From ea8ca04a7cb478c6c379e64e5db655fff9c0e15a Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 14 Feb 2015 15:08:07 +0100 Subject: Move Makefile (and auxiliary file replace.sh) into base folder. Adapt packaging these scripts: debian/roll-tarballs.sh debian/rules nx-libs.spec --- Makefile | 184 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 184 insertions(+) create mode 100644 Makefile (limited to 'Makefile') diff --git a/Makefile b/Makefile new file mode 100644 index 000000000..3aeda739b --- /dev/null +++ b/Makefile @@ -0,0 +1,184 @@ +#!/usr/bin/make -f + +INSTALL_DIR=install -d -m 755 +INSTALL_FILE=install -m 644 +INSTALL_PROGRAM=install -m 755 +INSTALL_SYMLINK=ln -s -f +COPY_SYMLINK=cp -a +RM_FILE=rm -f +RM_DIR=rmdir -p --ignore-fail-on-non-empty + +ETCDIR_NX ?= /etc/nxagent +ETCDIR_X2GO ?= /etc/x2go +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib +USRLIBDIR ?= $(LIBDIR) +INCLUDEDIR ?= $(PREFIX)/include +NXLIBDIR ?= $(PREFIX)/lib/nx +X2GOLIBDIR ?= $(PREFIX)/lib/x2go +CONFIGURE ?= ./configure + +SHELL:=/bin/bash + +%: + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi + if test -d nx-X11; then \ + if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ + if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ + fi + +all: build + +test: + echo "No testing for NX (redistributed)" + +build-lite: + cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} + +build-full: +# in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... + cd nxcomp && autoconf + cd nxcompext && autoconf + cd nxcompshad && autoconf + cd nx-X11 && ${MAKE} World + cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} + +build: + if ! test -d nx-X11; then \ + ${MAKE} build-lite; \ + else \ + ${MAKE} build-full; \ + fi + +install: + $(MAKE) install-lite + [ ! -d nx-X11 ] || $(MAKE) install-full + +install-lite: + $(INSTALL_DIR) $(DESTDIR)$(BINDIR) + for d in nxcomp nxproxy; do \ + $(MAKE) -C $$d install; done + mkdir -p $(DESTDIR)$(NXLIBDIR)/bin/ + mv $(DESTDIR)$(BINDIR)/nxproxy $(DESTDIR)$(NXLIBDIR)/bin/ + for f in nxproxy; do \ + $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nxproxy/man/nxproxy.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 + + +install-full: + for f in nxagent nxauth x2goagent; do \ + $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done + for d in nxcompext nxcompshad; do \ + $(MAKE) -C $$d install; done + + $(INSTALL_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ + cd $(DESTDIR)$(X2GOLIBDIR)/bin/ && ln -sf $(NXLIBDIR)/bin/nxagent x2goagent + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/x2go.xpm $(DESTDIR)$(PREFIX)/share/pixmaps + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx + $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go/versions + $(INSTALL_FILE) VERSION.x2goagent $(DESTDIR)$(PREFIX)/share/x2go/versions + + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_PROGRAM) nx-X11/programs/nxauth/nxauth $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/x2goagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ + $(INSTALL_FILE) nx-X11/programs/nxauth/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/ + mv -f $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.1 + gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 + + # create a clean nx-X11/.build-exports space + rm -Rf nx-X11/.build-exports + mkdir -p nx-X11/.build-exports/include + mkdir -p nx-X11/.build-exports/lib + + # copy headers (for libnx-x11-dev) + cp -aL nx-X11/exports/include/* nx-X11/.build-exports/include + + # copy libs (for libnx-x11), we want the targets of the links + . replace.sh; set -x; find nx-X11/exports/lib/ | grep -F ".so" | while read libpath; do \ + libfile=$$(basename $$libpath); \ + libdir=$$(dirname $$libpath); \ + link=$$(readlink $$libpath); \ + \ + mkdir -p "$$(string_rep "$$libdir" exports .build-exports)"; \ + cp -a "$$(string_rep "$$libpath" "$$libfile" "$$link")" "$$(string_rep "$$libdir" exports .build-exports)"; \ + done; + + $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) + $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(USRLIBDIR)/ + + . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | grep -v "include/X11/bitmaps" | \ + while read dirname; do \ + $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"; \ + $(INSTALL_FILE) $${dirname}/*.h \ + "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"/ || true; \ + done; \ + + # Provide means for Xinerama support in NX/X2Go sessions. This + # This also requires two post-install symlinks: + # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_X11.so.6 -> /usr//libX11.so.6 + # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama + $(INSTALL_SYMLINK) $(USRLIBDIR)/libNX_Xinerama.so.1 $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 + + $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps + $(INSTALL_FILE) nx-X11/.build-exports/include/X11/bitmaps/* \ + $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps/ + + $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) + $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) + $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ + $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_X2GO)/ + $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_X2GO)/ + $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_NX)/ + $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ + $(INSTALL_FILE) etc/x2goagent.keyboard $(DESTDIR)$(ETCDIR_X2GO)/ + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go + $(INSTALL_SYMLINK) $(ETCDIR_X2GO)/rgb $(DESTDIR)$(PREFIX)/share/x2go/rgb + + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx + $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb + +uninstall: + $(MAKE) uninstall-lite + [ ! -d nx-X11 ] || $(MAKE) uninstall-full + +uninstall-lite: + for f in nxproxy; do \ + $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + +uninstall-full: + for f in nxagent nxauth x2goagent; do \ + $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + + $(RM_FILE) $(DESTDIR)$(X2GOLIBDIR)/bin/x2goagent + $(RM_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ + + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi + + if test -d nx-X11; then \ + if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ + if test -f nx-X11/Makefile; then \ + if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi; \ + if test -d $(INCLUDEDIR)/nx; then rm -rf $(INCLUDEDIR)/nx; fi; \ + fi; \ + fi -- cgit v1.2.3 From e4d97018b4bed33afb3a6c61894272615f97e43d Mon Sep 17 00:00:00 2001 From: Mike DePaulo Date: Sat, 14 Feb 2015 17:07:21 -0500 Subject: Fix FTBFS due to the nxproxy executable already existing under /usr/lib/nx/bin/nx Conflicts (resolved by Mike Gabriel): debian/changelog --- Makefile | 2 -- debian/changelog | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 67 insertions(+), 4 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 3aeda739b..52326fb22 100644 --- a/Makefile +++ b/Makefile @@ -62,8 +62,6 @@ install-lite: $(INSTALL_DIR) $(DESTDIR)$(BINDIR) for d in nxcomp nxproxy; do \ $(MAKE) -C $$d install; done - mkdir -p $(DESTDIR)$(NXLIBDIR)/bin/ - mv $(DESTDIR)$(BINDIR)/nxproxy $(DESTDIR)$(NXLIBDIR)/bin/ for f in nxproxy; do \ $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done diff --git a/debian/changelog b/debian/changelog index 834868790..0eae634e9 100644 --- a/debian/changelog +++ b/debian/changelog @@ -125,8 +125,73 @@ nx-libs (2:3.5.0.29-0x2go2) UNRELEASED; urgency=medium (Fixes: #744). [ Michael DePaulo ] - * debian/rules: - + Fix build for LDFLAGS containing spaces. + * Security fixes: + - Rebase loads of X.Org patches (mainly from RHEL-5) against NX. If not + all patches from a CVE patch series appear here, then it means that + the affected file/code is not used in NX at build time. + + - X.Org CVE-2011-2895: + 1001-LZW-decompress-fix-for-CVE-2011-2895-From-xorg-lib-X.patch + - X.Org CVE-2011-4028: + 1002-Fix-CVE-2011-4028-File-disclosure-vulnerability.-ups.patch + - X.Org CVE-2013-4396: + 1003-Avoid-use-after-free-in-dix-dixfonts.c-doImageText-C.patch + - X.Org CVE-2013-6462: + 1004-CVE-2013-6462-unlimited-sscanf-overflows-stack-buffe.patch + - X.Org CVE-2014-0209: + 1005-CVE-2014-0209-integer-overflow-of-realloc-size-in-Fo.patch + 1006-CVE-2014-0209-integer-overflow-of-realloc-size-in-le.patch + - X.Org CVE-2014-0210: + 1007-CVE-2014-0210-unvalidated-length-in-_fs_recv_conn_se.patch + 1009-CVE-2014-0210-unvalidated-lengths-when-reading-repli.patch + 1011-CVE-2014-0210-unvalidated-length-fields-in-fs_read_q.patch + 1014-CVE-2014-0210-unvalidated-length-fields-in-fs_read_e.patch + 1015-CVE-2014-0210-unvalidated-length-fields-in-fs_read_g.patch + 1016-CVE-2014-0210-unvalidated-length-fields-in-fs_read_l.patch + 1017-CVE-2014-0210-unvalidated-length-fields-in-fs_read_l.patch + - X.Org CVE-2014-0211: + 1010-CVE-2014-0211-Integer-overflow-in-fs_get_reply-_fs_s.patch + 1012-CVE-2014-0211-integer-overflow-in-fs_read_extent_inf.patch + 1013-CVE-2014-0211-integer-overflow-in-fs_alloc_glyphs-fr.patch + 1018-unchecked-malloc-may-allow-unauthed-client-to-crash-.patch + - X.Org CVE-2014-8092: + 1019-dix-integer-overflow-in-ProcPutImage-CVE-2014-8092-1.patch + 1020-dix-integer-overflow-in-GetHosts-CVE-2014-8092-2-4.patch + 1021-dix-integer-overflow-in-RegionSizeof-CVE-2014-8092-3.patch + 1022-dix-integer-overflow-in-REQUEST_FIXED_SIZE-CVE-2014-.patch + - X.Org CVE-2014-8097: + 1023-dbe-unvalidated-lengths-in-DbeSwapBuffers-calls-CVE-.patch + - X.Org CVE-2014-8095: + 1024-Xi-unvalidated-lengths-in-Xinput-extension-CVE-2014-.patch + - X.Org CVE-2014-8096: + 1025-xcmisc-unvalidated-length-in-SProcXCMiscGetXIDList-C.patch + - X.Org CVE-2014-8099: + 1026-Xv-unvalidated-lengths-in-XVideo-extension-swapped-p.patch + - X.Org CVE-2014-8100: + 1027-render-check-request-size-before-reading-it-CVE-2014.patch + 1028-render-unvalidated-lengths-in-Render-extn.-swapped-p.patch + - X.Org CVE-2014-8102: + 1029-xfixes-unvalidated-length-in-SProcXFixesSelectSelect.patch + - X.Org CVE-2014-8101: + 1030-randr-unvalidated-lengths-in-RandR-extension-swapped.patch + - X.Org CVE-2014-8093: + 1031-glx-Be-more-paranoid-about-variable-length-requests-.patch + 1032-glx-Be-more-strict-about-rejecting-invalid-image-siz.patch + 1033-glx-Additional-paranoia-in-__glXGetAnswerBuffer-__GL.patch + 1034-glx-Add-safe_-add-mul-pad-v3-CVE-2014-8093-4-6-v4.patch + 1036-glx-Integer-overflow-protection-for-non-generated-re.patch + - X.Org CVE-2014-8098: + 1035-glx-Length-checking-for-GLXRender-requests-v2-CVE-20.patch + 1037-glx-Top-level-length-checking-for-swapped-VendorPriv.patch + 1038-glx-Length-checking-for-non-generated-single-request.patch + 1039-glx-Length-checking-for-RenderLarge-requests-v2-CVE-.patch + 1040-glx-Pass-remaining-request-length-into-varsize-v2-CV.patch + + - Security fixes with no assigned CVE: + 1008-Don-t-crash-when-we-receive-an-FS_Error-from-the-fon.patch + + - Fix FTBFS due to the nxproxy executable already existing under + /usr/lib/nx/bin/nx/ [ Mihai Moldovan ] * Change string "X2go" to "X2Go" where appropriate. -- cgit v1.2.3 From 892c08ddc4f4f7fc84b22081a53e4385a737ab23 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 16 Feb 2015 05:45:17 +0100 Subject: Make install-lite rule in Makefile.nx-libs more predictable and not rely on nxproxy/Makefile.in. --- Makefile | 15 ++++++++++----- debian/changelog | 2 ++ 2 files changed, 12 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 52326fb22..2c2cf3548 100644 --- a/Makefile +++ b/Makefile @@ -59,17 +59,22 @@ install: [ ! -d nx-X11 ] || $(MAKE) install-full install-lite: + # install nxcomp library + $(MAKE) -C nxcomp install + + # install nxproxy wrapper script $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - for d in nxcomp nxproxy; do \ - $(MAKE) -C $$d install; done - for f in nxproxy; do \ - $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done + $(INSTALL_PROGRAM) bin/nxproxy $(DESTDIR)$(BINDIR) + + # FIXME: the below install logic should work via nxproxy/Makefile.in + # overriding for now... + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_PROGRAM) nxproxy/nxproxy $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nxproxy/man/nxproxy.1 $(DESTDIR)$(PREFIX)/share/man/man1/ gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 - install-full: for f in nxagent nxauth x2goagent; do \ $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done diff --git a/debian/changelog b/debian/changelog index bd10412ed..ad42842bf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -34,6 +34,8 @@ nx-libs (2:3.5.0.29-0x2go2) UNRELEASED; urgency=medium * Add Description: and Author: fields to various patch headers. * Makefile.nx-libs: Run make install for nxproxy first, then create the wrapper script. + * Make install-lite rule in Makefile.nx-libs more predictable and not + rely on nxproxy/Makefile.in. * NX code reduction efforts (from 93Mb to 41Mb): - Drop more unused code in nx-X11/programs/Xserver/hw/. Do this in -- cgit v1.2.3 From db12538ddeb32db3bfd1882d2bb34ff00809301e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 16 Feb 2015 05:51:02 +0100 Subject: Makefile.nx-libs: Fix uninstall-lite rule. The nxproxy and nxcomp uninstallation has to be in uninstall-lite, not in uninstall-full. --- Makefile | 14 +++++++++----- debian/changelog | 2 ++ 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2c2cf3548..f0c8a978b 100644 --- a/Makefile +++ b/Makefile @@ -164,8 +164,15 @@ uninstall: [ ! -d nx-X11 ] || $(MAKE) uninstall-full uninstall-lite: - for f in nxproxy; do \ - $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + + # uninstall nproxy wrapper script + $(RM_FILE) $(DESTDIR)$(BINDIR)/nxproxy + # FIXME: don't use uninstall rule in nxproxy/Makefile.in, let's do + # it on our own for now... + $(RM_FILE) $(DESTDIR)$(NXLIBDIR)/bin/nxproxy + $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/bin/ + $(RM_FILE) $(DESTDIR)$(PREFIX)/share/man/man1/*.1 uninstall-full: for f in nxagent nxauth x2goagent; do \ @@ -174,9 +181,6 @@ uninstall-full: $(RM_FILE) $(DESTDIR)$(X2GOLIBDIR)/bin/x2goagent $(RM_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi - if test -d nx-X11; then \ if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ diff --git a/debian/changelog b/debian/changelog index ad42842bf..476fadac1 100644 --- a/debian/changelog +++ b/debian/changelog @@ -36,6 +36,8 @@ nx-libs (2:3.5.0.29-0x2go2) UNRELEASED; urgency=medium wrapper script. * Make install-lite rule in Makefile.nx-libs more predictable and not rely on nxproxy/Makefile.in. + * Makefile.nx-libs: Fix uninstall-lite rule. The nxproxy and nxcomp + uninstallation has to be in uninstall-lite, not in uninstall-full. * NX code reduction efforts (from 93Mb to 41Mb): - Drop more unused code in nx-X11/programs/Xserver/hw/. Do this in -- cgit v1.2.3 From 203d97147623b97a48c0f6456cc1de9d8364db03 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 16 Feb 2015 15:11:02 +0100 Subject: Make nxagent process aware of its current NX'ish version. This feature copies the way how X.Org version string and number are propagated at build time. First use case: if people start nxagent, it reports its version number on stderr. This is about being human-friendly. Second use case: None, so far. But it will now be easy to use the NXAGENT_VERSION_STRING in later feature add-ons. --- Makefile | 19 ++++++++++++++++ nx-X11/config/cf/Imakefile | 3 ++- nx-X11/config/cf/nxversion.def.in | 4 ++++ nx-X11/config/cf/xorg.cf | 26 ++++++++++++++++++++- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 7 +++++- nx-X11/programs/Xserver/hw/nxagent/Init.c | 5 ++-- version.sh | 34 ++++++++++++++++++++++++++++ 7 files changed, 93 insertions(+), 5 deletions(-) create mode 100644 nx-X11/config/cf/nxversion.def.in create mode 100755 version.sh (limited to 'Makefile') diff --git a/Makefile b/Makefile index f0c8a978b..2f8dda83a 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,11 @@ NXLIBDIR ?= $(PREFIX)/lib/nx X2GOLIBDIR ?= $(PREFIX)/lib/x2go CONFIGURE ?= ./configure +NX_VERSION_MAJOR=$(shell ./version.sh 1) +NX_VERSION_MINOR=$(shell ./version.sh 2) +NX_VERSION_MICRO=$(shell ./version.sh 3) +NX_VERSION_PATCH=$(shell ./version.sh 4) + SHELL:=/bin/bash %: @@ -44,7 +49,21 @@ build-full: cd nxcomp && autoconf cd nxcompext && autoconf cd nxcompshad && autoconf + + # prepare nx-X11/config/cf/nxversion.def + sed \ + -e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \ + -e 's/###NX_VERSION_MINOR###/$(NX_VERSION_MINOR)/' \ + -e 's/###NX_VERSION_MICRO###/$(NX_VERSION_MICRO)/' \ + -e 's/###NX_VERSION_PATCH###/$(NX_VERSION_PATCH)/' \ + nx-X11/config/cf/nxversion.def.in \ + > nx-X11/config/cf/nxversion.def + cd nx-X11 && ${MAKE} World + + # clean directly after build + rm -f nx-X11/config/cf/nxversion.def + cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} build: diff --git a/nx-X11/config/cf/Imakefile b/nx-X11/config/cf/Imakefile index 2eb7e995c..cbcec409e 100644 --- a/nx-X11/config/cf/Imakefile +++ b/nx-X11/config/cf/Imakefile @@ -27,7 +27,8 @@ xorgsite.def \ $(VERSIONDEFFILES) \ $(HOSTDEFFILES) \ site.def \ -xorgversion.def +xorgversion.def \ +nxversion.def RULEFILES = \ Imake.rules \ diff --git a/nx-X11/config/cf/nxversion.def.in b/nx-X11/config/cf/nxversion.def.in new file mode 100644 index 000000000..03ac921f4 --- /dev/null +++ b/nx-X11/config/cf/nxversion.def.in @@ -0,0 +1,4 @@ +#define NX_VERSION_MAJOR ###NX_VERSION_MAJOR### +#define NX_VERSION_MINOR ###NX_VERSION_MINOR### +#define NX_VERSION_MICRO ###NX_VERSION_MICRO### +#define NX_VERSION_PATCH ###NX_VERSION_PATCH### diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index 6c42574aa..71dab5631 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -54,6 +54,31 @@ XCOMM $Xorg: xfree86.cf,v 1.4 2000/08/17 19:41:49 cpqbld Exp $ XORG_VERSION_CURRENT = XorgVersion RELEASE_VERSION = ReleaseVersion +#if NXAgentServer +#include "nxversion.def" + +#if !defined(nxVersionString) && \ + defined(NX_VERSION_MAJOR) && defined(NX_VERSION_MINOR) && \ + defined(NX_VERSION_MICRO) && defined(NX_VERSION_PATCH) +# define nxVersionString `echo NX_VERSION_MAJOR NX_VERSION_MINOR NX_VERSION_MICRO NX_VERSION_PATCH | sed 's/ /./g'` +#endif + +/* + * NX versions are M.m.µ.p, and NXVersion is: + * + * M * 10000000 + m * 100000 + µ * 1000 + p + * + */ + +#if !defined(nxVersion) && defined(nxVersionString) +# define nxVersion (((NX_VERSION_MAJOR) * 10000000) + ((NX_VERSION_MINOR) * 100000) + ((NX_VERSION_MICRO) * 1000) + NX_VERSION_PATCH) + +NX_VERSION_CURRENT = nxVersion +NX_VERSION_CURRENT_STRING = nxVersionString + +#endif +#endif /* NXAgentServer */ + #if !defined(XorgManVersionString) && \ defined(XORG_VERSION_MAJOR) && defined(XORG_VERSION_MINOR) && \ defined(XORG_VERSION_PATCH) && defined(XORG_VERSION_SNAP) @@ -1686,4 +1711,3 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese #include #endif #include - diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index d812c7f70..6c075fa9f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -189,7 +189,12 @@ UPG_DEFINES=-DNXAGENT_UPGRADE UPG_DEFINES= #endif -DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) \ +#if nxVersion +NX_DEFINES=-DNX_VERSION_CURRENT="$(NX_VERSION_CURRENT)" \ + -DNX_VERSION_CURRENT_STRING="\"$(NX_VERSION_CURRENT_STRING)\"" +#endif + +DEFINES = -g $(OS_DEFINES) $(EXT_DEFINES) $(UPG_DEFINES) $(NX_DEFINES) \ -UXF86VIDMODE -UXFreeXDGA -UXF86MISC -UXF86DRI -UXFree86LOADER \ -DNXAGENT_SERVER \ -DNXAGENT_CONSTRAINCURSOR \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index 8d4eed2b6..dbc706cfe 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -74,7 +74,8 @@ is" without express or implied warranty. #undef DEBUG #undef DUMP -#define NXAGENT_VERSION "3.5.0" +#define NXAGENT_VERSION NX_VERSION_CURRENT +#define NXAGENT_VERSION_STRING NX_VERSION_CURRENT_STRING /* * ProcVector array defined in tables.c. @@ -226,7 +227,7 @@ void InitOutput(ScreenInfo *screenInfo, int argc, char *argv[]) if (serverGeneration <= 1) { - fprintf(stderr, "\nNXAGENT - Version " NXAGENT_VERSION "\n\n"); + fprintf(stderr, "\nNXAGENT - Version " NXAGENT_VERSION_STRING "\n\n"); fprintf(stderr, "Copyright (C) 2001, 2011 NoMachine.\n"); fprintf(stderr, "See http://www.nomachine.com/ for more information.\n\n"); diff --git a/version.sh b/version.sh new file mode 100755 index 000000000..891536890 --- /dev/null +++ b/version.sh @@ -0,0 +1,34 @@ +#!/bin/sh + +# Copyright (C) 2015 Mihai Moldovan +# Copyright (C) 2015 Mike Gabriel +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +COMPONENT="$1" +VERSION_FILE="VERSION" + +case "${COMPONENT}" in + (1|2|3|4) :;; + (*) echo "usage: $(basename ${0}) " >&2; exit 1;; +esac + +# More than one line is not supported. +VER="$(head -n "1" "${VERSION_FILE}" | cut -d"." -f"${COMPONENT}")" + +[ "x${VER}" = "x" ] && VER="0" + +printf "${VER}" -- cgit v1.2.3 From 18e186b517d56db2fb447cb92d27fb6857f9e763 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 5 Mar 2015 12:24:42 +0100 Subject: Makefile: clean-up auto-generated nxversion.def in clean rule (not in build rule). --- Makefile | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2f8dda83a..6400f21dd 100644 --- a/Makefile +++ b/Makefile @@ -35,6 +35,11 @@ SHELL:=/bin/bash if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ fi + # clean auto-generated nxversion.def file \ + if [ "x$@" == "xclean" ]; then \ + rm -f nx-X11/config/cf/nxversion.def; \ + fi + all: build test: @@ -61,9 +66,6 @@ build-full: cd nx-X11 && ${MAKE} World - # clean directly after build - rm -f nx-X11/config/cf/nxversion.def - cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} build: -- cgit v1.2.3 From e69b7d1ecf9672effd4715a4bc8d5bd729b5bd37 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Apr 2015 10:42:47 +0200 Subject: xbitmaps cleanup: The headers are not required at build time for NX. --- Makefile | 6 +- debian/rules | 1 - nx-X11/include/Imakefile | 2 +- nx-X11/include/bitmaps/1x1 | 6 - nx-X11/include/bitmaps/2x2 | 6 - nx-X11/include/bitmaps/Imakefile | 86 --- nx-X11/include/bitmaps/black | 6 - nx-X11/include/bitmaps/boxes | 6 - nx-X11/include/bitmaps/calculator | 19 - nx-X11/include/bitmaps/cntr_ptr | 8 - nx-X11/include/bitmaps/cntr_ptrmsk | 6 - nx-X11/include/bitmaps/cross_weave | 6 - nx-X11/include/bitmaps/dimple1 | 6 - nx-X11/include/bitmaps/dimple3 | 6 - nx-X11/include/bitmaps/dot | 6 - nx-X11/include/bitmaps/dropbar7 | 4 - nx-X11/include/bitmaps/dropbar8 | 4 - nx-X11/include/bitmaps/escherknot | 473 --------------- nx-X11/include/bitmaps/flagdown | 27 - nx-X11/include/bitmaps/flagup | 27 - nx-X11/include/bitmaps/flipped_gray | 4 - nx-X11/include/bitmaps/gray | 4 - nx-X11/include/bitmaps/gray1 | 4 - nx-X11/include/bitmaps/gray3 | 4 - nx-X11/include/bitmaps/grid16 | 6 - nx-X11/include/bitmaps/grid2 | 4 - nx-X11/include/bitmaps/grid4 | 4 - nx-X11/include/bitmaps/grid8 | 4 - nx-X11/include/bitmaps/hlines2 | 4 - nx-X11/include/bitmaps/hlines3 | 4 - nx-X11/include/bitmaps/icon | 6 - nx-X11/include/bitmaps/keyboard16 | 6 - nx-X11/include/bitmaps/left_ptr | 8 - nx-X11/include/bitmaps/left_ptrmsk | 6 - nx-X11/include/bitmaps/letters | 27 - nx-X11/include/bitmaps/light_gray | 4 - nx-X11/include/bitmaps/mailempty | 27 - nx-X11/include/bitmaps/mailemptymsk | 27 - nx-X11/include/bitmaps/mailfull | 27 - nx-X11/include/bitmaps/mailfullmsk | 27 - nx-X11/include/bitmaps/mensetmanus | 258 -------- nx-X11/include/bitmaps/menu10 | 5 - nx-X11/include/bitmaps/menu12 | 5 - nx-X11/include/bitmaps/menu16 | 6 - nx-X11/include/bitmaps/menu6 | 4 - nx-X11/include/bitmaps/menu8 | 4 - nx-X11/include/bitmaps/noletters | 27 - nx-X11/include/bitmaps/opendot | 8 - nx-X11/include/bitmaps/opendotMask | 8 - nx-X11/include/bitmaps/plaid | 11 - nx-X11/include/bitmaps/right_ptr | 8 - nx-X11/include/bitmaps/right_ptrmsk | 6 - nx-X11/include/bitmaps/root_weave | 4 - nx-X11/include/bitmaps/scales | 6 - nx-X11/include/bitmaps/sipb | 16 - nx-X11/include/bitmaps/star | 8 - nx-X11/include/bitmaps/starMask | 8 - nx-X11/include/bitmaps/stipple | 4 - nx-X11/include/bitmaps/target | 6 - nx-X11/include/bitmaps/terminal | 52 -- nx-X11/include/bitmaps/tie_fighter | 6 - nx-X11/include/bitmaps/vlines2 | 4 - nx-X11/include/bitmaps/vlines3 | 4 - nx-X11/include/bitmaps/weird_size | 5 - nx-X11/include/bitmaps/wide_weave | 6 - nx-X11/include/bitmaps/wingdogs | 14 - nx-X11/include/bitmaps/woman | 66 --- nx-X11/include/bitmaps/xfd_icon | 27 - nx-X11/include/bitmaps/xlogo11 | 6 - nx-X11/include/bitmaps/xlogo16 | 6 - nx-X11/include/bitmaps/xlogo32 | 14 - nx-X11/include/bitmaps/xlogo64 | 46 -- nx-X11/include/bitmaps/xsnow | 1112 ----------------------------------- nx-libs.spec | 1 - 74 files changed, 2 insertions(+), 2687 deletions(-) delete mode 100644 nx-X11/include/bitmaps/1x1 delete mode 100644 nx-X11/include/bitmaps/2x2 delete mode 100644 nx-X11/include/bitmaps/Imakefile delete mode 100644 nx-X11/include/bitmaps/black delete mode 100644 nx-X11/include/bitmaps/boxes delete mode 100644 nx-X11/include/bitmaps/calculator delete mode 100644 nx-X11/include/bitmaps/cntr_ptr delete mode 100644 nx-X11/include/bitmaps/cntr_ptrmsk delete mode 100644 nx-X11/include/bitmaps/cross_weave delete mode 100644 nx-X11/include/bitmaps/dimple1 delete mode 100644 nx-X11/include/bitmaps/dimple3 delete mode 100644 nx-X11/include/bitmaps/dot delete mode 100644 nx-X11/include/bitmaps/dropbar7 delete mode 100644 nx-X11/include/bitmaps/dropbar8 delete mode 100644 nx-X11/include/bitmaps/escherknot delete mode 100644 nx-X11/include/bitmaps/flagdown delete mode 100644 nx-X11/include/bitmaps/flagup delete mode 100644 nx-X11/include/bitmaps/flipped_gray delete mode 100644 nx-X11/include/bitmaps/gray delete mode 100644 nx-X11/include/bitmaps/gray1 delete mode 100644 nx-X11/include/bitmaps/gray3 delete mode 100644 nx-X11/include/bitmaps/grid16 delete mode 100644 nx-X11/include/bitmaps/grid2 delete mode 100644 nx-X11/include/bitmaps/grid4 delete mode 100644 nx-X11/include/bitmaps/grid8 delete mode 100644 nx-X11/include/bitmaps/hlines2 delete mode 100644 nx-X11/include/bitmaps/hlines3 delete mode 100644 nx-X11/include/bitmaps/icon delete mode 100644 nx-X11/include/bitmaps/keyboard16 delete mode 100644 nx-X11/include/bitmaps/left_ptr delete mode 100644 nx-X11/include/bitmaps/left_ptrmsk delete mode 100644 nx-X11/include/bitmaps/letters delete mode 100644 nx-X11/include/bitmaps/light_gray delete mode 100644 nx-X11/include/bitmaps/mailempty delete mode 100644 nx-X11/include/bitmaps/mailemptymsk delete mode 100644 nx-X11/include/bitmaps/mailfull delete mode 100644 nx-X11/include/bitmaps/mailfullmsk delete mode 100644 nx-X11/include/bitmaps/mensetmanus delete mode 100644 nx-X11/include/bitmaps/menu10 delete mode 100644 nx-X11/include/bitmaps/menu12 delete mode 100644 nx-X11/include/bitmaps/menu16 delete mode 100644 nx-X11/include/bitmaps/menu6 delete mode 100644 nx-X11/include/bitmaps/menu8 delete mode 100644 nx-X11/include/bitmaps/noletters delete mode 100644 nx-X11/include/bitmaps/opendot delete mode 100644 nx-X11/include/bitmaps/opendotMask delete mode 100644 nx-X11/include/bitmaps/plaid delete mode 100644 nx-X11/include/bitmaps/right_ptr delete mode 100644 nx-X11/include/bitmaps/right_ptrmsk delete mode 100644 nx-X11/include/bitmaps/root_weave delete mode 100644 nx-X11/include/bitmaps/scales delete mode 100644 nx-X11/include/bitmaps/sipb delete mode 100644 nx-X11/include/bitmaps/star delete mode 100644 nx-X11/include/bitmaps/starMask delete mode 100644 nx-X11/include/bitmaps/stipple delete mode 100644 nx-X11/include/bitmaps/target delete mode 100644 nx-X11/include/bitmaps/terminal delete mode 100644 nx-X11/include/bitmaps/tie_fighter delete mode 100644 nx-X11/include/bitmaps/vlines2 delete mode 100644 nx-X11/include/bitmaps/vlines3 delete mode 100644 nx-X11/include/bitmaps/weird_size delete mode 100644 nx-X11/include/bitmaps/wide_weave delete mode 100644 nx-X11/include/bitmaps/wingdogs delete mode 100644 nx-X11/include/bitmaps/woman delete mode 100644 nx-X11/include/bitmaps/xfd_icon delete mode 100644 nx-X11/include/bitmaps/xlogo11 delete mode 100644 nx-X11/include/bitmaps/xlogo16 delete mode 100644 nx-X11/include/bitmaps/xlogo32 delete mode 100644 nx-X11/include/bitmaps/xlogo64 delete mode 100644 nx-X11/include/bitmaps/xsnow (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6400f21dd..9f6442181 100644 --- a/Makefile +++ b/Makefile @@ -147,7 +147,7 @@ install-full: $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(USRLIBDIR)/ - . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | grep -v "include/X11/bitmaps" | \ + . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | \ while read dirname; do \ $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"; \ $(INSTALL_FILE) $${dirname}/*.h \ @@ -161,10 +161,6 @@ install-full: $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama $(INSTALL_SYMLINK) $(USRLIBDIR)/libNX_Xinerama.so.1 $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 - $(INSTALL_DIR) $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps - $(INSTALL_FILE) nx-X11/.build-exports/include/X11/bitmaps/* \ - $(DESTDIR)$(INCLUDEDIR)/nx/X11/bitmaps/ - $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ diff --git a/debian/rules b/debian/rules index dd4f1c7c2..0da6db71a 100755 --- a/debian/rules +++ b/debian/rules @@ -43,7 +43,6 @@ override_dh_install: # remove extras, GL, and other unneeded headers rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/GL/ - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/bitmaps/ rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XInput.h rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XK*.h rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/*Xv*.h diff --git a/nx-X11/include/Imakefile b/nx-X11/include/Imakefile index 39d330d04..74d775b75 100644 --- a/nx-X11/include/Imakefile +++ b/nx-X11/include/Imakefile @@ -15,7 +15,7 @@ GLXDIR = GL DPSDIR = DPS #endif -SUBDIRS = bitmaps extensions $(GLXDIR) $(DPSDIR) +SUBDIRS = extensions $(GLXDIR) $(DPSDIR) #ifdef Win32Architecture EXTRA_HEADERS = Xw32defs.h Xwinsock.h Xwindows.h diff --git a/nx-X11/include/bitmaps/1x1 b/nx-X11/include/bitmaps/1x1 deleted file mode 100644 index 6d013d4af..000000000 --- a/nx-X11/include/bitmaps/1x1 +++ /dev/null @@ -1,6 +0,0 @@ -#define 1x1_width 16 -#define 1x1_height 16 -static char 1x1_bits[] = { - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55, - 0xff, 0xff, 0x55, 0x55, 0xff, 0xff, 0x55, 0x55}; diff --git a/nx-X11/include/bitmaps/2x2 b/nx-X11/include/bitmaps/2x2 deleted file mode 100644 index 8490457a1..000000000 --- a/nx-X11/include/bitmaps/2x2 +++ /dev/null @@ -1,6 +0,0 @@ -#define 2x2_width 16 -#define 2x2_height 16 -static char 2x2_bits[] = { - 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff, - 0x33, 0x33, 0x33, 0x33, 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33, - 0xff, 0xff, 0xff, 0xff, 0x33, 0x33, 0x33, 0x33}; diff --git a/nx-X11/include/bitmaps/Imakefile b/nx-X11/include/bitmaps/Imakefile deleted file mode 100644 index 4e1ec0b0b..000000000 --- a/nx-X11/include/bitmaps/Imakefile +++ /dev/null @@ -1,86 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/18 04:05:43 coskrey Exp $ - - - -XCOMM $XFree86$ - -HEADERS = \ - 1x1 \ - 2x2 \ - black \ - boxes \ - calculator \ - cntr_ptr \ - cntr_ptrmsk \ - cross_weave \ - dimple1 \ - dimple3 \ - dot \ - dropbar7 \ - dropbar8 \ - escherknot \ - flagdown \ - flagup \ - flipped_gray \ - gray \ - gray1 \ - gray3 \ - grid2 \ - grid4 \ - grid8 \ - grid16 \ - hlines2 \ - hlines3 \ - icon \ - keyboard16 \ - left_ptr \ - left_ptrmsk \ - letters \ - light_gray \ - mailempty \ - mailemptymsk \ - mailfull \ - mailfullmsk \ - mensetmanus \ - menu6 \ - menu8 \ - menu10 \ - menu12 \ - menu16 \ - noletters \ - opendot \ - opendotMask \ - plaid \ - right_ptr \ - right_ptrmsk \ - root_weave \ - scales \ - sipb \ - star \ - starMask \ - stipple \ - target \ - terminal \ - tie_fighter \ - vlines2 \ - vlines3 \ - weird_size \ - wide_weave \ - wingdogs \ - woman \ - xfd_icon \ - xlogo11 \ - xlogo16 \ - xlogo32 \ - xlogo64 \ - xsnow - - -all:: - -BuildIncludes($(HEADERS),X11/bitmaps,../..) - -#if BuildLibraries -InstallMultipleFlags($(HEADERS),$(INCDIR)/X11/bitmaps,$(INSTINCFLAGS)) -#endif - diff --git a/nx-X11/include/bitmaps/black b/nx-X11/include/bitmaps/black deleted file mode 100644 index 3a1ec90a3..000000000 --- a/nx-X11/include/bitmaps/black +++ /dev/null @@ -1,6 +0,0 @@ -#define black_width 16 -#define black_height 16 -static char black_bits[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; diff --git a/nx-X11/include/bitmaps/boxes b/nx-X11/include/bitmaps/boxes deleted file mode 100644 index 0deb80130..000000000 --- a/nx-X11/include/bitmaps/boxes +++ /dev/null @@ -1,6 +0,0 @@ -#define boxes_width 16 -#define boxes_height 16 -static char boxes_bits[] = { - 0x0f, 0x0f, 0x09, 0x09, 0x09, 0x09, 0x0f, 0x0f, 0xf0, 0xf0, 0x90, 0x90, - 0x90, 0x90, 0xf0, 0xf0, 0x0f, 0x0f, 0x09, 0x09, 0x09, 0x09, 0x0f, 0x0f, - 0xf0, 0xf0, 0x90, 0x90, 0x90, 0x90, 0xf0, 0xf0}; diff --git a/nx-X11/include/bitmaps/calculator b/nx-X11/include/bitmaps/calculator deleted file mode 100644 index 2be3b9d5a..000000000 --- a/nx-X11/include/bitmaps/calculator +++ /dev/null @@ -1,19 +0,0 @@ -#define icon_width 28 -#define icon_height 48 -static char icon_bits[] = { - 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x03, 0x00, 0x00, 0x0c, - 0xd3, 0x5d, 0x5d, 0x0c, 0x13, 0x51, 0x45, 0x0c, 0xd3, 0xdd, 0xdd, 0x0d, - 0x53, 0x10, 0x51, 0x0d, 0xd3, 0x1d, 0xdd, 0x0d, 0x03, 0x00, 0x00, 0x0c, - 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x00, 0x08, - 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, - 0xbd, 0xf7, 0xde, 0x0b, 0xa5, 0x94, 0x52, 0x0a, 0xbd, 0xf7, 0xde, 0x0b, - 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, - 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, - 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, - 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, - 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, - 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, - 0x01, 0x00, 0x00, 0x08, 0xbd, 0xf7, 0xde, 0x0b, 0xbd, 0x94, 0xd2, 0x0b, - 0xbd, 0x94, 0xd2, 0x0b, 0xbd, 0xf7, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, - 0xbd, 0xff, 0xde, 0x0b, 0xbd, 0x80, 0xd2, 0x0b, 0xbd, 0x80, 0xd2, 0x0b, - 0xbd, 0xff, 0xde, 0x0b, 0x01, 0x00, 0x00, 0x08, 0xff, 0xff, 0xff, 0x0f}; diff --git a/nx-X11/include/bitmaps/cntr_ptr b/nx-X11/include/bitmaps/cntr_ptr deleted file mode 100644 index eddb25f1e..000000000 --- a/nx-X11/include/bitmaps/cntr_ptr +++ /dev/null @@ -1,8 +0,0 @@ -#define cntr_ptr_width 16 -#define cntr_ptr_height 16 -#define cntr_ptr_x_hot 7 -#define cntr_ptr_y_hot 1 -static char cntr_ptr_bits[] = { - 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, - 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, 0x98, 0x19, 0x88, 0x11, 0x80, 0x01, - 0x80, 0x01, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/cntr_ptrmsk b/nx-X11/include/bitmaps/cntr_ptrmsk deleted file mode 100644 index d3607a4ba..000000000 --- a/nx-X11/include/bitmaps/cntr_ptrmsk +++ /dev/null @@ -1,6 +0,0 @@ -#define cntr_ptrmsk_width 16 -#define cntr_ptrmsk_height 16 -static char cntr_ptrmsk_bits[] = { - 0xc0, 0x03, 0xc0, 0x03, 0xe0, 0x07, 0xe0, 0x07, 0xf0, 0x0f, 0xf0, 0x0f, - 0xf8, 0x1f, 0xf8, 0x1f, 0xfc, 0x3f, 0xfc, 0x3f, 0xfc, 0x3f, 0xdc, 0x3b, - 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03, 0xc0, 0x03}; diff --git a/nx-X11/include/bitmaps/cross_weave b/nx-X11/include/bitmaps/cross_weave deleted file mode 100644 index 40de9e426..000000000 --- a/nx-X11/include/bitmaps/cross_weave +++ /dev/null @@ -1,6 +0,0 @@ -#define cross_weave_width 16 -#define cross_weave_height 16 -static char cross_weave_bits[] = { - 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, - 0x55, 0x55, 0x22, 0x22, 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22, - 0x55, 0x55, 0x88, 0x88, 0x55, 0x55, 0x22, 0x22}; diff --git a/nx-X11/include/bitmaps/dimple1 b/nx-X11/include/bitmaps/dimple1 deleted file mode 100644 index 9144605a8..000000000 --- a/nx-X11/include/bitmaps/dimple1 +++ /dev/null @@ -1,6 +0,0 @@ -#define dimple1_width 16 -#define dimple1_height 16 -static char dimple1_bits[] = { - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00, - 0x55, 0x55, 0x00, 0x00, 0x55, 0x55, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/dimple3 b/nx-X11/include/bitmaps/dimple3 deleted file mode 100644 index 209b4e8b2..000000000 --- a/nx-X11/include/bitmaps/dimple3 +++ /dev/null @@ -1,6 +0,0 @@ -#define dimple3_width 16 -#define dimple3_height 16 -static char dimple3_bits[] = { - 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/dot b/nx-X11/include/bitmaps/dot deleted file mode 100644 index e403eebe9..000000000 --- a/nx-X11/include/bitmaps/dot +++ /dev/null @@ -1,6 +0,0 @@ -#define dot_width 16 -#define dot_height 16 -static char dot_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xf0, 0x0f, 0xf0, 0x0f, - 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf8, 0x1f, 0xf0, 0x0f, 0xf0, 0x0f, - 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/dropbar7 b/nx-X11/include/bitmaps/dropbar7 deleted file mode 100644 index 26893009b..000000000 --- a/nx-X11/include/bitmaps/dropbar7 +++ /dev/null @@ -1,4 +0,0 @@ -#define bar7_width 7 -#define bar7_height 7 -static char bar7_bits[] = { - 0x00, 0x3f, 0x61, 0x61, 0x7f, 0x7e, 0x00}; diff --git a/nx-X11/include/bitmaps/dropbar8 b/nx-X11/include/bitmaps/dropbar8 deleted file mode 100644 index d7cfdeb9a..000000000 --- a/nx-X11/include/bitmaps/dropbar8 +++ /dev/null @@ -1,4 +0,0 @@ -#define dropbar8_width 8 -#define dropbar8_height 8 -static char dropbar8_bits[] = { - 0x00, 0x7f, 0xc1, 0xc1, 0xc1, 0xff, 0xfe, 0x00}; diff --git a/nx-X11/include/bitmaps/escherknot b/nx-X11/include/bitmaps/escherknot deleted file mode 100644 index 80bc471b2..000000000 --- a/nx-X11/include/bitmaps/escherknot +++ /dev/null @@ -1,473 +0,0 @@ -#define escherknot_width 216 -#define escherknot_height 208 - -static char escherknot_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfa, 0x5f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0x6f, 0xf6, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xff, 0x3a, 0x13, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x0d, 0x02, 0x51, 0x71, 0x0e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x2f, 0x20, 0xd9, 0x88, - 0x9b, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x82, - 0xac, 0x44, 0x4e, 0x1c, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x1e, 0x40, 0x02, 0x44, 0x60, 0xe2, 0xfc, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x25, 0x09, 0x90, 0x22, 0x13, 0xb7, 0x9a, 0x1e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x40, 0x10, 0x89, - 0x18, 0xe3, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x04, 0x08, - 0x01, 0x10, 0xc8, 0xa8, 0xd5, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x83, 0x80, 0x20, 0x40, 0x82, 0x00, 0x66, 0x9c, 0xec, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x08, 0x08, 0x24, 0x12, 0x93, 0x5b, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x12, 0x80, 0x04, 0x01, 0x00, 0x80, - 0x19, 0x33, 0xfa, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x80, 0x80, 0x00, - 0x20, 0x08, 0x12, 0xc4, 0x68, 0x26, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x02, 0x04, 0x24, 0x00, 0x01, 0x40, 0x24, 0x8c, 0xcd, 0x3f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x00, - 0x00, 0x80, 0x49, 0x10, 0x90, 0x00, 0x21, 0x20, 0x08, 0x11, 0x43, 0xd9, - 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, - 0xff, 0xff, 0x0b, 0x00, 0x60, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x30, 0xb9, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x97, 0x04, 0x08, 0xfe, 0x05, 0x30, 0x10, 0x12, 0x20, 0x20, - 0x04, 0x00, 0x80, 0x48, 0x0c, 0xa3, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3e, 0x92, 0x20, 0x49, 0x40, 0x3e, 0x0e, 0x82, - 0x00, 0x84, 0x25, 0x01, 0x80, 0x00, 0x80, 0xc8, 0x34, 0xed, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x25, 0x01, 0x04, 0x01, 0x08, - 0xd0, 0x17, 0x00, 0x80, 0x25, 0x01, 0xad, 0x04, 0x12, 0x20, 0x23, 0x4c, - 0x6a, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x5c, 0x02, 0x48, - 0x92, 0x20, 0x41, 0x92, 0x9e, 0x80, 0x24, 0x24, 0x29, 0x00, 0x04, 0x00, - 0x10, 0x98, 0xcc, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x4f, 0x10, 0x01, 0x90, 0x24, 0x40, 0x12, 0xf0, 0x00, 0x24, 0x41, 0x0b, - 0xa9, 0x10, 0x00, 0x00, 0x04, 0xd9, 0x96, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x00, 0x92, 0x48, 0x02, 0x04, 0x09, 0xc0, 0x84, 0x8f, - 0x29, 0x2d, 0xf8, 0xa9, 0x02, 0x00, 0x00, 0x20, 0x90, 0xf4, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x98, 0x24, 0x91, 0x04, 0x50, 0x22, 0x24, - 0x1b, 0x12, 0x7a, 0x48, 0xca, 0x03, 0x21, 0x10, 0x00, 0x00, 0x48, 0x93, - 0xff, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9e, 0x24, 0x92, 0x20, - 0x81, 0xda, 0x24, 0xc8, 0x16, 0xd0, 0xe7, 0x50, 0xd2, 0xbf, 0x03, 0x00, - 0x80, 0x00, 0x30, 0x29, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, - 0x20, 0x80, 0x24, 0x41, 0x12, 0x2a, 0x41, 0xb2, 0x80, 0x33, 0x0e, 0x7e, - 0x88, 0x1c, 0x01, 0x00, 0xa0, 0x24, 0x69, 0x75, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x82, 0x44, 0x11, 0x24, 0x09, 0x90, 0xa4, 0x4d, 0xd2, 0x92, - 0x9e, 0xd3, 0x83, 0x6b, 0x62, 0x00, 0x00, 0x10, 0x22, 0xff, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x30, 0x42, 0x04, 0x92, 0x24, 0x6b, 0x53, 0x32, - 0x59, 0x90, 0x16, 0xfa, 0xb4, 0xf4, 0xff, 0x0f, 0x01, 0x00, 0x90, 0x68, - 0x4a, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x28, 0x90, 0x24, 0x11, 0x24, - 0x49, 0xda, 0x82, 0xc5, 0x92, 0xd2, 0xd0, 0x9e, 0x1e, 0x00, 0x78, 0x0a, - 0x00, 0x00, 0x05, 0xd2, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, 0x4c, 0x02, - 0x44, 0xb2, 0x65, 0xea, 0x49, 0x9e, 0x2c, 0x4b, 0x1a, 0xd2, 0xeb, 0xe3, - 0xff, 0xc7, 0x09, 0x00, 0x20, 0x68, 0xff, 0xd6, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x0b, 0x90, 0x40, 0x92, 0x24, 0x09, 0x5f, 0xd2, 0x64, 0x59, 0x72, - 0x56, 0x7f, 0xfd, 0xdf, 0x1f, 0x12, 0x00, 0x20, 0x49, 0x92, 0xde, 0x01, - 0x00, 0x00, 0x00, 0x80, 0x41, 0x92, 0x4c, 0x92, 0x24, 0x25, 0xc9, 0x8b, - 0x2e, 0xcb, 0x92, 0x4b, 0x5a, 0x2f, 0x75, 0xf4, 0x04, 0x00, 0x00, 0x41, - 0xf6, 0x74, 0x01, 0x00, 0x00, 0x00, 0x40, 0x49, 0x02, 0x00, 0xba, 0xb6, - 0xfd, 0x49, 0xf8, 0x74, 0x6d, 0x4b, 0x72, 0xed, 0xdb, 0xff, 0xcf, 0x53, - 0x00, 0x00, 0x48, 0xb6, 0xd7, 0x03, 0x00, 0x00, 0x00, 0x60, 0x48, 0x10, - 0xc9, 0x93, 0x24, 0x00, 0x7b, 0xc3, 0xa6, 0x69, 0x58, 0x5a, 0xfb, 0xfa, - 0xa5, 0xbe, 0x16, 0x00, 0x00, 0x92, 0xa4, 0xfd, 0x03, 0x00, 0x00, 0x00, - 0x30, 0x01, 0x20, 0x5d, 0xa2, 0xfe, 0x7f, 0x01, 0x4f, 0x1a, 0xcd, 0x6b, - 0x6a, 0xa9, 0x5f, 0xff, 0xf3, 0x24, 0x01, 0x40, 0xc0, 0xb4, 0xf4, 0x03, - 0x00, 0x00, 0x00, 0x2c, 0x88, 0x84, 0x89, 0xb6, 0x00, 0x24, 0x7d, 0x69, - 0xf2, 0x34, 0xad, 0x99, 0x2d, 0xf7, 0xff, 0x9f, 0x4b, 0x00, 0x00, 0x92, - 0xa6, 0xad, 0x07, 0x00, 0x00, 0x00, 0x06, 0x91, 0x24, 0xe9, 0xa4, 0xfd, - 0xa5, 0xa9, 0x4b, 0x93, 0xe7, 0x34, 0x63, 0xf9, 0xfc, 0xd5, 0xef, 0x16, - 0x00, 0x40, 0x90, 0xb4, 0xbd, 0x07, 0x00, 0x00, 0x00, 0x6a, 0x80, 0x4c, - 0x96, 0xbe, 0x2d, 0xfd, 0x2f, 0x7c, 0x5e, 0x9c, 0x67, 0xad, 0xa5, 0xfd, - 0xff, 0xbf, 0x29, 0x00, 0x00, 0x92, 0x76, 0xed, 0x06, 0x00, 0x00, 0x00, - 0x05, 0x12, 0x48, 0x53, 0x25, 0x65, 0x25, 0xf4, 0xe5, 0xd3, 0x72, 0x9c, - 0x35, 0xdf, 0xf6, 0x7f, 0xf5, 0x56, 0x00, 0x00, 0x92, 0xa4, 0xed, 0x0f, - 0x00, 0x00, 0x80, 0x49, 0x20, 0x59, 0x38, 0xec, 0xff, 0xff, 0xad, 0x2f, - 0x5d, 0xd3, 0x33, 0xe6, 0x24, 0xed, 0xff, 0xdf, 0x2d, 0x01, 0x40, 0x80, - 0x24, 0xbd, 0x07, 0x00, 0x00, 0xc0, 0x48, 0x24, 0x49, 0x87, 0x37, 0x21, - 0xa0, 0xbd, 0xf4, 0x79, 0x4f, 0xc7, 0x9c, 0xde, 0xf6, 0xff, 0xff, 0x5b, - 0x08, 0x00, 0x92, 0xfc, 0xe9, 0x0e, 0x00, 0x00, 0x20, 0x89, 0x40, 0xd3, - 0xf4, 0x49, 0xff, 0xff, 0xe7, 0x2f, 0xcf, 0x79, 0x9c, 0x53, 0xb2, 0x35, - 0xff, 0xff, 0x37, 0x00, 0x40, 0x90, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x30, - 0x91, 0x49, 0x32, 0x2d, 0xff, 0x6b, 0xb7, 0xbd, 0xbc, 0x3c, 0xef, 0x79, - 0xce, 0xde, 0xd6, 0xfd, 0xff, 0x9f, 0x00, 0x00, 0x92, 0xa6, 0xad, 0x0b, - 0x00, 0x00, 0x30, 0x11, 0x89, 0x8c, 0xcb, 0x5b, 0xba, 0xaf, 0xf6, 0xd7, - 0xe7, 0x35, 0xe7, 0x59, 0xb3, 0xfb, 0xff, 0xff, 0x7f, 0x04, 0x40, 0x80, - 0xe4, 0xb9, 0x1f, 0x00, 0x00, 0x48, 0x22, 0x91, 0x66, 0x79, 0xeb, 0xff, - 0xff, 0xdf, 0xbe, 0xbe, 0xe7, 0x8c, 0x75, 0x6b, 0x4a, 0xfa, 0xbf, 0x7f, - 0x00, 0x00, 0x82, 0x24, 0xef, 0x0e, 0x00, 0x00, 0x4c, 0x22, 0xb2, 0x79, - 0x5e, 0xfa, 0x5b, 0xa9, 0xfd, 0xeb, 0xf5, 0x9c, 0x3d, 0xc6, 0xcc, 0xee, - 0xed, 0x01, 0xf8, 0x00, 0x40, 0x82, 0xb6, 0xa9, 0x1b, 0x00, 0x00, 0x94, - 0x64, 0x66, 0x8e, 0xd3, 0x97, 0xfe, 0xff, 0xd7, 0xdf, 0x9f, 0x7b, 0xf3, - 0x3c, 0x35, 0x59, 0x6b, 0x00, 0x70, 0x00, 0x00, 0x40, 0xe4, 0xed, 0x1e, - 0x00, 0x00, 0x92, 0xc4, 0x34, 0xf3, 0xfc, 0xfd, 0x5f, 0xad, 0x7d, 0xfa, - 0x7a, 0xce, 0x8e, 0xb3, 0x76, 0x2f, 0xfd, 0x00, 0xe0, 0x04, 0x00, 0x9a, - 0x26, 0xaf, 0x1e, 0x00, 0x00, 0x13, 0x88, 0xcc, 0xb5, 0x3f, 0xbf, 0xff, - 0xff, 0xd7, 0xef, 0xef, 0xbd, 0x79, 0x6a, 0xde, 0xec, 0xab, 0x01, 0xc0, - 0x00, 0x00, 0x40, 0xb6, 0xbd, 0x1b, 0x00, 0x00, 0x05, 0x91, 0xeb, 0x5c, - 0xeb, 0xeb, 0xff, 0xff, 0xff, 0x7e, 0xef, 0x6b, 0xef, 0xcd, 0x99, 0xb3, - 0xe4, 0x07, 0x80, 0x00, 0x40, 0x49, 0xb2, 0xe5, 0x1a, 0x00, 0x80, 0x20, - 0x32, 0xb1, 0xe7, 0x79, 0x7f, 0xf7, 0xff, 0xfd, 0xeb, 0xbd, 0xfe, 0x2c, - 0x3d, 0x6b, 0xb6, 0xaf, 0x06, 0x80, 0x00, 0x00, 0x41, 0x96, 0xfe, 0x1e, - 0x00, 0x80, 0x44, 0xb2, 0x9b, 0xf9, 0xde, 0xff, 0xff, 0xff, 0x7f, 0xbf, - 0xf7, 0xbb, 0xb3, 0x77, 0xce, 0xce, 0xb6, 0x0d, 0x80, 0x01, 0x00, 0x49, - 0xf2, 0x94, 0x1f, 0x00, 0x40, 0x49, 0x44, 0xe6, 0x9e, 0x77, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xbf, 0xf7, 0x7e, 0xd6, 0xbc, 0xd9, 0xba, 0x3b, 0x80, - 0x00, 0x00, 0x64, 0x93, 0xf7, 0x1b, 0x00, 0x40, 0x89, 0xec, 0x7e, 0x67, - 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xce, 0xdb, 0x99, 0x33, 0x37, - 0xd3, 0x36, 0x80, 0x01, 0x80, 0x24, 0xda, 0xd6, 0x1e, 0x00, 0x20, 0x90, - 0x99, 0x99, 0x7b, 0xef, 0xfb, 0xff, 0xff, 0xff, 0xff, 0xef, 0xbd, 0x37, - 0x63, 0xf3, 0x66, 0xdb, 0x7a, 0x80, 0x00, 0x00, 0x24, 0x59, 0xde, 0x1f, - 0x00, 0x60, 0x12, 0xb3, 0xf7, 0xdd, 0xfb, 0xfe, 0xff, 0xff, 0xff, 0xff, - 0xbf, 0xf7, 0xfe, 0x6e, 0xce, 0xdd, 0x6d, 0xd7, 0x80, 0x00, 0x80, 0x20, - 0xcb, 0xfb, 0x1f, 0x00, 0x10, 0x20, 0x6e, 0x66, 0x76, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xef, 0xde, 0xdb, 0x9b, 0x99, 0xb3, 0x5d, 0x6b, 0x81, - 0x00, 0x40, 0x96, 0x59, 0x6a, 0x1f, 0x00, 0x98, 0xc4, 0xe4, 0xdf, 0xff, - 0xfb, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x7b, 0x6f, 0x7b, 0x37, 0x7f, - 0xb3, 0xdd, 0x83, 0x00, 0x00, 0xb0, 0xed, 0xef, 0x1d, 0x00, 0x10, 0x88, - 0x9e, 0xdd, 0xcd, 0xbd, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xed, - 0x6c, 0xe6, 0xcc, 0x76, 0x6d, 0xc1, 0x00, 0x40, 0x91, 0x24, 0x7b, 0x1f, - 0x00, 0x08, 0xd1, 0xf1, 0x66, 0x76, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xdf, 0xbd, 0xbf, 0xd9, 0xdd, 0xdd, 0xb6, 0x47, 0x00, 0x00, 0xd8, - 0xb4, 0xad, 0x1f, 0x00, 0x24, 0x24, 0x6f, 0xf6, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x7f, 0x7f, 0xb7, 0x9d, 0x33, 0xd9, 0x96, 0x4e, - 0x00, 0x20, 0x49, 0xf7, 0xfd, 0x1e, 0x00, 0x48, 0xe4, 0xac, 0xb9, 0xdd, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xdd, 0x76, 0xb6, - 0xb7, 0xfd, 0x7a, 0x00, 0x00, 0x44, 0x96, 0xb7, 0x1f, 0x00, 0x02, 0x9a, - 0xbe, 0x6f, 0x77, 0xff, 0xff, 0x7f, 0x61, 0xd9, 0xff, 0xff, 0xff, 0xfd, - 0xdd, 0x66, 0xed, 0x66, 0x5b, 0x37, 0x00, 0x90, 0x64, 0xb9, 0xf6, 0x1f, - 0x00, 0x02, 0xc9, 0xf3, 0xee, 0xfd, 0xff, 0xff, 0x2f, 0x24, 0x4f, 0xfe, - 0xff, 0xff, 0x7f, 0x37, 0xdb, 0xcd, 0x7c, 0xff, 0x3a, 0x00, 0x88, 0x24, - 0xdb, 0xde, 0x1a, 0x00, 0x13, 0x31, 0x6f, 0xbb, 0xdf, 0xff, 0xff, 0x21, - 0xa0, 0x64, 0xf3, 0xff, 0xff, 0xe7, 0xff, 0x96, 0xbb, 0x9b, 0xa5, 0x1d, - 0x00, 0x60, 0x32, 0xe9, 0xdb, 0x0f, 0x00, 0x65, 0xe6, 0x3c, 0xfb, 0xf6, - 0xff, 0x7f, 0x10, 0xa4, 0xb5, 0x9d, 0xfe, 0xdf, 0xdf, 0xdd, 0x6d, 0x32, - 0xb3, 0x7d, 0x0d, 0x00, 0x0b, 0x93, 0x7c, 0x7b, 0x0f, 0x00, 0x89, 0xdc, - 0xb3, 0xed, 0xfb, 0xff, 0x1f, 0x10, 0x90, 0x92, 0xd9, 0xfe, 0x7f, 0xff, - 0x77, 0xdb, 0xee, 0x6e, 0xdb, 0x0e, 0x00, 0x20, 0xdd, 0x66, 0x6f, 0x0f, - 0x80, 0x91, 0x5a, 0xfb, 0xbe, 0xef, 0xff, 0x0f, 0x10, 0xda, 0x92, 0xee, - 0xff, 0xff, 0xff, 0xf7, 0xb7, 0xcd, 0xee, 0xde, 0x07, 0x00, 0x24, 0x49, - 0xb6, 0xed, 0x0f, 0x00, 0x12, 0x6b, 0xcd, 0xf3, 0xbe, 0xff, 0x07, 0x08, - 0x48, 0xda, 0x76, 0xb7, 0xff, 0xff, 0xdd, 0x6e, 0xba, 0x99, 0x65, 0x03, - 0x40, 0x92, 0xe4, 0xba, 0xbd, 0x0e, 0x80, 0x62, 0xed, 0x7d, 0x5f, 0xf7, - 0xff, 0x01, 0x08, 0x28, 0xc9, 0x26, 0xbb, 0xff, 0xff, 0xff, 0x99, 0xb7, - 0xbb, 0x7d, 0x03, 0x00, 0x89, 0x64, 0xdb, 0xf6, 0x07, 0x40, 0x0c, 0x35, - 0xe7, 0x79, 0xdd, 0xff, 0x01, 0x84, 0xa5, 0x7d, 0xba, 0xdd, 0xfe, 0x7f, - 0xbf, 0xbf, 0x6d, 0x76, 0xdb, 0x01, 0x00, 0x48, 0x36, 0xdb, 0xd6, 0x07, - 0xc0, 0x88, 0xb4, 0xb6, 0xbf, 0xff, 0x7f, 0x00, 0x0c, 0x24, 0x44, 0xdb, - 0xed, 0xff, 0xdf, 0xef, 0x6e, 0xdb, 0x6e, 0xb7, 0x00, 0x80, 0x44, 0x93, - 0xed, 0x5b, 0x07, 0x40, 0x91, 0xd2, 0xfa, 0xfc, 0xf6, 0x7f, 0x00, 0x02, - 0xb4, 0x35, 0xd9, 0xef, 0xff, 0xff, 0xfb, 0xef, 0xb6, 0xc9, 0xe4, 0x00, - 0x10, 0x24, 0xd9, 0x6d, 0xfb, 0x03, 0x00, 0x27, 0xfe, 0xd3, 0xd6, 0xdb, - 0x3f, 0x00, 0xa2, 0x94, 0xb4, 0xdb, 0x7c, 0xff, 0xff, 0xbf, 0xd9, 0xad, - 0xdb, 0x7d, 0x00, 0x40, 0x32, 0xd9, 0xb6, 0xef, 0x03, 0x60, 0xe4, 0x5a, - 0x5f, 0x5f, 0xff, 0x1f, 0x00, 0x02, 0x52, 0x92, 0xec, 0xb6, 0xff, 0xff, - 0xef, 0xff, 0x6d, 0xb6, 0x3b, 0x00, 0x28, 0x90, 0xcc, 0xbe, 0xfd, 0x03, - 0xa0, 0x88, 0xeb, 0xf9, 0xfd, 0xf5, 0x1f, 0x00, 0x82, 0x53, 0xbb, 0x6d, - 0xf7, 0xff, 0xf9, 0xff, 0x6f, 0xdb, 0x6d, 0x1b, 0x00, 0x04, 0xc9, 0x66, - 0xdb, 0x57, 0x03, 0xa0, 0x52, 0xaf, 0xa7, 0x97, 0xff, 0x0f, 0x00, 0x51, - 0x48, 0xda, 0x66, 0xdb, 0xff, 0xf8, 0xdf, 0xed, 0xbe, 0xed, 0x0e, 0x00, - 0x92, 0x64, 0x32, 0xeb, 0xf6, 0x01, 0x20, 0x63, 0xbd, 0xbc, 0xfc, 0xfa, - 0x0f, 0x00, 0x09, 0x20, 0x89, 0x3e, 0xff, 0xff, 0xe0, 0x7f, 0xdf, 0x6f, - 0xdb, 0x07, 0x00, 0x01, 0x24, 0xbb, 0xed, 0xfe, 0x01, 0xa0, 0xce, 0xf5, - 0xf6, 0xdb, 0xdf, 0x07, 0x00, 0x41, 0xad, 0x5f, 0xf2, 0xed, 0xff, 0xc0, - 0xff, 0xbf, 0xdd, 0x92, 0x03, 0x00, 0x44, 0xb2, 0xd9, 0x7d, 0xfb, 0x01, - 0xe0, 0xaa, 0xdf, 0x9b, 0x7f, 0xfb, 0x07, 0x80, 0x28, 0x21, 0x64, 0xbb, - 0x7f, 0x7f, 0x80, 0xff, 0xf6, 0xbb, 0xee, 0x03, 0x80, 0x22, 0x99, 0xed, - 0xb6, 0xff, 0x00, 0x90, 0xb8, 0x5e, 0x5b, 0x6b, 0xed, 0x03, 0x00, 0x01, - 0xa6, 0x6d, 0xdb, 0xf6, 0x7f, 0x00, 0xff, 0xff, 0xf6, 0xcd, 0x00, 0x40, - 0x10, 0xc9, 0x6c, 0xff, 0xf7, 0x00, 0xa0, 0xe3, 0x72, 0xeb, 0xef, 0xff, - 0x03, 0x80, 0xe0, 0x90, 0x24, 0xdb, 0xbd, 0x3f, 0x00, 0xfe, 0xdb, 0x6f, - 0xfb, 0x00, 0x00, 0x89, 0x4c, 0xb6, 0xd9, 0x7e, 0x00, 0x70, 0xaf, 0xaf, - 0x6f, 0xb5, 0xde, 0x03, 0x80, 0x94, 0x92, 0xb6, 0xf9, 0xf6, 0x3f, 0x00, - 0xfc, 0xbf, 0xdd, 0x7b, 0x00, 0x10, 0x48, 0x26, 0xb3, 0xdf, 0x7f, 0x00, - 0x70, 0xd8, 0xae, 0xfd, 0xff, 0xf7, 0x03, 0x80, 0x00, 0xd2, 0x36, 0xcf, - 0xdf, 0x3f, 0x00, 0xb8, 0x6d, 0xdf, 0x16, 0x00, 0x48, 0x44, 0xb2, 0xfb, - 0x6c, 0x3f, 0x00, 0x50, 0x75, 0xfd, 0xa5, 0xd5, 0xfe, 0x01, 0x40, 0xd1, - 0x12, 0xa2, 0x7d, 0xfb, 0x1f, 0x00, 0xf0, 0xff, 0xbf, 0x0d, 0x00, 0x20, - 0x12, 0x9b, 0xcd, 0xf6, 0x3f, 0x00, 0x90, 0xd5, 0xa7, 0xfd, 0x77, 0xab, - 0x03, 0x40, 0x1c, 0xc8, 0xbe, 0x6d, 0xfb, 0x1f, 0x00, 0xe0, 0xff, 0xee, - 0x07, 0x00, 0x04, 0x91, 0xc9, 0x7e, 0xbf, 0x1f, 0x00, 0x30, 0x57, 0xbf, - 0xa6, 0xde, 0xfd, 0x01, 0x40, 0x40, 0x6b, 0xd3, 0x6e, 0xef, 0x0f, 0x00, - 0xc0, 0xeb, 0x7d, 0x03, 0x00, 0x90, 0xc8, 0x6c, 0x76, 0xfb, 0x0f, 0x00, - 0x70, 0x5c, 0xe5, 0xf7, 0xfa, 0xeb, 0x01, 0x40, 0x50, 0x49, 0x92, 0xf4, - 0xfd, 0x0f, 0x00, 0xc0, 0xff, 0xdb, 0x01, 0x80, 0x44, 0x44, 0x66, 0xbb, - 0x6f, 0x0f, 0x00, 0xd0, 0xf1, 0x95, 0xf6, 0x6f, 0xad, 0x01, 0x40, 0x08, - 0x78, 0xdb, 0xb6, 0xef, 0x0f, 0x00, 0x00, 0xdf, 0xd6, 0x00, 0x00, 0x20, - 0x32, 0xb3, 0xdb, 0xfd, 0x0f, 0x00, 0x10, 0xd7, 0xf7, 0xb6, 0xd8, 0xeb, - 0x03, 0x20, 0x43, 0x27, 0xd9, 0xb6, 0xfd, 0x0f, 0x00, 0x00, 0xff, 0x7e, - 0x00, 0x40, 0x12, 0x93, 0xd9, 0xec, 0xb6, 0x07, 0x00, 0x70, 0x55, 0xdd, - 0xf6, 0x6f, 0xbb, 0x01, 0x40, 0x28, 0xa1, 0x6f, 0xb6, 0xb7, 0x0f, 0x00, - 0x00, 0xde, 0x1f, 0x00, 0x80, 0x88, 0xd8, 0xcc, 0x66, 0xff, 0x03, 0x00, - 0x70, 0xf4, 0xf5, 0xdb, 0xaa, 0xee, 0x01, 0x60, 0x28, 0x2d, 0x49, 0xf7, - 0xf6, 0x07, 0x00, 0x00, 0x7c, 0x0f, 0x00, 0x08, 0x48, 0x66, 0x6e, 0xfb, - 0xef, 0x03, 0x00, 0xd0, 0xd5, 0xdf, 0x52, 0xff, 0xda, 0x03, 0x20, 0xa3, - 0xa5, 0xd9, 0xb2, 0xff, 0x07, 0x00, 0x00, 0xf8, 0x07, 0x00, 0x20, 0x22, - 0x33, 0x37, 0xbf, 0xfd, 0x01, 0x00, 0x70, 0x5f, 0xf7, 0xfe, 0xab, 0x6b, - 0x02, 0xa0, 0xa8, 0xb4, 0x6d, 0xdf, 0xf6, 0x07, 0x00, 0x00, 0xf8, 0x01, - 0x00, 0x12, 0x33, 0x11, 0xd9, 0xdd, 0xff, 0x01, 0x00, 0x70, 0x75, 0xd5, - 0x52, 0xea, 0x8a, 0x03, 0x20, 0x84, 0x36, 0x69, 0xba, 0xdb, 0x07, 0x00, - 0x00, 0xf0, 0x01, 0x00, 0x81, 0xc8, 0xcc, 0xdd, 0xed, 0xff, 0x00, 0x00, - 0x60, 0xd5, 0xdf, 0xf6, 0xae, 0x6b, 0x03, 0x00, 0xa1, 0xa4, 0x6d, 0xdf, - 0xfe, 0x07, 0x00, 0x00, 0x60, 0x00, 0x40, 0x44, 0xc6, 0xcc, 0x64, 0xb7, - 0xfd, 0x00, 0x00, 0xe0, 0x55, 0xf7, 0xd6, 0xea, 0xba, 0x07, 0x20, 0x94, - 0x94, 0x6d, 0xfb, 0xdb, 0x07, 0x00, 0x00, 0x20, 0x00, 0x20, 0x20, 0x32, - 0x76, 0x77, 0xff, 0x7f, 0x00, 0x00, 0x60, 0x7d, 0xd5, 0xb6, 0x3f, 0xaf, - 0x06, 0xa0, 0xa4, 0x95, 0x6c, 0x9b, 0xee, 0x07, 0x00, 0x00, 0x18, 0x00, - 0x10, 0x92, 0x15, 0x73, 0xbb, 0xd9, 0x3f, 0x00, 0x00, 0xe0, 0xf5, 0xff, - 0xf7, 0x6a, 0xa9, 0x06, 0x80, 0xa2, 0xb4, 0x6d, 0xfb, 0xfb, 0x07, 0x00, - 0x00, 0x04, 0x00, 0x84, 0x88, 0xc8, 0x99, 0xdd, 0xff, 0x3f, 0x00, 0x00, - 0xe0, 0x8b, 0xff, 0x96, 0x6a, 0xb6, 0x0a, 0xa0, 0x94, 0x96, 0x64, 0xdb, - 0xee, 0x07, 0x00, 0x00, 0x03, 0x08, 0x20, 0x60, 0x66, 0xec, 0xee, 0xb6, - 0x1d, 0x00, 0x00, 0xc0, 0x7e, 0xa5, 0xf4, 0xab, 0x55, 0x0d, 0x20, 0xe7, - 0xd4, 0x6d, 0xdb, 0xfb, 0x07, 0x00, 0x80, 0x00, 0x00, 0x09, 0x12, 0x33, - 0x67, 0x77, 0xff, 0x0f, 0x00, 0x00, 0xc0, 0xfa, 0xff, 0xb7, 0x7a, 0x55, - 0x19, 0x90, 0x91, 0xd4, 0x64, 0xdb, 0xee, 0x07, 0x00, 0x40, 0x00, 0x81, - 0x04, 0x88, 0x91, 0x3b, 0xbb, 0xfd, 0x0f, 0x00, 0x00, 0xc0, 0xab, 0xbf, - 0xed, 0x4e, 0xbb, 0x32, 0x20, 0x94, 0x96, 0x6c, 0xff, 0xfa, 0x03, 0x00, - 0x30, 0x40, 0x20, 0x20, 0x64, 0xcc, 0xdc, 0xdd, 0xff, 0x07, 0x00, 0x00, - 0xc0, 0xeb, 0xea, 0xfd, 0xd5, 0xaa, 0x2a, 0x20, 0xd7, 0xb0, 0x6d, 0x93, - 0xef, 0x07, 0x00, 0x08, 0x00, 0x08, 0x01, 0x23, 0xee, 0xee, 0xee, 0xfb, - 0x03, 0x00, 0x00, 0xc0, 0xfe, 0xff, 0x2d, 0xdd, 0x6a, 0x49, 0xd0, 0x90, - 0x9a, 0x64, 0xdf, 0xea, 0x07, 0x00, 0x03, 0x80, 0x40, 0x8c, 0x98, 0x33, - 0xb3, 0xbb, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xa5, 0x7b, 0x6d, 0xa7, 0x56, - 0xc5, 0xa0, 0x94, 0x94, 0x6f, 0xd3, 0xbb, 0x07, 0x80, 0x10, 0x0c, 0x12, - 0x40, 0xc6, 0xb9, 0xdb, 0xfb, 0xfd, 0x01, 0x00, 0x00, 0x80, 0x97, 0xee, - 0xdf, 0xba, 0x54, 0x1a, 0xa1, 0xe5, 0xd2, 0x64, 0x7e, 0xee, 0x07, 0x60, - 0x02, 0x80, 0x00, 0x31, 0x62, 0xcc, 0xdc, 0xee, 0x7f, 0x00, 0x00, 0x00, - 0x80, 0xff, 0xff, 0xdb, 0xaa, 0xb5, 0x8a, 0x86, 0x98, 0x96, 0x6d, 0x9b, - 0xea, 0x07, 0x98, 0x00, 0x22, 0x44, 0x88, 0x39, 0x77, 0x77, 0xff, 0x7f, - 0x00, 0x00, 0x00, 0x80, 0x7d, 0x77, 0xba, 0x7b, 0x2d, 0x55, 0x3c, 0xa6, - 0xb4, 0x6c, 0xf6, 0xaf, 0x07, 0x07, 0x90, 0x88, 0x20, 0x42, 0x9c, 0xbb, - 0xbb, 0xbb, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x4b, 0xbd, 0xbf, 0x55, 0x53, - 0xa5, 0xb2, 0xa1, 0xb4, 0xc9, 0x9f, 0xda, 0xcf, 0x28, 0x24, 0x42, 0x08, - 0x31, 0xe6, 0xcc, 0xdd, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xff, 0xef, - 0xb7, 0xbd, 0xde, 0x12, 0xd1, 0xac, 0x95, 0x4d, 0xf2, 0x56, 0x9f, 0x88, - 0x80, 0x10, 0xc2, 0x9c, 0x73, 0x77, 0xef, 0xfe, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0xbf, 0xfb, 0xed, 0xeb, 0x35, 0x95, 0x72, 0xa2, 0x35, 0xcd, 0xb6, - 0xd6, 0x2f, 0x21, 0x24, 0x04, 0x31, 0xc6, 0x98, 0x33, 0xf7, 0xff, 0xff, - 0x00, 0x00, 0x00, 0x00, 0xd6, 0x6a, 0x7f, 0x5b, 0xab, 0x2d, 0x28, 0x23, - 0x65, 0xd9, 0xb6, 0x55, 0x5f, 0x88, 0x08, 0x43, 0x0c, 0x61, 0xde, 0xdd, - 0xfb, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x76, 0xff, 0x4d, 0xd7, 0x4d, - 0x4a, 0xa5, 0x29, 0x2d, 0xdb, 0xbe, 0x55, 0x1f, 0x22, 0x42, 0x28, 0xc2, - 0x39, 0xe7, 0xee, 0xee, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x7f, - 0xfb, 0xb6, 0xb6, 0x95, 0x70, 0x2e, 0xa5, 0xd9, 0x24, 0x5d, 0x5f, 0x8a, - 0x28, 0x88, 0x31, 0x9e, 0x39, 0x73, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0xec, 0xb7, 0xdf, 0x6c, 0xb5, 0x65, 0x26, 0xa3, 0x39, 0x9b, 0xfc, - 0x85, 0x5d, 0x21, 0x04, 0x63, 0x1c, 0xe6, 0xdd, 0xbd, 0xfb, 0xff, 0xff, - 0x01, 0x00, 0x00, 0x00, 0xb8, 0xfa, 0xb6, 0x6f, 0x4d, 0x9a, 0x28, 0x59, - 0x4d, 0xd3, 0x2f, 0xf5, 0x3f, 0x8c, 0xd1, 0x18, 0xc6, 0x31, 0xf6, 0xdd, - 0xfe, 0xff, 0xfe, 0x01, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xb9, 0xb6, - 0x25, 0xe1, 0x4d, 0x69, 0xba, 0x6c, 0xad, 0x3c, 0x41, 0x14, 0x84, 0xe9, - 0x9e, 0x37, 0xf7, 0xff, 0xff, 0xfb, 0x03, 0x00, 0x00, 0x00, 0x70, 0x5d, - 0x3d, 0x9f, 0x3d, 0x6d, 0x26, 0x52, 0x59, 0xb6, 0x6d, 0xab, 0x7f, 0x14, - 0x82, 0xe1, 0x39, 0xe6, 0xdd, 0xfb, 0xff, 0xbf, 0xff, 0x01, 0x00, 0x00, - 0x00, 0xf0, 0xf6, 0x6f, 0x77, 0xcd, 0x92, 0xd0, 0x52, 0x4b, 0xb3, 0x49, - 0x0b, 0x3a, 0x41, 0x61, 0x38, 0x9e, 0x73, 0xee, 0xdc, 0xff, 0xff, 0xfd, - 0x03, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xd7, 0x65, 0xda, 0x66, 0x63, 0x9d, - 0xf2, 0x36, 0x7b, 0x6a, 0x7f, 0x14, 0x18, 0x8e, 0xe7, 0xd9, 0x7b, 0xff, - 0xff, 0xef, 0xff, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xdd, 0xb6, - 0xc9, 0x4c, 0x46, 0x9a, 0x64, 0xcb, 0x5b, 0xed, 0x06, 0xc6, 0xe3, 0x71, - 0xde, 0xbd, 0xff, 0xff, 0x7f, 0xff, 0x07, 0x00, 0x00, 0x00, 0xc0, 0x7f, - 0x7f, 0xff, 0x59, 0x37, 0x75, 0xbb, 0x96, 0x66, 0xdb, 0x56, 0xf7, 0xe0, - 0xf2, 0x74, 0x9e, 0x77, 0xef, 0xfd, 0xff, 0xeb, 0xed, 0x03, 0x00, 0x00, - 0x00, 0xc0, 0xea, 0xdf, 0xb3, 0xdb, 0xde, 0xc6, 0x81, 0xb0, 0x6c, 0xba, - 0xb4, 0xf6, 0x38, 0x18, 0x3c, 0xe7, 0x9c, 0xfb, 0xff, 0x7f, 0xff, 0xff, - 0x07, 0x00, 0x00, 0x00, 0x80, 0xff, 0xf7, 0x6e, 0x66, 0xd9, 0x99, 0xac, - 0xa4, 0xcd, 0x96, 0xa5, 0xea, 0x03, 0xa7, 0xcf, 0x79, 0xef, 0xfd, 0xff, - 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xff, 0xfd, 0xef, 0xdf, - 0x6f, 0xef, 0x72, 0x65, 0xd9, 0xb6, 0xad, 0xe8, 0xc1, 0xe1, 0xf1, 0xbe, - 0x7b, 0xef, 0xff, 0xdf, 0x7a, 0xfb, 0x07, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0x5f, 0xdd, 0x9d, 0xac, 0x99, 0x84, 0x29, 0xcd, 0x3c, 0x4f, 0x9d, 0x7d, - 0x3c, 0x9e, 0xe7, 0xbe, 0xff, 0xff, 0xff, 0xff, 0xef, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xff, 0x77, 0x7b, 0x33, 0xe7, 0x5a, 0x49, 0x9b, 0x65, - 0x59, 0x75, 0x07, 0x97, 0xf7, 0xbb, 0xef, 0xff, 0xff, 0xdb, 0xfe, 0xff, - 0x07, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf7, 0x3f, 0xe7, 0xcf, 0x9c, 0x51, - 0x4d, 0xb0, 0x6d, 0x4b, 0xc9, 0xd3, 0xf5, 0x79, 0xfe, 0xfb, 0xff, 0xff, - 0xdb, 0xda, 0xfe, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xef, 0xde, - 0xdd, 0xf3, 0x4d, 0x52, 0x36, 0xcb, 0xd2, 0x3a, 0x7e, 0x3c, 0xde, 0xe7, - 0xbe, 0xff, 0x7f, 0xda, 0xff, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0xff, 0xfb, 0xdd, 0x73, 0x8f, 0xa5, 0x9a, 0xe6, 0xd9, 0xb6, 0xe2, 0x4e, - 0xc7, 0xf7, 0xfd, 0xff, 0xff, 0xff, 0xf7, 0xf6, 0xff, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0xff, 0xff, 0x7f, 0xee, 0x79, 0xb2, 0xb2, 0x2c, 0x9f, - 0xb6, 0x54, 0xfe, 0xfb, 0x79, 0xbf, 0xff, 0xff, 0x5f, 0xda, 0xff, 0xfa, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xf7, 0xbf, 0xe7, 0x4b, - 0xb4, 0x69, 0xd3, 0x2c, 0x25, 0xbd, 0xbc, 0xcf, 0xf7, 0xfd, 0xff, 0xd7, - 0xf6, 0xfe, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xbf, 0x9d, - 0xf1, 0x3e, 0x57, 0x25, 0xcb, 0xb6, 0x6d, 0xa9, 0xb5, 0xef, 0xfb, 0xff, - 0xff, 0xff, 0xd5, 0xda, 0xd6, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xff, 0xfb, 0xcf, 0xf5, 0x25, 0x65, 0xd9, 0x66, 0x5b, 0x4a, 0xfa, - 0xf9, 0x7e, 0xff, 0xff, 0xff, 0xf6, 0xd6, 0xdf, 0xfa, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0xff, 0xef, 0x3e, 0xf7, 0x9f, 0x5b, 0x92, 0x6c, - 0xdb, 0x52, 0xe5, 0xbe, 0xdf, 0xff, 0xff, 0xbf, 0x51, 0xda, 0xfa, 0x7f, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7b, 0x9f, 0xe7, - 0x4c, 0xb3, 0x4d, 0xd3, 0x54, 0xd9, 0xe7, 0xfb, 0xff, 0xff, 0x5f, 0xdc, - 0xfa, 0xdf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x7f, - 0xe7, 0xf9, 0x3a, 0xd3, 0xa6, 0xe9, 0xb6, 0xa5, 0xca, 0xf9, 0xfd, 0xff, - 0xff, 0x83, 0x42, 0xd2, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0xff, 0xfd, 0xbf, 0xef, 0x4f, 0xd5, 0x64, 0xdb, 0x26, 0x4d, 0x30, - 0x7f, 0xff, 0xff, 0xff, 0x91, 0xda, 0xdb, 0xda, 0xdf, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, 0xff, 0x7d, 0xbe, 0xb5, 0x6d, 0x97, - 0x6d, 0x93, 0x56, 0xdf, 0xff, 0xff, 0x7f, 0x81, 0x4a, 0xda, 0x7f, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xef, 0xeb, 0xbb, - 0xa6, 0x4d, 0x73, 0xcd, 0x92, 0xaa, 0xfe, 0xff, 0xff, 0x1f, 0x01, 0x6a, - 0x5b, 0xfb, 0xfb, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, - 0xfd, 0xbf, 0x5f, 0x3b, 0xdb, 0x36, 0xbb, 0x26, 0x4c, 0xf9, 0xff, 0xff, - 0x0f, 0xa3, 0x2a, 0xe9, 0x7f, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xee, 0xff, 0xff, 0xfe, 0xfe, 0xcc, 0x91, 0xec, 0x93, 0x6d, 0x93, - 0xf2, 0xff, 0xff, 0x03, 0x00, 0x6a, 0x6d, 0x6f, 0xff, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x6f, 0x76, 0xb6, 0xcd, - 0x76, 0xc9, 0x2a, 0xe9, 0xff, 0xff, 0x00, 0x02, 0x24, 0xed, 0xf9, 0xed, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, 0xdf, 0xff, - 0xd9, 0x66, 0x9b, 0x6c, 0x93, 0x54, 0xc5, 0xff, 0x3f, 0x00, 0x01, 0x95, - 0xb5, 0xaf, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, - 0xff, 0xff, 0xfd, 0xae, 0x7d, 0xde, 0x6d, 0xf6, 0xa1, 0x8a, 0xff, 0x0f, - 0x00, 0x81, 0x90, 0xb4, 0xfd, 0xfd, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xcd, 0xb2, 0xdb, 0x2c, 0xcb, - 0x54, 0xfe, 0x01, 0x00, 0x01, 0xd2, 0xb6, 0xb7, 0xff, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x39, 0xdb, 0x76, - 0xb3, 0x4b, 0xb6, 0x0a, 0xfe, 0x00, 0x00, 0x01, 0x48, 0xda, 0xfe, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, - 0xcf, 0xb9, 0x6d, 0xb6, 0xd9, 0xa5, 0x75, 0x1c, 0x00, 0x80, 0x80, 0x20, - 0xdb, 0xda, 0xbe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, - 0xff, 0xff, 0xff, 0x77, 0x96, 0xd9, 0x26, 0xb3, 0x4d, 0x82, 0x11, 0x00, - 0x80, 0x80, 0x24, 0x6d, 0xff, 0xf7, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xbb, 0x67, 0xdb, 0xdd, 0x36, 0xd9, - 0x54, 0x60, 0x00, 0xc0, 0x00, 0x92, 0x65, 0x6b, 0xff, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x4f, 0x7d, 0x96, - 0xd9, 0x6c, 0x36, 0xad, 0xc2, 0x00, 0x60, 0x00, 0xc8, 0xb6, 0x6d, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, - 0xff, 0xc8, 0x76, 0xbb, 0xcb, 0x64, 0x52, 0x02, 0x03, 0x10, 0x00, 0x64, - 0xda, 0xff, 0xfb, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0xff, 0xff, 0x5f, 0xd7, 0x4d, 0x33, 0x99, 0xdd, 0x96, 0x04, 0x2c, - 0x1c, 0x40, 0x22, 0xdb, 0xb6, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xdf, 0xb5, 0xed, 0xe6, 0x36, 0x9b, - 0x6c, 0x29, 0xf0, 0x03, 0x00, 0x99, 0x6c, 0xfb, 0xfd, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0x7f, 0x35, 0xbb, - 0xec, 0x76, 0x33, 0x91, 0x02, 0x00, 0x00, 0x00, 0x64, 0x67, 0xdf, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, - 0xbf, 0x6f, 0x9b, 0x9d, 0xc9, 0xce, 0x36, 0x49, 0x00, 0x00, 0x00, 0x93, - 0xb1, 0xdd, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x40, 0xff, 0x6a, 0x76, 0xbb, 0xdd, 0xd9, 0x64, 0x12, 0x01, - 0x00, 0x40, 0x98, 0xdd, 0x6d, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x66, 0x73, 0x33, 0xbb, - 0x9d, 0x4d, 0x00, 0x00, 0x00, 0x63, 0xe6, 0xf6, 0xff, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xed, 0xfd, - 0xee, 0xee, 0x36, 0x73, 0x2b, 0x04, 0x00, 0xa0, 0x38, 0x75, 0xbf, 0xff, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x7f, 0xd9, 0xec, 0xce, 0x66, 0x66, 0x66, 0x22, 0x04, 0x00, 0xc6, - 0x99, 0xbb, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x5e, 0xb3, 0xdb, 0xb9, 0xcd, 0xc9, 0x88, 0x89, - 0x00, 0x68, 0x31, 0xee, 0xdd, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf6, 0xbe, 0xbb, 0x9b, 0x3f, - 0xbb, 0x33, 0x23, 0x04, 0x00, 0x8c, 0xf3, 0xee, 0xff, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbc, 0x67, - 0x76, 0x77, 0xb2, 0x66, 0xce, 0x0c, 0xd1, 0xd6, 0xe3, 0x79, 0xf7, 0xff, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0xfd, 0xef, 0xe6, 0xee, 0xce, 0x9c, 0x31, 0x16, 0x00, 0x3c, - 0x9e, 0xfb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x78, 0x9f, 0xdb, 0xdc, 0x9d, 0x99, 0x33, 0xc6, - 0xc1, 0xff, 0x8f, 0xe7, 0xbb, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xf7, 0xbd, 0xbb, 0x33, - 0x7b, 0xee, 0x18, 0x1e, 0x50, 0xf0, 0xf9, 0xfe, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7b, - 0xf7, 0x77, 0xf7, 0xe6, 0x9c, 0xe3, 0xf0, 0x4d, 0xff, 0x7c, 0xef, 0xff, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xdf, 0x76, 0x7f, 0xcf, 0x9e, 0x73, 0x8f, 0x07, 0xff, 0x0b, - 0xdf, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xee, 0xcd, 0xdd, 0x9d, 0x7b, 0xf7, 0x7c, - 0x7a, 0x00, 0xf0, 0xe7, 0xfd, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7f, 0xbf, 0xdd, 0x7b, - 0x6b, 0x9e, 0xf3, 0xe1, 0xff, 0xff, 0x7d, 0xff, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, - 0xb7, 0xbb, 0x7b, 0xee, 0x79, 0x8f, 0x0f, 0xfa, 0x2f, 0xff, 0xf7, 0x3f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x7e, 0xff, 0x77, 0xef, 0xdd, 0x77, 0x7c, 0xfe, 0x02, 0xe8, - 0xcf, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xef, 0xee, 0xdd, 0xb3, 0xcf, 0xf3, - 0xf1, 0xff, 0xff, 0xf9, 0xfe, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfb, 0xff, 0xbf, - 0xef, 0xbe, 0xcf, 0x8f, 0xfe, 0x5f, 0xfe, 0xff, 0x0f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, - 0xbf, 0xbb, 0xf7, 0xde, 0x79, 0x3e, 0xff, 0x52, 0xd2, 0xdf, 0xff, 0x0f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0xef, 0xef, 0xef, 0x3c, 0xef, 0xf9, 0xf8, 0xff, 0xff, - 0xf7, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xee, 0xdc, 0xf7, 0xfe, 0xe7, - 0x97, 0xfe, 0xff, 0xfe, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xbf, - 0xef, 0xbf, 0x3e, 0xff, 0xda, 0xf6, 0xff, 0xff, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfe, 0xbf, 0xf7, 0xfe, 0xf7, 0xff, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0xff, 0xde, 0xbd, 0xef, 0xfb, 0xd7, 0xff, 0xbf, - 0xfd, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, 0xff, 0xf7, 0x7d, 0xbf, - 0xff, 0xd2, 0xf6, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xbf, - 0xef, 0xfb, 0xfd, 0xfd, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xff, 0xef, 0xbe, 0xf7, 0xef, 0xef, 0xff, 0xff, 0xff, 0x3f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xfb, 0xdf, 0xbf, 0xff, 0xff, 0xff, - 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x7f, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, - 0xfe, 0xff, 0xfb, 0xf7, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf0, 0xff, 0xff, 0xff, 0xdf, 0xff, 0xfd, 0xff, 0xff, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x1f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 - }; diff --git a/nx-X11/include/bitmaps/flagdown b/nx-X11/include/bitmaps/flagdown deleted file mode 100644 index 55abc5182..000000000 --- a/nx-X11/include/bitmaps/flagdown +++ /dev/null @@ -1,27 +0,0 @@ -#define flagdown_width 48 -#define flagdown_height 48 -static char flagdown_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x00, 0x00, - 0x00, 0x00, 0x70, 0x80, 0x01, 0x00, 0x00, 0x00, 0x18, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x0c, 0x00, 0x03, 0x00, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, - 0x00, 0x00, 0x03, 0x00, 0x06, 0x06, 0x00, 0x80, 0x01, 0x00, 0x06, 0x07, - 0x00, 0xc0, 0x1f, 0x00, 0x87, 0x07, 0x00, 0xe0, 0x7f, 0x80, 0xc7, 0x07, - 0x00, 0x70, 0xe0, 0xc0, 0xe5, 0x07, 0x00, 0x38, 0x80, 0xe1, 0x74, 0x07, - 0x00, 0x18, 0x80, 0x71, 0x3c, 0x07, 0x00, 0x0c, 0x00, 0x3b, 0x1e, 0x03, - 0x00, 0x0c, 0x00, 0x1f, 0x0f, 0x00, 0x00, 0x86, 0x1f, 0x8e, 0x07, 0x00, - 0x00, 0x06, 0x06, 0xc6, 0x05, 0x00, 0x00, 0x06, 0x00, 0xc6, 0x05, 0x00, - 0x00, 0x06, 0x00, 0xc6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, - 0x7f, 0x06, 0x00, 0x06, 0xe4, 0xff, 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, - 0x00, 0x06, 0x00, 0x06, 0x04, 0x00, 0x00, 0x06, 0x00, 0x06, 0x06, 0x00, - 0x00, 0x06, 0x00, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00, - 0x00, 0x06, 0x00, 0xc6, 0x00, 0x00, 0x00, 0x06, 0x00, 0x66, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x36, 0x00, 0x00, 0x00, 0x06, 0x00, 0x3e, 0x00, 0x00, - 0x00, 0xfe, 0xff, 0x2f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x27, 0x00, 0x00, - 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, 0x00, 0x00, 0x88, 0x20, 0x00, 0x00, - 0xf7, 0xbf, 0x8e, 0xfc, 0xdf, 0xf8, 0x9d, 0xeb, 0x9b, 0x76, 0xd2, 0x7a, - 0x46, 0x30, 0xe2, 0x0f, 0xe1, 0x47, 0x55, 0x84, 0x48, 0x11, 0x84, 0x19}; diff --git a/nx-X11/include/bitmaps/flagup b/nx-X11/include/bitmaps/flagup deleted file mode 100644 index 6eb0d846a..000000000 --- a/nx-X11/include/bitmaps/flagup +++ /dev/null @@ -1,27 +0,0 @@ -#define flagup_width 48 -#define flagup_height 48 -static char flagup_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xef, 0x6a, 0x00, - 0x00, 0x00, 0xc0, 0x7b, 0x75, 0x00, 0x00, 0x00, 0xe0, 0xe0, 0x6a, 0x00, - 0x00, 0x00, 0x30, 0x60, 0x75, 0x00, 0x00, 0x00, 0x18, 0xe0, 0x7f, 0x00, - 0x00, 0x00, 0x0c, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x06, 0xe0, 0x04, 0x00, - 0x00, 0x00, 0x03, 0xe0, 0x04, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x06, 0x00, - 0x00, 0xc0, 0x1f, 0xe0, 0x07, 0x00, 0x00, 0xe0, 0x7f, 0xe0, 0x07, 0x00, - 0x00, 0x70, 0xe0, 0xe0, 0x05, 0x00, 0x00, 0x38, 0x80, 0xe1, 0x04, 0x00, - 0x00, 0x18, 0x80, 0xf1, 0x04, 0x00, 0x00, 0x0c, 0x00, 0xfb, 0x04, 0x00, - 0x00, 0x0c, 0x00, 0xff, 0x04, 0x00, 0x00, 0x86, 0x1f, 0xee, 0x04, 0x00, - 0x00, 0x06, 0x06, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, - 0x00, 0x06, 0x00, 0xe6, 0x04, 0x00, 0x00, 0x06, 0x00, 0x66, 0x04, 0x00, - 0x7f, 0x56, 0x52, 0x06, 0xe4, 0xff, 0x00, 0x76, 0x55, 0x06, 0x04, 0x00, - 0x00, 0x56, 0x57, 0x06, 0x04, 0x00, 0x00, 0x56, 0x55, 0x06, 0x06, 0x00, - 0x00, 0x56, 0xd5, 0x06, 0x03, 0x00, 0x00, 0x06, 0x00, 0x86, 0x01, 0x00, - 0x54, 0x06, 0x00, 0xc6, 0x54, 0x55, 0xaa, 0x06, 0x00, 0x66, 0xaa, 0x2a, - 0x54, 0x06, 0x00, 0x36, 0x55, 0x55, 0xaa, 0x06, 0x00, 0xbe, 0xaa, 0x2a, - 0x54, 0xfe, 0xff, 0x6f, 0x55, 0x55, 0xaa, 0xfc, 0xff, 0xa7, 0xaa, 0x2a, - 0x54, 0x01, 0x88, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, - 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, - 0x54, 0x55, 0x8d, 0x60, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa0, 0xaa, 0x2a, - 0x54, 0x55, 0x8d, 0x50, 0x55, 0x55, 0xaa, 0xaa, 0x8a, 0xa8, 0xaa, 0x2a, - 0x54, 0x55, 0x95, 0x54, 0x55, 0x55, 0xaa, 0xaa, 0xaa, 0xaa, 0xaa, 0x2a, - 0x54, 0x55, 0x55, 0x55, 0x55, 0x15, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/flipped_gray b/nx-X11/include/bitmaps/flipped_gray deleted file mode 100644 index b75cacd7b..000000000 --- a/nx-X11/include/bitmaps/flipped_gray +++ /dev/null @@ -1,4 +0,0 @@ -#define flipped_gray_width 4 -#define flipped_gray_height 2 -static char flipped_gray_bits[] = { - 0x07, 0x0d}; diff --git a/nx-X11/include/bitmaps/gray b/nx-X11/include/bitmaps/gray deleted file mode 100644 index dc7327e5c..000000000 --- a/nx-X11/include/bitmaps/gray +++ /dev/null @@ -1,4 +0,0 @@ -#define gray_width 2 -#define gray_height 2 -static char gray_bits[] = { - 0x01, 0x02}; diff --git a/nx-X11/include/bitmaps/gray1 b/nx-X11/include/bitmaps/gray1 deleted file mode 100644 index 476d93055..000000000 --- a/nx-X11/include/bitmaps/gray1 +++ /dev/null @@ -1,4 +0,0 @@ -#define gray1_width 2 -#define gray1_height 2 -static char gray1_bits[] = { - 0x01, 0x02}; diff --git a/nx-X11/include/bitmaps/gray3 b/nx-X11/include/bitmaps/gray3 deleted file mode 100644 index 230288478..000000000 --- a/nx-X11/include/bitmaps/gray3 +++ /dev/null @@ -1,4 +0,0 @@ -#define gray3_width 4 -#define gray3_height 4 -static char gray3_bits[] = { - 0x01, 0x00, 0x04, 0x00}; diff --git a/nx-X11/include/bitmaps/grid16 b/nx-X11/include/bitmaps/grid16 deleted file mode 100644 index edc7c735b..000000000 --- a/nx-X11/include/bitmaps/grid16 +++ /dev/null @@ -1,6 +0,0 @@ -#define grid16_width 16 -#define grid16_height 16 -static char grid16_bits[] = { - 0x55, 0x55, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/grid2 b/nx-X11/include/bitmaps/grid2 deleted file mode 100644 index 7a021673e..000000000 --- a/nx-X11/include/bitmaps/grid2 +++ /dev/null @@ -1,4 +0,0 @@ -#define grid2_width 2 -#define grid2_height 2 -static char grid2_bits[] = { - 0x01, 0x00}; diff --git a/nx-X11/include/bitmaps/grid4 b/nx-X11/include/bitmaps/grid4 deleted file mode 100644 index 8062f40f1..000000000 --- a/nx-X11/include/bitmaps/grid4 +++ /dev/null @@ -1,4 +0,0 @@ -#define grid4_width 4 -#define grid4_height 4 -static char grid4_bits[] = { - 0x05, 0x00, 0x01, 0x00}; diff --git a/nx-X11/include/bitmaps/grid8 b/nx-X11/include/bitmaps/grid8 deleted file mode 100644 index 02ce50e5b..000000000 --- a/nx-X11/include/bitmaps/grid8 +++ /dev/null @@ -1,4 +0,0 @@ -#define grid8_width 8 -#define grid8_height 8 -static char grid8_bits[] = { - 0x55, 0x00, 0x01, 0x00, 0x01, 0x00, 0x01, 0x00}; diff --git a/nx-X11/include/bitmaps/hlines2 b/nx-X11/include/bitmaps/hlines2 deleted file mode 100644 index 5c1a396f9..000000000 --- a/nx-X11/include/bitmaps/hlines2 +++ /dev/null @@ -1,4 +0,0 @@ -#define hlines2_width 1 -#define hlines2_height 2 -static char hlines2_bits[] = { - 0x01, 0x00}; diff --git a/nx-X11/include/bitmaps/hlines3 b/nx-X11/include/bitmaps/hlines3 deleted file mode 100644 index ed4943319..000000000 --- a/nx-X11/include/bitmaps/hlines3 +++ /dev/null @@ -1,4 +0,0 @@ -#define hlines3_width 1 -#define hlines3_height 3 -static char hlines3_bits[] = { - 0x00, 0x01, 0x00}; diff --git a/nx-X11/include/bitmaps/icon b/nx-X11/include/bitmaps/icon deleted file mode 100644 index 9a75a57c4..000000000 --- a/nx-X11/include/bitmaps/icon +++ /dev/null @@ -1,6 +0,0 @@ -#define icon_width 16 -#define icon_height 16 -static char icon_bits[] = { - 0xff, 0xff, 0xab, 0xaa, 0x55, 0xd5, 0xab, 0xaa, 0x05, 0xd0, 0x0b, 0xa0, - 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, 0x05, 0xd0, 0x0b, 0xa0, - 0x55, 0xd5, 0xab, 0xaa, 0x55, 0xd5, 0xff, 0xff}; diff --git a/nx-X11/include/bitmaps/keyboard16 b/nx-X11/include/bitmaps/keyboard16 deleted file mode 100644 index c4ead326b..000000000 --- a/nx-X11/include/bitmaps/keyboard16 +++ /dev/null @@ -1,6 +0,0 @@ -#define keyboard16_width 16 -#define keyboard16_height 16 -static char keyboard16_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0x08, 0x10, 0x08, 0x10, 0x08, 0x10, - 0x08, 0x10, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x0f, 0xa8, 0x1a, - 0x54, 0x35, 0xfc, 0x3f, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/left_ptr b/nx-X11/include/bitmaps/left_ptr deleted file mode 100644 index 8a6abb13a..000000000 --- a/nx-X11/include/bitmaps/left_ptr +++ /dev/null @@ -1,8 +0,0 @@ -#define left_ptr_width 16 -#define left_ptr_height 16 -#define left_ptr_x_hot 3 -#define left_ptr_y_hot 1 -static char left_ptr_bits[] = { - 0x00, 0x00, 0x08, 0x00, 0x18, 0x00, 0x38, 0x00, 0x78, 0x00, 0xf8, 0x00, - 0xf8, 0x01, 0xf8, 0x03, 0xf8, 0x07, 0xf8, 0x00, 0xd8, 0x00, 0x88, 0x01, - 0x80, 0x01, 0x00, 0x03, 0x00, 0x03, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/left_ptrmsk b/nx-X11/include/bitmaps/left_ptrmsk deleted file mode 100644 index 851911d3d..000000000 --- a/nx-X11/include/bitmaps/left_ptrmsk +++ /dev/null @@ -1,6 +0,0 @@ -#define left_ptrmsk_width 16 -#define left_ptrmsk_height 16 -static char left_ptrmsk_bits[] = { - 0x0c, 0x00, 0x1c, 0x00, 0x3c, 0x00, 0x7c, 0x00, 0xfc, 0x00, 0xfc, 0x01, - 0xfc, 0x03, 0xfc, 0x07, 0xfc, 0x0f, 0xfc, 0x0f, 0xfc, 0x01, 0xdc, 0x03, - 0xcc, 0x03, 0x80, 0x07, 0x80, 0x07, 0x00, 0x03}; diff --git a/nx-X11/include/bitmaps/letters b/nx-X11/include/bitmaps/letters deleted file mode 100644 index 0f12568d1..000000000 --- a/nx-X11/include/bitmaps/letters +++ /dev/null @@ -1,27 +0,0 @@ -#define letters_width 48 -#define letters_height 48 -static char letters_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x02, 0x00, 0x00, 0x00, 0x20, - 0x00, 0xfa, 0x00, 0x00, 0x00, 0x2e, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2a, - 0x00, 0x3a, 0x00, 0x00, 0x00, 0x2a, 0x00, 0x02, 0x00, 0x00, 0x00, 0x2e, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0x21, 0x20, 0x00, 0x00, 0x00, 0x00, 0x21, - 0xa0, 0x03, 0x00, 0x00, 0x70, 0x21, 0x20, 0x00, 0x00, 0x00, 0x50, 0x21, - 0xa0, 0x1f, 0x00, 0x00, 0x50, 0x21, 0x20, 0x00, 0x00, 0x00, 0x70, 0x21, - 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21, - 0xfa, 0x01, 0x00, 0x80, 0x0b, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0a, 0x21, - 0xba, 0x01, 0x00, 0x80, 0x0a, 0x21, 0x02, 0x00, 0x00, 0x80, 0x0b, 0x21, - 0x3a, 0x00, 0x00, 0x00, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x21, - 0x02, 0xc0, 0xfb, 0x03, 0x08, 0x21, 0x02, 0x00, 0x00, 0x00, 0x08, 0x3f, - 0x02, 0xc0, 0xbd, 0x0f, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01, - 0x02, 0xc0, 0x7f, 0x7b, 0x08, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x01, - 0x02, 0x00, 0x00, 0x00, 0xf8, 0x01, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, 0x02, 0x00, 0x00, 0x00, 0x08, 0x00, - 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/light_gray b/nx-X11/include/bitmaps/light_gray deleted file mode 100644 index ea62e17dc..000000000 --- a/nx-X11/include/bitmaps/light_gray +++ /dev/null @@ -1,4 +0,0 @@ -#define light_gray_width 4 -#define light_gray_height 2 -static char light_gray_bits[] = { - 0x08, 0x02}; diff --git a/nx-X11/include/bitmaps/mailempty b/nx-X11/include/bitmaps/mailempty deleted file mode 100644 index 064252534..000000000 --- a/nx-X11/include/bitmaps/mailempty +++ /dev/null @@ -1,27 +0,0 @@ -#define mailempty_width 48 -#define mailempty_height 48 -static unsigned char mailempty_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x80, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0xc0, 0xaf, 0xaa, 0xaa, 0xaa, 0x7a, 0xe0, 0x57, 0x55, 0x55, 0x55, 0x7d, - 0xf0, 0xaf, 0xaa, 0xaa, 0xaa, 0x7e, 0xf8, 0x57, 0x55, 0x55, 0x55, 0x7f, - 0xfc, 0xaf, 0xaa, 0xaa, 0xaa, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xab, 0xaa, 0xaa, 0xea, 0x7f, - 0xfe, 0x55, 0x55, 0x55, 0xf5, 0x6f, 0xfe, 0xaa, 0xaa, 0xaa, 0xea, 0x67, - 0x7e, 0x55, 0x55, 0x55, 0xf5, 0x63, 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, - 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, - 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, - 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0xfe, 0xff, 0xff, 0xff, 0x7f, - 0x06, 0xff, 0xff, 0xff, 0xff, 0x7f, 0x86, 0xaf, 0xaa, 0xaa, 0xea, 0x7a, - 0xc6, 0x57, 0x55, 0x55, 0x75, 0x7d, 0xe6, 0xaf, 0xaa, 0xaa, 0xea, 0x7e, - 0xf6, 0x57, 0x55, 0x55, 0x75, 0x7f, 0xfe, 0xaf, 0xaa, 0xaa, 0xea, 0x7f, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0xfe, 0xab, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0x55, 0x55, 0x55, 0xf5, 0x6f, - 0xfe, 0xaa, 0xaa, 0xaa, 0xea, 0x67, 0x7e, 0x55, 0x55, 0x55, 0xf5, 0x63, - 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, - 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, - 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/mailemptymsk b/nx-X11/include/bitmaps/mailemptymsk deleted file mode 100644 index f1204b233..000000000 --- a/nx-X11/include/bitmaps/mailemptymsk +++ /dev/null @@ -1,27 +0,0 @@ -#define mailemask_width 48 -#define mailemask_height 48 -static char mailemask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x80, 0xff, 0xff, 0xff, 0xff, 0xff, 0xc0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, - 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, - 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, - 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, - 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x0f, 0x00, 0x00, 0x00, 0xf0, 0x00}; diff --git a/nx-X11/include/bitmaps/mailfull b/nx-X11/include/bitmaps/mailfull deleted file mode 100644 index cc2f6f8b6..000000000 --- a/nx-X11/include/bitmaps/mailfull +++ /dev/null @@ -1,27 +0,0 @@ -#define mailfull_width 48 -#define mailfull_height 48 -static unsigned char mailfull_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x07, - 0xc0, 0xff, 0xff, 0xff, 0x1f, 0x04, 0x40, 0x00, 0x00, 0x00, 0xd0, 0x05, - 0x40, 0x00, 0x00, 0x00, 0x57, 0x7d, 0x40, 0x1e, 0x00, 0x00, 0x55, 0x7d, - 0x40, 0x00, 0x00, 0x00, 0xd5, 0x7d, 0x60, 0x02, 0x00, 0x00, 0x17, 0x7c, - 0x70, 0x00, 0x7e, 0x00, 0x10, 0x7c, 0x78, 0x00, 0x00, 0x00, 0x10, 0x7e, - 0x7c, 0x00, 0x1e, 0x00, 0x10, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0x90, 0x7f, - 0x7e, 0x00, 0x3e, 0x07, 0xd0, 0x7f, 0x7e, 0x00, 0x00, 0x00, 0xf0, 0x7f, - 0x7e, 0x00, 0x00, 0x00, 0xf0, 0x6f, 0x7e, 0x00, 0x00, 0x00, 0xf0, 0x67, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x63, 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, - 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, - 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, - 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, 0x06, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0x86, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xc6, 0xaf, 0xaa, 0xaa, 0xea, 0x7a, - 0xe6, 0x57, 0x55, 0x55, 0x75, 0x7d, 0xf6, 0xaf, 0xaa, 0xaa, 0xea, 0x7e, - 0xfe, 0x57, 0x55, 0x55, 0x75, 0x7f, 0xfe, 0xaf, 0xaa, 0xaa, 0xea, 0x7f, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x7f, - 0xfe, 0xab, 0xaa, 0xaa, 0xea, 0x7f, 0xfe, 0x55, 0x55, 0x55, 0xf5, 0x6f, - 0xfe, 0xaa, 0xaa, 0xaa, 0xea, 0x67, 0x7e, 0x55, 0x55, 0x55, 0xf5, 0x63, - 0xbe, 0xaa, 0xaa, 0xaa, 0xea, 0x61, 0xfe, 0xff, 0xff, 0xff, 0xff, 0x60, - 0xfe, 0xff, 0xff, 0xff, 0x7f, 0x60, 0x06, 0x06, 0x00, 0x00, 0x60, 0x60, - 0x06, 0x00, 0x00, 0x00, 0x60, 0x00, 0x06, 0xee, 0x9c, 0x37, 0x60, 0x00, - 0x06, 0xfe, 0x36, 0x33, 0x60, 0x00, 0x06, 0xd6, 0x3e, 0x33, 0x60, 0x00, - 0x06, 0xc6, 0xb6, 0xf7, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/mailfullmsk b/nx-X11/include/bitmaps/mailfullmsk deleted file mode 100644 index 6dfc942eb..000000000 --- a/nx-X11/include/bitmaps/mailfullmsk +++ /dev/null @@ -1,27 +0,0 @@ -#define mailfullmsk_width 48 -#define mailfullmsk_height 48 -static char mailfullmsk_bits[] = { - 0x00, 0xe0, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0x0f, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xf8, 0xff, 0xff, 0xff, 0xff, 0xff, 0xfc, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xfe, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, - 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, 0x0f, 0x0f, 0x00, 0x00, 0xf0, 0xf0, - 0x0f, 0xff, 0xff, 0xff, 0xff, 0xff, 0x8f, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xcf, 0xff, 0xff, 0xff, 0xff, 0xff, 0xef, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf7, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf1, - 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xf0, - 0x0f, 0xff, 0xff, 0xff, 0xf1, 0xf0, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, - 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, - 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00, 0x0f, 0xff, 0xff, 0xff, 0xf1, 0x00}; diff --git a/nx-X11/include/bitmaps/mensetmanus b/nx-X11/include/bitmaps/mensetmanus deleted file mode 100644 index 095b8ec48..000000000 --- a/nx-X11/include/bitmaps/mensetmanus +++ /dev/null @@ -1,258 +0,0 @@ -#define mensetmanus_width 161 -#define mensetmanus_height 145 - -static char mensetmanus_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0x01, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3f, 0xdb, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, - 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf7, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x61, 0x00, 0x00, 0xc6, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3, 0xff, - 0x1f, 0x00, 0x00, 0x00, 0xc0, 0xe1, 0xff, 0xff, 0x87, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xc3, 0xf6, 0x1f, 0x00, 0x00, - 0x00, 0xc0, 0xc0, 0xff, 0xff, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x9f, 0x65, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x00, - 0x07, 0x80, 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x9f, 0x6d, 0x1f, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xff, 0xff, 0xc7, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x89, 0x6d, - 0x1b, 0x00, 0x00, 0x00, 0xc0, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, - 0x00, 0xc0, 0xe1, 0x5b, 0xdb, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x80, 0x83, - 0x5b, 0xdb, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x81, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0xcf, 0x5b, 0x1b, 0x0c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x80, 0x6d, - 0x1b, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x5b, 0x1b, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x80, 0x6d, 0x1b, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0x5b, 0x0b, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xe0, 0x83, 0x6d, 0x19, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x5b, 0x0b, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe0, 0x83, 0x6d, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x5b, 0x0f, 0x0e, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x6d, - 0x1b, 0x00, 0x00, 0x00, 0x00, 0x80, 0x4b, 0x0f, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x83, 0x79, 0x1b, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x6b, 0xbf, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x03, 0xfb, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x6d, 0xb7, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x03, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xed, 0xf7, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xfe, - 0x7f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xed, 0xd7, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x7f, 0xf8, 0xff, 0x07, 0x00, - 0x00, 0x00, 0xe0, 0xfe, 0xd7, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xff, 0x7f, 0xe0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xf0, - 0xff, 0xd6, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0xbf, 0x73, 0x80, 0x3b, 0x7c, 0x00, 0x00, 0x00, 0xf8, 0xe7, 0xd6, 0xef, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xb9, 0x73, 0xc0, - 0x3b, 0xf0, 0x01, 0x00, 0x00, 0xff, 0xc3, 0xbf, 0xe7, 0x3f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xb8, 0x7f, 0xe0, 0x3b, 0xc0, 0x03, - 0x00, 0xc0, 0xbf, 0xc7, 0xbf, 0xe7, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0xb8, 0xff, 0xf8, 0x3b, 0x80, 0x07, 0x00, 0xe0, 0x61, - 0x87, 0xfd, 0xe7, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, - 0xb8, 0xf3, 0xff, 0x3b, 0x00, 0x0f, 0x00, 0x78, 0x60, 0x8e, 0xf1, 0x67, - 0xc7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xb8, 0xc3, 0x8f, - 0x7b, 0x00, 0x0e, 0x00, 0x38, 0xe0, 0x8c, 0x03, 0x66, 0x87, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xb8, 0x03, 0x83, 0x7b, 0x00, 0x1e, - 0x00, 0x1c, 0xe0, 0x1d, 0x03, 0x76, 0x07, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x07, 0xb8, 0xe3, 0x8f, 0xbb, 0x01, 0x39, 0x00, 0x1e, 0xe0, - 0x3b, 0x03, 0xf6, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, - 0xb8, 0xe3, 0x8f, 0x3b, 0xc6, 0x38, 0x00, 0x17, 0xe0, 0x73, 0x07, 0xfe, - 0xff, 0xff, 0x7f, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0b, 0xb8, 0xe7, 0x8e, - 0x3b, 0x38, 0x78, 0x00, 0x13, 0xe0, 0x77, 0x06, 0xfe, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0xe0, 0x12, 0x3c, 0xff, 0xce, 0x3b, 0x00, 0x78, - 0x80, 0x13, 0x60, 0xef, 0x0e, 0xfe, 0x00, 0x00, 0x60, 0x08, 0x00, 0x00, - 0x00, 0x70, 0x22, 0x3e, 0xfc, 0xfe, 0x39, 0x00, 0xe8, 0x80, 0x61, 0x60, - 0xce, 0x0f, 0xfe, 0x00, 0x00, 0x60, 0xf8, 0x00, 0x00, 0x00, 0x70, 0xc2, - 0x39, 0xf8, 0x7e, 0x38, 0x00, 0xc8, 0xc0, 0x81, 0x71, 0xde, 0x0f, 0xfe, - 0x00, 0x00, 0x60, 0x88, 0x00, 0x00, 0x00, 0x70, 0x04, 0x38, 0xe0, 0x0e, - 0x38, 0x00, 0xc4, 0xc0, 0x01, 0x7e, 0xbc, 0x1f, 0xfe, 0x00, 0x00, 0x60, - 0x88, 0x00, 0x00, 0x00, 0x78, 0x04, 0x38, 0xe0, 0x0e, 0x38, 0x00, 0xc4, - 0xc1, 0x01, 0x60, 0x3c, 0x1f, 0xfe, 0x00, 0x00, 0x60, 0x84, 0x0f, 0x00, - 0x00, 0x78, 0x08, 0x38, 0xe0, 0x0f, 0x38, 0x00, 0x82, 0xe1, 0x01, 0x60, - 0x74, 0x3e, 0xfe, 0x00, 0x00, 0x60, 0x44, 0x08, 0x00, 0x00, 0xb8, 0x10, - 0x38, 0xe0, 0x0f, 0x38, 0x00, 0x81, 0xe1, 0x00, 0x60, 0xe4, 0x3e, 0xfe, - 0x00, 0x00, 0x60, 0x44, 0x08, 0x00, 0x00, 0x98, 0x20, 0x38, 0xf8, 0x3f, - 0x38, 0x80, 0x80, 0xe1, 0x01, 0x60, 0xc4, 0x3c, 0xfe, 0x00, 0x00, 0x60, - 0x24, 0x0c, 0x00, 0x00, 0x1c, 0xc1, 0x39, 0x3c, 0x78, 0x38, 0x40, 0x80, - 0x61, 0x01, 0x60, 0xc4, 0x79, 0xfe, 0x00, 0x00, 0x60, 0x22, 0x32, 0x00, - 0x00, 0x1c, 0x01, 0x3e, 0x1c, 0xf0, 0x38, 0xf0, 0x9f, 0x61, 0x01, 0x60, - 0x84, 0x7b, 0xee, 0x00, 0x00, 0x60, 0x12, 0x21, 0x00, 0x00, 0x1c, 0x02, - 0x38, 0x0e, 0xe7, 0xf8, 0x3f, 0xe0, 0x61, 0x00, 0x60, 0x04, 0xf7, 0xce, - 0x00, 0x00, 0x60, 0x92, 0x10, 0x00, 0x00, 0x1c, 0x04, 0x38, 0x06, 0xff, - 0x38, 0x40, 0x80, 0x61, 0x02, 0x60, 0x04, 0xe7, 0xcf, 0x00, 0x00, 0x60, - 0x8a, 0x18, 0x00, 0x00, 0x1c, 0x18, 0x38, 0x07, 0xf0, 0x38, 0x00, 0x81, - 0x61, 0x02, 0x60, 0x04, 0xee, 0xcf, 0xff, 0x03, 0x60, 0x49, 0xe4, 0x00, - 0x00, 0x1c, 0x70, 0x38, 0x07, 0xe7, 0x38, 0x00, 0x82, 0x61, 0x04, 0x60, - 0x04, 0xdc, 0xcf, 0x01, 0x04, 0x60, 0x25, 0x42, 0x00, 0x00, 0x1c, 0xfe, - 0x3f, 0x03, 0xff, 0x38, 0x00, 0x84, 0x61, 0x08, 0x60, 0x04, 0xfc, 0xcf, - 0xf8, 0xff, 0x60, 0x95, 0x31, 0x00, 0x00, 0xfc, 0x01, 0xff, 0x03, 0xf0, - 0xf8, 0x1f, 0x88, 0x61, 0x10, 0xe0, 0xff, 0xff, 0xff, 0x00, 0x00, 0xe1, - 0x53, 0x0c, 0x00, 0x00, 0x38, 0xf0, 0xff, 0x03, 0xef, 0xf8, 0x7f, 0x90, - 0x61, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x00, 0xff, 0xe3, 0x2b, 0xfe, 0x00, - 0x00, 0x18, 0xf8, 0xff, 0x03, 0xff, 0x7c, 0xf0, 0x90, 0x61, 0x00, 0x3e, - 0x36, 0xe3, 0xe1, 0x00, 0x00, 0xe3, 0x9f, 0x60, 0x00, 0x00, 0x38, 0x3c, - 0x00, 0x03, 0xf0, 0x1f, 0xe0, 0xa0, 0xe1, 0x00, 0x30, 0x22, 0xe2, 0xc0, - 0x00, 0xff, 0xe3, 0x7f, 0x18, 0x00, 0x00, 0x38, 0x0e, 0x00, 0x07, 0xe7, - 0x07, 0xc0, 0xe1, 0xc1, 0x00, 0x18, 0x22, 0xe2, 0xc0, 0x00, 0x00, 0xe1, - 0x1f, 0x07, 0x00, 0x00, 0x38, 0x06, 0x00, 0x07, 0xef, 0x01, 0xc0, 0xc1, - 0xc1, 0x01, 0x16, 0x24, 0xe2, 0xc0, 0x01, 0xff, 0xe1, 0xff, 0x00, 0x00, - 0x00, 0x70, 0x07, 0x00, 0x0e, 0xf8, 0x00, 0x80, 0xc3, 0xc0, 0xf1, 0x11, - 0x24, 0xe4, 0xc0, 0x03, 0xe0, 0xe1, 0x7f, 0x00, 0x00, 0x00, 0x70, 0x07, - 0x00, 0x1e, 0x3c, 0x00, 0x80, 0xe3, 0x80, 0x0f, 0x10, 0x24, 0xe4, 0xc0, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0xfc, 0x0f, - 0x00, 0x00, 0x63, 0x80, 0x01, 0x08, 0x44, 0xe4, 0xc0, 0xff, 0xff, 0xff, - 0xff, 0xff, 0x01, 0x00, 0xe0, 0x03, 0x00, 0xf8, 0x07, 0x00, 0x00, 0x73, - 0x80, 0x03, 0x08, 0x44, 0xe4, 0xc0, 0xfc, 0x00, 0x07, 0x0e, 0x00, 0x00, - 0x00, 0xc0, 0x03, 0x00, 0xf0, 0x01, 0x00, 0x00, 0x33, 0x00, 0x03, 0x08, - 0x44, 0xe4, 0xe0, 0xcc, 0x00, 0x07, 0x0e, 0x00, 0x00, 0x00, 0xc0, 0x03, - 0x00, 0x78, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x07, 0x04, 0x44, 0xe8, 0x70, - 0xcc, 0x01, 0x87, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x3e, 0x00, - 0x00, 0x80, 0x1f, 0x00, 0x0e, 0x04, 0x44, 0xe8, 0x38, 0xcc, 0x81, 0xe7, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x0f, 0x00, 0x00, 0x80, 0x0f, - 0x00, 0x1c, 0x02, 0x44, 0xf8, 0x1e, 0xcc, 0xe1, 0xff, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0f, 0xc0, 0x23, 0x00, 0x00, 0xc0, 0x07, 0x00, 0x38, 0x01, - 0x42, 0xfc, 0x0f, 0xcc, 0xf1, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, - 0xf0, 0x39, 0x00, 0x00, 0xe0, 0x03, 0x00, 0xf0, 0x00, 0xc2, 0xff, 0x07, - 0xcc, 0x7f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x7c, 0x0e, 0x00, - 0x00, 0xf0, 0x01, 0x00, 0xe0, 0x03, 0xe2, 0xe7, 0x07, 0xcc, 0x1f, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xbf, 0x23, 0xe0, 0xff, 0xff, 0x00, - 0x00, 0xc0, 0x1f, 0xff, 0x64, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0xff, 0x3c, 0xf0, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xff, - 0x7f, 0x64, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, - 0xf8, 0x1f, 0x78, 0x7c, 0x7f, 0x00, 0x00, 0x00, 0xfc, 0x20, 0x64, 0x06, - 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0xf8, 0x33, 0x1c, - 0x38, 0x66, 0x00, 0x00, 0x00, 0x0c, 0x20, 0x6c, 0x06, 0xcc, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x78, 0x3e, 0x0e, 0x38, 0x76, 0x00, - 0x00, 0x00, 0x0c, 0x20, 0x68, 0x06, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0xf8, 0x87, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, - 0x20, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, - 0x78, 0xf8, 0x0f, 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, - 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xf8, 0xff, 0x0f, - 0x38, 0x76, 0x00, 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0xf8, 0xff, 0x0e, 0x38, 0x76, 0x00, - 0x00, 0x00, 0x0c, 0x10, 0x68, 0x06, 0xcc, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x1c, 0xf8, 0xe1, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, - 0x08, 0x68, 0x06, 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, - 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x68, 0x06, - 0xcc, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x0e, - 0x38, 0x3e, 0x00, 0x00, 0x00, 0x0c, 0x04, 0x68, 0x06, 0xcc, 0x0e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, - 0x00, 0x00, 0x1c, 0x04, 0x68, 0x06, 0xcc, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x06, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, - 0x02, 0x68, 0x06, 0xcc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, - 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x02, 0x68, 0x06, - 0xcc, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0xe0, 0x0e, - 0x38, 0x3e, 0x00, 0x00, 0x00, 0x1c, 0x01, 0x68, 0x06, 0xcc, 0x1c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, - 0x00, 0x00, 0x18, 0x01, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x03, 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x98, - 0x00, 0x68, 0x06, 0xcc, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, - 0x38, 0xe0, 0x0e, 0x38, 0x3e, 0x00, 0x00, 0x00, 0x98, 0x00, 0x68, 0x06, - 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x38, 0xe0, 0x0e, - 0x38, 0x1e, 0x00, 0x00, 0x00, 0x58, 0x00, 0x6c, 0x0e, 0xcc, 0x18, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x30, 0xe0, 0x0e, 0x38, 0x1e, 0x00, - 0x00, 0x00, 0x38, 0x00, 0x64, 0x0e, 0xcc, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x01, 0x70, 0xe0, 0x0e, 0x1c, 0x1e, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x64, 0x1e, 0xcc, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, - 0xe0, 0xe1, 0x0e, 0x0f, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x3e, - 0xcc, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0xef, 0xce, - 0x07, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x64, 0x3e, 0xcc, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0xff, 0xfe, 0x03, 0x1e, 0x00, - 0x00, 0x00, 0x18, 0x00, 0x64, 0x7e, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x00, 0xfc, 0xfe, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, - 0x00, 0x64, 0x66, 0xcc, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0x00, 0xe0, 0x1e, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x66, 0xe6, - 0xcc, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xe0, 0x0e, - 0x00, 0x1e, 0x00, 0x00, 0x00, 0x18, 0x00, 0x62, 0xc6, 0xcd, 0x70, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0xfe, 0xff, 0x0f, 0x1e, 0x00, - 0x00, 0x00, 0x18, 0x00, 0x62, 0xc6, 0xcd, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x70, 0x00, 0xc0, 0xff, 0xff, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x38, - 0x00, 0x62, 0x86, 0xcf, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, - 0xf0, 0xff, 0xff, 0x0f, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x61, 0x86, - 0xcf, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0xfc, 0x00, 0x00, - 0x0e, 0x0e, 0x00, 0x00, 0x00, 0x38, 0x00, 0x61, 0x8e, 0xcf, 0xe0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x78, 0x00, 0x00, 0x0e, 0x0e, 0x00, - 0x00, 0x00, 0xf8, 0xff, 0x7f, 0xfe, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x00, 0xf0, 0x00, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf0, - 0xff, 0x3f, 0xff, 0xdf, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, - 0xe0, 0x01, 0x00, 0x0e, 0x0e, 0x00, 0x00, 0x00, 0xf0, 0xff, 0x8f, 0x07, - 0x9e, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xe0, 0x07, 0x00, - 0x0e, 0x0f, 0x00, 0x00, 0x00, 0x30, 0x00, 0xc0, 0xff, 0x3f, 0xc0, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x0f, 0x00, - 0x00, 0x00, 0xf0, 0xff, 0xff, 0xff, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x1c, 0x00, 0xfe, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0xf0, - 0xff, 0xff, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, - 0x3f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, - 0x38, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x7f, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x38, 0x00, 0x38, 0xe0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0xdc, 0x01, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, - 0x38, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x9c, 0x03, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x18, 0x70, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x07, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x1c, 0xfe, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x0c, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0x1c, 0xfc, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0c, 0x00, - 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, - 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0x1c, 0x1c, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, - 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x1c, 0x00, - 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x18, 0x38, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x07, 0x06, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0xfc, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x0e, 0x00, 0x18, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, - 0x18, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x30, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x1c, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x0e, 0x00, 0x18, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0c, 0x00, - 0x38, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0x70, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x1c, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x06, 0x18, 0x00, 0x38, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x18, 0x00, - 0x30, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x1e, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x38, 0x00, 0x30, 0xe0, 0x01, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x3c, 0x00, 0x30, 0xf0, 0x01, 0x00, 0x00, 0x00, - 0x00, 0xf8, 0x03, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0x7e, 0x00, 0x70, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x0f, - 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xe7, 0x00, - 0x70, 0xbc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x1e, 0x1e, 0x1f, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0xdc, 0xe3, 0x00, 0x60, 0x1e, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0xfc, 0xc1, 0x01, 0xe0, 0x0f, 0x0f, 0x00, 0x00, 0x00, - 0x80, 0x07, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x80, 0x03, 0xe0, 0x03, 0x1e, 0x00, 0x00, 0x00, 0xc0, 0x03, 0xe0, - 0x1b, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0x07, - 0xe0, 0x01, 0x1c, 0x00, 0x00, 0x00, 0xe0, 0x01, 0xc0, 0x1b, 0x00, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x0f, 0xe0, 0x01, 0x38, - 0x00, 0x00, 0x00, 0xf0, 0x00, 0xc0, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, - 0x00, 0x00, 0x00, 0x30, 0x0e, 0x1e, 0xc0, 0x71, 0xf8, 0x00, 0x00, 0x00, - 0x78, 0x00, 0xdc, 0x19, 0x00, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x1f, 0x1e, 0xc0, 0xf9, 0xf8, 0x00, 0x00, 0x00, 0xfc, 0xff, 0xff, - 0xff, 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xff, - 0xff, 0xff, 0xff, 0x07, 0x00, 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, - 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, 0xff, 0xff, 0xff, 0xff, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 }; diff --git a/nx-X11/include/bitmaps/menu10 b/nx-X11/include/bitmaps/menu10 deleted file mode 100644 index 6250e8e3c..000000000 --- a/nx-X11/include/bitmaps/menu10 +++ /dev/null @@ -1,5 +0,0 @@ -#define menu10_width 10 -#define menu10_height 10 -static char menu10_bits[] = { - 0xfe, 0x01, 0x02, 0x01, 0x02, 0x03, 0x32, 0x03, 0x02, 0x03, 0x32, 0x03, - 0x02, 0x03, 0x02, 0x03, 0xfe, 0x03, 0xf8, 0x03}; diff --git a/nx-X11/include/bitmaps/menu12 b/nx-X11/include/bitmaps/menu12 deleted file mode 100644 index e88ca688b..000000000 --- a/nx-X11/include/bitmaps/menu12 +++ /dev/null @@ -1,5 +0,0 @@ -#define menu12_width 12 -#define menu12_height 12 -static unsigned char menu12_bits[] = { - 0xfe, 0x03, 0x02, 0x02, 0x02, 0x06, 0x72, 0x06, 0x02, 0x06, 0x72, 0x06, - 0x02, 0x06, 0x72, 0x06, 0x02, 0x06, 0x02, 0x06, 0xfe, 0x07, 0xf8, 0x07}; diff --git a/nx-X11/include/bitmaps/menu16 b/nx-X11/include/bitmaps/menu16 deleted file mode 100644 index 770deeea5..000000000 --- a/nx-X11/include/bitmaps/menu16 +++ /dev/null @@ -1,6 +0,0 @@ -#define menu16_width 16 -#define menu16_height 16 -static char menu16_bits[] = { - 0xfc, 0x1f, 0x04, 0x10, 0x04, 0x30, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, - 0xe4, 0x33, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, 0xe4, 0x33, 0x04, 0x30, - 0x04, 0x30, 0x04, 0x30, 0xfc, 0x3f, 0xf0, 0x3f}; diff --git a/nx-X11/include/bitmaps/menu6 b/nx-X11/include/bitmaps/menu6 deleted file mode 100644 index 780b028b5..000000000 --- a/nx-X11/include/bitmaps/menu6 +++ /dev/null @@ -1,4 +0,0 @@ -#define menu6_width 6 -#define menu6_height 7 -static char menu6_bits[] = { - 0x1f, 0x31, 0x35, 0x35, 0x31, 0x3f, 0x1e}; diff --git a/nx-X11/include/bitmaps/menu8 b/nx-X11/include/bitmaps/menu8 deleted file mode 100644 index 955c1e92b..000000000 --- a/nx-X11/include/bitmaps/menu8 +++ /dev/null @@ -1,4 +0,0 @@ -#define menu8_width 8 -#define menu8_height 8 -static char menu8_bits[] = { - 0x7f, 0x41, 0xdd, 0xc1, 0xdd, 0xc1, 0xff, 0xfc}; diff --git a/nx-X11/include/bitmaps/noletters b/nx-X11/include/bitmaps/noletters deleted file mode 100644 index 5774124ef..000000000 --- a/nx-X11/include/bitmaps/noletters +++ /dev/null @@ -1,27 +0,0 @@ -#define noletters_width 48 -#define noletters_height 48 -static char noletters_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, - 0x00, 0xf0, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0x00, - 0x00, 0x3e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0x01, - 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0xc0, 0x03, 0x00, 0x00, 0xe0, 0x07, - 0xe0, 0x01, 0x00, 0x00, 0xf0, 0x0f, 0xe0, 0x00, 0x00, 0x00, 0x78, 0x0e, - 0xf0, 0x00, 0x00, 0x00, 0x3c, 0x1e, 0x70, 0x00, 0x00, 0x00, 0x1e, 0x1c, - 0x38, 0x00, 0x00, 0x00, 0x0f, 0x38, 0x38, 0x00, 0x00, 0x80, 0x07, 0x38, - 0x3c, 0xfc, 0xff, 0xff, 0x7f, 0x78, 0x1c, 0x04, 0x00, 0xe0, 0x41, 0x70, - 0x1c, 0x04, 0x00, 0xf0, 0x40, 0x70, 0x1c, 0x74, 0x00, 0x78, 0x4e, 0x70, - 0x0e, 0x04, 0x00, 0x3c, 0x4a, 0xe0, 0x0e, 0x74, 0x03, 0x1e, 0x4a, 0xe0, - 0x0e, 0x04, 0x00, 0x0f, 0x4e, 0xe0, 0x0e, 0x04, 0x80, 0x07, 0x40, 0xe0, - 0x0e, 0x04, 0xf8, 0x0f, 0x40, 0xe0, 0x0e, 0x04, 0xe0, 0x01, 0x40, 0xe0, - 0x0e, 0x04, 0xf8, 0x00, 0x40, 0xe0, 0x0e, 0x04, 0x78, 0x00, 0x40, 0xe0, - 0x0e, 0x04, 0xfc, 0xf3, 0x40, 0xe0, 0x1c, 0x04, 0x1e, 0x00, 0x40, 0x70, - 0x1c, 0x04, 0x0f, 0x00, 0x40, 0x70, 0x1c, 0x84, 0x07, 0x00, 0x40, 0x70, - 0x3c, 0xfc, 0xff, 0xff, 0x7f, 0x78, 0x38, 0xe0, 0x01, 0x00, 0x00, 0x38, - 0x38, 0xf0, 0x00, 0x00, 0x00, 0x38, 0x70, 0x78, 0x00, 0x00, 0x00, 0x1c, - 0xf0, 0x3c, 0x00, 0x00, 0x00, 0x1e, 0xe0, 0x1e, 0x00, 0x00, 0x00, 0x0e, - 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x07, 0x00, 0x00, 0x80, 0x07, - 0x80, 0x07, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1f, 0x00, 0x00, 0xf0, 0x01, - 0x00, 0x3e, 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x7f, 0x00, - 0x00, 0xf0, 0x0f, 0xe0, 0x1f, 0x00, 0x00, 0xc0, 0xff, 0xff, 0x07, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0xf0, 0x1f, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/opendot b/nx-X11/include/bitmaps/opendot deleted file mode 100644 index a8ec421df..000000000 --- a/nx-X11/include/bitmaps/opendot +++ /dev/null @@ -1,8 +0,0 @@ -#define opendot_width 16 -#define opendot_height 16 -#define opendot_x_hot 7 -#define opendot_y_hot 7 -static char opendot_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, - 0x60, 0x03, 0x20, 0x02, 0x60, 0x03, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/opendotMask b/nx-X11/include/bitmaps/opendotMask deleted file mode 100644 index 0f83c64de..000000000 --- a/nx-X11/include/bitmaps/opendotMask +++ /dev/null @@ -1,8 +0,0 @@ -#define opendotMask_width 16 -#define opendotMask_height 16 -#define opendotMask_x_hot 7 -#define opendotMask_y_hot 7 -static char opendotMask_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0xf0, 0x07, - 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xf0, 0x07, 0xe0, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/plaid b/nx-X11/include/bitmaps/plaid deleted file mode 100644 index 578e464db..000000000 --- a/nx-X11/include/bitmaps/plaid +++ /dev/null @@ -1,11 +0,0 @@ -#define plaid_width 22 -#define plaid_height 22 -#define plaid_x_hot -1 -#define plaid_y_hot -1 -static char plaid_bits[] = { - 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, - 0x75, 0xfd, 0x3f, 0xff, 0x57, 0x15, 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, - 0x75, 0xfd, 0x3f, 0xaa, 0xfa, 0x3e, 0x75, 0xfd, 0x3f, 0x20, 0xa8, 0x2b, - 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, - 0xff, 0xff, 0x3f, 0x20, 0xa8, 0x2b, 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b, - 0x20, 0x50, 0x15, 0x20, 0xa8, 0x2b}; diff --git a/nx-X11/include/bitmaps/right_ptr b/nx-X11/include/bitmaps/right_ptr deleted file mode 100644 index 3922aa562..000000000 --- a/nx-X11/include/bitmaps/right_ptr +++ /dev/null @@ -1,8 +0,0 @@ -#define right_ptr_width 16 -#define right_ptr_height 16 -#define right_ptr_x_hot 12 -#define right_ptr_y_hot 1 -static char right_ptr_bits[] = { - 0x00, 0x00, 0x00, 0x10, 0x00, 0x18, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x1f, - 0x80, 0x1f, 0xc0, 0x1f, 0xe0, 0x1f, 0x00, 0x1f, 0x00, 0x1b, 0x80, 0x11, - 0x80, 0x01, 0xc0, 0x00, 0xc0, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/right_ptrmsk b/nx-X11/include/bitmaps/right_ptrmsk deleted file mode 100644 index 96f532488..000000000 --- a/nx-X11/include/bitmaps/right_ptrmsk +++ /dev/null @@ -1,6 +0,0 @@ -#define right_ptrmsk_width 16 -#define right_ptrmsk_height 16 -static char right_ptrmsk_bits[] = { - 0x00, 0x30, 0x00, 0x38, 0x00, 0x3c, 0x00, 0x3e, 0x00, 0x3f, 0x80, 0x3f, - 0xc0, 0x3f, 0xe0, 0x3f, 0xf0, 0x3f, 0xf0, 0x3f, 0x80, 0x3f, 0xc0, 0x3b, - 0xc0, 0x33, 0xe0, 0x01, 0xe0, 0x01, 0xc0, 0x00}; diff --git a/nx-X11/include/bitmaps/root_weave b/nx-X11/include/bitmaps/root_weave deleted file mode 100644 index ec41e436f..000000000 --- a/nx-X11/include/bitmaps/root_weave +++ /dev/null @@ -1,4 +0,0 @@ -#define root_weave_width 4 -#define root_weave_height 4 -static char root_weave_bits[] = { - 0x07, 0x0d, 0x0b, 0x0e}; diff --git a/nx-X11/include/bitmaps/scales b/nx-X11/include/bitmaps/scales deleted file mode 100644 index e5aac6acb..000000000 --- a/nx-X11/include/bitmaps/scales +++ /dev/null @@ -1,6 +0,0 @@ -#define scales_width 16 -#define scales_height 16 -static char scales_bits[] = { - 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0xc7, 0xc7, 0x01, 0x01, 0x01, 0x01, - 0x82, 0x82, 0x7c, 0x7c, 0x10, 0x10, 0x10, 0x10, 0x28, 0x28, 0xc7, 0xc7, - 0x01, 0x01, 0x01, 0x01, 0x82, 0x82, 0x7c, 0x7c}; diff --git a/nx-X11/include/bitmaps/sipb b/nx-X11/include/bitmaps/sipb deleted file mode 100644 index 7f3b7c1a6..000000000 --- a/nx-X11/include/bitmaps/sipb +++ /dev/null @@ -1,16 +0,0 @@ -#define sipb_width 32 -#define sipb_height 32 -#define sipb_x_hot 12 -#define sipb_y_hot 16 -static char sipb_bits[] = { - 0xbe, 0xdf, 0x03, 0x00, 0x22, 0x49, 0x04, 0x00, 0x04, 0x49, 0x04, 0x00, - 0x08, 0x49, 0x04, 0x00, 0x10, 0xc9, 0x03, 0x00, 0x08, 0x49, 0x04, 0x00, - 0x04, 0x49, 0x04, 0x00, 0x22, 0x49, 0x04, 0x00, 0x3e, 0xc9, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xfd, 0x1e, 0x00, 0x10, 0x49, 0x22, - 0x00, 0x20, 0x48, 0x22, 0x00, 0x40, 0x48, 0x22, 0x00, 0x80, 0x48, 0x1e, - 0x00, 0x40, 0x48, 0x22, 0x00, 0x20, 0x48, 0x22, 0x00, 0x10, 0x49, 0x22, - 0x00, 0xf0, 0x49, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/star b/nx-X11/include/bitmaps/star deleted file mode 100644 index c98f1a4ab..000000000 --- a/nx-X11/include/bitmaps/star +++ /dev/null @@ -1,8 +0,0 @@ -#define star_width 16 -#define star_height 16 -#define star_x_hot 7 -#define star_y_hot 7 -static char star_bits[] = { - 0x00, 0x00, 0x80, 0x00, 0x80, 0x00, 0x88, 0x08, 0x90, 0x04, 0xa0, 0x02, - 0x40, 0x01, 0x3e, 0x3e, 0x40, 0x01, 0xa0, 0x02, 0x90, 0x04, 0x88, 0x08, - 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/starMask b/nx-X11/include/bitmaps/starMask deleted file mode 100644 index c220bb6ff..000000000 --- a/nx-X11/include/bitmaps/starMask +++ /dev/null @@ -1,8 +0,0 @@ -#define starMask_width 16 -#define starMask_height 16 -#define starMask_x_hot 7 -#define starMask_y_hot 7 -static char starMask_bits[] = { - 0xc0, 0x01, 0xc0, 0x01, 0xdc, 0x1d, 0xfc, 0x1f, 0xfc, 0x1f, 0xf8, 0x0f, - 0xff, 0x7f, 0xff, 0x7f, 0xff, 0x7f, 0xf8, 0x0f, 0xfc, 0x1f, 0xfc, 0x1f, - 0xdc, 0x1d, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/stipple b/nx-X11/include/bitmaps/stipple deleted file mode 100644 index 63558d026..000000000 --- a/nx-X11/include/bitmaps/stipple +++ /dev/null @@ -1,4 +0,0 @@ -#define stipple_width 16 -#define stipple_height 4 -static char stipple_bits[] = { - 0x55, 0x55, 0xee, 0xee, 0x55, 0x55, 0xba, 0xbb}; diff --git a/nx-X11/include/bitmaps/target b/nx-X11/include/bitmaps/target deleted file mode 100644 index 6d23ecada..000000000 --- a/nx-X11/include/bitmaps/target +++ /dev/null @@ -1,6 +0,0 @@ -#define target_width 16 -#define target_height 16 -static char target_bits[] = { - 0x00, 0x00, 0x80, 0x01, 0x80, 0x01, 0xe0, 0x07, 0x90, 0x09, 0x88, 0x11, - 0xc8, 0x13, 0x7e, 0x7e, 0x7e, 0x7e, 0xc8, 0x13, 0x88, 0x11, 0x90, 0x09, - 0xe0, 0x07, 0x80, 0x01, 0x80, 0x01, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/terminal b/nx-X11/include/bitmaps/terminal deleted file mode 100644 index b8d9204bd..000000000 --- a/nx-X11/include/bitmaps/terminal +++ /dev/null @@ -1,52 +0,0 @@ -/*****************************************************************************/ -/** Copyright 1988 by Evans & Sutherland Computer Corporation, **/ -/** Salt Lake City, Utah **/ -/** **/ -/** All Rights Reserved **/ -/** **/ -/** 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 permis- **/ -/** sion notice appear in supporting documentation, and that the **/ -/** name of Evans & Sutherland not be used in advertising or publi- **/ -/** city pertaining to distribution of the software without specif- **/ -/** ic, written prior permission. **/ -/** **/ -/** EVANS & SUTHERLAND DISCLAIMS ALL WARRANTIES WITH REGARD TO **/ -/** THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILI- **/ -/** TY AND FITNESS, IN NO EVENT SHALL EVANS & SUTHERLAND BE LIABLE **/ -/** FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAM- **/ -/** AGES 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 PER- **/ -/** FORMANCE OF THIS SOFTWARE. **/ -/*****************************************************************************/ - -#define xterm_width 48 -#define xterm_height 48 -static char xterm_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0x20, 0xfe, 0xff, 0xff, 0x1f, 0x05, - 0x20, 0x01, 0x00, 0x00, 0x20, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, - 0xa0, 0xfc, 0xff, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0xfc, 0x01, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0xfc, 0xff, 0x3f, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0xfc, 0x03, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0xfc, 0xff, 0x01, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0xfc, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, - 0xa0, 0x00, 0x00, 0x00, 0x40, 0x21, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, - 0xa0, 0x00, 0x00, 0x00, 0x40, 0x11, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x09, - 0xa0, 0x00, 0x00, 0x00, 0x40, 0x09, 0xa0, 0x00, 0x00, 0x00, 0x40, 0x05, - 0x20, 0x01, 0x00, 0x00, 0x20, 0x05, 0x20, 0xfe, 0xff, 0xff, 0x1f, 0x03, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, 0xc0, 0xff, 0xff, 0xff, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xff, 0xff, 0xff, 0xff, 0x03, 0x20, 0x00, 0x00, 0x00, 0x00, 0x03, - 0xa0, 0xaa, 0xaa, 0xaa, 0x2a, 0x03, 0x10, 0x00, 0x00, 0x00, 0x80, 0x02, - 0x50, 0x55, 0x55, 0x55, 0x95, 0x02, 0x08, 0x00, 0x00, 0x00, 0x40, 0x02, - 0xa8, 0xaa, 0xaa, 0xaa, 0x4a, 0x02, 0x04, 0x00, 0x00, 0x00, 0x20, 0x01, - 0xb4, 0xff, 0xff, 0xff, 0xad, 0x00, 0x02, 0x00, 0x00, 0x00, 0x50, 0x00, - 0xfe, 0xff, 0xff, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/tie_fighter b/nx-X11/include/bitmaps/tie_fighter deleted file mode 100644 index 0513db646..000000000 --- a/nx-X11/include/bitmaps/tie_fighter +++ /dev/null @@ -1,6 +0,0 @@ -#define tie_fighter_width 16 -#define tie_fighter_height 16 -static char tie_fighter_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x08, 0x10, 0x04, 0x20, 0x02, 0x40, 0x02, 0x40, - 0xe2, 0x47, 0x3e, 0x7c, 0x12, 0x48, 0x3e, 0x7c, 0xe2, 0x47, 0x02, 0x40, - 0x42, 0x42, 0x64, 0x26, 0x28, 0x14, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/vlines2 b/nx-X11/include/bitmaps/vlines2 deleted file mode 100644 index f42ae583f..000000000 --- a/nx-X11/include/bitmaps/vlines2 +++ /dev/null @@ -1,4 +0,0 @@ -#define vlines2_width 2 -#define vlines2_height 1 -static char vlines2_bits[] = { - 0x01}; diff --git a/nx-X11/include/bitmaps/vlines3 b/nx-X11/include/bitmaps/vlines3 deleted file mode 100644 index 55c224654..000000000 --- a/nx-X11/include/bitmaps/vlines3 +++ /dev/null @@ -1,4 +0,0 @@ -#define vlines3_width 3 -#define vlines3_height 1 -static char vlines3_bits[] = { - 0x02}; diff --git a/nx-X11/include/bitmaps/weird_size b/nx-X11/include/bitmaps/weird_size deleted file mode 100644 index e6f45d506..000000000 --- a/nx-X11/include/bitmaps/weird_size +++ /dev/null @@ -1,5 +0,0 @@ -#define weird_size_width 7 -#define weird_size_height 13 -static char weird_size_bits[] = { - 0x07, 0x05, 0x07, 0x01, 0x75, 0x45, 0x74, 0x44, 0x74, 0x00, 0x10, 0x38, - 0x10}; diff --git a/nx-X11/include/bitmaps/wide_weave b/nx-X11/include/bitmaps/wide_weave deleted file mode 100644 index 27ba6397f..000000000 --- a/nx-X11/include/bitmaps/wide_weave +++ /dev/null @@ -1,6 +0,0 @@ -#define wide_weave_width 16 -#define wide_weave_height 16 -static char wide_weave_bits[] = { - 0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a, 0x11, 0x11, 0xa3, 0xa3, - 0xc7, 0xc7, 0x8b, 0x8b, 0x11, 0x11, 0xb8, 0xb8, 0x7c, 0x7c, 0x3a, 0x3a, - 0x11, 0x11, 0xa3, 0xa3, 0xc7, 0xc7, 0x8b, 0x8b}; diff --git a/nx-X11/include/bitmaps/wingdogs b/nx-X11/include/bitmaps/wingdogs deleted file mode 100644 index 1a4befc44..000000000 --- a/nx-X11/include/bitmaps/wingdogs +++ /dev/null @@ -1,14 +0,0 @@ -#define wingdogs_width 32 -#define wingdogs_height 32 -static char wingdogs_bits[] = { - 0x60, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, - 0x20, 0x0f, 0x00, 0x00, 0x40, 0x3e, 0x00, 0x00, 0xc0, 0x7f, 0x00, 0x80, - 0x84, 0xff, 0x00, 0xc0, 0x86, 0xff, 0x00, 0xc0, 0x07, 0xff, 0x21, 0xe0, - 0x0f, 0xfe, 0x23, 0xf0, 0x0f, 0xfe, 0x23, 0xfc, 0x1d, 0xfe, 0x13, 0xfe, - 0x39, 0xfc, 0x13, 0xff, 0x3f, 0xfc, 0x83, 0xff, 0x9f, 0xfc, 0xc1, 0xff, - 0x0f, 0xfe, 0xe0, 0xff, 0xf3, 0xff, 0xff, 0xff, 0xf9, 0xff, 0xff, 0xff, - 0xfc, 0xff, 0xff, 0x7f, 0xf6, 0xff, 0xff, 0x1f, 0xfb, 0xff, 0xff, 0x07, - 0xf8, 0xfd, 0xff, 0x03, 0xbc, 0xf9, 0xff, 0x01, 0x3c, 0xf9, 0xff, 0x01, - 0x3e, 0xf0, 0xf7, 0x00, 0x1f, 0xe0, 0x77, 0x00, 0x1f, 0x80, 0x77, 0x00, - 0x8f, 0x00, 0x6f, 0x00, 0xc7, 0x00, 0x6e, 0x80, 0x07, 0x00, 0x7c, 0x80, - 0x0d, 0x00, 0xf8, 0x80, 0x1f, 0x00, 0xf0, 0x01}; diff --git a/nx-X11/include/bitmaps/woman b/nx-X11/include/bitmaps/woman deleted file mode 100644 index 92e604186..000000000 --- a/nx-X11/include/bitmaps/woman +++ /dev/null @@ -1,66 +0,0 @@ -#define sorceress_width 75 -#define sorceress_height 75 -static char sorceress_bits[] = { - 0xfc, 0x7e, 0x40, 0x20, 0x90, 0x00, 0x07, 0x80, 0x23, 0x00, 0x00, 0xc6, - 0xc1, 0x41, 0x98, 0xb8, 0x01, 0x07, 0x66, 0x00, 0x15, 0x9f, 0x03, 0x47, - 0x8c, 0xc6, 0xdc, 0x7b, 0xcc, 0x00, 0xb0, 0x71, 0x0e, 0x4d, 0x06, 0x66, - 0x73, 0x8e, 0x8f, 0x01, 0x18, 0xc4, 0x39, 0x4b, 0x02, 0x23, 0x0c, 0x04, - 0x1e, 0x03, 0x0c, 0x08, 0xc7, 0xef, 0x08, 0x30, 0x06, 0x07, 0x1c, 0x02, - 0x06, 0x30, 0x18, 0xae, 0xc8, 0x98, 0x3f, 0x78, 0x20, 0x06, 0x02, 0x20, - 0x60, 0xa0, 0xc4, 0x1d, 0xc0, 0xff, 0x41, 0x04, 0xfa, 0x63, 0x80, 0xa1, - 0xa4, 0x3d, 0x00, 0x84, 0xbf, 0x04, 0x0f, 0x06, 0xfc, 0xa1, 0x34, 0x6b, - 0x01, 0x1c, 0xc9, 0x05, 0x06, 0xc7, 0x06, 0xbe, 0x11, 0x1e, 0x43, 0x30, - 0x91, 0x05, 0xc3, 0x61, 0x02, 0x30, 0x1b, 0x30, 0xcc, 0x20, 0x11, 0x00, - 0xc1, 0x3c, 0x03, 0x20, 0x0a, 0x00, 0xe8, 0x60, 0x21, 0x00, 0x61, 0x1b, - 0xc1, 0x63, 0x08, 0xf0, 0xc6, 0xc7, 0x21, 0x03, 0xf8, 0x08, 0xe1, 0xcf, - 0x0a, 0xfc, 0x4d, 0x99, 0x43, 0x07, 0x3c, 0x0c, 0xf1, 0x9f, 0x0b, 0xfc, - 0x5b, 0x81, 0x47, 0x02, 0x16, 0x04, 0x31, 0x1c, 0x0b, 0x1f, 0x17, 0x89, - 0x4d, 0x06, 0x1a, 0x04, 0x31, 0x38, 0x02, 0x07, 0x56, 0x89, 0x49, 0x04, - 0x0b, 0x04, 0xb1, 0x72, 0x82, 0xa1, 0x54, 0x9a, 0x49, 0x04, 0x1d, 0x66, - 0x50, 0xe7, 0xc2, 0xf0, 0x54, 0x9a, 0x58, 0x04, 0x0d, 0x62, 0xc1, 0x1f, - 0x44, 0xfc, 0x51, 0x90, 0x90, 0x04, 0x86, 0x63, 0xe0, 0x74, 0x04, 0xef, - 0x31, 0x1a, 0x91, 0x00, 0x02, 0xe2, 0xc1, 0xfd, 0x84, 0xf9, 0x30, 0x0a, - 0x91, 0x00, 0x82, 0xa9, 0xc0, 0xb9, 0x84, 0xf9, 0x31, 0x16, 0x81, 0x00, - 0x42, 0xa9, 0xdb, 0x7f, 0x0c, 0xff, 0x1c, 0x16, 0x11, 0x00, 0x02, 0x28, - 0x0b, 0x07, 0x08, 0x60, 0x1c, 0x02, 0x91, 0x00, 0x46, 0x29, 0x0e, 0x00, - 0x00, 0x00, 0x10, 0x16, 0x11, 0x02, 0x06, 0x29, 0x04, 0x00, 0x00, 0x00, - 0x10, 0x16, 0x91, 0x06, 0xa6, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x24, - 0x91, 0x04, 0x86, 0x2a, 0x04, 0x00, 0x00, 0x00, 0x18, 0x27, 0x93, 0x04, - 0x96, 0x4a, 0x04, 0x00, 0x00, 0x00, 0x04, 0x02, 0x91, 0x04, 0x86, 0x4a, - 0x0c, 0x00, 0x00, 0x00, 0x1e, 0x23, 0x93, 0x04, 0x56, 0x88, 0x08, 0x00, - 0x00, 0x00, 0x90, 0x21, 0x93, 0x04, 0x52, 0x0a, 0x09, 0x80, 0x01, 0x00, - 0xd0, 0x21, 0x95, 0x04, 0x57, 0x0a, 0x0f, 0x80, 0x27, 0x00, 0xd8, 0x20, - 0x9d, 0x04, 0x5d, 0x08, 0x1c, 0x80, 0x67, 0x00, 0xe4, 0x01, 0x85, 0x04, - 0x79, 0x8a, 0x3f, 0x00, 0x00, 0x00, 0xf4, 0x11, 0x85, 0x06, 0x39, 0x08, - 0x7d, 0x00, 0x00, 0x18, 0xb7, 0x10, 0x81, 0x03, 0x29, 0x12, 0xcb, 0x00, - 0x7e, 0x30, 0x28, 0x00, 0x85, 0x03, 0x29, 0x10, 0xbe, 0x81, 0xff, 0x27, - 0x0c, 0x10, 0x85, 0x03, 0x29, 0x32, 0xfa, 0xc1, 0xff, 0x27, 0x94, 0x11, - 0x85, 0x03, 0x28, 0x20, 0x6c, 0xe1, 0xff, 0x07, 0x0c, 0x01, 0x85, 0x01, - 0x28, 0x62, 0x5c, 0xe3, 0x8f, 0x03, 0x4e, 0x91, 0x80, 0x05, 0x39, 0x40, - 0xf4, 0xc2, 0xff, 0x00, 0x9f, 0x91, 0x84, 0x05, 0x31, 0xc6, 0xe8, 0x07, - 0x7f, 0x80, 0xcd, 0x00, 0xc4, 0x04, 0x31, 0x06, 0xc9, 0x0e, 0x00, 0xc0, - 0x48, 0x88, 0xe0, 0x04, 0x79, 0x04, 0xdb, 0x12, 0x00, 0x30, 0x0c, 0xc8, - 0xe4, 0x04, 0x6d, 0x06, 0xb6, 0x23, 0x00, 0x18, 0x1c, 0xc0, 0x84, 0x04, - 0x25, 0x0c, 0xff, 0xc2, 0x00, 0x4e, 0x06, 0xb0, 0x80, 0x04, 0x3f, 0x8a, - 0xb3, 0x83, 0xff, 0xc3, 0x03, 0x91, 0x84, 0x04, 0x2e, 0xd8, 0x0f, 0x3f, - 0x00, 0x00, 0x5f, 0x83, 0x84, 0x04, 0x2a, 0x70, 0xfd, 0x7f, 0x00, 0x00, - 0xc8, 0xc0, 0x84, 0x04, 0x4b, 0xe2, 0x2f, 0x01, 0x00, 0x08, 0x58, 0x60, - 0x80, 0x04, 0x5b, 0x82, 0xff, 0x01, 0x00, 0x08, 0xd0, 0xa0, 0x84, 0x04, - 0x72, 0x80, 0xe5, 0x00, 0x00, 0x08, 0xd2, 0x20, 0x44, 0x04, 0xca, 0x02, - 0xff, 0x00, 0x00, 0x08, 0xde, 0xa0, 0x44, 0x04, 0x82, 0x02, 0x6d, 0x00, - 0x00, 0x08, 0xf6, 0xb0, 0x40, 0x02, 0x82, 0x07, 0x3f, 0x00, 0x00, 0x08, - 0x44, 0x58, 0x44, 0x02, 0x93, 0x3f, 0x1f, 0x00, 0x00, 0x30, 0x88, 0x4f, - 0x44, 0x03, 0x83, 0x23, 0x3e, 0x00, 0x00, 0x00, 0x18, 0x60, 0xe0, 0x07, - 0xe3, 0x0f, 0xfe, 0x00, 0x00, 0x00, 0x70, 0x70, 0xe4, 0x07, 0xc7, 0x1b, - 0xfe, 0x01, 0x00, 0x00, 0xe0, 0x3c, 0xe4, 0x07, 0xc7, 0xe3, 0xfe, 0x1f, - 0x00, 0x00, 0xff, 0x1f, 0xfc, 0x07, 0xc7, 0x03, 0xf8, 0x33, 0x00, 0xc0, - 0xf0, 0x07, 0xff, 0x07, 0x87, 0x02, 0xfc, 0x43, 0x00, 0x60, 0xf0, 0xff, - 0xff, 0x07, 0x8f, 0x06, 0xbe, 0x87, 0x00, 0x30, 0xf8, 0xff, 0xff, 0x07, - 0x8f, 0x14, 0x9c, 0x8f, 0x00, 0x00, 0xfc, 0xff, 0xff, 0x07, 0x9f, 0x8d, - 0x8a, 0x0f, 0x00, 0x00, 0xfe, 0xff, 0xff, 0x07, 0xbf, 0x0b, 0x80, 0x1f, - 0x00, 0x00, 0xff, 0xff, 0xff, 0x07, 0x7f, 0x3a, 0x80, 0x3f, 0x00, 0x80, - 0xff, 0xff, 0xff, 0x07, 0xff, 0x20, 0xc0, 0x3f, 0x00, 0x80, 0xff, 0xff, - 0xff, 0x07, 0xff, 0x01, 0xe0, 0x7f, 0x00, 0xc0, 0xff, 0xff, 0xff, 0x07, - 0xff, 0x0f, 0xf8, 0xff, 0x40, 0xe0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, - 0xff, 0xff, 0x40, 0xf0, 0xff, 0xff, 0xff, 0x07, 0xff, 0xff, 0xff, 0xff, - 0x41, 0xf0, 0xff, 0xff, 0xff, 0x07}; diff --git a/nx-X11/include/bitmaps/xfd_icon b/nx-X11/include/bitmaps/xfd_icon deleted file mode 100644 index 383334cf9..000000000 --- a/nx-X11/include/bitmaps/xfd_icon +++ /dev/null @@ -1,27 +0,0 @@ -#define xfd_icon_width 48 -#define xfd_icon_height 48 -static char xfd_icon_bits[] = { - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x81, 0x40, 0x20, 0x10, 0x08, - 0x11, 0x9d, 0x5c, 0xa7, 0xd7, 0x0b, 0x29, 0xa5, 0x42, 0xa9, 0x50, 0x08, - 0x45, 0xa5, 0x42, 0xa9, 0x50, 0x08, 0x7d, 0x9d, 0x42, 0xa9, 0xd7, 0x09, - 0x45, 0xa5, 0x42, 0xa9, 0x50, 0x08, 0x45, 0xa5, 0x42, 0xa9, 0x50, 0x08, - 0x45, 0x9d, 0x5c, 0xa7, 0x57, 0x08, 0x01, 0x81, 0x40, 0x20, 0x10, 0x08, - 0xff, 0xff, 0xff, 0xff, 0xff, 0x0f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-X11/include/bitmaps/xlogo11 b/nx-X11/include/bitmaps/xlogo11 deleted file mode 100644 index 5efd2c20e..000000000 --- a/nx-X11/include/bitmaps/xlogo11 +++ /dev/null @@ -1,6 +0,0 @@ -#define xlogo11_width 11 -#define xlogo11_height 11 - -static char xlogo11_bits[] = { - 0x0f, 0x04, 0x0f, 0x02, 0x1e, 0x01, 0x3c, 0x01, 0xb8, 0x00, 0x58, 0x00, - 0xe8, 0x00, 0xe4, 0x01, 0xc4, 0x03, 0xc2, 0x03, 0x81, 0x07 }; diff --git a/nx-X11/include/bitmaps/xlogo16 b/nx-X11/include/bitmaps/xlogo16 deleted file mode 100644 index 5c2302734..000000000 --- a/nx-X11/include/bitmaps/xlogo16 +++ /dev/null @@ -1,6 +0,0 @@ -#define xlogo16_width 16 -#define xlogo16_height 16 -static unsigned char xlogo16_bits[] = { - 0x0f, 0x80, 0x1e, 0x80, 0x3c, 0x40, 0x78, 0x20, 0x78, 0x10, 0xf0, 0x08, - 0xe0, 0x09, 0xc0, 0x05, 0xc0, 0x02, 0x40, 0x07, 0x20, 0x0f, 0x20, 0x1e, - 0x10, 0x1e, 0x08, 0x3c, 0x04, 0x78, 0x02, 0xf0}; diff --git a/nx-X11/include/bitmaps/xlogo32 b/nx-X11/include/bitmaps/xlogo32 deleted file mode 100644 index 1ecb6acaa..000000000 --- a/nx-X11/include/bitmaps/xlogo32 +++ /dev/null @@ -1,14 +0,0 @@ -#define xlogo32_width 32 -#define xlogo32_height 32 -static char xlogo32_bits[] = { - 0xff, 0x00, 0x00, 0xc0, 0xfe, 0x01, 0x00, 0xc0, 0xfc, 0x03, 0x00, 0x60, - 0xf8, 0x07, 0x00, 0x30, 0xf8, 0x07, 0x00, 0x18, 0xf0, 0x0f, 0x00, 0x0c, - 0xe0, 0x1f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x06, 0xc0, 0x3f, 0x00, 0x03, - 0x80, 0x7f, 0x80, 0x01, 0x00, 0xff, 0xc0, 0x00, 0x00, 0xfe, 0x61, 0x00, - 0x00, 0xfe, 0x31, 0x00, 0x00, 0xfc, 0x33, 0x00, 0x00, 0xf8, 0x1b, 0x00, - 0x00, 0xf0, 0x0d, 0x00, 0x00, 0xf0, 0x0e, 0x00, 0x00, 0x60, 0x1f, 0x00, - 0x00, 0xb0, 0x3f, 0x00, 0x00, 0x98, 0x7f, 0x00, 0x00, 0x98, 0x7f, 0x00, - 0x00, 0x0c, 0xff, 0x00, 0x00, 0x06, 0xfe, 0x01, 0x00, 0x03, 0xfc, 0x03, - 0x80, 0x01, 0xfc, 0x03, 0xc0, 0x00, 0xf8, 0x07, 0xc0, 0x00, 0xf0, 0x0f, - 0x60, 0x00, 0xe0, 0x1f, 0x30, 0x00, 0xe0, 0x1f, 0x18, 0x00, 0xc0, 0x3f, - 0x0c, 0x00, 0x80, 0x7f, 0x06, 0x00, 0x00, 0xff}; diff --git a/nx-X11/include/bitmaps/xlogo64 b/nx-X11/include/bitmaps/xlogo64 deleted file mode 100644 index ad3b0dbbf..000000000 --- a/nx-X11/include/bitmaps/xlogo64 +++ /dev/null @@ -1,46 +0,0 @@ -#define xlogo64_width 64 -#define xlogo64_height 64 -static unsigned char xlogo64_bits[] = { - 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xfe, 0xff, 0x01, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x7c, - 0xf8, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x3e, 0xf8, 0xff, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x1f, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0x00, 0x80, 0x0f, - 0xe0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x80, 0x0f, 0xc0, 0xff, 0x3f, 0x00, - 0x00, 0x00, 0xc0, 0x07, 0xc0, 0xff, 0x3f, 0x00, 0x00, 0x00, 0xe0, 0x03, - 0x80, 0xff, 0x7f, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xff, 0xff, 0x00, - 0x00, 0x00, 0xf8, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0xf8, 0x00, - 0x00, 0xfe, 0xff, 0x01, 0x00, 0x00, 0x7c, 0x00, 0x00, 0xfc, 0xff, 0x03, - 0x00, 0x00, 0x3e, 0x00, 0x00, 0xf8, 0xff, 0x07, 0x00, 0x00, 0x1f, 0x00, - 0x00, 0xf0, 0xff, 0x0f, 0x00, 0x80, 0x0f, 0x00, 0x00, 0xf0, 0xff, 0x0f, - 0x00, 0xc0, 0x07, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0x00, 0xc0, 0x07, 0x00, - 0x00, 0xc0, 0xff, 0x3f, 0x00, 0xe0, 0x03, 0x00, 0x00, 0x80, 0xff, 0x7f, - 0x00, 0xf0, 0x01, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0xf8, 0x00, 0x00, - 0x00, 0x00, 0xff, 0xff, 0x00, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xff, - 0x01, 0x7c, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, 0x3e, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0xff, 0x03, 0x1f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xff, - 0x87, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xff, 0xcf, 0x07, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0xff, 0xcf, 0x07, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, - 0xe7, 0x03, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xf3, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xff, 0xf9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, - 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7e, 0xfe, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3e, - 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, 0xff, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x80, 0xcf, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, - 0xff, 0x0f, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xe7, 0xff, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0xc3, 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1, - 0xff, 0x3f, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x80, 0xff, 0x7f, 0x00, 0x00, - 0x00, 0x00, 0x7c, 0x00, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x00, - 0xfe, 0xff, 0x01, 0x00, 0x00, 0x00, 0x3e, 0x00, 0xfe, 0xff, 0x01, 0x00, - 0x00, 0x00, 0x1f, 0x00, 0xfc, 0xff, 0x03, 0x00, 0x00, 0x80, 0x0f, 0x00, - 0xf8, 0xff, 0x07, 0x00, 0x00, 0xc0, 0x07, 0x00, 0xf0, 0xff, 0x0f, 0x00, - 0x00, 0xe0, 0x03, 0x00, 0xf0, 0xff, 0x0f, 0x00, 0x00, 0xe0, 0x03, 0x00, - 0xe0, 0xff, 0x1f, 0x00, 0x00, 0xf0, 0x01, 0x00, 0xc0, 0xff, 0x3f, 0x00, - 0x00, 0xf8, 0x00, 0x00, 0x80, 0xff, 0x7f, 0x00, 0x00, 0x7c, 0x00, 0x00, - 0x80, 0xff, 0x7f, 0x00, 0x00, 0x3e, 0x00, 0x00, 0x00, 0xff, 0xff, 0x00, - 0x00, 0x3e, 0x00, 0x00, 0x00, 0xfe, 0xff, 0x01, 0x00, 0x1f, 0x00, 0x00, - 0x00, 0xfc, 0xff, 0x03, 0x80, 0x0f, 0x00, 0x00, 0x00, 0xfc, 0xff, 0x03, - 0xc0, 0x07, 0x00, 0x00, 0x00, 0xf8, 0xff, 0x07, 0xe0, 0x03, 0x00, 0x00, - 0x00, 0xf0, 0xff, 0x0f, 0xe0, 0x03, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, - 0xf0, 0x01, 0x00, 0x00, 0x00, 0xe0, 0xff, 0x1f, 0xf8, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xff, 0x3f, 0x7c, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x7f, - 0x3e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff}; diff --git a/nx-X11/include/bitmaps/xsnow b/nx-X11/include/bitmaps/xsnow deleted file mode 100644 index 2c1bd8b65..000000000 --- a/nx-X11/include/bitmaps/xsnow +++ /dev/null @@ -1,1112 +0,0 @@ -#define xsnow_width 300 -#define xsnow_height 350 -static char xsnow_bits[] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x40, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, - 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x70, 0x01, 0x68, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x99, 0x39, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9e, 0x1f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x98, - 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x09, 0x33, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0x0f, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0xdf, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x80, 0x0f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xfe, 0x03, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x47, 0x00, - 0x00, 0x90, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0xce, - 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x6c, 0x0f, 0xef, 0x13, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x6a, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf0, 0xcf, 0x07, 0x7c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x26, 0x00, 0x00, 0x30, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0xf7, 0x03, 0x1e, 0xfe, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x70, 0x0e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xfc, 0x07, 0x7e, 0x5b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x60, 0x30, 0xf0, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x07, 0xef, 0x11, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x71, - 0xf0, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xfe, - 0x87, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0x77, 0xf0, 0x77, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0x07, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xb0, 0x33, 0xf0, 0x71, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xff, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0xf0, 0xe1, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0xe0, 0xe1, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x0c, 0x19, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x30, 0xe0, 0x81, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x9c, 0x11, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7e, 0x30, - 0xe0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, - 0x17, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xff, 0x19, 0xe0, 0x03, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x99, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x1f, 0xe0, 0xe3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x01, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xf0, 0x7b, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xfc, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x01, 0x68, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, - 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0xff, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x60, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x03, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0xdf, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x33, 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, - 0x00, 0xf6, 0xff, 0x03, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x6e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x30, 0x00, 0xfe, 0xff, 0x03, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x39, 0x66, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0x00, 0x1e, 0xce, 0x03, 0x78, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x33, 0x66, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x1f, 0x80, 0x07, 0x7c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3f, - 0xce, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x90, 0xc3, 0x1f, 0x80, 0x1f, - 0x7e, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x1c, 0xef, 0x0f, - 0x80, 0xbf, 0xff, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf1, 0x1e, - 0xfc, 0x07, 0x80, 0xff, 0x8f, 0x7b, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x02, 0x00, 0x00, 0x00, 0x40, - 0xdb, 0x0f, 0xf8, 0x03, 0x00, 0xf7, 0x07, 0xff, 0x16, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xb8, 0x0f, 0x03, 0x00, 0x00, - 0x00, 0xe0, 0x8d, 0x07, 0xfe, 0x01, 0x00, 0xfc, 0x03, 0x8e, 0x3d, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x3d, 0xdc, 0x23, - 0x00, 0x00, 0x00, 0x60, 0xef, 0x03, 0x7f, 0x07, 0x00, 0xfe, 0x80, 0xcf, - 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3e, 0x1f, - 0xfc, 0xbd, 0x00, 0x00, 0x00, 0x00, 0xf9, 0x8e, 0x7f, 0x0f, 0x00, 0xff, - 0xc1, 0xfb, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, - 0x1d, 0x0f, 0x58, 0xdc, 0x03, 0x00, 0x00, 0x00, 0x30, 0xfc, 0xef, 0x0f, - 0x80, 0xbf, 0xc3, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0xde, 0x1f, 0x7c, 0xbe, 0x01, 0x00, 0x00, 0x00, 0x10, 0xf0, - 0xc3, 0x0f, 0xc0, 0x1f, 0x46, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe2, 0x1d, 0xde, 0x27, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf0, 0x01, 0x0f, 0xc0, 0x07, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x78, 0x0e, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0x00, 0x9e, 0xc3, 0x03, 0x38, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x02, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0xfe, 0xdf, 0x03, 0x60, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10, 0x00, 0xfe, 0x7f, 0x03, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, - 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x39, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xff, 0xff, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x62, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0xff, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3b, 0x6a, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x3f, 0xf0, 0x7f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x7e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7c, 0x1e, 0xe0, 0xff, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, - 0xf2, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1f, 0x1e, 0xe0, 0xfe, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x02, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x1e, - 0x60, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x03, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x1c, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x38, 0x1c, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0xc0, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x38, 0x3c, 0x70, 0xc0, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3c, 0x70, 0x62, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x3f, 0x70, 0x6f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x39, - 0x70, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7e, 0x20, 0x30, 0xf0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x02, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x33, 0x00, 0x00, 0xf0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x36, 0x00, 0x00, 0x10, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x76, 0x00, 0x00, 0x50, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0f, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0x00, 0x00, 0xf0, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0b, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x67, 0x00, - 0x00, 0x90, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0xcf, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x07, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfc, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x07, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd6, 0xdc, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46, 0xd8, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x00, 0x00, 0x0e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, 0x1f, 0x08, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x70, 0x3e, 0x0c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe4, 0x7b, 0x78, - 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7d, - 0x3e, 0xf8, 0xd3, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x33, 0x1a, 0xf0, 0xb0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xad, 0x3f, 0xf0, 0xf9, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc4, 0x3b, 0x78, 0x9f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xf0, 0x39, 0x0c, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xf0, 0x1f, - 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf8, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x73, 0xe8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x66, 0x88, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0xac, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0xfc, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xcf, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0f, 0x40, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, - 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, 0x00, - 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x02, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x02, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x60, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3d, 0xe0, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x31, 0xe0, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x13, 0xc0, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x1f, 0xc0, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe8, 0xcf, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0xc1, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x07, 0x00, 0x86, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xb6, 0x07, 0x00, 0xec, 0x13, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xe7, 0x03, 0x00, - 0xf8, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xf3, - 0x00, 0x00, 0x3c, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xd0, 0xfe, 0x01, 0x00, 0x7e, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x40, 0xbc, 0x03, 0x00, 0xef, 0x11, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x87, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x80, 0x01, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xd8, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x00, 0x00, 0xe0, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, - 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0x40, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 0x11, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1b, 0x40, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x1f, 0x00, 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3b, 0x60, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x1a, 0x00, 0x00, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x3f, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x08, 0x00, 0x00, 0x4c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, 0x20, 0x1e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, - 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0b, 0x00, 0x00, 0xcc, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x08, - 0x04, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, - 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x03, 0x00, 0x1e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x0c, 0x9c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfe, 0x0d, 0xfc, 0x1d, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x60, 0x1e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe6, 0x0c, 0x7c, 0x1c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xe0, 0x0f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x0c, 0x3c, 0x1c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x35, 0xe0, - 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x06, 0x38, 0x1c, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x11, 0xc0, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x06, - 0x38, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x17, 0xc0, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x1f, 0x06, 0x78, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x7f, 0x06, 0x78, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0xff, 0x07, 0x78, 0x7c, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0xdf, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0x7c, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0xc5, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0xff, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0xff, - 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0c, 0xc0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xff, 0x7b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x04, 0x0c, 0x00, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0xc0, 0xfd, 0x7f, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x87, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0xc0, 0xff, 0xff, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbc, 0x07, 0x00, 0xee, 0x11, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xc0, 0x87, 0xf9, 0x00, 0x0f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf6, 0x03, 0x00, - 0xfc, 0x5b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe0, 0x07, 0xf0, 0x80, - 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x78, 0xe3, - 0x01, 0x00, 0x78, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x04, 0xf4, 0xf0, 0x07, - 0xf0, 0xc3, 0x0f, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xd8, 0xfb, 0x00, 0x00, 0x3e, 0xdf, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc7, - 0xfb, 0x03, 0xf0, 0xf7, 0x3f, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x40, 0xbe, 0x03, 0x00, 0xef, 0x13, 0x00, 0x00, 0x00, 0x40, - 0xbc, 0x87, 0xff, 0x00, 0xf0, 0xff, 0x73, 0x8f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x07, 0x00, 0x87, 0x01, 0x00, 0x00, - 0x00, 0xd0, 0xf6, 0x03, 0xff, 0x00, 0xc0, 0xff, 0xe0, 0xdf, 0x02, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x04, 0x00, 0x01, 0x01, - 0x00, 0x00, 0x00, 0xf8, 0xe3, 0x81, 0x3f, 0x00, 0x00, 0x7f, 0xc0, 0x33, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x80, - 0x01, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xfb, 0xc0, 0xef, 0x00, 0xc0, 0x3f, - 0xf0, 0xf9, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x1c, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x40, 0xbe, 0xf3, 0xff, 0x03, - 0xe0, 0x3f, 0x78, 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xff, - 0xfb, 0x03, 0xf0, 0x77, 0x38, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x98, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x04, 0xfc, 0xf0, 0x03, 0xf8, 0xc3, 0x08, 0x08, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xe0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0xf8, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x7c, 0xe0, 0x03, 0xf8, 0x80, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x05, 0xe0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0xc0, 0x67, 0xf8, 0x00, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x67, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0xc0, - 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0xc0, 0xff, 0xff, 0x00, - 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x19, 0x40, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0xc0, 0xff, - 0x6f, 0x00, 0x08, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x6b, 0x6e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x3b, 0x60, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xf7, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x23, 0x6c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x3f, 0xe0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xe0, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0xcc, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x80, 0x33, 0x60, 0x0e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf8, 0x3f, 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x1e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, 0x0f, 0xfc, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, - 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x9f, 0x07, 0xf8, 0x7f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x04, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x02, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x87, 0x07, - 0x98, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0x38, 0x1f, 0x06, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x00, 0x00, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x81, 0x07, 0x18, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf2, 0x3d, 0xbc, 0x47, 0x00, - 0x00, 0x00, 0x00, 0x40, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x02, 0x07, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x3e, 0x1f, 0xfc, - 0x69, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x06, 0x07, 0x18, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, - 0x0d, 0x78, 0xd8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x0f, 0x0c, 0x18, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0xd6, 0x1f, 0xf8, 0xfc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0e, 0x0f, 0xcc, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xe2, 0x1d, 0xbc, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xce, 0x0f, - 0xec, 0x1b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x60, 0xf8, 0x1c, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x0e, 0x8c, 0x3f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xf8, 0x0f, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0x1f, 0x08, 0x04, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x60, 0x0e, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x7f, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x00, 0x00, 0x44, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x39, 0xf4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1c, 0x00, 0x00, 0x56, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x33, 0x44, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1e, 0x00, - 0x00, 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x77, 0x56, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 0x19, 0x00, 0x00, 0xe6, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7f, 0xfe, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x01, 0x00, 0x00, 0xa0, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x67, 0xe6, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0xe0, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x07, 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x07, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x00, 0x80, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x01, 0x80, 0x01, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xf0, 0x01, 0x80, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x01, 0x80, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x00, 0x00, 0x0f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x09, - 0x98, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x0e, 0x78, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x08, 0x38, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x09, 0x30, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x0f, 0xf0, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xf8, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, - 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xf6, 0x73, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x42, 0x70, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x60, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x02, 0x02, 0x40, 0x40, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x84, 0x03, - 0x80, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, - 0xdb, 0x03, 0x00, 0xfb, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x0f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xfe, 0xf3, 0x01, 0x00, 0xbc, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xfe, 0x79, 0x00, 0x00, 0x8f, 0x7f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x23, 0x00, 0x00, - 0x00, 0x30, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x68, 0xff, 0x00, 0x80, 0xdf, 0x16, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, - 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, 0xde, 0x01, 0xc0, 0x7b, - 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x35, 0x00, 0x00, 0x00, 0x70, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x86, 0x03, - 0xc0, 0x61, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x13, 0x00, 0x00, 0x00, 0x60, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x02, 0x02, 0x40, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x1f, 0x00, 0x00, 0x00, 0x60, 0x0e, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x10, 0x00, 0x20, 0xf0, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x06, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x18, 0x00, - 0xe0, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8e, 0x67, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0x1b, 0x00, 0xe0, 0x6f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xee, 0x7f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xd8, 0x19, 0x00, 0xe0, 0x63, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, - 0xfe, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x18, 0x00, 0xe0, 0xe1, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x0f, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x00, 0xc0, 0xe1, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x60, 0x0e, 0xd0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x08, 0x00, 0xc0, 0x81, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0c, 0x10, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x08, 0x00, - 0xc0, 0x03, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0e, 0x58, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, - 0x0c, 0x00, 0xc0, 0xc3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0xf8, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xfe, 0x0f, 0x00, 0xc0, 0xf3, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x09, - 0x88, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf8, 0x1f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xe0, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, 0xf8, 0x1f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0x01, 0x80, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xfe, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xff, 0x87, - 0xcf, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x0c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf3, 0xff, 0xc3, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc3, 0xcf, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x01, 0x03, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, 0x80, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0x00, - 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x01, 0x00, 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x00, 0x80, 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x06, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0xf0, 0x00, 0x00, 0x00, 0x3c, - 0x80, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0f, 0xf8, 0x00, 0x00, - 0x00, 0x78, 0xc0, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x80, 0x1e, 0xfe, - 0x00, 0x00, 0x00, 0xe0, 0xe1, 0x07, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe1, - 0x78, 0x7f, 0x00, 0x00, 0x00, 0xc0, 0xfb, 0x1f, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x88, 0xf7, 0xf0, 0x1f, 0x00, 0x00, 0x00, 0x80, 0xff, 0xb9, 0x47, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xda, 0x7e, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x7e, 0xf0, - 0x6f, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x7f, 0x3c, 0xf0, 0x07, 0x00, 0x00, 0x00, 0x80, - 0x3f, 0xe0, 0xb9, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x7b, 0x1f, 0xf8, 0x01, 0x00, 0x00, - 0x00, 0xc0, 0x1f, 0xf8, 0x7c, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc8, 0x77, 0xfe, 0x03, - 0x00, 0x00, 0x00, 0xe0, 0x1f, 0xbc, 0x4f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xe1, - 0x7f, 0x07, 0x00, 0x00, 0x00, 0xf8, 0x7b, 0x1c, 0x06, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x80, 0x1f, 0x0e, 0x00, 0x00, 0x00, 0xfc, 0xe1, 0x04, 0x04, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x0f, 0x38, 0x00, 0x00, 0x00, 0x7c, 0xc0, 0x01, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x70, 0x00, 0x00, 0x00, 0x3c, - 0x80, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x01, 0xe0, 0x00, 0x00, - 0x00, 0x1c, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x80, - 0x00, 0x00, 0x00, 0x04, 0x00, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x80, 0x03, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, 0x00, 0x06, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x60, 0x00, 0x00, 0x00, 0x00, 0x02, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x07, 0x00, - 0x00, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x0f, 0x80, 0x03, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x03, 0x00, 0x00, 0xc0, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x0f, 0xec, 0x0f, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, - 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0f, 0xff, 0x3f, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x23, - 0x00, 0x00, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcf, 0xc7, 0xff, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x3f, 0x00, 0x00, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0xff, 0x01, 0xff, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x35, 0x00, 0x00, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x7f, 0x00, - 0xf8, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x11, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf8, - 0x1f, 0x00, 0xe0, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x17, 0x00, 0x00, 0x98, 0x03, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3e, 0x0f, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3f, 0x10, 0x08, - 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x0f, 0x0f, 0x00, 0xc0, 0xfc, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0x18, 0x38, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x0f, 0x00, 0x60, 0xf0, 0x03, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xfc, 0x1b, 0xf8, 0x3b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0e, 0x00, 0x60, 0xc0, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xcc, 0x19, 0xf8, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x0e, 0x00, - 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x18, 0x78, 0x38, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, - 0x1e, 0x00, 0x60, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x0c, 0x70, 0x38, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x18, 0x1e, 0x00, 0x60, 0x66, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x0c, 0x70, - 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x98, 0x1f, 0x00, 0x70, 0x7f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, - 0x0c, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1c, 0x00, 0x70, 0xfc, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0xff, 0x0c, 0xf0, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x10, 0x00, 0x30, 0xf0, - 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xff, 0x0f, 0xf0, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x19, 0x00, 0x00, - 0x00, 0xe0, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0xf8, 0x3e, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1b, - 0x00, 0x00, 0x00, 0x20, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0x7f, 0xfe, 0x07, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x3b, 0x00, 0x00, 0x00, 0xb0, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0xff, 0xff, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x80, 0x3f, 0x00, 0x00, 0x00, 0xf0, 0x07, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xff, 0xf7, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xc0, 0x33, 0x00, 0x00, 0x00, 0x30, 0x0f, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x08, 0x80, 0xfb, 0xff, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x18, 0x80, 0xff, 0xff, 0x01, 0x18, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x03, 0x00, 0x00, - 0x00, 0x00, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0x0f, 0xf3, 0x01, 0x1e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc0, 0x0f, 0xe0, 0x01, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0xe8, 0xe1, 0x0f, 0xe0, - 0x87, 0x1f, 0x10, 0x00, 0x00, 0x00, 0x00, 0x20, 0x00, 0x20, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x8e, 0xf7, - 0x07, 0xe0, 0xef, 0x7f, 0x18, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x78, - 0x0f, 0xff, 0x01, 0xe0, 0xff, 0xe7, 0x1e, 0x01, 0x00, 0x00, 0x00, 0xf0, - 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xa0, 0xed, 0x07, 0xfe, 0x01, 0x80, 0xff, 0xc1, 0xbf, 0x05, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf0, 0xc7, 0x03, 0x7f, 0x00, 0x00, 0xfe, 0x80, 0x67, 0x0e, - 0x00, 0x00, 0x00, 0xe0, 0x06, 0x39, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xb0, 0xf7, 0x81, 0xdf, 0x01, 0x80, 0x7f, 0xe0, - 0xf3, 0x0d, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x1f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x7c, 0xe7, 0xff, 0x07, 0xc0, - 0x7f, 0xf0, 0x3e, 0x01, 0x00, 0x00, 0x00, 0xc0, 0x06, 0x1b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0xfe, 0xf7, - 0x07, 0xe0, 0xef, 0x70, 0x18, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x3f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, - 0xf8, 0xe1, 0x07, 0xf0, 0x87, 0x11, 0x10, 0x00, 0x00, 0x00, 0x00, 0x80, - 0x8f, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf8, 0xc0, 0x07, 0xf0, 0x01, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xff, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x78, 0x80, 0xcf, 0xf0, 0x01, 0x0e, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x19, 0x06, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x18, 0x80, 0xff, 0xff, 0x01, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x06, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x08, 0x80, 0xff, 0xdf, - 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, - 0xef, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdc, 0x01, 0xdc, - 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xff, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0xff, - 0x01, 0xf8, 0x2b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0x7f, 0xfe, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xf0, 0x73, 0x00, 0x60, 0x7e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xfc, 0x1f, 0xf8, 0x3f, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xa0, 0x7f, 0x00, 0x78, 0x2f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x3f, 0x0f, 0xf0, 0xff, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0xde, 0x00, 0xdc, 0x0b, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x0f, 0x0f, 0x30, - 0xff, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x04, 0x01, 0x04, 0x01, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, - 0x0f, 0x30, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x04, 0x0e, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x43, 0x04, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x0c, 0x0e, 0x30, 0x30, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xf3, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x1e, 0x18, 0x30, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x80, 0xdf, 0x0f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0c, 0x00, 0x18, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x1e, 0x98, 0x31, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x3f, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, - 0x00, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9c, 0x1f, 0xd8, - 0x37, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x07, 0x1b, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfe, - 0x1c, 0x18, 0x7f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, 0x07, 0x1f, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x41, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x80, 0x3f, 0x10, 0x08, 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x07, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xc1, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x1c, 0x00, 0x00, 0xf8, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xe0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xc1, 0x06, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x80, 0x19, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xf0, 0x00, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb8, 0xc1, 0x0d, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x39, 0x00, 0x00, 0xac, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x70, 0x00, 0x70, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 0xc1, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x80, 0x3d, 0x00, 0x00, - 0xfc, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x30, 0x00, 0x60, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xf7, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x33, - 0x00, 0x00, 0xcc, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0x9e, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xc0, 0x03, 0x00, 0x00, 0x40, 0x03, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0xc0, 0x03, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x40, 0x80, 0x01, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x41, 0x00, 0x41, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xe0, 0x00, 0x00, 0x00, 0x00, 0x07, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa0, 0x77, - 0x00, 0xf6, 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0xfc, 0x3d, 0x00, 0xbc, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0xfc, 0x1e, 0x00, 0xde, 0x1f, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0xa0, 0x37, 0x00, 0xf7, 0x03, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x63, 0x00, 0x63, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc1, 0x00, 0x41, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc0, - 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0xc0, 0xb4, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0xc0, 0xff, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, 0xe3, 0x07, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, 0xc1, 0x0f, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xc1, 0x04, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xf0, - 0xc1, 0x07, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x38, 0xc1, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x38, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x3c, 0x00, 0x0e, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x1c, 0x00, 0x1c, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x00, 0x00, 0x00}; diff --git a/nx-libs.spec b/nx-libs.spec index 6774a7ed6..a56a15559 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -638,7 +638,6 @@ chmod 755 %{buildroot}%{_libdir}/lib*.so* #Remove extras, GL, and other unneeded headers rm -r %{buildroot}%{_includedir}/nx/GL -rm -r %{buildroot}%{_includedir}/nx/X11/bitmaps rm -r %{buildroot}%{_includedir}/nx/X11/extensions/XInput.h rm -r %{buildroot}%{_includedir}/nx/X11/extensions/XK*.h rm -r %{buildroot}%{_includedir}/nx/X11/extensions/*Xv*.h -- cgit v1.2.3 From 83983e944e5076ad2d8beb6dd9190559fb6c5937 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Tue, 28 Apr 2015 23:00:43 +0200 Subject: libnx-xinerama1: also create libXinerama symlink in postinst (and remove in prerm.) Due to the nx-x11-common package being a noarch/allarch package, creating the symlink in nx-libs' Makefile will lead to the symlink referencing the "default" architecture dpkg uses for building noarch/allarch packages. Incidentally, this worked fine for Debian, as amd64 seems to be the default architecture. On Ubuntu, however, the default architecture up to Vivid (15.04) was i386. For those builds, the symlink pointed to the 32 bit library of libNX_Xinerama.so.1 -- essentially breaking this feature. Move the symlink creation to the arch-sensitive libnx-xinerama1 package. The postinst and prerm scriptlets will work fine, unless someone installs the i386 package version *after* the amd64 version. Given that we already create symlinks to libNX_X11 and friends using that method, no new regression is introduced. Strictly speaking that's a bug, but we'll hopefully clean that up later... --- Makefile | 11 +++++----- debian/libnx-xinerama1.postinst.in | 12 +++++++++-- debian/libnx-xinerama1.prerm | 42 ++++++++++++++++++-------------------- 3 files changed, 36 insertions(+), 29 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9f6442181..47efbde52 100644 --- a/Makefile +++ b/Makefile @@ -155,11 +155,12 @@ install-full: done; \ # Provide means for Xinerama support in NX/X2Go sessions. This - # This also requires two post-install symlinks: - # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_X11.so.6 -> /usr//libX11.so.6 - # (DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama - $(INSTALL_SYMLINK) $(USRLIBDIR)/libNX_Xinerama.so.1 $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 + # This also requires three post-install symlinks created by libnx-xinerama1: + # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_X11.so.6 -> /usr//libX11.so.6 + # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 + # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 -> /usr//libNX_Xinerama.so.1 + # Only create the owned directory here for nx-x11-common. + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11 $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) diff --git a/debian/libnx-xinerama1.postinst.in b/debian/libnx-xinerama1.postinst.in index c690be387..9b88c4b6f 100755 --- a/debian/libnx-xinerama1.postinst.in +++ b/debian/libnx-xinerama1.postinst.in @@ -26,14 +26,22 @@ case "$1" in libdir=/usr/lib/#DEB_BUILD_MULTIARCH# - rm -f /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 - rm -f /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6 + # Already existent files and directories are not removed. + # Users will need to explicitly remove them and (re-) configure this package. + + if test ! -e /usr/lib/nx/X11/Xinerama; then + install -d -m 755 /usr/lib/nx/X11/Xinerama + fi + if test -e $libdir/libX11.so.6; then ln -s $libdir/libX11.so.6 /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 fi if test -e $libdir/libXext.so.6; then ln -s $libdir/libXext.so.6 /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6 fi + if test -e $libdir/libNX_Xinerama.so.1; then + ln -s $libdir/libNX_Xinerama.so.1 /usr/lib/nx/X11/Xinerama/libXinerama.so.1 + fi ;; abort-upgrade|abort-remove|abort-deconfigure) diff --git a/debian/libnx-xinerama1.prerm b/debian/libnx-xinerama1.prerm index 3fcd330e6..91105d0f8 100755 --- a/debian/libnx-xinerama1.prerm +++ b/debian/libnx-xinerama1.prerm @@ -1,37 +1,35 @@ #!/bin/sh -# postrm script for x2goserver-fmbindings +# prerm script for libnx-xinerama1 # # see: dh_installdeb(1) - -set -e - # summary of how this script can be called: -# * `remove' -# * `purge' -# * `upgrade' -# * `failed-upgrade' -# * `abort-install' -# * `abort-install' -# * `abort-upgrade' -# * `disappear' -# +# * `remove' +# * `upgrade' +# * `failed-upgrade' +# * `remove' `in-favour' +# * `deconfigure' `in-favour' +# `removing' +# # for details, see http://www.debian.org/doc/debian-policy/ or # the debian-policy package +set -e + + case "$1" in - purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - if test -e /usr/lib/nx/X11/Xinerama/libNX_X11.so.6; then - rm -f /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 - fi - if test -e /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6; then - rm -f /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6 + remove) + if test -d /usr/lib/nx/X11/Xinerama; then + rm -rf /usr/lib/nx/X11/Xinerama fi - ;; + ;; + deconfigure|upgrade|failed-upgrade) + : + ;; *) - echo "postrm called with unknown argument \`$1'" >&2 + echo "prerm called with unknown argument \`$1'" >&2 exit 1 - ;; + ;; esac # dh_installdeb will replace this with shell code automatically -- cgit v1.2.3 From a9bc7bdb6bc8c51f3ed8f35e80c4c0291f3d7ac2 Mon Sep 17 00:00:00 2001 From: Mihai Moldovan Date: Thu, 30 Apr 2015 14:25:25 +0200 Subject: debian/libnx-xinerama1.*: move Xinerama dir back to nx-x11-common. Only delete known files. Fixes RPM build failures. --- Makefile | 2 +- debian/libnx-xinerama1.postinst.in | 7 +------ debian/libnx-xinerama1.prerm | 13 ++++++++++++- 3 files changed, 14 insertions(+), 8 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 47efbde52..c218d8604 100644 --- a/Makefile +++ b/Makefile @@ -160,7 +160,7 @@ install-full: # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 -> /usr//libNX_Xinerama.so.1 # Only create the owned directory here for nx-x11-common. - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11 + $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) diff --git a/debian/libnx-xinerama1.postinst.in b/debian/libnx-xinerama1.postinst.in index 9b88c4b6f..c3706038c 100755 --- a/debian/libnx-xinerama1.postinst.in +++ b/debian/libnx-xinerama1.postinst.in @@ -26,13 +26,8 @@ case "$1" in libdir=/usr/lib/#DEB_BUILD_MULTIARCH# - # Already existent files and directories are not removed. + # Already existent files are not removed. # Users will need to explicitly remove them and (re-) configure this package. - - if test ! -e /usr/lib/nx/X11/Xinerama; then - install -d -m 755 /usr/lib/nx/X11/Xinerama - fi - if test -e $libdir/libX11.so.6; then ln -s $libdir/libX11.so.6 /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 fi diff --git a/debian/libnx-xinerama1.prerm b/debian/libnx-xinerama1.prerm index 91105d0f8..8cca06c85 100755 --- a/debian/libnx-xinerama1.prerm +++ b/debian/libnx-xinerama1.prerm @@ -20,7 +20,18 @@ set -e case "$1" in remove) if test -d /usr/lib/nx/X11/Xinerama; then - rm -rf /usr/lib/nx/X11/Xinerama + if test -e /usr/lib/nx/X11/Xinerama/libNX_X11.so.6; then + rm -f /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 + fi + + if test -e /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6; then + rm -f /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6 + fi + + + if test -e /usr/lib/nx/X11/Xinerama/libXinerama.so.1; then + rm -f /usr/lib/nx/X11/Xinerama/libXinerama.so.1 + fi fi ;; deconfigure|upgrade|failed-upgrade) -- cgit v1.2.3 From 5eecadb53b4bcea485f85b2d7f01e49f9873b875 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 14 Jul 2015 01:26:33 +0200 Subject: Makefile: Also remove nxversion.def on distclean. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index c218d8604..9b89669df 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ SHELL:=/bin/bash fi # clean auto-generated nxversion.def file \ - if [ "x$@" == "xclean" ]; then \ + if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \ rm -f nx-X11/config/cf/nxversion.def; \ fi -- cgit v1.2.3 From 433d8186588698ce6a435fbff5e9d40a37b78be9 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 8 Jul 2015 16:16:40 +0200 Subject: Clear header file namespace separation ( vs. ). In the process of building nxagent against more and more system-wide installed X.org libraries, we come to the limit of including structs from this (bundled nx-X11) and that (system-wide X.Org) library. This commit introduces a clear namespace separation of headers provided by nx-X11 and headers provided by X.Org. This approach is only temporary as we want to drop all nx-X11 bundled libraries from nx-libs. However, for a while we need to make this separation clear and also ship some reduced fake X.Org headers that avoid pulling in libX* and libNX_X* symbols at the same time. This patch has been tested on Debian jessie and unstable and requires no overall testing on various distros and distro versions, as we finally will drop all libNX_X* libraries and build against X.org's client libs. For now, this hack eases our development / cleanup process. --- Makefile | 4 +- debian/libnx-x11-dev.install.in | 28 +-- debian/libnx-xau-dev.install.in | 2 +- debian/libnx-xcomposite-dev.install.in | 2 +- debian/libnx-xext-dev.install.in | 66 +++--- debian/libnx-xfixes-dev.install.in | 2 +- debian/libnx-xinerama-dev.install.in | 4 +- debian/libnx-xrender-dev.install.in | 2 +- debian/libnx-xtst-dev.install.in | 2 +- debian/nx-x11proto-composite-dev.install.in | 4 +- debian/nx-x11proto-core-dev.install.in | 46 ++-- debian/nx-x11proto-render-dev.install.in | 4 +- debian/nx-x11proto-xext-dev.install.in | 8 +- debian/nx-x11proto-xfixes-dev.install.in | 4 +- debian/nx-x11proto-xinerama-dev.install.in | 2 +- debian/rules | 44 ++-- nx-X11/config/cf/X11.tmpl | 2 +- nx-X11/include/GL/glx.h | 4 +- nx-X11/include/GL/glxint.h | 4 +- nx-X11/include/Imakefile | 4 +- nx-X11/include/XWDFile.h | 2 +- nx-X11/include/Xdefs.h | 2 +- nx-X11/include/Xfuncs.h | 2 +- nx-X11/include/Xos.h | 6 +- nx-X11/include/Xos_r.h | 14 +- nx-X11/include/Xpoll.h.in | 6 +- nx-X11/include/Xproto.h | 4 +- nx-X11/include/Xprotostr.h | 2 +- nx-X11/include/Xthreads.h | 2 +- nx-X11/include/extensions/Imakefile | 4 +- nx-X11/include/extensions/MITMisc.h | 2 +- nx-X11/include/extensions/XEVI.h | 2 +- nx-X11/include/extensions/XEVIstr.h | 2 +- nx-X11/include/extensions/XInput.h | 4 +- nx-X11/include/extensions/XIproto.h | 4 +- nx-X11/include/extensions/XKBgeom.h | 2 +- nx-X11/include/extensions/XKBproto.h | 4 +- nx-X11/include/extensions/XKBsrv.h | 10 +- nx-X11/include/extensions/XKBstr.h | 2 +- nx-X11/include/extensions/XLbx.h | 6 +- nx-X11/include/extensions/XShm.h | 2 +- nx-X11/include/extensions/XTest.h | 4 +- nx-X11/include/extensions/Xag.h | 2 +- nx-X11/include/extensions/Xagsrv.h | 2 +- nx-X11/include/extensions/Xagstr.h | 2 +- nx-X11/include/extensions/Xcup.h | 2 +- nx-X11/include/extensions/Xcupstr.h | 2 +- nx-X11/include/extensions/Xdbe.h | 4 +- nx-X11/include/extensions/Xevie.h | 2 +- nx-X11/include/extensions/Xext.h | 2 +- nx-X11/include/extensions/Xinerama.h | 2 +- nx-X11/include/extensions/Xv.h | 2 +- nx-X11/include/extensions/XvMC.h | 4 +- nx-X11/include/extensions/XvMClib.h | 6 +- nx-X11/include/extensions/Xvlib.h | 4 +- nx-X11/include/extensions/Xvproto.h | 2 +- nx-X11/include/extensions/composite.h | 2 +- nx-X11/include/extensions/compositeproto.h | 4 +- nx-X11/include/extensions/dpms.h | 4 +- nx-X11/include/extensions/extutil.h | 2 +- nx-X11/include/extensions/fontcache.h | 2 +- nx-X11/include/extensions/fontcacheP.h | 2 +- nx-X11/include/extensions/fontcachstr.h | 2 +- nx-X11/include/extensions/lbxbuf.h | 2 +- nx-X11/include/extensions/lbxbufstr.h | 2 +- nx-X11/include/extensions/lbximage.h | 2 +- nx-X11/include/extensions/lbxstr.h | 2 +- nx-X11/include/extensions/multibuf.h | 2 +- nx-X11/include/extensions/recordstr.h | 2 +- nx-X11/include/extensions/renderproto.h | 4 +- nx-X11/include/extensions/saverproto.h | 2 +- nx-X11/include/extensions/scrnsaver.h | 6 +- nx-X11/include/extensions/security.h | 2 +- nx-X11/include/extensions/securstr.h | 2 +- nx-X11/include/extensions/shape.h | 4 +- nx-X11/include/extensions/sync.h | 2 +- nx-X11/include/extensions/vldXvMC.h | 6 +- nx-X11/include/extensions/xf86bigfont.h | 2 +- nx-X11/include/extensions/xf86bigfstr.h | 2 +- nx-X11/include/extensions/xf86dga.h | 4 +- nx-X11/include/extensions/xf86dga1.h | 2 +- nx-X11/include/extensions/xf86dgastr.h | 2 +- nx-X11/include/extensions/xf86misc.h | 2 +- nx-X11/include/extensions/xf86mscstr.h | 2 +- nx-X11/include/extensions/xf86vmode.h | 4 +- nx-X11/include/extensions/xf86vmstr.h | 2 +- nx-X11/include/extensions/xfixesproto.h | 6 +- nx-X11/include/extensions/xtrapddmi.h | 4 +- nx-X11/include/extensions/xtrapdi.h | 8 +- nx-X11/include/extensions/xtrapemacros.h | 2 +- nx-X11/include/extensions/xtraplib.h | 8 +- nx-X11/include/keysym.h | 2 +- nx-X11/lib/X11/ClDisplay.c | 2 +- nx-X11/lib/X11/ConnDis.c | 8 +- nx-X11/lib/X11/ErrDes.c | 2 +- nx-X11/lib/X11/FSWrap.c | 2 +- nx-X11/lib/X11/FetchName.c | 6 +- nx-X11/lib/X11/Font.c | 2 +- nx-X11/lib/X11/GetDflt.c | 8 +- nx-X11/lib/X11/GetHints.c | 8 +- nx-X11/lib/X11/GetImage.c | 2 +- nx-X11/lib/X11/GetNrmHint.c | 6 +- nx-X11/lib/X11/GetRGBCMap.c | 6 +- nx-X11/lib/X11/GetStCmap.c | 6 +- nx-X11/lib/X11/GetTxtProp.c | 8 +- nx-X11/lib/X11/GetWMCMapW.c | 2 +- nx-X11/lib/X11/GetWMProto.c | 2 +- nx-X11/lib/X11/HVC.c | 2 +- nx-X11/lib/X11/Iconify.c | 8 +- nx-X11/lib/X11/ImUtil.c | 4 +- nx-X11/lib/X11/Imakefile | 2 +- nx-X11/lib/X11/InitExt.c | 4 +- nx-X11/lib/X11/KeyBind.c | 6 +- nx-X11/lib/X11/KeysymStr.c | 4 +- nx-X11/lib/X11/LRGB.c | 4 +- nx-X11/lib/X11/Lab.c | 2 +- nx-X11/lib/X11/Luv.c | 2 +- nx-X11/lib/X11/OpenDis.c | 8 +- nx-X11/lib/X11/ParseCmd.c | 2 +- nx-X11/lib/X11/PolyReg.c | 2 +- nx-X11/lib/X11/Quarks.c | 2 +- nx-X11/lib/X11/RdBitF.c | 2 +- nx-X11/lib/X11/Region.c | 2 +- nx-X11/lib/X11/ScrResStr.c | 2 +- nx-X11/lib/X11/SetHints.c | 8 +- nx-X11/lib/X11/SetLocale.c | 4 +- nx-X11/lib/X11/SetNrmHint.c | 8 +- nx-X11/lib/X11/SetRGBCMap.c | 6 +- nx-X11/lib/X11/SetStCmap.c | 6 +- nx-X11/lib/X11/SetTxtProp.c | 8 +- nx-X11/lib/X11/SetWMCMapW.c | 2 +- nx-X11/lib/X11/SetWMProto.c | 2 +- nx-X11/lib/X11/StBytes.c | 4 +- nx-X11/lib/X11/StName.c | 4 +- nx-X11/lib/X11/StrKeysym.c | 4 +- nx-X11/lib/X11/StrToText.c | 6 +- nx-X11/lib/X11/TextToStr.c | 6 +- nx-X11/lib/X11/WMProps.c | 10 +- nx-X11/lib/X11/Withdraw.c | 8 +- nx-X11/lib/X11/WrBitF.c | 2 +- nx-X11/lib/X11/XDefaultOMIF.c | 4 +- nx-X11/lib/X11/XKB.c | 2 +- nx-X11/lib/X11/XKBAlloc.c | 12 +- nx-X11/lib/X11/XKBBell.c | 2 +- nx-X11/lib/X11/XKBBind.c | 8 +- nx-X11/lib/X11/XKBCompat.c | 2 +- nx-X11/lib/X11/XKBCtrls.c | 2 +- nx-X11/lib/X11/XKBCvt.c | 16 +- nx-X11/lib/X11/XKBExtDev.c | 4 +- nx-X11/lib/X11/XKBGAlloc.c | 12 +- nx-X11/lib/X11/XKBGeom.c | 4 +- nx-X11/lib/X11/XKBGetByName.c | 2 +- nx-X11/lib/X11/XKBGetMap.c | 2 +- nx-X11/lib/X11/XKBList.c | 2 +- nx-X11/lib/X11/XKBMAlloc.c | 12 +- nx-X11/lib/X11/XKBMisc.c | 12 +- nx-X11/lib/X11/XKBNames.c | 2 +- nx-X11/lib/X11/XKBRdBuf.c | 2 +- nx-X11/lib/X11/XKBSetGeom.c | 4 +- nx-X11/lib/X11/XKBSetMap.c | 2 +- nx-X11/lib/X11/XKBUse.c | 2 +- nx-X11/lib/X11/XKBleds.c | 2 +- nx-X11/lib/X11/XKBlib.h | 4 +- nx-X11/lib/X11/XKBlibint.h | 4 +- nx-X11/lib/X11/XYZ.c | 2 +- nx-X11/lib/X11/Xcms.h | 2 +- nx-X11/lib/X11/Xcmsint.h | 2 +- nx-X11/lib/X11/XimThai.h | 2 +- nx-X11/lib/X11/Ximint.h | 2 +- nx-X11/lib/X11/Xintatom.h | 2 +- nx-X11/lib/X11/Xintconn.h | 2 +- nx-X11/lib/X11/Xlcint.h | 4 +- nx-X11/lib/X11/Xlib.h | 6 +- nx-X11/lib/X11/XlibAsync.c | 4 +- nx-X11/lib/X11/XlibInt.c | 6 +- nx-X11/lib/X11/Xlibint.h | 14 +- nx-X11/lib/X11/Xlocale.h | 4 +- nx-X11/lib/X11/Xresource.h | 2 +- nx-X11/lib/X11/Xrm.c | 4 +- nx-X11/lib/X11/Xutil.h | 2 +- nx-X11/lib/X11/cmsColNm.c | 4 +- nx-X11/lib/X11/cmsProp.c | 2 +- nx-X11/lib/X11/evtomask.c | 2 +- nx-X11/lib/X11/globals.c | 2 +- nx-X11/lib/X11/imDefFlt.c | 2 +- nx-X11/lib/X11/imDefIm.c | 2 +- nx-X11/lib/X11/imDefLkup.c | 2 +- nx-X11/lib/X11/imDispch.c | 2 +- nx-X11/lib/X11/imEvToWire.c | 4 +- nx-X11/lib/X11/imExten.c | 2 +- nx-X11/lib/X11/imInt.c | 6 +- nx-X11/lib/X11/imLcFlt.c | 2 +- nx-X11/lib/X11/imLcIc.c | 4 +- nx-X11/lib/X11/imLcIm.c | 8 +- nx-X11/lib/X11/imLcLkup.c | 10 +- nx-X11/lib/X11/imLcPrs.c | 6 +- nx-X11/lib/X11/imLcSIc.c | 6 +- nx-X11/lib/X11/imRm.c | 2 +- nx-X11/lib/X11/imThaiFlt.c | 8 +- nx-X11/lib/X11/imThaiIc.c | 4 +- nx-X11/lib/X11/imThaiIm.c | 8 +- nx-X11/lib/X11/imTrX.c | 2 +- nx-X11/lib/X11/imTrans.c | 8 +- nx-X11/lib/X11/lcCT.c | 2 +- nx-X11/lib/X11/lcDB.c | 4 +- nx-X11/lib/X11/lcFile.c | 2 +- nx-X11/lib/X11/lcPrTxt.c | 4 +- nx-X11/lib/X11/lcTxtPr.c | 4 +- nx-X11/lib/X11/lcUtil.c | 2 +- nx-X11/lib/X11/lcWrap.c | 6 +- nx-X11/lib/X11/locking.h | 2 +- nx-X11/lib/X11/mbWMProps.c | 8 +- nx-X11/lib/X11/omDefault.c | 4 +- nx-X11/lib/X11/omGeneric.c | 4 +- nx-X11/lib/X11/os2Stubs.c | 2 +- nx-X11/lib/X11/utf8WMProps.c | 8 +- nx-X11/lib/X11/util/makekeys.c | 6 +- nx-X11/lib/X11/uvY.c | 2 +- nx-X11/lib/X11/xyY.c | 2 +- nx-X11/lib/Xau/AuDispose.c | 2 +- nx-X11/lib/Xau/AuFileName.c | 4 +- nx-X11/lib/Xau/AuGetAddr.c | 4 +- nx-X11/lib/Xau/AuGetBest.c | 8 +- nx-X11/lib/Xau/AuLock.c | 6 +- nx-X11/lib/Xau/AuRead.c | 2 +- nx-X11/lib/Xau/AuUnlock.c | 4 +- nx-X11/lib/Xau/AuWrite.c | 2 +- nx-X11/lib/Xau/Autest.c | 2 +- nx-X11/lib/Xau/Imakefile | 2 +- nx-X11/lib/Xau/k5encode.c | 8 +- nx-X11/lib/Xcomposite/Imakefile | 2 +- nx-X11/lib/Xcomposite/Xcomposite.h | 6 +- nx-X11/lib/Xcomposite/xcompositeint.h | 10 +- nx-X11/lib/Xext/DPMS.c | 10 +- nx-X11/lib/Xext/MITMisc.c | 10 +- nx-X11/lib/Xext/XAppgroup.c | 10 +- nx-X11/lib/Xext/XEVI.c | 12 +- nx-X11/lib/Xext/XLbx.c | 10 +- nx-X11/lib/Xext/XMultibuf.c | 8 +- nx-X11/lib/Xext/XSecurity.c | 8 +- nx-X11/lib/Xext/XShape.c | 12 +- nx-X11/lib/Xext/XShm.c | 12 +- nx-X11/lib/Xext/XSync.c | 8 +- nx-X11/lib/Xext/XTestExt1.c | 6 +- nx-X11/lib/Xext/Xcup.c | 10 +- nx-X11/lib/Xext/Xdbe.c | 8 +- nx-X11/lib/Xext/extutil.c | 6 +- nx-X11/lib/Xext/globals.c | 4 +- nx-X11/lib/Xfixes/Imakefile | 2 +- nx-X11/lib/Xfixes/Xfixes.h | 4 +- nx-X11/lib/Xfixes/Xfixes.man | 2 +- nx-X11/lib/Xfixes/Xfixesint.h | 8 +- nx-X11/lib/Xinerama/Xinerama.c | 14 +- nx-X11/lib/Xrender/Imakefile | 2 +- nx-X11/lib/Xrender/Picture.c | 2 +- nx-X11/lib/Xrender/Xrender.h | 10 +- nx-X11/lib/Xrender/Xrenderint.h | 6 +- nx-X11/lib/Xtst/XRecord.c | 8 +- nx-X11/lib/Xtst/XTest.c | 14 +- nx-X11/lib/oldX/Imakefile | 2 +- nx-X11/lib/xkbfile/Imakefile | 2 +- nx-X11/lib/xkbfile/XKMformat.h | 6 +- nx-X11/lib/xkbfile/cout.c | 8 +- nx-X11/lib/xkbfile/maprules.c | 34 +-- nx-X11/lib/xkbfile/srvmisc.c | 6 +- nx-X11/lib/xkbfile/xkbatom.c | 6 +- nx-X11/lib/xkbfile/xkbbells.c | 4 +- nx-X11/lib/xkbfile/xkbconfig.c | 22 +- nx-X11/lib/xkbfile/xkbdraw.c | 12 +- nx-X11/lib/xkbfile/xkbmisc.c | 24 +- nx-X11/lib/xkbfile/xkbout.c | 22 +- nx-X11/lib/xkbfile/xkbtext.c | 18 +- nx-X11/lib/xkbfile/xkmout.c | 8 +- nx-X11/lib/xkbfile/xkmread.c | 24 +- nx-X11/lib/xtrans/Imakefile | 2 +- nx-X11/programs/Xserver/GL/glx/glxserver.h | 6 +- nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c | 2 +- nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c | 2 +- nx-X11/programs/Xserver/XTrap/xtrapddmi.c | 10 +- nx-X11/programs/Xserver/XTrap/xtrapdi.c | 12 +- nx-X11/programs/Xserver/XTrap/xtrapdiswp.c | 12 +- nx-X11/programs/Xserver/XTrap/xtrapditbl.c | 12 +- nx-X11/programs/Xserver/Xext/EVI.c | 6 +- nx-X11/programs/Xserver/Xext/appgroup.c | 14 +- nx-X11/programs/Xserver/Xext/bigreq.c | 6 +- nx-X11/programs/Xserver/Xext/cup.c | 8 +- nx-X11/programs/Xserver/Xext/dgaproc.h | 2 +- nx-X11/programs/Xserver/Xext/dpms.c | 8 +- nx-X11/programs/Xserver/Xext/extmod/modinit.c | 2 +- nx-X11/programs/Xserver/Xext/extmod/modinit.h | 40 ++-- nx-X11/programs/Xserver/Xext/fontcache.c | 6 +- nx-X11/programs/Xserver/Xext/mbuf.c | 6 +- nx-X11/programs/Xserver/Xext/mbufbf.c | 6 +- nx-X11/programs/Xserver/Xext/mbufpx.c | 6 +- nx-X11/programs/Xserver/Xext/mitmisc.c | 6 +- nx-X11/programs/Xserver/Xext/panoramiX.c | 8 +- nx-X11/programs/Xserver/Xext/panoramiX.h | 2 +- nx-X11/programs/Xserver/Xext/panoramiXSwap.c | 8 +- nx-X11/programs/Xserver/Xext/panoramiXprocs.c | 4 +- nx-X11/programs/Xserver/Xext/sampleEVI.c | 6 +- nx-X11/programs/Xserver/Xext/saver.c | 6 +- nx-X11/programs/Xserver/Xext/security.c | 10 +- nx-X11/programs/Xserver/Xext/shape.c | 6 +- nx-X11/programs/Xserver/Xext/shm.c | 8 +- nx-X11/programs/Xserver/Xext/sleepuntil.c | 4 +- nx-X11/programs/Xserver/Xext/sync.c | 10 +- nx-X11/programs/Xserver/Xext/xcmisc.c | 6 +- nx-X11/programs/Xserver/Xext/xevie.c | 10 +- nx-X11/programs/Xserver/Xext/xf86bigfont.c | 6 +- nx-X11/programs/Xserver/Xext/xf86dga.c | 8 +- nx-X11/programs/Xserver/Xext/xf86dga2.c | 8 +- nx-X11/programs/Xserver/Xext/xf86misc.c | 12 +- nx-X11/programs/Xserver/Xext/xf86vmode.c | 6 +- nx-X11/programs/Xserver/Xext/xres.c | 6 +- nx-X11/programs/Xserver/Xext/xtest.c | 12 +- nx-X11/programs/Xserver/Xext/xtest1dd.c | 10 +- nx-X11/programs/Xserver/Xext/xtest1di.c | 6 +- nx-X11/programs/Xserver/Xext/xvdisp.c | 10 +- nx-X11/programs/Xserver/Xext/xvdix.h | 2 +- nx-X11/programs/Xserver/Xext/xvmain.c | 8 +- nx-X11/programs/Xserver/Xext/xvmc.c | 12 +- nx-X11/programs/Xserver/Xext/xvmcext.h | 2 +- nx-X11/programs/Xserver/Xext/xvmod.c | 6 +- nx-X11/programs/Xserver/Xi/allowev.c | 8 +- nx-X11/programs/Xserver/Xi/chgdctl.c | 8 +- nx-X11/programs/Xserver/Xi/chgfctl.c | 8 +- nx-X11/programs/Xserver/Xi/chgkbd.c | 8 +- nx-X11/programs/Xserver/Xi/chgkmap.c | 8 +- nx-X11/programs/Xserver/Xi/chgprop.c | 8 +- nx-X11/programs/Xserver/Xi/chgptr.c | 8 +- nx-X11/programs/Xserver/Xi/closedev.c | 8 +- nx-X11/programs/Xserver/Xi/devbell.c | 8 +- nx-X11/programs/Xserver/Xi/exevents.c | 8 +- nx-X11/programs/Xserver/Xi/extinit.c | 8 +- nx-X11/programs/Xserver/Xi/getbmap.c | 8 +- nx-X11/programs/Xserver/Xi/getdctl.c | 8 +- nx-X11/programs/Xserver/Xi/getfctl.c | 8 +- nx-X11/programs/Xserver/Xi/getfocus.c | 8 +- nx-X11/programs/Xserver/Xi/getkmap.c | 8 +- nx-X11/programs/Xserver/Xi/getmmap.c | 8 +- nx-X11/programs/Xserver/Xi/getprop.c | 8 +- nx-X11/programs/Xserver/Xi/getselev.c | 8 +- nx-X11/programs/Xserver/Xi/getvers.c | 8 +- nx-X11/programs/Xserver/Xi/grabdev.c | 8 +- nx-X11/programs/Xserver/Xi/grabdevb.c | 8 +- nx-X11/programs/Xserver/Xi/grabdevk.c | 8 +- nx-X11/programs/Xserver/Xi/gtmotion.c | 8 +- nx-X11/programs/Xserver/Xi/listdev.c | 8 +- nx-X11/programs/Xserver/Xi/opendev.c | 8 +- nx-X11/programs/Xserver/Xi/queryst.c | 8 +- nx-X11/programs/Xserver/Xi/selectev.c | 8 +- nx-X11/programs/Xserver/Xi/sendexev.c | 8 +- nx-X11/programs/Xserver/Xi/setbmap.c | 8 +- nx-X11/programs/Xserver/Xi/setdval.c | 8 +- nx-X11/programs/Xserver/Xi/setfocus.c | 8 +- nx-X11/programs/Xserver/Xi/setmmap.c | 8 +- nx-X11/programs/Xserver/Xi/setmode.c | 8 +- nx-X11/programs/Xserver/Xi/stubs.c | 8 +- nx-X11/programs/Xserver/Xi/ungrdev.c | 6 +- nx-X11/programs/Xserver/Xi/ungrdevb.c | 8 +- nx-X11/programs/Xserver/Xi/ungrdevk.c | 8 +- nx-X11/programs/Xserver/composite/compint.h | 2 +- nx-X11/programs/Xserver/damageext/damageextint.h | 4 +- nx-X11/programs/Xserver/dbe/dbe.c | 4 +- nx-X11/programs/Xserver/dbe/dbestruct.h | 2 +- nx-X11/programs/Xserver/dbe/midbe.c | 4 +- nx-X11/programs/Xserver/dix/atom.c | 4 +- nx-X11/programs/Xserver/dix/colormap.c | 4 +- nx-X11/programs/Xserver/dix/cursor.c | 4 +- nx-X11/programs/Xserver/dix/devices.c | 8 +- nx-X11/programs/Xserver/dix/dispatch.c | 6 +- nx-X11/programs/Xserver/dix/dixfonts.c | 8 +- nx-X11/programs/Xserver/dix/dixutils.c | 8 +- nx-X11/programs/Xserver/dix/events.c | 10 +- nx-X11/programs/Xserver/dix/extension.c | 6 +- nx-X11/programs/Xserver/dix/gc.c | 6 +- nx-X11/programs/Xserver/dix/globals.c | 4 +- nx-X11/programs/Xserver/dix/grabs.c | 4 +- nx-X11/programs/Xserver/dix/initatoms.c | 4 +- nx-X11/programs/Xserver/dix/main.c | 8 +- nx-X11/programs/Xserver/dix/pixmap.c | 2 +- nx-X11/programs/Xserver/dix/privates.c | 2 +- nx-X11/programs/Xserver/dix/property.c | 6 +- nx-X11/programs/Xserver/dix/resource.c | 2 +- nx-X11/programs/Xserver/dix/swaprep.c | 4 +- nx-X11/programs/Xserver/dix/swapreq.c | 6 +- nx-X11/programs/Xserver/dix/tables.c | 4 +- nx-X11/programs/Xserver/dix/window.c | 4 +- nx-X11/programs/Xserver/fb/fb.h | 2 +- nx-X11/programs/Xserver/fb/fbcmap.c | 4 +- nx-X11/programs/Xserver/fb/fbpseudocolor.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/Agent.h | 4 +- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Dialog.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Display.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/Events.c | 6 +- nx-X11/programs/Xserver/hw/nxagent/Events.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Holder.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Icons.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 8 +- nx-X11/programs/Xserver/hw/nxagent/NXcomposite.h | 6 +- .../programs/Xserver/hw/nxagent/NXcompositeext.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c | 11 +- nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c | 10 +- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 10 +- nx-X11/programs/Xserver/hw/nxagent/NXextension.c | 6 +- nx-X11/programs/Xserver/hw/nxagent/NXglyphstr.h | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c | 8 +- nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXproperty.c | 6 +- nx-X11/programs/Xserver/hw/nxagent/NXrender.c | 10 +- nx-X11/programs/Xserver/hw/nxagent/NXresource.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXshm.c | 8 +- nx-X11/programs/Xserver/hw/nxagent/NXwindow.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c | 10 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 +- nx-X11/programs/Xserver/hw/nxagent/TestExt.c | 6 +- .../hw/nxagent/X11/include/Xrandr_nxagent.h | 105 +++++++++ .../Xserver/hw/nxagent/X11/include/xpm_nxagent.h | 259 +++++++++++++++++++++ .../Xserver/hw/xfree86/os-support/xf86_libc.h | 2 +- nx-X11/programs/Xserver/include/Imakefile | 4 +- nx-X11/programs/Xserver/include/closestr.h | 2 +- nx-X11/programs/Xserver/include/colormap.h | 2 +- nx-X11/programs/Xserver/include/dixfontstr.h | 2 +- nx-X11/programs/Xserver/include/dixstruct.h | 2 +- nx-X11/programs/Xserver/include/gc.h | 6 +- nx-X11/programs/Xserver/include/gcstruct.h | 2 +- nx-X11/programs/Xserver/include/input.h | 4 +- nx-X11/programs/Xserver/include/misc.h | 12 +- nx-X11/programs/Xserver/include/miscstruct.h | 2 +- nx-X11/programs/Xserver/include/opaque.h | 2 +- nx-X11/programs/Xserver/include/os.h | 2 +- nx-X11/programs/Xserver/include/scrnintstr.h | 2 +- nx-X11/programs/Xserver/include/window.h | 2 +- nx-X11/programs/Xserver/include/windowstr.h | 2 +- nx-X11/programs/Xserver/mfb/maskbits.h | 4 +- nx-X11/programs/Xserver/mi/mi.h | 2 +- nx-X11/programs/Xserver/mi/miarc.c | 6 +- nx-X11/programs/Xserver/mi/mibitblt.c | 6 +- nx-X11/programs/Xserver/mi/mibstore.c | 6 +- nx-X11/programs/Xserver/mi/miclipn.c | 2 +- nx-X11/programs/Xserver/mi/micmap.c | 4 +- nx-X11/programs/Xserver/mi/miexpose.c | 8 +- nx-X11/programs/Xserver/mi/mifillarc.c | 4 +- nx-X11/programs/Xserver/mi/mifillrct.c | 4 +- nx-X11/programs/Xserver/mi/mifpolycon.c | 2 +- nx-X11/programs/Xserver/mi/miinitext.c | 18 +- nx-X11/programs/Xserver/mi/mioverlay.c | 2 +- nx-X11/programs/Xserver/mi/mipoly.c | 2 +- nx-X11/programs/Xserver/mi/mipolygen.c | 2 +- nx-X11/programs/Xserver/mi/mipolypnt.c | 4 +- nx-X11/programs/Xserver/mi/mipolyrect.c | 4 +- nx-X11/programs/Xserver/mi/mipolyseg.c | 4 +- nx-X11/programs/Xserver/mi/mipushpxl.c | 2 +- nx-X11/programs/Xserver/mi/miregion.c | 2 +- nx-X11/programs/Xserver/mi/miscrinit.c | 4 +- nx-X11/programs/Xserver/mi/miwideline.c | 2 +- nx-X11/programs/Xserver/mi/miwindow.c | 2 +- nx-X11/programs/Xserver/mi/mizerarc.c | 4 +- nx-X11/programs/Xserver/mi/mizerclip.c | 2 +- nx-X11/programs/Xserver/mi/mizerline.c | 2 +- nx-X11/programs/Xserver/os/WaitFor.c | 10 +- nx-X11/programs/Xserver/os/access.c | 14 +- nx-X11/programs/Xserver/os/auth.c | 8 +- nx-X11/programs/Xserver/os/connection.c | 14 +- nx-X11/programs/Xserver/os/io.c | 14 +- nx-X11/programs/Xserver/os/k5auth.c | 6 +- nx-X11/programs/Xserver/os/log.c | 2 +- nx-X11/programs/Xserver/os/mitauth.c | 2 +- nx-X11/programs/Xserver/os/osdep.h | 2 +- nx-X11/programs/Xserver/os/osinit.c | 4 +- nx-X11/programs/Xserver/os/rpcauth.c | 2 +- nx-X11/programs/Xserver/os/secauth.c | 4 +- nx-X11/programs/Xserver/os/utils.c | 14 +- nx-X11/programs/Xserver/os/xalloc.c | 4 +- nx-X11/programs/Xserver/os/xdmauth.c | 6 +- nx-X11/programs/Xserver/os/xdmcp.c | 12 +- nx-X11/programs/Xserver/os/xprintf.c | 2 +- nx-X11/programs/Xserver/randr/randrproto.h | 2 +- nx-X11/programs/Xserver/randr/randrstr.h | 12 +- nx-X11/programs/Xserver/randr/rrxinerama.c | 2 +- nx-X11/programs/Xserver/record/record.c | 2 +- nx-X11/programs/Xserver/render/animcur.c | 4 +- nx-X11/programs/Xserver/render/glyphstr.h | 2 +- nx-X11/programs/Xserver/render/render.c | 10 +- nx-X11/programs/Xserver/xfixes/xfixesint.h | 6 +- nx-X11/programs/Xserver/xkb/ddxBeep.c | 10 +- nx-X11/programs/Xserver/xkb/ddxConfig.c | 10 +- nx-X11/programs/Xserver/xkb/ddxCtrls.c | 10 +- nx-X11/programs/Xserver/xkb/ddxDevBtn.c | 12 +- nx-X11/programs/Xserver/xkb/ddxFakeBtn.c | 10 +- nx-X11/programs/Xserver/xkb/ddxFakeMtn.c | 10 +- nx-X11/programs/Xserver/xkb/ddxInit.c | 10 +- nx-X11/programs/Xserver/xkb/ddxKeyClick.c | 10 +- nx-X11/programs/Xserver/xkb/ddxKillSrv.c | 10 +- nx-X11/programs/Xserver/xkb/ddxLEDs.c | 10 +- nx-X11/programs/Xserver/xkb/ddxList.c | 14 +- nx-X11/programs/Xserver/xkb/ddxLoad.c | 16 +- nx-X11/programs/Xserver/xkb/ddxPrivate.c | 4 +- nx-X11/programs/Xserver/xkb/ddxVT.c | 10 +- nx-X11/programs/Xserver/xkb/xkb.c | 10 +- nx-X11/programs/Xserver/xkb/xkbAccessX.c | 8 +- nx-X11/programs/Xserver/xkb/xkbActions.c | 8 +- nx-X11/programs/Xserver/xkb/xkbEvents.c | 10 +- nx-X11/programs/Xserver/xkb/xkbInit.c | 16 +- nx-X11/programs/Xserver/xkb/xkbLEDs.c | 8 +- nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c | 8 +- nx-X11/programs/Xserver/xkb/xkbPrOtherEv.c | 12 +- nx-X11/programs/Xserver/xkb/xkbSwap.c | 8 +- nx-X11/programs/Xserver/xkb/xkbUtils.c | 10 +- nx-X11/programs/nxauth/gethost.c | 4 +- nx-X11/programs/nxauth/parsedpy.c | 6 +- nx-X11/programs/nxauth/process.c | 6 +- nx-X11/programs/nxauth/xauth.h | 6 +- nx-libs.spec | 240 +++++++++---------- nxcompext/Jpeg.c | 6 +- nxcompext/NXlib.h | 4 +- nxcompext/Pgn.h | 6 +- nxcompshad/Input.h | 2 +- nxcompshad/Manager.cpp | 6 +- nxcompshad/Manager.h | 2 +- nxcompshad/Regions.h | 4 +- nxcompshad/Shadow.h | 2 +- nxcompshad/Updater.cpp | 6 +- nxcompshad/Updater.h | 2 +- nxcompshad/Win.cpp | 2 +- nxcompshad/Win.h | 2 +- nxcompshad/X11.cpp | 8 +- nxcompshad/X11.h | 8 +- nxcompshad/X11/include/Xdamage_nxcompshad.h | 92 ++++++++ nxcompshad/X11/include/Xrandr_nxcompshad.h | 80 +++++++ 531 files changed, 2203 insertions(+), 1666 deletions(-) create mode 100644 nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrandr_nxagent.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/X11/include/xpm_nxagent.h create mode 100644 nxcompshad/X11/include/Xdamage_nxcompshad.h create mode 100644 nxcompshad/X11/include/Xrandr_nxcompshad.h (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9b89669df..2b5b4946a 100644 --- a/Makefile +++ b/Makefile @@ -149,9 +149,9 @@ install-full: . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | \ while read dirname; do \ - $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"; \ + $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/")"; \ $(INSTALL_FILE) $${dirname}/*.h \ - "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/nx")"/ || true; \ + "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/")"/ || true; \ done; \ # Provide means for Xinerama support in NX/X2Go sessions. This diff --git a/debian/libnx-x11-dev.install.in b/debian/libnx-x11-dev.install.in index 331ec104f..13af54672 100644 --- a/debian/libnx-x11-dev.install.in +++ b/debian/libnx-x11-dev.install.in @@ -1,15 +1,15 @@ usr/lib/*/libNX_X11.so -usr/include/*/nx/X11/ImUtil.h -usr/include/*/nx/X11/XKBlib.h -usr/include/*/nx/X11/Xcms.h -usr/include/*/nx/X11/Xlib.h -usr/include/*/nx/X11/XlibConf.h -usr/include/*/nx/X11/Xlibint.h -usr/include/*/nx/X11/Xlocale.h -usr/include/*/nx/X11/Xregion.h -usr/include/*/nx/X11/Xresource.h -usr/include/*/nx/X11/Xutil.h -usr/include/*/nx/X11/cursorfont.h -usr/include/*/nx/X11/misc.h -usr/include/*/nx/X11/os.h -usr/include/*/nx/X11/X10.h +usr/include/*/nx-X11/ImUtil.h +usr/include/*/nx-X11/XKBlib.h +usr/include/*/nx-X11/Xcms.h +usr/include/*/nx-X11/Xlib.h +usr/include/*/nx-X11/XlibConf.h +usr/include/*/nx-X11/Xlibint.h +usr/include/*/nx-X11/Xlocale.h +usr/include/*/nx-X11/Xregion.h +usr/include/*/nx-X11/Xresource.h +usr/include/*/nx-X11/Xutil.h +usr/include/*/nx-X11/cursorfont.h +usr/include/*/nx-X11/misc.h +usr/include/*/nx-X11/os.h +usr/include/*/nx-X11/X10.h diff --git a/debian/libnx-xau-dev.install.in b/debian/libnx-xau-dev.install.in index dd17a6054..1bf954c00 100644 --- a/debian/libnx-xau-dev.install.in +++ b/debian/libnx-xau-dev.install.in @@ -1,2 +1,2 @@ usr/lib/*/libNX_Xau.so -usr/include/*/nx/X11/Xauth.h +usr/include/*/nx-X11/Xauth.h diff --git a/debian/libnx-xcomposite-dev.install.in b/debian/libnx-xcomposite-dev.install.in index e7e3a33db..71451dbcc 100644 --- a/debian/libnx-xcomposite-dev.install.in +++ b/debian/libnx-xcomposite-dev.install.in @@ -1,2 +1,2 @@ usr/lib/*/libNX_Xcomposite.so -usr/include/*/nx/X11/extensions/Xcomposite.h +usr/include/*/nx-X11/extensions/Xcomposite.h diff --git a/debian/libnx-xext-dev.install.in b/debian/libnx-xext-dev.install.in index 9f4f60551..0d1df8c08 100644 --- a/debian/libnx-xext-dev.install.in +++ b/debian/libnx-xext-dev.install.in @@ -1,34 +1,34 @@ usr/lib/*/libNX_Xext.so -usr/include/*/nx/X11/extensions/MITMisc.h -usr/include/*/nx/X11/extensions/XEVI.h -usr/include/*/nx/X11/extensions/XEVIstr.h -usr/include/*/nx/X11/extensions/Xevie.h -usr/include/*/nx/X11/extensions/Xeviestr.h -usr/include/*/nx/X11/extensions/XLbx.h -usr/include/*/nx/X11/extensions/XShm.h -usr/include/*/nx/X11/extensions/Xag.h -usr/include/*/nx/X11/extensions/Xagsrv.h -usr/include/*/nx/X11/extensions/Xagstr.h -usr/include/*/nx/X11/extensions/Xcup.h -usr/include/*/nx/X11/extensions/Xcupstr.h -usr/include/*/nx/X11/extensions/Xdbe.h -usr/include/*/nx/X11/extensions/Xdbeproto.h -usr/include/*/nx/X11/extensions/Xext.h -usr/include/*/nx/X11/extensions/dpms.h -usr/include/*/nx/X11/extensions/dpmsstr.h -usr/include/*/nx/X11/extensions/extutil.h -usr/include/*/nx/X11/extensions/lbxstr.h -usr/include/*/nx/X11/extensions/lbxbuf.h -usr/include/*/nx/X11/extensions/lbxdeltastr.h -usr/include/*/nx/X11/extensions/lbximage.h -usr/include/*/nx/X11/extensions/lbxbufstr.h -usr/include/*/nx/X11/extensions/lbxopts.h -usr/include/*/nx/X11/extensions/lbxzlib.h -usr/include/*/nx/X11/extensions/mitmiscstr.h -usr/include/*/nx/X11/extensions/multibuf.h -usr/include/*/nx/X11/extensions/multibufst.h -usr/include/*/nx/X11/extensions/security.h -usr/include/*/nx/X11/extensions/securstr.h -usr/include/*/nx/X11/extensions/shape.h -usr/include/*/nx/X11/extensions/sync.h -usr/include/*/nx/X11/extensions/xtestext1.h +usr/include/*/nx-X11/extensions/MITMisc.h +usr/include/*/nx-X11/extensions/XEVI.h +usr/include/*/nx-X11/extensions/XEVIstr.h +usr/include/*/nx-X11/extensions/Xevie.h +usr/include/*/nx-X11/extensions/Xeviestr.h +usr/include/*/nx-X11/extensions/XLbx.h +usr/include/*/nx-X11/extensions/XShm.h +usr/include/*/nx-X11/extensions/Xag.h +usr/include/*/nx-X11/extensions/Xagsrv.h +usr/include/*/nx-X11/extensions/Xagstr.h +usr/include/*/nx-X11/extensions/Xcup.h +usr/include/*/nx-X11/extensions/Xcupstr.h +usr/include/*/nx-X11/extensions/Xdbe.h +usr/include/*/nx-X11/extensions/Xdbeproto.h +usr/include/*/nx-X11/extensions/Xext.h +usr/include/*/nx-X11/extensions/dpms.h +usr/include/*/nx-X11/extensions/dpmsstr.h +usr/include/*/nx-X11/extensions/extutil.h +usr/include/*/nx-X11/extensions/lbxstr.h +usr/include/*/nx-X11/extensions/lbxbuf.h +usr/include/*/nx-X11/extensions/lbxdeltastr.h +usr/include/*/nx-X11/extensions/lbximage.h +usr/include/*/nx-X11/extensions/lbxbufstr.h +usr/include/*/nx-X11/extensions/lbxopts.h +usr/include/*/nx-X11/extensions/lbxzlib.h +usr/include/*/nx-X11/extensions/mitmiscstr.h +usr/include/*/nx-X11/extensions/multibuf.h +usr/include/*/nx-X11/extensions/multibufst.h +usr/include/*/nx-X11/extensions/security.h +usr/include/*/nx-X11/extensions/securstr.h +usr/include/*/nx-X11/extensions/shape.h +usr/include/*/nx-X11/extensions/sync.h +usr/include/*/nx-X11/extensions/xtestext1.h diff --git a/debian/libnx-xfixes-dev.install.in b/debian/libnx-xfixes-dev.install.in index 96b6cf61c..475c78d0a 100644 --- a/debian/libnx-xfixes-dev.install.in +++ b/debian/libnx-xfixes-dev.install.in @@ -1,2 +1,2 @@ usr/lib/*/libNX_Xfixes.so -usr/include/*/nx/X11/extensions/Xfixes.h +usr/include/*/nx-X11/extensions/Xfixes.h diff --git a/debian/libnx-xinerama-dev.install.in b/debian/libnx-xinerama-dev.install.in index 983784460..59c0456aa 100644 --- a/debian/libnx-xinerama-dev.install.in +++ b/debian/libnx-xinerama-dev.install.in @@ -1,3 +1,3 @@ usr/lib/*/libNX_Xinerama.so -usr/include/*/nx/X11/extensions/Xinerama.h -usr/include/*/nx/X11/extensions/panoramiXext.h +usr/include/*/nx-X11/extensions/Xinerama.h +usr/include/*/nx-X11/extensions/panoramiXext.h diff --git a/debian/libnx-xrender-dev.install.in b/debian/libnx-xrender-dev.install.in index 392e20025..2aede35da 100644 --- a/debian/libnx-xrender-dev.install.in +++ b/debian/libnx-xrender-dev.install.in @@ -1,2 +1,2 @@ usr/lib/*/libNX_Xrender.so -usr/include/*/nx/X11/extensions/Xrender.h +usr/include/*/nx-X11/extensions/Xrender.h diff --git a/debian/libnx-xtst-dev.install.in b/debian/libnx-xtst-dev.install.in index 9dd16a1db..5acca96cf 100644 --- a/debian/libnx-xtst-dev.install.in +++ b/debian/libnx-xtst-dev.install.in @@ -1,2 +1,2 @@ usr/lib/*/libNX_Xtst.so -usr/include/*/nx/X11/extensions/XTest.h +usr/include/*/nx-X11/extensions/XTest.h diff --git a/debian/nx-x11proto-composite-dev.install.in b/debian/nx-x11proto-composite-dev.install.in index 609454a5e..cf2c77e36 100644 --- a/debian/nx-x11proto-composite-dev.install.in +++ b/debian/nx-x11proto-composite-dev.install.in @@ -1,2 +1,2 @@ -usr/include/*/nx/X11/extensions/composite.h -usr/include/*/nx/X11/extensions/compositeproto.h \ No newline at end of file +usr/include/*/nx-X11/extensions/composite.h +usr/include/*/nx-X11/extensions/compositeproto.h \ No newline at end of file diff --git a/debian/nx-x11proto-core-dev.install.in b/debian/nx-x11proto-core-dev.install.in index 92c529f41..2e99909a8 100644 --- a/debian/nx-x11proto-core-dev.install.in +++ b/debian/nx-x11proto-core-dev.install.in @@ -1,23 +1,23 @@ -usr/include/*/nx/X11/DECkeysym.h -usr/include/*/nx/X11/HPkeysym.h -usr/include/*/nx/X11/Sunkeysym.h -usr/include/*/nx/X11/X.h -usr/include/*/nx/X11/XF86keysym.h -usr/include/*/nx/X11/XWDFile.h -usr/include/*/nx/X11/Xalloca.h -usr/include/*/nx/X11/Xarch.h -usr/include/*/nx/X11/Xatom.h -usr/include/*/nx/X11/Xdefs.h -usr/include/*/nx/X11/Xfuncproto.h -usr/include/*/nx/X11/Xfuncs.h -usr/include/*/nx/X11/Xmd.h -usr/include/*/nx/X11/Xos.h -usr/include/*/nx/X11/Xos_r.h -usr/include/*/nx/X11/Xosdefs.h -usr/include/*/nx/X11/Xpoll.h -usr/include/*/nx/X11/Xproto.h -usr/include/*/nx/X11/Xprotostr.h -usr/include/*/nx/X11/Xthreads.h -usr/include/*/nx/X11/ap_keysym.h -usr/include/*/nx/X11/keysym.h -usr/include/*/nx/X11/keysymdef.h +usr/include/*/nx-X11/DECkeysym.h +usr/include/*/nx-X11/HPkeysym.h +usr/include/*/nx-X11/Sunkeysym.h +usr/include/*/nx-X11/X.h +usr/include/*/nx-X11/XF86keysym.h +usr/include/*/nx-X11/XWDFile.h +usr/include/*/nx-X11/Xalloca.h +usr/include/*/nx-X11/Xarch.h +usr/include/*/nx-X11/Xatom.h +usr/include/*/nx-X11/Xdefs.h +usr/include/*/nx-X11/Xfuncproto.h +usr/include/*/nx-X11/Xfuncs.h +usr/include/*/nx-X11/Xmd.h +usr/include/*/nx-X11/Xos.h +usr/include/*/nx-X11/Xos_r.h +usr/include/*/nx-X11/Xosdefs.h +usr/include/*/nx-X11/Xpoll.h +usr/include/*/nx-X11/Xproto.h +usr/include/*/nx-X11/Xprotostr.h +usr/include/*/nx-X11/Xthreads.h +usr/include/*/nx-X11/ap_keysym.h +usr/include/*/nx-X11/keysym.h +usr/include/*/nx-X11/keysymdef.h diff --git a/debian/nx-x11proto-render-dev.install.in b/debian/nx-x11proto-render-dev.install.in index bf778716f..f2222d234 100644 --- a/debian/nx-x11proto-render-dev.install.in +++ b/debian/nx-x11proto-render-dev.install.in @@ -1,3 +1,3 @@ -usr/include/*/nx/X11/extensions/render.h -usr/include/*/nx/X11/extensions/renderproto.h +usr/include/*/nx-X11/extensions/render.h +usr/include/*/nx-X11/extensions/renderproto.h diff --git a/debian/nx-x11proto-xext-dev.install.in b/debian/nx-x11proto-xext-dev.install.in index 7e0ca507f..0d1f8699b 100644 --- a/debian/nx-x11proto-xext-dev.install.in +++ b/debian/nx-x11proto-xext-dev.install.in @@ -1,4 +1,4 @@ -usr/include/*/nx/X11/extensions/xteststr.h -usr/include/*/nx/X11/extensions/shapestr.h -usr/include/*/nx/X11/extensions/shmstr.h -usr/include/*/nx/X11/extensions/syncstr.h +usr/include/*/nx-X11/extensions/xteststr.h +usr/include/*/nx-X11/extensions/shapestr.h +usr/include/*/nx-X11/extensions/shmstr.h +usr/include/*/nx-X11/extensions/syncstr.h diff --git a/debian/nx-x11proto-xfixes-dev.install.in b/debian/nx-x11proto-xfixes-dev.install.in index 4b614d6c1..91eae0306 100644 --- a/debian/nx-x11proto-xfixes-dev.install.in +++ b/debian/nx-x11proto-xfixes-dev.install.in @@ -1,3 +1,3 @@ -usr/include/*/nx/X11/extensions/xfixeswire.h -usr/include/*/nx/X11/extensions/xfixesproto.h +usr/include/*/nx-X11/extensions/xfixeswire.h +usr/include/*/nx-X11/extensions/xfixesproto.h diff --git a/debian/nx-x11proto-xinerama-dev.install.in b/debian/nx-x11proto-xinerama-dev.install.in index 36717e1f5..dca06ddee 100644 --- a/debian/nx-x11proto-xinerama-dev.install.in +++ b/debian/nx-x11proto-xinerama-dev.install.in @@ -1 +1 @@ -usr/include/*/nx/X11/extensions/panoramiXproto.h \ No newline at end of file +usr/include/*/nx-X11/extensions/panoramiXproto.h \ No newline at end of file diff --git a/debian/rules b/debian/rules index b3060b36f..b78855033 100755 --- a/debian/rules +++ b/debian/rules @@ -42,28 +42,28 @@ override_dh_install: rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.a # remove extras, GL, and other unneeded headers - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/GL/ - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XInput.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XK*.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/*Xv*.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xtrap*.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XRes*.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/record*.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86vmode.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86vmstr.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86misc.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86dga1.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86dgastr.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86dga.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86dga1str.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86mscstr.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/bigreqstr.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xcmiscstr.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XIproto.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86bigfstr.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/xf86bigfont.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/extensions/XI.h - rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx/X11/Xtrans/ + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/GL/ + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XInput.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XK*.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/*Xv*.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xtrap*.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XRes*.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/record*.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86vmode.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86vmstr.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86misc.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dga1.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dgastr.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dga.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86dga1str.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86mscstr.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/bigreqstr.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xcmiscstr.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XIproto.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86bigfstr.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/xf86bigfont.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/extensions/XI.h + rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/nx-X11/Xtrans/ dh_install --fail-missing diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index 241bc267f..f54ff84cc 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -1223,7 +1223,7 @@ XCOMM X Window System make variables; these need to be coordinated with rules PROGRAMSRC = $(TOP)/programs LIBSRC = $(XTOP)/lib INCLUDESRC = BuildIncDir - XINCLUDESRC = $(INCLUDESRC)/X11 + XINCLUDESRC = $(INCLUDESRC)/nx-X11 SERVERSRC = $(XTOP)/programs/Xserver CONTRIBSRC = ContribDir UNSUPPORTEDSRC = UnsupportedDir diff --git a/nx-X11/include/GL/glx.h b/nx-X11/include/GL/glx.h index 910504a1d..3a9e942c7 100644 --- a/nx-X11/include/GL/glx.h +++ b/nx-X11/include/GL/glx.h @@ -36,8 +36,8 @@ ** compliant with the OpenGL(R) version 1.2.1 Specification. */ -#include -#include +#include +#include #include #include diff --git a/nx-X11/include/GL/glxint.h b/nx-X11/include/GL/glxint.h index d9e2581bb..50f4a0eaa 100644 --- a/nx-X11/include/GL/glxint.h +++ b/nx-X11/include/GL/glxint.h @@ -23,8 +23,8 @@ ** $SGI$ */ -#include -#include +#include +#include #include "GL/gl.h" typedef struct __GLXvisualConfigRec __GLXvisualConfig; diff --git a/nx-X11/include/Imakefile b/nx-X11/include/Imakefile index 26520eab0..76a4daf6d 100644 --- a/nx-X11/include/Imakefile +++ b/nx-X11/include/Imakefile @@ -51,10 +51,10 @@ HEADERS = \ all:: -BuildIncludes($(HEADERS),X11,..) +BuildIncludes($(HEADERS),nx-X11,..) #if BuildLibraries -InstallMultipleFlags($(HEADERS),$(INCDIR)/X11,$(INSTINCFLAGS)) +InstallMultipleFlags($(HEADERS),$(INCDIR)/nx-X11,$(INSTINCFLAGS)) #endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/nx-X11/include/XWDFile.h b/nx-X11/include/XWDFile.h index 0ce22e1a8..19a26ea33 100644 --- a/nx-X11/include/XWDFile.h +++ b/nx-X11/include/XWDFile.h @@ -39,7 +39,7 @@ in this Software without prior written authorization from The Open Group. #ifndef XWDFILE_H #define XWDFILE_H -#include +#include #define XWD_FILE_VERSION 7 #define sz_XWDheader 100 diff --git a/nx-X11/include/Xdefs.h b/nx-X11/include/Xdefs.h index f32149db5..c06202af3 100644 --- a/nx-X11/include/Xdefs.h +++ b/nx-X11/include/Xdefs.h @@ -31,7 +31,7 @@ authorization from The XFree86 Project Inc.. #define _XDEFS_H #ifdef _XSERVER64 -#include +#include #endif #ifndef _XTYPEDEF_ATOM diff --git a/nx-X11/include/Xfuncs.h b/nx-X11/include/Xfuncs.h index a059bc710..7582198bb 100644 --- a/nx-X11/include/Xfuncs.h +++ b/nx-X11/include/Xfuncs.h @@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XFUNCS_H_ #define _XFUNCS_H_ -#include +#include /* the old Xfuncs.h, for pre-R6 */ #if !(defined(XFree86LOADER) && defined(IN_MODULE)) diff --git a/nx-X11/include/Xos.h b/nx-X11/include/Xos.h index 04b14b6fc..a2abf156f 100644 --- a/nx-X11/include/Xos.h +++ b/nx-X11/include/Xos.h @@ -37,7 +37,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XOS_H_ #define _XOS_H_ -#include +#include /* * Get major data types (esp. caddr_t) @@ -150,7 +150,7 @@ extern int sys_nerr; #include #endif #ifdef WIN32 -#include +#include #else #include #endif @@ -285,6 +285,6 @@ struct sockaddr_un { }; #endif -#include +#include #endif /* _XOS_H_ */ diff --git a/nx-X11/include/Xos_r.h b/nx-X11/include/Xos_r.h index e539aee2a..44b1eaacf 100644 --- a/nx-X11/include/Xos_r.h +++ b/nx-X11/include/Xos_r.h @@ -216,7 +216,7 @@ extern void XtProcessUnlock( * * #define X_INCLUDE_PWD_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xgetpwparams; * @@ -394,7 +394,7 @@ typedef int _Xgetpwret; * * #define X_INCLUDE_NETDB_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xgethostbynameparams; * typedef ... _Xgetservbynameparams; @@ -556,7 +556,7 @@ typedef int _Xgetservbynameparams; /* dummy */ * * #define X_INCLUDE_DIRENT_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xreaddirparams; * @@ -680,7 +680,7 @@ extern int _Preaddir_r(DIR *, struct dirent *, struct dirent **); * * #define X_INCLUDE_UNISTD_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xgetloginparams; * typedef ... _Xttynameparams; @@ -822,7 +822,7 @@ typedef struct { * * #define X_INCLUDE_STRING_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xstrtokparams; * @@ -868,7 +868,7 @@ typedef char * _Xstrtokparams; * * #define X_INCLUDE_TIME_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xatimeparams; * typedef ... _Xctimeparams; @@ -1036,7 +1036,7 @@ typedef struct tm _Xltimeparams; * * #define X_INCLUDE_GRP_H * #define XOS_USE_..._LOCKING - * #include + * #include * * typedef ... _Xgetgrparams; * diff --git a/nx-X11/include/Xpoll.h.in b/nx-X11/include/Xpoll.h.in index 3200c3711..77a0aea3d 100644 --- a/nx-X11/include/Xpoll.h.in +++ b/nx-X11/include/Xpoll.h.in @@ -75,7 +75,7 @@ from The Open Group. #ifndef USE_POLL -#include +#include /* Below is the monster branch from hell. Basically, most systems will drop to * 'the branch below is the fallthrough for halfway modern systems', and include @@ -104,7 +104,7 @@ from The Open Group. # include #endif -#include +#include #ifdef CSRG_BASED #include @@ -241,7 +241,7 @@ extern int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, #ifndef FD_SETSIZE #define FD_SETSIZE XFD_SETSIZE #endif -#include +#include #define Select(n,r,w,e,t) select(0,(fd_set*)r,(fd_set*)w,(fd_set*)e,(struct timeval*)t) diff --git a/nx-X11/include/Xproto.h b/nx-X11/include/Xproto.h index 877aab442..0f7d1f557 100644 --- a/nx-X11/include/Xproto.h +++ b/nx-X11/include/Xproto.h @@ -73,8 +73,8 @@ SOFTWARE. ******************************************************************/ -#include -#include +#include +#include /* * Define constants for the sizes of the network packets. The sz_ prefix is diff --git a/nx-X11/include/Xprotostr.h b/nx-X11/include/Xprotostr.h index f343d9849..a0f849874 100644 --- a/nx-X11/include/Xprotostr.h +++ b/nx-X11/include/Xprotostr.h @@ -48,7 +48,7 @@ ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ******************************************************************/ -#include +#include /* Used by PolySegment */ diff --git a/nx-X11/include/Xthreads.h b/nx-X11/include/Xthreads.h index 54b5440ad..41440a2fb 100644 --- a/nx-X11/include/Xthreads.h +++ b/nx-X11/include/Xthreads.h @@ -98,7 +98,7 @@ extern xthread_t (*_x11_thr_self)(); #define xcondition_broadcast(cv) cond_broadcast(cv) #else /* !SVR4 */ #ifdef WIN32 -#include +#include typedef DWORD xthread_t; typedef DWORD xthread_key_t; struct _xthread_waiter { diff --git a/nx-X11/include/extensions/Imakefile b/nx-X11/include/extensions/Imakefile index ec6c10b98..b7ed23120 100644 --- a/nx-X11/include/extensions/Imakefile +++ b/nx-X11/include/extensions/Imakefile @@ -101,10 +101,10 @@ HEADERS = Xext.h \ all:: -BuildIncludes($(HEADERS),X11/extensions,../..) +BuildIncludes($(HEADERS),nx-X11/extensions,../..) #if BuildLibraries -InstallMultipleFlags($(HEADERS),$(INCDIR)/X11/extensions,$(INSTINCFLAGS)) +InstallMultipleFlags($(HEADERS),$(INCDIR)/nx-X11/extensions,$(INSTINCFLAGS)) #endif InstallDriverSDKNonExecFile(XI.h,$(DRIVERSDKINCLUDEDIR)/extensions) diff --git a/nx-X11/include/extensions/MITMisc.h b/nx-X11/include/extensions/MITMisc.h index 975700e01..d66b8242d 100644 --- a/nx-X11/include/extensions/MITMisc.h +++ b/nx-X11/include/extensions/MITMisc.h @@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XMITMISC_H_ #define _XMITMISC_H_ -#include +#include #define X_MITSetBugMode 0 #define X_MITGetBugMode 1 diff --git a/nx-X11/include/extensions/XEVI.h b/nx-X11/include/extensions/XEVI.h index d8e37ff4f..30b2412d9 100644 --- a/nx-X11/include/extensions/XEVI.h +++ b/nx-X11/include/extensions/XEVI.h @@ -25,7 +25,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XEVI_H_ #define _XEVI_H_ -#include +#include #define X_EVIQueryVersion 0 #define X_EVIGetVisualInfo 1 #define XEVI_TRANSPARENCY_NONE 0 diff --git a/nx-X11/include/extensions/XEVIstr.h b/nx-X11/include/extensions/XEVIstr.h index 388ef4bcf..4deb6c113 100644 --- a/nx-X11/include/extensions/XEVIstr.h +++ b/nx-X11/include/extensions/XEVIstr.h @@ -26,7 +26,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _EVISTR_H_ #define _EVISTR_H_ -#include +#include #define VisualID CARD32 #define EVINAME "Extended-Visual-Information" diff --git a/nx-X11/include/extensions/XInput.h b/nx-X11/include/extensions/XInput.h index ee4410531..cf4b72ca0 100644 --- a/nx-X11/include/extensions/XInput.h +++ b/nx-X11/include/extensions/XInput.h @@ -52,8 +52,8 @@ SOFTWARE. #ifndef _XINPUT_H_ #define _XINPUT_H_ -#include -#include +#include +#include #define _deviceKeyPress 0 #define _deviceKeyRelease 1 diff --git a/nx-X11/include/extensions/XIproto.h b/nx-X11/include/extensions/XIproto.h index 1da0248f8..cccb11a2c 100644 --- a/nx-X11/include/extensions/XIproto.h +++ b/nx-X11/include/extensions/XIproto.h @@ -50,8 +50,8 @@ SOFTWARE. #ifndef _XIPROTO_H #define _XIPROTO_H -#include -#include +#include +#include /* make sure types have right sizes for protocol structures. */ #define Window CARD32 diff --git a/nx-X11/include/extensions/XKBgeom.h b/nx-X11/include/extensions/XKBgeom.h index 89f902fba..6ef114bfe 100644 --- a/nx-X11/include/extensions/XKBgeom.h +++ b/nx-X11/include/extensions/XKBgeom.h @@ -29,7 +29,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBGEOM_H_ #define _XKBGEOM_H_ -#include +#include #ifdef XKB_IN_SERVER #define XkbAddGeomKeyAlias SrvXkbAddGeomKeyAlias diff --git a/nx-X11/include/extensions/XKBproto.h b/nx-X11/include/extensions/XKBproto.h index 97dd4d262..2dc3b141e 100644 --- a/nx-X11/include/extensions/XKBproto.h +++ b/nx-X11/include/extensions/XKBproto.h @@ -28,8 +28,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBPROTO_H_ #define _XKBPROTO_H_ -#include -#include +#include +#include #define Window CARD32 #define Atom CARD32 diff --git a/nx-X11/include/extensions/XKBsrv.h b/nx-X11/include/extensions/XKBsrv.h index 0d262e979..3d335bc88 100644 --- a/nx-X11/include/extensions/XKBsrv.h +++ b/nx-X11/include/extensions/XKBsrv.h @@ -69,8 +69,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define XkbUpdateKeyTypeVirtualMods SrvXkbUpdateKeyTypeVirtualMods #endif -#include -#include +#include +#include #include "inputstr.h" #ifdef NXAGENT_SERVER @@ -1100,9 +1100,9 @@ extern void XkbSendNewKeyboardNotify( #ifdef XKBSRV_NEED_FILE_FUNCS -#include -#include -#include +#include +#include +#include #define _XkbListKeymaps 0 #define _XkbListKeycodes 1 diff --git a/nx-X11/include/extensions/XKBstr.h b/nx-X11/include/extensions/XKBstr.h index 6131c931c..77666f6aa 100644 --- a/nx-X11/include/extensions/XKBstr.h +++ b/nx-X11/include/extensions/XKBstr.h @@ -28,7 +28,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBSTR_H_ #define _XKBSTR_H_ -#include +#include #define XkbCharToInt(v) ((v)&0x80?(int)((v)|(~0xff)):(int)((v)&0x7f)) #define XkbIntTo2Chars(i,h,l) (((h)=((i>>8)&0xff)),((l)=((i)&0xff))) diff --git a/nx-X11/include/extensions/XLbx.h b/nx-X11/include/extensions/XLbx.h index 01d44f090..6cd867944 100644 --- a/nx-X11/include/extensions/XLbx.h +++ b/nx-X11/include/extensions/XLbx.h @@ -25,7 +25,7 @@ #ifndef _XLBX_H_ #define _XLBX_H_ -#include +#include /* * NOTE: any changes or additions to the opcodes needs to be reflected @@ -128,8 +128,8 @@ #ifndef _XLBX_SERVER_ -#include -#include +#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/XShm.h b/nx-X11/include/extensions/XShm.h index 4ae14ca8b..4b0d01bef 100644 --- a/nx-X11/include/extensions/XShm.h +++ b/nx-X11/include/extensions/XShm.h @@ -32,7 +32,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XSHM_H_ #define _XSHM_H_ -#include +#include #define X_ShmQueryVersion 0 #define X_ShmAttach 1 diff --git a/nx-X11/include/extensions/XTest.h b/nx-X11/include/extensions/XTest.h index afb1849c3..4817ef132 100644 --- a/nx-X11/include/extensions/XTest.h +++ b/nx-X11/include/extensions/XTest.h @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XTEST_H_ #define _XTEST_H_ -#include +#include #define X_XTestGetVersion 0 #define X_XTestCompareCursor 1 @@ -47,7 +47,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XTEST_SERVER_ -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/Xag.h b/nx-X11/include/extensions/Xag.h index 815f2b9f9..4c1193e3d 100644 --- a/nx-X11/include/extensions/Xag.h +++ b/nx-X11/include/extensions/Xag.h @@ -29,7 +29,7 @@ from The Open Group. #ifndef _XAG_H_ #define _XAG_H_ -#include +#include #define X_XagQueryVersion 0 #define X_XagCreate 1 diff --git a/nx-X11/include/extensions/Xagsrv.h b/nx-X11/include/extensions/Xagsrv.h index b9c50aaa9..daf1af04d 100644 --- a/nx-X11/include/extensions/Xagsrv.h +++ b/nx-X11/include/extensions/Xagsrv.h @@ -29,7 +29,7 @@ from The Open Group. #ifndef _XAGSRV_H_ #define _XAGSRV_H_ -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/Xagstr.h b/nx-X11/include/extensions/Xagstr.h index ffb5527a2..4f12027e0 100644 --- a/nx-X11/include/extensions/Xagstr.h +++ b/nx-X11/include/extensions/Xagstr.h @@ -29,7 +29,7 @@ from The Open Group. #ifndef _XAGSTR_H_ /* { */ #define _XAGSTR_H_ -#include +#include #define XAppGroup CARD32 diff --git a/nx-X11/include/extensions/Xcup.h b/nx-X11/include/extensions/Xcup.h index b1df039e6..fb5fd0887 100644 --- a/nx-X11/include/extensions/Xcup.h +++ b/nx-X11/include/extensions/Xcup.h @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XCUP_H_ #define _XCUP_H_ -#include +#include #define X_XcupQueryVersion 0 #define X_XcupGetReservedColormapEntries 1 diff --git a/nx-X11/include/extensions/Xcupstr.h b/nx-X11/include/extensions/Xcupstr.h index f521c333c..fa77b5aea 100644 --- a/nx-X11/include/extensions/Xcupstr.h +++ b/nx-X11/include/extensions/Xcupstr.h @@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XCUPSTR_H_ /* { */ #define _XCUPSTR_H_ -#include +#include #define XCUPNAME "TOG-CUP" diff --git a/nx-X11/include/extensions/Xdbe.h b/nx-X11/include/extensions/Xdbe.h index f9205a228..bc43007c6 100644 --- a/nx-X11/include/extensions/Xdbe.h +++ b/nx-X11/include/extensions/Xdbe.h @@ -38,8 +38,8 @@ /* INCLUDES */ -#include -#include +#include +#include /* DEFINES */ diff --git a/nx-X11/include/extensions/Xevie.h b/nx-X11/include/extensions/Xevie.h index d6d4fab84..5dc48bbfd 100644 --- a/nx-X11/include/extensions/Xevie.h +++ b/nx-X11/include/extensions/Xevie.h @@ -35,7 +35,7 @@ of the copyright holder. #ifndef _XEVIE_H_ #define _XEVIE_H_ -#include +#include #define XEVIE_UNMODIFIED 0 #define XEVIE_MODIFIED 1 diff --git a/nx-X11/include/extensions/Xext.h b/nx-X11/include/extensions/Xext.h index 5b62c8b2d..b0ce292fc 100644 --- a/nx-X11/include/extensions/Xext.h +++ b/nx-X11/include/extensions/Xext.h @@ -28,7 +28,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _XEXT_H_ #define _XEXT_H_ -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/Xinerama.h b/nx-X11/include/extensions/Xinerama.h index e1c9445c3..77e7e7444 100644 --- a/nx-X11/include/extensions/Xinerama.h +++ b/nx-X11/include/extensions/Xinerama.h @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _Xinerama_h #define _Xinerama_h -#include +#include typedef struct { int screen_number; diff --git a/nx-X11/include/extensions/Xv.h b/nx-X11/include/extensions/Xv.h index 4e85fa719..f07f9d75f 100644 --- a/nx-X11/include/extensions/Xv.h +++ b/nx-X11/include/extensions/Xv.h @@ -44,7 +44,7 @@ SOFTWARE. ** */ -#include +#include #define XvName "XVideo" #define XvVersion 2 diff --git a/nx-X11/include/extensions/XvMC.h b/nx-X11/include/extensions/XvMC.h index 3e621f05a..1709692a1 100644 --- a/nx-X11/include/extensions/XvMC.h +++ b/nx-X11/include/extensions/XvMC.h @@ -3,8 +3,8 @@ #ifndef _XVMC_H_ #define _XVMC_H_ -#include -#include +#include +#include #define XvMCName "XVideo-MotionCompensation" #define XvMCNumEvents 0 diff --git a/nx-X11/include/extensions/XvMClib.h b/nx-X11/include/extensions/XvMClib.h index 1b30a669a..c1e94119e 100644 --- a/nx-X11/include/extensions/XvMClib.h +++ b/nx-X11/include/extensions/XvMClib.h @@ -4,9 +4,9 @@ #ifndef _XVMCLIB_H_ #define _XVMCLIB_H_ -#include -#include -#include +#include +#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/Xvlib.h b/nx-X11/include/extensions/Xvlib.h index 2fd26e55b..98c407e31 100644 --- a/nx-X11/include/extensions/Xvlib.h +++ b/nx-X11/include/extensions/Xvlib.h @@ -53,8 +53,8 @@ SOFTWARE. ** */ -#include -#include +#include +#include typedef struct { int numerator; diff --git a/nx-X11/include/extensions/Xvproto.h b/nx-X11/include/extensions/Xvproto.h index 9112f510e..81e1656a8 100644 --- a/nx-X11/include/extensions/Xvproto.h +++ b/nx-X11/include/extensions/Xvproto.h @@ -49,7 +49,7 @@ SOFTWARE. ** */ -#include +#include /* Symbols: These are undefined at the end of this file to restore the values they have in Xv.h */ diff --git a/nx-X11/include/extensions/composite.h b/nx-X11/include/extensions/composite.h index bfdfbee97..d1901750a 100644 --- a/nx-X11/include/extensions/composite.h +++ b/nx-X11/include/extensions/composite.h @@ -25,7 +25,7 @@ #ifndef _COMPOSITE_H_ #define _COMPOSITE_H_ -#include +#include #define COMPOSITE_NAME "Composite" #define COMPOSITE_MAJOR 0 diff --git a/nx-X11/include/extensions/compositeproto.h b/nx-X11/include/extensions/compositeproto.h index 2304e961d..a851c727e 100644 --- a/nx-X11/include/extensions/compositeproto.h +++ b/nx-X11/include/extensions/compositeproto.h @@ -25,8 +25,8 @@ #ifndef _COMPOSITEPROTO_H_ #define _COMPOSITEPROTO_H_ -#include -#include +#include +#include #define Window CARD32 #define Region CARD32 diff --git a/nx-X11/include/extensions/dpms.h b/nx-X11/include/extensions/dpms.h index 7555f4ab6..87d7c9c81 100644 --- a/nx-X11/include/extensions/dpms.h +++ b/nx-X11/include/extensions/dpms.h @@ -46,8 +46,8 @@ Equipment Corporation. #ifndef DPMS_SERVER -#include -#include +#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/extutil.h b/nx-X11/include/extensions/extutil.h index 825d81e93..de6becfd2 100644 --- a/nx-X11/include/extensions/extutil.h +++ b/nx-X11/include/extensions/extutil.h @@ -36,7 +36,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _EXTUTIL_H_ #define _EXTUTIL_H_ -#include +#include /* * We need to keep a list of open displays since the Xlib display list isn't diff --git a/nx-X11/include/extensions/fontcache.h b/nx-X11/include/extensions/fontcache.h index b767db19b..2a3cf619b 100644 --- a/nx-X11/include/extensions/fontcache.h +++ b/nx-X11/include/extensions/fontcache.h @@ -68,7 +68,7 @@ typedef struct { #ifndef _FONTCACHE_SERVER_ -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/fontcacheP.h b/nx-X11/include/extensions/fontcacheP.h index 75677f300..5363ef149 100644 --- a/nx-X11/include/extensions/fontcacheP.h +++ b/nx-X11/include/extensions/fontcacheP.h @@ -31,7 +31,7 @@ #ifndef _FONTCACHEP_H_ #define _FONTCACHEP_H_ -#include +#include int FontCacheChangeSettings(FontCacheSettingsPtr /* cinfo */); void FontCacheGetSettings(FontCacheSettingsPtr /* cinfo */); diff --git a/nx-X11/include/extensions/fontcachstr.h b/nx-X11/include/extensions/fontcachstr.h index eab704e23..abead0f2b 100644 --- a/nx-X11/include/extensions/fontcachstr.h +++ b/nx-X11/include/extensions/fontcachstr.h @@ -34,7 +34,7 @@ #ifndef _FONTCACHESTR_H_ #define _FONTCACHESTR_H_ -#include +#include #define FONTCACHENAME "FontCache" diff --git a/nx-X11/include/extensions/lbxbuf.h b/nx-X11/include/extensions/lbxbuf.h index 63983df16..1a5a7475a 100644 --- a/nx-X11/include/extensions/lbxbuf.h +++ b/nx-X11/include/extensions/lbxbuf.h @@ -38,7 +38,7 @@ typedef struct _zlibbuffer *ZlibBufferPtr; -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/lbxbufstr.h b/nx-X11/include/extensions/lbxbufstr.h index e1a06f633..d99730e7e 100644 --- a/nx-X11/include/extensions/lbxbufstr.h +++ b/nx-X11/include/extensions/lbxbufstr.h @@ -27,7 +27,7 @@ #ifndef _BUFFERSTR_H_ #define _BUFFERSTR_H_ -#include +#include /* * ZLIB Input/Output buffer diff --git a/nx-X11/include/extensions/lbximage.h b/nx-X11/include/extensions/lbximage.h index 10627cf29..fff181a69 100644 --- a/nx-X11/include/extensions/lbximage.h +++ b/nx-X11/include/extensions/lbximage.h @@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _LBX_IMAGE_H_ #define _LBX_IMAGE_H_ -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/lbxstr.h b/nx-X11/include/extensions/lbxstr.h index a7521b1be..7bde5a766 100644 --- a/nx-X11/include/extensions/lbxstr.h +++ b/nx-X11/include/extensions/lbxstr.h @@ -25,7 +25,7 @@ #ifndef _LBXSTR_H_ #define _LBXSTR_H_ -#include +#include #define LBXNAME "LBX" diff --git a/nx-X11/include/extensions/multibuf.h b/nx-X11/include/extensions/multibuf.h index 96b4c3b14..c35399b01 100644 --- a/nx-X11/include/extensions/multibuf.h +++ b/nx-X11/include/extensions/multibuf.h @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _MULTIBUF_H_ #define _MULTIBUF_H_ -#include +#include #define MULTIBUFFER_PROTOCOL_NAME "Multi-Buffering" diff --git a/nx-X11/include/extensions/recordstr.h b/nx-X11/include/extensions/recordstr.h index 246d34f1a..88ff8b66b 100644 --- a/nx-X11/include/extensions/recordstr.h +++ b/nx-X11/include/extensions/recordstr.h @@ -29,7 +29,7 @@ static char sccsid[ ] = "@(#) recordstr.h 1.5 6/5/95 12:37:44"; #ifndef _RECORDSTR_H_ #define _RECORDSTR_H_ -#include +#include #define RECORD_NAME "RECORD" #define RECORD_MAJOR_VERSION 1 diff --git a/nx-X11/include/extensions/renderproto.h b/nx-X11/include/extensions/renderproto.h index bdd4c746f..25c510cd1 100644 --- a/nx-X11/include/extensions/renderproto.h +++ b/nx-X11/include/extensions/renderproto.h @@ -26,8 +26,8 @@ #ifndef _XRENDERP_H_ #define _XRENDERP_H_ -#include -#include +#include +#include #define Window CARD32 #define Drawable CARD32 diff --git a/nx-X11/include/extensions/saverproto.h b/nx-X11/include/extensions/saverproto.h index 1a671af91..17f740f4d 100644 --- a/nx-X11/include/extensions/saverproto.h +++ b/nx-X11/include/extensions/saverproto.h @@ -31,7 +31,7 @@ in this Software without prior written authorization from the X Consortium. #ifndef _SAVERPROTO_H_ #define _SAVERPROTO_H_ -#include +#include #define Window CARD32 #define Drawable CARD32 diff --git a/nx-X11/include/extensions/scrnsaver.h b/nx-X11/include/extensions/scrnsaver.h index 2659edd73..38e5e24df 100644 --- a/nx-X11/include/extensions/scrnsaver.h +++ b/nx-X11/include/extensions/scrnsaver.h @@ -31,9 +31,9 @@ in this Software without prior written authorization from the X Consortium. #ifndef _SCRNSAVER_H_ #define _SCRNSAVER_H_ -#include -#include -#include +#include +#include +#include typedef struct { int type; /* of event */ diff --git a/nx-X11/include/extensions/security.h b/nx-X11/include/extensions/security.h index 188ad55bc..a0aabaf8e 100644 --- a/nx-X11/include/extensions/security.h +++ b/nx-X11/include/extensions/security.h @@ -30,7 +30,7 @@ from The Open Group. #define _SECURITY_H #define _XAUTH_STRUCT_ONLY -#include +#include /* constants that server, library, and application all need */ diff --git a/nx-X11/include/extensions/securstr.h b/nx-X11/include/extensions/securstr.h index 50c764441..3e93fe10e 100644 --- a/nx-X11/include/extensions/securstr.h +++ b/nx-X11/include/extensions/securstr.h @@ -29,7 +29,7 @@ from The Open Group. #ifndef _SECURSTR_H #define _SECURSTR_H -#include +#include #define SECURITY_EXTENSION_NAME "SECURITY" #define SECURITY_MAJOR_VERSION 1 diff --git a/nx-X11/include/extensions/shape.h b/nx-X11/include/extensions/shape.h index d173efef8..5e85ffc04 100644 --- a/nx-X11/include/extensions/shape.h +++ b/nx-X11/include/extensions/shape.h @@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _SHAPE_H_ #define _SHAPE_H_ -#include +#include #define X_ShapeQueryVersion 0 #define X_ShapeRectangles 1 @@ -59,7 +59,7 @@ in this Software without prior written authorization from The Open Group. #ifndef _SHAPE_SERVER_ -#include +#include typedef struct { int type; /* of event */ diff --git a/nx-X11/include/extensions/sync.h b/nx-X11/include/extensions/sync.h index 9fbe6d72f..8d2861663 100644 --- a/nx-X11/include/extensions/sync.h +++ b/nx-X11/include/extensions/sync.h @@ -53,7 +53,7 @@ PERFORMANCE OF THIS SOFTWARE. #ifndef _SYNC_H_ #define _SYNC_H_ -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/include/extensions/vldXvMC.h b/nx-X11/include/extensions/vldXvMC.h index 91fb3b76a..355c662e6 100644 --- a/nx-X11/include/extensions/vldXvMC.h +++ b/nx-X11/include/extensions/vldXvMC.h @@ -28,9 +28,9 @@ #ifndef _VLDXVMC_H #define _VLDXVMC_H -#include -#include -#include +#include +#include +#include /* * New "Motion compensation type". diff --git a/nx-X11/include/extensions/xf86bigfont.h b/nx-X11/include/extensions/xf86bigfont.h index 654cc401b..d6be21b6f 100644 --- a/nx-X11/include/extensions/xf86bigfont.h +++ b/nx-X11/include/extensions/xf86bigfont.h @@ -11,7 +11,7 @@ #ifndef _XF86BIGFONT_H_ #define _XF86BIGFONT_H_ -#include +#include #define X_XF86BigfontQueryVersion 0 #define X_XF86BigfontQueryFont 1 diff --git a/nx-X11/include/extensions/xf86bigfstr.h b/nx-X11/include/extensions/xf86bigfstr.h index 95f107a2a..6f66e58d9 100644 --- a/nx-X11/include/extensions/xf86bigfstr.h +++ b/nx-X11/include/extensions/xf86bigfstr.h @@ -11,7 +11,7 @@ #ifndef _XF86BIGFSTR_H_ #define _XF86BIGFSTR_H_ -#include +#include #define XF86BIGFONTNAME "XFree86-Bigfont" diff --git a/nx-X11/include/extensions/xf86dga.h b/nx-X11/include/extensions/xf86dga.h index 720118842..d6e494158 100644 --- a/nx-X11/include/extensions/xf86dga.h +++ b/nx-X11/include/extensions/xf86dga.h @@ -6,8 +6,8 @@ #ifndef _XF86DGA_H_ #define _XF86DGA_H_ -#include -#include +#include +#include #define X_XDGAQueryVersion 0 diff --git a/nx-X11/include/extensions/xf86dga1.h b/nx-X11/include/extensions/xf86dga1.h index 4f45e74b3..972b18e9e 100644 --- a/nx-X11/include/extensions/xf86dga1.h +++ b/nx-X11/include/extensions/xf86dga1.h @@ -15,7 +15,7 @@ Copyright (c) 1995 XFree86 Inc #ifndef _XF86DGA1_H_ #define _XF86DGA1_H_ -#include +#include #define X_XF86DGAQueryVersion 0 #define X_XF86DGAGetVideoLL 1 diff --git a/nx-X11/include/extensions/xf86dgastr.h b/nx-X11/include/extensions/xf86dgastr.h index 66dd354c8..30e4ff722 100644 --- a/nx-X11/include/extensions/xf86dgastr.h +++ b/nx-X11/include/extensions/xf86dgastr.h @@ -9,7 +9,7 @@ Copyright (c) 1995 XFree86 Inc. #ifndef _XF86DGASTR_H_ #define _XF86DGASTR_H_ -#include +#include #define XF86DGANAME "XFree86-DGA" diff --git a/nx-X11/include/extensions/xf86misc.h b/nx-X11/include/extensions/xf86misc.h index f5d7a5664..fb01a6357 100644 --- a/nx-X11/include/extensions/xf86misc.h +++ b/nx-X11/include/extensions/xf86misc.h @@ -9,7 +9,7 @@ #ifndef _XF86MISC_H_ #define _XF86MISC_H_ -#include +#include #define X_XF86MiscQueryVersion 0 #ifdef _XF86MISC_SAVER_COMPAT_ diff --git a/nx-X11/include/extensions/xf86mscstr.h b/nx-X11/include/extensions/xf86mscstr.h index 637d3a5a0..2b8c0d07e 100644 --- a/nx-X11/include/extensions/xf86mscstr.h +++ b/nx-X11/include/extensions/xf86mscstr.h @@ -9,7 +9,7 @@ #ifndef _XF86MISCSTR_H_ #define _XF86MISCSTR_H_ -#include +#include #define XF86MISCNAME "XFree86-Misc" diff --git a/nx-X11/include/extensions/xf86vmode.h b/nx-X11/include/extensions/xf86vmode.h index 3420ae4c8..624820dea 100644 --- a/nx-X11/include/extensions/xf86vmode.h +++ b/nx-X11/include/extensions/xf86vmode.h @@ -35,8 +35,8 @@ from Kaleb S. KEITHLEY #ifndef _XF86VIDMODE_H_ #define _XF86VIDMODE_H_ -#include -#include +#include +#include #define X_XF86VidModeQueryVersion 0 #define X_XF86VidModeGetModeLine 1 diff --git a/nx-X11/include/extensions/xf86vmstr.h b/nx-X11/include/extensions/xf86vmstr.h index a80eb8eb6..43c67980f 100644 --- a/nx-X11/include/extensions/xf86vmstr.h +++ b/nx-X11/include/extensions/xf86vmstr.h @@ -35,7 +35,7 @@ from Kaleb S. KEITHLEY #ifndef _XF86VIDMODESTR_H_ #define _XF86VIDMODESTR_H_ -#include +#include #define XF86VIDMODENAME "XFree86-VidModeExtension" diff --git a/nx-X11/include/extensions/xfixesproto.h b/nx-X11/include/extensions/xfixesproto.h index 773bc65d1..0ef6a2fd6 100644 --- a/nx-X11/include/extensions/xfixesproto.h +++ b/nx-X11/include/extensions/xfixesproto.h @@ -25,10 +25,10 @@ #ifndef _XFIXESPROTO_H_ #define _XFIXESPROTO_H_ -#include -#include +#include +#include #define _SHAPE_SERVER_ -#include +#include #undef _SHAPE_SERVER_ #define Window CARD32 diff --git a/nx-X11/include/extensions/xtrapddmi.h b/nx-X11/include/extensions/xtrapddmi.h index c187a3a0b..71df0712d 100644 --- a/nx-X11/include/extensions/xtrapddmi.h +++ b/nx-X11/include/extensions/xtrapddmi.h @@ -42,8 +42,8 @@ SOFTWARE. * contained herein should *not* be visible to clients (xtrapdi.h * is used for this). The name is historical. */ -#include -#include +#include +#include #include "dix.h" #ifndef MIN diff --git a/nx-X11/include/extensions/xtrapdi.h b/nx-X11/include/extensions/xtrapdi.h index 9db13bb20..34696113d 100644 --- a/nx-X11/include/extensions/xtrapdi.h +++ b/nx-X11/include/extensions/xtrapdi.h @@ -48,14 +48,14 @@ SOFTWARE. #ifndef IN_MODULE #include #endif -#include -#include +#include +#include #ifdef SMT #define NEED_EVENTS #define NEED_REPLIES #endif -#include -#include +#include +#include #define XTrapExtName "DEC-XTRAP" /* Current Release, Version, and Revision of the XTrap Extension */ #define XETrapRelease 3L diff --git a/nx-X11/include/extensions/xtrapemacros.h b/nx-X11/include/extensions/xtrapemacros.h index f59ea3391..f5dc2be31 100644 --- a/nx-X11/include/extensions/xtrapemacros.h +++ b/nx-X11/include/extensions/xtrapemacros.h @@ -43,7 +43,7 @@ SOFTWARE. * specified; however, use of Trap Context convenience * routines is strongly encouraged (XETrapContext.c) */ -#include +#include #include /* msleep macro to replace msleep() for portability reasons */ diff --git a/nx-X11/include/extensions/xtraplib.h b/nx-X11/include/extensions/xtraplib.h index f3f273aab..b733dac7f 100644 --- a/nx-X11/include/extensions/xtraplib.h +++ b/nx-X11/include/extensions/xtraplib.h @@ -47,10 +47,10 @@ SOFTWARE. #define NEED_EVENTS #define NEED_REPLIES #endif -#include -#include -#include -#include +#include +#include +#include +#include typedef struct /* Callback structure */ { diff --git a/nx-X11/include/keysym.h b/nx-X11/include/keysym.h index 785fed32e..cd518a792 100644 --- a/nx-X11/include/keysym.h +++ b/nx-X11/include/keysym.h @@ -71,5 +71,5 @@ SOFTWARE. #define XK_CURRENCY #define XK_MATHEMATICAL -#include +#include diff --git a/nx-X11/lib/X11/ClDisplay.c b/nx-X11/lib/X11/ClDisplay.c index b7a58751e..dfbc2f518 100644 --- a/nx-X11/lib/X11/ClDisplay.c +++ b/nx-X11/lib/X11/ClDisplay.c @@ -32,7 +32,7 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "Xlib.h" #include "Xlibint.h" #include "Xintconn.h" diff --git a/nx-X11/lib/X11/ConnDis.c b/nx-X11/lib/X11/ConnDis.c index 30146a9f1..177ff2c59 100644 --- a/nx-X11/lib/X11/ConnDis.c +++ b/nx-X11/lib/X11/ConnDis.c @@ -54,9 +54,9 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include #include #include #include @@ -68,7 +68,7 @@ in this Software without prior written authorization from The Open Group. #include #endif #else -#include +#include #endif #ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */ diff --git a/nx-X11/lib/X11/ErrDes.c b/nx-X11/lib/X11/ErrDes.c index 16183e85e..64373ffd0 100644 --- a/nx-X11/lib/X11/ErrDes.c +++ b/nx-X11/lib/X11/ErrDes.c @@ -55,7 +55,7 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "Xresource.h" #include diff --git a/nx-X11/lib/X11/FSWrap.c b/nx-X11/lib/X11/FSWrap.c index d40f3b035..77dd3b59c 100644 --- a/nx-X11/lib/X11/FSWrap.c +++ b/nx-X11/lib/X11/FSWrap.c @@ -64,7 +64,7 @@ from The Open Group. #include "Xlibint.h" #include "Xlcint.h" #include -#include +#include #define XMAXLIST 256 diff --git a/nx-X11/lib/X11/FetchName.c b/nx-X11/lib/X11/FetchName.c index 3d41472f3..216c7453d 100644 --- a/nx-X11/lib/X11/FetchName.c +++ b/nx-X11/lib/X11/FetchName.c @@ -28,9 +28,9 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include #include diff --git a/nx-X11/lib/X11/Font.c b/nx-X11/lib/X11/Font.c index 92a6a8f4a..8c8d1e443 100644 --- a/nx-X11/lib/X11/Font.c +++ b/nx-X11/lib/X11/Font.c @@ -47,7 +47,7 @@ authorization from the X Consortium and the XFree86 Project. #include #include -#include +#include #endif #include "Xlcint.h" diff --git a/nx-X11/lib/X11/GetDflt.c b/nx-X11/lib/X11/GetDflt.c index 8a8563379..a881f1c28 100644 --- a/nx-X11/lib/X11/GetDflt.c +++ b/nx-X11/lib/X11/GetDflt.c @@ -52,8 +52,8 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include -#include +#include +#include #ifndef X_NOT_POSIX #ifdef _POSIX_SOURCE @@ -80,12 +80,12 @@ SOFTWARE. #endif #ifdef XTHREADS -#include +#include #endif #ifndef WIN32 #define X_INCLUDE_PWD_H #define XOS_USE_XLIB_LOCKING -#include +#include #endif #include #include diff --git a/nx-X11/lib/X11/GetHints.c b/nx-X11/lib/X11/GetHints.c index 4faccb624..2c4d49d61 100644 --- a/nx-X11/lib/X11/GetHints.c +++ b/nx-X11/lib/X11/GetHints.c @@ -51,11 +51,11 @@ SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include #include "Xatomtype.h" -#include +#include #include Status XGetSizeHints (dpy, w, hints, property) diff --git a/nx-X11/lib/X11/GetImage.c b/nx-X11/lib/X11/GetImage.c index ffe9d226f..634910d79 100644 --- a/nx-X11/lib/X11/GetImage.c +++ b/nx-X11/lib/X11/GetImage.c @@ -31,7 +31,7 @@ in this Software without prior written authorization from The Open Group. #include #endif #include "Xlibint.h" -#include /* for XDestroyImage */ +#include /* for XDestroyImage */ #include "ImUtil.h" #define ROUNDUP(nbytes, pad) (((((nbytes) - 1) + (pad)) / (pad)) * (pad)) diff --git a/nx-X11/lib/X11/GetNrmHint.c b/nx-X11/lib/X11/GetNrmHint.c index 9dcb7c403..c770df43d 100644 --- a/nx-X11/lib/X11/GetNrmHint.c +++ b/nx-X11/lib/X11/GetNrmHint.c @@ -55,10 +55,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include +#include #include Status XGetWMSizeHints (dpy, w, hints, supplied, property) diff --git a/nx-X11/lib/X11/GetRGBCMap.c b/nx-X11/lib/X11/GetRGBCMap.c index 6657c539a..4df3ccced 100644 --- a/nx-X11/lib/X11/GetRGBCMap.c +++ b/nx-X11/lib/X11/GetRGBCMap.c @@ -31,10 +31,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include +#include Status XGetRGBColormaps (dpy, w, stdcmap, count, property) Display *dpy; diff --git a/nx-X11/lib/X11/GetStCmap.c b/nx-X11/lib/X11/GetStCmap.c index 5c8c37e78..ae085aa87 100644 --- a/nx-X11/lib/X11/GetStCmap.c +++ b/nx-X11/lib/X11/GetStCmap.c @@ -50,10 +50,10 @@ SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include +#include /* * WARNING diff --git a/nx-X11/lib/X11/GetTxtProp.c b/nx-X11/lib/X11/GetTxtProp.c index 0d4474253..dbff8abc8 100644 --- a/nx-X11/lib/X11/GetTxtProp.c +++ b/nx-X11/lib/X11/GetTxtProp.c @@ -52,10 +52,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include Status XGetTextProperty (display, window, tp, property) diff --git a/nx-X11/lib/X11/GetWMCMapW.c b/nx-X11/lib/X11/GetWMCMapW.c index 6d5c73c85..496efd208 100644 --- a/nx-X11/lib/X11/GetWMCMapW.c +++ b/nx-X11/lib/X11/GetWMCMapW.c @@ -51,7 +51,7 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include Status XGetWMColormapWindows (dpy, w, colormapWindows, countReturn) diff --git a/nx-X11/lib/X11/GetWMProto.c b/nx-X11/lib/X11/GetWMProto.c index 9b244ce6a..8584a4214 100644 --- a/nx-X11/lib/X11/GetWMProto.c +++ b/nx-X11/lib/X11/GetWMProto.c @@ -51,7 +51,7 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include Status XGetWMProtocols (dpy, w, protocols, countReturn) diff --git a/nx-X11/lib/X11/HVC.c b/nx-X11/lib/X11/HVC.c index 79241fb7a..84fac58b9 100644 --- a/nx-X11/lib/X11/HVC.c +++ b/nx-X11/lib/X11/HVC.c @@ -55,7 +55,7 @@ #endif #include "Xlibint.h" #include "Xcmsint.h" -#include +#include #include #include "Cv.h" diff --git a/nx-X11/lib/X11/Iconify.c b/nx-X11/lib/X11/Iconify.c index 62e57b84e..e68508666 100644 --- a/nx-X11/lib/X11/Iconify.c +++ b/nx-X11/lib/X11/Iconify.c @@ -54,10 +54,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include /* diff --git a/nx-X11/lib/X11/ImUtil.c b/nx-X11/lib/X11/ImUtil.c index 85f4183f4..2be839928 100644 --- a/nx-X11/lib/X11/ImUtil.c +++ b/nx-X11/lib/X11/ImUtil.c @@ -29,8 +29,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include #include "ImUtil.h" diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile index 212216f46..81a1cfd3d 100644 --- a/nx-X11/lib/X11/Imakefile +++ b/nx-X11/lib/X11/Imakefile @@ -85,7 +85,7 @@ NX_XCOMPEXTCONFIGTARGET = $(NX_XCOMPEXTLIBDIR)/config.status #define LibName NX_X11 #define SoRev SOXLIBREV #define HugeLibrary YES -#define IncSubdir X11 +#define IncSubdir nx-X11 #if BuildLoadableXlibI18n SUBDIRS = xlibi18n diff --git a/nx-X11/lib/X11/InitExt.c b/nx-X11/lib/X11/InitExt.c index 67c865787..5aab682c7 100644 --- a/nx-X11/lib/X11/InitExt.c +++ b/nx-X11/lib/X11/InitExt.c @@ -31,8 +31,8 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include /* diff --git a/nx-X11/lib/X11/KeyBind.c b/nx-X11/lib/X11/KeyBind.c index fab9eeacd..d99cfdf2f 100644 --- a/nx-X11/lib/X11/KeyBind.c +++ b/nx-X11/lib/X11/KeyBind.c @@ -32,8 +32,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #define XK_MISCELLANY #define XK_LATIN1 #define XK_LATIN2 @@ -47,7 +47,7 @@ in this Software without prior written authorization from The Open Group. #define XK_CAUCASUS #define XK_VIETNAMESE #define XK_XKB_KEYS -#include +#include #include #ifdef USE_OWN_COMPOSE diff --git a/nx-X11/lib/X11/KeysymStr.c b/nx-X11/lib/X11/KeysymStr.c index 59aa3f32c..b43e2735a 100644 --- a/nx-X11/lib/X11/KeysymStr.c +++ b/nx-X11/lib/X11/KeysymStr.c @@ -31,8 +31,8 @@ in this Software without prior written authorization from The Open Group. #include #endif #include "Xlibint.h" -#include -#include +#include +#include #include /* sprintf */ diff --git a/nx-X11/lib/X11/LRGB.c b/nx-X11/lib/X11/LRGB.c index e4bc0b500..392c59579 100644 --- a/nx-X11/lib/X11/LRGB.c +++ b/nx-X11/lib/X11/LRGB.c @@ -41,8 +41,8 @@ #include #endif #include -#include -#include +#include +#include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" diff --git a/nx-X11/lib/X11/Lab.c b/nx-X11/lib/X11/Lab.c index 596c137f8..19b3e3a1d 100644 --- a/nx-X11/lib/X11/Lab.c +++ b/nx-X11/lib/X11/Lab.c @@ -42,7 +42,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include /* sscanf */ #include "Xlibint.h" #include "Xcmsint.h" diff --git a/nx-X11/lib/X11/Luv.c b/nx-X11/lib/X11/Luv.c index ec94c9e56..206ae1017 100644 --- a/nx-X11/lib/X11/Luv.c +++ b/nx-X11/lib/X11/Luv.c @@ -43,7 +43,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" diff --git a/nx-X11/lib/X11/OpenDis.c b/nx-X11/lib/X11/OpenDis.c index e9d019723..67f7ccbd1 100644 --- a/nx-X11/lib/X11/OpenDis.c +++ b/nx-X11/lib/X11/OpenDis.c @@ -50,10 +50,10 @@ in this Software without prior written authorization from The Open Group. #include #endif #include "Xlibint.h" -#include -#include -#include -#include +#include +#include +#include +#include #include #include "Xintconn.h" diff --git a/nx-X11/lib/X11/ParseCmd.c b/nx-X11/lib/X11/ParseCmd.c index ddcbf7846..fe20f6eff 100644 --- a/nx-X11/lib/X11/ParseCmd.c +++ b/nx-X11/lib/X11/ParseCmd.c @@ -61,7 +61,7 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include diff --git a/nx-X11/lib/X11/PolyReg.c b/nx-X11/lib/X11/PolyReg.c index 4b17ec5c5..6e1f7ead8 100644 --- a/nx-X11/lib/X11/PolyReg.c +++ b/nx-X11/lib/X11/PolyReg.c @@ -55,7 +55,7 @@ SOFTWARE. #endif #include "Xlibint.h" #include "Xutil.h" -#include +#include #include "poly.h" /* diff --git a/nx-X11/lib/X11/Quarks.c b/nx-X11/lib/X11/Quarks.c index d47bce314..a49562aac 100644 --- a/nx-X11/lib/X11/Quarks.c +++ b/nx-X11/lib/X11/Quarks.c @@ -55,7 +55,7 @@ from The Open Group. #include #endif #include "Xlibint.h" -#include +#include #include "Xresinternal.h" /* Not cost effective, at least for vanilla MIT clients */ diff --git a/nx-X11/lib/X11/RdBitF.c b/nx-X11/lib/X11/RdBitF.c index 198e0e4a5..97afcc493 100644 --- a/nx-X11/lib/X11/RdBitF.c +++ b/nx-X11/lib/X11/RdBitF.c @@ -47,7 +47,7 @@ from The Open Group. #include #endif #include "Xlibint.h" -#include +#include #include "Xutil.h" #include #include diff --git a/nx-X11/lib/X11/Region.c b/nx-X11/lib/X11/Region.c index cdd223b25..bef46def0 100644 --- a/nx-X11/lib/X11/Region.c +++ b/nx-X11/lib/X11/Region.c @@ -77,7 +77,7 @@ SOFTWARE. #endif #include "Xlibint.h" #include "Xutil.h" -#include +#include #include "poly.h" #ifdef DEBUG diff --git a/nx-X11/lib/X11/ScrResStr.c b/nx-X11/lib/X11/ScrResStr.c index 89f771784..7feb3b388 100644 --- a/nx-X11/lib/X11/ScrResStr.c +++ b/nx-X11/lib/X11/ScrResStr.c @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #include #endif #include "Xlibint.h" -#include +#include char *XScreenResourceString(screen) Screen *screen; diff --git a/nx-X11/lib/X11/SetHints.c b/nx-X11/lib/X11/SetHints.c index 5ee34435d..27b1bedbc 100644 --- a/nx-X11/lib/X11/SetHints.c +++ b/nx-X11/lib/X11/SetHints.c @@ -51,11 +51,11 @@ SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include -#include +#include +#include #define safestrlen(s) ((s) ? strlen(s) : 0) diff --git a/nx-X11/lib/X11/SetLocale.c b/nx-X11/lib/X11/SetLocale.c index bb4f850e3..875718dca 100644 --- a/nx-X11/lib/X11/SetLocale.c +++ b/nx-X11/lib/X11/SetLocale.c @@ -63,8 +63,8 @@ from The Open Group. #endif #include "Xlibint.h" #include "Xlcint.h" -#include -#include +#include +#include #include "XlcPubI.h" #define MAXLOCALE 64 /* buffer size of locale name */ diff --git a/nx-X11/lib/X11/SetNrmHint.c b/nx-X11/lib/X11/SetNrmHint.c index 64b0ef7f3..e8e6daf31 100644 --- a/nx-X11/lib/X11/SetNrmHint.c +++ b/nx-X11/lib/X11/SetNrmHint.c @@ -54,11 +54,11 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include -#include +#include +#include void XSetWMSizeHints (dpy, w, hints, prop) Display *dpy; diff --git a/nx-X11/lib/X11/SetRGBCMap.c b/nx-X11/lib/X11/SetRGBCMap.c index 4be840b75..03aa9392c 100644 --- a/nx-X11/lib/X11/SetRGBCMap.c +++ b/nx-X11/lib/X11/SetRGBCMap.c @@ -31,10 +31,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include +#include void XSetRGBColormaps (dpy, w, cmaps, count, property) Display *dpy; diff --git a/nx-X11/lib/X11/SetStCmap.c b/nx-X11/lib/X11/SetStCmap.c index b5a93e36e..521b9480d 100644 --- a/nx-X11/lib/X11/SetStCmap.c +++ b/nx-X11/lib/X11/SetStCmap.c @@ -50,10 +50,10 @@ SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xatomtype.h" -#include +#include /* * WARNING diff --git a/nx-X11/lib/X11/SetTxtProp.c b/nx-X11/lib/X11/SetTxtProp.c index a82d9b3e3..ae8b81e29 100644 --- a/nx-X11/lib/X11/SetTxtProp.c +++ b/nx-X11/lib/X11/SetTxtProp.c @@ -52,10 +52,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include void XSetTextProperty (dpy, w, tp, property) diff --git a/nx-X11/lib/X11/SetWMCMapW.c b/nx-X11/lib/X11/SetWMCMapW.c index dd88061da..6774d7326 100644 --- a/nx-X11/lib/X11/SetWMCMapW.c +++ b/nx-X11/lib/X11/SetWMCMapW.c @@ -51,7 +51,7 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include /* * XSetWMProtocols sets the property diff --git a/nx-X11/lib/X11/SetWMProto.c b/nx-X11/lib/X11/SetWMProto.c index 8640e5060..bc7dcf63c 100644 --- a/nx-X11/lib/X11/SetWMProto.c +++ b/nx-X11/lib/X11/SetWMProto.c @@ -51,7 +51,7 @@ SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include /* * XSetWMProtocols sets the property diff --git a/nx-X11/lib/X11/StBytes.c b/nx-X11/lib/X11/StBytes.c index b23902581..676652678 100644 --- a/nx-X11/lib/X11/StBytes.c +++ b/nx-X11/lib/X11/StBytes.c @@ -29,8 +29,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include /* insulate predefined atom numbers from cut routines */ static Atom n_to_atom[8] = { diff --git a/nx-X11/lib/X11/StName.c b/nx-X11/lib/X11/StName.c index ba01ffb0c..d3053346c 100644 --- a/nx-X11/lib/X11/StName.c +++ b/nx-X11/lib/X11/StName.c @@ -29,8 +29,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include int XStoreName ( diff --git a/nx-X11/lib/X11/StrKeysym.c b/nx-X11/lib/X11/StrKeysym.c index 74ccecbcd..fc1e7a34d 100644 --- a/nx-X11/lib/X11/StrKeysym.c +++ b/nx-X11/lib/X11/StrKeysym.c @@ -30,8 +30,8 @@ in this Software without prior written authorization from The Open Group. #include #endif #include "Xlibint.h" -#include -#include +#include +#include #include "Xresinternal.h" #define NEEDKTABLE diff --git a/nx-X11/lib/X11/StrToText.c b/nx-X11/lib/X11/StrToText.c index ba894e16f..5fd9c6ec6 100644 --- a/nx-X11/lib/X11/StrToText.c +++ b/nx-X11/lib/X11/StrToText.c @@ -28,9 +28,9 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include /* * XStringListToTextProperty - fill in TextProperty structure with diff --git a/nx-X11/lib/X11/TextToStr.c b/nx-X11/lib/X11/TextToStr.c index 0bea8096d..f4c00adcf 100644 --- a/nx-X11/lib/X11/TextToStr.c +++ b/nx-X11/lib/X11/TextToStr.c @@ -30,9 +30,9 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include /* diff --git a/nx-X11/lib/X11/WMProps.c b/nx-X11/lib/X11/WMProps.c index 62c6a8d12..7a390a9d7 100644 --- a/nx-X11/lib/X11/WMProps.c +++ b/nx-X11/lib/X11/WMProps.c @@ -55,11 +55,11 @@ SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include /* diff --git a/nx-X11/lib/X11/Withdraw.c b/nx-X11/lib/X11/Withdraw.c index 1b771c286..2037b8e46 100644 --- a/nx-X11/lib/X11/Withdraw.c +++ b/nx-X11/lib/X11/Withdraw.c @@ -54,10 +54,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include /* diff --git a/nx-X11/lib/X11/WrBitF.c b/nx-X11/lib/X11/WrBitF.c index d8c9f18fa..d48295f0b 100644 --- a/nx-X11/lib/X11/WrBitF.c +++ b/nx-X11/lib/X11/WrBitF.c @@ -32,7 +32,7 @@ from The Open Group. #include #endif #include "Xlibint.h" -#include +#include #include "Xutil.h" #include diff --git a/nx-X11/lib/X11/XDefaultOMIF.c b/nx-X11/lib/X11/XDefaultOMIF.c index 13f0d9cff..b4e63091b 100644 --- a/nx-X11/lib/X11/XDefaultOMIF.c +++ b/nx-X11/lib/X11/XDefaultOMIF.c @@ -49,8 +49,8 @@ Sun Microsystems, Inc. or its licensors is granted. #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" -#include -#include +#include +#include #include #define MAXFONTS 100 diff --git a/nx-X11/lib/X11/XKB.c b/nx-X11/lib/X11/XKB.c index ecc5ddf0a..413a51eb6 100644 --- a/nx-X11/lib/X11/XKB.c +++ b/nx-X11/lib/X11/XKB.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" XkbInternAtomFunc _XkbInternAtomFunc= XInternAtom; diff --git a/nx-X11/lib/X11/XKBAlloc.c b/nx-X11/lib/X11/XKBAlloc.c index 9430ac0ed..131985444 100644 --- a/nx-X11/lib/X11/XKBAlloc.c +++ b/nx-X11/lib/X11/XKBAlloc.c @@ -39,21 +39,21 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_EVENTS #include "Xlibint.h" #include "XKBlibint.h" -#include -#include +#include +#include #include "XKBlibint.h" #else #include -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "inputstr.h" -#include -#include +#include +#include #endif /* XKB_IN_SERVER */ diff --git a/nx-X11/lib/X11/XKBBell.c b/nx-X11/lib/X11/XKBBell.c index 6ea30855e..51869097e 100644 --- a/nx-X11/lib/X11/XKBBell.c +++ b/nx-X11/lib/X11/XKBBell.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" diff --git a/nx-X11/lib/X11/XKBBind.c b/nx-X11/lib/X11/XKBBind.c index e190d0052..6c1864d41 100644 --- a/nx-X11/lib/X11/XKBBind.c +++ b/nx-X11/lib/X11/XKBBind.c @@ -35,13 +35,13 @@ from The Open Group. #include #endif #include "XKBlib.h" -#include -#include -#include +#include +#include +#include #include #include -#include +#include #include "XKBlibint.h" #ifdef USE_OWN_COMPOSE diff --git a/nx-X11/lib/X11/XKBCompat.c b/nx-X11/lib/X11/XKBCompat.c index 5886e4d26..b16e6b083 100644 --- a/nx-X11/lib/X11/XKBCompat.c +++ b/nx-X11/lib/X11/XKBCompat.c @@ -34,7 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_EVENTS #define NEED_MAP_READERS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" Status diff --git a/nx-X11/lib/X11/XKBCtrls.c b/nx-X11/lib/X11/XKBCtrls.c index 0ea131aa0..f3a09a124 100644 --- a/nx-X11/lib/X11/XKBCtrls.c +++ b/nx-X11/lib/X11/XKBCtrls.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" diff --git a/nx-X11/lib/X11/XKBCvt.c b/nx-X11/lib/X11/XKBCvt.c index 1bdf81cd4..2d58ca990 100644 --- a/nx-X11/lib/X11/XKBCvt.c +++ b/nx-X11/lib/X11/XKBCvt.c @@ -35,23 +35,23 @@ from The Open Group. #include #include -#include -#include +#include +#include #define NEED_EVENTS #include "Xlibint.h" #include "Xlcint.h" #include "XlcPubI.h" #include "Ximint.h" -#include -#include +#include +#include #define XK_LATIN1 #define XK_PUBLISHING -#include -#include +#include +#include #include "XKBlibint.h" -#include +#include #include -#include +#include #ifdef __sgi_not_xconsortium #define XKB_EXTEND_LOOKUP_STRING diff --git a/nx-X11/lib/X11/XKBExtDev.c b/nx-X11/lib/X11/XKBExtDev.c index 34558e476..0510b7f55 100644 --- a/nx-X11/lib/X11/XKBExtDev.c +++ b/nx-X11/lib/X11/XKBExtDev.c @@ -34,9 +34,9 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_EVENTS #define NEED_MAP_READERS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" -#include +#include /***====================================================================***/ diff --git a/nx-X11/lib/X11/XKBGAlloc.c b/nx-X11/lib/X11/XKBGAlloc.c index fddb770b6..eb74cbfd0 100644 --- a/nx-X11/lib/X11/XKBGAlloc.c +++ b/nx-X11/lib/X11/XKBGAlloc.c @@ -40,18 +40,18 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include "Xlibint.h" #include "XKBlibint.h" -#include -#include +#include +#include #else #include -#include -#include +#include +#include #include "misc.h" #include "inputstr.h" -#include -#include +#include +#include #endif /* XKB_IN_SERVER */ diff --git a/nx-X11/lib/X11/XKBGeom.c b/nx-X11/lib/X11/XKBGeom.c index 061175489..d225342a7 100644 --- a/nx-X11/lib/X11/XKBGeom.c +++ b/nx-X11/lib/X11/XKBGeom.c @@ -37,8 +37,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_MAP_READERS #include "Xlibint.h" -#include -#include +#include +#include #include "XKBlibint.h" #ifndef MINSHORT diff --git a/nx-X11/lib/X11/XKBGetByName.c b/nx-X11/lib/X11/XKBGetByName.c index 2c6ff0849..87f405e50 100644 --- a/nx-X11/lib/X11/XKBGetByName.c +++ b/nx-X11/lib/X11/XKBGetByName.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "XKBlibint.h" /***====================================================================***/ diff --git a/nx-X11/lib/X11/XKBGetMap.c b/nx-X11/lib/X11/XKBGetMap.c index 2b9fb97f4..5f37f9571 100644 --- a/nx-X11/lib/X11/XKBGetMap.c +++ b/nx-X11/lib/X11/XKBGetMap.c @@ -34,7 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "XKBlibint.h" static Status diff --git a/nx-X11/lib/X11/XKBList.c b/nx-X11/lib/X11/XKBList.c index 2f4a53490..ef265fdde 100644 --- a/nx-X11/lib/X11/XKBList.c +++ b/nx-X11/lib/X11/XKBList.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "XKBlibint.h" /***====================================================================***/ diff --git a/nx-X11/lib/X11/XKBMAlloc.c b/nx-X11/lib/X11/XKBMAlloc.c index d57d9a58d..31255091f 100644 --- a/nx-X11/lib/X11/XKBMAlloc.c +++ b/nx-X11/lib/X11/XKBMAlloc.c @@ -38,22 +38,22 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include -#include +#include +#include #include "XKBlibint.h" #else #include -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "inputstr.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS -#include +#include #endif /* XKB_IN_SERVER */ diff --git a/nx-X11/lib/X11/XKBMisc.c b/nx-X11/lib/X11/XKBMisc.c index 09f361c19..04ac0c7ea 100644 --- a/nx-X11/lib/X11/XKBMisc.c +++ b/nx-X11/lib/X11/XKBMisc.c @@ -38,22 +38,22 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include -#include +#include +#include #include "XKBlibint.h" #else #include -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "inputstr.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS -#include +#include #endif /* XKB_IN_SERVER */ diff --git a/nx-X11/lib/X11/XKBNames.c b/nx-X11/lib/X11/XKBNames.c index 8483187c3..0bcd42b3d 100644 --- a/nx-X11/lib/X11/XKBNames.c +++ b/nx-X11/lib/X11/XKBNames.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "XKBlibint.h" diff --git a/nx-X11/lib/X11/XKBRdBuf.c b/nx-X11/lib/X11/XKBRdBuf.c index d0b7045d6..109618dd2 100644 --- a/nx-X11/lib/X11/XKBRdBuf.c +++ b/nx-X11/lib/X11/XKBRdBuf.c @@ -34,7 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_EVENTS #include "Xlibint.h" #include "XKBlibint.h" -#include +#include /***====================================================================***/ diff --git a/nx-X11/lib/X11/XKBSetGeom.c b/nx-X11/lib/X11/XKBSetGeom.c index e27297c11..f13be8097 100644 --- a/nx-X11/lib/X11/XKBSetGeom.c +++ b/nx-X11/lib/X11/XKBSetGeom.c @@ -38,8 +38,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #include "Xlibint.h" #include "XKBlibint.h" -#include -#include +#include +#include #ifndef MINSHORT #define MINSHORT -32768 diff --git a/nx-X11/lib/X11/XKBSetMap.c b/nx-X11/lib/X11/XKBSetMap.c index 4a3b15c70..784a241c2 100644 --- a/nx-X11/lib/X11/XKBSetMap.c +++ b/nx-X11/lib/X11/XKBSetMap.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" static int diff --git a/nx-X11/lib/X11/XKBUse.c b/nx-X11/lib/X11/XKBUse.c index ad18bb6fc..95fba49ac 100644 --- a/nx-X11/lib/X11/XKBUse.c +++ b/nx-X11/lib/X11/XKBUse.c @@ -34,7 +34,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS #include "Xlibint.h" -#include +#include #include "XKBlibint.h" static Bool _XkbIgnoreExtension = False; diff --git a/nx-X11/lib/X11/XKBleds.c b/nx-X11/lib/X11/XKBleds.c index 89ab2e9ec..d026d84be 100644 --- a/nx-X11/lib/X11/XKBleds.c +++ b/nx-X11/lib/X11/XKBleds.c @@ -33,7 +33,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "XKBlibint.h" Status diff --git a/nx-X11/lib/X11/XKBlib.h b/nx-X11/lib/X11/XKBlib.h index 6a5dc8a7c..a1ad7ccea 100644 --- a/nx-X11/lib/X11/XKBlib.h +++ b/nx-X11/lib/X11/XKBlib.h @@ -29,8 +29,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBLIB_H_ #define _XKBLIB_H_ -#include -#include +#include +#include typedef struct _XkbAnyEvent { int type; /* XkbAnyEvent */ diff --git a/nx-X11/lib/X11/XKBlibint.h b/nx-X11/lib/X11/XKBlibint.h index 0244e2ef3..9c6352769 100644 --- a/nx-X11/lib/X11/XKBlibint.h +++ b/nx-X11/lib/X11/XKBlibint.h @@ -29,8 +29,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef _XKBLIBINT_H_ #define _XKBLIBINT_H_ -#include -#include +#include +#include #define XkbMapPending (1<<0) #define XkbXlibNewKeyboard (1<<1) diff --git a/nx-X11/lib/X11/XYZ.c b/nx-X11/lib/X11/XYZ.c index f5f17f356..5408c4fbc 100644 --- a/nx-X11/lib/X11/XYZ.c +++ b/nx-X11/lib/X11/XYZ.c @@ -38,7 +38,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" diff --git a/nx-X11/lib/X11/Xcms.h b/nx-X11/lib/X11/Xcms.h index 779bc52ff..8ce81556d 100644 --- a/nx-X11/lib/X11/Xcms.h +++ b/nx-X11/lib/X11/Xcms.h @@ -31,7 +31,7 @@ #ifndef _XCMS_H_ #define _XCMS_H_ -#include +#include /* * XCMS Status Values diff --git a/nx-X11/lib/X11/Xcmsint.h b/nx-X11/lib/X11/Xcmsint.h index 1bf02ba2f..6bb44bbcf 100644 --- a/nx-X11/lib/X11/Xcmsint.h +++ b/nx-X11/lib/X11/Xcmsint.h @@ -34,7 +34,7 @@ #ifndef _XCMSINT_H_ #define _XCMSINT_H_ -#include +#include /* * DEFINES diff --git a/nx-X11/lib/X11/XimThai.h b/nx-X11/lib/X11/XimThai.h index 5b2666ebf..8d08eca6b 100644 --- a/nx-X11/lib/X11/XimThai.h +++ b/nx-X11/lib/X11/XimThai.h @@ -64,7 +64,7 @@ SOFTWARE. #ifndef _XIMTHAI_H_ #define _XIMTHAI_H_ -#include +#include /* Classification of characters in TIS620 according to WTT */ diff --git a/nx-X11/lib/X11/Ximint.h b/nx-X11/lib/X11/Ximint.h index e9bdda247..afd821c68 100644 --- a/nx-X11/lib/X11/Ximint.h +++ b/nx-X11/lib/X11/Ximint.h @@ -36,7 +36,7 @@ PERFORMANCE OF THIS SOFTWARE. #define _XIMINT_H #include -#include +#include #define Public /**/ #define Private static diff --git a/nx-X11/lib/X11/Xintatom.h b/nx-X11/lib/X11/Xintatom.h index f1e13568b..756d3445b 100644 --- a/nx-X11/lib/X11/Xintatom.h +++ b/nx-X11/lib/X11/Xintatom.h @@ -3,7 +3,7 @@ #ifndef _XINTATOM_H_ #define _XINTATOM_H_ 1 -#include +#include /* IntAtom.c */ diff --git a/nx-X11/lib/X11/Xintconn.h b/nx-X11/lib/X11/Xintconn.h index edea98302..ea272833a 100644 --- a/nx-X11/lib/X11/Xintconn.h +++ b/nx-X11/lib/X11/Xintconn.h @@ -3,7 +3,7 @@ #ifndef _XINTCONN_H_ #define _XINTCONN_H_ 1 -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/lib/X11/Xlcint.h b/nx-X11/lib/X11/Xlcint.h index fcc3a65f2..5a52cd36c 100644 --- a/nx-X11/lib/X11/Xlcint.h +++ b/nx-X11/lib/X11/Xlcint.h @@ -74,8 +74,8 @@ from The Open Group. #ifndef _XP_PRINT_SERVER_ -#include -#include +#include +#include #include typedef Bool (*XFilterEventProc)( diff --git a/nx-X11/lib/X11/Xlib.h b/nx-X11/lib/X11/Xlib.h index 8ce7fb577..d4cecc7b5 100644 --- a/nx-X11/lib/X11/Xlib.h +++ b/nx-X11/lib/X11/Xlib.h @@ -57,11 +57,11 @@ in this Software without prior written authorization from The Open Group. #include #endif -#include +#include /* applications should not depend on these two headers being included! */ -#include -#include +#include +#include #ifndef X_WCHAR #ifdef X_NOT_STDC_ENV diff --git a/nx-X11/lib/X11/XlibAsync.c b/nx-X11/lib/X11/XlibAsync.c index 81403ebc9..832371782 100644 --- a/nx-X11/lib/X11/XlibAsync.c +++ b/nx-X11/lib/X11/XlibAsync.c @@ -48,8 +48,8 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include /*ARGSUSED*/ Bool diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c index 0514470dd..0aa890bbb 100644 --- a/nx-X11/lib/X11/XlibInt.c +++ b/nx-X11/lib/X11/XlibInt.c @@ -60,9 +60,9 @@ from The Open Group. #include #endif #include "Xlibint.h" -#include -#include -#include +#include +#include +#include #include #ifdef WIN32 #include diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h index bcd42b52b..854b64b22 100644 --- a/nx-X11/lib/X11/Xlibint.h +++ b/nx-X11/lib/X11/Xlibint.h @@ -58,9 +58,9 @@ from The Open Group. * Warning, there be dragons here.... */ -#include -#include /* to declare xEvent */ -#include /* for configured options like XTHREADS */ +#include +#include /* to declare xEvent */ +#include /* for configured options like XTHREADS */ #ifdef NX_TRANS_SOCKET @@ -233,14 +233,14 @@ typedef struct _XSQEvent #define NEED_EVENTS #define NEED_REPLIES -#include +#include #ifdef __sgi #define _SGI_MP_SOURCE /* turn this on to get MP safe errno */ #endif #include #define _XBCOPYFUNC _Xbcopy -#include -#include +#include +#include /* Utek leaves kernel macros around in include files (bleah) */ #ifdef dirty @@ -250,7 +250,7 @@ typedef struct _XSQEvent #include #include -#include +#include _XFUNCPROTOBEGIN diff --git a/nx-X11/lib/X11/Xlocale.h b/nx-X11/lib/X11/Xlocale.h index 61d2f7a84..4370d969e 100644 --- a/nx-X11/lib/X11/Xlocale.h +++ b/nx-X11/lib/X11/Xlocale.h @@ -31,8 +31,8 @@ from The Open Group. #ifndef _XLOCALE_H_ #define _XLOCALE_H_ -#include -#include +#include +#include #ifndef X_LOCALE #include diff --git a/nx-X11/lib/X11/Xresource.h b/nx-X11/lib/X11/Xresource.h index ce1213748..e46a5f467 100644 --- a/nx-X11/lib/X11/Xresource.h +++ b/nx-X11/lib/X11/Xresource.h @@ -52,7 +52,7 @@ SOFTWARE. #define _XRESOURCE_H_ #ifndef _XP_PRINT_SERVER_ -#include +#include #endif /**************************************************************** diff --git a/nx-X11/lib/X11/Xrm.c b/nx-X11/lib/X11/Xrm.c index a932a5ce2..f27f9d2e8 100644 --- a/nx-X11/lib/X11/Xrm.c +++ b/nx-X11/lib/X11/Xrm.c @@ -57,13 +57,13 @@ from The Open Group. #include #include #include "Xlibint.h" -#include +#include #include "Xlcint.h" #ifdef XTHREADS #include "locking.h" #endif #include "XrmI.h" -#include +#include #include "Xresinternal.h" #include "Xresource.h" diff --git a/nx-X11/lib/X11/Xutil.h b/nx-X11/lib/X11/Xutil.h index 82dab7d56..8c877e697 100644 --- a/nx-X11/lib/X11/Xutil.h +++ b/nx-X11/lib/X11/Xutil.h @@ -52,7 +52,7 @@ SOFTWARE. #define _XUTIL_H_ /* You must include before including this file */ -#include +#include /* * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding diff --git a/nx-X11/lib/X11/cmsColNm.c b/nx-X11/lib/X11/cmsColNm.c index d8c24cdff..63f166efe 100644 --- a/nx-X11/lib/X11/cmsColNm.c +++ b/nx-X11/lib/X11/cmsColNm.c @@ -39,12 +39,12 @@ #endif #include "Xlibint.h" #include "Xcmsint.h" -#include +#include #include #include #include #define XK_LATIN1 -#include +#include #include "Cv.h" /* forwards/locals */ diff --git a/nx-X11/lib/X11/cmsProp.c b/nx-X11/lib/X11/cmsProp.c index 81ea58ce9..e9158479e 100644 --- a/nx-X11/lib/X11/cmsProp.c +++ b/nx-X11/lib/X11/cmsProp.c @@ -36,7 +36,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" diff --git a/nx-X11/lib/X11/evtomask.c b/nx-X11/lib/X11/evtomask.c index fbbb998d3..c852c4608 100644 --- a/nx-X11/lib/X11/evtomask.c +++ b/nx-X11/lib/X11/evtomask.c @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include /* * This array can be used given an event type to determine the mask bits diff --git a/nx-X11/lib/X11/globals.c b/nx-X11/lib/X11/globals.c index 11965cb5f..cf270dc22 100644 --- a/nx-X11/lib/X11/globals.c +++ b/nx-X11/lib/X11/globals.c @@ -38,7 +38,7 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include /* diff --git a/nx-X11/lib/X11/imDefFlt.c b/nx-X11/lib/X11/imDefFlt.c index ccf3ba348..b5b107221 100644 --- a/nx-X11/lib/X11/imDefFlt.c +++ b/nx-X11/lib/X11/imDefFlt.c @@ -31,7 +31,7 @@ PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #define NEED_EVENTS #include "Xlibint.h" #include "Xutil.h" diff --git a/nx-X11/lib/X11/imDefIm.c b/nx-X11/lib/X11/imDefIm.c index 7581548e7..e963f3560 100644 --- a/nx-X11/lib/X11/imDefIm.c +++ b/nx-X11/lib/X11/imDefIm.c @@ -36,7 +36,7 @@ OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #define NEED_EVENTS #include "Xlibint.h" #include "Xlcint.h" diff --git a/nx-X11/lib/X11/imDefLkup.c b/nx-X11/lib/X11/imDefLkup.c index aa1aaaf06..5bdcb77c3 100644 --- a/nx-X11/lib/X11/imDefLkup.c +++ b/nx-X11/lib/X11/imDefLkup.c @@ -31,7 +31,7 @@ PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #define NEED_EVENTS #include "Xlibint.h" #include "Xlcint.h" diff --git a/nx-X11/lib/X11/imDispch.c b/nx-X11/lib/X11/imDispch.c index c0c4bc726..1e3287529 100644 --- a/nx-X11/lib/X11/imDispch.c +++ b/nx-X11/lib/X11/imDispch.c @@ -31,7 +31,7 @@ PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "Xlibint.h" #include "Xutil.h" #include "Xlcint.h" diff --git a/nx-X11/lib/X11/imEvToWire.c b/nx-X11/lib/X11/imEvToWire.c index f407296df..211252a50 100644 --- a/nx-X11/lib/X11/imEvToWire.c +++ b/nx-X11/lib/X11/imEvToWire.c @@ -27,8 +27,8 @@ SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #undef NEED_EVENTS #include "Ximint.h" diff --git a/nx-X11/lib/X11/imExten.c b/nx-X11/lib/X11/imExten.c index 782d1c356..6cb663f66 100644 --- a/nx-X11/lib/X11/imExten.c +++ b/nx-X11/lib/X11/imExten.c @@ -31,7 +31,7 @@ PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #define NEED_EVENTS #include "Xlibint.h" #include "Xlcint.h" diff --git a/nx-X11/lib/X11/imInt.c b/nx-X11/lib/X11/imInt.c index 5a047e4aa..9658eef58 100644 --- a/nx-X11/lib/X11/imInt.c +++ b/nx-X11/lib/X11/imInt.c @@ -31,9 +31,9 @@ PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imLcFlt.c b/nx-X11/lib/X11/imLcFlt.c index c3c64bf46..7ff642fae 100644 --- a/nx-X11/lib/X11/imLcFlt.c +++ b/nx-X11/lib/X11/imLcFlt.c @@ -35,7 +35,7 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif #include "Xlibint.h" -#include +#include #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imLcIc.c b/nx-X11/lib/X11/imLcIc.c index 760e24c5f..475bbbef8 100644 --- a/nx-X11/lib/X11/imLcIc.c +++ b/nx-X11/lib/X11/imLcIc.c @@ -32,8 +32,8 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif #include -#include -#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imLcIm.c b/nx-X11/lib/X11/imLcIm.c index 675b48224..0a9027e6f 100644 --- a/nx-X11/lib/X11/imLcIm.c +++ b/nx-X11/lib/X11/imLcIm.c @@ -39,11 +39,11 @@ THIS SOFTWARE. #endif #include /* -#include +#include */ -#include -#include -#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" diff --git a/nx-X11/lib/X11/imLcLkup.c b/nx-X11/lib/X11/imLcLkup.c index 59025a529..b1db9f8f7 100644 --- a/nx-X11/lib/X11/imLcLkup.c +++ b/nx-X11/lib/X11/imLcLkup.c @@ -35,11 +35,11 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imLcPrs.c b/nx-X11/lib/X11/imLcPrs.c index 9736e135c..616d45186 100644 --- a/nx-X11/lib/X11/imLcPrs.c +++ b/nx-X11/lib/X11/imLcPrs.c @@ -35,9 +35,9 @@ OR PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imLcSIc.c b/nx-X11/lib/X11/imLcSIc.c index a32211ce2..e36c52269 100644 --- a/nx-X11/lib/X11/imLcSIc.c +++ b/nx-X11/lib/X11/imLcSIc.c @@ -31,9 +31,9 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif #include -#include -#include -#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imRm.c b/nx-X11/lib/X11/imRm.c index 7dbc385cb..1da1b2967 100644 --- a/nx-X11/lib/X11/imRm.c +++ b/nx-X11/lib/X11/imRm.c @@ -36,7 +36,7 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif #include -#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imThaiFlt.c b/nx-X11/lib/X11/imThaiFlt.c index 18df0e1ff..41ab992b0 100644 --- a/nx-X11/lib/X11/imThaiFlt.c +++ b/nx-X11/lib/X11/imThaiFlt.c @@ -68,10 +68,10 @@ SOFTWARE. #include #endif #include -#include -#include -#include -#include +#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imThaiIc.c b/nx-X11/lib/X11/imThaiIc.c index 67d7cc268..97a72ac81 100644 --- a/nx-X11/lib/X11/imThaiIc.c +++ b/nx-X11/lib/X11/imThaiIc.c @@ -38,8 +38,8 @@ THIS SOFTWARE. #include #endif #include -#include -#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "Ximint.h" diff --git a/nx-X11/lib/X11/imThaiIm.c b/nx-X11/lib/X11/imThaiIm.c index e24715022..85e9df6d3 100644 --- a/nx-X11/lib/X11/imThaiIm.c +++ b/nx-X11/lib/X11/imThaiIm.c @@ -38,10 +38,10 @@ THIS SOFTWARE. #include #endif #include -#include -#include -#include -#include +#include +#include +#include +#include #include "Xlibint.h" #include "Xlcint.h" #include "XlcPublic.h" diff --git a/nx-X11/lib/X11/imTrX.c b/nx-X11/lib/X11/imTrX.c index e2de05f28..7d00bb3f7 100644 --- a/nx-X11/lib/X11/imTrX.c +++ b/nx-X11/lib/X11/imTrX.c @@ -34,7 +34,7 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include -#include +#include #define NEED_EVENTS #include "Xlibint.h" #include "Xlcint.h" diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c index a239219b7..e9715927b 100644 --- a/nx-X11/lib/X11/imTrans.c +++ b/nx-X11/lib/X11/imTrans.c @@ -34,18 +34,18 @@ IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #include -#include -#include +#include +#include #define NEED_EVENTS #include "Xlibint.h" -#include +#include #include "Xlcint.h" #include "Ximint.h" #include "XimTrans.h" #include "XimTrInt.h" #ifdef WIN32 -#include +#include #endif diff --git a/nx-X11/lib/X11/lcCT.c b/nx-X11/lib/X11/lcCT.c index 63608a3cd..41c7cf418 100644 --- a/nx-X11/lib/X11/lcCT.c +++ b/nx-X11/lib/X11/lcCT.c @@ -43,7 +43,7 @@ #endif #include "Xlibint.h" #include "XlcPubI.h" -#include +#include #include diff --git a/nx-X11/lib/X11/lcDB.c b/nx-X11/lib/X11/lcDB.c index ffa8f49ae..7a14d3d4f 100644 --- a/nx-X11/lib/X11/lcDB.c +++ b/nx-X11/lib/X11/lcDB.c @@ -37,8 +37,8 @@ #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "Xlibint.h" #include "XlcPubI.h" diff --git a/nx-X11/lib/X11/lcFile.c b/nx-X11/lib/X11/lcFile.c index 691daeb9e..2e0a49db4 100644 --- a/nx-X11/lib/X11/lcFile.c +++ b/nx-X11/lib/X11/lcFile.c @@ -33,7 +33,7 @@ #include #include "Xlibint.h" #include "XlcPubI.h" -#include +#include #if 0 #include /* in theory delivers getresuid/gid prototypes, * in practice only the Linux syscall wrapper is there. */ diff --git a/nx-X11/lib/X11/lcPrTxt.c b/nx-X11/lib/X11/lcPrTxt.c index 5a781280e..1a55d1cab 100644 --- a/nx-X11/lib/X11/lcPrTxt.c +++ b/nx-X11/lib/X11/lcPrTxt.c @@ -30,8 +30,8 @@ #endif #include "Xlibint.h" #include "XlcPubI.h" -#include -#include +#include +#include static XPointer * alloc_list( diff --git a/nx-X11/lib/X11/lcTxtPr.c b/nx-X11/lib/X11/lcTxtPr.c index 1f9765f6e..e214ac4e9 100644 --- a/nx-X11/lib/X11/lcTxtPr.c +++ b/nx-X11/lib/X11/lcTxtPr.c @@ -30,8 +30,8 @@ #endif #include "Xlibint.h" #include "XlcPubI.h" -#include -#include +#include +#include #include static int diff --git a/nx-X11/lib/X11/lcUtil.c b/nx-X11/lib/X11/lcUtil.c index ab1db0083..3e49fd08f 100644 --- a/nx-X11/lib/X11/lcUtil.c +++ b/nx-X11/lib/X11/lcUtil.c @@ -29,7 +29,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "XlcPublic.h" /* Don't use here because it is locale dependent. */ diff --git a/nx-X11/lib/X11/lcWrap.c b/nx-X11/lib/X11/lcWrap.c index ea2623191..b694425fe 100644 --- a/nx-X11/lib/X11/lcWrap.c +++ b/nx-X11/lib/X11/lcWrap.c @@ -61,12 +61,12 @@ from The Open Group. #include #include "Xlibint.h" #include "Xlcint.h" -#include -#include +#include +#include #ifdef WIN32 #undef close #endif -#include +#include #include "XlcPubI.h" #ifdef XTHREADS diff --git a/nx-X11/lib/X11/locking.h b/nx-X11/lib/X11/locking.h index 96c99b972..4b847ded6 100644 --- a/nx-X11/lib/X11/locking.h +++ b/nx-X11/lib/X11/locking.h @@ -38,7 +38,7 @@ in this Software without prior written authorization from The Open Group. #define xmalloc(s) Xmalloc(s) #define xfree(s) Xfree(s) -#include +#include struct _XCVList { xcondition_t cv; diff --git a/nx-X11/lib/X11/mbWMProps.c b/nx-X11/lib/X11/mbWMProps.c index a5f7732e4..8b16bc990 100644 --- a/nx-X11/lib/X11/mbWMProps.c +++ b/nx-X11/lib/X11/mbWMProps.c @@ -31,10 +31,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include +#include +#include +#include +#include void XmbSetWMProperties ( diff --git a/nx-X11/lib/X11/omDefault.c b/nx-X11/lib/X11/omDefault.c index 57dd975ad..eaa75ff84 100644 --- a/nx-X11/lib/X11/omDefault.c +++ b/nx-X11/lib/X11/omDefault.c @@ -35,8 +35,8 @@ #endif #include "Xlibint.h" #include "XomGeneric.h" -#include -#include +#include +#include #include #define DefineLocalBuf char local_buf[BUFSIZ] diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c index e6c23f4e2..8f4942873 100644 --- a/nx-X11/lib/X11/omGeneric.c +++ b/nx-X11/lib/X11/omGeneric.c @@ -55,8 +55,8 @@ #include "Xlibint.h" #include "XomGeneric.h" #include "XlcGeneric.h" -#include -#include +#include +#include #include #include #include diff --git a/nx-X11/lib/X11/os2Stubs.c b/nx-X11/lib/X11/os2Stubs.c index 9d109025c..804d2e14e 100644 --- a/nx-X11/lib/X11/os2Stubs.c +++ b/nx-X11/lib/X11/os2Stubs.c @@ -37,7 +37,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include #include #define INCL_DOSSEMAPHORES diff --git a/nx-X11/lib/X11/utf8WMProps.c b/nx-X11/lib/X11/utf8WMProps.c index e3a329ac8..69366b6cb 100644 --- a/nx-X11/lib/X11/utf8WMProps.c +++ b/nx-X11/lib/X11/utf8WMProps.c @@ -53,10 +53,10 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include +#include +#include +#include +#include void Xutf8SetWMProperties ( diff --git a/nx-X11/lib/X11/util/makekeys.c b/nx-X11/lib/X11/util/makekeys.c index 0b0ad9e2c..d2a7b4aef 100644 --- a/nx-X11/lib/X11/util/makekeys.c +++ b/nx-X11/lib/X11/util/makekeys.c @@ -31,9 +31,9 @@ from The Open Group. /* Constructs hash tables for XStringToKeysym and XKeysymToString. */ -#include -#include -#include +#include +#include +#include #include #include #if defined(macII) && !defined(__STDC__) /* stdlib.h fails to define these */ diff --git a/nx-X11/lib/X11/uvY.c b/nx-X11/lib/X11/uvY.c index d7c3e6ab2..c07fcfc39 100644 --- a/nx-X11/lib/X11/uvY.c +++ b/nx-X11/lib/X11/uvY.c @@ -40,7 +40,7 @@ #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" diff --git a/nx-X11/lib/X11/xyY.c b/nx-X11/lib/X11/xyY.c index 63e80bc59..ba0b06137 100644 --- a/nx-X11/lib/X11/xyY.c +++ b/nx-X11/lib/X11/xyY.c @@ -40,7 +40,7 @@ #include #endif #include -#include +#include #include "Xlibint.h" #include "Xcmsint.h" #include "Cv.h" diff --git a/nx-X11/lib/Xau/AuDispose.c b/nx-X11/lib/Xau/AuDispose.c index 58ffd61e7..dc2080f40 100644 --- a/nx-X11/lib/Xau/AuDispose.c +++ b/nx-X11/lib/Xau/AuDispose.c @@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include void diff --git a/nx-X11/lib/Xau/AuFileName.c b/nx-X11/lib/Xau/AuFileName.c index a51fc3bff..6ab0138b8 100644 --- a/nx-X11/lib/Xau/AuFileName.c +++ b/nx-X11/lib/Xau/AuFileName.c @@ -30,8 +30,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include char * diff --git a/nx-X11/lib/Xau/AuGetAddr.c b/nx-X11/lib/Xau/AuGetAddr.c index ab13cb630..d68ceadc2 100644 --- a/nx-X11/lib/Xau/AuGetAddr.c +++ b/nx-X11/lib/Xau/AuGetAddr.c @@ -30,8 +30,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include static int binaryEqual (_Xconst char *a, _Xconst char *b, int len) diff --git a/nx-X11/lib/Xau/AuGetBest.c b/nx-X11/lib/Xau/AuGetBest.c index 5ff1c7cd3..eb27f24c1 100644 --- a/nx-X11/lib/Xau/AuGetBest.c +++ b/nx-X11/lib/Xau/AuGetBest.c @@ -30,15 +30,15 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #ifdef XTHREADS -#include +#include #endif #ifdef hpux #define X_INCLUDE_NETDB_H #define XOS_USE_NO_LOCKING -#include +#include #endif static int diff --git a/nx-X11/lib/Xau/AuLock.c b/nx-X11/lib/Xau/AuLock.c index 001235607..1813dc368 100644 --- a/nx-X11/lib/Xau/AuLock.c +++ b/nx-X11/lib/Xau/AuLock.c @@ -30,8 +30,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include #include #include @@ -42,7 +42,7 @@ in this Software without prior written authorization from The Open Group. #ifndef WIN32 extern unsigned sleep (); #else -#include +#include #define link rename #endif #endif diff --git a/nx-X11/lib/Xau/AuRead.c b/nx-X11/lib/Xau/AuRead.c index 60a0d747f..2e2509633 100644 --- a/nx-X11/lib/Xau/AuRead.c +++ b/nx-X11/lib/Xau/AuRead.c @@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include #include diff --git a/nx-X11/lib/Xau/AuUnlock.c b/nx-X11/lib/Xau/AuUnlock.c index 460effe86..e40042104 100644 --- a/nx-X11/lib/Xau/AuUnlock.c +++ b/nx-X11/lib/Xau/AuUnlock.c @@ -30,8 +30,8 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include int XauUnlockAuth ( diff --git a/nx-X11/lib/Xau/AuWrite.c b/nx-X11/lib/Xau/AuWrite.c index f25abc9e6..5a9b44eb2 100644 --- a/nx-X11/lib/Xau/AuWrite.c +++ b/nx-X11/lib/Xau/AuWrite.c @@ -30,7 +30,7 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include static int write_short (unsigned short s, FILE *file) diff --git a/nx-X11/lib/Xau/Autest.c b/nx-X11/lib/Xau/Autest.c index 298464908..2352cf170 100644 --- a/nx-X11/lib/Xau/Autest.c +++ b/nx-X11/lib/Xau/Autest.c @@ -29,7 +29,7 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include main (argc, argv) char **argv; diff --git a/nx-X11/lib/Xau/Imakefile b/nx-X11/lib/Xau/Imakefile index 331d29c09..df80d28d4 100644 --- a/nx-X11/lib/Xau/Imakefile +++ b/nx-X11/lib/Xau/Imakefile @@ -12,7 +12,7 @@ XCOMM $XFree86: xc/lib/Xau/Imakefile,v 3.5 1999/04/17 09:08:11 dawes Exp $ #define DoProfileLib ProfileLibXau #define LibName NX_Xau #define SoRev SOXAUTHREV -#define IncSubdir X11 +#define IncSubdir nx-X11 #include diff --git a/nx-X11/lib/Xau/k5encode.c b/nx-X11/lib/Xau/k5encode.c index a3c6c09b1..c71222e1c 100644 --- a/nx-X11/lib/Xau/k5encode.c +++ b/nx-X11/lib/Xau/k5encode.c @@ -45,10 +45,10 @@ in this Software without prior written authorization from The Open Group. #undef BITS32 #undef xfree -#include -#include -#include -#include +#include +#include +#include +#include /* * XauKrb5Encode diff --git a/nx-X11/lib/Xcomposite/Imakefile b/nx-X11/lib/Xcomposite/Imakefile index a8e4077fa..24820c146 100644 --- a/nx-X11/lib/Xcomposite/Imakefile +++ b/nx-X11/lib/Xcomposite/Imakefile @@ -16,7 +16,7 @@ SOXCOMPOSITEREV=1.0.0 #define LibName NX_Xcomposite #define SoRev SOXCOMPOSITEREV -#define IncSubdir X11 +#define IncSubdir nx-X11 #define IncSubSubdir extensions #include diff --git a/nx-X11/lib/Xcomposite/Xcomposite.h b/nx-X11/lib/Xcomposite/Xcomposite.h index 3604141bb..c28cc6857 100644 --- a/nx-X11/lib/Xcomposite/Xcomposite.h +++ b/nx-X11/lib/Xcomposite/Xcomposite.h @@ -25,9 +25,9 @@ #ifndef _XCOMPOSITE_H_ #define _XCOMPOSITE_H_ -#include -#include -#include +#include +#include +#include /* * This revision number also appears in configure.ac, they have diff --git a/nx-X11/lib/Xcomposite/xcompositeint.h b/nx-X11/lib/Xcomposite/xcompositeint.h index af5f57500..7b12e8d55 100644 --- a/nx-X11/lib/Xcomposite/xcompositeint.h +++ b/nx-X11/lib/Xcomposite/xcompositeint.h @@ -28,11 +28,11 @@ #define NEED_EVENTS #define NEED_REPLIES #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include typedef struct _XCompositeExtDisplayInfo { struct _XCompositeExtDisplayInfo *next; /* keep a linked list */ diff --git a/nx-X11/lib/Xext/DPMS.c b/nx-X11/lib/Xext/DPMS.c index 35b21b4ad..a2c0dc3c5 100644 --- a/nx-X11/lib/Xext/DPMS.c +++ b/nx-X11/lib/Xext/DPMS.c @@ -36,11 +36,11 @@ Equipment Corporation. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include static XExtensionInfo _dpms_info_data; diff --git a/nx-X11/lib/Xext/MITMisc.c b/nx-X11/lib/Xext/MITMisc.c index c0fa87209..8ba35dce1 100644 --- a/nx-X11/lib/Xext/MITMisc.c +++ b/nx-X11/lib/Xext/MITMisc.c @@ -32,11 +32,11 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include static XExtensionInfo _mit_info_data; static XExtensionInfo *mit_info = &_mit_info_data; diff --git a/nx-X11/lib/Xext/XAppgroup.c b/nx-X11/lib/Xext/XAppgroup.c index 2ca3e4d21..abbf1c1b9 100644 --- a/nx-X11/lib/Xext/XAppgroup.c +++ b/nx-X11/lib/Xext/XAppgroup.c @@ -30,15 +30,15 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #endif #define NEED_EVENTS #define NEED_REPLIES -#include -#include -#include -#include +#include +#include +#include +#include #include diff --git a/nx-X11/lib/Xext/XEVI.c b/nx-X11/lib/Xext/XEVI.c index a64b9c1ba..e5a811bdf 100644 --- a/nx-X11/lib/Xext/XEVI.c +++ b/nx-X11/lib/Xext/XEVI.c @@ -27,12 +27,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include static XExtensionInfo *xevi_info;/* needs to move to globals.c */ static /* const */ char *xevi_extension_name = EVINAME; #define XeviCheckExtension(dpy,i,val) \ diff --git a/nx-X11/lib/Xext/XLbx.c b/nx-X11/lib/Xext/XLbx.c index 8c0cfad0b..450bd5bc5 100644 --- a/nx-X11/lib/Xext/XLbx.c +++ b/nx-X11/lib/Xext/XLbx.c @@ -30,11 +30,11 @@ #include #endif #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include static XExtensionInfo _lbx_info_data; static XExtensionInfo *lbx_info = &_lbx_info_data; diff --git a/nx-X11/lib/Xext/XMultibuf.c b/nx-X11/lib/Xext/XMultibuf.c index 3e0049e92..570676def 100644 --- a/nx-X11/lib/Xext/XMultibuf.c +++ b/nx-X11/lib/Xext/XMultibuf.c @@ -32,11 +32,11 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include -#include -#include -#include +#include +#include +#include static XExtensionInfo _multibuf_info_data; static XExtensionInfo *multibuf_info = &_multibuf_info_data; diff --git a/nx-X11/lib/Xext/XSecurity.c b/nx-X11/lib/Xext/XSecurity.c index 161ade3b7..a9899916f 100644 --- a/nx-X11/lib/Xext/XSecurity.c +++ b/nx-X11/lib/Xext/XSecurity.c @@ -29,11 +29,11 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #include -#include -#include -#include +#include +#include +#include static XExtensionInfo _Security_info_data; static XExtensionInfo *Security_info = &_Security_info_data; diff --git a/nx-X11/lib/Xext/XShape.c b/nx-X11/lib/Xext/XShape.c index 29a7f83f9..79b4b78f6 100644 --- a/nx-X11/lib/Xext/XShape.c +++ b/nx-X11/lib/Xext/XShape.c @@ -31,12 +31,12 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include static XExtensionInfo _shape_info_data; static XExtensionInfo *shape_info = &_shape_info_data; diff --git a/nx-X11/lib/Xext/XShm.c b/nx-X11/lib/Xext/XShm.c index f4e29a42b..ec3720732 100644 --- a/nx-X11/lib/Xext/XShm.c +++ b/nx-X11/lib/Xext/XShm.c @@ -36,12 +36,12 @@ in this Software without prior written authorization from The Open Group. #include #endif #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include static XExtensionInfo _shm_info_data; static XExtensionInfo *shm_info = &_shm_info_data; diff --git a/nx-X11/lib/Xext/XSync.c b/nx-X11/lib/Xext/XSync.c index 61f8600ce..39eb97cdd 100644 --- a/nx-X11/lib/Xext/XSync.c +++ b/nx-X11/lib/Xext/XSync.c @@ -58,10 +58,10 @@ PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS #define NEED_REPLIES -#include -#include -#include -#include +#include +#include +#include +#include static XExtensionInfo _sync_info_data; static XExtensionInfo *sync_info = &_sync_info_data; diff --git a/nx-X11/lib/Xext/XTestExt1.c b/nx-X11/lib/Xext/XTestExt1.c index ee4a0bde0..00da036bd 100644 --- a/nx-X11/lib/Xext/XTestExt1.c +++ b/nx-X11/lib/Xext/XTestExt1.c @@ -64,9 +64,9 @@ University of California. #include #endif #include -#include -#include -#include +#include +#include +#include /****************************************************************************** * variables diff --git a/nx-X11/lib/Xext/Xcup.c b/nx-X11/lib/Xext/Xcup.c index 6315d32a4..8bf2bb29e 100644 --- a/nx-X11/lib/Xext/Xcup.c +++ b/nx-X11/lib/Xext/Xcup.c @@ -30,15 +30,15 @@ in this Software without prior written authorization from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include +#include #endif #define NEED_EVENTS #define NEED_REPLIES -#include -#include -#include -#include +#include +#include +#include +#include static XExtensionInfo _xcup_info_data; static XExtensionInfo *xcup_info = &_xcup_info_data; diff --git a/nx-X11/lib/Xext/Xdbe.c b/nx-X11/lib/Xext/Xdbe.c index 954c8f01d..05df171f6 100644 --- a/nx-X11/lib/Xext/Xdbe.c +++ b/nx-X11/lib/Xext/Xdbe.c @@ -38,11 +38,11 @@ #include #endif #include -#include -#include -#include +#include +#include +#include #define NEED_DBE_PROTOCOL -#include +#include static XExtensionInfo _dbe_info_data; static XExtensionInfo *dbe_info = &_dbe_info_data; diff --git a/nx-X11/lib/Xext/extutil.c b/nx-X11/lib/Xext/extutil.c index d96b17f3f..bd79dbdb2 100644 --- a/nx-X11/lib/Xext/extutil.c +++ b/nx-X11/lib/Xext/extutil.c @@ -51,9 +51,9 @@ in this Software without prior written authorization from The Open Group. #include #endif #include -#include -#include -#include +#include +#include +#include /* diff --git a/nx-X11/lib/Xext/globals.c b/nx-X11/lib/Xext/globals.c index 0cd5d2690..53a18690d 100644 --- a/nx-X11/lib/Xext/globals.c +++ b/nx-X11/lib/Xext/globals.c @@ -34,8 +34,8 @@ from The Open Group. #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include /* for definition of NULL */ /* diff --git a/nx-X11/lib/Xfixes/Imakefile b/nx-X11/lib/Xfixes/Imakefile index ca1fe046b..cc3e1631d 100644 --- a/nx-X11/lib/Xfixes/Imakefile +++ b/nx-X11/lib/Xfixes/Imakefile @@ -16,7 +16,7 @@ SOXFIXESREV=3.0.0 #define LibName NX_Xfixes #define SoRev SOXFIXESREV -#define IncSubdir X11 +#define IncSubdir nx-X11 #define IncSubSubdir extensions #include diff --git a/nx-X11/lib/Xfixes/Xfixes.h b/nx-X11/lib/Xfixes/Xfixes.h index 28ca28f1a..4cba47ca4 100644 --- a/nx-X11/lib/Xfixes/Xfixes.h +++ b/nx-X11/lib/Xfixes/Xfixes.h @@ -25,9 +25,9 @@ #ifndef _XFIXES_H_ #define _XFIXES_H_ -#include +#include -#include +#include /* * This revision number also appears in configure.ac, they have diff --git a/nx-X11/lib/Xfixes/Xfixes.man b/nx-X11/lib/Xfixes/Xfixes.man index f081cc54e..563db15b5 100644 --- a/nx-X11/lib/Xfixes/Xfixes.man +++ b/nx-X11/lib/Xfixes/Xfixes.man @@ -31,7 +31,7 @@ .SH NAME XFixes \- Augmented versions of core protocol requests .SH SYNTAX -\&#include +\&#include .nf .sp Bool XFixesQueryExtension \^(\^Display *\fIdpy\fP, diff --git a/nx-X11/lib/Xfixes/Xfixesint.h b/nx-X11/lib/Xfixes/Xfixesint.h index e227571be..353dcae77 100644 --- a/nx-X11/lib/Xfixes/Xfixesint.h +++ b/nx-X11/lib/Xfixes/Xfixesint.h @@ -28,11 +28,11 @@ #define NEED_EVENTS #define NEED_REPLIES #include -#include -#include -#include +#include +#include +#include #include "Xfixes.h" -#include +#include extern char XFixesExtensionName[]; diff --git a/nx-X11/lib/Xinerama/Xinerama.c b/nx-X11/lib/Xinerama/Xinerama.c index fd717dd22..0256336be 100644 --- a/nx-X11/lib/Xinerama/Xinerama.c +++ b/nx-X11/lib/Xinerama/Xinerama.c @@ -27,13 +27,13 @@ Equipment Corporation. #define NEED_EVENTS #define NEED_REPLIES -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include static XExtensionInfo _panoramiX_ext_info_data; diff --git a/nx-X11/lib/Xrender/Imakefile b/nx-X11/lib/Xrender/Imakefile index 35d826b22..c5a0f89fc 100644 --- a/nx-X11/lib/Xrender/Imakefile +++ b/nx-X11/lib/Xrender/Imakefile @@ -71,7 +71,7 @@ clean:: #define SoRev SOXRENDERREV #ifdef XBuildIncDir -#define IncSubdir X11 +#define IncSubdir nx-X11 #define IncSubSubdir extensions RENDERINCDIR = $(BUILDINCDIR) #else diff --git a/nx-X11/lib/Xrender/Picture.c b/nx-X11/lib/Xrender/Picture.c index 0b18f5c57..260eda05e 100644 --- a/nx-X11/lib/Xrender/Picture.c +++ b/nx-X11/lib/Xrender/Picture.c @@ -26,7 +26,7 @@ #include #endif #include "Xrenderint.h" -#include +#include static void _XRenderProcessPictureAttributes (Display *dpy, diff --git a/nx-X11/lib/Xrender/Xrender.h b/nx-X11/lib/Xrender/Xrender.h index 4d125cd81..a38f4cc3d 100644 --- a/nx-X11/lib/Xrender/Xrender.h +++ b/nx-X11/lib/Xrender/Xrender.h @@ -27,12 +27,12 @@ #define NX_CLEANUP -#include +#include -#include -#include -#include -#include +#include +#include +#include +#include #ifdef NX_CLEANUP #include "renderproto.h" diff --git a/nx-X11/lib/Xrender/Xrenderint.h b/nx-X11/lib/Xrender/Xrenderint.h index a90fe65d8..9744b0da4 100644 --- a/nx-X11/lib/Xrender/Xrenderint.h +++ b/nx-X11/lib/Xrender/Xrenderint.h @@ -28,9 +28,9 @@ #include "config.h" #define NEED_EVENTS #define NEED_REPLIES -#include -#include -#include +#include +#include +#include #include "Xrender.h" typedef struct { diff --git a/nx-X11/lib/Xtst/XRecord.c b/nx-X11/lib/Xtst/XRecord.c index 05cbda889..8e1823ef9 100644 --- a/nx-X11/lib/Xtst/XRecord.c +++ b/nx-X11/lib/Xtst/XRecord.c @@ -56,10 +56,10 @@ from The Open Group. #include #define NEED_EVENTS #define NEED_REPLIES -#include -#include -#include -#include +#include +#include +#include +#include static XExtensionInfo _xrecord_info_data; static XExtensionInfo *xrecord_info = &_xrecord_info_data; diff --git a/nx-X11/lib/Xtst/XTest.c b/nx-X11/lib/Xtst/XTest.c index 2c3ae2b41..6b814aab4 100644 --- a/nx-X11/lib/Xtst/XTest.c +++ b/nx-X11/lib/Xtst/XTest.c @@ -33,13 +33,13 @@ from The Open Group. /* $XFree86: xc/lib/Xtst/XTest.c,v 1.5 2001/12/14 19:56:40 dawes Exp $ */ #define NEED_REPLIES -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include static XExtensionInfo _xtest_info_data; static XExtensionInfo *xtest_info = &_xtest_info_data; diff --git a/nx-X11/lib/oldX/Imakefile b/nx-X11/lib/oldX/Imakefile index 663d11019..e2ee75eb0 100644 --- a/nx-X11/lib/oldX/Imakefile +++ b/nx-X11/lib/oldX/Imakefile @@ -12,7 +12,7 @@ XCOMM $XFree86: xc/lib/oldX/Imakefile,v 1.2 1998/12/20 11:57:19 dawes Exp $ #define DoProfileLib ProfileOldX #define LibName NX_oldX #define SoRev SOOLDXREV -#define IncSubdir X11 +#define IncSubdir nx-X11 #ifdef SharedOldXReqs REQUIREDLIBS = SharedOldXReqs diff --git a/nx-X11/lib/xkbfile/Imakefile b/nx-X11/lib/xkbfile/Imakefile index d7693819e..6a675dc9a 100644 --- a/nx-X11/lib/xkbfile/Imakefile +++ b/nx-X11/lib/xkbfile/Imakefile @@ -13,7 +13,7 @@ XCOMM $XFree86: xc/lib/xkbfile/Imakefile,v 3.5 2003/10/15 21:23:38 herrb Exp $ #define HasSharedData NO #define LibName NX_xkbfile #define SoRev SOXKBFILEREV -#define IncSubdir X11 +#define IncSubdir nx-X11 #define IncSubSubdir extensions #ifdef SharedxkbfileReqs diff --git a/nx-X11/lib/xkbfile/XKMformat.h b/nx-X11/lib/xkbfile/XKMformat.h index 154da5694..ced5ea21d 100644 --- a/nx-X11/lib/xkbfile/XKMformat.h +++ b/nx-X11/lib/xkbfile/XKMformat.h @@ -29,9 +29,9 @@ #ifndef _XKMFORMAT_H_ #define _XKMFORMAT_H_ 1 -#include -#include -#include +#include +#include +#include typedef struct _xkmFileInfo { CARD8 type; diff --git a/nx-X11/lib/xkbfile/cout.c b/nx-X11/lib/xkbfile/cout.c index 161bd0f89..96b3ba411 100644 --- a/nx-X11/lib/xkbfile/cout.c +++ b/nx-X11/lib/xkbfile/cout.c @@ -32,10 +32,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" diff --git a/nx-X11/lib/xkbfile/maprules.c b/nx-X11/lib/xkbfile/maprules.c index 53decdcad..75baf07ea 100644 --- a/nx-X11/lib/xkbfile/maprules.c +++ b/nx-X11/lib/xkbfile/maprules.c @@ -38,18 +38,18 @@ #define X_INCLUDE_STRING_H #define XOS_USE_NO_LOCKING -#include +#include #ifndef XKB_IN_SERVER -#include -#include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" #include "XKBrules.h" @@ -57,18 +57,18 @@ #else #define NEED_EVENTS -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "misc.h" #include "inputstr.h" #include "dix.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS -#include +#include #endif diff --git a/nx-X11/lib/xkbfile/srvmisc.c b/nx-X11/lib/xkbfile/srvmisc.c index 3e4c73c98..d228389d9 100644 --- a/nx-X11/lib/xkbfile/srvmisc.c +++ b/nx-X11/lib/xkbfile/srvmisc.c @@ -32,9 +32,9 @@ #include #include #include -#include -#include -#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" diff --git a/nx-X11/lib/xkbfile/xkbatom.c b/nx-X11/lib/xkbfile/xkbatom.c index 1a5dea0f8..d023d5410 100644 --- a/nx-X11/lib/xkbfile/xkbatom.c +++ b/nx-X11/lib/xkbfile/xkbatom.c @@ -79,9 +79,9 @@ SOFTWARE. #include #include #include -#include -#include -#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" diff --git a/nx-X11/lib/xkbfile/xkbbells.c b/nx-X11/lib/xkbfile/xkbbells.c index 30b918fb4..8bf0885fe 100644 --- a/nx-X11/lib/xkbfile/xkbbells.c +++ b/nx-X11/lib/xkbfile/xkbbells.c @@ -29,8 +29,8 @@ #ifdef HAVE_CONFIG_H #include #endif -#include -#include +#include +#include #include "XKBbells.h" static char *_xkbStdBellNames[XkbBI_NumBells] = { diff --git a/nx-X11/lib/xkbfile/xkbconfig.c b/nx-X11/lib/xkbfile/xkbconfig.c index 7930979eb..8c31213a5 100644 --- a/nx-X11/lib/xkbfile/xkbconfig.c +++ b/nx-X11/lib/xkbfile/xkbconfig.c @@ -36,32 +36,32 @@ #include #include -#include +#include -#include +#include #ifndef XKB_IN_SERVER -#include -#include -#include -#include +#include +#include +#include +#include #include "XKBfileInt.h" #else -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "inputstr.h" #include "dix.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #endif -#include +#include /***====================================================================***/ diff --git a/nx-X11/lib/xkbfile/xkbdraw.c b/nx-X11/lib/xkbfile/xkbdraw.c index c955f0321..865b2952e 100644 --- a/nx-X11/lib/xkbfile/xkbdraw.c +++ b/nx-X11/lib/xkbfile/xkbdraw.c @@ -33,12 +33,12 @@ #include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" diff --git a/nx-X11/lib/xkbfile/xkbmisc.c b/nx-X11/lib/xkbfile/xkbmisc.c index cca31f778..52fca3d10 100644 --- a/nx-X11/lib/xkbfile/xkbmisc.c +++ b/nx-X11/lib/xkbfile/xkbmisc.c @@ -36,31 +36,31 @@ #include #include -#include -#include +#include +#include #ifndef XKB_IN_SERVER -#include -#include -#include -#include +#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" #else -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "inputstr.h" #include "dix.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS 1 -#include -#include +#include +#include #include "xkb.h" #endif diff --git a/nx-X11/lib/xkbfile/xkbout.c b/nx-X11/lib/xkbfile/xkbout.c index b69fdfbb4..8baf34b78 100644 --- a/nx-X11/lib/xkbfile/xkbout.c +++ b/nx-X11/lib/xkbfile/xkbout.c @@ -35,32 +35,32 @@ #include #include #include -#include +#include #ifndef XKB_IN_SERVER -#include -#include -#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" #else -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "inputstr.h" #include "dix.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS 1 -#include +#include -#include -#include +#include +#include #endif diff --git a/nx-X11/lib/xkbfile/xkbtext.c b/nx-X11/lib/xkbfile/xkbtext.c index 28592d242..41f2a8ff3 100644 --- a/nx-X11/lib/xkbfile/xkbtext.c +++ b/nx-X11/lib/xkbfile/xkbtext.c @@ -36,29 +36,29 @@ #include #include -#include +#include #ifndef XKB_IN_SERVER -#include -#include -#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" #else -#include +#include #define NEED_EVENTS -#include +#include #include "misc.h" #include "inputstr.h" #include "dix.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS 1 -#include -#include +#include +#include #endif diff --git a/nx-X11/lib/xkbfile/xkmout.c b/nx-X11/lib/xkbfile/xkmout.c index 403e48810..7de4081af 100644 --- a/nx-X11/lib/xkbfile/xkmout.c +++ b/nx-X11/lib/xkbfile/xkmout.c @@ -32,10 +32,10 @@ #include #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "XKMformat.h" #include "XKBfileInt.h" diff --git a/nx-X11/lib/xkbfile/xkmread.c b/nx-X11/lib/xkbfile/xkmread.c index f22941f67..92ef05b86 100644 --- a/nx-X11/lib/xkbfile/xkmread.c +++ b/nx-X11/lib/xkbfile/xkmread.c @@ -34,33 +34,33 @@ #include -#include -#include +#include +#include #ifndef XKB_IN_SERVER #include -#include -#include +#include +#include -#include +#include -#include +#include #include "XKMformat.h" #include "XKBfileInt.h" #else -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "inputstr.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS -#include -#include +#include +#include Atom XkbInternAtom(Display *dpy,char *str,Bool only_if_exists) diff --git a/nx-X11/lib/xtrans/Imakefile b/nx-X11/lib/xtrans/Imakefile index e29a38591..2cc880c39 100644 --- a/nx-X11/lib/xtrans/Imakefile +++ b/nx-X11/lib/xtrans/Imakefile @@ -1,6 +1,6 @@ XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:46:44 cpqbld Exp $ -#define IncSubdir X11 +#define IncSubdir nx-X11 all:: diff --git a/nx-X11/programs/Xserver/GL/glx/glxserver.h b/nx-X11/programs/Xserver/GL/glx/glxserver.h index 193ebcb6f..4238de537 100644 --- a/nx-X11/programs/Xserver/GL/glx/glxserver.h +++ b/nx-X11/programs/Xserver/GL/glx/glxserver.h @@ -41,9 +41,9 @@ ** */ -#include -#include -#include +#include +#include +#include #include #include #include diff --git a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c index 6441a4b4f..1889bdabd 100644 --- a/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c +++ b/nx-X11/programs/Xserver/GL/mesa/X/xf86glx_util.c @@ -39,7 +39,7 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include "pixmapstr.h" #include "xf86glx_util.h" -#include +#include #include "GL/xf86glx.h" #ifdef ROUNDUP diff --git a/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c b/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c index 3b9955eba..a3e1d08c6 100644 --- a/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c +++ b/nx-X11/programs/Xserver/XTrap/xf86XTrapModule.c @@ -8,7 +8,7 @@ #include "xf86Module.h" -#include +#include extern void DEC_XTRAPInit(INITARGS); diff --git a/nx-X11/programs/Xserver/XTrap/xtrapddmi.c b/nx-X11/programs/Xserver/XTrap/xtrapddmi.c index 2dba356b7..1b4be39cd 100644 --- a/nx-X11/programs/Xserver/XTrap/xtrapddmi.c +++ b/nx-X11/programs/Xserver/XTrap/xtrapddmi.c @@ -44,7 +44,7 @@ SOFTWARE. #ifndef EXTMODULE #include -#include +#include #ifdef PC # include "fcntl.h" # include "io.h" @@ -56,7 +56,7 @@ SOFTWARE. #define NEED_REPLIES #define NEED_EVENTS -#include /* From library include environment */ +#include /* From library include environment */ #include "input.h" /* From server include env. (must be before Xlib.h!) */ #ifdef PC # include "scrintst.h" /* Screen struct */ @@ -66,9 +66,9 @@ SOFTWARE. # include "scrnintstr.h" /* Screen struct */ #endif -#include -#include -#include +#include +#include +#include extern int XETrapErrorBase; extern xXTrapGetAvailReply XETrap_avail; diff --git a/nx-X11/programs/Xserver/XTrap/xtrapdi.c b/nx-X11/programs/Xserver/XTrap/xtrapdi.c index bdddb6310..987d54e4f 100644 --- a/nx-X11/programs/Xserver/XTrap/xtrapdi.c +++ b/nx-X11/programs/Xserver/XTrap/xtrapdi.c @@ -58,12 +58,12 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifndef EXTMODULE #include #include -#include +#include #else #include "xf86_ansic.h" #endif -#include -#include +#include +#include #include "input.h" /* Server DevicePtr definitions */ #include "misc.h" /* Server swapping macros */ #include "dixstruct.h" /* Server ClientRec definitions */ @@ -77,9 +77,9 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #endif #include "pixmapstr.h" /* DrawableRec */ #include "windowstr.h" /* Drawable Lookup structures */ -#include -#include -#include +#include +#include +#include #include "colormapst.h" #ifdef PANORAMIX #include "panoramiX.h" diff --git a/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c b/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c index c43f6e332..ba8249c35 100644 --- a/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c +++ b/nx-X11/programs/Xserver/XTrap/xtrapdiswp.c @@ -49,12 +49,12 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#include +#include #define NEED_REPLIES #define NEED_EVENTS -#include -#include -#include +#include +#include +#include #include "input.h" /* Server DevicePtr definitions */ #include "misc.h" #include "dixstruct.h" @@ -64,8 +64,8 @@ CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. # include "extnsionst.h" /* Server ExtensionEntry definitions */ #endif # include "swapreq.h" /* Server SwapColorItem definition */ -#include -#include +#include +#include /* In-coming XTrap requests needing to be swapped to native format */ diff --git a/nx-X11/programs/Xserver/XTrap/xtrapditbl.c b/nx-X11/programs/Xserver/XTrap/xtrapditbl.c index a9ceddb3d..10a070e9e 100644 --- a/nx-X11/programs/Xserver/XTrap/xtrapditbl.c +++ b/nx-X11/programs/Xserver/XTrap/xtrapditbl.c @@ -39,12 +39,12 @@ SOFTWARE. #include #endif -#include +#include #define NEED_REPLIES #define NEED_EVENTS -#include -#include -#include +#include +#include +#include #include "input.h" /* Server DevicePtr definitions */ #include "misc.h" #include "dixstruct.h" @@ -53,8 +53,8 @@ SOFTWARE. #else # include "extnsionst.h" /* Server ExtensionEntry definitions */ #endif -#include -#include +#include +#include globaldef void_function XETSwProcVector[256L] = { diff --git a/nx-X11/programs/Xserver/Xext/EVI.c b/nx-X11/programs/Xserver/Xext/EVI.c index 93ed19fa6..1eca62693 100644 --- a/nx-X11/programs/Xserver/Xext/EVI.c +++ b/nx-X11/programs/Xserver/Xext/EVI.c @@ -27,13 +27,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#include -#include +#include +#include #include "dixstruct.h" #include "extnsionst.h" #include "dix.h" #define _XEVI_SERVER_ -#include +#include #include "EVIstruct.h" #include "modinit.h" #include "scrnintstr.h" diff --git a/nx-X11/programs/Xserver/Xext/appgroup.c b/nx-X11/programs/Xserver/Xext/appgroup.c index e23ceca59..1dd4f1ae5 100644 --- a/nx-X11/programs/Xserver/Xext/appgroup.c +++ b/nx-X11/programs/Xserver/Xext/appgroup.c @@ -32,8 +32,8 @@ from The Open Group. #include #endif -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -42,14 +42,14 @@ from The Open Group. #include "colormapst.h" #include "servermd.h" #define _XAG_SERVER_ -#include -#include +#include +#include #define _SECURITY_SERVER -#include -#include +#include +#include #define XSERV_t -#include +#include #include "../os/osdep.h" #include diff --git a/nx-X11/programs/Xserver/Xext/bigreq.c b/nx-X11/programs/Xserver/Xext/bigreq.c index 3d6d49ca7..eba552cfe 100644 --- a/nx-X11/programs/Xserver/Xext/bigreq.c +++ b/nx-X11/programs/Xserver/Xext/bigreq.c @@ -33,13 +33,13 @@ from The Open Group. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" -#include +#include #include "opaque.h" #include "modinit.h" diff --git a/nx-X11/programs/Xserver/Xext/cup.c b/nx-X11/programs/Xserver/Xext/cup.c index 198aa801f..9b6d25c21 100644 --- a/nx-X11/programs/Xserver/Xext/cup.c +++ b/nx-X11/programs/Xserver/Xext/cup.c @@ -32,8 +32,8 @@ in this Software without prior written authorization from The Open Group. #include #endif -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -42,8 +42,8 @@ in this Software without prior written authorization from The Open Group. #include "servermd.h" #include "swapreq.h" #define _XCUP_SERVER_ -#include -#include +#include +#include #ifndef EXTMODULE #include "../os/osdep.h" diff --git a/nx-X11/programs/Xserver/Xext/dgaproc.h b/nx-X11/programs/Xserver/Xext/dgaproc.h index eb9791098..4d3f224e6 100644 --- a/nx-X11/programs/Xserver/Xext/dgaproc.h +++ b/nx-X11/programs/Xserver/Xext/dgaproc.h @@ -3,7 +3,7 @@ #ifndef __DGAPROC_H #define __DGAPROC_H -#include +#include #include "pixmap.h" #define DGA_CONCURRENT_ACCESS 0x00000001 diff --git a/nx-X11/programs/Xserver/Xext/dpms.c b/nx-X11/programs/Xserver/Xext/dpms.c index 3e79602d1..fc40193e4 100644 --- a/nx-X11/programs/Xserver/Xext/dpms.c +++ b/nx-X11/programs/Xserver/Xext/dpms.c @@ -39,16 +39,16 @@ Equipment Corporation. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "opaque.h" #define DPMS_SERVER -#include -#include +#include +#include #include "dpmsproc.h" #include "modinit.h" diff --git a/nx-X11/programs/Xserver/Xext/extmod/modinit.c b/nx-X11/programs/Xserver/Xext/extmod/modinit.c index f79204281..162f76ad8 100644 --- a/nx-X11/programs/Xserver/Xext/extmod/modinit.c +++ b/nx-X11/programs/Xserver/Xext/extmod/modinit.c @@ -33,7 +33,7 @@ #include "xf86Module.h" #include "xf86Opt.h" -#include +#include #include "modinit.h" #include "globals.h" diff --git a/nx-X11/programs/Xserver/Xext/extmod/modinit.h b/nx-X11/programs/Xserver/Xext/extmod/modinit.h index 2bafdb2b0..40e1828bb 100644 --- a/nx-X11/programs/Xserver/Xext/extmod/modinit.h +++ b/nx-X11/programs/Xserver/Xext/extmod/modinit.h @@ -12,26 +12,26 @@ #ifdef SHAPE extern void ShapeExtensionInit(INITARGS); #define _SHAPE_SERVER_ /* don't want Xlib structures */ -#include +#include #endif #ifdef MULTIBUFFER extern void MultibufferExtensionInit(INITARGS); #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ -#include +#include #endif #ifdef MITMISC extern void MITMiscExtensionInit(INITARGS); #define _MITMISC_SERVER_ -#include +#include #endif #ifdef XTEST extern void XTestExtensionInit(INITARGS); #define _XTEST_SERVER_ -#include -#include +#include +#include #endif #if 1 @@ -40,49 +40,49 @@ extern void XTestExtension1Init(INITARGS); #ifdef BIGREQS extern void BigReqExtensionInit(INITARGS); -#include +#include #endif #ifdef XSYNC extern void SyncExtensionInit(INITARGS); #define _SYNC_SERVER -#include -#include +#include +#include #endif #ifdef SCREENSAVER extern void ScreenSaverExtensionInit (INITARGS); -#include +#include #endif #ifdef XCMISC extern void XCMiscExtensionInit(INITARGS); -#include +#include #endif #ifdef XF86VIDMODE extern void XFree86VidModeExtensionInit(INITARGS); #define _XF86VIDMODE_SERVER_ -#include +#include #endif #ifdef XF86MISC extern void XFree86MiscExtensionInit(INITARGS); #define _XF86MISC_SERVER_ #define _XF86MISC_SAVER_COMPAT_ -#include +#include #endif #ifdef XFreeXDGA extern void XFree86DGAExtensionInit(INITARGS); extern void XFree86DGARegister(INITARGS); #define _XF86DGA_SERVER_ -#include +#include #endif #ifdef DPMSExtension extern void DPMSExtensionInit(INITARGS); -#include +#include #endif #ifdef FONTCACHE @@ -95,31 +95,31 @@ extern void FontCacheExtensionInit(INITARGS); #ifdef TOGCUP extern void XcupExtensionInit(INITARGS); #define _XCUP_SERVER_ -#include +#include #endif #ifdef EVI extern void EVIExtensionInit(INITARGS); #define _XEVI_SERVER_ -#include +#include #endif #ifdef XV extern void XvExtensionInit(INITARGS); extern void XvMCExtensionInit(INITARGS); extern void XvRegister(INITARGS); -#include -#include +#include +#include #endif #ifdef RES extern void ResExtensionInit(INITARGS); -#include +#include #endif #ifdef SHM extern void ShmExtensionInit(INITARGS); -#include +#include extern void ShmSetPixmapFormat( ScreenPtr pScreen, int format); diff --git a/nx-X11/programs/Xserver/Xext/fontcache.c b/nx-X11/programs/Xserver/Xext/fontcache.c index 9ab23a122..0956f9be9 100644 --- a/nx-X11/programs/Xserver/Xext/fontcache.c +++ b/nx-X11/programs/Xserver/Xext/fontcache.c @@ -37,8 +37,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -48,7 +48,7 @@ #define _FONTCACHE_SERVER_ #include "fontcacheP.h" #include "fontcachstr.h" -#include +#include #include "swaprep.h" #include "modinit.h" diff --git a/nx-X11/programs/Xserver/Xext/mbuf.c b/nx-X11/programs/Xserver/Xext/mbuf.c index 37024da19..e6dec8f6f 100644 --- a/nx-X11/programs/Xserver/Xext/mbuf.c +++ b/nx-X11/programs/Xserver/Xext/mbuf.c @@ -32,8 +32,8 @@ in this Software without prior written authorization from The Open Group. #include #endif -#include -#include +#include +#include #include "window.h" #include "os.h" #include "windowstr.h" @@ -46,7 +46,7 @@ in this Software without prior written authorization from The Open Group. #include "opaque.h" #include "sleepuntil.h" #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ -#include +#include #ifdef EXTMODULE #include "xf86_ansic.h" diff --git a/nx-X11/programs/Xserver/Xext/mbufbf.c b/nx-X11/programs/Xserver/Xext/mbufbf.c index 84e7ee839..318fa6756 100644 --- a/nx-X11/programs/Xserver/Xext/mbufbf.c +++ b/nx-X11/programs/Xserver/Xext/mbufbf.c @@ -34,8 +34,8 @@ in this Software without prior written authorization from The Open Group. #endif #include -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "windowstr.h" @@ -53,7 +53,7 @@ in this Software without prior written authorization from The Open Group. #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ #define _MULTIBUF_BUFFER_ -#include +#include /* Support for doublebuffer hardare diff --git a/nx-X11/programs/Xserver/Xext/mbufpx.c b/nx-X11/programs/Xserver/Xext/mbufpx.c index 0973fc324..0e9ae1628 100644 --- a/nx-X11/programs/Xserver/Xext/mbufpx.c +++ b/nx-X11/programs/Xserver/Xext/mbufpx.c @@ -33,8 +33,8 @@ in this Software without prior written authorization from The Open Group. #endif #include -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "windowstr.h" @@ -51,7 +51,7 @@ in this Software without prior written authorization from The Open Group. #define _MULTIBUF_SERVER_ /* don't want Xlib structures */ #define _MULTIBUF_PIXMAP_ -#include +#include static Bool NoopDDA_True() { return TRUE; } diff --git a/nx-X11/programs/Xserver/Xext/mitmisc.c b/nx-X11/programs/Xserver/Xext/mitmisc.c index f7b0ee55c..5c5183e69 100644 --- a/nx-X11/programs/Xserver/Xext/mitmisc.c +++ b/nx-X11/programs/Xserver/Xext/mitmisc.c @@ -34,14 +34,14 @@ in this Software without prior written authorization from The Open Group. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #define _MITMISC_SERVER_ -#include +#include #include "modinit.h" extern Bool permitOldBugs; diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.c b/nx-X11/programs/Xserver/Xext/panoramiX.c index 2dc011e70..000c4bf04 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.c +++ b/nx-X11/programs/Xserver/Xext/panoramiX.c @@ -35,9 +35,9 @@ Equipment Corporation. #define NEED_REPLIES #include -#include -#include -#include +#include +#include +#include #include "misc.h" #include "cursor.h" #include "cursorstr.h" @@ -50,7 +50,7 @@ Equipment Corporation. #include "windowstr.h" #include "pixmapstr.h" #include "panoramiX.h" -#include +#include #include "panoramiXsrv.h" #include "globals.h" #include "servermd.h" diff --git a/nx-X11/programs/Xserver/Xext/panoramiX.h b/nx-X11/programs/Xserver/Xext/panoramiX.h index 4178b985f..3f70b6473 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiX.h +++ b/nx-X11/programs/Xserver/Xext/panoramiX.h @@ -43,7 +43,7 @@ Equipment Corporation. #ifndef _PANORAMIX_H_ #define _PANORAMIX_H_ -#include +#include /*#include "gcstruct.h"*/ diff --git a/nx-X11/programs/Xserver/Xext/panoramiXSwap.c b/nx-X11/programs/Xserver/Xext/panoramiXSwap.c index e0548df7b..955b81ed1 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiXSwap.c +++ b/nx-X11/programs/Xserver/Xext/panoramiXSwap.c @@ -30,8 +30,8 @@ Equipment Corporation. #endif #include -#include -#include +#include +#include #include "misc.h" #include "cursor.h" #include "cursorstr.h" @@ -45,10 +45,10 @@ Equipment Corporation. #include "pixmapstr.h" #if 0 #include -#include +#include #endif #include "panoramiX.h" -#include +#include #include "panoramiXsrv.h" #include "globals.h" #include "panoramiXh.h" diff --git a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c index 79a5a3290..2f2b2c63e 100644 --- a/nx-X11/programs/Xserver/Xext/panoramiXprocs.c +++ b/nx-X11/programs/Xserver/Xext/panoramiXprocs.c @@ -33,10 +33,10 @@ Equipment Corporation. #endif #include -#include +#include #define NEED_REPLIES #define NEED_EVENTS -#include +#include #include "windowstr.h" #include "dixfontstr.h" #include "gcstruct.h" diff --git a/nx-X11/programs/Xserver/Xext/sampleEVI.c b/nx-X11/programs/Xserver/Xext/sampleEVI.c index 500a585c9..598992742 100644 --- a/nx-X11/programs/Xserver/Xext/sampleEVI.c +++ b/nx-X11/programs/Xserver/Xext/sampleEVI.c @@ -27,13 +27,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#include -#include +#include +#include #include "dixstruct.h" #include "extnsionst.h" #include "dix.h" #define _XEVI_SERVER_ -#include +#include #include "EVIstruct.h" #include "scrnintstr.h" diff --git a/nx-X11/programs/Xserver/Xext/saver.c b/nx-X11/programs/Xserver/Xext/saver.c index 4a7fc054c..ec91d080a 100644 --- a/nx-X11/programs/Xserver/Xext/saver.c +++ b/nx-X11/programs/Xserver/Xext/saver.c @@ -36,8 +36,8 @@ in this Software without prior written authorization from the X Consortium. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "windowstr.h" @@ -47,7 +47,7 @@ in this Software without prior written authorization from the X Consortium. #include "dixstruct.h" #include "resource.h" #include "opaque.h" -#include +#include #include "gcstruct.h" #include "cursorstr.h" #include "colormapst.h" diff --git a/nx-X11/programs/Xserver/Xext/security.c b/nx-X11/programs/Xserver/Xext/security.c index 4bc49f408..bcc8574cb 100644 --- a/nx-X11/programs/Xserver/Xext/security.c +++ b/nx-X11/programs/Xserver/Xext/security.c @@ -57,19 +57,19 @@ in this Software without prior written authorization from The Open Group. #include "colormapst.h" #include "propertyst.h" #define _SECURITY_SERVER -#include +#include #include #include #ifdef LBX #define _XLBX_SERVER_ -#include +#include extern unsigned char LbxReqCode; #endif #ifdef XAPPGROUP -#include +#include #endif #include /* for file reading operations */ -#include /* for XA_STRING */ +#include /* for XA_STRING */ #ifdef NXAGENT_SERVER @@ -91,7 +91,7 @@ extern unsigned char LbxReqCode; #endif #if defined(WIN32) || defined(__CYGWIN__) -#include +#include #undef index #endif diff --git a/nx-X11/programs/Xserver/Xext/shape.c b/nx-X11/programs/Xserver/Xext/shape.c index 02182398a..78d3be319 100644 --- a/nx-X11/programs/Xserver/Xext/shape.c +++ b/nx-X11/programs/Xserver/Xext/shape.c @@ -33,8 +33,8 @@ in this Software without prior written authorization from The Open Group. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "windowstr.h" @@ -45,7 +45,7 @@ in this Software without prior written authorization from The Open Group. #include "resource.h" #include "opaque.h" #define _SHAPE_SERVER_ /* don't want Xlib structures */ -#include +#include #include "regionstr.h" #include "gcstruct.h" #ifdef EXTMODULE diff --git a/nx-X11/programs/Xserver/Xext/shm.c b/nx-X11/programs/Xserver/Xext/shm.c index d500e551c..6378a55a4 100644 --- a/nx-X11/programs/Xserver/Xext/shm.c +++ b/nx-X11/programs/Xserver/Xext/shm.c @@ -47,8 +47,8 @@ in this Software without prior written authorization from The Open Group. #include #define NEED_REPLIES #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -60,8 +60,8 @@ in this Software without prior written authorization from The Open Group. #include "extnsionst.h" #include "servermd.h" #define _XSHM_SERVER_ -#include -#include +#include +#include #ifdef EXTMODULE #include "xf86_ansic.h" #endif diff --git a/nx-X11/programs/Xserver/Xext/sleepuntil.c b/nx-X11/programs/Xserver/Xext/sleepuntil.c index da93806f5..62f946cf8 100644 --- a/nx-X11/programs/Xserver/Xext/sleepuntil.c +++ b/nx-X11/programs/Xserver/Xext/sleepuntil.c @@ -34,8 +34,8 @@ in this Software without prior written authorization from The Open Group. #endif #include "sleepuntil.h" -#include -#include +#include +#include #include "misc.h" #include "windowstr.h" #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/Xext/sync.c b/nx-X11/programs/Xserver/Xext/sync.c index 006cefa86..c122e2860 100644 --- a/nx-X11/programs/Xserver/Xext/sync.c +++ b/nx-X11/programs/Xserver/Xext/sync.c @@ -58,9 +58,9 @@ PERFORMANCE OF THIS SOFTWARE. #include #endif -#include -#include -#include +#include +#include +#include #include "misc.h" #include "os.h" #include "extnsionst.h" @@ -68,8 +68,8 @@ PERFORMANCE OF THIS SOFTWARE. #include "resource.h" #include "opaque.h" #define _SYNC_SERVER -#include -#include +#include +#include #ifdef EXTMODULE #include "xf86_ansic.h" diff --git a/nx-X11/programs/Xserver/Xext/xcmisc.c b/nx-X11/programs/Xserver/Xext/xcmisc.c index 0a9a09069..1d7ad0e09 100644 --- a/nx-X11/programs/Xserver/Xext/xcmisc.c +++ b/nx-X11/programs/Xserver/Xext/xcmisc.c @@ -34,14 +34,14 @@ from The Open Group. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "swaprep.h" -#include +#include #include "modinit.h" #if HAVE_STDINT_H diff --git a/nx-X11/programs/Xserver/Xext/xevie.c b/nx-X11/programs/Xserver/Xext/xevie.c index 354be121f..eb38d9223 100644 --- a/nx-X11/programs/Xserver/Xext/xevie.c +++ b/nx-X11/programs/Xserver/Xext/xevie.c @@ -38,8 +38,8 @@ of the copyright holder. #include #endif -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -47,13 +47,13 @@ of the copyright holder. #include "scrnintstr.h" #include "servermd.h" #define _XEVIE_SERVER_ -#include -#include +#include +#include #include "input.h" #include "inputstr.h" #include "windowstr.h" #include "cursorstr.h" -#include +#include #include "../os/osdep.h" diff --git a/nx-X11/programs/Xserver/Xext/xf86bigfont.c b/nx-X11/programs/Xserver/Xext/xf86bigfont.c index 36af17622..c0cc7f938 100644 --- a/nx-X11/programs/Xserver/Xext/xf86bigfont.c +++ b/nx-X11/programs/Xserver/Xext/xf86bigfont.c @@ -64,8 +64,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -74,7 +74,7 @@ #include "extnsionst.h" #define _XF86BIGFONT_SERVER_ -#include +#include static void XF86BigfontResetProc( ExtensionEntry * /* extEntry */ diff --git a/nx-X11/programs/Xserver/Xext/xf86dga.c b/nx-X11/programs/Xserver/Xext/xf86dga.c index 9979bfb30..074118c18 100644 --- a/nx-X11/programs/Xserver/Xext/xf86dga.c +++ b/nx-X11/programs/Xserver/Xext/xf86dga.c @@ -13,8 +13,8 @@ Copyright (c) 1995, 1996, 1999 XFree86 Inc #define NEED_REPLIES #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -23,8 +23,8 @@ Copyright (c) 1995, 1996, 1999 XFree86 Inc #include "scrnintstr.h" #include "servermd.h" #define _XF86DGA_SERVER_ -#include -#include +#include +#include #include "swaprep.h" #include "dgaproc.h" diff --git a/nx-X11/programs/Xserver/Xext/xf86dga2.c b/nx-X11/programs/Xserver/Xext/xf86dga2.c index 490554d9a..c2b64b048 100644 --- a/nx-X11/programs/Xserver/Xext/xf86dga2.c +++ b/nx-X11/programs/Xserver/Xext/xf86dga2.c @@ -12,8 +12,8 @@ #define NEED_REPLIES #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "dixevents.h" @@ -24,8 +24,8 @@ #include "scrnintstr.h" #include "servermd.h" #define _XF86DGA_SERVER_ -#include -#include +#include +#include #include "swaprep.h" #include "dgaproc.h" #include "xf86dgaext.h" diff --git a/nx-X11/programs/Xserver/Xext/xf86misc.c b/nx-X11/programs/Xserver/Xext/xf86misc.c index 6de794e1f..ccf983fae 100644 --- a/nx-X11/programs/Xserver/Xext/xf86misc.c +++ b/nx-X11/programs/Xserver/Xext/xf86misc.c @@ -12,8 +12,8 @@ #define NEED_REPLIES #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -22,16 +22,16 @@ #include "servermd.h" #define _XF86MISC_SERVER_ #undef _XF86MISC_SAVER_COMPAT_ -#include +#include #include "swaprep.h" #include "xf86.h" -#include +#include #include "xf86miscproc.h" #if 0 -#include +#include #include "../os/osdep.h" -#include +#include #ifndef USL #ifndef Lynx #include diff --git a/nx-X11/programs/Xserver/Xext/xf86vmode.c b/nx-X11/programs/Xserver/Xext/xf86vmode.c index 979f55c00..0595343c9 100644 --- a/nx-X11/programs/Xserver/Xext/xf86vmode.c +++ b/nx-X11/programs/Xserver/Xext/xf86vmode.c @@ -39,15 +39,15 @@ from Kaleb S. KEITHLEY #define NEED_REPLIES #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" #include "scrnintstr.h" #include "servermd.h" #define _XF86VIDMODE_SERVER_ -#include +#include #include "swaprep.h" #include "xf86.h" #include "vidmodeproc.h" diff --git a/nx-X11/programs/Xserver/Xext/xres.c b/nx-X11/programs/Xserver/Xext/xres.c index dc4018dd7..7b3555452 100644 --- a/nx-X11/programs/Xserver/Xext/xres.c +++ b/nx-X11/programs/Xserver/Xext/xres.c @@ -10,14 +10,14 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" #include "swaprep.h" -#include +#include #include "pixmapstr.h" #include "modinit.h" diff --git a/nx-X11/programs/Xserver/Xext/xtest.c b/nx-X11/programs/Xserver/Xext/xtest.c index 994b0c502..d9adc03c0 100644 --- a/nx-X11/programs/Xserver/Xext/xtest.c +++ b/nx-X11/programs/Xserver/Xext/xtest.c @@ -33,9 +33,9 @@ from The Open Group. #include #endif -#include +#include #define NEED_EVENTS -#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -46,11 +46,11 @@ from The Open Group. #include "dixevents.h" #include "sleepuntil.h" #define _XTEST_SERVER_ -#include -#include +#include +#include #ifdef XINPUT -#include -#include +#include +#include #define EXTENSION_EVENT_BASE 64 #include "extinit.h" /* LookupDeviceIntRec */ #endif /* XINPUT */ diff --git a/nx-X11/programs/Xserver/Xext/xtest1dd.c b/nx-X11/programs/Xserver/Xext/xtest1dd.c index c78cceed0..c945fd6bd 100644 --- a/nx-X11/programs/Xserver/Xext/xtest1dd.c +++ b/nx-X11/programs/Xserver/Xext/xtest1dd.c @@ -66,14 +66,14 @@ University of California. #endif #include -#include -#include -#include -#include +#include +#include +#include +#include #include "misc.h" #include "dixstruct.h" #define XTestSERVER_SIDE -#include +#include #include "xtest1dd.h" diff --git a/nx-X11/programs/Xserver/Xext/xtest1di.c b/nx-X11/programs/Xserver/Xext/xtest1di.c index 985193a89..e7c3522ba 100644 --- a/nx-X11/programs/Xserver/Xext/xtest1di.c +++ b/nx-X11/programs/Xserver/Xext/xtest1di.c @@ -67,8 +67,8 @@ University of California. #endif #include -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "gcstruct.h" @@ -76,7 +76,7 @@ University of California. #include "dixstruct.h" #include "opaque.h" #define XTestSERVER_SIDE -#include +#include #include "modinit.h" #include "xtest1dd.h" diff --git a/nx-X11/programs/Xserver/Xext/xvdisp.c b/nx-X11/programs/Xserver/Xext/xvdisp.c index b361c0ff3..8037e6c45 100644 --- a/nx-X11/programs/Xserver/Xext/xvdisp.c +++ b/nx-X11/programs/Xserver/Xext/xvdisp.c @@ -52,8 +52,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "misc.h" #include "scrnintstr.h" #include "windowstr.h" @@ -63,12 +63,12 @@ SOFTWARE. #include "resource.h" #include "opaque.h" -#include -#include +#include +#include #include "xvdix.h" #ifdef MITSHM #define _XSHM_SERVER_ -#include +#include #endif #ifdef EXTMODULE diff --git a/nx-X11/programs/Xserver/Xext/xvdix.h b/nx-X11/programs/Xserver/Xext/xvdix.h index 99d918406..6e6e07302 100644 --- a/nx-X11/programs/Xserver/Xext/xvdix.h +++ b/nx-X11/programs/Xserver/Xext/xvdix.h @@ -54,7 +54,7 @@ SOFTWARE. */ #include "scrnintstr.h" -#include +#include extern int XvScreenIndex; extern unsigned long XvExtensionGeneration; diff --git a/nx-X11/programs/Xserver/Xext/xvmain.c b/nx-X11/programs/Xserver/Xext/xvmain.c index bbbb34dcf..571bb9c46 100644 --- a/nx-X11/programs/Xserver/Xext/xvmain.c +++ b/nx-X11/programs/Xserver/Xext/xvmain.c @@ -79,8 +79,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "scrnintstr.h" @@ -95,8 +95,8 @@ SOFTWARE. #define GLOBAL -#include -#include +#include +#include #include "xvdix.h" #ifdef EXTMODULE diff --git a/nx-X11/programs/Xserver/Xext/xvmc.c b/nx-X11/programs/Xserver/Xext/xvmc.c index 30de35a2b..b1441fa1d 100644 --- a/nx-X11/programs/Xserver/Xext/xvmc.c +++ b/nx-X11/programs/Xserver/Xext/xvmc.c @@ -6,8 +6,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -15,11 +15,11 @@ #include "scrnintstr.h" #include "extnsionst.h" #include "servermd.h" -#include +#include #include "xvdix.h" -#include -#include -#include +#include +#include +#include #include "xvmcext.h" #ifdef HAS_XVMCSHM diff --git a/nx-X11/programs/Xserver/Xext/xvmcext.h b/nx-X11/programs/Xserver/Xext/xvmcext.h index 7cb8af24d..b92a53225 100644 --- a/nx-X11/programs/Xserver/Xext/xvmcext.h +++ b/nx-X11/programs/Xserver/Xext/xvmcext.h @@ -2,7 +2,7 @@ #ifndef _XVMC_H #define _XVMC_H -#include +#include #include "xvdix.h" typedef struct { diff --git a/nx-X11/programs/Xserver/Xext/xvmod.c b/nx-X11/programs/Xserver/Xext/xvmod.c index 7899f3a75..258023f65 100644 --- a/nx-X11/programs/Xserver/Xext/xvmod.c +++ b/nx-X11/programs/Xserver/Xext/xvmod.c @@ -4,12 +4,12 @@ #include #endif -#include +#include #include "misc.h" #include "scrnintstr.h" #include "gc.h" -#include -#include +#include +#include #include "xvdix.h" #include "xvmodproc.h" diff --git a/nx-X11/programs/Xserver/Xi/allowev.c b/nx-X11/programs/Xserver/Xi/allowev.c index c1df7eb73..8073649f1 100644 --- a/nx-X11/programs/Xserver/Xi/allowev.c +++ b/nx-X11/programs/Xserver/Xi/allowev.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/chgdctl.c b/nx-X11/programs/Xserver/Xi/chgdctl.c index 144a51ed4..c4fa46ba7 100644 --- a/nx-X11/programs/Xserver/Xi/chgdctl.c +++ b/nx-X11/programs/Xserver/Xi/chgdctl.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include /* control constants */ +#include +#include /* control constants */ #include "XIstubs.h" #include "extnsionst.h" diff --git a/nx-X11/programs/Xserver/Xi/chgfctl.c b/nx-X11/programs/Xserver/Xi/chgfctl.c index 3ffac39b3..d78b32a17 100644 --- a/nx-X11/programs/Xserver/Xi/chgfctl.c +++ b/nx-X11/programs/Xserver/Xi/chgfctl.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include /* control constants */ +#include +#include /* control constants */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/chgkbd.c b/nx-X11/programs/Xserver/Xi/chgkbd.c index a8a6024d8..136d257c6 100644 --- a/nx-X11/programs/Xserver/Xi/chgkbd.c +++ b/nx-X11/programs/Xserver/Xi/chgkbd.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "XIstubs.h" #include "globals.h" #include "extnsionst.h" diff --git a/nx-X11/programs/Xserver/Xi/chgkmap.c b/nx-X11/programs/Xserver/Xi/chgkmap.c index 3df376d9a..88afd9df7 100644 --- a/nx-X11/programs/Xserver/Xi/chgkmap.c +++ b/nx-X11/programs/Xserver/Xi/chgkmap.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" diff --git a/nx-X11/programs/Xserver/Xi/chgprop.c b/nx-X11/programs/Xserver/Xi/chgprop.c index 6e345d554..47db87293 100644 --- a/nx-X11/programs/Xserver/Xi/chgprop.c +++ b/nx-X11/programs/Xserver/Xi/chgprop.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/chgptr.c b/nx-X11/programs/Xserver/Xi/chgptr.c index bf2abd6b6..925d43c07 100644 --- a/nx-X11/programs/Xserver/Xi/chgptr.c +++ b/nx-X11/programs/Xserver/Xi/chgptr.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "XIstubs.h" #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ diff --git a/nx-X11/programs/Xserver/Xi/closedev.c b/nx-X11/programs/Xserver/Xi/closedev.c index 8a57aeeee..ae46f50c6 100644 --- a/nx-X11/programs/Xserver/Xi/closedev.c +++ b/nx-X11/programs/Xserver/Xi/closedev.c @@ -59,13 +59,13 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ #include "scrnintstr.h" /* screen structure */ -#include -#include +#include +#include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/devbell.c b/nx-X11/programs/Xserver/Xi/devbell.c index 190e32086..12c444137 100644 --- a/nx-X11/programs/Xserver/Xi/devbell.c +++ b/nx-X11/programs/Xserver/Xi/devbell.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/exevents.c b/nx-X11/programs/Xserver/Xi/exevents.c index f0c9aea3d..ce5fe9ec9 100644 --- a/nx-X11/programs/Xserver/Xi/exevents.c +++ b/nx-X11/programs/Xserver/Xi/exevents.c @@ -59,10 +59,10 @@ SOFTWARE. #include #endif -#include -#include -#include -#include +#include +#include +#include +#include #include "inputstr.h" #include "windowstr.h" #include "miscstruct.h" diff --git a/nx-X11/programs/Xserver/Xi/extinit.c b/nx-X11/programs/Xserver/Xi/extinit.c index 0b27b5cf7..750fa46cb 100644 --- a/nx-X11/programs/Xserver/Xi/extinit.c +++ b/nx-X11/programs/Xserver/Xi/extinit.c @@ -61,13 +61,13 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "inputstr.h" #include "gcstruct.h" /* pointer for extnsionst.h*/ #include "extnsionst.h" /* extension entry */ -#include -#include +#include +#include #include "dixevents.h" #include "exevents.h" diff --git a/nx-X11/programs/Xserver/Xi/getbmap.c b/nx-X11/programs/Xserver/Xi/getbmap.c index a944d4cc8..ac2b69749 100644 --- a/nx-X11/programs/Xserver/Xi/getbmap.c +++ b/nx-X11/programs/Xserver/Xi/getbmap.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getdctl.c b/nx-X11/programs/Xserver/Xi/getdctl.c index 527273ac4..d8c310d92 100644 --- a/nx-X11/programs/Xserver/Xi/getdctl.c +++ b/nx-X11/programs/Xserver/Xi/getdctl.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getfctl.c b/nx-X11/programs/Xserver/Xi/getfctl.c index 5652ad303..c6cb8457c 100644 --- a/nx-X11/programs/Xserver/Xi/getfctl.c +++ b/nx-X11/programs/Xserver/Xi/getfctl.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getfocus.c b/nx-X11/programs/Xserver/Xi/getfocus.c index 3c1597cc9..61a98f1bf 100644 --- a/nx-X11/programs/Xserver/Xi/getfocus.c +++ b/nx-X11/programs/Xserver/Xi/getfocus.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "windowstr.h" /* focus struct */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getkmap.c b/nx-X11/programs/Xserver/Xi/getkmap.c index 4e67d9c71..fe8fd9b22 100644 --- a/nx-X11/programs/Xserver/Xi/getkmap.c +++ b/nx-X11/programs/Xserver/Xi/getkmap.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getmmap.c b/nx-X11/programs/Xserver/Xi/getmmap.c index 6b2e38d0b..203799103 100644 --- a/nx-X11/programs/Xserver/Xi/getmmap.c +++ b/nx-X11/programs/Xserver/Xi/getmmap.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include /* Request macro */ +#include +#include /* Request macro */ #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getprop.c b/nx-X11/programs/Xserver/Xi/getprop.c index 2b4de1f3e..ac37617ec 100644 --- a/nx-X11/programs/Xserver/Xi/getprop.c +++ b/nx-X11/programs/Xserver/Xi/getprop.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structs */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/getselev.c b/nx-X11/programs/Xserver/Xi/getselev.c index c2ec2b9d5..7cd97b5ef 100644 --- a/nx-X11/programs/Xserver/Xi/getselev.c +++ b/nx-X11/programs/Xserver/Xi/getselev.c @@ -59,10 +59,10 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ -#include -#include +#include /* for inputstr.h */ +#include /* Request macro */ +#include +#include #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window struct */ #include "extnsionst.h" diff --git a/nx-X11/programs/Xserver/Xi/getvers.c b/nx-X11/programs/Xserver/Xi/getvers.c index 3a335dd31..7743e797f 100644 --- a/nx-X11/programs/Xserver/Xi/getvers.c +++ b/nx-X11/programs/Xserver/Xi/getvers.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/grabdev.c b/nx-X11/programs/Xserver/Xi/grabdev.c index 21e920a35..865263688 100644 --- a/nx-X11/programs/Xserver/Xi/grabdev.c +++ b/nx-X11/programs/Xserver/Xi/grabdev.c @@ -60,12 +60,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/grabdevb.c b/nx-X11/programs/Xserver/Xi/grabdevb.c index ad43c29a0..9a20345be 100644 --- a/nx-X11/programs/Xserver/Xi/grabdevb.c +++ b/nx-X11/programs/Xserver/Xi/grabdevb.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/grabdevk.c b/nx-X11/programs/Xserver/Xi/grabdevk.c index 952c5d89a..73b8690b9 100644 --- a/nx-X11/programs/Xserver/Xi/grabdevk.c +++ b/nx-X11/programs/Xserver/Xi/grabdevk.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/gtmotion.c b/nx-X11/programs/Xserver/Xi/gtmotion.c index 02b1fee32..ec26ae407 100644 --- a/nx-X11/programs/Xserver/Xi/gtmotion.c +++ b/nx-X11/programs/Xserver/Xi/gtmotion.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" diff --git a/nx-X11/programs/Xserver/Xi/listdev.c b/nx-X11/programs/Xserver/Xi/listdev.c index 6228352f5..e99584d0e 100644 --- a/nx-X11/programs/Xserver/Xi/listdev.c +++ b/nx-X11/programs/Xserver/Xi/listdev.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/opendev.c b/nx-X11/programs/Xserver/Xi/opendev.c index 520c6832a..054dae159 100644 --- a/nx-X11/programs/Xserver/Xi/opendev.c +++ b/nx-X11/programs/Xserver/Xi/opendev.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "XIstubs.h" #include "windowstr.h" /* window structure */ #include "extnsionst.h" diff --git a/nx-X11/programs/Xserver/Xi/queryst.c b/nx-X11/programs/Xserver/Xi/queryst.c index 34b140c8e..af2b4301d 100644 --- a/nx-X11/programs/Xserver/Xi/queryst.c +++ b/nx-X11/programs/Xserver/Xi/queryst.c @@ -40,12 +40,12 @@ from The Open Group. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" diff --git a/nx-X11/programs/Xserver/Xi/selectev.c b/nx-X11/programs/Xserver/Xi/selectev.c index a9b731864..de29fcf59 100644 --- a/nx-X11/programs/Xserver/Xi/selectev.c +++ b/nx-X11/programs/Xserver/Xi/selectev.c @@ -60,12 +60,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" diff --git a/nx-X11/programs/Xserver/Xi/sendexev.c b/nx-X11/programs/Xserver/Xi/sendexev.c index 0b2a701bb..9decfadab 100644 --- a/nx-X11/programs/Xserver/Xi/sendexev.c +++ b/nx-X11/programs/Xserver/Xi/sendexev.c @@ -60,12 +60,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* Window */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exevents.h" diff --git a/nx-X11/programs/Xserver/Xi/setbmap.c b/nx-X11/programs/Xserver/Xi/setbmap.c index 37db5110d..74b8e3c05 100644 --- a/nx-X11/programs/Xserver/Xi/setbmap.c +++ b/nx-X11/programs/Xserver/Xi/setbmap.c @@ -62,11 +62,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/setdval.c b/nx-X11/programs/Xserver/Xi/setdval.c index 9b5b1e20d..04f55d4fc 100644 --- a/nx-X11/programs/Xserver/Xi/setdval.c +++ b/nx-X11/programs/Xserver/Xi/setdval.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/setfocus.c b/nx-X11/programs/Xserver/Xi/setfocus.c index a1dd09d71..b9a495612 100644 --- a/nx-X11/programs/Xserver/Xi/setfocus.c +++ b/nx-X11/programs/Xserver/Xi/setfocus.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "windowstr.h" /* focus struct */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "dixevents.h" diff --git a/nx-X11/programs/Xserver/Xi/setmmap.c b/nx-X11/programs/Xserver/Xi/setmmap.c index 3fa2c7e7e..9fd8e7244 100644 --- a/nx-X11/programs/Xserver/Xi/setmmap.c +++ b/nx-X11/programs/Xserver/Xi/setmmap.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "exevents.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/setmode.c b/nx-X11/programs/Xserver/Xi/setmode.c index f95ef5514..17c46515d 100644 --- a/nx-X11/programs/Xserver/Xi/setmode.c +++ b/nx-X11/programs/Xserver/Xi/setmode.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ -#include -#include +#include +#include #include "XIstubs.h" #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ diff --git a/nx-X11/programs/Xserver/Xi/stubs.c b/nx-X11/programs/Xserver/Xi/stubs.c index 2d9aad08b..33c55d3b7 100644 --- a/nx-X11/programs/Xserver/Xi/stubs.c +++ b/nx-X11/programs/Xserver/Xi/stubs.c @@ -62,11 +62,11 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "inputstr.h" -#include -#include +#include +#include #include "XIstubs.h" /*********************************************************************** diff --git a/nx-X11/programs/Xserver/Xi/ungrdev.c b/nx-X11/programs/Xserver/Xi/ungrdev.c index 8de4cd225..b318fa044 100644 --- a/nx-X11/programs/Xserver/Xi/ungrdev.c +++ b/nx-X11/programs/Xserver/Xi/ungrdev.c @@ -59,11 +59,11 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/ungrdevb.c b/nx-X11/programs/Xserver/Xi/ungrdevb.c index 8927a5c6e..a76f9692c 100644 --- a/nx-X11/programs/Xserver/Xi/ungrdevb.c +++ b/nx-X11/programs/Xserver/Xi/ungrdevb.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/Xi/ungrdevk.c b/nx-X11/programs/Xserver/Xi/ungrdevk.c index 38cfa1b71..928b602f1 100644 --- a/nx-X11/programs/Xserver/Xi/ungrdevk.c +++ b/nx-X11/programs/Xserver/Xi/ungrdevk.c @@ -59,12 +59,12 @@ SOFTWARE. #include #endif -#include /* for inputstr.h */ -#include /* Request macro */ +#include /* for inputstr.h */ +#include /* Request macro */ #include "inputstr.h" /* DeviceIntPtr */ #include "windowstr.h" /* window structure */ -#include -#include +#include +#include #include "extnsionst.h" #include "extinit.h" /* LookupDeviceIntRec */ #include "exglobals.h" diff --git a/nx-X11/programs/Xserver/composite/compint.h b/nx-X11/programs/Xserver/composite/compint.h index 9a6a22f48..262d95108 100644 --- a/nx-X11/programs/Xserver/composite/compint.h +++ b/nx-X11/programs/Xserver/composite/compint.h @@ -50,7 +50,7 @@ #include "damage.h" #include "damageextint.h" #include "xfixes.h" -#include +#include #include /* diff --git a/nx-X11/programs/Xserver/damageext/damageextint.h b/nx-X11/programs/Xserver/damageext/damageextint.h index ab00effe3..d2f9d71ac 100644 --- a/nx-X11/programs/Xserver/damageext/damageextint.h +++ b/nx-X11/programs/Xserver/damageext/damageextint.h @@ -30,8 +30,8 @@ #define _DAMAGEEXTINT_H_ #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/dbe/dbe.c b/nx-X11/programs/Xserver/dbe/dbe.c index ad5294a4c..064987dec 100644 --- a/nx-X11/programs/Xserver/dbe/dbe.c +++ b/nx-X11/programs/Xserver/dbe/dbe.c @@ -41,8 +41,8 @@ #include #endif -#include -#include +#include +#include #include "scrnintstr.h" #include "extnsionst.h" #include "gcstruct.h" diff --git a/nx-X11/programs/Xserver/dbe/dbestruct.h b/nx-X11/programs/Xserver/dbe/dbestruct.h index 69135a837..43c4c525b 100644 --- a/nx-X11/programs/Xserver/dbe/dbestruct.h +++ b/nx-X11/programs/Xserver/dbe/dbestruct.h @@ -39,7 +39,7 @@ /* INCLUDES */ #define NEED_DBE_PROTOCOL -#include +#include #include "windowstr.h" diff --git a/nx-X11/programs/Xserver/dbe/midbe.c b/nx-X11/programs/Xserver/dbe/midbe.c index 042f95953..b8383e11a 100644 --- a/nx-X11/programs/Xserver/dbe/midbe.c +++ b/nx-X11/programs/Xserver/dbe/midbe.c @@ -41,8 +41,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "windowstr.h" diff --git a/nx-X11/programs/Xserver/dix/atom.c b/nx-X11/programs/Xserver/dix/atom.c index 207174280..583f2dafc 100644 --- a/nx-X11/programs/Xserver/dix/atom.c +++ b/nx-X11/programs/Xserver/dix/atom.c @@ -52,8 +52,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "misc.h" #include "resource.h" #include "dix.h" diff --git a/nx-X11/programs/Xserver/dix/colormap.c b/nx-X11/programs/Xserver/dix/colormap.c index 32d9bae89..11a353f84 100644 --- a/nx-X11/programs/Xserver/dix/colormap.c +++ b/nx-X11/programs/Xserver/dix/colormap.c @@ -53,9 +53,9 @@ SOFTWARE. #include #endif -#include +#include #define NEED_EVENTS -#include +#include #include "misc.h" #include "dix.h" #include "colormapst.h" diff --git a/nx-X11/programs/Xserver/dix/cursor.c b/nx-X11/programs/Xserver/dix/cursor.c index 187dd62c5..1e1dba36b 100644 --- a/nx-X11/programs/Xserver/dix/cursor.c +++ b/nx-X11/programs/Xserver/dix/cursor.c @@ -53,8 +53,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/dix/devices.c b/nx-X11/programs/Xserver/dix/devices.c index 917a3849a..91a92644c 100644 --- a/nx-X11/programs/Xserver/dix/devices.c +++ b/nx-X11/programs/Xserver/dix/devices.c @@ -54,12 +54,12 @@ SOFTWARE. #include #endif -#include +#include #include "misc.h" #include "resource.h" #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" @@ -68,11 +68,11 @@ SOFTWARE. #include "site.h" #define XKB_IN_SERVER #ifdef XKB -#include +#include #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef LBX #include "lbxserve.h" diff --git a/nx-X11/programs/Xserver/dix/dispatch.c b/nx-X11/programs/Xserver/dix/dispatch.c index 71c22ae0e..b6010e627 100644 --- a/nx-X11/programs/Xserver/dix/dispatch.c +++ b/nx-X11/programs/Xserver/dix/dispatch.c @@ -109,15 +109,15 @@ int ProcInitialConnection(); #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef XAPPGROUP -#include +#include #endif #ifdef XKB #define XKB_IN_SERVER #include "inputstr.h" -#include +#include #endif #ifdef LBX #include "lbxserve.h" diff --git a/nx-X11/programs/Xserver/dix/dixfonts.c b/nx-X11/programs/Xserver/dix/dixfonts.c index fac918963..6e515300d 100644 --- a/nx-X11/programs/Xserver/dix/dixfonts.c +++ b/nx-X11/programs/Xserver/dix/dixfonts.c @@ -56,9 +56,9 @@ Equipment Corporation. #include #endif -#include -#include -#include +#include +#include +#include #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" @@ -139,7 +139,7 @@ _NXGetFontPathError: #ifdef XF86BIGFONT #define _XF86BIGFONT_SERVER_ -#include +#include #endif #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics diff --git a/nx-X11/programs/Xserver/dix/dixutils.c b/nx-X11/programs/Xserver/dix/dixutils.c index f3b3373d0..8bcfce619 100644 --- a/nx-X11/programs/Xserver/dix/dixutils.c +++ b/nx-X11/programs/Xserver/dix/dixutils.c @@ -88,18 +88,18 @@ Author: Adobe Systems Incorporated #include #endif -#include -#include +#include +#include #include "misc.h" #include "windowstr.h" #include "dixstruct.h" #include "pixmapstr.h" #include "scrnintstr.h" #define XK_LATIN1 -#include +#include #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif /* diff --git a/nx-X11/programs/Xserver/dix/events.c b/nx-X11/programs/Xserver/dix/events.c index ab995a772..1166bf84b 100644 --- a/nx-X11/programs/Xserver/dix/events.c +++ b/nx-X11/programs/Xserver/dix/events.c @@ -115,12 +115,12 @@ of the copyright holder. #include #endif -#include +#include #include "misc.h" #include "resource.h" #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" @@ -134,13 +134,13 @@ of the copyright holder. #include "globals.h" #ifdef XKB -#include +#include extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef XEVIE @@ -157,7 +157,7 @@ int xeviegrabState = 0; xEvent *xeviexE; #endif -#include +#include #include "exevents.h" #include "extnsionst.h" diff --git a/nx-X11/programs/Xserver/dix/extension.c b/nx-X11/programs/Xserver/dix/extension.c index 19333c151..dd6de9c63 100644 --- a/nx-X11/programs/Xserver/dix/extension.c +++ b/nx-X11/programs/Xserver/dix/extension.c @@ -51,10 +51,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -63,7 +63,7 @@ SOFTWARE. #include "dispatch.h" #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef LBX #include "lbxserve.h" diff --git a/nx-X11/programs/Xserver/dix/gc.c b/nx-X11/programs/Xserver/dix/gc.c index 834919946..2c17de3d6 100644 --- a/nx-X11/programs/Xserver/dix/gc.c +++ b/nx-X11/programs/Xserver/dix/gc.c @@ -52,9 +52,9 @@ SOFTWARE. #include #endif -#include -#include -#include +#include +#include +#include #include "misc.h" #include "resource.h" #include "gcstruct.h" diff --git a/nx-X11/programs/Xserver/dix/globals.c b/nx-X11/programs/Xserver/dix/globals.c index 15eedf602..e4f43fd01 100644 --- a/nx-X11/programs/Xserver/dix/globals.c +++ b/nx-X11/programs/Xserver/dix/globals.c @@ -53,8 +53,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "misc.h" #include "windowstr.h" #include "scrnintstr.h" diff --git a/nx-X11/programs/Xserver/dix/grabs.c b/nx-X11/programs/Xserver/dix/grabs.c index e133c0dfc..839e930b1 100644 --- a/nx-X11/programs/Xserver/dix/grabs.c +++ b/nx-X11/programs/Xserver/dix/grabs.c @@ -52,10 +52,10 @@ SOFTWARE. #include #endif -#include +#include #include "misc.h" #define NEED_EVENTS -#include +#include #include "windowstr.h" #include "inputstr.h" #include "cursorstr.h" diff --git a/nx-X11/programs/Xserver/dix/initatoms.c b/nx-X11/programs/Xserver/dix/initatoms.c index a5972afd6..5f6244a76 100644 --- a/nx-X11/programs/Xserver/dix/initatoms.c +++ b/nx-X11/programs/Xserver/dix/initatoms.c @@ -7,8 +7,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "dix.h" void MakePredeclaredAtoms() diff --git a/nx-X11/programs/Xserver/dix/main.c b/nx-X11/programs/Xserver/dix/main.c index 954c260c2..6a5b0021d 100644 --- a/nx-X11/programs/Xserver/dix/main.c +++ b/nx-X11/programs/Xserver/dix/main.c @@ -84,9 +84,9 @@ Equipment Corporation. #include #endif -#include -#include /* for unistd.h */ -#include +#include +#include /* for unistd.h */ +#include #include "scrnintstr.h" #include "misc.h" #include "os.h" @@ -113,7 +113,7 @@ Equipment Corporation. #ifdef DPMSExtension #define DPMS_SERVER -#include +#include #include "dpmsproc.h" #endif diff --git a/nx-X11/programs/Xserver/dix/pixmap.c b/nx-X11/programs/Xserver/dix/pixmap.c index 7888cf90a..463e31598 100644 --- a/nx-X11/programs/Xserver/dix/pixmap.c +++ b/nx-X11/programs/Xserver/dix/pixmap.c @@ -32,7 +32,7 @@ from The Open Group. #include #endif -#include +#include #include "scrnintstr.h" #include "misc.h" #include "os.h" diff --git a/nx-X11/programs/Xserver/dix/privates.c b/nx-X11/programs/Xserver/dix/privates.c index 36bbc65d1..d08883d1d 100644 --- a/nx-X11/programs/Xserver/dix/privates.c +++ b/nx-X11/programs/Xserver/dix/privates.c @@ -33,7 +33,7 @@ from The Open Group. #include #endif -#include +#include #include "scrnintstr.h" #include "misc.h" #include "os.h" diff --git a/nx-X11/programs/Xserver/dix/property.c b/nx-X11/programs/Xserver/dix/property.c index f462a3ebd..51cbc1a0d 100644 --- a/nx-X11/programs/Xserver/dix/property.c +++ b/nx-X11/programs/Xserver/dix/property.c @@ -51,10 +51,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_REPLIES #define NEED_EVENTS -#include +#include #include "windowstr.h" #include "propertyst.h" #include "dixstruct.h" @@ -62,7 +62,7 @@ SOFTWARE. #include "swaprep.h" #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef LBX #include "lbxserve.h" diff --git a/nx-X11/programs/Xserver/dix/resource.c b/nx-X11/programs/Xserver/dix/resource.c index e0fc2b997..ed8a255f5 100644 --- a/nx-X11/programs/Xserver/dix/resource.c +++ b/nx-X11/programs/Xserver/dix/resource.c @@ -106,7 +106,7 @@ Equipment Corporation. #include #endif -#include +#include #include "misc.h" #include "os.h" #include "resource.h" diff --git a/nx-X11/programs/Xserver/dix/swaprep.c b/nx-X11/programs/Xserver/dix/swaprep.c index 9776cd437..b8f245408 100644 --- a/nx-X11/programs/Xserver/dix/swaprep.c +++ b/nx-X11/programs/Xserver/dix/swaprep.c @@ -52,10 +52,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_REPLIES #define NEED_EVENTS -#include +#include #include "misc.h" #include "dixstruct.h" #include diff --git a/nx-X11/programs/Xserver/dix/swapreq.c b/nx-X11/programs/Xserver/dix/swapreq.c index 7d57d551f..35a7e7527 100644 --- a/nx-X11/programs/Xserver/dix/swapreq.c +++ b/nx-X11/programs/Xserver/dix/swapreq.c @@ -52,10 +52,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" /* for SendEvent */ diff --git a/nx-X11/programs/Xserver/dix/tables.c b/nx-X11/programs/Xserver/dix/tables.c index 5196f0e85..eb4f4c8d2 100644 --- a/nx-X11/programs/Xserver/dix/tables.c +++ b/nx-X11/programs/Xserver/dix/tables.c @@ -51,10 +51,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "windowstr.h" #include "extnsionst.h" #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/dix/window.c b/nx-X11/programs/Xserver/dix/window.c index 340ca50cc..5854f2e95 100644 --- a/nx-X11/programs/Xserver/dix/window.c +++ b/nx-X11/programs/Xserver/dix/window.c @@ -105,11 +105,11 @@ Equipment Corporation. #include "globals.h" #ifdef XAPPGROUP -#include +#include #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif /****** diff --git a/nx-X11/programs/Xserver/fb/fb.h b/nx-X11/programs/Xserver/fb/fb.h index 202638d32..b64f3a227 100644 --- a/nx-X11/programs/Xserver/fb/fb.h +++ b/nx-X11/programs/Xserver/fb/fb.h @@ -27,7 +27,7 @@ #ifndef _FB_H_ #define _FB_H_ -#include +#include #include "scrnintstr.h" #include "pixmap.h" #include "pixmapstr.h" diff --git a/nx-X11/programs/Xserver/fb/fbcmap.c b/nx-X11/programs/Xserver/fb/fbcmap.c index 762c51c9d..a7c8ca638 100644 --- a/nx-X11/programs/Xserver/fb/fbcmap.c +++ b/nx-X11/programs/Xserver/fb/fbcmap.c @@ -34,8 +34,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#include -#include +#include +#include #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" diff --git a/nx-X11/programs/Xserver/fb/fbpseudocolor.c b/nx-X11/programs/Xserver/fb/fbpseudocolor.c index 83d556a0e..469f3ea08 100644 --- a/nx-X11/programs/Xserver/fb/fbpseudocolor.c +++ b/nx-X11/programs/Xserver/fb/fbpseudocolor.c @@ -2,8 +2,8 @@ #include #endif -#include -#include +#include +#include #include "scrnintstr.h" #include "colormapst.h" #include "glyphstr.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Agent.h b/nx-X11/programs/Xserver/hw/nxagent/Agent.h index dbed1e0d8..ec312bad2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Agent.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Agent.h @@ -103,8 +103,8 @@ typedef XID KeySym64; #define NX_TRANS_SOCKET #define GC XlibGC -#include "Xlib.h" -#include "X11/extensions/shape.h" +#include +#include #undef GC #ifdef _XSERVER64_tmp diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 557798e7f..21bcc60e5 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -33,7 +33,7 @@ #include "gcstruct.h" #include "xfixeswire.h" -#include +#include /* * Use asyncronous get property replies. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c index 0fb9491a4..63c3b73c1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c @@ -25,7 +25,7 @@ #include "scrnintstr.h" #include "Agent.h" -#include +#include #include "opaque.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index 862ce57d0..abc6a9380 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -38,8 +38,8 @@ is" without express or implied warranty. #include #include -#include -#include +#include +#include #include "screenint.h" #include "input.h" #include "misc.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index c33564092..d965d574c 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -66,7 +66,7 @@ #define Window XlibWindow #define Atom XlibAtom #define Time XlibXID -#include +#include #undef Window #undef Atom #undef Time @@ -90,10 +90,10 @@ #undef KeySym #undef XID -#include +#include #include "Shadow.h" -#include +#include "X11/include/Xrandr_nxagent.h" #include "NXlib.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.h b/nx-X11/programs/Xserver/hw/nxagent/Events.h index c74fa151f..02b2b8cbe 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.h @@ -18,7 +18,7 @@ #ifndef __Events_H__ #define __Events_H__ -#include +#include #define ProcessedExpose (LASTEvent + 1) #define ProcessedNotify (LASTEvent + 2) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Holder.c b/nx-X11/programs/Xserver/hw/nxagent/Holder.c index 4aca1ecdb..64ffb24a4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Holder.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Holder.c @@ -33,7 +33,7 @@ #include "../../include/gc.h" #include "../../include/window.h" -#include +#include "X11/include/xpm_nxagent.h" #include "Agent.h" #include "Pixmaps.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Icons.h b/nx-X11/programs/Xserver/hw/nxagent/Icons.h index 98e879662..b307f42e6 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Icons.h +++ b/nx-X11/programs/Xserver/hw/nxagent/Icons.h @@ -19,7 +19,7 @@ #define __Icons_H__ #define Pixel XpmPixel -#include +#include "X11/include/xpm_nxagent.h" #undef Pixel #define NXAGENT_ICON_NAME "nxagent.xpm" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 835aebeb6..9ead48de1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -64,13 +64,13 @@ is" without express or implied warranty. #include "property.h" #include "Init.h" -#include +#include #define XKBSRV_NEED_FILE_FUNCS -#include -#include +#include +#include -#include "X11/extensions/XKBrules.h" +#include #include "Xatom.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXcomposite.h b/nx-X11/programs/Xserver/hw/nxagent/NXcomposite.h index d11561e18..a274b8a39 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXcomposite.h +++ b/nx-X11/programs/Xserver/hw/nxagent/NXcomposite.h @@ -33,12 +33,12 @@ #else -#include -#include +#include +#include #endif -#include +#include /* * This revision number also appears in configure.ac, they have diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXcompositeext.h b/nx-X11/programs/Xserver/hw/nxagent/NXcompositeext.h index 8667ded16..b4433d6c1 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXcompositeext.h +++ b/nx-X11/programs/Xserver/hw/nxagent/NXcompositeext.h @@ -27,7 +27,7 @@ #ifndef NXAGENT_SERVER -#include +#include #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c index af76ed4c2..704bfcc0d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdispatch.c @@ -109,12 +109,13 @@ int ProcInitialConnection(); #define True 1 #endif +#include + #define GC XlibGC -#include +#include #undef GC #include "windowstr.h" -#include #include "dixfontstr.h" #include "gcstruct.h" #include "selection.h" @@ -135,15 +136,15 @@ int ProcInitialConnection(); #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef XAPPGROUP -#include +#include #endif #ifdef XKB #define XKB_IN_SERVER #include "inputstr.h" -#include +#include #endif #include "Atoms.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c index 4f41ee228..2f3a75147 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXdixfonts.c @@ -73,16 +73,16 @@ Equipment Corporation. #include #endif -#include -#include -#include +#include +#include +#include +#include #include "scrnintstr.h" #include "resource.h" #include "dixstruct.h" #include "cursorstr.h" #include "misc.h" #include "opaque.h" -#include #include "dixfontstr.h" #include "closestr.h" @@ -172,7 +172,7 @@ _NXGetFontPathError: #ifdef XF86BIGFONT #define _XF86BIGFONT_SERVER_ -#include +#include #endif #define QUERYCHARINFO(pci, pr) *(pr) = (pci)->metrics diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 5940fe7d1..11ff62947 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -132,13 +132,13 @@ of the copyright holder. #include #endif -#include +#include #include "Xlib.h" #include "misc.h" #include "resource.h" #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "windowstr.h" #include "inputstr.h" #include "scrnintstr.h" @@ -152,13 +152,13 @@ of the copyright holder. #include "globals.h" #ifdef XKB -#include +#include extern Bool XkbFilterEvents(ClientPtr, int, xEvent *); #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef XEVIE @@ -175,7 +175,7 @@ int xeviegrabState = 0; xEvent *xeviexE; #endif -#include +#include #include "exevents.h" #include "extnsionst.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXextension.c b/nx-X11/programs/Xserver/hw/nxagent/NXextension.c index f964e2fd8..962367bf2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXextension.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXextension.c @@ -68,10 +68,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "dixstruct.h" #include "extnsionst.h" @@ -80,7 +80,7 @@ SOFTWARE. #include "../../dix/dispatch.h" #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef LBX #include "lbxserve.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXglyphstr.h b/nx-X11/programs/Xserver/hw/nxagent/NXglyphstr.h index e7bb2d841..5d7fcf640 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXglyphstr.h +++ b/nx-X11/programs/Xserver/hw/nxagent/NXglyphstr.h @@ -50,7 +50,7 @@ #ifndef _GLYPHSTR_H_ #define _GLYPHSTR_H_ -#include +#include #include "../../render/picture.h" #include "screenint.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c index e1c6b6d8c..aa3c606f8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiexpose.c @@ -97,10 +97,10 @@ Equipment Corporation. #include #endif -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "regionstr.h" @@ -112,7 +112,7 @@ Equipment Corporation. #include "dixstruct.h" #include "mi.h" -#include +#include #include "globals.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c index 8132e9dd0..a720cafbf 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXmiwindow.c @@ -67,7 +67,7 @@ SOFTWARE. #include #endif -#include +#include #include "regionstr.h" #include "region.h" #include "mi.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c index a2d4a8e52..d6c5aa4dd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXproperty.c @@ -68,10 +68,10 @@ SOFTWARE. #include #endif -#include +#include #define NEED_REPLIES #define NEED_EVENTS -#include +#include #include "windowstr.h" #include "propertyst.h" #include "dixstruct.h" @@ -79,7 +79,7 @@ SOFTWARE. #include "swaprep.h" #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef LBX #include "lbxserve.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c index 260355c6e..dc1d2387e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXrender.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXrender.c @@ -47,8 +47,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -59,9 +59,9 @@ #include "colormapst.h" #include "extnsionst.h" #include "servermd.h" -#include -#include -#include +#include +#include +#include #include "cursorstr.h" #ifdef EXTMODULE #include "xf86_ansic.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c index 833a33fd3..39a1992de 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXresource.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXresource.c @@ -123,7 +123,7 @@ Equipment Corporation. #include #endif -#include +#include #include "misc.h" #include "os.h" #include "resource.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c index 3b40b82f7..95905fde7 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXshm.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXshm.c @@ -64,8 +64,8 @@ in this Software without prior written authorization from The Open Group. #include #define NEED_REPLIES #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -77,8 +77,8 @@ in this Software without prior written authorization from The Open Group. #include "extnsionst.h" #include "servermd.h" #define _XSHM_SERVER_ -#include -#include +#include +#include #ifdef EXTMODULE #include "xf86_ansic.h" #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c index 4017099e9..4552ad563 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXwindow.c @@ -123,11 +123,11 @@ Equipment Corporation. #include "globals.h" #ifdef XAPPGROUP -#include +#include #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #include "Screen.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c index cfce34463..1724374a0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXxvdisp.c @@ -71,8 +71,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "misc.h" #include "scrnintstr.h" #include "windowstr.h" @@ -82,12 +82,12 @@ SOFTWARE. #include "resource.h" #include "opaque.h" -#include -#include +#include +#include #include "xvdix.h" #ifdef MITSHM #define _XSHM_SERVER_ -#include +#include #endif #include "Trap.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 095aa7b08..491a92c2f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -77,13 +77,13 @@ is" without express or implied warranty. #include "Shadow.h" #include "Utils.h" -#include +#include "X11/include/Xrandr_nxagent.h" #define GC XlibGC #define Font XlibFont #define KeySym XlibKeySym #define XID XlibXID -#include +#include #undef GC #undef Font #undef KeySym diff --git a/nx-X11/programs/Xserver/hw/nxagent/TestExt.c b/nx-X11/programs/Xserver/hw/nxagent/TestExt.c index 6bce2eaeb..30fe1968e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/TestExt.c +++ b/nx-X11/programs/Xserver/hw/nxagent/TestExt.c @@ -29,9 +29,9 @@ is" without express or implied warranty. */ -#include -#include -#include +#include +#include +#include #undef Bool #include "screenint.h" #include "input.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrandr_nxagent.h b/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrandr_nxagent.h new file mode 100644 index 000000000..acfc5834e --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrandr_nxagent.h @@ -0,0 +1,105 @@ +/* + * Copyright © 2000 Compaq Computer Corporation, Inc. + * Copyright © 2002 Hewlett-Packard Company, Inc. + * Copyright © 2006 Intel Corporation + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS 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: Jim Gettys, HP Labs, Hewlett-Packard, Inc. + * Keith Packard, Intel Corporation + */ + +/* + * This file is a reduced version of the header file of + * + * + * This copy of code has been introduced to allow a clear namespace + * separation between and header files. + * + * This version of the Xrandr library header file only contains symbols + * required by nxagent and strictly avoids indirectly including + * from an X11 library that is also shipped in nx-X11/lib/. + * + * When using instead for inclusion in + * nxagent, it will attempt pulling in the + * header which in turn will include . However, the headers of + * the same name from should be used instead. + * + * FIXME: Once the nxagent Xserver starts using libXrender from X.Org, this + * hack can be removed. + * + * 2015/06/26, Mike Gabriel + */ + +#ifndef _XRANDR_H_ +#define _XRANDR_H_ + +#include +#include + +_XFUNCPROTOBEGIN + +typedef XID RRProvider; +typedef XID RRMode; + +/* + * Events. + */ + +typedef struct { + int type; /* event base */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window which selected for this event */ + Window root; /* Root window for changed screen */ + Time timestamp; /* when the screen change occurred */ + Time config_timestamp; /* when the last configuration change */ + SizeID size_index; + SubpixelOrder subpixel_order; + Rotation rotation; + int width; + int height; + int mwidth; + int mheight; +} XRRScreenChangeNotifyEvent; + +typedef unsigned long XRRModeFlags; + +typedef struct _XRRModeInfo { + RRMode id; + unsigned int width; + unsigned int height; + unsigned long dotClock; + unsigned int hSyncStart; + unsigned int hSyncEnd; + unsigned int hTotal; + unsigned int hSkew; + unsigned int vSyncStart; + unsigned int vSyncEnd; + unsigned int vTotal; + char *name; + unsigned int nameLength; + XRRModeFlags modeFlags; +} XRRModeInfo; + +_XFUNCPROTOEND + +#endif /* _XRANDR_H_ */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/X11/include/xpm_nxagent.h b/nx-X11/programs/Xserver/hw/nxagent/X11/include/xpm_nxagent.h new file mode 100644 index 000000000..b02e5a913 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/X11/include/xpm_nxagent.h @@ -0,0 +1,259 @@ +/* + * Copyright (C) 1989-95 GROUPE BULL + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to + * deal in the Software without restriction, including without limitation the + * rights to use, copy, modify, merge, publish, distribute, sublicense, and/or + * sell copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in + * all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * GROUPE BULL BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN + * AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN + * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of GROUPE BULL shall not be + * used in advertising or otherwise to promote the sale, use or other dealings + * in this Software without prior written authorization from GROUPE BULL. + */ + +/*****************************************************************************\ +* xpm.h: * +* * +* XPM library * +* Include file * +* * +* Developed by Arnaud Le Hors * +\*****************************************************************************/ + +/* + * This file is a reduced version of the header file of + * + * + * This copy of code has been introduced to allow a clear namespace + * separation between and header files. + * + * This version of the Xpm library header file only contains symbols + * required by nxagent and strictly avoids indirectly including + * from an X11 library that is also shipped in nx-X11/lib/. + * + * When using instead for inclusion in nxagent, it will + * attempt pulling in the header file. + * However, the headers of the same name from should be + * used instead. + * + * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this + * hack can be removed. + * + * 2015/06/26, Mike Gabriel + */ + +#ifndef XPM_h +#define XPM_h + +/* + * first some identification numbers: + * the version and revision numbers are determined with the following rule: + * SO Major number = LIB minor version number. + * SO Minor number = LIB sub-minor version number. + * e.g: Xpm version 3.2f + * we forget the 3 which is the format number, 2 gives 2, and f gives 6. + * thus we have XpmVersion = 2 and XpmRevision = 6 + * which gives SOXPMLIBREV = 2.6 + * + * Then the XpmIncludeVersion number is built from these numbers. + */ +#define XpmFormat 3 +#define XpmVersion 4 +#define XpmRevision 11 +#define XpmIncludeVersion ((XpmFormat * 100 + XpmVersion) * 100 + XpmRevision) + +#ifndef XPM_NUMBERS + +/* let's define Pixel if it is not done yet */ +#if ! defined(_XtIntrinsic_h) && ! defined(PIXEL_ALREADY_TYPEDEFED) +typedef unsigned long Pixel; /* Index into colormap */ +# define PIXEL_ALREADY_TYPEDEFED +#endif + +/* include headers from instead of */ +#include +#include + +/* Return ErrorStatus codes: + * null if full success + * positive if partial success + * negative if failure + */ + +#define XpmColorError 1 +#define XpmSuccess 0 +#define XpmOpenFailed -1 +#define XpmFileInvalid -2 +#define XpmNoMemory -3 +#define XpmColorFailed -4 + +typedef struct { + char *name; /* Symbolic color name */ + char *value; /* Color value */ + Pixel pixel; /* Color pixel */ +} XpmColorSymbol; + +typedef struct { + char *name; /* name of the extension */ + unsigned int nlines; /* number of lines in this extension */ + char **lines; /* pointer to the extension array of strings */ +} XpmExtension; + +typedef struct { + char *string; /* characters string */ + char *symbolic; /* symbolic name */ + char *m_color; /* monochrom default */ + char *g4_color; /* 4 level grayscale default */ + char *g_color; /* other level grayscale default */ + char *c_color; /* color default */ +} XpmColor; + +typedef struct { + unsigned int width; /* image width */ + unsigned int height; /* image height */ + unsigned int cpp; /* number of characters per pixel */ + unsigned int ncolors; /* number of colors */ + XpmColor *colorTable; /* list of related colors */ + unsigned int *data; /* image data */ +} XpmImage; + +typedef struct { + unsigned long valuemask; /* Specifies which attributes are defined */ + char *hints_cmt; /* Comment of the hints section */ + char *colors_cmt; /* Comment of the colors section */ + char *pixels_cmt; /* Comment of the pixels section */ + unsigned int x_hotspot; /* Returns the x hotspot's coordinate */ + unsigned int y_hotspot; /* Returns the y hotspot's coordinate */ + unsigned int nextensions; /* number of extensions */ + XpmExtension *extensions; /* pointer to array of extensions */ +} XpmInfo; + +typedef int (*XpmAllocColorFunc)( + Display* /* display */, + Colormap /* colormap */, + char* /* colorname */, + XColor* /* xcolor */, + void* /* closure */ +); + +typedef int (*XpmFreeColorsFunc)( + Display* /* display */, + Colormap /* colormap */, + Pixel* /* pixels */, + int /* npixels */, + void* /* closure */ +); + + +/* required struct for hw/nxagent/Holder.c */ +typedef struct { + unsigned long valuemask; /* Specifies which attributes are + defined */ + + Visual *visual; /* Specifies the visual to use */ + Colormap colormap; /* Specifies the colormap to use */ + unsigned int depth; /* Specifies the depth */ + unsigned int width; /* Returns the width of the created + pixmap */ + unsigned int height; /* Returns the height of the created + pixmap */ + unsigned int x_hotspot; /* Returns the x hotspot's + coordinate */ + unsigned int y_hotspot; /* Returns the y hotspot's + coordinate */ + unsigned int cpp; /* Specifies the number of char per + pixel */ + Pixel *pixels; /* List of used color pixels */ + unsigned int npixels; /* Number of used pixels */ + XpmColorSymbol *colorsymbols; /* List of color symbols to override */ + unsigned int numsymbols; /* Number of symbols */ + char *rgb_fname; /* RGB text file name */ + unsigned int nextensions; /* Number of extensions */ + XpmExtension *extensions; /* List of extensions */ + + unsigned int ncolors; /* Number of colors */ + XpmColor *colorTable; /* List of colors */ +/* 3.2 backward compatibility code */ + char *hints_cmt; /* Comment of the hints section */ + char *colors_cmt; /* Comment of the colors section */ + char *pixels_cmt; /* Comment of the pixels section */ +/* end 3.2 bc */ + unsigned int mask_pixel; /* Color table index of transparent + color */ + + /* Color Allocation Directives */ + Bool exactColors; /* Only use exact colors for visual */ + unsigned int closeness; /* Allowable RGB deviation */ + unsigned int red_closeness; /* Allowable red deviation */ + unsigned int green_closeness; /* Allowable green deviation */ + unsigned int blue_closeness; /* Allowable blue deviation */ + int color_key; /* Use colors from this color set */ + + Pixel *alloc_pixels; /* Returns the list of alloc'ed color + pixels */ + int nalloc_pixels; /* Returns the number of alloc'ed + color pixels */ + + Bool alloc_close_colors; /* Specify whether close colors should + be allocated using XAllocColor + or not */ + int bitmap_format; /* Specify the format of 1bit depth + images: ZPixmap or XYBitmap */ + + /* Color functions */ + XpmAllocColorFunc alloc_color; /* Application color allocator */ + XpmFreeColorsFunc free_colors; /* Application color de-allocator */ + void *color_closure; /* Application private data to pass to + alloc_color and free_colors */ + +} XpmAttributes; + +/* XpmAttributes value masks bits */ + +/* required masks bits for hw/nxagent/Holder.c */ +#define XpmDepth (1L<<2) +#define XpmSize (1L<<3) /* width & height */ + +/* macros for forward declarations of functions with prototypes */ +#define FUNC(f, t, p) extern t f p +#define LFUNC(f, t, p) static t f p + + +/* + * functions declarations (for building nxagent against system wide libXpm4, + * but also against libNX_X11 (as opposed to system-wide libX11). + */ + +_XFUNCPROTOBEGIN + +/* Keep for hw/nxagent/Holder.c */ +FUNC(XpmCreatePixmapFromData, int, (Display *display, + Drawable d, + char **data, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes)); +/* Keep for hw/nxagent/Display.c */ +FUNC(XpmReadFileToPixmap, int, (Display *display, + Drawable d, + const char *filename, + Pixmap *pixmap_return, + Pixmap *shapemask_return, + XpmAttributes *attributes)); + +_XFUNCPROTOEND + +#endif /* XPM_NUMBERS */ +#endif diff --git a/nx-X11/programs/Xserver/hw/xfree86/os-support/xf86_libc.h b/nx-X11/programs/Xserver/hw/xfree86/os-support/xf86_libc.h index c51e0ee14..ca68c1b63 100644 --- a/nx-X11/programs/Xserver/hw/xfree86/os-support/xf86_libc.h +++ b/nx-X11/programs/Xserver/hw/xfree86/os-support/xf86_libc.h @@ -45,7 +45,7 @@ #ifndef XF86_LIBC_H #define XF86_LIBC_H 1 -#include +#include #include /* diff --git a/nx-X11/programs/Xserver/include/Imakefile b/nx-X11/programs/Xserver/include/Imakefile index d68ef940c..4c9b169a4 100644 --- a/nx-X11/programs/Xserver/include/Imakefile +++ b/nx-X11/programs/Xserver/include/Imakefile @@ -63,5 +63,5 @@ InstallDriverSDKNonExecFile(validate.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(window.h,$(DRIVERSDKINCLUDEDIR)) InstallDriverSDKNonExecFile(windowstr.h,$(DRIVERSDKINCLUDEDIR)) -BuildIncludes($(HEADERS),X11,..) -InstallMultipleFlags($(HEADERS),$(INCDIR)/X11,$(INSTINCFLAGS)) +BuildIncludes($(HEADERS),nx-X11,..) +InstallMultipleFlags($(HEADERS),$(INCDIR)/nx-X11,$(INSTINCFLAGS)) diff --git a/nx-X11/programs/Xserver/include/closestr.h b/nx-X11/programs/Xserver/include/closestr.h index c06010113..31b5693f5 100644 --- a/nx-X11/programs/Xserver/include/closestr.h +++ b/nx-X11/programs/Xserver/include/closestr.h @@ -33,7 +33,7 @@ from The Open Group. #define CLOSESTR_H #define NEED_REPLIES -#include +#include #include "closure.h" #include "dix.h" #include "misc.h" diff --git a/nx-X11/programs/Xserver/include/colormap.h b/nx-X11/programs/Xserver/include/colormap.h index d519bb782..67f44193d 100644 --- a/nx-X11/programs/Xserver/include/colormap.h +++ b/nx-X11/programs/Xserver/include/colormap.h @@ -50,7 +50,7 @@ SOFTWARE. #ifndef CMAP_H #define CMAP_H 1 -#include +#include #include "screenint.h" #include "window.h" diff --git a/nx-X11/programs/Xserver/include/dixfontstr.h b/nx-X11/programs/Xserver/include/dixfontstr.h index 948bf1adb..09a162451 100644 --- a/nx-X11/programs/Xserver/include/dixfontstr.h +++ b/nx-X11/programs/Xserver/include/dixfontstr.h @@ -30,7 +30,7 @@ SOFTWARE. #include #include "closure.h" #define NEED_REPLIES -#include /* for xQueryFontReply */ +#include /* for xQueryFontReply */ #define FONTCHARSET(font) (font) #define FONTMAXBOUNDS(font,field) (font)->info.maxbounds.field diff --git a/nx-X11/programs/Xserver/include/dixstruct.h b/nx-X11/programs/Xserver/include/dixstruct.h index 53c78d2de..e4b5e9fe8 100644 --- a/nx-X11/programs/Xserver/include/dixstruct.h +++ b/nx-X11/programs/Xserver/include/dixstruct.h @@ -31,7 +31,7 @@ SOFTWARE. #include "cursor.h" #include "gc.h" #include "pixmap.h" -#include +#include /* * direct-mapped hash table, used by resource manager to store diff --git a/nx-X11/programs/Xserver/include/gc.h b/nx-X11/programs/Xserver/include/gc.h index 1c0c90d3e..1969e5cd7 100644 --- a/nx-X11/programs/Xserver/include/gc.h +++ b/nx-X11/programs/Xserver/include/gc.h @@ -50,15 +50,15 @@ SOFTWARE. #ifndef GC_H #define GC_H -#include /* for GContext, Mask */ +#include /* for GContext, Mask */ #ifndef _XTYPEDEF_POINTER /* Don't let Xdefs.h define 'pointer' */ #define _XTYPEDEF_POINTER 1 #endif /* _XTYPEDEF_POINTER */ -#include /* for Bool */ +#include /* for Bool */ -#include +#include #include "screenint.h" /* for ScreenPtr */ #include "pixmap.h" /* for DrawablePtr */ diff --git a/nx-X11/programs/Xserver/include/gcstruct.h b/nx-X11/programs/Xserver/include/gcstruct.h index 16779f692..71d3ace47 100644 --- a/nx-X11/programs/Xserver/include/gcstruct.h +++ b/nx-X11/programs/Xserver/include/gcstruct.h @@ -58,7 +58,7 @@ SOFTWARE. #include "region.h" #include "pixmap.h" #include "screenint.h" -#include +#include /* * functions which modify the state of the GC diff --git a/nx-X11/programs/Xserver/include/input.h b/nx-X11/programs/Xserver/include/input.h index 88cc98050..a7c8d0dfe 100644 --- a/nx-X11/programs/Xserver/include/input.h +++ b/nx-X11/programs/Xserver/include/input.h @@ -52,8 +52,8 @@ SOFTWARE. #include "misc.h" #include "screenint.h" -#include -#include +#include +#include #include "window.h" /* for WindowPtr */ #define DEVICE_INIT 0 diff --git a/nx-X11/programs/Xserver/include/misc.h b/nx-X11/programs/Xserver/include/misc.h index 1576f1433..cb3051c94 100644 --- a/nx-X11/programs/Xserver/include/misc.h +++ b/nx-X11/programs/Xserver/include/misc.h @@ -77,16 +77,16 @@ OF THIS SOFTWARE. extern unsigned long globalSerialNumber; extern unsigned long serverGeneration; -#include -#include -#include -#include +#include +#include +#include +#include #ifndef _XTYPEDEF_POINTER /* Don't let Xdefs.h define 'pointer' */ #define _XTYPEDEF_POINTER 1 #endif /* _XTYPEDEF_POINTER */ -#include +#include #ifndef IN_MODULE #ifndef NULL @@ -121,7 +121,7 @@ typedef struct _xReq *xReqPtr; #include "os.h" /* for ALLOCATE_LOCAL and DEALLOCATE_LOCAL */ #ifndef IN_MODULE -#include /* for bcopy, bzero, and bcmp */ +#include /* for bcopy, bzero, and bcmp */ #endif #define NullBox ((BoxPtr)0) diff --git a/nx-X11/programs/Xserver/include/miscstruct.h b/nx-X11/programs/Xserver/include/miscstruct.h index 87874aae4..7df9240c9 100644 --- a/nx-X11/programs/Xserver/include/miscstruct.h +++ b/nx-X11/programs/Xserver/include/miscstruct.h @@ -51,7 +51,7 @@ SOFTWARE. #define MISCSTRUCT_H 1 #include "misc.h" -#include +#include #include "gc.h" typedef xPoint DDXPointRec; diff --git a/nx-X11/programs/Xserver/include/opaque.h b/nx-X11/programs/Xserver/include/opaque.h index ca29afdc0..749b6f5b9 100644 --- a/nx-X11/programs/Xserver/include/opaque.h +++ b/nx-X11/programs/Xserver/include/opaque.h @@ -31,7 +31,7 @@ from The Open Group. #ifndef OPAQUE_H #define OPAQUE_H -#include +#include #include "globals.h" diff --git a/nx-X11/programs/Xserver/include/os.h b/nx-X11/programs/Xserver/include/os.h index 551b35097..e150e1e0b 100644 --- a/nx-X11/programs/Xserver/include/os.h +++ b/nx-X11/programs/Xserver/include/os.h @@ -54,7 +54,7 @@ SOFTWARE. #include "misc.h" #define ALLOCATE_LOCAL_FALLBACK(_size) Xalloc((unsigned long)(_size)) #define DEALLOCATE_LOCAL_FALLBACK(_ptr) Xfree((void *)(_ptr)) -#include +#include #ifndef IN_MODULE #include #else diff --git a/nx-X11/programs/Xserver/include/scrnintstr.h b/nx-X11/programs/Xserver/include/scrnintstr.h index 297227493..0539ca516 100644 --- a/nx-X11/programs/Xserver/include/scrnintstr.h +++ b/nx-X11/programs/Xserver/include/scrnintstr.h @@ -56,7 +56,7 @@ SOFTWARE. #include "colormap.h" #include "cursor.h" #include "validate.h" -#include +#include #include "dix.h" typedef struct _PixmapFormat { diff --git a/nx-X11/programs/Xserver/include/window.h b/nx-X11/programs/Xserver/include/window.h index cbfed645f..571115365 100644 --- a/nx-X11/programs/Xserver/include/window.h +++ b/nx-X11/programs/Xserver/include/window.h @@ -53,7 +53,7 @@ SOFTWARE. #include "misc.h" #include "region.h" #include "screenint.h" -#include +#include #define TOTALLY_OBSCURED 0 #define UNOBSCURED 1 diff --git a/nx-X11/programs/Xserver/include/windowstr.h b/nx-X11/programs/Xserver/include/windowstr.h index dab6fcf71..5c181bc51 100644 --- a/nx-X11/programs/Xserver/include/windowstr.h +++ b/nx-X11/programs/Xserver/include/windowstr.h @@ -58,7 +58,7 @@ SOFTWARE. #include "resource.h" /* for ROOT_WINDOW_ID_BASE */ #include "dix.h" #include "miscstruct.h" -#include +#include #include "opaque.h" #define GuaranteeNothing 0 diff --git a/nx-X11/programs/Xserver/mfb/maskbits.h b/nx-X11/programs/Xserver/mfb/maskbits.h index 7e2b74a18..94a7e8955 100644 --- a/nx-X11/programs/Xserver/mfb/maskbits.h +++ b/nx-X11/programs/Xserver/mfb/maskbits.h @@ -28,8 +28,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "servermd.h" diff --git a/nx-X11/programs/Xserver/mi/mi.h b/nx-X11/programs/Xserver/mi/mi.h index 0f3f5778f..6eea34b6c 100644 --- a/nx-X11/programs/Xserver/mi/mi.h +++ b/nx-X11/programs/Xserver/mi/mi.h @@ -49,7 +49,7 @@ SOFTWARE. #ifndef MI_H #define MI_H -#include +#include #include "region.h" #include "validate.h" #include "window.h" diff --git a/nx-X11/programs/Xserver/mi/miarc.c b/nx-X11/programs/Xserver/mi/miarc.c index f06c4b51d..8db188a6e 100644 --- a/nx-X11/programs/Xserver/mi/miarc.c +++ b/nx-X11/programs/Xserver/mi/miarc.c @@ -62,8 +62,8 @@ SOFTWARE. #include #undef _XOPEN_SOURCE #endif -#include -#include +#include +#include #include "misc.h" #include "gcstruct.h" #include "scrnintstr.h" @@ -72,7 +72,7 @@ SOFTWARE. #include "mifpoly.h" #include "mi.h" #include "mifillarc.h" -#include +#include static double miDsin(double a); static double miDcos(double a); diff --git a/nx-X11/programs/Xserver/mi/mibitblt.c b/nx-X11/programs/Xserver/mi/mibitblt.c index 0caad083f..60318a046 100644 --- a/nx-X11/programs/Xserver/mi/mibitblt.c +++ b/nx-X11/programs/Xserver/mi/mibitblt.c @@ -52,8 +52,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "misc.h" #include "gcstruct.h" @@ -62,7 +62,7 @@ SOFTWARE. #include "scrnintstr.h" #include "mi.h" #include "regionstr.h" -#include +#include #include "servermd.h" #ifndef HAS_FFS diff --git a/nx-X11/programs/Xserver/mi/mibstore.c b/nx-X11/programs/Xserver/mi/mibstore.c index f18648f66..875ec87f3 100644 --- a/nx-X11/programs/Xserver/mi/mibstore.c +++ b/nx-X11/programs/Xserver/mi/mibstore.c @@ -49,9 +49,9 @@ implied warranty. #include #endif -#include -#include -#include +#include +#include +#include #include "misc.h" #include "regionstr.h" #include "scrnintstr.h" diff --git a/nx-X11/programs/Xserver/mi/miclipn.c b/nx-X11/programs/Xserver/mi/miclipn.c index 14ff0d69a..913b0e47a 100644 --- a/nx-X11/programs/Xserver/mi/miclipn.c +++ b/nx-X11/programs/Xserver/mi/miclipn.c @@ -32,7 +32,7 @@ from The Open Group. #include #endif -#include +#include #include "windowstr.h" #include "scrnintstr.h" #include "mi.h" diff --git a/nx-X11/programs/Xserver/mi/micmap.c b/nx-X11/programs/Xserver/mi/micmap.c index 98f3e521d..15d3f7f46 100644 --- a/nx-X11/programs/Xserver/mi/micmap.c +++ b/nx-X11/programs/Xserver/mi/micmap.c @@ -40,8 +40,8 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#include -#include +#include +#include #include "scrnintstr.h" #include "colormapst.h" #include "resource.h" diff --git a/nx-X11/programs/Xserver/mi/miexpose.c b/nx-X11/programs/Xserver/mi/miexpose.c index f3dae5768..782ddad49 100644 --- a/nx-X11/programs/Xserver/mi/miexpose.c +++ b/nx-X11/programs/Xserver/mi/miexpose.c @@ -80,10 +80,10 @@ Equipment Corporation. #include #endif -#include +#include #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "regionstr.h" @@ -95,7 +95,7 @@ Equipment Corporation. #include "dixstruct.h" #include "mi.h" -#include +#include #include "globals.h" diff --git a/nx-X11/programs/Xserver/mi/mifillarc.c b/nx-X11/programs/Xserver/mi/mifillarc.c index 0dcf25d05..533bfe996 100644 --- a/nx-X11/programs/Xserver/mi/mifillarc.c +++ b/nx-X11/programs/Xserver/mi/mifillarc.c @@ -34,8 +34,8 @@ Author: Bob Scheifler, MIT X Consortium #endif #include -#include -#include +#include +#include #include "regionstr.h" #include "gcstruct.h" #include "pixmapstr.h" diff --git a/nx-X11/programs/Xserver/mi/mifillrct.c b/nx-X11/programs/Xserver/mi/mifillrct.c index 9f68db720..8a8f2b4f3 100644 --- a/nx-X11/programs/Xserver/mi/mifillrct.c +++ b/nx-X11/programs/Xserver/mi/mifillrct.c @@ -51,8 +51,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "gcstruct.h" #include "windowstr.h" #include "pixmap.h" diff --git a/nx-X11/programs/Xserver/mi/mifpolycon.c b/nx-X11/programs/Xserver/mi/mifpolycon.c index 40b83586f..95b81bbb6 100644 --- a/nx-X11/programs/Xserver/mi/mifpolycon.c +++ b/nx-X11/programs/Xserver/mi/mifpolycon.c @@ -51,7 +51,7 @@ SOFTWARE. #endif #include -#include +#include #include "gcstruct.h" #include "windowstr.h" #include "pixmapstr.h" diff --git a/nx-X11/programs/Xserver/mi/miinitext.c b/nx-X11/programs/Xserver/mi/miinitext.c index b70a6a67e..f4ff4c243 100644 --- a/nx-X11/programs/Xserver/mi/miinitext.c +++ b/nx-X11/programs/Xserver/mi/miinitext.c @@ -191,35 +191,35 @@ typedef void (*InitExtension)(INITARGS); #ifdef MITSHM #define _XSHM_SERVER_ -#include +#include #endif #ifdef XTEST #define _XTEST_SERVER_ -#include +#include #endif #ifdef XKB -#include +#include #endif #ifdef LBX #define _XLBX_SERVER_ -#include +#include #endif #ifdef XAPPGROUP #define _XAG_SERVER_ -#include +#include #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef PANORAMIX -#include +#include #endif #ifdef XF86BIGFONT -#include +#include #endif #ifdef RES -#include +#include #endif /* FIXME: this whole block of externs should be from the appropriate headers */ diff --git a/nx-X11/programs/Xserver/mi/mioverlay.c b/nx-X11/programs/Xserver/mi/mioverlay.c index 732e47af0..f67704e11 100644 --- a/nx-X11/programs/Xserver/mi/mioverlay.c +++ b/nx-X11/programs/Xserver/mi/mioverlay.c @@ -4,7 +4,7 @@ #include #endif -#include +#include #include "scrnintstr.h" #include "validate.h" #include "windowstr.h" diff --git a/nx-X11/programs/Xserver/mi/mipoly.c b/nx-X11/programs/Xserver/mi/mipoly.c index 403d3da56..11214a732 100644 --- a/nx-X11/programs/Xserver/mi/mipoly.c +++ b/nx-X11/programs/Xserver/mi/mipoly.c @@ -60,7 +60,7 @@ SOFTWARE. #include #endif -#include +#include #include "windowstr.h" #include "gcstruct.h" #include "pixmapstr.h" diff --git a/nx-X11/programs/Xserver/mi/mipolygen.c b/nx-X11/programs/Xserver/mi/mipolygen.c index c3d9ef397..98fe21d50 100644 --- a/nx-X11/programs/Xserver/mi/mipolygen.c +++ b/nx-X11/programs/Xserver/mi/mipolygen.c @@ -50,7 +50,7 @@ SOFTWARE. #include #endif -#include +#include #include "gcstruct.h" #include "miscanfill.h" #include "mipoly.h" diff --git a/nx-X11/programs/Xserver/mi/mipolypnt.c b/nx-X11/programs/Xserver/mi/mipolypnt.c index 5d615c28d..dcbdf85d0 100644 --- a/nx-X11/programs/Xserver/mi/mipolypnt.c +++ b/nx-X11/programs/Xserver/mi/mipolypnt.c @@ -50,8 +50,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "pixmapstr.h" #include "gcstruct.h" #include "windowstr.h" diff --git a/nx-X11/programs/Xserver/mi/mipolyrect.c b/nx-X11/programs/Xserver/mi/mipolyrect.c index 98e467f9f..9b21bb032 100644 --- a/nx-X11/programs/Xserver/mi/mipolyrect.c +++ b/nx-X11/programs/Xserver/mi/mipolyrect.c @@ -50,8 +50,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "regionstr.h" #include "gcstruct.h" #include "pixmap.h" diff --git a/nx-X11/programs/Xserver/mi/mipolyseg.c b/nx-X11/programs/Xserver/mi/mipolyseg.c index dcf3d815a..bd3c93ed6 100644 --- a/nx-X11/programs/Xserver/mi/mipolyseg.c +++ b/nx-X11/programs/Xserver/mi/mipolyseg.c @@ -50,8 +50,8 @@ SOFTWARE. #include #endif -#include -#include +#include +#include #include "regionstr.h" #include "gcstruct.h" #include "pixmap.h" diff --git a/nx-X11/programs/Xserver/mi/mipushpxl.c b/nx-X11/programs/Xserver/mi/mipushpxl.c index 5fce1cae7..44834db50 100644 --- a/nx-X11/programs/Xserver/mi/mipushpxl.c +++ b/nx-X11/programs/Xserver/mi/mipushpxl.c @@ -50,7 +50,7 @@ SOFTWARE. #include #endif -#include +#include #include "gcstruct.h" #include "scrnintstr.h" #include "pixmapstr.h" diff --git a/nx-X11/programs/Xserver/mi/miregion.c b/nx-X11/programs/Xserver/mi/miregion.c index 5ec4ec55a..1df0dcc46 100644 --- a/nx-X11/programs/Xserver/mi/miregion.c +++ b/nx-X11/programs/Xserver/mi/miregion.c @@ -82,7 +82,7 @@ Equipment Corporation. #endif #include "regionstr.h" -#include +#include #include "gc.h" #include "mi.h" #include "mispans.h" diff --git a/nx-X11/programs/Xserver/mi/miscrinit.c b/nx-X11/programs/Xserver/mi/miscrinit.c index 78e2af5a4..4950eaa93 100644 --- a/nx-X11/programs/Xserver/mi/miscrinit.c +++ b/nx-X11/programs/Xserver/mi/miscrinit.c @@ -32,7 +32,7 @@ from The Open Group. #include #endif -#include +#include #include "servermd.h" #include "misc.h" #include "mi.h" @@ -42,7 +42,7 @@ from The Open Group. #include "miline.h" #ifdef MITSHM #define _XSHM_SERVER_ -#include +#include #endif /* We use this structure to propogate some information from miScreenInit to diff --git a/nx-X11/programs/Xserver/mi/miwideline.c b/nx-X11/programs/Xserver/mi/miwideline.c index 44cf18f2e..fa9ef4591 100644 --- a/nx-X11/programs/Xserver/mi/miwideline.c +++ b/nx-X11/programs/Xserver/mi/miwideline.c @@ -47,7 +47,7 @@ from The Open Group. #include #undef _XOPEN_SOURCE #endif -#include +#include #include "windowstr.h" #include "gcstruct.h" #include "regionstr.h" diff --git a/nx-X11/programs/Xserver/mi/miwindow.c b/nx-X11/programs/Xserver/mi/miwindow.c index 179c6e31e..44b7ada60 100644 --- a/nx-X11/programs/Xserver/mi/miwindow.c +++ b/nx-X11/programs/Xserver/mi/miwindow.c @@ -50,7 +50,7 @@ SOFTWARE. #include #endif -#include +#include #include "regionstr.h" #include "region.h" #include "mi.h" diff --git a/nx-X11/programs/Xserver/mi/mizerarc.c b/nx-X11/programs/Xserver/mi/mizerarc.c index 62402f41b..4b4d724a6 100644 --- a/nx-X11/programs/Xserver/mi/mizerarc.c +++ b/nx-X11/programs/Xserver/mi/mizerarc.c @@ -40,8 +40,8 @@ Author: Bob Scheifler, MIT X Consortium #endif #include -#include -#include +#include +#include #include "regionstr.h" #include "gcstruct.h" #include "pixmapstr.h" diff --git a/nx-X11/programs/Xserver/mi/mizerclip.c b/nx-X11/programs/Xserver/mi/mizerclip.c index e648b21d4..6acfc7fe0 100644 --- a/nx-X11/programs/Xserver/mi/mizerclip.c +++ b/nx-X11/programs/Xserver/mi/mizerclip.c @@ -49,7 +49,7 @@ SOFTWARE. #include #endif -#include +#include #include "misc.h" #include "scrnintstr.h" diff --git a/nx-X11/programs/Xserver/mi/mizerline.c b/nx-X11/programs/Xserver/mi/mizerline.c index 8e62a8c94..5a61ff5d6 100644 --- a/nx-X11/programs/Xserver/mi/mizerline.c +++ b/nx-X11/programs/Xserver/mi/mizerline.c @@ -50,7 +50,7 @@ SOFTWARE. #include #endif -#include +#include #include "misc.h" #include "scrnintstr.h" diff --git a/nx-X11/programs/Xserver/os/WaitFor.c b/nx-X11/programs/Xserver/os/WaitFor.c index d97d44ab6..0a18c28c8 100644 --- a/nx-X11/programs/Xserver/os/WaitFor.c +++ b/nx-X11/programs/Xserver/os/WaitFor.c @@ -78,19 +78,19 @@ SOFTWARE. #endif #ifdef WIN32 -#include +#include #endif -#include /* for strings, fcntl, time */ +#include /* for strings, fcntl, time */ #include #include -#include +#include #include "misc.h" #ifdef __UNIXOS2__ #define select(n,r,w,x,t) os2PseudoSelect(n,r,w,x,t) #endif #include "osdep.h" -#include +#include #include "dixstruct.h" #include "opaque.h" #ifdef DPMSExtension @@ -138,7 +138,7 @@ mffs(fd_mask mask) #ifdef DPMSExtension #define DPMS_SERVER -#include +#include #endif #ifdef XTESTEXT1 diff --git a/nx-X11/programs/Xserver/os/access.c b/nx-X11/programs/Xserver/os/access.c index 07b460f40..05dfaf38a 100644 --- a/nx-X11/programs/Xserver/os/access.c +++ b/nx-X11/programs/Xserver/os/access.c @@ -62,15 +62,15 @@ SOFTWARE. #endif #ifdef WIN32 -#include +#include #endif #include #include -#include -#include -#include -#include +#include +#include +#include +#include #include "misc.h" #include "site.h" #include @@ -197,14 +197,14 @@ SOFTWARE. #endif #define X_INCLUDE_NETDB_H -#include +#include #include "dixstruct.h" #include "osdep.h" #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifndef PATH_MAX diff --git a/nx-X11/programs/Xserver/os/auth.c b/nx-X11/programs/Xserver/os/auth.c index dfb6f8899..c14c1e874 100644 --- a/nx-X11/programs/Xserver/os/auth.c +++ b/nx-X11/programs/Xserver/os/auth.c @@ -57,8 +57,8 @@ from The Open Group. #ifdef K5AUTH # include #endif -# include -# include +# include +# include # include "misc.h" # include "osdep.h" # include "dixstruct.h" @@ -66,10 +66,10 @@ from The Open Group. # include #ifdef XCSECURITY #define _SECURITY_SERVER -# include +# include #endif #ifdef WIN32 -#include +#include #endif struct protocol { diff --git a/nx-X11/programs/Xserver/os/connection.c b/nx-X11/programs/Xserver/os/connection.c index 0f846d084..ef71cd540 100644 --- a/nx-X11/programs/Xserver/os/connection.c +++ b/nx-X11/programs/Xserver/os/connection.c @@ -68,14 +68,14 @@ SOFTWARE. #endif #ifdef WIN32 -#include +#include #endif -#include -#include +#include +#include #define XSERV_t #define TRANS_SERVER #define TRANS_REOPEN -#include +#include #include #include #include @@ -144,15 +144,15 @@ extern __const__ int _nfiles; #endif /* WIN32 */ #include "misc.h" #include "osdep.h" -#include +#include #include "opaque.h" #include "dixstruct.h" #ifdef XAPPGROUP -#include +#include #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef LBX #include "colormapst.h" diff --git a/nx-X11/programs/Xserver/os/io.c b/nx-X11/programs/Xserver/os/io.c index b92e7c4ae..ccfc01dfe 100644 --- a/nx-X11/programs/Xserver/os/io.c +++ b/nx-X11/programs/Xserver/os/io.c @@ -63,11 +63,11 @@ SOFTWARE. #define DEBUG_COMMUNICATION #endif #ifdef WIN32 -#include +#include #endif #include -#include -#include +#include +#include #include #if !defined(__UNIXOS2__) && !defined(WIN32) #ifndef Lynx @@ -76,12 +76,12 @@ SOFTWARE. #include #endif #endif -#include +#include #define NEED_REPLIES -#include +#include #include "os.h" #include "osdep.h" -#include +#include #include "opaque.h" #include "dixstruct.h" #include "misc.h" @@ -125,7 +125,7 @@ OsCommPtr AvailableInput = (OsCommPtr)NULL; lswaps((req)->length) : (req)->length) #ifdef BIGREQS -#include +#include #define get_big_req_len(req,cli) ((cli)->swapped ? \ lswapl(((xBigReq *)(req))->length) : \ diff --git a/nx-X11/programs/Xserver/os/k5auth.c b/nx-X11/programs/Xserver/os/k5auth.c index 3c50de032..f2ed5369d 100644 --- a/nx-X11/programs/Xserver/os/k5auth.c +++ b/nx-X11/programs/Xserver/os/k5auth.c @@ -54,11 +54,11 @@ from The Open Group. #undef BITS32 #undef xfree #include -#include +#include #include "os.h" #include "osdep.h" -#include -#include +#include +#include #include "dixstruct.h" #include #include "Xauth.h" diff --git a/nx-X11/programs/Xserver/os/log.c b/nx-X11/programs/Xserver/os/log.c index 9af39800f..2444cd333 100644 --- a/nx-X11/programs/Xserver/os/log.c +++ b/nx-X11/programs/Xserver/os/log.c @@ -99,7 +99,7 @@ OR PERFORMANCE OF THIS SOFTWARE. #include #endif -#include +#include #include #include #include diff --git a/nx-X11/programs/Xserver/os/mitauth.c b/nx-X11/programs/Xserver/os/mitauth.c index 2f42fd41f..abf7976af 100644 --- a/nx-X11/programs/Xserver/os/mitauth.c +++ b/nx-X11/programs/Xserver/os/mitauth.c @@ -37,7 +37,7 @@ from The Open Group. #include #endif -#include +#include #include "os.h" #include "osdep.h" #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/os/osdep.h b/nx-X11/programs/Xserver/os/osdep.h index e8c2d5959..e0c5de3a8 100644 --- a/nx-X11/programs/Xserver/os/osdep.h +++ b/nx-X11/programs/Xserver/os/osdep.h @@ -103,7 +103,7 @@ SOFTWARE. #endif #endif -#include +#include /* * MAXSOCKS is used only for initialising MaxClients when no other method diff --git a/nx-X11/programs/Xserver/os/osinit.c b/nx-X11/programs/Xserver/os/osinit.c index ea99ace21..ca707d4b2 100644 --- a/nx-X11/programs/Xserver/os/osinit.c +++ b/nx-X11/programs/Xserver/os/osinit.c @@ -52,10 +52,10 @@ SOFTWARE. #endif #include -#include +#include #include "os.h" #include "osdep.h" -#include +#include #ifdef SMART_SCHEDULE #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/os/rpcauth.c b/nx-X11/programs/Xserver/os/rpcauth.c index 896291e59..94c26651b 100644 --- a/nx-X11/programs/Xserver/os/rpcauth.c +++ b/nx-X11/programs/Xserver/os/rpcauth.c @@ -40,7 +40,7 @@ from The Open Group. #ifdef SECURE_RPC -#include +#include #include "Xauth.h" #include "misc.h" #include "os.h" diff --git a/nx-X11/programs/Xserver/os/secauth.c b/nx-X11/programs/Xserver/os/secauth.c index 1000b4e79..eadb17b40 100644 --- a/nx-X11/programs/Xserver/os/secauth.c +++ b/nx-X11/programs/Xserver/os/secauth.c @@ -30,7 +30,7 @@ from The Open Group. #include #endif -#include +#include #include "os.h" #include "osdep.h" #include "dixstruct.h" @@ -38,7 +38,7 @@ from The Open Group. #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif static char InvalidPolicyReason[] = "invalid policy specification"; diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index b09190c4e..3ab08897a 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -79,13 +79,13 @@ OR PERFORMANCE OF THIS SOFTWARE. #endif #if defined(WIN32) && !defined(__CYGWIN__) -#include +#include #endif -#include +#include #include #include "misc.h" -#include -#include +#include +#include #include "input.h" #include "dixfont.h" #include "osdep.h" @@ -136,11 +136,11 @@ OR PERFORMANCE OF THIS SOFTWARE. #endif #ifdef XKB -#include +#include #endif #ifdef XCSECURITY #define _SECURITY_SERVER -#include +#include #endif #ifdef RENDER @@ -258,7 +258,7 @@ Bool noXvExtension = FALSE; #endif #define X_INCLUDE_NETDB_H -#include +#include #include diff --git a/nx-X11/programs/Xserver/os/xalloc.c b/nx-X11/programs/Xserver/os/xalloc.c index a2487d4bc..4d2d3f1ee 100644 --- a/nx-X11/programs/Xserver/os/xalloc.c +++ b/nx-X11/programs/Xserver/os/xalloc.c @@ -39,9 +39,9 @@ Pascal Haible. #include /* for malloc() etc. */ -#include +#include #include "misc.h" -#include +#include #ifdef XALLOC_LOG #include diff --git a/nx-X11/programs/Xserver/os/xdmauth.c b/nx-X11/programs/Xserver/os/xdmauth.c index e02ca349c..92fbde478 100644 --- a/nx-X11/programs/Xserver/os/xdmauth.c +++ b/nx-X11/programs/Xserver/os/xdmauth.c @@ -40,8 +40,8 @@ from The Open Group. #endif #include -#include -#include +#include +#include #include "os.h" #include "osdep.h" #include "dixstruct.h" @@ -51,7 +51,7 @@ from The Open Group. static Bool authFromXDMCP; #ifdef XDMCP -#include +#include #undef REQUEST #include diff --git a/nx-X11/programs/Xserver/os/xdmcp.c b/nx-X11/programs/Xserver/os/xdmcp.c index 675e9c456..4181e52ce 100644 --- a/nx-X11/programs/Xserver/os/xdmcp.c +++ b/nx-X11/programs/Xserver/os/xdmcp.c @@ -21,10 +21,10 @@ #endif #ifdef WIN32 -#include +#include #endif -#include +#include #if !defined(WIN32) #ifndef Lynx @@ -39,10 +39,10 @@ #include #include -#include -#include +#include +#include #include "misc.h" -#include +#include #include "osdep.h" #include "input.h" #include "dixstruct.h" @@ -76,7 +76,7 @@ #include #define X_INCLUDE_NETDB_H -#include +#include #ifdef NX_TRANS_SOCKET diff --git a/nx-X11/programs/Xserver/os/xprintf.c b/nx-X11/programs/Xserver/os/xprintf.c index 54bbeefe2..4423208ff 100644 --- a/nx-X11/programs/Xserver/os/xprintf.c +++ b/nx-X11/programs/Xserver/os/xprintf.c @@ -30,7 +30,7 @@ #include #endif -#include +#include #include "os.h" #include #include diff --git a/nx-X11/programs/Xserver/randr/randrproto.h b/nx-X11/programs/Xserver/randr/randrproto.h index 7d5c139e9..bded957fa 100644 --- a/nx-X11/programs/Xserver/randr/randrproto.h +++ b/nx-X11/programs/Xserver/randr/randrproto.h @@ -30,7 +30,7 @@ #ifndef _XRANDRP_H_ #define _XRANDRP_H_ -/*#include */ +/*#include */ #include "randr.h" #define Window CARD32 diff --git a/nx-X11/programs/Xserver/randr/randrstr.h b/nx-X11/programs/Xserver/randr/randrstr.h index 3c3db2c13..bab784b8f 100644 --- a/nx-X11/programs/Xserver/randr/randrstr.h +++ b/nx-X11/programs/Xserver/randr/randrstr.h @@ -32,8 +32,8 @@ #ifndef _RANDRSTR_H_ #define _RANDRSTR_H_ -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -44,17 +44,17 @@ #include "extnsionst.h" #include "servermd.h" #ifndef NXAGENT_SERVER -#include -#include +#include +#include #else #include "randr.h" #include "randrproto.h" #endif #ifdef RENDER -#include /* we share subpixel order information */ +#include /* we share subpixel order information */ #include "picturestr.h" #endif -#include +#include /* required for ABI compatibility for now */ #define RANDR_10_INTERFACE 1 diff --git a/nx-X11/programs/Xserver/randr/rrxinerama.c b/nx-X11/programs/Xserver/randr/rrxinerama.c index 5441f8abc..2bc17cf21 100644 --- a/nx-X11/programs/Xserver/randr/rrxinerama.c +++ b/nx-X11/programs/Xserver/randr/rrxinerama.c @@ -88,7 +88,7 @@ #include "randrstr.h" #include "swaprep.h" #ifndef NXAGENT_SERVER -#include +#include #else #include "panoramiXproto.h" #endif diff --git a/nx-X11/programs/Xserver/record/record.c b/nx-X11/programs/Xserver/record/record.c index aa1cd7543..2c5b867b4 100644 --- a/nx-X11/programs/Xserver/record/record.c +++ b/nx-X11/programs/Xserver/record/record.c @@ -43,7 +43,7 @@ and Jim Haggerty of Metheus. #include "dixstruct.h" #include "extnsionst.h" #define _XRECORD_SERVER_ -#include +#include #include "set.h" #ifndef XFree86LOADER diff --git a/nx-X11/programs/Xserver/render/animcur.c b/nx-X11/programs/Xserver/render/animcur.c index 15293af64..27e5ab949 100644 --- a/nx-X11/programs/Xserver/render/animcur.c +++ b/nx-X11/programs/Xserver/render/animcur.c @@ -36,8 +36,8 @@ #include #endif -#include -#include +#include +#include #include "servermd.h" #include "scrnintstr.h" #include "dixstruct.h" diff --git a/nx-X11/programs/Xserver/render/glyphstr.h b/nx-X11/programs/Xserver/render/glyphstr.h index e9bbd19b0..f27a73fbb 100644 --- a/nx-X11/programs/Xserver/render/glyphstr.h +++ b/nx-X11/programs/Xserver/render/glyphstr.h @@ -26,7 +26,7 @@ #ifndef _GLYPHSTR_H_ #define _GLYPHSTR_H_ -#include +#include #include "picture.h" #include "screenint.h" diff --git a/nx-X11/programs/Xserver/render/render.c b/nx-X11/programs/Xserver/render/render.c index 8d644b35e..2dedbc9c4 100644 --- a/nx-X11/programs/Xserver/render/render.c +++ b/nx-X11/programs/Xserver/render/render.c @@ -30,8 +30,8 @@ #include #endif -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" @@ -42,11 +42,11 @@ #include "colormapst.h" #include "extnsionst.h" #include "servermd.h" -#include -#include +#include +#include #include "picturestr.h" #include "glyphstr.h" -#include +#include #include "cursorstr.h" #ifdef EXTMODULE #include "xf86_ansic.h" diff --git a/nx-X11/programs/Xserver/xfixes/xfixesint.h b/nx-X11/programs/Xserver/xfixes/xfixesint.h index 4892654be..a883acaec 100755 --- a/nx-X11/programs/Xserver/xfixes/xfixesint.h +++ b/nx-X11/programs/Xserver/xfixes/xfixesint.h @@ -30,13 +30,13 @@ #define _XFIXESINT_H_ #define NEED_EVENTS -#include -#include +#include +#include #include "misc.h" #include "os.h" #include "dixstruct.h" #include "extnsionst.h" -#include +#include #include "windowstr.h" #include "selection.h" #include "xfixes.h" diff --git a/nx-X11/programs/Xserver/xkb/ddxBeep.c b/nx-X11/programs/Xserver/xkb/ddxBeep.c index 22d62a502..e99e4c2dd 100644 --- a/nx-X11/programs/Xserver/xkb/ddxBeep.c +++ b/nx-X11/programs/Xserver/xkb/ddxBeep.c @@ -32,14 +32,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include #if (defined(__osf__) && defined(__alpha)) #include diff --git a/nx-X11/programs/Xserver/xkb/ddxConfig.c b/nx-X11/programs/Xserver/xkb/ddxConfig.c index b023531dc..8ffd344ca 100644 --- a/nx-X11/programs/Xserver/xkb/ddxConfig.c +++ b/nx-X11/programs/Xserver/xkb/ddxConfig.c @@ -32,16 +32,16 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #include "os.h" #define XKBSRV_NEED_FILE_FUNCS -#include -#include +#include +#include Bool XkbDDXApplyConfig(XPointer cfg_in,XkbSrvInfoPtr info) diff --git a/nx-X11/programs/Xserver/xkb/ddxCtrls.c b/nx-X11/programs/Xserver/xkb/ddxCtrls.c index 2e4e106ce..9fee8aa30 100644 --- a/nx-X11/programs/Xserver/xkb/ddxCtrls.c +++ b/nx-X11/programs/Xserver/xkb/ddxCtrls.c @@ -32,14 +32,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include void XkbDDXKeybdCtrlProc(DeviceIntPtr dev,KeybdCtrl *ctrl) diff --git a/nx-X11/programs/Xserver/xkb/ddxDevBtn.c b/nx-X11/programs/Xserver/xkb/ddxDevBtn.c index d0e37f263..04094e787 100644 --- a/nx-X11/programs/Xserver/xkb/ddxDevBtn.c +++ b/nx-X11/programs/Xserver/xkb/ddxDevBtn.c @@ -32,15 +32,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include -#include +#include +#include +#include extern int DeviceValuator; diff --git a/nx-X11/programs/Xserver/xkb/ddxFakeBtn.c b/nx-X11/programs/Xserver/xkb/ddxFakeBtn.c index 73c8a2415..b77d040ff 100644 --- a/nx-X11/programs/Xserver/xkb/ddxFakeBtn.c +++ b/nx-X11/programs/Xserver/xkb/ddxFakeBtn.c @@ -32,14 +32,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include void XkbDDXFakePointerButton(int event,int button) diff --git a/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c b/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c index ffd6f5d79..33fa49ae7 100644 --- a/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c +++ b/nx-X11/programs/Xserver/xkb/ddxFakeMtn.c @@ -33,14 +33,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include #ifdef PANORAMIX #include "panoramiX.h" diff --git a/nx-X11/programs/Xserver/xkb/ddxInit.c b/nx-X11/programs/Xserver/xkb/ddxInit.c index 8b76b7cb1..00ffea14e 100644 --- a/nx-X11/programs/Xserver/xkb/ddxInit.c +++ b/nx-X11/programs/Xserver/xkb/ddxInit.c @@ -32,14 +32,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include int XkbDDXInitDevice(DeviceIntPtr dev) diff --git a/nx-X11/programs/Xserver/xkb/ddxKeyClick.c b/nx-X11/programs/Xserver/xkb/ddxKeyClick.c index c940e5321..e56377ca5 100644 --- a/nx-X11/programs/Xserver/xkb/ddxKeyClick.c +++ b/nx-X11/programs/Xserver/xkb/ddxKeyClick.c @@ -32,14 +32,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include void XkbDDXKeyClick(DeviceIntPtr pXDev,int keycode,int synthetic) diff --git a/nx-X11/programs/Xserver/xkb/ddxKillSrv.c b/nx-X11/programs/Xserver/xkb/ddxKillSrv.c index b78dc420d..44fad85ca 100644 --- a/nx-X11/programs/Xserver/xkb/ddxKillSrv.c +++ b/nx-X11/programs/Xserver/xkb/ddxKillSrv.c @@ -36,14 +36,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include #ifdef XF86DDXACTIONS #include "xf86.h" diff --git a/nx-X11/programs/Xserver/xkb/ddxLEDs.c b/nx-X11/programs/Xserver/xkb/ddxLEDs.c index fb5f72bf8..92ab12ee8 100644 --- a/nx-X11/programs/Xserver/xkb/ddxLEDs.c +++ b/nx-X11/programs/Xserver/xkb/ddxLEDs.c @@ -32,14 +32,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include void XkbDDXUpdateIndicators(DeviceIntPtr dev,CARD32 new) diff --git a/nx-X11/programs/Xserver/xkb/ddxList.c b/nx-X11/programs/Xserver/xkb/ddxList.c index 9c961e934..3dfb85644 100644 --- a/nx-X11/programs/Xserver/xkb/ddxList.c +++ b/nx-X11/programs/Xserver/xkb/ddxList.c @@ -33,17 +33,17 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include -#include +#include +#include #ifndef PATH_MAX #ifdef MAXPATHLEN diff --git a/nx-X11/programs/Xserver/xkb/ddxLoad.c b/nx-X11/programs/Xserver/xkb/ddxLoad.c index 7caf9b1cb..16343fc9c 100644 --- a/nx-X11/programs/Xserver/xkb/ddxLoad.c +++ b/nx-X11/programs/Xserver/xkb/ddxLoad.c @@ -44,17 +44,17 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include -#include +#include +#include #include "xkb.h" #if defined(CSRG_BASED) || defined(linux) || defined(__sgi) || defined(AIXV3) || defined(__osf__) || defined(__GNU__) @@ -94,7 +94,7 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #ifdef WIN32 -#include +#include const char* Win32TempDir() { diff --git a/nx-X11/programs/Xserver/xkb/ddxPrivate.c b/nx-X11/programs/Xserver/xkb/ddxPrivate.c index 5c0bca4cd..c71216d70 100644 --- a/nx-X11/programs/Xserver/xkb/ddxPrivate.c +++ b/nx-X11/programs/Xserver/xkb/ddxPrivate.c @@ -10,10 +10,10 @@ #include #define NEED_EVENTS 1 -#include +#include #include "windowstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #ifdef XF86DDXACTIONS #include "xf86.h" diff --git a/nx-X11/programs/Xserver/xkb/ddxVT.c b/nx-X11/programs/Xserver/xkb/ddxVT.c index 1b7853fa0..1806ed257 100644 --- a/nx-X11/programs/Xserver/xkb/ddxVT.c +++ b/nx-X11/programs/Xserver/xkb/ddxVT.c @@ -36,14 +36,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" #include "scrnintstr.h" #include "windowstr.h" -#include -#include +#include +#include #ifdef XF86DDXACTIONS #include "xf86.h" diff --git a/nx-X11/programs/Xserver/xkb/xkb.c b/nx-X11/programs/Xserver/xkb/xkb.c index 441d88a5c..4a1561db3 100644 --- a/nx-X11/programs/Xserver/xkb/xkb.c +++ b/nx-X11/programs/Xserver/xkb/xkb.c @@ -31,18 +31,18 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #endif #include -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include +#include #include "extnsionst.h" #include "xkb.h" -#include +#include int XkbEventBase; int XkbErrorBase; @@ -3916,7 +3916,7 @@ ProcXkbSetNames(ClientPtr client) /***====================================================================***/ -#include +#include #define XkbSizeCountedString(s) ((s)?((((2+strlen(s))+3)/4)*4):4) diff --git a/nx-X11/programs/Xserver/xkb/xkbAccessX.c b/nx-X11/programs/Xserver/xkb/xkbAccessX.c index 75e46dc32..ac5713d05 100644 --- a/nx-X11/programs/Xserver/xkb/xkbAccessX.c +++ b/nx-X11/programs/Xserver/xkb/xkbAccessX.c @@ -36,11 +36,11 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #endif #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "inputstr.h" -#include +#include #if !defined(WIN32) && !defined(Lynx) #include #endif diff --git a/nx-X11/programs/Xserver/xkb/xkbActions.c b/nx-X11/programs/Xserver/xkb/xkbActions.c index b7f3e13a5..eb1c80448 100644 --- a/nx-X11/programs/Xserver/xkb/xkbActions.c +++ b/nx-X11/programs/Xserver/xkb/xkbActions.c @@ -34,12 +34,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "misc.h" #include "inputstr.h" -#include +#include #include "xkb.h" #include diff --git a/nx-X11/programs/Xserver/xkb/xkbEvents.c b/nx-X11/programs/Xserver/xkb/xkbEvents.c index ca201c6f0..6c0aa0761 100644 --- a/nx-X11/programs/Xserver/xkb/xkbEvents.c +++ b/nx-X11/programs/Xserver/xkb/xkbEvents.c @@ -32,13 +32,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #define NEED_EVENTS 1 -#include -#include -#include -#include +#include +#include +#include +#include #include "inputstr.h" #include "windowstr.h" -#include +#include #include "xkb.h" /***====================================================================***/ diff --git a/nx-X11/programs/Xserver/xkb/xkbInit.c b/nx-X11/programs/Xserver/xkb/xkbInit.c index ef7e6a4f7..9afe0dacc 100644 --- a/nx-X11/programs/Xserver/xkb/xkbInit.c +++ b/nx-X11/programs/Xserver/xkb/xkbInit.c @@ -41,19 +41,19 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include -#include -#include +#include +#include +#include +#include #include "misc.h" #include "inputstr.h" #include "opaque.h" #include "property.h" #define XKBSRV_NEED_FILE_FUNCS -#include -#include -#include -#include +#include +#include +#include +#include #include "xkb.h" #define CREATE_ATOM(s) MakeAtom(s,sizeof(s)-1,1) diff --git a/nx-X11/programs/Xserver/xkb/xkbLEDs.c b/nx-X11/programs/Xserver/xkb/xkbLEDs.c index e04c05f14..20203ef2c 100644 --- a/nx-X11/programs/Xserver/xkb/xkbLEDs.c +++ b/nx-X11/programs/Xserver/xkb/xkbLEDs.c @@ -34,13 +34,13 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include +#include +#include #include "misc.h" #include "inputstr.h" -#include -#include +#include +#include #include "xkb.h" /***====================================================================***/ diff --git a/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c b/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c index 713995d16..330fd2800 100644 --- a/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c +++ b/nx-X11/programs/Xserver/xkb/xkbPrKeyEv.c @@ -33,12 +33,12 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "misc.h" #include "inputstr.h" -#include +#include #include diff --git a/nx-X11/programs/Xserver/xkb/xkbPrOtherEv.c b/nx-X11/programs/Xserver/xkb/xkbPrOtherEv.c index 82f476790..ac601c525 100644 --- a/nx-X11/programs/Xserver/xkb/xkbPrOtherEv.c +++ b/nx-X11/programs/Xserver/xkb/xkbPrOtherEv.c @@ -33,15 +33,15 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include -#include +#include +#include +#include #include "misc.h" #include "inputstr.h" -#include +#include -#include -#include +#include +#include extern void ProcessOtherEvent( xEvent * /* xE */, diff --git a/nx-X11/programs/Xserver/xkb/xkbSwap.c b/nx-X11/programs/Xserver/xkb/xkbSwap.c index be1cd94fc..c16209153 100644 --- a/nx-X11/programs/Xserver/xkb/xkbSwap.c +++ b/nx-X11/programs/Xserver/xkb/xkbSwap.c @@ -31,14 +31,14 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #endif #include "stdio.h" -#include +#include #define NEED_EVENTS #define NEED_REPLIES -#include +#include #include "misc.h" #include "inputstr.h" -#include -#include +#include +#include #include "extnsionst.h" #include "xkb.h" diff --git a/nx-X11/programs/Xserver/xkb/xkbUtils.c b/nx-X11/programs/Xserver/xkb/xkbUtils.c index f3c3ff8ca..465644f16 100644 --- a/nx-X11/programs/Xserver/xkb/xkbUtils.c +++ b/nx-X11/programs/Xserver/xkb/xkbUtils.c @@ -34,16 +34,16 @@ THE USE OR PERFORMANCE OF THIS SOFTWARE. #include #include #define NEED_EVENTS 1 -#include -#include +#include +#include #define XK_CYRILLIC -#include +#include #include "misc.h" #include "inputstr.h" #define XKBSRV_NEED_FILE_FUNCS -#include -#include +#include +#include #include "xkb.h" #ifdef MODE_SWITCH diff --git a/nx-X11/programs/nxauth/gethost.c b/nx-X11/programs/nxauth/gethost.c index cab2aea9f..fa889f29b 100644 --- a/nx-X11/programs/nxauth/gethost.c +++ b/nx-X11/programs/nxauth/gethost.c @@ -36,10 +36,10 @@ in this Software without prior written authorization from The Open Group. #endif #ifdef WIN32 -#include +#include #define EPROTOTYPE WSAEPROTOTYPE #endif -#include +#include #include #include #include diff --git a/nx-X11/programs/nxauth/parsedpy.c b/nx-X11/programs/nxauth/parsedpy.c index 8ce46815c..d0f022574 100644 --- a/nx-X11/programs/nxauth/parsedpy.c +++ b/nx-X11/programs/nxauth/parsedpy.c @@ -49,12 +49,12 @@ in this Software without prior written authorization from The Open Group. #include /* for NULL */ #include /* for isascii() and isdigit() */ -#include /* for strchr() and string routines */ -#include /* for Family contants */ +#include /* for strchr() and string routines */ +#include /* for Family contants */ #ifdef hpux #include /* for struct utsname */ #endif -#include /* for FamilyLocal */ +#include /* for FamilyLocal */ #if defined(UNIXCONN) || defined(LOCALCONN) #define UNIX_CONNECTION "unix" diff --git a/nx-X11/programs/nxauth/process.c b/nx-X11/programs/nxauth/process.c index 76259d76a..86aba2b2a 100644 --- a/nx-X11/programs/nxauth/process.c +++ b/nx-X11/programs/nxauth/process.c @@ -55,10 +55,10 @@ from The Open Group. #include #include -/*#include */ /* for Family constants */ +/*#include */ /* for Family constants */ /* -#include -#include +#include +#include */ /*FIXME*/ diff --git a/nx-X11/programs/nxauth/xauth.h b/nx-X11/programs/nxauth/xauth.h index 33a6c4e3b..4f8490070 100644 --- a/nx-X11/programs/nxauth/xauth.h +++ b/nx-X11/programs/nxauth/xauth.h @@ -29,9 +29,9 @@ in this Software without prior written authorization from The Open Group. /* $XFree86: xc/programs/xauth/xauth.h,v 1.6 2001/12/14 20:01:15 dawes Exp $ */ #include -#include -#include -#include +#include +#include +#include #ifndef True typedef int Bool; diff --git a/nx-libs.spec b/nx-libs.spec index 6eed3691a..a9afb7ec8 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -616,11 +616,11 @@ ln -sf ../../nx/bin/nxagent %{buildroot}%{_libdir}/x2go/bin/x2goagent chmod 755 %{buildroot}%{_libdir}/lib*.so* #Remove extras, GL, and other unneeded headers -rm -r %{buildroot}%{_includedir}/nx/GL -rm -r %{buildroot}%{_includedir}/nx/X11/extensions/XInput.h -rm -r %{buildroot}%{_includedir}/nx/X11/extensions/XK*.h -rm -r %{buildroot}%{_includedir}/nx/X11/extensions/*Xv*.h -rm -r %{buildroot}%{_includedir}/nx/X11/Xtrans +rm -r %{buildroot}%{_includedir}/GL +rm -r %{buildroot}%{_includedir}/nx-X11/extensions/XInput.h +rm -r %{buildroot}%{_includedir}/nx-X11/extensions/XK*.h +rm -r %{buildroot}%{_includedir}/nx-X11/extensions/*Xv*.h +rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans # Needed for Xinerama support ln -s -f ../../../../%{_lib}/libX11.so.6 %{buildroot}%{_libdir}/nx/X11/Xinerama/libNX_X11.so.6 @@ -673,23 +673,23 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %defattr(-,root,root) %{_libdir}/libNX_X11.so %dir %{_includedir}/nx -%dir %{_includedir}/nx/X11 -%{_includedir}/nx/X11/ImUtil.h -%{_includedir}/nx/X11/XKBlib.h -%{_includedir}/nx/X11/Xcms.h -%{_includedir}/nx/X11/Xlib.h -%{_includedir}/nx/X11/XlibConf.h -%{_includedir}/nx/X11/Xlibint.h -%{_includedir}/nx/X11/Xlocale.h -%{_includedir}/nx/X11/Xregion.h -%{_includedir}/nx/X11/Xresource.h -%{_includedir}/nx/X11/Xutil.h -%{_includedir}/nx/X11/cursorfont.h +%dir %{_includedir}/nx-X11 +%{_includedir}/nx-X11/ImUtil.h +%{_includedir}/nx-X11/XKBlib.h +%{_includedir}/nx-X11/Xcms.h +%{_includedir}/nx-X11/Xlib.h +%{_includedir}/nx-X11/XlibConf.h +%{_includedir}/nx-X11/Xlibint.h +%{_includedir}/nx-X11/Xlocale.h +%{_includedir}/nx-X11/Xregion.h +%{_includedir}/nx-X11/Xresource.h +%{_includedir}/nx-X11/Xutil.h +%{_includedir}/nx-X11/cursorfont.h %files -n libNX_Xau-devel %defattr(-,root,root) %{_libdir}/libNX_Xau.so -%{_includedir}/nx/X11/Xauth.h +%{_includedir}/nx-X11/Xauth.h %files -n libNX_Xau6 %defattr(-,root,root) @@ -702,33 +702,33 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %files -n libNX_Xext-devel %defattr(-,root,root) %{_libdir}/libNX_Xext.so -%dir %{_includedir}/nx/X11/extensions -%{_includedir}/nx/X11/extensions/MITMisc.h -%{_includedir}/nx/X11/extensions/XEVI.h -%{_includedir}/nx/X11/extensions/XEVIstr.h -%{_includedir}/nx/X11/extensions/XLbx.h -%{_includedir}/nx/X11/extensions/XShm.h -%{_includedir}/nx/X11/extensions/Xag.h -%{_includedir}/nx/X11/extensions/Xagsrv.h -%{_includedir}/nx/X11/extensions/Xagstr.h -%{_includedir}/nx/X11/extensions/Xcup.h -%{_includedir}/nx/X11/extensions/Xcupstr.h -%{_includedir}/nx/X11/extensions/Xdbe.h -%{_includedir}/nx/X11/extensions/Xdbeproto.h -%{_includedir}/nx/X11/extensions/Xext.h -%{_includedir}/nx/X11/extensions/dpms.h -%{_includedir}/nx/X11/extensions/dpmsstr.h -%{_includedir}/nx/X11/extensions/extutil.h -%{_includedir}/nx/X11/extensions/lbxstr.h -%{_includedir}/nx/X11/extensions/mitmiscstr.h -%{_includedir}/nx/X11/extensions/multibuf.h -%{_includedir}/nx/X11/extensions/multibufst.h -%{_includedir}/nx/X11/extensions/security.h -%{_includedir}/nx/X11/extensions/securstr.h -%{_includedir}/nx/X11/extensions/shape.h -%{_includedir}/nx/X11/extensions/sync.h -%{_includedir}/nx/X11/extensions/xtestext1.h -%{_includedir}/nx/X11/extensions/xteststr.h +%dir %{_includedir}/nx-X11/extensions +%{_includedir}/nx-X11/extensions/MITMisc.h +%{_includedir}/nx-X11/extensions/XEVI.h +%{_includedir}/nx-X11/extensions/XEVIstr.h +%{_includedir}/nx-X11/extensions/XLbx.h +%{_includedir}/nx-X11/extensions/XShm.h +%{_includedir}/nx-X11/extensions/Xag.h +%{_includedir}/nx-X11/extensions/Xagsrv.h +%{_includedir}/nx-X11/extensions/Xagstr.h +%{_includedir}/nx-X11/extensions/Xcup.h +%{_includedir}/nx-X11/extensions/Xcupstr.h +%{_includedir}/nx-X11/extensions/Xdbe.h +%{_includedir}/nx-X11/extensions/Xdbeproto.h +%{_includedir}/nx-X11/extensions/Xext.h +%{_includedir}/nx-X11/extensions/dpms.h +%{_includedir}/nx-X11/extensions/dpmsstr.h +%{_includedir}/nx-X11/extensions/extutil.h +%{_includedir}/nx-X11/extensions/lbxstr.h +%{_includedir}/nx-X11/extensions/mitmiscstr.h +%{_includedir}/nx-X11/extensions/multibuf.h +%{_includedir}/nx-X11/extensions/multibufst.h +%{_includedir}/nx-X11/extensions/security.h +%{_includedir}/nx-X11/extensions/securstr.h +%{_includedir}/nx-X11/extensions/shape.h +%{_includedir}/nx-X11/extensions/sync.h +%{_includedir}/nx-X11/extensions/xtestext1.h +%{_includedir}/nx-X11/extensions/xteststr.h %files -n libNX_Xext6 %defattr(-,root,root) @@ -737,7 +737,7 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %files -n libNX_Xfixes-devel %defattr(-,root,root) %{_libdir}/libNX_Xfixes.so -%{_includedir}/nx/X11/extensions/Xfixes.h +%{_includedir}/nx-X11/extensions/Xfixes.h %files -n libNX_Xfixes3 %defattr(-,root,root) @@ -818,83 +818,83 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %{_libdir}/libNX_Xcomposite.so %{_libdir}/libNX_Xinerama.so %{_libdir}/libNX_Xtst.so -%{_includedir}/nx/X11/X10.h -%dir %{_includedir}/nx/X11/extensions -%{_includedir}/nx/X11/extensions/XTest.h -%{_includedir}/nx/X11/extensions/Xcomposite.h -%{_includedir}/nx/X11/extensions/Xevie.h -%{_includedir}/nx/X11/extensions/Xinerama.h -%{_includedir}/nx/X11/extensions/lbxbuf.h -%{_includedir}/nx/X11/extensions/lbxbufstr.h -%{_includedir}/nx/X11/extensions/lbxdeltastr.h -%{_includedir}/nx/X11/extensions/lbximage.h -%{_includedir}/nx/X11/extensions/lbxopts.h -%{_includedir}/nx/X11/extensions/lbxzlib.h -%{_includedir}/nx/X11/extensions/panoramiXext.h -%{_includedir}/nx/X11/extensions/record.h -%{_includedir}/nx/X11/extensions/xf86dga1.h -%{_includedir}/nx/X11/extensions/xf86vmode.h -%{_includedir}/nx/X11/misc.h -%{_includedir}/nx/X11/os.h +%{_includedir}/nx-X11/X10.h +%dir %{_includedir}/nx-X11/extensions +%{_includedir}/nx-X11/extensions/XTest.h +%{_includedir}/nx-X11/extensions/Xcomposite.h +%{_includedir}/nx-X11/extensions/Xevie.h +%{_includedir}/nx-X11/extensions/Xinerama.h +%{_includedir}/nx-X11/extensions/lbxbuf.h +%{_includedir}/nx-X11/extensions/lbxbufstr.h +%{_includedir}/nx-X11/extensions/lbxdeltastr.h +%{_includedir}/nx-X11/extensions/lbximage.h +%{_includedir}/nx-X11/extensions/lbxopts.h +%{_includedir}/nx-X11/extensions/lbxzlib.h +%{_includedir}/nx-X11/extensions/panoramiXext.h +%{_includedir}/nx-X11/extensions/record.h +%{_includedir}/nx-X11/extensions/xf86dga1.h +%{_includedir}/nx-X11/extensions/xf86vmode.h +%{_includedir}/nx-X11/misc.h +%{_includedir}/nx-X11/os.h %files -n nx-proto-devel %defattr(-,root,root) -%dir %{_includedir}/nx/X11 -%{_includedir}/nx/X11/DECkeysym.h -%{_includedir}/nx/X11/HPkeysym.h -%{_includedir}/nx/X11/Sunkeysym.h -%{_includedir}/nx/X11/X.h -%{_includedir}/nx/X11/XF86keysym.h -%{_includedir}/nx/X11/XWDFile.h -%{_includedir}/nx/X11/Xalloca.h -%{_includedir}/nx/X11/Xarch.h -%{_includedir}/nx/X11/Xatom.h -%{_includedir}/nx/X11/Xdefs.h -%{_includedir}/nx/X11/Xfuncproto.h -%{_includedir}/nx/X11/Xfuncs.h -%{_includedir}/nx/X11/Xmd.h -%{_includedir}/nx/X11/Xos.h -%{_includedir}/nx/X11/Xos_r.h -%{_includedir}/nx/X11/Xosdefs.h -%{_includedir}/nx/X11/Xpoll.h -%{_includedir}/nx/X11/Xproto.h -%{_includedir}/nx/X11/Xprotostr.h -%{_includedir}/nx/X11/Xthreads.h -%{_includedir}/nx/X11/ap_keysym.h -%{_includedir}/nx/X11/keysym.h -%{_includedir}/nx/X11/keysymdef.h -%{_includedir}/nx/X11/extensions/XI.h -%{_includedir}/nx/X11/extensions/XIproto.h -%{_includedir}/nx/X11/extensions/XResproto.h -%{_includedir}/nx/X11/extensions/Xeviestr.h -%{_includedir}/nx/X11/extensions/bigreqstr.h -%{_includedir}/nx/X11/extensions/composite.h -%{_includedir}/nx/X11/extensions/compositeproto.h -%{_includedir}/nx/X11/extensions/panoramiXproto.h -%{_includedir}/nx/X11/extensions/recordstr.h -%{_includedir}/nx/X11/extensions/render.h -%{_includedir}/nx/X11/extensions/renderproto.h -%{_includedir}/nx/X11/extensions/shapestr.h -%{_includedir}/nx/X11/extensions/shmstr.h -%{_includedir}/nx/X11/extensions/syncstr.h -%{_includedir}/nx/X11/extensions/xcmiscstr.h -%{_includedir}/nx/X11/extensions/xf86bigfont.h -%{_includedir}/nx/X11/extensions/xf86bigfstr.h -%{_includedir}/nx/X11/extensions/xf86dga.h -%{_includedir}/nx/X11/extensions/xf86dga1str.h -%{_includedir}/nx/X11/extensions/xf86dgastr.h -%{_includedir}/nx/X11/extensions/xf86misc.h -%{_includedir}/nx/X11/extensions/xf86mscstr.h -%{_includedir}/nx/X11/extensions/xf86vmstr.h -%{_includedir}/nx/X11/extensions/xfixesproto.h -%{_includedir}/nx/X11/extensions/xfixeswire.h -%{_includedir}/nx/X11/extensions/xtrapbits.h -%{_includedir}/nx/X11/extensions/xtrapddmi.h -%{_includedir}/nx/X11/extensions/xtrapdi.h -%{_includedir}/nx/X11/extensions/xtrapemacros.h -%{_includedir}/nx/X11/extensions/xtraplib.h -%{_includedir}/nx/X11/extensions/xtraplibp.h -%{_includedir}/nx/X11/extensions/xtrapproto.h +%dir %{_includedir}/nx-X11 +%{_includedir}/nx-X11/DECkeysym.h +%{_includedir}/nx-X11/HPkeysym.h +%{_includedir}/nx-X11/Sunkeysym.h +%{_includedir}/nx-X11/X.h +%{_includedir}/nx-X11/XF86keysym.h +%{_includedir}/nx-X11/XWDFile.h +%{_includedir}/nx-X11/Xalloca.h +%{_includedir}/nx-X11/Xarch.h +%{_includedir}/nx-X11/Xatom.h +%{_includedir}/nx-X11/Xdefs.h +%{_includedir}/nx-X11/Xfuncproto.h +%{_includedir}/nx-X11/Xfuncs.h +%{_includedir}/nx-X11/Xmd.h +%{_includedir}/nx-X11/Xos.h +%{_includedir}/nx-X11/Xos_r.h +%{_includedir}/nx-X11/Xosdefs.h +%{_includedir}/nx-X11/Xpoll.h +%{_includedir}/nx-X11/Xproto.h +%{_includedir}/nx-X11/Xprotostr.h +%{_includedir}/nx-X11/Xthreads.h +%{_includedir}/nx-X11/ap_keysym.h +%{_includedir}/nx-X11/keysym.h +%{_includedir}/nx-X11/keysymdef.h +%{_includedir}/nx-X11/extensions/XI.h +%{_includedir}/nx-X11/extensions/XIproto.h +%{_includedir}/nx-X11/extensions/XResproto.h +%{_includedir}/nx-X11/extensions/Xeviestr.h +%{_includedir}/nx-X11/extensions/bigreqstr.h +%{_includedir}/nx-X11/extensions/composite.h +%{_includedir}/nx-X11/extensions/compositeproto.h +%{_includedir}/nx-X11/extensions/panoramiXproto.h +%{_includedir}/nx-X11/extensions/recordstr.h +%{_includedir}/nx-X11/extensions/render.h +%{_includedir}/nx-X11/extensions/renderproto.h +%{_includedir}/nx-X11/extensions/shapestr.h +%{_includedir}/nx-X11/extensions/shmstr.h +%{_includedir}/nx-X11/extensions/syncstr.h +%{_includedir}/nx-X11/extensions/xcmiscstr.h +%{_includedir}/nx-X11/extensions/xf86bigfont.h +%{_includedir}/nx-X11/extensions/xf86bigfstr.h +%{_includedir}/nx-X11/extensions/xf86dga.h +%{_includedir}/nx-X11/extensions/xf86dga1str.h +%{_includedir}/nx-X11/extensions/xf86dgastr.h +%{_includedir}/nx-X11/extensions/xf86misc.h +%{_includedir}/nx-X11/extensions/xf86mscstr.h +%{_includedir}/nx-X11/extensions/xf86vmstr.h +%{_includedir}/nx-X11/extensions/xfixesproto.h +%{_includedir}/nx-X11/extensions/xfixeswire.h +%{_includedir}/nx-X11/extensions/xtrapbits.h +%{_includedir}/nx-X11/extensions/xtrapddmi.h +%{_includedir}/nx-X11/extensions/xtrapdi.h +%{_includedir}/nx-X11/extensions/xtrapemacros.h +%{_includedir}/nx-X11/extensions/xtraplib.h +%{_includedir}/nx-X11/extensions/xtraplibp.h +%{_includedir}/nx-X11/extensions/xtrapproto.h %files -n nxagent %defattr(-,root,root) diff --git a/nxcompext/Jpeg.c b/nxcompext/Jpeg.c index cb854bc6c..d6a94cc80 100644 --- a/nxcompext/Jpeg.c +++ b/nxcompext/Jpeg.c @@ -19,9 +19,9 @@ #include #include -#include "X11/X.h" -#include "X11/Xlib.h" -#include "X11/Xmd.h" +#include +#include +#include #include diff --git a/nxcompext/NXlib.h b/nxcompext/NXlib.h index d77ff6046..15661b439 100644 --- a/nxcompext/NXlib.h +++ b/nxcompext/NXlib.h @@ -22,8 +22,8 @@ extern "C" { #endif -#include -#include +#include +#include #include "NX.h" #include "NXpack.h" diff --git a/nxcompext/Pgn.h b/nxcompext/Pgn.h index 999e8ea01..075d2bc1e 100644 --- a/nxcompext/Pgn.h +++ b/nxcompext/Pgn.h @@ -22,9 +22,9 @@ extern "C" { #endif -#include "X11/X.h" -#include "X11/Xlib.h" -#include "X11/Xmd.h" +#include +#include +#include #include diff --git a/nxcompshad/Input.h b/nxcompshad/Input.h index 6250e790b..88217c9b1 100644 --- a/nxcompshad/Input.h +++ b/nxcompshad/Input.h @@ -18,7 +18,7 @@ #ifndef Input_H #define Input_H -#include +#include typedef struct Event { diff --git a/nxcompshad/Manager.cpp b/nxcompshad/Manager.cpp index ba9260a13..3b5504a1f 100644 --- a/nxcompshad/Manager.cpp +++ b/nxcompshad/Manager.cpp @@ -15,9 +15,9 @@ /* */ /**************************************************************************/ -#include -#include -#include +#include +#include +#include #include #define PANIC diff --git a/nxcompshad/Manager.h b/nxcompshad/Manager.h index 267754906..56b7e0aa5 100644 --- a/nxcompshad/Manager.h +++ b/nxcompshad/Manager.h @@ -18,7 +18,7 @@ #ifndef UpdateManager_H #define UpdateManager_H -#include +#include #include "Updater.h" #include "Regions.h" diff --git a/nxcompshad/Regions.h b/nxcompshad/Regions.h index b9303dcb7..d46d11a72 100644 --- a/nxcompshad/Regions.h +++ b/nxcompshad/Regions.h @@ -18,8 +18,8 @@ #ifndef Region_H #define Region_H -#include -#include +#include +#include typedef struct { short x1, x2, y1, y2; diff --git a/nxcompshad/Shadow.h b/nxcompshad/Shadow.h index e1eddb95c..99824b0aa 100644 --- a/nxcompshad/Shadow.h +++ b/nxcompshad/Shadow.h @@ -18,7 +18,7 @@ #ifndef Shadow_H #define Shadow_H -#include +#include #define NXShadowCorrectColor(length, buffer) \ \ diff --git a/nxcompshad/Updater.cpp b/nxcompshad/Updater.cpp index 245c6ce31..eee81bf16 100644 --- a/nxcompshad/Updater.cpp +++ b/nxcompshad/Updater.cpp @@ -15,9 +15,9 @@ /* */ /**************************************************************************/ -#include -#include -#include +#include +#include +#include #include #define PANIC diff --git a/nxcompshad/Updater.h b/nxcompshad/Updater.h index daa26c10b..cb8b15aa6 100644 --- a/nxcompshad/Updater.h +++ b/nxcompshad/Updater.h @@ -18,7 +18,7 @@ #ifndef Updater_H #define Updater_H -#include +#include #include "Regions.h" #include "Input.h" diff --git a/nxcompshad/Win.cpp b/nxcompshad/Win.cpp index 481cbcac0..77a9694bd 100644 --- a/nxcompshad/Win.cpp +++ b/nxcompshad/Win.cpp @@ -17,7 +17,7 @@ #if defined(__CYGWIN32__) || defined(WIN32) -#include +#include #define PANIC #define WARNING diff --git a/nxcompshad/Win.h b/nxcompshad/Win.h index fe591ff02..1069fa9ee 100644 --- a/nxcompshad/Win.h +++ b/nxcompshad/Win.h @@ -20,7 +20,7 @@ #ifndef Win32Poller_H #define Win32Poller_H -//#include +//#include #include #include diff --git a/nxcompshad/X11.cpp b/nxcompshad/X11.cpp index 2d1140f11..5a18e0a69 100644 --- a/nxcompshad/X11.cpp +++ b/nxcompshad/X11.cpp @@ -22,10 +22,10 @@ #undef TEST #undef DEBUG -#include -#include -#include -#include +#include +#include +#include +#include #include #include #include diff --git a/nxcompshad/X11.h b/nxcompshad/X11.h index 21275420c..d7b858100 100644 --- a/nxcompshad/X11.h +++ b/nxcompshad/X11.h @@ -18,10 +18,10 @@ #ifndef X11Poller_H #define X11Poller_H -#include -#include -#include -#include +#include +#include +#include "X11/include/Xdamage_nxcompshad.h" +#include "X11/include/Xrandr_nxcompshad.h" #include "Core.h" diff --git a/nxcompshad/X11/include/Xdamage_nxcompshad.h b/nxcompshad/X11/include/Xdamage_nxcompshad.h new file mode 100644 index 000000000..8e5e0fbbd --- /dev/null +++ b/nxcompshad/X11/include/Xdamage_nxcompshad.h @@ -0,0 +1,92 @@ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +/* + * This file is a reduced version of the header file of + * + * + * This copy of code has been introduced to allow a clear namespace + * separation between and header files. + * + * This version of the Xdamage library header file only contains symbols + * required by nxcompshad and strictly avoids indirectly including + * from an X11 library that is also shipped in nx-X11/lib/. + * + * When using instead for inclusion in + * nxcompshad, it will attempt pulling in the + * header which in turn will include . However, the headers of + * the same name from should be used instead. + * + * FIXME: Once the nxagent Xserver starts using libXfixes from X.Org, this + * hack can be removed. + * + * 2015/06/26, Mike Gabriel + */ + + +#ifndef _XDAMAGE_H_ +#define _XDAMAGE_H_ + +#include +#include + +/* from */ +typedef XID XserverRegion; + +#define XDAMAGE_1_1_INTERFACE + +typedef XID Damage; + +typedef struct { + int type; /* event base */ + unsigned long serial; + Bool send_event; + Display *display; + Drawable drawable; + Damage damage; + int level; + Bool more; /* more events will be delivered immediately */ + Time timestamp; + XRectangle area; + XRectangle geometry; +} XDamageNotifyEvent; + +_XFUNCPROTOBEGIN + +Bool XDamageQueryExtension (Display *dpy, + int *event_base_return, + int *error_base_return); + +Status XDamageQueryVersion (Display *dpy, + int *major_version_return, + int *minor_version_return); + +Damage +XDamageCreate (Display *dpy, Drawable drawable, int level); + +void +XDamageSubtract (Display *dpy, Damage damage, + XserverRegion repair, XserverRegion parts); + +_XFUNCPROTOEND + +#endif /* _XDAMAGE_H_ */ diff --git a/nxcompshad/X11/include/Xrandr_nxcompshad.h b/nxcompshad/X11/include/Xrandr_nxcompshad.h new file mode 100644 index 000000000..4feb01685 --- /dev/null +++ b/nxcompshad/X11/include/Xrandr_nxcompshad.h @@ -0,0 +1,80 @@ +/* + * Copyright © 2000 Compaq Computer Corporation, Inc. + * Copyright © 2002 Hewlett-Packard Company, Inc. + * Copyright © 2006 Intel Corporation + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS 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: Jim Gettys, HP Labs, Hewlett-Packard, Inc. + * Keith Packard, Intel Corporation + */ + +/* + * This file is a reduced version of the header file of + * + * + * This copy of code has been introduced to allow a clear namespace + * separation between and header files. + * + * This version of the Xrandr library header file only contains symbols + * required by nxcompshad and strictly avoids indirectly including + * from an X11 library that is also shipped in nx-X11/lib/. + * + * When using instead for inclusion in + * nxcompshad, it will attempt pulling in the + * header which in turn will include . However, the headers of + * the same name from should be used instead. + * + * FIXME: Once the nxagent Xserver starts using libXrender from X.Org, this + * hack can be removed. + * + * 2015/06/26, Mike Gabriel + */ + +#ifndef _XRANDR_H_ +#define _XRANDR_H_ + +/* from */ +#define RRScreenChangeNotify 0 +#define RRScreenChangeNotifyMask (1L << 0) + +#include + +_XFUNCPROTOBEGIN + +/* internal representation is private to the library */ +typedef struct _XRRScreenConfiguration XRRScreenConfiguration; + +Bool XRRQueryExtension (Display *dpy, + int *event_base_return, + int *error_base_return); + +void XRRSelectInput(Display *dpy, Window window, int mask); + + +/* + * intended to take RRScreenChangeNotify, or + * ConfigureNotify (on the root window) + * returns 1 if it is an event type it understands, 0 if not + */ +int XRRUpdateConfiguration(XEvent *event); +_XFUNCPROTOEND + +#endif /* _XRANDR_H_ */ -- cgit v1.2.3 From 2d776b14fddc5ec70c97aa82672f3a7c9caef6a3 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 5 May 2015 10:24:24 +0200 Subject: library clean-up: Don't build libNX_Xinerama anymore. Use system's libXinerama shared library. (Fixes ArcticaProject/nx-libs#49). This commit goes along with a patch from Ulrich Sibiller who managed to move the Xinerama awareness for NX sessions into the Xserver code. This makes Xinerama support for NX in libNX_Xinerama.so obsolete. Fixes ArcticaProject/nx-libs#49 --- Makefile | 8 - debian/control | 46 ++-- debian/libnx-xinerama-dev.install.in | 3 - debian/libnx-xinerama1.install.in | 1 - debian/libnx-xinerama1.symbols | 11 - debian/nx-x11-common.install | 1 - debian/nx-x11proto-xinerama-dev.install.in | 1 - debian/nxagent.postinst.in | 57 ----- debian/nxagent.prerm | 53 ---- debian/rules | 5 - nx-X11/config/cf/X11.tmpl | 37 --- nx-X11/include/extensions/Imakefile | 4 +- nx-X11/lib/Imakefile | 4 - nx-X11/lib/Xinerama/Imakefile | 30 --- nx-X11/lib/Xinerama/Xinerama-def.cpp | 14 -- nx-X11/lib/Xinerama/Xinerama.c | 361 ---------------------------- nx-X11/programs/Xserver/Imakefile | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 4 + nx-libs.spec | 45 +--- 19 files changed, 25 insertions(+), 662 deletions(-) delete mode 100644 debian/libnx-xinerama-dev.install.in delete mode 100644 debian/libnx-xinerama1.install.in delete mode 100644 debian/libnx-xinerama1.symbols delete mode 100644 debian/nx-x11proto-xinerama-dev.install.in delete mode 100755 debian/nxagent.postinst.in delete mode 100755 debian/nxagent.prerm delete mode 100644 nx-X11/lib/Xinerama/Imakefile delete mode 100644 nx-X11/lib/Xinerama/Xinerama-def.cpp delete mode 100644 nx-X11/lib/Xinerama/Xinerama.c (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2b5b4946a..14f6e4266 100644 --- a/Makefile +++ b/Makefile @@ -154,14 +154,6 @@ install-full: "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/")"/ || true; \ done; \ - # Provide means for Xinerama support in NX/X2Go sessions. This - # This also requires three post-install symlinks created by libnx-xinerama1: - # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_X11.so.6 -> /usr//libX11.so.6 - # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libNX_Xext.so.6 -> /usr//libXext.so.6 - # $(DESTDIR)$(NXLIBDIR)/X11/Xinerama/libXinerama.so.1 -> /usr//libNX_Xinerama.so.1 - # Only create the owned directory here for nx-x11-common. - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/X11/Xinerama - $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ diff --git a/debian/control b/debian/control index 946dd4b2a..94aa64014 100644 --- a/debian/control +++ b/debian/control @@ -22,12 +22,11 @@ Build-Depends: libxrandr-dev, libxfixes-dev, libxtst-dev, + libxinerama-dev, autoconf, pkg-config, x11proto-core-dev, expat, -Build-Conflicts: - x11proto-xinerama-dev, Standards-Version: 3.9.6 Homepage: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary Vcs-Git: git://code.x2go.org/nx-libs.git @@ -548,21 +547,17 @@ Multi-Arch: same Pre-Depends: ${misc:Pre-Depends}, Depends: - ${shlibs:Depends}, ${misc:Depends}, -Breaks: nxlibs (<= 3.5.1), - libnx-x11 (<< 2:3.5.0.29-0x2go2~), Description: nx-X11 Xinerama extension library NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when using X applications over a network, especially a slow one. . - libNX_Xinerama provides an X Window System client interface to the XINERAMA - extension to the X protocol. + This package removes the obsoleted libNX_Xinerama.so.1 library. + Xinerama support in NX has been moved into nxagent whereas X-Clients + can now use the libXinerama library shipped with X.Org. . - The Xinerama (also known as panoramiX) extension allows for multiple screens - attached to a single display to be treated as belonging together, and to give - desktop applications a better idea of the monitor layout. + This package can be safely removed. Package: libnx-xinerama-dev Provides: libnx-xinerama1-dev @@ -570,24 +565,16 @@ Section: libdevel Architecture: any Multi-Arch: same Depends: - libnx-xinerama1 (= ${binary:Version}), - nx-x11proto-xinerama-dev (= ${binary:Version}), ${misc:Depends}, -Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), Description: nx-X11 Xinerama extension library (development headers) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when using X applications over a network, especially a slow one. . - libNX_Xinerama provides an X Window System client interface to the XINERAMA - extension to the X protocol. + This package removes the obsoleted headers for the libNX_Xinerama.so.1 + library. . - The Xinerama (also known as panoramiX) extension allows for multiple screens - attached to a single display to be treated as belonging together, and to give - desktop applications a better idea of the monitor layout. - . - This package contains the development headers for this library. + This package can be safely removed. Package: nx-x11proto-xinerama-dev Section: libdevel @@ -595,16 +582,15 @@ Architecture: any Multi-Arch: same Depends: ${misc:Depends}, -Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), Description: nx-X11 Xinerama extension wire protocol NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when using X applications over a network, especially a slow one. . - This package provides development headers describing the wire protocol - for the XINERAMA extension, used to use and manage a multiple-screen - display. + This package removes the obsoleted headers for the libNX_Xinerama.so.1 + library. + . + This package can be safely removed. Package: libnx-xinerama1-dbg Architecture: any @@ -624,12 +610,10 @@ Description: nx-X11 Xinerama extension library (debug package) libNX_Xinerama provides an X Window System client interface to the XINERAMA extension to the X protocol. . - The Xinerama (also known as panoramiX) extension allows for multiple - screens attached to a single display to be treated as belonging - together, and to give desktop applications a better idea of the monitor - layout. + This package removes the obsoleted debug symbols for the libNX_Xinerama.so.1 + library. . - This package contains debug symbols for this library. + This package can be safely removed. Package: libnx-xpm4 Architecture: any diff --git a/debian/libnx-xinerama-dev.install.in b/debian/libnx-xinerama-dev.install.in deleted file mode 100644 index 59c0456aa..000000000 --- a/debian/libnx-xinerama-dev.install.in +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/*/libNX_Xinerama.so -usr/include/*/nx-X11/extensions/Xinerama.h -usr/include/*/nx-X11/extensions/panoramiXext.h diff --git a/debian/libnx-xinerama1.install.in b/debian/libnx-xinerama1.install.in deleted file mode 100644 index d53de9c4f..000000000 --- a/debian/libnx-xinerama1.install.in +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/libNX_Xinerama.so.* diff --git a/debian/libnx-xinerama1.symbols b/debian/libnx-xinerama1.symbols deleted file mode 100644 index f8f73a3fd..000000000 --- a/debian/libnx-xinerama1.symbols +++ /dev/null @@ -1,11 +0,0 @@ -libNX_Xinerama.so.1 libnx-xinerama1 #MINVER# - XPanoramiXAllocInfo@Base 3.5.0.29 - XPanoramiXGetScreenCount@Base 3.5.0.29 - XPanoramiXGetScreenSize@Base 3.5.0.29 - XPanoramiXGetState@Base 3.5.0.29 - XPanoramiXQueryExtension@Base 3.5.0.29 - XPanoramiXQueryVersion@Base 3.5.0.29 - XineramaIsActive@Base 3.5.0.29 - XineramaQueryExtension@Base 3.5.0.29 - XineramaQueryScreens@Base 3.5.0.29 - XineramaQueryVersion@Base 3.5.0.29 diff --git a/debian/nx-x11-common.install b/debian/nx-x11-common.install index 1131e7291..b6fc46613 100644 --- a/debian/nx-x11-common.install +++ b/debian/nx-x11-common.install @@ -1,2 +1 @@ usr/share/nx/SecurityPolicy -usr/lib/nx/X11/ diff --git a/debian/nx-x11proto-xinerama-dev.install.in b/debian/nx-x11proto-xinerama-dev.install.in deleted file mode 100644 index dca06ddee..000000000 --- a/debian/nx-x11proto-xinerama-dev.install.in +++ /dev/null @@ -1 +0,0 @@ -usr/include/*/nx-X11/extensions/panoramiXproto.h \ No newline at end of file diff --git a/debian/nxagent.postinst.in b/debian/nxagent.postinst.in deleted file mode 100755 index 95879b943..000000000 --- a/debian/nxagent.postinst.in +++ /dev/null @@ -1,57 +0,0 @@ -#!/bin/sh -# postinst script for nxagent -# -# see: dh_installdeb(1) - -set -e - -# summary of how this script can be called: -# * `configure' -# * `abort-upgrade' -# * `abort-remove' `in-favour' -# -# * `abort-remove' -# * `abort-deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - - -case "$1" in - configure) - ### FIXME: this is a work-around while we have not implemented - ### multiarch support into the Debian source package of - ### nx-libs. - - libdir=/usr/lib/#DEB_BUILD_MULTIARCH# - - mkdir -p /usr/lib/nx/X11/Xinerama/ - # Already existent files are not removed. - # Users will need to explicitly remove them and (re-) configure this package. - if test -e $libdir/libX11.so.6; then - ln -sf $libdir/libX11.so.6 /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 - fi - if test -e $libdir/libXext.so.6; then - ln -sf $libdir/libXext.so.6 /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6 - fi - if test -e $libdir/libNX_Xinerama.so.1; then - ln -sf $libdir/libNX_Xinerama.so.1 /usr/lib/nx/X11/Xinerama/libXinerama.so.1 - fi - ;; - - abort-upgrade|abort-remove|abort-deconfigure) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/nxagent.prerm b/debian/nxagent.prerm deleted file mode 100755 index 019284a16..000000000 --- a/debian/nxagent.prerm +++ /dev/null @@ -1,53 +0,0 @@ -#!/bin/sh -# prerm script for nxagent -# -# see: dh_installdeb(1) -# summary of how this script can be called: -# * `remove' -# * `upgrade' -# * `failed-upgrade' -# * `remove' `in-favour' -# * `deconfigure' `in-favour' -# `removing' -# -# for details, see http://www.debian.org/doc/debian-policy/ or -# the debian-policy package - -set -e - - - -case "$1" in - remove) - if test -d /usr/lib/nx/X11/Xinerama; then - if test -e /usr/lib/nx/X11/Xinerama/libNX_X11.so.6; then - rm -f /usr/lib/nx/X11/Xinerama/libNX_X11.so.6 - fi - - if test -e /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6; then - rm -f /usr/lib/nx/X11/Xinerama/libNX_Xext.so.6 - fi - - if test -e /usr/lib/nx/X11/Xinerama/libXinerama.so.1; then - rm -f /usr/lib/nx/X11/Xinerama/libXinerama.so.1 - fi - - rmdir --ignore-fail-on-non-empty /usr/lib/nx/X11/Xinerama - - fi - ;; - deconfigure|upgrade|failed-upgrade) - : - ;; - *) - echo "prerm called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/rules b/debian/rules index 729a2c6f4..c90bb6451 100755 --- a/debian/rules +++ b/debian/rules @@ -20,7 +20,6 @@ override_dh_auto_clean: override_dh_clean: rm -f nx*/configure . ./replace.sh; set -x; ls debian/*.install.in | while read file; do rm -f $$(string_rep $$file .install.in .install); done - rm -f debian/nxagent.postinst rm -fR .preserve/ dh_clean @@ -72,16 +71,12 @@ override_dh_auto_install: override_dh_auto_build: - # let's prep the nxagent.postinst script with the value of the build systems's DEB_BUILD_MULTIARCH variable - sed debian/nxagent.postinst.in -e 's/#DEB_BUILD_MULTIARCH#/$(DEB_BUILD_MULTIARCH)/' > debian/nxagent.postinst - LOCAL_LDFLAGS="$(LDFLAGS)" SHLIBGLOBALSFLAGS="$(LDFLAGS)" SHLIBDIR="$(LIBDIR)" PREFIX=/usr dh_auto_build --parallel override_dh_strip: dh_strip -plibnx-x11-6 --dbg-package=libnx-x11-6-dbg dh_strip -plibnx-xau6 --dbg-package=libnx-xau6-dbg dh_strip -plibnx-xext6 --dbg-package=libnx-xext6-dbg - dh_strip -plibnx-xinerama1 --dbg-package=libnx-xinerama1-dbg dh_strip -plibnx-xrender1 --dbg-package=libnx-xrender1-dbg dh_strip -plibxcomp3 --dbg-package=libxcomp3-dbg dh_strip -plibxcompshad3 --dbg-package=libxcompshad3-dbg diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index af466b47f..3e7423040 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -226,9 +226,6 @@ XORGRELSTRING = XorgManVersionString #ifndef BuildXinerama #define BuildXinerama NO #endif -#ifndef BuildXineramaLibrary -#define BuildXineramaLibrary (BuildXinerama) -#endif #ifndef BuildXCSecurity #define BuildXCSecurity YES #endif @@ -1321,30 +1318,6 @@ ProjectUnsharedLibReferences(XONLY,NX_X11,$(XLIBSRC),XBuildLibDir) XLIBONLY = $(XONLYLIB) LINTXONLYLIB = $(LINTXONLY) -#if BuildXineramaLibrary -#ifndef SharedLibXinerama -#define SharedLibXinerama HasSharedLibraries -#endif -#ifndef NormalLibXinerama -#define NormalLibXinerama (!SharedLibXinerama || ForceNormalLib) -#endif -#ifndef DebugLibXinerama -#define DebugLibXinerama NO -#endif -#ifndef ProfileLibXinerama -#define ProfileLibXinerama NO -#endif -#else -#undef SharedLibXinerama -#define SharedLibXinerama NO -#undef NormalLibXinerama -#define NormalLibXinerama NO -#undef DebugLibXinerama -#define DebugLibXinerama NO -#undef ProfileLibXinerama -#define ProfileLibXinerama NO -#endif - #if BuildRenderLibrary #ifndef SharedLibXrender #define SharedLibXrender HasSharedLibraries @@ -1395,16 +1368,6 @@ LINTEXTENSIONLIB = $(LINTEXTENSION) XLIB = $(EXTENSIONLIB) $(XONLYLIB) LINTXLIB = $(LINTXONLYLIB) - XINERAMALIBSRC = $(LIBSRC)/Xinerama -#if SharedLibXinerama -#ifndef SharedXineramaRev -#define SharedXineramaRev 1.0 -#endif -SharedLibReferences(XINERAMA,NX_Xinerama,$(XINERAMALIBSRC),SOXINERAMAREV,SharedXineramaRev) -#else -ProjectUnsharedLibReferences(XINERAMA,NX_Xinerama,$(XINERAMALIBSRC),XBuildLibDir) -#endif - XRENDERLIBSRC = $(LIBSRC)/Xrender #if SharedLibXrender #ifndef SharedXrenderRev diff --git a/nx-X11/include/extensions/Imakefile b/nx-X11/include/extensions/Imakefile index 33e854058..eb7763535 100644 --- a/nx-X11/include/extensions/Imakefile +++ b/nx-X11/include/extensions/Imakefile @@ -35,8 +35,8 @@ XVMCHEADERS = XvMC.h XvMClib.h XvMCproto.h vldXvMC.h #if BuildFontCache FONTCACHEHEADERS = fontcache.h fontcacheP.h fontcachstr.h #endif -#if BuildXinerama || BuildXineramaLibrary -XINERAMAHEADERS = Xinerama.h panoramiXext.h panoramiXproto.h +#if BuildXinerama +XINERAMAHEADERS = panoramiXext.h panoramiXproto.h #endif #if BuildRandR RANDRHEADERS = randr.h randrproto.h diff --git a/nx-X11/lib/Imakefile b/nx-X11/lib/Imakefile index b97ef6b22..dbe4e4280 100644 --- a/nx-X11/lib/Imakefile +++ b/nx-X11/lib/Imakefile @@ -15,10 +15,6 @@ NULL = XKBLIBDIR = xkbfile #endif -#if BuildXineramaLibrary -XINERAMADIR=Xinerama -#endif - #if BuildRenderLibrary RENDERLIBDIR = Xrender #endif diff --git a/nx-X11/lib/Xinerama/Imakefile b/nx-X11/lib/Xinerama/Imakefile deleted file mode 100644 index 910f98da6..000000000 --- a/nx-X11/lib/Xinerama/Imakefile +++ /dev/null @@ -1,30 +0,0 @@ -XCOMM $XFree86: xc/lib/Xinerama/Imakefile,v 1.4 2002/10/16 00:37:31 dawes Exp $ - -#define DoNormalLib NormalLibXinerama -#define DoSharedLib SharedLibXinerama -#define DoDebugLib DebugLibXinerama -#define DoProfileLib ProfileLibXinerama -#define LibName NX_Xinerama -#define SoRev SOXINERAMAREV -#define LibHeaders NO - -#include - -#ifdef SharedXineramaReqs -REQUIREDLIBS = SharedXineramaReqs -#endif - -#if Malloc0ReturnsNull -ALLOC_DEFINES = -DMALLOC_0_RETURNS_NULL -#endif - - DEFINES = $(ALLOC_DEFINES) - SRCS = Xinerama.c - OBJS = Xinerama.o - LINTLIBS = $(LINTXLIB) - -#define IncludeSharedObjectInNormalLib - -#include - -DependTarget() diff --git a/nx-X11/lib/Xinerama/Xinerama-def.cpp b/nx-X11/lib/Xinerama/Xinerama-def.cpp deleted file mode 100644 index 01449d15b..000000000 --- a/nx-X11/lib/Xinerama/Xinerama-def.cpp +++ /dev/null @@ -1,14 +0,0 @@ -LIBRARY Xinerama -VERSION LIBRARY_VERSION -EXPORTS - XPanoramiXAllocInfo - XPanoramiXGetScreenCount - XPanoramiXGetScreenSize - XPanoramiXGetState - XPanoramiXQueryExtension - XPanoramiXQueryVersion - XineramaIsActive - XineramaQueryExtension - XineramaQueryScreens - XineramaQueryVersion -/* $XFree86$ */ diff --git a/nx-X11/lib/Xinerama/Xinerama.c b/nx-X11/lib/Xinerama/Xinerama.c deleted file mode 100644 index 0256336be..000000000 --- a/nx-X11/lib/Xinerama/Xinerama.c +++ /dev/null @@ -1,361 +0,0 @@ -/* $Xorg: XPanoramiX.c,v 1.4 2000/08/17 19:45:51 cpqbld Exp $ */ -/***************************************************************** -Copyright (c) 1991, 1997 Digital Equipment Corporation, Maynard, Massachusetts. -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL -DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY CLAIM, DAMAGES, INCLUDING, -BUT NOT LIMITED TO CONSEQUENTIAL OR INCIDENTAL DAMAGES, OR OTHER LIABILITY, -WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR -IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of Digital Equipment Corporation -shall not be used in advertising or otherwise to promote the sale, use or other -dealings in this Software without prior written authorization from Digital -Equipment Corporation. -******************************************************************/ -/* $XFree86: xc/lib/Xinerama/Xinerama.c,v 1.2 2001/07/23 17:20:28 dawes Exp $ */ - -#define NEED_EVENTS -#define NEED_REPLIES -#include -#include -#include -#include -#include -#include -#include -#include - -static XExtensionInfo _panoramiX_ext_info_data; -static XExtensionInfo *panoramiX_ext_info = &_panoramiX_ext_info_data; -static /* const */ char *panoramiX_extension_name = PANORAMIX_PROTOCOL_NAME; - -#define PanoramiXCheckExtension(dpy,i,val) \ - XextCheckExtension (dpy, i, panoramiX_extension_name, val) -#define PanoramiXSimpleCheckExtension(dpy,i) \ - XextSimpleCheckExtension (dpy, i, panoramiX_extension_name) - -static int close_display(); -static /* const */ XExtensionHooks panoramiX_extension_hooks = { - NULL, /* create_gc */ - NULL, /* copy_gc */ - NULL, /* flush_gc */ - NULL, /* free_gc */ - NULL, /* create_font */ - NULL, /* free_font */ - close_display, /* close_display */ - NULL, /* wire_to_event */ - NULL, /* event_to_wire */ - NULL, /* error */ - NULL, /* error_string */ -}; - -static XEXT_GENERATE_FIND_DISPLAY (find_display, panoramiX_ext_info, - panoramiX_extension_name, - &panoramiX_extension_hooks, - 0, NULL) - -static XEXT_GENERATE_CLOSE_DISPLAY (close_display, panoramiX_ext_info) - - - -/**************************************************************************** - * * - * PanoramiX public interfaces * - * * - ****************************************************************************/ - -Bool XPanoramiXQueryExtension ( - Display *dpy, - int *event_basep, - int *error_basep -) -{ - XExtDisplayInfo *info = find_display (dpy); - - if (XextHasExtension(info)) { - *event_basep = info->codes->first_event; - *error_basep = info->codes->first_error; - return True; - } else { - return False; - } -} - - -Status XPanoramiXQueryVersion( - Display *dpy, - int *major_versionp, - int *minor_versionp -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXQueryVersionReply rep; - register xPanoramiXQueryVersionReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXQueryVersion, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXQueryVersion; - req->clientMajor = PANORAMIX_MAJOR_VERSION; - req->clientMinor = PANORAMIX_MINOR_VERSION; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - *major_versionp = rep.majorVersion; - *minor_versionp = rep.minorVersion; - UnlockDisplay (dpy); - SyncHandle (); - return 1; -} - -XPanoramiXInfo *XPanoramiXAllocInfo(void) -{ - return (XPanoramiXInfo *) Xmalloc (sizeof (XPanoramiXInfo)); -} - -Status XPanoramiXGetState ( - Display *dpy, - Drawable drawable, - XPanoramiXInfo *panoramiX_info -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXGetStateReply rep; - register xPanoramiXGetStateReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXGetState, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXGetState; - req->window = drawable; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - UnlockDisplay (dpy); - SyncHandle (); - panoramiX_info->window = rep.window; - panoramiX_info->State = rep.state; - return 1; -} - -Status XPanoramiXGetScreenCount ( - Display *dpy, - Drawable drawable, - XPanoramiXInfo *panoramiX_info -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXGetScreenCountReply rep; - register xPanoramiXGetScreenCountReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXGetScreenCount, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXGetScreenCount; - req->window = drawable; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - UnlockDisplay (dpy); - SyncHandle (); - panoramiX_info->window = rep.window; - panoramiX_info->ScreenCount = rep.ScreenCount; - return 1; -} - -Status XPanoramiXGetScreenSize ( - Display *dpy, - Drawable drawable, - int screen_num, - XPanoramiXInfo *panoramiX_info -) -{ - XExtDisplayInfo *info = find_display (dpy); - xPanoramiXGetScreenSizeReply rep; - register xPanoramiXGetScreenSizeReq *req; - - PanoramiXCheckExtension (dpy, info, 0); - - LockDisplay (dpy); - GetReq (PanoramiXGetScreenSize, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_PanoramiXGetScreenSize; - req->window = drawable; - req->screen = screen_num; /* need to define */ - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return 0; - } - UnlockDisplay (dpy); - SyncHandle (); - panoramiX_info->window = rep.window; - panoramiX_info->screen = rep.screen; - panoramiX_info->width = rep.width; - panoramiX_info->height = rep.height; - return 1; -} - -/*******************************************************************\ - Alternate interface to make up for shortcomings in the original, - namely, the omission of the screen origin. The new interface is - in the "Xinerama" namespace instead of "PanoramiX". -\*******************************************************************/ - -Bool XineramaQueryExtension ( - Display *dpy, - int *event_base, - int *error_base -) -{ - return XPanoramiXQueryExtension(dpy, event_base, error_base); -} - -Status XineramaQueryVersion( - Display *dpy, - int *major, - int *minor -) -{ - return XPanoramiXQueryVersion(dpy, major, minor); -} - -Bool XineramaIsActive(Display *dpy) -{ - xXineramaIsActiveReply rep; - xXineramaIsActiveReq *req; - XExtDisplayInfo *info = find_display (dpy); - - - FILE* fptr; - if((fptr=fopen(getenv("NX_XINERAMA_CONF"),"r"))!=NULL) { - fclose (fptr); - return True; - } - else { - return False; - } - - if(!XextHasExtension(info)) - return False; /* server doesn't even have the extension */ - - LockDisplay (dpy); - GetReq (XineramaIsActive, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_XineramaIsActive; - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay (dpy); - SyncHandle (); - return False; - } - UnlockDisplay (dpy); - SyncHandle (); - return rep.state; -} - - -XineramaScreenInfo * -XineramaQueryScreens( - Display *dpy, - int *number -) -{ - XExtDisplayInfo *info = find_display (dpy); - xXineramaQueryScreensReply rep; - xXineramaQueryScreensReq *req; - XineramaScreenInfo *scrnInfo = NULL; - - int i; - int x,y,w,h; - FILE* fptr; - if((fptr=fopen(getenv("NX_XINERAMA_CONF"),"r"))==NULL) { - PanoramiXCheckExtension (dpy, info, 0); - LockDisplay (dpy); - GetReq (XineramaQueryScreens, req); - req->reqType = info->codes->major_opcode; - req->panoramiXReqType = X_XineramaQueryScreens; - if (!_XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay (dpy); - SyncHandle (); - return NULL; - } - if(rep.number) { - if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * rep.number))) { - xXineramaScreenInfo scratch; - int i; - - for(i = 0; i < rep.number; i++) { - _XRead(dpy, (char*)(&scratch), sz_XineramaScreenInfo); - scrnInfo[i].screen_number = i; - scrnInfo[i].x_org = scratch.x_org; - scrnInfo[i].y_org = scratch.y_org; - scrnInfo[i].width = scratch.width; - scrnInfo[i].height = scratch.height; - } - - *number = rep.number; - } else { - _XEatData(dpy, rep.length << 2); - } - } - - UnlockDisplay (dpy); - SyncHandle (); - - } else { - - i=0; - while(!feof(fptr)) { - w=h=0; - fscanf(fptr,"%d %d %d %d",&x,&y,&w,&h); - if(w&&h) - i++; - } - rewind(fptr); - *number=i; - if((scrnInfo = Xmalloc(sizeof(XineramaScreenInfo) * i))) { - i=0; - while(!feof(fptr)){ - w=h=0; - fscanf(fptr,"%d %d %d %d",&x,&y,&w,&h); - if(w&&h){ - scrnInfo[i].screen_number=i; - scrnInfo[i].x_org=x; - scrnInfo[i].y_org=y; - scrnInfo[i].width=w; - scrnInfo[i].height=h; - i++; - } - } - } - fclose(fptr); - } - - return scrnInfo; -} - - - diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 309d5d98f..d034c2672 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -413,7 +413,7 @@ NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext \ #else NXAGENTNXLIBS = -L ../../../nxcomp -L ../../../nxcompext -L ../../../nxcompshad \ -lXcomp -lXcompext -lXcompshad -lNX_Xrender -lNX_X11 -lNX_Xext -lXfixes -lXfont \ - -L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lNX_Xinerama -lXdmcp \ + -L../../../nx-X11/exports/lib -lXtst -lXrandr -lXcomposite -lXinerama -lXdmcp \ `pkg-config --libs libxml-2.0` #endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 491a92c2f..2f70334d4 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -79,6 +79,10 @@ is" without express or implied warranty. #include "X11/include/Xrandr_nxagent.h" +#include +#include "X11/include/Xinerama_nxagent.h" + + #define GC XlibGC #define Font XlibFont #define KeySym XlibKeySym diff --git a/nx-libs.spec b/nx-libs.spec index 22094c2a5..01341a4ca 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -39,6 +39,7 @@ BuildRequires: pkgconfig(xcomposite) BuildRequires: pkgconfig(xrandr) BuildRequires: pkgconfig(xfixes) BuildRequires: pkgconfig(xtst) +BuildRequires: pkgconfig(xinerama) %else BuildRequires: libexpat-devel BuildRequires: libpng-devel @@ -53,6 +54,7 @@ BuildRequires: xorg-x11-libXcomposite-devel BuildRequires: xorg-x11-libXrandr-devel BuildRequires: xorg-x11-libXfixes-devel BuildRequires: xorg-x11-libXtst-devel +BuildRequires: xorg-x11-libXinerama-devel %endif BuildRequires: xorg-x11-util-devel %endif @@ -67,6 +69,7 @@ BuildRequires: libXcomposite-devel BuildRequires: libXrandr-devel BuildRequires: libXfixes-devel BuildRequires: libXtst-devel +BuildRequires: libXinerama-devel %endif # For imake @@ -84,20 +87,6 @@ Provides: nx = %{version}-%{release} Obsoletes: nx%{?_isa} < 3.5.0-19 Provides: nx%{?_isa} = %{version}-%{release} -# for Xinerama in NX to work: -%if 0%{?suse_version} -%if 0%{?suse_version} < 1140 -Requires: xorg-x11-libX11%{?_isa} -Requires: xorg-x11-libXext%{?_isa} -%else -Requires: libX11-6%{?_isa} -Requires: libXext6%{?_isa} -%endif -%else -Requires: libX11%{?_isa} -Requires: libXext%{?_isa} -%endif - %if 0%{?el5} # For compatibility with EPEL5 BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX) @@ -244,22 +233,6 @@ The NX_Xext library contains a handful of X11 extensions: - X11 Double-Buffering, Multi-Buffering, and Stereo extension (Xmbuf) -%package -n libNX_Xinerama1 -Group: System Environment/Libraries -Summary: Xinerama extension to the NX Protocol -Requires: %{name}%{?_isa} >= 3.5.0.29 -Obsoletes: libNX_Xinerama - -%description -n libNX_Xinerama1 -NX is a software suite which implements very efficient compression of -the X11 protocol. This increases performance when using X -applications over a network, especially a slow one. - -Xinerama is an extension to the X Window System which enables -multi-headed X applications and window managers to use two or more -physical displays as one large virtual display. - - %package -n libNX_Xrender-devel Group: Development/Libraries Summary: Development files for the NX Render Extension library @@ -553,11 +526,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/extensions/XK*.h rm -r %{buildroot}%{_includedir}/nx-X11/extensions/*Xv*.h rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans -# Needed for Xinerama support -ln -s -f ../../../../%{_lib}/libX11.so.6 %{buildroot}%{_libdir}/nx/X11/Xinerama/libNX_X11.so.6 -ln -s -f ../../../../%{_lib}/libXext.so.6 %{buildroot}%{_libdir}/nx/X11/Xinerama/libNX_Xext.so.6 -ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/Xinerama/libXinerama.so.1 - %if 0%{?fdupes:1} %fdupes %buildroot/%_prefix %endif @@ -566,7 +534,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %post -n libNX_X11-6 -p /sbin/ldconfig %post -n libNX_Xau6 -p /sbin/ldconfig %post -n libNX_Xext6 -p /sbin/ldconfig -%post -n libNX_Xinerama1 -p /sbin/ldconfig %post -n libNX_Xrender1 -p /sbin/ldconfig %post -n libXcomp3 -p /sbin/ldconfig %post -n libXcompext3 -p /sbin/ldconfig @@ -575,7 +542,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %postun -n libNX_X11-6 -p /sbin/ldconfig %postun -n libNX_Xau6 -p /sbin/ldconfig %postun -n libNX_Xext6 -p /sbin/ldconfig -%postun -n libNX_Xinerama1 -p /sbin/ldconfig %postun -n libNX_Xrender1 -p /sbin/ldconfig %postun -n libXcomp3 -p /sbin/ldconfig %postun -n libXcompext3 -p /sbin/ldconfig @@ -654,10 +620,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %defattr(-,root,root) %{_libdir}/libNX_Xext.so.6* -%files -n libNX_Xinerama1 -%defattr(-,root,root) -%{_libdir}/libNX_Xinerama.so.1* - %files -n libNX_Xrender-devel %defattr(-,root,root) %{_libdir}/libNX_Xrender.so @@ -722,7 +684,6 @@ ln -s -f ../../../../%{_lib}/libNX_Xinerama.so.1 %{buildroot}%{_libdir}/nx/X11/X %files devel %defattr(-,root,root) -%{_libdir}/libNX_Xinerama.so %{_includedir}/nx-X11/X10.h %dir %{_includedir}/nx-X11/extensions %{_includedir}/nx-X11/extensions/Xevie.h -- cgit v1.2.3 From 522cf0089e4db707346c25d826c33e92ef09db8a Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 7 Oct 2015 21:33:55 +0200 Subject: X2Go Agent: Add x2goagent.features file that informs X2Go clients about the new RandR based Xinerama feature. --- Makefile | 9 +++++++++ debian/x2goagent.install | 1 + x2goagent.features | 37 +++++++++++++++++++++++++++++++++++++ 3 files changed, 47 insertions(+) create mode 100644 x2goagent.features (limited to 'Makefile') diff --git a/Makefile b/Makefile index 14f6e4266..c9a52ac02 100644 --- a/Makefile +++ b/Makefile @@ -17,6 +17,7 @@ USRLIBDIR ?= $(LIBDIR) INCLUDEDIR ?= $(PREFIX)/include NXLIBDIR ?= $(PREFIX)/lib/nx X2GOLIBDIR ?= $(PREFIX)/lib/x2go +X2GODATADIR ?= $(PREFIX)/share/x2go CONFIGURE ?= ./configure NX_VERSION_MAJOR=$(shell ./version.sh 1) @@ -163,6 +164,10 @@ install-full: $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_FILE) etc/x2goagent.keyboard $(DESTDIR)$(ETCDIR_X2GO)/ + # x2goagent.features file for X2Go + $(INSTALL_DIR) $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/ + $(INSTALL_FILE) x2goagent.features $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/ + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go $(INSTALL_SYMLINK) $(ETCDIR_X2GO)/rgb $(DESTDIR)$(PREFIX)/share/x2go/rgb @@ -191,6 +196,10 @@ uninstall-full: $(RM_FILE) $(DESTDIR)$(X2GOLIBDIR)/bin/x2goagent $(RM_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ + # x2goagent.features file for X2Go + $(RM_FILE) $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/x2goagent.features + $(RM_DIR) $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/ + if test -d nx-X11; then \ if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ diff --git a/debian/x2goagent.install b/debian/x2goagent.install index 9ef17d9c6..0603507ef 100644 --- a/debian/x2goagent.install +++ b/debian/x2goagent.install @@ -5,5 +5,6 @@ usr/share/x2go/rgb usr/share/man/man1/x2goagent.1* etc/x2go/rgb usr/share/x2go/versions/VERSION.x2goagent +usr/share/x2go/x2gofeature.d/x2goagent.features etc/x2go/keystrokes.cfg etc/x2go/x2goagent.keyboard diff --git a/x2goagent.features b/x2goagent.features new file mode 100644 index 000000000..12d62e01c --- /dev/null +++ b/x2goagent.features @@ -0,0 +1,37 @@ +#!/bin/bash + +# Copyright (C) 2015, Mike Gabriel +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +# silently bail out if X2Go Server is not installed +if ! which x2gopath 1>/dev/null; then + exit 0 +fi + +X2GO_LIB_PATH="$(x2gopath libexec)"; + +$X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" + +X2GO_FEATURE=$1 + +# check for X2Go Agent features +case "$X2GO_FEATURE" in + + "X2GOAGENT_RANDRXINERAMA") echo "ok"; exit 0;; + *) exit -1;; + +esac -- cgit v1.2.3 From c355dc91d35c74234c24dfbf013dfac98110d352 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 22 Jun 2016 08:16:35 +0200 Subject: Makefile,debian/*,nx-libs.spec,: Drop references to X2Go Project, esp. drop x2goagent. The x2goagent package is being replaced by an x2goserver bin:package named x2goserver-x2goagent. This x2goserver-x2goagent bin:package will be maintained in the X2Go Project's namespace and basically wraps around nxagent. Furthermore, declare Arctica Project as upstream source for nx-libs. --- Makefile | 38 +++++------------------- VERSION.x2goagent | 1 - bin/x2goagent | 29 ------------------ debian/README.source | 29 +++--------------- debian/control | 77 +++++++++++++++++------------------------------- debian/nxagent.install | 1 + debian/nxproxy.install | 1 + debian/roll-tarballs.sh | 3 +- debian/watch | 3 ++ debian/watch.nx-X11 | 3 -- debian/watch.nxagent | 3 -- debian/watch.nxauth | 3 -- debian/watch.nxcomp | 3 -- debian/watch.nxcompext | 3 -- debian/watch.nxcompshad | 3 -- debian/watch.nxproxy | 3 -- debian/x2goagent.dirs | 3 -- debian/x2goagent.install | 10 ------- etc/x2goagent.keyboard | 1 - nx-libs.spec | 37 +---------------------- x2goagent.features | 37 ----------------------- 21 files changed, 46 insertions(+), 245 deletions(-) delete mode 120000 VERSION.x2goagent delete mode 100644 bin/x2goagent create mode 100644 debian/watch delete mode 100644 debian/watch.nx-X11 delete mode 100644 debian/watch.nxagent delete mode 100644 debian/watch.nxauth delete mode 100644 debian/watch.nxcomp delete mode 100644 debian/watch.nxcompext delete mode 100644 debian/watch.nxcompshad delete mode 100644 debian/watch.nxproxy delete mode 100644 debian/x2goagent.dirs delete mode 100644 debian/x2goagent.install delete mode 100644 etc/x2goagent.keyboard delete mode 100644 x2goagent.features (limited to 'Makefile') diff --git a/Makefile b/Makefile index c9a52ac02..e2077ed5b 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,12 @@ RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty ETCDIR_NX ?= /etc/nxagent -ETCDIR_X2GO ?= /etc/x2go PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin LIBDIR ?= $(PREFIX)/lib USRLIBDIR ?= $(LIBDIR) INCLUDEDIR ?= $(PREFIX)/include NXLIBDIR ?= $(PREFIX)/lib/nx -X2GOLIBDIR ?= $(PREFIX)/lib/x2go -X2GODATADIR ?= $(PREFIX)/share/x2go CONFIGURE ?= ./configure NX_VERSION_MAJOR=$(shell ./version.sh 1) @@ -98,30 +95,22 @@ install-lite: gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 install-full: - for f in nxagent nxauth x2goagent; do \ + for f in nxagent nxauth; do \ $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done for d in nxcompext nxcompshad; do \ $(MAKE) -C $$d install; done - $(INSTALL_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ - cd $(DESTDIR)$(X2GOLIBDIR)/bin/ && ln -sf $(NXLIBDIR)/bin/nxagent x2goagent - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps - $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/x2go.xpm $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go/versions - $(INSTALL_FILE) VERSION.x2goagent $(DESTDIR)$(PREFIX)/share/x2go/versions - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_PROGRAM) nx-X11/programs/nxauth/nxauth $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/x2goagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nx-X11/programs/nxauth/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/ mv -f $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.1 @@ -156,23 +145,14 @@ install-full: done; \ $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) - $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_X2GO) $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ - $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_X2GO)/ - $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_X2GO)/ $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ - $(INSTALL_FILE) etc/x2goagent.keyboard $(DESTDIR)$(ETCDIR_X2GO)/ - - # x2goagent.features file for X2Go - $(INSTALL_DIR) $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/ - $(INSTALL_FILE) x2goagent.features $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/ - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/x2go - $(INSTALL_SYMLINK) $(ETCDIR_X2GO)/rgb $(DESTDIR)$(PREFIX)/share/x2go/rgb $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb + $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent + $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy uninstall: $(MAKE) uninstall-lite @@ -188,17 +168,15 @@ uninstall-lite: $(RM_FILE) $(DESTDIR)$(NXLIBDIR)/bin/nxproxy $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/bin/ $(RM_FILE) $(DESTDIR)$(PREFIX)/share/man/man1/*.1 + $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy + $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/share/nx/ uninstall-full: - for f in nxagent nxauth x2goagent; do \ + for f in nxagent nxauth; do \ $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done - $(RM_FILE) $(DESTDIR)$(X2GOLIBDIR)/bin/x2goagent - $(RM_DIR) $(DESTDIR)$(X2GOLIBDIR)/bin/ - - # x2goagent.features file for X2Go - $(RM_FILE) $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/x2goagent.features - $(RM_DIR) $(DESTDIR)$(X2GODATADIR)/x2gofeature.d/ + $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent + $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/share/nx/ if test -d nx-X11; then \ if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ diff --git a/VERSION.x2goagent b/VERSION.x2goagent deleted file mode 120000 index 974cf28e0..000000000 --- a/VERSION.x2goagent +++ /dev/null @@ -1 +0,0 @@ -VERSION \ No newline at end of file diff --git a/bin/x2goagent b/bin/x2goagent deleted file mode 100644 index 09011efbe..000000000 --- a/bin/x2goagent +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NXAPP=x2goagent -NX_LIBS=/usr/lib/nx -NX_LOCAL_LIBS=/usr/local/lib/nx - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -test -x $NX_LOCAL_LIBS/../x2go/bin/$NXAPP && export NX_LIBS=$NX_LOCAL_LIBS -test -x $NX_LIBS/../x2go/bin/$NXAPP && export NX_LIBS=$NX_LIBS - -exec $NX_LIBS/../x2go/bin/$NXAPP "$@" diff --git a/debian/README.source b/debian/README.source index 800a55d8a..a43fa1de5 100644 --- a/debian/README.source +++ b/debian/README.source @@ -1,12 +1,12 @@ UPSTREAM SOURCES ---------------- -The current upstream source for this package is NoMachine. -http://www.nomachine.com/sources.php +The current upstream source for this package is the Arctica Project. +https://github.com/ArcticaProject/nx-libs PACKAGE SOURCE TREE ------------------- -This package pulls in 7 source tarballs from NoMachine: +This package originally pulled in 7 source tarballs from NoMachine: nx-X11 nxagent @@ -16,26 +16,5 @@ This package pulls in 7 source tarballs from NoMachine: nxcompext nxproxy -Intensive tests with X2Go/FreeNX on Debian squeeze+ systems showed an extreme -instability of nxagent when the named sources had been built separately against the -distribution's Xorg & co. libraries. -The recommended build method by NoMachine is placing the above projects into one -big source tree and build them in one go. When this build method is chosen, -the instability issues of nxagent (and x2goagent) disappear. - -Unfortunately, so far we could not track down the exact problem of building the -above sources in separate packages. - - -PATCH SYSTEM ------------- -This package uses quilt to manage all modifications to the upstream source. -Changes are stored in the source package as diffs in debian/patches and -applied during the build. - -See /usr/share/doc/quilt/README.source for a detailed explanation. - - - -X2Go Packaging Team / Mike Gabriel (20111231) \ No newline at end of file +Arctica Project / Mike Gabriel (2016-06-22) \ No newline at end of file diff --git a/debian/control b/debian/control index a621bddd7..2344dd37f 100644 --- a/debian/control +++ b/debian/control @@ -1,11 +1,10 @@ Source: nx-libs Section: x11 Priority: extra -Maintainer: X2Go Developers +Maintainer: Artica Project Uploaders: - Reinhard Tartler , Mike Gabriel , - Oleksandr Shneyder , + Mihai Moldovan Build-Depends: debhelper (>= 7.0.50~), libpng-dev, @@ -30,9 +29,9 @@ Build-Depends: expat, libpixman-1-dev (>= 0.13.2), Standards-Version: 3.9.6 -Homepage: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary -Vcs-Git: git://code.x2go.org/nx-libs.git -Vcs-Browser: http://code.x2go.org/gitweb?p=nx-libs.git;a=summary +Homepage: https://github.com/ArcticaProject/nx-libs/ +Vcs-Git: https://github.com/ArcticaProject/nx-libs/ +Vcs-Browser: https://github.com/ArcticaProject/nx-libs/ Package: nx-x11-common Architecture: all @@ -40,8 +39,8 @@ Multi-Arch: foreign Depends: ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11 (<< 2:3.5.0.29-0x2go2~), - nxagent (<< 2:3.5.0.29-0x2go2~), + libnx-x11 (<< 2:3.5.0.29-1~), + nxagent (<< 2:3.5.0.29-1~), Description: nx-X11 (common files) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -55,7 +54,7 @@ Architecture: any Depends: ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), + libnx-x11-dev (<< 2:3.5.0.29-1~), Description: nx-X11 core wire protocol and auxiliary headers NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -89,7 +88,7 @@ Depends: ${misc:Depends}, nx-x11-common (>= ${source:Version}), nx-x11-common (<< ${source:Version}.1), Breaks: nxlibs (<= 3.5.1), - libnx-x11 (<< 2:3.5.0.29-0x2go2~), + libnx-x11 (<< 2:3.5.0.29-1~), Replaces: nxlibs, Description: nx-X11 client-side library NX is a software suite which implements very efficient @@ -125,7 +124,7 @@ Depends: libnx-x11-6 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Replaces: nx-x11-dbg, Description: nx-X11 client-side library (debug package) NX is a software suite which implements very efficient @@ -144,7 +143,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11 (<< 2:3.5.0.29-0x2go2~), + libnx-x11 (<< 2:3.5.0.29-1~), Description: nx-X11 authorisation library NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -163,7 +162,7 @@ Depends: libnx-xau6 (= ${binary:Version}), ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), + libnx-x11-dev (<< 2:3.5.0.29-1~), Description: nx-X11 authorisation library (development headers) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -184,7 +183,7 @@ Depends: libnx-xau6 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 authorisation library (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -239,7 +238,7 @@ Multi-Arch: same Depends: ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), + libnx-x11-dev (<< 2:3.5.0.29-1~), Description: nx-X11 Composite extension wire protocol NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -402,7 +401,7 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11 (<< 2:3.5.0.29-0x2go2~), + libnx-x11 (<< 2:3.5.0.29-1~), Description: nx-X11 miscellaneous extension library NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -424,7 +423,7 @@ Depends: nx-x11proto-xext-dev (= ${binary:Version}), ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), + libnx-x11-dev (<< 2:3.5.0.29-1~), Description: nx-X11 miscellaneous extension library (development headers) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -443,7 +442,7 @@ Depends: libnx-xext6 (= ${binary:Version}), ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), + libnx-x11-dev (<< 2:3.5.0.29-1~), libnx-xext-dev (<< 2:3.5.99.0~), Description: nx-X11 miscellaneous extension wire protocol NX is a software suite which implements very efficient @@ -463,7 +462,7 @@ Depends: libnx-xext6 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 miscellaneous extension library (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -516,7 +515,7 @@ Multi-Arch: same Depends: ${misc:Depends}, Breaks: nxlibs (<= 3.5.1), - libnx-x11-dev (<< 2:3.5.0.29-0x2go2~), + libnx-x11-dev (<< 2:3.5.0.29-1~), Description: nx-X11 'xfixes' extension wire protocol NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -604,7 +603,7 @@ Depends: libnx-xinerama1 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 Xinerama extension library (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -661,7 +660,7 @@ Pre-Depends: Depends: ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 pixmap library (debug package, dummy package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -919,7 +918,7 @@ Multi-Arch: foreign Depends: nxagent (= ${binary:Version}), ${misc:Depends}, -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: NX agent (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -934,28 +933,6 @@ Description: NX agent (debug package) helpful backtraces. You can safely remove it if you do not intend to debug NX packages on this system. -Package: x2goagent -Architecture: all -Depends: - nxagent (>= ${source:Version}), nxagent (<< ${source:Version}.1), - ${misc:Depends}, -Suggests: - x2goserver -Description: X2Go agent - X2Go is a software suite that uses NX technology for remote desktop - computing. - . - NX technology implements a very efficient compression of the X11 protocol. - This increases performance when using X applications over a network, - especially a slow one. - . - X2Go agent functionality has been completely incorporated into NX agent's - code base. If the nxagent binary is executed under the name of `x2goagent', - the X2Go functionalities get activated. - . - The x2goagent package is a wrapper that activates X2Go branding in nxagent. - Please refer to the nxagent package's description for more information on NX. - Package: nxproxy Architecture: any Breaks: qvd-nxproxy @@ -980,7 +957,7 @@ Depends: ${misc:Depends}, Suggests: libxcomp3-dbg, -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: NX proxy (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -1012,7 +989,7 @@ Multi-Arch: foreign Depends: nxauth (= ${binary:Version}), ${misc:Depends}, -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: NX auth (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -1070,7 +1047,7 @@ Depends: libxcomp3 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 compression library (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -1125,7 +1102,7 @@ Depends: libxcompext3 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 protocol compression extensions library (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -1179,7 +1156,7 @@ Depends: libxcompshad3 (= ${binary:Version}), ${misc:Depends}, Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-0x2go2~), +Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), Description: nx-X11 shadowing library (debug package) NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when diff --git a/debian/nxagent.install b/debian/nxagent.install index eaaa847e9..123971a7c 100644 --- a/debian/nxagent.install +++ b/debian/nxagent.install @@ -1,6 +1,7 @@ etc/nxagent/keystrokes.cfg etc/nxagent/rgb usr/share/nx/rgb +usr/share/nx/VERSION.nxagent usr/share/man/man1/nxagent.1* usr/lib/nx/bin/nxagent usr/bin/nxagent diff --git a/debian/nxproxy.install b/debian/nxproxy.install index 5a55a9825..ab7c97d58 100644 --- a/debian/nxproxy.install +++ b/debian/nxproxy.install @@ -1,3 +1,4 @@ usr/lib/nx/bin/nxproxy usr/bin/nxproxy usr/share/man/man1/nxproxy.1* +usr/share/nx/VERSION.nxproxy diff --git a/debian/roll-tarballs.sh b/debian/roll-tarballs.sh index 52c2090f0..24f7b07b0 100755 --- a/debian/roll-tarballs.sh +++ b/debian/roll-tarballs.sh @@ -100,14 +100,13 @@ if [ "x$MODE" = "xfull" ]; then echo "${file##*/}" >> "doc/applied-patches/series" done else - rm -f "bin/"{nxagent,nxauth,x2goagent} + rm -f "bin/"{nxagent,nxauth} rm -Rf "nxcompshad"* rm -Rf "nxcompext"* rm -Rf "nx-X11"* rm -Rf "etc"* rm -Rf "doc/nx-X11_vs_XOrg69_patches"* rm -f "README.keystrokes" - rm -f "VERSION.x2goagent" cat "debian/patches/series" | sort | grep -v '^#' | egrep "([0-9]+(_|-).*\.full\+lite\.patch)" | while read file do cp -v "debian/patches/$file" "doc/applied-patches/" diff --git a/debian/watch b/debian/watch new file mode 100644 index 000000000..4ca027c1b --- /dev/null +++ b/debian/watch @@ -0,0 +1,3 @@ +version=3 +opts=filenamemangle=s/.*\/.*?([\d\.-]+)\.tar\.gz/nx-libs-$1.tar.gz/ \ +https://github.com/ArcticaProject/nx-libs/tags .*/archive/.*?([\d\.]+).tar.gz diff --git a/debian/watch.nx-X11 b/debian/watch.nx-X11 deleted file mode 100644 index dfe41c643..000000000 --- a/debian/watch.nx-X11 +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nx-X11-([\d\.-]*)\.tar\.gz diff --git a/debian/watch.nxagent b/debian/watch.nxagent deleted file mode 100644 index 7f22764b3..000000000 --- a/debian/watch.nxagent +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nxagent-([\d\.-]*)\.tar\.gz diff --git a/debian/watch.nxauth b/debian/watch.nxauth deleted file mode 100644 index b505077c0..000000000 --- a/debian/watch.nxauth +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nxauth-([\d\.-]*)\.tar\.gz diff --git a/debian/watch.nxcomp b/debian/watch.nxcomp deleted file mode 100644 index 75f24916b..000000000 --- a/debian/watch.nxcomp +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nxcomp-([\d\.-]*)\.tar\.gz diff --git a/debian/watch.nxcompext b/debian/watch.nxcompext deleted file mode 100644 index 67883630e..000000000 --- a/debian/watch.nxcompext +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nxcompext-([\d\.-]*)\.tar\.gz diff --git a/debian/watch.nxcompshad b/debian/watch.nxcompshad deleted file mode 100644 index 43e2e528a..000000000 --- a/debian/watch.nxcompshad +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nxcompshad-([\d\.-]*)\.tar\.gz diff --git a/debian/watch.nxproxy b/debian/watch.nxproxy deleted file mode 100644 index bbf27fd2f..000000000 --- a/debian/watch.nxproxy +++ /dev/null @@ -1,3 +0,0 @@ -version=3 -http://www.nomachine.com/sources.php \ - http://[^"]*/nxproxy-([\d\.-]*)\.tar\.gz diff --git a/debian/x2goagent.dirs b/debian/x2goagent.dirs deleted file mode 100644 index 548ecdfc7..000000000 --- a/debian/x2goagent.dirs +++ /dev/null @@ -1,3 +0,0 @@ -usr/bin -usr/share/pixmaps -usr/share/x2go diff --git a/debian/x2goagent.install b/debian/x2goagent.install deleted file mode 100644 index 0603507ef..000000000 --- a/debian/x2goagent.install +++ /dev/null @@ -1,10 +0,0 @@ -usr/bin/x2goagent -usr/lib/x2go/bin/x2goagent -usr/share/pixmaps/x2go.xpm -usr/share/x2go/rgb -usr/share/man/man1/x2goagent.1* -etc/x2go/rgb -usr/share/x2go/versions/VERSION.x2goagent -usr/share/x2go/x2gofeature.d/x2goagent.features -etc/x2go/keystrokes.cfg -etc/x2go/x2goagent.keyboard diff --git a/etc/x2goagent.keyboard b/etc/x2goagent.keyboard deleted file mode 100644 index afe283260..000000000 --- a/etc/x2goagent.keyboard +++ /dev/null @@ -1 +0,0 @@ -rules=xfree86 diff --git a/nx-libs.spec b/nx-libs.spec index cf0a25228..770f1870a 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -11,7 +11,7 @@ License: GPL-2.0+ %else License: GPLv2+ %endif -URL: http://x2go.org/ +URL: http://github.com/ArcticaProject/nx-libs/ Source0: %{name}-%{version}.tar.gz BuildRequires: autoconf >= 2.13 @@ -419,21 +419,6 @@ applications over a network, especially a slow one. This package provides the NX proxy (client) binary. -%package -n x2goagent -Group: Applications/System -Summary: X2Go Agent -Requires: nxagent - -%description -n x2goagent -X2Go Agent functionality has been completely incorporated into -nxagent's code base. If the nxagent binary is executed under the name -of "x2goagent", the X2Go functionalities get activated. - -The x2goagent package is a wrapper that activates X2Go branding in -nxagent. Please refer to the nxagent package's description for more -information on NX. - - %prep %setup -q # remove build cruft that is in Git (also taken from roll-tarball.sh) @@ -446,7 +431,6 @@ sed -i -e 's#-O3#%{optflags}#' nx-X11/config/cf/host.def # We're installing binaries into %%{_libdir}/nx/bin rather than %%{_libexedir}/nx # because upstream expects libraries and binaries in the same directory sed -i -e 's,/lib/nx,/%{_lib}/nx,' Makefile nx-X11/config/cf/X11.tmpl -sed -i -e 's,/lib/x2go,/%{_lib}/x2go,' Makefile sed -i -e 's,/usr/lib/,/usr/%{_lib}/,' bin/* # Fix FSF address find -name LICENSE | xargs sed -i \ @@ -484,10 +468,6 @@ make install \ # Remove static libs (they don't exist on SLES, so using -f here) rm -f %{buildroot}%{_libdir}/*.a -# Make sure x2goagent is linked relative and on 64-bit -mkdir -p %{buildroot}%{_libdir}/x2go/bin -ln -sf ../../nx/bin/nxagent %{buildroot}%{_libdir}/x2go/bin/x2goagent - # Fix permissions on shared libraries chmod 755 %{buildroot}%{_libdir}/lib*.so* @@ -704,21 +684,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %dir %{_libdir}/nx/bin %{_libdir}/nx/bin/nxproxy -%files -n x2goagent -%defattr(-,root,root) -#%%{_sysconfdir}/x2go is owned by x2goserver, which this requires -%dir %{_sysconfdir}/x2go -%dir %{_libdir}/x2go -%dir %{_libdir}/x2go/bin -%config(noreplace) %{_sysconfdir}/x2go/keystrokes.cfg -%config(noreplace) %{_sysconfdir}/x2go/x2goagent.keyboard -%config(noreplace) %{_sysconfdir}/x2go/rgb -%{_bindir}/x2goagent -%{_libdir}/x2go/bin/x2goagent -%{_datadir}/pixmaps/x2go.xpm -%{_datadir}/x2go/ -%{_datadir}/man/man1/x2goagent.1* - %changelog * Thu Jan 29 2015 Mike Gabriel 3.5.99.0 diff --git a/x2goagent.features b/x2goagent.features deleted file mode 100644 index 12d62e01c..000000000 --- a/x2goagent.features +++ /dev/null @@ -1,37 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2015, Mike Gabriel -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -# silently bail out if X2Go Server is not installed -if ! which x2gopath 1>/dev/null; then - exit 0 -fi - -X2GO_LIB_PATH="$(x2gopath libexec)"; - -$X2GO_LIB_PATH/x2gosyslog "$0" "info" "$(basename $0) called with options: $@" - -X2GO_FEATURE=$1 - -# check for X2Go Agent features -case "$X2GO_FEATURE" in - - "X2GOAGENT_RANDRXINERAMA") echo "ok"; exit 0;; - *) exit -1;; - -esac -- cgit v1.2.3 From d650a0b47eadeb675e2d2cf03ad10a4dbc564971 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 23 Jun 2016 14:27:15 +0200 Subject: OPTFLAGS: Properly propagate build option flags to nxcomp{,ext,shad} and the nx-X11 build scripts. Note: - The "normal" way to inject CFLAGS (and CPPFLAGS) into nx-X11 builds is copying those options over into the variable CDEBUGFLAGS. - LDFLAGS have to be handed to nx-X11 via LOCAL_LDFLAGS. This change also includes a slight change in the nx-X11 build order. Old build order: Main Makefile: - [...] - libNX_X11 + implicitly building nxcomp + implicitly building nxcompext - [...] - nxagent + implicitly building nxcompshad - [...] New build ordner: Main Makefile: - [...] - nxcomp - setup nx-X11 build env + cd nx-X11 && make BuildEnv - nx-X11/lib/* - nxcompext - nxcompshad - [...] - nxagent - [...] Fixes ArcticaProject/nx-libs#141 Fixes X2GoBTS#84 --- Makefile | 14 +++++++++++--- debian/rules | 2 +- nx-X11/Makefile | 16 ++++++++++------ nx-X11/lib/X11/Imakefile | 38 -------------------------------------- nx-X11/programs/Xserver/Imakefile | 22 +--------------------- nx-libs.spec | 1 + nxcomp/Makefile.in | 6 ++++-- nxcomp/configure.in | 8 ++++++-- nxcompext/Makefile.in | 6 ++++-- nxcompext/configure.in | 8 ++++++-- nxcompshad/Makefile.in | 6 ++++-- nxcompshad/configure.in | 12 ++++++++---- nxproxy/configure.in | 8 ++++++-- 13 files changed, 62 insertions(+), 85 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index e2077ed5b..daff448cd 100644 --- a/Makefile +++ b/Makefile @@ -49,9 +49,7 @@ build-lite: build-full: # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... - cd nxcomp && autoconf - cd nxcompext && autoconf - cd nxcompshad && autoconf + cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} # prepare nx-X11/config/cf/nxversion.def sed \ @@ -62,6 +60,16 @@ build-full: nx-X11/config/cf/nxversion.def.in \ > nx-X11/config/cf/nxversion.def + # prepare Makefiles and the nx-X11 symlinking magic + cd nx-X11 && make BuildEnv + + # build libNX_X11 and libNX_Xext prior to building + # nxcomp{ext,shad}. + cd nx-X11/lib && make + + cd nxcompext && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} + cd nx-X11 && ${MAKE} World cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} diff --git a/debian/rules b/debian/rules index a37478c21..275956c9a 100755 --- a/debian/rules +++ b/debian/rules @@ -66,7 +66,7 @@ override_dh_auto_install: override_dh_auto_build: - LOCAL_LDFLAGS="$(LDFLAGS)" SHLIBGLOBALSFLAGS="$(LDFLAGS)" SHLIBDIR="$(LIBDIR)" PREFIX=/usr dh_auto_build --parallel + PREFIX=/usr dh_auto_build --parallel -- CDEBUGFLAGS="$(CPPFLAGS) $(CFLAGS)" LOCAL_LDFLAGS="$(LDFLAGS)" SHLIBGLOBALSFLAGS="$(LDFLAGS)" SHLIBDIR="$(LIBDIR)" override_dh_strip: dh_strip -plibnx-x11-6 --dbg-package=libnx-x11-6-dbg diff --git a/nx-X11/Makefile b/nx-X11/Makefile index cb8c86b2b..1096e62cf 100644 --- a/nx-X11/Makefile +++ b/nx-X11/Makefile @@ -39,6 +39,15 @@ World: @echo "" @date @echo "" + if [ ! -f xmakefile ]; then ${MAKE} ${MFLAGS} BuildEnv; fi + ${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World + @echo "" + @date + @echo "" + @echo Full build of $(RELEASE) complete. + @echo "" + +BuildEnv: @if [ -f xmakefile ]; then \ ${MAKE} ${MAKE_OPTS} -k distclean || \ ${MAKE} ${MAKE_OPTS} -k clean || \ @@ -52,12 +61,7 @@ World: ${MAKE} ${MAKE_OPTS} $(MFLAGS) BOOTSTRAPSUBDIRS= clean ${MAKE} ${MAKE_OPTS} $(MFLAGS) includes ${MAKE} ${MAKE_OPTS} $(MFLAGS) depend - ${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World - @echo "" - @date - @echo "" - @echo Full build of $(RELEASE) complete. - @echo "" + .PRECIOUS: Makefile diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile index 81a1cfd3d..1ba1e4818 100644 --- a/nx-X11/lib/X11/Imakefile +++ b/nx-X11/lib/X11/Imakefile @@ -1139,44 +1139,6 @@ includes:: ks_tables.h CONFIGURE ?= ./configure -#if NXLibraries - -$(NX_XCOMPCONFIGTARGET): - cd ../../../nxcomp && \ - ${CONFIGURE} - -$(NX_XCOMPEXTCONFIGTARGET): - cd ../../../nxcompext && \ - ${CONFIGURE} - -#ifdef SunArchitecture -$(NX_XCOMPLIBTARGET): $(NX_XCOMPCONFIGTARGET) - ${MAKE} -C $(NX_XCOMPLIBDIR) - -$(NX_XCOMPEXTLIBTARGET): $(NX_XCOMPEXTCONFIGTARGET) - ${MAKE} -C ../../../nxcompext - -#else -$(NX_XCOMPLIBTARGET): $(NX_XCOMPCONFIGTARGET) - ${MAKE} -C $(NX_XCOMPLIBDIR) - -$(NX_XCOMPEXTLIBTARGET): $(NX_XCOMPEXTCONFIGTARGET) $(NX_XCOMPLIBTARGET) lib$(LIBNAME).so.$(SOXLIBREV) - ${MAKE} -C ../../../nxcompext - -#endif - -depend:: - -lib$(LIBNAME).so.$(SOXLIBREV): $(NX_XCOMPLIBTARGET) - -all:: $(NX_XCOMPLIBTARGET) - -depend:: $(NX_XCOMPLIBTARGET) - -all:: $(NX_XCOMPEXTLIBTARGET) - -#endif - depend:: ks_tables.h clean:: diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 0d820fad2..50031217e 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -455,27 +455,7 @@ NX_XSHADOWLIBNAME = cygXcompshad.dll NX_XSHADOWLIBNAME = libXcompshad.so #endif -NX_XSHADOWLIBDIR = $(XTOP)/../nxcompshad -NX_XSHADOWLIBTARGET = $(NX_XSHADOWLIBDIR)/$(NX_XSHADOWLIBNAME) -NX_XSHADOWCONFIGTARGET = $(NX_XSHADOWLIBDIR)/config.status - -CONFIGURE ?= ./configure - -$(NX_XSHADOWCONFIGTARGET): - cd $(NX_XSHADOWLIBDIR) && \ - ${CONFIGURE} - -#ifdef SunArchitecture -$(NX_XSHADOWLIBTARGET): $(NX_XSHADOWCONFIGTARGET) - cd $(NX_XSHADOWLIBDIR) && \ - ${MAKE} -#else -$(NX_XSHADOWLIBTARGET): $(NX_XSHADOWCONFIGTARGET) - cd $(NX_XSHADOWLIBDIR) && \ - rm -f *.o && ${MAKE} -#endif - -ServerTarget(nxagent,$(NX_XSHADOWLIBTARGET) $(NXAGENTDIRS),$(NXAGENTOBJS), \ +ServerTarget(nxagent,$(NXAGENTDIRS),$(NXAGENTOBJS), \ $(LIBCWRAPPER) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXAGENTSYSLIBS) $(NXAGENTNXLIBS)) /* diff --git a/nx-libs.spec b/nx-libs.spec index 770f1870a..8b2ecb09a 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -454,6 +454,7 @@ chmod a+x my_configure; %{!?__global_ldflags: %global __global_ldflags -Wl,-z,relro} export SHLIBGLOBALSFLAGS="%{__global_ldflags}" export LOCAL_LDFLAGS="%{__global_ldflags}" +export CDEBUGFLAGS="%{__global_cppflags} %{__global_cflags}" make %{?_smp_mflags} CONFIGURE="$PWD/my_configure" PREFIX=%{_prefix} USRLIBDIR=%{_libdir} SHLIBDIR=%{_libdir} %install diff --git a/nxcomp/Makefile.in b/nxcomp/Makefile.in index 759ab6a4f..ee12c3dbb 100644 --- a/nxcomp/Makefile.in +++ b/nxcomp/Makefile.in @@ -41,6 +41,8 @@ CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ CXXINCLUDES = CXXDEFINES = +CPPFLAGS = @CPPFLAGS@ + # # C programs have their own CFLAGS. # @@ -87,9 +89,9 @@ DEPENDINCLUDES = -I/usr/include/c++ -I/usr/include/g++ -I/usr/include/g++-3 .SUFFIXES: .cpp.c .cpp.o: - $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< .c.o: - $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< + $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< LIBRARY = Xcomp diff --git a/nxcomp/configure.in b/nxcomp/configure.in index 47b29e7bc..6586f22b2 100644 --- a/nxcomp/configure.in +++ b/nxcomp/configure.in @@ -10,8 +10,12 @@ AC_SUBST(pkgconfigdir) dnl Set our default compilation flags. -CXXFLAGS="$CXXFLAGS -O3 -fno-rtti -fno-exceptions" -CFLAGS="$CFLAGS -O3" +if test "x$CXXFLAGS" = "x"; then + CXXFLAGS="-O3 -fno-rtti -fno-exceptions" +fi +if test "x$CFLAGS" = "x"; then + CFLAGS="$CFLAGS -O3" +fi dnl Reset default linking directives. diff --git a/nxcompext/Makefile.in b/nxcompext/Makefile.in index dd18c8053..415ffabb1 100644 --- a/nxcompext/Makefile.in +++ b/nxcompext/Makefile.in @@ -34,6 +34,8 @@ CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ CXXINCLUDES = -I. -I../nxcomp CXXDEFINES = +CPPFLAGS = @CPPFLAGS@ + CC = @CC@ CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ @@ -78,9 +80,9 @@ DEPENDINCLUDES = -I/usr/include/c++ -I/usr/include/g++ -I/usr/include/g++-3 .SUFFIXES: .cpp.c .cpp.o: - $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $< + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $< .c.o: - $(CC) -c $(CCFLAGS) $(CCINCLUDES) $< + $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $< LIBRARY = Xcompext diff --git a/nxcompext/configure.in b/nxcompext/configure.in index 6078851b4..70bb9d121 100644 --- a/nxcompext/configure.in +++ b/nxcompext/configure.in @@ -10,8 +10,12 @@ AC_SUBST(pkgconfigdir) dnl Reset default compilation flags. -CXXFLAGS="$CXXFLAGS -O3" -CFLAGS="$CFLAGS -O3" +if test "x$CXXFLAGS" = "x"; then + CXXFLAGS="-O3" +fi +if test "x$CFLAGS" == "x"; then + CFLAGS="-O3" +fi dnl Reset default linking directives. diff --git a/nxcompshad/Makefile.in b/nxcompshad/Makefile.in index 68bb1fbad..9c2b6f4fd 100644 --- a/nxcompshad/Makefile.in +++ b/nxcompshad/Makefile.in @@ -36,6 +36,8 @@ CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ CXXINCLUDES = CXXDEFINES = +CPPFLAGS = @CPPFLAGS@ + # # C programs don't share the C++ flags. They should # have their own @CCFLAGS@. @@ -99,9 +101,9 @@ DEPENDINCLUDES = -I/usr/include/g++ -I/usr/include/g++-3 .SUFFIXES: .cpp.c .cpp.o: - $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< + $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< .c.o: - $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< + $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< LIBRARY = Xcompshad diff --git a/nxcompshad/configure.in b/nxcompshad/configure.in index 7ec064cc6..226b13ef8 100644 --- a/nxcompshad/configure.in +++ b/nxcompshad/configure.in @@ -10,8 +10,12 @@ AC_SUBST(pkgconfigdir) dnl Reset default compilation flags. -CXXFLAGS="$CXXFLAGS -O3" -CPPFLAGS="$CPPFLAGS -O3" +if test "x$CXXFLAGS" == "x"; then + CXXFLAGS="-O3" +fi +if test "x$CPPFLAGS" == "x"; then + CPPFLAGS="-O3" +fi dnl Reset default linking directives. @@ -80,8 +84,8 @@ case "${gcc_version}" in *) AC_MSG_RESULT([yes]) - CXXFLAGS="$CXXFLAGS -Wmissing-declarations -Wnested-externs" - CPPFLAGS="$CPPFLAGS -Wmissing-declarations -Wnested-externs" + CXXFLAGS="$CXXFLAGS -Wmissing-declarations" + CPPFLAGS="$CPPFLAGS -Wmissing-declarations" ;; esac diff --git a/nxproxy/configure.in b/nxproxy/configure.in index 268584216..12e2a08d2 100644 --- a/nxproxy/configure.in +++ b/nxproxy/configure.in @@ -7,8 +7,12 @@ AC_PREREQ(2.13) dnl Reset default compilation flags. -CXXFLAGS="$CXXFLAGS -O3" -CPPFLAGS="$CPPFLAGS -O3" +if test "x$CXXFLAGS" == "x"; then + CXXFLAGS="-O3" +fi +if test "x$CPPFLAGS" == "x"; then + CPPFLAGS="-O3" +fi dnl Prefer headers and libraries from nx-X11 if present. -- cgit v1.2.3 From b214c73b5a0c6b9d94671bc08e08049441bf9bc6 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 23 Jun 2016 10:27:37 +0200 Subject: nxauth: Drop nxauth tool completely, xauth can be successfully used with nxagent / nxproxy instead. --- Makefile | 7 +- debian/README.source | 2 +- debian/control | 44 +- debian/nxauth.dirs | 2 - debian/nxauth.install | 3 - debian/rules | 1 - nx-X11/programs/Imakefile | 4 - nx-X11/programs/nxauth/CHANGELOG | 108 --- nx-X11/programs/nxauth/COPYING | 339 ------- nx-X11/programs/nxauth/Imakefile | 38 - nx-X11/programs/nxauth/LICENSE | 26 - nx-X11/programs/nxauth/gethost.c | 287 ------ nx-X11/programs/nxauth/nxauth.man | 236 ----- nx-X11/programs/nxauth/parsedpy.c | 259 ----- nx-X11/programs/nxauth/process.c | 1872 ------------------------------------- nx-X11/programs/nxauth/xauth.c | 184 ---- nx-X11/programs/nxauth/xauth.h | 58 -- nx-libs.spec | 19 - roll-tarballs.sh | 2 +- 19 files changed, 14 insertions(+), 3477 deletions(-) delete mode 100644 debian/nxauth.dirs delete mode 100644 debian/nxauth.install delete mode 100644 nx-X11/programs/nxauth/CHANGELOG delete mode 100644 nx-X11/programs/nxauth/COPYING delete mode 100644 nx-X11/programs/nxauth/Imakefile delete mode 100644 nx-X11/programs/nxauth/LICENSE delete mode 100644 nx-X11/programs/nxauth/gethost.c delete mode 100644 nx-X11/programs/nxauth/nxauth.man delete mode 100644 nx-X11/programs/nxauth/parsedpy.c delete mode 100644 nx-X11/programs/nxauth/process.c delete mode 100644 nx-X11/programs/nxauth/xauth.c delete mode 100644 nx-X11/programs/nxauth/xauth.h (limited to 'Makefile') diff --git a/Makefile b/Makefile index daff448cd..47ac50fe9 100644 --- a/Makefile +++ b/Makefile @@ -103,7 +103,7 @@ install-lite: gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 install-full: - for f in nxagent nxauth; do \ + for f in nxagent; do \ $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done for d in nxcompext nxcompshad; do \ $(MAKE) -C $$d install; done @@ -115,13 +115,10 @@ install-full: $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin - $(INSTALL_PROGRAM) nx-X11/programs/nxauth/nxauth $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nx-X11/programs/nxauth/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/ - mv -f $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.man $(DESTDIR)$(PREFIX)/share/man/man1/nxauth.1 gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 # create a clean nx-X11/.build-exports space @@ -180,7 +177,7 @@ uninstall-lite: $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/share/nx/ uninstall-full: - for f in nxagent nxauth; do \ + for f in nxagent; do \ $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent diff --git a/debian/README.source b/debian/README.source index a43fa1de5..71cc0c2b2 100644 --- a/debian/README.source +++ b/debian/README.source @@ -10,7 +10,7 @@ This package originally pulled in 7 source tarballs from NoMachine: nx-X11 nxagent - nxauth + nxauth (discontinued in nx-libs) nxcomp nxcompshad nxcompext diff --git a/debian/control b/debian/control index 1a58cf6a7..be1e1b2f2 100644 --- a/debian/control +++ b/debian/control @@ -430,6 +430,10 @@ Depends: Recommends: xfonts-base, xkb-data, +Breaks: + nxauth, +Replaces: + nxauth, Description: NX agent NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -473,12 +477,16 @@ Description: NX agent (debug package) Package: nxproxy Architecture: any -Breaks: qvd-nxproxy -Replaces: qvd-nxproxy Multi-Arch: foreign Depends: ${shlibs:Depends}, ${misc:Depends}, +Breaks: + qvd-nxproxy, + nxauth, +Replaces: + qvd-nxproxy, + nxauth, Description: NX proxy NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -507,38 +515,6 @@ Description: NX proxy (debug package) helpful backtraces. You can safely remove it if you do not intend to debug NX packages on this system. -Package: nxauth -Architecture: any -Multi-Arch: foreign -Depends: - ${shlibs:Depends}, - ${misc:Depends}, -Description: NX xauth - NX is a software suite which implements very efficient - compression of the X11 protocol. This increases performance when - using X applications over a network, especially a slow one. - . - This package provides the NX xauth binary. - -Package: nxauth-dbg -Section: debug -Architecture: any -Multi-Arch: foreign -Depends: - nxauth (= ${binary:Version}), - ${misc:Depends}, -Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), -Description: NX auth (debug package) - NX is a software suite which implements very efficient - compression of the X11 protocol. This increases performance when - using X applications over a network, especially a slow one. - . - This package provides the NX auth binary. - . - This package contains detached debug symbols that help generating more - helpful backtraces. You can safely remove it if you do not intend to - debug NX packages on this system. - Package: libxcomp3 Architecture: any Multi-Arch: same diff --git a/debian/nxauth.dirs b/debian/nxauth.dirs deleted file mode 100644 index 7c8e1505c..000000000 --- a/debian/nxauth.dirs +++ /dev/null @@ -1,2 +0,0 @@ -usr/bin -usr/lib/nx/bin diff --git a/debian/nxauth.install b/debian/nxauth.install deleted file mode 100644 index eefba46b9..000000000 --- a/debian/nxauth.install +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/nx/bin/nxauth -usr/bin/nxauth -usr/share/man/man1/nxauth.1* diff --git a/debian/rules b/debian/rules index e41f97c81..a3979b0fe 100755 --- a/debian/rules +++ b/debian/rules @@ -63,5 +63,4 @@ override_dh_strip: dh_strip -plibxcompext3 --dbg-package=libxcompext3-dbg dh_strip -pnxagent --dbg-package=nxagent-dbg dh_strip -pnxproxy --dbg-package=nxproxy-dbg - dh_strip -pnxauth --dbg-package=nxauth-dbg diff --git a/nx-X11/programs/Imakefile b/nx-X11/programs/Imakefile index 77a84a65f..c618d2de9 100644 --- a/nx-X11/programs/Imakefile +++ b/nx-X11/programs/Imakefile @@ -22,11 +22,7 @@ XSSRCDIR = Xserver #endif -#if defined(NXEmbeddedXServer) SUBDIRS = $(XSSRCDIR) -#else -SUBDIRS = $(XSSRCDIR) nxauth -#endif MakeSubdirs($(SUBDIRS)) DependSubdirs($(SUBDIRS)) diff --git a/nx-X11/programs/nxauth/CHANGELOG b/nx-X11/programs/nxauth/CHANGELOG deleted file mode 100644 index 9faf9eba2..000000000 --- a/nx-X11/programs/nxauth/CHANGELOG +++ /dev/null @@ -1,108 +0,0 @@ -ChangeLog: - -nxauth-3.5.0-1 - -- Opened the 3.5.0 branch based on nxauth-3.4.0-3. - -- Updated copyright to year 2011. - -nxauth-3.4.0-3 - -- Updated the launchd socket detection to support OSX versions relea- - sed so far. - -nxauth-3.4.0-2 - -- Updated copyright to year 2010. - -nxauth-3.4.0-1 - -- Opened the 3.4.0 branch based on nxauth-3.3.0-1. - -- Updated copyright to year 2009. - -nxauth-3.3.0-1 - -- Opened the 3.3.0 branch based on nxauth-3.2.0-1. - -nxauth-3.2.0-1 - -- Opened the 3.2.0 branch based on nxauth-3.1.0-2. - -nxauth-3.1.0-2 - -- Added support for launchd socket. - -nxauth-3.1.0-1 - -- Opened the 3.1.0 branch based on nxauth-3.0.0-6. - -nxauth-3.0.0-6 - -- Updated the NoMachine copyright notice. - -nxauth-3.0.0-5 - -- Changed the copyright attribution from Medialogic to NoMachine. - -nxauth-3.0.0-4 - -- Changed the LICENSE file to state that the software is only made - available under the version 2 of the GPL. - -- Added file COPYING. - -nxauth-3.0.0-3 - -- Updated copyright notices to year 2007. - -nxauth-3.0.0-2 - -- Imported changes up to nxauth-2.1.0-1. - -- Ignoring lock on '.Xauthority' file. - -- Using '__CYGWIN__' definition in process.c. 'WIN32' is not defined - during compilation under nx-X11 and wrong code block is used to - rename xauth temporary file. - -nxauth-3.0.0-1 - -- Opened the 3.0.0 branch based on nxauth-2.0.0-2. - -nxauth-2.0.0-2 - -- Updated the NoMachine copyright notices. - -nxauth-2.0.0-1 - -- Opened the 2.0.0 branch based on the 1.6.0-1. - -nxauth-1.6.0-1 - -- Opened the 1.6.0 branch based on nxauth-1.5.0-1. - -nxauth-1.5.0-1 - -- Opened the 1.5.0 branch. - -nxauth-1.4.1-1 - -- Opened the 1.4.1 branch. - -nxauth-1.4.0-2 - -- Removed debug message 'host name is'. - -nxauth-1.4.0-1 - -- Opened the 1.4.0 branch based on nxauth-1.3.2-1. - -nxauth-1.3.2-1 - -- Opened the 1.3.2 branch. - -nxauth-1.3.1-2 - -- Fixed problem with compilation on systems without - X11 includes instaled. diff --git a/nx-X11/programs/nxauth/COPYING b/nx-X11/programs/nxauth/COPYING deleted file mode 100644 index d511905c1..000000000 --- a/nx-X11/programs/nxauth/COPYING +++ /dev/null @@ -1,339 +0,0 @@ - GNU GENERAL PUBLIC LICENSE - Version 2, June 1991 - - Copyright (C) 1989, 1991 Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - Everyone is permitted to copy and distribute verbatim copies - of this license document, but changing it is not allowed. - - Preamble - - The licenses for most software are designed to take away your -freedom to share and change it. By contrast, the GNU General Public -License is intended to guarantee your freedom to share and change free -software--to make sure the software is free for all its users. This -General Public License applies to most of the Free Software -Foundation's software and to any other program whose authors commit to -using it. (Some other Free Software Foundation software is covered by -the GNU Lesser General Public License instead.) You can apply it to -your programs, too. - - When we speak of free software, we are referring to freedom, not -price. Our General Public Licenses are designed to make sure that you -have the freedom to distribute copies of free software (and charge for -this service if you wish), that you receive source code or can get it -if you want it, that you can change the software or use pieces of it -in new free programs; and that you know you can do these things. - - To protect your rights, we need to make restrictions that forbid -anyone to deny you these rights or to ask you to surrender the rights. -These restrictions translate to certain responsibilities for you if you -distribute copies of the software, or if you modify it. - - For example, if you distribute copies of such a program, whether -gratis or for a fee, you must give the recipients all the rights that -you have. You must make sure that they, too, receive or can get the -source code. And you must show them these terms so they know their -rights. - - We protect your rights with two steps: (1) copyright the software, and -(2) offer you this license which gives you legal permission to copy, -distribute and/or modify the software. - - Also, for each author's protection and ours, we want to make certain -that everyone understands that there is no warranty for this free -software. If the software is modified by someone else and passed on, we -want its recipients to know that what they have is not the original, so -that any problems introduced by others will not reflect on the original -authors' reputations. - - Finally, any free program is threatened constantly by software -patents. We wish to avoid the danger that redistributors of a free -program will individually obtain patent licenses, in effect making the -program proprietary. To prevent this, we have made it clear that any -patent must be licensed for everyone's free use or not licensed at all. - - The precise terms and conditions for copying, distribution and -modification follow. - - GNU GENERAL PUBLIC LICENSE - TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION - - 0. This License applies to any program or other work which contains -a notice placed by the copyright holder saying it may be distributed -under the terms of this General Public License. The "Program", below, -refers to any such program or work, and a "work based on the Program" -means either the Program or any derivative work under copyright law: -that is to say, a work containing the Program or a portion of it, -either verbatim or with modifications and/or translated into another -language. (Hereinafter, translation is included without limitation in -the term "modification".) Each licensee is addressed as "you". - -Activities other than copying, distribution and modification are not -covered by this License; they are outside its scope. The act of -running the Program is not restricted, and the output from the Program -is covered only if its contents constitute a work based on the -Program (independent of having been made by running the Program). -Whether that is true depends on what the Program does. - - 1. You may copy and distribute verbatim copies of the Program's -source code as you receive it, in any medium, provided that you -conspicuously and appropriately publish on each copy an appropriate -copyright notice and disclaimer of warranty; keep intact all the -notices that refer to this License and to the absence of any warranty; -and give any other recipients of the Program a copy of this License -along with the Program. - -You may charge a fee for the physical act of transferring a copy, and -you may at your option offer warranty protection in exchange for a fee. - - 2. You may modify your copy or copies of the Program or any portion -of it, thus forming a work based on the Program, and copy and -distribute such modifications or work under the terms of Section 1 -above, provided that you also meet all of these conditions: - - a) You must cause the modified files to carry prominent notices - stating that you changed the files and the date of any change. - - b) You must cause any work that you distribute or publish, that in - whole or in part contains or is derived from the Program or any - part thereof, to be licensed as a whole at no charge to all third - parties under the terms of this License. - - c) If the modified program normally reads commands interactively - when run, you must cause it, when started running for such - interactive use in the most ordinary way, to print or display an - announcement including an appropriate copyright notice and a - notice that there is no warranty (or else, saying that you provide - a warranty) and that users may redistribute the program under - these conditions, and telling the user how to view a copy of this - License. (Exception: if the Program itself is interactive but - does not normally print such an announcement, your work based on - the Program is not required to print an announcement.) - -These requirements apply to the modified work as a whole. If -identifiable sections of that work are not derived from the Program, -and can be reasonably considered independent and separate works in -themselves, then this License, and its terms, do not apply to those -sections when you distribute them as separate works. But when you -distribute the same sections as part of a whole which is a work based -on the Program, the distribution of the whole must be on the terms of -this License, whose permissions for other licensees extend to the -entire whole, and thus to each and every part regardless of who wrote it. - -Thus, it is not the intent of this section to claim rights or contest -your rights to work written entirely by you; rather, the intent is to -exercise the right to control the distribution of derivative or -collective works based on the Program. - -In addition, mere aggregation of another work not based on the Program -with the Program (or with a work based on the Program) on a volume of -a storage or distribution medium does not bring the other work under -the scope of this License. - - 3. You may copy and distribute the Program (or a work based on it, -under Section 2) in object code or executable form under the terms of -Sections 1 and 2 above provided that you also do one of the following: - - a) Accompany it with the complete corresponding machine-readable - source code, which must be distributed under the terms of Sections - 1 and 2 above on a medium customarily used for software interchange; or, - - b) Accompany it with a written offer, valid for at least three - years, to give any third party, for a charge no more than your - cost of physically performing source distribution, a complete - machine-readable copy of the corresponding source code, to be - distributed under the terms of Sections 1 and 2 above on a medium - customarily used for software interchange; or, - - c) Accompany it with the information you received as to the offer - to distribute corresponding source code. (This alternative is - allowed only for noncommercial distribution and only if you - received the program in object code or executable form with such - an offer, in accord with Subsection b above.) - -The source code for a work means the preferred form of the work for -making modifications to it. For an executable work, complete source -code means all the source code for all modules it contains, plus any -associated interface definition files, plus the scripts used to -control compilation and installation of the executable. However, as a -special exception, the source code distributed need not include -anything that is normally distributed (in either source or binary -form) with the major components (compiler, kernel, and so on) of the -operating system on which the executable runs, unless that component -itself accompanies the executable. - -If distribution of executable or object code is made by offering -access to copy from a designated place, then offering equivalent -access to copy the source code from the same place counts as -distribution of the source code, even though third parties are not -compelled to copy the source along with the object code. - - 4. You may not copy, modify, sublicense, or distribute the Program -except as expressly provided under this License. Any attempt -otherwise to copy, modify, sublicense or distribute the Program is -void, and will automatically terminate your rights under this License. -However, parties who have received copies, or rights, from you under -this License will not have their licenses terminated so long as such -parties remain in full compliance. - - 5. You are not required to accept this License, since you have not -signed it. However, nothing else grants you permission to modify or -distribute the Program or its derivative works. These actions are -prohibited by law if you do not accept this License. Therefore, by -modifying or distributing the Program (or any work based on the -Program), you indicate your acceptance of this License to do so, and -all its terms and conditions for copying, distributing or modifying -the Program or works based on it. - - 6. Each time you redistribute the Program (or any work based on the -Program), the recipient automatically receives a license from the -original licensor to copy, distribute or modify the Program subject to -these terms and conditions. You may not impose any further -restrictions on the recipients' exercise of the rights granted herein. -You are not responsible for enforcing compliance by third parties to -this License. - - 7. If, as a consequence of a court judgment or allegation of patent -infringement or for any other reason (not limited to patent issues), -conditions are imposed on you (whether by court order, agreement or -otherwise) that contradict the conditions of this License, they do not -excuse you from the conditions of this License. If you cannot -distribute so as to satisfy simultaneously your obligations under this -License and any other pertinent obligations, then as a consequence you -may not distribute the Program at all. For example, if a patent -license would not permit royalty-free redistribution of the Program by -all those who receive copies directly or indirectly through you, then -the only way you could satisfy both it and this License would be to -refrain entirely from distribution of the Program. - -If any portion of this section is held invalid or unenforceable under -any particular circumstance, the balance of the section is intended to -apply and the section as a whole is intended to apply in other -circumstances. - -It is not the purpose of this section to induce you to infringe any -patents or other property right claims or to contest validity of any -such claims; this section has the sole purpose of protecting the -integrity of the free software distribution system, which is -implemented by public license practices. Many people have made -generous contributions to the wide range of software distributed -through that system in reliance on consistent application of that -system; it is up to the author/donor to decide if he or she is willing -to distribute software through any other system and a licensee cannot -impose that choice. - -This section is intended to make thoroughly clear what is believed to -be a consequence of the rest of this License. - - 8. If the distribution and/or use of the Program is restricted in -certain countries either by patents or by copyrighted interfaces, the -original copyright holder who places the Program under this License -may add an explicit geographical distribution limitation excluding -those countries, so that distribution is permitted only in or among -countries not thus excluded. In such case, this License incorporates -the limitation as if written in the body of this License. - - 9. The Free Software Foundation may publish revised and/or new versions -of the General Public License from time to time. Such new versions will -be similar in spirit to the present version, but may differ in detail to -address new problems or concerns. - -Each version is given a distinguishing version number. If the Program -specifies a version number of this License which applies to it and "any -later version", you have the option of following the terms and conditions -either of that version or of any later version published by the Free -Software Foundation. If the Program does not specify a version number of -this License, you may choose any version ever published by the Free Software -Foundation. - - 10. If you wish to incorporate parts of the Program into other free -programs whose distribution conditions are different, write to the author -to ask for permission. For software which is copyrighted by the Free -Software Foundation, write to the Free Software Foundation; we sometimes -make exceptions for this. Our decision will be guided by the two goals -of preserving the free status of all derivatives of our free software and -of promoting the sharing and reuse of software generally. - - NO WARRANTY - - 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY -FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN -OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES -PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED -OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS -TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE -PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, -REPAIR OR CORRECTION. - - 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING -WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR -REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, -INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING -OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED -TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY -YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER -PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE -POSSIBILITY OF SUCH DAMAGES. - - END OF TERMS AND CONDITIONS - - How to Apply These Terms to Your New Programs - - If you develop a new program, and you want it to be of the greatest -possible use to the public, the best way to achieve this is to make it -free software which everyone can redistribute and change under these terms. - - To do so, attach the following notices to the program. It is safest -to attach them to the start of each source file to most effectively -convey the exclusion of warranty; and each file should have at least -the "copyright" line and a pointer to where the full notice is found. - - - Copyright (C) - - This program is free software; you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation; either version 2 of the License, or - (at your option) any later version. - - This program is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License along - with this program; if not, write to the Free Software Foundation, Inc., - 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -Also add information on how to contact you by electronic and paper mail. - -If the program is interactive, make it output a short notice like this -when it starts in an interactive mode: - - Gnomovision version 69, Copyright (C) year name of author - Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. - This is free software, and you are welcome to redistribute it - under certain conditions; type `show c' for details. - -The hypothetical commands `show w' and `show c' should show the appropriate -parts of the General Public License. Of course, the commands you use may -be called something other than `show w' and `show c'; they could even be -mouse-clicks or menu items--whatever suits your program. - -You should also get your employer (if you work as a programmer) or your -school, if any, to sign a "copyright disclaimer" for the program, if -necessary. Here is a sample; alter the names: - - Yoyodyne, Inc., hereby disclaims all copyright interest in the program - `Gnomovision' (which makes passes at compilers) written by James Hacker. - - , 1 April 1989 - Ty Coon, President of Vice - -This General Public License does not permit incorporating your program into -proprietary programs. If your program is a subroutine library, you may -consider it more useful to permit linking proprietary applications with the -library. If this is what you want to do, use the GNU Lesser General -Public License instead of this License. diff --git a/nx-X11/programs/nxauth/Imakefile b/nx-X11/programs/nxauth/Imakefile deleted file mode 100644 index 278904f05..000000000 --- a/nx-X11/programs/nxauth/Imakefile +++ /dev/null @@ -1,38 +0,0 @@ -XCOMM $Xorg: Imakefile,v 1.3 2000/08/17 19:54:11 cpqbld Exp $ - - - - -XCOMM $XFree86: xc/programs/xauth/Imakefile,v 3.5 2001/03/30 02:15:23 keithp Exp $ - -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXAUTH, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ -/* LOCAL_LIBRARIES = $(DESTDIR)$(SHLIBDIR)/libXau.a */ - - - INCLUDES=-I../../lib - DEPLIBS = $(DEPXAUTHLIB) - LOCAL_LIBRARIES = $(XAUTHLIB) - SRCS = xauth.c gethost.c process.c parsedpy.c - OBJS = xauth.o gethost.o process.o parsedpy.o - CONN_DEFINES = $(CONNECTION_FLAGS) - -ComplexProgramTarget(nxauth) - -SpecialCObjectRule(gethost,$(ICONFIGFILES),$(CONN_DEFINES) $(SIGNAL_DEFINES)) -SpecialCObjectRule(process,$(ICONFIGFILES),$(SIGNAL_DEFINES)) -SpecialCObjectRule(parsedpy,$(ICONFIGFILES),$(CONN_DEFINES)) diff --git a/nx-X11/programs/nxauth/LICENSE b/nx-X11/programs/nxauth/LICENSE deleted file mode 100644 index 626b9c54f..000000000 --- a/nx-X11/programs/nxauth/LICENSE +++ /dev/null @@ -1,26 +0,0 @@ -Copyright (c) 2001, 2010 NoMachine - http://www.nomachine.com/. - -NXAUTH and NX extensions to X are copyright of NoMachine. - -Redistribution and use of this software is allowed according to the -following terms: - -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License Version 2, and -not any other version, as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, but -WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- -BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General -Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, you can request a copy to NoMachine -or write to the Free Software Foundation, Inc., 59 Temple Place, -Suite 330, Boston, MA 02111-1307 USA - -Parts of this software are derived from XFree86 project. Other copy- -rights and the MIT/X11 license applies to different sources. Please -check the applicable copyrights in each file or subdirectory. - -All rights reserved. diff --git a/nx-X11/programs/nxauth/gethost.c b/nx-X11/programs/nxauth/gethost.c deleted file mode 100644 index fa889f29b..000000000 --- a/nx-X11/programs/nxauth/gethost.c +++ /dev/null @@ -1,287 +0,0 @@ -/* - * $Xorg: gethost.c,v 1.5 2001/02/09 02:05:38 xorgcvs Exp $ - * - * -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * * - * Author: Jim Fulton, MIT X Consortium - */ - -/* $XFree86: xc/programs/xauth/gethost.c,v 3.16 2001/12/14 20:01:14 dawes Exp $ */ - -/* sorry, streams support does not really work yet */ -#if defined(STREAMSCONN) && defined(SVR4) -#undef STREAMSCONN -#define TCPCONN -#endif - -#ifdef WIN32 -#include -#define EPROTOTYPE WSAEPROTOTYPE -#endif -#include -#include -#include -#include -#ifndef __TYPES__ -#include -#define __TYPES__ -#endif -#ifndef WIN32 -#ifndef STREAMSCONN -#ifndef Lynx -#include -#else -#include -#endif -#include -#include -#include -#ifdef SYSV -#ifdef i386 -#ifndef sco -#include -#endif /* !sco */ -#endif /* i386 */ -#endif /* SYSV */ -#endif /* !STREAMSCONN */ -#endif /* !WIN32 */ -#include -#include "xauth.h" - -#ifdef DNETCONN -#include -#include -#endif - -#ifdef SIGALRM -Bool nameserver_timedout = False; - - -/* - * get_hostname - Given an internet address, return a name (CHARON.MIT.EDU) - * or a string representing the address (18.58.0.13) if the name cannot - * be found. Stolen from xhost. - */ - -static jmp_buf env; -static -#ifdef SIGNALRETURNSINT -int -#else -void -#endif -nameserver_lost(int sig) -{ - nameserver_timedout = True; - longjmp (env, -1); - /* NOTREACHED */ -#ifdef SIGNALRETURNSINT - return -1; /* for picky compilers */ -#endif -} -#endif - -char * -get_hostname (auth) - Xauth *auth; -{ - static struct hostent *hp = NULL; -#ifdef DNETCONN - struct nodeent *np; - static char nodeaddr[4 + 2 * DN_MAXADDL]; -#endif /* DNETCONN */ - - if (auth->address_length == 0) - return "Illegal Address"; -#ifdef TCPCONN - if (auth->family == FamilyInternet) { -#ifdef SIGALRM - /* gethostbyaddr can take a LONG time if the host does not exist. - Assume that if it does not respond in NAMESERVER_TIMEOUT seconds - that something is wrong and do not make the user wait. - gethostbyaddr will continue after a signal, so we have to - jump out of it. - */ - nameserver_timedout = False; - signal (SIGALRM, nameserver_lost); - alarm (4); - if (setjmp(env) == 0) { -#endif - hp = gethostbyaddr (auth->address, auth->address_length, AF_INET); -#ifdef SIGALRM - } - alarm (0); -#endif - if (hp) - return (hp->h_name); - else - return (inet_ntoa(*((struct in_addr *)(auth->address)))); - } -#endif -#ifdef DNETCONN - if (auth->family == FamilyDECnet) { - struct dn_naddr *addr_ptr = (struct dn_naddr *) auth->address; - - if (np = getnodebyaddr(addr_ptr->a_addr, addr_ptr->a_len, AF_DECnet)) { - sprintf(nodeaddr, "%s:", np->n_name); - } else { - sprintf(nodeaddr, "%s:", dnet_htoa(auth->address)); - } - return(nodeaddr); - } -#endif - - return (NULL); -} - -#ifdef TCPCONN -/* - * cribbed from lib/X/XConnDis.c - */ -static Bool -get_inet_address(char *name, unsigned int *resultp) -{ - unsigned int hostinetaddr = inet_addr (name); - struct hostent *host_ptr; - struct sockaddr_in inaddr; /* dummy variable for size calcs */ - -#ifndef INADDR_NONE -#define INADDR_NONE -1 -#endif - - if (hostinetaddr == INADDR_NONE) { - if ((host_ptr = gethostbyname (name)) == NULL) { - /* No such host! */ - errno = EINVAL; - return False; - } - /* Check the address type for an internet host. */ - if (host_ptr->h_addrtype != AF_INET) { - /* Not an Internet host! */ - errno = EPROTOTYPE; - return False; - } - - memmove( (char *)&hostinetaddr, (char *)host_ptr->h_addr, - sizeof(inaddr.sin_addr)); - } - *resultp = hostinetaddr; - return True; -} -#endif - -#ifdef DNETCONN -static Bool get_dnet_address (name, resultp) - char *name; - struct dn_naddr *resultp; -{ - struct dn_naddr *dnaddrp, dnaddr; - struct nodeent *np; - - if (dnaddrp = dnet_addr (name)) { /* stolen from xhost */ - dnaddr = *dnaddrp; - } else { - if ((np = getnodebyname (name)) == NULL) return False; - dnaddr.a_len = np->n_length; - memmove( dnaddr.a_addr, np->n_addr, np->n_length); - } - *resultp = dnaddr; - return True; -} -#endif - -char *get_address_info (family, fulldpyname, prefix, host, lenp) - int family; - char *fulldpyname; - int prefix; - char *host; - int *lenp; -{ - char *retval = NULL; - int len = 0; - char *src = NULL; -#ifdef TCPCONN - unsigned int hostinetaddr; -#endif -#ifdef DNETCONN - struct dn_naddr dnaddr; -#endif - char buf[255]; - - /* - * based on the family, set the pointer src to the start of the address - * information to be copied and set len to the number of bytes. - */ - switch (family) { - case FamilyLocal: /* hostname/unix:0 */ - /* handle unix:0 and :0 specially */ - if (prefix == 0 && (strncmp (fulldpyname, "unix:", 5) == 0 || - fulldpyname[0] == ':')) { - - if (!get_local_hostname (buf, sizeof buf)) { - len = 0; - } else { - src = buf; - len = strlen (buf); - } - } else { - src = fulldpyname; - len = prefix; - } - break; - case FamilyInternet: /* host:0 */ -#ifdef TCPCONN - if (!get_inet_address (host, &hostinetaddr)) return NULL; - src = (char *) &hostinetaddr; - len = 4; /* sizeof inaddr.sin_addr, would fail on Cray */ - break; -#else - return NULL; -#endif - case FamilyDECnet: /* host::0 */ -#ifdef DNETCONN - if (!get_dnet_address (host, &dnaddr)) return NULL; - src = (char *) &dnaddr; - len = (sizeof dnaddr); - break; -#else - /* fall through since we don't have code for it */ -#endif - default: - src = NULL; - len = 0; - } - - /* - * if source was provided, allocate space and copy it - */ - if (len == 0 || !src) return NULL; - - retval = malloc (len); - if (retval) { - memmove( retval, src, len); - *lenp = len; - } - return retval; -} diff --git a/nx-X11/programs/nxauth/nxauth.man b/nx-X11/programs/nxauth/nxauth.man deleted file mode 100644 index b9df3737d..000000000 --- a/nx-X11/programs/nxauth/nxauth.man +++ /dev/null @@ -1,236 +0,0 @@ -.\" $Xorg: xauth.man,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ -.\" Copyright 1993, 1998 The Open Group -.\" -.\" Permission to use, copy, modify, distribute, and sell this software and its -.\" 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. -.\" -.\" The above copyright notice and this permission notice shall be included -.\" in all copies or substantial portions of the Software. -.\" -.\" THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -.\" OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -.\" MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -.\" IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -.\" OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -.\" ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -.\" OTHER DEALINGS IN THE SOFTWARE. -.\" -.\" Except as contained in this notice, the name of The Open Group shall -.\" not be used in advertising or otherwise to promote the sale, use or -.\" other dealings in this Software without prior written authorization -.\" from The Open Group. -.\" -.\" $XFree86: xc/programs/xauth/xauth.man,v 1.7 2001/12/14 20:01:15 dawes Exp $ -.\" -.TH XAUTH 1 __xorgversion__ -.SH NAME -nxauth \- NoMachine X authority file utility -.SH SYNOPSIS -.B nxauth -[ \fB\-f\fP \fIauthfile\fP ] [ \fB\-vqib\fP ] [ \fIcommand arg ...\fP ] -.SH DESCRIPTION -.PP -The \fInxauth\fP program is used to edit and display the authorization -information used in connecting to the X server. This program is usually -used to extract authorization records from one machine and merge them in on -another (as is the case when using remote logins or granting access to -other users). Commands (described below) may be entered interactively, -on the \fInxauth\fP command line, or in scripts. Note that this program -does \fBnot\fP contact the X server except when the generate command is used. -Normally \fInxauth\fP is not used to create the authority file entry in -the first place; \fIxdm\fP does that. -.SH OPTIONS -The following options may be used with \fInxauth\fP. They may be given -individually (e.g., \fI\-q \-i\|\fP) or may combined (e.g., \fI\-qi\|\fP). -.TP 8 -.B "\-f \fIauthfile\fP" -This option specifies the name of the authority file to use. By default, -\fInxauth\fP will use the file specified by the nxauthORITY environment variable -or \fI\.Xauthority\fP in the user's home directory. -.TP 8 -.B \-q -This option indicates that \fInxauth\fP should operate quietly and not print -unsolicited status messages. This is the default if an \fInxauth\fP command is -is given on the command line or if the standard output is not directed to a -terminal. -.TP 8 -.B \-v -This option indicates that \fInxauth\fP should operate verbosely and print -status messages indicating the results of various operations (e.g., how many -records have been read in or written out). This is the default if \fInxauth\fP -is reading commands from its standard input and its standard output is -directed to a terminal. -.TP 8 -.B \-i -This option indicates that \fInxauth\fP should ignore any authority file -locks. Normally, \fInxauth\fP will refuse to read or edit any authority files -that have been locked by other programs (usually \fIxdm\fP or another -\fInxauth\fP). -.TP 8 -.B \-b -This option indicates that \fInxauth\fP should attempt to break any authority -file locks before proceeding. Use this option only to clean up stale locks. -.SH COMMANDS -The following commands may be used to manipulate authority files: -.TP 8 -.B "add \fIdisplayname protocolname hexkey" -An authorization entry for the indicated display using the given protocol -and key data is added to the authorization file. The data is specified as -an even-lengthed string of hexadecimal digits, each pair representing -one octet. The first digit of each pair gives the most significant 4 bits -of the octet, and the second digit of the pair gives the least significant 4 -bits. For example, a 32 character hexkey would represent a 128-bit value. -A protocol name consisting of just a -single period is treated as an abbreviation for \fIMIT-MAGIC-COOKIE-1\fP. - -.TP 8 -.B "generate \fIdisplayname protocolname\fP \fR[\fPtrusted|untrusted\fR]\fP" -.B \fR[\fPtimeout \fIseconds\fP\fR]\fP \fR[\fPgroup \fIgroup-id\fP\fR]\fP \fR[\fBdata \fIhexdata\fR] - -This command is similar to add. The main difference is that instead -of requiring the user to supply the key data, it connects to the -server specified in \fIdisplayname\fP and uses the SECURITY extension -in order to get the key data to store in the authorization file. If -the server cannot be contacted or if it does not support the SECURITY -extension, the command fails. Otherwise, an authorization entry for -the indicated display using the given protocol is added to the -authorization file. A protocol name consisting of just a single -period is treated as an abbreviation for \fIMIT-MAGIC-COOKIE-1\fP. - -If the \fBtrusted\fP option is used, clients that connect using this -authorization will have full run of the display, as usual. If -\fBuntrusted\fP is used, clients that connect using this authorization -will be considered untrusted and prevented from stealing or tampering -with data belonging to trusted clients. See the SECURITY extension -specification for full details on the restrictions imposed on -untrusted clients. The default is \fBuntrusted\fP. - -The \fBtimeout\fP option specifies how long in seconds this -authorization will be valid. If the authorization remains unused (no -clients are connected with it) for longer than this time period, the -server purges the authorization, and future attempts to connect using -it will fail. Note that the purging done by the server does \fBnot\fP -delete the authorization entry from the authorization file. The -default timeout is 60 seconds. - -The \fBgroup\fP option specifies the application group that clients -connecting with this authorization should belong to. See the -application group extension specification for more details. The -default is to not belong to an application group. - -The \fBdata\fP option specifies data that the server should use to -generate the authorization. Note that this is \fBnot\fP the same data -that gets written to the authorization file. The interpretation of -this data depends on the authorization protocol. The \fIhexdata\fP is -in the same format as the \fIhexkey\fP described in the add command. -The default is to send no data. - -.TP 8 -.B "[n]extract \fIfilename displayname..." -Authorization entries for each of the specified displays are written to the -indicated file. If the \fInextract\fP command is used, the entries are written -in a numeric format suitable for non-binary transmission (such as secure -electronic mail). The extracted entries can be read back in using the -\fImerge\fP and \fInmerge\fP commands. If the filename consists of -just a single dash, the entries will be written to the standard output. -.TP 8 -.B "[n]list \fR[\fIdisplayname\fP...]" -Authorization entries for each of the specified displays (or all if no -displays are named) are printed on the standard output. If the \fInlist\fP -command is used, entries will be shown in the numeric format used by -the \fInextract\fP command; otherwise, they are shown in a textual format. -Key data is always displayed in the hexadecimal format given in the -description of the \fIadd\fP command. -.TP 8 -.B "[n]merge \fR[\fIfilename\fP...]" -Authorization entries are read from the specified files and are merged into -the authorization database, superceding any matching existing entries. If -the \fInmerge\fP command is used, the numeric format given in the description -of the \fIextract\fP command is used. If a filename consists of just a single -dash, the standard input will be read if it hasn't been read before. -.TP 8 -.B "remove \fIdisplayname\fR..." -Authorization entries matching the specified displays are removed from the -authority file. -.TP 8 -.B "source \fIfilename" -The specified file is treated as a script containing \fInxauth\fP commands -to execute. Blank lines and lines beginning with a sharp sign (#) are -ignored. A single dash may be used to indicate the standard input, if it -hasn't already been read. -.TP 8 -.B "info" -Information describing the authorization file, whether or not any changes -have been made, and from where \fInxauth\fP commands are being read -is printed on the standard output. -.TP 8 -.B "exit" -If any modifications have been made, the authority file is written out (if -allowed), and the program exits. An end of file is treated as an implicit -\fIexit\fP command. -.TP 8 -.B "quit" -The program exits, ignoring any modifications. This may also be accomplished -by pressing the interrupt character. -.TP 8 -.B "help [\fIstring\fP]" -A description of all commands that begin with the given string (or all -commands if no string is given) is printed on the standard output. -.TP 8 -.B "?" -A short list of the valid commands is printed on the standard output. -.SH "DISPLAY NAMES" -Display names for the \fIadd\fP, \fI[n]extract\fP, \fI[n]list\fP, -\fI[n]merge\fP, and \fIremove\fP commands use the same format as the -DISPLAY environment variable and the common \fI\-display\fP command line -argument. Display-specific information (such as the screen number) -is unnecessary and will be ignored. -Same-machine connections (such as local-host sockets, -shared memory, and the Internet Protocol hostname \fIlocalhost\fP) are -referred to as \fIhostname\fP/unix:\fIdisplaynumber\fP so that -local entries for different machines may be stored in one authority file. -.SH EXAMPLE -.PP -The most common use for \fInxauth\fP is to extract the entry for the -current display, copy it to another machine, and merge it into the -user's authority file on the remote machine: -.sp -.nf - % nxauth extract \- $DISPLAY | rsh otherhost nxauth merge \- -.fi -.PP -.sp -The following command contacts the server :0 to create an -authorization using the MIT-MAGIC-COOKIE-1 protocol. Clients that -connect with this authorization will be untrusted. -.nf - % nxauth generate :0 . -.fi -.SH ENVIRONMENT -This \fInxauth\fP program uses the following environment variables: -.TP 8 -.B XAUTHORITY -to get the name of the authority file to use if the \fI\-f\fP option isn't -used. -.TP 8 -.B HOME -to get the user's home directory if XAUTHORITY isn't defined. -.SH FILES -.TP 8 -.I $HOME/.Xauthority -default authority file if XAUTHORITY isn't defined. -.SH BUGS -.PP -Users that have unsecure networks should take care to use encrypted -file transfer mechanisms to copy authorization entries between machines. -Similarly, the \fIMIT-MAGIC-COOKIE-1\fP protocol is not very useful in -unsecure environments. Sites that are interested in additional security -may need to use encrypted authorization mechanisms such as Kerberos. -.PP -Spaces are currently not allowed in the protocol name. Quoting could be -added for the truly perverse. -.SH AUTHOR -Jim Fulton, MIT X Consortium diff --git a/nx-X11/programs/nxauth/parsedpy.c b/nx-X11/programs/nxauth/parsedpy.c deleted file mode 100644 index d0f022574..000000000 --- a/nx-X11/programs/nxauth/parsedpy.c +++ /dev/null @@ -1,259 +0,0 @@ -/* - * $Xorg: parsedpy.c,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ - * - * parse_displayname - utility routine for splitting up display name strings - * - * -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * * - * Author: Jim Fulton, MIT X Consortium - */ - -/* $XFree86: xc/programs/xauth/parsedpy.c,v 3.6 2001/12/14 20:01:15 dawes Exp $ */ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXAUTH, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -#include /* for NULL */ -#include /* for isascii() and isdigit() */ -#include /* for strchr() and string routines */ -#include /* for Family contants */ -#ifdef hpux -#include /* for struct utsname */ -#endif -#include /* for FamilyLocal */ - -#if defined(UNIXCONN) || defined(LOCALCONN) -#define UNIX_CONNECTION "unix" -#define UNIX_CONNECTION_LENGTH 4 -#endif - -#include -#include "xauth.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -/* - * private utility routines - */ - -char * -copystring (char *src, int len) -{ - char *cp; - - if (!src && len != 0) return NULL; - cp = malloc (len + 1); - if (cp) { - if (src) strncpy (cp, src, len); - cp[len] = '\0'; - } - return cp; -} - - -char * -get_local_hostname (char *buf, int maxlen) -{ - buf[0] = '\0'; -/* - (void) XmuGetHostname (buf, maxlen); -*/ - /*FIXME*/ - - (void) gethostname (buf, maxlen); - - buf [maxlen - 1] = '\0'; - - #ifdef TEST - printf("get_local_hostname: Host name is %s", buf); - #endif - - return (buf[0] ? buf : NULL); -} - -#ifndef UNIXCONN -static char * -copyhostname (void) -{ - char buf[256]; - - return (get_local_hostname (buf, sizeof buf) ? - copystring (buf, strlen (buf)) : NULL); -} -#endif - -/* - * parse_displayname - display a display string up into its component parts - */ -Bool -parse_displayname (char *displayname, - int *familyp, /* return */ - char **hostp, /* return */ - int *dpynump, /* return */ - int *scrnump, /* return */ - char **restp) /* return */ -{ - char *ptr; /* work variables */ - int len; /* work variable */ - int family = -1; /* value to be returned */ - char *host = NULL; /* must free if set and error return */ - int dpynum = -1; /* value to be returned */ - int scrnum = 0; /* value to be returned */ - char *rest = NULL; /* must free if set and error return */ - Bool dnet = False; /* if true then using DECnet */ - - /* check the name */ - if (!displayname || !displayname[0]) return False; - - /* must have at least :number */ - ptr = strchr(displayname, ':'); - if (!ptr || !ptr[1]) return False; - if (ptr[1] == ':') { - if (ptr[2] == '\0') return False; - dnet = True; - } - - - /* - * get the host string; if none is given, use the most effiecient path - */ - - len = (ptr - displayname); /* length of host name */ - if (len == 0) { /* choose most efficient path */ -#if defined(UNIXCONN) || defined(LOCALCONN) - host = copystring (UNIX_CONNECTION, UNIX_CONNECTION_LENGTH); - family = FamilyLocal; -#else - if (dnet) { - host = copystring ("0", 1); - family = FamilyDECnet; - } else { - host = copyhostname (); - family = FamilyInternet; - } -#endif - } else { - host = copystring (displayname, len); - if (dnet) { - family = dnet; - } else { -#if defined(UNIXCONN) || defined(LOCALCONN) - if (host && strcmp (host, UNIX_CONNECTION) == 0) - family = FamilyLocal; - else -#endif - family = FamilyInternet; - } - } - - if (!host) return False; - - - /* - * get the display number; we know that there is something after the - * colon (or colons) from above. note that host is now set and must - * be freed if there is an error. - */ - - if (dnet) ptr++; /* skip the extra DECnet colon */ - ptr++; /* move to start of display num */ - { - register char *cp; - - for (cp = ptr; *cp && isascii(*cp) && isdigit(*cp); cp++) ; - len = (cp - ptr); - /* check present and valid follow */ - if (len == 0 || (*cp && *cp != '.')) { - free (host); - return False; - } - - dpynum = atoi (ptr); /* it will handle num. as well */ - ptr = cp; - } - - /* - * now get screen number if given; ptr may point to nul at this point - */ - if (ptr[0] == '.') { - register char *cp; - - ptr++; - for (cp = ptr; *cp && isascii(*cp) && isdigit(*cp); cp++) ; - len = (cp - ptr); - if (len == 0 || (*cp && *cp != '.')) { /* all prop name */ - free (host); - return False; - } - - scrnum = atoi (ptr); /* it will handle num. as well */ - ptr = cp; - } - - /* - * and finally, get any additional stuff that might be following the - * the screen number; ptr must point to a period if there is anything - */ - - if (ptr[0] == '.') { - ptr++; - len = strlen (ptr); - if (len > 0) { - rest = copystring (ptr, len); - if (!rest) { - free (host); - return False; - } - } - } - - /* - * and we are done! - */ - - *familyp = family; - *hostp = host; - *dpynump = dpynum; - *scrnump = scrnum; - *restp = rest; - return True; -} - - diff --git a/nx-X11/programs/nxauth/process.c b/nx-X11/programs/nxauth/process.c deleted file mode 100644 index 86aba2b2a..000000000 --- a/nx-X11/programs/nxauth/process.c +++ /dev/null @@ -1,1872 +0,0 @@ -/* $Xorg: process.c,v 1.6 2001/02/09 02:05:38 xorgcvs Exp $ */ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* $XFree86: xc/programs/xauth/process.c,v 3.18 2003/02/13 02:50:22 dawes Exp $ */ - -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXAUTH, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -/* - * Author: Jim Fulton, MIT X Consortium - */ - -#include "xauth.h" -#include -#include -#include - -#include -/*#include */ /* for Family constants */ -/* -#include -#include -*/ - -/*FIXME*/ -#define FamilyInternet 0 -#define FamilyDECnet 1 - -extern Bool naneserver_timedout; - -#ifndef DEFAULT_PROTOCOL_ABBREV /* to make add command easier */ -#define DEFAULT_PROTOCOL_ABBREV "." -#endif -#ifndef DEFAULT_PROTOCOL /* for protocol abbreviation */ -#define DEFAULT_PROTOCOL "MIT-MAGIC-COOKIE-1" -#endif - -#define SECURERPC "SUN-DES-1" -#define K5AUTH "MIT-KERBEROS-5" - -#define XAUTH_DEFAULT_RETRIES 10 /* number of competitors we expect */ -#define XAUTH_DEFAULT_TIMEOUT 2 /* in seconds, be quick */ -#define XAUTH_DEFAULT_DEADTIME 600L /* 10 minutes in seconds */ - -typedef struct _AuthList { /* linked list of entries */ - struct _AuthList *next; - Xauth *auth; -} AuthList; - -typedef int (*ProcessFunc)(char *, int, int, char**); - -#define add_to_list(h,t,e) {if (t) (t)->next = (e); else (h) = (e); (t) = (e);} - -typedef struct _CommandTable { /* commands that are understood */ - char *name; /* full name */ - int minlen; /* unique prefix */ - int maxlen; /* strlen(name) */ - ProcessFunc processfunc; /* handler */ - char *helptext; /* what to print for help */ -} CommandTable; - -struct _extract_data { /* for iterating */ - FILE *fp; /* input source */ - char *filename; /* name of input */ - Bool used_stdout; /* whether or not need to close */ - Bool numeric; /* format in which to write */ - int nwritten; /* number of entries written */ - char *cmd; /* for error messages */ -}; - -struct _list_data { /* for iterating */ - FILE *fp; /* output file */ - Bool numeric; /* format in which to write */ -}; - - -/* - * private data - */ -static char *stdin_filename = "(stdin)"; /* for messages */ -static char *stdout_filename = "(stdout)"; /* for messages */ -static char *Yes = "yes"; /* for messages */ -static char *No = "no"; /* for messages */ - -static int do_help ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_questionmark ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_list ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_merge ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_extract ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_add ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_remove ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_info ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_exit ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_quit ( char *inputfilename, int lineno, int argc, char **argv ); -static int do_source ( char *inputfilename, int lineno, int argc, char **argv ); -/* -static int do_generate ( char *inputfilename, int lineno, int argc, char **argv ); -*/ -static CommandTable command_table[] = { /* table of known commands */ - { "add", 2, 3, do_add, - "add dpyname protoname hexkey add entry" }, - { "exit", 3, 4, do_exit, - "exit save changes and exit program" }, - { "extract", 3, 7, do_extract, - "extract filename dpyname... extract entries into file" }, - { "help", 1, 4, do_help, - "help [topic] print help" }, - { "info", 1, 4, do_info, - "info print information about entries" }, - { "list", 1, 4, do_list, - "list [dpyname...] list entries" }, - { "merge", 1, 5, do_merge, - "merge filename... merge entries from files" }, - { "nextract", 2, 8, do_extract, - "nextract filename dpyname... numerically extract entries" }, - { "nlist", 2, 5, do_list, - "nlist [dpyname...] numerically list entries" }, - { "nmerge", 2, 6, do_merge, - "nmerge filename... numerically merge entries" }, - { "quit", 1, 4, do_quit, - "quit abort changes and exit program" }, - { "remove", 1, 6, do_remove, - "remove dpyname... remove entries" }, - { "source", 1, 6, do_source, - "source filename read commands from file" }, - { "?", 1, 1, do_questionmark, - "? list available commands" }, -/* { "generate", 1, 8, do_generate, - "generate dpyname protoname [options] use server to generate entry\n" - " options are:\n" - " timeout n authorization expiration time in seconds\n" - " trusted clients using this entry are trusted\n" - " untrusted clients using this entry are untrusted\n" - " group n clients using this entry belong to application group n\n" - " data hexkey auth protocol specific data needed to generate the entry\n" - }, */ - { NULL, 0, 0, NULL, NULL }, -}; - -#define COMMAND_NAMES_PADDED_WIDTH 10 /* wider than anything above */ - - -static Bool okay_to_use_stdin = True; /* set to false after using */ - -static char *hex_table[] = { /* for printing hex digits */ - "00", "01", "02", "03", "04", "05", "06", "07", - "08", "09", "0a", "0b", "0c", "0d", "0e", "0f", - "10", "11", "12", "13", "14", "15", "16", "17", - "18", "19", "1a", "1b", "1c", "1d", "1e", "1f", - "20", "21", "22", "23", "24", "25", "26", "27", - "28", "29", "2a", "2b", "2c", "2d", "2e", "2f", - "30", "31", "32", "33", "34", "35", "36", "37", - "38", "39", "3a", "3b", "3c", "3d", "3e", "3f", - "40", "41", "42", "43", "44", "45", "46", "47", - "48", "49", "4a", "4b", "4c", "4d", "4e", "4f", - "50", "51", "52", "53", "54", "55", "56", "57", - "58", "59", "5a", "5b", "5c", "5d", "5e", "5f", - "60", "61", "62", "63", "64", "65", "66", "67", - "68", "69", "6a", "6b", "6c", "6d", "6e", "6f", - "70", "71", "72", "73", "74", "75", "76", "77", - "78", "79", "7a", "7b", "7c", "7d", "7e", "7f", - "80", "81", "82", "83", "84", "85", "86", "87", - "88", "89", "8a", "8b", "8c", "8d", "8e", "8f", - "90", "91", "92", "93", "94", "95", "96", "97", - "98", "99", "9a", "9b", "9c", "9d", "9e", "9f", - "a0", "a1", "a2", "a3", "a4", "a5", "a6", "a7", - "a8", "a9", "aa", "ab", "ac", "ad", "ae", "af", - "b0", "b1", "b2", "b3", "b4", "b5", "b6", "b7", - "b8", "b9", "ba", "bb", "bc", "bd", "be", "bf", - "c0", "c1", "c2", "c3", "c4", "c5", "c6", "c7", - "c8", "c9", "ca", "cb", "cc", "cd", "ce", "cf", - "d0", "d1", "d2", "d3", "d4", "d5", "d6", "d7", - "d8", "d9", "da", "db", "dc", "dd", "de", "df", - "e0", "e1", "e2", "e3", "e4", "e5", "e6", "e7", - "e8", "e9", "ea", "eb", "ec", "ed", "ee", "ef", - "f0", "f1", "f2", "f3", "f4", "f5", "f6", "f7", - "f8", "f9", "fa", "fb", "fc", "fd", "fe", "ff", -}; - -static unsigned int hexvalues[256]; /* for parsing hex input */ - -static int original_umask = 0; /* for restoring */ - - -/* - * private utility procedures - */ - -static void -prefix(char *fn, int n) -{ - fprintf (stderr, "%s: %s:%d: ", ProgramName, fn, n); -} - -static void -baddisplayname(char *dpy, char *cmd) -{ - fprintf (stderr, "bad display name \"%s\" in \"%s\" command\n", - dpy, cmd); -} - -static void -badcommandline(char *cmd) -{ - fprintf (stderr, "bad \"%s\" command line\n", cmd); -} - -static char * -skip_space(register char *s) -{ - if (!s) return NULL; - - for ( ; *s && isascii(*s) && isspace(*s); s++) - ; - return s; -} - - -static char * -skip_nonspace(register char *s) -{ - if (!s) return NULL; - - /* put quoting into loop if need be */ - for ( ; *s && isascii(*s) && !isspace(*s); s++) - ; - return s; -} - -static char ** -split_into_words(char *src, int *argcp) /* argvify string */ -{ - char *jword; - char savec; - char **argv; - int cur, total; - - *argcp = 0; -#define WORDSTOALLOC 4 /* most lines are short */ - argv = (char **) malloc (WORDSTOALLOC * sizeof (char *)); - if (!argv) return NULL; - cur = 0; - total = WORDSTOALLOC; - - /* - * split the line up into separate, nul-terminated tokens; the last - * "token" will point to the empty string so that it can be bashed into - * a null pointer. - */ - - do { - jword = skip_space (src); - src = skip_nonspace (jword); - savec = *src; - *src = '\0'; - if (cur == total) { - total += WORDSTOALLOC; - argv = (char **) realloc (argv, total * sizeof (char *)); - if (!argv) return NULL; - } - argv[cur++] = jword; - if (savec) src++; /* if not last on line advance */ - } while (jword != src); - - argv[--cur] = NULL; /* smash empty token to end list */ - *argcp = cur; - return argv; -} - - -static FILE * -open_file(char **filenamep, - char *mode, - Bool *usedstdp, - char *srcfn, - int srcln, - char *cmd) -{ - FILE *fp; - - if (strcmp (*filenamep, "-") == 0) { - *usedstdp = True; - /* select std descriptor to use */ - if (mode[0] == 'r') { - if (okay_to_use_stdin) { - okay_to_use_stdin = False; - *filenamep = stdin_filename; - return stdin; - } else { - prefix (srcfn, srcln); - fprintf (stderr, "%s: stdin already in use\n", cmd); - return NULL; - } - } else { - *filenamep = stdout_filename; - return stdout; /* always okay to use stdout */ - } - } - - fp = fopen (*filenamep, mode); - if (!fp) { - prefix (srcfn, srcln); - fprintf (stderr, "%s: unable to open file %s\n", cmd, *filenamep); - } - return fp; -} - -static int -getinput(FILE *fp) -{ - register int c; - - while ((c = getc (fp)) != EOF && isascii(c) && c != '\n' && isspace(c)) ; - return c; -} - -static int -get_short(FILE *fp, unsigned short *sp) /* for reading numeric input */ -{ - int c; - int i; - unsigned short us = 0; - - /* - * read family: written with %04x - */ - for (i = 0; i < 4; i++) { - switch (c = getinput (fp)) { - case EOF: - case '\n': - return 0; - } - if (c < 0 || c > 255) return 0; - us = (us * 16) + hexvalues[c]; /* since msb */ - } - *sp = us; - return 1; -} - -static int -get_bytes(FILE *fp, unsigned int n, char **ptr) /* for reading numeric input */ -{ - char *s; - register char *cp; - int c1, c2; - - cp = s = malloc (n); - if (!cp) return 0; - - while (n > 0) { - if ((c1 = getinput (fp)) == EOF || c1 == '\n' || - (c2 = getinput (fp)) == EOF || c2 == '\n') { - free (s); - return 0; - } - *cp = (char) ((hexvalues[c1] * 16) + hexvalues[c2]); - cp++; - n--; - } - - *ptr = s; - return 1; -} - - -static Xauth * -read_numeric(FILE *fp) -{ - Xauth *auth; - - auth = (Xauth *) malloc (sizeof (Xauth)); - if (!auth) goto bad; - auth->family = 0; - auth->address = NULL; - auth->address_length = 0; - auth->number = NULL; - auth->number_length = 0; - auth->name = NULL; - auth->name_length = 0; - auth->data = NULL; - auth->data_length = 0; - - if (!get_short (fp, (unsigned short *) &auth->family)) - goto bad; - if (!get_short (fp, (unsigned short *) &auth->address_length)) - goto bad; - if (!get_bytes (fp, (unsigned int) auth->address_length, &auth->address)) - goto bad; - if (!get_short (fp, (unsigned short *) &auth->number_length)) - goto bad; - if (!get_bytes (fp, (unsigned int) auth->number_length, &auth->number)) - goto bad; - if (!get_short (fp, (unsigned short *) &auth->name_length)) - goto bad; - if (!get_bytes (fp, (unsigned int) auth->name_length, &auth->name)) - goto bad; - if (!get_short (fp, (unsigned short *) &auth->data_length)) - goto bad; - if (!get_bytes (fp, (unsigned int) auth->data_length, &auth->data)) - goto bad; - - switch (getinput (fp)) { /* get end of line */ - case EOF: - case '\n': - return auth; - } - - bad: - if (auth) XauDisposeAuth (auth); /* won't free null pointers */ - return NULL; -} - -typedef Xauth *(*ReadFunc)(FILE *); - -static int -read_auth_entries(FILE *fp, Bool numeric, AuthList **headp, AuthList **tailp) -{ - ReadFunc readfunc = (numeric ? read_numeric : XauReadAuth); - Xauth *auth; - AuthList *head, *tail; - int n; - - head = tail = NULL; - n = 0; - /* put all records into linked list */ - while ((auth = ((*readfunc) (fp))) != NULL) { - AuthList *l = (AuthList *) malloc (sizeof (AuthList)); - if (!l) { - fprintf (stderr, - "%s: unable to alloc entry reading auth file\n", - ProgramName); - exit (1); - } - l->next = NULL; - l->auth = auth; - if (tail) /* if not first time through append */ - tail->next = l; - else - head = l; /* first time through, so assign */ - tail = l; - n++; - } - *headp = head; - *tailp = tail; - return n; -} - -static Bool -get_displayname_auth(char *displayname, Xauth *auth) -{ - int family; - char *host = NULL, *rest = NULL; - int dpynum, scrnum; - char *cp; - int len; - Xauth proto; - int prelen = 0; - - /* - * check to see if the display name is of the form "host/unix:" - * which is how the list routine prints out local connections - */ - cp = strchr(displayname, '/'); - if (cp && strncmp (cp, "/unix:", 6) == 0) - prelen = (cp - displayname); - - #ifdef __APPLE__ - - /* - * FIXME: This is an attempt to get the right - * cookie, because no one can grant that the - * X server is running on the display number - * reported in the launchd display name. - */ - - if (strncmp (displayname, "/tmp/launch", 11) == 0) - displayname = strrchr(displayname, ':'); - - #endif - - if (!parse_displayname (displayname + ((prelen > 0) ? prelen + 1 : 0), - &family, &host, &dpynum, &scrnum, &rest)) { - return False; - } - - proto.family = family; - proto.address = get_address_info (family, displayname, prelen, host, &len); - if (proto.address) { - char buf[40]; /* want to hold largest display num */ - - proto.address_length = len; - buf[0] = '\0'; - sprintf (buf, "%d", dpynum); - proto.number_length = strlen (buf); - if (proto.number_length <= 0) { - free (proto.address); - proto.address = NULL; - } else { - proto.number = copystring (buf, proto.number_length); - } - } - - if (host) free (host); - if (rest) free (rest); - - if (proto.address) { - auth->family = proto.family; - auth->address = proto.address; - auth->address_length = proto.address_length; - auth->number = proto.number; - auth->number_length = proto.number_length; - auth->name = NULL; - auth->name_length = 0; - auth->data = NULL; - auth->data_length = 0; - return True; - } else { - return False; - } -} - -static int -cvthexkey(char *hexstr, char **ptrp) /* turn hex key string into octets */ -{ - int i; - int len = 0; - char *retval, *s; - unsigned char *us; - char c; - char savec = '\0'; - - /* count */ - for (s = hexstr; *s; s++) { - if (!isascii(*s)) return -1; - if (isspace(*s)) continue; - if (!isxdigit(*s)) return -1; - len++; - } - - /* if odd then there was an error */ - if ((len & 1) == 1) return -1; - - - /* now we know that the input is good */ - len >>= 1; - retval = malloc (len); - if (!retval) { - fprintf (stderr, "%s: unable to allocate %d bytes for hexkey\n", - ProgramName, len); - return -1; - } - - for (us = (unsigned char *) retval, i = len; i > 0; hexstr++) { - c = *hexstr; - if (isspace(c)) continue; /* already know it is ascii */ - if (isupper(c)) - c = tolower(c); - if (savec) { -#define atoh(c) ((c) - (((c) >= '0' && (c) <= '9') ? '0' : ('a'-10))) - *us = (unsigned char)((atoh(savec) << 4) + atoh(c)); -#undef atoh - savec = 0; /* ready for next character */ - us++; - i--; - } else { - savec = c; - } - } - *ptrp = retval; - return len; -} - -static int -dispatch_command(char *inputfilename, - int lineno, - int argc, - char **argv, - CommandTable *tab, - int *statusp) -{ - CommandTable *ct; - char *cmd; - int n; - /* scan table for command */ - cmd = argv[0]; - n = strlen (cmd); - for (ct = tab; ct->name; ct++) { - /* look for unique prefix */ - if (n >= ct->minlen && n <= ct->maxlen && - strncmp (cmd, ct->name, n) == 0) { - *statusp = (*(ct->processfunc))(inputfilename, lineno, argc, argv); - return 1; - } - } - - *statusp = 1; - return 0; -} - - -static AuthList *xauth_head = NULL; /* list of auth entries */ -static Bool xauth_existed = False; /* if was present at initialize */ -static Bool xauth_modified = False; /* if added, removed, or merged */ -static Bool xauth_allowed = True; /* if allowed to write auth file */ -static Bool xauth_locked = False; /* if has been locked */ -static char *xauth_filename = NULL; -static Bool dieing = False; - -#ifdef SIGNALRETURNSINT -#define _signal_t int -#else -#define _signal_t void -#endif - -/* poor man's puts(), for under signal handlers */ -#define WRITES(fd, S) (void)write((fd), (S), strlen((S))) - -/* ARGSUSED */ -static _signal_t -die(int sig) -{ - dieing = True; - _exit (auth_finalize ()); - /* NOTREACHED */ -#ifdef SIGNALRETURNSINT - return -1; /* for picky compilers */ -#endif -} - -static _signal_t -catchsig(int sig) -{ -#ifdef SYSV - if (sig > 0) signal (sig, die); /* re-establish signal handler */ -#endif - /* - * fileno() might not be reentrant, avoid it if possible, and use - * stderr instead of stdout - */ -#ifdef STDERR_FILENO - if (verbose && xauth_modified) WRITES(STDERR_FILENO, "\r\n"); -#else - if (verbose && xauth_modified) WRITES(fileno(stderr), "\r\n"); -#endif - die (sig); - /* NOTREACHED */ -#ifdef SIGNALRETURNSINT - return -1; /* for picky compilers */ -#endif -} - -static void -register_signals(void) -{ - signal (SIGINT, catchsig); - signal (SIGTERM, catchsig); -#ifdef SIGHUP - signal (SIGHUP, catchsig); -#endif - return; -} - - -/* - * public procedures for parsing lines of input - */ - -int -auth_initialize(char *authfilename) -{ - int n; - AuthList *head, *tail; - FILE *authfp; - Bool exists; - - xauth_filename = authfilename; /* used in cleanup, prevent race with - signals */ - register_signals (); - - bzero ((char *) hexvalues, sizeof hexvalues); - hexvalues['0'] = 0; - hexvalues['1'] = 1; - hexvalues['2'] = 2; - hexvalues['3'] = 3; - hexvalues['4'] = 4; - hexvalues['5'] = 5; - hexvalues['6'] = 6; - hexvalues['7'] = 7; - hexvalues['8'] = 8; - hexvalues['9'] = 9; - hexvalues['a'] = hexvalues['A'] = 0xa; - hexvalues['b'] = hexvalues['B'] = 0xb; - hexvalues['c'] = hexvalues['C'] = 0xc; - hexvalues['d'] = hexvalues['D'] = 0xd; - hexvalues['e'] = hexvalues['E'] = 0xe; - hexvalues['f'] = hexvalues['F'] = 0xf; - - if (break_locks && verbose) { - printf ("Attempting to break locks on authority file %s\n", - authfilename); - } - - if (ignore_locks) { - if (break_locks) XauUnlockAuth (authfilename); - } else { - n = XauLockAuth (authfilename, XAUTH_DEFAULT_RETRIES, - XAUTH_DEFAULT_TIMEOUT, - (break_locks ? 0L : XAUTH_DEFAULT_DEADTIME)); - if (n != LOCK_SUCCESS) { - char *reason = "unknown error"; - switch (n) { - case LOCK_ERROR: - reason = "error"; - break; - case LOCK_TIMEOUT: - reason = "timeout"; - break; - } - fprintf (stderr, "%s: %s in locking authority file %s\n", - ProgramName, reason, authfilename); - return -1; - } else - xauth_locked = True; - } - - /* these checks can only be done reliably after the file is locked */ - exists = (access (authfilename, F_OK) == 0); - if (exists && access (authfilename, W_OK) != 0) { - fprintf (stderr, - "%s: %s not writable, changes will be ignored\n", - ProgramName, authfilename); - xauth_allowed = False; - } - - original_umask = umask (0077); /* disallow non-owner access */ - - authfp = fopen (authfilename, "rb"); - if (!authfp) { - int olderrno = errno; - - /* if file there then error */ - if (access (authfilename, F_OK) == 0) { /* then file does exist! */ - errno = olderrno; - return -1; - } /* else ignore it */ - fprintf (stderr, - "%s: creating new authority file %s\n", - ProgramName, authfilename); - } else { - xauth_existed = True; - n = read_auth_entries (authfp, False, &head, &tail); - (void) fclose (authfp); - if (n < 0) { - fprintf (stderr, - "%s: unable to read auth entries from file \"%s\"\n", - ProgramName, authfilename); - return -1; - } - xauth_head = head; - } - - n = strlen (authfilename); - xauth_filename = malloc (n + 1); - if (xauth_filename) strcpy (xauth_filename, authfilename); - else { - fprintf(stderr,"cannot allocate memory\n"); - return -1; - } - - xauth_modified = False; - - if (verbose) { - printf ("%s authority file %s\n", - ignore_locks ? "Ignoring locks on" : "Using", authfilename); - } - return 0; -} - -static int -write_auth_file(char *tmp_nam) -{ - FILE *fp = NULL; - int fd; - AuthList *list; - - /* - * xdm and auth spec assumes auth file is 12 or fewer characters - */ - strcpy (tmp_nam, xauth_filename); - strcat (tmp_nam, "-n"); /* for new */ - (void) unlink (tmp_nam); - /* CPhipps 2000/02/12 - fix file unlink/fopen race */ - fd = open(tmp_nam, O_WRONLY | O_CREAT | O_EXCL, 0600); - if (fd != -1) fp = fdopen (fd, "wb"); - if (!fp) { - if (fd != -1) close(fd); - fprintf (stderr, "%s: unable to open tmp file \"%s\"\n", - ProgramName, tmp_nam); - return -1; - } - - /* - * Write MIT-MAGIC-COOKIE-1 first, because R4 Xlib knows - * only that and uses the first authorization it finds. - */ - for (list = xauth_head; list; list = list->next) { - if (list->auth->name_length == 18 - && strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) == 0) { - if (!XauWriteAuth(fp, list->auth)) { - (void) fclose(fp); - return -1; - } - } - } - for (list = xauth_head; list; list = list->next) { - if (list->auth->name_length != 18 - || strncmp(list->auth->name, "MIT-MAGIC-COOKIE-1", 18) != 0) { - if (!XauWriteAuth(fp, list->auth)) { - (void) fclose(fp); - return -1; - } - } - } - - (void) fclose (fp); - return 0; -} - -int -auth_finalize(void) -{ - char temp_name[1024]; /* large filename size */ - - if (xauth_modified) { - if (dieing) { - if (verbose) { - /* - * called from a signal handler -- printf is *not* reentrant; also - * fileno() might not be reentrant, avoid it if possible, and use - * stderr instead of stdout - */ -#ifdef STDERR_FILENO - WRITES(STDERR_FILENO, "\nAborting changes to authority file "); - WRITES(STDERR_FILENO, xauth_filename); - WRITES(STDERR_FILENO, "\n"); -#else - WRITES(fileno(stderr), "\nAborting changes to authority file "); - WRITES(fileno(stderr), xauth_filename); - WRITES(fileno(stderr), "\n"); -#endif - } - } else if (!xauth_allowed) { - fprintf (stderr, - "%s: %s not writable, changes ignored\n", - ProgramName, xauth_filename); - } else { - if (verbose) { - printf ("%s authority file %s\n", - ignore_locks ? "Ignoring locks and writing" : - "Writing", xauth_filename); - } - temp_name[0] = '\0'; - if (write_auth_file (temp_name) == -1) { - fprintf (stderr, - "%s: unable to write authority file %s\n", - ProgramName, temp_name); - } else { - (void) unlink (xauth_filename); -#if defined(WIN32) || defined(__UNIXOS2__)|| defined(__CYGWIN__) - if (rename(temp_name, xauth_filename) == -1) -#else - if (link (temp_name, xauth_filename) == -1) -#endif - { - fprintf (stderr, - "%s: unable to link authority file %s, use %s\n", - ProgramName, xauth_filename, temp_name); - } else { - (void) unlink (temp_name); - } - } - } - } - - if (xauth_locked) { - XauUnlockAuth (xauth_filename); - } - (void) umask (original_umask); - return 0; -} - -int -process_command(char *inputfilename, int lineno, int argc, char **argv) -{ - int status; - - if (argc < 1 || !argv || !argv[0]) return 1; - - if (dispatch_command (inputfilename, lineno, argc, argv, - command_table, &status)) - return status; - - prefix (inputfilename, lineno); - fprintf (stderr, "unknown command \"%s\"\n", argv[0]); - return 1; -} - - -/* - * utility routines - */ - -static char * -bintohex(unsigned int len, char *bindata) -{ - char *hexdata, *starthex; - - /* two chars per byte, plus null termination */ - starthex = hexdata = (char *)malloc(2*len + 1); - if (!hexdata) - return NULL; - - for (; len > 0; len--, bindata++) { - register char *s = hex_table[(unsigned char)*bindata]; - *hexdata++ = s[0]; - *hexdata++ = s[1]; - } - *hexdata = '\0'; - return starthex; -} - -static void -fprintfhex(register FILE *fp, int len, char *cp) -{ - char *hex; - - hex = bintohex(len, cp); - fprintf(fp, "%s", hex); - free(hex); -} - -int -dump_numeric(register FILE *fp, register Xauth *auth) -{ - fprintf (fp, "%04x", auth->family); /* unsigned short */ - fprintf (fp, " %04x ", auth->address_length); /* short */ - fprintfhex (fp, auth->address_length, auth->address); - fprintf (fp, " %04x ", auth->number_length); /* short */ - fprintfhex (fp, auth->number_length, auth->number); - fprintf (fp, " %04x ", auth->name_length); /* short */ - fprintfhex (fp, auth->name_length, auth->name); - fprintf (fp, " %04x ", auth->data_length); /* short */ - fprintfhex (fp, auth->data_length, auth->data); - putc ('\n', fp); - return 1; -} - -/* ARGSUSED */ -static int -dump_entry(char *inputfilename, int lineno, Xauth *auth, char *data) -{ - struct _list_data *ld = (struct _list_data *) data; - FILE *fp = ld->fp; - - if (ld->numeric) { - dump_numeric (fp, auth); - } else { - char *dpyname = NULL; - - switch (auth->family) { - case FamilyLocal: - fwrite (auth->address, sizeof (char), auth->address_length, fp); - fprintf (fp, "/unix"); - break; - case FamilyInternet: - case FamilyDECnet: - dpyname = get_hostname (auth); - if (dpyname) { - fprintf (fp, "%s", dpyname); - break; - } - /* else fall through to default */ - default: - fprintf (fp, "#%04x#", auth->family); - fprintfhex (fp, auth->address_length, auth->address); - putc ('#', fp); - } - putc (':', fp); - fwrite (auth->number, sizeof (char), auth->number_length, fp); - putc (' ', fp); - putc (' ', fp); - fwrite (auth->name, sizeof (char), auth->name_length, fp); - putc (' ', fp); - putc (' ', fp); - if (!strncmp(auth->name, SECURERPC, auth->name_length) || - !strncmp(auth->name, K5AUTH, auth->name_length)) - fwrite (auth->data, sizeof (char), auth->data_length, fp); - else - fprintfhex (fp, auth->data_length, auth->data); - putc ('\n', fp); - } - return 0; -} - -static int -extract_entry(char *inputfilename, int lineno, Xauth *auth, char *data) -{ - struct _extract_data *ed = (struct _extract_data *) data; - - if (!ed->fp) { - ed->fp = open_file (&ed->filename, - ed->numeric ? "w" : "wb", - &ed->used_stdout, - inputfilename, lineno, ed->cmd); - if (!ed->fp) { - prefix (inputfilename, lineno); - fprintf (stderr, - "unable to open extraction file \"%s\"\n", - ed->filename); - return -1; - } - } - (*(ed->numeric ? dump_numeric : XauWriteAuth)) (ed->fp, auth); - ed->nwritten++; - - return 0; -} - - -static int -match_auth_dpy(register Xauth *a, register Xauth *b) -{ - return ((a->family == b->family && - a->address_length == b->address_length && - a->number_length == b->number_length && - memcmp(a->address, b->address, a->address_length) == 0 && - memcmp(a->number, b->number, a->number_length) == 0) ? 1 : 0); -} - -/* return non-zero iff display and authorization type are the same */ - -static int -match_auth(register Xauth *a, register Xauth *b) -{ - return ((match_auth_dpy(a, b) - && a->name_length == b->name_length - && memcmp(a->name, b->name, a->name_length) == 0) ? 1 : 0); -} - - -static int -merge_entries(AuthList **firstp, AuthList *second, int *nnewp, int *nreplp) -{ - AuthList *a, *b, *first, *tail; - int n = 0, nnew = 0, nrepl = 0; - - if (!second) return 0; - - if (!*firstp) { /* if nothing to merge into */ - *firstp = second; - for (tail = *firstp, n = 1; tail->next; n++, tail = tail->next) ; - *nnewp = n; - *nreplp = 0; - return n; - } - - first = *firstp; - /* - * find end of first list and stick second list on it - */ - for (tail = first; tail->next; tail = tail->next) ; - tail->next = second; - - /* - * run down list freeing duplicate entries; if an entry is okay, then - * bump the tail up to include it, otherwise, cut the entry out of - * the chain. - */ - for (b = second; b; ) { - AuthList *next = b->next; /* in case we free it */ - - a = first; - for (;;) { - if (match_auth (a->auth, b->auth)) { /* found a duplicate */ - AuthList tmp; /* swap it in for old one */ - tmp = *a; - *a = *b; - *b = tmp; - a->next = b->next; - XauDisposeAuth (b->auth); - free ((char *) b); - b = NULL; - tail->next = next; - nrepl++; - nnew--; - break; - } - if (a == tail) break; /* if have looked at left side */ - a = a->next; - } - if (b) { /* if we didn't remove it */ - tail = b; /* bump end of first list */ - } - b = next; - n++; - nnew++; - } - - *nnewp = nnew; - *nreplp = nrepl; - return n; - -} - -typedef int (*YesNoFunc)(char *, int, Xauth *, char *); - -static int -iterdpy (char *inputfilename, int lineno, int start, - int argc, char *argv[], - YesNoFunc yfunc, YesNoFunc nfunc, char *data) -{ - int i; - int status; - int errors = 0; - Xauth proto; - AuthList *l, *next; - - /* - * iterate - */ - for (i = start; i < argc; i++) { - char *displayname = argv[i]; - proto.address = proto.number = NULL; - if (!get_displayname_auth (displayname, &proto)) { - prefix (inputfilename, lineno); - baddisplayname (displayname, argv[0]); - errors++; - continue; - } - status = 0; - for (l = xauth_head; l; l = next) { - next = l->next; - if (match_auth_dpy (&proto, l->auth)) { - if (yfunc) { - status = (*yfunc) (inputfilename, lineno, - l->auth, data); - if (status < 0) break; - } - } else { - if (nfunc) { - status = (*nfunc) (inputfilename, lineno, - l->auth, data); - if (status < 0) break; - } - } - } - if (proto.address) free (proto.address); - if (proto.number) free (proto.number); - if (status < 0) { - errors -= status; /* since status is negative */ - break; - } - } - - return errors; -} - -/* ARGSUSED */ -static int -remove_entry(char *inputfilename, int lineno, Xauth *auth, char *data) -{ - int *nremovedp = (int *) data; - AuthList **listp = &xauth_head; - AuthList *list; - - /* - * unlink the auth we were asked to - */ - while ((list = *listp)->auth != auth) - listp = &list->next; - *listp = list->next; - XauDisposeAuth (list->auth); /* free the auth */ - free (list); /* free the link */ - xauth_modified = True; - (*nremovedp)++; - return 1; -} - -/* - * action routines - */ - -/* - * help - */ -int -print_help(FILE *fp, char *cmd, char *prefix) -{ - CommandTable *ct; - int n = 0; - - if (!prefix) prefix = ""; - - if (!cmd) { /* if no cmd, print all help */ - for (ct = command_table; ct->name; ct++) { - fprintf (fp, "%s%s\n", prefix, ct->helptext); - n++; - } - } else { - int len = strlen (cmd); - for (ct = command_table; ct->name; ct++) { - if (strncmp (cmd, ct->name, len) == 0) { - fprintf (fp, "%s%s\n", prefix, ct->helptext); - n++; - } - } - } - - return n; -} - -static int -do_help(char *inputfilename, int lineno, int argc, char **argv) -{ - char *cmd = (argc > 1 ? argv[1] : NULL); - int n; - - n = print_help (stdout, cmd, " "); /* a nice amount */ - - if (n < 0 || (n == 0 && !cmd)) { - prefix (inputfilename, lineno); - fprintf (stderr, "internal error with help"); - if (cmd) { - fprintf (stderr, " on command \"%s\"", cmd); - } - fprintf (stderr, "\n"); - return 1; - } - - if (n == 0) { - prefix (inputfilename, lineno); - /* already know that cmd is set in this case */ - fprintf (stderr, "no help for noexistent command \"%s\"\n", cmd); - } - - return 0; -} - -/* - * questionmark - */ -/* ARGSUSED */ -static int -do_questionmark(char *inputfilename, int lineno, int argc, char **argv) -{ - CommandTable *ct; - int i; -#define WIDEST_COLUMN 72 - int col = WIDEST_COLUMN; - - printf ("Commands:\n"); - for (ct = command_table; ct->name; ct++) { - if ((col + ct->maxlen) > WIDEST_COLUMN) { - if (ct != command_table) { - putc ('\n', stdout); - } - fputs (" ", stdout); - col = 8; /* length of string above */ - } - fputs (ct->name, stdout); - col += ct->maxlen; - for (i = ct->maxlen; i < COMMAND_NAMES_PADDED_WIDTH; i++) { - putc (' ', stdout); - col++; - } - } - if (col != 0) { - putc ('\n', stdout); - } - - /* allow bad lines since this is help */ - return 0; -} - -/* - * list [displayname ...] - */ -static int -do_list (char *inputfilename, int lineno, int argc, char **argv) -{ - struct _list_data ld; - - ld.fp = stdout; - ld.numeric = (argv[0][0] == 'n'); - - if (argc == 1) { - register AuthList *l; - - if (xauth_head) { - for (l = xauth_head; l; l = l->next) { - dump_entry (inputfilename, lineno, l->auth, (char *) &ld); - } - } - return 0; - } - - return iterdpy (inputfilename, lineno, 1, argc, argv, - dump_entry, NULL, (char *) &ld); - - return 0; -} - -/* - * merge filename [filename ...] - */ -static int -do_merge(char *inputfilename, int lineno, int argc, char **argv) -{ - int i; - int errors = 0; - AuthList *head, *tail, *listhead, *listtail; - int nentries, nnew, nrepl; - Bool numeric = False; - - if (argc < 2) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - if (argv[0][0] == 'n') numeric = True; - listhead = listtail = NULL; - - for (i = 1; i < argc; i++) { - char *filename = argv[i]; - FILE *fp; - Bool used_stdin = False; - - fp = open_file (&filename, - numeric ? "r" : "rb", - &used_stdin, inputfilename, lineno, - argv[0]); - if (!fp) { - errors++; - continue; - } - - head = tail = NULL; - nentries = read_auth_entries (fp, numeric, &head, &tail); - if (nentries == 0) { - prefix (inputfilename, lineno); - fprintf (stderr, "unable to read any entries from file \"%s\"\n", - filename); - errors++; - } else { /* link it in */ - add_to_list (listhead, listtail, head); - } - - if (!used_stdin) (void) fclose (fp); - } - - /* - * if we have new entries, merge them in (freeing any duplicates) - */ - if (listhead) { - nentries = merge_entries (&xauth_head, listhead, &nnew, &nrepl); - if (verbose) - printf ("%d entries read in: %d new, %d replacement%s\n", - nentries, nnew, nrepl, nrepl != 1 ? "s" : ""); - if (nentries > 0) xauth_modified = True; - } - - return 0; -} - -/* - * extract filename displayname [displayname ...] - */ -static int -do_extract(char *inputfilename, int lineno, int argc, char **argv) -{ - int errors; - struct _extract_data ed; - - if (argc < 3) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - ed.fp = NULL; - ed.filename = argv[1]; - ed.numeric = (argv[0][0] == 'n'); - ed.nwritten = 0; - ed.cmd = argv[0]; - - errors = iterdpy (inputfilename, lineno, 2, argc, argv, - extract_entry, NULL, (char *) &ed); - - if (!ed.fp) { - fprintf (stderr, - "No matches found, authority file \"%s\" not written\n", - ed.filename); - } else { - if (verbose) { - printf ("%d entries written to \"%s\"\n", - ed.nwritten, ed.filename); - } - if (!ed.used_stdout) { - (void) fclose (ed.fp); - } - } - - return errors; -} - - -/* - * add displayname protocolname hexkey - */ -static int -do_add(char *inputfilename, int lineno, int argc, char **argv) -{ - int n, nnew, nrepl; - int len; - char *dpyname; - char *protoname; - char *hexkey; - char *key; - Xauth *auth; - AuthList *list; - - if (argc != 4 || !argv[1] || !argv[2] || !argv[3]) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - dpyname = argv[1]; - protoname = argv[2]; - hexkey = argv[3]; - - len = strlen(hexkey); - if (hexkey[0] == '"' && hexkey[len-1] == '"') { - key = malloc(len-1); - strncpy(key, hexkey+1, len-2); - len -= 2; - } else if (!strcmp(protoname, SECURERPC) || - !strcmp(protoname, K5AUTH)) { - key = malloc(len+1); - strcpy(key, hexkey); - } else { - len = cvthexkey (hexkey, &key); - if (len < 0) { - prefix (inputfilename, lineno); - fprintf (stderr, - "key contains odd number of or non-hex characters\n"); - return 1; - } - } - - auth = (Xauth *) malloc (sizeof (Xauth)); - if (!auth) { - prefix (inputfilename, lineno); - fprintf (stderr, "unable to allocate %ld bytes for Xauth structure\n", - (unsigned long)sizeof (Xauth)); - free (key); - return 1; - } - - if (!get_displayname_auth (dpyname, auth)) { - prefix (inputfilename, lineno); - baddisplayname (dpyname, argv[0]); - free (auth); - free (key); - return 1; - } - - /* - * allow an abbreviation for common protocol names - */ - if (strcmp (protoname, DEFAULT_PROTOCOL_ABBREV) == 0) { - protoname = DEFAULT_PROTOCOL; - } - - auth->name_length = strlen (protoname); - auth->name = copystring (protoname, auth->name_length); - if (!auth->name) { - prefix (inputfilename, lineno); - fprintf (stderr, "unable to allocate %d character protocol name\n", - auth->name_length); - free (auth); - free (key); - return 1; - } - auth->data_length = len; - auth->data = key; - - list = (AuthList *) malloc (sizeof (AuthList)); - if (!list) { - prefix (inputfilename, lineno); - fprintf (stderr, "unable to allocate %ld bytes for auth list\n", - (unsigned long)sizeof (AuthList)); - free (auth); - free (key); - free (auth->name); - return 1; - } - - list->next = NULL; - list->auth = auth; - - /* - * merge it in; note that merge will deal with allocation - */ - n = merge_entries (&xauth_head, list, &nnew, &nrepl); - if (n <= 0) { - prefix (inputfilename, lineno); - fprintf (stderr, "unable to merge in added record\n"); - return 1; - } - - xauth_modified = True; - return 0; -} - -/* - * remove displayname - */ -static int -do_remove(char *inputfilename, int lineno, int argc, char **argv) -{ - int nremoved = 0; - int errors; - - if (argc < 2) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - errors = iterdpy (inputfilename, lineno, 1, argc, argv, - remove_entry, NULL, (char *) &nremoved); - if (verbose) printf ("%d entries removed\n", nremoved); - return errors; -} - -/* - * info - */ -static int -do_info(char *inputfilename, int lineno, int argc, char **argv) -{ - int n; - AuthList *l; - - if (argc != 1) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - for (l = xauth_head, n = 0; l; l = l->next, n++) ; - - printf ("Authority file: %s\n", - xauth_filename ? xauth_filename : "(none)"); - printf ("File new: %s\n", xauth_existed ? No : Yes); - printf ("File locked: %s\n", xauth_locked ? No : Yes); - printf ("Number of entries: %d\n", n); - printf ("Changes honored: %s\n", xauth_allowed ? Yes : No); - printf ("Changes made: %s\n", xauth_modified ? Yes : No); - printf ("Current input: %s:%d\n", inputfilename, lineno); - return 0; -} - - -/* - * exit - */ -static Bool alldone = False; - -/* ARGSUSED */ -static int -do_exit(char *inputfilename, int lineno, int argc, char **argv) -{ - /* allow bogus stuff */ - alldone = True; - return 0; -} - -/* - * quit - */ -/* ARGSUSED */ -static int -do_quit(char *inputfilename, int lineno, int argc, char **argv) -{ - /* allow bogus stuff */ - die (0); - /* NOTREACHED */ - return -1; /* for picky compilers */ -} - - -/* - * source filename - */ -static int -do_source(char *inputfilename, int lineno, int argc, char **argv) -{ - char *script; - char buf[BUFSIZ]; - FILE *fp; - Bool used_stdin = False; - int len; - int errors = 0, status; - int sublineno = 0; - char **subargv; - int subargc; - Bool prompt = False; /* only true if reading from tty */ - - if (argc != 2 || !argv[1]) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - script = argv[1]; - - fp = open_file (&script, "r", &used_stdin, inputfilename, lineno, argv[0]); - if (!fp) { - return 1; - } - - if (verbose && used_stdin && isatty (fileno (fp))) prompt = True; - - while (!alldone) { - buf[0] = '\0'; - if (prompt) { - printf ("xauth> "); - fflush (stdout); - } - if (fgets (buf, sizeof buf, fp) == NULL) break; - sublineno++; - len = strlen (buf); - if (len == 0 || buf[0] == '#') continue; - if (buf[len-1] != '\n') { - prefix (script, sublineno); - fprintf (stderr, "line too long\n"); - errors++; - break; - } - buf[--len] = '\0'; /* remove new line */ - subargv = split_into_words (buf, &subargc); - if (subargv) { - status = process_command (script, sublineno, subargc, subargv); - free ((char *) subargv); - errors += status; - } else { - prefix (script, sublineno); - fprintf (stderr, "unable to break line into words\n"); - errors++; - } - } - - if (!used_stdin) { - (void) fclose (fp); - } - return errors; -} - -/*static int -static int x_protocol_error; -catch_x_protocol_error(Display *dpy, XErrorEvent *errevent) -{ - char buf[80]; - XGetErrorText(dpy, errevent->error_code, buf, sizeof (buf)); - fprintf(stderr, "%s\n", buf); - x_protocol_error = errevent->error_code; - return 1; -} -*/ -/* - * generate - */ -/*static int -do_generate(char *inputfilename, int lineno, int argc, char **argv) -{ - char *displayname; - int major_version, minor_version; - XSecurityAuthorization id_return; - Xauth *auth_in, *auth_return; - XSecurityAuthorizationAttributes attributes; - unsigned long attrmask = 0; - Display *dpy; - int status; - char *args[4]; - char *protoname = "."; - int i; - int authdatalen = 0; - char *hexdata; - char *authdata = NULL; - - if (argc < 2 || !argv[1]) { - prefix (inputfilename, lineno); - badcommandline (argv[0]); - return 1; - } - - displayname = argv[1]; - - if (argc > 2) { - protoname = argv[2]; - } - - for (i = 3; i < argc; i++) { - if (0 == strcmp(argv[i], "timeout")) { - if (++i == argc) { - prefix (inputfilename, lineno); - badcommandline (argv[i-1]); - return 1; - } - attributes.timeout = atoi(argv[i]); - attrmask |= XSecurityTimeout; - - } else if (0 == strcmp(argv[i], "trusted")) { - attributes.trust_level = XSecurityClientTrusted; - attrmask |= XSecurityTrustLevel; - - } else if (0 == strcmp(argv[i], "untrusted")) { - attributes.trust_level = XSecurityClientUntrusted; - attrmask |= XSecurityTrustLevel; - - } else if (0 == strcmp(argv[i], "group")) { - if (++i == argc) { - prefix (inputfilename, lineno); - badcommandline (argv[i-1]); - return 1; - } - attributes.group = atoi(argv[i]); - attrmask |= XSecurityGroup; - - } else if (0 == strcmp(argv[i], "data")) { - if (++i == argc) { - prefix (inputfilename, lineno); - badcommandline (argv[i-1]); - return 1; - } - hexdata = argv[i]; - authdatalen = strlen(hexdata); - if (hexdata[0] == '"' && hexdata[authdatalen-1] == '"') { - authdata = malloc(authdatalen-1); - strncpy(authdata, hexdata+1, authdatalen-2); - authdatalen -= 2; - } else { - authdatalen = cvthexkey (hexdata, &authdata); - if (authdatalen < 0) { - prefix (inputfilename, lineno); - fprintf (stderr, - "data contains odd number of or non-hex characters\n"); - return 1; - } - } - } else { - prefix (inputfilename, lineno); - badcommandline (argv[i]); - return 1; - } - } - - // generate authorization using the Security extension / - - dpy = XOpenDisplay (displayname); - if (!dpy) { - prefix (inputfilename, lineno); - fprintf (stderr, "unable to open display \"%s\".\n", displayname); - return 1; - } - - status = XSecurityQueryExtension(dpy, &major_version, &minor_version); - if (!status) - { - prefix (inputfilename, lineno); - fprintf (stderr, "couldn't query Security extension on display \"%s\"\n", - displayname); - return 1; - } - - // fill in input Xauth struct / - - auth_in = XSecurityAllocXauth(); - if (strcmp (protoname, DEFAULT_PROTOCOL_ABBREV) == 0) { - auth_in->name = DEFAULT_PROTOCOL; - } - else - auth_in->name = protoname; - auth_in->name_length = strlen(auth_in->name); - auth_in->data = authdata; - auth_in->data_length = authdatalen; - - x_protocol_error = 0; - XSetErrorHandler(catch_x_protocol_error); - auth_return = XSecurityGenerateAuthorization(dpy, auth_in, attrmask, - &attributes, &id_return); - XSync(dpy, False); - - if (!auth_return || x_protocol_error) - { - prefix (inputfilename, lineno); - fprintf (stderr, "couldn't generate authorization\n"); - return 1; - } - - if (verbose) - printf("authorization id is %ld\n", id_return); - - // create a fake input line to give to do_add / - - args[0] = "add"; - args[1] = displayname; - args[2] = auth_in->name; - args[3] = bintohex(auth_return->data_length, auth_return->data); - - status = do_add(inputfilename, lineno, 4, args); - - if (authdata) free(authdata); - XSecurityFreeXauth(auth_in); - XSecurityFreeXauth(auth_return); - free(args[3]); // hex data / - XCloseDisplay(dpy); - return status; -} -*/ diff --git a/nx-X11/programs/nxauth/xauth.c b/nx-X11/programs/nxauth/xauth.c deleted file mode 100644 index 5a37c34c8..000000000 --- a/nx-X11/programs/nxauth/xauth.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - * $Xorg: xauth.c,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ - * - * xauth - manipulate authorization file - * - * -Copyright 1989,1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * * - * Author: Jim Fulton, MIT X Consortium - */ -/* $XFree86: xc/programs/xauth/xauth.c,v 1.5 2001/12/14 20:01:15 dawes Exp $ */ - -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2010 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXAUTH, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -#include "xauth.h" - - -/* - * global data - */ -char *ProgramName; /* argv[0], set at top of main() */ -int verbose = -1; /* print certain messages */ -Bool ignore_locks = True; /* for error recovery */ -Bool break_locks = False; /* for error recovery */ - -/* - * local data - */ - -static char *authfilename = NULL; /* filename of cookie file */ -static char *defcmds[] = { "source", "-", NULL }; /* default command */ -static int ndefcmds = 2; -static char *defsource = "(stdin)"; - -/* - * utility routines - */ -static void -usage(void) -{ - static char *prefixmsg[] = { -"", -"where options include:", -" -f authfilename name of authority file to use", -" -v turn on extra messages", -" -q turn off extra messages", -" -i ignore locks on authority file", -" -b break locks on authority file", -"", -"and commands have the following syntax:", -"", -NULL }; - static char *suffixmsg[] = { -"A dash may be used with the \"merge\" and \"source\" to read from the", -"standard input. Commands beginning with \"n\" use numeric format.", -"", -NULL }; - char **msg; - - fprintf (stderr, "usage: %s [-options ...] [command arg ...]\n", - ProgramName); - for (msg = prefixmsg; *msg; msg++) { - fprintf (stderr, "%s\n", *msg); - } - print_help (stderr, NULL, " "); /* match prefix indentation */ - fprintf (stderr, "\n"); - for (msg = suffixmsg; *msg; msg++) { - fprintf (stderr, "%s\n", *msg); - } - exit (1); -} - - -/* - * The main routine - parses command line and calls action procedures - */ -int -main(int argc, char *argv[]) -{ - int i; - char *sourcename = defsource; - char **arglist = defcmds; - int nargs = ndefcmds; - int status; - - ProgramName = argv[0]; - - for (i = 1; i < argc; i++) { - char *arg = argv[i]; - - if (arg[0] == '-') { - char *flag; - - for (flag = (arg + 1); *flag; flag++) { - switch (*flag) { - case 'f': /* -f authfilename */ - if (++i >= argc) usage (); - authfilename = argv[i]; - continue; - case 'v': /* -v */ - verbose = 1; - continue; - case 'q': /* -q */ - verbose = 0; - continue; - case 'b': /* -b */ - break_locks = True; - continue; - case 'i': /* -i */ - ignore_locks = True; - continue; - default: - usage (); - } - } - } else { - sourcename = "(argv)"; - nargs = argc - i; - arglist = argv + i; - if (verbose == -1) verbose = 0; - break; - } - } - - if (verbose == -1) { /* set default, don't junk stdout */ - verbose = (isatty(fileno(stdout)) != 0); - } - - if (!authfilename) { - authfilename = XauFileName (); /* static name, do not free */ - if (!authfilename) { - fprintf (stderr, - "%s: unable to generate an authority file name\n", - ProgramName); - exit (1); - } - } - if (auth_initialize (authfilename) != 0) { - /* error message printed in auth_initialize */ - exit (1); - } - - status = process_command (sourcename, 1, nargs, arglist); - - (void) auth_finalize (); - exit ((status != 0) ? 1 : 0); -} - - diff --git a/nx-X11/programs/nxauth/xauth.h b/nx-X11/programs/nxauth/xauth.h deleted file mode 100644 index 4f8490070..000000000 --- a/nx-X11/programs/nxauth/xauth.h +++ /dev/null @@ -1,58 +0,0 @@ -/* - * $Xorg: xauth.h,v 1.4 2001/02/09 02:05:38 xorgcvs Exp $ - * - * -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - * * - * Author: Jim Fulton, MIT X Consortium - */ -/* $XFree86: xc/programs/xauth/xauth.h,v 1.6 2001/12/14 20:01:15 dawes Exp $ */ - -#include -#include -#include -#include - -#ifndef True -typedef int Bool; -#define False 0 -#define True 1 -#endif - -extern char *ProgramName; - -#include - -extern char *get_hostname ( Xauth *auth ); -extern char *get_address_info ( int family, char *fulldpyname, int prefix, char *host, int *lenp ); -extern char *copystring ( char *src, int len ); -extern char *get_local_hostname ( char *buf, int maxlen ); -extern Bool parse_displayname ( char *displayname, int *familyp, char **hostp, int *dpynump, int *scrnump, char **restp ); -extern int auth_initialize ( char *authfilename ); -extern int auth_finalize ( void ); -extern int process_command ( char *inputfilename, int lineno, int argc, char **argv ); -extern int dump_numeric ( FILE *fp, Xauth *auth ); -extern int print_help ( FILE *fp, char *cmd, char *prefix ); -extern int verbose; -extern Bool ignore_locks; -extern Bool break_locks; diff --git a/nx-libs.spec b/nx-libs.spec index ae6a53e4c..578a1f063 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -391,18 +391,6 @@ related requests locally, ensuring that the most common source of round-trips are nearly reduced to zero. -%package -n nxauth -Group: Applications/System -Summary: NX Auth - -%description -n nxauth -NX is a software suite which implements very efficient compression of -the X11 protocol. This increases performance when using X -applications over a network, especially a slow one. - -This package provides the NX xauth binary. - - %package -n nxproxy Group: Applications/System Summary: NX Proxy @@ -669,13 +657,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %{_datadir}/nx/rgb %{_datadir}/man/man1/nxagent.1* -%files -n nxauth -%defattr(-,root,root) -%{_bindir}/nxauth -%dir %{_libdir}/nx/bin -%{_libdir}/nx/bin/nxauth -%{_datadir}/man/man1/nxauth.1* - %files -n nxproxy %defattr(-,root,root) %{_bindir}/nxproxy diff --git a/roll-tarballs.sh b/roll-tarballs.sh index 60b5e916f..166f8738b 100755 --- a/roll-tarballs.sh +++ b/roll-tarballs.sh @@ -100,7 +100,7 @@ if [ "x$MODE" = "xfull" ]; then echo "${file##*/}" >> "doc/applied-patches/series" done else - rm -f "bin/"{nxagent,nxauth} + rm -f "bin/nxagent" rm -Rf "nxcompshad"* rm -Rf "nxcompext"* rm -Rf "nx-X11"* -- cgit v1.2.3 From 5934d03efdcf32e8ecdf61cc29a80b2088e6de9c Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 30 Jun 2016 23:50:12 +0200 Subject: Rework nxagent and nxproxy wrapper scripts. o Install nxagent/nxproxy executables into multi-arch path. o Fake libNX_X11.so* as $LIBDIR/nx-X11/libX11.so*. o Allow injecting different $NXAPP containing the executable name. o For e.g. x2goagent this requires the following changes: - Move x2goagent symlink from /usr/lib/x2go/bin/x2goagent to $LIBDIR/nx/bin/x2goagent - Replace /usr/bin/x2goagent by a two-liner... ``` #!/bin/sh export NXAPP=x2goagent nxagent ``` --- Makefile | 15 ++++++++++++--- bin/nxagent | 29 ----------------------------- bin/nxagent.in | 25 +++++++++++++++++++++++++ bin/nxproxy | 29 ----------------------------- bin/nxproxy.in | 24 ++++++++++++++++++++++++ debian/nxagent.install | 3 ++- debian/nxproxy.install | 2 +- nx-libs.spec | 3 +-- 8 files changed, 65 insertions(+), 65 deletions(-) delete mode 100644 bin/nxagent create mode 100644 bin/nxagent.in delete mode 100644 bin/nxproxy create mode 100644 bin/nxproxy.in (limited to 'Makefile') diff --git a/Makefile b/Makefile index 47ac50fe9..470a46d6e 100644 --- a/Makefile +++ b/Makefile @@ -14,7 +14,7 @@ BINDIR ?= $(PREFIX)/bin LIBDIR ?= $(PREFIX)/lib USRLIBDIR ?= $(LIBDIR) INCLUDEDIR ?= $(PREFIX)/include -NXLIBDIR ?= $(PREFIX)/lib/nx +NXLIBDIR ?= $(LIBDIR)/nx CONFIGURE ?= ./configure NX_VERSION_MAJOR=$(shell ./version.sh 1) @@ -36,6 +36,8 @@ SHELL:=/bin/bash # clean auto-generated nxversion.def file \ if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \ rm -f nx-X11/config/cf/nxversion.def; \ + rm -f bin/nxagent; \ + rm -f bin/nxproxy; \ fi all: build @@ -91,6 +93,7 @@ install-lite: # install nxproxy wrapper script $(INSTALL_DIR) $(DESTDIR)$(BINDIR) + sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxproxy.in > bin/nxproxy $(INSTALL_PROGRAM) bin/nxproxy $(DESTDIR)$(BINDIR) # FIXME: the below install logic should work via nxproxy/Makefile.in @@ -103,8 +106,11 @@ install-lite: gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 install-full: - for f in nxagent; do \ - $(INSTALL_PROGRAM) bin/$$f $(DESTDIR)$(BINDIR); done + # install nxagent wrapper script + $(INSTALL_DIR) $(DESTDIR)$(BINDIR) + sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxagent.in > bin/nxagent + $(INSTALL_PROGRAM) bin/nxagent $(DESTDIR)$(BINDIR) + for d in nxcompext nxcompshad; do \ $(MAKE) -C $$d install; done @@ -141,6 +147,9 @@ install-full: $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(USRLIBDIR)/ + $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)/nx-X11 + $(INSTALL_SYMLINK) ../libNX_X11.so $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so + $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | \ while read dirname; do \ diff --git a/bin/nxagent b/bin/nxagent deleted file mode 100644 index 6306ed069..000000000 --- a/bin/nxagent +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NXAPP=nxagent -NX_LIBS=/usr/lib/nx -NX_LOCAL_LIBS=/usr/local/lib/nx - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -test -x $NX_LOCAL_LIBS/bin/$NXAPP && export NX_LIBS=$NX_LOCAL_LIBS -test -x $NX_LIBS/bin/$NXAPP && export NX_LIBS=$NX_LIBS - -exec $NX_LIBS/bin/$NXAPP "$@" diff --git a/bin/nxagent.in b/bin/nxagent.in new file mode 100644 index 000000000..86603d549 --- /dev/null +++ b/bin/nxagent.in @@ -0,0 +1,25 @@ +#!/bin/bash + +# Copyright (C) 2012 Mike Gabriel +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +NX_LIBS=@@NXLIBDIR@@ + +# make sure nxagent starts properly with pam_tmpdir.so being in use +NX_TEMP=${NX_TEMP:-/tmp} +export NX_TEMP +export LD_LIBRARY_PATH=@@NXLIBDIR@@-X11/ + +exec $NX_LIBS/bin/${NXAPP:-"nxagent"} "$@" diff --git a/bin/nxproxy b/bin/nxproxy deleted file mode 100644 index 23e7109e3..000000000 --- a/bin/nxproxy +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NXAPP=nxproxy -NX_LIBS=/usr/lib/nx -NX_LOCAL_LIBS=/usr/local/lib/nx - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -test -x $NX_LOCAL_LIBS/bin/$NXAPP && export NX_LIBS=$NX_LOCAL_LIBS -test -x $NX_LIBS/bin/$NXAPP && export NX_LIBS=$NX_LIBS - -exec $NX_LIBS/bin/$NXAPP "$@" \ No newline at end of file diff --git a/bin/nxproxy.in b/bin/nxproxy.in new file mode 100644 index 000000000..d21388d18 --- /dev/null +++ b/bin/nxproxy.in @@ -0,0 +1,24 @@ +#!/bin/bash + +# Copyright (C) 2012 Mike Gabriel +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see http://www.gnu.org/licenses/. + +NX_LIBS=@@NXLIBDIR@@ + +# make sure nxagent starts properly with pam_tmpdir.so being in use +NX_TEMP=${NX_TEMP:-/tmp} +export NX_TEMP + +exec $NX_LIBS/bin/${NXAPP:="nxproxy"} "$@" diff --git a/debian/nxagent.install b/debian/nxagent.install index 123971a7c..75e72fcde 100644 --- a/debian/nxagent.install +++ b/debian/nxagent.install @@ -3,7 +3,8 @@ etc/nxagent/rgb usr/share/nx/rgb usr/share/nx/VERSION.nxagent usr/share/man/man1/nxagent.1* -usr/lib/nx/bin/nxagent +usr/lib/*/nx/bin/nxagent +usr/lib/*/nx-X11/ usr/bin/nxagent usr/share/pixmaps/nxagent.xpm etc/nxagent/nxagent.keyboard diff --git a/debian/nxproxy.install b/debian/nxproxy.install index ab7c97d58..8ade77d6d 100644 --- a/debian/nxproxy.install +++ b/debian/nxproxy.install @@ -1,4 +1,4 @@ -usr/lib/nx/bin/nxproxy +usr/lib/*/nx/bin/nxproxy usr/bin/nxproxy usr/share/man/man1/nxproxy.1* usr/share/nx/VERSION.nxproxy diff --git a/nx-libs.spec b/nx-libs.spec index 5adb42ca2..418a83bdd 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -329,8 +329,7 @@ sed -i -e 's#-O3#%{optflags}#' nx-X11/config/cf/host.def # Use multilib dirs # We're installing binaries into %%{_libdir}/nx/bin rather than %%{_libexedir}/nx # because upstream expects libraries and binaries in the same directory -sed -i -e 's,/lib/nx,/%{_lib}/nx,' Makefile nx-X11/config/cf/X11.tmpl -sed -i -e 's,/usr/lib/,/usr/%{_lib}/,' bin/* +sed -i -e 's,/lib/nx,/%{_lib}/nx,' nx-X11/config/cf/X11.tmpl # Fix FSF address find -name LICENSE | xargs sed -i \ -e 's/59 Temple Place/51 Franklin Street/' -e 's/Suite 330/Fifth Floor/' \ -- cgit v1.2.3 From 1bd2463a2b76340ae356364dff944deba9774cfe Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 28 Jun 2016 20:30:42 +0200 Subject: libNX_X11 data files: Install libNX_X11 related data files. - Update XErrorDB to latest X.org version. - Install XErrorDB, XKeysymDB and Xcms.txt to /usr/{local/}share/nx/. - Assure that libNX_X11 finds those files at the named location. - Update debian/ packaging files. - Update nx-libs.spec packaging file. Fixes ArcticaProject/nx-libs#153 --- Makefile | 3 + debian/nx-x11-common.install | 3 + .../016_nx-X11_install-location.debian.patch | 20 ++++ nx-X11/config/cf/Imake.tmpl | 20 ++++ nx-X11/lib/X11/Imakefile | 6 +- nx-X11/lib/X11/XErrorDB | 106 ++++++++++++++++++++- nx-libs.spec | 3 + 7 files changed, 154 insertions(+), 7 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 470a46d6e..455fa859f 100644 --- a/Makefile +++ b/Makefile @@ -164,6 +164,9 @@ install-full: $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx + $(INSTALL_FILE) nx-X11/lib/X11/XErrorDB $(DESTDIR)$(PREFIX)/share/nx/ + $(INSTALL_FILE) nx-X11/lib/X11/XKeysymDB $(DESTDIR)$(PREFIX)/share/nx/ + $(INSTALL_FILE) nx-X11/lib/X11/Xcms.txt $(DESTDIR)$(PREFIX)/share/nx/ $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy diff --git a/debian/nx-x11-common.install b/debian/nx-x11-common.install index b6fc46613..d3f7b4c3b 100644 --- a/debian/nx-x11-common.install +++ b/debian/nx-x11-common.install @@ -1 +1,4 @@ usr/share/nx/SecurityPolicy +usr/share/nx/XErrorDB +usr/share/nx/XKeysymDB +usr/share/nx/Xcms.txt diff --git a/debian/patches/016_nx-X11_install-location.debian.patch b/debian/patches/016_nx-X11_install-location.debian.patch index ddd92eeb3..ee5bb66cf 100644 --- a/debian/patches/016_nx-X11_install-location.debian.patch +++ b/debian/patches/016_nx-X11_install-location.debian.patch @@ -15,3 +15,23 @@ Last-Update: 2012-12-31 #ifndef AlternateUsrLibDir #define AlternateUsrLibDir NO #endif +@@ -767,7 +767,7 @@ + #define AlternateUsrDataDir YES + #endif + #else +-#define UsrDataDir Concat4(/usr/local,/,share,/nx) ++#define UsrDataDir Concat4(/usr,/,share,/nx) + #ifndef AlternateUsrDataDir + #define AlternateUsrDataDir NO + #endif +--- a/nx-X11/config/cf/site.def ++++ b/nx-X11/config/cf/site.def +@@ -72,7 +72,7 @@ + #ifdef AfterVendorCF + + #ifndef ProjectRoot +-#define ProjectRoot /usr/local ++#define ProjectRoot /usr + #endif + + /* diff --git a/nx-X11/config/cf/Imake.tmpl b/nx-X11/config/cf/Imake.tmpl index d540f418b..b5753b5c7 100644 --- a/nx-X11/config/cf/Imake.tmpl +++ b/nx-X11/config/cf/Imake.tmpl @@ -759,6 +759,25 @@ TCLIBDIR = TclLibDir #define AlternateUsrLibDir YES #endif #endif + +#ifndef UsrDataDir +#ifdef ProjectRoot +#define UsrDataDir Concat4(ProjectRoot,/,share,/nx) +#ifndef AlternateUsrDataDir +#define AlternateUsrDataDir YES +#endif +#else +#define UsrDataDir Concat4(/usr/local,/,share,/nx) +#ifndef AlternateUsrDataDir +#define AlternateUsrDataDir NO +#endif +#endif +#else +#ifndef AlternateUsrDataDir +#define AlternateUsrDataDir YES +#endif +#endif + #ifndef VarDirectory #ifdef ProjectVar #define VarDirectory ProjectVar @@ -1656,6 +1675,7 @@ TCLIBDIR = TclLibDir INCROOT = IncRoot /* base of where to put header files */ USRLIBDIR = UsrLibDir /* nonshared libraries */ + USRDATADIR = UsrDataDir /* arch-indep files (XErrorDB, etc.) */ VARDIR = VarDirectory /* usually /var */ VARLIBDIR = VarLibDir /* xdm runtime files */ SYSTEMUSRLIBDIR = SystemUsrLibDir /* system's "/usr/lib" */ diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile index cc87d6e7b..186cd963d 100644 --- a/nx-X11/lib/X11/Imakefile +++ b/nx-X11/lib/X11/Imakefile @@ -152,9 +152,9 @@ EXTRA_LIBRARIES = /**/ XF86BIGFONT_DEFINES = XF86BigfontExtensionDefines - EDB_DEFINES = -DERRORDB=\"$(LIBDIR)/XErrorDB\" - KDB_DEFINES = -DKEYSYMDB=\"$(LIBDIR)/XKeysymDB\" - CMS_DEFINES = -DXCMSDB=\"$(LIBDIR)/Xcms.txt\" + EDB_DEFINES = -DERRORDB=\"$(USRDATADIR)/XErrorDB\" + KDB_DEFINES = -DKEYSYMDB=\"$(USRDATADIR)/XKeysymDB\" + CMS_DEFINES = -DXCMSDB=\"$(USRDATADIR)/Xcms.txt\" #if HasSnprintf MISC_DEFINES = -DHAS_SNPRINTF -DLIBX11 #endif diff --git a/nx-X11/lib/X11/XErrorDB b/nx-X11/lib/X11/XErrorDB index 80a3310b2..c2efa1044 100644 --- a/nx-X11/lib/X11/XErrorDB +++ b/nx-X11/lib/X11/XErrorDB @@ -1,5 +1,3 @@ -! $Xorg: XErrorDB,v 1.3 2000/08/17 19:44:59 cpqbld Exp $ -! $XdotOrg: xc/lib/X11/XErrorDB,v 1.4 2005/10/21 18:44:24 ajax Exp $ ! ! Copyright 1993, 1995, 1998 The Open Group @@ -25,7 +23,6 @@ ! other dealings in this Software without prior written authorization ! from The Open Group. ! -! $XFree86: xc/lib/X11/XErrorDB,v 3.40 2002/12/21 17:51:42 dawes Exp $ ! ! these are used in XGetErrorMessage. XlibMessage.XError: X Error of failed request @@ -235,6 +232,20 @@ XRequest.XInputExtension.32:X_DeviceBell XRequest.XInputExtension.33:X_SetDeviceValuators XRequest.XInputExtension.34:X_GetDeviceControl XRequest.XInputExtension.35:X_ChangeDeviceControl +XRequest.XInputExtension.36: X_ListDeviceProperties +XRequest.XInputExtension.37: X_ChangeDeviceProperty +XRequest.XInputExtension.38: X_DeleteDeviceProperty +XRequest.XInputExtension.39: X_GetDeviceProperty +XProtoError.XInputExtension.0: XI_BadDevice (invalid Device parameter) +XlibMessage.XInputExtension.0: Device id in failed request: 0x%lx +XProtoError.XInputExtension.1: XI_BadEvent (invalid Event parameter) +XlibMessage.XInputExtension.1: Event id in failed request: 0x%lx +XProtoError.XInputExtension.2: XI_BadMode (invalid Mode parameter) +XlibMessage.XInputExtension.2: Mode id in failed request: 0x%lx +XProtoError.XInputExtension.3: XI_DeviceBusy +XlibMessage.XInputExtension.3: Device id in failed request: 0x%lx +XProtoError.XInputExtension.4: XI_BadClass (invalid Class parameter) +XlibMessage.XInputExtension.4: Class id in failed request: 0x%lx ! MIT-SHM extension, experimental, not an X Consortium standard XRequest.MIT-SHM.0: X_ShmQueryVersion XRequest.MIT-SHM.1: X_ShmAttach @@ -386,6 +397,7 @@ XlibMessage.X3D-PEX.14: Resource id in failed request: 0x%lx XRequest.XTEST.0: X_XTestGetVersion XRequest.XTEST.1: X_XTestCompareCursor XRequest.XTEST.2: X_XTestFakeInput +XRequest.XTEST.3: X_XTestGrabControl ! BIG-REQUESTS extension, an X Consortium standard XRequest.BIG-REQUESTS.0: X_BigReqEnable ! XIE extension, an X Consortium standard @@ -498,6 +510,18 @@ XRequest.GLX.17: X_GLXVendorPrivateWithReply XRequest.GLX.18: X_GLXQueryExtensionsString XRequest.GLX.19: X_GLXQueryServerString XRequest.GLX.20: X_GLXClientInfo +XRequest.GLX.21: X_GLXGetFBConfigs +XRequest.GLX.22: X_GLXCreatePixmap +XRequest.GLX.23: X_GLXDestroyPixmap +XRequest.GLX.24: X_GLXCreateNewContext +XRequest.GLX.25: X_GLXQueryContext +XRequest.GLX.26: X_GLXMakeContextCurrent +XRequest.GLX.27: X_GLXCreatePbuffer +XRequest.GLX.28: X_GLXDestroyPbuffer +XRequest.GLX.29: X_GLXGetDrawableAttributes +XRequest.GLX.30: X_GLXChangeDrawableAttributes +XRequest.GLX.31: X_GLXCreateWindow +XRequest.GLX.32: X_GLXDestroyWindow ! GL Non-rendering Commands XRequest.GLX.103: X_GLXDeleteLists XRequest.GLX.102: X_GLXEndList @@ -555,6 +579,11 @@ XProtoError.GLX.5: GLXBadCurrentWindow XProtoError.GLX.6: GLXBadRenderRequest XProtoError.GLX.7: GLXBadLargeRequest XProtoError.GLX.8: GLXUnsupportedPrivateRequest +XProtoError.GLX.9: GLXBadFBConfig +XProtoError.GLX.10: GLXBadPbuffer +XProtoError.GLX.11: GLXBadCurrentDrawable +XProtoError.GLX.12: GLXBadWindow +XProtoError.GLX.13: GLXBadProfileARB ! XC-MISC extension, an X Consortium standard XRequest.XC-MISC.0: XCMiscGetVersion XRequest.XC-MISC.1: XCMiscGetXIDRange @@ -618,7 +647,7 @@ XProtoError.XFree86-Misc.5: XF86MiscModInDevDisabled XProtoError.XFree86-Misc.6: XF86MiscModInDevClientNotLocal XProtoError.XFree86-Misc.7: XF86MiscNoModule ! XFree86-DGA -- not an X Consortium standard -XRequest.XFree86-DGA.0: XDGAQueryVersion +XRequest.XFree86-DGA.0: XF86DGAQueryVersion XRequest.XFree86-DGA.1: XF86DGAGetVideoLL XRequest.XFree86-DGA.2: XF86DGADirectVideo XRequest.XFree86-DGA.3: XF86DGAGetViewPortSize @@ -843,6 +872,50 @@ XRequest.RANDR.2: RRSetScreenConfig XRequest.RANDR.3: RROldScreenChangeSelectInput XRequest.RANDR.4: RRSelectInput XRequest.RANDR.5: RRGetScreenInfo +XRequest.RANDR.6: RRGetScreenSizeRange +XRequest.RANDR.7: RRSetScreenSize +XRequest.RANDR.8: RRGetScreenResources +XRequest.RANDR.9: RRGetOutputInfo +XRequest.RANDR.10: RRListOutputProperties +XRequest.RANDR.11: RRQueryOutputProperty +XRequest.RANDR.12: RRConfigureOutputProperty +XRequest.RANDR.13: RRChangeOutputProperty +XRequest.RANDR.14: RRDeleteOutputProperty +XRequest.RANDR.15: RRGetOutputProperty +XRequest.RANDR.16: RRCreateMode +XRequest.RANDR.17: RRDestroyMode +XRequest.RANDR.18: RRAddOutputMode +XRequest.RANDR.19: RRDeleteOutputMode +XRequest.RANDR.20: RRGetCrtcInfo +XRequest.RANDR.21: RRSetCrtcConfig +XRequest.RANDR.22: RRGetCrtcGammaSize +XRequest.RANDR.23: RRGetCrtcGamma +XRequest.RANDR.24: RRSetCrtcGamma +XRequest.RANDR.25: RRGetScreenResourcesCurrent +XRequest.RANDR.26: RRSetCrtcTransform +XRequest.RANDR.27: RRGetCrtcTransform +XRequest.RANDR.28: RRGetPanning +XRequest.RANDR.29: RRSetPanning +XRequest.RANDR.30: RRSetOutputPrimary +XRequest.RANDR.31: RRGetOutputPrimary +XRequest.RANDR.32: RRGetProviders +XRequest.RANDR.33: RRGetProviderInfo +XRequest.RANDR.34: RRSetProviderOffloadSink +XRequest.RANDR.35: RRSetProviderOutputSource +XRequest.RANDR.36: RRListProviderProperties +XRequest.RANDR.37: RRQueryProviderProperty +XRequest.RANDR.38: RRConfigureProviderProperty +XRequest.RANDR.39: RRChangeProviderProperty +XRequest.RANDR.40: RRDeleteProviderProperty +XRequest.RANDR.41: RRGetProviderProperty +XProtoError.RANDR.0: BadRROutput (invalid Output parameter) +XlibMessage.RANDR.0: Output id in failed request: 0x%lx +XProtoError.RANDR.1: BadRRCrtc (invalid Crtc parameter) +XlibMessage.RANDR.1: Crtc id in failed request: 0x%lx +XProtoError.RANDR.2: BadRRMode (invalid Mode parameter) +XlibMessage.RANDR.2: Mode id in failed request: 0x%lx +XProtoError.RANDR.3: BadRRProvider (invalid Provider parameter) +XlibMessage.RANDR.3: Provider id in failed request: 0x%lx ! RENDER XRequest.RENDER.0: RenderQueryVersion XRequest.RENDER.1: RenderQueryPictFormats @@ -875,6 +948,12 @@ XRequest.RENDER.27: RenderCreateCursor XRequest.RENDER.28: RenderSetPictureTransform XRequest.RENDER.29: RenderQueryFilters XRequest.RENDER.30: RenderSetPictureFilter +XRequest.RENDER.31: RenderCreateAnimCursor +XRequest.RENDER.32: RenderAddTraps +XRequest.RENDER.33: RenderCreateSolidFill +XRequest.RENDER.34: RenderCreateLinearGradient +XRequest.RENDER.35: RenderCreateRadialGradient +XRequest.RENDER.36: RenderCreateConicalGradient XProtoError.RENDER.0: RenderBadFormat (invalid PictFormat parameter) XlibMessage.RENDER.0: PictFormat id in failed request: 0x%lx XProtoError.RENDER.1: RenderBadPicture (invalid Picture parameter) @@ -915,6 +994,8 @@ XRequest.XFIXES.25: XFixesGetCursorImageAndName XRequest.XFIXES.26: XFixesChangeCursor XRequest.XFIXES.27: XFixesChangeCursorByName XRequest.XFIXES.28: XFixesExpandRegion +XRequest.XFIXES.29: XFixesHideCursor +XRequest.XFIXES.30: XFixesShowCursor XProtoError.XFIXES.0: BadRegion (invalid Region parameter) XlibMessage.XFIXES.0: Region id in failed request: 0x%lx ! DAMAGE extension @@ -922,3 +1003,20 @@ XRequest.DAMAGE.0: XDamageQueryVersion XRequest.DAMAGE.1: XDamageCreate XRequest.DAMAGE.2: XDamageDestroy XRequest.DAMAGE.3: XDamageSubtract +XRequest.DAMAGE.4: XDamageAdd +XProtoError.DAMAGE.0: BadDamage (invalid Damage parameter) +XlibMessage.DAMAGE.0: Damage id in failed request: 0x%lx +! DRI2 extension +XRequest.DRI2.0: DRI2QueryVersion +XRequest.DRI2.1: DRI2Connect +XRequest.DRI2.2: DRI2Authenticate +XRequest.DRI2.3: DRI2CreateDrawable +XRequest.DRI2.4: DRI2DestroyDrawable +XRequest.DRI2.5: DRI2GetBuffers +XRequest.DRI2.6: DRI2CopyRegion +XRequest.DRI2.7: DRI2GetBuffersWithFormat +XRequest.DRI2.8: DRI2SwapBuffers +XRequest.DRI2.9: DRI2GetMSC +XRequest.DRI2.10: DRI2WaitMSC +XRequest.DRI2.11: DRI2WaitSBC +XRequest.DRI2.12: DRI2SwapInterval diff --git a/nx-libs.spec b/nx-libs.spec index 418a83bdd..b4388db38 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -403,6 +403,9 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %dir %{_libdir}/nx %dir %{_datadir}/nx %{_datadir}/nx/SecurityPolicy +%{_datadir}/nx/XErrorDB +%{_datadir}/nx/XKeysymDB +%{_datadir}/nx/Xcms.txt %files -n libNX_X11-6 %defattr(-,root,root) -- cgit v1.2.3 From a788c6856ce72ce84cec484156c953c2a714efa8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 1 Oct 2016 10:29:48 +0200 Subject: Makefile: Adapt install target to the new situation where we fake X11 headers in .build-export. This fixes FTBFS during file installation into .deb and .rpm packages. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 455fa859f..53f8bfe47 100644 --- a/Makefile +++ b/Makefile @@ -151,7 +151,7 @@ install-full: $(INSTALL_SYMLINK) ../libNX_X11.so $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 - . replace.sh; set -x; find nx-X11/.build-exports/include/ -type d | \ + . replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \ while read dirname; do \ $(INSTALL_DIR) "$$(string_rep "$$dirname" nx-X11/.build-exports/include "$(DESTDIR)$(INCLUDEDIR)/")"; \ $(INSTALL_FILE) $${dirname}/*.h \ -- cgit v1.2.3 From a559592dc2702d12c6a50b7308fcb0423106260b Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 20 Oct 2016 09:52:45 +0200 Subject: XKeysymDB: ... got removed. --- Makefile | 1 - debian/nx-x11-common.install | 1 - nx-libs.spec | 1 - 3 files changed, 3 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 53f8bfe47..177471a1a 100644 --- a/Makefile +++ b/Makefile @@ -165,7 +165,6 @@ install-full: $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) nx-X11/lib/X11/XErrorDB $(DESTDIR)$(PREFIX)/share/nx/ - $(INSTALL_FILE) nx-X11/lib/X11/XKeysymDB $(DESTDIR)$(PREFIX)/share/nx/ $(INSTALL_FILE) nx-X11/lib/X11/Xcms.txt $(DESTDIR)$(PREFIX)/share/nx/ $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent diff --git a/debian/nx-x11-common.install b/debian/nx-x11-common.install index d3f7b4c3b..00880c3d7 100644 --- a/debian/nx-x11-common.install +++ b/debian/nx-x11-common.install @@ -1,4 +1,3 @@ usr/share/nx/SecurityPolicy usr/share/nx/XErrorDB -usr/share/nx/XKeysymDB usr/share/nx/Xcms.txt diff --git a/nx-libs.spec b/nx-libs.spec index 6ba05c5ee..1c6523116 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -442,7 +442,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %dir %{_datadir}/nx %{_datadir}/nx/SecurityPolicy %{_datadir}/nx/XErrorDB -%{_datadir}/nx/XKeysymDB %{_datadir}/nx/Xcms.txt %files -n libNX_X11-6 -- cgit v1.2.3 From a9b145d466f774d0a6948a493df2e9c7bff50d6f Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 2 Nov 2016 19:38:08 +0100 Subject: Makefile: Make sure libNX_X11.so.6.2 does not get installed as symlink but as actual file. (Follow-up for 5a90a63). --- Makefile | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 177471a1a..11f8a7d9b 100644 --- a/Makefile +++ b/Makefile @@ -146,7 +146,9 @@ install-full: done; $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) - $(COPY_SYMLINK) nx-X11/.build-exports/lib/*.so* $(DESTDIR)$(USRLIBDIR)/ + $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so $(DESTDIR)$(USRLIBDIR)/ + $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/ + cd nx-X11/.build-exports/lib/ && $(INSTALL_FILE) `readlink libNX_X11.so.6.2` $(DESTDIR)$(USRLIBDIR)/ $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)/nx-X11 $(INSTALL_SYMLINK) ../libNX_X11.so $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 -- cgit v1.2.3 From 7b79e8d831a520624fd5e28be6da7c6ad3360c1a Mon Sep 17 00:00:00 2001 From: Mihai Moldovan <ïonic@ionic.de> Date: Sat, 5 Nov 2016 05:20:31 +0000 Subject: Makefile: fix up a9b145d4. `readlink` returns nothing for non-symlinks. Careful investigation of the build environment revealed that libNX_X11.so.6.2 was no symlink to begin with - so the whole copy operation failed. Pro-actively fix the call though, in case we ever encounter a symlink there. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 11f8a7d9b..0684ffbed 100644 --- a/Makefile +++ b/Makefile @@ -5,6 +5,7 @@ INSTALL_FILE=install -m 644 INSTALL_PROGRAM=install -m 755 INSTALL_SYMLINK=ln -s -f COPY_SYMLINK=cp -a +COPY_DEREFERENCED=cp -RH RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty @@ -148,7 +149,7 @@ install-full: $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so $(DESTDIR)$(USRLIBDIR)/ $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/ - cd nx-X11/.build-exports/lib/ && $(INSTALL_FILE) `readlink libNX_X11.so.6.2` $(DESTDIR)$(USRLIBDIR)/ + $(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/ $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)/nx-X11 $(INSTALL_SYMLINK) ../libNX_X11.so $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 -- cgit v1.2.3 From 80b5de3f55fd493ee85f2a78b731ff05e6363e43 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 3 Nov 2016 00:19:26 +0100 Subject: nxcompext: Move code into Xserver subtree, as nxcompext requires Xserver includes at build time. Fixes ArcticaProject/nx-libs#276. --- Makefile | 6 +- debian/control | 55 +- debian/libxcompext-dev.install | 3 - debian/libxcompext-dev.links | 1 - debian/libxcompext3.install | 1 - debian/libxcompext3.symbols | 103 - debian/libxcompext3.triggers | 1 - debian/rules | 1 - nx-X11/programs/Xserver/Imakefile | 35 +- nx-X11/programs/Xserver/hw/nxagent/Args.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Client.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Clipboard.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Cursor.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Dialog.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Display.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Drawable.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Events.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Font.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/GCOps.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Handlers.c | 8 +- nx-X11/programs/Xserver/hw/nxagent/Image.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 14 +- nx-X11/programs/Xserver/hw/nxagent/Init.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Keyboard.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/NXevents.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Pixmap.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Pointer.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Reconnect.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Rootless.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Screen.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Split.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/Window.c | 2 +- nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.c | 50 + nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.h | 45 + .../programs/Xserver/hw/nxagent/compext/Bitmap.c | 120 + .../programs/Xserver/hw/nxagent/compext/Bitmap.h | 44 + nx-X11/programs/Xserver/hw/nxagent/compext/Clean.c | 349 ++ nx-X11/programs/Xserver/hw/nxagent/compext/Clean.h | 44 + .../programs/Xserver/hw/nxagent/compext/Colormap.c | 50 + .../programs/Xserver/hw/nxagent/compext/Colormap.h | 45 + .../programs/Xserver/hw/nxagent/compext/Compext.c | 4778 ++++++++++++++++++++ .../programs/Xserver/hw/nxagent/compext/Compext.h | 912 ++++ .../programs/Xserver/hw/nxagent/compext/Imakefile | 48 + nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c | 480 ++ nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.h | 46 + nx-X11/programs/Xserver/hw/nxagent/compext/Mask.c | 802 ++++ nx-X11/programs/Xserver/hw/nxagent/compext/Mask.h | 48 + nx-X11/programs/Xserver/hw/nxagent/compext/Png.c | 730 +++ nx-X11/programs/Xserver/hw/nxagent/compext/Png.h | 76 + nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.c | 51 + nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.h | 44 + nx-X11/programs/Xserver/hw/nxagent/compext/Rle.c | 51 + nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h | 44 + nx-X11/programs/Xserver/hw/nxagent/compext/Z.c | 309 ++ nx-X11/programs/Xserver/hw/nxagent/compext/Z.h | 60 + nx-libs.spec | 48 +- nxcompext/Alpha.c | 50 - nxcompext/Alpha.h | 45 - nxcompext/Bitmap.c | 120 - nxcompext/Bitmap.h | 44 - nxcompext/Clean.c | 349 -- nxcompext/Clean.h | 44 - nxcompext/Colormap.c | 50 - nxcompext/Colormap.h | 45 - nxcompext/Jpeg.c | 480 -- nxcompext/Jpeg.h | 46 - nxcompext/Makefile.in | 214 - nxcompext/Mask.c | 802 ---- nxcompext/Mask.h | 48 - nxcompext/NXlib.c | 4776 ------------------- nxcompext/NXlib.h | 912 ---- nxcompext/Pgn.c | 730 --- nxcompext/Pgn.h | 76 - nxcompext/Rgb.c | 51 - nxcompext/Rgb.h | 44 - nxcompext/Rle.c | 51 - nxcompext/Rle.h | 44 - nxcompext/VERSION | 1 - nxcompext/Z.c | 309 -- nxcompext/Z.h | 60 - nxcompext/configure.in | 270 -- nxcompext/install-sh | 238 - nxcompext/mkinstalldirs | 34 - nxcompext/nxcompext.pc.in | 13 - roll-tarballs.sh | 1 - 85 files changed, 9283 insertions(+), 10208 deletions(-) delete mode 100644 debian/libxcompext-dev.install delete mode 100644 debian/libxcompext-dev.links delete mode 100644 debian/libxcompext3.install delete mode 100644 debian/libxcompext3.symbols delete mode 100644 debian/libxcompext3.triggers create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Clean.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Clean.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Compext.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Mask.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Mask.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Png.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Png.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Rle.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Z.c create mode 100644 nx-X11/programs/Xserver/hw/nxagent/compext/Z.h delete mode 100644 nxcompext/Alpha.c delete mode 100644 nxcompext/Alpha.h delete mode 100644 nxcompext/Bitmap.c delete mode 100644 nxcompext/Bitmap.h delete mode 100644 nxcompext/Clean.c delete mode 100644 nxcompext/Clean.h delete mode 100644 nxcompext/Colormap.c delete mode 100644 nxcompext/Colormap.h delete mode 100644 nxcompext/Jpeg.c delete mode 100644 nxcompext/Jpeg.h delete mode 100644 nxcompext/Makefile.in delete mode 100644 nxcompext/Mask.c delete mode 100644 nxcompext/Mask.h delete mode 100644 nxcompext/NXlib.c delete mode 100644 nxcompext/NXlib.h delete mode 100644 nxcompext/Pgn.c delete mode 100644 nxcompext/Pgn.h delete mode 100644 nxcompext/Rgb.c delete mode 100644 nxcompext/Rgb.h delete mode 100644 nxcompext/Rle.c delete mode 100644 nxcompext/Rle.h delete mode 120000 nxcompext/VERSION delete mode 100644 nxcompext/Z.c delete mode 100644 nxcompext/Z.h delete mode 100644 nxcompext/configure.in delete mode 100755 nxcompext/install-sh delete mode 100755 nxcompext/mkinstalldirs delete mode 100644 nxcompext/nxcompext.pc.in (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0684ffbed..9958b21dc 100644 --- a/Makefile +++ b/Makefile @@ -29,7 +29,6 @@ SHELL:=/bin/bash if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi if test -d nx-X11; then \ - if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ fi @@ -70,7 +69,6 @@ build-full: # nxcomp{ext,shad}. cd nx-X11/lib && make - cd nxcompext && autoconf && (${CONFIGURE}) && ${MAKE} cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} cd nx-X11 && ${MAKE} World @@ -112,8 +110,7 @@ install-full: sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxagent.in > bin/nxagent $(INSTALL_PROGRAM) bin/nxagent $(DESTDIR)$(BINDIR) - for d in nxcompext nxcompshad; do \ - $(MAKE) -C $$d install; done + $(MAKE) -C nxcompshad install $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps @@ -198,7 +195,6 @@ uninstall-full: $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/share/nx/ if test -d nx-X11; then \ - if test -f nxcompext/Makefile; then ${MAKE} -C nxcompext $@; fi; \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ if test -f nx-X11/Makefile; then \ if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi; \ diff --git a/debian/control b/debian/control index 633ab784b..6898cdb81 100644 --- a/debian/control +++ b/debian/control @@ -326,7 +326,6 @@ Depends: ${shlibs:Depends}, ${misc:Depends}, libxcomp3 (= ${binary:Version}), - libxcompext3 (= ${binary:Version}), libxcompshad3 (= ${binary:Version}), libnx-x11-6 (= ${binary:Version}), Recommends: @@ -334,8 +333,10 @@ Recommends: xkb-data, Breaks: nxauth, + libxcompext3 (<< 2:3.5.99.3~), Replaces: nxauth, + libxcompext3, Description: NX agent NX is a software suite which implements very efficient compression of the X11 protocol. This increases performance when @@ -470,58 +471,6 @@ Description: nx-X11 compression library (debug package) . This package contains debug symbols for this library. -Package: libxcompext3 -Architecture: any -Multi-Arch: same -Depends: - ${shlibs:Depends}, - ${misc:Depends}, - libnx-x11-6 (= ${binary:Version}), -Breaks: nxcompext (<=3.5.1) -Replaces: nxcompext -Description: nx-X11 protocol compression extensions library - NX is a software suite which implements very efficient - compression of the X11 protocol. This increases performance when - using X applications over a network, especially a slow one. - . - This package extends the core NX library with additional features. - -Package: libxcompext-dev -Provides: libxcompext3-dev -Architecture: any -Section: libdevel -Depends: - libxcompext3 (= ${binary:Version}), - ${misc:Depends}, - libxcomp-dev, -Breaks: nxcompext-dev (<=3.5.1), -Replaces: nxcompext-dev, -Description: nx-X11 protocol compression extensions library (development headers) - NX is a software suite which implements very efficient - compression of the X11 protocol. This increases performance when - using X applications over a network, especially a slow one. - . - This package extends the core NX library with additional features. - . - This package contains the development headers for this library. - -Package: libxcompext3-dbg -Architecture: any -Multi-Arch: same -Depends: - libxcompext3 (= ${binary:Version}), - ${misc:Depends}, -Section: debug -Breaks: nx-x11-dbg (<< 2:3.5.0.29-1~), -Description: nx-X11 protocol compression extensions library (debug package) - NX is a software suite which implements very efficient - compression of the X11 protocol. This increases performance when - using X applications over a network, especially a slow one. - . - This package extends the core NX library with additional features. - . - This package contains debug symbols for this library. - Package: libxcompshad3 Architecture: any Multi-Arch: same diff --git a/debian/libxcompext-dev.install b/debian/libxcompext-dev.install deleted file mode 100644 index 52f22918d..000000000 --- a/debian/libxcompext-dev.install +++ /dev/null @@ -1,3 +0,0 @@ -usr/lib/*/libXcompext.so -usr/include/*/nx/NXlib.h -usr/lib/*/pkgconfig/nxcompext.pc diff --git a/debian/libxcompext-dev.links b/debian/libxcompext-dev.links deleted file mode 100644 index 2346289d9..000000000 --- a/debian/libxcompext-dev.links +++ /dev/null @@ -1 +0,0 @@ -usr/share/doc/libxcompext3 usr/share/doc/libxcompext3-dev diff --git a/debian/libxcompext3.install b/debian/libxcompext3.install deleted file mode 100644 index b9ac8ebb9..000000000 --- a/debian/libxcompext3.install +++ /dev/null @@ -1 +0,0 @@ -usr/lib/*/libXcompext.so.* diff --git a/debian/libxcompext3.symbols b/debian/libxcompext3.symbols deleted file mode 100644 index 0ca6ec6b8..000000000 --- a/debian/libxcompext3.symbols +++ /dev/null @@ -1,103 +0,0 @@ -libXcompext.so.3 libxcompext3 #MINVER# - AlphaCompressData@Base 3.5.0.29 - BitmapCompressData@Base 3.5.0.29 - CleanXYImage@Base 3.5.0.29 - CleanZImage@Base 3.5.0.29 - ColormapCompressData@Base 3.5.0.29 - CopyAndCleanImage@Base 3.5.0.29 - FindLSB@Base 3.5.0.29 - JpegCompressData@Base 3.5.0.29 - MaskImage@Base 3.5.0.29 - MaskInPlaceImage@Base 3.5.0.29 - NXAbortSplit@Base 3.5.0.29 - NXAllocColors@Base 3.5.0.29 - NXAllocSplit@Base 3.5.0.29 - NXAllocUnpack@Base 3.5.0.29 - NXCacheAddImage@Base 3.5.0.29 - NXCacheFindImage@Base 3.5.0.29 - NXCleanImage@Base 3.5.0.29 - NXCollectGrabPointer@Base 3.5.0.29 - NXCollectImage@Base 3.5.0.29 - NXCollectInputFocus@Base 3.5.0.29 - NXCollectProperty@Base 3.5.0.29 - NXCommitSplit@Base 3.5.0.29 - NXCreatePackedImage@Base 3.5.0.29 - NXCreatePalette16@Base 3.5.0.29 - NXCreatePalette32@Base 3.5.0.29 - NXDestroyPackedImage@Base 3.5.0.29 - NXDisplayCongestion@Base 3.5.0.29 - NXDisplayError@Base 3.5.0.29 - NXDisplayFlushable@Base 3.5.0.29 - NXDisplayReadable@Base 3.5.0.29 - NXEncodeAlpha@Base 3.5.0.29 - NXEncodeBitmap@Base 3.5.0.29 - NXEncodeColormap@Base 3.5.0.29 - NXEncodeColors@Base 3.5.0.29 - NXEncodeJpeg@Base 3.5.0.29 - NXEncodePng@Base 3.5.0.29 - NXEncodeRgb@Base 3.5.0.29 - NXEncodeRle@Base 3.5.0.29 - NXEndSplit@Base 3.5.0.29 - NXFinishSplit@Base 3.5.0.29 - NXFlushDisplay@Base 3.5.0.29 - NXForceDisplayError@Base 3.5.0.29 - NXFreeCache@Base 3.5.0.29 - NXFreeSplit@Base 3.5.0.29 - NXFreeUnpack@Base 3.5.0.29 - NXGetCollectGrabPointerResource@Base 3.5.0.29 - NXGetCollectImageResource@Base 3.5.0.29 - NXGetCollectInputFocusResource@Base 3.5.0.29 - NXGetCollectPropertyResource@Base 3.5.0.29 - NXGetCollectedGrabPointer@Base 3.5.0.29 - NXGetCollectedImage@Base 3.5.0.29 - NXGetCollectedInputFocus@Base 3.5.0.29 - NXGetCollectedProperty@Base 3.5.0.29 - NXGetControlParameters@Base 3.5.0.29 - NXGetFontParameters@Base 3.5.0.29 - NXGetShmemParameters@Base 3.5.0.29 - NXGetUnpackParameters@Base 3.5.0.29 - NXHandleDisplayError@Base 3.5.0.29 - NXImageCache@Base 3.5.0.29 - NXImageCacheHits@Base 3.5.0.29 - NXImageCacheOps@Base 3.5.0.29 - NXImageCacheSize@Base 3.5.0.29 - NXInPlacePackImage@Base 3.5.0.29 - NXInitCache@Base 3.5.0.29 - NXInitDisplay@Base 3.5.0.29 - NXMaskImage@Base 3.5.0.29 - NXPackImage@Base 3.5.0.29 - NXPutPackedImage@Base 3.5.0.29 - NXResetDisplay@Base 3.5.0.29 - NXSetCacheParameters@Base 3.5.0.29 - NXSetDisplayBlockHandler@Base 3.5.0.29 - NXSetDisplayBuffer@Base 3.5.0.29 - NXSetDisplayErrorPredicate@Base 3.5.0.29 - NXSetDisplayFlushHandler@Base 3.5.0.29 - NXSetDisplayPolicy@Base 3.5.0.29 - NXSetDisplayStatisticsHandler@Base 3.5.0.29 - NXSetDisplayWriteHandler@Base 3.5.0.29 - NXSetExposeParameters@Base 3.5.0.29 - NXSetLostSequenceHandler@Base 3.5.0.29 - NXSetUnpackAlpha@Base 3.5.0.29 - NXSetUnpackAlphaCompat@Base 3.5.0.29 - NXSetUnpackColormap@Base 3.5.0.29 - NXSetUnpackColormapCompat@Base 3.5.0.29 - NXSetUnpackGeometry@Base 3.5.0.29 - NXStartSplit@Base 3.5.0.29 - NXUnsetLibraryPath@Base 3.5.0.29 - PackImage@Base 3.5.0.29 - PngCompareColorTable@Base 3.5.0.29 - PngCompressData@Base 3.5.0.29 - RgbCompressData@Base 3.5.0.29 - RleCompressData@Base 3.5.0.29 - ZCompressData@Base 3.5.0.29 - ZInitEncoder@Base 3.5.0.29 - ZResetEncoder@Base 3.5.0.29 - _NXInternalInitEncoders@Base 3.5.0.29 - _NXInternalInitResources@Base 3.5.0.29 - _NXInternalResetEncoders@Base 3.5.0.29 - _NXInternalResetResources@Base 3.5.0.29 - color_type@Base 3.5.0.29 - info_ptr@Base 3.5.0.29 - palette@Base 3.5.0.29 - png_ptr@Base 3.5.0.29 diff --git a/debian/libxcompext3.triggers b/debian/libxcompext3.triggers deleted file mode 100644 index dd8660367..000000000 --- a/debian/libxcompext3.triggers +++ /dev/null @@ -1 +0,0 @@ -activate-noawait ldconfig diff --git a/debian/rules b/debian/rules index 4b49ad27d..d30574c07 100755 --- a/debian/rules +++ b/debian/rules @@ -57,7 +57,6 @@ override_dh_strip: dh_strip -plibnx-x11-6 --dbg-package=libnx-x11-6-dbg dh_strip -plibxcomp3 --dbg-package=libxcomp3-dbg dh_strip -plibxcompshad3 --dbg-package=libxcompshad3-dbg - dh_strip -plibxcompext3 --dbg-package=libxcompext3-dbg dh_strip -pnxagent --dbg-package=nxagent-dbg dh_strip -pnxproxy --dbg-package=nxproxy-dbg diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 7bb8132da..a07121ff6 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -214,21 +214,18 @@ NXAGENTDDXDIR = hw NXAGENTDIRS = $(STDDIRS) $(FBDIR) $(MIDAMAGEDIR) $(NXAGENTDDXDIR) $(DEPDIRS) NX_XCOMP_HEADERS = \ + ../../../nxcomp/MD5.h \ ../../../nxcomp/NXalert.h \ ../../../nxcomp/NX.h \ ../../../nxcomp/NXpack.h \ ../../../nxcomp/NXproto.h \ ../../../nxcomp/NXvars.h -NX_XCOMPEXT_HEADERS = \ - ../../../nxcompext/NXlib.h - NX_XCOMPSHAD_HEADERS = \ ../../../nxcompshad/Shadow.h NX_HEADERS = \ $(NX_XCOMP_HEADERS) \ - $(NX_XCOMPEXT_HEADERS) \ $(NX_XCOMPSHAD_HEADERS) BuildIncludes($(NX_HEADERS),nx,..) @@ -295,11 +292,17 @@ NXAGENTOBJS = hw/nxagent/miinitext.o \ XPMLIB = -lXpm XMLLIB = `pkg-config --libs libxml-2.0` PIXMANLIB = `pkg-config --libs pixman-1` +ZLIB = `pkg-config --libs zlib` +PNGLIB = `pkg-config --libs libpng` +JPEGLIB = -ljpeg + NXAGENT = hw/nxagent/LibraryTargetName(nxagent) -NXAGENTLIBS = PreFbLibs $(NXAGENT) FbPostFbLibs $(NXAGENT) $(MI) -NXAGENTSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS) $(XPMLIB) $(XMLLIB) $(PIXMANLIB) +NXCOMPEXT = hw/nxagent/compext/LibraryTargetName(compext) +NXAGENTLIBS = PreFbLibs $(NXAGENT) FbPostFbLibs $(NXCOMPEXT) $(NXAGENT) $(MI) +NXAGENTSYSLIBS = $(LDPRELIBS) $(XLIB) $(SYSLIBS) $(XPMLIB) $(XMLLIB) +NXCOMPEXTSYSLIBS = $(PIXMANLIB) $(ZLIB) $(PNGLIB) $(JPEGLIB) #if HasParallelMake -MakeMutex($(NXAGENTDIRS) $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS)) +MakeMutex($(NXAGENTDIRS) $(NXCOMPEXT) $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS)) #endif #if ForceServerRemake $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) @@ -314,26 +317,26 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) NXAGENTNXLIBS = -L/usr/sfw/lib \ -L ../../../nxcomp \ -L../../../nx-X11/exports/lib \ - -L ../../../nxcompext -L ../../../nxcompshad \ + -L ../../../nxcompshad \ -lrt \ -lXcomp \ - -lXcompext -lXcompshad \ + -lXcompshad \ -lXrender -lXfixes -lXfont -lXcomposite -lXinerama -lXdmcp \ -lNX_X11 -lXext #elif defined(cygwinArchitecture) NXAGENTNXLIBS = -L ../../../nxcomp \ -L../../../nx-X11/exports/lib \ - -L ../../../nxcompext -L ../../../nxcompshad \ + -L ../../../nxcompshad \ -lXcomp \ - -lXcompext -lXcompshad \ + -lXcompshad \ -lXrender -lXfixes -lXfont -lXcomposite -lXdmcp \ -lNX_X11 -lXext #else NXAGENTNXLIBS = -L ../../../nxcomp \ -L../../../nx-X11/exports/lib \ - -L ../../../nxcompext -L ../../../nxcompshad \ + -L ../../../nxcompshad \ -lXcomp \ - -lXcompext -lXcompshad \ + -lXcompshad \ -lXrender -lXfixes -lXfont -lXcomposite -lXinerama -lXdmcp \ -lNX_X11 -lXext #endif @@ -346,7 +349,7 @@ NX_XSHADOWLIBNAME = libXcompshad.so #endif ServerTarget(nxagent,$(NXAGENTDIRS),$(NXAGENTOBJS), \ - $(LIBCWRAPPER) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXAGENTSYSLIBS) $(NXAGENTNXLIBS)) + $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS),$(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(NXAGENTNXLIBS)) /* * Hard coded target to build a static nxagent server. @@ -356,8 +359,8 @@ nxagent_static: nxagent $(MV) nxagent_static nxagent_static.bak; \ else exit 0; fi $(CCLINK) -o nxagent_static -static $(LDOPTIONS) $(NXAGENTOBJS) \ - $(LIBCWRAPPER) $(NXAGENTLIBS) $(LOADABLEEXTS) $(LDLIBS) \ - $(NXAGENTSYSLIBS) $(EXTRA_LOAD_FLAGS) + $(LIBCWRAPPER) $(NXCOMPEXT) $(NXAGENTLIBS) $(LOADABLEEXTS) $(LDLIBS) \ + $(NXCOMPEXTSYSLIBS) $(NXAGENTSYSLIBS) $(EXTRA_LOAD_FLAGS) /* * Hard coded target to build a static nxagent server except for libX11 and libXext. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Args.c b/nx-X11/programs/Xserver/hw/nxagent/Args.c index 7d256f5c5..4dbb003f2 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Args.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Args.c @@ -75,7 +75,7 @@ is" without express or implied warranty. * NX includes and definitions. */ -#include +#include "compext/Compext.h" #include /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Client.c b/nx-X11/programs/Xserver/hw/nxagent/Client.c index 061269a0e..44d48d0e0 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Client.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Client.c @@ -57,7 +57,7 @@ * definition of GC in Agent.h. */ -#include +#include "compext/Compext.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c index 802dcfdac..c18775bfc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Clipboard.c @@ -46,7 +46,7 @@ * Use asyncronous get property replies. */ -#include +#include "compext/Compext.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c index 8698308b8..1db26b7ec 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Cursor.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Cursor.c @@ -65,7 +65,7 @@ is" without express or implied warranty. #include "windowstr.h" #include "resource.h" -#include +#include "compext/Compext.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c index e7d5ba077..da448a1cd 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Dialog.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Dialog.c @@ -42,7 +42,7 @@ #include "Dialog.h" #include -#include +#include "compext/Compext.h" #include /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Display.c b/nx-X11/programs/Xserver/hw/nxagent/Display.c index f1fb1e902..d8e6aa7e3 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Display.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Display.c @@ -87,7 +87,7 @@ is" without express or implied warranty. #include "Handlers.h" #include -#include +#include "compext/Compext.h" #include NXAGENT_ICON_NAME #include X2GOAGENT_ICON_NAME diff --git a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c index 424f07ef3..8d6f4139d 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Drawable.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Drawable.c @@ -42,7 +42,7 @@ #include "Reconnect.h" #include "GCOps.h" -#include +#include "compext/Compext.h" #include "mibstorest.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Events.c b/nx-X11/programs/Xserver/hw/nxagent/Events.c index 4f3875780..371780a92 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Events.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Events.c @@ -102,7 +102,7 @@ #include #include "X11/include/Xrandr_nxagent.h" -#include +#include "compext/Compext.h" /* * Set here the required log level. Please note diff --git a/nx-X11/programs/Xserver/hw/nxagent/Font.c b/nx-X11/programs/Xserver/hw/nxagent/Font.c index 3d0cc4264..5b9c31106 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Font.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Font.c @@ -58,7 +58,7 @@ is" without express or implied warranty. #include "Args.h" -#include +#include "compext/Compext.h" #include #include diff --git a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c index 8961ff6f7..1bca067fc 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/GCOps.c +++ b/nx-X11/programs/Xserver/hw/nxagent/GCOps.c @@ -58,7 +58,7 @@ is" without express or implied warranty. #include "Args.h" #include "Screen.h" -#include +#include "compext/Compext.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c index 36244c4a3..1721be9fb 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Handlers.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Handlers.c @@ -41,7 +41,7 @@ #include "Millis.h" #define Window XlibWindow -#include +#include "compext/Compext.h" #undef Window #include @@ -992,14 +992,14 @@ void nxagentHandleCollectInputFocusEvent(int resource) * While we don't even need window or revert_to later on, a discrepancy in * data type sizes between the X server (Window being a 32bit ID) and * the Xlib (Window being a 64bit ID) will lead to stack corruption here. - * Calling functions from nxcompext from nxagent sounds like a very bad idea + * Calling functions from CompExt from nxagent sounds like a very bad idea * to begin with, but let's assume that's necessary for now and work around * the corruption issue. * - * Even though the NXlib header shows that the function expects a Window-sized + * Even though the CompExt header shows that the function expects a Window-sized * parameter, it's not the Window type as defined and used within the X.Org * Server, but an Xlib type. Hence, we'll be using the "XlibWindow" type here - * and to avoid compiler warnings, "rewrite" the NXlib.h header file via + * and to avoid compiler warnings, "rewrite" the CompExt.h header file via * overriding the original "Window" type with the XlibWindow type, including * the header file and undefining the macro again, essentially unshadowing * the original type. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Image.c b/nx-X11/programs/Xserver/hw/nxagent/Image.c index 5638765f2..4fa98f842 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Image.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Image.c @@ -45,7 +45,7 @@ #include "Pixels.h" #include "Utils.h" -#include +#include "compext/Compext.h" #include /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index bea18b4ca..ae0a9cf3a 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -1,7 +1,11 @@ #include + NULL = +SUBDIRS = compext \ + $(NULL) + #ifdef OS2Architecture SRCS1 = os2Stub.c OBJS1 = os2Stub.o @@ -156,9 +160,6 @@ INCLUDES = \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ `pkg-config --cflags-only-I pixman-1` \ - `pkg-config --cflags-only-I zlib` \ - `pkg-config --cflags-only-I libjpeg` \ - `pkg-config --cflags-only-I libpng` \ $(NULL) #ifdef SunArchitecture INCLUDES = \ @@ -180,7 +181,6 @@ INCLUDES = \ `pkg-config --cflags-only-I libxml-2.0` \ `pkg-config --cflags-only-I pixman-1` \ `pkg-config --cflags-only-I zlib` \ - `pkg-config --cflags-only-I libjpeg` \ `pkg-config --cflags-only-I libpng` \ $(NULL) #else @@ -197,7 +197,6 @@ INCLUDES = \ -I../../miext/damage \ -I../../miext/cw \ -I../../../../../nxcomp \ - -I../../../../../nxcompext \ -I../../../../../nxcompshad \ -I../../../../extras/Mesa/include \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ @@ -205,7 +204,6 @@ INCLUDES = \ `pkg-config --cflags-only-I libxml-2.0` \ `pkg-config --cflags-only-I pixman-1` \ `pkg-config --cflags-only-I zlib` \ - `pkg-config --cflags-only-I libjpeg` \ `pkg-config --cflags-only-I libpng` \ $(NULL) #endif @@ -274,3 +272,7 @@ NormalLibraryObjectRule() NormalLibraryTarget(nxagent,$(OBJS)) DependTarget() + +#define IHaveSubdirs +MakeSubdirs($(SUBDIRS)) +DependSubdirs($(SUBDIRS)) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Init.c b/nx-X11/programs/Xserver/hw/nxagent/Init.c index 52f98d8dd..06703aa4e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Init.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Init.c @@ -75,7 +75,7 @@ is" without express or implied warranty. #include "Error.h" #include -#include +#include "compext/Compext.h" #include "Reconnect.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c index 2fd42d3cf..88af5d400 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Keyboard.c @@ -61,7 +61,7 @@ is" without express or implied warranty. #include "Options.h" #include "Error.h" -#include +#include "compext/Compext.h" #include diff --git a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c index 8f79245f8..f507e5f71 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/NXevents.c +++ b/nx-X11/programs/Xserver/hw/nxagent/NXevents.c @@ -137,7 +137,7 @@ of the copyright holder. #include "../../dix/events.c" -#include +#include "compext/Compext.h" #include "Events.h" #include "Windows.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c index 894d749a2..05558e34f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pixmap.c @@ -50,7 +50,7 @@ #include "Holder.h" #include "Args.h" -#include +#include "compext/Compext.h" #include RESTYPE RT_NX_PIXMAP; diff --git a/nx-X11/programs/Xserver/hw/nxagent/Pointer.c b/nx-X11/programs/Xserver/hw/nxagent/Pointer.c index 20daec2a3..c59230724 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Pointer.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Pointer.c @@ -54,7 +54,7 @@ is" without express or implied warranty. #include "Events.h" #include "Options.h" -#include +#include "compext/Compext.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c index 65e2ae795..ee21bff69 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Reconnect.c @@ -58,7 +58,7 @@ #endif #include -#include +#include "compext/Compext.h" #include /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c index 59b588738..bb961e5a8 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Rootless.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Rootless.c @@ -39,7 +39,7 @@ #include "Atoms.h" #include "Trap.h" -#include +#include "compext/Compext.h" /* * Set here the required log level. diff --git a/nx-X11/programs/Xserver/hw/nxagent/Screen.c b/nx-X11/programs/Xserver/hw/nxagent/Screen.c index 0235ebf1b..e6451292f 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Screen.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Screen.c @@ -102,7 +102,7 @@ is" without express or implied warranty. #include "Xatom.h" #include "Xproto.h" -#include +#include "compext/Compext.h" #include "mibstorest.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/Split.c b/nx-X11/programs/Xserver/hw/nxagent/Split.c index 61a749395..9b9691b02 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Split.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Split.c @@ -34,7 +34,7 @@ #include "Events.h" #include "GCs.h" -#include +#include "compext/Compext.h" /* diff --git a/nx-X11/programs/Xserver/hw/nxagent/Window.c b/nx-X11/programs/Xserver/hw/nxagent/Window.c index f81e08ebc..982c88314 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Window.c +++ b/nx-X11/programs/Xserver/hw/nxagent/Window.c @@ -65,7 +65,7 @@ #include "Events.h" #include -#include +#include "compext/Compext.h" #include "Xatom.h" diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.c new file mode 100644 index 000000000..11450d69d --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.c @@ -0,0 +1,50 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include + +#include "Compext.h" + +#include "Alpha.h" +#include "Z.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define ALPHA_COMPRESSION_LEVEL 1 +#define ALPHA_COMPRESSION_THRESHOLD 32 +#define ALPHA_COMPRESSION_STRATEGY Z_RLE + +static int alphaCompressionLevel = ALPHA_COMPRESSION_LEVEL; +static int alphaCompressionThreshold = ALPHA_COMPRESSION_THRESHOLD; +static int alphaCompressionStrategy = ALPHA_COMPRESSION_STRATEGY; + +char *AlphaCompressData(const char *data, unsigned int size, unsigned int *compressed_size) +{ + return ZCompressData(data, size, alphaCompressionThreshold, alphaCompressionLevel, + alphaCompressionStrategy, compressed_size); +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.h new file mode 100644 index 000000000..d7ac4e78e --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Alpha.h @@ -0,0 +1,45 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Alpha_H +#define Alpha_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *AlphaCompressData( +#if NeedFunctionPrototypes + const char* /* data */, + unsigned int /* size */, + unsigned int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Alpha_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.c new file mode 100644 index 000000000..d906118d0 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.c @@ -0,0 +1,120 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include +#include + +#include "Compext.h" + +#include "Bitmap.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +char *BitmapCompressData(XImage *image, unsigned int *size) +{ + if (image -> bits_per_pixel != 32) + { + #ifdef TEST + fprintf(stderr, "******BitmapCompressData: Nothing to do with image of [%d] bpp and size [%d].\n", + image -> bits_per_pixel, image -> bytes_per_line * image -> height); + #endif + + *size = image -> bytes_per_line * image -> height; + + return image -> data; + } + else + { + /* + * Remove the 4th byte from the bitmap. + */ + + char *data; + + char *next_src; + char *next_dst; + + #ifdef TEST + + if (image -> bytes_per_line != 4 * image -> width) + { + fprintf(stderr, "******BitmapCompressData: PANIC! Image as [%d] bytes per line with expected [%d].\n", + image -> bytes_per_line, 4 * image -> width); + + return NULL; + } + + #endif + + *size = image -> width * image -> height * 3; + + data = Xmalloc(*size); + + if (data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******BitmapCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", + *size); + #endif + + *size = image -> bytes_per_line * image -> height; + + return image -> data; + } + + next_src = image -> data; + next_dst = data; + + if (image -> byte_order == LSBFirst) + { + while (next_src < image -> data + + image -> bytes_per_line * image -> height) + { + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + + next_src++; + } + } + else + { + while (next_src < image -> data + + image -> bytes_per_line * image -> height) + { + next_src++; + + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + } + } + + return data; + } +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.h new file mode 100644 index 000000000..e45836d11 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Bitmap.h @@ -0,0 +1,44 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Bitmap_H +#define Bitmap_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *BitmapCompressData( +#if NeedFunctionPrototypes + XImage* /* image */, + unsigned int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Bitmap_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.c new file mode 100644 index 000000000..7a6d81b6b --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.c @@ -0,0 +1,349 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include +#include + +#include "os.h" + +#include "Compext.h" + +#include "Clean.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +int CleanXYImage(XImage *image) +{ + int i, j, k, plane; + + int bitsToClean = (image -> bytes_per_line << 3) - image -> width - image -> xoffset; + + unsigned int bytesToClean = bitsToClean >> 3; + + bitsToClean &= 7; + + for (k = 0; k < image -> depth; k++) + { + plane = k * (image -> bytes_per_line * image -> height); + + for (i = 1; i <= image -> height; i++) + { + if (image -> byte_order == image -> bitmap_bit_order) + { + for (j = 1; j <= bytesToClean; j++) + { + image -> data[plane + i * (image -> bytes_per_line) - j] = 0x00; + } + } + else + { + for (j = bytesToClean; j >= 1; j--) + { + image -> data[plane + i * (image -> bytes_per_line) - j] = 0x00; + } + } + + if (image -> bitmap_bit_order == MSBFirst) + { + image -> data[plane + i * (image -> bytes_per_line) - j] &= 0xff << bitsToClean; + } + else + { + image -> data[plane + i * (image -> bytes_per_line) - j] &= 0xff >> bitsToClean; + } + } + } + + return 1; +} + +int CleanZImage(XImage *image) +{ + unsigned int bytesToClean; + unsigned int j; + unsigned int imageLength; + + #ifdef TEST + fprintf(stderr, "*****CleanZImage: Going to clean image of [%d] bits per pixel.\n", + image -> bits_per_pixel); + #endif + + switch (image -> bits_per_pixel) + { + case 32: + { + /* + * The caller should pay attention at extracting + * the alpha channel prior to cleaning the image. + * Cleaning an image which is carrying the alpha + * channel will result in the image being treated + * as fully transparent. + */ + + register int i; + + bytesToClean = image -> bytes_per_line * image -> height; + + #ifdef DEBUG + fprintf(stderr, "*****CleanZImage: Cleaning [%d] bytes with bits per pixel [%d] " + "width [%d] bytes per line [%d] height [%d].\n", bytesToClean, + image -> bits_per_pixel, image -> width, image -> + bytes_per_line, image -> height); + #endif + + if (image -> byte_order == LSBFirst) + { + for (i = 3; i < bytesToClean; i += 4) + { + ((unsigned char *) image -> data)[i] = 0x00; + } + } + else + { + for (i = 0; i < bytesToClean; i += 4) + { + ((unsigned char *) image -> data)[i] = 0x00; + } + } + + break; + } + case 24: + case 15: + case 16: + case 8: + { + register int i, j; + + bytesToClean = image -> bytes_per_line - + ((image -> width * image -> bits_per_pixel) >> 3); + + for (i = 1; i <= image -> height; i++) + { + for (j = bytesToClean; j > 0; j--) + { + ((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00; + } + } + + break; + } + default: + { + #ifdef PANIC + fprintf(stderr, "*****CleanZImage: PANIC! Cannot clean image with [%d] bits per pixel.\n", + image -> bits_per_pixel); + #endif + } + } + + /* + * Clean the padding bytes at the real + * end of the buffer. + */ + + imageLength = image -> bytes_per_line * image -> height; + + bytesToClean = imageLength % 4; + + for (j = 0; j < bytesToClean; j++) + { + ((unsigned char *)image -> data)[(imageLength + j)] = 0x00; + } + + return 1; +} + +/* + * Copy a clean version of src_image into dst_image. + * This code is not taking care of the image format. + * The agent doesn't use it and you have to consider + * it unsupported. + */ + +int CopyAndCleanImage(XImage *src_image, XImage *dst_image) +{ + register long data_size; + register int i; + + data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; + + #ifdef WARNING + fprintf(stderr, "******CleanImage: WARNING! Function called with image of [%d] bits per pixel.\n", + src_image -> bits_per_pixel); + #endif + + switch (src_image -> bits_per_pixel) + { + case 32: + { + unsigned int mask; + + if (src_image -> byte_order == MSBFirst) + { + mask = 0xffffff00; + } + else + { + mask = 0x00ffffff; + } + for (i = 0; i < data_size; i++) + { + ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask; + } + + break; + } + + case 24: + { + unsigned int bytes_to_clean; + + for (i = 0; i < data_size; i++) + { + ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i]; + } + + bytes_to_clean = dst_image -> bytes_per_line - ((dst_image -> width * + dst_image -> bits_per_pixel) >> 3); + + if (bytes_to_clean) + { + register unsigned int mask = 0xffffffff; + register int line_size; + register int i; + + line_size = dst_image -> bytes_per_line >> 2; + + if (dst_image -> byte_order == MSBFirst) + { + mask = mask << (bytes_to_clean << 3); + } + else + { + mask = mask >> (bytes_to_clean << 3); + } + + for (i = 0; i < dst_image -> height;) + { + ((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask; + } + } + + break; + } + + case 15: + case 16: + { + for (i = 0; i < data_size; i++) + { + ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; + } + + if (src_image -> width & 0x00000001) + { + int card32_per_line = dst_image -> bytes_per_line >> 2; + + for (i = 0; i < dst_image -> height;) + { + ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff; + } + } + + break; + } + + case 8: + { + unsigned int mask = 0x00000000; + + switch (dst_image -> width % 4) + { + case 3: + { + mask = 0x00ffffff; + + break; + } + case 2: + { + mask = 0x0000ffff; + + break; + } + case 1: + { + mask = 0x000000ff; + + break; + } + default: + { + /* + * Nothing to clean. + */ + + break; + } + } + + for (i = 0; i < data_size; i++) + { + ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; + } + + if (mask) + { + int card32_per_line; + int i; + + card32_per_line = dst_image -> bytes_per_line >> 2; + + for (i = 0; i < dst_image -> height; i++) + { + ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask; + } + } + + break; + } + + default: + { + #ifdef PANIC + fprintf(stderr, "******CleanImage: PANIC! Cannot clean image of [%d] bits per pixel.\n", + src_image -> bits_per_pixel); + #endif + + return 0; + } + } + + return 1; +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.h new file mode 100644 index 000000000..510af1dfb --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Clean.h @@ -0,0 +1,44 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Clean_H +#define Clean_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +int CleanXYImage(XImage *image); +int CleanZImage(XImage *image); + +int CopyAndCleanImage(XImage *src_image, XImage *dst_image); + +#ifdef __cplusplus +} +#endif + +#endif /* Clean_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.c new file mode 100644 index 000000000..6b025542d --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.c @@ -0,0 +1,50 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include + +#include "Compext.h" + +#include "Colormap.h" +#include "Z.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define COLORMAP_COMPRESSION_LEVEL 4 +#define COLORMAP_COMPRESSION_THRESHOLD 32 +#define COLORMAP_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY + +static int colormapCompressionLevel = COLORMAP_COMPRESSION_LEVEL; +static int colormapCompressionThreshold = COLORMAP_COMPRESSION_THRESHOLD; +static int colormapCompressionStrategy = COLORMAP_COMPRESSION_STRATEGY; + +char *ColormapCompressData(const char *data, unsigned int size, unsigned int *compressed_size) +{ + return ZCompressData(data, size, colormapCompressionThreshold, colormapCompressionLevel, + colormapCompressionStrategy, compressed_size); +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.h new file mode 100644 index 000000000..e30f4fdab --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Colormap.h @@ -0,0 +1,45 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ColormapComp_H +#define ColormapComp_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *ColormapCompressData( +#if NeedFunctionPrototypes + const char* /* data */, + unsigned int /* size */, + unsigned int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* ColormapComp_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c new file mode 100644 index 000000000..a91b0c568 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.c @@ -0,0 +1,4778 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#undef _XSERVER64 + +#include + +#ifndef __sun +#include +#endif + +#include "dix.h" +#include "os.h" + +/* + * Needed to enable definition of the callback + * functions. + */ + +#define NX_TRANS_SOCKET + +#include +#include +#include + +#include "Compext.h" + +#include +#include +#include +#include + +#include "Clean.h" +#include "Mask.h" +#include "Colormap.h" +#include "Alpha.h" +#include "Bitmap.h" +#include "Jpeg.h" +#include "Png.h" +#include "Rgb.h" +#include "Rle.h" +#include "Z.h" + + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +/* + * Maximum number of colors allowed in + * Png encoding. + */ + +#define NB_COLOR_MAX 256 + +/* + * Dummy error handlers used internally to catch + * Xlib failures in replies. + */ + +static int _NXInternalReplyErrorFunction(Display *dpy, XErrorEvent *error); + +static void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, + unsigned long lastseq, unsigned int type); + +/* + * Resource ids that can be requested by + * the client for use in split or unpack + * operations. + */ + +static unsigned char _NXSplitResources[NXNumberOfResources]; +static unsigned char _NXUnpackResources[NXNumberOfResources]; + +static Display *_NXDisplayInitialized = NULL; + +/* + * Used in asynchronous handling of + * GetImage replies. + */ + +typedef struct +{ + unsigned long sequence; + unsigned int resource; + unsigned long mask; + int format; + int width; + int height; + _XAsyncHandler *handler; + XImage *image; +} _NXCollectImageState; + +static _NXCollectImageState *_NXCollectedImages[NXNumberOfResources]; + +/* + * Used in asynchronous handling of + * GetProperty replies. + */ + +typedef struct +{ + unsigned long sequence; + unsigned int resource; + Window window; + Atom property; + Atom type; + int format; + unsigned long items; + unsigned long after; + _XAsyncHandler *handler; + char *data; +} _NXCollectPropertyState; + +static _NXCollectPropertyState *_NXCollectedProperties[NXNumberOfResources]; + +/* + * Used in asynchronous handling of + * GrabPointer replies. + */ + +typedef struct +{ + unsigned long sequence; + unsigned int resource; + int status; + _XAsyncHandler *handler; +} _NXCollectGrabPointerState; + +static _NXCollectGrabPointerState *_NXCollectedGrabPointers[NXNumberOfResources]; + +/* + * Used in asynchronous handling of + * GetInputFocus replies. + */ + +typedef struct +{ + unsigned long sequence; + unsigned int resource; + Window focus; + int revert_to; + _XAsyncHandler *handler; +} _NXCollectInputFocusState; + +static _NXCollectInputFocusState *_NXCollectedInputFocuses[NXNumberOfResources]; + +/* + * Used by functions handling cache of + * packed images. + */ + +#define MD5_LENGTH 16 + +typedef struct +{ + md5_byte_t *md5; + XImage *image; + unsigned int method; +} _NXImageCacheEntry; + +int NXImageCacheSize = 0; +int NXImageCacheHits = 0; +int NXImageCacheOps = 0; + +_NXImageCacheEntry *NXImageCache = NULL; + +#ifdef DUMP + +void _NXCacheDump(const char *label); + +void _NXDumpData(const unsigned char *buffer, unsigned int size); + +#endif + +/* + * From X11/PutImage.c. + * + * Cancel a GetReq operation, before doing + * _XSend or Data. + */ + +#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#define UnGetReq(name)\ + dpy->bufptr -= SIZEOF(x##name##Req);\ + dpy->request-- +#else +#define UnGetReq(name)\ + dpy->bufptr -= SIZEOF(x/**/name/**/Req);\ + dpy->request-- +#endif + +#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) +#define UnGetEmptyReq()\ + dpy->bufptr -= 4;\ + dpy->request-- +#else +#define UnGetEmptyReq(name)\ + dpy->bufptr -= 4;\ + dpy->request-- +#endif + +/* + * From X11/ImUtil.c. + */ + +extern int _XGetBitsPerPixel(Display *dpy, int depth); +extern int _XGetScanlinePad(Display *dpy, int depth); + +#define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & \ + ~(long)((pad) - 1)) + +static unsigned int DepthOnes(unsigned long mask) +{ + register unsigned long y; + + y = (mask >> 1) &033333333333; + y = mask - y - ((y >>1) & 033333333333); + return ((unsigned int) (((y + (y >> 3)) & + 030707070707) % 077)); +} + +#define CanMaskImage(image, mask) \ +\ +(image -> format == ZPixmap && mask != NULL && \ + (image -> depth == 32 || image -> depth == 24 || \ + (image -> depth == 16 && (image -> red_mask == 0xf800 && \ + image -> green_mask == 0x7e0 && image -> blue_mask == 0x1f)))) + +#define ShouldMaskImage(image, mask) (mask -> color_mask != 0xff) + +/* + * Initialize and reset the internal structures. + */ + +extern int _NXInternalInitResources(Display *dpy); +extern int _NXInternalResetResources(Display *dpy); +extern int _NXInternalInitEncoders(Display *dpy); +extern int _NXInternalResetEncoders(Display *dpy); + +int NXInitDisplay(Display *dpy) +{ + #ifdef TEST + fprintf(stderr, "******NXInitDisplay: Called for display at [%p].\n", (void *) dpy); + #endif + + if (_NXDisplayInitialized == NULL) + { + _NXInternalInitResources(dpy); + + _NXInternalInitEncoders(dpy); + + _NXDisplayInitialized = dpy; + + return 1; + } + + #ifdef TEST + fprintf(stderr, "******NXInitDisplay: WARNING! Internal structures already initialized.\n"); + #endif + + return 0; +} + +int NXResetDisplay(Display *dpy) +{ + #ifdef TEST + fprintf(stderr, "******NXResetDisplay: Called for display at [%p].\n", (void *) dpy); + #endif + + if (_NXDisplayInitialized != NULL) + { + _NXInternalResetResources(dpy); + + _NXInternalResetEncoders(dpy); + + _NXDisplayInitialized = NULL; + + return 1; + } + + #ifdef TEST + fprintf(stderr, "******NXResetDisplay: WARNING! Internal structures already reset.\n"); + #endif + + return 0; +} + +int _NXInternalInitResources(Display *dpy) +{ + return _NXInternalResetResources(dpy); +} + +int _NXInternalResetResources(Display *dpy) +{ + int i; + + #ifdef TEST + fprintf(stderr, "******_NXInternalResetResources: Clearing all the internal structures.\n"); + #endif + + for (i = 0; i < NXNumberOfResources; i++) + { + _NXSplitResources[i] = 0; + _NXUnpackResources[i] = 0; + + if (_NXCollectedImages[i] != NULL) + { + #ifdef TEST + fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect image data " + "for resource [%d].\n", i); + #endif + + if (_NXCollectedImages[i] -> handler != NULL) + { + DeqAsyncHandler(dpy, _NXCollectedImages[i] -> handler); + + Xfree(_NXCollectedImages[i] -> handler); + } + + if (_NXCollectedImages[i] -> image != NULL) + { + XDestroyImage(_NXCollectedImages[i] -> image); + } + + Xfree(_NXCollectedImages[i]); + + _NXCollectedImages[i] = NULL; + } + + if (_NXCollectedProperties[i] != NULL) + { + #ifdef TEST + fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect property data " + "for resource [%d].\n", i); + #endif + + if (_NXCollectedProperties[i] -> handler != NULL) + { + DeqAsyncHandler(dpy, _NXCollectedProperties[i] -> handler); + + Xfree(_NXCollectedProperties[i] -> handler); + } + + if (_NXCollectedProperties[i] -> data != NULL) + { + Xfree(_NXCollectedProperties[i] -> data); + } + + Xfree(_NXCollectedProperties[i]); + + _NXCollectedProperties[i] = NULL; + } + + if (_NXCollectedGrabPointers[i] != NULL) + { + #ifdef TEST + fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing grab pointer data " + "for resource [%d].\n", i); + #endif + + if (_NXCollectedGrabPointers[i] -> handler != NULL) + { + DeqAsyncHandler(dpy, _NXCollectedGrabPointers[i] -> handler); + + Xfree(_NXCollectedGrabPointers[i] -> handler); + } + + Xfree(_NXCollectedGrabPointers[i]); + + _NXCollectedGrabPointers[i] = NULL; + } + + if (_NXCollectedInputFocuses[i] != NULL) + { + #ifdef TEST + fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect input focus data " + "for resource [%d].\n", i); + #endif + + if (_NXCollectedInputFocuses[i] -> handler != NULL) + { + DeqAsyncHandler(dpy, _NXCollectedInputFocuses[i] -> handler); + + Xfree(_NXCollectedInputFocuses[i] -> handler); + } + + Xfree(_NXCollectedInputFocuses[i]); + + _NXCollectedInputFocuses[i] = NULL; + } + } + + return 1; +} + +int _NXInternalInitEncoders(Display *dpy) +{ + ZInitEncoder(); + + return 1; +} + +int _NXInternalResetEncoders(Display *dpy) +{ + ZResetEncoder(); + + return 1; +} + +int NXSetDisplayPolicy(Display *dpy, int policy) +{ + if (policy == NXPolicyImmediate) + { + return NXTransPolicy(NX_FD_ANY, NX_POLICY_IMMEDIATE); + } + else + { + return NXTransPolicy(NX_FD_ANY, NX_POLICY_DEFERRED); + } +} + +int NXSetDisplayBuffer(Display *dpy, int size) +{ + /* + * This is not multi-thread safe, so, + * if you have threads, be sure that + * they are stopped. + */ + + char *buffer; + + XFlush(dpy); + + if (dpy -> bufmax - size == dpy -> buffer) + { + #ifdef TEST + fprintf(stderr, "******NXSetDisplayBuffer: Nothing to do with buffer size matching.\n"); + #endif + + return 1; + } + else if (dpy -> bufptr != dpy -> buffer) + { + #ifdef PANIC + fprintf(stderr, "******NXSetDisplayBuffer: PANIC! The display buffer is not empty.\n"); + #endif + + return -1; + } + else if ((buffer = Xcalloc(1, size)) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXSetDisplayBuffer: PANIC! Can't allocate [%d] bytes for the buffer.\n", + size); + #endif + + return -1; + } + + if (dpy -> buffer != NULL) + { + Xfree(dpy -> buffer); + } + + dpy -> buffer = buffer; + dpy -> bufptr = dpy -> buffer; + dpy -> bufmax = dpy -> bufptr + size; + + #ifdef TEST + fprintf(stderr, "******NXSetDisplayBuffer: Set the display output buffer size to [%d].\n", + size); + #endif + + return 1; +} + +/* + * If set, the Popen() function in the X server + * wil remove the LD_LIBRARY_PATH variable from + * the environment before calling the execl() + * function on the child process. + */ + +int NXUnsetLibraryPath(int value) +{ + int previous = _NXUnsetLibraryPath; + + _NXUnsetLibraryPath = value; + + #ifdef TEST + fprintf(stderr, "******NXUnsetLibraryPath: Set the flag to [%d] with previous value [%d].\n", + value, previous); + #endif + + return previous; +} + +/* + * If set, the Xlib I/O error handler will simply + * return, instead of quitting the program. This + * leaves to the application the responsibility + * of checking the state of the XlibDisplayIOEr- + * ror flag. + */ + +int NXHandleDisplayError(int value) +{ + int previous = _NXHandleDisplayError; + + _NXHandleDisplayError = value; + + #ifdef TEST + fprintf(stderr, "******NXHandleDisplayError: Set the flag to [%d] with previous value [%d].\n", + value, previous); + #endif + + return previous; +} + +/* + * Shutdown the display descriptor and force Xlib + * to set the I/O error flag. + */ + +Bool NXForceDisplayError(Display *dpy) +{ + if (dpy != NULL) + { + NXTransClose(dpy -> fd); + + if (!(dpy -> flags & XlibDisplayIOError)) + { + shutdown(dpy -> fd, SHUT_RDWR); + + _XIOError(dpy); + } + + return 1; + } + + return 0; +} + +/* + * Check if the display has become invalid. Similarly + * to the modified Xlib, we call the predicate funct- + * ion with the value of the XlibDisplayIOError flag + * only if the I/O error was not encountered already. + * The application can use this function to query the + * XlibDisplayIOError flag because Xlib doesn't expose + * the internals of the display structure to the appli- + * cation. + */ + +int NXDisplayError(Display *dpy) +{ + if (dpy != NULL) + { + return (_XGetIOError(dpy) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))); + } + + return 1; +} + +/* + * Various queries related to the state of the + * display connection. + */ + +int NXDisplayReadable(Display *dpy) +{ + int result; + int readable; + + result = NXTransReadable(dpy -> fd, &readable); + + if (result == 0) + { + #ifdef DEBUG + fprintf(stderr, "******NXDisplayReadable: Returning [%d] bytes readable from fd [%d].\n", + readable, dpy -> fd); + #endif + + return readable; + } + + #ifdef DEBUG + fprintf(stderr, "******NXDisplayReadable: WARNING! Error detected on display fd [%d].\n", + dpy -> fd); + #endif + + return -1; +} + +int NXDisplayFlushable(Display *dpy) +{ + #ifdef DEBUG + + int flushable; + + flushable = NXTransFlushable(dpy -> fd) + + (dpy -> bufptr - dpy -> buffer); + + fprintf(stderr, "******NXDisplayFlushable: Returning [%d+%d=%d] bytes flushable " + "to fd [%d].\n", (int) (dpy -> bufptr - dpy -> buffer), + (int) (flushable - (dpy -> bufptr - dpy -> buffer)), + flushable, dpy -> fd); + + return flushable; + + #else + + return NXTransFlushable(dpy -> fd) + (dpy -> bufptr - dpy -> buffer); + + #endif +} + +int NXDisplayCongestion(Display *dpy) +{ + #ifdef DEBUG + + int congestion = NXTransCongestion(dpy -> fd); + + fprintf(stderr, "******NXDisplayCongestion: Returning [%d] as congestion level for fd [%d].\n", + congestion, dpy -> fd); + + return congestion; + + #else + + return NXTransCongestion(dpy -> fd); + + #endif +} + +int NXFlushDisplay(Display *dpy, int what) +{ + if (!(dpy -> flags & XlibDisplayWriting) && + dpy -> bufptr - dpy -> buffer > 0) + { + #ifdef DEBUG + fprintf(stderr, "******NXFlushDisplay: Writing with [%d] bytes in the buffer.\n", + (int) (dpy -> bufptr - dpy -> buffer)); + #endif + + XFlush(dpy); + } + + if (what == NXFlushBuffer) + { + return 0; + } + + #ifdef DEBUG + fprintf(stderr, "******NXFlushDisplay: Flushing with [%d] bytes in the NX transport.\n", + NXDisplayFlushable(dpy)); + #endif + + return NXTransFlush(dpy -> fd); +} + +NXDisplayErrorPredicate NXSetDisplayErrorPredicate(NXDisplayErrorPredicate predicate) +{ + NXDisplayErrorPredicate previous = _NXDisplayErrorFunction; + + _NXDisplayErrorFunction = predicate; + + #ifdef TEST + fprintf(stderr, "******NXSetDisplayErrorPredicate: Set the predicate to [%p] with previous value [%p].\n", + predicate, previous); + #endif + + return previous; +} + +NXDisplayBlockHandler NXSetDisplayBlockHandler(NXDisplayBlockHandler handler) +{ + NXDisplayBlockHandler previous = _NXDisplayBlockFunction; + + _NXDisplayBlockFunction = handler; + + #ifdef TEST + fprintf(stderr, "******NXSetDisplayBlockHandler: Set the handler to [%p] with previous value [%p].\n", + handler, previous); + #endif + + return previous; +} + +NXDisplayWriteHandler NXSetDisplayWriteHandler(NXDisplayWriteHandler handler) +{ + NXDisplayWriteHandler previous = _NXDisplayWriteFunction; + + _NXDisplayWriteFunction = handler; + + #ifdef TEST + fprintf(stderr, "******NXSetDisplayWriteHandler: Set the handler to [%p] with previous value [%p].\n", + handler, previous); + #endif + + return previous; +} + +NXDisplayFlushHandler NXSetDisplayFlushHandler(NXDisplayFlushHandler handler, Display *display) +{ + NXDisplayFlushHandler previous = _NXDisplayFlushFunction; + + _NXDisplayFlushFunction = handler; + + NXTransHandler(NX_FD_ANY, NX_HANDLER_FLUSH, + (void (*)(void *, int)) handler, (void *) display); + + #ifdef TEST + fprintf(stderr, "******NXSetDisplayFlushHandler: Set the handler to [%p] with display [%p] " + "and previous value [%p].\n", handler, display, previous); + #endif + + return previous; +} + +NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler(NXDisplayStatisticsHandler handler, char **buffer) +{ + NXDisplayStatisticsHandler previous = _NXDisplayStatisticsFunction; + + _NXDisplayStatisticsFunction = handler; + + /* + * Propagate the handler. + */ + + NXTransHandler(NX_FD_ANY, NX_HANDLER_STATISTICS, + (void (*)(void *, int)) handler, (void *) buffer); + + #ifdef TEST + fprintf(stderr, "******NXSetDisplayStatisticsHandler: Set the handler to [%p] with buffer pointer [%p] " + "and previous value [%p].\n", handler, buffer, previous); + #endif + + return previous; +} + +NXLostSequenceHandler NXSetLostSequenceHandler(NXLostSequenceHandler handler) +{ + NXLostSequenceHandler previous = _NXLostSequenceFunction; + + _NXLostSequenceFunction = handler; + + #ifdef TEST + fprintf(stderr, "******NXSetLostSequenceHandler: Set the handler to [%p] with previous value [%p].\n", + handler, previous); + #endif + + return previous; +} + +int _NXInternalReplyErrorFunction(Display *dpy, XErrorEvent *error) +{ + #ifdef TEST + fprintf(stderr, "******_NXInternalReplyErrorFunction: Internal error handler called.\n"); + #endif + + return 0; +} + +void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, + unsigned long lastseq, unsigned int type) +{ + #ifdef TEST + + fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Sequence lost with new " + "sequence %ld last request %ld.\n", newseq, dpy -> request); + + /* + * TODO: Reply or event info must be implemented. + * + * fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Expected event or reply " + * "was %ld with sequence %ld.\n", (long) rep -> type, (long) rep -> sequenceNumber); + */ + + fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Last sequence read " + "was %ld display request is %ld.\n", lastseq & 0xffff, dpy -> request & 0xffff); + + #endif +} + +Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned int *local_major, + unsigned int *local_minor, unsigned int *local_patch, + unsigned int *remote_major, unsigned int *remote_minor, + unsigned int *remote_patch, int *split_timeout, int *motion_timeout, + int *split_mode, int *split_size, unsigned int *pack_method, + unsigned int *pack_quality, int *data_level, int *stream_level, + int *delta_level, unsigned int *load_cache, + unsigned int *save_cache, unsigned int *startup_cache) +{ + xNXGetControlParametersReply rep; + + register xReq *req; + + LockDisplay(dpy); + + GetEmptyReq(NXGetControlParameters, req); + + #ifdef TEST + fprintf(stderr, "******NXGetControlParameters: Sending message opcode [%d].\n", + X_NXGetControlParameters); + #endif + + if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) + { + #ifdef TEST + fprintf(stderr, "******NXGetControlParameters: Error receiving reply.\n"); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + + #ifdef TEST + fprintf(stderr, "******NXGetControlParameters: Got reply with link type [%u].\n", rep.linkType); + + fprintf(stderr, "******NXGetControlParameters: Local protocol major [%u] minor [%u] patch [%u].\n", + rep.localMajor, rep.localMinor, rep.localPatch); + + fprintf(stderr, "******NXGetControlParameters: Remote protocol major [%u] minor [%u] patch [%u].\n", + rep.remoteMajor, rep.remoteMinor, rep.remotePatch); + + fprintf(stderr, "******NXGetControlParameters: Split timeout [%d] motion timeout [%d].\n", + (int) rep.splitTimeout, (int) rep.motionTimeout); + + fprintf(stderr, "******NXGetControlParameters: Split mode [%d] split size [%d].\n", + (int) rep.splitMode, (int) rep.splitSize); + + fprintf(stderr, "******NXGetControlParameters: Preferred pack method [%d] pack quality [%d].\n", + (int) rep.packMethod, (int) rep.packQuality); + + fprintf(stderr, "******NXGetControlParameters: Data level [%d] stream level [%d] delta level [%d].\n", + rep.dataLevel, rep.streamLevel, rep.deltaLevel); + #endif + + *link_type = rep.linkType; + + *local_major = rep.localMajor; + *local_minor = rep.localMinor; + *local_patch = rep.localPatch; + + *remote_major = rep.remoteMajor; + *remote_minor = rep.remoteMinor; + *remote_patch = rep.remotePatch; + + *split_timeout = rep.splitTimeout; + *motion_timeout = rep.motionTimeout; + + *split_mode = rep.splitMode; + *split_size = rep.splitSize; + + *pack_method = rep.packMethod; + *pack_quality = rep.packQuality; + + *data_level = rep.dataLevel; + *stream_level = rep.streamLevel; + *delta_level = rep.deltaLevel; + + *load_cache = rep.loadCache; + *save_cache = rep.saveCache; + *startup_cache = rep.startupCache; + + UnlockDisplay(dpy); + + SyncHandle(); + + /* + * Install our internal out-of-sync handler. + */ + + _NXLostSequenceFunction = _NXInternalLostSequenceFunction; + + return 1; +} + +/* + * Which unpack methods are supported by the + * remote proxy? + */ + +Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char supported_methods[]) +{ + register xNXGetUnpackParametersReq *req; + + xNXGetUnpackParametersReply rep; + + register unsigned n; + + #ifdef TEST + register unsigned i; + #endif + + if (*entries < NXNumberOfPackMethods) + { + #ifdef TEST + fprintf(stderr, "******NXGetUnpackParameters: Requested only [%d] entries while they should be [%d].\n", + *entries, NXNumberOfPackMethods); + #endif + + return 0; + } + + LockDisplay(dpy); + + GetReq(NXGetUnpackParameters, req); + + req -> entries = *entries; + + #ifdef TEST + fprintf(stderr, "******NXGetUnpackParameters: Sending message opcode [%d] with [%d] requested entries.\n", + X_NXGetUnpackParameters, *entries); + #endif + + if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) + { + #ifdef TEST + fprintf(stderr, "******NXGetUnpackParameters: Error receiving reply.\n"); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + + if ((n = rep.length << 2) > *entries) + { + #ifdef TEST + fprintf(stderr, "******NXGetUnpackParameters: Got [%d] bytes of reply data while they should be [%d].\n", + n, *entries); + #endif + + _XEatData(dpy, (unsigned long) n); + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + + *entries = n; + + #ifdef TEST + fprintf(stderr, "******NXGetUnpackParameters: Reading [%d] bytes of reply data.\n", n); + #endif + + _XReadPad(dpy, (char *) supported_methods, n); + + #ifdef TEST + + fprintf(stderr, "******NXGetUnpackParameters: Got reply with methods: "); + + for (i = 0; i < n; i++) + { + if (supported_methods[i] != 0) + { + fprintf(stderr, "[%d]", i); + } + } + + fprintf(stderr, ".\n"); + + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Query and enable the MIT-SHM support between the + * proxy and the X server. The 'enable' flags must be + * true if shared memory PutImages and PutPackedImages + * are desired. On return the flags will say if support + * has been successfully enabled. + * + * Note that the the client part is not useful and not + * implemented. The size of the segment is chosen by + * the proxy. The main purpose of the message is to + * reserve the XID that will be used by the remote. + */ + +Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, + unsigned int *enable_server, unsigned int *client_segment, + unsigned int *server_segment, unsigned int *client_size, + unsigned int *server_size) +{ + register xNXGetShmemParametersReq *req; + + register int stage; + + xNXGetShmemParametersReply rep; + + /* + * Save the previous handler. + */ + + int (*handler)(Display *, XErrorEvent *) = _XErrorFunction; + + *client_segment = 0; + *server_segment = 0; + + if (*enable_client) + { + *client_segment = XAllocID(dpy); + } + + if (*enable_server) + { + *server_segment = XAllocID(dpy); + } + + LockDisplay(dpy); + + _XErrorFunction = _NXInternalReplyErrorFunction; + + for (stage = 0; stage < 3; stage++) + { + GetReq(NXGetShmemParameters, req); + + req -> stage = stage; + + req -> enableClient = (*enable_client != 0 ? 1 : 0); + req -> enableServer = (*enable_server != 0 ? 1 : 0); + + req -> clientSegment = *client_segment; + req -> serverSegment = *server_segment; + + #ifdef TEST + fprintf(stderr, "******NXGetShmemParameters: Sending message opcode [%d] at stage [%d].\n", + X_NXGetShmemParameters, stage); + #endif + + #ifdef TEST + + if (stage == 0) + { + fprintf(stderr, "******NXGetShmemParameters: Enable client is [%u] enable server is [%u].\n", + *enable_client, *enable_server); + + fprintf(stderr, "******NXGetShmemParameters: Client segment is [%u] server segment is [%u].\n", + *client_segment, *server_segment); + } + + #endif + + /* + * There isn't X server reply in the second stage. + * The procedure followed at X server side is: + * + * Stage 0: Send X_QueryExtension and masquerade + * the reply. + * + * Stage 1: Allocate the shared memory and send + * X_ShmAttach to the X server. + * + * Stage 2: Send X_GetInputFocus and masquerade + * the reply. + * + * The last message is used to force a reply and + * collect any X error caused by a failure in the + * shared memory initialization. + */ + + if (stage != 1) + { + /* + * We are only interested in the final reply. + */ + + if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) + { + #ifdef TEST + fprintf(stderr, "******NXGetShmemParameters: Error receiving reply.\n"); + #endif + + _XErrorFunction = handler; + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + } + } + + /* + * Return the settings to client. + */ + + *enable_client = rep.clientEnabled; + *enable_server = rep.serverEnabled; + + *client_size = rep.clientSize; + *server_size = rep.serverSize; + + #ifdef TEST + fprintf(stderr, "******NXGetShmemParameters: Got final reply with enabled client [%u] and server [%u].\n", + *enable_client, *enable_server); + + fprintf(stderr, "******NXGetShmemParameters: Client segment size [%u] server segment size [%u].\n", + *client_size, *server_size); + #endif + + _XErrorFunction = handler; + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Get the path to the font server that can be used by the X + * server to tunnel the font connections across the NX link. + * The path actually represents the TCP port where the proxy + * on the NX client side is listening. The agent can tempora- + * rily enable the tunneling when it needs a font that is not + * available on the client, for example when the session is + * migrated from a different X server. + * + * Note that it is not advisable to use the font server chan- + * nel for other purposes than restoring a font that is found + * missing at the time the session is migrated to a different + * display. This is because the agent implements a caching of + * the list of fonts supported by the client as it needs to + * advertise only the fonts that can be opened at both sides. + */ + +Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_data[]) +{ + register xNXGetFontParametersReq *req; + + xNXGetFontParametersReply rep; + + register unsigned n; + + #ifdef TEST + register unsigned i; + #endif + + if (path_length < 1) + { + #ifdef TEST + fprintf(stderr, "******NXGetFontParameters: No room to store the reply.\n"); + #endif + + return 0; + } + + *path_data = '\0'; + + LockDisplay(dpy); + + GetReq(NXGetFontParameters, req); + + #ifdef TEST + fprintf(stderr, "******NXGetFontParameters: Sending message opcode [%d].\n", + X_NXGetFontParameters); + #endif + + if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) + { + #ifdef TEST + fprintf(stderr, "******NXGetFontParameters: Error receiving reply.\n"); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + + if ((n = rep.length << 2) > path_length) + { + #ifdef TEST + fprintf(stderr, "******NXGetFontParameters: Got [%d] bytes of reply data with only room for [%d].\n", + n, path_length); + #endif + + _XEatData(dpy, (unsigned long) n); + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + + #ifdef TEST + fprintf(stderr, "******NXGetFontParameters: Reading [%d] bytes of reply data.\n", n); + #endif + + _XReadPad(dpy, (char *) path_data, n); + + /* + * Check if the string can be fully + * contained by the buffer. + */ + + if (*path_data > path_length - 1) + { + #ifdef TEST + fprintf(stderr, "******NXGetFontParameters: Inconsistent length in the returned string.\n"); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 0; + } + + #ifdef TEST + + fprintf(stderr, "******NXGetFontParameters: Got font path of [%d] bytes and value [", + (int) *path_data); + + for (i = 0; i < *path_data; i++) + { + fprintf(stderr, "%c", *(path_data + i + 1)); + } + + fprintf(stderr, "].\n"); + + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +unsigned int NXAllocSplit(Display *dpy, unsigned int resource) +{ + if (resource == NXAnyResource) + { + for (resource = 0; resource < NXNumberOfResources; resource++) + { + if (_NXSplitResources[resource] == 0) + { + _NXSplitResources[resource] = 1; + + #ifdef TEST + fprintf(stderr, "******NXAllocSplit: Reserved resource [%u].\n", + resource); + #endif + + return resource; + } + } + + #ifdef TEST + fprintf(stderr, "******NXAllocSplit: WARNING! Resource limit exausted.\n"); + #endif + + return NXNoResource; + } + else if (resource >= 0 && resource < NXNumberOfResources) + { + #ifdef TEST + + if (_NXSplitResources[resource] == 0) + { + fprintf(stderr, "******NXAllocSplit: Reserved requested resource [%u].\n", + resource); + } + else + { + fprintf(stderr, "******NXAllocSplit: Requested resource [%u] already reserved.\n", + resource); + } + + #endif + + _NXSplitResources[resource] = 1; + } + + #ifdef PANIC + fprintf(stderr, "******NXAllocSplit: PANIC! Can't reserve requested resource [%u].\n", + resource); + #endif + + return NXNoResource; +} + +/* + * Tell the proxy to split the next messages. + */ + +int NXStartSplit(Display *dpy, unsigned int resource, unsigned int mode) +{ + register xNXStartSplitReq *req; + + LockDisplay(dpy); + + GetReq(NXStartSplit, req); + + req -> resource = resource; + req -> mode = mode; + + #ifdef TEST + fprintf(stderr, "******NXStartSplit: Sending opcode [%d] with resource [%d] mode [%d].\n", + X_NXStartSplit, resource, mode); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Send the closure of the split sequence and + * tell the proxy to send the results. + */ + +int NXEndSplit(Display *dpy, unsigned int resource) +{ + register xNXEndSplitReq *req; + + LockDisplay(dpy); + + GetReq(NXEndSplit, req); + + req -> resource = resource; + + #ifdef TEST + fprintf(stderr, "******NXEndSplit: Sending opcode [%d] with resource [%d].\n", + X_NXStartSplit, resource); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * This message must be sent whenever the proxy notifies + * the client of the completion of a split. If the 'pro- + * pagate' field is 0, the proxy will not send the ori- + * ginal request to the X server, but will only free the + * internal state. + */ + +int NXCommitSplit(Display *dpy, unsigned int resource, unsigned int propagate, + unsigned char request, unsigned int position) +{ + register xNXCommitSplitReq *req; + + LockDisplay(dpy); + + GetReq(NXCommitSplit, req); + + req -> resource = resource; + req -> propagate = propagate; + req -> request = request; + req -> position = position; + + #ifdef TEST + fprintf(stderr, "******NXCommitSplit: Sending opcode [%d] with resource [%d] propagate [%d] " + "request [%d] position [%d].\n", X_NXCommitSplit, resource, + propagate, request, position); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +int NXAbortSplit(Display *dpy, unsigned int resource) +{ + register xNXAbortSplitReq *req; + + LockDisplay(dpy); + + GetReq(NXAbortSplit, req); + + #ifdef TEST + fprintf(stderr, "******NXAbortSplit: Sending message opcode [%d] with resource [%u].\n", + X_NXAbortSplit, resource); + #endif + + req -> resource = resource; + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +int NXFinishSplit(Display *dpy, unsigned int resource) +{ + register xNXFinishSplitReq *req; + + LockDisplay(dpy); + + GetReq(NXFinishSplit, req); + + #ifdef TEST + fprintf(stderr, "******NXFinishSplit: Sending message opcode [%d] with resource [%u].\n", + X_NXFinishSplit, resource); + #endif + + req -> resource = resource; + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +int NXFreeSplit(Display *dpy, unsigned int resource) +{ + register xNXFreeSplitReq *req; + + if (_NXSplitResources[resource] != 0) + { + LockDisplay(dpy); + + GetReq(NXFreeSplit, req); + + #ifdef TEST + fprintf(stderr, "******NXFreeSplit: Sending message opcode [%d] with resource [%u].\n", + X_NXFreeSplit, resource); + #endif + + req -> resource = resource; + + UnlockDisplay(dpy); + + SyncHandle(); + + #ifdef TEST + fprintf(stderr, "******NXFreeSplit: Making the resource [%u] newly available.\n", + resource); + #endif + + _NXSplitResources[resource] = 0; + } + #ifdef TEST + else + { + fprintf(stderr, "******NXFreeSplit: Nothing to do for resource [%u].\n", + resource); + } + #endif + + return 1; +} + +/* + * Tell to remote proxy to discard expose events + * of one or more types. + */ + +int NXSetExposeParameters(Display *dpy, int expose, int graphics_expose, int no_expose) +{ + register xNXSetExposeParametersReq *req; + + LockDisplay(dpy); + + GetReq(NXSetExposeParameters, req); + + req -> expose = expose; + req -> graphicsExpose = graphics_expose; + req -> noExpose = no_expose; + + #ifdef TEST + fprintf(stderr, "******NXSetExposeParameters: Sending message opcode [%d] with flags [%d][%d][%d].\n", + X_NXSetExposeParameters, req -> expose, req -> graphicsExpose, req -> noExpose); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Tell to the local proxy how to handle the next requests. + */ + +int NXSetCacheParameters(Display *dpy, int enable_cache, int enable_split, + int enable_save, int enable_load) +{ + register xNXSetCacheParametersReq *req; + + LockDisplay(dpy); + + GetReq(NXSetCacheParameters, req); + + req -> enableCache = enable_cache; + req -> enableSplit = enable_split; + req -> enableSave = enable_save; + req -> enableLoad = enable_load; + + #ifdef TEST + fprintf(stderr, "******NXSetCacheParameters: Sending message opcode [%d] with " + "flags [%d][%d][%d][%d].\n", X_NXSetCacheParameters, req -> enableCache, + req -> enableSplit, req -> enableSave, req -> enableLoad); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) +{ + if (resource == NXAnyResource) + { + for (resource = 0; resource < NXNumberOfResources; resource++) + { + if (_NXUnpackResources[resource] == 0) + { + _NXUnpackResources[resource] = 1; + + #ifdef TEST + fprintf(stderr, "******NXAllocUnpack: Reserved resource [%u].\n", + resource); + #endif + + return resource; + } + } + + #ifdef TEST + fprintf(stderr, "******NXAllocUnpack: WARNING! Resource limit exausted.\n"); + #endif + + return NXNoResource; + } + else if (resource >= 0 && resource < NXNumberOfResources) + { + #ifdef TEST + + if (_NXUnpackResources[resource] == 0) + { + fprintf(stderr, "******NXAllocUnpack: Reserved requested resource [%u].\n", + resource); + } + else + { + fprintf(stderr, "******NXAllocUnpack: Requested resource [%u] already reserved.\n", + resource); + } + + #endif + + _NXUnpackResources[resource] = 1; + } + + #ifdef PANIC + fprintf(stderr, "******NXAllocUnpack: PANIC! Can't reserve requested resource [%u].\n", + resource); + #endif + + return NXNoResource; +} + +int NXSetUnpackGeometry(Display *dpy, unsigned int resource, Visual *visual) +{ + register xNXSetUnpackGeometryReq *req; + + LockDisplay(dpy); + + GetReq(NXSetUnpackGeometry, req); + + req -> resource = resource; + + req -> depth1Bpp = _XGetBitsPerPixel(dpy, 1); + req -> depth4Bpp = _XGetBitsPerPixel(dpy, 4); + req -> depth8Bpp = _XGetBitsPerPixel(dpy, 8); + req -> depth16Bpp = _XGetBitsPerPixel(dpy, 16); + req -> depth24Bpp = _XGetBitsPerPixel(dpy, 24); + req -> depth32Bpp = _XGetBitsPerPixel(dpy, 32); + + if (visual != NULL) + { + req -> redMask = visual -> red_mask; + req -> greenMask = visual -> green_mask; + req -> blueMask = visual -> blue_mask; + } + else + { + #ifdef PANIC + fprintf(stderr, "******NXSetUnpackGeometry: PANIC! Can't set the geometry without a visual.\n"); + #endif + + UnGetReq(NXSetUnpackGeometry); + + UnlockDisplay(dpy); + + return -1; + } + + #ifdef TEST + fprintf(stderr, "******NXSetUnpackGeometry: Resource [%u] Depth/Bpp [1/%d][4/%d][8/%d]" + "[16/%d][24/%d][32/%d].\n", resource, req -> depth1Bpp, req -> depth4Bpp, + req -> depth8Bpp, req -> depth16Bpp, req -> depth24Bpp, req -> depth32Bpp); + + fprintf(stderr, "******NXSetUnpackGeometry: red [0x%x] green [0x%x] blue [0x%x].\n", + (unsigned) req -> redMask, (unsigned) req -> greenMask, (unsigned) req -> blueMask); + #endif + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Store a colormap table on the remote side. + * The colormap can then be used to unpack + * an image. + */ + +int NXSetUnpackColormap(Display *dpy, unsigned int resource, unsigned int method, + unsigned int entries, const char *data, unsigned int data_length) +{ + register xNXSetUnpackColormapReq *req; + + register int dst_data_length; + + LockDisplay(dpy); + + GetReq(NXSetUnpackColormap, req); + + req -> resource = resource; + req -> method = method; + + req -> srcLength = data_length; + req -> dstLength = entries << 2; + + dst_data_length = ROUNDUP(data_length, 4); + + req -> length += (dst_data_length >> 2); + + #ifdef TEST + fprintf(stderr, "******NXSetUnpackColormap: Resource [%u] data size [%u] destination " + "data size [%u].\n", resource, data_length, dst_data_length); + #endif + + if (data_length > 0) + { + if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) + { + /* + * Clean the padding bytes in the request. + */ + + *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; + + memcpy(dpy -> bufptr, data, data_length); + + dpy -> bufptr += dst_data_length; + } + else + { + /* + * The _XSend() will pad the request for us. + */ + + _XSend(dpy, data, data_length); + } + } + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Store data of the alpha blending channel + * that will be combined with the next image + * to be unpacked. + */ + +int NXSetUnpackAlpha(Display *dpy, unsigned int resource, unsigned int method, + unsigned int entries, const char *data, unsigned int data_length) +{ + register xNXSetUnpackAlphaReq *req; + + register unsigned int dst_data_length; + + LockDisplay(dpy); + + GetReq(NXSetUnpackAlpha, req); + + req -> resource = resource; + req -> method = method; + + req -> srcLength = data_length; + req -> dstLength = entries; + + dst_data_length = ROUNDUP(data_length, 4); + + req -> length += (dst_data_length >> 2); + + #ifdef TEST + fprintf(stderr, "******NXSetUnpackAlpha: Resource [%u] data size [%u] destination data size [%u].\n", + resource, data_length, dst_data_length); + #endif + + if (data_length > 0) + { + if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) + { + /* + * Clean the padding bytes in the request. + */ + + *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; + + memcpy(dpy -> bufptr, data, data_length); + + dpy -> bufptr += dst_data_length; + } + else + { + /* + * The _XSend() will pad the request for us. + */ + + _XSend(dpy, data, data_length); + } + } + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Compatibility versions to be used when + * connected to a 1.X.X proxy. + */ + +/* + * These are for compatibility with the 1.X.X + * versions. + */ + +#define sz_xNXSetUnpackColormapCompatReq 8 + +typedef struct _NXSetUnpackColormapCompatReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD32 entries B32; +} xNXSetUnpackColormapCompatReq; + +#define X_NXSetUnpackColormapCompat X_NXSetUnpackColormap + +int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, + unsigned int entries, const char *data) +{ + register xNXSetUnpackColormapCompatReq *req; + + register char *dst_data; + + register int dst_data_length; + + #ifdef DUMP + + int i; + + #endif + + LockDisplay(dpy); + + GetReq(NXSetUnpackColormapCompat, req); + + req -> resource = resource; + req -> entries = entries; + + dst_data_length = entries << 2; + + req -> length += (dst_data_length >> 2); + + #ifdef TEST + fprintf(stderr, "******NXSetUnpackColormapCompat: Resource [%u] number of entries [%u] " + "destination data size [%u].\n", resource, entries, dst_data_length); + #endif + + if (entries > 0) + { + if ((dpy -> bufptr + dst_data_length) <= dpy -> bufmax) + { + dst_data = dpy -> bufptr; + } + else + { + if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXSetUnpackColormapCompat: PANIC! Cannot allocate memory.\n"); + #endif + + UnGetReq(NXSetUnpackColormapCompat); + + UnlockDisplay(dpy); + + return -1; + } + } + + memcpy(dst_data, data, entries << 2); + + #ifdef DUMP + + fprintf(stderr, "******NXSetUnpackColormapCompat: Dumping colormap entries:\n"); + + for (i = 0; i < entries; i++) + { + fprintf(stderr, "******NXSetUnpackColormapCompat: [%d] -> [0x%x].\n", + i, *((int *) (dst_data + (i * 4)))); + } + + #endif + + if (dst_data == dpy -> bufptr) + { + dpy -> bufptr += dst_data_length; + } + else + { + _XSend(dpy, dst_data, dst_data_length); + } + } + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +#define sz_xNXSetUnpackAlphaCompatReq 8 + +typedef struct _NXSetUnpackAlphaCompatReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD32 entries B32; +} xNXSetUnpackAlphaCompatReq; + +#define X_NXSetUnpackAlphaCompat X_NXSetUnpackAlpha + +int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, + unsigned int entries, const char *data) +{ + register xNXSetUnpackAlphaCompatReq *req; + + register char *dst_data; + + register unsigned int dst_data_length; + + #ifdef DUMP + + int i; + + #endif + + LockDisplay(dpy); + + GetReq(NXSetUnpackAlphaCompat, req); + + req -> resource = resource; + req -> entries = entries; + + dst_data_length = ROUNDUP(entries, 4); + + req -> length += (dst_data_length >> 2); + + #ifdef TEST + fprintf(stderr, "******NXSetUnpackAlphaCompat: Resource [%u] number of entries [%u] " + "destination data size [%u].\n", resource, entries, dst_data_length); + #endif + + if (entries > 0) + { + if ((dpy -> bufptr + dst_data_length) <= dpy -> bufmax) + { + dst_data = dpy -> bufptr; + } + else + { + if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXSetUnpackAlphaCompat: PANIC! Cannot allocate memory.\n"); + #endif + + UnGetReq(NXSetUnpackAlphaCompat); + + UnlockDisplay(dpy); + + return -1; + } + } + + memcpy(dst_data, data, entries); + + if (dst_data_length != entries) + { + memset(dst_data + entries, 0, dst_data_length - entries); + } + + #ifdef DUMP + + fprintf(stderr, "******NXSetUnpackAlphaCompat: Dumping alpha channel data:\n"); + + for (i = 0; i < dst_data_length; i++) + { + fprintf(stderr, "******NXSetUnpackAlphaCompat: [%d] -> [0x%02x].\n", + i, ((unsigned int) *(dst_data + i)) & 0xff); + } + + #endif + + if (dst_data == dpy -> bufptr) + { + dpy -> bufptr += dst_data_length; + } + else + { + _XSend(dpy, dst_data, dst_data_length); + } + } + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +/* + * Free any geometry, colormap and alpha channel + * data stored by the remote proxy to unpack the + * image. Resource, as usual, must be a value + * between 0 and 255. + */ + +int NXFreeUnpack(Display *dpy, unsigned int resource) +{ + register xNXFreeUnpackReq *req; + + if (_NXUnpackResources[resource] != 0) + { + LockDisplay(dpy); + + GetReq(NXFreeUnpack, req); + + #ifdef TEST + fprintf(stderr, "******NXFreeUnpack: Sending message opcode [%d] with resource [%u].\n", + X_NXFreeUnpack, resource); + #endif + + req -> resource = resource; + + UnlockDisplay(dpy); + + SyncHandle(); + + #ifdef TEST + fprintf(stderr, "******NXFreeUnpack: Making the resource [%u] newly available.\n", + resource); + #endif + + _NXUnpackResources[resource] = 0; + } + #ifdef TEST + else + { + fprintf(stderr, "******NXFreeUnpack: Nothing to do for resource [%u].\n", + resource); + } + #endif + + return 1; +} + +/* + * Wrapper of XCreateImage(). Note that we use offset + * field of XImage to store size of source image in + * packed format. Note also that method is currently + * not stored in the NXignored. + */ + +NXPackedImage *NXCreatePackedImage(Display *dpy, Visual *visual, unsigned int method, + unsigned int depth, int format, char *data, + int data_length, unsigned int width, + unsigned int height, int bitmap_pad, + int bytes_per_line) +{ + XImage* image; + + image = XCreateImage(dpy, visual, depth, format, 0, data, + width, height, bitmap_pad, bytes_per_line); + + if (image != NULL) + { + image -> xoffset = data_length; + } + + return (NXPackedImage *) image; +} + +/* + * Wrapper of XDestroyImage(). + */ + +int NXDestroyPackedImage(NXPackedImage *image) +{ + return XDestroyImage((XImage *) image); +} + +/* + * Clean the image data directly in the current buffer. + */ + +int NXCleanImage(XImage *image) +{ + #ifdef TEST + fprintf(stderr, "******NXCleanImage: Cleaning image with format [%d] depth [%d] " + "bits per pixel [%d].\n", image -> format, image -> depth, + image -> bits_per_pixel); + #endif + + if (image -> format == ZPixmap) + { + if (image -> depth == 1) + { + return CleanXYImage(image); + } + else + { + return CleanZImage(image); + } + } + else + { + return CleanXYImage(image); + } +} + +NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) +{ + XImage *dst_image; + + const ColorMask *mask; + + unsigned int dst_data_size; + unsigned int dst_packed_data_size; + + unsigned int dst_bits_per_pixel; + unsigned int dst_packed_bits_per_pixel; + + #ifdef TEST + fprintf(stderr, "******NXPackImage: Going to pack a new image with method [%d].\n", + method); + #endif + + /* + * Get the mask out of the method and + * check if the visual is supported by + * the color reduction algorithm. + */ + + mask = MethodColorMask(method); + + if (mask == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: WARNING! No mask to apply for pack method [%d].\n", + method); + #endif + + return NULL; + } + else if (CanMaskImage(src_image, mask) == 0) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", + src_image -> format, src_image -> depth, src_image -> bits_per_pixel); + + fprintf(stderr, "******NXPackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", + src_image -> red_mask, src_image -> green_mask, src_image -> blue_mask); + #endif + + return NULL; + } + + /* + * Create a destination image from + * source and apply the color mask. + */ + + if ((dst_image = (XImage *) Xmalloc(sizeof(XImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", + (int) sizeof(XImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + #ifdef TEST + fprintf(stderr, "******NXPackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", + src_image -> width, src_image -> bytes_per_line, src_image -> depth); + #endif + + dst_data_size = src_image -> bytes_per_line * src_image -> height; + + dst_image -> data = Xmalloc(dst_data_size); + + if (dst_image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for masked image data.\n", + dst_data_size); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * If the pixel resulting from the mask + * needs more bits than available, then + * just clean the padding bits in the + * image. + */ + + dst_bits_per_pixel = dst_image -> bits_per_pixel; + dst_packed_bits_per_pixel = MethodBitsPerPixel(method); + + #ifdef TEST + fprintf(stderr, "******NXPackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", + dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); + #endif + + if (dst_packed_bits_per_pixel > dst_bits_per_pixel || + ShouldMaskImage(src_image, mask) == 0) + { + /* + * Should use the same data for source + * and destination to avoid the memcpy. + */ + + if (CopyAndCleanImage(src_image, dst_image) <= 0) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: PANIC! Failed to clean the image.\n"); + #endif + + Xfree(dst_image -> data); + + Xfree(dst_image); + + return NULL; + } + } + else if (MaskImage(mask, src_image, dst_image) <= 0) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: PANIC! Failed to apply the color mask.\n"); + #endif + + Xfree(dst_image -> data); + + Xfree(dst_image); + + return NULL; + } + + /* + * Let's pack the same pixels in fewer bytes. + * Note that we save a new memory allocation + * by using the same image as source and des- + * tination. This means that PackImage() must + * be able to handle ovelapping areas. + */ + + #ifdef TEST + fprintf(stderr, "******NXPackImage: Plain bits per pixel [%d], data size [%d].\n", + dst_bits_per_pixel, dst_data_size); + #endif + + dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / + dst_bits_per_pixel; + + #ifdef TEST + fprintf(stderr, "******NXPackImage: Packed bits per pixel [%d], data size [%d].\n", + dst_packed_bits_per_pixel, dst_packed_data_size); + #endif + + if (PackImage(method, dst_data_size, dst_image, + dst_packed_data_size, dst_image) <= 0) + { + #ifdef PANIC + fprintf(stderr, "******NXPackImage: PANIC! Failed to pack image from [%d] to [%d] bits per pixel.\n", + dst_bits_per_pixel, dst_packed_bits_per_pixel); + #endif + + Xfree(dst_image -> data); + + Xfree(dst_image); + + return NULL; + } + + /* + * Save data size in xoffset field + * to comply with NX packed images. + */ + + dst_image -> xoffset = dst_packed_data_size; + + return dst_image; +} + +/* + * NXInPlacePackImage creates a NXPackedImage + * from a XImage, sharing the same data buffer. + * Is up to the caller to free the data buffer + * only once. + */ + +XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) +{ + XImage *dst_image; + + const ColorMask *mask; + + unsigned int dst_data_size; + unsigned int dst_packed_data_size; + + unsigned int dst_bits_per_pixel; + unsigned int dst_packed_bits_per_pixel; + + #ifdef TEST + fprintf(stderr, "******NXInPlacePackImage: Going to pack a new image with method [%d].\n", + method); + #endif + + /* + * Get mask out of method and check if + * visual is supported by current color + * reduction algorithm. + */ + + mask = MethodColorMask(method); + + if (mask == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXInPlacePackImage: WARNING! No mask to apply for pack method [%d].\n", + method); + #endif + + return NULL; + } + else if (CanMaskImage(src_image, mask) == 0) + { + #ifdef PANIC + fprintf(stderr, "******NXInPlacePackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", + src_image -> format, src_image -> depth, src_image -> bits_per_pixel); + + fprintf(stderr, "******NXInPlacePackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", + src_image -> red_mask, src_image -> green_mask, src_image -> blue_mask); + #endif + return NULL; + } + + /* + * Create a destination image from + * source and apply the color mask. + */ + + if ((dst_image = (XImage *) Xmalloc(sizeof(XImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXInPlacePackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", + (int) sizeof(XImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + #ifdef TEST + fprintf(stderr, "******NXInPlacePackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", + src_image -> width, src_image -> bytes_per_line, src_image -> depth); + #endif + + dst_data_size = src_image -> bytes_per_line * src_image -> height; + + dst_image -> data = src_image -> data; + + /* + * If pixel resulting from mask needs + * more bits than available, then just + * clean the pad bits in image. + */ + + dst_bits_per_pixel = dst_image -> bits_per_pixel; + dst_packed_bits_per_pixel = MethodBitsPerPixel(method); + + #ifdef TEST + fprintf(stderr, "******NXInPlacePackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", + dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); + #endif + + if (dst_packed_bits_per_pixel > dst_bits_per_pixel || + ShouldMaskImage(src_image, mask) == 0) + { + #ifdef TEST + fprintf(stderr, "******NXInPlacePackImage: Just clean image packed_bits_per_pixel[%d], bits_per_pixel[%d].\n", + dst_packed_bits_per_pixel, dst_bits_per_pixel); + #endif + + if (NXCleanImage(dst_image) <= 0) + { + #ifdef PANIC + fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to clean the image.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + } + else if (MaskInPlaceImage(mask, dst_image) <= 0) + { + #ifdef PANIC + fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to apply the color mask.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * Let's pack the same pixels in fewer bytes. + * Note that we save a new memory allocation + * by using the same image as source and des- + * tination. This means that PackImage() must + * be able to handle ovelapping areas. + */ + + #ifdef TEST + fprintf(stderr, "******NXInPlacePackImage: Plain bits per pixel [%d], data size [%d].\n", + dst_bits_per_pixel, dst_data_size); + #endif + + dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / + dst_bits_per_pixel; + + #ifdef TEST + fprintf(stderr, "******NXInPlacePackImage: Packed bits per pixel [%d], data size [%d].\n", + dst_packed_bits_per_pixel, dst_packed_data_size); + #endif + + /* + * Save data size in xoffset field + * to comply with NX packed images. + */ + + dst_image -> xoffset = dst_packed_data_size; + + return dst_image; +} + +int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, + void *gc, NXPackedImage *image, unsigned int method, + unsigned int depth, int src_x, int src_y, int dst_x, + int dst_y, unsigned int width, unsigned int height) +{ + register xNXPutPackedImageReq *req; + + register unsigned int src_data_length; + register unsigned int dst_data_length; + + LockDisplay(dpy); + + FlushGC(dpy, (GC) gc); + + GetReq(NXPutPackedImage, req); + + req -> resource = resource; + req -> drawable = drawable; + req -> gc = ((GC) gc) -> gid; + + #ifdef TEST + fprintf(stderr, "******NXPutPackedImage: Image resource [%d] drawable [%d] gc [%d].\n", + req -> resource, (int) req -> drawable, (int) req -> gc); + #endif + + /* + * There is no leftPad field in request. We only + * support a leftPad of 0. Anyway, X imposes a + * leftPad of 0 in case of ZPixmap format. + */ + + req -> format = image -> format; + + /* + * Source depth, as well as width and height, + * are taken from the image structure. + */ + + req -> srcDepth = image -> depth; + + req -> srcX = src_x; + req -> srcY = src_y; + + req -> srcWidth = image -> width; + req -> srcHeight = image -> height; + + /* + * The destination depth is provided + * by the caller. + */ + + req -> dstDepth = depth; + + req -> dstX = dst_x; + req -> dstY = dst_y; + + req -> dstWidth = width; + req -> dstHeight = height; + + req -> method = method; + + #ifdef TEST + fprintf(stderr, "******NXPutPackedImage: Source image depth [%d] destination depth [%d] " + "method [%d].\n", req -> srcDepth, req -> dstDepth, req -> method); + #endif + + /* + * Source data length is the size of image in packed format, + * as stored in xoffset field of XImage. Destination data + * size is calculated according to bytes per line of target + * image, so the caller must provide the right depth at the + * time XImage structure is created. + */ + + req -> srcLength = image -> xoffset; + + if (image -> width == (int) width && + image -> height == (int) height) + { + req -> dstLength = image -> bytes_per_line * image -> height; + } + else if (image -> format == ZPixmap) + { + req -> dstLength = ROUNDUP((image -> bits_per_pixel * width), + image -> bitmap_pad) * height >> 3; + } + else + { + req -> dstLength = ROUNDUP(width, image -> bitmap_pad) * height >> 3; + } + + src_data_length = image -> xoffset; + + dst_data_length = ROUNDUP(src_data_length, 4); + + #ifdef TEST + fprintf(stderr, "******NXPutPackedImage: Source data length [%d] request data length [%d].\n", + src_data_length, dst_data_length); + #endif + + req -> length += (dst_data_length >> 2); + + if (src_data_length > 0) + { + if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) + { + /* + * Clean the padding bytes in the request. + */ + + *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; + + memcpy(dpy -> bufptr, image -> data, src_data_length); + + dpy -> bufptr += dst_data_length; + } + else + { + /* + * The _XSend() will pad the request for us. + */ + + _XSend(dpy, image -> data, src_data_length); + } + } + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, + XColor screens_in_out[], Bool results_in_out[]) +{ + Status result = 0; + xAllocColorReply rep; + register xAllocColorReq *req; + + Bool alloc_error = False; + + register unsigned int i; + + LockDisplay(dpy); + + for (i = 0; i < entries; i++) + { + GetReq(AllocColor, req); + + req -> cmap = colormap; + + req -> red = screens_in_out[i].red; + req -> green = screens_in_out[i].green; + req -> blue = screens_in_out[i].blue; + } + + for (i = 0; i < entries; i++) + { + result = _XReply(dpy, (xReply *) &rep, 0, xTrue); + + if (result) + { + screens_in_out[i].pixel = rep.pixel; + + screens_in_out[i].red = rep.red; + screens_in_out[i].green = rep.green; + screens_in_out[i].blue = rep.blue; + + results_in_out[i] = True; + } + else + { + results_in_out[i] = False; + + alloc_error = True; + } + } + + UnlockDisplay(dpy); + + SyncHandle(); + + return (alloc_error == False); +} + +char *NXEncodeColormap(const char *src_data, unsigned int src_size, unsigned int *dst_size) +{ + return ColormapCompressData(src_data, src_size, dst_size); +} + +char *NXEncodeAlpha(const char *src_data, unsigned int src_size, unsigned int *dst_size) +{ + return AlphaCompressData(src_data, src_size, dst_size); +} + +NXPackedImage *NXEncodeRgb(XImage *src_image, unsigned int method, unsigned int quality) +{ + NXPackedImage *dst_image = NULL; + + unsigned int dst_size; + + /* + * Create a new image structure as a copy + * of the source. + */ + + if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeRgb: PANIC! Cannot allocate [%d] bytes for the image.\n", + (int) sizeof(XImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + dst_image -> data = RgbCompressData(src_image, &dst_size); + + if (dst_image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeRgb: PANIC! Rgb compression failed.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * Store the Rgb size in the xoffset field. + */ + + dst_image -> xoffset = dst_size; + + return dst_image; +} + +NXPackedImage *NXEncodeRle(XImage *src_image, unsigned int method, unsigned int quality) +{ + NXPackedImage *dst_image = NULL; + + unsigned int dst_size; + + /* + * Create a new image structure as a copy + * of the source. + */ + + if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeRle: PANIC! Cannot allocate [%d] bytes for the image.\n", + (int) sizeof(XImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + dst_image -> data = RleCompressData(src_image, &dst_size); + + if (dst_image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeRle: PANIC! Rle compression failed.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * Store the Rle size in the xoffset field. + */ + + dst_image -> xoffset = dst_size; + + return dst_image; +} + +NXPackedImage *NXEncodeBitmap(XImage *src_image, unsigned int method, unsigned int quality) +{ + NXPackedImage *dst_image = NULL; + + unsigned int dst_size; + + /* + * Create a new image structure as a copy + * of the source. + */ + + if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeBitmap: PANIC! Cannot allocate [%d] bytes for the image.\n", + (int) sizeof(XImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + dst_image -> data = BitmapCompressData(src_image, &dst_size); + + if (dst_image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeBitmap: PANIC! Bitmap compression failed.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * Store the bitmap size in the xoffset field. + */ + + dst_image -> xoffset = dst_size; + + return dst_image; +} + +NXPackedImage *NXEncodeJpeg(XImage *src_image, unsigned int method, unsigned int quality) +{ + NXPackedImage *dst_image = NULL; + + int size; + + /* + * Check if the bpp of the image is valid + * for the Jpeg compression. + */ + + if (src_image -> bits_per_pixel < 15) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeJpeg: PANIC! Invalid bpp for Jpeg compression [%d]\n.", + src_image -> bits_per_pixel); + #endif + + return NULL; + } + + /* + * Create the destination image as a copy + * of the source. + */ + + if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeJpeg: PANIC! Cannot allocate [%d] bytes for the Jpeg image.\n", + (int) sizeof(NXPackedImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + dst_image -> data = JpegCompressData(src_image, quality, &size); + + if (dst_image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodeJpeg: PANIC! Jpeg compression failed.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * Store the Jpeg size in the xoffset field. + */ + + dst_image -> xoffset = size; + + return dst_image; +} + +NXPackedImage *NXEncodePng(XImage *src_image, unsigned int method, unsigned int quality) +{ + NXPackedImage *dst_image = NULL; + + int size; + + /* + * Check if the bpp of the image is valid + * for png compression. + */ + + if (src_image -> bits_per_pixel < 15) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodePng: PANIC! Invalid bpp for Png compression [%d].\n", + src_image -> bits_per_pixel); + #endif + + return NULL; + } + + if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodePng: PANIC! Cannot allocate [%d] bytes for the Png image.\n", + (int) sizeof(NXPackedImage)); + #endif + + return NULL; + } + + *dst_image = *src_image; + + dst_image -> data = PngCompressData(dst_image, &size); + + if (dst_image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXEncodePng: PANIC! Png compression failed.\n"); + #endif + + Xfree(dst_image); + + return NULL; + } + + /* + * Store the Png size in the xoffset field. + */ + + dst_image -> xoffset = size; + + return dst_image; +} + +int NXEncodeColors(XImage *src_image, NXColorTable *color_table, int nb_max) +{ + int x, y, t, p; + + long pixel; + + /* + * We need a smarter way to extract + * the colors from the image and + * create a color table. + */ + + memset(color_table, 0, nb_max * sizeof(NXColorTable)); + + for (x = 0, p = 0; x < src_image -> width; x++) + { + for (y = 0; y < src_image -> height; y++) + { + pixel = XGetPixel(src_image, x, y); + + for (t = 0; t < nb_max; t++) + { + if ( color_table[t].found == 0) + { + color_table[t].pixel = pixel; + color_table[t].found = 1; + + p++; + + break; + } + else if ((color_table[t].pixel) == pixel) + { + break; + } + } + + if (p == nb_max) + { + return nb_max + 1; + } + } + } + + return p; +} + +void NXMaskImage(XImage *image, unsigned int method) +{ + unsigned int maskMethod; + + const ColorMask *mask; + + /* + * Choose the correct mask method + */ + + switch(method) + { + case PACK_JPEG_8_COLORS: + case PACK_PNG_8_COLORS: + { + maskMethod = MASK_8_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_8_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_64_COLORS: + case PACK_PNG_64_COLORS: + { + maskMethod = MASK_64_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_256_COLORS: + case PACK_PNG_256_COLORS: + { + maskMethod = MASK_256_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_256_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_512_COLORS: + case PACK_PNG_512_COLORS: + { + maskMethod = MASK_512_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_512K_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_4K_COLORS: + case PACK_PNG_4K_COLORS: + { + maskMethod = MASK_4K_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_4K_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_32K_COLORS: + case PACK_PNG_32K_COLORS: + { + maskMethod = MASK_32K_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_32K_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_64K_COLORS: + case PACK_PNG_64K_COLORS: + { + maskMethod = MASK_64K_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_256K_COLORS: + case PACK_PNG_256K_COLORS: + { + maskMethod = MASK_256K_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_256K_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_2M_COLORS: + case PACK_PNG_2M_COLORS: + { + maskMethod = MASK_2M_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_2M_COLORS\n"); + #endif + + break; + } + case PACK_JPEG_16M_COLORS: + case PACK_PNG_16M_COLORS: + { + maskMethod = MASK_16M_COLORS; + + #ifdef DEBUG + fprintf(stderr, "******NXMaskImage: Method is MASK_16M_COLORS\n"); + #endif + + break; + } + default: + { + #ifdef PANIC + fprintf(stderr, "******NXMaskImage: PANIC! Cannot find mask method for pack method [%d]\n", + method); + #endif + + return; + } + } + + #ifdef TEST + fprintf(stderr, "******NXMaskImage: packMethod[%d] => maskMethod[%d]\n", + method, maskMethod); + #endif + + /* + * Get mask out of method and check if + * visual is supported by current color + * reduction algorithm. + */ + + mask = MethodColorMask(maskMethod); + + if (mask == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXMaskImage: PANIC! No mask to apply for pack method [%d].\n", + method); + #endif + + return; + } + else if (CanMaskImage(image, mask) == 0) + { + #ifdef PANIC + fprintf(stderr, "******NXMaskImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", + image -> format, image -> depth, image -> bits_per_pixel); + + fprintf(stderr, "******NXMaskImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", + image -> red_mask, image -> green_mask, image -> blue_mask); + #endif + + return; + } + + /* + * Calling ShouldMaskImage you get 0 in the case + * of MASK_256_COLORS and MASK_64K_COLORS, which + * means that the image should not be masked. + */ + + if (ShouldMaskImage(image, mask) == 0) + { + #ifdef TEST + fprintf(stderr, "******NXMaskImage: the image will not be masked\n"); + #endif + } + else + { + if (MaskInPlaceImage(mask, image) <= 0) + { + #ifdef PANIC + fprintf(stderr, "******NXMaskImage: PANIC! Failed to apply the color mask in place.\n"); + #endif + } + } +} + +/* + * The display parameter is ignored. + */ + +void NXInitCache(Display *dpy, int entries) +{ + if (NXImageCache != NULL && NXImageCacheSize == entries) + { + #ifdef DEBUG + fprintf(stderr, "******NXInitCache: Nothing to do with image cache at [%p] and [%d] entries.\n", + NXImageCache, NXImageCacheSize); + #endif + + return; + } + + #ifdef DEBUG + fprintf(stderr, "******NXInitCache: Initializing the cache with [%d] entries.\n", + entries); + #endif + + NXImageCacheSize = 0; + + if (NXImageCache != NULL) + { + Xfree(NXImageCache); + + NXImageCache = NULL; + } + + if (entries > 0) + { + NXImageCache = Xmalloc(entries * sizeof(_NXImageCacheEntry)); + + if (NXImageCache != NULL) + { + memset(NXImageCache, 0, entries * sizeof(_NXImageCacheEntry)); + + NXImageCacheSize = entries; + + #ifdef DEBUG + fprintf(stderr, "******NXInitCache: Image cache initialized with [%d] entries.\n", entries); + #endif + } + } +} + +#ifdef DUMP + +void _NXCacheDump(const char *label) +{ + char s[MD5_LENGTH * 2 + 1]; + + int i; + int j; + + #ifdef DEBUG + fprintf(stderr, "%s: Dumping the content of image cache:\n", label); + #endif + + for (i = 0; i < NXImageCacheSize; i++) + { + if (NXImageCache[i].image == NULL) + { + break; + } + + for (j = 0; j < MD5_LENGTH; j++) + { + sprintf(s + (j * 2), "%02X", ((unsigned char *) NXImageCache[i].md5)[j]); + } + + #ifdef DEBUG + fprintf(stderr, "%s: [%d][%s].\n", label, i, s); + #endif + } +} + +#endif + +XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigned char **md5) +{ + md5_state_t new_state; + md5_byte_t *new_md5; + unsigned int data_size, i; + + if (NXImageCache == NULL) + { + return NULL; + } + + /* + * Will return the allocated checksum + * if the image is not found. + */ + + *md5 = NULL; + + if ((new_md5 = Xmalloc(MD5_LENGTH)) == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCacheFindImage: Can't allocate memory for the checksum.\n"); + #endif + + return NULL; + } + + data_size = (src_image -> bytes_per_line * src_image -> height); + + md5_init(&new_state); + + md5_append(&new_state, (unsigned char *) &src_image -> width, sizeof(int)); + md5_append(&new_state, (unsigned char *) &src_image -> height, sizeof(int)); + + md5_append(&new_state, (unsigned char *) src_image -> data, data_size); + + md5_finish(&new_state, new_md5); + + for (i = 0; i < NXImageCacheSize; i++) + { + if (NXImageCache[i].image != NULL) + { + if (memcmp(NXImageCache[i].md5, new_md5, MD5_LENGTH) == 0) + { + _NXImageCacheEntry found; + + found.image = NXImageCache[i].image; + found.method = NXImageCache[i].method; + found.md5 = NXImageCache[i].md5; + + *method = found.method; + + NXImageCacheHits++; + + #ifdef DEBUG + fprintf(stderr, "******NXCacheFindImage: Found at position [%d] with hits [%d] and [%d] packs.\n", + i, NXImageCacheHits, NXImageCacheOps); + #endif + + Xfree(new_md5); + + /* + * Move the images down one slot, from + * the head of the list, and place the + * image just found at top. + */ + + if (i > 16) + { + #ifdef DEBUG + fprintf(stderr, "******NXCacheFindImage: Moving the image at the head of the list.\n"); + #endif + + memmove(&NXImageCache[1], &NXImageCache[0], (i * sizeof(_NXImageCacheEntry))); + + NXImageCache[0].image = found.image; + NXImageCache[0].method = found.method; + NXImageCache[0].md5 = found.md5; + + #ifdef DUMP + + _NXCacheDump("******NXCacheFindImage"); + + #endif + } + + /* + * Return the checksum and image + * structure allocated in cache. + */ + + *md5 = found.md5; + + return found.image; + } + } + else + { + break; + } + } + + *md5 = new_md5; + + return NULL; +} + +/* + * Add a packed image to the cache. A new image + * structure is allocated and copied, data and + * checksum are inherited from the passed image. + */ + +int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md5) +{ + unsigned int i; + + if (image == NULL || image -> data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCacheAddImage: PANIC! Invalid image passed to function.\n"); + #endif + + return -1; + } + + i = (NXImageCacheOps < NXImageCacheSize) ? NXImageCacheOps : NXImageCacheSize; + + if (NXImageCacheOps >= NXImageCacheSize) + { + #ifdef DEBUG + fprintf(stderr, "******NXCacheAddImage: Freeing up the oldest entry.\n"); + #endif + + i--; + + Xfree(NXImageCache[NXImageCacheSize - 1].image -> data); + Xfree(NXImageCache[NXImageCacheSize - 1].image); + Xfree(NXImageCache[NXImageCacheSize - 1].md5); + } + + if (i > 0) + { + memmove(&NXImageCache[1], &NXImageCache[0], i * sizeof(_NXImageCacheEntry)); + } + + NXImageCacheOps++; + + #ifdef DEBUG + fprintf(stderr, "******NXCacheAddImage: Going to add new image with data size [%d].\n", + image -> xoffset); + #endif + + NXImageCache[0].image = image; + NXImageCache[0].method = method; + NXImageCache[0].md5 = md5; + + #ifdef DUMP + + _NXCacheDump("******NXCacheAddImage"); + + #endif + + return 1; +} + +/* + * The display parameter is ignored. + */ + +void NXFreeCache(Display *dpy) +{ + int i; + + if (NXImageCache == NULL) + { + #ifdef DEBUG + fprintf(stderr, "******NXFreeCache: Nothing to do with a null image cache.\n"); + #endif + + return; + } + + #ifdef DEBUG + fprintf(stderr, "******NXFreeCache: Freeing the cache with [%d] entries.\n", + NXImageCacheSize); + #endif + + for (i = 0; i < NXImageCacheSize; i++) + { + if (NXImageCache[i].image != NULL) + { + if (NXImageCache[i].image -> data != NULL) + { + Xfree(NXImageCache[i].image -> data); + } + + Xfree(NXImageCache[i].image); + + NXImageCache[i].image = NULL; + } + + if (NXImageCache[i].md5 != NULL) + { + Xfree(NXImageCache[i].md5); + + NXImageCache[i].md5 = NULL; + } + } + + Xfree(NXImageCache); + + NXImageCache = NULL; + + NXImageCacheSize = 0; + NXImageCacheHits = 0; + NXImageCacheOps = 0; +} + +static void _NXNotifyImage(Display *dpy, int resource, Bool success) +{ + XEvent async_event; + + /* + * Enqueue an event to tell client + * the result of GetImage. + */ + + async_event.type = ClientMessage; + + async_event.xclient.serial = _NXCollectedImages[resource] -> sequence; + + async_event.xclient.window = 0; + async_event.xclient.message_type = 0; + async_event.xclient.format = 32; + + async_event.xclient.data.l[0] = NXCollectImageNotify; + async_event.xclient.data.l[1] = resource; + async_event.xclient.data.l[2] = success; + + XPutBackEvent(dpy, &async_event); +} + +static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, + int len, XPointer data) +{ + register _NXCollectImageState *state; + + register xGetImageReply *async_rep; + + char *async_head; + char *async_data; + + int async_size; + + state = (_NXCollectImageState *) data; + + if ((rep -> generic.sequenceNumber % 65536) != + ((int)(state -> sequence) % 65536)) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] for opcode [%d] " + "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, + (int) rep -> generic.length << 2); + #endif + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Going to handle asynchronous GetImage reply.\n"); + #endif + + /* + * As even reply data is managed asynchronously, + * we can use state to get to vector and vector + * to get to handler. In this way, we can safely + * dequeue and free the handler itself. + */ + + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + + state -> handler = NULL; + + if (rep -> generic.type == X_Error) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Error received from X server for resource [%d].\n", + state -> resource); + #endif + + _NXNotifyImage(dpy, state -> resource, False); + + _NXCollectedImages[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Matched request with sequence [%ld].\n", + state -> sequence); + #endif + + async_size = SIZEOF(xGetImageReply); + + async_head = Xmalloc(async_size); + + if (async_head == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyImage(dpy, state -> resource, False); + + _NXCollectedImages[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Going to get reply with size [%d].\n", + (int) rep -> generic.length << 2); + #endif + + async_rep = (xGetImageReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); + + if (async_rep == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to get reply with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyImage(dpy, state -> resource, False); + + _NXCollectedImages[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Got reply with depth [%d] visual [%d] size [%d].\n", + async_rep -> depth, (int) async_rep -> visual, (int) async_rep -> length << 2); + #endif + + async_size = async_rep -> length << 2; + + if (async_size > 0) + { + async_data = Xmalloc(async_size); + + if (async_data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyImage(dpy, state -> resource, False); + + _NXCollectedImages[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Going to get data with size [%d].\n", + async_size); + #endif + + _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetImageReply), async_size, async_size); + + /* + * From now on we can return True, as all + * data has been consumed from buffer. + */ + + if (state -> format == XYPixmap) + { + unsigned long depth = DepthOnes(state -> mask & (((unsigned long)0xFFFFFFFF) >> + (32 - async_rep -> depth))); + + state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), + depth, XYPixmap, 0, async_data, state -> width, + state -> height, dpy -> bitmap_pad, 0); + } + else + { + state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), + async_rep -> depth, ZPixmap, 0, async_data, state -> width, + state -> height, _XGetScanlinePad(dpy, async_rep -> depth), 0); + } + + if (state -> image == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to create image for resource [%d].\n", + state -> resource); + #endif + + _NXNotifyImage(dpy, state -> resource, False); + + _NXCollectedImages[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + Xfree(async_data); + + return True; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectImageHandler: Successfully stored image data for resource [%d].\n", + state -> resource); + #endif + } + #ifdef WARNING + else + { + fprintf(stderr, "******_NXCollectImageHandler: WARNING! Null image data stored for resource [%d].\n", + state -> resource); + } + #endif + + _NXNotifyImage(dpy, state -> resource, True); + + Xfree(async_head); + + return True; +} + +int NXGetCollectImageResource(Display *dpy) +{ + int i; + + for (i = 0; i < NXNumberOfResources; i++) + { + if (_NXCollectedImages[i] == NULL) + { + return i; + } + } + + return -1; +} + +int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable, + int src_x, int src_y, unsigned int width, unsigned int height, + unsigned long plane_mask, int format) +{ + register xGetImageReq *req; + + _NXCollectImageState *state; + _XAsyncHandler *handler; + + if (resource >= NXNumberOfResources) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectImage: PANIC! Provided resource [%u] is out of range.\n", + resource); + #endif + + return -1; + } + + state = _NXCollectedImages[resource]; + + if (state != NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectImage: PANIC! Having to remove previous state for resource [%u].\n", + resource); + #endif + + if (state -> handler != NULL) + { + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + } + + if (state -> image != NULL) + { + XDestroyImage(state -> image); + } + + Xfree(state); + + _NXCollectedImages[resource] = NULL; + } + + LockDisplay(dpy); + + GetReq(GetImage, req); + + req -> format = format; + req -> drawable = drawable; + req -> x = src_x; + req -> y = src_y; + req -> width = width; + req -> height = height; + req -> planeMask = plane_mask; + + #ifdef TEST + fprintf(stderr, "******NXCollectImage: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", + X_GetImage, dpy -> request, resource); + + fprintf(stderr, "******NXCollectImage: Format [%d] drawable [%d] src_x [%d] src_y [%d].\n", + req -> format, (int) req -> drawable, req -> x, req -> y); + + fprintf(stderr, "******NXCollectImage: Width [%d] height [%d] plane_mask [%x].\n", + req -> width, req -> height, (int) req -> planeMask); + #endif + + state = Xmalloc(sizeof(_NXCollectImageState)); + handler = Xmalloc(sizeof(_XAsyncHandler)); + + if (state == NULL || handler == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectImage: PANIC! Failed to allocate memory with resource [%d].\n", + resource); + #endif + + UnGetReq(GetImage); + + if (state != NULL) + { + Xfree(state); + } + + if (handler != NULL) + { + Xfree(handler); + } + + UnlockDisplay(dpy); + + return -1; + } + + state -> sequence = dpy -> request; + state -> resource = resource; + state -> mask = plane_mask; + state -> format = format; + state -> width = width; + state -> height = height; + state -> image = NULL; + + state -> handler = handler; + + handler -> next = dpy -> async_handlers; + handler -> handler = _NXCollectImageHandler; + handler -> data = (XPointer) state; + dpy -> async_handlers = handler; + + _NXCollectedImages[resource] = state; + + UnlockDisplay(dpy); + + SyncHandle(); + + return 1; +} + +int NXGetCollectedImage(Display *dpy, unsigned int resource, XImage **image) +{ + register _NXCollectImageState *state; + + state = _NXCollectedImages[resource]; + + if (state == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXGetCollectedImage: PANIC! No image collected for resource [%u].\n", + resource); + #endif + + return 0; + } + + _NXCollectedImages[resource] = NULL; + + *image = state -> image; + + Xfree(state); + + #ifdef TEST + fprintf(stderr, "******NXGetCollectedImage: Returning GetImage data for resource [%u].\n", + resource); + #endif + + return 1; +} + +static void _NXNotifyProperty(Display *dpy, int resource, Bool success) +{ + XEvent async_event; + + /* + * Enqueue an event to tell client + * the result of GetProperty. + */ + + async_event.type = ClientMessage; + + async_event.xclient.serial = _NXCollectedProperties[resource] -> sequence; + + async_event.xclient.window = 0; + async_event.xclient.message_type = 0; + async_event.xclient.format = 32; + + async_event.xclient.data.l[0] = NXCollectPropertyNotify; + async_event.xclient.data.l[1] = resource; + async_event.xclient.data.l[2] = success; + + XPutBackEvent(dpy, &async_event); +} + +static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, + int len, XPointer data) +{ + register _NXCollectPropertyState *state; + + register xGetPropertyReply *async_rep; + + char *async_head; + char *async_data; + + int async_size; + + state = (_NXCollectPropertyState *) data; + + if ((rep -> generic.sequenceNumber % 65536) != + ((int)(state -> sequence) % 65536)) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] for opcode [%d] " + "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, + (int) rep -> generic.length << 2); + #endif + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Going to handle asynchronous GetProperty reply.\n"); + #endif + + /* + * Reply data is managed asynchronously. We can + * use state to get to vector and vector to get + * to handler. In this way, we can dequeue and + * free the handler itself. + */ + + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + + state -> handler = NULL; + + if (rep -> generic.type == X_Error) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Error received from X server for resource [%d].\n", + state -> resource); + #endif + + _NXNotifyProperty(dpy, state -> resource, False); + + _NXCollectedProperties[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Matched request with sequence [%ld].\n", + state -> sequence); + #endif + + async_size = SIZEOF(xGetPropertyReply); + + async_head = Xmalloc(async_size); + + if (async_head == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyProperty(dpy, state -> resource, False); + + _NXCollectedProperties[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Going to get reply with size [%d].\n", + (int) rep -> generic.length << 2); + #endif + + async_rep = (xGetPropertyReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); + + if (async_rep == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to get reply with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyProperty(dpy, state -> resource, False); + + _NXCollectedProperties[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Got reply with format [%d] type [%d] size [%d].\n", + async_rep -> format, (int) async_rep -> propertyType, (int) async_rep -> length << 2); + + fprintf(stderr, "******_NXCollectPropertyHandler: Bytes after [%d] number of items [%d].\n", + (int) async_rep -> bytesAfter, (int) async_rep -> nItems); + #endif + + state -> format = async_rep -> format; + state -> type = async_rep -> propertyType; + state -> items = async_rep -> nItems; + state -> after = async_rep -> bytesAfter; + + async_size = async_rep -> length << 2; + + if (async_size > 0) + { + async_data = Xmalloc(async_size); + + if (async_data == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyProperty(dpy, state -> resource, False); + + _NXCollectedProperties[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Going to get data with size [%d].\n", + async_size); + #endif + + _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetPropertyReply), async_size, async_size); + + /* + * From now on we can return True, as all + * data has been consumed from buffer. + */ + + state -> data = async_data; + + #ifdef TEST + fprintf(stderr, "******_NXCollectPropertyHandler: Successfully stored property data for resource [%d].\n", + state -> resource); + #endif + } + #ifdef TEST + else + { + fprintf(stderr, "******_NXCollectPropertyHandler: WARNING! Null property data stored for resource [%d].\n", + state -> resource); + } + #endif + + _NXNotifyProperty(dpy, state -> resource, True); + + Xfree(async_head); + + return True; +} + +int NXGetCollectPropertyResource(Display *dpy) +{ + int i; + + for (i = 0; i < NXNumberOfResources; i++) + { + if (_NXCollectedProperties[i] == NULL) + { + return i; + } + } + + return -1; +} + +int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom property, + long long_offset, long long_length, Bool delete, Atom req_type) +{ + register xGetPropertyReq *req; + + _NXCollectPropertyState *state; + _XAsyncHandler *handler; + + if (resource >= NXNumberOfResources) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectProperty: PANIC! Provided resource [%u] is out of range.\n", + resource); + #endif + + return -1; + } + + state = _NXCollectedProperties[resource]; + + if (state != NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectProperty: PANIC! Having to remove previous state for resource [%u].\n", + resource); + #endif + + if (state -> handler != NULL) + { + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + } + + if (state -> data != NULL) + { + Xfree(state -> data); + } + + Xfree(state); + + _NXCollectedProperties[resource] = NULL; + } + + LockDisplay(dpy); + + GetReq(GetProperty, req); + + req -> delete = delete; + req -> window = window; + req -> property = property; + req -> type = req_type; + req -> longOffset = long_offset; + req -> longLength = long_length; + + #ifdef TEST + fprintf(stderr, "******NXCollectProperty: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", + X_GetProperty, dpy -> request, resource); + + fprintf(stderr, "******NXCollectProperty: Delete [%u] window [%d] property [%d] type [%d].\n", + req -> delete, (int) req -> window, (int) req -> property, (int) req -> type); + + fprintf(stderr, "******NXCollectProperty: Long offset [%d] long length [%d].\n", + (int) req -> longOffset, (int) req -> longLength); + #endif + + state = Xmalloc(sizeof(_NXCollectPropertyState)); + handler = Xmalloc(sizeof(_XAsyncHandler)); + + if (state == NULL || handler == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectProperty: Failed to allocate memory with resource [%d].\n", + resource); + #endif + + if (state != NULL) + { + Xfree(state); + } + + if (handler != NULL) + { + Xfree(handler); + } + + UnGetReq(GetProperty); + + UnlockDisplay(dpy); + + return -1; + } + + state -> sequence = dpy -> request; + state -> resource = resource; + state -> window = window; + state -> property = property; + state -> type = 0; + state -> format = 0; + state -> items = 0; + state -> after = 0; + state -> data = NULL; + + state -> handler = handler; + + handler -> next = dpy -> async_handlers; + handler -> handler = _NXCollectPropertyHandler; + handler -> data = (XPointer) state; + dpy -> async_handlers = handler; + + _NXCollectedProperties[resource] = state; + + UnlockDisplay(dpy); + + SyncHandle(); + + return True; +} + +int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_type_return, + int *actual_format_return, unsigned long *nitems_return, + unsigned long *bytes_after_return, unsigned char **data) +{ + register _NXCollectPropertyState *state; + + state = _NXCollectedProperties[resource]; + + if (state == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXGetCollectedProperty: PANIC! No data collected for resource [%u].\n", + resource); + #endif + + return 0; + } + + *actual_type_return = state -> type; + *actual_format_return = state -> format; + *nitems_return = state -> items; + *bytes_after_return = state -> after; + + *data = (unsigned char *) _NXCollectedProperties[resource] -> data; + + Xfree(state); + + _NXCollectedProperties[resource] = NULL; + + #ifdef TEST + fprintf(stderr, "******NXGetCollectedProperty: Returning GetProperty data for resource [%u].\n", + resource); + #endif + + return True; +} + +static void _NXNotifyGrabPointer(Display *dpy, int resource, Bool success) +{ + XEvent async_event; + + async_event.type = ClientMessage; + + async_event.xclient.serial = _NXCollectedGrabPointers[resource] -> sequence; + + async_event.xclient.window = 0; + async_event.xclient.message_type = 0; + async_event.xclient.format = 32; + + async_event.xclient.data.l[0] = NXCollectGrabPointerNotify; + async_event.xclient.data.l[1] = resource; + async_event.xclient.data.l[2] = success; + + XPutBackEvent(dpy, &async_event); +} + +static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, + int len, XPointer data) +{ + register _NXCollectGrabPointerState *state; + + register xGrabPointerReply *async_rep; + + char *async_head; + + int async_size; + + state = (_NXCollectGrabPointerState *) data; + + if ((rep -> generic.sequenceNumber % 65536) != + ((int)(state -> sequence) % 65536)) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] for opcode [%d] " + "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, + (int) rep -> generic.length << 2); + #endif + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to handle asynchronous GrabPointer reply.\n"); + #endif + + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + + state -> handler = NULL; + + if (rep -> generic.type == X_Error) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectGrabPointerHandler: Error received from X server for resource [%d].\n", + state -> resource); + #endif + + _NXNotifyGrabPointer(dpy, state -> resource, False); + + _NXCollectedGrabPointers[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectGrabPointerHandler: Matched request with sequence [%ld].\n", + state -> sequence); + #endif + + async_size = SIZEOF(xGrabPointerReply); + + async_head = Xmalloc(async_size); + + if (async_head == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to allocate memory with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyGrabPointer(dpy, state -> resource, False); + + _NXCollectedGrabPointers[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to get reply with size [%d].\n", + (int) rep -> generic.length << 2); + #endif + + async_rep = (xGrabPointerReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); + + if (async_rep == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to get reply with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyGrabPointer(dpy, state -> resource, False); + + _NXCollectedGrabPointers[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectGrabPointerHandler: Got reply with status [%d] size [%d].\n", + async_rep -> status, (int) async_rep -> length << 2); + #endif + + state -> status = async_rep -> status; + + _NXNotifyGrabPointer(dpy, state -> resource, True); + + Xfree(async_head); + + return True; +} + +int NXGetCollectGrabPointerResource(Display *dpy) +{ + int i; + + for (i = 0; i < NXNumberOfResources; i++) + { + if (_NXCollectedGrabPointers[i] == NULL) + { + return i; + } + } + + return -1; +} + +int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window, Bool owner_events, + unsigned int event_mask, int pointer_mode, int keyboard_mode, + Window confine_to, Cursor cursor, Time time) +{ + register xGrabPointerReq *req; + + _NXCollectGrabPointerState *state; + _XAsyncHandler *handler; + + if (resource >= NXNumberOfResources) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectGrabPointer: PANIC! Provided resource [%u] is out of range.\n", + resource); + #endif + + return -1; + } + + state = _NXCollectedGrabPointers[resource]; + + if (state != NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectGrabPointer: PANIC! Having to remove previous state for resource [%u].\n", + resource); + #endif + + if (state -> handler != NULL) + { + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + } + + Xfree(state); + + _NXCollectedGrabPointers[resource] = NULL; + } + + LockDisplay(dpy); + + GetReq(GrabPointer, req); + + req -> grabWindow = grab_window; + req -> ownerEvents = owner_events; + req -> eventMask = event_mask; + req -> pointerMode = pointer_mode; + req -> keyboardMode = keyboard_mode; + req -> confineTo = confine_to; + req -> cursor = cursor; + req -> time = time; + + #ifdef TEST + fprintf(stderr, "******NXCollectGrabPointer: Sending message opcode [%d] sequence [%ld] " + "for resource [%d].\n", X_GrabPointer, dpy -> request, resource); + #endif + + state = Xmalloc(sizeof(_NXCollectGrabPointerState)); + handler = Xmalloc(sizeof(_XAsyncHandler)); + + if (state == NULL || handler == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectGrabPointer: Failed to allocate memory with resource [%d].\n", + resource); + #endif + + if (state != NULL) + { + Xfree(state); + } + + if (handler != NULL) + { + Xfree(handler); + } + + UnGetReq(GrabPointer); + + UnlockDisplay(dpy); + + return -1; + } + + state -> sequence = dpy -> request; + state -> resource = resource; + state -> status = 0; + + state -> handler = handler; + + handler -> next = dpy -> async_handlers; + handler -> handler = _NXCollectGrabPointerHandler; + handler -> data = (XPointer) state; + dpy -> async_handlers = handler; + + _NXCollectedGrabPointers[resource] = state; + + UnlockDisplay(dpy); + + SyncHandle(); + + return True; +} + +int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status) +{ + register _NXCollectGrabPointerState *state; + + state = _NXCollectedGrabPointers[resource]; + + if (state == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXGetCollectedGrabPointer: PANIC! No data collected for resource [%u].\n", + resource); + #endif + + return 0; + } + + *status = state -> status; + + Xfree(state); + + _NXCollectedGrabPointers[resource] = NULL; + + #ifdef TEST + fprintf(stderr, "******NXGetCollectedGrabPointer: Returning GrabPointer data for resource [%u].\n", + resource); + #endif + + return True; +} + +static void _NXNotifyInputFocus(Display *dpy, int resource, Bool success) +{ + XEvent async_event; + + async_event.type = ClientMessage; + + async_event.xclient.serial = _NXCollectedInputFocuses[resource] -> sequence; + + async_event.xclient.window = 0; + async_event.xclient.message_type = 0; + async_event.xclient.format = 32; + + async_event.xclient.data.l[0] = NXCollectInputFocusNotify; + async_event.xclient.data.l[1] = resource; + async_event.xclient.data.l[2] = success; + + XPutBackEvent(dpy, &async_event); +} + +static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, + int len, XPointer data) +{ + register _NXCollectInputFocusState *state; + + register xGetInputFocusReply *async_rep; + + char *async_head; + + int async_size; + + state = (_NXCollectInputFocusState *) data; + + if ((rep -> generic.sequenceNumber % 65536) != + ((int)(state -> sequence) % 65536)) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] for opcode [%d] " + "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, + (int) rep -> generic.length << 2); + #endif + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectInputFocusHandler: Going to handle asynchronous GetInputFocus reply.\n"); + #endif + + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + + state -> handler = NULL; + + if (rep -> generic.type == X_Error) + { + #ifdef TEST + fprintf(stderr, "******_NXCollectInputFocusHandler: Error received from X server for resource [%d].\n", + state -> resource); + #endif + + _NXNotifyInputFocus(dpy, state -> resource, False); + + _NXCollectedInputFocuses[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectInputFocusHandler: Matched request with sequence [%ld].\n", + state -> sequence); + #endif + + async_size = SIZEOF(xGetInputFocusReply); + + async_head = Xmalloc(async_size); + + if (async_head == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to allocate memory with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyInputFocus(dpy, state -> resource, False); + + _NXCollectedInputFocuses[state -> resource] = NULL; + + Xfree(state); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectInputFocusHandler: Going to get reply with size [%d].\n", + (int) rep -> generic.length << 2); + #endif + + async_rep = (xGetInputFocusReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); + + if (async_rep == NULL) + { + #ifdef PANIC + fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to get reply with resource [%d].\n", + state -> resource); + #endif + + _NXNotifyInputFocus(dpy, state -> resource, False); + + _NXCollectedInputFocuses[state -> resource] = NULL; + + Xfree(state); + + Xfree(async_head); + + return False; + } + + #ifdef TEST + fprintf(stderr, "******_NXCollectInputFocusHandler: Got reply with focus [%d] revert to [%d] " + "size [%d].\n", (int) async_rep -> focus, (int) async_rep -> revertTo, + (int) async_rep -> length << 2); + #endif + + state -> focus = async_rep -> focus; + state -> revert_to = async_rep -> revertTo; + + _NXNotifyInputFocus(dpy, state -> resource, True); + + Xfree(async_head); + + return True; +} + +int NXGetCollectInputFocusResource(Display *dpy) +{ + int i; + + for (i = 0; i < NXNumberOfResources; i++) + { + if (_NXCollectedInputFocuses[i] == NULL) + { + return i; + } + } + + return -1; +} + +int NXCollectInputFocus(Display *dpy, unsigned int resource) +{ + register xReq *req; + + _NXCollectInputFocusState *state; + _XAsyncHandler *handler; + + if (resource >= NXNumberOfResources) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectInputFocus: PANIC! Provided resource [%u] is out of range.\n", + resource); + #endif + + return -1; + } + + state = _NXCollectedInputFocuses[resource]; + + if (state != NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectInputFocus: PANIC! Having to remove previous state for resource [%u].\n", + resource); + #endif + + if (state -> handler != NULL) + { + DeqAsyncHandler(dpy, state -> handler); + + Xfree(state -> handler); + } + + Xfree(state); + + _NXCollectedInputFocuses[resource] = NULL; + } + + LockDisplay(dpy); + + GetEmptyReq(GetInputFocus, req); + + #ifdef TEST + fprintf(stderr, "******NXCollectInputFocus: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", + X_GetInputFocus, dpy -> request, resource); + #endif + + state = Xmalloc(sizeof(_NXCollectInputFocusState)); + handler = Xmalloc(sizeof(_XAsyncHandler)); + + if (state == NULL || handler == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXCollectInputFocus: Failed to allocate memory with resource [%d].\n", + resource); + #endif + + if (state != NULL) + { + Xfree(state); + } + + if (handler != NULL) + { + Xfree(handler); + } + + UnGetEmptyReq(); + + UnlockDisplay(dpy); + + return -1; + } + + state -> sequence = dpy -> request; + state -> resource = resource; + state -> focus = 0; + state -> revert_to = 0; + + state -> handler = handler; + + handler -> next = dpy -> async_handlers; + handler -> handler = _NXCollectInputFocusHandler; + handler -> data = (XPointer) state; + dpy -> async_handlers = handler; + + _NXCollectedInputFocuses[resource] = state; + + UnlockDisplay(dpy); + + SyncHandle(); + + return True; +} + +int NXGetCollectedInputFocus(Display *dpy, unsigned int resource, + Window *focus_return, int *revert_to_return) +{ + register _NXCollectInputFocusState *state; + + state = _NXCollectedInputFocuses[resource]; + + if (state == NULL) + { + #ifdef PANIC + fprintf(stderr, "******NXGetCollectedInputFocus: PANIC! No data collected for resource [%u].\n", + resource); + #endif + + return 0; + } + + *focus_return = state -> focus; + *revert_to_return = state -> revert_to; + + Xfree(state); + + _NXCollectedInputFocuses[resource] = NULL; + + #ifdef TEST + fprintf(stderr, "******NXGetCollectedInputFocus: Returning GetInputFocus data for resource [%u].\n", + resource); + #endif + + return True; +} + +#ifdef DUMP + +void _NXDumpData(const unsigned char *buffer, unsigned int size) +{ + if (buffer != NULL) + { + unsigned int i = 0; + + unsigned int ii; + + while (i < size) + { + fprintf(stderr, "[%d]\t", i); + + for (ii = 0; i < size && ii < 8; i++, ii++) + { + fprintf(stderr, "%d\t", (unsigned int) (buffer[i])); + } + + fprintf(stderr, "\n"); + } + } +} + +#endif diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.h new file mode 100644 index 000000000..ecd7d1e18 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Compext.h @@ -0,0 +1,912 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXlib_H +#define NXlib_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include + +#include +#include +#include +#include + +/* + * All the NX code should use these. + */ + +#define Xmalloc(size) malloc((size)) +#define Xfree(ptr) free((ptr)) + +/* + * Maximum number of supported pack methods. + */ + +#define NXNumberOfPackMethods 128 + +/* + * Assume this as the limit of resources that + * can be provided to the split and unpack + * requests. + */ + +#define NXNumberOfResources 256 + +#define NXNoResource 256 + 1 +#define NXAnyResource 256 + 2 + +/* + * Initialize the internal structures used by + * the library. Should be executed again after + * having reopened the display. + */ + +extern int NXInitDisplay( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Reset all the internal structures. Should be + * executed after closing the display. + */ + +extern int NXResetDisplay( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Set the NX display flush policy. The policy can + * be either NXFlushDeferred or NXFlushImmediate. + */ + +extern int NXSetDisplayPolicy( +#if NeedFunctionPrototypes + Display* /* display */, + int /* policy */ +#endif +); + +/* + * Set the display output buffer size. + */ + +extern int NXSetDisplayBuffer( +#if NeedFunctionPrototypes + Display* /* display */, + int /* size */ +#endif +); + +/* + * If set, the Popen() function in the X server + * wil remove the LD_LIBRARY_PATH variable from + * the environment before calling the execl() + * function on the child process. The function + * returns the previous value. + */ + +extern int NXUnsetLibraryPath( +#if NeedFunctionPrototypes + int /* value */ +#endif +); + +/* + * If the parameter is true, the Xlib I/O error + * handler will return, instead of quitting the + * program. The function returns the previous + * value. + */ + +extern int NXHandleDisplayError( +#if NeedFunctionPrototypes + int /* value */ +#endif +); + +/* + * Shutdown the display descriptor and force Xlib + * to set the I/O error flag. + */ + +extern Bool NXForceDisplayError( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Check the value of the XlibDisplayIOError flag. + * If not set, try to call the display error hand- + * ler to give to the application a chance to see + * whether it needs to close the connection. + */ + +extern int NXDisplayError( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Query the number of bytes readable from the + * display connection. + */ + +extern int NXDisplayReadable( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Query the number of the outstanding bytes to + * flush to the display connection. + */ + +extern int NXDisplayFlushable( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Return a value between 0 and 9 indicating the + * congestion level of the NX transport based on + * the tokens remaining. A value of 9 means that + * the link is congested and no further data can + * be sent. + */ + +extern int NXDisplayCongestion( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +/* + * Flush the Xlib display buffer and/or the + * outstanding data accumulated by the NX + * transport. + */ + +extern int NXFlushDisplay( +#if NeedFunctionPrototypes + Display* /* display */, + int /* what */ +#endif +); + +/* + * Public interfaces used to set the handlers. + * They all return the previous handler. + */ + +extern NXDisplayErrorPredicate NXSetDisplayErrorPredicate( +#if NeedFunctionPrototypes + NXDisplayErrorPredicate /* predicate */ +#endif +); + +/* + * Called when the display blocks waiting to read or + * write more data. + */ + +extern NXDisplayBlockHandler NXSetDisplayBlockHandler( +#if NeedFunctionPrototypes + NXDisplayBlockHandler /* handler */ +#endif +); + +/* + * Called after more data is written to the display. + * When the NX transport is running, data may be queued + * until an explicit flush. + */ + +extern NXDisplayWriteHandler NXSetDisplayWriteHandler( +#if NeedFunctionPrototypes + NXDisplayWriteHandler /* handler */ +#endif +); + +/* + * Called after more data is sent to the remote proxy. + * + * Here the display pointer is passed as the second + * parameter to make clear that the function does not + * tie the callback to the display, but, similarly to + * all the Xlib error handlers, to a global variable + * shared by all the Xlib functions. The display + * pointer will be passed back by nxcomp at the time + * it will call the handler. This is because nxcomp + * doesn't have access to the display structure. + */ + +extern NXDisplayFlushHandler NXSetDisplayFlushHandler( +#if NeedFunctionPrototypes + NXDisplayFlushHandler /* handler */, + Display* /* display */ +#endif +); + +/* + * Get an arbitrary null terminated buffer to be added + * to the NX statistics. + */ + +extern NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler( +#if NeedFunctionPrototypes + NXDisplayStatisticsHandler /* handler */, + char ** /* buffer */ +#endif +); + +/* + * Redefine the function called by Xlib in the case of + * an out-of-order sequence number received in the X + * protocol stream. + */ + +extern NXLostSequenceHandler NXSetLostSequenceHandler( +#if NeedFunctionPrototypes + NXLostSequenceHandler /* handler */ +#endif +); + +/* + * The agent should get the NX parameters at startup, just after + * having opened the display. If the agent is not able to satisfy + * the pack method set by user (because a method is not applica- + * ble, it is not supported by the remote or it simply requires a + * screen depth greater than the depth available), it should fall + * back to the nearest method of the same type. + */ + +extern Status NXGetControlParameters( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int* /* link_type */, + unsigned int* /* local_major */, + unsigned int* /* local_minor */, + unsigned int* /* local_patch */, + unsigned int* /* remote_major */, + unsigned int* /* remote_minor */, + unsigned int* /* remote_patch */, + int* /* frame_timeout */, + int* /* ping_timeout */, + int* /* split_mode */, + int* /* split_size */, + unsigned int* /* pack_method */, + unsigned int* /* pack_quality */, + int* /* data_level */, + int* /* stream_level */, + int* /* delta_level */, + unsigned int* /* load_cache */, + unsigned int* /* save_cache */, + unsigned int* /* startup_cache */ +#endif +); + +/* + * Which unpack methods are supported by the remote proxy? + */ + +extern Status NXGetUnpackParameters( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int* /* entries */, + unsigned char[] /* supported_methods */ +#endif +); + +/* + * Query and enable shared memory support on path agent to X + * client proxy and X server proxy to real X server. At the + * moment only the path proxy to real X server is implemented. + * On return flags will say if support has been successfully + * activated. Segments will contain the XID associated to the + * shared memory blocks. A MIT-SHM compliant protocol is used + * between proxy and the real server, while a simplified + * version is used between the agent and the client proxy to + * accomodate both packed images and plain X bitmaps. + */ + +extern Status NXGetShmemParameters( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int* /* enable_client */, + unsigned int* /* enable_server */, + unsigned int* /* client_segment */, + unsigned int* /* server_segment */, + unsigned int* /* client_size */, + unsigned int* /* server_size */ +#endif +); + +/* + * Get the path to the font server that can be used by the X + * server to tunnel the font connections across the NX link. + * The path actually represents the TCP port where the proxy + * on the NX client side is listening. The agent can tempora- + * rily enable the tunneling when it needs a font that is not + * available on the client, for example when the session is + * migrated from a different X server. + */ + +extern Status NXGetFontParameters( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* path_length */, + char[] /* path_data */ +#endif +); + +/* + * This set of functions is used to leverage the image stream- + * ing capabilities built in nxcomp. An image can be streamed + * by sending a start-split message, followed by the X messages + * that will have to be split by the proxy, followed by an end- + * split closure. Usually, in the middle of a start-split/end- + * split sequence there will be a single PutImage() or PutPack- + * edImage(), that, in turn, can generate multiple partial + * requests, like a SetUnpackColormap() and SetUnpackAlpha() + * that will be later used to decompress the image to its ori- + * ginal form. Multiple requests may be also generated because + * of the maximum size of a X request being exceeded, so that + * Xlib has to divide the single image in multiple sub-image re- + * quests. The agent doesn't need to take care of these details + * but will rather have to track the result of the split opera- + * tion. By monitoring the notify events sent by the proxy, the + * agent will have to implement its own strategy to deal with + * the resources. For example, it will be able to: + * + * - Mark a drawable as dirty, if the image was not sent + * synchronously, in the main X oputput stream. + * + * - Choose to commit or discard the original image, at the + * time it will be recomposed at the remote side. This may + * include all the messages that were part of the split + * (the colormap, the alpha channel, etc.) + * + * - Mark the drawable as clean again, if the image was + * committed and the drawable didn't change in the mean- + * while. + * + * At the time the proxy receives the end-split, it reports the + * result of the operation to the agent. The agent will be able + * to identify the original split operation (the one referenced + * in the start-split/end-split sequence) by the small integer + * number (0-255) named 'resource' sent in the events. + * + * One of the following cases may be encountered: + * + * + * NXNoSplitNotify All messages were sent in the main out- + * put stream, so that no split actually + * took place. + * + * NXStartSplitNotify One or more messages were split, so, + * at discrection of the agent, the client + * may be suspended until the transferral + * is completed. + * + * NXCommitSplitNotify One of the requests that made up the + * split was recomposed. The agent should + * either commit the given request or tell + * the proxy to discard it. + * + * NXEndSplitNotify The split was duly completed. The agent + * can restart the client. + * + * NXEmptySplitNotify No more split operation are pending. + * The agent can use this information to + * implement specific strategies requiring + * that all messages have been recomposed + * at the remote end, like updating the + * drawables that were not synchronized + * because of the lazy encoding. + * + * The 'mode' field that is sent by the agent in the start-split + * request, determines the strategy that the proxy will adopt to + * deal with the image. If set to 'eager', the proxy will only + * split the messages whose size exceeds the split threshold (the + * current threshold can be found in the NXGetControlParameters() + * reply). If the mode is set to lazy, the proxy will split any + * image that would have generated an actual transfer of the data + * part (in practice all images that are not found in the cache). + * This second strategy can be leveraged by an agent to further + * reduce the bandwidth requirements. For example, by setting the + * mode to lazy and by monitoring the result, an agent can easi- + * ly verify if the drawable was successfully updated, mark the + * drawable if not, and synchronize it at later time. + * + * See NXproto.h for the definition of the available modes. + */ + +extern unsigned int NXAllocSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXStartSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + unsigned int /* mode */ +#endif +); + +extern int NXEndSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXCommitSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + unsigned int /* propagate */, + unsigned char /* request */, + unsigned int /* position */ +#endif +); + +extern int NXAbortSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXFinishSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXFreeSplit( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXSetExposeParameters( +#if NeedFunctionPrototypes + Display* /* display */, + int /* expose */, + int /* graphics_expose */, + int /* no_expose */ +#endif +); + +extern int NXSetCacheParameters( +#if NeedFunctionPrototypes + Display* /* display */, + int /* enable_cache */, + int /* enable_split */, + int /* enable_save */, + int /* enable_load */ +#endif +); + +extern unsigned int NXAllocUnpack( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXSetUnpackGeometry( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Visual* /* visual */ +#endif +); + +extern int NXSetUnpackColormap( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + unsigned int /* method */, + unsigned int /* entries */, + const char* /* data */, + unsigned int /* data_length */ +#endif +); + +extern int NXSetUnpackAlpha( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + unsigned int /* method */, + unsigned int /* entries */, + const char* /* data */, + unsigned int /* data_length */ +#endif +); + +extern int NXSetUnpackColormapCompat( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + unsigned int /* entries */, + const char* /* data */ +#endif +); + +extern int NXSetUnpackAlphaCompat( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + unsigned int /* entries */, + const char* /* data */ +#endif +); + +extern int NXFreeUnpack( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +/* + * A packed image is a XImage but with + * offset field containing total amount + * of packed image data. + */ + +typedef XImage NXPackedImage; + +NXPackedImage *NXCreatePackedImage( +#if NeedFunctionPrototypes + Display* /* display */, + Visual* /* visual */, + unsigned int /* method */, + unsigned int /* depth */, + int /* format */, + char* /* data */, + int /* data_length */, + unsigned int /* width */, + unsigned int /* height */, + int /* bitmap_pad */, + int /* bytes_per_line */ +#endif +); + +extern int NXDestroyPackedImage( +#if NeedFunctionPrototypes + NXPackedImage* /* image */ +#endif +); + +NXPackedImage *NXPackImage( +#if NeedFunctionPrototypes + Display* /* display */, + XImage* /* src_image */, + unsigned int /* method */ +#endif +); + +NXPackedImage *NXInPlacePackImage( +#if NeedFunctionPrototypes + Display* /* display */, + XImage* /* src_image */, + unsigned int /* method */ +#endif +); + +/* + * GC is declared void * to get rid of mess + * with different GC definitions in some X + * server code (like in nxagent). + */ + +extern int NXPutPackedImage( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Drawable /* drawable */, + void* /* gc */, + NXPackedImage* /* image */, + unsigned int /* method */, + unsigned int /* depth */, + int /* src_x */, + int /* src_y */, + int /* dst_x */, + int /* dst_y */, + unsigned int /* width */, + unsigned int /* height */ +#endif +); + +/* + * Get multiple colors with a single call by + * pipelining X_AllocColor requests/replies. + */ + +extern int NXAllocColors( +#if NeedFunctionPrototypes + Display* /* display */, + Colormap /* colormap */, + unsigned int /* entries */, + XColor[] /* screens_in_out */, + Bool [] /* flags allocation errors */ +#endif +); + +/* + * Encode the data in the given format. + */ + +extern char *NXEncodeColormap( +#if NeedFunctionPrototypes + const char* /* src_data */, + unsigned int /* src_size */, + unsigned int* /* dst_size */ +#endif +); + +extern char *NXEncodeAlpha( +#if NeedFunctionPrototypes + const char* /* src_data */, + unsigned int /* src_size */, + unsigned int* /* dst_size */ +#endif +); + +extern NXPackedImage *NXEncodeRgb( +#if NeedFunctionPrototypes + XImage* /* src_image */, + unsigned int /* method */, + unsigned int /* quality */ +#endif +); + +extern NXPackedImage *NXEncodeRle( +#if NeedFunctionPrototypes + XImage* /* src_image */, + unsigned int /* method */, + unsigned int /* quality */ +#endif +); + +extern NXPackedImage *NXEncodeJpeg( +#if NeedFunctionPrototypes + XImage* /* src_image */, + unsigned int /* method */, + unsigned int /* quality */ +#endif +); + +typedef struct +{ + long pixel; + int found; + +} NXColorTable; + +extern int NXEncodeColors( +#if NeedFunctionPrototypes + XImage* /* src_image */, + NXColorTable* /* color_table */, + int /* nb_max */ +#endif +); + +extern NXPackedImage *NXEncodePng( +#if NeedFunctionPrototypes + XImage* /* src_image */, + unsigned int /* method */, + unsigned int /* quality */ +#endif +); + +extern NXPackedImage *NXEncodeBitmap( +#if NeedFunctionPrototypes + XImage* /* src_image */, + unsigned int /* method */, + unsigned int /* quality */ +#endif +); + +extern int NXCleanImage( +#if NeedFunctionPrototypes + XImage* +#endif +); + +extern void NXMaskImage( +#if NeedFunctionPrototypes + XImage* /* pointer to image to mask */ , + unsigned int /* method */ +#endif +); + +extern int NXImageCacheSize; + +extern void NXInitCache( +#if NeedFunctionPrototypes + Display* /* display */, + int /* entries in image cache */ +#endif +); + +extern void NXFreeCache( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +extern XImage *NXCacheFindImage( +#if NeedFunctionPrototypes + NXPackedImage* /* packed image to find */, + unsigned int* /* pointer to the pack method if found */, + unsigned char** /* pointer to the calculated MD5 if found */ +#endif +); + +extern int NXCacheAddImage( +#if NeedFunctionPrototypes + NXPackedImage* /* packed image to be added to the cache */, + unsigned int /* pack method of the image to add */, + unsigned char* /* pointer to MD5 of the original unpacked image */ +#endif +); + + +extern int NXGetCollectImageResource( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +extern int NXCollectImage( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Drawable /* drawable */, + int /* src_x */, + int /* src_y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned long /* plane_mask */, + int /* format */ +#endif +); + +extern int NXGetCollectedImage( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + XImage** /* image */ +#endif +); + +extern int NXGetCollectPropertyResource( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +extern int NXCollectProperty( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Window /* window */, + Atom /* property */, + long /* long_offset */, + long /* long_length */, + Bool /* delete */, + Atom /* req_type */ +#endif +); + +extern int NXGetCollectedProperty( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Atom* /* actual_type_return */, + int* /* actual_format_return */, + unsigned long* /* nitems_return */, + unsigned long* /* bytes_after_return */, + unsigned char** /* data */ +#endif +); + +extern int NXGetCollectGrabPointerResource( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +extern int NXCollectGrabPointer( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Window /* grab_window */, + Bool /* owner_events */, + unsigned int /* event_mask */, + int /* pointer_mode */, + int /* keyboard_mode */, + Window /* confine_to */, + Cursor /* cursor */, + Time /* time */ +#endif +); + +extern int NXGetCollectedGrabPointer( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + int* /* status */ +#endif +); + +extern int NXGetCollectInputFocusResource( +#if NeedFunctionPrototypes + Display* /* display */ +#endif +); + +extern int NXCollectInputFocus( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */ +#endif +); + +extern int NXGetCollectedInputFocus( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned int /* resource */, + Window* /* focus_return */, + int* /* revert_to_return */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* NXlib_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile new file mode 100644 index 000000000..8f0f17d1e --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile @@ -0,0 +1,48 @@ +NULL = + +#include + +SRCS = \ + Alpha.c \ + Bitmap.c \ + Clean.c \ + Colormap.c \ + Compext.c \ + Jpeg.c \ + Mask.c \ + Png.c \ + Rgb.c \ + Rle.c \ + Z.c \ + $(NULL) + +OBJS = \ + Alpha.o \ + Bitmap.o \ + Clean.o \ + Colormap.o \ + Compext.o \ + Jpeg.o \ + Mask.o \ + Png.o \ + Rgb.o \ + Rle.o \ + Z.o \ + $(NULL) + + INCLUDES = -I$(SERVERSRC)/include \ + -I$(XBUILDINCDIR) \ + `pkg-config --cflags-only-I pixman-1` \ + `pkg-config --cflags-only-I zlib` \ + `pkg-config --cflags-only-I libpng` \ + $(NULL) + + LINTLIBS = $(SERVERSRC)/dix/llib-ldix.ln \ + $(NULL) + +NormalLibraryObjectRule() +NormalLibraryTarget(compext,$(OBJS)) +LintLibraryTarget(compext,$(SRCS)) +NormalLintTarget($(SRCS)) + +DependTarget() diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c new file mode 100644 index 000000000..690a934f6 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.c @@ -0,0 +1,480 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include +#include +#include + +#include +#include +#include + +#include + +#include "Compext.h" + +#include "Mask.h" +#include "Jpeg.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define JPEG_DEST_SIZE(width, height) ((width) * 3 * (height) + 1024) + +/* + * Local function prototypes. + */ + +static void PrepareRowForJpeg(CARD8 *dst, int y, int count); +static void PrepareRowForJpeg24(CARD8 *dst, int y, int count); +static void PrepareRowForJpeg16(CARD8 *dst, int y, int count); +static void PrepareRowForJpeg32(CARD8 *dst, int y, int count); + +static int JpegEmptyOutputBuffer(j_compress_ptr cinfo); + +static void JpegInitDestination(j_compress_ptr cinfo); +static void JpegTermDestination(j_compress_ptr cinfo); +static void JpegSetDstManager(j_compress_ptr cinfo); + +/* + * Quality levels. + */ + +static int jpegQuality[10] = {20, 30, 40, 50, 55, 60, 65, 70, 75, 80}; + +/* + * Image characteristics. + */ + +static int bytesPerLine; + +static CARD8 bitsPerPixel; +static CARD16 redMax, greenMax, blueMax; +static CARD8 redShift, greenShift, blueShift; +static int byteOrder; + +/* + * Other variables used for the Jpeg + * encoding. + */ + +static char *jpegBeforeBuf = NULL; +static char *jpegCompBuf; +static int jpegCompBufSize; +static int jpegError; +static int jpegDstDataLen; + +static struct jpeg_destination_mgr jpegDstManager; + +/* + * Just for debugging purpose. + */ + +#ifdef DEBUG + +static int jpegId; +static char jpegName[10]; +static FILE *jpegFile; + +#endif + +/* + * Function declarations + */ + +char *JpegCompressData(XImage *image, int level, int *compressed_size) +{ + struct jpeg_compress_struct cinfo; + struct jpeg_error_mgr jerr; + + CARD8 *srcBuf; + JSAMPROW rowPointer[1]; + + int dy, w, h; + + *compressed_size = 0; + + /* + * Initialize the image stuff + */ + + bitsPerPixel = image -> bits_per_pixel; + bytesPerLine = image -> bytes_per_line; + byteOrder = image -> byte_order; + + #ifdef TEST + fprintf(stderr, "******JpegCompressData: Image byte order [%d] bitmap bit order [%d].\n", + image -> byte_order, image -> bitmap_bit_order); + + fprintf(stderr, "******JpegCompressData: Bits per pixel [%d] bytes per line [%d].\n", + bitsPerPixel, bytesPerLine); + #endif + + redShift = FindLSB(image -> red_mask) - 1; + greenShift = FindLSB(image -> green_mask) - 1; + blueShift = FindLSB(image -> blue_mask) - 1; + + #ifdef TEST + fprintf(stderr, "******JpegCompressData: Red mask [0x%lx] green mask [0x%lx] blue mask [0x%lx].\n", + image -> red_mask, image -> green_mask, image -> blue_mask); + + fprintf(stderr, "******JpegCompressData: Red shift [%d] green shift [%d] blue shift [%d].\n", + redShift, greenShift, blueShift); + #endif + + redMax = image -> red_mask >> redShift; + greenMax = image -> green_mask >> greenShift; + blueMax = image -> blue_mask >> blueShift; + + #ifdef TEST + fprintf(stderr, "******JpegCompressData: Red max [0x%x] green max [0x%x] blue max [0x%x].\n", + redMax, greenMax, blueMax); + #endif + + w = image -> width; + h = image -> height; + + jpegBeforeBuf = image -> data; + + #ifdef DEBUG + fprintf(stderr, "******JpegCompressData: Width [%d] height [%d] level [%d].\n", + w, h, level); + #endif + + if (bitsPerPixel == 1 || + bitsPerPixel == 8) + { + #ifdef PANIC + fprintf(stderr, "******JpegCompressData: PANIC! Invalid bits per pixel [%d].\n", + bitsPerPixel); + #endif + + return NULL; + } + + /* + * Allocate space for one line of the + * resulting image, 3 bytes per pixel. + */ + + #ifdef DEBUG + fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the scanline.\n", + w * 3); + #endif + + srcBuf = (CARD8 *) malloc(w * 3); + + if (srcBuf == NULL) + { + #ifdef PANIC + fprintf(stderr, "******JpegCompressData: PANIC! Cannot allocate [%d] bytes.\n", + w * 3); + #endif + + return NULL; + } + + rowPointer[0] = srcBuf; + + cinfo.err = jpeg_std_error(&jerr); + + jpeg_create_compress(&cinfo); + + cinfo.image_width = w; + cinfo.image_height = h; + cinfo.input_components = 3; + cinfo.in_color_space = JCS_RGB; + + jpeg_set_defaults(&cinfo); + jpeg_set_quality(&cinfo, jpegQuality[level], 1); + + /* + * Allocate memory for the destination + * buffer. + */ + + jpegCompBufSize = JPEG_DEST_SIZE(w, h); + + #ifdef TEST + fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the destination data.\n", + jpegCompBufSize); + #endif + + jpegCompBuf = malloc(jpegCompBufSize); + + if (jpegCompBuf == NULL) + { + #ifdef PANIC + fprintf(stderr, "******JpegCompressData: PANIC! Error allocating [%d] bytes for the Jpeg data.\n", + jpegCompBufSize); + #endif + + return NULL; + } + + JpegSetDstManager(&cinfo); + + jpeg_start_compress(&cinfo, 1); + + #ifdef DEBUG + fprintf(stderr, "******JpegCompressedData: Initialization finished.\n"); + #endif + + for (dy = 0; dy < h; dy++) + { + PrepareRowForJpeg(srcBuf, dy, w); + + jpeg_write_scanlines(&cinfo, rowPointer, 1); + + if (jpegError != 0) + { + break; + } + } + + #ifdef DEBUG + fprintf(stderr, "******JpegCompressedData: Compression finished. Lines handled [%d,%d]. Error is [%d].\n", + dy, h, jpegError); + #endif + + if (jpegError == 0) + { + jpeg_finish_compress(&cinfo); + } + + jpeg_destroy_compress(&cinfo); + + free((char *) srcBuf); + + if (jpegError != 0) + { + #ifdef PANIC + fprintf(stderr, "******JpegCompressedData: PANIC! Compression failed. Error is [%d].\n", + jpegError); + #endif + + free(jpegCompBuf); + + return NULL; + } + + /* + * Check the size of the resulting data. + */ + + if (jpegDstDataLen > 0) + { + /* + * Save the image on disk to help with + * the debug. + */ + + #ifdef DEBUG + + int i = 0; + + fprintf(stderr, "******JpegCompressedData: Compressed size [%d].\n", + jpegDstDataLen); + + jpegId++; + + sprintf(jpegName, "jpeg%d", jpegId); + + jpegFile = fopen(jpegName, "w"); + + for (i = 0; i < jpegDstDataLen; i++) + { + fprintf(jpegFile, "%c", *(jpegCompBuf + i)); + } + + fclose(jpegFile); + + #endif + + *compressed_size = jpegDstDataLen; + + return jpegCompBuf; + } + else + { + #ifdef PANIC + fprintf(stderr, "******JpegCompressedData: PANIC! Invalid size of the compressed data [%d].\n", + jpegDstDataLen); + #endif + + free(jpegCompBuf); + + return NULL; + } +} + +void PrepareRowForJpeg(CARD8 *dst, int y, int count) +{ + if (bitsPerPixel == 32) + { + if (redMax == 0xff && + greenMax == 0xff && + blueMax == 0xff) + { + PrepareRowForJpeg24(dst, y, count); + } + else + { + PrepareRowForJpeg32(dst, y, count); + } + } + else if (bitsPerPixel == 24) + { + memcpy(dst, jpegBeforeBuf + y * bytesPerLine, count * 3); + } + else + { + /* + * 16 bpp assumed. + */ + + PrepareRowForJpeg16(dst, y, count); + } +} + +void PrepareRowForJpeg24(CARD8 *dst, int y, int count) +{ + CARD8 *fbptr; + CARD32 pix; + + fbptr = (CARD8 *) (jpegBeforeBuf + y * bytesPerLine); + + while (count--) + { + if (byteOrder == LSBFirst) + { + pix = (CARD32) *(fbptr + 2); + pix = (pix << 8) | (CARD32) *(fbptr+1); + pix = (pix << 8) | (CARD32) *fbptr; + } + else + { + pix = (CARD32) *(fbptr + 1); + pix = (pix << 8) | (CARD32) *(fbptr + 2); + pix = (pix << 8) | (CARD32) *(fbptr + 3); + } + + *dst++ = (CARD8)(pix >> redShift); + *dst++ = (CARD8)(pix >> greenShift); + *dst++ = (CARD8)(pix >> blueShift); + + fbptr+=4; + } +} + +#define DEFINE_JPEG_GET_ROW_FUNCTION(bpp) \ + \ +void PrepareRowForJpeg##bpp(CARD8 *dst, int y, int count) \ +{ \ + CARD8 *fbptr; \ + CARD##bpp pix; \ + int inRed, inGreen, inBlue; \ + int i; \ + \ + fbptr = (CARD8 *) (jpegBeforeBuf + y * bytesPerLine); \ + \ + while (count--) \ + { \ + pix = 0; \ + \ + if (byteOrder == LSBFirst) \ + { \ + for (i = (bpp >> 3) - 1; i >= 0; i--) \ + { \ + pix = (pix << 8) | (CARD32) *(fbptr + i); \ + } \ + } \ + else \ + { \ + for (i = 0; i < (bpp >> 3); i++) \ + { \ + pix = (pix << 8) | (CARD32) *(fbptr + i); \ + } \ + } \ + \ + fbptr += bpp >> 3; \ + \ + inRed = (int) \ + (pix >> redShift & redMax); \ + inGreen = (int) \ + (pix >> greenShift & greenMax); \ + inBlue = (int) \ + (pix >> blueShift & blueMax); \ + \ + *dst++ = (CARD8)((inRed * 255 + redMax / 2) / \ + redMax); \ + *dst++ = (CARD8)((inGreen * 255 + greenMax / 2) / \ + greenMax); \ + *dst++ = (CARD8)((inBlue * 255 + blueMax / 2) / \ + blueMax); \ + } \ +} + +DEFINE_JPEG_GET_ROW_FUNCTION(16) +DEFINE_JPEG_GET_ROW_FUNCTION(32) + +/* + * Destination manager implementation for JPEG library. + */ + +void JpegInitDestination(j_compress_ptr cinfo) +{ + jpegError = 0; + + jpegDstManager.next_output_byte = (JOCTET *) jpegCompBuf; + jpegDstManager.free_in_buffer = (size_t) jpegCompBufSize; +} + +int JpegEmptyOutputBuffer(j_compress_ptr cinfo) +{ + jpegError = 1; + + jpegDstManager.next_output_byte = (JOCTET *) jpegCompBuf; + jpegDstManager.free_in_buffer = (size_t) jpegCompBufSize; + + return 1; +} + +void JpegTermDestination(j_compress_ptr cinfo) +{ + jpegDstDataLen = jpegCompBufSize - jpegDstManager.free_in_buffer; +} + +void JpegSetDstManager(j_compress_ptr cinfo) +{ + jpegDstManager.init_destination = JpegInitDestination; + jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer; + jpegDstManager.term_destination = JpegTermDestination; + + cinfo -> dest = &jpegDstManager; +} + diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.h new file mode 100644 index 000000000..b50efd3ec --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Jpeg.h @@ -0,0 +1,46 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Jpeg_H +#define Jpeg_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *JpegCompressData( +#if NeedFunctionPrototypes + XImage* /* image */, + int /* level */, + int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Jpeg_H */ + diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.c new file mode 100644 index 000000000..cdcb8d3c0 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.c @@ -0,0 +1,802 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include + +#include + +#include + +#include "Mask.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +/* + * Try first to reduce to a white or black + * pixel. If not possible, apply the mask. + * Note that correction is applied at the + * time pixel is unpacked. + */ + +#define MaskPixel(red, green, blue, mask) \ +\ +if (red > mask -> white_threshold && \ + green > mask -> white_threshold && \ + blue > mask -> white_threshold) \ +{ \ + red = green = blue = 0xff; \ +} \ +else if (red < mask -> black_threshold && \ + green < mask -> black_threshold && \ + blue < mask -> black_threshold) \ +{ \ + red = green = blue = 0x00; \ +} \ +else \ +{ \ + red = red & mask -> color_mask; \ + green = green & mask -> color_mask; \ + blue = blue & mask -> color_mask; \ +} + +int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image) +{ + unsigned long pixel; + + register unsigned int red; + register unsigned int green; + register unsigned int blue; + + register unsigned long data_size; + + register unsigned int i; + + data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; + + #ifdef TEST + fprintf(stderr, "******MaskImage: Going to mask image with [%d] bits per pixel.\n", + src_image -> bits_per_pixel); + #endif + + if (src_image -> bits_per_pixel == 24 || src_image -> bits_per_pixel == 32) + { + register unsigned char *pixel_addr; + + for (i = 0; i < data_size; i++) + { + pixel = ((unsigned long *) src_image -> data)[i]; + + pixel_addr = (unsigned char *) &pixel; + + red = pixel_addr[2]; + green = pixel_addr[1]; + blue = pixel_addr[0]; + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", + red, green, blue, pixel_addr[3]); + #endif + + MaskPixel(red, green, blue, mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", + red, green, blue, pixel_addr[3]); + #endif + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 24/32 bits pixel 0x%lx", pixel); + #endif + + pixel_addr[2] = red; + pixel_addr[1] = green; + pixel_addr[0] = blue; + + ((unsigned long*)dst_image -> data)[i] = pixel; + + #ifdef DEBUG + fprintf(stderr, " -> 0x%lx\n", pixel); + #endif + } + + return 1; + } + else if (src_image -> bits_per_pixel == 16) + { + /* + * FIXME: Masking doesn't work in 16 bpp. + * + + unsigned long src_addr, *dst_addr; + unsigned short *src_pixels_addr, *dst_pixels_addr; + + for (i = 0; i < data_size; i++) + { + src_addr = ((unsigned long *)src_image -> data)[i]; + dst_addr = (unsigned long *)((unsigned long *)dst_image -> data + i); + + src_pixels_addr = ((unsigned short *) &src_addr); + dst_pixels_addr = ((unsigned short *) dst_addr); + + red = (src_pixels_addr[0] & src_image -> red_mask) >> 8; + green = (src_pixels_addr[0] & src_image -> green_mask) >> 3; + blue = (src_pixels_addr[0] & src_image -> blue_mask) << 3; + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + MaskPixel(red, green, blue, mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + dst_pixels_addr[0] = ((red << 8) & src_image -> red_mask) | + ((green << 3) & src_image -> green_mask) | + ((blue >> 3) & src_image -> blue_mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); + #endif + + red = (src_pixels_addr[1] & src_image -> red_mask) >> 8; + green = (src_pixels_addr[1] & src_image -> green_mask) >> 3; + blue = (src_pixels_addr[1] & src_image -> blue_mask) << 3; + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + MaskPixel(red, green, blue, mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + dst_pixels_addr[1] = ((red << 8) & src_image -> red_mask) | + ((green << 3) & src_image -> green_mask) | + ((blue >> 3) & src_image -> blue_mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); + #endif + } + + if (dst_image -> width & 0x00000001) + { + int card32_per_line; + int i; + + card32_per_line = dst_image -> bytes_per_line >> 2; + + for (i = 0; i < dst_image -> height;) + { + ((CARD32 *) dst_image -> data)[(++i * card32_per_line) - 1] &= 0x0000ffff; + } + } + + * + * End of FIXME. + */ + } + else + { + #ifdef TEST + fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", + src_image -> bits_per_pixel); + #endif + + return 0; + } + + return 1; +} + +int MaskInPlaceImage(const ColorMask *mask, XImage *image) +{ + unsigned long pixel; + + register unsigned int red; + register unsigned int green; + register unsigned int blue; + + register unsigned int i; + + register unsigned long data_size; + + data_size = (image -> bytes_per_line * image -> height)>>2; + + #ifdef TEST + fprintf(stderr, "******MaskInPlaceImage: Going to mask image with [%d] bits per pixel.\n", + image -> bits_per_pixel); + #endif + + if (image -> bits_per_pixel == 24 || image -> bits_per_pixel == 32) + { + register unsigned char *pixel_addr; + + for (i = 0; i < data_size; i++) + { + pixel = ((unsigned long *) image -> data)[i]; + + pixel_addr = (unsigned char *) &pixel; + + red = pixel_addr[2]; + green = pixel_addr[1]; + blue = pixel_addr[0]; + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", + red, green, blue, pixel_addr[3]); + #endif + + MaskPixel(red, green, blue, mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", + red, green, blue, pixel_addr[3]); + #endif + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 24/32 bits pixel 0x%lx", pixel); + #endif + + pixel_addr[2] = red; + pixel_addr[1] = green; + pixel_addr[0] = blue; + + ((unsigned long *) image -> data)[i] = pixel; + + #ifdef DEBUG + fprintf(stderr, " -> 0x%lx\n", pixel); + #endif + } + + return 1; + } + else if (image -> bits_per_pixel == 16) + { + /* + * FIXME: Mask doesn't still work for 16 bits. + * + + unsigned long addr; + register unsigned short *pixels_addr; + + for (i = 0; i < data_size; i++) + { + addr = ((unsigned long *) image -> data)[i]; + + pixels_addr = ((unsigned short *) &addr); + + red = (pixels_addr[0] & image -> red_mask) >> 8; + green = (pixels_addr[0] & image -> green_mask) >> 3; + blue = (pixels_addr[0] & image -> blue_mask) << 3; + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + MaskPixel(red, green, blue, mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + pixels_addr[0] = ((red << 8) & image -> red_mask) | + ((green << 3) & image -> green_mask) | + ((blue >> 3) & image -> blue_mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[0]); + #endif + + red = (pixels_addr[1] & image -> red_mask) >> 8; + green = (pixels_addr[1] & image -> green_mask) >> 3; + blue = (pixels_addr[1] & image -> blue_mask) << 3; + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + MaskPixel(red, green, blue, mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", + red, green, blue); + #endif + + pixels_addr[1] = ((red << 8) & image -> red_mask) | + ((green << 3) & image -> green_mask) | + ((blue >> 3) & image -> blue_mask); + + #ifdef DEBUG + fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[1]); + #endif + } + + if (image -> width & 0x00000001) + { + int card32_per_line; + int i; + + card32_per_line = image -> bytes_per_line >> 2; + + for (i = 0; i < image -> height;) + { + ((CARD32 *) image -> data)[(++i * card32_per_line) - 1] &= 0x0000ffff; + } + } + + * + * End of FIXME. + */ + } + else + { + #ifdef TEST + fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", + image -> bits_per_pixel); + #endif + + return 0; + } + + return 1; +} + +static int Pack16To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) +{ + unsigned short *src_pixel = (unsigned short *) src_image -> data; + unsigned char *dst_pixel = (unsigned char *) dst_image -> data; + + #ifdef DEBUG + unsigned int counter = 0; + #endif + + while (src_pixel < ((unsigned short *) (src_image -> data + src_data_size))) + { + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", + counter, *src_pixel, (*src_pixel & 0xc000) >> 8, + ((*src_pixel & 0x600) >> 3), (*src_pixel & 0x18) << 3); + #endif + + if (*src_pixel == 0x0) + { + *dst_pixel = 0x0; + } + else if (*src_pixel == 0xffff) + { + *dst_pixel = 0xff; + } + else + { + *dst_pixel = ((*src_pixel & 0xc000) >> 10) | + ((*src_pixel & 0x600) >> 7) | + ((*src_pixel & 0x18) >> 3); + } + + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", + counter++, *dst_pixel); + #endif + + src_pixel++; + dst_pixel++; + } + + return 1; +} + +static int Pack24To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) +{ + unsigned char *src_pixel = (unsigned char *) src_image -> data; + unsigned char *dst_pixel = (unsigned char *) dst_image -> data; + + int i; + + unsigned int bytes_per_line = src_image -> bytes_per_line; + + unsigned char *end_of_line = (unsigned char *) (src_pixel + bytes_per_line); + + + #ifdef DEBUG + unsigned int counter = 0; + #endif + + for (i = 0; i < src_image -> height; i++ ) + { + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", + counter, src_pixel[0], src_pixel[1], src_pixel[2], src_pixel[0] & 0xc0, + src_pixel[1] & 0xc0, src_pixel[2] & 0xc0); + #endif + + while(src_pixel < end_of_line - 2) + { + if (src_pixel[0] == 0x00 && + src_pixel[1] == 0x00 && + src_pixel[2] == 0x00) + { + *dst_pixel = 0x0; + } + else if (src_pixel[0] == 0xff && + src_pixel[1] == 0xff && + src_pixel[2] == 0xff) + { + *dst_pixel = 0xff; + } + else + { + /* + * Pixel layout: + * + * 24 bit RRRRR000 GGGGG000 BBBBB000 -> 8 bit 00RRGGBB + */ + + *dst_pixel = (src_pixel[0] & 0xc0) >> 2 | + ((src_pixel[1] & 0xc0) >> 4) | + ((src_pixel[2] & 0xc0) >> 6); + } + + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", + counter++, *dst_pixel); + #endif + + src_pixel += 3; + dst_pixel += 1; + } + + src_pixel = end_of_line; + end_of_line += bytes_per_line; + } + + return 1; +} + +static int Pack24To16(unsigned int src_data_size, XImage *src_image, XImage *dst_image) +{ + unsigned char *src_pixel = (unsigned char *) src_image -> data; + unsigned short *dst_pixel = (unsigned short *) dst_image -> data; + + int i; + + unsigned int bytes_per_line = src_image -> bytes_per_line; + + unsigned char *end_of_line = (unsigned char *) (src_pixel + bytes_per_line); + + #ifdef DEBUG + unsigned int counter = 0; + #endif + + for (i = 0; i < src_image -> height; i++ ) + { + while(src_pixel < end_of_line - 2) + { + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", + counter, src_pixel[0], src_pixel[1], src_pixel[2], src_pixel[0] & 0xf8, + src_pixel[1] & 0xf8, src_pixel[2] & 0xf8); + #endif + + if (src_pixel[0] == 0x00 && + src_pixel[1] == 0x00 && + src_pixel[2] == 0x00) + { + *dst_pixel = 0x0; + } + else if (src_pixel[0] == 0xff && + src_pixel[1] == 0xff && + src_pixel[2] == 0xff) + { + *dst_pixel = 0xffff; + } + else + { + /* + * Pixel layout: + * + * 24 bit RRRRR000 GGGGG000 BBBBB000 -> 16 bit 0RRRRRGG GGGBBBBB + */ + + *dst_pixel = ((src_pixel[0] & 0xf8) << 7) | + ((src_pixel[1] & 0xf8) << 2) | + ((src_pixel[2] & 0xf8) >> 3); + } + + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", + counter++, *dst_pixel); + #endif + + src_pixel += 3; + dst_pixel += 1; + } + + src_pixel = end_of_line; + end_of_line += bytes_per_line; + } + + return 1; +} + +static int Pack32To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) +{ + unsigned int *src_pixel = (unsigned int *) src_image -> data; + unsigned char *dst_pixel = (unsigned char *) dst_image -> data; + + #ifdef DEBUG + unsigned int counter = 0; + #endif + + while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) + { + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", + counter, *src_pixel, (*src_pixel & 0xc00000), + (*src_pixel & 0xc000), (*src_pixel & 0xc0)); + #endif + + if (*src_pixel == 0x0) + { + *dst_pixel = 0x0; + } + else if (*src_pixel == 0xffffff) + { + *dst_pixel = 0xff; + } + else + { + *dst_pixel = ((*src_pixel & 0xc00000) >> 18) | + ((*src_pixel & 0xc000) >> 12) | + ((*src_pixel & 0xc0) >> 6); + } + + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", + counter++, *dst_pixel); + #endif + + src_pixel++; + dst_pixel++; + } + + return 1; +} + +static int Pack32To16(unsigned int src_data_size, XImage *src_image, XImage *dst_image) +{ + unsigned int *src_pixel = (unsigned int *) src_image -> data; + unsigned short *dst_pixel = (unsigned short *) dst_image -> data; + + #ifdef DEBUG + unsigned int counter = 0; + #endif + + while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) + { + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", + counter, *src_pixel, (*src_pixel & 0xf80000), + (*src_pixel & 0xf800), (*src_pixel & 0xf8)); + #endif + + if (*src_pixel == 0x0) + { + *dst_pixel = 0x0; + } + else if (*src_pixel == 0xffffff) + { + *dst_pixel = 0xffff; + } + else + { + *dst_pixel = ((*src_pixel & 0xf80000) >> 9) | + ((*src_pixel & 0xf800) >> 6) | + ((*src_pixel & 0xf8) >> 3); + } + + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", + counter++, *dst_pixel); + #endif + + src_pixel++; + dst_pixel++; + } + + return 1; +} + +static int Pack32To24(unsigned int src_data_size, XImage *src_image, XImage *dst_image) +{ + unsigned int *src_pixel = (unsigned int *) src_image -> data; + unsigned char *dst_pixel = (unsigned char *) dst_image -> data; + + #ifdef DEBUG + unsigned int counter = 0; + #endif + + while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) + { + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", + counter, *src_pixel, ((*src_pixel & 0xff0000) >> 16), + ((*src_pixel & 0x00ff00) >> 8), (*src_pixel & 0xff)); + #endif + + if (*src_pixel == 0x0) + { + dst_pixel[0] = dst_pixel[1] = dst_pixel[2] = 0x0; + } + else if (*src_pixel == 0xffffff) + { + dst_pixel[0] = dst_pixel[1] = dst_pixel[2] = 0xff; + } + else + { + dst_pixel[0] = (*src_pixel & 0xff0000) >> 16; + dst_pixel[1] = (*src_pixel & 0x00ff00) >> 8; + dst_pixel[2] = (*src_pixel & 0x0000ff); + } + + #ifdef DEBUG + fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x], [0x%x], [0x%x].\n", + counter++, dst_pixel[0], dst_pixel[1], dst_pixel[2]); + #endif + + src_pixel += 1; + dst_pixel += 3; + } + + return 1; +} + +int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, + unsigned int dst_data_size, XImage *dst_image) +{ + unsigned int src_bits_per_pixel; + unsigned int dst_bits_per_pixel; + + src_bits_per_pixel = src_image -> bits_per_pixel; + dst_bits_per_pixel = MethodBitsPerPixel(method); + + #ifdef TEST + fprintf(stderr, "******PackImage: Source bits per pixel [%d], destination bits per pixel [%d].\n", + src_bits_per_pixel, dst_bits_per_pixel); + + fprintf(stderr, "******PackImage: Source data size [%d], destination data size [%d].\n", + src_data_size, dst_data_size); + #endif + + if (dst_bits_per_pixel >= src_bits_per_pixel) + { + #ifdef PANIC + fprintf(stderr, "******PackImage: PANIC! Cannot pack image from [%d] to [%d] bytes per pixel.\n", + src_bits_per_pixel, dst_bits_per_pixel); + #endif + + return 0; + } + + switch (src_bits_per_pixel) + { + case 16: + { + switch (dst_bits_per_pixel) + { + case 8: + { + return Pack16To8(src_data_size, src_image, dst_image); + } + default: + { + return 0; + } + } + } + case 24: + { + switch (dst_bits_per_pixel) + { + case 8: + { + return Pack24To8(src_data_size, src_image, dst_image); + } + case 16: + { + return Pack24To16(src_data_size, src_image, dst_image); + } + default: + { + return 0; + } + } + } + case 32: + { + switch (dst_bits_per_pixel) + { + case 8: + { + return Pack32To8(src_data_size, src_image, dst_image); + } + case 16: + { + return Pack32To16(src_data_size, src_image, dst_image); + } + case 24: + { + return Pack32To24(src_data_size, src_image, dst_image); + } + default: + { + return 0; + } + } + } + default: + { + return 0; + } + } +} + +/* + * Replace the ffs() call that may be not + * present on some systems. + */ + +int FindLSB(int word) +{ + int t = word; + + int m = 1; + int i = 0; + + for (; i < sizeof(word) << 3; i++, m <<= 1) + { + if (t & m) + { + return i + 1; + } + } + + return 0; +} + diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.h new file mode 100644 index 000000000..1b6fe6d99 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Mask.h @@ -0,0 +1,48 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Mask_H +#define Mask_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include "Xlib.h" + +extern int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image); + +extern int MaskInPlaceImage(const ColorMask *mask, XImage *image); + +extern int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, + unsigned int dst_data_size, XImage *dst_image); + +int FindLSB(int word); + +#ifdef __cplusplus +} +#endif + +#endif /* Mask_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c new file mode 100644 index 000000000..b235e095e --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Png.c @@ -0,0 +1,730 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include +#include +#include + +#include + +#include "Compext.h" + +#include "Mask.h" +#include "Png.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +/* + * Selected ZLIB compression level. + */ + +#define PNG_Z_LEVEL 4 + +/* + * Local function prototypes. + */ + +static void PrepareRowForPng(CARD8 *dst, int y, int count); +static void PrepareRowForPng24(CARD8 *dst, int y, int count); +static void PrepareRowForPng16(CARD8 *dst, int y, int count); +static void PrepareRowForPng32(CARD8 *dst, int y, int count); + +static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length); +static void PngFlushData(png_structp png_ptr); + +/* + * Image characteristics. + */ + +static int bytesPerLine; +static int byteOrder; + +static CARD8 bitsPerPixel; +static CARD16 redMax, greenMax, blueMax; +static CARD8 redShift, greenShift, blueShift; + +/* + * Other variables used for the Png + * encoding. + */ + +png_byte color_type; +png_structp png_ptr; +png_infop info_ptr; +png_colorp palette; +static char *pngCompBuf; +static int pngDataLen; +static char *pngBeforeBuf = NULL; + +/* + * Allocate data for the compressed image. + * We need to ensure that there is enough + * space to include the palette and the + * header. + */ + +#define PNG_DEST_SIZE(width, height) ((width) * 3 * (height) + 1024 + 256) + +/* + * Just for debug purposes. + */ + +#ifdef DEBUG + +static int pngId; +static char pngName[10]; +static FILE *pngFile; + +#endif + +int PngCompareColorTable(NXColorTable *c1, NXColorTable *c2) +{ + return (c1 -> pixel - c2 -> pixel); +} + +#define NB_COLOR_MAX 256 + +int NXCreatePalette32(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) +{ + int x, y, t, p; + CARD8 *fbptr; + CARD32 pixel; + + fbptr = (CARD8 *) (src_image -> data); + + /* + * TODO: Find a more intelligent way to + * estimate the number of colors. + */ + + memset(color_table, 0, nb_max * sizeof(NXColorTable)); + + for (x = 0, p = 0; x < src_image -> height; x++) + { + for (y = 0; y < src_image -> width; y++) + { + if (byteOrder == LSBFirst) + { + pixel = (CARD32) *(fbptr + 3); + pixel = (pixel << 8) | (CARD32) *(fbptr + 2); + pixel = (pixel << 8) | (CARD32) *(fbptr + 1); + pixel = (pixel << 8) | (CARD32) *fbptr; + } + else + { + pixel = (CARD32) *fbptr; + pixel = (pixel << 8) | (CARD32) *(fbptr + 1); + pixel = (pixel << 8) | (CARD32) *(fbptr + 2); + pixel = (pixel << 8) | (CARD32) *(fbptr + 3); + } + + fbptr += 4; + + for (t = 0; t < nb_max; t++) + { + if (color_table[t].found == 0) + { + color_table[t].pixel = pixel; + color_table[t].found = 1; + p++; + image_index[((x * src_image -> width) + y)] = t; + + break; + } + else if ((CARD32)(color_table[t].pixel) == pixel) + { + image_index[((x * src_image -> width) + y)] = t; + + break; + } + } + + if (p == nb_max) + { + return nb_max + 1; + } + } + } + return p; +} + +int NXCreatePalette16(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) +{ + int x, y, t, p; + CARD8 *fbptr; + CARD16 pixel; + + fbptr = (CARD8 *) (src_image -> data); + + /* + * TODO: Find a more intelligent way to + * estimate the number of colors. + */ + + memset(color_table, 0, nb_max * sizeof(NXColorTable)); + + for (x = 0, p = 0; x < src_image -> height; x++) + { + for (y = 0; y < src_image -> width; y++) + { + if (byteOrder == LSBFirst) + { + pixel = (CARD16) *(fbptr + 1); + pixel = (pixel << 8) | (CARD16) *fbptr; + } + else + { + pixel = (CARD16) *fbptr; + pixel = (pixel << 8) | (CARD16) *(fbptr + 1); + } + + fbptr += 2; + + for (t = 0; t < nb_max; t++) + { + if (color_table[t].found == 0) + { + color_table[t].pixel = pixel; + color_table[t].found = 1; + p++; + image_index[((x * src_image -> width) + y)] = t; + + break; + } + else if ((color_table[t].pixel) == pixel) + { + image_index[((x * src_image -> width) + y)] = t; + + break; + } + } + + /* + * In case the number of 16bit words is not even + * we have 2 padding bytes that we have to skip. + */ + + if ((y == src_image -> width - 1) && (src_image -> width % 2 == 1)) fbptr += 2; + + if (p == nb_max) + { + return nb_max + 1; + } + } + } + + return p; +} + +char *PngCompressData(XImage *image, int *compressed_size) +{ + unsigned int num = 0; + CARD8 *srcBuf; + + int dy, w, h; + + int nb_colors; + + NXColorTable color_table[NB_COLOR_MAX]; + CARD8 *image_index; + + image_index = (CARD8 *) malloc((image -> height) * (image -> width) * sizeof(CARD8)); + + /* + * TODO: Be sure the padded bytes are cleaned. + * It would be better to set to zero the bytes + * that are not alligned to the word boundary + * at the end of the procedure. + */ + + memset(image_index, 0, (image -> height) * (image -> width) * sizeof(CARD8)); + + *compressed_size = 0; + + pngDataLen = 0; + + /* + * Initialize the image stuff. + */ + + bitsPerPixel = image -> bits_per_pixel; + bytesPerLine = image -> bytes_per_line; + byteOrder = image -> byte_order; + + if (bitsPerPixel < 15) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Can't compress images with [%d] bits per pixel.\n", + bitsPerPixel); + #endif + + return NULL; + } + + redShift = FindLSB(image -> red_mask) - 1; + greenShift = FindLSB(image -> green_mask) - 1; + blueShift = FindLSB(image -> blue_mask) - 1; + + redMax = image -> red_mask >> redShift; + greenMax = image -> green_mask >> greenShift; + blueMax = image -> blue_mask >> blueShift; + + w = image -> width; + h = image -> height; + pngBeforeBuf = image -> data; + + #ifdef DEBUG + fprintf(stderr, "******PngCompressData: Compressing image with width [%d] height [%d].\n", + w, h ); + #endif + + /* + * Initialize the PNG stuff. + */ + + png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (png_ptr == NULL) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_write_struct.\n"); + #endif + + return NULL; + } + + info_ptr = png_create_info_struct(png_ptr); + + if (info_ptr == NULL) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_info_struct.\n"); + #endif + + png_destroy_write_struct(&png_ptr, NULL); + + return NULL; + } + + if (setjmp(png_jmpbuf(png_ptr))) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Error during compression initialization.\n"); + #endif + + png_destroy_write_struct(&png_ptr, &info_ptr); + + return NULL; + } + + /* + * Be sure we allocate enough data. + */ + + #ifdef TEST + fprintf(stderr, "******PngCompressData: Allocating [%d] bytes for the destination data.\n", + PNG_DEST_SIZE(w, h)); + #endif + + pngCompBuf = malloc(PNG_DEST_SIZE(w, h)); + + if (pngCompBuf == NULL) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Error allocating [%d] bytes for the Png data.\n", + PNG_DEST_SIZE(w, h)); + #endif + + return NULL; + } + + png_set_write_fn(png_ptr, (void *) pngCompBuf, PngWriteData, PngFlushData); + + if (setjmp(png_jmpbuf(png_ptr))) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Error writing the header.\n"); + #endif + + png_destroy_write_struct(&png_ptr, &info_ptr); + + free(pngCompBuf); + + return NULL; + } + + png_set_compression_level(png_ptr, PNG_Z_LEVEL); + + if (bitsPerPixel == 16) + { + nb_colors = NXCreatePalette16(image, color_table, image_index, NB_COLOR_MAX); + } + else + { + nb_colors = NXCreatePalette32(image, color_table, image_index, NB_COLOR_MAX); + } + + if (nb_colors <= NB_COLOR_MAX) + { + color_type = PNG_COLOR_TYPE_PALETTE; + } + else + { + color_type = PNG_COLOR_TYPE_RGB; + } + + png_set_IHDR(png_ptr, info_ptr, w, h, + 8, color_type, PNG_INTERLACE_NONE, + PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); + + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + palette = png_malloc(png_ptr, sizeof(*palette) * 256); + + /* + * TODO: Do we need to clean these bytes? + * + * memset(palette, 0, sizeof(*palette) * 256); + */ + + for (num = 0; num < 256 && color_table[num].found != 0; num++) + { + if (bitsPerPixel == 24) + { + palette[num].red = (color_table[num].pixel >> redShift) & redMax; + palette[num].green = (color_table[num].pixel >> greenShift) & greenMax; + palette[num].blue = color_table[num].pixel >> blueShift & blueMax; + } + else + { + int inRed, inGreen, inBlue; + + inRed = (color_table[num].pixel >> redShift) & redMax; + inGreen = (color_table[num].pixel >> greenShift) & greenMax; + inBlue = color_table[num].pixel >> blueShift & blueMax; + + palette[num].red = (CARD8)((inRed * 255 + redMax / 2) / redMax); + palette[num].green = (CARD8)((inGreen * 255 + greenMax / 2) / greenMax); + palette[num].blue = (CARD8)((inBlue * 255 + blueMax / 2) / blueMax); + } + + #ifdef DEBUG + fprintf(stderr, "******PngCompressData: pixel[%d] r[%d] g[%d] b[%d].\n", + (int) color_table[num].pixel,palette[num].red,palette[num].green,palette[num].blue); + #endif + } + + png_set_PLTE(png_ptr, info_ptr, palette, num); + + #ifdef DEBUG + fprintf(stderr, "******PngCompressedData: Setting palette.\n"); + #endif + } + + /* + * End of palette. + */ + + png_write_info(png_ptr, info_ptr); + + /* + * Allocate space for one line of + * the image, 3 bytes per pixel. + */ + + #ifdef DEBUG + fprintf(stderr, "******PngCompressedData: Initialization finished.\n"); + #endif + + if (setjmp(png_jmpbuf(png_ptr))) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Error while writing the image rows.\n"); + #endif + + png_destroy_write_struct(&png_ptr, &info_ptr); + + free(pngCompBuf); + + return NULL; + } + + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + srcBuf = (CARD8 *) malloc(w * sizeof(CARD8)); + + if (srcBuf == NULL) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", + (int) (w * sizeof(CARD8))); + #endif + + return NULL; + } + + /* + * TODO: Be sure the padded bytes are cleaned. + * It would be better to set to zero the bytes + * that are not alligned to the word boundary + * at the end of the procedure. + */ + + memset(srcBuf, 0, w * sizeof(CARD8)); + } + else + { + srcBuf = (CARD8 *) malloc(w * 3 * sizeof(CARD8)); + + /* + * TODO: See above. + */ + + memset(srcBuf, 0, w * 3 * sizeof(CARD8)); + } + + if (srcBuf == NULL) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", + w * 3); + #endif + + free(pngCompBuf); + + return NULL; + } + + for (dy = 0; dy < h; dy++) + { + if (color_type == PNG_COLOR_TYPE_RGB) + { + PrepareRowForPng(srcBuf, dy, w); + } + else + { + memcpy(srcBuf, image_index + (dy * w), w); + } + + png_write_row(png_ptr, srcBuf); + } + + #ifdef DEBUG + fprintf(stderr, "******PngCompressedData: Compression finished. Lines handled [%d,%d].\n", + dy, h); + #endif + + free(srcBuf); + free(image_index); + + if (setjmp(png_jmpbuf(png_ptr))) + { + #ifdef PANIC + fprintf(stderr, "******PngCompressData: PANIC! error during end of write.\n"); + #endif + + png_destroy_write_struct(&png_ptr, &info_ptr); + + free(pngCompBuf); + + return NULL; + } + + png_write_end(png_ptr, NULL); + + if (color_type == PNG_COLOR_TYPE_PALETTE) + { + png_free(png_ptr, palette); + } + + png_destroy_write_struct(&png_ptr, &info_ptr); + + /* + * Check the size of the resulting data. + */ + + if (pngDataLen > 0) + { + #ifdef DEBUG + + int i = 0; + + fprintf(stderr, "******PngCompressedData: Compressed size [%d].\n", + pngDataLen); + + pngId++; + sprintf(pngName, "png%d", pngId); + pngFile = fopen(pngName, "w"); + + for (i = 0; i < pngDataLen; i++) + { + fprintf(pngFile, "%c", *(pngCompBuf + i)); + } + + fclose(pngFile); + + #endif + + *compressed_size = pngDataLen; + + return pngCompBuf; + } + else + { + #ifdef DEBUG + fprintf(stderr, "******PngCompressedData: PANIC! Invalid size of the compressed data [%d].\n", + pngDataLen); + #endif + + free(pngCompBuf); + + return NULL; + } +} + +static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length) +{ + memcpy(((char *) png_get_io_ptr(png_ptr) + pngDataLen), data, length); + + pngDataLen += length; +} + +static void PngFlushData(png_structp png_ptr) +{ +} + +void PrepareRowForPng(CARD8 *dst, int y, int count) +{ + if (bitsPerPixel == 32) + { + if (redMax == 0xff && + greenMax == 0xff && + blueMax == 0xff) + { + PrepareRowForPng24(dst, y, count); + } + else + { + PrepareRowForPng32(dst, y, count); + } + } + else if (bitsPerPixel == 24) + { + memcpy(dst, pngBeforeBuf + y * bytesPerLine, count * 3); + } + else + { + /* + * 16 bpp assumed. + */ + + PrepareRowForPng16(dst, y, count); + } +} + + + +void PrepareRowForPng24(CARD8 *dst, int y, int count) +{ + CARD8 *fbptr; + CARD32 pix; + + fbptr = (CARD8 *) (pngBeforeBuf + y * bytesPerLine); + + while (count--) + { + if (byteOrder == LSBFirst) + { + pix = (CARD32) *(fbptr + 2); + pix = (pix << 8) | (CARD32) *(fbptr+1); + pix = (pix << 8) | (CARD32) *fbptr; + } + else + { + pix = (CARD32) *(fbptr + 1); + pix = (pix << 8) | (CARD32) *(fbptr + 2); + pix = (pix << 8) | (CARD32) *(fbptr + 3); + } + + *dst++ = (CARD8)(pix >> redShift); + *dst++ = (CARD8)(pix >> greenShift); + *dst++ = (CARD8)(pix >> blueShift); + + fbptr+=4; + } +} + +#define DEFINE_PNG_GET_ROW_FUNCTION(bpp) \ + \ +void PrepareRowForPng##bpp(CARD8 *dst, int y, int count) \ +{ \ + CARD8 *fbptr; \ + CARD##bpp pix; \ + int inRed, inGreen, inBlue; \ + int i; \ + \ + fbptr = (CARD8 *) (pngBeforeBuf + y * bytesPerLine); \ + \ + while (count--) \ + { \ + pix = 0; \ + \ + if (byteOrder == LSBFirst) \ + { \ + for (i = (bpp >> 3) - 1; i >= 0; i--) \ + { \ + pix = (pix << 8) | (CARD32) *(fbptr + i); \ + } \ + } \ + else \ + { \ + for (i = 0; i < (bpp >> 3); i++) \ + { \ + pix = (pix << 8) | (CARD32) *(fbptr + i); \ + } \ + } \ + \ + fbptr += (bpp >> 3); \ + \ + inRed = (int) \ + (pix >> redShift & redMax); \ + inGreen = (int) \ + (pix >> greenShift & greenMax); \ + inBlue = (int) \ + (pix >> blueShift & blueMax); \ + *dst++ = (CARD8)((inRed * 255 + redMax / 2) / \ + redMax); \ + *dst++ = (CARD8)((inGreen * 255 + greenMax / 2) / \ + greenMax); \ + *dst++ = (CARD8)((inBlue * 255 + blueMax / 2) / \ + blueMax); \ + } \ +} + +DEFINE_PNG_GET_ROW_FUNCTION(16) +DEFINE_PNG_GET_ROW_FUNCTION(32) diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Png.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Png.h new file mode 100644 index 000000000..0e0621627 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Png.h @@ -0,0 +1,76 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Png_H +#define Png_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +#include + +extern int PngCompareColorTable( +#if NeedFunctionPrototypes + NXColorTable* /* color_table_1 */, + NXColorTable* /* color_table_2 */ +#endif +); + +extern char *PngCompressData( +#if NeedFunctionPrototypes + XImage* /* image */, + int* /* compressed_size */ +#endif +); + +int NXCreatePalette16( +#if NeedFunctionPrototypes + XImage* /* src_image */, + NXColorTable* /* color_table */, + CARD8* /* image_index */, + int /* nb_max */ +#endif +); + +int NXCreatePalette32( +#if NeedFunctionPrototypes + XImage* /* src_image */, + NXColorTable* /* color_table */, + CARD8* /* image_index */, + int /* nb_max */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Png_H */ + diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.c new file mode 100644 index 000000000..fc53ded92 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.c @@ -0,0 +1,51 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include + +#include "Compext.h" + +#include "Rgb.h" +#include "Z.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define RGB_COMPRESSION_LEVEL 4 +#define RGB_COMPRESSION_THRESHOLD 32 +#define RGB_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY + +static int rgbCompressionLevel = RGB_COMPRESSION_LEVEL; +static int rgbCompressionThreshold = RGB_COMPRESSION_THRESHOLD; +static int rgbCompressionStrategy = RGB_COMPRESSION_STRATEGY; + +char *RgbCompressData(XImage *image, unsigned int *size) +{ + return ZCompressData(image -> data, image -> bytes_per_line * image -> height, + rgbCompressionThreshold, rgbCompressionLevel, + rgbCompressionStrategy, size); +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.h new file mode 100644 index 000000000..fd53ffbf9 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Rgb.h @@ -0,0 +1,44 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Rgb_H +#define Rgb_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *RgbCompressData( +#if NeedFunctionPrototypes + XImage* /* image */, + unsigned int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Rgb_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.c new file mode 100644 index 000000000..3f1da0de4 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.c @@ -0,0 +1,51 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include + +#include "Compext.h" + +#include "Rle.h" +#include "Z.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define RLE_COMPRESSION_LEVEL 1 +#define RLE_COMPRESSION_THRESHOLD 32 +#define RLE_COMPRESSION_STRATEGY Z_RLE + +static int rleCompressionLevel = RLE_COMPRESSION_LEVEL; +static int rleCompressionThreshold = RLE_COMPRESSION_THRESHOLD; +static int rleCompressionStrategy = RLE_COMPRESSION_STRATEGY; + +char *RleCompressData(XImage *image, unsigned int *size) +{ + return ZCompressData(image -> data, image -> bytes_per_line * image -> height, + rleCompressionThreshold, rleCompressionLevel, + rleCompressionStrategy, size); +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h new file mode 100644 index 000000000..a32812657 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h @@ -0,0 +1,44 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Rle_H +#define Rle_H + +#ifdef __cplusplus +extern "C" { +#endif + +extern char *RleCompressData( +#if NeedFunctionPrototypes + XImage* /* image */, + unsigned int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Rle_H */ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c b/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c new file mode 100644 index 000000000..6ee08e236 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Z.c @@ -0,0 +1,309 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#include +#include +#include + +#include + +#include "Compext.h" + +#include "Z.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define Z_COMPRESSION_LEVEL 4 +#define Z_COMPRESSION_THRESHOLD 32 +#define Z_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY + +static int zCompressionLevel = Z_COMPRESSION_LEVEL; +static int zCompressionStrategy = Z_COMPRESSION_STRATEGY; + +static z_stream *zStream; + +static int zInitialized; + +static int ZConfigure(int level, int strategy); + +static int ZDeflate(char *dest, unsigned int *destLen, + const char *source, unsigned int sourceLen); + +char *ZCompressData(const char *plainData, unsigned int plainSize, int threshold, + int level, int strategy, unsigned int *compressedSize) +{ + char *compressedData; + + /* + * Determine the size of the source image + * data and make sure there is enough + * space in the destination buffer. + */ + + *compressedSize = plainSize + (plainSize / 1000) + 12 + 1; + + compressedData = Xmalloc(*compressedSize); + + if (compressedData == NULL) + { + #ifdef PANIC + fprintf(stderr, "******ZCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", + *compressedSize); + #endif + + *compressedSize = 0; + + return NULL; + } + + if (level == Z_NO_COMPRESSION || plainSize < threshold) + { + #ifdef TEST + fprintf(stderr, "******ZCompressData: Not compressing [%d] bytes with level [%d] and " + "threshold [%d].\n", plainSize, level, threshold); + #endif + + /* + * Tell in the first byte of the buffer + * if the remaining data is compressed + * or not. This same byte can be used + * in future to store some other flag. + */ + + *compressedData = 0; + + memcpy(compressedData + 1, plainData, plainSize); + + *compressedSize = plainSize + 1; + + return compressedData; + } + else + { + int result; + + /* + * Reconfigure the stream if needed. + */ + + if (zCompressionLevel != level || + zCompressionStrategy != strategy) + { + ZConfigure(level, strategy); + + zCompressionLevel = level; + zCompressionStrategy = strategy; + } + + result = ZDeflate(compressedData + 1, compressedSize, plainData, plainSize); + + if (result != Z_OK) + { + #ifdef PANIC + fprintf(stderr, "******ZCompressData: PANIC! Failed to compress [%d] bytes with error [%s].\n", + plainSize, zError(result)); + #endif + + Xfree(compressedData); + + *compressedSize = 0; + + return NULL; + } + + #ifdef TEST + fprintf(stderr, "******ZCompressData: Source data of [%d] bytes compressed to [%d].\n", + plainSize, *compressedSize); + #endif + + *compressedData = 1; + + *compressedSize = *compressedSize + 1; + + return compressedData; + } +} + +int ZConfigure(int level, int strategy) +{ + /* + * ZLIB wants the avail_out to be + * non zero, even if the stream was + * already flushed. + */ + + unsigned char dest[1]; + + zStream -> next_out = dest; + zStream -> avail_out = 1; + + if (deflateParams(zStream, level, strategy) != Z_OK) + { + #ifdef PANIC + fprintf(stderr, "******ZConfigure: PANIC! Failed to set level to [%d] and strategy to [%d].\n", + level, strategy); + #endif + + return -1; + } + #ifdef TEST + else + { + fprintf(stderr, "******ZConfigure: Reconfigured the stream with level [%d] and strategy [%d].\n", + level, strategy); + } + #endif + + return 1; +} + +int ZDeflate(char *dest, unsigned int *destLen, const char *source, unsigned int sourceLen) +{ + int saveOut; + int result; + + /* + * Deal with the possible overflow. + */ + + if (zStream -> total_out & 0x80000000) + { + #ifdef TEST + fprintf(stderr, "******ZDeflate: Reset Z stream counters with total in [%ld] total out [%ld].\n", + zStream -> total_in, zStream -> total_out); + #endif + + zStream -> total_in = 0; + zStream -> total_out = 0; + } + + saveOut = zStream -> total_out; + + zStream -> next_in = (Bytef *) source; + zStream -> avail_in = (uInt) sourceLen; + + #ifdef MAXSEG_64K + + /* + * Check if the source is greater + * than 64K on a 16-bit machine. + */ + + if ((uLong) zStream -> avail_in != sourceLen) return Z_BUF_ERROR; + + #endif + + zStream -> next_out = (unsigned char *) dest; + zStream -> avail_out = (uInt) *destLen; + + if ((uLong) zStream -> avail_out != *destLen) return Z_BUF_ERROR; + + result = deflate(zStream, Z_FINISH); + + if (result != Z_STREAM_END) + { + deflateReset(zStream); + + return (result == Z_OK ? Z_BUF_ERROR : result); + } + + *destLen = zStream -> total_out - saveOut; + + result = deflateReset(zStream); + + return result; +} + +int ZInitEncoder() +{ + if (zInitialized == 0) + { + int result; + + zStream = Xmalloc(sizeof(z_stream)); + + if (zStream == NULL) + { + #ifdef PANIC + fprintf(stderr, "******ZInitEncoder: PANIC! Failed to allocate memory for the stream.\n"); + #endif + + return -1; + } + + zStream -> zalloc = (alloc_func) 0; + zStream -> zfree = (free_func) 0; + zStream -> opaque = (voidpf) 0; + + #ifdef TEST + fprintf(stderr, "******ZInitEncoder: Initializing compressor with level [%d] and startegy [%d].\n", + zCompressionLevel, zCompressionStrategy); + #endif + + result = deflateInit2(zStream, zCompressionLevel, Z_DEFLATED, + 15, 9, zCompressionStrategy); + + if (result != Z_OK) + { + #ifdef PANIC + fprintf(stderr, "******ZInitEncoder: Failed to initialize the compressor with error [%s].\n", + zError(result)); + #endif + + return -1; + } + + zInitialized = 1; + } + + return zInitialized; +} + +int ZResetEncoder() +{ + int result; + + if (zInitialized == 1) + { + result = deflateEnd(zStream); + + if (result != Z_OK) + { + #ifdef WARNING + fprintf(stderr, "******ZResetEncoder: WARNING! Failed to deinitialize the compressor with error [%s].\n", + zError(result)); + #endif + } + + Xfree(zStream); + } + + zInitialized = 0; + + return 1; +} diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Z.h b/nx-X11/programs/Xserver/hw/nxagent/compext/Z.h new file mode 100644 index 000000000..8133f0c73 --- /dev/null +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Z.h @@ -0,0 +1,60 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Z_H +#define Z_H + +#ifdef __cplusplus +extern "C" { +#endif + +int ZInitEncoder( +#if NeedFunctionPrototypes +void +#endif +); + +int ZResetEncoder( +#if NeedFunctionPrototypes +void +#endif +); + +extern char *ZCompressData( +#if NeedFunctionPrototypes + const char* /* data */, + unsigned int /* size */, + int /* threshold */, + int /* level */, + int /* strategy */, + unsigned int* /* compressed_size */ +#endif +); + +#ifdef __cplusplus +} +#endif + +#endif /* Z_H */ diff --git a/nx-libs.spec b/nx-libs.spec index d6036a152..5a6635de8 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -213,39 +213,6 @@ using X applications over a network, especially a slow one. This package contains the NX differential compression library for X11. -%package -n libXcompext-devel -Group: Development/Libraries -Summary: Development files for the NX compression extensions library -Requires: libXcompext3%{?_isa} = %{version}-%{release} -Requires: libNX_X11-devel%{?_isa} = %{version}-%{release} -Requires: nx-proto-devel%{?_isa} = %{version}-%{release} - -%description -n libXcompext-devel -NX is a software suite from NoMachine which implements very efficient -compression of the X11 protocol. This increases performance when -using X applications over a network, especially a slow one. - -The NX compression extensions library's development files. - - -%package -n libXcompext3 -Group: System Environment/Libraries -Summary: NX protocol compression extensions library -Requires: %{name}%{?_isa} >= 3.5.0.29 -Obsoletes: libXcompext <= 3.5.1 -Provides: libXcompext = %{version}-%{release} -Obsoletes: libXcompext%{?_isa} <= 3.5.1 -Provides: libXcompext%{?_isa} = %{version}-%{release} - -%description -n libXcompext3 -NX is a software suite from NoMachine which implements very efficient -compression of the X11 protocol. This increases performance when -using X applications over a network, especially a slow one. - -This package provides the library to support additional features to -the core NX library. - - %package -n libXcompshad-devel Group: Development/Libraries Summary: Development files for the NX session shadowing library @@ -317,6 +284,8 @@ Obsoletes: nx%{?_isa} < 3.5.0-19 Provides: nx%{?_isa} = %{version}-%{release} Conflicts: nxauth < 3.5.99.1 Conflicts: nxauth%{?_isa} < 3.5.99.1 +Conflicts: libXcompext < 3.5.99.3 +Conflicts: libXcompext%{?_isa} < 3.5.99.3 %if 0%{?suse_version} Requires: xorg-x11-fonts-core %endif @@ -426,12 +395,10 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %post -p /sbin/ldconfig %post -n libNX_X11-6 -p /sbin/ldconfig %post -n libXcomp3 -p /sbin/ldconfig -%post -n libXcompext3 -p /sbin/ldconfig %post -n libXcompshad3 -p /sbin/ldconfig %postun -p /sbin/ldconfig %postun -n libNX_X11-6 -p /sbin/ldconfig %postun -n libXcomp3 -p /sbin/ldconfig -%postun -n libXcompext3 -p /sbin/ldconfig %postun -n libXcompshad3 -p /sbin/ldconfig %files @@ -483,17 +450,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %doc doc/nxcomp/nxcomp-3.6-drops-compat-code-3.4.x-testing.pdf %_libdir/libXcomp.so.3* -%files -n libXcompext-devel -%defattr(-,root,root) -%_libdir/libXcompext.so -%{_includedir}/nx/NXlib.h -%{_libdir}/pkgconfig/nxcompext.pc - -%files -n libXcompext3 -%defattr(-,root,root) -%doc COPYING -%_libdir/libXcompext.so.3* - %files -n libXcompshad-devel %defattr(-,root,root) %_libdir/libXcompshad.so diff --git a/nxcompext/Alpha.c b/nxcompext/Alpha.c deleted file mode 100644 index e4d8a3220..000000000 --- a/nxcompext/Alpha.c +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "NXlib.h" - -#include "Alpha.h" -#include "Z.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define ALPHA_COMPRESSION_LEVEL 1 -#define ALPHA_COMPRESSION_THRESHOLD 32 -#define ALPHA_COMPRESSION_STRATEGY Z_RLE - -static int alphaCompressionLevel = ALPHA_COMPRESSION_LEVEL; -static int alphaCompressionThreshold = ALPHA_COMPRESSION_THRESHOLD; -static int alphaCompressionStrategy = ALPHA_COMPRESSION_STRATEGY; - -char *AlphaCompressData(const char *data, unsigned int size, unsigned int *compressed_size) -{ - return ZCompressData(data, size, alphaCompressionThreshold, alphaCompressionLevel, - alphaCompressionStrategy, compressed_size); -} diff --git a/nxcompext/Alpha.h b/nxcompext/Alpha.h deleted file mode 100644 index d7ac4e78e..000000000 --- a/nxcompext/Alpha.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Alpha_H -#define Alpha_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *AlphaCompressData( -#if NeedFunctionPrototypes - const char* /* data */, - unsigned int /* size */, - unsigned int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Alpha_H */ diff --git a/nxcompext/Bitmap.c b/nxcompext/Bitmap.c deleted file mode 100644 index c1d07f164..000000000 --- a/nxcompext/Bitmap.c +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include - -#include "NXlib.h" - -#include "Bitmap.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -char *BitmapCompressData(XImage *image, unsigned int *size) -{ - if (image -> bits_per_pixel != 32) - { - #ifdef TEST - fprintf(stderr, "******BitmapCompressData: Nothing to do with image of [%d] bpp and size [%d].\n", - image -> bits_per_pixel, image -> bytes_per_line * image -> height); - #endif - - *size = image -> bytes_per_line * image -> height; - - return image -> data; - } - else - { - /* - * Remove the 4th byte from the bitmap. - */ - - char *data; - - char *next_src; - char *next_dst; - - #ifdef TEST - - if (image -> bytes_per_line != 4 * image -> width) - { - fprintf(stderr, "******BitmapCompressData: PANIC! Image as [%d] bytes per line with expected [%d].\n", - image -> bytes_per_line, 4 * image -> width); - - return NULL; - } - - #endif - - *size = image -> width * image -> height * 3; - - data = Xmalloc(*size); - - if (data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******BitmapCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", - *size); - #endif - - *size = image -> bytes_per_line * image -> height; - - return image -> data; - } - - next_src = image -> data; - next_dst = data; - - if (image -> byte_order == LSBFirst) - { - while (next_src < image -> data + - image -> bytes_per_line * image -> height) - { - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - - next_src++; - } - } - else - { - while (next_src < image -> data + - image -> bytes_per_line * image -> height) - { - next_src++; - - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - } - } - - return data; - } -} diff --git a/nxcompext/Bitmap.h b/nxcompext/Bitmap.h deleted file mode 100644 index e45836d11..000000000 --- a/nxcompext/Bitmap.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Bitmap_H -#define Bitmap_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *BitmapCompressData( -#if NeedFunctionPrototypes - XImage* /* image */, - unsigned int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Bitmap_H */ diff --git a/nxcompext/Clean.c b/nxcompext/Clean.c deleted file mode 100644 index 8fff49547..000000000 --- a/nxcompext/Clean.c +++ /dev/null @@ -1,349 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include - -#include "os.h" - -#include "NXlib.h" - -#include "Clean.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -int CleanXYImage(XImage *image) -{ - int i, j, k, plane; - - int bitsToClean = (image -> bytes_per_line << 3) - image -> width - image -> xoffset; - - unsigned int bytesToClean = bitsToClean >> 3; - - bitsToClean &= 7; - - for (k = 0; k < image -> depth; k++) - { - plane = k * (image -> bytes_per_line * image -> height); - - for (i = 1; i <= image -> height; i++) - { - if (image -> byte_order == image -> bitmap_bit_order) - { - for (j = 1; j <= bytesToClean; j++) - { - image -> data[plane + i * (image -> bytes_per_line) - j] = 0x00; - } - } - else - { - for (j = bytesToClean; j >= 1; j--) - { - image -> data[plane + i * (image -> bytes_per_line) - j] = 0x00; - } - } - - if (image -> bitmap_bit_order == MSBFirst) - { - image -> data[plane + i * (image -> bytes_per_line) - j] &= 0xff << bitsToClean; - } - else - { - image -> data[plane + i * (image -> bytes_per_line) - j] &= 0xff >> bitsToClean; - } - } - } - - return 1; -} - -int CleanZImage(XImage *image) -{ - unsigned int bytesToClean; - unsigned int j; - unsigned int imageLength; - - #ifdef TEST - fprintf(stderr, "*****CleanZImage: Going to clean image of [%d] bits per pixel.\n", - image -> bits_per_pixel); - #endif - - switch (image -> bits_per_pixel) - { - case 32: - { - /* - * The caller should pay attention at extracting - * the alpha channel prior to cleaning the image. - * Cleaning an image which is carrying the alpha - * channel will result in the image being treated - * as fully transparent. - */ - - register int i; - - bytesToClean = image -> bytes_per_line * image -> height; - - #ifdef DEBUG - fprintf(stderr, "*****CleanZImage: Cleaning [%d] bytes with bits per pixel [%d] " - "width [%d] bytes per line [%d] height [%d].\n", bytesToClean, - image -> bits_per_pixel, image -> width, image -> - bytes_per_line, image -> height); - #endif - - if (image -> byte_order == LSBFirst) - { - for (i = 3; i < bytesToClean; i += 4) - { - ((unsigned char *) image -> data)[i] = 0x00; - } - } - else - { - for (i = 0; i < bytesToClean; i += 4) - { - ((unsigned char *) image -> data)[i] = 0x00; - } - } - - break; - } - case 24: - case 15: - case 16: - case 8: - { - register int i, j; - - bytesToClean = image -> bytes_per_line - - ((image -> width * image -> bits_per_pixel) >> 3); - - for (i = 1; i <= image -> height; i++) - { - for (j = bytesToClean; j > 0; j--) - { - ((unsigned char *) image -> data)[(i * image -> bytes_per_line) - j] = 0x00; - } - } - - break; - } - default: - { - #ifdef PANIC - fprintf(stderr, "*****CleanZImage: PANIC! Cannot clean image with [%d] bits per pixel.\n", - image -> bits_per_pixel); - #endif - } - } - - /* - * Clean the padding bytes at the real - * end of the buffer. - */ - - imageLength = image -> bytes_per_line * image -> height; - - bytesToClean = imageLength % 4; - - for (j = 0; j < bytesToClean; j++) - { - ((unsigned char *)image -> data)[(imageLength + j)] = 0x00; - } - - return 1; -} - -/* - * Copy a clean version of src_image into dst_image. - * This code is not taking care of the image format. - * The agent doesn't use it and you have to consider - * it unsupported. - */ - -int CopyAndCleanImage(XImage *src_image, XImage *dst_image) -{ - register long data_size; - register int i; - - data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; - - #ifdef WARNING - fprintf(stderr, "******CleanImage: WARNING! Function called with image of [%d] bits per pixel.\n", - src_image -> bits_per_pixel); - #endif - - switch (src_image -> bits_per_pixel) - { - case 32: - { - unsigned int mask; - - if (src_image -> byte_order == MSBFirst) - { - mask = 0xffffff00; - } - else - { - mask = 0x00ffffff; - } - for (i = 0; i < data_size; i++) - { - ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i] & mask; - } - - break; - } - - case 24: - { - unsigned int bytes_to_clean; - - for (i = 0; i < data_size; i++) - { - ((unsigned int *)dst_image -> data)[i] = ((unsigned int *)src_image -> data)[i]; - } - - bytes_to_clean = dst_image -> bytes_per_line - ((dst_image -> width * - dst_image -> bits_per_pixel) >> 3); - - if (bytes_to_clean) - { - register unsigned int mask = 0xffffffff; - register int line_size; - register int i; - - line_size = dst_image -> bytes_per_line >> 2; - - if (dst_image -> byte_order == MSBFirst) - { - mask = mask << (bytes_to_clean << 3); - } - else - { - mask = mask >> (bytes_to_clean << 3); - } - - for (i = 0; i < dst_image -> height;) - { - ((unsigned char *)dst_image -> data)[(++i * line_size) -1] &= mask; - } - } - - break; - } - - case 15: - case 16: - { - for (i = 0; i < data_size; i++) - { - ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; - } - - if (src_image -> width & 0x00000001) - { - int card32_per_line = dst_image -> bytes_per_line >> 2; - - for (i = 0; i < dst_image -> height;) - { - ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= 0x0000ffff; - } - } - - break; - } - - case 8: - { - unsigned int mask = 0x00000000; - - switch (dst_image -> width % 4) - { - case 3: - { - mask = 0x00ffffff; - - break; - } - case 2: - { - mask = 0x0000ffff; - - break; - } - case 1: - { - mask = 0x000000ff; - - break; - } - default: - { - /* - * Nothing to clean. - */ - - break; - } - } - - for (i = 0; i < data_size; i++) - { - ((unsigned int *) dst_image -> data)[i] = ((unsigned int *) src_image -> data)[i]; - } - - if (mask) - { - int card32_per_line; - int i; - - card32_per_line = dst_image -> bytes_per_line >> 2; - - for (i = 0; i < dst_image -> height; i++) - { - ((unsigned int *) dst_image -> data)[(++i * card32_per_line) -1] &= mask; - } - } - - break; - } - - default: - { - #ifdef PANIC - fprintf(stderr, "******CleanImage: PANIC! Cannot clean image of [%d] bits per pixel.\n", - src_image -> bits_per_pixel); - #endif - - return 0; - } - } - - return 1; -} diff --git a/nxcompext/Clean.h b/nxcompext/Clean.h deleted file mode 100644 index 7d9c0aee1..000000000 --- a/nxcompext/Clean.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Clean_H -#define Clean_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "Xlib.h" - -int CleanXYImage(XImage *image); -int CleanZImage(XImage *image); - -int CopyAndCleanImage(XImage *src_image, XImage *dst_image); - -#ifdef __cplusplus -} -#endif - -#endif /* Clean_H */ diff --git a/nxcompext/Colormap.c b/nxcompext/Colormap.c deleted file mode 100644 index 8ac5fc782..000000000 --- a/nxcompext/Colormap.c +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "NXlib.h" - -#include "Colormap.h" -#include "Z.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define COLORMAP_COMPRESSION_LEVEL 4 -#define COLORMAP_COMPRESSION_THRESHOLD 32 -#define COLORMAP_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY - -static int colormapCompressionLevel = COLORMAP_COMPRESSION_LEVEL; -static int colormapCompressionThreshold = COLORMAP_COMPRESSION_THRESHOLD; -static int colormapCompressionStrategy = COLORMAP_COMPRESSION_STRATEGY; - -char *ColormapCompressData(const char *data, unsigned int size, unsigned int *compressed_size) -{ - return ZCompressData(data, size, colormapCompressionThreshold, colormapCompressionLevel, - colormapCompressionStrategy, compressed_size); -} diff --git a/nxcompext/Colormap.h b/nxcompext/Colormap.h deleted file mode 100644 index b97fc752b..000000000 --- a/nxcompext/Colormap.h +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Colormap_H -#define Colormap_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *ColormapCompressData( -#if NeedFunctionPrototypes - const char* /* data */, - unsigned int /* size */, - unsigned int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Colormap_H */ diff --git a/nxcompext/Jpeg.c b/nxcompext/Jpeg.c deleted file mode 100644 index 74a94b7be..000000000 --- a/nxcompext/Jpeg.c +++ /dev/null @@ -1,480 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#include -#include -#include - -#include - -#include "NXlib.h" - -#include "Mask.h" -#include "Jpeg.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define JPEG_DEST_SIZE(width, height) ((width) * 3 * (height) + 1024) - -/* - * Local function prototypes. - */ - -static void PrepareRowForJpeg(CARD8 *dst, int y, int count); -static void PrepareRowForJpeg24(CARD8 *dst, int y, int count); -static void PrepareRowForJpeg16(CARD8 *dst, int y, int count); -static void PrepareRowForJpeg32(CARD8 *dst, int y, int count); - -static int JpegEmptyOutputBuffer(j_compress_ptr cinfo); - -static void JpegInitDestination(j_compress_ptr cinfo); -static void JpegTermDestination(j_compress_ptr cinfo); -static void JpegSetDstManager(j_compress_ptr cinfo); - -/* - * Quality levels. - */ - -static int jpegQuality[10] = {20, 30, 40, 50, 55, 60, 65, 70, 75, 80}; - -/* - * Image characteristics. - */ - -static int bytesPerLine; - -static CARD8 bitsPerPixel; -static CARD16 redMax, greenMax, blueMax; -static CARD8 redShift, greenShift, blueShift; -static int byteOrder; - -/* - * Other variables used for the Jpeg - * encoding. - */ - -static char *jpegBeforeBuf = NULL; -static char *jpegCompBuf; -static int jpegCompBufSize; -static int jpegError; -static int jpegDstDataLen; - -static struct jpeg_destination_mgr jpegDstManager; - -/* - * Just for debugging purpose. - */ - -#ifdef DEBUG - -static int jpegId; -static char jpegName[10]; -static FILE *jpegFile; - -#endif - -/* - * Function declarations - */ - -char *JpegCompressData(XImage *image, int level, int *compressed_size) -{ - struct jpeg_compress_struct cinfo; - struct jpeg_error_mgr jerr; - - CARD8 *srcBuf; - JSAMPROW rowPointer[1]; - - int dy, w, h; - - *compressed_size = 0; - - /* - * Initialize the image stuff - */ - - bitsPerPixel = image -> bits_per_pixel; - bytesPerLine = image -> bytes_per_line; - byteOrder = image -> byte_order; - - #ifdef TEST - fprintf(stderr, "******JpegCompressData: Image byte order [%d] bitmap bit order [%d].\n", - image -> byte_order, image -> bitmap_bit_order); - - fprintf(stderr, "******JpegCompressData: Bits per pixel [%d] bytes per line [%d].\n", - bitsPerPixel, bytesPerLine); - #endif - - redShift = FindLSB(image -> red_mask) - 1; - greenShift = FindLSB(image -> green_mask) - 1; - blueShift = FindLSB(image -> blue_mask) - 1; - - #ifdef TEST - fprintf(stderr, "******JpegCompressData: Red mask [0x%lx] green mask [0x%lx] blue mask [0x%lx].\n", - image -> red_mask, image -> green_mask, image -> blue_mask); - - fprintf(stderr, "******JpegCompressData: Red shift [%d] green shift [%d] blue shift [%d].\n", - redShift, greenShift, blueShift); - #endif - - redMax = image -> red_mask >> redShift; - greenMax = image -> green_mask >> greenShift; - blueMax = image -> blue_mask >> blueShift; - - #ifdef TEST - fprintf(stderr, "******JpegCompressData: Red max [0x%x] green max [0x%x] blue max [0x%x].\n", - redMax, greenMax, blueMax); - #endif - - w = image -> width; - h = image -> height; - - jpegBeforeBuf = image -> data; - - #ifdef DEBUG - fprintf(stderr, "******JpegCompressData: Width [%d] height [%d] level [%d].\n", - w, h, level); - #endif - - if (bitsPerPixel == 1 || - bitsPerPixel == 8) - { - #ifdef PANIC - fprintf(stderr, "******JpegCompressData: PANIC! Invalid bits per pixel [%d].\n", - bitsPerPixel); - #endif - - return NULL; - } - - /* - * Allocate space for one line of the - * resulting image, 3 bytes per pixel. - */ - - #ifdef DEBUG - fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the scanline.\n", - w * 3); - #endif - - srcBuf = (CARD8 *) malloc(w * 3); - - if (srcBuf == NULL) - { - #ifdef PANIC - fprintf(stderr, "******JpegCompressData: PANIC! Cannot allocate [%d] bytes.\n", - w * 3); - #endif - - return NULL; - } - - rowPointer[0] = srcBuf; - - cinfo.err = jpeg_std_error(&jerr); - - jpeg_create_compress(&cinfo); - - cinfo.image_width = w; - cinfo.image_height = h; - cinfo.input_components = 3; - cinfo.in_color_space = JCS_RGB; - - jpeg_set_defaults(&cinfo); - jpeg_set_quality(&cinfo, jpegQuality[level], 1); - - /* - * Allocate memory for the destination - * buffer. - */ - - jpegCompBufSize = JPEG_DEST_SIZE(w, h); - - #ifdef TEST - fprintf(stderr, "******JpegCompressData: Allocating [%d] bytes for the destination data.\n", - jpegCompBufSize); - #endif - - jpegCompBuf = malloc(jpegCompBufSize); - - if (jpegCompBuf == NULL) - { - #ifdef PANIC - fprintf(stderr, "******JpegCompressData: PANIC! Error allocating [%d] bytes for the Jpeg data.\n", - jpegCompBufSize); - #endif - - return NULL; - } - - JpegSetDstManager(&cinfo); - - jpeg_start_compress(&cinfo, 1); - - #ifdef DEBUG - fprintf(stderr, "******JpegCompressedData: Initialization finished.\n"); - #endif - - for (dy = 0; dy < h; dy++) - { - PrepareRowForJpeg(srcBuf, dy, w); - - jpeg_write_scanlines(&cinfo, rowPointer, 1); - - if (jpegError != 0) - { - break; - } - } - - #ifdef DEBUG - fprintf(stderr, "******JpegCompressedData: Compression finished. Lines handled [%d,%d]. Error is [%d].\n", - dy, h, jpegError); - #endif - - if (jpegError == 0) - { - jpeg_finish_compress(&cinfo); - } - - jpeg_destroy_compress(&cinfo); - - free((char *) srcBuf); - - if (jpegError != 0) - { - #ifdef PANIC - fprintf(stderr, "******JpegCompressedData: PANIC! Compression failed. Error is [%d].\n", - jpegError); - #endif - - free(jpegCompBuf); - - return NULL; - } - - /* - * Check the size of the resulting data. - */ - - if (jpegDstDataLen > 0) - { - /* - * Save the image on disk to help with - * the debug. - */ - - #ifdef DEBUG - - int i = 0; - - fprintf(stderr, "******JpegCompressedData: Compressed size [%d].\n", - jpegDstDataLen); - - jpegId++; - - sprintf(jpegName, "jpeg%d", jpegId); - - jpegFile = fopen(jpegName, "w"); - - for (i = 0; i < jpegDstDataLen; i++) - { - fprintf(jpegFile, "%c", *(jpegCompBuf + i)); - } - - fclose(jpegFile); - - #endif - - *compressed_size = jpegDstDataLen; - - return jpegCompBuf; - } - else - { - #ifdef PANIC - fprintf(stderr, "******JpegCompressedData: PANIC! Invalid size of the compressed data [%d].\n", - jpegDstDataLen); - #endif - - free(jpegCompBuf); - - return NULL; - } -} - -void PrepareRowForJpeg(CARD8 *dst, int y, int count) -{ - if (bitsPerPixel == 32) - { - if (redMax == 0xff && - greenMax == 0xff && - blueMax == 0xff) - { - PrepareRowForJpeg24(dst, y, count); - } - else - { - PrepareRowForJpeg32(dst, y, count); - } - } - else if (bitsPerPixel == 24) - { - memcpy(dst, jpegBeforeBuf + y * bytesPerLine, count * 3); - } - else - { - /* - * 16 bpp assumed. - */ - - PrepareRowForJpeg16(dst, y, count); - } -} - -void PrepareRowForJpeg24(CARD8 *dst, int y, int count) -{ - CARD8 *fbptr; - CARD32 pix; - - fbptr = (CARD8 *) (jpegBeforeBuf + y * bytesPerLine); - - while (count--) - { - if (byteOrder == LSBFirst) - { - pix = (CARD32) *(fbptr + 2); - pix = (pix << 8) | (CARD32) *(fbptr+1); - pix = (pix << 8) | (CARD32) *fbptr; - } - else - { - pix = (CARD32) *(fbptr + 1); - pix = (pix << 8) | (CARD32) *(fbptr + 2); - pix = (pix << 8) | (CARD32) *(fbptr + 3); - } - - *dst++ = (CARD8)(pix >> redShift); - *dst++ = (CARD8)(pix >> greenShift); - *dst++ = (CARD8)(pix >> blueShift); - - fbptr+=4; - } -} - -#define DEFINE_JPEG_GET_ROW_FUNCTION(bpp) \ - \ -void PrepareRowForJpeg##bpp(CARD8 *dst, int y, int count) \ -{ \ - CARD8 *fbptr; \ - CARD##bpp pix; \ - int inRed, inGreen, inBlue; \ - int i; \ - \ - fbptr = (CARD8 *) (jpegBeforeBuf + y * bytesPerLine); \ - \ - while (count--) \ - { \ - pix = 0; \ - \ - if (byteOrder == LSBFirst) \ - { \ - for (i = (bpp >> 3) - 1; i >= 0; i--) \ - { \ - pix = (pix << 8) | (CARD32) *(fbptr + i); \ - } \ - } \ - else \ - { \ - for (i = 0; i < (bpp >> 3); i++) \ - { \ - pix = (pix << 8) | (CARD32) *(fbptr + i); \ - } \ - } \ - \ - fbptr += bpp >> 3; \ - \ - inRed = (int) \ - (pix >> redShift & redMax); \ - inGreen = (int) \ - (pix >> greenShift & greenMax); \ - inBlue = (int) \ - (pix >> blueShift & blueMax); \ - \ - *dst++ = (CARD8)((inRed * 255 + redMax / 2) / \ - redMax); \ - *dst++ = (CARD8)((inGreen * 255 + greenMax / 2) / \ - greenMax); \ - *dst++ = (CARD8)((inBlue * 255 + blueMax / 2) / \ - blueMax); \ - } \ -} - -DEFINE_JPEG_GET_ROW_FUNCTION(16) -DEFINE_JPEG_GET_ROW_FUNCTION(32) - -/* - * Destination manager implementation for JPEG library. - */ - -void JpegInitDestination(j_compress_ptr cinfo) -{ - jpegError = 0; - - jpegDstManager.next_output_byte = (JOCTET *) jpegCompBuf; - jpegDstManager.free_in_buffer = (size_t) jpegCompBufSize; -} - -int JpegEmptyOutputBuffer(j_compress_ptr cinfo) -{ - jpegError = 1; - - jpegDstManager.next_output_byte = (JOCTET *) jpegCompBuf; - jpegDstManager.free_in_buffer = (size_t) jpegCompBufSize; - - return 1; -} - -void JpegTermDestination(j_compress_ptr cinfo) -{ - jpegDstDataLen = jpegCompBufSize - jpegDstManager.free_in_buffer; -} - -void JpegSetDstManager(j_compress_ptr cinfo) -{ - jpegDstManager.init_destination = JpegInitDestination; - jpegDstManager.empty_output_buffer = JpegEmptyOutputBuffer; - jpegDstManager.term_destination = JpegTermDestination; - - cinfo -> dest = &jpegDstManager; -} - diff --git a/nxcompext/Jpeg.h b/nxcompext/Jpeg.h deleted file mode 100644 index b50efd3ec..000000000 --- a/nxcompext/Jpeg.h +++ /dev/null @@ -1,46 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Jpeg_H -#define Jpeg_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *JpegCompressData( -#if NeedFunctionPrototypes - XImage* /* image */, - int /* level */, - int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Jpeg_H */ - diff --git a/nxcompext/Makefile.in b/nxcompext/Makefile.in deleted file mode 100644 index e2f1852f9..000000000 --- a/nxcompext/Makefile.in +++ /dev/null @@ -1,214 +0,0 @@ -#/**************************************************************************/ -#/* */ -#/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -#/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -#/* Copyright (c) 2014-2016 Ulrich Sibiller */ -#/* Copyright (c) 2014-2016 Mihai Moldovan */ -#/* Copyright (c) 2011-2016 Mike Gabriel */ -#/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -#/* */ -#/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -#/* are copyright of the aforementioned persons and companies. */ -#/* */ -#/* Redistribution and use of the present software is allowed according */ -#/* to terms specified in the file LICENSE which comes in the source */ -#/* distribution. */ -#/* */ -#/* All rights reserved. */ -#/* */ -#/* NOTE: This software has received contributions from various other */ -#/* contributors, only the core maintainers and supporters are listed as */ -#/* copyright holders. Please contact us, if you feel you should be listed */ -#/* as copyright holder, as well. */ -#/* */ -#/**************************************************************************/ - -# -# Get values from configure script. -# - -VERSION=@VERSION@ -LIBVERSION=@LIBVERSION@ - -# -# We want to enable really all warnings. -Wredundant-decls, -# though, gives a warning caused by pthread.h and unistd.h. -# - -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs -CXXINCLUDES = -I. -I../nxcomp -CXXDEFINES = - -CPPFLAGS = @CPPFLAGS@ - -CC = @CC@ -CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs -CCINCLUDES = -I. -I../nxcomp -CCDEFINES = - -LDFLAGS = @LDFLAGS@ -L../nxcomp -LIBS = @LIBS@ -lz -lNX_X11 -lXcomp - -# -# Only if THREADS is defined -# -# LIBS = @LIBS@ -lz -ljpeg -lpthread -lNX_X11 -lXcomp -# - -srcdir = @srcdir@ -prefix = @prefix@ -datarootdir = @datarootdir@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -man1dir = @mandir@/man1 -VPATH = @srcdir@ -libdir = @libdir@ -includedir = @includedir@ -pkgconfigdir = @pkgconfigdir@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_LINK = cp -av -DESTDIR = -RM_FILE = rm -f -# -# This should be autodetected. -# - -MAKEDEPEND = @MAKEDEPEND@ -DEPENDINCLUDES = -I/usr/include/c++ -I/usr/include/g++ -I/usr/include/g++-3 - -.SUFFIXES: .cpp.c - -.cpp.o: - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $< -.c.o: - $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $< - -LIBRARY = Xcompext - -LIBNAME = lib$(LIBRARY) -ifeq ($(shell uname),Darwin) -LIBFULL = lib$(LIBRARY).$(VERSION).dylib -LIBLOAD = lib$(LIBRARY).$(LIBVERSION).dylib -LIBSHARED = lib$(LIBRARY).dylib -COMP_VER = $(shell echo '$(VERSION)' | cut -d '.' -f 1-3) -LIBFLAGS = -install_name $(libdir)/$(LIBLOAD) -compatibility_version $(LIBVERSION) -current_version $(COMP_VER) -else -LIBFULL = lib$(LIBRARY).so.$(VERSION) -LIBLOAD = lib$(LIBRARY).so.$(LIBVERSION) -LIBSHARED = lib$(LIBRARY).so -LIBFLAGS = -endif -LIBARCHIVE = lib$(LIBRARY).a - -LIBCYGSHARED = cyg$(LIBRARY).dll -LIBCYGARCHIVE = lib$(LIBRARY).dll.a - -all: depend @ALL@ - -MSRC= - -CSRC= NXlib.c \ - Clean.c \ - Mask.c \ - Colormap.c \ - Alpha.c \ - Jpeg.c \ - Pgn.c \ - Bitmap.c \ - Rgb.c \ - Rle.c \ - Z.c - -CXXSRC= - -MOBJ = $(MSRC:.c=.o) -COBJ = $(CSRC:.c=.o) -CXXOBJ = $(CXXSRC:.cpp=.o) - -$(LIBFULL): $(CXXOBJ) $(COBJ) - $(CXX) -o $@ $(LDFLAGS) $(LIBFLAGS) $(CXXOBJ) $(COBJ) $(LIBS) - -$(LIBLOAD): $(LIBFULL) - rm -f $(LIBLOAD) - ln -s $(LIBFULL) $(LIBLOAD) - -$(LIBSHARED): $(LIBFULL) - rm -f $(LIBSHARED) - ln -s $(LIBFULL) $(LIBSHARED) - -$(LIBARCHIVE): $(CXXOBJ) $(COBJ) - rm -f $(LIBARCHIVE) - ar clq $(LIBARCHIVE) $(CXXOBJ) $(COBJ) - ranlib $(LIBARCHIVE) - -$(LIBCYGSHARED): $(LIBARCHIVE) - $(CC) -shared -o $(LIBCYGSHARED) \ - -Wl,--out-implib=$(LIBCYGARCHIVE) \ - -Wl,--export-all-symbols \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive $(LIBARCHIVE) \ - -Wl,--no-whole-archive $(LIBS) \ - $(LDFLAGS) - -$(LIBCYGARCHIVE): $(LIBCYGSHARED) - -depends: depend.status - -depend: depend.status - -depend.status: - if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \ - $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \ - $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) \ - $(CXXSRC) 2>/dev/null; \ - fi - touch depend.status - -install: install.bin install.lib install.man - -install.bin: - -install.lib: all - ./mkinstalldirs $(DESTDIR)${libdir} - ./mkinstalldirs $(DESTDIR)${pkgconfigdir} - ./mkinstalldirs $(DESTDIR)${includedir}/nx - ./mkinstalldirs $(DESTDIR)${pkgconfigdir} - $(INSTALL_DATA) $(LIBFULL) $(DESTDIR)${libdir} - $(INSTALL_LINK) $(LIBLOAD) $(DESTDIR)${libdir} - $(INSTALL_LINK) $(LIBSHARED) $(DESTDIR)${libdir} - $(INSTALL_DATA) NX*.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) nxcompext.pc $(DESTDIR)${pkgconfigdir} - echo "Running ldconfig tool, this may take a while..." && ldconfig || true - -install.man: - -uninstall: uninstall.bin uninstall.lib uninstall.man - -uninstall.bin: - -uninstall.lib: - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBFULL) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBLOAD) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBSHARED) - $(RM_FILE) $(DESTDIR)${includedir}/nx/NXlib.h - $(RM_FILE) $(DESTDIR)${pkgconfigdir}/nxcompext.pc - echo "Running ldconfig tool, this may take a while..." && ldconfig || true - -uninstall.man: - -clean: - -rm -f *~ *.o *.bak *.orig *.rej st?????? core core.* *.out.* *.pc \ - @ALL@ - -distclean: clean - -rm -rf autom4te.cache config.status config.log configure \ - config.cache depend.status Makefile tags diff --git a/nxcompext/Mask.c b/nxcompext/Mask.c deleted file mode 100644 index 6fbc44a8e..000000000 --- a/nxcompext/Mask.c +++ /dev/null @@ -1,802 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "Xlib.h" - -#include "NXpack.h" - -#include "Mask.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -/* - * Try first to reduce to a white or black - * pixel. If not possible, apply the mask. - * Note that correction is applied at the - * time pixel is unpacked. - */ - -#define MaskPixel(red, green, blue, mask) \ -\ -if (red > mask -> white_threshold && \ - green > mask -> white_threshold && \ - blue > mask -> white_threshold) \ -{ \ - red = green = blue = 0xff; \ -} \ -else if (red < mask -> black_threshold && \ - green < mask -> black_threshold && \ - blue < mask -> black_threshold) \ -{ \ - red = green = blue = 0x00; \ -} \ -else \ -{ \ - red = red & mask -> color_mask; \ - green = green & mask -> color_mask; \ - blue = blue & mask -> color_mask; \ -} - -int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image) -{ - unsigned long pixel; - - register unsigned int red; - register unsigned int green; - register unsigned int blue; - - register unsigned long data_size; - - register unsigned int i; - - data_size = (src_image -> bytes_per_line * src_image -> height) >> 2; - - #ifdef TEST - fprintf(stderr, "******MaskImage: Going to mask image with [%d] bits per pixel.\n", - src_image -> bits_per_pixel); - #endif - - if (src_image -> bits_per_pixel == 24 || src_image -> bits_per_pixel == 32) - { - register unsigned char *pixel_addr; - - for (i = 0; i < data_size; i++) - { - pixel = ((unsigned long *) src_image -> data)[i]; - - pixel_addr = (unsigned char *) &pixel; - - red = pixel_addr[2]; - green = pixel_addr[1]; - blue = pixel_addr[0]; - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", - red, green, blue, pixel_addr[3]); - #endif - - MaskPixel(red, green, blue, mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", - red, green, blue, pixel_addr[3]); - #endif - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 24/32 bits pixel 0x%lx", pixel); - #endif - - pixel_addr[2] = red; - pixel_addr[1] = green; - pixel_addr[0] = blue; - - ((unsigned long*)dst_image -> data)[i] = pixel; - - #ifdef DEBUG - fprintf(stderr, " -> 0x%lx\n", pixel); - #endif - } - - return 1; - } - else if (src_image -> bits_per_pixel == 16) - { - /* - * FIXME: Masking doesn't work in 16 bpp. - * - - unsigned long src_addr, *dst_addr; - unsigned short *src_pixels_addr, *dst_pixels_addr; - - for (i = 0; i < data_size; i++) - { - src_addr = ((unsigned long *)src_image -> data)[i]; - dst_addr = (unsigned long *)((unsigned long *)dst_image -> data + i); - - src_pixels_addr = ((unsigned short *) &src_addr); - dst_pixels_addr = ((unsigned short *) dst_addr); - - red = (src_pixels_addr[0] & src_image -> red_mask) >> 8; - green = (src_pixels_addr[0] & src_image -> green_mask) >> 3; - blue = (src_pixels_addr[0] & src_image -> blue_mask) << 3; - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - MaskPixel(red, green, blue, mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - dst_pixels_addr[0] = ((red << 8) & src_image -> red_mask) | - ((green << 3) & src_image -> green_mask) | - ((blue >> 3) & src_image -> blue_mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); - #endif - - red = (src_pixels_addr[1] & src_image -> red_mask) >> 8; - green = (src_pixels_addr[1] & src_image -> green_mask) >> 3; - blue = (src_pixels_addr[1] & src_image -> blue_mask) << 3; - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 16 bits original R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - MaskPixel(red, green, blue, mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 16 bits masked R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - dst_pixels_addr[1] = ((red << 8) & src_image -> red_mask) | - ((green << 3) & src_image -> green_mask) | - ((blue >> 3) & src_image -> blue_mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskImage: 16 bits pixel 0x%x", dst_pixels_addr[0]); - #endif - } - - if (dst_image -> width & 0x00000001) - { - int card32_per_line; - int i; - - card32_per_line = dst_image -> bytes_per_line >> 2; - - for (i = 0; i < dst_image -> height;) - { - ((CARD32 *) dst_image -> data)[(++i * card32_per_line) - 1] &= 0x0000ffff; - } - } - - * - * End of FIXME. - */ - } - else - { - #ifdef TEST - fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", - src_image -> bits_per_pixel); - #endif - - return 0; - } - - return 1; -} - -int MaskInPlaceImage(const ColorMask *mask, XImage *image) -{ - unsigned long pixel; - - register unsigned int red; - register unsigned int green; - register unsigned int blue; - - register unsigned int i; - - register unsigned long data_size; - - data_size = (image -> bytes_per_line * image -> height)>>2; - - #ifdef TEST - fprintf(stderr, "******MaskInPlaceImage: Going to mask image with [%d] bits per pixel.\n", - image -> bits_per_pixel); - #endif - - if (image -> bits_per_pixel == 24 || image -> bits_per_pixel == 32) - { - register unsigned char *pixel_addr; - - for (i = 0; i < data_size; i++) - { - pixel = ((unsigned long *) image -> data)[i]; - - pixel_addr = (unsigned char *) &pixel; - - red = pixel_addr[2]; - green = pixel_addr[1]; - blue = pixel_addr[0]; - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 24/32 bits original R [%d] G [%d] B [%d] A [%d].\n", - red, green, blue, pixel_addr[3]); - #endif - - MaskPixel(red, green, blue, mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 24/32 bits masked R [%d] G [%d] B [%d] A [%d].\n", - red, green, blue, pixel_addr[3]); - #endif - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 24/32 bits pixel 0x%lx", pixel); - #endif - - pixel_addr[2] = red; - pixel_addr[1] = green; - pixel_addr[0] = blue; - - ((unsigned long *) image -> data)[i] = pixel; - - #ifdef DEBUG - fprintf(stderr, " -> 0x%lx\n", pixel); - #endif - } - - return 1; - } - else if (image -> bits_per_pixel == 16) - { - /* - * FIXME: Mask doesn't still work for 16 bits. - * - - unsigned long addr; - register unsigned short *pixels_addr; - - for (i = 0; i < data_size; i++) - { - addr = ((unsigned long *) image -> data)[i]; - - pixels_addr = ((unsigned short *) &addr); - - red = (pixels_addr[0] & image -> red_mask) >> 8; - green = (pixels_addr[0] & image -> green_mask) >> 3; - blue = (pixels_addr[0] & image -> blue_mask) << 3; - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - MaskPixel(red, green, blue, mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - pixels_addr[0] = ((red << 8) & image -> red_mask) | - ((green << 3) & image -> green_mask) | - ((blue >> 3) & image -> blue_mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[0]); - #endif - - red = (pixels_addr[1] & image -> red_mask) >> 8; - green = (pixels_addr[1] & image -> green_mask) >> 3; - blue = (pixels_addr[1] & image -> blue_mask) << 3; - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 16 bits original R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - MaskPixel(red, green, blue, mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 16 bits masked R [%d] G [%d] B [%d].\n", - red, green, blue); - #endif - - pixels_addr[1] = ((red << 8) & image -> red_mask) | - ((green << 3) & image -> green_mask) | - ((blue >> 3) & image -> blue_mask); - - #ifdef DEBUG - fprintf(stderr, "******MaskInPlaceImage: 16 bits pixel 0x%x", pixels_addr[1]); - #endif - } - - if (image -> width & 0x00000001) - { - int card32_per_line; - int i; - - card32_per_line = image -> bytes_per_line >> 2; - - for (i = 0; i < image -> height;) - { - ((CARD32 *) image -> data)[(++i * card32_per_line) - 1] &= 0x0000ffff; - } - } - - * - * End of FIXME. - */ - } - else - { - #ifdef TEST - fprintf(stderr, "******MaskImage: PANIC! Cannot apply mask with [%d] bits per pixel.\n", - image -> bits_per_pixel); - #endif - - return 0; - } - - return 1; -} - -static int Pack16To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) -{ - unsigned short *src_pixel = (unsigned short *) src_image -> data; - unsigned char *dst_pixel = (unsigned char *) dst_image -> data; - - #ifdef DEBUG - unsigned int counter = 0; - #endif - - while (src_pixel < ((unsigned short *) (src_image -> data + src_data_size))) - { - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", - counter, *src_pixel, (*src_pixel & 0xc000) >> 8, - ((*src_pixel & 0x600) >> 3), (*src_pixel & 0x18) << 3); - #endif - - if (*src_pixel == 0x0) - { - *dst_pixel = 0x0; - } - else if (*src_pixel == 0xffff) - { - *dst_pixel = 0xff; - } - else - { - *dst_pixel = ((*src_pixel & 0xc000) >> 10) | - ((*src_pixel & 0x600) >> 7) | - ((*src_pixel & 0x18) >> 3); - } - - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", - counter++, *dst_pixel); - #endif - - src_pixel++; - dst_pixel++; - } - - return 1; -} - -static int Pack24To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) -{ - unsigned char *src_pixel = (unsigned char *) src_image -> data; - unsigned char *dst_pixel = (unsigned char *) dst_image -> data; - - int i; - - unsigned int bytes_per_line = src_image -> bytes_per_line; - - unsigned char *end_of_line = (unsigned char *) (src_pixel + bytes_per_line); - - - #ifdef DEBUG - unsigned int counter = 0; - #endif - - for (i = 0; i < src_image -> height; i++ ) - { - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", - counter, src_pixel[0], src_pixel[1], src_pixel[2], src_pixel[0] & 0xc0, - src_pixel[1] & 0xc0, src_pixel[2] & 0xc0); - #endif - - while(src_pixel < end_of_line - 2) - { - if (src_pixel[0] == 0x00 && - src_pixel[1] == 0x00 && - src_pixel[2] == 0x00) - { - *dst_pixel = 0x0; - } - else if (src_pixel[0] == 0xff && - src_pixel[1] == 0xff && - src_pixel[2] == 0xff) - { - *dst_pixel = 0xff; - } - else - { - /* - * Pixel layout: - * - * 24 bit RRRRR000 GGGGG000 BBBBB000 -> 8 bit 00RRGGBB - */ - - *dst_pixel = (src_pixel[0] & 0xc0) >> 2 | - ((src_pixel[1] & 0xc0) >> 4) | - ((src_pixel[2] & 0xc0) >> 6); - } - - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", - counter++, *dst_pixel); - #endif - - src_pixel += 3; - dst_pixel += 1; - } - - src_pixel = end_of_line; - end_of_line += bytes_per_line; - } - - return 1; -} - -static int Pack24To16(unsigned int src_data_size, XImage *src_image, XImage *dst_image) -{ - unsigned char *src_pixel = (unsigned char *) src_image -> data; - unsigned short *dst_pixel = (unsigned short *) dst_image -> data; - - int i; - - unsigned int bytes_per_line = src_image -> bytes_per_line; - - unsigned char *end_of_line = (unsigned char *) (src_pixel + bytes_per_line); - - #ifdef DEBUG - unsigned int counter = 0; - #endif - - for (i = 0; i < src_image -> height; i++ ) - { - while(src_pixel < end_of_line - 2) - { - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x%x%x] red [0x%x] green [0x%x] blue [0x%x].\n", - counter, src_pixel[0], src_pixel[1], src_pixel[2], src_pixel[0] & 0xf8, - src_pixel[1] & 0xf8, src_pixel[2] & 0xf8); - #endif - - if (src_pixel[0] == 0x00 && - src_pixel[1] == 0x00 && - src_pixel[2] == 0x00) - { - *dst_pixel = 0x0; - } - else if (src_pixel[0] == 0xff && - src_pixel[1] == 0xff && - src_pixel[2] == 0xff) - { - *dst_pixel = 0xffff; - } - else - { - /* - * Pixel layout: - * - * 24 bit RRRRR000 GGGGG000 BBBBB000 -> 16 bit 0RRRRRGG GGGBBBBB - */ - - *dst_pixel = ((src_pixel[0] & 0xf8) << 7) | - ((src_pixel[1] & 0xf8) << 2) | - ((src_pixel[2] & 0xf8) >> 3); - } - - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", - counter++, *dst_pixel); - #endif - - src_pixel += 3; - dst_pixel += 1; - } - - src_pixel = end_of_line; - end_of_line += bytes_per_line; - } - - return 1; -} - -static int Pack32To8(unsigned int src_data_size, XImage *src_image, XImage *dst_image) -{ - unsigned int *src_pixel = (unsigned int *) src_image -> data; - unsigned char *dst_pixel = (unsigned char *) dst_image -> data; - - #ifdef DEBUG - unsigned int counter = 0; - #endif - - while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) - { - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", - counter, *src_pixel, (*src_pixel & 0xc00000), - (*src_pixel & 0xc000), (*src_pixel & 0xc0)); - #endif - - if (*src_pixel == 0x0) - { - *dst_pixel = 0x0; - } - else if (*src_pixel == 0xffffff) - { - *dst_pixel = 0xff; - } - else - { - *dst_pixel = ((*src_pixel & 0xc00000) >> 18) | - ((*src_pixel & 0xc000) >> 12) | - ((*src_pixel & 0xc0) >> 6); - } - - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", - counter++, *dst_pixel); - #endif - - src_pixel++; - dst_pixel++; - } - - return 1; -} - -static int Pack32To16(unsigned int src_data_size, XImage *src_image, XImage *dst_image) -{ - unsigned int *src_pixel = (unsigned int *) src_image -> data; - unsigned short *dst_pixel = (unsigned short *) dst_image -> data; - - #ifdef DEBUG - unsigned int counter = 0; - #endif - - while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) - { - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", - counter, *src_pixel, (*src_pixel & 0xf80000), - (*src_pixel & 0xf800), (*src_pixel & 0xf8)); - #endif - - if (*src_pixel == 0x0) - { - *dst_pixel = 0x0; - } - else if (*src_pixel == 0xffffff) - { - *dst_pixel = 0xffff; - } - else - { - *dst_pixel = ((*src_pixel & 0xf80000) >> 9) | - ((*src_pixel & 0xf800) >> 6) | - ((*src_pixel & 0xf8) >> 3); - } - - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x].\n", - counter++, *dst_pixel); - #endif - - src_pixel++; - dst_pixel++; - } - - return 1; -} - -static int Pack32To24(unsigned int src_data_size, XImage *src_image, XImage *dst_image) -{ - unsigned int *src_pixel = (unsigned int *) src_image -> data; - unsigned char *dst_pixel = (unsigned char *) dst_image -> data; - - #ifdef DEBUG - unsigned int counter = 0; - #endif - - while (src_pixel < ((unsigned int *) (src_image -> data + src_data_size))) - { - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] value [0x%x] red [0x%x] green [0x%x] blue [0x%x].\n", - counter, *src_pixel, ((*src_pixel & 0xff0000) >> 16), - ((*src_pixel & 0x00ff00) >> 8), (*src_pixel & 0xff)); - #endif - - if (*src_pixel == 0x0) - { - dst_pixel[0] = dst_pixel[1] = dst_pixel[2] = 0x0; - } - else if (*src_pixel == 0xffffff) - { - dst_pixel[0] = dst_pixel[1] = dst_pixel[2] = 0xff; - } - else - { - dst_pixel[0] = (*src_pixel & 0xff0000) >> 16; - dst_pixel[1] = (*src_pixel & 0x00ff00) >> 8; - dst_pixel[2] = (*src_pixel & 0x0000ff); - } - - #ifdef DEBUG - fprintf(stderr, "******PackImage: Pixel [%d] destination [0x%x], [0x%x], [0x%x].\n", - counter++, dst_pixel[0], dst_pixel[1], dst_pixel[2]); - #endif - - src_pixel += 1; - dst_pixel += 3; - } - - return 1; -} - -int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, - unsigned int dst_data_size, XImage *dst_image) -{ - unsigned int src_bits_per_pixel; - unsigned int dst_bits_per_pixel; - - src_bits_per_pixel = src_image -> bits_per_pixel; - dst_bits_per_pixel = MethodBitsPerPixel(method); - - #ifdef TEST - fprintf(stderr, "******PackImage: Source bits per pixel [%d], destination bits per pixel [%d].\n", - src_bits_per_pixel, dst_bits_per_pixel); - - fprintf(stderr, "******PackImage: Source data size [%d], destination data size [%d].\n", - src_data_size, dst_data_size); - #endif - - if (dst_bits_per_pixel >= src_bits_per_pixel) - { - #ifdef PANIC - fprintf(stderr, "******PackImage: PANIC! Cannot pack image from [%d] to [%d] bytes per pixel.\n", - src_bits_per_pixel, dst_bits_per_pixel); - #endif - - return 0; - } - - switch (src_bits_per_pixel) - { - case 16: - { - switch (dst_bits_per_pixel) - { - case 8: - { - return Pack16To8(src_data_size, src_image, dst_image); - } - default: - { - return 0; - } - } - } - case 24: - { - switch (dst_bits_per_pixel) - { - case 8: - { - return Pack24To8(src_data_size, src_image, dst_image); - } - case 16: - { - return Pack24To16(src_data_size, src_image, dst_image); - } - default: - { - return 0; - } - } - } - case 32: - { - switch (dst_bits_per_pixel) - { - case 8: - { - return Pack32To8(src_data_size, src_image, dst_image); - } - case 16: - { - return Pack32To16(src_data_size, src_image, dst_image); - } - case 24: - { - return Pack32To24(src_data_size, src_image, dst_image); - } - default: - { - return 0; - } - } - } - default: - { - return 0; - } - } -} - -/* - * Replace the ffs() call that may be not - * present on some systems. - */ - -int FindLSB(int word) -{ - int t = word; - - int m = 1; - int i = 0; - - for (; i < sizeof(word) << 3; i++, m <<= 1) - { - if (t & m) - { - return i + 1; - } - } - - return 0; -} - diff --git a/nxcompext/Mask.h b/nxcompext/Mask.h deleted file mode 100644 index 1b6fe6d99..000000000 --- a/nxcompext/Mask.h +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Mask_H -#define Mask_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include "Xlib.h" - -extern int MaskImage(const ColorMask *mask, XImage *src_image, XImage *dst_image); - -extern int MaskInPlaceImage(const ColorMask *mask, XImage *image); - -extern int PackImage(unsigned int method, unsigned int src_data_size, XImage *src_image, - unsigned int dst_data_size, XImage *dst_image); - -int FindLSB(int word); - -#ifdef __cplusplus -} -#endif - -#endif /* Mask_H */ diff --git a/nxcompext/NXlib.c b/nxcompext/NXlib.c deleted file mode 100644 index 0b8126557..000000000 --- a/nxcompext/NXlib.c +++ /dev/null @@ -1,4776 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#ifndef __sun -#include -#endif - -#include "NX.h" - -#include "dix.h" -#include "os.h" - -/* - * Needed to enable definition of the callback - * functions. - */ - -#define NX_TRANS_SOCKET - -#include "Xlib.h" -#include "Xutil.h" -#include "Xlibint.h" - -#include "NXlib.h" -#include "NXproto.h" -#include "NXpack.h" - -#include "Clean.h" -#include "Mask.h" -#include "Colormap.h" -#include "Alpha.h" -#include "Bitmap.h" -#include "Jpeg.h" -#include "Pgn.h" -#include "Rgb.h" -#include "Rle.h" -#include "Z.h" - -#include "MD5.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -/* - * Maximum number of colors allowed in - * Png encoding. - */ - -#define NB_COLOR_MAX 256 - -/* - * Dummy error handlers used internally to catch - * Xlib failures in replies. - */ - -static int _NXInternalReplyErrorFunction(Display *dpy, XErrorEvent *error); - -static void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, - unsigned long lastseq, unsigned int type); - -/* - * Resource ids that can be requested by - * the client for use in split or unpack - * operations. - */ - -static unsigned char _NXSplitResources[NXNumberOfResources]; -static unsigned char _NXUnpackResources[NXNumberOfResources]; - -static Display *_NXDisplayInitialized = NULL; - -/* - * Used in asynchronous handling of - * GetImage replies. - */ - -typedef struct -{ - unsigned long sequence; - unsigned int resource; - unsigned long mask; - int format; - int width; - int height; - _XAsyncHandler *handler; - XImage *image; -} _NXCollectImageState; - -static _NXCollectImageState *_NXCollectedImages[NXNumberOfResources]; - -/* - * Used in asynchronous handling of - * GetProperty replies. - */ - -typedef struct -{ - unsigned long sequence; - unsigned int resource; - Window window; - Atom property; - Atom type; - int format; - unsigned long items; - unsigned long after; - _XAsyncHandler *handler; - char *data; -} _NXCollectPropertyState; - -static _NXCollectPropertyState *_NXCollectedProperties[NXNumberOfResources]; - -/* - * Used in asynchronous handling of - * GrabPointer replies. - */ - -typedef struct -{ - unsigned long sequence; - unsigned int resource; - int status; - _XAsyncHandler *handler; -} _NXCollectGrabPointerState; - -static _NXCollectGrabPointerState *_NXCollectedGrabPointers[NXNumberOfResources]; - -/* - * Used in asynchronous handling of - * GetInputFocus replies. - */ - -typedef struct -{ - unsigned long sequence; - unsigned int resource; - Window focus; - int revert_to; - _XAsyncHandler *handler; -} _NXCollectInputFocusState; - -static _NXCollectInputFocusState *_NXCollectedInputFocuses[NXNumberOfResources]; - -/* - * Used by functions handling cache of - * packed images. - */ - -#define MD5_LENGTH 16 - -typedef struct -{ - md5_byte_t *md5; - XImage *image; - unsigned int method; -} _NXImageCacheEntry; - -int NXImageCacheSize = 0; -int NXImageCacheHits = 0; -int NXImageCacheOps = 0; - -_NXImageCacheEntry *NXImageCache = NULL; - -#ifdef DUMP - -void _NXCacheDump(const char *label); - -void _NXDumpData(const unsigned char *buffer, unsigned int size); - -#endif - -/* - * From X11/PutImage.c. - * - * Cancel a GetReq operation, before doing - * _XSend or Data. - */ - -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define UnGetReq(name)\ - dpy->bufptr -= SIZEOF(x##name##Req);\ - dpy->request-- -#else -#define UnGetReq(name)\ - dpy->bufptr -= SIZEOF(x/**/name/**/Req);\ - dpy->request-- -#endif - -#if (defined(__STDC__) && !defined(UNIXCPP)) || defined(ANSICPP) -#define UnGetEmptyReq()\ - dpy->bufptr -= 4;\ - dpy->request-- -#else -#define UnGetEmptyReq(name)\ - dpy->bufptr -= 4;\ - dpy->request-- -#endif - -/* - * From X11/ImUtil.c. - */ - -extern int _XGetBitsPerPixel(Display *dpy, int depth); -extern int _XGetScanlinePad(Display *dpy, int depth); - -#define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & \ - ~(long)((pad) - 1)) - -static unsigned int DepthOnes(unsigned long mask) -{ - register unsigned long y; - - y = (mask >> 1) &033333333333; - y = mask - y - ((y >>1) & 033333333333); - return ((unsigned int) (((y + (y >> 3)) & - 030707070707) % 077)); -} - -#define CanMaskImage(image, mask) \ -\ -(image -> format == ZPixmap && mask != NULL && \ - (image -> depth == 32 || image -> depth == 24 || \ - (image -> depth == 16 && (image -> red_mask == 0xf800 && \ - image -> green_mask == 0x7e0 && image -> blue_mask == 0x1f)))) - -#define ShouldMaskImage(image, mask) (mask -> color_mask != 0xff) - -/* - * Initialize and reset the internal structures. - */ - -extern int _NXInternalInitResources(Display *dpy); -extern int _NXInternalResetResources(Display *dpy); -extern int _NXInternalInitEncoders(Display *dpy); -extern int _NXInternalResetEncoders(Display *dpy); - -int NXInitDisplay(Display *dpy) -{ - #ifdef TEST - fprintf(stderr, "******NXInitDisplay: Called for display at [%p].\n", (void *) dpy); - #endif - - if (_NXDisplayInitialized == NULL) - { - _NXInternalInitResources(dpy); - - _NXInternalInitEncoders(dpy); - - _NXDisplayInitialized = dpy; - - return 1; - } - - #ifdef TEST - fprintf(stderr, "******NXInitDisplay: WARNING! Internal structures already initialized.\n"); - #endif - - return 0; -} - -int NXResetDisplay(Display *dpy) -{ - #ifdef TEST - fprintf(stderr, "******NXResetDisplay: Called for display at [%p].\n", (void *) dpy); - #endif - - if (_NXDisplayInitialized != NULL) - { - _NXInternalResetResources(dpy); - - _NXInternalResetEncoders(dpy); - - _NXDisplayInitialized = NULL; - - return 1; - } - - #ifdef TEST - fprintf(stderr, "******NXResetDisplay: WARNING! Internal structures already reset.\n"); - #endif - - return 0; -} - -int _NXInternalInitResources(Display *dpy) -{ - return _NXInternalResetResources(dpy); -} - -int _NXInternalResetResources(Display *dpy) -{ - int i; - - #ifdef TEST - fprintf(stderr, "******_NXInternalResetResources: Clearing all the internal structures.\n"); - #endif - - for (i = 0; i < NXNumberOfResources; i++) - { - _NXSplitResources[i] = 0; - _NXUnpackResources[i] = 0; - - if (_NXCollectedImages[i] != NULL) - { - #ifdef TEST - fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect image data " - "for resource [%d].\n", i); - #endif - - if (_NXCollectedImages[i] -> handler != NULL) - { - DeqAsyncHandler(dpy, _NXCollectedImages[i] -> handler); - - Xfree(_NXCollectedImages[i] -> handler); - } - - if (_NXCollectedImages[i] -> image != NULL) - { - XDestroyImage(_NXCollectedImages[i] -> image); - } - - Xfree(_NXCollectedImages[i]); - - _NXCollectedImages[i] = NULL; - } - - if (_NXCollectedProperties[i] != NULL) - { - #ifdef TEST - fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect property data " - "for resource [%d].\n", i); - #endif - - if (_NXCollectedProperties[i] -> handler != NULL) - { - DeqAsyncHandler(dpy, _NXCollectedProperties[i] -> handler); - - Xfree(_NXCollectedProperties[i] -> handler); - } - - if (_NXCollectedProperties[i] -> data != NULL) - { - Xfree(_NXCollectedProperties[i] -> data); - } - - Xfree(_NXCollectedProperties[i]); - - _NXCollectedProperties[i] = NULL; - } - - if (_NXCollectedGrabPointers[i] != NULL) - { - #ifdef TEST - fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing grab pointer data " - "for resource [%d].\n", i); - #endif - - if (_NXCollectedGrabPointers[i] -> handler != NULL) - { - DeqAsyncHandler(dpy, _NXCollectedGrabPointers[i] -> handler); - - Xfree(_NXCollectedGrabPointers[i] -> handler); - } - - Xfree(_NXCollectedGrabPointers[i]); - - _NXCollectedGrabPointers[i] = NULL; - } - - if (_NXCollectedInputFocuses[i] != NULL) - { - #ifdef TEST - fprintf(stderr, "******_NXInternalResetResources: WARNING! Clearing collect input focus data " - "for resource [%d].\n", i); - #endif - - if (_NXCollectedInputFocuses[i] -> handler != NULL) - { - DeqAsyncHandler(dpy, _NXCollectedInputFocuses[i] -> handler); - - Xfree(_NXCollectedInputFocuses[i] -> handler); - } - - Xfree(_NXCollectedInputFocuses[i]); - - _NXCollectedInputFocuses[i] = NULL; - } - } - - return 1; -} - -int _NXInternalInitEncoders(Display *dpy) -{ - ZInitEncoder(); - - return 1; -} - -int _NXInternalResetEncoders(Display *dpy) -{ - ZResetEncoder(); - - return 1; -} - -int NXSetDisplayPolicy(Display *dpy, int policy) -{ - if (policy == NXPolicyImmediate) - { - return NXTransPolicy(NX_FD_ANY, NX_POLICY_IMMEDIATE); - } - else - { - return NXTransPolicy(NX_FD_ANY, NX_POLICY_DEFERRED); - } -} - -int NXSetDisplayBuffer(Display *dpy, int size) -{ - /* - * This is not multi-thread safe, so, - * if you have threads, be sure that - * they are stopped. - */ - - char *buffer; - - XFlush(dpy); - - if (dpy -> bufmax - size == dpy -> buffer) - { - #ifdef TEST - fprintf(stderr, "******NXSetDisplayBuffer: Nothing to do with buffer size matching.\n"); - #endif - - return 1; - } - else if (dpy -> bufptr != dpy -> buffer) - { - #ifdef PANIC - fprintf(stderr, "******NXSetDisplayBuffer: PANIC! The display buffer is not empty.\n"); - #endif - - return -1; - } - else if ((buffer = Xcalloc(1, size)) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXSetDisplayBuffer: PANIC! Can't allocate [%d] bytes for the buffer.\n", - size); - #endif - - return -1; - } - - if (dpy -> buffer != NULL) - { - Xfree(dpy -> buffer); - } - - dpy -> buffer = buffer; - dpy -> bufptr = dpy -> buffer; - dpy -> bufmax = dpy -> bufptr + size; - - #ifdef TEST - fprintf(stderr, "******NXSetDisplayBuffer: Set the display output buffer size to [%d].\n", - size); - #endif - - return 1; -} - -/* - * If set, the Popen() function in the X server - * wil remove the LD_LIBRARY_PATH variable from - * the environment before calling the execl() - * function on the child process. - */ - -int NXUnsetLibraryPath(int value) -{ - int previous = _NXUnsetLibraryPath; - - _NXUnsetLibraryPath = value; - - #ifdef TEST - fprintf(stderr, "******NXUnsetLibraryPath: Set the flag to [%d] with previous value [%d].\n", - value, previous); - #endif - - return previous; -} - -/* - * If set, the Xlib I/O error handler will simply - * return, instead of quitting the program. This - * leaves to the application the responsibility - * of checking the state of the XlibDisplayIOEr- - * ror flag. - */ - -int NXHandleDisplayError(int value) -{ - int previous = _NXHandleDisplayError; - - _NXHandleDisplayError = value; - - #ifdef TEST - fprintf(stderr, "******NXHandleDisplayError: Set the flag to [%d] with previous value [%d].\n", - value, previous); - #endif - - return previous; -} - -/* - * Shutdown the display descriptor and force Xlib - * to set the I/O error flag. - */ - -Bool NXForceDisplayError(Display *dpy) -{ - if (dpy != NULL) - { - NXTransClose(dpy -> fd); - - if (!(dpy -> flags & XlibDisplayIOError)) - { - shutdown(dpy -> fd, SHUT_RDWR); - - _XIOError(dpy); - } - - return 1; - } - - return 0; -} - -/* - * Check if the display has become invalid. Similarly - * to the modified Xlib, we call the predicate funct- - * ion with the value of the XlibDisplayIOError flag - * only if the I/O error was not encountered already. - * The application can use this function to query the - * XlibDisplayIOError flag because Xlib doesn't expose - * the internals of the display structure to the appli- - * cation. - */ - -int NXDisplayError(Display *dpy) -{ - if (dpy != NULL) - { - return (_XGetIOError(dpy) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))); - } - - return 1; -} - -/* - * Various queries related to the state of the - * display connection. - */ - -int NXDisplayReadable(Display *dpy) -{ - int result; - int readable; - - result = NXTransReadable(dpy -> fd, &readable); - - if (result == 0) - { - #ifdef DEBUG - fprintf(stderr, "******NXDisplayReadable: Returning [%d] bytes readable from fd [%d].\n", - readable, dpy -> fd); - #endif - - return readable; - } - - #ifdef DEBUG - fprintf(stderr, "******NXDisplayReadable: WARNING! Error detected on display fd [%d].\n", - dpy -> fd); - #endif - - return -1; -} - -int NXDisplayFlushable(Display *dpy) -{ - #ifdef DEBUG - - int flushable; - - flushable = NXTransFlushable(dpy -> fd) + - (dpy -> bufptr - dpy -> buffer); - - fprintf(stderr, "******NXDisplayFlushable: Returning [%d+%d=%d] bytes flushable " - "to fd [%d].\n", (int) (dpy -> bufptr - dpy -> buffer), - (int) (flushable - (dpy -> bufptr - dpy -> buffer)), - flushable, dpy -> fd); - - return flushable; - - #else - - return NXTransFlushable(dpy -> fd) + (dpy -> bufptr - dpy -> buffer); - - #endif -} - -int NXDisplayCongestion(Display *dpy) -{ - #ifdef DEBUG - - int congestion = NXTransCongestion(dpy -> fd); - - fprintf(stderr, "******NXDisplayCongestion: Returning [%d] as congestion level for fd [%d].\n", - congestion, dpy -> fd); - - return congestion; - - #else - - return NXTransCongestion(dpy -> fd); - - #endif -} - -int NXFlushDisplay(Display *dpy, int what) -{ - if (!(dpy -> flags & XlibDisplayWriting) && - dpy -> bufptr - dpy -> buffer > 0) - { - #ifdef DEBUG - fprintf(stderr, "******NXFlushDisplay: Writing with [%d] bytes in the buffer.\n", - (int) (dpy -> bufptr - dpy -> buffer)); - #endif - - XFlush(dpy); - } - - if (what == NXFlushBuffer) - { - return 0; - } - - #ifdef DEBUG - fprintf(stderr, "******NXFlushDisplay: Flushing with [%d] bytes in the NX transport.\n", - NXDisplayFlushable(dpy)); - #endif - - return NXTransFlush(dpy -> fd); -} - -NXDisplayErrorPredicate NXSetDisplayErrorPredicate(NXDisplayErrorPredicate predicate) -{ - NXDisplayErrorPredicate previous = _NXDisplayErrorFunction; - - _NXDisplayErrorFunction = predicate; - - #ifdef TEST - fprintf(stderr, "******NXSetDisplayErrorPredicate: Set the predicate to [%p] with previous value [%p].\n", - predicate, previous); - #endif - - return previous; -} - -NXDisplayBlockHandler NXSetDisplayBlockHandler(NXDisplayBlockHandler handler) -{ - NXDisplayBlockHandler previous = _NXDisplayBlockFunction; - - _NXDisplayBlockFunction = handler; - - #ifdef TEST - fprintf(stderr, "******NXSetDisplayBlockHandler: Set the handler to [%p] with previous value [%p].\n", - handler, previous); - #endif - - return previous; -} - -NXDisplayWriteHandler NXSetDisplayWriteHandler(NXDisplayWriteHandler handler) -{ - NXDisplayWriteHandler previous = _NXDisplayWriteFunction; - - _NXDisplayWriteFunction = handler; - - #ifdef TEST - fprintf(stderr, "******NXSetDisplayWriteHandler: Set the handler to [%p] with previous value [%p].\n", - handler, previous); - #endif - - return previous; -} - -NXDisplayFlushHandler NXSetDisplayFlushHandler(NXDisplayFlushHandler handler, Display *display) -{ - NXDisplayFlushHandler previous = _NXDisplayFlushFunction; - - _NXDisplayFlushFunction = handler; - - NXTransHandler(NX_FD_ANY, NX_HANDLER_FLUSH, - (void (*)(void *, int)) handler, (void *) display); - - #ifdef TEST - fprintf(stderr, "******NXSetDisplayFlushHandler: Set the handler to [%p] with display [%p] " - "and previous value [%p].\n", handler, display, previous); - #endif - - return previous; -} - -NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler(NXDisplayStatisticsHandler handler, char **buffer) -{ - NXDisplayStatisticsHandler previous = _NXDisplayStatisticsFunction; - - _NXDisplayStatisticsFunction = handler; - - /* - * Propagate the handler. - */ - - NXTransHandler(NX_FD_ANY, NX_HANDLER_STATISTICS, - (void (*)(void *, int)) handler, (void *) buffer); - - #ifdef TEST - fprintf(stderr, "******NXSetDisplayStatisticsHandler: Set the handler to [%p] with buffer pointer [%p] " - "and previous value [%p].\n", handler, buffer, previous); - #endif - - return previous; -} - -NXLostSequenceHandler NXSetLostSequenceHandler(NXLostSequenceHandler handler) -{ - NXLostSequenceHandler previous = _NXLostSequenceFunction; - - _NXLostSequenceFunction = handler; - - #ifdef TEST - fprintf(stderr, "******NXSetLostSequenceHandler: Set the handler to [%p] with previous value [%p].\n", - handler, previous); - #endif - - return previous; -} - -int _NXInternalReplyErrorFunction(Display *dpy, XErrorEvent *error) -{ - #ifdef TEST - fprintf(stderr, "******_NXInternalReplyErrorFunction: Internal error handler called.\n"); - #endif - - return 0; -} - -void _NXInternalLostSequenceFunction(Display *dpy, unsigned long newseq, - unsigned long lastseq, unsigned int type) -{ - #ifdef TEST - - fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Sequence lost with new " - "sequence %ld last request %ld.\n", newseq, dpy -> request); - - /* - * TODO: Reply or event info must be implemented. - * - * fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Expected event or reply " - * "was %ld with sequence %ld.\n", (long) rep -> type, (long) rep -> sequenceNumber); - */ - - fprintf(stderr, "******_NXInternalLostSequenceFunction: WARNING! Last sequence read " - "was %ld display request is %ld.\n", lastseq & 0xffff, dpy -> request & 0xffff); - - #endif -} - -Status NXGetControlParameters(Display *dpy, unsigned int *link_type, unsigned int *local_major, - unsigned int *local_minor, unsigned int *local_patch, - unsigned int *remote_major, unsigned int *remote_minor, - unsigned int *remote_patch, int *split_timeout, int *motion_timeout, - int *split_mode, int *split_size, unsigned int *pack_method, - unsigned int *pack_quality, int *data_level, int *stream_level, - int *delta_level, unsigned int *load_cache, - unsigned int *save_cache, unsigned int *startup_cache) -{ - xNXGetControlParametersReply rep; - - register xReq *req; - - LockDisplay(dpy); - - GetEmptyReq(NXGetControlParameters, req); - - #ifdef TEST - fprintf(stderr, "******NXGetControlParameters: Sending message opcode [%d].\n", - X_NXGetControlParameters); - #endif - - if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) - { - #ifdef TEST - fprintf(stderr, "******NXGetControlParameters: Error receiving reply.\n"); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - - #ifdef TEST - fprintf(stderr, "******NXGetControlParameters: Got reply with link type [%u].\n", rep.linkType); - - fprintf(stderr, "******NXGetControlParameters: Local protocol major [%u] minor [%u] patch [%u].\n", - rep.localMajor, rep.localMinor, rep.localPatch); - - fprintf(stderr, "******NXGetControlParameters: Remote protocol major [%u] minor [%u] patch [%u].\n", - rep.remoteMajor, rep.remoteMinor, rep.remotePatch); - - fprintf(stderr, "******NXGetControlParameters: Split timeout [%d] motion timeout [%d].\n", - (int) rep.splitTimeout, (int) rep.motionTimeout); - - fprintf(stderr, "******NXGetControlParameters: Split mode [%d] split size [%d].\n", - (int) rep.splitMode, (int) rep.splitSize); - - fprintf(stderr, "******NXGetControlParameters: Preferred pack method [%d] pack quality [%d].\n", - (int) rep.packMethod, (int) rep.packQuality); - - fprintf(stderr, "******NXGetControlParameters: Data level [%d] stream level [%d] delta level [%d].\n", - rep.dataLevel, rep.streamLevel, rep.deltaLevel); - #endif - - *link_type = rep.linkType; - - *local_major = rep.localMajor; - *local_minor = rep.localMinor; - *local_patch = rep.localPatch; - - *remote_major = rep.remoteMajor; - *remote_minor = rep.remoteMinor; - *remote_patch = rep.remotePatch; - - *split_timeout = rep.splitTimeout; - *motion_timeout = rep.motionTimeout; - - *split_mode = rep.splitMode; - *split_size = rep.splitSize; - - *pack_method = rep.packMethod; - *pack_quality = rep.packQuality; - - *data_level = rep.dataLevel; - *stream_level = rep.streamLevel; - *delta_level = rep.deltaLevel; - - *load_cache = rep.loadCache; - *save_cache = rep.saveCache; - *startup_cache = rep.startupCache; - - UnlockDisplay(dpy); - - SyncHandle(); - - /* - * Install our internal out-of-sync handler. - */ - - _NXLostSequenceFunction = _NXInternalLostSequenceFunction; - - return 1; -} - -/* - * Which unpack methods are supported by the - * remote proxy? - */ - -Status NXGetUnpackParameters(Display *dpy, unsigned int *entries, unsigned char supported_methods[]) -{ - register xNXGetUnpackParametersReq *req; - - xNXGetUnpackParametersReply rep; - - register unsigned n; - - #ifdef TEST - register unsigned i; - #endif - - if (*entries < NXNumberOfPackMethods) - { - #ifdef TEST - fprintf(stderr, "******NXGetUnpackParameters: Requested only [%d] entries while they should be [%d].\n", - *entries, NXNumberOfPackMethods); - #endif - - return 0; - } - - LockDisplay(dpy); - - GetReq(NXGetUnpackParameters, req); - - req -> entries = *entries; - - #ifdef TEST - fprintf(stderr, "******NXGetUnpackParameters: Sending message opcode [%d] with [%d] requested entries.\n", - X_NXGetUnpackParameters, *entries); - #endif - - if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) - { - #ifdef TEST - fprintf(stderr, "******NXGetUnpackParameters: Error receiving reply.\n"); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - - if ((n = rep.length << 2) > *entries) - { - #ifdef TEST - fprintf(stderr, "******NXGetUnpackParameters: Got [%d] bytes of reply data while they should be [%d].\n", - n, *entries); - #endif - - _XEatData(dpy, (unsigned long) n); - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - - *entries = n; - - #ifdef TEST - fprintf(stderr, "******NXGetUnpackParameters: Reading [%d] bytes of reply data.\n", n); - #endif - - _XReadPad(dpy, (char *) supported_methods, n); - - #ifdef TEST - - fprintf(stderr, "******NXGetUnpackParameters: Got reply with methods: "); - - for (i = 0; i < n; i++) - { - if (supported_methods[i] != 0) - { - fprintf(stderr, "[%d]", i); - } - } - - fprintf(stderr, ".\n"); - - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Query and enable the MIT-SHM support between the - * proxy and the X server. The 'enable' flags must be - * true if shared memory PutImages and PutPackedImages - * are desired. On return the flags will say if support - * has been successfully enabled. - * - * Note that the the client part is not useful and not - * implemented. The size of the segment is chosen by - * the proxy. The main purpose of the message is to - * reserve the XID that will be used by the remote. - */ - -Status NXGetShmemParameters(Display *dpy, unsigned int *enable_client, - unsigned int *enable_server, unsigned int *client_segment, - unsigned int *server_segment, unsigned int *client_size, - unsigned int *server_size) -{ - register xNXGetShmemParametersReq *req; - - register int stage; - - xNXGetShmemParametersReply rep; - - /* - * Save the previous handler. - */ - - int (*handler)(Display *, XErrorEvent *) = _XErrorFunction; - - *client_segment = 0; - *server_segment = 0; - - if (*enable_client) - { - *client_segment = XAllocID(dpy); - } - - if (*enable_server) - { - *server_segment = XAllocID(dpy); - } - - LockDisplay(dpy); - - _XErrorFunction = _NXInternalReplyErrorFunction; - - for (stage = 0; stage < 3; stage++) - { - GetReq(NXGetShmemParameters, req); - - req -> stage = stage; - - req -> enableClient = (*enable_client != 0 ? 1 : 0); - req -> enableServer = (*enable_server != 0 ? 1 : 0); - - req -> clientSegment = *client_segment; - req -> serverSegment = *server_segment; - - #ifdef TEST - fprintf(stderr, "******NXGetShmemParameters: Sending message opcode [%d] at stage [%d].\n", - X_NXGetShmemParameters, stage); - #endif - - #ifdef TEST - - if (stage == 0) - { - fprintf(stderr, "******NXGetShmemParameters: Enable client is [%u] enable server is [%u].\n", - *enable_client, *enable_server); - - fprintf(stderr, "******NXGetShmemParameters: Client segment is [%u] server segment is [%u].\n", - *client_segment, *server_segment); - } - - #endif - - /* - * There isn't X server reply in the second stage. - * The procedure followed at X server side is: - * - * Stage 0: Send X_QueryExtension and masquerade - * the reply. - * - * Stage 1: Allocate the shared memory and send - * X_ShmAttach to the X server. - * - * Stage 2: Send X_GetInputFocus and masquerade - * the reply. - * - * The last message is used to force a reply and - * collect any X error caused by a failure in the - * shared memory initialization. - */ - - if (stage != 1) - { - /* - * We are only interested in the final reply. - */ - - if (_XReply(dpy, (xReply *) &rep, 0, xTrue) == xFalse) - { - #ifdef TEST - fprintf(stderr, "******NXGetShmemParameters: Error receiving reply.\n"); - #endif - - _XErrorFunction = handler; - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - } - } - - /* - * Return the settings to client. - */ - - *enable_client = rep.clientEnabled; - *enable_server = rep.serverEnabled; - - *client_size = rep.clientSize; - *server_size = rep.serverSize; - - #ifdef TEST - fprintf(stderr, "******NXGetShmemParameters: Got final reply with enabled client [%u] and server [%u].\n", - *enable_client, *enable_server); - - fprintf(stderr, "******NXGetShmemParameters: Client segment size [%u] server segment size [%u].\n", - *client_size, *server_size); - #endif - - _XErrorFunction = handler; - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Get the path to the font server that can be used by the X - * server to tunnel the font connections across the NX link. - * The path actually represents the TCP port where the proxy - * on the NX client side is listening. The agent can tempora- - * rily enable the tunneling when it needs a font that is not - * available on the client, for example when the session is - * migrated from a different X server. - * - * Note that it is not advisable to use the font server chan- - * nel for other purposes than restoring a font that is found - * missing at the time the session is migrated to a different - * display. This is because the agent implements a caching of - * the list of fonts supported by the client as it needs to - * advertise only the fonts that can be opened at both sides. - */ - -Status NXGetFontParameters(Display *dpy, unsigned int path_length, char path_data[]) -{ - register xNXGetFontParametersReq *req; - - xNXGetFontParametersReply rep; - - register unsigned n; - - #ifdef TEST - register unsigned i; - #endif - - if (path_length < 1) - { - #ifdef TEST - fprintf(stderr, "******NXGetFontParameters: No room to store the reply.\n"); - #endif - - return 0; - } - - *path_data = '\0'; - - LockDisplay(dpy); - - GetReq(NXGetFontParameters, req); - - #ifdef TEST - fprintf(stderr, "******NXGetFontParameters: Sending message opcode [%d].\n", - X_NXGetFontParameters); - #endif - - if (_XReply(dpy, (xReply *) &rep, 0, xFalse) == xFalse || rep.length == 0) - { - #ifdef TEST - fprintf(stderr, "******NXGetFontParameters: Error receiving reply.\n"); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - - if ((n = rep.length << 2) > path_length) - { - #ifdef TEST - fprintf(stderr, "******NXGetFontParameters: Got [%d] bytes of reply data with only room for [%d].\n", - n, path_length); - #endif - - _XEatData(dpy, (unsigned long) n); - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - - #ifdef TEST - fprintf(stderr, "******NXGetFontParameters: Reading [%d] bytes of reply data.\n", n); - #endif - - _XReadPad(dpy, (char *) path_data, n); - - /* - * Check if the string can be fully - * contained by the buffer. - */ - - if (*path_data > path_length - 1) - { - #ifdef TEST - fprintf(stderr, "******NXGetFontParameters: Inconsistent length in the returned string.\n"); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 0; - } - - #ifdef TEST - - fprintf(stderr, "******NXGetFontParameters: Got font path of [%d] bytes and value [", - (int) *path_data); - - for (i = 0; i < *path_data; i++) - { - fprintf(stderr, "%c", *(path_data + i + 1)); - } - - fprintf(stderr, "].\n"); - - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -unsigned int NXAllocSplit(Display *dpy, unsigned int resource) -{ - if (resource == NXAnyResource) - { - for (resource = 0; resource < NXNumberOfResources; resource++) - { - if (_NXSplitResources[resource] == 0) - { - _NXSplitResources[resource] = 1; - - #ifdef TEST - fprintf(stderr, "******NXAllocSplit: Reserved resource [%u].\n", - resource); - #endif - - return resource; - } - } - - #ifdef TEST - fprintf(stderr, "******NXAllocSplit: WARNING! Resource limit exausted.\n"); - #endif - - return NXNoResource; - } - else if (resource >= 0 && resource < NXNumberOfResources) - { - #ifdef TEST - - if (_NXSplitResources[resource] == 0) - { - fprintf(stderr, "******NXAllocSplit: Reserved requested resource [%u].\n", - resource); - } - else - { - fprintf(stderr, "******NXAllocSplit: Requested resource [%u] already reserved.\n", - resource); - } - - #endif - - _NXSplitResources[resource] = 1; - } - - #ifdef PANIC - fprintf(stderr, "******NXAllocSplit: PANIC! Can't reserve requested resource [%u].\n", - resource); - #endif - - return NXNoResource; -} - -/* - * Tell the proxy to split the next messages. - */ - -int NXStartSplit(Display *dpy, unsigned int resource, unsigned int mode) -{ - register xNXStartSplitReq *req; - - LockDisplay(dpy); - - GetReq(NXStartSplit, req); - - req -> resource = resource; - req -> mode = mode; - - #ifdef TEST - fprintf(stderr, "******NXStartSplit: Sending opcode [%d] with resource [%d] mode [%d].\n", - X_NXStartSplit, resource, mode); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Send the closure of the split sequence and - * tell the proxy to send the results. - */ - -int NXEndSplit(Display *dpy, unsigned int resource) -{ - register xNXEndSplitReq *req; - - LockDisplay(dpy); - - GetReq(NXEndSplit, req); - - req -> resource = resource; - - #ifdef TEST - fprintf(stderr, "******NXEndSplit: Sending opcode [%d] with resource [%d].\n", - X_NXStartSplit, resource); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * This message must be sent whenever the proxy notifies - * the client of the completion of a split. If the 'pro- - * pagate' field is 0, the proxy will not send the ori- - * ginal request to the X server, but will only free the - * internal state. - */ - -int NXCommitSplit(Display *dpy, unsigned int resource, unsigned int propagate, - unsigned char request, unsigned int position) -{ - register xNXCommitSplitReq *req; - - LockDisplay(dpy); - - GetReq(NXCommitSplit, req); - - req -> resource = resource; - req -> propagate = propagate; - req -> request = request; - req -> position = position; - - #ifdef TEST - fprintf(stderr, "******NXCommitSplit: Sending opcode [%d] with resource [%d] propagate [%d] " - "request [%d] position [%d].\n", X_NXCommitSplit, resource, - propagate, request, position); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -int NXAbortSplit(Display *dpy, unsigned int resource) -{ - register xNXAbortSplitReq *req; - - LockDisplay(dpy); - - GetReq(NXAbortSplit, req); - - #ifdef TEST - fprintf(stderr, "******NXAbortSplit: Sending message opcode [%d] with resource [%u].\n", - X_NXAbortSplit, resource); - #endif - - req -> resource = resource; - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -int NXFinishSplit(Display *dpy, unsigned int resource) -{ - register xNXFinishSplitReq *req; - - LockDisplay(dpy); - - GetReq(NXFinishSplit, req); - - #ifdef TEST - fprintf(stderr, "******NXFinishSplit: Sending message opcode [%d] with resource [%u].\n", - X_NXFinishSplit, resource); - #endif - - req -> resource = resource; - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -int NXFreeSplit(Display *dpy, unsigned int resource) -{ - register xNXFreeSplitReq *req; - - if (_NXSplitResources[resource] != 0) - { - LockDisplay(dpy); - - GetReq(NXFreeSplit, req); - - #ifdef TEST - fprintf(stderr, "******NXFreeSplit: Sending message opcode [%d] with resource [%u].\n", - X_NXFreeSplit, resource); - #endif - - req -> resource = resource; - - UnlockDisplay(dpy); - - SyncHandle(); - - #ifdef TEST - fprintf(stderr, "******NXFreeSplit: Making the resource [%u] newly available.\n", - resource); - #endif - - _NXSplitResources[resource] = 0; - } - #ifdef TEST - else - { - fprintf(stderr, "******NXFreeSplit: Nothing to do for resource [%u].\n", - resource); - } - #endif - - return 1; -} - -/* - * Tell to remote proxy to discard expose events - * of one or more types. - */ - -int NXSetExposeParameters(Display *dpy, int expose, int graphics_expose, int no_expose) -{ - register xNXSetExposeParametersReq *req; - - LockDisplay(dpy); - - GetReq(NXSetExposeParameters, req); - - req -> expose = expose; - req -> graphicsExpose = graphics_expose; - req -> noExpose = no_expose; - - #ifdef TEST - fprintf(stderr, "******NXSetExposeParameters: Sending message opcode [%d] with flags [%d][%d][%d].\n", - X_NXSetExposeParameters, req -> expose, req -> graphicsExpose, req -> noExpose); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Tell to the local proxy how to handle the next requests. - */ - -int NXSetCacheParameters(Display *dpy, int enable_cache, int enable_split, - int enable_save, int enable_load) -{ - register xNXSetCacheParametersReq *req; - - LockDisplay(dpy); - - GetReq(NXSetCacheParameters, req); - - req -> enableCache = enable_cache; - req -> enableSplit = enable_split; - req -> enableSave = enable_save; - req -> enableLoad = enable_load; - - #ifdef TEST - fprintf(stderr, "******NXSetCacheParameters: Sending message opcode [%d] with " - "flags [%d][%d][%d][%d].\n", X_NXSetCacheParameters, req -> enableCache, - req -> enableSplit, req -> enableSave, req -> enableLoad); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -unsigned int NXAllocUnpack(Display *dpy, unsigned int resource) -{ - if (resource == NXAnyResource) - { - for (resource = 0; resource < NXNumberOfResources; resource++) - { - if (_NXUnpackResources[resource] == 0) - { - _NXUnpackResources[resource] = 1; - - #ifdef TEST - fprintf(stderr, "******NXAllocUnpack: Reserved resource [%u].\n", - resource); - #endif - - return resource; - } - } - - #ifdef TEST - fprintf(stderr, "******NXAllocUnpack: WARNING! Resource limit exausted.\n"); - #endif - - return NXNoResource; - } - else if (resource >= 0 && resource < NXNumberOfResources) - { - #ifdef TEST - - if (_NXUnpackResources[resource] == 0) - { - fprintf(stderr, "******NXAllocUnpack: Reserved requested resource [%u].\n", - resource); - } - else - { - fprintf(stderr, "******NXAllocUnpack: Requested resource [%u] already reserved.\n", - resource); - } - - #endif - - _NXUnpackResources[resource] = 1; - } - - #ifdef PANIC - fprintf(stderr, "******NXAllocUnpack: PANIC! Can't reserve requested resource [%u].\n", - resource); - #endif - - return NXNoResource; -} - -int NXSetUnpackGeometry(Display *dpy, unsigned int resource, Visual *visual) -{ - register xNXSetUnpackGeometryReq *req; - - LockDisplay(dpy); - - GetReq(NXSetUnpackGeometry, req); - - req -> resource = resource; - - req -> depth1Bpp = _XGetBitsPerPixel(dpy, 1); - req -> depth4Bpp = _XGetBitsPerPixel(dpy, 4); - req -> depth8Bpp = _XGetBitsPerPixel(dpy, 8); - req -> depth16Bpp = _XGetBitsPerPixel(dpy, 16); - req -> depth24Bpp = _XGetBitsPerPixel(dpy, 24); - req -> depth32Bpp = _XGetBitsPerPixel(dpy, 32); - - if (visual != NULL) - { - req -> redMask = visual -> red_mask; - req -> greenMask = visual -> green_mask; - req -> blueMask = visual -> blue_mask; - } - else - { - #ifdef PANIC - fprintf(stderr, "******NXSetUnpackGeometry: PANIC! Can't set the geometry without a visual.\n"); - #endif - - UnGetReq(NXSetUnpackGeometry); - - UnlockDisplay(dpy); - - return -1; - } - - #ifdef TEST - fprintf(stderr, "******NXSetUnpackGeometry: Resource [%u] Depth/Bpp [1/%d][4/%d][8/%d]" - "[16/%d][24/%d][32/%d].\n", resource, req -> depth1Bpp, req -> depth4Bpp, - req -> depth8Bpp, req -> depth16Bpp, req -> depth24Bpp, req -> depth32Bpp); - - fprintf(stderr, "******NXSetUnpackGeometry: red [0x%x] green [0x%x] blue [0x%x].\n", - (unsigned) req -> redMask, (unsigned) req -> greenMask, (unsigned) req -> blueMask); - #endif - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Store a colormap table on the remote side. - * The colormap can then be used to unpack - * an image. - */ - -int NXSetUnpackColormap(Display *dpy, unsigned int resource, unsigned int method, - unsigned int entries, const char *data, unsigned int data_length) -{ - register xNXSetUnpackColormapReq *req; - - register int dst_data_length; - - LockDisplay(dpy); - - GetReq(NXSetUnpackColormap, req); - - req -> resource = resource; - req -> method = method; - - req -> srcLength = data_length; - req -> dstLength = entries << 2; - - dst_data_length = ROUNDUP(data_length, 4); - - req -> length += (dst_data_length >> 2); - - #ifdef TEST - fprintf(stderr, "******NXSetUnpackColormap: Resource [%u] data size [%u] destination " - "data size [%u].\n", resource, data_length, dst_data_length); - #endif - - if (data_length > 0) - { - if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) - { - /* - * Clean the padding bytes in the request. - */ - - *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; - - memcpy(dpy -> bufptr, data, data_length); - - dpy -> bufptr += dst_data_length; - } - else - { - /* - * The _XSend() will pad the request for us. - */ - - _XSend(dpy, data, data_length); - } - } - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Store data of the alpha blending channel - * that will be combined with the next image - * to be unpacked. - */ - -int NXSetUnpackAlpha(Display *dpy, unsigned int resource, unsigned int method, - unsigned int entries, const char *data, unsigned int data_length) -{ - register xNXSetUnpackAlphaReq *req; - - register unsigned int dst_data_length; - - LockDisplay(dpy); - - GetReq(NXSetUnpackAlpha, req); - - req -> resource = resource; - req -> method = method; - - req -> srcLength = data_length; - req -> dstLength = entries; - - dst_data_length = ROUNDUP(data_length, 4); - - req -> length += (dst_data_length >> 2); - - #ifdef TEST - fprintf(stderr, "******NXSetUnpackAlpha: Resource [%u] data size [%u] destination data size [%u].\n", - resource, data_length, dst_data_length); - #endif - - if (data_length > 0) - { - if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) - { - /* - * Clean the padding bytes in the request. - */ - - *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; - - memcpy(dpy -> bufptr, data, data_length); - - dpy -> bufptr += dst_data_length; - } - else - { - /* - * The _XSend() will pad the request for us. - */ - - _XSend(dpy, data, data_length); - } - } - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Compatibility versions to be used when - * connected to a 1.X.X proxy. - */ - -/* - * These are for compatibility with the 1.X.X - * versions. - */ - -#define sz_xNXSetUnpackColormapCompatReq 8 - -typedef struct _NXSetUnpackColormapCompatReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD32 entries B32; -} xNXSetUnpackColormapCompatReq; - -#define X_NXSetUnpackColormapCompat X_NXSetUnpackColormap - -int NXSetUnpackColormapCompat(Display *dpy, unsigned int resource, - unsigned int entries, const char *data) -{ - register xNXSetUnpackColormapCompatReq *req; - - register char *dst_data; - - register int dst_data_length; - - #ifdef DUMP - - int i; - - #endif - - LockDisplay(dpy); - - GetReq(NXSetUnpackColormapCompat, req); - - req -> resource = resource; - req -> entries = entries; - - dst_data_length = entries << 2; - - req -> length += (dst_data_length >> 2); - - #ifdef TEST - fprintf(stderr, "******NXSetUnpackColormapCompat: Resource [%u] number of entries [%u] " - "destination data size [%u].\n", resource, entries, dst_data_length); - #endif - - if (entries > 0) - { - if ((dpy -> bufptr + dst_data_length) <= dpy -> bufmax) - { - dst_data = dpy -> bufptr; - } - else - { - if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXSetUnpackColormapCompat: PANIC! Cannot allocate memory.\n"); - #endif - - UnGetReq(NXSetUnpackColormapCompat); - - UnlockDisplay(dpy); - - return -1; - } - } - - memcpy(dst_data, data, entries << 2); - - #ifdef DUMP - - fprintf(stderr, "******NXSetUnpackColormapCompat: Dumping colormap entries:\n"); - - for (i = 0; i < entries; i++) - { - fprintf(stderr, "******NXSetUnpackColormapCompat: [%d] -> [0x%x].\n", - i, *((int *) (dst_data + (i * 4)))); - } - - #endif - - if (dst_data == dpy -> bufptr) - { - dpy -> bufptr += dst_data_length; - } - else - { - _XSend(dpy, dst_data, dst_data_length); - } - } - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -#define sz_xNXSetUnpackAlphaCompatReq 8 - -typedef struct _NXSetUnpackAlphaCompatReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD32 entries B32; -} xNXSetUnpackAlphaCompatReq; - -#define X_NXSetUnpackAlphaCompat X_NXSetUnpackAlpha - -int NXSetUnpackAlphaCompat(Display *dpy, unsigned int resource, - unsigned int entries, const char *data) -{ - register xNXSetUnpackAlphaCompatReq *req; - - register char *dst_data; - - register unsigned int dst_data_length; - - #ifdef DUMP - - int i; - - #endif - - LockDisplay(dpy); - - GetReq(NXSetUnpackAlphaCompat, req); - - req -> resource = resource; - req -> entries = entries; - - dst_data_length = ROUNDUP(entries, 4); - - req -> length += (dst_data_length >> 2); - - #ifdef TEST - fprintf(stderr, "******NXSetUnpackAlphaCompat: Resource [%u] number of entries [%u] " - "destination data size [%u].\n", resource, entries, dst_data_length); - #endif - - if (entries > 0) - { - if ((dpy -> bufptr + dst_data_length) <= dpy -> bufmax) - { - dst_data = dpy -> bufptr; - } - else - { - if ((dst_data = _XAllocScratch(dpy, dst_data_length)) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXSetUnpackAlphaCompat: PANIC! Cannot allocate memory.\n"); - #endif - - UnGetReq(NXSetUnpackAlphaCompat); - - UnlockDisplay(dpy); - - return -1; - } - } - - memcpy(dst_data, data, entries); - - if (dst_data_length != entries) - { - memset(dst_data + entries, 0, dst_data_length - entries); - } - - #ifdef DUMP - - fprintf(stderr, "******NXSetUnpackAlphaCompat: Dumping alpha channel data:\n"); - - for (i = 0; i < dst_data_length; i++) - { - fprintf(stderr, "******NXSetUnpackAlphaCompat: [%d] -> [0x%02x].\n", - i, ((unsigned int) *(dst_data + i)) & 0xff); - } - - #endif - - if (dst_data == dpy -> bufptr) - { - dpy -> bufptr += dst_data_length; - } - else - { - _XSend(dpy, dst_data, dst_data_length); - } - } - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -/* - * Free any geometry, colormap and alpha channel - * data stored by the remote proxy to unpack the - * image. Resource, as usual, must be a value - * between 0 and 255. - */ - -int NXFreeUnpack(Display *dpy, unsigned int resource) -{ - register xNXFreeUnpackReq *req; - - if (_NXUnpackResources[resource] != 0) - { - LockDisplay(dpy); - - GetReq(NXFreeUnpack, req); - - #ifdef TEST - fprintf(stderr, "******NXFreeUnpack: Sending message opcode [%d] with resource [%u].\n", - X_NXFreeUnpack, resource); - #endif - - req -> resource = resource; - - UnlockDisplay(dpy); - - SyncHandle(); - - #ifdef TEST - fprintf(stderr, "******NXFreeUnpack: Making the resource [%u] newly available.\n", - resource); - #endif - - _NXUnpackResources[resource] = 0; - } - #ifdef TEST - else - { - fprintf(stderr, "******NXFreeUnpack: Nothing to do for resource [%u].\n", - resource); - } - #endif - - return 1; -} - -/* - * Wrapper of XCreateImage(). Note that we use offset - * field of XImage to store size of source image in - * packed format. Note also that method is currently - * not stored in the NXignored. - */ - -NXPackedImage *NXCreatePackedImage(Display *dpy, Visual *visual, unsigned int method, - unsigned int depth, int format, char *data, - int data_length, unsigned int width, - unsigned int height, int bitmap_pad, - int bytes_per_line) -{ - XImage* image; - - image = XCreateImage(dpy, visual, depth, format, 0, data, - width, height, bitmap_pad, bytes_per_line); - - if (image != NULL) - { - image -> xoffset = data_length; - } - - return (NXPackedImage *) image; -} - -/* - * Wrapper of XDestroyImage(). - */ - -int NXDestroyPackedImage(NXPackedImage *image) -{ - return XDestroyImage((XImage *) image); -} - -/* - * Clean the image data directly in the current buffer. - */ - -int NXCleanImage(XImage *image) -{ - #ifdef TEST - fprintf(stderr, "******NXCleanImage: Cleaning image with format [%d] depth [%d] " - "bits per pixel [%d].\n", image -> format, image -> depth, - image -> bits_per_pixel); - #endif - - if (image -> format == ZPixmap) - { - if (image -> depth == 1) - { - return CleanXYImage(image); - } - else - { - return CleanZImage(image); - } - } - else - { - return CleanXYImage(image); - } -} - -NXPackedImage *NXPackImage(Display *dpy, XImage *src_image, unsigned int method) -{ - XImage *dst_image; - - const ColorMask *mask; - - unsigned int dst_data_size; - unsigned int dst_packed_data_size; - - unsigned int dst_bits_per_pixel; - unsigned int dst_packed_bits_per_pixel; - - #ifdef TEST - fprintf(stderr, "******NXPackImage: Going to pack a new image with method [%d].\n", - method); - #endif - - /* - * Get the mask out of the method and - * check if the visual is supported by - * the color reduction algorithm. - */ - - mask = MethodColorMask(method); - - if (mask == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: WARNING! No mask to apply for pack method [%d].\n", - method); - #endif - - return NULL; - } - else if (CanMaskImage(src_image, mask) == 0) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", - src_image -> format, src_image -> depth, src_image -> bits_per_pixel); - - fprintf(stderr, "******NXPackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", - src_image -> red_mask, src_image -> green_mask, src_image -> blue_mask); - #endif - - return NULL; - } - - /* - * Create a destination image from - * source and apply the color mask. - */ - - if ((dst_image = (XImage *) Xmalloc(sizeof(XImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", - (int) sizeof(XImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - #ifdef TEST - fprintf(stderr, "******NXPackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", - src_image -> width, src_image -> bytes_per_line, src_image -> depth); - #endif - - dst_data_size = src_image -> bytes_per_line * src_image -> height; - - dst_image -> data = Xmalloc(dst_data_size); - - if (dst_image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: PANIC! Cannot allocate [%d] bytes for masked image data.\n", - dst_data_size); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * If the pixel resulting from the mask - * needs more bits than available, then - * just clean the padding bits in the - * image. - */ - - dst_bits_per_pixel = dst_image -> bits_per_pixel; - dst_packed_bits_per_pixel = MethodBitsPerPixel(method); - - #ifdef TEST - fprintf(stderr, "******NXPackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", - dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); - #endif - - if (dst_packed_bits_per_pixel > dst_bits_per_pixel || - ShouldMaskImage(src_image, mask) == 0) - { - /* - * Should use the same data for source - * and destination to avoid the memcpy. - */ - - if (CopyAndCleanImage(src_image, dst_image) <= 0) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: PANIC! Failed to clean the image.\n"); - #endif - - Xfree(dst_image -> data); - - Xfree(dst_image); - - return NULL; - } - } - else if (MaskImage(mask, src_image, dst_image) <= 0) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: PANIC! Failed to apply the color mask.\n"); - #endif - - Xfree(dst_image -> data); - - Xfree(dst_image); - - return NULL; - } - - /* - * Let's pack the same pixels in fewer bytes. - * Note that we save a new memory allocation - * by using the same image as source and des- - * tination. This means that PackImage() must - * be able to handle ovelapping areas. - */ - - #ifdef TEST - fprintf(stderr, "******NXPackImage: Plain bits per pixel [%d], data size [%d].\n", - dst_bits_per_pixel, dst_data_size); - #endif - - dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / - dst_bits_per_pixel; - - #ifdef TEST - fprintf(stderr, "******NXPackImage: Packed bits per pixel [%d], data size [%d].\n", - dst_packed_bits_per_pixel, dst_packed_data_size); - #endif - - if (PackImage(method, dst_data_size, dst_image, - dst_packed_data_size, dst_image) <= 0) - { - #ifdef PANIC - fprintf(stderr, "******NXPackImage: PANIC! Failed to pack image from [%d] to [%d] bits per pixel.\n", - dst_bits_per_pixel, dst_packed_bits_per_pixel); - #endif - - Xfree(dst_image -> data); - - Xfree(dst_image); - - return NULL; - } - - /* - * Save data size in xoffset field - * to comply with NX packed images. - */ - - dst_image -> xoffset = dst_packed_data_size; - - return dst_image; -} - -/* - * NXInPlacePackImage creates a NXPackedImage - * from a XImage, sharing the same data buffer. - * Is up to the caller to free the data buffer - * only once. - */ - -XImage *NXInPlacePackImage(Display *dpy, XImage *src_image, unsigned int method) -{ - XImage *dst_image; - - const ColorMask *mask; - - unsigned int dst_data_size; - unsigned int dst_packed_data_size; - - unsigned int dst_bits_per_pixel; - unsigned int dst_packed_bits_per_pixel; - - #ifdef TEST - fprintf(stderr, "******NXInPlacePackImage: Going to pack a new image with method [%d].\n", - method); - #endif - - /* - * Get mask out of method and check if - * visual is supported by current color - * reduction algorithm. - */ - - mask = MethodColorMask(method); - - if (mask == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXInPlacePackImage: WARNING! No mask to apply for pack method [%d].\n", - method); - #endif - - return NULL; - } - else if (CanMaskImage(src_image, mask) == 0) - { - #ifdef PANIC - fprintf(stderr, "******NXInPlacePackImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", - src_image -> format, src_image -> depth, src_image -> bits_per_pixel); - - fprintf(stderr, "******NXInPlacePackImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", - src_image -> red_mask, src_image -> green_mask, src_image -> blue_mask); - #endif - return NULL; - } - - /* - * Create a destination image from - * source and apply the color mask. - */ - - if ((dst_image = (XImage *) Xmalloc(sizeof(XImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXInPlacePackImage: PANIC! Cannot allocate [%d] bytes for the image.\n", - (int) sizeof(XImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - #ifdef TEST - fprintf(stderr, "******NXInPlacePackImage: Source width [%d], bytes per line [%d] with depth [%d].\n", - src_image -> width, src_image -> bytes_per_line, src_image -> depth); - #endif - - dst_data_size = src_image -> bytes_per_line * src_image -> height; - - dst_image -> data = src_image -> data; - - /* - * If pixel resulting from mask needs - * more bits than available, then just - * clean the pad bits in image. - */ - - dst_bits_per_pixel = dst_image -> bits_per_pixel; - dst_packed_bits_per_pixel = MethodBitsPerPixel(method); - - #ifdef TEST - fprintf(stderr, "******NXInPlacePackImage: Destination depth [%d], bits per pixel [%d], packed bits per pixel [%d].\n", - dst_image -> depth, dst_bits_per_pixel, dst_packed_bits_per_pixel); - #endif - - if (dst_packed_bits_per_pixel > dst_bits_per_pixel || - ShouldMaskImage(src_image, mask) == 0) - { - #ifdef TEST - fprintf(stderr, "******NXInPlacePackImage: Just clean image packed_bits_per_pixel[%d], bits_per_pixel[%d].\n", - dst_packed_bits_per_pixel, dst_bits_per_pixel); - #endif - - if (NXCleanImage(dst_image) <= 0) - { - #ifdef PANIC - fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to clean the image.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - } - else if (MaskInPlaceImage(mask, dst_image) <= 0) - { - #ifdef PANIC - fprintf(stderr, "******NXInPlacePackImage: PANIC! Failed to apply the color mask.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * Let's pack the same pixels in fewer bytes. - * Note that we save a new memory allocation - * by using the same image as source and des- - * tination. This means that PackImage() must - * be able to handle ovelapping areas. - */ - - #ifdef TEST - fprintf(stderr, "******NXInPlacePackImage: Plain bits per pixel [%d], data size [%d].\n", - dst_bits_per_pixel, dst_data_size); - #endif - - dst_packed_data_size = dst_data_size * dst_packed_bits_per_pixel / - dst_bits_per_pixel; - - #ifdef TEST - fprintf(stderr, "******NXInPlacePackImage: Packed bits per pixel [%d], data size [%d].\n", - dst_packed_bits_per_pixel, dst_packed_data_size); - #endif - - /* - * Save data size in xoffset field - * to comply with NX packed images. - */ - - dst_image -> xoffset = dst_packed_data_size; - - return dst_image; -} - -int NXPutPackedImage(Display *dpy, unsigned int resource, Drawable drawable, - void *gc, NXPackedImage *image, unsigned int method, - unsigned int depth, int src_x, int src_y, int dst_x, - int dst_y, unsigned int width, unsigned int height) -{ - register xNXPutPackedImageReq *req; - - register unsigned int src_data_length; - register unsigned int dst_data_length; - - LockDisplay(dpy); - - FlushGC(dpy, (GC) gc); - - GetReq(NXPutPackedImage, req); - - req -> resource = resource; - req -> drawable = drawable; - req -> gc = ((GC) gc) -> gid; - - #ifdef TEST - fprintf(stderr, "******NXPutPackedImage: Image resource [%d] drawable [%d] gc [%d].\n", - req -> resource, (int) req -> drawable, (int) req -> gc); - #endif - - /* - * There is no leftPad field in request. We only - * support a leftPad of 0. Anyway, X imposes a - * leftPad of 0 in case of ZPixmap format. - */ - - req -> format = image -> format; - - /* - * Source depth, as well as width and height, - * are taken from the image structure. - */ - - req -> srcDepth = image -> depth; - - req -> srcX = src_x; - req -> srcY = src_y; - - req -> srcWidth = image -> width; - req -> srcHeight = image -> height; - - /* - * The destination depth is provided - * by the caller. - */ - - req -> dstDepth = depth; - - req -> dstX = dst_x; - req -> dstY = dst_y; - - req -> dstWidth = width; - req -> dstHeight = height; - - req -> method = method; - - #ifdef TEST - fprintf(stderr, "******NXPutPackedImage: Source image depth [%d] destination depth [%d] " - "method [%d].\n", req -> srcDepth, req -> dstDepth, req -> method); - #endif - - /* - * Source data length is the size of image in packed format, - * as stored in xoffset field of XImage. Destination data - * size is calculated according to bytes per line of target - * image, so the caller must provide the right depth at the - * time XImage structure is created. - */ - - req -> srcLength = image -> xoffset; - - if (image -> width == (int) width && - image -> height == (int) height) - { - req -> dstLength = image -> bytes_per_line * image -> height; - } - else if (image -> format == ZPixmap) - { - req -> dstLength = ROUNDUP((image -> bits_per_pixel * width), - image -> bitmap_pad) * height >> 3; - } - else - { - req -> dstLength = ROUNDUP(width, image -> bitmap_pad) * height >> 3; - } - - src_data_length = image -> xoffset; - - dst_data_length = ROUNDUP(src_data_length, 4); - - #ifdef TEST - fprintf(stderr, "******NXPutPackedImage: Source data length [%d] request data length [%d].\n", - src_data_length, dst_data_length); - #endif - - req -> length += (dst_data_length >> 2); - - if (src_data_length > 0) - { - if (dpy -> bufptr + dst_data_length <= dpy -> bufmax) - { - /* - * Clean the padding bytes in the request. - */ - - *((int *) (dpy -> bufptr + dst_data_length - 4)) = 0x0; - - memcpy(dpy -> bufptr, image -> data, src_data_length); - - dpy -> bufptr += dst_data_length; - } - else - { - /* - * The _XSend() will pad the request for us. - */ - - _XSend(dpy, image -> data, src_data_length); - } - } - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -int NXAllocColors(Display *dpy, Colormap colormap, unsigned int entries, - XColor screens_in_out[], Bool results_in_out[]) -{ - Status result = 0; - xAllocColorReply rep; - register xAllocColorReq *req; - - Bool alloc_error = False; - - register unsigned int i; - - LockDisplay(dpy); - - for (i = 0; i < entries; i++) - { - GetReq(AllocColor, req); - - req -> cmap = colormap; - - req -> red = screens_in_out[i].red; - req -> green = screens_in_out[i].green; - req -> blue = screens_in_out[i].blue; - } - - for (i = 0; i < entries; i++) - { - result = _XReply(dpy, (xReply *) &rep, 0, xTrue); - - if (result) - { - screens_in_out[i].pixel = rep.pixel; - - screens_in_out[i].red = rep.red; - screens_in_out[i].green = rep.green; - screens_in_out[i].blue = rep.blue; - - results_in_out[i] = True; - } - else - { - results_in_out[i] = False; - - alloc_error = True; - } - } - - UnlockDisplay(dpy); - - SyncHandle(); - - return (alloc_error == False); -} - -char *NXEncodeColormap(const char *src_data, unsigned int src_size, unsigned int *dst_size) -{ - return ColormapCompressData(src_data, src_size, dst_size); -} - -char *NXEncodeAlpha(const char *src_data, unsigned int src_size, unsigned int *dst_size) -{ - return AlphaCompressData(src_data, src_size, dst_size); -} - -NXPackedImage *NXEncodeRgb(XImage *src_image, unsigned int method, unsigned int quality) -{ - NXPackedImage *dst_image = NULL; - - unsigned int dst_size; - - /* - * Create a new image structure as a copy - * of the source. - */ - - if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeRgb: PANIC! Cannot allocate [%d] bytes for the image.\n", - (int) sizeof(XImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - dst_image -> data = RgbCompressData(src_image, &dst_size); - - if (dst_image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeRgb: PANIC! Rgb compression failed.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * Store the Rgb size in the xoffset field. - */ - - dst_image -> xoffset = dst_size; - - return dst_image; -} - -NXPackedImage *NXEncodeRle(XImage *src_image, unsigned int method, unsigned int quality) -{ - NXPackedImage *dst_image = NULL; - - unsigned int dst_size; - - /* - * Create a new image structure as a copy - * of the source. - */ - - if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeRle: PANIC! Cannot allocate [%d] bytes for the image.\n", - (int) sizeof(XImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - dst_image -> data = RleCompressData(src_image, &dst_size); - - if (dst_image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeRle: PANIC! Rle compression failed.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * Store the Rle size in the xoffset field. - */ - - dst_image -> xoffset = dst_size; - - return dst_image; -} - -NXPackedImage *NXEncodeBitmap(XImage *src_image, unsigned int method, unsigned int quality) -{ - NXPackedImage *dst_image = NULL; - - unsigned int dst_size; - - /* - * Create a new image structure as a copy - * of the source. - */ - - if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeBitmap: PANIC! Cannot allocate [%d] bytes for the image.\n", - (int) sizeof(XImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - dst_image -> data = BitmapCompressData(src_image, &dst_size); - - if (dst_image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeBitmap: PANIC! Bitmap compression failed.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * Store the bitmap size in the xoffset field. - */ - - dst_image -> xoffset = dst_size; - - return dst_image; -} - -NXPackedImage *NXEncodeJpeg(XImage *src_image, unsigned int method, unsigned int quality) -{ - NXPackedImage *dst_image = NULL; - - int size; - - /* - * Check if the bpp of the image is valid - * for the Jpeg compression. - */ - - if (src_image -> bits_per_pixel < 15) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeJpeg: PANIC! Invalid bpp for Jpeg compression [%d]\n.", - src_image -> bits_per_pixel); - #endif - - return NULL; - } - - /* - * Create the destination image as a copy - * of the source. - */ - - if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeJpeg: PANIC! Cannot allocate [%d] bytes for the Jpeg image.\n", - (int) sizeof(NXPackedImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - dst_image -> data = JpegCompressData(src_image, quality, &size); - - if (dst_image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodeJpeg: PANIC! Jpeg compression failed.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * Store the Jpeg size in the xoffset field. - */ - - dst_image -> xoffset = size; - - return dst_image; -} - -NXPackedImage *NXEncodePng(XImage *src_image, unsigned int method, unsigned int quality) -{ - NXPackedImage *dst_image = NULL; - - int size; - - /* - * Check if the bpp of the image is valid - * for png compression. - */ - - if (src_image -> bits_per_pixel < 15) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodePng: PANIC! Invalid bpp for Png compression [%d].\n", - src_image -> bits_per_pixel); - #endif - - return NULL; - } - - if ((dst_image = (NXPackedImage *) Xmalloc(sizeof(NXPackedImage))) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodePng: PANIC! Cannot allocate [%d] bytes for the Png image.\n", - (int) sizeof(NXPackedImage)); - #endif - - return NULL; - } - - *dst_image = *src_image; - - dst_image -> data = PngCompressData(dst_image, &size); - - if (dst_image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXEncodePng: PANIC! Png compression failed.\n"); - #endif - - Xfree(dst_image); - - return NULL; - } - - /* - * Store the Png size in the xoffset field. - */ - - dst_image -> xoffset = size; - - return dst_image; -} - -int NXEncodeColors(XImage *src_image, NXColorTable *color_table, int nb_max) -{ - int x, y, t, p; - - long pixel; - - /* - * We need a smarter way to extract - * the colors from the image and - * create a color table. - */ - - memset(color_table, 0, nb_max * sizeof(NXColorTable)); - - for (x = 0, p = 0; x < src_image -> width; x++) - { - for (y = 0; y < src_image -> height; y++) - { - pixel = XGetPixel(src_image, x, y); - - for (t = 0; t < nb_max; t++) - { - if ( color_table[t].found == 0) - { - color_table[t].pixel = pixel; - color_table[t].found = 1; - - p++; - - break; - } - else if ((color_table[t].pixel) == pixel) - { - break; - } - } - - if (p == nb_max) - { - return nb_max + 1; - } - } - } - - return p; -} - -void NXMaskImage(XImage *image, unsigned int method) -{ - unsigned int maskMethod; - - const ColorMask *mask; - - /* - * Choose the correct mask method - */ - - switch(method) - { - case PACK_JPEG_8_COLORS: - case PACK_PNG_8_COLORS: - { - maskMethod = MASK_8_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_8_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_64_COLORS: - case PACK_PNG_64_COLORS: - { - maskMethod = MASK_64_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_256_COLORS: - case PACK_PNG_256_COLORS: - { - maskMethod = MASK_256_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_256_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_512_COLORS: - case PACK_PNG_512_COLORS: - { - maskMethod = MASK_512_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_512K_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_4K_COLORS: - case PACK_PNG_4K_COLORS: - { - maskMethod = MASK_4K_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_4K_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_32K_COLORS: - case PACK_PNG_32K_COLORS: - { - maskMethod = MASK_32K_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_32K_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_64K_COLORS: - case PACK_PNG_64K_COLORS: - { - maskMethod = MASK_64K_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_64K_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_256K_COLORS: - case PACK_PNG_256K_COLORS: - { - maskMethod = MASK_256K_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_256K_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_2M_COLORS: - case PACK_PNG_2M_COLORS: - { - maskMethod = MASK_2M_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_2M_COLORS\n"); - #endif - - break; - } - case PACK_JPEG_16M_COLORS: - case PACK_PNG_16M_COLORS: - { - maskMethod = MASK_16M_COLORS; - - #ifdef DEBUG - fprintf(stderr, "******NXMaskImage: Method is MASK_16M_COLORS\n"); - #endif - - break; - } - default: - { - #ifdef PANIC - fprintf(stderr, "******NXMaskImage: PANIC! Cannot find mask method for pack method [%d]\n", - method); - #endif - - return; - } - } - - #ifdef TEST - fprintf(stderr, "******NXMaskImage: packMethod[%d] => maskMethod[%d]\n", - method, maskMethod); - #endif - - /* - * Get mask out of method and check if - * visual is supported by current color - * reduction algorithm. - */ - - mask = MethodColorMask(maskMethod); - - if (mask == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXMaskImage: PANIC! No mask to apply for pack method [%d].\n", - method); - #endif - - return; - } - else if (CanMaskImage(image, mask) == 0) - { - #ifdef PANIC - fprintf(stderr, "******NXMaskImage: PANIC! Invalid source with format [%d] depth [%d] bits per pixel [%d].\n", - image -> format, image -> depth, image -> bits_per_pixel); - - fprintf(stderr, "******NXMaskImage: PANIC! Visual colormask is red 0x%lx green 0x%lx blue 0x%lx.\n", - image -> red_mask, image -> green_mask, image -> blue_mask); - #endif - - return; - } - - /* - * Calling ShouldMaskImage you get 0 in the case - * of MASK_256_COLORS and MASK_64K_COLORS, which - * means that the image should not be masked. - */ - - if (ShouldMaskImage(image, mask) == 0) - { - #ifdef TEST - fprintf(stderr, "******NXMaskImage: the image will not be masked\n"); - #endif - } - else - { - if (MaskInPlaceImage(mask, image) <= 0) - { - #ifdef PANIC - fprintf(stderr, "******NXMaskImage: PANIC! Failed to apply the color mask in place.\n"); - #endif - } - } -} - -/* - * The display parameter is ignored. - */ - -void NXInitCache(Display *dpy, int entries) -{ - if (NXImageCache != NULL && NXImageCacheSize == entries) - { - #ifdef DEBUG - fprintf(stderr, "******NXInitCache: Nothing to do with image cache at [%p] and [%d] entries.\n", - NXImageCache, NXImageCacheSize); - #endif - - return; - } - - #ifdef DEBUG - fprintf(stderr, "******NXInitCache: Initializing the cache with [%d] entries.\n", - entries); - #endif - - NXImageCacheSize = 0; - - if (NXImageCache != NULL) - { - Xfree(NXImageCache); - - NXImageCache = NULL; - } - - if (entries > 0) - { - NXImageCache = Xmalloc(entries * sizeof(_NXImageCacheEntry)); - - if (NXImageCache != NULL) - { - memset(NXImageCache, 0, entries * sizeof(_NXImageCacheEntry)); - - NXImageCacheSize = entries; - - #ifdef DEBUG - fprintf(stderr, "******NXInitCache: Image cache initialized with [%d] entries.\n", entries); - #endif - } - } -} - -#ifdef DUMP - -void _NXCacheDump(const char *label) -{ - char s[MD5_LENGTH * 2 + 1]; - - int i; - int j; - - #ifdef DEBUG - fprintf(stderr, "%s: Dumping the content of image cache:\n", label); - #endif - - for (i = 0; i < NXImageCacheSize; i++) - { - if (NXImageCache[i].image == NULL) - { - break; - } - - for (j = 0; j < MD5_LENGTH; j++) - { - sprintf(s + (j * 2), "%02X", ((unsigned char *) NXImageCache[i].md5)[j]); - } - - #ifdef DEBUG - fprintf(stderr, "%s: [%d][%s].\n", label, i, s); - #endif - } -} - -#endif - -XImage *NXCacheFindImage(NXPackedImage *src_image, unsigned int *method, unsigned char **md5) -{ - md5_state_t new_state; - md5_byte_t *new_md5; - unsigned int data_size, i; - - if (NXImageCache == NULL) - { - return NULL; - } - - /* - * Will return the allocated checksum - * if the image is not found. - */ - - *md5 = NULL; - - if ((new_md5 = Xmalloc(MD5_LENGTH)) == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCacheFindImage: Can't allocate memory for the checksum.\n"); - #endif - - return NULL; - } - - data_size = (src_image -> bytes_per_line * src_image -> height); - - md5_init(&new_state); - - md5_append(&new_state, (unsigned char *) &src_image -> width, sizeof(int)); - md5_append(&new_state, (unsigned char *) &src_image -> height, sizeof(int)); - - md5_append(&new_state, (unsigned char *) src_image -> data, data_size); - - md5_finish(&new_state, new_md5); - - for (i = 0; i < NXImageCacheSize; i++) - { - if (NXImageCache[i].image != NULL) - { - if (memcmp(NXImageCache[i].md5, new_md5, MD5_LENGTH) == 0) - { - _NXImageCacheEntry found; - - found.image = NXImageCache[i].image; - found.method = NXImageCache[i].method; - found.md5 = NXImageCache[i].md5; - - *method = found.method; - - NXImageCacheHits++; - - #ifdef DEBUG - fprintf(stderr, "******NXCacheFindImage: Found at position [%d] with hits [%d] and [%d] packs.\n", - i, NXImageCacheHits, NXImageCacheOps); - #endif - - Xfree(new_md5); - - /* - * Move the images down one slot, from - * the head of the list, and place the - * image just found at top. - */ - - if (i > 16) - { - #ifdef DEBUG - fprintf(stderr, "******NXCacheFindImage: Moving the image at the head of the list.\n"); - #endif - - memmove(&NXImageCache[1], &NXImageCache[0], (i * sizeof(_NXImageCacheEntry))); - - NXImageCache[0].image = found.image; - NXImageCache[0].method = found.method; - NXImageCache[0].md5 = found.md5; - - #ifdef DUMP - - _NXCacheDump("******NXCacheFindImage"); - - #endif - } - - /* - * Return the checksum and image - * structure allocated in cache. - */ - - *md5 = found.md5; - - return found.image; - } - } - else - { - break; - } - } - - *md5 = new_md5; - - return NULL; -} - -/* - * Add a packed image to the cache. A new image - * structure is allocated and copied, data and - * checksum are inherited from the passed image. - */ - -int NXCacheAddImage(NXPackedImage *image, unsigned int method, unsigned char *md5) -{ - unsigned int i; - - if (image == NULL || image -> data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCacheAddImage: PANIC! Invalid image passed to function.\n"); - #endif - - return -1; - } - - i = (NXImageCacheOps < NXImageCacheSize) ? NXImageCacheOps : NXImageCacheSize; - - if (NXImageCacheOps >= NXImageCacheSize) - { - #ifdef DEBUG - fprintf(stderr, "******NXCacheAddImage: Freeing up the oldest entry.\n"); - #endif - - i--; - - Xfree(NXImageCache[NXImageCacheSize - 1].image -> data); - Xfree(NXImageCache[NXImageCacheSize - 1].image); - Xfree(NXImageCache[NXImageCacheSize - 1].md5); - } - - if (i > 0) - { - memmove(&NXImageCache[1], &NXImageCache[0], i * sizeof(_NXImageCacheEntry)); - } - - NXImageCacheOps++; - - #ifdef DEBUG - fprintf(stderr, "******NXCacheAddImage: Going to add new image with data size [%d].\n", - image -> xoffset); - #endif - - NXImageCache[0].image = image; - NXImageCache[0].method = method; - NXImageCache[0].md5 = md5; - - #ifdef DUMP - - _NXCacheDump("******NXCacheAddImage"); - - #endif - - return 1; -} - -/* - * The display parameter is ignored. - */ - -void NXFreeCache(Display *dpy) -{ - int i; - - if (NXImageCache == NULL) - { - #ifdef DEBUG - fprintf(stderr, "******NXFreeCache: Nothing to do with a null image cache.\n"); - #endif - - return; - } - - #ifdef DEBUG - fprintf(stderr, "******NXFreeCache: Freeing the cache with [%d] entries.\n", - NXImageCacheSize); - #endif - - for (i = 0; i < NXImageCacheSize; i++) - { - if (NXImageCache[i].image != NULL) - { - if (NXImageCache[i].image -> data != NULL) - { - Xfree(NXImageCache[i].image -> data); - } - - Xfree(NXImageCache[i].image); - - NXImageCache[i].image = NULL; - } - - if (NXImageCache[i].md5 != NULL) - { - Xfree(NXImageCache[i].md5); - - NXImageCache[i].md5 = NULL; - } - } - - Xfree(NXImageCache); - - NXImageCache = NULL; - - NXImageCacheSize = 0; - NXImageCacheHits = 0; - NXImageCacheOps = 0; -} - -static void _NXNotifyImage(Display *dpy, int resource, Bool success) -{ - XEvent async_event; - - /* - * Enqueue an event to tell client - * the result of GetImage. - */ - - async_event.type = ClientMessage; - - async_event.xclient.serial = _NXCollectedImages[resource] -> sequence; - - async_event.xclient.window = 0; - async_event.xclient.message_type = 0; - async_event.xclient.format = 32; - - async_event.xclient.data.l[0] = NXCollectImageNotify; - async_event.xclient.data.l[1] = resource; - async_event.xclient.data.l[2] = success; - - XPutBackEvent(dpy, &async_event); -} - -static Bool _NXCollectImageHandler(Display *dpy, xReply *rep, char *buf, - int len, XPointer data) -{ - register _NXCollectImageState *state; - - register xGetImageReply *async_rep; - - char *async_head; - char *async_data; - - int async_size; - - state = (_NXCollectImageState *) data; - - if ((rep -> generic.sequenceNumber % 65536) != - ((int)(state -> sequence) % 65536)) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Unmatched sequence [%d] for opcode [%d] " - "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, - (int) rep -> generic.length << 2); - #endif - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Going to handle asynchronous GetImage reply.\n"); - #endif - - /* - * As even reply data is managed asynchronously, - * we can use state to get to vector and vector - * to get to handler. In this way, we can safely - * dequeue and free the handler itself. - */ - - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - - state -> handler = NULL; - - if (rep -> generic.type == X_Error) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Error received from X server for resource [%d].\n", - state -> resource); - #endif - - _NXNotifyImage(dpy, state -> resource, False); - - _NXCollectedImages[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Matched request with sequence [%ld].\n", - state -> sequence); - #endif - - async_size = SIZEOF(xGetImageReply); - - async_head = Xmalloc(async_size); - - if (async_head == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyImage(dpy, state -> resource, False); - - _NXCollectedImages[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Going to get reply with size [%d].\n", - (int) rep -> generic.length << 2); - #endif - - async_rep = (xGetImageReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); - - if (async_rep == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to get reply with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyImage(dpy, state -> resource, False); - - _NXCollectedImages[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Got reply with depth [%d] visual [%d] size [%d].\n", - async_rep -> depth, (int) async_rep -> visual, (int) async_rep -> length << 2); - #endif - - async_size = async_rep -> length << 2; - - if (async_size > 0) - { - async_data = Xmalloc(async_size); - - if (async_data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to allocate memory with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyImage(dpy, state -> resource, False); - - _NXCollectedImages[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Going to get data with size [%d].\n", - async_size); - #endif - - _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetImageReply), async_size, async_size); - - /* - * From now on we can return True, as all - * data has been consumed from buffer. - */ - - if (state -> format == XYPixmap) - { - unsigned long depth = DepthOnes(state -> mask & (((unsigned long)0xFFFFFFFF) >> - (32 - async_rep -> depth))); - - state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), - depth, XYPixmap, 0, async_data, state -> width, - state -> height, dpy -> bitmap_pad, 0); - } - else - { - state -> image = XCreateImage(dpy, _XVIDtoVisual(dpy, async_rep -> visual), - async_rep -> depth, ZPixmap, 0, async_data, state -> width, - state -> height, _XGetScanlinePad(dpy, async_rep -> depth), 0); - } - - if (state -> image == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectImageHandler: PANIC! Failed to create image for resource [%d].\n", - state -> resource); - #endif - - _NXNotifyImage(dpy, state -> resource, False); - - _NXCollectedImages[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - Xfree(async_data); - - return True; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectImageHandler: Successfully stored image data for resource [%d].\n", - state -> resource); - #endif - } - #ifdef WARNING - else - { - fprintf(stderr, "******_NXCollectImageHandler: WARNING! Null image data stored for resource [%d].\n", - state -> resource); - } - #endif - - _NXNotifyImage(dpy, state -> resource, True); - - Xfree(async_head); - - return True; -} - -int NXGetCollectImageResource(Display *dpy) -{ - int i; - - for (i = 0; i < NXNumberOfResources; i++) - { - if (_NXCollectedImages[i] == NULL) - { - return i; - } - } - - return -1; -} - -int NXCollectImage(Display *dpy, unsigned int resource, Drawable drawable, - int src_x, int src_y, unsigned int width, unsigned int height, - unsigned long plane_mask, int format) -{ - register xGetImageReq *req; - - _NXCollectImageState *state; - _XAsyncHandler *handler; - - if (resource >= NXNumberOfResources) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectImage: PANIC! Provided resource [%u] is out of range.\n", - resource); - #endif - - return -1; - } - - state = _NXCollectedImages[resource]; - - if (state != NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectImage: PANIC! Having to remove previous state for resource [%u].\n", - resource); - #endif - - if (state -> handler != NULL) - { - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - } - - if (state -> image != NULL) - { - XDestroyImage(state -> image); - } - - Xfree(state); - - _NXCollectedImages[resource] = NULL; - } - - LockDisplay(dpy); - - GetReq(GetImage, req); - - req -> format = format; - req -> drawable = drawable; - req -> x = src_x; - req -> y = src_y; - req -> width = width; - req -> height = height; - req -> planeMask = plane_mask; - - #ifdef TEST - fprintf(stderr, "******NXCollectImage: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", - X_GetImage, dpy -> request, resource); - - fprintf(stderr, "******NXCollectImage: Format [%d] drawable [%d] src_x [%d] src_y [%d].\n", - req -> format, (int) req -> drawable, req -> x, req -> y); - - fprintf(stderr, "******NXCollectImage: Width [%d] height [%d] plane_mask [%x].\n", - req -> width, req -> height, (int) req -> planeMask); - #endif - - state = Xmalloc(sizeof(_NXCollectImageState)); - handler = Xmalloc(sizeof(_XAsyncHandler)); - - if (state == NULL || handler == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectImage: PANIC! Failed to allocate memory with resource [%d].\n", - resource); - #endif - - UnGetReq(GetImage); - - if (state != NULL) - { - Xfree(state); - } - - if (handler != NULL) - { - Xfree(handler); - } - - UnlockDisplay(dpy); - - return -1; - } - - state -> sequence = dpy -> request; - state -> resource = resource; - state -> mask = plane_mask; - state -> format = format; - state -> width = width; - state -> height = height; - state -> image = NULL; - - state -> handler = handler; - - handler -> next = dpy -> async_handlers; - handler -> handler = _NXCollectImageHandler; - handler -> data = (XPointer) state; - dpy -> async_handlers = handler; - - _NXCollectedImages[resource] = state; - - UnlockDisplay(dpy); - - SyncHandle(); - - return 1; -} - -int NXGetCollectedImage(Display *dpy, unsigned int resource, XImage **image) -{ - register _NXCollectImageState *state; - - state = _NXCollectedImages[resource]; - - if (state == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXGetCollectedImage: PANIC! No image collected for resource [%u].\n", - resource); - #endif - - return 0; - } - - _NXCollectedImages[resource] = NULL; - - *image = state -> image; - - Xfree(state); - - #ifdef TEST - fprintf(stderr, "******NXGetCollectedImage: Returning GetImage data for resource [%u].\n", - resource); - #endif - - return 1; -} - -static void _NXNotifyProperty(Display *dpy, int resource, Bool success) -{ - XEvent async_event; - - /* - * Enqueue an event to tell client - * the result of GetProperty. - */ - - async_event.type = ClientMessage; - - async_event.xclient.serial = _NXCollectedProperties[resource] -> sequence; - - async_event.xclient.window = 0; - async_event.xclient.message_type = 0; - async_event.xclient.format = 32; - - async_event.xclient.data.l[0] = NXCollectPropertyNotify; - async_event.xclient.data.l[1] = resource; - async_event.xclient.data.l[2] = success; - - XPutBackEvent(dpy, &async_event); -} - -static Bool _NXCollectPropertyHandler(Display *dpy, xReply *rep, char *buf, - int len, XPointer data) -{ - register _NXCollectPropertyState *state; - - register xGetPropertyReply *async_rep; - - char *async_head; - char *async_data; - - int async_size; - - state = (_NXCollectPropertyState *) data; - - if ((rep -> generic.sequenceNumber % 65536) != - ((int)(state -> sequence) % 65536)) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Unmatched sequence [%d] for opcode [%d] " - "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, - (int) rep -> generic.length << 2); - #endif - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Going to handle asynchronous GetProperty reply.\n"); - #endif - - /* - * Reply data is managed asynchronously. We can - * use state to get to vector and vector to get - * to handler. In this way, we can dequeue and - * free the handler itself. - */ - - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - - state -> handler = NULL; - - if (rep -> generic.type == X_Error) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Error received from X server for resource [%d].\n", - state -> resource); - #endif - - _NXNotifyProperty(dpy, state -> resource, False); - - _NXCollectedProperties[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Matched request with sequence [%ld].\n", - state -> sequence); - #endif - - async_size = SIZEOF(xGetPropertyReply); - - async_head = Xmalloc(async_size); - - if (async_head == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyProperty(dpy, state -> resource, False); - - _NXCollectedProperties[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Going to get reply with size [%d].\n", - (int) rep -> generic.length << 2); - #endif - - async_rep = (xGetPropertyReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); - - if (async_rep == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to get reply with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyProperty(dpy, state -> resource, False); - - _NXCollectedProperties[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Got reply with format [%d] type [%d] size [%d].\n", - async_rep -> format, (int) async_rep -> propertyType, (int) async_rep -> length << 2); - - fprintf(stderr, "******_NXCollectPropertyHandler: Bytes after [%d] number of items [%d].\n", - (int) async_rep -> bytesAfter, (int) async_rep -> nItems); - #endif - - state -> format = async_rep -> format; - state -> type = async_rep -> propertyType; - state -> items = async_rep -> nItems; - state -> after = async_rep -> bytesAfter; - - async_size = async_rep -> length << 2; - - if (async_size > 0) - { - async_data = Xmalloc(async_size); - - if (async_data == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectPropertyHandler: PANIC! Failed to allocate memory with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyProperty(dpy, state -> resource, False); - - _NXCollectedProperties[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Going to get data with size [%d].\n", - async_size); - #endif - - _XGetAsyncData(dpy, async_data, buf, len, SIZEOF(xGetPropertyReply), async_size, async_size); - - /* - * From now on we can return True, as all - * data has been consumed from buffer. - */ - - state -> data = async_data; - - #ifdef TEST - fprintf(stderr, "******_NXCollectPropertyHandler: Successfully stored property data for resource [%d].\n", - state -> resource); - #endif - } - #ifdef TEST - else - { - fprintf(stderr, "******_NXCollectPropertyHandler: WARNING! Null property data stored for resource [%d].\n", - state -> resource); - } - #endif - - _NXNotifyProperty(dpy, state -> resource, True); - - Xfree(async_head); - - return True; -} - -int NXGetCollectPropertyResource(Display *dpy) -{ - int i; - - for (i = 0; i < NXNumberOfResources; i++) - { - if (_NXCollectedProperties[i] == NULL) - { - return i; - } - } - - return -1; -} - -int NXCollectProperty(Display *dpy, unsigned int resource, Window window, Atom property, - long long_offset, long long_length, Bool delete, Atom req_type) -{ - register xGetPropertyReq *req; - - _NXCollectPropertyState *state; - _XAsyncHandler *handler; - - if (resource >= NXNumberOfResources) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectProperty: PANIC! Provided resource [%u] is out of range.\n", - resource); - #endif - - return -1; - } - - state = _NXCollectedProperties[resource]; - - if (state != NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectProperty: PANIC! Having to remove previous state for resource [%u].\n", - resource); - #endif - - if (state -> handler != NULL) - { - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - } - - if (state -> data != NULL) - { - Xfree(state -> data); - } - - Xfree(state); - - _NXCollectedProperties[resource] = NULL; - } - - LockDisplay(dpy); - - GetReq(GetProperty, req); - - req -> delete = delete; - req -> window = window; - req -> property = property; - req -> type = req_type; - req -> longOffset = long_offset; - req -> longLength = long_length; - - #ifdef TEST - fprintf(stderr, "******NXCollectProperty: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", - X_GetProperty, dpy -> request, resource); - - fprintf(stderr, "******NXCollectProperty: Delete [%u] window [%d] property [%d] type [%d].\n", - req -> delete, (int) req -> window, (int) req -> property, (int) req -> type); - - fprintf(stderr, "******NXCollectProperty: Long offset [%d] long length [%d].\n", - (int) req -> longOffset, (int) req -> longLength); - #endif - - state = Xmalloc(sizeof(_NXCollectPropertyState)); - handler = Xmalloc(sizeof(_XAsyncHandler)); - - if (state == NULL || handler == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectProperty: Failed to allocate memory with resource [%d].\n", - resource); - #endif - - if (state != NULL) - { - Xfree(state); - } - - if (handler != NULL) - { - Xfree(handler); - } - - UnGetReq(GetProperty); - - UnlockDisplay(dpy); - - return -1; - } - - state -> sequence = dpy -> request; - state -> resource = resource; - state -> window = window; - state -> property = property; - state -> type = 0; - state -> format = 0; - state -> items = 0; - state -> after = 0; - state -> data = NULL; - - state -> handler = handler; - - handler -> next = dpy -> async_handlers; - handler -> handler = _NXCollectPropertyHandler; - handler -> data = (XPointer) state; - dpy -> async_handlers = handler; - - _NXCollectedProperties[resource] = state; - - UnlockDisplay(dpy); - - SyncHandle(); - - return True; -} - -int NXGetCollectedProperty(Display *dpy, unsigned int resource, Atom *actual_type_return, - int *actual_format_return, unsigned long *nitems_return, - unsigned long *bytes_after_return, unsigned char **data) -{ - register _NXCollectPropertyState *state; - - state = _NXCollectedProperties[resource]; - - if (state == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXGetCollectedProperty: PANIC! No data collected for resource [%u].\n", - resource); - #endif - - return 0; - } - - *actual_type_return = state -> type; - *actual_format_return = state -> format; - *nitems_return = state -> items; - *bytes_after_return = state -> after; - - *data = (unsigned char *) _NXCollectedProperties[resource] -> data; - - Xfree(state); - - _NXCollectedProperties[resource] = NULL; - - #ifdef TEST - fprintf(stderr, "******NXGetCollectedProperty: Returning GetProperty data for resource [%u].\n", - resource); - #endif - - return True; -} - -static void _NXNotifyGrabPointer(Display *dpy, int resource, Bool success) -{ - XEvent async_event; - - async_event.type = ClientMessage; - - async_event.xclient.serial = _NXCollectedGrabPointers[resource] -> sequence; - - async_event.xclient.window = 0; - async_event.xclient.message_type = 0; - async_event.xclient.format = 32; - - async_event.xclient.data.l[0] = NXCollectGrabPointerNotify; - async_event.xclient.data.l[1] = resource; - async_event.xclient.data.l[2] = success; - - XPutBackEvent(dpy, &async_event); -} - -static Bool _NXCollectGrabPointerHandler(Display *dpy, xReply *rep, char *buf, - int len, XPointer data) -{ - register _NXCollectGrabPointerState *state; - - register xGrabPointerReply *async_rep; - - char *async_head; - - int async_size; - - state = (_NXCollectGrabPointerState *) data; - - if ((rep -> generic.sequenceNumber % 65536) != - ((int)(state -> sequence) % 65536)) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectGrabPointerHandler: Unmatched sequence [%d] for opcode [%d] " - "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, - (int) rep -> generic.length << 2); - #endif - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to handle asynchronous GrabPointer reply.\n"); - #endif - - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - - state -> handler = NULL; - - if (rep -> generic.type == X_Error) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectGrabPointerHandler: Error received from X server for resource [%d].\n", - state -> resource); - #endif - - _NXNotifyGrabPointer(dpy, state -> resource, False); - - _NXCollectedGrabPointers[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectGrabPointerHandler: Matched request with sequence [%ld].\n", - state -> sequence); - #endif - - async_size = SIZEOF(xGrabPointerReply); - - async_head = Xmalloc(async_size); - - if (async_head == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to allocate memory with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyGrabPointer(dpy, state -> resource, False); - - _NXCollectedGrabPointers[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectGrabPointerHandler: Going to get reply with size [%d].\n", - (int) rep -> generic.length << 2); - #endif - - async_rep = (xGrabPointerReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); - - if (async_rep == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectGrabPointerHandler: PANIC! Failed to get reply with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyGrabPointer(dpy, state -> resource, False); - - _NXCollectedGrabPointers[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectGrabPointerHandler: Got reply with status [%d] size [%d].\n", - async_rep -> status, (int) async_rep -> length << 2); - #endif - - state -> status = async_rep -> status; - - _NXNotifyGrabPointer(dpy, state -> resource, True); - - Xfree(async_head); - - return True; -} - -int NXGetCollectGrabPointerResource(Display *dpy) -{ - int i; - - for (i = 0; i < NXNumberOfResources; i++) - { - if (_NXCollectedGrabPointers[i] == NULL) - { - return i; - } - } - - return -1; -} - -int NXCollectGrabPointer(Display *dpy, unsigned int resource, Window grab_window, Bool owner_events, - unsigned int event_mask, int pointer_mode, int keyboard_mode, - Window confine_to, Cursor cursor, Time time) -{ - register xGrabPointerReq *req; - - _NXCollectGrabPointerState *state; - _XAsyncHandler *handler; - - if (resource >= NXNumberOfResources) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectGrabPointer: PANIC! Provided resource [%u] is out of range.\n", - resource); - #endif - - return -1; - } - - state = _NXCollectedGrabPointers[resource]; - - if (state != NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectGrabPointer: PANIC! Having to remove previous state for resource [%u].\n", - resource); - #endif - - if (state -> handler != NULL) - { - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - } - - Xfree(state); - - _NXCollectedGrabPointers[resource] = NULL; - } - - LockDisplay(dpy); - - GetReq(GrabPointer, req); - - req -> grabWindow = grab_window; - req -> ownerEvents = owner_events; - req -> eventMask = event_mask; - req -> pointerMode = pointer_mode; - req -> keyboardMode = keyboard_mode; - req -> confineTo = confine_to; - req -> cursor = cursor; - req -> time = time; - - #ifdef TEST - fprintf(stderr, "******NXCollectGrabPointer: Sending message opcode [%d] sequence [%ld] " - "for resource [%d].\n", X_GrabPointer, dpy -> request, resource); - #endif - - state = Xmalloc(sizeof(_NXCollectGrabPointerState)); - handler = Xmalloc(sizeof(_XAsyncHandler)); - - if (state == NULL || handler == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectGrabPointer: Failed to allocate memory with resource [%d].\n", - resource); - #endif - - if (state != NULL) - { - Xfree(state); - } - - if (handler != NULL) - { - Xfree(handler); - } - - UnGetReq(GrabPointer); - - UnlockDisplay(dpy); - - return -1; - } - - state -> sequence = dpy -> request; - state -> resource = resource; - state -> status = 0; - - state -> handler = handler; - - handler -> next = dpy -> async_handlers; - handler -> handler = _NXCollectGrabPointerHandler; - handler -> data = (XPointer) state; - dpy -> async_handlers = handler; - - _NXCollectedGrabPointers[resource] = state; - - UnlockDisplay(dpy); - - SyncHandle(); - - return True; -} - -int NXGetCollectedGrabPointer(Display *dpy, unsigned int resource, int *status) -{ - register _NXCollectGrabPointerState *state; - - state = _NXCollectedGrabPointers[resource]; - - if (state == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXGetCollectedGrabPointer: PANIC! No data collected for resource [%u].\n", - resource); - #endif - - return 0; - } - - *status = state -> status; - - Xfree(state); - - _NXCollectedGrabPointers[resource] = NULL; - - #ifdef TEST - fprintf(stderr, "******NXGetCollectedGrabPointer: Returning GrabPointer data for resource [%u].\n", - resource); - #endif - - return True; -} - -static void _NXNotifyInputFocus(Display *dpy, int resource, Bool success) -{ - XEvent async_event; - - async_event.type = ClientMessage; - - async_event.xclient.serial = _NXCollectedInputFocuses[resource] -> sequence; - - async_event.xclient.window = 0; - async_event.xclient.message_type = 0; - async_event.xclient.format = 32; - - async_event.xclient.data.l[0] = NXCollectInputFocusNotify; - async_event.xclient.data.l[1] = resource; - async_event.xclient.data.l[2] = success; - - XPutBackEvent(dpy, &async_event); -} - -static Bool _NXCollectInputFocusHandler(Display *dpy, xReply *rep, char *buf, - int len, XPointer data) -{ - register _NXCollectInputFocusState *state; - - register xGetInputFocusReply *async_rep; - - char *async_head; - - int async_size; - - state = (_NXCollectInputFocusState *) data; - - if ((rep -> generic.sequenceNumber % 65536) != - ((int)(state -> sequence) % 65536)) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectInputFocusHandler: Unmatched sequence [%d] for opcode [%d] " - "with length [%d].\n", rep -> generic.sequenceNumber, rep -> generic.type, - (int) rep -> generic.length << 2); - #endif - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectInputFocusHandler: Going to handle asynchronous GetInputFocus reply.\n"); - #endif - - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - - state -> handler = NULL; - - if (rep -> generic.type == X_Error) - { - #ifdef TEST - fprintf(stderr, "******_NXCollectInputFocusHandler: Error received from X server for resource [%d].\n", - state -> resource); - #endif - - _NXNotifyInputFocus(dpy, state -> resource, False); - - _NXCollectedInputFocuses[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectInputFocusHandler: Matched request with sequence [%ld].\n", - state -> sequence); - #endif - - async_size = SIZEOF(xGetInputFocusReply); - - async_head = Xmalloc(async_size); - - if (async_head == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to allocate memory with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyInputFocus(dpy, state -> resource, False); - - _NXCollectedInputFocuses[state -> resource] = NULL; - - Xfree(state); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectInputFocusHandler: Going to get reply with size [%d].\n", - (int) rep -> generic.length << 2); - #endif - - async_rep = (xGetInputFocusReply *) _XGetAsyncReply(dpy, async_head, rep, buf, len, 0, False); - - if (async_rep == NULL) - { - #ifdef PANIC - fprintf(stderr, "******_NXCollectInputFocusHandler: PANIC! Failed to get reply with resource [%d].\n", - state -> resource); - #endif - - _NXNotifyInputFocus(dpy, state -> resource, False); - - _NXCollectedInputFocuses[state -> resource] = NULL; - - Xfree(state); - - Xfree(async_head); - - return False; - } - - #ifdef TEST - fprintf(stderr, "******_NXCollectInputFocusHandler: Got reply with focus [%d] revert to [%d] " - "size [%d].\n", (int) async_rep -> focus, (int) async_rep -> revertTo, - (int) async_rep -> length << 2); - #endif - - state -> focus = async_rep -> focus; - state -> revert_to = async_rep -> revertTo; - - _NXNotifyInputFocus(dpy, state -> resource, True); - - Xfree(async_head); - - return True; -} - -int NXGetCollectInputFocusResource(Display *dpy) -{ - int i; - - for (i = 0; i < NXNumberOfResources; i++) - { - if (_NXCollectedInputFocuses[i] == NULL) - { - return i; - } - } - - return -1; -} - -int NXCollectInputFocus(Display *dpy, unsigned int resource) -{ - register xReq *req; - - _NXCollectInputFocusState *state; - _XAsyncHandler *handler; - - if (resource >= NXNumberOfResources) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectInputFocus: PANIC! Provided resource [%u] is out of range.\n", - resource); - #endif - - return -1; - } - - state = _NXCollectedInputFocuses[resource]; - - if (state != NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectInputFocus: PANIC! Having to remove previous state for resource [%u].\n", - resource); - #endif - - if (state -> handler != NULL) - { - DeqAsyncHandler(dpy, state -> handler); - - Xfree(state -> handler); - } - - Xfree(state); - - _NXCollectedInputFocuses[resource] = NULL; - } - - LockDisplay(dpy); - - GetEmptyReq(GetInputFocus, req); - - #ifdef TEST - fprintf(stderr, "******NXCollectInputFocus: Sending message opcode [%d] sequence [%ld] for resource [%d].\n", - X_GetInputFocus, dpy -> request, resource); - #endif - - state = Xmalloc(sizeof(_NXCollectInputFocusState)); - handler = Xmalloc(sizeof(_XAsyncHandler)); - - if (state == NULL || handler == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXCollectInputFocus: Failed to allocate memory with resource [%d].\n", - resource); - #endif - - if (state != NULL) - { - Xfree(state); - } - - if (handler != NULL) - { - Xfree(handler); - } - - UnGetEmptyReq(); - - UnlockDisplay(dpy); - - return -1; - } - - state -> sequence = dpy -> request; - state -> resource = resource; - state -> focus = 0; - state -> revert_to = 0; - - state -> handler = handler; - - handler -> next = dpy -> async_handlers; - handler -> handler = _NXCollectInputFocusHandler; - handler -> data = (XPointer) state; - dpy -> async_handlers = handler; - - _NXCollectedInputFocuses[resource] = state; - - UnlockDisplay(dpy); - - SyncHandle(); - - return True; -} - -int NXGetCollectedInputFocus(Display *dpy, unsigned int resource, - Window *focus_return, int *revert_to_return) -{ - register _NXCollectInputFocusState *state; - - state = _NXCollectedInputFocuses[resource]; - - if (state == NULL) - { - #ifdef PANIC - fprintf(stderr, "******NXGetCollectedInputFocus: PANIC! No data collected for resource [%u].\n", - resource); - #endif - - return 0; - } - - *focus_return = state -> focus; - *revert_to_return = state -> revert_to; - - Xfree(state); - - _NXCollectedInputFocuses[resource] = NULL; - - #ifdef TEST - fprintf(stderr, "******NXGetCollectedInputFocus: Returning GetInputFocus data for resource [%u].\n", - resource); - #endif - - return True; -} - -#ifdef DUMP - -void _NXDumpData(const unsigned char *buffer, unsigned int size) -{ - if (buffer != NULL) - { - unsigned int i = 0; - - unsigned int ii; - - while (i < size) - { - fprintf(stderr, "[%d]\t", i); - - for (ii = 0; i < size && ii < 8; i++, ii++) - { - fprintf(stderr, "%d\t", (unsigned int) (buffer[i])); - } - - fprintf(stderr, "\n"); - } - } -} - -#endif diff --git a/nxcompext/NXlib.h b/nxcompext/NXlib.h deleted file mode 100644 index f4d76cb46..000000000 --- a/nxcompext/NXlib.h +++ /dev/null @@ -1,912 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXlib_H -#define NXlib_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include - -#include "NX.h" -#include "NXpack.h" -#include "NXproto.h" -#include "NXvars.h" - -/* - * All the NX code should use these. - */ - -#define Xmalloc(size) malloc((size)) -#define Xfree(ptr) free((ptr)) - -/* - * Maximum number of supported pack methods. - */ - -#define NXNumberOfPackMethods 128 - -/* - * Assume this as the limit of resources that - * can be provided to the split and unpack - * requests. - */ - -#define NXNumberOfResources 256 - -#define NXNoResource 256 + 1 -#define NXAnyResource 256 + 2 - -/* - * Initialize the internal structures used by - * the library. Should be executed again after - * having reopened the display. - */ - -extern int NXInitDisplay( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Reset all the internal structures. Should be - * executed after closing the display. - */ - -extern int NXResetDisplay( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Set the NX display flush policy. The policy can - * be either NXFlushDeferred or NXFlushImmediate. - */ - -extern int NXSetDisplayPolicy( -#if NeedFunctionPrototypes - Display* /* display */, - int /* policy */ -#endif -); - -/* - * Set the display output buffer size. - */ - -extern int NXSetDisplayBuffer( -#if NeedFunctionPrototypes - Display* /* display */, - int /* size */ -#endif -); - -/* - * If set, the Popen() function in the X server - * wil remove the LD_LIBRARY_PATH variable from - * the environment before calling the execl() - * function on the child process. The function - * returns the previous value. - */ - -extern int NXUnsetLibraryPath( -#if NeedFunctionPrototypes - int /* value */ -#endif -); - -/* - * If the parameter is true, the Xlib I/O error - * handler will return, instead of quitting the - * program. The function returns the previous - * value. - */ - -extern int NXHandleDisplayError( -#if NeedFunctionPrototypes - int /* value */ -#endif -); - -/* - * Shutdown the display descriptor and force Xlib - * to set the I/O error flag. - */ - -extern Bool NXForceDisplayError( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Check the value of the XlibDisplayIOError flag. - * If not set, try to call the display error hand- - * ler to give to the application a chance to see - * whether it needs to close the connection. - */ - -extern int NXDisplayError( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Query the number of bytes readable from the - * display connection. - */ - -extern int NXDisplayReadable( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Query the number of the outstanding bytes to - * flush to the display connection. - */ - -extern int NXDisplayFlushable( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Return a value between 0 and 9 indicating the - * congestion level of the NX transport based on - * the tokens remaining. A value of 9 means that - * the link is congested and no further data can - * be sent. - */ - -extern int NXDisplayCongestion( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -/* - * Flush the Xlib display buffer and/or the - * outstanding data accumulated by the NX - * transport. - */ - -extern int NXFlushDisplay( -#if NeedFunctionPrototypes - Display* /* display */, - int /* what */ -#endif -); - -/* - * Public interfaces used to set the handlers. - * They all return the previous handler. - */ - -extern NXDisplayErrorPredicate NXSetDisplayErrorPredicate( -#if NeedFunctionPrototypes - NXDisplayErrorPredicate /* predicate */ -#endif -); - -/* - * Called when the display blocks waiting to read or - * write more data. - */ - -extern NXDisplayBlockHandler NXSetDisplayBlockHandler( -#if NeedFunctionPrototypes - NXDisplayBlockHandler /* handler */ -#endif -); - -/* - * Called after more data is written to the display. - * When the NX transport is running, data may be queued - * until an explicit flush. - */ - -extern NXDisplayWriteHandler NXSetDisplayWriteHandler( -#if NeedFunctionPrototypes - NXDisplayWriteHandler /* handler */ -#endif -); - -/* - * Called after more data is sent to the remote proxy. - * - * Here the display pointer is passed as the second - * parameter to make clear that the function does not - * tie the callback to the display, but, similarly to - * all the Xlib error handlers, to a global variable - * shared by all the Xlib functions. The display - * pointer will be passed back by nxcomp at the time - * it will call the handler. This is because nxcomp - * doesn't have access to the display structure. - */ - -extern NXDisplayFlushHandler NXSetDisplayFlushHandler( -#if NeedFunctionPrototypes - NXDisplayFlushHandler /* handler */, - Display* /* display */ -#endif -); - -/* - * Get an arbitrary null terminated buffer to be added - * to the NX statistics. - */ - -extern NXDisplayStatisticsHandler NXSetDisplayStatisticsHandler( -#if NeedFunctionPrototypes - NXDisplayStatisticsHandler /* handler */, - char ** /* buffer */ -#endif -); - -/* - * Redefine the function called by Xlib in the case of - * an out-of-order sequence number received in the X - * protocol stream. - */ - -extern NXLostSequenceHandler NXSetLostSequenceHandler( -#if NeedFunctionPrototypes - NXLostSequenceHandler /* handler */ -#endif -); - -/* - * The agent should get the NX parameters at startup, just after - * having opened the display. If the agent is not able to satisfy - * the pack method set by user (because a method is not applica- - * ble, it is not supported by the remote or it simply requires a - * screen depth greater than the depth available), it should fall - * back to the nearest method of the same type. - */ - -extern Status NXGetControlParameters( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int* /* link_type */, - unsigned int* /* local_major */, - unsigned int* /* local_minor */, - unsigned int* /* local_patch */, - unsigned int* /* remote_major */, - unsigned int* /* remote_minor */, - unsigned int* /* remote_patch */, - int* /* frame_timeout */, - int* /* ping_timeout */, - int* /* split_mode */, - int* /* split_size */, - unsigned int* /* pack_method */, - unsigned int* /* pack_quality */, - int* /* data_level */, - int* /* stream_level */, - int* /* delta_level */, - unsigned int* /* load_cache */, - unsigned int* /* save_cache */, - unsigned int* /* startup_cache */ -#endif -); - -/* - * Which unpack methods are supported by the remote proxy? - */ - -extern Status NXGetUnpackParameters( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int* /* entries */, - unsigned char[] /* supported_methods */ -#endif -); - -/* - * Query and enable shared memory support on path agent to X - * client proxy and X server proxy to real X server. At the - * moment only the path proxy to real X server is implemented. - * On return flags will say if support has been successfully - * activated. Segments will contain the XID associated to the - * shared memory blocks. A MIT-SHM compliant protocol is used - * between proxy and the real server, while a simplified - * version is used between the agent and the client proxy to - * accomodate both packed images and plain X bitmaps. - */ - -extern Status NXGetShmemParameters( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int* /* enable_client */, - unsigned int* /* enable_server */, - unsigned int* /* client_segment */, - unsigned int* /* server_segment */, - unsigned int* /* client_size */, - unsigned int* /* server_size */ -#endif -); - -/* - * Get the path to the font server that can be used by the X - * server to tunnel the font connections across the NX link. - * The path actually represents the TCP port where the proxy - * on the NX client side is listening. The agent can tempora- - * rily enable the tunneling when it needs a font that is not - * available on the client, for example when the session is - * migrated from a different X server. - */ - -extern Status NXGetFontParameters( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* path_length */, - char[] /* path_data */ -#endif -); - -/* - * This set of functions is used to leverage the image stream- - * ing capabilities built in nxcomp. An image can be streamed - * by sending a start-split message, followed by the X messages - * that will have to be split by the proxy, followed by an end- - * split closure. Usually, in the middle of a start-split/end- - * split sequence there will be a single PutImage() or PutPack- - * edImage(), that, in turn, can generate multiple partial - * requests, like a SetUnpackColormap() and SetUnpackAlpha() - * that will be later used to decompress the image to its ori- - * ginal form. Multiple requests may be also generated because - * of the maximum size of a X request being exceeded, so that - * Xlib has to divide the single image in multiple sub-image re- - * quests. The agent doesn't need to take care of these details - * but will rather have to track the result of the split opera- - * tion. By monitoring the notify events sent by the proxy, the - * agent will have to implement its own strategy to deal with - * the resources. For example, it will be able to: - * - * - Mark a drawable as dirty, if the image was not sent - * synchronously, in the main X oputput stream. - * - * - Choose to commit or discard the original image, at the - * time it will be recomposed at the remote side. This may - * include all the messages that were part of the split - * (the colormap, the alpha channel, etc.) - * - * - Mark the drawable as clean again, if the image was - * committed and the drawable didn't change in the mean- - * while. - * - * At the time the proxy receives the end-split, it reports the - * result of the operation to the agent. The agent will be able - * to identify the original split operation (the one referenced - * in the start-split/end-split sequence) by the small integer - * number (0-255) named 'resource' sent in the events. - * - * One of the following cases may be encountered: - * - * - * NXNoSplitNotify All messages were sent in the main out- - * put stream, so that no split actually - * took place. - * - * NXStartSplitNotify One or more messages were split, so, - * at discrection of the agent, the client - * may be suspended until the transferral - * is completed. - * - * NXCommitSplitNotify One of the requests that made up the - * split was recomposed. The agent should - * either commit the given request or tell - * the proxy to discard it. - * - * NXEndSplitNotify The split was duly completed. The agent - * can restart the client. - * - * NXEmptySplitNotify No more split operation are pending. - * The agent can use this information to - * implement specific strategies requiring - * that all messages have been recomposed - * at the remote end, like updating the - * drawables that were not synchronized - * because of the lazy encoding. - * - * The 'mode' field that is sent by the agent in the start-split - * request, determines the strategy that the proxy will adopt to - * deal with the image. If set to 'eager', the proxy will only - * split the messages whose size exceeds the split threshold (the - * current threshold can be found in the NXGetControlParameters() - * reply). If the mode is set to lazy, the proxy will split any - * image that would have generated an actual transfer of the data - * part (in practice all images that are not found in the cache). - * This second strategy can be leveraged by an agent to further - * reduce the bandwidth requirements. For example, by setting the - * mode to lazy and by monitoring the result, an agent can easi- - * ly verify if the drawable was successfully updated, mark the - * drawable if not, and synchronize it at later time. - * - * See NXproto.h for the definition of the available modes. - */ - -extern unsigned int NXAllocSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXStartSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - unsigned int /* mode */ -#endif -); - -extern int NXEndSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXCommitSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - unsigned int /* propagate */, - unsigned char /* request */, - unsigned int /* position */ -#endif -); - -extern int NXAbortSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXFinishSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXFreeSplit( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXSetExposeParameters( -#if NeedFunctionPrototypes - Display* /* display */, - int /* expose */, - int /* graphics_expose */, - int /* no_expose */ -#endif -); - -extern int NXSetCacheParameters( -#if NeedFunctionPrototypes - Display* /* display */, - int /* enable_cache */, - int /* enable_split */, - int /* enable_save */, - int /* enable_load */ -#endif -); - -extern unsigned int NXAllocUnpack( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXSetUnpackGeometry( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Visual* /* visual */ -#endif -); - -extern int NXSetUnpackColormap( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - unsigned int /* method */, - unsigned int /* entries */, - const char* /* data */, - unsigned int /* data_length */ -#endif -); - -extern int NXSetUnpackAlpha( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - unsigned int /* method */, - unsigned int /* entries */, - const char* /* data */, - unsigned int /* data_length */ -#endif -); - -extern int NXSetUnpackColormapCompat( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - unsigned int /* entries */, - const char* /* data */ -#endif -); - -extern int NXSetUnpackAlphaCompat( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - unsigned int /* entries */, - const char* /* data */ -#endif -); - -extern int NXFreeUnpack( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -/* - * A packed image is a XImage but with - * offset field containing total amount - * of packed image data. - */ - -typedef XImage NXPackedImage; - -NXPackedImage *NXCreatePackedImage( -#if NeedFunctionPrototypes - Display* /* display */, - Visual* /* visual */, - unsigned int /* method */, - unsigned int /* depth */, - int /* format */, - char* /* data */, - int /* data_length */, - unsigned int /* width */, - unsigned int /* height */, - int /* bitmap_pad */, - int /* bytes_per_line */ -#endif -); - -extern int NXDestroyPackedImage( -#if NeedFunctionPrototypes - NXPackedImage* /* image */ -#endif -); - -NXPackedImage *NXPackImage( -#if NeedFunctionPrototypes - Display* /* display */, - XImage* /* src_image */, - unsigned int /* method */ -#endif -); - -NXPackedImage *NXInPlacePackImage( -#if NeedFunctionPrototypes - Display* /* display */, - XImage* /* src_image */, - unsigned int /* method */ -#endif -); - -/* - * GC is declared void * to get rid of mess - * with different GC definitions in some X - * server code (like in nxagent). - */ - -extern int NXPutPackedImage( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Drawable /* drawable */, - void* /* gc */, - NXPackedImage* /* image */, - unsigned int /* method */, - unsigned int /* depth */, - int /* src_x */, - int /* src_y */, - int /* dst_x */, - int /* dst_y */, - unsigned int /* width */, - unsigned int /* height */ -#endif -); - -/* - * Get multiple colors with a single call by - * pipelining X_AllocColor requests/replies. - */ - -extern int NXAllocColors( -#if NeedFunctionPrototypes - Display* /* display */, - Colormap /* colormap */, - unsigned int /* entries */, - XColor[] /* screens_in_out */, - Bool [] /* flags allocation errors */ -#endif -); - -/* - * Encode the data in the given format. - */ - -extern char *NXEncodeColormap( -#if NeedFunctionPrototypes - const char* /* src_data */, - unsigned int /* src_size */, - unsigned int* /* dst_size */ -#endif -); - -extern char *NXEncodeAlpha( -#if NeedFunctionPrototypes - const char* /* src_data */, - unsigned int /* src_size */, - unsigned int* /* dst_size */ -#endif -); - -extern NXPackedImage *NXEncodeRgb( -#if NeedFunctionPrototypes - XImage* /* src_image */, - unsigned int /* method */, - unsigned int /* quality */ -#endif -); - -extern NXPackedImage *NXEncodeRle( -#if NeedFunctionPrototypes - XImage* /* src_image */, - unsigned int /* method */, - unsigned int /* quality */ -#endif -); - -extern NXPackedImage *NXEncodeJpeg( -#if NeedFunctionPrototypes - XImage* /* src_image */, - unsigned int /* method */, - unsigned int /* quality */ -#endif -); - -typedef struct -{ - long pixel; - int found; - -} NXColorTable; - -extern int NXEncodeColors( -#if NeedFunctionPrototypes - XImage* /* src_image */, - NXColorTable* /* color_table */, - int /* nb_max */ -#endif -); - -extern NXPackedImage *NXEncodePng( -#if NeedFunctionPrototypes - XImage* /* src_image */, - unsigned int /* method */, - unsigned int /* quality */ -#endif -); - -extern NXPackedImage *NXEncodeBitmap( -#if NeedFunctionPrototypes - XImage* /* src_image */, - unsigned int /* method */, - unsigned int /* quality */ -#endif -); - -extern int NXCleanImage( -#if NeedFunctionPrototypes - XImage* -#endif -); - -extern void NXMaskImage( -#if NeedFunctionPrototypes - XImage* /* pointer to image to mask */ , - unsigned int /* method */ -#endif -); - -extern int NXImageCacheSize; - -extern void NXInitCache( -#if NeedFunctionPrototypes - Display* /* display */, - int /* entries in image cache */ -#endif -); - -extern void NXFreeCache( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -extern XImage *NXCacheFindImage( -#if NeedFunctionPrototypes - NXPackedImage* /* packed image to find */, - unsigned int* /* pointer to the pack method if found */, - unsigned char** /* pointer to the calculated MD5 if found */ -#endif -); - -extern int NXCacheAddImage( -#if NeedFunctionPrototypes - NXPackedImage* /* packed image to be added to the cache */, - unsigned int /* pack method of the image to add */, - unsigned char* /* pointer to MD5 of the original unpacked image */ -#endif -); - - -extern int NXGetCollectImageResource( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -extern int NXCollectImage( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Drawable /* drawable */, - int /* src_x */, - int /* src_y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* plane_mask */, - int /* format */ -#endif -); - -extern int NXGetCollectedImage( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - XImage** /* image */ -#endif -); - -extern int NXGetCollectPropertyResource( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -extern int NXCollectProperty( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Window /* window */, - Atom /* property */, - long /* long_offset */, - long /* long_length */, - Bool /* delete */, - Atom /* req_type */ -#endif -); - -extern int NXGetCollectedProperty( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Atom* /* actual_type_return */, - int* /* actual_format_return */, - unsigned long* /* nitems_return */, - unsigned long* /* bytes_after_return */, - unsigned char** /* data */ -#endif -); - -extern int NXGetCollectGrabPointerResource( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -extern int NXCollectGrabPointer( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Window /* grab_window */, - Bool /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */, - Time /* time */ -#endif -); - -extern int NXGetCollectedGrabPointer( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - int* /* status */ -#endif -); - -extern int NXGetCollectInputFocusResource( -#if NeedFunctionPrototypes - Display* /* display */ -#endif -); - -extern int NXCollectInputFocus( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */ -#endif -); - -extern int NXGetCollectedInputFocus( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned int /* resource */, - Window* /* focus_return */, - int* /* revert_to_return */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* NXlib_H */ diff --git a/nxcompext/Pgn.c b/nxcompext/Pgn.c deleted file mode 100644 index 3099a248c..000000000 --- a/nxcompext/Pgn.c +++ /dev/null @@ -1,730 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#include "Xutil.h" - -#include "NXlib.h" - -#include "Mask.h" -#include "Pgn.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -/* - * Selected ZLIB compression level. - */ - -#define PNG_Z_LEVEL 4 - -/* - * Local function prototypes. - */ - -static void PrepareRowForPng(CARD8 *dst, int y, int count); -static void PrepareRowForPng24(CARD8 *dst, int y, int count); -static void PrepareRowForPng16(CARD8 *dst, int y, int count); -static void PrepareRowForPng32(CARD8 *dst, int y, int count); - -static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length); -static void PngFlushData(png_structp png_ptr); - -/* - * Image characteristics. - */ - -static int bytesPerLine; -static int byteOrder; - -static CARD8 bitsPerPixel; -static CARD16 redMax, greenMax, blueMax; -static CARD8 redShift, greenShift, blueShift; - -/* - * Other variables used for the Png - * encoding. - */ - -png_byte color_type; -png_structp png_ptr; -png_infop info_ptr; -png_colorp palette; -static char *pngCompBuf; -static int pngDataLen; -static char *pngBeforeBuf = NULL; - -/* - * Allocate data for the compressed image. - * We need to ensure that there is enough - * space to include the palette and the - * header. - */ - -#define PNG_DEST_SIZE(width, height) ((width) * 3 * (height) + 1024 + 256) - -/* - * Just for debug purposes. - */ - -#ifdef DEBUG - -static int pngId; -static char pngName[10]; -static FILE *pngFile; - -#endif - -int PngCompareColorTable(NXColorTable *c1, NXColorTable *c2) -{ - return (c1 -> pixel - c2 -> pixel); -} - -#define NB_COLOR_MAX 256 - -int NXCreatePalette32(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) -{ - int x, y, t, p; - CARD8 *fbptr; - CARD32 pixel; - - fbptr = (CARD8 *) (src_image -> data); - - /* - * TODO: Find a more intelligent way to - * estimate the number of colors. - */ - - memset(color_table, 0, nb_max * sizeof(NXColorTable)); - - for (x = 0, p = 0; x < src_image -> height; x++) - { - for (y = 0; y < src_image -> width; y++) - { - if (byteOrder == LSBFirst) - { - pixel = (CARD32) *(fbptr + 3); - pixel = (pixel << 8) | (CARD32) *(fbptr + 2); - pixel = (pixel << 8) | (CARD32) *(fbptr + 1); - pixel = (pixel << 8) | (CARD32) *fbptr; - } - else - { - pixel = (CARD32) *fbptr; - pixel = (pixel << 8) | (CARD32) *(fbptr + 1); - pixel = (pixel << 8) | (CARD32) *(fbptr + 2); - pixel = (pixel << 8) | (CARD32) *(fbptr + 3); - } - - fbptr += 4; - - for (t = 0; t < nb_max; t++) - { - if (color_table[t].found == 0) - { - color_table[t].pixel = pixel; - color_table[t].found = 1; - p++; - image_index[((x * src_image -> width) + y)] = t; - - break; - } - else if ((CARD32)(color_table[t].pixel) == pixel) - { - image_index[((x * src_image -> width) + y)] = t; - - break; - } - } - - if (p == nb_max) - { - return nb_max + 1; - } - } - } - return p; -} - -int NXCreatePalette16(XImage *src_image, NXColorTable *color_table, CARD8 *image_index, int nb_max) -{ - int x, y, t, p; - CARD8 *fbptr; - CARD16 pixel; - - fbptr = (CARD8 *) (src_image -> data); - - /* - * TODO: Find a more intelligent way to - * estimate the number of colors. - */ - - memset(color_table, 0, nb_max * sizeof(NXColorTable)); - - for (x = 0, p = 0; x < src_image -> height; x++) - { - for (y = 0; y < src_image -> width; y++) - { - if (byteOrder == LSBFirst) - { - pixel = (CARD16) *(fbptr + 1); - pixel = (pixel << 8) | (CARD16) *fbptr; - } - else - { - pixel = (CARD16) *fbptr; - pixel = (pixel << 8) | (CARD16) *(fbptr + 1); - } - - fbptr += 2; - - for (t = 0; t < nb_max; t++) - { - if (color_table[t].found == 0) - { - color_table[t].pixel = pixel; - color_table[t].found = 1; - p++; - image_index[((x * src_image -> width) + y)] = t; - - break; - } - else if ((color_table[t].pixel) == pixel) - { - image_index[((x * src_image -> width) + y)] = t; - - break; - } - } - - /* - * In case the number of 16bit words is not even - * we have 2 padding bytes that we have to skip. - */ - - if ((y == src_image -> width - 1) && (src_image -> width % 2 == 1)) fbptr += 2; - - if (p == nb_max) - { - return nb_max + 1; - } - } - } - - return p; -} - -char *PngCompressData(XImage *image, int *compressed_size) -{ - unsigned int num = 0; - CARD8 *srcBuf; - - int dy, w, h; - - int nb_colors; - - NXColorTable color_table[NB_COLOR_MAX]; - CARD8 *image_index; - - image_index = (CARD8 *) malloc((image -> height) * (image -> width) * sizeof(CARD8)); - - /* - * TODO: Be sure the padded bytes are cleaned. - * It would be better to set to zero the bytes - * that are not alligned to the word boundary - * at the end of the procedure. - */ - - memset(image_index, 0, (image -> height) * (image -> width) * sizeof(CARD8)); - - *compressed_size = 0; - - pngDataLen = 0; - - /* - * Initialize the image stuff. - */ - - bitsPerPixel = image -> bits_per_pixel; - bytesPerLine = image -> bytes_per_line; - byteOrder = image -> byte_order; - - if (bitsPerPixel < 15) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Can't compress images with [%d] bits per pixel.\n", - bitsPerPixel); - #endif - - return NULL; - } - - redShift = FindLSB(image -> red_mask) - 1; - greenShift = FindLSB(image -> green_mask) - 1; - blueShift = FindLSB(image -> blue_mask) - 1; - - redMax = image -> red_mask >> redShift; - greenMax = image -> green_mask >> greenShift; - blueMax = image -> blue_mask >> blueShift; - - w = image -> width; - h = image -> height; - pngBeforeBuf = image -> data; - - #ifdef DEBUG - fprintf(stderr, "******PngCompressData: Compressing image with width [%d] height [%d].\n", - w, h ); - #endif - - /* - * Initialize the PNG stuff. - */ - - png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - if (png_ptr == NULL) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_write_struct.\n"); - #endif - - return NULL; - } - - info_ptr = png_create_info_struct(png_ptr); - - if (info_ptr == NULL) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Failed creating the png_create_info_struct.\n"); - #endif - - png_destroy_write_struct(&png_ptr, NULL); - - return NULL; - } - - if (setjmp(png_jmpbuf(png_ptr))) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Error during compression initialization.\n"); - #endif - - png_destroy_write_struct(&png_ptr, &info_ptr); - - return NULL; - } - - /* - * Be sure we allocate enough data. - */ - - #ifdef TEST - fprintf(stderr, "******PngCompressData: Allocating [%d] bytes for the destination data.\n", - PNG_DEST_SIZE(w, h)); - #endif - - pngCompBuf = malloc(PNG_DEST_SIZE(w, h)); - - if (pngCompBuf == NULL) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Error allocating [%d] bytes for the Png data.\n", - PNG_DEST_SIZE(w, h)); - #endif - - return NULL; - } - - png_set_write_fn(png_ptr, (void *) pngCompBuf, PngWriteData, PngFlushData); - - if (setjmp(png_jmpbuf(png_ptr))) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Error writing the header.\n"); - #endif - - png_destroy_write_struct(&png_ptr, &info_ptr); - - free(pngCompBuf); - - return NULL; - } - - png_set_compression_level(png_ptr, PNG_Z_LEVEL); - - if (bitsPerPixel == 16) - { - nb_colors = NXCreatePalette16(image, color_table, image_index, NB_COLOR_MAX); - } - else - { - nb_colors = NXCreatePalette32(image, color_table, image_index, NB_COLOR_MAX); - } - - if (nb_colors <= NB_COLOR_MAX) - { - color_type = PNG_COLOR_TYPE_PALETTE; - } - else - { - color_type = PNG_COLOR_TYPE_RGB; - } - - png_set_IHDR(png_ptr, info_ptr, w, h, - 8, color_type, PNG_INTERLACE_NONE, - PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE); - - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - palette = png_malloc(png_ptr, sizeof(*palette) * 256); - - /* - * TODO: Do we need to clean these bytes? - * - * memset(palette, 0, sizeof(*palette) * 256); - */ - - for (num = 0; num < 256 && color_table[num].found != 0; num++) - { - if (bitsPerPixel == 24) - { - palette[num].red = (color_table[num].pixel >> redShift) & redMax; - palette[num].green = (color_table[num].pixel >> greenShift) & greenMax; - palette[num].blue = color_table[num].pixel >> blueShift & blueMax; - } - else - { - int inRed, inGreen, inBlue; - - inRed = (color_table[num].pixel >> redShift) & redMax; - inGreen = (color_table[num].pixel >> greenShift) & greenMax; - inBlue = color_table[num].pixel >> blueShift & blueMax; - - palette[num].red = (CARD8)((inRed * 255 + redMax / 2) / redMax); - palette[num].green = (CARD8)((inGreen * 255 + greenMax / 2) / greenMax); - palette[num].blue = (CARD8)((inBlue * 255 + blueMax / 2) / blueMax); - } - - #ifdef DEBUG - fprintf(stderr, "******PngCompressData: pixel[%d] r[%d] g[%d] b[%d].\n", - (int) color_table[num].pixel,palette[num].red,palette[num].green,palette[num].blue); - #endif - } - - png_set_PLTE(png_ptr, info_ptr, palette, num); - - #ifdef DEBUG - fprintf(stderr, "******PngCompressedData: Setting palette.\n"); - #endif - } - - /* - * End of palette. - */ - - png_write_info(png_ptr, info_ptr); - - /* - * Allocate space for one line of - * the image, 3 bytes per pixel. - */ - - #ifdef DEBUG - fprintf(stderr, "******PngCompressedData: Initialization finished.\n"); - #endif - - if (setjmp(png_jmpbuf(png_ptr))) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Error while writing the image rows.\n"); - #endif - - png_destroy_write_struct(&png_ptr, &info_ptr); - - free(pngCompBuf); - - return NULL; - } - - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - srcBuf = (CARD8 *) malloc(w * sizeof(CARD8)); - - if (srcBuf == NULL) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", - (int) (w * sizeof(CARD8))); - #endif - - return NULL; - } - - /* - * TODO: Be sure the padded bytes are cleaned. - * It would be better to set to zero the bytes - * that are not alligned to the word boundary - * at the end of the procedure. - */ - - memset(srcBuf, 0, w * sizeof(CARD8)); - } - else - { - srcBuf = (CARD8 *) malloc(w * 3 * sizeof(CARD8)); - - /* - * TODO: See above. - */ - - memset(srcBuf, 0, w * 3 * sizeof(CARD8)); - } - - if (srcBuf == NULL) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! Cannot allocate [%d] bytes.\n", - w * 3); - #endif - - free(pngCompBuf); - - return NULL; - } - - for (dy = 0; dy < h; dy++) - { - if (color_type == PNG_COLOR_TYPE_RGB) - { - PrepareRowForPng(srcBuf, dy, w); - } - else - { - memcpy(srcBuf, image_index + (dy * w), w); - } - - png_write_row(png_ptr, srcBuf); - } - - #ifdef DEBUG - fprintf(stderr, "******PngCompressedData: Compression finished. Lines handled [%d,%d].\n", - dy, h); - #endif - - free(srcBuf); - free(image_index); - - if (setjmp(png_jmpbuf(png_ptr))) - { - #ifdef PANIC - fprintf(stderr, "******PngCompressData: PANIC! error during end of write.\n"); - #endif - - png_destroy_write_struct(&png_ptr, &info_ptr); - - free(pngCompBuf); - - return NULL; - } - - png_write_end(png_ptr, NULL); - - if (color_type == PNG_COLOR_TYPE_PALETTE) - { - png_free(png_ptr, palette); - } - - png_destroy_write_struct(&png_ptr, &info_ptr); - - /* - * Check the size of the resulting data. - */ - - if (pngDataLen > 0) - { - #ifdef DEBUG - - int i = 0; - - fprintf(stderr, "******PngCompressedData: Compressed size [%d].\n", - pngDataLen); - - pngId++; - sprintf(pngName, "png%d", pngId); - pngFile = fopen(pngName, "w"); - - for (i = 0; i < pngDataLen; i++) - { - fprintf(pngFile, "%c", *(pngCompBuf + i)); - } - - fclose(pngFile); - - #endif - - *compressed_size = pngDataLen; - - return pngCompBuf; - } - else - { - #ifdef DEBUG - fprintf(stderr, "******PngCompressedData: PANIC! Invalid size of the compressed data [%d].\n", - pngDataLen); - #endif - - free(pngCompBuf); - - return NULL; - } -} - -static void PngWriteData(png_structp png_ptr, png_bytep data, png_size_t length) -{ - memcpy(((char *) png_get_io_ptr(png_ptr) + pngDataLen), data, length); - - pngDataLen += length; -} - -static void PngFlushData(png_structp png_ptr) -{ -} - -void PrepareRowForPng(CARD8 *dst, int y, int count) -{ - if (bitsPerPixel == 32) - { - if (redMax == 0xff && - greenMax == 0xff && - blueMax == 0xff) - { - PrepareRowForPng24(dst, y, count); - } - else - { - PrepareRowForPng32(dst, y, count); - } - } - else if (bitsPerPixel == 24) - { - memcpy(dst, pngBeforeBuf + y * bytesPerLine, count * 3); - } - else - { - /* - * 16 bpp assumed. - */ - - PrepareRowForPng16(dst, y, count); - } -} - - - -void PrepareRowForPng24(CARD8 *dst, int y, int count) -{ - CARD8 *fbptr; - CARD32 pix; - - fbptr = (CARD8 *) (pngBeforeBuf + y * bytesPerLine); - - while (count--) - { - if (byteOrder == LSBFirst) - { - pix = (CARD32) *(fbptr + 2); - pix = (pix << 8) | (CARD32) *(fbptr+1); - pix = (pix << 8) | (CARD32) *fbptr; - } - else - { - pix = (CARD32) *(fbptr + 1); - pix = (pix << 8) | (CARD32) *(fbptr + 2); - pix = (pix << 8) | (CARD32) *(fbptr + 3); - } - - *dst++ = (CARD8)(pix >> redShift); - *dst++ = (CARD8)(pix >> greenShift); - *dst++ = (CARD8)(pix >> blueShift); - - fbptr+=4; - } -} - -#define DEFINE_PNG_GET_ROW_FUNCTION(bpp) \ - \ -void PrepareRowForPng##bpp(CARD8 *dst, int y, int count) \ -{ \ - CARD8 *fbptr; \ - CARD##bpp pix; \ - int inRed, inGreen, inBlue; \ - int i; \ - \ - fbptr = (CARD8 *) (pngBeforeBuf + y * bytesPerLine); \ - \ - while (count--) \ - { \ - pix = 0; \ - \ - if (byteOrder == LSBFirst) \ - { \ - for (i = (bpp >> 3) - 1; i >= 0; i--) \ - { \ - pix = (pix << 8) | (CARD32) *(fbptr + i); \ - } \ - } \ - else \ - { \ - for (i = 0; i < (bpp >> 3); i++) \ - { \ - pix = (pix << 8) | (CARD32) *(fbptr + i); \ - } \ - } \ - \ - fbptr += (bpp >> 3); \ - \ - inRed = (int) \ - (pix >> redShift & redMax); \ - inGreen = (int) \ - (pix >> greenShift & greenMax); \ - inBlue = (int) \ - (pix >> blueShift & blueMax); \ - *dst++ = (CARD8)((inRed * 255 + redMax / 2) / \ - redMax); \ - *dst++ = (CARD8)((inGreen * 255 + greenMax / 2) / \ - greenMax); \ - *dst++ = (CARD8)((inBlue * 255 + blueMax / 2) / \ - blueMax); \ - } \ -} - -DEFINE_PNG_GET_ROW_FUNCTION(16) -DEFINE_PNG_GET_ROW_FUNCTION(32) diff --git a/nxcompext/Pgn.h b/nxcompext/Pgn.h deleted file mode 100644 index eb4c8cc3f..000000000 --- a/nxcompext/Pgn.h +++ /dev/null @@ -1,76 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Pgn_H -#define Pgn_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -#include - -extern int PngCompareColorTable( -#if NeedFunctionPrototypes - NXColorTable* /* color_table_1 */, - NXColorTable* /* color_table_2 */ -#endif -); - -extern char *PngCompressData( -#if NeedFunctionPrototypes - XImage* /* image */, - int* /* compressed_size */ -#endif -); - -int NXCreatePalette16( -#if NeedFunctionPrototypes - XImage* /* src_image */, - NXColorTable* /* color_table */, - CARD8* /* image_index */, - int /* nb_max */ -#endif -); - -int NXCreatePalette32( -#if NeedFunctionPrototypes - XImage* /* src_image */, - NXColorTable* /* color_table */, - CARD8* /* image_index */, - int /* nb_max */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Pgn_H */ - diff --git a/nxcompext/Rgb.c b/nxcompext/Rgb.c deleted file mode 100644 index 683f11898..000000000 --- a/nxcompext/Rgb.c +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "NXlib.h" - -#include "Rgb.h" -#include "Z.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define RGB_COMPRESSION_LEVEL 4 -#define RGB_COMPRESSION_THRESHOLD 32 -#define RGB_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY - -static int rgbCompressionLevel = RGB_COMPRESSION_LEVEL; -static int rgbCompressionThreshold = RGB_COMPRESSION_THRESHOLD; -static int rgbCompressionStrategy = RGB_COMPRESSION_STRATEGY; - -char *RgbCompressData(XImage *image, unsigned int *size) -{ - return ZCompressData(image -> data, image -> bytes_per_line * image -> height, - rgbCompressionThreshold, rgbCompressionLevel, - rgbCompressionStrategy, size); -} diff --git a/nxcompext/Rgb.h b/nxcompext/Rgb.h deleted file mode 100644 index fd53ffbf9..000000000 --- a/nxcompext/Rgb.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Rgb_H -#define Rgb_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *RgbCompressData( -#if NeedFunctionPrototypes - XImage* /* image */, - unsigned int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Rgb_H */ diff --git a/nxcompext/Rle.c b/nxcompext/Rle.c deleted file mode 100644 index 883fde1e8..000000000 --- a/nxcompext/Rle.c +++ /dev/null @@ -1,51 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "NXlib.h" - -#include "Rle.h" -#include "Z.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define RLE_COMPRESSION_LEVEL 1 -#define RLE_COMPRESSION_THRESHOLD 32 -#define RLE_COMPRESSION_STRATEGY Z_RLE - -static int rleCompressionLevel = RLE_COMPRESSION_LEVEL; -static int rleCompressionThreshold = RLE_COMPRESSION_THRESHOLD; -static int rleCompressionStrategy = RLE_COMPRESSION_STRATEGY; - -char *RleCompressData(XImage *image, unsigned int *size) -{ - return ZCompressData(image -> data, image -> bytes_per_line * image -> height, - rleCompressionThreshold, rleCompressionLevel, - rleCompressionStrategy, size); -} diff --git a/nxcompext/Rle.h b/nxcompext/Rle.h deleted file mode 100644 index a32812657..000000000 --- a/nxcompext/Rle.h +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Rle_H -#define Rle_H - -#ifdef __cplusplus -extern "C" { -#endif - -extern char *RleCompressData( -#if NeedFunctionPrototypes - XImage* /* image */, - unsigned int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Rle_H */ diff --git a/nxcompext/VERSION b/nxcompext/VERSION deleted file mode 120000 index 6ff19de4b..000000000 --- a/nxcompext/VERSION +++ /dev/null @@ -1 +0,0 @@ -../VERSION \ No newline at end of file diff --git a/nxcompext/Z.c b/nxcompext/Z.c deleted file mode 100644 index 9ee453d32..000000000 --- a/nxcompext/Z.c +++ /dev/null @@ -1,309 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#include - -#include "NXlib.h" - -#include "Z.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define Z_COMPRESSION_LEVEL 4 -#define Z_COMPRESSION_THRESHOLD 32 -#define Z_COMPRESSION_STRATEGY Z_DEFAULT_STRATEGY - -static int zCompressionLevel = Z_COMPRESSION_LEVEL; -static int zCompressionStrategy = Z_COMPRESSION_STRATEGY; - -static z_stream *zStream; - -static int zInitialized; - -static int ZConfigure(int level, int strategy); - -static int ZDeflate(char *dest, unsigned int *destLen, - const char *source, unsigned int sourceLen); - -char *ZCompressData(const char *plainData, unsigned int plainSize, int threshold, - int level, int strategy, unsigned int *compressedSize) -{ - char *compressedData; - - /* - * Determine the size of the source image - * data and make sure there is enough - * space in the destination buffer. - */ - - *compressedSize = plainSize + (plainSize / 1000) + 12 + 1; - - compressedData = Xmalloc(*compressedSize); - - if (compressedData == NULL) - { - #ifdef PANIC - fprintf(stderr, "******ZCompressData: PANIC! Failed to allocate [%d] bytes for the destination.\n", - *compressedSize); - #endif - - *compressedSize = 0; - - return NULL; - } - - if (level == Z_NO_COMPRESSION || plainSize < threshold) - { - #ifdef TEST - fprintf(stderr, "******ZCompressData: Not compressing [%d] bytes with level [%d] and " - "threshold [%d].\n", plainSize, level, threshold); - #endif - - /* - * Tell in the first byte of the buffer - * if the remaining data is compressed - * or not. This same byte can be used - * in future to store some other flag. - */ - - *compressedData = 0; - - memcpy(compressedData + 1, plainData, plainSize); - - *compressedSize = plainSize + 1; - - return compressedData; - } - else - { - int result; - - /* - * Reconfigure the stream if needed. - */ - - if (zCompressionLevel != level || - zCompressionStrategy != strategy) - { - ZConfigure(level, strategy); - - zCompressionLevel = level; - zCompressionStrategy = strategy; - } - - result = ZDeflate(compressedData + 1, compressedSize, plainData, plainSize); - - if (result != Z_OK) - { - #ifdef PANIC - fprintf(stderr, "******ZCompressData: PANIC! Failed to compress [%d] bytes with error [%s].\n", - plainSize, zError(result)); - #endif - - Xfree(compressedData); - - *compressedSize = 0; - - return NULL; - } - - #ifdef TEST - fprintf(stderr, "******ZCompressData: Source data of [%d] bytes compressed to [%d].\n", - plainSize, *compressedSize); - #endif - - *compressedData = 1; - - *compressedSize = *compressedSize + 1; - - return compressedData; - } -} - -int ZConfigure(int level, int strategy) -{ - /* - * ZLIB wants the avail_out to be - * non zero, even if the stream was - * already flushed. - */ - - unsigned char dest[1]; - - zStream -> next_out = dest; - zStream -> avail_out = 1; - - if (deflateParams(zStream, level, strategy) != Z_OK) - { - #ifdef PANIC - fprintf(stderr, "******ZConfigure: PANIC! Failed to set level to [%d] and strategy to [%d].\n", - level, strategy); - #endif - - return -1; - } - #ifdef TEST - else - { - fprintf(stderr, "******ZConfigure: Reconfigured the stream with level [%d] and strategy [%d].\n", - level, strategy); - } - #endif - - return 1; -} - -int ZDeflate(char *dest, unsigned int *destLen, const char *source, unsigned int sourceLen) -{ - int saveOut; - int result; - - /* - * Deal with the possible overflow. - */ - - if (zStream -> total_out & 0x80000000) - { - #ifdef TEST - fprintf(stderr, "******ZDeflate: Reset Z stream counters with total in [%ld] total out [%ld].\n", - zStream -> total_in, zStream -> total_out); - #endif - - zStream -> total_in = 0; - zStream -> total_out = 0; - } - - saveOut = zStream -> total_out; - - zStream -> next_in = (Bytef *) source; - zStream -> avail_in = (uInt) sourceLen; - - #ifdef MAXSEG_64K - - /* - * Check if the source is greater - * than 64K on a 16-bit machine. - */ - - if ((uLong) zStream -> avail_in != sourceLen) return Z_BUF_ERROR; - - #endif - - zStream -> next_out = (unsigned char *) dest; - zStream -> avail_out = (uInt) *destLen; - - if ((uLong) zStream -> avail_out != *destLen) return Z_BUF_ERROR; - - result = deflate(zStream, Z_FINISH); - - if (result != Z_STREAM_END) - { - deflateReset(zStream); - - return (result == Z_OK ? Z_BUF_ERROR : result); - } - - *destLen = zStream -> total_out - saveOut; - - result = deflateReset(zStream); - - return result; -} - -int ZInitEncoder() -{ - if (zInitialized == 0) - { - int result; - - zStream = Xmalloc(sizeof(z_stream)); - - if (zStream == NULL) - { - #ifdef PANIC - fprintf(stderr, "******ZInitEncoder: PANIC! Failed to allocate memory for the stream.\n"); - #endif - - return -1; - } - - zStream -> zalloc = (alloc_func) 0; - zStream -> zfree = (free_func) 0; - zStream -> opaque = (voidpf) 0; - - #ifdef TEST - fprintf(stderr, "******ZInitEncoder: Initializing compressor with level [%d] and startegy [%d].\n", - zCompressionLevel, zCompressionStrategy); - #endif - - result = deflateInit2(zStream, zCompressionLevel, Z_DEFLATED, - 15, 9, zCompressionStrategy); - - if (result != Z_OK) - { - #ifdef PANIC - fprintf(stderr, "******ZInitEncoder: Failed to initialize the compressor with error [%s].\n", - zError(result)); - #endif - - return -1; - } - - zInitialized = 1; - } - - return zInitialized; -} - -int ZResetEncoder() -{ - int result; - - if (zInitialized == 1) - { - result = deflateEnd(zStream); - - if (result != Z_OK) - { - #ifdef WARNING - fprintf(stderr, "******ZResetEncoder: WARNING! Failed to deinitialize the compressor with error [%s].\n", - zError(result)); - #endif - } - - Xfree(zStream); - } - - zInitialized = 0; - - return 1; -} diff --git a/nxcompext/Z.h b/nxcompext/Z.h deleted file mode 100644 index 8133f0c73..000000000 --- a/nxcompext/Z.h +++ /dev/null @@ -1,60 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Z_H -#define Z_H - -#ifdef __cplusplus -extern "C" { -#endif - -int ZInitEncoder( -#if NeedFunctionPrototypes -void -#endif -); - -int ZResetEncoder( -#if NeedFunctionPrototypes -void -#endif -); - -extern char *ZCompressData( -#if NeedFunctionPrototypes - const char* /* data */, - unsigned int /* size */, - int /* threshold */, - int /* level */, - int /* strategy */, - unsigned int* /* compressed_size */ -#endif -); - -#ifdef __cplusplus -} -#endif - -#endif /* Z_H */ diff --git a/nxcompext/configure.in b/nxcompext/configure.in deleted file mode 100644 index 2ec62d497..000000000 --- a/nxcompext/configure.in +++ /dev/null @@ -1,270 +0,0 @@ -dnl /**************************************************************************/ -dnl /* */ -dnl /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -dnl /* Copyright (c) 2008-2014 Oleksandr Shneyder */ -dnl /* Copyright (c) 2014-2016 Ulrich Sibiller */ -dnl /* Copyright (c) 2014-2016 Mihai Moldovan */ -dnl /* Copyright (c) 2011-2016 Mike Gabriel */ -dnl /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -dnl /* */ -dnl /* NXCOMPEXT, NX protocol compression and NX extensions to this software */ -dnl /* are copyright of the aforementioned persons and companies. */ -dnl /* */ -dnl /* Redistribution and use of the present software is allowed according */ -dnl /* to terms specified in the file LICENSE which comes in the source */ -dnl /* distribution. */ -dnl /* */ -dnl /* All rights reserved. */ -dnl /* */ -dnl /* NOTE: This software has received contributions from various other */ -dnl /* contributors, only the core maintainers and supporters are listed as */ -dnl /* copyright holders. Please contact us, if you feel you should be listed */ -dnl /* as copyright holder, as well. */ -dnl /* */ -dnl /**************************************************************************/ - -dnl Process this file with autoconf to produce a configure script. - -dnl Prolog - -AC_INIT(NXlib.h) -AC_PREREQ(2.13) - -pkgconfigdir=${libdir}/pkgconfig -AC_SUBST(pkgconfigdir) - -dnl Reset default compilation flags. - -if test "x$CXXFLAGS" = "x"; then - CXXFLAGS="-O3" -fi -if test "x$CFLAGS" == "x"; then - CFLAGS="-O3" -fi - -dnl Reset default linking directives. - -LIBSTATIC="" -LIBSHARED="" - -dnl Prefer headers and libraries from nx-X11, if present. - -if test -d "../nx-X11/include" ; then - CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include -I../nx-X11/lib/X11 \ - -I../nx-X11/include -I../nx-X11/programs/Xserver/include" - CFLAGS="$CFLAGS -I../nx-X11/exports/include -I../nx-X11/lib/X11 \ - -I../nx-X11/include -I../nx-X11/programs/Xserver/include" - LDFLAGS="$LDFLAGS -L../nx-X11/exports/lib" -fi - -X_CFLAGS=`pkg-config --cflags-only-I pixman-1` - -dnl Check for programs. - -AC_PROG_CXX -AC_PROG_CC -AC_LANG_CPLUSPLUS - -dnl Check for BSD compatible install. - -AC_PROG_INSTALL - -dnl Check for extra header files. - -AC_PATH_XTRA - -dnl Custom addition. -ac_help="$ac_help - --with-symbols add the -g flag to produce the debug symbols - --with-info enable basic log output to trace the program - --with-valgrind clean up allocated buffers to avoid valgrind warnings - --with-version use this version for produced libraries - - --with-static-png enable static linking of PNG library - --with-static-jpeg enable static linking of JPEG library" - -dnl Check to see if we're running under Cygwin32. - -AC_DEFUN(nxproxy_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, nxproxy_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -nxproxy_cv_cygwin32=yes, nxproxy_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$nxproxy_cv_cygwin32" = yes && CYGWIN32=yes]) - -dnl CygWin32 requires the stdc++ library explicitly linked. - -nxproxy_CYGWIN32 -if test "$CYGWIN32" = yes; then - LIBS="$LIBS -mwindows -lstdc++" -fi - -dnl Check whether we're building on a AMD64. - -AC_DEFUN(nxconf_AMD64, -[AC_CACHE_CHECK(for Amd64 environment, nxconf_cv_amd64, -[AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], -nxconf_cv_amd64=yes, nxconf_cv_amd64=no) -rm -f conftest*]) -AMD64= -test "$nxconf_cv_amd64" = yes && AMD64=yes]) -nxconf_AMD64 - -dnl Check to see if we're running under Solaris. - -AC_DEFUN(nxconf_SUN, -[AC_CACHE_CHECK(for SunOS environment, nxconf_cv_sun, -[AC_TRY_COMPILE(,[return __sun;], -nxconf_cv_sun=yes, nxconf_cv_sun=no) -rm -f conftest*]) -SUN= -test "$nxconf_cv_sun" = yes && SUN=yes]) -nxconf_SUN - -if test "$SUN" = yes; then - CFLAGS="$CFLAGS -I/usr/sfw/include" -fi - -if test "$SUN" = yes; then - LDFLAGS="$LDFLAGS -G -h \$(LIBLOAD) -L/usr/sfw/lib" -else - LDFLAGS="$LDFLAGS -shared -Wl,-soname,\$(LIBLOAD)" -fi - -dnl Check to see if we're running under FreeBSD. - -AC_DEFUN(nxconf_FreeBSD, -[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd, -[AC_TRY_COMPILE(,[return __FreeBSD__;], -nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) -rm -f conftest*]) -FreeBSD= -test "$nxconf_cv_freebsd" = yes && FreeBSD=yes]) -nxconf_FreeBSD - -dnl Build PIC libraries. - -if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then - CXXFLAGS="$CXXFLAGS -fPIC" - CFLAGS="$CFLAGS -fPIC" -fi - -dnl On FreeBSD search libraries and includes under /usr/local. - -if test "$FreeBSD" = yes; then - LIBS="$LIBS -L/usr/local/lib" - CXXFLAGS="$CXXFLAGS -I/usr/local/include" - CFLAGS="$CFLAGS -I/usr/local/include" -fi - -dnl Check whether --with-static-png was -dnl given and add -lpng or libpng.a to linking. - -if test "${with_static_png}" = yes; then - echo -e "enabling static linking of PNG library" - if test "$CYGWIN32" = yes; then - LIBS="$LIBSTATIC -static -lpng" - else - if test -f "/usr/lib/libpng.a" ; then - LIBS="/usr/lib/libpng.a $LIBS" - else - if test -f "/usr/local/lib/libpng.a" ; then - echo -e "assuming libpng.a in /usr/local/lib" - LIBS="/usr/local/lib/libpng.a $LIBS" - else - echo -e "assuming libpng.a in default linker path" - LIBS="libpng.a $LIBS" - fi - fi - fi -else - echo -e "enabling dynamic linking of PNG library" - LIBS="-lpng $LIBS" -fi - -dnl Check whether --with-static-jpeg was -dnl given and add -ljpeg or libjpeg.a to linking. -if test "${with_static_jpeg}" = yes; then - echo -e "enabling static linking of JPEG library" - if test "$CYGWIN32" = yes; then - LIBSTATIC="$LIBS -static -ljpeg" - else - if test -f "/usr/lib/libjpeg.a" ; then - LIBS="/usr/lib/libjpeg.a $LIBS" - else - if test -f "/usr/local/lib/libjpeg.a" ; then - echo -e "assuming libjpeg.a in /usr/local/lib" - LIBS="/usr/local/lib/libjpeg.a $LIBS" - else - echo -e "assuming libjpeg.a in default linker path" - LIBS="libjpeg.a $LIBS" - fi - fi - fi -else - echo -e "enabling dynamic linking of JPEG library" - LIBS="-ljpeg $LIBS" -fi - -dnl Check whether --with-symbols or --without-symbols was -dnl given and set the required optimization level. -if test "${with_symbols}" = yes; then - echo -e "enabling production of debug symbols" - CXXFLAGS="-g $CXXFLAGS" - CFLAGS="-g $CFLAGS" -else - echo -e "disabling production of debug symbols" -fi - -dnl Check whether --with-info or --without-info was given. -if test "${with_info}" = yes; then - echo -e "enabling info output in the log file" - CXXFLAGS="$CXXFLAGS -DINFO" - CFLAGS="$CFLAGS -DINFO" -else - echo -e "disabling info output in the log file" -fi - -dnl Check whether --with-valgrind or --without-valgrind was given. -if test "${with_valgrind}" = yes; then - echo -e "enabling valgrind memory checker workarounds" - CXXFLAGS="$CXXFLAGS -DVALGRIND" - CFLAGS="$CFLAGS -DVALGRIND" -else - echo -e "disabling valgrind memory checker workarounds" -fi - -dnl Check whether --with-version was given. -AC_SUBST(LIBVERSION) -AC_SUBST(VERSION) -if test "${with_version}" = yes; then - VERSION=${ac_option} -else - VERSION=`cat VERSION` -fi -echo -e "compiling version ${VERSION}" - -LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1` - -CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\"" -CFLAGS="$CFLAGS -DVERSION=\\\"${VERSION}\\\"" - -dnl Find makedepend somewhere. - -AC_SUBST(MAKEDEPEND) -MAKEDEPEND="$(which makedepend)" - -dnl Determine what to build based on the platform. -dnl Override the LIBS settings on Cygwin32 so that -dnl we always link with the exact set of libraries. - -AC_SUBST(ALL) - -if test "$CYGWIN32" = yes; then - ALL="\$(LIBCYGARCHIVE) \$(LIBCYGSHARED) \$(LIBARCHIVE)" -else - ALL="\$(LIBFULL) \$(LIBLOAD) \$(LIBSHARED) \$(LIBARCHIVE)" -fi - -AC_OUTPUT(Makefile nxcompext.pc) diff --git a/nxcompext/install-sh b/nxcompext/install-sh deleted file mode 100755 index 58719246f..000000000 --- a/nxcompext/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/nxcompext/mkinstalldirs b/nxcompext/mkinstalldirs deleted file mode 100755 index 936cf3407..000000000 --- a/nxcompext/mkinstalldirs +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Last modified: 1995-03-05 -# Public domain - -errstatus=0 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? - fi - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus diff --git a/nxcompext/nxcompext.pc.in b/nxcompext/nxcompext.pc.in deleted file mode 100644 index 6bd0773b1..000000000 --- a/nxcompext/nxcompext.pc.in +++ /dev/null @@ -1,13 +0,0 @@ -prefix=@prefix@ -exec_prefix=@exec_prefix@ -libdir=@libdir@ -includedir=@includedir@ - -Name: nxcompext -Description: Extension for NX Compression Library -Version: @VERSION@ -Requires: nxcomp -Requires.private: x11 -Cflags: -I${includedir} -Libs: -L${libdir} -lXcompext - diff --git a/roll-tarballs.sh b/roll-tarballs.sh index 166f8738b..ccffe22ce 100755 --- a/roll-tarballs.sh +++ b/roll-tarballs.sh @@ -102,7 +102,6 @@ if [ "x$MODE" = "xfull" ]; then else rm -f "bin/nxagent" rm -Rf "nxcompshad"* - rm -Rf "nxcompext"* rm -Rf "nx-X11"* rm -Rf "etc"* rm -Rf "doc/nx-X11_vs_XOrg69_patches"* -- cgit v1.2.3 From c9ab60e89b95045c6571dc2912b6ab9fb9c11971 Mon Sep 17 00:00:00 2001 From: Orion Poplawski Date: Wed, 11 Jan 2017 15:19:24 -0700 Subject: Install missing libNX_X11.so.6 symlink - fixes gh-287 --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 9958b21dc..83fa4b43d 100644 --- a/Makefile +++ b/Makefile @@ -149,6 +149,7 @@ install-full: $(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/ $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)/nx-X11 $(INSTALL_SYMLINK) ../libNX_X11.so $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so + $(INSTALL_SYMLINK) ../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6 $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 . replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \ -- cgit v1.2.3 From 1cd73ccb79a89428eb1723b711cb08cf9bc39068 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 3 Feb 2017 14:58:06 +0100 Subject: Makefile: Don't create superfluous symlink for libX11.so -> ../libNX_X11.so. The libNX_X11.so is only required at build time, so need to use it for faking libX11.so in nxagent. Fixes ArcticaProject/nx-libs#286. --- Makefile | 1 - 1 file changed, 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 83fa4b43d..d31c7d3f5 100644 --- a/Makefile +++ b/Makefile @@ -148,7 +148,6 @@ install-full: $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/ $(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/ $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)/nx-X11 - $(INSTALL_SYMLINK) ../libNX_X11.so $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so $(INSTALL_SYMLINK) ../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6 $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 -- cgit v1.2.3 From c45cab1ba5a6ffe3832039d89c26a6d11068d417 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 4 Feb 2017 18:52:04 +0100 Subject: Makefile: Align variable names USRLIBDIR, SHLIBDIR (and NX_DIR) with nx-X11 internal naming schemes (and use /usr//nx/X11 rather than /usr//nx-X11). --- Makefile | 17 +++++++++-------- bin/nxagent.in | 6 +++--- bin/nxproxy.in | 4 ++-- debian/nxagent.install | 2 +- nx-libs.spec | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index d31c7d3f5..5bdf23b35 100644 --- a/Makefile +++ b/Makefile @@ -13,9 +13,10 @@ ETCDIR_NX ?= /etc/nxagent PREFIX ?= /usr/local BINDIR ?= $(PREFIX)/bin LIBDIR ?= $(PREFIX)/lib -USRLIBDIR ?= $(LIBDIR) +SHLIBDIR ?= $(LIBDIR) +NXLIBDIR ?= $(SHLIBDIR)/nx +USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -NXLIBDIR ?= $(LIBDIR)/nx CONFIGURE ?= ./configure NX_VERSION_MAJOR=$(shell ./version.sh 1) @@ -143,13 +144,13 @@ install-full: cp -a "$$(string_rep "$$libpath" "$$libfile" "$$link")" "$$(string_rep "$$libdir" exports .build-exports)"; \ done; + $(INSTALL_DIR) $(DESTDIR)$(SHLIBDIR) + $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so $(DESTDIR)$(SHLIBDIR)/ + $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(SHLIBDIR)/ + $(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(SHLIBDIR)/ $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) - $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so $(DESTDIR)$(USRLIBDIR)/ - $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/ - $(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/ - $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR)/nx-X11 - $(INSTALL_SYMLINK) ../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6 - $(INSTALL_SYMLINK) ../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/nx-X11/libX11.so.6.2 + $(INSTALL_SYMLINK) ../../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/libX11.so.6 + $(INSTALL_SYMLINK) ../../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/libX11.so.6.2 . replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \ while read dirname; do \ diff --git a/bin/nxagent.in b/bin/nxagent.in index 86603d549..b3e87aab1 100644 --- a/bin/nxagent.in +++ b/bin/nxagent.in @@ -15,11 +15,11 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses/. -NX_LIBS=@@NXLIBDIR@@ +NX_LIBDIR=@@NXLIBDIR@@ # make sure nxagent starts properly with pam_tmpdir.so being in use NX_TEMP=${NX_TEMP:-/tmp} export NX_TEMP -export LD_LIBRARY_PATH=@@NXLIBDIR@@-X11/ +export LD_LIBRARY_PATH=@@NX_LIBDIR@@/X11/ -exec $NX_LIBS/bin/${NXAPP:-"nxagent"} "$@" +exec $NX_LIBDIR/bin/${NXAPP:-"nxagent"} "$@" diff --git a/bin/nxproxy.in b/bin/nxproxy.in index d21388d18..0866d25ac 100644 --- a/bin/nxproxy.in +++ b/bin/nxproxy.in @@ -15,10 +15,10 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see http://www.gnu.org/licenses/. -NX_LIBS=@@NXLIBDIR@@ +NX_LIBDIR=@@NXLIBDIR@@ # make sure nxagent starts properly with pam_tmpdir.so being in use NX_TEMP=${NX_TEMP:-/tmp} export NX_TEMP -exec $NX_LIBS/bin/${NXAPP:="nxproxy"} "$@" +exec $NX_LIBDIR/bin/${NXAPP:="nxproxy"} "$@" diff --git a/debian/nxagent.install b/debian/nxagent.install index 75e72fcde..5f6a9de35 100644 --- a/debian/nxagent.install +++ b/debian/nxagent.install @@ -4,7 +4,7 @@ usr/share/nx/rgb usr/share/nx/VERSION.nxagent usr/share/man/man1/nxagent.1* usr/lib/*/nx/bin/nxagent -usr/lib/*/nx-X11/ +usr/lib/*/nx/X11/ usr/bin/nxagent usr/share/pixmaps/nxagent.xpm etc/nxagent/nxagent.keyboard diff --git a/nx-libs.spec b/nx-libs.spec index 8fb25bf07..0eae1b482 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -515,8 +515,8 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %{_bindir}/nxagent %dir %{_libdir}/nx/bin %{_libdir}/nx/bin/nxagent -%dir %{_libdir}/nx-X11 -%{_libdir}/nx-X11/libX11.so* +%dir %{_libdir}/nx/X11 +%{_libdir}/nx/X11/libX11.so* %{_datadir}/pixmaps/nxagent.xpm %dir %{_datadir}/nx %{_datadir}/nx/rgb -- cgit v1.2.3 From 4c4d3dfba927790abf5af511e8c31200de028a52 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sat, 4 Feb 2017 18:54:21 +0100 Subject: Makefile: Actively set/override USRLIBDIR and SHLIBDIR when calling Xserver's make process. SHLIBDIR -> Points to the system's official library folder. USRLIBDIR -> In NX, this variable (amongst others) is used to set the executables RPATH (if enabled), so pointing this to SHLIBDIR/nx-X11. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 5bdf23b35..14b92219f 100644 --- a/Makefile +++ b/Makefile @@ -72,7 +72,7 @@ build-full: cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} - cd nx-X11 && ${MAKE} World + cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} -- cgit v1.2.3 From 9d1da072c5f44e33d071a7f4f7c8c436cc8494fd Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 8 Feb 2017 15:03:58 +0100 Subject: Makefile: Allow longer names for variables that we want to allow distro maintainers to override. --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 14b92219f..2f6acd235 100644 --- a/Makefile +++ b/Makefile @@ -9,15 +9,15 @@ COPY_DEREFERENCED=cp -RH RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty -ETCDIR_NX ?= /etc/nxagent -PREFIX ?= /usr/local -BINDIR ?= $(PREFIX)/bin -LIBDIR ?= $(PREFIX)/lib -SHLIBDIR ?= $(LIBDIR) -NXLIBDIR ?= $(SHLIBDIR)/nx -USRLIBDIR ?= $(NXLIBDIR)/X11 -INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure +ETCDIR_NX ?= /etc/nxagent +PREFIX ?= /usr/local +BINDIR ?= $(PREFIX)/bin +LIBDIR ?= $(PREFIX)/lib +SHLIBDIR ?= $(LIBDIR) +NXLIBDIR ?= $(SHLIBDIR)/nx +USRLIBDIR ?= $(NXLIBDIR)/X11 +INCLUDEDIR ?= $(PREFIX)/include +CONFIGURE ?= ./configure NX_VERSION_MAJOR=$(shell ./version.sh 1) NX_VERSION_MINOR=$(shell ./version.sh 2) -- cgit v1.2.3 From 99c130f153b88fb9c779b0fd1f91d78cc4e75d01 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 8 Feb 2017 16:33:40 +0100 Subject: Makefile: Fix flawed uninstall-* targets. Spotted by Ionic while reviewing the nxagent RPATH changeset. Thanks! --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2f6acd235..e78f45c1b 100644 --- a/Makefile +++ b/Makefile @@ -186,14 +186,14 @@ uninstall-lite: $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/bin/ $(RM_FILE) $(DESTDIR)$(PREFIX)/share/man/man1/*.1 $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy - $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/share/nx/ + $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ uninstall-full: for f in nxagent; do \ $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent - $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/share/nx/ + $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ if test -d nx-X11; then \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ -- cgit v1.2.3 From f6a11402755a2489babb8bbf1c3b8b97b8d1ac7a Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 6 Feb 2017 15:19:47 +0100 Subject: Xserver/os/oscolor.c: Follow X.org in dropping the rgb.txt file entirely. Content of that file is now hard-coded. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adopting an exact copy of os/oscolor.c from X.org leads to this compiler warning: ``` oscolor.c:844:1: warning: string length ‘7614’ is greater than the length ‘4095’ ISO C99 compilers are required to support [-Woverlength-strings] }; ^ ``` This will be address later in coordination with X.org. Note: there is a tiny change in oscolor.c as we ship it. The original X.org file includes which seems unneeded. We drop that one line from oscolor.c. Fixes ArcticaProject/nx-libs#259. --- Makefile | 2 - etc/rgb | 754 ----------- nx-X11/config/cf/Imake.tmpl | 13 - nx-X11/config/cf/README | 4 - nx-X11/config/cf/X11.tmpl | 6 - nx-X11/config/cf/host.def | 1 - nx-X11/config/cf/xorg.cf | 4 - nx-X11/programs/Xserver/Imakefile | 5 +- nx-X11/programs/Xserver/dix/Imakefile | 8 +- nx-X11/programs/Xserver/dix/globals.c | 1 - nx-X11/programs/Xserver/include/globals.h | 1 - nx-X11/programs/Xserver/include/os.h | 1 - nx-X11/programs/Xserver/include/site.h | 12 +- nx-X11/programs/Xserver/os/Imakefile | 12 +- nx-X11/programs/Xserver/os/oscolor.c | 2037 +++++++++++++++++++++++------ nx-X11/programs/Xserver/os/osinit.c | 3 - nx-X11/programs/Xserver/os/utils.c | 8 - 17 files changed, 1617 insertions(+), 1255 deletions(-) delete mode 100644 etc/rgb (limited to 'Makefile') diff --git a/Makefile b/Makefile index e78f45c1b..4784f6d65 100644 --- a/Makefile +++ b/Makefile @@ -161,13 +161,11 @@ install-full: $(INSTALL_DIR) $(DESTDIR)/$(ETCDIR_NX) $(INSTALL_FILE) etc/keystrokes.cfg $(DESTDIR)/$(ETCDIR_NX)/ - $(INSTALL_FILE) etc/rgb $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) nx-X11/lib/X11/XErrorDB $(DESTDIR)$(PREFIX)/share/nx/ $(INSTALL_FILE) nx-X11/lib/X11/Xcms.txt $(DESTDIR)$(PREFIX)/share/nx/ - $(INSTALL_SYMLINK) $(ETCDIR_NX)/rgb $(DESTDIR)$(PREFIX)/share/nx/rgb $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy diff --git a/etc/rgb b/etc/rgb deleted file mode 100644 index b9e56c602..000000000 --- a/etc/rgb +++ /dev/null @@ -1,754 +0,0 @@ -! $Xorg: rgb.txt,v 1.3 2000/08/17 19:54:00 cpqbld Exp $ -255 250 250 snow -248 248 255 ghost white -248 248 255 GhostWhite -245 245 245 white smoke -245 245 245 WhiteSmoke -220 220 220 gainsboro -255 250 240 floral white -255 250 240 FloralWhite -253 245 230 old lace -253 245 230 OldLace -250 240 230 linen -250 235 215 antique white -250 235 215 AntiqueWhite -255 239 213 papaya whip -255 239 213 PapayaWhip -255 235 205 blanched almond -255 235 205 BlanchedAlmond -255 228 196 bisque -255 218 185 peach puff -255 218 185 PeachPuff -255 222 173 navajo white -255 222 173 NavajoWhite -255 228 181 moccasin -255 248 220 cornsilk -255 255 240 ivory -255 250 205 lemon chiffon -255 250 205 LemonChiffon -255 245 238 seashell -240 255 240 honeydew -245 255 250 mint cream -245 255 250 MintCream -240 255 255 azure -240 248 255 alice blue -240 248 255 AliceBlue -230 230 250 lavender -255 240 245 lavender blush -255 240 245 LavenderBlush -255 228 225 misty rose -255 228 225 MistyRose -255 255 255 white - 0 0 0 black - 47 79 79 dark slate gray - 47 79 79 DarkSlateGray - 47 79 79 dark slate grey - 47 79 79 DarkSlateGrey -105 105 105 dim gray -105 105 105 DimGray -105 105 105 dim grey -105 105 105 DimGrey -112 128 144 slate gray -112 128 144 SlateGray -112 128 144 slate grey -112 128 144 SlateGrey -119 136 153 light slate gray -119 136 153 LightSlateGray -119 136 153 light slate grey -119 136 153 LightSlateGrey -190 190 190 gray -190 190 190 grey -211 211 211 light grey -211 211 211 LightGrey -211 211 211 light gray -211 211 211 LightGray - 25 25 112 midnight blue - 25 25 112 MidnightBlue - 0 0 128 navy - 0 0 128 navy blue - 0 0 128 NavyBlue -100 149 237 cornflower blue -100 149 237 CornflowerBlue - 72 61 139 dark slate blue - 72 61 139 DarkSlateBlue -106 90 205 slate blue -106 90 205 SlateBlue -123 104 238 medium slate blue -123 104 238 MediumSlateBlue -132 112 255 light slate blue -132 112 255 LightSlateBlue - 0 0 205 medium blue - 0 0 205 MediumBlue - 65 105 225 royal blue - 65 105 225 RoyalBlue - 0 0 255 blue - 30 144 255 dodger blue - 30 144 255 DodgerBlue - 0 191 255 deep sky blue - 0 191 255 DeepSkyBlue -135 206 235 sky blue -135 206 235 SkyBlue -135 206 250 light sky blue -135 206 250 LightSkyBlue - 70 130 180 steel blue - 70 130 180 SteelBlue -176 196 222 light steel blue -176 196 222 LightSteelBlue -173 216 230 light blue -173 216 230 LightBlue -176 224 230 powder blue -176 224 230 PowderBlue -175 238 238 pale turquoise -175 238 238 PaleTurquoise - 0 206 209 dark turquoise - 0 206 209 DarkTurquoise - 72 209 204 medium turquoise - 72 209 204 MediumTurquoise - 64 224 208 turquoise - 0 255 255 cyan -224 255 255 light cyan -224 255 255 LightCyan - 95 158 160 cadet blue - 95 158 160 CadetBlue -102 205 170 medium aquamarine -102 205 170 MediumAquamarine -127 255 212 aquamarine - 0 100 0 dark green - 0 100 0 DarkGreen - 85 107 47 dark olive green - 85 107 47 DarkOliveGreen -143 188 143 dark sea green -143 188 143 DarkSeaGreen - 46 139 87 sea green - 46 139 87 SeaGreen - 60 179 113 medium sea green - 60 179 113 MediumSeaGreen - 32 178 170 light sea green - 32 178 170 LightSeaGreen -152 251 152 pale green -152 251 152 PaleGreen - 0 255 127 spring green - 0 255 127 SpringGreen -124 252 0 lawn green -124 252 0 LawnGreen - 0 255 0 green -127 255 0 chartreuse - 0 250 154 medium spring green - 0 250 154 MediumSpringGreen -173 255 47 green yellow -173 255 47 GreenYellow - 50 205 50 lime green - 50 205 50 LimeGreen -154 205 50 yellow green -154 205 50 YellowGreen - 34 139 34 forest green - 34 139 34 ForestGreen -107 142 35 olive drab -107 142 35 OliveDrab -189 183 107 dark khaki -189 183 107 DarkKhaki -240 230 140 khaki -238 232 170 pale goldenrod -238 232 170 PaleGoldenrod -250 250 210 light goldenrod yellow -250 250 210 LightGoldenrodYellow -255 255 224 light yellow -255 255 224 LightYellow -255 255 0 yellow -255 215 0 gold -238 221 130 light goldenrod -238 221 130 LightGoldenrod -218 165 32 goldenrod -184 134 11 dark goldenrod -184 134 11 DarkGoldenrod -188 143 143 rosy brown -188 143 143 RosyBrown -205 92 92 indian red -205 92 92 IndianRed -139 69 19 saddle brown -139 69 19 SaddleBrown -160 82 45 sienna -205 133 63 peru -222 184 135 burlywood -245 245 220 beige -245 222 179 wheat -244 164 96 sandy brown -244 164 96 SandyBrown -210 180 140 tan -210 105 30 chocolate -178 34 34 firebrick -165 42 42 brown -233 150 122 dark salmon -233 150 122 DarkSalmon -250 128 114 salmon -255 160 122 light salmon -255 160 122 LightSalmon -255 165 0 orange -255 140 0 dark orange -255 140 0 DarkOrange -255 127 80 coral -240 128 128 light coral -240 128 128 LightCoral -255 99 71 tomato -255 69 0 orange red -255 69 0 OrangeRed -255 0 0 red -255 105 180 hot pink -255 105 180 HotPink -255 20 147 deep pink -255 20 147 DeepPink -255 192 203 pink -255 182 193 light pink -255 182 193 LightPink -219 112 147 pale violet red -219 112 147 PaleVioletRed -176 48 96 maroon -199 21 133 medium violet red -199 21 133 MediumVioletRed -208 32 144 violet red -208 32 144 VioletRed -255 0 255 magenta -238 130 238 violet -221 160 221 plum -218 112 214 orchid -186 85 211 medium orchid -186 85 211 MediumOrchid -153 50 204 dark orchid -153 50 204 DarkOrchid -148 0 211 dark violet -148 0 211 DarkViolet -138 43 226 blue violet -138 43 226 BlueViolet -160 32 240 purple -147 112 219 medium purple -147 112 219 MediumPurple -216 191 216 thistle -255 250 250 snow1 -238 233 233 snow2 -205 201 201 snow3 -139 137 137 snow4 -255 245 238 seashell1 -238 229 222 seashell2 -205 197 191 seashell3 -139 134 130 seashell4 -255 239 219 AntiqueWhite1 -238 223 204 AntiqueWhite2 -205 192 176 AntiqueWhite3 -139 131 120 AntiqueWhite4 -255 228 196 bisque1 -238 213 183 bisque2 -205 183 158 bisque3 -139 125 107 bisque4 -255 218 185 PeachPuff1 -238 203 173 PeachPuff2 -205 175 149 PeachPuff3 -139 119 101 PeachPuff4 -255 222 173 NavajoWhite1 -238 207 161 NavajoWhite2 -205 179 139 NavajoWhite3 -139 121 94 NavajoWhite4 -255 250 205 LemonChiffon1 -238 233 191 LemonChiffon2 -205 201 165 LemonChiffon3 -139 137 112 LemonChiffon4 -255 248 220 cornsilk1 -238 232 205 cornsilk2 -205 200 177 cornsilk3 -139 136 120 cornsilk4 -255 255 240 ivory1 -238 238 224 ivory2 -205 205 193 ivory3 -139 139 131 ivory4 -240 255 240 honeydew1 -224 238 224 honeydew2 -193 205 193 honeydew3 -131 139 131 honeydew4 -255 240 245 LavenderBlush1 -238 224 229 LavenderBlush2 -205 193 197 LavenderBlush3 -139 131 134 LavenderBlush4 -255 228 225 MistyRose1 -238 213 210 MistyRose2 -205 183 181 MistyRose3 -139 125 123 MistyRose4 -240 255 255 azure1 -224 238 238 azure2 -193 205 205 azure3 -131 139 139 azure4 -131 111 255 SlateBlue1 -122 103 238 SlateBlue2 -105 89 205 SlateBlue3 - 71 60 139 SlateBlue4 - 72 118 255 RoyalBlue1 - 67 110 238 RoyalBlue2 - 58 95 205 RoyalBlue3 - 39 64 139 RoyalBlue4 - 0 0 255 blue1 - 0 0 238 blue2 - 0 0 205 blue3 - 0 0 139 blue4 - 30 144 255 DodgerBlue1 - 28 134 238 DodgerBlue2 - 24 116 205 DodgerBlue3 - 16 78 139 DodgerBlue4 - 99 184 255 SteelBlue1 - 92 172 238 SteelBlue2 - 79 148 205 SteelBlue3 - 54 100 139 SteelBlue4 - 0 191 255 DeepSkyBlue1 - 0 178 238 DeepSkyBlue2 - 0 154 205 DeepSkyBlue3 - 0 104 139 DeepSkyBlue4 -135 206 255 SkyBlue1 -126 192 238 SkyBlue2 -108 166 205 SkyBlue3 - 74 112 139 SkyBlue4 -176 226 255 LightSkyBlue1 -164 211 238 LightSkyBlue2 -141 182 205 LightSkyBlue3 - 96 123 139 LightSkyBlue4 -198 226 255 SlateGray1 -185 211 238 SlateGray2 -159 182 205 SlateGray3 -108 123 139 SlateGray4 -202 225 255 LightSteelBlue1 -188 210 238 LightSteelBlue2 -162 181 205 LightSteelBlue3 -110 123 139 LightSteelBlue4 -191 239 255 LightBlue1 -178 223 238 LightBlue2 -154 192 205 LightBlue3 -104 131 139 LightBlue4 -224 255 255 LightCyan1 -209 238 238 LightCyan2 -180 205 205 LightCyan3 -122 139 139 LightCyan4 -187 255 255 PaleTurquoise1 -174 238 238 PaleTurquoise2 -150 205 205 PaleTurquoise3 -102 139 139 PaleTurquoise4 -152 245 255 CadetBlue1 -142 229 238 CadetBlue2 -122 197 205 CadetBlue3 - 83 134 139 CadetBlue4 - 0 245 255 turquoise1 - 0 229 238 turquoise2 - 0 197 205 turquoise3 - 0 134 139 turquoise4 - 0 255 255 cyan1 - 0 238 238 cyan2 - 0 205 205 cyan3 - 0 139 139 cyan4 -151 255 255 DarkSlateGray1 -141 238 238 DarkSlateGray2 -121 205 205 DarkSlateGray3 - 82 139 139 DarkSlateGray4 -127 255 212 aquamarine1 -118 238 198 aquamarine2 -102 205 170 aquamarine3 - 69 139 116 aquamarine4 -193 255 193 DarkSeaGreen1 -180 238 180 DarkSeaGreen2 -155 205 155 DarkSeaGreen3 -105 139 105 DarkSeaGreen4 - 84 255 159 SeaGreen1 - 78 238 148 SeaGreen2 - 67 205 128 SeaGreen3 - 46 139 87 SeaGreen4 -154 255 154 PaleGreen1 -144 238 144 PaleGreen2 -124 205 124 PaleGreen3 - 84 139 84 PaleGreen4 - 0 255 127 SpringGreen1 - 0 238 118 SpringGreen2 - 0 205 102 SpringGreen3 - 0 139 69 SpringGreen4 - 0 255 0 green1 - 0 238 0 green2 - 0 205 0 green3 - 0 139 0 green4 -127 255 0 chartreuse1 -118 238 0 chartreuse2 -102 205 0 chartreuse3 - 69 139 0 chartreuse4 -192 255 62 OliveDrab1 -179 238 58 OliveDrab2 -154 205 50 OliveDrab3 -105 139 34 OliveDrab4 -202 255 112 DarkOliveGreen1 -188 238 104 DarkOliveGreen2 -162 205 90 DarkOliveGreen3 -110 139 61 DarkOliveGreen4 -255 246 143 khaki1 -238 230 133 khaki2 -205 198 115 khaki3 -139 134 78 khaki4 -255 236 139 LightGoldenrod1 -238 220 130 LightGoldenrod2 -205 190 112 LightGoldenrod3 -139 129 76 LightGoldenrod4 -255 255 224 LightYellow1 -238 238 209 LightYellow2 -205 205 180 LightYellow3 -139 139 122 LightYellow4 -255 255 0 yellow1 -238 238 0 yellow2 -205 205 0 yellow3 -139 139 0 yellow4 -255 215 0 gold1 -238 201 0 gold2 -205 173 0 gold3 -139 117 0 gold4 -255 193 37 goldenrod1 -238 180 34 goldenrod2 -205 155 29 goldenrod3 -139 105 20 goldenrod4 -255 185 15 DarkGoldenrod1 -238 173 14 DarkGoldenrod2 -205 149 12 DarkGoldenrod3 -139 101 8 DarkGoldenrod4 -255 193 193 RosyBrown1 -238 180 180 RosyBrown2 -205 155 155 RosyBrown3 -139 105 105 RosyBrown4 -255 106 106 IndianRed1 -238 99 99 IndianRed2 -205 85 85 IndianRed3 -139 58 58 IndianRed4 -255 130 71 sienna1 -238 121 66 sienna2 -205 104 57 sienna3 -139 71 38 sienna4 -255 211 155 burlywood1 -238 197 145 burlywood2 -205 170 125 burlywood3 -139 115 85 burlywood4 -255 231 186 wheat1 -238 216 174 wheat2 -205 186 150 wheat3 -139 126 102 wheat4 -255 165 79 tan1 -238 154 73 tan2 -205 133 63 tan3 -139 90 43 tan4 -255 127 36 chocolate1 -238 118 33 chocolate2 -205 102 29 chocolate3 -139 69 19 chocolate4 -255 48 48 firebrick1 -238 44 44 firebrick2 -205 38 38 firebrick3 -139 26 26 firebrick4 -255 64 64 brown1 -238 59 59 brown2 -205 51 51 brown3 -139 35 35 brown4 -255 140 105 salmon1 -238 130 98 salmon2 -205 112 84 salmon3 -139 76 57 salmon4 -255 160 122 LightSalmon1 -238 149 114 LightSalmon2 -205 129 98 LightSalmon3 -139 87 66 LightSalmon4 -255 165 0 orange1 -238 154 0 orange2 -205 133 0 orange3 -139 90 0 orange4 -255 127 0 DarkOrange1 -238 118 0 DarkOrange2 -205 102 0 DarkOrange3 -139 69 0 DarkOrange4 -255 114 86 coral1 -238 106 80 coral2 -205 91 69 coral3 -139 62 47 coral4 -255 99 71 tomato1 -238 92 66 tomato2 -205 79 57 tomato3 -139 54 38 tomato4 -255 69 0 OrangeRed1 -238 64 0 OrangeRed2 -205 55 0 OrangeRed3 -139 37 0 OrangeRed4 -255 0 0 red1 -238 0 0 red2 -205 0 0 red3 -139 0 0 red4 -215 7 81 DebianRed -255 20 147 DeepPink1 -238 18 137 DeepPink2 -205 16 118 DeepPink3 -139 10 80 DeepPink4 -255 110 180 HotPink1 -238 106 167 HotPink2 -205 96 144 HotPink3 -139 58 98 HotPink4 -255 181 197 pink1 -238 169 184 pink2 -205 145 158 pink3 -139 99 108 pink4 -255 174 185 LightPink1 -238 162 173 LightPink2 -205 140 149 LightPink3 -139 95 101 LightPink4 -255 130 171 PaleVioletRed1 -238 121 159 PaleVioletRed2 -205 104 137 PaleVioletRed3 -139 71 93 PaleVioletRed4 -255 52 179 maroon1 -238 48 167 maroon2 -205 41 144 maroon3 -139 28 98 maroon4 -255 62 150 VioletRed1 -238 58 140 VioletRed2 -205 50 120 VioletRed3 -139 34 82 VioletRed4 -255 0 255 magenta1 -238 0 238 magenta2 -205 0 205 magenta3 -139 0 139 magenta4 -255 131 250 orchid1 -238 122 233 orchid2 -205 105 201 orchid3 -139 71 137 orchid4 -255 187 255 plum1 -238 174 238 plum2 -205 150 205 plum3 -139 102 139 plum4 -224 102 255 MediumOrchid1 -209 95 238 MediumOrchid2 -180 82 205 MediumOrchid3 -122 55 139 MediumOrchid4 -191 62 255 DarkOrchid1 -178 58 238 DarkOrchid2 -154 50 205 DarkOrchid3 -104 34 139 DarkOrchid4 -155 48 255 purple1 -145 44 238 purple2 -125 38 205 purple3 - 85 26 139 purple4 -171 130 255 MediumPurple1 -159 121 238 MediumPurple2 -137 104 205 MediumPurple3 - 93 71 139 MediumPurple4 -255 225 255 thistle1 -238 210 238 thistle2 -205 181 205 thistle3 -139 123 139 thistle4 - 0 0 0 gray0 - 0 0 0 grey0 - 3 3 3 gray1 - 3 3 3 grey1 - 5 5 5 gray2 - 5 5 5 grey2 - 8 8 8 gray3 - 8 8 8 grey3 - 10 10 10 gray4 - 10 10 10 grey4 - 13 13 13 gray5 - 13 13 13 grey5 - 15 15 15 gray6 - 15 15 15 grey6 - 18 18 18 gray7 - 18 18 18 grey7 - 20 20 20 gray8 - 20 20 20 grey8 - 23 23 23 gray9 - 23 23 23 grey9 - 26 26 26 gray10 - 26 26 26 grey10 - 28 28 28 gray11 - 28 28 28 grey11 - 31 31 31 gray12 - 31 31 31 grey12 - 33 33 33 gray13 - 33 33 33 grey13 - 36 36 36 gray14 - 36 36 36 grey14 - 38 38 38 gray15 - 38 38 38 grey15 - 41 41 41 gray16 - 41 41 41 grey16 - 43 43 43 gray17 - 43 43 43 grey17 - 46 46 46 gray18 - 46 46 46 grey18 - 48 48 48 gray19 - 48 48 48 grey19 - 51 51 51 gray20 - 51 51 51 grey20 - 54 54 54 gray21 - 54 54 54 grey21 - 56 56 56 gray22 - 56 56 56 grey22 - 59 59 59 gray23 - 59 59 59 grey23 - 61 61 61 gray24 - 61 61 61 grey24 - 64 64 64 gray25 - 64 64 64 grey25 - 66 66 66 gray26 - 66 66 66 grey26 - 69 69 69 gray27 - 69 69 69 grey27 - 71 71 71 gray28 - 71 71 71 grey28 - 74 74 74 gray29 - 74 74 74 grey29 - 77 77 77 gray30 - 77 77 77 grey30 - 79 79 79 gray31 - 79 79 79 grey31 - 82 82 82 gray32 - 82 82 82 grey32 - 84 84 84 gray33 - 84 84 84 grey33 - 87 87 87 gray34 - 87 87 87 grey34 - 89 89 89 gray35 - 89 89 89 grey35 - 92 92 92 gray36 - 92 92 92 grey36 - 94 94 94 gray37 - 94 94 94 grey37 - 97 97 97 gray38 - 97 97 97 grey38 - 99 99 99 gray39 - 99 99 99 grey39 -102 102 102 gray40 -102 102 102 grey40 -105 105 105 gray41 -105 105 105 grey41 -107 107 107 gray42 -107 107 107 grey42 -110 110 110 gray43 -110 110 110 grey43 -112 112 112 gray44 -112 112 112 grey44 -115 115 115 gray45 -115 115 115 grey45 -117 117 117 gray46 -117 117 117 grey46 -120 120 120 gray47 -120 120 120 grey47 -122 122 122 gray48 -122 122 122 grey48 -125 125 125 gray49 -125 125 125 grey49 -127 127 127 gray50 -127 127 127 grey50 -130 130 130 gray51 -130 130 130 grey51 -133 133 133 gray52 -133 133 133 grey52 -135 135 135 gray53 -135 135 135 grey53 -138 138 138 gray54 -138 138 138 grey54 -140 140 140 gray55 -140 140 140 grey55 -143 143 143 gray56 -143 143 143 grey56 -145 145 145 gray57 -145 145 145 grey57 -148 148 148 gray58 -148 148 148 grey58 -150 150 150 gray59 -150 150 150 grey59 -153 153 153 gray60 -153 153 153 grey60 -156 156 156 gray61 -156 156 156 grey61 -158 158 158 gray62 -158 158 158 grey62 -161 161 161 gray63 -161 161 161 grey63 -163 163 163 gray64 -163 163 163 grey64 -166 166 166 gray65 -166 166 166 grey65 -168 168 168 gray66 -168 168 168 grey66 -171 171 171 gray67 -171 171 171 grey67 -173 173 173 gray68 -173 173 173 grey68 -176 176 176 gray69 -176 176 176 grey69 -179 179 179 gray70 -179 179 179 grey70 -181 181 181 gray71 -181 181 181 grey71 -184 184 184 gray72 -184 184 184 grey72 -186 186 186 gray73 -186 186 186 grey73 -189 189 189 gray74 -189 189 189 grey74 -191 191 191 gray75 -191 191 191 grey75 -194 194 194 gray76 -194 194 194 grey76 -196 196 196 gray77 -196 196 196 grey77 -199 199 199 gray78 -199 199 199 grey78 -201 201 201 gray79 -201 201 201 grey79 -204 204 204 gray80 -204 204 204 grey80 -207 207 207 gray81 -207 207 207 grey81 -209 209 209 gray82 -209 209 209 grey82 -212 212 212 gray83 -212 212 212 grey83 -214 214 214 gray84 -214 214 214 grey84 -217 217 217 gray85 -217 217 217 grey85 -219 219 219 gray86 -219 219 219 grey86 -222 222 222 gray87 -222 222 222 grey87 -224 224 224 gray88 -224 224 224 grey88 -227 227 227 gray89 -227 227 227 grey89 -229 229 229 gray90 -229 229 229 grey90 -232 232 232 gray91 -232 232 232 grey91 -235 235 235 gray92 -235 235 235 grey92 -237 237 237 gray93 -237 237 237 grey93 -240 240 240 gray94 -240 240 240 grey94 -242 242 242 gray95 -242 242 242 grey95 -245 245 245 gray96 -245 245 245 grey96 -247 247 247 gray97 -247 247 247 grey97 -250 250 250 gray98 -250 250 250 grey98 -252 252 252 gray99 -252 252 252 grey99 -255 255 255 gray100 -255 255 255 grey100 -169 169 169 dark grey -169 169 169 DarkGrey -169 169 169 dark gray -169 169 169 DarkGray -0 0 139 dark blue -0 0 139 DarkBlue -0 139 139 dark cyan -0 139 139 DarkCyan -139 0 139 dark magenta -139 0 139 DarkMagenta -139 0 0 dark red -139 0 0 DarkRed -144 238 144 light green -144 238 144 LightGreen diff --git a/nx-X11/config/cf/Imake.tmpl b/nx-X11/config/cf/Imake.tmpl index ba97b3b4c..879b55a3b 100644 --- a/nx-X11/config/cf/Imake.tmpl +++ b/nx-X11/config/cf/Imake.tmpl @@ -539,9 +539,6 @@ X_BYTE_ORDER = ByteOrder #ifndef HasMktemp #define HasMktemp NO /* if you have the mktemp command */ #endif -#ifndef HasNdbm -#define HasNdbm NO -#endif #ifndef HasSecureRPC #define HasSecureRPC NO /* if you have Secure RPC */ #endif @@ -1286,13 +1283,6 @@ TCLIBDIR = TclLibDir #ifndef ToolkitStringsABIOptions #define ToolkitStringsABIOptions /**/ #endif -#ifndef NdbmDefines -#if HasNdbm -#define NdbmDefines -DNDBM -#else -#define NdbmDefines /**/ -#endif -#endif #ifndef HasLdRunPath #define HasLdRunPath NO #endif @@ -1317,9 +1307,6 @@ TCLIBDIR = TclLibDir #ifndef MathLibrary #define MathLibrary -lm #endif -#ifndef DBMLibrary -#define DBMLibrary -ldbm -#endif #ifndef DlLibrary #define DlLibrary -ldl #endif diff --git a/nx-X11/config/cf/README b/nx-X11/config/cf/README index 9cb2ff91e..863c66a82 100644 --- a/nx-X11/config/cf/README +++ b/nx-X11/config/cf/README @@ -65,7 +65,6 @@ Imake.tmpl provides defaults for the following variables: HasLibCrypt boolean for system has libcrypt HasMotif boolean for system has Motif HasMotif2 boolean for system has Motif2 or OpenMotif - HasNdbm boolean for system has ndbm routines HasPoll use poll() syscall? HasPurify boolean for system has Purify HasPutenv boolean for libc has putenv() @@ -114,7 +113,6 @@ Imake.tmpl provides defaults for the following variables: MkCookieCmd command to generate an xauth cookie MsMacros macro flag for TroffCmd, normally "-ms" MvCmd command to rename a file - NdbmDefines -D's to turn on use of ndbm routines NeedConstPrototoypes whether const is supported NeedFunctionPrototypes whether or not to force function prototypes NeedNestedPrototypes whether nested prototypes are supported @@ -176,7 +174,6 @@ X11.tmpl provides defaults for the following variables: DebugLibX11 build libX11_d.a DefaultCursorTheme name of default cursor theme DefaultFontPath default server font path - DefaultRGBDatabase default server rgb color database DefaultSystemPath default system xdm PATH environment variable DefaultSystemShell default /bin/sh DefaultUserPath default user xdm PATH environment variable @@ -220,7 +217,6 @@ X11.tmpl provides defaults for the following variables: ShmDefines MIT-SHM define TwmDir directory in which to install twm config files UseCCMakeDepend boolean for using alternate makedepend script - UseRgbTxt use rgb.txt file as is instead of DBM-compiled VarDirectory directory in /var for logs, etc., and config VendorHasX11R6_3libXext don't need Security & AppGroup in xrx plug-in XAppLoadDir directory in which to install app defaults diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index fe94e1f4d..54f94355d 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -312,12 +312,6 @@ XORGRELSTRING = XorgManVersionString #ifndef DefaultFSFontPath # define DefaultFSFontPath DefaultFontPath #endif -#ifndef DefaultRGBDatabase -#define DefaultRGBDatabase $(USRDATADIR)/rgb -#endif -#ifndef UseRgbTxt -#define UseRgbTxt NO /* default is to compile with dbm */ -#endif #ifndef UseMemLeak #define UseMemLeak NO #endif diff --git a/nx-X11/config/cf/host.def b/nx-X11/config/cf/host.def index e9dba5958..ffcf4c0de 100644 --- a/nx-X11/config/cf/host.def +++ b/nx-X11/config/cf/host.def @@ -165,7 +165,6 @@ #if defined(cygwinArchitecture) #define DefaultFontPath /mnt/NX/fonts/base/,/mnt/NX/fonts/misc/,/mnt/NX/fonts/Speedo/,/mnt/NX/fonts/Type1/,/mnt/NX/fonts/75dpi/,/mnt/NX/fonts/100dpi/,/mnt/NX/fonts/TTF/ -#define DefaultRGBDatabase /mnt/NX/fonts/rgb #endif /* #if defined(cygwinArchitecture) */ /* diff --git a/nx-X11/config/cf/xorg.cf b/nx-X11/config/cf/xorg.cf index 513f78a43..ddc501978 100644 --- a/nx-X11/config/cf/xorg.cf +++ b/nx-X11/config/cf/xorg.cf @@ -660,10 +660,6 @@ XFREE86JAPANESEDOCDIR = $(DOCDIR)/Japanese # define OtherIConfigFiles $(IRULESRC)/xf86.rules #endif -#ifndef UseRgbTxt -# define UseRgbTxt YES -#endif - #ifndef ManSuffix # define ManSuffix 1 #endif diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index fe70d007a..a18f04108 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -160,10 +160,7 @@ INSTPGMFLAGS = #if HasPam && HasPamMisc PAMLIBS = PamLibraries PamMiscLibraries #endif -#if !(SystemV4 || UseRgbTxt) - DBMLIBS = DBMLibrary -#endif - SYSLIBS = $(ZLIB) MathLibrary $(DBMLIBS) $(USB) \ + SYSLIBS = $(ZLIB) MathLibrary $(USB) \ $(PAMLIBS) $(EXTRASYSLIBS) #if !HasCbrt CBRT = mi/LibraryTargetName(cbrt) diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile index 7acd1b45c..1024de965 100644 --- a/nx-X11/programs/Xserver/dix/Imakefile +++ b/nx-X11/programs/Xserver/dix/Imakefile @@ -91,7 +91,6 @@ OBJS = \ * .macros files or site.def in the directory util/imake.includes/: * * DefaultFontPath COMPILEDDEFAULTFONTPATH - * DefaultRGBDatabase RGB_DB * * The sample util/imake.includes/Imake.tmpl will provide generic defaults. * The values in site.h are simply a last line of defense and should not be @@ -103,11 +102,6 @@ DEFAULTFONTPATH = DefaultFontPath SITE_FONT_PATH = -DCOMPILEDDEFAULTFONTPATH=\"$(DEFAULTFONTPATH)\" #endif -#ifdef DefaultRGBDatabase -DEFAULTRGBDATABASE = DefaultRGBDatabase - SITE_RGB_DB = -DRGB_DB=\"$(DEFAULTRGBDATABASE)\" -#endif - #ifdef DefaultDisplayClass DEFAULTDISPLAYCLASS = DefaultDisplayClass SITE_DISPLAY_CLASS = -DCOMPILEDDISPLAYCLASS=\"$(DEFAULTDISPLAYCLASS)\" @@ -129,7 +123,7 @@ VENDORRELEASE = XVendorRelease #endif #endif -SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_RGB_DB) $(SITE_DISPLAY_CLASS) +SITE_DEFINES = $(SITE_FONT_PATH) $(SITE_DISPLAY_CLASS) VENDOR_DEFINES = $(VENDOR_STRING) $(VENDOR_RELEASE) $(QUARTZ_DEFINES) diff --git a/nx-X11/programs/Xserver/dix/globals.c b/nx-X11/programs/Xserver/dix/globals.c index 5a2819e50..a0af50fa8 100644 --- a/nx-X11/programs/Xserver/dix/globals.c +++ b/nx-X11/programs/Xserver/dix/globals.c @@ -130,7 +130,6 @@ int logoScreenSaver = DEFAULT_LOGO_SCREEN_SAVER; char *defaultFontPath = COMPILEDDEFAULTFONTPATH; char *defaultTextFont = COMPILEDDEFAULTFONT; char *defaultCursorFont = COMPILEDCURSORFONT; -char *rgbPath = RGB_DB; char *defaultDisplayClass = COMPILEDDISPLAYCLASS; FontPtr defaultFont; /* not declared in dix.h to avoid including font.h in every compilation of dix code */ diff --git a/nx-X11/programs/Xserver/include/globals.h b/nx-X11/programs/Xserver/include/globals.h index 6bc31d8e7..1c4d73e64 100644 --- a/nx-X11/programs/Xserver/include/globals.h +++ b/nx-X11/programs/Xserver/include/globals.h @@ -12,7 +12,6 @@ extern CARD32 ScreenSaverTime; extern CARD32 ScreenSaverInterval; extern char *defaultFontPath; -extern char *rgbPath; extern int monitorResolution; extern Bool loadableFonts; extern int defaultColorVisualClass; diff --git a/nx-X11/programs/Xserver/include/os.h b/nx-X11/programs/Xserver/include/os.h index 881abfccb..a53f0d4c8 100644 --- a/nx-X11/programs/Xserver/include/os.h +++ b/nx-X11/programs/Xserver/include/os.h @@ -94,7 +94,6 @@ typedef struct _NewClientRec *NewClientPtr; #define SIGVAL void #endif -extern Bool OsDelayInitColors; extern void (*OsVendorVErrorFProc)(const char *, va_list args); extern int WaitForSomething( diff --git a/nx-X11/programs/Xserver/include/site.h b/nx-X11/programs/Xserver/include/site.h index 5b9f25815..c8dfe69a6 100644 --- a/nx-X11/programs/Xserver/include/site.h +++ b/nx-X11/programs/Xserver/include/site.h @@ -65,19 +65,15 @@ SOFTWARE. #endif /* - * The following constants are provided solely as a last line of defense. The - * normal build ALWAYS overrides them using a special rule given in - * server/dix/Imakefile. If you want to change either of these constants, - * you should set the DefaultFontPath or DefaultRGBDatabase configuration - * parameters. + * The following constant is provided solely as a last line of defense. The + * normal build ALWAYS overrides it using a special rule given in + * server/dix/Imakefile. If you want to change this constant, you should set + * the DefaultFontPath configuration parameter. * DO NOT CHANGE THESE VALUES OR THE DIX IMAKEFILE! */ #ifndef COMPILEDDEFAULTFONTPATH #define COMPILEDDEFAULTFONTPATH "/usr/lib/X11/fonts/misc/" #endif -#ifndef RGB_DB -#define RGB_DB "/usr/lib/X11/rgb" -#endif /* * The following constants contain default values for all of the variables diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index d381ac272..26d9c6dff 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -125,10 +125,6 @@ BOOTSTRAPCFLAGS = #if UseMemLeak MEM_DEFINES = -DMEMBUG #endif -#if UseRgbTxt - RGB_DEFINES = -DUSE_RGB_TXT -#endif - DBM_DEFINES = NdbmDefines ADM_DEFINES = -DADMPATH=\"$(ADMDIR)/X\%smsgs\" XDMCP_DEFINES = ServerXdmcpDefines ERROR_DEFINES = ServerErrorDefines @@ -139,14 +135,14 @@ BOOTSTRAPCFLAGS = DEFINES = $(CONNECTION_FLAGS) $(MEM_DEFINES) \ $(XDMAUTHDEFS) $(RPCDEFS) $(SIGNAL_DEFINES) $(OS_DEFINES) \ - $(RGB_DEFINES) $(GETPEER_DEFINES) \ + $(GETPEER_DEFINES) \ $(RANDOM_DEFINES) $(BUGMSG) $(XTRANS_FAILDEFINES) \ $(XTRANS_DEFINES) $(NX_DEFINES) INCLUDES = -I. -I../include -I$(XINCLUDESRC) -I$(EXTINCSRC) \ -I$(SERVERSRC)/Xext -I$(SERVERSRC)/render \ -I$(TOP)/lib/Xau $(NX_INCLUDES) \ `pkg-config --cflags-only-I pixman-1` - DEPEND_DEFINES = $(DBM_DEFINES) $(XDMCP_DEFINES) $(EXT_DEFINES) \ + DEPEND_DEFINES = $(XDMCP_DEFINES) $(EXT_DEFINES) \ $(TRANS_INCLUDES) $(CONNECTION_FLAGS) $(GETPEER_DEFINES) \ DependDefines LINTLIBS = ../dix/llib-ldix.ln @@ -182,9 +178,7 @@ SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR #if defined(SparcArchitecture) && HasGcc && !HasGcc2 oscolor.o: oscolor.c $(ICONFIGFILES) $(RM) $@ - cc -c $(DBM_DEFINES) $(CDEBUGFLAGS) $(ALLDEFINES) $*.c -#else -SpecialCObjectRule(oscolor,$(ICONFIGFILES),$(DBM_DEFINES)) + cc -c $(CDEBUGFLAGS) $(ALLDEFINES) $*.c #endif #if !HasSnprintf diff --git a/nx-X11/programs/Xserver/os/oscolor.c b/nx-X11/programs/Xserver/os/oscolor.c index 88b243d65..70940653f 100644 --- a/nx-X11/programs/Xserver/os/oscolor.c +++ b/nx-X11/programs/Xserver/os/oscolor.c @@ -22,18 +22,17 @@ Except as contained in this notice, the name of The Open Group shall not be used in advertising or otherwise to promote the sale, use or other dealings in this Software without prior written authorization from The Open Group. - Copyright 1987 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 @@ -45,438 +44,1618 @@ SOFTWARE. ******************************************************************/ -#ifdef NX_TRANS_SOCKET - -#include -#include -#include - -/* FIXME: we need more intelligent code (like provided by the nxagentX2go - * var in hw/nxagent/Init.h) to detect our current runtime mode (running - * as x2goagent, running as nxagent) - */ -static char* nxAltRgbPaths[] = {"/etc/x2go/rgb", \ - "/usr/share/x2go/rgb", \ - "/usr/local/share/x2go/rgb", \ - "/etc/nxagent/rgb", \ - "/usr/share/nx/rgb", \ - "/usr/local/share/nx/rgb", \ - "/usr/NX/share/rgb", \ - "/usr/share/X11/rgb", \ - "/etc/X11/rgb"}; -static char _NXRgbPath[1024]; - -#endif - #ifdef HAVE_DIX_CONFIG_H #include #endif -#ifndef USE_RGB_TXT - -#ifdef NDBM -#include -#else -#ifdef SVR4 -#include -#else -#include -#endif -#endif -#include "rgb.h" #include "os.h" -#include "opaque.h" - -/* Note that we are assuming there is only one database for all the screens. */ - -#ifdef NDBM -DBM *rgb_dbm = (DBM *)NULL; -#else -int rgb_dbm = 0; -#endif - -extern void CopyISOLatin1Lowered( - char * /*dest*/, - const char * /*source*/, - int /*length*/); - -int -OsInitColors(void) -{ - if (!rgb_dbm) - { -#ifdef NDBM - rgb_dbm = dbm_open(rgbPath, 0, 0); -#else - if (dbminit(rgbPath) == 0) - rgb_dbm = 1; -#endif - if (!rgb_dbm) { - ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath ); - return FALSE; - } - } - return TRUE; -} - -/*ARGSUSED*/ -int -OsLookupColor(int screen, char *name, unsigned int len, - unsigned short *pred, unsigned short *pgreen, unsigned short *pblue) -{ - datum dbent; - RGB rgb; - char buf[64]; - char *lowername; - - if(!rgb_dbm) - return(0); - - /* we use malloc here so that we can compile with cc without alloca - * when otherwise using gcc */ - if (len < sizeof(buf)) - lowername = buf; - else if (!(lowername = (char *)malloc(len + 1))) - return(0); - CopyISOLatin1Lowered ((unsigned char *) lowername, (unsigned char *) name, - (int)len); - - dbent.dptr = lowername; - dbent.dsize = len; -#ifdef NDBM - dbent = dbm_fetch(rgb_dbm, dbent); -#else - dbent = fetch (dbent); -#endif - - if (len >= sizeof(buf)) - free(lowername); - - if(dbent.dptr) - { - memmove((char *) &rgb, dbent.dptr, sizeof (RGB)); - *pred = rgb.red; - *pgreen = rgb.green; - *pblue = rgb.blue; - return (1); - } - return(0); -} - -#else /* USE_RGB_TXT */ - - -/* - * The dbm routines are a porting hassle. This implementation will do - * the same thing by reading the rgb.txt file directly, which is much - * more portable. - */ - -#include -#include "os.h" -#include "opaque.h" - -#define HASHSIZE 511 - -typedef struct _dbEntry * dbEntryPtr; -typedef struct _dbEntry { - dbEntryPtr link; - unsigned short red; - unsigned short green; - unsigned short blue; - char name[1]; /* some compilers complain if [0] */ -} dbEntry; - - -extern void CopyISOLatin1Lowered( - char * /*dest*/, - const char * /*source*/, - int /*length*/); - -static dbEntryPtr hashTab[HASHSIZE]; - -#ifdef NX_TRANS_SOCKET - -static int NXVerifyRgbPath(char *path) -{ - int size; - char *rgbPath; - struct stat rgbFileStat; - - /* - * Check if rgb file is present. - */ - - size = strlen(path) + strlen(".txt") + 1; - - rgbPath = (char *) ALLOCATE_LOCAL(size + 1); - - strcpy(rgbPath, path); - - #ifdef NX_TRANS_TEST - fprintf(stderr, "NXVerifyRgbPath: Looking for [%s] file.\n", - rgbPath); - #endif - - if (stat(rgbPath, &rgbFileStat) != 0) - { - - #ifdef NX_TRANS_TEST - fprintf(stderr, "NXVerifyRgbPath: Can't find the rgb file [%s].\n", - rgbPath); - #endif - - strcat(rgbPath, ".txt"); - - #ifdef NX_TRANS_TEST - fprintf(stderr, "NXVerifyRgbPath: Looking for [%s] file.\n", - rgbPath); - #endif - - if (stat(rgbPath, &rgbFileStat) != 0) - { - - #ifdef NX_TRANS_TEST - fprintf(stderr, "NXVerifyRgbPath: Can't find the rgb file [%s].\n", - rgbPath); - #endif - - DEALLOCATE_LOCAL(rgbPath); - - return 0; - } - } - - #ifdef NX_TRANS_TEST - fprintf(stderr, "NXVerifyRgbPath: rgb path [%s] is valid.\n", - path); - #endif - - DEALLOCATE_LOCAL(rgbPath); - - return 1; -} - -static const char *_NXGetRgbPath(const char *path) -{ - const char *systemEnv; - char rgbPath[1024]; - int numAltRgbPaths; - int i; - - /* - * Check the environment only once. - */ - - if (*_NXRgbPath != '\0') - { - return _NXRgbPath; - } - - systemEnv = getenv("NX_SYSTEM"); - - if (systemEnv != NULL && *systemEnv != '\0') - { - if (strlen(systemEnv) + strlen("/share/rgb") + 1 > 1024) - { - - #ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetRgbPath: WARNING! Maximum length of rgb file path exceeded.\n"); - #endif - - goto _NXGetRgbPathError; - } - - strcpy(rgbPath, systemEnv); - strcat(rgbPath, "/share/rgb"); - - if (NXVerifyRgbPath(rgbPath) == 1) - { - strcpy(_NXRgbPath, systemEnv); - strcat(_NXRgbPath, "/share/rgb"); - - #ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetRgbPath: Using rgb file path [%s].\n", - _NXRgbPath); - #endif - - return _NXRgbPath; - } - } - - numAltRgbPaths = sizeof(nxAltRgbPaths) / sizeof(*nxAltRgbPaths); - - for (i = 0; i < numAltRgbPaths; i++) - { - if (NXVerifyRgbPath(nxAltRgbPaths[i]) == 1) - { - if (strlen(nxAltRgbPaths[i]) + 1 > 1024) - { - #ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetRgbPath: WARNING! Maximum length of rgb file path exceeded.\n"); - #endif - - goto _NXGetRgbPathError; - } - - strcpy(_NXRgbPath, nxAltRgbPaths[i]); - - #ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetRgbPath: Using rgb file path [%s].\n", - _NXRgbPath); - #endif - - return _NXRgbPath; - } - } - -_NXGetRgbPathError: - - strcpy(_NXRgbPath, path); - - #ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetRgbPath: Using default rgb file path [%s].\n", - _NXRgbPath); - #endif - - return _NXRgbPath; -} - -#endif - -static dbEntryPtr -lookup(char *name, int len, Bool create) -{ - unsigned int h = 0, g; - dbEntryPtr entry, *prev = NULL; - char *str = name; - - if (!(name = (char*)ALLOCATE_LOCAL(len +1))) return NULL; - CopyISOLatin1Lowered(name, str, len); - name[len] = '\0'; - - for(str = name; *str; str++) { - h = (h << 4) + *str; - if ((g = h) & 0xf0000000) h ^= (g >> 24); - h &= g; - } - h %= HASHSIZE; - - if ( (entry = hashTab[h]) ) - { - for( ; entry; prev = (dbEntryPtr*)entry, entry = entry->link ) - if (! strcmp(name, entry->name) ) break; - } - else - prev = &(hashTab[h]); - - if (!entry && create && (entry = (dbEntryPtr)malloc(sizeof(dbEntry) +len))) - { - *prev = entry; - entry->link = NULL; - strcpy( entry->name, name ); - } - - DEALLOCATE_LOCAL(name); - - return entry; -} +typedef struct _builtinColor { + unsigned char red; + unsigned char green; + unsigned char blue; + unsigned short name; +} BuiltinColor; + +static const char BuiltinColorNames[] = { + "alice blue\0" + "AliceBlue\0" + "antique white\0" + "AntiqueWhite\0" + "AntiqueWhite1\0" + "AntiqueWhite2\0" + "AntiqueWhite3\0" + "AntiqueWhite4\0" + "aqua\0" + "aquamarine\0" + "aquamarine1\0" + "aquamarine2\0" + "aquamarine3\0" + "aquamarine4\0" + "azure\0" + "azure1\0" + "azure2\0" + "azure3\0" + "azure4\0" + "beige\0" + "bisque\0" + "bisque1\0" + "bisque2\0" + "bisque3\0" + "bisque4\0" + "black\0" + "blanched almond\0" + "BlanchedAlmond\0" + "blue\0" + "blue violet\0" + "blue1\0" + "blue2\0" + "blue3\0" + "blue4\0" + "BlueViolet\0" + "brown\0" + "brown1\0" + "brown2\0" + "brown3\0" + "brown4\0" + "burlywood\0" + "burlywood1\0" + "burlywood2\0" + "burlywood3\0" + "burlywood4\0" + "cadet blue\0" + "CadetBlue\0" + "CadetBlue1\0" + "CadetBlue2\0" + "CadetBlue3\0" + "CadetBlue4\0" + "chartreuse\0" + "chartreuse1\0" + "chartreuse2\0" + "chartreuse3\0" + "chartreuse4\0" + "chocolate\0" + "chocolate1\0" + "chocolate2\0" + "chocolate3\0" + "chocolate4\0" + "coral\0" + "coral1\0" + "coral2\0" + "coral3\0" + "coral4\0" + "cornflower blue\0" + "CornflowerBlue\0" + "cornsilk\0" + "cornsilk1\0" + "cornsilk2\0" + "cornsilk3\0" + "cornsilk4\0" + "crimson\0" + "cyan\0" + "cyan1\0" + "cyan2\0" + "cyan3\0" + "cyan4\0" + "dark blue\0" + "dark cyan\0" + "dark goldenrod\0" + "dark gray\0" + "dark green\0" + "dark grey\0" + "dark khaki\0" + "dark magenta\0" + "dark olive green\0" + "dark orange\0" + "dark orchid\0" + "dark red\0" + "dark salmon\0" + "dark sea green\0" + "dark slate blue\0" + "dark slate gray\0" + "dark slate grey\0" + "dark turquoise\0" + "dark violet\0" + "DarkBlue\0" + "DarkCyan\0" + "DarkGoldenrod\0" + "DarkGoldenrod1\0" + "DarkGoldenrod2\0" + "DarkGoldenrod3\0" + "DarkGoldenrod4\0" + "DarkGray\0" + "DarkGreen\0" + "DarkGrey\0" + "DarkKhaki\0" + "DarkMagenta\0" + "DarkOliveGreen\0" + "DarkOliveGreen1\0" + "DarkOliveGreen2\0" + "DarkOliveGreen3\0" + "DarkOliveGreen4\0" + "DarkOrange\0" + "DarkOrange1\0" + "DarkOrange2\0" + "DarkOrange3\0" + "DarkOrange4\0" + "DarkOrchid\0" + "DarkOrchid1\0" + "DarkOrchid2\0" + "DarkOrchid3\0" + "DarkOrchid4\0" + "DarkRed\0" + "DarkSalmon\0" + "DarkSeaGreen\0" + "DarkSeaGreen1\0" + "DarkSeaGreen2\0" + "DarkSeaGreen3\0" + "DarkSeaGreen4\0" + "DarkSlateBlue\0" + "DarkSlateGray\0" + "DarkSlateGray1\0" + "DarkSlateGray2\0" + "DarkSlateGray3\0" + "DarkSlateGray4\0" + "DarkSlateGrey\0" + "DarkTurquoise\0" + "DarkViolet\0" + "deep pink\0" + "deep sky blue\0" + "DeepPink\0" + "DeepPink1\0" + "DeepPink2\0" + "DeepPink3\0" + "DeepPink4\0" + "DeepSkyBlue\0" + "DeepSkyBlue1\0" + "DeepSkyBlue2\0" + "DeepSkyBlue3\0" + "DeepSkyBlue4\0" + "dim gray\0" + "dim grey\0" + "DimGray\0" + "DimGrey\0" + "dodger blue\0" + "DodgerBlue\0" + "DodgerBlue1\0" + "DodgerBlue2\0" + "DodgerBlue3\0" + "DodgerBlue4\0" + "firebrick\0" + "firebrick1\0" + "firebrick2\0" + "firebrick3\0" + "firebrick4\0" + "floral white\0" + "FloralWhite\0" + "forest green\0" + "ForestGreen\0" + "fuchsia\0" + "gainsboro\0" + "ghost white\0" + "GhostWhite\0" + "gold\0" + "gold1\0" + "gold2\0" + "gold3\0" + "gold4\0" + "goldenrod\0" + "goldenrod1\0" + "goldenrod2\0" + "goldenrod3\0" + "goldenrod4\0" + "gray\0" + "gray0\0" + "gray1\0" + "gray10\0" + "gray100\0" + "gray11\0" + "gray12\0" + "gray13\0" + "gray14\0" + "gray15\0" + "gray16\0" + "gray17\0" + "gray18\0" + "gray19\0" + "gray2\0" + "gray20\0" + "gray21\0" + "gray22\0" + "gray23\0" + "gray24\0" + "gray25\0" + "gray26\0" + "gray27\0" + "gray28\0" + "gray29\0" + "gray3\0" + "gray30\0" + "gray31\0" + "gray32\0" + "gray33\0" + "gray34\0" + "gray35\0" + "gray36\0" + "gray37\0" + "gray38\0" + "gray39\0" + "gray4\0" + "gray40\0" + "gray41\0" + "gray42\0" + "gray43\0" + "gray44\0" + "gray45\0" + "gray46\0" + "gray47\0" + "gray48\0" + "gray49\0" + "gray5\0" + "gray50\0" + "gray51\0" + "gray52\0" + "gray53\0" + "gray54\0" + "gray55\0" + "gray56\0" + "gray57\0" + "gray58\0" + "gray59\0" + "gray6\0" + "gray60\0" + "gray61\0" + "gray62\0" + "gray63\0" + "gray64\0" + "gray65\0" + "gray66\0" + "gray67\0" + "gray68\0" + "gray69\0" + "gray7\0" + "gray70\0" + "gray71\0" + "gray72\0" + "gray73\0" + "gray74\0" + "gray75\0" + "gray76\0" + "gray77\0" + "gray78\0" + "gray79\0" + "gray8\0" + "gray80\0" + "gray81\0" + "gray82\0" + "gray83\0" + "gray84\0" + "gray85\0" + "gray86\0" + "gray87\0" + "gray88\0" + "gray89\0" + "gray9\0" + "gray90\0" + "gray91\0" + "gray92\0" + "gray93\0" + "gray94\0" + "gray95\0" + "gray96\0" + "gray97\0" + "gray98\0" + "gray99\0" + "green\0" + "green yellow\0" + "green1\0" + "green2\0" + "green3\0" + "green4\0" + "GreenYellow\0" + "grey\0" + "grey0\0" + "grey1\0" + "grey10\0" + "grey100\0" + "grey11\0" + "grey12\0" + "grey13\0" + "grey14\0" + "grey15\0" + "grey16\0" + "grey17\0" + "grey18\0" + "grey19\0" + "grey2\0" + "grey20\0" + "grey21\0" + "grey22\0" + "grey23\0" + "grey24\0" + "grey25\0" + "grey26\0" + "grey27\0" + "grey28\0" + "grey29\0" + "grey3\0" + "grey30\0" + "grey31\0" + "grey32\0" + "grey33\0" + "grey34\0" + "grey35\0" + "grey36\0" + "grey37\0" + "grey38\0" + "grey39\0" + "grey4\0" + "grey40\0" + "grey41\0" + "grey42\0" + "grey43\0" + "grey44\0" + "grey45\0" + "grey46\0" + "grey47\0" + "grey48\0" + "grey49\0" + "grey5\0" + "grey50\0" + "grey51\0" + "grey52\0" + "grey53\0" + "grey54\0" + "grey55\0" + "grey56\0" + "grey57\0" + "grey58\0" + "grey59\0" + "grey6\0" + "grey60\0" + "grey61\0" + "grey62\0" + "grey63\0" + "grey64\0" + "grey65\0" + "grey66\0" + "grey67\0" + "grey68\0" + "grey69\0" + "grey7\0" + "grey70\0" + "grey71\0" + "grey72\0" + "grey73\0" + "grey74\0" + "grey75\0" + "grey76\0" + "grey77\0" + "grey78\0" + "grey79\0" + "grey8\0" + "grey80\0" + "grey81\0" + "grey82\0" + "grey83\0" + "grey84\0" + "grey85\0" + "grey86\0" + "grey87\0" + "grey88\0" + "grey89\0" + "grey9\0" + "grey90\0" + "grey91\0" + "grey92\0" + "grey93\0" + "grey94\0" + "grey95\0" + "grey96\0" + "grey97\0" + "grey98\0" + "grey99\0" + "honeydew\0" + "honeydew1\0" + "honeydew2\0" + "honeydew3\0" + "honeydew4\0" + "hot pink\0" + "HotPink\0" + "HotPink1\0" + "HotPink2\0" + "HotPink3\0" + "HotPink4\0" + "indian red\0" + "IndianRed\0" + "IndianRed1\0" + "IndianRed2\0" + "IndianRed3\0" + "IndianRed4\0" + "indigo\0" + "ivory\0" + "ivory1\0" + "ivory2\0" + "ivory3\0" + "ivory4\0" + "khaki\0" + "khaki1\0" + "khaki2\0" + "khaki3\0" + "khaki4\0" + "lavender\0" + "lavender blush\0" + "LavenderBlush\0" + "LavenderBlush1\0" + "LavenderBlush2\0" + "LavenderBlush3\0" + "LavenderBlush4\0" + "lawn green\0" + "LawnGreen\0" + "lemon chiffon\0" + "LemonChiffon\0" + "LemonChiffon1\0" + "LemonChiffon2\0" + "LemonChiffon3\0" + "LemonChiffon4\0" + "light blue\0" + "light coral\0" + "light cyan\0" + "light goldenrod\0" + "light goldenrod yellow\0" + "light gray\0" + "light green\0" + "light grey\0" + "light pink\0" + "light salmon\0" + "light sea green\0" + "light sky blue\0" + "light slate blue\0" + "light slate gray\0" + "light slate grey\0" + "light steel blue\0" + "light yellow\0" + "LightBlue\0" + "LightBlue1\0" + "LightBlue2\0" + "LightBlue3\0" + "LightBlue4\0" + "LightCoral\0" + "LightCyan\0" + "LightCyan1\0" + "LightCyan2\0" + "LightCyan3\0" + "LightCyan4\0" + "LightGoldenrod\0" + "LightGoldenrod1\0" + "LightGoldenrod2\0" + "LightGoldenrod3\0" + "LightGoldenrod4\0" + "LightGoldenrodYellow\0" + "LightGray\0" + "LightGreen\0" + "LightGrey\0" + "LightPink\0" + "LightPink1\0" + "LightPink2\0" + "LightPink3\0" + "LightPink4\0" + "LightSalmon\0" + "LightSalmon1\0" + "LightSalmon2\0" + "LightSalmon3\0" + "LightSalmon4\0" + "LightSeaGreen\0" + "LightSkyBlue\0" + "LightSkyBlue1\0" + "LightSkyBlue2\0" + "LightSkyBlue3\0" + "LightSkyBlue4\0" + "LightSlateBlue\0" + "LightSlateGray\0" + "LightSlateGrey\0" + "LightSteelBlue\0" + "LightSteelBlue1\0" + "LightSteelBlue2\0" + "LightSteelBlue3\0" + "LightSteelBlue4\0" + "LightYellow\0" + "LightYellow1\0" + "LightYellow2\0" + "LightYellow3\0" + "LightYellow4\0" + "lime\0" + "lime green\0" + "LimeGreen\0" + "linen\0" + "magenta\0" + "magenta1\0" + "magenta2\0" + "magenta3\0" + "magenta4\0" + "maroon\0" + "maroon1\0" + "maroon2\0" + "maroon3\0" + "maroon4\0" + "medium aquamarine\0" + "medium blue\0" + "medium orchid\0" + "medium purple\0" + "medium sea green\0" + "medium slate blue\0" + "medium spring green\0" + "medium turquoise\0" + "medium violet red\0" + "MediumAquamarine\0" + "MediumBlue\0" + "MediumOrchid\0" + "MediumOrchid1\0" + "MediumOrchid2\0" + "MediumOrchid3\0" + "MediumOrchid4\0" + "MediumPurple\0" + "MediumPurple1\0" + "MediumPurple2\0" + "MediumPurple3\0" + "MediumPurple4\0" + "MediumSeaGreen\0" + "MediumSlateBlue\0" + "MediumSpringGreen\0" + "MediumTurquoise\0" + "MediumVioletRed\0" + "midnight blue\0" + "MidnightBlue\0" + "mint cream\0" + "MintCream\0" + "misty rose\0" + "MistyRose\0" + "MistyRose1\0" + "MistyRose2\0" + "MistyRose3\0" + "MistyRose4\0" + "moccasin\0" + "navajo white\0" + "NavajoWhite\0" + "NavajoWhite1\0" + "NavajoWhite2\0" + "NavajoWhite3\0" + "NavajoWhite4\0" + "navy\0" + "navy blue\0" + "NavyBlue\0" + "old lace\0" + "OldLace\0" + "olive\0" + "olive drab\0" + "OliveDrab\0" + "OliveDrab1\0" + "OliveDrab2\0" + "OliveDrab3\0" + "OliveDrab4\0" + "orange\0" + "orange red\0" + "orange1\0" + "orange2\0" + "orange3\0" + "orange4\0" + "OrangeRed\0" + "OrangeRed1\0" + "OrangeRed2\0" + "OrangeRed3\0" + "OrangeRed4\0" + "orchid\0" + "orchid1\0" + "orchid2\0" + "orchid3\0" + "orchid4\0" + "pale goldenrod\0" + "pale green\0" + "pale turquoise\0" + "pale violet red\0" + "PaleGoldenrod\0" + "PaleGreen\0" + "PaleGreen1\0" + "PaleGreen2\0" + "PaleGreen3\0" + "PaleGreen4\0" + "PaleTurquoise\0" + "PaleTurquoise1\0" + "PaleTurquoise2\0" + "PaleTurquoise3\0" + "PaleTurquoise4\0" + "PaleVioletRed\0" + "PaleVioletRed1\0" + "PaleVioletRed2\0" + "PaleVioletRed3\0" + "PaleVioletRed4\0" + "papaya whip\0" + "PapayaWhip\0" + "peach puff\0" + "PeachPuff\0" + "PeachPuff1\0" + "PeachPuff2\0" + "PeachPuff3\0" + "PeachPuff4\0" + "peru\0" + "pink\0" + "pink1\0" + "pink2\0" + "pink3\0" + "pink4\0" + "plum\0" + "plum1\0" + "plum2\0" + "plum3\0" + "plum4\0" + "powder blue\0" + "PowderBlue\0" + "purple\0" + "purple1\0" + "purple2\0" + "purple3\0" + "purple4\0" + "rebecca purple\0" + "RebeccaPurple\0" + "red\0" + "red1\0" + "red2\0" + "red3\0" + "red4\0" + "rosy brown\0" + "RosyBrown\0" + "RosyBrown1\0" + "RosyBrown2\0" + "RosyBrown3\0" + "RosyBrown4\0" + "royal blue\0" + "RoyalBlue\0" + "RoyalBlue1\0" + "RoyalBlue2\0" + "RoyalBlue3\0" + "RoyalBlue4\0" + "saddle brown\0" + "SaddleBrown\0" + "salmon\0" + "salmon1\0" + "salmon2\0" + "salmon3\0" + "salmon4\0" + "sandy brown\0" + "SandyBrown\0" + "sea green\0" + "SeaGreen\0" + "SeaGreen1\0" + "SeaGreen2\0" + "SeaGreen3\0" + "SeaGreen4\0" + "seashell\0" + "seashell1\0" + "seashell2\0" + "seashell3\0" + "seashell4\0" + "sienna\0" + "sienna1\0" + "sienna2\0" + "sienna3\0" + "sienna4\0" + "silver\0" + "sky blue\0" + "SkyBlue\0" + "SkyBlue1\0" + "SkyBlue2\0" + "SkyBlue3\0" + "SkyBlue4\0" + "slate blue\0" + "slate gray\0" + "slate grey\0" + "SlateBlue\0" + "SlateBlue1\0" + "SlateBlue2\0" + "SlateBlue3\0" + "SlateBlue4\0" + "SlateGray\0" + "SlateGray1\0" + "SlateGray2\0" + "SlateGray3\0" + "SlateGray4\0" + "SlateGrey\0" + "snow\0" + "snow1\0" + "snow2\0" + "snow3\0" + "snow4\0" + "spring green\0" + "SpringGreen\0" + "SpringGreen1\0" + "SpringGreen2\0" + "SpringGreen3\0" + "SpringGreen4\0" + "steel blue\0" + "SteelBlue\0" + "SteelBlue1\0" + "SteelBlue2\0" + "SteelBlue3\0" + "SteelBlue4\0" + "tan\0" + "tan1\0" + "tan2\0" + "tan3\0" + "tan4\0" + "teal\0" + "thistle\0" + "thistle1\0" + "thistle2\0" + "thistle3\0" + "thistle4\0" + "tomato\0" + "tomato1\0" + "tomato2\0" + "tomato3\0" + "tomato4\0" + "turquoise\0" + "turquoise1\0" + "turquoise2\0" + "turquoise3\0" + "turquoise4\0" + "violet\0" + "violet red\0" + "VioletRed\0" + "VioletRed1\0" + "VioletRed2\0" + "VioletRed3\0" + "VioletRed4\0" + "web gray\0" + "web green\0" + "web grey\0" + "web maroon\0" + "web purple\0" + "WebGray\0" + "WebGreen\0" + "WebGrey\0" + "WebMaroon\0" + "WebPurple\0" + "wheat\0" + "wheat1\0" + "wheat2\0" + "wheat3\0" + "wheat4\0" + "white\0" + "white smoke\0" + "WhiteSmoke\0" + "x11 gray\0" + "x11 green\0" + "x11 grey\0" + "x11 maroon\0" + "x11 purple\0" + "X11Gray\0" + "X11Green\0" + "X11Grey\0" + "X11Maroon\0" + "X11Purple\0" + "yellow\0" + "yellow green\0" + "yellow1\0" + "yellow2\0" + "yellow3\0" + "yellow4\0" + "YellowGreen\0" +}; + +static const BuiltinColor BuiltinColors[] = { + {240, 248, 255, 0}, /* alice blue */ + {240, 248, 255, 11}, /* AliceBlue */ + {250, 235, 215, 21}, /* antique white */ + {250, 235, 215, 35}, /* AntiqueWhite */ + {255, 239, 219, 48}, /* AntiqueWhite1 */ + {238, 223, 204, 62}, /* AntiqueWhite2 */ + {205, 192, 176, 76}, /* AntiqueWhite3 */ + {139, 131, 120, 90}, /* AntiqueWhite4 */ + {0, 255, 255, 104}, /* aqua */ + {127, 255, 212, 109}, /* aquamarine */ + {127, 255, 212, 120}, /* aquamarine1 */ + {118, 238, 198, 132}, /* aquamarine2 */ + {102, 205, 170, 144}, /* aquamarine3 */ + {69, 139, 116, 156}, /* aquamarine4 */ + {240, 255, 255, 168}, /* azure */ + {240, 255, 255, 174}, /* azure1 */ + {224, 238, 238, 181}, /* azure2 */ + {193, 205, 205, 188}, /* azure3 */ + {131, 139, 139, 195}, /* azure4 */ + {245, 245, 220, 202}, /* beige */ + {255, 228, 196, 208}, /* bisque */ + {255, 228, 196, 215}, /* bisque1 */ + {238, 213, 183, 223}, /* bisque2 */ + {205, 183, 158, 231}, /* bisque3 */ + {139, 125, 107, 239}, /* bisque4 */ + {0, 0, 0, 247}, /* black */ + {255, 235, 205, 253}, /* blanched almond */ + {255, 235, 205, 269}, /* BlanchedAlmond */ + {0, 0, 255, 284}, /* blue */ + {138, 43, 226, 289}, /* blue violet */ + {0, 0, 255, 301}, /* blue1 */ + {0, 0, 238, 307}, /* blue2 */ + {0, 0, 205, 313}, /* blue3 */ + {0, 0, 139, 319}, /* blue4 */ + {138, 43, 226, 325}, /* BlueViolet */ + {165, 42, 42, 336}, /* brown */ + {255, 64, 64, 342}, /* brown1 */ + {238, 59, 59, 349}, /* brown2 */ + {205, 51, 51, 356}, /* brown3 */ + {139, 35, 35, 363}, /* brown4 */ + {222, 184, 135, 370}, /* burlywood */ + {255, 211, 155, 380}, /* burlywood1 */ + {238, 197, 145, 391}, /* burlywood2 */ + {205, 170, 125, 402}, /* burlywood3 */ + {139, 115, 85, 413}, /* burlywood4 */ + {95, 158, 160, 424}, /* cadet blue */ + {95, 158, 160, 435}, /* CadetBlue */ + {152, 245, 255, 445}, /* CadetBlue1 */ + {142, 229, 238, 456}, /* CadetBlue2 */ + {122, 197, 205, 467}, /* CadetBlue3 */ + {83, 134, 139, 478}, /* CadetBlue4 */ + {127, 255, 0, 489}, /* chartreuse */ + {127, 255, 0, 500}, /* chartreuse1 */ + {118, 238, 0, 512}, /* chartreuse2 */ + {102, 205, 0, 524}, /* chartreuse3 */ + {69, 139, 0, 536}, /* chartreuse4 */ + {210, 105, 30, 548}, /* chocolate */ + {255, 127, 36, 558}, /* chocolate1 */ + {238, 118, 33, 569}, /* chocolate2 */ + {205, 102, 29, 580}, /* chocolate3 */ + {139, 69, 19, 591}, /* chocolate4 */ + {255, 127, 80, 602}, /* coral */ + {255, 114, 86, 608}, /* coral1 */ + {238, 106, 80, 615}, /* coral2 */ + {205, 91, 69, 622}, /* coral3 */ + {139, 62, 47, 629}, /* coral4 */ + {100, 149, 237, 636}, /* cornflower blue */ + {100, 149, 237, 652}, /* CornflowerBlue */ + {255, 248, 220, 667}, /* cornsilk */ + {255, 248, 220, 676}, /* cornsilk1 */ + {238, 232, 205, 686}, /* cornsilk2 */ + {205, 200, 177, 696}, /* cornsilk3 */ + {139, 136, 120, 706}, /* cornsilk4 */ + {220, 20, 60, 716}, /* crimson */ + {0, 255, 255, 724}, /* cyan */ + {0, 255, 255, 729}, /* cyan1 */ + {0, 238, 238, 735}, /* cyan2 */ + {0, 205, 205, 741}, /* cyan3 */ + {0, 139, 139, 747}, /* cyan4 */ + {0, 0, 139, 753}, /* dark blue */ + {0, 139, 139, 763}, /* dark cyan */ + {184, 134, 11, 773}, /* dark goldenrod */ + {169, 169, 169, 788}, /* dark gray */ + {0, 100, 0, 798}, /* dark green */ + {169, 169, 169, 809}, /* dark grey */ + {189, 183, 107, 819}, /* dark khaki */ + {139, 0, 139, 830}, /* dark magenta */ + {85, 107, 47, 843}, /* dark olive green */ + {255, 140, 0, 860}, /* dark orange */ + {153, 50, 204, 872}, /* dark orchid */ + {139, 0, 0, 884}, /* dark red */ + {233, 150, 122, 893}, /* dark salmon */ + {143, 188, 143, 905}, /* dark sea green */ + {72, 61, 139, 920}, /* dark slate blue */ + {47, 79, 79, 936}, /* dark slate gray */ + {47, 79, 79, 952}, /* dark slate grey */ + {0, 206, 209, 968}, /* dark turquoise */ + {148, 0, 211, 983}, /* dark violet */ + {0, 0, 139, 995}, /* DarkBlue */ + {0, 139, 139, 1004}, /* DarkCyan */ + {184, 134, 11, 1013}, /* DarkGoldenrod */ + {255, 185, 15, 1027}, /* DarkGoldenrod1 */ + {238, 173, 14, 1042}, /* DarkGoldenrod2 */ + {205, 149, 12, 1057}, /* DarkGoldenrod3 */ + {139, 101, 8, 1072}, /* DarkGoldenrod4 */ + {169, 169, 169, 1087}, /* DarkGray */ + {0, 100, 0, 1096}, /* DarkGreen */ + {169, 169, 169, 1106}, /* DarkGrey */ + {189, 183, 107, 1115}, /* DarkKhaki */ + {139, 0, 139, 1125}, /* DarkMagenta */ + {85, 107, 47, 1137}, /* DarkOliveGreen */ + {202, 255, 112, 1152}, /* DarkOliveGreen1 */ + {188, 238, 104, 1168}, /* DarkOliveGreen2 */ + {162, 205, 90, 1184}, /* DarkOliveGreen3 */ + {110, 139, 61, 1200}, /* DarkOliveGreen4 */ + {255, 140, 0, 1216}, /* DarkOrange */ + {255, 127, 0, 1227}, /* DarkOrange1 */ + {238, 118, 0, 1239}, /* DarkOrange2 */ + {205, 102, 0, 1251}, /* DarkOrange3 */ + {139, 69, 0, 1263}, /* DarkOrange4 */ + {153, 50, 204, 1275}, /* DarkOrchid */ + {191, 62, 255, 1286}, /* DarkOrchid1 */ + {178, 58, 238, 1298}, /* DarkOrchid2 */ + {154, 50, 205, 1310}, /* DarkOrchid3 */ + {104, 34, 139, 1322}, /* DarkOrchid4 */ + {139, 0, 0, 1334}, /* DarkRed */ + {233, 150, 122, 1342}, /* DarkSalmon */ + {143, 188, 143, 1353}, /* DarkSeaGreen */ + {193, 255, 193, 1366}, /* DarkSeaGreen1 */ + {180, 238, 180, 1380}, /* DarkSeaGreen2 */ + {155, 205, 155, 1394}, /* DarkSeaGreen3 */ + {105, 139, 105, 1408}, /* DarkSeaGreen4 */ + {72, 61, 139, 1422}, /* DarkSlateBlue */ + {47, 79, 79, 1436}, /* DarkSlateGray */ + {151, 255, 255, 1450}, /* DarkSlateGray1 */ + {141, 238, 238, 1465}, /* DarkSlateGray2 */ + {121, 205, 205, 1480}, /* DarkSlateGray3 */ + {82, 139, 139, 1495}, /* DarkSlateGray4 */ + {47, 79, 79, 1510}, /* DarkSlateGrey */ + {0, 206, 209, 1524}, /* DarkTurquoise */ + {148, 0, 211, 1538}, /* DarkViolet */ + {255, 20, 147, 1549}, /* deep pink */ + {0, 191, 255, 1559}, /* deep sky blue */ + {255, 20, 147, 1573}, /* DeepPink */ + {255, 20, 147, 1582}, /* DeepPink1 */ + {238, 18, 137, 1592}, /* DeepPink2 */ + {205, 16, 118, 1602}, /* DeepPink3 */ + {139, 10, 80, 1612}, /* DeepPink4 */ + {0, 191, 255, 1622}, /* DeepSkyBlue */ + {0, 191, 255, 1634}, /* DeepSkyBlue1 */ + {0, 178, 238, 1647}, /* DeepSkyBlue2 */ + {0, 154, 205, 1660}, /* DeepSkyBlue3 */ + {0, 104, 139, 1673}, /* DeepSkyBlue4 */ + {105, 105, 105, 1686}, /* dim gray */ + {105, 105, 105, 1695}, /* dim grey */ + {105, 105, 105, 1704}, /* DimGray */ + {105, 105, 105, 1712}, /* DimGrey */ + {30, 144, 255, 1720}, /* dodger blue */ + {30, 144, 255, 1732}, /* DodgerBlue */ + {30, 144, 255, 1743}, /* DodgerBlue1 */ + {28, 134, 238, 1755}, /* DodgerBlue2 */ + {24, 116, 205, 1767}, /* DodgerBlue3 */ + {16, 78, 139, 1779}, /* DodgerBlue4 */ + {178, 34, 34, 1791}, /* firebrick */ + {255, 48, 48, 1801}, /* firebrick1 */ + {238, 44, 44, 1812}, /* firebrick2 */ + {205, 38, 38, 1823}, /* firebrick3 */ + {139, 26, 26, 1834}, /* firebrick4 */ + {255, 250, 240, 1845}, /* floral white */ + {255, 250, 240, 1858}, /* FloralWhite */ + {34, 139, 34, 1870}, /* forest green */ + {34, 139, 34, 1883}, /* ForestGreen */ + {255, 0, 255, 1895}, /* fuchsia */ + {220, 220, 220, 1903}, /* gainsboro */ + {248, 248, 255, 1913}, /* ghost white */ + {248, 248, 255, 1925}, /* GhostWhite */ + {255, 215, 0, 1936}, /* gold */ + {255, 215, 0, 1941}, /* gold1 */ + {238, 201, 0, 1947}, /* gold2 */ + {205, 173, 0, 1953}, /* gold3 */ + {139, 117, 0, 1959}, /* gold4 */ + {218, 165, 32, 1965}, /* goldenrod */ + {255, 193, 37, 1975}, /* goldenrod1 */ + {238, 180, 34, 1986}, /* goldenrod2 */ + {205, 155, 29, 1997}, /* goldenrod3 */ + {139, 105, 20, 2008}, /* goldenrod4 */ + {190, 190, 190, 2019}, /* gray */ + {0, 0, 0, 2024}, /* gray0 */ + {3, 3, 3, 2030}, /* gray1 */ + {26, 26, 26, 2036}, /* gray10 */ + {255, 255, 255, 2043}, /* gray100 */ + {28, 28, 28, 2051}, /* gray11 */ + {31, 31, 31, 2058}, /* gray12 */ + {33, 33, 33, 2065}, /* gray13 */ + {36, 36, 36, 2072}, /* gray14 */ + {38, 38, 38, 2079}, /* gray15 */ + {41, 41, 41, 2086}, /* gray16 */ + {43, 43, 43, 2093}, /* gray17 */ + {46, 46, 46, 2100}, /* gray18 */ + {48, 48, 48, 2107}, /* gray19 */ + {5, 5, 5, 2114}, /* gray2 */ + {51, 51, 51, 2120}, /* gray20 */ + {54, 54, 54, 2127}, /* gray21 */ + {56, 56, 56, 2134}, /* gray22 */ + {59, 59, 59, 2141}, /* gray23 */ + {61, 61, 61, 2148}, /* gray24 */ + {64, 64, 64, 2155}, /* gray25 */ + {66, 66, 66, 2162}, /* gray26 */ + {69, 69, 69, 2169}, /* gray27 */ + {71, 71, 71, 2176}, /* gray28 */ + {74, 74, 74, 2183}, /* gray29 */ + {8, 8, 8, 2190}, /* gray3 */ + {77, 77, 77, 2196}, /* gray30 */ + {79, 79, 79, 2203}, /* gray31 */ + {82, 82, 82, 2210}, /* gray32 */ + {84, 84, 84, 2217}, /* gray33 */ + {87, 87, 87, 2224}, /* gray34 */ + {89, 89, 89, 2231}, /* gray35 */ + {92, 92, 92, 2238}, /* gray36 */ + {94, 94, 94, 2245}, /* gray37 */ + {97, 97, 97, 2252}, /* gray38 */ + {99, 99, 99, 2259}, /* gray39 */ + {10, 10, 10, 2266}, /* gray4 */ + {102, 102, 102, 2272}, /* gray40 */ + {105, 105, 105, 2279}, /* gray41 */ + {107, 107, 107, 2286}, /* gray42 */ + {110, 110, 110, 2293}, /* gray43 */ + {112, 112, 112, 2300}, /* gray44 */ + {115, 115, 115, 2307}, /* gray45 */ + {117, 117, 117, 2314}, /* gray46 */ + {120, 120, 120, 2321}, /* gray47 */ + {122, 122, 122, 2328}, /* gray48 */ + {125, 125, 125, 2335}, /* gray49 */ + {13, 13, 13, 2342}, /* gray5 */ + {127, 127, 127, 2348}, /* gray50 */ + {130, 130, 130, 2355}, /* gray51 */ + {133, 133, 133, 2362}, /* gray52 */ + {135, 135, 135, 2369}, /* gray53 */ + {138, 138, 138, 2376}, /* gray54 */ + {140, 140, 140, 2383}, /* gray55 */ + {143, 143, 143, 2390}, /* gray56 */ + {145, 145, 145, 2397}, /* gray57 */ + {148, 148, 148, 2404}, /* gray58 */ + {150, 150, 150, 2411}, /* gray59 */ + {15, 15, 15, 2418}, /* gray6 */ + {153, 153, 153, 2424}, /* gray60 */ + {156, 156, 156, 2431}, /* gray61 */ + {158, 158, 158, 2438}, /* gray62 */ + {161, 161, 161, 2445}, /* gray63 */ + {163, 163, 163, 2452}, /* gray64 */ + {166, 166, 166, 2459}, /* gray65 */ + {168, 168, 168, 2466}, /* gray66 */ + {171, 171, 171, 2473}, /* gray67 */ + {173, 173, 173, 2480}, /* gray68 */ + {176, 176, 176, 2487}, /* gray69 */ + {18, 18, 18, 2494}, /* gray7 */ + {179, 179, 179, 2500}, /* gray70 */ + {181, 181, 181, 2507}, /* gray71 */ + {184, 184, 184, 2514}, /* gray72 */ + {186, 186, 186, 2521}, /* gray73 */ + {189, 189, 189, 2528}, /* gray74 */ + {191, 191, 191, 2535}, /* gray75 */ + {194, 194, 194, 2542}, /* gray76 */ + {196, 196, 196, 2549}, /* gray77 */ + {199, 199, 199, 2556}, /* gray78 */ + {201, 201, 201, 2563}, /* gray79 */ + {20, 20, 20, 2570}, /* gray8 */ + {204, 204, 204, 2576}, /* gray80 */ + {207, 207, 207, 2583}, /* gray81 */ + {209, 209, 209, 2590}, /* gray82 */ + {212, 212, 212, 2597}, /* gray83 */ + {214, 214, 214, 2604}, /* gray84 */ + {217, 217, 217, 2611}, /* gray85 */ + {219, 219, 219, 2618}, /* gray86 */ + {222, 222, 222, 2625}, /* gray87 */ + {224, 224, 224, 2632}, /* gray88 */ + {227, 227, 227, 2639}, /* gray89 */ + {23, 23, 23, 2646}, /* gray9 */ + {229, 229, 229, 2652}, /* gray90 */ + {232, 232, 232, 2659}, /* gray91 */ + {235, 235, 235, 2666}, /* gray92 */ + {237, 237, 237, 2673}, /* gray93 */ + {240, 240, 240, 2680}, /* gray94 */ + {242, 242, 242, 2687}, /* gray95 */ + {245, 245, 245, 2694}, /* gray96 */ + {247, 247, 247, 2701}, /* gray97 */ + {250, 250, 250, 2708}, /* gray98 */ + {252, 252, 252, 2715}, /* gray99 */ + {0, 255, 0, 2722}, /* green */ + {173, 255, 47, 2728}, /* green yellow */ + {0, 255, 0, 2741}, /* green1 */ + {0, 238, 0, 2748}, /* green2 */ + {0, 205, 0, 2755}, /* green3 */ + {0, 139, 0, 2762}, /* green4 */ + {173, 255, 47, 2769}, /* GreenYellow */ + {190, 190, 190, 2781}, /* grey */ + {0, 0, 0, 2786}, /* grey0 */ + {3, 3, 3, 2792}, /* grey1 */ + {26, 26, 26, 2798}, /* grey10 */ + {255, 255, 255, 2805}, /* grey100 */ + {28, 28, 28, 2813}, /* grey11 */ + {31, 31, 31, 2820}, /* grey12 */ + {33, 33, 33, 2827}, /* grey13 */ + {36, 36, 36, 2834}, /* grey14 */ + {38, 38, 38, 2841}, /* grey15 */ + {41, 41, 41, 2848}, /* grey16 */ + {43, 43, 43, 2855}, /* grey17 */ + {46, 46, 46, 2862}, /* grey18 */ + {48, 48, 48, 2869}, /* grey19 */ + {5, 5, 5, 2876}, /* grey2 */ + {51, 51, 51, 2882}, /* grey20 */ + {54, 54, 54, 2889}, /* grey21 */ + {56, 56, 56, 2896}, /* grey22 */ + {59, 59, 59, 2903}, /* grey23 */ + {61, 61, 61, 2910}, /* grey24 */ + {64, 64, 64, 2917}, /* grey25 */ + {66, 66, 66, 2924}, /* grey26 */ + {69, 69, 69, 2931}, /* grey27 */ + {71, 71, 71, 2938}, /* grey28 */ + {74, 74, 74, 2945}, /* grey29 */ + {8, 8, 8, 2952}, /* grey3 */ + {77, 77, 77, 2958}, /* grey30 */ + {79, 79, 79, 2965}, /* grey31 */ + {82, 82, 82, 2972}, /* grey32 */ + {84, 84, 84, 2979}, /* grey33 */ + {87, 87, 87, 2986}, /* grey34 */ + {89, 89, 89, 2993}, /* grey35 */ + {92, 92, 92, 3000}, /* grey36 */ + {94, 94, 94, 3007}, /* grey37 */ + {97, 97, 97, 3014}, /* grey38 */ + {99, 99, 99, 3021}, /* grey39 */ + {10, 10, 10, 3028}, /* grey4 */ + {102, 102, 102, 3034}, /* grey40 */ + {105, 105, 105, 3041}, /* grey41 */ + {107, 107, 107, 3048}, /* grey42 */ + {110, 110, 110, 3055}, /* grey43 */ + {112, 112, 112, 3062}, /* grey44 */ + {115, 115, 115, 3069}, /* grey45 */ + {117, 117, 117, 3076}, /* grey46 */ + {120, 120, 120, 3083}, /* grey47 */ + {122, 122, 122, 3090}, /* grey48 */ + {125, 125, 125, 3097}, /* grey49 */ + {13, 13, 13, 3104}, /* grey5 */ + {127, 127, 127, 3110}, /* grey50 */ + {130, 130, 130, 3117}, /* grey51 */ + {133, 133, 133, 3124}, /* grey52 */ + {135, 135, 135, 3131}, /* grey53 */ + {138, 138, 138, 3138}, /* grey54 */ + {140, 140, 140, 3145}, /* grey55 */ + {143, 143, 143, 3152}, /* grey56 */ + {145, 145, 145, 3159}, /* grey57 */ + {148, 148, 148, 3166}, /* grey58 */ + {150, 150, 150, 3173}, /* grey59 */ + {15, 15, 15, 3180}, /* grey6 */ + {153, 153, 153, 3186}, /* grey60 */ + {156, 156, 156, 3193}, /* grey61 */ + {158, 158, 158, 3200}, /* grey62 */ + {161, 161, 161, 3207}, /* grey63 */ + {163, 163, 163, 3214}, /* grey64 */ + {166, 166, 166, 3221}, /* grey65 */ + {168, 168, 168, 3228}, /* grey66 */ + {171, 171, 171, 3235}, /* grey67 */ + {173, 173, 173, 3242}, /* grey68 */ + {176, 176, 176, 3249}, /* grey69 */ + {18, 18, 18, 3256}, /* grey7 */ + {179, 179, 179, 3262}, /* grey70 */ + {181, 181, 181, 3269}, /* grey71 */ + {184, 184, 184, 3276}, /* grey72 */ + {186, 186, 186, 3283}, /* grey73 */ + {189, 189, 189, 3290}, /* grey74 */ + {191, 191, 191, 3297}, /* grey75 */ + {194, 194, 194, 3304}, /* grey76 */ + {196, 196, 196, 3311}, /* grey77 */ + {199, 199, 199, 3318}, /* grey78 */ + {201, 201, 201, 3325}, /* grey79 */ + {20, 20, 20, 3332}, /* grey8 */ + {204, 204, 204, 3338}, /* grey80 */ + {207, 207, 207, 3345}, /* grey81 */ + {209, 209, 209, 3352}, /* grey82 */ + {212, 212, 212, 3359}, /* grey83 */ + {214, 214, 214, 3366}, /* grey84 */ + {217, 217, 217, 3373}, /* grey85 */ + {219, 219, 219, 3380}, /* grey86 */ + {222, 222, 222, 3387}, /* grey87 */ + {224, 224, 224, 3394}, /* grey88 */ + {227, 227, 227, 3401}, /* grey89 */ + {23, 23, 23, 3408}, /* grey9 */ + {229, 229, 229, 3414}, /* grey90 */ + {232, 232, 232, 3421}, /* grey91 */ + {235, 235, 235, 3428}, /* grey92 */ + {237, 237, 237, 3435}, /* grey93 */ + {240, 240, 240, 3442}, /* grey94 */ + {242, 242, 242, 3449}, /* grey95 */ + {245, 245, 245, 3456}, /* grey96 */ + {247, 247, 247, 3463}, /* grey97 */ + {250, 250, 250, 3470}, /* grey98 */ + {252, 252, 252, 3477}, /* grey99 */ + {240, 255, 240, 3484}, /* honeydew */ + {240, 255, 240, 3493}, /* honeydew1 */ + {224, 238, 224, 3503}, /* honeydew2 */ + {193, 205, 193, 3513}, /* honeydew3 */ + {131, 139, 131, 3523}, /* honeydew4 */ + {255, 105, 180, 3533}, /* hot pink */ + {255, 105, 180, 3542}, /* HotPink */ + {255, 110, 180, 3550}, /* HotPink1 */ + {238, 106, 167, 3559}, /* HotPink2 */ + {205, 96, 144, 3568}, /* HotPink3 */ + {139, 58, 98, 3577}, /* HotPink4 */ + {205, 92, 92, 3586}, /* indian red */ + {205, 92, 92, 3597}, /* IndianRed */ + {255, 106, 106, 3607}, /* IndianRed1 */ + {238, 99, 99, 3618}, /* IndianRed2 */ + {205, 85, 85, 3629}, /* IndianRed3 */ + {139, 58, 58, 3640}, /* IndianRed4 */ + {75, 0, 130, 3651}, /* indigo */ + {255, 255, 240, 3658}, /* ivory */ + {255, 255, 240, 3664}, /* ivory1 */ + {238, 238, 224, 3671}, /* ivory2 */ + {205, 205, 193, 3678}, /* ivory3 */ + {139, 139, 131, 3685}, /* ivory4 */ + {240, 230, 140, 3692}, /* khaki */ + {255, 246, 143, 3698}, /* khaki1 */ + {238, 230, 133, 3705}, /* khaki2 */ + {205, 198, 115, 3712}, /* khaki3 */ + {139, 134, 78, 3719}, /* khaki4 */ + {230, 230, 250, 3726}, /* lavender */ + {255, 240, 245, 3735}, /* lavender blush */ + {255, 240, 245, 3750}, /* LavenderBlush */ + {255, 240, 245, 3764}, /* LavenderBlush1 */ + {238, 224, 229, 3779}, /* LavenderBlush2 */ + {205, 193, 197, 3794}, /* LavenderBlush3 */ + {139, 131, 134, 3809}, /* LavenderBlush4 */ + {124, 252, 0, 3824}, /* lawn green */ + {124, 252, 0, 3835}, /* LawnGreen */ + {255, 250, 205, 3845}, /* lemon chiffon */ + {255, 250, 205, 3859}, /* LemonChiffon */ + {255, 250, 205, 3872}, /* LemonChiffon1 */ + {238, 233, 191, 3886}, /* LemonChiffon2 */ + {205, 201, 165, 3900}, /* LemonChiffon3 */ + {139, 137, 112, 3914}, /* LemonChiffon4 */ + {173, 216, 230, 3928}, /* light blue */ + {240, 128, 128, 3939}, /* light coral */ + {224, 255, 255, 3951}, /* light cyan */ + {238, 221, 130, 3962}, /* light goldenrod */ + {250, 250, 210, 3978}, /* light goldenrod yellow */ + {211, 211, 211, 4001}, /* light gray */ + {144, 238, 144, 4012}, /* light green */ + {211, 211, 211, 4024}, /* light grey */ + {255, 182, 193, 4035}, /* light pink */ + {255, 160, 122, 4046}, /* light salmon */ + {32, 178, 170, 4059}, /* light sea green */ + {135, 206, 250, 4075}, /* light sky blue */ + {132, 112, 255, 4090}, /* light slate blue */ + {119, 136, 153, 4107}, /* light slate gray */ + {119, 136, 153, 4124}, /* light slate grey */ + {176, 196, 222, 4141}, /* light steel blue */ + {255, 255, 224, 4158}, /* light yellow */ + {173, 216, 230, 4171}, /* LightBlue */ + {191, 239, 255, 4181}, /* LightBlue1 */ + {178, 223, 238, 4192}, /* LightBlue2 */ + {154, 192, 205, 4203}, /* LightBlue3 */ + {104, 131, 139, 4214}, /* LightBlue4 */ + {240, 128, 128, 4225}, /* LightCoral */ + {224, 255, 255, 4236}, /* LightCyan */ + {224, 255, 255, 4246}, /* LightCyan1 */ + {209, 238, 238, 4257}, /* LightCyan2 */ + {180, 205, 205, 4268}, /* LightCyan3 */ + {122, 139, 139, 4279}, /* LightCyan4 */ + {238, 221, 130, 4290}, /* LightGoldenrod */ + {255, 236, 139, 4305}, /* LightGoldenrod1 */ + {238, 220, 130, 4321}, /* LightGoldenrod2 */ + {205, 190, 112, 4337}, /* LightGoldenrod3 */ + {139, 129, 76, 4353}, /* LightGoldenrod4 */ + {250, 250, 210, 4369}, /* LightGoldenrodYellow */ + {211, 211, 211, 4390}, /* LightGray */ + {144, 238, 144, 4400}, /* LightGreen */ + {211, 211, 211, 4411}, /* LightGrey */ + {255, 182, 193, 4421}, /* LightPink */ + {255, 174, 185, 4431}, /* LightPink1 */ + {238, 162, 173, 4442}, /* LightPink2 */ + {205, 140, 149, 4453}, /* LightPink3 */ + {139, 95, 101, 4464}, /* LightPink4 */ + {255, 160, 122, 4475}, /* LightSalmon */ + {255, 160, 122, 4487}, /* LightSalmon1 */ + {238, 149, 114, 4500}, /* LightSalmon2 */ + {205, 129, 98, 4513}, /* LightSalmon3 */ + {139, 87, 66, 4526}, /* LightSalmon4 */ + {32, 178, 170, 4539}, /* LightSeaGreen */ + {135, 206, 250, 4553}, /* LightSkyBlue */ + {176, 226, 255, 4566}, /* LightSkyBlue1 */ + {164, 211, 238, 4580}, /* LightSkyBlue2 */ + {141, 182, 205, 4594}, /* LightSkyBlue3 */ + {96, 123, 139, 4608}, /* LightSkyBlue4 */ + {132, 112, 255, 4622}, /* LightSlateBlue */ + {119, 136, 153, 4637}, /* LightSlateGray */ + {119, 136, 153, 4652}, /* LightSlateGrey */ + {176, 196, 222, 4667}, /* LightSteelBlue */ + {202, 225, 255, 4682}, /* LightSteelBlue1 */ + {188, 210, 238, 4698}, /* LightSteelBlue2 */ + {162, 181, 205, 4714}, /* LightSteelBlue3 */ + {110, 123, 139, 4730}, /* LightSteelBlue4 */ + {255, 255, 224, 4746}, /* LightYellow */ + {255, 255, 224, 4758}, /* LightYellow1 */ + {238, 238, 209, 4771}, /* LightYellow2 */ + {205, 205, 180, 4784}, /* LightYellow3 */ + {139, 139, 122, 4797}, /* LightYellow4 */ + {0, 255, 0, 4810}, /* lime */ + {50, 205, 50, 4815}, /* lime green */ + {50, 205, 50, 4826}, /* LimeGreen */ + {250, 240, 230, 4836}, /* linen */ + {255, 0, 255, 4842}, /* magenta */ + {255, 0, 255, 4850}, /* magenta1 */ + {238, 0, 238, 4859}, /* magenta2 */ + {205, 0, 205, 4868}, /* magenta3 */ + {139, 0, 139, 4877}, /* magenta4 */ + {176, 48, 96, 4886}, /* maroon */ + {255, 52, 179, 4893}, /* maroon1 */ + {238, 48, 167, 4901}, /* maroon2 */ + {205, 41, 144, 4909}, /* maroon3 */ + {139, 28, 98, 4917}, /* maroon4 */ + {102, 205, 170, 4925}, /* medium aquamarine */ + {0, 0, 205, 4943}, /* medium blue */ + {186, 85, 211, 4955}, /* medium orchid */ + {147, 112, 219, 4969}, /* medium purple */ + {60, 179, 113, 4983}, /* medium sea green */ + {123, 104, 238, 5000}, /* medium slate blue */ + {0, 250, 154, 5018}, /* medium spring green */ + {72, 209, 204, 5038}, /* medium turquoise */ + {199, 21, 133, 5055}, /* medium violet red */ + {102, 205, 170, 5073}, /* MediumAquamarine */ + {0, 0, 205, 5090}, /* MediumBlue */ + {186, 85, 211, 5101}, /* MediumOrchid */ + {224, 102, 255, 5114}, /* MediumOrchid1 */ + {209, 95, 238, 5128}, /* MediumOrchid2 */ + {180, 82, 205, 5142}, /* MediumOrchid3 */ + {122, 55, 139, 5156}, /* MediumOrchid4 */ + {147, 112, 219, 5170}, /* MediumPurple */ + {171, 130, 255, 5183}, /* MediumPurple1 */ + {159, 121, 238, 5197}, /* MediumPurple2 */ + {137, 104, 205, 5211}, /* MediumPurple3 */ + {93, 71, 139, 5225}, /* MediumPurple4 */ + {60, 179, 113, 5239}, /* MediumSeaGreen */ + {123, 104, 238, 5254}, /* MediumSlateBlue */ + {0, 250, 154, 5270}, /* MediumSpringGreen */ + {72, 209, 204, 5288}, /* MediumTurquoise */ + {199, 21, 133, 5304}, /* MediumVioletRed */ + {25, 25, 112, 5320}, /* midnight blue */ + {25, 25, 112, 5334}, /* MidnightBlue */ + {245, 255, 250, 5347}, /* mint cream */ + {245, 255, 250, 5358}, /* MintCream */ + {255, 228, 225, 5368}, /* misty rose */ + {255, 228, 225, 5379}, /* MistyRose */ + {255, 228, 225, 5389}, /* MistyRose1 */ + {238, 213, 210, 5400}, /* MistyRose2 */ + {205, 183, 181, 5411}, /* MistyRose3 */ + {139, 125, 123, 5422}, /* MistyRose4 */ + {255, 228, 181, 5433}, /* moccasin */ + {255, 222, 173, 5442}, /* navajo white */ + {255, 222, 173, 5455}, /* NavajoWhite */ + {255, 222, 173, 5467}, /* NavajoWhite1 */ + {238, 207, 161, 5480}, /* NavajoWhite2 */ + {205, 179, 139, 5493}, /* NavajoWhite3 */ + {139, 121, 94, 5506}, /* NavajoWhite4 */ + {0, 0, 128, 5519}, /* navy */ + {0, 0, 128, 5524}, /* navy blue */ + {0, 0, 128, 5534}, /* NavyBlue */ + {253, 245, 230, 5543}, /* old lace */ + {253, 245, 230, 5552}, /* OldLace */ + {128, 128, 0, 5560}, /* olive */ + {107, 142, 35, 5566}, /* olive drab */ + {107, 142, 35, 5577}, /* OliveDrab */ + {192, 255, 62, 5587}, /* OliveDrab1 */ + {179, 238, 58, 5598}, /* OliveDrab2 */ + {154, 205, 50, 5609}, /* OliveDrab3 */ + {105, 139, 34, 5620}, /* OliveDrab4 */ + {255, 165, 0, 5631}, /* orange */ + {255, 69, 0, 5638}, /* orange red */ + {255, 165, 0, 5649}, /* orange1 */ + {238, 154, 0, 5657}, /* orange2 */ + {205, 133, 0, 5665}, /* orange3 */ + {139, 90, 0, 5673}, /* orange4 */ + {255, 69, 0, 5681}, /* OrangeRed */ + {255, 69, 0, 5691}, /* OrangeRed1 */ + {238, 64, 0, 5702}, /* OrangeRed2 */ + {205, 55, 0, 5713}, /* OrangeRed3 */ + {139, 37, 0, 5724}, /* OrangeRed4 */ + {218, 112, 214, 5735}, /* orchid */ + {255, 131, 250, 5742}, /* orchid1 */ + {238, 122, 233, 5750}, /* orchid2 */ + {205, 105, 201, 5758}, /* orchid3 */ + {139, 71, 137, 5766}, /* orchid4 */ + {238, 232, 170, 5774}, /* pale goldenrod */ + {152, 251, 152, 5789}, /* pale green */ + {175, 238, 238, 5800}, /* pale turquoise */ + {219, 112, 147, 5815}, /* pale violet red */ + {238, 232, 170, 5831}, /* PaleGoldenrod */ + {152, 251, 152, 5845}, /* PaleGreen */ + {154, 255, 154, 5855}, /* PaleGreen1 */ + {144, 238, 144, 5866}, /* PaleGreen2 */ + {124, 205, 124, 5877}, /* PaleGreen3 */ + {84, 139, 84, 5888}, /* PaleGreen4 */ + {175, 238, 238, 5899}, /* PaleTurquoise */ + {187, 255, 255, 5913}, /* PaleTurquoise1 */ + {174, 238, 238, 5928}, /* PaleTurquoise2 */ + {150, 205, 205, 5943}, /* PaleTurquoise3 */ + {102, 139, 139, 5958}, /* PaleTurquoise4 */ + {219, 112, 147, 5973}, /* PaleVioletRed */ + {255, 130, 171, 5987}, /* PaleVioletRed1 */ + {238, 121, 159, 6002}, /* PaleVioletRed2 */ + {205, 104, 137, 6017}, /* PaleVioletRed3 */ + {139, 71, 93, 6032}, /* PaleVioletRed4 */ + {255, 239, 213, 6047}, /* papaya whip */ + {255, 239, 213, 6059}, /* PapayaWhip */ + {255, 218, 185, 6070}, /* peach puff */ + {255, 218, 185, 6081}, /* PeachPuff */ + {255, 218, 185, 6091}, /* PeachPuff1 */ + {238, 203, 173, 6102}, /* PeachPuff2 */ + {205, 175, 149, 6113}, /* PeachPuff3 */ + {139, 119, 101, 6124}, /* PeachPuff4 */ + {205, 133, 63, 6135}, /* peru */ + {255, 192, 203, 6140}, /* pink */ + {255, 181, 197, 6145}, /* pink1 */ + {238, 169, 184, 6151}, /* pink2 */ + {205, 145, 158, 6157}, /* pink3 */ + {139, 99, 108, 6163}, /* pink4 */ + {221, 160, 221, 6169}, /* plum */ + {255, 187, 255, 6174}, /* plum1 */ + {238, 174, 238, 6180}, /* plum2 */ + {205, 150, 205, 6186}, /* plum3 */ + {139, 102, 139, 6192}, /* plum4 */ + {176, 224, 230, 6198}, /* powder blue */ + {176, 224, 230, 6210}, /* PowderBlue */ + {160, 32, 240, 6221}, /* purple */ + {155, 48, 255, 6228}, /* purple1 */ + {145, 44, 238, 6236}, /* purple2 */ + {125, 38, 205, 6244}, /* purple3 */ + {85, 26, 139, 6252}, /* purple4 */ + {102, 51, 153, 6260}, /* rebecca purple */ + {102, 51, 153, 6275}, /* RebeccaPurple */ + {255, 0, 0, 6289}, /* red */ + {255, 0, 0, 6293}, /* red1 */ + {238, 0, 0, 6298}, /* red2 */ + {205, 0, 0, 6303}, /* red3 */ + {139, 0, 0, 6308}, /* red4 */ + {188, 143, 143, 6313}, /* rosy brown */ + {188, 143, 143, 6324}, /* RosyBrown */ + {255, 193, 193, 6334}, /* RosyBrown1 */ + {238, 180, 180, 6345}, /* RosyBrown2 */ + {205, 155, 155, 6356}, /* RosyBrown3 */ + {139, 105, 105, 6367}, /* RosyBrown4 */ + {65, 105, 225, 6378}, /* royal blue */ + {65, 105, 225, 6389}, /* RoyalBlue */ + {72, 118, 255, 6399}, /* RoyalBlue1 */ + {67, 110, 238, 6410}, /* RoyalBlue2 */ + {58, 95, 205, 6421}, /* RoyalBlue3 */ + {39, 64, 139, 6432}, /* RoyalBlue4 */ + {139, 69, 19, 6443}, /* saddle brown */ + {139, 69, 19, 6456}, /* SaddleBrown */ + {250, 128, 114, 6468}, /* salmon */ + {255, 140, 105, 6475}, /* salmon1 */ + {238, 130, 98, 6483}, /* salmon2 */ + {205, 112, 84, 6491}, /* salmon3 */ + {139, 76, 57, 6499}, /* salmon4 */ + {244, 164, 96, 6507}, /* sandy brown */ + {244, 164, 96, 6519}, /* SandyBrown */ + {46, 139, 87, 6530}, /* sea green */ + {46, 139, 87, 6540}, /* SeaGreen */ + {84, 255, 159, 6549}, /* SeaGreen1 */ + {78, 238, 148, 6559}, /* SeaGreen2 */ + {67, 205, 128, 6569}, /* SeaGreen3 */ + {46, 139, 87, 6579}, /* SeaGreen4 */ + {255, 245, 238, 6589}, /* seashell */ + {255, 245, 238, 6598}, /* seashell1 */ + {238, 229, 222, 6608}, /* seashell2 */ + {205, 197, 191, 6618}, /* seashell3 */ + {139, 134, 130, 6628}, /* seashell4 */ + {160, 82, 45, 6638}, /* sienna */ + {255, 130, 71, 6645}, /* sienna1 */ + {238, 121, 66, 6653}, /* sienna2 */ + {205, 104, 57, 6661}, /* sienna3 */ + {139, 71, 38, 6669}, /* sienna4 */ + {192, 192, 192, 6677}, /* silver */ + {135, 206, 235, 6684}, /* sky blue */ + {135, 206, 235, 6693}, /* SkyBlue */ + {135, 206, 255, 6701}, /* SkyBlue1 */ + {126, 192, 238, 6710}, /* SkyBlue2 */ + {108, 166, 205, 6719}, /* SkyBlue3 */ + {74, 112, 139, 6728}, /* SkyBlue4 */ + {106, 90, 205, 6737}, /* slate blue */ + {112, 128, 144, 6748}, /* slate gray */ + {112, 128, 144, 6759}, /* slate grey */ + {106, 90, 205, 6770}, /* SlateBlue */ + {131, 111, 255, 6780}, /* SlateBlue1 */ + {122, 103, 238, 6791}, /* SlateBlue2 */ + {105, 89, 205, 6802}, /* SlateBlue3 */ + {71, 60, 139, 6813}, /* SlateBlue4 */ + {112, 128, 144, 6824}, /* SlateGray */ + {198, 226, 255, 6834}, /* SlateGray1 */ + {185, 211, 238, 6845}, /* SlateGray2 */ + {159, 182, 205, 6856}, /* SlateGray3 */ + {108, 123, 139, 6867}, /* SlateGray4 */ + {112, 128, 144, 6878}, /* SlateGrey */ + {255, 250, 250, 6888}, /* snow */ + {255, 250, 250, 6893}, /* snow1 */ + {238, 233, 233, 6899}, /* snow2 */ + {205, 201, 201, 6905}, /* snow3 */ + {139, 137, 137, 6911}, /* snow4 */ + {0, 255, 127, 6917}, /* spring green */ + {0, 255, 127, 6930}, /* SpringGreen */ + {0, 255, 127, 6942}, /* SpringGreen1 */ + {0, 238, 118, 6955}, /* SpringGreen2 */ + {0, 205, 102, 6968}, /* SpringGreen3 */ + {0, 139, 69, 6981}, /* SpringGreen4 */ + {70, 130, 180, 6994}, /* steel blue */ + {70, 130, 180, 7005}, /* SteelBlue */ + {99, 184, 255, 7015}, /* SteelBlue1 */ + {92, 172, 238, 7026}, /* SteelBlue2 */ + {79, 148, 205, 7037}, /* SteelBlue3 */ + {54, 100, 139, 7048}, /* SteelBlue4 */ + {210, 180, 140, 7059}, /* tan */ + {255, 165, 79, 7063}, /* tan1 */ + {238, 154, 73, 7068}, /* tan2 */ + {205, 133, 63, 7073}, /* tan3 */ + {139, 90, 43, 7078}, /* tan4 */ + {0, 128, 128, 7083}, /* teal */ + {216, 191, 216, 7088}, /* thistle */ + {255, 225, 255, 7096}, /* thistle1 */ + {238, 210, 238, 7105}, /* thistle2 */ + {205, 181, 205, 7114}, /* thistle3 */ + {139, 123, 139, 7123}, /* thistle4 */ + {255, 99, 71, 7132}, /* tomato */ + {255, 99, 71, 7139}, /* tomato1 */ + {238, 92, 66, 7147}, /* tomato2 */ + {205, 79, 57, 7155}, /* tomato3 */ + {139, 54, 38, 7163}, /* tomato4 */ + {64, 224, 208, 7171}, /* turquoise */ + {0, 245, 255, 7181}, /* turquoise1 */ + {0, 229, 238, 7192}, /* turquoise2 */ + {0, 197, 205, 7203}, /* turquoise3 */ + {0, 134, 139, 7214}, /* turquoise4 */ + {238, 130, 238, 7225}, /* violet */ + {208, 32, 144, 7232}, /* violet red */ + {208, 32, 144, 7243}, /* VioletRed */ + {255, 62, 150, 7253}, /* VioletRed1 */ + {238, 58, 140, 7264}, /* VioletRed2 */ + {205, 50, 120, 7275}, /* VioletRed3 */ + {139, 34, 82, 7286}, /* VioletRed4 */ + {128, 128, 128, 7297}, /* web gray */ + {0, 128, 0, 7306}, /* web green */ + {128, 128, 128, 7316}, /* web grey */ + {128, 0, 0, 7325}, /* web maroon */ + {128, 0, 128, 7336}, /* web purple */ + {128, 128, 128, 7347}, /* WebGray */ + {0, 128, 0, 7355}, /* WebGreen */ + {128, 128, 128, 7364}, /* WebGrey */ + {128, 0, 0, 7372}, /* WebMaroon */ + {128, 0, 128, 7382}, /* WebPurple */ + {245, 222, 179, 7392}, /* wheat */ + {255, 231, 186, 7398}, /* wheat1 */ + {238, 216, 174, 7405}, /* wheat2 */ + {205, 186, 150, 7412}, /* wheat3 */ + {139, 126, 102, 7419}, /* wheat4 */ + {255, 255, 255, 7426}, /* white */ + {245, 245, 245, 7432}, /* white smoke */ + {245, 245, 245, 7444}, /* WhiteSmoke */ + {190, 190, 190, 7455}, /* x11 gray */ + {0, 255, 0, 7464}, /* x11 green */ + {190, 190, 190, 7474}, /* x11 grey */ + {176, 48, 96, 7483}, /* x11 maroon */ + {160, 32, 240, 7494}, /* x11 purple */ + {190, 190, 190, 7505}, /* X11Gray */ + {0, 255, 0, 7513}, /* X11Green */ + {190, 190, 190, 7522}, /* X11Grey */ + {176, 48, 96, 7530}, /* X11Maroon */ + {160, 32, 240, 7540}, /* X11Purple */ + {255, 255, 0, 7550}, /* yellow */ + {154, 205, 50, 7557}, /* yellow green */ + {255, 255, 0, 7570}, /* yellow1 */ + {238, 238, 0, 7578}, /* yellow2 */ + {205, 205, 0, 7586}, /* yellow3 */ + {139, 139, 0, 7594}, /* yellow4 */ + {154, 205, 50, 7602}, /* YellowGreen */ +}; + +#define NUM_BUILTIN_COLORS (sizeof (BuiltinColors) / sizeof (BuiltinColors[0])) Bool -OsInitColors(void) +OsLookupColor(int screen, + char *name, + unsigned int len, + unsigned short *pred, + unsigned short *pgreen, unsigned short *pblue) { - FILE *rgb; - char *path; - char line[BUFSIZ]; - char name[BUFSIZ]; - int red, green, blue, lineno = 0; - dbEntryPtr entry; - - static Bool was_here = FALSE; - - if (!was_here) - { -#ifdef NX_TRANS_SOCKET - /* - * Add the trailing '.txt' if a - * 'rgb' file is not found. - */ - - struct stat statbuf; - - path = (char*)ALLOCATE_LOCAL(strlen(_NXGetRgbPath(rgbPath)) + 5); - strcpy(path, _NXGetRgbPath(rgbPath)); - - if (stat(path, &statbuf) != 0) - { - strcat(path, ".txt"); - } -#else - path = (char*)ALLOCATE_LOCAL(strlen(rgbPath) +5); - strcpy(path, rgbPath); - strcat(path, ".txt"); -#endif - if (!(rgb = fopen(path, "r"))) - { -#ifdef NX_TRANS_SOCKET - ErrorF( "Couldn't open RGB_DB '%s'\n", _NXGetRgbPath(rgbPath)); -#else - ErrorF( "Couldn't open RGB_DB '%s'\n", rgbPath ); -#endif - DEALLOCATE_LOCAL(path); - return FALSE; - } - - while(fgets(line, sizeof(line), rgb)) - { - lineno++; - if (sscanf(line,"%d %d %d %[^\n]\n", &red, &green, &blue, name) == 4) - { - if (red >= 0 && red <= 0xff && - green >= 0 && green <= 0xff && - blue >= 0 && blue <= 0xff) - { - if ((entry = lookup(name, strlen(name), TRUE))) - { - entry->red = (red * 65535) / 255; - entry->green = (green * 65535) / 255; - entry->blue = (blue * 65535) / 255; - } - } - else - ErrorF("Value out of range: %s:%d\n", path, lineno); - } - else if (*line && *line != '#' && *line != '!') - ErrorF("Syntax Error: %s:%d\n", path, lineno); - } - - fclose(rgb); - DEALLOCATE_LOCAL(path); - - was_here = TRUE; - } - - return TRUE; -} - - - -Bool -OsLookupColor(int screen, char *name, unsigned int len, - unsigned short *pred, unsigned short *pgreen, unsigned short *pblue) -{ - dbEntryPtr entry; - - if ((entry = lookup(name, len, FALSE))) - { - *pred = entry->red; - *pgreen = entry->green; - *pblue = entry->blue; - return TRUE; + const BuiltinColor *c; + int low, mid, high; + int r; + + low = 0; + high = NUM_BUILTIN_COLORS - 1; + while (high >= low) { + mid = (low + high) / 2; + c = &BuiltinColors[mid]; + r = strncasecmp(&BuiltinColorNames[c->name], name, len); + if (r == 0 && len == strlen(&BuiltinColorNames[c->name])) { + *pred = c->red * 0x101; + *pgreen = c->green * 0x101; + *pblue = c->blue * 0x101; + return TRUE; + } + if (r < 0) + low = mid + 1; + else + high = mid - 1; } - - return FALSE; + return FALSE; } - -#endif /* USE_RGB_TXT */ diff --git a/nx-X11/programs/Xserver/os/osinit.c b/nx-X11/programs/Xserver/os/osinit.c index 59b567356..adafa3cf4 100644 --- a/nx-X11/programs/Xserver/os/osinit.c +++ b/nx-X11/programs/Xserver/os/osinit.c @@ -88,8 +88,6 @@ int limitStackSpace = -1; int limitNoFile = -1; #endif -Bool OsDelayInitColors = FALSE; - void OsInit(void) { @@ -218,7 +216,6 @@ OsInit(void) if (!SmartScheduleInit ()) SmartScheduleDisable = TRUE; OsInitAllocator(); - if (!OsDelayInitColors) OsInitColors(); } void diff --git a/nx-X11/programs/Xserver/os/utils.c b/nx-X11/programs/Xserver/os/utils.c index 204494d63..af793454f 100644 --- a/nx-X11/programs/Xserver/os/utils.c +++ b/nx-X11/programs/Xserver/os/utils.c @@ -565,7 +565,6 @@ void UseMsg(void) ErrorF("-c turns off key-click\n"); ErrorF("c # key-click volume (0-100)\n"); ErrorF("-cc int default color visual class\n"); - ErrorF("-co file color database file\n"); #ifdef COMMANDLINE_CHALLENGED_OPERATING_SYSTEMS ErrorF("-config file read options from file\n"); #endif @@ -771,13 +770,6 @@ ProcessCommandLine(int argc, char *argv[]) else UseMsg(); } - else if ( strcmp( argv[i], "-co") == 0) - { - if(++i < argc) - rgbPath = argv[i]; - else - UseMsg(); - } else if ( strcmp( argv[i], "-core") == 0) CoreDump = TRUE; else if ( strcmp( argv[i], "-dpi") == 0) -- cgit v1.2.3 From 2c9effed2113df2929fd0b85830030ce4bd64f87 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 20 Feb 2017 12:54:14 +0100 Subject: Mesa subtree: Add quilt based patch system for bundled Mesa. --- Makefile | 3 +++ mesa-quilt | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100755 mesa-quilt (limited to 'Makefile') diff --git a/Makefile b/Makefile index 4784f6d65..eb53f1ed2 100644 --- a/Makefile +++ b/Makefile @@ -36,6 +36,8 @@ SHELL:=/bin/bash # clean auto-generated nxversion.def file \ if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \ + ./mesa-quilt pop -a; \ + rm -Rf nx-X11/extras/Mesa/.pc/; \ rm -f nx-X11/config/cf/nxversion.def; \ rm -f bin/nxagent; \ rm -f bin/nxproxy; \ @@ -72,6 +74,7 @@ build-full: cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} + ./mesa-quilt push -a cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} diff --git a/mesa-quilt b/mesa-quilt new file mode 100755 index 000000000..1aaeae1e4 --- /dev/null +++ b/mesa-quilt @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright (C) 2017 by Mike Gabriel +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +d=. ; while [ ! -d "$d/nx-X11/extras" ] && [ "$(readlink -e "$d")" != "/" ]; do d="$d/.."; done +if [ -d "$d/nx-X11/extras" ] && [ -z "$QUILT_PATCHES" ]; then + # if in nx-libs tree with unset $QUILT_PATCHES + export QUILT_PATCHES="../Mesa.patches" + export QUILT_PATCH_OPTS="--reject-format=unified" + export QUILT_DIFF_ARGS="-p ab --no-timestamps --no-index --color=auto" + export QUILT_REFRESH_ARGS="-p ab --no-timestamps --no-index" + export QUILT_COLORS="diff_hdr=1;32:diff_add=1;34:diff_rem=1;31:diff_hunk=1;33:diff_ctx=35:diff_cctx=33" + if ! [ -d "$d/nx-X11/extras/Mesa.patches" ]; then mkdir "$d/nx-X11/extras/Mesa.patches"; fi + cd "$d/nx-X11/extras/Mesa/" +fi + +quilt "$@" + +cd - 1> /dev/null -- cgit v1.2.3 From 92979a4e860f7e52f82292469e10b411ebaca0ae Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 10 Apr 2017 10:08:14 +0000 Subject: Makefile: Tell Xserver build which Xfont API to use (v2 or v1) depending on what's available in the build env. --- Makefile | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index eb53f1ed2..f2bf63264 100644 --- a/Makefile +++ b/Makefile @@ -19,6 +19,10 @@ USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include CONFIGURE ?= ./configure +# use Xfont2 if available in the build env +FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") +XFONTLIB ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-lXfont2" || echo "-lXfont") + NX_VERSION_MAJOR=$(shell ./version.sh 1) NX_VERSION_MINOR=$(shell ./version.sh 2) NX_VERSION_MICRO=$(shell ./version.sh 3) @@ -75,7 +79,8 @@ build-full: cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} ./mesa-quilt push -a - cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) + + cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB) cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} -- cgit v1.2.3 From d63b4a5bafaabcb456f70aacda2c348d049d8ee8 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Mon, 10 Apr 2017 20:53:34 +0000 Subject: Regression fix for added libXfont2 API support: - Move FONT_DEFINES and XLIBFONT definition to from Server.tmpl to Imake.tmpl. - Add FONT_DEFINES to ALLDEFINES. - Drop SpecialCObjectRules with FONT_DEFINES from various Imakefiles again, FONT_DEFINES is now set "globally". - Hand over FONT_DEFINES from main Makefile to nx-X11's make BuildEnv to make gccmakedep happy. --- Makefile | 2 +- nx-X11/config/cf/Imake.tmpl | 11 ++++++++++- nx-X11/config/cf/Server.tmpl | 8 -------- nx-X11/programs/Xserver/Xext/Imakefile | 2 +- nx-X11/programs/Xserver/dix/Imakefile | 4 +--- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 5 ----- nx-X11/programs/Xserver/mi/Imakefile | 2 -- nx-X11/programs/Xserver/miext/damage/Imakefile | 2 -- nx-X11/programs/Xserver/os/Imakefile | 2 +- 9 files changed, 14 insertions(+), 24 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index f2bf63264..8ea31cd63 100644 --- a/Makefile +++ b/Makefile @@ -70,7 +70,7 @@ build-full: > nx-X11/config/cf/nxversion.def # prepare Makefiles and the nx-X11 symlinking magic - cd nx-X11 && make BuildEnv + cd nx-X11 && make BuildEnv FONT_DEFINES=$(FONT_DEFINES) # build libNX_X11 and libNX_Xext prior to building # nxcomp{ext,shad}. diff --git a/nx-X11/config/cf/Imake.tmpl b/nx-X11/config/cf/Imake.tmpl index 9ca1f16d7..9deeb302d 100644 --- a/nx-X11/config/cf/Imake.tmpl +++ b/nx-X11/config/cf/Imake.tmpl @@ -1878,6 +1878,15 @@ SETITIMER_DEFINES = HasSetitimerDefines POSTNOSTDLIB = #endif #endif + +#if HasXfont2 +FONT_DEFINES = -DHAS_XFONT2 + XFONTLIB = -lXfont2 +#else +FONT_DEFINES = + XFONTLIB = -lXfont +#endif + /* * Here we set up flags needed to produce position-independent code * when doing C and C++ compilation. The default if you specify C @@ -1976,7 +1985,7 @@ SETITIMER_DEFINES = HasSetitimerDefines * LOCAL_LDFLAGS contains client-specific ld flags flags set in Imakefile */ ALLINCLUDES = $(INCLUDES) $(EXTRA_INCLUDES) $(TOP_INCLUDES) $(INSTALLED_INCLUDES) $(STD_INCLUDES) - ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(SETITIMER_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) + ALLDEFINES = $(ALLINCLUDES) $(STD_DEFINES) $(SETITIMER_DEFINES) $(FONT_DEFINES) $(PROTO_DEFINES) $(THREADS_DEFINES) $(MODULE_DEFINES) $(DEFINES) $(EXTRA_DEFINES) CFLAGS = $(CDEBUGFLAGS) $(CCOPTIONS) $(THREADS_CFLAGS) $(MODULE_CFLAGS) $(ALLDEFINES) LINTFLAGS = $(LINTOPTS) -DLINT $(ALLDEFINES) $(DEPEND_DEFINES) LDPRELIB = LdPreLib $(INSTALLED_LIBS) diff --git a/nx-X11/config/cf/Server.tmpl b/nx-X11/config/cf/Server.tmpl index bae6f3b02..ffdca6811 100644 --- a/nx-X11/config/cf/Server.tmpl +++ b/nx-X11/config/cf/Server.tmpl @@ -70,11 +70,3 @@ GLX_DEFINES = GlxDefines #ifdef XorgVersion #include #endif - -#if HasXfont2 -FONT_DEFINES = -DHAS_XFONT2 - XFONTLIB = -lXfont2 -#else -FONT_DEFINES = - XFONTLIB = -lXfont -#endif diff --git a/nx-X11/programs/Xserver/Xext/Imakefile b/nx-X11/programs/Xserver/Xext/Imakefile index 44a0f068a..becc7b66e 100644 --- a/nx-X11/programs/Xserver/Xext/Imakefile +++ b/nx-X11/programs/Xserver/Xext/Imakefile @@ -119,7 +119,7 @@ LintLibraryTarget(ext,$(SRCS)) NormalLintTarget($(SRCS)) #if BuildXF86BigfontExt -SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES) $(FONT_DEFINES)) +SpecialCObjectRule(xf86bigfont,$(ICONFIGFILES),$(SHM_DEFINES)) #endif #if BuildXCSecurity SpecialCObjectRule(security,$(ICONFIGFILES),$(POLICYFILEDEF)) diff --git a/nx-X11/programs/Xserver/dix/Imakefile b/nx-X11/programs/Xserver/dix/Imakefile index 49722da00..1024de965 100644 --- a/nx-X11/programs/Xserver/dix/Imakefile +++ b/nx-X11/programs/Xserver/dix/Imakefile @@ -133,9 +133,7 @@ LintLibraryTarget(dix,$(SRCS) $(XPSRC)) NormalLintTarget($(SRCS) $(XPSRC)) SpecialCObjectRule(globals,$(ICONFIGFILES),$(SITE_DEFINES)) -SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES) $(FONT_DEFINES)) -SpecialCObjectRule(dispatch,$(ICONFIGFILES),$(FONT_DEFINES)) -SpecialCObjectRule(dixfonts,$(ICONFIGFILES),$(FONT_DEFINES)) +SpecialCObjectRule(main,$(ICONFIGFILES),$(VENDOR_DEFINES)) SpecialCObjectRule(pixmap,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(privates,$(ICONFIGFILES),$(_NOOP_)) SpecialCObjectRule(window,$(ICONFIGFILES),$(QUARTZ_DEFINES)) diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index e9175df72..a1b059cae 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -257,11 +257,6 @@ all:: $(OBJS) LinkSourceFile(stubs.c,$(SERVERSRC)/Xi) LinkSourceFile(xpstubs.c,$(SERVERSRC)/dix) -SpecialCObjectRule(Init,$(ICONFIGFILES),$(FONT_DEFINES)) -SpecialCObjectRule(Font,$(ICONFIGFILES),$(FONT_DEFINES)) -SpecialCObjectRule(NXdamage,$(ICONFIGFILES),$(FONT_DEFINES)) -SpecialCObjectRule(NXdispatch,$(ICONFIGFILES),$(FONT_DEFINES)) -SpecialCObjectRule(NXdixfonts,$(ICONFIGFILES),$(FONT_DEFINES)) LinkSourceFile(miinitext.c,$(SERVERSRC)/mi) SpecialCObjectRule(miinitext,$(ICONFIGFILES), $(_NOOP_)) diff --git a/nx-X11/programs/Xserver/mi/Imakefile b/nx-X11/programs/Xserver/mi/Imakefile index de7015c73..15e897e8b 100644 --- a/nx-X11/programs/Xserver/mi/Imakefile +++ b/nx-X11/programs/Xserver/mi/Imakefile @@ -179,8 +179,6 @@ NormalLibraryTarget(cbrt,cbrt.o) SpecialCObjectRule(miinitext,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(miscrinit,$(ICONFIGFILES),$(EXT_DEFINES)) -SpecialCObjectRule(miglblt,$(ICONFIGFILES),$(FONT_DEFINES)) -SpecialCObjectRule(mipolytext,$(ICONFIGFILES),$(FONT_DEFINES)) #ifdef ItsyCompilerBug SpecialCObjectRule(mipolycon,$(_NOOP_),-O0) diff --git a/nx-X11/programs/Xserver/miext/damage/Imakefile b/nx-X11/programs/Xserver/miext/damage/Imakefile index b06261b24..34d3fcf5a 100644 --- a/nx-X11/programs/Xserver/miext/damage/Imakefile +++ b/nx-X11/programs/Xserver/miext/damage/Imakefile @@ -22,8 +22,6 @@ NormalLibraryTarget(damage,$(OBJS)) LintLibraryTarget(damage,$(SRCS)) NormalLintTarget($(SRCS)) - -SpecialCObjectRule(damage,$(ICONFIGFILES),$(FONT_DEFINES)) #endif DependTarget() diff --git a/nx-X11/programs/Xserver/os/Imakefile b/nx-X11/programs/Xserver/os/Imakefile index b82da1baa..7932e32cd 100644 --- a/nx-X11/programs/Xserver/os/Imakefile +++ b/nx-X11/programs/Xserver/os/Imakefile @@ -248,7 +248,7 @@ SpecialCObjectRule(connection,$(ICONFIGFILES),$(SOCK_DEFINES) $(XDMCP_DEFINES)) SpecialCObjectRule(osinit,$(ICONFIGFILES),$(ADM_DEFINES)) SpecialCObjectRule(WaitFor,$(ICONFIGFILES),$(EXT_DEFINES)) SpecialCObjectRule(io,$(ICONFIGFILES),$(EXT_DEFINES)) -SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES) $(PAM_DEFINES) $(FONT_DEFINES)) +SpecialCObjectRule(utils,$(ICONFIGFILES),$(XDMCP_DEFINES) $(EXT_DEFINES) $(ERROR_DEFINES) $(PAM_DEFINES)) #if defined(SparcArchitecture) && HasGcc && !HasGcc2 oscolor.o: oscolor.c $(ICONFIGFILES) $(RM) $@ -- cgit v1.2.3 From fa3734ff40ae133e72d2c43ed889d4fc17dc867c Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 13 Apr 2017 15:58:14 +0200 Subject: Makefile: Fix comment above special clean rules. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8ea31cd63..49a15afa1 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,7 @@ SHELL:=/bin/bash if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ fi - # clean auto-generated nxversion.def file \ + # clean auto-generated files if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \ ./mesa-quilt pop -a; \ rm -Rf nx-X11/extras/Mesa/.pc/; \ -- cgit v1.2.3 From f843d1b14b29dfac4baa31da0a4b0c6ce0f32b04 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 13 Apr 2017 15:58:46 +0200 Subject: Makefile: Remove nx-X11/config/cf/date.def on clean. --- Makefile | 1 + 1 file changed, 1 insertion(+) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 49a15afa1..0a114b5c0 100644 --- a/Makefile +++ b/Makefile @@ -43,6 +43,7 @@ SHELL:=/bin/bash ./mesa-quilt pop -a; \ rm -Rf nx-X11/extras/Mesa/.pc/; \ rm -f nx-X11/config/cf/nxversion.def; \ + rm -f nx-X11/config/cf/date.def; \ rm -f bin/nxagent; \ rm -f bin/nxproxy; \ fi -- cgit v1.2.3 From 8a3605ffaa22d97325693229fdc36df18ece2360 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Thu, 13 Apr 2017 16:00:16 +0200 Subject: Makefile: Make sure that 'make all' only calls 'make build' and _not_ the global '%:' ruleset afterwards. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 0a114b5c0..dedbe21d8 100644 --- a/Makefile +++ b/Makefile @@ -48,7 +48,8 @@ SHELL:=/bin/bash rm -f bin/nxproxy; \ fi -all: build +all: + ${MAKE} build test: echo "No testing for NX (redistributed)" -- cgit v1.2.3 From f61956c1698560be5c492a4e5920b312e300d25a Mon Sep 17 00:00:00 2001 From: Salvador Fandiño Date: Wed, 31 May 2017 14:30:32 +0200 Subject: Propagate DESTDIR and PREFIX from Makefile When descending subdirectories and calling configure pass `--prefix=${DESTDIR}${PREFIX}`, so that installing in a custom directory works. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index dedbe21d8..7103efb34 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure +CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) # use Xfont2 if available in the build env FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") -- cgit v1.2.3 From 41ea54b0217175a4b78980671f4c6818eb66b166 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Wed, 26 Apr 2017 13:26:47 +0200 Subject: nxproxy: Switch to autoreconf. This also solves the last remnant of overlinking as described in GH issue #133. Fixes ArcticaProject/nx-libs#133. --- Makefile | 16 +--- debian/copyright | 11 ++- debian/rules | 3 +- nxproxy/.gitignore | 22 ++++- nxproxy/Main.c | 120 ------------------------ nxproxy/Makefile.am | 17 ++++ nxproxy/Makefile.in | 112 ----------------------- nxproxy/configure.ac | 32 +++++++ nxproxy/configure.in | 186 ------------------------------------- nxproxy/install-sh | 238 ------------------------------------------------ nxproxy/m4/nx-macros.m4 | 1 + nxproxy/man/Makefile.am | 5 + nxproxy/mkinstalldirs | 34 ------- nxproxy/src/Main.c | 120 ++++++++++++++++++++++++ nxproxy/src/Makefile.am | 17 ++++ 15 files changed, 226 insertions(+), 708 deletions(-) delete mode 100644 nxproxy/Main.c create mode 100644 nxproxy/Makefile.am delete mode 100644 nxproxy/Makefile.in create mode 100644 nxproxy/configure.ac delete mode 100644 nxproxy/configure.in delete mode 100755 nxproxy/install-sh create mode 120000 nxproxy/m4/nx-macros.m4 create mode 100644 nxproxy/man/Makefile.am delete mode 100755 nxproxy/mkinstalldirs create mode 100644 nxproxy/src/Main.c create mode 100644 nxproxy/src/Makefile.am (limited to 'Makefile') diff --git a/Makefile b/Makefile index 7103efb34..6fb11333c 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) +CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) --libexecdir=$(NXLIBDIR)/bin # use Xfont2 if available in the build env FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") @@ -56,7 +56,7 @@ test: build-lite: cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} - cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} build-full: # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... @@ -84,7 +84,7 @@ build-full: cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB) - cd nxproxy && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} build: if ! test -d nx-X11; then \ @@ -106,14 +106,8 @@ install-lite: sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxproxy.in > bin/nxproxy $(INSTALL_PROGRAM) bin/nxproxy $(DESTDIR)$(BINDIR) - # FIXME: the below install logic should work via nxproxy/Makefile.in - # overriding for now... - $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin - $(INSTALL_PROGRAM) nxproxy/nxproxy $(DESTDIR)$(NXLIBDIR)/bin - - $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ - $(INSTALL_FILE) nxproxy/man/nxproxy.1 $(DESTDIR)$(PREFIX)/share/man/man1/ - gzip $(DESTDIR)$(PREFIX)/share/man/man1/*.1 + # install the nxproxy executable and its man page + $(MAKE) -C nxproxy install install-full: # install nxagent wrapper script diff --git a/debian/copyright b/debian/copyright index cce8e17dd..b08ec0335 100644 --- a/debian/copyright +++ b/debian/copyright @@ -2756,7 +2756,7 @@ Files: nx-X11/programs/Xserver/os/xdmcp.c Copyright: 1989, Network Computing Devices, Inc., Mountain View, California License: MIT~VeryOldStyle~NCD -Files: nxproxy/Main.c +Files: nxproxy/src/Main.c Copyright: 2001, 2011, NoMachine, http://www.nomachine.com/. License: GPL-2 @@ -2912,10 +2912,13 @@ Files: ChangeLog nxcompshad/VERSION nxcompshad/configure.in nxcompshad/nxcompshad.pc.in - nxproxy/Makefile.in nxproxy/VERSION - nxproxy/configure.in nxproxy/man/nxproxy.1 + nxproxy/Makefile.am + nxproxy/configure.ac + nxproxy/m4/.placeholder + nxproxy/man/Makefile.am + nxproxy/src/Makefile.am Copyright: 2001, 2011, NoMachine (http://www.nomachine.com) 2008-2014, Oleksandr Shneyder 2011-2016, Mike Gabriel */ @@ -2944,13 +2947,11 @@ Comment: Contributions by Daniel Stone have been licensed under MIT~X11. Files: nxcomp/mkinstalldirs - nxproxy/mkinstalldirs Copyright: *No copyright* License: public-domain Files: nxcomp/install-sh nxcompshad/install-sh - nxproxy/install-sh Copyright: 1994, X Consortium License: Expat~NoAdvert Comment: diff --git a/debian/rules b/debian/rules index 707bdec54..1400c79bd 100755 --- a/debian/rules +++ b/debian/rules @@ -7,10 +7,11 @@ DPKG_EXPORT_BUILDFLAGS = 1 include /usr/share/dpkg/buildflags.mk export LIBDIR = "/usr/lib/$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)" +export LIBEXECDIR = "$(LIBDIR)/nx/bin" export INCLUDEDIR = "/usr/include/$(shell dpkg-architecture -qDEB_BUILD_MULTIARCH)" %: - CONFIGURE="./configure --with-symbols --prefix=/usr --libdir=$(LIBDIR) --includedir=$(INCLUDEDIR)" dh $@ --with quilt + CONFIGURE="./configure --with-symbols --prefix=/usr --libdir=$(LIBDIR) --includedir=$(INCLUDEDIR) --libexecdir=$(LIBEXECDIR)" dh $@ --with quilt override_dh_auto_clean: rm -Rf nx-X11/.build-exports diff --git a/nxproxy/.gitignore b/nxproxy/.gitignore index 3d98254b2..6b771262b 100644 --- a/nxproxy/.gitignore +++ b/nxproxy/.gitignore @@ -1,2 +1,22 @@ Makefile -nxproxy +Makefile.in +aclocal.m4 +compile +config.guess +config.sub +depcomp +install-sh +ltmain.sh +missing +config.h +config.h.in +libtool +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +src/.deps/ +src/Makefile +src/Makefile.in +stamp-h1 diff --git a/nxproxy/Main.c b/nxproxy/Main.c deleted file mode 100644 index d9fb1ef4f..000000000 --- a/nxproxy/Main.c +++ /dev/null @@ -1,120 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ -/* */ -/* NXPROXY, NX protocol compression and NX extensions to this software */ -/* are copyright of NoMachine. Redistribution and use of the present */ -/* software is allowed according to terms specified in the file LICENSE */ -/* which comes in the source distribution. */ -/* */ -/* Check http://www.nomachine.com/licensing.html for applicability. */ -/* */ -/* NX and NoMachine are trademarks of Medialogic S.p.A. */ -/* */ -/* All rigths reserved. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include -#include - -#include "NX.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -extern const char *__progname; - -/* - * Entry point when running nxproxy stand-alone. - */ - -int main(int argc, const char **argv) -{ - int result = -1; - - char *options = NULL; - - char *nx_commfd_str = NULL; - - options = getenv("NX_DISPLAY"); - - if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL) - { - errno = 0; - unsigned long int nx_commfd = strtoul(nx_commfd_str, NULL, 10); - - if ((errno) && (0 == nx_commfd)) - { - fprintf(stderr, "%s: NX_COMMFD environment variable's value [%s] is not a file descriptor number. " - "Aborting...\n", - __progname, nx_commfd_str - ); - NXTransCleanup(); - } - else if ((unsigned long int) INT_MAX < nx_commfd) - { - fprintf(stderr, "%s: NX_COMMFD environment variable's value [%lu] is out of range for a file descriptor number. " - "Aborting...\n", - __progname, nx_commfd); - NXTransCleanup(); - } - else { - result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options); - - if (result != 1) - { - fprintf(stderr, "%s: NXTransCreate failed for FD#%lu\n" - "Aborting...", - __progname, nx_commfd); - NXTransCleanup(); - } - - } - - // go into endless loop - - if (result == 1) - { - while (NXTransRunning(NX_FD_ANY)) - result = NXTransContinue(NULL); - } - } - else - { - - if (NXTransParseCommandLine(argc, argv) < 0) - { - NXTransCleanup(); - } - - if (NXTransParseEnvironment(options, 0) < 0) - { - NXTransCleanup(); - } - - /* - * This should not return... - */ - - #ifdef TEST - fprintf(stderr, "%s: Yielding control to NX entry point.\n", __progname); - #endif - - result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY); - } - - /* - * ...So these should not be called. - */ - - NXTransExit(result); - - return 0; -} diff --git a/nxproxy/Makefile.am b/nxproxy/Makefile.am new file mode 100644 index 000000000..87ca0cfad --- /dev/null +++ b/nxproxy/Makefile.am @@ -0,0 +1,17 @@ +SUBDIRS = src man + +MAINTAINERCLEANFILES = \ + $(srcdir)/autom4te.cache/* \ + $(srcdir)/build-aux/* \ + $(srcdir)/Makefile.in \ + $(srcdir)/man/Makefile.in \ + $(srcdir)/src/Makefile.in \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/config.h.in \ + $(srcdir)/config.h.in~ \ + $(srcdir)/config.guess \ + $(srcdir)/config.sub \ + $(srcdir)/configure \ + $(NULL) + +DISTCLEANFILES=$(MAINTAINERCLEANFILES) \ No newline at end of file diff --git a/nxproxy/Makefile.in b/nxproxy/Makefile.in deleted file mode 100644 index 3a27cbd29..000000000 --- a/nxproxy/Makefile.in +++ /dev/null @@ -1,112 +0,0 @@ -# -# Get values from configure script. -# -VERSION=@VERSION@ -LIBVERSION=@LIBVERSION@ - -# -# Enable really all warnings. This, though, gives -# a warning due to pthread.h and unistd.h. -# -# -Wredundant-decls -# -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -Wstrict-prototypes -Wmissing-prototypes \ - -Wmissing-declarations -Wnested-externs - -CXXINCLUDES = -I. -I../nxcomp - -CC = @CC@ -CCFLAGS = $(CXXFLAGS) -CCINCLUDES = -I. -I../nxcomp -CCDEFINES = - -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -# -# Only if THREADS is defined. -# -# LIBS = $(LIBS) -lpthread -# - -srcdir = @srcdir@ -prefix = @prefix@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -man1dir = @mandir@/man1 -VPATH = @srcdir@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -DESTDIR = -RM_FILE = rm -f - -# -# This should be autodetected. -# - -MAKEDEPEND = @MAKEDEPEND@ -DEPENDINCLUDES = -I/usr/include/g++ -I/usr/include/g++-3 - -.SUFFIXES: .cpp.c - -.cpp.o: - $(CXX) -c $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< -.c.o: - $(CC) -c $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< - -PROGRAM = nxproxy - -all: depend $(PROGRAM) - -MSRC = Main.c - -CSRC = - -CXXSRC = - -MOBJ = $(MSRC:.c=.o) -COBJ = $(CSRC:.c=.o) -CXXOBJ = $(CXXSRC:.cpp=.o) - -$(PROGRAM): $(MOBJ) $(COBJ) $(CXXOBJ) - $(CXX) $(CXXFLAGS) -o $@ $(MOBJ) $(LDFLAGS) $(LIBS) - -depends: depend.status - -depend: depend.status - -depend.status: - if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \ - $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \ - $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) $(CXXSRC) 2>/dev/null; \ - fi - touch depend.status - -install: install.bin install.man - -install.bin: $(PROGRAM) - $(srcdir)/mkinstalldirs $(DESTDIR)$(bindir) - $(INSTALL_PROGRAM) $(PROGRAM) $(DESTDIR)$(bindir)/$(PROGRAM) - -install.man: - $(srcdir)/mkinstalldirs $(DESTDIR)$(man1dir) - $(INSTALL_DATA) man/$(PROGRAM).1 $(DESTDIR)$(man1dir)/$(PROGRAM).1 - -uninstall: uninstall.bin uninstall.man - -uninstall.bin: - $(RM_FILE) $(DESTDIR)$(bindir)/$(PROGRAM) - -uninstall.man: - $(RM_FILE) $(DESTDIR)$(man1dir)/nxproxy.1 - -clean: - -rm -f *~ *.o *.bak st?????? core core.* *.out.* \ - $(PROGRAM) $(PROGRAM).exe $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE) - -distclean: clean - -rm -rf autom4te.cache config.status config.log config.cache depend.status Makefile tags configure diff --git a/nxproxy/configure.ac b/nxproxy/configure.ac new file mode 100644 index 000000000..b233ff8e3 --- /dev/null +++ b/nxproxy/configure.ac @@ -0,0 +1,32 @@ +dnl *************************************************************************** +dnl *** configure.ac for nxproxy *** +dnl *************************************************************************** + +m4_define([nxproxy_version], m4_esyscmd([tr -d '\n' < VERSION])) + +# Initialize Autoconf +AC_PREREQ(2.60) + +AC_INIT([NX Proxy], [nxproxy_version], [https://github.com/ArcticaProject/nx-libs/issues]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_PROG_CC +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz]) + +PROXY_VERSION=nxproxy_version +AC_SUBST([PROXY_VERSION]) + +NX_COMPILER_BRAND +AC_LANG([C]) +NX_COMPILER_FLAGS + +AC_CONFIG_FILES([ +Makefile +man/Makefile +src/Makefile +]) + +AC_OUTPUT diff --git a/nxproxy/configure.in b/nxproxy/configure.in deleted file mode 100644 index 12e2a08d2..000000000 --- a/nxproxy/configure.in +++ /dev/null @@ -1,186 +0,0 @@ -dnl Process this file with autoconf to produce a configure script. - -dnl Prolog - -AC_INIT(Main.c) -AC_PREREQ(2.13) - -dnl Reset default compilation flags. - -if test "x$CXXFLAGS" == "x"; then - CXXFLAGS="-O3" -fi -if test "x$CPPFLAGS" == "x"; then - CPPFLAGS="-O3" -fi - -dnl Prefer headers and libraries from nx-X11 if present. - -if test -d "../nx-X11/exports/include" ; then - CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include" - LIBS="$LIBS -L../nx-X11/exports/lib" -fi - -dnl Check whether --with-ipaq was given. - -if test "${with_ipaq}" = yes; then - echo -e "enabling ipaq configuration" - CXX="arm-linux-c++" - CC="arm-linux-gcc" - unset ac_cv_prog_armcxx - unset ac_cv_prog_armcc - unset ac_cv_prog_CXXCPP - AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH]) - AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH]) - if test $armcxx = "yes" && test $armcc = "yes" ; then - ac_cv_prog_CXX="$CXX" - ac_cv_prog_CC="$CC" - else - AC_MSG_ERROR(installation or configuration problem: I cannot find compiler for arm-linux) - fi -else - unset ac_cv_prog_CXX - unset ac_cv_prog_CC - unset ac_cv_prog_CXXCPP -fi - -dnl Check for programs. - -AC_PROG_CXX -AC_PROG_CC -AC_LANG_CPLUSPLUS - -dnl Check for BSD compatible install. - -AC_PROG_INSTALL - -dnl Check for extra header files. - -AC_PATH_XTRA - -dnl Custom addition. - -ac_help="$ac_help - --with-symbols give -g flag to compiler to produce debug symbols - --with-info define INFO at compile time to get basic log output - --with-valgrind clean up allocated buffers to avoid valgrind warnings - --with-version use this version for produced libraries" - -dnl Check to see if we're running under Cygwin32. - - -dnl Check to see if we're running under FreeBSD. -AC_DEFUN(nxconf_FreeBSD, -[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd, -[AC_TRY_COMPILE(,[return __FreeBSD__;], -nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) -rm -f conftest*]) -FreeBSD= -test "$nxconf_cv_freebsd" = yes && FreeBSD=yes]) -nxconf_FreeBSD - - -AC_DEFUN(nxconf_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes]) -nxconf_CYGWIN32 - -dnl Check for Darwin environment. - -AC_DEFUN(nxconf_DARWIN, -[AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin, -[AC_TRY_COMPILE(,[return __APPLE__;], -nxconf_cv_darwin=yes, nxconf_cv_darwin=no) -rm -f conftest*]) -DARWIN= -test "$nxconf_cv_darwin" = yes && DARWIN=yes]) -nxconf_DARWIN - -dnl Check to see if we're running under Solaris. - -AC_DEFUN(nxconf_SUN, -[AC_CACHE_CHECK(for SunOS environment, nxconf_cv_sun, -[AC_TRY_COMPILE(,[return __sun;], -nxconf_cv_sun=yes, nxconf_cv_sun=no) -rm -f conftest*]) -SUN= -test "$nxconf_cv_sun" = yes && SUN=yes]) -nxconf_SUN - -dnl Check whether --with-version was given. - -AC_SUBST(LIBVERSION) -AC_SUBST(VERSION) -if test "${with_version}" = yes; then - VERSION=${ac_option} -else - VERSION=`cat VERSION` -fi -echo -e "compiling version ${VERSION}" - -LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1` - -CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\"" -CPPFLAGS="$CPPFLAGS -DVERSION=\\\"${VERSION}\\\"" - -dnl Check whether --with-symbols or --without-symbols was -dnl given and set the required optimization level. - -if test "${with_symbols}" = yes; then - echo -e "enabling production of debug symbols" - CXXFLAGS="-g $CXXFLAGS" - CPPFLAGS="-g $CPPFLAGS" -else - echo -e "disabling production of debug symbols" -fi - -dnl Check whether --with-info or --without-info was given. - -if test "${with_info}" = yes; then - echo -e "enabling info output in the log file" - CXXFLAGS="$CXXFLAGS -DINFO" - CPPFLAGS="$CPPFLAGS -DINFO" -else - echo -e "disabling info output in the log file" -fi - -dnl Check whether --with-valgrind or --without-valgrind was given. - -if test "${with_valgrind}" = yes; then - echo -e "enabling valgrind memory checker workarounds" - CXXFLAGS="$CXXFLAGS -DVALGRIND" - CPPFLAGS="$CPPFLAGS -DVALGRIND" -else - echo -e "disabling valgrind memory checker workarounds" -fi - -dnl Cygwin requires that the stdc++ library is linked explicitly. -dnl GCC 3.3.x requires also the z, png and jpeg libraries. This is -dnl not true anymore since GCC 3.4.x. - -if test "$CYGWIN32" = yes; then - LIBS="$LIBS -L../nxcomp -lXcomp -lstdc++ -Wl,-e,_mainCRTStartup -ljpeg -lpng -lz" -else - LIBS="$LIBS -L../nxcomp -lXcomp" -fi - -dnl Find makedepend somewhere. - -AC_SUBST(MAKEDEPEND) -MAKEDEPEND="$(which makedepend)" - -# Try to desperately find makedepend. -# Set MAKEDEPEND to the shipped makedepend binary. This will not -# exist in nx-libs-lite, though, in which case MAKEDEPEND -# will stay empty. -if test -z "${MAKEDEPEND}"; then - if test -x "../nx-X11/config/makedepend/makedepend"; then - MAKEDEPEND="../nx-X11/config/makedepend/makedepend" - fi -fi - -AC_OUTPUT(Makefile) diff --git a/nxproxy/install-sh b/nxproxy/install-sh deleted file mode 100755 index 58719246f..000000000 --- a/nxproxy/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/nxproxy/m4/nx-macros.m4 b/nxproxy/m4/nx-macros.m4 new file mode 120000 index 000000000..813e9b041 --- /dev/null +++ b/nxproxy/m4/nx-macros.m4 @@ -0,0 +1 @@ +../../m4/nx-macros.m4 \ No newline at end of file diff --git a/nxproxy/man/Makefile.am b/nxproxy/man/Makefile.am new file mode 100644 index 000000000..8f9211c07 --- /dev/null +++ b/nxproxy/man/Makefile.am @@ -0,0 +1,5 @@ +NULL = + +dist_man_MANS = \ + nxproxy.1 \ + $(NULL) diff --git a/nxproxy/mkinstalldirs b/nxproxy/mkinstalldirs deleted file mode 100755 index 936cf3407..000000000 --- a/nxproxy/mkinstalldirs +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Last modified: 1995-03-05 -# Public domain - -errstatus=0 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? - fi - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus diff --git a/nxproxy/src/Main.c b/nxproxy/src/Main.c new file mode 100644 index 000000000..d9fb1ef4f --- /dev/null +++ b/nxproxy/src/Main.c @@ -0,0 +1,120 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine, http://www.nomachine.com/. */ +/* */ +/* NXPROXY, NX protocol compression and NX extensions to this software */ +/* are copyright of NoMachine. Redistribution and use of the present */ +/* software is allowed according to terms specified in the file LICENSE */ +/* which comes in the source distribution. */ +/* */ +/* Check http://www.nomachine.com/licensing.html for applicability. */ +/* */ +/* NX and NoMachine are trademarks of Medialogic S.p.A. */ +/* */ +/* All rigths reserved. */ +/* */ +/**************************************************************************/ + +#include +#include +#include +#include +#include +#include + +#include "NX.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +extern const char *__progname; + +/* + * Entry point when running nxproxy stand-alone. + */ + +int main(int argc, const char **argv) +{ + int result = -1; + + char *options = NULL; + + char *nx_commfd_str = NULL; + + options = getenv("NX_DISPLAY"); + + if ((nx_commfd_str = getenv("NX_COMMFD")) != NULL) + { + errno = 0; + unsigned long int nx_commfd = strtoul(nx_commfd_str, NULL, 10); + + if ((errno) && (0 == nx_commfd)) + { + fprintf(stderr, "%s: NX_COMMFD environment variable's value [%s] is not a file descriptor number. " + "Aborting...\n", + __progname, nx_commfd_str + ); + NXTransCleanup(); + } + else if ((unsigned long int) INT_MAX < nx_commfd) + { + fprintf(stderr, "%s: NX_COMMFD environment variable's value [%lu] is out of range for a file descriptor number. " + "Aborting...\n", + __progname, nx_commfd); + NXTransCleanup(); + } + else { + result = NXTransCreate(nx_commfd, NX_MODE_SERVER, options); + + if (result != 1) + { + fprintf(stderr, "%s: NXTransCreate failed for FD#%lu\n" + "Aborting...", + __progname, nx_commfd); + NXTransCleanup(); + } + + } + + // go into endless loop + + if (result == 1) + { + while (NXTransRunning(NX_FD_ANY)) + result = NXTransContinue(NULL); + } + } + else + { + + if (NXTransParseCommandLine(argc, argv) < 0) + { + NXTransCleanup(); + } + + if (NXTransParseEnvironment(options, 0) < 0) + { + NXTransCleanup(); + } + + /* + * This should not return... + */ + + #ifdef TEST + fprintf(stderr, "%s: Yielding control to NX entry point.\n", __progname); + #endif + + result = NXTransProxy(NX_FD_ANY, NX_MODE_ANY, NX_DISPLAY_ANY); + } + + /* + * ...So these should not be called. + */ + + NXTransExit(result); + + return 0; +} diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am new file mode 100644 index 000000000..5ec1f9401 --- /dev/null +++ b/nxproxy/src/Makefile.am @@ -0,0 +1,17 @@ +NULL = + +nxexecdir = $(libexecdir) + +nxexec_PROGRAMS = nxproxy + +nxproxy_SOURCES = \ + Main.c \ + $(NULL) + +nxproxy_LDADD = \ + -L$(top_srcdir)/../nxcomp/ -lXcomp \ + $(NULL) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/../nxcomp/ \ + $(NULL) -- cgit v1.2.3 From 76b48676844bc7aa0511b8371ef6347b2e8ad545 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 25 Apr 2017 15:27:17 +0200 Subject: nxcompshad: Switch to autoreconf. --- Makefile | 2 +- debian/copyright | 50 +- debian/libxcompshad-dev.install | 1 + debian/rules | 2 +- nx-X11/lib/X11/Imakefile | 2 +- nx-X11/programs/Xserver/Imakefile | 12 +- nxcompshad/.gitignore | 23 +- nxcompshad/Core.cpp | 622 --------- nxcompshad/Core.h | 212 --- nxcompshad/Input.cpp | 175 --- nxcompshad/Input.h | 99 -- nxcompshad/Logger.cpp | 124 -- nxcompshad/Logger.h | 167 --- nxcompshad/Makefile.am | 21 + nxcompshad/Makefile.in | 251 ---- nxcompshad/Manager.cpp | 260 ---- nxcompshad/Manager.h | 123 -- nxcompshad/Misc.h | 50 - nxcompshad/Poller.h | 39 - nxcompshad/Regions.h | 43 - nxcompshad/Shadow.cpp | 478 ------- nxcompshad/Shadow.h | 109 -- nxcompshad/Updater.cpp | 391 ------ nxcompshad/Updater.h | 103 -- nxcompshad/Win.cpp | 1145 ---------------- nxcompshad/Win.h | 232 ---- nxcompshad/X11.cpp | 1594 ---------------------- nxcompshad/X11.h | 139 -- nxcompshad/X11/include/XTest_nxcompshad.h | 71 - nxcompshad/X11/include/Xdamage_nxcompshad.h | 92 -- nxcompshad/X11/include/Xrandr_nxcompshad.h | 80 -- nxcompshad/configure.ac | 53 + nxcompshad/configure.in | 307 ----- nxcompshad/include/Shadow.h | 109 ++ nxcompshad/install-sh | 238 ---- nxcompshad/m4/nx-macros.m4 | 1 + nxcompshad/nxcompshad.pc.in | 2 +- nxcompshad/src/Core.cpp | 626 +++++++++ nxcompshad/src/Core.h | 212 +++ nxcompshad/src/Input.cpp | 179 +++ nxcompshad/src/Input.h | 99 ++ nxcompshad/src/Logger.cpp | 128 ++ nxcompshad/src/Logger.h | 167 +++ nxcompshad/src/Makefile.am | 45 + nxcompshad/src/Manager.cpp | 264 ++++ nxcompshad/src/Manager.h | 123 ++ nxcompshad/src/Misc.h | 50 + nxcompshad/src/Poller.h | 39 + nxcompshad/src/Regions.h | 43 + nxcompshad/src/Shadow.cpp | 482 +++++++ nxcompshad/src/Updater.cpp | 395 ++++++ nxcompshad/src/Updater.h | 103 ++ nxcompshad/src/Win.cpp | 1149 ++++++++++++++++ nxcompshad/src/Win.h | 232 ++++ nxcompshad/src/X11.cpp | 1598 +++++++++++++++++++++++ nxcompshad/src/X11.h | 139 ++ nxcompshad/src/X11/include/XTest_nxcompshad.h | 71 + nxcompshad/src/X11/include/Xdamage_nxcompshad.h | 92 ++ nxcompshad/src/X11/include/Xrandr_nxcompshad.h | 80 ++ 59 files changed, 6558 insertions(+), 7180 deletions(-) delete mode 100644 nxcompshad/Core.cpp delete mode 100644 nxcompshad/Core.h delete mode 100644 nxcompshad/Input.cpp delete mode 100644 nxcompshad/Input.h delete mode 100644 nxcompshad/Logger.cpp delete mode 100644 nxcompshad/Logger.h create mode 100644 nxcompshad/Makefile.am delete mode 100644 nxcompshad/Makefile.in delete mode 100644 nxcompshad/Manager.cpp delete mode 100644 nxcompshad/Manager.h delete mode 100644 nxcompshad/Misc.h delete mode 100644 nxcompshad/Poller.h delete mode 100644 nxcompshad/Regions.h delete mode 100644 nxcompshad/Shadow.cpp delete mode 100644 nxcompshad/Shadow.h delete mode 100644 nxcompshad/Updater.cpp delete mode 100644 nxcompshad/Updater.h delete mode 100644 nxcompshad/Win.cpp delete mode 100644 nxcompshad/Win.h delete mode 100644 nxcompshad/X11.cpp delete mode 100644 nxcompshad/X11.h delete mode 100644 nxcompshad/X11/include/XTest_nxcompshad.h delete mode 100644 nxcompshad/X11/include/Xdamage_nxcompshad.h delete mode 100644 nxcompshad/X11/include/Xrandr_nxcompshad.h create mode 100644 nxcompshad/configure.ac delete mode 100644 nxcompshad/configure.in create mode 100644 nxcompshad/include/Shadow.h delete mode 100755 nxcompshad/install-sh create mode 120000 nxcompshad/m4/nx-macros.m4 create mode 100644 nxcompshad/src/Core.cpp create mode 100644 nxcompshad/src/Core.h create mode 100644 nxcompshad/src/Input.cpp create mode 100644 nxcompshad/src/Input.h create mode 100644 nxcompshad/src/Logger.cpp create mode 100644 nxcompshad/src/Logger.h create mode 100644 nxcompshad/src/Makefile.am create mode 100644 nxcompshad/src/Manager.cpp create mode 100644 nxcompshad/src/Manager.h create mode 100644 nxcompshad/src/Misc.h create mode 100644 nxcompshad/src/Poller.h create mode 100644 nxcompshad/src/Regions.h create mode 100644 nxcompshad/src/Shadow.cpp create mode 100644 nxcompshad/src/Updater.cpp create mode 100644 nxcompshad/src/Updater.h create mode 100644 nxcompshad/src/Win.cpp create mode 100644 nxcompshad/src/Win.h create mode 100644 nxcompshad/src/X11.cpp create mode 100644 nxcompshad/src/X11.h create mode 100644 nxcompshad/src/X11/include/XTest_nxcompshad.h create mode 100644 nxcompshad/src/X11/include/Xdamage_nxcompshad.h create mode 100644 nxcompshad/src/X11/include/Xrandr_nxcompshad.h (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6fb11333c..d38015a00 100644 --- a/Makefile +++ b/Makefile @@ -78,7 +78,7 @@ build-full: # nxcomp{ext,shad}. cd nx-X11/lib && make - cd nxcompshad && autoconf && (${CONFIGURE}) && ${MAKE} + cd nxcompshad && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} ./mesa-quilt push -a diff --git a/debian/copyright b/debian/copyright index b08ec0335..d9ef896b0 100644 --- a/debian/copyright +++ b/debian/copyright @@ -80,25 +80,25 @@ Files: nx-X11/extras/Mesa/src/mesa/main/WSDrawBuffer.h nx-X11/programs/Xserver/hw/nxagent/compext/Rle.h nx-X11/programs/Xserver/hw/nxagent/compext/Z.c nx-X11/programs/Xserver/hw/nxagent/compext/Z.h - nxcompshad/Core.cpp - nxcompshad/Core.h - nxcompshad/Input.cpp - nxcompshad/Input.h - nxcompshad/Logger.cpp - nxcompshad/Logger.h - nxcompshad/Manager.cpp - nxcompshad/Manager.h - nxcompshad/Misc.h - nxcompshad/Poller.h - nxcompshad/Regions.h - nxcompshad/Shadow.cpp - nxcompshad/Shadow.h - nxcompshad/Updater.cpp - nxcompshad/Updater.h - nxcompshad/Win.cpp - nxcompshad/Win.h - nxcompshad/X11.cpp - nxcompshad/X11.h + nxcompshad/include/Shadow.h + nxcompshad/src/Core.cpp + nxcompshad/src/Core.h + nxcompshad/src/Input.cpp + nxcompshad/src/Input.h + nxcompshad/src/Logger.cpp + nxcompshad/src/Logger.h + nxcompshad/src/Manager.cpp + nxcompshad/src/Manager.h + nxcompshad/src/Misc.h + nxcompshad/src/Poller.h + nxcompshad/src/Regions.h + nxcompshad/src/Shadow.cpp + nxcompshad/src/Updater.cpp + nxcompshad/src/Updater.h + nxcompshad/src/Win.cpp + nxcompshad/src/Win.h + nxcompshad/src/X11.cpp + nxcompshad/src/X11.h Copyright: 2001, 2011, NoMachine (http://www.nomachine.com) 2008-2014, Oleksandr Shneyder 2011-2016, Mike Gabriel */ @@ -1001,7 +1001,7 @@ Files: nx-X11/include/XWDFile.h nx-X11/programs/Xserver/record/record.c nx-X11/programs/Xserver/record/set.c nx-X11/programs/Xserver/record/set.h - nxcompshad/X11/include/XTest_nxcompshad.h + nxcompshad/src/X11/include/XTest_nxcompshad.h Copyright: 1985, 1987, 1990, 1998, The Open Group 1985, 1987, 1994, 1998, The Open Group 1985, 1987, 1998, The Open Group @@ -1452,7 +1452,7 @@ Files: nx-X11/include/extensions/composite.h nx-X11/programs/Xserver/xfixes/xfixes.h nx-X11/programs/Xserver/xfixes/xfixesint.h nx-X11/programs/Xserver/Xext/shmint.h - nxcompshad/X11/include/Xdamage_nxcompshad.h + nxcompshad/src/X11/include/Xdamage_nxcompshad.h Copyright: 1998, Keith Packard 1999, Keith Packard 2002, Keith Packard @@ -2310,7 +2310,7 @@ Copyright: 2000, Compaq Computer Corporation License: MIT~X11 Files: nx-X11/programs/Xserver/hw/nxagent/X11/include/Xrandr_nxagent.h - nxcompshad/X11/include/Xrandr_nxcompshad.h + nxcompshad/src/X11/include/Xrandr_nxcompshad.h Copyright: 2000, Compaq Computer Corporation, Inc 2002, Hewlett-Packard Company, Inc 2006, Intel Corporation @@ -2908,10 +2908,11 @@ Files: ChangeLog nxcomp/VERSION nxcomp/configure.in nxcomp/nxcomp.pc.in - nxcompshad/Makefile.in + nxcompshad/Makefile.am nxcompshad/VERSION - nxcompshad/configure.in + nxcompshad/configure.ac nxcompshad/nxcompshad.pc.in + nxcompshad/src/Makefile.am nxproxy/VERSION nxproxy/man/nxproxy.1 nxproxy/Makefile.am @@ -2951,7 +2952,6 @@ Copyright: *No copyright* License: public-domain Files: nxcomp/install-sh - nxcompshad/install-sh Copyright: 1994, X Consortium License: Expat~NoAdvert Comment: diff --git a/debian/libxcompshad-dev.install b/debian/libxcompshad-dev.install index 2010f5950..68318ee03 100644 --- a/debian/libxcompshad-dev.install +++ b/debian/libxcompshad-dev.install @@ -1,3 +1,4 @@ usr/lib/*/libXcompshad.so +usr/lib/*/libXcompshad.a usr/include/*/nx/Shadow.h usr/lib/*/pkgconfig/nxcompshad.pc diff --git a/debian/rules b/debian/rules index adfc34e5e..b59ba83a5 100755 --- a/debian/rules +++ b/debian/rules @@ -25,7 +25,7 @@ override_dh_install: # remove static libs rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcomp.a - rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.a + rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.la # remove extras, GL, and other unneeded headers rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/GL/ diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile index 055cbec33..5b289fae8 100644 --- a/nx-X11/lib/X11/Imakefile +++ b/nx-X11/lib/X11/Imakefile @@ -87,7 +87,7 @@ NX_XCOMPLIBTARGET = $(NX_XCOMPLIBDIR)/$(NX_XCOMPLIBNAME) NX_REQUIREDLIBS = -L$(NX_XCOMPLIBDIR) -l$(NX_XCOMPLIBLINK) NX_XCOMPCONFIGTARGET = $(NX_XCOMPLIBDIR)/config.status -NX_XCOMPEXTLIBDIR = $(XTOP)/../nxcompext +NX_XCOMPEXTLIBDIR = $(XTOP)/../nxcompext/src/.libs NX_XCOMPEXTLIBTARGET = $(NX_XCOMPEXTLIBDIR)/$(NX_XCOMPEXTLIBNAME) NX_XCOMPEXTCONFIGTARGET = $(NX_XCOMPEXTLIBDIR)/config.status diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index c5bbbeb75..ed49313ee 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -221,8 +221,8 @@ NX_XCOMP_HEADERS = \ ../../../nxcomp/NXvars.h \ $(NULL) -NX_XCOMPSHAD_HEADERS = \ - ../../../nxcompshad/Shadow.h \ +NX_XCOMPSHAD_HEADERS = \ + ../../../nxcompshad/include/Shadow.h \ $(NULL) NX_HEADERS = \ @@ -316,7 +316,7 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) #if defined(SunArchitecture) NXAGENTNXLIBS = -L/usr/sfw/lib \ -L../../../nxcomp \ - -L../../../nxcompshad \ + -L../../../nxcompshad/src/.libs \ -lrt \ -lXcomp \ -lXcompshad \ @@ -331,7 +331,7 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \ $(NULL) #elif defined(cygwinArchitecture) NXAGENTNXLIBS = -L../../../nxcomp \ - -L../../../nxcompshad \ + -L../../../nxcompshad/src/.libs \ -lXcomp \ -lXcompshad \ -lXrender \ @@ -345,7 +345,7 @@ NXAGENTNXLIBS = -L../../../nxcomp \ #elif defined(OpenBSDArchitecture) NXAGENTNXLIBS = -L../../../nxcomp \ -L../../../nx-X11/exports/lib \ - -L../../../nxcompshad \ + -L../../../nxcompshad/src/.libs \ -lkvm \ -lXcomp \ -lXcompshad \ @@ -360,7 +360,7 @@ NXAGENTNXLIBS = -L../../../nxcomp \ $(NULL) #else NXAGENTNXLIBS = -L../../../nxcomp \ - -L../../../nxcompshad \ + -L../../../nxcompshad/src/.libs \ -lXcomp \ -lXcompshad \ -lXrender \ diff --git a/nxcompshad/.gitignore b/nxcompshad/.gitignore index f083c6b27..1eefcb7bf 100644 --- a/nxcompshad/.gitignore +++ b/nxcompshad/.gitignore @@ -1,2 +1,23 @@ -nxcompshad.pc Makefile +Makefile.in +aclocal.m4 +build-aux/compile +build-aux/config.guess +build-aux/config.sub +build-aux/depcomp +build-aux/install-sh +build-aux/ltmain.sh +build-aux/missing +config.h +config.h.in +libtool +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +nxcompshad.pc +src/.deps/ +src/Makefile +src/Makefile.in +stamp-h1 diff --git a/nxcompshad/Core.cpp b/nxcompshad/Core.cpp deleted file mode 100644 index 1682d343f..000000000 --- a/nxcompshad/Core.cpp +++ /dev/null @@ -1,622 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include "Core.h" -#include "Logger.h" - -const int CorePoller::maxSliceHeight_ = 20; -const int CorePoller::minSliceHeight_ = 3; - -const char CorePoller::interlace_[] = -{ - 0, 16, - 8, 24, - 4, 20, 12, 28, - 2, 18, 10, 26, 6, 22, 14, 30, - 1, 17, - 9, 25, - 5, 21, 13, 29, - 3, 19, 11, 27, 7, 23, 15, 31 -}; - -CorePoller::CorePoller(Input *input, Display *display) : input_(input) -{ - logTrace("CorePoller::CorePoller"); - - buffer_ = NULL; - lastUpdatedRegion_ = NULL; - lineStatus_ = NULL; - linePriority_ = NULL; - lefts_ = NULL; - rights_ = NULL; -} - -CorePoller::~CorePoller() -{ - logTrace("CorePoller::~CorePoller"); - - if (buffer_ != NULL) - { - delete [] buffer_; - - buffer_ = NULL; - } - - if (lastUpdatedRegion_ != NULL) - { - XDestroyRegion(lastUpdatedRegion_); - - lastUpdatedRegion_ = NULL; - } - - if (lineStatus_ != NULL) - { - delete [] lineStatus_; - - lineStatus_ = NULL; - } - - if (linePriority_ != NULL) - { - delete [] linePriority_; - - linePriority_ = NULL; - } - - if (lefts_ != NULL) - { - delete [] lefts_; - - lefts_ = NULL; - } - - if (rights_ != NULL) - { - delete [] rights_; - - rights_ = NULL; - } -} - -int CorePoller::init() -{ - logTrace("CorePoller::init"); - - createFrameBuffer(); - - if (buffer_ == NULL) - { - logError("CorePoller::init", ESET(ENOMEM)); - - return -1; - } - - logTest("CorePoller::init", "Allocated frame buffer at [%p] for [%d] bytes.", - buffer_, bpl_ * height_); - - if (lastUpdatedRegion_ != NULL) - { - XDestroyRegion(lastUpdatedRegion_); - - lastUpdatedRegion_ = NULL; - } - - lastUpdatedRegion_ = XCreateRegion(); - - if (lineStatus_ != NULL) - { - delete[] lineStatus_; - } - - lineStatus_ = new LineStatus[height_ + 1]; - - if (lineStatus_ == NULL) - { - logError("CorePoller::init", ESET(ENOMEM)); - - return -1; - } - - // - // We need this boundary element to - // speed up the algo. - // - - if (linePriority_ != NULL) - { - delete[] linePriority_; - } - - linePriority_ = new int [height_ + 1]; - - if (linePriority_ == NULL) - { - logError("CorePoller::init", ESET(ENOMEM)); - - return -1; - } - - for (unsigned int i = 0; i < height_; i++) - { - linePriority_[i] = HIGHEST_PRIORITY; - } - - if (lefts_ != NULL) - { - delete[] lefts_; - } - - lefts_ = new int [height_]; - - if (rights_ != NULL) - { - delete[] rights_; - } - - rights_ = new int [height_]; - - for (unsigned int i = 0; i < height_; i++) - { - rights_[i] = lefts_[i] = 0; - } - - return 1; -} - -int CorePoller::isChanged(int (*checkIfInputCallback)(void *), void *arg, int *suspended) -{ - logTrace("CorePoller::isChanged"); - -#if defined(__CYGWIN32__) || defined(WIN32) - - checkDesktop(); - -#endif - -#if !defined(__CYGWIN32__) && !defined(WIN32) - - if (mirror_ == 1) - { - int result = mirrorChanges_; - - mirrorChanges_ = 0; - - return result; - } - -#endif - - logDebug("CorePoller:isChanged", "Going to use default polling algorithm.\n"); - - // - // In order to allow this function to - // be suspended and resumed later, we - // need to save these two status vars. - // - - static int idxIlace = 0; - static int curLine = 0; - - - const long timeout = 50; - long oldTime; - long newTime; - struct timeval ts; - - gettimeofday(&ts, NULL); - - oldTime = ts.tv_sec * 1000 + ts.tv_usec / 1000; - - if (curLine == 0) // && idxIlace == 0 ? - { - for (unsigned int i = 0; i < height_; i++) - { - lineStatus_[i] = LINE_NOT_CHECKED; - } - } - - int foundChanges = 0; - - foundChanges = 0; - - int curIlace = interlace_[idxIlace]; - - bool moveBackward = false; - - logDebug("CorePoller::isChanged", "Interlace index [%d] interlace [%d].", idxIlace, curIlace); - - for (; curLine < (int) height_; curLine++) - { - logDebug("CorePoller::isChanged", "Analizing line [%d] move backward [%d] status [%d] priority [%d].", - curLine, moveBackward, lineStatus_[curIlace], linePriority_[curLine]); - - // - // Ask the caller if the polling have to be suspended. - // - - if ((*checkIfInputCallback)(arg) == 1) - { - *suspended = 1; - - break; - } - - // - // Suspend if too much time is elapsed. - // - - gettimeofday(&ts, NULL); - - newTime = ts.tv_sec * 1000 + ts.tv_usec / 1000; - - if (newTime - oldTime >= timeout) - { - *suspended = 1; - - break; - } - - oldTime = newTime; - - if (lineStatus_[curLine] != LINE_NOT_CHECKED) - { - continue; - } - - if (moveBackward) - { - moveBackward = false; - } - else - { - switch (linePriority_[curLine]) - { - case 1: - case 29: - { - // - // It was a priority, - // but now it may not be. - // - } - case 31: - { - // - // Not a priority, still isn't. - // - - linePriority_[curLine] = NOT_PRIORITY; - - break; - } - case 0: - { - // - // Make it a priority. - // - - linePriority_[curLine] = PRIORITY; - - break; - } - default: - { - linePriority_[curLine]--; - - break; - } - } - - if ((linePriority_[curLine] > PRIORITY) && ((curLine & 31) != curIlace)) - { - continue; - } - } - - XRectangle rect = {0, curLine, width_, 1}; - - char *buffer; - - logDebug("CorePoller::isChanged", "Checking line [%d].", curLine); - - if ((buffer = getRect(rect)) == NULL) - { - logDebug("CorePoller::isChanged", "Failed to retrieve line [%d].", curLine); - - return -1; - } - - if (memcmp(buffer, buffer_ + curLine * bpl_, bpl_) == 0 || differ(buffer, rect) == 0) - { - logDebug("CorePoller::isChanged", "Data buffer didn't change."); - - lineStatus_[curLine] = LINE_NOT_CHANGED; - - continue; - } - - rect.x = lefts_[rect.y]; - rect.width = rights_[rect.y] - lefts_[rect.y] + 1; - - update(buffer + rect.x * bpp_, rect); - - foundChanges = 1; - - lineStatus_[curLine] = LINE_HAS_CHANGED; - - // - // Wake up the next line. - // - - if (linePriority_[curLine + 1] > PRIORITY) - { - linePriority_[curLine + 1] = HIGHEST_PRIORITY; - } - - // - // Give this line priority. - // - - linePriority_[curLine] = HIGHEST_PRIORITY; - - // - // Wake up previous line. - // - - if (curLine > 0 && lineStatus_[curLine - 1] == LINE_NOT_CHECKED) - { - moveBackward = true; - curLine -= 2; - } - } - - // - // Execution reached the end of loop. - // - - if (curLine == (int) height_) - { - idxIlace = (idxIlace + 1) % 32; - - curLine = 0; - } - - // - // Create the region of changed pixels. - // - - if (foundChanges) - { - int start, last, curLine, left, right; - - for (curLine = 0; curLine < (int) height_; curLine++) - { - if (lineStatus_[curLine] == LINE_HAS_CHANGED) - { - break; - } - } - - start = curLine; - last = curLine; - - left = lefts_[curLine]; - right = rights_[curLine]; - curLine++; - - while (1) - { - for (; curLine < (int) height_; curLine++) - { - if (lineStatus_[curLine] == LINE_HAS_CHANGED) - { - break; - } - } - - if (curLine == (int) height_) - { - break; - } - - if ((curLine - last > minSliceHeight_) || (last - start > maxSliceHeight_)) - { - XRectangle rect = {left, start, right - left + 1, last - start + 1}; - - XUnionRectWithRegion(&rect, lastUpdatedRegion_, lastUpdatedRegion_); - - start = curLine; - left = lefts_[curLine]; - right = rights_[curLine]; - } - else - { - if (lefts_[curLine] < left) - { - left = lefts_[curLine]; - } - - if (rights_[curLine] > right) - { - right = rights_[curLine]; - } - } - - last = curLine; - - curLine++; - } - - // - // Send last block. - // - - if (last >= start) - { - XRectangle rect = {left, start, right - left + 1, last - start + 1}; - - XUnionRectWithRegion(&rect, lastUpdatedRegion_, lastUpdatedRegion_); - } - } - - return foundChanges; -} - -int CorePoller::differ(char *buffer, XRectangle r) -{ - logTrace("CorePoller::differ"); - - int bpl = bpp_ * r.width; - int i; - char *pBuf; - char *pFb; - - pBuf = (buffer); - pFb = (buffer_ + r.x + r.y * bpl_); - - for (i = 0; i < bpl; i++) - { - if (*pFb++ != *pBuf++) - { - lefts_[r.y] = i / bpp_; - - break; - } - } - - if (i == bpl) - { - return 0; - } - - pBuf = (buffer) + bpl - 1; - pFb = (buffer_ + r.x + r.y * bpl_) + bpl - 1; - - int j = i - 1; - - for (i = bpl - 1; i > j; i--) - { - if (*pFb-- != *pBuf--) - { - rights_[r.y] = i / bpp_; - - break; - } - } - - return 1; -} - -void CorePoller::update(char *src, XRectangle r) -{ - logTrace("CorePoller::update"); - - char *dst = buffer_ + r.x * bpp_ + r.y * bpl_; - int bpl = bpp_ * r.width; - - for (unsigned int i = 0; i < r.height; i++) - { - if(((r.x * bpp_ + r.y * bpl_) + bpl) > (bpl_ * height_)) - { - // - // Out of bounds. Maybe a resize is going on. - // - - continue; - } - - memcpy(dst, src, bpl); - - src += bpl; - - dst += bpl_; - } -} - -void CorePoller::handleEvent(Display *display, XEvent *event) -{ - logTrace("CorePoller::handleEvent"); - - switch (event -> type) - { - case KeyPress: - case KeyRelease: - { - handleKeyboardEvent(display, event); - break; - } - case ButtonPress: - case ButtonRelease: - case MotionNotify: - { - handleMouseEvent(display, event); - break; - } - default: - { - logTest("CorePoller::handleEvent", "Handling unexpected event [%d] from display [%p].", - event -> type, display); - break; - } - } -} - -void CorePoller::handleWebKeyEvent(KeySym keysym, Bool isKeyPress) -{ - logTrace("CorePoller::handleWebKeyEvent"); - - handleWebKeyboardEvent(keysym, isKeyPress); -} - -void CorePoller::handleInput() -{ - while (input_ -> checkIfEvent()) - { - Display *display = input_ -> currentDisplay(); - XEvent *event = input_ -> popEvent(); - - handleEvent(display, event); - - delete event; - } -} - -void CorePoller::createFrameBuffer() -{ - logTrace("CorePoller::createFrameBuffer"); - - if (buffer_ == NULL) - { - buffer_ = new char[bpl_ * height_]; - } -} diff --git a/nxcompshad/Core.h b/nxcompshad/Core.h deleted file mode 100644 index 91f3f1e22..000000000 --- a/nxcompshad/Core.h +++ /dev/null @@ -1,212 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef CorePoller_H -#define CorePoller_H - -#include - -#include "Logger.h" -#include "Regions.h" -#include "Input.h" - -typedef enum{ - LINE_HAS_CHANGED, - LINE_NOT_CHECKED, - LINE_NOT_CHANGED -} LineStatus; - -typedef enum{ - HIGHEST_PRIORITY = 0, - PRIORITY = 30, - NOT_PRIORITY = 90 -} LinePriority; - -class CorePoller -{ - public: - - CorePoller(Input*, Display*); - - virtual ~CorePoller(); - - virtual int init(); - - unsigned int width() const; - - unsigned int height() const; - - unsigned char depth() const; - - int isChanged(int (*)(void*), void *, int *); - - char *getFrameBuffer() const; - - void destroyFrameBuffer(); - - void createFrameBuffer(); - - Region lastUpdatedRegion(); - - Region getLastUpdatedRegion(); - - void handleInput(); - - void handleEvent(Display *, XEvent *); - - void handleWebKeyEvent(KeySym keysym, Bool isKeyPress); - - Display *getShadowDisplay(); - - void setShadowDisplay(Display *shadowDisplay); - - protected: - - unsigned int bpp_; - - unsigned int bpl_; - - unsigned int width_; - - unsigned int height_; - - int depth_; - - char *buffer_; - - unsigned long redMask_; - unsigned long greenMask_; - unsigned long blueMask_; - unsigned long colorMask_[3]; - - char mirror_; - - char mirrorChanges_; - - virtual int updateShadowFrameBuffer(void) = 0; - - virtual char *getRect(XRectangle r) = 0; - - int imageByteOrder_; - - #ifdef __CYGWIN32__ - virtual char checkDesktop(void) = 0; - #endif - - Display *shadowDisplay_; - - void update(char *src, XRectangle r); - - Region lastUpdatedRegion_; - - private: - - virtual void handleKeyboardEvent(Display *, XEvent *) = 0; - - virtual void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) = 0; - - virtual void handleMouseEvent(Display *, XEvent *) = 0; - - Input *input_; - - static const int maxSliceHeight_; - static const int minSliceHeight_; - - LineStatus *lineStatus_; - int *linePriority_; - - static const char interlace_[]; - - int *lefts_; - int *rights_; - - // FIXME: Make them friend. - - int differ(char *src, XRectangle r); -}; - -inline unsigned int CorePoller::width() const -{ - return width_; -} - -inline unsigned int CorePoller::height() const -{ - return height_; -} - -inline unsigned char CorePoller::depth() const -{ - return depth_; -} - -inline char *CorePoller::getFrameBuffer() const -{ - return buffer_; -} - -inline void CorePoller::destroyFrameBuffer() -{ - if (buffer_ != NULL) - { - delete[] buffer_; - buffer_ = NULL; - } -} - -inline Region CorePoller::lastUpdatedRegion() -{ - Region region = lastUpdatedRegion_; - - lastUpdatedRegion_ = XCreateRegion(); - - if (lastUpdatedRegion_ == NULL) - { - logError("CorePoller::lastUpdatedRegion", ESET(ENOMEM)); - - lastUpdatedRegion_ = region; - - return NULL; - } - - return region; -} - -inline Region CorePoller::getLastUpdatedRegion() -{ - return lastUpdatedRegion_; -} - -inline Display *CorePoller::getShadowDisplay() -{ - return shadowDisplay_ ; -} - -inline void CorePoller::setShadowDisplay(Display *shadowDisplay) -{ - shadowDisplay_ = shadowDisplay; -} - -#endif /* CorePoller_H */ diff --git a/nxcompshad/Input.cpp b/nxcompshad/Input.cpp deleted file mode 100644 index a79b30459..000000000 --- a/nxcompshad/Input.cpp +++ /dev/null @@ -1,175 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include "Input.h" -#include "Logger.h" - -Input::Input() -{ - logTrace("Input::Input"); - - eventsHead_ = NULL; - eventsTail_ = NULL; - keymap_ = NULL; -} - -Input::~Input() -{ - logTrace("Input::~Input"); - - Event *head = eventsHead_; - - while (head) - { - Event *next = head -> next; - - delete head -> event; - delete head; - - head = next; - } - - if (keymap_ != NULL) - { - logDebug("Input::~Input", "Delete keymap_ [%p].", keymap_); - - delete [] keymap_; - } -} - -void Input::pushEvent(Display *display, XEvent *event) -{ - Event *tail = new Event; - - if (tail == NULL) - { - logError("Input::pushEvent", ESET(ENOMEM)); - - return; - } - - tail -> next = NULL; - tail -> display = display; - tail -> event = event; - - if (eventsHead_ == NULL) - { - eventsHead_ = tail; - } - else - { - eventsTail_ -> next = tail; - } - - eventsTail_ = tail; -} - -XEvent *Input::popEvent() -{ - Event *head = eventsHead_; - - if (head == NULL) - { - return 0; - } - - XEvent *event = head -> event; - - eventsHead_ = head -> next; - - delete head; - - if (eventsHead_ == NULL) - { - eventsTail_ = NULL; - } - - return event; -} - -int Input::removeAllEvents(Display *display) -{ - logTrace("Input::removeAllEvents"); - - int nRemoved = 0; - - Event *current = eventsHead_; - - while (current) - { - if (display == current -> display) - { - // - // Update head of list. - // - - if (current == eventsHead_) - { - eventsHead_ = current -> next; - } - - // - // Update tail of list. - // - - if (current == eventsTail_) - { - eventsTail_ = eventsHead_; - - while (eventsTail_ && eventsTail_ -> next) - { - eventsTail_ = eventsTail_ -> next; - } - } - - // - // Remove event. - // - - Event *next = current -> next; - - delete current -> event; - delete current; - - current = next; - - nRemoved++; - } - else - { - current = current -> next; - } - } - - return nRemoved; -} - diff --git a/nxcompshad/Input.h b/nxcompshad/Input.h deleted file mode 100644 index cbba029a9..000000000 --- a/nxcompshad/Input.h +++ /dev/null @@ -1,99 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Input_H -#define Input_H - -#include - -typedef struct Event -{ - struct Event *next; - Display *display; - XEvent *event; -} Event; - -class Input -{ - public: - - Input(); - - ~Input(); - - int checkIfEvent(); - - void pushEvent(Display *, XEvent *); - - XEvent *popEvent(); - Display *currentDisplay(); - - int removeAllEvents(Display *); - - void setKeymap(char *keymap); - char *getKeymap(); - - void setShadowDisplayName(char *shadowDisplayName); - char *getShadowDisplayName(); - - private: - - Event *eventsHead_; - Event *eventsTail_; - char *keymap_; - char *shadowDisplayName_; -}; - -inline Display *Input::currentDisplay() -{ - return eventsHead_ ? eventsHead_ -> display : NULL; -} - -inline int Input::checkIfEvent() -{ - return (eventsHead_ != NULL); -} - -inline void Input::setKeymap(char *keymap) -{ - keymap_ = keymap; -} - -inline char *Input::getKeymap() -{ - return keymap_; -} - -inline void Input::setShadowDisplayName(char *shadowDisplayName) -{ - shadowDisplayName_ = shadowDisplayName; -} - -inline char *Input::getShadowDisplayName() -{ - return shadowDisplayName_; -} - -#endif /* Input_H */ diff --git a/nxcompshad/Logger.cpp b/nxcompshad/Logger.cpp deleted file mode 100644 index f27c97c19..000000000 --- a/nxcompshad/Logger.cpp +++ /dev/null @@ -1,124 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#define PANIC -#define WARNING -#undef TEST -#define DEBUG - -#include "Misc.h" -#include "Logger.h" - -Logger logger; - -void Logger::user(const char *format, va_list arguments) -{ - char string[1024]; - - vsnprintf(string, 1024, format, arguments); - - fprintf(stderr, "%s\n", string); -} - -void Logger::error(const char *name, int error) -{ - fprintf(stderr, "PANIC! %s: Failed with code %d: %s\n", - name, error, strerror(error)); -} - -void Logger::warning(const char *name, const char *format, va_list arguments) -{ - char string[1024]; - - vsnprintf(string, 1024, format, arguments); - - fprintf(stderr, "%s: WARNING! %s\n", name, string); -} - -void Logger::test(const char *name, const char *format, va_list arguments) -{ - char string[1024]; - - vsnprintf(string, 1024, format, arguments); - - fprintf(stderr, "%s: %s\n", name, string); -} - -void Logger::trace(const char *name) -{ - fprintf(stderr, "%s\n", name); -} - -void Logger::debug(const char *name, const char *format, va_list arguments) -{ - char string[1024]; - - vsnprintf(string, 1024, format, arguments); - - fprintf(stderr, "%s: %s\n", name, string); -} - -void Logger::dump(const char *name, const char *data, int size) -{ - fprintf(stderr, "%s: Dumping %d bytes of data at %p\n", - name, size, data); - - for (int i = 0; i < size;) - { - fprintf(stderr, "[%d]\t", i); - - int t = i; - - for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) - { - fprintf(stderr, "%02x/%d\t", data[i] & 0xff, data[i]); - } - - for (unsigned int ii = i % 8; ii > 0 && ii < 8; ii++) - { - fprintf(stderr, "\t"); - } - - i = t; - - for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) - { - if (isprint(data[i])) - { - fprintf(stderr, "%c", data[i]); - } - else - { - fprintf(stderr, "."); - } - } - - fprintf(stderr, "\n"); - } -} diff --git a/nxcompshad/Logger.h b/nxcompshad/Logger.h deleted file mode 100644 index eba81f642..000000000 --- a/nxcompshad/Logger.h +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Logger_H -#define Logger_H - -#include -#include - -// -// Error handling macros. -// - -#define ESET(e) (errno = (e)) -#define EGET() (errno) -#define ESTR() strerror(errno) - -extern class Logger logger; - -class Logger -{ - public: - - void user(const char *format, va_list arguments); - - void error(const char *name, int error); - - void warning(const char *name, const char *format, va_list arguments); - - void test(const char *name, const char *format, va_list arguments); - - void trace(const char *name); - - void debug(const char *name, const char *format, va_list arguments); - - void dump(const char *name, const char *data, int size); -}; - -static inline void logUser(const char *format, ...) \ - __attribute__((format(printf, 1, 2))) __attribute__((__unused__)); - -static inline void logError(const char *name, int error) \ - __attribute__((__unused__)); - -static inline void logWarning(const char *name, const char *format, ...) \ - __attribute__((__unused__)); - -static inline void logTest(const char *name, const char *format, ...) \ - __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); - -static inline void logTrace(const char *name) \ - __attribute__((__unused__)); - -static inline void logDebug(const char *name, const char *format, ...) \ - __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); - -static inline void logDump(const char *name, const char *data, int size) \ - __attribute__((__unused__)); - -static inline void logUser(const char *format, ...) -{ - va_list arguments; - - va_start(arguments, format); - - logger.user(format, arguments); - - va_end(arguments); -} - -static inline void logError(const char *name, int error) -{ - #if defined(DEBUG) || defined(TEST) || \ - defined(WARNING) || defined(PANIC) - - logger.error(name, error); - - #endif -} - -static inline void logWarning(const char *name, const char *format, ...) -{ - #if defined(DEBUG) || defined(TEST) || \ - defined(WARNING) - - va_list arguments; - - va_start(arguments, format); - - logger.warning(name, format, arguments); - - va_end(arguments); - - #endif -} - -static inline void logTest(const char *name, const char *format, ...) -{ - #if defined(TEST) - - va_list arguments; - - va_start(arguments, format); - - logger.test(name, format, arguments); - - va_end(arguments); - - #endif -} - -static inline void logTrace(const char *name) -{ - #if defined(DEBUG) - - logger.trace(name); - - #endif -} - -static inline void logDebug(const char *name, const char *format, ...) -{ - #if defined(DEBUG) - - va_list arguments; - - va_start(arguments, format); - - logger.debug(name, format, arguments); - - va_end(arguments); - - #endif -} - -static inline void logDump(const char *name, const char *data, int size) -{ - #if defined(TEST) - - logger.dump(name, data, size); - - #endif -} - -#endif /* Logger_H */ diff --git a/nxcompshad/Makefile.am b/nxcompshad/Makefile.am new file mode 100644 index 000000000..f3666a08a --- /dev/null +++ b/nxcompshad/Makefile.am @@ -0,0 +1,21 @@ +SUBDIRS = src + +pkgconfig_DATA = nxcompshad.pc + +MAINTAINERCLEANFILES = \ + $(srcdir)/autom4te.cache/* \ + $(srcdir)/build-aux/* \ + $(srcdir)/Makefile.in \ + $(srcdir)/src/Makefile.in \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/config.h.in \ + $(srcdir)/config.h.in~ \ + $(srcdir)/configure \ + $(srcdir)/m4/libtool.m4 \ + $(srcdir)/m4/lt~obsolete.m4 \ + $(srcdir)/m4/ltoptions.m4 \ + $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ + $(NULL) + +DISTCLEANFILES=$(MAINTAINERCLEANFILES) diff --git a/nxcompshad/Makefile.in b/nxcompshad/Makefile.in deleted file mode 100644 index 34b785d25..000000000 --- a/nxcompshad/Makefile.in +++ /dev/null @@ -1,251 +0,0 @@ -#/**************************************************************************/ -#/* */ -#/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -#/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -#/* Copyright (c) 2014-2016 Ulrich Sibiller */ -#/* Copyright (c) 2014-2016 Mihai Moldovan */ -#/* Copyright (c) 2011-2016 Mike Gabriel */ -#/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -#/* */ -#/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -#/* are copyright of the aforementioned persons and companies. */ -#/* */ -#/* Redistribution and use of the present software is allowed according */ -#/* to terms specified in the file LICENSE which comes in the source */ -#/* distribution. */ -#/* */ -#/* All rights reserved. */ -#/* */ -#/* NOTE: This software has received contributions from various other */ -#/* contributors, only the core maintainers and supporters are listed as */ -#/* copyright holders. Please contact us, if you feel you should be listed */ -#/* as copyright holder, as well. */ -#/* */ -#/**************************************************************************/ - -# -# Get values from configure script. -# - -VERSION=@VERSION@ -LIBVERSION=@LIBVERSION@ - -# -# We would really like to enable all warnings, -Wredundant-decls, -# though, gives a warning caused by pthread.h and unistd.h and -# GCC 3.4 was changed in a way that it now complains about some -# of the -W directives we used before (-Wmissing-declarations, -# -Wnested-externs, -Wstrict-prototypes and -Wmissing-prototypes). -# - -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -CXXINCLUDES = -CXXDEFINES = - -CPPFLAGS = @CPPFLAGS@ - -# -# C programs don't share the C++ flags. They should -# have their own @CCFLAGS@. -# - -CC = @CC@ -CCFLAGS = @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -CCINCLUDES = -CCDEFINES = - -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ -lNX_X11 - -# -# Only if THREADS is defined. -# -# LIBS = $(LIBS) -lpthread -# - -# -# Only if you want ElectricFence. -# -# LIBS = $(LIBS) -lefence -# - -# -# Only if you want mpatrol. -# -# LIBS = $(LIBS) -lmpatrol -lbfd -liberty -# - -srcdir = @srcdir@ -prefix = @prefix@ -datarootdir = @datarootdir@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -man1dir = @mandir@/man1 -VPATH = @srcdir@ -libdir = @libdir@ -includedir = @includedir@ -pkgconfigdir = @pkgconfigdir@ - -INSTALL = @INSTALL@ -INSTALL_DIR = $(INSTALL) -d -m 0755 -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_LINK = cp -av -DESTDIR = -RM_FILE = rm -f -RM_DIR = rmdir -p --ignore-fail-on-non-empty - -# -# This should be autodetected. -# - -MAKEDEPEND = @MAKEDEPEND@ -DEPENDINCLUDES = -I/usr/include/g++ -I/usr/include/g++-3 - -.SUFFIXES: .cpp.c - -.cpp.o: - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< -.c.o: - $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< - -LIBRARY = Xcompshad - -LIBNAME = lib$(LIBRARY) -ifeq ($(shell uname),Darwin) -LIBFULL = lib$(LIBRARY).$(VERSION).dylib -LIBLOAD = lib$(LIBRARY).$(LIBVERSION).dylib -LIBSHARED = lib$(LIBRARY).dylib -COMP_VER = $(shell echo '$(VERSION)' | cut -d '.' -f 1-3) -LIBFLAGS = -install_name $(libdir)/$(LIBLOAD) -compatibility_version $(LIBVERSION) -current_version $(COMP_VER) -else -LIBFULL = lib$(LIBRARY).so.$(VERSION) -LIBLOAD = lib$(LIBRARY).so.$(LIBVERSION) -LIBSHARED = lib$(LIBRARY).so -LIBFLAGS = -endif -LIBARCHIVE = lib$(LIBRARY).a - -MSRC = Main.c - -CSRC = - -CXXSRC = Core.cpp \ - Input.cpp \ - Logger.cpp \ - Shadow.cpp \ - X11.cpp \ - Win.cpp \ - Updater.cpp \ - Manager.cpp - -MOBJ = $(MSRC:.c.cpp=.o) -COBJ = $(CSRC:.c=.o) -CXXOBJ = $(CXXSRC:.cpp=.o) - -MLIBS = -L. -lXShadow - -ifeq ($(findstring -lgdi32,$(LIBS)),-lgdi32) - -# We need a smarter way to detect windows -# platform. - -LIBDLL = cyg$(LIBRARY).dll -LIBDLLSTATIC = lib${LIBRARY}.dll.a - -all: depend $(LIBARCHIVE) $(LIBDLL) - -else - -EXTRALIBS = -lXext -lXtst -lXrandr -lXdamage - -all: depend $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE) - -endif - -$(LIBFULL): $(CXXOBJ) $(COBJ) - $(CXX) -o $@ $(LDFLAGS) $(LIBFLAGS) $(CXXOBJ) $(COBJ) $(LIBS) $(EXTRALIBS) - -$(LIBLOAD): $(LIBFULL) - rm -f $(LIBLOAD) - ln -s $(LIBFULL) $(LIBLOAD) - -$(LIBSHARED): $(LIBFULL) - rm -f $(LIBSHARED) - ln -s $(LIBFULL) $(LIBSHARED) - -$(LIBARCHIVE): $(CXXOBJ) $(COBJ) - rm -f $(LIBARCHIVE) - ar clq $(LIBARCHIVE) $(CXXOBJ) $(COBJ) - ranlib $(LIBARCHIVE) - -$(LIBDLL): $(LIBARCHIVE) - $(CC) -o $@ \ - -shared \ - -Wl,--out-implib=$(LIBDLLSTATIC) \ - -Wl,--export-all-symbols \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive ${LIBARCHIVE} \ - -Wl,--no-whole-archive \ - ${LIBS} - -$(PROGRAM): $(MOBJ) $(COBJ) $(CXXOBJ) $(LIBDLL) -# $(CC) $(CCFLAGS) -o $@ $(MOBJ) $(MLIBS) - -depends: depend.status - -depend: depend.status - -depend.status: - if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \ - $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \ - $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) $(CXXSRC) 2>/dev/null; \ - fi - touch depend.status - -install: install.bin install.lib install.man - -install.bin: - -install.lib: all - $(INSTALL_DIR) $(DESTDIR)${libdir} - $(INSTALL_DIR) $(DESTDIR)${pkgconfigdir} - $(INSTALL_DIR) $(DESTDIR)${includedir}/nx - $(INSTALL_DIR) $(DESTDIR)${pkgconfigdir} - $(INSTALL_DATA) $(LIBFULL) $(DESTDIR)${libdir} - $(INSTALL_LINK) $(LIBLOAD) $(DESTDIR)${libdir} - $(INSTALL_LINK) $(LIBSHARED) $(DESTDIR)${libdir} - $(INSTALL_DATA) $(LIBARCHIVE) $(DESTDIR)${libdir} - $(INSTALL_DATA) Shadow.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) nxcompshad.pc $(DESTDIR)${pkgconfigdir} - echo "Running ldconfig tool, this may take a while..." && ldconfig || true - -install.man: - -uninstall: uninstall.bin uninstall.lib uninstall.man - -uninstall.bin: - -uninstall.lib: - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBFULL) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBLOAD) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBSHARED) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBARCHIVE) - for header in *.h; do $(RM_FILE) $(DESTDIR)${includedir}/nx/$$header; done - $(RM_DIR) $(DESTDIR)${libdir}/nx/ - $(RM_DIR) $(DESTDIR)${includedir}/nx/ - $(RM_FILE) $(DESTDIR)${pkgconfigdir}/nxcompshad.pc - echo "Running ldconfig tool, this may take a while..." && ldconfig || true - -uninstall.man: - -clean: - -rm -f *~ *.o *.gch *.bak st?????? core core.* *.out.* *.exe.stackdump *.pc \ - $(LIBFULL) $(LIBLOAD) $(LIBSHARED) $(LIBARCHIVE) $(LIBDLL) $(LIBDLLSTATIC) $(PROGRAM) $(PROGRAM).exe - -distclean: clean - -rm -rf config.status config.log config.cache depend.status Makefile tags autom4te.cache configure diff --git a/nxcompshad/Manager.cpp b/nxcompshad/Manager.cpp deleted file mode 100644 index 3bb36c13f..000000000 --- a/nxcompshad/Manager.cpp +++ /dev/null @@ -1,260 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include "Manager.h" -#include "Logger.h" - -UpdateManager::UpdateManager(int w, int h, char *f, Input *i) - : width_(w), height_(h), frameBuffer_(f), input_(i) -{ - logTrace("UpdateManager::UpdateManager"); - - nUpdater = 0; - updaterVector = NULL; - updateManagerRegion_ = NULL; -} - -UpdateManager::~UpdateManager() -{ - logTrace("UpdateManager::~UpdateManager"); - - for (int i = 0; i < nUpdater; i++) - { - delete updaterVector[i]; - } - - delete [] updaterVector; -} - -Updater *UpdateManager::createUpdater(char *displayName, Display *display) -{ - Updater *updater = new Updater(displayName, display); - - if (updater == NULL) - { - logError("UpdateManager::createUpdater", ESET(ENOMEM)); - - return NULL; - } - - if (updater -> init(width_, height_, frameBuffer_, input_) == -1) - { - logError("UpdateManager::createUpdater", EGET()); - - delete updater; - - return NULL; - } - - return updater; -} - -UpdaterHandle UpdateManager::addUpdater(char *displayName, Display *display) -{ - Updater *newUpdater = createUpdater(displayName, display); - - if (newUpdater == NULL) - { - logError("UpdateManager::addUpdater", EGET()); - - return NULL; - } - - Updater **newUpdaterVector = new Updater*[nUpdater + 1]; - - if (newUpdaterVector == NULL) - { - logError("UpdateManager::addUpdater", ESET(ENOMEM)); - - delete newUpdater; - - return NULL; - } - - for (int i = 0; i < nUpdater; i++) - { - newUpdaterVector[i] = updaterVector[i]; - } - - newUpdaterVector[nUpdater] = newUpdater; - - delete [] updaterVector; - - updaterVector = newUpdaterVector; - - nUpdater++; - - logTest("UpdateManager::AddUpdater", "Number of updaters [%d].", nUpdater); - - return reinterpret_cast(newUpdater); -} - -int UpdateManager::removeAllUpdaters() -{ - logTest("UpdateManager::removeAllUpdaters", "Number of updaters [%d].", nUpdater); - - int nullUpdaters = 0; - - for (int i = nUpdater; i > 0; i--) - { - if (removeUpdater(reinterpret_cast(updaterVector[i - 1])) == 0) - { - nullUpdaters++; - } - } - - if (nUpdater == 0) - { - return 1; - } - - if (nUpdater == nullUpdaters) - { - logTest("UpdateManager::removeAllUpdaters", "Ignored null records in Updater vector."); - - return 0; - } - - logTest("UpdateManager::removeAllUpdaters", "Failed to remove some updaters."); - - return -1; -} - -int UpdateManager::removeUpdater(UpdaterHandle handle) -{ - Updater * const updater = (Updater*) handle; - - logTest("UpdateManager::removeUpdater", "Removing Updater [%p].", updater); - - if (updater == NULL) - { - return 0; - } - - for (int i = 0; i < nUpdater; i++) - { - if (updater == updaterVector[i]) - { - updaterVector[i] = updaterVector[nUpdater - 1]; - - nUpdater--; - - delete updater; - - return 1; - } - } - - logTest("UpdateManager::removeUpdater", "Couldn't find Updater [%p].", updater); - - return -1; -} - -void UpdateManager::addRegion(Region region) -{ - logTrace("UpdateManager::addRegion"); - - for (int i = 0; i < nUpdater; i++) - { - updaterVector[i] -> addRegion(region); - } - - XDestroyRegion(region); -} - -void UpdateManager::update() -{ - logTrace("UpdateManager::update"); - - for (int i = 0; i < nUpdater; i++) - { - /*updaterVector[i] -> update();*/ - if (updaterVector[i] -> getUpdateRegion()) - { - logDebug("UpdateManager::update", "pRegion [%p] rect[%ld].", - updaterVector[i] -> getUpdateRegion(), (updaterVector[i] -> getUpdateRegion()) -> numRects); - - updateManagerRegion_ = updaterVector[i] -> getUpdateRegion(); - // - // FIXME: Remove me. - // - for (int j = 0; j < updateManagerRegion_ -> numRects; j++) - { - int x = updateManagerRegion_ -> rects[j].x1; - int y = updateManagerRegion_ -> rects[j].y1; - unsigned int width = updateManagerRegion_ -> rects[j].x2 - updateManagerRegion_ -> rects[j].x1; - unsigned int height = updateManagerRegion_ -> rects[j].y2 - updateManagerRegion_ -> rects[j].y1; - logDebug("UpdateManager::update", "x[%d]y[%d]width[%u]height[%u], updateManagerRegion_[%p]", - x, y, width, height, updateManagerRegion_); - } - } - } -} - -void UpdateManager::handleInput() -{ - logTrace("UpdateManager::handleInput"); - - for (int i = 0; i < nUpdater; i++) - { - try - { - updaterVector[i] -> handleInput(); - } - catch (UpdaterClosing u) - { - logTest("UpdateManager::handleInput", "Catched exception UpdaterClosing()."); - - removeUpdater((UpdaterHandle)updaterVector[i]); - - // - // Now the i-element of the updaterVector - // is changed. We don't want to skip it. - // - - i--; - } - } -} - -void UpdateManager::newRegion() -{ - logTrace("UpdateManager::newRegion"); - - for (int i = 0; i < nUpdater; i++) - { - updaterVector[i] -> newRegion(); - } -} diff --git a/nxcompshad/Manager.h b/nxcompshad/Manager.h deleted file mode 100644 index 92a82cd32..000000000 --- a/nxcompshad/Manager.h +++ /dev/null @@ -1,123 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef UpdateManager_H -#define UpdateManager_H - -#include - -#include "Updater.h" -#include "Regions.h" -#include "Input.h" - -typedef char* UpdaterHandle; - -class UpdateManager -{ - public: - - UpdateManager(int, int, char *, Input *); - - ~UpdateManager(); - - void handleInput(); - - void addRegion(Region); - - void update(); - - UpdaterHandle addUpdater(char *displayName, Display *display); - - int removeUpdater(UpdaterHandle); - - int removeAllUpdaters(); - - int numberOfUpdaters(); - - int getWidth(); - - int getHeight(); - - char *getBuffer(); - - Region getUpdateManagerRegion(); - - void destroyUpdateManagerRegion(); - - void newRegion(); - - private: - - Updater *createUpdater(char *displayName, Display *display); - - int width_; - int height_; - char *frameBuffer_; - Input *input_; - - int nUpdater; - - Updater **updaterVector; - - Region updateManagerRegion_; - -}; - -inline int UpdateManager::numberOfUpdaters() -{ - return nUpdater; -} - -inline int UpdateManager::getWidth() -{ - return width_; -} - -inline int UpdateManager::getHeight() -{ - return height_; -} - -inline char *UpdateManager::getBuffer() -{ - return frameBuffer_; -} - -inline Region UpdateManager::getUpdateManagerRegion() -{ - return updateManagerRegion_; -} - -inline void UpdateManager::destroyUpdateManagerRegion() -{ - if (updateManagerRegion_ != NULL) - { - XDestroyRegion(updateManagerRegion_); - - updateManagerRegion_ = NULL; - } -} - -#endif /* UpdateManager_H */ diff --git a/nxcompshad/Misc.h b/nxcompshad/Misc.h deleted file mode 100644 index 9386dc080..000000000 --- a/nxcompshad/Misc.h +++ /dev/null @@ -1,50 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Misc_H -#define Misc_H - -#include - -#include -#include - -using namespace std; - -// -// Error handling macros. -// - -#define ESET(e) (errno = (e)) -#define EGET() (errno) -#define ESTR() strerror(errno) - -// -// Log file. -// - -extern ostream *logofs; - -#endif /* Misc_H */ diff --git a/nxcompshad/Poller.h b/nxcompshad/Poller.h deleted file mode 100644 index 6236f872f..000000000 --- a/nxcompshad/Poller.h +++ /dev/null @@ -1,39 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Poller_H -#define Poller_H - -#if defined(__CYGWIN32__) || defined(WIN32) - -#include "Win.h" - -#else - -#include "X11.h" - -#endif - -#endif /* Poller_H */ diff --git a/nxcompshad/Regions.h b/nxcompshad/Regions.h deleted file mode 100644 index 59fdcb46c..000000000 --- a/nxcompshad/Regions.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Region_H -#define Region_H - -#include -#include - -typedef struct { - short x1, x2, y1, y2; -} Box, BOX, BoxRec, *BoxPtr; - -typedef struct _XRegion { - long size; - long numRects; - BOX *rects; - BOX extents; -}; - -#endif /* Region_H */ diff --git a/nxcompshad/Shadow.cpp b/nxcompshad/Shadow.cpp deleted file mode 100644 index 643a5a807..000000000 --- a/nxcompshad/Shadow.cpp +++ /dev/null @@ -1,478 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include "Logger.h" -#include "Shadow.h" -#include "Poller.h" -#include "Manager.h" - -typedef struct { - KeySym *map; - KeyCode minKeyCode, - maxKeyCode; - int mapWidth; -} KeySymsRec, *KeySymsPtr; - -KeySymsPtr NXShadowKeymap = NULL; - -ShadowOptions NXShadowOptions = {1, 1, -1}; - -static int mirrorException = 0; - -static UpdateManager *updateManager; -static Poller *poller; -static Input *input; - -int NXShadowRemoveAllUpdaters(); - -inline bool NXShadowNotInitialized() -{ - // - // updateManager depends on input and poller. - // So this test seem redundant. - // - // return (input == NULL) || (poller == NULL) || (updateManager == NULL); - // - - return (updateManager == NULL); -} - -#ifdef NEED_SIGNAL_HANDLER -static void NXSignalHandler(int signal) -{ - logTest("NXSignalHandler", "Got signal [%d]", signal); - - if (signal == SIGINT) - { - mirrorException = 1; - } - else if (signal == SIGTERM) - { - mirrorException = 1; - } -} - -static int NXInitSignal() -{ - logTrace("NXInitSignal"); - - struct sigaction sa; - - sa.sa_handler = NXSignalHandler; - sigfillset(&sa.sa_mask); - sa.sa_flags = 0; - - int res; - - while ((res = sigaction(SIGINT, &sa, NULL)) == -1 && - errno == EINTR); - - if (res == -1) - { - logError("NXInitSignal", EGET()); - - return -1; - } - - return 1; -} -#endif - -static void NXHandleException() -{ - if (mirrorException) - { - mirrorException = 0; - - NXShadowRemoveAllUpdaters(); - } -} - -static int NXCreateInput(char *keymap, char *shadowDisplayName) -{ - logTrace("NXCreateInput"); - - input = new Input; - - if (input == NULL) - { - logError("NXCreateInput", ESET(ENOMEM)); - - return -1; - } - - input -> setKeymap(keymap); - - input -> setShadowDisplayName(shadowDisplayName); - - return 1; -} - -static int NXCreatePoller(Display *display, Display **shadowDisplay) -{ - logTrace("NXCreatePoller"); - - if (input == NULL) - { - logError("NXCreatePoller", ESET(EBADF)); - - return -1; - } - - poller = new Poller(input,display); - - if (poller == NULL) - { - logError("NXCreatePoller", ESET(ENOMEM)); - - return -1; - } - - if (poller -> init() == -1) - { - logWarning("NXCreatePoller", "Failed to initialize poller."); - - return -1; - } - - *shadowDisplay = poller -> getShadowDisplay(); - - logTest("NXCreatePoller", "Poller geometry [%d, %d], ShadowDisplay[%p].", poller -> width(), - poller -> height(), (Display *) *shadowDisplay); - - return 1; -} - -static int NXCreateUpdateManager() -{ - logTrace("NXCreateUpdateManager"); - - if (input == NULL || poller == NULL) - { - logError("NXCreateUpdateManager", ESET(EBADF)); - - return -1; - } - - updateManager = new UpdateManager(poller -> width(), poller -> height(), - poller -> getFrameBuffer(), input); - - if (updateManager == NULL) - { - logError("NXCreateUpdateManager", ESET(ENOMEM)); - - return -1; - } - - return 1; -} - -void NXShadowResetOptions() -{ - NXShadowOptions.optionShmExtension = 1; - NXShadowOptions.optionDamageExtension = 1; -} - -// -// Exported functions. -// - -int NXShadowHasUpdaters() -{ - logTrace("NXShadowHasUpdaters"); - - return (updateManager && updateManager -> numberOfUpdaters()) ? 1 : 0; -} - -int NXShadowRemoveAllUpdaters() -{ - logTrace("NXShadowRemoveAllUpdaters"); - - return updateManager ? updateManager -> removeAllUpdaters() : 0; -} - -int NXShadowRemoveUpdater(UpdaterHandle handle) -{ - logTrace("NXShadowRemoveUpdater"); - - return updateManager ? updateManager -> removeUpdater(handle) : 0; -} - -UpdaterHandle NXShadowAddUpdater(char *displayName) -{ - logTrace("NXShadowAddUpdater"); - - return updateManager ? updateManager -> addUpdater(displayName, NULL) : NULL; -} - -int NXShadowAddUpdaterDisplay(void *dpy, int *w, int *h, unsigned char *d) -{ - Display *display = reinterpret_cast(dpy); - - logTrace("NXShadowAddUpdaterDisplay"); - - if ((updateManager ? updateManager -> addUpdater(NULL, display) : NULL) == NULL) - { - logTest("NXShadowAddUpdaterDisplay", "Error"); - - return 0; - } - - *w = updateManager -> getWidth(); - *h = updateManager -> getHeight(); - *d = poller -> depth(); - - return 1; -} - -int NXShadowCreate(void *dpy, char *keymap, char* shadowDisplayName, void **shadowDpy) -{ - logTrace("NXShadowCreate"); - - Display *display = reinterpret_cast(dpy); - Display **shadowDisplay = reinterpret_cast(shadowDpy); - -/* if (NXInitSignal() != 1) - { - logError("NXShadowCreate", EGET()); - - return -1; - }*/ - - if (NXCreateInput(keymap, shadowDisplayName) != 1) - { - logError("NXShadowCreate", EGET()); - - return -1; - } - - if (NXCreatePoller(display, shadowDisplay) != 1) - { - logWarning("NXShadowCreate", "NXCreatePoller failed."); - - return -1; - } - - if (NXCreateUpdateManager() != 1) - { - logError("NXShadowCreate", EGET()); - - return -1; - } - - return 1; -} - -#if !defined(__CYGWIN32__) && !defined(WIN32) - -void NXShadowSetDisplayUid(int uid) -{ - NXShadowOptions.optionShadowDisplayUid = uid; -} - -void NXShadowDisableShm(void) -{ - logUser("NXShadowDisableShm: Disabling SHM.\n"); - - NXShadowOptions.optionShmExtension = 0; -} - -void NXShadowDisableDamage(void) -{ - NXShadowOptions.optionDamageExtension = 0; -} - -void NXShadowGetScreenSize(int *w, int *h) -{ - poller -> getScreenSize(w, h); -} - -void NXShadowSetScreenSize(int *w, int *h) -{ - poller -> setScreenSize(w, h); -} - -#endif - -void NXShadowDestroy() -{ - if (poller) - { - delete poller; - - poller = NULL; - } - - if (updateManager) - { - delete updateManager; - - updateManager = NULL; - } - - if (input) - { - delete input; - - input = NULL; - } -} - -void NXShadowHandleInput() -{ - logTrace("NXShadowHandleInput"); - - if (NXShadowNotInitialized()) - { - logError("NXShadowHandleInput - NXShadow not properly initialized.", ESET(EBADF)); - - return; - } - - NXHandleException(); - - updateManager -> handleInput(); - - poller -> handleInput(); -} - -int NXShadowHasChanged(int (*callback)(void *), void *arg, int *suspended) -{ - int result; - - logTrace("NXShadowHasChanged"); - - if (NXShadowNotInitialized()) - { - logError("NXShadowHasChanged - NXShadow not properly initialized.", ESET(EBADF)); - - return -1; - } - - // - // FIXME - //updateManager -> destroyUpdateManagerRegion(); - // - - updateManager -> newRegion(); - -#if !defined(__CYGWIN32__) && !defined(WIN32) - poller -> getEvents(); -#endif - - result = poller -> isChanged(callback, arg, suspended); - - if (result == 1) - { - updateManager -> addRegion(poller -> lastUpdatedRegion()); - - return 1; - } - else if (result == -1) - { - logTest("NXShadowHasChanged", "Scanline error."); - return -1; - } - - return 0; -} - -void NXShadowExportChanges(long *numRects, char **pBox) -{ - Region pReg; - - logTrace("NXShadowExportChanges"); - - if (NXShadowNotInitialized()) - { - logError("NXShadowExportChanges - NXShadow not properly initialized.", ESET(EBADF)); - } - - updateManager -> update(); - pReg = updateManager -> getUpdateManagerRegion(); - *numRects = pReg -> numRects; - *pBox = (char *)pReg -> rects; - - logTest("NXShadowExportChanges", "numRects [%ld] pBox[%p], pReg->numRects[%ld], rects[%p], size[%lu]", - *numRects, *pBox, pReg -> numRects, &(pReg -> rects -> x2), - (unsigned long) sizeof(pReg -> rects -> x2)); -} - -void NXShadowEvent(Display *display, XEvent event) -{ - poller -> handleEvent(display, &event); -} - -void NXShadowWebKeyEvent(KeySym keysym, Bool isKeyPress) -{ - poller -> handleWebKeyEvent(keysym, isKeyPress); -} - -#ifdef __CYGWIN32__ - -int NXShadowCaptureCursor(unsigned int wnd, void *vis) -{ - Window window = (Window)wnd; - Visual *visual = reinterpret_cast(vis); - - logTrace("NXShadowCaptureCursor"); - - logTest("NXShadowCaptureCursor","Init"); - - return poller -> updateCursor(window, visual); -} - -#endif - -void NXShadowUpdateBuffer(void **buffer) -{ - char **fBuffer = reinterpret_cast(buffer); - - if (*fBuffer != NULL) - { - poller -> destroyFrameBuffer(); - - poller -> init(); - } - - *fBuffer = poller -> getFrameBuffer(); - - logTest("NXShadowUpdateBuffer","New frame buffer [0x%p]", (void *)*fBuffer); -} - -void NXShadowInitKeymap(void *keysyms) -{ - NXShadowKeymap = (KeySymsPtr) keysyms; - - logTest("NXShadowInitKeymap","KeySyms pointer [0x%p]", (void *)NXShadowKeymap); -} diff --git a/nxcompshad/Shadow.h b/nxcompshad/Shadow.h deleted file mode 100644 index e1c57c432..000000000 --- a/nxcompshad/Shadow.h +++ /dev/null @@ -1,109 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Shadow_H -#define Shadow_H - -#include - -#define NXShadowCorrectColor(length, buffer) \ -\ -{ \ - unsigned short a; \ - unsigned short b; \ - unsigned short *shorts; \ - int i; \ -\ - length >>= 1; \ - shorts = (unsigned short *)buffer; \ - for (i = 0; i < length ; i++) \ - { \ - a = shorts[i]; \ -\ - b = a & 63; \ - a <<= 1; \ - a = (a & ~127) | b; \ -\ - shorts[i] = a; \ - } \ -} - -#ifdef __cplusplus -extern "C" { -#endif - -typedef char* UpdaterHandle; - -typedef struct _ShadowOptions -{ - char optionShmExtension; - char optionDamageExtension; - int optionShadowDisplayUid; -} ShadowOptions; - -extern ShadowOptions NXShadowOptions; - -extern int NXShadowCreate(void *, char *, char *, void **); -extern void NXShadowDestroy(void); - -/* - * Use an already opened Display connection. - * We use instead of to avoid - * useless dependences from Xlib headers. - */ - -extern int NXShadowAddUpdaterDisplay(void *display, int *width, int *height, - unsigned char *depth); -extern UpdaterHandle NXShadowAddUpdater(char *displayName); -extern int NXShadowRemoveUpdater(UpdaterHandle handle); -extern int NXShadowRemoveAllUpdaters(void); - -extern void NXShadowHandleInput(void); -extern int NXShadowHasChanged(int (*)(void *), void *, int *); -extern void NXShadowExportChanges(long *, char **); -extern int NXShadowHasUpdaters(void); -extern int NXShadowCaptureCursor(unsigned int wnd, void *vis); -extern void NXShadowColorCorrect(int, int, unsigned int, unsigned int, char *); -extern void NXShadowUpdateBuffer(void **); - -extern void NXShadowEvent(Display *, XEvent); -extern void NXShadowWebKeyEvent(KeySym keysym, Bool isKeyPress); - -extern void NXShadowSetDisplayUid(int uid); - -extern void NXShadowDisableShm(void); -extern void NXShadowDisableDamage(void); - -extern void NXShadowGetScreenSize(int *width, int *height); -extern void NXShadowSetScreenSize(int *width, int *height); - -extern void NXShadowInitKeymap(void *keysyms); - -#ifdef __cplusplus -} -#endif - -#endif /* Shadow_H */ - diff --git a/nxcompshad/Updater.cpp b/nxcompshad/Updater.cpp deleted file mode 100644 index 67f4f9628..000000000 --- a/nxcompshad/Updater.cpp +++ /dev/null @@ -1,391 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -// -#include -// -#include "Updater.h" -#include "Logger.h" - -Updater::Updater(char *displayName, Display *display) -{ - logTrace("Updater::Updater"); - - displayName_ = displayName; - display_ = display; - closeDisplay_ = false; - image_ = NULL; - updateRegion_ = NULL; - buffer_ = NULL; -} - -Updater::~Updater() -{ - logTrace("Updater::~Updater"); - - if (input_) - { - int removedEvents = input_ -> removeAllEvents(display_); - - logTest("Updater::~Updater", "Removed events in input queue is [%d].", removedEvents); - } - - if (display_) - { - XDestroyWindow(display_, window_); - XFreePixmap(display_, pixmap_); - - if (closeDisplay_) - { - XCloseDisplay(display_); - } - } - - if (image_) - { - image_ -> data = NULL; - - XDestroyImage(image_); - } - - if (updateRegion_) - { - XDestroyRegion(updateRegion_); - } -} - -int Updater::init(int width, int height, char *fb, Input *input) -{ - logTrace("Updater::init"); - - if (fb == NULL || input == NULL || width <= 0 || height <= 0) - { - logError("Updater::init", ESET(EINVAL)); - - return -1; - } - - width_ = width; - height_ = height; - buffer_ = fb; - input_ = input; -/* - if (display_ == NULL) - { - display_ = XOpenDisplay(displayName_); - - closeDisplay_ = true; - - if (display_ == NULL) - { - logError("Updater::init", ESET(ENOMSG)); - - return -1; - } - } -*/ - depth_ = DefaultDepth(display_, DefaultScreen(display_)); - - if (depth_ == 8) bpl_ = width_; - else if (depth_ == 16) bpl_ = width_ * 2; - else bpl_ = width_ * 4; - - logTest("Updater::init", "Server geometry [%d, %d] depth [%d] bpl [%d].", width_, height_, depth_, bpl_); - -/* int bitmap_pad = 8; - - image_ = XCreateImage(display_, DefaultVisual(display_, DefaultScreen(display_)), depth_, ZPixmap, 0, - buffer_, width_, height_, bitmap_pad, 0); - - if (image_ == NULL) - { - logError("Updater::init", ESET(ENOMSG)); - - logTest("Updater::init", "Failed to create default image."); - - return -1; - } - - pixmap_ = XCreatePixmap(display_, DefaultRootWindow(display_), width_, height_, depth_); - - unsigned int mask = CWBackPixmap | CWBorderPixel | CWEventMask; - - XSetWindowAttributes attributes; - - attributes.background_pixmap = pixmap_; - attributes.border_pixel = WhitePixel(display_, DefaultScreen(display_)); - attributes.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; - - window_ = XCreateWindow(display_, DefaultRootWindow(display_), - 0, 0, width_, height_, 0, depth_, InputOutput, - DefaultVisual(display_, DefaultScreen(display_)), mask, &attributes); - - if (window_ == None) - { - logError("Updater::init", ESET(ENOMSG)); - - return -1; - } - - XSizeHints *size_hints; - - if ((size_hints = XAllocSizeHints()) == NULL) - { - logError("Updater::init", ESET(ENOMEM)); - - return -1; - } - - size_hints -> flags = PMinSize | PMaxSize; - size_hints -> min_width = width_; - size_hints -> max_width = width_; - size_hints -> min_height = height_; - size_hints -> max_height = height_; - - XSetWMNormalHints(display_, window_, size_hints); - - XFree(size_hints); - - Atom deleteWMatom = XInternAtom(display_, "WM_DELETE_WINDOW", 1); - - XSetWMProtocols(display_, window_, &deleteWMatom, 1); - - XMapWindow(display_, window_);*/ - - updateRegion_ = XCreateRegion(); - - logTest("Updater::init", "updateRegion_[%p]", updateRegion_); - return 1; -} - -void Updater::addRegion(Region region) -{ - // - // FIXME: Is this too paranoid ? - // - - if (updateRegion_ == NULL) - { - logError("Updater::addRegion", ESET(EINVAL)); - - return; - } - - XUnionRegion(region, updateRegion_, updateRegion_); -} - -void Updater::update() -{ - logTrace("Updater::update"); - - if (updateRegion_ == NULL) - { - logError("Updater::update", ESET(EINVAL)); - - return; - } - - logTest("Updater::update", "Number of rectangles [%ld].", updateRegion_ -> numRects); - -/* for (; updateRegion_ -> numRects > 0; updateRegion_ -> numRects--) - { - int n = updateRegion_ -> numRects - 1; - - int x = updateRegion_ -> rects[n].x1; - int y = updateRegion_ -> rects[n].y1; - unsigned int width = updateRegion_ -> rects[n].x2 - updateRegion_ -> rects[n].x1; - unsigned int height = updateRegion_ -> rects[n].y2 - updateRegion_ -> rects[n].y1; - - logDebug("Updater::update", "Sending rectangle: [%d, %d, %d, %d].", x, y, width, height); - - // - // We need to update the extents. - // - - int bitmap_pad; - - if (depth_ == 32 || depth_ == 24) - { - bitmap_pad = 32; - } - else if (depth_ == 16) - { - if ((width & 1) == 0) - { - bitmap_pad = 32; - } - else - { - bitmap_pad = 16; - } - } - else if ((width & 3) == 0) - { - bitmap_pad = 32; - } - else if ((width & 1) == 0) - { - bitmap_pad = 16; - } - else - { - bitmap_pad = 8; - }*/ - -/* image_ -> bitmap_pad = bitmap_pad;*/ - - /* NXShadowCorrectColor(x, y, width, height);*/ - -/* XPutImage(display_, pixmap_, DefaultGC(display_, DefaultScreen(display_)), - image_, x, y, x, y, width, height); - - XClearArea(display_, window_, x, y, width, height, 0); - }*/ - - // - // Should we reduces the box vector ? - // - // BOX *box = Xrealloc(updateRegion_ -> rects, - // updateRegion_ -> numRects == 0 ? sizeof(BOX) : - // updateRegion_ -> numRects * sizeof(BOX)); - // - // if (box) - // { - // updateRegion_ -> rects = box; - // updateRegion_ -> size = 1; - // } - // - - if (updateRegion_ -> numRects == 0) - { - updateRegion_ -> extents.x1 = 0; - updateRegion_ -> extents.y1 = 0; - updateRegion_ -> extents.x2 = 0; - updateRegion_ -> extents.y2 = 0; - } - else - { - // - // FIXME: We have to update the region extents. - // - - logTest("Updater::update", "Region extents has not been updated."); - } -} - -void Updater::handleInput() -{ - logTrace("Updater::handleInput"); - - XEvent *event = new XEvent; - - if (event == NULL) - { - logError("Updater::handleInput", ESET(ENOMEM)); - - return; - } - - while (XCheckIfEvent(display_, event, anyEventPredicate, NULL)) - { - switch (event -> type) - { - /* case ClientMessage: - { - Atom wmProtocols = XInternAtom(display_, "WM_PROTOCOLS", 0); - Atom wmDeleteWindow = XInternAtom(display_, "WM_DELETE_WINDOW", 0); - - if (event -> xclient.message_type == wmProtocols && - (Atom)event -> xclient.data.l[0] == wmDeleteWindow) - { - logTest("Updater::handleInput", "Got client message of type WM_PROTOCOLS and value WM_DELETE_WINDOW," - " throwing exception UpdaterClosing."); - - delete event; - - throw UpdaterClosing(); - } - else - { - logTest("Updater::handleInput", "Unexpected client message type [%ld] format [%d] first value [%ld]", - event -> xclient.message_type, event -> xclient.format, event -> xclient.data.l[0]); - } - - break; - }*/ - case KeyPress: - case KeyRelease: - case ButtonPress: - case ButtonRelease: - case MotionNotify: - { - input_ -> pushEvent(display_, event); - - event = new XEvent; - - if (event == NULL) - { - logError("Updater::handleInput", ESET(ENOMEM)); - - return; - } - - break; - } - default: - { - logTest("Updater::handleInput", "Handling unexpected event [%d].", event -> type); - - break; - } - } - } - - delete event; -} - -void Updater::newRegion() -{ - if (updateRegion_ != NULL) - { - XDestroyRegion(updateRegion_); - } - - updateRegion_ = XCreateRegion(); - - logTest("Updater::newRegion", "updateRegion_ [%p].", updateRegion_); -} -// -// Private functions. -// diff --git a/nxcompshad/Updater.h b/nxcompshad/Updater.h deleted file mode 100644 index 10d75c0d6..000000000 --- a/nxcompshad/Updater.h +++ /dev/null @@ -1,103 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Updater_H -#define Updater_H - -#include - -#include "Regions.h" -#include "Input.h" - -class UpdaterClosing {}; - -class Updater -{ - public: - - Updater(char *displayName, Display *display); - - ~Updater(); - - int init(int, int, char *, Input*); - - void addRegion(Region r); - - void update(); - - void handleInput(); - - XImage *getImage(); - - Region getUpdateRegion(); - - void newRegion(); - - private: - - Input *input_; - - static inline Bool anyEventPredicate(Display*, XEvent*, XPointer); - - void handleKeyboardEvent(XEvent &event); - - char *displayName_; - - char *buffer_; - - bool closeDisplay_; - - Display *display_; - - int depth_; - - int width_; - int height_; - - int bpl_; - - Window window_; - XImage *image_; - - Pixmap pixmap_; - - Region updateRegion_; - -}; - -Bool Updater::anyEventPredicate(Display*, XEvent*, XPointer) -{ - return true; -} - -inline XImage* Updater::getImage() -{ - return image_; -} -inline Region Updater::getUpdateRegion() -{ - return updateRegion_; -} -#endif /* Updater_H */ diff --git a/nxcompshad/Win.cpp b/nxcompshad/Win.cpp deleted file mode 100644 index b3a06f415..000000000 --- a/nxcompshad/Win.cpp +++ /dev/null @@ -1,1145 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#if defined(__CYGWIN32__) || defined(WIN32) - -#include - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include "Poller.h" -#include "Logger.h" - -Poller::Poller(Input *input, Display *display, int depth) : CorePoller(input, display) -{ - logTrace("Poller::Poller"); - - screenDC_ = NULL; - screenBmp_ = NULL; - memoryDC_ = NULL; - pDIBbits_ = NULL; - DIBBuffer_ = NULL; - pKey_ = NULL; - pMouse_ = NULL; - path_ = NULL; - keymapName_ = input -> getKeymap(); - keymap_ = NULL; - toggleButtonState_ = 0; - serverModifierState_ = 0; - display_ = display; - depth_ = DefaultDepth(display_, DefaultScreen(display_)); - oldCursor_ = 0; - xCursor_ = 0; -} - -Poller::~Poller() -{ - logTrace("Poller::~Poller"); - - if (screenDC_) - { - BOOL result = ReleaseDC(NULL, screenDC_); - - logTest("Poller::~Poller", "ReleaseDC returned [%d].", result); - - screenDC_ = NULL; - } - - if (memoryDC_) - { - BOOL result = DeleteDC(memoryDC_); - - logTest("Poller::~Poller", "DeleteDC returned [%d].", result); - - memoryDC_ = NULL; - } - - if (screenBmp_) - { - BOOL result = DeleteObject(screenBmp_); - - logTest("Poller::~Poller", "DeleteObject returned [%d].", result); - - screenBmp_ = NULL; - } - - if (DIBBuffer_) - { - logDebug("Poller::~Poller", "Delete DIBBuffer_ [%p].", DIBBuffer_); - - delete [] DIBBuffer_; - } - - if (pKey_) - { - logDebug("Poller::~Poller", " pKey_[%p].", pKey_); - - delete [] pKey_; - } - - if (pMouse_) - { - logDebug("Poller::~Poller", " pMouse_[%p].", pMouse_); - - delete [] pMouse_; - } - - if (keymap_) - { - logDebug("Poller::~Poller", " keymap_[%p].", keymap_); - - delete [] keymap_; - } -} - -int Poller::init() -{ - logTrace("Poller::init"); - - int maxLengthArrayINPUT = 6; - - platformOS(); - - pKey_ = new INPUT [maxLengthArrayINPUT]; - - if (pKey_ == NULL) - { - logError("Poller::init", ESET(ENOMEM)); - - return -1; - } - - for (int i = 0; i < maxLengthArrayINPUT; i++) - { - pKey_[i].type = INPUT_KEYBOARD; - pKey_[i].ki.wVk = (WORD) 0; - pKey_[i].ki.time = (DWORD) 0; - pKey_[i].ki.dwExtraInfo = (DWORD) 0; - } - - pMouse_ = new INPUT; - - if (pMouse_ == NULL) - { - logError("Poller::init", ESET(ENOMEM)); - - return -1; - } - - pMouse_ -> type = INPUT_MOUSE; - - pMouse_ -> mi.dx = 0; - pMouse_ -> mi.dy = 0; - pMouse_ -> mi.mouseData = (DWORD) 0; - pMouse_ -> mi.time = 0; - pMouse_ -> mi.dwExtraInfo = (ULONG_PTR) NULL; - - screenDC_ = GetDC(NULL); - - if (screenDC_ == NULL) - { - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - - switch(depth_) - { - case 8: - { - depth_ = 16; - break; - } - case 16: - { - depth_ = 16; - break; - } - case 24: - { - depth_ = 32; - break; - } - default: - { - logError("Poller::init", ESET(EINVAL)); - - return -1; - } - } - - width_ = GetDeviceCaps(screenDC_, HORZRES); - height_ = GetDeviceCaps(screenDC_, VERTRES); - - bpl_ = width_ * (depth_ >> 3); - bpp_ = (depth_ >> 3); - - logTest("Poller::init", "Screen geometry is [%d, %d] depth is [%d] bpl [%d] bpp [%d].", - width_, height_, depth_, bpl_, bpp_); - - logTest("Poller::init", "Got device context at [%p] screen size is (%d,%d).", - screenDC_, width_, height_); - - memoryDC_ = CreateCompatibleDC(screenDC_); - - if (memoryDC_ == NULL) - { - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - - // - // Delete the old bitmap for the memory device. - // - - HBITMAP bitmap = (HBITMAP) GetCurrentObject(memoryDC_, OBJ_BITMAP); - - if (bitmap && DeleteObject(bitmap) == 0) - { - logError("Poller::init", ESET(ENOMSG)); - } - - // - // Bitmap header describing the bitmap we want to get from GetDIBits. - // - - bmi_.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); - bmi_.bmiHeader.biWidth = width_; - bmi_.bmiHeader.biHeight = -height_; - bmi_.bmiHeader.biPlanes = 1; - bmi_.bmiHeader.biBitCount = depth_; - bmi_.bmiHeader.biCompression = BI_RGB; - bmi_.bmiHeader.biSizeImage = 0; - bmi_.bmiHeader.biXPelsPerMeter = 0; - bmi_.bmiHeader.biYPelsPerMeter = 0; - bmi_.bmiHeader.biClrUsed = 0; - bmi_.bmiHeader.biClrImportant = 0; - - screenBmp_ = CreateDIBSection(memoryDC_, &bmi_, DIB_RGB_COLORS, &pDIBbits_, NULL, 0); - ReleaseDC(NULL,memoryDC_); - - if (screenBmp_ == NULL) - { - logTest ("Poller::init", "This video device is not supporting DIB section"); - - pDIBbits_ = NULL; - - screenBmp_ = CreateCompatibleBitmap(screenDC_, width_, height_); - - if (screenBmp_ == NULL) - { - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - - if (SelectObject(memoryDC_, screenBmp_) == NULL) - { - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - } - else - { - logTest ("Poller::init", "Enabled the DIB section"); - - if (SelectObject(memoryDC_, screenBmp_) == NULL) - { - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - } - - // - // Check if the screen device raster capabilities - // support the bitmap transfer. - // - - if ((GetDeviceCaps(screenDC_, RASTERCAPS) & RC_BITBLT) == 0) - { - logTest("Poller::init", "This video device is not supporting the bitmap transfer."); - - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - - // - // Check if the memory device raster capabilities - // support the GetDIBits and SetDIBits functions. - // - - if ((GetDeviceCaps(memoryDC_, RASTERCAPS) & RC_DI_BITMAP) == 0) - { - logTest("Poller::init", "This memory device is not supporting the GetDIBits and SetDIBits " - "function."); - - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - - if (GetDeviceCaps(screenDC_, PLANES) != 1) - { - logTest("Poller::init", "This video device has more than 1 color plane."); - - logError("Poller::init", ESET(ENOMSG)); - - return -1; - } - - return CorePoller::init(); -} - -// -// FIXME: Remove me. -// - -void ErrorExit(LPTSTR lpszFunction) -{ - LPVOID lpMsgBuf; - DWORD dw = GetLastError(); - - FormatMessage( - FORMAT_MESSAGE_ALLOCATE_BUFFER | - FORMAT_MESSAGE_FROM_SYSTEM, - NULL, - dw, - MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), - (LPTSTR) &lpMsgBuf, - 0, NULL ); - - logTest(lpszFunction, " Failed with error [%ld]: %s", dw, (char*)lpMsgBuf); - - LocalFree(lpMsgBuf); - ExitProcess(dw); -} - -// -// FIXME: End. -// - -char *Poller::getRect(XRectangle r) -{ - logTrace("Poller::getRect"); - - logDebug("Poller::getRect", "Going to retrive rectangle [%d, %d, %d, %d].", - r.x, r.y, r.width, r.height); - - // - // The CAPTUREBLT operation could be a very - // cpu-consuming task. We should make some - // test to see how much it is expensive. - // Anyway we get tooltip windows and any - // other special effect not included with - // only the SRCCOPY operation. - // - - if (BitBlt(memoryDC_, r.x, r.y, r.width, r.height, - screenDC_, r.x, r.y, SRCCOPY | CAPTUREBLT) == 0) - { - logError("Poller::getRect", ESET(ENOMSG)); - - logTest("Poller::getRect", "Failed to perform a bit-block transfer."); - logTest("Poller::getRect", "bit-block error=%lu", GetLastError()); - - return NULL; - } - - // bmi_.bmiHeader.biWidth = r.width; - // bmi_.bmiHeader.biHeight = -r.height; - - if (pDIBbits_ == NULL) - { - static long nPixel = 0; - - if (nPixel < r.width * r.height) - { - - if (DIBBuffer_) - { - delete [] DIBBuffer_; - } - - nPixel = r.width * r.height; - - DIBBuffer_ = new char [nPixel * bpp_]; - - if (DIBBuffer_ == NULL) - { - logError("Poller::getRect", ESET(ENOMEM)); - - nPixel = 0; - - return NULL; - } - } - - if (GetDIBits(memoryDC_, screenBmp_, height_ - r.height - r.y, r.height, - DIBBuffer_, &bmi_, DIB_RGB_COLORS) == 0) - { - logError("Poller::getRect", ESET(ENOMSG)); - - logTest("Poller::getRect", "Failed to retrieve the screen bitmap."); - - return NULL; - } - - return DIBBuffer_; - } - else - { - return (char *) pDIBbits_ + r.y * bpl_ + r.x * bpp_; - } -} - -void Poller::handleKeyboardEvent(Display *display, XEvent *event) -{ - KeySym keysym; - char *keyname = new char [31]; - keyTranslation tr = {0, 0}; - unsigned char scancode = 0; - int lengthArrayINPUT = 0; - - if (XLookupString((XKeyEvent *) event, keyname, 30, &keysym, NULL) > 0) - { - logTest("Poller::handleKeyboardEvent", "keyname %s, keysym [%x]", keyname, (unsigned int)keysym); - } - - if (specialKeys(keysym, event -> xkey.state, event -> type) == 1) - { - delete[] keyname; - return; - } - - tr = xkeymapTranslateKey(keysym, event -> xkey.keycode, event -> xkey.state); - scancode = tr.scancode; - - logTest("Poller::handleKeyboardEvent", "keyname [%s] scancode [0x%x], keycode[0x%x], keysym [%x]", keyname, - tr.scancode, event ->xkey.keycode, (unsigned int)keysym); - - if (scancode == 0) - { - delete[] keyname; - return; - } - - if (event -> type == KeyPress) - { - int test1 = MapVirtualKey(scancode, MAPVK_VSC_TO_VK_EX); - int test2 = MapVirtualKey(0x24, MAPVK_VSC_TO_VK_EX); - - if (test1 == test2) - { - simulateCtrlAltDel(); - } - - if (isModifier(scancode) == 0) - { - savedServerModifierState_ = serverModifierState_; - } - - ensureServerModifiers(tr, &lengthArrayINPUT); - if (sendInput(scancode, 1, &lengthArrayINPUT) == 0) - { - logTest("Poller::handleKeyboardEvent", "lengthArrayINPUT [%d].", lengthArrayINPUT); - } - restoreServerModifiers(scancode); - } - else if (event -> type == KeyRelease) - { - if (sendInput(scancode, 0, &lengthArrayINPUT) == 0) - { - logTest("Poller::handleKeyboardEvent", "lengthArrayINPUT [%d].", lengthArrayINPUT); - } - } - - updateModifierState(scancode, (event -> type == KeyPress)); - - delete[] keyname; -} - -void Poller::handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) -{ -/* -FIXME -*/ -} - -void Poller::handleMouseEvent(Display *display, XEvent *event) -{ - DWORD flg = 0; - DWORD whl = 0; - - if (event -> type == ButtonPress) - { - logTest("Poller::handleMouseEvent", "ButtonPress.\n"); - switch (event -> xbutton.button) - { - case Button1: - { - flg = MOUSEEVENTF_LEFTDOWN; - break; - } - case Button2: - { - flg = MOUSEEVENTF_MIDDLEDOWN; - break; - } - case Button3: - { - flg = MOUSEEVENTF_RIGHTDOWN; - break; - } - case Button4: - { - flg = MOUSEEVENTF_WHEEL; - whl = WHEEL_DELTA; - pMouse_ -> mi.mouseData = whl; - break; - } - case Button5: - { - flg = MOUSEEVENTF_WHEEL; - whl = (DWORD) (-WHEEL_DELTA); - pMouse_ -> mi.mouseData = whl; - break; - } - } - } - else if (event -> type == ButtonRelease) - { - switch (event -> xbutton.button) - { - case Button1: - { - flg = MOUSEEVENTF_LEFTUP; - break; - } - case Button2: - { - flg = MOUSEEVENTF_MIDDLEUP; - break; - } - case Button3: - { - flg = MOUSEEVENTF_RIGHTUP; - break; - } - case Button4: - { - flg = MOUSEEVENTF_WHEEL; - whl = 0; - pMouse_ -> mi.mouseData = whl; - break; - } - case Button5: - { - flg = MOUSEEVENTF_WHEEL; - whl = 0; - pMouse_ -> mi.mouseData = whl; - break; - } - } - } - else if (event -> type == MotionNotify) - { - logTest("Poller::handleMouseEvent", "SetCursor - MotionNotify"); - - SetCursorPos(event -> xmotion.x, event -> xmotion.y); - } - - if (flg > 0) - { - // logTest("Poller::handleMouseEvent", "SetCursor - flg > 0"); - // - // FIXME: move the cursor to the pace the event occurred - // - - SetCursorPos(event -> xbutton.x, event -> xbutton.y); - - // - // FIXME: Remove me: send the click/release event - // mouse_event(flg, 0, 0, whl, (ULONG_PTR)NULL); - // - - pMouse_ -> mi.dwFlags = flg; - - if (SendInput(1, pMouse_, sizeof(INPUT)) == 0) - { - logTest("Poller::handleMouseEvent", "Failed SendInput"); - } - } -} - -int Poller::updateCursor(Window wnd, Visual* vis) -{ - BYTE *mBits, *andBits, *xorBits; - - logTrace("Poller::Cursor"); - - // - // Retrieve mouse cursor handle. - // - - CURSORINFO cursorInfo; - cursorInfo.cbSize = sizeof(CURSORINFO); - - if (GetCursorInfo(&cursorInfo) == 0) - { - logTest("Poller::Cursor", "GetCursorInfo() failed [%u].\n", (unsigned int)GetLastError()); - LocalFree(&cursorInfo); - return -1; - } - - HCURSOR hCursor = cursorInfo.hCursor; - - if (hCursor == 0) - { - logTest("Poller::Cursor","Cursor Handle is NULL. Error[%u].\n", (unsigned int)GetLastError()); - return 1; - } - - if (hCursor == oldCursor_) - { - LocalFree(&cursorInfo); - return 1; - } - else - { - oldCursor_ = hCursor; - } - - // - // Get cursor info. - // - - // logTest("Poller::Cursor","hCursor [%xH] GetCursor [%xH].\n", hCursor, GetCursor()); - - ICONINFO iconInfo; - if (GetIconInfo(hCursor, &iconInfo) == 0) - { - logTest("Poller::Cursor","GetIconInfo() failed. Error[%d].", (unsigned int)GetLastError()); - LocalFree(&iconInfo); - // return -1; - } - - BOOL isColorCursor = FALSE; - if (iconInfo.hbmColor != NULL) - { - isColorCursor = TRUE; - } - - if (iconInfo.hbmMask == NULL) - { - logTest("Poller::Cursor","Cursor bitmap handle is NULL.\n"); - return -1; - } - - // - // Check bitmap info for the cursor - // - - BITMAP bmMask; - if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), (LPVOID)&bmMask)) - { - logTest("Poller::Cursor","GetObject() for bitmap failed.\n"); - DeleteObject(iconInfo.hbmMask); - LocalFree(&bmMask); - return -1; - } - - if (bmMask.bmPlanes != 1 || bmMask.bmBitsPixel != 1) - { - logTest("Poller::Cursor","Incorrect data in cursor bitmap.\n"); - LocalFree(&bmMask); - DeleteObject(iconInfo.hbmMask); - return -1; - } - - // Get monochrome bitmap data for cursor - // NOTE: they say we should use GetDIBits() instead of GetBitmapBits(). - mBits = new BYTE[bmMask.bmWidthBytes * bmMask.bmHeight]; - - if (mBits == NULL)//Data bitmap - { - DeleteObject(iconInfo.hbmMask); - DestroyCursor(cursorInfo.hCursor); - LocalFree(&iconInfo); - LocalFree(&bmMask); - delete[] mBits; - return -1; - } - - BOOL success = GetBitmapBits(iconInfo.hbmMask, bmMask.bmWidthBytes * bmMask.bmHeight, mBits); - - if (!success) - { - logTest("Poller::Cursor","GetBitmapBits() failed.\n"); - delete[] mBits; - return -1; - } - - andBits = mBits; - - long width = bmMask.bmWidth; - long height = (isColorCursor) ? bmMask.bmHeight : bmMask.bmHeight/2; - - // - // The bitmask is formatted so that the upper half is - // the icon AND bitmask and the lower half is the icon XOR bitmask. - // - - if (!isColorCursor) - { - xorBits = andBits + bmMask.bmWidthBytes * height; - -/* logTest("Poller::Cursor","no color widthB[%ld] width[%ld] height[%ld] totByte[%ld] mbits[%ld].\n", - bmMask.bmWidthBytes,width,height,success,bmMask.bmHeight * bmMask.bmWidthBytes);*/ - - if (xCursor_ > 0) - { - XFreeCursor(display_, xCursor_); - } - - xCursor_ = createCursor(wnd, vis, (unsigned int)iconInfo.xHotspot, (unsigned int)iconInfo.yHotspot, - width, height, (unsigned char *)xorBits, (unsigned char *)andBits); - - XDefineCursor(display_, wnd, xCursor_); - } - - delete []mBits; - DeleteObject(iconInfo.hbmMask); - LocalFree(&bmMask); - DestroyCursor(cursorInfo.hCursor); - LocalFree(&iconInfo); - - return success; -} - -unsigned char Poller::specialKeys(unsigned int keysym, unsigned int state, int pressed) -{ - return 0; -} - -void Poller::ensureServerModifiers(keyTranslation tr, int *lengthArrayINPUT) -{ - return; -} - -void Poller::restoreServerModifiers(UINT scancode) -{ - keyTranslation dummy; - int lengthArrayINPUT = 0; - - if (isModifier(scancode) == 1) - { - return; - } - - dummy.scancode = 0; - dummy.modifiers = savedServerModifierState_; - ensureServerModifiers(dummy, &lengthArrayINPUT); - if (sendInput(0, 0, &lengthArrayINPUT) == 0) - { - logTest("Poller::restoreServerModifiers", "lengthArrayINPUT [%d]", lengthArrayINPUT); - } -} - -int Poller::updateShadowFrameBuffer(void) -{ - return 1; -} - -void Poller::addToKeymap(char *keyname, unsigned char scancode, unsigned short modifiers, char *mapname) -{ - return; -} - -FILE *Poller::xkeymapOpen(char *filename) -{ - return NULL; -} - -int Poller::xkeymapRead(char *mapname) -{ - return 1; -} - -void Poller::xkeymapInit(char *keyMapName) -{ - return; -} - -keyTranslation Poller::xkeymapTranslateKey(unsigned int keysym, unsigned int keycode, - unsigned int state) -{ - keyTranslation tr = { 0, 0 }; - - return tr; -} - -unsigned char Poller::getKeyState(unsigned int state, unsigned int keysym) -{ - return 0; -} - -char *Poller::getKsname(unsigned int keysym) -{ - char *ksname = NULL; - - return ksname; -} - -// -// Routine used to fool Winlogon into thinking CtrlAltDel was pressed -// -char Poller::simulateCtrlAltDel(void) -{ - HDESK oldDesktop = GetThreadDesktop(GetCurrentThreadId()); - - // - // Switch into the Winlogon desktop. - // - if (selectDesktopByName("Winlogon") == 0) - { - logTest("SimulateCtrlAltDelThreadFn","Failed to select logon desktop."); - return 0; - } - - logTest("SimulateCtrlAltDelThreadFn","Generating ctrl-alt-del."); - - // - // Winlogon uses hotkeys to trap Ctrl-Alt-Del. - // - PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)); - - // - // Switch back to our original desktop. - // - if (oldDesktop != NULL) - { - selectDesktop(oldDesktop); - } - - return 1; -} - -// Switches the current thread into a different desktop by desktop handle -// This call takes care of all the evil memory management involved -char Poller::selectDesktop(HDESK newDesktop) -{ - // - // Only on NT. - // - if (isWinNT()) - { - HDESK oldDesktop = GetThreadDesktop(GetCurrentThreadId()); - - DWORD dummy; - char newName[256]; - - if (GetUserObjectInformation(newDesktop, UOI_NAME, &newName, 256, &dummy) == 0) - { - logDebug("Poller::selectDesktop","GetUserObjectInformation() failed. Error[%lu].", GetLastError()); - return 0; - } - - logTest("Poller::selectDesktop","New Desktop to [%s] (%x) from (%x).", - newName, (unsigned int)newDesktop, (unsigned int)oldDesktop); - - // - // Switch the desktop. - // - if(SetThreadDesktop(newDesktop) == 0) - { - logDebug("Poller::SelectDesktop","Unable to SetThreadDesktop(), Error=%lu.", GetLastError()); - return 0; - } - - // - // Switched successfully - destroy the old desktop. - // - if (CloseDesktop(oldDesktop) == 0) - { - logDebug("Poller::selectHdesk","Failed to close old desktop (%x), Error=%lu.", - (unsigned int)oldDesktop, GetLastError()); - return 0; - } - } - - return 1; -} - -// -// Switches the current thread into a different desktop, by name -// Calling with a valid desktop name will place the thread in that desktop. -// Calling with a NULL name will place the thread in the current input desktop. -// - -char Poller::selectDesktopByName(char *name) -{ - // - // Only on NT. - // - if (isWinNT()) - { - HDESK desktop; - - if (name != NULL) - { - // - // Attempt to open the named desktop. - // - desktop = OpenDesktop(name, 0, FALSE, - DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | - DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | - DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | - DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); - } - else - { - // - // Open the input desktop. - // - desktop = OpenInputDesktop(0, FALSE, - DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | - DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | - DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | - DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); - } - - if (desktop == NULL) - { - logDebug("Poller::selectDesktopByName","Unable to open desktop, Error=%lu.", GetLastError()); - return 0; - } - - // - // Switch to the new desktop - // - if (selectDesktop(desktop) == 0) - { - // - // Failed to enter the new desktop, so free it! - // - logDebug("Poller::selectDesktopByName","Failed to select desktop."); - - if (CloseDesktop(desktop) == 0) - { - logDebug("Poller::selectDesktopByName","Failed to close desktop, Error=%lu.", GetLastError()); - return 0; - } - } - - return 1; - } - - return (name == NULL); -} - -void Poller::platformOS() -{ - OSVERSIONINFO osversioninfo; - osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo); - - // - // Get the current OS version. - // - if (GetVersionEx(&osversioninfo) == 0) - { - platformID_ = 0; - } - platformID_ = osversioninfo.dwPlatformId; - -// -// versionMajor = osversioninfo.dwMajorVersion; -// versionMinor = osversioninfo.dwMinorVersion; -// -} - -char Poller::checkDesktop() -{ - // - // Only on NT. - // - if (isWinNT()) - { - // - // Get the input and thread desktops. - // - HDESK desktop = GetThreadDesktop(GetCurrentThreadId()); - HDESK inputDesktop = OpenInputDesktop(0, FALSE, - DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | - DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | - DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | - DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); - - if (inputDesktop == NULL) - { - return 0; - } - - DWORD dummy; - char desktopName[256]; - char inputName[256]; - - if (GetUserObjectInformation(desktop, UOI_NAME, &desktopName, 256, &dummy) == 0) - { - if (CloseDesktop(inputDesktop) == 0) - { - logDebug("Poller::checkDesktop", "Failed to close desktop, Error[%d].", (unsigned int)GetLastError()); - return 0; - } - } - - if (GetUserObjectInformation(inputDesktop, UOI_NAME, &inputName, 256, &dummy) == 0) - { - if (CloseDesktop(inputDesktop) == 0) - { - logDebug("Poller::checkDesktop", "Failed to close input desktop, Error[%d].", (unsigned int)GetLastError()); - return 0; - } - } - - if (strcmp(desktopName, inputName) != 0) - { - // - // Switch to new desktop. - // - selectDesktop(inputDesktop); - } - - if (CloseDesktop(desktop) == 0) - { - logDebug("Poller::checkDesktop", "Failed to close input desktop, Error[%d].", (unsigned int)GetLastError()); - return 0; - } - - if (CloseDesktop(inputDesktop) == 0) - { - logDebug("Poller::checkDesktop", "Failed to close input desktop, Error[%d].", (unsigned int)GetLastError()); - return 0; - } - } - - return 1; -} - -unsigned char Poller::isModifier(UINT scancode) -{ - return 0; -} - -void Poller::updateModifierState(UINT scancode, unsigned char pressed) -{ - return; -} - -Cursor Poller::createCursor(Window wnd, Visual *vis,unsigned int x, unsigned int y, - int width, int height, unsigned char *xormask, unsigned char *andmask) -{ - Pixmap maskglyph, cursorglyph; - XColor bg, fg; - Cursor xcursor; - unsigned char *cursor; - unsigned char *mask, *pmask, *pcursor, tmp; - int scanline, offset; - - scanline = (width + 7) / 8; - offset = scanline * height; - - pmask = andmask; - pcursor = xormask; - for (int i = 0; i < offset; i++) - { - // - // The pixel is black if both the bit of andmask and xormask is one. - // - - tmp = *pcursor & *pmask; - *pcursor ^= tmp; - *pmask ^= tmp; - - *pmask = ~(*pmask); - - pmask++; - pcursor++; - } - - cursor = new unsigned char[offset]; - memcpy(cursor, xormask, offset); - - mask = new unsigned char[offset]; - memcpy(mask, andmask, offset); - - fg.red = fg.blue = fg.green = 0xffff; - bg.red = bg.blue = bg.green = 0x0000; - fg.flags = bg.flags = DoRed | DoBlue | DoGreen; - - cursorglyph = createGlyph(wnd, vis, width, height, cursor); - maskglyph = createGlyph(wnd, vis, width, height, mask); - - xcursor = XCreatePixmapCursor(display_, cursorglyph, maskglyph, &fg, &bg, x, y); - - XFreePixmap(display_, maskglyph); - XFreePixmap(display_, cursorglyph); - delete[]mask; - delete[]cursor; - - return xcursor; -} - -Pixmap Poller::createGlyph(Window wnd, Visual *visual, int width, int height, unsigned char *data) -{ - XImage *image; - Pixmap bitmap; - int scanline; - GC glyphGC; - - scanline = (width + 7) / 8; - - bitmap = XCreatePixmap(display_, wnd, width, height, 1); - glyphGC = XCreateGC(display_, bitmap, 0, NULL); - - image = XCreateImage(display_, visual, 1, ZPixmap, 0, (char *)data, width, height, 8, scanline); - image->byte_order = 1; // MSBFirst -- LSBFirst = 0 - image->bitmap_bit_order = 1; - XInitImage(image); - -/* logTest("Poller::createGlyph","XPutImage on pixmap %d,%d,%d,%d.\n", - 0, 0, width, height);*/ - XPutImage(display_, bitmap, glyphGC, image, 0, 0, 0, 0, width, height); - XFree(image); - - return bitmap; -} -#endif /* defined(__CYGWIN32__) || defined(WIN32) */ diff --git a/nxcompshad/Win.h b/nxcompshad/Win.h deleted file mode 100644 index 615f9a5f5..000000000 --- a/nxcompshad/Win.h +++ /dev/null @@ -1,232 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifdef __CYGWIN32__ - -#ifndef Win32Poller_H -#define Win32Poller_H - -//#include - -#include -#include -#include -#include - -#define CAPTUREBLT 0x40000000 - -#define KEYEVENTF_SCANCODE 0x00000008 -#define MAPVK_VSC_TO_VK_EX 3 -// -// The CAPTUREBLT is a raster operation used -// in bit blit transfer. -// -// Using this operation includes any windows -// that are layered on top of your window in -// the resulting image. By default, the image -// only contains your window. -// - -#include "Core.h" - -typedef struct _keyTranslation -{ - unsigned char scancode; - unsigned short modifiers; - -}keyTranslation; - -class Poller : public CorePoller -{ - public: - - Display *display_; - keyTranslation *keymap_; - unsigned char keymapLoaded_; - int minKeycode_; - - Poller(Input *, Display *display, int = 16); - - ~Poller(); - - int init(); - - int updateCursor(Window, Visual*); - - private: - - - int Poller::updateShadowFrameBuffer(void); - void handleKeyboardEvent(Display *, XEvent *); - void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress); - void addToKeymap(char *keyname, unsigned char scancode, unsigned short modifiers, char *mapname); - int xkeymapRead(char *mapname); - FILE *xkeymapOpen(char *filename); - void xkeymapInit(char *keyMapName); - keyTranslation xkeymapTranslateKey(unsigned int keysym, unsigned int keycode, unsigned int state); - unsigned char getKeyState(unsigned int state, unsigned int keysym); - char *getKsname(unsigned int keysym); - unsigned char specialKeys(unsigned int keysym, unsigned int state, int pressed); - - unsigned char toggleSwitch(unsigned char ToggleStateClient, unsigned char ToggleStateServer, UINT scancode, - int *lengthArrayINPUT); - - void updateModifierState(UINT, unsigned char); - - unsigned char toggleServerState(UINT scancode); - unsigned char keyState(UINT scancode, UINT mapType); - unsigned char keyStateAsync(UINT scancode); - - void handleMouseEvent(Display *, XEvent *); - - Cursor createCursor(Window wnd, Visual *vis, unsigned int x, unsigned int y, int width, - int height, unsigned char *xormask, unsigned char *andmask); - - Pixmap createGlyph(Window wnd, Visual *visual, int width, int height, unsigned char *data); - - char isWinNT(); - char selectDesktop(HDESK new_desktop); - char selectDesktopByName(char *name); - void platformOS(); - char simulateCtrlAltDel(void); - DWORD platformID_; - - INPUT *pKey_, *pMouse_; - - char *keymapName_; - char *path_; - - unsigned char toggleButtonState_; - unsigned short serverModifierState_; - unsigned short savedServerModifierState_; - - void ensureServerModifiers(keyTranslation tr, int *lenghtArrayINPUT); - void restoreServerModifiers(UINT scancode); - unsigned char isModifier(UINT scancode); - - char sendInput(unsigned char scancode, unsigned char pressed, int *lengthArrayINPUT); - - char *getRect(XRectangle); - char checkDesktop(); - - char *DIBBuffer_; - - HCURSOR oldCursor_; - - VOID *pDIBbits_; - HDC screenDC_; - HDC memoryDC_; - BITMAPINFO bmi_; - HBITMAP screenBmp_; - - Cursor xCursor_; - -}; - -#undef TEST - -inline unsigned char Poller::toggleSwitch(unsigned char ToggleStateClient, unsigned char ToggleStateServer, - UINT scancode, int *lengthArrayINPUT) -{ - return 1; -} - -inline unsigned char Poller::toggleServerState(UINT scancode) -{ - return (GetKeyState(MapVirtualKeyEx(scancode, 3, GetKeyboardLayout((DWORD)NULL))) & 0x1); -} - -inline unsigned char Poller::keyStateAsync(UINT vKeycode) -{ - return GetAsyncKeyState(vKeycode); -} - -inline unsigned char Poller::keyState(UINT code, UINT mapType) -{ - if (mapType == 0) - { - // - // Virtual Keycode - // - return ((GetKeyState(code) & 0x80) == 0x80); - } - else - { - // - // scancode - // - return ((GetKeyState(MapVirtualKeyEx(code, 3, GetKeyboardLayout((DWORD)NULL))) & 0x80) == 0x80); - } -} - -inline char Poller::isWinNT() -{ - return (platformID_ == VER_PLATFORM_WIN32_NT); -} - -inline char Poller::sendInput(unsigned char scancode, unsigned char pressed, int *lengthArrayINPUT) -{ - DWORD keyEvent = 0; - DWORD extended = 0; - - if (scancode > 0) - { - if (pressed == 0) - { - keyEvent = KEYEVENTF_KEYUP; - } - - if (scancode & 0x80) - { - scancode &= ~0x80; - extended = KEYEVENTF_EXTENDEDKEY; - } - - pKey_[*lengthArrayINPUT].ki.wScan = (WORD) scancode; - pKey_[*lengthArrayINPUT].ki.dwFlags = (DWORD) (keyEvent | KEYEVENTF_SCANCODE | extended); - (*lengthArrayINPUT)++; - } - - - if (*lengthArrayINPUT > 0) { - // FIXME: Remove me. - logTest("Poller::sendInput", "length Input [%d] event: %s", *lengthArrayINPUT, - pressed == 1 ? "KeyPress": "KeyRelease"); - - if (SendInput(*lengthArrayINPUT, pKey_, sizeof(INPUT)) == 0) - { - logTest("Poller::sendInput", "Failed SendInput, event: %s", pressed == 1 ? "KeyPress": "KeyRelease"); - *lengthArrayINPUT = 0; - return 0; - } - - *lengthArrayINPUT = 0; - } - - return 1; -} -#endif /* Win32Poller_H */ - -#endif /* __CYGWIN32__ */ diff --git a/nxcompshad/X11.cpp b/nxcompshad/X11.cpp deleted file mode 100644 index d1af82281..000000000 --- a/nxcompshad/X11.cpp +++ /dev/null @@ -1,1594 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#if !defined(__CYGWIN32__) && !defined(WIN32) - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include -#include -#include -#include "X11/include/XTest_nxcompshad.h" -#include -#include -#include - -#include "Poller.h" -#include "Logger.h" -#include "Shadow.h" - -#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) - -#undef TRANSLATE_KEYCODES -#define TRANSLATE_ALWAYS - -typedef struct { - KeySym *map; - KeyCode minKeyCode, - maxKeyCode; - int mapWidth; -} KeySymsRec, *KeySymsPtr; - -extern KeySymsPtr NXShadowKeymap; - -typedef struct _KeyPressed -{ - KeyCode keyRcvd; - KeyCode keySent; - struct _KeyPressed *next; -} KeyPressedRec; - -static KeyPressedRec *shadowKeyPressedPtr = NULL; - -static KeySym *shadowKeysyms = NULL; -static KeySym *masterKeysyms = NULL; - -static KeySym *shadowKeymap = NULL; - -static int shadowMinKey, shadowMaxKey, shadowMapWidth; -static int masterMinKey, masterMaxKey, masterMapWidth; - -static int leftShiftOn = 0; -static int rightShiftOn = 0; -static int modeSwitchOn = 0; -static int level3ShiftOn = 0; -static int altROn = 0; - -static int sentFakeLShiftPress = 0; -static int sentFakeLShiftRelease = 0; -static int sentFakeRShiftRelease = 0; -static int sentFakeModeSwitchPress = 0; -static int sentFakeModeSwitchRelease = 0; -static int sentFakeLevel3ShiftPress = 0; -static int sentFakeLevel3ShiftRelease = 0; -static int sentFakeAltRRelease = 0; - -static int shmInitTrap = 0; - -Poller::Poller(Input *input, Display *display, int depth) : CorePoller(input, display) -{ - logTrace("Poller::Poller"); - - display_ = NULL; - shadowDisplayName_ = input -> getShadowDisplayName(); - - tmpBuffer_ = NULL; - - xtestExtension_ = -1; - shmExtension_ = -1; - randrExtension_ = -1; - damageExtension_ = -1; - - shadowDisplayUid_ = -1; - - image_ = NULL; - - shminfo_ = NULL; -} - -Poller::~Poller() -{ - logTrace("Poller::~Poller"); - - if (shmExtension_ == 1) - { - XShmDetach(display_, shminfo_); - XDestroyImage(image_); - shmdt(shminfo_ -> shmaddr); - shmctl(shminfo_ -> shmid, IPC_RMID, 0); - } - - if (shminfo_ != NULL) - { - delete shminfo_; - - shminfo_ = NULL; - } - - if (display_ != NULL) - { - XCloseDisplay(display_); - } - - if (tmpBuffer_ != NULL && shmExtension_ != -1 && damageExtension_ == 1) - { - XFree(tmpBuffer_); - - tmpBuffer_ = NULL; - } -} - -int Poller::init() -{ - logTrace("Poller::init"); - - if (display_ == NULL) - { - display_ = XOpenDisplay(shadowDisplayName_); - - setShadowDisplay(display_); - } - - logTest("Poller::init:" ,"Shadow display [%p] name [%s].", (Display *) display_, shadowDisplayName_); - - if (display_ == NULL) - { - logTest("Poller::init", "Failed to connect to display [%s].", shadowDisplayName_ ? shadowDisplayName_ : ""); - - return -1; - } - - setRootSize(); - - logTest("Poller::init", "Screen geometry is [%d, %d] depth is [%d] bpl [%d] bpp [%d].", - width_, height_, depth_, bpl_, bpp_); - - xtestInit(); - - shmInit(); - - randrInit(); - - damageInit(); - - return CorePoller::init(); -} - -int Poller::updateShadowFrameBuffer(void) -{ - if (shmExtension_ == 1) - { - if (XShmGetImage(display_, DefaultRootWindow(display_), image_, 0, 0, AllPlanes) == 0) - { - logDebug("Poller::updateShadowFrameBuffer", "XShmGetImage failed!"); - - return -1; - } - } - else - { - image_ = XGetImage(display_, DefaultRootWindow(display_), 0, 0, width_, - height_, AllPlanes, ZPixmap); - - if (image_ == NULL) - { - logDebug("Poller::updateShadowFrameBuffer", "XGetImage failed!"); - - return -1; - } - } - - return 1; -} - -char *Poller::getRect(XRectangle r) -{ - logTrace("Poller::getRect"); - - logDebug("Poller::getRect", "Going to retrive rectangle [%d, %d, %d, %d].", - r.x, r.y, r.width, r.height); - - if (shmExtension_ == 1) - { - if (damageExtension_ == 1) - { - image_ -> width = r.width; - image_ -> height = r.height; - - image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); - - if (XShmGetImage(display_, DefaultRootWindow(display_), image_, r.x, r.y, AllPlanes) == 0) - { - logDebug("Poller::getRect", "XShmGetImage failed!"); - - return NULL; - } - - tmpBuffer_ = image_ -> data; - } - else - { - image_ -> width = r.width; - image_ -> height = r.height; - - image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); - - if (XShmGetImage(display_, DefaultRootWindow(display_), image_, r.x, r.y, AllPlanes) == 0) - { - logDebug("Poller::getRect", "XShmGetImage failed!"); - } - - tmpBuffer_ = image_ -> data; - } - } - else - { - if (tmpBuffer_) - { - XFree(tmpBuffer_); - tmpBuffer_ = NULL; - } - - image_ = XGetImage(display_, DefaultRootWindow(display_), r.x, r.y, r.width, r.height, AllPlanes, ZPixmap); - - if (image_ == NULL) - { - logError("Poller::getRect", ESET(ENOMSG)); - - return NULL; - } - - tmpBuffer_ = image_ -> data; - - if (image_ -> obdata) - { - XFree(image_ -> obdata); - } - - XFree(image_); - - image_ = NULL; - } - - return tmpBuffer_; -} - -void Poller::shmInit(void) -{ - int major, minor; - int pixmaps; - - logTest("Poller::shmInit", "Added shmExtension_ [%d].", shmExtension_); - - if (shmExtension_ >= 0) - { - logDebug("Poller::shmInit", "Called with shared memory already initialized."); - - if (shmInitTrap == 0) - { - return; - } - } - - if (shmExtension_ < 0 && NXShadowOptions.optionShmExtension == 0) - { - shmExtension_ = 0; - - logUser("Poller::shmInit: Disabling use of MIT-SHM extension.\n"); - - return; - } - - if (XShmQueryVersion(display_, &major, &minor, &pixmaps) == 0) - { - logDebug("Poller::shmInit", "MIT_SHM: Shared memory extension not available."); - - shmExtension_ = 0; - } - else - { - logDebug("Poller::shmInit", "MIT_SHM: Shared memory extension available."); - - if (shminfo_ != NULL) - { - destroyShmImage(); - } - - shminfo_ = (XShmSegmentInfo* ) new XShmSegmentInfo; - - if (shminfo_ == NULL) - { - logError("Poller::shmInit", ESET(ENOMEM)); - - shmExtension_ = 0; - - return; - } - - image_ = (XImage *)XShmCreateImage(display_, display_ -> screens[0].root_visual, depth_, ZPixmap, - NULL, shminfo_, width_, height_); - - if (image_ == NULL) - { - logError("Poller::shmInit", ESET(ENOMSG)); - - shmExtension_ = 0; - - return; - } - - shadowDisplayUid_ = NXShadowOptions.optionShadowDisplayUid; - - logDebug("Poller::shmInit", "Master X server uid [%d].", NXShadowOptions.optionShadowDisplayUid); - - shminfo_ -> shmid = shmget(IPC_PRIVATE, image_ -> bytes_per_line * image_ -> height, IPC_CREAT | 0666); - - if (shminfo_ -> shmid < 0) - { - logDebug("Poller::shmInit", "kernel id error."); - - shmExtension_ = 0; - - return; - } - - logDebug("Poller::shmInit", "Created shm segment with shmid [%d].", shminfo_ -> shmid); - - shminfo_ -> shmaddr = (char *)shmat(shminfo_ -> shmid, 0, 0); - - if (shminfo_ -> shmaddr < 0) - { - logWarning("Poller::shmInit", "Couldn't attach to shm segment."); - } - - logDebug("Poller::shmInit", "shminfo_ -> shmaddr [%p].", shminfo_ -> shmaddr); - - image_ -> data = shminfo_ -> shmaddr; - - shminfo_ -> readOnly = 0; - - if (XShmAttach(display_, shminfo_) == 0) - { - logDebug("Poller::shmInit", "XShmAttach failed."); - - shmExtension_ = 0; - - return; - } - - // - // Mark the shm segment to be destroyed after - // the last process detach. Let the X server - // complete the X_ShmAttach request, before. - // - - XSync(display_, 0); - - struct shmid_ds ds; - - shmctl(shminfo_ -> shmid, IPC_STAT, &ds); - - if (shadowDisplayUid_ != -1) - { - ds.shm_perm.uid = (ushort) shadowDisplayUid_; - } - else - { - logWarning("Poller::shmInit", "Couldn't set uid for shm segment."); - } - - ds.shm_perm.mode = 0600; - - shmctl(shminfo_ -> shmid, IPC_SET, &ds); - - shmctl(shminfo_ -> shmid, IPC_STAT, &ds); - - shmctl(shminfo_ -> shmid, IPC_RMID, 0); - - logDebug("Poller::shmInit", "Number of attaches to shm segment [%d] are [%d].\n", - shminfo_ -> shmid, (int) ds.shm_nattch); - - if (ds.shm_nattch > 2) - { - logWarning("Poller::shmInit", "More than two attaches to the shm segment."); - - destroyShmImage(); - - shmExtension_ = 0; - - return; - } - - shmExtension_ = 1; - } -} - -void Poller::keymapShadowInit(Display *display) -{ - int i, len; - CARD32 *map; - - if (NXShadowKeymap != NULL) - { - shadowMinKey = NXShadowKeymap -> minKeyCode; - shadowMaxKey = NXShadowKeymap -> maxKeyCode; - shadowMapWidth = NXShadowKeymap -> mapWidth; - - len = (shadowMaxKey - shadowMinKey + 1) * shadowMapWidth; - - map = (CARD32 *) NXShadowKeymap -> map; - - if (shadowKeymap != NULL) - { - free(shadowKeymap); - } - - shadowKeymap = (KeySym *) malloc(len * sizeof(KeySym)); - - if (shadowKeymap != NULL) - { - for (i = 0; i < len; i++) - { - shadowKeymap[i] = map[i]; - } - - shadowKeysyms = shadowKeymap; - } - } - - if (shadowKeysyms == NULL) - { - XDisplayKeycodes(display, &shadowMinKey, &shadowMaxKey); - - shadowKeysyms = XGetKeyboardMapping(display, shadowMinKey, shadowMaxKey - shadowMinKey + 1, - &shadowMapWidth); - } - - #ifdef DEBUG - if (shadowKeysyms != NULL) - { - for (i = 0; i < (shadowMaxKey - shadowMinKey + 1) * shadowMapWidth; i++) - { - if (i % shadowMapWidth == 0) - { - logDebug("Poller::keymapShadowInit", "keycode [%d]", (int) (i / shadowMapWidth)); - } - - logDebug("\tkeysym", " [%x] [%s]", (unsigned int) shadowKeysyms[i], XKeysymToString(shadowKeysyms[i])); - } - } - #endif -} - -void Poller::keymapMasterInit() -{ - XDisplayKeycodes(display_, &masterMinKey, &masterMaxKey); - - masterKeysyms = XGetKeyboardMapping(display_, masterMinKey, masterMaxKey - masterMinKey + 1, - &masterMapWidth); - - #ifdef DEBUG - if (masterKeysyms != NULL) - { - for (int i = 0; i < (masterMaxKey - masterMinKey + 1) * masterMapWidth; i++) - { - if (i % masterMapWidth == 0) - { - logDebug("Poller::keymapMasterInit", "keycode [%d]", (int) (i / masterMapWidth)); - } - - logDebug("\tkeysym", " [%x] [%s]", (unsigned int) masterKeysyms[i], XKeysymToString(masterKeysyms[i])); - } - } - #endif -} - -KeySym Poller::keymapKeycodeToKeysym(KeyCode keycode, KeySym *keysyms, - int minKey, int mapWidth, int col) -{ - int index = ((keycode - minKey) * mapWidth) + col; - return keysyms[index]; -} - -KeyCode Poller::keymapKeysymToKeycode(KeySym keysym, KeySym *keysyms, - int minKey, int maxKey, int mapWidth, int *col) -{ - for (int i = 0; i < (maxKey - minKey + 1) * mapWidth; i++) - { - if (keysyms[i] == keysym) - { - *col = i % mapWidth; - return i / mapWidth + minKey; - } - } - return 0; -} - -KeyCode Poller::translateKeysymToKeycode(KeySym keysym, int *col) -{ - KeyCode keycode; - - keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col); - - if (keycode == 0) - { - if (((keysym >> 8) == 0) && (keysym >= XK_a) && (keysym <= XK_z)) - { - /* - * The master session has a Solaris keyboard. - */ - - keysym -= XK_a - XK_A; - - keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col); - } - else if (keysym == XK_Shift_R) - { - keysym = XK_Shift_L; - - keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col); - } - else if (keysym == XK_Shift_L) - { - keysym = XK_Shift_R; - - keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col); - } - else if (keysym == XK_ISO_Level3_Shift) - { - keysym = XK_Mode_switch; - - if ((keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col)) == 0) - { - keysym = XK_Alt_R; - - keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col); - } - } - else if (keysym == XK_Alt_R) - { - keysym = XK_ISO_Level3_Shift; - - if ((keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col)) == 0) - { - keysym = XK_Mode_switch; - - keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, col); - } - } - } - return keycode; -} - -Bool Poller::checkModifierKeys(KeySym keysym, Bool isKeyPress) -{ - switch (keysym) - { - case XK_Shift_L: - leftShiftOn = isKeyPress; - return True; - case XK_Shift_R: - rightShiftOn = isKeyPress; - return True; - case XK_Mode_switch: - modeSwitchOn = isKeyPress; - return True; - case XK_ISO_Level3_Shift: - level3ShiftOn = isKeyPress; - return True; - case XK_Alt_R: - altROn = isKeyPress; - return True; - default: - return False; - } -} - -void Poller::sendFakeModifierEvents(int pos, Bool skip) -{ - KeySym fakeKeysym; - int col; - - if ((!leftShiftOn && !rightShiftOn) && - (!modeSwitchOn && !level3ShiftOn && !altROn)) - { - if (pos == 1 || pos == 3) - { - fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - sentFakeLShiftPress = 1; - } - if (pos == 2 || pos == 3) - { - fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - - if (fakeKeysym == 0) - { - fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - sentFakeModeSwitchPress = 1; - } - else - { - sentFakeLevel3ShiftPress = 1; - } - - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - } - } - - else if ((leftShiftOn || rightShiftOn) && - (!modeSwitchOn && !level3ShiftOn && !altROn)) - { - if ((pos == 0 && !skip) || pos == 2) - { - if (leftShiftOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeLShiftRelease = 1; - } - if (rightShiftOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeRShiftRelease = 1; - } - } - if (pos == 2 || pos ==3) - { - fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - - if (fakeKeysym == 0) - { - fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - sentFakeModeSwitchPress = 1; - } - else - { - sentFakeLevel3ShiftPress = 1; - } - - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - } - } - - else if ((!leftShiftOn && !rightShiftOn) && - (modeSwitchOn || level3ShiftOn || altROn)) - { - if (pos == 1 || pos == 3) - { - fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - sentFakeLShiftPress = 1; - } - if (pos == 0 || pos == 1) - { - if (modeSwitchOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeModeSwitchRelease = 1; - } - if (level3ShiftOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeLevel3ShiftRelease = 1; - } - if (altROn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeAltRRelease = 1; - } - } - } - - else if ((leftShiftOn || rightShiftOn) && - (modeSwitchOn || level3ShiftOn || altROn)) - { - if (pos == 0 || pos == 2) - { - if (leftShiftOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeLShiftRelease = 1; - } - if (rightShiftOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeRShiftRelease = 1; - } - } - if (pos == 0 || pos == 1) - { - if (modeSwitchOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeModeSwitchRelease = 1; - } - if (level3ShiftOn) - { - fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeLevel3ShiftRelease = 1; - } - if (altROn) - { - fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - sentFakeAltRRelease = 1; - } - } - } -} - -void Poller::cancelFakeModifierEvents() -{ - KeySym fakeKeysym; - int col; - - if (sentFakeLShiftPress) - { - logTest("Poller::handleKeyboardEvent", "Fake Shift_L key press event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake Shift_L key release event"); - - fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - - sentFakeLShiftPress = 0; - } - - if (sentFakeLShiftRelease) - { - logTest("Poller::handleKeyboardEvent", "Fake Shift_L key release event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake Shift_L key press event"); - - fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - - sentFakeLShiftRelease = 0; - } - - if (sentFakeRShiftRelease) - { - logTest("Poller::handleKeyboardEvent", "Fake Shift_R key release event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake Shift_R key press event"); - - fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - - sentFakeRShiftRelease = 0; - } - - if (sentFakeModeSwitchPress) - { - logTest("Poller::handleKeyboardEvent", "Fake Mode_switch key press event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake Mode_switch key release event"); - - fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - - sentFakeModeSwitchPress = 0; - } - - if (sentFakeModeSwitchRelease) - { - logTest("Poller::handleKeyboardEvent", "Fake Mode_switch key release event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending Mode_switch key press event"); - - fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - - sentFakeModeSwitchRelease = 0; - } - - if (sentFakeLevel3ShiftPress) - { - logTest("Poller::handleKeyboardEvent", "Fake ISO_Level3_Shift key press event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake ISO_Level3_Shift key release event"); - - fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); - - sentFakeLevel3ShiftPress = 0; - } - - if (sentFakeLevel3ShiftRelease) - { - logTest("Poller::handleKeyboardEvent", "Fake ISO_Level3_Shift key release event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake ISO_Level3_Shift key press event"); - - fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - - sentFakeLevel3ShiftRelease = 0; - } - - if (sentFakeAltRRelease) - { - logTest("Poller::handleKeyboardEvent", "Fake XK_Alt_R key release event has been sent"); - logTest("Poller::handleKeyboardEvent", "Sending fake XK_Alt_R key press event"); - - fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, - masterMaxKey, masterMapWidth, &col); - XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); - - sentFakeAltRRelease = 0; - } -} - -Bool Poller::keyIsDown(KeyCode keycode) -{ - KeyPressedRec *downKey; - - downKey = shadowKeyPressedPtr; - - while (downKey) - { - if (downKey -> keyRcvd == keycode) - { - return True; - } - downKey = downKey -> next; - } - - return False; -} - -void Poller::addKeyPressed(KeyCode received, KeyCode sent) -{ - KeyPressedRec *downKey; - - if (!keyIsDown(received)) - { - if (shadowKeyPressedPtr == NULL) - { - shadowKeyPressedPtr = (KeyPressedRec *) malloc(sizeof(KeyPressedRec)); - - shadowKeyPressedPtr -> keyRcvd = received; - shadowKeyPressedPtr -> keySent = sent; - shadowKeyPressedPtr -> next = NULL; - } - else - { - downKey = shadowKeyPressedPtr; - - while (downKey -> next != NULL) - { - downKey = downKey -> next; - } - - downKey -> next = (KeyPressedRec *) malloc(sizeof(KeyPressedRec)); - - downKey -> next -> keyRcvd = received; - downKey -> next -> keySent = sent; - downKey -> next -> next = NULL; - } - } -} - -KeyCode Poller::getKeyPressed(KeyCode received) -{ - KeyCode sent; - KeyPressedRec *downKey; - KeyPressedRec *tempKey; - - if (shadowKeyPressedPtr != NULL) - { - if (shadowKeyPressedPtr -> keyRcvd == received) - { - sent = shadowKeyPressedPtr -> keySent; - - tempKey = shadowKeyPressedPtr; - shadowKeyPressedPtr = shadowKeyPressedPtr -> next; - free(tempKey); - - return sent; - } - else - { - downKey = shadowKeyPressedPtr; - - while (downKey -> next != NULL) - { - if (downKey -> next -> keyRcvd == received) - { - sent = downKey -> next -> keySent; - - tempKey = downKey -> next; - downKey -> next = downKey -> next -> next; - free(tempKey); - - return sent; - } - else - { - downKey = downKey -> next; - } - } - } - } - return 0; -} - -void Poller::handleKeyboardEvent(Display *display, XEvent *event) -{ - if (xtestExtension_ == 0 || display_ == 0) - { - return; - } - - logTest("Poller::handleKeyboardEvent", "Handling event at [%p]", event); - -#ifdef TRANSLATE_ALWAYS - - KeyCode keycode; - KeySym keysym; - - int col = 0; - - Bool isKeyPress = False; - Bool isModifier = False; - Bool isShiftComb = False; - Bool skip = False; - - if (event -> type == KeyPress) - { - isKeyPress = True; - } - - if (shadowKeysyms == NULL) - { - keymapShadowInit(event -> xkey.display); - } - - if (masterKeysyms == NULL) - { - keymapMasterInit(); - } - - if (shadowKeysyms == NULL || masterKeysyms == NULL) - { - logTest("Poller::handleKeyboardEvent", "Unable to initialize keymaps. Do not translate"); - - keycode = event -> xkey.keycode; - - goto SendKeycode; - } - - keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, - shadowMinKey, shadowMapWidth, 0); - - isModifier = checkModifierKeys(keysym, isKeyPress); - - if (event -> type == KeyRelease) - { - KeyCode keycodeToSend; - - keycodeToSend = getKeyPressed(event -> xkey.keycode); - - if (keycodeToSend) - { - keycode = keycodeToSend; - - goto SendKeycode; - } - } - - /* - * Convert case for Solaris keyboard. - */ - - if (((keysym >> 8) == 0) && (keysym >= XK_A) && (keysym <= XK_Z)) - { - if (!leftShiftOn && !rightShiftOn) - { - keysym += XK_a - XK_A; - } - else - { - skip = True; - } - } - - if (!isModifier) - { - if ((leftShiftOn || rightShiftOn) && - (!modeSwitchOn && !level3ShiftOn && !altROn) && - !skip) - { - KeySym tempKeysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, - shadowMinKey, shadowMapWidth, 1); - - if (tempKeysym == 0) - { - isShiftComb = True; - } - else - { - keysym = tempKeysym; - } - } - else if ((!leftShiftOn && !rightShiftOn) && - (modeSwitchOn || level3ShiftOn || altROn)) - { - keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, - shadowMinKey, shadowMapWidth, 2); - } - else if ((leftShiftOn || rightShiftOn) && - (modeSwitchOn || level3ShiftOn || altROn)) - { - keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, - shadowMinKey, shadowMapWidth, 3); - } - } - - if (keysym == 0) - { - logTest("Poller::handleKeyboardEvent", "Null keysym. Return"); - - return; - } - - logTest("Poller::handleKeyboardEvent", "keysym [%x] [%s]", - (unsigned int)keysym, XKeysymToString(keysym)); - - if (keysym == XK_Mode_switch) - { - keysym = XK_ISO_Level3_Shift; - } - - keycode = translateKeysymToKeycode(keysym, &col); - - if (keycode == 0) - { - logTest("Poller::handleKeyboardEvent", "No keycode found for keysym [%x] [%s]. Return", - (unsigned int)keysym, XKeysymToString(keysym)); - return; - } - - logTest("Poller::handleKeyboardEvent", "keycode [%d] translated into keycode [%d]", - (int)event -> xkey.keycode, (unsigned int)keycode); - - if (event -> type == KeyPress) - { - addKeyPressed(event -> xkey.keycode, keycode); - } - - /* - * Send fake modifier events. - */ - - if (!isModifier && isShiftComb == False) - { - sendFakeModifierEvents(col, ((keysym >> 8) == 0) && (keysym >= XK_A) && (keysym <= XK_Z)); - } - -SendKeycode: - - /* - * Send the event. - */ - - XTestFakeKeyEvent(display_, keycode, isKeyPress, 0); - - /* - * Check if fake modifier events have been sent. - */ - - cancelFakeModifierEvents(); - -#else // TRANSLATE_ALWAYS - - // - // Use keysyms to translate keycodes across different - // keyboard models. Unuseful when both keyboards have - // same keycodes (e.g. both are pc keyboards). - // - - #ifdef TRANSLATE_KEYCODES - - KeyCode keycode = XKeysymToKeycode(display_, XK_A); - - if (XKeysymToKeycode(event -> xkey.display, XK_A) != keycode) - { - KeySym keysym = XKeycodeToKeysym(event -> xkey.display, event -> xkey.keycode, 0); - - if (keysym == XK_Mode_switch || keysym == XK_ISO_Level3_Shift) - { - logUser("Poller::handleKeyboardEvent: keysym [%x].\n", (unsigned int)keysym); - - if (XKeycodeToKeysym(display_, 113, 0) == XK_ISO_Level3_Shift || - (XKeycodeToKeysym(display_, 124, 0) == XK_ISO_Level3_Shift)) - { - event -> xkey.keycode = 113; - } - else - { - event -> xkey.keycode = XKeysymToKeycode(display_, XK_Mode_switch); - } - - logUser("Poller::handleKeyboardEvent: keycode translated to [%x].\n", (unsigned int)event -> xkey.keycode); - } - else - { - event -> xkey.keycode = XKeysymToKeycode(display_, keysym); - } - } - - #endif // TRANSLATE_KEYCODES - - if (event -> type == KeyPress) - { - XTestFakeKeyEvent(display_, event -> xkey.keycode, 1, 0); - } - else if (event -> type == KeyRelease) - { - XTestFakeKeyEvent(display_, event -> xkey.keycode, 0, 0); - } - -#endif // TRANSLATE_ALWAYS -} - -void Poller::handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) -{ - KeyCode keycode; - int col; - - if (masterKeysyms == NULL) - { - keymapMasterInit(); - } - - if (masterKeysyms == NULL) - { - logTest("Poller::handleWebKeyboardEvent", "Unable to initialize keymap"); - - return; - } - - keycode = translateKeysymToKeycode(keysym, &col); - - if (keycode == 0) - { - logTest("Poller::handleKeyboardEvent", "No keycode found for keysym [%x] [%s]. Return", - (unsigned int)keysym, XKeysymToString(keysym)); - return; - } - - logTest("Poller::handleKeyboardEvent", "keysym [%x] [%s] translated into keycode [%x]", - (unsigned int)keysym, XKeysymToString(keysym), (unsigned int)keycode); - - /* - * Send fake modifier events. - */ - - if (!checkModifierKeys(keysym, isKeyPress)) - { - sendFakeModifierEvents(col, False); - } - - /* - * Send the event. - */ - - XTestFakeKeyEvent(display_, keycode, isKeyPress, 0); - - /* - * Check if fake modifier events have been sent. - */ - - cancelFakeModifierEvents(); - -} - -void Poller::handleMouseEvent(Display *display, XEvent *event) -{ - if (xtestExtension_ == 0 || display_ == 0) - { - return; - } - - if (event -> type == MotionNotify) - { - XTestFakeMotionEvent(display_, 0, event -> xmotion.x, event -> xmotion.y, 0); - } - else if (event -> type == ButtonPress) - { - XTestFakeButtonEvent(display_, event -> xbutton.button, True, 0); - } - else if (event -> type == ButtonRelease) - { - XTestFakeButtonEvent(display_, event -> xbutton.button, False, 0); - } - - XFlush(display_); -} - -void Poller::setRootSize(void) -{ - width_ = WidthOfScreen(DefaultScreenOfDisplay(display_)); - height_ = HeightOfScreen(DefaultScreenOfDisplay(display_)); - depth_ = DefaultDepth(display_, DefaultScreen(display_)); - - if (depth_ == 8) bpp_ = 1; - else if (depth_ == 16) bpp_ = 2; - else bpp_ = 4; - - bpl_ = width_ * bpp_; -} - -void Poller::destroyShmImage(void) -{ - XShmDetach(display_, shminfo_); - XDestroyImage(image_); - image_ = NULL; - - shmdt(shminfo_ -> shmaddr); - shmctl(shminfo_ -> shmid, IPC_RMID, 0); - - delete shminfo_; - shminfo_ = NULL; -} - -void Poller::xtestInit(void) -{ - int eventBase; - int errorBase; - int versionMajor; - int versionMinor; - int result; - - xtestExtension_ = 0; - - result = XTestQueryExtension(display_, &eventBase, &errorBase, &versionMajor, &versionMinor); - - if (result == 0) - { - xtestExtension_ = 0; - - logWarning("Poller::xtestInit", "Failed while querying for XTEST extension."); - } - else - { - logDebug("Poller::xtestInit", "XTEST version %d.%d.", versionMajor, versionMinor); - - xtestExtension_ = 1; - } - - // - // Make this client impervious to grabs. - // - - if (xtestExtension_ == 1) - { - XTestGrabControl(display_, 1); - } -} - -void Poller::randrInit(void) -{ - int randrEventBase; - int randrErrorBase; - - if (XRRQueryExtension(display_, &randrEventBase, &randrErrorBase) == 0) - { - logWarning("Poller::randrInit", "Randr extension not supported on this " - "display."); - - randrExtension_ = 0; - - return; - } - - XRRSelectInput(display_, DefaultRootWindow(display_), - RRScreenChangeNotifyMask); - - randrEventBase_ = randrEventBase; - - randrExtension_ = 1; - - return; -} - -void Poller::damageInit(void) -{ - int damageMajorVersion = 0; - int damageMinorVersion = 0; - - int damageEventBase = 0; - int damageErrorBase = 0; - - if (damageExtension_ >= 0) - { - logDebug("Poller::damageInit", "Called with damage already initialized."); - } - - if (damageExtension_ == 0) - { - logDebug("Poller::damageInit", "Damage disabled. Skip initialization."); - - return; - } - - if (damageExtension_ < 0 && NXShadowOptions.optionDamageExtension == 0) - { - damageExtension_ = 0; - - logUser("Poller::damageInit: Disabling use of DAMAGE extension.\n"); - - return; - } - - damageExtension_ = 0; - - mirrorChanges_ = 0; - - if (XDamageQueryExtension(display_, &damageEventBase, &damageErrorBase) == 0) - { - logUser("Poller::damageInit: DAMAGE not supported.\n"); - - return; - } - #ifdef DEBUG - else - { - fprintf(stderr, "Poller::damageInit: DAMAGE supported. " - "Event base [%d] error base [%d].\n", damageEventBase, damageErrorBase); - } - #endif - - damageEventBase_ = damageEventBase; - - if (XDamageQueryVersion(display_, &damageMajorVersion, &damageMinorVersion) == 0) - { - logWarning("Poller::damageInit", "Error on querying DAMAGE version.\n"); - - damageExtension_ = 0; - - return; - } - #ifdef DEBUG - else - { - fprintf(stderr, "Poller::damageInit: DAMAGE version %d.%d.\n", - damageMajorVersion, damageMinorVersion); - } - #endif - - damage_ = XDamageCreate(display_, DefaultRootWindow(display_), XDamageReportRawRectangles); - - damageExtension_= 1; - - mirror_ = 1; - - return; -} - -void Poller::getEvents(void) -{ - XEvent X; - - if (damageExtension_ == 1) - { - XDamageSubtract(display_, damage_, None, None); - } - - XSync(display_, 0); - - while (XCheckIfEvent(display_, &X, anyEventPredicate, NULL) == 1) - { - if (randrExtension_ == 1 && (X.type == randrEventBase_ + RRScreenChangeNotify || X.type == ConfigureNotify)) - { - XRRUpdateConfiguration(&X); - - handleRRScreenChangeNotify(&X); - - continue; - } - - if (damageExtension_ == 1 && X.type == damageEventBase_ + XDamageNotify) - { - handleDamageNotify(&X); - } - } - - if (damageExtension_ == 1) - { - updateDamagedAreas(); - } - - XFlush(display_); -} - -void Poller::handleRRScreenChangeNotify(XEvent *X) -{ - return; -} - -void Poller::handleDamageNotify(XEvent *X) -{ - XDamageNotifyEvent *e = (XDamageNotifyEvent *) X; - - // - // e->drawable is the window ID of the damaged window - // e->geometry is the geometry of the damaged window - // e->area is the bounding rect for the damaged area - // e->damage is the damage handle returned by XDamageCreate() - // - - #ifdef DEBUG - fprintf(stderr, "handleDamageNotify: drawable [%d] damage [%d] geometry [%d][%d][%d][%d] area [%d][%d][%d][%d].\n", - (int) e -> drawable, (int) e -> damage, e -> geometry.x, e -> geometry.y, - e -> geometry.width, e -> geometry.height, e -> area.x, e -> area.y, - e -> area.width, e -> area.height); - #endif - - XRectangle rectangle = {e -> area.x, e -> area.y, e -> area.width, e -> area.height}; - - XUnionRectWithRegion(&rectangle, lastUpdatedRegion_, lastUpdatedRegion_); - - mirrorChanges_ = 1; - - return; -} - -void Poller::updateDamagedAreas(void) -{ - BOX *boxPtr; - - XRectangle rectangle; - - int i; - int y; - - for (i = 0; i < lastUpdatedRegion_ -> numRects; i++) - { - boxPtr = lastUpdatedRegion_ -> rects + i; - - if (shmExtension_ == 1) - { - image_ -> width = boxPtr -> x2 - boxPtr -> x1; - image_ -> height = boxPtr -> y2 - boxPtr -> y1; - image_ -> bytes_per_line = - ROUNDUP((image_ -> bits_per_pixel * image_ -> width), - image_ -> bitmap_pad); - - if (XShmGetImage(display_, DefaultRootWindow(display_), image_, - boxPtr -> x1, boxPtr -> y1, AllPlanes) == 0) - { - logDebug("Poller::updateDamagedAreas", "XShmGetImage failed!"); - - return; - } - } - else if (shmExtension_ == 0) - { - image_ = XGetImage(display_, DefaultRootWindow(display_), boxPtr -> x1, - boxPtr -> y1, boxPtr -> x2 - boxPtr -> x1, - boxPtr -> y2 - boxPtr -> y1, AllPlanes, - ZPixmap); - - if (image_ == NULL) - { - logDebug("Poller::updateDamagedAreas", "XGetImage failed!"); - - return; - } - - image_ -> width = boxPtr -> x2 - boxPtr -> x1; - image_ -> height = boxPtr -> y2 - boxPtr -> y1; - image_ -> bytes_per_line = - ROUNDUP((image_ -> bits_per_pixel * image_ -> width), - image_ -> bitmap_pad); - } - - rectangle.height = 1; - rectangle.width = image_ -> width; - rectangle.x = boxPtr -> x1; - rectangle.y = boxPtr -> y1; - - for (y = 0; y < image_ -> height; y++) - { - update(image_ -> data + y * image_ -> bytes_per_line, rectangle); - - rectangle.y++; - } - - if (shmExtension_ != 1) - { - XDestroyImage(image_); - - image_ = NULL; - } - } - - return; -} - -void Poller::getScreenSize(int *w, int *h) -{ - *w = WidthOfScreen(DefaultScreenOfDisplay(display_)); - *h = HeightOfScreen(DefaultScreenOfDisplay(display_)); -} - -void Poller::setScreenSize(int *w, int *h) -{ - setRootSize(); - - shmInitTrap = 1; - shmInit(); - shmInitTrap = 0; - - *w = width_; - *h = height_; - - logDebug("Poller::setScreenSize", "New size of screen [%d, %d]", width_, height_); -} - -int anyEventPredicate(Display *display, XEvent *event, XPointer parameter) -{ - return 1; -} - -#endif /* !defined(__CYGWIN32__) && !defined(WIN32) */ diff --git a/nxcompshad/X11.h b/nxcompshad/X11.h deleted file mode 100644 index 87dd31fea..000000000 --- a/nxcompshad/X11.h +++ /dev/null @@ -1,139 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef X11Poller_H -#define X11Poller_H - -#include -#include -#include "X11/include/Xdamage_nxcompshad.h" -#include "X11/include/Xrandr_nxcompshad.h" - -#include "Core.h" - -class Poller : public CorePoller -{ - public: - - Poller(Input *, Display *display, int = 0); - - ~Poller(); - - int init(); - - void setRootSize(); - - void destroyShmImage(); - - void getEvents(void); - - void getScreenSize(int *width, int *height); - - void setScreenSize(int *width, int *height); - - private: - - Display *display_; - - char *shadowDisplayName_; - - int shadowDisplayUid_; - - char *tmpBuffer_; - - char xtestExtension_; - - char shmExtension_; - - char randrExtension_; - - int randrEventBase_; - - char damageExtension_; - - int damageEventBase_; - - Damage damage_; - - Region repair_; - - char damageChanges_; - - XShmSegmentInfo *shminfo_; - - XImage *image_; - - int updateShadowFrameBuffer(void); - - char *getRect(XRectangle); - - void keymapShadowInit(Display *display); - - void keymapMasterInit(); - - KeySym keymapKeycodeToKeysym(KeyCode keycode, KeySym *keysyms, - int minKey, int per, int col); - - KeyCode keymapKeysymToKeycode(KeySym keysym, KeySym *keysyms, - int minKey, int maxKey, int per, int *col); - - KeyCode translateKeysymToKeycode(KeySym keysym, int *col); - - Bool checkModifierKeys(KeySym keysym, Bool isKeyPress); - - void sendFakeModifierEvents(int pos, Bool skip); - - void cancelFakeModifierEvents(); - - Bool keyIsDown(KeyCode keycode); - - void addKeyPressed(KeyCode received, KeyCode sent); - - KeyCode getKeyPressed(KeyCode received); - - void handleKeyboardEvent(Display *display, XEvent *); - - void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress); - - void handleMouseEvent(Display *, XEvent *); - - void xtestInit(void); - - void shmInit(void); - - void randrInit(void); - - void damageInit(void); - - void handleRRScreenChangeNotify(XEvent *); - - void handleDamageNotify(XEvent *); - - void updateDamagedAreas(void); -}; - -int anyEventPredicate(Display *display, XEvent *event, XPointer parameter); - -#endif /* X11Poller_H */ diff --git a/nxcompshad/X11/include/XTest_nxcompshad.h b/nxcompshad/X11/include/XTest_nxcompshad.h deleted file mode 100644 index 91a2ba40b..000000000 --- a/nxcompshad/X11/include/XTest_nxcompshad.h +++ /dev/null @@ -1,71 +0,0 @@ -/* - -Copyright 1992, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifndef _XTEST_H_ -#define _XTEST_H_ - -#include - -_XFUNCPROTOBEGIN - -Bool XTestQueryExtension( - Display* /* dpy */, - int* /* event_basep */, - int* /* error_basep */, - int* /* majorp */, - int* /* minorp */ -); - -extern int XTestFakeKeyEvent( - Display* /* dpy */, - unsigned int /* keycode */, - Bool /* is_press */, - unsigned long /* delay */ -); - -extern int XTestFakeButtonEvent( - Display* /* dpy */, - unsigned int /* button */, - Bool /* is_press */, - unsigned long /* delay */ -); - -extern int XTestFakeMotionEvent( - Display* /* dpy */, - int /* screen */, - int /* x */, - int /* y */, - unsigned long /* delay */ -); - -extern int XTestGrabControl( - Display* /* dpy */, - Bool /* impervious */ -); - -_XFUNCPROTOEND - -#endif diff --git a/nxcompshad/X11/include/Xdamage_nxcompshad.h b/nxcompshad/X11/include/Xdamage_nxcompshad.h deleted file mode 100644 index cae3e1c67..000000000 --- a/nxcompshad/X11/include/Xdamage_nxcompshad.h +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. - */ - -/* - * This file is a reduced version of the header file of - * - * - * This copy of code has been introduced to allow a clear namespace - * separation between and header files. - * - * This version of the Xdamage library header file only contains symbols - * required by nxcompshad and strictly avoids indirectly including - * from an X11 library that is also shipped in nx-X11/lib/. - * - * When using instead for inclusion in - * nxcompshad, it will attempt pulling in the - * header which in turn will include . However, the headers of - * the same name from should be used instead. - * - * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this - * hack can be removed. - * - * 2015/06/26, Mike Gabriel - */ - - -#ifndef _XDAMAGE_H_ -#define _XDAMAGE_H_ - -#include -#include - -/* from */ -typedef XID XserverRegion; - -#define XDAMAGE_1_1_INTERFACE - -typedef XID Damage; - -typedef struct { - int type; /* event base */ - unsigned long serial; - Bool send_event; - Display *display; - Drawable drawable; - Damage damage; - int level; - Bool more; /* more events will be delivered immediately */ - Time timestamp; - XRectangle area; - XRectangle geometry; -} XDamageNotifyEvent; - -_XFUNCPROTOBEGIN - -Bool XDamageQueryExtension (Display *dpy, - int *event_base_return, - int *error_base_return); - -Status XDamageQueryVersion (Display *dpy, - int *major_version_return, - int *minor_version_return); - -Damage -XDamageCreate (Display *dpy, Drawable drawable, int level); - -void -XDamageSubtract (Display *dpy, Damage damage, - XserverRegion repair, XserverRegion parts); - -_XFUNCPROTOEND - -#endif /* _XDAMAGE_H_ */ diff --git a/nxcompshad/X11/include/Xrandr_nxcompshad.h b/nxcompshad/X11/include/Xrandr_nxcompshad.h deleted file mode 100644 index 4feb01685..000000000 --- a/nxcompshad/X11/include/Xrandr_nxcompshad.h +++ /dev/null @@ -1,80 +0,0 @@ -/* - * Copyright © 2000 Compaq Computer Corporation, Inc. - * Copyright © 2002 Hewlett-Packard Company, Inc. - * Copyright © 2006 Intel Corporation - * Copyright © 2008 Red Hat, Inc. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 the copyright holders not be used in advertising or - * publicity pertaining to distribution of the software without specific, - * written prior permission. The copyright holders make no representations - * about the suitability of this software for any purpose. It is provided "as - * is" without express or implied warranty. - * - * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL THE COPYRIGHT HOLDERS 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: Jim Gettys, HP Labs, Hewlett-Packard, Inc. - * Keith Packard, Intel Corporation - */ - -/* - * This file is a reduced version of the header file of - * - * - * This copy of code has been introduced to allow a clear namespace - * separation between and header files. - * - * This version of the Xrandr library header file only contains symbols - * required by nxcompshad and strictly avoids indirectly including - * from an X11 library that is also shipped in nx-X11/lib/. - * - * When using instead for inclusion in - * nxcompshad, it will attempt pulling in the - * header which in turn will include . However, the headers of - * the same name from should be used instead. - * - * FIXME: Once the nxagent Xserver starts using libXrender from X.Org, this - * hack can be removed. - * - * 2015/06/26, Mike Gabriel - */ - -#ifndef _XRANDR_H_ -#define _XRANDR_H_ - -/* from */ -#define RRScreenChangeNotify 0 -#define RRScreenChangeNotifyMask (1L << 0) - -#include - -_XFUNCPROTOBEGIN - -/* internal representation is private to the library */ -typedef struct _XRRScreenConfiguration XRRScreenConfiguration; - -Bool XRRQueryExtension (Display *dpy, - int *event_base_return, - int *error_base_return); - -void XRRSelectInput(Display *dpy, Window window, int mask); - - -/* - * intended to take RRScreenChangeNotify, or - * ConfigureNotify (on the root window) - * returns 1 if it is an event type it understands, 0 if not - */ -int XRRUpdateConfiguration(XEvent *event); -_XFUNCPROTOEND - -#endif /* _XRANDR_H_ */ diff --git a/nxcompshad/configure.ac b/nxcompshad/configure.ac new file mode 100644 index 000000000..b3abf0efb --- /dev/null +++ b/nxcompshad/configure.ac @@ -0,0 +1,53 @@ +dnl *************************************************************************** +dnl *** configure.ac for nxcompshad *** +dnl *************************************************************************** + +m4_define([nxcompshad_version], m4_esyscmd([tr -d '\n' < VERSION])) + +# Initialize Autoconf +AC_PREREQ(2.60) + +AC_INIT([libXcompshad], [nxcompshad_version], [https://github.com/ArcticaProject/nx-libs/issues]) +AC_PROG_CXX +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) +AC_CONFIG_AUX_DIR([build-aux]) + +AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz]) + +# Initialize libtool +AC_PROG_LIBTOOL + +COMPSHAD_VERSION=nxcompshad_version +AC_SUBST([COMPSHAD_VERSION]) + +LT_COMPSHAD_VERSION=[`echo $COMPSHAD_VERSION | sed -r -e 's/^([0-9]+\.[0-9]+\.[0-9]+).*$/\1/' -e 's/\./:/g'`] +AC_SUBST([LT_COMPSHAD_VERSION]) + +PKG_CHECK_MODULES(Xext, xext) +PKG_CHECK_MODULES(Xdamage, xdamage) +PKG_CHECK_MODULES(Xrandr, xrandr) +PKG_CHECK_MODULES(Xtst, xtst) + +# Upstream's pkg.m4 (since 0.27) offers this now, but define our own +# compatible version in case the local version of pkgconfig isn't new enough. +# https://bugs.freedesktop.org/show_bug.cgi?id=48743 +m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], + [AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], + [install directory for nxcompshad.pc pkg-config file])], + [],[with_pkgconfigdir='$(libdir)/pkgconfig']) + AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])]) + +AC_LANG([C++]) +NX_COMPILER_BRAND +NX_COMPILER_FLAGS + +AC_CONFIG_FILES([ +Makefile +src/Makefile +nxcompshad.pc +]) + +AC_OUTPUT diff --git a/nxcompshad/configure.in b/nxcompshad/configure.in deleted file mode 100644 index bb9286e3d..000000000 --- a/nxcompshad/configure.in +++ /dev/null @@ -1,307 +0,0 @@ -dnl /**************************************************************************/ -dnl /* */ -dnl /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -dnl /* Copyright (c) 2008-2014 Oleksandr Shneyder */ -dnl /* Copyright (c) 2014-2016 Ulrich Sibiller */ -dnl /* Copyright (c) 2014-2016 Mihai Moldovan */ -dnl /* Copyright (c) 2011-2016 Mike Gabriel */ -dnl /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -dnl /* */ -dnl /* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ -dnl /* are copyright of the aforementioned persons and companies. */ -dnl /* */ -dnl /* Redistribution and use of the present software is allowed according */ -dnl /* to terms specified in the file LICENSE which comes in the source */ -dnl /* distribution. */ -dnl /* */ -dnl /* All rights reserved. */ -dnl /* */ -dnl /* NOTE: This software has received contributions from various other */ -dnl /* contributors, only the core maintainers and supporters are listed as */ -dnl /* copyright holders. Please contact us, if you feel you should be listed */ -dnl /* as copyright holder, as well. */ -dnl /* */ -dnl /**************************************************************************/ - - -dnl Process this file with autoconf to produce a configure script. - -dnl Prolog - -AC_INIT(Shadow.h) -AC_PREREQ(2.13) - -pkgconfigdir=${libdir}/pkgconfig -AC_SUBST(pkgconfigdir) - -dnl Reset default compilation flags. - -if test "x$CXXFLAGS" == "x"; then - CXXFLAGS="-O3" -fi -if test "x$CPPFLAGS" == "x"; then - CPPFLAGS="-O3" -fi - -dnl Reset default linking directives. - -LIBSTATIC="" -LIBSHARED="" - -dnl Prefer headers and libraries from nx-X11, if present. - -if test -d "../nx-X11/exports/include" ; then - CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include" - LIBS="-L../nx-X11/exports/lib" -fi - -dnl Check whether --with-ipaq was given. - -if test "${with_ipaq}" = yes; then - echo -e "enabling IPAQ configuration" - CXX="arm-linux-c++" - CC="arm-linux-gcc" - unset ac_cv_prog_armcxx - unset ac_cv_prog_armcc - unset ac_cv_prog_CXXCPP - AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH]) - AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH]) - if test $armcxx = "yes" && test $armcc = "yes" ; then - ac_cv_prog_CXX="$CXX" - ac_cv_prog_CC="$CC" - else - AC_MSG_ERROR(installation or configuration problem: I cannot find compiler for arm-linux) - fi -else - unset ac_cv_prog_CXX - unset ac_cv_prog_CC - unset ac_cv_prog_CXXCPP -fi - -dnl Check for programs. - -AC_PROG_CXX -AC_PROG_CC -AC_LANG_CPLUSPLUS - -dnl Check whether option -Wno-deprecated -dnl is needed by GCC compiler. - -AC_MSG_CHECKING([whether compiler needs -Wno-deprecated]) -gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1` -case "${gcc_version}" in - gcc*) - AC_MSG_RESULT([yes]) - CXXFLAGS="$CXXFLAGS -Wno-deprecated" - CPPFLAGS="$CPPFLAGS -Wno-deprecated" - ;; - - *) - AC_MSG_RESULT([no]) - ;; -esac - -AC_MSG_CHECKING([whether compiler accepts -Wmissing-declarations and -Wnested-externs]) -gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1` -case "${gcc_version}" in - gcc*) - AC_MSG_RESULT([no]) - ;; - - *) - AC_MSG_RESULT([yes]) - CXXFLAGS="$CXXFLAGS -Wmissing-declarations" - CPPFLAGS="$CPPFLAGS -Wmissing-declarations" - ;; -esac - -dnl Check for BSD compatible install. - -AC_PROG_INSTALL - -dnl Check for extra header files. - -AC_PATH_XTRA - -dnl Custom addition. - -ac_help="$ac_help - --with-symbols give -g flag to compiler to produce debug symbols - --with-info define INFO at compile time to get basic log output - --with-valgrind clean up allocated buffers to avoid valgrind warnings - --with-version use this version for produced libraries - - --with-static-jpeg enable static linking of JPEG library - --with-static-z enable static linking of Z library" - -dnl Check to see if we're running under Cygwin32. - -AC_DEFUN(nxconf_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes]) -nxconf_CYGWIN32 - -dnl Cygwin32 requires the stdc++ library explicitly linked. - -if test "$CYGWIN32" = yes; then - LIBS="$LIBS -lstdc++ -lcygipc -lgdi32" -fi - -dnl Check for Darwin environment. - -AC_DEFUN(nxconf_DARWIN, -[AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin, -[AC_TRY_COMPILE(,[return __APPLE__;], -nxconf_cv_darwin=yes, nxconf_cv_darwin=no) -rm -f conftest*]) -DARWIN= -test "$nxconf_cv_darwin" = yes && DARWIN=yes]) -nxconf_DARWIN - -dnl Check to see if we're running under Solaris. - -AC_DEFUN(nxconf_SUN, -[AC_CACHE_CHECK(for Solaris environment, nxconf_cv_sun, -[AC_TRY_COMPILE(,[return __sun;], -nxconf_cv_sun=yes, nxconf_cv_sun=no) -rm -f conftest*]) -SUN= -test "$nxconf_cv_sun" = yes && SUN=yes]) -nxconf_SUN - -dnl Check to see if we're running under FreeBSD. - -AC_DEFUN(nxconf_FreeBSD, -[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd, -[AC_TRY_COMPILE(,[return __FreeBSD__;], -nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) -rm -f conftest*]) -FreeBSD= -test "$nxconf_cv_freebsd" = yes && FreeBSD=yes]) -nxconf_FreeBSD - -dnl Build PIC libraries. - -if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then - CXXFLAGS="$CXXFLAGS -fPIC" - CFLAGS="$CFLAGS -fPIC" -fi - -dnl Solaris requires the socket and gcc_s libs explicitly linked. -dnl Note also that headers from default /usr/openwin/include/X11 -dnl cause a warning due to pragma in Xmd.h. - -if test "$SUN" = yes; then - LIBS="$LIBS -L/usr/sfw/lib -lsocket " - CXXFLAGS="$CXXFLAGS -I/usr/sfw/include" -fi - -dnl On FreeBSD search libraries and includes under /usr/local. - -if test "$FreeBSD" = yes; then - LIBS="$LIBS -L/usr/local/lib" - CXXFLAGS="$CXXFLAGS -I/usr/local/include" -fi - -dnl Under Darwin we don't have support for -soname option and -dnl we need the -dynamiclib flag. Under Solaris, instead, we need -dnl the options -G -h. - -if test "$DARWIN" = yes; then - LDFLAGS="$LDFLAGS -dynamiclib" -elif test "$SUN" = yes; then - LDFLAGS="$LDFLAGS -G -h \$(LIBLOAD)" -else - LDFLAGS="$LDFLAGS -Wl,-soname,\$(LIBLOAD)" -fi - -dnl Check to see if in_addr_t is defined. -dnl Could use a specific configure test. - -AC_DEFUN(nxconf_INADDRT, -[AC_CACHE_CHECK(for in_addr_t, nxconf_cv_inaddrt, -[AC_TRY_COMPILE([#include ],[in_addr_t t; t = 1; return t;], -nxconf_cv_inaddrt=yes, nxconf_cv_inaddrt=no) -rm -f conftest*]) -INADDRT= -test "$nxconf_cv_inaddrt" = yes && INADDRT=yes]) -nxconf_INADDRT - -dnl If in_addr_t is not defined use unsigned int. - -if test "$INADDRT" != yes ; then - echo -e "using unsigned int for type in_addr_t" - CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=unsigned" - CPPFLAGS="$CPPFLAGS -DIN_ADDR_T=unsigned" -else - CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=in_addr_t" - CPPFLAGS="$CPPFLAGS -DIN_ADDR_T=in_addr_t" -fi - -dnl Check whether --with-version was given. - -AC_SUBST(LIBVERSION) -AC_SUBST(VERSION) -if test "${with_version}" = yes; then - VERSION=${ac_option} -else - VERSION=`cat VERSION` -fi -echo -e "compiling version ${VERSION}" - -LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1` - -CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\"" -CPPFLAGS="$CPPFLAGS -DVERSION=\\\"${VERSION}\\\"" - -dnl Finally compose the LIB variable. - -if test "$DARWIN" = yes ; then - LIBS="$LIBS $LIBSTATIC $LIBSHARED" -elif test "$SUN" = yes ; then - LIBS="$LIBS $LIBSTATIC $LIBSHARED" -else - LIBS="$LIBS $LIBSTATIC -shared $LIBSHARED" -fi - -dnl Check whether --with-symbols or --without-symbols was -dnl given and set the required optimization level. - -if test "${with_symbols}" = yes; then - echo -e "enabling production of debug symbols" - CXXFLAGS="-g $CXXFLAGS" - CPPFLAGS="-g $CPPFLAGS" -else - echo -e "disabling production of debug symbols" -fi - -dnl Check whether --with-info or --without-info was given. - -if test "${with_info}" = yes; then - echo -e "enabling info output in the log file" - CXXFLAGS="$CXXFLAGS -DINFO" - CPPFLAGS="$CPPFLAGS -DINFO" -else - echo -e "disabling info output in the log file" -fi - -dnl Check whether --with-valgrind or --without-valgrind was given. - -if test "${with_valgrind}" = yes; then - echo -e "enabling valgrind memory checker workarounds" - CXXFLAGS="$CXXFLAGS -DVALGRIND" - CPPFLAGS="$CPPFLAGS -DVALGRIND" -else - echo -e "disabling valgrind memory checker workarounds" -fi - -dnl Find makedepend somewhere. - -AC_SUBST(MAKEDEPEND) -MAKEDEPEND="$(which makedepend)" - -AC_OUTPUT(Makefile nxcompshad.pc) diff --git a/nxcompshad/include/Shadow.h b/nxcompshad/include/Shadow.h new file mode 100644 index 000000000..e1c57c432 --- /dev/null +++ b/nxcompshad/include/Shadow.h @@ -0,0 +1,109 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Shadow_H +#define Shadow_H + +#include + +#define NXShadowCorrectColor(length, buffer) \ +\ +{ \ + unsigned short a; \ + unsigned short b; \ + unsigned short *shorts; \ + int i; \ +\ + length >>= 1; \ + shorts = (unsigned short *)buffer; \ + for (i = 0; i < length ; i++) \ + { \ + a = shorts[i]; \ +\ + b = a & 63; \ + a <<= 1; \ + a = (a & ~127) | b; \ +\ + shorts[i] = a; \ + } \ +} + +#ifdef __cplusplus +extern "C" { +#endif + +typedef char* UpdaterHandle; + +typedef struct _ShadowOptions +{ + char optionShmExtension; + char optionDamageExtension; + int optionShadowDisplayUid; +} ShadowOptions; + +extern ShadowOptions NXShadowOptions; + +extern int NXShadowCreate(void *, char *, char *, void **); +extern void NXShadowDestroy(void); + +/* + * Use an already opened Display connection. + * We use instead of to avoid + * useless dependences from Xlib headers. + */ + +extern int NXShadowAddUpdaterDisplay(void *display, int *width, int *height, + unsigned char *depth); +extern UpdaterHandle NXShadowAddUpdater(char *displayName); +extern int NXShadowRemoveUpdater(UpdaterHandle handle); +extern int NXShadowRemoveAllUpdaters(void); + +extern void NXShadowHandleInput(void); +extern int NXShadowHasChanged(int (*)(void *), void *, int *); +extern void NXShadowExportChanges(long *, char **); +extern int NXShadowHasUpdaters(void); +extern int NXShadowCaptureCursor(unsigned int wnd, void *vis); +extern void NXShadowColorCorrect(int, int, unsigned int, unsigned int, char *); +extern void NXShadowUpdateBuffer(void **); + +extern void NXShadowEvent(Display *, XEvent); +extern void NXShadowWebKeyEvent(KeySym keysym, Bool isKeyPress); + +extern void NXShadowSetDisplayUid(int uid); + +extern void NXShadowDisableShm(void); +extern void NXShadowDisableDamage(void); + +extern void NXShadowGetScreenSize(int *width, int *height); +extern void NXShadowSetScreenSize(int *width, int *height); + +extern void NXShadowInitKeymap(void *keysyms); + +#ifdef __cplusplus +} +#endif + +#endif /* Shadow_H */ + diff --git a/nxcompshad/install-sh b/nxcompshad/install-sh deleted file mode 100755 index 58719246f..000000000 --- a/nxcompshad/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/nxcompshad/m4/nx-macros.m4 b/nxcompshad/m4/nx-macros.m4 new file mode 120000 index 000000000..813e9b041 --- /dev/null +++ b/nxcompshad/m4/nx-macros.m4 @@ -0,0 +1 @@ +../../m4/nx-macros.m4 \ No newline at end of file diff --git a/nxcompshad/nxcompshad.pc.in b/nxcompshad/nxcompshad.pc.in index 80b75e3f5..b12ca3e12 100644 --- a/nxcompshad/nxcompshad.pc.in +++ b/nxcompshad/nxcompshad.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: nxcompshad Description: Shadow Session Support for NX Compression Library -Version: @VERSION@ +Version: @COMPSHAD_VERSION@ Requires: nxcomp Requires.private: x11 Cflags: -I${includedir} diff --git a/nxcompshad/src/Core.cpp b/nxcompshad/src/Core.cpp new file mode 100644 index 000000000..de5f9a897 --- /dev/null +++ b/nxcompshad/src/Core.cpp @@ -0,0 +1,626 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include "Core.h" +#include "Logger.h" + +const int CorePoller::maxSliceHeight_ = 20; +const int CorePoller::minSliceHeight_ = 3; + +const char CorePoller::interlace_[] = +{ + 0, 16, + 8, 24, + 4, 20, 12, 28, + 2, 18, 10, 26, 6, 22, 14, 30, + 1, 17, + 9, 25, + 5, 21, 13, 29, + 3, 19, 11, 27, 7, 23, 15, 31 +}; + +CorePoller::CorePoller(Input *input, Display *display) : input_(input) +{ + logTrace("CorePoller::CorePoller"); + + buffer_ = NULL; + lastUpdatedRegion_ = NULL; + lineStatus_ = NULL; + linePriority_ = NULL; + lefts_ = NULL; + rights_ = NULL; +} + +CorePoller::~CorePoller() +{ + logTrace("CorePoller::~CorePoller"); + + if (buffer_ != NULL) + { + delete [] buffer_; + + buffer_ = NULL; + } + + if (lastUpdatedRegion_ != NULL) + { + XDestroyRegion(lastUpdatedRegion_); + + lastUpdatedRegion_ = NULL; + } + + if (lineStatus_ != NULL) + { + delete [] lineStatus_; + + lineStatus_ = NULL; + } + + if (linePriority_ != NULL) + { + delete [] linePriority_; + + linePriority_ = NULL; + } + + if (lefts_ != NULL) + { + delete [] lefts_; + + lefts_ = NULL; + } + + if (rights_ != NULL) + { + delete [] rights_; + + rights_ = NULL; + } +} + +int CorePoller::init() +{ + logTrace("CorePoller::init"); + + createFrameBuffer(); + + if (buffer_ == NULL) + { + logError("CorePoller::init", ESET(ENOMEM)); + + return -1; + } + + logTest("CorePoller::init", "Allocated frame buffer at [%p] for [%d] bytes.", + buffer_, bpl_ * height_); + + if (lastUpdatedRegion_ != NULL) + { + XDestroyRegion(lastUpdatedRegion_); + + lastUpdatedRegion_ = NULL; + } + + lastUpdatedRegion_ = XCreateRegion(); + + if (lineStatus_ != NULL) + { + delete[] lineStatus_; + } + + lineStatus_ = new LineStatus[height_ + 1]; + + if (lineStatus_ == NULL) + { + logError("CorePoller::init", ESET(ENOMEM)); + + return -1; + } + + // + // We need this boundary element to + // speed up the algo. + // + + if (linePriority_ != NULL) + { + delete[] linePriority_; + } + + linePriority_ = new int [height_ + 1]; + + if (linePriority_ == NULL) + { + logError("CorePoller::init", ESET(ENOMEM)); + + return -1; + } + + for (unsigned int i = 0; i < height_; i++) + { + linePriority_[i] = HIGHEST_PRIORITY; + } + + if (lefts_ != NULL) + { + delete[] lefts_; + } + + lefts_ = new int [height_]; + + if (rights_ != NULL) + { + delete[] rights_; + } + + rights_ = new int [height_]; + + for (unsigned int i = 0; i < height_; i++) + { + rights_[i] = lefts_[i] = 0; + } + + return 1; +} + +int CorePoller::isChanged(int (*checkIfInputCallback)(void *), void *arg, int *suspended) +{ + logTrace("CorePoller::isChanged"); + +#if defined(__CYGWIN32__) || defined(WIN32) + + checkDesktop(); + +#endif + +#if !defined(__CYGWIN32__) && !defined(WIN32) + + if (mirror_ == 1) + { + int result = mirrorChanges_; + + mirrorChanges_ = 0; + + return result; + } + +#endif + + logDebug("CorePoller:isChanged", "Going to use default polling algorithm.\n"); + + // + // In order to allow this function to + // be suspended and resumed later, we + // need to save these two status vars. + // + + static int idxIlace = 0; + static int curLine = 0; + + + const long timeout = 50; + long oldTime; + long newTime; + struct timeval ts; + + gettimeofday(&ts, NULL); + + oldTime = ts.tv_sec * 1000 + ts.tv_usec / 1000; + + if (curLine == 0) // && idxIlace == 0 ? + { + for (unsigned int i = 0; i < height_; i++) + { + lineStatus_[i] = LINE_NOT_CHECKED; + } + } + + int foundChanges = 0; + + foundChanges = 0; + + int curIlace = interlace_[idxIlace]; + + bool moveBackward = false; + + logDebug("CorePoller::isChanged", "Interlace index [%d] interlace [%d].", idxIlace, curIlace); + + for (; curLine < (int) height_; curLine++) + { + logDebug("CorePoller::isChanged", "Analizing line [%d] move backward [%d] status [%d] priority [%d].", + curLine, moveBackward, lineStatus_[curIlace], linePriority_[curLine]); + + // + // Ask the caller if the polling have to be suspended. + // + + if ((*checkIfInputCallback)(arg) == 1) + { + *suspended = 1; + + break; + } + + // + // Suspend if too much time is elapsed. + // + + gettimeofday(&ts, NULL); + + newTime = ts.tv_sec * 1000 + ts.tv_usec / 1000; + + if (newTime - oldTime >= timeout) + { + *suspended = 1; + + break; + } + + oldTime = newTime; + + if (lineStatus_[curLine] != LINE_NOT_CHECKED) + { + continue; + } + + if (moveBackward) + { + moveBackward = false; + } + else + { + switch (linePriority_[curLine]) + { + case 1: + case 29: + { + // + // It was a priority, + // but now it may not be. + // + } + case 31: + { + // + // Not a priority, still isn't. + // + + linePriority_[curLine] = NOT_PRIORITY; + + break; + } + case 0: + { + // + // Make it a priority. + // + + linePriority_[curLine] = PRIORITY; + + break; + } + default: + { + linePriority_[curLine]--; + + break; + } + } + + if ((linePriority_[curLine] > PRIORITY) && ((curLine & 31) != curIlace)) + { + continue; + } + } + + XRectangle rect = {0, curLine, width_, 1}; + + char *buffer; + + logDebug("CorePoller::isChanged", "Checking line [%d].", curLine); + + if ((buffer = getRect(rect)) == NULL) + { + logDebug("CorePoller::isChanged", "Failed to retrieve line [%d].", curLine); + + return -1; + } + + if (memcmp(buffer, buffer_ + curLine * bpl_, bpl_) == 0 || differ(buffer, rect) == 0) + { + logDebug("CorePoller::isChanged", "Data buffer didn't change."); + + lineStatus_[curLine] = LINE_NOT_CHANGED; + + continue; + } + + rect.x = lefts_[rect.y]; + rect.width = rights_[rect.y] - lefts_[rect.y] + 1; + + update(buffer + rect.x * bpp_, rect); + + foundChanges = 1; + + lineStatus_[curLine] = LINE_HAS_CHANGED; + + // + // Wake up the next line. + // + + if (linePriority_[curLine + 1] > PRIORITY) + { + linePriority_[curLine + 1] = HIGHEST_PRIORITY; + } + + // + // Give this line priority. + // + + linePriority_[curLine] = HIGHEST_PRIORITY; + + // + // Wake up previous line. + // + + if (curLine > 0 && lineStatus_[curLine - 1] == LINE_NOT_CHECKED) + { + moveBackward = true; + curLine -= 2; + } + } + + // + // Execution reached the end of loop. + // + + if (curLine == (int) height_) + { + idxIlace = (idxIlace + 1) % 32; + + curLine = 0; + } + + // + // Create the region of changed pixels. + // + + if (foundChanges) + { + int start, last, curLine, left, right; + + for (curLine = 0; curLine < (int) height_; curLine++) + { + if (lineStatus_[curLine] == LINE_HAS_CHANGED) + { + break; + } + } + + start = curLine; + last = curLine; + + left = lefts_[curLine]; + right = rights_[curLine]; + curLine++; + + while (1) + { + for (; curLine < (int) height_; curLine++) + { + if (lineStatus_[curLine] == LINE_HAS_CHANGED) + { + break; + } + } + + if (curLine == (int) height_) + { + break; + } + + if ((curLine - last > minSliceHeight_) || (last - start > maxSliceHeight_)) + { + XRectangle rect = {left, start, right - left + 1, last - start + 1}; + + XUnionRectWithRegion(&rect, lastUpdatedRegion_, lastUpdatedRegion_); + + start = curLine; + left = lefts_[curLine]; + right = rights_[curLine]; + } + else + { + if (lefts_[curLine] < left) + { + left = lefts_[curLine]; + } + + if (rights_[curLine] > right) + { + right = rights_[curLine]; + } + } + + last = curLine; + + curLine++; + } + + // + // Send last block. + // + + if (last >= start) + { + XRectangle rect = {left, start, right - left + 1, last - start + 1}; + + XUnionRectWithRegion(&rect, lastUpdatedRegion_, lastUpdatedRegion_); + } + } + + return foundChanges; +} + +int CorePoller::differ(char *buffer, XRectangle r) +{ + logTrace("CorePoller::differ"); + + int bpl = bpp_ * r.width; + int i; + char *pBuf; + char *pFb; + + pBuf = (buffer); + pFb = (buffer_ + r.x + r.y * bpl_); + + for (i = 0; i < bpl; i++) + { + if (*pFb++ != *pBuf++) + { + lefts_[r.y] = i / bpp_; + + break; + } + } + + if (i == bpl) + { + return 0; + } + + pBuf = (buffer) + bpl - 1; + pFb = (buffer_ + r.x + r.y * bpl_) + bpl - 1; + + int j = i - 1; + + for (i = bpl - 1; i > j; i--) + { + if (*pFb-- != *pBuf--) + { + rights_[r.y] = i / bpp_; + + break; + } + } + + return 1; +} + +void CorePoller::update(char *src, XRectangle r) +{ + logTrace("CorePoller::update"); + + char *dst = buffer_ + r.x * bpp_ + r.y * bpl_; + int bpl = bpp_ * r.width; + + for (unsigned int i = 0; i < r.height; i++) + { + if(((r.x * bpp_ + r.y * bpl_) + bpl) > (bpl_ * height_)) + { + // + // Out of bounds. Maybe a resize is going on. + // + + continue; + } + + memcpy(dst, src, bpl); + + src += bpl; + + dst += bpl_; + } +} + +void CorePoller::handleEvent(Display *display, XEvent *event) +{ + logTrace("CorePoller::handleEvent"); + + switch (event -> type) + { + case KeyPress: + case KeyRelease: + { + handleKeyboardEvent(display, event); + break; + } + case ButtonPress: + case ButtonRelease: + case MotionNotify: + { + handleMouseEvent(display, event); + break; + } + default: + { + logTest("CorePoller::handleEvent", "Handling unexpected event [%d] from display [%p].", + event -> type, display); + break; + } + } +} + +void CorePoller::handleWebKeyEvent(KeySym keysym, Bool isKeyPress) +{ + logTrace("CorePoller::handleWebKeyEvent"); + + handleWebKeyboardEvent(keysym, isKeyPress); +} + +void CorePoller::handleInput() +{ + while (input_ -> checkIfEvent()) + { + Display *display = input_ -> currentDisplay(); + XEvent *event = input_ -> popEvent(); + + handleEvent(display, event); + + delete event; + } +} + +void CorePoller::createFrameBuffer() +{ + logTrace("CorePoller::createFrameBuffer"); + + if (buffer_ == NULL) + { + buffer_ = new char[bpl_ * height_]; + } +} diff --git a/nxcompshad/src/Core.h b/nxcompshad/src/Core.h new file mode 100644 index 000000000..91f3f1e22 --- /dev/null +++ b/nxcompshad/src/Core.h @@ -0,0 +1,212 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef CorePoller_H +#define CorePoller_H + +#include + +#include "Logger.h" +#include "Regions.h" +#include "Input.h" + +typedef enum{ + LINE_HAS_CHANGED, + LINE_NOT_CHECKED, + LINE_NOT_CHANGED +} LineStatus; + +typedef enum{ + HIGHEST_PRIORITY = 0, + PRIORITY = 30, + NOT_PRIORITY = 90 +} LinePriority; + +class CorePoller +{ + public: + + CorePoller(Input*, Display*); + + virtual ~CorePoller(); + + virtual int init(); + + unsigned int width() const; + + unsigned int height() const; + + unsigned char depth() const; + + int isChanged(int (*)(void*), void *, int *); + + char *getFrameBuffer() const; + + void destroyFrameBuffer(); + + void createFrameBuffer(); + + Region lastUpdatedRegion(); + + Region getLastUpdatedRegion(); + + void handleInput(); + + void handleEvent(Display *, XEvent *); + + void handleWebKeyEvent(KeySym keysym, Bool isKeyPress); + + Display *getShadowDisplay(); + + void setShadowDisplay(Display *shadowDisplay); + + protected: + + unsigned int bpp_; + + unsigned int bpl_; + + unsigned int width_; + + unsigned int height_; + + int depth_; + + char *buffer_; + + unsigned long redMask_; + unsigned long greenMask_; + unsigned long blueMask_; + unsigned long colorMask_[3]; + + char mirror_; + + char mirrorChanges_; + + virtual int updateShadowFrameBuffer(void) = 0; + + virtual char *getRect(XRectangle r) = 0; + + int imageByteOrder_; + + #ifdef __CYGWIN32__ + virtual char checkDesktop(void) = 0; + #endif + + Display *shadowDisplay_; + + void update(char *src, XRectangle r); + + Region lastUpdatedRegion_; + + private: + + virtual void handleKeyboardEvent(Display *, XEvent *) = 0; + + virtual void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) = 0; + + virtual void handleMouseEvent(Display *, XEvent *) = 0; + + Input *input_; + + static const int maxSliceHeight_; + static const int minSliceHeight_; + + LineStatus *lineStatus_; + int *linePriority_; + + static const char interlace_[]; + + int *lefts_; + int *rights_; + + // FIXME: Make them friend. + + int differ(char *src, XRectangle r); +}; + +inline unsigned int CorePoller::width() const +{ + return width_; +} + +inline unsigned int CorePoller::height() const +{ + return height_; +} + +inline unsigned char CorePoller::depth() const +{ + return depth_; +} + +inline char *CorePoller::getFrameBuffer() const +{ + return buffer_; +} + +inline void CorePoller::destroyFrameBuffer() +{ + if (buffer_ != NULL) + { + delete[] buffer_; + buffer_ = NULL; + } +} + +inline Region CorePoller::lastUpdatedRegion() +{ + Region region = lastUpdatedRegion_; + + lastUpdatedRegion_ = XCreateRegion(); + + if (lastUpdatedRegion_ == NULL) + { + logError("CorePoller::lastUpdatedRegion", ESET(ENOMEM)); + + lastUpdatedRegion_ = region; + + return NULL; + } + + return region; +} + +inline Region CorePoller::getLastUpdatedRegion() +{ + return lastUpdatedRegion_; +} + +inline Display *CorePoller::getShadowDisplay() +{ + return shadowDisplay_ ; +} + +inline void CorePoller::setShadowDisplay(Display *shadowDisplay) +{ + shadowDisplay_ = shadowDisplay; +} + +#endif /* CorePoller_H */ diff --git a/nxcompshad/src/Input.cpp b/nxcompshad/src/Input.cpp new file mode 100644 index 000000000..8de74c3c3 --- /dev/null +++ b/nxcompshad/src/Input.cpp @@ -0,0 +1,179 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include "Input.h" +#include "Logger.h" + +Input::Input() +{ + logTrace("Input::Input"); + + eventsHead_ = NULL; + eventsTail_ = NULL; + keymap_ = NULL; +} + +Input::~Input() +{ + logTrace("Input::~Input"); + + Event *head = eventsHead_; + + while (head) + { + Event *next = head -> next; + + delete head -> event; + delete head; + + head = next; + } + + if (keymap_ != NULL) + { + logDebug("Input::~Input", "Delete keymap_ [%p].", keymap_); + + delete [] keymap_; + } +} + +void Input::pushEvent(Display *display, XEvent *event) +{ + Event *tail = new Event; + + if (tail == NULL) + { + logError("Input::pushEvent", ESET(ENOMEM)); + + return; + } + + tail -> next = NULL; + tail -> display = display; + tail -> event = event; + + if (eventsHead_ == NULL) + { + eventsHead_ = tail; + } + else + { + eventsTail_ -> next = tail; + } + + eventsTail_ = tail; +} + +XEvent *Input::popEvent() +{ + Event *head = eventsHead_; + + if (head == NULL) + { + return 0; + } + + XEvent *event = head -> event; + + eventsHead_ = head -> next; + + delete head; + + if (eventsHead_ == NULL) + { + eventsTail_ = NULL; + } + + return event; +} + +int Input::removeAllEvents(Display *display) +{ + logTrace("Input::removeAllEvents"); + + int nRemoved = 0; + + Event *current = eventsHead_; + + while (current) + { + if (display == current -> display) + { + // + // Update head of list. + // + + if (current == eventsHead_) + { + eventsHead_ = current -> next; + } + + // + // Update tail of list. + // + + if (current == eventsTail_) + { + eventsTail_ = eventsHead_; + + while (eventsTail_ && eventsTail_ -> next) + { + eventsTail_ = eventsTail_ -> next; + } + } + + // + // Remove event. + // + + Event *next = current -> next; + + delete current -> event; + delete current; + + current = next; + + nRemoved++; + } + else + { + current = current -> next; + } + } + + return nRemoved; +} + diff --git a/nxcompshad/src/Input.h b/nxcompshad/src/Input.h new file mode 100644 index 000000000..cbba029a9 --- /dev/null +++ b/nxcompshad/src/Input.h @@ -0,0 +1,99 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Input_H +#define Input_H + +#include + +typedef struct Event +{ + struct Event *next; + Display *display; + XEvent *event; +} Event; + +class Input +{ + public: + + Input(); + + ~Input(); + + int checkIfEvent(); + + void pushEvent(Display *, XEvent *); + + XEvent *popEvent(); + Display *currentDisplay(); + + int removeAllEvents(Display *); + + void setKeymap(char *keymap); + char *getKeymap(); + + void setShadowDisplayName(char *shadowDisplayName); + char *getShadowDisplayName(); + + private: + + Event *eventsHead_; + Event *eventsTail_; + char *keymap_; + char *shadowDisplayName_; +}; + +inline Display *Input::currentDisplay() +{ + return eventsHead_ ? eventsHead_ -> display : NULL; +} + +inline int Input::checkIfEvent() +{ + return (eventsHead_ != NULL); +} + +inline void Input::setKeymap(char *keymap) +{ + keymap_ = keymap; +} + +inline char *Input::getKeymap() +{ + return keymap_; +} + +inline void Input::setShadowDisplayName(char *shadowDisplayName) +{ + shadowDisplayName_ = shadowDisplayName; +} + +inline char *Input::getShadowDisplayName() +{ + return shadowDisplayName_; +} + +#endif /* Input_H */ diff --git a/nxcompshad/src/Logger.cpp b/nxcompshad/src/Logger.cpp new file mode 100644 index 000000000..9648509b8 --- /dev/null +++ b/nxcompshad/src/Logger.cpp @@ -0,0 +1,128 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#define PANIC +#define WARNING +#undef TEST +#define DEBUG + +#include "Misc.h" +#include "Logger.h" + +Logger logger; + +void Logger::user(const char *format, va_list arguments) +{ + char string[1024]; + + vsnprintf(string, 1024, format, arguments); + + fprintf(stderr, "%s\n", string); +} + +void Logger::error(const char *name, int error) +{ + fprintf(stderr, "PANIC! %s: Failed with code %d: %s\n", + name, error, strerror(error)); +} + +void Logger::warning(const char *name, const char *format, va_list arguments) +{ + char string[1024]; + + vsnprintf(string, 1024, format, arguments); + + fprintf(stderr, "%s: WARNING! %s\n", name, string); +} + +void Logger::test(const char *name, const char *format, va_list arguments) +{ + char string[1024]; + + vsnprintf(string, 1024, format, arguments); + + fprintf(stderr, "%s: %s\n", name, string); +} + +void Logger::trace(const char *name) +{ + fprintf(stderr, "%s\n", name); +} + +void Logger::debug(const char *name, const char *format, va_list arguments) +{ + char string[1024]; + + vsnprintf(string, 1024, format, arguments); + + fprintf(stderr, "%s: %s\n", name, string); +} + +void Logger::dump(const char *name, const char *data, int size) +{ + fprintf(stderr, "%s: Dumping %d bytes of data at %p\n", + name, size, data); + + for (int i = 0; i < size;) + { + fprintf(stderr, "[%d]\t", i); + + int t = i; + + for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) + { + fprintf(stderr, "%02x/%d\t", data[i] & 0xff, data[i]); + } + + for (unsigned int ii = i % 8; ii > 0 && ii < 8; ii++) + { + fprintf(stderr, "\t"); + } + + i = t; + + for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) + { + if (isprint(data[i])) + { + fprintf(stderr, "%c", data[i]); + } + else + { + fprintf(stderr, "."); + } + } + + fprintf(stderr, "\n"); + } +} diff --git a/nxcompshad/src/Logger.h b/nxcompshad/src/Logger.h new file mode 100644 index 000000000..eba81f642 --- /dev/null +++ b/nxcompshad/src/Logger.h @@ -0,0 +1,167 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Logger_H +#define Logger_H + +#include +#include + +// +// Error handling macros. +// + +#define ESET(e) (errno = (e)) +#define EGET() (errno) +#define ESTR() strerror(errno) + +extern class Logger logger; + +class Logger +{ + public: + + void user(const char *format, va_list arguments); + + void error(const char *name, int error); + + void warning(const char *name, const char *format, va_list arguments); + + void test(const char *name, const char *format, va_list arguments); + + void trace(const char *name); + + void debug(const char *name, const char *format, va_list arguments); + + void dump(const char *name, const char *data, int size); +}; + +static inline void logUser(const char *format, ...) \ + __attribute__((format(printf, 1, 2))) __attribute__((__unused__)); + +static inline void logError(const char *name, int error) \ + __attribute__((__unused__)); + +static inline void logWarning(const char *name, const char *format, ...) \ + __attribute__((__unused__)); + +static inline void logTest(const char *name, const char *format, ...) \ + __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); + +static inline void logTrace(const char *name) \ + __attribute__((__unused__)); + +static inline void logDebug(const char *name, const char *format, ...) \ + __attribute__((format(printf, 2, 3))) __attribute__((__unused__)); + +static inline void logDump(const char *name, const char *data, int size) \ + __attribute__((__unused__)); + +static inline void logUser(const char *format, ...) +{ + va_list arguments; + + va_start(arguments, format); + + logger.user(format, arguments); + + va_end(arguments); +} + +static inline void logError(const char *name, int error) +{ + #if defined(DEBUG) || defined(TEST) || \ + defined(WARNING) || defined(PANIC) + + logger.error(name, error); + + #endif +} + +static inline void logWarning(const char *name, const char *format, ...) +{ + #if defined(DEBUG) || defined(TEST) || \ + defined(WARNING) + + va_list arguments; + + va_start(arguments, format); + + logger.warning(name, format, arguments); + + va_end(arguments); + + #endif +} + +static inline void logTest(const char *name, const char *format, ...) +{ + #if defined(TEST) + + va_list arguments; + + va_start(arguments, format); + + logger.test(name, format, arguments); + + va_end(arguments); + + #endif +} + +static inline void logTrace(const char *name) +{ + #if defined(DEBUG) + + logger.trace(name); + + #endif +} + +static inline void logDebug(const char *name, const char *format, ...) +{ + #if defined(DEBUG) + + va_list arguments; + + va_start(arguments, format); + + logger.debug(name, format, arguments); + + va_end(arguments); + + #endif +} + +static inline void logDump(const char *name, const char *data, int size) +{ + #if defined(TEST) + + logger.dump(name, data, size); + + #endif +} + +#endif /* Logger_H */ diff --git a/nxcompshad/src/Makefile.am b/nxcompshad/src/Makefile.am new file mode 100644 index 000000000..c7f45ba27 --- /dev/null +++ b/nxcompshad/src/Makefile.am @@ -0,0 +1,45 @@ +NULL = + +lib_LTLIBRARIES = libXcompshad.la + +libXcompshad_la_SOURCES = \ + Core.cpp \ + Input.cpp \ + Logger.cpp \ + Manager.cpp \ + Shadow.cpp \ + Updater.cpp \ + Win.cpp \ + X11.cpp \ + $(NULL) + +libXcompshad_la_LIBADD = \ + @Xext_LIBS@ \ + @Xdamage_LIBS@ \ + @Xrandr_LIBS@ \ + @Xtst_LIBS@ \ + -L$(top_srcdir)/../nx-X11/exports/lib -lNX_X11 \ + $(NULL) + +AM_CFLAGS = \ + $(Xext_CFLAGS) \ + $(Xdamage_CFLAGS) \ + $(Xrandr_CFLAGS) \ + $(Xtst_CFLAGS) \ + $(NULL) + +AM_CXXFLAGS = \ + $(BASE_CXXFLAGS) \ + $(NULL) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/../nx-X11/exports/include \ + $(NULL) + +libXcompshad_la_LDFLAGS = -version-number @LT_COMPSHAD_VERSION@ -no-undefined + +libXcompshadincludedir = $(includedir)/nx +libXcompshadinclude_HEADERS = \ + $(top_srcdir)/include/Shadow.h \ + $(NULL) diff --git a/nxcompshad/src/Manager.cpp b/nxcompshad/src/Manager.cpp new file mode 100644 index 000000000..6e3f6b1b0 --- /dev/null +++ b/nxcompshad/src/Manager.cpp @@ -0,0 +1,264 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include "Manager.h" +#include "Logger.h" + +UpdateManager::UpdateManager(int w, int h, char *f, Input *i) + : width_(w), height_(h), frameBuffer_(f), input_(i) +{ + logTrace("UpdateManager::UpdateManager"); + + nUpdater = 0; + updaterVector = NULL; + updateManagerRegion_ = NULL; +} + +UpdateManager::~UpdateManager() +{ + logTrace("UpdateManager::~UpdateManager"); + + for (int i = 0; i < nUpdater; i++) + { + delete updaterVector[i]; + } + + delete [] updaterVector; +} + +Updater *UpdateManager::createUpdater(char *displayName, Display *display) +{ + Updater *updater = new Updater(displayName, display); + + if (updater == NULL) + { + logError("UpdateManager::createUpdater", ESET(ENOMEM)); + + return NULL; + } + + if (updater -> init(width_, height_, frameBuffer_, input_) == -1) + { + logError("UpdateManager::createUpdater", EGET()); + + delete updater; + + return NULL; + } + + return updater; +} + +UpdaterHandle UpdateManager::addUpdater(char *displayName, Display *display) +{ + Updater *newUpdater = createUpdater(displayName, display); + + if (newUpdater == NULL) + { + logError("UpdateManager::addUpdater", EGET()); + + return NULL; + } + + Updater **newUpdaterVector = new Updater*[nUpdater + 1]; + + if (newUpdaterVector == NULL) + { + logError("UpdateManager::addUpdater", ESET(ENOMEM)); + + delete newUpdater; + + return NULL; + } + + for (int i = 0; i < nUpdater; i++) + { + newUpdaterVector[i] = updaterVector[i]; + } + + newUpdaterVector[nUpdater] = newUpdater; + + delete [] updaterVector; + + updaterVector = newUpdaterVector; + + nUpdater++; + + logTest("UpdateManager::AddUpdater", "Number of updaters [%d].", nUpdater); + + return reinterpret_cast(newUpdater); +} + +int UpdateManager::removeAllUpdaters() +{ + logTest("UpdateManager::removeAllUpdaters", "Number of updaters [%d].", nUpdater); + + int nullUpdaters = 0; + + for (int i = nUpdater; i > 0; i--) + { + if (removeUpdater(reinterpret_cast(updaterVector[i - 1])) == 0) + { + nullUpdaters++; + } + } + + if (nUpdater == 0) + { + return 1; + } + + if (nUpdater == nullUpdaters) + { + logTest("UpdateManager::removeAllUpdaters", "Ignored null records in Updater vector."); + + return 0; + } + + logTest("UpdateManager::removeAllUpdaters", "Failed to remove some updaters."); + + return -1; +} + +int UpdateManager::removeUpdater(UpdaterHandle handle) +{ + Updater * const updater = (Updater*) handle; + + logTest("UpdateManager::removeUpdater", "Removing Updater [%p].", updater); + + if (updater == NULL) + { + return 0; + } + + for (int i = 0; i < nUpdater; i++) + { + if (updater == updaterVector[i]) + { + updaterVector[i] = updaterVector[nUpdater - 1]; + + nUpdater--; + + delete updater; + + return 1; + } + } + + logTest("UpdateManager::removeUpdater", "Couldn't find Updater [%p].", updater); + + return -1; +} + +void UpdateManager::addRegion(Region region) +{ + logTrace("UpdateManager::addRegion"); + + for (int i = 0; i < nUpdater; i++) + { + updaterVector[i] -> addRegion(region); + } + + XDestroyRegion(region); +} + +void UpdateManager::update() +{ + logTrace("UpdateManager::update"); + + for (int i = 0; i < nUpdater; i++) + { + /*updaterVector[i] -> update();*/ + if (updaterVector[i] -> getUpdateRegion()) + { + logDebug("UpdateManager::update", "pRegion [%p] rect[%ld].", + updaterVector[i] -> getUpdateRegion(), (updaterVector[i] -> getUpdateRegion()) -> numRects); + + updateManagerRegion_ = updaterVector[i] -> getUpdateRegion(); + // + // FIXME: Remove me. + // + for (int j = 0; j < updateManagerRegion_ -> numRects; j++) + { + int x = updateManagerRegion_ -> rects[j].x1; + int y = updateManagerRegion_ -> rects[j].y1; + unsigned int width = updateManagerRegion_ -> rects[j].x2 - updateManagerRegion_ -> rects[j].x1; + unsigned int height = updateManagerRegion_ -> rects[j].y2 - updateManagerRegion_ -> rects[j].y1; + logDebug("UpdateManager::update", "x[%d]y[%d]width[%u]height[%u], updateManagerRegion_[%p]", + x, y, width, height, updateManagerRegion_); + } + } + } +} + +void UpdateManager::handleInput() +{ + logTrace("UpdateManager::handleInput"); + + for (int i = 0; i < nUpdater; i++) + { + try + { + updaterVector[i] -> handleInput(); + } + catch (UpdaterClosing u) + { + logTest("UpdateManager::handleInput", "Catched exception UpdaterClosing()."); + + removeUpdater((UpdaterHandle)updaterVector[i]); + + // + // Now the i-element of the updaterVector + // is changed. We don't want to skip it. + // + + i--; + } + } +} + +void UpdateManager::newRegion() +{ + logTrace("UpdateManager::newRegion"); + + for (int i = 0; i < nUpdater; i++) + { + updaterVector[i] -> newRegion(); + } +} diff --git a/nxcompshad/src/Manager.h b/nxcompshad/src/Manager.h new file mode 100644 index 000000000..92a82cd32 --- /dev/null +++ b/nxcompshad/src/Manager.h @@ -0,0 +1,123 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef UpdateManager_H +#define UpdateManager_H + +#include + +#include "Updater.h" +#include "Regions.h" +#include "Input.h" + +typedef char* UpdaterHandle; + +class UpdateManager +{ + public: + + UpdateManager(int, int, char *, Input *); + + ~UpdateManager(); + + void handleInput(); + + void addRegion(Region); + + void update(); + + UpdaterHandle addUpdater(char *displayName, Display *display); + + int removeUpdater(UpdaterHandle); + + int removeAllUpdaters(); + + int numberOfUpdaters(); + + int getWidth(); + + int getHeight(); + + char *getBuffer(); + + Region getUpdateManagerRegion(); + + void destroyUpdateManagerRegion(); + + void newRegion(); + + private: + + Updater *createUpdater(char *displayName, Display *display); + + int width_; + int height_; + char *frameBuffer_; + Input *input_; + + int nUpdater; + + Updater **updaterVector; + + Region updateManagerRegion_; + +}; + +inline int UpdateManager::numberOfUpdaters() +{ + return nUpdater; +} + +inline int UpdateManager::getWidth() +{ + return width_; +} + +inline int UpdateManager::getHeight() +{ + return height_; +} + +inline char *UpdateManager::getBuffer() +{ + return frameBuffer_; +} + +inline Region UpdateManager::getUpdateManagerRegion() +{ + return updateManagerRegion_; +} + +inline void UpdateManager::destroyUpdateManagerRegion() +{ + if (updateManagerRegion_ != NULL) + { + XDestroyRegion(updateManagerRegion_); + + updateManagerRegion_ = NULL; + } +} + +#endif /* UpdateManager_H */ diff --git a/nxcompshad/src/Misc.h b/nxcompshad/src/Misc.h new file mode 100644 index 000000000..9386dc080 --- /dev/null +++ b/nxcompshad/src/Misc.h @@ -0,0 +1,50 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Misc_H +#define Misc_H + +#include + +#include +#include + +using namespace std; + +// +// Error handling macros. +// + +#define ESET(e) (errno = (e)) +#define EGET() (errno) +#define ESTR() strerror(errno) + +// +// Log file. +// + +extern ostream *logofs; + +#endif /* Misc_H */ diff --git a/nxcompshad/src/Poller.h b/nxcompshad/src/Poller.h new file mode 100644 index 000000000..6236f872f --- /dev/null +++ b/nxcompshad/src/Poller.h @@ -0,0 +1,39 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Poller_H +#define Poller_H + +#if defined(__CYGWIN32__) || defined(WIN32) + +#include "Win.h" + +#else + +#include "X11.h" + +#endif + +#endif /* Poller_H */ diff --git a/nxcompshad/src/Regions.h b/nxcompshad/src/Regions.h new file mode 100644 index 000000000..59fdcb46c --- /dev/null +++ b/nxcompshad/src/Regions.h @@ -0,0 +1,43 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Region_H +#define Region_H + +#include +#include + +typedef struct { + short x1, x2, y1, y2; +} Box, BOX, BoxRec, *BoxPtr; + +typedef struct _XRegion { + long size; + long numRects; + BOX *rects; + BOX extents; +}; + +#endif /* Region_H */ diff --git a/nxcompshad/src/Shadow.cpp b/nxcompshad/src/Shadow.cpp new file mode 100644 index 000000000..3db5039ce --- /dev/null +++ b/nxcompshad/src/Shadow.cpp @@ -0,0 +1,482 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include "Logger.h" +#include "Shadow.h" +#include "Poller.h" +#include "Manager.h" + +typedef struct { + KeySym *map; + KeyCode minKeyCode, + maxKeyCode; + int mapWidth; +} KeySymsRec, *KeySymsPtr; + +KeySymsPtr NXShadowKeymap = NULL; + +ShadowOptions NXShadowOptions = {1, 1, -1}; + +static int mirrorException = 0; + +static UpdateManager *updateManager; +static Poller *poller; +static Input *input; + +int NXShadowRemoveAllUpdaters(); + +inline bool NXShadowNotInitialized() +{ + // + // updateManager depends on input and poller. + // So this test seem redundant. + // + // return (input == NULL) || (poller == NULL) || (updateManager == NULL); + // + + return (updateManager == NULL); +} + +#ifdef NEED_SIGNAL_HANDLER +static void NXSignalHandler(int signal) +{ + logTest("NXSignalHandler", "Got signal [%d]", signal); + + if (signal == SIGINT) + { + mirrorException = 1; + } + else if (signal == SIGTERM) + { + mirrorException = 1; + } +} + +static int NXInitSignal() +{ + logTrace("NXInitSignal"); + + struct sigaction sa; + + sa.sa_handler = NXSignalHandler; + sigfillset(&sa.sa_mask); + sa.sa_flags = 0; + + int res; + + while ((res = sigaction(SIGINT, &sa, NULL)) == -1 && + errno == EINTR); + + if (res == -1) + { + logError("NXInitSignal", EGET()); + + return -1; + } + + return 1; +} +#endif + +static void NXHandleException() +{ + if (mirrorException) + { + mirrorException = 0; + + NXShadowRemoveAllUpdaters(); + } +} + +static int NXCreateInput(char *keymap, char *shadowDisplayName) +{ + logTrace("NXCreateInput"); + + input = new Input; + + if (input == NULL) + { + logError("NXCreateInput", ESET(ENOMEM)); + + return -1; + } + + input -> setKeymap(keymap); + + input -> setShadowDisplayName(shadowDisplayName); + + return 1; +} + +static int NXCreatePoller(Display *display, Display **shadowDisplay) +{ + logTrace("NXCreatePoller"); + + if (input == NULL) + { + logError("NXCreatePoller", ESET(EBADF)); + + return -1; + } + + poller = new Poller(input,display); + + if (poller == NULL) + { + logError("NXCreatePoller", ESET(ENOMEM)); + + return -1; + } + + if (poller -> init() == -1) + { + logWarning("NXCreatePoller", "Failed to initialize poller."); + + return -1; + } + + *shadowDisplay = poller -> getShadowDisplay(); + + logTest("NXCreatePoller", "Poller geometry [%d, %d], ShadowDisplay[%p].", poller -> width(), + poller -> height(), (Display *) *shadowDisplay); + + return 1; +} + +static int NXCreateUpdateManager() +{ + logTrace("NXCreateUpdateManager"); + + if (input == NULL || poller == NULL) + { + logError("NXCreateUpdateManager", ESET(EBADF)); + + return -1; + } + + updateManager = new UpdateManager(poller -> width(), poller -> height(), + poller -> getFrameBuffer(), input); + + if (updateManager == NULL) + { + logError("NXCreateUpdateManager", ESET(ENOMEM)); + + return -1; + } + + return 1; +} + +void NXShadowResetOptions() +{ + NXShadowOptions.optionShmExtension = 1; + NXShadowOptions.optionDamageExtension = 1; +} + +// +// Exported functions. +// + +int NXShadowHasUpdaters() +{ + logTrace("NXShadowHasUpdaters"); + + return (updateManager && updateManager -> numberOfUpdaters()) ? 1 : 0; +} + +int NXShadowRemoveAllUpdaters() +{ + logTrace("NXShadowRemoveAllUpdaters"); + + return updateManager ? updateManager -> removeAllUpdaters() : 0; +} + +int NXShadowRemoveUpdater(UpdaterHandle handle) +{ + logTrace("NXShadowRemoveUpdater"); + + return updateManager ? updateManager -> removeUpdater(handle) : 0; +} + +UpdaterHandle NXShadowAddUpdater(char *displayName) +{ + logTrace("NXShadowAddUpdater"); + + return updateManager ? updateManager -> addUpdater(displayName, NULL) : NULL; +} + +int NXShadowAddUpdaterDisplay(void *dpy, int *w, int *h, unsigned char *d) +{ + Display *display = reinterpret_cast(dpy); + + logTrace("NXShadowAddUpdaterDisplay"); + + if ((updateManager ? updateManager -> addUpdater(NULL, display) : NULL) == NULL) + { + logTest("NXShadowAddUpdaterDisplay", "Error"); + + return 0; + } + + *w = updateManager -> getWidth(); + *h = updateManager -> getHeight(); + *d = poller -> depth(); + + return 1; +} + +int NXShadowCreate(void *dpy, char *keymap, char* shadowDisplayName, void **shadowDpy) +{ + logTrace("NXShadowCreate"); + + Display *display = reinterpret_cast(dpy); + Display **shadowDisplay = reinterpret_cast(shadowDpy); + +/* if (NXInitSignal() != 1) + { + logError("NXShadowCreate", EGET()); + + return -1; + }*/ + + if (NXCreateInput(keymap, shadowDisplayName) != 1) + { + logError("NXShadowCreate", EGET()); + + return -1; + } + + if (NXCreatePoller(display, shadowDisplay) != 1) + { + logWarning("NXShadowCreate", "NXCreatePoller failed."); + + return -1; + } + + if (NXCreateUpdateManager() != 1) + { + logError("NXShadowCreate", EGET()); + + return -1; + } + + return 1; +} + +#if !defined(__CYGWIN32__) && !defined(WIN32) + +void NXShadowSetDisplayUid(int uid) +{ + NXShadowOptions.optionShadowDisplayUid = uid; +} + +void NXShadowDisableShm(void) +{ + logUser("NXShadowDisableShm: Disabling SHM.\n"); + + NXShadowOptions.optionShmExtension = 0; +} + +void NXShadowDisableDamage(void) +{ + NXShadowOptions.optionDamageExtension = 0; +} + +void NXShadowGetScreenSize(int *w, int *h) +{ + poller -> getScreenSize(w, h); +} + +void NXShadowSetScreenSize(int *w, int *h) +{ + poller -> setScreenSize(w, h); +} + +#endif + +void NXShadowDestroy() +{ + if (poller) + { + delete poller; + + poller = NULL; + } + + if (updateManager) + { + delete updateManager; + + updateManager = NULL; + } + + if (input) + { + delete input; + + input = NULL; + } +} + +void NXShadowHandleInput() +{ + logTrace("NXShadowHandleInput"); + + if (NXShadowNotInitialized()) + { + logError("NXShadowHandleInput - NXShadow not properly initialized.", ESET(EBADF)); + + return; + } + + NXHandleException(); + + updateManager -> handleInput(); + + poller -> handleInput(); +} + +int NXShadowHasChanged(int (*callback)(void *), void *arg, int *suspended) +{ + int result; + + logTrace("NXShadowHasChanged"); + + if (NXShadowNotInitialized()) + { + logError("NXShadowHasChanged - NXShadow not properly initialized.", ESET(EBADF)); + + return -1; + } + + // + // FIXME + //updateManager -> destroyUpdateManagerRegion(); + // + + updateManager -> newRegion(); + +#if !defined(__CYGWIN32__) && !defined(WIN32) + poller -> getEvents(); +#endif + + result = poller -> isChanged(callback, arg, suspended); + + if (result == 1) + { + updateManager -> addRegion(poller -> lastUpdatedRegion()); + + return 1; + } + else if (result == -1) + { + logTest("NXShadowHasChanged", "Scanline error."); + return -1; + } + + return 0; +} + +void NXShadowExportChanges(long *numRects, char **pBox) +{ + Region pReg; + + logTrace("NXShadowExportChanges"); + + if (NXShadowNotInitialized()) + { + logError("NXShadowExportChanges - NXShadow not properly initialized.", ESET(EBADF)); + } + + updateManager -> update(); + pReg = updateManager -> getUpdateManagerRegion(); + *numRects = pReg -> numRects; + *pBox = (char *)pReg -> rects; + + logTest("NXShadowExportChanges", "numRects [%ld] pBox[%p], pReg->numRects[%ld], rects[%p], size[%lu]", + *numRects, *pBox, pReg -> numRects, &(pReg -> rects -> x2), + (unsigned long) sizeof(pReg -> rects -> x2)); +} + +void NXShadowEvent(Display *display, XEvent event) +{ + poller -> handleEvent(display, &event); +} + +void NXShadowWebKeyEvent(KeySym keysym, Bool isKeyPress) +{ + poller -> handleWebKeyEvent(keysym, isKeyPress); +} + +#ifdef __CYGWIN32__ + +int NXShadowCaptureCursor(unsigned int wnd, void *vis) +{ + Window window = (Window)wnd; + Visual *visual = reinterpret_cast(vis); + + logTrace("NXShadowCaptureCursor"); + + logTest("NXShadowCaptureCursor","Init"); + + return poller -> updateCursor(window, visual); +} + +#endif + +void NXShadowUpdateBuffer(void **buffer) +{ + char **fBuffer = reinterpret_cast(buffer); + + if (*fBuffer != NULL) + { + poller -> destroyFrameBuffer(); + + poller -> init(); + } + + *fBuffer = poller -> getFrameBuffer(); + + logTest("NXShadowUpdateBuffer","New frame buffer [0x%p]", (void *)*fBuffer); +} + +void NXShadowInitKeymap(void *keysyms) +{ + NXShadowKeymap = (KeySymsPtr) keysyms; + + logTest("NXShadowInitKeymap","KeySyms pointer [0x%p]", (void *)NXShadowKeymap); +} diff --git a/nxcompshad/src/Updater.cpp b/nxcompshad/src/Updater.cpp new file mode 100644 index 000000000..4b677a78c --- /dev/null +++ b/nxcompshad/src/Updater.cpp @@ -0,0 +1,395 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +// +#include +// +#include "Updater.h" +#include "Logger.h" + +Updater::Updater(char *displayName, Display *display) +{ + logTrace("Updater::Updater"); + + displayName_ = displayName; + display_ = display; + closeDisplay_ = false; + image_ = NULL; + updateRegion_ = NULL; + buffer_ = NULL; +} + +Updater::~Updater() +{ + logTrace("Updater::~Updater"); + + if (input_) + { + int removedEvents = input_ -> removeAllEvents(display_); + + logTest("Updater::~Updater", "Removed events in input queue is [%d].", removedEvents); + } + + if (display_) + { + XDestroyWindow(display_, window_); + XFreePixmap(display_, pixmap_); + + if (closeDisplay_) + { + XCloseDisplay(display_); + } + } + + if (image_) + { + image_ -> data = NULL; + + XDestroyImage(image_); + } + + if (updateRegion_) + { + XDestroyRegion(updateRegion_); + } +} + +int Updater::init(int width, int height, char *fb, Input *input) +{ + logTrace("Updater::init"); + + if (fb == NULL || input == NULL || width <= 0 || height <= 0) + { + logError("Updater::init", ESET(EINVAL)); + + return -1; + } + + width_ = width; + height_ = height; + buffer_ = fb; + input_ = input; +/* + if (display_ == NULL) + { + display_ = XOpenDisplay(displayName_); + + closeDisplay_ = true; + + if (display_ == NULL) + { + logError("Updater::init", ESET(ENOMSG)); + + return -1; + } + } +*/ + depth_ = DefaultDepth(display_, DefaultScreen(display_)); + + if (depth_ == 8) bpl_ = width_; + else if (depth_ == 16) bpl_ = width_ * 2; + else bpl_ = width_ * 4; + + logTest("Updater::init", "Server geometry [%d, %d] depth [%d] bpl [%d].", width_, height_, depth_, bpl_); + +/* int bitmap_pad = 8; + + image_ = XCreateImage(display_, DefaultVisual(display_, DefaultScreen(display_)), depth_, ZPixmap, 0, + buffer_, width_, height_, bitmap_pad, 0); + + if (image_ == NULL) + { + logError("Updater::init", ESET(ENOMSG)); + + logTest("Updater::init", "Failed to create default image."); + + return -1; + } + + pixmap_ = XCreatePixmap(display_, DefaultRootWindow(display_), width_, height_, depth_); + + unsigned int mask = CWBackPixmap | CWBorderPixel | CWEventMask; + + XSetWindowAttributes attributes; + + attributes.background_pixmap = pixmap_; + attributes.border_pixel = WhitePixel(display_, DefaultScreen(display_)); + attributes.event_mask = KeyPressMask | KeyReleaseMask | ButtonPressMask | ButtonReleaseMask; + + window_ = XCreateWindow(display_, DefaultRootWindow(display_), + 0, 0, width_, height_, 0, depth_, InputOutput, + DefaultVisual(display_, DefaultScreen(display_)), mask, &attributes); + + if (window_ == None) + { + logError("Updater::init", ESET(ENOMSG)); + + return -1; + } + + XSizeHints *size_hints; + + if ((size_hints = XAllocSizeHints()) == NULL) + { + logError("Updater::init", ESET(ENOMEM)); + + return -1; + } + + size_hints -> flags = PMinSize | PMaxSize; + size_hints -> min_width = width_; + size_hints -> max_width = width_; + size_hints -> min_height = height_; + size_hints -> max_height = height_; + + XSetWMNormalHints(display_, window_, size_hints); + + XFree(size_hints); + + Atom deleteWMatom = XInternAtom(display_, "WM_DELETE_WINDOW", 1); + + XSetWMProtocols(display_, window_, &deleteWMatom, 1); + + XMapWindow(display_, window_);*/ + + updateRegion_ = XCreateRegion(); + + logTest("Updater::init", "updateRegion_[%p]", updateRegion_); + return 1; +} + +void Updater::addRegion(Region region) +{ + // + // FIXME: Is this too paranoid ? + // + + if (updateRegion_ == NULL) + { + logError("Updater::addRegion", ESET(EINVAL)); + + return; + } + + XUnionRegion(region, updateRegion_, updateRegion_); +} + +void Updater::update() +{ + logTrace("Updater::update"); + + if (updateRegion_ == NULL) + { + logError("Updater::update", ESET(EINVAL)); + + return; + } + + logTest("Updater::update", "Number of rectangles [%ld].", updateRegion_ -> numRects); + +/* for (; updateRegion_ -> numRects > 0; updateRegion_ -> numRects--) + { + int n = updateRegion_ -> numRects - 1; + + int x = updateRegion_ -> rects[n].x1; + int y = updateRegion_ -> rects[n].y1; + unsigned int width = updateRegion_ -> rects[n].x2 - updateRegion_ -> rects[n].x1; + unsigned int height = updateRegion_ -> rects[n].y2 - updateRegion_ -> rects[n].y1; + + logDebug("Updater::update", "Sending rectangle: [%d, %d, %d, %d].", x, y, width, height); + + // + // We need to update the extents. + // + + int bitmap_pad; + + if (depth_ == 32 || depth_ == 24) + { + bitmap_pad = 32; + } + else if (depth_ == 16) + { + if ((width & 1) == 0) + { + bitmap_pad = 32; + } + else + { + bitmap_pad = 16; + } + } + else if ((width & 3) == 0) + { + bitmap_pad = 32; + } + else if ((width & 1) == 0) + { + bitmap_pad = 16; + } + else + { + bitmap_pad = 8; + }*/ + +/* image_ -> bitmap_pad = bitmap_pad;*/ + + /* NXShadowCorrectColor(x, y, width, height);*/ + +/* XPutImage(display_, pixmap_, DefaultGC(display_, DefaultScreen(display_)), + image_, x, y, x, y, width, height); + + XClearArea(display_, window_, x, y, width, height, 0); + }*/ + + // + // Should we reduces the box vector ? + // + // BOX *box = Xrealloc(updateRegion_ -> rects, + // updateRegion_ -> numRects == 0 ? sizeof(BOX) : + // updateRegion_ -> numRects * sizeof(BOX)); + // + // if (box) + // { + // updateRegion_ -> rects = box; + // updateRegion_ -> size = 1; + // } + // + + if (updateRegion_ -> numRects == 0) + { + updateRegion_ -> extents.x1 = 0; + updateRegion_ -> extents.y1 = 0; + updateRegion_ -> extents.x2 = 0; + updateRegion_ -> extents.y2 = 0; + } + else + { + // + // FIXME: We have to update the region extents. + // + + logTest("Updater::update", "Region extents has not been updated."); + } +} + +void Updater::handleInput() +{ + logTrace("Updater::handleInput"); + + XEvent *event = new XEvent; + + if (event == NULL) + { + logError("Updater::handleInput", ESET(ENOMEM)); + + return; + } + + while (XCheckIfEvent(display_, event, anyEventPredicate, NULL)) + { + switch (event -> type) + { + /* case ClientMessage: + { + Atom wmProtocols = XInternAtom(display_, "WM_PROTOCOLS", 0); + Atom wmDeleteWindow = XInternAtom(display_, "WM_DELETE_WINDOW", 0); + + if (event -> xclient.message_type == wmProtocols && + (Atom)event -> xclient.data.l[0] == wmDeleteWindow) + { + logTest("Updater::handleInput", "Got client message of type WM_PROTOCOLS and value WM_DELETE_WINDOW," + " throwing exception UpdaterClosing."); + + delete event; + + throw UpdaterClosing(); + } + else + { + logTest("Updater::handleInput", "Unexpected client message type [%ld] format [%d] first value [%ld]", + event -> xclient.message_type, event -> xclient.format, event -> xclient.data.l[0]); + } + + break; + }*/ + case KeyPress: + case KeyRelease: + case ButtonPress: + case ButtonRelease: + case MotionNotify: + { + input_ -> pushEvent(display_, event); + + event = new XEvent; + + if (event == NULL) + { + logError("Updater::handleInput", ESET(ENOMEM)); + + return; + } + + break; + } + default: + { + logTest("Updater::handleInput", "Handling unexpected event [%d].", event -> type); + + break; + } + } + } + + delete event; +} + +void Updater::newRegion() +{ + if (updateRegion_ != NULL) + { + XDestroyRegion(updateRegion_); + } + + updateRegion_ = XCreateRegion(); + + logTest("Updater::newRegion", "updateRegion_ [%p].", updateRegion_); +} +// +// Private functions. +// diff --git a/nxcompshad/src/Updater.h b/nxcompshad/src/Updater.h new file mode 100644 index 000000000..10d75c0d6 --- /dev/null +++ b/nxcompshad/src/Updater.h @@ -0,0 +1,103 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Updater_H +#define Updater_H + +#include + +#include "Regions.h" +#include "Input.h" + +class UpdaterClosing {}; + +class Updater +{ + public: + + Updater(char *displayName, Display *display); + + ~Updater(); + + int init(int, int, char *, Input*); + + void addRegion(Region r); + + void update(); + + void handleInput(); + + XImage *getImage(); + + Region getUpdateRegion(); + + void newRegion(); + + private: + + Input *input_; + + static inline Bool anyEventPredicate(Display*, XEvent*, XPointer); + + void handleKeyboardEvent(XEvent &event); + + char *displayName_; + + char *buffer_; + + bool closeDisplay_; + + Display *display_; + + int depth_; + + int width_; + int height_; + + int bpl_; + + Window window_; + XImage *image_; + + Pixmap pixmap_; + + Region updateRegion_; + +}; + +Bool Updater::anyEventPredicate(Display*, XEvent*, XPointer) +{ + return true; +} + +inline XImage* Updater::getImage() +{ + return image_; +} +inline Region Updater::getUpdateRegion() +{ + return updateRegion_; +} +#endif /* Updater_H */ diff --git a/nxcompshad/src/Win.cpp b/nxcompshad/src/Win.cpp new file mode 100644 index 000000000..6033f2c1b --- /dev/null +++ b/nxcompshad/src/Win.cpp @@ -0,0 +1,1149 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if defined(__CYGWIN32__) || defined(WIN32) + +#include + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include "Poller.h" +#include "Logger.h" + +Poller::Poller(Input *input, Display *display, int depth) : CorePoller(input, display) +{ + logTrace("Poller::Poller"); + + screenDC_ = NULL; + screenBmp_ = NULL; + memoryDC_ = NULL; + pDIBbits_ = NULL; + DIBBuffer_ = NULL; + pKey_ = NULL; + pMouse_ = NULL; + path_ = NULL; + keymapName_ = input -> getKeymap(); + keymap_ = NULL; + toggleButtonState_ = 0; + serverModifierState_ = 0; + display_ = display; + depth_ = DefaultDepth(display_, DefaultScreen(display_)); + oldCursor_ = 0; + xCursor_ = 0; +} + +Poller::~Poller() +{ + logTrace("Poller::~Poller"); + + if (screenDC_) + { + BOOL result = ReleaseDC(NULL, screenDC_); + + logTest("Poller::~Poller", "ReleaseDC returned [%d].", result); + + screenDC_ = NULL; + } + + if (memoryDC_) + { + BOOL result = DeleteDC(memoryDC_); + + logTest("Poller::~Poller", "DeleteDC returned [%d].", result); + + memoryDC_ = NULL; + } + + if (screenBmp_) + { + BOOL result = DeleteObject(screenBmp_); + + logTest("Poller::~Poller", "DeleteObject returned [%d].", result); + + screenBmp_ = NULL; + } + + if (DIBBuffer_) + { + logDebug("Poller::~Poller", "Delete DIBBuffer_ [%p].", DIBBuffer_); + + delete [] DIBBuffer_; + } + + if (pKey_) + { + logDebug("Poller::~Poller", " pKey_[%p].", pKey_); + + delete [] pKey_; + } + + if (pMouse_) + { + logDebug("Poller::~Poller", " pMouse_[%p].", pMouse_); + + delete [] pMouse_; + } + + if (keymap_) + { + logDebug("Poller::~Poller", " keymap_[%p].", keymap_); + + delete [] keymap_; + } +} + +int Poller::init() +{ + logTrace("Poller::init"); + + int maxLengthArrayINPUT = 6; + + platformOS(); + + pKey_ = new INPUT [maxLengthArrayINPUT]; + + if (pKey_ == NULL) + { + logError("Poller::init", ESET(ENOMEM)); + + return -1; + } + + for (int i = 0; i < maxLengthArrayINPUT; i++) + { + pKey_[i].type = INPUT_KEYBOARD; + pKey_[i].ki.wVk = (WORD) 0; + pKey_[i].ki.time = (DWORD) 0; + pKey_[i].ki.dwExtraInfo = (DWORD) 0; + } + + pMouse_ = new INPUT; + + if (pMouse_ == NULL) + { + logError("Poller::init", ESET(ENOMEM)); + + return -1; + } + + pMouse_ -> type = INPUT_MOUSE; + + pMouse_ -> mi.dx = 0; + pMouse_ -> mi.dy = 0; + pMouse_ -> mi.mouseData = (DWORD) 0; + pMouse_ -> mi.time = 0; + pMouse_ -> mi.dwExtraInfo = (ULONG_PTR) NULL; + + screenDC_ = GetDC(NULL); + + if (screenDC_ == NULL) + { + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + + switch(depth_) + { + case 8: + { + depth_ = 16; + break; + } + case 16: + { + depth_ = 16; + break; + } + case 24: + { + depth_ = 32; + break; + } + default: + { + logError("Poller::init", ESET(EINVAL)); + + return -1; + } + } + + width_ = GetDeviceCaps(screenDC_, HORZRES); + height_ = GetDeviceCaps(screenDC_, VERTRES); + + bpl_ = width_ * (depth_ >> 3); + bpp_ = (depth_ >> 3); + + logTest("Poller::init", "Screen geometry is [%d, %d] depth is [%d] bpl [%d] bpp [%d].", + width_, height_, depth_, bpl_, bpp_); + + logTest("Poller::init", "Got device context at [%p] screen size is (%d,%d).", + screenDC_, width_, height_); + + memoryDC_ = CreateCompatibleDC(screenDC_); + + if (memoryDC_ == NULL) + { + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + + // + // Delete the old bitmap for the memory device. + // + + HBITMAP bitmap = (HBITMAP) GetCurrentObject(memoryDC_, OBJ_BITMAP); + + if (bitmap && DeleteObject(bitmap) == 0) + { + logError("Poller::init", ESET(ENOMSG)); + } + + // + // Bitmap header describing the bitmap we want to get from GetDIBits. + // + + bmi_.bmiHeader.biSize = sizeof(BITMAPINFOHEADER); + bmi_.bmiHeader.biWidth = width_; + bmi_.bmiHeader.biHeight = -height_; + bmi_.bmiHeader.biPlanes = 1; + bmi_.bmiHeader.biBitCount = depth_; + bmi_.bmiHeader.biCompression = BI_RGB; + bmi_.bmiHeader.biSizeImage = 0; + bmi_.bmiHeader.biXPelsPerMeter = 0; + bmi_.bmiHeader.biYPelsPerMeter = 0; + bmi_.bmiHeader.biClrUsed = 0; + bmi_.bmiHeader.biClrImportant = 0; + + screenBmp_ = CreateDIBSection(memoryDC_, &bmi_, DIB_RGB_COLORS, &pDIBbits_, NULL, 0); + ReleaseDC(NULL,memoryDC_); + + if (screenBmp_ == NULL) + { + logTest ("Poller::init", "This video device is not supporting DIB section"); + + pDIBbits_ = NULL; + + screenBmp_ = CreateCompatibleBitmap(screenDC_, width_, height_); + + if (screenBmp_ == NULL) + { + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + + if (SelectObject(memoryDC_, screenBmp_) == NULL) + { + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + } + else + { + logTest ("Poller::init", "Enabled the DIB section"); + + if (SelectObject(memoryDC_, screenBmp_) == NULL) + { + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + } + + // + // Check if the screen device raster capabilities + // support the bitmap transfer. + // + + if ((GetDeviceCaps(screenDC_, RASTERCAPS) & RC_BITBLT) == 0) + { + logTest("Poller::init", "This video device is not supporting the bitmap transfer."); + + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + + // + // Check if the memory device raster capabilities + // support the GetDIBits and SetDIBits functions. + // + + if ((GetDeviceCaps(memoryDC_, RASTERCAPS) & RC_DI_BITMAP) == 0) + { + logTest("Poller::init", "This memory device is not supporting the GetDIBits and SetDIBits " + "function."); + + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + + if (GetDeviceCaps(screenDC_, PLANES) != 1) + { + logTest("Poller::init", "This video device has more than 1 color plane."); + + logError("Poller::init", ESET(ENOMSG)); + + return -1; + } + + return CorePoller::init(); +} + +// +// FIXME: Remove me. +// + +void ErrorExit(LPTSTR lpszFunction) +{ + LPVOID lpMsgBuf; + DWORD dw = GetLastError(); + + FormatMessage( + FORMAT_MESSAGE_ALLOCATE_BUFFER | + FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + dw, + MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), + (LPTSTR) &lpMsgBuf, + 0, NULL ); + + logTest(lpszFunction, " Failed with error [%ld]: %s", dw, (char*)lpMsgBuf); + + LocalFree(lpMsgBuf); + ExitProcess(dw); +} + +// +// FIXME: End. +// + +char *Poller::getRect(XRectangle r) +{ + logTrace("Poller::getRect"); + + logDebug("Poller::getRect", "Going to retrive rectangle [%d, %d, %d, %d].", + r.x, r.y, r.width, r.height); + + // + // The CAPTUREBLT operation could be a very + // cpu-consuming task. We should make some + // test to see how much it is expensive. + // Anyway we get tooltip windows and any + // other special effect not included with + // only the SRCCOPY operation. + // + + if (BitBlt(memoryDC_, r.x, r.y, r.width, r.height, + screenDC_, r.x, r.y, SRCCOPY | CAPTUREBLT) == 0) + { + logError("Poller::getRect", ESET(ENOMSG)); + + logTest("Poller::getRect", "Failed to perform a bit-block transfer."); + logTest("Poller::getRect", "bit-block error=%lu", GetLastError()); + + return NULL; + } + + // bmi_.bmiHeader.biWidth = r.width; + // bmi_.bmiHeader.biHeight = -r.height; + + if (pDIBbits_ == NULL) + { + static long nPixel = 0; + + if (nPixel < r.width * r.height) + { + + if (DIBBuffer_) + { + delete [] DIBBuffer_; + } + + nPixel = r.width * r.height; + + DIBBuffer_ = new char [nPixel * bpp_]; + + if (DIBBuffer_ == NULL) + { + logError("Poller::getRect", ESET(ENOMEM)); + + nPixel = 0; + + return NULL; + } + } + + if (GetDIBits(memoryDC_, screenBmp_, height_ - r.height - r.y, r.height, + DIBBuffer_, &bmi_, DIB_RGB_COLORS) == 0) + { + logError("Poller::getRect", ESET(ENOMSG)); + + logTest("Poller::getRect", "Failed to retrieve the screen bitmap."); + + return NULL; + } + + return DIBBuffer_; + } + else + { + return (char *) pDIBbits_ + r.y * bpl_ + r.x * bpp_; + } +} + +void Poller::handleKeyboardEvent(Display *display, XEvent *event) +{ + KeySym keysym; + char *keyname = new char [31]; + keyTranslation tr = {0, 0}; + unsigned char scancode = 0; + int lengthArrayINPUT = 0; + + if (XLookupString((XKeyEvent *) event, keyname, 30, &keysym, NULL) > 0) + { + logTest("Poller::handleKeyboardEvent", "keyname %s, keysym [%x]", keyname, (unsigned int)keysym); + } + + if (specialKeys(keysym, event -> xkey.state, event -> type) == 1) + { + delete[] keyname; + return; + } + + tr = xkeymapTranslateKey(keysym, event -> xkey.keycode, event -> xkey.state); + scancode = tr.scancode; + + logTest("Poller::handleKeyboardEvent", "keyname [%s] scancode [0x%x], keycode[0x%x], keysym [%x]", keyname, + tr.scancode, event ->xkey.keycode, (unsigned int)keysym); + + if (scancode == 0) + { + delete[] keyname; + return; + } + + if (event -> type == KeyPress) + { + int test1 = MapVirtualKey(scancode, MAPVK_VSC_TO_VK_EX); + int test2 = MapVirtualKey(0x24, MAPVK_VSC_TO_VK_EX); + + if (test1 == test2) + { + simulateCtrlAltDel(); + } + + if (isModifier(scancode) == 0) + { + savedServerModifierState_ = serverModifierState_; + } + + ensureServerModifiers(tr, &lengthArrayINPUT); + if (sendInput(scancode, 1, &lengthArrayINPUT) == 0) + { + logTest("Poller::handleKeyboardEvent", "lengthArrayINPUT [%d].", lengthArrayINPUT); + } + restoreServerModifiers(scancode); + } + else if (event -> type == KeyRelease) + { + if (sendInput(scancode, 0, &lengthArrayINPUT) == 0) + { + logTest("Poller::handleKeyboardEvent", "lengthArrayINPUT [%d].", lengthArrayINPUT); + } + } + + updateModifierState(scancode, (event -> type == KeyPress)); + + delete[] keyname; +} + +void Poller::handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) +{ +/* +FIXME +*/ +} + +void Poller::handleMouseEvent(Display *display, XEvent *event) +{ + DWORD flg = 0; + DWORD whl = 0; + + if (event -> type == ButtonPress) + { + logTest("Poller::handleMouseEvent", "ButtonPress.\n"); + switch (event -> xbutton.button) + { + case Button1: + { + flg = MOUSEEVENTF_LEFTDOWN; + break; + } + case Button2: + { + flg = MOUSEEVENTF_MIDDLEDOWN; + break; + } + case Button3: + { + flg = MOUSEEVENTF_RIGHTDOWN; + break; + } + case Button4: + { + flg = MOUSEEVENTF_WHEEL; + whl = WHEEL_DELTA; + pMouse_ -> mi.mouseData = whl; + break; + } + case Button5: + { + flg = MOUSEEVENTF_WHEEL; + whl = (DWORD) (-WHEEL_DELTA); + pMouse_ -> mi.mouseData = whl; + break; + } + } + } + else if (event -> type == ButtonRelease) + { + switch (event -> xbutton.button) + { + case Button1: + { + flg = MOUSEEVENTF_LEFTUP; + break; + } + case Button2: + { + flg = MOUSEEVENTF_MIDDLEUP; + break; + } + case Button3: + { + flg = MOUSEEVENTF_RIGHTUP; + break; + } + case Button4: + { + flg = MOUSEEVENTF_WHEEL; + whl = 0; + pMouse_ -> mi.mouseData = whl; + break; + } + case Button5: + { + flg = MOUSEEVENTF_WHEEL; + whl = 0; + pMouse_ -> mi.mouseData = whl; + break; + } + } + } + else if (event -> type == MotionNotify) + { + logTest("Poller::handleMouseEvent", "SetCursor - MotionNotify"); + + SetCursorPos(event -> xmotion.x, event -> xmotion.y); + } + + if (flg > 0) + { + // logTest("Poller::handleMouseEvent", "SetCursor - flg > 0"); + // + // FIXME: move the cursor to the pace the event occurred + // + + SetCursorPos(event -> xbutton.x, event -> xbutton.y); + + // + // FIXME: Remove me: send the click/release event + // mouse_event(flg, 0, 0, whl, (ULONG_PTR)NULL); + // + + pMouse_ -> mi.dwFlags = flg; + + if (SendInput(1, pMouse_, sizeof(INPUT)) == 0) + { + logTest("Poller::handleMouseEvent", "Failed SendInput"); + } + } +} + +int Poller::updateCursor(Window wnd, Visual* vis) +{ + BYTE *mBits, *andBits, *xorBits; + + logTrace("Poller::Cursor"); + + // + // Retrieve mouse cursor handle. + // + + CURSORINFO cursorInfo; + cursorInfo.cbSize = sizeof(CURSORINFO); + + if (GetCursorInfo(&cursorInfo) == 0) + { + logTest("Poller::Cursor", "GetCursorInfo() failed [%u].\n", (unsigned int)GetLastError()); + LocalFree(&cursorInfo); + return -1; + } + + HCURSOR hCursor = cursorInfo.hCursor; + + if (hCursor == 0) + { + logTest("Poller::Cursor","Cursor Handle is NULL. Error[%u].\n", (unsigned int)GetLastError()); + return 1; + } + + if (hCursor == oldCursor_) + { + LocalFree(&cursorInfo); + return 1; + } + else + { + oldCursor_ = hCursor; + } + + // + // Get cursor info. + // + + // logTest("Poller::Cursor","hCursor [%xH] GetCursor [%xH].\n", hCursor, GetCursor()); + + ICONINFO iconInfo; + if (GetIconInfo(hCursor, &iconInfo) == 0) + { + logTest("Poller::Cursor","GetIconInfo() failed. Error[%d].", (unsigned int)GetLastError()); + LocalFree(&iconInfo); + // return -1; + } + + BOOL isColorCursor = FALSE; + if (iconInfo.hbmColor != NULL) + { + isColorCursor = TRUE; + } + + if (iconInfo.hbmMask == NULL) + { + logTest("Poller::Cursor","Cursor bitmap handle is NULL.\n"); + return -1; + } + + // + // Check bitmap info for the cursor + // + + BITMAP bmMask; + if (!GetObject(iconInfo.hbmMask, sizeof(BITMAP), (LPVOID)&bmMask)) + { + logTest("Poller::Cursor","GetObject() for bitmap failed.\n"); + DeleteObject(iconInfo.hbmMask); + LocalFree(&bmMask); + return -1; + } + + if (bmMask.bmPlanes != 1 || bmMask.bmBitsPixel != 1) + { + logTest("Poller::Cursor","Incorrect data in cursor bitmap.\n"); + LocalFree(&bmMask); + DeleteObject(iconInfo.hbmMask); + return -1; + } + + // Get monochrome bitmap data for cursor + // NOTE: they say we should use GetDIBits() instead of GetBitmapBits(). + mBits = new BYTE[bmMask.bmWidthBytes * bmMask.bmHeight]; + + if (mBits == NULL)//Data bitmap + { + DeleteObject(iconInfo.hbmMask); + DestroyCursor(cursorInfo.hCursor); + LocalFree(&iconInfo); + LocalFree(&bmMask); + delete[] mBits; + return -1; + } + + BOOL success = GetBitmapBits(iconInfo.hbmMask, bmMask.bmWidthBytes * bmMask.bmHeight, mBits); + + if (!success) + { + logTest("Poller::Cursor","GetBitmapBits() failed.\n"); + delete[] mBits; + return -1; + } + + andBits = mBits; + + long width = bmMask.bmWidth; + long height = (isColorCursor) ? bmMask.bmHeight : bmMask.bmHeight/2; + + // + // The bitmask is formatted so that the upper half is + // the icon AND bitmask and the lower half is the icon XOR bitmask. + // + + if (!isColorCursor) + { + xorBits = andBits + bmMask.bmWidthBytes * height; + +/* logTest("Poller::Cursor","no color widthB[%ld] width[%ld] height[%ld] totByte[%ld] mbits[%ld].\n", + bmMask.bmWidthBytes,width,height,success,bmMask.bmHeight * bmMask.bmWidthBytes);*/ + + if (xCursor_ > 0) + { + XFreeCursor(display_, xCursor_); + } + + xCursor_ = createCursor(wnd, vis, (unsigned int)iconInfo.xHotspot, (unsigned int)iconInfo.yHotspot, + width, height, (unsigned char *)xorBits, (unsigned char *)andBits); + + XDefineCursor(display_, wnd, xCursor_); + } + + delete []mBits; + DeleteObject(iconInfo.hbmMask); + LocalFree(&bmMask); + DestroyCursor(cursorInfo.hCursor); + LocalFree(&iconInfo); + + return success; +} + +unsigned char Poller::specialKeys(unsigned int keysym, unsigned int state, int pressed) +{ + return 0; +} + +void Poller::ensureServerModifiers(keyTranslation tr, int *lengthArrayINPUT) +{ + return; +} + +void Poller::restoreServerModifiers(UINT scancode) +{ + keyTranslation dummy; + int lengthArrayINPUT = 0; + + if (isModifier(scancode) == 1) + { + return; + } + + dummy.scancode = 0; + dummy.modifiers = savedServerModifierState_; + ensureServerModifiers(dummy, &lengthArrayINPUT); + if (sendInput(0, 0, &lengthArrayINPUT) == 0) + { + logTest("Poller::restoreServerModifiers", "lengthArrayINPUT [%d]", lengthArrayINPUT); + } +} + +int Poller::updateShadowFrameBuffer(void) +{ + return 1; +} + +void Poller::addToKeymap(char *keyname, unsigned char scancode, unsigned short modifiers, char *mapname) +{ + return; +} + +FILE *Poller::xkeymapOpen(char *filename) +{ + return NULL; +} + +int Poller::xkeymapRead(char *mapname) +{ + return 1; +} + +void Poller::xkeymapInit(char *keyMapName) +{ + return; +} + +keyTranslation Poller::xkeymapTranslateKey(unsigned int keysym, unsigned int keycode, + unsigned int state) +{ + keyTranslation tr = { 0, 0 }; + + return tr; +} + +unsigned char Poller::getKeyState(unsigned int state, unsigned int keysym) +{ + return 0; +} + +char *Poller::getKsname(unsigned int keysym) +{ + char *ksname = NULL; + + return ksname; +} + +// +// Routine used to fool Winlogon into thinking CtrlAltDel was pressed +// +char Poller::simulateCtrlAltDel(void) +{ + HDESK oldDesktop = GetThreadDesktop(GetCurrentThreadId()); + + // + // Switch into the Winlogon desktop. + // + if (selectDesktopByName("Winlogon") == 0) + { + logTest("SimulateCtrlAltDelThreadFn","Failed to select logon desktop."); + return 0; + } + + logTest("SimulateCtrlAltDelThreadFn","Generating ctrl-alt-del."); + + // + // Winlogon uses hotkeys to trap Ctrl-Alt-Del. + // + PostMessage(HWND_BROADCAST, WM_HOTKEY, 0, MAKELONG(MOD_ALT | MOD_CONTROL, VK_DELETE)); + + // + // Switch back to our original desktop. + // + if (oldDesktop != NULL) + { + selectDesktop(oldDesktop); + } + + return 1; +} + +// Switches the current thread into a different desktop by desktop handle +// This call takes care of all the evil memory management involved +char Poller::selectDesktop(HDESK newDesktop) +{ + // + // Only on NT. + // + if (isWinNT()) + { + HDESK oldDesktop = GetThreadDesktop(GetCurrentThreadId()); + + DWORD dummy; + char newName[256]; + + if (GetUserObjectInformation(newDesktop, UOI_NAME, &newName, 256, &dummy) == 0) + { + logDebug("Poller::selectDesktop","GetUserObjectInformation() failed. Error[%lu].", GetLastError()); + return 0; + } + + logTest("Poller::selectDesktop","New Desktop to [%s] (%x) from (%x).", + newName, (unsigned int)newDesktop, (unsigned int)oldDesktop); + + // + // Switch the desktop. + // + if(SetThreadDesktop(newDesktop) == 0) + { + logDebug("Poller::SelectDesktop","Unable to SetThreadDesktop(), Error=%lu.", GetLastError()); + return 0; + } + + // + // Switched successfully - destroy the old desktop. + // + if (CloseDesktop(oldDesktop) == 0) + { + logDebug("Poller::selectHdesk","Failed to close old desktop (%x), Error=%lu.", + (unsigned int)oldDesktop, GetLastError()); + return 0; + } + } + + return 1; +} + +// +// Switches the current thread into a different desktop, by name +// Calling with a valid desktop name will place the thread in that desktop. +// Calling with a NULL name will place the thread in the current input desktop. +// + +char Poller::selectDesktopByName(char *name) +{ + // + // Only on NT. + // + if (isWinNT()) + { + HDESK desktop; + + if (name != NULL) + { + // + // Attempt to open the named desktop. + // + desktop = OpenDesktop(name, 0, FALSE, + DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | + DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | + DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | + DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); + } + else + { + // + // Open the input desktop. + // + desktop = OpenInputDesktop(0, FALSE, + DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | + DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | + DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | + DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); + } + + if (desktop == NULL) + { + logDebug("Poller::selectDesktopByName","Unable to open desktop, Error=%lu.", GetLastError()); + return 0; + } + + // + // Switch to the new desktop + // + if (selectDesktop(desktop) == 0) + { + // + // Failed to enter the new desktop, so free it! + // + logDebug("Poller::selectDesktopByName","Failed to select desktop."); + + if (CloseDesktop(desktop) == 0) + { + logDebug("Poller::selectDesktopByName","Failed to close desktop, Error=%lu.", GetLastError()); + return 0; + } + } + + return 1; + } + + return (name == NULL); +} + +void Poller::platformOS() +{ + OSVERSIONINFO osversioninfo; + osversioninfo.dwOSVersionInfoSize = sizeof(osversioninfo); + + // + // Get the current OS version. + // + if (GetVersionEx(&osversioninfo) == 0) + { + platformID_ = 0; + } + platformID_ = osversioninfo.dwPlatformId; + +// +// versionMajor = osversioninfo.dwMajorVersion; +// versionMinor = osversioninfo.dwMinorVersion; +// +} + +char Poller::checkDesktop() +{ + // + // Only on NT. + // + if (isWinNT()) + { + // + // Get the input and thread desktops. + // + HDESK desktop = GetThreadDesktop(GetCurrentThreadId()); + HDESK inputDesktop = OpenInputDesktop(0, FALSE, + DESKTOP_CREATEMENU | DESKTOP_CREATEWINDOW | + DESKTOP_ENUMERATE | DESKTOP_HOOKCONTROL | + DESKTOP_WRITEOBJECTS | DESKTOP_READOBJECTS | + DESKTOP_SWITCHDESKTOP | GENERIC_WRITE); + + if (inputDesktop == NULL) + { + return 0; + } + + DWORD dummy; + char desktopName[256]; + char inputName[256]; + + if (GetUserObjectInformation(desktop, UOI_NAME, &desktopName, 256, &dummy) == 0) + { + if (CloseDesktop(inputDesktop) == 0) + { + logDebug("Poller::checkDesktop", "Failed to close desktop, Error[%d].", (unsigned int)GetLastError()); + return 0; + } + } + + if (GetUserObjectInformation(inputDesktop, UOI_NAME, &inputName, 256, &dummy) == 0) + { + if (CloseDesktop(inputDesktop) == 0) + { + logDebug("Poller::checkDesktop", "Failed to close input desktop, Error[%d].", (unsigned int)GetLastError()); + return 0; + } + } + + if (strcmp(desktopName, inputName) != 0) + { + // + // Switch to new desktop. + // + selectDesktop(inputDesktop); + } + + if (CloseDesktop(desktop) == 0) + { + logDebug("Poller::checkDesktop", "Failed to close input desktop, Error[%d].", (unsigned int)GetLastError()); + return 0; + } + + if (CloseDesktop(inputDesktop) == 0) + { + logDebug("Poller::checkDesktop", "Failed to close input desktop, Error[%d].", (unsigned int)GetLastError()); + return 0; + } + } + + return 1; +} + +unsigned char Poller::isModifier(UINT scancode) +{ + return 0; +} + +void Poller::updateModifierState(UINT scancode, unsigned char pressed) +{ + return; +} + +Cursor Poller::createCursor(Window wnd, Visual *vis,unsigned int x, unsigned int y, + int width, int height, unsigned char *xormask, unsigned char *andmask) +{ + Pixmap maskglyph, cursorglyph; + XColor bg, fg; + Cursor xcursor; + unsigned char *cursor; + unsigned char *mask, *pmask, *pcursor, tmp; + int scanline, offset; + + scanline = (width + 7) / 8; + offset = scanline * height; + + pmask = andmask; + pcursor = xormask; + for (int i = 0; i < offset; i++) + { + // + // The pixel is black if both the bit of andmask and xormask is one. + // + + tmp = *pcursor & *pmask; + *pcursor ^= tmp; + *pmask ^= tmp; + + *pmask = ~(*pmask); + + pmask++; + pcursor++; + } + + cursor = new unsigned char[offset]; + memcpy(cursor, xormask, offset); + + mask = new unsigned char[offset]; + memcpy(mask, andmask, offset); + + fg.red = fg.blue = fg.green = 0xffff; + bg.red = bg.blue = bg.green = 0x0000; + fg.flags = bg.flags = DoRed | DoBlue | DoGreen; + + cursorglyph = createGlyph(wnd, vis, width, height, cursor); + maskglyph = createGlyph(wnd, vis, width, height, mask); + + xcursor = XCreatePixmapCursor(display_, cursorglyph, maskglyph, &fg, &bg, x, y); + + XFreePixmap(display_, maskglyph); + XFreePixmap(display_, cursorglyph); + delete[]mask; + delete[]cursor; + + return xcursor; +} + +Pixmap Poller::createGlyph(Window wnd, Visual *visual, int width, int height, unsigned char *data) +{ + XImage *image; + Pixmap bitmap; + int scanline; + GC glyphGC; + + scanline = (width + 7) / 8; + + bitmap = XCreatePixmap(display_, wnd, width, height, 1); + glyphGC = XCreateGC(display_, bitmap, 0, NULL); + + image = XCreateImage(display_, visual, 1, ZPixmap, 0, (char *)data, width, height, 8, scanline); + image->byte_order = 1; // MSBFirst -- LSBFirst = 0 + image->bitmap_bit_order = 1; + XInitImage(image); + +/* logTest("Poller::createGlyph","XPutImage on pixmap %d,%d,%d,%d.\n", + 0, 0, width, height);*/ + XPutImage(display_, bitmap, glyphGC, image, 0, 0, 0, 0, width, height); + XFree(image); + + return bitmap; +} +#endif /* defined(__CYGWIN32__) || defined(WIN32) */ diff --git a/nxcompshad/src/Win.h b/nxcompshad/src/Win.h new file mode 100644 index 000000000..615f9a5f5 --- /dev/null +++ b/nxcompshad/src/Win.h @@ -0,0 +1,232 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef __CYGWIN32__ + +#ifndef Win32Poller_H +#define Win32Poller_H + +//#include + +#include +#include +#include +#include + +#define CAPTUREBLT 0x40000000 + +#define KEYEVENTF_SCANCODE 0x00000008 +#define MAPVK_VSC_TO_VK_EX 3 +// +// The CAPTUREBLT is a raster operation used +// in bit blit transfer. +// +// Using this operation includes any windows +// that are layered on top of your window in +// the resulting image. By default, the image +// only contains your window. +// + +#include "Core.h" + +typedef struct _keyTranslation +{ + unsigned char scancode; + unsigned short modifiers; + +}keyTranslation; + +class Poller : public CorePoller +{ + public: + + Display *display_; + keyTranslation *keymap_; + unsigned char keymapLoaded_; + int minKeycode_; + + Poller(Input *, Display *display, int = 16); + + ~Poller(); + + int init(); + + int updateCursor(Window, Visual*); + + private: + + + int Poller::updateShadowFrameBuffer(void); + void handleKeyboardEvent(Display *, XEvent *); + void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress); + void addToKeymap(char *keyname, unsigned char scancode, unsigned short modifiers, char *mapname); + int xkeymapRead(char *mapname); + FILE *xkeymapOpen(char *filename); + void xkeymapInit(char *keyMapName); + keyTranslation xkeymapTranslateKey(unsigned int keysym, unsigned int keycode, unsigned int state); + unsigned char getKeyState(unsigned int state, unsigned int keysym); + char *getKsname(unsigned int keysym); + unsigned char specialKeys(unsigned int keysym, unsigned int state, int pressed); + + unsigned char toggleSwitch(unsigned char ToggleStateClient, unsigned char ToggleStateServer, UINT scancode, + int *lengthArrayINPUT); + + void updateModifierState(UINT, unsigned char); + + unsigned char toggleServerState(UINT scancode); + unsigned char keyState(UINT scancode, UINT mapType); + unsigned char keyStateAsync(UINT scancode); + + void handleMouseEvent(Display *, XEvent *); + + Cursor createCursor(Window wnd, Visual *vis, unsigned int x, unsigned int y, int width, + int height, unsigned char *xormask, unsigned char *andmask); + + Pixmap createGlyph(Window wnd, Visual *visual, int width, int height, unsigned char *data); + + char isWinNT(); + char selectDesktop(HDESK new_desktop); + char selectDesktopByName(char *name); + void platformOS(); + char simulateCtrlAltDel(void); + DWORD platformID_; + + INPUT *pKey_, *pMouse_; + + char *keymapName_; + char *path_; + + unsigned char toggleButtonState_; + unsigned short serverModifierState_; + unsigned short savedServerModifierState_; + + void ensureServerModifiers(keyTranslation tr, int *lenghtArrayINPUT); + void restoreServerModifiers(UINT scancode); + unsigned char isModifier(UINT scancode); + + char sendInput(unsigned char scancode, unsigned char pressed, int *lengthArrayINPUT); + + char *getRect(XRectangle); + char checkDesktop(); + + char *DIBBuffer_; + + HCURSOR oldCursor_; + + VOID *pDIBbits_; + HDC screenDC_; + HDC memoryDC_; + BITMAPINFO bmi_; + HBITMAP screenBmp_; + + Cursor xCursor_; + +}; + +#undef TEST + +inline unsigned char Poller::toggleSwitch(unsigned char ToggleStateClient, unsigned char ToggleStateServer, + UINT scancode, int *lengthArrayINPUT) +{ + return 1; +} + +inline unsigned char Poller::toggleServerState(UINT scancode) +{ + return (GetKeyState(MapVirtualKeyEx(scancode, 3, GetKeyboardLayout((DWORD)NULL))) & 0x1); +} + +inline unsigned char Poller::keyStateAsync(UINT vKeycode) +{ + return GetAsyncKeyState(vKeycode); +} + +inline unsigned char Poller::keyState(UINT code, UINT mapType) +{ + if (mapType == 0) + { + // + // Virtual Keycode + // + return ((GetKeyState(code) & 0x80) == 0x80); + } + else + { + // + // scancode + // + return ((GetKeyState(MapVirtualKeyEx(code, 3, GetKeyboardLayout((DWORD)NULL))) & 0x80) == 0x80); + } +} + +inline char Poller::isWinNT() +{ + return (platformID_ == VER_PLATFORM_WIN32_NT); +} + +inline char Poller::sendInput(unsigned char scancode, unsigned char pressed, int *lengthArrayINPUT) +{ + DWORD keyEvent = 0; + DWORD extended = 0; + + if (scancode > 0) + { + if (pressed == 0) + { + keyEvent = KEYEVENTF_KEYUP; + } + + if (scancode & 0x80) + { + scancode &= ~0x80; + extended = KEYEVENTF_EXTENDEDKEY; + } + + pKey_[*lengthArrayINPUT].ki.wScan = (WORD) scancode; + pKey_[*lengthArrayINPUT].ki.dwFlags = (DWORD) (keyEvent | KEYEVENTF_SCANCODE | extended); + (*lengthArrayINPUT)++; + } + + + if (*lengthArrayINPUT > 0) { + // FIXME: Remove me. + logTest("Poller::sendInput", "length Input [%d] event: %s", *lengthArrayINPUT, + pressed == 1 ? "KeyPress": "KeyRelease"); + + if (SendInput(*lengthArrayINPUT, pKey_, sizeof(INPUT)) == 0) + { + logTest("Poller::sendInput", "Failed SendInput, event: %s", pressed == 1 ? "KeyPress": "KeyRelease"); + *lengthArrayINPUT = 0; + return 0; + } + + *lengthArrayINPUT = 0; + } + + return 1; +} +#endif /* Win32Poller_H */ + +#endif /* __CYGWIN32__ */ diff --git a/nxcompshad/src/X11.cpp b/nxcompshad/src/X11.cpp new file mode 100644 index 000000000..3643df731 --- /dev/null +++ b/nxcompshad/src/X11.cpp @@ -0,0 +1,1598 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#if !defined(__CYGWIN32__) && !defined(WIN32) + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include +#include +#include +#include "X11/include/XTest_nxcompshad.h" +#include +#include +#include + +#include "Poller.h" +#include "Logger.h" +#include "Shadow.h" + +#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) + +#undef TRANSLATE_KEYCODES +#define TRANSLATE_ALWAYS + +typedef struct { + KeySym *map; + KeyCode minKeyCode, + maxKeyCode; + int mapWidth; +} KeySymsRec, *KeySymsPtr; + +extern KeySymsPtr NXShadowKeymap; + +typedef struct _KeyPressed +{ + KeyCode keyRcvd; + KeyCode keySent; + struct _KeyPressed *next; +} KeyPressedRec; + +static KeyPressedRec *shadowKeyPressedPtr = NULL; + +static KeySym *shadowKeysyms = NULL; +static KeySym *masterKeysyms = NULL; + +static KeySym *shadowKeymap = NULL; + +static int shadowMinKey, shadowMaxKey, shadowMapWidth; +static int masterMinKey, masterMaxKey, masterMapWidth; + +static int leftShiftOn = 0; +static int rightShiftOn = 0; +static int modeSwitchOn = 0; +static int level3ShiftOn = 0; +static int altROn = 0; + +static int sentFakeLShiftPress = 0; +static int sentFakeLShiftRelease = 0; +static int sentFakeRShiftRelease = 0; +static int sentFakeModeSwitchPress = 0; +static int sentFakeModeSwitchRelease = 0; +static int sentFakeLevel3ShiftPress = 0; +static int sentFakeLevel3ShiftRelease = 0; +static int sentFakeAltRRelease = 0; + +static int shmInitTrap = 0; + +Poller::Poller(Input *input, Display *display, int depth) : CorePoller(input, display) +{ + logTrace("Poller::Poller"); + + display_ = NULL; + shadowDisplayName_ = input -> getShadowDisplayName(); + + tmpBuffer_ = NULL; + + xtestExtension_ = -1; + shmExtension_ = -1; + randrExtension_ = -1; + damageExtension_ = -1; + + shadowDisplayUid_ = -1; + + image_ = NULL; + + shminfo_ = NULL; +} + +Poller::~Poller() +{ + logTrace("Poller::~Poller"); + + if (shmExtension_ == 1) + { + XShmDetach(display_, shminfo_); + XDestroyImage(image_); + shmdt(shminfo_ -> shmaddr); + shmctl(shminfo_ -> shmid, IPC_RMID, 0); + } + + if (shminfo_ != NULL) + { + delete shminfo_; + + shminfo_ = NULL; + } + + if (display_ != NULL) + { + XCloseDisplay(display_); + } + + if (tmpBuffer_ != NULL && shmExtension_ != -1 && damageExtension_ == 1) + { + XFree(tmpBuffer_); + + tmpBuffer_ = NULL; + } +} + +int Poller::init() +{ + logTrace("Poller::init"); + + if (display_ == NULL) + { + display_ = XOpenDisplay(shadowDisplayName_); + + setShadowDisplay(display_); + } + + logTest("Poller::init:" ,"Shadow display [%p] name [%s].", (Display *) display_, shadowDisplayName_); + + if (display_ == NULL) + { + logTest("Poller::init", "Failed to connect to display [%s].", shadowDisplayName_ ? shadowDisplayName_ : ""); + + return -1; + } + + setRootSize(); + + logTest("Poller::init", "Screen geometry is [%d, %d] depth is [%d] bpl [%d] bpp [%d].", + width_, height_, depth_, bpl_, bpp_); + + xtestInit(); + + shmInit(); + + randrInit(); + + damageInit(); + + return CorePoller::init(); +} + +int Poller::updateShadowFrameBuffer(void) +{ + if (shmExtension_ == 1) + { + if (XShmGetImage(display_, DefaultRootWindow(display_), image_, 0, 0, AllPlanes) == 0) + { + logDebug("Poller::updateShadowFrameBuffer", "XShmGetImage failed!"); + + return -1; + } + } + else + { + image_ = XGetImage(display_, DefaultRootWindow(display_), 0, 0, width_, + height_, AllPlanes, ZPixmap); + + if (image_ == NULL) + { + logDebug("Poller::updateShadowFrameBuffer", "XGetImage failed!"); + + return -1; + } + } + + return 1; +} + +char *Poller::getRect(XRectangle r) +{ + logTrace("Poller::getRect"); + + logDebug("Poller::getRect", "Going to retrive rectangle [%d, %d, %d, %d].", + r.x, r.y, r.width, r.height); + + if (shmExtension_ == 1) + { + if (damageExtension_ == 1) + { + image_ -> width = r.width; + image_ -> height = r.height; + + image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); + + if (XShmGetImage(display_, DefaultRootWindow(display_), image_, r.x, r.y, AllPlanes) == 0) + { + logDebug("Poller::getRect", "XShmGetImage failed!"); + + return NULL; + } + + tmpBuffer_ = image_ -> data; + } + else + { + image_ -> width = r.width; + image_ -> height = r.height; + + image_ -> bytes_per_line = ROUNDUP((image_ -> bits_per_pixel * image_ -> width), image_ -> bitmap_pad); + + if (XShmGetImage(display_, DefaultRootWindow(display_), image_, r.x, r.y, AllPlanes) == 0) + { + logDebug("Poller::getRect", "XShmGetImage failed!"); + } + + tmpBuffer_ = image_ -> data; + } + } + else + { + if (tmpBuffer_) + { + XFree(tmpBuffer_); + tmpBuffer_ = NULL; + } + + image_ = XGetImage(display_, DefaultRootWindow(display_), r.x, r.y, r.width, r.height, AllPlanes, ZPixmap); + + if (image_ == NULL) + { + logError("Poller::getRect", ESET(ENOMSG)); + + return NULL; + } + + tmpBuffer_ = image_ -> data; + + if (image_ -> obdata) + { + XFree(image_ -> obdata); + } + + XFree(image_); + + image_ = NULL; + } + + return tmpBuffer_; +} + +void Poller::shmInit(void) +{ + int major, minor; + int pixmaps; + + logTest("Poller::shmInit", "Added shmExtension_ [%d].", shmExtension_); + + if (shmExtension_ >= 0) + { + logDebug("Poller::shmInit", "Called with shared memory already initialized."); + + if (shmInitTrap == 0) + { + return; + } + } + + if (shmExtension_ < 0 && NXShadowOptions.optionShmExtension == 0) + { + shmExtension_ = 0; + + logUser("Poller::shmInit: Disabling use of MIT-SHM extension.\n"); + + return; + } + + if (XShmQueryVersion(display_, &major, &minor, &pixmaps) == 0) + { + logDebug("Poller::shmInit", "MIT_SHM: Shared memory extension not available."); + + shmExtension_ = 0; + } + else + { + logDebug("Poller::shmInit", "MIT_SHM: Shared memory extension available."); + + if (shminfo_ != NULL) + { + destroyShmImage(); + } + + shminfo_ = (XShmSegmentInfo* ) new XShmSegmentInfo; + + if (shminfo_ == NULL) + { + logError("Poller::shmInit", ESET(ENOMEM)); + + shmExtension_ = 0; + + return; + } + + image_ = (XImage *)XShmCreateImage(display_, display_ -> screens[0].root_visual, depth_, ZPixmap, + NULL, shminfo_, width_, height_); + + if (image_ == NULL) + { + logError("Poller::shmInit", ESET(ENOMSG)); + + shmExtension_ = 0; + + return; + } + + shadowDisplayUid_ = NXShadowOptions.optionShadowDisplayUid; + + logDebug("Poller::shmInit", "Master X server uid [%d].", NXShadowOptions.optionShadowDisplayUid); + + shminfo_ -> shmid = shmget(IPC_PRIVATE, image_ -> bytes_per_line * image_ -> height, IPC_CREAT | 0666); + + if (shminfo_ -> shmid < 0) + { + logDebug("Poller::shmInit", "kernel id error."); + + shmExtension_ = 0; + + return; + } + + logDebug("Poller::shmInit", "Created shm segment with shmid [%d].", shminfo_ -> shmid); + + shminfo_ -> shmaddr = (char *)shmat(shminfo_ -> shmid, 0, 0); + + if (shminfo_ -> shmaddr < 0) + { + logWarning("Poller::shmInit", "Couldn't attach to shm segment."); + } + + logDebug("Poller::shmInit", "shminfo_ -> shmaddr [%p].", shminfo_ -> shmaddr); + + image_ -> data = shminfo_ -> shmaddr; + + shminfo_ -> readOnly = 0; + + if (XShmAttach(display_, shminfo_) == 0) + { + logDebug("Poller::shmInit", "XShmAttach failed."); + + shmExtension_ = 0; + + return; + } + + // + // Mark the shm segment to be destroyed after + // the last process detach. Let the X server + // complete the X_ShmAttach request, before. + // + + XSync(display_, 0); + + struct shmid_ds ds; + + shmctl(shminfo_ -> shmid, IPC_STAT, &ds); + + if (shadowDisplayUid_ != -1) + { + ds.shm_perm.uid = (ushort) shadowDisplayUid_; + } + else + { + logWarning("Poller::shmInit", "Couldn't set uid for shm segment."); + } + + ds.shm_perm.mode = 0600; + + shmctl(shminfo_ -> shmid, IPC_SET, &ds); + + shmctl(shminfo_ -> shmid, IPC_STAT, &ds); + + shmctl(shminfo_ -> shmid, IPC_RMID, 0); + + logDebug("Poller::shmInit", "Number of attaches to shm segment [%d] are [%d].\n", + shminfo_ -> shmid, (int) ds.shm_nattch); + + if (ds.shm_nattch > 2) + { + logWarning("Poller::shmInit", "More than two attaches to the shm segment."); + + destroyShmImage(); + + shmExtension_ = 0; + + return; + } + + shmExtension_ = 1; + } +} + +void Poller::keymapShadowInit(Display *display) +{ + int i, len; + CARD32 *map; + + if (NXShadowKeymap != NULL) + { + shadowMinKey = NXShadowKeymap -> minKeyCode; + shadowMaxKey = NXShadowKeymap -> maxKeyCode; + shadowMapWidth = NXShadowKeymap -> mapWidth; + + len = (shadowMaxKey - shadowMinKey + 1) * shadowMapWidth; + + map = (CARD32 *) NXShadowKeymap -> map; + + if (shadowKeymap != NULL) + { + free(shadowKeymap); + } + + shadowKeymap = (KeySym *) malloc(len * sizeof(KeySym)); + + if (shadowKeymap != NULL) + { + for (i = 0; i < len; i++) + { + shadowKeymap[i] = map[i]; + } + + shadowKeysyms = shadowKeymap; + } + } + + if (shadowKeysyms == NULL) + { + XDisplayKeycodes(display, &shadowMinKey, &shadowMaxKey); + + shadowKeysyms = XGetKeyboardMapping(display, shadowMinKey, shadowMaxKey - shadowMinKey + 1, + &shadowMapWidth); + } + + #ifdef DEBUG + if (shadowKeysyms != NULL) + { + for (i = 0; i < (shadowMaxKey - shadowMinKey + 1) * shadowMapWidth; i++) + { + if (i % shadowMapWidth == 0) + { + logDebug("Poller::keymapShadowInit", "keycode [%d]", (int) (i / shadowMapWidth)); + } + + logDebug("\tkeysym", " [%x] [%s]", (unsigned int) shadowKeysyms[i], XKeysymToString(shadowKeysyms[i])); + } + } + #endif +} + +void Poller::keymapMasterInit() +{ + XDisplayKeycodes(display_, &masterMinKey, &masterMaxKey); + + masterKeysyms = XGetKeyboardMapping(display_, masterMinKey, masterMaxKey - masterMinKey + 1, + &masterMapWidth); + + #ifdef DEBUG + if (masterKeysyms != NULL) + { + for (int i = 0; i < (masterMaxKey - masterMinKey + 1) * masterMapWidth; i++) + { + if (i % masterMapWidth == 0) + { + logDebug("Poller::keymapMasterInit", "keycode [%d]", (int) (i / masterMapWidth)); + } + + logDebug("\tkeysym", " [%x] [%s]", (unsigned int) masterKeysyms[i], XKeysymToString(masterKeysyms[i])); + } + } + #endif +} + +KeySym Poller::keymapKeycodeToKeysym(KeyCode keycode, KeySym *keysyms, + int minKey, int mapWidth, int col) +{ + int index = ((keycode - minKey) * mapWidth) + col; + return keysyms[index]; +} + +KeyCode Poller::keymapKeysymToKeycode(KeySym keysym, KeySym *keysyms, + int minKey, int maxKey, int mapWidth, int *col) +{ + for (int i = 0; i < (maxKey - minKey + 1) * mapWidth; i++) + { + if (keysyms[i] == keysym) + { + *col = i % mapWidth; + return i / mapWidth + minKey; + } + } + return 0; +} + +KeyCode Poller::translateKeysymToKeycode(KeySym keysym, int *col) +{ + KeyCode keycode; + + keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col); + + if (keycode == 0) + { + if (((keysym >> 8) == 0) && (keysym >= XK_a) && (keysym <= XK_z)) + { + /* + * The master session has a Solaris keyboard. + */ + + keysym -= XK_a - XK_A; + + keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col); + } + else if (keysym == XK_Shift_R) + { + keysym = XK_Shift_L; + + keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col); + } + else if (keysym == XK_Shift_L) + { + keysym = XK_Shift_R; + + keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col); + } + else if (keysym == XK_ISO_Level3_Shift) + { + keysym = XK_Mode_switch; + + if ((keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col)) == 0) + { + keysym = XK_Alt_R; + + keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col); + } + } + else if (keysym == XK_Alt_R) + { + keysym = XK_ISO_Level3_Shift; + + if ((keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col)) == 0) + { + keysym = XK_Mode_switch; + + keycode = keymapKeysymToKeycode(keysym, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, col); + } + } + } + return keycode; +} + +Bool Poller::checkModifierKeys(KeySym keysym, Bool isKeyPress) +{ + switch (keysym) + { + case XK_Shift_L: + leftShiftOn = isKeyPress; + return True; + case XK_Shift_R: + rightShiftOn = isKeyPress; + return True; + case XK_Mode_switch: + modeSwitchOn = isKeyPress; + return True; + case XK_ISO_Level3_Shift: + level3ShiftOn = isKeyPress; + return True; + case XK_Alt_R: + altROn = isKeyPress; + return True; + default: + return False; + } +} + +void Poller::sendFakeModifierEvents(int pos, Bool skip) +{ + KeySym fakeKeysym; + int col; + + if ((!leftShiftOn && !rightShiftOn) && + (!modeSwitchOn && !level3ShiftOn && !altROn)) + { + if (pos == 1 || pos == 3) + { + fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + sentFakeLShiftPress = 1; + } + if (pos == 2 || pos == 3) + { + fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + + if (fakeKeysym == 0) + { + fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + sentFakeModeSwitchPress = 1; + } + else + { + sentFakeLevel3ShiftPress = 1; + } + + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + } + } + + else if ((leftShiftOn || rightShiftOn) && + (!modeSwitchOn && !level3ShiftOn && !altROn)) + { + if ((pos == 0 && !skip) || pos == 2) + { + if (leftShiftOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeLShiftRelease = 1; + } + if (rightShiftOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeRShiftRelease = 1; + } + } + if (pos == 2 || pos ==3) + { + fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + + if (fakeKeysym == 0) + { + fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + sentFakeModeSwitchPress = 1; + } + else + { + sentFakeLevel3ShiftPress = 1; + } + + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + } + } + + else if ((!leftShiftOn && !rightShiftOn) && + (modeSwitchOn || level3ShiftOn || altROn)) + { + if (pos == 1 || pos == 3) + { + fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + sentFakeLShiftPress = 1; + } + if (pos == 0 || pos == 1) + { + if (modeSwitchOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeModeSwitchRelease = 1; + } + if (level3ShiftOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeLevel3ShiftRelease = 1; + } + if (altROn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeAltRRelease = 1; + } + } + } + + else if ((leftShiftOn || rightShiftOn) && + (modeSwitchOn || level3ShiftOn || altROn)) + { + if (pos == 0 || pos == 2) + { + if (leftShiftOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeLShiftRelease = 1; + } + if (rightShiftOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeRShiftRelease = 1; + } + } + if (pos == 0 || pos == 1) + { + if (modeSwitchOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeModeSwitchRelease = 1; + } + if (level3ShiftOn) + { + fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeLevel3ShiftRelease = 1; + } + if (altROn) + { + fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + sentFakeAltRRelease = 1; + } + } + } +} + +void Poller::cancelFakeModifierEvents() +{ + KeySym fakeKeysym; + int col; + + if (sentFakeLShiftPress) + { + logTest("Poller::handleKeyboardEvent", "Fake Shift_L key press event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake Shift_L key release event"); + + fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + + sentFakeLShiftPress = 0; + } + + if (sentFakeLShiftRelease) + { + logTest("Poller::handleKeyboardEvent", "Fake Shift_L key release event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake Shift_L key press event"); + + fakeKeysym = keymapKeysymToKeycode(XK_Shift_L, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + + sentFakeLShiftRelease = 0; + } + + if (sentFakeRShiftRelease) + { + logTest("Poller::handleKeyboardEvent", "Fake Shift_R key release event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake Shift_R key press event"); + + fakeKeysym = keymapKeysymToKeycode(XK_Shift_R, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + + sentFakeRShiftRelease = 0; + } + + if (sentFakeModeSwitchPress) + { + logTest("Poller::handleKeyboardEvent", "Fake Mode_switch key press event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake Mode_switch key release event"); + + fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + + sentFakeModeSwitchPress = 0; + } + + if (sentFakeModeSwitchRelease) + { + logTest("Poller::handleKeyboardEvent", "Fake Mode_switch key release event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending Mode_switch key press event"); + + fakeKeysym = keymapKeysymToKeycode(XK_Mode_switch, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + + sentFakeModeSwitchRelease = 0; + } + + if (sentFakeLevel3ShiftPress) + { + logTest("Poller::handleKeyboardEvent", "Fake ISO_Level3_Shift key press event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake ISO_Level3_Shift key release event"); + + fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 0, 0); + + sentFakeLevel3ShiftPress = 0; + } + + if (sentFakeLevel3ShiftRelease) + { + logTest("Poller::handleKeyboardEvent", "Fake ISO_Level3_Shift key release event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake ISO_Level3_Shift key press event"); + + fakeKeysym = keymapKeysymToKeycode(XK_ISO_Level3_Shift, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + + sentFakeLevel3ShiftRelease = 0; + } + + if (sentFakeAltRRelease) + { + logTest("Poller::handleKeyboardEvent", "Fake XK_Alt_R key release event has been sent"); + logTest("Poller::handleKeyboardEvent", "Sending fake XK_Alt_R key press event"); + + fakeKeysym = keymapKeysymToKeycode(XK_Alt_R, masterKeysyms, masterMinKey, + masterMaxKey, masterMapWidth, &col); + XTestFakeKeyEvent(display_, fakeKeysym, 1, 0); + + sentFakeAltRRelease = 0; + } +} + +Bool Poller::keyIsDown(KeyCode keycode) +{ + KeyPressedRec *downKey; + + downKey = shadowKeyPressedPtr; + + while (downKey) + { + if (downKey -> keyRcvd == keycode) + { + return True; + } + downKey = downKey -> next; + } + + return False; +} + +void Poller::addKeyPressed(KeyCode received, KeyCode sent) +{ + KeyPressedRec *downKey; + + if (!keyIsDown(received)) + { + if (shadowKeyPressedPtr == NULL) + { + shadowKeyPressedPtr = (KeyPressedRec *) malloc(sizeof(KeyPressedRec)); + + shadowKeyPressedPtr -> keyRcvd = received; + shadowKeyPressedPtr -> keySent = sent; + shadowKeyPressedPtr -> next = NULL; + } + else + { + downKey = shadowKeyPressedPtr; + + while (downKey -> next != NULL) + { + downKey = downKey -> next; + } + + downKey -> next = (KeyPressedRec *) malloc(sizeof(KeyPressedRec)); + + downKey -> next -> keyRcvd = received; + downKey -> next -> keySent = sent; + downKey -> next -> next = NULL; + } + } +} + +KeyCode Poller::getKeyPressed(KeyCode received) +{ + KeyCode sent; + KeyPressedRec *downKey; + KeyPressedRec *tempKey; + + if (shadowKeyPressedPtr != NULL) + { + if (shadowKeyPressedPtr -> keyRcvd == received) + { + sent = shadowKeyPressedPtr -> keySent; + + tempKey = shadowKeyPressedPtr; + shadowKeyPressedPtr = shadowKeyPressedPtr -> next; + free(tempKey); + + return sent; + } + else + { + downKey = shadowKeyPressedPtr; + + while (downKey -> next != NULL) + { + if (downKey -> next -> keyRcvd == received) + { + sent = downKey -> next -> keySent; + + tempKey = downKey -> next; + downKey -> next = downKey -> next -> next; + free(tempKey); + + return sent; + } + else + { + downKey = downKey -> next; + } + } + } + } + return 0; +} + +void Poller::handleKeyboardEvent(Display *display, XEvent *event) +{ + if (xtestExtension_ == 0 || display_ == 0) + { + return; + } + + logTest("Poller::handleKeyboardEvent", "Handling event at [%p]", event); + +#ifdef TRANSLATE_ALWAYS + + KeyCode keycode; + KeySym keysym; + + int col = 0; + + Bool isKeyPress = False; + Bool isModifier = False; + Bool isShiftComb = False; + Bool skip = False; + + if (event -> type == KeyPress) + { + isKeyPress = True; + } + + if (shadowKeysyms == NULL) + { + keymapShadowInit(event -> xkey.display); + } + + if (masterKeysyms == NULL) + { + keymapMasterInit(); + } + + if (shadowKeysyms == NULL || masterKeysyms == NULL) + { + logTest("Poller::handleKeyboardEvent", "Unable to initialize keymaps. Do not translate"); + + keycode = event -> xkey.keycode; + + goto SendKeycode; + } + + keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, + shadowMinKey, shadowMapWidth, 0); + + isModifier = checkModifierKeys(keysym, isKeyPress); + + if (event -> type == KeyRelease) + { + KeyCode keycodeToSend; + + keycodeToSend = getKeyPressed(event -> xkey.keycode); + + if (keycodeToSend) + { + keycode = keycodeToSend; + + goto SendKeycode; + } + } + + /* + * Convert case for Solaris keyboard. + */ + + if (((keysym >> 8) == 0) && (keysym >= XK_A) && (keysym <= XK_Z)) + { + if (!leftShiftOn && !rightShiftOn) + { + keysym += XK_a - XK_A; + } + else + { + skip = True; + } + } + + if (!isModifier) + { + if ((leftShiftOn || rightShiftOn) && + (!modeSwitchOn && !level3ShiftOn && !altROn) && + !skip) + { + KeySym tempKeysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, + shadowMinKey, shadowMapWidth, 1); + + if (tempKeysym == 0) + { + isShiftComb = True; + } + else + { + keysym = tempKeysym; + } + } + else if ((!leftShiftOn && !rightShiftOn) && + (modeSwitchOn || level3ShiftOn || altROn)) + { + keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, + shadowMinKey, shadowMapWidth, 2); + } + else if ((leftShiftOn || rightShiftOn) && + (modeSwitchOn || level3ShiftOn || altROn)) + { + keysym = keymapKeycodeToKeysym(event -> xkey.keycode, shadowKeysyms, + shadowMinKey, shadowMapWidth, 3); + } + } + + if (keysym == 0) + { + logTest("Poller::handleKeyboardEvent", "Null keysym. Return"); + + return; + } + + logTest("Poller::handleKeyboardEvent", "keysym [%x] [%s]", + (unsigned int)keysym, XKeysymToString(keysym)); + + if (keysym == XK_Mode_switch) + { + keysym = XK_ISO_Level3_Shift; + } + + keycode = translateKeysymToKeycode(keysym, &col); + + if (keycode == 0) + { + logTest("Poller::handleKeyboardEvent", "No keycode found for keysym [%x] [%s]. Return", + (unsigned int)keysym, XKeysymToString(keysym)); + return; + } + + logTest("Poller::handleKeyboardEvent", "keycode [%d] translated into keycode [%d]", + (int)event -> xkey.keycode, (unsigned int)keycode); + + if (event -> type == KeyPress) + { + addKeyPressed(event -> xkey.keycode, keycode); + } + + /* + * Send fake modifier events. + */ + + if (!isModifier && isShiftComb == False) + { + sendFakeModifierEvents(col, ((keysym >> 8) == 0) && (keysym >= XK_A) && (keysym <= XK_Z)); + } + +SendKeycode: + + /* + * Send the event. + */ + + XTestFakeKeyEvent(display_, keycode, isKeyPress, 0); + + /* + * Check if fake modifier events have been sent. + */ + + cancelFakeModifierEvents(); + +#else // TRANSLATE_ALWAYS + + // + // Use keysyms to translate keycodes across different + // keyboard models. Unuseful when both keyboards have + // same keycodes (e.g. both are pc keyboards). + // + + #ifdef TRANSLATE_KEYCODES + + KeyCode keycode = XKeysymToKeycode(display_, XK_A); + + if (XKeysymToKeycode(event -> xkey.display, XK_A) != keycode) + { + KeySym keysym = XKeycodeToKeysym(event -> xkey.display, event -> xkey.keycode, 0); + + if (keysym == XK_Mode_switch || keysym == XK_ISO_Level3_Shift) + { + logUser("Poller::handleKeyboardEvent: keysym [%x].\n", (unsigned int)keysym); + + if (XKeycodeToKeysym(display_, 113, 0) == XK_ISO_Level3_Shift || + (XKeycodeToKeysym(display_, 124, 0) == XK_ISO_Level3_Shift)) + { + event -> xkey.keycode = 113; + } + else + { + event -> xkey.keycode = XKeysymToKeycode(display_, XK_Mode_switch); + } + + logUser("Poller::handleKeyboardEvent: keycode translated to [%x].\n", (unsigned int)event -> xkey.keycode); + } + else + { + event -> xkey.keycode = XKeysymToKeycode(display_, keysym); + } + } + + #endif // TRANSLATE_KEYCODES + + if (event -> type == KeyPress) + { + XTestFakeKeyEvent(display_, event -> xkey.keycode, 1, 0); + } + else if (event -> type == KeyRelease) + { + XTestFakeKeyEvent(display_, event -> xkey.keycode, 0, 0); + } + +#endif // TRANSLATE_ALWAYS +} + +void Poller::handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress) +{ + KeyCode keycode; + int col; + + if (masterKeysyms == NULL) + { + keymapMasterInit(); + } + + if (masterKeysyms == NULL) + { + logTest("Poller::handleWebKeyboardEvent", "Unable to initialize keymap"); + + return; + } + + keycode = translateKeysymToKeycode(keysym, &col); + + if (keycode == 0) + { + logTest("Poller::handleKeyboardEvent", "No keycode found for keysym [%x] [%s]. Return", + (unsigned int)keysym, XKeysymToString(keysym)); + return; + } + + logTest("Poller::handleKeyboardEvent", "keysym [%x] [%s] translated into keycode [%x]", + (unsigned int)keysym, XKeysymToString(keysym), (unsigned int)keycode); + + /* + * Send fake modifier events. + */ + + if (!checkModifierKeys(keysym, isKeyPress)) + { + sendFakeModifierEvents(col, False); + } + + /* + * Send the event. + */ + + XTestFakeKeyEvent(display_, keycode, isKeyPress, 0); + + /* + * Check if fake modifier events have been sent. + */ + + cancelFakeModifierEvents(); + +} + +void Poller::handleMouseEvent(Display *display, XEvent *event) +{ + if (xtestExtension_ == 0 || display_ == 0) + { + return; + } + + if (event -> type == MotionNotify) + { + XTestFakeMotionEvent(display_, 0, event -> xmotion.x, event -> xmotion.y, 0); + } + else if (event -> type == ButtonPress) + { + XTestFakeButtonEvent(display_, event -> xbutton.button, True, 0); + } + else if (event -> type == ButtonRelease) + { + XTestFakeButtonEvent(display_, event -> xbutton.button, False, 0); + } + + XFlush(display_); +} + +void Poller::setRootSize(void) +{ + width_ = WidthOfScreen(DefaultScreenOfDisplay(display_)); + height_ = HeightOfScreen(DefaultScreenOfDisplay(display_)); + depth_ = DefaultDepth(display_, DefaultScreen(display_)); + + if (depth_ == 8) bpp_ = 1; + else if (depth_ == 16) bpp_ = 2; + else bpp_ = 4; + + bpl_ = width_ * bpp_; +} + +void Poller::destroyShmImage(void) +{ + XShmDetach(display_, shminfo_); + XDestroyImage(image_); + image_ = NULL; + + shmdt(shminfo_ -> shmaddr); + shmctl(shminfo_ -> shmid, IPC_RMID, 0); + + delete shminfo_; + shminfo_ = NULL; +} + +void Poller::xtestInit(void) +{ + int eventBase; + int errorBase; + int versionMajor; + int versionMinor; + int result; + + xtestExtension_ = 0; + + result = XTestQueryExtension(display_, &eventBase, &errorBase, &versionMajor, &versionMinor); + + if (result == 0) + { + xtestExtension_ = 0; + + logWarning("Poller::xtestInit", "Failed while querying for XTEST extension."); + } + else + { + logDebug("Poller::xtestInit", "XTEST version %d.%d.", versionMajor, versionMinor); + + xtestExtension_ = 1; + } + + // + // Make this client impervious to grabs. + // + + if (xtestExtension_ == 1) + { + XTestGrabControl(display_, 1); + } +} + +void Poller::randrInit(void) +{ + int randrEventBase; + int randrErrorBase; + + if (XRRQueryExtension(display_, &randrEventBase, &randrErrorBase) == 0) + { + logWarning("Poller::randrInit", "Randr extension not supported on this " + "display."); + + randrExtension_ = 0; + + return; + } + + XRRSelectInput(display_, DefaultRootWindow(display_), + RRScreenChangeNotifyMask); + + randrEventBase_ = randrEventBase; + + randrExtension_ = 1; + + return; +} + +void Poller::damageInit(void) +{ + int damageMajorVersion = 0; + int damageMinorVersion = 0; + + int damageEventBase = 0; + int damageErrorBase = 0; + + if (damageExtension_ >= 0) + { + logDebug("Poller::damageInit", "Called with damage already initialized."); + } + + if (damageExtension_ == 0) + { + logDebug("Poller::damageInit", "Damage disabled. Skip initialization."); + + return; + } + + if (damageExtension_ < 0 && NXShadowOptions.optionDamageExtension == 0) + { + damageExtension_ = 0; + + logUser("Poller::damageInit: Disabling use of DAMAGE extension.\n"); + + return; + } + + damageExtension_ = 0; + + mirrorChanges_ = 0; + + if (XDamageQueryExtension(display_, &damageEventBase, &damageErrorBase) == 0) + { + logUser("Poller::damageInit: DAMAGE not supported.\n"); + + return; + } + #ifdef DEBUG + else + { + fprintf(stderr, "Poller::damageInit: DAMAGE supported. " + "Event base [%d] error base [%d].\n", damageEventBase, damageErrorBase); + } + #endif + + damageEventBase_ = damageEventBase; + + if (XDamageQueryVersion(display_, &damageMajorVersion, &damageMinorVersion) == 0) + { + logWarning("Poller::damageInit", "Error on querying DAMAGE version.\n"); + + damageExtension_ = 0; + + return; + } + #ifdef DEBUG + else + { + fprintf(stderr, "Poller::damageInit: DAMAGE version %d.%d.\n", + damageMajorVersion, damageMinorVersion); + } + #endif + + damage_ = XDamageCreate(display_, DefaultRootWindow(display_), XDamageReportRawRectangles); + + damageExtension_= 1; + + mirror_ = 1; + + return; +} + +void Poller::getEvents(void) +{ + XEvent X; + + if (damageExtension_ == 1) + { + XDamageSubtract(display_, damage_, None, None); + } + + XSync(display_, 0); + + while (XCheckIfEvent(display_, &X, anyEventPredicate, NULL) == 1) + { + if (randrExtension_ == 1 && (X.type == randrEventBase_ + RRScreenChangeNotify || X.type == ConfigureNotify)) + { + XRRUpdateConfiguration(&X); + + handleRRScreenChangeNotify(&X); + + continue; + } + + if (damageExtension_ == 1 && X.type == damageEventBase_ + XDamageNotify) + { + handleDamageNotify(&X); + } + } + + if (damageExtension_ == 1) + { + updateDamagedAreas(); + } + + XFlush(display_); +} + +void Poller::handleRRScreenChangeNotify(XEvent *X) +{ + return; +} + +void Poller::handleDamageNotify(XEvent *X) +{ + XDamageNotifyEvent *e = (XDamageNotifyEvent *) X; + + // + // e->drawable is the window ID of the damaged window + // e->geometry is the geometry of the damaged window + // e->area is the bounding rect for the damaged area + // e->damage is the damage handle returned by XDamageCreate() + // + + #ifdef DEBUG + fprintf(stderr, "handleDamageNotify: drawable [%d] damage [%d] geometry [%d][%d][%d][%d] area [%d][%d][%d][%d].\n", + (int) e -> drawable, (int) e -> damage, e -> geometry.x, e -> geometry.y, + e -> geometry.width, e -> geometry.height, e -> area.x, e -> area.y, + e -> area.width, e -> area.height); + #endif + + XRectangle rectangle = {e -> area.x, e -> area.y, e -> area.width, e -> area.height}; + + XUnionRectWithRegion(&rectangle, lastUpdatedRegion_, lastUpdatedRegion_); + + mirrorChanges_ = 1; + + return; +} + +void Poller::updateDamagedAreas(void) +{ + BOX *boxPtr; + + XRectangle rectangle; + + int i; + int y; + + for (i = 0; i < lastUpdatedRegion_ -> numRects; i++) + { + boxPtr = lastUpdatedRegion_ -> rects + i; + + if (shmExtension_ == 1) + { + image_ -> width = boxPtr -> x2 - boxPtr -> x1; + image_ -> height = boxPtr -> y2 - boxPtr -> y1; + image_ -> bytes_per_line = + ROUNDUP((image_ -> bits_per_pixel * image_ -> width), + image_ -> bitmap_pad); + + if (XShmGetImage(display_, DefaultRootWindow(display_), image_, + boxPtr -> x1, boxPtr -> y1, AllPlanes) == 0) + { + logDebug("Poller::updateDamagedAreas", "XShmGetImage failed!"); + + return; + } + } + else if (shmExtension_ == 0) + { + image_ = XGetImage(display_, DefaultRootWindow(display_), boxPtr -> x1, + boxPtr -> y1, boxPtr -> x2 - boxPtr -> x1, + boxPtr -> y2 - boxPtr -> y1, AllPlanes, + ZPixmap); + + if (image_ == NULL) + { + logDebug("Poller::updateDamagedAreas", "XGetImage failed!"); + + return; + } + + image_ -> width = boxPtr -> x2 - boxPtr -> x1; + image_ -> height = boxPtr -> y2 - boxPtr -> y1; + image_ -> bytes_per_line = + ROUNDUP((image_ -> bits_per_pixel * image_ -> width), + image_ -> bitmap_pad); + } + + rectangle.height = 1; + rectangle.width = image_ -> width; + rectangle.x = boxPtr -> x1; + rectangle.y = boxPtr -> y1; + + for (y = 0; y < image_ -> height; y++) + { + update(image_ -> data + y * image_ -> bytes_per_line, rectangle); + + rectangle.y++; + } + + if (shmExtension_ != 1) + { + XDestroyImage(image_); + + image_ = NULL; + } + } + + return; +} + +void Poller::getScreenSize(int *w, int *h) +{ + *w = WidthOfScreen(DefaultScreenOfDisplay(display_)); + *h = HeightOfScreen(DefaultScreenOfDisplay(display_)); +} + +void Poller::setScreenSize(int *w, int *h) +{ + setRootSize(); + + shmInitTrap = 1; + shmInit(); + shmInitTrap = 0; + + *w = width_; + *h = height_; + + logDebug("Poller::setScreenSize", "New size of screen [%d, %d]", width_, height_); +} + +int anyEventPredicate(Display *display, XEvent *event, XPointer parameter) +{ + return 1; +} + +#endif /* !defined(__CYGWIN32__) && !defined(WIN32) */ diff --git a/nxcompshad/src/X11.h b/nxcompshad/src/X11.h new file mode 100644 index 000000000..87dd31fea --- /dev/null +++ b/nxcompshad/src/X11.h @@ -0,0 +1,139 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMPSHAD, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef X11Poller_H +#define X11Poller_H + +#include +#include +#include "X11/include/Xdamage_nxcompshad.h" +#include "X11/include/Xrandr_nxcompshad.h" + +#include "Core.h" + +class Poller : public CorePoller +{ + public: + + Poller(Input *, Display *display, int = 0); + + ~Poller(); + + int init(); + + void setRootSize(); + + void destroyShmImage(); + + void getEvents(void); + + void getScreenSize(int *width, int *height); + + void setScreenSize(int *width, int *height); + + private: + + Display *display_; + + char *shadowDisplayName_; + + int shadowDisplayUid_; + + char *tmpBuffer_; + + char xtestExtension_; + + char shmExtension_; + + char randrExtension_; + + int randrEventBase_; + + char damageExtension_; + + int damageEventBase_; + + Damage damage_; + + Region repair_; + + char damageChanges_; + + XShmSegmentInfo *shminfo_; + + XImage *image_; + + int updateShadowFrameBuffer(void); + + char *getRect(XRectangle); + + void keymapShadowInit(Display *display); + + void keymapMasterInit(); + + KeySym keymapKeycodeToKeysym(KeyCode keycode, KeySym *keysyms, + int minKey, int per, int col); + + KeyCode keymapKeysymToKeycode(KeySym keysym, KeySym *keysyms, + int minKey, int maxKey, int per, int *col); + + KeyCode translateKeysymToKeycode(KeySym keysym, int *col); + + Bool checkModifierKeys(KeySym keysym, Bool isKeyPress); + + void sendFakeModifierEvents(int pos, Bool skip); + + void cancelFakeModifierEvents(); + + Bool keyIsDown(KeyCode keycode); + + void addKeyPressed(KeyCode received, KeyCode sent); + + KeyCode getKeyPressed(KeyCode received); + + void handleKeyboardEvent(Display *display, XEvent *); + + void handleWebKeyboardEvent(KeySym keysym, Bool isKeyPress); + + void handleMouseEvent(Display *, XEvent *); + + void xtestInit(void); + + void shmInit(void); + + void randrInit(void); + + void damageInit(void); + + void handleRRScreenChangeNotify(XEvent *); + + void handleDamageNotify(XEvent *); + + void updateDamagedAreas(void); +}; + +int anyEventPredicate(Display *display, XEvent *event, XPointer parameter); + +#endif /* X11Poller_H */ diff --git a/nxcompshad/src/X11/include/XTest_nxcompshad.h b/nxcompshad/src/X11/include/XTest_nxcompshad.h new file mode 100644 index 000000000..91a2ba40b --- /dev/null +++ b/nxcompshad/src/X11/include/XTest_nxcompshad.h @@ -0,0 +1,71 @@ +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifndef _XTEST_H_ +#define _XTEST_H_ + +#include + +_XFUNCPROTOBEGIN + +Bool XTestQueryExtension( + Display* /* dpy */, + int* /* event_basep */, + int* /* error_basep */, + int* /* majorp */, + int* /* minorp */ +); + +extern int XTestFakeKeyEvent( + Display* /* dpy */, + unsigned int /* keycode */, + Bool /* is_press */, + unsigned long /* delay */ +); + +extern int XTestFakeButtonEvent( + Display* /* dpy */, + unsigned int /* button */, + Bool /* is_press */, + unsigned long /* delay */ +); + +extern int XTestFakeMotionEvent( + Display* /* dpy */, + int /* screen */, + int /* x */, + int /* y */, + unsigned long /* delay */ +); + +extern int XTestGrabControl( + Display* /* dpy */, + Bool /* impervious */ +); + +_XFUNCPROTOEND + +#endif diff --git a/nxcompshad/src/X11/include/Xdamage_nxcompshad.h b/nxcompshad/src/X11/include/Xdamage_nxcompshad.h new file mode 100644 index 000000000..cae3e1c67 --- /dev/null +++ b/nxcompshad/src/X11/include/Xdamage_nxcompshad.h @@ -0,0 +1,92 @@ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +/* + * This file is a reduced version of the header file of + * + * + * This copy of code has been introduced to allow a clear namespace + * separation between and header files. + * + * This version of the Xdamage library header file only contains symbols + * required by nxcompshad and strictly avoids indirectly including + * from an X11 library that is also shipped in nx-X11/lib/. + * + * When using instead for inclusion in + * nxcompshad, it will attempt pulling in the + * header which in turn will include . However, the headers of + * the same name from should be used instead. + * + * FIXME: Once the nxagent Xserver starts using libX11 from X.Org, this + * hack can be removed. + * + * 2015/06/26, Mike Gabriel + */ + + +#ifndef _XDAMAGE_H_ +#define _XDAMAGE_H_ + +#include +#include + +/* from */ +typedef XID XserverRegion; + +#define XDAMAGE_1_1_INTERFACE + +typedef XID Damage; + +typedef struct { + int type; /* event base */ + unsigned long serial; + Bool send_event; + Display *display; + Drawable drawable; + Damage damage; + int level; + Bool more; /* more events will be delivered immediately */ + Time timestamp; + XRectangle area; + XRectangle geometry; +} XDamageNotifyEvent; + +_XFUNCPROTOBEGIN + +Bool XDamageQueryExtension (Display *dpy, + int *event_base_return, + int *error_base_return); + +Status XDamageQueryVersion (Display *dpy, + int *major_version_return, + int *minor_version_return); + +Damage +XDamageCreate (Display *dpy, Drawable drawable, int level); + +void +XDamageSubtract (Display *dpy, Damage damage, + XserverRegion repair, XserverRegion parts); + +_XFUNCPROTOEND + +#endif /* _XDAMAGE_H_ */ diff --git a/nxcompshad/src/X11/include/Xrandr_nxcompshad.h b/nxcompshad/src/X11/include/Xrandr_nxcompshad.h new file mode 100644 index 000000000..4feb01685 --- /dev/null +++ b/nxcompshad/src/X11/include/Xrandr_nxcompshad.h @@ -0,0 +1,80 @@ +/* + * Copyright © 2000 Compaq Computer Corporation, Inc. + * Copyright © 2002 Hewlett-Packard Company, Inc. + * Copyright © 2006 Intel Corporation + * Copyright © 2008 Red Hat, Inc. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 the copyright holders not be used in advertising or + * publicity pertaining to distribution of the software without specific, + * written prior permission. The copyright holders make no representations + * about the suitability of this software for any purpose. It is provided "as + * is" without express or implied warranty. + * + * THE COPYRIGHT HOLDERS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL THE COPYRIGHT HOLDERS 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: Jim Gettys, HP Labs, Hewlett-Packard, Inc. + * Keith Packard, Intel Corporation + */ + +/* + * This file is a reduced version of the header file of + * + * + * This copy of code has been introduced to allow a clear namespace + * separation between and header files. + * + * This version of the Xrandr library header file only contains symbols + * required by nxcompshad and strictly avoids indirectly including + * from an X11 library that is also shipped in nx-X11/lib/. + * + * When using instead for inclusion in + * nxcompshad, it will attempt pulling in the + * header which in turn will include . However, the headers of + * the same name from should be used instead. + * + * FIXME: Once the nxagent Xserver starts using libXrender from X.Org, this + * hack can be removed. + * + * 2015/06/26, Mike Gabriel + */ + +#ifndef _XRANDR_H_ +#define _XRANDR_H_ + +/* from */ +#define RRScreenChangeNotify 0 +#define RRScreenChangeNotifyMask (1L << 0) + +#include + +_XFUNCPROTOBEGIN + +/* internal representation is private to the library */ +typedef struct _XRRScreenConfiguration XRRScreenConfiguration; + +Bool XRRQueryExtension (Display *dpy, + int *event_base_return, + int *error_base_return); + +void XRRSelectInput(Display *dpy, Window window, int mask); + + +/* + * intended to take RRScreenChangeNotify, or + * ConfigureNotify (on the root window) + * returns 1 if it is an event type it understands, 0 if not + */ +int XRRUpdateConfiguration(XEvent *event); +_XFUNCPROTOEND + +#endif /* _XRANDR_H_ */ -- cgit v1.2.3 From f76c82403888bb498973ec974dbfd20e4edb02fe Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 30 Jun 2017 20:13:51 +0200 Subject: nxcomp: Switch to autoreconf. --- Makefile | 16 +- debian/libxcomp-dev.install | 1 + debian/rules | 2 +- nx-X11/lib/X11/Imakefile | 6 +- nx-X11/programs/Xserver/Imakefile | 20 +- nxcomp/.gitignore | 23 +- nxcomp/ActionCache.cpp | 47 - nxcomp/ActionCache.h | 49 - nxcomp/Agent.cpp | 80 - nxcomp/Agent.h | 263 - nxcomp/Alpha.cpp | 134 - nxcomp/Alpha.h | 35 - nxcomp/Auth.cpp | 667 -- nxcomp/Auth.h | 127 - nxcomp/Bitmap.cpp | 114 - nxcomp/Bitmap.h | 36 - nxcomp/BlockCache.cpp | 77 - nxcomp/BlockCache.h | 67 - nxcomp/BlockCacheSet.cpp | 143 - nxcomp/BlockCacheSet.h | 49 - nxcomp/ChangeGC.cpp | 180 - nxcomp/ChangeGC.h | 185 - nxcomp/ChangeProperty.cpp | 187 - nxcomp/ChangeProperty.h | 189 - nxcomp/Channel.cpp | 2035 ---- nxcomp/Channel.h | 664 -- nxcomp/ChannelCache.cpp | 64 - nxcomp/ChannelCache.h | 61 - nxcomp/ChannelEndPoint.cpp | 345 - nxcomp/ChannelEndPoint.h | 71 - nxcomp/ChannelStore.h | 54 - nxcomp/CharCache.cpp | 69 - nxcomp/CharCache.h | 91 - nxcomp/Children.cpp | 1055 -- nxcomp/ClearArea.cpp | 121 - nxcomp/ClearArea.h | 182 - nxcomp/ClientCache.cpp | 388 - nxcomp/ClientCache.h | 417 - nxcomp/ClientChannel.cpp | 7877 -------------- nxcomp/ClientChannel.h | 434 - nxcomp/ClientProxy.cpp | 549 - nxcomp/ClientProxy.h | 113 - nxcomp/ClientReadBuffer.cpp | 174 - nxcomp/ClientReadBuffer.h | 65 - nxcomp/ClientStore.cpp | 222 - nxcomp/ClientStore.h | 143 - nxcomp/Colormap.cpp | 102 - nxcomp/Colormap.h | 32 - nxcomp/ConfigureWindow.cpp | 138 - nxcomp/ConfigureWindow.h | 178 - nxcomp/Control.cpp | 818 -- nxcomp/Control.h | 764 -- nxcomp/CopyArea.cpp | 195 - nxcomp/CopyArea.h | 192 - nxcomp/CreateGC.cpp | 190 - nxcomp/CreateGC.h | 186 - nxcomp/CreatePixmap.cpp | 276 - nxcomp/CreatePixmap.h | 162 - nxcomp/DecodeBuffer.cpp | 635 -- nxcomp/DecodeBuffer.h | 138 - nxcomp/EncodeBuffer.cpp | 619 -- nxcomp/EncodeBuffer.h | 183 - nxcomp/FillPoly.cpp | 235 - nxcomp/FillPoly.h | 200 - nxcomp/Fork.cpp | 106 - nxcomp/Fork.h | 31 - nxcomp/FreeCache.h | 42 - nxcomp/GenericChannel.cpp | 491 - nxcomp/GenericChannel.h | 440 - nxcomp/GenericReadBuffer.cpp | 78 - nxcomp/GenericReadBuffer.h | 61 - nxcomp/GenericReply.cpp | 298 - nxcomp/GenericReply.h | 161 - nxcomp/GenericRequest.cpp | 330 - nxcomp/GenericRequest.h | 160 - nxcomp/GetImage.cpp | 173 - nxcomp/GetImage.h | 190 - nxcomp/GetImageReply.cpp | 190 - nxcomp/GetImageReply.h | 150 - nxcomp/GetProperty.cpp | 115 - nxcomp/GetProperty.h | 183 - nxcomp/GetPropertyReply.cpp | 300 - nxcomp/GetPropertyReply.h | 160 - nxcomp/ImageText16.cpp | 227 - nxcomp/ImageText16.h | 190 - nxcomp/ImageText8.cpp | 227 - nxcomp/ImageText8.h | 190 - nxcomp/IntCache.cpp | 226 - nxcomp/IntCache.h | 119 - nxcomp/InternAtom.cpp | 127 - nxcomp/InternAtom.h | 178 - nxcomp/Jpeg.cpp | 886 -- nxcomp/Jpeg.h | 36 - nxcomp/Keeper.cpp | 608 -- nxcomp/Keeper.h | 199 - nxcomp/List.cpp | 108 - nxcomp/List.h | 95 - nxcomp/ListFontsReply.cpp | 209 - nxcomp/ListFontsReply.h | 146 - nxcomp/Loop.cpp | 16689 ---------------------------- nxcomp/MD5.c | 399 - nxcomp/MD5.h | 91 - nxcomp/Makefile.am | 21 + nxcomp/Makefile.in | 333 - nxcomp/Message.cpp | 2339 ---- nxcomp/Message.h | 1089 -- nxcomp/Misc.cpp | 1930 ---- nxcomp/Misc.h | 279 - nxcomp/NX.h | 471 - nxcomp/NXalert.h | 276 - nxcomp/NXmitshm.h | 56 - nxcomp/NXpack.h | 141 - nxcomp/NXproto.h | 447 - nxcomp/NXrender.h | 78 - nxcomp/NXvars.h | 201 - nxcomp/OpcodeCache.h | 53 - nxcomp/OpcodeStore.cpp | 84 - nxcomp/OpcodeStore.h | 91 - nxcomp/Pack.c | 180 - nxcomp/Pgn.cpp | 805 -- nxcomp/Pgn.h | 42 - nxcomp/Pipe.cpp | 429 - nxcomp/Pipe.h | 35 - nxcomp/PolyArc.cpp | 158 - nxcomp/PolyArc.h | 185 - nxcomp/PolyFillArc.cpp | 158 - nxcomp/PolyFillArc.h | 185 - nxcomp/PolyFillRectangle.cpp | 156 - nxcomp/PolyFillRectangle.h | 185 - nxcomp/PolyLine.cpp | 164 - nxcomp/PolyLine.h | 186 - nxcomp/PolyPoint.cpp | 164 - nxcomp/PolyPoint.h | 186 - nxcomp/PolySegment.cpp | 158 - nxcomp/PolySegment.h | 185 - nxcomp/PolyText16.cpp | 308 - nxcomp/PolyText16.h | 188 - nxcomp/PolyText8.cpp | 306 - nxcomp/PolyText8.h | 188 - nxcomp/Proxy.cpp | 6525 ----------- nxcomp/Proxy.h | 1276 --- nxcomp/ProxyReadBuffer.cpp | 207 - nxcomp/ProxyReadBuffer.h | 57 - nxcomp/PutImage.cpp | 407 - nxcomp/PutImage.h | 172 - nxcomp/PutPackedImage.cpp | 600 -- nxcomp/PutPackedImage.h | 218 - nxcomp/QueryFontReply.cpp | 150 - nxcomp/QueryFontReply.h | 136 - nxcomp/ReadBuffer.cpp | 635 -- nxcomp/ReadBuffer.h | 128 - nxcomp/RenderAddGlyphs.cpp | 229 - nxcomp/RenderAddGlyphs.h | 88 - nxcomp/RenderChangePicture.cpp | 234 - nxcomp/RenderChangePicture.h | 88 - nxcomp/RenderComposite.cpp | 396 - nxcomp/RenderComposite.h | 88 - nxcomp/RenderCompositeGlyphs.cpp | 625 -- nxcomp/RenderCompositeGlyphs.h | 100 - nxcomp/RenderCreateGlyphSet.cpp | 181 - nxcomp/RenderCreateGlyphSet.h | 88 - nxcomp/RenderCreatePicture.cpp | 274 - nxcomp/RenderCreatePicture.h | 88 - nxcomp/RenderExtension.cpp | 423 - nxcomp/RenderExtension.h | 504 - nxcomp/RenderFillRectangles.cpp | 233 - nxcomp/RenderFillRectangles.h | 88 - nxcomp/RenderFreeGlyphSet.cpp | 162 - nxcomp/RenderFreeGlyphSet.h | 88 - nxcomp/RenderFreePicture.cpp | 162 - nxcomp/RenderFreePicture.h | 88 - nxcomp/RenderGenericRequest.cpp | 266 - nxcomp/RenderGenericRequest.h | 89 - nxcomp/RenderMinorExtensionHeaders.h | 42 - nxcomp/RenderMinorExtensionMethods.h | 81 - nxcomp/RenderMinorExtensionTags.h | 194 - nxcomp/RenderPictureClip.cpp | 299 - nxcomp/RenderPictureClip.h | 88 - nxcomp/RenderPictureFilter.cpp | 274 - nxcomp/RenderPictureFilter.h | 88 - nxcomp/RenderPictureTransform.cpp | 210 - nxcomp/RenderPictureTransform.h | 88 - nxcomp/RenderTrapezoids.cpp | 368 - nxcomp/RenderTrapezoids.h | 88 - nxcomp/RenderTriangles.cpp | 358 - nxcomp/RenderTriangles.h | 88 - nxcomp/Rgb.cpp | 102 - nxcomp/Rgb.h | 36 - nxcomp/Rle.cpp | 102 - nxcomp/Rle.h | 36 - nxcomp/SendEvent.cpp | 300 - nxcomp/SendEvent.h | 195 - nxcomp/SequenceQueue.cpp | 170 - nxcomp/SequenceQueue.h | 91 - nxcomp/ServerCache.cpp | 191 - nxcomp/ServerCache.h | 303 - nxcomp/ServerChannel.cpp | 7942 -------------- nxcomp/ServerChannel.h | 529 - nxcomp/ServerProxy.cpp | 617 -- nxcomp/ServerProxy.h | 154 - nxcomp/ServerReadBuffer.cpp | 243 - nxcomp/ServerReadBuffer.h | 73 - nxcomp/ServerStore.cpp | 179 - nxcomp/ServerStore.h | 83 - nxcomp/SetClipRectangles.cpp | 150 - nxcomp/SetClipRectangles.h | 187 - nxcomp/SetUnpackAlpha.cpp | 262 - nxcomp/SetUnpackAlpha.h | 162 - nxcomp/SetUnpackColormap.cpp | 262 - nxcomp/SetUnpackColormap.h | 162 - nxcomp/SetUnpackGeometry.cpp | 301 - nxcomp/SetUnpackGeometry.h | 167 - nxcomp/ShapeExtension.cpp | 301 - nxcomp/ShapeExtension.h | 164 - nxcomp/Socket.cpp | 753 -- nxcomp/Socket.h | 96 - nxcomp/Split.cpp | 1835 ---- nxcomp/Split.h | 543 - nxcomp/StaticCompressor.cpp | 428 - nxcomp/StaticCompressor.h | 80 - nxcomp/Statistics.cpp | 2003 ---- nxcomp/Statistics.h | 745 -- nxcomp/Timestamp.cpp | 73 - nxcomp/Timestamp.h | 307 - nxcomp/TranslateCoords.cpp | 111 - nxcomp/TranslateCoords.h | 185 - nxcomp/Transport.cpp | 3064 ------ nxcomp/Transport.h | 577 - nxcomp/Types.h | 271 - nxcomp/Unpack.cpp | 1510 --- nxcomp/Unpack.h | 149 - nxcomp/Vars.c | 54 - nxcomp/Version.c | 97 - nxcomp/WriteBuffer.cpp | 496 - nxcomp/WriteBuffer.h | 134 - nxcomp/XidCache.cpp | 47 - nxcomp/XidCache.h | 49 - nxcomp/Z.cpp | 142 - nxcomp/Z.h | 37 - nxcomp/configure.ac | 83 + nxcomp/configure.in | 413 - nxcomp/include/MD5.h | 91 + nxcomp/include/NX.h | 471 + nxcomp/include/NXalert.h | 276 + nxcomp/include/NXpack.h | 141 + nxcomp/include/NXproto.h | 447 + nxcomp/include/NXvars.h | 201 + nxcomp/install-sh | 238 - nxcomp/m4/nx-macros.m4 | 1 + nxcomp/mkinstalldirs | 34 - nxcomp/nxcomp.pc.in | 2 +- nxcomp/src/ActionCache.cpp | 51 + nxcomp/src/ActionCache.h | 49 + nxcomp/src/Agent.cpp | 84 + nxcomp/src/Agent.h | 263 + nxcomp/src/Alpha.cpp | 138 + nxcomp/src/Alpha.h | 35 + nxcomp/src/Auth.cpp | 671 ++ nxcomp/src/Auth.h | 127 + nxcomp/src/Bitmap.cpp | 118 + nxcomp/src/Bitmap.h | 36 + nxcomp/src/BlockCache.cpp | 81 + nxcomp/src/BlockCache.h | 67 + nxcomp/src/BlockCacheSet.cpp | 147 + nxcomp/src/BlockCacheSet.h | 49 + nxcomp/src/ChangeGC.cpp | 184 + nxcomp/src/ChangeGC.h | 185 + nxcomp/src/ChangeProperty.cpp | 191 + nxcomp/src/ChangeProperty.h | 189 + nxcomp/src/Channel.cpp | 2039 ++++ nxcomp/src/Channel.h | 664 ++ nxcomp/src/ChannelCache.cpp | 68 + nxcomp/src/ChannelCache.h | 61 + nxcomp/src/ChannelEndPoint.cpp | 349 + nxcomp/src/ChannelEndPoint.h | 71 + nxcomp/src/ChannelStore.h | 54 + nxcomp/src/CharCache.cpp | 73 + nxcomp/src/CharCache.h | 91 + nxcomp/src/Children.cpp | 1059 ++ nxcomp/src/ClearArea.cpp | 125 + nxcomp/src/ClearArea.h | 182 + nxcomp/src/ClientCache.cpp | 392 + nxcomp/src/ClientCache.h | 417 + nxcomp/src/ClientChannel.cpp | 7881 ++++++++++++++ nxcomp/src/ClientChannel.h | 434 + nxcomp/src/ClientProxy.cpp | 553 + nxcomp/src/ClientProxy.h | 113 + nxcomp/src/ClientReadBuffer.cpp | 178 + nxcomp/src/ClientReadBuffer.h | 65 + nxcomp/src/ClientStore.cpp | 226 + nxcomp/src/ClientStore.h | 143 + nxcomp/src/Colormap.cpp | 106 + nxcomp/src/Colormap.h | 32 + nxcomp/src/ConfigureWindow.cpp | 142 + nxcomp/src/ConfigureWindow.h | 178 + nxcomp/src/Control.cpp | 822 ++ nxcomp/src/Control.h | 764 ++ nxcomp/src/CopyArea.cpp | 199 + nxcomp/src/CopyArea.h | 192 + nxcomp/src/CreateGC.cpp | 194 + nxcomp/src/CreateGC.h | 186 + nxcomp/src/CreatePixmap.cpp | 280 + nxcomp/src/CreatePixmap.h | 162 + nxcomp/src/DecodeBuffer.cpp | 639 ++ nxcomp/src/DecodeBuffer.h | 138 + nxcomp/src/EncodeBuffer.cpp | 623 ++ nxcomp/src/EncodeBuffer.h | 183 + nxcomp/src/FillPoly.cpp | 239 + nxcomp/src/FillPoly.h | 200 + nxcomp/src/Fork.cpp | 110 + nxcomp/src/Fork.h | 31 + nxcomp/src/FreeCache.h | 42 + nxcomp/src/GenericChannel.cpp | 495 + nxcomp/src/GenericChannel.h | 440 + nxcomp/src/GenericReadBuffer.cpp | 82 + nxcomp/src/GenericReadBuffer.h | 61 + nxcomp/src/GenericReply.cpp | 302 + nxcomp/src/GenericReply.h | 161 + nxcomp/src/GenericRequest.cpp | 334 + nxcomp/src/GenericRequest.h | 160 + nxcomp/src/GetImage.cpp | 177 + nxcomp/src/GetImage.h | 190 + nxcomp/src/GetImageReply.cpp | 194 + nxcomp/src/GetImageReply.h | 150 + nxcomp/src/GetProperty.cpp | 119 + nxcomp/src/GetProperty.h | 183 + nxcomp/src/GetPropertyReply.cpp | 304 + nxcomp/src/GetPropertyReply.h | 160 + nxcomp/src/ImageText16.cpp | 231 + nxcomp/src/ImageText16.h | 190 + nxcomp/src/ImageText8.cpp | 231 + nxcomp/src/ImageText8.h | 190 + nxcomp/src/IntCache.cpp | 230 + nxcomp/src/IntCache.h | 119 + nxcomp/src/InternAtom.cpp | 131 + nxcomp/src/InternAtom.h | 178 + nxcomp/src/Jpeg.cpp | 890 ++ nxcomp/src/Jpeg.h | 36 + nxcomp/src/Keeper.cpp | 612 ++ nxcomp/src/Keeper.h | 199 + nxcomp/src/List.cpp | 112 + nxcomp/src/List.h | 95 + nxcomp/src/ListFontsReply.cpp | 213 + nxcomp/src/ListFontsReply.h | 146 + nxcomp/src/Loop.cpp | 16693 +++++++++++++++++++++++++++++ nxcomp/src/MD5.c | 403 + nxcomp/src/Makefile.am | 146 + nxcomp/src/Message.cpp | 2343 ++++ nxcomp/src/Message.h | 1089 ++ nxcomp/src/Misc.cpp | 1934 ++++ nxcomp/src/Misc.h | 279 + nxcomp/src/NXmitshm.h | 56 + nxcomp/src/NXrender.h | 78 + nxcomp/src/OpcodeCache.h | 53 + nxcomp/src/OpcodeStore.cpp | 88 + nxcomp/src/OpcodeStore.h | 91 + nxcomp/src/Pack.c | 180 + nxcomp/src/Pgn.cpp | 809 ++ nxcomp/src/Pgn.h | 42 + nxcomp/src/Pipe.cpp | 433 + nxcomp/src/Pipe.h | 35 + nxcomp/src/PolyArc.cpp | 162 + nxcomp/src/PolyArc.h | 185 + nxcomp/src/PolyFillArc.cpp | 162 + nxcomp/src/PolyFillArc.h | 185 + nxcomp/src/PolyFillRectangle.cpp | 160 + nxcomp/src/PolyFillRectangle.h | 185 + nxcomp/src/PolyLine.cpp | 168 + nxcomp/src/PolyLine.h | 186 + nxcomp/src/PolyPoint.cpp | 168 + nxcomp/src/PolyPoint.h | 186 + nxcomp/src/PolySegment.cpp | 162 + nxcomp/src/PolySegment.h | 185 + nxcomp/src/PolyText16.cpp | 312 + nxcomp/src/PolyText16.h | 188 + nxcomp/src/PolyText8.cpp | 310 + nxcomp/src/PolyText8.h | 188 + nxcomp/src/Proxy.cpp | 6529 +++++++++++ nxcomp/src/Proxy.h | 1276 +++ nxcomp/src/ProxyReadBuffer.cpp | 211 + nxcomp/src/ProxyReadBuffer.h | 57 + nxcomp/src/PutImage.cpp | 411 + nxcomp/src/PutImage.h | 172 + nxcomp/src/PutPackedImage.cpp | 604 ++ nxcomp/src/PutPackedImage.h | 218 + nxcomp/src/QueryFontReply.cpp | 154 + nxcomp/src/QueryFontReply.h | 136 + nxcomp/src/ReadBuffer.cpp | 639 ++ nxcomp/src/ReadBuffer.h | 128 + nxcomp/src/RenderAddGlyphs.cpp | 233 + nxcomp/src/RenderAddGlyphs.h | 88 + nxcomp/src/RenderChangePicture.cpp | 238 + nxcomp/src/RenderChangePicture.h | 88 + nxcomp/src/RenderComposite.cpp | 400 + nxcomp/src/RenderComposite.h | 88 + nxcomp/src/RenderCompositeGlyphs.cpp | 629 ++ nxcomp/src/RenderCompositeGlyphs.h | 100 + nxcomp/src/RenderCreateGlyphSet.cpp | 185 + nxcomp/src/RenderCreateGlyphSet.h | 88 + nxcomp/src/RenderCreatePicture.cpp | 278 + nxcomp/src/RenderCreatePicture.h | 88 + nxcomp/src/RenderExtension.cpp | 427 + nxcomp/src/RenderExtension.h | 504 + nxcomp/src/RenderFillRectangles.cpp | 237 + nxcomp/src/RenderFillRectangles.h | 88 + nxcomp/src/RenderFreeGlyphSet.cpp | 166 + nxcomp/src/RenderFreeGlyphSet.h | 88 + nxcomp/src/RenderFreePicture.cpp | 166 + nxcomp/src/RenderFreePicture.h | 88 + nxcomp/src/RenderGenericRequest.cpp | 270 + nxcomp/src/RenderGenericRequest.h | 89 + nxcomp/src/RenderMinorExtensionHeaders.h | 42 + nxcomp/src/RenderMinorExtensionMethods.h | 81 + nxcomp/src/RenderMinorExtensionTags.h | 194 + nxcomp/src/RenderPictureClip.cpp | 303 + nxcomp/src/RenderPictureClip.h | 88 + nxcomp/src/RenderPictureFilter.cpp | 278 + nxcomp/src/RenderPictureFilter.h | 88 + nxcomp/src/RenderPictureTransform.cpp | 214 + nxcomp/src/RenderPictureTransform.h | 88 + nxcomp/src/RenderTrapezoids.cpp | 372 + nxcomp/src/RenderTrapezoids.h | 88 + nxcomp/src/RenderTriangles.cpp | 362 + nxcomp/src/RenderTriangles.h | 88 + nxcomp/src/Rgb.cpp | 106 + nxcomp/src/Rgb.h | 36 + nxcomp/src/Rle.cpp | 106 + nxcomp/src/Rle.h | 36 + nxcomp/src/SendEvent.cpp | 304 + nxcomp/src/SendEvent.h | 195 + nxcomp/src/SequenceQueue.cpp | 174 + nxcomp/src/SequenceQueue.h | 91 + nxcomp/src/ServerCache.cpp | 195 + nxcomp/src/ServerCache.h | 303 + nxcomp/src/ServerChannel.cpp | 7946 ++++++++++++++ nxcomp/src/ServerChannel.h | 529 + nxcomp/src/ServerProxy.cpp | 621 ++ nxcomp/src/ServerProxy.h | 154 + nxcomp/src/ServerReadBuffer.cpp | 247 + nxcomp/src/ServerReadBuffer.h | 73 + nxcomp/src/ServerStore.cpp | 183 + nxcomp/src/ServerStore.h | 83 + nxcomp/src/SetClipRectangles.cpp | 154 + nxcomp/src/SetClipRectangles.h | 187 + nxcomp/src/SetUnpackAlpha.cpp | 266 + nxcomp/src/SetUnpackAlpha.h | 162 + nxcomp/src/SetUnpackColormap.cpp | 266 + nxcomp/src/SetUnpackColormap.h | 162 + nxcomp/src/SetUnpackGeometry.cpp | 305 + nxcomp/src/SetUnpackGeometry.h | 167 + nxcomp/src/ShapeExtension.cpp | 305 + nxcomp/src/ShapeExtension.h | 164 + nxcomp/src/Socket.cpp | 757 ++ nxcomp/src/Socket.h | 96 + nxcomp/src/Split.cpp | 1839 ++++ nxcomp/src/Split.h | 543 + nxcomp/src/StaticCompressor.cpp | 432 + nxcomp/src/StaticCompressor.h | 80 + nxcomp/src/Statistics.cpp | 2007 ++++ nxcomp/src/Statistics.h | 745 ++ nxcomp/src/Timestamp.cpp | 77 + nxcomp/src/Timestamp.h | 307 + nxcomp/src/TranslateCoords.cpp | 115 + nxcomp/src/TranslateCoords.h | 185 + nxcomp/src/Transport.cpp | 3068 ++++++ nxcomp/src/Transport.h | 577 + nxcomp/src/Types.h | 271 + nxcomp/src/Unpack.cpp | 1514 +++ nxcomp/src/Unpack.h | 149 + nxcomp/src/Vars.c | 54 + nxcomp/src/Version.c | 101 + nxcomp/src/WriteBuffer.cpp | 500 + nxcomp/src/WriteBuffer.h | 134 + nxcomp/src/XidCache.cpp | 51 + nxcomp/src/XidCache.h | 49 + nxcomp/src/Z.cpp | 146 + nxcomp/src/Z.h | 37 + nxproxy/src/Makefile.am | 4 +- 478 files changed, 105105 insertions(+), 105414 deletions(-) delete mode 100644 nxcomp/ActionCache.cpp delete mode 100644 nxcomp/ActionCache.h delete mode 100644 nxcomp/Agent.cpp delete mode 100644 nxcomp/Agent.h delete mode 100644 nxcomp/Alpha.cpp delete mode 100644 nxcomp/Alpha.h delete mode 100644 nxcomp/Auth.cpp delete mode 100644 nxcomp/Auth.h delete mode 100644 nxcomp/Bitmap.cpp delete mode 100644 nxcomp/Bitmap.h delete mode 100644 nxcomp/BlockCache.cpp delete mode 100644 nxcomp/BlockCache.h delete mode 100644 nxcomp/BlockCacheSet.cpp delete mode 100644 nxcomp/BlockCacheSet.h delete mode 100644 nxcomp/ChangeGC.cpp delete mode 100644 nxcomp/ChangeGC.h delete mode 100644 nxcomp/ChangeProperty.cpp delete mode 100644 nxcomp/ChangeProperty.h delete mode 100644 nxcomp/Channel.cpp delete mode 100644 nxcomp/Channel.h delete mode 100644 nxcomp/ChannelCache.cpp delete mode 100644 nxcomp/ChannelCache.h delete mode 100644 nxcomp/ChannelEndPoint.cpp delete mode 100644 nxcomp/ChannelEndPoint.h delete mode 100644 nxcomp/ChannelStore.h delete mode 100644 nxcomp/CharCache.cpp delete mode 100644 nxcomp/CharCache.h delete mode 100644 nxcomp/Children.cpp delete mode 100644 nxcomp/ClearArea.cpp delete mode 100644 nxcomp/ClearArea.h delete mode 100644 nxcomp/ClientCache.cpp delete mode 100644 nxcomp/ClientCache.h delete mode 100644 nxcomp/ClientChannel.cpp delete mode 100644 nxcomp/ClientChannel.h delete mode 100644 nxcomp/ClientProxy.cpp delete mode 100644 nxcomp/ClientProxy.h delete mode 100644 nxcomp/ClientReadBuffer.cpp delete mode 100644 nxcomp/ClientReadBuffer.h delete mode 100644 nxcomp/ClientStore.cpp delete mode 100644 nxcomp/ClientStore.h delete mode 100644 nxcomp/Colormap.cpp delete mode 100644 nxcomp/Colormap.h delete mode 100644 nxcomp/ConfigureWindow.cpp delete mode 100644 nxcomp/ConfigureWindow.h delete mode 100644 nxcomp/Control.cpp delete mode 100644 nxcomp/Control.h delete mode 100644 nxcomp/CopyArea.cpp delete mode 100644 nxcomp/CopyArea.h delete mode 100644 nxcomp/CreateGC.cpp delete mode 100644 nxcomp/CreateGC.h delete mode 100644 nxcomp/CreatePixmap.cpp delete mode 100644 nxcomp/CreatePixmap.h delete mode 100644 nxcomp/DecodeBuffer.cpp delete mode 100644 nxcomp/DecodeBuffer.h delete mode 100644 nxcomp/EncodeBuffer.cpp delete mode 100644 nxcomp/EncodeBuffer.h delete mode 100644 nxcomp/FillPoly.cpp delete mode 100644 nxcomp/FillPoly.h delete mode 100644 nxcomp/Fork.cpp delete mode 100644 nxcomp/Fork.h delete mode 100644 nxcomp/FreeCache.h delete mode 100644 nxcomp/GenericChannel.cpp delete mode 100644 nxcomp/GenericChannel.h delete mode 100644 nxcomp/GenericReadBuffer.cpp delete mode 100644 nxcomp/GenericReadBuffer.h delete mode 100644 nxcomp/GenericReply.cpp delete mode 100644 nxcomp/GenericReply.h delete mode 100644 nxcomp/GenericRequest.cpp delete mode 100644 nxcomp/GenericRequest.h delete mode 100644 nxcomp/GetImage.cpp delete mode 100644 nxcomp/GetImage.h delete mode 100644 nxcomp/GetImageReply.cpp delete mode 100644 nxcomp/GetImageReply.h delete mode 100644 nxcomp/GetProperty.cpp delete mode 100644 nxcomp/GetProperty.h delete mode 100644 nxcomp/GetPropertyReply.cpp delete mode 100644 nxcomp/GetPropertyReply.h delete mode 100644 nxcomp/ImageText16.cpp delete mode 100644 nxcomp/ImageText16.h delete mode 100644 nxcomp/ImageText8.cpp delete mode 100644 nxcomp/ImageText8.h delete mode 100644 nxcomp/IntCache.cpp delete mode 100644 nxcomp/IntCache.h delete mode 100644 nxcomp/InternAtom.cpp delete mode 100644 nxcomp/InternAtom.h delete mode 100644 nxcomp/Jpeg.cpp delete mode 100644 nxcomp/Jpeg.h delete mode 100644 nxcomp/Keeper.cpp delete mode 100644 nxcomp/Keeper.h delete mode 100644 nxcomp/List.cpp delete mode 100644 nxcomp/List.h delete mode 100644 nxcomp/ListFontsReply.cpp delete mode 100644 nxcomp/ListFontsReply.h delete mode 100644 nxcomp/Loop.cpp delete mode 100644 nxcomp/MD5.c delete mode 100644 nxcomp/MD5.h create mode 100644 nxcomp/Makefile.am delete mode 100644 nxcomp/Makefile.in delete mode 100644 nxcomp/Message.cpp delete mode 100644 nxcomp/Message.h delete mode 100644 nxcomp/Misc.cpp delete mode 100644 nxcomp/Misc.h delete mode 100644 nxcomp/NX.h delete mode 100644 nxcomp/NXalert.h delete mode 100644 nxcomp/NXmitshm.h delete mode 100644 nxcomp/NXpack.h delete mode 100644 nxcomp/NXproto.h delete mode 100644 nxcomp/NXrender.h delete mode 100644 nxcomp/NXvars.h delete mode 100644 nxcomp/OpcodeCache.h delete mode 100644 nxcomp/OpcodeStore.cpp delete mode 100644 nxcomp/OpcodeStore.h delete mode 100644 nxcomp/Pack.c delete mode 100644 nxcomp/Pgn.cpp delete mode 100644 nxcomp/Pgn.h delete mode 100644 nxcomp/Pipe.cpp delete mode 100644 nxcomp/Pipe.h delete mode 100644 nxcomp/PolyArc.cpp delete mode 100644 nxcomp/PolyArc.h delete mode 100644 nxcomp/PolyFillArc.cpp delete mode 100644 nxcomp/PolyFillArc.h delete mode 100644 nxcomp/PolyFillRectangle.cpp delete mode 100644 nxcomp/PolyFillRectangle.h delete mode 100644 nxcomp/PolyLine.cpp delete mode 100644 nxcomp/PolyLine.h delete mode 100644 nxcomp/PolyPoint.cpp delete mode 100644 nxcomp/PolyPoint.h delete mode 100644 nxcomp/PolySegment.cpp delete mode 100644 nxcomp/PolySegment.h delete mode 100644 nxcomp/PolyText16.cpp delete mode 100644 nxcomp/PolyText16.h delete mode 100644 nxcomp/PolyText8.cpp delete mode 100644 nxcomp/PolyText8.h delete mode 100644 nxcomp/Proxy.cpp delete mode 100644 nxcomp/Proxy.h delete mode 100644 nxcomp/ProxyReadBuffer.cpp delete mode 100644 nxcomp/ProxyReadBuffer.h delete mode 100644 nxcomp/PutImage.cpp delete mode 100644 nxcomp/PutImage.h delete mode 100644 nxcomp/PutPackedImage.cpp delete mode 100644 nxcomp/PutPackedImage.h delete mode 100644 nxcomp/QueryFontReply.cpp delete mode 100644 nxcomp/QueryFontReply.h delete mode 100644 nxcomp/ReadBuffer.cpp delete mode 100644 nxcomp/ReadBuffer.h delete mode 100644 nxcomp/RenderAddGlyphs.cpp delete mode 100644 nxcomp/RenderAddGlyphs.h delete mode 100644 nxcomp/RenderChangePicture.cpp delete mode 100644 nxcomp/RenderChangePicture.h delete mode 100644 nxcomp/RenderComposite.cpp delete mode 100644 nxcomp/RenderComposite.h delete mode 100644 nxcomp/RenderCompositeGlyphs.cpp delete mode 100644 nxcomp/RenderCompositeGlyphs.h delete mode 100644 nxcomp/RenderCreateGlyphSet.cpp delete mode 100644 nxcomp/RenderCreateGlyphSet.h delete mode 100644 nxcomp/RenderCreatePicture.cpp delete mode 100644 nxcomp/RenderCreatePicture.h delete mode 100644 nxcomp/RenderExtension.cpp delete mode 100644 nxcomp/RenderExtension.h delete mode 100644 nxcomp/RenderFillRectangles.cpp delete mode 100644 nxcomp/RenderFillRectangles.h delete mode 100644 nxcomp/RenderFreeGlyphSet.cpp delete mode 100644 nxcomp/RenderFreeGlyphSet.h delete mode 100644 nxcomp/RenderFreePicture.cpp delete mode 100644 nxcomp/RenderFreePicture.h delete mode 100644 nxcomp/RenderGenericRequest.cpp delete mode 100644 nxcomp/RenderGenericRequest.h delete mode 100644 nxcomp/RenderMinorExtensionHeaders.h delete mode 100644 nxcomp/RenderMinorExtensionMethods.h delete mode 100644 nxcomp/RenderMinorExtensionTags.h delete mode 100644 nxcomp/RenderPictureClip.cpp delete mode 100644 nxcomp/RenderPictureClip.h delete mode 100644 nxcomp/RenderPictureFilter.cpp delete mode 100644 nxcomp/RenderPictureFilter.h delete mode 100644 nxcomp/RenderPictureTransform.cpp delete mode 100644 nxcomp/RenderPictureTransform.h delete mode 100644 nxcomp/RenderTrapezoids.cpp delete mode 100644 nxcomp/RenderTrapezoids.h delete mode 100644 nxcomp/RenderTriangles.cpp delete mode 100644 nxcomp/RenderTriangles.h delete mode 100644 nxcomp/Rgb.cpp delete mode 100644 nxcomp/Rgb.h delete mode 100644 nxcomp/Rle.cpp delete mode 100644 nxcomp/Rle.h delete mode 100644 nxcomp/SendEvent.cpp delete mode 100644 nxcomp/SendEvent.h delete mode 100644 nxcomp/SequenceQueue.cpp delete mode 100644 nxcomp/SequenceQueue.h delete mode 100644 nxcomp/ServerCache.cpp delete mode 100644 nxcomp/ServerCache.h delete mode 100644 nxcomp/ServerChannel.cpp delete mode 100644 nxcomp/ServerChannel.h delete mode 100644 nxcomp/ServerProxy.cpp delete mode 100644 nxcomp/ServerProxy.h delete mode 100644 nxcomp/ServerReadBuffer.cpp delete mode 100644 nxcomp/ServerReadBuffer.h delete mode 100644 nxcomp/ServerStore.cpp delete mode 100644 nxcomp/ServerStore.h delete mode 100644 nxcomp/SetClipRectangles.cpp delete mode 100644 nxcomp/SetClipRectangles.h delete mode 100644 nxcomp/SetUnpackAlpha.cpp delete mode 100644 nxcomp/SetUnpackAlpha.h delete mode 100644 nxcomp/SetUnpackColormap.cpp delete mode 100644 nxcomp/SetUnpackColormap.h delete mode 100644 nxcomp/SetUnpackGeometry.cpp delete mode 100644 nxcomp/SetUnpackGeometry.h delete mode 100644 nxcomp/ShapeExtension.cpp delete mode 100644 nxcomp/ShapeExtension.h delete mode 100644 nxcomp/Socket.cpp delete mode 100644 nxcomp/Socket.h delete mode 100644 nxcomp/Split.cpp delete mode 100644 nxcomp/Split.h delete mode 100644 nxcomp/StaticCompressor.cpp delete mode 100644 nxcomp/StaticCompressor.h delete mode 100644 nxcomp/Statistics.cpp delete mode 100644 nxcomp/Statistics.h delete mode 100644 nxcomp/Timestamp.cpp delete mode 100644 nxcomp/Timestamp.h delete mode 100644 nxcomp/TranslateCoords.cpp delete mode 100644 nxcomp/TranslateCoords.h delete mode 100644 nxcomp/Transport.cpp delete mode 100644 nxcomp/Transport.h delete mode 100644 nxcomp/Types.h delete mode 100644 nxcomp/Unpack.cpp delete mode 100644 nxcomp/Unpack.h delete mode 100644 nxcomp/Vars.c delete mode 100644 nxcomp/Version.c delete mode 100644 nxcomp/WriteBuffer.cpp delete mode 100644 nxcomp/WriteBuffer.h delete mode 100644 nxcomp/XidCache.cpp delete mode 100644 nxcomp/XidCache.h delete mode 100644 nxcomp/Z.cpp delete mode 100644 nxcomp/Z.h create mode 100644 nxcomp/configure.ac delete mode 100644 nxcomp/configure.in create mode 100644 nxcomp/include/MD5.h create mode 100644 nxcomp/include/NX.h create mode 100644 nxcomp/include/NXalert.h create mode 100644 nxcomp/include/NXpack.h create mode 100644 nxcomp/include/NXproto.h create mode 100644 nxcomp/include/NXvars.h delete mode 100755 nxcomp/install-sh create mode 120000 nxcomp/m4/nx-macros.m4 delete mode 100755 nxcomp/mkinstalldirs create mode 100644 nxcomp/src/ActionCache.cpp create mode 100644 nxcomp/src/ActionCache.h create mode 100644 nxcomp/src/Agent.cpp create mode 100644 nxcomp/src/Agent.h create mode 100644 nxcomp/src/Alpha.cpp create mode 100644 nxcomp/src/Alpha.h create mode 100644 nxcomp/src/Auth.cpp create mode 100644 nxcomp/src/Auth.h create mode 100644 nxcomp/src/Bitmap.cpp create mode 100644 nxcomp/src/Bitmap.h create mode 100644 nxcomp/src/BlockCache.cpp create mode 100644 nxcomp/src/BlockCache.h create mode 100644 nxcomp/src/BlockCacheSet.cpp create mode 100644 nxcomp/src/BlockCacheSet.h create mode 100644 nxcomp/src/ChangeGC.cpp create mode 100644 nxcomp/src/ChangeGC.h create mode 100644 nxcomp/src/ChangeProperty.cpp create mode 100644 nxcomp/src/ChangeProperty.h create mode 100644 nxcomp/src/Channel.cpp create mode 100644 nxcomp/src/Channel.h create mode 100644 nxcomp/src/ChannelCache.cpp create mode 100644 nxcomp/src/ChannelCache.h create mode 100644 nxcomp/src/ChannelEndPoint.cpp create mode 100644 nxcomp/src/ChannelEndPoint.h create mode 100644 nxcomp/src/ChannelStore.h create mode 100644 nxcomp/src/CharCache.cpp create mode 100644 nxcomp/src/CharCache.h create mode 100644 nxcomp/src/Children.cpp create mode 100644 nxcomp/src/ClearArea.cpp create mode 100644 nxcomp/src/ClearArea.h create mode 100644 nxcomp/src/ClientCache.cpp create mode 100644 nxcomp/src/ClientCache.h create mode 100644 nxcomp/src/ClientChannel.cpp create mode 100644 nxcomp/src/ClientChannel.h create mode 100644 nxcomp/src/ClientProxy.cpp create mode 100644 nxcomp/src/ClientProxy.h create mode 100644 nxcomp/src/ClientReadBuffer.cpp create mode 100644 nxcomp/src/ClientReadBuffer.h create mode 100644 nxcomp/src/ClientStore.cpp create mode 100644 nxcomp/src/ClientStore.h create mode 100644 nxcomp/src/Colormap.cpp create mode 100644 nxcomp/src/Colormap.h create mode 100644 nxcomp/src/ConfigureWindow.cpp create mode 100644 nxcomp/src/ConfigureWindow.h create mode 100644 nxcomp/src/Control.cpp create mode 100644 nxcomp/src/Control.h create mode 100644 nxcomp/src/CopyArea.cpp create mode 100644 nxcomp/src/CopyArea.h create mode 100644 nxcomp/src/CreateGC.cpp create mode 100644 nxcomp/src/CreateGC.h create mode 100644 nxcomp/src/CreatePixmap.cpp create mode 100644 nxcomp/src/CreatePixmap.h create mode 100644 nxcomp/src/DecodeBuffer.cpp create mode 100644 nxcomp/src/DecodeBuffer.h create mode 100644 nxcomp/src/EncodeBuffer.cpp create mode 100644 nxcomp/src/EncodeBuffer.h create mode 100644 nxcomp/src/FillPoly.cpp create mode 100644 nxcomp/src/FillPoly.h create mode 100644 nxcomp/src/Fork.cpp create mode 100644 nxcomp/src/Fork.h create mode 100644 nxcomp/src/FreeCache.h create mode 100644 nxcomp/src/GenericChannel.cpp create mode 100644 nxcomp/src/GenericChannel.h create mode 100644 nxcomp/src/GenericReadBuffer.cpp create mode 100644 nxcomp/src/GenericReadBuffer.h create mode 100644 nxcomp/src/GenericReply.cpp create mode 100644 nxcomp/src/GenericReply.h create mode 100644 nxcomp/src/GenericRequest.cpp create mode 100644 nxcomp/src/GenericRequest.h create mode 100644 nxcomp/src/GetImage.cpp create mode 100644 nxcomp/src/GetImage.h create mode 100644 nxcomp/src/GetImageReply.cpp create mode 100644 nxcomp/src/GetImageReply.h create mode 100644 nxcomp/src/GetProperty.cpp create mode 100644 nxcomp/src/GetProperty.h create mode 100644 nxcomp/src/GetPropertyReply.cpp create mode 100644 nxcomp/src/GetPropertyReply.h create mode 100644 nxcomp/src/ImageText16.cpp create mode 100644 nxcomp/src/ImageText16.h create mode 100644 nxcomp/src/ImageText8.cpp create mode 100644 nxcomp/src/ImageText8.h create mode 100644 nxcomp/src/IntCache.cpp create mode 100644 nxcomp/src/IntCache.h create mode 100644 nxcomp/src/InternAtom.cpp create mode 100644 nxcomp/src/InternAtom.h create mode 100644 nxcomp/src/Jpeg.cpp create mode 100644 nxcomp/src/Jpeg.h create mode 100644 nxcomp/src/Keeper.cpp create mode 100644 nxcomp/src/Keeper.h create mode 100644 nxcomp/src/List.cpp create mode 100644 nxcomp/src/List.h create mode 100644 nxcomp/src/ListFontsReply.cpp create mode 100644 nxcomp/src/ListFontsReply.h create mode 100644 nxcomp/src/Loop.cpp create mode 100644 nxcomp/src/MD5.c create mode 100644 nxcomp/src/Makefile.am create mode 100644 nxcomp/src/Message.cpp create mode 100644 nxcomp/src/Message.h create mode 100644 nxcomp/src/Misc.cpp create mode 100644 nxcomp/src/Misc.h create mode 100644 nxcomp/src/NXmitshm.h create mode 100644 nxcomp/src/NXrender.h create mode 100644 nxcomp/src/OpcodeCache.h create mode 100644 nxcomp/src/OpcodeStore.cpp create mode 100644 nxcomp/src/OpcodeStore.h create mode 100644 nxcomp/src/Pack.c create mode 100644 nxcomp/src/Pgn.cpp create mode 100644 nxcomp/src/Pgn.h create mode 100644 nxcomp/src/Pipe.cpp create mode 100644 nxcomp/src/Pipe.h create mode 100644 nxcomp/src/PolyArc.cpp create mode 100644 nxcomp/src/PolyArc.h create mode 100644 nxcomp/src/PolyFillArc.cpp create mode 100644 nxcomp/src/PolyFillArc.h create mode 100644 nxcomp/src/PolyFillRectangle.cpp create mode 100644 nxcomp/src/PolyFillRectangle.h create mode 100644 nxcomp/src/PolyLine.cpp create mode 100644 nxcomp/src/PolyLine.h create mode 100644 nxcomp/src/PolyPoint.cpp create mode 100644 nxcomp/src/PolyPoint.h create mode 100644 nxcomp/src/PolySegment.cpp create mode 100644 nxcomp/src/PolySegment.h create mode 100644 nxcomp/src/PolyText16.cpp create mode 100644 nxcomp/src/PolyText16.h create mode 100644 nxcomp/src/PolyText8.cpp create mode 100644 nxcomp/src/PolyText8.h create mode 100644 nxcomp/src/Proxy.cpp create mode 100644 nxcomp/src/Proxy.h create mode 100644 nxcomp/src/ProxyReadBuffer.cpp create mode 100644 nxcomp/src/ProxyReadBuffer.h create mode 100644 nxcomp/src/PutImage.cpp create mode 100644 nxcomp/src/PutImage.h create mode 100644 nxcomp/src/PutPackedImage.cpp create mode 100644 nxcomp/src/PutPackedImage.h create mode 100644 nxcomp/src/QueryFontReply.cpp create mode 100644 nxcomp/src/QueryFontReply.h create mode 100644 nxcomp/src/ReadBuffer.cpp create mode 100644 nxcomp/src/ReadBuffer.h create mode 100644 nxcomp/src/RenderAddGlyphs.cpp create mode 100644 nxcomp/src/RenderAddGlyphs.h create mode 100644 nxcomp/src/RenderChangePicture.cpp create mode 100644 nxcomp/src/RenderChangePicture.h create mode 100644 nxcomp/src/RenderComposite.cpp create mode 100644 nxcomp/src/RenderComposite.h create mode 100644 nxcomp/src/RenderCompositeGlyphs.cpp create mode 100644 nxcomp/src/RenderCompositeGlyphs.h create mode 100644 nxcomp/src/RenderCreateGlyphSet.cpp create mode 100644 nxcomp/src/RenderCreateGlyphSet.h create mode 100644 nxcomp/src/RenderCreatePicture.cpp create mode 100644 nxcomp/src/RenderCreatePicture.h create mode 100644 nxcomp/src/RenderExtension.cpp create mode 100644 nxcomp/src/RenderExtension.h create mode 100644 nxcomp/src/RenderFillRectangles.cpp create mode 100644 nxcomp/src/RenderFillRectangles.h create mode 100644 nxcomp/src/RenderFreeGlyphSet.cpp create mode 100644 nxcomp/src/RenderFreeGlyphSet.h create mode 100644 nxcomp/src/RenderFreePicture.cpp create mode 100644 nxcomp/src/RenderFreePicture.h create mode 100644 nxcomp/src/RenderGenericRequest.cpp create mode 100644 nxcomp/src/RenderGenericRequest.h create mode 100644 nxcomp/src/RenderMinorExtensionHeaders.h create mode 100644 nxcomp/src/RenderMinorExtensionMethods.h create mode 100644 nxcomp/src/RenderMinorExtensionTags.h create mode 100644 nxcomp/src/RenderPictureClip.cpp create mode 100644 nxcomp/src/RenderPictureClip.h create mode 100644 nxcomp/src/RenderPictureFilter.cpp create mode 100644 nxcomp/src/RenderPictureFilter.h create mode 100644 nxcomp/src/RenderPictureTransform.cpp create mode 100644 nxcomp/src/RenderPictureTransform.h create mode 100644 nxcomp/src/RenderTrapezoids.cpp create mode 100644 nxcomp/src/RenderTrapezoids.h create mode 100644 nxcomp/src/RenderTriangles.cpp create mode 100644 nxcomp/src/RenderTriangles.h create mode 100644 nxcomp/src/Rgb.cpp create mode 100644 nxcomp/src/Rgb.h create mode 100644 nxcomp/src/Rle.cpp create mode 100644 nxcomp/src/Rle.h create mode 100644 nxcomp/src/SendEvent.cpp create mode 100644 nxcomp/src/SendEvent.h create mode 100644 nxcomp/src/SequenceQueue.cpp create mode 100644 nxcomp/src/SequenceQueue.h create mode 100644 nxcomp/src/ServerCache.cpp create mode 100644 nxcomp/src/ServerCache.h create mode 100644 nxcomp/src/ServerChannel.cpp create mode 100644 nxcomp/src/ServerChannel.h create mode 100644 nxcomp/src/ServerProxy.cpp create mode 100644 nxcomp/src/ServerProxy.h create mode 100644 nxcomp/src/ServerReadBuffer.cpp create mode 100644 nxcomp/src/ServerReadBuffer.h create mode 100644 nxcomp/src/ServerStore.cpp create mode 100644 nxcomp/src/ServerStore.h create mode 100644 nxcomp/src/SetClipRectangles.cpp create mode 100644 nxcomp/src/SetClipRectangles.h create mode 100644 nxcomp/src/SetUnpackAlpha.cpp create mode 100644 nxcomp/src/SetUnpackAlpha.h create mode 100644 nxcomp/src/SetUnpackColormap.cpp create mode 100644 nxcomp/src/SetUnpackColormap.h create mode 100644 nxcomp/src/SetUnpackGeometry.cpp create mode 100644 nxcomp/src/SetUnpackGeometry.h create mode 100644 nxcomp/src/ShapeExtension.cpp create mode 100644 nxcomp/src/ShapeExtension.h create mode 100644 nxcomp/src/Socket.cpp create mode 100644 nxcomp/src/Socket.h create mode 100644 nxcomp/src/Split.cpp create mode 100644 nxcomp/src/Split.h create mode 100644 nxcomp/src/StaticCompressor.cpp create mode 100644 nxcomp/src/StaticCompressor.h create mode 100644 nxcomp/src/Statistics.cpp create mode 100644 nxcomp/src/Statistics.h create mode 100644 nxcomp/src/Timestamp.cpp create mode 100644 nxcomp/src/Timestamp.h create mode 100644 nxcomp/src/TranslateCoords.cpp create mode 100644 nxcomp/src/TranslateCoords.h create mode 100644 nxcomp/src/Transport.cpp create mode 100644 nxcomp/src/Transport.h create mode 100644 nxcomp/src/Types.h create mode 100644 nxcomp/src/Unpack.cpp create mode 100644 nxcomp/src/Unpack.h create mode 100644 nxcomp/src/Vars.c create mode 100644 nxcomp/src/Version.c create mode 100644 nxcomp/src/WriteBuffer.cpp create mode 100644 nxcomp/src/WriteBuffer.h create mode 100644 nxcomp/src/XidCache.cpp create mode 100644 nxcomp/src/XidCache.h create mode 100644 nxcomp/src/Z.cpp create mode 100644 nxcomp/src/Z.h (limited to 'Makefile') diff --git a/Makefile b/Makefile index d38015a00..2b4e5dfbd 100644 --- a/Makefile +++ b/Makefile @@ -54,14 +54,7 @@ all: test: echo "No testing for NX (redistributed)" -build-lite: - cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} - cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} - -build-full: -# in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... - cd nxcomp && autoconf && (${CONFIGURE}) && ${MAKE} - +build-env: # prepare nx-X11/config/cf/nxversion.def sed \ -e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \ @@ -74,6 +67,13 @@ build-full: # prepare Makefiles and the nx-X11 symlinking magic cd nx-X11 && make BuildEnv FONT_DEFINES=$(FONT_DEFINES) +build-lite: + cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + +build-full: build-env +# in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... + cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} # build libNX_X11 and libNX_Xext prior to building # nxcomp{ext,shad}. cd nx-X11/lib && make diff --git a/debian/libxcomp-dev.install b/debian/libxcomp-dev.install index e27e6ecf0..f73422f40 100644 --- a/debian/libxcomp-dev.install +++ b/debian/libxcomp-dev.install @@ -1,4 +1,5 @@ usr/lib/*/libXcomp.so +usr/lib/*/libXcomp.a usr/include/*/nx/NX.h usr/include/*/nx/NXalert.h usr/include/*/nx/NXpack.h diff --git a/debian/rules b/debian/rules index b59ba83a5..13490a86c 100755 --- a/debian/rules +++ b/debian/rules @@ -24,7 +24,7 @@ override_dh_clean: override_dh_install: # remove static libs - rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcomp.a + rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcomp.la rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.la # remove extras, GL, and other unneeded headers diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile index 5b289fae8..a6471bff1 100644 --- a/nx-X11/lib/X11/Imakefile +++ b/nx-X11/lib/X11/Imakefile @@ -36,9 +36,9 @@ BuildIncludes($(HEADERS),IncSubdir,..) #if NXLibraries #ifdef SunArchitecture -NX_INCLUDES = -I../../../nxcomp -I/usr/sfw/include +NX_INCLUDES = -I../../../nxcomp/include -I/usr/sfw/include #else -NX_INCLUDES = -I../../../nxcomp +NX_INCLUDES = -I../../../nxcomp/include #endif NX_DEFINES = -DNX_TRANS_SOCKET \ @@ -81,7 +81,7 @@ NX_XCOMPLIBNAME = libXcomp.so NX_XCOMPEXTLIBNAME = libXcompext.so #endif -NX_XCOMPLIBDIR = $(XTOP)/../nxcomp +NX_XCOMPLIBDIR = $(XTOP)/../nxcomp/src/.libs NX_XCOMPLIBLINK = Xcomp NX_XCOMPLIBTARGET = $(NX_XCOMPLIBDIR)/$(NX_XCOMPLIBNAME) NX_REQUIREDLIBS = -L$(NX_XCOMPLIBDIR) -l$(NX_XCOMPLIBLINK) diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index ed49313ee..3c7e68597 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -213,12 +213,12 @@ NXAGENTDDXDIR = hw NXAGENTDIRS = $(STDDIRS) $(FBDIR) $(MIDAMAGEDIR) $(NXAGENTDDXDIR) $(DEPDIRS) NX_XCOMP_HEADERS = \ - ../../../nxcomp/MD5.h \ - ../../../nxcomp/NXalert.h \ - ../../../nxcomp/NX.h \ - ../../../nxcomp/NXpack.h \ - ../../../nxcomp/NXproto.h \ - ../../../nxcomp/NXvars.h \ + ../../../nxcomp/include/MD5.h \ + ../../../nxcomp/include/NXalert.h \ + ../../../nxcomp/include/NX.h \ + ../../../nxcomp/include/NXpack.h \ + ../../../nxcomp/include/NXproto.h \ + ../../../nxcomp/include/NXvars.h \ $(NULL) NX_XCOMPSHAD_HEADERS = \ @@ -315,7 +315,7 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) #if defined(SunArchitecture) NXAGENTNXLIBS = -L/usr/sfw/lib \ - -L../../../nxcomp \ + -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -lrt \ -lXcomp \ @@ -330,7 +330,7 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \ -lXext \ $(NULL) #elif defined(cygwinArchitecture) -NXAGENTNXLIBS = -L../../../nxcomp \ +NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -lXcomp \ -lXcompshad \ @@ -343,7 +343,7 @@ NXAGENTNXLIBS = -L../../../nxcomp \ -lXext \ $(NULL) #elif defined(OpenBSDArchitecture) -NXAGENTNXLIBS = -L../../../nxcomp \ +NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nx-X11/exports/lib \ -L../../../nxcompshad/src/.libs \ -lkvm \ @@ -359,7 +359,7 @@ NXAGENTNXLIBS = -L../../../nxcomp \ -lXext \ $(NULL) #else -NXAGENTNXLIBS = -L../../../nxcomp \ +NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ -lXcomp \ -lXcompshad \ diff --git a/nxcomp/.gitignore b/nxcomp/.gitignore index 27a99e5b2..a148dfa93 100644 --- a/nxcomp/.gitignore +++ b/nxcomp/.gitignore @@ -1,2 +1,23 @@ -nxcomp.pc Makefile +Makefile.in +aclocal.m4 +compile +config.guess +config.sub +depcomp +install-sh +ltmain.sh +missing +config.h +config.h.in +libtool +m4/libtool.m4 +m4/ltoptions.m4 +m4/ltsugar.m4 +m4/ltversion.m4 +m4/lt~obsolete.m4 +nxcomp.pc +src/.deps/ +src/Makefile +src/Makefile.in +stamp-h1 diff --git a/nxcomp/ActionCache.cpp b/nxcomp/ActionCache.cpp deleted file mode 100644 index 8ad7f7ba2..000000000 --- a/nxcomp/ActionCache.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Control.h" - -#include "ActionCache.h" - -ActionCache::ActionCache() -{ - for (int i = 0; i < 256; i++) - { - base_[i] = new IntCache(8); - } - - slot_ = 0; - last_ = 0; -} - -ActionCache::~ActionCache() -{ - for (int i = 0; i < 256; i++) - { - delete base_[i]; - } -} diff --git a/nxcomp/ActionCache.h b/nxcomp/ActionCache.h deleted file mode 100644 index 2aedd4a07..000000000 --- a/nxcomp/ActionCache.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ActionCache_H -#define ActionCache_H - -#include "IntCache.h" - -class ActionCache -{ - friend class EncodeBuffer; - friend class DecodeBuffer; - - public: - - ActionCache(); - ~ActionCache(); - - private: - - IntCache *base_[256]; - - unsigned int slot_; - unsigned short last_; -}; - -#endif /* ActionCache_H */ diff --git a/nxcomp/Agent.cpp b/nxcomp/Agent.cpp deleted file mode 100644 index cd65101b3..000000000 --- a/nxcomp/Agent.cpp +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Agent.h" -#include "Proxy.h" - -extern Proxy *proxy; - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -Agent::Agent(int fd[2]) -{ - remoteFd_ = fd[0]; - localFd_ = fd[1]; - - transport_ = new AgentTransport(localFd_); - - if (transport_ == NULL) - { - #ifdef PANIC - *logofs << "Agent: PANIC! Can't create the memory-to-memory transport " - << "for FD#" << localFd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't create the memory-to-memory transport " - << "for FD#" << localFd_ << ".\n"; - - HandleCleanup(); - } - - FD_ZERO(&saveRead_); - FD_ZERO(&saveWrite_); - - canRead_ = 0; - - #ifdef DEBUG - *logofs << "Agent: Created agent object at " << this - << ".\n" << logofs_flush; - #endif -} - -Agent::~Agent() -{ - delete transport_; - - #ifdef DEBUG - *logofs << "Agent: Deleted agent object at " << this - << ".\n" << logofs_flush; - #endif -} diff --git a/nxcomp/Agent.h b/nxcomp/Agent.h deleted file mode 100644 index 3e1a50ae5..000000000 --- a/nxcomp/Agent.h +++ /dev/null @@ -1,263 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Agent_H -#define Agent_H - -#include - -#include -#include -#include - -#include "Misc.h" -#include "Transport.h" -#include "Proxy.h" - -extern Proxy *proxy; - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -class Agent -{ - public: - - // - // Must be created by passing the fake descriptor that - // will be used for simulating socket communication - // betwen the agent and the proxy. I/O will take place - // by copying data to the agent's read and write buf- - // fers. - // - - Agent(int fd[2]); - - ~Agent(); - - AgentTransport *getTransport() const - { - return transport_; - } - - void saveReadMask(fd_set *readSet) - { - saveRead_ = *readSet; - } - - void saveWriteMask(fd_set *writeSet) - { - saveWrite_ = *writeSet; - } - - void clearReadMask(fd_set *readSet) - { - FD_CLR(remoteFd_, readSet); - FD_CLR(localFd_, readSet); - } - - void clearWriteMask(fd_set *writeSet) - { - FD_CLR(remoteFd_, writeSet); - FD_CLR(localFd_, writeSet); - } - - void setLocalRead(fd_set *readSet, int *result) - { - (*result)++; - - FD_SET(localFd_, readSet); - } - - void setRemoteRead(fd_set *readSet, int *result) - { - (*result)++; - - FD_SET(remoteFd_, readSet); - } - - void setRemoteWrite(fd_set *writeSet, int *result) - { - (*result)++; - - FD_SET(remoteFd_, writeSet); - } - - fd_set *getSavedReadMask() - { - return &saveRead_; - } - - fd_set *getSavedWriteMask() - { - return &saveWrite_; - } - - int getRemoteFd() const - { - return remoteFd_; - } - - int getLocalFd() const - { - return localFd_; - } - - int getProxyFd() const - { - return proxy -> getFd(); - } - - int isValid() const - { - return (transport_ != NULL); - } - - int localReadable() - { - return (transport_ -> readable() != 0); - } - - // - // Check if we can process more data from - // the agent descriptor and cache the result - // to avoid multiple calls. This must be - // always called before querying the other - // functions. - // - - void saveChannelState() - { - canRead_ = (proxy != NULL ? proxy -> canRead(localFd_) : 0); - } - - int remoteCanRead(const fd_set * const readSet) - { - // OS X 10.5 requires the second argument to be non-const, so copy readSet. - // It's safe though, as FD_ISSET does not operate on it. - fd_set readWorkSet = *readSet; - - #if defined(TEST) || defined(INFO) - *logofs << "Agent: remoteCanRead() is " << - (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0) - << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet) - << " and dequeuable " << transport_ -> dequeuable() - << ".\n" << logofs_flush; - #endif - - return (FD_ISSET(remoteFd_, &readWorkSet) && - transport_ -> dequeuable() != 0); - } - - int remoteCanWrite(const fd_set * const writeSet) - { - // OS X 10.5 requires the second argument to be non-const, so copy writeSet. - // It's safe though, as FD_ISSET does not operate on it. - fd_set writeWorkSet = *writeSet; - - #if defined(TEST) || defined(INFO) - *logofs << "Agent: remoteCanWrite() is " << - (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ -> - queuable() != 0 && canRead_ == 1) << " with FD_ISSET() " - << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable " - << transport_ -> queuable() << " channel can read " - << canRead_ << ".\n" << logofs_flush; - #endif - - return (FD_ISSET(remoteFd_, &writeWorkSet) && - transport_ -> queuable() != 0 && - canRead_ == 1); - } - - int localCanRead() - { - #if defined(TEST) || defined(INFO) - *logofs << "Agent: localCanRead() is " << - (transport_ -> readable() != 0 && canRead_ == 1) - << " with readable " << transport_ -> readable() - << " channel can read " << canRead_ << ".\n" - << logofs_flush; - #endif - - return (transport_ -> readable() != 0 && - canRead_ == 1); - } - - int proxyCanRead() - { - #if defined(TEST) || defined(INFO) - *logofs << "Agent: proxyCanRead() is " << proxy -> canRead() - << ".\n" << logofs_flush; - #endif - - return (proxy -> canRead()); - } - - int proxyCanRead(const fd_set * const readSet) - { - // OS X 10.5 requires the second argument to be non-const, so copy readSet. - // It's safe though, as FD_ISSET does not operate on it. - fd_set readWorkSet = *readSet; - - #if defined(TEST) || defined(INFO) - *logofs << "Agent: proxyCanRead() is " - << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet)) - << ".\n" << logofs_flush; - #endif - - return (FD_ISSET(proxy -> getFd(), &readWorkSet)); - } - - int enqueueData(const char *data, const int size) const - { - return transport_ -> enqueue(data, size); - } - - int dequeueData(char *data, int size) const - { - return transport_ -> dequeue(data, size); - } - - int dequeuableData() const - { - return transport_ -> dequeuable(); - } - - private: - - int remoteFd_; - int localFd_; - - fd_set saveRead_; - fd_set saveWrite_; - - int canRead_; - - AgentTransport *transport_; -}; - -#endif /* Agent_H */ diff --git a/nxcomp/Alpha.cpp b/nxcomp/Alpha.cpp deleted file mode 100644 index 31a31f7cb..000000000 --- a/nxcomp/Alpha.cpp +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Unpack.h" -#include "Alpha.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -int UnpackAlpha(unsigned char method, unsigned char *src_data, int src_size, - unsigned char *dst_data, int dst_size) -{ - if (*src_data == 0) - { - if (dst_size != src_size - 1) - { - #ifdef TEST - *logofs << "UnpackAlpha: PANIC! Invalid destination size " - << dst_size << " with source " << src_size - << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "UnpackAlpha: Expanding " << src_size - 1 - << " bytes of plain alpha data.\n" << logofs_flush; - #endif - - memcpy(dst_data, src_data + 1, src_size - 1); - - return 1; - } - - unsigned int check_size = dst_size; - - int result = ZDecompress(&unpackStream, dst_data, &check_size, - src_data + 1, src_size - 1); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "UnpackAlpha: PANIC! Failure decompressing alpha data. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decompressing alpha data. " - << "Error is '" << zError(result) << "'.\n"; - - return -1; - } - else if (check_size != (unsigned int) dst_size) - { - #ifdef PANIC - *logofs << "UnpackAlpha: PANIC! Size mismatch in alpha data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Size mismatch in alpha data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n"; - - return -1; - } - - #ifdef TEST - *logofs << "UnpackAlpha: Decompressed " << src_size - 1 - << " bytes to " << dst_size << " bytes of alpha data.\n" - << logofs_flush; - #endif - - return 1; -} - -int UnpackAlpha(T_alpha *alpha, unsigned char *dst_data, - int dst_size, int big_endian) -{ - unsigned int count = dst_size >> 2; - - unsigned int i; - - int shift; - - if (count != alpha -> entries) - { - #ifdef WARNING - *logofs << "UnpackAlpha: WARNING! Not applying the alpha with " - << count << " elements needed and " << alpha -> entries - << " available.\n" << logofs_flush; - #endif - - return 0; - } - - shift = (big_endian == 1 ? 0 : 3); - - for (i = 0; i < count; i++) - { - *(dst_data + shift) = *(alpha -> data + i); - - dst_data += 4; - } - - return 1; -} diff --git a/nxcomp/Alpha.h b/nxcomp/Alpha.h deleted file mode 100644 index ea5068812..000000000 --- a/nxcomp/Alpha.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Alpha_H -#define Alpha_H - -int UnpackAlpha(unsigned char method, unsigned char *src_data, int src_size, - unsigned char *dst_data, int dst_size); - -int UnpackAlpha(T_alpha *alpha, unsigned char *dst_data, - int dst_size, int big_endian); - -#endif /* Aplha_H */ diff --git a/nxcomp/Auth.cpp b/nxcomp/Auth.cpp deleted file mode 100644 index bc047aa30..000000000 --- a/nxcomp/Auth.cpp +++ /dev/null @@ -1,667 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Auth.h" - -#include "Misc.h" -#include "Control.h" -#include "Timestamp.h" -#include "Pipe.h" - -#define DEFAULT_STRING_LIMIT 512 - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Store the provided cookie as our 'fake' cookie, then -// read the 'real' cookie from the current X authority -// file. -// - -Auth::Auth(char *display, char *cookie) -{ - display_ = NULL; - - file_ = NULL; - - last_ = nullTimestamp(); - - fakeCookie_ = NULL; - realCookie_ = NULL; - - fakeData_ = NULL; - realData_ = NULL; - - dataSize_ = 0; - - generatedCookie_ = 0; - - if (display == NULL || *display == '\0' || cookie == NULL || - *cookie == '\0' || strlen(cookie) != 32) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Can't create the X authorization data " - << "with cookie '" << cookie << "' and display '" - << display << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't create the X authorization data " - << "with cookie '" << cookie << "' and display '" - << display << "'.\n"; - - return; - } - - #ifdef TEST - *logofs << "Auth: Creating X authorization data with cookie '" - << cookie << "' and display '" << display << "'.\n" - << logofs_flush; - #endif - - // - // Get a local copy of all parameters. - // - - display_ = new char[strlen(display) + 1]; - file_ = new char[DEFAULT_STRING_LIMIT]; - - fakeCookie_ = new char[strlen(cookie) + 1]; - realCookie_ = new char[DEFAULT_STRING_LIMIT]; - - if (display_ == NULL || file_ == NULL || - fakeCookie_ == NULL || realCookie_ == NULL) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Cannot allocate memory for the X " - << "authorization data.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot allocate memory for the X " - << "authorization data.\n"; - - return; - } - - strcpy(display_, display); - - *file_ = '\0'; - - strcpy(fakeCookie_, cookie); - - *realCookie_ = '\0'; - - // - // Get the real cookie from the authorization file. - // - - updateCookie(); -} - -Auth::~Auth() -{ - delete [] display_; - delete [] file_; - - delete [] fakeCookie_; - delete [] realCookie_; - - delete [] fakeData_; - delete [] realData_; -} - -// -// At the present moment the cookie is read only once, -// at the time the instance is initialized. If the auth -// file changes along the life of the session, the old -// cookie will be used. This works with X servers beca- -// use of an undocumented "feature". See nx-X11. -// - -int Auth::updateCookie() -{ - if (isTimestamp(last_) == 0) - { - #ifdef TEST - *logofs << "Auth: Reading the X authorization file " - << "with last update at " << strMsTimestamp(last_) - << ".\n" << logofs_flush; - #endif - - if (getCookie() == 1 && validateCookie() == 1) - { - // - // It should rather be the modification time - // the auth file, so we can read it again if - // the file is changed. - // - - #ifdef TEST - *logofs << "Auth: Setting last X authorization file " - << "update at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - last_ = getTimestamp(); - - return 1; - } - - #ifdef PANIC - *logofs << "Auth: PANIC! Cannot read the cookie from the X " - << "authorization file.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot read the cookie from the X " - << "authorization file.\n"; - - return -1; - } - - #ifdef TEST - *logofs << "Auth: WARNING! Skipping check on the X " - << "authorization file.\n" << logofs_flush; - #endif - - return 0; -} - -int Auth::getCookie() -{ - // - // Check the name of the auth file that we are going to use. - // It can be either the value of the XAUTHORITY environment - // or the default .Xauthority file in the user's home. - // - - char *environment; - - environment = getenv("XAUTHORITY"); - - if (environment != NULL && *environment != '\0') - { - strncpy(file_, environment, DEFAULT_STRING_LIMIT - 1); - } - else - { - snprintf(file_, DEFAULT_STRING_LIMIT - 1, "%s/.Xauthority", - control -> HomePath); - } - - *(file_ + DEFAULT_STRING_LIMIT - 1) = '\0'; - - #ifdef TEST - *logofs << "Auth: Using X authorization file '" << file_ - << "'.\n" << logofs_flush; - #endif - - // - // Use the nxauth command on Windows and the Mac, xauth - // on all the other platforms. On Windows we assume that - // the nxauth command is located under bin in the client - // installation directory. On Mac OS X we assume that the - // command is located directly in the client installation - // directory, to make bundle shipping easier. On all the - // other platforms we use the default xauth command that - // is in our path. - // - - char command[DEFAULT_STRING_LIMIT]; - - #if defined(__CYGWIN32__) - - snprintf(command, DEFAULT_STRING_LIMIT - 1, - "%s/bin/nxauth", control -> SystemPath); - - *(command + DEFAULT_STRING_LIMIT - 1) = '\0'; - - #elif defined(__APPLE__) - - snprintf(command, DEFAULT_STRING_LIMIT - 1, - "%s/nxauth", control -> SystemPath); - - *(command + DEFAULT_STRING_LIMIT - 1) = '\0'; - - #else - - strcpy(command, "xauth"); - - #endif - - #ifdef TEST - *logofs << "Auth: Using X auth command '" << command - << "'.\n" << logofs_flush; - #endif - - // - // The SSH code forces using the unix:n port when passing localhost:n. - // This is probably because localhost:n can fail to return a valid - // entry on machines where the hostname for localhost doesn't match - // exactly the 'localhost' string. For example, on a freshly installed - // Fedora Core 3 I get a 'localhost.localdomain/unix:0' entry. Query- - // ing 'xauth list localhost:0' results in an empty result, while the - // query 'xauth list unix:0' works as expected. Note anyway that if - // the cookie for the TCP connection on 'localhost' is set to a dif- - // ferent cookie than the one for the Unix connections, both SSH and - // NX will match the wrong cookie and session will fail. - // - - char line[DEFAULT_STRING_LIMIT]; - - if (strncmp(display_, "localhost:", 10) == 0) - { - snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", display_ + 10); - } - else - { - snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_); - } - - const char *parameters[256]; - - parameters[0] = command; - parameters[1] = command; - parameters[2] = "-f"; - parameters[3] = file_; - parameters[4] = "list"; - parameters[5] = line; - parameters[6] = NULL; - - #ifdef TEST - *logofs << "Auth: Executing command "; - - for (int i = 0; i < 256 && parameters[i] != NULL; i++) - { - *logofs << "[" << parameters[i] << "]"; - } - - *logofs << ".\n" << logofs_flush; - #endif - - // - // Use the popen() function to read the result - // of the command. We would better use our own - // implementation. - // - - FILE *data = Popen((char *const *) parameters, "r"); - - int result = -1; - - if (data == NULL) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Failed to execute the X auth command.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to execute the X auth command.\n"; - - goto AuthGetCookieResult; - } - - if (fgets(line, DEFAULT_STRING_LIMIT, data) == NULL) - { - #ifdef WARNING - *logofs << "Auth: WARNING! Failed to read data from the X " - << "auth command.\n" << logofs_flush; - #endif - - #ifdef TEST - cerr << "Warning" << ": Failed to read data from the X " - << "auth command.\n"; - #endif - - #ifdef PANIC - *logofs << "Auth: WARNING! Generating a fake cookie for " - << "X authentication.\n" << logofs_flush; - #endif - - #ifdef TEST - cerr << "Warning" << ": Generating a fake cookie for " - << "X authentication.\n"; - #endif - - generateCookie(realCookie_); - } - else - { - #ifdef TEST - *logofs << "Auth: Checking cookie in string '" << line - << "'.\n" << logofs_flush; - #endif - - // - // Skip the hostname in the authority entry - // just in case it includes some white spaces. - // - - char *cookie = NULL; - - cookie = index(line, ':'); - - if (cookie == NULL) - { - cookie = line; - } - - if (sscanf(cookie, "%*s %*s %511s", realCookie_) != 1) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Failed to identify the cookie " - << "in string '" << line << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to identify the cookie " - << "in string '" << line << "'.\n"; - - goto AuthGetCookieResult; - } - - #ifdef TEST - *logofs << "Auth: Got cookie '" << realCookie_ - << "' from file '" << file_ << "'.\n" - << logofs_flush; - #endif - } - - result = 1; - -AuthGetCookieResult: - - if (data != NULL) - { - Pclose(data); - } - - return result; -} - -int Auth::validateCookie() -{ - unsigned int length = strlen(realCookie_); - - if (length > DEFAULT_STRING_LIMIT / 2 - 1 || - strlen(fakeCookie_) != length) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Size mismatch between cookies '" - << realCookie_ << "' and '" << fakeCookie_ << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Size mismatch between cookies '" - << realCookie_ << "' and '" << fakeCookie_ << "'.\n"; - - goto AuthValidateCookieError; - } - - // - // The length of the resulting data will be - // half the size of the Hex cookie. - // - - length = length / 2; - - fakeData_ = new char[length]; - realData_ = new char[length]; - - if (fakeData_ == NULL || realData_ == NULL) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Cannot allocate memory for the binary X " - << "authorization data.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot allocate memory for the binary X " - << "authorization data.\n"; - - goto AuthValidateCookieError; - } - - // - // Translate the real cookie from Hex data - // to its binary representation. - // - - unsigned int value; - - for (unsigned int i = 0; i < length; i++) - { - if (sscanf(realCookie_ + 2 * i, "%2x", &value) != 1) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Bad X authorization data in real " - << "cookie '" << realCookie_ << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Bad X authorization data in real cookie '" - << realCookie_ << "'.\n"; - - goto AuthValidateCookieError; - } - - realData_[i] = value; - - if (sscanf(fakeCookie_ + 2 * i, "%2x", &value) != 1) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Bad X authorization data in fake " - << "cookie '" << fakeCookie_ << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Bad X authorization data in fake cookie '" - << fakeCookie_ << "'.\n"; - - goto AuthValidateCookieError; - } - - fakeData_[i] = value; - } - - dataSize_ = length; - - #ifdef TEST - *logofs << "Auth: Validated real cookie '" - << realCookie_ << "' and fake cookie '" << fakeCookie_ - << "' with data with size " << dataSize_ << ".\n" - << logofs_flush; - - *logofs << "Auth: Ready to accept incoming connections.\n" - << logofs_flush; - #endif - - return 1; - -AuthValidateCookieError: - - delete [] fakeData_; - delete [] realData_; - - fakeData_ = NULL; - realData_ = NULL; - - dataSize_ = 0; - - return -1; -} - -int Auth::checkCookie(unsigned char *buffer) -{ - if (isValid() != 1) - { - #ifdef PANIC - *logofs << "Auth: PANIC! Attempt to check the X cookie with " - << "invalid authorization data.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Attempt to check the X cookie with " - << "invalid authorization data.\n"; - - return -1; - } - - const char *protoName = "MIT-MAGIC-COOKIE-1"; - int protoSize = strlen(protoName); - - int matchedProtoSize; - int matchedDataSize; - - if (buffer[0] == 0x42) - { - // - // Byte order is MSB first. - // - - matchedProtoSize = 256 * buffer[6] + buffer[7]; - matchedDataSize = 256 * buffer[8] + buffer[9]; - } - else if (buffer[0] == 0x6c) - { - // - // Byte order is LSB first. - // - - matchedProtoSize = buffer[6] + 256 * buffer[7]; - matchedDataSize = buffer[8] + 256 * buffer[9]; - } - else - { - #ifdef WARNING - *logofs << "Auth: WARNING! Bad X connection data in the buffer.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Bad X connection data in the buffer.\n"; - - return -1; - } - - // - // Check if both the authentication protocol - // and the fake cookie match our data. - // - - int protoOffset = 12; - - #ifdef TEST - *logofs << "Auth: Received a protocol size of " - << matchedProtoSize << " bytes.\n" - << logofs_flush; - #endif - - if (matchedProtoSize != protoSize || - memcmp(buffer + protoOffset, protoName, protoSize) != 0) - { - #ifdef WARNING - *logofs << "Auth: WARNING! Protocol mismatch or no X " - << "authentication data.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Protocol mismatch or no X " - << "authentication data.\n"; - - return -1; - } - - int dataOffset = protoOffset + ((matchedProtoSize + 3) & ~3); - - #ifdef TEST - *logofs << "Auth: Received a data size of " - << matchedDataSize << " bytes.\n" - << logofs_flush; - #endif - - if (matchedDataSize != dataSize_ || - memcmp(buffer + dataOffset, fakeData_, dataSize_) != 0) - { - #ifdef WARNING - *logofs << "Auth: WARNING! Cookie mismatch in the X " - << "authentication data.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Cookie mismatch in the X " - << "authentication data.\n"; - - return -1; - } - - // - // Everything is OK. Replace the fake data. - // - - #ifdef TEST - *logofs << "Auth: Replacing fake X authentication data " - << "with the real data.\n" << logofs_flush; - #endif - - memcpy(buffer + dataOffset, realData_, dataSize_); - - return 1; -} - -void Auth::generateCookie(char *cookie) -{ - // - // Code is from the SSH implementation, except that - // we use a much weaker random number generator. - // This is not critical, anyway, as this is just a - // fake cookie. The X server doesn't have a cookie - // for the display, so it will ignore the value we - // feed to it. - // - - T_timestamp timer = getTimestamp(); - - srand((unsigned int) timer.tv_usec); - - unsigned int data = rand(); - - for (int i = 0; i < 16; i++) - { - if (i % 4 == 0) - { - data = rand(); - } - - snprintf(cookie + 2 * i, 3, "%02x", data & 0xff); - - data >>= 8; - } - - generatedCookie_ = 1; - - #ifdef TEST - *logofs << "Auth: Generated X cookie string '" - << cookie << "'.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/Auth.h b/nxcomp/Auth.h deleted file mode 100644 index d51d9a26f..000000000 --- a/nxcomp/Auth.h +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Auth_H -#define Auth_H - -#include "Timestamp.h" - -// -// Handle the forwarding of authorization credentials -// to the X server by replacing the fake cookie with -// the real cookie as it is read from the auth file. -// At the moment only the MIT-MAGIC-COOKIE-1 cookies -// are recognized. The implementation is based on the -// corresponding code found in the SSH client. -// - -class Auth -{ - public: - - // - // Must be created by passing the fake cookie that - // will be forwarded by the remote end and with the - // real X display that is going to be used for the - // session. - // - - Auth(char *display, char *cookie); - - ~Auth(); - - int isValid() - { - return (isTimestamp(last_) == 1 && fakeCookie_ != NULL && - *fakeCookie_ != '\0' && realCookie_ != NULL && - *realCookie_ != '\0' && fakeData_ != NULL && - realData_ != NULL && dataSize_ != 0); - } - - int isFake() const - { - return generatedCookie_; - } - - // - // Method called in the channel class to find if the - // provided cookie matches the fake one. If the data - // matches, the fake cookie is replaced with the real - // one. - // - - int checkCookie(unsigned char *buffer); - - protected: - - // - // Update the real cookie for the display. If called - // a further time, check if the auth file is changed - // and get the new cookie. - // - - int updateCookie(); - - // - // Find out which authorization file is to be used - // and query the cookie for the current display. - // - - int getCookie(); - - // - // Extract the binary data from the cookies so that - // data can be directly compared at the time it is - // taken from the X request. - // - - int validateCookie(); - - // - // Generate a fake random cookie and copy it to the - // provided string. - // - - void generateCookie(char *cookie); - - private: - - char *display_; - char *file_; - - T_timestamp last_; - - char *fakeCookie_; - char *realCookie_; - - char *fakeData_; - char *realData_; - - int dataSize_; - - int generatedCookie_; -}; - -#endif /* Auth_H */ diff --git a/nxcomp/Bitmap.cpp b/nxcomp/Bitmap.cpp deleted file mode 100644 index fbc34a55e..000000000 --- a/nxcomp/Bitmap.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Bitmap.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -int UnpackBitmap(T_geometry *geometry, unsigned char method, unsigned char *src_data, - int src_size, int dst_bpp, int dst_width, int dst_height, - unsigned char *dst_data, int dst_size) -{ - if (dst_bpp != 32) - { - #ifdef TEST - *logofs << "UnpackBitmap: Nothing to do with " - << "image of " << dst_bpp << " bits per plane " - << "and size " << src_size << ".\n" - << logofs_flush; - #endif - - if (src_size != dst_size) - { - #ifdef PANIC - *logofs << "UnpackBitmap: PANIC! Size mismatch with " - << src_size << " bytes in the source and " - << dst_size << " in the destination.\n" - << logofs_flush; - #endif - - return -1; - } - - memcpy(dst_data, src_data, src_size); - - return 1; - } - else if (src_size != dst_width * dst_height * 3 || - dst_size != dst_width * dst_height * 4) - { - #ifdef PANIC - *logofs << "UnpackBitmap: PANIC! Size mismatch with " - << src_size << " bytes in the source and " - << dst_size << " in the destination.\n" - << logofs_flush; - #endif - - return -1; - } - - /* - * Insert the 4th byte in the bitmap. - */ - - unsigned char *next_src = src_data; - unsigned char *next_dst = dst_data; - - if (geometry -> image_byte_order == LSBFirst) - { - while (next_src < src_data + src_size) - { - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - - next_dst++; - } - } - else - { - while (next_src < src_data + src_size) - { - next_dst++; - - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - *next_dst++ = *next_src++; - } - } - - #ifdef TEST - *logofs << "UnpackBitmap: Unpacked " << src_size - << " bytes to a buffer of " << dst_size - << " with " << dst_bpp << " bits per plane.\n" - << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/Bitmap.h b/nxcomp/Bitmap.h deleted file mode 100644 index 8143e3125..000000000 --- a/nxcomp/Bitmap.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Bitmap_H -#define Bitmap_H - -#include "Unpack.h" - -int UnpackBitmap(T_geometry *geometry, unsigned char method, - unsigned char *src_data, int src_size, int dst_bpp, - int dst_width, int dst_height, unsigned char *dst_data, - int dst_size); - -#endif /* Bitmap_H */ diff --git a/nxcomp/BlockCache.cpp b/nxcomp/BlockCache.cpp deleted file mode 100644 index 76f7fd797..000000000 --- a/nxcomp/BlockCache.cpp +++ /dev/null @@ -1,77 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include "BlockCache.h" - - -int BlockCache::compare(unsigned int size, const unsigned char *data, - int overwrite) -{ - int match = 0; - if (size == size_) - { - match = 1; - for (unsigned int i = 0; i < size_; i++) - if (data[i] != buffer_[i]) - { - match = 0; - break; - } - } - if (!match && overwrite) - set(size, data); - return match; -} - - -void BlockCache::set(unsigned int size, const unsigned char *data) -{ - if (size_ < size) - { - delete[]buffer_; - buffer_ = new unsigned char[size]; - } - size_ = size; - memcpy(buffer_, data, size); - checksum_ = checksum(size, data); -} - - -unsigned int BlockCache::checksum(unsigned int size, const unsigned char *data) -{ - unsigned int sum = 0; - unsigned int shift = 0; - const unsigned char *next = data; - for (unsigned int i = 0; i < size; i++) - { - unsigned int value = (unsigned int) *next++; - sum += (value << shift); - shift++; - if (shift == 8) - shift = 0; - } - return sum; -} diff --git a/nxcomp/BlockCache.h b/nxcomp/BlockCache.h deleted file mode 100644 index 48e586966..000000000 --- a/nxcomp/BlockCache.h +++ /dev/null @@ -1,67 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef BlockCache_H -#define BlockCache_H - - -// Cache to hold an arbitrary-length block of bytes - -class BlockCache -{ - public: - BlockCache():buffer_(0), size_(0), checksum_(0) - { - } - ~BlockCache() - { - delete[]buffer_; - } - int compare(unsigned int size, const unsigned char *data, - int overwrite = 1); - void set(unsigned int size, const unsigned char *data); - - unsigned int getLength() const - { - return size_; - } - unsigned int getChecksum() const - { - return checksum_; - } - const unsigned char *getData() const - { - return buffer_; - } - - static unsigned int checksum(unsigned int size, const unsigned char *data); - -private: - unsigned char *buffer_; - unsigned int size_; - unsigned int checksum_; -}; - -#endif /* BlockCache_H */ diff --git a/nxcomp/BlockCacheSet.cpp b/nxcomp/BlockCacheSet.cpp deleted file mode 100644 index 3fd5e1ac7..000000000 --- a/nxcomp/BlockCacheSet.cpp +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "BlockCacheSet.h" - - -BlockCacheSet::BlockCacheSet(unsigned int numCaches): - caches_(new BlockCache *[numCaches]), size_(numCaches), - length_(0) -{ - for (unsigned int i = 0; i < numCaches; i++) - caches_[i] = new BlockCache(); -} - - -BlockCacheSet::~BlockCacheSet() -{ - // - // TODO: There is still a strange segfault occurring - // at random time under Cygwin, when proxy is being - // shutdown. Problem appeared just after upgrading - // to the latest version of the Cygwin DLL. A stack - // trace, obtained at the last minute, reveals that - // failure happens in this destructor. - // - - #ifndef __CYGWIN32__ - - for (unsigned int i = 0; i < size_; i++) - delete caches_[i]; - delete[]caches_; - - #endif /* ifdef __CYGWIN32__ */ -} - - -int -BlockCacheSet::lookup(unsigned int dataLength, const unsigned char *data, - unsigned int &index) -{ - unsigned int checksum = BlockCache::checksum(dataLength, data); - for (unsigned int i = 0; i < length_; i++) - if ((caches_[i]->getChecksum() == checksum) && - (caches_[i]->compare(dataLength, data, 0))) - { - // match - index = i; - if (i) - { - BlockCache *save = caches_[i]; - unsigned int target = (i >> 1); - do - { - caches_[i] = caches_[i - 1]; - i--; - } - while (i > target); - caches_[target] = save; - } - return 1; - } - // no match - unsigned int insertionPoint = (length_ >> 1); - unsigned int start; - if (length_ >= size_) - start = size_ - 1; - else - { - start = length_; - length_++; - } - BlockCache *save = caches_[start]; - for (unsigned int k = start; k > insertionPoint; k--) - caches_[k] = caches_[k - 1]; - caches_[insertionPoint] = save; - save->set(dataLength, data); - return 0; -} - - -void -BlockCacheSet::get(unsigned index, unsigned int &size, - const unsigned char *&data) -{ - size = caches_[index]->getLength(); - data = caches_[index]->getData(); - if (index) - { - BlockCache *save = caches_[index]; - unsigned int target = (index >> 1); - do - { - caches_[index] = caches_[index - 1]; - index--; - } - while (index > target); - caches_[target] = save; - } -} - - - -void -BlockCacheSet::set(unsigned int dataLength, const unsigned char *data) -{ - unsigned int insertionPoint = (length_ >> 1); - unsigned int start; - if (length_ >= size_) - start = size_ - 1; - else - { - start = length_; - length_++; - } - BlockCache *save = caches_[start]; - for (unsigned int k = start; k > insertionPoint; k--) - caches_[k] = caches_[k - 1]; - caches_[insertionPoint] = save; - save->set(dataLength, data); -} diff --git a/nxcomp/BlockCacheSet.h b/nxcomp/BlockCacheSet.h deleted file mode 100644 index 97273b0e0..000000000 --- a/nxcomp/BlockCacheSet.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef BlockCacheSet_H -#define BlockCacheSet_H - -#include "BlockCache.h" - - -class BlockCacheSet -{ - public: - BlockCacheSet(unsigned int numCaches); - ~BlockCacheSet(); - - int lookup(unsigned int size, const unsigned char *data, - unsigned int &index); - void get(unsigned int index, unsigned int &size, const unsigned char *&data); - void set(unsigned int size, const unsigned char *data); - - private: - BlockCache ** caches_; - unsigned int size_; - unsigned int length_; -}; - -#endif /* BlockCacheSet_H */ diff --git a/nxcomp/ChangeGC.cpp b/nxcomp/ChangeGC.cpp deleted file mode 100644 index f06984a10..000000000 --- a/nxcomp/ChangeGC.cpp +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ChangeGC.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int ChangeGCStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ChangeGCMessage *changeGC = (ChangeGCMessage *) message; - - // - // Here is the fingerprint. - // - - changeGC -> gcontext = GetULONG(buffer + 4, bigEndian); - changeGC -> value_mask = GetULONG(buffer + 8, bigEndian); - - // - // Clear the unused bytes carried in the - // payload to increase the effectiveness - // of the caching algorithm. - // - - if ((int) size > dataOffset) - { - #ifdef DEBUG - *logofs << name() << ": Removing unused bytes from the " - << "data payload.\n" << logofs_flush; - #endif - - changeGC -> value_mask &= (1 << 23) - 1; - - unsigned int mask = 0x1; - unsigned char *source = (unsigned char *) buffer + CHANGEGC_DATA_OFFSET; - unsigned long value = 0; - - for (unsigned int i = 0; i < 23; i++) - { - if (changeGC -> value_mask & mask) - { - value = GetULONG(source, bigEndian); - - value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i])); - - PutULONG(value, source, bigEndian); - - source += 4; - } - - mask <<= 1; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ChangeGCStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ChangeGCMessage *changeGC = (ChangeGCMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(changeGC -> gcontext, buffer + 4, bigEndian); - PutULONG(changeGC -> value_mask, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ChangeGCStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ChangeGCMessage *changeGC = (ChangeGCMessage *) message; - - *logofs << name() << ": Identity gcontext " << changeGC -> gcontext - << ", mask " << changeGC -> value_mask << ", size " - << changeGC -> size_ << ".\n" << logofs_flush; - #endif -} - -void ChangeGCStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -/* - md5_append(md5_state_, buffer + 4, 8); -*/ - md5_append(md5_state_, buffer + 8, 4); -} - -void ChangeGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - ChangeGCMessage *changeGC = (ChangeGCMessage *) message; - ChangeGCMessage *cachedChangeGC = (ChangeGCMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << changeGC -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(changeGC -> gcontext, clientCache -> gcCache); - - cachedChangeGC -> gcontext = changeGC -> gcontext; -} - -void ChangeGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - ChangeGCMessage *changeGC = (ChangeGCMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - changeGC -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << changeGC -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/ChangeGC.h b/nxcomp/ChangeGC.h deleted file mode 100644 index 9cac90e66..000000000 --- a/nxcomp/ChangeGC.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ChangeGC_H -#define ChangeGC_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define CHANGEGC_ENABLE_CACHE 1 -#define CHANGEGC_ENABLE_DATA 0 -#define CHANGEGC_ENABLE_SPLIT 0 -#define CHANGEGC_ENABLE_COMPRESS 0 - -#define CHANGEGC_DATA_LIMIT 144 -#define CHANGEGC_DATA_OFFSET 12 - -#define CHANGEGC_CACHE_SLOTS 3000 -#define CHANGEGC_CACHE_THRESHOLD 3 -#define CHANGEGC_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class ChangeGCMessage : public Message -{ - friend class ChangeGCStore; - - public: - - ChangeGCMessage() - { - } - - ~ChangeGCMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int gcontext; - unsigned int value_mask; -}; - -class ChangeGCStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ChangeGCStore() : MessageStore() - { - enableCache = CHANGEGC_ENABLE_CACHE; - enableData = CHANGEGC_ENABLE_DATA; - enableSplit = CHANGEGC_ENABLE_SPLIT; - enableCompress = CHANGEGC_ENABLE_COMPRESS; - - dataLimit = CHANGEGC_DATA_LIMIT; - dataOffset = CHANGEGC_DATA_OFFSET; - - cacheSlots = CHANGEGC_CACHE_SLOTS; - cacheThreshold = CHANGEGC_CACHE_THRESHOLD; - cacheLowerThreshold = CHANGEGC_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~ChangeGCStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "ChangeGC"; - } - - virtual unsigned char opcode() const - { - return X_ChangeGC; - } - - virtual unsigned int storage() const - { - return sizeof(ChangeGCMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ChangeGCMessage(); - } - - virtual Message *create(const Message &message) const - { - return new ChangeGCMessage((const ChangeGCMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (ChangeGCMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; -}; - -#endif /* ChangeGC_H */ diff --git a/nxcomp/ChangeProperty.cpp b/nxcomp/ChangeProperty.cpp deleted file mode 100644 index dbfb8f5d7..000000000 --- a/nxcomp/ChangeProperty.cpp +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ChangeProperty.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int ChangePropertyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; - - changeProperty -> mode = *(buffer + 1); - changeProperty -> format = *(buffer + 16); - - changeProperty -> window = GetULONG(buffer + 4, bigEndian); - changeProperty -> property = GetULONG(buffer + 8, bigEndian); - changeProperty -> type = GetULONG(buffer + 12, bigEndian); - changeProperty -> length = GetULONG(buffer + 20, bigEndian); - - // - // Cleanup the padding bytes. - // - - unsigned int uiFormat; - unsigned int uiLengthInBytes; - - if ((int) size > CHANGEPROPERTY_DATA_OFFSET) - { - uiFormat = *(buffer + 16); - - uiLengthInBytes = changeProperty -> length; - - #ifdef DEBUG - *logofs << name() << ": length " << uiLengthInBytes - << ", format " << uiFormat << ", size " - << size << ".\n" << logofs_flush; - #endif - - if (uiFormat == 16) - { - uiLengthInBytes <<= 1; - } - else if (uiFormat == 32) - { - uiLengthInBytes <<= 2; - } - - unsigned char *end = ((unsigned char *) buffer) + size; - unsigned char *pad = ((unsigned char *) buffer) + CHANGEPROPERTY_DATA_OFFSET + uiLengthInBytes; - - CleanData((unsigned char *) pad, end - pad); - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ChangePropertyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; - - *(buffer + 1) = changeProperty -> mode; - *(buffer + 16) = changeProperty -> format; - - PutULONG(changeProperty -> window, buffer + 4, bigEndian); - PutULONG(changeProperty -> property, buffer + 8, bigEndian); - PutULONG(changeProperty -> type, buffer + 12, bigEndian); - PutULONG(changeProperty -> length, buffer + 20, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ChangePropertyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; - - *logofs << name() << ": Identity mode " << (unsigned int) changeProperty -> mode << ", format " - << (unsigned int) changeProperty -> format << ", window " << changeProperty -> window - << ", property " << changeProperty -> property << ", type " << changeProperty -> type - << ", length " << changeProperty -> length << ", size " << changeProperty -> size_ - << ".\n" << logofs_flush; - - #endif -} - -void ChangePropertyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 16, 1); - - md5_append(md5_state_, buffer + 8, 4); - md5_append(md5_state_, buffer + 12, 4); - md5_append(md5_state_, buffer + 20, 4); -} - -void ChangePropertyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; - ChangePropertyMessage *cachedChangeProperty = (ChangePropertyMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << changeProperty -> window - << " as window field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(changeProperty -> window, clientCache -> windowCache); - - cachedChangeProperty -> window = changeProperty -> window; -} - -void ChangePropertyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> windowCache); - - changeProperty -> window = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << changeProperty -> window - << " as window field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/ChangeProperty.h b/nxcomp/ChangeProperty.h deleted file mode 100644 index c06ce10fc..000000000 --- a/nxcomp/ChangeProperty.h +++ /dev/null @@ -1,189 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ChangeProperty_H -#define ChangeProperty_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define CHANGEPROPERTY_ENABLE_CACHE 1 -#define CHANGEPROPERTY_ENABLE_DATA 0 -#define CHANGEPROPERTY_ENABLE_SPLIT 0 -#define CHANGEPROPERTY_ENABLE_COMPRESS 0 - -#define CHANGEPROPERTY_DATA_LIMIT 28688 -#define CHANGEPROPERTY_DATA_OFFSET 24 - -#define CHANGEPROPERTY_CACHE_SLOTS 2000 -#define CHANGEPROPERTY_CACHE_THRESHOLD 2 -#define CHANGEPROPERTY_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class ChangePropertyMessage : public Message -{ - friend class ChangePropertyStore; - - public: - - ChangePropertyMessage() - { - } - - ~ChangePropertyMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char mode; - unsigned char format; - unsigned int window; - unsigned int property; - unsigned int type; - unsigned int length; -}; - -class ChangePropertyStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ChangePropertyStore() : MessageStore() - { - enableCache = CHANGEPROPERTY_ENABLE_CACHE; - enableData = CHANGEPROPERTY_ENABLE_DATA; - enableSplit = CHANGEPROPERTY_ENABLE_SPLIT; - enableCompress = CHANGEPROPERTY_ENABLE_COMPRESS; - - dataLimit = CHANGEPROPERTY_DATA_LIMIT; - dataOffset = CHANGEPROPERTY_DATA_OFFSET; - - cacheSlots = CHANGEPROPERTY_CACHE_SLOTS; - cacheThreshold = CHANGEPROPERTY_CACHE_THRESHOLD; - cacheLowerThreshold = CHANGEPROPERTY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~ChangePropertyStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "ChangeProperty"; - } - - virtual unsigned char opcode() const - { - return X_ChangeProperty; - } - - virtual unsigned int storage() const - { - return sizeof(ChangePropertyMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ChangePropertyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new ChangePropertyMessage((const ChangePropertyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (ChangePropertyMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* ChangeProperty_H */ diff --git a/nxcomp/Channel.cpp b/nxcomp/Channel.cpp deleted file mode 100644 index 41a09e951..000000000 --- a/nxcomp/Channel.cpp +++ /dev/null @@ -1,2035 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Channel.h" - -#include "List.h" -#include "Proxy.h" -#include "Statistics.h" - -#include "StaticCompressor.h" - -#include "NXalert.h" - -extern Proxy *proxy; - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Log the operations related to splits. -// - -#undef SPLIT - -#undef COUNT - -#define COUNT_MAJOR_OPCODE 154 - -#undef MONITOR - -#define MONITOR_MAJOR_OPCODE 154 -#define MONITOR_MINOR_OPCODE 23 - -#undef CLEAR - -#define CLEAR_MAJOR_OPCODE 154 -#define CLEAR_MINOR_OPCODE 23 - -// -// Define this to know how many messages -// are allocated and deallocated. -// - -#undef REFERENCES - -// -// Set to the descriptor of the first X -// channel successfully connected. -// - -int Channel::firstClient_ = -1; - -// -// Port used for font server connections. -// - -int Channel::fontPort_ = -1; - -// -// This is used for reference count. -// - -#ifdef REFERENCES - -int Channel::references_ = 0; - -#endif - -Channel::Channel(Transport *transport, StaticCompressor *compressor) - - : transport_(transport), compressor_(compressor) -{ - fd_ = transport_ -> fd(); - - finish_ = 0; - closing_ = 0; - drop_ = 0; - congestion_ = 0; - priority_ = 0; - - alert_ = 0; - - firstRequest_ = 1; - firstReply_ = 1; - - enableCache_ = 1; - enableSplit_ = 1; - enableSave_ = 1; - enableLoad_ = 1; - - // - // Must be set by proxy. - // - - opcodeStore_ = NULL; - - clientStore_ = NULL; - serverStore_ = NULL; - - clientCache_ = NULL; - serverCache_ = NULL; - - #ifdef REFERENCES - *logofs << "Channel: Created new Channel at " - << this << " out of " << ++references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -Channel::~Channel() -{ - if (firstClient_ == fd_) - { - firstClient_ = -1; - } - - #ifdef REFERENCES - *logofs << "Channel: Deleted Channel at " - << this << " out of " << --references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -int Channel::handleEncode(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, - MessageStore *store, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #ifdef MONITOR - - static float totalMessages = 0; - static float totalBits = 0; - - int bits; - int diff; - - bits = encodeBuffer.getBits(); - - #endif - - // - // Check if message can be differentially - // encoded using a similar message in the - // message store. - // - - #ifdef COUNT - - if (*(buffer) == COUNT_MAJOR_OPCODE) - { - if (*(buffer) < 128) - { - *logofs << "handleEncode: Handling OPCODE#" << (unsigned int) *(buffer) - << ".\n" << logofs_flush; - } - else - { - *logofs << "handleEncode: Handling OPCODE#" << (unsigned int) *(buffer) - << " MINOR#" << (unsigned int) *(buffer + 1) << ".\n" - << logofs_flush; - } - } - - #endif - - #ifdef CLEAR - - if (*(buffer) == CLEAR_MAJOR_OPCODE && - (CLEAR_MINOR_OPCODE == -1 || *(buffer + 1) == CLEAR_MINOR_OPCODE)) - { - *((unsigned char *) buffer) = X_NoOperation; - - *((unsigned char *) buffer + 1) = '\0'; - - CleanData((unsigned char *) buffer + 4, size - 4); - } - - #endif - - if (handleEncodeCached(encodeBuffer, channelCache, - store, buffer, size) == 1) - { - #ifdef MONITOR - - diff = encodeBuffer.getBits() - bits; - - if (*(buffer) == MONITOR_MAJOR_OPCODE && - (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) - { - totalMessages++; - - totalBits += diff; - - *logofs << "handleEncode: Handled cached OPCODE#" << (unsigned int) *(buffer) - << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size - << " bytes in, " << diff << " bits (" << ((float) diff) / 8 - << " bytes) out. Average " << totalBits / totalMessages - << "/1.\n" << logofs_flush; - } - - #endif - - // - // Let the channel update the split store - // and notify the agent in the case of a - // cache hit. - // - - if (store -> enableSplit) - { - handleSplit(encodeBuffer, store, store -> lastAction, - store -> lastHit, opcode, buffer, size); - } - - return 1; - } - - // - // A similar message could not be found in - // cache or message must be discarded. Must - // transmit the message using the field by - // field differential encoding. - // - - handleEncodeIdentity(encodeBuffer, channelCache, - store, buffer, size, bigEndian_); - - // - // Check if message has a distinct data part. - // - - if (store -> enableData) - { - // - // If message split was requested by agent then send data - // out-of-band, dividing it in small chunks. Until message - // is completely transferred, keep in the split store a - // dummy version of the message, with data replaced with a - // pattern. - // - // While data is being transferred, agent should have put - // the resource (for example its client) asleep. It can - // happen, though, that a different client would reference - // the same message. We cannot issue a cache hit for images - // being split (such images are put in store in 'incomplete' - // state), so we need to handle this case. - // - - if (store -> enableSplit == 1) - { - // - // Let the channel decide what to do with the - // message. If the split can't take place be- - // cause the split store is full, the channel - // will tell the remote side that the data is - // going to follow. - // - - if (handleSplit(encodeBuffer, store, store -> lastAction, - (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), - opcode, buffer, size) == 1) - { - #ifdef MONITOR - - diff = encodeBuffer.getBits() - bits; - - if (*(buffer) == MONITOR_MAJOR_OPCODE && - (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) - { - totalMessages++; - - totalBits += diff; - - *logofs << "handleEncode: Handled split OPCODE#" << (unsigned int) *(buffer) - << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size - << " bytes in, " << diff << " bits (" << ((float) diff) / 8 - << " bytes) out. Average " << totalBits / totalMessages - << "/1.\n" << logofs_flush; - } - - #endif - - return 0; - } - } - - // - // The split did not take place and we are going - // to transfer the data part. Check if the static - // compression of the data section is enabled. - // This is the case of all messages not having a - // special differential encoding or messages that - // we want to store in cache in compressed form. - // - - unsigned int offset = store -> identitySize(buffer, size); - - if (store -> enableCompress) - { - unsigned char *data = NULL; - unsigned int dataSize = 0; - - int compressed = handleCompress(encodeBuffer, opcode, offset, - buffer, size, data, dataSize); - if (compressed < 0) - { - return -1; - } - else if (compressed > 0) - { - // - // Update the size of the message according - // to the result of the data compression. - // - - handleUpdate(store, size - offset, dataSize); - } - } - else - { - handleCopy(encodeBuffer, opcode, offset, buffer, size); - } - } - - #ifdef MONITOR - - diff = encodeBuffer.getBits() - bits; - - if (*(buffer) == MONITOR_MAJOR_OPCODE && - (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) - { - totalMessages++; - - totalBits += diff; - - *logofs << "handleEncode: Handled OPCODE#" << (unsigned int) *(buffer) - << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size - << " bytes in, " << diff << " bits (" << ((float) diff) / 8 - << " bytes) out. Average " << totalBits / totalMessages - << "/1.\n" << logofs_flush; - } - - #endif - - return 0; -} - -int Channel::handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, - MessageStore *store, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // Check first if the message is in the - // message store. - // - - unsigned int split = 0; - - if (handleDecodeCached(decodeBuffer, channelCache, - store, buffer, size) == 1) - { - // - // Let the channel update the split store - // in the case of a message being cached. - // - - if (store -> enableSplit == 1) - { - // Since ProtoStep7 (#issue 108) - #ifdef DEBUG - *logofs << "handleDecode: " << store -> name() - << ": Checking if the message was split.\n" - << logofs_flush; - #endif - - decodeBuffer.decodeBoolValue(split); - - if (split == 1) - { - handleSplit(decodeBuffer, store, store -> lastAction, - store -> lastHit, opcode, buffer, size); - - handleCleanAndNullRequest(opcode, buffer, size); - } - } - - return 1; - } - - // - // Decode the full identity. - // - - handleDecodeIdentity(decodeBuffer, channelCache, store, buffer, - size, bigEndian_, &writeBuffer_); - - // - // Check if the message has a distinct - // data part. - // - - if (store -> enableData) - { - // - // Check if message has been split. - // - - if (store -> enableSplit) - { - #ifdef DEBUG - *logofs << "handleDecode: " << store -> name() - << ": Checking if the message was split.\n" - << logofs_flush; - #endif - - decodeBuffer.decodeBoolValue(split); - - if (split == 1) - { - // - // If the message was added to the store, - // create the entry without the data part. - // - - handleSaveSplit(store, buffer, size); - - handleSplit(decodeBuffer, store, store -> lastAction, - (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), - opcode, buffer, size); - - handleCleanAndNullRequest(opcode, buffer, size); - - return 0; - } - } - - // - // Decode the data part. - // - - unsigned int offset = store -> identitySize(buffer, size); - - if (store -> enableCompress) - { - const unsigned char *data = NULL; - unsigned int dataSize = 0; - - int decompressed = handleDecompress(decodeBuffer, opcode, offset, - buffer, size, data, dataSize); - if (decompressed < 0) - { - return -1; - } - else if (decompressed > 0) - { - // - // The message has been transferred - // in compressed format. - // - - handleSave(store, buffer, size, data, dataSize); - - if (store -> enableSplit) - { - if (split == 1) - { - handleSplit(decodeBuffer, store, store -> lastAction, - (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), - opcode, buffer, size); - - handleCleanAndNullRequest(opcode, buffer, size); - } - } - - return 0; - } - } - else - { - // - // Static compression of the data part - // was not enabled for this message. - // - - handleCopy(decodeBuffer, opcode, offset, buffer, size); - } - } - - // - // The message doesn't have a data part - // or the data was not compressed. - // - - handleSave(store, buffer, size); - - if (store -> enableSplit) - { - if (split == 1) - { - handleSplit(decodeBuffer, store, store -> lastAction, - (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), - opcode, buffer, size); - - handleCleanAndNullRequest(opcode, buffer, size); - } - } - - return 0; -} - -int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, - MessageStore *store, const unsigned char *buffer, - const unsigned int size) -{ - if (control -> LocalDeltaCompression == 0 || - enableCache_ == 0 || store -> enableCache == 0) - { - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(is_discarded, - store -> lastActionCache); - - store -> lastAction = is_discarded; - - return 0; - } - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() - << ": Going to handle a new message of this class.\n" - << logofs_flush; - #endif - - // - // Check if the estimated size of cache is greater - // than the requested limit. If it is the case make - // some room by deleting one or more messages. - // - - int position; - - while (mustCleanStore(store) == 1 && canCleanStore(store) == 1) - { - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() - << ": Trying to reduce size of message store.\n" - << logofs_flush; - #endif - - position = store -> clean(use_checksum); - - if (position == nothing) - { - #ifdef TEST - *logofs << "handleEncodeCached: " << store -> name() - << ": WARNING! No message found to be " - << "actually removed.\n" << logofs_flush; - #endif - - break; - } - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() - << ": Message at position " << position - << " will be removed.\n" << logofs_flush; - #endif - - // - // Encode the position of message to - // be discarded. - // - - store -> lastRemoved = position; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(is_removed, store -> lastRemoved, - store -> lastActionCache); - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() << ": Going to " - << "clean up message at position " << position << ".\n" - << logofs_flush; - #endif - - store -> remove(position, use_checksum, discard_data); - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() << ": There are " - << store -> getSize() << " messages in the store out of " - << store -> cacheSlots << " slots.\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() - << ": Size of store is " << store -> getLocalStorageSize() - << " bytes locally and " << store -> getRemoteStorageSize() - << " bytes remotely.\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() - << ": Size of total cache is " << store -> getLocalTotalStorageSize() - << " bytes locally and " << store -> getRemoteTotalStorageSize() - << " bytes remotely.\n" << logofs_flush; - #endif - } - - #ifdef DEBUG - - if (mustCleanStore(store) == 1 && canCleanStore(store) == 0) - { - *logofs << "handleEncodeCached: " << store -> name() - << ": Store would need a clean but operation will be delayed.\n" - << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() << ": There are " - << store -> getSize() << " messages in the store out of " - << store -> cacheSlots << " slots.\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() - << ": Size of store is " << store -> getLocalStorageSize() - << " bytes locally and " << store -> getRemoteStorageSize() - << " bytes remotely.\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() - << ": Size of total cache is " << store -> getLocalTotalStorageSize() - << " bytes locally and " << store -> getRemoteTotalStorageSize() - << " bytes remotely.\n" << logofs_flush; - } - - #endif - - // - // If 'on the wire' size of message exceeds the - // allowed limit then avoid to store it in the - // cache. - // - - if (store -> validateMessage(buffer, size) == 0) - { - #ifdef TEST - *logofs << "handleEncodeCached: " << store -> name() - << ": Message with size " << size << " ignored.\n" - << logofs_flush; - #endif - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(is_discarded, - store -> lastActionCache); - - store -> lastAction = is_discarded; - - return 0; - } - - // - // Fill the message object with the - // received data. - // - - Message *message = store -> getTemporary(); - - if (message == NULL) - { - #ifdef PANIC - *logofs << "handleEncodeCached: " << store -> name() - << ": PANIC! Can't allocate memory for " - << "a new message.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "a new message in context [D].\n"; - - HandleCleanup(); - } - - // - // As we are at encoding side, it is enough to store the - // checksum for the object while data can be erased. Both - // the identity and the data will never be sent through - // the wire again as long as they are stored in the cache - // at the decoding side. The split parameter is always - // set to 0 as the data will not be stored in any case. - // - - store -> parse(message, 0, buffer, size, use_checksum, - discard_data, bigEndian_); - - #ifdef DUMP - - store -> dump(message); - - #endif - - // - // Search the object in the message - // store. If found get the position. - // - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() - << ": Searching object of size " << size - << " in the cache.\n" << logofs_flush; - #endif - - int added; - int locked; - - position = store -> findOrAdd(message, use_checksum, - discard_data, added, locked); - - if (position == nothing) - { - #ifdef WARNING - *logofs << "handleEncodeCached: " << store -> name() - << ": WARNING! Can't store object in the cache.\n" - << logofs_flush; - #endif - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(is_discarded, - store -> lastActionCache); - - store -> lastAction = is_discarded; - - return 0; - } - else if (locked == 1) - { - // - // We can't issue a cache hit. Encoding identity - // differences while message it's being split - // would later result in agent to commit a wrong - // version of message. - // - - #ifdef WARNING - *logofs << "handleEncodeCached: " << store -> name() - << ": WARNING! Message of size " << store -> plainSize(position) - << " at position " << position << " is locked.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Message of size " << store -> plainSize(position) - << " at position " << position << " is locked.\n"; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(is_discarded, - store -> lastActionCache); - - store -> lastAction = is_discarded; - - return 0; - } - else if (added == 1) - { - store -> resetTemporary(); - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() << ": Message of size " - << store -> plainSize(position) << " has been stored at position " - << position << ".\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() << ": There are " - << store -> getSize() << " messages in the store out of " - << store -> cacheSlots << " slots.\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() - << ": Size of store is " << store -> getLocalStorageSize() - << " bytes locally and " << store -> getRemoteStorageSize() - << " bytes remotely.\n" << logofs_flush; - - *logofs << "handleEncodeCached: " << store -> name() - << ": Size of total cache is " << store -> getLocalTotalStorageSize() - << " bytes locally and " << store -> getRemoteTotalStorageSize() - << " bytes remotely.\n" << logofs_flush; - #endif - - // - // Inform the decoding side that message - // must be inserted in cache and encode - // the position where the insertion took - // place. - // - - store -> lastAction = IS_ADDED; - - store -> lastAdded = position; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(IS_ADDED, store -> lastAdded, - store -> lastActionCache); - - return 0; - } - else - { - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() - << ": Cache hit. Found object at position " - << position << ".\n" << logofs_flush; - #endif - - // - // Must abort the connection if the - // the position is invalid. - // - - Message *cachedMessage = store -> get(position); - - // - // Increase the rating of the cached - // message. - // - - store -> touch(cachedMessage); - - #ifdef DEBUG - *logofs << "handleEncodeCached: " << store -> name() << ": Hits for " - << "object at position " << position << " are now " - << store -> getTouches(position) << ".\n" - << logofs_flush; - #endif - - // - // Send to the decoding side position - // where object can be found in cache. - // - - store -> lastAction = IS_HIT; - - store -> lastHit = position; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeActionValue(IS_HIT, store -> lastHit, - store -> lastActionCache); - - // - // Send the field by field differences in - // respect to the original message stored - // in cache. - // - - store -> updateIdentity(encodeBuffer, message, cachedMessage, channelCache); - - return 1; - } -} - -void Channel::handleUpdateAdded(MessageStore *store, unsigned int dataSize, - unsigned int compressedDataSize) -{ - #ifdef TEST - - if (store -> lastAction != IS_ADDED) - { - #ifdef PANIC - *logofs << "handleUpdateAdded: " << store -> name() - << ": PANIC! Function called for action '" - << store -> lastAction << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Update function called for " - << "store '" << store -> name() << "' with " - << "action '" << store -> lastAction - << "'.\n"; - - HandleCleanup(); - } - - #endif - - #ifdef DEBUG - *logofs << "handleUpdateAdded: " << store -> name() << ": Updating " - << "object at position " << store -> lastAdded << " of size " - << store -> plainSize(store -> lastAdded) << " (" << dataSize - << "/" << compressedDataSize << ").\n" << logofs_flush; - #endif - - store -> updateData(store -> lastAdded, dataSize, compressedDataSize); - - #ifdef DEBUG - *logofs << "handleUpdateAdded: " << store -> name() << ": There are " - << store -> getSize() << " messages in the store out of " - << store -> cacheSlots << " slots.\n" << logofs_flush; - - *logofs << "handleUpdateAdded: " << store -> name() - << ": Size of store is " << store -> getLocalStorageSize() - << " bytes locally and " << store -> getRemoteStorageSize() - << " bytes remotely.\n" << logofs_flush; - - *logofs << "handleUpdateAdded: " << store -> name() - << ": Size of total cache is " << store -> getLocalTotalStorageSize() - << " bytes locally and " << store -> getRemoteTotalStorageSize() - << " bytes remotely.\n" << logofs_flush; - #endif -} - -int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, - MessageStore *store, unsigned char *&buffer, - unsigned int &size) -{ - // - // Create a new message object and - // fill it with received data. - // - - #ifdef DEBUG - *logofs << "handleDecodeCached: " << store -> name() - << ": Going to handle a new message of this class.\n" - << logofs_flush; - #endif - - // - // Decode bits telling how to handle - // this message. - // - - unsigned char action; - unsigned short int position; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeActionValue(action, position, - store -> lastActionCache); - - // - // Clean operations must always come - // before any operation on message. - // - - while (action == is_removed) - { - // Since ProtoStep7 (#issue 108) - store -> lastRemoved = position; - - #ifdef DEBUG - - if (store -> get(store -> lastRemoved)) - { - *logofs << "handleDecodeCached: " << store -> name() << ": Cleaning up " - << "object at position " << store -> lastRemoved - << " of size " << store -> plainSize(store -> lastRemoved) - << " (" << store -> plainSize(store -> lastRemoved) << "/" - << store -> compressedSize(store -> lastRemoved) << ").\n" - << logofs_flush; - } - - #endif - - // - // If the message can't be found we - // will abort the connection. - // - - store -> remove(store -> lastRemoved, discard_checksum, use_data); - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeActionValue(action, position, - store -> lastActionCache); - } - - // - // If it's a cache hit, the position - // where object can be found follows. - // - - if ((T_store_action) action == IS_HIT) - { - // Since ProtoStep7 (#issue 108) - store -> lastHit = position; - - // - // Get data from the cache at given position. - // - - #ifdef DEBUG - - if (store -> get(store -> lastHit)) - { - *logofs << "handleDecodeCached: " << store -> name() << ": Retrieving " - << "object at position " << store -> lastHit - << " of size " << store -> plainSize(store -> lastHit) - << " (" << store -> plainSize(store -> lastHit) << "/" - << store -> compressedSize(store -> lastHit) << ").\n" - << logofs_flush; - } - - #endif - - // - // Must abort the connection if the - // the position is invalid. - // - - Message *message = store -> get(store -> lastHit); - - // - // Make room for the outgoing message. - // - - size = store -> plainSize(store -> lastHit); - - buffer = writeBuffer_.addMessage(size); - - #ifdef DEBUG - *logofs << "handleDecodeCached: " << store -> name() - << ": Prepared an outgoing buffer of " - << size << " bytes.\n" << logofs_flush; - #endif - - // - // Decode the variant part. Pass client - // or server cache to the message store. - // - - store -> updateIdentity(decodeBuffer, message, channelCache); - - // - // Write each field in the outgoing buffer. - // - - store -> unparse(message, buffer, size, bigEndian_); - - #ifdef DUMP - - store -> dump(message); - - #endif - - store -> lastAction = IS_HIT; - - return 1; - } - else if ((T_store_action) action == IS_ADDED) - { - // Since ProtoStep7 (#issue 108) - store -> lastAdded = position; - - #ifdef DEBUG - *logofs << "handleDecodeCached: " << store -> name() - << ": Message will be later stored at position " - << store -> lastAdded << ".\n" << logofs_flush; - #endif - - store -> lastAction = IS_ADDED; - - return 0; - } - else - { - #ifdef DEBUG - *logofs << "handleDecodeCached: " << store -> name() - << ": Message will be later discarded.\n" - << logofs_flush; - #endif - - store -> lastAction = is_discarded; - - return 0; - } -} - -void Channel::handleSaveAdded(MessageStore *store, int split, unsigned char *buffer, - unsigned int size, const unsigned char *compressedData, - const unsigned int compressedDataSize) -{ - #ifdef TEST - - if (store -> lastAction != IS_ADDED) - { - #ifdef PANIC - *logofs << "handleSaveAdded: " << store -> name() - << ": PANIC! Function called for action '" - << store -> lastAction << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Save function called for " - << "store '" << store -> name() << "' with " - << "action '" << store -> lastAction - << "'.\n"; - - HandleCleanup(); - } - - #endif - - Message *message = store -> getTemporary(); - - if (message == NULL) - { - #ifdef PANIC - *logofs << "handleSaveAdded: " << store -> name() - << ": PANIC! Can't access temporary storage " - << "for message at position " << store -> lastAdded - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't access temporary storage " - << "for message at position " << store -> lastAdded - << ".\n"; - - HandleCleanup(); - } - - if (compressedData == NULL) - { - // - // If the data part has been split - // avoid to copy it into the message. - // - - store -> parse(message, split, buffer, size, discard_checksum, - use_data, bigEndian_); - } - else - { - store -> parse(message, buffer, size, compressedData, - compressedDataSize, discard_checksum, - use_data, bigEndian_); - } - - if (store -> add(message, store -> lastAdded, - discard_checksum, use_data) == nothing) - { - #ifdef PANIC - *logofs << "handleSaveAdded: " << store -> name() - << ": PANIC! Can't store message in the cache " - << "at position " << store -> lastAdded << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't store message of type " - << store -> name() << "in the cache at position " - << store -> lastAdded << ".\n"; - - HandleCleanup(); - } - else - { - store -> resetTemporary(); - - #ifdef DEBUG - *logofs << "handleSaveAdded: " << store -> name() << ": Stored " - << (compressedData == NULL ? "plain" : "compressed") - << " object at position " << store -> lastAdded - << " of size " << store -> plainSize(store -> lastAdded) - << " (" << store -> plainSize(store -> lastAdded) << "/" - << store -> compressedSize(store -> lastAdded) << ").\n" - << logofs_flush; - #endif - } - - #ifdef DEBUG - *logofs << "handleSaveAdded: " << store -> name() - << ": Size of store is " << store -> getLocalStorageSize() - << " bytes locally and " << store -> getRemoteStorageSize() - << " bytes remotely.\n" << logofs_flush; - - *logofs << "handleSaveAdded: " << store -> name() - << ": Size of total cache is " << store -> getLocalTotalStorageSize() - << " bytes locally and " << store -> getRemoteTotalStorageSize() - << " bytes remotely.\n" << logofs_flush; - #endif -} - -int Channel::handleWait(int timeout) -{ - #ifdef TEST - *logofs << "handleWait: Going to wait for more data " - << "on FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - T_timestamp startTs = getNewTimestamp(); - - T_timestamp nowTs = startTs; - - int readable; - int remaining; - - for (;;) - { - remaining = timeout - diffTimestamp(startTs, nowTs); - - if (transport_ -> blocked() == 1) - { - #ifdef WARNING - *logofs << "handleWait: WARNING! Having to drain with " - << "channel " << "for FD#" << fd_ << " blocked.\n" - << logofs_flush; - #endif - - handleDrain(0, remaining); - - continue; - } - - if (remaining <= 0) - { - #ifdef TEST - *logofs << "handleWait: Timeout raised while waiting " - << "for more data for FD#" << fd_ << " at " - << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - return 0; - } - - #ifdef TEST - *logofs << "handleWait: Waiting " << remaining << " Ms " - << "for a new message on FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - readable = transport_ -> wait(remaining); - - if (readable > 0) - { - #ifdef TEST - *logofs << "handleWait: WARNING! Encoding more data " - << "for FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - if (proxy -> handleAsyncRead(fd_) < 0) - { - return -1; - } - - return 1; - } - else if (readable == -1) - { - return -1; - } - - nowTs = getNewTimestamp(); - } -} - -int Channel::handleDrain(int limit, int timeout) -{ - #ifdef TEST - *logofs << "handleDrain: Going to drain FD#" << fd_ - << " with a limit of " << limit << " bytes " - << "at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - T_timestamp startTs = getNewTimestamp(); - - T_timestamp nowTs = startTs; - - int drained; - int remaining; - - int result; - - for (;;) - { - remaining = timeout - diffTimestamp(startTs, nowTs); - - if (remaining <= 0) - { - #ifdef TEST - *logofs << "handleDrain: Timeout raised while draining " - << "FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - result = 0; - - goto ChannelDrainEnd; - } - - #ifdef TEST - *logofs << "handleDrain: Trying to write to FD#" - << fd_ << " with " << remaining << " Ms " - << "remaining.\n" << logofs_flush; - #endif - - drained = transport_ -> drain(limit, remaining); - - if (drained == 1) - { - #ifdef TEST - *logofs << "handleDrain: Transport for FD#" << fd_ - << " drained to " << transport_ -> length() - << " bytes at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - result = 1; - - goto ChannelDrainEnd; - } - else if (drained == 0 && transport_ -> readable() > 0) - { - #ifdef TEST - *logofs << "handleDrain: WARNING! Encoding more data " - << "for FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - if (proxy -> handleAsyncRead(fd_) < 0) - { - goto ChannelDrainError; - } - } - else if (drained == -1) - { - goto ChannelDrainError; - } - - nowTs = getNewTimestamp(); - - if (diffTimestamp(startTs, nowTs) >= control -> ChannelTimeout) - { - int seconds = (remaining + control -> LatencyTimeout * 10) / 1000; - - #ifdef WARNING - *logofs << "handleDrain: WARNING! Could not drain FD#" - << fd_ << " within " << seconds << " seconds.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Can't write to connection on FD#" - << fd_ << " since " << seconds << " seconds.\n"; - - if (alert_ == 0) - { - if (control -> ProxyMode == proxy_client) - { - alert_ = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT; - } - else - { - alert_ = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT; - } - - HandleAlert(alert_, 1); - } - } - } - -ChannelDrainEnd: - - // - // Maybe we drained the channel and are - // now out of the congestion state. - // - - handleCongestion(); - - return result; - -ChannelDrainError: - - finish_ = 1; - - return -1; -} - -int Channel::handleCongestion() -{ - // - // Send a begin congestion control code - // if the local end of the channel does - // not consume its data. - // - - if (isCongested() == 1) - { - if (congestion_ == 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleCongestion: Sending congestion for FD#" - << fd_ << " with length " << transport_ -> length() - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - congestion_ = 1; - - // - // Use the callback to send the control - // code immediately. - // - - if (proxy -> handleAsyncCongestion(fd_) < 0) - { - finish_ = 1; - - return -1; - } - } - } - else - { - // - // If the channel was in congestion state - // send an end congestion control code. - // - - if (congestion_ == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleCongestion: Sending decongestion for FD#" - << fd_ << " with length " << transport_ -> length() - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - congestion_ = 0; - - if (proxy -> handleAsyncDecongestion(fd_) < 0) - { - finish_ = 1; - - return -1; - } - } - - // - // Remove the "channel unresponsive" - // dialog. - // - - if (alert_ != 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleCongestion: Displacing the dialog " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - HandleAlert(DISPLACE_MESSAGE_ALERT, 1); - } - } - - return 1; -} - -int Channel::handleFlush(T_flush type, int bufferLength, int scratchLength) -{ - if (finish_ == 1) - { - #ifdef TEST - *logofs << "handleFlush: Not flushing data for " - << "finishing channel for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - writeBuffer_.fullReset(); - - return -1; - } - - #ifdef TEST - *logofs << "handleFlush: Flushing " << bufferLength - << " + " << scratchLength << " bytes " - << "to FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - // - // Check if the channel has data available. - // Recent Linux kernels are very picky. - // They require that we read often or they - // assume that the process is non-interact- - // ive. - // - - int result = 0; - - if (handleAsyncEvents() < 0) - { - goto ChannelFlushError; - } - - // - // Write the data in the main buffer first, - // followed by the data in the scratch buffer. - // - - if (bufferLength > 0) - { - result = transport_ -> write(write_immediate, - writeBuffer_.getData(), bufferLength); - } - - if (result >= 0 && scratchLength > 0) - { - result = transport_ -> write(write_immediate, - writeBuffer_.getScratchData(), scratchLength); - } - - if (type == flush_if_any) - { - writeBuffer_.fullReset(); - } - else - { - writeBuffer_.partialReset(); - } - - // - // If we failed to write to the X connection then - // set the finish flag. The caller should continue - // to handle all the remaining messages or it will - // corrupt the decode buffer. At the real end, an - // error will be propagated to the upper layers - // which will perform any needed cleanup. - // - - if (result < 0) - { - goto ChannelFlushError; - } - - // - // Reset transport buffers. - // - - transport_ -> partialReset(); - - // - // Check if the X server has generated - // any event in response to our data. - // - - if (handleAsyncEvents() < 0) - { - goto ChannelFlushError; - } - - // - // Check if the channel has entered in - // congestion state and, in this case, - // send an immediate congestion control - // code to the remote. - // - - handleCongestion(); - - // - // We could optionally drain the output - // buffer if this is X11 channel. - // - // if (isCongested() == 1 && isReliable() == 1) - // { - // if (handleDrain(0, control -> ChannelTimeout) < 0) - // { - // goto ChannelFlushError; - // } - // } - // - - return 1; - -ChannelFlushError: - - finish_ = 1; - - return -1; -} - -int Channel::handleFlush() -{ - #ifdef TEST - *logofs << "handleFlush: Flushing " - << transport_ -> length() << " bytes to FD#" - << fd_ << " with descriptor writable.\n" - << logofs_flush; - #endif - - // - // Check if there is anything to read - // before anf after having written to - // the socket. - // - - if (handleAsyncEvents() < 0) - { - goto ChannelFlushError; - } - - if (transport_ -> flush() < 0) - { - #ifdef TEST - *logofs << "handleFlush: Failure detected " - << "flushing data to FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - goto ChannelFlushError; - } - - if (handleAsyncEvents() < 0) - { - goto ChannelFlushError; - } - - // - // Reset channel's transport buffers. - // - - transport_ -> partialReset(); - - // - // Check if the channel went out of the - // congestion state. - // - - handleCongestion(); - - return 1; - -ChannelFlushError: - - finish_ = 1; - - return -1; -} - -void Channel::handleResetAlert() -{ - if (alert_ != 0) - { - #ifdef TEST - *logofs << "handleResetAlert: The channel alert '" - << alert_ << "' was displaced.\n" - << logofs_flush; - #endif - - alert_ = 0; - } -} - -int Channel::handleCompress(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned int offset, const unsigned char *buffer, - const unsigned int size, unsigned char *&compressedData, - unsigned int &compressedDataSize) -{ - if (size <= offset) - { - #ifdef DEBUG - *logofs << "handleCompress: Not compressing data for FD#" << fd_ - << " as offset is " << offset << " with data size " - << size << ".\n" << logofs_flush; - #endif - - return 0; - } - - #ifdef DEBUG - *logofs << "handleCompress: Compressing data for FD#" << fd_ - << " with data size " << size << " and offset " - << offset << ".\n" << logofs_flush; - #endif - - // - // It is responsibility of the compressor to - // mark the buffer as such if the compression - // couldn't take place. - // - - if (compressor_ -> compressBuffer(buffer + offset, size - offset, compressedData, - compressedDataSize, encodeBuffer) <= 0) - { - #ifdef DEBUG - *logofs << "handleCompress: Sent " << size - offset - << " bytes of plain data for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - return 0; - } - else - { - #ifdef DEBUG - *logofs << "handleCompress: Sent " << compressedDataSize - << " bytes of compressed data for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return 1; - } -} - -int Channel::handleDecompress(DecodeBuffer &decodeBuffer, const unsigned char opcode, - const unsigned int offset, unsigned char *buffer, - const unsigned int size, const unsigned char *&compressedData, - unsigned int &compressedDataSize) -{ - if (size <= offset) - { - return 0; - } - - int result = compressor_ -> decompressBuffer(buffer + offset, size - offset, - compressedData, compressedDataSize, - decodeBuffer); - if (result < 0) - { - #ifdef PANIC - *logofs << "handleDecompress: PANIC! Failed to decompress " - << size - offset << " bytes of data for FD#" << fd_ - << " with OPCODE#" << (unsigned int) opcode << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Data decompression failed for OPCODE#" - << (unsigned int) opcode << ".\n"; - - return -1; - } - else if (result == 0) - { - #ifdef DEBUG - *logofs << "handleDecompress: Received " << size - offset - << " bytes of plain data for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - return 0; - } - else - { - #ifdef DEBUG - *logofs << "handleDecompress: Received " << compressedDataSize - << " bytes of compressed data for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - return 1; - } -} - -int Channel::handleCleanAndNullRequest(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - #ifdef TEST - *logofs << "handleCleanAndNullRequest: Removing the previous data " - << "and sending an X_NoOperation " << "for FD#" << fd_ - << " due to OPCODE#" << (unsigned int) opcode << " (" - << DumpOpcode(opcode) << ").\n" << logofs_flush; - #endif - - writeBuffer_.removeMessage(size - 4); - - size = 4; - opcode = X_NoOperation; - - return 1; -} - -int Channel::handleNullRequest(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - #ifdef TEST - *logofs << "handleNullRequest: Sending an X_NoOperation for FD#" - << fd_ << " due to OPCODE#" << (unsigned int) opcode - << " (" << DumpOpcode(opcode) << ").\n" - << logofs_flush; - #endif - - size = 4; - buffer = writeBuffer_.addMessage(size); - opcode = X_NoOperation; - - return 1; -} - -void Channel::handleSplitStoreError(int resource) -{ - if (resource < 0 || resource >= CONNECTIONS_LIMIT) - { - #ifdef PANIC - *logofs << "handleSplitStoreError: PANIC! Resource " - << resource << " is out of range with limit " - << "set to " << CONNECTIONS_LIMIT << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Resource " << resource - << " is out of range with limit set to " - << CONNECTIONS_LIMIT << ".\n"; - - HandleCleanup(); - } - else - { - #ifdef PANIC - *logofs << "handleSplitStoreError: PANIC! Cannot " - << "allocate the split store for resource " - << resource << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot allocate the " - << "split store for resource " << resource - << ".\n"; - - HandleCleanup(); - } -} - -void Channel::handleSplitStoreAlloc(List *list, int resource) -{ - if (resource < 0 || resource >= CONNECTIONS_LIMIT) - { - handleSplitStoreError(resource); - } - - if (clientStore_ -> getSplitStore(resource) == NULL) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitStoreAlloc: Allocating a new " - << "split store for resource " << resource - << ".\n" << logofs_flush; - #endif - - SplitStore *splitStore = clientStore_ -> createSplitStore(resource); - - if (splitStore == NULL) - { - handleSplitStoreError(resource); - } - - list -> add(resource); - } - #if defined(TEST) || defined(SPLIT) - else - { - // - // Old proxy versions only use a single - // split store. - // - - if (resource != 0) - { - *logofs << "handleSplitStoreAlloc: WARNING! A split " - << "store for resource " << resource - << " already exists.\n" << logofs_flush; - } - } - #endif -} - -void Channel::handleSplitStoreRemove(List *list, int resource) -{ - if (resource < 0 || resource >= CONNECTIONS_LIMIT) - { - handleSplitStoreError(resource); - } - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore != NULL) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitStoreRemove: Deleting the " - << "split store for resource " << resource - << ".\n" << logofs_flush; - #endif - - clientStore_ -> destroySplitStore(resource); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitStoreRemove: Deleting resource " - << resource << " from the list " << ".\n" - << logofs_flush; - #endif - - list -> remove(resource); - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleSplitStoreRemove: WARNING! A split " - << "store for resource " << resource - << " does not exist.\n" << logofs_flush; - } - #endif -} - -Split *Channel::handleSplitCommitRemove(int request, int resource, int position) -{ - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitCommitRemove: SPLIT! Checking split " - << "commit with resource " << resource << " request " - << request << " and position " << position - << ".\n" << logofs_flush; - #endif - - // - // Remove the split from the split queue. - // - - CommitStore *commitStore = clientStore_ -> getCommitStore(); - - Split *split = commitStore -> pop(); - - if (split == NULL) - { - #ifdef PANIC - *logofs << "handleSplitCommitRemove: PANIC! Can't " - << "find the split in the commit queue.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't find the " - << "split in the commit queue.\n"; - - HandleCleanup(); - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitCommitRemove: SPLIT! Element from " - << "the queue has resource " << split -> getResource() - << " request " << split -> getRequest() << " and " - << "position " << split -> getPosition() - << ".\n" << logofs_flush; - #endif - - // Since ProtoStep7 (#issue 108) - if (resource != split -> getResource() || - request != split -> getRequest() || - position != split -> getPosition()) - { - #ifdef PANIC - *logofs << "handleSplitCommitRemove: PANIC! The data in " - << "the split doesn't match the commit request.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": The data in the split doesn't " - << "match the commit request.\n"; - - return NULL; - } - - #if defined(TEST) || defined(SPLIT) - - commitStore -> dump(); - - #endif - - return split; -} - -int Channel::setReferences() -{ - #ifdef TEST - *logofs << "Channel: Initializing the static " - << "members for the base class.\n" - << logofs_flush; - #endif - - firstClient_ = -1; - - fontPort_ = -1; - - #ifdef REFERENCES - - references_ = 0; - - #endif - - return 1; -} - -int Channel::setOpcodes(OpcodeStore *opcodeStore) -{ - opcodeStore_ = opcodeStore; - - #ifdef TEST - *logofs << "setOpcodes: Propagated opcodes store to channel " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return 1; -} - -int Channel::setStores(ClientStore *clientStore, ServerStore *serverStore) -{ - clientStore_ = clientStore; - serverStore_ = serverStore; - - #ifdef TEST - *logofs << "setStores: Propagated message stores to channel " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return 1; -} - -int Channel::setCaches(ClientCache *clientCache, ServerCache *serverCache) -{ - clientCache_ = clientCache; - serverCache_ = serverCache; - - #ifdef TEST - *logofs << "setCaches: Propagated encode caches to channel " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/Channel.h b/nxcomp/Channel.h deleted file mode 100644 index 93b022630..000000000 --- a/nxcomp/Channel.h +++ /dev/null @@ -1,664 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Channel_H -#define Channel_H - -#include "Transport.h" - -#include "WriteBuffer.h" - -#include "OpcodeStore.h" - -#include "ClientStore.h" -#include "ServerStore.h" - -#include "ClientCache.h" -#include "ServerCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Forward declaration of referenced classes. -// - -class List; - -class StaticCompressor; - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to log a line when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// Type of traffic carried by channel. -// - -typedef enum -{ - channel_none = -1, - channel_x11, - channel_cups, - channel_smb, - channel_media, - channel_http, - channel_font, - channel_slave, - channel_last_tag - -} T_channel_type; - -// -// Type of notification event to be sent -// by proxy to the X channel. -// - -typedef enum -{ - notify_no_split, - notify_start_split, - notify_commit_split, - notify_end_split, - notify_empty_split, - -} T_notification_type; - -class Channel -{ - public: - - // - // Maximum number of X connections supported. - // - - static const int CONNECTIONS_LIMIT = 256; - - Channel(Transport *transport, StaticCompressor *compressor); - - virtual ~Channel(); - - // - // Read any X message available on the X - // connection and encode it to the encode - // buffer. - // - - virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length) = 0; - - // - // Decode any X message encoded in the - // proxy message and write it to the X - // connection. - // - - virtual int handleWrite(const unsigned char *message, unsigned int length) = 0; - - // - // Other methods to be implemented in - // client, server and generic channel - // classes. - // - - virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, - T_store_action action, int position, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) = 0; - - virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, - T_store_action action, int position, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) = 0; - - virtual int handleSplit(EncodeBuffer &encodeBuffer) = 0; - - virtual int handleSplit(DecodeBuffer &decodeBuffer) = 0; - - virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split) = 0; - - virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) = 0; - - virtual int handleMotion(EncodeBuffer &encodeBuffer) = 0; - - virtual int handleCompletion(EncodeBuffer &encodeBuffer) = 0; - - virtual int handleConfiguration() = 0; - - virtual int handleFinish() = 0; - - // - // Interleave reads of the available - // events while writing data to the - // channel socket. - // - - virtual int handleAsyncEvents() = 0; - - // - // Handle the channel tear down. - // - - int handleClosing() - { - closing_ = 1; - - return 1; - } - - int handleDrop() - { - drop_ = 1; - - return 1; - } - - // - // Try to read more data from the socket. In - // the meanwhile flush any enqueued data if - // the channel is blocked. Return as soon as - // more data has been read or the timeout has - // been exceeded. - // - - int handleWait(int timeout); - - // - // Drain the output buffer while handling the - // data that may become readable. - // - - int handleDrain(int timeout, int limit); - - // - // Flush any remaining data in the transport - // buffer. - // - - int handleFlush(); - - // - // Called when the loop has replaced or - // closed a previous alert. - // - - void handleResetAlert(); - - // - // Initialize all the static members. - // - - static int setReferences(); - - // - // Set pointer to object mapping opcodes - // of NX specific messages. - // - - int setOpcodes(OpcodeStore *opcodeStore); - - // - // Update pointers to message stores in - // channels. - // - - int setStores(ClientStore *clientStore, ServerStore *serverStore); - - // - // The same for channels caches. - // - - int setCaches(ClientCache *clientCache, ServerCache *serverCache); - - // - // Set the port used for tunneling of the - // font server connections. - // - - void setPorts(int fontPort) - { - fontPort_ = fontPort; - } - - // - // Check if there are pending split - // to send to the remote side. - // - - virtual int needSplit() const = 0; - - // - // Check if there are motion events - // to flush. - // - - virtual int needMotion() const = 0; - - // - // Return the type of traffic carried - // by this channel. - // - - virtual T_channel_type getType() const = 0; - - // - // Check if the channel has been marked - // as closing down. - // - - int getFinish() const - { - return finish_; - } - - int getClosing() - { - return closing_; - } - - int getDrop() - { - return drop_; - } - - int getCongestion() - { - return congestion_; - } - - protected: - - int handleFlush(T_flush type) - { - // - // We could write the data immediately if there - // is already something queued to the low level - // TCP buffers. - // - // if (... || transport_ -> queued() > 0) - // { - // ... - // } - // - - if (writeBuffer_.getScratchLength() > 0 || - (type == flush_if_any && writeBuffer_.getLength() > 0) || - writeBuffer_.getLength() >= (unsigned int) - control -> TransportFlushBufferSize) - { - return handleFlush(type, writeBuffer_.getLength(), - writeBuffer_.getScratchLength()); - } - - return 0; - } - - // - // Actually flush the data to the - // channel descriptor. - // - - int handleFlush(T_flush type, int bufferLength, int scratchLength); - - // - // Handle the congestion changes. - // - - int handleCongestion(); - - // - // Encode and decode X messages. - // - - int handleEncode(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, - MessageStore *store, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - int handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, - MessageStore *store, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Encode the message based on its - // message store. - // - - int handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, - MessageStore *store, const unsigned char *buffer, - const unsigned int size); - - int handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, - MessageStore *store, unsigned char *&buffer, - unsigned int &size); - - int handleEncodeIdentity(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, - MessageStore *store, const unsigned char *buffer, - const unsigned int size, int bigEndian) - { - return (store -> encodeIdentity(encodeBuffer, buffer, size, - bigEndian, channelCache)); - } - - int handleDecodeIdentity(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, - MessageStore *store, unsigned char *&buffer, - unsigned int &size, int bigEndian, - WriteBuffer *writeBuffer) - { - return (store -> decodeIdentity(decodeBuffer, buffer, size, bigEndian, - writeBuffer, channelCache)); - } - - // - // Other utility functions used by - // the encoding and decoding methods. - // - - void handleCopy(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned int offset, const unsigned char *buffer, - const unsigned int size) - { - if (size > offset) - { - encodeBuffer.encodeMemory(buffer + offset, size - offset); - } - } - - void handleCopy(DecodeBuffer &decodeBuffer, const unsigned char opcode, - const unsigned int offset, unsigned char *buffer, - const unsigned int size) - { - if (size > offset) - { - memcpy(buffer + offset, decodeBuffer.decodeMemory(size - offset), size - offset); - } - } - - void handleUpdate(MessageStore *store, const unsigned int dataSize, - const unsigned int compressedDataSize) - { - if (store -> lastAction == IS_ADDED) - { - handleUpdateAdded(store, dataSize, compressedDataSize); - } - } - - void handleSave(MessageStore *store, unsigned char *buffer, unsigned int size, - const unsigned char *compressedData = NULL, - const unsigned int compressedDataSize = 0) - { - if (store -> lastAction == IS_ADDED) - { - handleSaveAdded(store, 0, buffer, size, compressedData, compressedDataSize); - } - } - - void handleSaveSplit(MessageStore *store, unsigned char *buffer, - unsigned int size) - { - if (store -> lastAction == IS_ADDED) - { - return handleSaveAdded(store, 1, buffer, size, 0, 0); - } - } - - void handleUpdateAdded(MessageStore *store, const unsigned int dataSize, - const unsigned int compressedDataSize); - - void handleSaveAdded(MessageStore *store, int split, unsigned char *buffer, - unsigned int size, const unsigned char *compressedData, - const unsigned int compressedDataSize); - - // - // Compress the data part of a message - // using ZLIB or another compressor - // and send it over the network. - // - - int handleCompress(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned int offset, const unsigned char *buffer, - const unsigned int size, unsigned char *&compressedData, - unsigned int &compressedDataSize); - - int handleDecompress(DecodeBuffer &decodeBuffer, const unsigned char opcode, - const unsigned int offset, unsigned char *buffer, - const unsigned int size, const unsigned char *&compressedData, - unsigned int &compressedDataSize); - - // - // Send an X_NoOperation to the X server. - // The second version also removes any - // previous data in the write buffer. - // - - int handleNullRequest(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - int handleCleanAndNullRequest(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - // - // X11 channels are considered to be in - // congestion state when there was a - // blocking write and, since then, the - // local end didn't consume all the data. - // - - virtual int isCongested() - { - return (transport_ -> getType() != - transport_agent && transport_ -> length() > - control -> TransportFlushBufferSize); - } - - virtual int isReliable() - { - return 1; - } - - // - // Determine how to handle allocation - // of new messages in the message - // stores. - // - - int mustCleanStore(MessageStore *store) - { - return (store -> getRemoteTotalStorageSize() > control -> - RemoteTotalStorageSize || store -> getLocalTotalStorageSize() > - control -> LocalTotalStorageSize || (store -> getRemoteStorageSize() > - (control -> RemoteTotalStorageSize / 100 * store -> - cacheThreshold)) || (store -> getLocalStorageSize() > - (control -> LocalTotalStorageSize / 100 * store -> - cacheThreshold))); - } - - int canCleanStore(MessageStore *store) - { - return ((store -> getSize() > 0 && (store -> getRemoteStorageSize() > - (control -> RemoteTotalStorageSize / 100 * store -> - cacheLowerThreshold))) || (store -> getLocalStorageSize() > - (control -> LocalTotalStorageSize / 100 * store -> - cacheLowerThreshold))); - } - - protected: - - // - // Set up the split stores. - // - - void handleSplitStoreError(int resource); - - void handleSplitStoreAlloc(List *list, int resource); - void handleSplitStoreRemove(List *list, int resource); - - Split *handleSplitCommitRemove(int request, int resource, int position); - - void validateSize(const char *name, int input, int output, - int offset, int size) - { - if (size < offset || size > control -> MaximumMessageSize || - size != (int) RoundUp4(input) + offset || - output > control -> MaximumMessageSize) - { - *logofs << "Channel: PANIC! Invalid size " << size - << " for " << name << " output with data " - << input << "/" << output << "/" << offset - << "/" << size << ".\n" << logofs_flush; - - cerr << "Error" << ": Invalid size " << size - << " for " << name << " output.\n"; - - HandleAbort(); - } - } - - // - // Is the X client big endian? - // - - int bigEndian() const - { - return bigEndian_; - } - - int bigEndian_; - - // - // Other X server's features - // saved at session startup. - // - - unsigned int imageByteOrder_; - unsigned int bitmapBitOrder_; - unsigned int scanlineUnit_; - unsigned int scanlinePad_; - - int firstRequest_; - int firstReply_; - - // - // Use this class for IO operations. - // - - Transport *transport_; - - // - // The static compressor is created by the - // proxy and shared among channels. - // - - StaticCompressor *compressor_; - - // - // Map NX operations to opcodes. Propagated - // by proxy to all channels on the same X - // server. - // - - OpcodeStore *opcodeStore_; - - // - // Also stores are shared between channels. - // - - ClientStore *clientStore_; - ServerStore *serverStore_; - - // - // Caches are specific for each channel. - // - - ClientCache *clientCache_; - ServerCache *serverCache_; - - // - // Data going to X connection. - // - - WriteBuffer writeBuffer_; - - // - // Other data members. - // - - int fd_; - - int finish_; - int closing_; - int drop_; - int congestion_; - int priority_; - - int alert_; - - // - // It will be set to the descriptor of the - // first X channel that is successfully con- - // nected and will print an info message on - // standard error. - // - - static int firstClient_; - - // - // Port used for font server connections. - // - - static int fontPort_; - - // - // Track which cache operations have been - // enabled by the agent. - // - - int enableCache_; - int enableSplit_; - int enableSave_; - int enableLoad_; - - // - // Keep track of object creation and - // deletion. - // - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -#endif /* Channel_H */ diff --git a/nxcomp/ChannelCache.cpp b/nxcomp/ChannelCache.cpp deleted file mode 100644 index 5c4c360b9..000000000 --- a/nxcomp/ChannelCache.cpp +++ /dev/null @@ -1,64 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ChannelCache.h" - -const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7] = -{ - 16, // x - 16, // y - 16, // width - 16, // height - 16, // border width - 29, // sibling window - 3 // stack mode -}; - -const unsigned int CREATEGC_FIELD_WIDTH[23] = -{ - 4, // function - 32, // plane mask - 32, // foreground - 32, // background - 16, // line width - 2, // line style - 2, // cap style - 2, // join style - 2, // fill style - 1, // fill rule - 29, // tile - 29, // stipple - 16, // tile/stipple x origin - 16, // tile/stipple y origin - 29, // font - 1, // subwindow mode - 1, // graphics exposures - 16, // clip x origin - 16, // clip y origin - 29, // clip mask - 16, // card offset - 8, // dashes - 1 // arc mode -}; diff --git a/nxcomp/ChannelCache.h b/nxcomp/ChannelCache.h deleted file mode 100644 index 6a29c3847..000000000 --- a/nxcomp/ChannelCache.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ChannelCache_H -#define ChannelCache_H - -// -// Sizes of optional fields for ConfigureWindow -// request. -// - -extern const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7]; - -// -// Sizes of optional fields for CreateGC request. -// - -extern const unsigned int CREATEGC_FIELD_WIDTH[23]; - -// -// This is just needed to provide a pointer -// to the base cache class in encoding and -// decoding procedures of message stores. -// - -class ChannelCache -{ - public: - - ChannelCache() - { - } - - ~ChannelCache() - { - } -}; - -#endif /* ChannelCache_H */ diff --git a/nxcomp/ChannelEndPoint.cpp b/nxcomp/ChannelEndPoint.cpp deleted file mode 100644 index 286210dc7..000000000 --- a/nxcomp/ChannelEndPoint.cpp +++ /dev/null @@ -1,345 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include - -#include "ChannelEndPoint.h" - -#include "NXalert.h" - -ChannelEndPoint::ChannelEndPoint(const char *spec) - : defaultTCPPort_(0), defaultTCPInterface_(0), - defaultUnixPath_(NULL), spec_(NULL) { - setSpec(spec); -} - -ChannelEndPoint::~ChannelEndPoint() -{ - char *unixPath = NULL; - - if (getUnixPath(&unixPath)) - { - struct stat st; - lstat(unixPath, &st); - if(S_ISSOCK(st.st_mode)) - unlink(unixPath); - } -} - -void -ChannelEndPoint::setSpec(const char *spec) { - if (spec_) free(spec_); - - if (spec && strlen(spec)) - { - spec_ = strdup(spec); - isUnix_ = getUnixPath(); - isTCP_ = getTCPHostAndPort(); - } - else - { - spec_ = NULL; - isUnix_ = false; - isTCP_ = false; - } -} - -void -ChannelEndPoint::setSpec(long port) { - if (port >= 0) { - char tmp[20]; - sprintf(tmp, "%ld", port); - setSpec(tmp); - } - else { - disable(); - } -} - -void -ChannelEndPoint::setSpec(const char *hostName, long port) { - int length; - - if (spec_) free(spec_); - isUnix_ = false; - isTCP_ = false; - - if (hostName && strlen(hostName) && port >= 1) - { - length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); - spec_ = (char *)calloc(length + 1, sizeof(char)); - snprintf(spec_, length+1, "tcp:%s:%ld", hostName, port); - isTCP_ = true; - } - else setSpec((char*)NULL); -} - -bool -ChannelEndPoint::getSpec(char **socketUri) const { - - if (socketUri) *socketUri = NULL; - - char *unixPath = NULL; - char *hostName = NULL; - long port = -1; - - char *newSocketUri = NULL; - int length = -1; - - if (getUnixPath(&unixPath)) - { - length = snprintf(NULL, 0, "unix:%s", unixPath); - } - else if (getTCPHostAndPort(&hostName, &port)) - { - length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); - } - - if (length > 0) - { - newSocketUri = (char *)calloc(length + 1, sizeof(char)); - if (isUnixSocket()) - snprintf(newSocketUri, length+1, "unix:%s", unixPath); - else - snprintf(newSocketUri, length+1, "tcp:%s:%ld", hostName, port); - - if (socketUri) - *socketUri = strdup(newSocketUri); - } - - free(newSocketUri); - free(unixPath); - free(hostName); - - if (NULL != *socketUri) - return true; - - return false; -} - -void -ChannelEndPoint::setDefaultTCPPort(long port) { - defaultTCPPort_ = port; -} - -void -ChannelEndPoint::setDefaultTCPInterface(int publicInterface) { - defaultTCPInterface_ = publicInterface; -} - -void -ChannelEndPoint::setDefaultUnixPath(char *path) { - if (defaultUnixPath_) free(defaultUnixPath_); - - if (path && strlen(path)) - defaultUnixPath_ = strdup(path); - else - defaultUnixPath_ = NULL; -} - -void -ChannelEndPoint::disable() { - setSpec("0"); -} - -bool -ChannelEndPoint::getPort(long *port) const { - if (port) *port = 0; - long p = -1; - if (spec_) { - char *end; - p = strtol(spec_, &end, 10); - if ((end == spec_) || (*end != '\0')) - return false; - } - - if (port) *port = p; - return true; -} - -bool -ChannelEndPoint::getUnixPath(char **unixPath) const { - - if (unixPath) *unixPath = 0; - - long p; - char *path = NULL; - - if (getPort(&p)) { - if (p != 1) return false; - } - else if (spec_ && (strncmp("unix:", spec_, 5) == 0)) { - path = spec_ + 5; - } - else - return false; - - if (!path || (*path == '\0')) { - path = defaultUnixPath_; - if (!path) - return false; - } - - if (unixPath) - *unixPath = strdup(path); - - return true; -} - -bool -ChannelEndPoint::isUnixSocket() const { - return isUnix_; -} - -// FIXME!!! -static const char * -getComputerName() { - // - // Strangely enough, under some Windows OSes SMB - // service doesn't bind to localhost. Fall back - // to localhost if can't find computer name in - // the environment. In future we should try to - // bind to localhost and then try the other IPs. - // - - const char *hostname = NULL; - - #ifdef __CYGWIN32__ - - hostname = getenv("COMPUTERNAME"); - - #endif - - if (hostname == NULL) - { - hostname = "localhost"; - } - - return hostname; -} - -bool -ChannelEndPoint::getTCPHostAndPort(char **host, long *port) const { - long p; - char *h = NULL; - ssize_t h_len; - - if (host) *host = NULL; - if (port) *port = 0; - - if (getPort(&p)) { - h_len = 0; - } - else if (spec_ && (strncmp("tcp:", spec_, 4) == 0)) { - h = spec_ + 4; - char *colon = strrchr(h, ':'); - if (colon) { - char *end; - h_len = colon++ - h; - p = strtol(colon, &end, 10); - if ((end == colon) || (*end != '\0')) - return false; - } - else { - h_len = strlen(h); - p = 1; - } - } - else - return false; - - if (p == 1) p = defaultTCPPort_; - if (p < 1) return false; - - if (port) - *port = p; - - if (host) - *host = ( h_len - ? strndup(h, h_len) - : strdup(defaultTCPInterface_ ? getComputerName() : "localhost")); - - return true; -} - -bool -ChannelEndPoint::isTCPSocket() const { - return isTCP_; -} - -long ChannelEndPoint::getTCPPort() const { - long port; - if (getTCPHostAndPort(NULL, &port)) return port; - return -1; -} - -bool -ChannelEndPoint::enabled() const { - return (isUnixSocket() || isTCPSocket()); -} - -bool -ChannelEndPoint::validateSpec() { - isTCP_ = getTCPHostAndPort(); - isUnix_ = getUnixPath(); - return ( getPort() || isUnix_ || isTCP_ ); -} - -ChannelEndPoint &ChannelEndPoint::operator=(const ChannelEndPoint &other) { - char *old; - defaultTCPPort_ = other.defaultTCPPort_; - defaultTCPInterface_ = other.defaultTCPInterface_; - old = defaultUnixPath_; - defaultUnixPath_ = (other.defaultUnixPath_ ? strdup(other.defaultUnixPath_) : NULL); - free(old); - old = spec_; - spec_ = (other.spec_ ? strdup(other.spec_) : NULL); - free(old); - isUnix_ = getUnixPath(); - isTCP_ = getTCPHostAndPort(); - return *this; -} - -std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint) { - if (endPoint.enabled()) { - char* endPointSpec = NULL; - if (endPoint.getSpec(&endPointSpec)) - { - os << endPointSpec; - free(endPointSpec); - } - else - os << "(invalid)"; - } - else - { - os << "(disabled)"; - } - return os; -} diff --git a/nxcomp/ChannelEndPoint.h b/nxcomp/ChannelEndPoint.h deleted file mode 100644 index 4c0c728f3..000000000 --- a/nxcomp/ChannelEndPoint.h +++ /dev/null @@ -1,71 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ChannelEndPoint_H -#define ChannelEndPoint_H - -#include -#include - -class ChannelEndPoint -{ - private: - long defaultTCPPort_; - int defaultTCPInterface_; // 0=localhost, otherwise IP of public interface. - char *defaultUnixPath_; - char *spec_; - bool isUnix_; - bool isTCP_; - - bool getPort(long *port = NULL) const; - - public: - ChannelEndPoint(const char *spec = NULL); - ~ChannelEndPoint(); - ChannelEndPoint &operator=(const ChannelEndPoint &other); - - bool enabled() const; - bool disabled() { return !enabled(); } - void disable(); - void setSpec(const char *spec); - void setSpec(long port); - void setSpec(const char *hostName, long port); - bool getSpec(char **socketUri) const; - void setDefaultTCPPort(long port); - void setDefaultTCPInterface(int publicInterface); - void setDefaultUnixPath(char *path); - - bool getUnixPath(char **path = NULL) const; - bool isUnixSocket() const; - bool getTCPHostAndPort(char **hostname = NULL, long *port = NULL) const; - long getTCPPort() const; - bool isTCPSocket() const; - - bool validateSpec(); -}; - -std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint); - -#endif diff --git a/nxcomp/ChannelStore.h b/nxcomp/ChannelStore.h deleted file mode 100644 index 53bb60f73..000000000 --- a/nxcomp/ChannelStore.h +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ChannelStore_H -#define ChannelStore_H - -// -// One message store for each opcode. -// - -#define CHANNEL_STORE_OPCODE_LIMIT 256 - -// -// One split store for each resource. -// - -#define CHANNEL_STORE_RESOURCE_LIMIT 256 - -class ChannelStore -{ - public: - - ChannelStore() - { - } - - virtual ~ChannelStore() - { - } -}; - -#endif /* ChannelStore_H */ diff --git a/nxcomp/CharCache.cpp b/nxcomp/CharCache.cpp deleted file mode 100644 index 88e66e3da..000000000 --- a/nxcomp/CharCache.cpp +++ /dev/null @@ -1,69 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "CharCache.h" - -int CharCache::lookup(unsigned char value, unsigned int &index) -{ - for (unsigned int i = 0; i < length_; i++) - if (value == buffer_[i]) - { - index = i; - if (i) - { - unsigned int target = (i >> 1); - do - { - buffer_[i] = buffer_[i - 1]; - i--; - } - while (i > target); - buffer_[target] = value; - } - return 1; - } - insert(value); - return 0; -} - -void CharCache::insert(unsigned char value) -{ - unsigned int insertionPoint = 0; - if (2 >= length_) - insertionPoint = length_; - else - insertionPoint = 2; - unsigned int start; - if (length_ >= 7) - start = 7 - 1; - else - { - start = length_; - length_++; - } - for (unsigned int k = start; k > insertionPoint; k--) - buffer_[k] = buffer_[k - 1]; - buffer_[insertionPoint] = value; -} diff --git a/nxcomp/CharCache.h b/nxcomp/CharCache.h deleted file mode 100644 index b8891d2df..000000000 --- a/nxcomp/CharCache.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef CharCache_H -#define CharCache_H - -// -// CharCache is a counterpart of IntCache that is -// optimized for use in compressing text composed -// of 8-bit characters. -// - -class CharCache -{ - public: - - CharCache() : length_(0) - { - } - - ~CharCache() - { - } - - unsigned int getSize() const - { - return (unsigned int) length_; - } - - int lookup(unsigned char value, unsigned int &index); - - // - // This can be inlined as it is only - // called by decodeCachedValue(). - // - - unsigned int get(unsigned int index) - { - unsigned char result = buffer_[index]; - - if (index != 0) - { - unsigned int i = index; - unsigned int target = (i >> 1); - - do - { - buffer_[i] = buffer_[i - 1]; - - i--; - } - while (i > target); - - buffer_[target] = result; - } - - return (unsigned int) result; - } - - void insert(unsigned char value); - - private: - - unsigned char length_; - - unsigned char buffer_[7]; -}; - -#endif /* CharCache_H */ diff --git a/nxcomp/Children.cpp b/nxcomp/Children.cpp deleted file mode 100644 index 265ba4e37..000000000 --- a/nxcomp/Children.cpp +++ /dev/null @@ -1,1055 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include - -#include "NX.h" - -#include "Misc.h" - -#include "Types.h" -#include "Timestamp.h" - -#include "Control.h" -#include "Statistics.h" -#include "Proxy.h" - -#include "Keeper.h" -#include "Fork.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define DISPLAY_LENGTH_LIMIT 256 -#define DEFAULT_STRING_LIMIT 512 - -// -// These are from the main loop. -// - -extern Keeper *keeper; - -extern int (*handler)(int); - -extern int useUnixSocket; - -extern int lastDialog; -extern int lastWatchdog; -extern int lastKeeper; - -extern void CleanupListeners(); -extern void CleanupSockets(); -extern void CleanupAgent(); -extern void CleanupGlobal(); - -extern void InstallSignals(); - -extern char *GetClientPath(); - -extern int CheckParent(const char *name, const char *type, - int parent); - -#ifdef __sun -extern char **environ; -#endif - -// -// Close all the unused descriptors and -// install any signal handler that might -// have been disabled in the main process. -// - -static void SystemCleanup(const char *name); - -// -// Release all objects allocated in the -// heap. - -static void MemoryCleanup(const char *name); - -// -// Remove 'name' from the environment. -// - -static int UnsetEnv(const char *name); - -static int NXTransKeeperHandler(int signal); -static void NXTransKeeperCheck(); - - -// -// Start a nxclient process in dialog mode. -// - -int NXTransDialog(const char *caption, const char *message, - const char *window, const char *type, int local, - const char* display) -{ - // - // Be sure log file is valid. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - int pid; - - #ifdef TEST - *logofs << "NXTransDialog: Going to fork with NX pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - pid = Fork(); - - if (pid != 0) - { - if (pid < 0) - { - #ifdef TEST - *logofs << "NXTransDialog: WARNING! Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - #ifdef TEST - else - { - *logofs << "NXTransDialog: Created NX dialog process " - << "with pid '" << pid << "'.\n" - << logofs_flush; - } - #endif - - return pid; - } - - #ifdef TEST - *logofs << "NXTransDialog: Executing child with pid '" - << getpid() << "' and parent '" << getppid() - << "'.\n" << logofs_flush; - #endif - - SystemCleanup("NXTransDialog"); - - // - // Copy the client command before - // freeing up the control class. - // - - char command[DEFAULT_STRING_LIMIT]; - - if (control != NULL) - { - strcpy(command, control -> ClientPath); - } - else - { - char *path = GetClientPath(); - - strcpy(command, path); - - delete [] path; - } - - // - // Get rid of the unused resources. - // - - MemoryCleanup("NXTransDialog"); - - #ifdef TEST - *logofs << "NXTransDialog: Running external NX dialog with caption '" - << caption << "' message '" << message << "' type '" - << type << "' local '" << local << "' display '" - << display << "'.\n" - << logofs_flush; - #endif - - int pulldown = (strcmp(type, "pulldown") == 0); - - char parent[DEFAULT_STRING_LIMIT]; - - snprintf(parent, DEFAULT_STRING_LIMIT, "%d", getppid()); - - parent[DEFAULT_STRING_LIMIT - 1] = '\0'; - - UnsetEnv("LD_LIBRARY_PATH"); - - for (int i = 0; i < 2; i++) - { - if (local != 0) - { - if (pulldown) - { - execlp(command, command, "--dialog", type, "--caption", caption, - "--window", window, "--local", "--parent", parent, - "--display", display, NULL); - } - else - { - execlp(command, command, "--dialog", type, "--caption", caption, - "--message", message, "--local", "--parent", parent, - "--display", display, NULL); - } - } - else - { - if (pulldown) - { - execlp(command, command, "--dialog", type, "--caption", caption, - "--window", window, "--parent", parent, - "--display", display, NULL); - } - else - { - execlp(command, command, "--dialog", type, "--caption", caption, - "--message", message, "--parent", parent, - "--display", display, NULL); - } - } - - #ifdef WARNING - *logofs << "NXTransDialog: WARNING! Couldn't start '" - << command << "'. " << "Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Couldn't start '" << command - << "'. Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - // - // Retry by looking for the default name - // in the default NX path. - // - - if (i == 0) - { - - strcpy(command, "nxclient"); - - char newPath[DEFAULT_STRING_LIMIT]; - - strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:"); - - #ifdef __APPLE__ - - strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:"); - - #endif - - #ifdef __CYGWIN32__ - - strcat(newPath, ".:"); - - #endif - - int newLength = strlen(newPath); - - char *oldPath = getenv("PATH"); - - strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1); - - newPath[DEFAULT_STRING_LIMIT - 1] = '\0'; - - #ifdef WARNING - *logofs << "NXTransDialog: WARNING! Trying with path '" - << newPath << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Trying with path '" << newPath - << "'.\n"; - - // - // Solaris doesn't seem to have - // function setenv(). - // - - #ifdef __sun - - char newEnv[DEFAULT_STRING_LIMIT + 5]; - - sprintf(newEnv,"PATH=%s", newPath); - - putenv(newEnv); - - #else - - setenv("PATH", newPath, 1); - - #endif - - } - } - - // - // Hopefully useless. - // - - exit(0); -} - -// -// Start a nxclient process in dialog mode. -// - -int NXTransClient(const char* display) -{ - // - // Be sure log file is valid. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - int pid; - - #ifdef TEST - *logofs << "NXTransClient: Going to fork with NX pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - pid = Fork(); - - if (pid != 0) - { - if (pid < 0) - { - #ifdef TEST - *logofs << "NXTransClient: WARNING! Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - #ifdef TEST - else - { - *logofs << "NXTransClient: Created NX client process " - << "with pid '" << pid << "'.\n" - << logofs_flush; - } - #endif - - return pid; - } - - #ifdef TEST - *logofs << "NXTransClient: Executing child with pid '" - << getpid() << "' and parent '" << getppid() - << "'.\n" << logofs_flush; - #endif - - SystemCleanup("NXTransClient"); - - // - // Copy the client command before - // freeing up the control class. - // - - char command[DEFAULT_STRING_LIMIT]; - - if (control != NULL) - { - strcpy(command, control -> ClientPath); - } - else - { - char *path = GetClientPath(); - - strcpy(command, path); - - delete [] path; - } - - // - // Get rid of unused resources. - // - - MemoryCleanup("NXTransClient"); - - #ifdef TEST - *logofs << "NXTransClient: Running external NX client with display '" - << display << "'.\n" << logofs_flush; - #endif - - // - // Provide the display in the environment. - // - - char newDisplay[DISPLAY_LENGTH_LIMIT]; - - #ifdef __sun - - snprintf(newDisplay, DISPLAY_LENGTH_LIMIT - 1, "DISPLAY=%s", display); - - newDisplay[DISPLAY_LENGTH_LIMIT - 1] = '\0'; - - putenv(newDisplay); - - #else - - strncpy(newDisplay, display, DISPLAY_LENGTH_LIMIT - 1); - - newDisplay[DISPLAY_LENGTH_LIMIT - 1] = '\0'; - - setenv("DISPLAY", newDisplay, 1); - - #endif - - UnsetEnv("LD_LIBRARY_PATH"); - - for (int i = 0; i < 2; i++) - { - execlp(command, command, NULL); - - #ifdef WARNING - *logofs << "NXTransClient: WARNING! Couldn't start '" - << command << "'. Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Couldn't start '" << command - << "'. Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - // - // Retry by looking for the default name - // in the default NX path. - // - - if (i == 0) - { - - strcpy(command, "nxclient"); - - char newPath[DEFAULT_STRING_LIMIT]; - - strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:"); - - #ifdef __APPLE__ - - strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:"); - - #endif - - #ifdef __CYGWIN32__ - - strcat(newPath, ".:"); - - #endif - - int newLength = strlen(newPath); - - char *oldPath = getenv("PATH"); - - strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1); - - newPath[DEFAULT_STRING_LIMIT - 1] = '\0'; - - #ifdef WARNING - *logofs << "NXTransClient: WARNING! Trying with path '" - << newPath << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Trying with path '" << newPath - << "'.\n"; - - // - // Solaris doesn't seem to have - // function setenv(). - // - - #ifdef __sun - - char newEnv[DEFAULT_STRING_LIMIT + 5]; - - sprintf(newEnv,"PATH=%s", newPath); - - putenv(newEnv); - - #else - - setenv("PATH", newPath, 1); - - #endif - } - - } - // - // Hopefully useless. - // - - exit(0); -} - -// -// Wait until the timeout is expired. -// The timeout is expressed in milli- -// seconds. -// - -int NXTransWatchdog(int timeout) -{ - // - // Be sure log file is valid. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - int pid; - - #ifdef TEST - *logofs << "NXTransWatchdog: Going to fork with NX pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - pid = Fork(); - - if (pid != 0) - { - if (pid < 0) - { - #ifdef TEST - *logofs << "NXTransWatchdog: WARNING! Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - #ifdef TEST - else - { - *logofs << "NXTransWatchdog: Created NX watchdog process " - << "with pid '" << pid << "'.\n" << logofs_flush; - } - #endif - - return pid; - } - - int parent = getppid(); - - #ifdef TEST - *logofs << "NXTransWatchdog: Executing child with pid '" - << getpid() << "' and parent '" << parent - << "'.\n" << logofs_flush; - #endif - - SystemCleanup("NXTransWatchdog"); - - // - // Get rid of unused resources. - // - - MemoryCleanup("NXTransWatchdog"); - - // - // Run until the timeout is expired - // or forever, if no timeout is - // provided. - // - - T_timestamp startTs = getTimestamp(); - - int diffTs = 0; - - for (;;) - { - // - // Complain if the parent is dead. - // - - if (CheckParent("NXTransWatchdog", "watchdog", parent) == 0) - { - #ifdef TEST - *logofs << "NXTransWatchdog: Exiting with no parent " - << "running.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - if (timeout > 0) - { - if (diffTs >= timeout) - { - #ifdef TEST - *logofs << "NXTransWatchdog: Timeout of " << timeout - << " Ms raised in watchdog.\n" << logofs_flush; - #endif - - // - // We will just exit. Our parent should be - // monitoring us and detect that the process - // is gone. - // - - HandleCleanup(); - } - } - - if (timeout > 0) - { - #ifdef TEST - *logofs << "NXTransWatchdog: Waiting for the timeout " - << "with " << timeout - diffTs << " Ms to run.\n" - << logofs_flush; - #endif - - usleep((timeout - diffTs) * 1000); - - diffTs = diffTimestamp(startTs, getNewTimestamp()); - } - else - { - #ifdef TEST - *logofs << "NXTransWatchdog: Waiting for a signal.\n" - << logofs_flush; - #endif - - sleep(10); - } - } - - // - // Hopefully useless. - // - - exit(0); -} - -int NXTransKeeperHandler(int signal) -{ - if (keeper != NULL) - { - switch (signal) - { - case SIGTERM: - case SIGINT: - case SIGHUP: - { - #ifdef TEST - *logofs << "NXTransKeeperHandler: Requesting giveup " - << "because of signal " << signal << " ,'" - << DumpSignal(signal) << "'.\n" - << logofs_flush; - #endif - - keeper -> setSignal(signal); - - return 0; - } - } - } - - return 1; -} - -void NXTransKeeperCheck() -{ - if (CheckParent("NXTransKeeper", "keeper", - keeper -> getParent()) == 0 || keeper -> getSignal() != 0) - { - #ifdef TEST - *logofs << "NXTransKeeperCheck: Exiting because of signal " - << "or no parent running.\n" << logofs_flush; - #endif - - HandleCleanup(); - } -} - -int NXTransKeeper(int caches, int images, const char *root) -{ - // - // Be sure log file is valid. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - if (caches == 0 && images == 0) - { - #ifdef TEST - *logofs << "NXTransKeeper: No NX cache house-keeping needed.\n" - << logofs_flush; - #endif - - return 0; - } - - int pid; - - #ifdef TEST - *logofs << "NXTransKeeper: Going to fork with NX pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - pid = Fork(); - - if (pid != 0) - { - if (pid < 0) - { - #ifdef TEST - *logofs << "NXTransKeeper: WARNING! Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - #ifdef TEST - else - { - *logofs << "NXTransKeeper: Created NX keeper process " - << "with pid '" << pid << "'.\n" - << logofs_flush; - } - #endif - - return pid; - } - - int parent = getppid(); - - #ifdef TEST - *logofs << "NXTransKeeper: Executing child with pid '" - << getpid() << "' and parent '" << parent - << "'.\n" << logofs_flush; - #endif - - SystemCleanup("NXTransKeeper"); - - #ifdef TEST - *logofs << "NXTransKeeper: Going to run with caches " << caches - << " images " << images << " and root " << root - << " at " << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - // - // Create the house-keeper class. - // - - int timeout = control -> KeeperTimeout; - - keeper = new Keeper(caches, images, root, 100, parent); - - handler = NXTransKeeperHandler; - - if (keeper == NULL) - { - #ifdef PANIC - *logofs << "NXTransKeeper: PANIC! Failed to create the keeper object.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to create the keeper object.\n"; - - HandleCleanup(); - } - - // - // Get rid of unused resources. Root path - // must be copied in keeper's constructor - // before control is deleted. - // - - MemoryCleanup("NXTransKeeper"); - - // - // Decrease the priority of this process. - // - // The following applies to Cygwin: "Cygwin processes can be - // set to IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, HIGH_- - // PRIORITY_CLASS, or REALTIME_PRIORITY_CLASS with the nice - // call. If you pass a positive number to nice(), then the - // priority level will decrease by one (within the above list - // of priorities). A negative number would make it increase - // by one. It is not possible to change it by more than one - // at a time without making repeated calls". - // - - if (nice(5) < 0 && errno != 0) - { - #ifdef WARNING - *logofs << "NXTransKeeper: WARNING! Failed to renice process to +5. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to renice process to +5. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - - // - // Delay a bit the first run to give - // a boost to the session startup. - // - - #ifdef TEST - *logofs << "NXTransKeeper: Going to sleep for " - << timeout / 20 << " Ms.\n" << logofs_flush; - #endif - - usleep(timeout / 20 * 1000); - - NXTransKeeperCheck(); - - // - // The house keeping of the persistent - // caches is performed only once. - // - - if (caches != 0) - { - #ifdef TEST - *logofs << "NXTransKeeper: Going to cleanup the NX cache " - << "directories at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - keeper -> cleanupCaches(); - - #ifdef TEST - *logofs << "NXTransKeeper: Completed cleanup of NX cache " - << "directories at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - } - #ifdef TEST - else - { - *logofs << "NXTransKeeper: Nothing to do for the " - << "persistent caches.\n" << logofs_flush; - } - #endif - - if (images == 0) - { - #ifdef TEST - *logofs << "NXTransKeeper: Nothing to do for the " - << "persistent images.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - // - // Take care of the persisten image cache. - // Run a number of iterations and then exit, - // so we can keep the memory consumption - // low. The parent will check our exit code - // and will eventually restart us. - // - - for (int iterations = 0; iterations < 100; iterations++) - { - #ifdef TEST - *logofs << "NXTransKeeper: Running iteration " << iterations - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - NXTransKeeperCheck(); - - #ifdef TEST - *logofs << "NXTransKeeper: Going to cleanup the NX images " - << "directories at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - if (keeper -> cleanupImages() < 0) - { - #ifdef TEST - *logofs << "NXTransKeeper: Exiting because of error " - << "handling the image cache.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "NXTransKeeper: Completed cleanup of NX images " - << "directories at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - NXTransKeeperCheck(); - - #ifdef TEST - *logofs << "NXTransKeeper: Going to sleep for " << timeout - << " Ms.\n" << logofs_flush; - #endif - - usleep(timeout * 1000); - } - - HandleCleanup(2); - - // - // Hopefully useless. - // - - exit(0); -} - -void SystemCleanup(const char *name) -{ - #ifdef TEST - *logofs << name << ": Performing system cleanup in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - // - // Reinstall signals that might - // have been restored by agents. - // - - InstallSignals(); -} - -void MemoryCleanup(const char *name) -{ - #ifdef TEST - *logofs << name << ": Performing memory cleanup in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - DisableSignals(); - - // - // Prevent deletion of unix socket - // and lock file. - // - - useUnixSocket = 0; - - // - // Don't let cleanup kill other - // children. - // - - lastDialog = 0; - lastWatchdog = 0; - lastKeeper = 0; - - CleanupListeners(); - - CleanupSockets(); - - CleanupGlobal(); - - EnableSignals(); -} - -int UnsetEnv(const char *name) -{ - int result; - - #ifdef __sun - - char **pEnv = environ; - - int nameLen = strlen(name) + 1; - - char *varName = new char[nameLen + 1]; - - strcpy(varName, name); - - strcat(varName, "="); - - pEnv = environ; - - while (*pEnv != NULL) - { - if (!strncmp(varName, *pEnv, nameLen)) - { - break; - } - - *pEnv++; - } - - while (*pEnv != NULL) - { - *pEnv = *(pEnv + 1); - - pEnv++; - } - - result = 0; - - #else - - #ifdef __APPLE__ - - unsetenv(name); - result = 0; - - #else - - result = unsetenv(name); - - #endif - - #endif - - return result; -} diff --git a/nxcomp/ClearArea.cpp b/nxcomp/ClearArea.cpp deleted file mode 100644 index b76e750a4..000000000 --- a/nxcomp/ClearArea.cpp +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ClearArea.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int ClearAreaStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ClearAreaMessage *clearArea = (ClearAreaMessage *) message; - - // - // Here is the fingerprint. - // - - clearArea -> exposures = *(buffer + 1); - - clearArea -> window = GetULONG(buffer + 4, bigEndian); - - clearArea -> x = GetUINT(buffer + 8, bigEndian); - clearArea -> y = GetUINT(buffer + 10, bigEndian); - clearArea -> width = GetUINT(buffer + 12, bigEndian); - clearArea -> height = GetUINT(buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ClearAreaStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ClearAreaMessage *clearArea = (ClearAreaMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = clearArea -> exposures; - - PutULONG(clearArea -> window, buffer + 4, bigEndian); - - PutUINT(clearArea -> x, buffer + 8, bigEndian); - PutUINT(clearArea -> y, buffer + 10, bigEndian); - PutUINT(clearArea -> width, buffer + 12, bigEndian); - PutUINT(clearArea -> height, buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ClearAreaStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ClearAreaMessage *clearArea = (ClearAreaMessage *) message; - - *logofs << name() << ": Identity exposures " << (unsigned int) clearArea -> exposures - << ", window " << clearArea -> window << ", x " << clearArea -> x - << ", y " << clearArea -> y << ", width " << clearArea -> width - << ", height " << clearArea -> height << ", size " << clearArea -> size_ - << ".\n"; - - #endif -} - -void ClearAreaStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 4, 4); - md5_append(md5_state_, buffer + 8, 2); - md5_append(md5_state_, buffer + 10, 2); - md5_append(md5_state_, buffer + 12, 2); - md5_append(md5_state_, buffer + 14, 2); -} diff --git a/nxcomp/ClearArea.h b/nxcomp/ClearArea.h deleted file mode 100644 index 8067edffd..000000000 --- a/nxcomp/ClearArea.h +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ClearArea_H -#define ClearArea_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define CLEARAREA_ENABLE_CACHE 1 -#define CLEARAREA_ENABLE_DATA 0 -#define CLEARAREA_ENABLE_SPLIT 0 -#define CLEARAREA_ENABLE_COMPRESS 0 - -#define CLEARAREA_DATA_LIMIT 0 -#define CLEARAREA_DATA_OFFSET 16 - -#define CLEARAREA_CACHE_SLOTS 3000 -#define CLEARAREA_CACHE_THRESHOLD 5 -#define CLEARAREA_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class ClearAreaMessage : public Message -{ - friend class ClearAreaStore; - - public: - - ClearAreaMessage() - { - } - - ~ClearAreaMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char exposures; - unsigned int window; - unsigned short x; - unsigned short y; - unsigned short width; - unsigned short height; -}; - -class ClearAreaStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ClearAreaStore() : MessageStore() - { - enableCache = CLEARAREA_ENABLE_CACHE; - enableData = CLEARAREA_ENABLE_DATA; - enableSplit = CLEARAREA_ENABLE_SPLIT; - enableCompress = CLEARAREA_ENABLE_COMPRESS; - - dataLimit = CLEARAREA_DATA_LIMIT; - dataOffset = CLEARAREA_DATA_OFFSET; - - cacheSlots = CLEARAREA_CACHE_SLOTS; - cacheThreshold = CLEARAREA_CACHE_THRESHOLD; - cacheLowerThreshold = CLEARAREA_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~ClearAreaStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "ClearArea"; - } - - virtual unsigned char opcode() const - { - return X_ClearArea; - } - - virtual unsigned int storage() const - { - return sizeof(ClearAreaMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ClearAreaMessage(); - } - - virtual Message *create(const Message &message) const - { - return new ClearAreaMessage((const ClearAreaMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (ClearAreaMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* ClearArea_H */ diff --git a/nxcomp/ClientCache.cpp b/nxcomp/ClientCache.cpp deleted file mode 100644 index b6c04dd0b..000000000 --- a/nxcomp/ClientCache.cpp +++ /dev/null @@ -1,388 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ClientCache.h" - -ClientCache::ClientCache() : - - freeGCCache(16), freeDrawableCache(16), freeWindowCache(16), - - cursorCache(16), colormapCache(16), visualCache(16), lastFont(0), - - changePropertyPropertyCache(16), changePropertyTypeCache(16), - changePropertyData32Cache(16), - - configureWindowBitmaskCache(4), - - convertSelectionRequestorCache(16), - convertSelectionLastTimestamp(0), - - copyPlaneBitPlaneCache(8), - - createGCBitmaskCache(8), - - createPixmapIdCache(16), createPixmapLastId(0), - createPixmapXCache(8), createPixmapYCache(8), - - createWindowBitmaskCache(8), - - fillPolyNumPointsCache(8), fillPolyIndex(0), - - getSelectionOwnerSelectionCache(8), - - grabButtonEventMaskCache(8), grabButtonConfineCache(8), - grabButtonModifierCache(8), - - grabKeyboardLastTimestamp(0), - - imageTextLengthCache(8), - imageTextLastX(0), imageTextLastY(0), - imageTextCacheX(8), imageTextCacheY(8), - - polySegmentCacheX(8), polySegmentCacheY(8), polySegmentCacheIndex(0), - - polyTextLastX(0), polyTextLastY(0), polyTextCacheX(8), - polyTextCacheY(8), polyTextFontCache(8), - - putImageWidthCache(8), putImageHeightCache(8), putImageLastX(0), - putImageLastY(0), putImageXCache(8), putImageYCache(8), - - getImagePlaneMaskCache(8), - - queryColorsLastPixel(0), - - setClipRectanglesXCache(8), setClipRectanglesYCache(8), - - setDashesLengthCache(8), setDashesOffsetCache(8), - - setSelectionOwnerCache(8), setSelectionOwnerTimestampCache(8), - - translateCoordsSrcCache(8), translateCoordsDstCache(8), - translateCoordsXCache(8), translateCoordsYCache(8), - - sendEventMaskCache(16), sendEventLastSequence(0), - sendEventIntDataCache(16), - - putPackedImageSrcLengthCache(16), putPackedImageDstLengthCache(16), - - // - // RenderExtension requests. - // - - renderFreePictureCache(16), - - renderGlyphSetCache(16), - renderFreeGlyphSetCache(16), - - renderIdCache(8), - - renderLengthCache(16), renderFormatCache(16), - renderValueMaskCache(8), renderNumGlyphsCache(8), - - renderXCache(16), renderYCache(16), - renderLastX(0), renderLastY(0), - - renderWidthCache(16), renderHeightCache(16), - - renderLastId(0), - - renderGlyphXCache(16), renderGlyphYCache(16), - renderGlyphX(0), renderGlyphY(0), - - renderLastCompositeGlyphsData(0), - - setCacheParametersCache(8), - - lastIdCache(16), lastId(0) - -{ - unsigned int i; - - for (i = 0; i < 3; i++) - { - allocColorRGBCache[i] = new IntCache(8); - - convertSelectionAtomCache[i] = new IntCache(8); - } - - for (i = 0; i < 4; i++) - { - clearAreaGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 7; i++) - { - configureWindowAttrCache[i] = new IntCache(8); - } - - for (i = 0; i < 6; i++) - { - copyAreaGeomCache[i] = new IntCache(8); - copyPlaneGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 23; i++) - { - if (CREATEGC_FIELD_WIDTH[i] > 16) - { - createGCAttrCache[i] = new IntCache(16); - } - else - { - createGCAttrCache[i] = new IntCache(CREATEGC_FIELD_WIDTH[i]); - } - } - - for (i = 0; i < 6; i++) - { - createWindowGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 15; i++) - { - createWindowAttrCache[i] = new IntCache(8); - } - - for (i = 0; i < 10; i++) - { - fillPolyXRelCache[i] = new IntCache(8); - fillPolyXAbsCache[i] = new IntCache(8); - fillPolyYRelCache[i] = new IntCache(8); - fillPolyYAbsCache[i] = new IntCache(8); - } - - for (i = 0; i < 8; i++) - { - fillPolyRecentX[i] = 0; - fillPolyRecentY[i] = 0; - } - - for (i = 0; i < 4; i++) - { - polyFillRectangleCacheX[i] = new IntCache(8); - polyFillRectangleCacheY[i] = new IntCache(8); - polyFillRectangleCacheWidth[i] = new IntCache(8); - polyFillRectangleCacheHeight[i] = new IntCache(8); - } - - for (i = 0; i < 2; i++) - { - polyLineCacheX[i] = new IntCache(8); - polyLineCacheY[i] = new IntCache(8); - } - - for (i = 0; i < 2; i++) - { - polyPointCacheX[i] = new IntCache(8); - polyPointCacheY[i] = new IntCache(8); - } - - for (i = 0; i < 4; i++) - { - polyRectangleGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 2; i++) - { - polySegmentLastX[i] = 0; - polySegmentLastY[i] = 0; - } - - for (i = 0; i < 4; i++) - { - setClipRectanglesGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 2; i++) - { - polyFillArcCacheX[i] = new IntCache(8); - polyFillArcCacheY[i] = new IntCache(8); - polyFillArcCacheWidth[i] = new IntCache(8); - polyFillArcCacheHeight[i] = new IntCache(8); - polyFillArcCacheAngle1[i] = new IntCache(8); - polyFillArcCacheAngle2[i] = new IntCache(8); - } - - for (i = 0; i < 2; i++) - { - polyArcCacheX[i] = new IntCache(8); - polyArcCacheY[i] = new IntCache(8); - polyArcCacheWidth[i] = new IntCache(8); - polyArcCacheHeight[i] = new IntCache(8); - polyArcCacheAngle1[i] = new IntCache(8); - polyArcCacheAngle2[i] = new IntCache(8); - } - - for (i = 0; i < 8; i++) - { - shapeDataCache[i] = new IntCache(8); - } - - for (i = 0; i < 8; i++) - { - genericRequestDataCache[i] = new IntCache(8); - } - - for (i = 0; i < 16; i++) - { - renderDataCache[i] = new IntCache(16); - } - - for (i = 0; i < 16; i++) - { - renderCompositeGlyphsDataCache[i] = new IntCache(16); - } - - for (i = 0; i < 3; i++) - { - renderCompositeDataCache[i] = new IntCache(16); - } -} - - -ClientCache::~ClientCache() -{ - unsigned int i; - - for (i = 0; i < 3; i++) - { - delete allocColorRGBCache[i]; - delete convertSelectionAtomCache[i]; - } - - for (i = 0; i < 4; i++) - { - delete clearAreaGeomCache[i]; - } - - for (i = 0; i < 7; i++) - { - delete configureWindowAttrCache[i]; - } - - for (i = 0; i < 6; i++) - { - delete copyAreaGeomCache[i]; - delete copyPlaneGeomCache[i]; - } - - for (i = 0; i < 23; i++) - { - delete createGCAttrCache[i]; - } - - for (i = 0; i < 6; i++) - { - delete createWindowGeomCache[i]; - } - - for (i = 0; i < 15; i++) - { - delete createWindowAttrCache[i]; - } - - for (i = 0; i < 10; i++) - { - delete fillPolyXRelCache[i]; - delete fillPolyXAbsCache[i]; - delete fillPolyYRelCache[i]; - delete fillPolyYAbsCache[i]; - } - - for (i = 0; i < 4; i++) - { - delete polyFillRectangleCacheX[i]; - delete polyFillRectangleCacheY[i]; - delete polyFillRectangleCacheWidth[i]; - delete polyFillRectangleCacheHeight[i]; - } - - for (i = 0; i < 2; i++) - { - delete polyLineCacheX[i]; - delete polyLineCacheY[i]; - } - - for (i = 0; i < 2; i++) - { - delete polyPointCacheX[i]; - delete polyPointCacheY[i]; - } - - for (i = 0; i < 4; i++) - { - delete polyRectangleGeomCache[i]; - } - - for (i = 0; i < 4; i++) - { - delete setClipRectanglesGeomCache[i]; - } - - for (i = 0; i < 2; i++) - { - delete polyFillArcCacheX[i]; - delete polyFillArcCacheY[i]; - delete polyFillArcCacheWidth[i]; - delete polyFillArcCacheHeight[i]; - delete polyFillArcCacheAngle1[i]; - delete polyFillArcCacheAngle2[i]; - } - - for (i = 0; i < 2; i++) - { - delete polyArcCacheX[i]; - delete polyArcCacheY[i]; - delete polyArcCacheWidth[i]; - delete polyArcCacheHeight[i]; - delete polyArcCacheAngle1[i]; - delete polyArcCacheAngle2[i]; - } - - for (i = 0; i < 8; i++) - { - delete shapeDataCache[i]; - } - - for (i = 0; i < 8; i++) - { - delete genericRequestDataCache[i]; - } - - for (i = 0; i < 16; i++) - { - delete renderDataCache[i]; - } - - for (i = 0; i < 16; i++) - { - delete renderCompositeGlyphsDataCache[i]; - } - - for (i = 0; i < 3; i++) - { - delete renderCompositeDataCache[i]; - } -} diff --git a/nxcomp/ClientCache.h b/nxcomp/ClientCache.h deleted file mode 100644 index ed3361097..000000000 --- a/nxcomp/ClientCache.h +++ /dev/null @@ -1,417 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ClientCache_H -#define ClientCache_H - -#include "Misc.h" - -#include "IntCache.h" -#include "CharCache.h" -#include "OpcodeCache.h" -#include "XidCache.h" -#include "FreeCache.h" - -#include "ChannelCache.h" - -class ClientCache : public ChannelCache -{ - public: - - ClientCache(); - - ~ClientCache(); - - // - // Opcode prediction caches. - // - - OpcodeCache opcodeCache; - - // - // GC and drawables caches. - // - - XidCache gcCache; - FreeCache freeGCCache; - - XidCache drawableCache; - FreeCache freeDrawableCache; - - XidCache windowCache; - FreeCache freeWindowCache; - - // - // General-purpose caches. - // - - IntCache cursorCache; - IntCache colormapCache; - IntCache visualCache; - CharCache depthCache; - CharCache resourceCache; - CharCache methodCache; - - unsigned int lastFont; - - // - // AllocColor request. - // - - IntCache *allocColorRGBCache[3]; - - // - // ChangeProperty request. - // - - CharCache changePropertyFormatCache; - IntCache changePropertyPropertyCache; - IntCache changePropertyTypeCache; - IntCache changePropertyData32Cache; - - // - // ClearArea request. - // - - IntCache *clearAreaGeomCache[4]; - - // - // ConfigureWindow request. - // - - IntCache configureWindowBitmaskCache; - IntCache *configureWindowAttrCache[7]; - - // - // ConvertSelection request. - // - - IntCache convertSelectionRequestorCache; - IntCache* convertSelectionAtomCache[3]; - unsigned int convertSelectionLastTimestamp; - - // - // CopyArea request. - // - - IntCache *copyAreaGeomCache[6]; - - // - // CopyPlane request. - // - - IntCache *copyPlaneGeomCache[6]; - IntCache copyPlaneBitPlaneCache; - - // - // CreateGC request. - // - - IntCache createGCBitmaskCache; - IntCache *createGCAttrCache[23]; - - // - // CreatePixmap request. - // - - IntCache createPixmapIdCache; - unsigned int createPixmapLastId; - IntCache createPixmapXCache; - IntCache createPixmapYCache; - - // - // CreateWindow request. - // - - IntCache *createWindowGeomCache[6]; - IntCache createWindowBitmaskCache; - IntCache *createWindowAttrCache[15]; - - // - // FillPoly request. - // - - IntCache fillPolyNumPointsCache; - IntCache *fillPolyXRelCache[10]; - IntCache *fillPolyXAbsCache[10]; - IntCache *fillPolyYRelCache[10]; - IntCache *fillPolyYAbsCache[10]; - unsigned int fillPolyRecentX[8]; - unsigned int fillPolyRecentY[8]; - unsigned int fillPolyIndex; - - // - // GetSelectionOwner request. - // - - IntCache getSelectionOwnerSelectionCache; - - // - // GrabButton request (also used for GrabPointer). - // - - IntCache grabButtonEventMaskCache; - IntCache grabButtonConfineCache; - CharCache grabButtonButtonCache; - IntCache grabButtonModifierCache; - - // - // GrabKeyboard request. - // - - unsigned int grabKeyboardLastTimestamp; - - // - // ImageText8/16 request. - // - - IntCache imageTextLengthCache; - unsigned int imageTextLastX; - unsigned int imageTextLastY; - IntCache imageTextCacheX; - IntCache imageTextCacheY; - - // - // PolyFillRectangle request. - // - - IntCache *polyFillRectangleCacheX[4]; - IntCache *polyFillRectangleCacheY[4]; - IntCache *polyFillRectangleCacheWidth[4]; - IntCache *polyFillRectangleCacheHeight[4]; - - // - // PolyLine request. - // - - IntCache *polyLineCacheX[2]; - IntCache *polyLineCacheY[2]; - - // - // PolyPoint request. - // - - IntCache *polyPointCacheX[2]; - IntCache *polyPointCacheY[2]; - - // - // PolyRectangle request. - // - - IntCache *polyRectangleGeomCache[4]; - - // - // PolySegment request. - // - - IntCache polySegmentCacheX; - IntCache polySegmentCacheY; - unsigned int polySegmentLastX[2]; - unsigned int polySegmentLastY[2]; - unsigned int polySegmentCacheIndex; - - // - // PolyText8/16 request. - // - - unsigned int polyTextLastX; - unsigned int polyTextLastY; - IntCache polyTextCacheX; - IntCache polyTextCacheY; - IntCache polyTextFontCache; - CharCache polyTextDeltaCache; - - // - // PutImage request. - // - - IntCache putImageWidthCache; - IntCache putImageHeightCache; - unsigned int putImageLastX; - unsigned int putImageLastY; - IntCache putImageXCache; - IntCache putImageYCache; - CharCache putImageLeftPadCache; - - // - // GetImage request. - // - - IntCache getImagePlaneMaskCache; - - // - // QueryColors request. - // - - unsigned int queryColorsLastPixel; - - // - // SetClipRectangles request. - // - - IntCache setClipRectanglesXCache; - IntCache setClipRectanglesYCache; - IntCache *setClipRectanglesGeomCache[4]; - - // - // SetDashes request. - // - - IntCache setDashesLengthCache; - IntCache setDashesOffsetCache; - CharCache setDashesDashCache_[2]; - - // - // SetSelectionOwner request. - // - - IntCache setSelectionOwnerCache; - IntCache setSelectionOwnerTimestampCache; - - // - // TranslateCoords request. - // - - IntCache translateCoordsSrcCache; - IntCache translateCoordsDstCache; - IntCache translateCoordsXCache; - IntCache translateCoordsYCache; - - // - // SendEvent request. - // - - IntCache sendEventMaskCache; - CharCache sendEventCodeCache; - CharCache sendEventByteDataCache; - unsigned int sendEventLastSequence; - IntCache sendEventIntDataCache; - CharCache sendEventEventCache; - - // - // PolyFillArc request. - // - - IntCache *polyFillArcCacheX[2]; - IntCache *polyFillArcCacheY[2]; - IntCache *polyFillArcCacheWidth[2]; - IntCache *polyFillArcCacheHeight[2]; - IntCache *polyFillArcCacheAngle1[2]; - IntCache *polyFillArcCacheAngle2[2]; - - // - // PolyArc request. - // - - IntCache *polyArcCacheX[2]; - IntCache *polyArcCacheY[2]; - IntCache *polyArcCacheWidth[2]; - IntCache *polyArcCacheHeight[2]; - IntCache *polyArcCacheAngle1[2]; - IntCache *polyArcCacheAngle2[2]; - - // - // PutPackedImage request. - // - - IntCache putPackedImageSrcLengthCache; - IntCache putPackedImageDstLengthCache; - - // - // Shape extension requests. - // - - CharCache shapeOpcodeCache; - IntCache *shapeDataCache[8]; - - // - // Generic requests. - // - - CharCache genericRequestOpcodeCache; - IntCache *genericRequestDataCache[8]; - - // - // Render extension requests. - // - - OpcodeCache renderOpcodeCache; - - CharCache renderOpCache; - - XidCache renderSrcPictureCache; - XidCache renderMaskPictureCache; - XidCache renderDstPictureCache; - FreeCache renderFreePictureCache; - - IntCache renderGlyphSetCache; - FreeCache renderFreeGlyphSetCache; - - IntCache renderIdCache; - IntCache renderLengthCache; - IntCache renderFormatCache; - IntCache renderValueMaskCache; - IntCache renderNumGlyphsCache; - - IntCache renderXCache; - IntCache renderYCache; - - unsigned int renderLastX; - unsigned int renderLastY; - - IntCache renderWidthCache; - IntCache renderHeightCache; - - unsigned int renderLastId; - - IntCache *renderDataCache[16]; - - IntCache renderGlyphXCache; - IntCache renderGlyphYCache; - - unsigned int renderGlyphX; - unsigned int renderGlyphY; - - IntCache *renderCompositeGlyphsDataCache[16]; - unsigned int renderLastCompositeGlyphsData; - - IntCache *renderCompositeDataCache[3]; - - // - // SetCacheParameters request. - // - - IntCache setCacheParametersCache; - - // - // Encode new XID values based - // on the last value encoded. - // - - IntCache lastIdCache; - unsigned int lastId; -}; - -#endif /* ClientCache_H */ diff --git a/nxcomp/ClientChannel.cpp b/nxcomp/ClientChannel.cpp deleted file mode 100644 index dbf5f6986..000000000 --- a/nxcomp/ClientChannel.cpp +++ /dev/null @@ -1,7877 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include -#include - -#include "NXproto.h" -#include "NXrender.h" - -#include "ClientChannel.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "StaticCompressor.h" - -#include "Statistics.h" -#include "Proxy.h" - -#include "PutImage.h" -#include "PutPackedImage.h" - -extern Proxy *proxy; - -// -// Set the verbosity level. You also -// need to define OPCODES in Misc.cpp -// if you want literals instead of -// opcodes' numbers. -// - -#define PANIC -#define WARNING -#undef OPCODES -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Log the important tracepoints related -// to writing packets to the peer proxy. -// - -#undef FLUSH - -// -// Log the operations related to splits. -// - -#undef SPLIT - -// -// Define this to trace the invocations -// of the agent's callbacks. -// - -#undef CALLBACK - -// -// By defining this, a simple procedure is activated at -// startup which just allocates and deallocates plenty -// of cache objects. This is used to help determine the -// current memory requirements. -// - -#undef MEMORY - -// -// Inspects target of common X operations. -// - -#undef TARGETS - -#ifdef TARGETS - -#include -#include - -typedef set < unsigned int, less > T_windows; -typedef set < unsigned int, less > T_pixmaps; -typedef map < unsigned int, unsigned int, less > T_gcontexts; - -T_windows windows; -T_pixmaps pixmaps; -T_gcontexts gcontexts; - -#endif - -// -// Define this to log when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// Here are the static members. -// - -#ifdef REFERENCES - -int ClientChannel::references_ = 0; - -#endif - -ClientChannel::ClientChannel(Transport *transport, StaticCompressor *compressor) - - : Channel(transport, compressor), readBuffer_(transport_, this) -{ - // - // Sequence number of the next message - // being encoded or decoded. - // - - clientSequence_ = 0; - serverSequence_ = 0; - - // - // Current sequence known by NX agent. - // - - lastSequence_ = 0; - - // - // This is used to test the synchronous - // flush in the proxy. - // - - lastRequest_ = 0; - - // - // Store information about the images - // being streamed. - // - - splitState_.resource = nothing; - splitState_.pending = 0; - splitState_.commit = 0; - splitState_.mode = split_none; - - // - // Number of outstanding tainted replies. - // - - taintCounter_ = 0; - - #ifdef MEMORY - - *logofs << "ClientChannel: Created 1 ClientCache and 1 ServerCache. " - << "You have 30 seconds to check the allocated size.\n" - << logofs_flush; - - sleep(30); - - ClientCache *clientCacheTestArray[100]; - ServerCache *serverCacheTestArray[100]; - - for (int i = 0; i < 100; i++) - { - clientCacheTestArray[i] = new ClientCache(); - } - - *logofs << "ClientChannel: Created further 100 ClientCache. " - << "You have 30 seconds to check the allocated size.\n" - << logofs_flush; - - sleep(30); - - for (int i = 0; i < 100; i++) - { - serverCacheTestArray[i] = new ServerCache(); - } - - *logofs << "ClientChannel: Created further 100 ServerCache. " - << "You have 30 seconds to check the allocated size.\n" - << logofs_flush; - - sleep(30); - - for (int i = 0; i < 100; i++) - { - delete clientCacheTestArray[i]; - delete serverCacheTestArray[i]; - } - - *logofs << "ClientChannel: Deleted 100 ClientCache and 100 ServerCache. " - << "You have 30 seconds to check the allocated size.\n" - << logofs_flush; - - sleep(30); - - #endif - - #ifdef REFERENCES - *logofs << "ClientChannel: Created new object at " - << this << " for FD#" << fd_ << " out of " - << ++references_ << " allocated channels.\n" - << logofs_flush; - #endif -} - -ClientChannel::~ClientChannel() -{ - #ifdef REFERENCES - *logofs << "ClientChannel: Deleted object at " - << this << " for FD#" << fd_ << " out of " - << --references_ << " allocated channels.\n" - << logofs_flush; - #endif -} - -// -// Beginning of handleRead(). -// - -int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length) -{ - #ifdef TEST - *logofs << "handleRead: Called for FD#" << fd_ - << " with " << encodeBuffer.getLength() - << " bytes already encoded.\n" - << logofs_flush; - #endif - - // - // Pointer to located message and - // its size in bytes. - // - - const unsigned char *inputMessage; - unsigned int inputLength; - - // - // Set when message is found in - // cache. - // - - int hit; - - // - // Check if we can borrow the buffer - // from the caller. - // - - if (message != NULL && length != 0) - { - readBuffer_.readMessage(message, length); - } - else - { - // - // Get the data from the transport. - // - - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: Trying to read from FD#" - << fd_ << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - int result = readBuffer_.readMessage(); - - #ifdef DEBUG - *logofs << "handleRead: Read result on FD#" << fd_ - << " is " << result << ".\n" - << logofs_flush; - #endif - - if (result < 0) - { - // - // Let the proxy close the channel. - // - - return -1; - } - else if (result == 0) - { - #if defined(TEST) || defined(INFO) - - *logofs << "handleRead: PANIC! No data read from FD#" - << fd_ << " while encoding messages.\n" - << logofs_flush; - - HandleCleanup(); - - #endif - - return 0; - } - } - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "handleRead: Encoding messages for FD#" << fd_ - << " with " << readBuffer_.getLength() << " bytes " - << "in the buffer.\n" << logofs_flush; - #endif - - // - // Extract any complete message which - // is available in the buffer. - // - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) - { - hit = 0; - - if (firstRequest_) - { - // - // Need to add the length of the first - // request as it was not present in - // previous versions. - // - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeValue(inputLength, 8); - - for (unsigned int i = 0; i < inputLength; i++) - { - encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8); - } - - firstRequest_ = 0; - - #if defined(TEST) || defined(OPCODES) - - int bits = encodeBuffer.diffBits(); - - *logofs << "handleRead: Handled first request. " << inputLength - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - #endif - - priority_++; - } - else - { - // - // First of all we get the opcode. - // - - unsigned char inputOpcode = *inputMessage; - - #if defined(TEST) || defined(INFO) - - // - // This is used to test the synchronous - // flush in the parent proxy. - // - - lastRequest_ = inputOpcode; - - #endif - - // - // Check if the request is supported by the - // remote. If not, only handle it locally and - // taint the opcode as a X_NoOperation. Also - // try to short-circuit some replies at this - // side. XSync requests, for example, weight - // for half of the total round-trips. - // - - if (handleTaintRequest(inputOpcode, inputMessage, - inputLength) < 0) - { - return -1; - } - - encodeBuffer.encodeOpcodeValue(inputOpcode, clientCache_ -> opcodeCache); - - // - // Update the current sequence. - // - - clientSequence_++; - clientSequence_ &= 0xffff; - - #ifdef DEBUG - *logofs << "handleRead: Last client sequence number for FD#" - << fd_ << " is " << clientSequence_ << ".\n" - << logofs_flush; - #endif - - // - // If differential compression is disabled - // then use the most simple encoding. - // - - if (control -> LocalDeltaCompression == 0) - { - int result = handleFastReadRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - // - // Go to the message's specific encoding. - // - - switch (inputOpcode) - { - case X_AllocColor: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> colormapCache); - const unsigned char *nextSrc = inputMessage + 8; - unsigned int colorData[3]; - for (unsigned int i = 0; i < 3; i++) - { - unsigned int value = GetUINT(nextSrc, bigEndian_); - encodeBuffer.encodeCachedValue(value, 16, - *(clientCache_ -> allocColorRGBCache[i]), 4); - colorData[i] = value; - nextSrc += 2; - } - - sequenceQueue_.push(clientSequence_, inputOpcode, - colorData[0], colorData[1], colorData[2]); - - priority_++; - } - break; - case X_ReparentWindow: - { - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), - clientCache_ -> windowCache); - encodeBuffer.encodeValue(GetUINT(inputMessage + 12, bigEndian_), 16, 11); - encodeBuffer.encodeValue(GetUINT(inputMessage + 14, bigEndian_), 16, 11); - } - break; - case X_ChangeProperty: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ChangeProperty); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - unsigned char format = inputMessage[16]; - encodeBuffer.encodeCachedValue(format, 8, - clientCache_ -> changePropertyFormatCache); - unsigned int dataLength = GetULONG(inputMessage + 20, bigEndian_); - encodeBuffer.encodeValue(dataLength, 32, 6); - encodeBuffer.encodeValue(inputMessage[1], 2); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, - clientCache_ -> changePropertyPropertyCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, - clientCache_ -> changePropertyTypeCache, 9); - const unsigned char *nextSrc = inputMessage + 24; - if (format == 8) - { - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, dataLength); - } - else if (format == 32) - { - for (unsigned int i = 0; i < dataLength; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, - clientCache_ -> changePropertyData32Cache); - nextSrc += 4; - } - } - else - { - for (unsigned int i = 0; i < dataLength; i++) - { - encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); - nextSrc += 2; - } - } - } - break; - case X_SendEvent: - { - // - // TODO: This can be improved. In the worst - // cases, it appears to provide a poor 1.6:1 - // ratio. - // - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_SendEvent); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - unsigned int window = GetULONG(inputMessage + 4, bigEndian_); - - if (window == 0 || window == 1) - { - encodeBuffer.encodeBoolValue(1); - encodeBuffer.encodeBoolValue(window); - } - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeXidValue(window, clientCache_ -> windowCache); - } - - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 32, - clientCache_ -> sendEventMaskCache, 9); - encodeBuffer.encodeCachedValue(*(inputMessage + 12), 8, - clientCache_ -> sendEventCodeCache); - encodeBuffer.encodeCachedValue(*(inputMessage + 13), 8, - clientCache_ -> sendEventByteDataCache); - - unsigned int newSeq = GetUINT(inputMessage + 14, bigEndian_); - unsigned int diffSeq = newSeq - clientCache_ -> sendEventLastSequence; - clientCache_ -> sendEventLastSequence = newSeq; - encodeBuffer.encodeValue(diffSeq, 16, 4); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, - clientCache_ -> sendEventIntDataCache); - - for (unsigned int i = 20; i < 44; i++) - { - encodeBuffer.encodeCachedValue((unsigned int) inputMessage[i], 8, - clientCache_ -> sendEventEventCache); - } - } - break; - case X_ChangeWindowAttributes: - { - encodeBuffer.encodeValue((inputLength - 12) >> 2, 4); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - unsigned int bitmask = GetULONG(inputMessage + 8, bigEndian_); - encodeBuffer.encodeCachedValue(bitmask, 15, - clientCache_ -> createWindowBitmaskCache); - const unsigned char *nextSrc = inputMessage + 12; - unsigned int mask = 0x1; - for (unsigned int j = 0; j < 15; j++) - { - if (bitmask & mask) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, - *clientCache_ -> createWindowAttrCache[j]); - nextSrc += 4; - } - mask <<= 1; - } - } - break; - case X_ClearArea: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_ClearArea target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_ClearArea target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_ClearArea target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ClearArea); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - const unsigned char *nextSrc = inputMessage + 8; - for (unsigned int i = 0; i < 4; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> clearAreaGeomCache[i], 8); - nextSrc += 2; - } - } - break; - case X_CloseFont: - { - unsigned int font = GetULONG(inputMessage + 4, bigEndian_); - encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); - clientCache_ -> lastFont = font; - } - break; - case X_ConfigureWindow: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ConfigureWindow); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - unsigned int bitmask = GetUINT(inputMessage + 8, bigEndian_); - encodeBuffer.encodeCachedValue(bitmask, 7, - clientCache_ -> configureWindowBitmaskCache); - unsigned int mask = 0x1; - const unsigned char *nextSrc = inputMessage + 12; - for (unsigned int i = 0; i < 7; i++) - { - if (bitmask & mask) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), - CONFIGUREWINDOW_FIELD_WIDTH[i], - *clientCache_ -> configureWindowAttrCache[i], 8); - nextSrc += 4; - } - mask <<= 1; - } - } - break; - case X_ConvertSelection: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> convertSelectionRequestorCache, 9); - const unsigned char* nextSrc = inputMessage + 8; - for (unsigned int i = 0; i < 3; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, - *(clientCache_ -> convertSelectionAtomCache[i]), 9); - nextSrc += 4; - } - unsigned int timestamp = GetULONG(nextSrc, bigEndian_); - encodeBuffer.encodeValue(timestamp - - clientCache_ -> convertSelectionLastTimestamp, 32, 4); - clientCache_ -> convertSelectionLastTimestamp = timestamp; - } - break; - case X_CopyArea: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_CopyArea source id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_CopyArea source id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_CopyArea source id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - t_id = GetULONG(inputMessage + 8, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_CopyArea target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_CopyArea target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_CopyArea target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_CopyArea); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 12, - bigEndian_), clientCache_ -> gcCache); - const unsigned char *nextSrc = inputMessage + 16; - for (unsigned int i = 0; i < 6; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> copyAreaGeomCache[i], 8); - nextSrc += 2; - } - } - break; - case X_CopyGC: - { - #ifdef TARGETS - - unsigned int s_g_id = GetULONG(inputMessage + 4, bigEndian_); - unsigned int d_g_id = GetULONG(inputMessage + 8, bigEndian_); - - *logofs << "handleRead: X_CopyGC source gcontext id is " << s_g_id - << " destination gcontext id is " << d_g_id << ".\n" - << logofs_flush; - - #endif - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> gcCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, - bigEndian_), 23, clientCache_ -> createGCBitmaskCache); - } - break; - case X_CopyPlane: - { - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 12, - bigEndian_), clientCache_ -> gcCache); - const unsigned char *nextSrc = inputMessage + 16; - for (unsigned int i = 0; i < 6; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> copyPlaneGeomCache[i], 8); - nextSrc += 2; - } - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 28, bigEndian_), 32, - clientCache_ -> copyPlaneBitPlaneCache, 10); - } - break; - case X_CreateGC: - { - #ifdef TARGETS - - unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); - unsigned int t_id = GetULONG(inputMessage + 8, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_CreateGC id " << g_id - << " target id is pixmap " << t_id - << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_CreateGC id " << g_id - << " target id is window " << t_id - << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_CreateGC id " << g_id - << " target id is unrecognized.\n" - << logofs_flush; - } - - gcontexts.insert(T_gcontexts::value_type(g_id, t_id)); - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_CreateGC); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> lastId, clientCache_ -> lastIdCache, - clientCache_ -> gcCache, - clientCache_ -> freeGCCache); - - const unsigned char *nextSrc = inputMessage + 8; - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> drawableCache); - nextSrc += 4; - unsigned int bitmask = GetULONG(nextSrc, bigEndian_); - nextSrc += 4; - encodeBuffer.encodeCachedValue(bitmask, 23, - clientCache_ -> createGCBitmaskCache); - unsigned int mask = 0x1; - for (unsigned int i = 0; i < 23; i++) - { - if (bitmask & mask) - { - unsigned int value = GetULONG(nextSrc, bigEndian_); - nextSrc += 4; - unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; - if (fieldWidth <= 4) - { - encodeBuffer.encodeValue(value, fieldWidth); - } - else - { - encodeBuffer.encodeCachedValue(value, fieldWidth, - *clientCache_ -> createGCAttrCache[i]); - } - } - mask <<= 1; - } - } - break; - case X_ChangeGC: - { - #ifdef TARGETS - - unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); - - T_gcontexts::iterator i = gcontexts.find(g_id); - - if (i != gcontexts.end()) - { - unsigned int t_id = i -> second; - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_ChangeGC gcontext id is " << g_id - << " target id is pixmap " << t_id << ".\n" - << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_ChangeGC gcontext id is " << g_id - << " target id is window " << t_id << ".\n" - << logofs_flush; - } - else - { - *logofs << "handleRead: X_ChangeGC gcontext is " << g_id - << " target id is unrecognized.\n" - << logofs_flush; - } - } - else - { - *logofs << "handleRead: X_ChangeGC gcontext id " << g_id - << " is unrecognized.\n" << logofs_flush; - } - - gcontexts.erase(g_id); - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ChangeGC); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> gcCache); - const unsigned char *nextSrc = inputMessage + 8; - unsigned int bitmask = GetULONG(nextSrc, bigEndian_); - nextSrc += 4; - encodeBuffer.encodeCachedValue(bitmask, 23, - clientCache_ -> createGCBitmaskCache); - unsigned int mask = 0x1; - for (unsigned int i = 0; i < 23; i++) - { - if (bitmask & mask) - { - unsigned int value = GetULONG(nextSrc, bigEndian_); - nextSrc += 4; - unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; - if (fieldWidth <= 4) - { - encodeBuffer.encodeValue(value, fieldWidth); - } - else - { - encodeBuffer.encodeCachedValue(value, fieldWidth, - *clientCache_ -> createGCAttrCache[i]); - } - } - mask <<= 1; - } - } - break; - case X_CreatePixmap: - { - #ifdef TARGETS - - *logofs << "handleRead: X_CreatePixmap depth " << (unsigned) inputMessage[1] - << ", pixmap id " << GetULONG(inputMessage + 4, bigEndian_) - << ", drawable " << GetULONG(inputMessage + 8, bigEndian_) - << ", width " << GetUINT(inputMessage + 12, bigEndian_) - << ", height " << GetUINT(inputMessage + 14, bigEndian_) - << ", size " << GetUINT(inputMessage + 2, bigEndian_) << 2 - << ".\n" << logofs_flush; - - unsigned int p_id = GetULONG(inputMessage + 4, bigEndian_); - unsigned short p_sx = GetUINT(inputMessage + 12, bigEndian_); - unsigned short p_sy = GetUINT(inputMessage + 14, bigEndian_); - - *logofs << "handleRead: X_CreatePixmap id is " << p_id - << " width is " << p_sx << " height is " << p_sy - << ".\n" << logofs_flush; - - if (p_sx * p_sy <= 64 * 64) - { - *logofs << "handleRead: X_CreatePixmap id " << p_id << " of size " - << p_sx << "x" << p_sy << "=" << p_sx * p_sy - << " will be painted at client side.\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_CreatePixmap id " << p_id << " of size " - << p_sx << "x" << p_sy << "=" << p_sx * p_sy - << " will be painted at server side.\n" << logofs_flush; - } - - pixmaps.insert(p_id); - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_CreatePixmap); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - break; - case X_CreateWindow: - { - #ifdef TARGETS - - unsigned int w_id = GetULONG(inputMessage + 4, bigEndian_); - - *logofs << "handleRead: X_CreateWindow id is " << w_id - << ".\n" << logofs_flush; - - windows.insert(w_id); - - #endif - - unsigned bitmask = GetULONG(inputMessage + 28, bigEndian_); - encodeBuffer.encodeCachedValue((unsigned int) inputMessage[1], 8, - clientCache_ -> depthCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), - clientCache_ -> windowCache); - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> lastId, clientCache_ -> lastIdCache, - clientCache_ -> windowCache, - clientCache_ -> freeWindowCache); - - const unsigned char *nextSrc = inputMessage + 12; - for (unsigned int i = 0; i < 6; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> createWindowGeomCache[i], 8); - nextSrc += 2; - } - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 24, - bigEndian_), 29, clientCache_ -> visualCache); - encodeBuffer.encodeCachedValue(bitmask, 15, - clientCache_ -> createWindowBitmaskCache); - nextSrc = inputMessage + 32; - unsigned int mask = 0x1; - for (unsigned int j = 0; j < 15; j++) - { - if (bitmask & mask) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, - *clientCache_ -> createWindowAttrCache[j]); - nextSrc += 4; - } - mask <<= 1; - } - } - break; - case X_DeleteProperty: - { - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 29, 9); - } - break; - case X_FillPoly: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_FillPoly target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_FillPoly target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_FillPoly target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_FillPoly); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - unsigned int numPoints = ((inputLength - 16) >> 2); - - // Since ProtoStep10 (#issue 108) - encodeBuffer.encodeCachedValue(numPoints, 16, - clientCache_ -> fillPolyNumPointsCache, 4); - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), - clientCache_ -> gcCache); - encodeBuffer.encodeValue((unsigned int) inputMessage[12], 2); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); - int relativeCoordMode = (inputMessage[13] != 0); - const unsigned char *nextSrc = inputMessage + 16; - unsigned int pointIndex = 0; - - for (unsigned int i = 0; i < numPoints; i++) - { - if (relativeCoordMode) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> fillPolyXRelCache[pointIndex], 8); - nextSrc += 2; - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> fillPolyYRelCache[pointIndex], 8); - nextSrc += 2; - } - else - { - unsigned int x = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - unsigned int y = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - unsigned int j; - for (j = 0; j < 8; j++) - if ((x == clientCache_ -> fillPolyRecentX[j]) && - (y == clientCache_ -> fillPolyRecentY[j])) - break; - if (j < 8) - { - encodeBuffer.encodeBoolValue(1); - encodeBuffer.encodeValue(j, 3); - } - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeCachedValue(x, 16, - *clientCache_ -> fillPolyXAbsCache[pointIndex], 8); - encodeBuffer.encodeCachedValue(y, 16, - *clientCache_ -> fillPolyYAbsCache[pointIndex], 8); - clientCache_ -> fillPolyRecentX[clientCache_ -> fillPolyIndex] = x; - clientCache_ -> fillPolyRecentY[clientCache_ -> fillPolyIndex] = y; - clientCache_ -> fillPolyIndex++; - if (clientCache_ -> fillPolyIndex == 8) - clientCache_ -> fillPolyIndex = 0; - } - } - - if (++pointIndex == 10) pointIndex = 0; - } - } - break; - case X_FreeColors: - { - unsigned int numPixels = GetUINT(inputMessage + 2, bigEndian_) - 3; - encodeBuffer.encodeValue(numPixels, 16, 4); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> colormapCache); - encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 32, 4); - const unsigned char *nextSrc = inputMessage + 12; - while (numPixels) - { - encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 8); - nextSrc += 4; - numPixels--; - } - } - break; - case X_FreeCursor: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, clientCache_ -> cursorCache, 9); - } - break; - case X_FreeGC: - { - #ifdef TARGETS - - unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); - - T_gcontexts::iterator i = gcontexts.find(g_id); - - if (i != gcontexts.end()) - { - unsigned int t_id = i -> second; - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_FreeGC gcontext id is " << g_id - << " target id is pixmap " << t_id << ".\n" - << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_FreeGC gcontext id is " << g_id - << " target id is window " << t_id << ".\n" - << logofs_flush; - } - else - { - *logofs << "handleRead: X_FreeGC gcontext id is " << g_id - << " target id is unrecognized.\n" - << logofs_flush; - } - } - else - { - *logofs << "handleRead: X_FreeGC gcontext id " << g_id - << " is unrecognized.\n" << logofs_flush; - } - - gcontexts.erase(g_id); - - #endif - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> freeGCCache); - } - break; - case X_FreePixmap: - { - #ifdef TARGETS - - unsigned int p_id = GetULONG(inputMessage + 4, bigEndian_); - - *logofs << "handleRead: X_FreePixmap id is " << p_id << ".\n" << logofs_flush; - - pixmaps.erase(p_id); - - #endif - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> freeDrawableCache); - } - break; - case X_GetAtomName: - { - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 29, 9); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetGeometry: - { - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> drawableCache); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetInputFocus: - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetModifierMapping: - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetKeyboardMapping: - { - encodeBuffer.encodeValue((unsigned int) inputMessage[4], 8); - encodeBuffer.encodeValue((unsigned int) inputMessage[5], 8); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetProperty: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_GetProperty); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - unsigned int property = GetULONG(inputMessage + 8, bigEndian_); - - sequenceQueue_.push(clientSequence_, inputOpcode, property); - - priority_++; - - hit = 1; - - break; - } - - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - unsigned int property = GetULONG(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(property, 29, 9); - encodeBuffer.encodeValue(GetULONG(inputMessage + 12, bigEndian_), 29, 9); - encodeBuffer.encodeValue(GetULONG(inputMessage + 16, bigEndian_), 32, 2); - encodeBuffer.encodeValue(GetULONG(inputMessage + 20, bigEndian_), 32, 8); - - sequenceQueue_.push(clientSequence_, inputOpcode, property); - - priority_++; - } - break; - case X_GetSelectionOwner: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> getSelectionOwnerSelectionCache, 9); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GrabButton: - { - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, - clientCache_ -> grabButtonEventMaskCache); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[10]); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[11]); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, - clientCache_ -> grabButtonConfineCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 29, - clientCache_ -> cursorCache, 9); - encodeBuffer.encodeCachedValue(inputMessage[20], 8, - clientCache_ -> grabButtonButtonCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 22, bigEndian_), 16, - clientCache_ -> grabButtonModifierCache); - } - break; - case X_GrabPointer: - { - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, - clientCache_ -> grabButtonEventMaskCache); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[10]); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[11]); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, - bigEndian_), 29, - clientCache_ -> grabButtonConfineCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, - bigEndian_), 29, clientCache_ -> cursorCache, 9); - - unsigned int timestamp = GetULONG(inputMessage + 20, bigEndian_); - encodeBuffer.encodeValue(timestamp - - clientCache_ -> grabKeyboardLastTimestamp, 32, 4); - clientCache_ -> grabKeyboardLastTimestamp = timestamp; - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GrabKeyboard: - { - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - unsigned int timestamp = GetULONG(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(timestamp - - clientCache_ -> grabKeyboardLastTimestamp, 32, 4); - clientCache_ -> grabKeyboardLastTimestamp = timestamp; - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GrabServer: - case X_UngrabServer: - case X_NoOperation: - { - } - break; - case X_PolyText8: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyText8 target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyText8 target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyText8 target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyText8); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - unsigned int x = GetUINT(inputMessage + 12, bigEndian_); - int xDiff = x - clientCache_ -> polyTextLastX; - clientCache_ -> polyTextLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache_ -> polyTextCacheX); - unsigned int y = GetUINT(inputMessage + 14, bigEndian_); - int yDiff = y - clientCache_ -> polyTextLastY; - clientCache_ -> polyTextLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache_ -> polyTextCacheY); - const unsigned char *end = inputMessage + inputLength - 1; - const unsigned char *nextSrc = inputMessage + 16; - while (nextSrc < end) - { - unsigned int textLength = (unsigned int) *nextSrc++; - encodeBuffer.encodeBoolValue(1); - encodeBuffer.encodeValue(textLength, 8); - if (textLength == 255) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, 1), 29, - clientCache_ -> polyTextFontCache); - nextSrc += 4; - } - else - { - encodeBuffer.encodeCachedValue(*nextSrc++, 8, - clientCache_ -> polyTextDeltaCache); - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, textLength); - nextSrc += textLength; - } - } - encodeBuffer.encodeBoolValue(0); - } - break; - case X_PolyText16: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyText16 target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyText16 target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyText16 target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyText16); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - unsigned int x = GetUINT(inputMessage + 12, bigEndian_); - int xDiff = x - clientCache_ -> polyTextLastX; - clientCache_ -> polyTextLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache_ -> polyTextCacheX); - unsigned int y = GetUINT(inputMessage + 14, bigEndian_); - int yDiff = y - clientCache_ -> polyTextLastY; - clientCache_ -> polyTextLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache_ -> polyTextCacheY); - const unsigned char *end = inputMessage + inputLength - 1; - const unsigned char *nextSrc = inputMessage + 16; - while (nextSrc < end) - { - unsigned int textLength = (unsigned int) *nextSrc++; - encodeBuffer.encodeBoolValue(1); - encodeBuffer.encodeValue(textLength, 8); - if (textLength == 255) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, 1), 29, - clientCache_ -> polyTextFontCache); - nextSrc += 4; - } - else - { - encodeBuffer.encodeCachedValue(*nextSrc++, 8, - clientCache_ -> polyTextDeltaCache); - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, textLength * 2); - nextSrc += textLength * 2; - } - } - encodeBuffer.encodeBoolValue(0); - } - break; - case X_ImageText8: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_ImageText8 target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_ImageText8 target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_ImageText8 target id " - << t_id << " is unrecognized.\n" - << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ImageText8); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - unsigned int textLength = (unsigned int) inputMessage[1]; - encodeBuffer.encodeCachedValue(textLength, 8, - clientCache_ -> imageTextLengthCache, 4); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - unsigned int x = GetUINT(inputMessage + 12, bigEndian_); - int xDiff = x - clientCache_ -> imageTextLastX; - clientCache_ -> imageTextLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache_ -> imageTextCacheX); - unsigned int y = GetUINT(inputMessage + 14, bigEndian_); - int yDiff = y - clientCache_ -> imageTextLastY; - clientCache_ -> imageTextLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache_ -> imageTextCacheY); - const unsigned char *nextSrc = inputMessage + 16; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, textLength); - } - break; - case X_ImageText16: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_ImageText16 target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_ImageText16 target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_ImageText16 target id " - << t_id << " is unrecognized.\n" - << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ImageText16); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - unsigned int textLength = (unsigned int) inputMessage[1]; - encodeBuffer.encodeCachedValue(textLength, 8, - clientCache_ -> imageTextLengthCache, 4); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - unsigned int x = GetUINT(inputMessage + 12, bigEndian_); - int xDiff = x - clientCache_ -> imageTextLastX; - clientCache_ -> imageTextLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache_ -> imageTextCacheX); - unsigned int y = GetUINT(inputMessage + 14, bigEndian_); - int yDiff = y - clientCache_ -> imageTextLastY; - clientCache_ -> imageTextLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache_ -> imageTextCacheY); - const unsigned char *nextSrc = inputMessage + 16; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, textLength * 2); - } - break; - case X_InternAtom: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_InternAtom); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - // - // Set the priority, also if doing so will - // penalize all the well written clients - // using XInternAtoms() to pipeline multi- - // ple replies. - // - - priority_++; - - hit = 1; - - break; - } - - unsigned int nameLength = GetUINT(inputMessage + 4, bigEndian_); - encodeBuffer.encodeValue(nameLength, 16, 6); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - const unsigned char *nextSrc = inputMessage + 8; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, nameLength); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_ListExtensions: - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_ListFonts: - { - unsigned int textLength = GetUINT(inputMessage + 6, bigEndian_); - encodeBuffer.encodeValue(textLength, 16, 6); - encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16, 6); - const unsigned char* nextSrc = inputMessage + 8; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, textLength); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_LookupColor: - case X_AllocNamedColor: - { - unsigned int textLength = GetUINT(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(textLength, 16, 6); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, clientCache_ -> colormapCache); - const unsigned char *nextSrc = inputMessage + 12; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, textLength); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_MapWindow: - case X_UnmapWindow: - case X_MapSubwindows: - case X_GetWindowAttributes: - case X_DestroyWindow: - case X_DestroySubwindows: - case X_QueryPointer: - case X_QueryTree: - { - #ifdef TARGETS - - if (inputOpcode == X_DestroyWindow) - { - unsigned int w_id = GetULONG(inputMessage + 4, bigEndian_); - - *logofs << "handleRead: X_DestroyWindow id is " - << w_id << ".\n" << logofs_flush; - - windows.erase(w_id); - } - - #endif - - if (inputOpcode == X_DestroyWindow) - { - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> freeWindowCache); - } - else - { - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> windowCache); - } - - if ((inputOpcode == X_QueryPointer) || - (inputOpcode == X_GetWindowAttributes) || - (inputOpcode == X_QueryTree)) - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - } - break; - case X_OpenFont: - { - unsigned int nameLength = GetUINT(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(nameLength, 16, 7); - unsigned int font = GetULONG(inputMessage + 4, bigEndian_); - encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); - clientCache_ -> lastFont = font; - const unsigned char *nextSrc = inputMessage + 12; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, nameLength); - } - break; - case X_PolyFillRectangle: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyFillRectangle target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyFillRectangle target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyFillRectangle target id " - << t_id << " is unrecognized.\n" - << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyFillRectangle); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - unsigned int lastWidth = 0, lastHeight = 0; - - // - // TODO: Could send the size at the beginning - // instead of a bool at each iteration. - // - - for (unsigned int i = 12; i < inputLength;) - { - unsigned int x = GetUINT(inputMessage + i, bigEndian_); - unsigned int newX = x; - x -= lastX; - lastX = newX; - encodeBuffer.encodeCachedValue(x, 16, - *clientCache_ -> polyFillRectangleCacheX[index], 8); - i += 2; - unsigned int y = GetUINT(inputMessage + i, bigEndian_); - unsigned int newY = y; - y -= lastY; - lastY = newY; - encodeBuffer.encodeCachedValue(y, 16, - *clientCache_ -> polyFillRectangleCacheY[index], 8); - i += 2; - unsigned int width = GetUINT(inputMessage + i, bigEndian_); - unsigned int newWidth = width; - width -= lastWidth; - lastWidth = newWidth; - encodeBuffer.encodeCachedValue(width, 16, - *clientCache_ -> polyFillRectangleCacheWidth[index], 8); - i += 2; - unsigned int height = GetUINT(inputMessage + i, bigEndian_); - unsigned int newHeight = height; - height -= lastHeight; - lastHeight = newHeight; - encodeBuffer.encodeCachedValue(height, 16, - *clientCache_ -> polyFillRectangleCacheHeight[index], 8); - i += 2; - - if (++index == 4) index = 0; - - encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); - } - } - break; - case X_PolyFillArc: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyFillArc target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyFillArc target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyFillArc target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyFillArc); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - unsigned int lastWidth = 0, lastHeight = 0; - unsigned int lastAngle1 = 0, lastAngle2 = 0; - - // - // TODO: Could send the size at the beginning - // instead of a bool at each iteration. - // - - for (unsigned int i = 12; i < inputLength;) - { - unsigned int x = GetUINT(inputMessage + i, bigEndian_); - unsigned int newX = x; - x -= lastX; - lastX = newX; - encodeBuffer.encodeCachedValue(x, 16, - *clientCache_ -> polyFillArcCacheX[index], 8); - i += 2; - unsigned int y = GetUINT(inputMessage + i, bigEndian_); - unsigned int newY = y; - y -= lastY; - lastY = newY; - encodeBuffer.encodeCachedValue(y, 16, - *clientCache_ -> polyFillArcCacheY[index], 8); - i += 2; - unsigned int width = GetUINT(inputMessage + i, bigEndian_); - unsigned int newWidth = width; - width -= lastWidth; - lastWidth = newWidth; - encodeBuffer.encodeCachedValue(width, 16, - *clientCache_ -> polyFillArcCacheWidth[index], 8); - i += 2; - unsigned int height = GetUINT(inputMessage + i, bigEndian_); - unsigned int newHeight = height; - height -= lastHeight; - lastHeight = newHeight; - encodeBuffer.encodeCachedValue(height, 16, - *clientCache_ -> polyFillArcCacheHeight[index], 8); - i += 2; - unsigned int angle1 = GetUINT(inputMessage + i, bigEndian_); - unsigned int newAngle1 = angle1; - angle1 -= lastAngle1; - lastAngle1 = newAngle1; - encodeBuffer.encodeCachedValue(angle1, 16, - *clientCache_ -> polyFillArcCacheAngle1[index], 8); - i += 2; - unsigned int angle2 = GetUINT(inputMessage + i, bigEndian_); - unsigned int newAngle2 = angle2; - angle2 -= lastAngle2; - lastAngle2 = newAngle2; - encodeBuffer.encodeCachedValue(angle2, 16, - *clientCache_ -> polyFillArcCacheAngle2[index], 8); - i += 2; - - if (++index == 2) index = 0; - - encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); - } - } - break; - case X_PolyArc: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyArc target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyArc target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyArc target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyArc); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - unsigned int lastWidth = 0, lastHeight = 0; - unsigned int lastAngle1 = 0, lastAngle2 = 0; - - // - // TODO: Could send the size at the beginning - // instead of a bool at each iteration. - // - - for (unsigned int i = 12; i < inputLength;) - { - unsigned int x = GetUINT(inputMessage + i, bigEndian_); - unsigned int newX = x; - x -= lastX; - lastX = newX; - encodeBuffer.encodeCachedValue(x, 16, - *clientCache_ -> polyArcCacheX[index], 8); - i += 2; - unsigned int y = GetUINT(inputMessage + i, bigEndian_); - unsigned int newY = y; - y -= lastY; - lastY = newY; - encodeBuffer.encodeCachedValue(y, 16, - *clientCache_ -> polyArcCacheY[index], 8); - i += 2; - unsigned int width = GetUINT(inputMessage + i, bigEndian_); - unsigned int newWidth = width; - width -= lastWidth; - lastWidth = newWidth; - encodeBuffer.encodeCachedValue(width, 16, - *clientCache_ -> polyArcCacheWidth[index], 8); - i += 2; - unsigned int height = GetUINT(inputMessage + i, bigEndian_); - unsigned int newHeight = height; - height -= lastHeight; - lastHeight = newHeight; - encodeBuffer.encodeCachedValue(height, 16, - *clientCache_ -> polyArcCacheHeight[index], 8); - i += 2; - unsigned int angle1 = GetUINT(inputMessage + i, bigEndian_); - unsigned int newAngle1 = angle1; - angle1 -= lastAngle1; - lastAngle1 = newAngle1; - encodeBuffer.encodeCachedValue(angle1, 16, - *clientCache_ -> polyArcCacheAngle1[index], 8); - i += 2; - unsigned int angle2 = GetUINT(inputMessage + i, bigEndian_); - unsigned int newAngle2 = angle2; - angle2 -= lastAngle2; - lastAngle2 = newAngle2; - encodeBuffer.encodeCachedValue(angle2, 16, - *clientCache_ -> polyArcCacheAngle2[index], 8); - i += 2; - - if (++index == 2) index = 0; - - encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); - } - } - break; - case X_PolyPoint: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyPoint target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyPoint target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyPoint target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyPoint); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_) - 3, 16, 4); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), - clientCache_ -> gcCache); - const unsigned char *nextSrc = inputMessage + 12; - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - - for (unsigned int i = 12; i < inputLength; i += 4) - { - unsigned int x = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - unsigned int tmp = x; - x -= lastX; - lastX = tmp; - encodeBuffer.encodeCachedValue(x, 16, - *clientCache_ -> polyPointCacheX[index], 8); - unsigned int y = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - tmp = y; - y -= lastY; - lastY = tmp; - encodeBuffer.encodeCachedValue(y, 16, - *clientCache_ -> polyPointCacheY[index], 8); - - if (++index == 2) index = 0; - } - } - break; - case X_PolyLine: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolyLine target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolyLine target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolyLine target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyLine); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_) - 3, 16, 4); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - const unsigned char *nextSrc = inputMessage + 12; - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - - for (unsigned int i = 12; i < inputLength; i += 4) - { - unsigned int x = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - unsigned int tmp = x; - x -= lastX; - lastX = tmp; - encodeBuffer.encodeCachedValue(x, 16, - *clientCache_ -> polyLineCacheX[index], 8); - unsigned int y = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - tmp = y; - y -= lastY; - lastY = tmp; - encodeBuffer.encodeCachedValue(y, 16, - *clientCache_ -> polyLineCacheY[index], 8); - - if (++index == 2) index = 0; - } - } - break; - case X_PolyRectangle: - { - encodeBuffer.encodeValue((GetUINT(inputMessage + 2, - bigEndian_) - 3) >> 1, 16, 3); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - const unsigned char *end = inputMessage + inputLength; - const unsigned char *nextSrc = inputMessage + 12; - while (nextSrc < end) - { - for (unsigned int i = 0; i < 4; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> polyRectangleGeomCache[i], 8); - nextSrc += 2; - } - } - } - break; - case X_PolySegment: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PolySegment target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PolySegment target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PolySegment target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolySegment); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - encodeBuffer.encodeValue((GetUINT(inputMessage + 2, - bigEndian_) - 3) >> 1, 16, 4); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, - bigEndian_), clientCache_ -> gcCache); - const unsigned char *end = inputMessage + inputLength; - const unsigned char *nextSrc = inputMessage + 12; - // unsigned int index = 0; - // unsigned int lastX1, lastY1, lastX2, lastY2; - while (nextSrc < end) - { - unsigned int x = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - unsigned int xDiff0 = - x - clientCache_ -> polySegmentLastX[0]; - unsigned int xDiff1 = - x - clientCache_ -> polySegmentLastX[1]; - int xDiff0Abs = (int) xDiff0; - if (xDiff0Abs < 0) - xDiff0Abs = -xDiff0Abs; - int xDiff1Abs = (int) xDiff1; - if (xDiff1Abs < 0) - xDiff1Abs = -xDiff1Abs; - - unsigned int y = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - unsigned int yDiff0 = - y - clientCache_ -> polySegmentLastY[0]; - unsigned int yDiff1 = - y - clientCache_ -> polySegmentLastY[1]; - int yDiff0Abs = (int) yDiff0; - if (yDiff0Abs < 0) - yDiff0Abs = -yDiff0Abs; - int yDiff1Abs = (int) yDiff1; - if (yDiff1Abs < 0) - yDiff1Abs = -yDiff1Abs; - - int diff0 = xDiff0Abs + yDiff0Abs; - int diff1 = xDiff1Abs + yDiff1Abs; - if (diff0 < diff1) - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeCachedValue(xDiff0, 16, - clientCache_ -> polySegmentCacheX, 6); - encodeBuffer.encodeCachedValue(yDiff0, 16, - clientCache_ -> polySegmentCacheY, 6); - } - else - { - encodeBuffer.encodeBoolValue(1); - encodeBuffer.encodeCachedValue(xDiff1, 16, - clientCache_ -> polySegmentCacheX, 6); - encodeBuffer.encodeCachedValue(yDiff1, 16, - clientCache_ -> polySegmentCacheY, 6); - } - - clientCache_ -> polySegmentLastX[clientCache_ -> polySegmentCacheIndex] = x; - clientCache_ -> polySegmentLastY[clientCache_ -> polySegmentCacheIndex] = y; - - clientCache_ -> polySegmentCacheIndex = - clientCache_ -> polySegmentCacheIndex == 1 ? 0 : 1; - } - } - break; - case X_PutImage: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_PutImage target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_PutImage target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_PutImage target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PutImage); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - break; - case X_QueryBestSize: - { - encodeBuffer.encodeValue((unsigned int)inputMessage[1], 2); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - encodeBuffer.encodeValue(GetUINT(inputMessage + 8, bigEndian_), 16, 8); - encodeBuffer.encodeValue(GetUINT(inputMessage + 10, bigEndian_), 16, 8); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_QueryColors: - { - // Differential encoding. - encodeBuffer.encodeBoolValue(1); - - unsigned int numColors = ((inputLength - 8) >> 2); - encodeBuffer.encodeValue(numColors, 16, 5); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> colormapCache); - const unsigned char *nextSrc = inputMessage + 8; - unsigned int predictedPixel = clientCache_ -> queryColorsLastPixel; - for (unsigned int i = 0; i < numColors; i++) - { - unsigned int pixel = GetULONG(nextSrc, bigEndian_); - nextSrc += 4; - if (pixel == predictedPixel) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue(pixel, 32, 9); - } - if (i == 0) - clientCache_ -> queryColorsLastPixel = pixel; - predictedPixel = pixel + 1; - } - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_QueryExtension: - { - #ifdef TEST - - char data[256]; - - int length = GetUINT(inputMessage + 4, bigEndian_); - - if (length > 256) - { - length = 256; - } - - strncpy(data, (char *) inputMessage + 8, length); - - *(data + length) = '\0'; - - *logofs << "handleRead: Going to query extension '" - << data << "' for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - unsigned int nameLength = GetUINT(inputMessage + 4, bigEndian_); - encodeBuffer.encodeValue(nameLength, 16, 6); - const unsigned char *nextSrc = inputMessage + 8; - - for (; nameLength; nameLength--) - { - encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); - } - - unsigned int extension = 0; - - if (strncmp((char *) inputMessage + 8, "SHAPE", 5) == 0) - { - extension = X_NXInternalShapeExtension; - } - else if (strncmp((char *) inputMessage + 8, "RENDER", 6) == 0) - { - extension = X_NXInternalRenderExtension; - } - - sequenceQueue_.push(clientSequence_, inputOpcode, extension); - - priority_++; - } - break; - case X_QueryFont: - { - unsigned int font = GetULONG(inputMessage + 4, bigEndian_); - encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); - clientCache_ -> lastFont = font; - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_SetClipRectangles: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_SetClipRectangles); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - hit = 1; - - break; - } - - unsigned int numRectangles = ((inputLength - 12) >> 3); - - // Since ProtoStep9 (#issue 108) - encodeBuffer.encodeValue(numRectangles, 15, 4); - - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> gcCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, - clientCache_ -> setClipRectanglesXCache, 8); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 10, bigEndian_), 16, - clientCache_ -> setClipRectanglesYCache, 8); - const unsigned char *nextSrc = inputMessage + 12; - for (unsigned int i = 0; i < numRectangles; i++) - { - for (unsigned int j = 0; j < 4; j++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *clientCache_ -> setClipRectanglesGeomCache[j], 8); - nextSrc += 2; - } - } - } - break; - case X_SetDashes: - { - unsigned int numDashes = GetUINT(inputMessage + 10, bigEndian_); - encodeBuffer.encodeCachedValue(numDashes, 16, - clientCache_ -> setDashesLengthCache, 5); - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), - clientCache_ -> gcCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, - clientCache_ -> setDashesOffsetCache, 5); - const unsigned char *nextSrc = inputMessage + 12; - for (unsigned int i = 0; i < numDashes; i++) - encodeBuffer.encodeCachedValue(*nextSrc++, 8, - clientCache_ -> setDashesDashCache_[i & 1], 5); - } - break; - case X_SetSelectionOwner: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> setSelectionOwnerCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, - clientCache_ -> getSelectionOwnerSelectionCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 32, - clientCache_ -> setSelectionOwnerTimestampCache, 9); - } - break; - case X_TranslateCoords: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_TranslateCoords source id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_TranslateCoords source id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_TranslateCoords source id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - t_id = GetULONG(inputMessage + 8, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_TranslateCoords target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_TranslateCoords target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_TranslateCoords target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_TranslateCoords); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - - hit = 1; - - break; - } - - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - clientCache_ -> translateCoordsSrcCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, - clientCache_ -> translateCoordsDstCache, 9); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), 16, - clientCache_ -> translateCoordsXCache, 8); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 14, bigEndian_), 16, - clientCache_ -> translateCoordsYCache, 8); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetImage: - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_GetImage source id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_GetImage source id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_GetImage source id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_GetImage); - - if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, - inputMessage, inputLength)) - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - - hit = 1; - - break; - } - - // Format. - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); - // Drawable. - encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, - bigEndian_), clientCache_ -> drawableCache); - // X. - unsigned int x = GetUINT(inputMessage + 8, bigEndian_); - int xDiff = x - clientCache_ -> putImageLastX; - clientCache_ -> putImageLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache_ -> putImageXCache, 8); - // Y. - unsigned int y = GetUINT(inputMessage + 10, bigEndian_); - int yDiff = y - clientCache_ -> putImageLastY; - clientCache_ -> putImageLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache_ -> putImageYCache, 8); - // Width. - unsigned int width = GetUINT(inputMessage + 12, bigEndian_); - encodeBuffer.encodeCachedValue(width, 16, - clientCache_ -> putImageWidthCache, 8); - // Height. - unsigned int height = GetUINT(inputMessage + 14, bigEndian_); - encodeBuffer.encodeCachedValue(height, 16, - clientCache_ -> putImageHeightCache, 8); - // Plane mask. - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, - clientCache_ -> getImagePlaneMaskCache, 5); - - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetPointerMapping: - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - case X_GetKeyboardControl: - { - sequenceQueue_.push(clientSequence_, inputOpcode); - - priority_++; - } - break; - default: - { - if (inputOpcode == opcodeStore_ -> renderExtension) - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXInternalRenderExtension); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - else if (inputOpcode == opcodeStore_ -> shapeExtension) - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXInternalShapeExtension); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - else if (inputOpcode == opcodeStore_ -> putPackedImage) - { - #ifdef TARGETS - - unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); - - if (pixmaps.find(t_id) != pixmaps.end()) - { - *logofs << "handleRead: X_NXPutPackedImage target id is pixmap " - << t_id << ".\n" << logofs_flush; - } - else if (windows.find(t_id) != windows.end()) - { - *logofs << "handleRead: X_NXPutPackedImage target id is window " - << t_id << ".\n" << logofs_flush; - } - else - { - *logofs << "handleRead: X_NXPutPackedImage target id " << t_id - << " is unrecognized.\n" << logofs_flush; - } - - #endif - - #ifdef DEBUG - *logofs << "handleRead: Encoding packed image request for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - // - // The field carries the destination data - // length. We add the request's size of - // the final X_PutImage. - // - - unsigned int outputLength = GetULONG(inputMessage + 20, bigEndian_) + 24; - - statistics -> addPackedBytesIn(inputLength); - - statistics -> addPackedBytesOut(outputLength); - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXPutPackedImage); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - else if (inputOpcode == opcodeStore_ -> setUnpackColormap) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding set unpack colormap request " - << "for FD#" << fd_ << " with size " << inputLength - << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXSetUnpackColormap); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - else if (inputOpcode == opcodeStore_ -> setUnpackAlpha) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding set unpack alpha request " - << "for FD#" << fd_ << " with size " << inputLength - << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXSetUnpackAlpha); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - else if (inputOpcode == opcodeStore_ -> setUnpackGeometry) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding set unpack geometry request " - << "for FD#" << fd_ << " with size " << inputLength - << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXSetUnpackGeometry); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - } - else if (inputOpcode == opcodeStore_ -> startSplit) - { - if (handleStartSplitRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> endSplit) - { - if (handleEndSplitRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> commitSplit) - { - if (handleCommitSplitRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> abortSplit) - { - if (handleAbortSplitRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> finishSplit) - { - if (handleFinishSplitRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> freeSplit) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding free split request " - << "for FD#" << fd_ << " with size " << inputLength - << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, - clientCache_ -> resourceCache); - } - else if (inputOpcode == opcodeStore_ -> freeUnpack) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding free unpack request " - << "for FD#" << fd_ << " with size " << inputLength - << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, - clientCache_ -> resourceCache); - } - else if (inputOpcode == opcodeStore_ -> getControlParameters) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding get control parameters " - << "request for FD#" << fd_ << " with size " - << inputLength << ".\n" << logofs_flush; - #endif - - // - // Add the reply to the write buffer. If found - // to contain a message, it it will be flushed - // to the X client before leaving the loop. - // - - unsigned char *reply = writeBuffer_.addMessage(32); - - *(reply + 0) = X_Reply; - - PutUINT(clientSequence_, reply + 2, bigEndian_); - - PutULONG(0, reply + 4, bigEndian_); - - // - // Save the sequence number we used - // to auto-generate this reply. - // - - lastSequence_ = clientSequence_; - - #ifdef TEST - *logofs << "handleRead: Registered " << lastSequence_ - << " as last auto-generated sequence number.\n" - << logofs_flush; - #endif - - *(reply + 1) = control -> LinkMode; - - *(reply + 8) = control -> LocalVersionMajor; - *(reply + 9) = control -> LocalVersionMinor; - *(reply + 10) = control -> LocalVersionPatch; - - *(reply + 11) = control -> RemoteVersionMajor; - *(reply + 12) = control -> RemoteVersionMinor; - *(reply + 13) = control -> RemoteVersionPatch; - - PutUINT(control -> SplitTimeout, reply + 14, bigEndian_); - PutUINT(control -> MotionTimeout, reply + 16, bigEndian_); - - *(reply + 18) = control -> SplitMode; - - PutULONG(control -> SplitDataThreshold, reply + 20, bigEndian_); - - *(reply + 24) = control -> PackMethod; - *(reply + 25) = control -> PackQuality; - - *(reply + 26) = control -> LocalDataCompressionLevel; - *(reply + 27) = control -> LocalStreamCompressionLevel; - *(reply + 28) = control -> LocalDeltaCompression; - - *(reply + 29) = (control -> LocalDeltaCompression == 1 && - control -> PersistentCacheEnableLoad == 1); - *(reply + 30) = (control -> LocalDeltaCompression == 1 && - control -> PersistentCacheEnableSave == 1); - *(reply + 31) = (control -> LocalDeltaCompression == 1 && - control -> PersistentCacheEnableLoad == 1 && - control -> PersistentCacheName != NULL); - - if (handleFlush(flush_if_any) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> getCleanupParameters) - { - #ifdef WARNING - *logofs << "handleRead: WARNING! Encoding fake get cleanup " - << "parameters request for FD#" << fd_ << " with size " - << inputLength << ".\n" << logofs_flush; - #endif - } - else if (inputOpcode == opcodeStore_ -> getImageParameters) - { - #ifdef WARNING - *logofs << "handleRead: WARNING! Encoding fake get cleanup " - << "parameters request for FD#" << fd_ << " with size " - << inputLength << ".\n" << logofs_flush; - #endif - } - else if (inputOpcode == opcodeStore_ -> getUnpackParameters) - { - #ifdef DEBUG - *logofs << "handleRead: Encoding get unpack parameters " - << "request for FD#" << fd_ << " with size " - << inputLength << ".\n" << logofs_flush; - #endif - - sequenceQueue_.push(clientSequence_, inputOpcode); - } - else if (inputOpcode == opcodeStore_ -> getShmemParameters) - { - if (handleShmemRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> setExposeParameters) - { - // - // Enable or disable expose events - // coming from the real server. - // - - encodeBuffer.encodeBoolValue(*(inputMessage + 4)); - encodeBuffer.encodeBoolValue(*(inputMessage + 5)); - encodeBuffer.encodeBoolValue(*(inputMessage + 6)); - } - else if (inputOpcode == opcodeStore_ -> setCacheParameters) - { - if (handleCacheRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else if (inputOpcode == opcodeStore_ -> getFontParameters) - { - if (handleFontRequest(encodeBuffer, inputOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - else - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXInternalGenericRequest); - - hit = handleEncode(encodeBuffer, clientCache_, messageStore, - inputOpcode, inputMessage, inputLength); - - // - // Don't flush if the opcode is unrecognized. - // We may optionally flush it is an extension - // but would penalize the well written clients. - // - // if (inputOpcode > 127) - // { - // priority_++; - // } - // - } - } - } // End of switch on opcode. - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - - const char *cacheString = (hit ? "cached " : ""); - - *logofs << "handleRead: Handled " << cacheString << "request OPCODE#" - << (unsigned int) inputOpcode << " (" << DumpOpcode(inputOpcode) - << ")" << " for FD#" << fd_ << " sequence " << clientSequence_ - << ". " << inputLength << " bytes in, " << bits << " bits (" - << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; - - #endif - - if (hit) - { - statistics -> addCachedRequest(inputOpcode); - } - - statistics -> addRequestBits(inputOpcode, inputLength << 3, bits); - - if (inputOpcode == opcodeStore_ -> renderExtension) - { - if (hit) - { - statistics -> addRenderCachedRequest(*(inputMessage + 1)); - } - - statistics -> addRenderRequestBits(*(inputMessage + 1), inputLength << 3, bits); - } - - } // End if (firstRequest_)... else ... - - } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != 0) ... - - // - // Check if we need to flush because of - // prioritized data. - // - - if (priority_ > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: WARNING! Requesting flush " - << "because of " << priority_ << " prioritized " - << "messages for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncPriority() < 0) - { - return -1; - } - - // - // Reset the priority flag. - // - - priority_ = 0; - } - - // - // Flush if we exceeded the token length. - // - - if (proxy -> canAsyncFlush() == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: WARNING! Requesting flush " - << "because of token length exceeded.\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncFlush() < 0) - { - return -1; - } - } - - #if defined(TEST) || defined(INFO) - - if (transport_ -> pending() != 0 || - readBuffer_.checkMessage() != 0) - { - *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" - << fd_ << " has " << transport_ -> pending() - << " bytes to read.\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Reset the read buffer. - // - - readBuffer_.fullReset(); - - return 1; -} - -// -// End of handleRead(). -// - -// -// Beginning of handleWrite(). -// - -int ClientChannel::handleWrite(const unsigned char *message, unsigned int length) -{ - #ifdef TEST - *logofs << "handleWrite: Called for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - // - // Create the buffer from which to - // decode messages. - // - - DecodeBuffer decodeBuffer(message, length); - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "handleWrite: Decoding messages for FD#" << fd_ - << " with " << length << " bytes in the buffer.\n" - << logofs_flush; - #endif - - if (firstReply_) - { - #ifdef TEST - *logofs << "handleWrite: First reply detected.\n" << logofs_flush; - #endif - - unsigned int outputOpcode; - - decodeBuffer.decodeValue(outputOpcode, 8); - unsigned int secondByte; - decodeBuffer.decodeValue(secondByte, 8); - unsigned int major; - decodeBuffer.decodeValue(major, 16); - unsigned int minor; - decodeBuffer.decodeValue(minor, 16); - unsigned int extraLength; - decodeBuffer.decodeValue(extraLength, 16); - unsigned int outputLength = 8 + (extraLength << 2); - - unsigned char *outputMessage = writeBuffer_.addMessage(outputLength); - *outputMessage = (unsigned char) outputOpcode; - outputMessage[1] = (unsigned char) secondByte; - PutUINT(major, outputMessage + 2, bigEndian_); - PutUINT(minor, outputMessage + 4, bigEndian_); - PutUINT(extraLength, outputMessage + 6, bigEndian_); - unsigned char *nextDest = outputMessage + 8; - unsigned int cached; - decodeBuffer.decodeBoolValue(cached); - - if (cached) - { - memcpy(nextDest, ServerCache::lastInitReply.getData(), outputLength - 8); - } - else - { - for (unsigned i = 8; i < outputLength; i++) - { - unsigned int nextByte; - decodeBuffer.decodeValue(nextByte, 8); - *nextDest++ = (unsigned char) nextByte; - } - - ServerCache::lastInitReply.set(outputLength - 8, outputMessage + 8); - } - - imageByteOrder_ = outputMessage[30]; - bitmapBitOrder_ = outputMessage[31]; - scanlineUnit_ = outputMessage[32]; - scanlinePad_ = outputMessage[33]; - - firstReply_ = 0; - - } // End of if (firstReply_) - - // - // This was previously in a 'else' block. - // Due to the way the first request was - // handled, we could not decode multiple - // messages in the first frame. - // - - { // Start of the decoding block. - - #ifdef DEBUG - *logofs << "handleWrite: Starting loop on opcodes.\n" - << logofs_flush; - #endif - - unsigned char outputOpcode; - - // - // NX client needs this line to consider - // the initialization phase successfully - // completed. - // - - if (firstClient_ == -1) - { - cerr << "Info" << ": Established X client connection.\n" ; - - firstClient_ = fd_; - } - - while (decodeBuffer.decodeOpcodeValue(outputOpcode, serverCache_ -> opcodeCache, 1)) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoded a new OPCODE#" - << (unsigned int) outputOpcode << ".\n" - << logofs_flush; - #endif - - unsigned char *outputMessage = NULL; - unsigned int outputLength = 0; - - // - // General-purpose temp variables - // for decoding ints and chars. - // - - unsigned int value = 0; - unsigned char cValue = 0; - - // - // Check first if we need to abort any split, - // then if this is a reply, finally if it is - // en event or error. - // - - if (outputOpcode == opcodeStore_ -> splitEvent) - { - // - // It's an abort split, not a normal - // burst of proxy data. - // - - handleSplitEvent(decodeBuffer); - - continue; - } - else if (outputOpcode == X_Reply) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding sequence number of reply.\n" - << logofs_flush; - #endif - - unsigned int sequenceNum; - unsigned int sequenceDiff; - - decodeBuffer.decodeCachedValue(sequenceDiff, 16, - serverCache_ -> replySequenceCache, 7); - - sequenceNum = (serverSequence_ + sequenceDiff) & 0xffff; - - serverSequence_ = sequenceNum; - - #ifdef DEBUG - *logofs << "handleWrite: Last server sequence number for FD#" - << fd_ << " is " << serverSequence_ << " with " - << "difference " << sequenceDiff << ".\n" - << logofs_flush; - #endif - - // - // In case of reply we can follow the X server and - // override any event's sequence number generated - // by this side. - // - - #ifdef TEST - *logofs << "handleWrite: Updating last event's sequence " - << lastSequence_ << " to reply's sequence number " - << serverSequence_ << " for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - lastSequence_ = serverSequence_; - - unsigned short int requestSequenceNum; - unsigned char requestOpcode; - - #ifdef DEBUG - - requestSequenceNum = 0; - requestOpcode = 0; - - *logofs << "handleWrite: Peek of sequence number returns "; - - *logofs << sequenceQueue_.peek(requestSequenceNum, requestOpcode); - - *logofs << " with sequence " << requestSequenceNum << " and opcode " - << (unsigned int) requestOpcode << ".\n" << logofs_flush; - - #endif - - if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) == 1 && - (requestSequenceNum == sequenceNum)) - { - unsigned int requestData[3]; - - sequenceQueue_.pop(requestSequenceNum, requestOpcode, - requestData[0], requestData[1], requestData[2]); - - #ifdef DEBUG - *logofs << "handleWrite: Identified reply to OPCODE#" - << (unsigned int) requestOpcode << ".\n" - << logofs_flush; - #endif - - // - // Is differential encoding disabled? - // - - if (control -> RemoteDeltaCompression == 0) - { - int result = handleFastWriteReply(decodeBuffer, requestOpcode, - outputMessage, outputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - switch (requestOpcode) - { - case X_AllocColor: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - unsigned char *nextDest = outputMessage + 8; - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeBoolValue(value); - if (value) - { - PutUINT(requestData[i], nextDest, bigEndian_); - } - else - { - decodeBuffer.decodeValue(value, 16, 6); - PutUINT(requestData[i] + value, nextDest, bigEndian_); - } - nextDest += 2; - } - decodeBuffer.decodeValue(value, 32, 9); - PutULONG(value, outputMessage + 16, bigEndian_); - } - break; - case X_GetAtomName: - { - unsigned int nameLength; - decodeBuffer.decodeValue(nameLength, 16, 6); - outputLength = RoundUp4(nameLength) + 32; - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(nameLength, outputMessage + 8, bigEndian_); - unsigned char* nextDest = outputMessage + 32; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, nameLength); - } - break; - case X_GetGeometry: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> depthCache); - outputMessage[1] = cValue; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> getGeometryRootCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - for (unsigned int i = 0; i < 5; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *serverCache_ -> getGeometryGeomCache[i], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - } - break; - case X_GetInputFocus: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 2); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> getInputFocusWindowCache); - PutULONG(value, outputMessage + 8, bigEndian_); - } - break; - case X_GetKeyboardMapping: - { - decodeBuffer.decodeBoolValue(value); - if (value) - { - unsigned int dataLength = - ServerCache::getKeyboardMappingLastMap.getLength(); - outputLength = 32 + dataLength; - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = - ServerCache::getKeyboardMappingLastKeysymsPerKeycode; - memcpy(outputMessage + 32, - ServerCache::getKeyboardMappingLastMap.getData(), - dataLength); - break; - } - unsigned int numKeycodes; - decodeBuffer.decodeValue(numKeycodes, 8); - unsigned int keysymsPerKeycode; - decodeBuffer.decodeValue(keysymsPerKeycode, 8, 4); - ServerCache::getKeyboardMappingLastKeysymsPerKeycode = - keysymsPerKeycode; - outputLength = 32 + numKeycodes * keysymsPerKeycode * 4; - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) keysymsPerKeycode; - unsigned char *nextDest = outputMessage + 32; - unsigned char previous = 0; - for (unsigned int count = numKeycodes * keysymsPerKeycode; - count; --count) - { - decodeBuffer.decodeBoolValue(value); - if (value) - PutULONG((unsigned int) NoSymbol, nextDest, bigEndian_); - else - { - unsigned int keysym; - decodeBuffer.decodeCachedValue(keysym, 24, - serverCache_ -> getKeyboardMappingKeysymCache, 9); - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> getKeyboardMappingLastByteCache, 5); - previous += cValue; - PutULONG((keysym << 8) | previous, nextDest, bigEndian_); - } - nextDest += 4; - } - ServerCache::getKeyboardMappingLastMap.set(outputLength - 32, - outputMessage + 32); - } - break; - case X_GetModifierMapping: - { - unsigned int keycodesPerModifier; - decodeBuffer.decodeValue(keycodesPerModifier, 8); - outputLength = 32 + (keycodesPerModifier << 3); - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) keycodesPerModifier; - unsigned char *nextDest = outputMessage + 32; - decodeBuffer.decodeBoolValue(value); - if (value) - { - memcpy(outputMessage + 32, - ServerCache::getModifierMappingLastMap.getData(), - ServerCache::getModifierMappingLastMap.getLength()); - break; - } - for (unsigned int count = outputLength - 32; count; count--) - { - decodeBuffer.decodeBoolValue(value); - if (value) - *nextDest++ = 0; - else - { - decodeBuffer.decodeValue(value, 8); - *nextDest++ = value; - } - } - ServerCache::getModifierMappingLastMap.set(outputLength - 32, - outputMessage + 32); - } - break; - case X_GetProperty: - { - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_GetProperty); - - handleDecode(decodeBuffer, serverCache_, messageStore, - requestOpcode, outputMessage, outputLength); - } - break; - case X_GetSelectionOwner: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> getSelectionOwnerCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - } - break; - case X_GetWindowAttributes: - { - outputLength = 44; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 2); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> visualCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> getWindowAttributesClassCache, 3); - PutUINT(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> getWindowAttributesBitGravityCache); - outputMessage[14] = cValue; - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> getWindowAttributesWinGravityCache); - outputMessage[15] = cValue; - decodeBuffer.decodeCachedValue(value, 32, - serverCache_ -> getWindowAttributesPlanesCache, 9); - PutULONG(value, outputMessage + 16, bigEndian_); - decodeBuffer.decodeCachedValue(value, 32, - serverCache_ -> getWindowAttributesPixelCache, 9); - PutULONG(value, outputMessage + 20, bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[24] = (unsigned char) value; - decodeBuffer.decodeBoolValue(value); - outputMessage[25] = (unsigned char) value; - decodeBuffer.decodeValue(value, 2); - outputMessage[26] = (unsigned char) value; - decodeBuffer.decodeBoolValue(value); - outputMessage[27] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> colormapCache, 9); - PutULONG(value, outputMessage + 28, bigEndian_); - decodeBuffer.decodeCachedValue(value, 32, - serverCache_ -> getWindowAttributesAllEventsCache); - PutULONG(value, outputMessage + 32, bigEndian_); - decodeBuffer.decodeCachedValue(value, 32, - serverCache_ -> getWindowAttributesYourEventsCache); - PutULONG(value, outputMessage + 36, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> getWindowAttributesDontPropagateCache); - PutUINT(value, outputMessage + 40, bigEndian_); - } - break; - case X_GrabKeyboard: - case X_GrabPointer: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 3); - outputMessage[1] = (unsigned char) value; - } - break; - case X_InternAtom: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 29, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - } - break; - case X_ListExtensions: - { - decodeBuffer.decodeValue(value, 32, 8); - outputLength = 32 + (value << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - unsigned int numExtensions; - decodeBuffer.decodeValue(numExtensions, 8); - outputMessage[1] = (unsigned char) numExtensions; - unsigned char *nextDest = outputMessage + 32; - for (; numExtensions; numExtensions--) - { - unsigned int length; - decodeBuffer.decodeValue(length, 8); - *nextDest++ = (unsigned char) length; - for (; length; length--) - { - decodeBuffer.decodeValue(value, 8); - *nextDest++ = value; - } - } - } - break; - case X_ListFonts: - { - // - // Differential compression can achieve a 12:1 to 14:1 - // ratio, while the best ZLIB compression can achieve - // a mere 4:1 to 5:1. In the first case, though, the - // huge amount of data constituting the message would - // be stored uncompressed at the remote side. We need - // to find a compromise. The solution is to use diffe- - // rential compression at startup and ZLIB compression - // later on. - // - - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_ListFonts); - - if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - decodeBuffer.decodeValue(value, 32, 8); - outputLength = 32 + (value << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - unsigned int numFonts; - decodeBuffer.decodeValue(numFonts, 16, 6); - PutUINT(numFonts, outputMessage + 8, bigEndian_); - - // Differential or plain data compression? - decodeBuffer.decodeBoolValue(value); - - if (value) - { - unsigned char* nextDest = outputMessage + 32; - for (; numFonts; numFonts--) - { - unsigned int length; - decodeBuffer.decodeValue(length, 8); - *nextDest++ = (unsigned char)length; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, length); - nextDest += length; - } - - handleSave(messageStore, outputMessage, outputLength); - } - else - { - const unsigned char *compressedData = NULL; - unsigned int compressedDataSize = 0; - - int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset, - outputMessage, outputLength, compressedData, - compressedDataSize); - if (decompressed < 0) - { - return -1; - } - else if (decompressed > 0) - { - handleSave(messageStore, outputMessage, outputLength, - compressedData, compressedDataSize); - } - else - { - handleSave(messageStore, outputMessage, outputLength); - } - } - } - break; - case X_LookupColor: - case X_AllocNamedColor: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - unsigned char *nextDest = outputMessage + 8; - if (requestOpcode == X_AllocNamedColor) - { - decodeBuffer.decodeValue(value, 32, 9); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - unsigned int count = 3; - do - { - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, nextDest, bigEndian_); - unsigned int visualColor; - decodeBuffer.decodeValue(visualColor, 16, 5); - visualColor += value; - visualColor &= 0xffff; - PutUINT(visualColor, nextDest + 6, bigEndian_); - nextDest += 2; - } - while (--count); - } - break; - case X_QueryBestSize: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 16, 8); - PutUINT(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 16, 8); - PutUINT(value, outputMessage + 10, bigEndian_); - } - break; - case X_QueryColors: - { - // Differential or plain data compression? - decodeBuffer.decodeBoolValue(value); - - if (value) - { - decodeBuffer.decodeBoolValue(value); - if (value) - { - unsigned int numColors = - serverCache_ -> queryColorsLastReply.getLength() / 6; - outputLength = 32 + (numColors << 3); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(numColors, outputMessage + 8, bigEndian_); - const unsigned char *nextSrc = - serverCache_ -> queryColorsLastReply.getData(); - unsigned char *nextDest = outputMessage + 32; - for (; numColors; numColors--) - { - for (unsigned int i = 0; i < 6; i++) - *nextDest++ = *nextSrc++; - nextDest += 2; - } - } - else - { - unsigned int numColors; - decodeBuffer.decodeValue(numColors, 16, 5); - outputLength = 32 + (numColors << 3); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(numColors, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 32; - for (unsigned int c = 0; c < numColors; c++) - { - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeValue(value, 16); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - } - serverCache_ -> queryColorsLastReply.set(numColors * 6, - outputMessage + 32); - const unsigned char *nextSrc = nextDest - 1; - nextDest = outputMessage + 32 + ((numColors - 1) << 3) + 5; - for (; numColors > 1; numColors--) - { - for (unsigned int i = 0; i < 6; i++) - *nextDest-- = *nextSrc--; - nextDest -= 2; - } - } - } - else - { - // Reply length. - unsigned int numColors; - decodeBuffer.decodeValue(numColors, 16, 5); - outputLength = 32 + (numColors << 3); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(numColors, outputMessage + 8, bigEndian_); - - const unsigned char *compressedData = NULL; - unsigned int compressedDataSize = 0; - - int decompressed = handleDecompress(decodeBuffer, requestOpcode, 32, - outputMessage, outputLength, compressedData, - compressedDataSize); - if (decompressed < 0) - { - return -1; - } - } - } - break; - case X_QueryExtension: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[8] = (unsigned char) value; - decodeBuffer.decodeValue(value, 8); - outputMessage[9] = (unsigned char) value; - decodeBuffer.decodeValue(value, 8); - outputMessage[10] = (unsigned char) value; - decodeBuffer.decodeValue(value, 8); - outputMessage[11] = (unsigned char) value; - - // - // We use a predefined opcode to address - // extensions' message stores, while real - // opcodes are used for communication with - // X server and clients. - // - - if (requestData[0] == X_NXInternalShapeExtension) - { - opcodeStore_ -> shapeExtension = outputMessage[9]; - - #ifdef TEST - *logofs << "handleWrite: Shape extension opcode for FD#" << fd_ - << " is " << (unsigned int) opcodeStore_ -> shapeExtension - << ".\n" << logofs_flush; - #endif - } - else if (requestData[0] == X_NXInternalRenderExtension) - { - opcodeStore_ -> renderExtension = outputMessage[9]; - - #ifdef TEST - *logofs << "handleWrite: Render extension opcode for FD#" << fd_ - << " is " << (unsigned int) opcodeStore_ -> renderExtension - << ".\n" << logofs_flush; - #endif - } - } - break; - case X_QueryFont: - { - // - // Use differential compression at startup and plain - // data compression later. Check X_ListFonts message - // for an explaination. - // - - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_QueryFont); - - if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - // Differential or plain data compression? - decodeBuffer.decodeBoolValue(value); - - if (value) - { - unsigned int numProperties; - unsigned int numCharInfos; - decodeBuffer.decodeValue(numProperties, 16, 8); - decodeBuffer.decodeValue(numCharInfos, 32, 10); - outputLength = 60 + numProperties * 8 + numCharInfos * 12; - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(numProperties, outputMessage + 46, bigEndian_); - PutULONG(numCharInfos, outputMessage + 56, bigEndian_); - handleDecodeCharInfo(decodeBuffer, outputMessage + 8); - handleDecodeCharInfo(decodeBuffer, outputMessage + 24); - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, outputMessage + 40, bigEndian_); - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, outputMessage + 42, bigEndian_); - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, outputMessage + 44, bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[48] = (unsigned char) value; - decodeBuffer.decodeValue(value, 8); - outputMessage[49] = (unsigned char) value; - decodeBuffer.decodeValue(value, 8); - outputMessage[50] = (unsigned char) value; - decodeBuffer.decodeBoolValue(value); - outputMessage[51] = (unsigned char) value; - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, outputMessage + 52, bigEndian_); - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, outputMessage + 54, bigEndian_); - unsigned char *nextDest = outputMessage + 60; - decodeBuffer.decodeBoolValue(value); - - int end = 0; - - if (value == 1) - { - unsigned int index; - decodeBuffer.decodeValue(index, 4); - unsigned int length; - const unsigned char *data; - ServerCache::queryFontFontCache.get(index, length, data); - memcpy(nextDest, data, length); - - end = 1; - } - - if (end == 0) - { - unsigned char *saveDest = nextDest; - unsigned int length = numProperties * 8 + numCharInfos * 12; - for (; numProperties; numProperties--) - { - decodeBuffer.decodeValue(value, 32, 9); - PutULONG(value, nextDest, bigEndian_); - decodeBuffer.decodeValue(value, 32, 9); - PutULONG(value, nextDest + 4, bigEndian_); - nextDest += 8; - } - for (; numCharInfos; numCharInfos--) - { - handleDecodeCharInfo(decodeBuffer, nextDest); - - nextDest += 12; - } - ServerCache::queryFontFontCache.set(length, saveDest); - } - - handleSave(messageStore, outputMessage, outputLength); - } - else - { - // Reply length. - unsigned int replyLength; - decodeBuffer.decodeValue(replyLength, 32, 16); - outputLength = 32 + (replyLength << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - - const unsigned char *compressedData = NULL; - unsigned int compressedDataSize = 0; - - int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset, - outputMessage, outputLength, compressedData, - compressedDataSize); - if (decompressed < 0) - { - return -1; - } - else if (decompressed > 0) - { - handleSave(messageStore, outputMessage, outputLength, - compressedData, compressedDataSize); - } - else - { - handleSave(messageStore, outputMessage, outputLength); - } - } - } - break; - case X_QueryPointer: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> queryPointerRootCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> queryPointerChildCache, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyRootXCache, 8); - serverCache_ -> motionNotifyLastRootX += value; - PutUINT(serverCache_ -> motionNotifyLastRootX, outputMessage + 16, - bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyRootYCache, 8); - serverCache_ -> motionNotifyLastRootY += value; - PutUINT(serverCache_ -> motionNotifyLastRootY, outputMessage + 18, - bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyEventXCache, 8); - PutUINT(serverCache_ -> motionNotifyLastRootX + value, - outputMessage + 20, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyEventYCache, 8); - PutUINT(serverCache_ -> motionNotifyLastRootY + value, - outputMessage + 22, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyStateCache); - PutUINT(value, outputMessage + 24, bigEndian_); - } - break; - case X_QueryTree: - { - unsigned int children; - decodeBuffer.decodeValue(children, 16, 8); - - outputLength = 32 + (children << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - - PutULONG(outputLength, outputMessage + 4, bigEndian_); - - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> queryTreeWindowCache); - - PutULONG(value, outputMessage + 8, bigEndian_); - - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> queryTreeWindowCache); - - PutULONG(value, outputMessage + 12, bigEndian_); - - unsigned char *next = outputMessage + 32; - - PutUINT(children, outputMessage + 16, bigEndian_); - - for (unsigned int i = 0; i < children; i++) - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> queryTreeWindowCache); - - PutULONG(value, next + (i * 4), bigEndian_); - } - } - break; - case X_TranslateCoords: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> translateCoordsChildCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> translateCoordsXCache, 8); - PutUINT(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> translateCoordsYCache, 8); - PutUINT(value, outputMessage + 14, bigEndian_); - } - break; - case X_GetImage: - { - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_GetImage); - - if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - // Depth. - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> depthCache); - // Reply length. - unsigned int replyLength; - decodeBuffer.decodeValue(replyLength, 32, 9); - outputLength = 32 + (replyLength << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) cValue; - // Visual. - unsigned int visual; - decodeBuffer.decodeCachedValue(visual, 29, - serverCache_ -> visualCache); - PutULONG(visual, outputMessage + 8, bigEndian_); - - // Since ProtoStep8 (#issue 108) - handleCopy(decodeBuffer, requestOpcode, messageStore -> - dataOffset, outputMessage, outputLength); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_GetPointerMapping: - { - unsigned int nextByte; - decodeBuffer.decodeValue(nextByte, 8, 4); - unsigned int replyLength; - decodeBuffer.decodeValue(replyLength, 32, 4); - outputLength = 32 + (replyLength << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) nextByte; - unsigned char *nextDest = outputMessage + 32; - for (unsigned int i = 32; i < outputLength; i++) - { - decodeBuffer.decodeValue(nextByte, 8, 4); - *nextDest++ = (unsigned char) nextByte; - } - } - break; - case X_GetKeyboardControl: - { - unsigned int nextByte; - decodeBuffer.decodeValue(nextByte, 8, 2); - unsigned int replyLength; - decodeBuffer.decodeValue(replyLength, 32, 8); - outputLength = 32 + (replyLength << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) nextByte; - unsigned char *nextDest = outputMessage + 8; - for (unsigned int i = 8; i < outputLength; i++) - { - decodeBuffer.decodeValue(nextByte, 8, 4); - *nextDest++ = (unsigned char) nextByte; - } - } - break; - default: - { - if (requestOpcode == opcodeStore_ -> getUnpackParameters) - { - #ifdef TEST - *logofs << "handleWrite: Received get unpack parameters reply " - << "OPCODE#" << (unsigned int) opcodeStore_ -> getUnpackParameters - << ".\n" << logofs_flush; - #endif - - outputLength = 32 + PACK_METHOD_LIMIT; - - outputMessage = writeBuffer_.addMessage(outputLength); - - unsigned int method; - - // - // Let agent use only the unpack methods - // implemented at both sides. - // - - for (int i = 0; i < PACK_METHOD_LIMIT; i++) - { - decodeBuffer.decodeBoolValue(method); - - control -> RemoteUnpackMethods[i] = method; - - *(outputMessage + 32 + i) = - (control -> LocalUnpackMethods[i] == 1 && - method == 1); - } - } - else if (requestOpcode == opcodeStore_ -> getShmemParameters) - { - if (handleShmemReply(decodeBuffer, requestOpcode, - outputMessage, outputLength) < 0) - { - return -1; - } - } - else if (requestOpcode == opcodeStore_ -> getFontParameters) - { - if (handleFontReply(decodeBuffer, requestOpcode, - outputMessage, outputLength) < 0) - { - return -1; - } - } - else - { - #ifdef PANIC - *logofs << "handleWrite: PANIC! No matching request for " - << "reply with sequence number " << sequenceNum - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": No matching request for " - << "reply with sequence number " << sequenceNum - << ".\n"; - - return -1; - } - } - } - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: Handled reply to OPCODE#" - << (unsigned) requestOpcode << " (" << DumpOpcode(requestOpcode) - << ")" << " for FD#" << fd_ << " with sequence " << serverSequence_ - << ". Output size is " << outputLength << ".\n" << logofs_flush; - #endif - - statistics -> addRepliedRequest(requestOpcode); - } - else // End of if (sequenceQueue_.peek() && ...) - { - // - // Reply didn't match any request opcode. - // Check again if differential encoding - // is disabled. - // - - #ifdef DEBUG - *logofs << "handleWrite: Identified generic reply.\n" - << logofs_flush; - #endif - - requestOpcode = X_Reply; - - if (control -> RemoteDeltaCompression == 0) - { - int result = handleFastWriteReply(decodeBuffer, requestOpcode, - outputMessage, outputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - // - // All replies whose opcode is not pushed in - // sequence number queue are cached together. - // Among such replies are those to extension - // requests. - // - - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_NXInternalGenericReply); - - handleDecode(decodeBuffer, serverCache_, messageStore, - requestOpcode, outputMessage, outputLength); - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: Handled generic reply for FD#" << fd_ - << " with sequence " << serverSequence_ << ". Output size is " - << outputLength << ".\n" << logofs_flush; - #endif - - statistics -> addRepliedRequest(requestOpcode); - - } // End of if (sequenceQueue_.peek() && ...) else ... - - // - // If any output was produced then write opcode, - // sequence number and size to the buffer. - // - - if (outputLength > 0) - { - *outputMessage = outputOpcode; - - PutUINT(serverSequence_, outputMessage + 2, bigEndian_); - - PutULONG((outputLength - 32) >> 2, outputMessage + 4, bigEndian_); - } - - } // End of if (outputOpcode == 1)... - else - { - // - // It's an event or error. - // - - unsigned int sequenceNum; - unsigned int sequenceDiff; - - decodeBuffer.decodeCachedValue(sequenceDiff, 16, - serverCache_ -> eventSequenceCache, 7); - - sequenceNum = (serverSequence_ + sequenceDiff) & 0xffff; - - serverSequence_ = sequenceNum; - - #ifdef DEBUG - *logofs << "handleWrite: Last server sequence number for FD#" - << fd_ << " is " << serverSequence_ << " with " - << "difference " << sequenceDiff << ".\n" - << logofs_flush; - #endif - - // - // Check if this is an error that matches - // a sequence number for which we were - // expecting a reply. - // - - if (outputOpcode == X_Error) - { - unsigned short int errorSequenceNum; - unsigned char errorOpcode; - - if (sequenceQueue_.peek(errorSequenceNum, errorOpcode) && - ((unsigned) errorSequenceNum == serverSequence_)) - { - // - // Remove the queued sequence of the reply. - // - - #ifdef TEST - *logofs << "handleWrite: WARNING! Removing reply to OPCODE#" - << (unsigned) errorOpcode << " sequence " - << errorSequenceNum << " for FD#" << fd_ - << " due to error.\n" << logofs_flush; - #endif - - sequenceQueue_.pop(errorSequenceNum, errorOpcode); - - // - // Send to the client the current sequence - // number, not the number that matched the - // reply. Because we are generating replies - // at our side, Xlib can incur in a sequence - // lost if the error comes after the auto- - // generated reply. - // - - if (control -> SessionMode == session_proxy) - { - #ifdef TEST - *logofs << "handleWrite: Updating last event's sequence " - << lastSequence_ << " to X server's error sequence " - << "number " << serverSequence_ << " for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - lastSequence_ = serverSequence_; - } - } - - // - // In case of errors always send to client the - // original X server's sequence associated to - // the failing request. - // - - if (control -> SessionMode != session_proxy) - { - #ifdef TEST - *logofs << "handleWrite: Updating last event's sequence " - << lastSequence_ << " to X server's error sequence " - << "number " << serverSequence_ << " for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - lastSequence_ = serverSequence_; - } - } - - // - // Check if by producing events at client side we - // have modified the events' sequence numbering. - // In this case taint the original sequence to - // comply with the last one known by client. - // - -/* -FIXME: Recover the sequence number if the proxy - is not connected to an agent. -*/ - if (serverSequence_ > lastSequence_ || - control -> SessionMode != session_proxy) - { - #ifdef DEBUG - *logofs << "handleWrite: Updating last event's sequence " - << lastSequence_ << " to X server's sequence number " - << serverSequence_ << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - lastSequence_ = serverSequence_; - } - #ifdef DEBUG - else if (serverSequence_ < lastSequence_) - { - // - // Use our last auto-generated sequence. - // - - *logofs << "handleWrite: Tainting sequence number " - << serverSequence_ << " to last event's sequence " - << lastSequence_ << " for FD#" << fd_ << ".\n" - << logofs_flush; - } - #endif - - // - // Check if remote side used fast encoding. - // - - if (control -> RemoteDeltaCompression == 0) - { - int result = handleFastWriteEvent(decodeBuffer, outputOpcode, - outputMessage, outputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - // - // Make space for message in the outgoing buffer - // and write opcode and sequence number. - // - - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - - *outputMessage = outputOpcode; - - PutUINT(lastSequence_, outputMessage + 2, bigEndian_); - - #ifdef DEBUG - *logofs << "handleWrite: Going to handle event or error OPCODE#" - << (unsigned int) outputOpcode << " for FD#" << fd_ - << " sequence " << lastSequence_ << " (real was " - << serverSequence_ << ").\n" << logofs_flush; - #endif - - switch (outputOpcode) - { - case X_Error: - { - unsigned char code; - decodeBuffer.decodeCachedValue(code, 8, - serverCache_ -> errorCodeCache); - outputMessage[1] = code; - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: Handled error ERR_CODE#" - << (unsigned int) code << " for FD#" << fd_; - #endif - - if ((code != 11) && (code != 8) && - (code != 15) && (code != 1)) - { - decodeBuffer.decodeValue(value, 32, 16); - PutULONG(value, outputMessage + 4, bigEndian_); - - #if defined(TEST) || defined(OPCODES) - *logofs << " RES_ID#" << value; - #endif - } - - if (code >= 18) - { - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> errorMinorCache); - PutUINT(value, outputMessage + 8, bigEndian_); - - #if defined(TEST) || defined(OPCODES) - *logofs << " MIN_OP#" << value; - #endif - } - - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> errorMajorCache); - outputMessage[10] = cValue; - - #if defined(TEST) || defined(OPCODES) - *logofs << " MAJ_OP#" << (unsigned int) cValue; - #endif - - if (code >= 18) - { - unsigned char *nextDest = outputMessage + 11; - for (unsigned int i = 11; i < 32; i++) - { - decodeBuffer.decodeValue(value, 8); - *nextDest++ = (unsigned char) cValue; - } - } - - #if defined(TEST) || defined(OPCODES) - *logofs << " sequence " << lastSequence_ << " (real was " - << serverSequence_ << ") . Size is " - << (unsigned int) outputLength << ".\n" - << logofs_flush; - #endif - } - break; - case ButtonPress: - case ButtonRelease: - case KeyPress: - case KeyRelease: - case MotionNotify: - case EnterNotify: - case LeaveNotify: - { - if (outputOpcode == MotionNotify) - { - decodeBuffer.decodeBoolValue(value); - } - else if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) - { - decodeBuffer.decodeValue(value, 3); - } - else if (outputOpcode == KeyRelease) - { - decodeBuffer.decodeBoolValue(value); - if (value) - { - value = serverCache_ -> keyPressLastKey; - } - else - { - decodeBuffer.decodeValue(value, 8); - } - } - else if (outputOpcode == ButtonPress || outputOpcode == ButtonRelease) - { - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> buttonCache); - value = (unsigned int) cValue; - } - else - { - decodeBuffer.decodeValue(value, 8); - } - - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 32, - serverCache_ -> motionNotifyTimestampCache, 9); - serverCache_ -> lastTimestamp += value; - PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, - bigEndian_); - unsigned char *nextDest = outputMessage + 8; - int skipRest = 0; - if (outputOpcode == KeyRelease) - { - decodeBuffer.decodeBoolValue(value); - if (value) - { - for (unsigned int i = 0; i < 23; i++) - { - *nextDest++ = serverCache_ -> keyPressCache[i]; - } - skipRest = 1; - } - } - - if (!skipRest) - { - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeCachedValue(value, 29, - *serverCache_ -> motionNotifyWindowCache[i], 6); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyRootXCache, 6); - serverCache_ -> motionNotifyLastRootX += value; - PutUINT(serverCache_ -> motionNotifyLastRootX, outputMessage + 20, - bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyRootYCache, 6); - serverCache_ -> motionNotifyLastRootY += value; - PutUINT(serverCache_ -> motionNotifyLastRootY, outputMessage + 22, - bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyEventXCache, 6); - PutUINT(serverCache_ -> motionNotifyLastRootX + value, - outputMessage + 24, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyEventYCache, 6); - PutUINT(serverCache_ -> motionNotifyLastRootY + value, - outputMessage + 26, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> motionNotifyStateCache); - PutUINT(value, outputMessage + 28, bigEndian_); - if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) - { - decodeBuffer.decodeValue(value, 2); - } - else - { - decodeBuffer.decodeBoolValue(value); - } - outputMessage[30] = (unsigned char) value; - if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) - { - decodeBuffer.decodeValue(value, 2); - outputMessage[31] = (unsigned char) value; - } - else if (outputOpcode == KeyPress) - { - serverCache_ -> keyPressLastKey = outputMessage[1]; - for (unsigned int i = 8; i < 31; i++) - { - serverCache_ -> keyPressCache[i - 8] = outputMessage[i]; - } - } - } - } - break; - case ColormapNotify: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> colormapNotifyWindowCache, 8); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> colormapNotifyColormapCache, 8); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[12] = (unsigned char) value; - decodeBuffer.decodeBoolValue(value); - outputMessage[13] = (unsigned char) value; - } - break; - case ConfigureNotify: - { - unsigned char *nextDest = outputMessage + 4; - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeCachedValue(value, 29, - *serverCache_ -> configureNotifyWindowCache[i], 9); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - for (unsigned int j = 0; j < 5; j++) - { - decodeBuffer.decodeCachedValue(value, 16, - *serverCache_ -> configureNotifyGeomCache[j], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - decodeBuffer.decodeBoolValue(value); - *nextDest = value; - } - break; - case CreateNotify: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> createNotifyWindowCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 29, 5); - serverCache_ -> createNotifyLastWindow += value; - serverCache_ -> createNotifyLastWindow &= 0x1fffffff; - PutULONG(serverCache_ -> createNotifyLastWindow, outputMessage + 8, - bigEndian_); - unsigned char* nextDest = outputMessage + 12; - for (unsigned int i = 0; i < 5; i++) - { - decodeBuffer.decodeValue(value, 16, 9); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - decodeBuffer.decodeBoolValue(value); - *nextDest = (unsigned char) value; - } - break; - case Expose: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> exposeWindowCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 8; - for (unsigned int i = 0; i < 5; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *serverCache_ -> exposeGeomCache[i], 6); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - } - break; - case FocusIn: - case FocusOut: - { - decodeBuffer.decodeValue(value, 3); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> focusInWindowCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 2); - outputMessage[8] = (unsigned char) value; - } - break; - case KeymapNotify: - { - decodeBuffer.decodeBoolValue(value); - if (value) - memcpy(outputMessage + 1, ServerCache::lastKeymap.getData(), 31); - else - { - unsigned char *nextDest = outputMessage + 1; - for (unsigned int i = 1; i < 32; i++) - { - decodeBuffer.decodeValue(value, 8); - *nextDest++ = (unsigned char) value; - } - ServerCache::lastKeymap.set(31, outputMessage + 1); - } - } - break; - case MapNotify: - case UnmapNotify: - case DestroyNotify: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> mapNotifyEventCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> mapNotifyWindowCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - if (outputOpcode == MapNotify || outputOpcode == UnmapNotify) - { - decodeBuffer.decodeBoolValue(value); - outputMessage[12] = (unsigned char) value; - } - } - break; - case NoExpose: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> noExposeDrawableCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - serverCache_ -> noExposeMinorCache); - PutUINT(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(cValue, 8, - serverCache_ -> noExposeMajorCache); - outputMessage[10] = cValue; - } - break; - case PropertyNotify: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> propertyNotifyWindowCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> propertyNotifyAtomCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 32, 9); - serverCache_ -> lastTimestamp += value; - PutULONG(serverCache_ -> lastTimestamp, outputMessage + 12, - bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[16] = (unsigned char) value; - } - break; - case ReparentNotify: - { - unsigned char* nextDest = outputMessage + 4; - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> reparentNotifyWindowCache, 9); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - decodeBuffer.decodeValue(value, 16, 6); - PutUINT(value, nextDest, bigEndian_); - decodeBuffer.decodeValue(value, 16, 6); - PutUINT(value, nextDest + 2, bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[20] = (unsigned char)value; - } - break; - case SelectionClear: - { - decodeBuffer.decodeValue(value, 32, 9); - serverCache_ -> lastTimestamp += value; - PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, - bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearWindowCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearAtomCache, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - } - break; - case SelectionRequest: - { - decodeBuffer.decodeValue(value, 32, 9); - serverCache_ -> lastTimestamp += value; - PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, - bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearWindowCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearWindowCache, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearAtomCache, 9); - PutULONG(value, outputMessage + 16, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearAtomCache, 9); - PutULONG(value, outputMessage + 20, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> selectionClearAtomCache, 9); - PutULONG(value, outputMessage + 24, bigEndian_); - } - break; - case VisibilityNotify: - { - decodeBuffer.decodeCachedValue(value, 29, - serverCache_ -> visibilityNotifyWindowCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 2); - outputMessage[8] = (unsigned char) value; - } - break; - default: - { - #ifdef TEST - *logofs << "handleWrite: Using generic event compression " - << "for OPCODE#" << (unsigned int) outputOpcode - << ".\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(*(outputMessage + 1), 8, - serverCache_ -> genericEventCharCache); - - for (unsigned int i = 0; i < 14; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *serverCache_ -> genericEventIntCache[i]); - - PutUINT(value, outputMessage + i * 2 + 4, bigEndian_); - } - } - } // End of switch (outputOpcode)... - - #if defined(TEST) || defined(OPCODES) - if (outputOpcode != X_Error) - { - *logofs << "handleWrite: Handled event OPCODE#" - << (unsigned int) outputOpcode << " for FD#" - << fd_ << " sequence " << lastSequence_ << " (real was " - << serverSequence_ << "). Size is " << outputLength - << ".\n" << logofs_flush; - } - #endif - - // - // Check if we need to suppress the error. - // - - if (outputOpcode == X_Error && - handleTaintSyncError(*(outputMessage + 10)) > 0) - { - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: WARNING! Suppressed error OPCODE#" - << (unsigned int) outputOpcode << " for FD#" - << fd_ << " sequence " << lastSequence_ << ".\n" - << logofs_flush; - #endif - - writeBuffer_.removeMessage(32); - } - - } // End of if (outputOpcode == 1)... else ... - - // - // Check if we produced enough data. We need to - // decode all provided messages. Just update the - // finish flag in case of failure. - // - - handleFlush(flush_if_needed); - - } // End of while (decodeBuffer.decodeOpcodeValue(outputOpcode, 8, ... - - } // End of the decoding block. - - // - // Write any remaining data to the X connection. - // - - if (handleFlush(flush_if_any) < 0) - { - return -1; - } - - return 1; -} - -// -// End of handleWrite(). -// - -// -// Other members. -// - -int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, - T_store_action action, int position, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #if defined(TEST) || defined(SPLIT) - - // Since ProtoStep8 (#issue 108) - *logofs << "handleSplit: PANIC! SPLIT! Split should " - << "not be enabled for message " << "OPCODE#" - << (unsigned int) store -> opcode() << ".\n" - << logofs_flush; - - HandleCleanup(); - - #endif - - // - // Refuse the split if it is not introduced - // by a start split. - // - - // Since ProtoStep7 (#issue 108) - if (splitState_.resource == nothing || enableSplit_ == 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Nothing to do for message " - << "OPCODE#" << (unsigned int) store -> opcode() - << " of size " << size << " position " << position - << " with action [" << DumpAction(action) << "] at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeBoolValue(0); - - return 0; - } - - // - // It's not advisable to allocate the store at - // the time we receive the start-split because - // we may process all the splits received and - // deallocate the store even before we receive - // the end split. Another message for the same - // split sequence may then come and we would - // have a null split store. - // - - handleSplitStoreAlloc(&splitResources_, splitState_.resource); - - // - // Check if the split was actually requested by - // the agent and if the request was saved in the - // message store. The split can also be refused - // if the message is smaller than the threshold - // or if the split store is already full. - // - - if (mustSplitMessage(splitState_.resource) == 0) - { - if (action == IS_HIT || canSplitMessage(splitState_.mode, size) == 0) - { - #if defined(TEST) || defined(SPLIT) - - if (splitState_.mode == split_none) - { - #ifdef PANIC - *logofs << "handleSplit: PANIC! SPLIT! Split state has " - << "mode 'none'.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - if (action != IS_HIT && (int) size >= - control -> SplitDataThreshold) - { - #ifdef WARNING - *logofs << "handleSplit: WARNING! SPLIT! Split stores have " - << clientStore_ -> getSplitTotalSize() << " messages " - << "and " << clientStore_ -> getSplitTotalStorageSize() - << " allocated bytes.\n" << logofs_flush; - #endif - } - - #endif - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Message OPCODE#" - << (unsigned int) store -> opcode() << " of size " << size - << " [not split] with resource " << splitState_.resource - << " mode " << splitState_.mode << " position " << position - << " and action [" << DumpAction(action) << "] at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeBoolValue(0); - - return 0; - } - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Message OPCODE#" - << (unsigned int) store -> opcode() << " of size " << size - << " [split] with resource " << splitState_.resource - << " mode " << splitState_.mode << " position " << position - << " and action [" << DumpAction(action) << "] at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeBoolValue(1); - - T_checksum checksum = NULL; - - if (action == IS_ADDED) - { - checksum = store -> getChecksum(position); - } - else if (action == is_discarded) - { - // - // Generate the checksum on the fly. - // - - checksum = store -> getChecksum(buffer, size, bigEndian_); - } - - // - // The method must abort the connection - // if it can't allocate the split. - // - - Split *splitMessage = clientStore_ -> getSplitStore(splitState_.resource) -> - add(store, splitState_.resource, splitState_.mode, - position, action, checksum, buffer, size); - - // - // Send the checksum. By using the checksum, - // the remote end will try to locate the - // message and load it from disk. - // - - if (action == IS_HIT) - { - splitMessage -> setState(split_loaded); - } - else if (handleSplitChecksum(encodeBuffer, checksum) == 0) - { - // - // If the checksum is not sent, for example - // because loading of messages from disk is - // disabled, then mark the split as missed. - // - - #ifdef WARNING - *logofs << "handleSplit: WARNING! Checksum not sent. " - << "Marking the split as [missed].\n" - << logofs_flush; - #endif - - splitMessage -> setState(split_missed); - } - - if (action == is_discarded) - { - delete [] checksum; - } - - // - // Check if we are ready to send a new split - // for this store. - // - - handleSplitPending(splitState_.resource); - - #if defined(TEST) || defined(SPLIT) - - *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> - getSplitTotalSize() << " messages and " << clientStore_ -> - getSplitTotalStorageSize() << " bytes to send in " - << "the split stores.\n" << logofs_flush; - - clientStore_ -> dumpSplitStore(splitState_.resource); - - #endif - - return 1; -} - -int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer) -{ - // - // Determine the maximum amount of bytes - // we can write in this iteration. - // - - int total = control -> SplitDataPacketLimit; - - int bytes = total; - int splits = 0; - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Handling splits " - << "for FD#" << fd_ << " with " << clientStore_ -> - getSplitTotalSize() << " elements and " << total - << " bytes to write at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Looping to find " - << "if there is any split to send.\n" - << logofs_flush; - #endif - - SplitStore *splitStore; - - Split *splitMessage; - - // - // Divide the available bandwidth among all the active - // split stores by implementing a simple round-robin - // mechanism. This can be extended by using an external - // function returning the number of bytes to be written - // based on the state of the split (splits which didn't - // receive yet a confirmation event could be delayed), - // the current bitrate, and by letting the agent asso- - // ciate a priority to the resource in the start split - // operation. - // - - splitState_.pending = 0; - - splitResources_.rotate(); - - // - // Copy the list since elements can be removed - // in the middle of the loop. - // - - T_list splitList = splitResources_.copyList(); - - for (T_list::iterator j = splitList.begin(); - j != splitList.end(); j++) - { - int resource = *j; - - #ifdef DEBUG - *logofs << "handleSplit: SPLIT! Looping with current " - << "resource " << resource << ".\n" - << logofs_flush; - #endif - - splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore != NULL) - { - // - // Don't send more than the the packet size - // bytes but ensure that we abort any split - // found in the disk cache. - // - - for (;;) - { - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpSplitStore(resource); - - #endif - - splitMessage = splitStore -> getFirstSplit(); - - if (splitMessage == NULL) - { - // - // We have created the store after a start - // split but no message was added yet. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: WARNING! SPLIT! The split store " - << "is still empty.\n" << logofs_flush; - #endif - - break; - } - - // - // Splits already aborted can't be in the - // split store. - // - - #if defined(TEST) || defined(SPLIT) - - if (splitMessage -> getState() == split_aborted) - { - *logofs << "handleSplit: PANIC! SPLIT! Found an " - << "aborted split in store [" << resource - << "].\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Check if there are more messages in the - // store that can be aborted or if we have - // exceeded the number of bytes we can send - // for this iteration. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Checking closure " - << "of the inner loop with " << bytes - << " bytes to write and split state [" - << DumpState(splitMessage -> getState()) - << "].\n" << logofs_flush; - #endif - - if ((splitMessage -> getMode() == split_sync && - splitMessage -> getState() == split_added) || - (bytes <= 0 && splitMessage -> - getState() != split_loaded)) - { - break; - } - - // - // If the split was loaded at the remote - // side abort it immediately. - // - - if (splitMessage -> getState() == split_loaded) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Sending more data " - << "for store [" << resource << "] with " - << "a split to be aborted.\n" - << logofs_flush; - #endif - - if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) - { - return -1; - } - } - else if (bytes > 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Sending more data " - << "for store [" << resource << "] with " - << bytes << " bytes to send.\n" - << logofs_flush; - #endif - - if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) - { - return -1; - } - } - - // - // Check if the split store was deleted. - // - - splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore == NULL) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Exiting from the " - << "inner loop with split store [" << resource - << "] destroyed.\n" << logofs_flush; - #endif - - break; - } - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Completed handling splits " - << "for store [" << resource << "] with " << bytes - << " bytes still to send.\n" << logofs_flush; - #endif - - // - // Check if there is still a split to - // send for the store just processed. - // - - handleSplitPending(resource); - } - } - - #if defined(TEST) || defined(SPLIT) - - if (splits == 0) - { - #ifdef PANIC - *logofs << "handleSplit: PANIC! Function called but " - << "no split message was sent.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - - *logofs << "handleSplit: SPLIT! Sent " << splits - << " splits and " << total - bytes << " bytes for FD#" << fd_ - << " with " << clientStore_ -> getSplitTotalStorageSize() - << " bytes and [" << clientStore_ -> getSplitTotalSize() - << "] splits remaining.\n" << logofs_flush; - - *logofs << "handleSplit: SPLIT! The pending split flag is " - << splitState_.pending << " with " << clientStore_ -> - getSplitTotalSize() << " splits in the split stores.\n" - << logofs_flush; - - clientStore_ -> dumpSplitStores(); - - #endif - - return 1; -} - -int ClientChannel::handleSplitSend(EncodeBuffer &encodeBuffer, int resource, - int &splits, int &bytes) -{ - #if defined(TEST) || defined(SPLIT) - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - Split *splitMessage = splitStore -> getFirstSplit(); - - if (splitStore -> getResource() != resource || - splitMessage -> getResource() != resource) - { - #ifdef PANIC - *logofs << "handleSplitSend: PANIC! The resource doesn't " - << "match the split store.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - *logofs << "handleSplitSend: SPLIT! Sending message " - << "OPCODE#" << (unsigned) opcodeStore_ -> splitData - << " for resource " << splitMessage -> getResource() - << " with request " << splitMessage -> getRequest() - << " position " << splitMessage -> getPosition() - << " and " << bytes << " bytes to write.\n" - << logofs_flush; - #endif - - // - // Use a special opcode to signal the other - // side this is part of a split and not a - // new message. - // - - encodeBuffer.encodeOpcodeValue(opcodeStore_ -> splitData, - clientCache_ -> opcodeCache); - - encodeBuffer.encodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - int result = clientStore_ -> getSplitStore(resource) -> - send(encodeBuffer, bytes); - - if (result < 0) - { - #ifdef PANIC - *logofs << "handleSplit: PANIC! Error sending splits for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Error sending splits for FD#" - << fd_ << ".\n"; - - return -1; - } - - // - // Get the bits written and update the - // statistics for this special opcode. - // - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(SPLIT)|| defined(OPCODES) - *logofs << "handleSplitSend: SPLIT! Handled request OPCODE#" - << (unsigned int) opcodeStore_ -> splitData << " (" - << DumpOpcode(opcodeStore_ -> splitData) << ")" << " for FD#" - << fd_ << " sequence none. 0 bytes in, " << bits << " bits (" - << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; - #endif - - statistics -> addRequestBits(opcodeStore_ -> splitData, 0, bits); - - bytes -= bits >> 3; - - splits++; - - if (result == 1) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitSend: SPLIT! Split at the head " - << "of the list was completely transferred.\n" - << logofs_flush; - #endif - - // - // The split at the head of the list was - // completely transferred. - // - - handleRestart(sequence_deferred, resource); - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleSplitSend: SPLIT! More data to send " - << "for the split at the head of the list.\n" - << logofs_flush; - } - #endif - - return result; -} - -int ClientChannel::handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum) -{ - // - // Send the checksum only if the loading - // or the saving of the message to the - // persistent image cache is enabled. - // - - if ((control -> ImageCacheEnableLoad == 1 || - control -> ImageCacheEnableSave == 1) && - (enableLoad_ == 1 || enableSave_ == 1)) - { - encodeBuffer.encodeBoolValue(1); - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - encodeBuffer.encodeValue((unsigned int) checksum[i], 8); - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitChecksum: SPLIT! Sent checksum " - << "[" << DumpChecksum(checksum) << "].\n" - << logofs_flush; - #endif - - return 1; - } - else - { - encodeBuffer.encodeBoolValue(0); - - return 0; - } -} - -void ClientChannel::handleSplitPending() -{ - #if defined(TEST) || defined(SPLIT) - - int previous = splitState_.pending; - - #endif - - if (clientStore_ -> getSplitTotalSize() == 0) - { - splitState_.pending = 0; - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitPending: SPLIT! Set the pending " - << "split flag to " << splitState_.pending - << " with split stores empty.\n" - << logofs_flush; - #endif - } - else - { - // - // Loop through the stores to find if - // there is any split that has become - // ready. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitPending: WARNING! SPLIT! Looping to " - << "find if there is any split pending.\n" - << logofs_flush; - #endif - - splitState_.pending = 0; - - T_list &splitList = splitResources_.getList(); - - for (T_list::iterator j = splitList.begin(); - j != splitList.end(); j++) - { - int resource = *j; - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore != NULL) - { - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpSplitStore(resource); - - #endif - - Split *splitMessage = splitStore -> getFirstSplit(); - - if (splitMessage != NULL && canSendSplit(splitMessage) == 1) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitPending: SPLIT! Found a pending " - << "split in store [" << resource << "].\n" - << logofs_flush; - #endif - - splitState_.pending = 1; - - #if defined(TEST) || defined(SPLIT) - - if (splitMessage -> getState() == split_loaded) - { - *logofs << "handleSplitPending: PANIC! SPLIT! Found a " - << "loaded split in store [" << resource - << "].\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - break; - } - } - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitPending: SPLIT! Set the pending " - << "split flag to " << splitState_.pending - << " with " << clientStore_ -> getSplitTotalSize() - << " splits in the split stores.\n" - << logofs_flush; - #endif - } - - #if defined(TEST) || defined(SPLIT) - - if (splitState_.pending != previous) - { - *logofs << "handleSplitPending: SPLIT! Pending state " - << "changed from " << previous << " to " - << splitState_.pending << ".\n" - << logofs_flush; - } - - #endif -} - -int ClientChannel::handleSplitEvent(EncodeBuffer &encodeBuffer, Split *splitMessage) -{ - SplitStore *splitStore; - - int resource = splitMessage -> getResource(); - - #if defined(TEST) || defined(INFO) - - splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore == NULL) - { - #ifdef PANIC - *logofs << "handleSplitEvent: PANIC! The split store can't " - << "be NULL handling abort splits.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - else if (splitMessage -> getState() != split_loaded) - { - *logofs << "handleSplitEvent: PANIC! Can't find the split " - << "to be aborted.\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Send any split that it is possible to - // abort until the store is either empty - // or the next split can't be aborted. - // - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - while ((splitStore = clientStore_ -> - getSplitStore(resource)) != NULL && - (splitMessage = splitStore -> getFirstSplit()) != NULL && - splitMessage -> getState() == split_loaded) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Aborting split with " - << "checksum [" << DumpChecksum(splitMessage -> - getChecksum()) << "] for resource " << resource - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - int any = 0; - - if (handleSplitSend(encodeBuffer, resource, any, any) < 0) - { - return -1; - } - } - - #if defined(TEST) || defined(SPLIT) - - if ((splitStore = clientStore_ -> - getSplitStore(resource)) == NULL) - { - *logofs << "handleSplitEvent: SPLIT! The split store [" - << resource << "] has been destroyed.\n" - << logofs_flush; - } - else if ((splitMessage = splitStore -> - getFirstSplit()) == NULL) - { - *logofs << "handleSplitEvent: SPLIT! The split store [" - << resource << "] is empty.\n" - << logofs_flush; - } - else if (splitMessage -> getState() != split_loaded) - { - *logofs << "handleSplitEvent: SPLIT! The split at the " - << "head of store [" << resource << "] doesn't " - << "need to be aborted.\n" << logofs_flush; - } - - #endif - - return 1; -} - -int ClientChannel::handleSplitEvent(DecodeBuffer &decodeBuffer) -{ - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Handling abort " - << "split messages for FD#" << fd_ << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - // Since ProtoStep7 (#issue 108) - - // - // Decode the information about the - // message to be updated. - // - - unsigned char resource; - - decodeBuffer.decodeCachedValue(resource, 8, - serverCache_ -> resourceCache); - - unsigned int loaded; - - decodeBuffer.decodeBoolValue(loaded); - - unsigned char request; - unsigned int size; - - if (loaded == 1) - { - decodeBuffer.decodeOpcodeValue(request, serverCache_ -> abortOpcodeCache); - - decodeBuffer.decodeValue(size, 32, 14); - } - else - { - request = 0; - size = 0; - } - - unsigned int value; - - md5_byte_t checksum[MD5_LENGTH]; - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - decodeBuffer.decodeValue(value, 8); - - checksum[i] = (unsigned char) value; - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Checking split " - << "with checksum [" << DumpChecksum(checksum) - << "] loaded " << loaded << " request " << (unsigned int) - request << " compressed size " << size << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - Split *splitMessage = handleSplitFind(checksum, resource); - - if (splitMessage != NULL) - { - if (loaded == 1) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Marked split with " - << "checksum [" << DumpChecksum(checksum) << "] " - << "as [loaded] at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - splitMessage -> setState(split_loaded); - - #if defined(TEST) || defined(SPLIT) - - if (splitMessage -> compressedSize() != (int) size) - { - *logofs << "handleSplitEvent: WARNING! SPLIT! Updating " - << "compressed data size from " << splitMessage -> - compressedSize() << " to " << size << ".\n" - << logofs_flush; - } - - #endif - - splitMessage -> compressedSize(size); - - // - // The splits to be aborted are checked by the split - // store at the time we are going to send a new chunk - // of split data. The splits must be strictly handled - // in the same order as they were added to the split - // store and the split we want to abort here may be - // not at the head of the list. - // - - if (splitMessage == clientStore_ -> - getSplitStore(resource) -> getFirstSplit()) - { - // - // We don't need to flush this packet immediately. - // The abort can be sent at any time to the remote - // proxy. What's important is that we restart the - // agent resource as soon as possible. - // - - #if defined(TEST) || defined(SPLIT) - - T_timestamp startTs = getTimestamp(); - - *logofs << "handleSplitEvent: SPLIT! Encoding abort " - << "split events for FD#" << fd_ << " with " - << "resource " << (unsigned) resource << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) - { - return -1; - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Spent " - << diffTimestamp(startTs, getTimestamp()) << " Ms " - << "handling abort split events for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - // - // Check if we can clear the pending flag. - // - - handleSplitPending(); - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleSplitEvent: WARNING! SPLIT! Abort split " - << "event not sent because not at the head " - << "of the list.\n" << logofs_flush; - } - #endif - } - else - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Marked split with " - << "checksum [" << DumpChecksum(checksum) << "] " - << "as [missed] at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - splitMessage -> setState(split_missed); - - // - // Check if we can set the pending flag. - // - - handleSplitPending(resource); - } - } - else - { - // - // The split report came after the split was already - // sent or the split store deleted. If the message - // had been loaded from disk by the remote side, we - // need to update the compressed size in our message - // store or the checksum will not match at the time - // we will try to save the message store on disk. - // - - if (loaded == 1 && size != 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: WARNING! SPLIT! Can't find " - << "the split. Updating in the message store.\n" - << logofs_flush; - #endif - - MessageStore *store = clientStore_ -> getRequestStore(request); - - if (store != NULL) - { - store -> updateData(checksum, size); - } - #if defined(TEST) || defined(SPLIT) - else - { - #ifdef PANIC - *logofs << "handleSplitEvent: PANIC! The message store " - << "can't be null.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - #endif - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleSplitEvent: WARNING! SPLIT! No need to " - << "update the store with loaded " << loaded - << " and compressed size " << size << ".\n" - << logofs_flush; - } - #endif - } - - return 1; -} - -Split *ClientChannel::handleSplitFind(T_checksum checksum, int resource) -{ - // - // It can be that we handled all the splits, - // restarted the resource and deleted the - // store before the event could even reach - // our side. - // - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore != NULL) - { - Split *splitMessage; - - T_splits *splitList = splitStore -> getSplits(); - - for (T_splits::iterator i = splitList -> begin(); - i != splitList -> end(); i++) - { - splitMessage = (*i); - - if (splitMessage -> getChecksum() != NULL) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitFind: SPLIT! Comparing with message [" - << DumpChecksum(splitMessage -> getChecksum()) - << "].\n" << logofs_flush; - #endif - - if (memcmp(checksum, splitMessage -> getChecksum(), MD5_LENGTH) == 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitFind: SPLIT! Located split for " - << "checksum [" << DumpChecksum(checksum) << "] " - << "in store [" << splitStore -> getResource() - << "].\n" << logofs_flush; - #endif - - return splitMessage; - } - } - } - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleSplitFind: WARNING! SPLIT! The split store " - << "was already deleted.\n" << logofs_flush; - } - #endif - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitFind: WARNING! SPLIT! Can't find the " - << "split for checksum [" << DumpChecksum(checksum) - << "].\n" << logofs_flush; - #endif - - return NULL; -} - -int ClientChannel::handleRestart(T_sequence_mode mode, int resource) -{ - // - // The agent must send a start-split message, followed by the - // X messages that may be optionally split by the proxy. Usu- - // ally, in the middle of a start-split/end-split sequence is - // a single PutImage() or PutPackedImage(), that, in turn, - // can generate multiple partial requests, like a SetUnpack- - // Colormap() and SetUnpackAlpha() followed by the image that - // must be transferred. Multiple requests may be also genera- - // ted because the maximum size of a X request has been exce- - // eded, so that Xlib has divided the single image in multi- - // ple sub-image requests. The agent doesn't need to take care - // of that, except tracking the result of the split operation. - // - // By monitoring the notify events sent by the proxy, the - // agent will have to implement its own strategy to deal with - // its resources (for example its clients). For example: - // - // - It will issue a new image request and suspend a client - // if the image was not entirely sent in the main X oputput - // stream. - // - // - It will choose to commit or discard the messages after - // they are recomposed at the remote side. The set of mes- - // sages that will have to be committed will include all - // messages that were part of the split (the colormap, the - // alpha channel). - // - // - It will restart its own client, in the case it had been - // suspended. - // - // A more useful strategy would be to replace the original im- - // age with a tiny 'placeholder' if a split took place, and - // synchronize the content of the drawable at later time. This - // is generally referred as 'lazy encoding'. - // - // The agent will be able to identify the original split ope- - // ration (the one marked with the start-spit) by the small - // integer number (0-255) referred to as the 'resource' field. - // - // Before the proxy will be able to report the status of the - // split, the agent will have to close the sequence by issueing - // an end-split. The proxy will then report the result of the - // operation, so that the agent will have the option of suspend- - // ing the client or marking the drawable as dirty and take - // care of synchronizing it at later time. - // - // One of the following cases may be encountered: - // - // notify_no_split: All messages were sent in the main out- - // put stream, so that no split actually - // took place. - // - // notify_start_split: One or more messages were split, so, - // at discrection of the agent, the client - // may be suspended until the transferral - // is completed. - // - // notify_commit_split: One of the requests that made up the - // split was recomposed. The agent should - // either commit the given request or tell - // the proxy to discard it. - // - // notify_end_split: The split was duly completed. The agent - // can restart the client. - // - // notify_empty_split: No more split operation are pending. - // The agent can use this information to - // implement specific strategies requiring - // that all messages have been recomposed - // at the remote end, like updating the - // drawables that were not synchronized - // because of the lazy encoding. - // - // By checking the split and commit store we can determine if we - // need to send a new notification event to the agent. There can - // be four different cases: - // - // - If the split store is not null and not empty, we are still - // in the middle of a split. - // - // - If the commit store is not empty, we completely recomposed - // a full message and can send a new commit notify. - // - // - If the split store has become empty, we recomposed all the - // messages added for the given resource, and so will be able - // to restart the resource. - // - // - If no more messages are in the split stores, we can notify - // an empty split event to the agent. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Handling [" - << (mode == sequence_immediate ? "immediate" : "deferred") - << "] restart events for resource " << resource << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (mode == sequence_immediate) - { - // - // We have received an end-split request. If the store - // was not deleted already, we mark the last split added - // as the one ending the row for this resource. If the - // commit() function returns 0 it means that the split - // store is either empty or that we did not add any split - // for this resource. This is because when connected to - // an old proxy version we only have a single store for - // all the resources. - // - // It can happen that all the split messages that were - // originally appended to the list were completely sent - // before our client had the chance of ending the split - // sequence. In this case the split store will be empty - // or already deleted and so we will be able to restart - // the resource. - // - - #if defined(TEST) || defined(SPLIT) - - if (splitStore == NULL) - { - *logofs << "handleRestart: WARNING! SPLIT! Split store [" - << resource << "] was already deleted.\n" - << logofs_flush; - } - else - { - clientStore_ -> dumpSplitStore(resource); - } - - #endif - - if (splitStore == NULL || splitStore -> getSize() == 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Immediate agent split event " - << "TYPE#" << (unsigned) opcodeStore_ -> noSplitNotify - << " [no split] with resource " << resource - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - if (handleNotify(notify_no_split, sequence_immediate, - resource, nothing, nothing) < 0) - { - return -1; - } - } - else - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Immediate agent split event " - << "TYPE#" << (unsigned) opcodeStore_ -> startSplitNotify - << " [start split] with resource " << resource - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - if (handleNotify(notify_start_split, sequence_immediate, - resource, nothing, nothing) < 0) - { - return -1; - } - } - } - else - { - // - // We have completely transferred a message - // that was put in the split store. - // - // The id of the resource can be different - // than the index of the store if we are - // connected to an old proxy. - // - - #if defined(TEST) || defined(SPLIT) - - if (splitStore == NULL) - { - #ifdef PANIC - *logofs << "handleRestart: PANIC! The split store can't " - << "be NULL handling deferred restart events.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - else - { - clientStore_ -> dumpSplitStore(resource); - } - - #endif - - CommitStore *commitStore = clientStore_ -> getCommitStore(); - - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpCommitStore(); - - #endif - - // - // Check if there is any commit to notify. - // - - Split *split; - - T_splits *commitList = commitStore -> getSplits(); - - for (T_splits::iterator i = commitList -> begin(); - i != commitList -> end(); i++) - { - split = *i; - - if (split -> getState() != split_notified) - { - #if defined(TEST) || defined(SPLIT) - - if (split -> getResource() != resource) - { - #ifdef PANIC - *logofs << "handleSplitSend: PANIC! The resource doesn't " - << "match the split store.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - #endif - - int request = split -> getRequest(); - int position = split -> getPosition(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Deferred agent split event " - << "TYPE#" << (unsigned) opcodeStore_ -> commitSplitNotify - << " [commit split] with resource " << resource << " request " - << request << " position " << position << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - if (handleNotify(notify_commit_split, sequence_deferred, - resource, request, position) < 0) - { - return -1; - } - - // - // Don't send the notification again. - // - - split -> setState(split_notified); - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleRestart: SPLIT! Split for request " - << split -> getRequest() << " and position " - << split -> getPosition() << " was already " - << "notified.\n" << logofs_flush; - } - #endif - } - - // - // Don't send the end split if we are still - // in the middle of a start-split/end-split - // sequence. We'll send a no-split at the - // time the end-split is received. - // - - if (splitStore -> getSize() == 0 && - splitStore -> getResource() != splitState_.resource) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Deferred agent split event " - << "TYPE#" << (unsigned) opcodeStore_ -> endSplitNotify - << " [end split] with resource " << resource << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - if (handleNotify(notify_end_split, sequence_deferred, - resource, nothing, nothing) < 0) - { - return -1; - } - } - #if defined(TEST) || defined(SPLIT) - else if (splitStore -> getSize() == 0 && - splitStore -> getResource() == splitState_.resource) - { - *logofs << "handleRestart: SPLIT! WARNING! The split store " - << "for resource " << resource << " was emptied in the " - << "split sequence at " << strMsTimestamp() << ".\n" - << logofs_flush; - } - #endif - } - - // - // Remove the split store if it's empty. - // - - if (splitStore != NULL && splitStore -> getSize() == 0 && - splitStore -> getResource() != splitState_.resource) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Removing the split store [" - << resource << "] at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - handleSplitStoreRemove(&splitResources_, resource); - - if (clientStore_ -> getSplitTotalSize() == 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! Deferred agent split event " - << "TYPE#" << (unsigned) opcodeStore_ -> emptySplitNotify - << " [empty split] for FD#" << fd_ << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - if (handleNotify(notify_empty_split, sequence_deferred, - nothing, nothing, nothing) < 0) - { - return -1; - } - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleRestart: SPLIT! There are " << clientStore_ -> - getSplitTotalSize() << " messages and " << clientStore_ -> - getSplitTotalStorageSize() << " bytes to send in " - << "the split stores.\n" << logofs_flush; - - if ((clientStore_ -> getSplitTotalSize() != 0 && - clientStore_ -> getSplitTotalStorageSize() == 0) || - (clientStore_ -> getSplitTotalSize() == 0 && - clientStore_ -> getSplitTotalStorageSize() != 0)) - { - #ifdef PANIC - *logofs << "handleRestart: PANIC! Inconsistency detected " - << "while handling the split stores.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - - #endif - } - - return 1; -} - -int ClientChannel::handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer, - unsigned int &size) -{ - // - // Test the efficiency of the encoding - // without these RENDER requests. - // - - if (opcode == opcodeStore_ -> renderExtension && - (*(buffer + 1) == X_RenderCompositeGlyphs8 || - *(buffer + 1) == X_RenderCompositeGlyphs16 || - *(buffer + 1) == X_RenderCompositeGlyphs32 || - *(buffer + 1) == X_RenderAddGlyphs || - *(buffer + 1) == X_RenderTrapezoids)) - { - #ifdef TEST - *logofs << "handleTaintLameRequest: Tainting request " - << "OPCODE#" << (unsigned int) opcode << " MINOR#" - << (unsigned int) *(buffer + 1) << " for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - opcode = X_NoOperation; - - return 1; - } - - return 0; -} - -int ClientChannel::handleTaintSyncRequest(unsigned char &opcode, const unsigned char *&buffer, - unsigned int &size) -{ - // - // Should short-circuit other common replies - // whose values could be queried only once. - // Examples are X_InterAtom, X_ListExtension - // and X_QueryExtension. - // - - if (taintCounter_ >= control -> TaintThreshold) - { - #ifdef DEBUG - *logofs << "handleTaintSyncRequest: Reset taint counter after " - << taintCounter_ << " replies managed.\n" - << logofs_flush; - #endif - - taintCounter_ = 0; - - return 0; - } - - // - // Check if we are rolling the counter. - // The client sequence number has not - // been incremented yet in the loop. - // - - unsigned int sequence = (clientSequence_ + 1) & 0xffff; - - #ifdef DEBUG - *logofs << "handleTaintSyncRequest: Opcode is " << (unsigned) opcode - << " expected client sequence is " << sequence - << ".\n" << logofs_flush; - #endif - - if (sequence == 0xffff) - { - return 0; - } - - unsigned short t1; - unsigned char t2; - - // - // Check if there is a previous reply - // pending. - // - - if (sequenceQueue_.peek(t1, t2) != 0) - { - #ifdef DEBUG - *logofs << "handleTaintSyncRequest: Skipping taint of reply due to " - << "pending request OPCODE#" << t1 << " with sequence " - << (unsigned int) t2 << ".\n" << logofs_flush; - #endif - - return 0; - } - - #ifdef DEBUG - *logofs << "handleTaintSyncRequest: Suppressing get input focus " - << "request for FD#" << fd_ << " with sequence " - << sequence << ".\n" << logofs_flush; - #endif - - unsigned char *reply = writeBuffer_.addMessage(32); - - *(reply + 0) = X_Reply; - - PutUINT(sequence, reply + 2, bigEndian_); - - PutULONG(0, reply + 4, bigEndian_); - - // - // Set revert-to to none. - // - - *(reply + 1) = 0; - - // - // Set focus to none. - // - - PutULONG(0, reply + 8, bigEndian_); - - // - // Save the sequence number, not incremented - // yet, we used to auto-generate this reply. - // - - lastSequence_ = clientSequence_ + 1; - - #ifdef TEST - *logofs << "handleTaintSyncRequest: Registered " << lastSequence_ - << " as last auto-generated sequence number.\n" - << logofs_flush; - #endif - - // - // Taint the request to a X_NoOperation. - // - - opcode = X_NoOperation; - - // - // We may assume that the client has finished - // drawing and flush immediately, even if this - // seems to perceively affect the performance. - // - // priority_++; - // - - if (handleFlush(flush_if_any) < 0) - { - return -1; - } - - taintCounter_++; - - return 1; -} - -int ClientChannel::handleTaintSyncError(unsigned char opcode) -{ - if (control -> TaintReplies > 0) - { - // - // By enabling short-circuiting of replies - // some window managers can get confused - // by some otherwise innocuous X errors. - // - - if (opcode == X_GrabKey || opcode == X_ReparentWindow || - opcode == X_ConfigureWindow) - { - #if defined(TEST) || defined(OPCODES) - *logofs << "handleTaintSyncError: WARNING! Suppressed error " - << "on OPCODE#" << (unsigned int) opcode << " for FD#" - << fd_ << " sequence " << lastSequence_ << " (real was " - << serverSequence_ << ").\n" << logofs_flush; - #endif - - return 1; - } - } - - return 0; -} - -int ClientChannel::handleNotify(T_notification_type type, T_sequence_mode mode, - int resource, int request, int position) -{ - if (finish_ == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleNotify: Discarding notification on " - << "channel for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - // - // Add a new message to the write buffer. - // - - unsigned char *event = writeBuffer_.addMessage(32); - - // - // Event is ClientMessage, atom and - // window are 0, format is 32. - // - - *(event + 0) = ClientMessage; - - PutULONG(0, event + 4, bigEndian_); - PutULONG(0, event + 8, bigEndian_); - - *(event + 1) = 32; - - // - // If the event follows immediately the request (that is the - // sequence mode is 'immediate') then the sequence number is - // the one of the last request, else it should be the last - // sequence number encoded by peer proxy but, as we are ins- - // erting events in the stream, we must ensure that the se- - // quence we send is not less than the last sequence we have - // auto-generated. - // - - if (mode == sequence_immediate) - { - // - // Save the sequence number we used - // to auto-generate this event. - // - - lastSequence_ = clientSequence_; - - #if defined(TEST) || defined(INFO) - *logofs << "handleNotify: Registered " << lastSequence_ - << " as last auto-generated sequence number.\n" - << logofs_flush; - #endif - } - else - { - if (serverSequence_ > lastSequence_) - { - #ifdef DEBUG - *logofs << "handleNotify: Updating last event's sequence " - << lastSequence_ << " to X server's sequence number " - << serverSequence_ << " for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - lastSequence_ = serverSequence_; - } - #ifdef DEBUG - else if (serverSequence_ < lastSequence_) - { - // - // Use our last auto-generated sequence. - // - - *logofs << "handleNotify: Tainting sequence number " - << serverSequence_ << " to last event's sequence " - << lastSequence_ << " for FD#" << fd_ << ".\n" - << logofs_flush; - } - #endif - } - - PutUINT(lastSequence_, event + 2, bigEndian_); - - // - // Be sure we set to void the fields that - // are not significant for the specific - // notification message. - // - - PutULONG(nothing, event + 16, bigEndian_); - PutULONG(nothing, event + 20, bigEndian_); - PutULONG(nothing, event + 24, bigEndian_); - - switch (type) - { - case notify_no_split: - { - PutULONG(opcodeStore_ -> noSplitNotify, - event + 12, bigEndian_); - - PutULONG(resource, event + 16, bigEndian_); - - break; - } - case notify_start_split: - { - PutULONG(opcodeStore_ -> startSplitNotify, - event + 12, bigEndian_); - - PutULONG(resource, event + 16, bigEndian_); - - break; - } - case notify_commit_split: - { - PutULONG(opcodeStore_ -> commitSplitNotify, - event + 12, bigEndian_); - - PutULONG(resource, event + 16, bigEndian_); - - PutULONG(request, event + 20, bigEndian_); - - PutULONG(position, event + 24, bigEndian_); - - break; - } - case notify_end_split: - { - PutULONG(opcodeStore_ -> endSplitNotify, - event + 12, bigEndian_); - - PutULONG(resource, event + 16, bigEndian_); - - break; - } - case notify_empty_split: - { - PutULONG(opcodeStore_ -> emptySplitNotify, - event + 12, bigEndian_); - break; - } - default: - { - #ifdef PANIC - *logofs << "handleNotify: PANIC! Unrecognized notify " - << "TYPE#" << type << ".\n" - << logofs_flush; - #endif - - return -1; - } - } - - #if defined(TEST) || defined(INFO) || defined (SPLIT) - - *logofs << "handleNotify: Sending " - << (mode == sequence_immediate ? "immediate " : "deferred ") - << "agent notify event TYPE#" << GetULONG(event + 12, bigEndian_) - << logofs_flush; - - if (resource != nothing) - { - *logofs << " with resource " << GetULONG(event + 16, bigEndian_) - << logofs_flush; - - if (request != nothing && position != nothing) - { - *logofs << " request " << GetULONG(event + 20, bigEndian_) - << " position " << GetULONG(event + 24, bigEndian_) - << logofs_flush; - } - } - - *logofs << ".\n" << logofs_flush; - - #endif - - // - // Send the notification now. - // - - if (handleFlush(flush_if_any) < 0) - { - return -1; - } - - return 1; -} - -int ClientChannel::handleCommitSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - // - // Get the data of the request to be - // committed. - // - - unsigned char request = *(buffer + 5); - - MessageStore *store = clientStore_ -> getRequestStore(request); - - if (store == NULL) - { - #ifdef PANIC - *logofs << "handleCommitSplitRequest: PANIC! Can't commit split for " - << "request OPCODE#" << (unsigned int) request - << ". No message store found.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't commit split for request " - << "OPCODE#" << (unsigned int) request - << ". No message store found.\n"; - - return -1; - } - - // - // The position in cache of the message - // to commit. Encode it as difference in - // respect to the last encoded value. - // - - unsigned int position = GetULONG(buffer + 8, bigEndian_); - - unsigned char resource = *(buffer + 1); - unsigned int commit = *(buffer + 4); - - #if defined(TEST) || defined(SPLIT) - - if (commit == 1) - { - *logofs << "handleCommitSplitRequest: SPLIT! Committing request " - << "OPCODE#" << (unsigned) request << " at position " - << position << " for FD#" << fd_ << " with resource " - << (unsigned) resource << ".\n" << logofs_flush; - } - else - { - *logofs << "handleCommitSplitRequest: SPLIT! Discarding request " - << "OPCODE#" << (unsigned) request << " at position " - << position << " for FD#" << fd_ << " with resource " - << (unsigned) resource << ".\n" << logofs_flush; - } - - #endif - - encodeBuffer.encodeOpcodeValue(request, clientCache_ -> opcodeCache); - - int diffCommit = position - splitState_.commit; - - splitState_.commit = position; - - encodeBuffer.encodeValue(diffCommit, 32, 5); - - // - // Send the resource id and the commit - // flag. - // - - encodeBuffer.encodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - encodeBuffer.encodeBoolValue(commit); - - // - // Remove the split from the split queue. - // - - Split *split = handleSplitCommitRemove(request, resource, splitState_.commit); - - if (split == NULL) - { - return -1; - } - - clientStore_ -> getCommitStore() -> update(split); - - // - // Free the split. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleCommitSplitRequest: SPLIT! Freeing up the " - << "committed split.\n" << logofs_flush; - #endif - - delete split; - - return 1; -} - -int ClientChannel::handleAbortSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - unsigned char resource = *(buffer + 1); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Handling abort split " - << "request for FD#"<< fd_ << " and resource " - << (unsigned int) resource << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore == NULL) - { - #ifdef WARNING - *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The split " - << "store [" << (unsigned int) resource << "] " - << "is already empty.\n" << logofs_flush; - #endif - - return 0; - } - - // - // Loop through the messages in the split - // store and discard from the memory cache - // the messages that are still incomplete. - // Then remove the message from the split - // store. - // - - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpSplitStore(resource); - - #endif - - int splits = 0; - - Split *splitMessage; - - for (;;) - { - splitMessage = splitStore -> getFirstSplit(); - - if (splitMessage == NULL) - { - // - // Check if we had created the store - // but no message was added yet. - // - - #ifdef WARNING - - if (splits == 0) - { - *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " - << "split store [" << (unsigned int) resource - << "] is unexpectedly empty.\n" - << logofs_flush; - } - - #endif - - break; - } - - // - // Splits already aborted can't be in the - // split store. - // - - #if defined(TEST) || defined(SPLIT) - - if (splitMessage -> getState() == split_aborted) - { - *logofs << "handleAbortSplitRequest: PANIC! SPLIT! Found an " - << "aborted split in store [" << (unsigned int) resource - << "].\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - if (splitMessage -> getAction() == IS_HIT) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Removing the " - << "split from the memory cache.\n" - << logofs_flush; - #endif - - splitMessage -> getStore() -> remove(splitMessage -> getPosition(), - use_checksum, discard_data); - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Removing the " - << "split from the split store.\n" - << logofs_flush; - #endif - - splitMessage = splitStore -> pop(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Freeing up the " - << "aborted split.\n" << logofs_flush; - #endif - - delete splitMessage; - - splits++; - } - - // - // If the start-split/end-split sequence - // was closed, send the notification now, - // else wait for the end-split. - // - - if (resource != splitState_.resource) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Sending the " - << "deferred [end split] event.\n" - << logofs_flush; - #endif - - handleRestart(sequence_deferred, resource); - } - #if defined(TEST) || defined(SPLIT) - else - { - *logofs << "handleAbortSplitRequest: WARNING! SPLIT! Still " - << "waiting for the closure of the split " - << "sequence.\n" << logofs_flush; - } - #endif - - // - // Check if there is any other store - // having splits to send. - // - - handleSplitPending(); - - return (splits > 0); -} - -int ClientChannel::handleFinishSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - unsigned char resource = *(buffer + 1); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleFinishSplitRequest: SPLIT! Handling finish split " - << "request for FD#"<< fd_ << " and resource " - << (unsigned int) resource << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - // - // We need to get the protocol statistics - // for the finish message we are handling - // here because sending a new split will - // reset the bits counter. - // - - int bits = encodeBuffer.diffBits(); - - statistics -> addRequestBits(opcode, size << 3, bits); - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore == NULL) - { - #ifdef WARNING - *logofs << "handleFinishSplitRequest: WARNING! SPLIT! The split " - << "store [" << (unsigned int) resource << "] " - << "is already empty.\n" << logofs_flush; - #endif - - return 0; - } - - // - // Send all the split queued for the given - // resource until the split store becomes - // empty. - // - - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpSplitStore(resource); - - #endif - - Split *splitMessage; - - int total = MESSAGE_DATA_LIMIT; - - int bytes = total; - int splits = 0; - - for (;;) - { - splitMessage = splitStore -> getFirstSplit(); - - if (splitMessage == NULL) - { - // - // We have presumably created the store - // after a start split but no message - // was added yet. - // - - #ifdef WARNING - *logofs << "handleFinishSplitRequest: WARNING! SPLIT! The " - << "split store [" << (unsigned int) resource - << "] is unexpectedly empty.\n" - << logofs_flush; - #endif - - break; - } - - // - // Splits already aborted can't be in the - // split store. - // - - #if defined(TEST) || defined(SPLIT) - - if (splitMessage -> getState() == split_aborted) - { - *logofs << "handleFinishSplitRequest: PANIC! SPLIT! Found an " - << "aborted split in store [" << (unsigned int) resource - << "].\n" << logofs_flush; - - HandleCleanup(); - } - - *logofs << "handleFinishSplitRequest: SPLIT! Sending more " - << "data for store [" << (unsigned int) resource - << "].\n" << logofs_flush; - #endif - - if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) - { - return -1; - } - - // - // Check if the split store was deleted. - // - - if (clientStore_ -> getSplitStore(resource) == NULL) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleFinishSplitRequest: SPLIT! Exiting " - << "from the finish loop with split store [" - << (unsigned int) resource << "] destroyed.\n" - << logofs_flush; - #endif - - break; - } - } - - // - // Check if there is any other store - // having splits to send. - // - - handleSplitPending(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleFinishSplitRequest: SPLIT! Sent " << splits - << " splits and " << total - bytes << " bytes for FD#" << fd_ - << " with " << clientStore_ -> getSplitTotalStorageSize() - << " bytes and [" << clientStore_ -> getSplitTotalSize() - << "] splits remaining.\n" << logofs_flush; - #endif - - return (splits > 0); -} - -int ClientChannel::handleConfiguration() -{ - #ifdef TEST - *logofs << "ClientChannel: Setting new buffer parameters.\n" - << logofs_flush; - #endif - - readBuffer_.setSize(control -> ClientInitialReadSize, - control -> ClientMaximumBufferSize); - - writeBuffer_.setSize(control -> TransportXBufferSize, - control -> TransportXBufferThreshold, - control -> TransportMaximumBufferSize); - - transport_ -> setSize(control -> TransportXBufferSize, - control -> TransportXBufferThreshold, - control -> TransportMaximumBufferSize); - - return 1; -} - -int ClientChannel::handleFinish() -{ - #ifdef TEST - *logofs << "ClientChannel: Finishing channel for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - congestion_ = 0; - priority_ = 0; - - finish_ = 1; - - taintCounter_ = 0; - - splitState_.resource = nothing; - splitState_.pending = 0; - splitState_.commit = 0; - splitState_.mode = split_none; - - transport_ -> finish(); - - return 1; -} - -// -// If differential compression is disabled then use the -// most simple encoding but handle the image requests -// and the X_ListExtensions and X_QueryExtension messa- -// ges (needed to detect the opcode of the shape or the -// other extensions) in the usual way. -// - -int ClientChannel::handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsigned char &opcode, - const unsigned char *&buffer, const unsigned int &size) -{ - // - // All the NX requests are handled in the - // main message loop. The X_PutImage can - // be handled here only if the split was - // not requested (since ProtoStep7 #issue 108). - // - - if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || - (opcode == X_PutImage && splitState_.resource != nothing) || - opcode == X_ListExtensions || - opcode == X_QueryExtension) - { - return 0; - } - - #ifdef DEBUG - *logofs << "handleFastReadRequest: Encoding raw request OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << " with size " << size << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeMemory(buffer, size); - - // - // Put request on the fast track - // if it needs a reply. - // - - switch (opcode) - { - case X_GetAtomName: - case X_GetGeometry: - case X_GetInputFocus: - case X_GetModifierMapping: - case X_GetKeyboardMapping: - case X_GetProperty: - case X_GetSelectionOwner: - case X_GrabPointer: - case X_GrabKeyboard: - case X_ListExtensions: - case X_ListFonts: - case X_LookupColor: - case X_AllocNamedColor: - case X_QueryPointer: - case X_GetWindowAttributes: - case X_QueryTree: - case X_QueryBestSize: - case X_QueryColors: - case X_QueryFont: - case X_TranslateCoords: - case X_GetImage: - case X_GetPointerMapping: - case X_GetKeyboardControl: - case X_InternAtom: - case X_AllocColor: - { - sequenceQueue_.push(clientSequence_, opcode); - - priority_++; - - break; - } - default: - { - break; - } - } - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - - *logofs << "handleFastReadRequest: Handled raw request OPCODE#" - << (unsigned int) opcode << " (" << DumpOpcode(opcode) << ")" - << " for FD#" << fd_ << " sequence " << clientSequence_ - << ". " << size << " bytes in, " << bits << " bits (" - << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; - - #endif - - statistics -> addRequestBits(opcode, size << 3, bits); - - if (opcode == opcodeStore_ -> renderExtension) - { - statistics -> addRenderRequestBits(*(buffer + 1), size << 3, bits); - } - - return 1; -} - -int ClientChannel::handleFastWriteReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - if ((opcode >= X_NXFirstOpcode && - opcode <= X_NXLastOpcode) || - opcode == X_ListExtensions || - opcode == X_QueryExtension) - { - return 0; - } - - #ifdef DEBUG - *logofs << "handleFastWriteReply: Decoding raw reply OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - buffer = writeBuffer_.addMessage(8); - - #ifndef __sun - - unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(8); - - *((unsigned int *) buffer) = *next++; - *((unsigned int *) (buffer + 4)) = *next; - - #else /* #ifndef __sun */ - - memcpy(buffer, decodeBuffer.decodeMemory(8), 8); - - #endif /* #ifndef __sun */ - - size = 32 + (GetULONG(buffer + 4, bigEndian_) << 2); - - writeBuffer_.registerPointer(&buffer); - - if (writeBuffer_.getAvailable() < size - 8 || - (int) size >= control -> TransportFlushBufferSize) - { - #ifdef DEBUG - *logofs << "handleFastWriteReply: Using scratch buffer for OPCODE#" - << (unsigned int) opcode << " with size " << size << " and " - << writeBuffer_.getLength() << " bytes in buffer.\n" - << logofs_flush; - #endif - - writeBuffer_.removeMessage(8); - - buffer = writeBuffer_.addScratchMessage(((unsigned char *) - decodeBuffer.decodeMemory(size - 8)) - 8, size); - } - else - { - writeBuffer_.addMessage(size - 8); - - #ifndef __sun - - if (size == 32) - { - next = (unsigned int *) decodeBuffer.decodeMemory(size - 8); - - for (int i = 8; i < 32; i += sizeof(unsigned int)) - { - *((unsigned int *) (buffer + i)) = *next++; - } - } - else - { - memcpy(buffer + 8, decodeBuffer.decodeMemory(size - 8), size - 8); - } - - #else /* #ifndef __sun */ - - memcpy(buffer + 8, decodeBuffer.decodeMemory(size - 8), size - 8); - - #endif /* #ifndef __sun */ - } - - writeBuffer_.unregisterPointer(); - - // - // We don't need to write our local sequence - // number. Replies are always sent with the - // original X server's sequence number. - // - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleFastWriteReply: Handled raw reply OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " - << serverSequence_ << ". Output size is " << size << ".\n" - << logofs_flush; - #endif - - #ifdef DEBUG - *logofs << "handleFastWriteReply: Length of sequence queue is " - << sequenceQueue_.length() << ".\n" << logofs_flush; - #endif - - statistics -> addRepliedRequest(opcode); - - handleFlush(flush_if_needed); - - return 1; -} - -int ClientChannel::handleFastWriteEvent(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - #ifdef DEBUG - *logofs << "handleFastWriteEvent: Decoding raw " - << (opcode == X_Error ? "error" : "event") << " OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - size = 32; - - buffer = writeBuffer_.addMessage(size); - - #ifndef __sun - - unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(size); - - for (int i = 0; i < 32; i += sizeof(unsigned int)) - { - *((unsigned int *) (buffer + i)) = *next++; - } - - #else /* #ifndef __sun */ - - memcpy(buffer, decodeBuffer.decodeMemory(size), size); - - #endif /* #ifndef __sun */ - - // - // Use our local sequence number. - // - - PutUINT(lastSequence_, buffer + 2, bigEndian_); - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleFastWriteEvent: Handled raw " - << (opcode == X_Error ? "error" : "event") << " OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " - << lastSequence_ << ". Output size is " << size << ".\n" - << logofs_flush; - #endif - - // - // Check if we need to suppress the error. - // - - if (opcode == X_Error && handleTaintSyncError(*(buffer + 10)) > 0) - { - #if defined(TEST) || defined(OPCODES) - *logofs << "handleFastWriteEvent: WARNING! Suppressed error OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << " with sequence " << lastSequence_ << ".\n" - << logofs_flush; - #endif - - writeBuffer_.removeMessage(32); - } - - handleFlush(flush_if_needed); - - return 1; -} - -int ClientChannel::handleShmemRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - // - // Will push sequence and set - // priority according to stage. - // - - unsigned int stage = *(buffer + 1); - - #ifdef TEST - *logofs << "handleShmemRequest: Encoding shmem request " - << "OPCODE#" << (unsigned int) opcode << " for FD#" - << fd_ << " with size " << size << " at stage " - << stage << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeValue(stage, 2); - - if (stage == 0) - { - unsigned int enableClient = 0; - unsigned int enableServer = 0; - - if (control -> ShmemClient == 1) - { - enableClient = *(buffer + 4); - } - - if (control -> ShmemServer == 1) - { - enableServer = *(buffer + 5); - } - - encodeBuffer.encodeBoolValue(enableClient); - encodeBuffer.encodeBoolValue(enableServer); - - unsigned int clientSegment = GetULONG(buffer + 8, bigEndian_); - unsigned int serverSegment = GetULONG(buffer + 12, bigEndian_); - - encodeBuffer.encodeValue(clientSegment, 29, 9); - encodeBuffer.encodeValue(serverSegment, 29, 9); - - #ifdef TEST - *logofs << "handleShmemRequest: Enable client is " - << enableClient << " enable server is " << enableServer - << " client segment is " << (void *) clientSegment - << " server segment is " << (void *) serverSegment - << ".\n" << logofs_flush; - #endif - - #ifdef TEST - *logofs << "handleShmemRequest: Size of the shared memory " - << "segment will be " << control -> ShmemServerSize - << ".\n" << logofs_flush; - #endif - } - - if (stage != 1) - { - sequenceQueue_.push(clientSequence_, opcodeStore_ -> - getShmemParameters); - - priority_++; - } - - return 1; -} - -int ClientChannel::handleShmemReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - #ifdef TEST - *logofs << "handleShmemReply: Received shmem parameters " - << "reply OPCODE#" << (unsigned int) opcode - << ".\n" << logofs_flush; - #endif - - size = 32; - buffer = writeBuffer_.addMessage(size); - - unsigned int stage; - - decodeBuffer.decodeValue(stage, 2); - - *(buffer + 1) = stage; - - if (stage == 2) - { - unsigned int clientEnabled; - unsigned int serverEnabled; - - decodeBuffer.decodeBoolValue(clientEnabled); - decodeBuffer.decodeBoolValue(serverEnabled); - - // - // Client support is not implemented - // and not useful. It is here only - // for compatibility. - // - - clientEnabled = 0; - - *(buffer + 8) = clientEnabled; - *(buffer + 9) = serverEnabled; - - PutULONG(0, buffer + 12, bigEndian_); - - if (serverEnabled == 1) - { - #ifdef TEST - *logofs << "handleShmemReply: Enabled shared memory " - << "support in X server with segment size " - << control -> ShmemServerSize << ".\n" - << logofs_flush; - #endif - - PutULONG(control -> ShmemServerSize, buffer + 16, bigEndian_); - } - else - { - PutULONG(0, buffer + 16, bigEndian_); - } - } - else - { - *(buffer + 8) = 0; - *(buffer + 9) = 0; - - PutULONG(0, buffer + 12, bigEndian_); - PutULONG(0, buffer + 16, bigEndian_); - } - - return 1; -} - -int ClientChannel::handleFontRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #ifdef TEST - *logofs << "handleFontRequest: Encoding font request " - << "OPCODE#" << (unsigned int) opcode << " for FD#" - << fd_ << " with size " << size << ".\n" - << logofs_flush; - #endif - - sequenceQueue_.push(clientSequence_, opcodeStore_ -> - getFontParameters); - - return 1; -} - -int ClientChannel::handleFontReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - #ifdef TEST - *logofs << "handleFontReply: Received font operation " - << "reply OPCODE#" << (unsigned int) opcode - << ".\n" << logofs_flush; - #endif - - unsigned int length; - - decodeBuffer.decodeValue(length, 8); - - size = 32 + RoundUp4(length + 1); - buffer = writeBuffer_.addMessage(size); - - unsigned char *next = buffer + 32; - - *next++ = length; - - decodeBuffer.decodeTextData(next, length); - - #ifdef TEST - - *logofs << "handleFontReply: Received tunneled font server " - << "path '"; - - for (unsigned int i = 0; i < length; i++) - { - *logofs << *(buffer + 32 + 1 + i); - } - - *logofs << "' for FD#" << fd_ << ".\n" << logofs_flush; - - #endif - - if (fontPort_ == -1) - { - // - // The local side is not going to forward - // the font server connections. - // - - #ifdef TEST - *logofs << "handleFontReply: WARNING! Returning an empty " - << "font server path.\n" << logofs_flush; - #endif - - writeBuffer_.removeMessage(size); - - size = 36; - buffer = writeBuffer_.addMessage(size); - - // - // Set the length of the returned - // path to 0. - // - - *(buffer + 32) = 0; - } - #ifdef TEST - else - { - *logofs << "handleFontReply: Returning the received " - << "font server path.\n" << logofs_flush; - } - #endif - - return 1; -} - -int ClientChannel::handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #ifdef TEST - *logofs << "handleCacheRequest: Handling cache request " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - enableCache_ = *(buffer + 4); - enableSplit_ = *(buffer + 5); - enableSave_ = *(buffer + 6); - enableLoad_ = *(buffer + 7); - - #ifdef TEST - *logofs << "handleCacheRequest: Set cache parameters to " - << " cache " << enableCache_ << " split " << enableSplit_ - << " save " << enableSave_ << " load " << enableLoad_ - << ".\n" << logofs_flush; - #endif - - // - // Encode all the parameters as a - // single unsigned int so we can - // use an int cache. - // - - unsigned int mask = enableSave_ << 8 | enableLoad_; - - encodeBuffer.encodeCachedValue(mask, 32, clientCache_ -> - setCacheParametersCache); - return 0; -} - -int ClientChannel::handleStartSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #if defined(TEST) || defined(SPLIT) - *logofs << "handleStartSplitRequest: SPLIT! Handling start split " - << "request for FD#"<< fd_ << ".\n" << logofs_flush; - #endif - - if (splitState_.resource != nothing) - { - #ifdef PANIC - *logofs << "handleStartSplitRequest: PANIC! SPLIT! Split requested " - << "for resource id " << (unsigned int) *(buffer + 1) - << " while handling resource " << splitState_.resource - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Split requested for " - << "resource id " << (unsigned int) *(buffer + 1) - << " while handling resource " << splitState_.resource - << ".\n"; - - return -1; - } - else if (fd_ != firstClient_) - { - // - // It can be that an auxiliary channel is the - // first to connect, then comes the agent that - // is actually using the NX opcodes. - // - - #ifdef WARNING - *logofs << "handleStartSplitRequest: WARNING SPLIT! Split requested " - << "on FD#" << fd_ << " while expecting FD#" << firstClient_ - << ".\n" << logofs_flush; - #endif - - firstClient_ = fd_; - } - - // - // Set the agent's resource for which we are - // going to split the request. - // - - splitState_.resource = *(buffer + 1); - - #if defined(TEST) || defined(SPLIT) - - *logofs << "handleStartSplitRequest: SPLIT! Registered id " - << splitState_.resource << " as resource " - << "waiting for a split.\n" << logofs_flush; - - if (clientStore_ -> getSplitStore(splitState_.resource) != NULL) - { - *logofs << "handleStartSplitRequest: WARNING! SPLIT! A split " - << "store for resource id " << splitState_.resource - << " already exists.\n" << logofs_flush; - - clientStore_ -> dumpSplitStore(splitState_.resource); - } - - #endif - - // - // Send the selected resource to the remote. - // - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeCachedValue(splitState_.resource, 8, - clientCache_ -> resourceCache); - - splitState_.mode = (T_split_mode) *(buffer + 4); - - if (splitState_.mode != NXSplitModeAsync && - splitState_.mode != NXSplitModeSync) - { - splitState_.mode = (T_split_mode) control -> SplitMode; - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleStartSplitRequest: SPLIT! Set split " - << "mode to '" << splitState_.mode << "' with " - << "provided value '" << (unsigned) *(buffer + 4) - << "'.\n" << logofs_flush; - #endif - } - - #if defined(TEST) || defined(SPLIT) - - if (splitState_.mode == NXSplitModeAsync) - { - *logofs << "handleStartSplitRequest: SPLIT! Selected split " - << "mode is [split_async].\n" << logofs_flush; - } - else if (splitState_.mode == NXSplitModeSync) - { - *logofs << "handleStartSplitRequest: SPLIT! Selected split " - << "mode is [split_sync].\n" << logofs_flush; - } - - clientStore_ -> dumpSplitStores(); - - #endif - - return 1; -} - -int ClientChannel::handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #if defined(TEST) || defined(SPLIT) - *logofs << "handleEndSplitRequest: SPLIT! Handling end split " - << "request for FD#"<< fd_ << ".\n" << logofs_flush; - #endif - - // - // Verify that the agent resource matches. - // - - if (splitState_.resource == nothing) - { - #ifdef PANIC - *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of " - << "split for resource id " << (unsigned int) *(buffer + 1) - << " without a previous start.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Received an end of split " - << "for resource id " << (unsigned int) *(buffer + 1) - << " without a previous start.\n"; - - return -1; - } - else if (splitState_.resource != *(buffer + 1)) - { - #ifdef PANIC - *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id " - << (unsigned int) *(buffer + 1) << " received while " - << "waiting for resource id " << splitState_.resource - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid resource id " - << (unsigned int) *(buffer + 1) << " received while " - << "waiting for resource id " << splitState_.resource - << ".\n"; - - return -1; - } - - // - // Send the selected resource to the remote. - // - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeCachedValue(splitState_.resource, 8, - clientCache_ -> resourceCache); - - // - // Send the split notification events - // to the agent. - // - - handleRestart(sequence_immediate, splitState_.resource); - - // - // Check if we still have splits to send. - // - - handleSplitPending(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleEndSplitRequest: SPLIT! Reset id " - << splitState_.resource << " as resource " - << "selected for splits.\n" << logofs_flush; - #endif - - splitState_.resource = nothing; - splitState_.mode = split_none; - - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpSplitStores(); - - #endif - - return 1; -} - -void ClientChannel::handleDecodeCharInfo(DecodeBuffer &decodeBuffer, unsigned char *nextDest) -{ - unsigned int value; - - decodeBuffer.decodeCachedValue(value, 32, - *serverCache_ -> queryFontCharInfoCache[0], 6); - - PutUINT(value & 0xffff, nextDest, bigEndian_); - PutUINT(value >> 16, nextDest + 10, bigEndian_); - - nextDest += 2; - - for (unsigned int i = 1; i < 5; i++) - { - unsigned int value; - - decodeBuffer.decodeCachedValue(value, 16, - *serverCache_ -> queryFontCharInfoCache[i], 6); - - PutUINT(value, nextDest, bigEndian_); - - nextDest += 2; - } -} - -int ClientChannel::setBigEndian(int flag) -{ - bigEndian_ = flag; - - return 1; -} - -int ClientChannel::setReferences() -{ - #ifdef TEST - *logofs << "ClientChannel: Initializing the static " - << "members for the client channels.\n" - << logofs_flush; - #endif - - #ifdef REFERENCES - - references_ = 0; - - #endif - - return 1; -} diff --git a/nxcomp/ClientChannel.h b/nxcomp/ClientChannel.h deleted file mode 100644 index ae92648d5..000000000 --- a/nxcomp/ClientChannel.h +++ /dev/null @@ -1,434 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ClientChannel_H -#define ClientChannel_H - -#include "List.h" -#include "Channel.h" - -#include "SequenceQueue.h" - -#include "ClientReadBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// If defined, the client channel will -// have the chance of suppressing more -// opcodes for test purposes. -// - -#undef LAME - -// -// Define this to log a line when a -// channel is created or destroyed. -// - -#undef REFERENCES - -// -// This class implements the X client -// side compression of the protocol. -// - -class ClientChannel : public Channel -{ - public: - - ClientChannel(Transport *transport, StaticCompressor *compressor); - - virtual ~ClientChannel(); - - virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length); - - virtual int handleWrite(const unsigned char *message, unsigned int length); - - virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, - T_store_action action, int position, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, - T_store_action action, int position, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) - { - return 0; - } - - virtual int handleSplit(EncodeBuffer &encodeBuffer); - - virtual int handleSplit(DecodeBuffer &decodeBuffer) - { - return 0; - } - - virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split); - - virtual int handleSplitEvent(DecodeBuffer &decodeBuffer); - - virtual int handleMotion(EncodeBuffer &encodeBuffer) - { - return 0; - } - - virtual int handleCompletion(EncodeBuffer &encodeBuffer) - { - return 0; - } - - virtual int handleConfiguration(); - - virtual int handleFinish(); - - virtual int handleAsyncEvents() - { - return 0; - } - - virtual int needSplit() const - { - #if defined(TEST) || defined(SPLIT) - *logofs << "needSplit: SPLIT! Returning pending split " - << "flag " << splitState_.pending << " with " - << clientStore_ -> getSplitTotalSize() - << " splits in the split stores.\n" - << logofs_flush; - #endif - - return splitState_.pending; - } - - virtual int needMotion() const - { - return 0; - } - - virtual T_channel_type getType() const - { - return channel_x11; - } - - int setBigEndian(int flag); - - // - // Initialize the static members. - // - - static int setReferences(); - - private: - - int handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsigned char &opcode, - const unsigned char *&buffer, const unsigned int &size); - - int handleFastWriteReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - int handleFastWriteEvent(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Intercept the request before the opcode - // is encoded. - // - - int handleTaintRequest(unsigned char &opcode, const unsigned char *&buffer, - unsigned int &size) - { - if (control -> TaintReplies > 0 && - opcode == X_GetInputFocus) - { - return handleTaintSyncRequest(opcode, buffer, size); - } - - #ifdef LAME - - return handleTaintLameRequest(opcode, buffer, size); - - #endif - - return 0; - } - - int handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer, - unsigned int &size); - - int handleTaintSyncRequest(unsigned char &opcode, const unsigned char *&buffer, - unsigned int &size); - - int handleTaintSyncError(unsigned char opcode); - - // - // How to handle sequence counter - // in notification event. - // - - enum T_sequence_mode - { - sequence_immediate, - sequence_deferred - }; - - // - // Send split notifications to the - // agent. - // - - int handleRestart(T_sequence_mode mode, int resource); - - int handleNotify(T_notification_type type, T_sequence_mode mode, - int resource, int request, int position); - - // - // Other utility functions used in - // handling of the image streaming. - // - - int mustSplitMessage(int resource) - { - return (clientStore_ -> getSplitStore(resource) -> - getSize() != 0); - } - - int canSplitMessage(T_split_mode mode, unsigned int size) - { - return ((int) size >= control -> SplitDataThreshold && - (clientStore_ -> getSplitTotalStorageSize() < control -> - SplitTotalStorageSize && clientStore_ -> - getSplitTotalSize() < control -> SplitTotalSize)); - } - - int canSendSplit(Split *split) - { - return (split -> getMode() != split_sync || - split -> getState() == split_missed || - split -> getState() == split_loaded); - } - - int handleSplitSend(EncodeBuffer &encodeBuffer, int resource, - int &total, int &bytes); - - Split *handleSplitFind(T_checksum checksum, int resource); - - int handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum); - - void handleSplitPending(int resource) - { - if (splitState_.pending == 0) - { - if (clientStore_ -> getSplitStore(resource) != NULL && - clientStore_ -> getSplitStore(resource) -> - getFirstSplit() != NULL) - { - splitState_.pending = canSendSplit(clientStore_ -> - getSplitStore(resource) -> getFirstSplit()); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitPending: SPLIT! Set the pending " - << "split flag to " << splitState_.pending - << " with " << clientStore_ -> getSplitTotalSize() - << " splits in the split stores.\n" - << logofs_flush; - #endif - } - } - } - - // - // Scan all the split stores to find - // if there is any split to send. - // - - void handleSplitPending(); - - // - // Handle the MIT-SHM initialization - // messages exchanged with the remote - // proxy. - // - - int handleShmemRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - int handleShmemReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Query the port used to tunnel - // the font server connections. - // - - int handleFontRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - int handleFontReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Let the agent set the cache - // policy for image requests. - // - - int handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - // - // Encode the start and end split - // requests. - // - - int handleStartSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - int handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - // - // Empty a split store and send the - // restart event. - // - - int handleAbortSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - // - // Force the proxy to finalize all - // the pending split operations and - // restart a resource. - // - - int handleFinishSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - // - // Tell the remote peer to send the - // split requests to the X server. - // - - int handleCommitSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - // - // Other utilities. - // - - void handleDecodeCharInfo(DecodeBuffer &, unsigned char *); - - // - // Own read buffer. It is able to identify - // full messages read from the X descriptor. - // - - ClientReadBuffer readBuffer_; - - // - // Sequence number of last request coming - // from the X client or the X server. - // - - unsigned int clientSequence_; - unsigned int serverSequence_; - - // - // Last sequence number known by client. It can - // be the real sequence generated by server or - // the one of the last auto-generated event. - // - - unsigned int lastSequence_; - - // - // Used to identify replies based on sequence - // number of original request. - // - - SequenceQueue sequenceQueue_; - - // - // This is used to test the synchronous flush - // in the proxy. - // - - int lastRequest_; - - // - // Current resource id selected as target and - // other information related to the image split. - // The pending and abort flags are set when we - // want the proxy to give us a chance to send - // more split data. We also save the position - // of the last commit operation performed by - // channel so we can differentially encode the - // position of next message to commit. - // - - typedef struct - { - int resource; - int pending; - int commit; - T_split_mode mode; - - } T_split_state; - - T_split_state splitState_; - - // - // List of agent resources. - // - - List splitResources_; - - // - // How many sync requests we - // have tainted so far. - // - - int taintCounter_; - - private: - - // - // Keep track of object - // creation and deletion. - // - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -#endif /* ClientChannel_H */ diff --git a/nxcomp/ClientProxy.cpp b/nxcomp/ClientProxy.cpp deleted file mode 100644 index 3df45331a..000000000 --- a/nxcomp/ClientProxy.cpp +++ /dev/null @@ -1,549 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Socket.h" -#include "Agent.h" - -#include "ClientProxy.h" - -#include "ClientChannel.h" -#include "GenericChannel.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Log the operations related to sending -// and receiving the control tokens. -// - -#undef TOKEN - -ClientProxy::ClientProxy(int proxyFd) : Proxy(proxyFd) -{ - fontServerPort_ = NULL; - - #ifdef DEBUG - *logofs << "ClientProxy: Created new object at " << this - << ".\n" << logofs_flush; - #endif -} - -ClientProxy::~ClientProxy() -{ - delete [] fontServerPort_; - - #ifdef DEBUG - *logofs << "ClientProxy: Deleted object at " << this - << ".\n" << logofs_flush; - #endif -} - -void ClientProxy::handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, - sockaddr * xServerAddr, unsigned int xServerAddrLength) -{ - #ifdef DEBUG - *logofs << "ClientProxy: No display configuration to set.\n" - << logofs_flush; - #endif -} - -void ClientProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort, - ChannelEndPoint &smbServerPort, - ChannelEndPoint &mediaServerPort, - ChannelEndPoint &httpServerPort, - const char *fontServerPort) -{ - delete [] fontServerPort_; - - fontServerPort_ = new char[strlen(fontServerPort) + 1]; - - strcpy(fontServerPort_, fontServerPort); - - #ifdef DEBUG - *logofs << "ClientProxy: Set port configuration to font '" - << fontServerPort_ << "'.\n" - << logofs_flush; - #endif -} - -int ClientProxy::handleNewConnection(T_channel_type type, int clientFd) -{ - switch (type) - { - case channel_x11: - { - return handleNewXConnection(clientFd); - } - case channel_cups: - { - return handleNewGenericConnection(clientFd, channel_cups, "CUPS"); - } - case channel_smb: - { - return handleNewGenericConnection(clientFd, channel_smb, "SMB"); - } - case channel_media: - { - return handleNewGenericConnection(clientFd, channel_media, "media"); - } - case channel_http: - { - return handleNewGenericConnection(clientFd, channel_http, "HTTP"); - } - case channel_slave: - { - return handleNewSlaveConnection(clientFd); - } - default: - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Unsupported channel with type '" - << getTypeName(type) << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unsupported channel with type '" - << getTypeName(type) << "'.\n"; - - return -1; - } - } -} - -int ClientProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) -{ - switch (type) - { - case channel_font: - { - int port = atoi(fontServerPort_); - - if (port > 0) - { - // - // Connect on the TCP port number. - // - - return handleNewGenericConnectionFromProxyTCP(channelId, channel_font, "localhost", - port, "font"); - } - else - { - // - // Connect to the Unix path. - // - - return handleNewGenericConnectionFromProxyUnix(channelId, channel_font, - fontServerPort_, "font"); - } - } - case channel_slave: - { - return handleNewSlaveConnectionFromProxy(channelId); - } - default: - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Unsupported channel with type '" - << getTypeName(type) << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unsupported channel with type '" - << getTypeName(type) << "'.\n"; - - return -1; - } - } -} - -int ClientProxy::handleNewAgentConnection(Agent *agent) -{ - int clientFd = agent -> getLocalFd(); - - int channelId = allocateChannelMap(clientFd); - - if (channelId == -1) - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Maximum number of available " - << "channels exceeded.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Maximum number of available " - << "channels exceeded.\n"; - - return -1; - } - - transports_[channelId] = agent -> getTransport(); - - agent_ = channelId; - - return handleNewXConnection(clientFd); -} - -int ClientProxy::handleNewXConnection(int clientFd) -{ - int channelId = getChannel(clientFd); - - // - // Check if the channel has been - // already mapped. - // - - if (channelId == -1) - { - channelId = allocateChannelMap(clientFd); - - if (channelId == -1) - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Maximum number of available " - << "channels exceeded.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Maximum number of available " - << "channels exceeded.\n"; - - return -1; - } - } - - #ifdef TEST - *logofs << "ClientProxy: X client descriptor FD#" << clientFd - << " mapped to channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - // - // Turn queuing off for path proxy-to-X-client. - // - - if (control -> OptionClientNoDelay == 1) - { - SetNoDelay(clientFd, control -> OptionClientNoDelay); - } - - // - // If requested, set the size of the TCP send - // and receive buffers. - // - - if (control -> OptionClientSendBuffer != -1) - { - SetSendBuffer(clientFd, control -> OptionClientSendBuffer); - } - - if (control -> OptionClientReceiveBuffer != -1) - { - SetReceiveBuffer(clientFd, control -> OptionClientReceiveBuffer); - } - - if (allocateTransport(clientFd, channelId) < 0) - { - return -1; - } - - // - // Starting from protocol level 3 client and server - // caches are created in proxy and shared between all - // channels. If remote proxy has older protocol level - // pointers are NULL and channels must create their - // own instances. - // - - channels_[channelId] = new ClientChannel(transports_[channelId], compressor_); - - if (channels_[channelId] == NULL) - { - deallocateTransport(channelId); - - return -1; - } - - increaseChannels(channelId); - - // - // Propagate channel stores and caches to the new - // channel. - // - - channels_[channelId] -> setOpcodes(opcodeStore_); - - channels_[channelId] -> setStores(clientStore_, serverStore_); - - channels_[channelId] -> setCaches(clientCache_, serverCache_); - - int port = atoi(fontServerPort_); - - if (port > 0 || *fontServerPort_ != '\0') - { - channels_[channelId] -> setPorts(1); - } - - if (handleControl(code_new_x_connection, channelId) < 0) - { - return -1; - } - - // - // Let channel configure itself according - // to control parameters. - // - - channels_[channelId] -> handleConfiguration(); - - return 1; -} - -int ClientProxy::handleNewXConnectionFromProxy(int channelId) -{ - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Can't create a new X channel " - << "with ID#" << channelId << " at this side.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create a new X channel " - << "with ID#" << channelId << " at this side.\n"; - - return -1; -} - -int ClientProxy::handleLoad(T_load_type type) -{ - int channelCount = getChannels(channel_x11); - - if ((channelCount == 0 && type == load_if_first) || - (channelCount > 0 && type == load_if_any)) - { - #ifdef TEST - *logofs << "ClientProxy: Going to load content of client store.\n" - << logofs_flush; - #endif - - int result = handleLoadStores(); - - if (result == 1) - { - if (handleControl(code_load_request) < 0) - { - return -1; - } - - priority_ = 1; - } - else if (result < 0) - { - #ifdef WARNING - *logofs << "ClientProxy: WARNING! Failed to load content " - << "of persistent cache.\n" << logofs_flush; - #endif - - // - // Don't abort the proxy connection in the case - // of a corrupted cache. By not sending the load - // message to the remote peer, both sides will - // start encoding messages using empty stores. - // This behaviour is compatible with old proxy - // versions. - // - - if (channelCount == 0 && type == load_if_first) - { - if (handleResetStores() < 0) - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Failed to reset message stores.\n" - << logofs_flush; - #endif - - return -1; - } - } - else - { - return -1; - } - } - } - else - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Can't load the stores with " - << channelCount << " remaining channels.\n" - << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int ClientProxy::handleSave() -{ - // - // If no more X channels are remaining - // then save content of message stores. - // - - int channelCount = getChannels(channel_x11); - - if (channelCount == 0) - { - int result = handleSaveStores(); - - if (result == 1) - { - if (handleControl(code_save_request) < 0) - { - return -1; - } - - priority_ = 1; - - return 1; - } - else if (result < 0) - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Failed to save stores " - << "to persistent cache.\n" << logofs_flush; - #endif - - return -1; - } - } - else - { - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Can't save the stores with " - << channelCount << " remaining channels.\n" - << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int ClientProxy::handleAsyncEvents() -{ - if (canRead() == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: WARNING! Reading while writing " - << "with data available on the proxy link.\n" - << logofs_flush; - #endif - - if (handleRead() < 0) - { - return -1; - } - - return 1; - } - - return 0; -} - -int ClientProxy::handleLoadFromProxy() -{ - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Invalid load control message " - << "received in proxy.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid load control message " - << "received in proxy.\n"; - - return -1; -} - -int ClientProxy::handleSaveFromProxy() -{ - #ifdef PANIC - *logofs << "ClientProxy: PANIC! Invalid save control message " - << "received in proxy.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid save control message " - << "received in proxy.\n"; - - return -1; -} - -int ClientProxy::handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient) const -{ - if (clientStore_ -> saveRequestStores(cachefs, md5StateStream, md5StateClient, - use_checksum, discard_data) < 0) - { - return -1; - } - else if (serverStore_ -> saveReplyStores(cachefs, md5StateStream, md5StateClient, - discard_checksum, use_data) < 0) - { - return -1; - } - else if (serverStore_ -> saveEventStores(cachefs, md5StateStream, md5StateClient, - discard_checksum, use_data) < 0) - { - return -1; - } - - return 1; -} - -int ClientProxy::handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const -{ - if (clientStore_ -> loadRequestStores(cachefs, md5StateStream, - use_checksum, discard_data) < 0) - { - return -1; - } - else if (serverStore_ -> loadReplyStores(cachefs, md5StateStream, - discard_checksum, use_data) < 0) - { - return -1; - } - else if (serverStore_ -> loadEventStores(cachefs, md5StateStream, - discard_checksum, use_data) < 0) - { - return -1; - } - - return 1; -} - diff --git a/nxcomp/ClientProxy.h b/nxcomp/ClientProxy.h deleted file mode 100644 index b89785b1a..000000000 --- a/nxcomp/ClientProxy.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ClientProxy_H -#define ClientProxy_H - -#include "Proxy.h" - -// -// Set the verbosity level. -// - -#undef TEST -#undef DEBUG - -class ClientProxy : public Proxy -{ - public: - - ClientProxy(int proxyFD); - - virtual ~ClientProxy(); - - virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, - sockaddr *xServerAddr, unsigned int xServerAddrLength); - - virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, - ChannelEndPoint &smbServerPort, - ChannelEndPoint &mediaServerPort, - ChannelEndPoint &httpServerPort, - const char *fontServerPort); - - protected: - - // - // Create a new channel. - // - - virtual int handleNewConnection(T_channel_type type, int clientFd); - - virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId); - - virtual int handleNewAgentConnection(Agent *agent); - - virtual int handleNewXConnection(int clientFd); - - virtual int handleNewXConnectionFromProxy(int channelId); - - // - // Implement persistence according - // to our proxy mode. - // - - virtual int handleLoad(T_load_type type); - virtual int handleSave(); - - virtual int handleAsyncEvents(); - - virtual int handleLoadFromProxy(); - virtual int handleSaveFromProxy(); - - virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient) const; - - virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const; - - // - // Utility function used to realize - // a new connection. - // - - protected: - - virtual int checkLocalChannelMap(int channelId) - { - // Since ProtoStep7 (#issue 108) - return ((channelId & control -> ChannelMask) != 0); - } - - // - // Ports where to forward extended services' - // TCP connections. - // - - private: - - char *fontServerPort_; -}; - - -#endif /* ClientProxy_H */ diff --git a/nxcomp/ClientReadBuffer.cpp b/nxcomp/ClientReadBuffer.cpp deleted file mode 100644 index 37502038f..000000000 --- a/nxcomp/ClientReadBuffer.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ClientReadBuffer.h" - -#include "ClientChannel.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -unsigned int ClientReadBuffer::suggestedLength(unsigned int pendingLength) -{ - // - // Even if the pending data is not - // enough to make a complete message, - // resize the buffer to accommodate - // it all. - // - - unsigned int readLength = pendingLength; - - if (pendingLength < remaining_) - { - readLength = remaining_; - } - - return readLength; -} - -int ClientReadBuffer::locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength) -{ - unsigned int size = end - start; - - #ifdef TEST - *logofs << "ClientReadBuffer: Locating message for FD#" - << transport_ -> fd() << " with " << size - << " bytes.\n" << logofs_flush; - #endif - - if (firstMessage_) - { - if (size < 12) - { - remaining_ = 12 - size; - - #ifdef TEST - *logofs << "ClientReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - if (*start == 0x42) - { - bigEndian_ = 1; - } - else - { - bigEndian_ = 0; - } - - channel_ -> setBigEndian(bigEndian_); - - dataLength = 12 + RoundUp4(GetUINT(start + 6, bigEndian_)) + - RoundUp4(GetUINT(start + 8, bigEndian_)); - - // - // Send the data immediately if this is unlikely - // to be a X connection attempt. - // - - if (dataLength > 4096) - { - #ifdef WARNING - *logofs << "ClientReadBuffer: WARNING! Flushing suspicious X " - << "connection with first request of " << dataLength - << " bytes.\n" << logofs_flush; - #endif - - dataLength = size; - } - } - else - { - if (size < 4) - { - remaining_ = 4 - size; - - #ifdef TEST - *logofs << "ClientReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - dataLength = (GetUINT(start + 2, bigEndian_) << 2); - - if (dataLength < 4) - { - #ifdef TEST - *logofs << "ClientReadBuffer: WARNING! Assuming length 4 " - << "for suspicious message of length " << dataLength - << ".\n" << logofs_flush; - #endif - - dataLength = 4; - } - } - - #ifdef TEST - *logofs << "ClientReadBuffer: Length of the next message is " - << dataLength << ".\n" << logofs_flush; - #endif - - if (size < dataLength) - { - remaining_ = dataLength - size; - - #ifdef TEST - *logofs << "ClientReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - firstMessage_ = 0; - - controlLength = 0; - trailerLength = 0; - - remaining_ = 0; - - #ifdef TEST - *logofs << "ClientReadBuffer: Located message with " - << "remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/ClientReadBuffer.h b/nxcomp/ClientReadBuffer.h deleted file mode 100644 index c557417fa..000000000 --- a/nxcomp/ClientReadBuffer.h +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ClientReadBuffer_H -#define ClientReadBuffer_H - -#include "Control.h" -#include "ReadBuffer.h" - -class ClientChannel; - -class ClientReadBuffer : public ReadBuffer -{ - public: - - ClientReadBuffer(Transport *transport, ClientChannel *channel) - - : ReadBuffer(transport), firstMessage_(1), channel_(channel) - { - } - - virtual ~ClientReadBuffer() - { - } - - protected: - - virtual unsigned int suggestedLength(unsigned int pendingLength); - - virtual int locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength); - - int bigEndian_; - - int firstMessage_; - - ClientChannel *channel_; -}; - -#endif /* ClientReadBuffer_H */ diff --git a/nxcomp/ClientStore.cpp b/nxcomp/ClientStore.cpp deleted file mode 100644 index e1ba3f4a7..000000000 --- a/nxcomp/ClientStore.cpp +++ /dev/null @@ -1,222 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ClientStore.h" - -// -// Cached request classes. -// - -#include "ChangeProperty.h" -#include "SendEvent.h" -#include "CreateGC.h" -#include "ChangeGC.h" -#include "CreatePixmap.h" -#include "SetClipRectangles.h" -#include "CopyArea.h" -#include "PolyLine.h" -#include "PolySegment.h" -#include "PolyFillRectangle.h" -#include "PutImage.h" -#include "TranslateCoords.h" -#include "GetImage.h" -#include "ClearArea.h" -#include "ConfigureWindow.h" -#include "ShapeExtension.h" -#include "RenderExtension.h" -#include "PolyText8.h" -#include "PolyText16.h" -#include "ImageText8.h" -#include "ImageText16.h" -#include "PolyPoint.h" -#include "PolyFillArc.h" -#include "PolyArc.h" -#include "FillPoly.h" -#include "InternAtom.h" -#include "GetProperty.h" -#include "SetUnpackGeometry.h" -#include "SetUnpackColormap.h" -#include "SetUnpackAlpha.h" -#include "PutPackedImage.h" -#include "GenericRequest.h" - -// -// Set the verbosity level. -// - -#define WARNING -#define PANIC -#undef TEST - -ClientStore::ClientStore(StaticCompressor *compressor) - - : compressor_(compressor) -{ - if (logofs == NULL) - { - logofs = &cout; - } - - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - requests_[i] = NULL; - } - - requests_[X_ChangeProperty] = new ChangePropertyStore(); - requests_[X_SendEvent] = new SendEventStore(); - requests_[X_CreateGC] = new CreateGCStore(); - requests_[X_SetClipRectangles] = new SetClipRectanglesStore(); - requests_[X_CopyArea] = new CopyAreaStore(); - requests_[X_PolyLine] = new PolyLineStore(); - requests_[X_PolySegment] = new PolySegmentStore(); - requests_[X_PolyFillRectangle] = new PolyFillRectangleStore(); - requests_[X_PutImage] = new PutImageStore(compressor); - requests_[X_TranslateCoords] = new TranslateCoordsStore(); - requests_[X_GetImage] = new GetImageStore(); - requests_[X_ClearArea] = new ClearAreaStore(); - requests_[X_ConfigureWindow] = new ConfigureWindowStore(); - requests_[X_PolyText8] = new PolyText8Store(); - requests_[X_PolyText16] = new PolyText16Store(); - requests_[X_ImageText8] = new ImageText8Store(); - requests_[X_ImageText16] = new ImageText16Store(); - requests_[X_PolyPoint] = new PolyPointStore(); - requests_[X_PolyFillArc] = new PolyFillArcStore(); - requests_[X_PolyArc] = new PolyArcStore(); - requests_[X_FillPoly] = new FillPolyStore(); - requests_[X_InternAtom] = new InternAtomStore(); - requests_[X_GetProperty] = new GetPropertyStore(); - - requests_[X_NXInternalShapeExtension] = new ShapeExtensionStore(compressor); - requests_[X_NXInternalGenericRequest] = new GenericRequestStore(compressor); - requests_[X_NXInternalRenderExtension] = new RenderExtensionStore(compressor); - requests_[X_NXSetUnpackGeometry] = new SetUnpackGeometryStore(compressor); - requests_[X_NXPutPackedImage] = new PutPackedImageStore(compressor); - - // Since ProtoStep7 (#issue 108) - requests_[X_ChangeGC] = new ChangeGCStore(); - requests_[X_CreatePixmap] = new CreatePixmapStore(); - requests_[X_NXSetUnpackColormap] = new SetUnpackColormapStore(compressor); - requests_[X_NXSetUnpackAlpha] = new SetUnpackAlphaStore(compressor); - - for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) - { - splits_[i] = NULL; - } - - commits_ = new CommitStore(compressor); -} - -ClientStore::~ClientStore() -{ - if (logofs == NULL) - { - logofs = &cout; - } - - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - delete requests_[i]; - } - - for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) - { - delete splits_[i]; - } - - delete commits_; -} - -int ClientStore::saveRequestStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction) const -{ - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (requests_[i] != NULL && - requests_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, - checksumAction, dataAction, - storeBigEndian()) < 0) - { - #ifdef WARNING - *logofs << "ClientStore: WARNING! Error saving request store " - << "for OPCODE#" << (unsigned int) i << ".\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Error saving request store " - << "for opcode '" << (unsigned int) i << "'.\n"; - - return -1; - } - } - - return 1; -} - -int ClientStore::loadRequestStores(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction) const -{ - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (requests_[i] != NULL && - requests_[i] -> loadStore(cachefs, md5StateStream, - checksumAction, dataAction, - storeBigEndian()) < 0) - { - #ifdef WARNING - *logofs << "ClientStore: WARNING! Error loading request store " - << "for OPCODE#" << (unsigned int) i << ".\n" - << logofs_flush; - #endif - - return -1; - } - } - - return 1; -} - -void ClientStore::dumpSplitStores() const -{ - for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) - { - if (splits_[i] != NULL) - { - splits_[i] -> dump(); - } - } - - if ((getSplitTotalSize() != 0 && getSplitTotalStorageSize() == 0) || - (getSplitTotalSize() == 0 && getSplitTotalStorageSize() != 0)) - { - #ifdef PANIC - *logofs << "ClientStore: PANIC! Inconsistency detected " - << "while handling the split stores.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } -} diff --git a/nxcomp/ClientStore.h b/nxcomp/ClientStore.h deleted file mode 100644 index 009d87d9f..000000000 --- a/nxcomp/ClientStore.h +++ /dev/null @@ -1,143 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ClientStore_H -#define ClientStore_H - -#include "Message.h" -#include "Split.h" - -#include "ChannelStore.h" - -class StaticCompressor; - -class ClientStore : public ChannelStore -{ - public: - - ClientStore(StaticCompressor *compressor); - - virtual ~ClientStore(); - - // - // Get the store based on the index. - // - - MessageStore *getRequestStore(unsigned char opcode) const - { - return requests_[opcode]; - } - - SplitStore *getSplitStore(int resource) const - { - return splits_[resource]; - } - - int getSplitTotalSize() const - { - return SplitStore::getTotalSize(); - } - - int getSplitTotalStorageSize() const - { - return SplitStore::getTotalStorageSize(); - } - - CommitStore *getCommitStore() const - { - return commits_; - } - - int getCommitSize() const - { - return commits_ -> getSize(); - } - - void dumpSplitStore(int resource) const - { - splits_[resource] -> dump(); - } - - void dumpCommitStore() const - { - commits_ -> dump(); - } - - void dumpSplitStores() const; - - SplitStore *createSplitStore(int resource) - { - splits_[resource] = new SplitStore(compressor_, commits_, resource); - - return splits_[resource]; - } - - void destroySplitStore(int resource) - { - delete splits_[resource]; - - splits_[resource] = NULL; - } - - // - // Actually save the message store - // to disk according to proxy mode. - // - - int saveRequestStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction) const; - - int loadRequestStores(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction) const; - - private: - - // - // A client store contains requests. - // - - MessageStore *requests_[CHANNEL_STORE_OPCODE_LIMIT]; - - // - // Client messages being split. - // - - SplitStore *splits_[CHANNEL_STORE_RESOURCE_LIMIT]; - - // - // Messages having been recomposed. - // - - CommitStore *commits_; - - // - // Passed forward to the other stores. - // - - StaticCompressor *compressor_; -}; - -#endif /* ClientStore_H */ diff --git a/nxcomp/Colormap.cpp b/nxcomp/Colormap.cpp deleted file mode 100644 index 8579b7317..000000000 --- a/nxcomp/Colormap.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Unpack.h" -#include "Colormap.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size, - unsigned char *dst_data, int dst_size) -{ - if (*src_data == 0) - { - if (dst_size != src_size - 1) - { - #ifdef TEST - *logofs << "UnpackColormap: PANIC! Invalid destination size " - << dst_size << " with source " << src_size - << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "UnpackColormap: Expanding " << src_size - 1 - << " bytes of plain colormap data.\n" << logofs_flush; - #endif - - memcpy(dst_data, src_data + 1, src_size - 1); - - return 1; - } - - unsigned int check_size = dst_size; - - int result = ZDecompress(&unpackStream, dst_data, &check_size, - src_data + 1, src_size - 1); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "UnpackColormap: PANIC! Failure decompressing colormap data. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decompressing colormap data. " - << "Error is '" << zError(result) << "'.\n"; - - return -1; - } - else if (check_size != (unsigned int) dst_size) - { - #ifdef PANIC - *logofs << "UnpackColormap: PANIC! Size mismatch in colormap data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Size mismatch in colormap data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n"; - - return -1; - } - - #ifdef TEST - *logofs << "UnpackColormap: Decompressed " << src_size - 1 - << " bytes to " << dst_size << " bytes of colormap data.\n" - << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/Colormap.h b/nxcomp/Colormap.h deleted file mode 100644 index a96d003fa..000000000 --- a/nxcomp/Colormap.h +++ /dev/null @@ -1,32 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Colormap_H -#define Colormap_H - -int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size, - unsigned char *dst_data, int dst_size); - -#endif /* Colormap_H */ diff --git a/nxcomp/ConfigureWindow.cpp b/nxcomp/ConfigureWindow.cpp deleted file mode 100644 index 7b0794269..000000000 --- a/nxcomp/ConfigureWindow.cpp +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ConfigureWindow.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int ConfigureWindowStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; - - // - // Here is the fingerprint. - // - - configureWindow -> window = GetULONG(buffer + 4, bigEndian); - - configureWindow -> value_mask = GetUINT(buffer + 8, bigEndian); - - // - // To increase effectiveness of the caching algorithm - // we remove the unused bytes carried in the data part. - // - - if ((int) size > dataOffset) - { - #ifdef DEBUG - *logofs << name() << ": Removing unused bytes from the data payload.\n" << logofs_flush; - #endif - - configureWindow -> value_mask &= (1 << 7) - 1; - - unsigned int mask = 0x1; - unsigned char *source = (unsigned char *) buffer + CONFIGUREWINDOW_DATA_OFFSET; - unsigned long value = 0; - - for (unsigned int i = 0; i < 7; i++) - { - if (configureWindow -> value_mask & mask) - { - value = GetULONG(source, bigEndian); - - value &= (1 << CONFIGUREWINDOW_FIELD_WIDTH[i]) - 1; - - PutULONG(value, source, bigEndian); - - source += 4; - } - mask <<= 1; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ConfigureWindowStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(configureWindow -> window, buffer + 4, bigEndian); - - PutUINT(configureWindow -> value_mask, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ConfigureWindowStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; - - *logofs << "ConfigureWindow: window " << configureWindow -> window - << ", value_mask " << configureWindow -> value_mask - << ", size " << configureWindow -> size_ << ".\n"; - - #endif -} - -void ConfigureWindowStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 4, 4); - md5_append(md5_state_, buffer + 8, 2); -} diff --git a/nxcomp/ConfigureWindow.h b/nxcomp/ConfigureWindow.h deleted file mode 100644 index e02c2aae1..000000000 --- a/nxcomp/ConfigureWindow.h +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ConfigureWindow_H -#define ConfigureWindow_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define CONFIGUREWINDOW_ENABLE_CACHE 1 -#define CONFIGUREWINDOW_ENABLE_DATA 0 -#define CONFIGUREWINDOW_ENABLE_SPLIT 0 -#define CONFIGUREWINDOW_ENABLE_COMPRESS 0 - -#define CONFIGUREWINDOW_DATA_LIMIT 32 -#define CONFIGUREWINDOW_DATA_OFFSET 12 - -#define CONFIGUREWINDOW_CACHE_SLOTS 3000 -#define CONFIGUREWINDOW_CACHE_THRESHOLD 5 -#define CONFIGUREWINDOW_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class ConfigureWindowMessage : public Message -{ - friend class ConfigureWindowStore; - - public: - - ConfigureWindowMessage() - { - } - - ~ConfigureWindowMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int window; - unsigned short value_mask; -}; - -class ConfigureWindowStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ConfigureWindowStore() : MessageStore() - { - enableCache = CONFIGUREWINDOW_ENABLE_CACHE; - enableData = CONFIGUREWINDOW_ENABLE_DATA; - enableSplit = CONFIGUREWINDOW_ENABLE_SPLIT; - enableCompress = CONFIGUREWINDOW_ENABLE_COMPRESS; - - dataLimit = CONFIGUREWINDOW_DATA_LIMIT; - dataOffset = CONFIGUREWINDOW_DATA_OFFSET; - - cacheSlots = CONFIGUREWINDOW_CACHE_SLOTS; - cacheThreshold = CONFIGUREWINDOW_CACHE_THRESHOLD; - cacheLowerThreshold = CONFIGUREWINDOW_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~ConfigureWindowStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "ConfigureWindow"; - } - - virtual unsigned char opcode() const - { - return X_ConfigureWindow; - } - - virtual unsigned int storage() const - { - return sizeof(ConfigureWindowMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ConfigureWindowMessage(); - } - - virtual Message *create(const Message &message) const - { - return new ConfigureWindowMessage((const ConfigureWindowMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (ConfigureWindowMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* ConfigureWindow_H */ diff --git a/nxcomp/Control.cpp b/nxcomp/Control.cpp deleted file mode 100644 index 4469a9bf5..000000000 --- a/nxcomp/Control.cpp +++ /dev/null @@ -1,818 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "NX.h" -#include "NXpack.h" - -#include "Control.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Flush immediately on prioritized messages. -// - -#define FLUSH_PRIORITY 0 - -// -// Maximum number of bytes sent for each token. -// - -#define TOKEN_SIZE 1536 - -// -// Maximum number of tokens that can be spent -// by the client proxy before having to block -// waiting for a token reply. -// - -#define TOKEN_LIMIT 24 - -// -// By default assume the proxy is running as a -// standalone program. -// - -#define LINK_ENCRYPTED 0 - -// -// Maximum number of pids the proxy will record -// and kill at shutdown. -// - -#define KILL_LIMIT 16 - -// -// Allocate on the NX client side channels whose -// ids are a multiple of 8 (starting from 0). All -// the other ids can be used to allocate channels -// at the NX server side (X client side). -// - -#define CHANNEL_MASK 0x07 - -// -// Kill session if control parameters cannot be -// negotiated before this timeout. -// - -#define INIT_TIMEOUT 60000 - -// -// Enter the congestion state if the remote does -// not reply to a ping within the given amount -// of time. -// - -#define PING_TIMEOUT 5000 - -// -// Only send one motion event any N milliseconds. -// - -#define MOTION_TIMEOUT 0 - - -// -// Force an update of the congestion counter if -// the proxy is idle for this time. -// - -#define IDLE_TIMEOUT 50 - -// -// Close X connection if can't write before this -// timeout. -// - -#define CHANNEL_TIMEOUT 10000 - -// -// Warn user (or close proxy connection) if don't -// receive any data before this timeout. -// - -#define PROXY_TIMEOUT 120000 - -// -// How many milliseconds to wait for the shared -// memory completion event to become available. -// - -#define SHMEM_TIMEOUT 200 -// -// Before closing down the proxy, wait for the -// given amount of miliseconds to let all the -// running applications to close down their -// connections. -// -// A null timeout will cause the proxy to wait -// indefinitely, until the watchdog process is -// killed. This is usually the way the proxy is -// started by the NX server. If on the other -// hand a timeout is given and there no channel -// is remaining, the proxy will be closed down -// using a small timeout, presently of 500 ms. -// - -#define CLEANUP_TIMEOUT 3000 - -// -// Wait this amount of milliseconds after any -// iteration of the house-keeping process. -// - -#define KEEPER_TIMEOUT 60000 - -// -// In case of timeout, select can return control -// to program earlier or later of this amount of -// ms. Consider this when calculating if timeout -// is elapsed. -// - -#define LATENCY_TIMEOUT 1 - -// -// Control memory allocation in transport -// and other classes. -// - -#define TRANSPORT_X_BUFFER_SIZE 131072 -#define TRANSPORT_PROXY_BUFFER_SIZE 65536 -#define TRANSPORT_GENERIC_BUFFER_SIZE 16384 - -#define TRANSPORT_X_BUFFER_THRESHOLD 262144 -#define TRANSPORT_PROXY_BUFFER_THRESHOLD 131072 -#define TRANSPORT_GENERIC_BUFFER_THRESHOLD 32768 - -// -// Never allow buffers to exceed this limit. -// - -#define TRANSPORT_MAXIMUM_BUFFER_SIZE 393216 - -// -// Immediately flush the accumulated data to -// the X server if the write buffer exceeds -// this size. -// - -#define TRANSPORT_FLUSH_BUFFER_SIZE 16384 - -// -// Defaults used for socket options. -// - -#define OPTION_PROXY_KEEP_ALIVE 0 -#define OPTION_PROXY_LOW_DELAY 1 -#define OPTION_PROXY_CLIENT_NO_DELAY 1 -#define OPTION_PROXY_SERVER_NO_DELAY 1 -#define OPTION_CLIENT_NO_DELAY 1 -#define OPTION_SERVER_NO_DELAY 1 - -#define OPTION_PROXY_RECEIVE_BUFFER -1 -#define OPTION_CLIENT_RECEIVE_BUFFER -1 -#define OPTION_SERVER_RECEIVE_BUFFER -1 - -#define OPTION_PROXY_SEND_BUFFER -1 -#define OPTION_CLIENT_SEND_BUFFER -1 -#define OPTION_SERVER_SEND_BUFFER -1 - -#define OPTION_PROXY_RETRY_CONNECT 30 -#define OPTION_PROXY_RETRY_ACCEPT 3 -#define OPTION_SERVER_RETRY_CONNECT 3 - -// -// Defaults used for cache persistence. -// - -#define PERSISTENT_CACHE_THRESHOLD 102400 - -#define PERSISTENT_CACHE_ENABLE_LOAD 1 -#define PERSISTENT_CACHE_ENABLE_SAVE 1 - -#define PERSISTENT_CACHE_CHECK_ON_SHUTDOWN 0 - -#define PERSISTENT_CACHE_LOAD_PACKED 1 -#define PERSISTENT_CACHE_LOAD_RENDER 1 - -#define PERSISTENT_CACHE_DISK_LIMIT 33554432 - -// -// Defaults used for image cache. -// - -#define IMAGE_CACHE_ENABLE_LOAD 0 -#define IMAGE_CACHE_ENABLE_SAVE 0 - -#define IMAGE_CACHE_DISK_LIMIT 33554432 - -// -// Suggested defaults for read length parameters -// used by read buffer classes. -// - -#define CLIENT_INITIAL_READ_SIZE 8192 -#define CLIENT_MAXIMUM_BUFFER_SIZE 262144 - -#define SERVER_INITIAL_READ_SIZE 8192 -#define SERVER_MAXIMUM_BUFFER_SIZE 65536 - -#define PROXY_INITIAL_READ_SIZE 65536 -#define PROXY_MAXIMUM_BUFFER_SIZE 262144 + 1024 - -#define GENERIC_INITIAL_READ_SIZE 8192 -#define GENERIC_MAXIMUM_BUFFER_SIZE 8192 - -// -// Calculate bitrate in given time frames. -// Values are in milliseconds. -// - -#define SHORT_BITRATE_TIME_FRAME 5000 -#define LONG_BITRATE_TIME_FRAME 30000 - -// -// Bandwidth control. A value of 0 means no -// limit. Values are stored internally in -// bytes per second. -// - -#define CLIENT_BITRATE_LIMIT 0 -#define SERVER_BITRATE_LIMIT 0 - -// -// Default values for cache control. We limit -// the maximum size of a request to 262144 but -// we need to consider the replies, whose size -// may be up to 4MB. -// - -#define MINIMUM_MESSAGE_SIZE 4 -#define MAXIMUM_MESSAGE_SIZE 4194304 -#define MAXIMUM_REQUEST_SIZE 262144 - -#define CLIENT_TOTAL_STORAGE_SIZE 8388608 -#define SERVER_TOTAL_STORAGE_SIZE 8388608 - -#define STORE_TIME_LIMIT 3600 - -#define STORE_HITS_LOAD_BONUS 10 -#define STORE_HITS_ADD_BONUS 20 -#define STORE_HITS_LIMIT 100 - -#define STORE_HITS_TOUCH 1 -#define STORE_HITS_UNTOUCH 2 - -// -// Default parameters for message splitting. -// - -#define SPLIT_MODE 1 -#define SPLIT_TIMEOUT 50 -#define SPLIT_TOTAL_SIZE 128 -#define SPLIT_TOTAL_STORAGE_SIZE 1048576 -#define SPLIT_DATA_THRESHOLD 65536 -#define SPLIT_DATA_PACKET_LIMIT 24576 - -// -// Agent related parameters. -// - -#define PACK_METHOD 63 -#define PACK_QUALITY 9 -#define HIDE_RENDER 0 -#define TAINT_REPLIES 1 -#define TAINT_THRESHOLD 8 - -// -// In current version only X server support is -// implemented. Note that use of shared memory -// is negotiated according to options provided -// by the user. -// - -#define SHMEM_CLIENT 0 -#define SHMEM_SERVER 1 - -// -// Default size of shared memory segments used -// in MIT-SHM support. -// - -#define SHMEM_CLIENT_SIZE 0 -#define SHMEM_SERVER_SIZE 2097152 - -// -// What do we do at the end of session? If this -// flag is set, we launch a new client letting -// the user run a new NX session. -// - -#define ENABLE_RESTART_ON_SHUTDOWN 0 - -// -// Do we produce a core dump on fatal errors? -// - -#define ENABLE_CORE_DUMP_ON_ABORT 0 - -// -// Reopen the log file if it exceeds this size. -// - -#define FILE_SIZE_LIMIT 60000000 - -// -// Check periodically if we need to truncate the -// log file. By default check every minute. -// - -#define FILE_SIZE_CHECK_TIMEOUT 60000 - -// -// Protocol version compatibility values -// - -const int Control::NX_MIN_PROTO_STEP = 10; -const int Control::NX_MAX_PROTO_STEP = 10; -const char* const Control::NXPROXY_COMPATIBILITY_VERSION = "3.5.0"; - -// -// Set defaults for control. They should be what -// you get in case of 'local' connection. -// - -Control::Control() -{ - ProxyMode = proxy_undefined; - ProxyStage = stage_undefined; - SessionMode = session_undefined; - FlushPolicy = policy_undefined; - LinkMode = link_undefined; - - LinkEncrypted = LINK_ENCRYPTED; - FlushPriority = FLUSH_PRIORITY; - - TokenSize = TOKEN_SIZE; - TokenLimit = TOKEN_LIMIT; - - ChannelMask = CHANNEL_MASK; - - InitTimeout = INIT_TIMEOUT; - PingTimeout = PING_TIMEOUT; - MotionTimeout = MOTION_TIMEOUT; - IdleTimeout = IDLE_TIMEOUT; - - ChannelTimeout = CHANNEL_TIMEOUT; - ProxyTimeout = PROXY_TIMEOUT; - ShmemTimeout = SHMEM_TIMEOUT; - - CleanupTimeout = CLEANUP_TIMEOUT; - KeeperTimeout = KEEPER_TIMEOUT; - LatencyTimeout = LATENCY_TIMEOUT; - - FileSizeLimit = FILE_SIZE_LIMIT; - FileSizeCheckTimeout = FILE_SIZE_CHECK_TIMEOUT; - - EnableRestartOnShutdown = ENABLE_RESTART_ON_SHUTDOWN; - - KillDaemonOnShutdownLimit = KILL_LIMIT; - - KillDaemonOnShutdown = new int[KillDaemonOnShutdownLimit]; - - for (int i = 0; i < KILL_LIMIT; i++) - { - KillDaemonOnShutdown[i] = -1; - } - - KillDaemonOnShutdownNumber = 0; - - EnableCoreDumpOnAbort = ENABLE_CORE_DUMP_ON_ABORT; - - // - // Collect statistics by default. - // - - EnableStatistics = 1; - - // - // Memory restrictions if any. - // - - LocalMemoryLevel = -1; - - // - // Compression must be negotiated between proxies. - // - - LocalDeltaCompression = -1; - RemoteDeltaCompression = -1; - - LocalDataCompression = -1; - LocalStreamCompression = -1; - - RemoteDataCompression = -1; - RemoteStreamCompression = -1; - - LocalDataCompressionLevel = -1; - LocalDataCompressionThreshold = -1; - LocalStreamCompressionLevel = -1; - - RemoteDataCompressionLevel = -1; - RemoteStreamCompressionLevel = -1; - - // - // Transport buffers' allocation parameters. - // - - TransportXBufferSize = TRANSPORT_X_BUFFER_SIZE; - TransportProxyBufferSize = TRANSPORT_PROXY_BUFFER_SIZE; - TransportGenericBufferSize = TRANSPORT_GENERIC_BUFFER_SIZE; - - TransportXBufferThreshold = TRANSPORT_X_BUFFER_THRESHOLD; - TransportProxyBufferThreshold = TRANSPORT_PROXY_BUFFER_THRESHOLD; - TransportGenericBufferThreshold = TRANSPORT_GENERIC_BUFFER_THRESHOLD; - - TransportMaximumBufferSize = TRANSPORT_MAXIMUM_BUFFER_SIZE; - - // - // Flush the write buffer if it exceeds - // this size. - // - - TransportFlushBufferSize = TRANSPORT_FLUSH_BUFFER_SIZE; - - // - // Socket options. - // - - OptionProxyKeepAlive = OPTION_PROXY_KEEP_ALIVE; - OptionProxyLowDelay = OPTION_PROXY_LOW_DELAY; - OptionProxyClientNoDelay = OPTION_PROXY_CLIENT_NO_DELAY; - OptionProxyServerNoDelay = OPTION_PROXY_SERVER_NO_DELAY; - OptionClientNoDelay = OPTION_CLIENT_NO_DELAY; - OptionServerNoDelay = OPTION_SERVER_NO_DELAY; - - OptionProxyReceiveBuffer = OPTION_PROXY_RECEIVE_BUFFER; - OptionClientReceiveBuffer = OPTION_CLIENT_RECEIVE_BUFFER; - OptionServerReceiveBuffer = OPTION_SERVER_RECEIVE_BUFFER; - - OptionProxySendBuffer = OPTION_PROXY_SEND_BUFFER; - OptionClientSendBuffer = OPTION_CLIENT_SEND_BUFFER; - OptionServerSendBuffer = OPTION_SERVER_SEND_BUFFER; - - OptionProxyRetryAccept = OPTION_PROXY_RETRY_ACCEPT; - OptionProxyRetryConnect = OPTION_PROXY_RETRY_CONNECT; - OptionServerRetryConnect = OPTION_SERVER_RETRY_CONNECT; - - // - // Base NX directories. - // - - HomePath = NULL; - RootPath = NULL; - SystemPath = NULL; - TempPath = NULL; - ClientPath = NULL; - - // - // Set defaults for handling persistent cache. - // - - PersistentCachePath = NULL; - PersistentCacheName = NULL; - - PersistentCacheThreshold = PERSISTENT_CACHE_THRESHOLD; - - PersistentCacheEnableLoad = PERSISTENT_CACHE_ENABLE_LOAD; - PersistentCacheEnableSave = PERSISTENT_CACHE_ENABLE_SAVE; - - PersistentCacheCheckOnShutdown = PERSISTENT_CACHE_CHECK_ON_SHUTDOWN; - - PersistentCacheLoadPacked = PERSISTENT_CACHE_LOAD_PACKED; - PersistentCacheLoadRender = PERSISTENT_CACHE_LOAD_RENDER; - - PersistentCacheDiskLimit = PERSISTENT_CACHE_DISK_LIMIT; - - // - // Set defaults for image cache. - // - - ImageCachePath = NULL; - - ImageCacheEnableLoad = IMAGE_CACHE_ENABLE_LOAD; - ImageCacheEnableSave = IMAGE_CACHE_ENABLE_SAVE; - - ImageCacheDiskLimit = IMAGE_CACHE_DISK_LIMIT; - - // - // Set defaults for the read buffers. - // - - ClientInitialReadSize = CLIENT_INITIAL_READ_SIZE; - ClientMaximumBufferSize = CLIENT_MAXIMUM_BUFFER_SIZE; - - ServerInitialReadSize = SERVER_INITIAL_READ_SIZE; - ServerMaximumBufferSize = SERVER_MAXIMUM_BUFFER_SIZE; - - ProxyInitialReadSize = PROXY_INITIAL_READ_SIZE; - ProxyMaximumBufferSize = PROXY_MAXIMUM_BUFFER_SIZE; - - GenericInitialReadSize = GENERIC_INITIAL_READ_SIZE; - GenericMaximumBufferSize = GENERIC_MAXIMUM_BUFFER_SIZE; - - ShortBitrateTimeFrame = SHORT_BITRATE_TIME_FRAME; - LongBitrateTimeFrame = LONG_BITRATE_TIME_FRAME; - - // - // Bandwidth control. - // - - LocalBitrateLimit = -1; - - ClientBitrateLimit = CLIENT_BITRATE_LIMIT; - ServerBitrateLimit = SERVER_BITRATE_LIMIT; - - // - // Default parameters for message handling. - // - - ClientTotalStorageSize = CLIENT_TOTAL_STORAGE_SIZE; - ServerTotalStorageSize = SERVER_TOTAL_STORAGE_SIZE; - - LocalTotalStorageSize = -1; - RemoteTotalStorageSize = -1; - - StoreTimeLimit = STORE_TIME_LIMIT; - - StoreHitsLoadBonus = STORE_HITS_LOAD_BONUS; - StoreHitsAddBonus = STORE_HITS_ADD_BONUS; - StoreHitsLimit = STORE_HITS_LIMIT; - - StoreHitsTouch = STORE_HITS_TOUCH; - StoreHitsUntouch = STORE_HITS_UNTOUCH; - - MinimumMessageSize = MINIMUM_MESSAGE_SIZE; - MaximumMessageSize = MAXIMUM_MESSAGE_SIZE; - MaximumRequestSize = MAXIMUM_REQUEST_SIZE; - - SplitMode = SPLIT_MODE; - SplitTimeout = SPLIT_TIMEOUT; - SplitTotalSize = SPLIT_TOTAL_SIZE; - SplitTotalStorageSize = SPLIT_TOTAL_STORAGE_SIZE; - SplitDataThreshold = SPLIT_DATA_THRESHOLD; - SplitDataPacketLimit = SPLIT_DATA_PACKET_LIMIT; - - PackMethod = PACK_METHOD; - PackQuality = PACK_QUALITY; - HideRender = HIDE_RENDER; - TaintReplies = TAINT_REPLIES; - TaintThreshold = TAINT_THRESHOLD; - - ShmemClient = SHMEM_CLIENT; - ShmemServer = SHMEM_SERVER; - - ShmemClientSize = SHMEM_CLIENT_SIZE; - ShmemServerSize = SHMEM_SERVER_SIZE; - - // - // Get local version number from compile time - // settings. Version of remote proxy will be - // checked at connection time. - // - - RemoteVersionMajor = -1; - RemoteVersionMinor = -1; - RemoteVersionPatch = -1; - RemoteVersionMaintenancePatch = -1; - - CompatVersionMajor = -1; - CompatVersionMinor = -1; - CompatVersionPatch = -1; - CompatVersionMaintenancePatch = -1; - - LocalVersionMajor = NXMajorVersion(); - LocalVersionMinor = NXMinorVersion(); - LocalVersionPatch = NXPatchVersion(); - LocalVersionMaintenancePatch = NXMaintenancePatchVersion(); - - #ifdef TEST - *logofs << "Control: Major version is " << LocalVersionMajor - << " minor is " << LocalVersionMinor << " patch is " - << LocalVersionPatch << " Maintenance version is " - << LocalVersionMaintenancePatch << ".\n" << logofs_flush; - #endif - - // - // Initialize local implemented methods later - // and negotiate remote methods at connection - // time. - // - - LocalUnpackMethods = NULL; - RemoteUnpackMethods = NULL; - - // - // Set to 1 those methods which are implemented. - // - - setLocalUnpackMethods(); - - // - // Set the protocol version at the - // time the session is negotiated. - // - - protoStep_ = 0; -} - -Control::~Control() -{ - if (KillDaemonOnShutdown != NULL) - { - delete [] KillDaemonOnShutdown; - } - - if (HomePath != NULL) - { - delete [] HomePath; - } - - if (RootPath != NULL) - { - delete [] RootPath; - } - - if (SystemPath != NULL) - { - delete [] SystemPath; - } - - if (TempPath != NULL) - { - delete [] TempPath; - } - - if (ClientPath != NULL) - { - delete [] ClientPath; - } - - if (PersistentCachePath != NULL) - { - delete [] PersistentCachePath; - } - - if (PersistentCacheName != NULL) - { - delete [] PersistentCacheName; - } - - if (LocalUnpackMethods != NULL) - { - delete [] LocalUnpackMethods; - } - - if (RemoteUnpackMethods != NULL) - { - delete [] RemoteUnpackMethods; - } - - if (ImageCachePath != NULL) - { - delete [] ImageCachePath; - } -} - -// -// Set the protocol step based on the -// remote version. -// - -void Control::setProtoStep(int step) -{ - if (isValidProtoStep(step)) - { - protoStep_ = step; - } - else - { - #ifdef PANIC - *logofs << "Control: PANIC! Invalid protocol step " - << "with value " << step << ".\n" - << logofs_flush; - #endif - - HandleCleanup(); - } -} - -int Control::getProtoStep() -{ - if (isValidProtoStep(protoStep_)) - { - return protoStep_; - } - else - { - #ifdef PANIC - *logofs << "Control: PANIC! Can't identify the " - << "protocol step.\n" << logofs_flush; - #endif - - HandleCleanup(); - } -} - -// -// Set here the pack/unpack methods that are -// implemented by this NX proxy. -// - -void Control::setLocalUnpackMethods() -{ - LocalUnpackMethods = new unsigned char[PACK_METHOD_LIMIT]; - RemoteUnpackMethods = new unsigned char[PACK_METHOD_LIMIT]; - - for (int i = 0; i < PACK_METHOD_LIMIT; i++) - { - LocalUnpackMethods[i] = 0; - RemoteUnpackMethods[i] = 0; - } - - LocalUnpackMethods[NO_PACK] = 1; - - LocalUnpackMethods[PACK_MASKED_8_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_64_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_256_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_512_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_4K_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_32K_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_64K_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_256K_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_2M_COLORS] = 1; - LocalUnpackMethods[PACK_MASKED_16M_COLORS] = 1; - - LocalUnpackMethods[PACK_RAW_8_BITS] = 1; - LocalUnpackMethods[PACK_RAW_16_BITS] = 1; - LocalUnpackMethods[PACK_RAW_24_BITS] = 1; - - LocalUnpackMethods[PACK_COLORMAP_256_COLORS] = 1; - - LocalUnpackMethods[PACK_JPEG_8_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_64_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_256_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_512_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_4K_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_32K_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_64K_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_256K_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_2M_COLORS] = 1; - LocalUnpackMethods[PACK_JPEG_16M_COLORS] = 1; - - LocalUnpackMethods[PACK_PNG_8_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_64_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_256_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_512_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_4K_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_32K_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_64K_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_256K_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_2M_COLORS] = 1; - LocalUnpackMethods[PACK_PNG_16M_COLORS] = 1; - - LocalUnpackMethods[PACK_RGB_16M_COLORS] = 1; - LocalUnpackMethods[PACK_RLE_16M_COLORS] = 1; - - LocalUnpackMethods[PACK_ALPHA] = 1; - LocalUnpackMethods[PACK_COLORMAP] = 1; - - LocalUnpackMethods[PACK_BITMAP_16M_COLORS] = 1; -} diff --git a/nxcomp/Control.h b/nxcomp/Control.h deleted file mode 100644 index 764fca2c1..000000000 --- a/nxcomp/Control.h +++ /dev/null @@ -1,764 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Control_H -#define Control_H - -#include "NXpack.h" - -#include "Misc.h" -#include "Types.h" -#include "Timestamp.h" -#include "Statistics.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// This is the mode proxy is running. -// - -typedef enum -{ - proxy_undefined = -1, - proxy_client, - proxy_server, - proxy_last_tag -} -T_proxy_mode; - -// -// Handle advances in the connection -// procedure. -// - -typedef enum -{ - stage_undefined, - stage_initializing, - stage_connecting, - stage_connected, - stage_waiting_forwarder_version, - stage_waiting_forwarder_options, - stage_sending_forwarder_options, - stage_waiting_proxy_version, - stage_waiting_proxy_options, - stage_sending_proxy_options, - stage_waiting_proxy_caches, - stage_sending_proxy_caches, - stage_operational, - stage_terminating, - stage_terminated -} -T_proxy_stage; - -// -// Hint about whether or not the proxy is -// connected to a NX agen. -// - -typedef enum -{ - session_undefined = -1, - session_agent, - session_shadow, - session_proxy, - session_last_tag -} -T_session_mode; - -// -// Set how data will be written to the peer -// socket. -// - -typedef enum -{ - policy_undefined = -1, - policy_immediate, - policy_deferred -} -T_flush_policy; - -// -// Link mode, after negotiation, will be set to -// any of the values defined in the NXproto.h. -// - -#define link_undefined -1; - -// -// This class collects functioning parameters, -// to be configurable at run-time. They are for -// the most part regarding timeouts, transport -// and message stores handling. -// - -class Control -{ - public: - - // - // Does proxy run in client mode or server mode? - // As soon as we'll have gone through parsing of - // the command line options the current mode will - // be propagated to the control class. - // - - T_proxy_mode ProxyMode; - - // - // Goes from initializing to operational. - // - - T_proxy_stage ProxyStage; - - // - // Hint about type of session currently running. - // - - T_session_mode SessionMode; - - // - // Either immediate or defferred flushes. - // - - T_flush_policy FlushPolicy; - - // - // If set, the channels will try to flush the - // encoded data whenever there is a prioritized - // message. Depending on the flush policy, this - // may determine an immediate flush or an event - // being generated telling to the agent that it - // should flush the proxy link. - // - - int FlushPriority; - - // - // Id corresponding to link speed negotiated - // between proxies. - // - - int LinkMode; - - // - // Set if the proxy is connected to a program - // providing the encryption of the point to - // point communication. - // - - int LinkEncrypted; - - // - // Maximum number of bytes sent for each token. - // - - int TokenSize; - - // - // Maximum number of tokens that can be spent - // by the client proxy before having to block - // waiting for a reply. - // - - int TokenLimit; - - // - // Bitmask used to determine the distribution - // of channel ids between the client and server - // proxies. - // - - int ChannelMask; - - // - // Kill session if control parameters cannot - // be negotiated before this timeout. - // - - int InitTimeout; - - // - // Enter the congestion state if the remote does - // not reply to the ping within the given amount - // of time. - // - - int PingTimeout; - - // - // Enqueue motion notify events in server channel. - // - - int MotionTimeout; - - // - // Force an update of the congestion counter if - // the proxy is idle for this time. - // - - int IdleTimeout; - - // - // Close the connection if can't write before - // this timeout. - // - - int ChannelTimeout; - - // - // Close connection if can't write before - // this timeout. - // - - int ProxyTimeout; - - // - // How many milliseconds to wait for the shared - // memory completion event to become available. - // - - int ShmemTimeout; - - // - // Wait for applications to complete at the time - // proxy is shut down. - // - - int CleanupTimeout; - - // - // Wait this amount of milliseconds before any - // iteration of the house-keeping process. - // - - int KeeperTimeout; - - // - // Adjust timeout calculations. - // - - int LatencyTimeout; - - // - // Maximum allowed size of log files. - // - - int FileSizeLimit; - int FileSizeCheckTimeout; - - // - // What do we do at the end of session? If - // this flag is set we launch a new client - // letting the user run a new NX session. - // - - int EnableRestartOnShutdown; - - // - // The client can request the proxy to kill - // a number of processes before exiting. - // - - int *KillDaemonOnShutdown; - int KillDaemonOnShutdownNumber; - int KillDaemonOnShutdownLimit; - - // - // Do we generate a core dump and exit in - // case of program errors? - // - - int EnableCoreDumpOnAbort; - - // - // Is statistic output enabled? - // - - int EnableStatistics; - - // - // Version number of local and remote proxy. - // - - /* - * LocalVersionMaintenancePatch, RemoteVersionMaintenancePatch - * CompatVersionMaintenancePatch - * - * currently not used, for future compatibility checks - */ - int LocalVersionMajor; - int LocalVersionMinor; - int LocalVersionPatch; - int LocalVersionMaintenancePatch; - - int RemoteVersionMajor; - int RemoteVersionMinor; - int RemoteVersionPatch; - int RemoteVersionMaintenancePatch; - - int CompatVersionMajor; - int CompatVersionMinor; - int CompatVersionPatch; - int CompatVersionMaintenancePatch; - - // - // Compatibility version for the proxy - // - - static const char* const NXPROXY_COMPATIBILITY_VERSION; - - // - // Which unpack methods are implemented in proxy? - // - - unsigned char *LocalUnpackMethods; - unsigned char *RemoteUnpackMethods; - - // - // Memory restriction imposed by user. - // - - int LocalMemoryLevel; - - // - // Use or not differential compression - // and caching of X protocol messages. - // - - int LocalDeltaCompression; - int RemoteDeltaCompression; - - // - // Compression of images and replies. - // - - int LocalDataCompression; - int LocalDataCompressionLevel; - - int RemoteDataCompression; - int RemoteDataCompressionLevel; - - // - // Minimum packet size to be compressed. - // - - int LocalDataCompressionThreshold; - - // - // Compress or not data flowing through the proxy - // link. Level should be one of the ZLIB level as - // Z_DEFAULT_COMPRESSION or Z_BEST_COMPRESSION. - // - - int LocalStreamCompression; - int LocalStreamCompressionLevel; - - int RemoteStreamCompression; - int RemoteStreamCompressionLevel; - - // - // Size of read operations in read buffer classes. - // - - int ClientInitialReadSize; - int ClientMaximumBufferSize; - - int ServerInitialReadSize; - int ServerMaximumBufferSize; - - int ProxyInitialReadSize; - int ProxyMaximumBufferSize; - - int GenericInitialReadSize; - int GenericMaximumBufferSize; - - // - // Set initial size and resize policy of - // transport buffers. If maximum size is - // exceeded, print a warning. - // - - int TransportXBufferSize; - int TransportProxyBufferSize; - int TransportGenericBufferSize; - - int TransportXBufferThreshold; - int TransportProxyBufferThreshold; - int TransportGenericBufferThreshold; - - int TransportMaximumBufferSize; - - // - // Flush the data produced for the channel - // connection if it exceeds this size. - // - - int TransportFlushBufferSize; - - // - // Socket options. - // - - int OptionProxyKeepAlive; - int OptionProxyLowDelay; - int OptionProxyClientNoDelay; - int OptionProxyServerNoDelay; - int OptionClientNoDelay; - int OptionServerNoDelay; - - int OptionProxyReceiveBuffer; - int OptionClientReceiveBuffer; - int OptionServerReceiveBuffer; - - int OptionProxySendBuffer; - int OptionClientSendBuffer; - int OptionServerSendBuffer; - - int OptionProxyRetryAccept; - int OptionProxyRetryConnect; - int OptionServerRetryConnect; - - // - // Calculate current bitrate on proxy link - // using these observation periods. Value - // is in milliseconds. - // - - int ShortBitrateTimeFrame; - int LongBitrateTimeFrame; - - // - // Limit the bandwidth usage of the proxy - // link. - // - - int LocalBitrateLimit; - - int ClientBitrateLimit; - int ServerBitrateLimit; - - // - // This is the limit imposed by user on - // total cache size. - // - - int ClientTotalStorageSize; - int ServerTotalStorageSize; - - int LocalTotalStorageSize; - int RemoteTotalStorageSize; - - // - // Discard messages in store older than - // this amount of seconds. - // - - int StoreTimeLimit; - - // - // Any new message in store starts with - // this amount of hits. - // - - int StoreHitsAddBonus; - - // - // Unless it is loaded from persistent - // cache. - // - - int StoreHitsLoadBonus; - - // - // Stop increasing hits at this threshold. - // - - int StoreHitsLimit; - - // - // Give a special weight to messages put or - // taken from cache during startup time. - // - - int StoreHitsStartup; - - // - // Weight of touch and untoch operations. - // - - int StoreHitsTouch; - int StoreHitsUntouch; - - // - // Directives on size of messages to cache. - // - - int MinimumMessageSize; - int MaximumMessageSize; - - // - // Maximum size of a single X request. - // - - int MaximumRequestSize; - - // - // Currently selected streaming mode. - // - - int SplitMode; - - // - // Send new split data any given amount of - // milliseconds. - // - - int SplitTimeout; - - // - // Maximum number of distinct messages and - // maximum size in bytes of the temporary - // storage. - // - - int SplitTotalSize; - int SplitTotalStorageSize; - - // - // Don't split messages smaller that this - // threshold and send no more than the - // given amount of bytes in a single data - // shot when streaming the split messages. - // - - int SplitDataThreshold; - int SplitDataPacketLimit; - - // - // Agent related parameters. These values apply - // to the agent which, at startup, must query - // the user's settings. - // - - int PackMethod; - int PackQuality; - int HideRender; - int TaintReplies; - int TaintThreshold; - - // - // Do we allow shared memory image support in - // client and or server? - // - - int ShmemClient; - int ShmemServer; - - // - // Default size of shared memory segments used - // in MIT-SHM support. - // - - int ShmemClientSize; - int ShmemServerSize; - - // - // The user's home directory. - // - - char *HomePath; - - // - // The ".nx" directory, usually in - // the user's home. - // - - char *RootPath; - - // - // Usually the /usr/NX" directory. - // - - char *SystemPath; - - // - // Usually the "/tmp" directory. - // - - char *TempPath; - - // - // The complete path to the client. - // - - char *ClientPath; - - // - // String containing path of cache - // file selected for load or save. - // - - char *PersistentCachePath; - - // - // Name of selected cache file. - // - - char *PersistentCacheName; - - // - // Minimum size of cache in memory - // to proceed to its storage on disk. - // - - int PersistentCacheThreshold; - - // - // Is persistent cache enabled? - // - - int PersistentCacheEnableLoad; - int PersistentCacheEnableSave; - - // - // This is used just for test because - // it requires that client and server - // reside on the same machine. - // - - int PersistentCacheCheckOnShutdown; - - // - // Load packed image and render extension - // message stores. This currently depends - // on the type of session. - // - - int PersistentCacheLoadPacked; - int PersistentCacheLoadRender; - - // - // Maximum disk consumption of message - // caches on disk. - // - - int PersistentCacheDiskLimit; - - // - // String containing the base path - // of image cache files. - // - - char *ImageCachePath; - - // - // Is image cache enabled? - // - - int ImageCacheEnableLoad; - int ImageCacheEnableSave; - - // - // Maximum disk consumption of image - // caches on disk. - // - - int ImageCacheDiskLimit; - - // - // Only constructor, destructor - // and a few utility functions. - // - - Control(); - - ~Control(); - - // - // Should not leverage control to find channel - // stores' size limits. As most of values in - // control, this info must be moved elsewhere. - // - - int getUpperStorageSize() const - { - return (ClientTotalStorageSize > - ServerTotalStorageSize ? - ClientTotalStorageSize : - ServerTotalStorageSize); - } - - int getLowerStorageSize() const - { - return (ClientTotalStorageSize < - ServerTotalStorageSize ? - ClientTotalStorageSize : - ServerTotalStorageSize); - } - - void setProtoStep(int step); - - int getProtoStep(); - - private: - - // - // Look in Control.cpp. - // - - void setLocalUnpackMethods(); - - // - // Manage the encoding according - // to the protocol version. - // - - int protoStep_; - - // - // Min and max values allowed for protocol step - // depending on protocol version compatibility - // - - static const int NX_MIN_PROTO_STEP; - static const int NX_MAX_PROTO_STEP; - - // - // Check the validity of protocol step - // - - bool isValidProtoStep(int step) - { - return ((step >= NX_MIN_PROTO_STEP) && (step <= NX_MAX_PROTO_STEP)); - } - -}; - -#endif /* Control_H */ diff --git a/nxcomp/CopyArea.cpp b/nxcomp/CopyArea.cpp deleted file mode 100644 index 3bff8d60e..000000000 --- a/nxcomp/CopyArea.cpp +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "CopyArea.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -int CopyAreaStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - CopyAreaMessage *copyArea = (CopyAreaMessage *) message; - - // - // Here is the fingerprint. - // - - copyArea -> src_drawable = GetULONG(buffer + 4, bigEndian); - copyArea -> dst_drawable = GetULONG(buffer + 8, bigEndian); - copyArea -> gcontext = GetULONG(buffer + 12, bigEndian); - - copyArea -> src_x = GetUINT(buffer + 16, bigEndian); - copyArea -> src_y = GetUINT(buffer + 18, bigEndian); - copyArea -> dst_x = GetUINT(buffer + 20, bigEndian); - copyArea -> dst_y = GetUINT(buffer + 22, bigEndian); - - copyArea -> width = GetUINT(buffer + 24, bigEndian); - copyArea -> height = GetUINT(buffer + 26, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int CopyAreaStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - CopyAreaMessage *copyArea = (CopyAreaMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(copyArea -> src_drawable, buffer + 4, bigEndian); - PutULONG(copyArea -> dst_drawable, buffer + 8, bigEndian); - PutULONG(copyArea -> gcontext, buffer + 12, bigEndian); - - PutUINT(copyArea -> src_x, buffer + 16, bigEndian); - PutUINT(copyArea -> src_y, buffer + 18, bigEndian); - PutUINT(copyArea -> dst_x, buffer + 20, bigEndian); - PutUINT(copyArea -> dst_y, buffer + 22, bigEndian); - - PutUINT(copyArea -> width, buffer + 24, bigEndian); - PutUINT(copyArea -> height, buffer + 26, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void CopyAreaStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - CopyAreaMessage *copyArea = (CopyAreaMessage *) message; - - *logofs << name() << ": Identity src_drawable " << copyArea -> src_drawable - << ", dst_drawable " << copyArea -> dst_drawable << ", gcontext " << copyArea -> gcontext - << ", src_x " << copyArea -> src_x << ", src_y " << copyArea -> src_y - << ", dst_x " << copyArea -> dst_x << ", dst_y " << copyArea -> dst_y - << ", width " << copyArea -> width << ", height " << copyArea -> height - << ", size " << copyArea -> size_ << ".\n"; - - #endif -} - -void CopyAreaStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 16, 12); -} - -void CopyAreaStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - CopyAreaMessage *copyArea = (CopyAreaMessage *) message; - CopyAreaMessage *cachedCopyArea = (CopyAreaMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << copyArea -> src_drawable - << " as " << "src_drawable" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(copyArea -> src_drawable, clientCache -> drawableCache); - - cachedCopyArea -> src_drawable = copyArea -> src_drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << copyArea -> dst_drawable - << " as " << "dst_drawable" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(copyArea -> dst_drawable, clientCache -> drawableCache); - - cachedCopyArea -> dst_drawable = copyArea -> dst_drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << copyArea -> gcontext - << " as " << "gcontext" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(copyArea -> gcontext, clientCache -> gcCache); - - cachedCopyArea -> gcontext = copyArea -> gcontext; -} - -void CopyAreaStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - CopyAreaMessage *copyArea = (CopyAreaMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - copyArea -> src_drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << copyArea -> src_drawable - << " as " << "src_drawable" << " field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - copyArea -> dst_drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << copyArea -> dst_drawable - << " as " << "dst_drawable" << " field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - copyArea -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << copyArea -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/CopyArea.h b/nxcomp/CopyArea.h deleted file mode 100644 index 6b2617875..000000000 --- a/nxcomp/CopyArea.h +++ /dev/null @@ -1,192 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef CopyArea_H -#define CopyArea_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define COPYAREA_ENABLE_CACHE 1 -#define COPYAREA_ENABLE_DATA 0 -#define COPYAREA_ENABLE_SPLIT 0 -#define COPYAREA_ENABLE_COMPRESS 0 - -#define COPYAREA_DATA_LIMIT 0 -#define COPYAREA_DATA_OFFSET 28 - -#define COPYAREA_CACHE_SLOTS 3000 -#define COPYAREA_CACHE_THRESHOLD 5 -#define COPYAREA_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class CopyAreaMessage : public Message -{ - friend class CopyAreaStore; - - public: - - CopyAreaMessage() - { - } - - ~CopyAreaMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int src_drawable; - unsigned int dst_drawable; - unsigned int gcontext; - unsigned short src_x; - unsigned short src_y; - unsigned short dst_x; - unsigned short dst_y; - unsigned short width; - unsigned short height; -}; - -class CopyAreaStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - CopyAreaStore() : MessageStore() - { - enableCache = COPYAREA_ENABLE_CACHE; - enableData = COPYAREA_ENABLE_DATA; - enableSplit = COPYAREA_ENABLE_SPLIT; - enableCompress = COPYAREA_ENABLE_COMPRESS; - - dataLimit = COPYAREA_DATA_LIMIT; - dataOffset = COPYAREA_DATA_OFFSET; - - cacheSlots = COPYAREA_CACHE_SLOTS; - cacheThreshold = COPYAREA_CACHE_THRESHOLD; - cacheLowerThreshold = COPYAREA_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~CopyAreaStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "CopyArea"; - } - - virtual unsigned char opcode() const - { - return X_CopyArea; - } - - virtual unsigned int storage() const - { - return sizeof(CopyAreaMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new CopyAreaMessage(); - } - - virtual Message *create(const Message &message) const - { - return new CopyAreaMessage((const CopyAreaMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (CopyAreaMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* CopyArea_H */ diff --git a/nxcomp/CreateGC.cpp b/nxcomp/CreateGC.cpp deleted file mode 100644 index 30a2f674e..000000000 --- a/nxcomp/CreateGC.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "CreateGC.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int CreateGCStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - CreateGCMessage *createGC = (CreateGCMessage *) message; - - // - // Here is the fingerprint. - // - - createGC -> gcontext = GetULONG(buffer + 4, bigEndian); - createGC -> drawable = GetULONG(buffer + 8, bigEndian); - createGC -> value_mask = GetULONG(buffer + 12, bigEndian); - - // - // Clear the unused bytes carried in the - // payload to increase the effectiveness - // of the caching algorithm. - // - - if ((int) size > dataOffset) - { - #ifdef DEBUG - *logofs << name() << ": Removing unused bytes from the " - << "data payload.\n" << logofs_flush; - #endif - - createGC -> value_mask &= (1 << 23) - 1; - - unsigned int mask = 0x1; - unsigned char *source = (unsigned char *) buffer + CREATEGC_DATA_OFFSET; - unsigned long value = 0; - - for (unsigned int i = 0; i < 23; i++) - { - if (createGC -> value_mask & mask) - { - value = GetULONG(source, bigEndian); - - value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i])); - - PutULONG(value, source, bigEndian); - - source += 4; - } - - mask <<= 1; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int CreateGCStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - CreateGCMessage *createGC = (CreateGCMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(createGC -> gcontext, buffer + 4, bigEndian); - PutULONG(createGC -> drawable, buffer + 8, bigEndian); - PutULONG(createGC -> value_mask, buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void CreateGCStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - CreateGCMessage *createGC = (CreateGCMessage *) message; - - *logofs << name() << ": Identity gcontext " << createGC -> gcontext << ", drawable " - << createGC -> drawable << ", value_mask " << createGC -> value_mask - << ", size " << createGC -> size_ << ".\n" << logofs_flush; - #endif -} - -void CreateGCStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // This didn't include the drawable - // in previous versions. - // - - md5_append(md5_state_, buffer + 8, 8); -} - -void CreateGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - CreateGCMessage *createGC = (CreateGCMessage *) message; - CreateGCMessage *cachedCreateGC = (CreateGCMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - // Since ProtoStep7 (#issue 108) - #ifdef TEST - *logofs << name() << ": Encoding value " << createGC -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeNewXidValue(createGC -> gcontext, clientCache -> lastId, - clientCache -> lastIdCache, clientCache -> gcCache, - clientCache -> freeGCCache); - - cachedCreateGC -> gcontext = createGC -> gcontext; -} - -void CreateGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - CreateGCMessage *createGC = (CreateGCMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeNewXidValue(value, clientCache -> lastId, - clientCache -> lastIdCache, clientCache -> gcCache, - clientCache -> freeGCCache); - - createGC -> gcontext = value; - - #ifdef TEST - *logofs << name() << ": Decoded value " << createGC -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/CreateGC.h b/nxcomp/CreateGC.h deleted file mode 100644 index 03e27d685..000000000 --- a/nxcomp/CreateGC.h +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef CreateGC_H -#define CreateGC_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define CREATEGC_ENABLE_CACHE 1 -#define CREATEGC_ENABLE_DATA 0 -#define CREATEGC_ENABLE_SPLIT 0 -#define CREATEGC_ENABLE_COMPRESS 0 - -#define CREATEGC_DATA_LIMIT 144 -#define CREATEGC_DATA_OFFSET 16 - -#define CREATEGC_CACHE_SLOTS 2000 -#define CREATEGC_CACHE_THRESHOLD 2 -#define CREATEGC_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class CreateGCMessage : public Message -{ - friend class CreateGCStore; - - public: - - CreateGCMessage() - { - } - - ~CreateGCMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int gcontext; - unsigned int drawable; - unsigned int value_mask; -}; - -class CreateGCStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - CreateGCStore() : MessageStore() - { - enableCache = CREATEGC_ENABLE_CACHE; - enableData = CREATEGC_ENABLE_DATA; - enableSplit = CREATEGC_ENABLE_SPLIT; - enableCompress = CREATEGC_ENABLE_COMPRESS; - - dataLimit = CREATEGC_DATA_LIMIT; - dataOffset = CREATEGC_DATA_OFFSET; - - cacheSlots = CREATEGC_CACHE_SLOTS; - cacheThreshold = CREATEGC_CACHE_THRESHOLD; - cacheLowerThreshold = CREATEGC_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~CreateGCStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "CreateGC"; - } - - virtual unsigned char opcode() const - { - return X_CreateGC; - } - - virtual unsigned int storage() const - { - return sizeof(CreateGCMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new CreateGCMessage(); - } - - virtual Message *create(const Message &message) const - { - return new CreateGCMessage((const CreateGCMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (CreateGCMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* CreateGC_H */ diff --git a/nxcomp/CreatePixmap.cpp b/nxcomp/CreatePixmap.cpp deleted file mode 100644 index 93ca38fbb..000000000 --- a/nxcomp/CreatePixmap.cpp +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "CreatePixmap.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Constructors and destructors. -// - -CreatePixmapStore::CreatePixmapStore() - - : MessageStore() -{ - enableCache = CREATEPIXMAP_ENABLE_CACHE; - enableData = CREATEPIXMAP_ENABLE_DATA; - enableSplit = CREATEPIXMAP_ENABLE_SPLIT; - enableCompress = CREATEPIXMAP_ENABLE_COMPRESS; - - dataLimit = CREATEPIXMAP_DATA_LIMIT; - dataOffset = CREATEPIXMAP_DATA_OFFSET; - - cacheSlots = CREATEPIXMAP_CACHE_SLOTS; - cacheThreshold = CREATEPIXMAP_CACHE_THRESHOLD; - cacheLowerThreshold = CREATEPIXMAP_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -CreatePixmapStore::~CreatePixmapStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int CreatePixmapStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> depthCache); - - encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> drawableCache, - clientCache -> freeDrawableCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> windowCache); - - encodeBuffer.encodeCachedValue(GetUINT(buffer + 12, bigEndian), 16, - clientCache -> createPixmapXCache, 8); - - encodeBuffer.encodeCachedValue(GetUINT(buffer + 14, bigEndian), 16, - clientCache -> createPixmapYCache, 8); - - #ifdef TEST - *logofs << name() << ": Encoded message. Size is " - << size << ".\n" << logofs_flush; - #endif - - return 1; -} - -int CreatePixmapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned char cValue; - unsigned int value; - - size = 16; - - buffer = writeBuffer -> addMessage(size); - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - - *(buffer + 1) = cValue; - - decodeBuffer.decodeNewXidValue(value, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> drawableCache, - clientCache -> freeDrawableCache); - - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeXidValue(value, - clientCache -> windowCache); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> createPixmapXCache, 8); - - PutUINT(value, buffer + 12, bigEndian); - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> createPixmapYCache, 8); - - PutUINT(value, buffer + 14, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Size is " - << size << ".\n" << logofs_flush; - #endif - - return 1; -} - -int CreatePixmapStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; - - createPixmap -> depth = *(buffer + 1); - - createPixmap -> id = GetULONG(buffer + 4, bigEndian); - createPixmap -> drawable = GetULONG(buffer + 8, bigEndian); - - createPixmap -> width = GetUINT(buffer + 12, bigEndian); - createPixmap -> height = GetUINT(buffer + 14, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Size is " - << createPixmap -> size_ << " identity is " - << createPixmap -> i_size_ << ".\n" - << logofs_flush; - #endif - - return 1; -} - -int CreatePixmapStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; - - *(buffer + 1) = createPixmap -> depth; - - PutULONG(createPixmap -> id, buffer + 4, bigEndian); - PutULONG(createPixmap -> drawable, buffer + 8, bigEndian); - - PutUINT(createPixmap -> width, buffer + 12, bigEndian); - PutUINT(createPixmap -> height, buffer + 14, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Size is " - << createPixmap -> size_ << " identity is " - << createPixmap -> i_size_ << ".\n" - << logofs_flush; - #endif - - return 1; -} - -void CreatePixmapStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - #ifdef WARNING - *logofs << name() << ": WARNING! Dump of identity not implemented.\n" - << logofs_flush; - #endif - - #endif -} - -void CreatePixmapStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 8, 8); -} - -void CreatePixmapStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; - CreatePixmapMessage *cachedCreatePixmap = (CreatePixmapMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeNewXidValue(createPixmap -> id, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> drawableCache, - clientCache -> freeDrawableCache); - - cachedCreatePixmap -> id = createPixmap -> id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Size is " - << createPixmap -> size_ << " identity is " - << createPixmap -> i_size_ << ".\n" - << logofs_flush; - #endif -} - -void CreatePixmapStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeNewXidValue(createPixmap -> id, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> drawableCache, - clientCache -> freeDrawableCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Size is " - << createPixmap -> size_ << " identity is " - << createPixmap -> i_size_ << ".\n" - << logofs_flush; - #endif -} diff --git a/nxcomp/CreatePixmap.h b/nxcomp/CreatePixmap.h deleted file mode 100644 index 0a3212dd9..000000000 --- a/nxcomp/CreatePixmap.h +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef CreatePixmap_H -#define CreatePixmap_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define CREATEPIXMAP_ENABLE_CACHE 1 -#define CREATEPIXMAP_ENABLE_DATA 0 -#define CREATEPIXMAP_ENABLE_SPLIT 0 -#define CREATEPIXMAP_ENABLE_COMPRESS 0 - -#define CREATEPIXMAP_DATA_LIMIT 16 -#define CREATEPIXMAP_DATA_OFFSET 16 - -#define CREATEPIXMAP_CACHE_SLOTS 1000 -#define CREATEPIXMAP_CACHE_THRESHOLD 2 -#define CREATEPIXMAP_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class CreatePixmapMessage : public Message -{ - friend class CreatePixmapStore; - - public: - - CreatePixmapMessage() - { - } - - ~CreatePixmapMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char depth; - - unsigned int id; - unsigned int drawable; - - unsigned short width; - unsigned short height; -}; - -class CreatePixmapStore : public MessageStore -{ - public: - - CreatePixmapStore(); - - virtual ~CreatePixmapStore(); - - virtual const char *name() const - { - return "CreatePixmap"; - } - - virtual unsigned char opcode() const - { - return X_CreatePixmap; - } - - virtual unsigned int storage() const - { - return sizeof(CreatePixmapMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new CreatePixmapMessage(); - } - - virtual Message *create(const Message &message) const - { - return new CreatePixmapMessage((const CreatePixmapMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (CreatePixmapMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* CreatePixmap_H */ diff --git a/nxcomp/DecodeBuffer.cpp b/nxcomp/DecodeBuffer.cpp deleted file mode 100644 index 456dee249..000000000 --- a/nxcomp/DecodeBuffer.cpp +++ /dev/null @@ -1,635 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Control.h" - -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -DecodeBuffer::DecodeBuffer(const unsigned char *data, unsigned int length) - - : buffer_(data), end_(buffer_ + length), nextSrc_(buffer_), srcMask_(0x80) -{ - // Since ProtoStep7 (#issue 108) - end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE; -} - -int DecodeBuffer::decodeValue(unsigned int &value, unsigned int numBits, - unsigned int blockSize, int endOkay) -{ - #ifdef DUMP - *logofs << "DecodeBuffer: Decoding " << numBits - << " bits value with block " << blockSize - << " and " << (nextSrc_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - unsigned int result = 0; - unsigned int destMask = 0x1; - unsigned int bitsRead = 0; - - if (blockSize == 0) - blockSize = numBits; - - unsigned char nextSrcChar = *nextSrc_; - unsigned int numBlocks = 1; - - do - { - if (numBlocks == 4) - { - blockSize = numBits; - } - - unsigned int bitsToRead = (blockSize > numBits - bitsRead ? - numBits - bitsRead : blockSize); - unsigned int count = 0; - unsigned char lastBit; - - do - { - if (nextSrc_ >= end_) - { - if (!endOkay) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [A] " - << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) - << " end_ = " << (end_ - buffer_) << ".\n" - << logofs_flush; - #endif - - // - // Label "context" is just used to identify - // the routine which detected the problem in - // present source file. - // - - cerr << "Error" << ": Failure decoding data in context [A].\n"; - - HandleAbort(); - } - - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [B] " - << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) - << " end_ = " << (end_ - buffer_) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [B].\n"; - - HandleAbort(); - } - - lastBit = (nextSrcChar & srcMask_); - - if (lastBit) - result |= destMask; - - srcMask_ >>= 1; - - if (srcMask_ == 0) - { - srcMask_ = 0x80; - nextSrc_++; - nextSrcChar = *nextSrc_; - } - - destMask <<= 1; - } - while (bitsToRead > ++count); - - bitsRead += bitsToRead; - - if (bitsRead < numBits) - { - if (nextSrc_ >= end_) - { - if (!endOkay) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [C] " - << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) - << " end_ = " << (end_ - buffer_) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [C].\n"; - - HandleAbort(); - } - - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [D] " - << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) - << " end_ = " << (end_ - buffer_) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [D].\n"; - - HandleAbort(); - } - - unsigned char moreData = (nextSrcChar & srcMask_); - - srcMask_ >>= 1; - - if (srcMask_ == 0) - { - srcMask_ = 0x80; - nextSrc_++; - nextSrcChar = *nextSrc_; - } - - if (!moreData) - { - if (lastBit) - { - do - { - result |= destMask; - destMask <<= 1; - } - while (numBits > ++bitsRead); - } - else - bitsRead = numBits; - } - } - - blockSize >>= 1; - - if (blockSize < 2) - blockSize = 2; - - numBlocks++; - } - while (numBits > bitsRead); - - value = result; - - return 1; -} - -int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits, - IntCache &cache, unsigned int blockSize, - int endOkay) -{ - #ifdef DUMP - *logofs << "DecodeBuffer: Decoding " << numBits - << " bits cached value with block " << blockSize - << " and " << (nextSrc_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - if (nextSrc_ >= end_) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [E] " - << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) - << " end_ = " << (end_ - buffer_) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [E].\n"; - - HandleAbort(); - } - - unsigned int index = 0; - unsigned char nextSrcChar = *nextSrc_; - - while (!(nextSrcChar & srcMask_)) - { - index++; - srcMask_ >>= 1; - if (srcMask_ == 0) - { - srcMask_ = 0x80; - nextSrc_++; - if (nextSrc_ >= end_) - { - if (!endOkay) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [F] " - << "in decodeCachedValue() nextSrc_ = " - << (nextSrc_ - buffer_) << " end_ = " - << (end_ - buffer_) << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [F].\n"; - - HandleAbort(); - } - - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [G] " - << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) - << " end_ = " << (end_ - buffer_) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [G].\n"; - - HandleAbort(); - } - - nextSrcChar = *nextSrc_; - } - } - - srcMask_ >>= 1; - - if (srcMask_ == 0) - { - srcMask_ = 0x80; - nextSrc_++; - } - - if (index == 2) - { - // Since ProtoStep8 (#issue 108) - blockSize = cache.getBlockSize(blockSize); - - if (decodeValue(value, numBits, blockSize, endOkay)) - { - cache.insert(value, IntMask[numBits]); - - return 1; - } - - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] " - << "in decodeCacheValue() with no value found.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [H].\n"; - - HandleAbort(); - } - else - { - if (index > 2) - { - index--; - } - - if (index > cache.getSize()) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [I] " - << "in decodeCachedValue() index = " << index - << " cache size = " << cache.getSize() << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [I].\n"; - - HandleAbort(); - } - - value = cache.get(index); - - return 1; - } -} - -int DecodeBuffer::decodeCachedValue(unsigned char &value, unsigned int numBits, - CharCache &cache, unsigned int blockSize, - int endOkay) -{ - #ifdef DUMP - *logofs << "DecodeBuffer: Decoding " << numBits - << " bits char cached value with block " << blockSize - << " and " << nextSrc_ - buffer_ << " bytes read out of " - << end_ - buffer_ << ".\n" << logofs_flush; - #endif - - if (nextSrc_ >= end_) - { - #ifdef TEST - *logofs << "DecodeBuffer: End of buffer reached in context [J] with " - << nextSrc_ - buffer_ << " bytes read out of " - << end_ - buffer_ << ".\n" << logofs_flush; - #endif - - return 0; - } - - unsigned int index = 0; - unsigned char nextSrcChar = *nextSrc_; - - while (!(nextSrcChar & srcMask_)) - { - index++; - srcMask_ >>= 1; - - if (srcMask_ == 0) - { - srcMask_ = 0x80; - nextSrc_++; - - if (nextSrc_ >= end_) - { - if (!endOkay) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [K] " - << "in decodeCachedValue() nextSrc_ " - << (nextSrc_ - buffer_) << " end_ " << (end_ - buffer_) - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [K].\n"; - - HandleAbort(); - } - - #ifdef TEST - *logofs << "DecodeBuffer: End of buffer reached in context [L] with " - << nextSrc_ - buffer_ << " bytes read out of " - << end_ - buffer_ << ".\n" << logofs_flush; - #endif - - return 0; - } - - nextSrcChar = *nextSrc_; - } - } - - srcMask_ >>= 1; - - if (srcMask_ == 0) - { - srcMask_ = 0x80; - nextSrc_++; - } - - if (index == 2) - { - unsigned int temp; - - if (decodeValue(temp, numBits, blockSize, endOkay)) - { - value = (unsigned char) temp; - - cache.insert(value); - } - else - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [M] " - << "in decodeValue() with index = 2.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [M].\n"; - - HandleAbort(); - } - } - else - { - if (index > 2) - { - index--; - } - - if (index > cache.getSize()) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [N] " - << "in decodeCachedValue() " << "index = " << index - << " cache size = " << cache.getSize() << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [N].\n"; - - HandleAbort(); - } - - value = cache.get(index); - } - - return 1; -} - -// -// Simply returns a pointer to the correct spot in -// the internal buffer. If the caller needs this -// data to last beyond the lifetime of the internal -// buffer, it must copy the data in its own memory. -// - -const unsigned char *DecodeBuffer::decodeMemory(unsigned int numBytes) -{ - #ifdef DUMP - *logofs << "DecodeBuffer: Decoding " << numBytes - << " bytes of memory with " << (nextSrc_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - const unsigned char *result; - - // - // Force ourselves to a byte boundary. - // Is up to application to ensure data - // is word alligned when needed. - // - - if (srcMask_ != 0x80) - { - srcMask_ = 0x80; - nextSrc_++; - } - - result = nextSrc_; - - if (numBytes > DECODE_BUFFER_OVERFLOW_SIZE) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Can't decode a buffer of " - << numBytes << " bytes with limit set to " - << DECODE_BUFFER_OVERFLOW_SIZE << ".\n" - << logofs_flush; - - *logofs << "DecodeBuffer: PANIC! Assuming failure decoding " - << "data in context [O].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Should never decode buffer of size " - << "greater than " << DECODE_BUFFER_OVERFLOW_SIZE - << " bytes.\n"; - - cerr << "Error" << ": Assuming failure decoding data in " - << "context [O].\n"; - - HandleAbort(); - } - else if (end_ - nextSrc_ < (int) numBytes) - { - #ifdef PANIC - *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [P] " - << "in decodeMemory() " << "with length " << numBytes - << " and " << (end_ - nextSrc_) - << " bytes remaining.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failure decoding data in context [P].\n"; - - HandleAbort(); - } - - nextSrc_ += numBytes; - - return result; -} - -void DecodeBuffer::decodeActionValue(unsigned char &value, unsigned short &position, - ActionCache &cache) -{ - unsigned int t; - - decodeCachedValue(t, 15, *(cache.base_[cache.slot_])); - - cache.last_ += t; - cache.last_ &= 0x7fff; - - value = cache.last_ >> 13; - - position = cache.last_ & 0x1fff; - - #ifdef DEBUG - *logofs << "DecodeBuffer: Decoded value " - << (unsigned) value << " and position " - << position << " with base " << cache.slot_ - << ".\n" << logofs_flush; - #endif - - #ifdef DEBUG - *logofs << "DecodeBuffer: Action block prediction is " - << (*(cache.base_[cache.slot_])).getBlockSize(15) - << ".\n" << logofs_flush; - #endif - - cache.slot_ = (cache.last_ & 0xff); -} - -void DecodeBuffer::decodeNewXidValue(unsigned int &value, unsigned int &lastId, - IntCache &lastIdCache, IntCache &cache, - FreeCache &freeCache) -{ - decodeCachedValue(value, 29, lastIdCache); - - lastId += (value + 1); - lastId &= 0x1fffffff; - - value = lastId; - - cache.push(value, 0x1fffffff); - - freeCache.push(value, 0x1fffffff); -} - -void DecodeBuffer::decodeNewXidValue(unsigned int &value, unsigned int &lastId, - IntCache &lastIdCache, XidCache &cache, - FreeCache &freeCache) -{ - decodeCachedValue(value, 29, lastIdCache); - - #ifdef DEBUG - *logofs << "DecodeBuffer: Decoded new Xid difference " - << value << ".\n" << logofs_flush; - #endif - - lastId += (value + 1); - lastId &= 0x1fffffff; - - value = lastId; - - unsigned int t = (value - cache.last_); - - cache.last_ = value; - - #ifdef DEBUG - *logofs << "DecodeBuffer: Decoded new Xid " << value - << " with base " << cache.slot_ << ".\n" - << logofs_flush; - #endif - - cache.slot_ = (value & 0xff); - - cache.base_[cache.slot_] -> push(t, 0x1fffffff); - - freeCache.push(value, 0x1fffffff); -} - -void DecodeBuffer::decodeXidValue(unsigned int &value, XidCache &cache) -{ - unsigned int t; - - decodeCachedValue(t, 29, *(cache.base_[cache.slot_])); - - cache.last_ += t; - cache.last_ &= 0x1fffffff; - - value = cache.last_; - - #ifdef DEBUG - *logofs << "DecodeBuffer: Decoded Xid " << value - << " with base " << cache.slot_ << ".\n" - << logofs_flush; - #endif - - cache.slot_ = (value & 0xff); - - #ifdef DEBUG - *logofs << "DecodeBuffer: Xid block prediction is " - << (*(cache.base_[cache.slot_])).getBlockSize(29) - << ".\n" << logofs_flush; - #endif -} - -void DecodeBuffer::decodeFreeXidValue(unsigned int &value, FreeCache &cache) -{ - decodeCachedValue(value, 29, cache); -} - diff --git a/nxcomp/DecodeBuffer.h b/nxcomp/DecodeBuffer.h deleted file mode 100644 index f5f84c54f..000000000 --- a/nxcomp/DecodeBuffer.h +++ /dev/null @@ -1,138 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef DecodeBuffer_H -#define DecodeBuffer_H - -#include - -#include "IntCache.h" -#include "CharCache.h" -#include "XidCache.h" -#include "FreeCache.h" -#include "OpcodeCache.h" -#include "ActionCache.h" - -#define DECODE_BUFFER_OVERFLOW_SIZE 4194304 - -#define DECODE_BUFFER_POSTFIX_SIZE 1 - -class DecodeBuffer -{ - public: - - DecodeBuffer(const unsigned char *data, unsigned int length); - - ~DecodeBuffer() - { - } - - int decodeValue(unsigned int &value, unsigned int numBits, - unsigned int blockSize = 0, int endOkay = 0); - - int decodeCachedValue(unsigned int &value, unsigned int numBits, - IntCache &cache, unsigned int blockSize = 0, - int endOkay = 0); - - int decodeCachedValue(unsigned char &value, unsigned int numBits, - CharCache &cache, unsigned int blockSize = 0, - int endOkay = 0); - - void decodeDiffCachedValue(unsigned int &value, unsigned int &previous, - unsigned int numBits, IntCache &cache, - unsigned int blockSize = 0) - { - decodeCachedValue(value, numBits, cache, blockSize); - - previous += (value + 1); - previous &= (0xffffffff >> (32 - numBits)); - - value = previous; - } - - void decodeBoolValue(unsigned int &value) - { - decodeValue(value, 1); - } - - int decodeOpcodeValue(unsigned char &value, OpcodeCache &cache, int endOkay = 0) - { - int result = decodeCachedValue(value, 8, cache.base_[cache.slot_], 8, endOkay); - - if (result == 1) - { - cache.slot_ = value; - } - - return result; - } - - void decodeActionValue(unsigned char &value, unsigned short &position, - ActionCache &cache); - - void decodeNewXidValue(unsigned int &value, unsigned int &lastId, - IntCache &lastIdCache, IntCache &cache, - FreeCache &freeCache); - - void decodeNewXidValue(unsigned int &value, unsigned int &lastId, - IntCache &lastIdCache, XidCache &cache, - FreeCache &freeCache); - - void decodeXidValue(unsigned int &value, XidCache &cache); - - void decodeFreeXidValue(unsigned int &value, FreeCache &cache); - - void decodeTextData(unsigned char *buffer, unsigned int numBytes) - { - decodeMemory(buffer, numBytes); - } - - void decodeIntData(unsigned char *buffer, unsigned int numBytes) - { - decodeMemory(buffer, numBytes); - } - - void decodeLongData(unsigned char *buffer, unsigned int numBytes) - { - decodeMemory(buffer, numBytes); - } - - const unsigned char *decodeMemory(unsigned int numBytes); - - void decodeMemory(unsigned char *buffer, unsigned int numBytes) - { - memcpy(buffer, decodeMemory(numBytes), numBytes); - } - - private: - - const unsigned char *buffer_; - const unsigned char *end_; - const unsigned char *nextSrc_; - - unsigned char srcMask_; -}; - -#endif /* DecodeBuffer_H */ diff --git a/nxcomp/EncodeBuffer.cpp b/nxcomp/EncodeBuffer.cpp deleted file mode 100644 index a259aacb2..000000000 --- a/nxcomp/EncodeBuffer.cpp +++ /dev/null @@ -1,619 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Control.h" - -#include "EncodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -#define ADVANCE_DEST \ -\ -if (destShift_ == 0) \ -{ \ - destShift_ = 7; nextDest_++; *nextDest_ = 0; \ -} \ -else \ -{ \ - destShift_--; \ -} - -EncodeBuffer::EncodeBuffer() -{ - size_ = ENCODE_BUFFER_DEFAULT_SIZE; - - buffer_ = new unsigned char[size_ + ENCODE_BUFFER_PREFIX_SIZE + - ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; - end_ = buffer_ + size_; - - nextDest_ = buffer_; - *nextDest_ = 0; - destShift_ = 7; - - lastBits_ = 0; - - initialSize_ = ENCODE_BUFFER_DEFAULT_SIZE; - thresholdSize_ = ENCODE_BUFFER_DEFAULT_SIZE << 1; - maximumSize_ = ENCODE_BUFFER_DEFAULT_SIZE << 4; -} - -EncodeBuffer::~EncodeBuffer() -{ - delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); -} - -void EncodeBuffer::setSize(unsigned int initialSize, unsigned int thresholdSize, - unsigned int maximumSize) -{ - initialSize_ = initialSize; - thresholdSize_ = thresholdSize; - maximumSize_ = maximumSize; - - #ifdef TEST - *logofs << "EncodeBuffer: Set buffer sizes to " - << initialSize_ << "/" << thresholdSize_ - << "/" << maximumSize_ << ".\n" - << logofs_flush; - #endif -} - -void EncodeBuffer::fullReset() -{ - if (size_ > initialSize_) - { - delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); - - size_ = initialSize_; - - buffer_ = new unsigned char[size_ + ENCODE_BUFFER_PREFIX_SIZE + - ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; - } - - end_ = buffer_ + size_; - - nextDest_ = buffer_; - *nextDest_ = 0; - destShift_ = 7; - - lastBits_ = 0; -} - -void EncodeBuffer::encodeValue(unsigned int value, unsigned int numBits, - unsigned int blockSize) -{ - #ifdef DUMP - *logofs << "EncodeBuffer: Encoding " << numBits - << " bits value with block " << blockSize - << " and " << (nextDest_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - value &= IntMask[numBits]; - - unsigned int srcMask = 0x1; - unsigned int bitsWritten = 0; - - if (blockSize == 0) - blockSize = numBits; - - if (end_ - nextDest_ < 8) - { - growBuffer(); - } - - unsigned int numBlocks = 1; - - do - { - if (numBlocks == 4) - blockSize = numBits; - - unsigned int bitsToWrite = (blockSize > numBits - bitsWritten ? - numBits - bitsWritten : blockSize); - unsigned int count = 0; - unsigned int lastBit; - - do - { - lastBit = (value & srcMask); - if (lastBit) - *nextDest_ |= (1 << destShift_); - ADVANCE_DEST; - srcMask <<= 1; - } - while (bitsToWrite > ++count); - - bitsWritten += bitsToWrite; - - if (bitsWritten < numBits) - { - unsigned int tmpMask = srcMask; - unsigned int i = bitsWritten; - - if (lastBit) - { - do - { - unsigned int nextBit = (value & tmpMask); - - if (!nextBit) - break; - - tmpMask <<= 1; - } - while (numBits > ++i); - } - else - { - do - { - unsigned int nextBit = (value & tmpMask); - - if (nextBit) - break; - - tmpMask <<= 1; - } - while (numBits > ++i); - } - - if (i < numBits) - *nextDest_ |= (1 << destShift_); - else - bitsWritten = numBits; - - ADVANCE_DEST; - } - blockSize >>= 1; - - if (blockSize < 2) - blockSize = 2; - - numBlocks++; - } - while (numBits > bitsWritten); -} - -void EncodeBuffer::encodeCachedValue(unsigned int value, unsigned int numBits, - IntCache &cache, unsigned int blockSize) -{ - #ifdef DUMP - *logofs << "EncodeBuffer: Encoding " << numBits - << " bits cached value with block " << blockSize - << " and " << (nextDest_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - value &= IntMask[numBits]; - - if (end_ - nextDest_ < 8) - { - growBuffer(); - } - - blockSize = cache.getBlockSize(blockSize); - - unsigned int index; - unsigned int sameDiff; - - #ifdef DUMP - - diffBits(); - - #endif - - if (cache.lookup(value, index, IntMask[numBits], sameDiff)) - { - if (index > 1) - index++; - - while (destShift_ < index) - { - index -= destShift_; - index--; - destShift_ = 7; - nextDest_++; - *nextDest_ = 0; - } - - destShift_ -= index; - *nextDest_ |= (1 << destShift_); - ADVANCE_DEST; - - #ifdef DUMP - *logofs << "EncodeBuffer: Encoded cached int using " - << diffBits() << " bits out of " << numBits - << ".\n" << logofs_flush; - #endif - } - else - { - ADVANCE_DEST; - ADVANCE_DEST; - *nextDest_ |= (1 << destShift_); - ADVANCE_DEST; - - // - // The attempt is very seldom successful. - // Avoid to encode the additional bool. - // - - // Since ProtoStep8 (#issue 108) - #ifdef DUMP - *logofs << "EncodeBuffer: Encoded missed int using " - << diffBits() << " bits out of " << numBits - << ".\n" << logofs_flush; - #endif - - encodeValue(value, numBits, blockSize); - } -} - -void EncodeBuffer::encodeCachedValue(unsigned char value, unsigned int numBits, - CharCache &cache, unsigned int blockSize) -{ - #ifdef DUMP - *logofs << "EncodeBuffer: Encoding " << numBits - << " bits char cached value with block " << blockSize - << " and " << (nextDest_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - value &= IntMask[numBits]; - - if (end_ - nextDest_ < 8) - { - growBuffer(); - } - - unsigned int index; - - #ifdef DUMP - - diffBits(); - - #endif - - if (cache.lookup(value, index)) - { - if (index > 1) - index++; - - while (destShift_ < index) - { - index -= destShift_; - index--; - destShift_ = 7; - nextDest_++; - *nextDest_ = 0; - } - - destShift_ -= index; - *nextDest_ |= (1 << destShift_); - ADVANCE_DEST; - - #ifdef DUMP - *logofs << "EncodeBuffer: Encoded cached char using " - << diffBits() << " bits out of " << numBits - << ".\n" << logofs_flush; - #endif - } - else - { - ADVANCE_DEST; - ADVANCE_DEST; - *nextDest_ |= (1 << destShift_); - ADVANCE_DEST; - - encodeValue(value, numBits, blockSize); - - #ifdef DUMP - *logofs << "EncodeBuffer: Encoded missed char using " - << diffBits() << " bits out of " << numBits - << ".\n" << logofs_flush; - #endif - } -} - -void EncodeBuffer::encodeMemory(const unsigned char *buffer, unsigned int numBytes) -{ - #ifdef DUMP - *logofs << "EncodeBuffer: Encoding " << numBytes - << " bytes of memory with " << (nextDest_ - buffer_) - << " bytes in buffer.\n" << logofs_flush; - #endif - - if (numBytes > ENCODE_BUFFER_OVERFLOW_SIZE) - { - #ifdef PANIC - *logofs << "EncodeBuffer: PANIC! Should never encode buffer " - << "of size greater than " << ENCODE_BUFFER_OVERFLOW_SIZE - << " bytes.\n" << logofs_flush; - - *logofs << "EncodeBuffer: PANIC! Assuming failure encoding data " - << "in context [A].\n" << logofs_flush; - #endif - - // - // Label "context" is just used to identify - // the routine which detected the problem in - // present source file. - // - - cerr << "Error" << ": Should never encode buffer of size " - << "greater than " << ENCODE_BUFFER_OVERFLOW_SIZE - << " bytes.\n"; - - cerr << "Error" << ": Assuming failure encoding data " - << "in context [A].\n" ; - - HandleAbort(); - } - - alignBuffer(); - - if (end_ - nextDest_ < (int) numBytes) - { - growBuffer(numBytes); - } - - memcpy(nextDest_, buffer, numBytes); - - nextDest_ += numBytes; - - if (nextDest_ == end_) - { - growBuffer(); - } - else if (nextDest_ > end_) - { - #ifdef PANIC - *logofs << "EncodeBuffer: PANIC! Assertion failed. Error [B] " - << "in encodeMemory() nextDest_ " << (nextDest_ - buffer) - << " end_ " << (end_ - buffer) << ".\n" - << logofs_flush; - #endif - - // - // Label "context" is just used to identify - // the routine which detected the problem in - // present source file. - // - - cerr << "Error" << ": Failure encoding raw data " - << "in context [B].\n" ; - - HandleAbort(); - } - - *nextDest_ = 0; -} - -unsigned int EncodeBuffer::getLength() const -{ - unsigned int length = nextDest_ - buffer_; - - if (destShift_ != 7) - { - length++; - } - - // Since ProtoStep7 (#issue 108) - if (length > 0) - { - return length + ENCODE_BUFFER_POSTFIX_SIZE; - } - - return length; -} - -unsigned int EncodeBuffer::diffBits() -{ - unsigned int bits = ((nextDest_ - buffer_) << 3); - - bits += (7 - destShift_); - - unsigned int diff = bits - lastBits_; - - lastBits_ = bits; - - return diff; -} - -void EncodeBuffer::growBuffer(unsigned int numBytes) -{ - if (numBytes == 0) - { - numBytes = initialSize_; - } - - unsigned int bytesInBuffer = nextDest_ - buffer_; - - unsigned int newSize = thresholdSize_; - - while (newSize < bytesInBuffer + numBytes) - { - newSize <<= 1; - - if (newSize > maximumSize_) - { - newSize = bytesInBuffer + numBytes + initialSize_; - } - } - - unsigned char *newBuffer; - - newBuffer = new unsigned char[newSize + ENCODE_BUFFER_PREFIX_SIZE + - ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; - - if (newBuffer == NULL) - { - #ifdef PANIC - *logofs << "EncodeBuffer: PANIC! Error in context [C] " - << "growing buffer to accommodate " << numBytes - << " bytes .\n" << logofs_flush; - #endif - - cerr << "Error" << ": Error in context [C] " - << "growing encode buffer to accommodate " - << numBytes << " bytes.\n"; - - HandleAbort(); - } - - #ifdef TEST - if (newSize >= maximumSize_) - { - *logofs << "EncodeBuffer: WARNING! Buffer grown to reach " - << "size of " << newSize << " bytes.\n" - << logofs_flush; - } - #endif - - // - // Prefix should not contain any valid data. - // It is proxy that will fill it with control - // messages and data length at the time a new - // frame is written to socket. - // - - memcpy(newBuffer, buffer_, bytesInBuffer + 1); - - newBuffer[bytesInBuffer + 1] = 0; - - delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); - - buffer_ = newBuffer; - size_ = newSize; - end_ = buffer_ + size_; - - nextDest_ = buffer_ + bytesInBuffer; -} - -void EncodeBuffer::alignBuffer() -{ - if (destShift_ != 7) - { - destShift_ = 7; - nextDest_++; - - if (nextDest_ >= end_) - { - growBuffer(); - } - - *nextDest_ = 0; - } -} - -void EncodeBuffer::encodeActionValue(unsigned char value, unsigned short position, - ActionCache &cache) -{ - unsigned int v = (value << 13) | position; - - unsigned int t = (v - cache.last_); - - encodeCachedValue(t, 15, *(cache.base_[cache.slot_])); - - cache.last_ = v; - - #ifdef DEBUG - *logofs << "EncodeBuffer: Encoded value " - << (unsigned) value << " and position " - << position << " with base " << cache.slot_ - << ".\n" << logofs_flush; - #endif - - cache.slot_ = (cache.last_ & 0xff); -} - -void EncodeBuffer::encodeNewXidValue(unsigned int value, unsigned int &lastId, - IntCache &lastIdCache, IntCache &cache, - FreeCache &freeCache) -{ - encodeCachedValue((value - 1) - lastId, 29, lastIdCache); - - lastId = value; - - cache.push(value, 0x1fffffff); - - freeCache.push(value, 0x1fffffff); -} - -void EncodeBuffer::encodeNewXidValue(unsigned int value, unsigned int &lastId, - IntCache &lastIdCache, XidCache &cache, - FreeCache &freeCache) -{ - encodeCachedValue((value - 1) - lastId, 29, lastIdCache); - - lastId = value; - - unsigned int t = (value - cache.last_); - - cache.last_ = value; - - #ifdef DEBUG - *logofs << "EncodeBuffer: Encoded new Xid " << value - << " with base " << cache.slot_ << ".\n" - << logofs_flush; - #endif - - cache.slot_ = (value & 0xff); - - cache.base_[cache.slot_] -> push(t, 0x1fffffff); - - freeCache.push(value, IntMask[29]); -} - -void EncodeBuffer::encodeXidValue(unsigned int value, XidCache &cache) -{ - unsigned int t = (value - cache.last_); - - encodeCachedValue(t, 29, *(cache.base_[cache.slot_])); - - cache.last_ = value; - - #ifdef DEBUG - *logofs << "EncodeBuffer: Encoded Xid " << value - << " with base " << cache.slot_ << ".\n" - << logofs_flush; - #endif - - cache.slot_ = (value & 0xff); -} - -void EncodeBuffer::encodeFreeXidValue(unsigned int value, FreeCache &cache) -{ - encodeCachedValue(value, 29, cache); -} diff --git a/nxcomp/EncodeBuffer.h b/nxcomp/EncodeBuffer.h deleted file mode 100644 index 67f6ff093..000000000 --- a/nxcomp/EncodeBuffer.h +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef EncodeBuffer_H -#define EncodeBuffer_H - -#include "IntCache.h" -#include "CharCache.h" -#include "XidCache.h" -#include "FreeCache.h" -#include "OpcodeCache.h" -#include "ActionCache.h" - -#define ENCODE_BUFFER_DEFAULT_SIZE 16384 - -// -// This should match the maximum size of -// a single message added to write buffer -// (see WriteBuffer.h). -// - -#define ENCODE_BUFFER_OVERFLOW_SIZE 4194304 - -// -// Adjust for the control messages and the -// frame length added by the proxy. -// - -#define ENCODE_BUFFER_PREFIX_SIZE 64 - -// -// The encode routines may write one byte -// past the nominal end of the encode buffer. -// This additional byte is included in the -// payload. This is actually a harmless bug. -// - -#define ENCODE_BUFFER_POSTFIX_SIZE 1 - -class EncodeBuffer -{ - public: - - EncodeBuffer(); - - ~EncodeBuffer(); - - void setSize(unsigned int initialSize, unsigned int thresholdSize, - unsigned int maximumSize); - - void encodeValue(unsigned int value, unsigned int numBits, - unsigned int blockSize = 0); - - void encodeCachedValue(unsigned int value, unsigned int numBits, - IntCache &cache, unsigned int blockSize = 0); - - void encodeCachedValue(unsigned char value, unsigned int numBits, - CharCache &cache, unsigned int blockSize = 0); - - void encodeDiffCachedValue(const unsigned int value, unsigned int &previous, - unsigned int numBits, IntCache &cache, - unsigned int blockSize = 0) - { - encodeCachedValue((value - 1) - previous, numBits, cache, blockSize); - - previous = value; - } - - void encodeBoolValue(unsigned int value) - { - encodeValue(value, 1); - } - - void encodeOpcodeValue(unsigned char value, OpcodeCache &cache) - { - encodeCachedValue(value, 8, cache.base_[cache.slot_], 8); - - cache.slot_ = value; - } - - void encodeActionValue(unsigned char value, ActionCache &cache) - { - unsigned short position = 0; - - encodeActionValue(value, position, cache); - } - - void encodeActionValue(unsigned char value, unsigned short position, - ActionCache &cache); - - void encodeNewXidValue(unsigned int value, unsigned int &lastId, - IntCache &lastIdCache, IntCache &cache, - FreeCache &freeCache); - - void encodeNewXidValue(unsigned int value, unsigned int &lastId, - IntCache &lastIdCache, XidCache &cache, - FreeCache &freeCache); - - void encodeXidValue(unsigned int value, XidCache &cache); - - void encodeFreeXidValue(unsigned int value, FreeCache &cache); - - void encodeTextData(const unsigned char *buffer, unsigned int numBytes) - { - encodeMemory(buffer, numBytes); - } - - void encodeIntData(const unsigned char *buffer, unsigned int numBytes) - { - encodeMemory(buffer, numBytes); - } - - void encodeLongData(const unsigned char *buffer, unsigned int numBytes) - { - encodeMemory(buffer, numBytes); - } - - void encodeMemory(const unsigned char *buffer, unsigned int numBytes); - - unsigned char *getData() - { - return buffer_; - } - - unsigned int getLength() const; - - unsigned int getBits() const - { - return ((nextDest_ - buffer_) << 3) + (7 - destShift_); - } - - unsigned int diffBits(); - - void fullReset(); - - private: - - void growBuffer(unsigned int numBytes = 0); - - void alignBuffer(); - - unsigned int size_; - unsigned char *buffer_; - - // - // This points to the first byte - // just beyond end of the buffer. - // - - const unsigned char *end_; - - unsigned char *nextDest_; - unsigned int destShift_; - unsigned int lastBits_; - - unsigned int initialSize_; - unsigned int thresholdSize_; - unsigned int maximumSize_; -}; - -#endif /* EncodeBuffer_H */ diff --git a/nxcomp/FillPoly.cpp b/nxcomp/FillPoly.cpp deleted file mode 100644 index 85fa8fdd1..000000000 --- a/nxcomp/FillPoly.cpp +++ /dev/null @@ -1,235 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "FillPoly.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int FillPolyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - FillPolyMessage *fillPoly = (FillPolyMessage *) message; - - // - // Here is the fingerprint. - // - - fillPoly -> drawable = GetULONG(buffer + 4, bigEndian); - fillPoly -> gcontext = GetULONG(buffer + 8, bigEndian); - - fillPoly -> shape = *(buffer + 12); - fillPoly -> mode = *(buffer + 13); - - // Since ProtoStep8 (#issue 108) - if (size >= (unsigned int) dataOffset) - { - fillPoly -> x_origin = GetUINT(buffer + 16, bigEndian); - fillPoly -> y_origin = GetUINT(buffer + 18, bigEndian); - } - else - { - fillPoly -> x_origin = 0; - fillPoly -> y_origin = 0; - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int FillPolyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - FillPolyMessage *fillPoly = (FillPolyMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(fillPoly -> drawable, buffer + 4, bigEndian); - PutULONG(fillPoly -> gcontext, buffer + 8, bigEndian); - - *(buffer + 12) = fillPoly -> shape; - *(buffer + 13) = fillPoly -> mode; - - // Since ProtoStep8 (#issue 108) - if (size >= (unsigned int) dataOffset) - { - PutUINT(fillPoly -> x_origin, buffer + 16, bigEndian); - PutUINT(fillPoly -> y_origin, buffer + 18, bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void FillPolyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - FillPolyMessage *fillPoly = (FillPolyMessage *) message; - - *logofs << name() << ": Identity drawable " << fillPoly -> drawable - << ", gcontext " << fillPoly -> gcontext << ", shape " - << fillPoly -> shape << ", mode " << fillPoly -> mode - << fillPoly -> size_ << ", x_origin " << fillPoly -> x_origin - << ", y_origin " << fillPoly -> y_origin << ".\n" - << logofs_flush; - #endif -} - -void FillPolyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Fields shape, mode. - // - - md5_append(md5_state_, buffer + 12, 2); -} - -void FillPolyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - FillPolyMessage *fillPoly = (FillPolyMessage *) message; - FillPolyMessage *cachedFillPoly = (FillPolyMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << fillPoly -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(fillPoly -> drawable, clientCache -> drawableCache); - - cachedFillPoly -> drawable = fillPoly -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << fillPoly -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(fillPoly -> gcontext, clientCache -> gcCache); - - cachedFillPoly -> gcontext = fillPoly -> gcontext; - - // Since ProtoStep8 (#issue 108) - if (fillPoly -> size_ >= dataOffset) - { - #ifdef TEST - *logofs << name() << ": Encoding value " << fillPoly -> x_origin - << " as x_origin field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(fillPoly -> x_origin, 16, - *clientCache -> fillPolyXAbsCache[0], 8); - - cachedFillPoly -> x_origin = fillPoly -> x_origin; - - #ifdef TEST - *logofs << name() << ": Encoding value " << fillPoly -> y_origin - << " as y_origin field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(fillPoly -> y_origin, 16, - *clientCache -> fillPolyYAbsCache[0], 8); - - cachedFillPoly -> y_origin = fillPoly -> y_origin; - } -} - -void FillPolyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - FillPolyMessage *fillPoly = (FillPolyMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(fillPoly -> drawable, clientCache -> drawableCache); - - #ifdef TEST - *logofs << name() << ": Decoded value " << fillPoly -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(fillPoly -> gcontext, clientCache -> gcCache); - - #ifdef TEST - *logofs << name() << ": Decoded value " << fillPoly -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - // Since ProtoStep8 (#issue 108) - if (fillPoly -> size_ >= dataOffset) - { - unsigned int value; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> fillPolyXAbsCache[0], 8); - - fillPoly -> x_origin = value; - - #ifdef TEST - *logofs << name() << ": Decoded value " << fillPoly -> x_origin - << " as x_origin field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> fillPolyYAbsCache[0], 8); - - fillPoly -> y_origin = value; - - #ifdef TEST - *logofs << name() << ": Decoded value " << fillPoly -> y_origin - << " as y_origin field.\n" << logofs_flush; - #endif - } -} - - diff --git a/nxcomp/FillPoly.h b/nxcomp/FillPoly.h deleted file mode 100644 index 4ceb96c09..000000000 --- a/nxcomp/FillPoly.h +++ /dev/null @@ -1,200 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef FillPoly_H -#define FillPoly_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define FILLPOLY_ENABLE_CACHE 1 -#define FILLPOLY_ENABLE_DATA 0 -#define FILLPOLY_ENABLE_SPLIT 0 -#define FILLPOLY_ENABLE_COMPRESS 0 - -#define FILLPOLY_DATA_LIMIT 512 - -#define FILLPOLY_CACHE_SLOTS 2000 -#define FILLPOLY_CACHE_THRESHOLD 3 -#define FILLPOLY_CACHE_LOWER_THRESHOLD 1 - -#define FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 20 - -// -// The message class. -// - -class FillPolyMessage : public Message -{ - friend class FillPolyStore; - - public: - - FillPolyMessage() - { - } - - ~FillPolyMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char shape; - unsigned char mode; - unsigned int drawable; - unsigned int gcontext; - - unsigned short x_origin; - unsigned short y_origin; -}; - -class FillPolyStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - FillPolyStore() : MessageStore() - { - enableCache = FILLPOLY_ENABLE_CACHE; - enableData = FILLPOLY_ENABLE_DATA; - enableSplit = FILLPOLY_ENABLE_SPLIT; - enableCompress = FILLPOLY_ENABLE_COMPRESS; - - dataLimit = FILLPOLY_DATA_LIMIT; - - // Since ProtoStep8 (#issue 108) - dataOffset = FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8; - - cacheSlots = FILLPOLY_CACHE_SLOTS; - cacheThreshold = FILLPOLY_CACHE_THRESHOLD; - cacheLowerThreshold = FILLPOLY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~FillPolyStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "FillPoly"; - } - - virtual unsigned char opcode() const - { - return X_FillPoly; - } - - virtual unsigned int storage() const - { - return sizeof(FillPolyMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new FillPolyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new FillPolyMessage((const FillPolyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (FillPolyMessage *) message; - } - - virtual int identitySize(const unsigned char *buffer, unsigned int size) - { - // Since ProtoStep8 (#issue 108) - return (size >= FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 ? - FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 : size); - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* FillPoly_H */ diff --git a/nxcomp/Fork.cpp b/nxcomp/Fork.cpp deleted file mode 100644 index 0120cb4a6..000000000 --- a/nxcomp/Fork.cpp +++ /dev/null @@ -1,106 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "Fork.h" -#include "Misc.h" -#include "Timestamp.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Only on Cygwin, retry n times waiting a -// given amount of milliseconds after each -// attempt. -// - -#define RETRY_LIMIT 30 -#define RETRY_TIMEOUT 1000 - -int Fork() -{ - #ifdef __CYGWIN32__ - - int limit = RETRY_LIMIT; - int timeout = RETRY_TIMEOUT; - - #else - - int limit = 1; - int timeout = 0; - - #endif - - int pid = 0; - - for (int i = 0; i < limit; i++) - { - #ifdef TEST - *logofs << "Fork: Trying at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - // - // It could optionally try again only if the - // error code is 11, 'Resource temporarily - // unavailable'. - // - - if ((pid = fork()) >= 0) - { - break; - } - else if (i < limit - 1) - { - #ifdef WARNING - *logofs << "Fork: WARNING! Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'. Retrying...\n" << logofs_flush; - #endif - - usleep(timeout * 1000); - } - } - - #ifdef TEST - - if (pid <= 0) - { - *logofs << "Fork: Returning at " << strMsTimestamp() - << ".\n" << logofs_flush; - } - - #endif - - return pid; -} diff --git a/nxcomp/Fork.h b/nxcomp/Fork.h deleted file mode 100644 index 94238ed90..000000000 --- a/nxcomp/Fork.h +++ /dev/null @@ -1,31 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Try again if the fork() fails, as it can happen -// often on Cygwin. -// - -extern int Fork(); diff --git a/nxcomp/FreeCache.h b/nxcomp/FreeCache.h deleted file mode 100644 index bf5c801e5..000000000 --- a/nxcomp/FreeCache.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef FreeCache_H -#define FreeCache_H - -#include "IntCache.h" - -class FreeCache : public IntCache -{ - public: - - FreeCache(unsigned int size) - - : IntCache(size) - { - } -}; - -#endif /* FreeCache_H */ diff --git a/nxcomp/GenericChannel.cpp b/nxcomp/GenericChannel.cpp deleted file mode 100644 index 6fc049e70..000000000 --- a/nxcomp/GenericChannel.cpp +++ /dev/null @@ -1,491 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include - -#include "GenericChannel.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "StaticCompressor.h" - -#include "Statistics.h" -#include "Proxy.h" - -extern Proxy *proxy; - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Log the important tracepoints related -// to writing packets to the peer proxy. -// - -#undef FLUSH - -// -// Define this to log when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// Here are the static members. -// - -#ifdef REFERENCES - -int GenericChannel::references_ = 0; - -#endif - -GenericChannel::GenericChannel(Transport *transport, StaticCompressor *compressor) - - : Channel(transport, compressor), readBuffer_(transport_, this) -{ - #ifdef REFERENCES - *logofs << "GenericChannel: Created new object at " - << this << " for FD#" << fd_ << " out of " - << ++references_ << " allocated channels.\n" - << logofs_flush; - #endif -} - -GenericChannel::~GenericChannel() -{ - #ifdef REFERENCES - *logofs << "GenericChannel: Deleted object at " - << this << " for FD#" << fd_ << " out of " - << --references_ << " allocated channels.\n" - << logofs_flush; - #endif -} - -// -// Beginning of handleRead(). -// - -int GenericChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length) -{ - #ifdef TEST - *logofs << "handleRead: Called for FD#" << fd_ - << " with " << encodeBuffer.getLength() - << " bytes already encoded.\n" - << logofs_flush; - #endif - - // - // Pointer to located message and - // its size in bytes. - // - - const unsigned char *inputMessage; - unsigned int inputLength; - - // - // Tag message as generic data in compression - // routine. Opcode is not actually transferred - // over the network. - // - - unsigned char inputOpcode = X_NXInternalGenericData; - - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: Trying to read from FD#" - << fd_ << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - int result = readBuffer_.readMessage(); - - #ifdef DEBUG - *logofs << "handleRead: Read result on FD#" << fd_ - << " is " << result << ".\n" - << logofs_flush; - #endif - - if (result < 0) - { - // - // Let the proxy close the channel. - // - - return -1; - } - else if (result == 0) - { - #if defined(TEST) || defined(INFO) - - *logofs << "handleRead: PANIC! No data read from FD#" - << fd_ << " while encoding messages.\n" - << logofs_flush; - - HandleCleanup(); - - #endif - - return 0; - } - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "handleRead: Encoding messages for FD#" << fd_ - << " with " << readBuffer_.getLength() << " bytes " - << "in the buffer.\n" << logofs_flush; - #endif - - // - // Divide the available data in multiple - // messages and encode them one by one. - // - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) - { - encodeBuffer.encodeValue(inputLength, 32, 14); - - if (isCompressed() == 1) - { - unsigned int compressedDataSize = 0; - unsigned char *compressedData = NULL; - - if (handleCompress(encodeBuffer, inputOpcode, 0, - inputMessage, inputLength, compressedData, - compressedDataSize) < 0) - { - return -1; - } - } - else - { - encodeBuffer.encodeMemory(inputMessage, inputLength); - } - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleRead: Handled generic data for FD#" << fd_ - << ". " << inputLength << " bytes in, " << bits << " bits (" - << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; - #endif - - addProtocolBits(inputLength << 3, bits); - - if (isPrioritized() == 1) - { - priority_++; - } - - } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) ... - - // - // All data has been read from the read buffer. - // We still need to mark the end of the encode - // buffer just before sending the frame. This - // allows us to accommodate multiple reads in - // a single frame. - // - - if (priority_ > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: WARNING! Requesting flush " - << "because of " << priority_ << " prioritized " - << "messages for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncPriority() < 0) - { - return -1; - } - - // - // Reset the priority flag. - // - - priority_ = 0; - } - - // - // Flush if we produced enough data. - // - - if (proxy -> canAsyncFlush() == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: WARNING! Requesting flush " - << "because of enough data or timeout on the " - << "proxy link.\n" << logofs_flush; - #endif - - if (proxy -> handleAsyncFlush() < 0) - { - return -1; - } - } - - #if defined(TEST) || defined(INFO) - - if (transport_ -> pending() != 0 || - readBuffer_.checkMessage() != 0) - { - *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" - << fd_ << " has " << transport_ -> pending() - << " bytes to read.\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Reset the read buffer. - // - - readBuffer_.fullReset(); - - return 1; -} - -// -// End of handleRead(). -// - -// -// Beginning of handleWrite(). -// - -int GenericChannel::handleWrite(const unsigned char *message, unsigned int length) -{ - #ifdef TEST - *logofs << "handleWrite: Called for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - // - // Create the buffer from which to - // decode messages. - // - - DecodeBuffer decodeBuffer(message, length); - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "handleWrite: Decoding messages for FD#" << fd_ - << " with " << length << " bytes in the buffer.\n" - << logofs_flush; - #endif - - unsigned char *outputMessage; - unsigned int outputLength; - - // - // Tag message as generic data - // in decompression. - // - - unsigned char outputOpcode = X_NXInternalGenericData; - - for (;;) - { - decodeBuffer.decodeValue(outputLength, 32, 14); - - if (outputLength == 0) - { - break; - } - - if (isCompressed() == 1) - { - if (writeBuffer_.getAvailable() < outputLength || - (int) outputLength >= control -> TransportFlushBufferSize) - { - #ifdef DEBUG - *logofs << "handleWrite: Using scratch buffer for " - << "generic data with size " << outputLength << " and " - << writeBuffer_.getLength() << " bytes in buffer.\n" - << logofs_flush; - #endif - - outputMessage = writeBuffer_.addScratchMessage(outputLength); - } - else - { - outputMessage = writeBuffer_.addMessage(outputLength); - } - - const unsigned char *compressedData = NULL; - unsigned int compressedDataSize = 0; - - int decompressed = handleDecompress(decodeBuffer, outputOpcode, 0, - outputMessage, outputLength, compressedData, - compressedDataSize); - if (decompressed < 0) - { - return -1; - } - } - else - { - #ifdef DEBUG - *logofs << "handleWrite: Using scratch buffer for " - << "generic data with size " << outputLength << " and " - << writeBuffer_.getLength() << " bytes in buffer.\n" - << logofs_flush; - #endif - - writeBuffer_.addScratchMessage((unsigned char *) - decodeBuffer.decodeMemory(outputLength), outputLength); - } - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: Handled generic data for FD#" << fd_ - << ". " << outputLength << " bytes out.\n" - << logofs_flush; - #endif - - handleFlush(flush_if_needed); - } - - // - // Write any remaining data to socket. - // - - if (handleFlush(flush_if_any) < 0) - { - return -1; - } - - return 1; -} - -// -// End of handleWrite(). -// - -// -// Other members. -// - -int GenericChannel::handleCompletion(EncodeBuffer &encodeBuffer) -{ - // - // Add the bits telling to the remote - // that all data in the frame has been - // encoded. - // - - if (encodeBuffer.getLength() > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleCompletion: Writing completion bits with " - << encodeBuffer.getLength() << " bytes encoded " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeValue(0, 32, 14); - - return 1; - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "handleCompletion: PANIC! No completion to write " - << "for FD#" << fd_ << ".\n" << logofs_flush; - - HandleCleanup(); - } - #endif - - return 0; -} - -int GenericChannel::handleConfiguration() -{ - #ifdef TEST - *logofs << "GenericChannel: Setting new buffer parameters.\n" - << logofs_flush; - #endif - - readBuffer_.setSize(control -> GenericInitialReadSize, - control -> GenericMaximumBufferSize); - - writeBuffer_.setSize(control -> TransportGenericBufferSize, - control -> TransportGenericBufferThreshold, - control -> TransportMaximumBufferSize); - - transport_ -> setSize(control -> TransportGenericBufferSize, - control -> TransportGenericBufferThreshold, - control -> TransportMaximumBufferSize); - - return 1; -} - -int GenericChannel::handleFinish() -{ - #ifdef TEST - *logofs << "GenericChannel: Finishing channel for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - congestion_ = 0; - priority_ = 0; - - finish_ = 1; - - transport_ -> fullReset(); - - return 1; -} - -int GenericChannel::setReferences() -{ - #ifdef TEST - *logofs << "GenericChannel: Initializing the static " - << "members for the generic channels.\n" - << logofs_flush; - #endif - - #ifdef REFERENCES - - references_ = 0; - - #endif - - return 1; -} diff --git a/nxcomp/GenericChannel.h b/nxcomp/GenericChannel.h deleted file mode 100644 index 3df18f444..000000000 --- a/nxcomp/GenericChannel.h +++ /dev/null @@ -1,440 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GenericChannel_H -#define GenericChannel_H - -#include "Channel.h" - -#include "Statistics.h" - -#include "GenericReadBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#undef TEST -#undef DEBUG - -// -// Define this to log a line when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// This class implements the client -// side compression of X protocol. -// - -class GenericChannel : public Channel -{ - public: - - GenericChannel(Transport *transport, StaticCompressor *compressor); - - virtual ~GenericChannel(); - - virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length); - - virtual int handleWrite(const unsigned char *message, unsigned int length); - - - virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, - T_store_action action, int position, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) - { - return 0; - } - - virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, - T_store_action action, int position, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) - { - return 0; - } - - - virtual int handleSplit(EncodeBuffer &encodeBuffer) - { - return 0; - } - - virtual int handleSplit(DecodeBuffer &decodeBuffer) - { - return 0; - } - - virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split) - { - return 0; - } - - virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) - { - return 0; - } - - virtual int handleMotion(EncodeBuffer &encodeBuffer) - { - return 0; - } - - virtual int handleCompletion(EncodeBuffer &encodeBuffer); - - virtual int handleConfiguration(); - - virtual int handleFinish(); - - virtual int handleAsyncEvents() - { - return 0; - } - - virtual int needSplit() const - { - return 0; - } - - virtual int needMotion() const - { - return 0; - } - - virtual T_channel_type getType() const = 0; - - // - // Initialize the static members. - // - - static int setReferences(); - - protected: - - // - // Generic channels are considered to be - // in congestion state as soon as the - // socket is blocked for write. - // - - virtual int isCongested() - { - return (transport_ -> blocked() == 1); - } - - virtual int isReliable() - { - return 0; - } - - // - // Model generic channels' encoding and - // decoding policy. - // - - virtual int isCompressed() = 0; - - // - // Return true if the channel contains - // time sensitive data. - // - - virtual int isPrioritized() = 0; - - // - // Record the protocol bits for the - // specific service. - // - - virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) = 0; - - // - // Channel's own read buffer. - // - - GenericReadBuffer readBuffer_; - - private: - - // - // Keep track of object's creation - // and deletion. - // - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -class CupsChannel : public GenericChannel -{ - public: - - CupsChannel(Transport *transport, StaticCompressor *compressor) - - : GenericChannel(transport, compressor) - { - } - - virtual ~CupsChannel() - { - } - - protected: - - virtual T_channel_type getType() const - { - return channel_cups; - } - - virtual int isCompressed() - { - // Since ProtoStep8 (#issue 108) - return 0; - } - - virtual int isPrioritized() - { - return 0; - } - - virtual void addProtocolBits(unsigned int bitsIn, - unsigned int bitsOut) - { - statistics -> addCupsBits(bitsIn, bitsOut); - } -}; - -class SmbChannel : public GenericChannel -{ - public: - - SmbChannel(Transport *transport, StaticCompressor *compressor) - - : GenericChannel(transport, compressor) - { - } - - virtual ~SmbChannel() - { - } - - protected: - - virtual T_channel_type getType() const - { - return channel_smb; - } - - virtual int isCompressed() - { - // Since ProtoStep8 (#issue 108) - return 0; - } - - virtual int isPrioritized() - { - return 0; - } - - virtual void addProtocolBits(unsigned int bitsIn, - unsigned int bitsOut) - { - statistics -> addSmbBits(bitsIn, bitsOut); - } -}; - -class MediaChannel : public GenericChannel -{ - public: - - MediaChannel(Transport *transport, StaticCompressor *compressor) - - : GenericChannel(transport, compressor) - { - } - - virtual ~MediaChannel() - { - } - - protected: - - virtual T_channel_type getType() const - { - return channel_media; - } - - // - // Don't try to compress the media data. - // - - virtual int isCompressed() - { - return 0; - } - - // - // Reduce the latency of media channels - // by setting them as prioritized, even - // if this will take away bandwidth from - // the X channels. - // - - virtual int isPrioritized() - { - return 1; - } - - virtual void addProtocolBits(unsigned int bitsIn, - unsigned int bitsOut) - { - statistics -> addMediaBits(bitsIn, bitsOut); - } -}; - -class HttpChannel : public GenericChannel -{ - public: - - HttpChannel(Transport *transport, StaticCompressor *compressor) - - : GenericChannel(transport, compressor) - { - } - - virtual ~HttpChannel() - { - } - - protected: - - virtual T_channel_type getType() const - { - return channel_http; - } - - virtual int isCompressed() - { - // Since ProtoStep8 (#issue 108) - return 0; - } - - virtual int isPrioritized() - { - return 0; - } - - virtual void addProtocolBits(unsigned int bitsIn, - unsigned int bitsOut) - { - statistics -> addHttpBits(bitsIn, bitsOut); - } -}; - -class FontChannel : public GenericChannel -{ - public: - - FontChannel(Transport *transport, StaticCompressor *compressor) - - : GenericChannel(transport, compressor) - { - } - - virtual ~FontChannel() - { - } - - protected: - - virtual T_channel_type getType() const - { - return channel_font; - } - - virtual int isCompressed() - { - // Since ProtoStep8 (#issue 108) - return 0; - } - - virtual int isPrioritized() - { - return 1; - } - - virtual void addProtocolBits(unsigned int bitsIn, - unsigned int bitsOut) - { - statistics -> addFontBits(bitsIn, bitsOut); - } -}; - -class SlaveChannel : public GenericChannel -{ - public: - - SlaveChannel(Transport *transport, StaticCompressor *compressor) - - : GenericChannel(transport, compressor) - { - } - - virtual ~SlaveChannel() - { - } - - protected: - - virtual T_channel_type getType() const - { - return channel_slave; - } - - virtual int isCompressed() - { - return 0; - } - - virtual int isPrioritized() - { - return 0; - } - - virtual void addProtocolBits(unsigned int bitsIn, - unsigned int bitsOut) - { - statistics -> addSlaveBits(bitsIn, bitsOut); - } -}; - -#endif /* GenericChannel_H */ diff --git a/nxcomp/GenericReadBuffer.cpp b/nxcomp/GenericReadBuffer.cpp deleted file mode 100644 index 337ae2f61..000000000 --- a/nxcomp/GenericReadBuffer.cpp +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GenericReadBuffer.h" - -#include "GenericChannel.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -unsigned int GenericReadBuffer::suggestedLength(unsigned int pendingLength) -{ - // - // Always read the initial read size. - // - - return 0; -} - -int GenericReadBuffer::locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength) -{ - // - // We don't care about the endianess - // in generic channels. - // - - unsigned int size = end - start; - - #ifdef TEST - *logofs << "GenericReadBuffer: Locating message for FD#" - << transport_ -> fd() << " with " << size - << " bytes.\n" << logofs_flush; - #endif - - if (size == 0) - { - remaining_ = 1; - - return 0; - } - - dataLength = size; - - controlLength = 0; - trailerLength = 0; - - remaining_ = 0; - - return 1; -} diff --git a/nxcomp/GenericReadBuffer.h b/nxcomp/GenericReadBuffer.h deleted file mode 100644 index 5ea4d939d..000000000 --- a/nxcomp/GenericReadBuffer.h +++ /dev/null @@ -1,61 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GenericReadBuffer_H -#define GenericReadBuffer_H - -#include "ReadBuffer.h" -#include "Control.h" - -class GenericChannel; - -class GenericReadBuffer : public ReadBuffer -{ - public: - - GenericReadBuffer(Transport *transport, GenericChannel *channel) - - : ReadBuffer(transport), channel_(channel) - { - } - - virtual ~GenericReadBuffer() - { - } - - protected: - - virtual unsigned int suggestedLength(unsigned int pendingLength); - - virtual int locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength); - - GenericChannel *channel_; -}; - -#endif /* GenericReadBuffer_H */ diff --git a/nxcomp/GenericReply.cpp b/nxcomp/GenericReply.cpp deleted file mode 100644 index 3d9a0d638..000000000 --- a/nxcomp/GenericReply.cpp +++ /dev/null @@ -1,298 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GenericReply.h" - -#include "ServerCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -GenericReplyStore::GenericReplyStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = GENERICREPLY_ENABLE_CACHE; - enableData = GENERICREPLY_ENABLE_DATA; - enableSplit = GENERICREPLY_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = GENERICREPLY_DATA_LIMIT; - dataOffset = GENERICREPLY_DATA_OFFSET; - - cacheSlots = GENERICREPLY_CACHE_SLOTS; - cacheThreshold = GENERICREPLY_CACHE_THRESHOLD; - cacheLowerThreshold = GENERICREPLY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -GenericReplyStore::~GenericReplyStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int GenericReplyStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ServerCache *serverCache = (ServerCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" - << logofs_flush; - #endif - - encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian), 32, 15); - - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - serverCache -> genericReplyCharCache); - - for (unsigned int i = 0; i < 6; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(buffer + i * 4 + 8, bigEndian), 32, - *serverCache -> genericReplyIntCache[i]); - } - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" - << logofs_flush; - #endif - - return 1; -} - -int GenericReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ServerCache *serverCache = (ServerCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" - << logofs_flush; - #endif - - decodeBuffer.decodeValue(size, 32, 15); - - size = 32 + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - decodeBuffer.decodeCachedValue(*(buffer + 1), 8, - serverCache -> genericReplyCharCache); - - unsigned int value; - - for (unsigned int i = 0; i < 6; i++) - { - decodeBuffer.decodeCachedValue(value, 32, - *serverCache -> genericReplyIntCache[i]); - - PutULONG(value, buffer + i * 4 + 8, bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" - << logofs_flush; - #endif - - return 1; -} - -int GenericReplyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GenericReplyMessage *genericReply = (GenericReplyMessage *) message; - - genericReply -> byte_data = *(buffer + 1); - - for (int i = 0; i < 12; i++) - { - genericReply -> short_data[i] = GetUINT(buffer + i * 2 + 8, bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int GenericReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GenericReplyMessage *genericReply = (GenericReplyMessage *) message; - - *(buffer + 1) = genericReply -> byte_data; - - for (int i = 0; i < 12; i++) - { - PutUINT(genericReply -> short_data[i], buffer + i * 2 + 8, bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void GenericReplyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - GenericReplyMessage *genericReply = (GenericReplyMessage *) message; - - *logofs << name() << ": Identity byte_data " - << (unsigned) genericReply -> byte_data; - - for (int i = 0; i < 12; i++) - { - *logofs << ", short_data[" << i << "]" - << (unsigned) genericReply -> short_data[i]; - } - - *logofs << ", size " << genericReply -> size_ << ".\n"; - - #endif -} - -void GenericReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void GenericReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - GenericReplyMessage *genericReply = (GenericReplyMessage *) message; - GenericReplyMessage *cachedGenericReply = (GenericReplyMessage *) cachedMessage; - - ServerCache *serverCache = (ServerCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " - << (unsigned int) genericReply -> byte_data - << " as byte_data field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(genericReply -> byte_data, 8, - serverCache -> genericReplyCharCache); - - cachedGenericReply -> byte_data = genericReply -> byte_data; - - for (unsigned int i = 0; i < 12; i++) - { - #ifdef TEST - *logofs << name() << ": Encoding value " << genericReply -> short_data[i] - << " as short_data[" << i << "] field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(genericReply -> short_data[i], 16, - *serverCache -> genericReplyIntCache[i]); - - cachedGenericReply -> short_data[i] = genericReply -> short_data[i]; - } -} - -void GenericReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - // - // Decode the variant part. - // - - GenericReplyMessage *genericReply = (GenericReplyMessage *) message; - - ServerCache *serverCache = (ServerCache *) channelCache; - - decodeBuffer.decodeCachedValue(genericReply -> byte_data, 8, - serverCache -> genericReplyCharCache); - - #ifdef TEST - *logofs << name() << ": Decoded value " - << (unsigned int) genericReply -> byte_data - << " as byte_data field.\n" << logofs_flush; - #endif - - unsigned int value; - - for (unsigned int i = 0; i < 12; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *serverCache -> genericReplyIntCache[i]); - - genericReply -> short_data[i] = (unsigned short) value; - - #ifdef TEST - *logofs << name() << ": Decoded value " << genericReply -> short_data[i] - << " as short_data[" << i << "] field.\n" << logofs_flush; - #endif - } -} diff --git a/nxcomp/GenericReply.h b/nxcomp/GenericReply.h deleted file mode 100644 index e899b8467..000000000 --- a/nxcomp/GenericReply.h +++ /dev/null @@ -1,161 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GenericReply_H -#define GenericReply_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define GENERICREPLY_ENABLE_CACHE 1 -#define GENERICREPLY_ENABLE_DATA 1 -#define GENERICREPLY_ENABLE_SPLIT 0 - -#define GENERICREPLY_DATA_LIMIT 1048576 - 32 -#define GENERICREPLY_DATA_OFFSET 32 - -#define GENERICREPLY_CACHE_SLOTS 400 -#define GENERICREPLY_CACHE_THRESHOLD 5 -#define GENERICREPLY_CACHE_LOWER_THRESHOLD 1 - -#define GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class GenericReplyMessage : public Message -{ - friend class GenericReplyStore; - - public: - - GenericReplyMessage() - { - } - - ~GenericReplyMessage() - { - } - - // - // Put here the fields which constitute the - // 'identity' part of the message. Starting - // from protocol level 3 we use short data - // to increase cache efficiency. - // - - private: - - unsigned char byte_data; - unsigned int int_data[6]; - unsigned short short_data[12]; -}; - -class GenericReplyStore : public MessageStore -{ - public: - - GenericReplyStore(StaticCompressor *compressor); - - virtual ~GenericReplyStore(); - - virtual const char *name() const - { - return "GenericReply"; - } - - virtual unsigned char opcode() const - { - return X_NXInternalGenericReply; - } - - virtual unsigned int storage() const - { - return sizeof(GenericReplyMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new GenericReplyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new GenericReplyMessage((const GenericReplyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (GenericReplyMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* GenericReply_H */ diff --git a/nxcomp/GenericRequest.cpp b/nxcomp/GenericRequest.cpp deleted file mode 100644 index 5c342fcf7..000000000 --- a/nxcomp/GenericRequest.cpp +++ /dev/null @@ -1,330 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GenericRequest.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -GenericRequestStore::GenericRequestStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = GENERICREQUEST_ENABLE_CACHE; - enableData = GENERICREQUEST_ENABLE_DATA; - enableSplit = GENERICREQUEST_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = GENERICREQUEST_DATA_LIMIT; - dataOffset = GENERICREQUEST_DATA_OFFSET; - - cacheSlots = GENERICREQUEST_CACHE_SLOTS; - cacheThreshold = GENERICREQUEST_CACHE_THRESHOLD; - cacheLowerThreshold = GENERICREQUEST_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -GenericRequestStore::~GenericRequestStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int GenericRequestStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - encodeBuffer.encodeValue(size >> 2, 16, 10); - - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> genericRequestOpcodeCache); - - for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) - { - #ifdef DEBUG - *logofs << name() << ": Encoding data[" << i << "] " - << "at position " << i * 2 + 4 << " with value " - << GetUINT(buffer + (i * 2) + 4, bigEndian) - << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(GetUINT(buffer + (i * 2) + 4, bigEndian), 16, - *clientCache -> genericRequestDataCache[i]); - } - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int GenericRequestStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - decodeBuffer.decodeValue(size, 16, 10); - - size <<= 2; - - buffer = writeBuffer -> addMessage(size); - - decodeBuffer.decodeCachedValue(*(buffer + 1), 8, - clientCache -> genericRequestOpcodeCache); - - unsigned int value; - - for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> genericRequestDataCache[i]); - - #ifdef DEBUG - *logofs << name() << ": Decoding data[" << i << "] " - << "at position " << i * 2 + 4 << " with value " - << value << ".\n" << logofs_flush; - #endif - - PutUINT(value, buffer + 4 + (i * 2), bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int GenericRequestStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; - - genericRequest -> opcode = *(buffer + 1); - - for (unsigned int i = 0; i < 8; i++) - { - if ((i * 2 + 4) < size) - { - genericRequest -> data[i] = GetUINT(buffer + i * 2 + 4, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed data[" << i << "] " - << "with value " << genericRequest -> data[i] - << ".\n" << logofs_flush; - #endif - } - else - { - genericRequest -> data[i] = 0; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int GenericRequestStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; - - *(buffer + 1) = genericRequest -> opcode; - - for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) - { - #ifdef DEBUG - *logofs << name() << ": Unparsed data[" << i << "] " - << "with value " << genericRequest -> data[i] - << ".\n" << logofs_flush; - #endif - - PutUINT(genericRequest -> data[i], buffer + i * 2 + 4, bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void GenericRequestStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; - - *logofs << name() << ": Identity opcode " << (unsigned) genericRequest -> opcode; - - for (int i = 0; i < 8; i++) - { - *logofs << ", data[" << i << "] " << genericRequest -> data[i]; - } - - *logofs << ", size " << genericRequest -> size_ << ".\n" << logofs_flush; - - #endif -} - -void GenericRequestStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // As data offset can be beyond the real end of - // the message, we need to include the message's - // size or we will match any message whose size - // is less or equal to the data offset. - // - - md5_append(md5_state_, buffer + 2, 2); -} - -void GenericRequestStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; - GenericRequestMessage *cachedGenericRequest = (GenericRequestMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Updating value " - << (unsigned) genericRequest -> opcode - << " as opcode field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((unsigned int) genericRequest -> opcode, 8, - clientCache -> genericRequestOpcodeCache); - - cachedGenericRequest -> opcode = genericRequest -> opcode; - - for (int i = 0; i < 8 && (i * 2 + 4) < genericRequest -> size_; i++) - { - #ifdef TEST - *logofs << name() << ": Updating data[" << i << "] " - << "with value " << genericRequest -> data[i] - << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((unsigned int) genericRequest -> data[i], 16, - *clientCache -> genericRequestDataCache[i]); - - cachedGenericRequest -> data[i] = genericRequest -> data[i]; - } -} - -void GenericRequestStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(genericRequest -> opcode, 8, - clientCache -> genericRequestOpcodeCache); - - #ifdef TEST - *logofs << name() << ": Updated value " - << (unsigned) genericRequest -> opcode - << " as opcode field.\n" << logofs_flush; - #endif - - unsigned int value; - - for (int i = 0; i < 8 && (i * 2 + 4) < genericRequest -> size_; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> genericRequestDataCache[i]); - - genericRequest -> data[i] = (unsigned short) value; - - #ifdef TEST - *logofs << name() << ": Updated data[" << i << "] " - << "with value " << genericRequest -> data[i] - << ".\n" << logofs_flush; - #endif - } -} diff --git a/nxcomp/GenericRequest.h b/nxcomp/GenericRequest.h deleted file mode 100644 index 13ffea718..000000000 --- a/nxcomp/GenericRequest.h +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GenericRequest_H -#define GenericRequest_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define GENERICREQUEST_ENABLE_CACHE 1 -#define GENERICREQUEST_ENABLE_DATA 1 -#define GENERICREQUEST_ENABLE_SPLIT 0 - -#define GENERICREQUEST_DATA_LIMIT 262144 - 20 -#define GENERICREQUEST_DATA_OFFSET 20 - -#define GENERICREQUEST_CACHE_SLOTS 400 -#define GENERICREQUEST_CACHE_THRESHOLD 5 -#define GENERICREQUEST_CACHE_LOWER_THRESHOLD 1 - -#define GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class GenericRequestMessage : public Message -{ - friend class GenericRequestStore; - - public: - - GenericRequestMessage() - { - } - - ~GenericRequestMessage() - { - } - - // - // Note that we consider for this message a data offset - // of 4 (or 20 starting from protocol 3). Bytes from 9 - // to 20, if present, are taken as part of identity and - // encoded through an array of int caches. - // - - private: - - unsigned char opcode; - unsigned short data[8]; -}; - -class GenericRequestStore : public MessageStore -{ - public: - - GenericRequestStore(StaticCompressor *compressor); - - virtual ~GenericRequestStore(); - - virtual const char *name() const - { - return "GenericRequest"; - } - - virtual unsigned char opcode() const - { - return X_NXInternalGenericRequest; - } - - virtual unsigned int storage() const - { - return sizeof(GenericRequestMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new GenericRequestMessage(); - } - - virtual Message *create(const Message &message) const - { - return new GenericRequestMessage((const GenericRequestMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (GenericRequestMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* GenericRequest_H */ diff --git a/nxcomp/GetImage.cpp b/nxcomp/GetImage.cpp deleted file mode 100644 index f6481b61c..000000000 --- a/nxcomp/GetImage.cpp +++ /dev/null @@ -1,173 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GetImage.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int GetImageStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetImageMessage *getImage = (GetImageMessage *) message; - - // - // Here is the fingerprint. - // - - getImage -> format = *(buffer + 1); - - #ifdef TEST - if (getImage -> format != 1 && getImage -> format != 2) - { - *logofs << name() << ": WARNING! Dirty value " << getImage -> format - << " for field format.\n" << logofs_flush; - } - #endif - - getImage -> drawable = GetULONG(buffer + 4, bigEndian); - - getImage -> x = GetUINT(buffer + 8, bigEndian); - getImage -> y = GetUINT(buffer + 10, bigEndian); - getImage -> width = GetUINT(buffer + 12, bigEndian); - getImage -> height = GetUINT(buffer + 14, bigEndian); - - getImage -> plane_mask = GetULONG(buffer + 16, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int GetImageStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetImageMessage *getImage = (GetImageMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = getImage -> format; - - PutULONG(getImage -> drawable, buffer + 4, bigEndian); - - PutUINT(getImage -> x, buffer + 8, bigEndian); - PutUINT(getImage -> y, buffer + 10, bigEndian); - PutUINT(getImage -> width, buffer + 12, bigEndian); - PutUINT(getImage -> height, buffer + 14, bigEndian); - - PutULONG(getImage -> plane_mask, buffer + 16, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void GetImageStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - GetImageMessage *getImage = (GetImageMessage *) message; - - *logofs << name() << ": Identity format " << (unsigned) getImage -> format - << ", drawable " << getImage -> drawable << ", x " << getImage -> x - << ", y " << getImage -> y << ", width " << getImage -> width - << ", height " << getImage -> height << ", plane_mask " - << getImage -> plane_mask << ", size " << getImage -> size_ - << ".\n" << logofs_flush; - - #endif -} - -void GetImageStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 8, 2); - md5_append(md5_state_, buffer + 10, 2); - md5_append(md5_state_, buffer + 12, 2); - md5_append(md5_state_, buffer + 14, 2); - md5_append(md5_state_, buffer + 16, 4); -} - -void GetImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - GetImageMessage *getImage = (GetImageMessage *) message; - GetImageMessage *cachedGetImage = (GetImageMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << getImage -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(getImage -> drawable, clientCache -> drawableCache); - - cachedGetImage -> drawable = getImage -> drawable; -} - -void GetImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - GetImageMessage *getImage = (GetImageMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - getImage -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << getImage -> drawable - << " as drawable field.\n" << logofs_flush; - #endif -} - diff --git a/nxcomp/GetImage.h b/nxcomp/GetImage.h deleted file mode 100644 index 1c3558d14..000000000 --- a/nxcomp/GetImage.h +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GetImage_H -#define GetImage_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define GETIMAGE_ENABLE_CACHE 1 -#define GETIMAGE_ENABLE_DATA 0 -#define GETIMAGE_ENABLE_SPLIT 0 -#define GETIMAGE_ENABLE_COMPRESS 0 - -#define GETIMAGE_DATA_LIMIT 0 -#define GETIMAGE_DATA_OFFSET 20 - -#define GETIMAGE_CACHE_SLOTS 200 -#define GETIMAGE_CACHE_THRESHOLD 1 -#define GETIMAGE_CACHE_LOWER_THRESHOLD 0 - -// -// The message class. -// - -class GetImageMessage : public Message -{ - friend class GetImageStore; - - public: - - GetImageMessage() - { - } - - ~GetImageMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char format; - unsigned int drawable; - unsigned short int x; - unsigned short int y; - unsigned short int width; - unsigned short int height; - unsigned int plane_mask; -}; - -class GetImageStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - GetImageStore() : MessageStore() - { - enableCache = GETIMAGE_ENABLE_CACHE; - enableData = GETIMAGE_ENABLE_DATA; - enableSplit = GETIMAGE_ENABLE_SPLIT; - enableCompress = GETIMAGE_ENABLE_COMPRESS; - - dataLimit = GETIMAGE_DATA_LIMIT; - dataOffset = GETIMAGE_DATA_OFFSET; - - cacheSlots = GETIMAGE_CACHE_SLOTS; - cacheThreshold = GETIMAGE_CACHE_THRESHOLD; - cacheLowerThreshold = GETIMAGE_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~GetImageStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "GetImage"; - } - - virtual unsigned char opcode() const - { - return X_GetImage; - } - - virtual unsigned int storage() const - { - return sizeof(GetImageMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new GetImageMessage(); - } - - virtual Message *create(const Message &message) const - { - return new GetImageMessage((const GetImageMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (GetImageMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* GetImage_H */ diff --git a/nxcomp/GetImageReply.cpp b/nxcomp/GetImageReply.cpp deleted file mode 100644 index 9b99d38e7..000000000 --- a/nxcomp/GetImageReply.cpp +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GetImageReply.h" - -#include "ServerCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -GetImageReplyStore::GetImageReplyStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = GETIMAGEREPLY_ENABLE_CACHE; - enableData = GETIMAGEREPLY_ENABLE_DATA; - enableSplit = GETIMAGEREPLY_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = GETIMAGEREPLY_DATA_LIMIT; - dataOffset = GETIMAGEREPLY_DATA_OFFSET; - - cacheSlots = GETIMAGEREPLY_CACHE_SLOTS; - cacheThreshold = GETIMAGEREPLY_CACHE_THRESHOLD; - cacheLowerThreshold = GETIMAGEREPLY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -GetImageReplyStore::~GetImageReplyStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int GetImageReplyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; - - // - // Here is the fingerprint. - // - - getImageReply -> depth = *(buffer + 1); - - getImageReply -> visual = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int GetImageReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = getImageReply -> depth; - - PutULONG(getImageReply -> visual, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void GetImageReplyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; - - *logofs << name() << ": Identity depth " << (unsigned) getImageReply -> depth - << ", visual " << getImageReply -> visual << ", size " - << getImageReply -> size_ << ".\n"; - - #endif -} - -void GetImageReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Field depth. - // - - md5_append(md5_state_, buffer + 1, 1); -} - -void GetImageReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; - - ServerCache *serverCache = (ServerCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << getImageReply -> visual - << " as visual field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(getImageReply -> visual, 29, - serverCache -> visualCache); -} - -void GetImageReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - // - // Decode the variant part. - // - - GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; - - ServerCache *serverCache = (ServerCache *) channelCache; - - decodeBuffer.decodeCachedValue(getImageReply -> visual, 29, - serverCache -> visualCache); -} diff --git a/nxcomp/GetImageReply.h b/nxcomp/GetImageReply.h deleted file mode 100644 index d4f7c4267..000000000 --- a/nxcomp/GetImageReply.h +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GetImageReply_H -#define GetImageReply_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define GETIMAGEREPLY_ENABLE_CACHE 1 -#define GETIMAGEREPLY_ENABLE_DATA 1 -#define GETIMAGEREPLY_ENABLE_SPLIT 0 - -#define GETIMAGEREPLY_DATA_LIMIT 1048576 - 32 -#define GETIMAGEREPLY_DATA_OFFSET 32 - -#define GETIMAGEREPLY_CACHE_SLOTS 1000 -#define GETIMAGEREPLY_CACHE_THRESHOLD 20 -#define GETIMAGEREPLY_CACHE_LOWER_THRESHOLD 2 - -#define GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class GetImageReplyMessage : public Message -{ - friend class GetImageReplyStore; - - public: - - GetImageReplyMessage() - { - } - - ~GetImageReplyMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char depth; - unsigned int visual; -}; - -class GetImageReplyStore : public MessageStore -{ - public: - - GetImageReplyStore(StaticCompressor *compressor); - - virtual ~GetImageReplyStore(); - - virtual const char *name() const - { - return "GetImageReply"; - } - - virtual unsigned char opcode() const - { - return X_GetImage; - } - - virtual unsigned int storage() const - { - return sizeof(GetImageReplyMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new GetImageReplyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new GetImageReplyMessage((const GetImageReplyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (GetImageReplyMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* GetImageReply_H */ diff --git a/nxcomp/GetProperty.cpp b/nxcomp/GetProperty.cpp deleted file mode 100644 index a79ebd64a..000000000 --- a/nxcomp/GetProperty.cpp +++ /dev/null @@ -1,115 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GetProperty.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int GetPropertyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetPropertyMessage *getProperty = (GetPropertyMessage *) message; - - // - // Here is the fingerprint. - // - - getProperty -> property_delete = *(buffer + 1); - - getProperty -> window = GetULONG(buffer + 4, bigEndian); - getProperty -> property = GetULONG(buffer + 8, bigEndian); - getProperty -> type = GetULONG(buffer + 12, bigEndian); - getProperty -> long_offset = GetULONG(buffer + 16, bigEndian); - getProperty -> long_length = GetULONG(buffer + 20, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int GetPropertyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - - GetPropertyMessage *getProperty = (GetPropertyMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = getProperty -> property_delete; - - PutULONG(getProperty -> window, buffer + 4, bigEndian); - PutULONG(getProperty -> property, buffer + 8, bigEndian); - PutULONG(getProperty -> type, buffer + 12, bigEndian); - PutULONG(getProperty -> long_offset, buffer + 16, bigEndian); - PutULONG(getProperty -> long_length, buffer + 20, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void GetPropertyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - GetPropertyMessage *getProperty = (GetPropertyMessage *) message; - - *logofs << name() << ": Identity property_delete " << (unsigned int) getProperty -> property_delete - << ", window " << getProperty -> window << ", property " << getProperty -> property - << ", type " << getProperty -> type << ", long-offset " << getProperty -> long_offset - << ", long-length " << getProperty -> long_length << ".\n" << logofs_flush; - - #endif -} - -void GetPropertyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 4, 20); -} diff --git a/nxcomp/GetProperty.h b/nxcomp/GetProperty.h deleted file mode 100644 index 46727280b..000000000 --- a/nxcomp/GetProperty.h +++ /dev/null @@ -1,183 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GetProperty_H -#define GetProperty_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define GETPROPERTY_ENABLE_CACHE 1 -#define GETPROPERTY_ENABLE_DATA 0 -#define GETPROPERTY_ENABLE_SPLIT 0 -#define GETPROPERTY_ENABLE_COMPRESS 0 - -#define GETPROPERTY_DATA_LIMIT 0 -#define GETPROPERTY_DATA_OFFSET 24 - -#define GETPROPERTY_CACHE_SLOTS 2000 -#define GETPROPERTY_CACHE_THRESHOLD 2 -#define GETPROPERTY_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class GetPropertyMessage : public Message -{ - friend class GetPropertyStore; - - public: - - GetPropertyMessage() - { - } - - ~GetPropertyMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char property_delete; - unsigned long window; - unsigned long property; - unsigned long type; - unsigned long long_offset; - unsigned long long_length; -}; - -class GetPropertyStore : public MessageStore -{ - - // - // Constructors and destructors. - // - - public: - - GetPropertyStore() : MessageStore() - { - enableCache = GETPROPERTY_ENABLE_CACHE; - enableData = GETPROPERTY_ENABLE_DATA; - enableSplit = GETPROPERTY_ENABLE_SPLIT; - enableCompress = GETPROPERTY_ENABLE_COMPRESS; - - dataLimit = GETPROPERTY_DATA_LIMIT; - dataOffset = GETPROPERTY_DATA_OFFSET; - - cacheSlots = GETPROPERTY_CACHE_SLOTS; - cacheThreshold = GETPROPERTY_CACHE_THRESHOLD; - cacheLowerThreshold = GETPROPERTY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~GetPropertyStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "GetProperty"; - } - - virtual unsigned char opcode() const - { - return X_GetProperty; - } - - virtual unsigned int storage() const - { - return sizeof(GetPropertyMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new GetPropertyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new GetPropertyMessage((const GetPropertyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (GetPropertyMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* GetProperty_H */ diff --git a/nxcomp/GetPropertyReply.cpp b/nxcomp/GetPropertyReply.cpp deleted file mode 100644 index 2d0657a4a..000000000 --- a/nxcomp/GetPropertyReply.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "GetPropertyReply.h" - -#include "ServerCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -GetPropertyReplyStore::GetPropertyReplyStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = GETPROPERTYREPLY_ENABLE_CACHE; - enableData = GETPROPERTYREPLY_ENABLE_DATA; - enableSplit = GETPROPERTYREPLY_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = GETPROPERTYREPLY_DATA_LIMIT; - dataOffset = GETPROPERTYREPLY_DATA_OFFSET; - - cacheSlots = GETPROPERTYREPLY_CACHE_SLOTS; - cacheThreshold = GETPROPERTYREPLY_CACHE_THRESHOLD; - cacheLowerThreshold = GETPROPERTYREPLY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -GetPropertyReplyStore::~GetPropertyReplyStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int GetPropertyReplyStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ServerCache *serverCache = (ServerCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" - << logofs_flush; - #endif - - unsigned char format = (unsigned int) *(buffer + 1); - - encodeBuffer.encodeCachedValue(format, 8, - serverCache -> getPropertyFormatCache); - - unsigned int numBytes = GetULONG(buffer + 16, bigEndian); - - encodeBuffer.encodeValue(numBytes, 32, 9); - - if (format == 16) - { - numBytes <<= 1; - } - else if (format == 32) - { - numBytes <<= 2; - } - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 29, - serverCache -> getPropertyTypeCache, 9); - - encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" - << logofs_flush; - #endif - - return 1; -} - -int GetPropertyReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ServerCache *serverCache = (ServerCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" - << logofs_flush; - #endif - - unsigned char format; - - decodeBuffer.decodeCachedValue(format, 8, - serverCache -> getPropertyFormatCache); - - unsigned int length; - - decodeBuffer.decodeValue(length, 32, 9); - - unsigned int numBytes = length; - - if (format == 16) - { - numBytes <<= 1; - } - else if (format == 32) - { - numBytes <<= 2; - } - - size = 32 + RoundUp4(numBytes); - - buffer = writeBuffer -> addMessage(size); - - *(buffer + 1) = format; - - PutULONG(length, buffer + 16, bigEndian); - - unsigned int value; - - decodeBuffer.decodeCachedValue(value, 29, - serverCache -> getPropertyTypeCache, 9); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeValue(value, 32, 9); - - PutULONG(value, buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" - << logofs_flush; - #endif - - return 1; -} - -int GetPropertyReplyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; - - getPropertyReply -> format = *(buffer + 1); - - getPropertyReply -> type = GetULONG(buffer + 8, bigEndian); - getPropertyReply -> after = GetULONG(buffer + 12, bigEndian); - getPropertyReply -> items = GetULONG(buffer + 16, bigEndian); - - // - // Cleanup the padding bytes. - // - - unsigned int uiLengthInBytes; - unsigned int uiFormat; - - if ((int) size > GETPROPERTYREPLY_DATA_OFFSET) - { - uiLengthInBytes = getPropertyReply -> items; - - uiFormat = *(buffer + 1); - - #ifdef DEBUG - *logofs << name() << ": length " << uiLengthInBytes - << ", format " << uiFormat << ", size " - << size << ".\n" << logofs_flush; - #endif - - if (uiFormat == 16) - { - uiLengthInBytes <<= 1; - } - else if (uiFormat == 32) - { - uiLengthInBytes <<= 2; - } - - unsigned char *end = ((unsigned char *) buffer) + size; - unsigned char *pad = ((unsigned char *) buffer) + GETPROPERTYREPLY_DATA_OFFSET + uiLengthInBytes; - - CleanData((unsigned char *) pad, end - pad); - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int GetPropertyReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; - - *(buffer + 1) = getPropertyReply -> format; - - PutULONG(getPropertyReply -> type, buffer + 8, bigEndian); - PutULONG(getPropertyReply -> after, buffer + 12, bigEndian); - PutULONG(getPropertyReply -> items, buffer + 16, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void GetPropertyReplyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; - - *logofs << name() << ": Identity format " - << (unsigned) getPropertyReply -> format << ", type " - << getPropertyReply -> type << ", after " << getPropertyReply -> after - << ", items " << getPropertyReply -> items << ", size " - << getPropertyReply -> size_ << ".\n"; - - #endif -} - -void GetPropertyReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Fields format, type, after, items. - // - - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 8, 12); -} - -void GetPropertyReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ -} - -void GetPropertyReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ -} diff --git a/nxcomp/GetPropertyReply.h b/nxcomp/GetPropertyReply.h deleted file mode 100644 index 01634b408..000000000 --- a/nxcomp/GetPropertyReply.h +++ /dev/null @@ -1,160 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef GetPropertyReply_H -#define GetPropertyReply_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define GETPROPERTYREPLY_ENABLE_CACHE 1 -#define GETPROPERTYREPLY_ENABLE_DATA 1 -#define GETPROPERTYREPLY_ENABLE_SPLIT 0 - -#define GETPROPERTYREPLY_DATA_LIMIT 1048576 - 32 -#define GETPROPERTYREPLY_DATA_OFFSET 32 - -#define GETPROPERTYREPLY_CACHE_SLOTS 400 -#define GETPROPERTYREPLY_CACHE_THRESHOLD 5 -#define GETPROPERTYREPLY_CACHE_LOWER_THRESHOLD 1 - -#define GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class GetPropertyReplyMessage : public Message -{ - friend class GetPropertyReplyStore; - - public: - - GetPropertyReplyMessage() - { - } - - ~GetPropertyReplyMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char format; - unsigned int type; - unsigned int after; - unsigned int items; -}; - -class GetPropertyReplyStore : public MessageStore -{ - public: - - GetPropertyReplyStore(StaticCompressor *compressor); - - virtual ~GetPropertyReplyStore(); - - virtual const char *name() const - { - return "GetPropertyReply"; - } - - virtual unsigned char opcode() const - { - return X_GetProperty; - } - - virtual unsigned int storage() const - { - return sizeof(GetPropertyReplyMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new GetPropertyReplyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new GetPropertyReplyMessage((const GetPropertyReplyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (GetPropertyReplyMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* GetPropertyReply_H */ diff --git a/nxcomp/ImageText16.cpp b/nxcomp/ImageText16.cpp deleted file mode 100644 index f3315d4ba..000000000 --- a/nxcomp/ImageText16.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ImageText16.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int ImageText16Store::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ImageText16Message *imageText16 = (ImageText16Message *) message; - - // - // Here is the fingerprint. - // - - imageText16 -> len = *(buffer + 1); - - imageText16 -> drawable = GetULONG(buffer + 4, bigEndian); - imageText16 -> gcontext = GetULONG(buffer + 8, bigEndian); - - imageText16 -> x = GetUINT(buffer + 12, bigEndian); - imageText16 -> y = GetUINT(buffer + 14, bigEndian); - - if ((int) size > dataOffset) - { - int pad = (size - dataOffset) - (imageText16 -> len * 2); - - if (pad > 0) - { - CleanData((unsigned char *) buffer + size - pad, pad); - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ImageText16Store::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ImageText16Message *imageText16 = (ImageText16Message *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = imageText16 -> len; - - PutULONG(imageText16 -> drawable, buffer + 4, bigEndian); - PutULONG(imageText16 -> gcontext, buffer + 8, bigEndian); - - PutUINT(imageText16 -> x, buffer + 12, bigEndian); - PutUINT(imageText16 -> y, buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ImageText16Store::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ImageText16Message *imageText16 = (ImageText16Message *) message; - - *logofs << name() << ": Identity len " << (unsigned int) imageText16 -> len - << " drawable " << imageText16 -> drawable << ", gcontext " - << imageText16 -> gcontext << ", x " << imageText16 -> x << ", y " - << imageText16 -> y << ", size " << imageText16 -> size_ << ".\n"; - - #endif -} - -void ImageText16Store::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); -} - -void ImageText16Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - ImageText16Message *imageText16 = (ImageText16Message *) message; - ImageText16Message *cachedImageText16 = (ImageText16Message *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText16 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(imageText16 -> drawable, clientCache -> drawableCache); - - cachedImageText16 -> drawable = imageText16 -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText16 -> gcontext - << " as " << "gcontext" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(imageText16 -> gcontext, clientCache -> gcCache); - - cachedImageText16 -> gcontext = imageText16 -> gcontext; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText16 -> x - << " as " << "x" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_x = imageText16 -> x - cachedImageText16 -> x; - - encodeBuffer.encodeCachedValue(diff_x, 16, - clientCache -> imageTextCacheX); - - cachedImageText16 -> x = imageText16 -> x; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText16 -> y - << " as " << "y" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_y = imageText16 -> y - cachedImageText16 -> y; - - encodeBuffer.encodeCachedValue(diff_y, 16, - clientCache -> imageTextCacheY); - - cachedImageText16 -> y = imageText16 -> y; -} - -void ImageText16Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - ImageText16Message *imageText16 = (ImageText16Message *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - imageText16 -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText16 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - imageText16 -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText16 -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> imageTextCacheX); - - imageText16 -> x += value; - imageText16 -> x &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText16 -> x - << " as x field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> imageTextCacheY); - - imageText16 -> y += value; - imageText16 -> y &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText16 -> y - << " as y field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/ImageText16.h b/nxcomp/ImageText16.h deleted file mode 100644 index 98462ab35..000000000 --- a/nxcomp/ImageText16.h +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ImageText16_H -#define ImageText16_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define IMAGETEXT16_ENABLE_CACHE 1 -#define IMAGETEXT16_ENABLE_DATA 0 -#define IMAGETEXT16_ENABLE_SPLIT 0 -#define IMAGETEXT16_ENABLE_COMPRESS 0 - -#define IMAGETEXT16_DATA_LIMIT 512 -#define IMAGETEXT16_DATA_OFFSET 16 - -#define IMAGETEXT16_CACHE_SLOTS 3000 -#define IMAGETEXT16_CACHE_THRESHOLD 5 -#define IMAGETEXT16_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class ImageText16Message : public Message -{ - friend class ImageText16Store; - - public: - - ImageText16Message() - { - } - - ~ImageText16Message() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char len; - - unsigned int drawable; - unsigned int gcontext; - - unsigned short x; - unsigned short y; -}; - -class ImageText16Store : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ImageText16Store() : MessageStore() - { - enableCache = IMAGETEXT16_ENABLE_CACHE; - enableData = IMAGETEXT16_ENABLE_DATA; - enableSplit = IMAGETEXT16_ENABLE_SPLIT; - enableCompress = IMAGETEXT16_ENABLE_COMPRESS; - - dataLimit = IMAGETEXT16_DATA_LIMIT; - dataOffset = IMAGETEXT16_DATA_OFFSET; - - cacheSlots = IMAGETEXT16_CACHE_SLOTS; - cacheThreshold = IMAGETEXT16_CACHE_THRESHOLD; - cacheLowerThreshold = IMAGETEXT16_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~ImageText16Store() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "ImageText16"; - } - - virtual unsigned char opcode() const - { - return X_ImageText16; - } - - virtual unsigned int storage() const - { - return sizeof(ImageText16Message); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ImageText16Message(); - } - - virtual Message *create(const Message &message) const - { - return new ImageText16Message((const ImageText16Message &) message); - } - - virtual void destroy(Message *message) const - { - delete (ImageText16Message *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* ImageText16_H */ diff --git a/nxcomp/ImageText8.cpp b/nxcomp/ImageText8.cpp deleted file mode 100644 index b0d6ac44e..000000000 --- a/nxcomp/ImageText8.cpp +++ /dev/null @@ -1,227 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ImageText8.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int ImageText8Store::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ImageText8Message *imageText8 = (ImageText8Message *) message; - - // - // Here is the fingerprint. - // - - imageText8 -> len = *(buffer + 1); - - imageText8 -> drawable = GetULONG(buffer + 4, bigEndian); - imageText8 -> gcontext = GetULONG(buffer + 8, bigEndian); - - imageText8 -> x = GetUINT(buffer + 12, bigEndian); - imageText8 -> y = GetUINT(buffer + 14, bigEndian); - - if ((int) size > dataOffset) - { - int pad = (size - dataOffset) - imageText8 -> len; - - if (pad > 0) - { - CleanData((unsigned char *) buffer + size - pad, pad); - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ImageText8Store::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ImageText8Message *imageText8 = (ImageText8Message *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = imageText8 -> len; - - PutULONG(imageText8 -> drawable, buffer + 4, bigEndian); - PutULONG(imageText8 -> gcontext, buffer + 8, bigEndian); - - PutUINT(imageText8 -> x, buffer + 12, bigEndian); - PutUINT(imageText8 -> y, buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ImageText8Store::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ImageText8Message *imageText8 = (ImageText8Message *) message; - - *logofs << name() << ": Identity len " << (unsigned int) imageText8 -> len - << " drawable " << imageText8 -> drawable << ", gcontext " - << imageText8 -> gcontext << ", x " << imageText8 -> x << ", y " - << imageText8 -> y << ", size " << imageText8 -> size_ << ".\n"; - - #endif -} - -void ImageText8Store::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); -} - -void ImageText8Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - ImageText8Message *imageText8 = (ImageText8Message *) message; - ImageText8Message *cachedImageText8 = (ImageText8Message *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText8 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(imageText8 -> drawable, clientCache -> drawableCache); - - cachedImageText8 -> drawable = imageText8 -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText8 -> gcontext - << " as " << "gcontext" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(imageText8 -> gcontext, clientCache -> gcCache); - - cachedImageText8 -> gcontext = imageText8 -> gcontext; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText8 -> x - << " as " << "x" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_x = imageText8 -> x - cachedImageText8 -> x; - - encodeBuffer.encodeCachedValue(diff_x, 16, - clientCache -> imageTextCacheX); - - cachedImageText8 -> x = imageText8 -> x; - - #ifdef TEST - *logofs << name() << ": Encoding value " << imageText8 -> y - << " as " << "y" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_y = imageText8 -> y - cachedImageText8 -> y; - - encodeBuffer.encodeCachedValue(diff_y, 16, - clientCache -> imageTextCacheY); - - cachedImageText8 -> y = imageText8 -> y; -} - -void ImageText8Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - ImageText8Message *imageText8 = (ImageText8Message *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - imageText8 -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText8 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - imageText8 -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText8 -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> imageTextCacheX); - - imageText8 -> x += value; - imageText8 -> x &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText8 -> x - << " as x field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> imageTextCacheY); - - imageText8 -> y += value; - imageText8 -> y &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << imageText8 -> y - << " as y field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/ImageText8.h b/nxcomp/ImageText8.h deleted file mode 100644 index aa9ccb5d9..000000000 --- a/nxcomp/ImageText8.h +++ /dev/null @@ -1,190 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ImageText8_H -#define ImageText8_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define IMAGETEXT8_ENABLE_CACHE 1 -#define IMAGETEXT8_ENABLE_DATA 0 -#define IMAGETEXT8_ENABLE_SPLIT 0 -#define IMAGETEXT8_ENABLE_COMPRESS 0 - -#define IMAGETEXT8_DATA_LIMIT 256 -#define IMAGETEXT8_DATA_OFFSET 16 - -#define IMAGETEXT8_CACHE_SLOTS 3000 -#define IMAGETEXT8_CACHE_THRESHOLD 5 -#define IMAGETEXT8_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class ImageText8Message : public Message -{ - friend class ImageText8Store; - - public: - - ImageText8Message() - { - } - - ~ImageText8Message() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char len; - - unsigned int drawable; - unsigned int gcontext; - - unsigned short x; - unsigned short y; -}; - -class ImageText8Store : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ImageText8Store() : MessageStore() - { - enableCache = IMAGETEXT8_ENABLE_CACHE; - enableData = IMAGETEXT8_ENABLE_DATA; - enableSplit = IMAGETEXT8_ENABLE_SPLIT; - enableCompress = IMAGETEXT8_ENABLE_COMPRESS; - - dataLimit = IMAGETEXT8_DATA_LIMIT; - dataOffset = IMAGETEXT8_DATA_OFFSET; - - cacheSlots = IMAGETEXT8_CACHE_SLOTS; - cacheThreshold = IMAGETEXT8_CACHE_THRESHOLD; - cacheLowerThreshold = IMAGETEXT8_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~ImageText8Store() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "ImageText8"; - } - - virtual unsigned char opcode() const - { - return X_ImageText8; - } - - virtual unsigned int storage() const - { - return sizeof(ImageText8Message); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ImageText8Message(); - } - - virtual Message *create(const Message &message) const - { - return new ImageText8Message((const ImageText8Message &) message); - } - - virtual void destroy(Message *message) const - { - delete (ImageText8Message *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* ImageText8_H */ diff --git a/nxcomp/IntCache.cpp b/nxcomp/IntCache.cpp deleted file mode 100644 index 362412182..000000000 --- a/nxcomp/IntCache.cpp +++ /dev/null @@ -1,226 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "Misc.h" -#include "IntCache.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -IntCache::IntCache(unsigned int size) - - : size_(size), length_(0), buffer_(new unsigned int[size]), - lastDiff_(0), lastValueInserted_(0), predictedBlockSize_(0) -{ -} - -int IntCache::lookup(unsigned int &value, unsigned int &index, - unsigned int mask, unsigned int &sameDiff) -{ - for (unsigned int i = 0; i < length_; i++) - { - if (value == buffer_[i]) - { - index = i; - if (i) - { - unsigned int target = (i >> 1); - do - { - buffer_[i] = buffer_[i - 1]; - i--; - } - while (i > target); - buffer_[target] = value; - } - return 1; - } - } - unsigned int insertionPoint; - if (2 >= length_) - insertionPoint = length_; - else - insertionPoint = 2; - unsigned int start; - if (length_ >= size_) - start = size_ - 1; - else - { - start = length_; - length_++; - } - for (unsigned int k = start; k > insertionPoint; k--) - buffer_[k] = buffer_[k - 1]; - buffer_[insertionPoint] = value; - unsigned int diff = value - lastValueInserted_; - - lastValueInserted_ = (value & mask); - value = (diff & mask); - sameDiff = (value == lastDiff_); - if (!sameDiff) - { - lastDiff_ = value; - - unsigned int lastChangeIndex = 0; - unsigned int lastBitIsOne = (lastDiff_ & 0x1); - unsigned int j = 1; - for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) - { - unsigned int nextBitIsOne = (lastDiff_ & nextMask); - if (nextBitIsOne) - { - if (!lastBitIsOne) - { - lastChangeIndex = j; - lastBitIsOne = nextBitIsOne; - } - } - else - { - if (lastBitIsOne) - { - lastChangeIndex = j; - lastBitIsOne = nextBitIsOne; - } - } - j++; - } - predictedBlockSize_ = lastChangeIndex + 1; - if (predictedBlockSize_ < 2) - predictedBlockSize_ = 2; - } - return 0; -} - -void IntCache::insert(unsigned int &value, unsigned int mask) -{ - unsigned int insertionPoint; - if (2 >= length_) - insertionPoint = length_; - else - insertionPoint = 2; - unsigned int start; - if (length_ >= size_) - start = size_ - 1; - else - { - start = length_; - length_++; - } - for (unsigned int k = start; k > insertionPoint; k--) - buffer_[k] = buffer_[k - 1]; - if (lastDiff_ != value) - { - lastDiff_ = value; - unsigned int lastChangeIndex = 0; - unsigned int lastBitIsOne = (lastDiff_ & 0x1); - unsigned int j = 1; - for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) - { - unsigned int nextBitIsOne = (lastDiff_ & nextMask); - if (nextBitIsOne) - { - if (!lastBitIsOne) - { - lastChangeIndex = j; - lastBitIsOne = nextBitIsOne; - } - } - else - { - if (lastBitIsOne) - { - lastChangeIndex = j; - lastBitIsOne = nextBitIsOne; - } - } - j++; - } - predictedBlockSize_ = lastChangeIndex + 1; - if (predictedBlockSize_ < 2) - predictedBlockSize_ = 2; - } - lastValueInserted_ += value; - lastValueInserted_ &= mask; - buffer_[insertionPoint] = lastValueInserted_; - value = lastValueInserted_; -} - -void IntCache::push(unsigned int &value, unsigned int mask) -{ - // - // Using a memmove() appears to be slower. - // - // memmove((char *) &buffer_[1], (char *) &buffer_[0], - // sizeof(unsigned int) * (size_ - 1)); - // - // if (length_ < size_) - // { - // length_++; - // } - // - - unsigned int start; - - if (length_ >= size_) - { - start = size_ - 1; - } - else - { - start = length_; - - length_++; - } - - for (unsigned int k = start; k > 0; k--) - { - buffer_[k] = buffer_[k - 1]; - } - - value &= mask; - - buffer_[0] = value; -} - -void IntCache::dump() -{ - #ifdef DUMP - - *logofs << "IntCache: Dumping content of cache at " - << (void *) this << ":\n" << logofs_flush; - - for (unsigned int i = 0; i < length_; i++) - { - *logofs << "IntCache: [" << i << "][" << buffer_[i] << "]\n"; - } - - #endif -} diff --git a/nxcomp/IntCache.h b/nxcomp/IntCache.h deleted file mode 100644 index 69c522325..000000000 --- a/nxcomp/IntCache.h +++ /dev/null @@ -1,119 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef IntCache_H -#define IntCache_H - -class IntCache -{ - public: - - IntCache(unsigned int size); - - ~IntCache() - { - delete [] buffer_; - } - - unsigned int getSize() const - { - return length_; - } - - int lookup(unsigned int &value, unsigned int &index, - unsigned int mask, unsigned int &sameDiff); - - // - // This can be inlined as it is only - // called by decodeCachedValue(). - // - - unsigned int get(unsigned int index) - { - unsigned int result = buffer_[index]; - - if (index != 0) - { - // - // Using a memmove() appears to be slower. - // - // unsigned int target = index >> 1; - // - // memmove((char *) &buffer_[target + 1], (char *) &buffer_[target], - // sizeof(unsigned int) * (index - target)); - // - // buffer_[target] = result; - // - - unsigned int i = index; - - unsigned int target = (i >> 1); - - do - { - buffer_[i] = buffer_[i - 1]; - - i--; - } - while (i > target); - - buffer_[target] = result; - } - - return result; - } - - void insert(unsigned int &value, unsigned int mask); - - void push(unsigned int &value, unsigned int mask); - - void dump(); - - unsigned int getLastDiff(unsigned int mask) const - { - return lastDiff_; - } - - unsigned int getBlockSize(unsigned int bits) const - { - if (bits > 0) - { - return (predictedBlockSize_ < bits ? predictedBlockSize_ : bits); - } - - return predictedBlockSize_; - } - - private: - - unsigned int size_; - unsigned int length_; - unsigned int *buffer_; - unsigned int lastDiff_; - unsigned int lastValueInserted_; - unsigned int predictedBlockSize_; -}; - -#endif /* IntCache_H */ diff --git a/nxcomp/InternAtom.cpp b/nxcomp/InternAtom.cpp deleted file mode 100644 index 760d72222..000000000 --- a/nxcomp/InternAtom.cpp +++ /dev/null @@ -1,127 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "InternAtom.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int InternAtomStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - InternAtomMessage *internAtom = (InternAtomMessage *) message; - - // - // Here is the fingerprint. - // - - internAtom -> only_if_exists = *(buffer + 1); - internAtom -> name_length = GetUINT(buffer + 4, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - // - // Clean up padding bytes. - // - - if ((int) size > dataOffset) - { - unsigned char *end = ((unsigned char *) buffer) + size; - - for (unsigned char *pad = ((unsigned char *) buffer) + 8 + - internAtom -> name_length; pad < end; pad++) - { - *pad = 0; - } - } - - return 1; -} - -int InternAtomStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - InternAtomMessage *internAtom = (InternAtomMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = internAtom -> only_if_exists; - - PutUINT(internAtom -> name_length, buffer + 4, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void InternAtomStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - InternAtomMessage *internAtom = (InternAtomMessage *) message; - - *logofs << name() << ": Identity only_if_exists " - << (unsigned int) internAtom -> only_if_exists - << ", name_length " << internAtom -> name_length - << ", name '"; - - for (int i = 0; i < internAtom -> name_length; i++) - { - *logofs << internAtom -> data_[i]; - } - - *logofs << "'.\n" << logofs_flush; - - #endif -} - -void InternAtomStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 4, 2); -} diff --git a/nxcomp/InternAtom.h b/nxcomp/InternAtom.h deleted file mode 100644 index 6e69eca24..000000000 --- a/nxcomp/InternAtom.h +++ /dev/null @@ -1,178 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef InternAtom_H -#define InternAtom_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define INTERNATOM_ENABLE_CACHE 1 -#define INTERNATOM_ENABLE_DATA 0 -#define INTERNATOM_ENABLE_SPLIT 0 -#define INTERNATOM_ENABLE_COMPRESS 0 - -#define INTERNATOM_DATA_LIMIT 80 -#define INTERNATOM_DATA_OFFSET 8 - -#define INTERNATOM_CACHE_SLOTS 2000 -#define INTERNATOM_CACHE_THRESHOLD 2 -#define INTERNATOM_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class InternAtomMessage : public Message -{ - friend class InternAtomStore; - - public: - - InternAtomMessage() - { - } - - ~InternAtomMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char only_if_exists; - unsigned short name_length; -}; - -class InternAtomStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - InternAtomStore() : MessageStore() - { - enableCache = INTERNATOM_ENABLE_CACHE; - enableData = INTERNATOM_ENABLE_DATA; - enableSplit = INTERNATOM_ENABLE_SPLIT; - enableCompress = INTERNATOM_ENABLE_COMPRESS; - - dataLimit = INTERNATOM_DATA_LIMIT; - dataOffset = INTERNATOM_DATA_OFFSET; - - cacheSlots = INTERNATOM_CACHE_SLOTS; - cacheThreshold = INTERNATOM_CACHE_THRESHOLD; - cacheLowerThreshold = INTERNATOM_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~InternAtomStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "InternAtom"; - } - - virtual unsigned char opcode() const - { - return X_InternAtom; - } - - virtual unsigned int storage() const - { - return sizeof(InternAtomMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new InternAtomMessage(); - } - - virtual Message *create(const Message &message) const - { - return new InternAtomMessage((const InternAtomMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (InternAtomMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* InternAtom_H */ diff --git a/nxcomp/Jpeg.cpp b/nxcomp/Jpeg.cpp deleted file mode 100644 index 54fa71d21..000000000 --- a/nxcomp/Jpeg.cpp +++ /dev/null @@ -1,886 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#ifdef ANDROID -#include -#endif -#include -#include -#include - -#ifdef __cplusplus - -extern "C" -{ - #include - #include -} - -#else - -#include -#include - -#endif - -#include "Misc.h" -#include "Jpeg.h" -#include "Unpack.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define RGB24_TO_PIXEL(bpp,r,g,b) \ - ((((CARD##bpp)(r) & 0xff) * srcRedMax + 127) / 255 \ - << srcRedShift | \ - (((CARD##bpp)(g) & 0xff) * srcGreenMax + 127) / 255 \ - << srcGreenShift | \ - (((CARD##bpp)(b) & 0xff) * srcBlueMax + 127) / 255 \ - << srcBlueShift) - -#define RGB24_TO_PIXEL32(r,g,b) \ - (((CARD32)(r) & 0xff) << srcRedShift | \ - ((CARD32)(g) & 0xff) << srcGreenShift | \ - ((CARD32)(b) & 0xff) << srcBlueShift) - -// -// Functions from Unpack.cpp -// - -extern int Unpack32To32(const T_colormask *colormask, const unsigned int *data, - unsigned int *out, unsigned int *end); - -extern int Unpack24To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -extern int Unpack16To16(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -// -// Local functions used for the jpeg decompression. -// - -static void JpegSetSrcManager(j_decompress_ptr cinfo, CARD8 *compressedData, int compressedLen); -static void JpegInitSource(j_decompress_ptr cinfo); -static void JpegTermSource(j_decompress_ptr cinfo); -static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes); - -static boolean JpegFillInputBuffer(j_decompress_ptr cinfo); - -static int DecompressJpeg16(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); - -static int DecompressJpeg24(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); - -static int DecompressJpeg32(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); - -void UnpackJpegErrorHandler(j_common_ptr cinfo); - -// -// Colormap stuff. -// - -CARD16 srcRedMax, srcGreenMax, srcBlueMax; -CARD8 srcRedShift, srcGreenShift, srcBlueShift; - -// -// Error handler. -// - -static bool jpegError; - -jmp_buf UnpackJpegContext; - -void UnpackJpegErrorHandler(j_common_ptr cinfo) -{ - #ifdef PANIC - *logofs << "UnpackJpegErrorHandler: PANIC! Detected error in JPEG decompression.\n" - << logofs_flush; - - *logofs << "UnpackJpegErrorHandler: PANIC! Trying to revert to the previous context.\n" - << logofs_flush; - #endif - - jpegError = 1; - - longjmp(UnpackJpegContext, 1); -} - -// -// Attributes used for the jpeg decompression. -// - -static struct jpeg_source_mgr jpegSrcManager; -static JOCTET *jpegBufferPtr; -static size_t jpegBufferLen; - -static char *tmpBuf; -static int tmpBufSize = 0; - -int UnpackJpeg(T_geometry *geometry, unsigned char method, unsigned char *srcData, - int srcSize, int dstBpp, int dstWidth, int dstHeight, - unsigned char *dstData, int dstSize) -{ - int byteOrder = geometry -> image_byte_order; - - // - // Check if data is coming from a failed unsplit. - // - - if (srcSize < 2 || (srcData[0] == SPLIT_PATTERN && - srcData[1] == SPLIT_PATTERN)) - { - #ifdef WARNING - *logofs << "UnpackJpeg: WARNING! Skipping unpack of dummy data.\n" - << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << "UnpackJpeg: Decompression. Source size " - << srcSize << " bits per plane " << dstBpp - << ".\n" << logofs_flush; - #endif - - srcRedShift = ffs(geometry -> red_mask) - 1; - srcGreenShift = ffs(geometry -> green_mask) - 1; - srcBlueShift = ffs(geometry -> blue_mask) - 1; - - #ifdef DEBUG - *logofs << "UnpackJpeg: Red shift " << (int) srcRedShift - << " green shift " << (int) srcGreenShift << " blue shift " - << (int) srcBlueShift << ".\n" << logofs_flush; - #endif - - srcRedMax = geometry -> red_mask >> srcRedShift; - srcGreenMax = geometry -> green_mask >> srcGreenShift; - srcBlueMax = geometry -> blue_mask >> srcBlueShift; - - #ifdef DEBUG - *logofs << "UnpackJpeg: Red mask " << (void *) geometry -> red_mask - << " green mask " << (void *) geometry -> green_mask - << " blue mask " << (void *) geometry -> blue_mask - << ".\n" << logofs_flush; - #endif - - #ifdef DEBUG - *logofs << "UnpackJpeg: Red max " << srcRedMax << " green max " - << srcGreenMax << " blue max " << srcBlueMax - << ".\n" << logofs_flush; - #endif - - // - // Make enough space in the temporary - // buffer to have one complete row of - // the image with 3 bytes for a pixel. - // - - tmpBufSize = dstWidth * 3; - tmpBuf = new char[tmpBufSize]; - - if (tmpBuf == NULL) - { - #ifdef PANIC - *logofs << "UnpackJpeg: PANIC! Cannot allocate " - << dstWidth * 3 << " bytes for Jpeg " - << "decompressed data.\n" << logofs_flush; - #endif - - delete [] tmpBuf; - - return -1; - } - - int result = 1; - - switch(dstBpp) - { - case 8: - { - // - // Simply move the data from srcData to dstData - // taking into consideration the correct padding. - // - - int row; - - unsigned char * dstBuff = dstData; - unsigned char * srcBuff = srcData; - - for (row = 0; row < dstHeight; row++) - { - memcpy(dstBuff, srcBuff, dstWidth); - - dstBuff += RoundUp4(dstWidth); - srcBuff += dstWidth; - } - - break; - } - case 16: - { - result = DecompressJpeg16(srcData, srcSize, dstWidth, - dstHeight, dstData, byteOrder); - break; - } - case 24: - { - result = DecompressJpeg24(srcData, srcSize, dstWidth, - dstHeight, dstData, byteOrder); - break; - } - case 32: - { - result = DecompressJpeg32(srcData, srcSize, dstWidth, - dstHeight, dstData, byteOrder); - break; - } - default: - { - #ifdef PANIC - *logofs << "UnpackJpeg: PANIC! Failed to decode Jpeg image. " - << " Unsupported Bpp value " << dstBpp - << " for the Jpeg compression" - << ".\n" << logofs_flush; - #endif - - delete [] tmpBuf; - - result = -1; - } - } - - #ifdef DEBUG - *logofs << "UnpackJpeg: Decompression finished with result " - << result << ".\n" << logofs_flush; - #endif - - if (result == -1) - { - delete [] tmpBuf; - - #ifdef PANIC - *logofs << "UnpackJpeg: PANIC! Failed to decode Jpeg image using " - << dstBpp << " Bpp destination.\n" << logofs_flush; - #endif - - return result; - } - - // - // Apply the correction for the brightness. - // - - int maskMethod; - - switch(method) - { - case PACK_JPEG_8_COLORS: - { - maskMethod = MASK_8_COLORS; - - break; - } - case PACK_JPEG_64_COLORS: - { - maskMethod = MASK_64_COLORS; - - break; - } - case PACK_JPEG_256_COLORS: - { - maskMethod = MASK_256_COLORS; - - break; - } - case PACK_JPEG_512_COLORS: - { - maskMethod = MASK_512_COLORS; - - break; - } - case PACK_JPEG_4K_COLORS: - { - maskMethod = MASK_4K_COLORS; - - break; - } - case PACK_JPEG_32K_COLORS: - { - maskMethod = MASK_32K_COLORS; - - break; - } - case PACK_JPEG_64K_COLORS: - { - maskMethod = MASK_64K_COLORS; - - break; - } - case PACK_JPEG_256K_COLORS: - { - maskMethod = MASK_256K_COLORS; - - break; - } - case PACK_JPEG_2M_COLORS: - { - maskMethod = MASK_2M_COLORS; - - break; - } - case PACK_JPEG_16M_COLORS: - { - maskMethod = MASK_16M_COLORS; - - break; - } - default: - { - delete [] tmpBuf; - - return -1; - } - } - - const T_colormask *colorMask = MethodColorMask(maskMethod); - - unsigned char *dstBuff = dstData; - - switch (dstBpp) - { - case 16: - { - Unpack16To16(colorMask, dstBuff, dstBuff, dstBuff + dstSize); - - break; - } - case 24: - { - break; - } - case 32: - { - Unpack32To32(colorMask, (unsigned int *) dstBuff, (unsigned int *) dstBuff, - (unsigned int *) (dstBuff + dstSize)); - break; - } - default: - { - delete [] tmpBuf; - - return -1; - } - } - - delete [] tmpBuf; - - return 1; -} - -// -// Functions that actually do the Jpeg decompression. -// - -int DecompressJpeg16(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) -{ - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - unsigned char *data; - JSAMPROW rowPointer[1]; - - unsigned int dx = 0; - unsigned int dy = 0; - - #ifdef DEBUG - *logofs << "DecompressJpeg16: Decompressing with length " - << compressedLen << " width " << w << " height " - << h << ".\n" << logofs_flush; - #endif - - jpegError = 0; - - cinfo.err = jpeg_std_error(&jerr); - - jerr.error_exit = UnpackJpegErrorHandler; - - if (setjmp(UnpackJpegContext) == 1) - { - #ifdef TEST - *logofs << "DecompressJpeg16: Out of the long jump with error '" - << jpegError << "'.\n" << logofs_flush; - #endif - - goto AbortDecompressJpeg16; - } - - jpeg_create_decompress(&cinfo); - - if (jpegError) goto AbortDecompressJpeg16; - - JpegSetSrcManager(&cinfo, compressedData, compressedLen); - - jpeg_read_header(&cinfo, TRUE); - - if (jpegError) goto AbortDecompressJpeg16; - - cinfo.out_color_space = JCS_RGB; - - jpeg_start_decompress(&cinfo); - - if (jpegError) goto AbortDecompressJpeg16; - - if (cinfo.output_width != w || - cinfo.output_height != h || - cinfo.output_components != 3) - { - #ifdef PANIC - *logofs << "DecompressJpeg16: PANIC! Wrong JPEG data received.\n" - << logofs_flush; - #endif - - jpeg_destroy_decompress(&cinfo); - - return -1; - } - - // - // PixelPtr points to dstBuf which is - // already padded correctly for the final - // image to put - // - - data = dstBuf; - - rowPointer[0] = (JSAMPROW) tmpBuf; - - unsigned long pixel; - - while (cinfo.output_scanline < cinfo.output_height) - { - jpeg_read_scanlines(&cinfo, rowPointer, 1); - - if (jpegError) goto AbortDecompressJpeg16; - - for (dx = 0; dx < w; dx++) - { - pixel = RGB24_TO_PIXEL(16, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], - tmpBuf[dx * 3 + 2]); - - // - // Follow the server byte order when arranging data. - // - - if (byteOrder == LSBFirst) - { - data[0] = (unsigned char) (pixel & 0xff); - data[1] = (unsigned char) ((pixel >> 8) & 0xff); - } - else - { - data[1] = (unsigned char) (pixel & 0xff); - data[0] = (unsigned char) ((pixel >> 8) & 0xff); - } - - data += 2; - } - - // - // Move data at the beginning of the - // next line. - // - - data = data + (RoundUp4(w * 2) - w * 2); - - dy++; - } - - AbortDecompressJpeg16: - - if (jpegError == 0) - { - jpeg_finish_decompress(&cinfo); - } - - jpeg_destroy_decompress(&cinfo); - - if (jpegError == 1) - { - #ifdef PANIC - *logofs << "DecompressJpeg16: Failed to decompress JPEG image.\n" - << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "DecompressJpeg16: Decompression finished with " - << dy << " lines handled.\n" << logofs_flush; - #endif - - return 1; -} - -int DecompressJpeg24(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) -{ - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - CARD8 *pixelPtr = NULL; - JSAMPROW rowPointer[1]; - - unsigned int dx = 0; - unsigned int dy = 0; - - #ifdef TEST - *logofs << "DecompressJpeg24: Decompressing with length " - << compressedLen << " width " << w << " height " - << h << ".\n" << logofs_flush; - #endif - - jpegError = 0; - - cinfo.err = jpeg_std_error(&jerr); - - jerr.error_exit = UnpackJpegErrorHandler; - - if (setjmp(UnpackJpegContext) == 1) - { - #ifdef TEST - *logofs << "DecompressJpeg24: Out of the long jump with error '" - << jpegError << "'.\n" << logofs_flush; - #endif - - goto AbortDecompressJpeg24; - } - - jpeg_create_decompress(&cinfo); - - if (jpegError) goto AbortDecompressJpeg24; - - JpegSetSrcManager(&cinfo, compressedData, compressedLen); - - jpeg_read_header(&cinfo, TRUE); - - if (jpegError) goto AbortDecompressJpeg24; - - cinfo.out_color_space = JCS_RGB; - - jpeg_start_decompress(&cinfo); - - if (jpegError) goto AbortDecompressJpeg24; - - if (cinfo.output_width != w || - cinfo.output_height != h || - cinfo.output_components != 3) - { - #ifdef PANIC - *logofs << "DecompressJpeg24: PANIC! Wrong JPEG data received.\n" - << logofs_flush; - #endif - - jpeg_destroy_decompress(&cinfo); - - return -1; - } - - // - // PixelPtr points to dstBuf which is - // already padded correctly for the final - // image to put. - // - - pixelPtr = (CARD8 *) dstBuf; - - rowPointer[0] = (JSAMPROW) tmpBuf; - - while (cinfo.output_scanline < cinfo.output_height) - { - jpeg_read_scanlines(&cinfo, rowPointer, 1); - - if (jpegError) goto AbortDecompressJpeg24; - - for (dx = 0; dx < w; dx++) - { - // - // Follow the server byte order when arranging data. - // - - if (byteOrder == LSBFirst) - { - pixelPtr[0] = tmpBuf[dx * 3]; - pixelPtr[1] = tmpBuf[dx * 3 + 1]; - pixelPtr[2] = tmpBuf[dx * 3 + 2]; - } - else - { - pixelPtr[2] = tmpBuf[dx * 3]; - pixelPtr[1] = tmpBuf[dx * 3 + 1]; - pixelPtr[0] = tmpBuf[dx * 3 + 2]; - } - - pixelPtr += 3; - } - - // - // Go to the next line. - // - - pixelPtr = (CARD8 *) (((char *) pixelPtr) + (RoundUp4(w * 3) - w * 3)); - - dy++; - } - - AbortDecompressJpeg24: - - if (jpegError == 0) - { - jpeg_finish_decompress(&cinfo); - } - - jpeg_destroy_decompress(&cinfo); - - if (jpegError == 1) - { - #ifdef PANIC - *logofs << "DecompressJpeg24: Failed to decompress JPEG image.\n" - << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "DecompressJpeg24: Decompression finished with " - << dy << " lines handled.\n" << logofs_flush; - #endif - - return 1; -} - -int DecompressJpeg32(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) -{ - struct jpeg_decompress_struct cinfo; - struct jpeg_error_mgr jerr; - unsigned char *data; - JSAMPROW rowPointer[1]; - - unsigned int dx = 0; - unsigned int dy = 0; - - #ifdef TEST - *logofs << "DecompressJpeg32: Decompressing with length " - << compressedLen << " width " << w << " height " - << h << ".\n" << logofs_flush; - #endif - - jpegError = 0; - - cinfo.err = jpeg_std_error(&jerr); - - jerr.error_exit = UnpackJpegErrorHandler; - - if (setjmp(UnpackJpegContext) == 1) - { - #ifdef TEST - *logofs << "DecompressJpeg32: Out of the long jump with error '" - << jpegError << "'.\n" << logofs_flush; - #endif - - goto AbortDecompressJpeg32; - } - - jpeg_create_decompress(&cinfo); - - if (jpegError) goto AbortDecompressJpeg32; - - JpegSetSrcManager(&cinfo, compressedData, compressedLen); - - jpeg_read_header(&cinfo, TRUE); - - if (jpegError) goto AbortDecompressJpeg32; - - cinfo.out_color_space = JCS_RGB; - - jpeg_start_decompress(&cinfo); - - if (jpegError) goto AbortDecompressJpeg32; - - if (cinfo.output_width != w || - cinfo.output_height != h || - cinfo.output_components != 3) - { - #ifdef PANIC - *logofs << "DecompressJpeg32 : PANIC! Wrong JPEG data received.\n" - << logofs_flush; - #endif - - jpeg_destroy_decompress(&cinfo); - - return -1; - } - - // - // PixelPtr points to dstBuf which is - // already padded correctly for the final - // image to put - // - - data = dstBuf; - - rowPointer[0] = (JSAMPROW) tmpBuf; - - unsigned long pixel; - - int i; - - while (cinfo.output_scanline < cinfo.output_height) - { - jpeg_read_scanlines(&cinfo, rowPointer, 1); - - if (jpegError) goto AbortDecompressJpeg32; - - for (dx = 0; dx < w; dx++) - { - pixel = RGB24_TO_PIXEL(32, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], - tmpBuf[dx * 3 + 2]); - - // - // Follow the server byte order when arranging data. - // - - if (byteOrder == LSBFirst) - { - for (i = 0; i < 4; i++) - { - data[i] = (unsigned char)(pixel & 0xff); - pixel >>= 8; - } - } - else - { - for (i = 3; i >= 0; i--) - { - data[i] = (unsigned char) (pixel & 0xff); - pixel >>= 8; - } - } - - data += 4; - } - - dy++; - } - - AbortDecompressJpeg32: - - if (jpegError == 0) - { - jpeg_finish_decompress(&cinfo); - } - - jpeg_destroy_decompress(&cinfo); - - if (jpegError == 1) - { - #ifdef PANIC - *logofs << "DecompressJpeg32: Failed to decompress JPEG image.\n" - << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "DecompressJpeg32: Decompression finished with " - << dy << " lines handled.\n" << logofs_flush; - #endif - - return 1; -} - -static void JpegInitSource(j_decompress_ptr cinfo) -{ - jpegError = 0; -} - -static boolean JpegFillInputBuffer(j_decompress_ptr cinfo) -{ - jpegError = 1; - - jpegSrcManager.bytes_in_buffer = jpegBufferLen; - jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; - - return TRUE; -} - -static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes) -{ - if (num_bytes < 0 || (unsigned long) num_bytes > jpegSrcManager.bytes_in_buffer) - { - jpegError = 1; - - jpegSrcManager.bytes_in_buffer = jpegBufferLen; - jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; - } - else - { - jpegSrcManager.next_input_byte += (size_t) num_bytes; - jpegSrcManager.bytes_in_buffer -= (size_t) num_bytes; - } -} - -static void JpegTermSource(j_decompress_ptr cinfo) -{ -} - -static void JpegSetSrcManager(j_decompress_ptr cinfo, - CARD8 *compressedData, - int compressedLen) -{ - jpegBufferPtr = (JOCTET *) compressedData; - jpegBufferLen = (size_t) compressedLen; - - jpegSrcManager.init_source = JpegInitSource; - jpegSrcManager.fill_input_buffer = JpegFillInputBuffer; - jpegSrcManager.skip_input_data = JpegSkipInputData; - jpegSrcManager.resync_to_restart = jpeg_resync_to_restart; - jpegSrcManager.term_source = JpegTermSource; - jpegSrcManager.next_input_byte = jpegBufferPtr; - jpegSrcManager.bytes_in_buffer = jpegBufferLen; - - cinfo->src = &jpegSrcManager; -} diff --git a/nxcomp/Jpeg.h b/nxcomp/Jpeg.h deleted file mode 100644 index 58a5bffef..000000000 --- a/nxcomp/Jpeg.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Jpeg_H -#define Jpeg_H - -#include "Misc.h" -#include "Unpack.h" - -int UnpackJpeg(T_geometry *geometry, unsigned char method, unsigned char *srcData, - int srcSize, int dstBpp, int dstWidth, int dstHeight, - unsigned char *dstData, int dstSize); - -#endif /* Jpeg_H */ diff --git a/nxcomp/Keeper.cpp b/nxcomp/Keeper.cpp deleted file mode 100644 index 7e8cd0cd7..000000000 --- a/nxcomp/Keeper.cpp +++ /dev/null @@ -1,608 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include - -#include "Keeper.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Remove the directory if it's empty -// since more than 30 * 24 h. -// - -#define EMPTY_DIR_TIME 2592000 - -// -// Sleep once any ONCE entries. -// - -#define ONCE 2 - -// -// Define this to trace messages while -// they are allocated and deallocated. -// - -#undef REFERENCES - -// -// This is used for reference count. -// - -#ifdef REFERENCES - -int File::references_ = 0; - -#endif - -bool T_older::operator () (File *a, File *b) const -{ - return a -> compare(b); -} - -File::File() -{ - name_ = NULL; - - size_ = 0; - time_ = 0; - - #ifdef REFERENCES - - references_++; - - *logofs << "Keeper: Created new File at " - << this << " out of " << references_ - << " allocated references.\n" - << logofs_flush; - - #endif -} - -// -// TODO: This class can leak industrial amounts of memory. -// I'm 100% sure that the desctructor is called and that -// also the string pointed in the File structure is dele- -// ted. Everything is logged, but still the memory is not -// freed. This is less a problem on Windows, where the me- -// mory occupation remains almost constant. Obviously the -// problem lies in the STL allocators of the GNU libstc++. -// - -File::~File() -{ - #ifdef TEST - *logofs << "Keeper: Deleting name for File at " - << this << ".\n" << logofs_flush; - #endif - - delete [] name_; - - #ifdef REFERENCES - - *logofs << "Keeper: Deleted File at " - << this << " out of " << references_ - << " allocated references.\n" - << logofs_flush; - - references_--; - - #endif -} - -bool File::compare(File *b) const -{ - if (this -> time_ == b -> time_) - { - return (this -> size_ < b -> size_); - } - - return (this -> time_ < b -> time_); -} - -Keeper::Keeper(int caches, int images, const char *root, - int sleep, int parent) -{ - caches_ = caches; - images_ = images; - sleep_ = sleep; - parent_ = parent; - - root_ = new char[strlen(root) + 1]; - - strcpy(root_, root); - - total_ = 0; - signal_ = 0; - - files_ = new T_files; -} - -Keeper::~Keeper() -{ - empty(); - - delete files_; - - delete [] root_; -} - -int Keeper::cleanupCaches() -{ - #ifdef TEST - *logofs << "Keeper: Looking for cache directories in '" - << root_ << "'.\n" << logofs_flush; - #endif - - DIR *rootDir = opendir(root_); - - if (rootDir != NULL) - { - dirent *dirEntry; - - struct stat fileStat; - - int baseSize = strlen(root_); - - int s = 0; - - while (((dirEntry = readdir(rootDir)) != NULL)) - { - if (s++ % ONCE == 0) usleep(sleep_ * 1000); - - if (signal_ != 0) break; - - if (strcmp(dirEntry -> d_name, "cache") == 0 || - strncmp(dirEntry -> d_name, "cache-", 6) == 0) - { - char *dirName = new char[baseSize + strlen(dirEntry -> d_name) + 2]; - - if (dirName == NULL) - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Can't check directory entry '" - << dirEntry -> d_name << "'.\n" << logofs_flush; - #endif - - delete [] dirName; - - continue; - } - - strcpy(dirName, root_); - strcpy(dirName + baseSize, "/"); - strcpy(dirName + baseSize + 1, dirEntry -> d_name); - - #ifdef TEST - *logofs << "Keeper: Checking directory '" << dirName - << "'.\n" << logofs_flush; - #endif - - if (stat(dirName, &fileStat) == 0 && - S_ISDIR(fileStat.st_mode) != 0) - { - // - // Add to repository all the "C-" and - // "S-" files in the given directory. - // - - collect(dirName); - } - - delete [] dirName; - } - } - - closedir(rootDir); - } - else - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Can't open NX root directory '" - << root_ << "'. Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Can't open NX root directory '" - << root_ << "'. Error is " << EGET() << " '" - << ESTR() << "'.\n"; - } - - // - // Remove older files. - // - - cleanup(caches_); - - // - // Empty the repository. - // - - empty(); - - return 1; -} - -int Keeper::cleanupImages() -{ - #ifdef TEST - *logofs << "Keeper: Looking for image directory in '" - << root_ << "'.\n" << logofs_flush; - #endif - - char *imagesPath = new char[strlen(root_) + strlen("/images") + 1]; - - if (imagesPath == NULL) - { - return -1; - } - - strcpy(imagesPath, root_); - strcat(imagesPath, "/images"); - - // - // Check if the cache directory does exist. - // - - struct stat dirStat; - - if (stat(imagesPath, &dirStat) == -1) - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Can't stat NX images cache directory '" - << imagesPath << ". Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Can't stat NX images cache directory '" - << imagesPath << ". Error is " << EGET() << " '" - << ESTR() << "'.\n"; - - delete [] imagesPath; - - return -1; - } - - // - // Check any of the 16 directories in the - // images root path. - // - - char *digitPath = new char[strlen(imagesPath) + 5]; - - strcpy(digitPath, imagesPath); - - for (char digit = 0; digit < 16; digit++) - { - // - // Give up if we received a signal or - // our parent is gone. - // - - if (signal_ != 0) - { - #ifdef TEST - *logofs << "Keeper: Signal detected. Aborting.\n" - << logofs_flush; - #endif - - goto KeeperCleanupImagesAbort; - } - else if (parent_ != getppid() || parent_ == 1) - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Parent process appears " - << "to be dead. Returning.\n" - << logofs_flush; - #endif - - goto KeeperCleanupImagesAbort; - - return 0; - } - - sprintf(digitPath + strlen(imagesPath), "/I-%01X", digit); - - // - // Add to the repository all the files - // in the given directory. - // - - collect(digitPath); - } - - delete [] imagesPath; - delete [] digitPath; - - // - // Remove the oldest files. - // - - cleanup(images_); - - // - // Empty the repository. - // - - empty(); - - return 1; - -KeeperCleanupImagesAbort: - - delete [] imagesPath; - delete [] digitPath; - - empty(); - - return 0; -} - -int Keeper::collect(const char *path) -{ - #ifdef TEST - *logofs << "Keeper: Looking for files in directory '" - << path << "'.\n" << logofs_flush; - #endif - - DIR *cacheDir = opendir(path); - - if (cacheDir != NULL) - { - File *file; - - dirent *dirEntry; - - struct stat fileStat; - - int baseSize = strlen(path); - int fileSize = baseSize + 3 + MD5_LENGTH * 2 + 1; - - int n = 0; - int s = 0; - - while (((dirEntry = readdir(cacheDir)) != NULL)) - { - if (s++ % ONCE == 0) usleep(sleep_ * 1000); - - if (signal_ != 0) break; - - if (strcmp(dirEntry -> d_name, ".") == 0 || - strcmp(dirEntry -> d_name, "..") == 0) - { - continue; - } - - n++; - - if (strlen(dirEntry -> d_name) == (MD5_LENGTH * 2 + 2) && - (strncmp(dirEntry -> d_name, "I-", 2) == 0 || - strncmp(dirEntry -> d_name, "S-", 2) == 0 || - strncmp(dirEntry -> d_name, "C-", 2) == 0)) - { - file = new File(); - - char *fileName = new char[fileSize]; - - if (file == NULL || fileName == NULL) - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Can't add file '" - << dirEntry -> d_name << "' to repository.\n" - << logofs_flush; - #endif - - delete [] fileName; - - delete file; - - continue; - } - - strcpy(fileName, path); - strcpy(fileName + baseSize, "/"); - strcpy(fileName + baseSize + 1, dirEntry -> d_name); - - file -> name_ = fileName; - - #ifdef DEBUG - *logofs << "Keeper: Adding file '" << file -> name_ - << "'.\n" << logofs_flush; - #endif - - if (stat(file -> name_, &fileStat) == -1) - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Can't stat NX file '" - << file -> name_ << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - delete file; - - continue; - } - - file -> size_ = fileStat.st_size; - file -> time_ = fileStat.st_mtime; - - files_ -> insert(T_files::value_type(file)); - - total_ += file -> size_; - } - } - - closedir(cacheDir); - - if (n == 0) - { - time_t now = time(NULL); - - if (now > 0 && stat(path, &fileStat) == 0) - { - #ifdef TEST - *logofs << "Keeper: Empty NX subdirectory '" << path - << "' unused since " << now - fileStat.st_mtime - << " S.\n" << logofs_flush; - #endif - - if (now - fileStat.st_mtime > EMPTY_DIR_TIME) - { - #ifdef TEST - *logofs << "Keeper: Removing empty NX subdirectory '" - << path << "'.\n" << logofs_flush; - #endif - - rmdir(path); - } - } - } - } - else - { - #ifdef WARNING - *logofs << "Keeper: WARNING! Can't open NX subdirectory '" - << path << ". Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Can't open NX subdirectory '" - << path << ". Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - - return 1; -} - -int Keeper::cleanup(int threshold) -{ - #ifdef TEST - *logofs << "Keeper: Deleting the oldest files with " - << files_ -> size() << " elements threshold " - << threshold << " and size " << total_ << ".\n" - << logofs_flush; - #endif - - // - // At least some versions of the standard - // library don't allow erasing an element - // while looping. This is not the most ef- - // ficient way to release the objects, but - // it's better than making a copy of the - // container. - // - - while (total_ > threshold && files_ -> size() > 0) - { - T_files::iterator i = files_ -> begin(); - - File *file = *i; - - #ifdef TEST - *logofs << "Keeper: Removing '" << file -> name_ - << "' with time " << file -> time_ << " and size " - << file -> size_ << ".\n" << logofs_flush; - #endif - - unlink(file -> name_); - - total_ -= file -> size_; - - #ifdef DEBUG - *logofs << "Keeper: Going to delete the file at " - << file << " while cleaning up.\n" - << logofs_flush; - #endif - - delete file; - - #ifdef DEBUG - *logofs << "Keeper: Going to erase the element " - << "while cleaning up.\n" - << logofs_flush; - #endif - - files_ -> erase(i); - } - - #ifdef TEST - *logofs << "Keeper: Bytes in repository are " - << total_ << ".\n" << logofs_flush; - #endif - - return 1; -} - -void Keeper::empty() -{ - #ifdef TEST - *logofs << "Keeper: Getting rid of files in repository.\n" - << logofs_flush; - #endif - - while (files_ -> size() > 0) - { - T_files::iterator i = files_ -> begin(); - - File *file = *i; - - #ifdef DEBUG - *logofs << "Keeper: Going to delete the file at " - << file << " while emptying.\n" - << logofs_flush; - #endif - - delete file; - - #ifdef DEBUG - *logofs << "Keeper: Going to erase the element " - << "while emptying.\n" - << logofs_flush; - #endif - - files_ -> erase(i); - } - - total_ = 0; - - #ifdef TEST - *logofs << "Keeper: Bytes in repository are " - << total_ << ".\n" << logofs_flush; - #endif -} diff --git a/nxcomp/Keeper.h b/nxcomp/Keeper.h deleted file mode 100644 index b440beceb..000000000 --- a/nxcomp/Keeper.h +++ /dev/null @@ -1,199 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Keeper_H -#define Keeper_H - -#include "Misc.h" -#include "Types.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to check how many file -// nodes are allocated and deallocated. -// - -#undef REFERENCES - -class Keeper; - -class File -{ - friend class Keeper; - - public: - - File(); - - ~File(); - - // - // Allow sort by time and size. If time - // is the same, keep the bigger element. - // - - bool compare(File *b) const; - - private: - - char *name_; - - int size_; - time_t time_; - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -class Keeper -{ - public: - - Keeper(int caches, int images, const char *root, - int sleep, int parent); - - ~Keeper(); - - // - // Call this just once. - // - - int cleanupCaches(); - - // - // Call this at any given interval. - // - - int cleanupImages(); - - // - // Call this if it's time to exit. - // - - void setSignal(int signal) - { - signal_ = signal; - } - - int getSignal() - { - return signal_; - } - - int getParent() - { - return parent_; - } - - private: - - // - // Get a list of files in directory. - // - - int collect(const char *path); - - // - // Sort the collected files according to - // last modification time and delete the - // older ones until disk size is below - // the threshold. - // - - int cleanup(int threshold); - - // - // Empty the files repository. - // - - void empty(); - - // - // Size in bytes of total allowed - // storage for persistent caches. - // - - int caches_; - - // - // Size in bytes of total allowed - // storage for images cache. - // - - int images_; - - // - // Path of the NX root directory. - // - - char *root_; - - // - // The little delay to be introduced - // before reading a new entry. - // - - int sleep_; - - // - // Total size of files in repository. - // - - int total_; - - // - // The parent process, so we can exit - // if it is gone. - // - - int parent_; - - // - // Set if we need to give up because - // of a signal. - // - - int signal_; - - // - // Repository where to collect files. - // - - T_files *files_; -}; - -#endif /* Keeper_H */ - diff --git a/nxcomp/List.cpp b/nxcomp/List.cpp deleted file mode 100644 index 228f83214..000000000 --- a/nxcomp/List.cpp +++ /dev/null @@ -1,108 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "List.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to know how many instances -// are allocated and deallocated. -// - -#undef REFERENCES - -#ifdef REFERENCES - -int List::references_ = 0; - -#endif - -List::List() -{ - #ifdef REFERENCES - - references_++; - - *logofs << "List: Created new List at " - << this << " out of " << references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -List::~List() -{ - #ifdef REFERENCES - - references_--; - - *logofs << "List: Deleted List at " - << this << " out of " << references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -void List::remove(int value) -{ - for (T_list::iterator i = list_.begin(); i != list_.end(); i++) - { - if (*i == value) - { - list_.erase(i); - - return; - } - } - - #ifdef PANIC - *logofs << "List: PANIC! Should not try to remove " - << "an element not found in the list.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Should not try to remove " - << "an element not found in the list.\n"; - - HandleAbort(); -} - -void List::rotate() -{ - if (list_.size() > 1) - { - int value = *(list_.begin()); - - list_.pop_front(); - - list_.push_back(value); - } -} diff --git a/nxcomp/List.h b/nxcomp/List.h deleted file mode 100644 index 31c80f835..000000000 --- a/nxcomp/List.h +++ /dev/null @@ -1,95 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef List_H -#define List_H - -#include "Misc.h" -#include "Types.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to log when lists are -// allocated and deallocated. -// - -#undef REFERENCES - -class List -{ - public: - - List(); - - ~List(); - - int getSize() - { - return list_.size(); - } - - T_list &getList() - { - return list_; - } - - T_list copyList() - { - return list_; - } - - void add(int value) - { - list_.push_back(value); - } - - void remove(int value); - - void rotate(); - - private: - - // - // The list container. - // - - T_list list_; - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -#endif /* List_H */ diff --git a/nxcomp/ListFontsReply.cpp b/nxcomp/ListFontsReply.cpp deleted file mode 100644 index 827f68a09..000000000 --- a/nxcomp/ListFontsReply.cpp +++ /dev/null @@ -1,209 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ListFontsReply.h" - -#include "ServerCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef DUMP -#undef TEST -#undef DEBUG - -ListFontsReplyStore::ListFontsReplyStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = LISTFONTSREPLY_ENABLE_CACHE; - enableData = LISTFONTSREPLY_ENABLE_DATA; - enableSplit = LISTFONTSREPLY_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = LISTFONTSREPLY_DATA_LIMIT; - dataOffset = LISTFONTSREPLY_DATA_OFFSET; - - cacheSlots = LISTFONTSREPLY_CACHE_SLOTS; - cacheThreshold = LISTFONTSREPLY_CACHE_THRESHOLD; - cacheLowerThreshold = LISTFONTSREPLY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -ListFontsReplyStore::~ListFontsReplyStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int ListFontsReplyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; - - // - // Here is the fingerprint. - // - - listFontsReply -> number_of_names = GetUINT(buffer + 8, bigEndian); - - // - // Clean up padding bytes. - // - - if ((int) size > dataOffset) - { - unsigned int current; - unsigned int length; - unsigned int nstringInNames; - - unsigned char *end = NULL; - unsigned char *pad = NULL; - - #ifdef DUMP - - *logofs << "\n" << logofs_flush; - - *logofs << "Number of STRING8 " << listFontsReply -> number_of_names << ".\n" << logofs_flush; - - *logofs << "Size " << size << ".\n" << logofs_flush; - - DumpHexData(buffer, size); - - *logofs << "\n" << logofs_flush; - - #endif - - length = LISTFONTSREPLY_DATA_OFFSET; - - for (nstringInNames = 0; - nstringInNames < listFontsReply -> number_of_names && - listFontsReply -> number_of_names > 0; - nstringInNames++) - { - // - // Start with offset LISTFONTSREPLY_DATA_OFFSET 32. - // - - current = buffer[length]; - - length += current + 1; - - #ifdef DUMP - *logofs << "\nString number : " << nstringInNames << " Current length : " - << current << "\n" << logofs_flush; - #endif - } - - #ifdef DUMP - *logofs << "\nFinal length " << length << "\n" << logofs_flush; - #endif - - end = ((unsigned char *) buffer) + size; - - for (pad = ((unsigned char *) buffer) + length; pad < end; pad++) - { - *pad = 0; - - #ifdef DUMP - *logofs << "\nPadding ." << "\n" << logofs_flush; - #endif - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ListFontsReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; - - // - // Fill all the message's fields. - // - - PutUINT(listFontsReply -> number_of_names, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ListFontsReplyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; - - *logofs << name() << ": Identity number_of_names " - << listFontsReply -> number_of_names << ", size " - << listFontsReply -> size_ << ".\n"; - - #endif -} - -void ListFontsReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Field number_of_names. - // - - md5_append(md5_state_, buffer + 8, 2); -} diff --git a/nxcomp/ListFontsReply.h b/nxcomp/ListFontsReply.h deleted file mode 100644 index c731878e0..000000000 --- a/nxcomp/ListFontsReply.h +++ /dev/null @@ -1,146 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ListFontsReply_H -#define ListFontsReply_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define LISTFONTSREPLY_ENABLE_CACHE 1 -#define LISTFONTSREPLY_ENABLE_DATA 1 -#define LISTFONTSREPLY_ENABLE_SPLIT 0 - -#define LISTFONTSREPLY_DATA_LIMIT 1048576 - 32 -#define LISTFONTSREPLY_DATA_OFFSET 32 - -#define LISTFONTSREPLY_CACHE_SLOTS 200 -#define LISTFONTSREPLY_CACHE_THRESHOLD 20 -#define LISTFONTSREPLY_CACHE_LOWER_THRESHOLD 5 - -#define LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class ListFontsReplyMessage : public Message -{ - friend class ListFontsReplyStore; - - public: - - ListFontsReplyMessage() - { - } - - ~ListFontsReplyMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned short int number_of_names; -}; - -class ListFontsReplyStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - ListFontsReplyStore(StaticCompressor *compressor); - - virtual ~ListFontsReplyStore(); - - virtual const char *name() const - { - return "ListFontsReply"; - } - - virtual unsigned char opcode() const - { - return X_ListFonts; - } - - virtual unsigned int storage() const - { - return sizeof(ListFontsReplyMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new ListFontsReplyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new ListFontsReplyMessage((const ListFontsReplyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (ListFontsReplyMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* ListFontsReply_H */ diff --git a/nxcomp/Loop.cpp b/nxcomp/Loop.cpp deleted file mode 100644 index 4592121de..000000000 --- a/nxcomp/Loop.cpp +++ /dev/null @@ -1,16689 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include "Misc.h" - -#ifdef __sun -#include -#endif - -// -// MacOSX 10.4 defines socklen_t. This is -// intended to ensure compatibility with -// older versions. -// - -#ifdef __APPLE__ -#include -#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 -typedef int socklen_t; -#endif -#endif - -#ifdef _AIX -#include -#include -#endif - -#ifndef __CYGWIN32__ -#include -#endif - -// -// NX include files. -// - -#include "NX.h" -#include "NXalert.h" - -#include "Misc.h" -#include "Control.h" -#include "Socket.h" -#include "Statistics.h" -#include "Auth.h" -#include "Keeper.h" -#include "Agent.h" - -#include "ClientProxy.h" -#include "ServerProxy.h" - -#include "Message.h" -#include "ChannelEndPoint.h" - -// -// System specific defines. -// - - -// -// HP-UX hides this define. -// - -#if defined(hpux) && !defined(RLIM_INFINITY) - -#define RLIM_INFINITY 0x7fffffff - -#endif - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Enable log output in signal handler. -// This is likely to hang the proxy at -// random, at least on Linux. -// - -#undef UNSAFE - -// -// Let all logs go to the standard error. -// This is useful to interleave the Xlib -// log output with the proxy output in a -// single file. -// - -#undef MIXED - -// -// Define this to check if the client and -// server caches match at shutdown. This -// is a test facility as it requires that -// both proxies are running on the same -// host. -// - -#undef MATCH - -// -// If defined, reduce the size of the log -// file and be sure it never exceeds the -// limit. -// - -#undef QUOTA - -// -// If defined, force very strict limits for -// the proxy tokens and force the proxy to -// enter often in congestion state. -// - -#undef STRICT - -// -// Print a line in the log if the time we -// spent inside the select or handling the -// messages exceeded a given time value. -// - -#undef TIME - -// -// This can be useful when testing the forwarding -// of the SSHD connection by nxssh to the agent. -// The debug output will go to a well known file -// that will be opened also by nxssh when BINDER -// is enabled there. -// - -#undef BINDER - -// -// Define this to override the limits on -// the core dump size. -// - -#define COREDUMPS - -// -// Upper limit of pre-allocated buffers -// for string parameters. -// - -#define DEFAULT_STRING_LENGTH 256 - -// -// Maximum length of remote options data -// passed by peer proxy at startup. -// - -#define DEFAULT_REMOTE_OPTIONS_LENGTH 512 - -// -// Maximum length of NX display string. -// - -#define DEFAULT_DISPLAY_OPTIONS_LENGTH 1024 - -// -// Maximum number of cache file names to -// send to the server side. -// - -#define DEFAULT_REMOTE_CACHE_ENTRIES 100 - -// -// Maximum length of remote options string -// that can be received from the peer proxy. -// - -#define MAXIMUM_REMOTE_OPTIONS_LENGTH 4096 - -// -// Macro is true if we determined our proxy -// mode. -// - -#define WE_SET_PROXY_MODE (control -> ProxyMode != proxy_undefined) - -// -// Macro is true if our side is the one that -// should connect to remote. -// - -#define WE_INITIATE_CONNECTION (connectSocket.enabled()) - -// -// Is true if we must provide our credentials -// to the remote peer. -// - -#define WE_PROVIDE_CREDENTIALS (control -> ProxyMode == proxy_server) - -// -// Is true if we listen for a local forwarder -// that will tunnel the traffic through a SSH -// or HTTP link. -// - -#define WE_LISTEN_FORWARDER (control -> ProxyMode == proxy_server && \ - listenSocket.enabled()) - -// -// You must define FLUSH in Misc.h if -// you want an immediate flush of the -// log output. -// - -ostream *logofs = NULL; - -// -// Other stream destriptors used for -// logging. -// - -ostream *statofs = NULL; -ostream *errofs = NULL; - -// -// Save standard error's rdbuf here -// and restore it when exiting. -// - -static streambuf *errsbuf = NULL; - -// -// Allow faults to be recovered by -// jumping back into the main loop. -// - -jmp_buf context; - -// -// Provide operational parameters. -// - -Control *control = NULL; - -// -// Collect and print statistics. -// - -Statistics *statistics = NULL; - -// -// Keep data for X11 authentication. -// - -Auth *auth = NULL; - -// -// This class makes the hard work. -// - -Proxy *proxy = NULL; - -// -// Used to handle memory-to-memory -// transport to the X agent. -// - -Agent *agent = NULL; - -// -// The image cache house-keeping class. -// - -Keeper *keeper = NULL; - -// -// Callback set by the child process -// to be notified about signals. -// - -int (*handler)(int) = NULL; - -// -// Signal handling functions. -// - -void DisableSignals(); -void EnableSignals(); -void InstallSignals(); - -static void RestoreSignals(); -static void HandleSignal(int signal); - -// -// Signal handling utilities. -// - -static void InstallSignal(int signal, int action); -static void RestoreSignal(int signal); - -static int HandleChildren(); - -int HandleChild(int child); -static int CheckChild(int pid, int status); -static int WaitChild(int child, const char *label, int force); - -int CheckParent(const char *name, const char *type, int parent); - -void RegisterChild(int child); - -static int CheckAbort(); - -// -// Timer handling utilities. -// - -void SetTimer(int timeout); -void ResetTimer(); - -static void HandleTimer(int signal); - -// -// Kill or check a running child. -// - -static int KillProcess(int pid, const char *label, int signal, int wait); -static int CheckProcess(int pid, const char *label); - -// -// Macros used to test the pid of a child. -// - -#define IsFailed(pid) ((pid) < 0) -#define IsRunning(pid) ((pid) > 1) -#define IsNotRunning(pid) ((pid) == 0) -#define IsRestarting(pid) ((pid) == 1) - -#define SetNotRunning(pid) ((pid) = 0) -#define SetRestarting(pid) ((pid) = 1) - -// -// Start or restart the house-keeper process. -// - -static int StartKeeper(); - -// -// Cleanup functions. -// - -void CleanupConnections(); -void CleanupListeners(); -void CleanupSockets(); -void CleanupGlobal(); - -static void CleanupChildren(); -static void CleanupLocal(); -static void CleanupKeeper(); -static void CleanupStreams(); - -// -// Loop forever until the connections -// to the peer proxy is dropped. -// - -static void WaitCleanup(); - -// -// Initialization functions. -// - -static int InitBeforeNegotiation(); -static int SetupProxyConnection(); -static int InitAfterNegotiation(); -static int SetupProxyInstance(); -static int SetupAuthInstance(); -static int SetupAgentInstance(); - -static int SetupTcpSocket(); -static int SetupUnixSocket(); -static int SetupServiceSockets(); -static int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr, - unsigned int &xServerAddrLength); - -// -// Setup a listening socket and accept -// a new connection. -// - -static int ListenConnection(ChannelEndPoint &endPoint, const char *label); -static int ListenConnectionTCP(const char *host, long port, const char *label); -static int ListenConnectionUnix(const char *path, const char *label); -static int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label); -static int AcceptConnection(int fd, int domain, const char *label); - -// -// Other convenience functions. -// - -static int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFD, int* reason); -static int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* reason); - -static int WaitForRemote(ChannelEndPoint &socketAddress); -static int ConnectToRemote(ChannelEndPoint &socketAddress); - -static int SendProxyOptions(int fd); -static int SendProxyCaches(int fd); -static int ReadProxyVersion(int fd); -static int ReadProxyOptions(int fd); -static int ReadProxyCaches(int fd); -static int ReadForwarderVersion(int fd); -static int ReadForwarderOptions(int fd); - -static int ReadRemoteData(int fd, char *buffer, int size, char stop); -static int WriteLocalData(int fd, const char *buffer, int size); - -static void PrintVersionInfo(); -static void PrintProcessInfo(); -static void PrintConnectionInfo(); -static void PrintUsageInfo(const char *option, const int error); -static void PrintOptionIgnored(const char *type, const char *name, const char *value); - -// -// This is not static to avoid a warning. -// - -void PrintCopyrightInfo(); - -static const char *GetOptions(const char *options); -static const char *GetArg(int &argi, int argc, const char **argv); -static int CheckArg(const char *type, const char *name, const char *value); -static int ParseArg(const char *type, const char *name, const char *value); -static int ValidateArg(const char *type, const char *name, const char *value); -static void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value, - ChannelEndPoint &endPoint); -static int LowercaseArg(const char *type, const char *name, char *value); -static int CheckSignal(int signal); - -extern "C" -{ - int ParseCommandLineOptions(int argc, const char **argv); - int ParseEnvironmentOptions(const char *env, int force); - int ParseBindOptions(char **host, int *port); -} - -static int ParseFileOptions(const char *file); -static int ParseRemoteOptions(char *opts); -static int ParseForwarderOptions(char *opts); - -// -// These functions are used to parse literal -// values provided by the user and set the -// control parameters accordingly. -// - -static int ParseLinkOption(const char *opt); -static int ParseBitrateOption(const char *opt); -static int ParseCacheOption(const char *opt); -static int ParseShmemOption(const char *opt); -static int ParseImagesOption(const char *opt); -static int ParsePackOption(const char *opt); - -// -// Set host and port where NX proxy is supposed -// to be listening in case such parameters are -// given on the command line. -// - -static int ParseHostOption(const char *opt, char *host, long &port); - -// -// Translate a font server port specification -// to the corresponding Unix socket path. -// - -static int ParseFontPath(char *path); - -// -// Translate a pack method id in a literal. -// - -static int ParsePackMethod(const int method, const int quality); - -// -// Try to increase the size of the allowed -// core dumps. -// - -static int SetCore(); - -// -// Set the proxy mode to either client or -// server. -// - -static int SetMode(int mode); - -// -// Determine the path of the NX_* directories -// from the environment. -// - -static int SetDirectories(); - -// -// Set the defaults used for the log file and -// statistics. -// - -static int SetLogs(); - -// -// Check if local and remote protocol versions -// are compatible and, eventually, downgrade -// local version to the minimum level that is -// known to work. -// - -static int SetVersion(); - -// -// Setup the listening TCP ports used for the -// additional channels according to user's -// wishes. -// - -static int SetPorts(); - -// -// Set the maximum number of open descriptors. -// - -static int SetDescriptors(); - -// -// Set the path used for choosing the cache. -// It must be selected after determining the -// session type. -// - -static int SetCaches(); - -// -// Initialize, one after the other, all the -// configuration parameters. -// - -static int SetParameters(); - -// -// Set the specific configuration parameter. -// - -static int SetSession(); -static int SetStorage(); -static int SetShmem(); -static int SetPack(); -static int SetImages(); -static int SetLimits(); - -// -// Set up the control parameters based on -// the link speed negotiated between the -// proxies. -// - -static int SetLink(); - -static int SetLinkModem(); -static int SetLinkIsdn(); -static int SetLinkAdsl(); -static int SetLinkWan(); -static int SetLinkLan(); - -// -// Adjust the compression parameters. -// - -static int SetCompression(); - -static int SetCompressionModem(); -static int SetCompressionIsdn(); -static int SetCompressionAdsl(); -static int SetCompressionWan(); -static int SetCompressionLan(); - -// -// Determine the NX paths based on the -// user's parameters or the environment. -// - -char *GetClientPath(); - -static char *GetSystemPath(); -static char *GetHomePath(); -static char *GetTempPath(); -static char *GetRootPath(); -static char *GetCachePath(); -static char *GetImagesPath(); -static char *GetSessionPath(); -static char *GetLastCache(char *list, const char *path); - -static int OpenLogFile(char *name, ostream *&stream); -static int ReopenLogFile(char *name, ostream *&stream, int limit); - -// -// Perform operations on the managed -// descriptors in the main loop. -// - -static void handleCheckSessionInLoop(); -static void handleCheckBitrateInLoop(); - -#if defined(TEST) || defined(INFO) -static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, - fd_set &writeSet, T_timestamp selectTs); -static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs, - struct timeval &startTs); -static void handleCheckStateInLoop(int &setFDs); -#endif - -static void handleCheckSessionInConnect(); - -static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs); -static inline void handleSetWriteInLoop(fd_set &writeSet, int &setFDs, struct timeval &selectTs); -static inline void handleSetListenersInLoop(fd_set &writeSet, int &setFDs); -static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, - struct timeval &selectTs); - -static void handleAlertInLoop(); -static void handleStatisticsInLoop(); - -static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs); -static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs); - -static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet); -static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet); - -static inline void handleRotateInLoop(); -static inline void handleEventsInLoop(); -static inline void handleFlushInLoop(); - -// -// Manage the proxy link during the negotiation -// phase. -// - -static void handleNegotiationInLoop(int &setFDs, fd_set &readSet, - fd_set &writeSet, T_timestamp &selectTs); - -// -// Print the 'terminating' messages in the -// session log. -// - -static inline void handleTerminatingInLoop(); -static inline void handleTerminatedInLoop(); - -// -// Monitor the size of the log file. -// - -static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs); - -// -// Directory where the NX binaries and libraries reside. -// - -static char systemDir[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Directory used for temporary files. -// - -static char tempDir[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Actually the full path to the client. -// - -static char clientDir[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// User's home directory. -// - -static char homeDir[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Root of directory structure to be created by proxy. -// - -static char rootDir[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Root of statistics and log files to be created by proxy. -// - -static char sessionDir[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Log files for errors and statistics. Error log is -// the place where we print also debug informations. -// Both files are closed, deleted and reopened as -// their size exceed the limit set in control class. -// The session log is not reopened, as it is used by -// the NX client and server to track the advance of -// the session. -// - -static char errorsFileName[DEFAULT_STRING_LENGTH] = { 0 }; -static char statsFileName[DEFAULT_STRING_LENGTH] = { 0 }; -static char sessionFileName[DEFAULT_STRING_LENGTH] = { 0 }; -static char optionsFileName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// String literal representing selected link speed -// parameter. Value is translated in control values -// used by proxies to stay synchronized. -// - -static char linkSpeedName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// String literal representing selected -// cache size. -// - -static char cacheSizeName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// String literal representing selected -// shared memory segment size. -// - -static char shsegSizeName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// String literal of images cache size. -// - -static char imagesSizeName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// String literal for bandwidth limit. -// - -static char bitrateLimitName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// String literal for image packing method. -// - -static char packMethodName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Product name provided by the server or client. -// - -static char productName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Its corresponding value from NXpack.h. -// - -static int packMethod = -1; -static int packQuality = -1; - -// -// String literal for session type. Persistent caches -// are searched in directory whose name matches this -// parameter. -// - -static char sessionType[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Unique id assigned to session. It is used as -// name of directory where all files are placed. -// - -static char sessionId[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Set if we already parsed the options. -// - -static int parsedOptions = 0; -static int parsedCommand = 0; - -// -// Buffer data received from the remote proxy at -// session negotiation. -// - -static char remoteData[MAXIMUM_REMOTE_OPTIONS_LENGTH] = { 0 }; -static int remotePosition = 0; - -// -// Main loop file descriptors. -// - -static int tcpFD = -1; -static int unixFD = -1; -static int cupsFD = -1; -static int auxFD = -1; -static int smbFD = -1; -static int mediaFD = -1; -static int httpFD = -1; -static int fontFD = -1; -static int slaveFD = -1; -static int proxyFD = -1; - -// -// Used for internal communication -// with the X agent. -// - -static int agentFD[2] = { -1, -1 }; - -// -// Flags determining which protocols and -// ports are forwarded. -// - -int useUnixSocket = 1; - -static int useTcpSocket = 1; -static int useCupsSocket = 0; -static int useAuxSocket = 0; -static int useSmbSocket = 0; -static int useMediaSocket = 0; -static int useHttpSocket = 0; -static int useFontSocket = 0; -static int useSlaveSocket = 0; -static int useAgentSocket = 0; - -// -// Set if the launchd service is running -// and its socket must be used as X socket. -// - -static int useLaunchdSocket = 0; - -// -// Set by user if he/she wants to modify -// the default TCP_NODELAY option as set -// in control. -// - -static int useNoDelay = -1; - -// -// Set if user wants to override default -// flush timeout set according to link. -// - -static int usePolicy = -1; - -// -// Set if user wants to hide the RENDER -// extension or wants to short-circuit -// some simple replies at client side. -// - -static int useRender = -1; -static int useTaint = -1; - -// -// Set if the user wants to reduce the -// nominal size of the token messages -// exchanged between the proxies. -// - -static int useStrict = -1; - -// -// Set if the proxy is running as part -// of SSH on the client. -// - -static int useEncryption = -1; - -// -// Name of Unix socket created by the client proxy to -// accept client connections. File must be unlinked -// by cleanup function. -// - -static char unixSocketName[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Other parameters. -// - -static char acceptHost[DEFAULT_STRING_LENGTH] = { 0 }; -static char displayHost[DEFAULT_STRING_LENGTH] = { 0 }; -static char authCookie[DEFAULT_STRING_LENGTH] = { 0 }; - -static int loopbackBind = DEFAULT_LOOPBACK_BIND; -static int proxyPort = DEFAULT_NX_PROXY_PORT; -static int xPort = DEFAULT_NX_X_PORT; - -// -// Used to setup the connection the real -// X display socket. -// - -static int xServerAddrFamily = -1; -static sockaddr *xServerAddr = NULL; -static unsigned int xServerAddrLength = 0; - -// -// The representation of a Unix socket path or -// a bind address, denoting where the local proxy -// will await the peer connection. -// - -static ChannelEndPoint listenSocket; - -// -// The TCP host and port or Unix file socket where -// the remote proxy will be contacted. -// - -static ChannelEndPoint connectSocket; - -// -// Helper channels are disabled by default. -// - -static ChannelEndPoint cupsPort; -static ChannelEndPoint auxPort; -static ChannelEndPoint smbPort; -static ChannelEndPoint mediaPort; -static ChannelEndPoint httpPort; -static ChannelEndPoint slavePort; - -// -// Can be either a port number or a Unix -// socket. -// - -static char fontPort[DEFAULT_STRING_LENGTH] = { 0 }; - -// -// Host and port where the existing proxy -// is running. -// - -static char bindHost[DEFAULT_STRING_LENGTH] = { 0 }; -static int bindPort = -1; - -// -// Pointers to the callback functions and -// parameter set by the agent -// - -static void (*flushCallback)(void *, int) = NULL; -static void *flushParameter = NULL; - -static void (*statisticsCallback)(void *, int) = NULL; -static void *statisticsParameter = NULL; - -// -// State variables shared between the init -// function and the main loop. -// - -T_timestamp initTs; -T_timestamp startTs; -T_timestamp logsTs; -T_timestamp nowTs; - -int diffTs; - -// -// This is set to the main proxy process id. -// - -int lastProxy = 0; - -// -// Set to last dialog process launched by proxy. -// - -int lastDialog = 0; - -// -// Set to watchdog process launched by proxy. -// - -int lastWatchdog = 0; - -// -// Set if a cache house-keeper process is running. -// - -int lastKeeper = 0; - -// -// Let an inner routine register the pid of a slave -// process. -// - -static int lastChild = 0; - -// -// Exit code of the last child process exited. -// - -static int lastStatus = 0; - -// -// Set if shutdown was requested through a signal. -// - -static int lastKill = 0; - -// -// Set if the agent confirmed the destruction of -// the NX transport. -// - -static int lastDestroy = 0; - -// -// This is set to the code and local flag of the -// last requested alert. -// - -static struct -{ - int code; - int local; - -} lastAlert; - -// -// Manage the current signal masks. -// - -static struct -{ - sigset_t saved; - - int blocked; - int installed; - - int enabled[32]; - int forward[32]; - - struct sigaction action[32]; - -} lastMasks; - -// -// Manage the current timer. -// - -static struct -{ - struct sigaction action; - struct itimerval value; - struct timeval start; - struct timeval next; - -} lastTimer; - -// -// This is set to last signal received in handler. -// - -static int lastSignal = 0; - -// -// Set to the last time bytes readable were queried -// by the agent. -// - -static T_timestamp lastReadableTs = nullTimestamp(); - -// -// Here are interfaces declared in NX.h. -// - -int NXTransProxy(int fd, int mode, const char* options) -{ - // - // Let the log temporarily go to the standard - // error. Be also sure we have a jump context, - // in the case any subsequent operation will - // cause a cleanup. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - if (setjmp(context) == 1) - { - #ifdef TEST - *logofs << "NXTransProxy: Out of the long jump with pid '" - << lastProxy << "'.\n" << logofs_flush; - #endif - - return -1; - } - - // - // Check if have already performed a parsing of - // parameters, as in the case we are running as - // a stand-alone process. If needed create the - // parameters repository - // - - if (control == NULL) - { - control = new Control(); - } - - lastProxy = getpid(); - - #ifdef TEST - *logofs << "NXTransProxy: Main process started with pid '" - << lastProxy << "'.\n" << logofs_flush; - #endif - - SetMode(mode); - - if (mode == NX_MODE_CLIENT) - { - if (fd != NX_FD_ANY) - { - #ifdef TEST - - *logofs << "NXTransProxy: Agent descriptor for X client connections is FD#" - << fd << ".\n" << logofs_flush; - - *logofs << "NXTransProxy: Disabling listening on further X client connections.\n" - << logofs_flush; - - #endif - - useTcpSocket = 0; - useUnixSocket = 0; - useAgentSocket = 1; - - agentFD[1] = fd; - } - } - else if (mode == NX_MODE_SERVER) - { - if (fd != NX_FD_ANY) - { - #ifdef TEST - *logofs << "NXTransProxy: PANIC! Agent descriptor for X server connections " - << "not supported yet.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Agent descriptor for X server connections " - << "not supported yet.\n"; - - return -1; - } - } - - const char *env = GetOptions(options); - - if (ParseEnvironmentOptions(env, 0) < 0) - { - cerr << "Error" << ": Parsing of NX transport options failed.\n"; - - return -1; - } - - // - // Set the path of the NX directories. - // - - SetDirectories(); - - // - // Open the log files. - // - - SetLogs(); - - #ifdef TEST - *logofs << "NXTransProxy: Going to run the NX transport loop.\n" - << logofs_flush; - #endif - - WaitCleanup(); - - // - // This function should never return. - // - - exit(0); -} - -void NXTransExit(int code) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - static int recurse; - - if (++recurse > 1) - { - #ifdef TEST - *logofs << "NXTransExit: Aborting process with pid '" - << getpid() << "' due to recursion through " - << "exit.\n" << logofs_flush; - #endif - - abort(); - } - - #ifdef TEST - *logofs << "NXTransExit: Process with pid '" - << getpid() << "' called exit with code '" - << code << "'.\n" << logofs_flush; - #endif - - if (control != NULL) - { - // - // Be sure that there we can detect the - // termination of the watchdog. - // - - EnableSignals(); - - // - // Close the NX transport if it was not - // shut down already. - // - - NXTransDestroy(NX_FD_ANY); - } - - exit(code); -} - -int NXTransParseCommandLine(int argc, const char **argv) -{ - return ParseCommandLineOptions(argc, argv); -} - -int NXTransParseEnvironment(const char *env, int force) -{ - return ParseEnvironmentOptions(env, force); -} - -void NXTransCleanup() -{ - HandleCleanup(); -} - -void NXTransCleanupForReconnect() -{ - HandleCleanupForReconnect(); -} - -// -// Check the parameters for subsequent -// initialization of the NX transport. -// - -int NXTransCreate(int fd, int mode, const char* options) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - // - // Be sure we have a jump context, in the - // case a subsequent operation will cause - // a cleanup. - // - - if (setjmp(context) == 1) - { - return -1; - } - - // - // Create the parameters repository - // - - if (control != NULL) - { - #ifdef PANIC - *logofs << "NXTransCreate: PANIC! The NX transport seems " - << "to be already running.\n" << logofs_flush; - #endif - - cerr << "Error" << ": The NX transport seems " - << "to be already running.\n"; - - return -1; - } - - control = new Control(); - - if (control == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating the NX transport.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error creating the NX transport.\n"; - - return -1; - } - - lastProxy = getpid(); - - #ifdef TEST - *logofs << "NXTransCreate: Caller process running with pid '" - << lastProxy << "'.\n" << logofs_flush; - #endif - - // - // Set the local proxy mode an parse the - // display NX options. - // - - SetMode(mode); - - const char *env = GetOptions(options); - - if (ParseEnvironmentOptions(env, 0) < 0) - { - cerr << "Error" << ": Parsing of NX transport options failed.\n"; - - return -1; - } - - // - // Set the path of the NX directories. - // - - SetDirectories(); - - // - // Open the log files. - // - - SetLogs(); - - // - // Use the provided descriptor. - // - - proxyFD = fd; - - #ifdef TEST - *logofs << "NXTransCreate: Called with NX proxy descriptor '" - << proxyFD << "'.\n" << logofs_flush; - #endif - - #ifdef TEST - *logofs << "NXTransCreate: Creation of the NX transport completed.\n" - << logofs_flush; - #endif - - return 1; -} - -// -// Tell the proxy to use the descriptor as the internal -// connection to the X client side NX agent. This will -// have the side effect of disabling listening for add- -// itional X client connections. -// - -int NXTransAgent(int fd[2]) -{ - // - // Be sure we have a jump context, in the - // case a subsequent operation will cause - // a cleanup. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - if (setjmp(context) == 1) - { - return -1; - } - - if (control == NULL) - { - cerr << "Error" << ": Can't set the NX agent without a NX transport.\n"; - - return -1; - } - else if (control -> ProxyMode != proxy_client) - { - #ifdef PANIC - *logofs << "NXTransAgent: Invalid mode while setting the NX agent.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid mode while setting the NX agent.\n\n"; - - return -1; - } - - useTcpSocket = 0; - useUnixSocket = 0; - useAgentSocket = 1; - - agentFD[0] = fd[0]; - agentFD[1] = fd[1]; - - #ifdef TEST - - *logofs << "NXTransAgent: Internal descriptors for agent are FD#" - << agentFD[0] << " and FD#" << agentFD[1] << ".\n" - << logofs_flush; - - *logofs << "NXTransAgent: Disabling listening for further X client " - << "connections.\n" << logofs_flush; - - #endif - - agent = new Agent(agentFD); - - if (agent == NULL || agent -> isValid() != 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating the NX memory transport .\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error creating the NX memory transport.\n"; - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "NXTransAgent: Enabling memory-to-memory transport.\n" - << logofs_flush; - #endif - - return 1; -} - -int NXTransClose(int fd) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - /* - * Only handle the proxy connection. The X - * transport will take care of closing its - * end of the socket pair. - */ - - if (control != NULL && ((agent != NULL && - (fd == agentFD[0] || fd == NX_FD_ANY)) || - (fd == proxyFD || fd == NX_FD_ANY))) - { - if (proxy != NULL) - { - #ifdef TEST - *logofs << "NXTransClose: Closing down all the X connections.\n" - << logofs_flush; - #endif - - CleanupConnections(); - } - } - #ifdef TEST - else - { - *logofs << "NXTransClose: The NX transport is not running.\n" - << logofs_flush; - } - #endif - - return 1; -} - -// -// Close down the transport and free the -// allocated NX resources. -// - -int NXTransDestroy(int fd) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - if (control != NULL && ((agent != NULL && - (fd == agentFD[0] || fd == NX_FD_ANY)) || - (fd == proxyFD || fd == NX_FD_ANY))) - { - // - // Shut down the X connections and - // wait the cleanup to complete. - // - - if (proxy != NULL) - { - #ifdef TEST - *logofs << "NXTransDestroy: Closing down all the X connections.\n" - << logofs_flush; - #endif - - CleanupConnections(); - } - - #ifdef TEST - *logofs << "NXTransDestroy: Waiting for the NX transport to terminate.\n" - << logofs_flush; - #endif - - lastDestroy = 1; - - WaitCleanup(); - } - #ifdef TEST - else - { - *logofs << "NXTransDestroy: The NX transport is not running.\n" - << logofs_flush; - } - #endif - - return 1; -} - -// -// Assume that the NX transport is valid -// as long as the control class has not -// been destroyed. -// - -int NXTransRunning(int fd) -{ - return (control != NULL); -} - -int NXTransContinue(struct timeval *selectTs) -{ - if (control != NULL) - { - // - // If no timeout is provided use - // the default. - // - - T_timestamp newTs; - - if (selectTs == NULL) - { - setTimestamp(newTs, control -> PingTimeout); - - selectTs = &newTs; - } - - // - // Use empty masks and only get the - // descriptors set by the proxy. - // - - fd_set readSet; - fd_set writeSet; - - int setFDs; - int errorFDs; - int resultFDs; - - setFDs = 0; - - FD_ZERO(&readSet); - FD_ZERO(&writeSet); - - // - // Run a new loop. If the transport - // is gone avoid sleeping until the - // timeout. - // - - if (NXTransPrepare(&setFDs, &readSet, &writeSet, selectTs) != 0) - { - NXTransSelect(&resultFDs, &errorFDs, &setFDs, &readSet, &writeSet, selectTs); - - NXTransExecute(&resultFDs, &errorFDs, &setFDs, &readSet, &writeSet, selectTs); - } - } - - return (control != NULL); -} - -int NXTransSignal(int signal, int action) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - if (control == NULL) - { - return 0; - } - - if (action == NX_SIGNAL_RAISE) - { - #ifdef TEST - *logofs << "NXTransSignal: Raising signal '" << DumpSignal(signal) - << "' in the proxy handler.\n" << logofs_flush; - #endif - - HandleSignal(signal); - - return 1; - } - else if (signal == NX_SIGNAL_ANY) - { - #ifdef TEST - *logofs << "NXTransSignal: Setting action of all signals to '" - << action << "'.\n" << logofs_flush; - #endif - - for (int i = 0; i < 32; i++) - { - if (CheckSignal(i) == 1) - { - NXTransSignal(i, action); - } - } - - return 1; - } - else if (CheckSignal(signal) == 1) - { - #ifdef TEST - *logofs << "NXTransSignal: Setting action of signal '" - << DumpSignal(signal) << "' to '" << action - << "'.\n" << logofs_flush; - #endif - - if (action == NX_SIGNAL_ENABLE || - action == NX_SIGNAL_FORWARD) - { - InstallSignal(signal, action); - - return 1; - } - else if (action == NX_SIGNAL_DISABLE) - { - RestoreSignal(signal); - - return 1; - } - } - - #ifdef WARNING - *logofs << "NXTransSignal: WARNING! Unable to perform action '" - << action << "' on signal '" << DumpSignal(signal) - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Unable to perform action '" << action - << "' on signal '" << DumpSignal(signal) - << "'.\n"; - - return -1; -} - -int NXTransCongestion(int fd) -{ - if (control != NULL && proxy != NULL) - { - #ifdef DUMP - - int congestion = proxy -> getCongestion(proxyFD); - - *logofs << "NXTransCongestion: Returning " << congestion - << " as current congestion level.\n" << logofs_flush; - - return congestion; - - #endif - - return (proxy -> getCongestion(proxyFD)); - } - - return 0; -} - -int NXTransHandler(int fd, int type, void (*handler)(void *parameter, - int reason), void *parameter) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - switch (type) - { - case NX_HANDLER_FLUSH: - { - flushCallback = handler; - flushParameter = parameter; - - break; - } - case NX_HANDLER_STATISTICS: - { - // - // Reporting of statistics by the agent - // still needs to be implemented. - // - - statisticsCallback = handler; - statisticsParameter = parameter; - - break; - } - default: - { - #ifdef TEST - *logofs << "NXTransHandler: WARNING! Failed to set " - << "the NX callback for event '" << type << "' to '" - << (void *) handler << "' and parameter '" - << parameter << "'.\n" << logofs_flush; - #endif - - return 0; - } - } - - #ifdef TEST - *logofs << "NXTransHandler: Set the NX " - << "callback for event '" << type << "' to '" - << (void *) handler << "' and parameter '" - << parameter << "'.\n" << logofs_flush; - #endif - - return 1; -} - -int NXTransRead(int fd, char *data, int size) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - if (control != NULL && agent != NULL && - fd == agentFD[0]) - { - #ifdef DUMP - *logofs << "NXTransRead: Dequeuing " << size << " bytes " - << "from FD#" << agentFD[0] << ".\n" << logofs_flush; - #endif - - int result = agent -> dequeueData(data, size); - - #ifdef DUMP - - if (result < 0 && EGET() == EAGAIN) - { - *logofs << "NXTransRead: WARNING! Dequeuing from FD#" - << agentFD[0] << " would block.\n" << logofs_flush; - } - else - { - *logofs << "NXTransRead: Dequeued " << result << " bytes " - << "to FD#" << agentFD[0] << ".\n" << logofs_flush; - } - - #endif - - return result; - } - else - { - #ifdef DUMP - *logofs << "NXTransRead: Reading " << size << " bytes " - << "from FD#" << fd << ".\n" << logofs_flush; - #endif - - return read(fd, data, size); - } -} - -int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - if (control != NULL && agent != NULL && - fd == agentFD[0]) - { - #if defined(DUMP) - - if (control -> ProxyStage >= stage_operational && - agent -> localReadable() > 0) - { - *logofs << "NXTransReadVector: WARNING! Agent has data readable.\n" - << logofs_flush; - } - - #endif - - char *base; - - int length; - int result; - - struct iovec *vector = iovdata; - int count = iovsize; - - ESET(0); - - int i = 0; - int total = 0; - - for (; i < count; i++, vector++) - { - length = vector -> iov_len; - base = (char *) vector -> iov_base; - - while (length > 0) - { - #ifdef DUMP - *logofs << "NXTransReadVector: Dequeuing " << length - << " bytes " << "from FD#" << agentFD[0] << ".\n" - << logofs_flush; - #endif - - result = agent -> dequeueData(base, length); - - #ifdef DUMP - - if (result < 0 && EGET() == EAGAIN) - { - *logofs << "NXTransReadVector: WARNING! Dequeuing from FD#" - << agentFD[0] << " would block.\n" << logofs_flush; - } - else - { - *logofs << "NXTransReadVector: Dequeued " << result - << " bytes " << "from FD#" << agentFD[0] << ".\n" - << logofs_flush; - } - - #endif - - if (result < 0 && total == 0) - { - return result; - } - else if (result <= 0) - { - return total; - } - - ESET(0); - - length -= result; - total += result; - base += result; - } - } - - return total; - } - else - { - #ifdef DUMP - *logofs << "NXTransReadVector: Reading vector with " - << iovsize << " elements from FD#" << fd << ".\n" - << logofs_flush; - #endif - - return readv(fd, iovdata, iovsize); - } -} - -int NXTransReadable(int fd, int *readable) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - if (control == NULL || agent == NULL || - fd != agentFD[0]) - { - #ifdef DUMP - - int result = GetBytesReadable(fd, readable); - - if (result == -1) - { - *logofs << "NXTransReadable: Error detected on FD#" - << fd << ".\n" << logofs_flush; - } - else - { - *logofs << "NXTransReadable: Returning " << *readable - << " bytes as readable from FD#" << fd - << ".\n" << logofs_flush; - } - - return result; - - #else - - return GetBytesReadable(fd, readable); - - #endif - } - - int result = agent -> dequeuableData(); - - switch (result) - { - case 0: - { - // - // The client might have enqueued data to our side - // and is now checking for the available events. As - // _XEventsQueued() may omit to call _XSelect(), we - // handle here the new data that is coming from the - // proxy to avoid spinning through this function - // again. - // - - if (proxy != NULL && proxy -> canRead() == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "NXTransReadable: WARNING! Trying to " - << "read to generate new agent data.\n" - << logofs_flush; - #endif - - // - // Set the context as the function - // can cause a cleanup. - // - - if (setjmp(context) == 1) - { - return -1; - } - - if (proxy -> handleRead() < 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "NXTransReadable: Failure reading " - << "messages from proxy FD#" << proxyFD - << ".\n" << logofs_flush; - #endif - - HandleShutdown(); - } - - // - // Call again the routine. By reading - // new control messages from the proxy - // the agent channel may be gone. - // - - return NXTransReadable(fd, readable); - } - - #ifdef DUMP - *logofs << "NXTransReadable: Returning " << 0 - << " bytes as readable from FD#" << fd - << " with result 0.\n" << logofs_flush; - #endif - - *readable = 0; - - return 0; - } - case -1: - { - #ifdef DUMP - *logofs << "NXTransReadable: Returning " << 0 - << " bytes as readable from FD#" << fd - << " with result -1.\n" << logofs_flush; - #endif - - *readable = 0; - - return -1; - } - default: - { - #ifdef DUMP - *logofs << "NXTransReadable: Returning " << result - << " bytes as readable from FD#" << fd - << " with result 0.\n" << logofs_flush; - #endif - - *readable = result; - - return 0; - } - } -} - -int NXTransWrite(int fd, char *data, int size) -{ - // - // Be sure we have a valid log file. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - if (control != NULL && agent != NULL && - fd == agentFD[0]) - { - int result; - - if (proxy != NULL) - { - if (proxy -> canRead(agentFD[1]) == 0) - { - #if defined(DUMP) || defined(TEST) - *logofs << "NXTransWrite: WARNING! Delayed enqueuing to FD#" - << agentFD[0] << " with proxy unable to read.\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - - return -1; - } - - // - // Set the context as the function - // can cause a cleanup. - // - - if (setjmp(context) == 1) - { - return -1; - } - - // - // Don't enqueue the data to the transport - // but let the channel borrow the buffer. - // - - #ifdef DUMP - *logofs << "NXTransWrite: Letting the channel borrow " - << size << " bytes from FD#" << agentFD[0] - << ".\n" << logofs_flush; - #endif - - result = proxy -> handleRead(agentFD[1], data, size); - - if (result == 1) - { - result = size; - } - else - { - if (result == 0) - { - ESET(EAGAIN); - } - else - { - ESET(EPIPE); - } - - result = -1; - } - } - else - { - // - // We don't have a proxy connection, yet. - // Enqueue the data to the agent transport. - // - - #ifdef DUMP - *logofs << "NXTransWrite: Enqueuing " << size << " bytes " - << "to FD#" << agentFD[0] << ".\n" << logofs_flush; - #endif - - result = agent -> enqueueData(data, size); - } - - #ifdef DUMP - - if (result < 0) - { - if (EGET() == EAGAIN) - { - *logofs << "NXTransWrite: WARNING! Enqueuing to FD#" - << agentFD[0] << " would block.\n" - << logofs_flush; - } - else - { - *logofs << "NXTransWrite: WARNING! Error enqueuing to FD#" - << agentFD[0] << ".\n" << logofs_flush; - } - } - else - { - *logofs << "NXTransWrite: Enqueued " << result << " bytes " - << "to FD#" << agentFD[0] << ".\n" << logofs_flush; - } - - #endif - - return result; - } - else - { - #ifdef DUMP - *logofs << "NXTransWrite: Writing " << size << " bytes " - << "to FD#" << fd << ".\n" << logofs_flush; - #endif - - return write(fd, data, size); - } -} - -int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize) -{ - // - // Be sure we have a valid log file and a - // jump context because we will later call - // functions that can perform a cleanup. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - int result = 0; - - if (control != NULL && agent != NULL && - fd == agentFD[0]) - { - // - // See the comment in NXTransWrite(). - // - - if (proxy != NULL) - { - if (proxy -> canRead(agentFD[1]) == 0) - { - #if defined(DUMP) || defined(TEST) - *logofs << "NXTransWriteVector: WARNING! Delayed enqueuing to FD#" - << agentFD[0] << " with proxy unable to read.\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - - return -1; - } - } - - // - // Set the context as the function - // can cause a cleanup. - // - - if (setjmp(context) == 1) - { - return -1; - } - - char *base; - - int length; - - struct iovec *vector = iovdata; - int count = iovsize; - - ESET(0); - - int i = 0; - int total = 0; - - for (; i < count; i++, vector++) - { - length = vector -> iov_len; - base = (char *) vector -> iov_base; - - while (length > 0) - { - if (proxy != NULL) - { - // - // Don't enqueue the data to the transport - // but let the channel borrow the buffer. - // - - #ifdef DUMP - *logofs << "NXTransWriteVector: Letting the channel borrow " - << length << " bytes from FD#" << agentFD[0] - << ".\n" << logofs_flush; - #endif - - result = proxy -> handleRead(agentFD[1], base, length); - - if (result == 1) - { - result = length; - } - else - { - if (result == 0) - { - ESET(EAGAIN); - } - else - { - ESET(EPIPE); - } - - result = -1; - } - } - else - { - // - // We don't have a proxy connection, yet. - // Enqueue the data to the agent transport. - // - - #ifdef DUMP - *logofs << "NXTransWriteVector: Enqueuing " << length - << " bytes " << "to FD#" << agentFD[0] << ".\n" - << logofs_flush; - #endif - - result = agent -> enqueueData(base, length); - } - - #ifdef DUMP - - if (result < 0) - { - if (EGET() == EAGAIN) - { - *logofs << "NXTransWriteVector: WARNING! Enqueuing to FD#" - << agentFD[0] << " would block.\n" - << logofs_flush; - } - else - { - *logofs << "NXTransWriteVector: WARNING! Error enqueuing to FD#" - << agentFD[0] << ".\n" << logofs_flush; - } - } - else - { - *logofs << "NXTransWriteVector: Enqueued " << result - << " bytes " << "to FD#" << agentFD[0] << ".\n" - << logofs_flush; - } - - #endif - - if (result < 0 && total == 0) - { - return result; - } - else if (result <= 0) - { - return total; - } - - ESET(0); - - length -= result; - total += result; - base += result; - } - } - - return total; - } - else - { - #ifdef DUMP - *logofs << "NXTransWriteVector: Writing vector with " - << iovsize << " elements to FD#" << fd << ".\n" - << logofs_flush; - #endif - - return writev(fd, iovdata, iovsize); - } -} - -int NXTransPolicy(int fd, int type) -{ - if (control != NULL) - { - if (usePolicy == -1) - { - #if defined(TEST) || defined(INFO) - *logofs << "NXTransPolicy: Setting flush policy on " - << "proxy FD#" << proxyFD << " to '" - << DumpPolicy(type == NX_POLICY_DEFERRED ? - policy_deferred : policy_immediate) - << "'.\n" << logofs_flush; - #endif - - control -> FlushPolicy = (type == NX_POLICY_DEFERRED ? - policy_deferred : policy_immediate); - - if (proxy != NULL) - { - proxy -> handleFlush(); - } - - return 1; - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "NXTransPolicy: Ignoring the agent " - << "setting with user policy set to '" - << DumpPolicy(control -> FlushPolicy) - << "'.\n" << logofs_flush; - #endif - - return 0; - } - } - - return 0; -} - -int NXTransFlushable(int fd) -{ - if (proxy == NULL || agent == NULL || - fd != agentFD[0]) - { - #ifdef DUMP - *logofs << "NXTransFlushable: Returning 0 bytes as " - << "flushable for unrecognized FD#" << fd - << ".\n" << logofs_flush; - #endif - - return 0; - } - else - { - #if defined(DUMP) || defined(INFO) - *logofs << "NXTransFlushable: Returning " << proxy -> - getFlushable(proxyFD) << " as bytes flushable on " - << "proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - return proxy -> getFlushable(proxyFD); - } -} - -int NXTransFlush(int fd) -{ - if (proxy != NULL) - { - #if defined(TEST) || defined(INFO) - *logofs << "NXTransFlush: Requesting an immediate flush of " - << "proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - return proxy -> handleFlush(); - } - - return 0; -} - -int NXTransChannel(int fd, int channelFd, int type) -{ - if (proxy != NULL) - { - // - // Set the context as the function - // can cause a cleanup. - // - - if (setjmp(context) == 1) - { - return -1; - } - - #if defined(TEST) || defined(INFO) - *logofs << "NXTransChannel: Going to create a new channel " - << "with type '" << type << "' on FD#" << channelFd - << ".\n" << logofs_flush; - #endif - - int result = -1; - - switch (type) - { - case NX_CHANNEL_X11: - { - if (useUnixSocket == 1 || useTcpSocket == 1 || - useAgentSocket == 1 || useAuxSocket == 1) - { - result = proxy -> handleNewConnection(channel_x11, channelFd); - } - - break; - } - case NX_CHANNEL_CUPS: - { - if (useCupsSocket == 1) - { - result = proxy -> handleNewConnection(channel_cups, channelFd); - } - - break; - } - case NX_CHANNEL_SMB: - { - if (useSmbSocket == 1) - { - result = proxy -> handleNewConnection(channel_smb, channelFd); - } - - break; - } - case NX_CHANNEL_MEDIA: - { - if (useMediaSocket == 1) - { - result = proxy -> handleNewConnection(channel_media, channelFd); - } - - break; - } - case NX_CHANNEL_HTTP: - { - if (useHttpSocket == 1) - { - result = proxy -> handleNewConnection(channel_http, channelFd); - } - - break; - } - case NX_CHANNEL_FONT: - { - if (useFontSocket == 1) - { - result = proxy -> handleNewConnection(channel_font, channelFd); - } - - break; - } - case NX_CHANNEL_SLAVE: - { - if (useSlaveSocket == 1) - { - result = proxy -> handleNewConnection(channel_slave, channelFd); - } - - break; - } - default: - { - #ifdef WARNING - *logofs << "NXTransChannel: WARNING! Unrecognized channel " - << "type '" << type << "'.\n" << logofs_flush; - #endif - - break; - } - } - - #ifdef WARNING - - if (result != 1) - { - *logofs << "NXTransChannel: WARNING! Could not create the " - << "new channel with type '" << type << "' on FD#" - << channelFd << ".\n" << logofs_flush; - } - - #endif - - return result; - } - - return 0; -} - -const char *NXTransFile(int type) -{ - char *name = NULL; - - switch (type) - { - case NX_FILE_SESSION: - { - name = sessionFileName; - - break; - } - case NX_FILE_ERRORS: - { - name = errorsFileName; - - break; - } - case NX_FILE_OPTIONS: - { - name = optionsFileName; - - break; - } - case NX_FILE_STATS: - { - name = statsFileName; - - break; - } - } - - if (name != NULL && *name != '\0') - { - return name; - } - - return NULL; -} - -long NXTransTime() -{ - static T_timestamp last = getTimestamp(); - - T_timestamp now = getTimestamp(); - - long diff = diffTimestamp(last, now); - - last = now; - - return diff; -} - -int NXTransAlert(int code, int local) -{ - if (proxy != NULL) - { - #if defined(DUMP) || defined(INFO) - *logofs << "NXTransAlert: Requesting a NX dialog with code " - << code << " and local " << local << ".\n" - << logofs_flush; - #endif - - if (local == 0) - { - // - // Set the context as the function - // can cause a cleanup. - // - - if (setjmp(context) == 1) - { - return -1; - } - - proxy -> handleAlert(code); - } - else - { - // - // Show the alert at the next loop. - // - - HandleAlert(code, local); - } - - return 1; - } - #if defined(DUMP) || defined(INFO) - else - { - if (logofs == NULL) - { - logofs = &cerr; - } - - *logofs << "NXTransAlert: Can't request an alert without " - << "a valid NX transport.\n" << logofs_flush; - } - #endif - - return 0; -} - -// -// Prepare the file sets and the timeout -// for a later execution of the select(). -// - -int NXTransPrepare(int *setFDs, fd_set *readSet, - fd_set *writeSet, struct timeval *selectTs) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - // - // Control is NULL if the NX transport was - // reset or was never created. If control - // is valid then prepare to jump back when - // the transport is destroyed. - // - - if (control == NULL || setjmp(context) == 1) - { - return 0; - } - - #if defined(TEST) || defined(INFO) - *logofs << "\nNXTransPrepare: Going to prepare the NX transport.\n" - << logofs_flush; - #endif - - if (control -> ProxyStage < stage_operational) - { - handleNegotiationInLoop(*setFDs, *readSet, *writeSet, *selectTs); - } - else - { - #if defined(TEST) || defined(INFO) - - if (isTimestamp(*selectTs) == 0) - { - *logofs << "Loop: WARNING! Preparing the select with requested " - << "timeout of " << selectTs -> tv_sec << " S and " - << (double) selectTs -> tv_usec / 1000 << " Ms.\n" - << logofs_flush; - } - else - { - *logofs << "Loop: Preparing the select with requested " - << "timeout of " << selectTs -> tv_sec << " S and " - << (double) selectTs -> tv_usec / 1000 << " Ms.\n" - << logofs_flush; - } - - #endif - - // - // Set descriptors of listening sockets. - // - - handleSetListenersInLoop(*readSet, *setFDs); - - // - // Set descriptors of both proxy and X - // connections. - // - - handleSetReadInLoop(*readSet, *setFDs, *selectTs); - - // - // Find out which file descriptors have - // data to write. - // - - handleSetWriteInLoop(*writeSet, *setFDs, *selectTs); - } - - // - // Prepare the masks for handling the memory- - // to-memory transport. This is required even - // during session negotiation. - // - - if (agent != NULL) - { - handleSetAgentInLoop(*setFDs, *readSet, *writeSet, *selectTs); - } - - // - // Register time spent handling messages. - // - - nowTs = getNewTimestamp(); - - diffTs = diffTimestamp(startTs, nowTs); - - #ifdef TEST - *logofs << "Loop: Mark - 0 - at " << strMsTimestamp() - << " with " << diffTs << " Ms elapsed.\n" - << logofs_flush; - #endif - - // - // TODO: Should add the read time in two - // parts otherwise the limits are checked - // before the counters are updated with - // time spent in the last loop. - // - - if (control -> ProxyStage >= stage_operational) - { - statistics -> addReadTime(diffTs); - } - - startTs = nowTs; - - #ifdef DEBUG - *logofs << "Loop: New timestamp is " << strMsTimestamp(startTs) - << ".\n" << logofs_flush; - #endif - - return 1; -} - -// -// Let's say that we call select() to find out -// if any of the handled descriptors has data, -// but actually things are a bit more complex -// than that. -// - -int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet, - fd_set *writeSet, struct timeval *selectTs) -{ - #ifdef TIME - - static T_timestamp lastTs; - - #endif - - if (logofs == NULL) - { - logofs = &cerr; - } - - // - // Control is NULL if the NX transport was - // reset or never created. If control is - // valid then prepare for jumping back in - // the case of an error. - // - - if (control == NULL || setjmp(context) == 1) - { - *resultFDs = select(*setFDs, readSet, writeSet, NULL, selectTs); - - *errorFDs = errno; - - return 0; - } - - #if defined(TEST) || defined(INFO) - *logofs << "\nNXTransSelect: Going to select the NX descriptors.\n" - << logofs_flush; - #endif - - #if defined(TEST) || defined(INFO) - - handleCheckSelectInLoop(*setFDs, *readSet, *writeSet, *selectTs); - - #endif - - #ifdef TIME - - diffTs = diffTimestamp(lastTs, getNewTimestamp()); - - if (diffTs > 20) - { - *logofs << "Loop: TIME! Spent " << diffTs - << " Ms handling messages for proxy FD#" - << proxyFD << ".\n" << logofs_flush; - } - - lastTs = getNewTimestamp(); - - #endif - - #if defined(TEST) || defined(INFO) - - if (isTimestamp(*selectTs) == 0) - { - *logofs << "Loop: WARNING! Executing the select with requested " - << "timeout of " << selectTs -> tv_sec << " S and " - << (double) selectTs -> tv_usec / 1000 << " Ms.\n" - << logofs_flush; - } - else if (proxy != NULL && proxy -> getFlushable(proxyFD) > 0) - { - *logofs << "Loop: WARNING! Proxy FD#" << proxyFD - << " has " << proxy -> getFlushable(proxyFD) - << " bytes to write but timeout is " - << selectTs -> tv_sec << " S and " - << selectTs -> tv_usec / 1000 << " Ms.\n" - << logofs_flush; - } - - #endif - - // - // Wait for the selected sockets - // or the timeout. - // - - ESET(0); - - *resultFDs = select(*setFDs, readSet, writeSet, NULL, selectTs); - - *errorFDs = EGET(); - - #ifdef TIME - - diffTs = diffTimestamp(lastTs, getNewTimestamp()); - - if (diffTs > 100) - { - *logofs << "Loop: TIME! Spent " << diffTs - << " Ms waiting for new data for proxy FD#" - << proxyFD << ".\n" << logofs_flush; - } - - lastTs = getNewTimestamp(); - - #endif - - // - // Check the result of the select. - // - - #if defined(TEST) || defined(INFO) - - handleCheckResultInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs, startTs); - - #endif - - // - // Get time spent in select. The accouting is done - // in milliseconds. This is a real problem on fast - // machines where each loop is unlikely to take - // more than 500 us, so consider that the results - // can be inaccurate. - // - - nowTs = getNewTimestamp(); - - diffTs = diffTimestamp(startTs, nowTs); - - #ifdef TEST - *logofs << "Loop: Out of select after " << diffTs << " Ms " - << "at " << strMsTimestamp(nowTs) << " with result " - << *resultFDs << ".\n" << logofs_flush; - #endif - - startTs = nowTs; - - #ifdef DEBUG - *logofs << "Loop: New timestamp is " << strMsTimestamp(startTs) - << ".\n" << logofs_flush; - #endif - - if (control -> ProxyStage >= stage_operational) - { - statistics -> addIdleTime(diffTs); - } - - if (*resultFDs < 0) - { - // - // Check if the call was interrupted or if any of the - // managed descriptors has become invalid. This can - // happen to the X11 code, before the descriptor is - // removed from the managed set. - // - - #ifdef __sun - - if (*errorFDs == EINTR || *errorFDs == EBADF || - *errorFDs == EINVAL) - - #else - - if (*errorFDs == EINTR || *errorFDs == EBADF) - - #endif - - { - #ifdef TEST - - if (*errorFDs == EINTR) - { - *logofs << "Loop: Select failed due to EINTR error.\n" - << logofs_flush; - } - else - { - *logofs << "Loop: WARNING! Call to select failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - } - - #endif - } - else - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to select failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Call to select failed. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - HandleCleanup(); - } - } - - return 1; -} - -// -// Perform the required actions on all -// the descriptors having I/O pending. -// - -int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet, - fd_set *writeSet, struct timeval *selectTs) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - // - // Control is NULL if the NX transport was - // reset or never created. If control is - // valid then prepare for jumping back in - // the case of an error. - // - - if (control == NULL || setjmp(context) == 1) - { - return 0; - } - - #if defined(TEST) || defined(INFO) - *logofs << "\nNXTransExecute: Going to execute I/O on the NX descriptors.\n" - << logofs_flush; - #endif - - if (control -> ProxyStage >= stage_operational) - { - // - // Check if I/O is possible on the proxy and - // local agent descriptors. - // - - if (agent != NULL) - { - handleAgentInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs); - } - - #ifdef TEST - *logofs << "Loop: Mark - 1 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - - // - // Rotate the channel that will be handled - // first. - // - - handleRotateInLoop(); - - // - // Flush any data on newly writable sockets. - // - - handleWritableInLoop(*resultFDs, *writeSet); - - #ifdef TEST - *logofs << "Loop: Mark - 2 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - - // - // Check if any socket has become readable. - // - - handleReadableInLoop(*resultFDs, *readSet); - - #ifdef TEST - *logofs << "Loop: Mark - 3 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - - // - // Handle the scheduled events on channels. - // - // - Restart, if possible, any client that was - // put to sleep. - // - // - Check if there are pointer motion events to - // flush. This applies only to X server side. - // - // - Check if any channel has exited the conges- - // tion state. - // - // - Check if there are images that are currently - // being streamed. - // - - handleEventsInLoop(); - - #ifdef TEST - *logofs << "Loop: Mark - 4 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - - // - // Check if user sent a signal to produce - // statistics. - // - - handleStatisticsInLoop(); - - // - // We may have flushed the proxy link or - // handled data coming from the remote. - // Post-process the masks and set the - // selected agent descriptors as ready. - // - - if (agent != NULL) - { - handleAgentLateInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs); - } - - #ifdef TEST - *logofs << "Loop: Mark - 5 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - - // - // Check if there is any data to flush. - // Agents should flush the proxy link - // explicitly. - // - - handleFlushInLoop(); - - #ifdef TEST - *logofs << "Loop: Mark - 6 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - } - - // - // Check if we have an alert to show. - // - - handleAlertInLoop(); - - if (control -> ProxyStage >= stage_operational) - { - // - // Check if it's time to give up. - // - - handleCheckSessionInLoop(); - - // - // Check if local proxy is consuming - // too many resources. - // - - handleCheckBitrateInLoop(); - - // - // Check coherency of internal state. - // - - #if defined(TEST) || defined(INFO) - - handleCheckStateInLoop(*setFDs); - - #endif - - #ifdef TEST - *logofs << "Loop: Mark - 7 - at " << strMsTimestamp() - << " with " << diffTimestamp(startTs, getTimestamp()) - << " Ms elapsed.\n" << logofs_flush; - #endif - } - - // - // Truncate the logs if needed. - // - - handleLogReopenInLoop(logsTs, nowTs); - - return 1; -} - -// -// Initialize the connection parameters and -// prepare for negotiating the link with the -// remote proxy. -// - -int InitBeforeNegotiation() -{ - // - // Disable limits on core dumps. - // - - SetCore(); - - // - // Install the signal handlers. - // - - InstallSignals(); - - // - // Track how much time we spent in initialization. - // - - nowTs = getNewTimestamp(); - - startTs = nowTs; - initTs = nowTs; - - #ifdef TEST - *logofs << "Loop: INIT! Taking mark for initialization at " - << strMsTimestamp(initTs) << ".\n" - << logofs_flush; - #endif - - // - // If not explicitly specified, determine if local - // mode is client or server according to parameters - // provided so far. - // - - if (WE_SET_PROXY_MODE == 0) - { - cerr << "Error" << ": Please specify either the -C or -S option.\n"; - - HandleCleanup(); - } - - // - // Start a watchdog. If initialization cannot - // be completed before timeout, then clean up - // everything and exit. - // - - if (control -> ProxyMode == proxy_client) - { - #ifdef TEST - *logofs << "Loop: Starting watchdog process with timeout of " - << control -> InitTimeout / 1000 << " seconds.\n" - << logofs_flush; - #endif - - lastWatchdog = NXTransWatchdog(control -> InitTimeout); - - if (IsFailed(lastWatchdog)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't start the NX watchdog process.\n" - << logofs_flush; - #endif - - SetNotRunning(lastWatchdog); - } - #ifdef TEST - else - { - *logofs << "Loop: Watchdog started with pid '" - << lastWatchdog << "'.\n" << logofs_flush; - } - #endif - } - - // - // Print preliminary info. - // - - PrintProcessInfo(); - - // - // Set cups, multimedia and other - // auxiliary ports. - // - - SetPorts(); - - // - // Increase the number of maximum open - // file descriptors for this process. - // - - SetDescriptors(); - - // - // Set local endianess. - // - - unsigned int test = 1; - - setHostBigEndian(*((unsigned char *) (&test)) == 0); - - #ifdef TEST - *logofs << "Loop: Local host is " - << (hostBigEndian() ? "big endian" : "little endian") - << ".\n" << logofs_flush; - #endif - - if (control -> ProxyMode == proxy_client) - { - // - // Listen on sockets that mimic an X display to - // which X clients will be able to connect (e.g. - // unix:8 and/or localhost:8). - // - - if (useTcpSocket == 1) - { - SetupTcpSocket(); - } - - if (useUnixSocket == 1) - { - SetupUnixSocket(); - } - } - else - { - // - // Don't listen for X connections. - // - - useUnixSocket = 0; - useTcpSocket = 0; - useAgentSocket = 0; - - // - // Get ready to open the local display. - // - - SetupDisplaySocket(xServerAddrFamily, xServerAddr, xServerAddrLength); - } - - // - // If we are the NX server-side proxy we need to - // complete our initializazion. We will mandate - // our parameters at the time the NX client will - // connect. - // - - if (control -> ProxyMode == proxy_client) - { - SetParameters(); - } - - return 1; -} - -int SetupProxyConnection() -{ - - if (proxyFD == -1) - { - - char *socketUri = NULL; - - // Let's make sure, the default value for listenSocket is properly set. Doing this - // here, because we have to make sure that we call it after the connectSocket - // declaration is really really complete. - - if (listenSocket.disabled() && connectSocket.disabled()) - { - char listenPortValue[20] = { 0 }; - sprintf(listenPortValue, "%ld", (long)(proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET)); - - SetAndValidateChannelEndPointArg("local", "listen", listenPortValue, listenSocket); - } - - #ifdef TEST - connectSocket.getSpec(&socketUri); - *logofs << "Loop: connectSocket is "<< ( connectSocket.enabled() ? "enabled" : "disabled") << ". " - << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "") << "'.\n" << logofs_flush; - listenSocket.getSpec(&socketUri); - *logofs << "Loop: listenSocket is "<< ( listenSocket.enabled() ? "enabled" : "disabled") << ". " - << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "") << "'.\n" << logofs_flush; - free(socketUri); - socketUri = NULL; - #endif - - if (WE_INITIATE_CONNECTION) - { - if (connectSocket.getSpec(&socketUri)) - { - #ifdef TEST - *logofs << "Loop: Going to connect to '" << socketUri - << "'.\n" << logofs_flush; - #endif - free(socketUri); - - proxyFD = ConnectToRemote(connectSocket); - - #ifdef TEST - *logofs << "Loop: Connected to remote proxy on FD#" - << proxyFD << ".\n" << logofs_flush; - #endif - - cerr << "Info" << ": Connected to remote proxy on FD#" - << proxyFD << ".\n"; - } - } - else - { - - if (listenSocket.isTCPSocket() && (listenSocket.getTCPPort() < 0)) - { - listenSocket.setSpec(DEFAULT_NX_PROXY_PORT_OFFSET + proxyPort); - } - - if (listenSocket.getSpec(&socketUri)) - { - #ifdef TEST - *logofs << "Loop: Going to wait for connection at '" - << socketUri << "'.\n" << logofs_flush; - #endif - free(socketUri); - - proxyFD = WaitForRemote(listenSocket); - - #ifdef TEST - if (WE_LISTEN_FORWARDER) - { - *logofs << "Loop: Connected to remote forwarder on FD#" - << proxyFD << ".\n" << logofs_flush; - } - else - { - *logofs << "Loop: Connected to remote proxy on FD#" - << proxyFD << ".\n" << logofs_flush; - } - #endif - - } - } - } - #ifdef TEST - else - { - *logofs << "Loop: Using the inherited connection on FD#" - << proxyFD << ".\n" << logofs_flush; - } - #endif - - // - // Set TCP_NODELAY on proxy descriptor - // to reduce startup time. Option will - // later be disabled if needed. - // - // either listenSocket or connectSocket is used here... - - if(listenSocket.isTCPSocket() || connectSocket.isTCPSocket()) - - SetNoDelay(proxyFD, 1); - - // - // We need non-blocking input since the - // negotiation phase. - // - - SetNonBlocking(proxyFD, 1); - - return 1; -} - -// -// Create the required proxy and channel classes -// and get ready for handling the encoded traffic. -// - -int InitAfterNegotiation() -{ - #ifdef TEST - *logofs << "Loop: Connection with remote proxy completed.\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Connection with remote proxy completed.\n" - << logofs_flush; - - // - // If we are the server proxy we completed - // our initializazion phase according to - // the values provided by the client side. - // - - if (control -> ProxyMode == proxy_server) - { - SetParameters(); - } - - // - // Set up the listeners for the additional - // services. - // - - SetupServiceSockets(); - - // - // Create the proxy class and the statistics - // repository and pass all the configuration - // data we negotiated with the remote peer. - // - - SetupProxyInstance(); - - // - // We completed both parsing of user's parameters - // and handlshaking with remote proxy. Now print - // a brief summary including the most significant - // control values. - // - - PrintConnectionInfo(); - - // - // Cancel the initialization watchdog. - // - - if (IsRunning(lastWatchdog)) - { - KillProcess(lastWatchdog, "watchdog", SIGTERM, 1); - - SetNotRunning(lastWatchdog); - - lastSignal = 0; - } - - // - // Start the house-keeper process. It will - // remove the oldest persistent caches, if - // the amount of storage exceed the limits - // set by the user. - // - - StartKeeper(); - - // - // Set the log size check timestamp. - // - - nowTs = getNewTimestamp(); - - logsTs = nowTs; - - // - // TODO: Due to the way the new NX transport is working, - // the accounting of time spent handling messages must - // be rewritten. In particular, at the moment it only - // shows the time spent encoding and decoding messages - // in the main loop, after executing a select. It doesn't - // take into account the time spent in the NXTrans* calls - // where messages can be encoded and decoded implicitly, - // on demand of the agent. When the agent transport is - // in use, these calls constitute the vast majority of - // the encoding activity. The result is that the number - // of KB encoded per second shown by the proxy statistics - // is actually much lower than the real throughput gene- - // rated by the proxy. - // - - #ifdef TEST - *logofs << "Loop: INIT! Completed initialization at " - << strMsTimestamp(nowTs) << " with " - << diffTimestamp(initTs, nowTs) << " Ms " - << "since the init mark.\n" << logofs_flush; - #endif - - initTs = getNewTimestamp(); - - // - // We can now start handling binary data from - // our peer proxy. - // - - if (agent == NULL) - { - cerr << "Session" << ": Session started at '" - << strTimestamp() << "'.\n"; - } - - return 1; -} - -int SetMode(int mode) -{ - // - // Set the local proxy mode. - // - - if (control -> ProxyMode == proxy_undefined) - { - if (mode == NX_MODE_CLIENT) - { - #ifdef TEST - *logofs << "Loop: INIT! Initializing with mode " - << "NX_MODE_CLIENT at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - control -> ProxyMode = proxy_client; - } - else if (mode == NX_MODE_SERVER) - { - #ifdef TEST - *logofs << "Loop: INIT! Initializing with mode " - << "NX_MODE_SERVER at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - control -> ProxyMode = proxy_server; - } - else - { - cerr << "Error" << ": Please specify either " - << "the -C or -S option.\n"; - - HandleCleanup(); - } - } - - return 1; -} - -int SetupProxyInstance() -{ - if (control -> ProxyMode == proxy_client) - { - proxy = new ClientProxy(proxyFD); - } - else - { - proxy = new ServerProxy(proxyFD); - } - - if (proxy == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating the NX proxy.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error creating the NX proxy.\n"; - - HandleCleanup(); - } - - // - // Create the statistics repository. - // - - statistics = new Statistics(proxy); - - if (statistics == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating the NX statistics.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error creating the NX statistics.\n"; - - HandleCleanup(); - } - - // - // If user gave us a proxy cookie than create the - // X11 authorization repository and find the real - // cookie to be used for our X display. - // - - SetupAuthInstance(); - - // - // Reset the static members in channels. - // - - proxy -> handleChannelConfiguration(); - - // - // Inform the proxies about the ports where they - // will have to forward the network connections. - // - - proxy -> handleDisplayConfiguration(displayHost, xServerAddrFamily, - xServerAddr, xServerAddrLength); - - proxy -> handlePortConfiguration(cupsPort, smbPort, mediaPort, - httpPort, fontPort); - - // - // We handed over the sockaddr structure we - // created when we set up the display socket - // to the proxy. - // - - xServerAddr = NULL; - - // - // Set socket options on proxy link, then propagate link - // configuration to proxy. This includes translating some - // control parameters in 'local' and 'remote'. Finally - // adjust cache parameters according to pack method and - // session type selected by user. - // - - if (proxy -> handleSocketConfiguration() < 0 || - proxy -> handleLinkConfiguration() < 0 || - proxy -> handleCacheConfiguration() < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error configuring the NX transport.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error configuring the NX transport.\n"; - - HandleCleanup(); - } - - // - // Load the message stores from the persistent - // cache. - // - - proxy -> handleLoad(load_if_first); - - // - // Inform the proxy that from now on it can - // start handling the encoded data. - // - - proxy -> setOperational(); - - // - // Are we going to use an internal IPC connection - // with an agent? In this case create the channel - // by using the socket descriptor provided by the - // caller at the proxy initialization. - // - - SetupAgentInstance(); - - // - // Check if we need to verify the existence of - // a matching client cache at shutdown. - // - - #ifdef MATCH - - control -> PersistentCacheCheckOnShutdown = 1; - - #endif - - // - // Flush any data produced so far. - // - - proxy -> handleFlush(); - - #if defined(TEST) || defined(INFO) - - if (proxy -> getFlushable(proxyFD) > 0) - { - *logofs << "Loop: WARNING! Proxy FD#" << proxyFD << " has data " - << "to flush after setup of the NX transport.\n" - << logofs_flush; - } - - #endif - - return 1; -} - -int SetupAuthInstance() -{ - // - // If user gave us a proxy cookie, then create the - // X11 authorization repository and find the real - // cookie to be used for our X display. - // - - if (control -> ProxyMode == proxy_server) - { - if (authCookie != NULL && *authCookie != '\0') - { - if (useLaunchdSocket == 1) - { - // - // If we are going to retrieve the X11 autho- - // rization through the launchd service, make - // a connection to its socket to trigger the - // X server starting. - // - - sockaddr_un launchdAddrUnix; - - unsigned int launchdAddrLength = sizeof(sockaddr_un); - - int launchdAddrFamily = AF_UNIX; - - launchdAddrUnix.sun_family = AF_UNIX; - - const int launchdAddrNameLength = 108; - - int success = -1; - - strncpy(launchdAddrUnix.sun_path, displayHost, launchdAddrNameLength); - - *(launchdAddrUnix.sun_path + launchdAddrNameLength - 1) = '\0'; - - #ifdef TEST - *logofs << "Loop: Connecting to launchd service " - << "on Unix port '" << displayHost << "'.\n" << logofs_flush; - #endif - - int launchdFd = socket(launchdAddrFamily, SOCK_STREAM, PF_UNSPEC); - - if (launchdFd < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - } - else if ((success = connect(launchdFd, (sockaddr *) &launchdAddrUnix, launchdAddrLength)) < 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Connection to launchd service " - << "on Unix port '" << displayHost << "' failed " - << "with error " << EGET() << ", '" << ESTR() << "'.\n" - << logofs_flush; - #endif - } - - if (launchdFd >= 0) - { - close(launchdFd); - } - - // - // The real cookie will not be available - // until the X server starts. Query for the - // cookie in a loop, unless the connection - // to the launchd service failed. - // - - int attempts = (success < 0 ? 1 : 10); - - for (int i = 0; i < attempts; i++) - { - delete auth; - - auth = new Auth(displayHost, authCookie); - - if (auth != NULL && auth -> isFake() == 1) - { - usleep(200000); - - continue; - } - - break; - } - } - else - { - auth = new Auth(displayHost, authCookie); - } - - if (auth == NULL || auth -> isValid() != 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating the X authorization.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error creating the X authorization.\n"; - - HandleCleanup(); - } - else if (auth -> isFake() == 1) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Could not retrieve the X server " - << "authentication cookie.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to read data from the X " - << "auth command.\n"; - - cerr << "Warning" << ": Generated a fake cookie for X " - << "authentication.\n"; - } - } - else - { - #ifdef TEST - *logofs << "Loop: No proxy cookie was provided for " - << "authentication.\n" << logofs_flush; - #endif - - cerr << "Info" << ": No proxy cookie was provided for " - << "authentication.\n"; - - #ifdef TEST - *logofs << "Loop: Forwarding the real X authorization " - << "cookie.\n" << logofs_flush; - #endif - - cerr << "Info" << ": Forwarding the real X authorization " - << "cookie.\n"; - } - } - - return 1; -} - -int SetupAgentInstance() -{ - if (control -> ProxyMode == proxy_client && - useAgentSocket == 1) - { - // - // This will temporarily disable signals to safely - // load the cache, then will send a control packet - // to the remote end, telling that cache has to be - // loaded, so it's important that proxy is already - // set in operational state. - // - - int result; - - if (agent != NULL) - { - result = proxy -> handleNewAgentConnection(agent); - } - else - { - result = proxy -> handleNewConnection(channel_x11, agentFD[1]); - } - - if (result < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating the NX agent connection.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error creating the NX agent connection.\n"; - - HandleCleanup(); - } - } - - return 1; -} - -int SetupTcpSocket() -{ - // - // Open TCP socket emulating local display. - // - - return ListenConnectionTCP((loopbackBind ? "localhost" : "*"), X_TCP_PORT + proxyPort, "X11"); -} - -int SetupUnixSocket() -{ - // - // Open UNIX domain socket for display. - // - - if (!control->TempPath) { - #ifdef PANIC - *logofs << "Loop: PANIC! Temporal path is null.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Temporal path is null.\n"; - HandleCleanup(); - } - - unsigned int required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s/.X11-unix", control->TempPath); - if (required < sizeof(unixSocketName)) { - - // No need to execute the following actions conditionally - mkdir(unixSocketName, (0777 | S_ISVTX)); - chmod(unixSocketName, (0777 | S_ISVTX)); - - required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s/.X11-unix/X%d", control->TempPath, proxyPort); - if (required < sizeof(unixSocketName)) { - - unixFD = ListenConnectionUnix(unixSocketName, "x11"); - if (unixFD >= 0) - chmod(unixSocketName, 0777); - return unixFD; - } - } - - unixSocketName[0] = '\0'; // Just in case! - - #ifdef PANIC - *logofs << "Loop: PANIC! path for unix socket is too long.\n" << logofs_flush; - #endif - - cerr << "Error" << ": path for Unix socket is too long.\n"; - HandleCleanup(); -} - -// -// The following is a dumb copy-paste. The -// nxcompsh library should offer a better -// implementation. -// - -int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr, - unsigned int &xServerAddrLength) -{ - xServerAddrFamily = AF_INET; - xServerAddr = NULL; - xServerAddrLength = 0; - - char *display; - - if (*displayHost == '\0') - { - // - // Assume DISPLAY as the X server to which - // we will forward the proxied connections. - // This means that NX parameters have been - // passed through other means. - // - - display = getenv("DISPLAY"); - - if (display == NULL || *display == '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! Host X server DISPLAY is not set.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Host X server DISPLAY is not set.\n"; - - HandleCleanup(); - } - else if (strncasecmp(display, "nx/nx,", 6) == 0 || - strncasecmp(display, "nx,", 3) == 0 || - strncasecmp(display, "nx/nx:", 6) == 0 || - strncasecmp(display, "nx:", 3) == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! NX transport on host X server '" - << display << "' not supported.\n" << logofs_flush; - #endif - - cerr << "Error" << ": NX transport on host X server '" - << display << "' not supported.\n"; - - cerr << "Error" << ": Please run the local proxy specifying " - << "the host X server to connect to.\n"; - - HandleCleanup(); - } - else if (strlen(display) >= DEFAULT_STRING_LENGTH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Host X server DISPLAY cannot exceed " - << DEFAULT_STRING_LENGTH << " characters.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Host X server DISPLAY cannot exceed " - << DEFAULT_STRING_LENGTH << " characters.\n"; - - HandleCleanup(); - } - - strcpy(displayHost, display); - } - - display = new char[strlen(displayHost) + 1]; - - if (display == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Out of memory handling DISPLAY variable.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Out of memory handling DISPLAY variable.\n"; - - HandleCleanup(); - } - - strcpy(display, displayHost); - - #ifdef __APPLE__ - - if ((strncasecmp(display, "/tmp/launch", 11) == 0) || (strncasecmp(display, "/private/tmp/com.apple.launchd", 30) == 0)) - { - #ifdef TEST - *logofs << "Loop: Using launchd service on socket '" - << display << "'.\n" << logofs_flush; - #endif - - useLaunchdSocket = 1; - } - - #endif - - char *separator = strrchr(display, ':'); - - if ((separator == NULL) || !isdigit(*(separator + 1))) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid display '" << display << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid display '" << display << "'.\n"; - - HandleCleanup(); - } - - *separator = '\0'; - - xPort = atoi(separator + 1); - - #ifdef TEST - *logofs << "Loop: Using local X display '" << displayHost - << "' with host '" << display << "' and port '" - << xPort << "'.\n" << logofs_flush; - #endif - - #ifdef __APPLE__ - - if (separator == display || strcmp(display, "unix") == 0 || - useLaunchdSocket == 1) - - #else - - if (separator == display || strcmp(display, "unix") == 0) - - #endif - { - // - // UNIX domain port. - // - - #ifdef TEST - *logofs << "Loop: Using real X server on UNIX domain socket.\n" - << logofs_flush; - #endif - - sockaddr_un *xServerAddrUNIX = new sockaddr_un; - - xServerAddrFamily = AF_UNIX; - xServerAddrUNIX -> sun_family = AF_UNIX; - - // - // The scope of this function is to fill either the sockaddr_un - // (when the display is set to the Unix Domain socket) or the - // sockaddr_in structure (when connecting by TCP) only once, so - // that the structure will be later used at the time the server - // proxy will try to forward the connection to the X server. We - // don't need to verify that the socket does exist at the pre- - // sent moment. The method that forwards the connection will - // perform the required checks and will retry, if needed. Anyway - // we need to select the name of the socket, so we check if the - // well-known directory exists and take that as an indication of - // where the socket will be created. - // - - // Try abstract X11 socket first (via a test connect), if that fails - // fall back to Unix domain socket file. - - #ifdef __linux__ - int testSocketFD; - testSocketFD = socket(xServerAddrFamily, SOCK_STREAM, PF_UNSPEC); - - int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort); - unixSocketName[0] = '\0'; - - sockaddr_un *xServerAddrABSTRACT = new sockaddr_un; - memset(xServerAddrABSTRACT, 0, xServerAddrLength); - xServerAddrABSTRACT -> sun_family = AF_UNIX; - memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1); - xServerAddrLength = len +3; - - int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, xServerAddrLength); - if (ret == 0) { - - cerr << "Info" << ": Using abstract X11 socket in kernel namespace " - << "for accessing DISPLAY=:" << xPort << ".\n"; - - close(testSocketFD); - xServerAddr = (sockaddr *) xServerAddrABSTRACT; - return 1; - - } else { - - cerr << "Info" << ": Falling back to file system X11 socket " - << "for accessing DISPLAY=:" << xPort << ".\n"; - - #endif - - struct stat statInfo; - - char unixSocketDir[DEFAULT_STRING_LENGTH]; - - snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "%s/.X11-unix", - control -> TempPath); - - #ifdef __APPLE__ - - if (useLaunchdSocket == 1) - { - char *slash = rindex(display, '/'); - - if (slash != NULL) - { - *slash = '\0'; - } - - snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "%s", display); - } - - #endif - - *(unixSocketDir + DEFAULT_STRING_LENGTH - 1) = '\0'; - - #ifdef TEST - *logofs << "Loop: Assuming X socket in directory '" - << unixSocketDir << "'.\n" << logofs_flush; - #endif - - if (stat(unixSocketDir, &statInfo) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't determine the location of " - << "the X display socket.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't determine the location of " - << "the X display socket.\n"; - - #ifdef PANIC - *logofs << "Loop: PANIC! Error " << EGET() << " '" << ESTR() - << "' checking '" << unixSocketDir << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error " << EGET() << " '" << ESTR() - << "' checking '" << unixSocketDir << "'.\n"; - - HandleCleanup(); - } - - sprintf(unixSocketName, "%s/X%d", unixSocketDir, xPort); - - #ifdef __APPLE__ - - if (useLaunchdSocket == 1) - { - strncpy(unixSocketName, displayHost, DEFAULT_STRING_LENGTH - 1); - } - - #endif - - #ifdef TEST - *logofs << "Loop: Assuming X socket name '" << unixSocketName - << "'.\n" << logofs_flush; - #endif - - strcpy(xServerAddrUNIX -> sun_path, unixSocketName); - - xServerAddr = (sockaddr *) xServerAddrUNIX; - xServerAddrLength = sizeof(sockaddr_un); - - #ifdef __linux__ - - } - #endif - } - else - { - // - // TCP port. - // - - #ifdef TEST - *logofs << "Loop: Using real X server on TCP port.\n" - << logofs_flush; - #endif - - xServerAddrFamily = AF_INET; - - int xServerIPAddr = GetHostAddress(display); - - if (xServerIPAddr == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Unknown display host '" << display - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unknown display host '" << display - << "'.\n"; - - HandleCleanup(); - } - - sockaddr_in *xServerAddrTCP = new sockaddr_in; - - xServerAddrTCP -> sin_family = AF_INET; - xServerAddrTCP -> sin_port = htons(X_TCP_PORT + xPort); - xServerAddrTCP -> sin_addr.s_addr = xServerIPAddr; - - xServerAddr = (sockaddr *) xServerAddrTCP; - xServerAddrLength = sizeof(sockaddr_in); - } - - delete [] display; - - return 1; -} - -int SetupServiceSockets() -{ - if (control -> ProxyMode == proxy_client) - { - if (useCupsSocket) - { - if ((cupsFD = ListenConnection(cupsPort, "CUPS")) < 0) - { - useCupsSocket = 0; - } - } - - if (useAuxSocket) - { - if ((auxFD = ListenConnection(auxPort, "auxiliary X11")) < 0) - { - useAuxSocket = 0; - } - } - - if (useSmbSocket) - { - if ((smbFD = ListenConnection(smbPort, "SMB")) < 0) - { - useSmbSocket = 0; - } - } - - if (useMediaSocket) - { - if ((mediaFD = ListenConnection(mediaPort, "media")) < 0) - { - useMediaSocket = 0; - } - } - - if (useHttpSocket) - { - if ((httpFD = ListenConnection(httpPort, "http")) < 0) - { - useHttpSocket = 0; - } - } - - useFontSocket = 0; - } - else - { - // - // Get ready to listen for the font server connections - // - - if (useFontSocket) - { - // Since ProtoStep7 (#issue 108) - int port = atoi(fontPort); - - if ((fontFD = ListenConnectionTCP("localhost", port, "font")) < 0) - { - useFontSocket = 0; - } - } - - useCupsSocket = 0; - useAuxSocket = 0; - useSmbSocket = 0; - useMediaSocket = 0; - useHttpSocket = 0; - } - - // - // Slave channels can be originated - // by both sides. - // - - if (useSlaveSocket) - { - // Since ProtoStep7 (#issue 108) - if ((slaveFD = ListenConnection(slavePort, "slave")) < 0) - { - useSlaveSocket = 0; - } - } - - return 1; -} - -int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label) -{ - int newFD = socket(addr->sa_family, SOCK_STREAM, PF_UNSPEC); - - if (newFD == -1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to socket failed for " << label - << " socket. Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to socket failed for " << label - << " socket. Error is " << EGET() << " '" - << ESTR() << "'.\n"; - - goto SetupSocketError; - } - - if (addr->sa_family == AF_INET) - if (SetReuseAddress(newFD) < 0) - { - // SetReuseAddress already warns with an error - goto SetupSocketError; - } - - if (bind(newFD, addr, addrlen) == -1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to bind failed for " << label - << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to bind failed for " << label - << ". Error is " << EGET() - << " '" << ESTR() << "'.\n"; - goto SetupSocketError; - } - - if (listen(newFD, 8) == -1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to listen failed for " << label - << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to listen failed for " << label - << ". Error is " << EGET() - << " '" << ESTR() << "'.\n"; - - goto SetupSocketError; - } - - return newFD; - -SetupSocketError: - - if (newFD != -1) - { - close(newFD); - } - - // - // May optionally return. The session would - // continue without the service. The problem - // with this approach is that it would make - // harder to track problems with allocation - // of ports in clients and server. - // - - HandleCleanup(); - return -1; -} - -int ListenConnectionUnix(const char *path, const char *label) -{ - - sockaddr_un unixAddr; - unixAddr.sun_family = AF_UNIX; -#ifdef UNIX_PATH_MAX - if (strlen(path) >= UNIX_PATH_MAX) -#else - if (strlen(path) >= sizeof(unixAddr.sun_path)) -#endif - { - #ifdef PANIC - *logofs << "Loop: PANIC! Socket path \"" << path << "\" for " - << label << " is too long.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Socket path \"" << path << "\" for " - << label << " is too long.\n"; - - HandleCleanup(); - return -1; - } - - strcpy(unixAddr.sun_path, path); - return ListenConnectionAny((sockaddr *)&unixAddr, sizeof(unixAddr), label); -} - -int ListenConnectionTCP(const char *host, long port, const char *label) -{ - sockaddr_in tcpAddr; - tcpAddr.sin_family = AF_INET; - tcpAddr.sin_port = htons(port); - - if (loopbackBind || - !host || - !strcmp(host, "") || - !strcmp(host, "localhost")) { - tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); - } - else if(strcmp(host, "*") == 0) { - tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); - } - else { - int ip = tcpAddr.sin_addr.s_addr = GetHostAddress(host); - if (ip == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Unknown " << label << " host '" << host - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unknown " << label << " host '" << host - << "'.\n"; - - HandleCleanup(); - return -1; - } - } - - return ListenConnectionAny((sockaddr *)&tcpAddr, sizeof(tcpAddr), label); -} - -int ListenConnection(ChannelEndPoint &endpoint, const char *label) -{ - char *unixPath, *host; - long port; - if (endpoint.getUnixPath(&unixPath)) { - return ListenConnectionUnix(unixPath, label); - } - else if (endpoint.getTCPHostAndPort(&host, &port)) { - return ListenConnectionTCP(host, port, label); - } - return -1; -} - -static int AcceptConnection(int fd, int domain, const char *label) -{ - struct sockaddr newAddr; - - socklen_t addrLen = sizeof(newAddr); - - #ifdef TEST - - if (domain == AF_UNIX) - { - *logofs << "Loop: Going to accept new Unix " << label - << " connection on FD#" << fd << ".\n" - << logofs_flush; - } - else - { - *logofs << "Loop: Going to accept new TCP " << label - << " connection on FD#" << fd << ".\n" - << logofs_flush; - } - - #endif - - int newFD = accept(fd, &newAddr, &addrLen); - - if (newFD < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to accept failed for " - << label << " connection. Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to accept failed for " - << label << " connection. Error is " << EGET() - << " '" << ESTR() << "'.\n"; - } - - return newFD; -} - -void HandleShutdown() -{ - if (proxy -> getShutdown() == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! No shutdown of proxy link " - << "performed by remote proxy.\n" - << logofs_flush; - #endif - - // - // Close the socket before showing the alert. - // It seems that the closure of the socket can - // sometimes take several seconds, even after - // the connection is broken. The result is that - // the dialog can be shown long after the user - // has gone after the failed session. Note that - // disabling the linger timeout does not seem - // to make any difference. - // - - CleanupSockets(); - - cerr << "Error" << ": Connection with remote peer broken.\n"; - - #ifdef TEST - *logofs << "Loop: Bytes received so far are " - << (unsigned long long) statistics -> getBytesIn() - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Please check the state of your " - << "network and retry.\n"; - - handleTerminatingInLoop(); - - if (control -> ProxyMode == proxy_server) - { - #ifdef TEST - *logofs << "Loop: Showing the proxy abort dialog.\n" - << logofs_flush; - #endif - - HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1); - - handleAlertInLoop(); - } - } - #ifdef TEST - else - { - *logofs << "Loop: Finalized the remote proxy shutdown.\n" - << logofs_flush; - } - #endif - - HandleCleanup(); -} - - -void WaitCleanup() -{ - T_timestamp selectTs; - - while (NXTransRunning(NX_FD_ANY)) - { - setTimestamp(selectTs, control -> PingTimeout); - - NXTransContinue(&selectTs); - } -} - -int KillProcess(int pid, const char *label, int signal, int wait) -{ - if (pid > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Killing the " << label << " process '" - << pid << "' from process with pid '" << getpid() - << "' with signal '" << DumpSignal(signal) - << "'.\n" << logofs_flush; - #endif - - signal = (signal == 0 ? SIGTERM : signal); - - if (kill(pid, signal) < 0 && EGET() != ESRCH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Couldn't kill the " << label - << " process with pid '" << pid << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Couldn't kill the " << label - << " process with pid '" << pid << "'.\n"; - } - - if (wait == 1) - { - WaitChild(pid, label, 1); - } - - return 1; - } - else - { - #ifdef TEST - *logofs << "Loop: No " << label << " process " - << "to kill with pid '" << pid - << "'.\n" << logofs_flush; - #endif - - return 0; - } -} - -int CheckProcess(int pid, const char *label) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Checking the " << label << " process '" - << pid << "' from process with pid '" << getpid() - << "'.\n" << logofs_flush; - #endif - - if (kill(pid, SIGCONT) < 0 && EGET() == ESRCH) - { - #ifdef WARNING - *logofs << "Loop: WARNING! The " << label << " process " - << "with pid '" << pid << "' has exited.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": The " << label << " process " - << "with pid '" << pid << "' has exited.\n"; - - return 0; - } - - return 1; -} - -int StartKeeper() -{ - #if defined(TEST) || defined(INFO) - - if (IsRunning(lastKeeper) == 1 || - IsRestarting(lastKeeper) == 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! The house-keeping process is " - << "alreay running with pid '" << lastKeeper - << "'.\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - #endif - - // - // Don't care harvesting the persistent caches if - // the memory cache is not enabled. If the memory - // cache is not enabled neither we produced per- - // sistent caches. The user can still delete any - // persistent cache produced by the previous runs - // by using the client GUI. - // - // TODO: At the moment the user doesn't have a way - // to specify the amount of disk space to use for - // the persistent caches, but only the amount of - // space to use for images. - // - - if (control -> LocalTotalStorageSize > 0) - { - #ifdef TEST - *logofs << "Loop: Starting the house-keeping process with " - << "storage size " << control -> PersistentCacheDiskLimit - << ".\n" << logofs_flush; - #endif - - lastKeeper = NXTransKeeper(control -> PersistentCacheDiskLimit, - 0, control -> RootPath); - - if (IsFailed(lastKeeper)) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Failed to start the NX keeper process.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to start the NX keeper process.\n"; - - SetNotRunning(lastKeeper); - } - #ifdef TEST - else - { - *logofs << "Loop: Keeper started with pid '" - << lastKeeper << "'.\n" << logofs_flush; - } - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Nothing to do for the keeper process " - << "with persistent cache not enabled.\n" - << logofs_flush; - } - #endif - - return 1; -} - -void HandleCleanupForReconnect() -{ - #ifdef TEST - *logofs << "Loop: Going to clean up system resources for Reconnect " - << "in process '" << getpid() << "'.\n" - << logofs_flush; - #endif - handleTerminatedInLoop(); - DisableSignals(); - if (control) - CleanupChildren(); - CleanupListeners(); - CleanupSockets(); - CleanupKeeper(); - CleanupStreams(); - CleanupLocal(); - CleanupGlobal(); - RestoreSignals(); - ServerCache::lastInitReply.set(0,NULL); - ServerCache::lastKeymap.set(0,NULL); - ServerCache::getKeyboardMappingLastMap.set(0,NULL); -} -void HandleCleanup(int code) -{ - #ifdef TEST - *logofs << "Loop: Going to clean up system resources " - << "in process '" << getpid() << "'.\n" - << logofs_flush; - #endif - - handleTerminatedInLoop(); - - // - // Suspend any signal while cleaning up. - // - - DisableSignals(); - - if (getpid() == lastProxy) - { - // - // Terminate all the children. - // - - CleanupChildren(); - - // - // Close all listeners. - // - - CleanupListeners(); - - // - // Close all sockets. - // - - CleanupSockets(); - - // - // Release the global objects. - // - - CleanupGlobal(); - - // - // Restore the original signal handlers. - // - - RestoreSignals(); - } - - // - // This is our last chance to print a message. If this - // is the process which created the transport we will - // jump back into the loop, letting the caller find out - // that the connection is broken, otherwise we assume - // that this is a child of the proxy and so we will - // safely exit. - // - - #ifdef TEST - - if (getpid() == lastProxy) - { - *logofs << "Loop: Reverting to loop context in process with " - << "pid '" << getpid() << "' at " << strMsTimestamp() - << ".\n" << logofs_flush; - } - else - { - *logofs << "Loop: Exiting from child process with pid '" - << getpid() << "' at " << strMsTimestamp() - << ".\n" << logofs_flush; - } - - #endif - - if (getpid() == lastProxy) - { - // - // Reset all values to their default. - // - - CleanupLocal(); - - CleanupStreams(); - - longjmp(context, 1); - } - else - { - // - // Give a last chance to the process - // to cleanup the ancillary classes. - // - - CleanupKeeper(); - - CleanupStreams(); - - exit(code); - } -} - -void CleanupKeeper() -{ - if (keeper != NULL) - { - #ifdef TEST - *logofs << "Loop: Freeing up keeper in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - delete keeper; - - keeper = NULL; - } -} - -void CleanupStreams() -{ - // - // TODO: The cleanup procedure skips deletion of - // the I/O streams under Windows. This is intended - // to avoid a strange segfault occurring randomly, - // at the time the proxy is being shut down. - // - - #ifndef __CYGWIN32__ - - #ifdef TEST - *logofs << "Loop: Freeing up streams in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - if (logofs != NULL && logofs != &cerr && - *errorsFileName != '\0') - { - *logofs << flush; - - delete logofs; - - // - // Let the log go again to the standard - // error. - // - - logofs = &cerr; - } - - if (statofs != NULL && statofs != &cerr && - *statsFileName != '\0') - { - *statofs << flush; - - delete statofs; - - statofs = NULL; - } - - if (errofs != NULL) - { - *errofs << flush; - - if (errofs == &cerr) - { - errofs = NULL; - } - else if (errsbuf != NULL) - { - cerr.rdbuf(errsbuf); - - errsbuf = NULL; - - delete errofs; - } - - errofs = NULL; - } - - #endif /* #ifndef __CYGWIN32__ */ - - // - // Reset these as they can't be reset - // in CleanupLocal(). - // - - *sessionFileName = '\0'; - *errorsFileName = '\0'; - *optionsFileName = '\0'; - *statsFileName = '\0'; -} - -void CleanupChildren() -{ - // - // Remove any watchdog. - // - - if (IsRunning(lastWatchdog)) - { - KillProcess(lastWatchdog, "watchdog", SIGTERM, 1); - - SetNotRunning(lastWatchdog); - - lastSignal = 0; - } - - // - // Kill the cache house-keeping process. - // - - if (IsRunning(lastKeeper)) - { - KillProcess(lastKeeper, "house-keeping", SIGTERM, 1); - - SetNotRunning(lastKeeper); - } - - // - // Let any running dialog to continue until it is - // closed by the user. In general this is the exp- - // ected behaviour, as for example when we are - // exiting because the link was abrouptedly shut - // down. - // - - if (IsRunning(lastDialog)) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: WARNING! Leaving the dialog process '" - << lastDialog << "' running in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - SetNotRunning(lastDialog); - } - - // - // Give user a chance to start a new session. - // - - if (control -> EnableRestartOnShutdown == 1) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Respawning the NX client " - << "on display '" << displayHost << "'.\n" - << logofs_flush; - #endif - - NXTransClient(displayHost); - } - - for (int i = 0; i < control -> KillDaemonOnShutdownNumber; i++) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Killing the NX daemon with " - << "pid '" << control -> KillDaemonOnShutdown[i] - << "'.\n" << logofs_flush; - #endif - - KillProcess(control -> KillDaemonOnShutdown[i], "daemon", SIGTERM, 0); - } -} - -void CleanupGlobal() -{ - if (proxy != NULL) - { - #ifdef TEST - *logofs << "Loop: Freeing up proxy in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - delete proxy; - - proxy = NULL; - } - - if (agent != NULL) - { - #ifdef TEST - *logofs << "Loop: Freeing up agent in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - delete agent; - - agent = NULL; - } - - if (auth != NULL) - { - #ifdef TEST - *logofs << "Loop: Freeing up auth data in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - delete auth; - - auth = NULL; - } - - if (statistics != NULL) - { - #ifdef TEST - *logofs << "Loop: Freeing up statistics in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - delete statistics; - - statistics = NULL; - } - - if (control != NULL) - { - #ifdef TEST - *logofs << "Loop: Freeing up control in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - delete control; - - control = NULL; - } -} - -void CleanupConnections() -{ - if (proxy -> getChannels(channel_x11) != 0) - { - #ifdef TEST - *logofs << "Loop: Closing any remaining X connections.\n" - << logofs_flush; - #endif - - proxy -> handleCloseAllXConnections(); - - #ifdef TEST - *logofs << "Loop: Closing any remaining listener.\n" - << logofs_flush; - #endif - - proxy -> handleCloseAllListeners(); - } - - proxy -> handleFinish(); -} - -void CleanupListeners() -{ - if (useTcpSocket == 1) - { - if (tcpFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing TCP listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(tcpFD); - - tcpFD = -1; - } - - useTcpSocket = 0; - } - - if (useUnixSocket == 1) - { - if (unixFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing UNIX listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(unixFD); - - unixFD = -1; - } - - if (*unixSocketName != '\0') - { - #ifdef TEST - *logofs << "Loop: Going to remove the Unix domain socket '" - << unixSocketName << "' in process " << "with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - unlink(unixSocketName); - } - - useUnixSocket = 0; - } - - if (useAgentSocket == 1) - { - // - // There is no listener for the - // agent descriptor. - // - - useAgentSocket = 0; - } - - if (useCupsSocket == 1) - { - if (cupsFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing CUPS listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(cupsFD); - - cupsFD = -1; - } - - useCupsSocket = 0; - } - - if (useAuxSocket == 1) - { - if (auxFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing auxiliary X11 listener " - << "in process " << "with pid '" << getpid() - << "'.\n" << logofs_flush; - #endif - - close(auxFD); - - auxFD = -1; - } - - useAuxSocket = 0; - } - - if (useSmbSocket == 1) - { - if (smbFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing SMB listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(smbFD); - - smbFD = -1; - } - - useSmbSocket = 0; - } - - if (useMediaSocket == 1) - { - if (mediaFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing multimedia listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(mediaFD); - - mediaFD = -1; - } - - useMediaSocket = 0; - } - - if (useHttpSocket == 1) - { - if (httpFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing http listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(httpFD); - - httpFD = -1; - } - - useHttpSocket = 0; - } - - if (useFontSocket == 1) - { - if (fontFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing font server listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(fontFD); - - fontFD = -1; - } - - useFontSocket = 0; - } - - if (useSlaveSocket == 1) - { - if (slaveFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing slave listener in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(slaveFD); - - slaveFD = -1; - } - - useSlaveSocket = 0; - } -} - -void CleanupSockets() -{ - if (proxyFD != -1) - { - #ifdef TEST - *logofs << "Loop: Closing proxy FD in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(proxyFD); - - proxyFD = -1; - } - - if (agentFD[1] != -1) - { - #ifdef TEST - *logofs << "Loop: Closing agent FD in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - close(agentFD[1]); - - agentFD[0] = -1; - agentFD[1] = -1; - } -} - -void CleanupLocal() -{ - *homeDir = '\0'; - *rootDir = '\0'; - *tempDir = '\0'; - *systemDir = '\0'; - *sessionDir = '\0'; - - *linkSpeedName = '\0'; - *cacheSizeName = '\0'; - *shsegSizeName = '\0'; - *imagesSizeName = '\0'; - *bitrateLimitName = '\0'; - *packMethodName = '\0'; - *productName = '\0'; - - packMethod = -1; - packQuality = -1; - - *sessionType = '\0'; - *sessionId = '\0'; - - parsedOptions = 0; - parsedCommand = 0; - - *remoteData = '\0'; - remotePosition = 0; - - tcpFD = -1; - unixFD = -1; - cupsFD = -1; - auxFD = -1; - smbFD = -1; - mediaFD = -1; - httpFD = -1; - fontFD = -1; - slaveFD = -1; - proxyFD = -1; - - agentFD[0] = -1; - agentFD[1] = -1; - - useUnixSocket = 1; - useTcpSocket = 1; - useCupsSocket = 0; - useAuxSocket = 0; - useSmbSocket = 0; - useMediaSocket = 0; - useHttpSocket = 0; - useFontSocket = 0; - useSlaveSocket = 0; - useAgentSocket = 0; - - useNoDelay = -1; - usePolicy = -1; - useRender = -1; - useTaint = -1; - - *unixSocketName = '\0'; - - *acceptHost = '\0'; - *displayHost = '\0'; - *authCookie = '\0'; - - proxyPort = DEFAULT_NX_PROXY_PORT; - xPort = DEFAULT_NX_X_PORT; - - xServerAddrFamily = -1; - xServerAddrLength = 0; - - delete xServerAddr; - - xServerAddr = NULL; - - listenSocket.disable(); - connectSocket.disable(); - - cupsPort.disable(); - auxPort.disable(); - smbPort.disable(); - mediaPort.disable(); - httpPort.disable(); - slavePort.disable(); - - *fontPort = '\0'; - - *bindHost = '\0'; - bindPort = -1; - - initTs = nullTimestamp(); - startTs = nullTimestamp(); - logsTs = nullTimestamp(); - nowTs = nullTimestamp(); - - diffTs = 0; - - lastProxy = 0; - lastDialog = 0; - lastWatchdog = 0; - lastKeeper = 0; - lastStatus = 0; - lastKill = 0; - lastDestroy = 0; - - lastReadableTs = nullTimestamp(); - - lastAlert.code = 0; - lastAlert.local = 0; - - lastMasks.blocked = 0; - lastMasks.installed = 0; - - memset(&lastMasks.saved, 0, sizeof(sigset_t)); - - for (int i = 0; i < 32; i++) - { - lastMasks.enabled[i] = 0; - lastMasks.forward[i] = 0; - - memset(&lastMasks.action[i], 0, sizeof(struct sigaction)); - } - - lastSignal = 0; - - memset(&lastTimer.action, 0, sizeof(struct sigaction)); - memset(&lastTimer.value, 0, sizeof(struct itimerval)); - - lastTimer.start = nullTimestamp(); - lastTimer.next = nullTimestamp(); -} - -int CheckAbort() -{ - if (lastSignal != 0) - { - #ifdef TEST - *logofs << "Loop: Aborting the procedure due to signal '" - << lastSignal << "', '" << DumpSignal(lastSignal) - << "'.\n" << logofs_flush; - #endif - - cerr << "Info" << ": Aborting the procedure due to signal '" - << lastSignal << "'.\n"; - - lastSignal = 0; - - return 1; - } - - return 0; -} - -void HandleAbort() -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - *logofs << flush; - - handleTerminatingInLoop(); - - if (lastSignal == SIGHUP) - { - lastSignal = 0; - } - - // - // The current default is to just quit the program. - // Code has not been updated to deal with the new - // NX transport loop. - // - - if (control -> EnableCoreDumpOnAbort == 1) - { - if (agent != NULL) - { - cerr << "Session" << ": Terminating session at '" - << strTimestamp() << "'.\n"; - } - - cerr << "Error" << ": Generating a core file to help " - << "the investigations.\n"; - - cerr << "Session" << ": Session terminated at '" - << strTimestamp() << "'.\n"; - - cerr << flush; - - signal(SIGABRT, SIG_DFL); - - raise(SIGABRT); - } - - #ifdef TEST - *logofs << "Loop: Showing the proxy abort dialog.\n" - << logofs_flush; - #endif - - if (control -> ProxyMode == proxy_server) - { - // - // Close the socket before showing the alert. - // It seems that the closure of the socket can - // sometimes take several seconds, even after - // the connection is broken. - // - - CleanupSockets(); - - if (lastKill == 0) - { - HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1); - } - else - { - HandleAlert(ABORT_PROXY_SHUTDOWN_ALERT, 1); - } - - handleAlertInLoop(); - } - - HandleCleanup(); -} - -void HandleAlert(int code, int local) -{ - if (lastAlert.code == 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Requesting an alert dialog with code " - << code << " and local " << local << ".\n" - << logofs_flush; - #endif - - lastAlert.code = code; - lastAlert.local = local; - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "Loop: WARNING! Alert dialog already requested " - << "with code " << lastAlert.code << ".\n" - << logofs_flush; - } - #endif - - return; -} - -void FlushCallback(int length) -{ - if (flushCallback != NULL) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Reporting a flush request at " - << strMsTimestamp() << " with " << length - << " bytes written.\n" << logofs_flush; - #endif - - (*flushCallback)(flushParameter, length); - } - #if defined(TEST) || defined(INFO) - else if (control -> ProxyMode == proxy_client) - { - *logofs << "Loop: WARNING! Can't find a flush " - << "callback in process with pid '" << getpid() - << "'.\n" << logofs_flush; - } - #endif -} - -void KeeperCallback() -{ - if (IsRunning(lastKeeper) == 0) - { - // - // Let the house-keeping process take care - // of the persistent image cache. - // - - if (control -> ImageCacheEnableLoad == 1 || - control -> ImageCacheEnableSave == 1) - { - #ifdef TEST - *logofs << "Loop: Starting the house-keeping process with " - << "image storage size " << control -> ImageCacheDiskLimit - << ".\n" << logofs_flush; - #endif - - lastKeeper = NXTransKeeper(0, control -> ImageCacheDiskLimit, - control -> RootPath); - - if (IsFailed(lastKeeper)) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Can't start the NX keeper process.\n" - << logofs_flush; - #endif - - SetNotRunning(lastKeeper); - } - #ifdef TEST - else - { - *logofs << "Loop: Keeper started with pid '" - << lastKeeper << "'.\n" << logofs_flush; - } - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Nothing to do for the keeper process " - << "with image cache not enabled.\n" - << logofs_flush; - } - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Nothing to do with the keeper process " - << "already running.\n" << logofs_flush; - } - #endif -} - -void InstallSignals() -{ - #ifdef TEST - *logofs << "Loop: Installing signals in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - for (int i = 0; i < 32; i++) - { - if (CheckSignal(i) == 1 && - lastMasks.enabled[i] == 0) - { - InstallSignal(i, NX_SIGNAL_ENABLE); - } - } - - lastMasks.installed = 1; -} - -void RestoreSignals() -{ - #ifdef TEST - *logofs << "Loop: Restoring signals in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - if (lastMasks.installed == 1) - { - // - // Need to keep monitoring the children. - // - - for (int i = 0; i < 32; i++) - { - if (lastMasks.enabled[i] == 1) - { - RestoreSignal(i); - } - } - } - - lastMasks.installed = 0; - - if (lastMasks.blocked == 1) - { - EnableSignals(); - } -} - -void DisableSignals() -{ - if (lastMasks.blocked == 0) - { - sigset_t newMask; - - sigemptyset(&newMask); - - // - // Block also the other signals that may be - // installed by the agent, that are those - // signals for which the function returns 2. - // - - for (int i = 0; i < 32; i++) - { - if (CheckSignal(i) > 0) - { - #ifdef DUMP - *logofs << "Loop: Disabling signal " << i << " '" - << DumpSignal(i) << "' in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - sigaddset(&newMask, i); - } - } - - sigprocmask(SIG_BLOCK, &newMask, &lastMasks.saved); - - lastMasks.blocked++; - } - #ifdef TEST - else - { - *logofs << "Loop: WARNING! Signals were already blocked in " - << "process with pid '" << getpid() << "'.\n" - << logofs_flush; - } - #endif -} - -void EnableSignals() -{ - if (lastMasks.blocked == 1) - { - #ifdef TEST - *logofs << "Loop: Enabling signals in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - sigprocmask(SIG_SETMASK, &lastMasks.saved, NULL); - - lastMasks.blocked = 0; - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Signals were not blocked in " - << "process with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Signals were not blocked in " - << "process with pid '" << getpid() << "'.\n"; - } -} - -void InstallSignal(int signal, int action) -{ - if (lastMasks.enabled[signal] == 1) - { - if (action == NX_SIGNAL_FORWARD) - { - #ifdef TEST - *logofs << "Loop: Forwarding handler for signal " << signal - << " '" << DumpSignal(signal) << "' in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - lastMasks.forward[signal] = 1; - - return; - } - #ifdef TEST - else - { - *logofs << "Loop: Reinstalling handler for signal " << signal - << " '" << DumpSignal(signal) << "' in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - } - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Installing handler for signal " << signal - << " '" << DumpSignal(signal) << "' in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - } - #endif - - if (signal == SIGALRM && isTimestamp(lastTimer.start)) - { - ResetTimer(); - } - - struct sigaction newAction; - - memset(&newAction, 0, sizeof(newAction)); - - newAction.sa_handler = HandleSignal; - - sigemptyset(&(newAction.sa_mask)); - - if (signal == SIGCHLD) - { - newAction.sa_flags = SA_NOCLDSTOP; - } - else - { - newAction.sa_flags = 0; - } - - sigaction(signal, &newAction, &lastMasks.action[signal]); - - lastMasks.enabled[signal] = 1; - - if (action == NX_SIGNAL_FORWARD) - { - lastMasks.forward[signal] = 1; - } -} - -void RestoreSignal(int signal) -{ - if (lastMasks.enabled[signal] == 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Signal '" << DumpSignal(signal) - << " not installed in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Signal '" << DumpSignal(signal) - << " not installed in process with pid '" - << getpid() << "'.\n"; - - return; - } - - #ifdef TEST - *logofs << "Loop: Restoring handler for signal " << signal - << " '" << DumpSignal(signal) << "' in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - if (signal == SIGALRM && isTimestamp(lastTimer.start)) - { - ResetTimer(); - } - - sigaction(signal, &lastMasks.action[signal], NULL); - - lastMasks.enabled[signal] = 0; - lastMasks.forward[signal] = 0; -} - -void HandleSignal(int signal) -{ - if (logofs == NULL) - { - logofs = &cerr; - } - - #if defined(UNSAFE) && (defined(TEST) || defined(INFO)) - - if (lastSignal != 0) - { - *logofs << "Loop: WARNING! Last signal is '" << lastSignal - << "', '" << DumpSignal(signal) << "' and not zero " - << "in process with pid '" << getpid() << "'.\n" - << logofs_flush; - } - - *logofs << "Loop: Signal '" << signal << "', '" - << DumpSignal(signal) << "' received in process " - << "with pid '" << getpid() << "'.\n" << logofs_flush; - - #endif - - if (getpid() != lastProxy && handler != NULL) - { - #if defined(UNSAFE) && (defined(TEST) || defined(INFO)) - *logofs << "Loop: Calling slave handler in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - if ((*handler)(signal) == 0) - { - return; - } - } - - switch (signal) - { - case SIGUSR1: - { - if (proxy != NULL && lastSignal == 0) - { - lastSignal = SIGUSR1; - } - - break; - } - case SIGUSR2: - { - if (proxy != NULL && lastSignal == 0) - { - lastSignal = SIGUSR2; - } - - break; - } - case SIGPIPE: - { - // - // It can happen that SIGPIPE is delivered - // to the proxy even in the case some other - // descriptor is unexpectedly closed. - // - // if (agentFD[1] != -1) - // { - // cerr << "Info" << ": Received signal 'SIGPIPE'. " - // << "Closing agent conection.\n"; - // - // shutdown(agentFD[1], SHUT_RDWR); - // } - // - - break; - } - case SIGALRM: - { - // - // Nothing to do. Just wake up the - // process on blocking operations. - // - - break; - } - case SIGCHLD: - { - // - // Check if any of our children has exited. - // - - if (HandleChildren() != 0) - { - signal = 0; - } - - // - // Don't save this signal or it will override - // any previous signal sent by child before - // exiting. - // - - break; - } - - #ifdef __CYGWIN32__ - - case 12: - { - // - // Nothing to do. This signal is what is delivered - // by the Cygwin library when trying use a shared - // memory function if the daemon is not running. - // - - #ifdef TEST - *logofs << "Loop: WARNING! Received signal '12' in " - << "process with pid '" << getpid() << "'.\n" - << logofs_flush; - - *logofs << "Loop: WARNING! Please check that the " - << "cygserver daemon is running.\n" - << logofs_flush; - #endif - - break; - } - - #endif - - default: - { - // - // Register the signal so we can handle it - // inside the main loop. We will probably - // dispose any resource and exit. - // - - if (getpid() == lastProxy) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Registering end of session request " - << "due to signal '" << signal << "', '" - << DumpSignal(signal) << "'.\n" - << logofs_flush; - #endif - - lastSignal = signal; - } - else - { - // - // This is a child, so exit immediately. - // - - HandleCleanup(); - } - } - } - - if (signal != 0 && lastMasks.forward[signal] == 1) - { - if (lastMasks.action[signal].sa_handler != NULL && - lastMasks.action[signal].sa_handler != HandleSignal) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Forwarding signal '" << signal << "', '" - << DumpSignal(signal) << "' to previous handler.\n" - << logofs_flush; - #endif - - lastMasks.action[signal].sa_handler(signal); - } - #ifdef WARNING - else if (lastMasks.action[signal].sa_handler == NULL) - { - *logofs << "Loop: WARNING! Parent requested to forward " - << "signal '" << signal << "', '" << DumpSignal(signal) - << "' but didn't set a handler.\n" << logofs_flush; - } - #endif - } -} - -int HandleChildren() -{ - // - // Try to waitpid() for each child because the - // call might have return ECHILD and so we may - // have lost any of the processes. - // - - if (IsRunning(lastDialog) && HandleChild(lastDialog) == 1) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Resetting pid of last dialog process " - << "in handler.\n" << logofs_flush; - #endif - - SetNotRunning(lastDialog); - - if (proxy != NULL) - { - proxy -> handleResetAlert(); - } - - return 1; - } - - if (IsRunning(lastWatchdog) && HandleChild(lastWatchdog) == 1) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Watchdog is gone. Setting the last " - << "signal to SIGHUP.\n" << logofs_flush; - #endif - - lastSignal = SIGHUP; - - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Resetting pid of last watchdog process " - << "in handler.\n" << logofs_flush; - #endif - - SetNotRunning(lastWatchdog); - - return 1; - } - - // - // The house-keeping process exits after a - // number of iterations to keep the memory - // pollution low. It is restarted on demand - // by the lower layers, using the callback - // function. - // - - if (IsRunning(lastKeeper) && HandleChild(lastKeeper) == 1) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Resetting pid of last house-keeping " - << "process in handler.\n" << logofs_flush; - #endif - - SetNotRunning(lastKeeper); - - return 1; - } - - // - // The pid will be checked by the code - // that registered the child. - // - - if (IsRunning(lastChild)) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Resetting pid of last child process " - << "in handler.\n" << logofs_flush; - #endif - - SetNotRunning(lastChild); - - return 1; - } - - proxy->checkSlaves(); - - // - // This can actually happen either because we - // reset the pid of the child process as soon - // as we kill it, or because of a child process - // of our parent. - // - - #if defined(UNSAFE) && (defined(TEST) || defined(INFO)) - *logofs << "Loop: Ignoring signal received for the " - << "unregistered child.\n" << logofs_flush; - #endif - - return 0; -} - -int HandleChild(int child) -{ - int pid; - - int status = 0; - int options = WNOHANG | WUNTRACED; - - while ((pid = waitpid(child, &status, options)) && - pid == -1 && EGET() == EINTR); - - return CheckChild(pid, status); -} - -int WaitChild(int child, const char* label, int force) -{ - int pid; - - int status = 0; - int options = WUNTRACED; - - for (;;) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Waiting for the " << label - << " process '" << child << "' to die.\n" - << logofs_flush; - #endif - - pid = waitpid(child, &status, options); - - if (pid == -1 && EGET() == EINTR) - { - if (force == 0) - { - return 0; - } - - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring signal while " - << "waiting for the " << label << " process '" - << child << "' to die.\n" - << logofs_flush; - #endif - - continue; - } - - break; - } - - return (EGET() == ECHILD ? 1 : CheckChild(pid, status)); -} - -int CheckChild(int pid, int status) -{ - lastStatus = 0; - - if (pid > 0) - { - if (WIFSTOPPED(status)) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Child process '" << pid << "' was stopped " - << "with signal " << (WSTOPSIG(status)) << ".\n" - << logofs_flush; - #endif - - return 0; - } - else - { - if (WIFEXITED(status)) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Child process '" << pid << "' exited " - << "with status '" << (WEXITSTATUS(status)) - << "'.\n" << logofs_flush; - #endif - - lastStatus = WEXITSTATUS(status); - } - else if (WIFSIGNALED(status)) - { - if (CheckSignal(WTERMSIG(status)) != 1) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Child process '" << pid - << "' died because of signal " << (WTERMSIG(status)) - << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Child process '" << pid - << "' died because of signal " << (WTERMSIG(status)) - << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"; - } - #if defined(UNSAFE) && defined(TEST) - else - { - *logofs << "Loop: Child process '" << pid - << "' died because of signal " << (WTERMSIG(status)) - << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n" - << logofs_flush; - } - #endif - - lastStatus = 1; - } - - return 1; - } - } - else if (pid < 0) - { - if (EGET() != ECHILD) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to waitpid failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to waitpid failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - HandleCleanup(); - } - - // - // This can happen when the waitpid() is - // blocking, as the SIGCHLD is received - // within the call. - // - - #ifdef TEST - *logofs << "Loop: No more children processes running.\n" - << logofs_flush; - #endif - - return 1; - } - - return 0; -} - -void RegisterChild(int child) -{ - #if defined(TEST) || defined(INFO) - - if (IsNotRunning(lastChild)) - { - *logofs << "Loop: Registering child process '" << child - << "' in process with pid '" << getpid() - << "'.\n" << logofs_flush; - } - else - { - *logofs << "Loop: WARNING! Overriding registered child '" - << lastChild << "' with new child '" << child - << "' in process with pid '" << getpid() - << "'.\n" << logofs_flush; - } - - #endif - - lastChild = child; -} - -int CheckParent(const char *name, const char *type, int parent) -{ - if (parent != getppid() || parent == 1) - { - #ifdef WARNING - *logofs << name << ": WARNING! Parent process appears " - << "to be dead. Exiting " << type << ".\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Parent process appears " - << "to be dead. Exiting " << type << ".\n"; - - return 0; - } - - return 1; -} - -void HandleTimer(int signal) -{ - if (signal == SIGALRM) - { - if (isTimestamp(lastTimer.start)) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Timer expired at " << strMsTimestamp() - << " in process with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - if (proxy != NULL) - { - proxy -> handleTimer(); - } - - ResetTimer(); - } - else - { - #ifdef PANIC - *logofs << "Loop: PANIC! Inconsistent timer state " - << " in process with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Inconsistent timer state " - << " in process with pid '" << getpid() << "'.\n"; - } - } - else - { - #ifdef PANIC - *logofs << "Loop: PANIC! Inconsistent signal '" - << signal << "', '" << DumpSignal(signal) - << "' received in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Inconsistent signal '" - << signal << "', '" << DumpSignal(signal) - << "' received in process with pid '" - << getpid() << "'.\n"; - } -} - -void SetTimer(int value) -{ - getNewTimestamp(); - - if (isTimestamp(lastTimer.start)) - { - int diffTs = diffTimestamp(lastTimer.start, getTimestamp()); - - if (diffTs > lastTimer.next.tv_usec / 1000 * 2) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Timer missed to expire at " - << strMsTimestamp() << " in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Timer missed to expire at " - << strMsTimestamp() << " in process with pid '" - << getpid() << "'.\n"; - - HandleTimer(SIGALRM); - } - else - { - #ifdef TEST - *logofs << "Loop: Timer already running at " - << strMsTimestamp() << " in process with pid '" - << getpid() << "'.\n" << logofs_flush; - #endif - - return; - } - } - - // - // Save the former handler. - // - - struct sigaction action; - - memset(&action, 0, sizeof(action)); - - action.sa_handler = HandleTimer; - - sigemptyset(&action.sa_mask); - - action.sa_flags = 0; - - sigaction(SIGALRM, &action, &lastTimer.action); - - // - // Start the timer. - // - - lastTimer.next = getTimestamp(value); - - struct itimerval timer; - - timer.it_interval = lastTimer.next; - timer.it_value = lastTimer.next; - - #ifdef TEST - *logofs << "Loop: Timer set to " << lastTimer.next.tv_sec - << " S and " << lastTimer.next.tv_usec / 1000 - << " Ms at " << strMsTimestamp() << " in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - if (setitimer(ITIMER_REAL, &timer, &lastTimer.value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to setitimer failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to setitimer failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - lastTimer.next = nullTimestamp(); - - return; - } - - lastTimer.start = getTimestamp(); -} - -void ResetTimer() -{ - if (isTimestamp(lastTimer.start) == 0) - { - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Timer not running in process " - << "with pid '" << getpid() << "'.\n" - << logofs_flush; - #endif - - return; - } - - #if defined(UNSAFE) && defined(TEST) - *logofs << "Loop: Timer reset at " << strMsTimestamp() - << " in process with pid '" << getpid() - << "'.\n" << logofs_flush; - #endif - - // - // Restore the old signal mask and timer. - // - - if (setitimer(ITIMER_REAL, &lastTimer.value, NULL) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to setitimer failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to setitimer failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - - if (sigaction(SIGALRM, &lastTimer.action, NULL) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to sigaction failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to sigaction failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - } - - lastTimer.start = lastTimer.next = nullTimestamp(); -} - -// -// Open TCP or UNIX file socket to listen for remote proxy -// and block until remote connects. If successful close -// the listening socket and return FD on which the other -// party is connected. -// - -int WaitForRemote(ChannelEndPoint &socketAddress) -{ - char hostLabel[DEFAULT_STRING_LENGTH] = { 0 }; - char *socketUri = NULL; - - int retryAccept = -1; - - int proxyFD = -1; - int newFD = -1; - - int acceptIPAddr = 0; - - if (socketAddress.isTCPSocket()) - { - - // - // Get IP address of host to be awaited. - // - - if (*acceptHost != '\0') - { - acceptIPAddr = GetHostAddress(acceptHost); - - if (acceptIPAddr == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Cannot accept connections from unknown host '" - << acceptHost << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot accept connections from unknown host '" - << acceptHost << "'.\n"; - - goto WaitForRemoteError; - } - snprintf(hostLabel, sizeof(hostLabel), "'%s'", acceptHost); - } - else - { - strcpy(hostLabel, "any host"); - } - - long bindPort; - if (socketAddress.getTCPHostAndPort(NULL, &bindPort)) - { - socketAddress.setSpec(loopbackBind ? "localhost" : "*", bindPort); - } - else - { - // This should never happen - cerr << "Error" << ": Unable to change bind host\n"; - } - } - else if (socketAddress.isUnixSocket()) - strcpy(hostLabel, "this host"); - else - strcpy(hostLabel, "unknown origin (something went wrong!!!)"); - - - proxyFD = ListenConnection(socketAddress, "NX"); - - socketAddress.getSpec(&socketUri); - #ifdef TEST - *logofs << "Loop: Waiting for connection from " - << hostLabel << " on socket '" << socketUri - << "'.\n" << logofs_flush; - #endif - cerr << "Info" << ": Waiting for connection from " - << hostLabel << " on socket '" << socketUri - << "'.\n"; - free(socketUri); - - // - // How many times to loop waiting for connections - // from the selected host? Each loop wait for at - // most 20 seconds so a default value of 3 gives - // a timeout of 1 minute. - // - // TODO: Handling of timeouts and retry attempts - // must be rewritten. - // - - retryAccept = control -> OptionProxyRetryAccept; - - for (;;) - { - fd_set readSet; - - FD_ZERO(&readSet); - FD_SET(proxyFD, &readSet); - - T_timestamp selectTs; - - selectTs.tv_sec = 20; - selectTs.tv_usec = 0; - - int result = select(proxyFD + 1, &readSet, NULL, NULL, &selectTs); - - getNewTimestamp(); - - if (result == -1) - { - if (EGET() == EINTR) - { - if (CheckAbort() != 0) - { - goto WaitForRemoteError; - } - - continue; - } - - #ifdef PANIC - *logofs << "Loop: PANIC! Call to select failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Call to select failed. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - goto WaitForRemoteError; - } - else if (result > 0 && FD_ISSET(proxyFD, &readSet)) - { - - sockaddr_in newAddrINET; - - if (socketAddress.isUnixSocket()) - { - socklen_t addrLen = sizeof(sockaddr_un); - newFD = accept(proxyFD, NULL, &addrLen); - } - else if (socketAddress.isTCPSocket()) - { - socklen_t addrLen = sizeof(sockaddr_in); - newFD = accept(proxyFD, (sockaddr *) &newAddrINET, &addrLen); - } - if (newFD == -1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to accept failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Call to accept failed. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - goto WaitForRemoteError; - } - - if (socketAddress.isUnixSocket()) - { - - char * unixPath = NULL; - socketAddress.getUnixPath(&unixPath); - #ifdef TEST - *logofs << "Loop: Accepted connection from this host on Unix file socket '" - << unixPath << "'.\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Accepted connection from this host on Unix file socket '" - << unixPath << "'.\n"; - free(unixPath); - - break; - } - else if (socketAddress.isTCPSocket()) - { - - char *connectedHost = inet_ntoa(newAddrINET.sin_addr); - - if (*acceptHost == '\0' || (int) newAddrINET.sin_addr.s_addr == acceptIPAddr) - { - - #ifdef TEST - - unsigned int connectedPort = ntohs(newAddrINET.sin_port); - - *logofs << "Loop: Accepted connection from '" << connectedHost - << "' with port '" << connectedPort << "'.\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Accepted connection from '" - << connectedHost << "'.\n"; - - break; - } - else - { - #ifdef PANIC - *logofs << "Loop: WARNING! Refusing connection from '" << connectedHost - << "' on port '" << socketAddress.getTCPPort() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Refusing connection from '" - << connectedHost << "'.\n"; - } - - // - // Not the best way to elude a DOS attack... - // - - sleep(5); - - close(newFD); - - } - - } - - if (--retryAccept == 0) - { - if (socketAddress.isUnixSocket()) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Connection via Unix file socket from this host " - << "could not be established.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Connection via Unix file socket from this host " - << "could not be established.\n"; - } - else if (*acceptHost == '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! Connection with remote host " - << "could not be established.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Connection with remote host " - << "could not be established.\n"; - } - else - { - #ifdef PANIC - *logofs << "Loop: PANIC! Connection with remote host '" - << acceptHost << "' could not be established.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Connection with remote host '" - << acceptHost << "' could not be established.\n"; - } - - goto WaitForRemoteError; - } - else - { - handleCheckSessionInConnect(); - } - } - - close(proxyFD); - - return newFD; - -WaitForRemoteError: - - close(proxyFD); - - HandleCleanup(); -} - -int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFD, int* reason) -{ - - if (!proxyFD) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). " - << "'proxyFD' must not be a NULL pointer.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). " - << "'proxyFD' must not be a NULL pointer.\n"; - - return -1; - } - - if (!reason) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). " - << "'reason' must not be a NULL pointer.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). " - << "'reason' must not be a NULL pointer.\n"; - - return -1; - } - - int remoteIPAddr = GetHostAddress(*hostName); - if (remoteIPAddr == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Unknown remote host '" - << *hostName << "'.\n" << logofs_flush; - #endif - cerr << "Error" << ": Unknown remote host '" - << *hostName << "'.\n"; - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "Loop: Connecting to remote host '" - << *hostName << ":" << *portNum << "'.\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Connecting to remote host '" - << *hostName << ":" << *portNum << "'.\n" - << logofs_flush; - - *proxyFD = -1; - *reason = -1; - - sockaddr_in addr; - addr.sin_family = AF_INET; - addr.sin_port = htons(*portNum); - addr.sin_addr.s_addr = remoteIPAddr; - - *proxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); - *reason = EGET(); - - if (*proxyFD == -1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to socket failed. " - << "Error is " << *reason << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to socket failed. " - << "Error is " << *reason << " '" << ESTR() - << "'.\n"; - return -1; - - } - else if (SetReuseAddress(*proxyFD) < 0) - { - return -1; - } - - // - // Ensure operation is timed out - // if there is a network problem. - // - - if (timeout) - SetTimer(*timeout); - else - SetTimer(20000); - - int result = connect(*proxyFD, (sockaddr *) &addr, sizeof(sockaddr_in)); - - *reason = EGET(); - - ResetTimer(); - - return result; - -} - -int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* reason) -{ - - if (!proxyFD) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). " - << "proxyFD must not be a NULL pointer.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). " - << "proxyFD must not be a NULL pointer.\n"; - - return -1; - } - - if (!reason) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). " - << "'reason' must not be a NULL pointer.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). " - << "'reason' must not be a NULL pointer.\n"; - - return -1; - } - - /* FIXME: Add socket file existence and permission checks */ - - *proxyFD = -1; - *reason = -1; - - sockaddr_un addr; - addr.sun_family = AF_UNIX; - strncpy(addr.sun_path, *path, 108 - 1); - - *proxyFD = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC); - *reason = EGET(); - - if (*proxyFD == -1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Call to socket failed. " - << "Error is " << *reason << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to socket failed. " - << "Error is " << *reason << " '" << ESTR() - << "'.\n"; - - return -1; - } - - // - // Ensure operation is timed out - // if there is a network problem. - // - - if (timeout) - SetTimer(*timeout); - else - SetTimer(20000); - - int result = connect(*proxyFD, (sockaddr *) &addr, sizeof(sockaddr_un)); - - *reason = EGET(); - - ResetTimer(); - - return result; -} - -// -// Connect to remote proxy. If successful -// return FD of connection, else return -1. -// - -int ConnectToRemote(ChannelEndPoint &socketAddress) -{ - - // - // How many times we retry to connect to remote - // host / Unix domain socket in case of failure? - // - - int retryConnect = control -> OptionProxyRetryConnect; - - // - // Show an alert after 20 seconds and use the - // same timeout to interrupt the connect. The - // retry timeout is incremental, starting from - // 100 miliseconds up to 1 second. - // - - int alertTimeout = 20000; - int connectTimeout = 20000; - int retryTimeout = 100; - - T_timestamp lastRetry = getNewTimestamp(); - - int result = -1; - int reason = -1; - int proxyFD = -1; - - char *hostName = NULL; - long int portNum = -1; - char *unixPath = NULL; - - for (;;) - { - - #ifdef DEBUG - *logofs << "Loop: Timer set to " << connectTimeout / 1000 - << " S " << "with retry set to " << retryConnect - << " in process with pid '" << getpid() - << "'.\n" << logofs_flush; - #endif - - if (socketAddress.getUnixPath(&unixPath)) - result = PrepareProxyConnectionUnix(&unixPath, &connectTimeout, &proxyFD, &reason); - else if (socketAddress.getTCPHostAndPort(&hostName, &portNum)) - result = PrepareProxyConnectionTCP(&hostName, &portNum, &connectTimeout, &proxyFD, &reason); - - if (result < 0) - { - close(proxyFD); - - if (CheckAbort() != 0) - { - goto ConnectToRemoteError; - } - else if (--retryConnect == 0) - { - ESET(reason); - - if (socketAddress.isUnixSocket()) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Connection to Unix file socket '" - << unixPath << "' failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Connection to Unix file socket '" - << unixPath << "' failed. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - } - else - { - - #ifdef PANIC - *logofs << "Loop: PANIC! Connection to '" << hostName - << ":" << portNum << "' failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Connection to '" << hostName - << ":" << portNum << "' failed. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - } - goto ConnectToRemoteError; - } - else - { - #ifdef TEST - *logofs << "Loop: Sleeping " << retryTimeout - << " ms before retrying.\n" - << logofs_flush; - #endif - - usleep(retryTimeout * 1000); - - retryTimeout <<= 1; - - if (retryTimeout > 1000 * 1000) - { - retryTimeout = 1000 * 1000; - } - } - - // - // Check if it is time to show an alert dialog. - // - - if (diffTimestamp(lastRetry, getNewTimestamp()) >= - (alertTimeout - control -> LatencyTimeout)) - { - if (IsNotRunning(lastDialog)) - { - handleCheckSessionInConnect(); - - // - // Wait for the dialog process to die - // unless a signal is received. - // - - while (IsRunning(lastDialog)) - { - WaitChild(lastDialog, "dialog", 0); - - if (CheckAbort() != 0) - { - // - // The client ignores the TERM signal - // on Windows. - // - - #ifdef __CYGWIN32__ - - KillProcess(lastDialog, "dialog", SIGKILL, 1); - - #else - - KillProcess(lastDialog, "dialog", SIGTERM, 1); - - #endif - - goto ConnectToRemoteError; - } - } - - lastRetry = getTimestamp(); - } - } - #ifdef TEST - { - *logofs << "Loop: Not showing the dialog with " - << (diffTimestamp(lastRetry, getTimestamp()) / 1000) - << " seconds elapsed.\n" << logofs_flush; - } - #endif - - ESET(reason); - - #ifdef TEST - if (unixPath && unixPath[0] != '\0' ) - { - *logofs << "Loop: Connection to Unix socket file '" - << unixPath << "' failed with error '" - << ESTR() << "'. Retrying.\n" - << logofs_flush; - } - else - { - *logofs << "Loop: Connection to '" << hostName - << ":" << portNum << "' failed with error '" - << ESTR() << "'. Retrying.\n" - << logofs_flush; - } - #endif - } - else - { - // - // Connection was successful. - // - - break; - } - } - - return proxyFD; - -ConnectToRemoteError: - - if (proxyFD != -1) - { - close(proxyFD); - } - - HandleCleanup(); -} - -// -// Make a string of options for the remote -// proxy and write it to the descriptor. -// The string includes the local version. -// - -int SendProxyOptions(int fd) -{ - char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; - - // - // Send the "compatibility" version first, then our - // actual version. Old proxies will take the first - // value and ignore the second. - // - - sprintf(options, "NXPROXY-%s-%i.%i.%i", - control -> NXPROXY_COMPATIBILITY_VERSION, - control -> LocalVersionMajor, - control -> LocalVersionMinor, - control -> LocalVersionPatch); - - // - // If you want to send options from proxy - // initiating the connection use something - // like this: - // - // if (WE_PROVIDE_CREDENTIALS) - // { - // sprintf(options + strlen(options), "%s=%s", option, value); - // } - // - // If you want to send options according to - // local proxy mode use something like this: - // - // if (control -> ProxyMode == proxy_client) - // { - // sprintf(options + strlen(options), "%s=%s", option, value); - // } - // - - // - // Send the authorization cookie if any. We assume - // user can choose to not provide any auth cookie - // and allow any connection to be accepted. - // - - if (WE_PROVIDE_CREDENTIALS && *authCookie != '\0') - { - sprintf(options + strlen(options), " cookie=%s,", authCookie); - } - else - { - sprintf(options + strlen(options), " "); - } - - // - // Now link characteristics and compression - // options. Delta compression, as well as - // preferred pack method, are imposed by - // client proxy. - // - - if (control -> ProxyMode == proxy_client) - { - sprintf(options + strlen(options), "link=%s,pack=%s,cache=%s,", - linkSpeedName, packMethodName, cacheSizeName); - - if (*bitrateLimitName != '\0') - { - sprintf(options + strlen(options), "limit=%s,", - bitrateLimitName); - } - - // - // Let the user disable the render extension - // and let the X client proxy know if it can - // short-circuit the X replies. Also pass - // along the session type to ensure that the - // remote proxy gets the right value. - // - - sprintf(options + strlen(options), "render=%d,taint=%d,", - (control -> HideRender == 0), - control -> TaintReplies); - - if (*sessionType != '\0') - { - sprintf(options + strlen(options), "type=%s,", sessionType); - } - else - { - sprintf(options + strlen(options), "type=default,"); - } - - // - // Add the 'strict' option, if needed. - // - - // Since ProtoStep7 (#issue 108) - if (useStrict != -1) - { - sprintf(options + strlen(options), "strict=%d,", useStrict); - } - - // - // Tell the remote the size of the shared - // memory segment. - // - - // Since ProtoStep7 (#issue 108) - if (*shsegSizeName != '\0') - { - sprintf(options + strlen(options), "shseg=%s,", shsegSizeName); - } - - // - // Send image cache parameters. - // - - sprintf(options + strlen(options), "images=%s,", imagesSizeName); - - sprintf(options + strlen(options), "delta=%d,stream=%d,data=%d ", - control -> LocalDeltaCompression, - control -> LocalStreamCompressionLevel, - control -> LocalDataCompressionLevel); - } - else - { - // - // If no special compression level was selected, - // server side will use compression levels set - // by client. - // - - if (control -> LocalStreamCompressionLevel < 0) - { - sprintf(options + strlen(options), "stream=default,"); - } - else - { - sprintf(options + strlen(options), "stream=%d,", - control -> LocalStreamCompressionLevel); - } - - if (control -> LocalDataCompressionLevel < 0) - { - sprintf(options + strlen(options), "data=default "); - } - else - { - sprintf(options + strlen(options), "data=%d ", - control -> LocalDataCompressionLevel); - } - } - - #ifdef TEST - *logofs << "Loop: Sending remote options '" - << options << "'.\n" << logofs_flush; - #endif - - return WriteLocalData(fd, options, strlen(options)); -} - -int ReadProxyVersion(int fd) -{ - #ifdef TEST - *logofs << "Loop: Going to read the remote proxy version " - << "from FD#" << fd << ".\n" << logofs_flush; - #endif - - // - // Read until the first space in string. - // We expect the remote version number. - // - - char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; - - int result = ReadRemoteData(fd, options, sizeof(options), ' '); - - if (result <= 0) - { - if (result < 0) - { - if (control -> ProxyMode == proxy_server) - { - HandleAlert(ABORT_PROXY_NEGOTIATION_ALERT, 1); - } - - handleAlertInLoop(); - } - - return result; - } - - #ifdef TEST - *logofs << "Loop: Received remote version string '" - << options << "' from FD#" << fd << ".\n" - << logofs_flush; - #endif - - if (strncmp(options, "NXPROXY-", strlen("NXPROXY-")) != 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Parse error in remote options string '" - << options << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Parse error in remote options string '" - << options << "'.\n"; - - return -1; - } - - // - // Try to determine if this is a pre-2.0.0 - // version advertising itself as compatible - // with the 1.2.2. - // - - int major = -1; - int minor = -1; - int patch = -1; - - sscanf(options, "NXPROXY-%i.%i.%i-%i.%i.%i", &(control -> RemoteVersionMajor), - &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch), - &major, &minor, &patch); - - if (control -> RemoteVersionMajor == 1 && - control -> RemoteVersionMinor == 2 && - control -> RemoteVersionPatch == 2 && - major != -1 && minor != -1 && patch != -1) - { - #ifdef TEST - *logofs << "Loop: Read trailing remote version '" << major - << "." << minor << "." << patch << "'.\n" - << logofs_flush; - #endif - - control -> CompatVersionMajor = major; - control -> CompatVersionMinor = minor; - control -> CompatVersionPatch = patch; - - control -> RemoteVersionMajor = major; - control -> RemoteVersionMinor = minor; - control -> RemoteVersionPatch = patch; - } - else - { - // - // We read the remote version at the first - // round. If the second version is missing, - // we will retain the values read before. - // - - sscanf(options, "NXPROXY-%i.%i.%i-%i.%i.%i", &(control -> CompatVersionMajor), - &(control -> CompatVersionMinor), &(control -> CompatVersionPatch), - &(control -> RemoteVersionMajor), &(control -> RemoteVersionMinor), - &(control -> RemoteVersionPatch)); - } - - *logofs << "Loop: Identified remote version '" << control -> RemoteVersionMajor - << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch - << "'.\n" << logofs_flush; - - *logofs << "Loop: Remote compatibility version '" << control -> CompatVersionMajor - << "." << control -> CompatVersionMinor << "." << control -> CompatVersionPatch - << "'.\n" << logofs_flush; - - *logofs << "Loop: Local version '" << control -> LocalVersionMajor - << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch - << "'.\n" << logofs_flush; - - if (SetVersion() < 0) - { - if (control -> ProxyMode == proxy_server) - { - HandleAlert(WRONG_PROXY_VERSION_ALERT, 1); - } - - handleAlertInLoop(); - - return -1; - } - - return 1; -} - -int ReadProxyOptions(int fd) -{ - #ifdef TEST - *logofs << "Loop: Going to read the remote proxy options " - << "from FD#" << fd << ".\n" << logofs_flush; - #endif - - char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; - - int result = ReadRemoteData(fd, options, sizeof(options), ' '); - - if (result <= 0) - { - return result; - } - - #ifdef TEST - *logofs << "Loop: Received remote options string '" - << options << "' from FD#" << fd << ".\n" - << logofs_flush; - #endif - - // - // Get the remote options, delimited by a space character. - // Note that there will be a further initialization phase - // at the time proxies negotiate cache file to restore. - // - - if (ParseRemoteOptions(options) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Couldn't negotiate a valid " - << "session with remote NX proxy.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Couldn't negotiate a valid " - << "session with remote NX proxy.\n"; - - return -1; - } - - return 1; -} - -int SendProxyCaches(int fd) -{ - #ifdef TEST - *logofs << "Loop: Synchronizing local and remote caches.\n" - << logofs_flush; - #endif - - if (control -> ProxyMode == proxy_client) - { - // - // Prepare a list of caches matching this - // session type and send it to the remote. - // - - #ifdef TEST - *logofs << "Loop: Going to send the list of local caches.\n" - << logofs_flush; - #endif - - SetCaches(); - - int entries = DEFAULT_REMOTE_CACHE_ENTRIES; - - const char prefix = 'C'; - - if (control -> LocalDeltaCompression == 0 || - control -> PersistentCacheEnableLoad == 0) - { - #ifdef TEST - *logofs << "Loop: Writing an empty list to FD#" << fd - << ".\n" << logofs_flush; - #endif - - return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none ")); - } - - int count = 0; - - #ifdef TEST - *logofs << "Loop: Looking for cache files in directory '" - << control -> PersistentCachePath << "'.\n" << logofs_flush; - #endif - - DIR *cacheDir = opendir(control -> PersistentCachePath); - - if (cacheDir != NULL) - { - dirent *dirEntry; - - int prologue = 0; - - while (((dirEntry = readdir(cacheDir)) != NULL) && (count < entries)) - { - if (*dirEntry -> d_name == prefix && - strlen(dirEntry -> d_name) == (MD5_LENGTH * 2 + 2)) - { - if (prologue == 0) - { - WriteLocalData(fd, "cachelist=", strlen("cachelist=")); - - prologue = 1; - } - else - { - WriteLocalData(fd, ",", strlen(",")); - } - - #ifdef TEST - *logofs << "Loop: Writing entry '" << control -> PersistentCachePath - << "/" << dirEntry -> d_name << "' to FD#" << fd - << ".\n" << logofs_flush; - #endif - - // - // Write cache file name to the socket, - // including leading 'C-' or 'S-'. - // - - WriteLocalData(fd, dirEntry -> d_name, MD5_LENGTH * 2 + 2); - - count++; - } - } - - closedir(cacheDir); - } - - if (count == 0) - { - #ifdef TEST - *logofs << "Loop: Writing an empty list to FD#" << fd - << ".\n" << logofs_flush; - #endif - - return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none ")); - } - else - { - return WriteLocalData(fd, " ", 1); - } - } - else - { - // - // Send back the selected cache name. - // - - #ifdef TEST - *logofs << "Loop: Going to send the selected cache.\n" - << logofs_flush; - #endif - - char buffer[DEFAULT_STRING_LENGTH]; - - if (control -> PersistentCacheName != NULL) - { - #ifdef TEST - *logofs << "Loop: Name of selected cache file is '" - << control -> PersistentCacheName << "'.\n" - << logofs_flush; - #endif - - sprintf(buffer, "cachefile=%s%s ", - *(control -> PersistentCacheName) == 'C' ? "S-" : "C-", - control -> PersistentCacheName + 2); - } - else - { - #ifdef TEST - *logofs << "Loop: No valid cache file was selected.\n" - << logofs_flush; - #endif - - sprintf(buffer, "cachefile=none "); - } - - #ifdef TEST - *logofs << "Loop: Sending string '" << buffer - << "' as selected cache file.\n" - << logofs_flush; - #endif - - return WriteLocalData(fd, buffer, strlen(buffer)); - } -} - -int ReadProxyCaches(int fd) -{ - if (control -> ProxyMode == proxy_client) - { - #ifdef TEST - *logofs << "Loop: Going to receive the selected proxy cache.\n" - << logofs_flush; - #endif - - // - // We will read the name of cache plus the stop character. - // - - char buffer[DEFAULT_STRING_LENGTH]; - - // - // Leave space for a trailing null. - // - - int result = ReadRemoteData(fd, buffer, sizeof("cachefile=") + MD5_LENGTH * 2 + 3, ' '); - - if (result <= 0) - { - return result; - } - - char *cacheName = strstr(buffer, "cachefile="); - - if (cacheName == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid cache file option '" - << buffer << "' provided by remote proxy.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid cache file option '" - << buffer << "' provided by remote proxy.\n"; - - HandleCleanup(); - } - - cacheName += strlen("cachefile="); - - if (control -> PersistentCacheName != NULL) - { - delete [] control -> PersistentCacheName; - } - - control -> PersistentCacheName = NULL; - - if (strncasecmp(cacheName, "none", strlen("none")) == 0) - { - #ifdef TEST - *logofs << "Loop: No cache file selected by remote proxy.\n" - << logofs_flush; - #endif - } - else if (strlen(cacheName) != MD5_LENGTH * 2 + 3 || - *(cacheName + MD5_LENGTH * 2 + 2) != ' ') - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid cache file name '" - << cacheName << "' provided by remote proxy.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid cache file name '" - << cacheName << "' provided by remote proxy.\n"; - - HandleCleanup(); - } - else - { - // - // It is "C-" + 32 + "\0". - // - - control -> PersistentCacheName = new char[MD5_LENGTH * 2 + 3]; - - *(cacheName + MD5_LENGTH * 2 + 2) = '\0'; - - strcpy(control -> PersistentCacheName, cacheName); - - #ifdef TEST - *logofs << "Loop: Cache file '" << control -> PersistentCacheName - << "' selected by remote proxy.\n" << logofs_flush; - #endif - } - } - else - { - #ifdef TEST - *logofs << "Loop: Going to receive the list of remote caches.\n" - << logofs_flush; - #endif - - SetCaches(); - - int size = ((MD5_LENGTH * 2 + 2) + strlen(",")) * DEFAULT_REMOTE_CACHE_ENTRIES + - strlen("cachelist=") + strlen(" ") + 1; - - char *buffer = new char[size]; - - int result = ReadRemoteData(fd, buffer, size - 1, ' '); - - if (result <= 0) - { - delete [] buffer; - - return result; - } - - #ifdef TEST - *logofs << "Loop: Read list of caches from remote side as '" - << buffer << "'.\n" << logofs_flush; - #endif - - // - // Prepare the buffer. What we want is a list - // like "cache1,cache2,cache2" terminated by - // null. - // - - *(buffer + strlen(buffer) - 1) = '\0'; - - if (strncasecmp(buffer, "cachelist=", strlen("cachelist=")) != 0) - { - #ifdef PANIC - *logofs << "Loop: Wrong format for list of cache files " - << "read from FD#" << fd << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Wrong format for list of cache files.\n"; - - delete [] buffer; - - return -1; - } - - control -> PersistentCacheName = GetLastCache(buffer, control -> PersistentCachePath); - - // - // Get rid of list of caches. - // - - delete [] buffer; - } - - return 1; -} - -int ReadForwarderVersion(int fd) -{ - #ifdef TEST - *logofs << "Loop: Going to negotiate the forwarder version.\n" - << logofs_flush; - #endif - - // - // Check if we actually expect the session cookie. - // - - if (*authCookie == '\0') - { - #ifdef TEST - *logofs << "Loop: No authentication cookie required " - << "from FD#" << fd << ".\n" << logofs_flush; - #endif - - return 1; - } - - char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; - - int result = ReadRemoteData(fd, options, sizeof(options), ' '); - - if (result <= 0) - { - return result; - } - - #ifdef TEST - *logofs << "Loop: Received forwarder version string '" << options - << "' from FD#" << fd << ".\n" << logofs_flush; - #endif - - if (strncmp(options, "NXSSH-", strlen("NXSSH-")) != 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Parse error in forwarder options string '" - << options << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Parse error in forwarder options string '" - << options << "'.\n"; - - return -1; - } - - // - // Accept whatever forwarder version. - // - - sscanf(options, "NXSSH-%i.%i.%i", &(control -> RemoteVersionMajor), - &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch)); - - #ifdef TEST - *logofs << "Loop: Read forwarder version '" << control -> RemoteVersionMajor - << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch - << "'.\n" << logofs_flush; - #endif - - return 1; -} - -int ReadForwarderOptions(int fd) -{ - // - // Get the forwarder cookie. - // - - if (*authCookie == '\0') - { - #ifdef TEST - *logofs << "Loop: No authentication cookie required " - << "from FD#" << fd << ".\n" << logofs_flush; - #endif - - return 1; - } - - char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; - - int result = ReadRemoteData(fd, options, sizeof(options), ' '); - - if (result <= 0) - { - return result; - } - - #ifdef TEST - *logofs << "Loop: Received forwarder options string '" - << options << "' from FD#" << fd << ".\n" - << logofs_flush; - #endif - - if (ParseForwarderOptions(options) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Couldn't negotiate a valid " - << "cookie with the NX forwarder.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Couldn't negotiate a valid " - << "cookie with the NX forwarder.\n"; - - return -1; - } - - return 1; -} - -int ReadRemoteData(int fd, char *buffer, int size, char stop) -{ - #ifdef TEST - *logofs << "Loop: Going to read remote data from FD#" - << fd << ".\n" << logofs_flush; - #endif - - if (size >= MAXIMUM_REMOTE_OPTIONS_LENGTH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Maximum remote options buffer " - << "limit exceeded.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Maximum remote options buffer " - << "limit exceeded.\n"; - - HandleCleanup(); - } - - while (remotePosition < (size - 1)) - { - int result = read(fd, remoteData + remotePosition, 1); - - getNewTimestamp(); - - if (result <= 0) - { - if (result == -1) - { - if (EGET() == EAGAIN) - { - #ifdef TEST - *logofs << "Loop: Reading data from FD#" << fd - << " would block.\n" << logofs_flush; - #endif - - return 0; - } - else if (EGET() == EINTR) - { - if (CheckAbort() != 0) - { - return -1; - } - - continue; - } - } - - #ifdef PANIC - *logofs << "Loop: PANIC! The remote NX proxy closed " - << "the connection.\n" << logofs_flush; - #endif - - cerr << "Error" << ": The remote NX proxy closed " - << "the connection.\n"; - - return -1; - } - else if (*(remoteData + remotePosition) == stop) - { - #ifdef TEST - *logofs << "Loop: Read stop character from FD#" - << fd << ".\n" << logofs_flush; - #endif - - remotePosition++; - - // - // Copy the fake terminating null - // in the buffer. - // - - *(remoteData + remotePosition) = '\0'; - - memcpy(buffer, remoteData, remotePosition + 1); - - #ifdef TEST - *logofs << "Loop: Remote string '" << remoteData - << "' read from FD#" << fd << ".\n" - << logofs_flush; - #endif - - int t = remotePosition; - - remotePosition = 0; - - return t; - } - else - { - // - // Make sure string received - // from far end is printable. - // - - if (isgraph(*(remoteData + remotePosition)) == 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Non printable character decimal '" - << (unsigned int) *(remoteData + remotePosition) - << "' received in remote data from FD#" - << fd << ".\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Non printable character decimal '" - << (unsigned int) *(remoteData + remotePosition) - << "' received in remote data from FD#" - << fd << ".\n" << logofs_flush; - - *(remoteData + remotePosition) = ' '; - } - - #ifdef DEBUG - *logofs << "Loop: Read a further character " - << "from FD#" << fd << ".\n" - << logofs_flush; - #endif - - remotePosition++; - } - } - - *(remoteData + remotePosition) = '\0'; - - #ifdef PANIC - *logofs << "Loop: PANIC! Stop character missing " - << "from FD#" << fd << " after " << remotePosition - << " characters read in string '" << remoteData - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Stop character missing " - << "from FD#" << fd << " after " << remotePosition - << " characters read in string '" << remoteData - << "'.\n"; - - memcpy(buffer, remoteData, remotePosition); - - remotePosition = 0; - - return -1; -} - -static int -hexval(char c) { - if ((c >= '0') && (c <= '9')) - return c - '0'; - if ((c >= 'a') && (c <= 'f')) - return c - 'a' + 10; - if ((c >= 'A') && (c <= 'F')) - return c - 'A' + 10; - return -1; -} - -static void -URLDecodeInPlace(char *str) { - if (str) { - char *to = str; - while (str[0]) { - if ((str[0] == '%') && - (hexval(str[1]) >= 0) && - (hexval(str[2]) >= 0)) { - *(to++) = hexval(str[1]) * 16 + hexval(str[2]); - str += 3; - } - else - *(to++) = *(str++); - } - *to = '\0'; - } -} - -int WriteLocalData(int fd, const char *buffer, int size) -{ - int position = 0; - int ret = 0; - fd_set writeSet; - struct timeval selectTs = {30, 0}; - - while (position < size) - { - - // A write to a non-blocking socket may fail with EAGAIN. The problem is - // that cache data is done in several writes, and there's no easy way - // to handle failure without rewriting a significant amount of code. - // - // Bailing out of the outer loop would result in restarting the sending - // of the entire cache list, which would confuse the other side. - - FD_ZERO(&writeSet); - FD_SET(fd, &writeSet); - - ret = select(fd+1, NULL, &writeSet, NULL, &selectTs); - - #ifdef DEBUG - *logofs << "Loop: WriteLocalData: select() returned with a code of " << ret << " and remaining timeout of " - << selectTs.tv_sec << " sec, " << selectTs.tv_usec << "usec\n" << logofs_flush; - #endif - - if ( ret < 0 ) - { - *logofs << "Loop: Error in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush; - - if ( EGET() == EINTR ) - continue; - - return -1; - } - else if ( ret == 0 ) - { - *logofs << "Loop: Timeout expired in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush; - return -1; - } - - int result = write(fd, buffer + position, size - position); - - getNewTimestamp(); - - if (result <= 0) - { - if (result < 0 && (EGET() == EINTR || EGET() == EAGAIN || EGET() == EWOULDBLOCK)) - { - continue; - } - - #ifdef TEST - *logofs << "Loop: Error writing data to FD#" - << fd << ".\n" << logofs_flush; - #endif - - return -1; - } - - position += result; - } - - return position; -} - -// -// Parse the string passed by calling process in -// the environment. This is not necessarily the -// content of DISPLAY variable, but can be the -// parameters passed when creating the process -// or thread. -// - -int ParseEnvironmentOptions(const char *env, int force) -{ - // - // Be sure log file is valid. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - // - // Be sure we have a parameters repository - // and a context to jump into because this - // can be called before creating the proxy. - // - - if (control == NULL) - { - control = new Control(); - } - - if (setjmp(context) == 1) - { - #ifdef TEST - *logofs << "Loop: Out of the long jump while parsing " - << "the environment options.\n" - << logofs_flush; - #endif - - return -1; - } - - if (force == 0 && parsedOptions == 1) - { - #ifdef TEST - *logofs << "Loop: Skipping a further parse of environment " - << "options string '" << (env != NULL ? env : "") - << "'.\n" << logofs_flush; - #endif - - return 1; - } - - if (env == NULL || *env == '\0') - { - #ifdef TEST - *logofs << "Loop: Nothing to do with empty environment " - << "options string '" << (env != NULL ? env : "") - << "'.\n" << logofs_flush; - #endif - - return 0; - } - - #ifdef TEST - *logofs << "Loop: Going to parse the environment options " - << "string '" << env << "'.\n" - << logofs_flush; - #endif - - parsedOptions = 1; - - // - // Copy the string passed as parameter - // because we need to modify it. - // - - char opts[DEFAULT_DISPLAY_OPTIONS_LENGTH]; - - #ifdef VALGRIND - - memset(opts, '\0', DEFAULT_DISPLAY_OPTIONS_LENGTH); - - #endif - - if (strlen(env) >= DEFAULT_DISPLAY_OPTIONS_LENGTH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Environment options string '" << env - << "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH - << " characters.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Environment options string '" << env - << "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH - << " characters.\n"; - - return -1; - } - - strcpy(opts, env); - - char *nextOpts = opts; - - // - // Ensure that DISPLAY environment variable - // (roughly) follows the X convention for - // transport notation. - // - - if (strncasecmp(opts, "nx/nx,:", 7) == 0 || - strncasecmp(opts, "nx,:", 4) == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Parse error in options string '" - << opts << "' at 'nx,:'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Parse error in options string '" - << opts << "' at 'nx,:'.\n"; - - return -1; - } - else if (strncasecmp(opts, "nx/nx,", 6) == 0) - { - nextOpts += 6; - } - else if (strncasecmp(opts, "nx,", 3) == 0) - { - nextOpts += 3; - } - else if (strncasecmp(opts, "nx:", 3) == 0) - { - nextOpts += 3; - } - else if (force == 0) - { - #ifdef TEST - *logofs << "Loop: Ignoring host X server display string '" - << opts << "'.\n" << logofs_flush; - #endif - - return 0; - } - - // - // Save here the name of the options file and - // parse it after all the other options. - // - - char fileOptions[DEFAULT_STRING_LENGTH] = { 0 }; - - // - // The options string is intended to be a series - // of name/value tuples in the form name=value - // separated by the ',' character ended by a ':' - // followed by remote NX proxy port. - // - - char *name; - char *value; - - value = strrchr(nextOpts, ':'); - - if (value != NULL) - { - char *check = value + 1; - - if (*check == '\0' || isdigit(*check) == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify NX port in string '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify NX port in string '" - << value << "'.\n"; - - return -1; - } - - proxyPort = atoi(check); - - // - // Get rid of the port specification. - // - - *value = '\0'; - } - else if (proxyPort == DEFAULT_NX_PROXY_PORT && force == 0) - { - // - // Complain only if user didn't specify - // the port on the command line. - // - - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify NX port in string '" - << opts << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify NX port in string '" - << opts << "'.\n"; - - return -1; - } - - #ifdef TEST - *logofs << "Loop: Parsing options string '" - << nextOpts << "'.\n" << logofs_flush; - #endif - - // - // Now all the other optional parameters. - // - - name = strtok(nextOpts, "="); - - char connectHost[DEFAULT_STRING_LENGTH] = { 0 }; - long connectPort = -1; - - while (name) - { - value = strtok(NULL, ","); - URLDecodeInPlace(value); - - if (CheckArg("environment", name, value) < 0) - { - return -1; - } - - if (strcasecmp(name, "options") == 0) - { - strncpy(fileOptions, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "display") == 0) - { - strncpy(displayHost, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "link") == 0) - { - - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else if (ParseLinkOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify 'link' option in string '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify 'link' option in string '" - << value << "'.\n"; - if (ParseLinkOption("adsl") < 0) - return -1; - } - } - else if (strcasecmp(name, "limit") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else if (ParseBitrateOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify option 'limit' in string '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify option 'limit' in string '" - << value << "'.\n"; - - return -1; - } - } - else if (strcasecmp(name, "type") == 0) - { - // - // Type of session, for example "desktop", - // "application", "windows", etc. - // - - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - if (strcasecmp(value, "default") == 0) - { - *sessionType = '\0'; - } - else - { - strncpy(sessionType, value, DEFAULT_STRING_LENGTH - 1); - } - } - } - else if (strcasecmp(name, "listen") == 0) - { - char *socketUri = NULL; - if (connectSocket.getSpec(&socketUri)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't handle 'listen' and 'connect' parameters " - << "at the same time.\n" << logofs_flush; - - *logofs << "Loop: PANIC! Refusing 'listen' parameter with 'connect' being '" - << socketUri << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't handle 'listen' and 'connect' parameters " - << "at the same time.\n"; - - cerr << "Error" << ": Refusing 'listen' parameter with 'connect' being '" - << socketUri << "'.\n"; - - free(socketUri); - return -1; - } - - SetAndValidateChannelEndPointArg("local", name, value, listenSocket); - - } - else if (strcasecmp(name, "loopback") == 0) - { - loopbackBind = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "accept") == 0) - { - char *socketUri = NULL; - if (connectSocket.getSpec(&socketUri)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't handle 'accept' and 'connect' parameters " - << "at the same time.\n" << logofs_flush; - - *logofs << "Loop: PANIC! Refusing 'accept' parameter with 'connect' being '" - << socketUri << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't handle 'accept' and 'connect' parameters " - << "at the same time.\n"; - - cerr << "Error" << ": Refusing 'accept' parameter with 'connect' being '" - << socketUri << "'.\n"; - - free(socketUri); - return -1; - } - - strncpy(acceptHost, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "connect") == 0) - { - if (*acceptHost != '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't handle 'connect' and 'accept' parameters " - << "at the same time.\n" << logofs_flush; - - *logofs << "Loop: PANIC! Refusing 'connect' parameter with 'accept' being '" - << acceptHost << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't handle 'connect' and 'accept' parameters " - << "at the same time.\n"; - - cerr << "Error" << ": Refusing 'connect' parameter with 'accept' being '" - << acceptHost << "'.\n"; - - return -1; - } - if ((strncmp(value, "tcp:", 4) == 0) || (strncmp(value, "unix:", 5) == 0)) - SetAndValidateChannelEndPointArg("local", name, value, connectSocket); - else - // if the "connect" parameter does not start with "unix:" or "tcp:" assume - // old parameter usage style (providing hostname string only). - strcpy(connectHost, value); - } - else if (strcasecmp(name, "port") == 0) - { - connectPort = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "retry") == 0) - { - control -> OptionProxyRetryConnect = ValidateArg("local", name, value); - control -> OptionServerRetryConnect = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "session") == 0) - { - strncpy(sessionFileName, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "errors") == 0) - { - // - // The old name of the parameter was 'log' - // but the default name for the file is - // 'errors' so it is more logical to use - // the same name. - // - - strncpy(errorsFileName, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "root") == 0) - { - strncpy(rootDir, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "id") == 0) - { - strncpy(sessionId, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "stats") == 0) - { - control -> EnableStatistics = 1; - - strncpy(statsFileName, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "cookie") == 0) - { - LowercaseArg("local", name, value); - - strncpy(authCookie, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "nodelay") == 0) - { - useNoDelay = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "policy") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - usePolicy = ValidateArg("local", name, value); - } - } - else if (strcasecmp(name, "render") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - useRender = ValidateArg("local", name, value); - } - } - else if (strcasecmp(name, "taint") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - useTaint = ValidateArg("local", name, value); - } - } - else if (strcasecmp(name, "delta") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - control -> LocalDeltaCompression = ValidateArg("local", name, value); - } - } - else if (strcasecmp(name, "data") == 0) - { - control -> LocalDataCompressionLevel = ValidateArg("local", name, value); - - if (control -> LocalDataCompressionLevel == 0) - { - control -> LocalDataCompression = 0; - } - else - { - control -> LocalDataCompression = 1; - } - } - else if (strcasecmp(name, "stream") == 0) - { - control -> LocalStreamCompressionLevel = ValidateArg("local", name, value); - - if (control -> LocalStreamCompressionLevel == 0) - { - control -> LocalStreamCompression = 0; - } - else - { - control -> LocalStreamCompression = 1; - } - } - else if (strcasecmp(name, "memory") == 0) - { - control -> LocalMemoryLevel = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "cache") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else if (ParseCacheOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify cache size for string '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify cache size for string '" - << value << "'.\n"; - - return -1; - } - } - else if (strcasecmp(name, "images") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else if (ParseImagesOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify images cache size for string '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify images cache size for string '" - << value << "'.\n"; - - return -1; - } - } - else if (strcasecmp(name, "shseg") == 0) - { - // - // The 'shmem' option is used by the agent, together - // with 'shpix' literal. We make the 'shseg' option - // specific to the proxy and use it to determine the - // size of the shared memory segment, or otherwise 0, - // if the use of the shared memory extension should - // not be enabled on the real X server. - // - - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else if (ParseShmemOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify size of shared memory " - << "segment in string '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify size of shared memory " - << "segment in string '" << value << "'.\n"; - - return -1; - } - } - else if (strcasecmp(name, "load") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - control -> PersistentCacheEnableLoad = ValidateArg("local", name, value); - - if (control -> PersistentCacheEnableLoad > 0) - { - control -> PersistentCacheEnableLoad = 1; - } - else - { - if (control -> PersistentCacheName != NULL) - { - delete [] control -> PersistentCacheName; - } - - control -> PersistentCacheName = NULL; - - control -> PersistentCacheEnableLoad = 0; - } - } - } - else if (strcasecmp(name, "save") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - control -> PersistentCacheEnableSave = ValidateArg("local", name, value); - - if (control -> PersistentCacheEnableSave > 0) - { - control -> PersistentCacheEnableSave = 1; - } - else - { - if (control -> PersistentCacheName != NULL) - { - delete [] control -> PersistentCacheName; - } - - control -> PersistentCacheName = NULL; - - control -> PersistentCacheEnableSave = 0; - } - } - } - else if (strcasecmp(name, "cups") == 0) - { - SetAndValidateChannelEndPointArg("local", name, value, cupsPort); - } - else if (strcasecmp(name, "sync") == 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! No 'sync' channel in current version. " - << "Assuming 'cups' channel.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": No 'sync' channel in current version. " - << "Assuming 'cups' channel.\n"; - - SetAndValidateChannelEndPointArg("local", name, value, cupsPort); - } - else if (strcasecmp(name, "keybd") == 0 || - strcasecmp(name, "aux") == 0) - { - SetAndValidateChannelEndPointArg("local", name, value, auxPort); - } - else if (strcasecmp(name, "samba") == 0 || - strcasecmp(name, "smb") == 0) - { - SetAndValidateChannelEndPointArg("local", name, value, smbPort); - } - else if (strcasecmp(name, "media") == 0) - { - SetAndValidateChannelEndPointArg("local", name, value, mediaPort); - } - else if (strcasecmp(name, "http") == 0) - { - SetAndValidateChannelEndPointArg("local", name, value, httpPort); - } - else if (strcasecmp(name, "font") == 0) - { - strncpy(fontPort, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "slave") == 0) - { - SetAndValidateChannelEndPointArg("local", name, value, slavePort); - } - else if (strcasecmp(name, "mask") == 0) - { - control -> ChannelMask = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "timeout") == 0) - { - int timeout = ValidateArg("local", name, value); - - if (timeout == 0) - { - #ifdef TEST - *logofs << "Loop: Disabling timeout on broken " - << "proxy connection.\n" << logofs_flush; - #endif - - control -> ProxyTimeout = 0; - } - else - { - control -> ProxyTimeout = timeout * 1000; - } - } - else if (strcasecmp(name, "cleanup") == 0) - { - int cleanup = ValidateArg("local", name, value); - - if (cleanup == 0) - { - #ifdef TEST - *logofs << "Loop: Disabling grace timeout on " - << "proxy shutdown.\n" << logofs_flush; - #endif - - control -> CleanupTimeout = 0; - } - else - { - control -> CleanupTimeout = cleanup * 1000; - } - } - else if (strcasecmp(name, "pack") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else if (ParsePackOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify pack method for string '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify pack method for string '" - << value << "'.\n"; - if (ParsePackOption("nopack")<0) - return -1; - } - } - else if (strcasecmp(name, "core") == 0) - { - control -> EnableCoreDumpOnAbort = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "kill") == 0) - { - if (control -> KillDaemonOnShutdownNumber < - control -> KillDaemonOnShutdownLimit) - { - #ifdef TEST - *logofs << "Loop: WARNING! Adding process with pid '" - << ValidateArg("local", name, value) << " to the " - << "daemons to kill at shutdown.\n" - << logofs_flush; - #endif - - control -> KillDaemonOnShutdown[control -> - KillDaemonOnShutdownNumber] = - ValidateArg("local", name, value); - - control -> KillDaemonOnShutdownNumber++; - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Number of daemons to kill " - << "at shutdown exceeded.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Number of daemons to kill " - << "at shutdown exceeded.\n"; - } - } - else if (strcasecmp(name, "strict") == 0) - { - if (control -> ProxyMode == proxy_server) - { - PrintOptionIgnored("local", name, value); - } - else - { - useStrict = ValidateArg("local", name, value); - } - } - else if (strcasecmp(name, "encryption") == 0) - { - useEncryption = ValidateArg("local", name, value); - } - else if (strcasecmp(name, "product") == 0) - { - strncpy(productName, value, DEFAULT_STRING_LENGTH - 1); - } - else if (strcasecmp(name, "rootless") == 0 || - strcasecmp(name, "geometry") == 0 || - strcasecmp(name, "resize") == 0 || - strcasecmp(name, "fullscreen") == 0 || - strcasecmp(name, "keyboard") == 0 || - strcasecmp(name, "clipboard") == 0 || - strcasecmp(name, "streaming") == 0 || - strcasecmp(name, "backingstore") == 0 || - strcasecmp(name, "sleep") == 0 || - strcasecmp(name, "tolerancechecks") == 0) - { - #ifdef DEBUG - *logofs << "Loop: Ignoring agent option '" << name - << "' with value '" << value << "'.\n" - << logofs_flush; - #endif - } - else if (strcasecmp(name, "composite") == 0 || - strcasecmp(name, "shmem") == 0 || - strcasecmp(name, "shpix") == 0 || - strcasecmp(name, "kbtype") == 0 || - strcasecmp(name, "client") == 0 || - strcasecmp(name, "shadow") == 0 || - strcasecmp(name, "shadowuid") == 0 || - strcasecmp(name, "shadowmode") == 0 || - strcasecmp(name, "clients") == 0 || - strcasecmp(name, "xinerama") == 0) - { - #ifdef DEBUG - *logofs << "Loop: Ignoring agent option '" << name - << "' with value '" << value << "'.\n" - << logofs_flush; - #endif - } - else if (strcasecmp(name, "defer") == 0 || - strcasecmp(name, "tile") == 0 || - strcasecmp(name, "menu") == 0 || - strcasecmp(name, "state") == 0 ) - { - #ifdef DEBUG - *logofs << "Loop: Ignoring agent option '" << name - << "' with value '" << value << "'.\n" - << logofs_flush; - #endif - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring unknown option '" - << name << "' with value '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Ignoring unknown option '" - << name << "' with value '" << value << "'.\n"; - } - - name = strtok(NULL, "="); - - } // End of while (name) ... - - // Assemble the connectSocket channel end point if parameter values have been old-school... - if (connectSocket.disabled() && (connectHost[0] != '\0') && (proxyPort > 0 || connectPort > 0)) - { - if (connectPort < 0) - connectPort = proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET; - - char tcpHostAndPort[DEFAULT_STRING_LENGTH] = { 0 }; - sprintf(tcpHostAndPort, "tcp:%s:%ld", connectHost, connectPort); - SetAndValidateChannelEndPointArg("local", name, tcpHostAndPort, connectSocket); - } - - #ifdef TEST - *logofs << "Loop: Completed parsing of string '" - << env << "'.\n" << logofs_flush; - #endif - - if ((*fileOptions != '\0') && (strncmp(fileOptions, "/dev/", 5) != 0) && (strncmp(fileOptions, "/proc/", 6) != 0) && (strncmp(fileOptions, "/sys/", 5) != 0)) - { - if (strcmp(fileOptions, optionsFileName) != 0) - { - #ifdef TEST - *logofs << "Loop: Reading options from '" << fileOptions - << "'.\n" << logofs_flush; - #endif - - if (ParseFileOptions(fileOptions) < 0) - { - return -1; - } - } - #ifdef WARNING - else - { - *logofs << "Loop: WARNING! Name of the options file " - << "specified multiple times. Not parsing " - << "again.\n" << logofs_flush; - } - #endif - - if (*optionsFileName == '\0') - { - strncpy(optionsFileName, value, DEFAULT_STRING_LENGTH - 1); - - #ifdef TEST - *logofs << "Loop: Assuming name of options file '" - << optionsFileName << "'.\n" - << logofs_flush; - #endif - } - } - - // - // If port where proxy is acting as an X server - // was not specified assume the same port where - // proxy is listening for the remote peer. - // - - if (xPort == DEFAULT_NX_X_PORT) - { - xPort = proxyPort; - } - - return 1; -} - -// -// Parse the command line options passed by user when -// running proxy in stand alone mode. Note that passing -// parameters this way is strongly discouraged. These -// command line switch can change (and they do often). -// Please, use the form "option=value" instead and set -// the DISPLAY environment variable. -// - -int ParseCommandLineOptions(int argc, const char **argv) -{ - // - // Be sure log file is valid. - // - - if (logofs == NULL) - { - logofs = &cerr; - } - - if (setjmp(context) == 1) - { - #ifdef TEST - *logofs << "Loop: Out of the long jump while parsing " - << "the command line options.\n" - << logofs_flush; - #endif - - return -1; - } - - // - // Be sure we have a parameters repository - // - - if (control == NULL) - { - control = new Control(); - } - - if (parsedCommand == 1) - { - #ifdef TEST - *logofs << "Loop: Skipping a further parse of command line options.\n" - << logofs_flush; - #endif - - return 1; - } - - #ifdef TEST - *logofs << "Loop: Going to parse the command line options.\n" - << logofs_flush; - #endif - - parsedCommand = 1; - - // - // Print out arguments. - // - - #ifdef TEST - - *logofs << "Loop: Argc is " << argc << ".\n" << logofs_flush; - - for (int argi = 0; argi < argc; argi++) - { - *logofs << "Loop: Argv[" << argi << "] is " << argv[argi] - << ".\n" << logofs_flush; - } - - #endif - - // - // Shall use getopt here. - // - - for (int argi = 1; argi < argc; argi++) - { - const char *nextArg = argv[argi]; - - if (*nextArg == '-') - { - switch (*(nextArg + 1)) - { - case 'h': - { - PrintUsageInfo(nextArg, 0); - - return -1; - } - case 'C': - { - // - // Start proxy in CLIENT mode. - // - - if (WE_SET_PROXY_MODE == 0) - { - #ifdef TEST - *logofs << "Loop: Setting local proxy mode to proxy_client.\n" - << logofs_flush; - #endif - - control -> ProxyMode = proxy_client; - } - else if (control -> ProxyMode != proxy_client) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't redefine local proxy to " - << "client mode.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't redefine local proxy to " - << "client mode.\n"; - - return -1; - } - - break; - } - case 'S': - { - // - // Start proxy in SERVER mode. - // - - if (WE_SET_PROXY_MODE == 0) - { - #ifdef TEST - *logofs << "Loop: Setting local proxy mode to proxy_server.\n" - << logofs_flush; - #endif - - control -> ProxyMode = proxy_server; - } - else if (control -> ProxyMode != proxy_server) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't redefine local proxy to " - << "server mode.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't redefine local proxy to " - << "server mode.\n"; - - return -1; - } - - break; - } - case 'v': - { - PrintVersionInfo(); - - return -1; - } - default: - { - PrintUsageInfo(nextArg, 1); - - // - // Function GetArg() is not used anymore. - // Add a dummy call to avoid the warning. - // - - if (0) - { - GetArg(argi, argc, argv); - } - - return -1; - } - } - } - else - { - if (nextArg) - { - // - // Try to parse the option as a remote host:port - // specification as in 'localhost:8'. Such a - // parameter can be specified at the end of the - // command line at the connecting side. - // - - char cHost[DEFAULT_STRING_LENGTH] = { '\0' }; - long cPort = 0; - - if (ParseHostOption(nextArg, cHost, cPort) > 0) - { - // - // Assume port is at a proxied display offset. - // - - proxyPort = cPort; - - cPort += DEFAULT_NX_PROXY_PORT_OFFSET; - connectSocket.setSpec(cHost, cPort); - - } - else if (ParseEnvironmentOptions(nextArg, 1) < 0) - { - return -1; - } - } - } - } - - return 1; -} - -// -// Set the variable to the values of host and -// port where this proxy is going to hook to -// an existing proxy. -// - -int ParseBindOptions(char **host, int *port) -{ - if (*bindHost != '\0') - { - *host = bindHost; - *port = bindPort; - - return 1; - } - else - { - return 0; - } -} - -// -// Read options from file and merge with environment. -// - -int ParseFileOptions(const char *file) -{ - char *fileName; - - if (*file != '/' && *file != '.') - { - char *filePath = GetSessionPath(); - - if (filePath == NULL) - { - cerr << "Error" << ": Cannot determine directory for NX option file.\n"; - - HandleCleanup(); - } - - fileName = new char[strlen(filePath) + strlen("/") + - strlen(file) + 1]; - - strcpy(fileName, filePath); - - strcat(fileName, "/"); - strcat(fileName, file); - - delete [] filePath; - } - else - { - fileName = new char[strlen(file) + 1]; - - strcpy(fileName, file); - } - - #ifdef TEST - *logofs << "Loop: Going to read options from file '" - << fileName << "'.\n" << logofs_flush; - #endif - - FILE *filePtr = fopen(fileName, "r"); - - if (filePtr == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't open options file '" << fileName - << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't open options file '" << fileName - << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; - - delete [] fileName; - - return -1; - } - - char options[DEFAULT_DISPLAY_OPTIONS_LENGTH]; - - #ifdef VALGRIND - - memset(options, '\0', DEFAULT_DISPLAY_OPTIONS_LENGTH); - - #endif - - if (fgets(options, DEFAULT_DISPLAY_OPTIONS_LENGTH, filePtr) == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't read options from file '" << fileName - << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't read options from file '" << fileName - << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; - - fclose(filePtr); - - delete [] fileName; - - return -1; - } - - fclose(filePtr); - - // - // Purge the newline and the other non- - // printable characters in the string. - // - - char *next = options; - - while (*next != '\0') - { - if (isprint(*next) == 0) - { - *next = '\0'; - } - - next++; - } - - #ifdef TEST - *logofs << "Loop: Read options '" << options << "' from file '" - << fileName << "'.\n" << logofs_flush; - #endif - - if (ParseEnvironmentOptions(options, 1) < 0) - { - delete [] fileName; - - return -1; - } - - delete [] fileName; - - return 1; -} - -// -// Parse the option string passed from the -// remote proxy at startup. -// - -int ParseRemoteOptions(char *opts) -{ - #ifdef TEST - *logofs << "Loop: Going to parse the remote options " - << "string '" << opts << "'.\n" - << logofs_flush; - #endif - - char *name; - char *value; - - // - // The options string is intended to be a series - // of name/value tuples in the form name=value - // separated by the ',' character. - // - - int hasCookie = 0; - int hasLink = 0; - int hasPack = 0; - int hasCache = 0; - int hasImages = 0; - int hasDelta = 0; - int hasStream = 0; - int hasData = 0; - int hasType = 0; - - // - // Get rid of the terminating space. - // - - if (*(opts + strlen(opts) - 1) == ' ') - { - *(opts + strlen(opts) - 1) = '\0'; - } - - name = strtok(opts, "="); - - while (name) - { - value = strtok(NULL, ","); - - if (CheckArg("remote", name, value) < 0) - { - return -1; - } - - if (strcasecmp(name, "cookie") == 0) - { - if (WE_PROVIDE_CREDENTIALS) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring remote option 'cookie' " - << "with value '" << value << "' when initiating " - << "connection.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Ignoring remote option 'cookie' " - << "with value '" << value << "' when initiating " - << "connection.\n"; - } - else if (strncasecmp(authCookie, value, strlen(authCookie)) != 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Authentication cookie '" << value - << "' doesn't match '" << authCookie << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Authentication cookie '" << value - << "' doesn't match '" << authCookie << "'.\n"; - - return -1; - } - - hasCookie = 1; - } - else if (strcasecmp(name, "link") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - if (*linkSpeedName != '\0' && strcasecmp(linkSpeedName, value) != 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Overriding option 'link' " - << "with new value '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Overriding option 'link' " - << "with new value '" << value << "'.\n"; - } - - if (ParseLinkOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify remote 'link' " - << "option in string '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify remote 'link' " - << "option in string '" << value << "'.\n"; - - return -1; - } - } - - hasLink = 1; - } - else if (strcasecmp(name, "pack") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - if (*packMethodName != '\0' && strcasecmp(packMethodName, value) != 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Overriding option 'pack' " - << "with remote value '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Overriding option 'pack' " - << "with remote value '" << value << "'.\n"; - } - - if (ParsePackOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid pack option '" - << value << "' requested by remote.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid pack option '" - << value << "' requested by remote.\n"; - - return -1; - } - } - - hasPack = 1; - } - else if (strcasecmp(name, "cache") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - // - // Cache size is sent as a hint of how much memory - // the remote proxy is going to consume. A very low - // powered thin client could choose to refuse the - // connection. - // - - if (ParseCacheOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify remote 'cache' " - << "option in string '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify remote 'cache' " - << "option in string '" << value << "'.\n"; - - return -1; - } - } - - hasCache = 1; - } - else if (strcasecmp(name, "images") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - // - // Images cache size is sent as a hint. - // There is no obbligation for the local - // proxy to use the persistent cache. - // - - if (ParseImagesOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify remote 'images' " - << "option in string '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify remote 'images' " - << "option in string '" << value << "'.\n"; - - return -1; - } - } - - hasImages = 1; - } - else if (strcasecmp(name, "limit") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - if (*bitrateLimitName != '\0' && - strcasecmp(bitrateLimitName, value) != 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Overriding option 'limit' " - << "with new value '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Overriding option 'limit' " - << "with new value '" << value << "'.\n"; - } - - if (ParseBitrateOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify 'limit' " - << "option in string '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify 'limit' " - << "option in string '" << value << "'.\n"; - - return -1; - } - } - - } - else if (strcasecmp(name, "render") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - useRender = ValidateArg("remote", name, value); - } - - } - else if (strcasecmp(name, "taint") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - useTaint = ValidateArg("remote", name, value); - } - - } - else if (strcasecmp(name, "type") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - if (strcasecmp(value, "default") == 0) - { - *sessionType = '\0'; - } - else - { - strncpy(sessionType, value, DEFAULT_STRING_LENGTH - 1); - } - } - - hasType = 1; - } - else if (strcasecmp(name, "strict") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - useStrict = ValidateArg("remote", name, value); - } - - } - else if (strcasecmp(name, "shseg") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else if (ParseShmemOption(value) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't identify size of shared memory " - << "segment in string '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify size of shared memory " - << "segment in string '" << value << "'.\n"; - - return -1; - } - - } - else if (strcasecmp(name, "delta") == 0) - { - if (control -> ProxyMode == proxy_client) - { - PrintOptionIgnored("remote", name, value); - } - else - { - control -> RemoteDeltaCompression = ValidateArg("remote", name, value); - - // - // Follow for delta compression the - // same settings as the client proxy. - // - - control -> LocalDeltaCompression = control -> RemoteDeltaCompression; - } - - hasDelta = 1; - } - else if (strcasecmp(name, "stream") == 0) - { - // - // If remote side didn't choose its own - // stream compression level then assume - // local settings. - // - - if (strcasecmp(value, "default") == 0) - { - // - // This applies only at client side. - // - - control -> RemoteStreamCompression = - control -> LocalStreamCompression; - - control -> RemoteStreamCompressionLevel = - control -> LocalStreamCompressionLevel; - } - else - { - control -> RemoteStreamCompressionLevel = ValidateArg("remote", name, value); - - if (control -> RemoteStreamCompressionLevel > 0) - { - control -> RemoteStreamCompression = 1; - } - else - { - control -> RemoteStreamCompression = 0; - } - - if (control -> LocalStreamCompressionLevel < 0) - { - control -> LocalStreamCompressionLevel = ValidateArg("remote", name, value); - - if (control -> LocalStreamCompressionLevel > 0) - { - control -> LocalStreamCompression = 1; - } - else - { - control -> LocalStreamCompression = 0; - } - } - } - - hasStream = 1; - } - else if (strcasecmp(name, "data") == 0) - { - // - // Apply the same to data compression level. - // - - if (strcasecmp(value, "default") == 0) - { - control -> RemoteDataCompression = - control -> LocalDataCompression; - - control -> RemoteDataCompressionLevel = - control -> LocalDataCompressionLevel; - } - else - { - control -> RemoteDataCompressionLevel = ValidateArg("remote", name, value); - - if (control -> RemoteDataCompressionLevel > 0) - { - control -> RemoteDataCompression = 1; - } - else - { - control -> RemoteDataCompression = 0; - } - - if (control -> LocalDataCompressionLevel < 0) - { - control -> LocalDataCompressionLevel = ValidateArg("remote", name, value); - - if (control -> LocalDataCompressionLevel > 0) - { - control -> LocalDataCompression = 1; - } - else - { - control -> LocalDataCompression = 0; - } - } - } - - hasData = 1; - } - else if (strcasecmp(name, "flush") == 0) - { - // - // This option has no effect in recent - // versions. - // - - #ifdef DEBUG - *logofs << "Loop: Ignoring obsolete remote option '" - << name << "' with value '" << value - << "'.\n" << logofs_flush; - #endif - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring unknown remote option '" - << name << "' with value '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Ignoring unknown remote option '" - << name << "' with value '" << value << "'.\n"; - } - - name = strtok(NULL, "="); - - } // End of while (name) ... - - // - // If we are client side, we need remote 'stream' - // and 'data' options. If we are server, we need - // all the above plus 'link' and some others. - // - - char missing[DEFAULT_STRING_LENGTH]; - - *missing = '\0'; - - if (control -> ProxyMode == proxy_client) - { - if (hasStream == 0) - { - strcpy(missing, "stream"); - } - else if (hasData == 0) - { - strcpy(missing, "data"); - } - } - else - { - // - // Don't complain if the optional 'flush', - // 'render' and 'taint' options are not - // provided. - // - - if (hasLink == 0) - { - strcpy(missing, "link"); - } - else if (hasCache == 0) - { - strcpy(missing, "cache"); - } - else if (hasPack == 0) - { - strcpy(missing, "pack"); - } - else if (hasDelta == 0) - { - strcpy(missing, "delta"); - } - else if (hasStream == 0) - { - strcpy(missing, "stream"); - } - else if (hasData == 0) - { - strcpy(missing, "data"); - } - else if (hasType == 0) - { - strcpy(missing, "type"); - } - else if (hasImages == 0) - { - strcpy(missing, "images"); - } - } - - if (WE_PROVIDE_CREDENTIALS == 0) - { - // - // Can be that user doesn't have requested to - // check the authorization cookie provided by - // the connecting peer. - // - - if (hasCookie == 0 && *authCookie != '\0') - { - strcpy(missing, "cookie"); - } - } - - if (*missing != '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! The remote peer didn't specify the option '" - << missing << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": The remote peer didn't specify the option '" - << missing << "'.\n"; - - return -1; - } - - return 1; -} - -// -// Parse the cookie provided by the NX proxy -// connection forwarder. -// - -int ParseForwarderOptions(char *opts) -{ - #ifdef TEST - *logofs << "Loop: Going to parse the forwarder options " - << "string '" << opts << "'.\n" - << logofs_flush; - #endif - - char *name; - char *value; - - int hasCookie = 0; - - // - // Get rid of the terminating space. - // - - if (*(opts + strlen(opts) - 1) == ' ') - { - *(opts + strlen(opts) - 1) = '\0'; - } - - name = strtok(opts, "="); - - while (name) - { - value = strtok(NULL, ","); - - if (CheckArg("forwarder", name, value) < 0) - { - return -1; - } - - if (strcasecmp(name, "cookie") == 0) - { - if (strncasecmp(authCookie, value, strlen(authCookie)) != 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! The NX forwarder cookie '" << value - << "' doesn't match '" << authCookie << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": The NX forwarder cookie '" << value - << "' doesn't match '" << authCookie << "'.\n"; - - return -1; - } - - hasCookie = 1; - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring unknown forwarder option '" - << name << "' with value '" << value << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Ignoring unknown forwarder option '" - << name << "' with value '" << value << "'.\n"; - } - - name = strtok(NULL, "="); - - } // End of while (name) ... - - if (hasCookie == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! The NX forwarder didn't provide " - << "the authentication cookie.\n" << logofs_flush; - #endif - - cerr << "Error" << ": The NX forwarder didn't provide " - << "the authentication cookie.\n"; - - return -1; - } - - return 1; -} - -int SetCore() -{ - #ifdef COREDUMPS - - rlimit rlim; - - if (getrlimit(RLIMIT_CORE, &rlim)) - { - #ifdef TEST - *logofs << "Loop: Cannot read RLIMIT_CORE. Error is '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - return -1; - } - - if (rlim.rlim_cur < rlim.rlim_max) - { - rlim.rlim_cur = rlim.rlim_max; - - if (setrlimit(RLIMIT_CORE, &rlim)) - { - #ifdef TEST - *logofs << "Loop: Cannot set RLIMIT_CORE. Error is '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - return -2; - } - } - - #ifdef TEST - *logofs << "Loop: RLIMIT_CORE is "<< rlim.rlim_max - << ".\n" << logofs_flush; - #endif - - #endif // #ifdef COREDUMPS - - return 1; -} - -char *GetLastCache(char *listBuffer, const char *searchPath) -{ - if (listBuffer == NULL || searchPath == NULL || - strncmp(listBuffer, "cachelist=", strlen("cachelist=")) != 0) - { - #ifdef TEST - *logofs << "Loop: Invalid parameters '" << listBuffer << "' and '" - << (searchPath != NULL ? searchPath : "") - << "'. Can't select any cache.\n" << logofs_flush; - #endif - - return NULL; - } - - char *selectedName = new char[MD5_LENGTH * 2 + 3]; - - *selectedName = '\0'; - - const char *localPrefix; - const char *remotePrefix; - - if (control -> ProxyMode == proxy_client) - { - localPrefix = "C-"; - remotePrefix = "S-"; - } - else - { - localPrefix = "S-"; - remotePrefix = "C-"; - } - - // - // Get rid of prefix. - // - - listBuffer += strlen("cachelist="); - - char *fileName; - - fileName = strtok(listBuffer, ","); - - // - // It is "/path/to/file" + "/" + "C-" + 32 + "\0". - // - - char fullPath[strlen(searchPath) + MD5_LENGTH * 2 + 4]; - - time_t selectedTime = 0; - - struct stat fileStat; - - while (fileName) - { - if (strncmp(fileName, "none", strlen("none")) == 0) - { - #ifdef TEST - *logofs << "Loop: No cache files seem to be available.\n" - << logofs_flush; - #endif - - delete [] selectedName; - - return NULL; - } - else if (strlen(fileName) != MD5_LENGTH * 2 + 2 || - strncmp(fileName, remotePrefix, 2) != 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Bad cache file name '" - << fileName << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Bad cache file name '" - << fileName << "'.\n"; - - delete [] selectedName; - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "Loop: Parsing remote cache name '" - << fileName << "'.\n" << logofs_flush; - #endif - - // - // Prefix, received as "S-", becomes - // "C-" and viceversa. - // - - *fileName = *localPrefix; - - strcpy(fullPath, searchPath); - strcat(fullPath, "/"); - strcat(fullPath, fileName); - - if (stat(fullPath, &fileStat) == 0) - { - #ifdef TEST - *logofs << "Loop: Found a matching cache '" - << fullPath << "'.\n" << logofs_flush; - #endif - - if (fileStat.st_mtime >= selectedTime) - { - strcpy(selectedName, fileName); - - selectedTime = fileStat.st_mtime; - } - } - #ifdef TEST - else - { - *logofs << "Loop: Can't get stats of file '" - << fullPath << "'.\n" << logofs_flush; - } - #endif - - fileName = strtok(NULL, ","); - } - - if (*selectedName != '\0') - { - return selectedName; - } - else - { - delete [] selectedName; - - return NULL; - } -} - -char *GetTempPath() -{ - if (*tempDir == '\0') - { - // - // Check the NX_TEMP environment, first, - // then the TEMP variable. - // - - const char *tempEnv = getenv("NX_TEMP"); - - if (tempEnv == NULL || *tempEnv == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No environment for NX_TEMP.\n" - << logofs_flush; - #endif - - tempEnv = getenv("TEMP"); - - if (tempEnv == NULL || *tempEnv == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No environment for TEMP.\n" - << logofs_flush; - #endif - - tempEnv = "/tmp"; - } - } - - if (strlen(tempEnv) > DEFAULT_STRING_LENGTH - 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value for the NX " - << "temporary directory '" << tempEnv - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value for the NX " - << "temporary directory '" << tempEnv - << "'.\n"; - - HandleCleanup(); - } - - strcpy(tempDir, tempEnv); - - #ifdef TEST - *logofs << "Loop: Assuming temporary NX directory '" - << tempDir << "'.\n" << logofs_flush; - #endif - } - - char *tempPath = new char[strlen(tempDir) + 1]; - - if (tempPath == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't allocate memory " - << "for the temp path.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the temp path.\n"; - - HandleCleanup(); - } - - strcpy(tempPath, tempDir); - - return tempPath; -} - -char *GetClientPath() -{ - if (*clientDir == '\0') - { - // - // Check the NX_CLIENT environment. - // - - const char *clientEnv = getenv("NX_CLIENT"); - - if (clientEnv == NULL || *clientEnv == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No environment for NX_CLIENT.\n" - << logofs_flush; - #endif - - // - // Try to guess the location of the client. - // - - clientEnv = "/usr/NX/bin/nxclient"; - - #ifdef __APPLE__ - - clientEnv = "/Applications/NX Client for OSX.app/Contents/MacOS/nxclient"; - - #endif - - #ifdef __CYGWIN32__ - - clientEnv = "C:\\Program Files\\NX Client for Windows\\nxclient"; - - #endif - } - - if (strlen(clientEnv) > DEFAULT_STRING_LENGTH - 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value for the NX " - << "client directory '" << clientEnv - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value for the NX " - << "client directory '" << clientEnv - << "'.\n"; - - HandleCleanup(); - } - - strcpy(clientDir, clientEnv); - - #ifdef TEST - *logofs << "Loop: Assuming NX client location '" - << clientDir << "'.\n" << logofs_flush; - #endif - } - - char *clientPath = new char[strlen(clientDir) + 1]; - - if (clientPath == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't allocate memory " - << "for the client path.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the client path.\n"; - - HandleCleanup(); - } - - strcpy(clientPath, clientDir); - - return clientPath; -} - -char *GetSystemPath() -{ - if (*systemDir == '\0') - { - // - // Check the NX_SYSTEM environment. - // - - const char *systemEnv = getenv("NX_SYSTEM"); - - if (systemEnv == NULL || *systemEnv == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No environment for NX_SYSTEM.\n" - << logofs_flush; - #endif - - systemEnv = "/usr/NX"; - } - - if (strlen(systemEnv) > DEFAULT_STRING_LENGTH - 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value for the NX " - << "system directory '" << systemEnv - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value for the NX " - << "system directory '" << systemEnv - << "'.\n"; - - HandleCleanup(); - } - - strcpy(systemDir, systemEnv); - - #ifdef TEST - *logofs << "Loop: Assuming system NX directory '" - << systemDir << "'.\n" << logofs_flush; - #endif - } - - char *systemPath = new char[strlen(systemDir) + 1]; - - if (systemPath == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't allocate memory " - << "for the system path.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the system path.\n"; - - HandleCleanup(); - } - - strcpy(systemPath, systemDir); - - return systemPath; -} - -char *GetHomePath() -{ - if (*homeDir == '\0') - { - // - // Check the NX_HOME environment. - // - - const char *homeEnv = getenv("NX_HOME"); - - if (homeEnv == NULL || *homeEnv == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No environment for NX_HOME.\n" - << logofs_flush; - #endif - - homeEnv = getenv("HOME"); - - if (homeEnv == NULL || *homeEnv == '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! No environment for HOME.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No environment for HOME.\n"; - - HandleCleanup(); - } - } - - if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value for the NX " - << "home directory '" << homeEnv - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value for the NX " - << "home directory '" << homeEnv - << "'.\n"; - - HandleCleanup(); - } - - strcpy(homeDir, homeEnv); - - #ifdef TEST - *logofs << "Loop: Assuming NX user's home directory '" - << homeDir << "'.\n" << logofs_flush; - #endif - } - - char *homePath = new char[strlen(homeDir) + 1]; - - if (homePath == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't allocate memory " - << "for the home path.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the home path.\n"; - - HandleCleanup(); - } - - strcpy(homePath, homeDir); - - return homePath; -} - -char *GetRootPath() -{ - if (*rootDir == '\0') - { - // - // Check the NX_ROOT environment. - // - - const char *rootEnv = getenv("NX_ROOT"); - - if (rootEnv == NULL || *rootEnv == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No environment for NX_ROOT.\n" - << logofs_flush; - #endif - - // - // We will determine the root NX directory - // based on the NX_HOME or HOME directory - // settings. - // - - const char *homeEnv = GetHomePath(); - - if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - - strlen("/.nx") - 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value for the NX " - << "home directory '" << homeEnv - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value for the NX " - << "home directory '" << homeEnv - << "'.\n"; - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "Loop: Assuming NX root directory in " - << "the user's home '" << homeEnv - << "'.\n" << logofs_flush; - #endif - - strcpy(rootDir, homeEnv); - strcat(rootDir, "/.nx"); - - delete [] homeEnv; - - // - // Create the NX root directory. - // - - struct stat dirStat; - - if ((stat(rootDir, &dirStat) == -1) && (EGET() == ENOENT)) - { - if (mkdir(rootDir, 0700) < 0 && (EGET() != EEXIST)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't create directory '" - << rootDir << ". Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't create directory '" - << rootDir << ". Error is " << EGET() << " '" - << ESTR() << "'.\n"; - - HandleCleanup(); - } - } - } - else - { - if (strlen(rootEnv) > DEFAULT_STRING_LENGTH - 1) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value for the NX " - << "root directory '" << rootEnv - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value for the NX " - << "root directory '" << rootEnv - << "'.\n"; - - HandleCleanup(); - } - - strcpy(rootDir, rootEnv); - } - - #ifdef TEST - *logofs << "Loop: Assuming NX root directory '" - << rootDir << "'.\n" << logofs_flush; - #endif - } - - char *rootPath = new char[strlen(rootDir) + 1]; - - if (rootPath == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't allocate memory " - << "for the root path.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the root path.\n"; - - HandleCleanup(); - } - - strcpy(rootPath, rootDir); - - return rootPath; -} - -char *GetCachePath() -{ - char *rootPath = GetRootPath(); - - char *cachePath; - - if (*sessionType != '\0') - { - cachePath = new char[strlen(rootPath) + strlen("/cache-") + - strlen(sessionType) + 1]; - } - else - { - cachePath = new char[strlen(rootPath) + strlen("/cache") + 1]; - } - - strcpy(cachePath, rootPath); - - if (*sessionType != '\0') - { - strcat(cachePath, "/cache-"); - - strcat(cachePath, sessionType); - } - else - { - strcat(cachePath, "/cache"); - } - - // - // Create the cache directory if needed. - // - - struct stat dirStat; - - if ((stat(cachePath, &dirStat) == -1) && (EGET() == ENOENT)) - { - if (mkdir(cachePath, 0700) < 0 && (EGET() != EEXIST)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't create directory '" << cachePath - << ". Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create directory '" << cachePath - << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; - - delete [] rootPath; - delete [] cachePath; - - return NULL; - } - } - - delete [] rootPath; - - return cachePath; -} - -char *GetImagesPath() -{ - char *rootPath = GetRootPath(); - - char *imagesPath = new char[strlen(rootPath) + strlen("/images") + 1]; - - strcpy(imagesPath, rootPath); - - strcat(imagesPath, "/images"); - - // - // Create the cache directory if needed. - // - - struct stat dirStat; - - if ((stat(imagesPath, &dirStat) == -1) && (EGET() == ENOENT)) - { - if (mkdir(imagesPath, 0700) < 0 && (EGET() != EEXIST)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't create directory '" << imagesPath - << ". Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create directory '" << imagesPath - << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; - - delete [] rootPath; - delete [] imagesPath; - - return NULL; - } - } - - // - // Create 16 directories in the path to - // hold the images whose name begins with - // the corresponding hexadecimal digit. - // - - char *digitPath = new char[strlen(imagesPath) + 5]; - - strcpy(digitPath, imagesPath); - - // - // Image paths have format "[path][/I-c][\0]", - // where c is the first digit of the checksum. - // - - for (char digit = 0; digit < 16; digit++) - { - sprintf(digitPath + strlen(imagesPath), "/I-%01X", digit); - - if ((stat(digitPath, &dirStat) == -1) && (EGET() == ENOENT)) - { - if (mkdir(digitPath, 0700) < 0 && (EGET() != EEXIST)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't create directory '" << digitPath - << ". Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create directory '" << digitPath - << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; - - delete [] rootPath; - delete [] imagesPath; - delete [] digitPath; - - return NULL; - } - } - } - - delete [] rootPath; - delete [] digitPath; - - return imagesPath; -} - -char *GetSessionPath() -{ - if (*sessionDir == '\0') - { - char *rootPath = GetRootPath(); - - strcpy(sessionDir, rootPath); - - if (control -> ProxyMode == proxy_client) - { - strcat(sessionDir, "/C-"); - } - else - { - strcat(sessionDir, "/S-"); - } - - if (*sessionId == '\0') - { - char port[DEFAULT_STRING_LENGTH]; - - sprintf(port, "%d", proxyPort); - - strcpy(sessionId, port); - } - - strcat(sessionDir, sessionId); - - struct stat dirStat; - - if ((stat(sessionDir, &dirStat) == -1) && (EGET() == ENOENT)) - { - if (mkdir(sessionDir, 0700) < 0 && (EGET() != EEXIST)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't create directory '" << sessionDir - << ". Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create directory '" << sessionDir - << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; - - delete [] rootPath; - - return NULL; - } - } - - #ifdef TEST - *logofs << "Loop: Root of NX session is '" << sessionDir - << "'.\n" << logofs_flush; - #endif - - delete [] rootPath; - } - - char *sessionPath = new char[strlen(sessionDir) + 1]; - - strcpy(sessionPath, sessionDir); - - return sessionPath; -} - -// -// Identify requested link characteristics -// and set control parameters accordingly. -// - -int ParseLinkOption(const char *opt) -{ - // - // Normalize the user input. - // - - if (strcasecmp(opt, "modem") == 0 || - strcasecmp(opt, "33k") == 0 || - strcasecmp(opt, "56k") == 0) - { - strcpy(linkSpeedName, "MODEM"); - } - else if (strcasecmp(opt, "isdn") == 0 || - strcasecmp(opt, "64k") == 0 || - strcasecmp(opt, "128k") == 0) - { - strcpy(linkSpeedName, "ISDN"); - } - else if (strcasecmp(opt, "adsl") == 0 || - strcasecmp(opt, "256k") == 0 || - strcasecmp(opt, "640k") == 0) - { - strcpy(linkSpeedName, "ADSL"); - } - else if (strcasecmp(opt, "wan") == 0 || - strcasecmp(opt, "1m") == 0 || - strcasecmp(opt, "2m") == 0 || - strcasecmp(opt, "34m") == 0) - { - strcpy(linkSpeedName, "WAN"); - } - else if (strcasecmp(opt, "lan") == 0 || - strcasecmp(opt, "10m") == 0 || - strcasecmp(opt, "100m") == 0 || - strcasecmp(opt, "local") == 0) - { - strcpy(linkSpeedName, "LAN"); - } - - if (strcasecmp(linkSpeedName, "modem") != 0 && - strcasecmp(linkSpeedName, "isdn") != 0 && - strcasecmp(linkSpeedName, "adsl") != 0 && - strcasecmp(linkSpeedName, "wan") != 0 && - strcasecmp(linkSpeedName, "lan") != 0) - { - return -1; - } - - return 1; -} - -int ParsePackOption(const char *opt) -{ - #ifdef DEBUG - *logofs << "Loop: Pack method is " << packMethod - << " quality is " << packQuality << ".\n" - << logofs_flush; - #endif - - #ifdef DEBUG - *logofs << "Loop: Parsing pack method '" << opt - << "'.\n" << logofs_flush; - #endif - - if (strcasecmp(opt, "0") == 0 || - strcasecmp(opt, "none") == 0 || - strcasecmp(opt, "nopack") == 0 || - strcasecmp(opt, "no-pack") == 0) - { - packMethod = PACK_NONE; - } - else if (strcasecmp(opt, "8") == 0) - { - packMethod = PACK_MASKED_8_COLORS; - } - else if (strcasecmp(opt, "64") == 0) - { - packMethod = PACK_MASKED_64_COLORS; - } - else if (strcasecmp(opt, "256") == 0) - { - packMethod = PACK_MASKED_256_COLORS; - } - else if (strcasecmp(opt, "512") == 0) - { - packMethod = PACK_MASKED_512_COLORS; - } - else if (strcasecmp(opt, "4k") == 0) - { - packMethod = PACK_MASKED_4K_COLORS; - } - else if (strcasecmp(opt, "32k") == 0) - { - packMethod = PACK_MASKED_32K_COLORS; - } - else if (strcasecmp(opt, "64k") == 0) - { - packMethod = PACK_MASKED_64K_COLORS; - } - else if (strcasecmp(opt, "256k") == 0) - { - packMethod = PACK_MASKED_256K_COLORS; - } - else if (strcasecmp(opt, "2m") == 0) - { - packMethod = PACK_MASKED_2M_COLORS; - } - else if (strcasecmp(opt, "16m") == 0) - { - packMethod = PACK_MASKED_16M_COLORS; - } - else if (strncasecmp(opt, "8-jpeg", strlen("8-jpeg")) == 0) - { - packMethod = PACK_JPEG_8_COLORS; - } - else if (strncasecmp(opt, "64-jpeg", strlen("64-jpeg")) == 0) - { - packMethod = PACK_JPEG_64_COLORS; - } - else if (strncasecmp(opt, "256-jpeg", strlen("256-jpeg")) == 0) - { - packMethod = PACK_JPEG_256_COLORS; - } - else if (strncasecmp(opt, "512-jpeg", strlen("512-jpeg")) == 0) - { - packMethod = PACK_JPEG_512_COLORS; - } - else if (strncasecmp(opt, "4k-jpeg", strlen("4k-jpeg")) == 0) - { - packMethod = PACK_JPEG_4K_COLORS; - } - else if (strncasecmp(opt, "32k-jpeg", strlen("32k-jpeg")) == 0) - { - packMethod = PACK_JPEG_32K_COLORS; - } - else if (strncasecmp(opt, "64k-jpeg", strlen("64k-jpeg")) == 0) - { - packMethod = PACK_JPEG_64K_COLORS; - } - else if (strncasecmp(opt, "256k-jpeg", strlen("256k-jpeg")) == 0) - { - packMethod = PACK_JPEG_256K_COLORS; - } - else if (strncasecmp(opt, "2m-jpeg", strlen("2m-jpeg")) == 0) - { - packMethod = PACK_JPEG_2M_COLORS; - } - else if (strncasecmp(opt, "16m-jpeg", strlen("16m-jpeg")) == 0) - { - packMethod = PACK_JPEG_16M_COLORS; - } - else if (strncasecmp(opt, "8-png", strlen("8-png")) == 0) - { - packMethod = PACK_PNG_8_COLORS; - } - else if (strncasecmp(opt, "64-png", strlen("64-png")) == 0) - { - packMethod = PACK_PNG_64_COLORS; - } - else if (strncasecmp(opt, "256-png", strlen("256-png")) == 0) - { - packMethod = PACK_PNG_256_COLORS; - } - else if (strncasecmp(opt, "512-png", strlen("512-png")) == 0) - { - packMethod = PACK_PNG_512_COLORS; - } - else if (strncasecmp(opt, "4k-png", strlen("4k-png")) == 0) - { - packMethod = PACK_PNG_4K_COLORS; - } - else if (strncasecmp(opt, "32k-png", strlen("32k-png")) == 0) - { - packMethod = PACK_PNG_32K_COLORS; - } - else if (strncasecmp(opt, "64k-png", strlen("64k-png")) == 0) - { - packMethod = PACK_PNG_64K_COLORS; - } - else if (strncasecmp(opt, "256k-png", strlen("256k-png")) == 0) - { - packMethod = PACK_PNG_256K_COLORS; - } - else if (strncasecmp(opt, "2m-png", strlen("2m-png")) == 0) - { - packMethod = PACK_PNG_2M_COLORS; - } - else if (strncasecmp(opt, "16m-png", strlen("16m-png")) == 0) - { - packMethod = PACK_PNG_16M_COLORS; - } - else if (strncasecmp(opt, "16m-rgb", strlen("16m-rgb")) == 0 || - strncasecmp(opt, "rgb", strlen("rgb")) == 0) - { - packMethod = PACK_RGB_16M_COLORS; - } - else if (strncasecmp(opt, "16m-rle", strlen("16m-rle")) == 0 || - strncasecmp(opt, "rle", strlen("rle")) == 0) - { - packMethod = PACK_RLE_16M_COLORS; - } - else if (strncasecmp(opt, "16m-bitmap", strlen("16m-bitmap")) == 0 || - strncasecmp(opt, "bitmap", strlen("bitmap")) == 0) - { - packMethod = PACK_BITMAP_16M_COLORS; - } - else if (strncasecmp(opt, "lossy", strlen("lossy")) == 0) - { - packMethod = PACK_LOSSY; - } - else if (strncasecmp(opt, "lossless", strlen("lossless")) == 0) - { - packMethod = PACK_LOSSLESS; - } - else if (strncasecmp(opt, "adaptive", strlen("adaptive")) == 0) - { - packMethod = PACK_ADAPTIVE; - } - else - { - return -1; - } - - if (packMethod == PACK_NONE) - { - strcpy(packMethodName, "none"); - } - else - { - strcpy(packMethodName, opt); - } - - if (packMethod == PACK_RGB_16M_COLORS || - packMethod == PACK_RLE_16M_COLORS || - packMethod == PACK_BITMAP_16M_COLORS || - (packMethod >= PACK_JPEG_8_COLORS && - packMethod <= PACK_JPEG_16M_COLORS) || - (packMethod >= PACK_PNG_8_COLORS && - packMethod <= PACK_PNG_16M_COLORS) || - packMethod == PACK_LOSSY || - packMethod == PACK_LOSSLESS || - packMethod == PACK_ADAPTIVE) - { - const char *dash = strrchr(opt, '-'); - - if (dash != NULL && strlen(dash) == 2 && - *(dash + 1) >= '0' && *(dash + 1) <= '9') - { - packQuality = atoi(dash + 1); - - #ifdef DEBUG - *logofs << "Loop: Using pack quality '" - << packQuality << "'.\n" << logofs_flush; - #endif - } - } - else - { - packQuality = 0; - } - - return 1; -} - -int ParsePackMethod(const int method, const int quality) -{ - switch (method) - { - case PACK_NONE: - { - strcpy(packMethodName, "none"); - - break; - } - case PACK_MASKED_8_COLORS: - { - strcpy(packMethodName, "8"); - - break; - } - case PACK_MASKED_64_COLORS: - { - strcpy(packMethodName, "64"); - - break; - } - case PACK_MASKED_256_COLORS: - { - strcpy(packMethodName, "256"); - - break; - } - case PACK_MASKED_512_COLORS: - { - strcpy(packMethodName, "512"); - - break; - } - case PACK_MASKED_4K_COLORS: - { - strcpy(packMethodName, "4k"); - - break; - } - case PACK_MASKED_32K_COLORS: - { - strcpy(packMethodName, "32k"); - - break; - } - case PACK_MASKED_64K_COLORS: - { - strcpy(packMethodName, "64k"); - - break; - } - case PACK_MASKED_256K_COLORS: - { - strcpy(packMethodName, "256k"); - - break; - } - case PACK_MASKED_2M_COLORS: - { - strcpy(packMethodName, "2m"); - - break; - } - case PACK_MASKED_16M_COLORS: - { - strcpy(packMethodName, "16m"); - - break; - } - case PACK_JPEG_8_COLORS: - { - strcpy(packMethodName, "8-jpeg"); - - break; - } - case PACK_JPEG_64_COLORS: - { - strcpy(packMethodName, "64-jpeg"); - - break; - } - case PACK_JPEG_256_COLORS: - { - strcpy(packMethodName, "256-jpeg"); - - break; - } - case PACK_JPEG_512_COLORS: - { - strcpy(packMethodName, "512-jpeg"); - - break; - } - case PACK_JPEG_4K_COLORS: - { - strcpy(packMethodName, "4k-jpeg"); - - break; - } - case PACK_JPEG_32K_COLORS: - { - strcpy(packMethodName, "32k-jpeg"); - - break; - } - case PACK_JPEG_64K_COLORS: - { - strcpy(packMethodName, "64k-jpeg"); - - break; - } - case PACK_JPEG_256K_COLORS: - { - strcpy(packMethodName, "256k-jpeg"); - - break; - } - case PACK_JPEG_2M_COLORS: - { - strcpy(packMethodName, "2m-jpeg"); - - break; - } - case PACK_JPEG_16M_COLORS: - { - strcpy(packMethodName, "16m-jpeg"); - - break; - } - case PACK_PNG_8_COLORS: - { - strcpy(packMethodName, "8-png"); - - break; - } - case PACK_PNG_64_COLORS: - { - strcpy(packMethodName, "64-png"); - - break; - } - case PACK_PNG_256_COLORS: - { - strcpy(packMethodName, "256-png"); - - break; - } - case PACK_PNG_512_COLORS: - { - strcpy(packMethodName, "512-png"); - - break; - } - case PACK_PNG_4K_COLORS: - { - strcpy(packMethodName, "4k-png"); - - break; - } - case PACK_PNG_32K_COLORS: - { - strcpy(packMethodName, "32k-png"); - - break; - } - case PACK_PNG_64K_COLORS: - { - strcpy(packMethodName, "64k-png"); - - break; - } - case PACK_PNG_256K_COLORS: - { - strcpy(packMethodName, "256k-png"); - - break; - } - case PACK_PNG_2M_COLORS: - { - strcpy(packMethodName, "2m-png"); - - break; - } - case PACK_PNG_16M_COLORS: - { - strcpy(packMethodName, "16m-png"); - - break; - } - case PACK_RGB_16M_COLORS: - { - strcpy(packMethodName, "16m-rgb"); - - break; - } - case PACK_RLE_16M_COLORS: - { - strcpy(packMethodName, "16m-rle"); - - break; - } - case PACK_BITMAP_16M_COLORS: - { - strcpy(packMethodName, "16m-bitmap"); - - break; - } - case PACK_LOSSY: - { - strcpy(packMethodName, "lossy"); - - break; - } - case PACK_LOSSLESS: - { - strcpy(packMethodName, "lossless"); - - break; - } - case PACK_ADAPTIVE: - { - strcpy(packMethodName, "adaptive"); - - break; - } - default: - { - return -1; - } - } - - if (quality < 0 || quality > 9) - { - return -1; - } - - if (packMethod == PACK_RGB_16M_COLORS || - packMethod == PACK_RLE_16M_COLORS || - packMethod == PACK_BITMAP_16M_COLORS || - (packMethod >= PACK_JPEG_8_COLORS && - packMethod <= PACK_JPEG_16M_COLORS) || - (packMethod >= PACK_PNG_8_COLORS && - packMethod <= PACK_PNG_16M_COLORS) || - packMethod == PACK_LOSSY || - packMethod == PACK_LOSSLESS || - packMethod == PACK_ADAPTIVE) - { - sprintf(packMethodName + strlen(packMethodName), - "-%d", quality); - } - - packMethod = method; - packQuality = quality; - - control -> PackMethod = packMethod; - control -> PackQuality = packQuality; - - return 1; -} - -int SetDirectories() -{ - // - // Determine the location of the user's NX - // directory and the other relevant paths. - // The functions below will check the pa- - // rameters passed to the program and will - // query the environment, if needed. - // - - control -> HomePath = GetHomePath(); - control -> RootPath = GetRootPath(); - control -> SystemPath = GetSystemPath(); - control -> TempPath = GetTempPath(); - control -> ClientPath = GetClientPath(); - - return 1; -} - -int SetLogs() -{ - // - // So far we used stderr (or stdout under - // WIN32). Now use the files selected by - // the user. - // - - if (*statsFileName == '\0') - { - strcpy(statsFileName, "stats"); - - #ifdef TEST - *logofs << "Loop: Assuming default statistics file '" - << statsFileName << "'.\n" << logofs_flush; - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Name selected for statistics is '" - << statsFileName << "'.\n" << logofs_flush; - } - #endif - - if (OpenLogFile(statsFileName, statofs) < 0) - { - HandleCleanup(); - } - - #ifndef MIXED - - if (*errorsFileName == '\0') - { - strcpy(errorsFileName, "errors"); - - #ifdef TEST - *logofs << "Loop: Assuming default log file name '" - << errorsFileName << "'.\n" << logofs_flush; - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Name selected for log file is '" - << errorsFileName << "'.\n" << logofs_flush; - } - #endif - - // - // Share the bebug output with the nxssh binder - // process. The file must be made writable by - // everybody because the nxssh process is run by - // nxserver as the nx user. - // - - #ifdef BINDER - - strcpy(errorsFileName, "/tmp/errors"); - - ostream *tmpfs = new ofstream(errorsFileName, ios::out); - - delete tmpfs; - - chmod(errorsFileName, S_IRUSR | S_IWUSR | S_IRGRP | - S_IWGRP | S_IROTH | S_IWOTH); - - #endif - - if (OpenLogFile(errorsFileName, logofs) < 0) - { - HandleCleanup(); - } - - // - // By default the session log is the standard error - // of the process. It is anyway required to set the - // option when running inside SSH, otherwise the - // output will go to the same file as the SSH log, - // depending where the NX client has redirected the - // output. - // - - if (*sessionFileName != '\0') - { - #ifdef TEST - *logofs << "Loop: Name selected for session file is '" - << sessionFileName << "'.\n" << logofs_flush; - #endif - - if (errofs != NULL) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Unexpected value for stream errofs.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Unexpected value for stream errofs.\n"; - } - - if (errsbuf != NULL) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Unexpected value for buffer errsbuf.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Unexpected value for buffer errsbuf.\n"; - } - - errofs = NULL; - errsbuf = NULL; - - if (OpenLogFile(sessionFileName, errofs) < 0) - { - HandleCleanup(); - } - - // - // Redirect the standard error to the file. - // - - errsbuf = cerr.rdbuf(errofs -> rdbuf()); - } - - #endif - - return 1; -} - -int SetPorts() -{ - // - // Depending on the proxy side, we need to determine on which - // port to listen for the given protocol or to which port we - // will have to forward the connection. Three possibilities - // are given for each supported protocol: - // - // Port <= 0: Disable port forwarding. - // Port == 1: Use the default port. - // Port > 1: Use the specified port. - // - // At the connectiong side the user should always explicitly - // set the ports where the connections will be forwarded. This - // is both for security reasons and because, when running both - // proxies on the same host, there is a concrete possibility - // that, by using the default ports, the connection will be - // forwarded to the same port where the peer proxy is listen- - // ing, causing a loop. - // - - useCupsSocket = 0; - if (cupsPort.enabled()) { - if (control -> ProxyMode == proxy_client) { - cupsPort.setDefaultTCPPort(DEFAULT_NX_CUPS_PORT_OFFSET + proxyPort); - useCupsSocket = 1; - } - else - cupsPort.setDefaultTCPPort(631); - } - -#ifdef TEST - *logofs << "Loop: cups port: " << cupsPort << "\n" - << logofs_flush; -#endif - - useAuxSocket = 0; - if (auxPort.enabled()) { - if (control -> ProxyMode == proxy_client) { - auxPort.setDefaultTCPPort(DEFAULT_NX_AUX_PORT_OFFSET + proxyPort); - useAuxSocket = 1; - } - else { - auxPort.setDefaultTCPPort(1); - - if (auxPort.getTCPPort() != 1) { - -#ifdef WARNING - *logofs << "Loop: WARNING! Overriding auxiliary X11 " - << "port with new value '" << 1 << "'.\n" - << logofs_flush; -#endif - - cerr << "Warning" << ": Overriding auxiliary X11 " - << "port with new value '" << 1 << "'.\n"; - - auxPort.setSpec("1"); - } - } - } - -#ifdef TEST - *logofs << "Loop: aux port: " << auxPort << "\n" - << logofs_flush; -#endif - - useSmbSocket = 0; - if (smbPort.enabled()) { - if (control -> ProxyMode == proxy_client) { - auxPort.setDefaultTCPPort(DEFAULT_NX_SMB_PORT_OFFSET + proxyPort); - useAuxSocket = 1; - } - else - auxPort.setDefaultTCPPort(139); - } - - -#ifdef TEST - *logofs << "Loop: smb port: " << smbPort << "\n" - << logofs_flush; -#endif - - useMediaSocket = 0; - if (mediaPort.enabled()) { - if (control -> ProxyMode == proxy_client) { - mediaPort.setDefaultTCPPort(DEFAULT_NX_MEDIA_PORT_OFFSET + proxyPort); - useMediaSocket = 1; - } - else if (mediaPort.getTCPPort() == 1) { -#ifdef PANIC - *logofs << "Loop: PANIC! No port specified for multimedia connections.\n" - << logofs_flush; -#endif - - cerr << "Error" << ": No port specified for multimedia connections.\n"; - - HandleCleanup(); - } - } - -#ifdef TEST - *logofs << "Loop: Using multimedia port '" << mediaPort - << "'.\n" << logofs_flush; -#endif - - useHttpSocket = 0; - if (httpPort.enabled()) { - if (control -> ProxyMode == proxy_client) { - httpPort.setDefaultTCPPort(DEFAULT_NX_HTTP_PORT_OFFSET + proxyPort); - useHttpSocket = 1; - } - else - httpPort.setDefaultTCPPort(80); - } - -#ifdef TEST - *logofs << "Loop: Using HTTP port '" << httpPort - << "'.\n" << logofs_flush; -#endif - - if (ParseFontPath(fontPort) <= 0) - { - #ifdef TEST - *logofs << "Loop: Disabling font server connections.\n" - << logofs_flush; - #endif - - *fontPort = '\0'; - - useFontSocket = 0; - } - else - { - // - // We don't know yet if the remote proxy supports - // the font server connections. If needed, we will - // disable the font server connections at later - // time. - // - - if (control -> ProxyMode == proxy_server) - { - useFontSocket = 1; - } - else - { - useFontSocket = 0; - } - - #ifdef TEST - *logofs << "Loop: Using font server port '" << fontPort - << "'.\n" << logofs_flush; - #endif - } - - useSlaveSocket = 0; - if (slavePort.enabled()) { - useSlaveSocket = 1; - if (control -> ProxyMode == proxy_client) - slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET + proxyPort); - else - slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET + proxyPort); - } - -#ifdef TEST - *logofs << "Loop: Using slave port '" << slavePort - << "'.\n" << logofs_flush; -#endif - - return 1; -} - -int SetDescriptors() -{ - unsigned int limit = 0; - - #ifdef RLIMIT_NOFILE - - rlimit limits; - - if (getrlimit(RLIMIT_NOFILE, &limits) == 0) - { - if (limits.rlim_max == RLIM_INFINITY) - { - limit = 0; - } - else - { - limit = (unsigned int) limits.rlim_max; - } - } - - #endif - - #ifdef _SC_OPEN_MAX - - if (limit == 0) - { - limit = sysconf(_SC_OPEN_MAX); - } - - #endif - - #ifdef FD_SETSIZE - - if (limit > FD_SETSIZE) - { - limit = FD_SETSIZE; - } - - #endif - - #ifdef RLIMIT_NOFILE - - if (limits.rlim_cur < limit) - { - limits.rlim_cur = limit; - - setrlimit(RLIMIT_NOFILE, &limits); - } - - #endif - - if (limit == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Cannot determine number of available " - << "file descriptors.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot determine number of available " - << "file descriptors.\n"; - - return -1; - } - - return 1; -} - -// -// Find the directory containing the caches -// matching the session type. -// - -int SetCaches() -{ - if ((control -> PersistentCachePath = GetCachePath()) == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error getting or creating the cache path.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error getting or creating the cache path.\n"; - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "Loop: Path of cache files is '" << control -> PersistentCachePath - << "'.\n" << logofs_flush; - #endif - - return 1; -} - -// -// Initialize all configuration parameters. -// - -int SetParameters() -{ - // - // Find out the type of session. - // - - SetSession(); - - // - // Initialize the network and compression - // parameters according to the settings - // suggested by the user. - // - - SetLink(); - - // - // Set compression according to link speed. - // - - SetCompression(); - - // - // Be sure that we have a literal for current - // cache size. Value will reflect control's - // default unless we already parsed a 'cache' - // option. Server side has no control on size - // of cache but is informed at session nego- - // tiation about how much memory is going to - // be used. - // - - SetStorage(); - - // - // Set size of shared memory segments. - // - - SetShmem(); - - // - // Make adjustments to cache based - // on the pack method. - // - - SetPack(); - - // - // Set disk-based image cache. - // - - SetImages(); - - // - // Set CPU and bandwidth limits. - // - - SetLimits(); - - return 1; -} - -// -// According to session literal determine -// the type of traffic that is going to be -// transported. Literals should be better -// standardized in future NX versions. -// - -int SetSession() -{ - if (strncmp(sessionType, "agent", strlen("agent")) == 0 || - strncmp(sessionType, "desktop", strlen("desktop")) == 0 || - strncmp(sessionType, "rootless", strlen("rootless")) == 0 || - strncmp(sessionType, "console", strlen("console")) == 0 || - strncmp(sessionType, "default", strlen("default")) == 0 || - strncmp(sessionType, "gnome", strlen("gnome")) == 0 || - strncmp(sessionType, "kde", strlen("kde")) == 0 || - strncmp(sessionType, "cde", strlen("cde")) == 0 || - strncmp(sessionType, "xdm", strlen("xdm")) == 0) - { - control -> SessionMode = session_agent; - } - else if (strncmp(sessionType, "win", strlen("win")) == 0 || - strncmp(sessionType, "vnc", strlen("vnc")) == 0) - { - control -> SessionMode = session_agent; - } - else if (strncmp(sessionType, "shadow", strlen("shadow")) == 0) - { - control -> SessionMode = session_shadow; - } - else if (strncmp(sessionType, "proxy", strlen("proxy")) == 0 || - strncmp(sessionType, "application", strlen("application")) == 0 || - strncmp(sessionType, "raw", strlen("raw")) == 0) - { - control -> SessionMode = session_proxy; - } - else - { - // - // If the session type is not passed or - // it is not among the recognized strings, - // we assume that the proxy is connected - // to the agent. - // - - // - // Since ProtoStep8 (#issue 108) and also - // with older "unix-" sessions - // - - if (*sessionType != '\0') - { - #ifdef WARNING - *logofs << "Loop: WARNING! Unrecognized session type '" - << sessionType << "'. Assuming agent session.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Unrecognized session type '" - << sessionType << "'. Assuming agent session.\n"; - } - - control -> SessionMode = session_agent; - } - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Assuming session type '" - << DumpSession(control -> SessionMode) << "' with " - << "string '" << sessionType << "'.\n" - << logofs_flush; - #endif - - // - // By default the policy is immediate. Agents - // will set a different policy, if they like. - // Anyway we need to check if the user has - // provided a custom flush policy. - // - - if (usePolicy != -1) - { - if (usePolicy > 0) - { - control -> FlushPolicy = policy_deferred; - } - else - { - control -> FlushPolicy = policy_immediate; - } - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: WARNING! Forcing flush policy to '" - << DumpPolicy(control -> FlushPolicy) - << ".\n" << logofs_flush; - #endif - } - else - { - control -> FlushPolicy = policy_immediate; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Setting initial flush policy to '" - << DumpPolicy(control -> FlushPolicy) - << "'.\n" << logofs_flush; - #endif - } - - // - // Check if the proxy library is run inside - // another program providing encryption, as - // it is the case of the SSH client. - // - - if (useEncryption != -1) - { - if (useEncryption > 0) - { - control -> LinkEncrypted = 1; - } - else - { - control -> LinkEncrypted = 0; - } - } - - if (control -> LinkEncrypted == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Proxy running as part of an " - << "encrypting client.\n" - << logofs_flush; - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Assuming proxy running as a " - << "standalone program.\n" - << logofs_flush; - #endif - } - - // - // Check if the system administrator has - // enabled the respawn of the client at - // the end of session. - // - - if (control -> ProxyMode == proxy_server) - { - struct stat fileStat; - - char fileName[DEFAULT_STRING_LENGTH]; - - snprintf(fileName, DEFAULT_STRING_LENGTH - 1, - "%s/share/noexit", control -> SystemPath); - - *(fileName + DEFAULT_STRING_LENGTH - 1) = '\0'; - - if (stat(fileName, &fileStat) == 0) - { - #ifdef TEST - *logofs << "Loop: Enabling respawn of client at session shutdown.\n" - << logofs_flush; - #endif - - control -> EnableRestartOnShutdown = 1; - } - } - - return 1; -} - -int SetStorage() -{ - // - // If differential compression is disabled - // we don't need a cache at all. - // - - if (control -> LocalDeltaCompression == 0) - { - control -> ClientTotalStorageSize = 0; - control -> ServerTotalStorageSize = 0; - } - - // - // Set a a cache size literal. - // - - int size = control -> getUpperStorageSize(); - - if (size / 1024 > 0) - { - sprintf(cacheSizeName, "%dk", size / 1024); - } - else - { - sprintf(cacheSizeName, "%d", size); - } - - if (control -> ProxyMode == proxy_client) - { - control -> LocalTotalStorageSize = - control -> ClientTotalStorageSize; - - control -> RemoteTotalStorageSize = - control -> ServerTotalStorageSize; - } - else - { - control -> LocalTotalStorageSize = - control -> ServerTotalStorageSize; - - control -> RemoteTotalStorageSize = - control -> ClientTotalStorageSize; - } - - #ifdef DEBUG - *logofs << "Loop: Storage size limit is " - << control -> ClientTotalStorageSize - << " at client and " - << control -> ServerTotalStorageSize - << " at server.\n" - << logofs_flush; - #endif - - #ifdef DEBUG - *logofs << "Loop: Storage local limit set to " - << control -> LocalTotalStorageSize - << " remote limit set to " - << control -> RemoteTotalStorageSize - << ".\n" << logofs_flush; - #endif - - // - // Never reserve for split store more than - // half the memory available for messages. - // - - if (size > 0 && control -> - SplitTotalStorageSize > size / 2) - { - #ifdef TEST - *logofs << "Loop: Reducing size of split store to " - << size / 2 << " bytes.\n" - << logofs_flush; - #endif - - control -> SplitTotalStorageSize = size / 2; - } - - // - // Don't load render from persistent - // cache if extension is hidden or - // not supported by agent. - // - - if (control -> HideRender == 1) - { - #ifdef TEST - *logofs << "Loop: Not loading render extension " - << "from persistent cache.\n" - << logofs_flush; - #endif - - control -> PersistentCacheLoadRender = 0; - } - - return 1; -} - -int SetShmem() -{ - // - // If not set, adjust the size of the shared - // memory segment according to size of the - // message cache. - // - - if (*shsegSizeName == '\0') - { - int size = control -> getUpperStorageSize(); - - const int mega = 1048576; - - if (size > 0) - { - if (size <= 1 * mega) - { - size = 0; - } - else if (size <= 2 * mega) - { - size = 524288; - } - else if (size < 4 * mega) - { - size = 1048576; - } - else - { - size = size / 4; - } - - if (size > 4194304) - { - size = 4194304; - } - - control -> ShmemClientSize = size; - control -> ShmemServerSize = size; - } - else - { - // - // The delta compression is disabled. - // Use a default segment size of 2 MB. - // - - control -> ShmemServerSize = 2 * mega; - } - } - - // - // Client side shared memory support is - // not useful and not implemented. - // - - if (control -> ShmemServerSize >= 524288) - { - control -> ShmemServer = 1; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Set initial shared memory size " - << "to " << control -> ShmemServerSize - << " bytes.\n" << logofs_flush; - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Disabled use of the shared memory " - << "extension.\n" << logofs_flush; - #endif - - control -> ShmemServer = 0; - } - - // For android, no shared memory available - control -> ShmemServer = 0; - control -> ShmemClientSize = 0; - - return 1; -} - -// -// Adjust the pack method according to the -// type of the session. -// - -int SetPack() -{ - #ifdef TEST - *logofs << "Loop: Setting pack with initial method " - << packMethod << " and quality " << packQuality - << ".\n" << logofs_flush; - #endif - - // - // Check if this is a proxy session and, in - // this case, set the pack method to none. - // Packed images are not supported by plain - // X applications. - // - - if (control -> SessionMode == session_proxy) - { - #ifdef TEST - *logofs << "Loop: WARNING! Disabling pack with proxy session.\n" - << logofs_flush; - #endif - - packMethod = PACK_NONE; - } - - // - // Adjust the internal settings according - // to the newly selected pack method. - // - - ParsePackMethod(packMethod, packQuality); - - // - // Don't load messages from persistent - // cache if packed images are disabled. - // - - if (control -> PackMethod == PACK_NONE) - { - control -> PersistentCacheLoadPacked = 0; - - #ifdef TEST - *logofs << "Loop: Not loading packed images " - << "from persistent cache.\n" - << logofs_flush; - #endif - } - - return 1; -} - -// -// Set the disk-based image cache parameters -// according to the user's wishes. -// - -int SetImages() -{ - // - // Be sure we disable the image cache if we - // are connecting to plain X clients. - // - - if (control -> SessionMode == session_proxy) - { - #ifdef TEST - *logofs << "Loop: Disabling image cache with " - << "session '" << DumpSession(control -> - SessionMode) << "'.\n" << logofs_flush; - #endif - - sprintf(imagesSizeName, "0"); - - control -> ImageCacheEnableLoad = 0; - control -> ImageCacheEnableSave = 0; - - return 1; - } - - int size = control -> ImageCacheDiskLimit; - - if (size / 1024 > 0) - { - sprintf(imagesSizeName, "%dk", size / 1024); - } - else - { - sprintf(imagesSizeName, "%d", size); - } - - if (size > 0) - { - control -> ImageCacheEnableLoad = 1; - control -> ImageCacheEnableSave = 1; - - if (control -> ProxyMode == proxy_server) - { - if ((control -> ImageCachePath = GetImagesPath()) == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error getting or creating image cache path.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error getting or creating image cache path.\n"; - - HandleCleanup(); - } - - #ifdef TEST - *logofs << "Loop: Path of image cache files is '" << control -> ImageCachePath - << "'.\n" << logofs_flush; - #endif - } - } - else - { - #ifdef TEST - *logofs << "Loop: Disabling the persistent image cache.\n" - << logofs_flush; - #endif - - control -> ImageCacheEnableLoad = 0; - control -> ImageCacheEnableSave = 0; - } - - return 1; -} - -int SetVersion() -{ - // - // Normalize the different proxy versions. - // - - int local = (control -> LocalVersionMajor << 24) | - (control -> LocalVersionMinor << 16) | - control -> LocalVersionPatch; - - int remote = (control -> RemoteVersionMajor << 24) | - (control -> RemoteVersionMinor << 16) | - control -> RemoteVersionPatch; - - int major = -1; - int minor = -1; - int patch = -1; - - if (control -> RemoteVersionMajor <= 1) - { - // - // The remote proxy uses a different - // logic to determine the version so - // we default to the compatibility - // version. - // - - major = control -> CompatVersionMajor; - minor = control -> CompatVersionMinor; - patch = control -> CompatVersionPatch; - - #ifdef TEST - *logofs << "Loop: Using compatibility version '" - << major << "." << minor << "." << patch - << "'.\n" << logofs_flush; - #endif - } - else if (control -> LocalVersionMajor > - control -> RemoteVersionMajor) - { - // - // We use a more recent version. Let's - // negotiate the version based on the - // version supported by the remote. - // - - major = control -> RemoteVersionMajor; - minor = control -> RemoteVersionMinor; - patch = control -> RemoteVersionPatch; - - #ifdef TEST - *logofs << "Loop: Using remote version '" - << major << "." << minor << "." << patch - << "'.\n" << logofs_flush; - #endif - } - else - { - // - // We support a major version that is - // equal or older than the remote. We - // assume the smaller version between - // the two, including the minor and - // the patch numbers. - // - - if (local > remote) - { - major = control -> RemoteVersionMajor; - minor = control -> RemoteVersionMinor; - patch = control -> RemoteVersionPatch; - - #ifdef TEST - *logofs << "Loop: Using remote version '" - << major << "." << minor << "." << patch - << "'.\n" << logofs_flush; - #endif - } - else - { - major = control -> LocalVersionMajor; - minor = control -> LocalVersionMinor; - patch = control -> LocalVersionPatch; - - #ifdef TEST - *logofs << "Loop: Using local version '" - << major << "." << minor << "." << patch - << "'.\n" << logofs_flush; - #endif - } - } - - // - // Handle versions from 3.5.0. The protocol - // step 10 is the minimum supported version. - // - - int step = 0; - - if (major == 3) - { - if (minor >= 5) - { - step = 10; - } - } - else if (major > 3) - { - step = 10; - } - - if (step == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Unable to set the protocol step value from " - << "the negotiated protocol version " << major << "." << minor - << "." << patch << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unable to set the protocol step value from " - << "the negotiated protocol version " << major << "." << minor - << "." << patch << ".\n"; - - #ifdef PANIC - *logofs << "Loop: PANIC! Incompatible remote version " - << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor - << "." << control -> RemoteVersionPatch << " with local version " - << control -> LocalVersionMajor << "." << control -> LocalVersionMinor - << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Incompatible remote version " - << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor - << "." << control -> RemoteVersionPatch << " with local version " - << control -> LocalVersionMajor << "." << control -> LocalVersionMinor - << "." << control -> LocalVersionPatch << ".\n"; - - return -1; - } - - #ifdef TEST - *logofs << "Loop: Using NX protocol step " - << step << ".\n" << logofs_flush; - #endif - - control -> setProtoStep(step); - - // - // Ignore the differences in patch version - // and print a warning if the local version - // is different or obsolete compared to - // the remote. - // - - local &= 0xffff0000; - remote &= 0xffff0000; - - if (local != remote) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Connected to remote version " - << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor - << "." << control -> RemoteVersionPatch << " with local version " - << control -> LocalVersionMajor << "." << control -> LocalVersionMinor - << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Connected to remote version " - << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor - << "." << control -> RemoteVersionPatch << " with local version " - << control -> LocalVersionMajor << "." << control -> LocalVersionMinor - << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; - } - - if (local < remote) - { - cerr << "Warning" << ": Consider checking https://github.com/ArcticaProject/nx-libs/releases for updates.\n"; - } - - // - // Now that we are aware of the remote - // version, let's adjust the options to - // be compatible with the remote proxy. - // - - if (control -> ProxyMode == proxy_client) - { - // - // Since ProtoStep8 (#issue 108) - // - // Now it's assumed that the remote is - // able to handle the selected pack - // method - // - - #ifdef TEST - *logofs << __FILE__ << " : " << __LINE__ << " - " - << "step = " << control -> getProtoStep() - << " packMethod = " << packMethod - << " packQuality = " << packQuality - << ".\n" << logofs_flush; - #endif - - // - // Update the pack method name. - // - - ParsePackMethod(packMethod, packQuality); - } - - // - // At the moment the image cache is not used by the - // agent. Proxy versions older than 3.0.0 assumed - // that it was enabled and sent specific bits as part - // of the encoding. Conversely, it is advisable to - // disable the cache right now. By not enabling the - // the image cache, the house-keeping process will - // only take care of cleaning up the "cache-" direc- - // tories. - // - - // - // Considering that compatibility with older versions - // has been set to cover as far as 3.5.0, the cache can - // be disabled at this point without any concern - // - - // Since ProtoStep8 (#issue 108) - #ifdef TEST - *logofs << "Loop: Disabling image cache with protocol " - << "step '" << control -> getProtoStep() - << "'.\n" << logofs_flush; - #endif - - sprintf(imagesSizeName, "0"); - - control -> ImageCacheEnableLoad = 0; - control -> ImageCacheEnableSave = 0; - - return 1; -} - -// -// Identify the requested link settings -// and update the control parameters -// accordingly. -// - -int SetLink() -{ - #ifdef TEST - *logofs << "Loop: Setting link with initial value " - << linkSpeedName << ".\n" << logofs_flush; - #endif - - if (*linkSpeedName == '\0') - { - strcpy(linkSpeedName, "lan"); - } - - #ifdef TEST - *logofs << "Loop: Link speed is " << linkSpeedName - << ".\n" << logofs_flush; - #endif - - if (strcasecmp(linkSpeedName, "modem") == 0) - { - SetLinkModem(); - } - else if (strcasecmp(linkSpeedName, "isdn") == 0) - { - SetLinkIsdn(); - } - else if (strcasecmp(linkSpeedName, "adsl") == 0) - { - SetLinkAdsl(); - } - else if (strcasecmp(linkSpeedName, "wan") == 0) - { - SetLinkWan(); - } - else if (strcasecmp(linkSpeedName, "lan") == 0) - { - SetLinkLan(); - } - else - { - return -1; - } - - // - // Set TCP_NODELAY according to the user's - // wishes. - // - - if (useNoDelay != -1) - { - control -> OptionProxyClientNoDelay = useNoDelay; - control -> OptionProxyServerNoDelay = useNoDelay; - } - - // - // Select the image compression method. - // - - if (packMethod == -1) - { - packMethod = control -> PackMethod; - } - - if (packQuality == -1) - { - packQuality = control -> PackQuality; - } - - if (ParsePackMethod(packMethod, packQuality) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Unrecognized pack method id " - << packMethod << " with quality " << packQuality - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unrecognized pack method id " - << packMethod << " with quality " << packQuality - << ".\n"; - - HandleCleanup(); - } - - // - // Check if the user disabled the ability - // to generate simple replies at the client - // side. - // - - if (control -> SessionMode == session_proxy) - { - if (useTaint != -1) - { - control -> TaintReplies = (useTaint == 1); - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Forcing taint of replies " - << "with a proxy session.\n" - << logofs_flush; - #endif - - control -> TaintReplies = 1; - } - } - else - { - // - // There is no need to taint the - // replies if we have an agent. - // - - control -> TaintReplies = 0; - } - - // - // Be sure that the requests needing a reply - // are flushed immediately. Normal X clients - // use so many replies to make the queuing - // completely useless. - // - - if (control -> SessionMode == session_proxy) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Forcing flush on priority " - << "with a proxy session.\n" - << logofs_flush; - #endif - - control -> FlushPriority = 1; - } - - return 1; -} - -// -// Parameters for MODEM 28.8/33.6/56 Kbps. -// - -int SetLinkModem() -{ - #ifdef TEST - *logofs << "Loop: Setting parameters for MODEM.\n" - << logofs_flush; - #endif - - control -> LinkMode = LINK_TYPE_MODEM; - - control -> TokenSize = 256; - control -> TokenLimit = 24; - - control -> SplitMode = 1; - control -> SplitTotalSize = 128; - control -> SplitTotalStorageSize = 1048576; - - control -> SplitTimeout = 50; - control -> MotionTimeout = 50; - control -> IdleTimeout = 50; - - control -> PackMethod = PACK_ADAPTIVE; - control -> PackQuality = 3; - - return 1; -} - -// -// Parameters for ISDN 64/128 Kbps. -// - -int SetLinkIsdn() -{ - #ifdef TEST - *logofs << "Loop: Setting parameters for ISDN.\n" - << logofs_flush; - #endif - - control -> LinkMode = LINK_TYPE_ISDN; - - control -> TokenSize = 384; - control -> TokenLimit = 24; - - control -> SplitMode = 1; - control -> SplitTotalSize = 128; - control -> SplitTotalStorageSize = 1048576; - - control -> SplitTimeout = 50; - control -> MotionTimeout = 20; - control -> IdleTimeout = 50; - - control -> PackMethod = PACK_ADAPTIVE; - control -> PackQuality = 5; - - return 1; -} - -// -// Parameters for ADSL 256 Kbps. -// - -int SetLinkAdsl() -{ - #ifdef TEST - *logofs << "Loop: Setting parameters for ADSL.\n" - << logofs_flush; - #endif - - control -> LinkMode = LINK_TYPE_ADSL; - - control -> TokenSize = 1536; - control -> TokenLimit = 24; - - control -> SplitMode = 1; - control -> SplitTotalSize = 128; - control -> SplitTotalStorageSize = 1048576; - - control -> SplitTimeout = 50; - control -> MotionTimeout = 10; - control -> IdleTimeout = 50; - - control -> PackMethod = PACK_ADAPTIVE; - control -> PackQuality = 7; - - return 1; -} - -// -// Parameters for XDSL/FDDI/ATM 1/2/34 Mbps WAN. -// - -int SetLinkWan() -{ - #ifdef TEST - *logofs << "Loop: Setting parameters for WAN.\n" - << logofs_flush; - #endif - - control -> LinkMode = LINK_TYPE_WAN; - - control -> TokenSize = 1536; - control -> TokenLimit = 24; - - control -> SplitMode = 1; - control -> SplitTotalSize = 128; - control -> SplitTotalStorageSize = 1048576; - - control -> SplitTimeout = 50; - control -> MotionTimeout = 5; - control -> IdleTimeout = 50; - - control -> PackMethod = PACK_ADAPTIVE; - control -> PackQuality = 9; - - return 1; -} - -// -// Parameters for LAN 10/100 Mbps. -// - -int SetLinkLan() -{ - #ifdef TEST - *logofs << "Loop: Setting parameters for LAN.\n" - << logofs_flush; - #endif - - control -> LinkMode = LINK_TYPE_LAN; - - control -> TokenSize = 1536; - control -> TokenLimit = 24; - - control -> SplitMode = 1; - control -> SplitTotalSize = 128; - control -> SplitTotalStorageSize = 1048576; - - control -> SplitTimeout = 50; - control -> MotionTimeout = 0; - control -> IdleTimeout = 50; - - control -> PackMethod = PACK_ADAPTIVE; - control -> PackQuality = 9; - - return 1; -} - -// -// Identify the requested link type and set -// the control parameters accordingly. -// - -int SetCompression() -{ - if (strcasecmp(linkSpeedName, "modem") == 0) - { - SetCompressionModem(); - } - else if (strcasecmp(linkSpeedName, "isdn") == 0) - { - SetCompressionIsdn(); - } - else if (strcasecmp(linkSpeedName, "adsl") == 0) - { - SetCompressionAdsl(); - } - else if (strcasecmp(linkSpeedName, "wan") == 0) - { - SetCompressionWan(); - } - else if (strcasecmp(linkSpeedName, "lan") == 0) - { - SetCompressionLan(); - } - else - { - return -1; - } - - if (control -> LocalDeltaCompression < 0) - { - control -> LocalDeltaCompression = 1; - } - - // - // If we didn't set remote delta compression - // (as it should always be the case at client - // side) assume value of local side. - // - - if (control -> RemoteDeltaCompression < 0) - { - control -> RemoteDeltaCompression = - control -> LocalDeltaCompression; - } - - // - // If we didn't set remote compression levels - // assume values of local side. - // - - if (control -> RemoteStreamCompression < 0) - { - control -> RemoteStreamCompressionLevel = - control -> LocalStreamCompressionLevel; - - if (control -> RemoteStreamCompressionLevel > 0) - { - control -> RemoteStreamCompression = 1; - } - else - { - control -> RemoteStreamCompression = 0; - } - } - - if (control -> RemoteDataCompression < 0) - { - control -> RemoteDataCompressionLevel = - control -> LocalDataCompressionLevel; - - if (control -> RemoteDataCompressionLevel > 0) - { - control -> RemoteDataCompression = 1; - } - else - { - control -> RemoteDataCompression = 0; - } - } - - return 1; -} - -// -// Compression for MODEM. -// - -int SetCompressionModem() -{ - if (control -> LocalDataCompression < 0) - { - control -> LocalDataCompression = 1; - control -> LocalDataCompressionLevel = 1; - } - - if (control -> LocalDataCompressionThreshold < 0) - { - control -> LocalDataCompressionThreshold = 32; - } - - if (control -> LocalStreamCompression < 0) - { - control -> LocalStreamCompression = 1; - control -> LocalStreamCompressionLevel = 9; - } - - return 1; -} - -// -// Compression for ISDN. -// - -int SetCompressionIsdn() -{ - if (control -> LocalDataCompression < 0) - { - control -> LocalDataCompression = 1; - control -> LocalDataCompressionLevel = 1; - } - - if (control -> LocalDataCompressionThreshold < 0) - { - control -> LocalDataCompressionThreshold = 32; - } - - if (control -> LocalStreamCompression < 0) - { - control -> LocalStreamCompression = 1; - control -> LocalStreamCompressionLevel = 6; - } - - return 1; -} - -// -// Compression for ADSL. -// - -int SetCompressionAdsl() -{ - if (control -> LocalDataCompression < 0) - { - control -> LocalDataCompression = 1; - control -> LocalDataCompressionLevel = 1; - } - - if (control -> LocalDataCompressionThreshold < 0) - { - control -> LocalDataCompressionThreshold = 32; - } - - if (control -> LocalStreamCompression < 0) - { - control -> LocalStreamCompression = 1; - control -> LocalStreamCompressionLevel = 4; - } - - return 1; -} - -// -// Compression for WAN. -// - -int SetCompressionWan() -{ - if (control -> LocalDataCompression < 0) - { - control -> LocalDataCompression = 1; - control -> LocalDataCompressionLevel = 1; - } - - if (control -> LocalDataCompressionThreshold < 0) - { - control -> LocalDataCompressionThreshold = 32; - } - - if (control -> LocalStreamCompression < 0) - { - control -> LocalStreamCompression = 1; - control -> LocalStreamCompressionLevel = 1; - } - - return 1; -} - -// -// Compression for LAN. -// - -int SetCompressionLan() -{ - // - // Disable delta compression if not - // explicitly enabled. - // - - if (control -> LocalDeltaCompression < 0) - { - control -> LocalDeltaCompression = 0; - } - - if (control -> LocalDataCompression < 0) - { - control -> LocalDataCompression = 0; - control -> LocalDataCompressionLevel = 0; - } - - if (control -> LocalDataCompressionThreshold < 0) - { - control -> LocalDataCompressionThreshold = 0; - } - - if (control -> LocalStreamCompression < 0) - { - control -> LocalStreamCompression = 0; - control -> LocalStreamCompressionLevel = 0; - } - - return 1; -} - -int SetLimits() -{ - // - // Check if the user requested strict - // control flow parameters. - // - - if (useStrict == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: LIMIT! Decreasing the token limit " - << "to " << control -> TokenLimit / 2 - << " with option 'strict'.\n" - << logofs_flush; - #endif - - control -> TokenLimit /= 2; - } - - #ifdef STRICT - - control -> TokenLimit = 1; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: WARNING! LIMIT! Setting the token limit " - << "to " << control -> TokenLimit - << " to simulate the proxy congestion.\n" - << logofs_flush; - #endif - - #endif - - // - // Reduce the size of the log file. - // - - #ifdef QUOTA - - control -> FileSizeLimit = 8388608; - - #endif - - // - // Check the bitrate limits. - // - - if (control -> LocalBitrateLimit == -1) - { - if (control -> ProxyMode == proxy_client) - { - control -> LocalBitrateLimit = - control -> ClientBitrateLimit; - } - else - { - control -> LocalBitrateLimit = - control -> ServerBitrateLimit; - } - } - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: LIMIT! Setting client bitrate limit " - << "to " << control -> ClientBitrateLimit - << " server bitrate limit to " << control -> - ServerBitrateLimit << " with local limit " - << control -> LocalBitrateLimit << ".\n" - << logofs_flush; - #endif - - return 1; -} - -// -// These functions are used to parse literal -// values provided by the user and set the -// control parameters accordingly. -// - -int ParseCacheOption(const char *opt) -{ - int size = ParseArg("", "cache", opt); - - if (size < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value '" - << opt << "' for option 'cache'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value '" - << opt << "' for option 'cache'.\n"; - - return -1; - } - - #ifdef TEST - *logofs << "Loop: Setting size of cache to " - << size << " bytes.\n" << logofs_flush; - #endif - - control -> ClientTotalStorageSize = size; - control -> ServerTotalStorageSize = size; - - strcpy(cacheSizeName, opt); - - if (size == 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Disabling NX delta compression.\n" - << logofs_flush; - #endif - - control -> LocalDeltaCompression = 0; - - #ifdef WARNING - *logofs << "Loop: WARNING! Disabling use of NX persistent cache.\n" - << logofs_flush; - #endif - - control -> PersistentCacheEnableLoad = 0; - control -> PersistentCacheEnableSave = 0; - } - - return 1; -} - -int ParseImagesOption(const char *opt) -{ - int size = ParseArg("", "images", opt); - - if (size < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value '" - << opt << "' for option 'images'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value '" - << opt << "' for option 'images'.\n"; - - return -1; - } - - #ifdef TEST - *logofs << "Loop: Setting size of images cache to " - << size << " bytes.\n" << logofs_flush; - #endif - - control -> ImageCacheDiskLimit = size; - - strcpy(imagesSizeName, opt); - - return 1; -} - -int ParseShmemOption(const char *opt) -{ - int size = ParseArg("", "shseg", opt); - - if (size < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value '" - << opt << "' for option 'shseg'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value '" - << opt << "' for option 'shseg'.\n"; - - return -1; - } - - control -> ShmemClientSize = size; - control -> ShmemServerSize = size; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Set shared memory size to " - << control -> ShmemServerSize << " bytes.\n" - << logofs_flush; - #endif - - strcpy(shsegSizeName, opt); - - return 1; -} - -int ParseBitrateOption(const char *opt) -{ - int bitrate = ParseArg("", "limit", opt); - - if (bitrate < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid value '" - << opt << "' for option 'limit'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Invalid value '" - << opt << "' for option 'limit'.\n"; - - return -1; - } - - strcpy(bitrateLimitName, opt); - - if (bitrate == 0) - { - #ifdef TEST - *logofs << "Loop: Disabling bitrate limit on proxy link.\n" - << logofs_flush; - #endif - - control -> LocalBitrateLimit = 0; - } - else - { - #ifdef TEST - *logofs << "Loop: Setting bitrate to " << bitrate - << " bits per second.\n" << logofs_flush; - #endif - - // - // Internal representation is in bytes - // per second. - // - - control -> LocalBitrateLimit = bitrate >> 3; - } - - return 1; -} - -int ParseHostOption(const char *opt, char *host, long &port) -{ - #ifdef TEST - *logofs << "Loop: Trying to parse options string '" << opt - << "' as a remote NX host.\n" << logofs_flush; - #endif - - if (opt == NULL || *opt == '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! No host parameter provided.\n" - << logofs_flush; - #endif - - return 0; - } - else if (strlen(opt) >= DEFAULT_STRING_LENGTH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Host parameter exceeds length of " - << DEFAULT_STRING_LENGTH << " characters.\n" - << logofs_flush; - #endif - - return 0; - } - - // - // Look for a host name followed - // by a colon followed by port. - // - - int newPort = port; - - const char *separator = strrchr(opt, ':'); - - if (separator != NULL) - { - const char *check = separator + 1; - - while (*check != '\0' && *check != ',' && - *check != '=' && isdigit(*check) != 0) - { - check++; - } - - newPort = atoi(separator + 1); - - if (newPort < 0 || *check != '\0') - { - #ifdef TEST - *logofs << "Loop: Can't identify remote NX port in string '" - << separator << "'.\n" << logofs_flush; - #endif - - return 0; - } - } - else if (newPort < 0) - { - // - // Complain if port was not passed - // by other means. - // - - #ifdef TEST - *logofs << "Loop: Can't identify remote NX port in string '" - << opt << "'.\n" << logofs_flush; - #endif - - return 0; - } - else - { - separator = opt + strlen(opt); - } - - char newHost[DEFAULT_STRING_LENGTH] = { 0 }; - - strncpy(newHost, opt, strlen(opt) - strlen(separator)); - - *(newHost + strlen(opt) - strlen(separator)) = '\0'; - - const char *check = newHost; - - while (*check != '\0' && *check != ',' && - *check != '=') - { - check++; - } - - if (*check != '\0') - { - #ifdef TEST - *logofs << "Loop: Can't identify remote NX host in string '" - << newHost << "'.\n" << logofs_flush; - #endif - - return 0; - } - else if (*acceptHost != '\0') - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't manage to connect and accept connections " - << "at the same time.\n" << logofs_flush; - - *logofs << "Loop: PANIC! Refusing remote NX host with string '" - << opt << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't manage to connect and accept connections " - << "at the same time.\n"; - - cerr << "Error" << ": Refusing remote NX host with string '" - << opt << "'.\n"; - - return -1; - } - - if (*host != '\0' && strcmp(host, newHost) != 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Overriding remote NX host '" - << host << "' with new value '" << newHost - << "'.\n" << logofs_flush; - #endif - } - - strcpy(host, newHost); - - if (port != -1 && port != newPort) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Overriding remote NX port '" - << port << "' with new value '" << newPort - << "'.\n" << logofs_flush; - #endif - } - - #ifdef TEST - *logofs << "Loop: Parsed options string '" << opt - << "' with host '" << newHost << "' and port '" - << newPort << "'.\n" << logofs_flush; - #endif - - port = newPort; - - return 1; -} - -int ParseFontPath(char *path) -{ - char oldPath[DEFAULT_STRING_LENGTH]; - - strcpy(oldPath, path); - - if (path == NULL || *path == '\0' || strcmp(path, "0") == 0) - { - return 0; - } - - #ifdef TEST - *logofs << "Loop: Parsing font server option '" << path - << "'.\n" << logofs_flush; - #endif - - // - // Convert the value to our default port. - // - - if (strcmp(fontPort, "1") == 0) - { - if (control -> ProxyMode == proxy_server) - { - snprintf(fontPort, DEFAULT_STRING_LENGTH - 1, "%d", - DEFAULT_NX_FONT_PORT_OFFSET + proxyPort); - } - else - { - // - // Let the client use the well-known - // "unix/:7100" font path. - // - - snprintf(fontPort, DEFAULT_STRING_LENGTH - 1, "unix/:7100"); - } - } - - // - // Check if a simple numaric value was given. - // - - if (atoi(path) > 0) - { - #ifdef TEST - *logofs << "Loop: Assuming numeric TCP port '" << atoi(path) - << "' for font server.\n" << logofs_flush; - #endif - - return 1; - } - - // - // Let's assume that a port specification "unix/:7100" - // corresponds to "$TEMP/.font-unix/fs7100" and a port - // "unix/:-1" corresponds to "$TEMP/.font-unix/fs-1". - // - - if (strncmp("unix/:", path, 6) == 0) - { - snprintf(path, DEFAULT_STRING_LENGTH - 1, "%s/.font-unix/fs%s", - control -> TempPath, oldPath + 6); - - *(path + DEFAULT_STRING_LENGTH - 1) = '\0'; - - #ifdef TEST - *logofs << "Loop: Assuming Unix socket '" << path - << "' for font server.\n" << logofs_flush; - #endif - } - else if (strncmp("tcp/:", path, 5) == 0) - { - snprintf(path, DEFAULT_STRING_LENGTH - 1, "%d", atoi(oldPath + 5)); - - *(path + DEFAULT_STRING_LENGTH - 1) = '\0'; - - if (atoi(path) <= 0) - { - goto ParseFontPathError; - } - - #ifdef TEST - *logofs << "Loop: Assuming TCP port '" << atoi(path) - << "' for font server.\n" << logofs_flush; - #endif - } - else - { - // - // Accept an absolute file path as - // a valid Unix socket. - // - - if (*path != '/') - { - goto ParseFontPathError; - } - - #ifdef TEST - *logofs << "Loop: Assuming Unix socket '" << path - << "' for font server.\n" << logofs_flush; - #endif - } - - return 1; - -ParseFontPathError: - - #ifdef TEST - *logofs << "Loop: Unable to determine the font server " - << "port in string '" << path << "'.\n" - << logofs_flush; - #endif - - return -1; -} - -int OpenLogFile(char *name, ostream *&stream) -{ - if (name == NULL || *name == '\0') - { - #ifdef TEST - *logofs << "Loop: WARNING! No name provided for output. Using standard error.\n" - << logofs_flush; - #endif - - if (stream == NULL) - { - stream = &cerr; - } - - return 1; - } - - if (stream == NULL || stream == &cerr) - { - if (*name != '/' && *name != '.') - { - char *filePath = GetSessionPath(); - - if (filePath == NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Cannot determine directory of NX session file.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Cannot determine directory of NX session file.\n"; - - return -1; - } - - if (strlen(filePath) + strlen("/") + - strlen(name) + 1 > DEFAULT_STRING_LENGTH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Full name of NX file '" << name - << " would exceed length of " << DEFAULT_STRING_LENGTH - << " characters.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Full name of NX file '" << name - << " would exceed length of " << DEFAULT_STRING_LENGTH - << " characters.\n"; - - return -1; - } - - char *file = new char[strlen(filePath) + strlen("/") + - strlen(name) + 1]; - - // - // Transform name in a fully qualified name. - // - - strcpy(file, filePath); - strcat(file, "/"); - strcat(file, name); - - strcpy(name, file); - - delete [] filePath; - delete [] file; - } - - mode_t fileMode = umask(0077); - - for (;;) - { - if ((stream = new ofstream(name, ios::app)) != NULL) - { - break; - } - - usleep(200000); - } - - umask(fileMode); - } - else - { - #ifdef PANIC - *logofs << "Loop: PANIC! Bad stream provided for output.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Bad stream provided for output.\n"; - - return -1; - } - - return 1; -} - -int ReopenLogFile(char *name, ostream *&stream, int limit) -{ - if (*name != '\0' && limit >= 0) - { - struct stat fileStat; - - if (limit > 0) - { - // - // This is used for the log file, if the - // size exceeds the limit. - // - - if (stat(name, &fileStat) != 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Can't get stats of file '" - << name << "'. Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - return 0; - } - else if (fileStat.st_size < (long) limit) - { - return 0; - } - } - - #ifdef TEST - *logofs << "Loop: Deleting file '" << name - << "' with size " << fileStat.st_size - << ".\n" << logofs_flush; - #endif - - // - // Create a new stream over the previous - // file. Trying to delete the file fails - // to work on recent Cygwin installs. - // - - *stream << flush; - - delete stream; - - mode_t fileMode = umask(0077); - - for (;;) - { - if ((stream = new ofstream(name, ios::out)) != NULL) - { - break; - } - - usleep(200000); - } - - umask(fileMode); - - #ifdef TEST - *logofs << "Loop: Reopened file '" << name - << "'.\n" << logofs_flush; - #endif - } - - return 1; -} - -void PrintProcessInfo() -{ - if (agent == NULL) - { - - cerr << endl; - - PrintVersionInfo(); - - cerr << endl; - - cerr << GetCopyrightInfo() - << endl - << GetOtherCopyrightInfo() - << endl - << "See https://github.com/ArcticaProject/nx-libs for more information." << endl << endl; - } - - // - // People get confused by the fact that client - // mode is running on NX server and viceversa. - // Let's adopt an user-friendly naming conven- - // tion here. - // - - cerr << "Info: Proxy running in " - << (control -> ProxyMode == proxy_client ? "client" : "server") - << " mode with pid '" << getpid() << "'.\n"; - - if (agent == NULL) - { - cerr << "Session" << ": Starting session at '" - << strTimestamp() << "'.\n"; - } - - #ifdef TEST - - if (*errorsFileName != '\0') - { - cerr << "Info" << ": Using errors file '" << errorsFileName << "'.\n"; - } - - if (*statsFileName != '\0') - { - cerr << "Info" << ": Using stats file '" << statsFileName << "'.\n"; - } - - #endif -} - -void PrintConnectionInfo() -{ - cerr << "Info" << ": Using " - << linkSpeedName << " link parameters " - << control -> TokenSize - << "/" << control -> TokenLimit - << "/" << control -> FlushPolicy + 1 - << "/" << control -> FlushPriority - << ".\n"; - - if (control -> ProxyMode == proxy_client) - { - cerr << "Info" << ": Using agent parameters " - << control -> PingTimeout - << "/" << control -> MotionTimeout - << "/" << control -> IdleTimeout - << "/" << control -> TaintReplies - << "/" << control -> HideRender - << ".\n"; - } - - if (control -> LocalDeltaCompression == 1) - { - cerr << "Info" << ": Using cache parameters " - << control -> MinimumMessageSize - << "/" << control -> MaximumMessageSize / 1024 << "KB" - << "/" << control -> ClientTotalStorageSize / 1024 << "KB" - << "/" << control -> ServerTotalStorageSize / 1024 << "KB" - << ".\n"; - } - - if (control -> ImageCacheEnableLoad == 1 || - control -> ImageCacheEnableSave == 1) - { - cerr << "Info" << ": Using image streaming parameters " - << control -> SplitTimeout - << "/" << control -> SplitTotalSize - << "/" << control -> SplitTotalStorageSize / 1024 << "KB" - << "/" << control -> SplitDataThreshold - << "/" << control -> SplitDataPacketLimit - << ".\n"; - - cerr << "Info" << ": Using image cache parameters " - << control -> ImageCacheEnableLoad - << "/" << control -> ImageCacheEnableSave - << "/" << control -> ImageCacheDiskLimit / 1024 << "KB" - << ".\n"; - } - - cerr << "Info" << ": Using pack method '" - << packMethodName << "' with session '" - << sessionType << "'.\n"; - - if (*productName != '\0') - { - cerr << "Info" << ": Using product '" << productName - << "'.\n" << logofs_flush; - } - - if (control -> LocalDeltaCompression == 0) - { - cerr << "Info" << ": Not using NX delta compression.\n"; - } - - if (control -> LocalDataCompression == 1 || - control -> RemoteDataCompression == 1) - { - cerr << "Info" << ": Using ZLIB data compression " - << control -> LocalDataCompressionLevel - << "/" << control -> RemoteDataCompressionLevel - << "/" << control -> LocalDataCompressionThreshold - << ".\n"; - } - else - { - cerr << "Info" << ": Not using ZLIB data compression.\n"; - } - - if (control -> LocalStreamCompression == 1 || - control -> RemoteStreamCompression == 1) - { - cerr << "Info" << ": Using ZLIB stream compression " - << control -> LocalStreamCompressionLevel - << "/" << control -> RemoteStreamCompressionLevel - << ".\n"; - } - else - { - cerr << "Info" << ": Not using ZLIB stream compression.\n"; - } - - if (control -> LocalBitrateLimit > 0) - { - cerr << "Info" << ": Using bandwidth limit of " - << bitrateLimitName << " bits per second.\n"; - } - - if (control -> PersistentCacheName != NULL) - { - cerr << "Info" << ": Using cache file '" - << control -> PersistentCachePath << "/" - << control -> PersistentCacheName << "'.\n"; - } - else - { - if (control -> PersistentCacheEnableLoad == 0 || - control -> LocalDeltaCompression == 0) - { - cerr << "Info" << ": Not using a persistent cache.\n"; - } - else - { - cerr << "Info" << ": No suitable cache file found.\n"; - } - } - - if (control -> ProxyMode == proxy_client && - (useUnixSocket > 0 || useTcpSocket > 0 || - useAgentSocket > 0)) - { - cerr << "Info" << ": Listening to X11 connections " - << "on display ':" << xPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_server) - { - cerr << "Info" << ": Forwarding X11 connections " - << "to display '" << displayHost << "'.\n"; - } - - if (control -> ProxyMode == proxy_client && - useCupsSocket > 0 && cupsPort.enabled()) - { - cerr << "Info" << ": Listening to CUPS connections " - << "on port '" << cupsPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_server && - cupsPort.enabled()) - { - cerr << "Info" << ": Forwarding CUPS connections " - << "to port '" << cupsPort << "'.\n"; - } - - if (control -> ProxyMode == proxy_client && - useAuxSocket > 0 && auxPort.enabled()) - { - cerr << "Info" << ": Listening to auxiliary X11 connections " - << "on port '" << auxPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_server && - auxPort.enabled()) - { - cerr << "Info" << ": Forwarding auxiliary X11 connections " - << "to display '" << displayHost << "'.\n"; - } - - if (control -> ProxyMode == proxy_client && - useSmbSocket > 0 && smbPort.enabled()) - { - cerr << "Info" << ": Listening to SMB connections " - << "on port '" << smbPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_server && - smbPort.enabled()) - { - cerr << "Info" << ": Forwarding SMB connections " - << "to port '" << smbPort << "'.\n"; - } - - if (control -> ProxyMode == proxy_client && - useMediaSocket > 0 && mediaPort.enabled()) - { - cerr << "Info" << ": Listening to multimedia connections " - << "on port '" << mediaPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_server && - mediaPort.enabled()) - { - cerr << "Info" << ": Forwarding multimedia connections " - << "to port '" << mediaPort << "'.\n"; - } - - if (control -> ProxyMode == proxy_client && - useHttpSocket > 0 && httpPort.enabled()) - { - cerr << "Info" << ": Listening to HTTP connections " - << "on port '" << httpPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_server && - httpPort.enabled()) - { - cerr << "Info" << ": Forwarding HTTP connections " - << "to port '" << httpPort << "'.\n"; - } - - if (control -> ProxyMode == proxy_server && - useFontSocket > 0 && *fontPort != '\0') - { - cerr << "Info" << ": Listening to font server connections " - << "on port '" << fontPort << "'.\n"; - } - else if (control -> ProxyMode == proxy_client && - *fontPort != '\0') - { - cerr << "Info" << ": Forwarding font server connections " - << "to port '" << fontPort << "'.\n"; - } - - if (useSlaveSocket > 0 && slavePort.enabled()) - { - cerr << "Info" << ": Listening to slave connections " - << "on port '" << slavePort << "'.\n"; - } -} - -void PrintVersionInfo() -{ - cerr << "NXPROXY - " << "Version " - << control -> LocalVersionMajor << "." - << control -> LocalVersionMinor << "." - << control -> LocalVersionPatch << "." - << control -> LocalVersionMaintenancePatch; - - cerr << endl; -} - -void PrintCopyrightInfo() -{ - cerr << endl; - - PrintVersionInfo(); - - cerr << endl; - - cerr << GetCopyrightInfo(); - - // - // Print third party's copyright info. - // - - cerr << endl; - - cerr << GetOtherCopyrightInfo(); - - cerr << endl; -} - -void PrintOptionIgnored(const char *type, const char *name, const char *value) -{ - if (control -> ProxyMode == proxy_server) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring " << type - << " option '" << name << "' with value '" - << value << "' at " << "NX client side.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Ignoring " << type - << " option '" << name << "' with value '" - << value << "' at " << "NX client side.\n"; - } - else - { - #ifdef WARNING - *logofs << "Loop: WARNING! Ignoring " << type - << " option '" << name << "' with value '" - << value << "' at " << "NX server side.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Ignoring " << type - << " option '" << name << "' with value '" - << value << "' at " << "NX server side.\n"; - } -} - -const char *GetOptions(const char *options) -{ - if (options != NULL) - { - if (strncasecmp(options, "nx/nx,", 6) != 0 && - strncasecmp(options, "nx,", 3) != 0 && - strncasecmp(options, "nx:", 3) != 0) - { - #ifdef TEST - *logofs << "Loop: PANIC! Display options string '" << options - << "' must start with 'nx' or 'nx/nx' prefix.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Display options string '" << options - << "' must start with 'nx' or 'nx/nx' prefix.\n"; - - HandleCleanup(); - } - } - else - { - options = getenv("DISPLAY"); - } - - return options; -} - -const char *GetArg(int &argi, int argc, const char **argv) -{ - // - // Skip "-" and flag character. - // - - const char *arg = argv[argi] + 2; - - if (*arg == 0) - { - if (argi + 1 == argc) - { - return NULL; - } - else - { - argi++; - - return (*argv[argi] == '-' ? NULL : argv[argi]); - } - } - else - { - return (*arg == '-' ? NULL : arg); - } -} - -int CheckArg(const char *type, const char *name, const char *value) -{ - #ifdef TEST - *logofs << "Loop: Parsing " << type << " option '" << name - << "' with value '" << (value ? value : "(null)") - << "'.\n" << logofs_flush; - #endif - - if (value == NULL || strstr(value, "=") != NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error in " << type << " option '" - << name << "'. No value found.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error in " << type << " option '" - << name << "'. No value found.\n"; - - return -1; - } - else if (strstr(name, ",") != NULL) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Parse error at " << type << " option '" - << name << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Parse error at " << type << " option '" - << name << "'.\n"; - - return -1; - } - else if (strlen(value) >= DEFAULT_STRING_LENGTH) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Value '" << value << "' of " - << type << " option '" << name << "' exceeds length of " - << DEFAULT_STRING_LENGTH << " characters.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Value '" << value << "' of " - << type << " option '" << name << "' exceeds length of " - << DEFAULT_STRING_LENGTH << " characters.\n"; - - return -1; - } - - return 1; -} - -int ParseArg(const char *type, const char *name, const char *value) -{ - if (strcasecmp(value, "0") == 0) - { - return 0; - } - - // - // Find the base factor. - // - - double base; - - const char *id = value + strlen(value) - 1; - - if (strcasecmp(id, "g") == 0) - { - base = 1024 * 1024 * 1024; - } - else if (strcasecmp(id, "m") == 0) - { - base = 1024 * 1024; - } - else if (strcasecmp(id, "k") == 0) - { - base = 1024; - } - else if (strcasecmp(id, "b") == 0 || isdigit(*id) == 1) - { - base = 1; - } - else - { - return -1; - } - - char *string = new char[strlen(value)]; - - strncpy(string, value, strlen(value) - 1); - - *(string + (strlen(value) - 1)) = '\0'; - - #ifdef TEST - - *logofs << "Loop: Parsing integer option '" << name - << "' from string '" << string << "' with base set to "; - - switch (tolower(*id)) - { - case 'k': - case 'm': - case 'g': - { - *logofs << (char) toupper(*id); - } - break; - } - - *logofs << ".\n" << logofs_flush; - - #endif - - double result = atof(string) * base; - - if (result < 0 || result > (((unsigned) -1) >> 1)) - { - delete [] string; - - return -1; - } - - delete [] string; - - #ifdef TEST - *logofs << "Loop: Integer option parsed to '" - << (int) result << "'.\n" << logofs_flush; - #endif - - return (int) result; -} - -void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value, - ChannelEndPoint &endPoint) { - endPoint.setSpec(value); - if (!endPoint.validateSpec()) { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid " << type - << " option '" << name << "' with value '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid " << type - << " option '" << name << "' with value '" - << value << "'.\n"; - - HandleCleanup(); - } -} - - -int ValidateArg(const char *type, const char *name, const char *value) -{ - int number = atoi(value); - - if (number < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Invalid " << type - << " option '" << name << "' with value '" - << value << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid " << type - << " option '" << name << "' with value '" - << value << "'.\n"; - - HandleCleanup(); - } - - return number; -} - -int LowercaseArg(const char *type, const char *name, char *value) -{ - char *next = value; - - while (*next != '\0') - { - *next = tolower(*next); - - next++; - } - - return 1; -} - -int CheckSignal(int signal) -{ - // - // Return 1 if the signal needs to be handled - // by the proxy, 2 if the signal just needs to - // be blocked to avoid interrupting a system - // call. - // - - switch (signal) - { - case SIGCHLD: - case SIGUSR1: - case SIGUSR2: - case SIGHUP: - case SIGINT: - case SIGTERM: - case SIGPIPE: - case SIGALRM: - { - return 1; - } - case SIGVTALRM: - case SIGWINCH: - case SIGIO: - case SIGTSTP: - case SIGTTIN: - case SIGTTOU: - { - return 2; - } - default: - { - #ifdef __CYGWIN32__ - - // - // This signal can be raised by the Cygwin - // library. - // - - if (signal == 12) - { - return 1; - } - - #endif - - return 0; - } - } -} - -static void PrintUsageInfo(const char *option, int error) -{ - if (error == 1) - { - cerr << "Error" << ": Invalid command line option '" << option << "'.\n"; - } - - cerr << GetUsageInfo(); - - if (error == 1) - { - cerr << "Error" << ": NX transport initialization failed.\n"; - } -} - -static void handleCheckSessionInLoop() -{ - // - // Check if we completed the shutdown procedure - // and the remote confirmed the shutdown. The - // tear down should be always initiated by the - // agent, but the X server side may unilateral- - // ly shut down the link without our permission. - // - - if (proxy -> getShutdown() > 0) - { - #ifdef TEST - *logofs << "Loop: End of NX transport requested " - << "by remote.\n" << logofs_flush; - #endif - - handleTerminatingInLoop(); - - if (control -> ProxyMode == proxy_server) - { - #ifdef TEST - *logofs << "Loop: Bytes received so far are " - << (unsigned long long) statistics -> getBytesIn() - << ".\n" << logofs_flush; - #endif - - if (statistics -> getBytesIn() < 1024) - { - cerr << "Info" << ": Your session was closed before reaching " - << "a usable state.\n"; - cerr << "Info" << ": This can be due to the local X server " - << "refusing access to the client.\n"; - cerr << "Info" << ": Please check authorization provided " - << "by the remote X application.\n"; - } - } - - #ifdef TEST - *logofs << "Loop: Shutting down the NX transport.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - else if (proxy -> handlePing() < 0) - { - #ifdef TEST - *logofs << "Loop: Failure handling the ping for " - << "proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - HandleShutdown(); - } - - // - // Check if the watchdog has exited and we didn't - // get the SIGCHLD. This can happen if the parent - // has overridden our signal handlers. - // - - if (IsRunning(lastWatchdog) && CheckProcess(lastWatchdog, "watchdog") == 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Watchdog is gone unnoticed. " - << "Setting the last signal to SIGTERM.\n" - << logofs_flush; - #endif - - lastSignal = SIGTERM; - - #ifdef WARNING - *logofs << "Loop: WARNING! Resetting pid of last " - << "watchdog process.\n" << logofs_flush; - #endif - - SetNotRunning(lastWatchdog); - } - - // - // Let the client proxy find out if the agent's - // channel is gone. This is the normal shutdown - // procedure in the case of an internal connect- - // ion to the agent. - // - - int cleanup = 0; - - if (control -> ProxyMode == proxy_client && - agent != NULL && proxy -> getType(agentFD[1]) == - channel_none && lastKill == 0 && lastDestroy == 1) - { - #ifdef TEST - *logofs << "Loop: End of NX transport requested " - << "by agent.\n" << logofs_flush; - #endif - - #ifdef TEST - *logofs << "Loop: Bytes sent so far are " - << (unsigned long long) statistics -> getBytesOut() - << ".\n" << logofs_flush; - #endif - - if (statistics -> getBytesOut() < 1024) - { - cerr << "Info" << ": Your session has died before reaching " - << "an usable state.\n"; - cerr << "Info" << ": This can be due to the remote X server " - << "refusing access to the client.\n"; - cerr << "Info" << ": Please check the authorization provided " - << "by your X application.\n"; - } - - cleanup = 1; - } - - // - // Check if the user requested the end of the - // session by sending a signal to the proxy. - // All signals are handled in the main loop - // so we need to reset the value to get ready - // for the next iteration. - // - - int signal = 0; - - if (lastSignal != 0) - { - switch (lastSignal) - { - case SIGCHLD: - case SIGUSR1: - case SIGUSR2: - { - break; - } - default: - { - signal = lastSignal; - - cleanup = 1; - - break; - } - } - - lastSignal = 0; - } - - if (cleanup == 1) - { - // - // The first time termination signal is received - // disable all further connections, close down any - // X channel and wait for a second signal. - // - - if (lastKill == 0) - { - // - // Don't print a message if cleanup is - // due to normal termination of agent. - // - - if (signal != 0) - { - #ifdef TEST - *logofs << "Loop: End of NX transport requested by signal '" - << signal << "' '" << DumpSignal(signal) - << "'.\n" << logofs_flush; - #endif - - handleTerminatingInLoop(); - } - - // - // Disable any further connection. - // - - CleanupListeners(); - - // - // Close all the remaining X channels and - // let proxies save their persistent cache - // on disk. - // - - CleanupConnections(); - - // - // We'll need to wait for the X channels - // to be shut down before waiting for the - // cleanup signal. - // - - lastKill = 1; - } - else if (lastKill == 2) - { - #ifdef TEST - *logofs << "Loop: Shutting down the NX transport.\n" - << logofs_flush; - #endif - - proxy -> handleShutdown(); - - HandleCleanup(); - } - } - - if (lastKill == 1 && proxy -> getChannels(channel_x11) == 0) - { - // - // Save the message stores to the - // persistent cache. - // - - proxy -> handleSave(); - - // - // Run a watchdog process so we can finally - // give up at the time the watchdog exits. - // - - if (IsNotRunning(lastWatchdog)) - { - int timeout = control -> CleanupTimeout; - - if (timeout > 0) - { - if (proxy -> getChannels() == 0) - { - timeout = 500; - } - - #ifdef TEST - *logofs << "Loop: Starting watchdog process with timeout " - << "of " << timeout << " Ms.\n" - << logofs_flush; - #endif - } - #ifdef TEST - else - { - *logofs << "Loop: Starting watchdog process without " - << "a timeout.\n" << logofs_flush; - } - #endif - - lastWatchdog = NXTransWatchdog(timeout); - - if (IsFailed(lastWatchdog)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't start the NX watchdog " - << "process in shutdown.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't start the NX watchdog " - << "process in shutdown.\n"; - - HandleCleanup(); - } - #ifdef TEST - else - { - *logofs << "Loop: Watchdog started with pid '" - << lastWatchdog << "'.\n" << logofs_flush; - } - #endif - } - else - { - #ifdef PANIC - *logofs << "Loop: PANIC! Previous watchdog detected " - << "in shutdown with pid '" << lastWatchdog - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Previous watchdog detected " - << "in shutdown with pid '" << lastWatchdog - << "'.\n"; - - HandleCleanup(); - } - - if (control -> CleanupTimeout > 0) - { - #ifdef TEST - *logofs << "Loop: Waiting the cleanup timeout to complete.\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Waiting the cleanup timeout to complete.\n"; - } - else - { - // - // The NX server will kill the watchdog - // process after having shut down the - // service channels. - // - - cerr << "Info" << ": Watchdog running with pid '" << lastWatchdog - << "'.\n"; - - #ifdef TEST - *logofs << "Loop: Waiting the watchdog process to complete.\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Waiting the watchdog process to complete.\n"; - } - - lastKill = 2; - } -} - -static void handleCheckBitrateInLoop() -{ - static long int slept = 0; - - #ifdef TEST - *logofs << "Loop: Bitrate is " << statistics -> getBitrateInShortFrame() - << " B/s and " << statistics -> getBitrateInLongFrame() - << " B/s in " << control -> ShortBitrateTimeFrame / 1000 - << "/" << control -> LongBitrateTimeFrame / 1000 - << " seconds timeframes.\n" << logofs_flush; - #endif - - // - // This can be improved. We may not jump out - // of the select often enough to guarantee - // the necessary accuracy. - // - - if (control -> LocalBitrateLimit > 0) - { - #ifdef TEST - *logofs << "Loop: Calculating bandwidth usage with limit " - << control -> LocalBitrateLimit << ".\n" - << logofs_flush; - #endif - - int reference = (statistics -> getBitrateInLongFrame() + - statistics -> getBitrateInShortFrame()) / 2; - - if (reference > control -> LocalBitrateLimit) - { - double ratio = ((double) reference) / - ((double) control -> LocalBitrateLimit); - - if (ratio > 1.2) - { - ratio = 1.2; - } - - slept += (unsigned int) (pow(50000, ratio) / 1000); - - if (slept > 2000) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Sleeping due to " - << "reference bitrate of " << reference - << " B/s.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Sleeping due to " - << "reference bitrate of " << reference - << " B/s.\n"; - - slept %= 2000; - } - - T_timestamp idleTs = getNewTimestamp(); - - usleep((unsigned int) pow(50000, ratio)); - - int diffTs = diffTimestamp(idleTs, getNewTimestamp()); - - statistics -> addIdleTime(diffTs); - - statistics -> subReadTime(diffTs); - } - } -} - -#if defined(TEST) || defined(INFO) - -static void handleCheckStateInLoop(int &setFDs) -{ - int fdLength; - int fdPending; - int fdSplits; - - for (int j = 0; j < setFDs; j++) - { - if (j != proxyFD) - { - fdPending = proxy -> getPending(j); - - if (fdPending > 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Buffer for descriptor FD#" - << j << " has pending bytes to read.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - - fdLength = proxy -> getLength(j); - - if (fdLength > 0) - { - #ifdef TEST - *logofs << "Loop: WARNING! Buffer for descriptor FD#" - << j << " has " << fdLength << " bytes to write.\n" - << logofs_flush; - #endif - } - } - } - - fdPending = proxy -> getPending(proxyFD); - - if (fdPending > 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Buffer for proxy descriptor FD#" - << proxyFD << " has pending bytes to read.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - - fdLength = proxy -> getFlushable(proxyFD); - - if (fdLength > 0) - { - if (control -> FlushPolicy == policy_immediate && - proxy -> getBlocked(proxyFD) == 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Buffer for proxy descriptor FD#" - << proxyFD << " has " << fdLength << " bytes " - << "to write with policy 'immediate'.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - else - { - #ifdef TEST - *logofs << "Loop: WARNING! Buffer for proxy descriptor FD#" - << proxyFD << " has " << fdLength << " bytes " - << "to write.\n" << logofs_flush; - #endif - } - } - - fdSplits = proxy -> getSplitSize(); - - if (fdSplits > 0) - { - #ifdef WARNING - *logofs << "Loop: WARNING! Proxy descriptor FD#" << proxyFD - << " has " << fdSplits << " splits to send.\n" - << logofs_flush; - #endif - } -} - -static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, - fd_set &writeSet, T_timestamp selectTs) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Maximum descriptors is [" - << setFDs << "] at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - int i; - - if (setFDs > 0) - { - i = 0; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Selected for read are "; - #endif - - for (int j = 0; j < setFDs; j++) - { - if (FD_ISSET(j, &readSet)) - { - #if defined(TEST) || defined(INFO) - *logofs << "[" << j << "]" << logofs_flush; - #endif - - i++; - } - } - - if (i > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << ".\n" << logofs_flush; - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "[none].\n" << logofs_flush; - #endif - } - - i = 0; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Selected for write are "; - #endif - - for (int j = 0; j < setFDs; j++) - { - if (FD_ISSET(j, &writeSet)) - { - #if defined(TEST) || defined(INFO) - *logofs << "[" << j << "]" << logofs_flush; - #endif - - i++; - } - } - - if (i > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << ".\n" << logofs_flush; - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "[none].\n" << logofs_flush; - #endif - } - } - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Select timeout is " - << selectTs.tv_sec << " S and " - << (double) selectTs.tv_usec / 1000 - << " Ms.\n" << logofs_flush; - #endif -} - -static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs, - struct timeval &startTs) -{ - int diffTs = diffTimestamp(startTs, getNewTimestamp()); - - #if defined(TEST) || defined(INFO) - - if (diffTs >= (control -> PingTimeout - - (control -> LatencyTimeout * 4))) - { - *logofs << "Loop: Select result is [" << resultFDs - << "] at " << strMsTimestamp() << " with no " - << "communication within " << diffTs - << " Ms.\n" << logofs_flush; - } - else - { - *logofs << "Loop: Select result is [" << resultFDs - << "] error is [" << errorFDs << "] at " - << strMsTimestamp() << " after " << diffTs - << " Ms.\n" << logofs_flush; - } - - #endif - - int i; - - if (resultFDs > 0) - { - i = 0; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Selected for read are "; - #endif - - for (int j = 0; j < setFDs; j++) - { - if (FD_ISSET(j, &readSet)) - { - #if defined(TEST) || defined(INFO) - *logofs << "[" << j << "]" << logofs_flush; - #endif - - i++; - } - } - - if (i > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << ".\n" << logofs_flush; - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "[none].\n" << logofs_flush; - #endif - } - - i = 0; - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Selected for write are "; - #endif - - for (int j = 0; j < setFDs; j++) - { - if (FD_ISSET(j, &writeSet)) - { - #if defined(TEST) || defined(INFO) - *logofs << "[" << j << "]" << logofs_flush; - #endif - - i++; - } - } - - if (i > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << ".\n" << logofs_flush; - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "[none].\n" << logofs_flush; - #endif - } - } -} - -#endif - -static void handleCheckSessionInConnect() -{ - #ifdef TEST - *logofs << "Loop: Going to check session in connect.\n" - << logofs_flush; - #endif - - if (control -> ProxyMode == proxy_client) - { - HandleAlert(FAILED_PROXY_CONNECTION_CLIENT_ALERT, 1); - } - else if (IsNotRunning(lastDialog)) - { - HandleAlert(FAILED_PROXY_CONNECTION_SERVER_ALERT, 1); - } - - handleAlertInLoop(); -} - -static void handleStatisticsInLoop() -{ - if (lastSignal == 0) - { - return; - } - - int mode = NO_STATS; - - if (control -> EnableStatistics == 1) - { - if (lastSignal == SIGUSR1) - { - // - // Print overall statistics. - // - - mode = TOTAL_STATS; - } - else if (lastSignal == SIGUSR2) - { - // - // Print partial statistics. - // - - mode = PARTIAL_STATS; - } - - if (mode == TOTAL_STATS || mode == PARTIAL_STATS) - { - #ifdef TEST - *logofs << "Loop: Going to request proxy statistics " - << "with signal '" << DumpSignal(lastSignal) - << "'.\n" << logofs_flush; - #endif - - if (proxy != NULL) - { - if (ReopenLogFile(statsFileName, statofs, 0) < 0) - { - HandleCleanup(); - } - - proxy -> handleStatistics(mode, statofs); - } - } - } -} - -static void handleNegotiationInLoop(int &setFDs, fd_set &readSet, - fd_set &writeSet, T_timestamp &selectTs) -{ - int yield = 0; - - while (yield == 0) - { - #ifdef TEST - *logofs << "Loop: Going to run a new negotiation loop " - << "with stage " << control -> ProxyStage - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - switch (control -> ProxyStage) - { - case stage_undefined: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_undefined" << "'.\n" - << logofs_flush; - #endif - - control -> ProxyStage = stage_initializing; - - break; - } - case stage_initializing: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_initializing" << "'.\n" - << logofs_flush; - #endif - - InitBeforeNegotiation(); - - control -> ProxyStage = stage_connecting; - - break; - } - case stage_connecting: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_connecting" << "'.\n" - << logofs_flush; - #endif - - SetupProxyConnection(); - - control -> ProxyStage = stage_connected; - - break; - } - case stage_connected: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_connected" << "'.\n" - << logofs_flush; - #endif - - // - // Server side proxy must always be the one that - // sends its version and options first, so, in - // some way, client side can be the the one that - // has the last word on the matter. - // - - if (control -> ProxyMode == proxy_server) - { - // - // Check if we have been listening for a - // forwarder. In this case it will have to - // authenticate itself. - // - - if (WE_LISTEN_FORWARDER) - { - control -> ProxyStage = stage_waiting_forwarder_version; - - break; - } - - control -> ProxyStage = stage_sending_proxy_options; - } - else - { - // - // The X client side is the side that has to wait - // for the authorization cookie and any remote - // option. - // - - control -> ProxyStage = stage_waiting_proxy_version; - } - - break; - } - case stage_sending_proxy_options: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_sending_proxy_options" << "'.\n" - << logofs_flush; - #endif - - if (SendProxyOptions(proxyFD) < 0) - { - goto handleNegotiationInLoopError; - } - - if (control -> ProxyMode == proxy_server) - { - control -> ProxyStage = stage_waiting_proxy_version; - } - else - { - control -> ProxyStage = stage_sending_proxy_caches; - } - - break; - } - case stage_waiting_forwarder_version: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_waiting_forwarder_version" << "'.\n" - << logofs_flush; - #endif - - int result = ReadForwarderVersion(proxyFD); - - if (result == 0) - { - yield = 1; - } - else if (result == 1) - { - control -> ProxyStage = stage_waiting_forwarder_options; - } - else - { - goto handleNegotiationInLoopError; - } - - break; - } - case stage_waiting_forwarder_options: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_waiting_forwarder_options" << "'.\n" - << logofs_flush; - #endif - - int result = ReadForwarderOptions(proxyFD); - - if (result == 0) - { - yield = 1; - } - else if (result == 1) - { - control -> ProxyStage = stage_sending_proxy_options; - } - else - { - goto handleNegotiationInLoopError; - } - - break; - } - case stage_waiting_proxy_version: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_waiting_proxy_version" << "'.\n" - << logofs_flush; - #endif - - int result = ReadProxyVersion(proxyFD); - - if (result == 0) - { - yield = 1; - } - else if (result == 1) - { - control -> ProxyStage = stage_waiting_proxy_options; - } - else - { - goto handleNegotiationInLoopError; - } - - break; - } - case stage_waiting_proxy_options: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_waiting_proxy_options" << "'.\n" - << logofs_flush; - #endif - - int result = ReadProxyOptions(proxyFD); - - if (result == 0) - { - yield = 1; - } - else if (result == 1) - { - if (control -> ProxyMode == proxy_server) - { - control -> ProxyStage = stage_waiting_proxy_caches; - } - else - { - control -> ProxyStage = stage_sending_proxy_options; - } - } - else - { - goto handleNegotiationInLoopError; - } - - break; - } - case stage_sending_proxy_caches: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_sending_proxy_caches" << "'.\n" - << logofs_flush; - #endif - - if (SendProxyCaches(proxyFD) < 0) - { - goto handleNegotiationInLoopError; - } - - if (control -> ProxyMode == proxy_server) - { - control -> ProxyStage = stage_operational; - } - else - { - control -> ProxyStage = stage_waiting_proxy_caches; - } - - break; - } - case stage_waiting_proxy_caches: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_waiting_proxy_caches" << "'.\n" - << logofs_flush; - #endif - - int result = ReadProxyCaches(proxyFD); - - if (result == 0) - { - yield = 1; - } - else if (result == 1) - { - if (control -> ProxyMode == proxy_server) - { - control -> ProxyStage = stage_sending_proxy_caches; - } - else - { - control -> ProxyStage = stage_operational; - } - } - else - { - goto handleNegotiationInLoopError; - } - - break; - } - case stage_operational: - { - #ifdef TEST - *logofs << "Loop: Handling negotiation with '" - << "stage_operational" << "'.\n" - << logofs_flush; - #endif - - InitAfterNegotiation(); - - yield = 1; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Loop: PANIC! Unmanaged case '" << control -> ProxyStage - << "' while handling negotiation.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unmanaged case '" << control -> ProxyStage - << "' while handling negotiation.\n"; - - HandleCleanup(); - } - } - } - - // - // Check if the user requested the end of - // the session. - // - - if (CheckAbort() != 0) - { - HandleCleanup(); - } - - // - // Select the proxy descriptor so that we - // can proceed negotiating the session. - // - - FD_SET(proxyFD, &readSet); - - if (proxyFD >= setFDs) - { - setFDs = proxyFD + 1; - } - - setMinTimestamp(selectTs, control -> PingTimeout); - - #ifdef TEST - *logofs << "Loop: Selected proxy FD#" << proxyFD << " in negotiation " - << "phase with timeout of " << selectTs.tv_sec << " S and " - << selectTs.tv_usec << " Ms.\n" << logofs_flush; - #endif - - return; - -handleNegotiationInLoopError: - - #ifdef PANIC - *logofs << "Loop: PANIC! Failure negotiating the session in stage '" - << control -> ProxyStage << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failure negotiating the session in stage '" - << control -> ProxyStage << "'.\n"; - - - if (control -> ProxyMode == proxy_server && - control -> ProxyStage == stage_waiting_proxy_version) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Wrong version or invalid session " - << "authentication cookie.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Wrong version or invalid session " - << "authentication cookie.\n"; - } - - handleTerminatingInLoop(); - - HandleCleanup(); -} - -static void handleTerminatingInLoop() -{ - if (getpid() == lastProxy) - { - if (control -> ProxyStage < stage_terminating) - { - if (agent == NULL) - { - cerr << "Session" << ": Terminating session at '" - << strTimestamp() << "'.\n"; - } - - control -> ProxyStage = stage_terminating; - } - } -} - -static void handleTerminatedInLoop() -{ - if (getpid() == lastProxy) - { - if (control -> ProxyStage < stage_terminated) - { - if (agent == NULL) - { - cerr << "Session" << ": Session terminated at '" - << strTimestamp() << "'.\n"; - } - - control -> ProxyStage = stage_terminated; - } - } -} - -static void handleAlertInLoop() -{ - if (lastAlert.code == 0) - { - return; - } - - // - // Since ProtoStep7 (#issue 108) - // - // Now the remote proxy should always - // be able to handle the alert - // - - if (lastAlert.local == 0) - { - if (proxy != NULL) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Requesting a remote alert with code '" - << lastAlert.code << "'.\n" << logofs_flush; - #endif - - if (proxy -> handleAlert(lastAlert.code) < 0) - { - HandleShutdown(); - } - } - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Handling a local alert with code '" - << lastAlert.code << "'.\n" << logofs_flush; - #endif - - if (control -> ProxyMode == proxy_client) - { - // - // If we are at X client side and server - // proxy is not responding, we don't have - // any possibility to interact with user. - // - - if (lastAlert.code != CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT && - lastAlert.code != RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT && - lastAlert.code != FAILED_PROXY_CONNECTION_CLIENT_ALERT) - { - // - // Let the server proxy show the dialog. - // - - if (proxy != NULL && - proxy -> handleAlert(lastAlert.code) < 0) - { - HandleShutdown(); - } - } - } - else - { - char caption[DEFAULT_STRING_LENGTH]; - - strcpy(caption, ALERT_CAPTION_PREFIX); - - int length = strlen(sessionId); - - // - // Get rid of the trailing MD5 from session id. - // - - if (length > (MD5_LENGTH * 2 + 1) && - *(sessionId + (length - (MD5_LENGTH * 2 + 1))) == '-') - { - strncat(caption, sessionId, length - (MD5_LENGTH * 2 + 1)); - } - else - { - strcat(caption, sessionId); - } - - // - // Use the display to which we are forwarding - // the remote X connections. - // - - char *display = displayHost; - - int replace = 1; - int local = 1; - - const char *message; - const char *type; - - switch (lastAlert.code) - { - case CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT: - { - message = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_STRING; - type = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_TYPE; - - break; - } - case CLOSE_DEAD_X_CONNECTION_SERVER_ALERT: - { - message = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_STRING; - type = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_TYPE; - - break; - } - case CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT: - { - message = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING; - type = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE; - - break; - } - case RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT: - { - message = RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING; - type = RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE; - - break; - } - case CLOSE_UNRESPONSIVE_X_SERVER_ALERT: - { - message = CLOSE_UNRESPONSIVE_X_SERVER_ALERT_STRING; - type = CLOSE_UNRESPONSIVE_X_SERVER_ALERT_TYPE; - - break; - } - case WRONG_PROXY_VERSION_ALERT: - { - message = WRONG_PROXY_VERSION_ALERT_STRING; - type = WRONG_PROXY_VERSION_ALERT_TYPE; - - break; - } - case FAILED_PROXY_CONNECTION_SERVER_ALERT: - { - message = FAILED_PROXY_CONNECTION_SERVER_ALERT_STRING; - type = FAILED_PROXY_CONNECTION_SERVER_ALERT_TYPE; - - break; - } - case MISSING_PROXY_CACHE_ALERT: - { - message = MISSING_PROXY_CACHE_ALERT_STRING; - type = MISSING_PROXY_CACHE_ALERT_TYPE; - - break; - } - case ABORT_PROXY_CONNECTION_ALERT: - { - message = ABORT_PROXY_CONNECTION_ALERT_STRING; - type = ABORT_PROXY_CONNECTION_ALERT_TYPE; - - break; - } - case DISPLACE_MESSAGE_ALERT: - { - message = DISPLACE_MESSAGE_ALERT_STRING; - type = DISPLACE_MESSAGE_ALERT_TYPE; - - break; - } - case GREETING_MESSAGE_ALERT: - { - message = GREETING_MESSAGE_ALERT_STRING; - type = GREETING_MESSAGE_ALERT_TYPE; - - break; - } - case START_RESUME_SESSION_ALERT: - { - message = START_RESUME_SESSION_ALERT_STRING; - type = START_RESUME_SESSION_ALERT_TYPE; - - break; - } - case FAILED_RESUME_DISPLAY_ALERT: - { - message = FAILED_RESUME_DISPLAY_ALERT_STRING; - type = FAILED_RESUME_DISPLAY_ALERT_TYPE; - - break; - } - case FAILED_RESUME_DISPLAY_BROKEN_ALERT: - { - message = FAILED_RESUME_DISPLAY_BROKEN_STRING; - type = FAILED_RESUME_DISPLAY_BROKEN_TYPE; - - break; - } - case FAILED_RESUME_VISUALS_ALERT: - { - message = FAILED_RESUME_VISUALS_ALERT_STRING; - type = FAILED_RESUME_VISUALS_ALERT_TYPE; - - break; - } - case FAILED_RESUME_COLORMAPS_ALERT: - { - message = FAILED_RESUME_COLORMAPS_ALERT_STRING; - type = FAILED_RESUME_COLORMAPS_ALERT_TYPE; - - break; - } - case FAILED_RESUME_PIXMAPS_ALERT: - { - message = FAILED_RESUME_PIXMAPS_ALERT_STRING; - type = FAILED_RESUME_PIXMAPS_ALERT_TYPE; - - break; - } - case FAILED_RESUME_DEPTHS_ALERT: - { - message = FAILED_RESUME_DEPTHS_ALERT_STRING; - type = FAILED_RESUME_DEPTHS_ALERT_TYPE; - - break; - } - case FAILED_RESUME_RENDER_ALERT: - { - message = FAILED_RESUME_RENDER_ALERT_STRING; - type = FAILED_RESUME_RENDER_ALERT_TYPE; - - break; - } - case FAILED_RESUME_FONTS_ALERT: - { - message = FAILED_RESUME_FONTS_ALERT_STRING; - type = FAILED_RESUME_FONTS_ALERT_TYPE; - - break; - } - case INTERNAL_ERROR_ALERT: - { - message = INTERNAL_ERROR_ALERT_STRING; - type = INTERNAL_ERROR_ALERT_TYPE; - - break; - } - case ABORT_PROXY_NEGOTIATION_ALERT: - { - message = ABORT_PROXY_NEGOTIATION_ALERT_STRING; - type = ABORT_PROXY_NEGOTIATION_ALERT_TYPE; - - break; - } - case ABORT_PROXY_SHUTDOWN_ALERT: - { - message = ABORT_PROXY_SHUTDOWN_ALERT_STRING; - type = ABORT_PROXY_SHUTDOWN_ALERT_TYPE; - - break; - } - case FAILED_XDMCP_CONNECTION_ALERT: - { - message = FAILED_XDMCP_CONNECTION_ALERT_STRING; - type = FAILED_XDMCP_CONNECTION_ALERT_TYPE; - - break; - } - default: - { - if (lastAlert.code > LAST_PROTO_STEP_7_ALERT) - { - #ifdef WARNING - *logofs << "Loop: WARNING! An unrecognized alert type '" - << lastAlert.code << "' was requested.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": An unrecognized alert type '" - << lastAlert.code << "' was requested.\n"; - } - #ifdef WARNING - else - { - *logofs << "Loop: WARNING! Ignoring obsolete alert type '" - << lastAlert.code << "'.\n" << logofs_flush; - } - #endif - - message = NULL; - type = NULL; - - replace = 0; - - break; - } - } - - if (replace == 1 && IsRunning(lastDialog)) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Killing the previous dialog with pid '" - << lastDialog << "'.\n" << logofs_flush; - #endif - - // - // The client ignores the TERM signal - // on Windows. - // - - #ifdef __CYGWIN32__ - - KillProcess(lastDialog, "dialog", SIGKILL, 0); - - #else - - KillProcess(lastDialog, "dialog", SIGTERM, 0); - - #endif - - SetNotRunning(lastDialog); - - if (proxy != NULL) - { - proxy -> handleResetAlert(); - } - } - - if (message != NULL && type != NULL) - { - lastDialog = NXTransDialog(caption, message, 0, type, local, display); - - if (IsFailed(lastDialog)) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Can't start the NX dialog process.\n" - << logofs_flush; - #endif - - SetNotRunning(lastDialog); - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "Loop: Dialog started with pid '" - << lastDialog << "'.\n" << logofs_flush; - } - #endif - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "Loop: No new dialog required for code '" - << lastAlert.code << "'.\n" << logofs_flush; - } - #endif - } - } - - // - // Reset state. - // - - lastAlert.code = 0; - lastAlert.local = 0; -} - -static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs) -{ - #ifdef TEST - *logofs << "Loop: Preparing the masks for the agent descriptors.\n" - << logofs_flush; - #endif - - agent -> saveChannelState(); - - agent -> saveReadMask(&readSet); - agent -> saveWriteMask(&writeSet); - - if (control -> ProxyStage >= stage_operational) - { - if (agent -> remoteCanRead(&readSet) || - agent -> remoteCanWrite(&writeSet) || - agent -> localCanRead() || - agent -> proxyCanRead()) - { - #ifdef TEST - *logofs << "Loop: Setting a null timeout with agent descriptors ready.\n" - << logofs_flush; - #endif - - // - // Force a null timeout so we'll bail out - // of the select immediately. We will ac- - // comodate the result code later. - // - - selectTs.tv_sec = 0; - selectTs.tv_usec = 0; - } - } - - #ifdef TEST - *logofs << "Loop: Clearing the read and write agent descriptors.\n" - << logofs_flush; - #endif - - agent -> clearReadMask(&readSet); - agent -> clearWriteMask(&writeSet); -} - -static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Setting proxy and local agent descriptors.\n" - << logofs_flush; - #endif - - // - // Check if I/O is possible on the local - // agent or the proxy descriptor. - // - - if (resultFDs >= 0) - { - // - // Save if the proxy can read from the - // the agent descriptor. - // - - agent -> saveChannelState(); - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Values were resultFDs " << resultFDs - << " errorFDs " << errorFDs << " setFDs " - << setFDs << ".\n" << logofs_flush; - #endif - - if (agent -> localCanRead() == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Setting agent descriptor FD#" << agent -> - getLocalFd() << " as ready to read.\n" - << logofs_flush; - #endif - - agent -> setLocalRead(&readSet, &resultFDs); - } - - #if defined(TEST) || defined(INFO) - - if (agent -> proxyCanRead(&readSet) == 0 && - agent -> proxyCanRead() == 1) - { - *logofs << "Loop: WARNING! Can read from proxy FD#" - << proxyFD << " but the descriptor " - << "is not selected.\n" << logofs_flush; - } - - if (agent -> proxyCanRead(&readSet) == 1) - { - *logofs << "Loop: Setting proxy descriptor FD#" << agent -> - getProxyFd() << " as ready to read.\n" - << logofs_flush; - } - - #endif - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Values are now resultFDs " << resultFDs - << " errorFDs " << errorFDs << " setFDs " - << setFDs << ".\n" << logofs_flush; - #endif - } -} - -static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, - fd_set &writeSet, struct timeval &selectTs) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Setting remote agent descriptors.\n" - << logofs_flush; - #endif - - // - // We reset the masks before calling our select. - // We now set the descriptors that are ready but - // only if they were set in the original mask. - // We do this after having executed our loop as - // we may have produced more data and the agent - // descriptors may have become readable or writ- - // able in the meanwhile. - // - - if (resultFDs >= 0) - { - // - // Save if the proxy can read from the - // the agent descriptor. - // - - agent -> saveChannelState(); - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Values were resultFDs " << resultFDs - << " errorFDs " << errorFDs << " setFDs " - << setFDs << ".\n" << logofs_flush; - #endif - - if (agent -> remoteCanRead(agent -> - getSavedReadMask()) == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Setting agent descriptor FD#" << agent -> - getRemoteFd() << " as ready to read.\n" - << logofs_flush; - #endif - - agent -> setRemoteRead(&readSet, &resultFDs); - } - - if (agent -> remoteCanWrite(agent -> - getSavedWriteMask()) == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Setting agent descriptor FD#" << agent -> - getRemoteFd() << " as ready to write.\n" - << logofs_flush; - #endif - - agent -> setRemoteWrite(&writeSet, &resultFDs); - } - - #if defined(TEST) || defined(INFO) - *logofs << "Loop: Values are now resultFDs " << resultFDs - << " errorFDs " << errorFDs << " setFDs " - << setFDs << ".\n" << logofs_flush; - #endif - } -} - -static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet) -{ - if (resultFDs > 0) - { - T_channel_type type = channel_none; - - const char *label = NULL; - int domain = -1; - int fd = -1; - - if (tcpFD != -1 && FD_ISSET(tcpFD, &readSet)) - { - type = channel_x11; - label = "X"; - domain = AF_INET; - fd = tcpFD; - - resultFDs--; - } - - if (unixFD != -1 && FD_ISSET(unixFD, &readSet)) - { - type = channel_x11; - label = "X"; - domain = AF_UNIX; - fd = unixFD; - - resultFDs--; - } - - if (cupsFD != -1 && FD_ISSET(cupsFD, &readSet)) - { - type = channel_cups; - label = "CUPS"; - domain = AF_INET; - fd = cupsFD; - - resultFDs--; - } - - if (auxFD != -1 && FD_ISSET(auxFD, &readSet)) - { - // - // Starting from version 1.5.0 we create real X - // connections for the keyboard channel, so they - // can use the fake authorization cookie. This - // means that there is not such a thing like a - // channel_aux anymore. - // - - type = channel_x11; - label = "auxiliary X11"; - domain = AF_INET; - fd = auxFD; - - resultFDs--; - } - - if (smbFD != -1 && FD_ISSET(smbFD, &readSet)) - { - type = channel_smb; - label = "SMB"; - domain = AF_INET; - fd = smbFD; - - resultFDs--; - } - - if (mediaFD != -1 && FD_ISSET(mediaFD, &readSet)) - { - type = channel_media; - label = "media"; - domain = AF_INET; - fd = mediaFD; - - resultFDs--; - } - - if (httpFD != -1 && FD_ISSET(httpFD, &readSet)) - { - type = channel_http; - label = "HTTP"; - domain = AF_INET; - fd = httpFD; - - resultFDs--; - } - - if (fontFD != -1 && FD_ISSET(fontFD, &readSet)) - { - type = channel_font; - label = "font server"; - domain = AF_INET; - fd = fontFD; - - resultFDs--; - } - - if (slaveFD != -1 && FD_ISSET(slaveFD, &readSet)) - { - type = channel_slave; - label = "slave"; - domain = AF_INET; - fd = slaveFD; - - resultFDs--; - } - - if (type != channel_none) - { - int newFD = AcceptConnection(fd, domain, label); - - if (newFD != -1) - { - if (proxy -> handleNewConnection(type, newFD) < 0) - { - #ifdef PANIC - *logofs << "Loop: PANIC! Error creating new " << label - << " connection.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Error creating new " << label - << " connection.\n"; - - close(newFD); - - // - // Don't kill the proxy in the case of an error. - // - // HandleCleanup(); - // - } - else if (proxy -> getReadable(newFD) > 0) - { - // - // Add the descriptor, so we can try - // to read immediately. - // - - #ifdef TEST - *logofs << "Loop: Trying to read immediately " - << "from descriptor FD#" << newFD - << ".\n" << logofs_flush; - #endif - - FD_SET(newFD, &readSet); - - resultFDs++; - } - #ifdef TEST - else - { - *logofs << "Loop: Nothing to read immediately " - << "from descriptor FD#" << newFD - << ".\n" << logofs_flush; - } - #endif - } - } - } - - #ifdef DEBUG - *logofs << "Loop: Going to check the readable descriptors.\n" - << logofs_flush; - #endif - - if (proxy -> handleRead(resultFDs, readSet) < 0) - { - #ifdef TEST - *logofs << "Loop: Failure reading from descriptors " - << "for proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - HandleShutdown(); - } -} - -static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet) -{ - #ifdef DEBUG - *logofs << "Loop: Going to check the writable descriptors.\n" - << logofs_flush; - #endif - - if (resultFDs > 0 && proxy -> handleFlush(resultFDs, writeSet) < 0) - { - #ifdef TEST - *logofs << "Loop: Failure writing to descriptors " - << "for proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - HandleShutdown(); - } -} - -static inline void handleFlushInLoop() -{ - #ifdef DEBUG - *logofs << "Loop: Going to flush any data to the proxy.\n" - << logofs_flush; - #endif - - if (agent == NULL || control -> - FlushPolicy == policy_immediate) - { - #if defined(TEST) || defined(INFO) - - if (usePolicy == -1 && control -> - ProxyMode == proxy_client) - { - *logofs << "Loop: WARNING! Flushing the proxy link " - << "on behalf of the agent.\n" << logofs_flush; - } - - #endif - - if (proxy -> handleFlush() < 0) - { - #ifdef TEST - *logofs << "Loop: Failure flushing the proxy FD#" - << proxyFD << ".\n" << logofs_flush; - #endif - - HandleShutdown(); - } - } -} - -static inline void handleRotateInLoop() -{ - #ifdef DEBUG - *logofs << "Loop: Going to rotate channels " - << "for proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - proxy -> handleRotate(); -} - -static inline void handleEventsInLoop() -{ - #ifdef DEBUG - *logofs << "Loop: Going to check channel events " - << "for proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - if (proxy -> handleEvents() < 0) - { - #ifdef TEST - *logofs << "Loop: Failure handling channel events " - << "for proxy FD#" << proxyFD << ".\n" - << logofs_flush; - #endif - - HandleShutdown(); - } -} - -static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs) -{ - // - // If need to limit the size of the - // log file, check the size at each - // loop. - // - - #ifndef QUOTA - - if (diffTimestamp(logsTs, nowTs) > control -> FileSizeCheckTimeout) - - #endif - { - #ifdef DEBUG - *logofs << "Loop: Checking size of log file '" - << errorsFileName << "'.\n" << logofs_flush; - #endif - - #ifndef MIXED - - if (ReopenLogFile(errorsFileName, logofs, control -> FileSizeLimit) < 0) - { - HandleShutdown(); - } - - #endif - - // - // Reset to current timestamp. - // - - logsTs = nowTs; - } -} - -static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs) -{ - proxy -> setReadDescriptors(&readSet, setFDs, selectTs); -} - -static inline void handleSetWriteInLoop(fd_set &writeSet, int &setFDs, struct timeval &selectTs) -{ - proxy -> setWriteDescriptors(&writeSet, setFDs, selectTs); -} - -static void handleSetListenersInLoop(fd_set &readSet, int &setFDs) -{ - // - // Set descriptors of listening sockets. - // - - if (control -> ProxyMode == proxy_client) - { - if (useTcpSocket == 1) - { - FD_SET(tcpFD, &readSet); - - if (tcpFD >= setFDs) - { - setFDs = tcpFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener tcpFD " << tcpFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - - if (useUnixSocket == 1) - { - FD_SET(unixFD, &readSet); - - if (unixFD >= setFDs) - { - setFDs = unixFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener unixFD " << unixFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - - if (useCupsSocket == 1) - { - FD_SET(cupsFD, &readSet); - - if (cupsFD >= setFDs) - { - setFDs = cupsFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener cupsFD " << cupsFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - - if (useAuxSocket == 1) - { - FD_SET(auxFD, &readSet); - - if (auxFD >= setFDs) - { - setFDs = auxFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener auxFD " << auxFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - - if (useSmbSocket == 1) - { - FD_SET(smbFD, &readSet); - - if (smbFD >= setFDs) - { - setFDs = smbFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener smbFD " << smbFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - - if (useMediaSocket == 1) - { - FD_SET(mediaFD, &readSet); - - if (mediaFD >= setFDs) - { - setFDs = mediaFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener mediaFD " << mediaFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - - if (useHttpSocket == 1) - { - FD_SET(httpFD, &readSet); - - if (httpFD >= setFDs) - { - setFDs = httpFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener httpFD " << httpFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - } - else - { - if (useFontSocket == 1) - { - FD_SET(fontFD, &readSet); - - if (fontFD >= setFDs) - { - setFDs = fontFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener fontFD " << fontFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } - } - - if (useSlaveSocket == 1) - { - FD_SET(slaveFD, &readSet); - - if (slaveFD >= setFDs) - { - setFDs = slaveFD + 1; - } - - #ifdef DEBUG - *logofs << "Loop: Selected listener slaveFD " << slaveFD - << " with setFDs " << setFDs << ".\n" - << logofs_flush; - #endif - } -} diff --git a/nxcomp/MD5.c b/nxcomp/MD5.c deleted file mode 100644 index e49d3cf58..000000000 --- a/nxcomp/MD5.c +++ /dev/null @@ -1,399 +0,0 @@ -/* - Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.c is L. Peter Deutsch - . Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order - either statically or dynamically; added missing #include - in library. - 2002-03-11 lpd Corrected argument list for main(), and added int return - type, in test program and T value program. - 2002-02-21 lpd Added missing #include in test program. - 2000-07-03 lpd Patched to eliminate warnings about "constant is - unsigned in ANSI C, signed in traditional"; made test program - self-checking. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). - 1999-05-03 lpd Original version. - */ - -#include "MD5.h" - -#include - -/* - * Try to determine the CPU endianess - * at compile time. - */ - -#if defined(__linux) || defined(__CYGWIN32__) - -#include - -#if (__BYTE_ORDER == __LITTLE_ENDIAN) -#define ARCH_IS_BIG_ENDIAN 0 -#else -#define ARCH_IS_BIG_ENDIAN 1 -#endif - -#endif /* #if defined(__linux) || defined(__CYGWIN32__) */ - -#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ -#ifdef ARCH_IS_BIG_ENDIAN -# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) -#else -# define BYTE_ORDER 0 -#endif - -#define T_MASK ((md5_word_t)~0) -#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) -#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) -#define T3 0x242070db -#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) -#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) -#define T6 0x4787c62a -#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) -#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) -#define T9 0x698098d8 -#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) -#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) -#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) -#define T13 0x6b901122 -#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) -#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) -#define T16 0x49b40821 -#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) -#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) -#define T19 0x265e5a51 -#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) -#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) -#define T22 0x02441453 -#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) -#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) -#define T25 0x21e1cde6 -#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) -#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) -#define T28 0x455a14ed -#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) -#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) -#define T31 0x676f02d9 -#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) -#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) -#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) -#define T35 0x6d9d6122 -#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) -#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) -#define T38 0x4bdecfa9 -#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) -#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) -#define T41 0x289b7ec6 -#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) -#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) -#define T44 0x04881d05 -#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) -#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) -#define T47 0x1fa27cf8 -#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) -#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) -#define T50 0x432aff97 -#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) -#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) -#define T53 0x655b59c3 -#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) -#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) -#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) -#define T57 0x6fa87e4f -#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) -#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) -#define T60 0x4e0811a1 -#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) -#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) -#define T63 0x2ad7d2bb -#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) - - -static void -md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) -{ - md5_word_t - a = pms->abcd[0], b = pms->abcd[1], - c = pms->abcd[2], d = pms->abcd[3]; - md5_word_t t; -#if BYTE_ORDER > 0 - /* Define storage only for big-endian CPUs. */ - md5_word_t X[16]; -#else - /* Define storage for little-endian or both types of CPUs. */ - md5_word_t xbuf[16]; - const md5_word_t *X; -#endif - - { -#if BYTE_ORDER == 0 - /* - * Determine dynamically whether this is a big-endian or - * little-endian machine, since we can use a more efficient - * algorithm on the latter. - */ - static const int w = 1; - - if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ -#endif -#if BYTE_ORDER <= 0 /* little-endian */ - { - /* - * On little-endian machines, we can process properly aligned - * data without copying it. - */ - if (!((data - (const md5_byte_t *)0) & 3)) { - /* data are properly aligned */ - X = (const md5_word_t *)data; - } else { - /* not aligned */ - memcpy(xbuf, data, 64); - X = xbuf; - } - } -#endif -#if BYTE_ORDER == 0 - else /* dynamic big-endian */ -#endif -#if BYTE_ORDER >= 0 /* big-endian */ - { - /* - * On big-endian machines, we must arrange the bytes in the - * right order. - */ - const md5_byte_t *xp = data; - int i; - -# if BYTE_ORDER == 0 - X = xbuf; /* (dynamic only) */ -# else -# define xbuf X /* (static only) */ -# endif - for (i = 0; i < 16; ++i, xp += 4) - xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); - } -#endif - } - -#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) - - /* Round 1. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ -#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + F(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 7, T1); - SET(d, a, b, c, 1, 12, T2); - SET(c, d, a, b, 2, 17, T3); - SET(b, c, d, a, 3, 22, T4); - SET(a, b, c, d, 4, 7, T5); - SET(d, a, b, c, 5, 12, T6); - SET(c, d, a, b, 6, 17, T7); - SET(b, c, d, a, 7, 22, T8); - SET(a, b, c, d, 8, 7, T9); - SET(d, a, b, c, 9, 12, T10); - SET(c, d, a, b, 10, 17, T11); - SET(b, c, d, a, 11, 22, T12); - SET(a, b, c, d, 12, 7, T13); - SET(d, a, b, c, 13, 12, T14); - SET(c, d, a, b, 14, 17, T15); - SET(b, c, d, a, 15, 22, T16); -#undef SET - - /* Round 2. */ - /* Let [abcd k s i] denote the operation - a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ -#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + G(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 1, 5, T17); - SET(d, a, b, c, 6, 9, T18); - SET(c, d, a, b, 11, 14, T19); - SET(b, c, d, a, 0, 20, T20); - SET(a, b, c, d, 5, 5, T21); - SET(d, a, b, c, 10, 9, T22); - SET(c, d, a, b, 15, 14, T23); - SET(b, c, d, a, 4, 20, T24); - SET(a, b, c, d, 9, 5, T25); - SET(d, a, b, c, 14, 9, T26); - SET(c, d, a, b, 3, 14, T27); - SET(b, c, d, a, 8, 20, T28); - SET(a, b, c, d, 13, 5, T29); - SET(d, a, b, c, 2, 9, T30); - SET(c, d, a, b, 7, 14, T31); - SET(b, c, d, a, 12, 20, T32); -#undef SET - - /* Round 3. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ -#define H(x, y, z) ((x) ^ (y) ^ (z)) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + H(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 5, 4, T33); - SET(d, a, b, c, 8, 11, T34); - SET(c, d, a, b, 11, 16, T35); - SET(b, c, d, a, 14, 23, T36); - SET(a, b, c, d, 1, 4, T37); - SET(d, a, b, c, 4, 11, T38); - SET(c, d, a, b, 7, 16, T39); - SET(b, c, d, a, 10, 23, T40); - SET(a, b, c, d, 13, 4, T41); - SET(d, a, b, c, 0, 11, T42); - SET(c, d, a, b, 3, 16, T43); - SET(b, c, d, a, 6, 23, T44); - SET(a, b, c, d, 9, 4, T45); - SET(d, a, b, c, 12, 11, T46); - SET(c, d, a, b, 15, 16, T47); - SET(b, c, d, a, 2, 23, T48); -#undef SET - - /* Round 4. */ - /* Let [abcd k s t] denote the operation - a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ -#define I(x, y, z) ((y) ^ ((x) | ~(z))) -#define SET(a, b, c, d, k, s, Ti)\ - t = a + I(b,c,d) + X[k] + Ti;\ - a = ROTATE_LEFT(t, s) + b - /* Do the following 16 operations. */ - SET(a, b, c, d, 0, 6, T49); - SET(d, a, b, c, 7, 10, T50); - SET(c, d, a, b, 14, 15, T51); - SET(b, c, d, a, 5, 21, T52); - SET(a, b, c, d, 12, 6, T53); - SET(d, a, b, c, 3, 10, T54); - SET(c, d, a, b, 10, 15, T55); - SET(b, c, d, a, 1, 21, T56); - SET(a, b, c, d, 8, 6, T57); - SET(d, a, b, c, 15, 10, T58); - SET(c, d, a, b, 6, 15, T59); - SET(b, c, d, a, 13, 21, T60); - SET(a, b, c, d, 4, 6, T61); - SET(d, a, b, c, 11, 10, T62); - SET(c, d, a, b, 2, 15, T63); - SET(b, c, d, a, 9, 21, T64); -#undef SET - - /* Then perform the following additions. (That is increment each - of the four registers by the value it had before this block - was started.) */ - pms->abcd[0] += a; - pms->abcd[1] += b; - pms->abcd[2] += c; - pms->abcd[3] += d; -} - -void -md5_init(md5_state_t *pms) -{ - pms->count[0] = pms->count[1] = 0; - pms->abcd[0] = 0x67452301; - pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; - pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; - pms->abcd[3] = 0x10325476; -} - -void -md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) -{ - const md5_byte_t *p = data; - int left = nbytes; - int offset = (pms->count[0] >> 3) & 63; - md5_word_t nbits = (md5_word_t)(nbytes << 3); - - if (nbytes <= 0) - return; - - /* Update the message length. */ - pms->count[1] += nbytes >> 29; - pms->count[0] += nbits; - if (pms->count[0] < nbits) - pms->count[1]++; - - /* Process an initial partial block. */ - if (offset) { - int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); - - memcpy(pms->buf + offset, p, copy); - if (offset + copy < 64) - return; - p += copy; - left -= copy; - md5_process(pms, pms->buf); - } - - /* Process full blocks. */ - for (; left >= 64; p += 64, left -= 64) - md5_process(pms, p); - - /* Process a final partial block. */ - if (left) - memcpy(pms->buf, p, left); -} - -void -md5_finish(md5_state_t *pms, md5_byte_t digest[16]) -{ - static const md5_byte_t pad[64] = { - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 - }; - md5_byte_t data[8]; - int i; - - /* Save the length before padding. */ - for (i = 0; i < 8; ++i) - data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); - /* Pad to 56 bytes mod 64. */ - md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); - /* Append the length. */ - md5_append(pms, data, 8); - for (i = 0; i < 16; ++i) - digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); -} diff --git a/nxcomp/MD5.h b/nxcomp/MD5.h deleted file mode 100644 index 698c995d8..000000000 --- a/nxcomp/MD5.h +++ /dev/null @@ -1,91 +0,0 @@ -/* - Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. - - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any damages - arising from the use of this software. - - Permission is granted to anyone to use this software for any purpose, - including commercial applications, and to alter it and redistribute it - freely, subject to the following restrictions: - - 1. The origin of this software must not be misrepresented; you must not - claim that you wrote the original software. If you use this software - in a product, an acknowledgment in the product documentation would be - appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and must not be - misrepresented as being the original software. - 3. This notice may not be removed or altered from any source distribution. - - L. Peter Deutsch - ghost@aladdin.com - - */ -/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */ -/* - Independent implementation of MD5 (RFC 1321). - - This code implements the MD5 Algorithm defined in RFC 1321, whose - text is available at - http://www.ietf.org/rfc/rfc1321.txt - The code is derived from the text of the RFC, including the test suite - (section A.5) but excluding the rest of Appendix A. It does not include - any code or documentation that is identified in the RFC as being - copyrighted. - - The original and principal author of md5.h is L. Peter Deutsch - . Other authors are noted in the change history - that follows (in reverse chronological order): - - 2002-04-13 lpd Removed support for non-ANSI compilers; removed - references to Ghostscript; clarified derivation from RFC 1321; - now handles byte order either statically or dynamically. - 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. - 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); - added conditionalization for C++ compilation from Martin - Purschke . - 1999-05-03 lpd Original version. - */ - -#ifndef md5_INCLUDED -# define md5_INCLUDED - -/* - * This package supports both compile-time and run-time determination of CPU - * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be - * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is - * defined as non-zero, the code will be compiled to run only on big-endian - * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to - * run on either big- or little-endian CPUs, but will run slightly less - * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. - */ - -typedef unsigned char md5_byte_t; /* 8-bit byte */ -typedef unsigned int md5_word_t; /* 32-bit word */ - -/* Define the state of the MD5 Algorithm. */ -typedef struct md5_state_s { - md5_word_t count[2]; /* message length in bits, lsw first */ - md5_word_t abcd[4]; /* digest buffer */ - md5_byte_t buf[64]; /* accumulate block */ -} md5_state_t; - -#ifdef __cplusplus -extern "C" -{ -#endif - -/* Initialize the algorithm. */ -void md5_init(md5_state_t *pms); - -/* Append a string to the message. */ -void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); - -/* Finish the message and return the digest. */ -void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); - -#ifdef __cplusplus -} /* end extern "C" */ -#endif - -#endif /* md5_INCLUDED */ diff --git a/nxcomp/Makefile.am b/nxcomp/Makefile.am new file mode 100644 index 000000000..ae5991c3d --- /dev/null +++ b/nxcomp/Makefile.am @@ -0,0 +1,21 @@ +SUBDIRS = src + +pkgconfig_DATA = nxcomp.pc + +MAINTAINERCLEANFILES = \ + $(srcdir)/autom4te.cache/* \ + $(srcdir)/build-aux/* \ + $(srcdir)/Makefile.in \ + $(srcdir)/src/Makefile.in \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/config.h.in \ + $(srcdir)/config.h.in~ \ + $(srcdir)/configure \ + $(srcdir)/m4/libtool.m4 \ + $(srcdir)/m4/lt~obsolete.m4 \ + $(srcdir)/m4/ltoptions.m4 \ + $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ + $(NULL) + +DISTCLEANFILES=$(MAINTAINERCLEANFILES) diff --git a/nxcomp/Makefile.in b/nxcomp/Makefile.in deleted file mode 100644 index f18875524..000000000 --- a/nxcomp/Makefile.in +++ /dev/null @@ -1,333 +0,0 @@ -#/**************************************************************************/ -#/* */ -#/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -#/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -#/* Copyright (c) 2014-2016 Ulrich Sibiller */ -#/* Copyright (c) 2014-2016 Mihai Moldovan */ -#/* Copyright (c) 2011-2016 Mike Gabriel */ -#/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -#/* */ -#/* NXCOMP, NX protocol compression and NX extensions to this software */ -#/* are copyright of the aforementioned persons and companies. */ -#/* */ -#/* Redistribution and use of the present software is allowed according */ -#/* to terms specified in the file LICENSE.nxcomp which comes in the */ -#/* source distribution. */ -#/* */ -#/* All rights reserved. */ -#/* */ -#/* NOTE: This software has received contributions from various other */ -#/* contributors, only the core maintainers and supporters are listed as */ -#/* copyright holders. Please contact us, if you feel you should be listed */ -#/* as copyright holder, as well. */ -#/* */ -#/**************************************************************************/ - -# -# Get these values from the configure script. The -# version printed by the program should be derived -# from the CHANGELOG. For example we may use the -# following command: -# -# head -n 3 CHANGELOG | grep 'nxcomp-' | cut -d '-' -f 2-3 -# - -VERSION=@VERSION@ -LIBVERSION=@LIBVERSION@ - -# -# We would really like to enable all warnings, -Wredundant-decls, -# though, gives a warning caused by pthread.h and unistd.h and -# GCC 3.4 was changed in a way that it now complains about some -# of the -W directives we used before (-Wmissing-declarations, -# -Wnested-externs, -Wstrict-prototypes and -Wmissing-prototypes). -# - -CXX = @CXX@ -CXXFLAGS = @CXXFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -CXXINCLUDES = -CXXDEFINES = - -CPPFLAGS = @CPPFLAGS@ - -# -# C programs have their own CFLAGS. -# - -CC = @CC@ -CCFLAGS = @CFLAGS@ @X_CFLAGS@ @DEFS@ \ - -Wall -Wpointer-arith -CCINCLUDES = -CCDEFINES = - -LDFLAGS = @LDFLAGS@ -LIBS = @LIBS@ - -# -# Other autoconfigured settings, not used at the moment. -# - -srcdir = @srcdir@ -prefix = @prefix@ -datarootdir = @datarootdir@ -datadir = @datadir@ -exec_prefix = @exec_prefix@ -bindir = @bindir@ -man1dir = @mandir@/man1 -VPATH = @srcdir@ -libdir = @libdir@ -includedir = @includedir@ -pkgconfigdir = @pkgconfigdir@ - -INSTALL = @INSTALL@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_LINK = cp -av -DESTDIR = -RM_FILE = rm -f - -# -# This should be autodetected. -# - -MAKEDEPEND = @MAKEDEPEND@ -DEPENDINCLUDES = -I/usr/include/c++ -I/usr/include/g++ -I/usr/include/g++-3 - -.SUFFIXES: .cpp.c - -.cpp.o: - $(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $(CXXINCLUDES) $(CXXDEFINES) $< -.c.o: - $(CC) -c $(CPPFLAGS) $(CCFLAGS) $(CCINCLUDES) $(CCDEFINES) $< - -LIBRARY = Xcomp - -LIBNAME = lib$(LIBRARY) -ifeq ($(shell uname),Darwin) -LIBFULL = lib$(LIBRARY).$(VERSION).dylib -LIBLOAD = lib$(LIBRARY).$(LIBVERSION).dylib -LIBSHARED = lib$(LIBRARY).dylib -COMP_VER = $(shell echo '$(VERSION)' | cut -d '.' -f 1-3) -LIBFLAGS = -install_name $(libdir)/$(LIBLOAD) -compatibility_version $(LIBVERSION) -current_version $(COMP_VER) -else -LIBFULL = lib$(LIBRARY).so.$(VERSION) -LIBLOAD = lib$(LIBRARY).so.$(LIBVERSION) -LIBSHARED = lib$(LIBRARY).so -LIBFLAGS = -endif -LIBARCHIVE = lib$(LIBRARY).a - -LIBCYGSHARED = cyg$(LIBRARY).dll -LIBCYGARCHIVE = lib$(LIBRARY).dll.a - -all: depend @ALL@ - -MSRC = - -CSRC = MD5.c \ - Pack.c \ - Vars.c \ - Version.c - -CXXSRC = Loop.cpp \ - Children.cpp \ - Control.cpp \ - Misc.cpp \ - Socket.cpp \ - Fork.cpp \ - Pipe.cpp \ - List.cpp \ - Keeper.cpp \ - Timestamp.cpp \ - Transport.cpp \ - Statistics.cpp \ - Auth.cpp \ - Agent.cpp \ - Proxy.cpp \ - Channel.cpp \ - Message.cpp \ - Split.cpp \ - ClientProxy.cpp \ - ServerProxy.cpp \ - OpcodeStore.cpp \ - ClientStore.cpp \ - ServerStore.cpp \ - ChannelCache.cpp \ - ClientCache.cpp \ - ServerCache.cpp \ - ClientChannel.cpp \ - ServerChannel.cpp \ - GenericChannel.cpp \ - ChannelEndPoint.cpp \ - ReadBuffer.cpp \ - ProxyReadBuffer.cpp \ - ClientReadBuffer.cpp \ - ServerReadBuffer.cpp \ - GenericReadBuffer.cpp \ - EncodeBuffer.cpp \ - DecodeBuffer.cpp \ - WriteBuffer.cpp \ - SequenceQueue.cpp \ - IntCache.cpp \ - CharCache.cpp \ - XidCache.cpp \ - ActionCache.cpp \ - BlockCache.cpp \ - BlockCacheSet.cpp \ - StaticCompressor.cpp \ - Unpack.cpp \ - Alpha.cpp \ - Colormap.cpp \ - Jpeg.cpp \ - Pgn.cpp \ - Bitmap.cpp \ - Rgb.cpp \ - Rle.cpp \ - Z.cpp \ - ChangeProperty.cpp \ - SendEvent.cpp \ - ChangeGC.cpp \ - CreateGC.cpp \ - CreatePixmap.cpp \ - SetClipRectangles.cpp \ - CopyArea.cpp \ - PolyLine.cpp \ - PolySegment.cpp \ - PolyFillRectangle.cpp \ - PutImage.cpp \ - TranslateCoords.cpp \ - GetImage.cpp \ - ClearArea.cpp \ - ConfigureWindow.cpp \ - PolyText8.cpp \ - PolyText16.cpp \ - ImageText8.cpp \ - ImageText16.cpp \ - PolyPoint.cpp \ - PolyFillArc.cpp \ - PolyArc.cpp \ - FillPoly.cpp \ - InternAtom.cpp \ - GetProperty.cpp \ - SetUnpackGeometry.cpp \ - SetUnpackColormap.cpp \ - SetUnpackAlpha.cpp \ - PutPackedImage.cpp \ - ShapeExtension.cpp \ - RenderExtension.cpp \ - GenericRequest.cpp \ - QueryFontReply.cpp \ - ListFontsReply.cpp \ - GetImageReply.cpp \ - GetPropertyReply.cpp \ - GenericReply.cpp \ - RenderGenericRequest.cpp \ - RenderCreatePicture.cpp \ - RenderChangePicture.cpp \ - RenderFreePicture.cpp \ - RenderPictureClip.cpp \ - RenderPictureTransform.cpp \ - RenderPictureFilter.cpp \ - RenderCreateGlyphSet.cpp \ - RenderFreeGlyphSet.cpp \ - RenderAddGlyphs.cpp \ - RenderComposite.cpp \ - RenderCompositeGlyphs.cpp \ - RenderFillRectangles.cpp \ - RenderTrapezoids.cpp \ - RenderTriangles.cpp - -MOBJ = $(MSRC:.c=.o) -COBJ = $(CSRC:.c=.o) -CXXOBJ = $(CXXSRC:.cpp=.o) - -$(LIBFULL): $(CXXOBJ) $(COBJ) - $(CXX) -o $@ $(LDFLAGS) $(LIBFLAGS) $(CXXOBJ) $(COBJ) $(LIBS) - -$(LIBLOAD): $(LIBFULL) - rm -f $(LIBLOAD) - ln -s $(LIBFULL) $(LIBLOAD) - -$(LIBSHARED): $(LIBFULL) - rm -f $(LIBSHARED) - ln -s $(LIBFULL) $(LIBSHARED) - -$(LIBARCHIVE): $(CXXOBJ) $(COBJ) - rm -f $(LIBARCHIVE) - ar clq $(LIBARCHIVE) $(CXXOBJ) $(COBJ) - ranlib $(LIBARCHIVE) - -$(LIBCYGSHARED): $(LIBARCHIVE) - $(CC) -shared -o $(LIBCYGSHARED) \ - -Wl,--out-implib=$(LIBCYGARCHIVE) \ - -Wl,--export-all-symbols \ - -Wl,--enable-auto-import \ - -Wl,--whole-archive $(LIBARCHIVE) \ - -Wl,--no-whole-archive $(LIBS) \ - $(LDFLAGS) - -$(LIBCYGARCHIVE): $(LIBCYGSHARED) - -depends: depend.status - -depend: depend.status - -depend.status: - if [ -n "$(MAKEDEPEND)" ] && [ -x "$(MAKEDEPEND)" ] ; then \ - $(MAKEDEPEND) $(CXXINCLUDES) $(CCINCLUDES) \ - $(DEPENDINCLUDES) -f Makefile $(MSRC) $(CSRC) \ - $(CXXSRC) 2>/dev/null; \ - fi - touch depend.status - -install: install.bin install.lib install.man - -install.bin: - -install.lib: all - ./mkinstalldirs $(DESTDIR)${libdir} - ./mkinstalldirs $(DESTDIR)${includedir}/nx - ./mkinstalldirs $(DESTDIR)${pkgconfigdir} - $(INSTALL_DATA) $(LIBFULL) $(DESTDIR)${libdir} - $(INSTALL_LINK) $(LIBLOAD) $(DESTDIR)${libdir} - $(INSTALL_LINK) $(LIBSHARED) $(DESTDIR)${libdir} - $(INSTALL_DATA) $(LIBARCHIVE) $(DESTDIR)${libdir} - $(INSTALL_DATA) MD5.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) NX.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) NXalert.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) NXpack.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) NXproto.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) NXvars.h $(DESTDIR)${includedir}/nx - $(INSTALL_DATA) nxcomp.pc $(DESTDIR)${pkgconfigdir} - echo "Running ldconfig tool, this may take a while..." && ldconfig || true - -install.man: - -uninstall: uninstall.bin uninstall.lib uninstall.man - -uninstall.bin: - -uninstall.lib: - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBFULL) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBLOAD) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBSHARED) - $(RM_FILE) $(DESTDIR)${libdir}/$(LIBARCHIVE) - $(RM_FILE) $(DESTDIR)${includedir}/nx/NXalert.h - $(RM_FILE) $(DESTDIR)${includedir}/nx/NX.h - $(RM_FILE) $(DESTDIR)${includedir}/nx/NXpack.h - $(RM_FILE) $(DESTDIR)${includedir}/nx/NXproto.h - $(RM_FILE) $(DESTDIR)${includedir}/nx/NXvars.h - $(RM_FILE) $(DESTDIR)${includedir}/nx/MD5.h - $(RM_FILE) $(DESTDIR)${pkgconfigdir}/nxcomp.pc - echo "Running ldconfig tool, this may take a while..." && ldconfig || true - -uninstall.man: - -clean: - -rm -f *~ *.o *.bak *.orig *.rej st?????? core core.* *.out.* *.pc \ - @ALL@ - -distclean: clean - -rm -rf autom4te.cache config.status config.log \ - config.cache depend.status Makefile tags configure diff --git a/nxcomp/Message.cpp b/nxcomp/Message.cpp deleted file mode 100644 index 530b6b5a8..000000000 --- a/nxcomp/Message.cpp +++ /dev/null @@ -1,2339 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include - -#include - -#include "Misc.h" - -// -// We need channel's cache data. -// - -#include "Message.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. You also -// need to define DUMP in Misc.cpp -// if DUMP is defined here. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Define this to log when messages -// are allocated and deallocated. -// - -#undef REFERENCES - -// -// Keep track of how many bytes are -// occupied by cache. -// - -int MessageStore::totalLocalStorageSize_ = 0; -int MessageStore::totalRemoteStorageSize_ = 0; - -// -// These are used for reference count. -// - -#ifdef REFERENCES - -int Message::references_ = 0; -int MessageStore::references_ = 0; - -#endif - -// -// Here are the methods to handle cached messages. -// - -MessageStore::MessageStore(StaticCompressor *compressor) - - : compressor_(compressor) -{ - // - // Public members. - // - - enableCache = MESSAGE_ENABLE_CACHE; - enableData = MESSAGE_ENABLE_DATA; - enableSplit = MESSAGE_ENABLE_SPLIT; - enableCompress = MESSAGE_ENABLE_COMPRESS; - - dataLimit = MESSAGE_DATA_LIMIT; - dataOffset = MESSAGE_DATA_OFFSET; - - cacheSlots = MESSAGE_CACHE_SLOTS; - cacheThreshold = MESSAGE_CACHE_THRESHOLD; - cacheLowerThreshold = MESSAGE_CACHE_LOWER_THRESHOLD; - - #ifdef TEST - *logofs << "MessageStore: Static compressor is at " - << compressor_ << ".\n" << logofs_flush; - #endif - - md5_state_ = new md5_state_t(); - - #ifdef DEBUG - *logofs << "MessageStore: Created MD5 state for object at " - << this << ".\n" << logofs_flush; - #endif - - lastAdded = cacheSlots; - lastHit = 0; - lastRemoved = 0; - lastRated = nothing; - lastAction = is_discarded; - - // - // Private members. - // - - localStorageSize_ = 0; - remoteStorageSize_ = 0; - - #ifdef TEST - *logofs << "MessageStore: Size of total cache is " - << totalLocalStorageSize_ << " bytes at local side and " - << totalRemoteStorageSize_ << " bytes at remote side.\n" - << logofs_flush; - #endif - - messages_ = new T_messages(); - checksums_ = new T_checksums(); - - temporary_ = NULL; - - #ifdef REFERENCES - - references_++; - - *logofs << "MessageStore: Created new store at " - << this << "out of " << references_ - << " allocated stores.\n" << logofs_flush; - - #endif -} - -MessageStore::~MessageStore() -{ - // - // The virtual destructor of specialized class - // must get rid of both messages in container - // and temporary. - // - - #ifdef DEBUG - *logofs << "MessageStore: Deleting MD5 state for object at " - << this << ".\n" << logofs_flush; - #endif - - delete md5_state_; - - delete messages_; - delete checksums_; - - // - // Update the static members tracking - // size of total memory allocated for - // all stores. - // - - totalLocalStorageSize_ -= localStorageSize_; - totalRemoteStorageSize_ -= remoteStorageSize_; - - #ifdef TEST - *logofs << "MessageStore: Size of total cache is " - << totalLocalStorageSize_ << " bytes at local side and " - << totalRemoteStorageSize_ << " bytes at remote side.\n" - << logofs_flush; - #endif - - #ifdef REFERENCES - - references_--; - - *logofs << "MessageStore: Deleted store at " - << this << " out of " << references_ - << " allocated stores.\n" << logofs_flush; - - #endif -} - -// -// Here are the methods to parse and cache -// messages in the message stores. -// - -int MessageStore::parse(Message *message, int split, const unsigned char *buffer, - unsigned int size, T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian) -{ - // - // Save the message size as received on the link. - // This information will be used to create an ap- - // propriate buffer at the time the message will - // be unparsed. - // - - message -> size_ = size; - message -> i_size_ = identitySize(buffer, size); - message -> c_size_ = 0; - - validateSize(size); - - if (checksumAction == use_checksum) - { - beginChecksum(message); - - parseIdentity(message, buffer, size, bigEndian); - - identityChecksum(message, buffer, size, bigEndian); - - parseData(message, split, buffer, size, checksumAction, dataAction, bigEndian); - - endChecksum(message); - } - else - { - parseIdentity(message, buffer, size, bigEndian); - - parseData(message, split, buffer, size, checksumAction, dataAction, bigEndian); - } - - return 1; -} - -int MessageStore::parse(Message *message, const unsigned char *buffer, - unsigned int size, const unsigned char *compressedData, - const unsigned int compressedDataSize, - T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian) -{ - int offset = identitySize(buffer, size); - - message -> size_ = size; - message -> i_size_ = offset; - message -> c_size_ = compressedDataSize + offset; - - validateSize(message -> size_ - offset, compressedDataSize); - - if (checksumAction == use_checksum) - { - beginChecksum(message); - - parseIdentity(message, buffer, size, bigEndian); - - identityChecksum(message, buffer, size, bigEndian); - - parseData(message, buffer, size, compressedData, compressedDataSize, - checksumAction, dataAction, bigEndian); - - endChecksum(message); - } - else - { - parseIdentity(message, buffer, size, bigEndian); - - parseData(message, buffer, size, compressedData, compressedDataSize, - checksumAction, dataAction, bigEndian); - } - - return 1; -} - -int MessageStore::parseData(Message *message, int split, const unsigned char *buffer, - unsigned int size, T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian) -{ - if ((int) size > message -> i_size_) - { - unsigned int dataSize = size - message -> i_size_; - - if (checksumAction == use_checksum) - { - #ifdef DEBUG - *logofs << name() << ": Calculating checksum of object at " - << message << " with data size " << dataSize - << ".\n" << logofs_flush; - #endif - - dataChecksum(message, buffer, size, bigEndian); - } - - if (dataAction == discard_data) - { - #ifdef DEBUG - *logofs << name() << ": Discarded " << dataSize - << " bytes of plain data. Real size is " - << message -> size_ << " compressed size is " - << message -> c_size_ << ".\n" << logofs_flush; - #endif - - return 1; - } - - // - // Accept anyway data beyond the - // expected limit. - // - - #ifdef TEST - - if (dataSize > (unsigned int) dataLimit) - { - *logofs << name() << ": WARNING! Data is " << dataSize - << " bytes. Ignoring the established limit.\n" - << logofs_flush; - } - - #endif - - if (dataSize != message -> data_.size()) - { - #ifdef DEBUG - *logofs << name() << ": Data will be resized from " - << message -> data_.size() << " to hold a plain buffer of " - << dataSize << " bytes.\n" << logofs_flush; - #endif - - message -> data_.clear(); - - message -> data_.resize(dataSize); - } - - if (split == 0) - { - memcpy(message -> data_.begin(), buffer + message -> i_size_, dataSize); - } - #ifdef TEST - else - { - *logofs << name() << ": Not copied " << dataSize - << " bytes of fake data for the split message.\n" - << logofs_flush; - } - #endif - - #ifdef DEBUG - *logofs << name() << ": Parsed " << dataSize - << " bytes of plain data. Real size is " - << message -> size_ << " compressed size is " - << message -> c_size_ << ".\n" << logofs_flush; - #endif - } - - return 1; -} - -// -// Store the data part in compressed format. -// - -int MessageStore::parseData(Message *message, const unsigned char *buffer, - unsigned int size, const unsigned char *compressedData, - const unsigned int compressedDataSize, - T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian) -{ - if ((int) size > message -> i_size_) - { - unsigned int dataSize = size - message -> i_size_; - - if (checksumAction == use_checksum) - { - #ifdef DEBUG - *logofs << name() << ": Calculating checksum of object at " - << message << " with data size " << dataSize - << ".\n" << logofs_flush; - #endif - - dataChecksum(message, buffer, size, bigEndian); - } - - if (dataAction == discard_data) - { - #ifdef DEBUG - *logofs << name() << ": Discarded " << dataSize - << " bytes of compressed data. Real size is " - << message -> size_ << " compressed size is " - << message -> c_size_ << ".\n" << logofs_flush; - #endif - - return 1; - } - - #ifdef WARNING - if (dataSize > (unsigned int) dataLimit) - { - *logofs << name() << ": WARNING! Data is " << dataSize - << " bytes. Ignoring the established limit!\n" - << logofs_flush; - } - #endif - - dataSize = compressedDataSize; - - if (dataSize != message -> data_.size()) - { - #ifdef DEBUG - *logofs << name() << ": Data will be resized from " - << message -> data_.size() << " to hold a compressed buffer of " - << dataSize << " bytes.\n" << logofs_flush; - #endif - - message -> data_.clear(); - - message -> data_.resize(compressedDataSize); - } - - memcpy(message -> data_.begin(), compressedData, compressedDataSize); - - #ifdef DEBUG - *logofs << name() << ": Parsed " << dataSize - << " bytes of compressed data. Real size is " - << message -> size_ << " compressed size is " - << message -> c_size_ << ".\n" << logofs_flush; - #endif - } - - return 1; -} - -int MessageStore::unparseData(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) -{ - // - // Copy data, if any, to the buffer. - // - - if ((int) size > message -> i_size_) - { - // - // Check if message has been stored - // in compressed format. - // - - if (message -> c_size_ == 0) - { - memcpy(buffer + message -> i_size_, message -> data_.begin(), size - message -> i_size_); - - #ifdef DEBUG - *logofs << name() << ": Unparsed " << message -> size_ - message -> i_size_ - << " bytes of data to a buffer of " << message -> size_ - message -> i_size_ - << ".\n" << logofs_flush; - #endif - } - else - { - #ifdef DEBUG - *logofs << name() << ": Using static compressor at " << (void *) compressor_ - << ".\n" << logofs_flush; - #endif - - if (compressor_ -> - decompressBuffer(buffer + message -> i_size_, - size - message -> i_size_, - message -> data_.begin(), - message -> c_size_ - message -> i_size_) < 0) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Data decompression failed.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Data decompression failed.\n"; - - return -1; - } - - #ifdef DEBUG - *logofs << name() << ": Unparsed " << message -> c_size_ - message -> i_size_ - << " bytes of compressed data to a buffer of " - << message -> size_ - message -> i_size_ << ".\n" << logofs_flush; - #endif - } - } - - // - // We could write size to the buffer but this - // is something the channel class is doing by - // itself. - // - // PutUINT(size >> 2, buffer + 2, bigEndian); - // - - return 1; -} - -void MessageStore::dumpData(const Message *message) const -{ - #ifdef DUMP - - *logofs << name() << ": Dumping enumerated data:\n" << logofs_flush; - - DumpData(message -> data_.begin(), message -> data_.size()); - - #endif - - #ifdef DUMP - - *logofs << name() << ": Dumping checksum data:\n" << logofs_flush; - - DumpData(message -> md5_digest_, MD5_LENGTH); - - #endif -} - -T_checksum MessageStore::getChecksum(const unsigned char *buffer, - unsigned int size, int bigEndian) -{ - Message *message = getTemporary(); - - message -> size_ = size; - message -> i_size_ = identitySize(buffer, size); - message -> c_size_ = 0; - - validateSize(size); - - beginChecksum(message); - - // - // We don't need to extract the identity - // data from the buffer. - // - // parseIdentity(message, buffer, size, bigEndian); - // - - identityChecksum(message, buffer, size, bigEndian); - - parseData(message, 0, buffer, size, use_checksum, discard_data, bigEndian); - - endChecksum(message); - - // - // The caller will have to explicitly - // deallocated the memory after use. - // - - T_checksum checksum = new md5_byte_t[MD5_LENGTH]; - - memcpy(checksum, message -> md5_digest_, MD5_LENGTH); - - return checksum; -} - -int MessageStore::clean(T_checksum_action checksumAction) -{ - int position = lastRemoved + 1; - - if (position >= cacheSlots) - { - position = 0; - } - - #ifdef DEBUG - *logofs << name() << ": Searching a message to remove " - << "starting at position " << position - << " with " << checksums_ -> size() - << " elements in cache.\n" - << logofs_flush; - #endif - - while (position != lastRemoved) - { - #ifdef DEBUG - *logofs << name() << ": Examining position " - << position << ".\n" << logofs_flush; - #endif - - if ((*messages_)[position] != NULL) - { - if (getRating((*messages_)[position], rating_for_clean) == 0) - { - break; - } - else - { - untouch((*messages_)[position]); - } - } - - if (++position == cacheSlots) - { - #ifdef DEBUG - *logofs << name() << ": Rolled position at " - << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - position = 0; - } - } - - // - // If no message is a good candidate, - // then try the object at the next slot - // in respect to last element removed. - // - - if (position == lastRemoved) - { - position = lastRemoved + 1; - - if (position >= cacheSlots) - { - position = 0; - } - - if ((*messages_)[position] == NULL || - (*messages_)[position] -> locks_ != 0) - { - #ifdef DEBUG - *logofs << name() << ": WARNING! No message found " - << "to be actually removed.\n" - << logofs_flush; - #endif - - return nothing; - } - - #ifdef DEBUG - *logofs << name() << ": WARNING! Assuming object " - << "at position " << position << ".\n" - << logofs_flush; - #endif - } - - return position; -} - -// -// This is the insertion method used at local side -// side. Cache at remote side side will be kept in -// sync by telling the to other party where to -// store the message. -// - -int MessageStore::findOrAdd(Message *message, T_checksum_action checksumAction, - T_data_action dataAction, int &added, int &locked) -{ - if (checksumAction != use_checksum) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Internal error in context [A]. " - << "Cannot find or add message to repository " - << "without using checksum.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Internal error in context [A]. " - << "Cannot find or add message to repository " - << "without using checksum.\n"; - - HandleAbort(); - } - - // - // Set added to true only if message - // is inserted in cache. - // - - added = 0; - locked = 0; - - // - // First of all figure out where to - // store this object. - // - - #ifdef DEBUG - *logofs << name() << ": Searching an empty slot " - << "with last rated " << lastRated << " and " - << "last added " << lastAdded << ".\n" - << logofs_flush; - #endif - - int position = lastRated; - - if (position == nothing) - { - position = lastAdded + 1; - - if (position >= cacheSlots) - { - position = 0; - } - - #ifdef DEBUG - *logofs << name() << ": Searching an empty slot " - << "starting at position " << position - << " with " << checksums_ -> size() - << " elements in cache.\n" - << logofs_flush; - #endif - - while (position != lastAdded) - { - #ifdef DEBUG - *logofs << name() << ": Examining position " - << position << ".\n" << logofs_flush; - #endif - - if ((*messages_)[position] == NULL) - { - break; - } - else if (getRating((*messages_)[position], rating_for_insert) == 0) - { - break; - } - else - { - untouch((*messages_)[position]); - } - - if (++position == cacheSlots) - { - #ifdef DEBUG - *logofs << name() << ": Rolled position at " - << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - position = 0; - } - } - } - #ifdef DEBUG - else - { - *logofs << name() << ": Using last rated position " - << position << ".\n" << logofs_flush; - } - #endif - - // - // If we made an extensive check but did not - // find neither a free slot or a message to - // replace, assume slot at next position in - // respect to last added. This can happen if - // all objects in repository have got an hit - // recently. - // - - if (position == lastAdded) - { - position = lastAdded + 1; - - if (position >= cacheSlots) - { - position = 0; - } - - #ifdef DEBUG - *logofs << name() << ": WARNING! Assuming slot " - << "at position " << position << ".\n" - << logofs_flush; - #endif - } - #ifdef DEBUG - else - { - *logofs << name() << ": Found candidate slot " - << "at position " << position << ".\n" - << logofs_flush; - } - #endif - - // - // Save the search result so if the message - // is found in cache, we can use the slot - // at next run. - // - - lastRated = position; - - if ((*messages_)[position] != NULL && - (*messages_)[position] -> locks_ != 0) - { - #ifdef WARNING - *logofs << name() << ": WARNING! Insertion at position " - << position << " would replace a locked message. " - << "Forcing channel to discard the message.\n" - << logofs_flush; - #endif - - #ifdef TEST - *logofs << name() << ": Invalidating rating of object " - << "at position " << position << ".\n" - << logofs_flush; - #endif - - return (lastRated = nothing); - } - - if (checksumAction == use_checksum) - { - T_checksum checksum = getChecksum(message); - - #ifdef TEST - *logofs << name() << ": Searching checksum [" - << DumpChecksum(checksum) << "] in repository.\n" - << logofs_flush; - - #endif - - pair result; - - result = checksums_ -> insert(T_checksums::value_type(checksum, position)); - - // - // Message was found in cache or - // insertion couldn't take place. - // - - if (result.second == 0) - { - if (result.first == checksums_ -> end()) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Failed to insert object " - << "in the cache.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to insert object of type " - << name() << " in the cache.\n"; - - return nothing; - } - - // - // Message is in cache. - // - - #ifdef TEST - *logofs << name() << ": Object is already in cache " - << "at position " << (result.first) -> second - << ".\n" << logofs_flush; - #endif - - #ifdef DEBUG - - printStorageSize(); - - #endif - - // - // Message is locked, probably because - // it has not completely recomposed at - // remote side after a split. - // - - if ((*messages_)[(result.first) -> second] -> locks_ != 0) - { - #ifdef TEST - *logofs << name() << ": WARNING! Object at position " - << (result.first) -> second << " is locked.\n" - << logofs_flush; - #endif - - locked = 1; - } - - // - // Object got a hit, so prevent - // its removal. - // - - if (lastRated == (result.first) -> second) - { - #ifdef TEST - *logofs << name() << ": Resetting rating of object " - << "at position " << (result.first) -> second - << ".\n" << logofs_flush; - #endif - - lastRated = nothing; - } - - return (result.first) -> second; - } - - #ifdef DEBUG - *logofs << name() << ": Could not find message in cache.\n" - << logofs_flush; - #endif - } - - // - // Message not found in hash table (or insertion - // of checksum in hash table was not requested). - // Message was added to cache. - // - - added = 1; - - // - // Log data about the missed message. - // - - #ifdef TEST - - if (opcode() == X_PutImage || opcode() == X_NXPutPackedImage) - { - #ifdef WARNING - *logofs << name() << ": WARNING! Dumping identity of " - << "missed image object of type " << name() - << ".\n" << logofs_flush; - #endif - - dumpIdentity(message); - } - - #endif - - if ((*messages_)[position] != NULL) - { - #ifdef DEBUG - *logofs << name() << ": The message replaces " - << "the old one at position " << position - << ".\n" << logofs_flush; - #endif - - remove(position, checksumAction, dataAction); - } - - (*messages_)[position] = message; - - // - // We used the slot. Perform a new - // search at next run. - // - - lastRated = nothing; - - #ifdef TEST - *logofs << name() << ": Stored message object of size " - << plainSize(position) << " (" << message -> size_ - << "/" << message -> c_size_ << ") at position " - << position << ".\n" << logofs_flush; - #endif - - unsigned int localSize; - unsigned int remoteSize; - - storageSize(message, localSize, remoteSize); - - localStorageSize_ += localSize; - remoteStorageSize_ += remoteSize; - - totalLocalStorageSize_ += localSize; - totalRemoteStorageSize_ += remoteSize; - - #ifdef DEBUG - - printStorageSize(); - - #endif - - // - // Set hits and timestamp at insertion in cache. - // - - message -> hits_ = control -> StoreHitsAddBonus; - message -> last_ = (getTimestamp()).tv_sec; - - message -> locks_ = 0; - - #ifdef DEBUG - *logofs << name() << ": Set last hit of object at " - << strMsTimestamp() << " with a bonus of " - << message -> hits_ << ".\n" << logofs_flush; - #endif - - return position; -} - -// -// Add a parsed message to repository. It is normally used -// at decoding side or at encoding side when we load store -// from disk. To handle messages coming from network, the -// encoding side uses the optimized method findOrAdd(). -// - -int MessageStore::add(Message *message, const int position, - T_checksum_action checksumAction, T_data_action dataAction) -{ - if (position < 0 || position >= cacheSlots) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Cannot add a message " - << "at non existing position " << position - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot add a message " - << "at non existing position " << position - << ".\n"; - - HandleAbort(); - } - - if ((*messages_)[position] != NULL) - { - #ifdef DEBUG - *logofs << name() << ": The message will replace " - << "the old one at position " << position - << ".\n" << logofs_flush; - #endif - - remove(position, checksumAction, dataAction); - } - - #ifdef DEBUG - *logofs << name() << ": Inserting object in repository at position " - << position << ".\n" << logofs_flush; - #endif - - (*messages_)[position] = message; - - // - // Get the object's checksum value - // and insert it in the table. - // - - if (checksumAction == use_checksum) - { - #ifdef DEBUG - *logofs << name() << ": Inserting object's checksum in repository.\n"; - #endif - - T_checksum checksum = getChecksum(message); - - checksums_ -> insert(T_checksums::value_type(checksum, position)); - } - - #ifdef DEBUG - *logofs << name() << ": Stored message object of size " - << plainSize(position) << " (" << message -> size_ - << "/" << message -> c_size_ << ") at position " - << position << ".\n" << logofs_flush; - #endif - - unsigned int localSize; - unsigned int remoteSize; - - storageSize(message, localSize, remoteSize); - - localStorageSize_ += localSize; - remoteStorageSize_ += remoteSize; - - totalLocalStorageSize_ += localSize; - totalRemoteStorageSize_ += remoteSize; - - #ifdef DEBUG - - printStorageSize(); - - #endif - - // - // Set hits and timestamp at insertion in cache. - // - - message -> hits_ = control -> StoreHitsAddBonus; - message -> last_ = (getTimestamp()).tv_sec; - - message -> locks_ = 0; - - #ifdef DEBUG - *logofs << name() << ": Set last hit of object at " - << strMsTimestamp() << " with a bonus of " - << message -> hits_ << ".\n" << logofs_flush; - #endif - - return position; -} - -// -// The following functions don't modify data, -// so they are supposed to be called only at -// the encoding side. -// - -void MessageStore::updateData(const int position, unsigned int dataSize, - unsigned int compressedDataSize) -{ - Message *message = (*messages_)[position]; - - validateSize(dataSize, compressedDataSize); - - if (compressedDataSize != 0) - { - unsigned int localSize; - unsigned int remoteSize; - - storageSize(message, localSize, remoteSize); - - localStorageSize_ -= localSize; - remoteStorageSize_ -= remoteSize; - - totalLocalStorageSize_ -= localSize; - totalRemoteStorageSize_ -= remoteSize; - - message -> c_size_ = compressedDataSize + message -> i_size_; - - #ifdef TEST - - if (message -> size_ != (int) (dataSize + message -> i_size_)) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Size of object looks " - << message -> size_ << " bytes while it " - << "should be " << dataSize + message -> i_size_ - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Size of object looks " - << message -> size_ << " bytes while it " - << "should be " << dataSize + message -> i_size_ - << ".\n"; - - HandleAbort(); - } - - #endif - - storageSize(message, localSize, remoteSize); - - localStorageSize_ += localSize; - remoteStorageSize_ += remoteSize; - - totalLocalStorageSize_ += localSize; - totalRemoteStorageSize_ += remoteSize; - - #ifdef DEBUG - - printStorageSize(); - - #endif - } -} - -void MessageStore::updateData(const T_checksum checksum, unsigned int compressedDataSize) -{ - #ifdef TEST - *logofs << name() << ": Searching checksum [" - << DumpChecksum(checksum) << "] in repository.\n" - << logofs_flush; - #endif - - T_checksums::iterator found = checksums_ -> find(checksum); - - if (found != checksums_ -> end()) - { - Message *message = (*messages_)[found -> second]; - - #ifdef TEST - *logofs << name() << ": Message found in cache at " - << "position " << found -> second << " with size " - << message -> size_ << " and compressed size " - << message -> c_size_ << ".\n" << logofs_flush; - #endif - - updateData(found -> second, message -> size_ - - message -> i_size_, compressedDataSize); - } - #ifdef TEST - else if (checksums_ -> size() > 0) - { - *logofs << name() << ": WARNING! Can't locate the " - << "checksum [" << DumpChecksum(checksum) - << "] for the update.\n" << logofs_flush; - } - #endif -} - -// -// This function replaces the data part of the message -// and updates the information about its size. Split -// messages are advertised to the decoding side with -// their uncompressed size, data is then compressed -// before sending the first chunk. This function is -// called by the decoding side after the split message -// is fully recomposed to replace the dummy data and -// set the real size. -// - -void MessageStore::updateData(const int position, const unsigned char *newData, - unsigned int dataSize, unsigned int compressedDataSize) -{ - Message *message = (*messages_)[position]; - - validateSize(dataSize, compressedDataSize); - - #ifdef TEST - - if (message -> size_ != (int) (dataSize + message -> i_size_)) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Data of object looks " - << dataSize << " bytes while it " << "should be " - << message -> size_ - message -> i_size_ - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Data of object looks " - << dataSize << " bytes while it " << "should be " - << message -> size_ - message -> i_size_ - << ".\n"; - - HandleAbort(); - } - - #endif - - // - // A compressed data size of 0 means that - // message's data was not compressed. - // - - if (compressedDataSize != 0) - { - unsigned int localSize; - unsigned int remoteSize; - - storageSize(message, localSize, remoteSize); - - localStorageSize_ -= localSize; - remoteStorageSize_ -= remoteSize; - - totalLocalStorageSize_ -= localSize; - totalRemoteStorageSize_ -= remoteSize; - - if (message -> c_size_ != (int) compressedDataSize + - message -> i_size_) - { - #ifdef TEST - *logofs << name() << ": Resizing data of message at " - << "position " << position << " from " << message -> - c_size_ << " to " << compressedDataSize + - message -> i_size_ << " bytes.\n" - << logofs_flush; - #endif - - message -> data_.clear(); - - message -> data_.resize(compressedDataSize); - } - - memcpy(message -> data_.begin(), newData, compressedDataSize); - - #ifdef TEST - *logofs << name() << ": Data of message at position " - << position << " has size " << message -> data_.size() - << " and capacity " << message -> data_.capacity() - << ".\n" << logofs_flush; - #endif - - message -> c_size_ = compressedDataSize + message -> i_size_; - - storageSize(message, localSize, remoteSize); - - localStorageSize_ += localSize; - remoteStorageSize_ += remoteSize; - - totalLocalStorageSize_ += localSize; - totalRemoteStorageSize_ += remoteSize; - - #ifdef DEBUG - - printStorageSize(); - - #endif - } - else - { - #ifdef TEST - *logofs << name() << ": No changes to data size for message " - << "at position " << position << ".\n" << logofs_flush; - #endif - - memcpy(message -> data_.begin(), newData, dataSize); - } -} - -int MessageStore::remove(const int position, T_checksum_action checksumAction, - T_data_action dataAction) -{ - Message *message; - - if (position < 0 || position >= cacheSlots || - (message = (*messages_)[position]) == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Cannot remove " - << "a non existing message at position " - << position << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot remove " - << "a non existing message at position " - << position << ".\n"; - - HandleAbort(); - } - - #if defined(TEST) || defined(INFO) - - if (opcode() == X_PutImage || opcode() == X_NXPutPackedImage) - { - #ifdef WARNING - *logofs << name() << ": WARNING! Discarding image object " - << "of type " << name() << " at position " - << position << ".\n" << logofs_flush; - #endif - } - - #endif - - // - // The checksum is only stored at the encoding - // side. - // - - if (checksumAction == use_checksum) - { - #ifdef DEBUG - *logofs << name() << ": Removing checksum for object at " - << "position " << position << ".\n" << logofs_flush; - #endif - - // - // TODO: If we had stored the iterator and - // not the pointer to the message, we could - // have removed the message without having - // to look up the checksum. - // - - T_checksum checksum = getChecksum(message); - - #ifdef TEST - *logofs << name() << ": Searching checksum [" - << DumpChecksum(checksum) << "] in repository.\n" - << logofs_flush; - #endif - - T_checksums::iterator found = checksums_ -> find(checksum); - - if (found == checksums_ -> end()) - { - #ifdef PANIC - *logofs << name() << ": PANIC! No checksum found for " - << "object at position " << position << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No checksum found for " - << "object at position " << position << ".\n"; - - HandleAbort(); - } - - #ifdef TEST - - else if (position != found -> second) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Value of position for object " - << "doesn't match position " << position << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Value of position for object " - << "doesn't match position " << position << ".\n"; - - HandleAbort(); - } - - #endif - - checksums_ -> erase(found); - } - - #ifdef DEBUG - *logofs << name() << ": Removing message at position " - << position << " of size " << plainSize(position) - << " (" << message -> size_ << "/" << message -> c_size_ - << ").\n" << logofs_flush; - #endif - - unsigned int localSize; - unsigned int remoteSize; - - storageSize(message, localSize, remoteSize); - - localStorageSize_ -= localSize; - remoteStorageSize_ -= remoteSize; - - totalLocalStorageSize_ -= localSize; - totalRemoteStorageSize_ -= remoteSize; - - recycle(message); - - (*messages_)[position] = NULL; - - #ifdef DEBUG - - printStorageSize(); - - #endif - - return position; -} - -// -// This should only be called at encoding side. -// The decoding side can't rely on the counter -// as it is decremented by the encoding side -// every time the repository is searched for a -// message to be removed. -// - -int MessageStore::getRating(Message *message, T_rating type) const -{ - if (message -> locks_ != 0) - { - #ifdef TEST - *logofs << name() << ": Rate set to -1 as locks of object are " - << (int) message -> locks_ << ".\n" - << logofs_flush; - #endif - - return -1; - } - else if ((type == rating_for_clean || - (int) checksums_ -> size() == cacheSlots) && - message -> hits_ <= control -> StoreHitsLoadBonus) - { - // - // We don't have any free slot or we exceeded the - // available storage size. This is likely to happen - // after having loaded objects from persistent cache. - // It's not a bad idea to discard some messages that - // were restored but never referenced. - // - - #ifdef TEST - - if (type == rating_for_clean) - { - *logofs << name() << ": Rate set to 0 with hits " - << message -> hits_ << " as maximum storage size " - << "was exceeded.\n" << logofs_flush; - } - else - { - *logofs << name() << ": Rate set to 0 with hits " - << message -> hits_ << " as there are no available " - << "slots in store.\n" << logofs_flush; - } - - #endif - - return 0; - } - else if (type == rating_for_clean && - (getTimestamp()).tv_sec - message -> last_ >= - control -> StoreTimeLimit) - { - #ifdef TEST - *logofs << name() << ": Rate set to 0 as last hit of object was " - << (getTimestamp()).tv_sec - message -> last_ - << " seconds ago with limit set to " << control -> - StoreTimeLimit << ".\n" << logofs_flush; - #endif - - return 0; - } - else - { - #ifdef TEST - if (message -> hits_ < 0) - { - *logofs << name() << ": PANIC! Rate of object shouldn't be " - << message -> hits_ << ".\n" << logofs_flush; - - cerr << "Error" << ": Rate of object of type " << name() - << " shouldn't be " << message -> hits_ << ".\n"; - - HandleAbort(); - } - #endif - - #ifdef TEST - *logofs << name() << ": Rate of object is " << message -> hits_ - << " with last hit " << (getTimestamp()).tv_sec - - message -> last_ << " seconds ago.\n" - << logofs_flush; - #endif - - return message -> hits_; - } -} - -int MessageStore::touch(Message *message) const -{ - message -> last_ = (getTimestamp()).tv_sec; - - message -> hits_ += control -> StoreHitsTouch; - - if (message -> hits_ > control -> StoreHitsLimit) - { - message -> hits_ = control -> StoreHitsLimit; - } - - #ifdef TEST - *logofs << name() << ": Increased hits of object to " - << message -> hits_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - return message -> hits_; -} - -int MessageStore::untouch(Message *message) const -{ - message -> hits_ -= control -> StoreHitsUntouch; - - if (message -> hits_ < 0) - { - message -> hits_ = 0; - } - - #ifdef TEST - *logofs << name() << ": Decreased hits of object to " - << message -> hits_ << ".\n" - << logofs_flush; - #endif - - return message -> hits_; -} - -int MessageStore::lock(const int position) const -{ - Message *message = (*messages_)[position]; - - if (message == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Can't lock the null " - << "object at position " << position - << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << name() << ": Increasing locks of object to " - << (int) message -> locks_ + 1 << ".\n" - << logofs_flush; - #endif - - return ++(message -> locks_); -} - -int MessageStore::unlock(const int position) const -{ - Message *message = (*messages_)[position]; - - if (message == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Can't unlock the null " - << "object at position " << position - << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << name() << ": Decreasing locks of object to " - << (int) message -> locks_ - 1 << ".\n" - << logofs_flush; - #endif - - return --(message -> locks_); -} - -int MessageStore::saveStore(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian) -{ - Message *message; - - #ifdef TEST - *logofs << name() << ": Opcode of this store is " - << (unsigned int) opcode() << " default size of " - << "identity is " << dataOffset << ".\n" - << logofs_flush; - #endif - - unsigned char *identityBuffer = new unsigned char[dataOffset]; - unsigned char *sizeBuffer = new unsigned char[4 * 2]; - unsigned char *positionBuffer = new unsigned char[4]; - unsigned char *opcodeBuffer = new unsigned char[4]; - - #ifdef DUMP - - char *md5ClientDump = new char[dataOffset * 2 + 128]; - - #endif - - unsigned char value; - - int offset; - - int failed = 0; - - for (int position = 0; position < cacheSlots; position++) - { - message = (*messages_)[position]; - - // - // Don't save split messages. - // - - if (message != NULL && message -> locks_ == 0) - { - // - // Use the total size if offset is - // beyond the real end of message. - // - - offset = dataOffset; - - if (offset > message -> size_) - { - offset = message -> size_; - } - - #ifdef TEST - *logofs << name() << ": Going to save message at position " - << position << ".\n" << logofs_flush; - #endif - - value = 1; - - PutULONG(position, positionBuffer, bigEndian); - PutULONG(opcode(), opcodeBuffer, bigEndian); - - md5_append(md5StateClient, positionBuffer, 4); - md5_append(md5StateClient, opcodeBuffer, 4); - - #ifdef DUMP - - *logofs << "Name=" << name() << logofs_flush; - - sprintf(md5ClientDump," Pos=%d Op=%d\n", position, opcode()); - - *logofs << md5ClientDump << logofs_flush; - - #endif - - if (PutData(cachefs, &value, 1) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure writing " << 1 - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, &value, 1); - - PutULONG(message -> size_, sizeBuffer, bigEndian); - PutULONG(message -> c_size_, sizeBuffer + 4, bigEndian); - - // - // Note that the identity size is not saved with - // the message and will be determined from the - // data read when restoring the identity. - // - - if (PutData(cachefs, sizeBuffer, 4 * 2) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure writing " << 4 * 2 - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, sizeBuffer, 4 * 2); - md5_append(md5StateClient, sizeBuffer, 4 * 2); - - #ifdef DUMP - - sprintf(md5ClientDump, "size = %d c_size = %d\n", - message -> size_, message -> c_size_); - - *logofs << md5ClientDump << logofs_flush; - - #endif - - // - // Prepare a clean buffer for unparse. - // - - CleanData(identityBuffer, offset); - - unparseIdentity(message, identityBuffer, offset, bigEndian); - - if (PutData(cachefs, identityBuffer, offset) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure writing " << offset - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, identityBuffer, offset); - md5_append(md5StateClient, identityBuffer, offset); - - #ifdef DUMP - - for (int i = 0; i < offset; i++) - { - sprintf(md5ClientDump + (i * 2), "%02X", identityBuffer[i]); - } - - *logofs << "Identity = " << md5ClientDump << "\n" << logofs_flush; - - #endif - - // - // Set the real identity size before - // saving the data. - // - - offset = message -> i_size_; - - if (offset > message -> size_) - { - offset = message -> size_; - } - - if (checksumAction == use_checksum) - { - if (PutData(cachefs, message -> md5_digest_, MD5_LENGTH) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure writing " << MD5_LENGTH - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, message -> md5_digest_, MD5_LENGTH); - } - else if (dataAction == use_data) - { - int dataSize = (message -> c_size_ == 0 ? - message -> size_ - offset : - message -> c_size_ - offset); - if (dataSize > 0) - { - if (PutData(cachefs, message -> data_.begin(), dataSize) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure writing " << dataSize - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, message -> data_.begin(), dataSize); - } - } - } - else - { - #ifdef TEST - *logofs << name() << ": Not saving message at position " - << position << ".\n" << logofs_flush; - #endif - - value = 0; - - if (PutData(cachefs, &value, 1) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure writing " << 1 - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, &value, 1); - } - } - - if (failed == 1) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Write to persistent cache file failed.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Write to persistent cache file failed.\n"; - } - - delete [] identityBuffer; - delete [] sizeBuffer; - delete [] positionBuffer; - delete [] opcodeBuffer; - - #ifdef DUMP - - delete [] md5ClientDump; - - #endif - - return (failed == 0 ? 1 : -1); -} - -int MessageStore::loadStore(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction, - int bigEndian) -{ - Message *message; - - #ifdef TEST - *logofs << name() << ": Opcode of this store is " - << (unsigned int) opcode() << " default size of " - << "identity is " << dataOffset << " slots are " - << cacheSlots << ".\n" << logofs_flush; - #endif - - // - // If packed images or the render extension has been - // disabled we don't need to restore these messages - // in the cache. Encoding of RENDER in 1.4.0 is also - // changed so we want to skip messages saved using - // the old format. We want to restore all the other - // messages so we'll need to skip these one by one. - // - - int skip = 0; - - if ((opcode() == X_NXPutPackedImage && - control -> PersistentCacheLoadPacked == 0) || - (opcode() == X_NXInternalRenderExtension && - control -> PersistentCacheLoadRender == 0)) - { - #ifdef TEST - *logofs << name() << ": All messages for OPCODE#" - << (unsigned int) opcode() << " will be discarded.\n" - << logofs_flush; - #endif - - skip = 1; - } - - unsigned char *identityBuffer = new unsigned char[dataOffset]; - unsigned char *sizeBuffer = new unsigned char[4 * 2]; - - unsigned char value; - - int offset; - - int failed = 0; - - for (int position = 0; position < cacheSlots; position++) - { - if (GetData(cachefs, &value, 1) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure reading " << 1 - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, &value, 1); - - if (value == 1) - { - #ifdef TEST - *logofs << name() << ": Going to load message at position " - << position << ".\n" << logofs_flush; - #endif - - if (GetData(cachefs, sizeBuffer, 4 * 2) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure reading " << 4 * 2 - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, sizeBuffer, 4 * 2); - - message = getTemporary(); - - if (message == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Can't access temporary storage " - << "for message in context [B].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't access temporary storage " - << "for message in context [B].\n"; - - failed = 1; - - break; - } - - message -> size_ = GetULONG(sizeBuffer, bigEndian); - message -> c_size_ = GetULONG(sizeBuffer + 4, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Size is " << message -> size_ - << " compressed size is " << message -> c_size_ - << ".\n" << logofs_flush; - #endif - - // - // Use the total size if offset is - // beyond the real end of message. - // - - offset = dataOffset; - - if (offset > message -> size_) - { - offset = message -> size_; - } - - if (GetData(cachefs, identityBuffer, offset) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure reading " << offset - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, identityBuffer, offset); - - // - // Get the real identity size based on the value - // reported by the message store. The dataOffset - // value is guaranteed to be greater or equal to - // the maximum identity size of the messages in - // the major store. - // - - offset = identitySize(identityBuffer, offset); - - if (offset > message -> size_) - { - offset = message -> size_; - } - - message -> i_size_ = offset; - - // - // Get identity of message from the buffer we just - // created. Don't calculate neither checksum nor - // data, restore them from stream. Don't pass the - // message's size but the default size of identity. - // - - parseIdentity(message, identityBuffer, offset, bigEndian); - - if (checksumAction == use_checksum) - { - if (message -> md5_digest_ == NULL) - { - message -> md5_digest_ = new md5_byte_t[MD5_LENGTH]; - } - - if (GetData(cachefs, message -> md5_digest_, MD5_LENGTH) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure reading " << MD5_LENGTH - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - // - // Add message's checksum to checksum that will - // be saved together with this cache. Checksum - // will be verified when cache file is restored - // to ensure file is not corrupted. - // - - md5_append(md5StateStream, message -> md5_digest_, MD5_LENGTH); - - if (skip == 1) - { - #ifdef TEST - *logofs << name() << ": Discarding message for OPCODE#" - << (unsigned int) opcode() << ".\n" - << logofs_flush; - #endif - - continue; - } - } - else if (dataAction == use_data) - { - // - // Restore the data part. - // - - int dataSize = (message -> c_size_ == 0 ? - message -> size_ - offset : - message -> c_size_ - offset); - - if (dataSize < 0 || dataSize > control -> MaximumMessageSize) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Bad data size " - << dataSize << " loading persistent cache.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Bad data size " << dataSize - << " loading persistent cache.\n"; - - failed = 1; - - break; - } - else if (dataSize > 0) - { - // - // If need to skip the message let anyway - // it to be part of the calculated MD5. - // - - if (skip == 1) - { - unsigned char *dummy = new unsigned char[dataSize]; - - if (dummy == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Can't allocate dummy buffer " - << "of size " << dataSize << " loading cache.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate dummy buffer " - << "of size " << dataSize << " loading cache.\n"; - - failed = 1; - - break; - } - - if (GetData(cachefs, dummy, dataSize) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure reading " << dataSize - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - md5_append(md5StateStream, dummy, dataSize); - - delete [] dummy; - - #ifdef TEST - *logofs << name() << ": Discarding message for OPCODE#" - << (unsigned int) opcode() << ".\n" - << logofs_flush; - #endif - - continue; - } - else - { - message -> data_.clear(); - - message -> data_.resize(dataSize); - - if (GetData(cachefs, message -> data_.begin(), dataSize) < 0) - { - #ifdef DEBUG - *logofs << name() << ": PANIC! Failure reading " << dataSize - << " bytes.\n" << logofs_flush; - #endif - - failed = 1; - - break; - } - - // - // Add message's data to cache checksum. - // - - md5_append(md5StateStream, message -> data_.begin(), dataSize); - } - } - else - { - // - // We are here if data part is zero. - // - - if (skip == 1) - { - #ifdef TEST - *logofs << name() << ": Discarding message for OPCODE#" - << (unsigned int) opcode() << ".\n" - << logofs_flush; - #endif - - continue; - } - } - } - - int added; - - added = add(message, position, checksumAction, dataAction); - - if (added != position) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Can't store message " - << "in the cache at position " << position - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't store message " - << "in the cache at position " << position - << ".\n"; - - failed = 1; - - break; - } - else - { - // - // Replace default value of hits set by add - // function. Messages read from cache start - // with a lower bonus than fresh messages - // inserted. - // - - message -> hits_ = control -> StoreHitsLoadBonus; - - #ifdef DEBUG - *logofs << name() << ": Updated last hit of object at " - << strMsTimestamp() << " with a bonus of " - << message -> hits_ << ".\n" << logofs_flush; - #endif - - resetTemporary(); - } - } - else if ((*messages_)[position] != NULL) - { - #ifdef TEST - *logofs << name() << ": Going to remove message at position " - << position << ".\n" << logofs_flush; - #endif - - int removed; - - removed = remove(position, checksumAction, dataAction); - - if (removed != position) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Can't remove message from cache " - << "at position " << position << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't remove message from cache " - << "at position " << position << ".\n"; - - failed = 1; - - break; - } - } - #ifdef TEST - else - { - *logofs << name() << ": Not loading message at position " - << position << ".\n" << logofs_flush; - } - #endif - } - - #ifdef WARNING - - if (failed == 1) - { - *logofs << name() << ": WARNING! Read from persistent cache file failed.\n" - << logofs_flush; - } - - #endif - - delete [] identityBuffer; - delete [] sizeBuffer; - - return (failed == 0 ? 1 : -1); -} - -void MessageStore::storageSize(const Message *message, unsigned int &local, - unsigned int &remote) const -{ - local = remote = storage(); - - // - // Encoding side includes 48 bytes for - // the map of checksums and 24 bytes - // of adjustment for total overhead. - // - - local += MD5_LENGTH + 48 + 24; - - // - // At decoding side we include size of - // data part and 24 bytes of adjustment - // for total overhead. - // - - if (message -> c_size_ == 0) - { - remote += message -> size_ + 24; - } - else - { - remote += message -> c_size_ + 24; - } - - // - // Check if we are the encoding or the - // decoding side and, if needed, swap - // the values. - // - - if (message -> md5_digest_ == NULL) - { - unsigned int t = local; - - local = remote; - - remote = t; - } -} - -void MessageStore::printStorageSize() -{ - #ifdef TEST - - *logofs << name() << ": There are " - << checksums_ -> size() << " checksums in this store " - << "out of " << cacheSlots << " slots.\n" - << logofs_flush; - - *logofs << name() << ": Size of this store is " - << localStorageSize_ << " bytes at local side and " - << remoteStorageSize_ << " bytes at remote side.\n" - << logofs_flush; - - *logofs << name() << ": Size of total cache is " - << totalLocalStorageSize_ << " bytes at local side and " - << totalRemoteStorageSize_ << " bytes at remote side.\n" - << logofs_flush; - - #endif -} diff --git a/nxcomp/Message.h b/nxcomp/Message.h deleted file mode 100644 index 30883f101..000000000 --- a/nxcomp/Message.h +++ /dev/null @@ -1,1089 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Message_H -#define Message_H - -#include - -#include "NXproto.h" - -#include "Misc.h" -#include "Control.h" - -#include "Types.h" -#include "Timestamp.h" - -#include "ActionCache.h" - -#include "StaticCompressor.h" - -// -// Forward class declarations. -// - -class ChannelCache; - -class EncodeBuffer; -class DecodeBuffer; - -class WriteBuffer; - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to know how many messages -// are allocated and deallocated. -// - -#undef REFERENCES - -// -// Set default values. We limit the maximum -// size of a request to 262144 but we need to -// consider the replies, whose size may be up -// to 4MB. -// - -#define MESSAGE_ENABLE_CACHE 0 -#define MESSAGE_ENABLE_DATA 0 -#define MESSAGE_ENABLE_SPLIT 0 -#define MESSAGE_ENABLE_COMPRESS 0 - -#define MESSAGE_DATA_LIMIT 4194304 - 4 -#define MESSAGE_DATA_OFFSET 4 - -#define MESSAGE_CACHE_SLOTS 6000 -#define MESSAGE_CACHE_THRESHOLD 50 -#define MESSAGE_CACHE_LOWER_THRESHOLD 5 - -// -// Base message class. -// - -class Message -{ - friend class MessageStore; - friend class RenderExtensionStore; - - public: - - Message() - { - hits_ = 0; - last_ = 0; - locks_ = 0; - - size_ = 0; - c_size_ = 0; - - md5_digest_ = NULL; - - #ifdef REFERENCES - - references_++; - - *logofs << "Message: Created new message at " - << this << " out of " << references_ - << " allocated messages.\n" - << logofs_flush; - - #endif - } - - Message(const Message &message) - { - size_ = message.size_; - c_size_ = message.c_size_; - i_size_ = message.i_size_; - - hits_ = message.hits_; - last_ = message.last_; - locks_ = message.locks_; - - data_ = message.data_; - - #ifdef REFERENCES - - references_++; - - *logofs << "Message: Creating new copied message at " - << this << " out of " << references_ - << " allocated messages.\n" - << logofs_flush; - #endif - - if (message.md5_digest_ != NULL) - { - md5_digest_ = new md5_byte_t[MD5_LENGTH]; - - memcpy(md5_digest_, message.md5_digest_, MD5_LENGTH); - - #ifdef DEBUG - *logofs << "Message: Created MD5 digest for object at " - << this << ".\n" << logofs_flush; - #endif - } - else - { - md5_digest_ = NULL; - } - } - - ~Message() - { - #ifdef DEBUG - if (md5_digest_ != NULL) - { - *logofs << "Message: Deleted MD5 digest for object at " - << this << ".\n" << logofs_flush; - } - #endif - - delete [] md5_digest_; - - #ifdef REFERENCES - - references_--; - - *logofs << "Message: Deleted message at " - << this << " out of " << references_ - << " allocated messages.\n" - << logofs_flush; - #endif - } - - // - // This is the original message size - // including the data part regardless - // data is still stored in the object. - // - - int size_; - - // - // This is the size of the identity. - // - - int i_size_; - - // - // This is the size, including identity, - // after message has been 'updated' to - // reflect storage of data in compressed - // format. - // - - int c_size_; - - protected: - - // - // This is the data part. - // - - T_data data_; - - // - // Time of last hit. - // - - time_t last_; - - // - // This is the number of cache hits - // registered for the object. - // - - short int hits_; - - // - // This is used to mark messages - // that have been split. - // - - short int locks_; - - // - // This is the MD5 checksum. - // - - md5_byte_t *md5_digest_; - - // - // Keep a reference counter - // of allocated objects. - // - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -// -// Repository of messages. -// - -class MessageStore -{ - public: - - // - // Enable or disable cache of messages in store. - // - - int enableCache; - - // - // Does message have a distinct data part. - // - - int enableData; - - // - // Enable or disable split of data part. - // - - int enableSplit; - - // - // Enable or disable compression of data part. - // - - int enableCompress; - - // - // Set starting point of data part in the message. - // - - int dataOffset; - - // - // Set maximum size for the data part of each message. - // - - int dataLimit; - - // - // Set maximum elements in cache. - // - - int cacheSlots; - - // - // Set the percentage of total cache memory which - // a given type of message is allowed to occupy. - // When threshold is exceeded store is cleaned to - // make room for a new message of the same type. - // - - int cacheThreshold; - - // - // Don't clean the store if percentage of cache - // memory occupied by messages of this type is - // below the threshold. - // - - int cacheLowerThreshold; - - // - // Last operation performed on cache. - // - - T_store_action lastAction; - - // - // Position of last element stored in cache. - // - - short int lastAdded; - - // - // Positions of last element found in cache. - // - - short int lastHit; - - // - // Position of last element erased. - // - - short int lastRemoved; - - // - // Used to encode the the action to - // perform on the store and the slot - // involved. - // - - ActionCache lastActionCache; - - // - // Position in cache where next insertion - // is going to take place. - // - - short int lastRated; - - // - // Constructors and destructors. - // - - public: - - MessageStore(StaticCompressor *compressor = NULL); - - virtual ~MessageStore(); - - virtual const char *name() const = 0; - - virtual unsigned char opcode() const = 0; - - virtual unsigned int storage() const = 0; - - // - // These are members that must be specialized. - // - - public: - - virtual Message *create() const = 0; - - virtual Message *create(const Message &message) const = 0; - - virtual void destroy(Message *message) const = 0; - - void validateSize(int size) - { - if (size < control -> MinimumMessageSize || - size > control -> MaximumMessageSize) - { - *logofs << name() << ": PANIC! Invalid size " << size - << " for message.\n" << logofs_flush; - - cerr << "Error" << ": Invalid size " << size - << " for message opcode " << opcode() << ".\n"; - - HandleAbort(); - } - } - - void validateSize(int dataSize, int compressedDataSize) - { - if (dataSize < 0 || dataSize > control -> - MaximumMessageSize - 4 || compressedDataSize < 0 || - compressedDataSize >= dataSize) - { - *logofs << name() << ": PANIC! Invalid data size " - << dataSize << " and compressed data size " - << compressedDataSize << " for message.\n" - << logofs_flush; - - cerr << "Error" << ": Invalid data size " - << dataSize << " and compressed data size " - << compressedDataSize << " for message " - << "opcode " << (unsigned) opcode() << ".\n"; - - HandleAbort(); - } - } - - // - // Determine if the message can be stored - // in the cache. - // - - virtual int validateMessage(const unsigned char *buffer, int size) - { - return (size >= control -> MinimumMessageSize && - size <= control -> MaximumMessageSize); - } - - // - // Get data offset based on major and minor - // opcode of the message. - // - - virtual int identitySize(const unsigned char *buffer, unsigned int size) - { - return dataOffset; - } - - // - // Encode identity and data using the - // specific message encoding. - // - // Some messages do not implement these - // methods because the encoding is done - // directly in the channel loop. Should - // move the encoding methods in in the - // message classes. - // - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const - { - return 1; - } - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const - { - return 1; - } - - // - // Encode differences between message - // in cache and the one to be encoded. - // - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, ChannelCache *channelCache) const - { - } - - // - // Decode differences and update the - // cached version of the same message. - // - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const - { - } - - // - // Post process the message information - // contained in the store by either up- - // dating the size record or the actual - // data part once the message has been - // completely sent to our peer. - // - - void updateData(const int position, unsigned int dataSize, - unsigned int compressedDataSize); - - void updateData(const T_checksum checksum, unsigned int compressedDataSize); - - void updateData(const int position, const unsigned char *newData, - unsigned int dataSize, unsigned int compressedDataSize); - - // - // These members, used internally - // in the message store class, are - // mandatory. - // - - protected: - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual void dumpIdentity(const Message *message) const = 0; - - // - // Design should preserve these from being - // virtual. - // - - int parseData(Message *message, int split, const unsigned char *buffer, - unsigned int size, T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian); - - int parseData(Message *message, const unsigned char *buffer, - unsigned int size, const unsigned char *compressedData, - const unsigned int compressedDataSize, T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian); - - int unparseData(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian); - - // - // Manage efficient allocation of messages - // in the heap. - // - - void recycle(Message *message) - { - #ifdef TEST - - if (message == NULL) - { - *logofs << name() << ": PANIC! Cannot recycle a null message.\n" - << logofs_flush; - - cerr << "Error" << ": Cannot recycle a null message.\n"; - - HandleAbort(); - } - - #endif - - if (temporary_ == NULL) - { - // - // Be careful when reusing the message as - // it can contain valid data that must be - // explicitly deallocated if not needed. - // Note also that you cannot count on the - // initialization made in costructor. - // - - temporary_ = message; - } - else - { - destroy(message); - } - } - - void beginChecksum(Message *message) - { - if (message -> md5_digest_ == NULL) - { - message -> md5_digest_ = new md5_byte_t[MD5_LENGTH]; - - #ifdef DEBUG - *logofs << name() << ": Created MD5 digest structure " - << "for object at " << message << ".\n" - << logofs_flush; - #endif - } - #ifdef DEBUG - else - { - *logofs << name() << ": Using existing MD5 digest structure " - << "for object at " << message << ".\n" - << logofs_flush; - } - #endif - - #ifdef DEBUG - *logofs << name() << ": Prepared MD5 digest for object at " - << message << ".\n" << logofs_flush; - #endif - - md5_init(md5_state_); - } - - void endChecksum(Message *message) - { - md5_finish(md5_state_, message -> md5_digest_); - - #ifdef DEBUG - *logofs << name() << ": Calculated checksum for object at " - << message << ".\n" << logofs_flush; - #endif - } - - void dataChecksum(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) - { - // - // Messages that have a data part starting - // at an offset possibly beyond the end of - // the message, must include the size in - // the identity checksum. - // - - if ((int) size > message -> i_size_) - { - md5_append(md5_state_, buffer + message -> i_size_, - size - message -> i_size_); - } - } - - // - // Repository handling methods. - // - - public: - - // - // Extract identity and data from buffer. - // The size field will be updated at the - // time of data parsing. - // - - int parse(Message *message, int split, const unsigned char *buffer, unsigned int size, - T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); - - int parse(Message *message, const unsigned char *buffer, unsigned int size, - const unsigned char *compressedData, const unsigned int compressedDataSize, - T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); - - // - // From identity and data write the - // final message to the raw buffer. - // - - int unparse(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) - { - return (unparseData(message, buffer, size, bigEndian) && - unparseIdentity(message, buffer, size, bigEndian)); - } - - void dump(const Message *message) const - { - dumpIdentity(message); - - dumpData(message); - } - - void dumpData(const Message *message) const; - - // - // This returns the original message size as it - // was received on the link. It takes in account - // the data part, regardless data is still stored - // in the message object. This information will - // be used at the time message is unparsed. - // - - int plainSize(const int position) const - { - return (*messages_)[position] -> size_; - } - - // - // This returns either the size of identity plus - // the compressed data part or 0 if message is - // stored in uncompressed format. - // - - int compressedSize(const int position) const - { - return (*messages_)[position] -> c_size_; - } - - // - // Returns a pointer to message - // given its position in cache. - // - - Message *get(const int position) const - { - if (position < 0 || position >= cacheSlots) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Requested position " - << position << " is not inside the " - << "container.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Requested position " - << position << " is not inside the" - << "container.\n"; - - HandleAbort(); - } - else if ((*messages_)[position] == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Message at position " - << position << " is NULL.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Message at position " - << position << " is NULL.\n"; - - HandleAbort(); - } - - return (*messages_)[position]; - } - - // - // This is the method called at encoding - // side to add a message to cache. - // - - int findOrAdd(Message *message, T_checksum_action checksumAction, - T_data_action dataAction, int &added, int &locked); - - // - // Utility interfaces to message insertion - // and deletion. - // - - int add(Message *message, const int position, - T_checksum_action checksumAction, T_data_action dataAction); - - int remove(const int position, T_checksum_action checksumAction, - T_data_action dataAction); - - // - // Make space in the repository by remove - // the first suitable message object. - // - - int clean(T_checksum_action checksumAction); - - // - // Increase or decrease the "rating" of - // the message object. - // - - int touch(Message *message) const; - int untouch(Message *message) const; - - int getTouches(const int position) const - { - Message *message = (*messages_)[position]; - - if (message == NULL) - { - return 0; - } - - return message -> hits_; - } - - // - // Gives a 'weight' to the cached message. A zero - // value means object can be safely removed. A value - // greater than zero means it is advisable to retain - // the object. A negative result means it is mandato- - // ry to keep object in cache. - // - - int getRating(Message *message, T_rating type) const; - - // - // Increase or decrease locks of message at given - // position. A locked message will not be removed - // from the message store until the lock counter - // is zero. - // - - int lock(const int position) const; - int unlock(const int position) const; - - int getLocks(const int position) const - { - Message *message = (*messages_)[position]; - - if (message == NULL) - { - return 0; - } - - return message -> locks_; - } - - T_checksum const getChecksum(const int position) const - { - return getChecksum(get(position)); - } - - T_checksum const getChecksum(const Message *message) const - { - if (message -> md5_digest_ == NULL) - { - #ifdef PANIC - *logofs << name() << ": PANIC! Checksum not initialized " - << "for object at " << message << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Checksum not initialized " - << "for object at " << message << ".\n"; - - HandleAbort(); - } - - #ifdef DEBUG - *logofs << name() << ": Got checksum for object at " - << message << ".\n" << logofs_flush; - #endif - - return message -> md5_digest_; - } - - // - // Calculate the checksum on the fly based the - // opcode in the buffer. Useful in the case a - // message was not processed or was not stored - // in the cache. The returned checksum must be - // explicitly deallocated by the caller, after - // use. - // - - T_checksum getChecksum(const unsigned char *buffer, - unsigned int size, int bigEndian); - - const unsigned char *getData(const Message *message) const - { - return message -> data_.begin(); - } - - int plainSize(const Message *message) const - { - return message -> size_; - } - - int identitySize(Message *message) - { - return message -> i_size_; - } - - int compressedSize(const Message *message) const - { - return message -> c_size_; - } - - Message *getTemporary() - { - if (temporary_ == NULL) - { - temporary_ = create(); - } - - return temporary_; - } - - void resetTemporary() - { - temporary_ = NULL; - } - - // - // On side where we don't have checksums, we - // count how many messages are in the array. - // This is obviously expensive and should be - // only performed when reporting statistics. - // - - int getSize() const - { - int size = checksums_ -> size(); - - if (size == 0) - { - for (int i = 0; i < cacheSlots; i++) - { - if ((*messages_)[i] != NULL) - { - size++; - } - } - } - - return size; - } - - int getLocalStorageSize() const - { - return localStorageSize_; - } - - int getRemoteStorageSize() const - { - return remoteStorageSize_; - } - - int getLocalTotalStorageSize() const - { - return totalLocalStorageSize_; - } - - int getRemoteTotalStorageSize() const - { - return totalRemoteStorageSize_; - } - - static int getCumulativeTotalStorageSize() - { - return (totalLocalStorageSize_ > totalRemoteStorageSize_ ? - totalLocalStorageSize_ : totalRemoteStorageSize_); - } - - int saveStore(ostream *cachefs, md5_state_t *md5_state_stream, - md5_state_t *md5_state_client, T_checksum_action checksumAction, - T_data_action dataAction, int bigEndian); - - int loadStore(istream *cachefs, md5_state_t *md5_state_stream, - T_checksum_action checksumAction, T_data_action dataAction, - int bigEndian); - - protected: - - // - // Estimate the memory requirements of given - // instance of message. Size includes memory - // allocated from heap to store checksum and - // data. - // - - void storageSize(const Message *message, unsigned int &local, - unsigned int &remote) const; - - // - // Just used for debug. - // - - void printStorageSize(); - - // - // Repositories where to save cached messages. - // First is a vector of pointers, the second - // is a hash table used for fast lookups. - // - - T_messages *messages_; - T_checksums *checksums_; - - // - // A message object to be used as a temporary. - // Reuse the temporary object if possible, if - // not, create a new instance. - // - - Message *temporary_; - - // - // Used to calculate message's checksum. - // - - md5_state_t *md5_state_; - - private: - - // - // Used to compress data payload. - // - - StaticCompressor *compressor_; - - // - // Keep track of how many bytes - // are taken by cache. - // - - int localStorageSize_; - int remoteStorageSize_; - - static int totalLocalStorageSize_; - static int totalRemoteStorageSize_; - - // - // Used to track object allocation and deallocation. - // - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -// -// This is an ancillary class of the message -// store, used to encode extensions based on -// the minor opcode. -// - -class MinorMessageStore -{ - public: - - virtual ~MinorMessageStore() - { - } - - virtual const char *name() const = 0; - - virtual int identitySize(const unsigned char *buffer, unsigned int size) = 0; - - virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const - { - return 1; - } - - virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, unsigned char type, int bigEndian, - WriteBuffer *writeBuffer, ChannelCache *channelCache) const - { - return 1; - } - - virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const - { - } - - virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const - { - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const - { - } - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const - { - } - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, md5_state_t *md5_state, - int bigEndian) const = 0; -}; - -#endif /* Message_H */ - diff --git a/nxcomp/Misc.cpp b/nxcomp/Misc.cpp deleted file mode 100644 index 09a0b29d2..000000000 --- a/nxcomp/Misc.cpp +++ /dev/null @@ -1,1930 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include - -#include -#include - -#include "NXproto.h" - -#include "MD5.h" - -#include "Misc.h" -#include "Proxy.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#define OPCODES -#undef TEST -#undef DEBUG - -// -// By default nxproxy binds to all network interfaces, setting -// DEFAULT_LOOPBACK_BIND to 1 enables binding to the loopback -// device only. -// - -const int DEFAULT_LOOPBACK_BIND = 0; - -// -// TCP port offset applied to any NX port specification. -// - -const int DEFAULT_NX_PROXY_PORT_OFFSET = 4000; - -// -// Default TCP port used by client proxy to listen to -// X clients and by server proxy to connect to remote. -// - -const int DEFAULT_NX_PROXY_PORT = 8; - -// -// Default X display number that client proxy imitates. -// - -const int DEFAULT_NX_X_PORT = 8; - -// -// Default ports used for listening for cups, samba, http, -// multimedia and auxiliary X connections. Arbitrary ports -// can be used by passing the service's port at the proxy -// startup. By default ports are determined by adding the -// offset below to the offset of the proxied display. For -// example, if the proxy is impersonating the display :8, -// SMB tunnels can be created by connecting to port 3008. -// -// Considering that the NX server uses to start the first -// session at display offset 1000, we must lower the CUPS -// and SMB ports to avoid interference with normal X ses- -// sions run on the server. -// -// Font server connections are used to let the X server on -// the client connect to a font server on the NX server. -// -// Slave channels can be originated by both sides so we need -// different offsets in the case the user runs both proxies -// on the same host. -// - -const int DEFAULT_NX_CUPS_PORT_OFFSET = 2000; -const int DEFAULT_NX_SMB_PORT_OFFSET = 3000; -const int DEFAULT_NX_MEDIA_PORT_OFFSET = 7000; -const int DEFAULT_NX_AUX_PORT_OFFSET = 8000; -const int DEFAULT_NX_HTTP_PORT_OFFSET = 9000; -const int DEFAULT_NX_FONT_PORT_OFFSET = 10000; - -const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET = 11000; -const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET = 12000; - -// -// Usage info and copyright. -// - -static const char UsageInfo[] = -"\n\ - Usage: nxproxy [OPTIONS] host:port\n\ -\n\ - -C Specify that nxproxy has to run on the 'X client'\n\ - side, listening for connections and impersonating\n\ - an X server.\n\ -\n\ - -S Specify that nxproxy has to run in 'X server' mode,\n\ - thus forwarding the connections to daemons running\n\ - on the client.\n\ -\n\ - -h Print this message.\n\ -\n\ - -v Print version information.\n\ -\n\ - host:port Put at the end, specifies the host and port of the\n\ - listening proxy.\n\ -\n\ - name=value Set the NX option to the provided value.\n\ -\n\ - Multiple NX options can be specified in the DISPLAY environment\n\ - or on the command line, by using the nx/nx,option=value notation.\n\ -\n\ - Options:\n\ -\n\ - link=s An indication of the link speed that is going to be\n\ - used between the proxies. Usually the compression\n\ - and the other link parameters depend on this setting.\n\ - The value can be either 'modem', 'isdn', 'adsl',\n\ - 'wan', 'lan', 'local' or a bandwidth specification,\n\ - like for example '56k', '1m', '100m', etc.\n\ -\n\ - type=s Type of session, for example 'windows', 'unix-kde'.\n\ - 'unix-application', etc.\n\ -\n\ - display=s Specify the real display where X connections have\n\ - to be forwarded by the proxy running on the client.\n\ -\n\ - listen=n Local port used for accepting the proxy connection.\n\ -\n\ - loopback=b Bind to the loopback device only.\n\ -\n\ - accept=s Name or IP of host that can connect to the proxy.\n\ -\n\ - connect=s Name or IP of host that the proxy will connect to.\n\ -\n\ - port=n Remote port used for the connection.\n\ -\n\ - retry=n Number of connection atempts.\n\ -\n\ - root=s The root directory for the session. Usually is the\n\ - C-* or S-* in the .nx directory in the user's home,\n\ - with '*' being the virtual display.\n\ -\n\ - session=s Name of the session file. The default is the name\n\ - 'session' in the session directory.\n\ -\n\ - errors=s Name of the log file used by the proxy. The default\n\ - is the name 'errors' in the session directory.\n\ -\n\ - stats=s Name of the file where are written the proxy stat-\n\ - istics. The default is a file 'stats' in the session\n\ - directory. The proxy replaces the data in the file\n\ - whenever it receives a SIGUSR1 or SIGUSR2 signal:\n\ -\n\ - SIGUSR1 Gives total statistics, i.e. statistics\n\ - collected since the beginning of the\n\ - session.\n\ -\n\ - SIGUSR2 Gives partial statistics, i.e. statist-\n\ - ics collected since the last time this\n\ - signal was received.\n\ -\n\ - cookie=s Use the provided cookie for authenticating to the\n\ - remote proxy. The same cookie is used as the fake\n\ - value used for the X authorization. The fake cookie\n\ - is replaced on the X server side with the real cookie\n\ - to be used for the display, so that the real cookie\n\ - doesn't have to travel over the net. When not using\n\ - a proxy cookie, any host will be able to connect to\n\ - the proxy. See also the 'accept' parameter.\n\ -\n\ - nodelay=b A boolean indicating if TCP_NODELAY has to be set\n\ - on the proxy link. Old Linux kernels had problems\n\ - with handling TCP_NODELAY on PPP links.\n\ -\n\ - policy=b Let or not the agent decide when it is the best time\n\ - to flush the proxy link. If set to 0, the proxy will\n\ - flush any encoded data immediately. The option has\n\ - only effect on the X client side proxy.\n\ -\n\ - render=b Enable or disable use of the RENDER extension.\n\ -\n\ - taint=b Try to suppress trivial sources of X roundtrips by\n\ - generating the reply on the X client side.\n\ -\n\ - delta=b Enable X differential compression.\n\ -\n\ - data=n Enable or disable the ZLIB data compression. It is\n\ - possible to specify a value between 0 and 9. Usual-\n\ - ly the value is chosen automatically based on the\n\ - requested link setting.\n\ -\n\ - stream=n Enable or disable the ZLIB stream compression. The\n\ - value, between 0 and 9, is usually determined accor-\n\ - ding to the requested link setting.\n\ -\n\ - limit=n Specify a bitrate limit allowed for this session.\n\ -\n\ - memory=n Trigger memory optimizations used to keep small the\n\ - size of X buffers. This is useful on embedded plat-\n\ - forms, or where memory is scarce.\n\ -\n\ - cache=n Size of the in-memory X message cache. Setting the\n\ - value to 0 will disable the memory cache as well\n\ - as the NX differential compression.\n\ -\n\ - images=n Size of the persistent image cache.\n\ -\n\ - shseg=n Enable the use of the MIT-SHM extension between the\n\ - NX client proxy and the real X server. A value greater\n\ - than 1 is assumed to be the size of requested shared\n\ - memory segment. By default, the size of the segment is\n\ - determined based on the size of the in-memory cache.\n\ -\n\ - load=b Enable loading a persistent X message cache at the\n\ - proxy startup.\n\ -\n\ - save=b Enable saving a persistent X message cache at the\n\ - end of session.\n\ -\n\ - cups=n Enable or disable forwarding of CUPS connections,\n\ - by listening on the optional port 'n'.\n\ -\n\ - aux=n Enable or disable forwarding of the auxiliary X chan-\n\ - nel used for controlling the keyboard. The 'keybd=n'\n\ - form is accepted for backward compatibility.\n\ -\n\ - smb=n Enable or disable forwarding of SMB connections. The\n\ - 'samba=n' form is accepted for backward compatibility.\n\ -\n\ - media=n Enable forwarding of audio connections.\n\ -\n\ - http=n Enable forwarding of HTTP connections.\n\ -\n\ - font=n Enable forwarding of reversed connections to a font\n\ - server running on the NX server.\n\ -\n\ - file=n Enable forwarding of file transfer connections.\n\ -\n\ - mask=n Determine the distribution of channel ids between the\n\ - proxies. By default, channels whose ids are multiple\n\ - of 8 (starting from 0) are reserved for the NX client\n\ - side. All the other channels can be allocated by the\n\ - NX server side.\n\ -\n\ - timeout=t Specify the keep-alive timeout used by proxies to\n\ - determine if there is a network problem preventing\n\ - communication with the remote peer. A value of 0\n\ - disables the check.\n\ -\n\ - cleanup=t Specify the number of seconds the proxy has to wait\n\ - at session shutdown before closing all channels.\n\ - The feature is used by the NX server to ensure that\n\ - services are disconnected before shutting down the\n\ - link.\n\ -\n\ - pack=s Determine the method used to compress images.\n\ -\n\ - product=s The product id of the client or server. The value is\n\ - ignored by the proxy, but the client or server can\n\ - provide it to facilitate the support.\n\ -\n\ - core=b Enable production of core dumps when aborting the\n\ - proxy connection.\n\ -\n\ - options=s Specify an additional file containing options that\n\ - has to be merged with option read from the command\n\ - line or the environment.\n\ -\n\ - kill=n Add the given process to the list of daemons that\n\ - must be terminated at session shutdown. Multiple\n\ - 'kill=n' options can be specified. The proxy will\n\ - send them a SIGTERM signal just before exiting.\n\ -\n\ - strict=b Optimize for responsiveness, rather than for the best\n\ - use of all the available bandwidth.\n\ -\n\ - encryption=b Should be set to 1 if the proxy is running as part of\n\ - a program providing encryption of the point to point\n\ - communication.\n\ -\n\ -rootless=b\n\ -geometry=s\n\ -resize=b\n\ -fullscreen=b\n\ -keyboard=s\n\ -clipboard=s\n\ -streaming=n\n\ -backingstore=n\n\ -composite=n\n\ -xinerama=n\n\ -shmem=b\n\ -shpix=b\n\ -kbtype=s\n\ -client=s\n\ -shadow=n\n\ -shadowuid=n\n\ -shadowmode=s\n\ -defer=n\n\ -tile=s\n\ -menu=n\n\ -sleep=n\n\ -tolerancechecks=s\n\ - These options are interpreted by the NX agent. They\n\ - are ignored by the proxy.\n\ -\n\ - Environment:\n\ -\n\ - NX_ROOT The root NX directory is the place where the session\n\ - directory and the cache files are created. This is\n\ - usually overridden by passing the 'root=' option. By\n\ - default, the root NX directory is assumed to be the\n\ - directory '.nx' in the user's home.\n\ -\n\ - NX_SYSTEM The directory where NX programs and libraries reside.\n\ - If not set, the value is assumed to be '/usr/NX'.\n\ - Programs, libraries and data files are respectedly\n\ - searched in the 'bin', 'lib' and 'share' subdirecto-\n\ - ries.\n\ -\n\ - NX_HOME The NX user's home directory. If NX_ROOT is not set\n\ - or invalid, the user's NX directory is created here.\n\ -\n\ - NX_TEMP The directory where the X11 Unix Domain Sockets and\n\ - all temporary files are to be created.\n\ -\n\ - NX_CLIENT The full path to the nxclient executable. If the va-\n\ - riable is not set, the nxclient executable will be\n\ - run assuming that the program is in the system path.\n\ - This can be useful on platforms like Windows and the\n\ - Mac where nxclient is located in a different direct-\n\ - ory compared to the other programs, to make easier\n\ - for the user to execute the program from the shell.\n\ -\n\ - NX_SLAVE_CMD The full path to the slave channel handler. When the\n\ - slave channel is enabled, the agent will listen on a\n\ - port and forward the connection to the NX_SLAVE_CMD\n\ - program. This can be used to implement agent/proxy\n\ - communication for applications such as serial port and\n\ - USB forwarding.\n\ -\n\ - Shell environment:\n\ -\n\ - HOME The variable is checked in the case NX_HOME is not\n\ - set, null or invalid.\n\ -\n\ - TEMP The variable is checked whenever the NX_TEMP direct-\n\ - ory is not set, null or invalid.\n\ -\n\ - PATH The path where all executables are searched, except\n\ - nxclient. If NX_CLIENT is not set, also the client\n\ - executable is searched in the system path.\n\ -\n\ - LD_LIBRARY_PATH\n\ - System-wide library search order. This should be set\n\ - by the program invoking the proxy.\n\ -\n\ - DISPLAY On the X server side, the DISPLAY variable indicates\n\ - the location of the X11 server. When nxcomp is used\n\ - as a transport library, the DISPLAY may represent a\n\ - NX transport specification and options can passed in\n\ - the form nx/nx,option=value...\n\ -\n\ - XAUTHORITY This is the file containing the X11 authorization\n\ - cookie. If not set, the file is assumed to be in\n\ - the user's home (either NX_HOME or HOME).\n\ -\n\ -"; - -const char *GetUsageInfo() -{ - return UsageInfo; -} - -static const char CopyrightInfo[] = -"\ -Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)\n\ -Copyright (c) 2008-2014 Oleksandr Shneyder \n\ -Copyright (c) 2014-2016 Ulrich Sibiller \n\ -Copyright (c) 2014-2016 Mihai Moldovan \n\ -Copyright (c) 2011-2016 Mike Gabriel \n\ -Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)\n\ -\n\ -NXCOMP, NX protocol compression and NX extensions to this software\n\ -are copyright of the aforementioned persons and companies.\n\ -\n\ -Redistribution and use of the present software is allowed according\n\ -to terms specified in the file LICENSE.nxcomp which comes in the\n\ -source distribution.\n\ -\n\ -All rights reserved.\n\ -\n\ -NOTE: This software has received contributions from various other\n\ -contributors, only the core maintainers and supporters are listed as\n\ -copyright holders. Please contact us, if you feel you should be listed\n\ -as copyright holder, as well.\n\ -"; - -const char *GetCopyrightInfo() -{ - return CopyrightInfo; -} - -static const char OtherCopyrightInfo[] = -"\ -NX protocol compression is derived from DXPC project.\n\ -\n\ -Copyright (c) 1995,1996 Brian Pane\n\ -Copyright (c) 1996,1997 Zachary Vonler and Brian Pane\n\ -Copyright (c) 1999 Kevin Vigor and Brian Pane\n\ -Copyright (c) 2000,2003 Gian Filippo Pinzari and Brian Pane\n\ -\n\ -All rights reserved.\n\ -"; - -const char *GetOtherCopyrightInfo() -{ - return OtherCopyrightInfo; -} - -int _hostBigEndian = 0; -int _storeBigEndian = 0; - -const unsigned int IntMask[33] = -{ - 0x00000000, - 0x00000001, - 0x00000003, - 0x00000007, - 0x0000000f, - 0x0000001f, - 0x0000003f, - 0x0000007f, - 0x000000ff, - 0x000001ff, - 0x000003ff, - 0x000007ff, - 0x00000fff, - 0x00001fff, - 0x00003fff, - 0x00007fff, - 0x0000ffff, - 0x0001ffff, - 0x0003ffff, - 0x0007ffff, - 0x000fffff, - 0x001fffff, - 0x003fffff, - 0x007fffff, - 0x00ffffff, - 0x01ffffff, - 0x03ffffff, - 0x07ffffff, - 0x0fffffff, - 0x1fffffff, - 0x3fffffff, - 0x7fffffff, - 0xffffffff -}; - -unsigned int GetUINT(unsigned const char *buffer, int bigEndian) -{ - // - // It doesn't work on SPARCs if the buffer - // is not aligned to the word boundary. We - // should check the CPU, not the OS as this - // surely applies to other architectures. - // - - #ifndef __sun - - if (_hostBigEndian == bigEndian) - { - return *((unsigned short *) buffer); - } - - #else - - if (_hostBigEndian == bigEndian && ((unsigned int) buffer) & 0x1 == 0) - { - return *((unsigned short *) buffer); - } - - #endif - - unsigned int result; - - if (bigEndian) - { - result = *buffer; - - result <<= 8; - - result += buffer[1]; - } - else - { - result = buffer[1]; - - result <<= 8; - - result += *buffer; - } - - return result; -} - -unsigned int GetULONG(unsigned const char *buffer, int bigEndian) -{ - // - // It doesn't work on SPARCs if the buffer - // is not aligned to word the boundary. - // - - #ifndef __sun - - if (_hostBigEndian == bigEndian) - { - return *((unsigned int *) buffer); - } - - #else - - if (_hostBigEndian == bigEndian && ((unsigned int) buffer) & 0x3 == 0) - { - return *((unsigned int *) buffer); - } - - #endif - - const unsigned char *next = (bigEndian ? buffer : buffer + 3); - - unsigned int result = 0; - - for (int i = 0; i < 4; i++) - { - result <<= 8; - - result += *next; - - if (bigEndian) - { - next++; - } - else - { - next--; - } - } - - return result; -} - -void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian) -{ - if (_hostBigEndian == bigEndian) - { - *((unsigned short *) buffer) = value; - - return; - } - - if (bigEndian) - { - buffer[1] = (unsigned char) (value & 0xff); - - value >>= 8; - - *buffer = (unsigned char) value; - } - else - { - *buffer = (unsigned char) (value & 0xff); - - value >>= 8; - - buffer[1] = (unsigned char) value; - } -} - -void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian) -{ - if (_hostBigEndian == bigEndian) - { - *((unsigned int *) buffer) = value; - - return; - } - - if (bigEndian) - { - buffer += 3; - - for (int i = 4; i > 0; i--) - { - *buffer-- = (unsigned char) (value & 0xff); - - value >>= 8; - } - } - else - { - for (int i = 4; i > 0; i--) - { - *buffer++ = (unsigned char) (value & 0xff); - - value >>= 8; - } - } -} - -int CheckData(istream *fs) -{ - if (fs == NULL || fs -> fail()) - { - return -1; - } - - return 1; -} - -int CheckData(ostream *fs) -{ - if (fs == NULL || fs -> fail()) - { - return -1; - } - - return 1; -} - -int PutData(ostream *fs, const unsigned char *buffer, int size) -{ - fs -> write((char *) buffer, size); - - #ifdef DEBUG - *logofs << "PutData: Written " << size << " bytes with eof " - << fs -> eof() << " fail " << fs -> fail() << " and bad " - << fs -> bad() << ".\n" << logofs_flush; - #endif - - if (fs -> fail()) - { - return -1; - } - - return size; -} - -int GetData(istream *fs, unsigned char *buffer, int size) -{ - fs -> read((char *) buffer, size); - - #ifdef DEBUG - *logofs << "GetData: Read " << size << " bytes with eof " - << fs -> eof() << " fail " << fs -> fail() - << " and bad " << fs -> bad() << ".\n" - << logofs_flush; - #endif - - #ifdef __APPLE__ - - if (fs -> bad()) - { - return -1; - } - - #else - - if (fs -> fail()) - { - return -1; - } - - #endif - - return size; -} - -int FlushData(ostream *fs) -{ - fs -> flush(); - - if (fs -> fail()) - { - return -1; - } - - return 1; -} - -unsigned int RoundUp2(unsigned int x) -{ - unsigned int y = x / 2; - - y *= 2; - - if (y != x) - { - y += 2; - } - - return y; -} - -unsigned int RoundUp4(unsigned int x) -{ - unsigned int y = x / 4; - - y *= 4; - - if (y != x) - { - y += 4; - } - - return y; -} - -unsigned int RoundUp8(unsigned int x) -{ - unsigned int y = x / 8; - - y *= 8; - - if (y != x) - { - y += 8; - } - - return y; -} - -const char *DumpSignal(int signal) -{ - switch (signal) - { - case SIGCHLD: - { - return "SIGCHLD"; - } - case SIGUSR1: - { - return "SIGUSR1"; - } - case SIGUSR2: - { - return "SIGUSR2"; - } - case SIGHUP: - { - return "SIGHUP"; - } - case SIGINT: - { - return "SIGINT"; - } - case SIGTERM: - { - return "SIGTERM"; - } - case SIGPIPE: - { - return "SIGPIPE"; - } - case SIGALRM: - { - return "SIGALRM"; - } - case SIGVTALRM: - { - return "SIGVTALRM"; - } - case SIGWINCH: - { - return "SIGWINCH"; - } - case SIGIO: - { - return "SIGIO"; - } - case SIGTSTP: - { - return "SIGTSTP"; - } - case SIGTTIN: - { - return "SIGTTIN"; - } - case SIGTTOU: - { - return "SIGTTOU"; - } - case SIGSEGV: - { - return "SIGSEGV"; - } - case SIGABRT: - { - return "SIGABRT"; - } - default: - { - return "Unknown"; - } - } -} - -const char *DumpPolicy(int type) -{ - switch ((T_flush_policy) type) - { - case policy_immediate: - { - return "immediate"; - } - case policy_deferred: - { - return "deferred"; - } - default: - { - #ifdef PANIC - *logofs << "Misc: PANIC! Unknown policy type '" - << type << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unknown policy type '" - << type << "'.\n"; - - HandleCleanup(); - } - } -} - -const char *DumpAction(int type) -{ - T_store_action action = (T_store_action) type; - - if (action == IS_HIT) - { - return "is_hit"; - } - else if (action == IS_ADDED) - { - return "is_added"; - } - else if (action == is_discarded) - { - return "is_discarded"; - } - else if (action == is_removed) - { - return "is_removed"; - } - else - { - #ifdef PANIC - *logofs << "Misc: PANIC! Unknown store action '" - << type << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unknown store action '" - << type << "'.\n"; - - HandleCleanup(); - } -} - -const char *DumpState(int type) -{ - switch ((T_split_state) type) - { - case split_added: - { - return "split_added"; - } - case split_missed: - { - return "split_missed"; - } - case split_loaded: - { - return "split_loaded"; - } - case split_aborted: - { - return "split_aborted"; - } - case split_notified: - { - return "split_notified"; - } - default: - { - #ifdef PANIC - *logofs << "Misc: PANIC! Unknown split state '" - << type << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unknown split state '" - << type << "'.\n"; - - HandleCleanup(); - } - } -} - -const char *DumpControl(int code) -{ - switch ((T_proxy_code) code) - { - case code_new_x_connection: - { - return "code_new_x_connection"; - } - case code_new_cups_connection: - { - return "code_new_cups_connection"; - } - case code_new_aux_connection: - { - return "code_new_aux_connection"; - } - case code_new_smb_connection: - { - return "code_new_smb_connection"; - } - case code_new_media_connection: - { - return "code_new_media_connection"; - } - case code_switch_connection: - { - return "code_switch_connection"; - } - case code_drop_connection: - { - return "code_drop_connection"; - } - case code_finish_connection: - { - return "code_finish_connection"; - } - case code_begin_congestion: - { - return "code_begin_congestion"; - } - case code_end_congestion: - { - return "code_end_congestion"; - } - case code_alert_request: - { - return "code_alert_request"; - } - case code_alert_reply: - { - return "code_alert_reply"; - } - case code_reset_request: - { - return "code_reset_request"; - } - case code_reset_reply: - { - return "code_reset_reply"; - } - case code_load_request: - { - return "code_load_request"; - } - case code_load_reply: - { - return "code_load_reply"; - } - case code_save_request: - { - return "code_save_request"; - } - case code_save_reply: - { - return "code_save_reply"; - } - case code_shutdown_request: - { - return "code_shutdown_request"; - } - case code_shutdown_reply: - { - return "code_shutdown_reply"; - } - case code_control_token_request: - { - return "code_control_token_request"; - } - case code_control_token_reply: - { - return "code_control_token_reply"; - } - case code_configuration_request: - { - return "code_configuration_request"; - } - case code_configuration_reply: - { - return "code_configuration_reply"; - } - case code_statistics_request: - { - return "code_statistics_request"; - } - case code_statistics_reply: - { - return "code_statistics_reply"; - } - case code_new_http_connection: - { - return "code_new_http_connection"; - } - case code_sync_request: - { - return "code_sync_request"; - } - case code_sync_reply: - { - return "code_sync_reply"; - } - case code_new_font_connection: - { - return "code_new_font_connection"; - } - case code_new_slave_connection: - { - return "code_new_slave_connection"; - } - case code_finish_listeners: - { - return "code_finish_listeners"; - } - case code_split_token_request: - { - return "code_split_token_request"; - } - case code_split_token_reply: - { - return "code_split_token_reply"; - } - case code_data_token_request: - { - return "code_data_token_request"; - } - case code_data_token_reply: - { - return "code_data_token_reply"; - } - default: - { - #ifdef WARNING - *logofs << "Misc: WARNING! Unknown control code '" - << code << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Unknown control code '" - << code << "'.\n"; - - return "unknown"; - } - } -} - -const char *DumpSession(int code) -{ - switch ((T_session_mode) code) - { - case session_agent: - { - return "session_agent"; - } - case session_shadow: - { - return "session_shadow"; - } - case session_proxy: - { - return "session_proxy"; - } - default: - { - #ifdef WARNING - *logofs << "Misc: WARNING! Unknown session type '" - << code << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Unknown session type '" - << code << "'.\n"; - - return "unknown"; - } - } -} - -const char *DumpToken(int type) -{ - switch ((T_token_type) type) - { - case token_control: - { - return "token_control"; - } - case token_split: - { - return "token_split"; - } - case token_data: - { - return "token_data"; - } - default: - { - #ifdef WARNING - *logofs << "Misc: WARNING! Unknown token type '" - << type << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Unknown token type '" - << type << "'.\n"; - - return "unknown"; - } - } -} - -// -// Always include this in code as it is generally -// needed to test channels and split store. -// - -const char *DumpChecksum(const void *checksum) -{ - static char string[MD5_LENGTH * 2 + 1]; - - if (checksum != NULL) - { - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - sprintf(string + (i * 2), "%02X", ((unsigned char *) checksum)[i]); - } - } - else - { - strcpy(string, "null"); - } - - return string; -} - -// -// Define OPCODES here and in the channel -// if you want to log the opcode literal. -// - -#ifdef OPCODES - -const char *DumpOpcode(const int &opcode) -{ - switch (opcode) - { - case X_CreateWindow: - { - return "X_CreateWindow"; - } - case X_ChangeWindowAttributes: - { - return "X_ChangeWindowAttributes"; - } - case X_GetWindowAttributes: - { - return "X_GetWindowAttributes"; - } - case X_DestroyWindow: - { - return "X_DestroyWindow"; - } - case X_DestroySubwindows: - { - return "X_DestroySubwindows"; - } - case X_ChangeSaveSet: - { - return "X_ChangeSaveSet"; - } - case X_ReparentWindow: - { - return "X_ReparentWindow"; - } - case X_MapWindow: - { - return "X_MapWindow"; - } - case X_MapSubwindows: - { - return "X_MapSubwindows"; - } - case X_UnmapWindow: - { - return "X_UnmapWindow"; - } - case X_UnmapSubwindows: - { - return "X_UnmapSubwindows"; - } - case X_ConfigureWindow: - { - return "X_ConfigureWindow"; - } - case X_CirculateWindow: - { - return "X_CirculateWindow"; - } - case X_GetGeometry: - { - return "X_GetGeometry"; - } - case X_QueryTree: - { - return "X_QueryTree"; - } - case X_InternAtom: - { - return "X_InternAtom"; - } - case X_GetAtomName: - { - return "X_GetAtomName"; - } - case X_ChangeProperty: - { - return "X_ChangeProperty"; - } - case X_DeleteProperty: - { - return "X_DeleteProperty"; - } - case X_GetProperty: - { - return "X_GetProperty"; - } - case X_ListProperties: - { - return "X_ListProperties"; - } - case X_SetSelectionOwner: - { - return "X_SetSelectionOwner"; - } - case X_GetSelectionOwner: - { - return "X_GetSelectionOwner"; - } - case X_ConvertSelection: - { - return "X_ConvertSelection"; - } - case X_SendEvent: - { - return "X_SendEvent"; - } - case X_GrabPointer: - { - return "X_GrabPointer"; - } - case X_UngrabPointer: - { - return "X_UngrabPointer"; - } - case X_GrabButton: - { - return "X_GrabButton"; - } - case X_UngrabButton: - { - return "X_UngrabButton"; - } - case X_ChangeActivePointerGrab: - { - return "X_ChangeActivePointerGrab"; - } - case X_GrabKeyboard: - { - return "X_GrabKeyboard"; - } - case X_UngrabKeyboard: - { - return "X_UngrabKeyboard"; - } - case X_GrabKey: - { - return "X_GrabKey"; - } - case X_UngrabKey: - { - return "X_UngrabKey"; - } - case X_AllowEvents: - { - return "X_AllowEvents"; - } - case X_GrabServer: - { - return "X_GrabServer"; - } - case X_UngrabServer: - { - return "X_UngrabServer"; - } - case X_QueryPointer: - { - return "X_QueryPointer"; - } - case X_GetMotionEvents: - { - return "X_GetMotionEvents"; - } - case X_TranslateCoords: - { - return "X_TranslateCoords"; - } - case X_WarpPointer: - { - return "X_WarpPointer"; - } - case X_SetInputFocus: - { - return "X_SetInputFocus"; - } - case X_GetInputFocus: - { - return "X_GetInputFocus"; - } - case X_QueryKeymap: - { - return "X_QueryKeymap"; - } - case X_OpenFont: - { - return "X_OpenFont"; - } - case X_CloseFont: - { - return "X_CloseFont"; - } - case X_QueryFont: - { - return "X_QueryFont"; - } - case X_QueryTextExtents: - { - return "X_QueryTextExtents"; - } - case X_ListFonts: - { - return "X_ListFonts"; - } - case X_ListFontsWithInfo: - { - return "X_ListFontsWithInfo"; - } - case X_SetFontPath: - { - return "X_SetFontPath"; - } - case X_GetFontPath: - { - return "X_GetFontPath"; - } - case X_CreatePixmap: - { - return "X_CreatePixmap"; - } - case X_FreePixmap: - { - return "X_FreePixmap"; - } - case X_CreateGC: - { - return "X_CreateGC"; - } - case X_ChangeGC: - { - return "X_ChangeGC"; - } - case X_CopyGC: - { - return "X_CopyGC"; - } - case X_SetDashes: - { - return "X_SetDashes"; - } - case X_SetClipRectangles: - { - return "X_SetClipRectangles"; - } - case X_FreeGC: - { - return "X_FreeGC"; - } - case X_ClearArea: - { - return "X_ClearArea"; - } - case X_CopyArea: - { - return "X_CopyArea"; - } - case X_CopyPlane: - { - return "X_CopyPlane"; - } - case X_PolyPoint: - { - return "X_PolyPoint"; - } - case X_PolyLine: - { - return "X_PolyLine"; - } - case X_PolySegment: - { - return "X_PolySegment"; - } - case X_PolyRectangle: - { - return "X_PolyRectangle"; - } - case X_PolyArc: - { - return "X_PolyArc"; - } - case X_FillPoly: - { - return "X_FillPoly"; - } - case X_PolyFillRectangle: - { - return "X_PolyFillRectangle"; - } - case X_PolyFillArc: - { - return "X_PolyFillArc"; - } - case X_PutImage: - { - return "X_PutImage"; - } - case X_GetImage: - { - return "X_GetImage"; - } - case X_PolyText8: - { - return "X_PolyText8"; - } - case X_PolyText16: - { - return "X_PolyText16"; - } - case X_ImageText8: - { - return "X_ImageText8"; - } - case X_ImageText16: - { - return "X_ImageText16"; - } - case X_CreateColormap: - { - return "X_CreateColormap"; - } - case X_FreeColormap: - { - return "X_FreeColormap"; - } - case X_CopyColormapAndFree: - { - return "X_CopyColormapAndFree"; - } - case X_InstallColormap: - { - return "X_InstallColormap"; - } - case X_UninstallColormap: - { - return "X_UninstallColormap"; - } - case X_ListInstalledColormaps: - { - return "X_ListInstalledColormaps"; - } - case X_AllocColor: - { - return "X_AllocColor"; - } - case X_AllocNamedColor: - { - return "X_AllocNamedColor"; - } - case X_AllocColorCells: - { - return "X_AllocColorCells"; - } - case X_AllocColorPlanes: - { - return "X_AllocColorPlanes"; - } - case X_FreeColors: - { - return "X_FreeColors"; - } - case X_StoreColors: - { - return "X_StoreColors"; - } - case X_StoreNamedColor: - { - return "X_StoreNamedColor"; - } - case X_QueryColors: - { - return "X_QueryColors"; - } - case X_LookupColor: - { - return "X_LookupColor"; - } - case X_CreateCursor: - { - return "X_CreateCursor"; - } - case X_CreateGlyphCursor: - { - return "X_CreateGlyphCursor"; - } - case X_FreeCursor: - { - return "X_FreeCursor"; - } - case X_RecolorCursor: - { - return "X_RecolorCursor"; - } - case X_QueryBestSize: - { - return "X_QueryBestSize"; - } - case X_QueryExtension: - { - return "X_QueryExtension"; - } - case X_ListExtensions: - { - return "X_ListExtensions"; - } - case X_ChangeKeyboardMapping: - { - return "X_ChangeKeyboardMapping"; - } - case X_GetKeyboardMapping: - { - return "X_GetKeyboardMapping"; - } - case X_ChangeKeyboardControl: - { - return "X_ChangeKeyboardControl"; - } - case X_GetKeyboardControl: - { - return "X_GetKeyboardControl"; - } - case X_Bell: - { - return "X_Bell"; - } - case X_ChangePointerControl: - { - return "X_ChangePointerControl"; - } - case X_GetPointerControl: - { - return "X_GetPointerControl"; - } - case X_SetScreenSaver: - { - return "X_SetScreenSaver"; - } - case X_GetScreenSaver: - { - return "X_GetScreenSaver"; - } - case X_ChangeHosts: - { - return "X_ChangeHosts"; - } - case X_ListHosts: - { - return "X_ListHosts"; - } - case X_SetAccessControl: - { - return "X_SetAccessControl"; - } - case X_SetCloseDownMode: - { - return "X_SetCloseDownMode"; - } - case X_KillClient: - { - return "X_KillClient"; - } - case X_RotateProperties: - { - return "X_RotateProperties"; - } - case X_ForceScreenSaver: - { - return "X_ForceScreenSaver"; - } - case X_SetPointerMapping: - { - return "X_SetPointerMapping"; - } - case X_GetPointerMapping: - { - return "X_GetPointerMapping"; - } - case X_SetModifierMapping: - { - return "X_SetModifierMapping"; - } - case X_GetModifierMapping: - { - return "X_GetModifierMapping"; - } - case X_NoOperation: - { - return "X_NoOperation"; - } - case X_NXInternalGenericData: - { - return "X_NXInternalGenericData"; - } - // - // case X_NXInternalGenericReply: - // { - // return "X_NXInternalGenericReply"; - // } - // - case X_NXInternalGenericRequest: - { - return "X_NXInternalGenericRequest"; - } - case X_NXInternalShapeExtension: - { - return "X_NXInternalShapeExtension"; - } - case X_NXGetControlParameters: - { - return "X_NXGetControlParameters"; - } - case X_NXGetCleanupParameters: - { - return "X_NXGetCleanupParameters"; - } - case X_NXGetImageParameters: - { - return "X_NXGetImageParameters"; - } - case X_NXGetUnpackParameters: - { - return "X_NXGetUnpackParameters"; - } - case X_NXGetShmemParameters: - { - return "X_NXGetShmemParameters"; - } - case X_NXGetFontParameters: - { - return "X_NXGetFontParameters"; - } - case X_NXSetExposeParameters: - { - return "X_NXSetExposeParameters"; - } - case X_NXSetCacheParameters: - { - return "X_NXSetCacheParameters"; - } - case X_NXStartSplit: - { - return "X_NXStartSplit"; - } - case X_NXEndSplit: - { - return "X_NXEndSplit"; - } - case X_NXSplitData: - { - return "X_NXSplitData"; - } - case X_NXSplitEvent: - { - return "X_NXSplitEvent"; - } - case X_NXCommitSplit: - { - return "X_NXCommitSplit"; - } - case X_NXFinishSplit: - { - return "X_NXFinishSplit"; - } - case X_NXAbortSplit: - { - return "X_NXAbortSplit"; - } - case X_NXFreeSplit: - { - return "X_NXFreeSplit"; - } - case X_NXSetUnpackGeometry: - { - return "X_NXSetUnpackGeometry"; - } - case X_NXSetUnpackColormap: - { - return "X_NXSetUnpackColormap"; - } - case X_NXSetUnpackAlpha: - { - return "X_NXSetUnpackAlpha"; - } - case X_NXPutPackedImage: - { - return "X_NXPutPackedImage"; - } - case X_NXFreeUnpack: - { - return "X_NXFreeUnpack"; - } - default: - { - if (opcode > 127) - { - return "Extension"; - } - else - { - return "?"; - } - } - } -} - -#else /* #ifdef OPCODES */ - -const char *DumpOpcode(const int &opcode) -{ - return "?"; -} - -#endif /* #ifdef OPCODES */ - -void DumpData(const unsigned char *buffer, unsigned int size) -{ - if (buffer != NULL) - { - unsigned int i = 0; - - while (i < size) - { - *logofs << "[" << i << "]\t"; - - for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) - { - *logofs << (unsigned int) (buffer[i]) << "\t"; - } - - *logofs << "\n" << logofs_flush; - } - } -} - -void DumpChecksum(const unsigned char *buffer, unsigned int size) -{ - if (buffer != NULL) - { - md5_byte_t md5_digest[MD5_LENGTH]; - - md5_state_t md5_state; - - md5_init(&md5_state); - - md5_append(&md5_state, buffer, size); - - md5_finish(&md5_state, md5_digest); - - char md5_string[MD5_LENGTH * 2 + 1]; - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - sprintf(md5_string + (i * 2), "%02X", md5_digest[i]); - } - - *logofs << "[" << md5_string << "]" << logofs_flush; - } -} - -void DumpBlockChecksums(const unsigned char *buffer, - unsigned int size, unsigned int block) -{ - for (unsigned int i = 0; i < (size / block); i++) - { - *logofs << "[" << i * block << "]"; - - DumpChecksum(buffer + (i * block), block); - - *logofs << "\n"; - } - - if (size % block > 0) - { - *logofs << "[" << size / block * block << "]"; - - DumpChecksum(buffer + (size / block * block), size % block); - - *logofs << "\n"; - } -} - -void DumpHexData(const unsigned char *buffer, unsigned int size) -{ - char message [65536]; - char ascii [17]; - - unsigned int index = 0; - unsigned int linescan = 0; - unsigned int index_ascii = 0; - - sprintf (message,"\n#### Start Dump Buffer of [%.5d] Bytes ####\n\n",size); - - *logofs << message << logofs_flush; - - // - // "Index 0 1 2 3 4 5 6 7 8 9 a b c d e f Ascii " - // "----- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------" - // "00000 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" - // - - sprintf (message,"Index 0 1 2 3 4 5 6 7 8 9 a b c d e f Ascii \n"); - *logofs << message << logofs_flush; - sprintf (message,"----- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------\n"); - *logofs << message << logofs_flush; - - index = 0; - - while (index < size) - { - memset (ascii, ' ', sizeof(ascii)); - - ascii[16] = '\0'; - - sprintf (message,"%.5d ", index); - - for (index_ascii = 0, linescan = index; - ((index < (linescan + 16)) && (index < size)); - index++, index_ascii++) - { - if (isprint(buffer [index])) - { - ascii[index_ascii] = buffer [index]; - } - else - { - ascii[index_ascii] = '.'; - } - - sprintf (&message [strlen (message)],"%.2x ", (unsigned char) buffer [index]); - } - - for (linescan = index_ascii; linescan < 16; linescan++) - { - strcat (&message [strlen (message)], " "); - } - - sprintf (&message [strlen (message)]," %s\n", ascii); - - *logofs << message << logofs_flush; - } - - sprintf (message,"\n#### End Dump Buffer ####\n\n"); - - *logofs << message << logofs_flush; -} diff --git a/nxcomp/Misc.h b/nxcomp/Misc.h deleted file mode 100644 index 997630137..000000000 --- a/nxcomp/Misc.h +++ /dev/null @@ -1,279 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Misc_H -#define Misc_H - -#include -#include - -#include -#include - -#ifdef __sun - -#include - -#endif - -using namespace std; - -// -// This is MD5 length. -// - -#define MD5_LENGTH 16 - -// -// Error handling macros. -// - -#define ESET(e) (errno = (e)) -#define EGET() (errno) -#define ESTR() strerror(errno) - -// -// TCP port offset applied to NX port specification. -// - -extern const int DEFAULT_NX_PROXY_PORT_OFFSET; - -// -// Default TCP port used by client proxy to listen -// to X clients and by server proxy to connect to -// remote. -// - -extern const int DEFAULT_NX_PROXY_PORT; - -// -// Default X display number that client -// proxy imitates. -// - -extern const int DEFAULT_NX_X_PORT; - -// -// Establish the port offsets for the additional -// services. -// - -extern const int DEFAULT_NX_CUPS_PORT_OFFSET; -extern const int DEFAULT_NX_SMB_PORT_OFFSET; -extern const int DEFAULT_NX_MEDIA_PORT_OFFSET; -extern const int DEFAULT_NX_AUX_PORT_OFFSET; -extern const int DEFAULT_NX_HTTP_PORT_OFFSET; -extern const int DEFAULT_NX_FONT_PORT_OFFSET; - -// -// Slave channels can be originated by both sides -// so they need to have different port offsets -// in the case the user runs both proxies on the -// same host. -// - -extern const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET; -extern const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET; - -// -// NX proxy binds to all network interfaces by default -// With the -loopback parameter, you can switch -// over to binding to the loopback device only. -// - -extern const int DEFAULT_LOOPBACK_BIND; - -// -// Return strings containing various info. -// - -const char *GetUsageInfo(); -const char *GetCopyrightInfo(); -const char *GetOtherCopyrightInfo(); - -// -// Define this if you want immediate flush of -// the log output. -// - -#define FLUSH_LOGOFS - -// -// Global objects providing shared functions. -// - -class Auth; -class Control; -class Statistics; - -extern Auth *auth; -extern Control *control; -extern Statistics *statistics; - -// -// Log file. -// - -extern ostream *logofs; - -// -// Cleanup code. -// - -void HandleAbort() __attribute__((noreturn)); -void HandleShutdown() __attribute__((noreturn)); - -extern "C" -{ - void HandleCleanup(int code = 0) __attribute__((noreturn)); - void HandleCleanupForReconnect(); -} - -// -// Manage signal handlers. -// - -void DisableSignals(); -void EnableSignals(); - -// -// Manage timers. -// - -void SetTimer(int value); -void ResetTimer(); - -// -// Show a dialog asking the user if he/she -// wants to close the current session. Look -// in the alerts file for the known critical -// events. -// - -void HandleAlert(int code, int local); - -// -// Run the callback registered by the proxy -// or the agent. -// - -void KeeperCallback(); -void FlushCallback(int length); - -// -// Return the string literal corresponding -// the value. -// - -const char *DumpSignal(int signal); -const char *DumpPolicy(int type); -const char *DumpControl(int code); -const char *DumpSession(int code); -const char *DumpAction(int type); -const char *DumpState(int type); -const char *DumpToken(int type); - -// -// Print out content of buffer to log file. -// You need to define DUMP or OPCODES in -// the source to have these compiled. -// - -const char *DumpOpcode(const int &opcode); -const char *DumpChecksum(const void *checksum); - -void DumpData(const unsigned char *data, unsigned int length); -void DumpHexData(const unsigned char *data, unsigned int length); -void DumpChecksum(const unsigned char *data, unsigned int length); -void DumpBlockChecksums(const unsigned char *data, unsigned int length, - unsigned int block); - -// -// Defines logofs_flush as an empty string to -// avoid calling the corresponding ostream's -// flush() function. -// - -#ifdef FLUSH_LOGOFS - -#define logofs_flush "" ; logofs -> flush() - -#else - -#define logofs_flush "" - -#endif - -// -// Is the host where local proxy is running -// big-endian? -// - -extern int _hostBigEndian; -extern int _storeBigEndian; - -inline void setHostBigEndian(int flag) -{ - _hostBigEndian = flag; -} - -inline int hostBigEndian() -{ - return _hostBigEndian; -} - -inline int storeBigEndian() -{ - return _storeBigEndian; -} - -extern const unsigned int IntMask[33]; - -unsigned int GetUINT(unsigned const char *buffer, int bigEndian); -unsigned int GetULONG(unsigned const char *buffer, int bigEndian); -void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian); -void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian); - -inline void CleanData(unsigned char *buffer, int size) -{ - unsigned char *end = buffer + size; - - while (buffer < end) - { - *buffer++ = 0x00; - } -} - -int CheckData(istream *fs); -int CheckData(ostream *fs); -int PutData(ostream *fs, const unsigned char *buffer, int size); -int GetData(istream *fs, unsigned char *buffer, int size); -int FlushData(ostream *fs); - -unsigned int RoundUp2(unsigned int x); -unsigned int RoundUp4(unsigned int x); -unsigned int RoundUp8(unsigned int x); - -#endif /* Misc_H */ diff --git a/nxcomp/NX.h b/nxcomp/NX.h deleted file mode 100644 index 7ec79b4b1..000000000 --- a/nxcomp/NX.h +++ /dev/null @@ -1,471 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NX_H -#define NX_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include -#include -#include -#include - -#define NX_FD_ANY -1 - -#define NX_MODE_ANY -1 -#define NX_MODE_CLIENT 1 -#define NX_MODE_SERVER 2 - -#define NX_DISPLAY_ANY NULL - -#define NX_SIGNAL_ANY -1 -#define NX_SIGNAL_ENABLE 1 -#define NX_SIGNAL_DISABLE 2 -#define NX_SIGNAL_RAISE 3 -#define NX_SIGNAL_FORWARD 4 - -#define NX_POLICY_IMMEDIATE 1 -#define NX_POLICY_DEFERRED 2 - -#define NX_ALERT_REMOTE 0 -#define NX_ALERT_LOCAL 1 - -#define NX_HANDLER_FLUSH 0 -#define NX_HANDLER_STATISTICS 1 - -#define NX_STATISTICS_PARTIAL 0 -#define NX_STATISTICS_TOTAL 1 - -#define NX_CHANNEL_X11 0 -#define NX_CHANNEL_CUPS 1 -#define NX_CHANNEL_SMB 2 -#define NX_CHANNEL_MEDIA 3 -#define NX_CHANNEL_HTTP 4 -#define NX_CHANNEL_FONT 5 -#define NX_CHANNEL_SLAVE 6 - -#define NX_FILE_SESSION 0 -#define NX_FILE_ERRORS 1 -#define NX_FILE_OPTIONS 2 -#define NX_FILE_STATS 3 - -/* - * The following are the new interfaces to the NX transport. The - * NX proxy software is now intended to be run as a library of a - * higher level communication manager (nxssh, nxhttp, nxrtp, etc, - * not only nxproxy). This is a work-in-progress, so expect these - * interfaces to change in future. At the present moment, as an - * example, there is no provision for creating and managing mul- - * tiple proxy connections. - */ - -/* - * Attach a NX transport to the provided descriptor. This should be - * done after having created a pair of connected sockets. - */ - -extern int NXTransCreate(int fd, int mode, const char *options); - -/* - * Tell the proxy to use the second descriptor as its own end of - * the internal connection to the NX agent. The NX agent will use - * the first descriptor. Setting an agent connection will have the - * effect of disabling further X client connections and, if it is - * possible, will trigger the use of the memory-to-memory transport. - */ - -extern int NXTransAgent(int fd[2]); - -/* - * Prepare the file sets and the timeout for a later execution of - * the select(). The masks and the timeout must persist across all - * the calls, so if you don't need any of the values, it is requi- - * red that you create empty masks and a default timeout. To save - * a check at each run, all the functions below assume that valid - * pointers are passed. - */ - -extern int NXTransPrepare(int *maxfds, fd_set *readfds, - fd_set *writefds, struct timeval *timeout); - -/* - * Call select() to find out the descriptors in the sets having - * pending data. - */ - -extern int NXTransSelect(int *result, int *error, int *maxfds, fd_set *readfds, - fd_set *writefds, struct timeval *timeout); - -/* - * Perform the required I/O on all the NX descriptors having pen- - * ding data. This can include reading and writing to the NX chan- - * nels, encoding and decoding the proxy data or managing any of - * the other NX resources. - */ - -extern int NXTransExecute(int *result, int *error, int *maxfds, fd_set *readfds, - fd_set *writefds, struct timeval *timeout); - -/* - * Run an empty loop, giving to the NX transport a chance to check - * its descriptors. - */ - -extern int NXTransContinue(struct timeval *timeout); - -/* - * Perform I/O on the given descriptors. If memory-to-memory trans- - * port has been activated and the descriptor is recognized as a - * valid agent connection, then the functions will read and write - * the data directly to the proxy buffer, otherwise the correspond- - * ing network operation will be performed. - */ - -extern int NXTransRead(int fd, char *data, int size); -extern int NXTransWrite(int fd, char *data, int size); -extern int NXTransReadable(int fd, int *readable); - -extern int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize); -extern int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize); - -extern int NXTransClose(int fd); - -/* - * Return true if the NX transport is running. The fd parameter can - * be either the local descriptor attached to the NX transport or - * NX_FD_ANY. - */ - -extern int NXTransRunning(int fd); - -/* - * Close down the NX transport and free all the allocated resources. - * The fd parameter can be either the local descriptor or NX_FD_ANY. - * This must be explicitly called by the agent before the proxy can - * start the tear down procedure. - */ - -extern int NXTransDestroy(int fd); - -/* - * Tell to the proxy how to handle the standard POSIX signals. For - * example, given the SIGINT signal, the caller can specify any of - * the following actions: - * - * NX_SIGNAL_ENABLE: A signal handler will have to be installed by - * the library, so that it can be intercepted by - * the proxy. - * - * NX_SIGNAL_DISABLE: The signal will be handled by the caller and, - * eventually, forwarded to the proxy by calling - * NXTransSignal() explicitly. - * - * NX_SIGNAL_RAISE: The signal must be handled now, as if it had - * been delivered by the operating system. This - * function can be called by the agent with the - * purpose of propagating a signal to the proxy. - * - * NX_SIGNAL_FORWARD: A signal handler will have to be installed by - * the library but the library will have to call - * the original signal handler when the signal - * is received. - * - * As a rule of thumb, agents should let the proxy handle SIGUSR1 - * and SIGUSR2, used for producing the NX protocol statistics, and - * SIGHUP, used for disconnecting the NX transport. - * - * The following signals are blocked by default upon creation of the - * NX transport: - * - * SIGCHLD These signals should be always put under the control - * SIGUSR1 of the proxy. If agents are intercepting them, agents - * SIGUSR2 should later call NXTransSignal(..., NX_SIGNAL_RAISE) - * SIGHUP to forward the signal to the proxy. As an alternative - * they can specify a NX_SIGNAL_FORWARD action, so they, - * in turn, can be notified about the signal. This can - * be especially useful for SIGCHLD. - * - * SIGINT These signals should be intercepted by agents. Agents - * SIGTERM should ensure that NXTransDestroy() is called before - * exiting, to give the proxy a chance to shut down the - * NX transport. - * - * SIGPIPE This signal is blocked by the proxy, but not used to - * implement any functionality. It can be handled by the - * NX agent without affecting the proxy. - * - * SIGALRM This is now used by the proxy and agents should not - * redefine it. Agents can use the signal to implement - * their own timers but should not interleave calls to - * the NX transport and should restore the old handler - * when the timeout is raised. - * - * SIGVTALRM These signals are not used but may be used in future - * SIGWINCH versions of the library. - * SIGIO - * SIGTSTP - * SIGTTIN - * SIGTTOU - * - * By calling NXTransSignal(..., NX_SIGNAL_DISABLE) nxcomp will res- - * tore the signal handler that was saved at the time the proxy hand- - * ler was installed. This means that you should call the function - * just after the XOpenDisplay() or any other function used to init- - * ialize the NX transport. - */ - -extern int NXTransSignal(int signal, int action); - -/* - * Return a value between 0 and 9 indicating the congestion level - * based on the tokens still available. A value of 9 means that - * the link is congested and no further data can be sent. - */ - -extern int NXTransCongestion(int fd); - -/* - * Let the application to be notified by the proxy when an event oc- - * curs. The parameter, as set at the time the handler is installed, - * is passed each time to the callback function. The parameter is - * presumably the display pointer, given that at the present moment - * the NX transport doesn't have access to the display structure and - * so wouldn't be able to determine the display to pass to the call- - * back function. - * - * NX_HANDLER_FLUSH: The handler function is called when some - * more data has been written to the proxy - * link. - * - * The data is the number of bytes written. - * - * NX_HANDLER_STATISTICS: This handler is called to let the agent - * include arbitrary data in the transport - * statistics. The parameter, in this case, - * is a pointer to a pointer to a null term- - * inated string. The pointer is set at the - * time the handler is registered. The point- - * ed string will have to be filled by the - * agent with its statistics data. - * - * The data can be NX_STATISTICS_PARTIAL or NX_STATISTICS_TOTAL. The - * agent can refer to the value by using the NXStatisticsPartial and - * NXStatisticsTotal constants defined in NXvars.h. - * - * Note that these interfaces are used by Xlib and nxcompext. Agents - * should never call these interfaces directly, but use the nxcompext - * wrapper. - */ - -extern int NXTransHandler(int fd, int type, void (*handler)(void *parameter, - int reason), void *parameter); - -/* - * Set the policy to be used by the NX transport to write data to the - * proxy link: - * - * NX_POLICY_IMMEDIATE: When set to immediate, the proxy will try to - * write the data just after having encoded it. - * - * NX_POLICY_DEFERRED: When policy is set to deferred, data will be - * accumulated in a buffer and written to the - * remote proxy when NXTransFlush() is called by - * the agent. - */ - -extern int NXTransPolicy(int fd, int type); - -/* - * Query the number of bytes that have been accumulated for a deferred - * flush. - */ - -extern int NXTransFlushable(int fd); - -/* - * Tell to the NX transport to write all the accumulated data to the - * remote proxy. - */ - -extern int NXTransFlush(int fd); - -/* - * Create a new channel of the given type. It returns 1 on success, - * 0 if the NX transport is not running, or -1 in the case of error. - * On success, the descriptor provided by the caller can be later - * used for the subsequent I/O. The type parameter not only tells to - * the proxy the remote port where the channel has to be connected, - * but also gives a hint about the type of data that will be carried - * by the channel, so that the proxy can try to optimize the traffic - * on the proxy link. - * - * NX_CHANNEL_X: The channel will carry X traffic and it - * will be connected to the remote X display. - * - * NX_CHANNEL_CUPS: The channel will carry CUPS/IPP protocol. - * - * NX_CHANNEL_SMB: The channel will carry SMB/CIFS protocol. - * - * NX_CHANNEL_MEDIA: The channel will transport audio or other - * multimedia data. - * - * NX_CHANNEL_HTTP: The channel will carry HTTP protocol. - * - * NX_CHANNEL_FONT: The channel will forward a X font server - * connection. - * - * Only a proxy running at the NX server/X client side will be able - * to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running - * at the NX client/X server side can create font server connections. - * The channel creation will also fail if the remote end has not been - * set up to forward the connection. - * - * To create a new channel the agent will have to set up a socketpair - * and pass to the proxy one of the socket descriptors. - * - * Example: - * - * #include - * #include - * - * int fds[2]; - * - * if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) - * { - * ... - * } - * else - * { - * // - * // Use fds[0] locally and let the - * // proxy use fds[1]. - * // - * - * if (NXTransChannel(NX_FD_ANY, fds[1], NX_CHANNEL_X) <= 0) - * { - * ... - * } - * - * // - * // The agent can now use fds[0] in - * // read(), write() and select() - * // system calls. - * // - * - * ... - * } - * - * Note that all the I/O on the descriptor should be non-blocking, to - * give a chance to the NX transport to run in the background and handle - * the data that will be fed to the agent's side of the socketpair. This - * will happen automatically, as long as the agent uses the XSelect() - * version of the select() function (as it is normal whenever performing - * Xlib I/O). In all the other cases, like presumably in the agent's main - * loop, the agent will have to loop through NXTransPrepare(), NXTrans- - * Select() and NXTransExecute() functions explicitly, adding to the sets - * the descriptors that are awaited by the agent. Please check the imple- - * mentation of _XSelect() in nx-X11/lib/X11/XlibInt.c for an example. - */ - -extern int NXTransChannel(int fd, int channelfd, int type); - -/* - * Return the name of the files used by the proxy for the current session. - * - * The type parameter can be: - * - * NX_FILE_SESSION: Usually the file 'session' in the user's session - * directory. - * - * NX_FILE_ERRORS: The file used for the diagnostic output. Usually - * the file 'errors' in the session directory. - * - * NX_FILE_OPTIONS: The file containing the NX options, if any. - * - * NX_FILE_STATS: The file used for the statistics output. - * - * The returned string is allocated in static memory. The caller should - * copy the string upon returning from the function, without freeing the - * pointer. - */ - -extern const char *NXTransFile(int type); - -/* - * Return the time in milliseconds elapsed since the last call to this - * same function. - */ - -extern long NXTransTime(void); - -/* - * Other interfaces to the internal transport functions. - */ - -extern int NXTransProxy(int fd, int mode, const char *display); - -extern int NXTransClient(const char *display); - -extern int NXTransDialog(const char *caption, const char *message, - const char *window, const char *type, int local, - const char *display); - -extern int NXTransAlert(int code, int local); - -extern int NXTransWatchdog(int timeout); - -extern int NXTransKeeper(int caches, int images, const char *root); - -extern void NXTransExit(int code) __attribute__((noreturn)); - -extern int NXTransParseCommandLine(int argc, const char **argv); -extern int NXTransParseEnvironment(const char *env, int force); - -extern void NXTransCleanup(void) __attribute__((noreturn)); - -/* - * Cleans up the global and local state - * (the same way as NXTransCleanup does) - * but does not exit the process - * Needed for IOS platform - */ -extern void NXTransCleanupForReconnect(void); - -extern const char* NXVersion(void); -extern int NXMajorVersion(void); -extern int NXMinorVersion(void); -extern int NXPatchVersion(void); -extern int NXMaintenancePatchVersion(void); - -#ifdef __cplusplus -} -#endif - -#endif /* NX_H */ diff --git a/nxcomp/NXalert.h b/nxcomp/NXalert.h deleted file mode 100644 index dca2f44ca..000000000 --- a/nxcomp/NXalert.h +++ /dev/null @@ -1,276 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXalert_H -#define NXalert_H - -#define ALERT_CAPTION_PREFIX "NX - " - -#define INTERNAL_ERROR_ALERT 1 -#define INTERNAL_ERROR_ALERT_TYPE "error" -#define INTERNAL_ERROR_ALERT_STRING \ -"\ -An unrecoverable internal error was detected.\n\ -Press OK to terminate the current session.\n\ -" - -#define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT 2 -#define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_TYPE "yesno" -#define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_STRING \ -"\ -One of the applications currently in use is not responding.\n\ -Do you want to terminate the current session?\n\ -" - -#define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT 3 -#define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_TYPE "yesno" -#define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_STRING \ -"\ -One of the applications did not behave correctly and caused\n\ -the X server to stop responding in a timely fashion. Do you\n\ -want to terminate the current session?\n\ -" - -#define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT 4 -#define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL -#define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL - -#define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT 5 -#define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" -#define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING \ -"\ -No response received from the remote server.\n\ -Do you want to terminate the current session?\n\ -" - -#define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT 6 -#define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL -#define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL - -#define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT 7 -#define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" -#define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING \ -"\ -Connection with remote server was shut down. NX will try\n\ -to establish a new server connection. Session could have\n\ -been left in a unusable state. Do you want to terminate\n\ -the session?\n\ -" - -#define CLOSE_UNRESPONSIVE_X_SERVER_ALERT 8 -#define CLOSE_UNRESPONSIVE_X_SERVER_ALERT_TYPE "panic" -#define CLOSE_UNRESPONSIVE_X_SERVER_ALERT_STRING \ -"\ -You pressed the key sequence CTRL+ALT+SHIFT+ESC.\n\ -This is probably because your X server has become\n\ -unresponsive. Session will be terminated in 30\n\ -seconds unless you abort the procedure by pressing\n\ -the Cancel button.\n\ -" - -#define WRONG_PROXY_VERSION_ALERT 9 -#define WRONG_PROXY_VERSION_ALERT_TYPE "ok" -#define WRONG_PROXY_VERSION_ALERT_STRING \ -"\ -Local NX libraries version " VERSION " do not match the NX\n\ -version of the remote server. Please check the error\n\ -log on the server to find out which client version you\n\ -need to install to be able to access this server.\n\ -" - -#define FAILED_PROXY_CONNECTION_CLIENT_ALERT 10 -#define FAILED_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL -#define FAILED_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL - -#define FAILED_PROXY_CONNECTION_SERVER_ALERT 11 -#define FAILED_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" -#define FAILED_PROXY_CONNECTION_SERVER_ALERT_STRING \ -"\ -Could not yet establish the connection to the remote\n\ -proxy. Do you want to terminate the current session?\n\ -" - -#define MISSING_PROXY_CACHE_ALERT 12 -#define MISSING_PROXY_CACHE_ALERT_TYPE "ok" -#define MISSING_PROXY_CACHE_ALERT_STRING \ -"\ -NX was unable to negotiate a cache for this session.\n\ -This may happen if this is the first time you run a\n\ -session on this server or if cache was corrupted or\n\ -produced by an incompatible NX version.\n\ -" - -#define ABORT_PROXY_CONNECTION_ALERT 13 -#define ABORT_PROXY_CONNECTION_ALERT_TYPE "ok" -#define ABORT_PROXY_CONNECTION_ALERT_STRING \ -"\ -The connection with the remote server was shut down.\n\ -Please check the state of your network connection.\n\ -" - -/* - * The one below is a special alert, used to close - * a previous alert that is running on the given - * side. This can be used to get rid of a message - * that has ceased to hold true. - */ - -#define DISPLACE_MESSAGE_ALERT 14 -#define DISPLACE_MESSAGE_ALERT_TYPE NULL -#define DISPLACE_MESSAGE_ALERT_STRING NULL - -/* - * These are the other alert messages that were - * added in the 1.5.0 release. The first is never - * shown and is intended just for testing. - */ - -#define GREETING_MESSAGE_ALERT 15 -#define GREETING_MESSAGE_ALERT_TYPE "ok" -#define GREETING_MESSAGE_ALERT_STRING \ -"\ -Welcome to NX from the NoMachine team. We really\n\ -hope you will enjoy this wonderful software as much\n\ -as we had fun making it ;-).\n\ -" - -/* - * These alerts are intended to notify the user - * of the reason why the agent failed to resume - * the session. - */ - -#define START_RESUME_SESSION_ALERT 16 -#define START_RESUME_SESSION_ALERT_TYPE "ok" -#define START_RESUME_SESSION_ALERT_STRING \ -"\ -You appear to run your NX session across a slow network\n\ -connection. Resuming the session may require some time.\n\ -Please wait.\ -" - -#define FAILED_RESUME_DISPLAY_ALERT 17 -#define FAILED_RESUME_DISPLAY_ALERT_TYPE "error" -#define FAILED_RESUME_DISPLAY_ALERT_STRING \ -"\ -Failed to open the display. Can't resume the NX\n\ -session on this display.\n\ -" - -#define FAILED_RESUME_DISPLAY_BROKEN_ALERT 18 -#define FAILED_RESUME_DISPLAY_BROKEN_TYPE "error" -#define FAILED_RESUME_DISPLAY_BROKEN_STRING \ -"\ -The display connection was broken while trying to\n\ -resume the session. Please, check your network\n\ -connection and try again.\n\ -" - -#define FAILED_RESUME_VISUALS_ALERT 19 -#define FAILED_RESUME_VISUALS_ALERT_TYPE "error" -#define FAILED_RESUME_VISUALS_ALERT_STRING \ -"\ -Failed to restore all the required visuals.\n\ -Can't resume the NX session on this display.\n\ -" - -#define FAILED_RESUME_COLORMAPS_ALERT 20 -#define FAILED_RESUME_COLORMAPS_ALERT_TYPE "error" -#define FAILED_RESUME_COLORMAPS_ALERT_STRING \ -"\ -The number of available colormaps is different\n\ -on the new display. Can't resume the NX session\n\ -on this display.\n\ -" - -#define FAILED_RESUME_PIXMAPS_ALERT 21 -#define FAILED_RESUME_PIXMAPS_ALERT_TYPE "error" -#define FAILED_RESUME_PIXMAPS_ALERT_STRING \ -"\ -Failed to restore all the required pixmap formats.\n\ -Can't resume the NX session on this display.\n\ -" - -#define FAILED_RESUME_DEPTHS_ALERT 22 -#define FAILED_RESUME_DEPTHS_ALERT_TYPE "error" -#define FAILED_RESUME_DEPTHS_ALERT_STRING \ -"\ -Failed to restore all the required screen depths.\n\ -Can't resume the NX session on this display.\n\ -" - -#define FAILED_RESUME_RENDER_ALERT 23 -#define FAILED_RESUME_RENDER_ALERT_TYPE "error" -#define FAILED_RESUME_RENDER_ALERT_STRING \ -"\ -The render extension is missing or an incompatible\n\ -version was detected on your X server. Can't resume\n\ -the NX session on this display.\n\ -" - -#define FAILED_RESUME_FONTS_ALERT 24 -#define FAILED_RESUME_FONTS_ALERT_TYPE "error" -#define FAILED_RESUME_FONTS_ALERT_STRING \ -"\ -One or more of the fonts that are in use by the\n\ -session are missing. Can't resume the NX session\n\ -on this display.\n\ -" - -#define ABORT_PROXY_NEGOTIATION_ALERT 62 -#define ABORT_PROXY_NEGOTIATION_ALERT_TYPE "ok" -#define ABORT_PROXY_NEGOTIATION_ALERT_STRING \ -"\ -The remote proxy closed the connection while negotiating\n\ -the session. This may be due to the wrong authentication\n\ -credentials passed to the server.\n\ -" - -#define ABORT_PROXY_SHUTDOWN_ALERT 64 -#define ABORT_PROXY_SHUTDOWN_ALERT_TYPE "ok" -#define ABORT_PROXY_SHUTDOWN_ALERT_STRING \ -"\ -No response received from the remote proxy while\n\ -waiting for the session shutdown.\n\ -" - -#define FAILED_XDMCP_CONNECTION_ALERT 65 -#define FAILED_XDMCP_CONNECTION_ALERT_TYPE "ok" -#define FAILED_XDMCP_CONNECTION_ALERT_STRING \ -"\ -The XDM host that was contacted by the NX server doesn't\n\ -seem to be able to start the session. Please check your\n\ -server configuration.\n\ -" - -/* - * Used to handle the backward compatibility. - * Update the numbers if you add a new alert. - */ - -#define LAST_PROTO_STEP_6_ALERT 63 -#define LAST_PROTO_STEP_7_ALERT 65 - -#endif /* NXalert_H */ diff --git a/nxcomp/NXmitshm.h b/nxcomp/NXmitshm.h deleted file mode 100644 index 939d488fb..000000000 --- a/nxcomp/NXmitshm.h +++ /dev/null @@ -1,56 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXmitshm_H -#define NXmitshm_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Import opcodes from - * to get rid of weird dependencies from other - * headers of X environment. - */ - -#define X_ShmQueryVersion 0 -#define X_ShmAttach 1 -#define X_ShmDetach 2 -#define X_ShmPutImage 3 -#define X_ShmGetImage 4 -#define X_ShmCreatePixmap 5 - -#define ShmCompletion 0 -#define ShmNumberEvents (ShmCompletion + 1) - -#define BadShmSeg 0 -#define ShmNumberErrors (BadShmSeg + 1) - -#ifdef __cplusplus -} -#endif - -#endif /* NXmitshm_H */ diff --git a/nxcomp/NXpack.h b/nxcomp/NXpack.h deleted file mode 100644 index 3eade6855..000000000 --- a/nxcomp/NXpack.h +++ /dev/null @@ -1,141 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXpack_H -#define NXpack_H - -#ifdef __cplusplus -extern "C" { -#endif - -#define MASK_METHOD_LIMIT 10 - -#define NO_MASK 0 - -#define MASK_8_COLORS 1 -#define MASK_64_COLORS 2 -#define MASK_256_COLORS 3 -#define MASK_512_COLORS 4 -#define MASK_4K_COLORS 5 -#define MASK_32K_COLORS 6 -#define MASK_64K_COLORS 7 -#define MASK_256K_COLORS 8 -#define MASK_2M_COLORS 9 -#define MASK_16M_COLORS 10 - -#define PACK_METHOD_LIMIT 128 - -#define NO_PACK 0 - -#define PACK_MASKED_8_COLORS 1 -#define PACK_MASKED_64_COLORS 2 -#define PACK_MASKED_256_COLORS 3 -#define PACK_MASKED_512_COLORS 4 -#define PACK_MASKED_4K_COLORS 5 -#define PACK_MASKED_32K_COLORS 6 -#define PACK_MASKED_64K_COLORS 7 -#define PACK_MASKED_256K_COLORS 8 -#define PACK_MASKED_2M_COLORS 9 -#define PACK_MASKED_16M_COLORS 10 - -#define PACK_RAW_8_BITS 3 -#define PACK_RAW_16_BITS 7 -#define PACK_RAW_24_BITS 10 - -#define PACK_COLORMAP_256_COLORS 11 - -#define PACK_JPEG_8_COLORS 26 -#define PACK_JPEG_64_COLORS 27 -#define PACK_JPEG_256_COLORS 28 -#define PACK_JPEG_512_COLORS 29 -#define PACK_JPEG_4K_COLORS 30 -#define PACK_JPEG_32K_COLORS 31 -#define PACK_JPEG_64K_COLORS 32 -#define PACK_JPEG_256K_COLORS 33 -#define PACK_JPEG_2M_COLORS 34 -#define PACK_JPEG_16M_COLORS 35 - -#define PACK_PNG_8_COLORS 37 -#define PACK_PNG_64_COLORS 38 -#define PACK_PNG_256_COLORS 39 -#define PACK_PNG_512_COLORS 40 -#define PACK_PNG_4K_COLORS 41 -#define PACK_PNG_32K_COLORS 42 -#define PACK_PNG_64K_COLORS 43 -#define PACK_PNG_256K_COLORS 44 -#define PACK_PNG_2M_COLORS 45 -#define PACK_PNG_16M_COLORS 46 - -#define PACK_RGB_16M_COLORS 63 -#define PACK_RLE_16M_COLORS 64 - -#define PACK_ALPHA 65 -#define PACK_COLORMAP 66 - -#define PACK_BITMAP_16M_COLORS 67 - -/* - * Not really pack methods. These values - * allow dynamic selection of the pack - * method by the agent. - */ - -#define PACK_NONE 0 -#define PACK_LOSSY 253 -#define PACK_LOSSLESS 254 -#define PACK_ADAPTIVE 255 - -/* - * Reduce the number of colors in the - * image by applying a mask. - */ - -typedef struct -{ - unsigned int color_mask; - unsigned int correction_mask; - unsigned int white_threshold; - unsigned int black_threshold; - -} ColorMask; - -extern const ColorMask Mask8TrueColor; -extern const ColorMask Mask64TrueColor; -extern const ColorMask Mask512TrueColor; -extern const ColorMask Mask4KTrueColor; -extern const ColorMask Mask32KTrueColor; -extern const ColorMask Mask256KTrueColor; -extern const ColorMask Mask2MTrueColor; -extern const ColorMask Mask16MTrueColor; - -const ColorMask *MethodColorMask(unsigned int method); - -int MethodBitsPerPixel(unsigned int method); - -#ifdef __cplusplus -} -#endif - -#endif /* NXpack_H */ diff --git a/nxcomp/NXproto.h b/nxcomp/NXproto.h deleted file mode 100644 index 7b988bdbf..000000000 --- a/nxcomp/NXproto.h +++ /dev/null @@ -1,447 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXproto_H -#define NXproto_H - -#ifdef __cplusplus -extern "C" { -#endif - -#include -#include -#include - -/* - * Force the size to match the wire protocol. - */ - -#define Drawable CARD32 -#define GContext CARD32 - -#define sz_xNXGetControlParametersReq 4 -#define sz_xNXGetCleanupParametersReq 4 -#define sz_xNXGetImageParametersReq 4 -#define sz_xNXGetUnpackParametersReq 8 -#define sz_xNXGetShmemParametersReq 16 -#define sz_xNXGetFontParametersReq 4 -#define sz_xNXSetExposeParametersReq 8 -#define sz_xNXSetCacheParametersReq 8 -#define sz_xNXStartSplitReq 8 -#define sz_xNXEndSplitReq 4 -#define sz_xNXCommitSplitReq 12 -#define sz_xNXSetUnpackGeometryReq 24 -#define sz_xNXSetUnpackColormapReq 16 -#define sz_xNXSetUnpackAlphaReq 16 -#define sz_xNXPutPackedImageReq 40 -#define sz_xNXFreeUnpackReq 4 -#define sz_xNXFinishSplitReq 4 -#define sz_xNXAbortSplitReq 4 -#define sz_xNXFreeSplitReq 4 - -#define sz_xGetControlParametersReply 32 -#define sz_xGetCleanupParametersReply 32 -#define sz_xGetImageParametersReply 32 -#define sz_xGetUnpackParametersReply 32 -#define sz_xGetShmemParametersReply 32 - -#define LINK_TYPE_LIMIT 5 - -#define LINK_TYPE_NONE 0 -#define LINK_TYPE_MODEM 1 -#define LINK_TYPE_ISDN 2 -#define LINK_TYPE_ADSL 3 -#define LINK_TYPE_WAN 4 -#define LINK_TYPE_LAN 5 - -/* - * NX Replies. - */ - -/* - * The following reply has 4 new boolean - * fields in the last protocol version. - */ - -typedef struct _NXGetControlParametersReply { - BYTE type; /* Is X_Reply. */ - CARD8 linkType; - CARD16 sequenceNumber B16; - CARD32 length B32; /* Is 0. */ - CARD8 localMajor; - CARD8 localMinor; - CARD8 localPatch; - CARD8 remoteMajor; - CARD8 remoteMinor; - CARD8 remotePatch; - CARD16 splitTimeout B16; - CARD16 motionTimeout B16; - CARD8 splitMode; - CARD8 pad1; - CARD32 splitSize B32; - CARD8 packMethod; - CARD8 packQuality; - CARD8 dataLevel; - CARD8 streamLevel; - CARD8 deltaLevel; - CARD8 loadCache; - CARD8 saveCache; - CARD8 startupCache; -} xNXGetControlParametersReply; - -typedef struct _NXGetCleanupParametersReply { - BYTE type; /* Is X_Reply. */ - BYTE pad; - CARD16 sequenceNumber B16; - CARD32 length B32; /* Is 0. */ - BOOL cleanGet; - BOOL cleanAlloc; - BOOL cleanFlush; - BOOL cleanSend; - BOOL cleanImages; - BYTE pad1, pad2, pad3; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xNXGetCleanupParametersReply; - -typedef struct _NXGetImageParametersReply { - BYTE type; /* Is X_Reply. */ - BYTE pad; - CARD16 sequenceNumber B16; - CARD32 length B32; /* Is 0. */ - BOOL imageSplit; - BOOL imageMask; - BOOL imageFrame; - CARD8 imageMaskMethod; - CARD8 imageSplitMethod; - BYTE pad1, pad2, pad3; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xNXGetImageParametersReply; - -/* - * Data is made of PACK_METHOD_LIMIT values of - * type BOOL telling which unpack capabilities - * are implemented in proxy. - */ - -typedef struct _NXGetUnpackParametersReply { - BYTE type; /* Is X_Reply. */ - BYTE pad; - CARD16 sequenceNumber B16; - CARD32 length B32; /* Is PACK_METHOD_LIMIT / 4 from NXpack.h. */ - CARD8 entries; /* Is PACK_METHOD_LIMIT. */ - BYTE pad1, pad2, pad3; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; - CARD32 pad8 B32; -} xNXGetUnpackParametersReply; - -typedef struct _NXGetShmemParametersReply { - BYTE type; /* Is X_Reply. */ - CARD8 stage; /* As in the corresponding request. */ - CARD16 sequenceNumber B16; - CARD32 length B32; /* Is 0. */ - BOOL clientEnabled; /* SHM on path agent to proxy. */ - BOOL serverEnabled; /* SHM on path proxy to X server. */ - BYTE pad1, pad2; /* Previous values can be checked */ - CARD32 clientSize B32; /* at end of stage 2. */ - CARD32 serverSize B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; -} xNXGetShmemParametersReply; - -typedef struct _NXGetFontParametersReply { - BYTE type; /* Is X_Reply. */ - BYTE pad1; - CARD16 sequenceNumber B16; - CARD32 length B32; /* Is length of path string + 1 / 4. */ - CARD32 pad2 B32; - CARD32 pad3 B32; - CARD32 pad4 B32; - CARD32 pad5 B32; - CARD32 pad6 B32; - CARD32 pad7 B32; -} xNXGetFontParametersReply; - -/* - * NX Requests. - */ - -typedef struct _NXGetControlParametersReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; -} xNXGetControlParametersReq; - -typedef struct _NXGetCleanupParametersReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; -} xNXGetCleanupParametersReq; - -typedef struct _NXGetImageParametersReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; -} xNXGetImageParametersReq; - -typedef struct _NXGetUnpackParametersReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - CARD8 entries; - BYTE pad1, pad2, pad3; -} xNXGetUnpackParametersReq; - -typedef struct _NXGetShmemParametersReq { - CARD8 reqType; - CARD8 stage; /* It is between 0 and 2. */ - CARD16 length B16; - BOOL enableClient; /* X client side support is */ - BOOL enableServer; /* not implemented yet. */ - BYTE pad1, pad2; - CARD32 clientSegment; /* XID identifying the shared */ - CARD32 serverSegment; /* memory segments. */ -} xNXGetShmemParametersReq; - -typedef struct _NXGetFontParametersReq { - CARD8 reqType; - CARD8 pad; - CARD16 length B16; -} xNXGetFontParametersReq; - -/* - * The available split modes. - */ - -#define NXSplitModeDefault 0 -#define NXSplitModeAsync 1 -#define NXSplitModeSync 2 - -typedef struct _NXStartSplitReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD8 mode; - BYTE pad1, pad2, pad3; -} xNXStartSplitReq; - -typedef struct _NXEndSplitReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; -} xNXEndSplitReq; - -typedef struct _NXCommitSplitReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD8 propagate; - CARD8 request; - BYTE pad1, pad2; - CARD32 position B32; -} xNXCommitSplitReq; - -typedef struct _NXFinishSplitReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; -} xNXFinishSplitReq; - -typedef struct _NXAbortSplitReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; -} xNXAbortSplitReq; - -typedef struct _NXFreeSplitReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; -} xNXFreeSplitReq; - -typedef struct _NXSetExposeParametersReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - BOOL expose; - BOOL graphicsExpose; - BOOL noExpose; - BYTE pad1; -} xNXSetExposeParametersReq; - -typedef struct _NXSetCacheParametersReq { - CARD8 reqType; - BYTE pad; - CARD16 length B16; - BOOL enableCache; - BOOL enableSplit; - BOOL enableSave; - BOOL enableLoad; -} xNXSetCacheParametersReq; - -typedef struct _NXSetUnpackGeometryReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD8 depth1Bpp; - CARD8 depth4Bpp; - CARD8 depth8Bpp; - CARD8 depth16Bpp; - CARD8 depth24Bpp; - CARD8 depth32Bpp; - BYTE pad1, pad2; - CARD32 redMask B32; - CARD32 greenMask B32; - CARD32 blueMask B32; -} xNXSetUnpackGeometryReq; - -typedef struct _NXSetUnpackColormapReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD8 method; - BYTE pad1, pad2, pad3; - CARD32 srcLength B32; - CARD32 dstLength B32; -} xNXSetUnpackColormapReq; - -typedef struct _NXSetUnpackAlphaReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - CARD8 method; - BYTE pad1, pad2, pad3; - CARD32 srcLength B32; - CARD32 dstLength B32; -} xNXSetUnpackAlphaReq; - -typedef struct _NXPutPackedImageReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; - Drawable drawable B32; - GContext gc B32; - CARD8 method; - CARD8 format; - CARD8 srcDepth; - CARD8 dstDepth; - CARD32 srcLength B32; - CARD32 dstLength B32; - INT16 srcX B16, srcY B16; - CARD16 srcWidth B16, srcHeight B16; - INT16 dstX B16, dstY B16; - CARD16 dstWidth B16, dstHeight B16; -} xNXPutPackedImageReq; - -typedef struct _NXFreeUnpackReq { - CARD8 reqType; - CARD8 resource; - CARD16 length B16; -} xNXFreeUnpackReq; - -/* - * The X_NXSplitData and X_NXSplitEvent opcodes - * are used internally and are ignored if coming - * from the agent. - */ - -#define X_NXInternalGenericData 0 -#define X_NXInternalGenericReply 1 -#define X_NXInternalGenericRequest 255 - -#define X_NXInternalShapeExtension 128 -#define X_NXInternalRenderExtension 129 - -#define X_NXFirstOpcode 230 -#define X_NXLastOpcode 252 - -#define X_NXGetControlParameters 230 -#define X_NXGetCleanupParameters 231 -#define X_NXGetImageParameters 232 -#define X_NXGetUnpackParameters 233 -#define X_NXStartSplit 234 -#define X_NXEndSplit 235 -#define X_NXSplitData 236 -#define X_NXCommitSplit 237 -#define X_NXSetExposeParameters 240 -#define X_NXSetUnpackGeometry 241 -#define X_NXSetUnpackColormap 242 -#define X_NXPutPackedImage 243 -#define X_NXSplitEvent 244 -#define X_NXGetShmemParameters 245 -#define X_NXSetUnpackAlpha 246 -#define X_NXFreeUnpack 247 -#define X_NXFinishSplit 248 -#define X_NXAbortSplit 249 -#define X_NXFreeSplit 250 -#define X_NXGetFontParameters 251 -#define X_NXSetCacheParameters 252 - -/* - * The following events are received by the agent - * in the form of a ClientMessage with the value - * 0 in fields atom and window. The format is - * always 32. Event specific data starts at byte - * offset 12. - * - * These events are sent by the NX transport to - * notify the agent about the result of a split - * operation. - */ - -#define NXNoSplitNotify 1 -#define NXStartSplitNotify 2 -#define NXCommitSplitNotify 3 -#define NXEndSplitNotify 4 -#define NXEmptySplitNotify 5 - -/* - * Notifications of collect events. These events - * don't come from the NX transport but are put - * back in client's event queue by NXlib. - */ - -#define NXCollectImageNotify 8 -#define NXCollectPropertyNotify 9 -#define NXCollectGrabPointerNotify 10 -#define NXCollectInputFocusNotify 11 - -#undef Drawable -#undef GContext - -#ifdef __cplusplus -} -#endif - -#endif /* NXproto_H */ diff --git a/nxcomp/NXrender.h b/nxcomp/NXrender.h deleted file mode 100644 index 280715833..000000000 --- a/nxcomp/NXrender.h +++ /dev/null @@ -1,78 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXrender_H -#define NXrender_H - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Import this from - * to compile under old XFree86 distributions - * when render extension was not present yet. - */ - -#define X_RenderQueryVersion 0 -#define X_RenderQueryPictFormats 1 -#define X_RenderQueryPictIndexValues 2 -#define X_RenderQueryDithers 3 -#define X_RenderCreatePicture 4 -#define X_RenderChangePicture 5 -#define X_RenderSetPictureClipRectangles 6 -#define X_RenderFreePicture 7 -#define X_RenderComposite 8 -#define X_RenderScale 9 -#define X_RenderTrapezoids 10 -#define X_RenderTriangles 11 -#define X_RenderTriStrip 12 -#define X_RenderTriFan 13 -#define X_RenderColorTrapezoids 14 -#define X_RenderColorTriangles 15 -#define X_RenderTransform 16 -#define X_RenderCreateGlyphSet 17 -#define X_RenderReferenceGlyphSet 18 -#define X_RenderFreeGlyphSet 19 -#define X_RenderAddGlyphs 20 -#define X_RenderAddGlyphsFromPicture 21 -#define X_RenderFreeGlyphs 22 -#define X_RenderCompositeGlyphs8 23 -#define X_RenderCompositeGlyphs16 24 -#define X_RenderCompositeGlyphs32 25 -#define X_RenderFillRectangles 26 -/* 0.5 */ -#define X_RenderCreateCursor 27 -/* 0.6 */ -#define X_RenderSetPictureTransform 28 -#define X_RenderQueryFilters 29 -#define X_RenderSetPictureFilter 30 -#define X_RenderCreateAnimCursor 31 - -#ifdef __cplusplus -} -#endif - -#endif /* NXrender_H */ diff --git a/nxcomp/NXvars.h b/nxcomp/NXvars.h deleted file mode 100644 index f514000d7..000000000 --- a/nxcomp/NXvars.h +++ /dev/null @@ -1,201 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef NXvars_H -#define NXvars_H - -/* - * This can be included by the proxy or another - * layer that doesn't use Xlib. - */ - -#if !defined(_XLIB_H_) && !defined(_XKBSRV_H_) - -#define NeedFunctionPrototypes 1 - -#define Display void - -#endif - -#ifdef __cplusplus -extern "C" { -#endif - -/* - * Display flush policies. - */ - -#define NXPolicyImmediate 1 -#define NXPolicyDeferred 2 - -/* - * Type of flush. - */ - -#define NXFlushBuffer 0 -#define NXFlushLink 1 - -/* - * Type of statistics. - */ - -#define NXStatisticsPartial 0 -#define NXStatisticsTotal 1 - -/* - * Reason why the display is blocking. - */ - -#define NXBlockRead 1 -#define NXBlockWrite 2 - -/* - * Set if the client is interested in ignoring - * the display error and continue with the exe- - * cution of the program. By default the usual - * Xlib behaviour is gotten, and the library - * will call an exit(). - */ - -extern int _NXHandleDisplayError; - -/* - * The function below is called whenever Xlib is - * going to perform an I/O operation. The funct- - * ion can be redefined to include additional - * checks aimed at detecting if the display needs - * to be closed, for example because of an event - * or a signal mandating the end of the session. - * In this way the client program can regain the - * control before Xlib blocks waiting for input - * from the network. - */ - -typedef int (*NXDisplayErrorPredicate)( -#if NeedFunctionPrototypes - Display* /* display */, - int /* reason */ -#endif -); - -extern NXDisplayErrorPredicate _NXDisplayErrorFunction; - -/* - * This is called when Xlib is going to block - * waiting for the display to become readable or - * writable. The client can use the hook to run - * any arbitrary operation that may require some - * time to complete. The user should not try to - * read or write to the display inside the call- - * back routine. - */ - -typedef void (*NXDisplayBlockHandler)( -#if NeedFunctionPrototypes - Display* /* display */, - int /* reason */ -#endif -); - -extern NXDisplayBlockHandler _NXDisplayBlockFunction; - -/* - * Used to notify the program when more data - * is written to the socket. - */ - -typedef void (*NXDisplayWriteHandler)( -#if NeedFunctionPrototypes - Display* /* display */, - int /* length */ -#endif -); - -extern NXDisplayWriteHandler _NXDisplayWriteFunction; - -/* - * This callback is used to notify the agent - * that the proxy link has been flushed. - */ - -typedef void (*NXDisplayFlushHandler)( -#if NeedFunctionPrototypes - Display* /* display */, - int /* length */ -#endif -); - -extern NXDisplayFlushHandler _NXDisplayFlushFunction; - -/* - * Used by the NX transport to get an arbitrary - * string to add to its protocol statistics. - */ - -typedef void (*NXDisplayStatisticsHandler)( -#if NeedFunctionPrototypes - Display* /* display */, - char* /* buffer */, - int /* size */ -#endif -); - -extern NXDisplayStatisticsHandler _NXDisplayStatisticsFunction; - -/* - * Let users redefine the function printing an - * error message in the case of a out-of-order - * sequence number. - */ - -typedef void (*NXLostSequenceHandler)( -#if NeedFunctionPrototypes - Display* /* display */, - unsigned long /* newseq */, - unsigned long /* lastseq */, - unsigned int /* type */ -#endif -); - -extern NXLostSequenceHandler _NXLostSequenceFunction; - -/* - * Let the X server run the children processes - * (as for example the keyboard initialization - * utilities) by using the native system libra- - * ries, instead of the libraries shipped with - * the NX environment. If set, the Popen() in - * the X server will remove the LD_LIBRARY_PATH - * setting from the environment before calling - * the execl() function in the child process. - */ - -extern int _NXUnsetLibraryPath; - -#ifdef __cplusplus -} -#endif - -#endif /* NXvars_H */ diff --git a/nxcomp/OpcodeCache.h b/nxcomp/OpcodeCache.h deleted file mode 100644 index e07a1b997..000000000 --- a/nxcomp/OpcodeCache.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef OpcodeCache_H -#define OpcodeCache_H - -#include "CharCache.h" - -class OpcodeCache -{ - friend class EncodeBuffer; - friend class DecodeBuffer; - - public: - - OpcodeCache() - { - slot_ = 0; - } - - ~OpcodeCache() - { - } - - private: - - CharCache base_[256]; - unsigned char slot_; -}; - -#endif /* OpcodeCache_H */ diff --git a/nxcomp/OpcodeStore.cpp b/nxcomp/OpcodeStore.cpp deleted file mode 100644 index 66a425d53..000000000 --- a/nxcomp/OpcodeStore.cpp +++ /dev/null @@ -1,84 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "OpcodeStore.h" - -OpcodeStore::OpcodeStore() -{ - // - // Assign values of the specific - // NX opcodes. - // - - getControlParameters = X_NXGetControlParameters; - getCleanupParameters = X_NXGetCleanupParameters; - getImageParameters = X_NXGetImageParameters; - getUnpackParameters = X_NXGetUnpackParameters; - getShmemParameters = X_NXGetShmemParameters; - getFontParameters = X_NXGetFontParameters; - - startSplit = X_NXStartSplit; - endSplit = X_NXEndSplit; - commitSplit = X_NXCommitSplit; - finishSplit = X_NXFinishSplit; - abortSplit = X_NXAbortSplit; - - splitData = X_NXSplitData; - splitEvent = X_NXSplitEvent; - - setCacheParameters = X_NXSetCacheParameters; - setExposeParameters = X_NXSetExposeParameters; - - setUnpackGeometry = X_NXSetUnpackGeometry; - setUnpackColormap = X_NXSetUnpackColormap; - setUnpackAlpha = X_NXSetUnpackAlpha; - - putPackedImage = X_NXPutPackedImage; - - freeUnpack = X_NXFreeUnpack; - freeSplit = X_NXFreeSplit; - - // - // These values must be fetched - // from the X server. - // - - shapeExtension = 0; - renderExtension = 0; - - // - // Events sent as ClientMessage. - // - - noSplitNotify = NXNoSplitNotify; - startSplitNotify = NXStartSplitNotify; - commitSplitNotify = NXCommitSplitNotify; - endSplitNotify = NXEndSplitNotify; - emptySplitNotify = NXEmptySplitNotify; -} - -OpcodeStore::~OpcodeStore() -{ -} diff --git a/nxcomp/OpcodeStore.h b/nxcomp/OpcodeStore.h deleted file mode 100644 index d041ed4b8..000000000 --- a/nxcomp/OpcodeStore.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef OpcodeStore_H -#define OpcodeStore_H - -#include "NXproto.h" - -class OpcodeStore -{ - public: - - OpcodeStore(); - - ~OpcodeStore(); - - // - // Map NX protocol messages. At the moment mapping is hard- - // coded. Opcodes should be instead agreed with the proxied - // X server (by excluding all opcodes used for extensions) - // and exported by the proxy class to channels. - // - // Some toolkits query the server only once for extensions' - // opcodes and share the same settings across all channels. - // This could be a problem as channels needed to monitor the - // traffic to find out the extensions' opcodes themselves, - // so it is important that proxy passes an instance of this - // class to new channels. - // - - unsigned char getControlParameters; - unsigned char getCleanupParameters; - unsigned char getImageParameters; - unsigned char getUnpackParameters; - unsigned char getShmemParameters; - unsigned char getFontParameters; - - unsigned char startSplit; - unsigned char endSplit; - unsigned char commitSplit; - unsigned char finishSplit; - unsigned char abortSplit; - - unsigned char splitData; - unsigned char splitEvent; - - unsigned char setCacheParameters; - unsigned char setExposeParameters; - - unsigned char setUnpackGeometry; - unsigned char setUnpackColormap; - unsigned char setUnpackAlpha; - - unsigned char putPackedImage; - - unsigned char freeUnpack; - unsigned char freeSplit; - - unsigned char shapeExtension; - unsigned char renderExtension; - - unsigned char noSplitNotify; - unsigned char startSplitNotify; - unsigned char commitSplitNotify; - unsigned char endSplitNotify; - unsigned char emptySplitNotify; -}; - -#endif /* OpcodeStore_H */ diff --git a/nxcomp/Pack.c b/nxcomp/Pack.c deleted file mode 100644 index 97fb93b5f..000000000 --- a/nxcomp/Pack.c +++ /dev/null @@ -1,180 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "NXpack.h" - -const ColorMask Mask8TrueColor = { 128, 63, 240, 7 }; -const ColorMask Mask64TrueColor = { 192, 7, 240, 4 }; -const ColorMask Mask256TrueColor = { 255, 0, 255, 0 }; -const ColorMask Mask512TrueColor = { 224, 5, 240, 4 }; -const ColorMask Mask4KTrueColor = { 240, 4, 240, 2 }; -const ColorMask Mask32KTrueColor = { 248, 3, 248, 2 }; -const ColorMask Mask64KTrueColor = { 255, 0, 255, 0 }; -const ColorMask Mask256KTrueColor = { 252, 1, 252, 1 }; -const ColorMask Mask2MTrueColor = { 255, 0, 254, 1 }; -const ColorMask Mask16MTrueColor = { 255, 0, 255, 0 }; - -const ColorMask *MethodColorMask(unsigned int method) -{ - switch (method) - { - case MASK_8_COLORS: - { - return &Mask8TrueColor; - } - case MASK_64_COLORS: - { - return &Mask64TrueColor; - } - case MASK_256_COLORS: - { - return &Mask256TrueColor; - } - case MASK_512_COLORS: - { - return &Mask512TrueColor; - } - case MASK_4K_COLORS: - { - return &Mask4KTrueColor; - } - case MASK_32K_COLORS: - { - return &Mask32KTrueColor; - } - case MASK_64K_COLORS: - { - return &Mask64KTrueColor; - } - case MASK_256K_COLORS: - { - return &Mask256KTrueColor; - } - case MASK_2M_COLORS: - { - return &Mask2MTrueColor; - } - case MASK_16M_COLORS: - { - return &Mask16MTrueColor; - } - default: - { - return NULL; - } - } -} - -int MethodBitsPerPixel(unsigned int method) -{ - switch (method) - { - case PACK_MASKED_8_COLORS: - case PACK_JPEG_8_COLORS: - case PACK_PNG_8_COLORS: - { - return 8; - } - case PACK_MASKED_64_COLORS: - case PACK_JPEG_64_COLORS: - case PACK_PNG_64_COLORS: - { - return 8; - } - case PACK_MASKED_256_COLORS: - case PACK_JPEG_256_COLORS: - case PACK_PNG_256_COLORS: - { - return 8; - } - case PACK_MASKED_512_COLORS: - case PACK_JPEG_512_COLORS: - case PACK_PNG_512_COLORS: - { - return 16; - } - case PACK_MASKED_4K_COLORS: - case PACK_JPEG_4K_COLORS: - case PACK_PNG_4K_COLORS: - { - return 16; - } - case PACK_MASKED_32K_COLORS: - case PACK_JPEG_32K_COLORS: - case PACK_PNG_32K_COLORS: - { - return 16; - } - case PACK_MASKED_64K_COLORS: - case PACK_JPEG_64K_COLORS: - case PACK_PNG_64K_COLORS: - { - return 16; - } - case PACK_MASKED_256K_COLORS: - case PACK_JPEG_256K_COLORS: - case PACK_PNG_256K_COLORS: - { - return 24; - } - case PACK_MASKED_2M_COLORS: - case PACK_JPEG_2M_COLORS: - case PACK_PNG_2M_COLORS: - { - return 24; - } - case PACK_MASKED_16M_COLORS: - case PACK_JPEG_16M_COLORS: - case PACK_PNG_16M_COLORS: - { - return 24; - } - case PACK_BITMAP_16M_COLORS: - case PACK_RGB_16M_COLORS: - case PACK_RLE_16M_COLORS: - { - return 24; - } - default: - { - return 0; - } - } -} - -#ifdef __cplusplus -} -#endif diff --git a/nxcomp/Pgn.cpp b/nxcomp/Pgn.cpp deleted file mode 100644 index 17e1702d4..000000000 --- a/nxcomp/Pgn.cpp +++ /dev/null @@ -1,805 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// This file obviously supports PNG -// decompression. It was renamed to -// avoid name clashes on Windows. -// - -#include - -#ifdef ANDROID -#include -#endif -#include -#include -#include - -#include "Unpack.h" -#include "Pgn.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define RGB24_TO_PIXEL(bpp,r,g,b) \ - ((((CARD##bpp)(r) & 0xFF) * srcRedMax2 + 127) / 255 \ - << srcRedShift2 | \ - (((CARD##bpp)(g) & 0xFF) * srcGreenMax2 + 127) / 255 \ - << srcGreenShift2 | \ - (((CARD##bpp)(b) & 0xFF) * srcBlueMax2 + 127) / 255 \ - << srcBlueShift2) - -#define RGB24_TO_PIXEL32(r,g,b) \ - (((CARD32)(r) & 0xFF) << srcRedShift2 | \ - ((CARD32)(g) & 0xFF) << srcGreenShift2 | \ - ((CARD32)(b) & 0xFF) << srcBlueShift2) - -// -// Functions from Unpack.cpp -// - -extern int Unpack32To32(const T_colormask *colormask, const unsigned int *data, - unsigned int *out, unsigned int *end); - -extern int Unpack24To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -extern int Unpack16To16(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -// -// Local functions used for the png decompression. -// - -static int DecompressPng16(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, - int byteOrder); - -static int DecompressPng24(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, - int byteOrder); - -static int DecompressPng32(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, - int byteOrder); - -static void PngReadData(png_structp png_ptr, png_bytep data, png_size_t length); - -// -// Colormap stuff. -// - -CARD16 srcRedMax2, srcGreenMax2, srcBlueMax2; -CARD8 srcRedShift2, srcGreenShift2, srcBlueShift2; - -// -// Attributes used for the png decompression. -// - -static char *tmpBuf; -static int tmpBufSize = 0; -static int streamPos; - -int UnpackPng(T_geometry *geometry, unsigned char method, unsigned char *srcData, - int srcSize, int dstBpp, int dstWidth, int dstHeight, - unsigned char *dstData, int dstSize) -{ - int byteOrder = geometry -> image_byte_order; - - // - // Check if data is coming from a failed unsplit. - // - - if (srcSize < 2 || (srcData[0] == SPLIT_PATTERN && - srcData[1] == SPLIT_PATTERN)) - { - #ifdef WARNING - *logofs << "UnpackPng: WARNING! Skipping unpack of dummy data.\n" - << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << "UnpackPng: Decompressing image with " - << "srcSize " << srcSize << " and bpp " - << dstBpp << ".\n" << logofs_flush; - #endif - - srcRedShift2 = ffs(geometry -> red_mask) - 1; - srcGreenShift2 = ffs(geometry -> green_mask) - 1; - srcBlueShift2 = ffs(geometry -> blue_mask) - 1; - srcRedMax2 = geometry -> red_mask >> srcRedShift2; - srcGreenMax2 = geometry -> green_mask >> srcGreenShift2; - srcBlueMax2 = geometry -> blue_mask >> srcBlueShift2; - - // - // Make enough space in the temporary - // buffer to have one complete row of - // the image with 3 bytes per pixel. - // - - tmpBufSize = dstWidth * 3; - tmpBuf = new char [tmpBufSize]; - - if (tmpBuf == NULL) - { - #ifdef PANIC - *logofs << "UnpackPng: PANIC! Cannot allocate " - << dstWidth * 3 << " bytes for PNG " - << "decompressed data.\n" << logofs_flush; - #endif - - delete [] tmpBuf; - - return -1; - } - - int result = 1; - - switch (dstBpp) - { - case 8: - { - // - // Simply move the data from srcData to dstData - // taking into consideration the correct padding. - // - - int row; - - unsigned char * dstBuff = dstData; - unsigned char * srcBuff = srcData; - - for (row = 0; row < dstHeight; row++) - { - memcpy(dstBuff, srcBuff, dstWidth ); - - dstBuff += RoundUp4(dstWidth); - srcBuff += dstWidth; - } - } - case 16: - { - result = DecompressPng16(srcData, srcSize, dstWidth, - dstHeight, dstData, byteOrder); - break; - } - case 24: - { - result = DecompressPng24(srcData, srcSize, dstWidth, - dstHeight, dstData, byteOrder); - break; - } - case 32: - { - result = DecompressPng32(srcData, srcSize, dstWidth, - dstHeight, dstData, byteOrder); - break; - } - default: - { - #ifdef PANIC - *logofs << "UnpackPng: PANIC! Error in PNG compression. " - << " Unsupported Bpp value " << dstBpp - << " for the PNG compression" - << ".\n" << logofs_flush; - #endif - - delete [] tmpBuf; - - result = -1; - } - } - - if (result == -1) - { - delete [] tmpBuf; - - return result; - } - - // - // Apply the correction for the brightness - // - - int maskMethod; - - switch (method) - { - case PACK_PNG_8_COLORS: - { - maskMethod = MASK_8_COLORS; - - break; - } - case PACK_PNG_64_COLORS: - { - maskMethod = MASK_64_COLORS; - - break; - } - case PACK_PNG_256_COLORS: - { - maskMethod = MASK_256_COLORS; - - break; - } - case PACK_PNG_512_COLORS: - { - maskMethod = MASK_512_COLORS; - - break; - } - case PACK_PNG_4K_COLORS: - { - maskMethod = MASK_4K_COLORS; - - break; - } - case PACK_PNG_32K_COLORS: - { - maskMethod = MASK_32K_COLORS; - - break; - } - case PACK_PNG_64K_COLORS: - { - maskMethod = MASK_64K_COLORS; - - break; - } - case PACK_PNG_256K_COLORS: - { - maskMethod = MASK_256K_COLORS; - - break; - } - case PACK_PNG_2M_COLORS: - { - maskMethod = MASK_2M_COLORS; - - break; - } - case PACK_PNG_16M_COLORS: - { - maskMethod = MASK_16M_COLORS; - - break; - } - default: - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << " No matching decompression method.\n" - << logofs_flush; - #endif - - delete [] tmpBuf; - - return -1; - } - } - - const T_colormask *colorMask = MethodColorMask(maskMethod); - - unsigned char *dstBuff = dstData; - - switch (dstBpp) - { - case 16: - { - Unpack16To16(colorMask, dstBuff, dstBuff, dstBuff + dstSize); - - break; - } - case 24: - { - break; - } - case 32: - { - Unpack32To32(colorMask, (unsigned int *)dstBuff, (unsigned int *)dstBuff, - (unsigned int *)(dstBuff + dstSize)); - break; - } - default: - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << " No matching destination bits per plane.\n" - << logofs_flush; - #endif - - delete [] tmpBuf; - - return -1; - } - } - - delete [] tmpBuf; - - return 1; -} - - -// -// Functions that actually do -// the PNG decompression. -// - -int DecompressPng16(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) -{ - unsigned char *data; - unsigned int dx, dy; - - png_structp pngPtr; - png_infop infoPtr; - png_bytep rowPointers; - - - streamPos = 0; - - pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - if (!pngPtr) - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << " Failed png_create_read_struct operation" - << ".\n" << logofs_flush; - #endif - - return -1; - } - - infoPtr = png_create_info_struct(pngPtr); - - if (!infoPtr) - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << "Failed png_create_info_struct operation" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, NULL, NULL); - - return -1; - } - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << "Error during IO initialization" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << "Error during read of PNG header" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - png_read_info(pngPtr, infoPtr); - - if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) - { - png_set_expand(pngPtr); - } - - // - // data points to dstBuf which is - // already padded correctly for the final - // image to put - // - - data = dstBuf; - rowPointers = (png_byte *) tmpBuf; - - // - // We use setjmp() to save our context. - // The PNG library will call longjmp() - // in case of error. - // - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng16: PANIC! " - << "Error during read of PNG rows" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - unsigned long pixel; - - for (dy = 0; dy < h; dy++) - { - png_read_row(pngPtr, rowPointers, NULL); - - for (dx = 0; dx < w; dx++) - { - pixel = RGB24_TO_PIXEL(16, tmpBuf[dx*3], tmpBuf[dx*3+1], tmpBuf[dx*3+2]); - - // - // Follow the server byte order when arranging data. - // - - if (byteOrder == LSBFirst) - { - data[0] = (unsigned char) (pixel & 0xff); - data[1] = (unsigned char) ((pixel >> 8) & 0xff); - } - else - { - data[1] = (unsigned char) (pixel & 0xff); - data[0] = (unsigned char) ((pixel >> 8) & 0xff); - } - - data += 2; - } - - // - // Move pixelPtr at the beginning of the - // next line. - // - - data = data + (RoundUp4(w * 2) - w * 2); - } - - png_destroy_read_struct(&pngPtr, &infoPtr,NULL); - - #ifdef DEBUG - *logofs << "DecompressPng16: Decompression finished." - << dy << " lines handled.\n" - << logofs_flush; - #endif - - return 1; -} - -int DecompressPng24(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) -{ - static CARD8 *pixelPtr = NULL; - unsigned int dx, dy; - - png_structp pngPtr; - png_infop infoPtr; - png_bytep rowPointers; - - - streamPos = 0; - - pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - if (!pngPtr) - { - #ifdef PANIC - *logofs << "DecompressPng24: PANIC! " - << "Failed png_create_read_struct operation" - << ".\n" << logofs_flush; - #endif - - return -1; - } - - infoPtr = png_create_info_struct(pngPtr); - - if (!infoPtr) - { - #ifdef PANIC - *logofs << "DecompressPng24: PANIC! " - << "Failed png_create_info_struct operation" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, NULL, NULL); - - return -1; - } - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng24: PANIC! " - << "Error during IO initialization" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng24: PANIC! " - << "Error during read of PNG header" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - png_read_info( pngPtr, infoPtr ) ; - - if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) - { - png_set_expand(pngPtr); - } - - // - // PixelPtr points to dstBuf which is - // already padded correctly for the final - // image to put - // - - pixelPtr = (CARD8 *) dstBuf; - - rowPointers = (png_byte *)tmpBuf; - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng24: PANIC! " - << "Error during read of PNG rows" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - for (dy = 0; dy < h; dy++) - { - png_read_row(pngPtr, rowPointers, NULL); - - for (dx = 0; dx < w; dx++) - { - // - // Follow the server byte order when arranging data. - // - - if (byteOrder == LSBFirst) - { - pixelPtr[0] = tmpBuf[dx * 3]; - pixelPtr[1] = tmpBuf[dx * 3 + 1]; - pixelPtr[2] = tmpBuf[dx * 3 + 2]; - } - else - { - pixelPtr[2] = tmpBuf[dx * 3]; - pixelPtr[1] = tmpBuf[dx * 3 + 1]; - pixelPtr[0] = tmpBuf[dx * 3 + 2]; - } - - pixelPtr += 3; - } - - // - // Go to the next line. - // - - pixelPtr = (CARD8 *) (((char *) pixelPtr) + (RoundUp4(w * 3) - w * 3)); - } - - png_destroy_read_struct(&pngPtr, &infoPtr,NULL); - - #ifdef DEBUG - *logofs << "DecompressPng24: Decompression finished." - << dy << " lines handled.\n" - << logofs_flush; - #endif - - return 1; -} - -int DecompressPng32(unsigned char *compressedData, int compressedLen, - unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) -{ - unsigned char *data; - - unsigned int dx, dy; - - png_structp pngPtr; - png_infop infoPtr; - png_bytep rowPointers; - - streamPos = 0; - - pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); - - if (!pngPtr) - { - #ifdef PANIC - *logofs << "DecompressPng32: PANIC! " - << "Failed png_create_read_struct operation" - << ".\n" << logofs_flush; - #endif - - return -1; - } - - infoPtr = png_create_info_struct(pngPtr); - - if (!infoPtr) - { - #ifdef PANIC - *logofs << "DecompressPng32: PANIC! " - << "Failed png_create_info_struct operation." - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, NULL, NULL); - - return -1; - } - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng32: PANIC! " - << "Error during IO initialization" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng32: PANIC! " - << "Error during read of PNG header" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - png_read_info(pngPtr, infoPtr) ; - - - if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) - { - png_set_expand(pngPtr); - } - - // - // data points to dstBuf which is - // already padded correctly for the final - // image to put - // - - data = dstBuf; - - rowPointers = (png_byte *) tmpBuf; - - if (setjmp(png_jmpbuf(pngPtr))) - { - #ifdef PANIC - *logofs << "DecompressPng32: PANIC! " - << "Error during read of PNG rows" - << ".\n" << logofs_flush; - #endif - - png_destroy_read_struct(&pngPtr, &infoPtr, NULL); - - return -1; - } - - unsigned long pixel; - - int i; - - for (dy = 0; dy < h; dy++) - { - png_read_row(pngPtr, rowPointers, NULL); - - for (dx = 0; dx < w; dx++) - { - pixel = RGB24_TO_PIXEL(32, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], - tmpBuf[dx * 3 + 2]); - - // - // Follow the server byte order when arranging data. - // - - if (byteOrder == LSBFirst) - { - for (i = 0; i < 4; i++) - { - data[i] = (unsigned char)(pixel & 0xff); - pixel >>= 8; - } - } - else - { - for (i = 3; i >= 0; i--) - { - data[i] = (unsigned char) (pixel & 0xff); - pixel >>= 8; - } - } - - data += 4; - } - } - - png_destroy_read_struct(&pngPtr, &infoPtr,NULL); - - #ifdef DEBUG - *logofs << "DecompressPng32: Decompression finished." - << dy << " lines handled.\n" - << logofs_flush; - #endif - - return 1; -} - -static void PngReadData(png_structp png_ptr, png_bytep data, png_size_t length) -{ - memcpy((char *) data, (char *) png_get_io_ptr(png_ptr) + streamPos, length); - - streamPos += length; -} diff --git a/nxcomp/Pgn.h b/nxcomp/Pgn.h deleted file mode 100644 index e5ea36715..000000000 --- a/nxcomp/Pgn.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Pgn_H -#define Pgn_H - -// -// This file obviously supports PNG -// decompression. It was renamed to -// avoid name clashes on Windows. -// - -#include "Misc.h" -#include "Unpack.h" - -int UnpackPng(T_geometry *geometry, unsigned char method, unsigned char *srcData, - int srcSize, int dstBpp, int dstWidth, int dstHeight, - unsigned char *dstData, int dstSize); - -#endif /* Pgn_H */ diff --git a/nxcomp/Pipe.cpp b/nxcomp/Pipe.cpp deleted file mode 100644 index 88f10edb4..000000000 --- a/nxcomp/Pipe.cpp +++ /dev/null @@ -1,429 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#include "Pipe.h" -#include "Misc.h" -#include "Fork.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -extern void RegisterChild(int child); - -static int Psplit(const char *command, char *parameters[], int limit); - -// -// These are slightly modified versions of popen(3) and pclose(3) -// that don't rely on a shell to be available on the system, so -// that they can also work on Windows. As an additional benefit, -// these functions give up all privileges before running the com- -// mand. Code is taken from the X distribution and, in turn, is -// based on libc from FreeBSD 2.2. -// - -static struct pid -{ - struct pid *next; - FILE *fp; - int self; - -} *pidlist; - -// -// A very unsofisticated attempt to parse the command line and -// split each parameter in distinct strings. This is not going -// to work when dealing with parameters containing spaces, even -// if they are enclosed in quotes. -// - -int Psplit(const char *command, char *parameters[], int limit) -{ - char *line; - char *value; - - int number; - - // - // Preapare the list of parameters. - // - - for (number = 0; number < limit; number++) - { - parameters[number] = NULL; - } - - // - // Copy the command to get rid of the - // const qualifier. - // - - line = new char[strlen(command) + 1]; - - if (line == NULL) - { - goto PsplitError; - } - - strcpy(line, command); - - number = 0; - - value = strtok(line, " "); - - while (value != NULL && number < limit) - { - #ifdef DEBUG - *logofs << "Psplit: Got parameter '" << value - << "'.\n" << logofs_flush; - #endif - - parameters[number] = new char[strlen(value) + 1]; - - if (parameters[number] == NULL) - { - goto PsplitError; - } - - strcpy(parameters[number], value); - - number++; - - // - // If this is the first parameter, then - // copy it in the second position and - // use it as the name of the command. - // - - if (number == 1) - { - parameters[number] = new char[strlen(value) + 1]; - - if (parameters[number] == NULL) - { - goto PsplitError; - } - - strcpy(parameters[number], value); - - number++; - } - - value = strtok(NULL, " "); - } - - // - // Needs at least to have the command itself and - // the first argument, being again the name of - // the command. - // - - if (number < 2) - { - goto PsplitError; - } - - return number; - -PsplitError: - - #ifdef PANIC - *logofs << "Psplit: PANIC! Can't split command line '" - << command << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't split command line '" - << command << "'.\n"; - - delete [] line; - - return -1; -} - -FILE *Popen(char * const parameters[], const char *type) -{ - FILE *iop; - - struct pid *cur; - int pdes[2], pid; - - if (parameters == NULL || type == NULL) - { - return NULL; - } - - if ((*type != 'r' && *type != 'w') || type[1]) - { - return NULL; - } - - if ((cur = (struct pid *) malloc(sizeof(struct pid))) == NULL) - { - return NULL; - } - - if (pipe(pdes) < 0) - { - free(cur); - - return NULL; - } - - // - // Block all signals until command is exited. - // We need to gather information about the - // child in Pclose(). - // - - DisableSignals(); - - switch (pid = Fork()) - { - case -1: - { - // - // Error. - // - - #ifdef PANIC - *logofs << "Popen: PANIC! Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Function fork failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - close(pdes[0]); - close(pdes[1]); - - free(cur); - - return NULL; - } - case 0: - { - // - // Child. - // - - struct passwd *pwent = getpwuid(getuid()); - if (pwent) initgroups(pwent->pw_name,getgid()); - if (setgid(getgid()) == -1) - { - _exit(127); - } - if (setuid(getuid()) == -1) - { - _exit(127); - } - - if (*type == 'r') - { - if (pdes[1] != 1) - { - // - // Set up stdout. - // - - dup2(pdes[1], 1); - close(pdes[1]); - } - - close(pdes[0]); - } - else - { - if (pdes[0] != 0) - { - // - // Set up stdin. - // - - dup2(pdes[0], 0); - close(pdes[0]); - } - - close(pdes[1]); - } - - execvp(parameters[0], parameters + 1); - - exit(127); - } - } - - // - // Parent. Save data about the child. - // - - RegisterChild(pid); - - if (*type == 'r') - { - iop = fdopen(pdes[0], type); - - close(pdes[1]); - } - else - { - iop = fdopen(pdes[1], type); - - close(pdes[0]); - } - - cur -> fp = iop; - cur -> self = pid; - cur -> next = pidlist; - - pidlist = cur; - - #ifdef TEST - *logofs << "Popen: Executing "; - - for (int i = 0; i < 256 && parameters[i] != NULL; i++) - { - *logofs << "[" << parameters[i] << "]"; - } - - *logofs << " with descriptor " << fileno(iop) - << ".\n" << logofs_flush; - #endif - - return iop; -} - -FILE *Popen(const char *command, const char *type) -{ - char *parameters[256]; - - if (Psplit(command, parameters, 256) > 0) - { - FILE *file = Popen(parameters, type); - - for (int i = 0; i < 256; i++) - { - delete [] parameters[i]; - } - - return file; - } - else - { - #ifdef PANIC - *logofs << "Popen: PANIC! Failed to parse command '" - << command << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to parse command '" - << command << "'.\n"; - - return NULL; - } -} - -int Pclose(FILE *iop) -{ - struct pid *cur, *last; - - int pstat; - int pid; - - #ifdef TEST - *logofs << "Pclose: Closing command with output " - << "on descriptor " << fileno(iop) << ".\n" - << logofs_flush; - #endif - - fclose((FILE *) iop); - - for (last = NULL, cur = pidlist; cur; last = cur, cur = cur -> next) - { - if (cur -> fp == iop) - { - break; - } - } - - if (cur == NULL) - { - #ifdef PANIC - *logofs << "Pclose: PANIC! Failed to find the process " - << "for descriptor " << fileno(iop) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to find the process " - << "for descriptor " << fileno(iop) << ".\n"; - - return -1; - } - - do - { - #ifdef TEST - *logofs << "Pclose: Going to wait for process " - << "with pid '" << cur -> self << "'.\n" - << logofs_flush; - #endif - - pid = waitpid(cur -> self, &pstat, 0); - } - while (pid == -1 && errno == EINTR); - - if (last == NULL) - { - pidlist = cur -> next; - } - else - { - last -> next = cur -> next; - } - - free(cur); - - // - // Child has finished and we called the - // waitpid(). We can enable signals again. - // - - EnableSignals(); - - return (pid == -1 ? -1 : pstat); -} diff --git a/nxcomp/Pipe.h b/nxcomp/Pipe.h deleted file mode 100644 index fd1061d30..000000000 --- a/nxcomp/Pipe.h +++ /dev/null @@ -1,35 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// These are slightly modified versions of popen(3) and pclose(3) -// that don't rely on a shell to be available on the system, so -// that they can also work on Windows. -// - -extern FILE *Popen(char * const parameters[], const char *type); -extern FILE *Popen(const char *command, const char *type); - -extern int Pclose(FILE *file); diff --git a/nxcomp/PolyArc.cpp b/nxcomp/PolyArc.cpp deleted file mode 100644 index 8996c6f15..000000000 --- a/nxcomp/PolyArc.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyArc.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyArcStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyArcMessage *polyArc = (PolyArcMessage *) message; - - // - // Here is the fingerprint. - // - - polyArc -> drawable = GetULONG(buffer + 4, bigEndian); - polyArc -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyArcStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyArcMessage *polyArc = (PolyArcMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(polyArc -> drawable, buffer + 4, bigEndian); - PutULONG(polyArc -> gcontext, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyArcStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyArcMessage *polyArc = (PolyArcMessage *) message; - - *logofs << name() << ": Identity drawable " << polyArc -> drawable - << ", gcontext " << polyArc -> gcontext - << ", size " << polyArc -> size_ << ".\n" << logofs_flush; - #endif -} - -void PolyArcStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void PolyArcStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyArcMessage *polyArc = (PolyArcMessage *) message; - PolyArcMessage *cachedPolyArc = (PolyArcMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyArc -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyArc -> drawable, clientCache -> drawableCache); - - cachedPolyArc -> drawable = polyArc -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyArc -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyArc -> gcontext, clientCache -> gcCache); - - cachedPolyArc -> gcontext = polyArc -> gcontext; -} - -void PolyArcStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyArcMessage *polyArc = (PolyArcMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyArc -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyArc -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyArc -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyArc -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/PolyArc.h b/nxcomp/PolyArc.h deleted file mode 100644 index d744d6a10..000000000 --- a/nxcomp/PolyArc.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyArc_H -#define PolyArc_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYARC_ENABLE_CACHE 1 -#define POLYARC_ENABLE_DATA 0 -#define POLYARC_ENABLE_SPLIT 0 -#define POLYARC_ENABLE_COMPRESS 0 - -#define POLYARC_DATA_LIMIT 1980 -#define POLYARC_DATA_OFFSET 12 - -#define POLYARC_CACHE_SLOTS 2000 -#define POLYARC_CACHE_THRESHOLD 2 -#define POLYARC_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyArcMessage : public Message -{ - friend class PolyArcStore; - - public: - - PolyArcMessage() - { - } - - ~PolyArcMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int drawable; - unsigned int gcontext; -}; - -class PolyArcStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyArcStore() : MessageStore() - { - enableCache = POLYARC_ENABLE_CACHE; - enableData = POLYARC_ENABLE_DATA; - enableSplit = POLYARC_ENABLE_SPLIT; - enableCompress = POLYARC_ENABLE_COMPRESS; - - dataLimit = POLYARC_DATA_LIMIT; - dataOffset = POLYARC_DATA_OFFSET; - - cacheSlots = POLYARC_CACHE_SLOTS; - cacheThreshold = POLYARC_CACHE_THRESHOLD; - cacheLowerThreshold = POLYARC_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyArcStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyArc"; - } - - virtual unsigned char opcode() const - { - return X_PolyArc; - } - - virtual unsigned int storage() const - { - return sizeof(PolyArcMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyArcMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PolyArcMessage((const PolyArcMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyArcMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyArc_H */ diff --git a/nxcomp/PolyFillArc.cpp b/nxcomp/PolyFillArc.cpp deleted file mode 100644 index f995a8815..000000000 --- a/nxcomp/PolyFillArc.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyFillArc.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyFillArcStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; - - // - // Here is the fingerprint. - // - - polyFillArc -> drawable = GetULONG(buffer + 4, bigEndian); - polyFillArc -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyFillArcStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(polyFillArc -> drawable, buffer + 4, bigEndian); - PutULONG(polyFillArc -> gcontext, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyFillArcStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; - - *logofs << name() << ": Identity drawable " << polyFillArc -> drawable - << ", gcontext " << polyFillArc -> gcontext - << ", size " << polyFillArc -> size_ << ".\n" << logofs_flush; - #endif -} - -void PolyFillArcStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void PolyFillArcStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; - PolyFillArcMessage *cachedPolyFillArc = (PolyFillArcMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyFillArc -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyFillArc -> drawable, clientCache -> drawableCache); - - cachedPolyFillArc -> drawable = polyFillArc -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyFillArc -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyFillArc -> gcontext, clientCache -> gcCache); - - cachedPolyFillArc -> gcontext = polyFillArc -> gcontext; -} - -void PolyFillArcStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyFillArc -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyFillArc -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyFillArc -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyFillArc -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/PolyFillArc.h b/nxcomp/PolyFillArc.h deleted file mode 100644 index a4eff5b48..000000000 --- a/nxcomp/PolyFillArc.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyFillArc_H -#define PolyFillArc_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYFILLARC_ENABLE_CACHE 1 -#define POLYFILLARC_ENABLE_DATA 0 -#define POLYFILLARC_ENABLE_SPLIT 0 -#define POLYFILLARC_ENABLE_COMPRESS 0 - -#define POLYFILLARC_DATA_LIMIT 6144 -#define POLYFILLARC_DATA_OFFSET 12 - -#define POLYFILLARC_CACHE_SLOTS 2000 -#define POLYFILLARC_CACHE_THRESHOLD 2 -#define POLYFILLARC_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyFillArcMessage : public Message -{ - friend class PolyFillArcStore; - - public: - - PolyFillArcMessage() - { - } - - ~PolyFillArcMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int drawable; - unsigned int gcontext; -}; - -class PolyFillArcStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyFillArcStore() : MessageStore() - { - enableCache = POLYFILLARC_ENABLE_CACHE; - enableData = POLYFILLARC_ENABLE_DATA; - enableSplit = POLYFILLARC_ENABLE_SPLIT; - enableCompress = POLYFILLARC_ENABLE_COMPRESS; - - dataLimit = POLYFILLARC_DATA_LIMIT; - dataOffset = POLYFILLARC_DATA_OFFSET; - - cacheSlots = POLYFILLARC_CACHE_SLOTS; - cacheThreshold = POLYFILLARC_CACHE_THRESHOLD; - cacheLowerThreshold = POLYFILLARC_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyFillArcStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyFillArc"; - } - - virtual unsigned char opcode() const - { - return X_PolyFillArc; - } - - virtual unsigned int storage() const - { - return sizeof(PolyFillArcMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyFillArcMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PolyFillArcMessage((const PolyFillArcMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyFillArcMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyFillArc_H */ diff --git a/nxcomp/PolyFillRectangle.cpp b/nxcomp/PolyFillRectangle.cpp deleted file mode 100644 index d0f1452b2..000000000 --- a/nxcomp/PolyFillRectangle.cpp +++ /dev/null @@ -1,156 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyFillRectangle.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyFillRectangleStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; - - // - // Here is the fingerprint. - // - - polyFillRectangle -> drawable = GetULONG(buffer + 4, bigEndian); - polyFillRectangle -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyFillRectangleStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(polyFillRectangle -> drawable, buffer + 4, bigEndian); - PutULONG(polyFillRectangle -> gcontext, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyFillRectangleStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; - - *logofs << name() << ": Identity drawable " << polyFillRectangle -> drawable - << ", gcontext " << polyFillRectangle -> gcontext - << ", size " << polyFillRectangle -> size_ << ".\n" << logofs_flush; - #endif -} - -void PolyFillRectangleStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void PolyFillRectangleStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; - PolyFillRectangleMessage *cachedPolyFillRectangle = (PolyFillRectangleMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding value " << polyFillRectangle -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyFillRectangle -> drawable, clientCache -> drawableCache); - - cachedPolyFillRectangle -> drawable = polyFillRectangle -> drawable; - - #ifdef DEBUG - *logofs << name() << ": Encoding value " << polyFillRectangle -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyFillRectangle -> gcontext, clientCache -> gcCache); - - cachedPolyFillRectangle -> gcontext = polyFillRectangle -> gcontext; -} - -void PolyFillRectangleStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyFillRectangle -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyFillRectangle -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyFillRectangle -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyFillRectangle -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/PolyFillRectangle.h b/nxcomp/PolyFillRectangle.h deleted file mode 100644 index 7ebb9270d..000000000 --- a/nxcomp/PolyFillRectangle.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyFillRectangle_H -#define PolyFillRectangle_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYFILLRECTANGLE_ENABLE_CACHE 1 -#define POLYFILLRECTANGLE_ENABLE_DATA 0 -#define POLYFILLRECTANGLE_ENABLE_SPLIT 0 -#define POLYFILLRECTANGLE_ENABLE_COMPRESS 0 - -#define POLYFILLRECTANGLE_DATA_LIMIT 2048 -#define POLYFILLRECTANGLE_DATA_OFFSET 12 - -#define POLYFILLRECTANGLE_CACHE_SLOTS 4000 -#define POLYFILLRECTANGLE_CACHE_THRESHOLD 5 -#define POLYFILLRECTANGLE_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyFillRectangleMessage : public Message -{ - friend class PolyFillRectangleStore; - - public: - - PolyFillRectangleMessage() - { - } - - ~PolyFillRectangleMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int drawable; - unsigned int gcontext; -}; - -class PolyFillRectangleStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyFillRectangleStore() : MessageStore() - { - enableCache = POLYFILLRECTANGLE_ENABLE_CACHE; - enableData = POLYFILLRECTANGLE_ENABLE_DATA; - enableSplit = POLYFILLRECTANGLE_ENABLE_SPLIT; - enableCompress = POLYFILLRECTANGLE_ENABLE_COMPRESS; - - dataLimit = POLYFILLRECTANGLE_DATA_LIMIT; - dataOffset = POLYFILLRECTANGLE_DATA_OFFSET; - - cacheSlots = POLYFILLRECTANGLE_CACHE_SLOTS; - cacheThreshold = POLYFILLRECTANGLE_CACHE_THRESHOLD; - cacheLowerThreshold = POLYFILLRECTANGLE_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyFillRectangleStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyFillRectangle"; - } - - virtual unsigned char opcode() const - { - return X_PolyFillRectangle; - } - - virtual unsigned int storage() const - { - return sizeof(PolyFillRectangleMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyFillRectangleMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PolyFillRectangleMessage((const PolyFillRectangleMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyFillRectangleMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyFillRectangle_H */ diff --git a/nxcomp/PolyLine.cpp b/nxcomp/PolyLine.cpp deleted file mode 100644 index 845985728..000000000 --- a/nxcomp/PolyLine.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyLine.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyLineStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyLineMessage *polyLine = (PolyLineMessage *) message; - - // - // Here is the fingerprint. - // - - polyLine -> mode = *(buffer + 1); - - polyLine -> drawable = GetULONG(buffer + 4, bigEndian); - polyLine -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyLineStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyLineMessage *polyLine = (PolyLineMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = polyLine -> mode; - - PutULONG(polyLine -> drawable, buffer + 4, bigEndian); - PutULONG(polyLine -> gcontext, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyLineStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyLineMessage *polyLine = (PolyLineMessage *) message; - - *logofs << name() << ": Identity drawable " << polyLine -> drawable - << ", gcontext " << polyLine -> gcontext - << ", size " << polyLine -> size_ << ".\n" << logofs_flush; - #endif -} - -void PolyLineStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // Since ProtoStep8 (#issue 108) - md5_append(md5_state_, buffer + 1, 1); -} - -void PolyLineStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyLineMessage *polyLine = (PolyLineMessage *) message; - PolyLineMessage *cachedPolyLine = (PolyLineMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyLine -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyLine -> drawable, clientCache -> drawableCache); - - cachedPolyLine -> drawable = polyLine -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyLine -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyLine -> gcontext, clientCache -> gcCache); - - cachedPolyLine -> gcontext = polyLine -> gcontext; -} - -void PolyLineStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyLineMessage *polyLine = (PolyLineMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyLine -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyLine -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyLine -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyLine -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/PolyLine.h b/nxcomp/PolyLine.h deleted file mode 100644 index 66fa5df1a..000000000 --- a/nxcomp/PolyLine.h +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyLine_H -#define PolyLine_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYLINE_ENABLE_CACHE 1 -#define POLYLINE_ENABLE_DATA 0 -#define POLYLINE_ENABLE_SPLIT 0 -#define POLYLINE_ENABLE_COMPRESS 0 - -#define POLYLINE_DATA_LIMIT 144 -#define POLYLINE_DATA_OFFSET 12 - -#define POLYLINE_CACHE_SLOTS 3000 -#define POLYLINE_CACHE_THRESHOLD 3 -#define POLYLINE_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyLineMessage : public Message -{ - friend class PolyLineStore; - - public: - - PolyLineMessage() - { - } - - ~PolyLineMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char mode; - unsigned int drawable; - unsigned int gcontext; -}; - -class PolyLineStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyLineStore() : MessageStore() - { - enableCache = POLYLINE_ENABLE_CACHE; - enableData = POLYLINE_ENABLE_DATA; - enableSplit = POLYLINE_ENABLE_SPLIT; - enableCompress = POLYLINE_ENABLE_COMPRESS; - - dataLimit = POLYLINE_DATA_LIMIT; - dataOffset = POLYLINE_DATA_OFFSET; - - cacheSlots = POLYLINE_CACHE_SLOTS; - cacheThreshold = POLYLINE_CACHE_THRESHOLD; - cacheLowerThreshold = POLYLINE_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyLineStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyLine"; - } - - virtual unsigned char opcode() const - { - return X_PolyLine; - } - - virtual unsigned int storage() const - { - return sizeof(PolyLineMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyLineMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PolyLineMessage((const PolyLineMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyLineMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyLine_H */ diff --git a/nxcomp/PolyPoint.cpp b/nxcomp/PolyPoint.cpp deleted file mode 100644 index dfd77f40b..000000000 --- a/nxcomp/PolyPoint.cpp +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyPoint.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyPointStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyPointMessage *polyPoint = (PolyPointMessage *) message; - - // - // Here is the fingerprint. - // - - polyPoint -> mode = *(buffer + 1); - - polyPoint -> drawable = GetULONG(buffer + 4, bigEndian); - polyPoint -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyPointStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyPointMessage *polyPoint = (PolyPointMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = polyPoint -> mode; - - PutULONG(polyPoint -> drawable, buffer + 4, bigEndian); - PutULONG(polyPoint -> gcontext, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyPointStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyPointMessage *polyPoint = (PolyPointMessage *) message; - - *logofs << name() << ": Identity drawable " << polyPoint -> drawable - << ", gcontext " << polyPoint -> gcontext - << ", size " << polyPoint -> size_ << ".\n" << logofs_flush; - #endif -} - -void PolyPointStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // Since ProtoStep8 (#issue 108) - md5_append(md5_state_, buffer + 1, 1); -} - -void PolyPointStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyPointMessage *polyPoint = (PolyPointMessage *) message; - PolyPointMessage *cachedPolyPoint = (PolyPointMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyPoint -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyPoint -> drawable, clientCache -> drawableCache); - - cachedPolyPoint -> drawable = polyPoint -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyPoint -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyPoint -> gcontext, clientCache -> gcCache); - - cachedPolyPoint -> gcontext = polyPoint -> gcontext; -} - -void PolyPointStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyPointMessage *polyPoint = (PolyPointMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyPoint -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyPoint -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyPoint -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyPoint -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/PolyPoint.h b/nxcomp/PolyPoint.h deleted file mode 100644 index b8ea183bf..000000000 --- a/nxcomp/PolyPoint.h +++ /dev/null @@ -1,186 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyPoint_H -#define PolyPoint_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYPOINT_ENABLE_CACHE 1 -#define POLYPOINT_ENABLE_DATA 0 -#define POLYPOINT_ENABLE_SPLIT 0 -#define POLYPOINT_ENABLE_COMPRESS 0 - -#define POLYPOINT_DATA_LIMIT 3200 -#define POLYPOINT_DATA_OFFSET 12 - -#define POLYPOINT_CACHE_SLOTS 3000 -#define POLYPOINT_CACHE_THRESHOLD 3 -#define POLYPOINT_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyPointMessage : public Message -{ - friend class PolyPointStore; - - public: - - PolyPointMessage() - { - } - - ~PolyPointMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char mode; - unsigned int drawable; - unsigned int gcontext; -}; - -class PolyPointStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyPointStore() : MessageStore() - { - enableCache = POLYPOINT_ENABLE_CACHE; - enableData = POLYPOINT_ENABLE_DATA; - enableSplit = POLYPOINT_ENABLE_SPLIT; - enableCompress = POLYPOINT_ENABLE_COMPRESS; - - dataLimit = POLYPOINT_DATA_LIMIT; - dataOffset = POLYPOINT_DATA_OFFSET; - - cacheSlots = POLYPOINT_CACHE_SLOTS; - cacheThreshold = POLYPOINT_CACHE_THRESHOLD; - cacheLowerThreshold = POLYPOINT_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyPointStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyPoint"; - } - - virtual unsigned char opcode() const - { - return X_PolyPoint; - } - - virtual unsigned int storage() const - { - return sizeof(PolyPointMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyPointMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PolyPointMessage((const PolyPointMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyPointMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyPoint_H */ diff --git a/nxcomp/PolySegment.cpp b/nxcomp/PolySegment.cpp deleted file mode 100644 index 34c2461f1..000000000 --- a/nxcomp/PolySegment.cpp +++ /dev/null @@ -1,158 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolySegment.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolySegmentStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolySegmentMessage *polySegment = (PolySegmentMessage *) message; - - // - // Here is the fingerprint. - // - - polySegment -> drawable = GetULONG(buffer + 4, bigEndian); - polySegment -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolySegmentStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolySegmentMessage *polySegment = (PolySegmentMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(polySegment -> drawable, buffer + 4, bigEndian); - PutULONG(polySegment -> gcontext, buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolySegmentStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolySegmentMessage *polySegment = (PolySegmentMessage *) message; - - *logofs << name() << ": Identity drawable " << polySegment -> drawable - << ", gcontext " << polySegment -> gcontext - << ", size " << polySegment -> size_ << ".\n" << logofs_flush; - #endif -} - -void PolySegmentStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void PolySegmentStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolySegmentMessage *polySegment = (PolySegmentMessage *) message; - PolySegmentMessage *cachedPolySegment = (PolySegmentMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polySegment -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polySegment -> drawable, clientCache -> drawableCache); - - cachedPolySegment -> drawable = polySegment -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polySegment -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polySegment -> gcontext, clientCache -> gcCache); - - cachedPolySegment -> gcontext = polySegment -> gcontext; -} - -void PolySegmentStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolySegmentMessage *polySegment = (PolySegmentMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polySegment -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polySegment -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polySegment -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polySegment -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/PolySegment.h b/nxcomp/PolySegment.h deleted file mode 100644 index 53fd42c60..000000000 --- a/nxcomp/PolySegment.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolySegment_H -#define PolySegment_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYSEGMENT_ENABLE_CACHE 1 -#define POLYSEGMENT_ENABLE_DATA 0 -#define POLYSEGMENT_ENABLE_SPLIT 0 -#define POLYSEGMENT_ENABLE_COMPRESS 0 - -#define POLYSEGMENT_DATA_LIMIT 8192 -#define POLYSEGMENT_DATA_OFFSET 12 - -#define POLYSEGMENT_CACHE_SLOTS 3000 -#define POLYSEGMENT_CACHE_THRESHOLD 5 -#define POLYSEGMENT_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolySegmentMessage : public Message -{ - friend class PolySegmentStore; - - public: - - PolySegmentMessage() - { - } - - ~PolySegmentMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int drawable; - unsigned int gcontext; -}; - -class PolySegmentStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolySegmentStore() : MessageStore() - { - enableCache = POLYSEGMENT_ENABLE_CACHE; - enableData = POLYSEGMENT_ENABLE_DATA; - enableSplit = POLYSEGMENT_ENABLE_SPLIT; - enableCompress = POLYSEGMENT_ENABLE_COMPRESS; - - dataLimit = POLYSEGMENT_DATA_LIMIT; - dataOffset = POLYSEGMENT_DATA_OFFSET; - - cacheSlots = POLYSEGMENT_CACHE_SLOTS; - cacheThreshold = POLYSEGMENT_CACHE_THRESHOLD; - cacheLowerThreshold = POLYSEGMENT_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolySegmentStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolySegment"; - } - - virtual unsigned char opcode() const - { - return X_PolySegment; - } - - virtual unsigned int storage() const - { - return sizeof(PolySegmentMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolySegmentMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PolySegmentMessage((const PolySegmentMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolySegmentMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolySegment_H */ diff --git a/nxcomp/PolyText16.cpp b/nxcomp/PolyText16.cpp deleted file mode 100644 index 80c77a70f..000000000 --- a/nxcomp/PolyText16.cpp +++ /dev/null @@ -1,308 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyText16.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyText16Store::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyText16Message *polyText16 = (PolyText16Message *) message; - - // - // Here is the fingerprint. - // - - polyText16 -> drawable = GetULONG(buffer + 4, bigEndian); - polyText16 -> gcontext = GetULONG(buffer + 8, bigEndian); - - polyText16 -> x = GetUINT(buffer + 12, bigEndian); - polyText16 -> y = GetUINT(buffer + 14, bigEndian); - - // - // Clean up padding bytes. - // - - #ifdef DUMP - - DumpData(buffer, size); - - *logofs << "\n" << logofs_flush; - - #endif - - if ((int) size > dataOffset) - { - int current; - int length; - int delta; - int item; - - unsigned int nitem; - - unsigned char *pad = NULL; - unsigned char *end = NULL; - - delta = 1; - nitem = 0; - - #ifdef DUMP - *logofs << name() << " Size " << size << ".\n" << logofs_flush; - #endif - - // - // Data is a list of TextItem where element - // can be a string or a font shift. - // - - current = POLYTEXT16_DATA_OFFSET; - length = POLYTEXT16_DATA_OFFSET; - - do - { - #ifdef DUMP - *logofs << name() << " Current " << current << ".\n" << logofs_flush; - #endif - - item = GetUINT(buffer + length , bigEndian); - - if (item < 255) - { - // - // Text element. Number represents - // the 'Length of CHAR2B string' - // field. - // - - length += ((item * 2) + delta + 1); - - nitem++; - } - else if (item == 255) - { - // - // Element is a font shift. - // - - length += 5; - - nitem++; - } - - #ifdef DUMP - *logofs << name() << " Item " << item << ".\n" << logofs_flush; - #endif - - current += length; - } - while(current < (int) size && item != 0); - - #ifdef DUMP - *logofs << name() << " Final length " << length << ".\n" << logofs_flush; - #endif - - end = ((unsigned char *) buffer) + size; - - pad = ((unsigned char *) buffer) + length; - - for (; pad < end && nitem >= 1; pad++) - { - #ifdef DUMP - *logofs << name() << " Padding " << " .\n" << logofs_flush; - #endif - - *pad = 0; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyText16Store::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyText16Message *polyText16 = (PolyText16Message *) message; - - // - // Fill all the message's fields. - // - - PutULONG(polyText16 -> drawable, buffer + 4, bigEndian); - PutULONG(polyText16 -> gcontext, buffer + 8, bigEndian); - - PutUINT(polyText16 -> x, buffer + 12, bigEndian); - PutUINT(polyText16 -> y, buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyText16Store::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyText16Message *polyText16 = (PolyText16Message *) message; - - *logofs << name() << ": Identity drawable " << polyText16 -> drawable - << ", gcontext " << polyText16 -> gcontext << ", x " << polyText16 -> x - << ", y " << polyText16 -> y << ", size " << polyText16 -> size_ - << ".\n"; - - #endif -} - -void PolyText16Store::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void PolyText16Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyText16Message *polyText16 = (PolyText16Message *) message; - PolyText16Message *cachedPolyText16 = (PolyText16Message *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText16 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyText16 -> drawable, clientCache -> drawableCache); - - cachedPolyText16 -> drawable = polyText16 -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText16 -> gcontext - << " as " << "gcontext" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyText16 -> gcontext, clientCache -> gcCache); - - cachedPolyText16 -> gcontext = polyText16 -> gcontext; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText16 -> x - << " as " << "x" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_x = polyText16 -> x - cachedPolyText16 -> x; - - encodeBuffer.encodeCachedValue(diff_x, 16, - clientCache -> polyTextCacheX); - - cachedPolyText16 -> x = polyText16 -> x; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText16 -> y - << " as " << "y" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_y = polyText16 -> y - cachedPolyText16 -> y; - - encodeBuffer.encodeCachedValue(diff_y, 16, - clientCache -> polyTextCacheY); - - cachedPolyText16 -> y = polyText16 -> y; -} - -void PolyText16Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyText16Message *polyText16 = (PolyText16Message *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyText16 -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText16 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyText16 -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText16 -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> polyTextCacheX); - - polyText16 -> x += value; - polyText16 -> x &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText16 -> x - << " as x field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> polyTextCacheY); - - polyText16 -> y += value; - polyText16 -> y &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText16 -> y - << " as y field.\n" << logofs_flush; - #endif -} - - diff --git a/nxcomp/PolyText16.h b/nxcomp/PolyText16.h deleted file mode 100644 index 805e1fa04..000000000 --- a/nxcomp/PolyText16.h +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyText16_H -#define PolyText16_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYTEXT16_ENABLE_CACHE 1 -#define POLYTEXT16_ENABLE_DATA 0 -#define POLYTEXT16_ENABLE_SPLIT 0 -#define POLYTEXT16_ENABLE_COMPRESS 0 - -#define POLYTEXT16_DATA_LIMIT 420 -#define POLYTEXT16_DATA_OFFSET 16 - -#define POLYTEXT16_CACHE_SLOTS 3000 -#define POLYTEXT16_CACHE_THRESHOLD 4 -#define POLYTEXT16_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyText16Message : public Message -{ - friend class PolyText16Store; - - public: - - PolyText16Message() - { - } - - ~PolyText16Message() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int drawable; - unsigned int gcontext; - - unsigned short x; - unsigned short y; -}; - -class PolyText16Store : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyText16Store() : MessageStore() - { - enableCache = POLYTEXT16_ENABLE_CACHE; - enableData = POLYTEXT16_ENABLE_DATA; - enableSplit = POLYTEXT16_ENABLE_SPLIT; - enableCompress = POLYTEXT16_ENABLE_COMPRESS; - - dataLimit = POLYTEXT16_DATA_LIMIT; - dataOffset = POLYTEXT16_DATA_OFFSET; - - cacheSlots = POLYTEXT16_CACHE_SLOTS; - cacheThreshold = POLYTEXT16_CACHE_THRESHOLD; - cacheLowerThreshold = POLYTEXT16_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyText16Store() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyText16"; - } - - virtual unsigned char opcode() const - { - return X_PolyText16; - } - - virtual unsigned int storage() const - { - return sizeof(PolyText16Message); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyText16Message(); - } - - virtual Message *create(const Message &message) const - { - return new PolyText16Message((const PolyText16Message &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyText16Message *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyText16_H */ diff --git a/nxcomp/PolyText8.cpp b/nxcomp/PolyText8.cpp deleted file mode 100644 index 50c21f79e..000000000 --- a/nxcomp/PolyText8.cpp +++ /dev/null @@ -1,306 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PolyText8.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int PolyText8Store::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyText8Message *polyText8 = (PolyText8Message *) message; - - // - // Here is the fingerprint. - // - - polyText8 -> drawable = GetULONG(buffer + 4, bigEndian); - polyText8 -> gcontext = GetULONG(buffer + 8, bigEndian); - - polyText8 -> x = GetUINT(buffer + 12, bigEndian); - polyText8 -> y = GetUINT(buffer + 14, bigEndian); - - // - // Clean up padding bytes. - // - - #ifdef DUMP - - DumpData(buffer, size); - - *logofs << "\n\n" << logofs_flush; - - #endif - - if ((int) size > dataOffset) - { - int length; - int current; - int delta; - int item; - - unsigned int nitem; - - unsigned char *pad = NULL; - unsigned char *end = NULL; - - delta = 1; - nitem = 0; - - #ifdef DUMP - *logofs << name() << " Size " << size << ".\n" << logofs_flush; - #endif - - // - // Data is a list of TextItem where element - // can be a string or a font shift. - // - - current = POLYTEXT8_DATA_OFFSET; - length = POLYTEXT8_DATA_OFFSET; - - do - { - #ifdef DUMP - *logofs << name() << " Current " << current << ".\n" << logofs_flush; - #endif - - item = GetUINT(buffer + length , bigEndian); - - if (item < 255) - { - // - // Text element. Number represents - // the 'Length of string' field. - // - - length += (item + delta + 1); - - nitem++; - } - else if (item == 255) - { - // - // Element is a font shift. - // - - length += 5; - - nitem++; - } - - #ifdef DUMP - *logofs << name() << " Item " << item << ".\n" << logofs_flush; - #endif - - current += length; - } - while(current < (int) size && item != 0); - - - #ifdef DUMP - *logofs << name() << " Final length " << length << ".\n" << logofs_flush; - #endif - - end = ((unsigned char *) buffer) + size; - - pad = ((unsigned char *) buffer) + length; - - for (; pad < end && nitem >= 1; pad++) - { - #ifdef DUMP - *logofs << name() << " Padding " << " .\n" << logofs_flush; - #endif - - *pad = 0; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PolyText8Store::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PolyText8Message *polyText8 = (PolyText8Message *) message; - - // - // Fill all the message's fields. - // - - PutULONG(polyText8 -> drawable, buffer + 4, bigEndian); - PutULONG(polyText8 -> gcontext, buffer + 8, bigEndian); - - PutUINT(polyText8 -> x, buffer + 12, bigEndian); - PutUINT(polyText8 -> y, buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PolyText8Store::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PolyText8Message *polyText8 = (PolyText8Message *) message; - - *logofs << name() << ": Identity drawable " << polyText8 -> drawable - << ", gcontext " << polyText8 -> gcontext << ", x " << polyText8 -> x - << ", y " << polyText8 -> y << ", size " << polyText8 -> size_ - << ".\n"; - - #endif -} - -void PolyText8Store::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void PolyText8Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - PolyText8Message *polyText8 = (PolyText8Message *) message; - PolyText8Message *cachedPolyText8 = (PolyText8Message *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText8 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyText8 -> drawable, clientCache -> drawableCache); - - cachedPolyText8 -> drawable = polyText8 -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText8 -> gcontext - << " as " << "gcontext" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(polyText8 -> gcontext, clientCache -> gcCache); - - cachedPolyText8 -> gcontext = polyText8 -> gcontext; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText8 -> x - << " as " << "x" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_x = polyText8 -> x - cachedPolyText8 -> x; - - encodeBuffer.encodeCachedValue(diff_x, 16, - clientCache -> polyTextCacheX); - - cachedPolyText8 -> x = polyText8 -> x; - - #ifdef TEST - *logofs << name() << ": Encoding value " << polyText8 -> y - << " as " << "y" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_y = polyText8 -> y - cachedPolyText8 -> y; - - encodeBuffer.encodeCachedValue(diff_y, 16, - clientCache -> polyTextCacheY); - - cachedPolyText8 -> y = polyText8 -> y; -} - -void PolyText8Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - PolyText8Message *polyText8 = (PolyText8Message *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - polyText8 -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText8 -> drawable - << " as " << "drawable" << " field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - polyText8 -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText8 -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> polyTextCacheX); - - polyText8 -> x += value; - polyText8 -> x &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText8 -> x - << " as x field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> polyTextCacheY); - - polyText8 -> y += value; - polyText8 -> y &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << polyText8 -> y - << " as y field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/PolyText8.h b/nxcomp/PolyText8.h deleted file mode 100644 index 3d5ff533a..000000000 --- a/nxcomp/PolyText8.h +++ /dev/null @@ -1,188 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PolyText8_H -#define PolyText8_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define POLYTEXT8_ENABLE_CACHE 1 -#define POLYTEXT8_ENABLE_DATA 0 -#define POLYTEXT8_ENABLE_SPLIT 0 -#define POLYTEXT8_ENABLE_COMPRESS 0 - -#define POLYTEXT8_DATA_LIMIT 380 -#define POLYTEXT8_DATA_OFFSET 16 - -#define POLYTEXT8_CACHE_SLOTS 3000 -#define POLYTEXT8_CACHE_THRESHOLD 5 -#define POLYTEXT8_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class PolyText8Message : public Message -{ - friend class PolyText8Store; - - public: - - PolyText8Message() - { - } - - ~PolyText8Message() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int drawable; - unsigned int gcontext; - - unsigned short x; - unsigned short y; -}; - -class PolyText8Store : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PolyText8Store() : MessageStore() - { - enableCache = POLYTEXT8_ENABLE_CACHE; - enableData = POLYTEXT8_ENABLE_DATA; - enableSplit = POLYTEXT8_ENABLE_SPLIT; - enableCompress = POLYTEXT8_ENABLE_COMPRESS; - - dataLimit = POLYTEXT8_DATA_LIMIT; - dataOffset = POLYTEXT8_DATA_OFFSET; - - cacheSlots = POLYTEXT8_CACHE_SLOTS; - cacheThreshold = POLYTEXT8_CACHE_THRESHOLD; - cacheLowerThreshold = POLYTEXT8_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~PolyText8Store() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "PolyText8"; - } - - virtual unsigned char opcode() const - { - return X_PolyText8; - } - - virtual unsigned int storage() const - { - return sizeof(PolyText8Message); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new PolyText8Message(); - } - - virtual Message *create(const Message &message) const - { - return new PolyText8Message((const PolyText8Message &) message); - } - - virtual void destroy(Message *message) const - { - delete (PolyText8Message *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PolyText8_H */ diff --git a/nxcomp/Proxy.cpp b/nxcomp/Proxy.cpp deleted file mode 100644 index 3a7a42362..000000000 --- a/nxcomp/Proxy.cpp +++ /dev/null @@ -1,6525 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include -#include -#include - -#ifdef ANDROID -#include -#include -#include -#endif - -#include "Misc.h" - -#if defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) -#include -#endif - -#ifndef ANDROID -#include -#include -#include -#endif - -#include "NXalert.h" -#include "NXvars.h" - -#include "Proxy.h" - -#include "Socket.h" -#include "Channel.h" -#include "Statistics.h" - -#include "ClientChannel.h" -#include "ServerChannel.h" -#include "GenericChannel.h" -#include "ChannelEndPoint.h" - -// -// We need to adjust some values related -// to these messages at the time the mes- -// sage stores are reconfigured. -// - -#include "PutImage.h" -#include "ChangeGC.h" -#include "PolyFillRectangle.h" -#include "PutPackedImage.h" - -// -// This is from the main loop. -// - -extern void CleanupListeners(); - -extern int HandleChild(int); - -// -// Default size of string buffers. -// - -#define DEFAULT_STRING_LENGTH 512 - -// -// Set the verbosity level. You also need -// to define DUMP in Misc.cpp if DUMP is -// defined here. -// - -#define WARNING -#define PANIC -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Log the important tracepoints related -// to writing packets to the peer proxy. -// - -#undef FLUSH - -// -// Log the operations related to splits. -// - -#undef SPLIT - -// -// Log the operations related to sending -// and receiving the control tokens. -// - -#undef TOKEN - -// -// Log the operations related to setting -// the token limits. -// - -#undef LIMIT - -// -// Log a warning if no data is written by -// the proxy within a timeout. -// - -#undef TIME - -// -// Log the operation related to generating -// the ping message at idle time. -// - -#undef PING - -Proxy::Proxy(int fd) - - : transport_(new ProxyTransport(fd)), fd_(fd), readBuffer_(transport_) -{ - for (int channelId = 0; - channelId < CONNECTIONS_LIMIT; - channelId++) - { - channels_[channelId] = NULL; - transports_[channelId] = NULL; - congestions_[channelId] = 0; - - fdMap_[channelId] = nothing; - channelMap_[channelId] = nothing; - slavePidMap_[channelId] = nothing; - } - - inputChannel_ = nothing; - outputChannel_ = nothing; - - controlLength_ = 0; - - operation_ = operation_in_negotiation; - - draining_ = 0; - priority_ = 0; - finish_ = 0; - shutdown_ = 0; - congestion_ = 0; - - timer_ = 0; - alert_ = 0; - - agent_ = nothing; - - // - // Set null timeouts. This will require - // a new link configuration. - // - - timeouts_.split = 0; - timeouts_.motion = 0; - - timeouts_.readTs = getTimestamp(); - timeouts_.writeTs = getTimestamp(); - - timeouts_.loopTs = getTimestamp(); - timeouts_.pingTs = getTimestamp(); - timeouts_.alertTs = nullTimestamp(); - timeouts_.loadTs = nullTimestamp(); - - timeouts_.splitTs = nullTimestamp(); - timeouts_.motionTs = nullTimestamp(); - - // - // Initialize the token counters. This - // will require a new link configuration. - // - - for (int i = token_control; i <= token_data; i++) - { - tokens_[i].size = 0; - tokens_[i].limit = 0; - - tokens_[i].bytes = 0; - tokens_[i].remaining = 0; - } - - tokens_[token_control].request = code_control_token_request; - tokens_[token_control].reply = code_control_token_reply; - tokens_[token_control].type = token_control; - - tokens_[token_split].request = code_split_token_request; - tokens_[token_split].reply = code_split_token_reply; - tokens_[token_split].type = token_split; - - tokens_[token_data].request = code_data_token_request; - tokens_[token_data].reply = code_data_token_reply; - tokens_[token_data].type = token_data; - - currentStatistics_ = NULL; - - // - // Create compressor and decompressor - // for image and data payload. - // - - compressor_ = new StaticCompressor(control -> LocalDataCompressionLevel, - control -> LocalDataCompressionThreshold); - - // - // Create object storing NX specific - // opcodes. - // - - opcodeStore_ = new OpcodeStore(); - - // - // Create the message stores. - // - - clientStore_ = new ClientStore(compressor_); - serverStore_ = new ServerStore(compressor_); - - clientCache_ = new ClientCache(); - serverCache_ = new ServerCache(); - - if (clientCache_ == NULL || serverCache_ == NULL) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Failed to create the channel cache.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to create the channel cache.\n"; - - HandleCleanup(); - } - - // - // Prepare for image decompression. - // - - UnpackInit(); - - #ifdef DEBUG - *logofs << "Proxy: Created new object at " << this - << ".\n" << logofs_flush; - #endif -} - -Proxy::~Proxy() -{ - for (int channelId = 0; - channelId < CONNECTIONS_LIMIT; - channelId++) - { - if (channels_[channelId] != NULL) - { - deallocateTransport(channelId); - - delete channels_[channelId]; - channels_[channelId] = NULL; - } - } - - // - // Kill all active slave channel children, and - // give them 5 seconds to exit nicely. - - #ifdef DEBUG - *logofs << "Proxy: Killing active slaves" << endl; - #endif - - int slave_count = 999; - int loop_count = 0; - - while(slave_count > 0 && loop_count < 50) - { - slave_count = 0; - - for (int channelId = 0; channelId 1) { - slave_count++; - - #ifdef DEBUG - *logofs << "Proxy: Active slave with pid " << pid << logofs_flush; - #endif - - if ( loop_count == 0 ) - { - #ifdef DEBUG - *logofs << "Proxy: Sending SIGTERM to " << pid << logofs_flush; - #endif - kill(pid, SIGTERM); - } - else if ( loop_count == 25 ) - { - #ifdef DEBUG - *logofs << "Proxy: Sending SIGKILL to " << pid << logofs_flush; - #endif - kill(pid, SIGKILL); - } - - if (HandleChild(pid)) - { - #ifdef DEBUG - *logofs << "Proxy: Slave " << pid << " terminated" << logofs_flush; - #endif - slavePidMap_[channelId] = nothing; - } - } - } - - if ( slave_count > 0 ) - { - cerr << "Proxy: Error: Failed to kill all slave channel processes. " << slave_count << " processes still remaining." << endl; - } - - usleep(200000); - loop_count++; - } - - delete transport_; - delete compressor_; - - // - // Delete storage shared among channels. - // - - delete opcodeStore_; - - delete clientStore_; - delete serverStore_; - - delete clientCache_; - delete serverCache_; - - // - // Get rid of the image decompression - // resources. - // - - UnpackDestroy(); - - #ifdef DEBUG - *logofs << "Proxy: Deleted proxy object at " << this - << ".\n" << logofs_flush; - #endif -} - -int Proxy::setOperational() -{ - #ifdef TEST - *logofs << "Proxy: Entering operational mode.\n" - << logofs_flush; - #endif - - operation_ = operation_in_messages; - - return 1; -} - -int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax) -{ - // - // Set the initial timeout to the time of - // the next ping. If the congestion count - // is greater than zero, anyway, use a - // shorter timeout to force a congestion - // update. - // - - if (agent_ != nothing && congestions_[agent_] == 0 && - statistics -> getCongestionInFrame() >= 1 && - tokens_[token_control].remaining >= - (tokens_[token_control].limit - 1)) - { - setMinTimestamp(tsMax, control -> IdleTimeout); - - #ifdef TEST - *logofs << "Proxy: Initial timeout is " << tsMax.tv_sec - << " S and " << (double) tsMax.tv_usec / - 1000 << " Ms with congestion " - << statistics -> getCongestionInFrame() - << ".\n" << logofs_flush; - #endif - } - else - { - setMinTimestamp(tsMax, control -> PingTimeout); - - #ifdef TEST - *logofs << "Proxy: Initial timeout is " << tsMax.tv_sec - << " S and " << (double) tsMax.tv_usec / - 1000 << " Ms.\n" << logofs_flush; - #endif - } - - int fd = -1; - - if (isTimeToRead() == 1) - { - // - // If we don't have split tokens available - // don't set the timeout. - // - - if (tokens_[token_split].remaining > 0 && - isTimestamp(timeouts_.splitTs) == 1) - { - int diffTs = getTimeToNextSplit(); - - #if defined(TEST) || defined(INFO) || \ - defined(FLUSH) || defined(SPLIT) - - if (diffTimestamp(timeouts_.splitTs, - getTimestamp()) > timeouts_.split) - { - *logofs << "Proxy: FLUSH! SPLIT! WARNING! Running with " - << diffTimestamp(timeouts_.splitTs, getTimestamp()) - << " Ms elapsed since the last split.\n" - << logofs_flush; - } - - *logofs << "Proxy: FLUSH! SPLIT! Requesting timeout of " - << diffTs << " Ms as there are splits to send.\n" - << logofs_flush; - - #endif - - setMinTimestamp(tsMax, diffTs); - } - #if defined(TEST) || defined(INFO) - else if (isTimestamp(timeouts_.splitTs) == 1) - { - *logofs << "Proxy: WARNING! Not requesting a split " - << "timeout with " << tokens_[token_split].remaining - << " split tokens remaining.\n" << logofs_flush; - } - #endif - - // - // Loop through the valid channels and set - // the descriptors selected for read and - // the timeout. - // - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] == NULL) - { - continue; - } - - fd = getFd(channelId); - - if (channels_[channelId] -> getFinish() == 0 && - (channels_[channelId] -> getType() == channel_x11 || - tokens_[token_data].remaining > 0) && - congestions_[channelId] == 0) - { - FD_SET(fd, fdSet); - - if (fd >= fdMax) - { - fdMax = fd + 1; - } - - #ifdef TEST - *logofs << "Proxy: Descriptor FD#" << fd - << " selected for read with buffer length " - << transports_[channelId] -> length() - << ".\n" << logofs_flush; - #endif - - // - // Wakeup the proxy if there are motion - // events to flush. - // - - if (isTimestamp(timeouts_.motionTs) == 1) - { - int diffTs = getTimeToNextMotion(); - - #if defined(TEST) || defined(INFO) - - if (diffTimestamp(timeouts_.motionTs, - getTimestamp()) > timeouts_.motion) - { - *logofs << "Proxy: FLUSH! WARNING! Running with " - << diffTimestamp(timeouts_.motionTs, getTimestamp()) - << " Ms elapsed since the last motion.\n" - << logofs_flush; - } - - *logofs << "Proxy: FLUSH! Requesting timeout of " - << diffTs << " Ms as FD#" << fd << " has motion " - << "events to send.\n" << logofs_flush; - - #endif - - setMinTimestamp(tsMax, diffTs); - } - } - #if defined(TEST) || defined(INFO) - else - { - if (channels_[channelId] -> getType() != channel_x11 && - tokens_[token_data].remaining <= 0) - { - *logofs << "Proxy: WARNING! Descriptor FD#" << fd - << " not selected for read with " - << tokens_[token_data].remaining << " data " - << "tokens remaining.\n" << logofs_flush; - } - } - #endif - } - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "Proxy: WARNING! Disabled reading from channels.\n" - << logofs_flush; - - *logofs << "Proxy: WARNING! Congestion is " << congestion_ - << " pending " << transport_ -> pending() << " blocked " - << transport_ -> blocked() << " length " << transport_ -> - length() << ".\n" << logofs_flush; - } - #endif - - // - // Include the proxy descriptor. - // - - FD_SET(fd_, fdSet); - - if (fd_ >= fdMax) - { - fdMax = fd_ + 1; - } - - #ifdef TEST - *logofs << "Proxy: Proxy descriptor FD#" << fd_ - << " selected for read with buffer length " - << transport_ -> length() << ".\n" - << logofs_flush; - #endif - - return 1; -} - -// -// Add to the mask the file descriptors of all -// X connections to write to. -// - -int Proxy::setWriteDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax) -{ - int fd = -1; - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL) - { - fd = getFd(channelId); - - if (transports_[channelId] -> length() > 0) - { - FD_SET(fd, fdSet); - - #ifdef TEST - *logofs << "Proxy: Descriptor FD#" << fd << " selected " - << "for write with blocked " << transports_[channelId] -> - blocked() << " and length " << transports_[channelId] -> - length() << ".\n" << logofs_flush; - #endif - - if (fd >= fdMax) - { - fdMax = fd + 1; - } - } - #ifdef TEST - else - { - *logofs << "Proxy: Descriptor FD#" << fd << " not selected " - << "for write with blocked " << transports_[channelId] -> - blocked() << " and length " << transports_[channelId] -> - length() << ".\n" << logofs_flush; - } - #endif - - #if defined(TEST) || defined(INFO) - - if (transports_[channelId] -> getType() != - transport_agent && transports_[channelId] -> - length() > 0 && transports_[channelId] -> - blocked() != 1) - { - *logofs << "Proxy: PANIC! Descriptor FD#" << fd - << " has data to write but blocked flag is " - << transports_[channelId] -> blocked() - << ".\n" << logofs_flush; - - cerr << "Error" << ": Descriptor FD#" << fd - << " has data to write but blocked flag is " - << transports_[channelId] -> blocked() - << ".\n"; - - HandleCleanup(); - } - - #endif - } - } - - // - // Check if the proxy transport has data - // from a previous blocking write. - // - - if (transport_ -> blocked() == 1) - { - FD_SET(fd_, fdSet); - - #ifdef TEST - *logofs << "Proxy: Proxy descriptor FD#" - << fd_ << " selected for write. Blocked is " - << transport_ -> blocked() << " length is " - << transport_ -> length() << ".\n" - << logofs_flush; - #endif - - if (fd_ >= fdMax) - { - fdMax = fd_ + 1; - } - } - #ifdef TEST - else - { - *logofs << "Proxy: Proxy descriptor FD#" - << fd_ << " not selected for write. Blocked is " - << transport_ -> blocked() << " length is " - << transport_ -> length() << ".\n" - << logofs_flush; - } - #endif - - // - // We are entering the main select. Save - // the timestamp of the last loop so that - // we can detect the clock drifts. - // - - timeouts_.loopTs = getTimestamp(); - - return 1; -} - -int Proxy::getChannels(T_channel_type type) -{ - int channels = 0; - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL && - (type == channel_none || - type == channels_[channelId] -> - getType())) - { - channels++; - } - } - - return channels; -} - -T_channel_type Proxy::getType(int fd) -{ - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - return channel_none; - } - - return channels_[channelId] -> getType(); -} - -const char *Proxy::getTypeName(T_channel_type type) -{ - switch (type) - { - case channel_x11: - { - return "X"; - } - case channel_cups: - { - return "CUPS"; - } - case channel_smb: - { - return "SMB"; - } - case channel_media: - { - return "media"; - } - case channel_http: - { - return "HTTP"; - } - case channel_font: - { - return "font"; - } - case channel_slave: - { - return "slave"; - } - default: - { - return "unknown"; - } - } -} - -const char *Proxy::getComputerName() -{ - // - // Strangely enough, under some Windows OSes SMB - // service doesn't bind to localhost. Fall back - // to localhost if can't find computer name in - // the environment. In future we should try to - // bind to localhost and then try the other IPs. - // - - const char *hostname = NULL; - - #ifdef __CYGWIN32__ - - hostname = getenv("COMPUTERNAME"); - - #endif - - if (hostname == NULL) - { - hostname = "localhost"; - } - - return hostname; -} - -// -// Handle data from channels selected for read. -// - -int Proxy::handleRead(int &resultFds, fd_set &readSet) -{ - #ifdef DEBUG - *logofs << "Proxy: Checking descriptors selected for read.\n" - << logofs_flush; - #endif - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - #ifdef DEBUG - *logofs << "Proxy: Looping with current channel " - << *j << ".\n" << logofs_flush; - #endif - - int fd = getFd(*j); - - if (fd >= 0 && resultFds > 0 && FD_ISSET(fd, &readSet)) - { - #ifdef DEBUG - *logofs << "Proxy: Going to read messages from FD#" - << fd << ".\n" << logofs_flush; - #endif - - int result = handleRead(fd); - - if (result < 0) - { - #ifdef TEST - *logofs << "Proxy: Failure reading messages from FD#" - << fd << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << "Proxy: Clearing the read descriptor " - << "for FD#" << fd << ".\n" << logofs_flush; - #endif - - FD_CLR(fd, &readSet); - - resultFds--; - } - } - - if (resultFds > 0 && FD_ISSET(fd_, &readSet)) - { - #ifdef DEBUG - *logofs << "Proxy: Going to read messages from " - << "proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - if (handleRead() < 0) - { - #ifdef TEST - *logofs << "Proxy: Failure reading from proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << "Proxy: Clearing the read descriptor " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - FD_CLR(fd_, &readSet); - - resultFds--; - } - - return 1; -} - -// -// Perform flush on descriptors selected for write. -// - -int Proxy::handleFlush(int &resultFds, fd_set &writeSet) -{ - #ifdef DEBUG - *logofs << "Proxy: Checking descriptors selected for write.\n" - << logofs_flush; - #endif - - if (resultFds > 0 && FD_ISSET(fd_, &writeSet)) - { - #ifdef TEST - *logofs << "Proxy: FLUSH! Proxy descriptor FD#" << fd_ - << " reported to be writable.\n" - << logofs_flush; - #endif - - if (handleFlush() < 0) - { - #ifdef TEST - *logofs << "Proxy: Failure flushing the writable " - << "proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - return -1; - } - - #ifdef DEBUG - *logofs << "Proxy: Clearing the write descriptor " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - FD_CLR(fd_, &writeSet); - - resultFds--; - } - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - resultFds > 0 && j != channelList.end(); j++) - { - #ifdef DEBUG - *logofs << "Proxy: Looping with current channel " - << *j << ".\n" << logofs_flush; - #endif - - int fd = getFd(*j); - - if (fd >= 0 && FD_ISSET(fd, &writeSet)) - { - #ifdef TEST - *logofs << "Proxy: X descriptor FD#" << fd - << " reported to be writable.\n" - << logofs_flush; - #endif - - // - // It can happen that, in handling reads, we - // have destroyed the buffer associated to a - // closed socket, so don't complain about - // the errors. - // - - handleFlush(fd); - - // - // Clear the descriptor from the mask so - // we don't confuse the agent if it's - // not checking only its own descriptors. - // - - #ifdef DEBUG - *logofs << "Proxy: Clearing the write descriptor " - << "for FD#" << fd << ".\n" - << logofs_flush; - #endif - - FD_CLR(fd, &writeSet); - - resultFds--; - } - } - - return 1; -} - -int Proxy::handleRead() -{ - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Decoding data from proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - // - // Decode all the available messages from - // the remote proxy until is not possible - // to read more. - // - - for (;;) - { - int result = readBuffer_.readMessage(); - - #if defined(TEST) || defined(DEBUG) || defined(INFO) - *logofs << "Proxy: Read result on proxy FD#" << fd_ - << " is " << result << ".\n" - << logofs_flush; - #endif - - if (result < 0) - { - if (shutdown_ == 0) - { - if (finish_ == 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Failure reading from the " - << "peer proxy on FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure reading from the " - << "peer proxy.\n"; - } - } - #ifdef TEST - else - { - *logofs << "Proxy: Closure of the proxy link detected " - << "after clean shutdown.\n" << logofs_flush; - } - #endif - - priority_ = 0; - finish_ = 1; - congestion_ = 0; - - return -1; - } - else if (result == 0) - { - #if defined(TEST) || defined(DEBUG) || defined(INFO) - *logofs << "Proxy: No data read from proxy FD#" - << fd_ << "\n" << logofs_flush; - #endif - - return 0; - } - - // - // We read some data from the remote. If we set - // the congestion flag because we couldn't read - // before the timeout and have tokens available, - // then reset the congestion flag. - // - - if (congestion_ == 1 && - tokens_[token_control].remaining > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Exiting congestion due to " - << "proxy data with " << tokens_[token_control].remaining - << " tokens.\n" << logofs_flush; - #endif - - congestion_ = 0; - } - - // - // Set the timestamp of the last read - // operation from the remote proxy and - // enable again showing the 'no data - // received' dialog at the next timeout. - // - - timeouts_.readTs = getTimestamp(); - - if (alert_ != 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Displacing the dialog " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - HandleAlert(DISPLACE_MESSAGE_ALERT, 1); - } - - timeouts_.alertTs = nullTimestamp(); - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Getting messages from proxy FD#" << fd_ - << " with " << readBuffer_.getLength() << " bytes " - << "in the read buffer.\n" << logofs_flush; - #endif - - unsigned int controlLength; - unsigned int dataLength; - - const unsigned char *message; - - while ((message = readBuffer_.getMessage(controlLength, dataLength)) != NULL) - { - statistics -> addFrameIn(); - - if (controlLength == 3 && *message == 0 && - *(message + 1) < code_last_tag) - { - if (handleControlFromProxy(message) < 0) - { - return -1; - } - } - else if (operation_ == operation_in_messages) - { - int channelId = inputChannel_; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Identified message of " << dataLength - << " bytes for FD#" << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && - channels_[channelId] != NULL) - { - int finish = channels_[channelId] -> getFinish(); - - #ifdef WARNING - - if (finish == 1) - { - *logofs << "Proxy: WARNING! Handling data for finishing " - << "FD#" << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - } - - #endif - - // - // We need to decode all the data to preserve - // the consistency of the cache, so can't re- - // turn as soon as the first error is encount- - // ered. Check if this is the first time that - // the failure is detected. - // - - int result = channels_[channelId] -> handleWrite(message, dataLength); - - if (result < 0 && finish == 0) - { - #ifdef TEST - *logofs << "Proxy: Failed to write proxy data to FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - if (handleFinish(channelId) < 0) - { - return -1; - } - } - - // - // Check if we have splits or motion - // events to send. - // - - setSplitTimeout(channelId); - setMotionTimeout(channelId); - } - #ifdef WARNING - else - { - *logofs << "Proxy: WARNING! Received data for " - << "invalid channel ID#" << channelId - << ".\n" << logofs_flush; - } - #endif - } - else if (operation_ == operation_in_statistics) - { - #ifdef TEST - *logofs << "Proxy: Received statistics data from remote proxy.\n" - << logofs_flush; - #endif - - if (handleStatisticsFromProxy(message, dataLength) < 0) - { - return -1; - } - - operation_ = operation_in_messages; - } - else if (operation_ == operation_in_negotiation) - { - #ifdef TEST - *logofs << "Proxy: Received new negotiation data from remote proxy.\n" - << logofs_flush; - #endif - - if (handleNegotiationFromProxy(message, dataLength) < 0) - { - return -1; - } - } - - // - // if (controlLength == 3 && *message == 0 && ...) ... - // else if (operation_ == operation_in_statistics) ... - // else if (operation_ == operation_in_messages) ... - // else if (operation_ == operation_in_negotiation) ... - // else ... - // - - else - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Unrecognized message received on proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unrecognized message received on proxy FD#" - << fd_ << ".\n"; - - return -1; - } - - } // while ((message = readBuffer_.getMessage(controlLength, dataLength)) != NULL) ... - - // - // Reset the read buffer. - // - - readBuffer_.fullReset(); - - // - // Give up if no data is readable. - // - - if (transport_ -> readable() == 0) - { - break; - } - - } // End of for (;;) ... - - return 1; -} - -int Proxy::handleControlFromProxy(const unsigned char *message) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Received message '" << DumpControl(*(message + 1)) - << "' at " << strMsTimestamp() << " with data ID#" - << (int) *(message + 2) << ".\n" << logofs_flush; - #endif - - T_channel_type channelType = channel_none; - - switch (*(message + 1)) - { - case code_switch_connection: - { - int channelId = *(message + 2); - - // - // If channel is invalid further messages will - // be ignored. The acknowledged shutdown of - // channels should prevent this. - // - - inputChannel_ = channelId; - - break; - } - case code_begin_congestion: - { - // - // Set the congestion state for the - // channel reported by the remote. - // - - int channelId = *(message + 2); - - if (channels_[channelId] != NULL) - { - congestions_[channelId] = 1; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Received a begin congestion " - << "for channel id ID#" << channelId - << ".\n" << logofs_flush; - #endif - - if (channelId == agent_ && congestions_[agent_] != 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Forcing an update of the congestion " - << "counter with agent congested.\n" - << logofs_flush; - #endif - - statistics -> updateCongestion(-tokens_[token_control].remaining, - tokens_[token_control].limit); - } - } - #ifdef WARNING - else - { - *logofs << "Proxy: WARNING! Received a begin congestion " - << "for invalid channel id ID#" << channelId - << ".\n" << logofs_flush; - } - #endif - - break; - } - case code_end_congestion: - { - // - // Attend again to the channel. - // - - int channelId = *(message + 2); - - if (channels_[channelId] != NULL) - { - congestions_[channelId] = 0; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Received an end congestion " - << "for channel id ID#" << channelId - << ".\n" << logofs_flush; - #endif - - if (channelId == agent_ && congestions_[agent_] != 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Forcing an update of the congestion " - << "counter with agent decongested.\n" - << logofs_flush; - #endif - - statistics -> updateCongestion(tokens_[token_control].remaining, - tokens_[token_control].limit); - } - } - #ifdef WARNING - else - { - *logofs << "Proxy: WARNING! Received an end congestion " - << "for invalid channel id ID#" << channelId - << ".\n" << logofs_flush; - } - #endif - - break; - } - case code_control_token_request: - { - T_proxy_token &token = tokens_[token_control]; - - if (handleTokenFromProxy(token, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_split_token_request: - { - T_proxy_token &token = tokens_[token_split]; - - if (handleTokenFromProxy(token, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_data_token_request: - { - T_proxy_token &token = tokens_[token_data]; - - if (handleTokenFromProxy(token, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_control_token_reply: - { - T_proxy_token &token = tokens_[token_control]; - - if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_split_token_reply: - { - T_proxy_token &token = tokens_[token_split]; - - if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_data_token_reply: - { - T_proxy_token &token = tokens_[token_data]; - - if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_new_x_connection: - { - // - // Opening the channel is handled later. - // - - channelType = channel_x11; - - break; - } - case code_new_cups_connection: - { - channelType = channel_cups; - - break; - } - case code_new_aux_connection: - { - // - // Starting from version 1.5.0 we create real X - // connections for the keyboard channel. We need - // to refuse old auxiliary X connections because - // they would be unable to leverage the new fake - // authorization cookie. - // - - #ifdef WARNING - *logofs << "Proxy: WARNING! Can't open outdated auxiliary X " - << "channel for code " << *(message + 1) << ".\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Can't open outdated auxiliary X " - << "channel for code " << *(message + 1) << ".\n"; - - if (handleControl(code_drop_connection, *(message + 2)) < 0) - { - return -1; - } - - break; - } - case code_new_smb_connection: - { - channelType = channel_smb; - - break; - } - case code_new_media_connection: - { - channelType = channel_media; - - break; - } - case code_new_http_connection: - { - channelType = channel_http; - - break; - } - case code_new_font_connection: - { - channelType = channel_font; - - break; - } - case code_new_slave_connection: - { - channelType = channel_slave; - - break; - } - case code_drop_connection: - { - int channelId = *(message + 2); - - if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && - channels_[channelId] != NULL) - { - handleDropFromProxy(channelId); - } - #ifdef WARNING - else - { - *logofs << "Proxy: WARNING! Received a drop message " - << "for invalid channel id ID#" << channelId - << ".\n" << logofs_flush; - } - #endif - - break; - } - case code_finish_connection: - { - int channelId = *(message + 2); - - if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && - channels_[channelId] != NULL) - { - // - // Force the finish state on the channel. - // We can receive this message while in - // the read loop, so we only mark the - // channel for deletion. - // - - #ifdef TEST - *logofs << "Proxy: Received a finish message for FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - handleFinishFromProxy(channelId); - } - #ifdef WARNING - else - { - *logofs << "Proxy: WARNING! Received a finish message " - << "for invalid channel id ID#" << channelId - << ".\n" << logofs_flush; - } - #endif - - break; - } - case code_finish_listeners: - { - // - // This is from the main loop. - // - - #ifdef TEST - *logofs << "Proxy: Closing down all local listeners.\n" - << logofs_flush; - #endif - - CleanupListeners(); - - finish_ = 1; - - break; - } - case code_reset_request: - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Proxy reset not supported " - << "in this version.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Proxy reset not supported " - << "in this version.\n"; - - HandleCleanup(); - } - case code_shutdown_request: - { - // - // Time to rest in peace. - // - - shutdown_ = 1; - - break; - } - case code_load_request: - { - if (handleLoadFromProxy() < 0) - { - return -1; - } - - break; - } - case code_save_request: - { - // - // Don't abort the connection - // if can't write to disk. - // - - handleSaveFromProxy(); - - break; - } - case code_statistics_request: - { - int type = *(message + 2); - - if (handleStatisticsFromProxy(type) < 0) - { - return -1; - } - - break; - } - case code_statistics_reply: - { - operation_ = operation_in_statistics; - - break; - } - case code_alert_request: - { - HandleAlert(*(message + 2), 1); - - break; - } - case code_sync_request: - { - int channelId = *(message + 2); - - if (handleSyncFromProxy(channelId) < 0) - { - return -1; - } - - break; - } - case code_sync_reply: - { - // - // We are not the one that issued - // the request. - // - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: PANIC! Received an unexpected " - << "synchronization reply.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Received an unexpected " - << "synchronization reply.\n"; - - HandleCleanup(); - } - default: - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Received bad control message number " - << (unsigned int) *(message + 1) << " with attribute " - << (unsigned int) *(message + 2) << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Received bad control message number " - << (unsigned int) *(message + 1) << " with attribute " - << (unsigned int) *(message + 2) << ".\n"; - - HandleCleanup(); - } - - } // End of switch (*(message + 1)) ... - - if (channelType == channel_none) - { - return 1; - } - - // - // Handle the channel allocation that we - // left from the main switch case. - // - - int channelId = *(message + 2); - - // - // Check if the channel has been dropped. - // - - if (channels_[channelId] != NULL && - (channels_[channelId] -> getDrop() == 1 || - channels_[channelId] -> getClosing() == 1)) - { - #ifdef TEST - *logofs << "Proxy: Dropping the descriptor FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - handleDrop(channelId); - } - - // - // Check if the channel is in the valid - // range. - // - - int result = checkChannelMap(channelId); - - if (result >= 0) - { - result = handleNewConnectionFromProxy(channelType, channelId); - } - - if (result < 0) - { - // - // Realization of new channel failed. - // Send channel shutdown message to - // the peer proxy. - // - - if (handleControl(code_drop_connection, channelId) < 0) - { - return -1; - } - } - else - { - int fd = getFd(channelId); - - if (getReadable(fd) > 0) - { - #ifdef TEST - *logofs << "Proxy: Trying to read immediately " - << "from descriptor FD#" << fd << ".\n" - << logofs_flush; - #endif - - if (handleRead(fd) < 0) - { - return -1; - } - } - #ifdef TEST - *logofs << "Proxy: Nothing to read immediately " - << "from descriptor FD#" << fd << ".\n" - << logofs_flush; - #endif - } - - return 1; -} - -int Proxy::handleRead(int fd, const char *data, int size) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Handling data for connection on FD#" - << fd << ".\n" << logofs_flush; - #endif - - if (canRead(fd) == 0) - { - #if defined(TEST) || defined(INFO) - - if (getChannel(fd) < 0) - { - *logofs << "Proxy: PANIC! Can't read from invalid FD#" - << fd << ".\n" << logofs_flush; - - HandleCleanup(); - } - else - { - *logofs << "Proxy: WARNING! Read method called for FD#" - << fd << " but operation is not possible.\n" - << logofs_flush; - } - - #endif - - return 0; - } - - int channelId = getChannel(fd); - - // - // Let the channel object read all the new data from - // its file descriptor, isolate messages, compress - // those messages, and append the compressed form to - // the encode buffer. - // - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Reading messages from FD#" << fd - << " channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - int result = channels_[channelId] -> handleRead(encodeBuffer_, (const unsigned char *) data, - (unsigned int) size); - - // - // Even in the case of a failure, write the produced - // data to the proxy connection. To keep the stores - // synchronized, the remote side needs to decode any - // message encoded by this side, also if the X socket - // was closed in the meanwhile. If this is the case, - // the decompressed output will be silently discarded. - // - - if (result < 0) - { - #ifdef TEST - *logofs << "Proxy: Failed to read data from connection FD#" - << fd << " channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - if (handleFinish(channelId) < 0) - { - return -1; - } - } - - // - // Check if there are new splits or - // motion events to send. - // - - setSplitTimeout(channelId); - setMotionTimeout(channelId); - - return 1; -} - -int Proxy::handleEvents() -{ - #ifdef TEST - *logofs << "Proxy: Going to check the events on channels.\n" - << logofs_flush; - #endif - - // - // Check if we can safely write to the - // proxy link. - // - - int read = isTimeToRead(); - - // - // Loop on channels and send the pending - // events. We must copy the list because - // channels can be removed in the middle - // of the loop. - // - - T_list channelList = activeChannels_.copyList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] == NULL) - { - continue; - } - - // - // Check if we need to drop the channel. - // - - if (channels_[channelId] -> getDrop() == 1 || - channels_[channelId] -> getClosing() == 1) - { - #ifdef TEST - *logofs << "Proxy: Dropping the descriptor FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - if (handleDrop(channelId) < 0) - { - return -1; - } - - continue; - } - else if (channels_[channelId] -> getFinish() == 1) - { - #ifdef TEST - *logofs << "Proxy: Skipping finishing " - << "descriptor FD#" << getFd(channelId) - << " channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - continue; - } - - // - // If the proxy link or the channel is - // in congestion state, don't handle - // the further events. - // - - if (read == 0 || congestions_[channelId] == 1) - { - #ifdef TEST - - if (read == 0) - { - *logofs << "Proxy: Can't handle events for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " with proxy not available.\n" - << logofs_flush; - } - else - { - *logofs << "Proxy: Can't handle events for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " with channel congested.\n" - << logofs_flush; - } - - #endif - - continue; - } - - // - // Handle the timeouts on the channel - // operations. - // - - int result = 0; - - // - // Handle the motion events. - // - - if (result >= 0 && channels_[channelId] -> needMotion() == 1) - { - if (isTimeToMotion() == 1) - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - - *logofs << "Proxy: FLUSH! Motion timeout expired after " - << diffTimestamp(timeouts_.motionTs, getTimestamp()) - << " Ms.\n" << logofs_flush; - - #endif - - result = channels_[channelId] -> handleMotion(encodeBuffer_); - - #ifdef TEST - - if (result < 0) - { - *logofs << "Proxy: Failed to handle motion events for FD#" - << getFd(channelId) << " channel ID#" << channelId - << ".\n" << logofs_flush; - } - - #endif - - timeouts_.motionTs = nullTimestamp(); - - setMotionTimeout(channelId); - } - #if defined(TEST) || defined(INFO) - else if (isTimestamp(timeouts_.motionTs) == 1) - { - *logofs << "Proxy: Running with " - << diffTimestamp(timeouts_.motionTs, getTimestamp()) - << " Ms elapsed since the last motion.\n" - << logofs_flush; - } - #endif - } - - if (result >= 0 && channels_[channelId] -> needSplit() == 1) - { - // - // Check if it is time to send more splits - // and how many bytes are going to be sent. - // - - if (isTimeToSplit() == 1) - { - #if defined(TEST) || defined(INFO) || defined(SPLIT) - *logofs << "Proxy: SPLIT! Split timeout expired after " - << diffTimestamp(timeouts_.splitTs, getTimestamp()) - << " Ms.\n" << logofs_flush; - #endif - - #if defined(TEST) || defined(INFO) || defined(SPLIT) - - *logofs << "Proxy: SPLIT! Encoding splits for FD#" - << getFd(channelId) << " at " << strMsTimestamp() - << " with " << clientStore_ -> getSplitTotalStorageSize() - << " total bytes and " << control -> SplitDataPacketLimit - << " bytes " << "to write.\n" - << logofs_flush; - - #endif - - result = channels_[channelId] -> handleSplit(encodeBuffer_); - - #ifdef TEST - - if (result < 0) - { - *logofs << "Proxy: Failed to handle splits for FD#" - << getFd(channelId) << " channel ID#" << channelId - << ".\n" << logofs_flush; - } - - #endif - - timeouts_.splitTs = nullTimestamp(); - - setSplitTimeout(channelId); - } - #if defined(TEST) || defined(INFO) || defined(SPLIT) - else if (channels_[channelId] -> needSplit() == 1 && - isTimestamp(timeouts_.splitTs) == 0) - { - *logofs << "Proxy: SPLIT! WARNING! Channel for FD#" - << getFd(channelId) << " has split to send but " - << "there is no timeout.\n" << logofs_flush; - } - else if (isTimestamp(timeouts_.splitTs) == 1) - { - *logofs << "Proxy: SPLIT! Running with " - << diffTimestamp(timeouts_.splitTs, getTimestamp()) - << " Ms elapsed since the last split.\n" - << logofs_flush; - } - #endif - } - - if (result < 0) - { - #ifdef TEST - *logofs << "Proxy: Error handling events for FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - if (handleFinish(channelId) < 0) - { - return -1; - } - } - } - - return 1; -} - -int Proxy::handleFrame(T_frame_type type) -{ - // - // Write any outstanding control message, followed by the - // content of the encode buffer, to the proxy transport. - // - // This code assumes that the encode buffer data is at an - // offset several bytes from start of the buffer, so that - // the length header and any necessary control bytes can - // be inserted in front of the data already in the buffer. - // This is the easiest way to encapsulate header and data - // together in a single frame. - // - // The way framing is implemented is very efficient but - // inherently limited and does not allow for getting the - // best performance, especially when running over a fast - // link. Framing should be rewritten to include the length - // of the packets in a fixed size header and, possibly, - // to incapsulate the control messages and the channel's - // data in a pseudo X protocol message, so that the proxy - // itself would be treated like any other channel. - // - - #if defined(TEST) || defined(INFO) - - if (congestion_ == 1) - { - // - // This can happen because there may be control - // messages to send, like a proxy shutdown mes- - // sage or a statistics request. All the other - // cases should be considered an error. - // - - #ifdef WARNING - *logofs << "Proxy: WARNING! Data is to be sent while " - << "congestion is " << congestion_ << ".\n" - << logofs_flush; - #endif - } - - #endif - - // - // Check if there is any data available on - // the socket. Recent Linux kernels are very - // picky. They require that we read often or - // they assume that the process is non-inter- - // active. - // - - if (handleAsyncEvents() < 0) - { - return -1; - } - - // - // Check if this is a ping, not a data frame. - // - - if (type == frame_ping) - { - if (handleToken(frame_ping) < 0) - { - return -1; - } - } - - unsigned int dataLength = encodeBuffer_.getLength(); - - #ifdef DEBUG - *logofs << "Proxy: Data length is " << dataLength - << " control length is " << controlLength_ - << ".\n" << logofs_flush; - #endif - - if (dataLength > 0) - { - // - // If this is a generic channel we need - // to add the completion bits. Data can - // also have been encoded because of a - // statistics request, even if no output - // channel was currently selected. - // - - if (outputChannel_ != -1) - { - #if defined(TEST) || defined(INFO) - - if (channels_[outputChannel_] == NULL) - { - *logofs << "Proxy: PANIC! A new frame was requested " - << "but the channel is invalid.\n" - << logofs_flush; - - HandleCleanup(); - } - - #endif - - channels_[outputChannel_] -> handleCompletion(encodeBuffer_); - - dataLength = encodeBuffer_.getLength(); - } - } - else if (controlLength_ == 0) - { - #if defined(TEST) || defined(INFO) - - *logofs << "Proxy: PANIC! A new frame was requested " - << "but there is no data to write.\n" - << logofs_flush; - - HandleCleanup(); - - #endif - - return 0; - } - - #ifdef DEBUG - *logofs << "Proxy: Data length is now " << dataLength - << " control length is " << controlLength_ - << ".\n" << logofs_flush; - #endif - - // - // Check if this frame needs to carry a new - // token request. - // - - if (type == frame_data) - { - if (handleToken(frame_data) < 0) - { - return -1; - } - } - - #ifdef DEBUG - *logofs << "Proxy: Adding a new frame for the remote proxy.\n" - << logofs_flush; - #endif - - unsigned char temp[5]; - - unsigned int lengthLength = 0; - unsigned int shift = dataLength; - - while (shift) - { - temp[lengthLength++] = (unsigned char) (shift & 0x7f); - - shift >>= 7; - } - - unsigned char *data = encodeBuffer_.getData(); - - unsigned char *outputMessage = data - (controlLength_ + lengthLength); - - unsigned char *nextDest = outputMessage; - - for (int i = 0; i < controlLength_; i++) - { - *nextDest++ = controlCodes_[i]; - } - - for (int j = lengthLength - 1; j > 0; j--) - { - *nextDest++ = (temp[j] | 0x80); - } - - if (lengthLength) - { - *nextDest++ = temp[0]; - } - - unsigned int outputLength = dataLength + controlLength_ + lengthLength; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Produced plain output for " << dataLength << "+" - << controlLength_ << "+" << lengthLength << " out of " - << outputLength << " bytes.\n" << logofs_flush; - #endif - - #if defined(TEST) || defined(INFO) || defined(FLUSH) || defined(TIME) - - T_timestamp nowTs = getTimestamp(); - - *logofs << "Proxy: FLUSH! Immediate with blocked " << transport_ -> - blocked() << " length " << transport_ -> length() - << " new " << outputLength << " flushable " << transport_ -> - flushable() << " tokens " << tokens_[token_control].remaining - << " after " << diffTimestamp(timeouts_.writeTs, nowTs) - << " Ms.\n" << logofs_flush; - - *logofs << "Proxy: FLUSH! Immediate flush to proxy FD#" << fd_ - << " of " << outputLength << " bytes at " << strMsTimestamp() - << " with priority " << priority_ << ".\n" << logofs_flush; - - *logofs << "Proxy: FLUSH! Current bitrate is " - << statistics -> getBitrateInShortFrame() << " with " - << statistics -> getBitrateInLongFrame() << " in the " - << "long frame and top " << statistics -> - getTopBitrate() << ".\n" << logofs_flush; - #endif - - statistics -> addWriteOut(); - - int result = transport_ -> write(write_immediate, outputMessage, outputLength); - - #ifdef TIME - - if (diffTimestamp(timeouts_.writeTs, nowTs) > 50) - { - *logofs << "Proxy: WARNING! TIME! Data written to proxy FD#" - << fd_ << " at " << strMsTimestamp() << " after " - << diffTimestamp(timeouts_.writeTs, nowTs) - << " Ms.\n" << logofs_flush; - } - - #endif - - #ifdef DUMP - *logofs << "Proxy: Sent " << outputLength << " bytes of data " - << "with checksum "; - - DumpChecksum(outputMessage, outputLength); - - *logofs << " on proxy FD#" << fd_ << ".\n" << logofs_flush; - #endif - - #ifdef DUMP - *logofs << "Proxy: Partial checksums are:\n"; - - DumpBlockChecksums(outputMessage, outputLength, 256); - - *logofs << logofs_flush; - #endif - - // - // Clean up the encode buffer and - // bring it to the initial size. - // - - encodeBuffer_.fullReset(); - - // - // Close the connection if we got - // an error. - // - - if (result < 0) - { - #ifdef TEST - *logofs << "Proxy: Failed write to proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return -1; - } - - // - // Account for the data frame and the - // framing overhead. - // - - if (dataLength > 0) - { - statistics -> addFrameOut(); - } - - statistics -> addFramingBits((controlLength_ + lengthLength) << 3); - - controlLength_ = 0; - - // - // Reset all buffers, counters and the - // priority flag. - // - - handleResetFlush(); - - // - // Check if more data became available - // after writing. - // - - if (handleAsyncEvents() < 0) - { - return -1; - } - - // - // Drain the proxy link if we are in - // congestion state. - // - // if (needDrain() == 1 && draining_ == 0) - // { - // if (handleDrain() < 0) - // { - // return -1; - // } - // } - // - - return result; -} - -int Proxy::handleFlush() -{ - // - // We can have data in the encode buffer or - // control bytes to send. In the case make - // up a new frame. - // - - if (encodeBuffer_.getLength() + controlLength_ > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Flushing data in the encode buffer.\n" - << logofs_flush; - #endif - - priority_ = 1; - - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - // - // Check if we have something to write. - // - - if (transport_ -> length() + transport_ -> flushable() == 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Nothing else to flush for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return 0; - } - - #if defined(TEST) || defined(INFO) - - if (transport_ -> blocked() == 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Proxy descriptor FD#" << fd_ - << " has data to flush but the transport " - << "is not blocked.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Proxy descriptor FD#" << fd_ - << " has data to flush but the transport " - << "is not blocked.\n"; - - HandleCleanup(); - } - - #endif - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: FLUSH! Deferred with blocked " << transport_ -> - blocked() << " length " << transport_ -> length() - << " flushable " << transport_ -> flushable() << " tokens " - << tokens_[token_control].remaining << ".\n" - << logofs_flush; - - *logofs << "Proxy: FLUSH! Deferred flush to proxy FD#" << fd_ - << " of " << transport_ -> length() + transport_ -> - flushable() << " bytes at " << strMsTimestamp() - << " with priority " << priority_ << ".\n" - << logofs_flush; - - *logofs << "Proxy: FLUSH! Current bitrate is " - << statistics -> getBitrateInShortFrame() << " with " - << statistics -> getBitrateInLongFrame() << " in the " - << "long frame and top " << statistics -> - getTopBitrate() << ".\n" << logofs_flush; - #endif - - statistics -> addWriteOut(); - - int result = transport_ -> flush(); - - if (result < 0) - { - return -1; - } - - // - // Reset the counters and update the - // timestamp of the last write. - // - - handleResetFlush(); - - return result; -} - -int Proxy::handleDrain() -{ - // - // If the proxy is run in the same process - // as SSH, we can't block or the program - // would not have a chance to read or write - // its data. - // - - if (control -> LinkEncrypted == 1) - { - return 0; - } - - if (needDrain() == 0 || draining_ == 1) - { - #if defined(TEST) || defined(INFO) - - if (draining_ == 1) - { - *logofs << "Proxy: WARNING! Already draining proxy FD#" - << fd_ << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - } - else - { - *logofs << "Proxy: WARNING! No need to drain proxy FD#" - << fd_ << " with congestion " << congestion_ - << " length " << transport_ -> length() - << " and blocked " << transport_ -> blocked() - << ".\n" << logofs_flush; - } - - #endif - - return 0; - } - - draining_ = 1; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Going to drain the proxy FD#" << fd_ - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - int timeout = control -> PingTimeout / 2; - - T_timestamp startTs = getNewTimestamp(); - - T_timestamp nowTs = startTs; - - int remaining; - int result; - - // - // Keep draining the proxy socket while - // reading the incoming messages until - // the timeout is expired. - // - - for (;;) - { - remaining = timeout - diffTimestamp(startTs, nowTs); - - if (remaining <= 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Timeout raised while draining " - << "FD#" << fd_ << " at " << strMsTimestamp() - << " after " << diffTimestamp(startTs, nowTs) - << " Ms.\n" << logofs_flush; - #endif - - result = 0; - - goto ProxyDrainEnd; - } - - if (transport_ -> length() > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Trying to write to FD#" << fd_ - << " at " << strMsTimestamp() << " with length " - << transport_ -> length() << " and " - << remaining << " Ms remaining.\n" - << logofs_flush; - #endif - - result = transport_ -> drain(0, remaining); - - if (result == -1) - { - result = -1; - - goto ProxyDrainEnd; - } - else if (result == 0 && transport_ -> readable() > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Decoding more data from proxy FD#" - << fd_ << " at " << strMsTimestamp() << " with " - << transport_ -> length() << " bytes to write and " - << transport_ -> readable() << " readable.\n" - << logofs_flush; - #endif - - if (handleRead() < 0) - { - result = -1; - - goto ProxyDrainEnd; - } - } - #if defined(TEST) || defined(INFO) - else if (result == 1) - { - *logofs << "Proxy: Transport for proxy FD#" << fd_ - << " drained down to " << transport_ -> length() - << " bytes.\n" << logofs_flush; - } - #endif - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Waiting for more data from proxy " - << "FD#" << fd_ << " at " << strMsTimestamp() - << " with " << remaining << " Ms remaining.\n" - << logofs_flush; - #endif - - - result = transport_ -> wait(remaining); - - if (result == -1) - { - result = -1; - - goto ProxyDrainEnd; - } - else if (result > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Decoding more data from proxy FD#" - << fd_ << " at " << strMsTimestamp() << " with " - << transport_ -> readable() << " bytes readable.\n" - << logofs_flush; - #endif - - if (handleRead() < 0) - { - result = -1; - - goto ProxyDrainEnd; - } - } - } - - // - // Check if we finally got the tokens - // that would allow us to come out of - // the congestion state. - // - - if (needDrain() == 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Got decongestion for proxy FD#" - << fd_ << " at " << strMsTimestamp() << " after " - << diffTimestamp(startTs, getTimestamp()) - << " Ms.\n" << logofs_flush; - #endif - - result = 1; - - goto ProxyDrainEnd; - } - - nowTs = getNewTimestamp(); - } - -ProxyDrainEnd: - - draining_ = 0; - - return result; -} - -int Proxy::handleFlush(int fd) -{ - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - #ifdef TEST - *logofs << "Proxy: WARNING! Skipping flush on invalid " - << "descriptor FD#" << fd << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (channels_[channelId] -> getFinish() == 1) - { - #ifdef TEST - *logofs << "Proxy: Skipping flush on finishing " - << "descriptor FD#" << fd << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - return 0; - } - - #ifdef TEST - *logofs << "Proxy: Going to flush FD#" << fd - << " with blocked " << transports_[channelId] -> blocked() - << " length " << transports_[channelId] -> length() - << ".\n" << logofs_flush; - #endif - - if (channels_[channelId] -> handleFlush() < 0) - { - #ifdef TEST - *logofs << "Proxy: Failed to flush data to FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - handleFinish(channelId); - - return -1; - } - - return 1; -} - -int Proxy::handleStatistics(int type, ostream *stream) -{ - if (stream == NULL || control -> EnableStatistics == 0) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Cannot produce statistics " - << " for proxy FD#" << fd_ << ". Invalid settings " - << "for statistics or stream.\n" << logofs_flush; - #endif - - return 0; - } - else if (currentStatistics_ != NULL) - { - // - // Need to update the stream pointer as the - // previous one could have been destroyed. - // - - #ifdef WARNING - *logofs << "Proxy: WARNING! Replacing stream while producing " - << "statistics in stream at " << currentStatistics_ - << " for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - } - - currentStatistics_ = stream; - - // - // Get statistics of remote peer. - // - - if (handleControl(code_statistics_request, type) < 0) - { - return -1; - } - - return 1; -} - -int Proxy::handleStatisticsFromProxy(int type) -{ - if (needFlush() == 1) - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: WARNING! Data for the previous " - << "channel ID#" << outputChannel_ - << " flushed in statistics.\n" - << logofs_flush; - #endif - - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - if (control -> EnableStatistics == 1) - { - // - // Allocate a buffer for the output. - // - - char *buffer = new char[STATISTICS_LENGTH]; - - *buffer = '\0'; - - if (control -> ProxyMode == proxy_client) - { - #ifdef TEST - *logofs << "Proxy: Producing " - << (type == TOTAL_STATS ? "total" : "partial") - << " client statistics for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - statistics -> getClientProtocolStats(type, buffer); - - statistics -> getClientOverallStats(type, buffer); - } - else - { - #ifdef TEST - *logofs << "Proxy: Producing " - << (type == TOTAL_STATS ? "total" : "partial") - << " server statistics for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - statistics -> getServerProtocolStats(type, buffer); - } - - if (type == PARTIAL_STATS) - { - statistics -> resetPartialStats(); - } - - unsigned int length = strlen((char *) buffer) + 1; - - encodeBuffer_.encodeValue(type, 8); - - encodeBuffer_.encodeValue(length, 32); - - #ifdef TEST - *logofs << "Proxy: Encoding " << length - << " bytes of statistics data for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - encodeBuffer_.encodeMemory((unsigned char *) buffer, length); - - // - // Account statistics data as framing bits. - // - - statistics -> addFramingBits(length << 3); - - delete [] buffer; - } - else - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Got statistics request " - << "but local statistics are disabled.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Got statistics request " - << "but local statistics are disabled.\n"; - - type = NO_STATS; - - encodeBuffer_.encodeValue(type, 8); - - #ifdef TEST - *logofs << "Proxy: Sending error code to remote proxy on FD#" - << fd_ << ".\n" << logofs_flush; - #endif - } - - // - // The next write will flush the statistics - // data and the control message. - // - - if (handleControl(code_statistics_reply, type) < 0) - { - return -1; - } - - return 1; -} - -int Proxy::handleStatisticsFromProxy(const unsigned char *message, unsigned int length) -{ - if (currentStatistics_ == NULL) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Unexpected statistics data received " - << "from remote proxy on FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Unexpected statistics data received " - << "from remote proxy.\n"; - - return 0; - } - - // - // Allocate the decode buffer and at least - // the 'type' field to see if there was an - // error. - // - - DecodeBuffer decodeBuffer(message, length); - - unsigned int type; - - decodeBuffer.decodeValue(type, 8); - - if (type == NO_STATS) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Couldn't get statistics from remote " - << "proxy on FD#" << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Couldn't get statistics from remote proxy.\n"; - } - else if (type != TOTAL_STATS && type != PARTIAL_STATS) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Cannot produce statistics " - << "with qualifier '" << type << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Cannot produce statistics " - << "with qualifier '" << type << "'.\n"; - - return -1; - } - else - { - unsigned int size; - - decodeBuffer.decodeValue(size, 32); - - char *buffer = new char[STATISTICS_LENGTH]; - - *buffer = '\0'; - - if (control -> EnableStatistics == 1) - { - if (control -> ProxyMode == proxy_client) - { - #ifdef TEST - *logofs << "Proxy: Finalizing " - << (type == TOTAL_STATS ? "total" : "partial") - << " client statistics for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - statistics -> getClientCacheStats(type, buffer); - - #ifdef TEST - *logofs << "Proxy: Decoding " << size - << " bytes of statistics data for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); - - statistics -> getClientProtocolStats(type, buffer); - - statistics -> getClientOverallStats(type, buffer); - } - else - { - #ifdef TEST - *logofs << "Proxy: Finalizing " - << (type == TOTAL_STATS ? "total" : "partial") - << " server statistics for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - statistics -> getServerCacheStats(type, buffer); - - statistics -> getServerProtocolStats(type, buffer); - - #ifdef TEST - *logofs << "Proxy: Decoding " << size - << " bytes of statistics data for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); - } - - if (type == PARTIAL_STATS) - { - statistics -> resetPartialStats(); - } - - *currentStatistics_ << buffer; - - // - // Mark the end of text to help external parsing. - // - - *currentStatistics_ << '\4'; - - *currentStatistics_ << flush; - } - else - { - // - // It can be that statistics were enabled at the time - // we issued the request (otherwise we could not have - // set the stream), but now they have been disabled - // by user. We must decode statistics data if we want - // to keep the connection. - // - - #ifdef TEST - *logofs << "Proxy: Discarding " << size - << " bytes of statistics data for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); - } - - delete [] buffer; - } - - currentStatistics_ = NULL; - - return 1; -} - -int Proxy::handleNegotiation(const unsigned char *message, unsigned int length) -{ - #ifdef PANIC - *logofs << "Proxy: PANIC! Writing data during proxy " - << "negotiation is not implemented.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Writing data during proxy " - << "negotiation is not implemented.\n"; - - return -1; -} - -int Proxy::handleNegotiationFromProxy(const unsigned char *message, unsigned int length) -{ - #ifdef PANIC - *logofs << "Proxy: PANIC! Reading data during proxy " - << "negotiation is not implemented.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Reading data during proxy " - << "negotiation is not implemented.\n"; - - return -1; -} - -int Proxy::handleAlert(int alert) -{ - if (handleControl(code_alert_request, alert) < 0) - { - return -1; - } - - return 1; -} - -int Proxy::handleCloseConnection(int clientFd) -{ - int channelId = getChannel(clientFd); - - if (channels_[channelId] != NULL && - channels_[channelId] -> getFinish() == 0) - { - #ifdef TEST - *logofs << "Proxy: Closing down the channel for FD#" - << clientFd << ".\n" << logofs_flush; - #endif - - if (handleFinish(channelId) < 0) - { - return -1; - } - - return 1; - } - - return 0; -} - -int Proxy::handleCloseAllXConnections() -{ - #ifdef TEST - *logofs << "Proxy: Closing down any remaining X channel.\n" - << logofs_flush; - #endif - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL && - channels_[channelId] -> getType() == channel_x11 && - channels_[channelId] -> getFinish() == 0) - { - #ifdef TEST - *logofs << "Proxy: Closing down the channel for FD#" - << getFd(channelId) << ".\n" << logofs_flush; - #endif - - if (handleFinish(channelId) < 0) - { - return -1; - } - } - } - - return 1; -} - -int Proxy::handleCloseAllListeners() -{ - // Since ProtoStep7 (#issue 108) - if (finish_ == 0) - { - #ifdef TEST - *logofs << "Proxy: Closing down all remote listeners.\n" - << logofs_flush; - #endif - - if (handleControl(code_finish_listeners) < 0) - { - return -1; - } - - finish_ = 1; - } - - return 1; -} - -void Proxy::handleResetAlert() -{ - if (alert_ != 0) - { - #ifdef TEST - *logofs << "Proxy: The proxy alert '" << alert_ - << "' was displaced.\n" << logofs_flush; - #endif - - alert_ = 0; - } - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL) - { - channels_[channelId] -> handleResetAlert(); - } - } -} - -int Proxy::handleFinish(int channelId) -{ - // - // Send any outstanding encoded data and - // do any finalization needed on the - // channel. - // - - if (needFlush(channelId) == 1) - { - if (channels_[channelId] -> getFinish() == 1) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! The finishing channel ID#" - << channelId << " has data to flush.\n" - << logofs_flush; - #endif - } - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: WARNING! Flushing data for the " - << "finishing channel ID#" << channelId - << ".\n" << logofs_flush; - #endif - - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - // - // Reset the congestion state and the - // timeouts, if needed. - // - - congestions_[channelId] = 0; - - setSplitTimeout(channelId); - setMotionTimeout(channelId); - - if (channels_[channelId] -> getFinish() == 0) - { - channels_[channelId] -> handleFinish(); - - // - // Force a failure in the case somebody - // would try to read from the channel. - // - - shutdown(getFd(channelId), SHUT_RD); - - // - // If the failure was not originated by - // the remote, send a channel shutdown - // message. - // - - if (channels_[channelId] -> getClosing() == 0) - { - #ifdef TEST - *logofs << "Proxy: Finishing channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " because of failure.\n" - << logofs_flush; - #endif - - if (handleControl(code_finish_connection, channelId) < 0) - { - return -1; - } - } - } - - return 1; -} - -int Proxy::handleFinishFromProxy(int channelId) -{ - // - // Check if this channel has pending - // data to send. - // - - if (needFlush(channelId) == 1) - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: WARNING! Flushing data for the " - << "finishing channel ID#" << channelId - << ".\n" << logofs_flush; - #endif - - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - // - // Mark the channel. We will free its - // resources at the next loop and will - // send the drop message to the remote. - // - - if (channels_[channelId] -> getClosing() == 0) - { - #ifdef TEST - *logofs << "Proxy: Marking channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " as closing.\n" - << logofs_flush; - #endif - - channels_[channelId] -> handleClosing(); - } - - if (channels_[channelId] -> getFinish() == 0) - { - #ifdef TEST - *logofs << "Proxy: Finishing channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " because of proxy.\n" - << logofs_flush; - #endif - - channels_[channelId] -> handleFinish(); - } - - if (handleFinish(channelId) < 0) - { - return -1; - } - - return 1; -} - -int Proxy::handleDropFromProxy(int channelId) -{ - // - // Only mark the channel. - // - - #ifdef TEST - *logofs << "Proxy: Marking channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " as being dropped.\n" - << logofs_flush; - #endif - - if (channels_[channelId] -> getDrop() == 0) - { - channels_[channelId] -> handleDrop(); - } - - return 1; -} - -// -// Close the channel and deallocate all its -// resources. -// - -int Proxy::handleDrop(int channelId) -{ - // - // Check if this channel has pending - // data to send. - // - - if (needFlush(channelId) == 1) - { - if (channels_[channelId] -> getFinish() == 1) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! The dropping channel ID#" - << channelId << " has data to flush.\n" - << logofs_flush; - #endif - } - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: WARNING! Flushing data for the " - << "dropping channel ID#" << channelId - << ".\n" << logofs_flush; - #endif - - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - #ifdef TEST - *logofs << "Proxy: Dropping channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - if (channels_[channelId] -> getFinish() == 0) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! The channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " was not marked as " - << "finishing.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": The channel for FD#" - << getFd(channelId) << " channel ID#" - << channelId << " was not marked as " - << "finishing.\n"; - - channels_[channelId] -> handleFinish(); - } - - // - // Send the channel shutdown message - // to the peer proxy. - // - - if (channels_[channelId] -> getClosing() == 1) - { - if (handleControl(code_drop_connection, channelId) < 0) - { - return -1; - } - } - - // - // Get rid of the channel. - // - - if (channels_[channelId] -> getType() != channel_x11) - { - #ifdef TEST - *logofs << "Proxy: Closed connection to " - << getTypeName(channels_[channelId] -> getType()) - << " server.\n" << logofs_flush; - #endif - - cerr << "Info" << ": Closed connection to " - << getTypeName(channels_[channelId] -> getType()) - << " server.\n"; - } - - delete channels_[channelId]; - channels_[channelId] = NULL; - - cleanupChannelMap(channelId); - - // - // Get rid of the transport. - // - - deallocateTransport(channelId); - - congestions_[channelId] = 0; - - decreaseChannels(channelId); - - // - // Check if the channel was the - // one currently selected for - // output. - // - - if (outputChannel_ == channelId) - { - outputChannel_ = -1; - } - - return 1; -} - -// -// Send an empty message to the remote peer -// to verify if the link is alive and let -// the remote proxy detect a congestion. -// - -int Proxy::handlePing() -{ - T_timestamp nowTs = getTimestamp(); - - #if defined(DEBUG) || defined(PING) - - *logofs << "Proxy: Checking ping at " - << strMsTimestamp(nowTs) << logofs_flush; - - *logofs << " with last loop at " - << strMsTimestamp(timeouts_.loopTs) << ".\n" - << logofs_flush; - - *logofs << "Proxy: Last bytes in at " - << strMsTimestamp(timeouts_.readTs) << logofs_flush; - - *logofs << " last bytes out at " - << strMsTimestamp(timeouts_.writeTs) << ".\n" - << logofs_flush; - - *logofs << "Proxy: Last ping at " - << strMsTimestamp(timeouts_.pingTs) << ".\n" - << logofs_flush; - - #endif - - // - // Be sure we take into account any clock drift. This - // can be caused by the user changing the system timer - // or by small adjustments introduced by the operating - // system making the clock go backward. - // - - if (checkDiffTimestamp(timeouts_.loopTs, nowTs) == 0) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Detected drift in system " - << "timer. Resetting to current time.\n" - << logofs_flush; - #endif - - timeouts_.pingTs = nowTs; - timeouts_.readTs = nowTs; - timeouts_.writeTs = nowTs; - } - - // - // Check timestamp of last read from remote proxy. It can - // happen that we stayed in the main loop long enough to - // have idle timeout expired, for example if the proxy was - // stopped and restarted or because of an extremely high - // load of the system. In this case we don't complain if - // there is something new to read from the remote. - // - - int diffIn = diffTimestamp(timeouts_.readTs, nowTs); - - if (diffIn >= (control -> PingTimeout * 2) - - control -> LatencyTimeout) - { - // - // Force a read to detect whether the remote proxy - // aborted the connection. - // - - int result = handleRead(); - - if (result < 0) - { - #if defined(TEST) || defined(INFO) || defined(PING) - *logofs << "Proxy: WARNING! Detected shutdown waiting " - << "for the ping after " << diffIn / 1000 - << " seconds.\n" << logofs_flush; - #endif - - return -1; - } - else if (result > 0) - { - diffIn = diffTimestamp(timeouts_.readTs, nowTs); - - if (handleFlush() < 0) - { - return -1; - } - } - } - - if (diffIn >= (control -> PingTimeout * 2) - - control -> LatencyTimeout) - { - #if defined(TEST) || defined(INFO) || defined(PING) - *logofs << "Proxy: Detected congestion at " - << strMsTimestamp() << " with " << diffIn / 1000 - << " seconds since the last read.\n" - << logofs_flush; - #endif - - // - // There are two types of proxy congestion. The first, - // affecting the ability of the proxy to write the - // encoded data to the network, is controlled by the - // congestion_ flag. The flag is raised when no data - // is received from the remote proxy within a timeout. - // On the X client side, the flag is also raised when - // the proxy runs out of tokens. - // - - if (control -> ProxyMode == proxy_server) - { - // - // At X server side we must return to read data - // from the channels after a while, because we - // need to give a chance to the channel to read - // the key sequence CTRL+ALT+SHIFT+ESC. - // - - if (congestion_ == 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Forcibly entering congestion due to " - << "timeout with " << tokens_[token_control].remaining - << " tokens.\n" << logofs_flush; - #endif - - congestion_ = 1; - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Forcibly exiting congestion due to " - << "timeout with " << tokens_[token_control].remaining - << " tokens.\n" << logofs_flush; - #endif - - congestion_ = 0; - } - } - else - { - #if defined(TEST) || defined(INFO) - - if (congestion_ == 0) - { - *logofs << "Proxy: Entering congestion due to timeout " - << "with " << tokens_[token_control].remaining - << " tokens.\n" << logofs_flush; - } - - #endif - - congestion_ = 1; - } - - if (control -> ProxyTimeout > 0 && - diffIn >= (control -> ProxyTimeout - - control -> LatencyTimeout)) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No data received from " - << "remote proxy on FD#" << fd_ << " within " - << (diffIn + control -> LatencyTimeout) / 1000 - << " seconds.\n" << logofs_flush; - #endif - - cerr << "Error" << ": No data received from remote " - << "proxy within " << (diffIn + control -> - LatencyTimeout) / 1000 << " seconds.\n"; - - HandleAbort(); - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: WARNING! No data received from " - << "remote proxy on FD#" << fd_ << " since " - << diffIn << " Ms.\n" << logofs_flush; - #endif - - if (control -> ProxyTimeout > 0 && - isTimestamp(timeouts_.alertTs) == 0 && - diffIn >= (control -> ProxyTimeout - - control -> LatencyTimeout) / 4) - { - // - // If we are in the middle of a shutdown - // procedure but the remote is not resp- - // onding, force the closure of the link. - // - - if (finish_ != 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No response received from " - << "the remote proxy on FD#" << fd_ << " while " - << "waiting for the shutdown.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No response received from remote " - << "proxy while waiting for the shutdown.\n"; - - HandleAbort(); - } - else - { - cerr << "Warning" << ": No data received from remote " - << "proxy within " << (diffIn + control -> - LatencyTimeout) / 1000 << " seconds.\n"; - - if (alert_ == 0) - { - if (control -> ProxyMode == proxy_client) - { - alert_ = CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT; - } - else - { - alert_ = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT; - } - - HandleAlert(alert_, 1); - } - - timeouts_.alertTs = nowTs; - } - } - } - } - - // - // Check if we need to update the congestion - // counter. - // - - int diffOut = diffTimestamp(timeouts_.writeTs, nowTs); - - if (agent_ != nothing && congestions_[agent_] == 0 && - statistics -> getCongestionInFrame() >= 1 && - diffOut >= (control -> IdleTimeout - - control -> LatencyTimeout * 5)) - { - #if defined(TEST) || defined(INFO) || defined(PING) - *logofs << "Proxy: Forcing an update of the " - << "congestion counter after timeout.\n" - << logofs_flush; - #endif - - statistics -> updateCongestion(tokens_[token_control].remaining, - tokens_[token_control].limit); - } - - // - // Send a new token if we didn't send any data to - // the remote for longer than the ping timeout. - // The client side sends a token, the server side - // responds with a token reply. - // - // VMWare virtual machines can have the system - // timer deadly broken. Try to send a ping regard- - // less we are the client or the server proxy to - // force a write by the remote. - // - - if (control -> ProxyMode == proxy_client || - diffIn >= (control -> PingTimeout * 4) - - control -> LatencyTimeout) - { - // - // We need to send a new ping even if we didn't - // receive anything from the remote within the - // ping timeout. The server side will respond - // to our ping, so we use the ping to force the - // remote end to send some data. - // - - if (diffIn >= (control -> PingTimeout - - control -> LatencyTimeout * 5) || - diffOut >= (control -> PingTimeout - - control -> LatencyTimeout * 5)) - { - int diffPing = diffTimestamp(timeouts_.pingTs, nowTs); - - if (diffPing < 0 || diffPing >= (control -> PingTimeout - - control -> LatencyTimeout * 5)) - { - #if defined(TEST) || defined(INFO) || defined(PING) - *logofs << "Proxy: Sending a new ping at " << strMsTimestamp() - << " with " << tokens_[token_control].remaining - << " tokens and elapsed in " << diffIn << " out " - << diffOut << " ping " << diffPing - << ".\n" << logofs_flush; - #endif - - if (handleFrame(frame_ping) < 0) - { - return -1; - } - - timeouts_.pingTs = nowTs; - } - #if defined(TEST) || defined(INFO) || defined(PING) - else - { - *logofs << "Proxy: Not sending a new ping with " - << "elapsed in " << diffIn << " out " - << diffOut << " ping " << diffPing - << ".\n" << logofs_flush; - } - #endif - } - } - - return 1; -} - -int Proxy::handleSyncFromProxy(int channelId) -{ - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: WARNING! Received a synchronization " - << "request from the remote proxy.\n" - << logofs_flush; - #endif - - if (handleControl(code_sync_reply, channelId) < 0) - { - return -1; - } - - return 1; -} - -int Proxy::handleResetStores() -{ - // - // Recreate the message stores. - // - - delete clientStore_; - delete serverStore_; - - clientStore_ = new ClientStore(compressor_); - serverStore_ = new ServerStore(compressor_); - - timeouts_.loadTs = nullTimestamp(); - - // - // Replace message stores in channels. - // - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL) - { - if (channels_[channelId] -> setStores(clientStore_, serverStore_) < 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Failed to replace message stores in " - << "channel for FD#" << getFd(channelId) << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to replace message stores in " - << "channel for FD#" << getFd(channelId) << ".\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Proxy: Replaced message stores in channel " - << "for FD#" << getFd(channelId) << ".\n" - << logofs_flush; - } - #endif - } - } - - return 1; -} - -int Proxy::handleResetPersistentCache() -{ - char *fullName = new char[strlen(control -> PersistentCachePath) + - strlen(control -> PersistentCacheName) + 2]; - - strcpy(fullName, control -> PersistentCachePath); - strcat(fullName, "/"); - strcat(fullName, control -> PersistentCacheName); - - #ifdef TEST - *logofs << "Proxy: Going to remove persistent cache file '" - << fullName << "'\n" << logofs_flush; - #endif - - unlink(fullName); - - delete [] fullName; - - delete [] control -> PersistentCacheName; - - control -> PersistentCacheName = NULL; - - return 1; -} - -void Proxy::handleResetFlush() -{ - #ifdef TEST - *logofs << "Proxy: Going to reset flush counters " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - // - // Reset the proxy priority flag. - // - - priority_ = 0; - - // - // Restore buffers to their initial - // size. - // - - transport_ -> partialReset(); - - // - // Update the timestamp of the last - // write operation performed on the - // socket. - // - - timeouts_.writeTs = getTimestamp(); -} - -int Proxy::handleFinish() -{ - // - // Reset the timestamps to give the proxy - // another chance to show the 'no response' - // dialog if the shutdown message doesn't - // come in time. - // - - timeouts_.readTs = getTimestamp(); - - timeouts_.alertTs = nullTimestamp(); - - finish_ = 1; - - return 1; -} - -int Proxy::handleShutdown() -{ - // - // Send shutdown message to remote proxy. - // - - shutdown_ = 1; - - handleControl(code_shutdown_request); - - #ifdef TEST - *logofs << "Proxy: Starting shutdown procedure " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - // - // Ensure that all the data accumulated - // in the transport buffer is flushed - // to the network layer. - // - - for (int i = 0; i < 100; i++) - { - if (canFlush() == 1) - { - handleFlush(); - } - else - { - break; - } - - usleep(100000); - } - - // - // Now wait for the network layers to - // consume all the data. - // - - for (int i = 0; i < 100; i++) - { - if (transport_ -> queued() <= 0) - { - break; - } - - usleep(100000); - } - - // - // Give time to the remote end to read - // the shutdown message and close the - // connection. - // - - transport_ -> wait(10000); - - #ifdef TEST - *logofs << "Proxy: Ending shutdown procedure " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - return 1; -} - -int Proxy::handleChannelConfiguration() -{ - if (activeChannels_.getSize() == 0) - { - #ifdef TEST - *logofs << "Proxy: Going to initialize the static " - << "members in channels for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - Channel::setReferences(); - - ClientChannel::setReferences(); - ServerChannel::setReferences(); - - GenericChannel::setReferences(); - } - - return 1; -} - -int Proxy::handleSocketConfiguration() -{ - // - // Set linger mode on proxy to correctly - // get shutdown notification. - // - - SetLingerTimeout(fd_, 30); - - // - // Set keep-alive on socket so that if remote link - // terminates abnormally (as killed hard or because - // of a power-off) process will get a SIGPIPE. In - // practice this is useless as proxies already ping - // each other every few seconds. - // - - if (control -> OptionProxyKeepAlive == 1) - { - SetKeepAlive(fd_); - } - - // - // Set 'priority' flag at TCP layer for path - // proxy-to-proxy. Look at IPTOS_LOWDELAY in - // man 7 ip. - // - - if (control -> OptionProxyLowDelay == 1) - { - SetLowDelay(fd_); - } - - // - // Update size of TCP send and receive buffers. - // - - if (control -> OptionProxySendBuffer != -1) - { - SetSendBuffer(fd_, control -> OptionProxySendBuffer); - } - - if (control -> OptionProxyReceiveBuffer != -1) - { - SetReceiveBuffer(fd_, control -> OptionProxyReceiveBuffer); - } - - // - // Update TCP_NODELAY settings. Note that on old Linux - // kernels turning off the Nagle algorithm didn't work - // when proxy was run through a PPP link. Trying to do - // so caused the kernel to stop delivering data to us - // if a serious network congestion was encountered. - // - - if (control -> ProxyMode == proxy_client) - { - if (control -> OptionProxyClientNoDelay != -1) - { - SetNoDelay(fd_, control -> OptionProxyClientNoDelay); - } - } - else - { - if (control -> OptionProxyServerNoDelay != -1) - { - SetNoDelay(fd_, control -> OptionProxyServerNoDelay); - } - } - - return 1; -} - -int Proxy::handleLinkConfiguration() -{ - #ifdef TEST - *logofs << "Proxy: Propagating parameters to " - << "channels' read buffers.\n" - << logofs_flush; - #endif - - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL) - { - channels_[channelId] -> handleConfiguration(); - } - } - - #ifdef TEST - *logofs << "Proxy: Propagating parameters to " - << "proxy buffers.\n" - << logofs_flush; - #endif - - readBuffer_.setSize(control -> ProxyInitialReadSize, - control -> ProxyMaximumBufferSize); - - encodeBuffer_.setSize(control -> TransportProxyBufferSize, - control -> TransportProxyBufferThreshold, - control -> TransportMaximumBufferSize); - - transport_ -> setSize(control -> TransportProxyBufferSize, - control -> TransportProxyBufferThreshold, - control -> TransportMaximumBufferSize); - - #ifdef TEST - *logofs << "Proxy: Configuring the proxy timeouts.\n" - << logofs_flush; - #endif - - timeouts_.split = control -> SplitTimeout; - timeouts_.motion = control -> MotionTimeout; - - #ifdef TEST - *logofs << "Proxy: Configuring the proxy tokens.\n" - << logofs_flush; - #endif - - tokens_[token_control].size = control -> TokenSize; - tokens_[token_control].limit = control -> TokenLimit; - - if (tokens_[token_control].limit < 1) - { - tokens_[token_control].limit = 1; - } - - #if defined(TEST) || defined(INFO) || defined(LIMIT) - *logofs << "Proxy: TOKEN! LIMIT! Setting token [" - << DumpToken(token_control) << "] size to " - << tokens_[token_control].size << " and limit to " - << tokens_[token_control].limit << ".\n" - << logofs_flush; - #endif - - tokens_[token_split].size = control -> TokenSize; - tokens_[token_split].limit = control -> TokenLimit / 2; - - if (tokens_[token_split].limit < 1) - { - tokens_[token_split].limit = 1; - } - - #if defined(TEST) || defined(INFO) || defined(LIMIT) - *logofs << "Proxy: TOKEN! LIMIT! Setting token [" - << DumpToken(token_split) << "] size to " - << tokens_[token_split].size << " and limit to " - << tokens_[token_split].limit << ".\n" - << logofs_flush; - #endif - - tokens_[token_data].size = control -> TokenSize; - tokens_[token_data].limit = control -> TokenLimit / 4; - - if (tokens_[token_data].limit < 1) - { - tokens_[token_data].limit = 1; - } - - #if defined(TEST) || defined(INFO) || defined(LIMIT) - *logofs << "Proxy: TOKEN! LIMIT! Setting token [" - << DumpToken(token_data) << "] size to " - << tokens_[token_data].size << " and limit to " - << tokens_[token_data].limit << ".\n" - << logofs_flush; - #endif - - for (int i = token_control; i <= token_data; i++) - { - tokens_[i].remaining = tokens_[i].limit; - } - - #if defined(TEST) || defined(INFO) || defined(LIMIT) - *logofs << "Proxy: LIMIT! Using client bitrate " - << "limit " << control -> ClientBitrateLimit - << " server bitrate limit " << control -> - ServerBitrateLimit << " with local limit " - << control -> LocalBitrateLimit << ".\n" - << logofs_flush; - #endif - - // - // Set the other parameters based on - // the token size. - // - - int base = control -> TokenSize; - - control -> SplitDataThreshold = base * 4; - control -> SplitDataPacketLimit = base / 2; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: LIMIT! Setting split data threshold " - << "to " << control -> SplitDataThreshold - << " split packet limit to " << control -> - SplitDataPacketLimit << " with base " - << base << ".\n" << logofs_flush; - #endif - - // - // Set the number of bytes read from the - // data channels at each loop. This will - // basically determine the maximum band- - // width available for the generic chan- - // nels. - // - - control -> GenericInitialReadSize = base / 2; - control -> GenericMaximumBufferSize = base / 2; - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: LIMIT! Setting generic channel " - << "initial read size to " << control -> - GenericInitialReadSize << " maximum read " - << "size to " << control -> GenericMaximumBufferSize - << " with base " << base << ".\n" - << logofs_flush; - #endif - - return 1; -} - -int Proxy::handleCacheConfiguration() -{ - #ifdef TEST - *logofs << "Proxy: Configuring cache according to pack parameters.\n" - << logofs_flush; - #endif - - // - // Further adjust the cache parameters. If - // packing of the images is enabled, reduce - // the size available for plain images. - // - - if (control -> SessionMode == session_agent) - { - if (control -> PackMethod != NO_PACK) - { - clientStore_ -> getRequestStore(X_PutImage) -> - cacheThreshold = PUTIMAGE_CACHE_THRESHOLD_IF_PACKED; - - clientStore_ -> getRequestStore(X_PutImage) -> - cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED; - } - } - - // - // If this is a shadow session increase the - // size of the image cache. - // - - if (control -> SessionMode == session_shadow) - { - if (control -> PackMethod != NO_PACK) - { - clientStore_ -> getRequestStore(X_NXPutPackedImage) -> - cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD_IF_PACKED_SHADOW; - - clientStore_ -> getRequestStore(X_NXPutPackedImage) -> - cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED_SHADOW; - } - else - { - clientStore_ -> getRequestStore(X_PutImage) -> - cacheThreshold = PUTIMAGE_CACHE_THRESHOLD_IF_SHADOW; - - clientStore_ -> getRequestStore(X_PutImage) -> - cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_SHADOW; - } - } - - return 1; -} - -int Proxy::handleSaveStores() -{ - // - // Save content of stores on disk. - // - - char *cacheToAdopt = NULL; - - // - // Set to false the indicator for cumulative store - // size too small - // - bool isTooSmall = false; - - if (control -> PersistentCacheEnableSave) - { - #ifdef TEST - *logofs << "Proxy: Going to save content of client store.\n" - << logofs_flush; - #endif - - cacheToAdopt = handleSaveAllStores(control -> PersistentCachePath, isTooSmall); - } - #ifdef TEST - else - { - if (control -> ProxyMode == proxy_client) - { - *logofs << "Proxy: Saving persistent cache to disk disabled.\n" - << logofs_flush; - } - else - { - *logofs << "Proxy: PANIC! Protocol violation in command save.\n" - << logofs_flush; - - cerr << "Error" << ": Protocol violation in command save.\n"; - - HandleCleanup(); - } - } - #endif - - if (cacheToAdopt != NULL) - { - // - // Do we have a cache already? - // - - if (control -> PersistentCacheName != NULL) - { - // - // Check if old and new cache are the same. - // In this case don't remove the old cache. - // - - if (strcasecmp(control -> PersistentCacheName, cacheToAdopt) != 0) - { - handleResetPersistentCache(); - } - - delete [] control -> PersistentCacheName; - } - - #ifdef TEST - *logofs << "Proxy: Setting current persistent cache file to '" - << cacheToAdopt << "'\n" << logofs_flush; - #endif - - control -> PersistentCacheName = cacheToAdopt; - - return 1; - } - else - { - #ifdef TEST - *logofs << "Proxy: No cache file produced from message stores.\n" - << logofs_flush; - #endif - - // - // It can be that we didn't generate a new cache - // because store was too small or persistent cache - // was disabled. This is not an error. - // - - if (control -> PersistentCacheEnableSave && !isTooSmall) - { - return -1; - } - else - { - return 0; - } - } -} - -int Proxy::handleLoadStores() -{ - // - // Restore the content of the client store - // from disk if a valid cache was negotiated - // at session startup. - // - - if (control -> PersistentCacheEnableLoad == 1 && - control -> PersistentCachePath != NULL && - control -> PersistentCacheName != NULL) - { - #ifdef TEST - *logofs << "Proxy: Going to load content of client store.\n" - << logofs_flush; - #endif - - // - // Returns the same string passed as name of - // the cache, or NULL if it was not possible - // to load the cache from disk. - // - - if (handleLoadAllStores(control -> PersistentCachePath, - control -> PersistentCacheName) == NULL) - { - // - // The corrupted cache should have been - // removed from disk. Get rid of the - // reference so we don't try to delete - // it once again. - // - - if (control -> PersistentCacheName != NULL) - { - delete [] control -> PersistentCacheName; - } - - control -> PersistentCacheName = NULL; - - return -1; - } - - // - // Set timestamp of last time cache - // was loaded from data on disk. - // - - timeouts_.loadTs = getTimestamp(); - - return 1; - } - #ifdef TEST - else - { - if (control -> ProxyMode == proxy_client) - { - *logofs << "Proxy: Loading of cache disabled or no cache file selected.\n" - << logofs_flush; - } - else - { - *logofs << "Proxy: PANIC! Protocol violation in command load.\n" - << logofs_flush; - - cerr << "Error" << ": Protocol violation in command load.\n"; - - HandleCleanup(); - } - } - #endif - - return 0; -} - -int Proxy::handleControl(T_proxy_code code, int data) -{ - // - // Send the given control messages - // to the remote proxy. - // - - #if defined(TEST) || defined(INFO) - - if (data != -1) - { - if (code == code_control_token_reply || - code == code_split_token_reply || - code == code_data_token_reply) - { - *logofs << "Proxy: TOKEN! Sending message '" << DumpControl(code) - << "' at " << strMsTimestamp() << " with count " - << data << ".\n" << logofs_flush; - } - else - { - *logofs << "Proxy: Sending message '" << DumpControl(code) - << "' at " << strMsTimestamp() << " with data ID#" - << data << ".\n" << logofs_flush; - } - } - else - { - *logofs << "Proxy: Sending message '" << DumpControl(code) - << "' at " << strMsTimestamp() << ".\n" - << logofs_flush; - } - - #endif - - // - // Add the control message and see if the - // data has to be flushed immediately. - // - - if (addControlCodes(code, data) < 0) - { - return -1; - } - - switch (code) - { - // - // Append the first data read from the opened - // channel to the control code. - // - - case code_new_x_connection: - case code_new_cups_connection: - case code_new_aux_connection: - case code_new_smb_connection: - case code_new_media_connection: - case code_new_http_connection: - case code_new_font_connection: - case code_new_slave_connection: - - // - // Do we send the token reply immediately? - // The control messages are put at the begin- - // ning of the of the encode buffer, so we may - // reply to multiple tokens before having the - // chance of handling the actual frame data. - // On the other hand, the sooner we reply, the - // sooner the remote proxy is restarted. - // - - case code_control_token_reply: - case code_split_token_reply: - case code_data_token_reply: - { - break; - } - - // - // Also send the congestion control codes - // immediately. - // - // case code_begin_congestion: - // case code_end_congestion: - // - - default: - { - priority_ = 1; - - break; - } - } - - if (priority_ == 1) - { - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - return 1; -} - -int Proxy::handleSwitch(int channelId) -{ - // - // If data is for a different channel than last - // selected for output, prepend to the data the - // new channel id. - // - - #ifdef DEBUG - *logofs << "Proxy: Requested a switch with " - << "current channel ID#" << outputChannel_ - << " new channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - if (channelId != outputChannel_) - { - if (needFlush() == 1) - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: WARNING! Flushing data for the " - << "previous channel ID#" << outputChannel_ - << ".\n" << logofs_flush; - #endif - - if (handleFrame(frame_data) < 0) - { - return -1; - } - } - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Sending message '" - << DumpControl(code_switch_connection) << "' at " - << strMsTimestamp() << " with FD#" << getFd(channelId) - << " channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - if (addControlCodes(code_switch_connection, channelId) < 0) - { - return -1; - } - - outputChannel_ = channelId; - } - - return 1; -} - -int Proxy::addTokenCodes(T_proxy_token &token) -{ - #if defined(TEST) || defined(INFO) || defined(TOKEN) - *logofs << "Proxy: TOKEN! Sending token [" - << DumpToken(token.type) << "] with " - << token.bytes << " bytes accumulated size " - << token.size << " and " << token.remaining - << " available.\n" << logofs_flush; - #endif - - // - // Give a 'weight' to the token. The tokens - // remaining can become negative if we sent - // a packet that was exceptionally big. - // - - int count = 0; - - // Since ProtoStep7 (#issue 108) - count = token.bytes / token.size; - - // - // Force a count of 1, for example - // if this is a ping. - // - - if (count < 1) - { - count = 1; - - token.bytes = 0; - } - else - { - // Since ProtoStep7 (#issue 108) - if (count > 255) - { - count = 255; - } - - // - // Let the next token account for the - // remaining bytes. - // - - token.bytes %= token.size; - } - - #if defined(TEST) || defined(INFO) || defined(TOKEN) - *logofs << "Proxy: Sending message '" - << DumpControl(token.request) << "' at " - << strMsTimestamp() << " with count " << count - << ".\n" << logofs_flush; - #endif - - controlCodes_[controlLength_++] = 0; - controlCodes_[controlLength_++] = (unsigned char) token.request; - controlCodes_[controlLength_++] = (unsigned char) count; - - statistics -> addFrameOut(); - - token.remaining -= count; - - return 1; -} - -int Proxy::handleToken(T_frame_type type) -{ - #if defined(TEST) || defined(INFO) || defined(TOKEN) - *logofs << "Proxy: TOKEN! Checking tokens with " - << "frame type ["; - - *logofs << (type == frame_ping ? "frame_ping" : "frame_data"); - - *logofs << "] with stream ratio " << statistics -> - getStreamRatio() << ".\n" << logofs_flush; - #endif - - if (type == frame_data) - { - // - // Since ProtoStep7 (#issue 108) - // - - // Send a distinct token for each data type. - // We don't want to slow down the sending of - // the X events, X replies and split confir- - // mation events on the X server side, so - // take care only of the generic data token. - // - - if (control -> ProxyMode == proxy_client) - { - statistics -> updateControlToken(tokens_[token_control].bytes); - - if (tokens_[token_control].bytes > tokens_[token_control].size) - { - if (addTokenCodes(tokens_[token_control]) < 0) - { - return -1; - } - - #if defined(TEST) || defined(INFO) || defined(TOKEN) - - T_proxy_token &token = tokens_[token_control]; - - *logofs << "Proxy: TOKEN! Token class [" - << DumpToken(token.type) << "] has now " - << token.bytes << " bytes accumulated and " - << token.remaining << " tokens remaining.\n" - << logofs_flush; - #endif - } - - statistics -> updateSplitToken(tokens_[token_split].bytes); - - if (tokens_[token_split].bytes > tokens_[token_split].size) - { - if (addTokenCodes(tokens_[token_split]) < 0) - { - return -1; - } - - #if defined(TEST) || defined(INFO) || defined(TOKEN) - - T_proxy_token &token = tokens_[token_split]; - - *logofs << "Proxy: TOKEN! Token class [" - << DumpToken(token.type) << "] has now " - << token.bytes << " bytes accumulated and " - << token.remaining << " tokens remaining.\n" - << logofs_flush; - #endif - } - } - - statistics -> updateDataToken(tokens_[token_data].bytes); - - if (tokens_[token_data].bytes > tokens_[token_data].size) - { - if (addTokenCodes(tokens_[token_data]) < 0) - { - return -1; - } - - #if defined(TEST) || defined(INFO) || defined(TOKEN) - - T_proxy_token &token = tokens_[token_data]; - - *logofs << "Proxy: TOKEN! Token class [" - << DumpToken(token.type) << "] has now " - << token.bytes << " bytes accumulated and " - << token.remaining << " tokens remaining.\n" - << logofs_flush; - #endif - } - } - else - { - if (addTokenCodes(tokens_[token_control]) < 0) - { - return -1; - } - - // - // Reset all counters on a ping. - // - - tokens_[token_control].bytes = 0; - tokens_[token_split].bytes = 0; - tokens_[token_data].bytes = 0; - - #if defined(TEST) || defined(INFO) || defined(TOKEN) - - T_proxy_token &token = tokens_[token_control]; - - *logofs << "Proxy: TOKEN! Token class [" - << DumpToken(token.type) << "] has now " - << token.bytes << " bytes accumulated and " - << token.remaining << " tokens remaining.\n" - << logofs_flush; - #endif - } - - // - // Check if we have entered in - // congestion state. - // - - if (congestion_ == 0 && - tokens_[token_control].remaining <= 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Entering congestion with " - << tokens_[token_control].remaining - << " tokens remaining.\n" << logofs_flush; - #endif - - congestion_ = 1; - } - - statistics -> updateCongestion(tokens_[token_control].remaining, - tokens_[token_control].limit); - - return 1; -} - -int Proxy::handleTokenFromProxy(T_proxy_token &token, int count) -{ - #if defined(TEST) || defined(INFO) || defined(TOKEN) - *logofs << "Proxy: TOKEN! Received token [" - << DumpToken(token.type) << "] request at " - << strMsTimestamp() << " with count " - << count << ".\n" << logofs_flush; - #endif - - // - // Since ProtoStep7 (#issue 108) with no limitations - // concerning invalid token requests at this point - // - - // - // Add our token reply. - // - - if (handleControl(token.reply, count) < 0) - { - return -1; - } - - return 1; -} - -int Proxy::handleTokenReplyFromProxy(T_proxy_token &token, int count) -{ - #if defined(TEST) || defined(INFO) || defined(TOKEN) - *logofs << "Proxy: TOKEN! Received token [" - << DumpToken(token.type) << "] reply at " - << strMsTimestamp() << " with count " << count - << ".\n" << logofs_flush; - #endif - - // - // Since ProtoStep7 (#issue 108) with no limitations - // concerning invalid token requests at this point - // - - // - // Increment the available tokens. - // - - token.remaining += count; - - if (token.remaining > token.limit) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Token overflow handling messages.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Token overflow handling messages.\n"; - - HandleCleanup(); - } - - #if defined(TEST) || defined(INFO) || defined(TOKEN) - *logofs << "Proxy: TOKEN! Token class [" - << DumpToken(token.type) << "] has now " << token.bytes - << " bytes accumulated and " << token.remaining - << " tokens remaining.\n" << logofs_flush; - #endif - - // - // Check if we can jump out of the - // congestion state. - // - - if (congestion_ == 1 && - tokens_[token_control].remaining > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Exiting congestion with " - << tokens_[token_control].remaining - << " tokens remaining.\n" << logofs_flush; - #endif - - congestion_ = 0; - } - - statistics -> updateCongestion(tokens_[token_control].remaining, - tokens_[token_control].limit); - - return 1; -} - -void Proxy::handleFailOnSave(const char *fullName, const char *failContext) const -{ - #ifdef WARNING - *logofs << "Proxy: WARNING! Error saving stores to cache file " - << "in context [" << failContext << "].\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Error saving stores to cache file " - << "in context [" << failContext << "].\n"; - - #ifdef WARNING - *logofs << "Proxy: WARNING! Removing invalid cache '" - << fullName << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Removing invalid cache '" - << fullName << "'.\n"; - - unlink(fullName); -} - -void Proxy::handleFailOnLoad(const char *fullName, const char *failContext) const -{ - #ifdef WARNING - *logofs << "Proxy: WARNING! Error loading stores from cache file " - << "in context [" << failContext << "].\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Error loading stores from cache file " - << "in context [" << failContext << "].\n"; - - #ifdef WARNING - *logofs << "Proxy: WARNING! Removing invalid cache '" - << fullName << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Removing invalid cache '" - << fullName << "'.\n"; - - unlink(fullName); -} - -int Proxy::handleSaveVersion(unsigned char *buffer, int &major, - int &minor, int &patch) const -{ - // Since ProtoStep8 (#issue 108) - major = 3; - minor = 0; - patch = 0; - - *(buffer + 0) = major; - *(buffer + 1) = minor; - - PutUINT(patch, buffer + 2, storeBigEndian()); - - return 1; -} - -int Proxy::handleLoadVersion(const unsigned char *buffer, int &major, - int &minor, int &patch) const -{ - major = *(buffer + 0); - minor = *(buffer + 1); - - patch = GetUINT(buffer + 2, storeBigEndian()); - - // - // Force the proxy to discard the - // incompatible caches. - // - - // Since ProtoStep8 (#issue 108) - if (major < 3) - { - return -1; - } - - return 1; -} - -char *Proxy::handleSaveAllStores(const char *savePath, bool & isTooSmall) const -{ - isTooSmall = false; - - int cumulativeSize = MessageStore::getCumulativeTotalStorageSize(); - - if (cumulativeSize < control -> PersistentCacheThreshold) - { - #ifdef TEST - *logofs << "Proxy: Cache not saved as size is " - << cumulativeSize << " with threshold set to " - << control -> PersistentCacheThreshold - << ".\n" << logofs_flush; - #endif - - // - // Cumulative store size is smaller than threshold - // so the indicator is set to true - // - - isTooSmall = true; - - return NULL; - } - else if (savePath == NULL) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No name provided for save path.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No name provided for save path.\n"; - - return NULL; - } - - #ifdef TEST - *logofs << "Proxy: Going to save content of message stores.\n" - << logofs_flush; - #endif - - // - // Our parent process is likely going to terminate. - // Until we finish saving cache we must ignore its - // SIGIPE. - // - - DisableSignals(); - - ofstream *cachefs = NULL; - - md5_state_t *md5StateStream = NULL; - md5_byte_t *md5DigestStream = NULL; - - md5_state_t *md5StateClient = NULL; - md5_byte_t *md5DigestClient = NULL; - - char md5String[MD5_LENGTH * 2 + 2]; - - char fullName[strlen(savePath) + MD5_LENGTH * 2 + 4]; - - // - // Prepare the template for the temporary file - // - - const char* const uniqueTemplate = "XXXXXX"; - char tempName[strlen(savePath) + strlen("/") + 4 + strlen(uniqueTemplate) + 1]; - - snprintf(tempName, sizeof tempName, "%s/%s%s", - savePath, - control -> ProxyMode == proxy_client ? - "Z-C-" : - "Z-S-", - uniqueTemplate); - - #ifdef TEST - *logofs << "Proxy: Generating temporary file with template '" - << tempName << "'.\n" << logofs_flush; - #endif - - // - // Change the mask to make the file only - // readable by the user, then restore the - // old mask. - // - - mode_t fileMode = umask(0077); - - // - // Generate a unique temporary filename from tempName - // and then create and open the file - // - - int fdTemp = mkstemp(tempName); - if (fdTemp == -1) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't create temporary file in '" - << savePath << "'. Cause = " << strerror(errno) << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't create temporary file in '" - << savePath << "'. Cause = " << strerror(errno) << ".\n"; - - umask(fileMode); - - EnableSignals(); - - return NULL; - } - - #ifdef TEST - *logofs << "Proxy: Saving cache to file '" - << tempName << "'.\n" << logofs_flush; - #endif - - // - // Create and open the output stream for the new temporary - // file - // - - cachefs = new (std::nothrow) ofstream(tempName, ios::out | ios::binary); - if ((cachefs == NULL) || cachefs->fail()) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't create stream for temporary file '" - << tempName << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't create stream for temporary file '" - << tempName << "'.\n"; - - close(fdTemp); - unlink(tempName); - - umask(fileMode); - - EnableSignals(); - - return NULL; - } - - // - // Close the file descriptor returned by mkstemp - // and restore the old mask - // - - close(fdTemp); - umask(fileMode); - - md5StateStream = new md5_state_t(); - md5DigestStream = new md5_byte_t[MD5_LENGTH]; - - md5_init(md5StateStream); - - // - // First write the proxy version. - // - - unsigned char version[4]; - - int major; - int minor; - int patch; - - handleSaveVersion(version, major, minor, patch); - - #ifdef TEST - *logofs << "Proxy: Saving cache using version '" - << major << "." << minor << "." << patch - << "'.\n" << logofs_flush; - #endif - - if (PutData(cachefs, version, 4) < 0) - { - handleFailOnSave(tempName, "A"); - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - EnableSignals(); - - return NULL; - } - - // - // Make space for the calculated MD5 so we - // can later rewind the file and write it - // at this position. - // - - if (PutData(cachefs, md5DigestStream, MD5_LENGTH) < 0) - { - handleFailOnSave(tempName, "B"); - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - EnableSignals(); - - return NULL; - } - - md5StateClient = new md5_state_t(); - md5DigestClient = new md5_byte_t[MD5_LENGTH]; - - md5_init(md5StateClient); - - #ifdef DUMP - - ofstream *cacheDump = NULL; - - ofstream *tempfs = (ofstream*) logofs; - - char cacheDumpName[DEFAULT_STRING_LENGTH]; - - if (control -> ProxyMode == proxy_client) - { - snprintf(cacheDumpName, DEFAULT_STRING_LENGTH - 1, - "%s/client-cache-dump", control -> TempPath); - } - else - { - snprintf(cacheDumpName, DEFAULT_STRING_LENGTH - 1, - "%s/server-cache-dump", control -> TempPath); - } - - *(cacheDumpName + DEFAULT_STRING_LENGTH - 1) = '\0'; - - fileMode = umask(0077); - - cacheDump = new ofstream(cacheDumpName, ios::out); - - umask(fileMode); - - logofs = cacheDump; - - #endif - - // - // Use the virtual method of the concrete proxy class. - // - - int allSaved = handleSaveAllStores(cachefs, md5StateStream, md5StateClient); - - #ifdef DUMP - - logofs = tempfs; - - delete cacheDump; - - #endif - - if (allSaved == -1) - { - handleFailOnSave(tempName, "C"); - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - delete md5StateClient; - delete [] md5DigestClient; - - EnableSignals(); - - return NULL; - } - - md5_finish(md5StateClient, md5DigestClient); - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - sprintf(md5String + (i * 2), "%02X", md5DigestClient[i]); - } - - strcpy(fullName, (control -> ProxyMode == proxy_client) ? "C-" : "S-"); - - strcat(fullName, md5String); - - md5_append(md5StateStream, (const md5_byte_t *) fullName, strlen(fullName)); - md5_finish(md5StateStream, md5DigestStream); - - // - // Go to the beginning of file plus - // the integer where we wrote our - // proxy version. - // - - cachefs -> seekp(4); - - if (PutData(cachefs, md5DigestStream, MD5_LENGTH) < 0) - { - handleFailOnSave(tempName, "D"); - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - delete md5StateClient; - delete [] md5DigestClient; - - EnableSignals(); - - return NULL; - } - - delete cachefs; - - // - // Copy the resulting cache name without - // the path so that we can return it to - // the caller. - // - - char *cacheName = new char[MD5_LENGTH * 2 + 4]; - - strcpy(cacheName, fullName); - - // - // Add the path to the full name and move - // the cache into the path. - // - - strcpy(fullName, savePath); - strcat(fullName, (control -> ProxyMode == proxy_client) ? "/C-" : "/S-"); - strcat(fullName, md5String); - - #ifdef TEST - *logofs << "Proxy: Renaming cache file from '" - << tempName << "' to '" << fullName - << "'.\n" << logofs_flush; - #endif - - rename(tempName, fullName); - - delete md5StateStream; - delete [] md5DigestStream; - - delete md5StateClient; - delete [] md5DigestClient; - - // - // Restore the original handlers. - // - - EnableSignals(); - - #ifdef TEST - *logofs << "Proxy: Successfully saved cache file '" - << cacheName << "'.\n" << logofs_flush; - #endif - - // - // This must be enabled only for test - // because it requires that client and - // server reside on the same machine. - // - - if (control -> PersistentCacheCheckOnShutdown == 1 && - control -> ProxyMode == proxy_server) - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: MATCH! Checking if the file '" - << fullName << "' matches a client cache.\n" - << logofs_flush; - #endif - - strcpy(fullName, savePath); - strcat(fullName, "/C-"); - strcat(fullName, md5String); - - struct stat fileStat; - - if (stat(fullName, &fileStat) != 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't find a client cache " - << "with name '" << fullName << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't find a client cache " - << "with name '" << fullName << "'.\n"; - - HandleShutdown(); - } - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: MATCH! Client cache '" << fullName - << "' matches the local cache.\n" - << logofs_flush; - #endif - } - - return cacheName; -} - -const char *Proxy::handleLoadAllStores(const char *loadPath, const char *loadName) const -{ - #ifdef TEST - *logofs << "Proxy: Going to load content of message stores.\n" - << logofs_flush; - #endif - - // - // Until we finish loading cache we - // must at least ignore any SIGIPE. - // - - DisableSignals(); - - if (loadPath == NULL || loadName == NULL) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No path or no file name provided for cache to restore.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No path or no file name provided for cache to restore.\n"; - - EnableSignals(); - - return NULL; - } - else if (strlen(loadName) != MD5_LENGTH * 2 + 2) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Bad file name provided for cache to restore.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Bad file name provided for cache to restore.\n"; - - EnableSignals(); - - return NULL; - } - - istream *cachefs = NULL; - char md5String[(MD5_LENGTH * 2) + 2]; - md5_byte_t md5FromFile[MD5_LENGTH]; - - char *cacheName = new char[strlen(loadPath) + strlen(loadName) + 3]; - - strcpy(cacheName, loadPath); - strcat(cacheName, "/"); - strcat(cacheName, loadName); - - #ifdef TEST - *logofs << "Proxy: Name of cache file is '" - << cacheName << "'.\n" << logofs_flush; - #endif - - cachefs = new ifstream(cacheName, ios::in | ios::binary); - - unsigned char version[4]; - - if (cachefs == NULL || GetData(cachefs, version, 4) < 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't read cache file '" - << cacheName << "'.\n" << logofs_flush;; - #endif - - handleFailOnLoad(cacheName, "A"); - - delete cachefs; - - delete [] cacheName; - - EnableSignals(); - - return NULL; - } - - int major; - int minor; - int patch; - - if (handleLoadVersion(version, major, minor, patch) < 0) - { - #ifdef PANIC - *logofs << "Proxy: WARNING! Incompatible version '" - << major << "." << minor << "." << patch - << "' in cache file '" << cacheName - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Incompatible version '" - << major << "." << minor << "." << patch - << "' in cache file '" << cacheName - << "'.\n" << logofs_flush; - - if (control -> ProxyMode == proxy_server) - { - handleFailOnLoad(cacheName, "B"); - } - else - { - // - // Simply remove the cache file. - // - - unlink(cacheName); - } - - delete cachefs; - - delete [] cacheName; - - EnableSignals(); - - return NULL; - } - - #ifdef TEST - *logofs << "Proxy: Reading from cache file version '" - << major << "." << minor << "." << patch - << "'.\n" << logofs_flush; - #endif - - if (GetData(cachefs, md5FromFile, MD5_LENGTH) < 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No checksum in cache file '" - << loadName << "'.\n" << logofs_flush; - #endif - - handleFailOnLoad(cacheName, "C"); - - delete cachefs; - - delete [] cacheName; - - EnableSignals(); - - return NULL; - } - - md5_state_t *md5StateStream = NULL; - md5_byte_t *md5DigestStream = NULL; - - md5StateStream = new md5_state_t(); - md5DigestStream = new md5_byte_t[MD5_LENGTH]; - - md5_init(md5StateStream); - - // - // Use the virtual method of the proxy class. - // - - if (handleLoadAllStores(cachefs, md5StateStream) < 0) - { - handleFailOnLoad(cacheName, "D"); - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - delete [] cacheName; - - EnableSignals(); - - return NULL; - } - - md5_append(md5StateStream, (const md5_byte_t *) loadName, strlen(loadName)); - md5_finish(md5StateStream, md5DigestStream); - - for (int i = 0; i < MD5_LENGTH; i++) - { - if (md5DigestStream[i] != md5FromFile[i]) - { - #ifdef PANIC - - *logofs << "Proxy: PANIC! Bad checksum for cache file '" - << cacheName << "'.\n" << logofs_flush; - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - sprintf(md5String + (i * 2), "%02X", md5FromFile[i]); - } - - *logofs << "Proxy: PANIC! Saved checksum is '" - << md5String << "'.\n" << logofs_flush; - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - sprintf(md5String + (i * 2),"%02X", md5DigestStream[i]); - } - - *logofs << "Proxy: PANIC! Calculated checksum is '" - << md5String << "'.\n" << logofs_flush; - - #endif - - handleFailOnLoad(cacheName, "E"); - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - delete [] cacheName; - - EnableSignals(); - - return NULL; - } - } - - delete cachefs; - - delete md5StateStream; - delete [] md5DigestStream; - - delete [] cacheName; - - // - // Restore the original handlers. - // - - EnableSignals(); - - #ifdef TEST - *logofs << "Proxy: Successfully loaded cache file '" - << loadName << "'.\n" << logofs_flush; - #endif - - // - // Return the string provided by caller. - // - - return loadName; -} - -int Proxy::allocateChannelMap(int fd) -{ - // - // We assume that the fd is lower than - // the maximum allowed number. This is - // checked at the time the connection - // is accepted. - // - - if (fd < 0 || fd >= CONNECTIONS_LIMIT) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Internal error allocating " - << "new channel with FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Internal error allocating " - << "new channel with FD#" << fd_ << ".\n"; - - HandleCleanup(); - } - - for (int channelId = 0; - channelId < CONNECTIONS_LIMIT; - channelId++) - { - if (checkLocalChannelMap(channelId) == 1 && - fdMap_[channelId] == -1) - { - fdMap_[channelId] = fd; - channelMap_[fd] = channelId; - - #ifdef TEST - *logofs << "Proxy: Allocated new channel ID#" - << channelId << " with FD#" << fd << ".\n" - << logofs_flush; - #endif - - return channelId; - } - } - - // - // No available channel is remaining. - // - - #ifdef TEST - *logofs << "Proxy: WARNING! Can't allocate a new channel " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return -1; -} - -int Proxy::checkChannelMap(int channelId) -{ - // - // To be acceptable, the channel id must - // be an id that is not possible to use - // to allocate channels at this side. - // - - if (checkLocalChannelMap(channelId) == 1) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't open a new channel " - << "with invalid ID#" << channelId << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't open a new channel " - << "with invalid ID#" << channelId << ".\n"; - - return -1; - } - else if (channels_[channelId] != NULL) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't open a new channel " - << "over an existing ID#" << channelId - << " with FD#" << getFd(channelId) - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't open a new channel " - << "over an existing ID#" << channelId - << " with FD#" << getFd(channelId) - << ".\n"; - - return -1; - } - - return 1; -} - -int Proxy::assignChannelMap(int channelId, int fd) -{ - // - // We assume that the fd is lower than - // the maximum allowed number. This is - // checked at the time the connection - // is accepted. - // - - if (channelId < 0 || channelId >= CONNECTIONS_LIMIT || - fd < 0 || fd >= CONNECTIONS_LIMIT) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Internal error assigning " - << "new channel with FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Internal error assigning " - << "new channel with FD#" << fd_ << ".\n"; - - HandleCleanup(); - } - - fdMap_[channelId] = fd; - channelMap_[fd] = channelId; - - return 1; -} - -void Proxy::cleanupChannelMap(int channelId) -{ - int fd = fdMap_[channelId]; - - if (fd != -1) - { - fdMap_[channelId] = -1; - channelMap_[fd] = -1; - } -} - -int Proxy::addControlCodes(T_proxy_code code, int data) -{ - // - // Flush the encode buffer plus all the outstanding - // control codes if there is not enough space for - // the new control message. We need to ensure that - // there are further bytes available, in the case - // we will need to add more token control messages. - // - - if (controlLength_ + 3 > CONTROL_CODES_THRESHOLD) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Flushing control messages " - << "while sending code '" << DumpControl(code) - << "'.\n" << logofs_flush; - #endif - - if (handleFlush() < 0) - { - return -1; - } - } - - controlCodes_[controlLength_++] = 0; - controlCodes_[controlLength_++] = (unsigned char) code; - controlCodes_[controlLength_++] = (unsigned char) (data == -1 ? 0 : data); - - // - // Account for the control frame. - // - - statistics -> addFrameOut(); - - return 1; -} - -void Proxy::setSplitTimeout(int channelId) -{ - int needed = channels_[channelId] -> needSplit(); - - if (needed != isTimestamp(timeouts_.splitTs)) - { - if (needed == 1) - { - #if defined(TEST) || defined(INFO) || defined(SPLIT) - *logofs << "Proxy: SPLIT! Allocating split timestamp at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - timeouts_.splitTs = getTimestamp(); - } - else - { - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL && - channels_[channelId] -> needSplit() == 1) - { - #ifdef TEST - *logofs << "Proxy: SPLIT! Channel for FD#" - << getFd(channelId) << " still needs splits.\n" - << logofs_flush; - #endif - - return; - } - } - - #if defined(TEST) || defined(INFO) || defined(SPLIT) - *logofs << "Proxy: SPLIT! Resetting split timestamp at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - timeouts_.splitTs = nullTimestamp(); - } - } -} - -void Proxy::setMotionTimeout(int channelId) -{ - int needed = channels_[channelId] -> needMotion(); - - if (needed != isTimestamp(timeouts_.motionTs)) - { - if (channels_[channelId] -> needMotion() == 1) - { - #if defined(TEST) || defined(INFO) || defined(SPLIT) - *logofs << "Proxy: Allocating motion timestamp at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - timeouts_.motionTs = getTimestamp(); - } - else - { - T_list &channelList = activeChannels_.getList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL && - channels_[channelId] -> needMotion() == 1) - { - #ifdef TEST - *logofs << "Proxy: SPLIT! Channel for FD#" - << getFd(channelId) << " still needs motions.\n" - << logofs_flush; - #endif - - return; - } - } - - #if defined(TEST) || defined(INFO) || defined(SPLIT) - *logofs << "Proxy: Resetting motion timestamp at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - timeouts_.motionTs = nullTimestamp(); - } - } -} - -void Proxy::increaseChannels(int channelId) -{ - #ifdef TEST - *logofs << "Proxy: Adding channel " << channelId - << " to the list of active channels.\n" - << logofs_flush; - #endif - - activeChannels_.add(channelId); - - #ifdef TEST - *logofs << "Proxy: There are " << activeChannels_.getSize() - << " allocated channels for proxy FD#" << fd_ - << ".\n" << logofs_flush; - #endif -} - -void Proxy::decreaseChannels(int channelId) -{ - #ifdef TEST - *logofs << "Proxy: Removing channel " << channelId - << " from the list of active channels.\n" - << logofs_flush; - #endif - - activeChannels_.remove(channelId); - - #ifdef TEST - *logofs << "Proxy: There are " << activeChannels_.getSize() - << " allocated channels for proxy FD#" << fd_ - << ".\n" << logofs_flush; - #endif -} - -int Proxy::allocateTransport(int channelFd, int channelId) -{ - if (transports_[channelId] == NULL) - { - transports_[channelId] = new Transport(channelFd); - - if (transports_[channelId] == NULL) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Can't allocate transport for " - << "channel id " << channelId << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate transport for " - << "channel id " << channelId << ".\n"; - - return -1; - } - } - else if (transports_[channelId] -> - getType() != transport_agent) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Transport for channel id " - << channelId << " should be null.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Transport for channel id " - << channelId << " should be null.\n"; - - return -1; - } - - return 1; -} - -int Proxy::deallocateTransport(int channelId) -{ - // - // Transport for the agent connection - // is passed from the outside when - // creating the channel. - // - - if (transports_[channelId] -> - getType() != transport_agent) - { - delete transports_[channelId]; - } - - transports_[channelId] = NULL; - - return 1; -} - -int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const char *label) -{ - int channelId = allocateChannelMap(clientFd); - - if (channelId == -1) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Maximum number of available " - << "channels exceeded.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Maximum number of available " - << "channels exceeded.\n"; - - return -1; - } - - #ifdef TEST - *logofs << "Proxy: Channel for " << label << " descriptor " - << "FD#" << clientFd << " mapped to ID#" - << channelId << ".\n" - << logofs_flush; - #endif - - // - // Turn queuing off for path server-to-proxy. - // - - SetNoDelay(clientFd, 1); - - if (allocateTransport(clientFd, channelId) < 0) - { - return -1; - } - - switch (type) - { - case channel_cups: - { - channels_[channelId] = new CupsChannel(transports_[channelId], compressor_); - - break; - } - case channel_smb: - { - channels_[channelId] = new SmbChannel(transports_[channelId], compressor_); - - break; - } - case channel_media: - { - channels_[channelId] = new MediaChannel(transports_[channelId], compressor_); - - break; - } - case channel_http: - { - channels_[channelId] = new HttpChannel(transports_[channelId], compressor_); - - break; - } - case channel_font: - { - channels_[channelId] = new FontChannel(transports_[channelId], compressor_); - - break; - } - default: - { - channels_[channelId] = new SlaveChannel(transports_[channelId], compressor_); - - break; - } - } - - if (channels_[channelId] == NULL) - { - deallocateTransport(channelId); - - return -1; - } - - #ifdef TEST - *logofs << "Proxy: Accepted new connection to " - << label << " server.\n" << logofs_flush; - #endif - - cerr << "Info" << ": Accepted new connection to " - << label << " server.\n"; - - increaseChannels(channelId); - - switch (type) - { - case channel_cups: - { - if (handleControl(code_new_cups_connection, channelId) < 0) - { - return -1; - } - - break; - } - case channel_smb: - { - if (handleControl(code_new_smb_connection, channelId) < 0) - { - return -1; - } - - break; - } - case channel_media: - { - if (handleControl(code_new_media_connection, channelId) < 0) - { - return -1; - } - - break; - } - case channel_http: - { - if (handleControl(code_new_http_connection, channelId) < 0) - { - return -1; - } - - break; - } - case channel_font: - { - if (handleControl(code_new_font_connection, channelId) < 0) - { - return -1; - } - - break; - } - default: - { - if (handleControl(code_new_slave_connection, channelId) < 0) - { - return -1; - } - - break; - } - } - - channels_[channelId] -> handleConfiguration(); - - return 1; -} - -int Proxy::handleNewSlaveConnection(int clientFd) -{ - // Since ProtoStep7 (#issue 108) - return handleNewGenericConnection(clientFd, channel_slave, "slave"); -} - - - -int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type, - ChannelEndPoint &endPoint, const char *label) -{ - char *unixPath, *host; - long port; - - if (endPoint.getUnixPath(&unixPath)) { - return handleNewGenericConnectionFromProxyUnix(channelId, type, unixPath, label); - } - - if (endPoint.getTCPHostAndPort(&host, &port)) { - return handleNewGenericConnectionFromProxyTCP(channelId, type, host, port, label); - } - - #ifdef WARNING - *logofs << "Proxy: WARNING! Refusing attempted connection " - << "to " << label << " server.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Refusing attempted connection " - << "to " << label << " server.\n"; - - return -1; -} - -int Proxy::handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type, - const char *hostname, long port, const char *label) - -{ - if (port <= 0) - { - // - // This happens when user has disabled - // forwarding of the specific service. - // - - #ifdef WARNING - *logofs << "Proxy: WARNING! Refusing attempted connection " - << "to " << label << " server.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Refusing attempted connection " - << "to " << label << " server.\n"; - - return -1; - } - - const char *serverHost = hostname; - int serverAddrFamily = AF_INET; - sockaddr *serverAddr = NULL; - unsigned int serverAddrLength = 0; - - #ifdef TEST - *logofs << "Proxy: Connecting to " << label - << " server '" << serverHost << "' on TCP port '" - << port << "'.\n" << logofs_flush; - #endif - - int serverIPAddr = GetHostAddress(serverHost); - - if (serverIPAddr == 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Unknown " << label - << " server host '" << serverHost << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Unknown " << label - << " server host '" << serverHost - << "'.\n"; - - return -1; - } - - sockaddr_in *serverAddrTCP = new sockaddr_in; - - serverAddrTCP -> sin_family = AF_INET; - serverAddrTCP -> sin_port = htons(port); - serverAddrTCP -> sin_addr.s_addr = serverIPAddr; - - serverAddr = (sockaddr *) serverAddrTCP; - serverAddrLength = sizeof(sockaddr_in); - - // - // Connect to the requested server. - // - - int serverFd = socket(serverAddrFamily, SOCK_STREAM, PF_UNSPEC); - - if (serverFd < 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - delete serverAddrTCP; - - return -1; - } - else if (connect(serverFd, serverAddr, serverAddrLength) < 0) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Connection to " << label - << " server '" << serverHost << ":" << port - << "' failed with error '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Connection to " << label - << " server '" << serverHost << ":" << port - << "' failed with error '" << ESTR() << "'.\n"; - - close(serverFd); - - delete serverAddrTCP; - - return -1; - } - - delete serverAddrTCP; - - if (handlePostConnectionFromProxy(channelId, serverFd, type, label) < 0) - { - return -1; - } - - #ifdef TEST - *logofs << "Proxy: Forwarded new connection to " - << label << " server on port '" << port - << "'.\n" << logofs_flush; - #endif - - cerr << "Info" << ": Forwarded new connection to " - << label << " server on port '" << port - << "'.\n"; - - return 1; -} - -int Proxy::handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type, - const char *path, const char *label) -{ - if (path == NULL || *path == '\0' ) - { - // - // This happens when user has disabled - // forwarding of the specific service. - // - - #ifdef WARNING - *logofs << "Proxy: WARNING! Refusing attempted connection " - << "to " << label << " server.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Refusing attempted connection " - << "to " << label << " server.\n"; - - return -1; - } - - sockaddr_un serverAddrUnix; - - unsigned int serverAddrLength = sizeof(sockaddr_un); - - int serverAddrFamily = AF_UNIX; - - serverAddrUnix.sun_family = AF_UNIX; - - const int serverAddrNameLength = 108; - - strncpy(serverAddrUnix.sun_path, path, serverAddrNameLength); - - *(serverAddrUnix.sun_path + serverAddrNameLength - 1) = '\0'; - - #ifdef TEST - *logofs << "Proxy: Connecting to " << label << " server " - << "on Unix port '" << path << "'.\n" << logofs_flush; - #endif - - // - // Connect to the requested server. - // - - int serverFd = socket(serverAddrFamily, SOCK_STREAM, PF_UNSPEC); - - if (serverFd < 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - return -1; - } - else if (connect(serverFd, (sockaddr *) &serverAddrUnix, serverAddrLength) < 0) - { - #ifdef WARNING - *logofs << "Proxy: WARNING! Connection to " << label - << " server on Unix port '" << path << "' failed " - << "with error " << EGET() << ", '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Connection to " << label - << " server on Unix port '" << path << "' failed " - << "with error " << EGET() << ", '" << ESTR() << "'.\n"; - - close(serverFd); - - return -1; - } - - if (handlePostConnectionFromProxy(channelId, serverFd, type, label) < 0) - { - return -1; - } - - #ifdef TEST - *logofs << "Proxy: Forwarded new connection to " - << label << " server on Unix port '" << path - << "'.\n" << logofs_flush; - #endif - - cerr << "Info" << ": Forwarded new connection to " - << label << " server on Unix port '" << path - << "'.\n"; - - return 1; -} - -int Proxy::handleNewSlaveConnectionFromProxy(int channelId) -{ - - cerr << "Info" << ": New slave connection on " - << "channel ID#" << channelId << "\n"; - - char *nx_slave_cmd = getenv("NX_SLAVE_CMD"); - if (nx_slave_cmd == NULL) { - return -1; - } - - int spair[2]; - if (socketpair(AF_UNIX, SOCK_STREAM, 0, spair) == -1) { - perror("socketpair"); - return -1; - } - - int serverFd = spair[0]; - int clientFd = spair[1]; - - if (handlePostConnectionFromProxy(channelId, serverFd, channel_slave, "slave") < 0) - { - close(serverFd); - close(clientFd); - return -1; - } - - - int pid = fork(); - if (pid == 0) - { - - if (dup2(clientFd, 0) == -1) - { - perror("dup2"); - exit(1); - } - - if (dup2(clientFd, 1) == -1) - { - perror("dup2"); - exit(1); - } - - close(serverFd); - close(clientFd); - - /* Close FDs used by NX, QVD #1208 */ - for (int fd = 3; fd < 256; fd++) { - close(fd); - } - - char *const argv[2] = {nx_slave_cmd, NULL}; - - if (execv(nx_slave_cmd, argv) == -1) - { - perror("execv"); - } - exit(1); - - } - else if (pid == -1) - { - // TODO Test this! - perror("fork"); - close(serverFd); - close(clientFd); - return -1; - } - - close(clientFd); - slavePidMap_[channelId] = pid; - - cerr << "Info" << ": slave channel ID#" << channelId << " handler has PID " << pid << endl; - - return 1; -} - -void Proxy::checkSlaves() -{ - for (int channelId = 0; channelId 1 && HandleChild(pid)) - { - slavePidMap_[channelId] = nothing; - cerr << "Info:" << " Handled death of slave with pid " << pid << endl; - } - } -} - -int Proxy::handlePostConnectionFromProxy(int channelId, int serverFd, - T_channel_type type, const char *label) -{ - // - // Turn queuing off for path proxy-to-server. - // - - SetNoDelay(serverFd, 1); - - assignChannelMap(channelId, serverFd); - - #ifdef TEST - *logofs << "Proxy: Descriptor FD#" << serverFd - << " mapped to channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - if (allocateTransport(serverFd, channelId) < 0) - { - return -1; - } - - switch (type) - { - case channel_cups: - { - channels_[channelId] = new CupsChannel(transports_[channelId], compressor_); - break; - } - case channel_smb: - { - channels_[channelId] = new SmbChannel(transports_[channelId], compressor_); - - break; - } - case channel_media: - { - channels_[channelId] = new MediaChannel(transports_[channelId], compressor_); - - break; - } - case channel_http: - { - channels_[channelId] = new HttpChannel(transports_[channelId], compressor_); - - break; - } - case channel_font: - { - channels_[channelId] = new FontChannel(transports_[channelId], compressor_); - - break; - } - default: - { - channels_[channelId] = new SlaveChannel(transports_[channelId], compressor_); - - break; - } - } - - if (channels_[channelId] == NULL) - { - deallocateTransport(channelId); - - return -1; - } - - increaseChannels(channelId); - - channels_[channelId] -> handleConfiguration(); - - return 1; -} diff --git a/nxcomp/Proxy.h b/nxcomp/Proxy.h deleted file mode 100644 index ea60c827a..000000000 --- a/nxcomp/Proxy.h +++ /dev/null @@ -1,1276 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Proxy_H -#define Proxy_H - -#include - -#ifdef _AIX -#include -#endif - -#include "Misc.h" -#include "Timestamp.h" - -#include "List.h" -#include "Channel.h" -#include "Transport.h" -#include "EncodeBuffer.h" -#include "ProxyReadBuffer.h" -#include "ChannelEndPoint.h" - -// -// Forward declaration as we -// need a pointer. -// - -class Agent; - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Log the important tracepoints related -// to writing packets to the peer proxy. -// - -#undef FLUSH - -// -// Codes used for control messages in -// proxy-to-proxy protocol. -// -// The following codes are currently -// unused. -// -// code_alert_reply, -// code_reset_request, -// code_reset_reply, -// code_load_reply, -// code_save_reply, -// code_shutdown_reply, -// code_configuration_request, -// code_configuration_reply. -// -// These are for compatibility with -// old versions. -// -// code_sync_request, -// code_sync_reply, -// -// The code_new_aux_connection should not -// be used anymore. Auxiliary X connections -// are treated as normal X channels since -// version 1.5.0. -// - -typedef enum -{ - code_new_x_connection, - code_new_cups_connection, - code_new_aux_connection, - code_new_smb_connection, - code_new_media_connection, - code_switch_connection, - code_drop_connection, - code_finish_connection, - code_begin_congestion, - code_end_congestion, - code_alert_request, - code_alert_reply, - code_reset_request, - code_reset_reply, - code_load_request, - code_load_reply, - code_save_request, - code_save_reply, - code_shutdown_request, - code_shutdown_reply, - code_control_token_request, - code_control_token_reply, - code_configuration_request, - code_configuration_reply, - code_statistics_request, - code_statistics_reply, - code_new_http_connection, - code_sync_request, - code_sync_reply, - code_new_font_connection, - code_new_slave_connection, - code_finish_listeners, - code_split_token_request, - code_split_token_reply, - code_data_token_request, - code_data_token_reply, - code_last_tag - -} T_proxy_code; - -typedef enum -{ - operation_in_negotiation, - operation_in_messages, - operation_in_configuration, - operation_in_statistics, - operation_last_tag - -} T_proxy_operation; - -typedef enum -{ - frame_ping, - frame_data, - -} T_frame_type; - -typedef enum -{ - token_control, - token_split, - token_data - -} T_token_type; - -typedef enum -{ - load_if_any, - load_if_first - -} T_load_type; - -class Proxy -{ - public: - - // - // Maximum number of supported channels. - // - - static const int CONNECTIONS_LIMIT = 256; - - // - // Numboer of token types. - // - - static const int TOKEN_TYPES = 3; - - // - // Lenght of buffer we use to add our - // control messages plus the length of - // the data frame. - // - - static const int CONTROL_CODES_LENGTH = ENCODE_BUFFER_PREFIX_SIZE - 5; - - static const int CONTROL_CODES_THRESHOLD = CONTROL_CODES_LENGTH - 9; - - Proxy(int fd); - - virtual ~Proxy(); - - // - // Inform the proxy that the negotiation phase is - // completed and that it can start handling binary - // messages. - // - - int setOperational(); - - int getOperational() - { - return (operation_ != operation_in_negotiation); - } - - int setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax); - - int setWriteDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax); - - // - // Perform the operation on the proxy - // link or its own channels. - // - - int handleRead(int &resultFds, fd_set &fdSet); - - int handleFlush(int &resultFds, fd_set &fdSet); - - int handleRead(); - - int handleRead(int fd, const char *data = NULL, int size = 0); - - int handleEvents(); - - int handleFlush(); - - int handleFlush(int fd); - - int handlePing(); - - int handleFinish(); - - int handleShutdown(); - - int handleStatistics(int type, ostream *statofs); - - int handleAlert(int alert); - - int handleRotate() - { - activeChannels_.rotate(); - - return 1; - } - - int handleChannelConfiguration(); - - int handleSocketConfiguration(); - - int handleLinkConfiguration(); - - int handleCacheConfiguration(); - - // - // These must be called just after initialization to - // tell to the proxy where the network connections - // have to be forwarded. - // - - virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, - sockaddr * xServerAddr, unsigned int xServerAddrLength) = 0; - - virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, - ChannelEndPoint &smbServerPort, - ChannelEndPoint &mediaServerPort, - ChannelEndPoint &httpServerPort, - const char *fontServerPort) = 0; - - // - // Create new tunneled channels. - // - - virtual int handleNewConnection(T_channel_type type, int clientFd) = 0; - - virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId) = 0; - - virtual int handleNewAgentConnection(Agent *agent) = 0; - - virtual int handleNewXConnection(int clientFd) = 0; - - virtual int handleNewXConnectionFromProxy(int channelId) = 0; - - int handleNewGenericConnection(int clientFd, T_channel_type type, const char *label); - - int handleNewGenericConnectionFromProxy(int channelId, T_channel_type type, - ChannelEndPoint &endpoint, const char *label); - - int handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type, - const char *path, const char *label); - - int handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type, - const char *hostname, long port, const char *label); - - int handleNewSlaveConnection(int clientFd); - - int handleNewSlaveConnectionFromProxy(int channelId); - - void checkSlaves(); - - // - // Force closure of channels. - // - - int handleCloseConnection(int clientFd); - - int handleCloseAllXConnections(); - - int handleCloseAllListeners(); - - // - // Called when the loop has replaced - // or closed a previous alert. - // - - void handleResetAlert(); - - // - // Handle the persistent cache. - // - - virtual int handleLoad(T_load_type type) = 0; - - virtual int handleSave() = 0; - - protected: - - // - // Timeout related data: - // - // flush - // split - // motion - // - // Timeouts in milliseconds after which the - // proxy will have to perform the operation. - // - // readTs, writeTs - // - // Timestamp of last packet received or sent - // to remote proxy. Used to detect lost con- - // nection. - // - // loopTs - // - // Timestamp of last loop completed by the - // proxy - // - // pingTs - // - // Timestamp of last ping request sent to the - // remote peer. - // - // alertTs - // - // Timestamp of last 'no data received' alert - // dialog shown to the user. - // - // loadTs - // - // Were message stores populated from data on - // disk. - // - // splitTs - // motionTs - // - // Timestamps of the last operation of this - // kind handled by the proxy. - // - - typedef struct - { - int split; - int motion; - - T_timestamp readTs; - T_timestamp writeTs; - - T_timestamp loopTs; - T_timestamp pingTs; - T_timestamp alertTs; - T_timestamp loadTs; - - T_timestamp splitTs; - T_timestamp motionTs; - - } T_proxy_timeouts; - - // - // Bytes accumulated so far while waiting - // to send the next token, number of tokens - // remaining for each token type and other - // token related information. - // - - typedef struct - { - int size; - int limit; - - int bytes; - int remaining; - - T_proxy_code request; - T_proxy_code reply; - - T_token_type type; - - } T_proxy_token; - - int handlePostConnectionFromProxy(int channelId, int serverFd, - T_channel_type type, const char *label); - - int handleDrain(); - - int handleFrame(T_frame_type type); - - int handleFinish(int channelId); - - int handleDrop(int channelId); - - int handleFinishFromProxy(int channelId); - - int handleDropFromProxy(int channelId); - - int handleStatisticsFromProxy(int type); - - int handleStatisticsFromProxy(const unsigned char *message, unsigned int length); - - int handleNegotiation(const unsigned char *message, unsigned int length); - - int handleNegotiationFromProxy(const unsigned char *message, unsigned int length); - - int handleToken(T_frame_type type); - - int handleTokenFromProxy(T_proxy_token &token, int count); - - int handleTokenReplyFromProxy(T_proxy_token &token, int count); - - int handleSyncFromProxy(int channelId); - - int handleSwitch(int channelId); - - int handleControl(T_proxy_code code, int data = -1); - - int handleControlFromProxy(const unsigned char *message); - - // - // Interleave reads of the X server - // events while writing data to the - // remote proxy. - // - - virtual int handleAsyncEvents() = 0; - - // - // Timer related functions. - // - - protected: - - void setTimer(int value) - { - SetTimer(value); - } - - void resetTimer() - { - ResetTimer(); - - timer_ = 0; - } - - public: - - void handleTimer() - { - timer_ = 1; - } - - int getTimer() - { - return timer_; - } - - // - // Can the channel consume data and the - // proxy produce more output? - // - - int canRead(int fd) const - { - return (isTimeToRead() == 1 && - isTimeToRead(getChannel(fd)) == 1); - } - - // - // Can the proxy read more data from its - // peer? - // - - int canRead() const - { - return (transport_ -> readable() != 0); - } - - int canFlush() const - { - return (encodeBuffer_.getLength() + - controlLength_ + transport_ -> length() + - transport_ -> flushable() > 0); - } - - int needFlush(int channelId) const - { - return (outputChannel_ == channelId && - encodeBuffer_.getLength() > 0); - } - - int needFlush() const - { - return (encodeBuffer_.getLength() > 0); - } - - int shouldFlush() const - { - if ((int) ((encodeBuffer_.getLength() + - controlLength_) / statistics -> - getStreamRatio()) >= control -> TokenSize) - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: FLUSH! Requesting a flush with " - << (encodeBuffer_.getLength() + controlLength_) - << " bytes and stream ratio " << (double) statistics -> - getStreamRatio() << ".\n" << logofs_flush; - #endif - - return 1; - } - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "Proxy: Not requesting a flush with " - << (encodeBuffer_.getLength() + controlLength_) - << " bytes and stream ratio " << (double) statistics -> - getStreamRatio() << ".\n" << logofs_flush; - #endif - - return 0; - } - - int needDrain() const - { - return (congestion_ == 1 || transport_ -> length() > - control -> TransportProxyBufferThreshold); - } - - int getFd() const - { - return fd_; - } - - int getFlushable(int fd) const - { - if (fd == fd_) - { - return (encodeBuffer_.getLength() + controlLength_ + - transport_ -> flushable()); - } - - return 0; - } - - int getSplitSize() - { - return (clientStore_ != NULL ? clientStore_ -> - getSplitTotalSize() : 0); - } - - int getSplitStorageSize() - { - return (clientStore_ != NULL ? clientStore_ -> - getSplitTotalStorageSize() : 0); - } - - // - // Returns the number of active channels - // that currently managed by this proxy. - // - - int getChannels(T_channel_type type = channel_none); - - // - // If descriptor corresponds to a valid - // channel, returns the type of traffic - // carried by it. - // - - T_channel_type getType(int fd); - - // - // Given a channel type, returns the - // literal name. - // - - const char *getTypeName(T_channel_type type); - - // - // Get a convenient name for 'localhost'. - // - - const char *getComputerName(); - - // - // Set if we have initiated the shutdown - // procedure and if the shutdown request - // has been received from the remote. - // - - int getFinish() const - { - return finish_; - } - - int getShutdown() const - { - return shutdown_; - } - - // - // Interfaces to the transport buffers. - // - - int getLength(int fd) const - { - if (fd == fd_) - { - return transport_ -> length(); - } - - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - return 0; - } - - return transports_[channelId] -> length(); - } - - int getPending(int fd) const - { - if (fd == fd_) - { - return transport_ -> pending(); - } - - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - return 0; - } - - return transports_[channelId] -> pending(); - } - - // - // Check if the proxy or the given channel - // has data in the buffer because of a - // blocking write. - // - - int getBlocked(int fd) const - { - if (fd == fd_) - { - return transport_ -> blocked(); - } - - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - return 0; - } - - return transports_[channelId] -> blocked(); - } - - // - // Check if the proxy or the given channel has - // data to read. - // - - int getReadable(int fd) const - { - if (fd == fd_) - { - return transport_ -> readable(); - } - - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - return 0; - } - - return transports_[channelId] -> readable(); - } - - // - // Return a vale between 0 and 9 in the case - // of the proxy descriptor. - // - - int getCongestion(int fd) const - { - if (fd == fd_) - { - return (agent_ != nothing && congestions_[agent_] == 1 ? 9 : - (int) statistics -> getCongestionInFrame()); - } - - int channelId = getChannel(fd); - - if (channelId < 0 || channels_[channelId] == NULL) - { - return 0; - } - - return channels_[channelId] -> getCongestion(); - } - - // - // Let the statistics class get info - // from the message stores. - // - - const ClientStore * const getClientStore() const - { - return clientStore_; - } - - const ServerStore * const getServerStore() const - { - return serverStore_; - } - - // - // These can be called asynchronously by - // channels during their read or write - // loop. - // - - int handleAsyncRead(int fd) - { - return handleRead(fd); - } - - int handleAsyncCongestion(int fd) - { - int channelId = getChannel(fd); - - return handleControl(code_begin_congestion, channelId); - } - - int handleAsyncDecongestion(int fd) - { - int channelId = getChannel(fd); - - return handleControl(code_end_congestion, channelId); - } - - int handleAsyncSplit(int fd, Split *split) - { - return channels_[getChannel(fd)] -> - handleSplitEvent(encodeBuffer_, split); - } - - int handleAsyncPriority() - { - if (control -> FlushPriority == 1) - { - return handleFlush(); - } - - return 0; - } - - int canAsyncFlush() const - { - return shouldFlush(); - } - - int handleAsyncFlush() - { - return handleFlush(); - } - - int handleAsyncSwitch(int fd) - { - return handleSwitch(getChannel(fd)); - } - - int handleAsyncKeeperCallback() - { - KeeperCallback(); - - return 1; - } - - // - // Internal interfaces used to verify the - // availability of channels and the proxy - // link. - // - - protected: - - int isTimeToRead() const - { - if (congestion_ == 0 && transport_ -> - blocked() == 0) - { - return 1; - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Can't read from channels " - << "with congestion " << congestion_ - << " and blocked " << transport_ -> - blocked() << ".\n" << logofs_flush; - #endif - - return 0; - } - } - - int isTimeToRead(int channelId) const - { - if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && - channels_[channelId] != NULL && - congestions_[channelId] == 0) - { - if (channels_[channelId] -> getType() == channel_x11 || - tokens_[token_data].remaining > 0 || - channels_[channelId] -> - getFinish() == 1) - { - return 1; - } - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: Can't read from generic " - << "descriptor FD#" << getFd(channelId) - << " channel ID#" << channelId << " with " - << tokens_[token_data].remaining - << " data tokens remaining.\n" - << logofs_flush; - #endif - - return 0; - } - - #if defined(TEST) || defined(INFO) - - if (channelId < 0 || channelId >= CONNECTIONS_LIMIT || - channels_[channelId] == NULL) - { - *logofs << "Proxy: WARNING! No valid channel for ID#" - << channelId << ".\n" << logofs_flush; - } - else if (channels_[channelId] -> getFinish()) - { - *logofs << "Proxy: Can't read from finishing " - << "descriptor FD#" << getFd(channelId) - << " channel ID#" << channelId << ".\n" - << logofs_flush; - } - else if (congestions_[channelId] == 1) - { - *logofs << "Proxy: Can't read from congested " - << "descriptor FD#" << getFd(channelId) - << " channel ID#" << channelId << ".\n" - << logofs_flush; - } - - #endif - - return 0; - } - - // - // Handle the flush and split timeouts. - // All these functions should round up - // to the value of the latency timeout - // to save a further loop. - // - - protected: - - int isTimeToSplit() const - { - if (isTimestamp(timeouts_.splitTs) && - getTimeToNextSplit() <= control -> - LatencyTimeout) - { - if (tokens_[token_split].remaining > 0) - { - return 1; - } - - #if defined(TEST) || defined(INFO) - *logofs << "Proxy: WARNING! Can't encode splits " - << "with " << tokens_[token_split].remaining - << " split tokens remaining.\n" - << logofs_flush; - #endif - } - - return 0; - } - - int isTimeToMotion() const - { - return (isTimestamp(timeouts_.motionTs) && - getTimeToNextMotion() <= control -> - LatencyTimeout); - } - - int getTimeToNextSplit() const - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - - if (isTimestamp(timeouts_.splitTs) == 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No split timeout was set " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No split timeout was set " - << "for proxy FD#" << fd_ << ".\n"; - - HandleCleanup(); - } - - #endif - - int diffTs = timeouts_.split - - diffTimestamp(timeouts_.splitTs, - getTimestamp()); - - return (diffTs > 0 ? diffTs : 0); - } - - int getTimeToNextMotion() const - { - #if defined(TEST) || defined(INFO) || defined(FLUSH) - - if (isTimestamp(timeouts_.motionTs) == 0) - { - #ifdef PANIC - *logofs << "Proxy: PANIC! No motion timeout was set " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No motion timeout was set " - << "for proxy FD#" << fd_ << ".\n"; - - HandleCleanup(); - } - - #endif - - int diffTs = timeouts_.motion - - diffTimestamp(timeouts_.motionTs, - getTimestamp()); - - return (diffTs > 0 ? diffTs : 0); - } - - protected: - - // - // Implement persistence of cache on disk. - // - - virtual int handleLoadFromProxy() = 0; - virtual int handleSaveFromProxy() = 0; - - int handleLoadStores(); - int handleSaveStores(); - - char *handleSaveAllStores(const char *savePath, bool & isTooSmall) const; - - virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient) const = 0; - - int handleSaveVersion(unsigned char *buffer, int &major, int &minor, int &patch) const; - - void handleFailOnSave(const char *fullName, const char *failContext) const; - - const char *handleLoadAllStores(const char *loadPath, const char *loadName) const; - - virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const = 0; - - int handleLoadVersion(const unsigned char *buffer, int &major, int &minor, int &patch) const; - - void handleFailOnLoad(const char *fullName, const char *failContext) const; - - // - // Prepare for a new persistent cache. - // - - int handleResetPersistentCache(); - - // - // Reset the stores in the case of a - // failure loading the cache. - // - - int handleResetStores(); - - // - // Reset the transport buffer and the - // other counters. - // - - void handleResetFlush(); - - // - // Utility functions used to map file - // descriptors to channel ids. - // - - protected: - - int allocateChannelMap(int fd); - int checkChannelMap(int channelId); - int assignChannelMap(int channelId, int fd); - - void cleanupChannelMap(int channelId); - - virtual int checkLocalChannelMap(int channelId) = 0; - - int addControlCodes(T_proxy_code code, int data); - int addTokenCodes(T_proxy_token &token); - - int getFd(int channelId) const - { - if (channelId >= 0 && channelId < CONNECTIONS_LIMIT) - { - return fdMap_[channelId]; - } - - return -1; - } - - int getChannel(int fd) const - { - if (fd >= 0 && fd < CONNECTIONS_LIMIT) - { - return channelMap_[fd]; - } - - return -1; - } - - protected: - - void setSplitTimeout(int channelId); - void setMotionTimeout(int channelId); - - void increaseChannels(int channelId); - void decreaseChannels(int channelId); - - int allocateTransport(int channelFd, int channelId); - int deallocateTransport(int channelId); - - // - // The proxy has its own transport. - // - - ProxyTransport *transport_; - - // - // The static compressor is shared among - // channels and all the message stores. - // - - StaticCompressor *compressor_; - - // - // Map NX specific opcodes. - // - - OpcodeStore *opcodeStore_; - - // - // Stores are shared between channels. - // - - ClientStore *clientStore_; - ServerStore *serverStore_; - - // - // Client and server caches are shared - // between channels. - // - - ClientCache *clientCache_; - ServerCache *serverCache_; - - // - // The proxy's file descriptor. - // - - int fd_; - - // - // Channels currently selected for I/O - // operations. - // - - int inputChannel_; - int outputChannel_; - - // - // List of active channels. - // - - List activeChannels_; - - // - // Used to read data sent from peer proxy. - // - - ProxyReadBuffer readBuffer_; - - // - // Used to send data to peer proxy. - // - - EncodeBuffer encodeBuffer_; - - // - // Control messages' array. - // - - int controlLength_; - - unsigned char controlCodes_[CONTROL_CODES_LENGTH]; - - // - // Table of channel classes taking - // care of open X connections. - // - - Channel *channels_[CONNECTIONS_LIMIT]; - - // - // Table of open sockets. - // - - Transport *transports_[CONNECTIONS_LIMIT]; - - // - // Timeout related data. - // - - T_proxy_timeouts timeouts_; - - // - // Proxy can be decoding messages, - // handling a link reconfiguration, - // or decoding statistics. - // - - int operation_; - - // - // True if we are currently draining - // the proxy link. - // - - int draining_; - - // - // Force flush because of prioritized - // control messages to send. - // - - int priority_; - - // - // Set if we have initiated the close - // down procedure. - // - - int finish_; - - // - // Remote peer requested the shutdown. - // - - int shutdown_; - - // - // We are in the middle of a network - // congestion in the path to remote - // proxy. - // - - int congestion_; - - // - // Channels at the remote end that - // are not consuming their data. - // - - int congestions_[CONNECTIONS_LIMIT]; - - // - // Is the timer expired? - // - - int timer_; - - // - // Did the proxy request an alert? - // - - int alert_; - - // - // The channel id of the agent. - // - - int agent_; - - // - // Token related data. - // - - T_proxy_token tokens_[TOKEN_TYPES]; - - // - // Pointer to stream descriptor where - // proxy is producing statistics. - // - - ostream *currentStatistics_; - - private: - - // - // Map channel ids to file descriptors. - // - - int channelMap_[CONNECTIONS_LIMIT]; - int fdMap_[CONNECTIONS_LIMIT]; - int slavePidMap_[CONNECTIONS_LIMIT]; -}; - -#endif /* Proxy_H */ diff --git a/nxcomp/ProxyReadBuffer.cpp b/nxcomp/ProxyReadBuffer.cpp deleted file mode 100644 index 0427bb76c..000000000 --- a/nxcomp/ProxyReadBuffer.cpp +++ /dev/null @@ -1,207 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ProxyReadBuffer.h" - -#include "Transport.h" - -// -// Set the verbosity level. You also -// need to define DUMP in Misc.cpp -// if DUMP is defined here. -// - -#define WARNING -#define PANIC -#undef TEST -#undef DEBUG -#undef DUMP - -unsigned int ProxyReadBuffer::suggestedLength(unsigned int pendingLength) -{ - // - // Always read all the data that - // is available. - // - - int readable = transport_ -> readable(); - - unsigned int readLength = (readable == -1 ? 0 : (unsigned int) readable); - - if (readLength < pendingLength) - { - readLength = pendingLength; - } - - // - // Even if the readable data is not - // enough to make a complete message, - // resize the buffer to accommodate - // it all. - // - - if (pendingLength < remaining_) - { - readLength = remaining_; - } - - return readLength; -} - -int ProxyReadBuffer::locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength) -{ - unsigned int lengthLength = 0; - const unsigned char *nextSrc = start; - unsigned char next; - - dataLength = 0; - - #ifdef TEST - *logofs << "ProxyReadBuffer: Locating message for FD#" - << transport_ -> fd() << " with " << end - start - << " bytes.\n" << logofs_flush; - #endif - - // - // Use something like the following if - // you are looking for errors. - // - - #ifdef DUMP - if (control -> ProxyMode == proxy_server && start < end && - transport_ -> fd() == 6 || transport_ -> fd() == 11) - { - *logofs << "ProxyReadBuffer: Partial checksums are:\n"; - - DumpBlockChecksums(start, end - start, 256); - - *logofs << logofs_flush; - } - #endif - - do - { - if (nextSrc >= end) - { - remaining_ = 1; - - #ifdef TEST - *logofs << "ProxyReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - next = *nextSrc++; - - dataLength <<= 7; - dataLength |= (unsigned int) (next & 0x7f); - - lengthLength++; - } - while (next & 0x80); - - unsigned int totalLength; - - if (dataLength == 0) - { - trailerLength = 0; - controlLength = 3; - totalLength = controlLength; - } - else - { - trailerLength = lengthLength; - controlLength = 0; - totalLength = dataLength + trailerLength; - } - - if (start + totalLength > end) - { - // - // When having to decompress a ZLIB stream, - // a single byte can be enough to complete - // the frame. - // - - if (control -> RemoteStreamCompression == 0) - { - remaining_ = totalLength - (end - start); - } - else - { - remaining_ = 1; - } - - #ifdef TEST - *logofs << "ProxyReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - else - { - #ifdef DUMP - *logofs << "ProxyReadBuffer: Received " << totalLength << " bytes of data " - << "with checksum "; - - DumpChecksum(start, totalLength); - - *logofs << " on proxy FD#" << transport_ -> fd() << ".\n" << logofs_flush; - #endif - - #if defined(TEST) || defined(INFO) - *logofs << "ProxyReadBuffer: Produced plain input for " << dataLength - << "+" << trailerLength << "+" << controlLength << " bytes out of " - << totalLength << " bytes.\n" << logofs_flush; - #endif - - #ifdef DUMP - *logofs << "ProxyReadBuffer: Partial checksums are:\n"; - - DumpBlockChecksums(start, totalLength, 256); - - *logofs << logofs_flush; - #endif - - remaining_ = 0; - - #ifdef TEST - *logofs << "ProxyReadBuffer: Located message with " - << "remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 1; - } -} diff --git a/nxcomp/ProxyReadBuffer.h b/nxcomp/ProxyReadBuffer.h deleted file mode 100644 index 68e9e95fa..000000000 --- a/nxcomp/ProxyReadBuffer.h +++ /dev/null @@ -1,57 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ProxyReadBuffer_H -#define ProxyReadBuffer_H - -#include "ReadBuffer.h" -#include "Control.h" - -class ProxyReadBuffer : public ReadBuffer -{ - public: - - ProxyReadBuffer(Transport *transport) - - : ReadBuffer(transport) - { - } - - virtual ~ProxyReadBuffer() - { - } - - protected: - - virtual unsigned int suggestedLength(unsigned int pendingLength); - - virtual int locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength); -}; - -#endif /* ProxyReadBuffer_H */ diff --git a/nxcomp/PutImage.cpp b/nxcomp/PutImage.cpp deleted file mode 100644 index 7b9a3ae5d..000000000 --- a/nxcomp/PutImage.cpp +++ /dev/null @@ -1,407 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PutImage.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -PutImageStore::PutImageStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = PUTIMAGE_ENABLE_CACHE; - enableData = PUTIMAGE_ENABLE_DATA; - - // Since ProtoStep7 (#issue 108) - enableCompress = PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = PUTIMAGE_DATA_LIMIT; - dataOffset = PUTIMAGE_DATA_OFFSET; - - cacheSlots = PUTIMAGE_CACHE_SLOTS; - cacheThreshold = PUTIMAGE_CACHE_THRESHOLD; - cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD; - - // Since ProtoStep8 (#issue 108) - enableSplit = PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -PutImageStore::~PutImageStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int PutImageStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian), 16, 8); - - encodeBuffer.encodeValue((unsigned int) buffer[1], 2); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> drawableCache); - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> gcCache); - - unsigned int width = GetUINT(buffer + 12, bigEndian); - encodeBuffer.encodeCachedValue(width, 16, - clientCache -> putImageWidthCache, 8); - - unsigned int height = GetUINT(buffer + 14, bigEndian); - encodeBuffer.encodeCachedValue(height, 16, - clientCache -> putImageHeightCache, 8); - - unsigned int x = GetUINT(buffer + 16, bigEndian); - int xDiff = x - clientCache -> putImageLastX; - clientCache -> putImageLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache -> putImageXCache, 8); - - unsigned int y = GetUINT(buffer + 18, bigEndian); - int yDiff = y - clientCache -> putImageLastY; - clientCache -> putImageLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache -> putImageYCache, 8); - - encodeBuffer.encodeCachedValue(buffer[20], 8, - clientCache -> putImageLeftPadCache); - - encodeBuffer.encodeCachedValue(buffer[21], 8, - clientCache -> depthCache); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int PutImageStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - unsigned int value; - unsigned char cValue; - - decodeBuffer.decodeValue(value, 16, 8); - - size = (value << 2); - - buffer = writeBuffer -> addMessage(size); - - decodeBuffer.decodeValue(value, 2); - buffer[1] = (unsigned char) value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - PutULONG(value, buffer + 8, bigEndian); - - unsigned int width; - decodeBuffer.decodeCachedValue(width, 16, - clientCache -> putImageWidthCache, 8); - PutUINT(width, buffer + 12, bigEndian); - - unsigned int height; - decodeBuffer.decodeCachedValue(height, 16, - clientCache -> putImageHeightCache, 8); - PutUINT(height, buffer + 14, bigEndian); - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageXCache, 8); - clientCache -> putImageLastX += value; - clientCache -> putImageLastX &= 0xffff; - PutUINT(clientCache -> putImageLastX, buffer + 16, bigEndian); - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageYCache, 8); - clientCache -> putImageLastY += value; - clientCache -> putImageLastY &= 0xffff; - PutUINT(clientCache -> putImageLastY, buffer + 18, bigEndian); - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> putImageLeftPadCache); - buffer[20] = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - buffer[21] = cValue; - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int PutImageStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PutImageMessage *putImage = (PutImageMessage *) message; - - // - // Here is the fingerprint. - // - - putImage -> format = *(buffer + 1); - putImage -> depth = *(buffer + 21); - putImage -> left_pad = *(buffer + 20); - - putImage -> width = GetUINT(buffer + 12, bigEndian); - putImage -> height = GetUINT(buffer + 14, bigEndian); - putImage -> pos_x = GetUINT(buffer + 16, bigEndian); - putImage -> pos_y = GetUINT(buffer + 18, bigEndian); - - putImage -> drawable = GetULONG(buffer + 4, bigEndian); - putImage -> gcontext = GetULONG(buffer + 8, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PutImageStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PutImageMessage *putImage = (PutImageMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = putImage -> format; - - PutULONG(putImage -> drawable, buffer + 4, bigEndian); - PutULONG(putImage -> gcontext, buffer + 8, bigEndian); - - PutUINT(putImage -> width, buffer + 12, bigEndian); - PutUINT(putImage -> height, buffer + 14, bigEndian); - PutUINT(putImage -> pos_x, buffer + 16, bigEndian); - PutUINT(putImage -> pos_y, buffer + 18, bigEndian); - - *(buffer + 20) = (unsigned char) putImage -> left_pad; - *(buffer + 21) = (unsigned char) putImage -> depth; - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PutImageStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PutImageMessage *putImage = (PutImageMessage *) message; - - *logofs << name() << ": Identity format " << (unsigned) putImage -> format - << ", depth " << (unsigned) putImage -> depth << ", left_pad " - << (unsigned) putImage -> left_pad << ", width " << putImage -> width - << ", height " << putImage -> height << ", pos_x " << putImage -> pos_x - << ", pos_y " << putImage -> pos_y << ", drawable " << putImage -> drawable - << ", gcontext " << putImage -> gcontext << ", size " << putImage -> size_ - << ".\n" << logofs_flush; - - #endif -} - -void PutImageStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Fields format, width, height, left_pad, depth. - // - - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 12, 4); - md5_append(md5_state_, buffer + 20, 2); -} - -void PutImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - PutImageMessage *putImage = (PutImageMessage *) message; - PutImageMessage *cachedPutImage = (PutImageMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putImage -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(putImage -> drawable, clientCache -> drawableCache); - - cachedPutImage -> drawable = putImage -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putImage -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(putImage -> gcontext, clientCache -> gcCache); - - cachedPutImage -> gcontext = putImage -> gcontext; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putImage -> pos_x - << " as " << "pos_x" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_x = putImage -> pos_x - cachedPutImage -> pos_x; - - encodeBuffer.encodeCachedValue(diff_x, 16, - clientCache -> putImageXCache, 8); - - cachedPutImage -> pos_x = putImage -> pos_x; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putImage -> pos_y - << " as " << "pos_y" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_y = putImage -> pos_y - cachedPutImage -> pos_y; - - encodeBuffer.encodeCachedValue(diff_y, 16, - clientCache -> putImageYCache, 8); - - cachedPutImage -> pos_y = putImage -> pos_y; -} - -void PutImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - // - // Decode the variant part. - // - - PutImageMessage *putImage = (PutImageMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - putImage -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putImage -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - putImage -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putImage -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageXCache, 8); - - putImage -> pos_x += value; - putImage -> pos_x &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putImage -> pos_x - << " as pos_x field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageYCache, 8); - - putImage -> pos_y += value; - putImage -> pos_y &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putImage -> pos_y - << " as pos_y field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/PutImage.h b/nxcomp/PutImage.h deleted file mode 100644 index 93dde9dfb..000000000 --- a/nxcomp/PutImage.h +++ /dev/null @@ -1,172 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PutImage_H -#define PutImage_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define PUTIMAGE_ENABLE_CACHE 1 -#define PUTIMAGE_ENABLE_DATA 1 - -#define PUTIMAGE_DATA_LIMIT 262144 - 24 -#define PUTIMAGE_DATA_OFFSET 24 - -#define PUTIMAGE_CACHE_SLOTS 6000 -#define PUTIMAGE_CACHE_THRESHOLD 70 -#define PUTIMAGE_CACHE_LOWER_THRESHOLD 50 - -#define PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -#define PUTIMAGE_CACHE_THRESHOLD_IF_PACKED 10 -#define PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED 5 - -#define PUTIMAGE_CACHE_THRESHOLD_IF_SHADOW 97 -#define PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_SHADOW 90 - -#define PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8 0 - -// -// The message class. -// - -class PutImageMessage : public Message -{ - friend class PutImageStore; - - public: - - PutImageMessage() - { - } - - ~PutImageMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char format; - unsigned char depth; - unsigned char left_pad; - unsigned short width; - unsigned short height; - unsigned int drawable; - unsigned int gcontext; - unsigned short pos_x; - unsigned short pos_y; -}; - -class PutImageStore : public MessageStore -{ - public: - - PutImageStore(StaticCompressor *compressor); - - virtual ~PutImageStore(); - - virtual const char *name() const - { - return "PutImage"; - } - - virtual unsigned char opcode() const - { - return X_PutImage; - } - - virtual unsigned int storage() const - { - return sizeof(PutImageMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new PutImageMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PutImageMessage((const PutImageMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PutImageMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PutImage_H */ diff --git a/nxcomp/PutPackedImage.cpp b/nxcomp/PutPackedImage.cpp deleted file mode 100644 index 66506ebbe..000000000 --- a/nxcomp/PutPackedImage.cpp +++ /dev/null @@ -1,600 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "PutPackedImage.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -PutPackedImageStore::PutPackedImageStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = PUTPACKEDIMAGE_ENABLE_CACHE; - enableData = PUTPACKEDIMAGE_ENABLE_DATA; - enableCompress = PUTPACKEDIMAGE_ENABLE_COMPRESS; - - dataLimit = PUTPACKEDIMAGE_DATA_LIMIT; - dataOffset = PUTPACKEDIMAGE_DATA_OFFSET; - - cacheSlots = PUTPACKEDIMAGE_CACHE_SLOTS; - cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD; - cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD; - - // Since ProtoStep8 (#issue 108) - enableSplit = PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -PutPackedImageStore::~PutPackedImageStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int PutPackedImageStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - // Client. - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> resourceCache); - - // Size. - encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian), 16, 10); - - // Drawable. - encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> drawableCache); - // GC. - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> gcCache); - // Method. - encodeBuffer.encodeCachedValue(*(buffer + 12), 8, - clientCache -> methodCache); - // Format. - encodeBuffer.encodeValue(*(buffer + 13), 2); - - // SrcDepth. - encodeBuffer.encodeCachedValue(*(buffer + 14), 8, - clientCache -> depthCache); - // DstDepth. - encodeBuffer.encodeCachedValue(*(buffer + 15), 8, - clientCache -> depthCache); - // SrcLength. - encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 24, - clientCache -> putPackedImageSrcLengthCache); - // DstLength. - encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 24, - clientCache -> putPackedImageDstLengthCache); - // SrcX. - unsigned int x = GetUINT(buffer + 24, bigEndian); - int xDiff = x - clientCache -> putImageLastX; - clientCache -> putImageLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache -> putImageXCache, 8); - // SrcY. - unsigned int y = GetUINT(buffer + 26, bigEndian); - int yDiff = y - clientCache -> putImageLastY; - clientCache -> putImageLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache -> putImageYCache, 8); - // SrcWidth. - encodeBuffer.encodeCachedValue(GetUINT(buffer + 28, bigEndian), 16, - clientCache -> putImageWidthCache, 8); - // SrcHeight. - encodeBuffer.encodeCachedValue(GetUINT(buffer + 30, bigEndian), 16, - clientCache -> putImageHeightCache, 8); - // DstX. - x = GetUINT(buffer + 32, bigEndian); - xDiff = x - clientCache -> putImageLastX; - clientCache -> putImageLastX = x; - encodeBuffer.encodeCachedValue(xDiff, 16, - clientCache -> putImageXCache, 8); - // DstY. - y = GetUINT(buffer + 34, bigEndian); - yDiff = y - clientCache -> putImageLastY; - clientCache -> putImageLastY = y; - encodeBuffer.encodeCachedValue(yDiff, 16, - clientCache -> putImageYCache, 8); - // DstWidth. - encodeBuffer.encodeCachedValue(GetUINT(buffer + 36, bigEndian), 16, - clientCache -> putImageWidthCache, 8); - // DstHeight. - encodeBuffer.encodeCachedValue(GetUINT(buffer + 38, bigEndian), 16, - clientCache -> putImageHeightCache, 8); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int PutPackedImageStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - unsigned int value; - unsigned char cValue; - - // Client. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> resourceCache); - - // Size. - decodeBuffer.decodeValue(size, 16, 10); - - size <<= 2; - - buffer = writeBuffer -> addMessage(size); - - *(buffer + 1) = cValue; - - // Drawable. - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - PutULONG(value, buffer + 4, bigEndian); - - // GC. - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - PutULONG(value, buffer + 8, bigEndian); - - // Method. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> methodCache); - *(buffer + 12) = cValue; - - // Format. - decodeBuffer.decodeValue(value, 2); - *(buffer + 13) = value; - - // SrcDepth. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 14) = cValue; - - // DstDepth. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 15) = cValue; - - // SrcLength. - decodeBuffer.decodeCachedValue(value, 24, - clientCache -> putPackedImageSrcLengthCache); - PutULONG(value, buffer + 16, bigEndian); - - // DstLength. - decodeBuffer.decodeCachedValue(value, 24, - clientCache -> putPackedImageDstLengthCache); - PutULONG(value, buffer + 20, bigEndian); - - // SrcX. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageXCache, 8); - clientCache -> putImageLastX += value; - clientCache -> putImageLastX &= 0xffff; - PutUINT(clientCache -> putImageLastX, buffer + 24, bigEndian); - - // SrcY. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageYCache, 8); - clientCache -> putImageLastY += value; - clientCache -> putImageLastY &= 0xffff; - PutUINT(clientCache -> putImageLastY, buffer + 26, bigEndian); - - // SrcWidth. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageWidthCache, 8); - PutUINT(value, buffer + 28, bigEndian); - - // SrcHeight. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageHeightCache, 8); - PutUINT(value, buffer + 30, bigEndian); - - // DstX. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageXCache, 8); - clientCache -> putImageLastX += value; - clientCache -> putImageLastX &= 0xffff; - PutUINT(clientCache -> putImageLastX, buffer + 32, bigEndian); - - // DstY. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageYCache, 8); - clientCache -> putImageLastY += value; - clientCache -> putImageLastY &= 0xffff; - PutUINT(clientCache -> putImageLastY, buffer + 34, bigEndian); - - // DstWidth. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageWidthCache, 8); - PutUINT(value, buffer + 36, bigEndian); - - // DstHeight. - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageHeightCache, 8); - PutUINT(value, buffer + 38, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int PutPackedImageStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; - - // - // Here is the fingerprint. - // - - putPackedImage -> client = *(buffer + 1); - - putPackedImage -> drawable = GetULONG(buffer + 4, bigEndian); - putPackedImage -> gcontext = GetULONG(buffer + 8, bigEndian); - - putPackedImage -> method = *(buffer + 12); - - putPackedImage -> format = *(buffer + 13); - putPackedImage -> src_depth = *(buffer + 14); - putPackedImage -> dst_depth = *(buffer + 15); - - putPackedImage -> src_length = GetULONG(buffer + 16, bigEndian); - putPackedImage -> dst_length = GetULONG(buffer + 20, bigEndian); - - putPackedImage -> src_x = GetUINT(buffer + 24, bigEndian); - putPackedImage -> src_y = GetUINT(buffer + 26, bigEndian); - putPackedImage -> src_width = GetUINT(buffer + 28, bigEndian); - putPackedImage -> src_height = GetUINT(buffer + 30, bigEndian); - - putPackedImage -> dst_x = GetUINT(buffer + 32, bigEndian); - putPackedImage -> dst_y = GetUINT(buffer + 34, bigEndian); - putPackedImage -> dst_width = GetUINT(buffer + 36, bigEndian); - putPackedImage -> dst_height = GetUINT(buffer + 38, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int PutPackedImageStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = putPackedImage -> client; - - PutULONG(putPackedImage -> drawable, buffer + 4, bigEndian); - PutULONG(putPackedImage -> gcontext, buffer + 8, bigEndian); - - *(buffer + 12) = putPackedImage -> method; - - *(buffer + 13) = putPackedImage -> format; - *(buffer + 14) = putPackedImage -> src_depth; - *(buffer + 15) = putPackedImage -> dst_depth; - - PutULONG(putPackedImage -> src_length, buffer + 16, bigEndian); - PutULONG(putPackedImage -> dst_length, buffer + 20, bigEndian); - - PutUINT(putPackedImage -> src_x, buffer + 24, bigEndian); - PutUINT(putPackedImage -> src_y, buffer + 26, bigEndian); - PutUINT(putPackedImage -> src_width, buffer + 28, bigEndian); - PutUINT(putPackedImage -> src_height, buffer + 30, bigEndian); - - PutUINT(putPackedImage -> dst_x, buffer + 32, bigEndian); - PutUINT(putPackedImage -> dst_y, buffer + 34, bigEndian); - PutUINT(putPackedImage -> dst_width, buffer + 36, bigEndian); - PutUINT(putPackedImage -> dst_height, buffer + 38, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void PutPackedImageStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; - - *logofs << name() << ": Identity format " - - << "drawable " << putPackedImage -> drawable << ", " - << "gcontext " << putPackedImage -> gcontext << ", " - - << "format " << (unsigned int) putPackedImage -> format << ", " - << "method " << (unsigned int) putPackedImage -> method << ", " - - << "src_depth " << (unsigned int) putPackedImage -> src_depth << ", " - << "dst_depth " << (unsigned int) putPackedImage -> dst_depth << ", " - - << "src_length " << putPackedImage -> src_length << ", " - << "dst_length " << putPackedImage -> dst_length << ", " - - << "src_x " << putPackedImage -> src_x << ", " - << "src_y " << putPackedImage -> src_y << ", " - << "src_width " << putPackedImage -> src_width << ", " - << "src_height " << putPackedImage -> src_height << ", " - - << "dst_x " << putPackedImage -> dst_x << ", " - << "dst_y " << putPackedImage -> dst_y << ", " - << "dst_width " << putPackedImage -> dst_width << ", " - << "dst_height " << putPackedImage -> dst_height << ", " - - << "size " << putPackedImage -> size_ << ".\n" - << logofs_flush; - - #endif -} - -void PutPackedImageStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Fields method, format, src_depth, dst_depth, - // src_length, dst_length, src_x, src_y, src_width, - // src_height. - // - // - // TODO: We should better investigate the effect of - // having fields src_x and src_y in identity instead - // of keeping them in differences. - // - - md5_append(md5_state_, buffer + 12, 20); -} - -void PutPackedImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; - PutPackedImageMessage *cachedPutPackedImage = (PutPackedImageMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " - << (unsigned int) putPackedImage -> client - << " as client field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(putPackedImage -> client, 8, - clientCache -> resourceCache); - - cachedPutPackedImage -> client = putPackedImage -> client; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putPackedImage -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(putPackedImage -> drawable, clientCache -> drawableCache); - - cachedPutPackedImage -> drawable = putPackedImage -> drawable; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putPackedImage -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(putPackedImage -> gcontext, clientCache -> gcCache); - - cachedPutPackedImage -> gcontext = putPackedImage -> gcontext; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putPackedImage -> dst_x - << " as " << "dst_x" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_x = putPackedImage -> dst_x - cachedPutPackedImage -> dst_x; - - encodeBuffer.encodeCachedValue(diff_x, 16, - clientCache -> putImageXCache, 8); - - cachedPutPackedImage -> dst_x = putPackedImage -> dst_x; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putPackedImage -> dst_y - << " as " << "dst_y" << " field.\n" << logofs_flush; - #endif - - unsigned short int diff_y = putPackedImage -> dst_y - cachedPutPackedImage -> dst_y; - - encodeBuffer.encodeCachedValue(diff_y, 16, - clientCache -> putImageYCache, 8); - - cachedPutPackedImage -> dst_y = putPackedImage -> dst_y; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putPackedImage -> dst_width - << " as " << "dst_width" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(putPackedImage -> dst_width, 16, - clientCache -> putImageWidthCache, 8); - - cachedPutPackedImage -> dst_width = putPackedImage -> dst_width; - - #ifdef TEST - *logofs << name() << ": Encoding value " << putPackedImage -> dst_height - << " as " << "dst_height" << " field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(putPackedImage -> dst_height, 16, - clientCache -> putImageHeightCache, 8); - - cachedPutPackedImage -> dst_height = putPackedImage -> dst_height; -} - -void PutPackedImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - // - // Decode the variant part. - // - - PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeCachedValue(putPackedImage -> client, 8, - clientCache -> resourceCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " - << (unsigned int) putPackedImage -> client - << " as client field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); - - putPackedImage -> drawable = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putPackedImage -> drawable - << " as drawable field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - putPackedImage -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putPackedImage -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageXCache, 8); - - putPackedImage -> dst_x += value; - putPackedImage -> dst_x &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putPackedImage -> dst_x - << " as dst_x field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageYCache, 8); - - putPackedImage -> dst_y += value; - putPackedImage -> dst_y &= 0xffff; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putPackedImage -> dst_y - << " as dst_y field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageWidthCache, 8); - - putPackedImage -> dst_width = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putPackedImage -> dst_width - << " as dst_width field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> putImageHeightCache, 8); - - putPackedImage -> dst_height = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << putPackedImage -> dst_height - << " as dst_height field.\n" << logofs_flush; - #endif -} - diff --git a/nxcomp/PutPackedImage.h b/nxcomp/PutPackedImage.h deleted file mode 100644 index d28ad39eb..000000000 --- a/nxcomp/PutPackedImage.h +++ /dev/null @@ -1,218 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef PutPackedImage_H -#define PutPackedImage_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define PUTPACKEDIMAGE_ENABLE_CACHE 1 -#define PUTPACKEDIMAGE_ENABLE_DATA 1 -#define PUTPACKEDIMAGE_ENABLE_COMPRESS 0 - -// -// We can't exceed lenght of 262144 bytes. -// - -#define PUTPACKEDIMAGE_DATA_LIMIT 262144 - 40 -#define PUTPACKEDIMAGE_DATA_OFFSET 40 - -#define PUTPACKEDIMAGE_CACHE_SLOTS 6000 -#define PUTPACKEDIMAGE_CACHE_THRESHOLD 70 -#define PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD 50 - -#define PUTPACKEDIMAGE_CACHE_THRESHOLD_IF_PACKED_SHADOW 97 -#define PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED_SHADOW 90 - -#define PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8 0 - -// -// The message class. -// - -class PutPackedImageMessage : public Message -{ - friend class PutPackedImageStore; - - public: - - PutPackedImageMessage() - { - } - - ~PutPackedImageMessage() - { - } - - // - // Here are the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char client; - - unsigned int drawable; - unsigned int gcontext; - - unsigned char format; - unsigned char method; - - unsigned char src_depth; - unsigned char dst_depth; - - unsigned int src_length; - unsigned int dst_length; - - short int src_x; - short int src_y; - unsigned short src_width; - unsigned short src_height; - - short int dst_x; - short int dst_y; - unsigned short dst_width; - unsigned short dst_height; -}; - -class PutPackedImageStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - PutPackedImageStore(StaticCompressor *compressor); - - virtual ~PutPackedImageStore(); - - virtual const char *name() const - { - return "PutPackedImage"; - } - - virtual unsigned char opcode() const - { - return X_NXPutPackedImage; - } - - virtual unsigned int storage() const - { - return sizeof(PutPackedImageMessage); - } - - // - // Very special of this class. - // - - int getPackedSize(const int position) const - { - PutPackedImageMessage *message = (PutPackedImageMessage *) (*messages_)[position]; - - if (message == NULL) - { - return 0; - } - - return dataOffset + message -> src_length; - } - - int getUnpackedSize(const int position) const - { - PutPackedImageMessage *message = (PutPackedImageMessage *) (*messages_)[position]; - - if (message == NULL) - { - return 0; - } - - return dataOffset + message -> dst_length; - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new PutPackedImageMessage(); - } - - virtual Message *create(const Message &message) const - { - return new PutPackedImageMessage((const PutPackedImageMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (PutPackedImageMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* PutPackedImage_H */ diff --git a/nxcomp/QueryFontReply.cpp b/nxcomp/QueryFontReply.cpp deleted file mode 100644 index ffd5eaee9..000000000 --- a/nxcomp/QueryFontReply.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "QueryFontReply.h" - -#include "ServerCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -QueryFontReplyStore::QueryFontReplyStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = QUERYFONTREPLY_ENABLE_CACHE; - enableData = QUERYFONTREPLY_ENABLE_DATA; - enableSplit = QUERYFONTREPLY_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = QUERYFONTREPLY_DATA_LIMIT; - dataOffset = QUERYFONTREPLY_DATA_OFFSET; - - cacheSlots = QUERYFONTREPLY_CACHE_SLOTS; - cacheThreshold = QUERYFONTREPLY_CACHE_THRESHOLD; - cacheLowerThreshold = QUERYFONTREPLY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -QueryFontReplyStore::~QueryFontReplyStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int QueryFontReplyStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Clear the padding bytes. - // - - unsigned char *pad = (unsigned char *) buffer; - - if (size >= 24) - { - PutULONG(0, pad + 20, bigEndian); - } - - if (size >= 40) - { - PutULONG(0, pad + 36, bigEndian); - } - - // - // TODO: This doesn't work. Probably these - // padding bytes are not padding anymore. - // This is to be investigated. - // - // pad += 60; - // - // while (pad + 16 <= (buffer + size)) - // { - // PutULONG(0, pad + 12, bigEndian); - // - // pad += 16; - // } - // - - #ifdef DEBUG - *logofs << name() << ": Cleaned padding bytes of " - << "message at " << message << ".\n" - << logofs_flush; - #endif - - return 1; -} - -int QueryFontReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - return 1; -} - -void QueryFontReplyStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - QueryFontReplyMessage *queryFontReply = (QueryFontReplyMessage *) message; - - *logofs << name() << ": Identity size " << queryFontReply -> size_ << ".\n"; - - #endif -} - -void QueryFontReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} diff --git a/nxcomp/QueryFontReply.h b/nxcomp/QueryFontReply.h deleted file mode 100644 index e12fe4e4b..000000000 --- a/nxcomp/QueryFontReply.h +++ /dev/null @@ -1,136 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef QueryFontReply_H -#define QueryFontReply_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// -#define QUERYFONTREPLY_ENABLE_CACHE 1 -#define QUERYFONTREPLY_ENABLE_DATA 1 -#define QUERYFONTREPLY_ENABLE_SPLIT 0 - -#define QUERYFONTREPLY_DATA_LIMIT 1048576 - 32 -#define QUERYFONTREPLY_DATA_OFFSET 8 - -#define QUERYFONTREPLY_CACHE_SLOTS 200 -#define QUERYFONTREPLY_CACHE_THRESHOLD 20 -#define QUERYFONTREPLY_CACHE_LOWER_THRESHOLD 5 - -#define QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class QueryFontReplyMessage : public Message -{ - friend class QueryFontReplyStore; - - public: - - QueryFontReplyMessage() - { - } - - ~QueryFontReplyMessage() - { - } -}; - -class QueryFontReplyStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - QueryFontReplyStore(StaticCompressor *compressor); - - virtual ~QueryFontReplyStore(); - - virtual const char *name() const - { - return "QueryFontReply"; - } - - virtual unsigned char opcode() const - { - return X_QueryFont; - } - - virtual unsigned int storage() const - { - return sizeof(QueryFontReplyMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new QueryFontReplyMessage(); - } - - virtual Message *create(const Message &message) const - { - return new QueryFontReplyMessage((const QueryFontReplyMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (QueryFontReplyMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* QueryFontReply_H */ diff --git a/nxcomp/ReadBuffer.cpp b/nxcomp/ReadBuffer.cpp deleted file mode 100644 index 1e2326cee..000000000 --- a/nxcomp/ReadBuffer.cpp +++ /dev/null @@ -1,635 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ReadBuffer.h" - -#include "Transport.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -ReadBuffer::ReadBuffer(Transport *transport) - - : transport_(transport) -{ - // - // The read buffer will grow until - // reaching the maximum buffer size - // and then will remain stable at - // that size. - // - - initialReadSize_ = READ_BUFFER_DEFAULT_SIZE; - maximumBufferSize_ = READ_BUFFER_DEFAULT_SIZE; - - size_ = 0; - buffer_ = NULL; - - owner_ = 1; - length_ = 0; - start_ = 0; - - remaining_ = 0; -} - -ReadBuffer::~ReadBuffer() -{ - if (owner_ == 1) - { - delete [] buffer_; - } -} - -void ReadBuffer::readMessage(const unsigned char *message, unsigned int length) -{ - // - // To be here we must be the real owner - // of the buffer and there must not be - // pending bytes in the transport. - // - - #ifdef TEST - - if (owner_ == 0) - { - *logofs << "ReadBuffer: PANIC! Class for FD#" - << transport_ -> fd() << " doesn't " - << "appear to be the owner of the buffer " - << "while borrowing from the caller.\n" - << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Be sure that any outstanding data from - // the transport is appended to our own - // byffer. - // - - if (transport_ -> pending() != 0) - { - #ifdef WARNING - *logofs << "ReadBuffer: WARNING! Class for FD#" - << transport_ -> fd() << " has pending " - << "data in the transport while " - << "borrowing from the caller.\n" - << logofs_flush; - #endif - - readMessage(); - - if (owner_ == 0) - { - convertBuffer(); - } - } - - // - // Can't borrow the buffer if there is data - // from a partial message. In this case add - // the new data to the end of our buffer. - // - - if (length_ == 0) - { - #ifdef TEST - *logofs << "ReadBuffer: Borrowing " << length - << " bytes from the caller for FD#" - << transport_ -> fd() << " with " - << length_ << " bytes in the buffer.\n" - << logofs_flush; - #endif - - delete [] buffer_; - - buffer_ = (unsigned char *) message; - size_ = length; - - length_ = length; - - owner_ = 0; - start_ = 0; - } - else - { - #ifdef TEST - *logofs << "ReadBuffer: Appending " << length - << " bytes from the caller for FD#" - << transport_ -> fd() << " with " - << length_ << " bytes in the buffer.\n" - << logofs_flush; - #endif - - appendBuffer(message, length); - } -} - -int ReadBuffer::readMessage() -{ - int pendingLength = transport_ -> pending(); - - if (pendingLength > 0) - { - // - // Can't move the data in the borrowed buffer, - // so use the tansport buffer only if we don't - // have any partial message. This can happen - // with the proxy where we need to deflate the - // stream. - // - - if (length_ == 0) - { - unsigned char *newBuffer; - - length_ = transport_ -> getPending(newBuffer); - - if (newBuffer == NULL) - { - #ifdef PANIC - *logofs << "ReadBuffer: PANIC! Failed to borrow " - << length_ << " bytes of memory for buffer " - << "in context [A].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to borrow memory for " - << "read buffer in context [A].\n"; - - HandleCleanup(); - } - - delete [] buffer_; - - buffer_ = newBuffer; - size_ = length_; - - owner_ = 0; - start_ = 0; - - #ifdef TEST - *logofs << "ReadBuffer: Borrowed " << length_ - << " pending bytes for FD#" << transport_ -> - fd() << ".\n" << logofs_flush; - #endif - - return length_; - } - #ifdef TEST - else - { - *logofs << "ReadBuffer: WARNING! Cannot borrow " - << pendingLength << " bytes for FD#" - << transport_ -> fd() << " with " - << length_ << " bytes in the buffer.\n" - << logofs_flush; - } - #endif - } - - unsigned int readLength = suggestedLength(pendingLength); - - #ifdef DEBUG - *logofs << "ReadBuffer: Requested " << readLength - << " bytes for FD#" << transport_ -> fd() - << " with readable " << transport_ -> readable() - << " remaining " << remaining_ << " pending " - << transport_ -> pending() << ".\n" - << logofs_flush; - #endif - - if (readLength < initialReadSize_) - { - readLength = initialReadSize_; - } - - #ifdef DEBUG - *logofs << "ReadBuffer: Buffer size is " << size_ - << " length " << length_ << " and start " - << start_ << ".\n" << logofs_flush; - #endif - - // - // We can't use the transport buffer - // to read our own data in it. - // - - #ifdef TEST - - if (owner_ == 0) - { - *logofs << "ReadBuffer: PANIC! Class for FD#" - << transport_ -> fd() << " doesn't " - << "appear to be the owner of the buffer " - << "while reading.\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Be sure that we have enough space - // to store all the requested data. - // - - if (buffer_ == NULL || length_ + readLength > size_) - { - unsigned int newSize = length_ + readLength; - - #ifdef TEST - *logofs << "ReadBuffer: Resizing buffer for FD#" - << transport_ -> fd() << " in read from " - << size_ << " to " << newSize << " bytes.\n" - << logofs_flush; - #endif - - unsigned char *newBuffer = allocateBuffer(newSize); - - memcpy(newBuffer, buffer_ + start_, length_); - - delete [] buffer_; - - buffer_ = newBuffer; - size_ = newSize; - - transport_ -> pendingReset(); - - owner_ = 1; - } - else if (start_ != 0 && length_ != 0) - { - // - // If any bytes are left due to a partial - // message, shift them to the beginning - // of the buffer. - // - - #ifdef TEST - *logofs << "ReadBuffer: Moving " << length_ - << " bytes of data " << "at beginning of " - << "the buffer for FD#" << transport_ -> fd() - << ".\n" << logofs_flush; - #endif - - memmove(buffer_, buffer_ + start_, length_); - } - - start_ = 0; - - #ifdef DEBUG - *logofs << "ReadBuffer: Buffer size is now " << size_ - << " length is " << length_ << " and start is " - << start_ << ".\n" << logofs_flush; - #endif - - unsigned char *readData = buffer_ + length_; - - #ifdef DEBUG - *logofs << "ReadBuffer: Going to read " << readLength - << " bytes from FD#" << transport_ -> fd() << ".\n" - << logofs_flush; - #endif - - int bytesRead = transport_ -> read(readData, readLength); - - if (bytesRead > 0) - { - #ifdef TEST - *logofs << "ReadBuffer: Read " << bytesRead - << " bytes from FD#" << transport_ -> fd() - << ".\n" << logofs_flush; - #endif - - length_ += bytesRead; - } - else if (bytesRead < 0) - { - // - // Check if there is more data pending than the - // size of the provided buffer. After reading - // the requested amount, in fact, the transport - // may have decompressed the data and produced - // more input. This trick allows us to always - // borrow the buffer from the transport, even - // when the partial read would have prevented - // that. - // - - if (transport_ -> pending() > 0) - { - #ifdef TEST - *logofs << "ReadBuffer: WARNING! Trying to read some " - << "more with " << transport_ -> pending() - << " bytes pending for FD#" << transport_ -> - fd() << ".\n" << logofs_flush; - #endif - - return readMessage(); - } - - #ifdef TEST - *logofs << "ReadBuffer: Error detected reading " - << "from FD#" << transport_ -> fd() - << ".\n" << logofs_flush; - #endif - - return -1; - } - #ifdef TEST - else - { - *logofs << "ReadBuffer: No data read from FD#" - << transport_ -> fd() << " with remaining " - << remaining_ << ".\n" << logofs_flush; - } - #endif - - return bytesRead; -} - -const unsigned char *ReadBuffer::getMessage(unsigned int &controlLength, - unsigned int &dataLength) -{ - #ifdef TEST - - if (transport_ -> pending() > 0) - { - *logofs << "ReadBuffer: PANIC! The transport " - << "appears to have data pending.\n" - << logofs_flush; - - HandleCleanup(); - } - - #endif - - if (length_ == 0) - { - #ifdef DEBUG - *logofs << "ReadBuffer: No message can be located " - << "for FD#" << transport_ -> fd() << ".\n" - << logofs_flush; - #endif - - if (owner_ == 0) - { - buffer_ = NULL; - size_ = 0; - - transport_ -> pendingReset(); - - owner_ = 1; - start_ = 0; - } - - return NULL; - } - - unsigned int trailerLength; - - #ifdef DEBUG - *logofs << "ReadBuffer: Going to locate message with " - << "start at " << start_ << " and length " - << length_ << " for FD#" << transport_ -> fd() - << ".\n" << logofs_flush; - #endif - - int located = locateMessage(buffer_ + start_, buffer_ + start_ + length_, - controlLength, dataLength, trailerLength); - - if (located == 0) - { - // - // No more complete messages are in - // the buffer. - // - - #ifdef DEBUG - *logofs << "ReadBuffer: No message was located " - << "for FD#" << transport_ -> fd() - << ".\n" << logofs_flush; - #endif - - if (owner_ == 0) - { - // - // Must move the remaining bytes in - // our own buffer. - // - - convertBuffer(); - } - - return NULL; - } - else - { - const unsigned char *result = buffer_ + start_; - - if (dataLength > 0) - { - // - // Message contains data, so go to the - // first byte of payload. - // - - result += trailerLength; - - start_ += (dataLength + trailerLength); - length_ -= (dataLength + trailerLength); - } - else - { - // - // It is a control message. - // - - start_ += (controlLength + trailerLength); - length_ -= (controlLength + trailerLength); - } - - #ifdef DEBUG - *logofs << "ReadBuffer: Located message for FD#" - << transport_ -> fd() << " with control length " - << controlLength << " and data length " - << dataLength << ".\n" << logofs_flush; - #endif - - remaining_ = 0; - - return result; - } -} - -int ReadBuffer::setSize(int initialReadSize, int maximumBufferSize) -{ - initialReadSize_ = initialReadSize; - maximumBufferSize_ = maximumBufferSize; - - #ifdef TEST - *logofs << "ReadBuffer: WARNING! Set buffer parameters to " - << initialReadSize_ << "/" << maximumBufferSize_ - << " for object at "<< this << ".\n" - << logofs_flush; - #endif - - return 1; -} - -void ReadBuffer::fullReset() -{ - #ifdef TEST - - if (owner_ == 0) - { - *logofs << "ReadBuffer: PANIC! Class for FD#" - << transport_ -> fd() << " doesn't " - << "appear to be the owner of the buffer " - << "in reset.\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - if (length_ == 0 && size_ > maximumBufferSize_) - { - #ifdef TEST - *logofs << "ReadBuffer: Resizing buffer for FD#" - << transport_ -> fd() << " in reset from " - << size_ << " to " << maximumBufferSize_ - << " bytes.\n" << logofs_flush; - #endif - - delete [] buffer_; - - int newSize = maximumBufferSize_; - - unsigned char *newBuffer = allocateBuffer(newSize); - - buffer_ = newBuffer; - size_ = newSize; - - transport_ -> pendingReset(); - - owner_ = 1; - start_ = 0; - } -} - -unsigned char *ReadBuffer::allocateBuffer(unsigned int newSize) -{ - unsigned char *newBuffer = new unsigned char[newSize]; - - if (newBuffer == NULL) - { - #ifdef PANIC - *logofs << "ReadBuffer: PANIC! Can't allocate " - << newSize << " bytes of memory for buffer " - << "in context [B].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "read buffer in context [B].\n"; - - HandleCleanup(); - } - - #ifdef VALGRIND - - memset(newBuffer, '\0', newSize); - - #endif - - return newBuffer; -} - -void ReadBuffer::appendBuffer(const unsigned char *message, unsigned int length) -{ - if (start_ + length_ + length > size_) - { - unsigned int newSize = length_ + length + initialReadSize_; - - #ifdef TEST - *logofs << "ReadBuffer: WARNING! Resizing buffer " - << "for FD#" << transport_ -> fd() - << " from " << size_ << " to " << newSize - << " bytes.\n" << logofs_flush; - #endif - - unsigned char *newBuffer = allocateBuffer(newSize); - - memcpy(newBuffer, buffer_ + start_, length_); - - delete [] buffer_; - - buffer_ = newBuffer; - size_ = newSize; - - start_ = 0; - } - - memcpy(buffer_ + start_ + length_, message, length); - - length_ += length; - - transport_ -> pendingReset(); - - owner_ = 1; -} - -void ReadBuffer::convertBuffer() -{ - unsigned int newSize = length_ + initialReadSize_; - - #ifdef TEST - *logofs << "ReadBuffer: WARNING! Converting " - << length_ << " bytes to own buffer " - << "for FD#" << transport_ -> fd() - << " with new size " << newSize - << " bytes.\n" << logofs_flush; - #endif - - unsigned char *newBuffer = allocateBuffer(newSize); - - memcpy(newBuffer, buffer_ + start_, length_); - - buffer_ = newBuffer; - size_ = newSize; - - transport_ -> pendingReset(); - - owner_ = 1; - start_ = 0; -} diff --git a/nxcomp/ReadBuffer.h b/nxcomp/ReadBuffer.h deleted file mode 100644 index a12bcc9b3..000000000 --- a/nxcomp/ReadBuffer.h +++ /dev/null @@ -1,128 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ReadBuffer_H -#define ReadBuffer_H - -#include "Misc.h" -#include "Timestamp.h" -#include "Transport.h" - -#define READ_BUFFER_DEFAULT_SIZE 8192 - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -class ReadBuffer -{ - public: - - ReadBuffer(Transport *transport); - - virtual ~ReadBuffer(); - - int readMessage(); - - void readMessage(const unsigned char *message, unsigned int length); - - const unsigned char *getMessage(unsigned int &dataLength) - { - unsigned int controlLength; - - return getMessage(controlLength, dataLength); - } - - const unsigned char *getMessage(unsigned int &controlLength, unsigned int &dataLength); - - unsigned int getLength() const - { - return length_; - } - - unsigned int getRemaining() const - { - return remaining_; - } - - int setSize(int initialReadSize, int initialbufferSize); - - void fullReset(); - - // - // Check if there is a complete - // message in the buffer. - // - - int checkMessage() - { - if (length_ == 0) - { - return 0; - } - else - { - unsigned int controlLength; - unsigned int dataLength; - unsigned int trailerLength; - - return (locateMessage(buffer_ + start_, buffer_ + start_ + length_, - controlLength, dataLength, trailerLength)); - } - } - - protected: - - virtual unsigned int suggestedLength(unsigned int pendingLength) = 0; - - virtual int locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength) = 0; - - unsigned char *allocateBuffer(unsigned int newSize); - - void appendBuffer(const unsigned char *message, unsigned int length); - - void convertBuffer(); - - Transport *transport_; - - unsigned char *buffer_; - - unsigned int length_; - unsigned int size_; - unsigned int start_; - unsigned int remaining_; - - int owner_; - - unsigned int initialReadSize_; - unsigned int maximumBufferSize_; -}; - -#endif /* ReadBuffer_H */ diff --git a/nxcomp/RenderAddGlyphs.cpp b/nxcomp/RenderAddGlyphs.cpp deleted file mode 100644 index ed0864b93..000000000 --- a/nxcomp/RenderAddGlyphs.cpp +++ /dev/null @@ -1,229 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderAddGlyphs.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian), 29, - clientCache -> renderGlyphSetCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 32, - clientCache -> renderNumGlyphsCache, 8); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeCachedValue(value, 29, - clientCache -> renderGlyphSetCache); - - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderNumGlyphsCache, 8); - - PutULONG(value, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.add_glyphs.type = *(buffer + 1); - - renderExtension -> data.add_glyphs.set_id = GetULONG(buffer + 4, bigEndian); - renderExtension -> data.add_glyphs.num_elm = GetULONG(buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.add_glyphs.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.add_glyphs.type; - - PutULONG(renderExtension -> data.add_glyphs.set_id, buffer + 4, bigEndian); - PutULONG(renderExtension -> data.add_glyphs.num_elm, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.add_glyphs.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); - md5_append(md5_state, buffer + 8, 4); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(renderExtension -> data.add_glyphs.set_id, 29, - clientCache -> renderGlyphSetCache); - - cachedRenderExtension -> data.add_glyphs.set_id = - renderExtension -> data.add_glyphs.set_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.add_glyphs.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(renderExtension -> data.add_glyphs.set_id, 29, - clientCache -> renderGlyphSetCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.add_glyphs.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderAddGlyphs.h b/nxcomp/RenderAddGlyphs.h deleted file mode 100644 index d3c8cd158..000000000 --- a/nxcomp/RenderAddGlyphs.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderAddGlyphs_H -#define RenderAddGlyphs_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderAddGlyphs" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderAddGlyphsStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 12 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderAddGlyphs_H */ diff --git a/nxcomp/RenderChangePicture.cpp b/nxcomp/RenderChangePicture.cpp deleted file mode 100644 index 2abb97493..000000000 --- a/nxcomp/RenderChangePicture.cpp +++ /dev/null @@ -1,234 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderChangePicture.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - #ifdef DEBUG - - if (size == MESSAGE_OFFSET + 4) - { - *logofs << name() << ": Mask is " << GetULONG(buffer + 8, bigEndian) - << " value is " << GetULONG(buffer + 12, bigEndian) - << ".\n" << logofs_flush; - } - else - { - *logofs << name() << ": WARNING! Unexpected size. Mask is " - << GetULONG(buffer + 8, bigEndian) << ".\n" - << logofs_flush; - } - - #endif - - encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.change_picture.type = *(buffer + 1); - - renderExtension -> data.change_picture.src_id = GetULONG(buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.change_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.change_picture.type; - - PutULONG(renderExtension -> data.change_picture.src_id, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.change_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.change_picture.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.change_picture.src_id = - renderExtension -> data.change_picture.src_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.change_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.change_picture.src_id, - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.change_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderChangePicture.h b/nxcomp/RenderChangePicture.h deleted file mode 100644 index 4bab1ef98..000000000 --- a/nxcomp/RenderChangePicture.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderChangePicture_H -#define RenderChangePicture_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderChangePicture" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderChangePictureStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 8 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderChangePicture_H */ diff --git a/nxcomp/RenderComposite.cpp b/nxcomp/RenderComposite.cpp deleted file mode 100644 index e8603a7da..000000000 --- a/nxcomp/RenderComposite.cpp +++ /dev/null @@ -1,396 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderComposite.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> renderSrcPictureCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), - clientCache -> renderMaskPictureCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 16, bigEndian), - clientCache -> renderDstPictureCache); - - // - // Src X and Y. - // - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - // - // Mask X and Y. - // - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 24, bigEndian), - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 26, bigEndian), - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - // - // Dst X and Y. - // - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 28, bigEndian), - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 30, bigEndian), - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - // - // Width and height. - // - - encodeBuffer.encodeCachedValue(GetUINT(buffer + 32, bigEndian), 16, - clientCache -> renderWidthCache, 11); - - encodeBuffer.encodeCachedValue(GetUINT(buffer + 34, bigEndian), 16, - clientCache -> renderHeightCache, 11); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeXidValue(value, clientCache -> renderMaskPictureCache); - - PutULONG(value, buffer + 12, bigEndian); - - decodeBuffer.decodeXidValue(value, clientCache -> renderDstPictureCache); - - PutULONG(value, buffer + 16, bigEndian); - - // - // Src X and Y. - // - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); - - // - // Mask X and Y. - // - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - PutUINT(clientCache -> renderLastX, buffer + 24, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - PutUINT(clientCache -> renderLastY, buffer + 26, bigEndian); - - // - // Dst X and Y. - // - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - PutUINT(clientCache -> renderLastX, buffer + 28, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - PutUINT(clientCache -> renderLastY, buffer + 30, bigEndian); - - // - // Width and height. - // - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> renderWidthCache, 11); - - PutUINT(value, buffer + 32, bigEndian); - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> renderHeightCache, 11); - - PutUINT(value, buffer + 34, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.composite.type = *(buffer + 1); - renderExtension -> data.composite.op = *(buffer + 4); - - renderExtension -> data.composite.src_id = GetULONG(buffer + 8, bigEndian); - renderExtension -> data.composite.msk_id = GetULONG(buffer + 12, bigEndian); - renderExtension -> data.composite.dst_id = GetULONG(buffer + 16, bigEndian); - - renderExtension -> data.composite.src_x = GetUINT(buffer + 20, bigEndian); - renderExtension -> data.composite.src_y = GetUINT(buffer + 22, bigEndian); - - renderExtension -> data.composite.msk_x = GetUINT(buffer + 24, bigEndian); - renderExtension -> data.composite.msk_y = GetUINT(buffer + 26, bigEndian); - - renderExtension -> data.composite.dst_x = GetUINT(buffer + 28, bigEndian); - renderExtension -> data.composite.dst_y = GetUINT(buffer + 30, bigEndian); - - renderExtension -> data.composite.width = GetUINT(buffer + 32, bigEndian); - renderExtension -> data.composite.height = GetUINT(buffer + 34, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.composite.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.composite.type; - *(buffer + 4) = renderExtension -> data.composite.op; - - PutULONG(renderExtension -> data.composite.src_id, buffer + 8, bigEndian); - PutULONG(renderExtension -> data.composite.msk_id, buffer + 12, bigEndian); - PutULONG(renderExtension -> data.composite.dst_id, buffer + 16, bigEndian); - - PutUINT(renderExtension -> data.composite.src_x, buffer + 20, bigEndian); - PutUINT(renderExtension -> data.composite.src_y, buffer + 22, bigEndian); - - PutUINT(renderExtension -> data.composite.msk_x, buffer + 24, bigEndian); - PutUINT(renderExtension -> data.composite.msk_y, buffer + 26, bigEndian); - - PutUINT(renderExtension -> data.composite.dst_x, buffer + 28, bigEndian); - PutUINT(renderExtension -> data.composite.dst_y, buffer + 30, bigEndian); - - PutUINT(renderExtension -> data.composite.width, buffer + 32, bigEndian); - PutUINT(renderExtension -> data.composite.height, buffer + 34, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.composite.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - // - // Include the minor opcode and size in the - // identity, plus the operator, the x and y - // of the source and mask and the width and - // height of the destination. - // - - md5_append(md5_state, buffer + 1, 4); - md5_append(md5_state, buffer + 20, 8); - md5_append(md5_state, buffer + 32, 4); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Source " << renderExtension -> data.composite.src_id - << " mask " << renderExtension -> data.composite.msk_id - << " destination " << renderExtension -> data.composite.msk_id - << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(renderExtension -> data.composite.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.composite.src_id = - renderExtension -> data.composite.src_id; - - encodeBuffer.encodeXidValue(renderExtension -> data.composite.msk_id, - clientCache -> renderMaskPictureCache); - - cachedRenderExtension -> data.composite.msk_id = - renderExtension -> data.composite.msk_id; - - encodeBuffer.encodeXidValue(renderExtension -> data.composite.dst_id, - clientCache -> renderDstPictureCache); - - cachedRenderExtension -> data.composite.dst_id = - renderExtension -> data.composite.dst_id; - - // - // Dst X and Y. - // - - unsigned int value; - unsigned int previous; - - value = renderExtension -> data.composite.dst_x; - previous = cachedRenderExtension -> data.composite.dst_x; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - cachedRenderExtension -> data.composite.dst_x = value; - - value = renderExtension -> data.composite.dst_y; - previous = cachedRenderExtension -> data.composite.dst_y; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - cachedRenderExtension -> data.composite.dst_y = value; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.composite.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.composite.src_id, - clientCache -> renderSrcPictureCache); - - decodeBuffer.decodeXidValue(renderExtension -> data.composite.msk_id, - clientCache -> renderMaskPictureCache); - - decodeBuffer.decodeXidValue(renderExtension -> data.composite.dst_id, - clientCache -> renderDstPictureCache); - - // - // Dst X and Y. - // - - unsigned int value; - unsigned int previous; - - previous = renderExtension -> data.composite.dst_x; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - renderExtension -> data.composite.dst_x = value; - - previous = renderExtension -> data.composite.dst_y; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - renderExtension -> data.composite.dst_y = value; - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.composite.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderComposite.h b/nxcomp/RenderComposite.h deleted file mode 100644 index aafa1e776..000000000 --- a/nxcomp/RenderComposite.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderComposite_H -#define RenderComposite_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderComposite" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderCompositeStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 36 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 0 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 0 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderComposite_H */ diff --git a/nxcomp/RenderCompositeGlyphs.cpp b/nxcomp/RenderCompositeGlyphs.cpp deleted file mode 100644 index 74b3ec779..000000000 --- a/nxcomp/RenderCompositeGlyphs.cpp +++ /dev/null @@ -1,625 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderCompositeGlyphs.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding value " - << ((size - MESSAGE_OFFSET) >> 2) << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << size - << ".\n" << logofs_flush; - #endif - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> renderSrcPictureCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), - clientCache -> renderDstPictureCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, - clientCache -> renderFormatCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 29, - clientCache -> renderGlyphSetCache); - - unsigned int src_x = GetUINT(buffer + 24, bigEndian); - unsigned int src_y = GetUINT(buffer + 26, bigEndian); - - // Since ProtoStep8 (#issue 108) - encodeBuffer.encodeDiffCachedValue(src_x, - clientCache -> renderGlyphX, 16, - clientCache -> renderGlyphXCache, 11); - - encodeBuffer.encodeDiffCachedValue(src_y, - clientCache -> renderGlyphY, 16, - clientCache -> renderGlyphYCache, 11); - - #ifdef TEST - *logofs << name() << ": Encoded source X " - << GetUINT(buffer + 24, bigEndian) << " source Y " - << GetUINT(buffer + 26, bigEndian) << ".\n" - << logofs_flush; - #endif - - // - // Bytes from 28 to 36 contain in the order: - // - // 1 byte for the length of the first string. - // 3 bytes of padding. - // 2 bytes for the X offset. - // 2 bytes for the Y offset. - // - // Encode these bytes differentially to match - // all the strings that have equal glyphs. - // - // Only manage the first string of glyphs. The - // others strings should match, if they contain - // the same glyphs, since the offset are rela- - // tive to the first offset coordinates. - // - - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - unsigned int numGlyphs = *(buffer + 28); - - encodeBuffer.encodeCachedValue(numGlyphs, 8, - clientCache -> renderNumGlyphsCache); - - unsigned int offset_x = GetUINT(buffer + 32, bigEndian); - unsigned int offset_y = GetUINT(buffer + 34, bigEndian); - - if (offset_x == src_x && offset_y == src_y) - { - encodeBuffer.encodeBoolValue(0); - - #ifdef TEST - *logofs << name() << ": Matched offset X " - << GetUINT(buffer + 32, bigEndian) << " offset Y " - << GetUINT(buffer + 34, bigEndian) << ".\n" - << logofs_flush; - #endif - } - else - { - encodeBuffer.encodeBoolValue(1); - - encodeBuffer.encodeDiffCachedValue(offset_x, - clientCache -> renderGlyphX, 16, - clientCache -> renderGlyphXCache, 11); - - encodeBuffer.encodeDiffCachedValue(offset_y, - clientCache -> renderGlyphY, 16, - clientCache -> renderGlyphYCache, 11); - - #ifdef TEST - *logofs << name() << ": Missed offset X " - << GetUINT(buffer + 32, bigEndian) << " offset Y " - << GetUINT(buffer + 34, bigEndian) << ".\n" - << logofs_flush; - #endif - } - } - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - decodeBuffer.decodeXidValue(value, - clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeXidValue(value, - clientCache -> renderDstPictureCache); - - PutULONG(value, buffer + 12, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderFormatCache); - - PutULONG(value, buffer + 16, bigEndian); - - decodeBuffer.decodeCachedValue(value, 29, - clientCache -> renderGlyphSetCache); - - PutULONG(value, buffer + 20, bigEndian); - - unsigned int src_x; - unsigned int src_y; - - // Since ProtoStep8 (#issue 108) - decodeBuffer.decodeDiffCachedValue(src_x, - clientCache -> renderGlyphX, 16, - clientCache -> renderGlyphXCache, 11); - - decodeBuffer.decodeDiffCachedValue(src_y, - clientCache -> renderGlyphY, 16, - clientCache -> renderGlyphYCache, 11); - - PutUINT(src_x, buffer + 24, bigEndian); - PutUINT(src_y, buffer + 26, bigEndian); - - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - decodeBuffer.decodeCachedValue(value, 8, - clientCache -> renderNumGlyphsCache); - - *(buffer + 28) = value; - - decodeBuffer.decodeBoolValue(value); - - if (value == 0) - { - PutUINT(src_x, buffer + 32, bigEndian); - PutUINT(src_y, buffer + 34, bigEndian); - } - else - { - decodeBuffer.decodeDiffCachedValue(src_x, - clientCache -> renderGlyphX, 16, - clientCache -> renderGlyphXCache, 11); - - PutUINT(src_x, buffer + 32, bigEndian); - - decodeBuffer.decodeDiffCachedValue(src_y, - clientCache -> renderGlyphY, 16, - clientCache -> renderGlyphYCache, 11); - - PutUINT(src_y, buffer + 34, bigEndian); - } - } - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8, - size, bigEndian, channelCache); - } - else if (size > MESSAGE_OFFSET) - { - encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - } - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of text data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8, - size, bigEndian, channelCache); - } - else if (size > MESSAGE_OFFSET) - { - decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - } - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.composite_glyphs.type = *(buffer + 1); - renderExtension -> data.composite_glyphs.op = *(buffer + 4); - - renderExtension -> data.composite_glyphs.src_id = GetULONG(buffer + 8, bigEndian); - renderExtension -> data.composite_glyphs.dst_id = GetULONG(buffer + 12, bigEndian); - - renderExtension -> data.composite_glyphs.format = GetULONG(buffer + 16, bigEndian); - renderExtension -> data.composite_glyphs.set_id = GetULONG(buffer + 20, bigEndian); - - renderExtension -> data.composite_glyphs.src_x = GetUINT(buffer + 24, bigEndian); - renderExtension -> data.composite_glyphs.src_y = GetUINT(buffer + 26, bigEndian); - - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - renderExtension -> data.composite_glyphs.num_elm = *(buffer + 28); - - renderExtension -> data.composite_glyphs.offset_x = GetUINT(buffer + 32, bigEndian); - renderExtension -> data.composite_glyphs.offset_y = GetUINT(buffer + 34, bigEndian); - } - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.composite_glyphs.type - << " size is " << renderExtension -> size_ << " identity size " - << renderExtension -> i_size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.composite_glyphs.type; - *(buffer + 4) = renderExtension -> data.composite_glyphs.op; - - PutULONG(renderExtension -> data.composite_glyphs.src_id, buffer + 8, bigEndian); - PutULONG(renderExtension -> data.composite_glyphs.dst_id, buffer + 12, bigEndian); - - PutULONG(renderExtension -> data.composite_glyphs.format, buffer + 16, bigEndian); - PutULONG(renderExtension -> data.composite_glyphs.set_id, buffer + 20, bigEndian); - - PutUINT(renderExtension -> data.composite_glyphs.src_x, buffer + 24, bigEndian); - PutUINT(renderExtension -> data.composite_glyphs.src_y, buffer + 26, bigEndian); - - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - *(buffer + 28) = renderExtension -> data.composite_glyphs.num_elm; - - PutUINT(renderExtension -> data.composite_glyphs.offset_x, buffer + 32, bigEndian); - PutUINT(renderExtension -> data.composite_glyphs.offset_y, buffer + 34, bigEndian); - } - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.composite_glyphs.type - << " size is " << renderExtension -> size_ << " identity size " - << renderExtension -> i_size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - // - // Include minor opcode, size and - // the composite operator in the - // identity. - // - - md5_append(md5_state, buffer + 1, 4); - - // - // Include the format. - // - - md5_append(md5_state, buffer + 16, 4); - - // - // Also include the length of the - // first string. - // - - // Since ProtoStep8 (#issue 108) - if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - md5_append(md5_state, buffer + 28, 1); - } -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.composite_glyphs.src_id = - renderExtension -> data.composite_glyphs.src_id; - - encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs.dst_id, - clientCache -> renderDstPictureCache); - - cachedRenderExtension -> data.composite_glyphs.dst_id = - renderExtension -> data.composite_glyphs.dst_id; - - encodeBuffer.encodeCachedValue(renderExtension -> data.composite_glyphs.set_id, 29, - clientCache -> renderGlyphSetCache); - - cachedRenderExtension -> data.composite_glyphs.set_id = - renderExtension -> data.composite_glyphs.set_id; - - // - // Src X and Y. - // - // The source X and Y coordinates are - // encoded as differerences in respect - // to the cached message. - // - - unsigned int value; - unsigned int previous; - - // Since ProtoStep8 (#issue 108) - value = renderExtension -> data.composite_glyphs.src_x; - previous = cachedRenderExtension -> data.composite_glyphs.src_x; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphXCache, 11); - - cachedRenderExtension -> data.composite_glyphs.src_x = value; - - value = renderExtension -> data.composite_glyphs.src_y; - previous = cachedRenderExtension -> data.composite_glyphs.src_y; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphYCache, 11); - - cachedRenderExtension -> data.composite_glyphs.src_y = value; - - #ifdef TEST - *logofs << name() << ": Encoded source X " - << renderExtension -> data.composite_glyphs.src_x << " source Y " - << renderExtension -> data.composite_glyphs.src_y << ".\n" - << logofs_flush; - #endif - - // Since ProtoStep8 (#issue 108) - if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - // - // Offset X and Y. - // - - if (renderExtension -> data.composite_glyphs.offset_x == - renderExtension -> data.composite_glyphs.src_x && - renderExtension -> data.composite_glyphs.offset_y == - renderExtension -> data.composite_glyphs.src_y) - { - encodeBuffer.encodeBoolValue(0); - - cachedRenderExtension -> data.composite_glyphs.offset_x = - renderExtension -> data.composite_glyphs.offset_x; - - cachedRenderExtension -> data.composite_glyphs.offset_y = - renderExtension -> data.composite_glyphs.offset_y; - - #ifdef TEST - *logofs << name() << ": Matched offset X " - << renderExtension -> data.composite_glyphs.offset_x << " offset Y " - << renderExtension -> data.composite_glyphs.offset_y << ".\n" - << logofs_flush; - #endif - } - else - { - encodeBuffer.encodeBoolValue(1); - - value = renderExtension -> data.composite_glyphs.offset_x; - previous = cachedRenderExtension -> data.composite_glyphs.offset_x; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphXCache, 11); - - cachedRenderExtension -> data.composite_glyphs.offset_x = value; - - value = renderExtension -> data.composite_glyphs.offset_y; - previous = cachedRenderExtension -> data.composite_glyphs.offset_y; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphYCache, 11); - - cachedRenderExtension -> data.composite_glyphs.offset_y = value; - - #ifdef TEST - *logofs << name() << ": Missed offset X " - << renderExtension -> data.composite_glyphs.offset_x << " offset Y " - << renderExtension -> data.composite_glyphs.offset_y << ".\n" - << logofs_flush; - #endif - } - } - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.composite_glyphs.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs.src_id, - clientCache -> renderSrcPictureCache); - - decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs.dst_id, - clientCache -> renderDstPictureCache); - - decodeBuffer.decodeCachedValue(renderExtension -> data.composite_glyphs.set_id, 29, - clientCache -> renderGlyphSetCache); - - // - // Src X and Y. - // - - unsigned int value; - unsigned int previous; - - // Since ProtoStep8 (#issue 108) - previous = renderExtension -> data.composite_glyphs.src_x; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphXCache, 11); - - renderExtension -> data.composite_glyphs.src_x = value; - - previous = renderExtension -> data.composite_glyphs.src_y; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphYCache, 11); - - renderExtension -> data.composite_glyphs.src_y = value; - - // Since ProtoStep8 (#issue 108) - if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8) - { - // - // Offset X and Y. - // - - decodeBuffer.decodeBoolValue(value); - - if (value == 0) - { - renderExtension -> data.composite_glyphs.offset_x = - renderExtension -> data.composite_glyphs.src_x; - - renderExtension -> data.composite_glyphs.offset_y = - renderExtension -> data.composite_glyphs.src_y; - } - else - { - previous = renderExtension -> data.composite_glyphs.offset_x; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphXCache, 11); - - renderExtension -> data.composite_glyphs.offset_x = value; - - previous = renderExtension -> data.composite_glyphs.offset_y; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderGlyphYCache, 11); - - renderExtension -> data.composite_glyphs.offset_y = value; - } - } - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.composite_glyphs.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderCompositeGlyphs.h b/nxcomp/RenderCompositeGlyphs.h deleted file mode 100644 index 1062ee781..000000000 --- a/nxcomp/RenderCompositeGlyphs.h +++ /dev/null @@ -1,100 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderCompositeGlyphs_H -#define RenderCompositeGlyphs_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderCompositeGlyphs" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderCompositeGlyphsStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 28 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Encode the first 8 bytes of the -// data differentially in newer -// protocol versions. -// - -#undef MESSAGE_OFFSET_IF_PROTO_STEP_8 -#define MESSAGE_OFFSET_IF_PROTO_STEP_8 36 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - // Since ProtoStep8 (#issue 108) - unsigned int offset = MESSAGE_OFFSET_IF_PROTO_STEP_8; - - return (size >= offset ? offset : size); - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderCompositeGlyphs_H */ diff --git a/nxcomp/RenderCreateGlyphSet.cpp b/nxcomp/RenderCreateGlyphSet.cpp deleted file mode 100644 index 3e7a71721..000000000 --- a/nxcomp/RenderCreateGlyphSet.cpp +++ /dev/null @@ -1,181 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderCreateGlyphSet.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderGlyphSetCache, - clientCache -> renderFreeGlyphSetCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 32, - clientCache -> renderFormatCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeNewXidValue(value, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderGlyphSetCache, - clientCache -> renderFreeGlyphSetCache); - - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderFormatCache); - - PutULONG(value, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.create_set.type = *(buffer + 1); - - renderExtension -> data.create_set.set_id = GetULONG(buffer + 4, bigEndian); - renderExtension -> data.create_set.format = GetULONG(buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.create_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.create_set.type; - - PutULONG(renderExtension -> data.create_set.set_id, buffer + 4, bigEndian); - PutULONG(renderExtension -> data.create_set.format, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.create_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); - md5_append(md5_state, buffer + 8, 4); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeNewXidValue(renderExtension -> data.create_set.set_id, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderGlyphSetCache, - clientCache -> renderFreeGlyphSetCache); - - cachedRenderExtension -> data.create_set.set_id = - renderExtension -> data.create_set.set_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.create_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeNewXidValue(renderExtension -> data.create_set.set_id, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderGlyphSetCache, - clientCache -> renderFreeGlyphSetCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.create_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderCreateGlyphSet.h b/nxcomp/RenderCreateGlyphSet.h deleted file mode 100644 index 10f5d6699..000000000 --- a/nxcomp/RenderCreateGlyphSet.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderCreateGlyphSet_H -#define RenderCreateGlyphSet_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderCreateGlyphSet" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderCreateGlyphSetStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 12 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 0 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 0 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderCreateGlyphSet_H */ diff --git a/nxcomp/RenderCreatePicture.cpp b/nxcomp/RenderCreatePicture.cpp deleted file mode 100644 index 2fd736cbb..000000000 --- a/nxcomp/RenderCreatePicture.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderCreatePicture.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderSrcPictureCache, - clientCache -> renderFreePictureCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> drawableCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 12, bigEndian), 32, - clientCache -> renderFormatCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, - clientCache -> renderValueMaskCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeNewXidValue(value, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderSrcPictureCache, - clientCache -> renderFreePictureCache); - - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeXidValue(value, - clientCache -> drawableCache); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderFormatCache); - - PutULONG(value, buffer + 12, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderValueMaskCache); - - PutULONG(value, buffer + 16, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.create_picture.type = *(buffer + 1); - - renderExtension -> data.create_picture.src_id = GetULONG(buffer + 4, bigEndian); - renderExtension -> data.create_picture.dst_id = GetULONG(buffer + 8, bigEndian); - - renderExtension -> data.create_picture.format = GetULONG(buffer + 12, bigEndian); - renderExtension -> data.create_picture.mask = GetULONG(buffer + 16, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.create_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.create_picture.type; - - PutULONG(renderExtension -> data.create_picture.src_id, buffer + 4, bigEndian); - PutULONG(renderExtension -> data.create_picture.dst_id, buffer + 8, bigEndian); - - PutULONG(renderExtension -> data.create_picture.format, buffer + 12, bigEndian); - PutULONG(renderExtension -> data.create_picture.mask, buffer + 16, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.create_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); - md5_append(md5_state, buffer + 12, 8); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding new id value " - << renderExtension -> data.create_picture.src_id - << ".\n"; - #endif - - encodeBuffer.encodeNewXidValue(renderExtension -> data.create_picture.src_id, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderSrcPictureCache, - clientCache -> renderFreePictureCache); - - cachedRenderExtension -> data.create_picture.src_id = - renderExtension -> data.create_picture.src_id; - - encodeBuffer.encodeXidValue(renderExtension -> data.create_picture.dst_id, - clientCache -> drawableCache); - - cachedRenderExtension -> data.create_picture.dst_id = - renderExtension -> data.create_picture.dst_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.create_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeNewXidValue(renderExtension -> data.create_picture.src_id, - clientCache -> lastId, clientCache -> lastIdCache, - clientCache -> renderSrcPictureCache, - clientCache -> renderFreePictureCache); - - decodeBuffer.decodeXidValue(renderExtension -> data.create_picture.dst_id, - clientCache -> drawableCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.create_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderCreatePicture.h b/nxcomp/RenderCreatePicture.h deleted file mode 100644 index ae2f583a0..000000000 --- a/nxcomp/RenderCreatePicture.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderCreatePicture_H -#define RenderCreatePicture_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderCreatePicture" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderCreatePictureStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 20 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderCreatePicture_H */ diff --git a/nxcomp/RenderExtension.cpp b/nxcomp/RenderExtension.cpp deleted file mode 100644 index bd2285e82..000000000 --- a/nxcomp/RenderExtension.cpp +++ /dev/null @@ -1,423 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "NXrender.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -#include "RenderExtension.h" - -#include "RenderGenericRequest.h" -#include "RenderCreatePicture.h" -#include "RenderChangePicture.h" -#include "RenderFreePicture.h" -#include "RenderPictureClip.h" -#include "RenderPictureTransform.h" -#include "RenderPictureFilter.h" -#include "RenderCreateGlyphSet.h" -#include "RenderFreeGlyphSet.h" -#include "RenderAddGlyphs.h" -#include "RenderComposite.h" -#include "RenderCompositeGlyphs.h" -#include "RenderFillRectangles.h" -#include "RenderTrapezoids.h" -#include "RenderTriangles.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Constructor and destructor. -// - -RenderExtensionStore::RenderExtensionStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = RENDEREXTENSION_ENABLE_CACHE; - enableData = RENDEREXTENSION_ENABLE_DATA; - enableSplit = RENDEREXTENSION_ENABLE_SPLIT; - enableCompress = RENDEREXTENSION_ENABLE_COMPRESS; - - generic_ = new RenderGenericRequestStore(); - - for (int i = 0; i < RENDEREXTENSION_MINOR_OPCODE_LIMIT; i++) - { - minors_[i] = generic_; - } - - minors_[X_RenderChangePicture] = new RenderChangePictureStore(); - minors_[X_RenderFillRectangles] = new RenderFillRectanglesStore(); - minors_[X_RenderAddGlyphs] = new RenderAddGlyphsStore(); - - // Since ProtoStep7 (#issue 108) - minors_[X_RenderCreatePicture] = new RenderCreatePictureStore(); - minors_[X_RenderFreePicture] = new RenderFreePictureStore(); - minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore(); - minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore(); - minors_[X_RenderComposite] = new RenderCompositeStore(); - minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore(); - minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore(); - minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore(); - - minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore(); - minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore(); - minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore(); - minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore(); - minors_[X_RenderTriangles] = new RenderTrianglesStore(); - - dataLimit = RENDEREXTENSION_DATA_LIMIT; - dataOffset = RENDEREXTENSION_DATA_OFFSET; - - // Since ProtoStep7 (#issue 108) - cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7; - - cacheThreshold = RENDEREXTENSION_CACHE_THRESHOLD; - cacheLowerThreshold = RENDEREXTENSION_CACHE_LOWER_THRESHOLD; - - opcode_ = X_NXInternalRenderExtension; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -RenderExtensionStore::~RenderExtensionStore() -{ - for (int i = 0; i < RENDEREXTENSION_MINOR_OPCODE_LIMIT; i++) - { - if (minors_[i] != generic_) - { - delete minors_[i]; - } - } - - delete generic_; - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -int RenderExtensionStore::validateMessage(const unsigned char *buffer, int size) -{ - #ifdef TEST - *logofs << name() << ": Encoding message OPCODE#" - << (unsigned) *buffer << " MINOR#" << (unsigned) - *(buffer + 1) << " with size " << size - << ".\n" << logofs_flush; - #endif - - return (size >= control -> MinimumMessageSize && - size <= control -> MaximumMessageSize); -} - -// -// Here are the methods to handle the messages' content. -// - -int RenderExtensionStore::identitySize(const unsigned char *buffer, unsigned int size) -{ - return minors_[*(buffer + 1)] -> identitySize(buffer, size); -} - -int RenderExtensionStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - encodeBuffer.encodeOpcodeValue(*(buffer + 1), - ((ClientCache *) channelCache) -> renderOpcodeCache); - - minors_[*(buffer + 1)] -> encodeMessage(encodeBuffer, buffer, size, - bigEndian, channelCache); - - return 1; -} - -int RenderExtensionStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - unsigned char type; - - decodeBuffer.decodeOpcodeValue(type, - ((ClientCache *) channelCache) -> renderOpcodeCache); - - minors_[type] -> decodeMessage(decodeBuffer, buffer, size, type, - bigEndian, writeBuffer, channelCache); - - return 1; -} - -int RenderExtensionStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - return minors_[*(buffer + 1)] -> parseIdentity(message, buffer, size, bigEndian); -} - -int RenderExtensionStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - return minors_[((RenderExtensionMessage *) message) -> data.any.type] -> - unparseIdentity(message, buffer, size, bigEndian); -} - -void RenderExtensionStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - minors_[*(buffer + 1)] -> identityChecksum(message, buffer, size, md5_state_, bigEndian); -} - -void RenderExtensionStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - minors_[((RenderExtensionMessage *) message) -> data.any.type] -> - updateIdentity(encodeBuffer, message, cachedMessage, channelCache); -} - -void RenderExtensionStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - minors_[((RenderExtensionMessage *) message) -> data.any.type] -> - updateIdentity(decodeBuffer, message, channelCache); -} - -void RenderExtensionStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - #ifdef WARNING - *logofs << name() << ": WARNING! Dump of identity not implemented.\n" - << logofs_flush; - #endif - - #endif -} - -// -// TODO: The following encoding and decoding functions -// could be generalized further, for example by passing -// the pointer to the data cache, the number of caches -// made available by the caller and the first cache to -// iterate through. -// - -void RenderMinorExtensionStore::encodeLongData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeLongData(buffer + offset, size - offset); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - offset - << " bytes of long data.\n" << logofs_flush; - #endif -} - -void RenderMinorExtensionStore::encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeIntData(buffer + offset, size - offset); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - offset - << " bytes of int data.\n" << logofs_flush; - #endif -} - -void RenderMinorExtensionStore::encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(buffer + offset, size - offset); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - offset - << " bytes of text data.\n" << logofs_flush; - #endif -} - -void RenderMinorExtensionStore::decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeLongData(buffer + offset, size - offset); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - offset - << " bytes of long data.\n" << logofs_flush; - #endif -} - -void RenderMinorExtensionStore::decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeIntData(buffer + offset, size - offset); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - offset - << " bytes of int data.\n" << logofs_flush; - #endif -} - -void RenderMinorExtensionStore::decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(buffer + offset, size - offset); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - offset - << " bytes of text data.\n" << logofs_flush; - #endif -} - -void RenderMinorExtensionStore::parseIntData(const Message *message, const unsigned char *buffer, - unsigned int offset, unsigned int size, - int bigEndian) const -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); - - for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) - { - #ifdef DEBUG - *logofs << name() << ": Parsing int with i = " << i << " c = " - << c << ".\n" << logofs_flush; - #endif - - renderExtension -> data.any.short_data[c] = GetUINT(buffer + i, bigEndian); - - if (++c == 16) c = 0; - } -} - -void RenderMinorExtensionStore::unparseIntData(const Message *message, unsigned char *buffer, - unsigned int offset, unsigned int size, - int bigEndian) const -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); - - for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) - { - #ifdef DEBUG - *logofs << name() << ": Unparsing int with i = " << i << " c = " - << c << ".\n" << logofs_flush; - #endif - - PutUINT(renderExtension -> data.any.short_data[c], buffer + i, bigEndian); - - if (++c == 16) c = 0; - } -} - -void RenderMinorExtensionStore::updateIntData(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, unsigned int offset, - unsigned int size, ChannelCache *channelCache) const -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); - - for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) - { - #ifdef DEBUG - *logofs << name() << ": Encoding int update with i = " << i - << " c = " << c << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(renderExtension -> data.any.short_data[c], 16, - *clientCache -> renderDataCache[c]); - - cachedRenderExtension -> data.any.short_data[c] = - renderExtension -> data.any.short_data[c]; - - if (++c == 16) c = 0; - } -} - -void RenderMinorExtensionStore::updateIntData(DecodeBuffer &decodeBuffer, const Message *message, - unsigned int offset, unsigned int size, - ChannelCache *channelCache) const -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); - - unsigned int value; - - for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) - { - #ifdef DEBUG - *logofs << name() << ": Decoding int update with i = " << i - << " c = " << c << ".\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> renderDataCache[c]); - - renderExtension -> data.any.short_data[c] = value; - - if (++c == 16) c = 0; - } -} diff --git a/nxcomp/RenderExtension.h b/nxcomp/RenderExtension.h deleted file mode 100644 index aa9db1b55..000000000 --- a/nxcomp/RenderExtension.h +++ /dev/null @@ -1,504 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderExtension_H -#define RenderExtension_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Compression of data part is not enabled as -// most messages of this type are smaller than -// the current data size compression threshold. -// - -#define RENDEREXTENSION_ENABLE_CACHE 1 -#define RENDEREXTENSION_ENABLE_DATA 0 -#define RENDEREXTENSION_ENABLE_SPLIT 0 -#define RENDEREXTENSION_ENABLE_COMPRESS 0 - -#define RENDEREXTENSION_DATA_LIMIT 6144 -#define RENDEREXTENSION_DATA_OFFSET 36 - -#define RENDEREXTENSION_CACHE_THRESHOLD 20 -#define RENDEREXTENSION_CACHE_LOWER_THRESHOLD 10 - -#define RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7 8000 - -// -// Used to build the table of minor opcodes. -// - -#define RENDEREXTENSION_MINOR_OPCODE_LIMIT 256 - -// -// The message class. -// - -class RenderMinorExtensionStore; - -class RenderExtensionMessage : public Message -{ - friend class RenderExtensionStore; - friend class RenderMinorExtensionStore; - - friend class RenderGenericRequestStore; - friend class RenderCreatePictureStore; - friend class RenderChangePictureStore; - friend class RenderFreePictureStore; - friend class RenderPictureClipStore; - friend class RenderPictureTransformStore; - friend class RenderPictureFilterStore; - friend class RenderCreateGlyphSetStore; - friend class RenderFreeGlyphSetStore; - friend class RenderAddGlyphsStore; - friend class RenderCompositeStore; - friend class RenderCompositeGlyphsStore; - friend class RenderFillRectanglesStore; - friend class RenderTrapezoidsStore; - friend class RenderTrianglesStore; - - public: - - RenderExtensionMessage() - { - } - - ~RenderExtensionMessage() - { - } - - // - // We consider for this message a data offset of 36, - // that is size of the biggest among all requests of - // this extension. The most common requests have a - // specific differential encoding, others are simply - // encoded through an array of int or char caches. - // - - private: - - union - { - struct - { - unsigned char type; - - unsigned char char_data[32]; - unsigned short short_data[16]; - unsigned short long_data[8]; - } - any; - - struct - { - unsigned char type; - - unsigned int src_id; - unsigned int dst_id; - - unsigned int format; - unsigned int mask; - } - create_picture; - - struct - { - unsigned char type; - - unsigned int src_id; - } - change_picture; - - struct - { - unsigned char type; - - unsigned int src_id; - } - free_picture; - - struct - { - unsigned char type; - - unsigned int src_id; - - unsigned short src_x; - unsigned short src_y; - } - picture_clip; - - struct - { - unsigned char type; - - unsigned int src_id; - } - picture_transform; - - struct - { - unsigned char type; - - unsigned int src_id; - unsigned int num_elm; - } - picture_filter; - - struct - { - unsigned char type; - - unsigned int set_id; - unsigned int format; - } - create_set; - - struct - { - unsigned char type; - - unsigned int set_id; - } - free_set; - - struct - { - unsigned char type; - - unsigned int set_id; - unsigned int num_elm; - } - add_glyphs; - - struct - { - unsigned char type; - - unsigned char op; - - unsigned int src_id; - unsigned int msk_id; - unsigned int dst_id; - - unsigned short src_x; - unsigned short src_y; - - unsigned short msk_x; - unsigned short msk_y; - - unsigned short dst_x; - unsigned short dst_y; - - unsigned short width; - unsigned short height; - } - composite; - - struct - { - unsigned char type; - - unsigned char op; - - unsigned char num_elm; - - unsigned int src_id; - unsigned int dst_id; - - unsigned int format; - unsigned int set_id; - - unsigned short src_x; - unsigned short src_y; - - unsigned short offset_x; - unsigned short offset_y; - } - composite_glyphs; - - struct - { - unsigned char type; - - unsigned char op; - - unsigned int dst_id; - } - fill_rectangles; - - struct - { - unsigned char type; - - unsigned char op; - - unsigned int src_id; - unsigned int dst_id; - - unsigned int format; - - unsigned short src_x; - unsigned short src_y; - } - trapezoids; - - struct - { - unsigned char type; - - unsigned char op; - - unsigned int src_id; - unsigned int dst_id; - - unsigned int format; - - unsigned short src_x; - unsigned short src_y; - } - triangles; - - struct - { - unsigned char type; - - unsigned char op; - - unsigned char num_elm; - - unsigned int src_id; - unsigned int dst_id; - - unsigned int format; - unsigned int set_id; - - unsigned short src_x; - unsigned short src_y; - - unsigned short delta_x; - unsigned short delta_y; - } - composite_glyphs_compat; - - } - data; -}; - -class RenderExtensionStore : public MessageStore -{ - public: - - RenderExtensionStore(StaticCompressor *compressor); - - virtual ~RenderExtensionStore(); - - virtual const char *name() const - { - return "RenderExtension"; - } - - virtual unsigned char opcode() const - { - return opcode_; - } - - virtual unsigned int storage() const - { - return sizeof(RenderExtensionMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new RenderExtensionMessage(); - } - - virtual Message *create(const Message &message) const - { - return new RenderExtensionMessage((const RenderExtensionMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (RenderExtensionMessage *) message; - } - - // - // Determine if the message must be stored - // in the cache. - // - - virtual int validateMessage(const unsigned char *buffer, int size); - - // - // Since protocol step 5 these methods are - // specialized in their minor opcode stores. - // - - virtual int identitySize(const unsigned char *buffer, unsigned int size); - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; - - private: - - unsigned char opcode_; - - // - // Keep pointers to specialized classes. - // - - RenderMinorExtensionStore *minors_[RENDEREXTENSION_MINOR_OPCODE_LIMIT]; - - RenderMinorExtensionStore *generic_; -}; - -class RenderMinorExtensionStore : public MinorMessageStore -{ - public: - - virtual const char *name() const = 0; - - virtual int identitySize(const unsigned char *buffer, unsigned int size) = 0; - - virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const = 0; - - virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, unsigned char type, int bigEndian, - WriteBuffer *writeBuffer, ChannelCache *channelCache) const = 0; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const = 0; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const = 0; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const = 0; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, md5_state_t *md5_state, - int bigEndian) const = 0; - - // - // Internal encode and decode utilities. - // - - protected: - - void encodeLongData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - void encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - void encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - void decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - void decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - void decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int offset, unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - /* - * The following methods are only used in the - * encoding of the generic render request. To - * be removed in future. - */ - - void parseIntData(const Message *message, const unsigned char *buffer, - unsigned int offset, unsigned int size, - int bigEndian) const; - - void unparseIntData(const Message *message, unsigned char *buffer, - unsigned int offset, unsigned int size, - int bigEndian) const; - - void updateIntData(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, unsigned int offset, - unsigned int size, ChannelCache *channelCache) const; - - void updateIntData(DecodeBuffer &decodeBuffer, const Message *message, - unsigned int offset, unsigned int size, - ChannelCache *channelCache) const; -}; - -#endif /* RenderExtension_H */ diff --git a/nxcomp/RenderFillRectangles.cpp b/nxcomp/RenderFillRectangles.cpp deleted file mode 100644 index a6f2c0e0d..000000000 --- a/nxcomp/RenderFillRectangles.cpp +++ /dev/null @@ -1,233 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderFillRectangles.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - // - // The color structure (4 components, 2 bytes - // each) is included in the data part, so that - // it gets into the checksum. The rectangles - // are in the format x, y, width, height with - // 2 bytes per each field, so each request is - // at least 12 + 8 + 8 = 28 bytes long. - // - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.fill_rectangles.type = *(buffer + 1); - renderExtension -> data.fill_rectangles.op = *(buffer + 4); - - renderExtension -> data.fill_rectangles.dst_id = GetULONG(buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.fill_rectangles.type << " size is " - << renderExtension -> size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.fill_rectangles.type; - *(buffer + 4) = renderExtension -> data.fill_rectangles.op; - - PutULONG(renderExtension -> data.fill_rectangles.dst_id, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.fill_rectangles.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 4); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.fill_rectangles.dst_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.fill_rectangles.dst_id = - renderExtension -> data.fill_rectangles.dst_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.fill_rectangles.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.fill_rectangles.dst_id, - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.fill_rectangles.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderFillRectangles.h b/nxcomp/RenderFillRectangles.h deleted file mode 100644 index 9efaeffa8..000000000 --- a/nxcomp/RenderFillRectangles.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderFillRectangles_H -#define RenderFillRectangles_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderFillRectangles" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderFillRectanglesStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 12 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderFillRectangles_H */ diff --git a/nxcomp/RenderFreeGlyphSet.cpp b/nxcomp/RenderFreeGlyphSet.cpp deleted file mode 100644 index cf1261ac0..000000000 --- a/nxcomp/RenderFreeGlyphSet.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderFreeGlyphSet.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeFreeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> renderFreeGlyphSetCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - unsigned int value; - - ClientCache *clientCache = (ClientCache *) channelCache; - - *(buffer + 1) = type; - - decodeBuffer.decodeFreeXidValue(value, - clientCache -> renderFreeGlyphSetCache); - - PutULONG(value, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.free_set.type = *(buffer + 1); - - renderExtension -> data.free_set.set_id = GetULONG(buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.free_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.free_set.type; - - PutULONG(renderExtension -> data.free_set.set_id, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.free_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeFreeXidValue(renderExtension -> data.free_set.set_id, - clientCache -> renderFreeGlyphSetCache); - - cachedRenderExtension -> data.free_set.set_id = - renderExtension -> data.free_set.set_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.free_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeFreeXidValue(renderExtension -> data.free_set.set_id, - clientCache -> renderFreeGlyphSetCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.free_set.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderFreeGlyphSet.h b/nxcomp/RenderFreeGlyphSet.h deleted file mode 100644 index 8817e8d99..000000000 --- a/nxcomp/RenderFreeGlyphSet.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderFreeGlyphSet_H -#define RenderFreeGlyphSet_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderFreeGlyphSet" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderFreeGlyphSetStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 8 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 0 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 0 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderFreeGlyphSet_H */ diff --git a/nxcomp/RenderFreePicture.cpp b/nxcomp/RenderFreePicture.cpp deleted file mode 100644 index 3d468624a..000000000 --- a/nxcomp/RenderFreePicture.cpp +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderFreePicture.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeFreeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> renderFreePictureCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - unsigned int value; - - ClientCache *clientCache = (ClientCache *) channelCache; - - *(buffer + 1) = type; - - decodeBuffer.decodeFreeXidValue(value, - clientCache -> renderFreePictureCache); - - PutULONG(value, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.free_picture.type = *(buffer + 1); - - renderExtension -> data.free_picture.src_id = GetULONG(buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.free_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.free_picture.type; - - PutULONG(renderExtension -> data.free_picture.src_id, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.free_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeFreeXidValue(renderExtension -> data.free_picture.src_id, - clientCache -> renderFreePictureCache); - - cachedRenderExtension -> data.free_picture.src_id = - renderExtension -> data.free_picture.src_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.free_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeFreeXidValue(renderExtension -> data.free_picture.src_id, - clientCache -> renderFreePictureCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.free_picture.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderFreePicture.h b/nxcomp/RenderFreePicture.h deleted file mode 100644 index b50191a72..000000000 --- a/nxcomp/RenderFreePicture.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderFreePicture_H -#define RenderFreePicture_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderFreePicture" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderFreePictureStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 8 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 0 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 0 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderFreePicture_H */ diff --git a/nxcomp/RenderGenericRequest.cpp b/nxcomp/RenderGenericRequest.cpp deleted file mode 100644 index fc3210ba2..000000000 --- a/nxcomp/RenderGenericRequest.cpp +++ /dev/null @@ -1,266 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "NXrender.h" - -#include "RenderExtension.h" -#include "RenderGenericRequest.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Here are the methods to handle the messages' content. -// - -int RenderGenericRequestStore::encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message.\n" - << logofs_flush; - - unsigned char type = *(buffer + 1); - - #endif - - encodeBuffer.encodeCachedValue(size >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef DEBUG - *logofs << name() << ": Encoding full unhandled message. " - << "Type is " << (unsigned int) type << " size is " - << size << ".\n" << logofs_flush; - #endif - - encodeIntData(encodeBuffer, buffer, 4, size, - bigEndian, clientCache); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message.\n" - << logofs_flush; - #endif - - return 1; -} - -int RenderGenericRequestStore::decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, unsigned char type, int bigEndian, - WriteBuffer *writeBuffer, ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message.\n" - << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - size <<= 2; - - buffer = writeBuffer -> addMessage(size); - - *(buffer + 1) = type; - - #ifdef DEBUG - *logofs << name() << ": Decoding full unhandled message. " - << "Type is " << (unsigned int) type << " size is " - << size << ".\n" << logofs_flush; - #endif - - decodeIntData(decodeBuffer, buffer, 4, size, - bigEndian, clientCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded full message.\n" - << logofs_flush; - #endif - - return 1; -} - -void RenderGenericRequestStore::encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ -} - -void RenderGenericRequestStore::decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ -} - -int RenderGenericRequestStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - #ifdef DEBUG - *logofs << name() << ": Parsing identity for message at " - << this << ".\n" << logofs_flush; - #endif - - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - unsigned char type = *(buffer + 1); - - renderExtension -> data.any.type = type; - - #ifdef DEBUG - *logofs << name() << ": Parsing unhandled identity. " - << "Type is " << (unsigned int) renderExtension -> data.any.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif - - parseIntData(message, buffer, 4, size, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int RenderGenericRequestStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - #ifdef DEBUG - *logofs << name() << ": Unparsing identity for message at " - << this << ".\n" << logofs_flush; - #endif - - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - unsigned char type = renderExtension -> data.any.type; - - *(buffer + 1) = type; - - #ifdef DEBUG - *logofs << name() << ": Unparsing unhandled identity. " - << "Type is " << (unsigned int) renderExtension -> data.any.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif - - unparseIntData(message, buffer, 4, size, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void RenderGenericRequestStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, md5_state_t *md5_state, - int bigEndian) const -{ - // - // Include the minor opcode in the checksum. - // Because the data offset can be beyond the - // real end of the message, we need to include - // the size or we will match any message whose - // size is less or equal to the data offset. - // - - md5_append(md5_state, buffer + 1, 3); -} - -void RenderGenericRequestStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - #ifdef DEBUG - *logofs << name() << ": Updating identity for message at " - << this << ".\n" << logofs_flush; - #endif - - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - #ifdef DEBUG - *logofs << name() << ": Encoding unhandled update. " - << "Type is " << (unsigned int) renderExtension -> data.any.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif - - updateIntData(encodeBuffer, message, cachedMessage, 4, - renderExtension -> size_, channelCache); - - #ifdef DEBUG - *logofs << name() << ": Updated identity for message at " - << this << ".\n" << logofs_flush; - #endif -} - -void RenderGenericRequestStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - #ifdef DEBUG - *logofs << name() << ": Updating identity for message at " - << this << ".\n" << logofs_flush; - #endif - - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - #ifdef DEBUG - *logofs << name() << ": Decoding unhandled update. " - << "Type is " << (unsigned int) renderExtension -> data.any.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif - - updateIntData(decodeBuffer, message, 4, - renderExtension -> size_, channelCache); - - #ifdef DEBUG - *logofs << name() << ": Updated identity for message at " - << this << ".\n" << logofs_flush; - #endif -} diff --git a/nxcomp/RenderGenericRequest.h b/nxcomp/RenderGenericRequest.h deleted file mode 100644 index fdf5ca876..000000000 --- a/nxcomp/RenderGenericRequest.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderGenericRequest_H -#define RenderGenericRequest_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -class RenderGenericRequestStore : public RenderMinorExtensionStore -{ - public: - - virtual const char *name() const - { - return "RenderGenericRequest"; - } - - virtual int identitySize(const unsigned char *buffer, unsigned int size) - { - return RENDEREXTENSION_DATA_OFFSET; - } - - virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, unsigned char type, int bigEndian, - WriteBuffer *writeBuffer, ChannelCache *channelCache) const; - - virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, md5_state_t *md5_state, - int bigEndian) const; -}; - -#endif /* RenderGenericRequest_H */ diff --git a/nxcomp/RenderMinorExtensionHeaders.h b/nxcomp/RenderMinorExtensionHeaders.h deleted file mode 100644 index b7f6efc5a..000000000 --- a/nxcomp/RenderMinorExtensionHeaders.h +++ /dev/null @@ -1,42 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderMinorExtensionHeaders_H -#define RenderMinorExtensionHeaders_H - -#include "NXrender.h" - -#include "Message.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -#include "RenderExtension.h" - -#endif /* RenderMinorExtensionHeaders_H */ diff --git a/nxcomp/RenderMinorExtensionMethods.h b/nxcomp/RenderMinorExtensionMethods.h deleted file mode 100644 index d272337e0..000000000 --- a/nxcomp/RenderMinorExtensionMethods.h +++ /dev/null @@ -1,81 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// This file is included multiple times, -// one for each message inheriting the -// parent class. -// - -public: - -#if MESSAGE_HAS_SIZE - -virtual void encodeSize(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - -virtual void decodeSize(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, unsigned char type, int bigEndian, - WriteBuffer *writeBuffer, ChannelCache *channelCache) const; - -#endif - -#if MESSAGE_HAS_DATA - -virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - -virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, - unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - -#endif - -virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - -virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, unsigned char type, int bigEndian, - WriteBuffer *writeBuffer, ChannelCache *channelCache) const; - -virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - -virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - -virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - -virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - -virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, md5_state_t *md5_state, - int bigEndian) const; diff --git a/nxcomp/RenderMinorExtensionTags.h b/nxcomp/RenderMinorExtensionTags.h deleted file mode 100644 index c24a99638..000000000 --- a/nxcomp/RenderMinorExtensionTags.h +++ /dev/null @@ -1,194 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderMinorExtensionTags_H -#define RenderMinorExtensionTags_H - -// -// Set in the message header file. -// - -#if MESSAGE_HAS_SIZE - -#define MESSAGE_ENCODE_SIZE encodeSize(encodeBuffer, buffer, size, bigEndian, channelCache) -#define MESSAGE_DECODE_SIZE decodeSize(decodeBuffer, buffer, size, type, bigEndian, writeBuffer, channelCache) - -#else - -#define MESSAGE_ENCODE_SIZE -#define MESSAGE_DECODE_SIZE size = MESSAGE_OFFSET; buffer = writeBuffer -> addMessage(size); - -#endif - -#if MESSAGE_HAS_DATA - -#define MESSAGE_ENCODE_DATA encodeData(encodeBuffer, buffer, size, bigEndian, channelCache) -#define MESSAGE_DECODE_DATA decodeData(decodeBuffer, buffer, size, bigEndian, channelCache) - -#else - -#define MESSAGE_ENCODE_DATA -#define MESSAGE_DECODE_DATA - -#endif - -// -// Prologue an epilogue of the message -// handling functions. -// - -#define MESSAGE_BEGIN_ENCODE_SIZE \ -\ -void MESSAGE_STORE::encodeSize(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ - const unsigned int size, int bigEndian, \ - ChannelCache *channelCache) const \ -{ - -#define MESSAGE_END_ENCODE_SIZE \ -\ -} - -#define MESSAGE_BEGIN_DECODE_SIZE \ -\ -void MESSAGE_STORE::decodeSize(DecodeBuffer &decodeBuffer, unsigned char *&buffer, \ - unsigned int &size, unsigned char type, int bigEndian, \ - WriteBuffer *writeBuffer, ChannelCache *channelCache) const \ -{ - -#define MESSAGE_END_DECODE_SIZE \ -\ -} - -#define MESSAGE_BEGIN_ENCODE_MESSAGE \ -\ -int MESSAGE_STORE::encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ - const unsigned int size, int bigEndian, \ - ChannelCache *channelCache) const \ -{ \ - MESSAGE_ENCODE_SIZE; - - -#define MESSAGE_END_ENCODE_MESSAGE \ -\ - MESSAGE_ENCODE_DATA; \ -\ - return 1; \ -} - -#define MESSAGE_BEGIN_DECODE_MESSAGE \ -\ -int MESSAGE_STORE::decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, \ - unsigned int &size, unsigned char type, int bigEndian, \ - WriteBuffer *writeBuffer, ChannelCache *channelCache) const \ -{ \ - MESSAGE_DECODE_SIZE; - - -#define MESSAGE_END_DECODE_MESSAGE \ -\ - MESSAGE_DECODE_DATA; \ -\ - return 1; \ -} - -#define MESSAGE_BEGIN_ENCODE_DATA \ -\ -void MESSAGE_STORE::encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ - unsigned int size, int bigEndian, \ - ChannelCache *channelCache) const \ -{ - -#define MESSAGE_END_ENCODE_DATA \ -\ -} - -#define MESSAGE_BEGIN_DECODE_DATA \ -\ -void MESSAGE_STORE::decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, \ - unsigned int size, int bigEndian, \ - ChannelCache *channelCache) const \ -{ - -#define MESSAGE_END_DECODE_DATA \ -\ -} - -#define MESSAGE_BEGIN_PARSE_IDENTITY \ -\ -int MESSAGE_STORE::parseIdentity(Message *message, const unsigned char *buffer, \ - unsigned int size, int bigEndian) const \ -{ - -#define MESSAGE_END_PARSE_IDENTITY \ -\ - return 1; \ -\ -} - -#define MESSAGE_BEGIN_UNPARSE_IDENTITY \ -\ -int MESSAGE_STORE::unparseIdentity(const Message *message, unsigned char *buffer, \ - unsigned int size, int bigEndian) const \ -{ - -#define MESSAGE_END_UNPARSE_IDENTITY \ -\ - return 1; \ -\ -} - -#define MESSAGE_BEGIN_IDENTITY_CHECKSUM \ -\ -void MESSAGE_STORE::identityChecksum(const Message *message, const unsigned char *buffer, \ - unsigned int size, md5_state_t *md5_state, \ - int bigEndian) const \ -{ - -#define MESSAGE_END_IDENTITY_CHECKSUM \ -\ -} - -#define MESSAGE_BEGIN_ENCODE_UPDATE \ -\ -void MESSAGE_STORE::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, \ - const Message *cachedMessage, \ - ChannelCache *channelCache) const \ -{ - -#define MESSAGE_END_ENCODE_UPDATE \ -\ -} - -#define MESSAGE_BEGIN_DECODE_UPDATE \ -\ -void MESSAGE_STORE::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, \ - ChannelCache *channelCache) const \ -{ - -#define MESSAGE_END_DECODE_UPDATE \ -\ -} - -#endif /* RenderMinorExtensionTags_H */ diff --git a/nxcomp/RenderPictureClip.cpp b/nxcomp/RenderPictureClip.cpp deleted file mode 100644 index 32d526c81..000000000 --- a/nxcomp/RenderPictureClip.cpp +++ /dev/null @@ -1,299 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderPictureClip.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - // - // The data is constituted by a number of - // rectangles. Each rectangle is in the - // format x, y, width, height with 2 bytes - // per each field, so each request is at - // least 12 + 8 = 20 bytes long. - // - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> renderSrcPictureCache); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 8, bigEndian), - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 10, bigEndian), - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeXidValue(value, - clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - PutUINT(clientCache -> renderLastX, buffer + 8, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - PutUINT(clientCache -> renderLastY, buffer + 10, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.picture_clip.type = *(buffer + 1); - - renderExtension -> data.picture_clip.src_id = GetULONG(buffer + 4, bigEndian); - - renderExtension -> data.picture_clip.src_x = GetUINT(buffer + 8, bigEndian); - renderExtension -> data.picture_clip.src_y = GetUINT(buffer + 10, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.picture_clip.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.picture_clip.type; - - PutULONG(renderExtension -> data.picture_clip.src_id, buffer + 4, bigEndian); - - PutUINT(renderExtension -> data.picture_clip.src_x, buffer + 8, bigEndian); - PutUINT(renderExtension -> data.picture_clip.src_y, buffer + 10, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.picture_clip.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - // - // Encode the picture id and the - // source x and y differentially. - // - - md5_append(md5_state, buffer + 1, 3); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.picture_clip.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.picture_clip.src_id = - renderExtension -> data.picture_clip.src_id; - - // - // The source x and y coordinates are - // encoded as differerences in respect - // to the previous cached value. - // - - unsigned int value; - unsigned int previous; - - value = renderExtension -> data.picture_clip.src_x; - previous = cachedRenderExtension -> data.picture_clip.src_x; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - cachedRenderExtension -> data.picture_clip.src_x = value; - - value = renderExtension -> data.picture_clip.src_y; - previous = cachedRenderExtension -> data.picture_clip.src_y; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - cachedRenderExtension -> data.picture_clip.src_y = value; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.picture_clip.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.picture_clip.src_id, - clientCache -> renderSrcPictureCache); - - unsigned int value; - unsigned int previous; - - previous = renderExtension -> data.picture_clip.src_x; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - renderExtension -> data.picture_clip.src_x = value; - - previous = renderExtension -> data.picture_clip.src_y; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - renderExtension -> data.picture_clip.src_y = value; - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.picture_clip.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderPictureClip.h b/nxcomp/RenderPictureClip.h deleted file mode 100644 index bd811dfcd..000000000 --- a/nxcomp/RenderPictureClip.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderPictureClip_H -#define RenderPictureClip_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderPictureClip" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderPictureClipStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 12 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderPictureClip_H */ diff --git a/nxcomp/RenderPictureFilter.cpp b/nxcomp/RenderPictureFilter.cpp deleted file mode 100644 index 9598601c2..000000000 --- a/nxcomp/RenderPictureFilter.cpp +++ /dev/null @@ -1,274 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderPictureFilter.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding value " - << ((size - MESSAGE_OFFSET) >> 2) << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << size - << ".\n" << logofs_flush; - #endif - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> renderSrcPictureCache); - - encodeBuffer.encodeCachedValue(GetUINT(buffer + 8, bigEndian), 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeXidValue(value, - clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 4, bigEndian); - - decodeBuffer.decodeCachedValue(value, 16, - clientCache -> renderLengthCache, 5); - - PutUINT(value, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.picture_filter.type = *(buffer + 1); - - renderExtension -> data.picture_filter.src_id = GetULONG(buffer + 4, bigEndian); - renderExtension -> data.picture_filter.num_elm = GetUINT(buffer + 8, bigEndian); - - // - // Clean the padding bytes. This - // should be the purpose of the - // filter. - // - - #ifdef TEST - *logofs << name() << ": Cleaning " - << RoundUp4(renderExtension -> data.picture_filter.num_elm) - - renderExtension -> data.picture_filter.num_elm << " bytes " - << "at offset " << MESSAGE_OFFSET + renderExtension -> - data.picture_filter.num_elm << " with " << renderExtension -> - data.picture_filter.num_elm << " elements and size " - << renderExtension -> size_ << ".\n" << logofs_flush; - #endif - - if (size >= MESSAGE_OFFSET + renderExtension -> - data.picture_filter.num_elm) - { - unsigned char *next = (unsigned char *) buffer + - MESSAGE_OFFSET + renderExtension -> - data.picture_filter.num_elm; - - while (next < buffer + size) - { - *next++ = '\0'; - } - } - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.picture_filter.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.picture_filter.type; - - PutULONG(renderExtension -> data.picture_filter.src_id, buffer + 4, bigEndian); - PutUINT(renderExtension -> data.picture_filter.num_elm, buffer + 8, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.picture_filter.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - // - // Include the length of the filter name - // in the checksum. - // - - md5_append(md5_state, buffer + 1, 3); - md5_append(md5_state, buffer + 8, 2); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.picture_filter.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.picture_filter.src_id = - renderExtension -> data.picture_filter.src_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.picture_filter.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.picture_filter.src_id, - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.picture_filter.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderPictureFilter.h b/nxcomp/RenderPictureFilter.h deleted file mode 100644 index a3e37538b..000000000 --- a/nxcomp/RenderPictureFilter.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderPictureFilter_H -#define RenderPictureFilter_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderPictureFilter" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderPictureFilterStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 12 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderPictureFilter_H */ diff --git a/nxcomp/RenderPictureTransform.cpp b/nxcomp/RenderPictureTransform.cpp deleted file mode 100644 index 053748bd3..000000000 --- a/nxcomp/RenderPictureTransform.cpp +++ /dev/null @@ -1,210 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderPictureTransform.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - // - // Size is always 44. The identity size - // is set to 8, so we encode the 36 bytes - // of the transformation matrix as our - // data. - // -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - size = MESSAGE_OFFSET + 36; - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeXidValue(value, - clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.picture_transform.type = *(buffer + 1); - - renderExtension -> data.picture_transform.src_id = GetULONG(buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.picture_transform.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.picture_transform.type; - - PutULONG(renderExtension -> data.picture_transform.src_id, buffer + 4, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.picture_transform.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - md5_append(md5_state, buffer + 1, 3); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.picture_transform.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.picture_transform.src_id = - renderExtension -> data.picture_transform.src_id; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.picture_transform.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.picture_transform.src_id, - clientCache -> renderSrcPictureCache); - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.picture_transform.type - << " size is " << renderExtension -> size_ << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderPictureTransform.h b/nxcomp/RenderPictureTransform.h deleted file mode 100644 index 649cd05d3..000000000 --- a/nxcomp/RenderPictureTransform.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderPictureTransform_H -#define RenderPictureTransform_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderPictureTransform" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderPictureTransformStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 8 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return MESSAGE_OFFSET; - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderPictureTransform_H */ diff --git a/nxcomp/RenderTrapezoids.cpp b/nxcomp/RenderTrapezoids.cpp deleted file mode 100644 index 85f4cad05..000000000 --- a/nxcomp/RenderTrapezoids.cpp +++ /dev/null @@ -1,368 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderTrapezoids.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - // - // The trapezoid data is made up of a structure - // containing a top and bottom coordinate in 4 - // bytes format, plus two lines, each represent- - // ed as four points in 4 bytes format. Thus - // each trapezoid is 4 * 2 + (4 * 4) * 2 = 40 - // bytes. Bytes are all padded to an long int, - // so we don't need to clean the message. - // - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding value " - << ((size - MESSAGE_OFFSET) >> 2) << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << size - << ".\n" << logofs_flush; - #endif - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> renderSrcPictureCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), - clientCache -> renderDstPictureCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, - clientCache -> renderFormatCache); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - decodeBuffer.decodeXidValue(value, - clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeXidValue(value, - clientCache -> renderDstPictureCache); - - PutULONG(value, buffer + 12, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderFormatCache); - - PutULONG(value, buffer + 16, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - if (size > MESSAGE_OFFSET) - { - encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - } - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of text data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - if (size > MESSAGE_OFFSET) - { - decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - } - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.trapezoids.type = *(buffer + 1); - renderExtension -> data.trapezoids.op = *(buffer + 4); - - renderExtension -> data.trapezoids.src_id = GetULONG(buffer + 8, bigEndian); - renderExtension -> data.trapezoids.dst_id = GetULONG(buffer + 12, bigEndian); - - renderExtension -> data.trapezoids.format = GetULONG(buffer + 16, bigEndian); - - renderExtension -> data.trapezoids.src_x = GetUINT(buffer + 20, bigEndian); - renderExtension -> data.trapezoids.src_y = GetUINT(buffer + 22, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.trapezoids.type - << " size is " << renderExtension -> size_ << " identity size " - << renderExtension -> i_size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.trapezoids.type; - *(buffer + 4) = renderExtension -> data.trapezoids.op; - - PutULONG(renderExtension -> data.trapezoids.src_id, buffer + 8, bigEndian); - PutULONG(renderExtension -> data.trapezoids.dst_id, buffer + 12, bigEndian); - - PutULONG(renderExtension -> data.trapezoids.format, buffer + 16, bigEndian); - - PutUINT(renderExtension -> data.trapezoids.src_x, buffer + 20, bigEndian); - PutUINT(renderExtension -> data.trapezoids.src_y, buffer + 22, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.trapezoids.type - << " size is " << renderExtension -> size_ << " identity size " - << renderExtension -> i_size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - // - // Include minor opcode, size and the - // operator in the identity. - // - - md5_append(md5_state, buffer + 1, 4); - - // - // Also include the format but not the - // x and y source. - // - - md5_append(md5_state, buffer + 16, 4); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.trapezoids.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.trapezoids.src_id = - renderExtension -> data.trapezoids.src_id; - - encodeBuffer.encodeXidValue(renderExtension -> data.trapezoids.dst_id, - clientCache -> renderDstPictureCache); - - cachedRenderExtension -> data.trapezoids.dst_id = - renderExtension -> data.trapezoids.dst_id; - - // - // The source x and y coordinates are - // encoded as differerences in respect - // to the previous cached value. - // - - unsigned int value; - unsigned int previous; - - value = renderExtension -> data.trapezoids.src_x; - previous = cachedRenderExtension -> data.trapezoids.src_x; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - cachedRenderExtension -> data.trapezoids.src_x = value; - - value = renderExtension -> data.trapezoids.src_y; - previous = cachedRenderExtension -> data.trapezoids.src_y; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - cachedRenderExtension -> data.trapezoids.src_y = value; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.trapezoids.type - << " size is " << renderExtension -> size_ << " source x " - << renderExtension -> data.trapezoids.src_x << " y " - << renderExtension -> data.trapezoids.src_y << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.trapezoids.src_id, - clientCache -> renderSrcPictureCache); - - decodeBuffer.decodeXidValue(renderExtension -> data.trapezoids.dst_id, - clientCache -> renderDstPictureCache); - - unsigned int value; - unsigned int previous; - - previous = renderExtension -> data.trapezoids.src_x; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - renderExtension -> data.trapezoids.src_x = value; - - previous = renderExtension -> data.trapezoids.src_y; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - renderExtension -> data.trapezoids.src_y = value; - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.trapezoids.type - << " size is " << renderExtension -> size_ << " source x " - << renderExtension -> data.trapezoids.src_x << " y " - << renderExtension -> data.trapezoids.src_y << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderTrapezoids.h b/nxcomp/RenderTrapezoids.h deleted file mode 100644 index faf524c76..000000000 --- a/nxcomp/RenderTrapezoids.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderTrapezoids_H -#define RenderTrapezoids_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderTrapezoids" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderTrapezoidsStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 24 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size); - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderTrapezoids_H */ diff --git a/nxcomp/RenderTriangles.cpp b/nxcomp/RenderTriangles.cpp deleted file mode 100644 index 746a8e278..000000000 --- a/nxcomp/RenderTriangles.cpp +++ /dev/null @@ -1,358 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -// -// Include the template for -// this message class. -// - -#include "RenderTriangles.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#include MESSAGE_TAGS - -// -// Message handling methods. -// - -MESSAGE_BEGIN_ENCODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding value " - << ((size - MESSAGE_OFFSET) >> 2) << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, - clientCache -> renderLengthCache, 5); - - #ifdef TEST - *logofs << name() << ": Encoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_SIZE - -MESSAGE_BEGIN_DECODE_SIZE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(size, 16, - clientCache -> renderLengthCache, 5); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << size - << ".\n" << logofs_flush; - #endif - - size = MESSAGE_OFFSET + (size << 2); - - buffer = writeBuffer -> addMessage(size); - - #ifdef TEST - *logofs << name() << ": Decoded size with value " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_SIZE - -MESSAGE_BEGIN_ENCODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), - clientCache -> renderSrcPictureCache); - - encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), - clientCache -> renderDstPictureCache); - - encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, - clientCache -> renderFormatCache); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - #ifdef TEST - *logofs << name() << ": Encoded message. Type is " - << (unsigned int) *(buffer + 1) << " size is " - << size << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_MESSAGE - -MESSAGE_BEGIN_DECODE_MESSAGE -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - *(buffer + 1) = type; - - decodeBuffer.decodeCachedValue(*(buffer + 4), 8, - clientCache -> renderOpCache); - - decodeBuffer.decodeXidValue(value, - clientCache -> renderSrcPictureCache); - - PutULONG(value, buffer + 8, bigEndian); - - decodeBuffer.decodeXidValue(value, - clientCache -> renderDstPictureCache); - - PutULONG(value, buffer + 12, bigEndian); - - decodeBuffer.decodeCachedValue(value, 32, - clientCache -> renderFormatCache); - - PutULONG(value, buffer + 16, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastX, 16, - clientCache -> renderXCache, 11); - - PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); - - decodeBuffer.decodeDiffCachedValue(value, - clientCache -> renderLastY, 16, - clientCache -> renderYCache, 11); - - PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); - - #ifdef TEST - *logofs << name() << ": Decoded message. Type is " - << (unsigned int) type << " size is " << size - << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_MESSAGE - -MESSAGE_BEGIN_ENCODE_DATA -{ - if (size > MESSAGE_OFFSET) - { - encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - } - - #ifdef TEST - *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET - << " bytes of text data.\n" << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_DATA - -MESSAGE_BEGIN_DECODE_DATA -{ - if (size > MESSAGE_OFFSET) - { - decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, - size, bigEndian, channelCache); - } - - #ifdef TEST - *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET - << " bytes of data.\n" << logofs_flush; - #endif -} -MESSAGE_END_DECODE_DATA - -MESSAGE_BEGIN_PARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - renderExtension -> data.triangles.type = *(buffer + 1); - renderExtension -> data.triangles.op = *(buffer + 4); - - renderExtension -> data.triangles.src_id = GetULONG(buffer + 8, bigEndian); - renderExtension -> data.triangles.dst_id = GetULONG(buffer + 12, bigEndian); - - renderExtension -> data.triangles.format = GetULONG(buffer + 16, bigEndian); - - renderExtension -> data.triangles.src_x = GetUINT(buffer + 20, bigEndian); - renderExtension -> data.triangles.src_y = GetUINT(buffer + 22, bigEndian); - - #ifdef TEST - *logofs << name() << ": Parsed identity. Type is " - << (unsigned int) renderExtension -> data.triangles.type - << " size is " << renderExtension -> size_ << " identity size " - << renderExtension -> i_size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_PARSE_IDENTITY - -MESSAGE_BEGIN_UNPARSE_IDENTITY -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - *(buffer + 1) = renderExtension -> data.triangles.type; - *(buffer + 4) = renderExtension -> data.triangles.op; - - PutULONG(renderExtension -> data.triangles.src_id, buffer + 8, bigEndian); - PutULONG(renderExtension -> data.triangles.dst_id, buffer + 12, bigEndian); - - PutULONG(renderExtension -> data.triangles.format, buffer + 16, bigEndian); - - PutUINT(renderExtension -> data.triangles.src_x, buffer + 20, bigEndian); - PutUINT(renderExtension -> data.triangles.src_y, buffer + 22, bigEndian); - - #ifdef TEST - *logofs << name() << ": Unparsed identity. Type is " - << (unsigned int) renderExtension -> data.triangles.type - << " size is " << renderExtension -> size_ << " identity size " - << renderExtension -> i_size_ << ".\n" << logofs_flush; - #endif -} -MESSAGE_END_UNPARSE_IDENTITY - -MESSAGE_BEGIN_IDENTITY_CHECKSUM -{ - // - // Include minor opcode, size and the - // operator in the identity. - // - - md5_append(md5_state, buffer + 1, 4); - - // - // Also include the format but not the - // x and y source. - // - - md5_append(md5_state, buffer + 16, 4); -} -MESSAGE_END_IDENTITY_CHECKSUM - -MESSAGE_BEGIN_ENCODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeXidValue(renderExtension -> data.triangles.src_id, - clientCache -> renderSrcPictureCache); - - cachedRenderExtension -> data.triangles.src_id = - renderExtension -> data.triangles.src_id; - - encodeBuffer.encodeXidValue(renderExtension -> data.triangles.dst_id, - clientCache -> renderDstPictureCache); - - cachedRenderExtension -> data.triangles.dst_id = - renderExtension -> data.triangles.dst_id; - - // - // The source x and y coordinates are - // encoded as differerences in respect - // to the previous cached value. - // - - unsigned int value; - unsigned int previous; - - value = renderExtension -> data.triangles.src_x; - previous = cachedRenderExtension -> data.triangles.src_x; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - cachedRenderExtension -> data.triangles.src_x = value; - - value = renderExtension -> data.triangles.src_y; - previous = cachedRenderExtension -> data.triangles.src_y; - - encodeBuffer.encodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - cachedRenderExtension -> data.triangles.src_y = value; - - #ifdef TEST - *logofs << name() << ": Encoded update. Type is " - << (unsigned int) renderExtension -> data.triangles.type - << " size is " << renderExtension -> size_ << " source x " - << renderExtension -> data.triangles.src_x << " y " - << renderExtension -> data.triangles.src_y << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_ENCODE_UPDATE - -MESSAGE_BEGIN_DECODE_UPDATE -{ - RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeXidValue(renderExtension -> data.triangles.src_id, - clientCache -> renderSrcPictureCache); - - decodeBuffer.decodeXidValue(renderExtension -> data.triangles.dst_id, - clientCache -> renderDstPictureCache); - - unsigned int value; - unsigned int previous; - - previous = renderExtension -> data.triangles.src_x; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderXCache, 11); - - renderExtension -> data.triangles.src_x = value; - - previous = renderExtension -> data.triangles.src_y; - - decodeBuffer.decodeDiffCachedValue(value, previous, 16, - clientCache -> renderYCache, 11); - - renderExtension -> data.triangles.src_y = value; - - #ifdef TEST - *logofs << name() << ": Decoded update. Type is " - << (unsigned int) renderExtension -> data.triangles.type - << " size is " << renderExtension -> size_ << " source x " - << renderExtension -> data.triangles.src_x << " y " - << renderExtension -> data.triangles.src_y << ".\n" - << logofs_flush; - #endif -} -MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/RenderTriangles.h b/nxcomp/RenderTriangles.h deleted file mode 100644 index d73efb7b8..000000000 --- a/nxcomp/RenderTriangles.h +++ /dev/null @@ -1,88 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef RenderTriangles_H -#define RenderTriangles_H - -// -// Define the characteristics -// of this message class here. -// - -#undef MESSAGE_NAME -#define MESSAGE_NAME "RenderTriangles" - -#undef MESSAGE_STORE -#define MESSAGE_STORE RenderTrianglesStore - -#undef MESSAGE_CLASS -#define MESSAGE_CLASS RenderMinorExtensionStore - -#undef MESSAGE_METHODS -#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" - -#undef MESSAGE_HEADERS -#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" - -#undef MESSAGE_TAGS -#define MESSAGE_TAGS "RenderMinorExtensionTags.h" - -#undef MESSAGE_OFFSET -#define MESSAGE_OFFSET 24 - -#undef MESSAGE_HAS_SIZE -#define MESSAGE_HAS_SIZE 1 - -#undef MESSAGE_HAS_DATA -#define MESSAGE_HAS_DATA 1 - -#undef MESSAGE_HAS_FILTER -#define MESSAGE_HAS_FILTER 0 - -// -// Declare the message class. -// - -#include MESSAGE_HEADERS - -class MESSAGE_STORE : public MESSAGE_CLASS -{ - public: - - virtual const char *name() const - { - return MESSAGE_NAME; - } - - virtual int identitySize(const unsigned char *buffer, - unsigned int size) - { - return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size); - } - - #include MESSAGE_METHODS -}; - -#endif /* RenderTriangles_H */ diff --git a/nxcomp/Rgb.cpp b/nxcomp/Rgb.cpp deleted file mode 100644 index 8946a9fc8..000000000 --- a/nxcomp/Rgb.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Rgb.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -int UnpackRgb(T_geometry *geometry, unsigned char method, unsigned char *src_data, - int src_size, int dst_bpp, int dst_width, int dst_height, - unsigned char *dst_data, int dst_size) -{ - if (*src_data == 0) - { - if (dst_size != src_size - 1) - { - #ifdef TEST - *logofs << "UnpackRgb: PANIC! Invalid destination size " - << dst_size << " with source " << src_size - << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "UnpackRgb: Expanding " << src_size - 1 - << " bytes of plain RGB data.\n" << logofs_flush; - #endif - - memcpy(dst_data, src_data + 1, src_size - 1); - - return 1; - } - - unsigned int check_size = dst_size; - - int result = ZDecompress(&unpackStream, dst_data, &check_size, - src_data + 1, src_size - 1); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "UnpackRgb: PANIC! Failure decompressing RGB data. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decompressing RGB data. " - << "Error is '" << zError(result) << "'.\n"; - - return -1; - } - else if (check_size != (unsigned int) dst_size) - { - #ifdef PANIC - *logofs << "UnpackRgb: PANIC! Size mismatch in RGB data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Size mismatch in RGB data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n"; - - return -1; - } - - #ifdef TEST - *logofs << "UnpackRgb: Decompressed " << src_size - 1 - << " bytes to " << dst_size << " bytes of RGB data.\n" - << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/Rgb.h b/nxcomp/Rgb.h deleted file mode 100644 index ec088dd1b..000000000 --- a/nxcomp/Rgb.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Rgb_H -#define Rgb_H - -#include "Unpack.h" - -int UnpackRgb(T_geometry *geometry, unsigned char method, - unsigned char *src_data, int src_size, int dst_bpp, - int dst_width, int dst_height, unsigned char *dst_data, - int dst_size); - -#endif /* Rgb_H */ diff --git a/nxcomp/Rle.cpp b/nxcomp/Rle.cpp deleted file mode 100644 index 92fc7785a..000000000 --- a/nxcomp/Rle.cpp +++ /dev/null @@ -1,102 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Rle.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -int UnpackRle(T_geometry *geometry, unsigned char method, unsigned char *src_data, - int src_size, int dst_bpp, int dst_width, int dst_height, - unsigned char *dst_data, int dst_size) -{ - if (*src_data == 0) - { - if (dst_size != src_size - 1) - { - #ifdef TEST - *logofs << "UnpackRle: PANIC! Invalid destination size " - << dst_size << " with source " << src_size - << ".\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "UnpackRle: Expanding " << src_size - 1 - << " bytes of plain RLE data.\n" << logofs_flush; - #endif - - memcpy(dst_data, src_data + 1, src_size - 1); - - return 1; - } - - unsigned int check_size = dst_size; - - int result = ZDecompress(&unpackStream, dst_data, &check_size, - src_data + 1, src_size - 1); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "UnpackRle: PANIC! Failure decompressing RLE data. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decompressing RLE data. " - << "Error is '" << zError(result) << "'.\n"; - - return -1; - } - else if (check_size != (unsigned int) dst_size) - { - #ifdef PANIC - *logofs << "UnpackRle: PANIC! Size mismatch in RLE data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Size mismatch in RLE data. " - << "Resulting size is " << check_size << " with " - << "expected size " << dst_size << ".\n"; - - return -1; - } - - #ifdef TEST - *logofs << "UnpackRle: Decompressed " << src_size - 1 - << " bytes to " << dst_size << " bytes of RLE data.\n" - << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/Rle.h b/nxcomp/Rle.h deleted file mode 100644 index cc5dab0e8..000000000 --- a/nxcomp/Rle.h +++ /dev/null @@ -1,36 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Rle_H -#define Rle_H - -#include "Unpack.h" - -int UnpackRle(T_geometry *geometry, unsigned char method, - unsigned char *src_data, int src_size, int dst_bpp, - int dst_width, int dst_height, unsigned char *dst_data, - int dst_size); - -#endif /* Rle_H */ diff --git a/nxcomp/SendEvent.cpp b/nxcomp/SendEvent.cpp deleted file mode 100644 index 8658c1835..000000000 --- a/nxcomp/SendEvent.cpp +++ /dev/null @@ -1,300 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "SendEvent.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "IntCache.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int SendEventStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SendEventMessage *sendEvent = (SendEventMessage *) message; - - // - // Here is the fingerprint. - // - - sendEvent -> propagate = *(buffer + 1); - - sendEvent -> window = GetULONG(buffer + 4, bigEndian); - sendEvent -> mask = GetULONG(buffer + 8, bigEndian); - - sendEvent -> code = *(buffer + 12); - sendEvent -> byte_data = *(buffer + 13); - - sendEvent -> sequence = GetUINT(buffer + 14, bigEndian); - - sendEvent -> int_data = GetULONG(buffer + 16, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int SendEventStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SendEventMessage *sendEvent = (SendEventMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = sendEvent -> propagate; - - PutULONG(sendEvent -> window, buffer + 4, bigEndian); - PutULONG(sendEvent -> mask, buffer + 8, bigEndian); - - *(buffer + 12) = sendEvent -> code; - *(buffer + 13) = sendEvent -> byte_data; - - PutUINT(sendEvent -> sequence, buffer + 14, bigEndian); - - PutULONG(sendEvent -> int_data, buffer + 16, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void SendEventStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - SendEventMessage *sendEvent = (SendEventMessage *) message; - - *logofs << name() << ": Identity propagate " << (unsigned int) sendEvent -> propagate - << ", window " << sendEvent -> window << ", mask " << sendEvent -> mask - << ", code " << (unsigned int) sendEvent -> code << ", byte_data " - << (unsigned int) sendEvent -> byte_data << ", sequence " - << sendEvent -> sequence << ", int_data " << sendEvent -> int_data - << ", size " << sendEvent -> size_ << ".\n" << logofs_flush; - - #endif -} - -void SendEventStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ -} - -void SendEventStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - SendEventMessage *sendEvent = (SendEventMessage *) message; - SendEventMessage *cachedSendEvent = (SendEventMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << (unsigned int) sendEvent -> propagate - << " as propagate field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeBoolValue(sendEvent -> propagate); - - cachedSendEvent -> propagate = sendEvent -> propagate; - - #ifdef TEST - *logofs << name() << ": Encoding value " << sendEvent -> window - << " as window field.\n" << logofs_flush; - #endif - - if (sendEvent -> window == 0 || sendEvent -> window == 1) - { - encodeBuffer.encodeBoolValue(1); - - encodeBuffer.encodeBoolValue(sendEvent -> window); - } - else - { - encodeBuffer.encodeBoolValue(0); - - encodeBuffer.encodeXidValue(sendEvent -> window, clientCache -> windowCache); - } - - cachedSendEvent -> window = sendEvent -> window; - - #ifdef TEST - *logofs << name() << ": Encoding value " << sendEvent -> mask - << " as mask field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sendEvent -> mask, 32, - clientCache -> sendEventMaskCache); - - cachedSendEvent -> mask = sendEvent -> mask; - - #ifdef TEST - *logofs << name() << ": Encoding value " << sendEvent -> code - << " as code field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sendEvent -> code, 8, - clientCache -> sendEventCodeCache); - - cachedSendEvent -> code = sendEvent -> code; - - #ifdef TEST - *logofs << name() << ": Encoding value " << sendEvent -> byte_data - << " as byte_data field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sendEvent -> byte_data, 8, - clientCache -> sendEventByteDataCache); - - cachedSendEvent -> byte_data = sendEvent -> byte_data; - - #ifdef TEST - *logofs << name() << ": Encoding value " << sendEvent -> sequence - << " as sequence field.\n" << logofs_flush; - #endif - - unsigned int diffSeq = sendEvent -> sequence - - clientCache -> sendEventLastSequence; - - clientCache -> sendEventLastSequence = sendEvent -> sequence; - - encodeBuffer.encodeValue(diffSeq, 16, 4); - - cachedSendEvent -> sequence = sendEvent -> sequence; - - #ifdef TEST - *logofs << name() << ": Encoding value " << sendEvent -> int_data - << " as int_data field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sendEvent -> int_data, 32, - clientCache -> sendEventIntDataCache); - - cachedSendEvent -> int_data = sendEvent -> int_data; -} - -void SendEventStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - SendEventMessage *sendEvent = (SendEventMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeBoolValue(value); - - sendEvent -> propagate = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << (unsigned int) sendEvent -> propagate - << " as propagate field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeBoolValue(value); - - if (value) - { - decodeBuffer.decodeBoolValue(value); - } - else - { - decodeBuffer.decodeXidValue(value, clientCache -> windowCache); - } - - sendEvent -> window = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << sendEvent -> window - << " as window field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(sendEvent -> mask, 32, - clientCache -> sendEventMaskCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << sendEvent -> mask - << " as mask field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(sendEvent -> code, 8, - clientCache -> sendEventCodeCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << sendEvent -> code - << " as code field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(sendEvent -> byte_data, 8, - clientCache -> sendEventByteDataCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << sendEvent -> byte_data - << " as byte_data field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeValue(value, 16, 4); - - clientCache -> sendEventLastSequence += value; - clientCache -> sendEventLastSequence &= 0xffff; - - sendEvent -> sequence = clientCache -> sendEventLastSequence; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << sendEvent -> sequence - << " as sequence field.\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(sendEvent -> int_data, 32, - clientCache -> sendEventIntDataCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << sendEvent -> int_data - << " as int_data field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/SendEvent.h b/nxcomp/SendEvent.h deleted file mode 100644 index a8841a706..000000000 --- a/nxcomp/SendEvent.h +++ /dev/null @@ -1,195 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef SendEvent_H -#define SendEvent_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define SENDEVENT_ENABLE_CACHE 1 -#define SENDEVENT_ENABLE_DATA 0 -#define SENDEVENT_ENABLE_SPLIT 0 -#define SENDEVENT_ENABLE_COMPRESS 0 - -#define SENDEVENT_DATA_LIMIT 24 -#define SENDEVENT_DATA_OFFSET 20 - -#define SENDEVENT_CACHE_SLOTS 2000 -#define SENDEVENT_CACHE_THRESHOLD 2 -#define SENDEVENT_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class SendEventMessage : public Message -{ - friend class SendEventStore; - - public: - - SendEventMessage() - { - } - - ~SendEventMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char propagate; - unsigned int window; - unsigned int mask; - - // - // These are part of the event data. - // - - unsigned char code; - unsigned char byte_data; - unsigned short sequence; - unsigned int int_data; -}; - -class SendEventStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - SendEventStore() : MessageStore() - { - enableCache = SENDEVENT_ENABLE_CACHE; - enableData = SENDEVENT_ENABLE_DATA; - enableSplit = SENDEVENT_ENABLE_SPLIT; - enableCompress = SENDEVENT_ENABLE_COMPRESS; - - dataLimit = SENDEVENT_DATA_LIMIT; - dataOffset = SENDEVENT_DATA_OFFSET; - - cacheSlots = SENDEVENT_CACHE_SLOTS; - cacheThreshold = SENDEVENT_CACHE_THRESHOLD; - cacheLowerThreshold = SENDEVENT_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~SendEventStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "SendEvent"; - } - - virtual unsigned char opcode() const - { - return X_SendEvent; - } - - virtual unsigned int storage() const - { - return sizeof(SendEventMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new SendEventMessage(); - } - - virtual Message *create(const Message &message) const - { - return new SendEventMessage((const SendEventMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (SendEventMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* SendEvent_H */ diff --git a/nxcomp/SequenceQueue.cpp b/nxcomp/SequenceQueue.cpp deleted file mode 100644 index 3114bfcd0..000000000 --- a/nxcomp/SequenceQueue.cpp +++ /dev/null @@ -1,170 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "SequenceQueue.h" - -static const unsigned int INITIAL_SIZE_ = 16; -static const unsigned int GROWTH_INCREMENT = 16; - -SequenceQueue::SequenceQueue() - - : queue_(new RequestSequence[INITIAL_SIZE_]), size_(INITIAL_SIZE_), - length_(0), start_(0), end_(0) -{ -} - -SequenceQueue::~SequenceQueue() -{ - delete [] queue_; -} - -void SequenceQueue::push(unsigned short int sequence, unsigned char opcode, - unsigned int data1, unsigned int data2, - unsigned int data3) -{ - if (length_ == 0) - { - start_ = end_ = 0; - - queue_[0].opcode = opcode; - queue_[0].sequence = sequence; - - queue_[0].data1 = data1; - queue_[0].data2 = data2; - queue_[0].data3 = data3; - - length_ = 1; - - return; - } - - if (length_ == size_) - { - size_ += GROWTH_INCREMENT; - - RequestSequence *newQueue = new RequestSequence[size_]; - - for (int i = start_; (unsigned int) i < length_; i++) - { - newQueue[i - start_] = queue_[i]; - } - - for (int i1 = 0; (unsigned int) i1 < start_; i1++) - { - newQueue[i1 + length_ - start_] = queue_[i1]; - } - - delete [] queue_; - - queue_ = newQueue; - - start_ = 0; - - end_ = length_ - 1; - } - - end_++; - - if (end_ == size_) - { - end_ = 0; - } - - queue_[end_].opcode = opcode; - queue_[end_].sequence = sequence; - - queue_[end_].data1 = data1; - queue_[end_].data2 = data2; - queue_[end_].data3 = data3; - - length_++; -} - -int SequenceQueue::peek(unsigned short int &sequence, - unsigned char &opcode) -{ - if (length_ == 0) - { - return 0; - } - else - { - opcode = queue_[start_].opcode; - sequence = queue_[start_].sequence; - - return 1; - } -} - -int SequenceQueue::peek(unsigned short int &sequence, unsigned char &opcode, - unsigned int &data1, unsigned int &data2, - unsigned int &data3) -{ - if (length_ == 0) - { - return 0; - } - else - { - opcode = queue_[start_].opcode; - sequence = queue_[start_].sequence; - - data1 = queue_[start_].data1; - data2 = queue_[start_].data2; - data3 = queue_[start_].data3; - - return 1; - } -} - -int SequenceQueue::pop(unsigned short int &sequence, unsigned char &opcode, - unsigned int &data1, unsigned int &data2, - unsigned int &data3) -{ - if (length_ == 0) - { - return 0; - } - else - { - opcode = queue_[start_].opcode; - sequence = queue_[start_].sequence; - - data1 = queue_[start_].data1; - data2 = queue_[start_].data2; - data3 = queue_[start_].data3; - - start_++; - - if (start_ == size_) - { - start_ = 0; - } - - length_--; - - return 1; - } -} diff --git a/nxcomp/SequenceQueue.h b/nxcomp/SequenceQueue.h deleted file mode 100644 index 2a72bc3fe..000000000 --- a/nxcomp/SequenceQueue.h +++ /dev/null @@ -1,91 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef SequenceQueue_H -#define SequenceQueue_H - -// -// List of outstanding request messages which -// are waiting for a reply. This class is used -// in X client and server channels to correlate -// the replies sequence numbers to the original -// request type. -// - -class SequenceQueue -{ - public: - - SequenceQueue(); - - virtual ~SequenceQueue(); - - void push(unsigned short int sequence, unsigned char opcode, - unsigned int data1 = 0, unsigned int data2 = 0, - unsigned int data3 = 0); - - int peek(unsigned short int &sequence, unsigned char &opcode); - - int peek(unsigned short int &sequence, unsigned char &opcode, - unsigned int &data1, unsigned int &data2, - unsigned int &data3); - - int pop(unsigned short int &sequence, unsigned char &opcode, - unsigned int &data1, unsigned int &data2, - unsigned int &data3); - - int pop(unsigned short int &sequence, unsigned char &opcode) - { - unsigned int data1, data2, data3; - - return pop(sequence, opcode, data1, data2, data3); - } - - int length() - { - return length_; - } - - private: - - struct RequestSequence - { - unsigned short int sequence; - unsigned char opcode; - unsigned int data1; - unsigned int data2; - unsigned int data3; - }; - - RequestSequence *queue_; - - unsigned int size_; - unsigned int length_; - - unsigned int start_; - unsigned int end_; -}; - -#endif /* SequenceQueue_H */ diff --git a/nxcomp/ServerCache.cpp b/nxcomp/ServerCache.cpp deleted file mode 100644 index 00693d2af..000000000 --- a/nxcomp/ServerCache.cpp +++ /dev/null @@ -1,191 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ServerCache.h" - -// -// Some global caches used to store information -// common to all X connections. -// - -BlockCache ServerCache::lastInitReply; -BlockCache ServerCache::lastKeymap; -unsigned char ServerCache::getKeyboardMappingLastKeysymsPerKeycode = 0; -BlockCache ServerCache::getKeyboardMappingLastMap; -BlockCache ServerCache::getModifierMappingLastMap; -BlockCache ServerCache::xResources; -BlockCacheSet ServerCache::queryFontFontCache(16); - -ServerCache::ServerCache() : - - replySequenceCache(6), eventSequenceCache(6), - lastTimestamp(0), visualCache(8), colormapCache(8), - - errorMinorCache(8), - - colormapNotifyWindowCache(8), colormapNotifyColormapCache(8), - - createNotifyWindowCache(8), createNotifyLastWindow(0), - - exposeWindowCache(12), - - focusInWindowCache(8), - - keyPressLastKey(0), - - mapNotifyEventCache(8), mapNotifyWindowCache(8), - - motionNotifyTimestampCache(8), motionNotifyLastRootX(0), - motionNotifyLastRootY(0), motionNotifyRootXCache(8), - motionNotifyRootYCache(8), motionNotifyEventXCache(8), - motionNotifyEventYCache(8), motionNotifyStateCache(8), - - noExposeDrawableCache(8), noExposeMinorCache(8), - - propertyNotifyWindowCache(8), propertyNotifyAtomCache(8), - - reparentNotifyWindowCache(8), - - selectionClearWindowCache(8), selectionClearAtomCache(8), - - visibilityNotifyWindowCache(8), - - getGeometryRootCache(8), - - getInputFocusWindowCache(8), - - getKeyboardMappingKeysymCache(8), - - getPropertyTypeCache(8), - - getSelectionOwnerCache(8), - - getWindowAttributesClassCache(8), getWindowAttributesPlanesCache(8), - getWindowAttributesPixelCache(8), getWindowAttributesAllEventsCache(8), - getWindowAttributesYourEventsCache(8), - getWindowAttributesDontPropagateCache(8), - - queryPointerRootCache(8), queryPointerChildCache(8), - - translateCoordsChildCache(8), translateCoordsXCache(8), - translateCoordsYCache(8), - - queryTreeWindowCache(8) - -{ - unsigned int i; - - for (i = 0; i < 3; i++) - { - configureNotifyWindowCache[i] = new IntCache(8); - } - - for (i = 0; i < 5; i++) - { - configureNotifyGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 5; i++) - { - exposeGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 3; i++) - { - motionNotifyWindowCache[i] = new IntCache(8); - } - - for (i = 0; i < 5; i++) - { - getGeometryGeomCache[i] = new IntCache(8); - } - - for (i = 0; i < 23; i++) - { - keyPressCache[i] = 0; - } - - for (i = 0; i < 6; i++) - { - queryFontCharInfoCache[i] = new IntCache(8); - queryFontLastCharInfo[i] = 0; - } - - for (i = 0; i < 12; i++) - { - genericReplyIntCache[i] = new IntCache(8); - } - - for (i = 0; i < 14; i++) - { - genericEventIntCache[i] = new IntCache(8); - } -} - - -ServerCache::~ServerCache() -{ - unsigned int i; - - for (i = 0; i < 3; i++) - { - delete configureNotifyWindowCache[i]; - } - - for (i = 0; i < 5; i++) - { - delete configureNotifyGeomCache[i]; - } - - for (i = 0; i < 5; i++) - { - delete exposeGeomCache[i]; - } - - for (i = 0; i < 3; i++) - { - delete motionNotifyWindowCache[i]; - } - - for (i = 0; i < 5; i++) - { - delete getGeometryGeomCache[i]; - } - - for (i = 0; i < 6; i++) - { - delete queryFontCharInfoCache[i]; - } - - for (i = 0; i < 12; i++) - { - delete genericReplyIntCache[i]; - } - - for (i = 0; i < 14; i++) - { - delete genericEventIntCache[i]; - } -} diff --git a/nxcomp/ServerCache.h b/nxcomp/ServerCache.h deleted file mode 100644 index c6e2b81b6..000000000 --- a/nxcomp/ServerCache.h +++ /dev/null @@ -1,303 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ServerCache_H -#define ServerCache_H - -#include "Misc.h" - -#include "IntCache.h" -#include "CharCache.h" -#include "OpcodeCache.h" -#include "BlockCache.h" -#include "BlockCacheSet.h" - -#include "ChannelCache.h" - -class ServerCache : public ChannelCache -{ - public: - - ServerCache(); - - ~ServerCache(); - - // - // Opcode prediction caches. - // - - OpcodeCache opcodeCache; - - // - // General-purpose caches. - // - - IntCache replySequenceCache; - IntCache eventSequenceCache; - unsigned int lastTimestamp; - CharCache depthCache; - IntCache visualCache; - IntCache colormapCache; - CharCache resourceCache; - - // - // X connection startup. - // - - static BlockCache lastInitReply; - - // - // X errors. - // - - CharCache errorCodeCache; - IntCache errorMinorCache; - CharCache errorMajorCache; - - // - // ButtonPress and ButtonRelease events. - // - - CharCache buttonCache; - - // - // ColormapNotify event. - // - - IntCache colormapNotifyWindowCache; - IntCache colormapNotifyColormapCache; - - // - // ConfigureNotify event. - // - - IntCache *configureNotifyWindowCache[3]; - IntCache *configureNotifyGeomCache[5]; - - // - // CreateNotify event. - // - - IntCache createNotifyWindowCache; - unsigned int createNotifyLastWindow; - - // - // Expose event. - // - - IntCache exposeWindowCache; - IntCache *exposeGeomCache[5]; - - // - // FocusIn event (also used for FocusOut). - // - - IntCache focusInWindowCache; - - // - // KeymapNotify event. - // - - static BlockCache lastKeymap; - - // - // KeyPress event. - // - - unsigned char keyPressLastKey; - unsigned char keyPressCache[23]; - - // - // MapNotify event (also used for UnmapNotify). - // - - IntCache mapNotifyEventCache; - IntCache mapNotifyWindowCache; - - // - // MotionNotify event (also used for KeyPress, - // KeyRelease, ButtonPress, ButtonRelease, - // EnterNotify, and LeaveNotify events and - // QueryPointer reply). - // - - IntCache motionNotifyTimestampCache; - unsigned int motionNotifyLastRootX; - unsigned int motionNotifyLastRootY; - IntCache motionNotifyRootXCache; - IntCache motionNotifyRootYCache; - IntCache motionNotifyEventXCache; - IntCache motionNotifyEventYCache; - IntCache motionNotifyStateCache; - IntCache *motionNotifyWindowCache[3]; - - // - // NoExpose event. - // - - IntCache noExposeDrawableCache; - IntCache noExposeMinorCache; - CharCache noExposeMajorCache; - - // - // PropertyNotify event. - // - - IntCache propertyNotifyWindowCache; - IntCache propertyNotifyAtomCache; - - // - // ReparentNotify event. - // - - IntCache reparentNotifyWindowCache; - - // - // SelectionClear event. - // - - IntCache selectionClearWindowCache; - IntCache selectionClearAtomCache; - - // - // VisibilityNotify event. - // - - IntCache visibilityNotifyWindowCache; - - // - // GetGeometry reply. - // - - IntCache getGeometryRootCache; - IntCache *getGeometryGeomCache[5]; - - // - // GetInputFocus reply. - // - - IntCache getInputFocusWindowCache; - - // - // GetKeyboardMapping reply. - // - - static unsigned char getKeyboardMappingLastKeysymsPerKeycode; - static BlockCache getKeyboardMappingLastMap; - IntCache getKeyboardMappingKeysymCache; - CharCache getKeyboardMappingLastByteCache; - - // - // GetModifierMapping reply. - // - - static BlockCache getModifierMappingLastMap; - - // - // GetProperty reply. - // - - CharCache getPropertyFormatCache; - IntCache getPropertyTypeCache; - static BlockCache xResources; - - // - // GetSelection reply. - // - - IntCache getSelectionOwnerCache; - - // - // GetWindowAttributes reply. - // - - IntCache getWindowAttributesClassCache; - CharCache getWindowAttributesBitGravityCache; - CharCache getWindowAttributesWinGravityCache; - IntCache getWindowAttributesPlanesCache; - IntCache getWindowAttributesPixelCache; - IntCache getWindowAttributesAllEventsCache; - IntCache getWindowAttributesYourEventsCache; - IntCache getWindowAttributesDontPropagateCache; - - // - // QueryColors reply. - // - - BlockCache queryColorsLastReply; - - // - // QueryFont reply. - // - - static BlockCacheSet queryFontFontCache; - IntCache *queryFontCharInfoCache[6]; - unsigned int queryFontLastCharInfo[6]; - - // - // QueryPointer reply. - // - - IntCache queryPointerRootCache; - IntCache queryPointerChildCache; - - // - // TranslateCoords reply. - // - - IntCache translateCoordsChildCache; - IntCache translateCoordsXCache; - IntCache translateCoordsYCache; - - // - // QueryTree reply. - // - - IntCache queryTreeWindowCache; - - // - // Generic reply. Use short data - // in protocol versions >= 3. - // - - CharCache genericReplyCharCache; - IntCache *genericReplyIntCache[12]; - - // - // Generic event. Only in protocol - // versions >= 3. - // - - CharCache genericEventCharCache; - IntCache *genericEventIntCache[14]; - - // - // Used in the abort split events. - // - - OpcodeCache abortOpcodeCache; -}; - -#endif /* ServerCache_H */ diff --git a/nxcomp/ServerChannel.cpp b/nxcomp/ServerChannel.cpp deleted file mode 100644 index eff24e90e..000000000 --- a/nxcomp/ServerChannel.cpp +++ /dev/null @@ -1,7942 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#ifndef ANDROID -#include -#endif - -#include -#include - -#include "NXproto.h" -#include "NXalert.h" -#include "NXpack.h" -#include "NXmitshm.h" - -#include "ServerChannel.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "StaticCompressor.h" - -#include "Statistics.h" -#include "Proxy.h" - -#include "Auth.h" -#include "Unpack.h" - -// -// Available unpack methods. -// - -#include "Alpha.h" -#include "Colormap.h" -#include "Bitmap.h" -#include "Jpeg.h" -#include "Pgn.h" -#include "Rgb.h" -#include "Rle.h" - -extern Proxy *proxy; - -// -// Set the verbosity level. You also -// need to define OPCODES in Misc.cpp -// if you want literals instead of -// opcodes' numbers. -// - -#define PANIC -#define WARNING -#undef OPCODES -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Log the important tracepoints related -// to writing packets to the peer proxy. -// - -#undef FLUSH - -// -// Log the operations related to splits. -// - -#undef SPLIT - -// -// Define this to log when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// Define this to exit and suspend the -// session after a given number of X -// messages decoded by the proxy. -// - -#undef SUSPEND - -// -// Define these to hide the server extensions. -// - -#define HIDE_MIT_SHM_EXTENSION -#define HIDE_BIG_REQUESTS_EXTENSION -#define HIDE_XFree86_Bigfont_EXTENSION -#undef HIDE_SHAPE_EXTENSION -#undef HIDE_XKEYBOARD_EXTENSION - -// -// Known reasons of connection failures. -// - -#define INVALID_COOKIE_DATA "Invalid MIT-MAGIC-COOKIE-1 key" -#define INVALID_COOKIE_SIZE ((int) sizeof(INVALID_COOKIE_DATA) - 1) - -#define NO_AUTH_PROTO_DATA "No protocol specified" -#define NO_AUTH_PROTO_SIZE ((int) sizeof(NO_AUTH_PROTO_DATA) - 1) - -// -// Here are the static members. -// - -#ifdef REFERENCES - -int ServerChannel::references_ = 0; - -#endif - -ServerChannel::ServerChannel(Transport *transport, StaticCompressor *compressor) - - : Channel(transport, compressor), readBuffer_(transport_, this) -{ - // - // Sequence number of the next message - // being encoded or decoded. - // - - clientSequence_ = 0; - serverSequence_ = 0; - - // - // Save the last motion event and flush - // it only when the timeout expires. - // - - lastMotion_[0] = '\0'; - - // - // Clear the queue of sequence numbers - // of split commits. Used to mask the - // errors. - // - - initCommitQueue(); - - // - // Do we enable or not sending of expose - // events to the X client. - // - - enableExpose_ = 1; - enableGraphicsExpose_ = 1; - enableNoExpose_ = 1; - - // - // Track data of image currently being - // decompressed. - // - - imageState_ = NULL; - - // - // Track MIT-SHM resources. - // - - shmemState_ = NULL; - - // - // Store the unpack state for each agent - // resource. - // - - for (int i = 0; i < CONNECTIONS_LIMIT; i++) - { - unpackState_[i] = NULL; - } - - // - // Data about the split parameters requested - // by the encoding side. - // - - splitState_.resource = nothing; - splitState_.current = 0; - splitState_.save = 1; - splitState_.load = 1; - splitState_.commit = 0; - - // - // It will be eventually set by - // the server proxy. - // - - fontPort_ = -1; - - #ifdef REFERENCES - *logofs << "ServerChannel: Created new object at " - << this << " for FD#" << fd_ << " out of " - << ++references_ << " allocated channels.\n" - << logofs_flush; - #endif -} - -ServerChannel::~ServerChannel() -{ - #ifdef TEST - *logofs << "ServerChannel: Freeing image state information.\n" - << logofs_flush; - #endif - - handleImageStateRemove(); - - #ifdef TEST - *logofs << "ServerChannel: Freeing shared memory information.\n" - << logofs_flush; - #endif - - handleShmemStateRemove(); - - #ifdef TEST - *logofs << "ServerChannel: Freeing unpack state information.\n" - << logofs_flush; - #endif - - for (int i = 0; i < CONNECTIONS_LIMIT; i++) - { - handleUnpackStateRemove(i); - } - - #ifdef TEST - *logofs << "ServerChannel: Freeing channel caches.\n" - << logofs_flush; - #endif - - #ifdef REFERENCES - *logofs << "ServerChannel: Deleted object at " - << this << " for FD#" << fd_ << " out of " - << --references_ << " allocated channels.\n" - << logofs_flush; - #endif -} - -// -// Beginning of handleRead(). -// - -int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length) -{ - #ifdef DEBUG - *logofs << "handleRead: Called for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - // - // Pointer to located message and - // its size in bytes. - // - - const unsigned char *inputMessage; - unsigned int inputLength; - - // - // Set when message is found in - // cache. - // - - int hit; - - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: Trying to read from FD#" - << fd_ << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - int result = readBuffer_.readMessage(); - - #if defined(DEBUG) || defined(INFO) - *logofs << "handleRead: Read result on FD#" << fd_ - << " is " << result << ".\n" - << logofs_flush; - #endif - - if (result < 0) - { - // - // Let the proxy close the channel. - // - - return -1; - } - else if (result == 0) - { - #if defined(TEST) || defined(INFO) - - // - // This can happen because we have the descriptor - // selected in the read set but we already read - // the data asynchronously, while decoding data - // read from the proxy. - // - - *logofs << "handleRead: WARNING! No data read from FD#" - << fd_ << " while encoding messages.\n" - << logofs_flush; - - #endif - - return 0; - } - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "handleRead: Encoding messages for FD#" << fd_ - << " with " << readBuffer_.getLength() << " bytes " - << "in the buffer.\n" << logofs_flush; - #endif - - // - // Extract any complete message which - // is available in the buffer. - // - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) - { - hit = 0; - - if (firstReply_) - { - // - // Handle the X server's authorization reply. - // - - if (handleAuthorization(inputMessage, inputLength) < 0) - { - return -1; - } - - imageByteOrder_ = inputMessage[30]; - bitmapBitOrder_ = inputMessage[31]; - scanlineUnit_ = inputMessage[32]; - scanlinePad_ = inputMessage[33]; - - encodeBuffer.encodeValue((unsigned int) inputMessage[0], 8); - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 8); - encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_), 16); - encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16); - encodeBuffer.encodeValue(GetUINT(inputMessage + 6, bigEndian_), 16); - - if (ServerCache::lastInitReply.compare(inputLength - 8, inputMessage + 8)) - { - encodeBuffer.encodeBoolValue(1); - } - else - { - encodeBuffer.encodeBoolValue(0); - - for (unsigned int i = 8; i < inputLength; i++) - { - encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8); - } - } - - firstReply_ = 0; - - #if defined(TEST) || defined(OPCODES) - - int bits = encodeBuffer.diffBits(); - - *logofs << "handleRead: Handled first reply. " << inputLength - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - - #endif - - priority_++; - - } - else - { - // - // NX client needs this line to consider - // the initialization phase successfully - // completed. - // - - if (firstClient_ == -1) - { - cerr << "Info" << ": Established X server connection.\n" ; - - firstClient_ = fd_; - } - - // - // Check if this is a reply. - // - - if (*inputMessage == X_Reply) - { - int bits = 0; - - unsigned char inputOpcode = *inputMessage; - - unsigned short int requestSequenceNum; - unsigned char requestOpcode; - unsigned int requestData[3]; - - unsigned int sequenceNum = GetUINT(inputMessage + 2, bigEndian_); - - #ifdef SUSPEND - - if (sequenceNum >= 1000) - { - cerr << "Warning" << ": Exiting to test the resilience of the agent.\n"; - - sleep(2); - - HandleAbort(); - } - - #endif - - // - // We managed all the events and errors caused - // by the previous requests. We can now reset - // the queue of split commits. - // - - clearCommitQueue(); - - // - // Encode opcode and difference between - // current sequence and the last one. - // - - encodeBuffer.encodeOpcodeValue(inputOpcode, serverCache_ -> opcodeCache); - - unsigned int sequenceDiff = sequenceNum - serverSequence_; - - serverSequence_ = sequenceNum; - - #ifdef DEBUG - *logofs << "handleRead: Last server sequence number for FD#" - << fd_ << " is " << serverSequence_ << " with " - << "difference " << sequenceDiff << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sequenceDiff, 16, - serverCache_ -> replySequenceCache, 7); - - // - // Now handle the data part. - // - - if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) && - requestSequenceNum == sequenceNum) - { - // - // We've found the request that generated this reply. - // It is possible to compress the reply based on the - // specific request type. - // - - sequenceQueue_.pop(requestSequenceNum, requestOpcode, - requestData[0], requestData[1], requestData[2]); - - // - // If differential compression is disabled - // then use the most simple encoding. - // - - if (control -> LocalDeltaCompression == 0) - { - int result = handleFastReadReply(encodeBuffer, requestOpcode, - inputMessage, inputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - switch (requestOpcode) - { - case X_AllocColor: - { - const unsigned char *nextSrc = inputMessage + 8; - for (unsigned int i = 0; i < 3; i++) - { - unsigned int colorValue = GetUINT(nextSrc, bigEndian_); - nextSrc += 2; - if (colorValue == requestData[i]) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue(colorValue - colorValue, 16, 6); - } - } - unsigned int pixel = GetULONG(inputMessage + 16, bigEndian_); - encodeBuffer.encodeValue(pixel, 32, 9); - - priority_++; - } - break; - case X_GetAtomName: - { - unsigned int nameLength = GetUINT(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(nameLength, 16, 6); - const unsigned char *nextSrc = inputMessage + 32; - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, nameLength); - - priority_++; - } - break; - case X_GetGeometry: - { - // - // TODO: This obtains a satisfactory 10:1, but - // could be cached to leverage the big amount - // of such requests issued by QT clients. - // - - encodeBuffer.encodeCachedValue(inputMessage[1], 8, - serverCache_ -> depthCache); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> getGeometryRootCache, 9); - const unsigned char *nextSrc = inputMessage + 12; - for (unsigned int i = 0; i < 5; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *serverCache_ -> getGeometryGeomCache[i], 8); - nextSrc += 2; - } - - priority_++; - } - break; - case X_GetInputFocus: - { - // - // Is it a real X_GetInputFocus or a - // masqueraded reply? - // - - if (requestData[0] == X_GetInputFocus) - { - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> getInputFocusWindowCache); - - priority_++; - } - else - { - // - // TODO: We are not setting priority in case - // of replies other than real X_GetInputFocus - // or X_NXGetUnpackParameters. We should check - // once again that this is OK. - // - - #ifdef TEST - *logofs << "handleRead: Received tainted X_GetInputFocus reply " - << "for request OPCODE#" << requestData[0] << " with " - << "sequence " << sequenceNum << ".\n" - << logofs_flush; - #endif - - // - // Don't encode any data in case of sync - // messages or any other reply for which - // opcode is enough. - // - - if (requestData[0] == opcodeStore_ -> getUnpackParameters) - { - for (int i = 0; i < PACK_METHOD_LIMIT; i++) - { - encodeBuffer.encodeBoolValue(control -> LocalUnpackMethods[i]); - } - - priority_++; - } - else if (requestData[0] == opcodeStore_ -> getShmemParameters) - { - if (handleShmemReply(encodeBuffer, requestOpcode, requestData[1], - inputMessage, inputLength) < 0) - { - return -1; - } - - priority_++; - } - else if (requestData[0] == opcodeStore_ -> getFontParameters) - { - if (handleFontReply(encodeBuffer, requestOpcode, - inputMessage, inputLength) < 0) - { - return -1; - } - } - - // - // Account this data to the original opcode. - // - - requestOpcode = requestData[0]; - } - } - break; - case X_GetKeyboardMapping: - { - unsigned int keysymsPerKeycode = (unsigned int) inputMessage[1]; - if (ServerCache::getKeyboardMappingLastMap.compare(inputLength - 32, - inputMessage + 32) && (keysymsPerKeycode == - ServerCache::getKeyboardMappingLastKeysymsPerKeycode)) - { - encodeBuffer.encodeBoolValue(1); - - priority_++; - - break; - } - ServerCache::getKeyboardMappingLastKeysymsPerKeycode = keysymsPerKeycode; - encodeBuffer.encodeBoolValue(0); - unsigned int numKeycodes = - (((inputLength - 32) / keysymsPerKeycode) >> 2); - encodeBuffer.encodeValue(numKeycodes, 8); - encodeBuffer.encodeValue(keysymsPerKeycode, 8, 4); - const unsigned char *nextSrc = inputMessage + 32; - unsigned char previous = 0; - for (unsigned int count = numKeycodes * keysymsPerKeycode; - count; --count) - { - unsigned int keysym = GetULONG(nextSrc, bigEndian_); - nextSrc += 4; - if (keysym == NoSymbol) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - unsigned int first3Bytes = (keysym >> 8); - encodeBuffer.encodeCachedValue(first3Bytes, 24, - serverCache_ -> getKeyboardMappingKeysymCache, 9); - unsigned char lastByte = (unsigned char) (keysym & 0xff); - encodeBuffer.encodeCachedValue(lastByte - previous, 8, - serverCache_ -> getKeyboardMappingLastByteCache, 5); - previous = lastByte; - } - } - - priority_++; - } - break; - case X_GetModifierMapping: - { - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 8); - const unsigned char *nextDest = inputMessage + 32; - if (ServerCache::getModifierMappingLastMap.compare(inputLength - 32, - nextDest)) - { - encodeBuffer.encodeBoolValue(1); - - priority_++; - - break; - } - encodeBuffer.encodeBoolValue(0); - for (unsigned int count = inputLength - 32; count; count--) - { - unsigned char next = *nextDest++; - if (next == 0) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue(next, 8); - } - } - - priority_++; - } - break; - case X_GetProperty: - { - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_GetProperty); - - hit = handleEncode(encodeBuffer, serverCache_, messageStore, - requestOpcode, inputMessage, inputLength); - - priority_++; - } - break; - case X_GetSelectionOwner: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> getSelectionOwnerCache, 9); - priority_++; - } - break; - case X_GetWindowAttributes: - { - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> visualCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), - 16, serverCache_ -> getWindowAttributesClassCache, 3); - encodeBuffer.encodeCachedValue(inputMessage[14], 8, - serverCache_ -> getWindowAttributesBitGravityCache); - encodeBuffer.encodeCachedValue(inputMessage[15], 8, - serverCache_ -> getWindowAttributesWinGravityCache); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), - 32, serverCache_ -> getWindowAttributesPlanesCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 20, bigEndian_), - 32, serverCache_ -> getWindowAttributesPixelCache, 9); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[24]); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[25]); - encodeBuffer.encodeValue((unsigned int) inputMessage[26], 2); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[27]); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 28, bigEndian_), - 29, serverCache_ -> colormapCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 32, bigEndian_), - 32, serverCache_ -> getWindowAttributesAllEventsCache); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 36, bigEndian_), - 32, serverCache_ -> getWindowAttributesYourEventsCache); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 40, bigEndian_), - 16, serverCache_ -> getWindowAttributesDontPropagateCache); - - priority_++; - } - break; - case X_GrabKeyboard: - case X_GrabPointer: - { - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 3); - - priority_++; - } - break; - case X_InternAtom: - { - encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 29, 9); - - priority_++; - } - break; - case X_ListExtensions: - { - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); - unsigned int numExtensions = (unsigned int) inputMessage[1]; - encodeBuffer.encodeValue(numExtensions, 8); - const unsigned char *nextSrc = inputMessage + 32; - - for (; numExtensions; numExtensions--) - { - unsigned int length = (unsigned int) (*nextSrc++); - - encodeBuffer.encodeValue(length, 8); - - #ifdef HIDE_MIT_SHM_EXTENSION - - if (!strncmp((char *) nextSrc, "MIT-SHM", 7)) - { - #ifdef TEST - *logofs << "handleRead: Hiding MIT-SHM extension in reply.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) nextSrc, "NO-MIT-", 7); - } - - #endif - - #ifdef HIDE_BIG_REQUESTS_EXTENSION - - if (!strncmp((char *) nextSrc, "BIG-REQUESTS", 12)) - { - #ifdef TEST - *logofs << "handleRead: Hiding BIG-REQUESTS extension in reply.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) nextSrc, "NO-BIG-REQUE", 12); - } - - #endif - - #ifdef HIDE_XKEYBOARD_EXTENSION - - if (!strncmp((char *) nextSrc, "XKEYBOARD", 9)) - { - #ifdef TEST - *logofs << "handleRead: Hiding XKEYBOARD extension in reply.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) nextSrc, "NO-XKEYBO", 9); - } - - #endif - - #ifdef HIDE_XFree86_Bigfont_EXTENSION - - if (!strncmp((char *) nextSrc, "XFree86-Bigfont", 15)) - { - #ifdef TEST - *logofs << "handleRead: Hiding XFree86-Bigfont extension in reply.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) nextSrc, "NO-XFree86-Bigf", 15); - } - - #endif - - #ifdef HIDE_SHAPE_EXTENSION - - if (!strncmp((char *) nextSrc, "SHAPE", 5)) - { - #ifdef TEST - *logofs << "handleRead: Hiding SHAPE extension in reply.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) nextSrc, "NO-SH", 5); - } - - #endif - - // - // Check if user disabled RENDER extension. - // - - if (control -> HideRender == 1 && - !strncmp((char *) nextSrc, "RENDER", 6)) - { - #ifdef TEST - *logofs << "handleRead: Hiding RENDER extension in reply.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) nextSrc, "NO-REN", 6); - } - - for (; length; length--) - { - encodeBuffer.encodeValue((unsigned int) (*nextSrc++), 8); - } - } - - priority_++; - } - break; - case X_ListFonts: - { - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_ListFonts); - - if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, - inputMessage, inputLength)) - { - priority_++; - - hit = 1; - - break; - } - - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); - unsigned int numFonts = GetUINT(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(numFonts, 16, 6); - - // Differential encoding. - encodeBuffer.encodeBoolValue(1); - - const unsigned char* nextSrc = inputMessage + 32; - for (; numFonts; numFonts--) - { - unsigned int length = (unsigned int) (*nextSrc++); - encodeBuffer.encodeValue(length, 8); - - // Since ProtoStep7 (#issue 108) - encodeBuffer.encodeTextData(nextSrc, length); - - nextSrc += length; - } - - priority_++; - } - break; - case X_LookupColor: - case X_AllocNamedColor: - { - const unsigned char *nextSrc = inputMessage + 8; - if (requestOpcode == X_AllocNamedColor) - { - encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); - nextSrc += 4; - } - unsigned int count = 3; - do - { - unsigned int exactColor = GetUINT(nextSrc, bigEndian_); - encodeBuffer.encodeValue(exactColor, 16, 9); - unsigned int visualColor = GetUINT(nextSrc + 6, bigEndian_) - - exactColor; - encodeBuffer.encodeValue(visualColor, 16, 5); - nextSrc += 2; - } - while (--count); - - priority_++; - } - break; - case X_QueryBestSize: - { - encodeBuffer.encodeValue(GetUINT(inputMessage + 8, bigEndian_), 16, 8); - encodeBuffer.encodeValue(GetUINT(inputMessage + 10, bigEndian_), 16, 8); - - priority_++; - } - break; - case X_QueryColors: - { - // Differential encoding. - encodeBuffer.encodeBoolValue(1); - - unsigned int numColors = ((inputLength - 32) >> 3); - const unsigned char *nextSrc = inputMessage + 40; - unsigned char *nextDest = (unsigned char *) inputMessage + 38; - for (unsigned int c = 1; c < numColors; c++) - { - for (unsigned int i = 0; i < 6; i++) - *nextDest++ = *nextSrc++; - nextSrc += 2; - } - unsigned int colorsLength = numColors * 6; - if (serverCache_ -> queryColorsLastReply.compare(colorsLength, - inputMessage + 32)) - encodeBuffer.encodeBoolValue(1); - else - { - const unsigned char *nextSrc = inputMessage + 32; - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue(numColors, 16, 5); - for (numColors *= 3; numColors; numColors--) - { - encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); - nextSrc += 2; - } - } - - priority_++; - } - break; - case X_QueryExtension: - { - if (requestData[0] == X_QueryExtension) - { - // - // Value in requestData[0] will be nonzero - // if the request is for an extension that - // we should hide to the X client. - // - - if (requestData[1]) - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue(0, 8); - } - else - { - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[8]); - encodeBuffer.encodeValue((unsigned int) inputMessage[9], 8); - } - - encodeBuffer.encodeValue((unsigned int) inputMessage[10], 8); - encodeBuffer.encodeValue((unsigned int) inputMessage[11], 8); - - if (requestData[2] == X_NXInternalShapeExtension) - { - opcodeStore_ -> shapeExtension = inputMessage[9]; - - #ifdef TEST - *logofs << "handleRead: Shape extension opcode for FD#" << fd_ - << " is " << (unsigned int) opcodeStore_ -> shapeExtension - << ".\n" << logofs_flush; - #endif - } - else if (requestData[2] == X_NXInternalRenderExtension) - { - opcodeStore_ -> renderExtension = inputMessage[9]; - - #ifdef TEST - *logofs << "handleRead: Render extension opcode for FD#" << fd_ - << " is " << (unsigned int) opcodeStore_ -> renderExtension - << ".\n" << logofs_flush; - #endif - } - - priority_++; - } - else - { - #ifdef TEST - *logofs << "handleRead: Received tainted X_QueryExtension reply " - << "for request OPCODE#" << requestData[0] << " with " - << "sequence " << sequenceNum << ".\n" - << logofs_flush; - #endif - - if (requestData[0] == opcodeStore_ -> getShmemParameters) - { - if (handleShmemReply(encodeBuffer, requestOpcode, requestData[1], - inputMessage, inputLength) < 0) - { - return -1; - } - - priority_++; - } - // - // Account this data to the original opcode. - // - - requestOpcode = requestData[0]; - } - } - break; - case X_QueryFont: - { - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_QueryFont); - - if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, - inputMessage, inputLength)) - { - priority_++; - - hit = 1; - - break; - } - - // Differential encoding. - encodeBuffer.encodeBoolValue(1); - - unsigned int numProperties = GetUINT(inputMessage + 46, bigEndian_); - unsigned int numCharInfos = GetULONG(inputMessage + 56, bigEndian_); - encodeBuffer.encodeValue(numProperties, 16, 8); - encodeBuffer.encodeValue(numCharInfos, 32, 10); - handleEncodeCharInfo(inputMessage + 8, encodeBuffer); - handleEncodeCharInfo(inputMessage + 24, encodeBuffer); - encodeBuffer.encodeValue(GetUINT(inputMessage + 40, bigEndian_), 16, 9); - encodeBuffer.encodeValue(GetUINT(inputMessage + 42, bigEndian_), 16, 9); - encodeBuffer.encodeValue(GetUINT(inputMessage + 44, bigEndian_), 16, 9); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[48]); - encodeBuffer.encodeValue((unsigned int) inputMessage[49], 8); - encodeBuffer.encodeValue((unsigned int) inputMessage[50], 8); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[51]); - encodeBuffer.encodeValue(GetUINT(inputMessage + 52, bigEndian_), 16, 9); - encodeBuffer.encodeValue(GetUINT(inputMessage + 54, bigEndian_), 16, 9); - const unsigned char *nextSrc = inputMessage + 60; - unsigned int index; - - int end = 0; - - if (ServerCache::queryFontFontCache.lookup(numProperties * 8 + - numCharInfos * 12, nextSrc, index)) - { - encodeBuffer.encodeBoolValue(1); - encodeBuffer.encodeValue(index, 4); - - end = 1; - } - - if (end == 0) - { - encodeBuffer.encodeBoolValue(0); - for (; numProperties; numProperties--) - { - encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); - encodeBuffer.encodeValue(GetULONG(nextSrc + 4, bigEndian_), 32, 9); - nextSrc += 8; - } - for (; numCharInfos; numCharInfos--) - { - handleEncodeCharInfo(nextSrc, encodeBuffer); - - nextSrc += 12; - } - } - - priority_++; - } - break; - case X_QueryPointer: - { - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> queryPointerRootCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), - 29, serverCache_ -> queryPointerChildCache, 9); - unsigned int rootX = GetUINT(inputMessage + 16, bigEndian_); - unsigned int rootY = GetUINT(inputMessage + 18, bigEndian_); - unsigned int eventX = GetUINT(inputMessage + 20, bigEndian_); - unsigned int eventY = GetUINT(inputMessage + 22, bigEndian_); - eventX -= rootX; - eventY -= rootY; - encodeBuffer.encodeCachedValue( - rootX - serverCache_ -> motionNotifyLastRootX, 16, - serverCache_ -> motionNotifyRootXCache, 8); - serverCache_ -> motionNotifyLastRootX = rootX; - encodeBuffer.encodeCachedValue( - rootY - serverCache_ -> motionNotifyLastRootY, 16, - serverCache_ -> motionNotifyRootYCache, 8); - serverCache_ -> motionNotifyLastRootY = rootY; - encodeBuffer.encodeCachedValue(eventX, 16, - serverCache_ -> motionNotifyEventXCache, 8); - encodeBuffer.encodeCachedValue(eventY, 16, - serverCache_ -> motionNotifyEventYCache, 8); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 24, bigEndian_), - 16, serverCache_ -> motionNotifyStateCache); - priority_++; - } - break; - case X_QueryTree: - { - // - // This was very inefficient. In practice - // it just copied data on the output. Now - // it obtains an average 7:1 compression - // and could optionally be cached. - // - - unsigned int children = GetUINT(inputMessage + 16, bigEndian_); - - encodeBuffer.encodeValue(children, 16, 8); - - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, - serverCache_ -> queryTreeWindowCache); - - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, - serverCache_ -> queryTreeWindowCache); - - const unsigned char *next = inputMessage + 32; - - for (unsigned int i = 0; i < children; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(next + (i * 4), bigEndian_), 29, - serverCache_ -> queryTreeWindowCache); - } - - priority_++; - } - break; - case X_TranslateCoords: - { - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> translateCoordsChildCache, 9); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), - 16, serverCache_ -> translateCoordsXCache, 8); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 14, bigEndian_), - 16, serverCache_ -> translateCoordsYCache, 8); - priority_++; - } - break; - case X_GetImage: - { - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_GetImage); - - if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, - inputMessage, inputLength)) - { - priority_++; - - hit = 1; - - break; - } - - // Depth. - encodeBuffer.encodeCachedValue(inputMessage[1], 8, - serverCache_ -> depthCache); - // Reply length. - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 9); - - // Visual. - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, - serverCache_ -> visualCache); - - // Since ProtoStep8 (#issue 108) - handleCopy(encodeBuffer, requestOpcode, messageStore -> - dataOffset, inputMessage, inputLength); - - priority_++; - } - break; - case X_GetPointerMapping: - { - encodeBuffer.encodeValue(inputMessage[1], 8, 4); - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 4); - for (unsigned int i = 32; i < inputLength; i++) - encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8, 4); - - priority_++; - } - break; - case X_GetKeyboardControl: - { - encodeBuffer.encodeValue(inputMessage[1], 8, 2); - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); - for (unsigned int i = 8; i < inputLength; i++) - encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8, 4); - - priority_++; - } - break; - default: - { - #ifdef PANIC - *logofs << "ServerChannel: PANIC! No matching request with " - << "OPCODE#" << (unsigned int) requestOpcode - << " for reply with sequence number " - << requestSequenceNum << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": No matching request with OPCODE#" - << (unsigned int) requestOpcode << " for reply with " - << "sequence number " << requestSequenceNum << ".\n"; - - return -1; - } - } - - bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - - const char *cacheString = (hit ? "cached " : ""); - - *logofs << "handleRead: Handled " << cacheString << "reply to OPCODE#" - << (unsigned int) requestOpcode << " (" << DumpOpcode(requestOpcode) - << ") for FD#" << fd_ << " sequence " << serverSequence_ - << ". " << inputLength << " bytes in, " << bits << " bits (" - << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; - - #endif - - } // End of if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) && ... - else - { - // - // We didn't push the request opcode. - // Check if fast encoding is required. - // - - requestOpcode = X_Reply; - - if (control -> LocalDeltaCompression == 0) - { - int result = handleFastReadReply(encodeBuffer, requestOpcode, - inputMessage, inputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - // - // Group all replies whose opcode was not - // pushed in sequence number queue under - // the category 'generic reply'. - // - - #ifdef DEBUG - *logofs << "handleRead: Identified generic reply.\n" - << logofs_flush; - #endif - - MessageStore *messageStore = serverStore_ -> - getReplyStore(X_NXInternalGenericReply); - - hit = handleEncode(encodeBuffer, serverCache_, messageStore, - requestOpcode, inputMessage, inputLength); - - priority_++; - - bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - - const char *cacheString = (hit ? "cached " : ""); - - *logofs << "handleRead: Handled " << cacheString << "generic reply " - << "OPCODE#" << X_NXInternalGenericReply << " for FD#" << fd_ - << " sequence " << serverSequence_ << ". " << inputLength - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - - #endif - } - - if (hit) - { - statistics -> addCachedReply(requestOpcode); - } - - statistics -> addReplyBits(requestOpcode, inputLength << 3, bits); - - } // End of if (inputMessage[0] == 1) ... - else - { - // - // Event or error. - // - - unsigned char inputOpcode = *inputMessage; - - unsigned int inputSequence = GetUINT(inputMessage + 2, bigEndian_); - - // - // Check if this is an event which we can discard. - // - - if ((inputOpcode == Expose && enableExpose_ == 0) || - (inputOpcode == GraphicsExpose && enableGraphicsExpose_ == 0) || - (inputOpcode == NoExpose && enableNoExpose_ == 0)) - { - continue; - } - else if (shmemState_ != NULL && shmemState_ -> enabled == 1 && - inputOpcode == shmemState_ -> event && - checkShmemEvent(inputOpcode, inputSequence, - inputMessage) > 0) - { - continue; - } - else if (inputOpcode == MotionNotify) - { - // - // Save the motion event and send when another - // event or error is received or the motion ti- - // meout is elapsed. If a previous motion event - // was already saved, we replace it with the - // new one and don't reset the timeout, so we - // still have a motion event every given ms. - // - - memcpy(lastMotion_, inputMessage, 32); - - #ifdef TEST - *logofs << "handleRead: Saved suppressed motion event for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - continue; - } - else if (inputOpcode == X_Error) - { - // - // Check if this is an error that matches a - // sequence number for which we are expecting - // a reply. - // - - unsigned short int errorSequenceNum; - unsigned char errorOpcode; - - if (sequenceQueue_.peek(errorSequenceNum, errorOpcode) && - ((unsigned int) errorSequenceNum == inputSequence)) - { - sequenceQueue_.pop(errorSequenceNum, errorOpcode); - } - - // - // Check if error is due to an image commit - // generated at the end of a split. - // - - if (checkCommitError(*(inputMessage + 1), inputSequence, inputMessage) > 0) - { - #ifdef TEST - *logofs << "handleRead: Skipping error on image commit for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - continue; - } - - // - // Check if it's an error generated by a request - // concerning shared memory support. - // - - else if (shmemState_ != NULL && (shmemState_ -> sequence == - inputSequence || (shmemState_ -> enabled == 1 && - (shmemState_ -> opcode == *(inputMessage + 10) || - shmemState_ -> error == *(inputMessage + 1)))) && - checkShmemError(*(inputMessage + 1), inputSequence, - inputMessage) > 0) - { - #ifdef TEST - *logofs << "handleRead: Skipping error on shmem operation for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - continue; - } - } - // - // Check if user pressed the CTRL+ALT+SHIFT+ESC key - // sequence because was unable to kill the session - // through the normal procedure. - // - - if (inputOpcode == KeyPress) - { - if (checkKeyboardEvent(inputOpcode, inputSequence, inputMessage) == 1) - { - #ifdef TEST - *logofs << "handleRead: Removing the key sequence from the " - << "event stream for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - continue; - } - } - - // - // We are going to handle an event or error - // that's not a mouse motion. Prepend any - // saved motion to it. - // - - if (lastMotion_[0] != '\0') - { - if (handleMotion(encodeBuffer) < 0) - { - #ifdef PANIC - *logofs << "handleRead: PANIC! Can't encode motion event for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't encode motion event for FD#" - << fd_ << ".\n"; - - return -1; - } - } - - // - // Encode opcode and difference between - // current sequence and the last one. - // - - encodeBuffer.encodeOpcodeValue(inputOpcode, serverCache_ -> opcodeCache); - - unsigned int sequenceDiff = inputSequence - serverSequence_; - - serverSequence_ = inputSequence; - - #ifdef DEBUG - *logofs << "handleRead: Last server sequence number for FD#" - << fd_ << " is " << serverSequence_ << " with " - << "difference " << sequenceDiff << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sequenceDiff, 16, - serverCache_ -> eventSequenceCache, 7); - - // - // If differential compression is disabled - // then use the most simple encoding. - // - - if (control -> LocalDeltaCompression == 0) - { - int result = handleFastReadEvent(encodeBuffer, inputOpcode, - inputMessage, inputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - switch (inputOpcode) - { - case X_Error: - { - // - // Set the priority flag in the case of - // a X protocol error. This may restart - // the client if it was waiting for the - // reply. - // - - priority_++; - - unsigned char errorCode = *(inputMessage + 1); - - encodeBuffer.encodeCachedValue(errorCode, 8, - serverCache_ -> errorCodeCache); - - if (errorCode != 11 && errorCode != 8 && - errorCode != 15 && errorCode != 1) - { - encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 16); - } - - if (errorCode >= 18) - { - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, - serverCache_ -> errorMinorCache); - } - - encodeBuffer.encodeCachedValue(inputMessage[10], 8, - serverCache_ -> errorMajorCache); - - if (errorCode >= 18) - { - const unsigned char *nextSrc = inputMessage + 11; - for (unsigned int i = 11; i < 32; i++) - encodeBuffer.encodeValue(*nextSrc++, 8); - } - } - break; - case ButtonPress: - case ButtonRelease: - case KeyPress: - case KeyRelease: - case MotionNotify: - case EnterNotify: - case LeaveNotify: - { - // - // Set the priority in the case this is - // an event that the remote side may - // care to receive as soon as possible. - // - - switch (inputOpcode) - { - case ButtonPress: - case ButtonRelease: - case KeyPress: - case KeyRelease: - { - priority_++; - } - } - - unsigned char detail = inputMessage[1]; - if (*inputMessage == MotionNotify) - encodeBuffer.encodeBoolValue((unsigned int) detail); - else if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) - encodeBuffer.encodeValue((unsigned int) detail, 3); - else if (*inputMessage == KeyRelease) - { - if (detail == serverCache_ -> keyPressLastKey) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue((unsigned int) detail, 8); - } - } - else if ((*inputMessage == ButtonPress) || (*inputMessage == ButtonRelease)) - encodeBuffer.encodeCachedValue(detail, 8, - serverCache_ -> buttonCache); - else - encodeBuffer.encodeValue((unsigned int) detail, 8); - unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); - unsigned int timestampDiff = - timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; - encodeBuffer.encodeCachedValue(timestampDiff, 32, - serverCache_ -> motionNotifyTimestampCache, 9); - int skipRest = 0; - if (*inputMessage == KeyRelease) - { - skipRest = 1; - for (unsigned int i = 8; i < 31; i++) - { - if (inputMessage[i] != serverCache_ -> keyPressCache[i - 8]) - { - skipRest = 0; - break; - } - } - encodeBuffer.encodeBoolValue(skipRest); - } - - if (!skipRest) - { - const unsigned char *nextSrc = inputMessage + 8; - for (unsigned int i = 0; i < 3; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, - *serverCache_ -> motionNotifyWindowCache[i], 6); - nextSrc += 4; - } - unsigned int rootX = GetUINT(inputMessage + 20, bigEndian_); - unsigned int rootY = GetUINT(inputMessage + 22, bigEndian_); - unsigned int eventX = GetUINT(inputMessage + 24, bigEndian_); - unsigned int eventY = GetUINT(inputMessage + 26, bigEndian_); - eventX -= rootX; - eventY -= rootY; - encodeBuffer.encodeCachedValue(rootX - - serverCache_ -> motionNotifyLastRootX, 16, - serverCache_ -> motionNotifyRootXCache, 6); - serverCache_ -> motionNotifyLastRootX = rootX; - encodeBuffer.encodeCachedValue(rootY - - serverCache_ -> motionNotifyLastRootY, 16, - serverCache_ -> motionNotifyRootYCache, 6); - serverCache_ -> motionNotifyLastRootY = rootY; - encodeBuffer.encodeCachedValue(eventX, 16, - serverCache_ -> motionNotifyEventXCache, 6); - encodeBuffer.encodeCachedValue(eventY, 16, - serverCache_ -> motionNotifyEventYCache, 6); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 28, bigEndian_), - 16, serverCache_ -> motionNotifyStateCache); - if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) - encodeBuffer.encodeValue((unsigned int) inputMessage[30], 2); - else - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[30]); - if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) - encodeBuffer.encodeValue((unsigned int) inputMessage[31], 2); - else if (*inputMessage == KeyPress) - { - serverCache_ -> keyPressLastKey = detail; - for (unsigned int i = 8; i < 31; i++) - { - serverCache_ -> keyPressCache[i - 8] = inputMessage[i]; - } - } - } - } - break; - case ColormapNotify: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> colormapNotifyWindowCache, 8); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> colormapNotifyColormapCache, 8); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); - } - break; - case ConfigureNotify: - { - const unsigned char *nextSrc = inputMessage + 4; - for (unsigned int i = 0; i < 3; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, - *serverCache_ -> configureNotifyWindowCache[i], 9); - nextSrc += 4; - } - for (unsigned int j = 0; j < 5; j++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *serverCache_ -> configureNotifyGeomCache[j], 8); - nextSrc += 2; - } - encodeBuffer.encodeBoolValue(*nextSrc); - } - break; - case CreateNotify: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> createNotifyWindowCache, 9); - unsigned int window = GetULONG(inputMessage + 8, bigEndian_); - encodeBuffer.encodeValue(window - - serverCache_ -> createNotifyLastWindow, 29, 5); - serverCache_ -> createNotifyLastWindow = window; - const unsigned char* nextSrc = inputMessage + 12; - for (unsigned int i = 0; i < 5; i++) - { - encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 9); - nextSrc += 2; - } - encodeBuffer.encodeBoolValue(*nextSrc); - } - break; - case Expose: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, - serverCache_ -> exposeWindowCache, 9); - const unsigned char *nextSrc = inputMessage + 8; - for (unsigned int i = 0; i < 5; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, - *serverCache_ -> exposeGeomCache[i], 6); - nextSrc += 2; - } - } - break; - case FocusIn: - case FocusOut: - { - encodeBuffer.encodeValue((unsigned int) inputMessage[1], 3); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> focusInWindowCache, 9); - encodeBuffer.encodeValue((unsigned int) inputMessage[8], 2); - } - break; - case KeymapNotify: - { - if (ServerCache::lastKeymap.compare(31, inputMessage + 1)) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - const unsigned char *nextSrc = inputMessage + 1; - for (unsigned int i = 1; i < 32; i++) - encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); - } - } - break; - case MapNotify: - case UnmapNotify: - case DestroyNotify: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> mapNotifyEventCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> mapNotifyWindowCache, 9); - if ((*inputMessage == MapNotify) || (*inputMessage == UnmapNotify)) - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); - } - break; - case NoExpose: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> noExposeDrawableCache, 9); - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, - serverCache_ -> noExposeMinorCache); - encodeBuffer.encodeCachedValue(inputMessage[10], 8, - serverCache_ -> noExposeMajorCache); - } - break; - case PropertyNotify: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> propertyNotifyWindowCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> propertyNotifyAtomCache, 9); - unsigned int timestamp = GetULONG(inputMessage + 12, bigEndian_); - unsigned int timestampDiff = - timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; - encodeBuffer.encodeValue(timestampDiff, 32, 9); - encodeBuffer.encodeBoolValue((unsigned int) inputMessage[16]); - } - break; - case ReparentNotify: - { - const unsigned char* nextSrc = inputMessage + 4; - for (unsigned int i = 0; i < 3; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), - 29, serverCache_ -> reparentNotifyWindowCache, 9); - nextSrc += 4; - } - encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 6); - encodeBuffer.encodeValue(GetUINT(nextSrc + 2, bigEndian_), 16, 6); - encodeBuffer.encodeBoolValue((unsigned int)inputMessage[20]); - } - break; - case SelectionClear: - { - unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); - unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; - encodeBuffer.encodeValue(timestampDiff, 32, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> selectionClearWindowCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), - 29, serverCache_ -> selectionClearAtomCache, 9); - } - break; - case SelectionRequest: - { - unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); - unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; - encodeBuffer.encodeValue(timestampDiff, 32, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), - 29, serverCache_ -> selectionClearWindowCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), - 29, serverCache_ -> selectionClearWindowCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), - 29, serverCache_ -> selectionClearAtomCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 20, bigEndian_), - 29, serverCache_ -> selectionClearAtomCache, 9); - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 24, bigEndian_), - 29, serverCache_ -> selectionClearAtomCache, 9); - } - break; - case VisibilityNotify: - { - encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), - 29, serverCache_ -> visibilityNotifyWindowCache, 9); - encodeBuffer.encodeValue((unsigned int) inputMessage[8], 2); - } - break; - default: - { - #ifdef TEST - *logofs << "handleRead: Using generic event compression " - << "for OPCODE#" << (unsigned int) inputOpcode - << ".\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, - serverCache_ -> genericEventCharCache); - - for (unsigned int i = 0; i < 14; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(inputMessage + i * 2 + 4, bigEndian_), - 16, *serverCache_ -> genericEventIntCache[i]); - } - } - - } // switch (inputOpcode)... - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - - if (*inputMessage == X_Error) - { - unsigned char code = *(inputMessage + 1); - - *logofs << "handleRead: Handled error ERR_CODE#" - << (unsigned int) code << " for FD#" << fd_; - - *logofs << " RES_ID#" << GetULONG(inputMessage + 4, bigEndian_); - - *logofs << " MIN_OP#" << GetUINT(inputMessage + 8, bigEndian_); - - *logofs << " MAJ_OP#" << (unsigned int) *(inputMessage + 10); - - *logofs << " sequence " << inputSequence << ". " << inputLength - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - } - else - { - *logofs << "handleRead: Handled event OPCODE#" - << (unsigned int) *inputMessage << " for FD#" << fd_ - << " sequence " << inputSequence << ". " << inputLength - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - } - - #endif - - statistics -> addEventBits(*inputMessage, inputLength << 3, bits); - - } // End of if (inputMessage[0] == X_Reply) ... else ... - - } // End of if (firstReply_) ... else ... - - } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != 0) ... - - // - // Check if we need to flush because of - // prioritized data. - // - - if (priority_ > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: WARNING! Requesting flush " - << "because of " << priority_ << " prioritized " - << "messages for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncPriority() < 0) - { - return -1; - } - - // - // Reset the priority flag. - // - - priority_ = 0; - } - - // - // Flush if we produced enough data. - // - - if (proxy -> canAsyncFlush() == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleRead: WARNING! Requesting flush " - << "because of token length exceeded.\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncFlush() < 0) - { - return -1; - } - } - - #if defined(TEST) || defined(INFO) - - if (transport_ -> pending() != 0 || - readBuffer_.checkMessage() != 0) - { - *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" - << fd_ << " has " << transport_ -> pending() - << " bytes to read.\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // Reset the read buffer. - // - - readBuffer_.fullReset(); - - return 1; -} - -// -// End of handleRead(). -// - -// -// Beginning of handleWrite(). -// - -int ServerChannel::handleWrite(const unsigned char *message, unsigned int length) -{ - #ifdef TEST - *logofs << "handleWrite: Called for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - // - // Create the buffer from which to - // decode messages. - // - - DecodeBuffer decodeBuffer(message, length); - - #if defined(TEST) || defined(INFO) || defined(FLUSH) - *logofs << "handleWrite: Decoding messages for FD#" << fd_ - << " with " << length << " bytes in the buffer.\n" - << logofs_flush; - #endif - - if (firstRequest_) - { - // - // Need to add the length of the first request - // because it was not present in the previous - // versions. Length of the first request was - // assumed to be the same as the encode buffer - // but this may be not the case if a different - // encoding is used. - // - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeValue(length, 8); - - unsigned int nextByte; - unsigned char *outputMessage = writeBuffer_.addMessage(length); - unsigned char *nextDest = outputMessage; - - for (unsigned int i = 0; i < length; i++) - { - decodeBuffer.decodeValue(nextByte, 8); - - *nextDest++ = (unsigned char) nextByte; - } - - if (*outputMessage == 0x42) - { - setBigEndian(1); - } - else - { - setBigEndian(0); - } - - #ifdef TEST - *logofs << "handleWrite: First request detected.\n" << logofs_flush; - #endif - - // - // Handle the fake authorization cookie. - // - - if (handleAuthorization(outputMessage) < 0) - { - return -1; - } - - firstRequest_ = 0; - - } // End of if (firstRequest_) - - // - // This was previously in a 'else' block. - // Due to the way the first request was - // handled, we could not decode multiple - // messages in the first frame. - // - - { // Start of the decoding block. - - unsigned char outputOpcode; - - unsigned char *outputMessage; - unsigned int outputLength; - - // - // Set when message is found in cache. - // - - int hit; - - while (decodeBuffer.decodeOpcodeValue(outputOpcode, clientCache_ -> opcodeCache, 1)) - { - hit = 0; - - // - // Splits are sent by client proxy outside the - // normal read loop. As we 'insert' splits in - // the real client-server X protocol, we must - // avoid to increment the sequence number or - // our clients would get confused. - // - - if (outputOpcode != opcodeStore_ -> splitData) - { - clientSequence_++; - clientSequence_ &= 0xffff; - - #ifdef DEBUG - *logofs << "handleWrite: Last client sequence number for FD#" - << fd_ << " is " << clientSequence_ << ".\n" - << logofs_flush; - #endif - } - else - { - // - // It's a split, not a normal - // burst of proxy data. - // - - handleSplit(decodeBuffer); - - continue; - } - - #ifdef SUSPEND - - if (clientSequence_ == 1000) - { - cerr << "Warning" << ": Exiting to test the resilience of the agent.\n"; - - sleep(2); - - HandleAbort(); - } - - #endif - - // - // Is differential encoding disabled? - // - - if (control -> RemoteDeltaCompression == 0) - { - int result = handleFastWriteRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength); - if (result < 0) - { - return -1; - } - else if (result > 0) - { - continue; - } - } - - // - // General-purpose temp variables for - // decoding ints and chars. - // - - unsigned int value; - unsigned char cValue; - - #ifdef DEBUG - *logofs << "handleWrite: Going to handle request OPCODE#" - << (unsigned int) outputOpcode << " (" << DumpOpcode(outputOpcode) - << ") for FD#" << fd_ << " sequence " << clientSequence_ - << ".\n" << logofs_flush; - #endif - - switch (outputOpcode) - { - case X_AllocColor: - { - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> colormapCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 8; - unsigned int colorData[3]; - - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *(clientCache_ -> allocColorRGBCache[i]), 4); - PutUINT(value, nextDest, bigEndian_); - colorData[i] = value; - nextDest += 2; - } - - sequenceQueue_.push(clientSequence_, outputOpcode, - colorData[0], colorData[1], colorData[2]); - } - break; - case X_ReparentWindow: - { - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 16, 11); - PutUINT(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeValue(value, 16, 11); - PutUINT(value, outputMessage + 14, bigEndian_); - } - break; - case X_ChangeProperty: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ChangeProperty); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned char format; - decodeBuffer.decodeCachedValue(format, 8, - clientCache_ -> changePropertyFormatCache); - unsigned int dataLength; - decodeBuffer.decodeValue(dataLength, 32, 6); - outputLength = 24 + RoundUp4(dataLength * (format >> 3)); - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 2); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> changePropertyPropertyCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> changePropertyTypeCache, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - outputMessage[16] = format; - PutULONG(dataLength, outputMessage + 20, bigEndian_); - unsigned char *nextDest = outputMessage + 24; - - if (format == 8) - { - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, dataLength); - } - else if (format == 32) - { - for (unsigned int i = 0; i < dataLength; i++) - { - decodeBuffer.decodeCachedValue(value, 32, - clientCache_ -> changePropertyData32Cache); - - PutULONG(value, nextDest, bigEndian_); - - nextDest += 4; - } - } - else - { - for (unsigned int i = 0; i < dataLength; i++) - { - decodeBuffer.decodeValue(value, 16); - - PutUINT(value, nextDest, bigEndian_); - - nextDest += 2; - } - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_SendEvent: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_SendEvent); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 44; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - *(outputMessage + 1) = value; - decodeBuffer.decodeBoolValue(value); - if (value) - { - decodeBuffer.decodeBoolValue(value); - } - else - { - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - } - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 32, - clientCache_ -> sendEventMaskCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(*(outputMessage + 12), 8, - clientCache_ -> sendEventCodeCache); - decodeBuffer.decodeCachedValue(*(outputMessage + 13), 8, - clientCache_ -> sendEventByteDataCache); - decodeBuffer.decodeValue(value, 16, 4); - clientCache_ -> sendEventLastSequence += value; - clientCache_ -> sendEventLastSequence &= 0xffff; - PutUINT(clientCache_ -> sendEventLastSequence, outputMessage + 14, bigEndian_); - decodeBuffer.decodeCachedValue(value, 32, - clientCache_ -> sendEventIntDataCache); - PutULONG(value, outputMessage + 16, bigEndian_); - - for (unsigned int i = 20; i < 44; i++) - { - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> sendEventEventCache); - *(outputMessage + i) = cValue; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_ChangeWindowAttributes: - { - unsigned int numAttrs; - decodeBuffer.decodeValue(numAttrs, 4); - outputLength = 12 + (numAttrs << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned int bitmask; - decodeBuffer.decodeCachedValue(bitmask, 15, - clientCache_ -> createWindowBitmaskCache); - PutULONG(bitmask, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - unsigned int mask = 0x1; - for (unsigned int i = 0; i < 15; i++) - { - if (bitmask & mask) - { - decodeBuffer.decodeCachedValue(value, 32, - *clientCache_ -> createWindowAttrCache[i]); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - mask <<= 1; - } - } - break; - case X_ClearArea: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ClearArea); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 8; - for (unsigned int i = 0; i < 4; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> clearAreaGeomCache[i], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_CloseFont: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 29, 5); - clientCache_ -> lastFont += value; - clientCache_ -> lastFont &= 0x1fffffff; - PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); - } - break; - case X_ConfigureWindow: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ConfigureWindow); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned int bitmask; - decodeBuffer.decodeCachedValue(bitmask, 7, - clientCache_ -> configureWindowBitmaskCache); - PutUINT(bitmask, outputMessage + 8, bigEndian_); - unsigned int mask = 0x1; - for (unsigned int i = 0; i < 7; i++) - { - if (bitmask & mask) - { - unsigned char* nextDest = writeBuffer_.addMessage(4); - outputLength += 4; - decodeBuffer.decodeCachedValue(value, CONFIGUREWINDOW_FIELD_WIDTH[i], - *clientCache_ -> configureWindowAttrCache[i], 8); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - mask <<= 1; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_ConvertSelection: - { - outputLength = 24; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> convertSelectionRequestorCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned char* nextDest = outputMessage + 8; - for (unsigned int i = 0; i < 3; i++) - { - decodeBuffer.decodeCachedValue(value, 29, - *(clientCache_ -> convertSelectionAtomCache[i]), 9); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - } - decodeBuffer.decodeValue(value, 32, 4); - clientCache_ -> convertSelectionLastTimestamp += value; - PutULONG(clientCache_ -> convertSelectionLastTimestamp, - nextDest, bigEndian_); - } - break; - case X_CopyArea: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_CopyArea); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 28; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 12, bigEndian_); - unsigned char *nextDest = outputMessage + 16; - for (unsigned int i = 0; i < 6; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> copyAreaGeomCache[i], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_CopyGC: - { - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 23, - clientCache_ -> createGCBitmaskCache); - PutULONG(value, outputMessage + 12, bigEndian_); - } - break; - case X_CopyPlane: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 12, bigEndian_); - unsigned char *nextDest = outputMessage + 16; - for (unsigned int i = 0; i < 6; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> copyPlaneGeomCache[i], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - decodeBuffer.decodeCachedValue(value, 32, - clientCache_ -> copyPlaneBitPlaneCache, 10); - PutULONG(value, outputMessage + 28, bigEndian_); - } - break; - case X_CreateGC: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_CreateGC); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId, - clientCache_ -> lastIdCache, clientCache_ -> gcCache, - clientCache_ -> freeGCCache); - - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned int offset = 8; - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + offset, bigEndian_); - offset += 4; - unsigned int bitmask; - decodeBuffer.decodeCachedValue(bitmask, 23, - clientCache_ -> createGCBitmaskCache); - PutULONG(bitmask, outputMessage + offset, bigEndian_); - unsigned int mask = 0x1; - for (unsigned int i = 0; i < 23; i++) - { - if (bitmask & mask) - { - unsigned char* nextDest = writeBuffer_.addMessage(4); - outputLength += 4; - unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; - if (fieldWidth <= 4) - decodeBuffer.decodeValue(value, fieldWidth); - else - decodeBuffer.decodeCachedValue(value, fieldWidth, - *clientCache_ -> createGCAttrCache[i]); - PutULONG(value, nextDest, bigEndian_); - } - mask <<= 1; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_ChangeGC: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ChangeGC); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned int offset = 8; - unsigned int bitmask; - decodeBuffer.decodeCachedValue(bitmask, 23, - clientCache_ -> createGCBitmaskCache); - PutULONG(bitmask, outputMessage + offset, bigEndian_); - unsigned int mask = 0x1; - for (unsigned int i = 0; i < 23; i++) - { - if (bitmask & mask) - { - unsigned char* nextDest = writeBuffer_.addMessage(4); - outputLength += 4; - unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; - if (fieldWidth <= 4) - decodeBuffer.decodeValue(value, fieldWidth); - else - decodeBuffer.decodeCachedValue(value, fieldWidth, - *clientCache_ -> createGCAttrCache[i]); - PutULONG(value, nextDest, bigEndian_); - } - mask <<= 1; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_CreatePixmap: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_CreatePixmap); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - } - break; - case X_CreateWindow: - { - outputLength = 32; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> depthCache); - outputMessage[1] = cValue; - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 8, bigEndian_); - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId, - clientCache_ -> lastIdCache, clientCache_ -> windowCache, - clientCache_ -> freeWindowCache); - - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - unsigned int i; - for (i = 0; i < 6; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> createWindowGeomCache[i], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> visualCache); - PutULONG(value, outputMessage + 24, bigEndian_); - unsigned int bitmask; - decodeBuffer.decodeCachedValue(bitmask, 15, - clientCache_ -> createWindowBitmaskCache); - PutULONG(bitmask, outputMessage + 28, bigEndian_); - unsigned int mask = 0x1; - for (i = 0; i < 15; i++) - { - if (bitmask & mask) - { - nextDest = writeBuffer_.addMessage(4); - outputLength += 4; - decodeBuffer.decodeCachedValue(value, 32, - *clientCache_ -> createWindowAttrCache[i]); - PutULONG(value, nextDest, bigEndian_); - } - mask <<= 1; - } - writeBuffer_.unregisterPointer(); - } - break; - case X_DeleteProperty: - { - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 29, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - } - break; - case X_FillPoly: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_FillPoly); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int numPoints; - - // Since ProtoStep10 (#issue 108) - decodeBuffer.decodeCachedValue(numPoints, 16, - clientCache_ -> fillPolyNumPointsCache, 4); - - outputLength = 16 + (numPoints << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 2); - outputMessage[12] = (unsigned char) value; - unsigned int relativeCoordMode; - decodeBuffer.decodeBoolValue(relativeCoordMode); - outputMessage[13] = (unsigned char) relativeCoordMode; - unsigned char *nextDest = outputMessage + 16; - unsigned int pointIndex = 0; - for (unsigned int i = 0; i < numPoints; i++) - { - if (relativeCoordMode) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> fillPolyXRelCache[pointIndex], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> fillPolyYRelCache[pointIndex], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - else - { - unsigned int x, y; - decodeBuffer.decodeBoolValue(value); - if (value) - { - decodeBuffer.decodeValue(value, 3); - x = clientCache_ -> fillPolyRecentX[value]; - y = clientCache_ -> fillPolyRecentY[value]; - } - else - { - decodeBuffer.decodeCachedValue(x, 16, - *clientCache_ -> fillPolyXAbsCache[pointIndex], 8); - decodeBuffer.decodeCachedValue(y, 16, - *clientCache_ -> fillPolyYAbsCache[pointIndex], 8); - clientCache_ -> fillPolyRecentX[clientCache_ -> fillPolyIndex] = x; - clientCache_ -> fillPolyRecentY[clientCache_ -> fillPolyIndex] = y; - clientCache_ -> fillPolyIndex++; - if (clientCache_ -> fillPolyIndex == 8) - clientCache_ -> fillPolyIndex = 0; - } - PutUINT(x, nextDest, bigEndian_); - nextDest += 2; - PutUINT(y, nextDest, bigEndian_); - nextDest += 2; - } - - if (++pointIndex == 10) pointIndex = 0; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_FreeColors: - { - unsigned int numPixels; - decodeBuffer.decodeValue(numPixels, 16, 4); - outputLength = 12 + (numPixels << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> colormapCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 32, 4); - PutULONG(value, outputMessage + 8, bigEndian_); - unsigned char* nextDest = outputMessage + 12; - while (numPixels) - { - decodeBuffer.decodeValue(value, 32, 8); - PutULONG(value, nextDest, bigEndian_); - nextDest += 4; - numPixels--; - } - } - break; - case X_FreeCursor: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> cursorCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - } - break; - case X_FreeGC: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeGCCache); - - PutULONG(value, outputMessage + 4, bigEndian_); - } - break; - case X_FreePixmap: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeDrawableCache); - - PutULONG(value, outputMessage + 4, bigEndian_); - } - break; - case X_GetAtomName: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 29, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GetGeometry: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GetInputFocus: - { - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - - sequenceQueue_.push(clientSequence_, outputOpcode, outputOpcode); - } - break; - case X_GetModifierMapping: - { - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GetKeyboardMapping: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 8); - outputMessage[4] = value; - decodeBuffer.decodeValue(value, 8); - outputMessage[5] = value; - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GetProperty: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_GetProperty); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - // - // Save a reference to identify the reply. - // - - unsigned int property = GetULONG(outputMessage + 8, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode, property); - - break; - } - - outputLength = 24; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned int property; - decodeBuffer.decodeValue(property, 29, 9); - PutULONG(property, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 29, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeValue(value, 32, 2); - PutULONG(value, outputMessage + 16, bigEndian_); - decodeBuffer.decodeValue(value, 32, 8); - PutULONG(value, outputMessage + 20, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode, property); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_GetSelectionOwner: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> getSelectionOwnerSelectionCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GrabButton: - case X_GrabPointer: - { - outputLength = 24; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> grabButtonEventMaskCache); - PutUINT(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[10] = (unsigned char) value; - decodeBuffer.decodeBoolValue(value); - outputMessage[11] = (unsigned char) value; - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> grabButtonConfineCache, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> cursorCache, 9); - PutULONG(value, outputMessage + 16, bigEndian_); - if (outputOpcode == X_GrabButton) - { - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> grabButtonButtonCache); - outputMessage[20] = cValue; - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> grabButtonModifierCache); - PutUINT(value, outputMessage + 22, bigEndian_); - } - else - { - decodeBuffer.decodeValue(value, 32, 4); - clientCache_ -> grabKeyboardLastTimestamp += value; - PutULONG(clientCache_ -> grabKeyboardLastTimestamp, - outputMessage + 20, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - } - break; - case X_GrabKeyboard: - { - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 32, 4); - clientCache_ -> grabKeyboardLastTimestamp += value; - PutULONG(clientCache_ -> grabKeyboardLastTimestamp, outputMessage + 8, - bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[12] = (unsigned char) value; - decodeBuffer.decodeBoolValue(value); - outputMessage[13] = (unsigned char) value; - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GrabServer: - case X_UngrabServer: - case X_NoOperation: - { - #ifdef DEBUG - *logofs << "handleWrite: Managing (probably tainted) X_NoOperation request for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - } - break; - case X_PolyText8: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyText8); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> polyTextCacheX); - clientCache_ -> polyTextLastX += value; - clientCache_ -> polyTextLastX &= 0xffff; - PutUINT(clientCache_ -> polyTextLastX, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> polyTextCacheY); - clientCache_ -> polyTextLastY += value; - clientCache_ -> polyTextLastY &= 0xffff; - PutUINT(clientCache_ -> polyTextLastY, outputMessage + 14, bigEndian_); - unsigned int addedLength = 0; - writeBuffer_.registerPointer(&outputMessage); - for (;;) - { - decodeBuffer.decodeBoolValue(value); - if (!value) - break; - unsigned int textLength; - decodeBuffer.decodeValue(textLength, 8); - if (textLength == 255) - { - addedLength += 5; - unsigned char *nextSegment = writeBuffer_.addMessage(5); - *nextSegment = (unsigned char) textLength; - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> polyTextFontCache); - PutULONG(value, nextSegment + 1, 1); - } - else - { - addedLength += (textLength + 2); - unsigned char *nextSegment = - writeBuffer_.addMessage(textLength + 2); - *nextSegment = (unsigned char) textLength; - unsigned char *nextDest = nextSegment + 1; - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> polyTextDeltaCache); - *nextDest++ = cValue; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, textLength); - - nextDest += textLength; - } - } - outputLength += addedLength; - unsigned int mod4 = (addedLength & 0x3); - if (mod4) - { - unsigned int extra = 4 - mod4; - unsigned char *nextDest = writeBuffer_.addMessage(extra); - for (unsigned int i = 0; i < extra; i++) - *nextDest++ = 0; - outputLength += extra; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PolyText16: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyText16); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> polyTextCacheX); - clientCache_ -> polyTextLastX += value; - clientCache_ -> polyTextLastX &= 0xffff; - PutUINT(clientCache_ -> polyTextLastX, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> polyTextCacheY); - clientCache_ -> polyTextLastY += value; - clientCache_ -> polyTextLastY &= 0xffff; - PutUINT(clientCache_ -> polyTextLastY, outputMessage + 14, bigEndian_); - unsigned int addedLength = 0; - writeBuffer_.registerPointer(&outputMessage); - for (;;) - { - decodeBuffer.decodeBoolValue(value); - if (!value) - break; - unsigned int textLength; - decodeBuffer.decodeValue(textLength, 8); - if (textLength == 255) - { - addedLength += 5; - unsigned char *nextSegment = writeBuffer_.addMessage(5); - *nextSegment = (unsigned char) textLength; - decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> polyTextFontCache); - PutULONG(value, nextSegment + 1, 1); - } - else - { - addedLength += (textLength * 2 + 2); - unsigned char *nextSegment = - writeBuffer_.addMessage(textLength * 2 + 2); - *nextSegment = (unsigned char) textLength; - unsigned char *nextDest = nextSegment + 1; - decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> polyTextDeltaCache); - *nextDest++ = cValue; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, textLength * 2); - - nextDest += textLength * 2; - } - } - outputLength += addedLength; - - unsigned int mod4 = (addedLength & 0x3); - if (mod4) - { - unsigned int extra = 4 - mod4; - unsigned char *nextDest = writeBuffer_.addMessage(extra); - for (unsigned int i = 0; i < extra; i++) - *nextDest++ = 0; - outputLength += extra; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_ImageText8: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ImageText8); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int textLength; - decodeBuffer.decodeCachedValue(textLength, 8, - clientCache_ -> imageTextLengthCache, 4); - outputLength = 16 + RoundUp4(textLength); - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) textLength; - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> imageTextCacheX); - clientCache_ -> imageTextLastX += value; - clientCache_ -> imageTextLastX &= 0xffff; - PutUINT(clientCache_ -> imageTextLastX, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> imageTextCacheY); - clientCache_ -> imageTextLastY += value; - clientCache_ -> imageTextLastY &= 0xffff; - PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_); - unsigned char *nextDest = outputMessage + 16; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, textLength); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_ImageText16: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_ImageText16); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int textLength; - decodeBuffer.decodeCachedValue(textLength, 8, - clientCache_ -> imageTextLengthCache, 4); - outputLength = 16 + RoundUp4(textLength * 2); - outputMessage = writeBuffer_.addMessage(outputLength); - outputMessage[1] = (unsigned char) textLength; - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> imageTextCacheX); - clientCache_ -> imageTextLastX += value; - clientCache_ -> imageTextLastX &= 0xffff; - PutUINT(clientCache_ -> imageTextLastX, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> imageTextCacheY); - clientCache_ -> imageTextLastY += value; - clientCache_ -> imageTextLastY &= 0xffff; - PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_); - unsigned char *nextDest = outputMessage + 16; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, textLength * 2); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_InternAtom: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_InternAtom); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - sequenceQueue_.push(clientSequence_, outputOpcode); - - break; - } - - unsigned int nameLength; - decodeBuffer.decodeValue(nameLength, 16, 6); - outputLength = RoundUp4(nameLength) + 8; - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(nameLength, outputMessage + 4, bigEndian_); - decodeBuffer.decodeBoolValue(value); - outputMessage[1] = (unsigned char) value; - unsigned char *nextDest = outputMessage + 8; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, nameLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_ListExtensions: - { - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_ListFonts: - { - unsigned int textLength; - decodeBuffer.decodeValue(textLength, 16, 6); - outputLength = 8 + RoundUp4(textLength); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(textLength, outputMessage + 6, bigEndian_); - decodeBuffer.decodeValue(value, 16, 6); - PutUINT(value, outputMessage + 4, bigEndian_); - unsigned char* nextDest = outputMessage + 8; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, textLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_LookupColor: - case X_AllocNamedColor: - { - unsigned int textLength; - decodeBuffer.decodeValue(textLength, 16, 6); - outputLength = 12 + RoundUp4(textLength); - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> colormapCache); - PutULONG(value, outputMessage + 4, bigEndian_); - PutUINT(textLength, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, textLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_MapWindow: - case X_UnmapWindow: - case X_MapSubwindows: - case X_GetWindowAttributes: - case X_DestroyWindow: - case X_DestroySubwindows: - case X_QueryPointer: - case X_QueryTree: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - - if (outputOpcode == X_DestroyWindow) // Since ProtoStep7 (#issue 108) - { - decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeWindowCache); - } - else - { - decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); - } - - PutULONG(value, outputMessage + 4, bigEndian_); - if (outputOpcode == X_QueryPointer || - outputOpcode == X_GetWindowAttributes || - outputOpcode == X_QueryTree) - { - sequenceQueue_.push(clientSequence_, outputOpcode); - } - } - break; - case X_OpenFont: - { - unsigned int nameLength; - decodeBuffer.decodeValue(nameLength, 16, 7); - outputLength = RoundUp4(12 + nameLength); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(nameLength, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 29, 5); - clientCache_ -> lastFont += value; - clientCache_ -> lastFont &= 0x1fffffff; - PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeTextData(nextDest, nameLength); - } - break; - case X_PolyFillRectangle: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyFillRectangle); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0; - unsigned int numRectangles = 0; - - for (;;) - { - outputLength += 8; - writeBuffer_.addMessage(8); - unsigned char *nextDest = outputMessage + 12 + - (numRectangles << 3); - numRectangles++; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillRectangleCacheX[index], 8); - value += lastX; - PutUINT(value, nextDest, bigEndian_); - lastX = value; - nextDest += 2; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillRectangleCacheY[index], 8); - value += lastY; - PutUINT(value, nextDest, bigEndian_); - lastY = value; - nextDest += 2; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillRectangleCacheWidth[index], 8); - value += lastWidth; - PutUINT(value, nextDest, bigEndian_); - lastWidth = value; - nextDest += 2; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillRectangleCacheHeight[index], 8); - value += lastHeight; - PutUINT(value, nextDest, bigEndian_); - lastHeight = value; - nextDest += 2; - - if (++index == 4) index = 0; - - decodeBuffer.decodeBoolValue(value); - - if (!value) break; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PolyFillArc: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyFillArc); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0, - lastWidth = 0, lastHeight = 0, - lastAngle1 = 0, lastAngle2 = 0; - - unsigned int numArcs = 0; - - for (;;) - { - outputLength += 12; - writeBuffer_.addMessage(12); - - unsigned char *nextDest = outputMessage + 12 + - (numArcs * 12); - numArcs++; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillArcCacheX[index], 8); - value += lastX; - PutUINT(value, nextDest, bigEndian_); - lastX = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillArcCacheY[index], 8); - value += lastY; - PutUINT(value, nextDest, bigEndian_); - lastY = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillArcCacheWidth[index], 8); - value += lastWidth; - PutUINT(value, nextDest, bigEndian_); - lastWidth = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillArcCacheHeight[index], 8); - value += lastHeight; - PutUINT(value, nextDest, bigEndian_); - lastHeight = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillArcCacheAngle1[index], 8); - value += lastAngle1; - PutUINT(value, nextDest, bigEndian_); - lastAngle1 = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyFillArcCacheAngle2[index], 8); - value += lastAngle2; - PutUINT(value, nextDest, bigEndian_); - lastAngle2 = value; - nextDest += 2; - - if (++index == 2) index = 0; - - decodeBuffer.decodeBoolValue(value); - - if (!value) break; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PolyArc: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyArc); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - writeBuffer_.registerPointer(&outputMessage); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0, - lastWidth = 0, lastHeight = 0, - lastAngle1 = 0, lastAngle2 = 0; - - unsigned int numArcs = 0; - - for (;;) - { - outputLength += 12; - writeBuffer_.addMessage(12); - - unsigned char *nextDest = outputMessage + 12 + - (numArcs * 12); - numArcs++; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyArcCacheX[index], 8); - value += lastX; - PutUINT(value, nextDest, bigEndian_); - lastX = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyArcCacheY[index], 8); - value += lastY; - PutUINT(value, nextDest, bigEndian_); - lastY = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyArcCacheWidth[index], 8); - value += lastWidth; - PutUINT(value, nextDest, bigEndian_); - lastWidth = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyArcCacheHeight[index], 8); - value += lastHeight; - PutUINT(value, nextDest, bigEndian_); - lastHeight = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyArcCacheAngle1[index], 8); - value += lastAngle1; - PutUINT(value, nextDest, bigEndian_); - lastAngle1 = value; - nextDest += 2; - - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyArcCacheAngle2[index], 8); - value += lastAngle2; - PutUINT(value, nextDest, bigEndian_); - lastAngle2 = value; - nextDest += 2; - - if (++index == 2) index = 0; - - decodeBuffer.decodeBoolValue(value); - - if (!value) break; - } - writeBuffer_.unregisterPointer(); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PolyPoint: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyPoint); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int numPoints; - decodeBuffer.decodeValue(numPoints, 16, 4); - outputLength = (numPoints << 2) + 12; - outputMessage = writeBuffer_.addMessage(outputLength); - unsigned int relativeCoordMode; - decodeBuffer.decodeBoolValue(relativeCoordMode); - outputMessage[1] = (unsigned char) relativeCoordMode; - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - - for (unsigned int i = 0; i < numPoints; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyPointCacheX[index], 8); - lastX += value; - PutUINT(lastX, nextDest, bigEndian_); - nextDest += 2; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyPointCacheY[index], 8); - lastY += value; - PutUINT(lastY, nextDest, bigEndian_); - nextDest += 2; - - if (++index == 2) index = 0; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PolyLine: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolyLine); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int numPoints; - decodeBuffer.decodeValue(numPoints, 16, 4); - outputLength = (numPoints << 2) + 12; - outputMessage = writeBuffer_.addMessage(outputLength); - unsigned int relativeCoordMode; - decodeBuffer.decodeBoolValue(relativeCoordMode); - outputMessage[1] = (unsigned char) relativeCoordMode; - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - - unsigned int index = 0; - unsigned int lastX = 0, lastY = 0; - - for (unsigned int i = 0; i < numPoints; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyLineCacheX[index], 8); - lastX += value; - PutUINT(lastX, nextDest, bigEndian_); - nextDest += 2; - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyLineCacheY[index], 8); - lastY += value; - PutUINT(lastY, nextDest, bigEndian_); - nextDest += 2; - - if (++index == 2) index = 0; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PolyRectangle: - { - unsigned int numRectangles; - decodeBuffer.decodeValue(numRectangles, 16, 3); - outputLength = (numRectangles << 3) + 12; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - for (unsigned int i = 0; i < numRectangles; i++) - for (unsigned int k = 0; k < 4; k++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> polyRectangleGeomCache[k], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - } - break; - case X_PolySegment: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PolySegment); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int numSegments; - decodeBuffer.decodeValue(numSegments, 16, 4); - outputLength = (numSegments << 3) + 12; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - - for (numSegments *= 2; numSegments; numSegments--) - { - unsigned int index; - decodeBuffer.decodeBoolValue(index); - unsigned int x; - decodeBuffer.decodeCachedValue(x, 16, - clientCache_ -> polySegmentCacheX, 6); - x += clientCache_ -> polySegmentLastX[index]; - PutUINT(x, nextDest, bigEndian_); - nextDest += 2; - - unsigned int y; - decodeBuffer.decodeCachedValue(y, 16, - clientCache_ -> polySegmentCacheY, 6); - y += clientCache_ -> polySegmentLastY[index]; - PutUINT(y, nextDest, bigEndian_); - nextDest += 2; - - clientCache_ -> polySegmentLastX[clientCache_ -> polySegmentCacheIndex] = x; - clientCache_ -> polySegmentLastY[clientCache_ -> polySegmentCacheIndex] = y; - - if (clientCache_ -> polySegmentCacheIndex == 1) - clientCache_ -> polySegmentCacheIndex = 0; - else - clientCache_ -> polySegmentCacheIndex = 1; - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_PutImage: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_PutImage); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - - if (outputOpcode == X_PutImage) - { - handleImage(outputOpcode, outputMessage, outputLength); - } - } - break; - case X_QueryBestSize: - { - outputLength = 12; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 2); - outputMessage[1] = (unsigned char)value; - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeValue(value, 16, 8); - PutUINT(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeValue(value, 16, 8); - PutUINT(value, outputMessage + 10, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_QueryColors: - { - // Differential or plain data compression? - decodeBuffer.decodeBoolValue(value); - - if (value) - { - unsigned int numColors; - decodeBuffer.decodeValue(numColors, 16, 5); - outputLength = (numColors << 2) + 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> colormapCache); - PutULONG(value, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 8; - unsigned int predictedPixel = clientCache_ -> queryColorsLastPixel; - for (unsigned int i = 0; i < numColors; i++) - { - unsigned int pixel; - decodeBuffer.decodeBoolValue(value); - if (value) - pixel = predictedPixel; - else - decodeBuffer.decodeValue(pixel, 32, 9); - PutULONG(pixel, nextDest, bigEndian_); - if (i == 0) - clientCache_ -> queryColorsLastPixel = pixel; - predictedPixel = pixel + 1; - nextDest += 4; - } - } - else - { - // Request length. - unsigned int requestLength; - decodeBuffer.decodeValue(requestLength, 16, 10); - outputLength = (requestLength << 2); - outputMessage = writeBuffer_.addMessage(outputLength); - - const unsigned char *compressedData = NULL; - unsigned int compressedDataSize = 0; - - int decompressed = handleDecompress(decodeBuffer, outputOpcode, 4, - outputMessage, outputLength, compressedData, - compressedDataSize); - if (decompressed < 0) - { - return -1; - } - } - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_QueryExtension: - { - unsigned int nameLength; - decodeBuffer.decodeValue(nameLength, 16, 6); - outputLength = 8 + RoundUp4(nameLength); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(nameLength, outputMessage + 4, bigEndian_); - unsigned char *nextDest = outputMessage + 8; - for (unsigned int i = 0; i < nameLength; i++) - { - decodeBuffer.decodeValue(value, 8); - *nextDest++ = (unsigned char) value; - } - - unsigned int hide = 0; - - #ifdef HIDE_MIT_SHM_EXTENSION - - if (!strncmp((char *) outputMessage + 8, "MIT-SHM", 7)) - { - #ifdef TEST - *logofs << "handleWrite: Going to hide MIT-SHM extension in reply.\n" - << logofs_flush; - #endif - - hide = 1; - } - - #endif - - #ifdef HIDE_BIG_REQUESTS_EXTENSION - - if (!strncmp((char *) outputMessage + 8, "BIG-REQUESTS", 12)) - { - #ifdef TEST - *logofs << "handleWrite: Going to hide BIG-REQUESTS extension in reply.\n" - << logofs_flush; - #endif - - hide = 1; - } - - #endif - - #ifdef HIDE_XKEYBOARD_EXTENSION - - else if (!strncmp((char *) outputMessage + 8, "XKEYBOARD", 9)) - { - #ifdef TEST - *logofs << "handleWrite: Going to hide XKEYBOARD extension in reply.\n" - << logofs_flush; - #endif - - hide = 1; - } - - #endif - - #ifdef HIDE_XFree86_Bigfont_EXTENSION - - else if (!strncmp((char *) outputMessage + 8, "XFree86-Bigfont", 15)) - { - #ifdef TEST - *logofs << "handleWrite: Going to hide XFree86-Bigfont extension in reply.\n" - << logofs_flush; - #endif - - hide = 1; - } - - #endif - - // - // This is if you want to experiment disabling SHAPE extensions. - // - - #ifdef HIDE_SHAPE_EXTENSION - - if (!strncmp((char *) outputMessage + 8, "SHAPE", 5)) - { - #ifdef DEBUG - *logofs << "handleWrite: Going to hide SHAPE extension in reply.\n" - << logofs_flush; - #endif - - hide = 1; - } - - #endif - - // - // Check if user disabled RENDER extension. - // - - if (control -> HideRender == 1 && - strncmp((char *) outputMessage + 8, "RENDER", 6) == 0) - { - #ifdef TEST - *logofs << "handleWrite: Going to hide RENDER extension in reply.\n" - << logofs_flush; - #endif - - hide = 1; - } - - unsigned int extension = 0; - - if (strncmp((char *) outputMessage + 8, "SHAPE", 5) == 0) - { - extension = X_NXInternalShapeExtension; - } - else if (strncmp((char *) outputMessage + 8, "RENDER", 6) == 0) - { - extension = X_NXInternalRenderExtension; - } - - sequenceQueue_.push(clientSequence_, outputOpcode, - outputOpcode, hide, extension); - } - break; - case X_QueryFont: - { - outputLength = 8; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 29, 5); - clientCache_ -> lastFont += value; - clientCache_ -> lastFont &= 0x1fffffff; - PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_SetClipRectangles: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_SetClipRectangles); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - break; - } - - unsigned int numRectangles; - - // Since ProtoStep9 (#issue 108) - decodeBuffer.decodeValue(numRectangles, 15, 4); - - outputLength = (numRectangles << 3) + 12; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeValue(value, 2); - outputMessage[1] = (unsigned char) value; - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> setClipRectanglesXCache, 8); - PutUINT(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> setClipRectanglesYCache, 8); - PutUINT(value, outputMessage + 10, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - for (unsigned int i = 0; i < numRectangles; i++) - { - for (unsigned int k = 0; k < 4; k++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache_ -> setClipRectanglesGeomCache[k], 8); - PutUINT(value, nextDest, bigEndian_); - nextDest += 2; - } - } - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_SetDashes: - { - unsigned int numDashes; - decodeBuffer.decodeCachedValue(numDashes, 16, - clientCache_ -> setDashesLengthCache, 5); - outputLength = 12 + RoundUp4(numDashes); - outputMessage = writeBuffer_.addMessage(outputLength); - PutUINT(numDashes, outputMessage + 10, bigEndian_); - decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> setDashesOffsetCache, 5); - PutUINT(value, outputMessage + 8, bigEndian_); - unsigned char *nextDest = outputMessage + 12; - for (unsigned int i = 0; i < numDashes; i++) - { - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> setDashesDashCache_[i & 1], 5); - *nextDest++ = cValue; - } - } - break; - case X_SetSelectionOwner: - { - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> setSelectionOwnerCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> getSelectionOwnerSelectionCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 32, - clientCache_ -> setSelectionOwnerTimestampCache, 9); - PutULONG(value, outputMessage + 12, bigEndian_); - } - break; - case X_TranslateCoords: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_TranslateCoords); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - sequenceQueue_.push(clientSequence_, outputOpcode); - - break; - } - - outputLength = 16; - outputMessage = writeBuffer_.addMessage(outputLength); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> translateCoordsSrcCache, 9); - PutULONG(value, outputMessage + 4, bigEndian_); - decodeBuffer.decodeCachedValue(value, 29, - clientCache_ -> translateCoordsDstCache, 9); - PutULONG(value, outputMessage + 8, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> translateCoordsXCache, 8); - PutUINT(value, outputMessage + 12, bigEndian_); - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> translateCoordsYCache, 8); - PutUINT(value, outputMessage + 14, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_GetImage: - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_GetImage); - - if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, - outputMessage, outputLength)) - { - sequenceQueue_.push(clientSequence_, outputOpcode); - - break; - } - - outputLength = 20; - outputMessage = writeBuffer_.addMessage(outputLength); - // Format. - unsigned int format; - decodeBuffer.decodeValue(format, 2); - outputMessage[1] = (unsigned char) format; - // Drawable. - decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); - PutULONG(value, outputMessage + 4, bigEndian_); - // X. - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> putImageXCache, 8); - clientCache_ -> putImageLastX += value; - clientCache_ -> putImageLastX &= 0xffff; - PutUINT(clientCache_ -> putImageLastX, outputMessage + 8, bigEndian_); - // Y. - decodeBuffer.decodeCachedValue(value, 16, - clientCache_ -> putImageYCache, 8); - clientCache_ -> putImageLastY += value; - clientCache_ -> putImageLastY &= 0xffff; - PutUINT(clientCache_ -> putImageLastY, outputMessage + 10, bigEndian_); - // Width. - unsigned int width; - decodeBuffer.decodeCachedValue(width, 16, - clientCache_ -> putImageWidthCache, 8); - PutUINT(width, outputMessage + 12, bigEndian_); - // Height. - unsigned int height; - decodeBuffer.decodeCachedValue(height, 16, - clientCache_ -> putImageHeightCache, 8); - PutUINT(height, outputMessage + 14, bigEndian_); - // Plane mask. - decodeBuffer.decodeCachedValue(value, 32, - clientCache_ -> getImagePlaneMaskCache, 5); - PutULONG(value, outputMessage + 16, bigEndian_); - - sequenceQueue_.push(clientSequence_, outputOpcode); - - handleSave(messageStore, outputMessage, outputLength); - } - break; - case X_GetPointerMapping: - { - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - case X_GetKeyboardControl: - { - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - - sequenceQueue_.push(clientSequence_, outputOpcode); - } - break; - default: - { - if (outputOpcode == opcodeStore_ -> renderExtension) - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXInternalRenderExtension); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> shapeExtension) - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXInternalShapeExtension); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> putPackedImage) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding packed image request for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXPutPackedImage); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - - if (outputOpcode == opcodeStore_ -> putPackedImage) - { - handleImage(outputOpcode, outputMessage, outputLength); - } - } - else if (outputOpcode == opcodeStore_ -> setUnpackColormap) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding set unpack colormap request " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXSetUnpackColormap); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - // - // Message could have been split. - // - - if (outputOpcode == opcodeStore_ -> setUnpackColormap) - { - handleColormap(outputOpcode, outputMessage, outputLength); - } - } - else if (outputOpcode == opcodeStore_ -> setUnpackAlpha) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding unpack alpha request for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXSetUnpackAlpha); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - // - // Message could have been split. - // - - if (outputOpcode == opcodeStore_ -> setUnpackAlpha) - { - handleAlpha(outputOpcode, outputMessage, outputLength); - } - } - else if (outputOpcode == opcodeStore_ -> setUnpackGeometry) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding set unpack geometry request " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXSetUnpackGeometry); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - - handleGeometry(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> startSplit) - { - handleStartSplitRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> endSplit) - { - handleEndSplitRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> commitSplit) - { - int result = handleCommitSplitRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength); - - // - // Check if message has been successfully - // extracted from the split store. In this - // case post-process it in the usual way. - // - - if (result > 0) - { - if (outputOpcode == opcodeStore_ -> putPackedImage || - outputOpcode == X_PutImage) - { - handleImage(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> setUnpackColormap) - { - handleColormap(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> setUnpackAlpha) - { - handleAlpha(outputOpcode, outputMessage, outputLength); - } - } - else if (result < 0) - { - return -1; - } - } - else if (outputOpcode == opcodeStore_ -> abortSplit) - { - handleAbortSplitRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> finishSplit) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding finish split request " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> resourceCache); - - handleNullRequest(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> freeSplit) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding free split request " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> resourceCache); - - handleNullRequest(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> freeUnpack) - { - #ifdef DEBUG - *logofs << "handleWrite: Decoding free unpack request " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache_ -> resourceCache); - - #ifdef DEBUG - *logofs << "handleWrite: Freeing unpack state for resource " - << (unsigned int) cValue << ".\n" << logofs_flush; - #endif - - handleUnpackStateRemove(cValue); - - handleNullRequest(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> setExposeParameters) - { - // - // Send expose events according to agent's wish. - // - - decodeBuffer.decodeBoolValue(enableExpose_); - decodeBuffer.decodeBoolValue(enableGraphicsExpose_); - decodeBuffer.decodeBoolValue(enableNoExpose_); - - handleNullRequest(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> getUnpackParameters) - { - // - // Client proxy needs the list of supported - // unpack methods. We would need an encode - // buffer, but this is in proxy, not here in - // channel. - // - - #ifdef TEST - *logofs << "handleWrite: Sending X_GetInputFocus request for FD#" - << fd_ << " due to OPCODE#" << (unsigned int) outputOpcode - << ".\n" << logofs_flush; - #endif - - outputOpcode = X_GetInputFocus; - - outputLength = 4; - outputMessage = writeBuffer_.addMessage(outputLength); - - sequenceQueue_.push(clientSequence_, outputOpcode, - opcodeStore_ -> getUnpackParameters); - } - else if (outputOpcode == opcodeStore_ -> getControlParameters || - outputOpcode == opcodeStore_ -> getCleanupParameters || - outputOpcode == opcodeStore_ -> getImageParameters) - { - handleNullRequest(outputOpcode, outputMessage, outputLength); - } - else if (outputOpcode == opcodeStore_ -> getShmemParameters) - { - if (handleShmemRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength) < 0) - { - return -1; - } - } - else if (outputOpcode == opcodeStore_ -> setCacheParameters) - { - if (handleCacheRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength) < 0) - { - return -1; - } - } - else if (outputOpcode == opcodeStore_ -> getFontParameters) - { - if (handleFontRequest(decodeBuffer, outputOpcode, - outputMessage, outputLength) < 0) - { - return -1; - } - } - else - { - MessageStore *messageStore = clientStore_ -> - getRequestStore(X_NXInternalGenericRequest); - - hit = handleDecode(decodeBuffer, clientCache_, messageStore, - outputOpcode, outputMessage, outputLength); - } - } - } // End of switch on opcode. - - // - // TODO: at the moment the variable hit was being set - // but not used, so to avoid the corresponding warning - // this logging block has been added. - // This code will probably be optimized away when none - // of the defines is set, but if there is no additional - // use for the hit variable in the future, then maybe - // it could be removed completely. - // - - if (hit) - { - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: Cached flag enabled in handled request.\n" - << logofs_flush; - #endif - } - - // - // A packed image request can generate more than just - // a single X_PutImage. Write buffer is handled inside - // handleUnpack(). Cannot simply assume that the final - // opcode and size must be put at the buffer offset as - // as buffer could have been grown or could have been - // replaced by a scratch buffer. The same is true in - // the case of a shared memory image. - // - - if (outputOpcode != 0) - { - // - // Commit opcode and size to the buffer. - // - - *outputMessage = (unsigned char) outputOpcode; - - PutUINT(outputLength >> 2, outputMessage + 2, bigEndian_); - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleWrite: Handled request OPCODE#" - << (unsigned int) outputOpcode << " (" - << DumpOpcode(outputOpcode) << ") for FD#" - << fd_ << " sequence " << clientSequence_ - << ". " << outputLength << " bytes out.\n" - << logofs_flush; - #endif - } - #if defined(TEST) || defined(OPCODES) - else - { - // - // In case of shared memory images the log doesn't - // reflect the actual opcode of the request that is - // going to be written. It would be possible to find - // the opcode of the original request received from - // the remote proxy in member imageState_ -> opcode, - // but we have probably already deleted the struct. - // - - *logofs << "handleWrite: Handled image request for FD#" - << fd_ << " new sequence " << clientSequence_ - << ". " << outputLength << " bytes out.\n" - << logofs_flush; - } - #endif - - // - // Check if we produced enough data. We need to - // decode all the proxy messages or the decode - // buffer will be left in an inconsistent state, - // so we just update the finish flag in case of - // failure. - // - - handleFlush(flush_if_needed); - - } // End of while (decodeBuffer.decodeOpcodeValue(outputOpcode, 8, ... - - } // End of the decoding block. - - // - // Write any remaining data to the X connection. - // - - if (handleFlush(flush_if_any) < 0) - { - return -1; - } - - // - // Reset offset at which we read the - // last event looking for the shared - // memory completion. - // - - if (shmemState_ != NULL) - { - shmemState_ -> checked = 0; - } - - return 1; -} - -// -// End of handleWrite(). -// - -// -// Other members. -// - -int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, - T_store_action action, int position, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // Since ProtoStep7 (#issue 108) - splitState_.current = splitState_.resource; - - handleSplitStoreAlloc(&splitResources_, splitState_.current); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Message OPCODE#" - << (unsigned int) store -> opcode() << " of size " << size - << " [split] with resource " << splitState_.current - << " position " << position << " and action [" - << DumpAction(action) << "] at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - // - // Get the MD5 of the message being - // split. - // - - T_checksum checksum = NULL; - - if (action != IS_HIT) - { - handleSplitChecksum(decodeBuffer, checksum); - } - - // - // The method must abort the connection - // if it can't allocate the split. - // - - Split *splitMessage = clientStore_ -> getSplitStore(splitState_.current) -> - add(store, splitState_.current, position, - action, checksum, buffer, size); - - // - // If the encoding side didn't provide - // a checksum, then don't send the split - // report. - // - - if (checksum == NULL) - { - if (action == IS_HIT) - { - splitMessage -> setState(split_loaded); - } - else - { - splitMessage -> setState(split_missed); - } - - #if defined(TEST) || defined(SPLIT) - - *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> - getSplitTotalSize() << " messages and " << clientStore_ -> - getSplitTotalStorageSize() << " bytes to send in " - << "the split stores.\n" << logofs_flush; - - clientStore_ -> dumpSplitStore(splitState_.current); - - #endif - - return 1; - } - - delete [] checksum; - - // - // Tell the split store if it must use - // the disk cache to retrieve and save - // the message. - // - - splitMessage -> setPolicy(splitState_.load, splitState_.save); - - // - // Try to locate the message on disk. - // - - if (clientStore_ -> getSplitStore(splitState_.current) -> - load(splitMessage) == 1) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Loaded the message " - << "from the image cache.\n" << logofs_flush; - #endif - - splitMessage -> setState(split_loaded); - } - else - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: WARNING! SPLIT! Can't find the message " - << "in the image cache.\n" << logofs_flush; - #endif - - splitMessage -> setState(split_missed); - } - - #if defined(TEST) || defined(SPLIT) - - T_timestamp startTs = getTimestamp(); - - *logofs << "handleSplit: SPLIT! Encoding abort " - << "split events for FD#" << fd_ << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - - if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) - { - return -1; - } - - // - // Send the encoded data immediately. We - // want the abort split message to reach - // the remote proxy as soon as possible. - // - - if (proxy -> handleAsyncFlush() < 0) - { - return -1; - } - - #if defined(TEST) || defined(SPLIT) - - *logofs << "handleSplit: SPLIT! Spent " - << diffTimestamp(startTs, getTimestamp()) << " Ms " - << "handling abort split events for FD#" << fd_ - << ".\n" << logofs_flush; - - *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> - getSplitTotalSize() << " messages and " << clientStore_ -> - getSplitTotalStorageSize() << " bytes to send in " - << "the split stores.\n" << logofs_flush; - - clientStore_ -> dumpSplitStore(splitState_.current); - - #endif - - return 1; -} - -int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer) -{ - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Going to handle splits " - << "for FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - unsigned char resource; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - splitState_.current = resource; - - handleSplitStoreAlloc(&splitResources_, splitState_.current); - - SplitStore *splitStore = clientStore_ -> getSplitStore(splitState_.current); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Handling splits for " - << "resource [" << splitState_.current << "] with " - << splitStore -> getSize() << " elements " - << "in the split store.\n" << logofs_flush; - #endif - - int result = splitStore -> receive(decodeBuffer); - - if (result < 0) - { - #ifdef PANIC - *logofs << "handleSplit: PANIC! Receive of split for FD#" << fd_ - << " failed.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Receive of split for FD#" << fd_ - << " failed.\n"; - - return -1; - } - else if (result == 0) - { - // - // The split is still incomplete. It's time - // to check if we need to start the house- - // keeping process to take care of the image - // cache. - // - - if (proxy -> handleAsyncKeeperCallback() < 0) - { - return -1; - } - } - else - { - // - // Note that we don't need the resource id at the - // X server side and, thus, we don't provide it - // at the time we add split to the split store. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Remote agent should " - << "now commit a new split for resource [" - << splitState_.current << "].\n" - << logofs_flush; - - clientStore_ -> dumpCommitStore(); - - #endif - - if (splitStore -> getSize() == 0) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! Removing split store " - << "for resource [" << splitState_.current - << "] at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - handleSplitStoreRemove(&splitResources_, splitState_.current); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: SPLIT! There are [" << clientStore_ -> - getSplitTotalSize() << "] messages and " << clientStore_ -> - getSplitTotalStorageSize() << " bytes to send in " - << "the split stores.\n" << logofs_flush; - #endif - } - else - { - // - // If the next split is discarded, it can be - // that, since the beginning of the split, we - // have saved the message on the disk, due to - // a more recent split operation. This is also - // the case when we had to discard the message - // because it was locked but, since then, we - // completed the transferral of the split. - // - - Split *splitMessage = splitStore -> getFirstSplit(); - - if (splitMessage -> getAction() == is_discarded && - splitMessage -> getState() == split_missed && - splitStore -> load(splitMessage) == 1) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplit: WARNING! SPLIT! Asynchronously " - << "loaded the message from the image cache.\n" - << logofs_flush; - #endif - - splitMessage -> setState(split_loaded); - - #if defined(TEST) || defined(SPLIT) - - T_timestamp startTs = getTimestamp(); - - *logofs << "handleSplit: WARNING! SPLIT! Asynchronously " - << "encoding abort split events for FD#" << fd_ - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) - { - return -1; - } - - // - // Send the encoded data immediately. We - // want the abort split message to reach - // the remote proxy as soon as possible. - // - - if (proxy -> handleAsyncFlush() < 0) - { - return -1; - } - - #if defined(TEST) || defined(SPLIT) - - *logofs << "handleSplit: WARNING! SPLIT! Spent " - << diffTimestamp(startTs, getTimestamp()) << " Ms " - << "handling asynchronous abort split events for " - << "FD#" << fd_ << ".\n" << logofs_flush; - - *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> - getSplitTotalSize() << " messages and " << clientStore_ -> - getSplitTotalStorageSize() << " bytes to send in " - << "the split stores.\n" << logofs_flush; - - clientStore_ -> dumpSplitStore(splitState_.current); - - #endif - } - } - } - - return 1; -} - -int ServerChannel::handleSplitEvent(EncodeBuffer &encodeBuffer, Split *splitMessage) -{ - int resource = splitMessage -> getResource(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Going to send a " - << "split report for resource " << resource - << ".\n" << logofs_flush; - #endif - - // - // This function is called only after the message - // has been searched in the disk cache. We need to - // inform the other side if the data transfer can - // start or it must be aborted to let the local - // side use the copy that was found on the disk. - // - - #if defined(TEST) || defined(INFO) - - if (splitMessage -> getState() != split_loaded && - splitMessage -> getState() != split_missed) - { - *logofs << "handleSplitEvent: PANIC! Can't find the split to be aborted.\n" - << logofs_flush; - - HandleCleanup(); - } - - #endif - - // - // We need to send a boolean telling if the split - // was found or not, followed by the checksum of - // message we are referencing. - // - - T_checksum checksum = splitMessage -> getChecksum(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Sending split report for " - << "checksum [" << DumpChecksum(checksum) << "].\n" - << logofs_flush; - #endif - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - encodeBuffer.encodeOpcodeValue(opcodeStore_ -> splitEvent, - serverCache_ -> opcodeCache); - - // - // The encoding in older protocol versions - // is different but we will never try to - // send a split report if the remote does - // not support our version. - // - - encodeBuffer.encodeCachedValue(resource, 8, - serverCache_ -> resourceCache); - - if (splitMessage -> getState() == split_loaded) - { - encodeBuffer.encodeBoolValue(1); - - encodeBuffer.encodeOpcodeValue(splitMessage -> getStore() -> opcode(), - serverCache_ -> abortOpcodeCache); - - encodeBuffer.encodeValue(splitMessage -> compressedSize(), 32, 14); - } - else - { - encodeBuffer.encodeBoolValue(0); - } - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - encodeBuffer.encodeValue((unsigned int) checksum[i], 8); - } - - // - // Update statistics for this special opcode. - // - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) || defined(INFO) || defined(SPLIT) - *logofs << "handleSplitEvent: SPLIT! Handled event OPCODE#" - << (unsigned int) opcodeStore_ -> splitEvent << " (" - << DumpOpcode(opcodeStore_ -> splitEvent) << ")" << " for FD#" - << fd_ << " sequence none. 0 bytes in, " << bits << " bits (" - << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; - #endif - - statistics -> addEventBits(opcodeStore_ -> splitEvent, 0, bits); - - return 1; -} - -int ServerChannel::handleAbortSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - unsigned char resource; - - decodeBuffer.decodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Handling abort split " - << "request for FD#" << fd_ << " and resource " - << (unsigned) resource << ".\n" - << logofs_flush; - #endif - - int splits = 0; - - SplitStore *splitStore = clientStore_ -> getSplitStore(resource); - - if (splitStore != NULL) - { - // - // Discard from the memory cache the messages - // that are still incomplete and then get rid - // of the splits in the store. - // - - #if defined(TEST) || defined(SPLIT) - - clientStore_ -> dumpSplitStore(resource); - - #endif - - Split *splitMessage; - - for (;;) - { - splitMessage = splitStore -> getFirstSplit(); - - if (splitMessage == NULL) - { - // - // Check if we had created the store - // but no message was added yet. - // - - #ifdef WARNING - - if (splits == 0) - { - *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " - << "split store for resource [" << (unsigned int) - resource << "] is unexpectedly empty.\n" - << logofs_flush; - } - - #endif - - break; - } - - // - // Splits already aborted can't be in the - // split store. - // - - #if defined(TEST) || defined(SPLIT) - - if (splitMessage -> getState() == split_aborted) - { - *logofs << "handleAbortSplitRequest: PANIC! SPLIT! Found an " - << "aborted split in store [" << (unsigned int) resource - << "].\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - if (splitMessage -> getAction() == IS_HIT) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Removing the " - << "split from the memory cache.\n" - << logofs_flush; - #endif - - splitMessage -> getStore() -> remove(splitMessage -> getPosition(), - discard_checksum, use_data); - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Removing the " - << "split from the split store.\n" - << logofs_flush; - #endif - - splitMessage = splitStore -> pop(); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleAbortSplitRequest: SPLIT! Freeing up the " - << "aborted split.\n" << logofs_flush; - #endif - - delete splitMessage; - - splits++; - } - } - #ifdef WARNING - else - { - *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " - << "split store for resource [" << (unsigned int) - resource << "] is already empty.\n" - << logofs_flush; - } - #endif - - handleNullRequest(opcode, buffer, size); - - return (splits > 0); -} - -int ServerChannel::handleCommitSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // Get request type and position of the image - // to commit. - // - - unsigned char request; - - decodeBuffer.decodeOpcodeValue(request, clientCache_ -> opcodeCache); - - unsigned int diffCommit; - - decodeBuffer.decodeValue(diffCommit, 32, 5); - - splitState_.commit += diffCommit; - - unsigned char resource = 0; - unsigned int commit = 1; - - // - // Send the resource id and the commit flag. - // The resource id is ignored at the moment. - // The message will be handled based on the - // resource id that was sent together with - // the original message. - // - - decodeBuffer.decodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - decodeBuffer.decodeBoolValue(commit); - - Split *split = handleSplitCommitRemove(request, resource, splitState_.commit); - - if (split == NULL) - { - return -1; - } - - clientStore_ -> getCommitStore() -> update(split); - - if (commit == 1) - { - #if defined(TEST) || defined(SPLIT) - *logofs << "handleCommitSplitRequest: SPLIT! Handling split commit " - << "for FD#" << fd_ << " with commit " << commit - << " request " << (unsigned) request << " resource " - << (unsigned) resource << " and position " - << splitState_.commit << ".\n" - << logofs_flush; - #endif - - // - // Allocate as many bytes in the write - // buffer as the final length of the - // message in uncompressed form. - // - - size = split -> plainSize(); - - buffer = writeBuffer_.addMessage(size); - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleCommitSplitRequest: SPLIT! Prepared an " - << "outgoing buffer of " << size << " bytes.\n" - << logofs_flush; - #endif - - if (clientStore_ -> getCommitStore() -> expand(split, buffer, size) < 0) - { - writeBuffer_.removeMessage(size); - - commit = 0; - } - } - - // - // Free the split. - // - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleCommitSplitRequest: SPLIT! Freeing up the " - << "committed split.\n" << logofs_flush; - #endif - - delete split; - - // - // Discard the operation and send a null - // message. - // - - if (commit == 0) - { - handleNullRequest(opcode, buffer, size); - } - else - { - // - // Save the sequence number to be able - // to mask any error generated by the - // request. - // - - updateCommitQueue(clientSequence_); - - // - // Now in the write buffer there is - // a copy of this request. - // - - opcode = request; - } - - return commit; -} - -int ServerChannel::handleGeometry(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - // - // Replace the old geometry and taint - // the message into a X_NoOperation. - // - - int resource = *(buffer + 1); - - #ifdef TEST - *logofs << "handleGeometry: Setting new unpack geometry " - << "for resource " << resource << ".\n" - << logofs_flush; - #endif - - handleUnpackStateInit(resource); - - handleUnpackAllocGeometry(resource); - - unpackState_[resource] -> geometry -> depth1_bpp = *(buffer + 4); - unpackState_[resource] -> geometry -> depth4_bpp = *(buffer + 5); - unpackState_[resource] -> geometry -> depth8_bpp = *(buffer + 6); - unpackState_[resource] -> geometry -> depth16_bpp = *(buffer + 7); - unpackState_[resource] -> geometry -> depth24_bpp = *(buffer + 8); - unpackState_[resource] -> geometry -> depth32_bpp = *(buffer + 9); - - unpackState_[resource] -> geometry -> red_mask = GetULONG(buffer + 12, bigEndian_); - unpackState_[resource] -> geometry -> green_mask = GetULONG(buffer + 16, bigEndian_); - unpackState_[resource] -> geometry -> blue_mask = GetULONG(buffer + 20, bigEndian_); - - handleCleanAndNullRequest(opcode, buffer, size); - - return 1; -} - -int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - // - // Replace the old colormap and taint - // the message into a X_NoOperation. - // - - int resource = *(buffer + 1); - - #ifdef TEST - *logofs << "handleColormap: Setting new unpack colormap " - << "for resource " << resource << ".\n" - << logofs_flush; - #endif - - handleUnpackStateInit(resource); - - handleUnpackAllocColormap(resource); - - // - // New protocol versions send the alpha - // data in compressed form. - // - - // - // Since ProtoStep7 (#issue 108) - // - - { // An anonymous block is used here to limit the scope of local variables - unsigned int packed = GetULONG(buffer + 8, bigEndian_); - unsigned int unpacked = GetULONG(buffer + 12, bigEndian_); - - validateSize("colormap", packed, unpacked, 16, size); - - if (unpackState_[resource] -> colormap -> entries != unpacked >> 2 && - unpackState_[resource] -> colormap -> data != NULL) - { - #ifdef TEST - *logofs << "handleColormap: Freeing previously allocated " - << "unpack colormap data.\n" << logofs_flush; - #endif - - delete [] unpackState_[resource] -> colormap -> data; - - unpackState_[resource] -> colormap -> data = NULL; - unpackState_[resource] -> colormap -> entries = 0; - } - - #ifdef TEST - *logofs << "handleColormap: Setting " << unpacked - << " bytes of unpack colormap data for resource " - << resource << ".\n" << logofs_flush; - #endif - - if (unpackState_[resource] -> colormap -> data == NULL) - { - unpackState_[resource] -> colormap -> data = - (unsigned int *) new unsigned char[unpacked]; - - if (unpackState_[resource] -> colormap -> data == NULL) - { - #ifdef PANIC - *logofs << "handleColormap: PANIC! Can't allocate " - << unpacked << " entries for unpack colormap data " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - goto handleColormapEnd; - } - - #ifdef DEBUG - *logofs << "handleColormap: Size of new colormap data is " - << unpacked << ".\n" << logofs_flush; - #endif - } - - unsigned int method = *(buffer + 4); - - if (method == PACK_COLORMAP) - { - if (UnpackColormap(method, buffer + 16, packed, - (unsigned char *) unpackState_[resource] -> - colormap -> data, unpacked) < 0) - { - #ifdef PANIC - *logofs << "handleColormap: PANIC! Can't unpack " << packed - << " bytes to " << unpacked << " entries for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - delete [] unpackState_[resource] -> colormap -> data; - - unpackState_[resource] -> colormap -> data = NULL; - unpackState_[resource] -> colormap -> entries = 0; - - goto handleColormapEnd; - } - } - else - { - memcpy((unsigned char *) unpackState_[resource] -> - colormap -> data, buffer + 16, unpacked); - } - - unpackState_[resource] -> colormap -> entries = unpacked >> 2; - - #if defined(DEBUG) && defined(DUMP) - - *logofs << "handleColormap: Dumping colormap entries:\n" - << logofs_flush; - - const unsigned char *p = (const unsigned char *) unpackState_[resource] -> colormap -> data; - - for (unsigned int i = 0; i < unpackState_[resource] -> - colormap -> entries; i++) - { - *logofs << "handleColormap: [" << i << "] [" - << (void *) ((int) p[i]) << "].\n" - << logofs_flush; - } - - #endif - } // end anonymous block - -handleColormapEnd: - - handleCleanAndNullRequest(opcode, buffer, size); - - return 1; -} - -int ServerChannel::handleAlpha(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - int resource = *(buffer + 1); - - #ifdef TEST - *logofs << "handleAlpha: Setting new unpack alpha " - << "for resource " << resource << ".\n" - << logofs_flush; - #endif - - handleUnpackStateInit(resource); - - handleUnpackAllocAlpha(resource); - - // - // New protocol versions send the alpha - // data in compressed form. - // - - // - // Since ProtoStep7 (#issue 108) - // - - { // An anonymous block is used here to limit the scope of local variables - unsigned int packed = GetULONG(buffer + 8, bigEndian_); - unsigned int unpacked = GetULONG(buffer + 12, bigEndian_); - - validateSize("alpha", packed, unpacked, 16, size); - - if (unpackState_[resource] -> alpha -> entries != unpacked && - unpackState_[resource] -> alpha -> data != NULL) - { - #ifdef TEST - *logofs << "handleAlpha: Freeing previously allocated " - << "unpack alpha data.\n" << logofs_flush; - #endif - - delete [] unpackState_[resource] -> alpha -> data; - - unpackState_[resource] -> alpha -> data = NULL; - unpackState_[resource] -> alpha -> entries = 0; - } - - #ifdef TEST - *logofs << "handleAlpha: Setting " << unpacked - << " bytes of unpack alpha data for resource " - << resource << ".\n" << logofs_flush; - #endif - - if (unpackState_[resource] -> alpha -> data == NULL) - { - unpackState_[resource] -> alpha -> data = new unsigned char[unpacked]; - - if (unpackState_[resource] -> alpha -> data == NULL) - { - #ifdef PANIC - *logofs << "handleAlpha: PANIC! Can't allocate " - << unpacked << " entries for unpack alpha data " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - goto handleAlphaEnd; - } - - #ifdef DEBUG - *logofs << "handleAlpha: Size of new alpha data is " - << unpacked << ".\n" << logofs_flush; - #endif - } - - unsigned int method = *(buffer + 4); - - if (method == PACK_ALPHA) - { - if (UnpackAlpha(method, buffer + 16, packed, - unpackState_[resource] -> alpha -> - data, unpacked) < 0) - { - #ifdef PANIC - *logofs << "handleAlpha: PANIC! Can't unpack " << packed - << " bytes to " << unpacked << " entries for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - delete [] unpackState_[resource] -> alpha -> data; - - unpackState_[resource] -> alpha -> data = NULL; - unpackState_[resource] -> alpha -> entries = 0; - - goto handleAlphaEnd; - } - } - else - { - memcpy((unsigned char *) unpackState_[resource] -> - alpha -> data, buffer + 16, unpacked); - } - - unpackState_[resource] -> alpha -> entries = unpacked; - - #if defined(DEBUG) && defined(DUMP) - - *logofs << "handleAlpha: Dumping alpha entries:\n" - << logofs_flush; - - const unsigned char *p = unpackState_[resource] -> alpha -> data; - - for (unsigned int i = 0; i < unpackState_[resource] -> - alpha -> entries; i++) - { - *logofs << "handleAlpha: [" << i << "] [" - << (void *) ((int) p[i]) << "].\n" - << logofs_flush; - } - - #endif - } //end anonymous block - -handleAlphaEnd: - - handleCleanAndNullRequest(opcode, buffer, size); - - return 1; -} - -int ServerChannel::handleImage(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - int result = 1; - - // - // Save the original opcode together with - // the image state so we can later find if - // this is a plain or a packed image when - // moving data to the shared memory area. - // - - handleImageStateAlloc(opcode); - - if (opcode == opcodeStore_ -> putPackedImage) - { - // - // Unpack the image and put a X_PutImage in a - // new buffer. Save the expected output size, - // so, in the case of a decoding error we can - // still update the statistics. - // - - int length = GetULONG(buffer + 20, bigEndian_); - - #ifdef TEST - *logofs << "handleImage: Sending image for FD#" << fd_ - << " due to OPCODE#" << (unsigned int) opcode << " with " - << GetULONG(buffer + 16, bigEndian_) << " bytes packed " - << "and " << GetULONG(buffer + 20, bigEndian_) - << " bytes unpacked.\n" << logofs_flush; - #endif - - statistics -> addPackedBytesIn(size); - - result = handleUnpack(opcode, buffer, size); - - if (result < 0) - { - // - // Recover from the error. Send a X_NoOperation - // to keep the sequence counter in sync with - // the remote peer. - // - - size = 4; - buffer = writeBuffer_.addMessage(size); - - *buffer = X_NoOperation; - - PutUINT(size >> 2, buffer + 2, bigEndian_); - - #ifdef PANIC - *logofs << "handleImage: PANIC! Sending X_NoOperation for FD#" - << fd_ << " to recover from failed unpack.\n" - << logofs_flush; - #endif - - // - // Set the output length to reflect the amount of - // data that would have been produced by unpacking - // the image. This is advisable to keep the count- - // ers in sync with those at remote proxy. Setting - // the size here doesn't have any effect on the - // size of data sent to the X server as the actual - // size will be taken from the content of the write - // buffer. - // - - size = length; - } - - statistics -> addPackedBytesOut(size); - - // - // Refrain the write loop from putting - // opcode and size in the output buffer. - // - - opcode = 0; - } - - // - // Now image is unpacked as a X_PutImage - // in write buffer. Check if we can send - // the image using the MIT-SHM extension. - // - - if (result > 0) - { - result = handleShmem(opcode, buffer, size); - - // - // We already put opcode and size in - // the resulting buffer. - // - - if (result > 0) - { - opcode = 0; - } - } - - return 1; -} - -int ServerChannel::handleMotion(EncodeBuffer &encodeBuffer) -{ - #if defined(TEST) || defined(INFO) - - if (lastMotion_[0] == '\0') - { - *logofs << "handleMotion: PANIC! No motion events to send " - << "for FD#" << fd_ << ".\n" << logofs_flush; - - HandleCleanup(); - } - - #endif - - #if defined(TEST) || defined(INFO) - *logofs << "handleMotion: Sending motion events for FD#" - << fd_ << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - // - // Replicate code from read loop. When have - // time and wish, try to split everything - // in functions. - // - - if (proxy -> handleAsyncSwitch(fd_) < 0) - { - return -1; - } - - const unsigned char *buffer = lastMotion_; - unsigned char opcode = *lastMotion_; - unsigned int size = 32; - - if (GetUINT(buffer + 2, bigEndian_) < serverSequence_) - { - PutUINT(serverSequence_, (unsigned char *) buffer + 2, bigEndian_); - } - - encodeBuffer.encodeOpcodeValue(opcode, serverCache_ -> opcodeCache); - - unsigned int sequenceNum = GetUINT(buffer + 2, bigEndian_); - - unsigned int sequenceDiff = sequenceNum - serverSequence_; - - serverSequence_ = sequenceNum; - - #ifdef DEBUG - *logofs << "handleMotion: Last server sequence number for FD#" - << fd_ << " is " << serverSequence_ << " with " - << "difference " << sequenceDiff << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(sequenceDiff, 16, - serverCache_ -> eventSequenceCache, 7); - - // - // If we fast encoded the message - // then skip the rest. - // - - if (control -> LocalDeltaCompression == 0) - { - int result = handleFastReadEvent(encodeBuffer, opcode, - buffer, size); - - #ifdef DEBUG - *logofs << "handleMotion: Sent saved motion event for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - lastMotion_[0] = '\0'; - - #ifdef DEBUG - *logofs << "handleMotion: Reset last motion event for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - if (result < 0) - { - return -1; - } - else if (result > 0) - { - return 1; - } - } - - // - // This should be just the part specific - // for motion events but is currently a - // copy-paste of code from the read loop. - // - - unsigned char detail = buffer[1]; - if (*buffer == MotionNotify) - encodeBuffer.encodeBoolValue((unsigned int) detail); - else if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) - encodeBuffer.encodeValue((unsigned int) detail, 3); - else if (*buffer == KeyRelease) - { - if (detail == serverCache_ -> keyPressLastKey) - encodeBuffer.encodeBoolValue(1); - else - { - encodeBuffer.encodeBoolValue(0); - encodeBuffer.encodeValue((unsigned int) detail, 8); - } - } - else if ((*buffer == ButtonPress) || (*buffer == ButtonRelease)) - encodeBuffer.encodeCachedValue(detail, 8, - serverCache_ -> buttonCache); - else - encodeBuffer.encodeValue((unsigned int) detail, 8); - unsigned int timestamp = GetULONG(buffer + 4, bigEndian_); - unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; - serverCache_ -> lastTimestamp = timestamp; - encodeBuffer.encodeCachedValue(timestampDiff, 32, - serverCache_ -> motionNotifyTimestampCache, 9); - int skipRest = 0; - if (*buffer == KeyRelease) - { - skipRest = 1; - for (unsigned int i = 8; i < 31; i++) - { - if (buffer[i] != serverCache_ -> keyPressCache[i - 8]) - { - skipRest = 0; - break; - } - } - encodeBuffer.encodeBoolValue(skipRest); - } - if (!skipRest) - { - const unsigned char *nextSrc = buffer + 8; - for (unsigned int i = 0; i < 3; i++) - { - encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, - *serverCache_ -> motionNotifyWindowCache[i], 6); - nextSrc += 4; - } - unsigned int rootX = GetUINT(buffer + 20, bigEndian_); - unsigned int rootY = GetUINT(buffer + 22, bigEndian_); - unsigned int eventX = GetUINT(buffer + 24, bigEndian_); - unsigned int eventY = GetUINT(buffer + 26, bigEndian_); - eventX -= rootX; - eventY -= rootY; - encodeBuffer.encodeCachedValue(rootX - - serverCache_ -> motionNotifyLastRootX, 16, - serverCache_ -> motionNotifyRootXCache, 6); - serverCache_ -> motionNotifyLastRootX = rootX; - encodeBuffer.encodeCachedValue(rootY - - serverCache_ -> motionNotifyLastRootY, 16, - serverCache_ -> motionNotifyRootYCache, 6); - serverCache_ -> motionNotifyLastRootY = rootY; - encodeBuffer.encodeCachedValue(eventX, 16, - serverCache_ -> motionNotifyEventXCache, 6); - encodeBuffer.encodeCachedValue(eventY, 16, - serverCache_ -> motionNotifyEventYCache, 6); - encodeBuffer.encodeCachedValue(GetUINT(buffer + 28, bigEndian_), - 16, serverCache_ -> motionNotifyStateCache); - if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) - encodeBuffer.encodeValue((unsigned int) buffer[30], 2); - else - encodeBuffer.encodeBoolValue((unsigned int) buffer[30]); - if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) - encodeBuffer.encodeValue((unsigned int) buffer[31], 2); - else if (*buffer == KeyPress) - { - serverCache_ -> keyPressLastKey = detail; - for (unsigned int i = 8; i < 31; i++) - { - serverCache_ -> keyPressCache[i - 8] = buffer[i]; - } - } - } - - // - // Print info about achieved compression - // and update the statistics. - // - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleMotion: Handled event OPCODE#" << (unsigned int) buffer[0] - << " for FD#" << fd_ << " sequence " << sequenceNum << ". " - << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - #endif - - statistics -> addEventBits(*buffer, size << 3, bits); - - #ifdef DEBUG - *logofs << "handleMotion: Sent saved motion event for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - lastMotion_[0] = '\0'; - - #ifdef DEBUG - *logofs << "handleMotion: Reset last motion event for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ServerChannel::handleConfiguration() -{ - #ifdef TEST - *logofs << "ServerChannel: Setting new buffer parameters " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - readBuffer_.setSize(control -> ServerInitialReadSize, - control -> ServerMaximumBufferSize); - - writeBuffer_.setSize(control -> TransportXBufferSize, - control -> TransportXBufferThreshold, - control -> TransportMaximumBufferSize); - - transport_ -> setSize(control -> TransportXBufferSize, - control -> TransportXBufferThreshold, - control -> TransportMaximumBufferSize); - return 1; -} - -int ServerChannel::handleFinish() -{ - #ifdef TEST - *logofs << "ServerChannel: Finishing connection for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - congestion_ = 0; - priority_ = 0; - - finish_ = 1; - - // - // Reset the motion event. - // - - lastMotion_[0] = '\0'; - - transport_ -> fullReset(); - - return 1; -} - -int ServerChannel::handleAsyncEvents() -{ - // - // Encode more events while decoding the - // proxy messages. - // - - if (transport_ -> readable() > 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleAsyncEvents: WARNING! Encoding events " - << "for FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - #if defined(TEST) || defined(INFO) - - T_timestamp startTs = getTimestamp(); - - #endif - - if (proxy -> handleAsyncRead(fd_) < 0) - { - return -1; - } - - #if defined(TEST) || defined(INFO) - *logofs << "handleAsyncEvents: Spent " << diffTimestamp(startTs, - getTimestamp()) << " Ms handling events for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return 1; - } - - return 0; -} - -int ServerChannel::handleUnpack(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - int resource = *(buffer + 1); - - #ifdef DEBUG - *logofs << "handleUnpack: Unpacking image for resource " << resource - << " with method " << (unsigned int) *(buffer + 12) - << ".\n" << logofs_flush; - #endif - - handleUnpackStateInit(resource); - - T_geometry *geometryState = unpackState_[resource] -> geometry; - T_colormap *colormapState = unpackState_[resource] -> colormap; - T_alpha *alphaState = unpackState_[resource] -> alpha; - - if (geometryState == NULL) - { - #ifdef PANIC - *logofs << "handleUnpack: PANIC! Missing geometry unpacking " - << "image for resource " << resource << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Missing geometry unpacking " - << "image for resource " << resource << ".\n"; - - return -1; - } - - // - // Get the image data from the buffer. - // - - imageState_ -> drawable = GetULONG(buffer + 4, bigEndian_); - imageState_ -> gcontext = GetULONG(buffer + 8, bigEndian_); - - imageState_ -> method = *(buffer + 12); - - imageState_ -> format = *(buffer + 13); - imageState_ -> srcDepth = *(buffer + 14); - imageState_ -> dstDepth = *(buffer + 15); - - imageState_ -> srcLength = GetULONG(buffer + 16, bigEndian_); - imageState_ -> dstLength = GetULONG(buffer + 20, bigEndian_); - - imageState_ -> srcX = GetUINT(buffer + 24, bigEndian_); - imageState_ -> srcY = GetUINT(buffer + 26, bigEndian_); - imageState_ -> srcWidth = GetUINT(buffer + 28, bigEndian_); - imageState_ -> srcHeight = GetUINT(buffer + 30, bigEndian_); - - imageState_ -> dstX = GetUINT(buffer + 32, bigEndian_); - imageState_ -> dstY = GetUINT(buffer + 34, bigEndian_); - imageState_ -> dstWidth = GetUINT(buffer + 36, bigEndian_); - imageState_ -> dstHeight = GetUINT(buffer + 38, bigEndian_); - - #ifdef TEST - *logofs << "handleUnpack: Source X is " << imageState_ -> srcX - << " Y is " << imageState_ -> srcY << " width is " - << imageState_ -> srcWidth << " height is " - << imageState_ -> srcHeight << ".\n" - << logofs_flush; - #endif - - #ifdef TEST - *logofs << "handleUnpack: Destination X is " << imageState_ -> dstX - << " Y is " << imageState_ -> dstY << " width is " - << imageState_ -> dstWidth << " height is " - << imageState_ -> dstHeight << ".\n" - << logofs_flush; - #endif - - if (imageState_ -> srcX != 0 || imageState_ -> srcY != 0) - { - #ifdef PANIC - *logofs << "handleUnpack: PANIC! Unsupported source coordinates " - << "in unpack request.\n" << logofs_flush; - #endif - - return -1; - } - else if (imageState_ -> method == PACK_COLORMAP_256_COLORS && - (colormapState == NULL || colormapState -> data == NULL)) - { - #ifdef PANIC - *logofs << "handleUnpack: PANIC! Cannot find any unpack colormap.\n" - << logofs_flush; - #endif - - return -1; - } - - // - // Field srcLength carries size of image data in - // packed format. Field dstLength is size of the - // image in the original X bitmap format. - // - - unsigned int srcDataOffset = 40; - - unsigned int srcSize = imageState_ -> srcLength; - - unsigned int removeSize = size; - - unsigned char *srcData = buffer + srcDataOffset; - - // - // Get source and destination bits per pixel. - // - - int srcBitsPerPixel = MethodBitsPerPixel(imageState_ -> method); - - if (srcBitsPerPixel <= 0) - { - #ifdef PANIC - *logofs << "handleUnpack: PANIC! Can't identify source " - << "bits per pixel for method " << (unsigned int) - imageState_ -> method << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify source bits " - << "per pixel for method " << (unsigned int) - imageState_ -> method << ".\n"; - - writeBuffer_.removeMessage(removeSize); - - return -1; - } - - #ifdef TEST - *logofs << "handleUnpack: Source bits per pixel are " - << srcBitsPerPixel << " source data size is " - << srcSize << ".\n" << logofs_flush; - #endif - - int dstBitsPerPixel = UnpackBitsPerPixel(geometryState, imageState_ -> dstDepth); - - if (dstBitsPerPixel <= 0) - { - #ifdef PANIC - *logofs << "handleUnpack: PANIC! Can't identify " - << "destination bits per pixel for depth " - << (unsigned int) imageState_ -> dstDepth - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't identify " - << "destination bits per pixel for depth " - << (unsigned int) imageState_ -> dstDepth - << ".\n"; - - writeBuffer_.removeMessage(removeSize); - - return -1; - } - - // - // Destination is a PutImage request. - // - - unsigned int dstDataOffset = 24; - - // - // Output buffer size must match the number of input - // pixels multiplied by the number of bytes per pixel - // of current geometry. - // - - size = (RoundUp4(imageState_ -> dstWidth * dstBitsPerPixel / 8) * - imageState_ -> dstHeight) + dstDataOffset; - - #ifdef TEST - *logofs << "handleUnpack: Destination bits per pixel are " - << dstBitsPerPixel << " destination data size is " - << size - dstDataOffset << ".\n" << logofs_flush; - #endif - - unsigned int dstSize = size - dstDataOffset; - - imageState_ -> dstLines = imageState_ -> dstHeight; - - unsigned char *dstData; - - // - // Size of the final output buffer had to be stored - // in the offset field of XImage/NXPackedImage. - // - - #ifdef WARNING - - if (dstSize != imageState_ -> dstLength) - { - *logofs << "handleUnpack: WARNING! Destination size mismatch " - << "with reported " << imageState_ -> dstLength - << " and actual " << dstSize << ".\n" - << logofs_flush; - } - - #endif - - // - // The decoding algorithm has put the packed image - // in the plain write buffer. Let's use the scratch - // buffer to uncompress the image. - // - - buffer = writeBuffer_.addScratchMessage(size); - - dstData = buffer + dstDataOffset; - - // - // Unpack image into the buffer. - // - - *buffer = (unsigned char) X_PutImage; - - *(buffer + 1) = imageState_ -> format; - - PutUINT(size >> 2, buffer + 2, bigEndian_); - - PutULONG(imageState_ -> drawable, buffer + 4, bigEndian_); - PutULONG(imageState_ -> gcontext, buffer + 8, bigEndian_); - - PutUINT(imageState_ -> dstWidth, buffer + 12, bigEndian_); - PutUINT(imageState_ -> dstLines, buffer + 14, bigEndian_); - - PutUINT(imageState_ -> dstX, buffer + 16, bigEndian_); - PutUINT(imageState_ -> dstY, buffer + 18, bigEndian_); - - *(buffer + 20) = 0; - *(buffer + 21) = imageState_ -> dstDepth; - - #ifdef TEST - *logofs << "handleUnpack: Write buffer size is " - << writeBuffer_.getLength() << " scratch size is " - << writeBuffer_.getScratchLength() << ".\n" - << logofs_flush; - #endif - - int result = 0; - - switch (imageState_ -> method) - { - case PACK_JPEG_8_COLORS: - case PACK_JPEG_64_COLORS: - case PACK_JPEG_256_COLORS: - case PACK_JPEG_512_COLORS: - case PACK_JPEG_4K_COLORS: - case PACK_JPEG_32K_COLORS: - case PACK_JPEG_64K_COLORS: - case PACK_JPEG_256K_COLORS: - case PACK_JPEG_2M_COLORS: - case PACK_JPEG_16M_COLORS: - { - result = UnpackJpeg(geometryState, imageState_ -> method, srcData, - srcSize, dstBitsPerPixel, imageState_ -> dstWidth, - imageState_ -> dstHeight, dstData, dstSize); - break; - } - case PACK_PNG_8_COLORS: - case PACK_PNG_64_COLORS: - case PACK_PNG_256_COLORS: - case PACK_PNG_512_COLORS: - case PACK_PNG_4K_COLORS: - case PACK_PNG_32K_COLORS: - case PACK_PNG_64K_COLORS: - case PACK_PNG_256K_COLORS: - case PACK_PNG_2M_COLORS: - case PACK_PNG_16M_COLORS: - { - result = UnpackPng(geometryState, imageState_ -> method, srcData, - srcSize, dstBitsPerPixel, imageState_ -> dstWidth, - imageState_ -> dstHeight, dstData, dstSize); - break; - } - case PACK_RGB_16M_COLORS: - { - result = UnpackRgb(geometryState, imageState_ -> method, srcData, - srcSize, dstBitsPerPixel, imageState_ -> dstWidth, - imageState_ -> dstHeight, dstData, dstSize); - break; - } - case PACK_RLE_16M_COLORS: - { - result = UnpackRle(geometryState, imageState_ -> method, srcData, - srcSize, dstBitsPerPixel, imageState_ -> dstWidth, - imageState_ -> dstHeight, dstData, dstSize); - break; - } - case PACK_BITMAP_16M_COLORS: - { - result = UnpackBitmap(geometryState, imageState_ -> method, srcData, - srcSize, dstBitsPerPixel, imageState_ -> dstWidth, - imageState_ -> dstHeight, dstData, dstSize); - break; - } - case PACK_COLORMAP_256_COLORS: - { - result = Unpack8(geometryState, colormapState, srcBitsPerPixel, - imageState_ -> srcWidth, imageState_ -> srcHeight, srcData, - srcSize, dstBitsPerPixel, imageState_ -> dstWidth, - imageState_ -> dstHeight, dstData, dstSize); - - break; - } - default: - { - const T_colormask *colorMask = MethodColorMask(imageState_ -> method); - - switch (imageState_ -> method) - { - case PACK_MASKED_8_COLORS: - case PACK_MASKED_64_COLORS: - case PACK_MASKED_256_COLORS: - { - result = Unpack8(geometryState, colorMask, imageState_ -> srcDepth, - imageState_ -> srcWidth, imageState_ -> srcHeight, - srcData, srcSize, imageState_ -> dstDepth, - imageState_ -> dstWidth, imageState_ -> dstHeight, - dstData, dstSize); - break; - } - case PACK_MASKED_512_COLORS: - case PACK_MASKED_4K_COLORS: - case PACK_MASKED_32K_COLORS: - case PACK_MASKED_64K_COLORS: - { - result = Unpack16(geometryState, colorMask, imageState_ -> srcDepth, - imageState_ -> srcWidth, imageState_ -> srcHeight, - srcData, srcSize, imageState_ -> dstDepth, - imageState_ -> dstWidth, imageState_ -> dstHeight, - dstData, dstSize); - break; - } - case PACK_MASKED_256K_COLORS: - case PACK_MASKED_2M_COLORS: - case PACK_MASKED_16M_COLORS: - { - result = Unpack24(geometryState, colorMask, imageState_ -> srcDepth, - imageState_ -> srcWidth, imageState_ -> srcHeight, - srcData, srcSize, imageState_ -> dstDepth, - imageState_ -> dstWidth, imageState_ -> dstHeight, - dstData, dstSize); - break; - } - default: - { - break; - } - } - } - } - - writeBuffer_.removeMessage(removeSize); - - if (result <= 0) - { - #ifdef PANIC - *logofs << "handleUnpack: PANIC! Failed to unpack image " - << "with method '" << (unsigned int) imageState_ -> method - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to unpack image " - << "with method '" << (unsigned int) imageState_ -> method - << "'.\n"; - - // - // TODO: We should mark the image somehow, - // and force the remote to remove it from - // the cache. - // - - writeBuffer_.removeScratchMessage(); - - return -1; - } - - // - // Alpha channel is used only on some 32 bits pixmaps - // and only if render extension is in use. Presently - // we don't have an efficient way to know in advance - // if mask must be applied or not to the image. If an - // alpha channel is set, the function will check if - // the size of the alpha data matches the size of the - // image. In the worst case we'll create an useless - // alpha plane for a pixmap that doesn't need it. - // - - if (alphaState != NULL && alphaState -> data != NULL && - imageState_ -> dstDepth == 32) - { - UnpackAlpha(alphaState, dstData, dstSize, imageByteOrder_); - } - - return 1; -} - -int ServerChannel::handleAuthorization(unsigned char *buffer) -{ - // - // At the present moment we don't support more than - // a single display for each proxy, so authorization - // data is shared among all the channels. - // - // Use the following code to simulate authentication - // failures on a LSB machine: - // - // memcpy(buffer + 12 + (((buffer[6] + 256 * - // buffer[7]) + 3) & ~3), "1234567890123456", 16); - // - - if (auth == NULL) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleAuthorization: Forwarding the real cookie " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (auth -> checkCookie(buffer) == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleAuthorization: Matched the fake cookie " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return 1; - } - else - { - #if defined(TEST) || defined(INFO) - *logofs << "handleAuthorization: WARNING! Failed to match " - << "the fake cookie for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - return -1; - } -} - -int ServerChannel::handleAuthorization(const unsigned char *buffer, int size) -{ - // - // Check the X server's response and, in the case of - // an error, print the textual information reported - // by the server. - // - - if (*buffer != 1) - { - const char *reason = NULL; - - // - // At the moment we don't take into account the end- - // ianess of the reply. This should work in any case - // because we simply try to match a few well-known - // error strings. - // - - if (size >= INVALID_COOKIE_SIZE + 8 && - memcmp(buffer + 8, INVALID_COOKIE_DATA, - INVALID_COOKIE_SIZE) == 0) - { - reason = INVALID_COOKIE_DATA; - } - else if (size >= NO_AUTH_PROTO_SIZE + 8 && - memcmp(buffer + 8, NO_AUTH_PROTO_DATA, - NO_AUTH_PROTO_SIZE) == 0) - { - reason = NO_AUTH_PROTO_DATA; - } - else - { - reason = "Unknown"; - } - - #ifdef WARNING - *logofs << "handleAuthorization: WARNING! X connection failed " - << "with error '" << reason << "' on FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - cerr << "Warning" << ": X connection failed " - << "with error '" << reason << "'.\n"; - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "handleAuthorization: X connection successful " - << "on FD#" << fd_ << ".\n" << logofs_flush; - } - #endif - - return 1; -} - -// -// Use a simple encoding. Need to handle the image -// requests in the usual way and the X_ListExtensions -// and X_QueryExtension to hide MIT-SHM and RENDER -// in the reply. -// - -int ServerChannel::handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // All the NX requests are handled in the - // main message loop. - // - - // - // Since ProtoStep7 (#issue 108) - // - // The X_PutImage can be handled here only - // if a split was not requested. - // - - if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || - (opcode == X_PutImage && splitState_.resource != nothing) || - opcode == X_ListExtensions || - opcode == X_QueryExtension) - { - return 0; - } - - #ifdef DEBUG - *logofs << "handleFastWriteRequest: Decoding raw request OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - buffer = writeBuffer_.addMessage(4); - - #ifndef __sun - - unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(4); - - *((unsigned int *) buffer) = *next; - - #else /* #ifndef __sun */ - - memcpy(buffer, decodeBuffer.decodeMemory(4), 4); - - #endif /* #ifndef __sun */ - - size = GetUINT(buffer + 2, bigEndian_) << 2; - - if (size < 4) - { - #ifdef WARNING - *logofs << "handleFastWriteRequest: WARNING! Assuming size 4 " - << "for suspicious message of size " << size - << ".\n" << logofs_flush; - #endif - - size = 4; - } - - writeBuffer_.registerPointer(&buffer); - - if (writeBuffer_.getAvailable() < size - 4 || - (int) size >= control -> TransportFlushBufferSize) - { - #ifdef DEBUG - *logofs << "handleFastWriteRequest: Using scratch buffer for OPCODE#" - << (unsigned int) opcode << " with size " << size << " and " - << writeBuffer_.getLength() << " bytes in buffer.\n" - << logofs_flush; - #endif - - // - // The procedure moving data to shared memory - // assumes that the full message is stored in - // the scratch buffer. We can safely let the - // scratch buffer inherit the decode buffer - // at the next offset. - // - - writeBuffer_.removeMessage(4); - - buffer = writeBuffer_.addScratchMessage(((unsigned char *) - decodeBuffer.decodeMemory(size - 4)) - 4, size); - } - else - { - writeBuffer_.addMessage(size - 4); - - #ifndef __sun - - if (size <= 32) - { - next = (unsigned int *) decodeBuffer.decodeMemory(size - 4); - - for (unsigned int i = 4; i < size; i += sizeof(unsigned int)) - { - *((unsigned int *) (buffer + i)) = *next++; - } - } - else - { - memcpy(buffer + 4, decodeBuffer.decodeMemory(size - 4), size - 4); - } - - #else /* #ifndef __sun */ - - memcpy(buffer + 4, decodeBuffer.decodeMemory(size - 4), size - 4); - - #endif /* #ifndef __sun */ - } - - // - // Opcode could have been tainted by the client - // proxy. Replace the original opcode with the - // one sent in the decode buffer. - // - - *buffer = opcode; - - writeBuffer_.unregisterPointer(); - - if (opcode == X_PutImage) - { - handleImage(opcode, buffer, size); - } - - #if defined(TEST) || defined(OPCODES) - - if (opcode != 0) - { - *logofs << "handleFastWriteRequest: Handled request " - << "OPCODE#" << (unsigned int) opcode << " (" - << DumpOpcode(opcode) << ") for FD#" << fd_ - << " sequence " << clientSequence_ << ". " - << size << " bytes out.\n" << logofs_flush; - } - else - { - *logofs << "handleFastWriteRequest: Handled image or " - << "other request for FD#" << fd_ - << " sequence " << clientSequence_ << ". " - << size << " bytes out.\n" << logofs_flush; - } - - #endif - - handleFlush(flush_if_needed); - - return 1; -} - -// -// Use the simplest encoding except for replies that -// need to be managed some way. -// - -int ServerChannel::handleFastReadReply(EncodeBuffer &encodeBuffer, const unsigned char &opcode, - const unsigned char *&buffer, const unsigned int &size) -{ - // - // If we pushed a X_GetInputFocus in the sequence - // queue this means that the original message was - // a NX request for which we have to provide a NX - // reply. - // - - if ((opcode >= X_NXFirstOpcode && - opcode <= X_NXLastOpcode) || - opcode == X_QueryExtension || - opcode == X_ListExtensions || - opcode == X_GetInputFocus) - { - return 0; - } - - #ifdef DEBUG - *logofs << "handleFastReadReply: Encoding raw reply OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << " with size " << size << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeMemory(buffer, size); - - // - // Send back the reply as soon - // as possible. - // - - priority_++; - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - *logofs << "handleFastReadReply: Handled raw reply OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ << " sequence " - << serverSequence_ << ". " << size << " bytes in, " - << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - #endif - - statistics -> addReplyBits(opcode, size << 3, bits); - - return 1; -} - -int ServerChannel::handleFastReadEvent(EncodeBuffer &encodeBuffer, const unsigned char &opcode, - const unsigned char *&buffer, const unsigned int &size) -{ - #ifdef DEBUG - *logofs << "handleFastReadEvent: Encoding raw " - << (opcode == X_Error ? "error" : "event") << " OPCODE#" - << (unsigned int) opcode << " for FD#" << fd_ - << " with size " << size << ".\n" - << logofs_flush; - #endif - - encodeBuffer.encodeMemory(buffer, size); - - switch (opcode) - { - case X_Error: - case ButtonPress: - case ButtonRelease: - case KeyPress: - case KeyRelease: - { - priority_++; - } - } - - int bits = encodeBuffer.diffBits(); - - #if defined(TEST) || defined(OPCODES) - - if (opcode == X_Error) - { - unsigned char code = *(buffer + 1); - - *logofs << "handleFastReadEvent: Handled error ERR_CODE#" - << (unsigned int) code << " for FD#" << fd_; - - *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); - - *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); - - *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); - - *logofs << " sequence " << serverSequence_ << ". " << size - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - } - else - { - *logofs << "handleFastReadEvent: Handled event OPCODE#" - << (unsigned int) *buffer << " for FD#" << fd_ - << " sequence " << serverSequence_ << ". " << size - << " bytes in, " << bits << " bits (" << ((float) bits) / 8 - << " bytes) out.\n" << logofs_flush; - } - - #endif - - statistics -> addEventBits(opcode, size << 3, bits); - - return 1; -} - -void ServerChannel::initCommitQueue() -{ - #ifdef TEST - *logofs << "initCommitQueue: Resetting the queue of split commits " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE; i++) - { - commitSequenceQueue_[i] = 0; - } -} - -void ServerChannel::updateCommitQueue(unsigned short sequence) -{ - for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE - 1; i++) - { - commitSequenceQueue_[i + 1] = commitSequenceQueue_[i]; - } - - #ifdef TEST - *logofs << "updateCommitQueue: Saved " << sequence - << " as last sequence number of image to commit.\n" - << logofs_flush; - #endif - - commitSequenceQueue_[0] = sequence; -} - -int ServerChannel::checkCommitError(unsigned char error, unsigned short sequence, - const unsigned char *buffer) -{ - // - // Check if error is due to an image commit - // generated at the end of a split. - // - // TODO: It should zero the head of the list - // when an event comes with a sequence number - // greater than the value of the last element - // added. - // - - for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE && - commitSequenceQueue_[i] != 0; i++) - { - #ifdef TEST - *logofs << "checkCommitError: Checking committed image's " - << "sequence number " << commitSequenceQueue_[i] - << " with input sequence " << sequence << ".\n" - << logofs_flush; - #endif - - if (commitSequenceQueue_[i] == sequence) - { - #ifdef WARNING - - *logofs << "checkCommitError: WARNING! Failed operation for " - << "FD#" << fd_ << " with ERR_CODE#" - << (unsigned int) *(buffer + 1); - - *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); - - *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); - - *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); - - *logofs << " sequence " << sequence << ".\n"; - - *logofs << logofs_flush; - - #endif - - cerr << "Warning" << ": Failed commit operation " - << "with ERR_CODE#" << (unsigned int) error; - - cerr << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); - - cerr << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); - - cerr << " MAJ_OP#" << (unsigned int) *(buffer + 10); - - cerr << ".\n"; - - #ifdef WARNING - *logofs << "checkCommitError: WARNING! Suppressing error on " - << "OPCODE#" << (unsigned int) opcodeStore_ -> commitSplit - << " for FD#" << fd_ << " with sequence " << sequence - << " at position " << i << ".\n" << logofs_flush; - #endif - - return 0; - } - } - - return 0; -} - -// -// Check if the user pressed the CTRL+ALT+SHIFT+ESC -// keystroke. At the present moment it uses different -// keycodes based on the client OS. This should be -// implemented in a way that is platform independent -// (that's not an easy task, considered that we don't -// have access to the higher level X libraries). -// - -int ServerChannel::checkKeyboardEvent(unsigned char event, unsigned short sequence, - const unsigned char *buffer) -{ - #ifdef TEST - *logofs << "checkKeyboardEvent: Checking escape sequence with byte [1] " - << (void *) ((unsigned) *(buffer + 1)) << " and bytes [28-29] " - << (void *) ((unsigned) GetUINT(buffer + 28, bigEndian_)) - << " for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - #ifdef __APPLE__ - - int alert = (*(buffer + 1) == 0x3d && - GetUINT(buffer + 28, bigEndian_) == 0x2005); - - #else - - int alert = (*(buffer + 1) == 0x09 && - ((GetUINT(buffer + 28, bigEndian_) & - 0x0d) == 0x0d)); - - #endif - - if (alert == 1) - { - #ifdef PANIC - *logofs << "checkKeyboardEvent: PANIC! Received sequence " - << "CTRL+ALT+SHIFT+ESC " << "for FD#"<< fd_ - << ". Showing the abort dialog.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Received sequence CTRL+ALT+SHIFT+ESC. " - << "Showing the abort dialog.\n"; - - HandleAlert(CLOSE_UNRESPONSIVE_X_SERVER_ALERT, 1); - } - - return alert; -} - -// -// Handle the MIT-SHM initialization -// messages exchanged with the remote -// proxy. -// - -int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned int stage, const unsigned char *buffer, - const unsigned int size) -{ - #ifdef TEST - *logofs << "handleShmemReply: Returning shmem reply for " - << "stage " << stage << ".\n" << logofs_flush; - #endif - - if (opcode == X_QueryExtension) - { - encodeBuffer.encodeValue(stage, 2); - -#ifndef ANDROID - shmemState_ -> present = *(buffer + 8); -#else - shmemState_ -> present = 0; - cerr << "Info: handleShmemReply: In android no shared memory. Setting present to 0 hardcoded\n"; -#endif - shmemState_ -> opcode = *(buffer + 9); - shmemState_ -> event = *(buffer + 10); - shmemState_ -> error = *(buffer + 11); - - #ifdef TEST - *logofs << "handleShmemReply: Extension present is " - << shmemState_ -> present << " with base OPCODE#" - << (unsigned int) shmemState_ -> opcode << " base event " - << (unsigned int) shmemState_ -> event << " base error " - << (unsigned int) shmemState_ -> error << ".\n" - << logofs_flush; - #endif - } - else if (opcode == X_GetInputFocus) - { - encodeBuffer.encodeValue(stage, 2); - - encodeBuffer.encodeBoolValue(0); - - if (shmemState_ -> present == 1 && - shmemState_ -> address != NULL && - shmemState_ -> segment > 0 && - shmemState_ -> id > 0) - { - cerr << "Info" << ": Using shared memory parameters 1/" - << (shmemState_ -> size / 1024) << "K.\n"; - -#ifndef ANDROID - shmemState_ -> enabled = 1; -#else - cerr << "Info: handleShmemReply: In android no shared memory. Setting enabled to -1. This should not be displayed\n"; - shmemState_ -> enabled = -1; -#endif - - encodeBuffer.encodeBoolValue(1); - } - else - { - #ifdef TEST - *logofs << "handleShmemReply: WARNING! Not using shared memory " - << "support in X server for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Info" << ": Using shared memory parameters 0/0K.\n"; - - handleShmemStateRemove(); - - encodeBuffer.encodeBoolValue(0); - } - } - else - { - #ifdef PANIC - *logofs << "handleShmemReply: PANIC! Conversation error " - << "handling shared memory support for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Conversation error handling " - << "shared memory support.\n"; - - return -1; - } - - return 1; -} - -int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // We need to query and initialize MIT-SHM on - // the real X server. To do this we'll need 3 - // requests. At the end we'll have to encode - // the final reply for the X client side. - // - - handleShmemStateAlloc(); - - unsigned int stage; - - decodeBuffer.decodeValue(stage, 2); - - unsigned int expected = shmemState_ -> stage + 1; - - if (stage != expected || stage > 2) - { - #ifdef PANIC - *logofs << "handleShmemRequest: PANIC! Unexpected stage " - << stage << " in handling shared memory " - << "support for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Unexpected stage " - << stage << " in handling shared memory " - << "support for FD#" << fd_ << ".\n"; - - return -1; - } - - switch (stage) - { - case 0: - { - unsigned int enableClient; - unsigned int enableServer; - - decodeBuffer.decodeBoolValue(enableClient); - decodeBuffer.decodeBoolValue(enableServer); - - unsigned int clientSegment; - unsigned int serverSegment; - - decodeBuffer.decodeValue(clientSegment, 29, 9); - decodeBuffer.decodeValue(serverSegment, 29, 9); - - shmemState_ -> segment = serverSegment; - - #ifdef TEST - *logofs << "handleShmemRequest: Size of the shared memory " - << "segment will be " << control -> ShmemServerSize - << ".\n" << logofs_flush; - #endif - - #ifdef TEST - *logofs << "handleShmemRequest: Sending X_QueryExtension request " - << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) - opcodeStore_ -> getShmemParameters << " in stage " - << stage << ".\n" << logofs_flush; - #endif - - opcode = X_QueryExtension; - - size = 16; - buffer = writeBuffer_.addMessage(size); - - PutUINT(7, buffer + 4, bigEndian_); - - // - // Simply make the query fail if shared - // memory support is disabled by the - // user. - // -#ifndef ANDROID - if (control -> ShmemServer == 1 && - control -> ShmemServerSize > 0 && - enableServer == 1) - { - memcpy(buffer + 8, "MIT-SHM", 7); - } - else - { - memcpy(buffer + 8, "NO-MIT-", 7); - } -#else - cerr << "Info: handleShmemRequest: In android no shared memory. Returning NO-MIT- answer\n"; - - memcpy(buffer + 8, "NO-MIT-", 7); -#endif - sequenceQueue_.push(clientSequence_, opcode, - opcodeStore_ -> getShmemParameters, stage); - - // - // Save the sequence number so we can - // later identify any matching X error - // received from server. - // - - shmemState_ -> sequence = clientSequence_; - - break; - } - case 1: - { - if (shmemState_ -> present == 1) - { - // - // Make the segment read-write for everybody on - // Cygwin (to avoid any lack of support or any - // performance issue) and on MacOS/X (where the - // 0600 mask doesn't seem to work). - // - - #if defined(__CYGWIN32__) || defined(__APPLE__) - - int permissions = 0777; - - #else - - int permissions = 0600; - - #endif - - shmemState_ -> size = control -> ShmemServerSize; - -#ifndef ANDROID - shmemState_ -> id = shmget(IPC_PRIVATE, shmemState_ -> size, - IPC_CREAT | permissions); -#else - cerr << "Info: handleShmemReqyest: In android no shared memory (shmget). This message should not be displayed present should never be 1 in android\n"; - shmemState_ -> id = -1; -#endif - if (shmemState_ -> id >= 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleShmemRequest: Allocated shared memory " - << "segment of " << shmemState_ -> size - << " bytes with id " << shmemState_ -> id - << ".\n" << logofs_flush; - #endif - - -#ifndef ANDROID - shmemState_ -> address = shmat(shmemState_ -> id, 0, 0); -#else - cerr << "Info: handleShmemReqyest: In android no shared memory (shmat). This message should not be displayed. present should never be 1 in android\n"; - shmemState_ -> address = NULL; -#endif - if (shmemState_ -> address != NULL) - { - #ifdef TEST - *logofs << "handleShmemRequest: Sending X_ShmAttach request " - << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) - opcodeStore_ -> getShmemParameters << " in stage " - << stage << ".\n" << logofs_flush; - #endif - - opcode = shmemState_ -> opcode; - - size = 16; - buffer = writeBuffer_.addMessage(size); - - *(buffer + 1) = X_ShmAttach; - - PutULONG(shmemState_ -> segment, buffer + 4, bigEndian_); - PutULONG(shmemState_ -> id, buffer + 8, bigEndian_); - - *(buffer + 12) = 1; - - shmemState_ -> sequence = clientSequence_; - - break; - } - else - { - #ifdef WARNING - *logofs << "handleShmemRequest: WARNING! Can't attach the shared " - << "memory segment. Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Can't attach the shared memory " - << "segment. Error is " << EGET() << " '" - << ESTR() << "'.\n"; - } - } - else - { - #ifndef __CYGWIN32__ - - #ifdef WARNING - *logofs << "handleShmemRequest: WARNING! Can't create the shared " - << "memory segment. Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Can't create the shared memory " - << "segment. Error is " << EGET() << " '" - << ESTR() << "'.\n"; - - #else - - #ifdef TEST - *logofs << "handleShmemRequest: WARNING! Can't create the shared " - << "memory segment. Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - #endif - } - } - - if (shmemState_ -> present != 0) - { - #ifdef TEST - *logofs << "handleShmemRequest: Resetting shared memory " - << "presence flag for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - shmemState_ -> present = 0; - } - - handleNullRequest(opcode, buffer, size); - - break; - } - default: - { - #ifdef TEST - *logofs << "handleShmemRequest: Sending X_GetInputFocus request " - << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) - opcodeStore_ -> getShmemParameters << " in stage " - << stage << ".\n" << logofs_flush; - #endif - - opcode = X_GetInputFocus; - - size = 4; - buffer = writeBuffer_.addMessage(size); - - sequenceQueue_.push(clientSequence_, opcode, - opcodeStore_ -> getShmemParameters, stage); - break; - } - } - - shmemState_ -> stage += 1; - - return 1; -} - -// -// Handling of MIT-SHM extension has been plugged late in -// the design, so we have to make some assumptions. Image -// is a X_PutImage request contained either in the scratch -// buffer or in the normal write buffer. We need to move -// the image data to the shared memory segment and replace -// the X_PutImage request with a X_ShmPutImage. -// - -int ServerChannel::handleShmem(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size) -{ - if (shmemState_ == NULL || shmemState_ -> enabled != 1) - { - #ifdef TEST - - if (shmemState_ != NULL) - { - *logofs << "handleShmem: PANIC! Shared memory " - << "state found but support is not enabled " - << "for FD#" << fd_ << " in stage " - << shmemState_ -> stage << ".\n" - << logofs_flush; - } - - #endif - - return 0; - } -#ifdef ANDROID - cerr << "Info: handleShmem: In android no shared memory. enabled should never be 1. This should not be displayed\n"; - return 0; -#endif - - // - // Ignore null requests and requests that will not result - // in a single X_PutImage. To conform with the other func- - // tions, we get the opcode passed as a parameter. It can - // be zero if we don't want the write loop to put opcode - // and length in the resulting buffer. Anyway we are only - // interested in the original opcode of the request, that - // is stored in the image state. - // - - unsigned char *dstData = buffer + 24; - unsigned int dstDataSize = size - 24; - - if (dstDataSize == 0 || dstDataSize > - (unsigned int) control -> MaximumRequestSize) - { - #ifdef TEST - *logofs << "handleShmem: Ignoring image with opcode " - << (unsigned int) imageState_ -> opcode - << " and size " << size << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - return 0; - } - - #ifdef TEST - *logofs << "handleShmem: Handling image with opcode " - << (unsigned int) imageState_ -> opcode - << " and size " << size << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - // - // Get image data from buffer. - // - - if (imageState_ -> opcode == X_PutImage) - { - // - // We still need to get the image's data. - // - - imageState_ -> format = *(buffer + 1); - - imageState_ -> drawable = GetULONG(buffer + 4, bigEndian_); - imageState_ -> gcontext = GetULONG(buffer + 8, bigEndian_); - - imageState_ -> dstWidth = GetUINT(buffer + 12, bigEndian_); - imageState_ -> dstHeight = GetUINT(buffer + 14, bigEndian_); - - imageState_ -> srcX = 0; - imageState_ -> srcY = 0; - - imageState_ -> srcWidth = imageState_ -> dstWidth; - imageState_ -> srcHeight = imageState_ -> dstHeight; - - imageState_ -> dstX = GetUINT(buffer + 16, bigEndian_); - imageState_ -> dstY = GetUINT(buffer + 18, bigEndian_); - - imageState_ -> leftPad = *(buffer + 20); - imageState_ -> dstDepth = *(buffer + 21); - - imageState_ -> dstLines = imageState_ -> dstHeight; - - imageState_ -> dstLength = size - 24; - } - - // - // Skip the MIT-SHM operation if the image - // is 1 bits-per-plane. - // - - if (imageState_ -> dstDepth == 1) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleShmem: Ignoring image with opcode " - << (unsigned int) imageState_ -> opcode << " depth " - << (unsigned int) imageState_ -> dstDepth << " and " - << "size " << size << " for FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - return 0; - } - - // - // If the image can't fit in the available - // space, check if the completion event is - // arrived. - // - - #if defined(TEST) || defined(INFO) - - if (isTimestamp(shmemState_ -> last) == 0 && - shmemState_ -> offset != 0) - { - *logofs << "handleShmem: PANIC! No timestamp for sequence " - << shmemState_ -> sequence << " with offset " - << shmemState_ -> offset << ".\n" - << logofs_flush; - } - - #endif - - if (shmemState_ -> offset + imageState_ -> dstLength > - shmemState_ -> size) - { - if (imageState_ -> dstLength > shmemState_ -> size) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleShmem: WARNING! Can't fit the image " - << "in the available memory segment for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (handleShmemEvent() <= 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleShmem: WARNING! Missing completion " - << "after " << diffTimestamp(shmemState_ -> last, - getTimestamp()) << " Ms for shared memory " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - return 0; - } - } - - // - // Let image start at current offset - // in the shared segment. - // - - #ifdef TEST - *logofs << "handleShmem: Copying " << dstDataSize - << " bytes to shared memory at offset " - << shmemState_ -> offset << " for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - memcpy((unsigned char *) shmemState_ -> address + - shmemState_ -> offset, dstData, dstDataSize); - - // - // Get rid of the original X_PutImage - // request. - // - - if (writeBuffer_.getScratchData() != NULL) - { - writeBuffer_.removeScratchMessage(); - } - else - { - writeBuffer_.removeMessage(size); - } - - // - // Add a X_ShmPutImage request to the - // write buffer. - // - - buffer = writeBuffer_.addMessage(40); - - *buffer = shmemState_ -> opcode; - - *(buffer + 1) = X_ShmPutImage; - - PutUINT(40 >> 2, buffer + 2, bigEndian_); - - PutULONG(imageState_ -> drawable, buffer + 4, bigEndian_); - PutULONG(imageState_ -> gcontext, buffer + 8, bigEndian_); - - PutUINT(imageState_ -> dstWidth, buffer + 12, bigEndian_); - PutUINT(imageState_ -> dstLines, buffer + 14, bigEndian_); - - PutUINT(imageState_ -> srcX, buffer + 16, bigEndian_); - PutUINT(imageState_ -> srcY, buffer + 18, bigEndian_); - - PutUINT(imageState_ -> dstWidth, buffer + 20, bigEndian_); - PutUINT(imageState_ -> dstLines, buffer + 22, bigEndian_); - - PutUINT(imageState_ -> dstX, buffer + 24, bigEndian_); - PutUINT(imageState_ -> dstY, buffer + 26, bigEndian_); - - *(buffer + 28) = imageState_ -> dstDepth; - *(buffer + 29) = imageState_ -> format; - *(buffer + 30) = 1; - - PutULONG(shmemState_ -> segment, buffer + 32, bigEndian_); - PutULONG(shmemState_ -> offset, buffer + 36, bigEndian_); - - shmemState_ -> offset += dstDataSize; - - shmemState_ -> sequence = clientSequence_; - shmemState_ -> last = getTimestamp(); - - #ifdef TEST - *logofs << "handleShmem: Saved shared memory sequence " - << shmemState_ -> sequence << " for FD#" << fd_ - << " with offset " << shmemState_ -> offset - << " at " << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - - // - // Make the X server read immediately - // from the shared memory buffer and - // produce the completion event. - // - - handleFlush(flush_if_any); - - return 1; -} - -// -// Try to read more events from the socket in the -// attempt to get the completion event required -// to reset the MIT-SHM segment. -// - -int ServerChannel::handleShmemEvent() -{ - #if defined(TEST) || defined(INFO) - *logofs << "handleShmemEvent: Waiting for shared memory " - << "sequence " << shmemState_ -> sequence - << " for X server FD#" << fd_ << ".\n" - << logofs_flush; - - T_timestamp startTs = getTimestamp(); - - #endif - - while (isTimestamp(shmemState_ -> last) != 0) - { - if (handleWait(control -> ShmemTimeout) <= 0) - { - break; - } - #if defined(TEST) || defined(INFO) - else - { - *logofs << "handleShmemEvent: WARNING! Encoded events " - << "for FD#" << fd_ << " at " << strMsTimestamp() - << ".\n" << logofs_flush; - } - #endif - } - - if (isTimestamp(shmemState_ -> last) == 0) - { - #if defined(TEST) || defined(INFO) - *logofs << "handleShmemEvent: Spent " - << diffTimestamp(startTs, getTimestamp()) << " Ms " - << "waiting for shared memory sequence for FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - return 1; - } - - #if defined(TEST) || defined(INFO) - *logofs << "handleShmemEvent: WARNING! Can't reset shared " - << "memory sequence for FD#" << fd_ << " after " - << diffTimestamp(shmemState_ -> last, getTimestamp()) - << " Ms.\n" << logofs_flush; - #endif - - return 0; -} - -int ServerChannel::checkShmemEvent(unsigned char event, unsigned short sequence, - const unsigned char *buffer) -{ - if (isTimestamp(shmemState_ -> last) == 1 && - sequence == shmemState_ -> sequence) - { - #ifdef TEST - *logofs << "checkShmemEvent: Reset shared memory sequence " - << shmemState_ -> sequence << " for FD#" << fd_ - << " after " << diffTimestamp(shmemState_ -> last, - getTimestamp()) << " Ms.\n" << logofs_flush; - #endif - - shmemState_ -> sequence = 0; - shmemState_ -> offset = 0; - shmemState_ -> last = nullTimestamp(); - } - #ifdef TEST - else - { - *logofs << "checkShmemEvent: Skipping past shared memory " - << "image sequence " << sequence << " for FD#" - << fd_ << ".\n" << logofs_flush; - } - #endif - - return 1; -} - -int ServerChannel::checkShmemError(unsigned char error, unsigned short sequence, - const unsigned char *buffer) -{ - #ifdef TEST - - *logofs << "checkShmemError: WARNING! Failed operation for " - << "FD#" << fd_ << " in stage " << shmemState_ -> stage - << " with ERR_CODE#" << (unsigned int) *(buffer + 1); - - *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); - - *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); - - *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); - - *logofs << " sequence " << sequence << ".\n"; - - *logofs << logofs_flush; - - #endif - - // - // If enabled flag is <= 0 we are still - // in the inizialization phase. In this - // case force presence to false. - // - - if (shmemState_ -> enabled != 1) - { - if (shmemState_ -> present != 0) - { - #ifdef TEST - *logofs << "checkShmemError: Resetting shared memory " - << "presence flag for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - shmemState_ -> present = 0; - } - - return 0; - } - - if (shmemState_ -> sequence == sequence) - { - // - // Reset the sequence and timestamp. - // - - shmemState_ -> sequence = 0; - shmemState_ -> offset = 0; - shmemState_ -> last = nullTimestamp(); - } - - return 1; -} - -int ServerChannel::handleFontRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // Send a synchronization request and use - // the reply to return the requested font - // path. - // - - #ifdef TEST - *logofs << "handleFontRequest: Sending X_GetInputFocus request " - << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) - opcodeStore_ -> getFontParameters << ".\n" - << logofs_flush; - #endif - - opcode = X_GetInputFocus; - - size = 4; - buffer = writeBuffer_.addMessage(size); - - sequenceQueue_.push(clientSequence_, X_GetInputFocus, - opcodeStore_ -> getFontParameters); - - return 1; -} - -int ServerChannel::handleFontReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) -{ - #ifdef TEST - *logofs << "handleFontReply: Encoding font operation " - << "reply with size " << size << ".\n" - << logofs_flush; - #endif - - char data[256]; - - if (fontPort_ != -1) - { - sprintf(data + 1, "tcp/localhost:%d", fontPort_); - } - else - { - *(data + 1) = '\0'; - } - - *data = strlen(data + 1); - - unsigned char *next = (unsigned char *) data; - - unsigned int length = (unsigned int) (*next++); - - encodeBuffer.encodeValue(length, 8); - - encodeBuffer.encodeTextData(next, length); - - return 1; -} - -int ServerChannel::handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - unsigned int mask; - - decodeBuffer.decodeCachedValue(mask, 32, clientCache_ -> - setCacheParametersCache); - - splitState_.save = (mask >> 8) & 0xff; - splitState_.load = mask & 0xff; - - #ifdef TEST - *logofs << "handleCacheRequest: Set cache parameters to " - << "save " << splitState_.save << " load " - << splitState_.load << ".\n" << logofs_flush; - #endif - - handleNullRequest(opcode, buffer, size); - - return 1; -} - -int ServerChannel::handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // Prepare for the split for the selected - // resource. Old proxy versions only used - // the split store at position 0. - // - - // Since ProtoStep7 (#issue 108) - unsigned char resource; - - decodeBuffer.decodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - splitState_.resource = resource; - - splitState_.current = splitState_.resource; - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleStartSplitRequest: SPLIT! Registered id " - << splitState_.resource << " as resource " - << "waiting for a split.\n" << logofs_flush; - #endif - - handleNullRequest(opcode, buffer, size); - - return 1; -} - -int ServerChannel::handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size) -{ - // - // Verify that the agent resource matches. - // - - // Since ProtoStep7 (#issue 108) - unsigned char resource; - - decodeBuffer.decodeCachedValue(resource, 8, - clientCache_ -> resourceCache); - - #ifdef TEST - - if (splitState_.resource == nothing) - { - #ifdef PANIC - *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of " - << "split for resource id " << (unsigned int) *(buffer + 1) - << " without a previous start.\n" - << logofs_flush; - #endif - - HandleCleanup(); - } - else if (resource != splitState_.resource) - { - #ifdef PANIC - *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id " - << resource << " received while waiting for resource id " - << splitState_.resource << ".\n" << logofs_flush; - #endif - - HandleCleanup(); - } - - #endif - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleEndSplitRequest: SPLIT! Reset id " - << splitState_.resource << " as resource " - << "selected for splits.\n" << logofs_flush; - #endif - - splitState_.resource = nothing; - - handleNullRequest(opcode, buffer, size); - - return 1; -} - -int ServerChannel::handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum) -{ - unsigned int receive; - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeBoolValue(receive); - - if (receive == 1) - { - checksum = new md5_byte_t[MD5_LENGTH]; - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - decodeBuffer.decodeValue(receive, 8); - - if (checksum != NULL) - { - checksum[i] = (unsigned char) receive; - } - } - - #if defined(TEST) || defined(SPLIT) - *logofs << "handleSplitChecksum: SPLIT! Received checksum " - << "[" << DumpChecksum(checksum) << "].\n" - << logofs_flush; - #endif - - return 1; - } - - return 0; -} - -void ServerChannel::handleShmemStateAlloc() -{ - if (shmemState_ == NULL) - { - shmemState_ = new T_shmem_state(); - - shmemState_ -> stage = -1; - shmemState_ -> present = -1; - shmemState_ -> enabled = -1; - - shmemState_ -> segment = -1; - shmemState_ -> id = -1; - shmemState_ -> address = NULL; - shmemState_ -> size = 0; - - shmemState_ -> opcode = 0xff; - shmemState_ -> event = 0xff; - shmemState_ -> error = 0xff; - - shmemState_ -> sequence = 0; - shmemState_ -> offset = 0; - shmemState_ -> last = nullTimestamp(); - - shmemState_ -> checked = 0; - } -} - -void ServerChannel::handleShmemStateRemove() -{ - if (shmemState_ != NULL) - { - if (shmemState_ -> address != NULL) - { -#ifndef ANDROID - shmdt((char *) shmemState_ -> address); -#else - cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. address should always be NULL\n"; -#endif - } - - if (shmemState_ -> id > 0) - { -#ifndef ANDROID - shmctl(shmemState_ -> id, IPC_RMID, 0); -#else - cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. id should always be 0\n"; -#endif - } - - delete shmemState_; - - shmemState_ = NULL; - } -} - -void ServerChannel::handleUnpackStateInit(int resource) -{ - if (unpackState_[resource] == NULL) - { - unpackState_[resource] = new T_unpack_state(); - - if (unpackState_[resource] == NULL) - { - #ifdef PANIC - *logofs << "handleUnpackStateInit: PANIC! Can't allocate " - << "memory for unpack state in context [A].\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "unpack state in context [A].\n"; - - HandleAbort(); - } - - unpackState_[resource] -> geometry = NULL; - unpackState_[resource] -> colormap = NULL; - unpackState_[resource] -> alpha = NULL; - } -} - -void ServerChannel::handleUnpackAllocGeometry(int resource) -{ - if (unpackState_[resource] -> geometry == NULL) - { - unpackState_[resource] -> geometry = new T_geometry(); - - if (unpackState_[resource] -> geometry == NULL) - { - #ifdef PANIC - *logofs << "handleUnpackAllocGeometry: PANIC! Can't allocate " - << "memory for unpack state in context [B].\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "unpack state in context [B].\n"; - - HandleAbort(); - } - - unpackState_[resource] -> geometry -> depth1_bpp = 4; - unpackState_[resource] -> geometry -> depth4_bpp = 4; - unpackState_[resource] -> geometry -> depth8_bpp = 8; - unpackState_[resource] -> geometry -> depth16_bpp = 16; - unpackState_[resource] -> geometry -> depth24_bpp = 32; - unpackState_[resource] -> geometry -> depth32_bpp = 32; - - unpackState_[resource] -> geometry -> red_mask = 0xff0000; - unpackState_[resource] -> geometry -> green_mask = 0x00ff00; - unpackState_[resource] -> geometry -> blue_mask = 0x0000ff; - - unpackState_[resource] -> geometry -> image_byte_order = imageByteOrder_; - unpackState_[resource] -> geometry -> bitmap_bit_order = bitmapBitOrder_; - unpackState_[resource] -> geometry -> scanline_unit = scanlineUnit_; - unpackState_[resource] -> geometry -> scanline_pad = scanlinePad_; - } -} - -void ServerChannel::handleUnpackAllocColormap(int resource) -{ - if (unpackState_[resource] -> colormap == NULL) - { - unpackState_[resource] -> colormap = new T_colormap(); - - if (unpackState_[resource] -> colormap == NULL) - { - #ifdef PANIC - *logofs << "handleUnpackAllocColormap: PANIC! Can't allocate " - << "memory for unpack state in context [C].\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "unpack state in context [C].\n"; - - HandleAbort(); - } - - unpackState_[resource] -> colormap -> entries = 0; - unpackState_[resource] -> colormap -> data = NULL; - } -} - -void ServerChannel::handleUnpackAllocAlpha(int resource) -{ - if (unpackState_[resource] -> alpha == NULL) - { - unpackState_[resource] -> alpha = new T_alpha(); - - if (unpackState_[resource] -> alpha == NULL) - { - #ifdef PANIC - *logofs << "handleUnpackAllocAlpha: PANIC! Can't allocate " - << "memory for unpack state in context [D].\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "unpack state in context [D].\n"; - - HandleAbort(); - } - - unpackState_[resource] -> alpha -> entries = 0; - unpackState_[resource] -> alpha -> data = NULL; - } -} - -void ServerChannel::handleUnpackStateRemove(int resource) -{ - if (unpackState_[resource] != NULL) - { - delete unpackState_[resource] -> geometry; - - if (unpackState_[resource] -> colormap != NULL) - { - delete [] unpackState_[resource] -> colormap -> data; - } - - delete unpackState_[resource] -> colormap; - - if (unpackState_[resource] -> alpha != NULL) - { - delete [] unpackState_[resource] -> alpha -> data; - } - - delete unpackState_[resource] -> alpha; - - delete unpackState_[resource]; - - unpackState_[resource] = NULL; - } -} - -void ServerChannel::handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuffer &encodeBuffer) -{ - unsigned int value = GetUINT(nextSrc, bigEndian_) | - (GetUINT(nextSrc + 10, bigEndian_) << 16); - - encodeBuffer.encodeCachedValue(value, 32, - *serverCache_ -> queryFontCharInfoCache[0], 6); - - nextSrc += 2; - - for (unsigned int i = 1; i < 5; i++) - { - unsigned int value = GetUINT(nextSrc, bigEndian_); - - nextSrc += 2; - - encodeBuffer.encodeCachedValue(value, 16, - *serverCache_ -> queryFontCharInfoCache[i], 6); - } -} - -int ServerChannel::setBigEndian(int flag) -{ - bigEndian_ = flag; - - readBuffer_.setBigEndian(flag); - - return 1; -} - -int ServerChannel::setReferences() -{ - #ifdef TEST - *logofs << "ServerChannel: Initializing the static " - << "members for the server channels.\n" - << logofs_flush; - #endif - - #ifdef REFERENCES - - references_ = 0; - - #endif - - return 1; -} diff --git a/nxcomp/ServerChannel.h b/nxcomp/ServerChannel.h deleted file mode 100644 index 374e52896..000000000 --- a/nxcomp/ServerChannel.h +++ /dev/null @@ -1,529 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ServerChannel_H -#define ServerChannel_H - -#include "List.h" -#include "Channel.h" - -#include "SequenceQueue.h" - -#include "ServerReadBuffer.h" - -#include "Unpack.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// How many sequence numbers of split commit -// requests we are going to save in order to -// mask errors. -// - -#define MAX_COMMIT_SEQUENCE_QUEUE 16 - -// -// Define this to know when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// This class implements the X server -// side compression of X protocol. -// - -class ServerChannel : public Channel -{ - public: - - ServerChannel(Transport *transport, StaticCompressor *compressor); - - virtual ~ServerChannel(); - - virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, - unsigned int length); - - virtual int handleWrite(const unsigned char *message, unsigned int length); - - virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, - T_store_action action, int position, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size) - { - return 0; - } - - virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, - T_store_action action, int position, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - virtual int handleSplit(EncodeBuffer &encodeBuffer) - { - return 0; - } - - virtual int handleSplit(DecodeBuffer &decodeBuffer); - - virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split); - - virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) - { - return 0; - } - - // - // Send the last motion notify event - // received from the X server to the - // remote proxy. - // - - virtual int handleMotion(EncodeBuffer &encodeBuffer); - - virtual int handleCompletion(EncodeBuffer &encodeBuffer) - { - return 0; - } - - virtual int handleConfiguration(); - - virtual int handleFinish(); - - virtual int handleAsyncEvents(); - - virtual int needSplit() const - { - return 0; - } - - virtual int needMotion() const - { - return (lastMotion_[0] != '\0'); - } - - virtual T_channel_type getType() const - { - return channel_x11; - } - - int setBigEndian(int flag); - - // - // Initialize the static members. - // - - static int setReferences(); - - private: - - int handleFastReadReply(EncodeBuffer &encodeBuffer, const unsigned char &opcode, - const unsigned char *&buffer, const unsigned int &size); - - int handleFastReadEvent(EncodeBuffer &encodeBuffer, const unsigned char &opcode, - const unsigned char *&buffer, const unsigned int &size); - - int handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Handle the fake authorization cookie - // and the X server's reply. - // - - int handleAuthorization(unsigned char *buffer); - int handleAuthorization(const unsigned char *buffer, int size); - - // - // Set the unpack colormap and the alpha - // blending data to be used to unpack - // images. - // - - int handleGeometry(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - int handleColormap(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - int handleAlpha(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - // - // Manage the decoded buffer to unpack - // the image and move the data to the - // shared memory segment. - // - - int handleImage(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - // - // Uncompress a packed image in one - // or more graphic X requests. - // - - int handleUnpack(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - // - // Move the image to the shared - // memory buffer. - // - - int handleShmem(unsigned char &opcode, unsigned char *&buffer, - unsigned int &size); - - // - // Handle suppression of error on - // commit of image splits. - // - - void initCommitQueue(); - - void updateCommitQueue(unsigned short sequence); - - int checkCommitError(unsigned char error, unsigned short sequence, - const unsigned char *buffer); - - void clearCommitQueue() - { - if (commitSequenceQueue_[0] != 0) - { - initCommitQueue(); - } - } - - // - // Check if the user pressed the - // CTRL+ALT+SHIFT+ESC keystroke. - // - - int checkKeyboardEvent(unsigned char event, unsigned short sequence, - const unsigned char *buffer); - - // - // Other utilities. - // - - void handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuffer &encodeBuffer); - - // - // Handle the MIT-SHM initialization - // messages exchanged with the remote - // proxy. - // - - int handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - - int handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned int stage, const unsigned char *buffer, - const unsigned int size); - - // - // Try to read more events in the attempt to - // get the MIT-SHM image completion event - // from the X server. - // - - int handleShmemEvent(); - - // - // Handle the MIT-SHM events as they are read - // from the socket. - // - - int checkShmemEvent(unsigned char event, unsigned short sequence, - const unsigned char *buffer); - - int checkShmemError(unsigned char error, unsigned short sequence, - const unsigned char *buffer); - - // - // Query the port used to tunnel - // the font server connections. - // - - int handleFontRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - int handleFontReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, - const unsigned char *buffer, const unsigned int size); - - // - // Set the cache policy for image - // requests. - // - - int handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Decode the start and end split - // requests. - // - - int handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - int handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Remove the split store and the - // incomplete messages from the - // memory cache. - // - - int handleAbortSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - // - // Send the split requests to the - // X server once they have been - // recomposed. - // - - int handleCommitSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, - unsigned char *&buffer, unsigned int &size); - - int handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum); - - // - // Allocate and free the shared memory - // support resources. - // - - void handleShmemStateAlloc(); - void handleShmemStateRemove(); - - // - // Temporary storage for the image info. - // - - void handleImageStateAlloc(unsigned char opcode) - { - if (imageState_ == NULL) - { - imageState_ = new T_image_state(); - } - - imageState_ -> opcode = opcode; - } - - void handleImageStateRemove() - { - if (imageState_ != NULL) - { - delete imageState_; - - imageState_ = NULL; - } - } - - // - // Store the information needed to unpack - // images per each known agent's client. - // - - void handleUnpackStateInit(int resource); - - void handleUnpackAllocGeometry(int resource); - void handleUnpackAllocColormap(int resource); - void handleUnpackAllocAlpha(int resource); - - void handleUnpackStateRemove(int resource); - - typedef struct - { - T_geometry *geometry; - T_colormap *colormap; - T_alpha *alpha; - - } T_unpack_state; - - T_unpack_state *unpackState_[256]; - - // - // Own read buffer. It is able to identify - // full messages read from X descriptor. - // - - ServerReadBuffer readBuffer_; - - // - // Sequence number of last request coming - // from X client or X server. - // - - unsigned int clientSequence_; - unsigned int serverSequence_; - - // - // Used to identify replies based on sequence - // number of original request. - // - - SequenceQueue sequenceQueue_; - - // - // Last motion notify read from the X server. - // - - unsigned char lastMotion_[32]; - - // - // Sequence numbers of last auto-generated - // put image requests. Needed to intercept - // and suppress errors generated by such - // requests. - // - - unsigned int commitSequenceQueue_[MAX_COMMIT_SEQUENCE_QUEUE]; - - // - // Let agent select which expose - // events is going to receive. - // - - unsigned int enableExpose_; - unsigned int enableGraphicsExpose_; - unsigned int enableNoExpose_; - - // - // Used in initialization and handling - // of MIT-SHM shared memory put images. - // - - typedef struct - { - int stage; - int present; - int enabled; - int segment; - int id; - void *address; - unsigned int size; - - unsigned char opcode; - unsigned char event; - unsigned char error; - - unsigned int sequence; - unsigned int offset; - T_timestamp last; - - unsigned int checked; - - } T_shmem_state; - - T_shmem_state *shmemState_; - - // - // Used to pass current image data between - // the different decompression stages. - // - - typedef struct - { - unsigned char opcode; - - unsigned int drawable; - unsigned int gcontext; - - unsigned char method; - - unsigned char format; - unsigned char srcDepth; - unsigned char dstDepth; - - unsigned int srcLength; - unsigned int dstLength; - unsigned int dstLines; - - short int srcX; - short int srcY; - unsigned short srcWidth; - unsigned short srcHeight; - - short int dstX; - short int dstY; - unsigned short dstWidth; - unsigned short dstHeight; - - unsigned char leftPad; - - } T_image_state; - - T_image_state *imageState_; - - // - // The flags is set according to the - // split load and save policy set by - // the encoding side. - // - - typedef struct - { - int resource; - int current; - int load; - int save; - int commit; - - } T_split_state; - - T_split_state splitState_; - - // - // List of agent resources. - // - - List splitResources_; - - // - // Keep track of object creation and - // deletion. - // - - private: - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -#endif /* ServerChannel_H */ diff --git a/nxcomp/ServerProxy.cpp b/nxcomp/ServerProxy.cpp deleted file mode 100644 index 5d1765183..000000000 --- a/nxcomp/ServerProxy.cpp +++ /dev/null @@ -1,617 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "NXalert.h" - -#include "Socket.h" - -#include "ServerProxy.h" - -#include "ServerChannel.h" -#include "GenericChannel.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Log the operations related to sending -// and receiving the control tokens. -// - -#undef TOKEN - -ServerProxy::ServerProxy(int proxyFd) : Proxy(proxyFd) - -{ - xServerAddrFamily_ = -1; - xServerAddrLength_ = 0; - - xServerAddr_ = NULL; - xServerDisplay_ = NULL; - - cupsServerPort_ = NULL; - smbServerPort_ = NULL; - mediaServerPort_ = NULL; - httpServerPort_ = NULL; - - fontServerPort_ = NULL; - - #ifdef DEBUG - *logofs << "ServerProxy: Created new object at " << this - << ".\n" << logofs_flush; - #endif -} - -ServerProxy::~ServerProxy() -{ - delete xServerAddr_; - - delete [] xServerDisplay_; - - delete [] fontServerPort_; - - #ifdef DEBUG - *logofs << "ServerProxy: Deleted object at " << this - << ".\n" << logofs_flush; - #endif -} - -void ServerProxy::handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, - sockaddr *xServerAddr, unsigned int xServerAddrLength) -{ - delete xServerAddr_; - - xServerAddr_ = xServerAddr; - - xServerAddrFamily_ = xServerAddrFamily; - xServerAddrLength_ = xServerAddrLength; - - delete [] xServerDisplay_; - - xServerDisplay_ = new char[strlen(xServerDisplay) + 1]; - - strcpy(xServerDisplay_, xServerDisplay); - - #ifdef DEBUG - *logofs << "ServerProxy: Set display configuration to display '" - << xServerDisplay_ << "'.\n" - << logofs_flush; - #endif -} - -void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort, - ChannelEndPoint &smbServerPort, - ChannelEndPoint &mediaServerPort, - ChannelEndPoint &httpServerPort, - const char *fontServerPort) -{ - cupsServerPort_ = cupsServerPort; - smbServerPort_ = smbServerPort; - mediaServerPort_ = mediaServerPort; - httpServerPort_ = httpServerPort; - - delete [] fontServerPort_; - - fontServerPort_ = new char[strlen(fontServerPort) + 1]; - - strcpy(fontServerPort_, fontServerPort); - - #ifdef DEBUG - *logofs << "ServerProxy: Set port configuration to CUPS " - << cupsServerPort_ << ", SMB " << smbServerPort_ - << ", media " << mediaServerPort_ << ", HTTP " - << httpServerPort_ << ".\n" - << logofs_flush; - #endif -} - -int ServerProxy::handleNewConnection(T_channel_type type, int clientFd) -{ - switch (type) - { - case channel_font: - { - return handleNewGenericConnection(clientFd, channel_font, "font"); - } - case channel_slave: - { - return handleNewSlaveConnection(clientFd); - } - default: - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Unsupported channel with type '" - << getTypeName(type) << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unsupported channel with type '" - << getTypeName(type) << "'.\n"; - - return -1; - } - } -} - -int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) -{ - switch (type) - { - case channel_x11: - { - return handleNewXConnectionFromProxy(channelId); - } - case channel_cups: - { - return handleNewGenericConnectionFromProxy(channelId, channel_cups, - cupsServerPort_, "CUPS"); - } - case channel_smb: - { - smbServerPort_.setDefaultTCPInterface(1); - return handleNewGenericConnectionFromProxy(channelId, channel_smb, - smbServerPort_, "SMB"); - } - case channel_media: - { - return handleNewGenericConnectionFromProxy(channelId, channel_media, - mediaServerPort_, "media"); - } - case channel_http: - { - return handleNewGenericConnectionFromProxy(channelId, channel_http, - httpServerPort_, "HTTP"); - } - case channel_slave: - { - return handleNewSlaveConnectionFromProxy(channelId); - } - default: - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Unsupported channel with type '" - << getTypeName(type) << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Unsupported channel with type '" - << getTypeName(type) << "'.\n"; - - return -1; - } - } -} - -int ServerProxy::handleNewAgentConnection(Agent *agent) -{ - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Can't create an agent " - << "connection at this side.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create an agent " - << "connection at this side.\n"; - - return -1; -} - -int ServerProxy::handleNewXConnection(int clientFd) -{ - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Can't create a new X channel " - << "with FD#" << clientFd << " at this side.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't create a new X channel " - << "with FD#" << clientFd << " at this side.\n"; - - return -1; -} - -int ServerProxy::handleNewXConnectionFromProxy(int channelId) -{ - // - // Connect to the real X server. - // - - int retryConnect = control -> OptionServerRetryConnect; - - int xServerFd; - - for (;;) - { - xServerFd = socket(xServerAddrFamily_, SOCK_STREAM, PF_UNSPEC); - - if (xServerFd < 0) - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Call to socket failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - return -1; - } - - #ifdef TEST - *logofs << "ServerProxy: Trying to connect to X server '" - << xServerDisplay_ << "'.\n" << logofs_flush; - #endif - - int result = connect(xServerFd, xServerAddr_, xServerAddrLength_); - - getNewTimestamp(); - - if (result < 0) - { - #ifdef WARNING - *logofs << "ServerProxy: WARNING! Connection to '" - << xServerDisplay_ << "' failed with error '" - << ESTR() << "'. Retrying.\n" << logofs_flush; - #endif - - close(xServerFd); - - if (--retryConnect == 0) - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Connection to '" - << xServerDisplay_ << "' for channel ID#" - << channelId << " failed. Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Connection to '" - << xServerDisplay_ << "' failed. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - close(xServerFd); - - return -1; - } - - if (activeChannels_.getSize() == 0) - { - sleep(2); - } - else - { - sleep(1); - } - } - else - { - break; - } - } - - assignChannelMap(channelId, xServerFd); - - #ifdef TEST - *logofs << "ServerProxy: X server descriptor FD#" << xServerFd - << " mapped to channel ID#" << channelId << ".\n" - << logofs_flush; - #endif - - // - // Turn queuing off for path proxy-to-X-server. - // - - if (control -> OptionServerNoDelay == 1) - { - SetNoDelay(xServerFd, control -> OptionServerNoDelay); - } - - // - // If requested, set the size of the TCP send - // and receive buffers. - // - - if (control -> OptionServerSendBuffer != -1) - { - SetSendBuffer(xServerFd, control -> OptionServerSendBuffer); - } - - if (control -> OptionServerReceiveBuffer != -1) - { - SetReceiveBuffer(xServerFd, control -> OptionServerReceiveBuffer); - } - - if (allocateTransport(xServerFd, channelId) < 0) - { - return -1; - } - - // - // Starting from protocol level 3 client and server - // caches are created in proxy and shared between all - // channels. If remote proxy has older protocol level - // pointers are NULL and channels must create their - // own instances. - // - - channels_[channelId] = new ServerChannel(transports_[channelId], compressor_); - - if (channels_[channelId] == NULL) - { - deallocateTransport(channelId); - - return -1; - } - - increaseChannels(channelId); - - // - // Propagate channel stores and caches to the new - // channel. - // - - channels_[channelId] -> setOpcodes(opcodeStore_); - - channels_[channelId] -> setStores(clientStore_, serverStore_); - - channels_[channelId] -> setCaches(clientCache_, serverCache_); - - int port = atoi(fontServerPort_); - - if (port > 0) - { - channels_[channelId] -> setPorts(port); - } - - // - // Let channel configure itself according - // to control parameters. - // - - channels_[channelId] -> handleConfiguration(); - - // - // Check if we have successfully loaded the - // selected cache and, if not, remove it - // from disk. - // - - handleCheckLoad(); - - return 1; -} - -// -// Check if we still need to drop a channel. We need -// to check this explicitly at the time we receive a -// request to load or save the cache because we could -// receive the control message before having entered -// the function handling the channel events. -// - -int ServerProxy::handleCheckDrop() -{ - T_list channelList = activeChannels_.copyList(); - - for (T_list::iterator j = channelList.begin(); - j != channelList.end(); j++) - { - int channelId = *j; - - if (channels_[channelId] != NULL && - (channels_[channelId] -> getDrop() == 1 || - channels_[channelId] -> getClosing() == 1)) - { - #ifdef TEST - *logofs << "ServerProxy: Dropping the descriptor FD#" - << getFd(channelId) << " channel ID#" - << channelId << ".\n" << logofs_flush; - #endif - - handleDrop(channelId); - } - } - - return 1; -} - -int ServerProxy::handleCheckLoad() -{ - // - // Check if we just created the first X channel - // but the client side didn't tell us to load - // the cache selected at the session negotiation. - // This is very likely because the load operation - // failed at the remote side, for example because - // the cache was invalid or corrupted. - // - - int channelCount = getChannels(channel_x11); - - if (channelCount != 1) - { - return 0; - } - - if (control -> PersistentCacheEnableLoad == 1 && - control -> PersistentCachePath != NULL && - control -> PersistentCacheName != NULL && - isTimestamp(timeouts_.loadTs) == 0) - { - #ifdef WARNING - *logofs << "ServerProxy: WARNING! Cache file '" << control -> PersistentCachePath - << "/" << control -> PersistentCacheName << "' not loaded.\n" - << logofs_flush; - #endif - - // - // Remove the cache file. - // - - #ifdef WARNING - *logofs << "ServerProxy: WARNING! Removing supposedly " - << "incompatible cache '" << control -> PersistentCachePath - << "/" << control -> PersistentCacheName - << "'.\n" << logofs_flush; - #endif - - handleResetPersistentCache(); - } - - return 1; -} - -int ServerProxy::handleLoadFromProxy() -{ - // - // Be sure we drop any confirmed channel. - // - - handleCheckDrop(); - - // - // Check that either no X channel is - // remaining or we are inside a reset. - // - - int channelCount = getChannels(channel_x11); - - if (channelCount > 0) - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Protocol violation " - << "in command load with " << channelCount - << " channels.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Protocol violation " - << "in command load from proxy.\n"; - - return -1; - } - else if (handleLoadStores() < 0) - { - #ifdef WARNING - *logofs << "ServerProxy: WARNING! Failed to load content " - << "of persistent cache.\n" << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int ServerProxy::handleSaveFromProxy() -{ - // - // Be sure we drop any confirmed channel. - // - - handleCheckDrop(); - - // - // Now verify that all channels are gone. - // - - int channelCount = getChannels(channel_x11); - - if (channelCount > 0) - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Protocol violation " - << "in command save with " << channelCount - << " channels.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Protocol violation " - << "in command save from proxy.\n"; - - return -1; - } - else if (handleSaveStores() < 0) - { - #ifdef PANIC - *logofs << "ServerProxy: PANIC! Failed to save stores " - << "to persistent cache.\n" << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int ServerProxy::handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient) const -{ - if (clientStore_ -> saveRequestStores(cachefs, md5StateStream, md5StateClient, - discard_checksum, use_data) < 0) - { - return -1; - } - else if (serverStore_ -> saveReplyStores(cachefs, md5StateStream, md5StateClient, - use_checksum, discard_data) < 0) - { - return -1; - } - else if (serverStore_ -> saveEventStores(cachefs, md5StateStream, md5StateClient, - use_checksum, discard_data) < 0) - { - return -1; - } - - return 1; -} - -int ServerProxy::handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const -{ - if (clientStore_ -> loadRequestStores(cachefs, md5StateStream, - discard_checksum, use_data) < 0) - { - return -1; - } - else if (serverStore_ -> loadReplyStores(cachefs, md5StateStream, - use_checksum, discard_data) < 0) - { - return -1; - } - else if (serverStore_ -> loadEventStores(cachefs, md5StateStream, - use_checksum, discard_data) < 0) - { - return -1; - } - - return 1; -} diff --git a/nxcomp/ServerProxy.h b/nxcomp/ServerProxy.h deleted file mode 100644 index e169c4aec..000000000 --- a/nxcomp/ServerProxy.h +++ /dev/null @@ -1,154 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ServerProxy_H -#define ServerProxy_H - -#include -#include - -#include "Proxy.h" - -#include "Misc.h" -#include "ChannelEndPoint.h" - -// -// Set the verbosity level. -// - -#undef TEST -#undef DEBUG - -class ServerProxy : public Proxy -{ - public: - - ServerProxy(int proxyFd); - - virtual ~ServerProxy(); - - virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, - sockaddr *xServerAddr, unsigned int xServerAddrLength); - - virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, - ChannelEndPoint &smbServerPort, - ChannelEndPoint &mediaServerPort, - ChannelEndPoint &httpServerPort, - const char *fontServerPort); - - protected: - - // - // Create a new channel. - // - - virtual int handleNewConnection(T_channel_type type, int clientFd); - - virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId); - - virtual int handleNewAgentConnection(Agent *agent); - - virtual int handleNewXConnection(int clientFd); - - virtual int handleNewXConnectionFromProxy(int channelId); - - // - // Implement persistence according - // to our proxy mode. - // - - virtual int handleLoad(T_load_type type) - { - return 0; - } - - virtual int handleSave() - { - return 0; - } - - virtual int handleAsyncEvents() - { - return 0; - } - - virtual int handleLoadFromProxy(); - virtual int handleSaveFromProxy(); - - virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient) const; - - virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const; - - int handleCheckDrop(); - int handleCheckLoad(); - - // - // Utility function used to realize - // a new connection. - // - - protected: - - virtual int checkLocalChannelMap(int channelId) - { - // Since ProtoStep7 (#issue 108) - return ((channelId & control -> ChannelMask) == 0); - } - - private: - - // FIXME: Use a ChannelEndPoint object also for the X server! - int xServerAddrFamily_; - sockaddr *xServerAddr_; - unsigned int xServerAddrLength_; - - // - // This is the name of the X display where - // we are going to forward connections. - // - - char *xServerDisplay_; - - // - // Ports where to forward extended services' - // TCP connections. - // - - ChannelEndPoint cupsServerPort_; - ChannelEndPoint smbServerPort_; - ChannelEndPoint mediaServerPort_; - ChannelEndPoint httpServerPort_; - - // - // It will have to be passed to the channel - // so that it can set the port where the - // font server connections are tunneled. - // - - char *fontServerPort_; -}; - -#endif /* ServerProxy_H */ diff --git a/nxcomp/ServerReadBuffer.cpp b/nxcomp/ServerReadBuffer.cpp deleted file mode 100644 index 5bd9bb60f..000000000 --- a/nxcomp/ServerReadBuffer.cpp +++ /dev/null @@ -1,243 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ServerReadBuffer.h" -#include "ServerChannel.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -unsigned int ServerReadBuffer::suggestedLength(unsigned int pendingLength) -{ - // - // Always read all the data that - // is available. - // - - int readable = transport_ -> readable(); - - unsigned int readLength = (readable == -1 ? 0 : (unsigned int) readable); - - if (readLength < pendingLength) - { - readLength = pendingLength; - } - - // - // Even if the readable data is not - // enough to make a complete message, - // resize the buffer to accommodate - // it all. - // - - if (pendingLength < remaining_) - { - readLength = remaining_; - } - - return readLength; -} - -int ServerReadBuffer::locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength) -{ - unsigned int size = end - start; - - #ifdef TEST - *logofs << "ServerReadBuffer: Locating message for FD#" - << transport_ -> fd() << " with " << size - << " bytes.\n" << logofs_flush; - #endif - - if (firstMessage_) - { - if (size < 8) - { - remaining_ = 8 - size; - - #ifdef TEST - *logofs << "ServerReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - dataLength = 8 + (GetUINT(start + 6, bigEndian_) << 2); - } - else - { - if (size < 32) - { - remaining_ = 32 - size; - - #ifdef TEST - *logofs << "ServerReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - if (*start == 1) - { - dataLength = 32 + (GetULONG(start + 4, bigEndian_) << 2); - } - else - { - dataLength = 32; - } - - if (dataLength < 32) - { - #ifdef TEST - *logofs << "ServerReadBuffer: WARNING! Assuming length 32 " - << "for suspicious message of length " << dataLength - << ".\n" << logofs_flush; - #endif - - dataLength = 32; - } - } - - #ifdef TEST - *logofs << "ServerReadBuffer: Length of the next message is " - << dataLength << ".\n" << logofs_flush; - #endif - - if (size < dataLength) - { - remaining_ = dataLength - size; - - #ifdef TEST - *logofs << "ServerReadBuffer: No message was located " - << "with remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - firstMessage_ = 0; - - controlLength = 0; - trailerLength = 0; - - remaining_ = 0; - - #ifdef TEST - *logofs << "ServerReadBuffer: Located message with " - << "remaining " << remaining_ << ".\n" - << logofs_flush; - #endif - - return 1; -} - -// -// Check if the data already read contains a -// message matching the opcode and sequence, -// starting at the given offset. -// - -unsigned char *ServerReadBuffer::peekMessage(unsigned int &offset, unsigned char opcode, - unsigned short sequence) -{ - #ifdef TEST - *logofs << "ServerReadBuffer: Peeking message " - << "for FD#" << transport_ -> fd() << " with size " - << length_ << " offset " << offset << " opcode " - << (unsigned int) opcode << " and sequence " - << sequence << ".\n" << logofs_flush; - #endif - - if (firstMessage_) - { - return NULL; - } - - unsigned char *next = buffer_ + start_ + offset; - unsigned char *end = buffer_ + start_ + length_; - - int found = 0; - - while (end - next >= 32) - { - #ifdef DEBUG - *logofs << "ServerReadBuffer: Checking opcode " - << (unsigned int) *next << " sequence " - << GetUINT(next + 2, bigEndian_) - << " at " << next - buffer_ + start_ - << ".\n" << logofs_flush; - #endif - - if (*next == opcode && GetUINT(next + 2, bigEndian_) == sequence) - { - found = 1; - - break; - } - else if (*next == 1) - { - next += (32 + (GetULONG(next + 4, bigEndian_) << 2)); - } - else - { - next += 32; - } - } - - offset = next - buffer_ + start_; - - if (found == 1) - { - #ifdef TEST - *logofs << "ServerReadBuffer: Found message at " - << "offset " << next - buffer_ + start_ - << ".\n" << logofs_flush; - #endif - - return next; - } - - #ifdef TEST - *logofs << "ServerReadBuffer: Quitting loop at " - << "offset " << next - buffer_ + start_ - << ".\n" << logofs_flush; - #endif - - return NULL; -} diff --git a/nxcomp/ServerReadBuffer.h b/nxcomp/ServerReadBuffer.h deleted file mode 100644 index d6c207ead..000000000 --- a/nxcomp/ServerReadBuffer.h +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ServerReadBuffer_H -#define ServerReadBuffer_H - -#include "ReadBuffer.h" -#include "Control.h" - -class ServerChannel; - -class ServerReadBuffer : public ReadBuffer -{ - public: - - ServerReadBuffer(Transport *transport, ServerChannel *channel) - - : ReadBuffer(transport), firstMessage_(1), channel_(channel) - { - } - - virtual ~ServerReadBuffer() - { - } - - void setBigEndian(int flag) - { - bigEndian_ = flag; - } - - unsigned char *peekMessage(unsigned int &offset, unsigned char opcode, - unsigned short sequence); - - protected: - - virtual unsigned int suggestedLength(unsigned int pendingLength); - - virtual int locateMessage(const unsigned char *start, - const unsigned char *end, - unsigned int &controlLength, - unsigned int &dataLength, - unsigned int &trailerLength); - - int bigEndian_; - - int firstMessage_; - - ServerChannel *channel_; -}; - -#endif /* ServerReadBuffer_H */ diff --git a/nxcomp/ServerStore.cpp b/nxcomp/ServerStore.cpp deleted file mode 100644 index 0fb17d974..000000000 --- a/nxcomp/ServerStore.cpp +++ /dev/null @@ -1,179 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ServerStore.h" - -// -// Cached reply classes. -// - -#include "GetImageReply.h" -#include "ListFontsReply.h" -#include "QueryFontReply.h" -#include "GetPropertyReply.h" -#include "GenericReply.h" - -// -// Set the verbosity level. -// - -#define WARNING -#define PANIC -#undef TEST - -ServerStore::ServerStore(StaticCompressor *compressor) -{ - if (logofs == NULL) - { - logofs = &cout; - } - - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - replies_[i] = NULL; - events_[i] = NULL; - } - - replies_[X_ListFonts] = new ListFontsReplyStore(compressor); - replies_[X_QueryFont] = new QueryFontReplyStore(compressor); - replies_[X_GetImage] = new GetImageReplyStore(compressor); - replies_[X_GetProperty] = new GetPropertyReplyStore(compressor); - - replies_[X_NXInternalGenericReply] = new GenericReplyStore(compressor); -} - -ServerStore::~ServerStore() -{ - if (logofs == NULL) - { - logofs = &cout; - } - - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - delete replies_[i]; - delete events_[i]; - } -} - -int ServerStore::saveReplyStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction) const -{ - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (replies_[i] != NULL && - replies_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, - checksumAction, dataAction, - storeBigEndian()) < 0) - { - #ifdef PANIC - *logofs << "ServerStore: PANIC! Error saving reply store " - << "for OPCODE#" << (unsigned int) i << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error saving reply store " - << "for opcode '" << (unsigned int) i << "'.\n"; - - return -1; - } - } - - return 1; -} - -int ServerStore::saveEventStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction) const -{ - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (events_[i] != NULL && - events_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, - checksumAction, dataAction, - storeBigEndian()) < 0) - { - #ifdef PANIC - *logofs << "ServerStore: PANIC! Error saving event store " - << "for OPCODE#" << (unsigned int) i << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Error saving event store " - << "for opcode '" << (unsigned int) i << "'.\n"; - - return -1; - } - } - - return 1; -} - -int ServerStore::loadReplyStores(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction) const -{ - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (replies_[i] != NULL && - replies_[i] -> loadStore(cachefs, md5StateStream, - checksumAction, dataAction, - storeBigEndian()) < 0) - { - #ifdef PANIC - *logofs << "ServerStore: PANIC! Error loading reply store " - << "for OPCODE#" << (unsigned int) i << ".\n" - << logofs_flush; - #endif - - return -1; - } - } - - return 1; -} - -int ServerStore::loadEventStores(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction) const -{ - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (events_[i] != NULL && - events_[i] -> loadStore(cachefs, md5StateStream, - checksumAction, dataAction, - storeBigEndian()) < 0) - { - #ifdef PANIC - *logofs << "ServerStore: PANIC! Error loading event store " - << "for OPCODE#" << (unsigned int) i << ".\n" - << logofs_flush; - #endif - - return -1; - } - } - - return 1; -} diff --git a/nxcomp/ServerStore.h b/nxcomp/ServerStore.h deleted file mode 100644 index dbbb968e5..000000000 --- a/nxcomp/ServerStore.h +++ /dev/null @@ -1,83 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ServerStore_H -#define ServerStore_H - -#include "Message.h" - -#include "ChannelStore.h" - -class StaticCompressor; - -class ServerStore : public ChannelStore -{ - public: - - ServerStore(StaticCompressor *compressor); - - virtual ~ServerStore(); - - MessageStore *getReplyStore(unsigned char opcode) const - { - return replies_[opcode]; - } - - MessageStore *getEventStore(unsigned char opcode) const - { - return events_[opcode]; - } - - // - // Actually save the message store - // to disk according to proxy mode. - // - - int saveReplyStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction) const; - - int saveEventStores(ostream *cachefs, md5_state_t *md5StateStream, - md5_state_t *md5StateClient, T_checksum_action checksumAction, - T_data_action dataAction) const; - - - int loadReplyStores(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction) const; - - int loadEventStores(istream *cachefs, md5_state_t *md5StateStream, - T_checksum_action checksumAction, T_data_action dataAction) const; - - private: - - // - // A server store contains replies and events. - // - - MessageStore *replies_[CHANNEL_STORE_OPCODE_LIMIT]; - MessageStore *events_[CHANNEL_STORE_OPCODE_LIMIT]; -}; - -#endif /* ServerStore_H */ diff --git a/nxcomp/SetClipRectangles.cpp b/nxcomp/SetClipRectangles.cpp deleted file mode 100644 index 164ead006..000000000 --- a/nxcomp/SetClipRectangles.cpp +++ /dev/null @@ -1,150 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "SetClipRectangles.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int SetClipRectanglesStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; - - // - // Here is the fingerprint. - // - - setClipRectangles -> ordering = *(buffer + 1); - - setClipRectangles -> gcontext = GetULONG(buffer + 4, bigEndian); - - setClipRectangles -> x_origin = GetUINT(buffer + 8, bigEndian); - setClipRectangles -> y_origin = GetUINT(buffer + 10, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int SetClipRectanglesStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; - - // - // Fill all the message's fields. - // - - *(buffer + 1) = setClipRectangles -> ordering; - - PutULONG(setClipRectangles -> gcontext, buffer + 4, bigEndian); - - PutUINT(setClipRectangles -> x_origin, buffer + 8, bigEndian); - PutUINT(setClipRectangles -> y_origin, buffer + 10, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void SetClipRectanglesStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; - - *logofs << name() << ": Identity ordering " << (unsigned int) setClipRectangles -> ordering - << ", gcontext " << setClipRectangles -> gcontext << ", x_origin " - << setClipRectangles -> x_origin << ", y_origin " - << setClipRectangles -> y_origin << ", size " - << setClipRectangles -> size_ << ".\n" << logofs_flush; - #endif -} - -void SetClipRectanglesStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 1, 1); - md5_append(md5_state_, buffer + 8, 4); -} - -void SetClipRectanglesStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; - SetClipRectanglesMessage *cachedSetClipRectangles = (SetClipRectanglesMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " << setClipRectangles -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeXidValue(setClipRectangles -> gcontext, clientCache -> gcCache); - - cachedSetClipRectangles -> gcontext = setClipRectangles -> gcontext; -} - -void SetClipRectanglesStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - decodeBuffer.decodeXidValue(value, clientCache -> gcCache); - - setClipRectangles -> gcontext = value; - - #ifdef DEBUG - *logofs << name() << ": Decoded value " << setClipRectangles -> gcontext - << " as gcontext field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/SetClipRectangles.h b/nxcomp/SetClipRectangles.h deleted file mode 100644 index a2245360c..000000000 --- a/nxcomp/SetClipRectangles.h +++ /dev/null @@ -1,187 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef SetClipRectangles_H -#define SetClipRectangles_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define SETCLIPRECTANGLES_ENABLE_CACHE 1 -#define SETCLIPRECTANGLES_ENABLE_DATA 0 -#define SETCLIPRECTANGLES_ENABLE_SPLIT 0 -#define SETCLIPRECTANGLES_ENABLE_COMPRESS 0 - -#define SETCLIPRECTANGLES_DATA_LIMIT 2048 -#define SETCLIPRECTANGLES_DATA_OFFSET 12 - -#define SETCLIPRECTANGLES_CACHE_SLOTS 3000 -#define SETCLIPRECTANGLES_CACHE_THRESHOLD 3 -#define SETCLIPRECTANGLES_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class SetClipRectanglesMessage : public Message -{ - friend class SetClipRectanglesStore; - - public: - - SetClipRectanglesMessage() - { - } - - ~SetClipRectanglesMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char ordering; - unsigned int gcontext; - unsigned short x_origin; - unsigned short y_origin; -}; - -class SetClipRectanglesStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - SetClipRectanglesStore() : MessageStore() - { - enableCache = SETCLIPRECTANGLES_ENABLE_CACHE; - enableData = SETCLIPRECTANGLES_ENABLE_DATA; - enableSplit = SETCLIPRECTANGLES_ENABLE_SPLIT; - enableCompress = SETCLIPRECTANGLES_ENABLE_COMPRESS; - - dataLimit = SETCLIPRECTANGLES_DATA_LIMIT; - dataOffset = SETCLIPRECTANGLES_DATA_OFFSET; - - cacheSlots = SETCLIPRECTANGLES_CACHE_SLOTS; - cacheThreshold = SETCLIPRECTANGLES_CACHE_THRESHOLD; - cacheLowerThreshold = SETCLIPRECTANGLES_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~SetClipRectanglesStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "SetClipRectangles"; - } - - virtual unsigned char opcode() const - { - return X_SetClipRectangles; - } - - virtual unsigned int storage() const - { - return sizeof(SetClipRectanglesMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new SetClipRectanglesMessage(); - } - - virtual Message *create(const Message &message) const - { - return new SetClipRectanglesMessage((const SetClipRectanglesMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (SetClipRectanglesMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* SetClipRectangles_H */ diff --git a/nxcomp/SetUnpackAlpha.cpp b/nxcomp/SetUnpackAlpha.cpp deleted file mode 100644 index cf09074e3..000000000 --- a/nxcomp/SetUnpackAlpha.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "SetUnpackAlpha.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -SetUnpackAlphaStore::SetUnpackAlphaStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = SETUNPACKALPHA_ENABLE_CACHE; - enableData = SETUNPACKALPHA_ENABLE_DATA; - enableCompress = SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = SETUNPACKALPHA_DATA_LIMIT; - dataOffset = SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7; - - cacheSlots = SETUNPACKALPHA_CACHE_SLOTS; - cacheThreshold = SETUNPACKALPHA_CACHE_THRESHOLD; - cacheLowerThreshold = SETUNPACKALPHA_CACHE_LOWER_THRESHOLD; - - // Since ProtoStep8 (#issue 108) - enableSplit = SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -SetUnpackAlphaStore::~SetUnpackAlphaStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int SetUnpackAlphaStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - // - // Encode the source length first because - // we need it to determine the size of - // the output buffer. - // - - // SrcLength. - encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian), 32, 9); - - // Client. - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> resourceCache); - // Method. - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> methodCache); - // DstLength. - encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackAlphaStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - unsigned int value; - unsigned char cValue; - - // SrcLength. - decodeBuffer.decodeValue(value, 32, 9); - - size = RoundUp4(value) + 16; - - buffer = writeBuffer -> addMessage(size); - - PutULONG(value, buffer + 8, bigEndian); - - // Client. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> resourceCache); - - *(buffer + 1) = cValue; - - // Method. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> methodCache); - - *(buffer + 4) = cValue; - - // DstLength. - decodeBuffer.decodeValue(value, 32, 9); - - PutULONG(value, buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackAlphaStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; - - setUnpackAlpha -> client = *(buffer + 1); - setUnpackAlpha -> method = *(buffer + 4); - - setUnpackAlpha -> src_length = GetULONG(buffer + 8, bigEndian); - setUnpackAlpha -> dst_length = GetULONG(buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackAlphaStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; - - *(buffer + 1) = setUnpackAlpha -> client; - *(buffer + 4) = setUnpackAlpha -> method; - - PutULONG(setUnpackAlpha -> src_length, buffer + 8, bigEndian); - PutULONG(setUnpackAlpha -> dst_length, buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void SetUnpackAlphaStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; - - *logofs << name() << ": Identity client " - << (unsigned int) setUnpackAlpha -> client << " method " - << (unsigned int) setUnpackAlpha -> method << " source length " - << setUnpackAlpha -> src_length << " destination length " - << setUnpackAlpha -> dst_length << " size " - << setUnpackAlpha -> size_ << ".\n"; - - #endif -} - -void SetUnpackAlphaStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Include the pack method and the source - // and destination length. - // - - md5_append(md5_state_, buffer + 4, 1); - md5_append(md5_state_, buffer + 8, 8); -} - -void SetUnpackAlphaStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; - SetUnpackAlphaMessage *cachedSetUnpackAlpha = (SetUnpackAlphaMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(setUnpackAlpha -> client, 8, - clientCache -> resourceCache); - - cachedSetUnpackAlpha -> client = setUnpackAlpha -> client; -} - -void SetUnpackAlphaStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(setUnpackAlpha -> client, 8, - clientCache -> resourceCache); -} diff --git a/nxcomp/SetUnpackAlpha.h b/nxcomp/SetUnpackAlpha.h deleted file mode 100644 index 54714efaa..000000000 --- a/nxcomp/SetUnpackAlpha.h +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef SetUnpackAlpha_H -#define SetUnpackAlpha_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define SETUNPACKALPHA_ENABLE_CACHE 1 -#define SETUNPACKALPHA_ENABLE_DATA 1 - -#define SETUNPACKALPHA_DATA_LIMIT 16384 - -#define SETUNPACKALPHA_CACHE_SLOTS 2000 -#define SETUNPACKALPHA_CACHE_THRESHOLD 10 -#define SETUNPACKALPHA_CACHE_LOWER_THRESHOLD 5 - -#define SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7 16 -#define SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -#define SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8 0 - -// -// The message class. -// - -class SetUnpackAlphaMessage : public Message -{ - friend class SetUnpackAlphaStore; - - public: - - SetUnpackAlphaMessage() - { - } - - ~SetUnpackAlphaMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char client; - unsigned char method; - - unsigned int src_length; - unsigned int dst_length; -}; - -class SetUnpackAlphaStore : public MessageStore -{ - public: - - SetUnpackAlphaStore(StaticCompressor *compressor); - - virtual ~SetUnpackAlphaStore(); - - virtual const char *name() const - { - return "SetUnpackAlpha"; - } - - virtual unsigned char opcode() const - { - return X_NXSetUnpackAlpha; - } - - virtual unsigned int storage() const - { - return sizeof(SetUnpackAlphaMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new SetUnpackAlphaMessage(); - } - - virtual Message *create(const Message &message) const - { - return new SetUnpackAlphaMessage((const SetUnpackAlphaMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (SetUnpackAlphaMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* SetUnpackAlpha_H */ diff --git a/nxcomp/SetUnpackColormap.cpp b/nxcomp/SetUnpackColormap.cpp deleted file mode 100644 index b44a7cf13..000000000 --- a/nxcomp/SetUnpackColormap.cpp +++ /dev/null @@ -1,262 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "SetUnpackColormap.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -SetUnpackColormapStore::SetUnpackColormapStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = SETUNPACKCOLORMAP_ENABLE_CACHE; - enableData = SETUNPACKCOLORMAP_ENABLE_DATA; - enableCompress = SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = SETUNPACKCOLORMAP_DATA_LIMIT; - dataOffset = SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7; - - cacheSlots = SETUNPACKCOLORMAP_CACHE_SLOTS; - cacheThreshold = SETUNPACKCOLORMAP_CACHE_THRESHOLD; - cacheLowerThreshold = SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD; - - // Since ProtoStep8 (#issue 108) - enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -SetUnpackColormapStore::~SetUnpackColormapStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int SetUnpackColormapStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - // - // Encode the source length first because - // we need it to determine the size of - // the output buffer. - // - - // SrcLength. - encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian), 32, 9); - - // Client. - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> resourceCache); - // Method. - encodeBuffer.encodeCachedValue(*(buffer + 4), 8, - clientCache -> methodCache); - // DstLength. - encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackColormapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - unsigned int value; - unsigned char cValue; - - // SrcLength. - decodeBuffer.decodeValue(value, 32, 9); - - size = RoundUp4(value) + 16; - - buffer = writeBuffer -> addMessage(size); - - PutULONG(value, buffer + 8, bigEndian); - - // Client. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> resourceCache); - - *(buffer + 1) = cValue; - - // Method. - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> methodCache); - - *(buffer + 4) = cValue; - - // DstLength. - decodeBuffer.decodeValue(value, 32, 9); - - PutULONG(value, buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackColormapStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; - - setUnpackColormap -> client = *(buffer + 1); - setUnpackColormap -> method = *(buffer + 4); - - setUnpackColormap -> src_length = GetULONG(buffer + 8, bigEndian); - setUnpackColormap -> dst_length = GetULONG(buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackColormapStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; - - *(buffer + 1) = setUnpackColormap -> client; - *(buffer + 4) = setUnpackColormap -> method; - - PutULONG(setUnpackColormap -> src_length, buffer + 8, bigEndian); - PutULONG(setUnpackColormap -> dst_length, buffer + 12, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void SetUnpackColormapStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; - - *logofs << name() << ": Identity client " - << (unsigned int) setUnpackColormap -> client << " method " - << (unsigned int) setUnpackColormap -> method << " source length " - << setUnpackColormap -> src_length << " destination length " - << setUnpackColormap -> dst_length << " size " - << setUnpackColormap -> size_ << ".\n"; - - #endif -} - -void SetUnpackColormapStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Include the pack method and the source - // and destination length. - // - - md5_append(md5_state_, buffer + 4, 1); - md5_append(md5_state_, buffer + 8, 8); -} - -void SetUnpackColormapStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; - SetUnpackColormapMessage *cachedSetUnpackColormap = (SetUnpackColormapMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - encodeBuffer.encodeCachedValue(setUnpackColormap -> client, 8, - clientCache -> resourceCache); - - cachedSetUnpackColormap -> client = setUnpackColormap -> client; -} - -void SetUnpackColormapStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(setUnpackColormap -> client, 8, - clientCache -> resourceCache); -} diff --git a/nxcomp/SetUnpackColormap.h b/nxcomp/SetUnpackColormap.h deleted file mode 100644 index 779366531..000000000 --- a/nxcomp/SetUnpackColormap.h +++ /dev/null @@ -1,162 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef SetUnpackColormap_H -#define SetUnpackColormap_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define SETUNPACKCOLORMAP_ENABLE_CACHE 1 -#define SETUNPACKCOLORMAP_ENABLE_DATA 1 - -#define SETUNPACKCOLORMAP_DATA_LIMIT 4096 - -#define SETUNPACKCOLORMAP_CACHE_SLOTS 2000 -#define SETUNPACKCOLORMAP_CACHE_THRESHOLD 5 -#define SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD 0 - -#define SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7 16 -#define SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -#define SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8 0 - -// -// The message class. -// - -class SetUnpackColormapMessage : public Message -{ - friend class SetUnpackColormapStore; - - public: - - SetUnpackColormapMessage() - { - } - - ~SetUnpackColormapMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char client; - unsigned char method; - - unsigned int src_length; - unsigned int dst_length; -}; - -class SetUnpackColormapStore : public MessageStore -{ - public: - - SetUnpackColormapStore(StaticCompressor *compressor); - - virtual ~SetUnpackColormapStore(); - - virtual const char *name() const - { - return "SetUnpackColormap"; - } - - virtual unsigned char opcode() const - { - return X_NXSetUnpackColormap; - } - - virtual unsigned int storage() const - { - return sizeof(SetUnpackColormapMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new SetUnpackColormapMessage(); - } - - virtual Message *create(const Message &message) const - { - return new SetUnpackColormapMessage((const SetUnpackColormapMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (SetUnpackColormapMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* SetUnpackColormap_H */ diff --git a/nxcomp/SetUnpackGeometry.cpp b/nxcomp/SetUnpackGeometry.cpp deleted file mode 100644 index 49fa4344e..000000000 --- a/nxcomp/SetUnpackGeometry.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "SetUnpackGeometry.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -SetUnpackGeometryStore::SetUnpackGeometryStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = SETUNPACKGEOMETRY_ENABLE_CACHE; - enableData = SETUNPACKGEOMETRY_ENABLE_DATA; - enableSplit = SETUNPACKGEOMETRY_ENABLE_SPLIT; - enableCompress = SETUNPACKGEOMETRY_ENABLE_COMPRESS; - - dataLimit = SETUNPACKGEOMETRY_DATA_LIMIT; - dataOffset = SETUNPACKGEOMETRY_DATA_OFFSET; - - cacheSlots = SETUNPACKGEOMETRY_CACHE_SLOTS; - cacheThreshold = SETUNPACKGEOMETRY_CACHE_THRESHOLD; - cacheLowerThreshold = SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -SetUnpackGeometryStore::~SetUnpackGeometryStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int SetUnpackGeometryStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> resourceCache); - - const unsigned char *nextChar = buffer + 4; - - for (int i = 0; i < 6; i++) - { - encodeBuffer.encodeCachedValue(*nextChar++, 8, - clientCache -> depthCache); - } - - encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32); - encodeBuffer.encodeValue(GetULONG(buffer + 16, bigEndian), 32); - encodeBuffer.encodeValue(GetULONG(buffer + 20, bigEndian), 32); - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackGeometryStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - size = 24; - buffer = writeBuffer -> addMessage(size); - - unsigned char cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> resourceCache); - *(buffer + 1) = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 4) = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 5) = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 6) = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 7) = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 8) = cValue; - - decodeBuffer.decodeCachedValue(cValue, 8, - clientCache -> depthCache); - *(buffer + 9) = cValue; - - unsigned int value; - - decodeBuffer.decodeValue(value, 32); - PutULONG(value, buffer + 12, bigEndian); - - decodeBuffer.decodeValue(value, 32); - PutULONG(value, buffer + 16, bigEndian); - - decodeBuffer.decodeValue(value, 32); - PutULONG(value, buffer + 20, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackGeometryStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; - - setUnpackGeometry -> client = *(buffer + 1); - - setUnpackGeometry -> depth_1_bpp = *(buffer + 4); - setUnpackGeometry -> depth_4_bpp = *(buffer + 5); - setUnpackGeometry -> depth_8_bpp = *(buffer + 6); - setUnpackGeometry -> depth_16_bpp = *(buffer + 7); - setUnpackGeometry -> depth_24_bpp = *(buffer + 8); - setUnpackGeometry -> depth_32_bpp = *(buffer + 9); - - setUnpackGeometry -> red_mask = GetULONG(buffer + 12, bigEndian); - setUnpackGeometry -> green_mask = GetULONG(buffer + 16, bigEndian); - setUnpackGeometry -> blue_mask = GetULONG(buffer + 20, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -int SetUnpackGeometryStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; - - *(buffer + 1) = setUnpackGeometry -> client; - - *(buffer + 4) = setUnpackGeometry -> depth_1_bpp; - *(buffer + 5) = setUnpackGeometry -> depth_4_bpp; - *(buffer + 6) = setUnpackGeometry -> depth_8_bpp; - *(buffer + 7) = setUnpackGeometry -> depth_16_bpp; - *(buffer + 8) = setUnpackGeometry -> depth_24_bpp; - *(buffer + 9) = setUnpackGeometry -> depth_32_bpp; - - PutULONG(setUnpackGeometry -> red_mask, buffer + 12, bigEndian); - PutULONG(setUnpackGeometry -> green_mask, buffer + 16, bigEndian); - PutULONG(setUnpackGeometry -> blue_mask, buffer + 20, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; - #endif - - return 1; -} - -void SetUnpackGeometryStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; - - *logofs << name() << ": Identity client " - << (unsigned) setUnpackGeometry -> client << " depth_1_bpp " - << (unsigned) setUnpackGeometry -> depth_1_bpp << " depth_4_bpp " - << (unsigned int) setUnpackGeometry -> depth_4_bpp << " depth_8_bpp " - << (unsigned int) setUnpackGeometry -> depth_8_bpp << " depth_16_bpp " - << (unsigned int) setUnpackGeometry -> depth_16_bpp << " depth_24_bpp " - << (unsigned int) setUnpackGeometry -> depth_24_bpp << " depth_32_bpp " - << (unsigned int) setUnpackGeometry -> depth_32_bpp - - << " red_mask " << setUnpackGeometry -> red_mask - << " green_mask " << setUnpackGeometry -> green_mask - << " blue_mask " << setUnpackGeometry -> blue_mask - - << " size " << setUnpackGeometry -> size_ << ".\n"; - - #endif -} - -void SetUnpackGeometryStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 4, 6); - md5_append(md5_state_, buffer + 12, 12); -} - -void SetUnpackGeometryStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; - SetUnpackGeometryMessage *cachedSetUnpackGeometry = (SetUnpackGeometryMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef TEST - *logofs << name() << ": Encoding value " - << (unsigned int) setUnpackGeometry -> client - << " as client field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue(setUnpackGeometry -> client, 8, - clientCache -> resourceCache); - - cachedSetUnpackGeometry -> client = setUnpackGeometry -> client; -} - -void SetUnpackGeometryStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - decodeBuffer.decodeCachedValue(setUnpackGeometry -> client, 8, - clientCache -> resourceCache); - - #ifdef DEBUG - *logofs << name() << ": Decoded value " - << (unsigned int) setUnpackGeometry -> client - << " as client field.\n" << logofs_flush; - #endif -} diff --git a/nxcomp/SetUnpackGeometry.h b/nxcomp/SetUnpackGeometry.h deleted file mode 100644 index 96104f57f..000000000 --- a/nxcomp/SetUnpackGeometry.h +++ /dev/null @@ -1,167 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef SetUnpackGeometry_H -#define SetUnpackGeometry_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define SETUNPACKGEOMETRY_ENABLE_CACHE 1 -#define SETUNPACKGEOMETRY_ENABLE_DATA 0 -#define SETUNPACKGEOMETRY_ENABLE_SPLIT 0 -#define SETUNPACKGEOMETRY_ENABLE_COMPRESS 0 - -#define SETUNPACKGEOMETRY_DATA_LIMIT 24 -#define SETUNPACKGEOMETRY_DATA_OFFSET 24 - -#define SETUNPACKGEOMETRY_CACHE_SLOTS 20 -#define SETUNPACKGEOMETRY_CACHE_THRESHOLD 1 -#define SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD 0 - -// -// The message class. -// - -class SetUnpackGeometryMessage : public Message -{ - friend class SetUnpackGeometryStore; - - public: - - SetUnpackGeometryMessage() - { - } - - ~SetUnpackGeometryMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned char client; - - unsigned char depth_1_bpp; - unsigned char depth_4_bpp; - unsigned char depth_8_bpp; - unsigned char depth_16_bpp; - unsigned char depth_24_bpp; - unsigned char depth_32_bpp; - - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; -}; - -class SetUnpackGeometryStore : public MessageStore -{ - public: - - SetUnpackGeometryStore(StaticCompressor *compressor); - - virtual ~SetUnpackGeometryStore(); - - virtual const char *name() const - { - return "SetUnpackGeometry"; - } - - virtual unsigned char opcode() const - { - return X_NXSetUnpackGeometry; - } - - virtual unsigned int storage() const - { - return sizeof(SetUnpackGeometryMessage); - } - - // - // Message handling methods. - // - - protected: - - virtual Message *create() const - { - return new SetUnpackGeometryMessage(); - } - - virtual Message *create(const Message &message) const - { - return new SetUnpackGeometryMessage((const SetUnpackGeometryMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (SetUnpackGeometryMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* SetUnpackGeometry_H */ diff --git a/nxcomp/ShapeExtension.cpp b/nxcomp/ShapeExtension.cpp deleted file mode 100644 index be3b9a903..000000000 --- a/nxcomp/ShapeExtension.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "ShapeExtension.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "WriteBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Constructors and destructors. -// - -ShapeExtensionStore::ShapeExtensionStore(StaticCompressor *compressor) - - : MessageStore(compressor) -{ - enableCache = SHAPEEXTENSION_ENABLE_CACHE; - enableData = SHAPEEXTENSION_ENABLE_DATA; - enableSplit = SHAPEEXTENSION_ENABLE_SPLIT; - - // Since ProtoStep7 (#issue 108) - enableCompress = SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7; - - dataLimit = SHAPEEXTENSION_DATA_LIMIT; - dataOffset = SHAPEEXTENSION_DATA_OFFSET; - - cacheSlots = SHAPEEXTENSION_CACHE_SLOTS; - cacheThreshold = SHAPEEXTENSION_CACHE_THRESHOLD; - cacheLowerThreshold = SHAPEEXTENSION_CACHE_LOWER_THRESHOLD; - - opcode_ = X_NXInternalShapeExtension; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; -} - -ShapeExtensionStore::~ShapeExtensionStore() -{ - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); -} - -// -// Here are the methods to handle messages' content. -// - -int ShapeExtensionStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const -{ - // - // Handle this extension in a way similar to shape. - // - - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; - #endif - - // - // We handle all possible requests of this extension - // using the same opcode. We give to message a data - // offset of 4 (or 16 if proto is >= 3) and handle - // the first 16 bytes through an array of caches. - // - - encodeBuffer.encodeValue(size >> 2, 16, 10); - - encodeBuffer.encodeCachedValue(*(buffer + 1), 8, - clientCache -> shapeOpcodeCache); - - for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) - { - encodeBuffer.encodeCachedValue(GetUINT(buffer + (i * 2) + 4, bigEndian), 16, - *clientCache -> shapeDataCache[i]); - } - - #ifdef DEBUG - *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int ShapeExtensionStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const -{ - ClientCache *clientCache = (ClientCache *) channelCache; - - #ifdef DEBUG - *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; - #endif - - decodeBuffer.decodeValue(size, 16, 10); - - size <<= 2; - - buffer = writeBuffer -> addMessage(size); - - decodeBuffer.decodeCachedValue(*(buffer + 1), 8, - clientCache -> shapeOpcodeCache); - - unsigned int value; - - for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> shapeDataCache[i]); - - PutUINT(value, buffer + 4 + (i * 2), bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; - #endif - - return 1; -} - -int ShapeExtensionStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; - - shapeExtension -> opcode = *(buffer + 1); - - for (unsigned int i = 0; i < 8; i++) - { - if ((i * 2 + 4) < size) - { - shapeExtension -> data[i] = GetUINT(buffer + i * 2 + 4, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed data[" << i << "].\n" - << logofs_flush; - #endif - } - else - { - shapeExtension -> data[i] = 0; - } - } - - #ifdef DEBUG - *logofs << name() << ": Parsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int ShapeExtensionStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; - - *(buffer + 1) = shapeExtension -> opcode; - - for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) - { - PutUINT(shapeExtension -> data[i], buffer + i * 2 + 4, bigEndian); - } - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " - << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void ShapeExtensionStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; - - *logofs << name() << ": Identity opcode " << (unsigned) shapeExtension -> opcode; - - for (int i = 0; i < 8; i++) - { - *logofs << ", data[" << i << "] " << shapeExtension -> data[i]; - } - - *logofs << ", size " << shapeExtension -> size_ << ".\n" << logofs_flush; - - #endif -} - -void ShapeExtensionStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - // - // Include minor opcode in the checksum. As data - // offset can be beyond the real end of message, - // we need to include size or we will match any - // message of size less or equal to data offset. - // - - md5_append(md5_state_, buffer + 1, 3); -} - -void ShapeExtensionStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const -{ - // - // Encode the variant part. - // - - ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; - ShapeExtensionMessage *cachedShapeExtension = (ShapeExtensionMessage *) cachedMessage; - - ClientCache *clientCache = (ClientCache *) channelCache; - - for (int i = 0; i < 8 && (i * 2 + 4) < shapeExtension -> size_; i++) - { - #ifdef TEST - *logofs << name() << ": Encoding value " << shapeExtension -> data[i] - << " as data[" << i << "] field.\n" << logofs_flush; - #endif - - encodeBuffer.encodeCachedValue((unsigned int) shapeExtension -> data[i], 16, - *clientCache -> shapeDataCache[i]); - - cachedShapeExtension -> data[i] = shapeExtension -> data[i]; - } -} - -void ShapeExtensionStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const -{ - ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; - - ClientCache *clientCache = (ClientCache *) channelCache; - - unsigned int value; - - for (int i = 0; i < 8 && (i * 2 + 4) < shapeExtension -> size_; i++) - { - decodeBuffer.decodeCachedValue(value, 16, - *clientCache -> shapeDataCache[i]); - - shapeExtension -> data[i] = (unsigned short) value; - - #ifdef TEST - *logofs << name() << ": Decoded value " << shapeExtension -> data[i] - << " as data[" << i << "] field.\n" << logofs_flush; - #endif - } -} diff --git a/nxcomp/ShapeExtension.h b/nxcomp/ShapeExtension.h deleted file mode 100644 index 4dd636847..000000000 --- a/nxcomp/ShapeExtension.h +++ /dev/null @@ -1,164 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef ShapeExtension_H -#define ShapeExtension_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define SHAPEEXTENSION_ENABLE_CACHE 1 -#define SHAPEEXTENSION_ENABLE_DATA 1 -#define SHAPEEXTENSION_ENABLE_SPLIT 0 - -#define SHAPEEXTENSION_DATA_LIMIT 3200 -#define SHAPEEXTENSION_DATA_OFFSET 20 - -#define SHAPEEXTENSION_CACHE_SLOTS 3000 -#define SHAPEEXTENSION_CACHE_THRESHOLD 10 -#define SHAPEEXTENSION_CACHE_LOWER_THRESHOLD 5 - -#define SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 - -// -// The message class. -// - -class ShapeExtensionMessage : public Message -{ - friend class ShapeExtensionStore; - - public: - - ShapeExtensionMessage() - { - } - - ~ShapeExtensionMessage() - { - } - - // - // Note for encoding in protocol level 1: we consider - // for this message a data offset of 4. Bytes from 5 - // to 20, if present, are taken as part of identity - // and encoded through an array of int caches. - // - - private: - - unsigned char opcode; - unsigned short data[8]; -}; - -class ShapeExtensionStore : public MessageStore -{ - public: - - ShapeExtensionStore(StaticCompressor *compressor); - - virtual ~ShapeExtensionStore(); - - virtual const char *name() const - { - return "ShapeExtension"; - } - - virtual unsigned char opcode() const - { - return opcode_; - } - - virtual unsigned int storage() const - { - return sizeof(ShapeExtensionMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new ShapeExtensionMessage(); - } - - virtual Message *create(const Message &message) const - { - return new ShapeExtensionMessage((const ShapeExtensionMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (ShapeExtensionMessage *) message; - } - - virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, - const unsigned int size, int bigEndian, - ChannelCache *channelCache) const; - - virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, - unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, - ChannelCache *channelCache) const; - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, - const Message *cachedMessage, - ChannelCache *channelCache) const; - - virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, - ChannelCache *channelCache) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; - - private: - - unsigned char opcode_; -}; - -#endif /* ShapeExtension_H */ diff --git a/nxcomp/Socket.cpp b/nxcomp/Socket.cpp deleted file mode 100644 index 28cb5646d..000000000 --- a/nxcomp/Socket.cpp +++ /dev/null @@ -1,753 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include - -#if defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) -#include -#endif - -#ifdef __sun -#include -#include -#endif - -#include -#include -#include -#include - -#include -#include - -// -// System specific defines. -// - -#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) -#define SOL_IP IPPROTO_IP -#endif - -#ifdef __sun -#define INADDR_NONE ((unsigned int) -1) -#endif - -// -// The TIOCOUTQ ioctl is not implemented on Cygwin. -// Note also that TIOCOUTQ and IPTOS_LOWDELAY are -// disabled when running on MacOS/X. -// - -#ifdef __CYGWIN32__ -#define TIOCOUTQ ((unsigned int) -1) -#endif - -// -// NX includes. -// - -#include "Misc.h" -#include "Socket.h" - -// -// Set verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Set this only once by querying OS details. -// - -static int _kernelStep = -1; - -int GetKernelStep() -{ - if (_kernelStep < 0) - { - // - // At the moment only NX clients run on Win32 - // and MacOS/X so we are not really interested - // in the relevant OS dependent functions. - // - - #if defined(__CYGWIN32__) || defined(__APPLE__) - - _kernelStep = 0; - - #else - - struct utsname buffer; - - if (uname(&buffer) < 0) - { - #ifdef WARNING - *logofs << "Socket: WARNING! Failed to get system info. Error is " - << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; - - *logofs << "Socket: WARNING! Assuming lowest system support.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to get system info. Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - cerr << "Warning" << ": Assuming lowest system support.\n"; - - _kernelStep = 0; - } - else - { - #ifdef TEST - *logofs << "Socket: System is '" << buffer.sysname - << "' nodename '" << buffer.nodename << "' release '" - << buffer.release << "'.\n" << logofs_flush; - - *logofs << "Socket: Version is '" << buffer.version << "' machine '" - << buffer.machine << "'.\n" << logofs_flush; - #endif - - // - // Should test support on other operating systems. - // - - if (strcmp(buffer.sysname, "Linux") == 0) - { - if (strncmp(buffer.release, "2.0.", 4) == 0 || - strncmp(buffer.release, "2.2.", 4) == 0) - { - #ifdef TEST - *logofs << "Socket: Assuming level 2 system support.\n" - << logofs_flush; - #endif - - _kernelStep = 2; - } - else - { - #ifdef TEST - *logofs << "Socket: Assuming level 3 system support.\n" - << logofs_flush; - #endif - - _kernelStep = 3; - } - } - else if (strcmp(buffer.sysname, "SunOS") == 0) - { - #ifdef TEST - *logofs << "Socket: Assuming level 1 system support.\n" - << logofs_flush; - #endif - - _kernelStep = 1; - } - else - { - #ifdef TEST - *logofs << "Socket: Assuming level 0 system support.\n" - << logofs_flush; - #endif - - _kernelStep = 0; - } - } - - #endif /* #if defined(__CYGWIN32__) || defined(__APPLE__) */ - } - - return _kernelStep; -} - -int SetReuseAddress(int fd) -{ - int flag = 1; - - if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, - (char *) &flag, sizeof(flag)) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set SO_REUSEADDR flag on FD#" - << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set SO_REUSEADDR flag on FD#" - << fd << ". Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Socket: Set SO_REUSEADDR flag on FD#" - << fd << ".\n" << logofs_flush; - } - #endif - - return 1; -} - -int SetNonBlocking(int fd, int value) -{ - int flags = fcntl(fd, F_GETFL); - - if (flags >= 0) - { - if (value == 0) - { - flags &= ~O_NONBLOCK; - } - else - { - flags |= O_NONBLOCK; - } - } - - if (flags < 0 || fcntl(fd, F_SETFL, flags) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set O_NONBLOCK flag on FD#" - << fd << " to " << value << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set O_NONBLOCK flag on FD#" - << fd << " to " << value << ". Error is " << EGET() - << " '" << ESTR() << "'.\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Socket: Set O_NONBLOCK flag on FD#" - << fd << " to " << value << ".\n" - << logofs_flush; - } - #endif - - return 1; -} - -int SetLingerTimeout(int fd, int timeout) -{ - struct linger linger_value; - - if (timeout > 0) - { - linger_value.l_onoff = 1; - linger_value.l_linger = timeout; - } - else - { - linger_value.l_onoff = 0; - linger_value.l_linger = 0; - } - - if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger_value, sizeof(linger_value)) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set SO_LINGER values to " - << linger_value.l_onoff << " and " << linger_value.l_linger - << " on FD#" << fd << ". Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set SO_LINGER values to " - << linger_value.l_onoff << " and " << linger_value.l_linger - << " on FD#" << fd << ". Error is " << EGET() << " '" - << ESTR() << "'.\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Socket: Set SO_LINGER values to " - << linger_value.l_onoff << " and " << linger_value.l_linger - << " on FD#" << fd << ".\n" << logofs_flush; - } - #endif - - return 1; -} - -int SetSendBuffer(int fd, int size) -{ - if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set SO_SNDBUF size to " - << size << " on FD#" << fd << ". Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set SO_SNDBUF size to " - << size << " on FD#" << fd << ". Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Socket: Set SO_SNDBUF on FD#" << fd - << " to " << size << " bytes.\n" - << logofs_flush; - } - #endif - - return 1; -} - -int SetReceiveBuffer(int fd, int size) -{ - if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set SO_RCVBUF size to " - << size << " on FD#" << fd << ". Error is " - << EGET() << " '" << ESTR() << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set SO_RCVBUF size to " - << size << " on FD#" << fd << ". Error is " - << EGET() << " '" << ESTR() << "'.\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Socket: Set SO_RCVBUF on FD#" << fd - << " to " << size << " bytes.\n" - << logofs_flush; - } - #endif - - return 1; -} - -int SetNoDelay(int fd, int value) -{ - int result = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); - - if (result == 0) - { - result = 1; - } - else if (result < 0) - { - // - // Is it become a different error on - // Mac OSX 10.4? - // - - #if defined(__APPLE__) - - result = 0; - - #endif - - #if defined(__sun) - - if (EGET() == ENOPROTOOPT) - { - result = 0; - } - - #endif - - #if !defined(__APPLE__) && !defined(__sun) - - if (EGET() == EOPNOTSUPP) - { - result = 0; - } - - #endif - } - - if (result < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set TCP_NODELAY flag on " - << "FD#" << fd << " to " << value << ". Error is " - << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set TCP_NODELAY flag on " - << "FD#" << fd << " to " << value << ". Error is " - << EGET() << " '" << ESTR() << "'.\n"; - } - #ifdef TEST - else if (result == 0) - { - #ifdef TEST - *logofs << "Socket: Option TCP_NODELAY not supported " - << "on FD#" << fd << ".\n" << logofs_flush; - #endif - } - else - { - *logofs << "Socket: Set TCP_NODELAY flag on FD#" - << fd << " to " << value << ".\n" - << logofs_flush; - } - #endif - - return result; -} - -int SetKeepAlive(int fd) -{ - int flag = 1; - - if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &flag, sizeof(flag)) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to set SO_KEEPALIVE flag on " - << "FD#" << fd << ". Error is " << EGET() << " '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to set SO_KEEPALIVE flag on " - << "FD#" << fd << ". Error is " << EGET() << " '" - << ESTR() << "'.\n"; - - return -1; - } - #ifdef TEST - else - { - *logofs << "Socket: Set SO_KEEPALIVE flag on FD#" - << fd << ".\n" << logofs_flush; - } - #endif - - return 1; -} - -int SetLowDelay(int fd) -{ - if (_kernelStep < 0) - { - GetKernelStep(); - } - - switch (_kernelStep) - { - case 3: - case 2: - case 1: - { - int flag = IPTOS_LOWDELAY; - - if (setsockopt(fd, SOL_IP, IP_TOS, &flag, sizeof(flag)) < 0) - { - if (EGET() == EOPNOTSUPP) - { - #ifdef TEST - *logofs << "Socket: Option IPTOS_LOWDELAY not supported " - << "on FD#" << fd << ".\n" << logofs_flush; - #endif - - return 0; - } - else - { - #ifdef WARNING - *logofs << "Socket: WARNING! Failed to set IPTOS_LOWDELAY flag on " - << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to set IPTOS_LOWDELAY flag on " - << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - return -1; - } - } - #ifdef TEST - else - { - *logofs << "Socket: Set IPTOS_LOWDELAY flag on FD#" - << fd << ".\n" << logofs_flush; - } - #endif - - return 1; - } - default: - { - #ifdef TEST - *logofs << "Socket: Option IPTOS_LOWDELAY not " - << "supported on FD#" << fd << ".\n" - << logofs_flush; - #endif - - return 0; - } - } -} - -int SetCloseOnExec(int fd) -{ - if (fcntl(fd, F_SETFD, 1) != 0) - { - #ifdef TEST - *logofs << "NXClient: PANIC! Cannot set close-on-exec " - << "on FD#" << fd << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot set close-on-exec on FD#" - << fd << ". Error is " << EGET() << " '" << ESTR() - << "'.\n"; - - return -1; - } - - return 1; -} - -int GetBytesReadable(int fd) -{ - long readable = 0; - - // - // It may fail, for example at session - // shutdown. - // - - if (ioctl(fd, FIONREAD, &readable) < 0) - { - #ifdef TEST - *logofs << "Socket: PANIC! Failed to get bytes readable " - << "from FD#" << fd << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - return -1; - } - - #ifdef TEST - *logofs << "Socket: Returning " << (int) readable - << " bytes readable on FD#" << fd << ".\n" - << logofs_flush; - #endif - - return (int) readable; -} - -int GetBytesWritable(int fd) -{ - if (_kernelStep < 0) - { - GetKernelStep(); - } - - long writable; - - switch (_kernelStep) - { - case 3: - { - // - // TODO: Should query the real size - // of the TCP write buffer. - // - - writable = 16384 - GetBytesQueued(fd); - - if (writable < 0) - { - writable = 0; - } - - break; - } - case 2: - { - if (ioctl(fd, TIOCOUTQ, (void *) &writable) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to get bytes writable " - << "on FD#" << fd << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to get bytes writable " - << "on FD#" << fd << ". Error is " << EGET() - << " '" << ESTR() << "'.\n"; - - return -1; - } - - break; - } - default: - { - #ifdef TEST - *logofs << "Socket: Option TIOCOUTQ not supported " - << "on FD#" << fd << ",\n" << logofs_flush; - #endif - - // - // TODO: Should query the real size - // of the TCP write buffer. - // - - writable = 16384; - - break; - } - } - - #ifdef TEST - *logofs << "Socket: Returning " << writable - << " bytes writable on FD#" << fd - << ".\n" << logofs_flush; - #endif - - return (int) writable; -} - -int GetBytesQueued(int fd) -{ - // - // The TIOCOUTQ ioctl is not implemented on Cygwin - // and returns the space available on Linux Kernels - // 2.0 and 2.2 (like current MIPS for PS/2). - // - - if (_kernelStep < 0) - { - GetKernelStep(); - } - - long queued; - - switch (_kernelStep) - { - case 3: - { - if (ioctl(fd, TIOCOUTQ, (void *) &queued) < 0) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to get bytes queued " - << "on FD#" << fd << ". Error is " << EGET() - << " '" << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to get bytes queued " - << "on FD#" << fd << ". Error is " << EGET() - << " '" << ESTR() << "'.\n"; - - return -1; - } - - break; - } - case 2: - { - // - // TODO: Should query the real size - // of the TCP write buffer. - // - - queued = 16384 - GetBytesWritable(fd); - - if (queued < 0) - { - queued = 0; - } - - break; - } - default: - { - #ifdef TEST - *logofs << "Socket: Option TIOCOUTQ not supported " - << "on FD#" << fd << ",\n" << logofs_flush; - #endif - - queued = 0; - - break; - } - } - - #ifdef TEST - *logofs << "Socket: Returning " << queued - << " bytes queued on FD#" << fd - << ".\n" << logofs_flush; - #endif - - return (int) queued; -} - -int GetHostAddress(const char *name) -{ - hostent *host = gethostbyname(name); - - if (host == NULL) - { - // - // On some Unices gethostbyname() doesn't - // accept IP addresses, so try inet_addr. - // - - IN_ADDR_T address = inet_addr(name); - - if (address == INADDR_NONE) - { - #ifdef PANIC - *logofs << "Socket: PANIC! Failed to resolve address of '" - << name << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed to resolve address of '" - << name << "'.\n"; - - return 0; - } - - return (int) address; - } - else - { - return (*((int *) host -> h_addr_list[0])); - } -} diff --git a/nxcomp/Socket.h b/nxcomp/Socket.h deleted file mode 100644 index 5e7e47705..000000000 --- a/nxcomp/Socket.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Socket_H -#define Socket_H - -#include -#include -#include - -#ifdef __sun -#include -#include -#endif - -// -// Set socket options. -// - -int SetReuseAddress(int fd); -int SetNonBlocking(int fd, int value); -int SetLingerTimeout(int fd, int timeout); -int SetSendBuffer(int fd, int size); -int SetReceiveBuffer(int fd, int size); -int SetNoDelay(int fd, int value); -int SetKeepAlive(int fd); -int SetLowDelay(int fd); -int SetCloseOnExec(int fd); - -// -// Get kernel support level. -// - -int GetKernelStep(); - -// -// Get socket info. -// - -int GetBytesReadable(int fd); -int GetBytesWritable(int fd); -int GetBytesQueued(int fd); - -// -// Inline version, providing direct access -// to the interface. -// - -#include "Misc.h" - -inline int GetBytesReadable(int fd, int *readable) -{ - long t; - - int result = ioctl(fd, FIONREAD, &t); - - #ifdef DEBUG - *logofs << "Socket: Bytes readable from FD#" - << fd << " are " << t << " with result " - << result << ".\n" << logofs_flush; - #endif - - *readable = (int) t; - - return result; -} - -// -// Query Internet address. -// - -int GetHostAddress(const char *name); - -#endif /* Socket_H */ diff --git a/nxcomp/Split.cpp b/nxcomp/Split.cpp deleted file mode 100644 index b6828c7cb..000000000 --- a/nxcomp/Split.cpp +++ /dev/null @@ -1,1835 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include - -#include "Misc.h" - -#include "Split.h" - -#include "Control.h" -#include "Statistics.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "StaticCompressor.h" - -#include "Unpack.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Define this to trace elements -// allocated and deallocated. -// - -#undef REFERENCES - -// -// Counters used for store control. -// - -int SplitStore::totalSplitSize_; -int SplitStore::totalSplitStorageSize_; - -// -// This is used for reference count. -// - -#ifdef REFERENCES - -int Split::references_ = 0; - -#endif - -Split::Split() -{ - resource_ = nothing; - position_ = nothing; - - store_ = NULL; - - d_size_ = 0; - i_size_ = 0; - c_size_ = 0; - r_size_ = 0; - - next_ = 0; - load_ = 0; - save_ = 0; - - checksum_ = NULL; - state_ = split_undefined; - mode_ = split_none; - action_ = is_discarded; - - #ifdef REFERENCES - - references_++; - - *logofs << "Split: Created new Split at " - << this << " out of " << references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -Split::~Split() -{ - delete [] checksum_; - - #ifdef REFERENCES - - references_--; - - *logofs << "Split: Deleted Split at " - << this << " out of " << references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -SplitStore::SplitStore(StaticCompressor *compressor, CommitStore *commits, int resource) - - : compressor_(compressor), commits_(commits), resource_(resource) -{ - splits_ = new T_splits(); - - current_ = splits_ -> end(); - - splitStorageSize_ = 0; - - #ifdef TEST - *logofs << "SplitStore: Created new store ["; - - if (resource_ != nothing) - { - *logofs << resource_; - } - else - { - *logofs << "commit"; - } - - *logofs << "].\n" << logofs_flush; - - *logofs << "SplitStore: Total messages in stores are " - << totalSplitSize_ << " with total storage size " - << totalSplitStorageSize_ << ".\n" - << logofs_flush; - #endif -} - -SplitStore::~SplitStore() -{ - totalSplitSize_ -= splits_ -> size(); - - totalSplitStorageSize_ -= splitStorageSize_; - - for (T_splits::iterator i = splits_ -> begin(); - i != splits_ -> end(); i++) - { - delete *i; - } - - delete splits_; - - #ifdef TEST - *logofs << "SplitStore: Deleted store ["; - - if (resource_ != nothing) - { - *logofs << resource_; - } - else - { - *logofs << "commit"; - } - - *logofs << "] with storage size " << splitStorageSize_ - << ".\n" << logofs_flush; - - *logofs << "SplitStore: Total messages in stores are " - << totalSplitSize_ << " with total storage size " - << totalSplitStorageSize_ << ".\n" - << logofs_flush; - #endif -} - -// -// This is called at the encoding side. -// - -Split *SplitStore::add(MessageStore *store, int resource, T_split_mode mode, - int position, T_store_action action, T_checksum checksum, - const unsigned char *buffer, const int size) -{ - #ifdef TEST - *logofs << "SplitStore: Adding message [" << (unsigned int) store -> - opcode() << "] resource " << resource << " mode " << mode - << " position " << position << " action [" << DumpAction(action) - << "] and checksum [" << DumpChecksum(checksum) << "]" - << ".\n" << logofs_flush; - #endif - - Split *split = new Split(); - - if (split == NULL) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Can't allocate " - << "memory for the split.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the split.\n"; - - HandleAbort(); - } - - split -> store_ = store; - split -> resource_ = resource; - split -> mode_ = mode; - split -> position_ = position; - split -> action_ = action; - - split -> store_ -> validateSize(size); - - // - // The checksum is not provided if the - // message is cached. - // - - if (checksum != NULL) - { - split -> checksum_ = new md5_byte_t[MD5_LENGTH]; - - memcpy(split -> checksum_, checksum, MD5_LENGTH); - } - - // - // We don't need the identity data at the - // encoding side. This qualifies the split - // as a split generated at the encoding - // side. - // - - split -> i_size_ = store -> identitySize(buffer, size); - - split -> d_size_ = size - split -> i_size_; - - if (action == IS_ADDED || action == is_discarded) - { - // - // If the message was added to message - // store or discarded we need to save - // the real data so we can transfer it - // at later time. - // - - split -> data_.resize(split -> d_size_); - - memcpy(split -> data_.begin(), buffer + split -> i_size_, split -> d_size_); - - // - // If the message was added, lock it so - // it will not be used by the encoding - // side until it is recomposed. - // - - if (action == IS_ADDED) - { - split -> store_ -> lock(split -> position_); - - #ifdef TEST - - commits_ -> validate(split); - - #endif - } - } - #ifdef WARNING - else - { - *logofs << "SplitStore: WARNING! Not copying data for the cached message.\n" - << logofs_flush; - } - #endif - - push(split); - - return split; -} - -// -// This is called at decoding side. If checksum -// is provided, the message can be searched on -// disk, then, if message is found, an event is -// sent to abort the data transfer. -// - -Split *SplitStore::add(MessageStore *store, int resource, int position, - T_store_action action, T_checksum checksum, - unsigned char *buffer, const int size) -{ - #ifdef TEST - *logofs << "SplitStore: Adding message [" - << (unsigned int) store -> opcode() << "] resource " - << resource << " position " << position << " action [" - << DumpAction(action) << "] and checksum [" - << DumpChecksum(checksum) << "].\n" << logofs_flush; - #endif - - Split *split = new Split(); - - if (split == NULL) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Can't allocate " - << "memory for the split.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory " - << "for the split.\n"; - - HandleAbort(); - } - - split -> store_ = store; - split -> resource_ = resource; - split -> position_ = position; - split -> action_ = action; - - split -> store_ -> validateSize(size); - - // - // Check if the checksum was provided - // by the remote. - // - - if (checksum != NULL) - { - split -> checksum_ = new md5_byte_t[MD5_LENGTH]; - - memcpy(split -> checksum_, checksum, MD5_LENGTH); - } - - split -> i_size_ = store -> identitySize(buffer, size); - - // - // Copy the identity so we can expand the - // message when it is committed. - // - - split -> identity_.resize(split -> i_size_); - - memcpy(split -> identity_.begin(), buffer, split -> i_size_); - - split -> d_size_ = size - split -> i_size_; - - if (action == IS_ADDED || action == is_discarded) - { - // - // The unpack procedure will check if the - // first 2 bytes of the buffer contain the - // pattern and will not try to expand the - // image. - // - - split -> data_.resize(2); - - unsigned char *data = split -> data_.begin(); - - data[0] = SPLIT_PATTERN; - data[1] = SPLIT_PATTERN; - - // - // If the message was added to the store, - // we don't have the data part, yet, so - // we need to lock the message until it - // is recomposed. - // - - if (action == IS_ADDED) - { - split -> store_ -> lock(split -> position_); - - #ifdef TEST - - commits_ -> validate(split); - - #endif - } - } - else - { - #ifdef WARNING - *logofs << "SplitStore: WARNING! Copying data for the cached message.\n" - << logofs_flush; - #endif - - // - // We may optionally take the data from the - // message store in compressed form, but, - // as the data has been decompressed in the - // buffer, we save a further decompression. - // - - split -> data_.resize(split -> d_size_); - - memcpy(split -> data_.begin(), buffer + split -> i_size_, split -> d_size_); - } - - push(split); - - return split; -} - -void SplitStore::push(Split *split) -{ - splits_ -> push_back(split); - - splitStorageSize_ += getNodeSize(split); - - totalSplitSize_++; - - totalSplitStorageSize_ += getNodeSize(split); - - statistics -> addSplit(); - - #ifdef TEST - *logofs << "SplitStore: There are " << splits_ -> size() - << " messages in store [" << resource_ << "] with " - << "storage size " << splitStorageSize_ << ".\n" - << logofs_flush; - - *logofs << "SplitStore: Total messages in stores are " - << totalSplitSize_ << " with total storage size " - << totalSplitStorageSize_ << ".\n" - << logofs_flush; - #endif - - split -> state_ = split_added; -} - -void SplitStore::dump() -{ - #ifdef DUMP - - int n; - - Split *split; - - *logofs << "SplitStore: DUMP! Dumping content of "; - - if (commits_ == NULL) - { - *logofs << "[commits]"; - } - else - { - *logofs << "[splits] for store [" << resource_ << "]"; - } - - *logofs << " with [" << getSize() << "] elements " - << "in the store.\n" << logofs_flush; - - n = 0; - - for (T_splits::iterator i = splits_ -> begin(); i != splits_ -> end(); i++, n++) - { - split = *i; - - *logofs << "SplitStore: DUMP! Split [" << n << "] has action [" - << DumpAction(split -> action_) << "] state [" - << DumpState(split -> state_) << "] "; - - if (split -> resource_ >= 0) - { - *logofs << "resource " << split -> resource_; - } - - *logofs << " request " << (unsigned) split -> store_ -> opcode() - << " position " << split -> position_ << " size is " - << split -> data_.size() << " (" << split -> d_size_ - << "/" << split -> c_size_ << "/" << split -> r_size_ - << ") with " << split -> data_.size() - split -> next_ - << "] bytes to go.\n" << logofs_flush; - } - - #endif -} - -int SplitStore::send(EncodeBuffer &encodeBuffer, int packetSize) -{ - if (splits_ -> size() == 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Function send called with no splits available.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Function send called with no splits available.\n"; - - HandleAbort(); - } - - // - // A start operation must always be executed on - // the split, even in the case the split will be - // later aborted. - // - - if (current_ == splits_ -> end()) - { - start(encodeBuffer); - } - - // - // If we have matched the checksum received from - // the remote side then we must abort the current - // split, else we can send another block of data - // to the remote peer. - // - - Split *split = *current_; - - unsigned int abort = 0; - - if (split -> state_ == split_loaded) - { - abort = 1; - } - - encodeBuffer.encodeBoolValue(abort); - - if (abort == 1) - { - #ifdef TEST - *logofs << "SplitStore: Aborting split for checksum [" - << DumpChecksum(split -> checksum_) << "] position " - << split -> position_ << " with " << (split -> - data_.size() - split -> next_) << " bytes to go " - << "out of " << split -> data_.size() - << ".\n" << logofs_flush; - #endif - - statistics -> addSplitAborted(); - - statistics -> addSplitAbortedBytesOut(split -> data_.size() - split -> next_); - - split -> next_ = split -> data_.size(); - - split -> state_ = split_aborted; - } - else - { - int count = (packetSize <= 0 || split -> next_ + - packetSize > (int) split -> data_.size() ? - split -> data_.size() - split -> next_ : packetSize); - - #ifdef TEST - *logofs << "SplitStore: Sending split for checksum [" - << DumpChecksum(split -> checksum_) << "] count " - << count << " position " << split -> position_ - << ". Data size is " << split -> data_.size() << " (" - << split -> d_size_ << "/" << split -> c_size_ << "), " - << split -> data_.size() - (split -> next_ + count) - << " to go.\n" << logofs_flush; - #endif - - encodeBuffer.encodeValue(count, 32, 10); - - encodeBuffer.encodeMemory(split -> data_.begin() + split -> next_, count); - - split -> next_ += count; - } - - // - // Was data completely transferred? We are the - // sending side. We must update the message in - // store, even if split was aborted. - // - - if (split -> next_ != ((int) split -> data_.size())) - { - return 0; - } - - // - // Move the split at the head of the - // list to the commits. - // - - remove(split); - - // - // Reset current position to the - // end of repository. - // - - current_ = splits_ -> end(); - - #ifdef TEST - *logofs << "SplitStore: Removed split at head of the list. " - << "Resource is " << split -> resource_ << " request " - << (unsigned) split -> store_ -> opcode() << " position " - << split -> position_ << ".\n" << logofs_flush; - #endif - - return 1; -} - -int SplitStore::start(EncodeBuffer &encodeBuffer) -{ - // - // Get the element at the top of the - // list. - // - - current_ = splits_ -> begin(); - - Split *split = *current_; - - #ifdef TEST - *logofs << "SplitStore: Starting split for checksum [" - << DumpChecksum(split -> checksum_) << "] position " - << split -> position_ << " with " << (split -> - data_.size() - split -> next_) << " bytes to go " - << "out of " << split -> data_.size() - << ".\n" << logofs_flush; - #endif - - // - // See if compression of the data part is - // enabled. - // - - if (split -> store_ -> enableCompress) - { - // - // If the split is going to be aborted don't - // compress the data and go straight to the - // send. The new data size will be assumed - // from the disk cache. - // - - if (split -> state_ != split_loaded) - { - unsigned int compressedSize = 0; - unsigned char *compressedData = NULL; - - if (control -> LocalDataCompression && - (compressor_ -> compressBuffer(split -> data_.begin(), split -> d_size_, - compressedData, compressedSize))) - { - // - // Replace the data with the one in - // compressed form. - // - - #ifdef TEST - *logofs << "SplitStore: Split data of size " << split -> d_size_ - << " has been compressed to " << compressedSize - << " bytes.\n" << logofs_flush; - #endif - - split -> data_.clear(); - - split -> data_.resize(compressedSize); - - memcpy(split -> data_.begin(), compressedData, compressedSize); - - split -> c_size_ = compressedSize; - - // - // Inform our peer that the data is - // compressed and send the new size. - // - - encodeBuffer.encodeBoolValue(1); - - encodeBuffer.encodeValue(compressedSize, 32, 14); - - #ifdef TEST - *logofs << "SplitStore: Signaled " << split -> c_size_ - << " bytes of compressed data for this message.\n" - << logofs_flush; - #endif - - return 1; - } - } - #ifdef TEST - else - { - *logofs << "SplitStore: Not trying to compress the " - << "loaded message.\n" << logofs_flush; - } - #endif - - // - // Tell to the remote that data will - // follow uncompressed. - // - - encodeBuffer.encodeBoolValue(0); - } - - return 1; -} - -int SplitStore::start(DecodeBuffer &decodeBuffer) -{ - #ifdef TEST - *logofs << "SplitStore: Going to receive a new split from the remote side.\n" - << logofs_flush; - #endif - - // - // Get the element at the head - // of the list. - // - - current_ = splits_ -> begin(); - - Split *split = *current_; - - unsigned int compressedSize = 0; - - // - // Save the data size known by the remote. - // This information will be needed if the - // remote will not have a chance to abort - // the split. - // - - split -> r_size_ = split -> d_size_; - - // - // Find out if data was compressed by the - // remote. - // - - if (split -> store_ -> enableCompress) - { - decodeBuffer.decodeBoolValue(compressedSize); - - if (compressedSize == 1) - { - // - // Get the compressed size. - // - - // Since ProtoStep7 (#issue 108) - decodeBuffer.decodeValue(compressedSize, 32, 14); - - split -> store_ -> validateSize(split -> d_size_, compressedSize); - - split -> r_size_ = compressedSize; - } - } - - // - // Update the size if the split - // was not already loaded. - // - - if (split -> state_ != split_loaded) - { - split -> data_.clear(); - - if (compressedSize > 0) - { - split -> c_size_ = compressedSize; - - #ifdef TEST - *logofs << "SplitStore: Split data of size " - << split -> d_size_ << " was compressed to " - << split -> c_size_ << " bytes.\n" - << logofs_flush; - #endif - - split -> data_.resize(split -> c_size_); - } - else - { - split -> data_.resize(split -> d_size_); - } - - unsigned char *data = split -> data_.begin(); - - data[0] = SPLIT_PATTERN; - data[1] = SPLIT_PATTERN; - } - #ifdef TEST - else - { - // - // The message had been already - // loaded from disk. - // - - if (compressedSize > 0) - { - if ((int) compressedSize != split -> c_size_) - { - *logofs << "SplitStore: WARNING! Compressed data size is " - << "different than the loaded compressed size.\n" - << logofs_flush; - } - - *logofs << "SplitStore: Ignoring the new size with " - << "loaded compressed size " << split -> c_size_ - << ".\n" << logofs_flush; - } - } - #endif - - return 1; -} - -int SplitStore::receive(DecodeBuffer &decodeBuffer) -{ - if (splits_ -> size() == 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Function receive called with no splits available.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Function receive called with no splits available.\n"; - - HandleAbort(); - } - - if (current_ == splits_ -> end()) - { - start(decodeBuffer); - } - - // - // Check first if split was aborted, else add - // any new data to message being recomposed. - // - - Split *split = *current_; - - unsigned int abort = 0; - - decodeBuffer.decodeBoolValue(abort); - - if (abort == 1) - { - #ifdef TEST - *logofs << "SplitStore: Aborting split for checksum [" - << DumpChecksum(split -> checksum_) << "] position " - << split -> position_ << " with " << (split -> - data_.size() - split -> next_) << " bytes to go " - << "out of " << split -> data_.size() - << ".\n" << logofs_flush; - #endif - - statistics -> addSplitAborted(); - - statistics -> addSplitAbortedBytesOut(split -> r_size_ - split -> next_); - - split -> next_ = split -> r_size_; - - split -> state_ = split_aborted; - } - else - { - // - // Get the size of the packet. - // - - unsigned int count; - - decodeBuffer.decodeValue(count, 32, 10); - - // - // If the split was not already loaded from - // disk, decode the packet and update our - // copy of the data. The encoding side may - // have not received the abort event, yet, - // and may be unaware that the message is - // stored in compressed form at our side. - // - - #ifdef TEST - *logofs << "SplitStore: Receiving split for checksum [" - << DumpChecksum(split -> checksum_) << "] count " - << count << " position " << split -> position_ - << ". Data size is " << split -> data_.size() << " (" - << split -> d_size_ << "/" << split -> c_size_ << "/" - << split -> r_size_ << "), " << split -> r_size_ - - (split -> next_ + count) << " to go.\n" - << logofs_flush; - #endif - - if (split -> next_ + count > (unsigned) split -> r_size_) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Invalid data count " - << count << "provided in the split.\n" - << logofs_flush; - - *logofs << "SplitStore: PANIC! While receiving split for " - << "checksum [" << DumpChecksum(split -> checksum_) - << "] with count " << count << " action [" - << DumpAction(split -> action_) << "] state [" - << DumpState(split -> state_) << "]. Data size is " - << split -> data_.size() << " (" << split -> d_size_ - << "/" << split -> c_size_ << "), " << split -> - data_.size() - (split -> next_ + count) - << " to go.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Invalid data count " - << count << "provided in the split.\n"; - - HandleAbort(); - } - - if (split -> state_ != split_loaded) - { - #ifdef TEST - - if (split -> next_ + count > split -> data_.size()) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Inconsistent split data size " - << split -> data_.size() << " with expected size " - << split -> r_size_ << ".\n" - << logofs_flush; - #endif - - HandleAbort(); - } - - #endif - - memcpy(split -> data_.begin() + split -> next_, - decodeBuffer.decodeMemory(count), count); - } - else - { - #ifdef TEST - *logofs << "SplitStore: WARNING! Data discarded with split " - << "loaded from disk.\n" << logofs_flush; - #endif - - decodeBuffer.decodeMemory(count); - } - - split -> next_ += count; - } - - // - // Is unsplit complete? - // - - if (split -> next_ != split -> r_size_) - { - return 0; - } - - // - // If the persistent cache is enabled, - // we have a valid checksum and the - // split was not originally retrieved - // from disk, save the message on disk. - // - - if (split -> state_ != split_loaded && - split -> state_ != split_aborted) - { - save(split); - } - - // - // Move the split at the head of the - // list to the commits. - // - - remove(split); - - // - // Reset the current position to the - // end of the repository. - // - - current_ = splits_ -> end(); - - #ifdef TEST - *logofs << "SplitStore: Removed split at head of the list. " - << "Resource is " << split -> resource_ << " request " - << (unsigned) split -> store_ -> opcode() << " position " - << split -> position_ << ".\n" << logofs_flush; - #endif - - return 1; -} - -Split *SplitStore::pop() -{ - if (splits_ -> size() == 0) - { - #ifdef TEST - *logofs << "SplitStore: The split store is empty.\n" - << logofs_flush; - #endif - - return NULL; - } - - // - // Move the pointer at the end of the list. - // The next send operation will eventually - // start a new split. - // - - current_ = splits_ -> end(); - - Split *split = *(splits_ -> begin()); - - splits_ -> pop_front(); - - #ifdef TEST - *logofs << "SplitStore: Removed split at the head of the " - << "list with resource " << split -> resource_ - << " request " << (unsigned) split -> store_ -> - opcode() << " position " << split -> position_ - << ".\n" << logofs_flush; - #endif - - splitStorageSize_ -= getNodeSize(split); - - totalSplitSize_--; - - totalSplitStorageSize_ -= getNodeSize(split); - - #ifdef TEST - *logofs << "SplitStore: There are " << splits_ -> size() - << " messages in store [" << resource_ << "] with " - << "storage size " << splitStorageSize_ << ".\n" - << logofs_flush; - - *logofs << "SplitStore: Total messages in stores are " - << totalSplitSize_ << " with total storage size " - << totalSplitStorageSize_ << ".\n" - << logofs_flush; - #endif - - return split; -} - -void SplitStore::remove(Split *split) -{ - #ifdef TEST - *logofs << "SplitStore: Going to remove the split from the list.\n" - << logofs_flush; - #endif - - #ifdef TEST - - if (split != getFirstSplit()) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Trying to remove a split " - << "not at the head of the list.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Trying to remove a split " - << "not at the head of the list.\n"; - - HandleAbort(); - } - - #endif - - // - // Move the split to the commit store. - // - - splits_ -> pop_front(); - - commits_ -> splits_ -> push_back(split); - - splitStorageSize_ -= getNodeSize(split); - - totalSplitSize_--; - - totalSplitStorageSize_ -= getNodeSize(split); - - #ifdef TEST - *logofs << "SplitStore: There are " << splits_ -> size() - << " messages in store [" << resource_ << "] with " - << "storage size " << splitStorageSize_ << ".\n" - << logofs_flush; - - *logofs << "SplitStore: Total messages in stores are " - << totalSplitSize_ << " with total storage size " - << totalSplitStorageSize_ << ".\n" - << logofs_flush; - #endif - - #ifdef TEST - - if (splits_ -> size() == 0) - { - if (splitStorageSize_ != 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Internal error calculating " - << "split data size. It is " << splitStorageSize_ - << " while should be 0.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Internal error calculating " - << "split data size. It is " << splitStorageSize_ - << " while should be 0.\n"; - - HandleAbort(); - } - } - - #endif -} - -const char *SplitStore::name(const T_checksum checksum) -{ - if (checksum == NULL) - { - return NULL; - } - - char *pathName = control -> ImageCachePath; - - if (pathName == NULL) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot determine directory of " - << "NX image files.\n" << logofs_flush; - #endif - - return NULL; - } - - int pathSize = strlen(pathName); - - // - // File name is "[path][/I-c/I-][checksum][\0]", - // where c is the first hex digit of checksum. - // - - int nameSize = pathSize + 7 + MD5_LENGTH * 2 + 1; - - char *fileName = new char[nameSize]; - - if (fileName == NULL) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot allocate space for " - << "NX image file name.\n" << logofs_flush; - #endif - - return NULL; - } - - strcpy(fileName, pathName); - - sprintf(fileName + pathSize, "/I-%1X/I-", - *((unsigned char *) checksum) >> 4); - - for (unsigned int i = 0; i < MD5_LENGTH; i++) - { - sprintf(fileName + pathSize + 7 + (i * 2), "%02X", - ((unsigned char *) checksum)[i]); - } - - return fileName; -} - -int SplitStore::save(Split *split) -{ - // - // Check if saving the message on the - // persistent cache is enabled. - // - - if (split -> save_ == 0) - { - return 0; - } - - T_checksum checksum = split -> checksum_; - - const char *fileName = name(checksum); - - if (fileName == NULL) - { - return 0; - } - - unsigned int splitSize; - - ostream *fileStream = NULL; - - unsigned char *fileHeader = NULL; - - // - // Get the other data from the split. - // - - unsigned char opcode = split -> store_ -> opcode(); - - unsigned char *data = split -> data_.begin(); - - int dataSize = split -> d_size_; - int compressedSize = split -> c_size_; - - #ifdef DEBUG - *logofs << "SplitStore: Going to save split OPCODE#" - << (unsigned int) opcode << " to file '" << fileName - << "' with size " << dataSize << " and compressed size " - << compressedSize << ".\n" << logofs_flush; - #endif - - DisableSignals(); - - // - // Change the mask to make the file only - // readable by the user, then restore the - // old mask. - // - - mode_t fileMode; - - // - // Check if the file already exists. We try to - // load the message when the split is started - // and save it only if it is not found. Still - // the remote side may send the same image mul- - // tiple time and we may not have the time to - // notify the abort. - // - - struct stat fileStat; - - if (stat(fileName, &fileStat) == 0) - { - #ifdef TEST - *logofs << "SplitStore: Image file '" << fileName - << "' already present on disk.\n" - << logofs_flush; - #endif - - goto SplitStoreSaveError; - } - - fileMode = umask(0077); - - fileStream = new ofstream(fileName, ios::out | ios::binary); - - umask(fileMode); - - if (CheckData(fileStream) < 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot open file '" << fileName - << "' for output.\n" << logofs_flush; - #endif - - goto SplitStoreSaveError; - } - - fileHeader = new unsigned char[SPLIT_HEADER_SIZE]; - - if (fileHeader == NULL) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot allocate space for " - << "NX image header.\n" << logofs_flush; - #endif - - goto SplitStoreSaveError; - } - - // - // Leave 3 bytes for future use. Please note - // that, on some CPUs, we can't use PutULONG() - // to write integers that are not aligned to - // the word boundary. - // - - *fileHeader = opcode; - - *(fileHeader + 1) = 0; - *(fileHeader + 2) = 0; - *(fileHeader + 3) = 0; - - PutULONG(dataSize, fileHeader + 4, false); - PutULONG(compressedSize, fileHeader + 8, false); - - splitSize = (compressedSize > 0 ? compressedSize : dataSize); - - if (PutData(fileStream, fileHeader, SPLIT_HEADER_SIZE) < 0 || - PutData(fileStream, data, splitSize) < 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot write to NX " - << "image file '" << fileName << "'.\n" - << logofs_flush; - #endif - - goto SplitStoreSaveError; - } - - // - // Check if all the data was written on the - // disk and, if not, remove the faulty copy. - // - - FlushData(fileStream); - - if (CheckData(fileStream) < 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Failed to write NX " - << "image file '" << fileName << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Failed to write NX " - << "image file '" << fileName << "'.\n"; - - goto SplitStoreSaveError; - } - - #ifdef TEST - *logofs << "SplitStore: Saved split to file '" << fileName - << "' with data size " << dataSize << " and " - << "compressed data size " << compressedSize - << ".\n" << logofs_flush; - #endif - - delete fileStream; - - delete [] fileName; - delete [] fileHeader; - - EnableSignals(); - - // - // Update the timestamp as the operation - // may have taken some time. - // - - getNewTimestamp(); - - return 1; - -SplitStoreSaveError: - - delete fileStream; - - if (fileName != NULL) - { - unlink(fileName); - } - - delete [] fileName; - delete [] fileHeader; - - EnableSignals(); - - return -1; -} - -int SplitStore::find(Split *split) -{ - const char *fileName = name(split -> checksum_); - - if (fileName == NULL) - { - return 0; - } - - #ifdef DEBUG - *logofs << "SplitStore: Going to find split OPCODE#" - << (unsigned) split -> store_ -> opcode() - << " in file '" << fileName << "'.\n" - << logofs_flush; - #endif - - // - // Check if the file exists and, at the - // same time, update the modification - // time to prevent its deletion. - // - - if (utime(fileName, NULL) == 0) - { - #ifdef TEST - *logofs << "SplitStore: Found split OPCODE#" - << (unsigned) split -> store_ -> opcode() - << " in file '" << fileName << "'.\n" - << logofs_flush; - #endif - - delete [] fileName; - - return 1; - } - - #ifdef TEST - *logofs << "SplitStore: WARNING! Can't find split " - << "OPCODE#" << (unsigned) split -> store_ -> - opcode() << " in file '" << fileName - << "'.\n" << logofs_flush; - #endif - - delete [] fileName; - - return 0; -} - -int SplitStore::load(Split *split) -{ - // - // Check if loading the image is enabled. - // - - if (split -> load_ == 0) - { - return 0; - } - - const char *fileName = name(split -> checksum_); - - if (fileName == NULL) - { - return 0; - } - - unsigned char fileOpcode; - - int fileSize; - int fileCSize; - - istream *fileStream = NULL; - - unsigned char *fileHeader = NULL; - - DisableSignals(); - - #ifdef DEBUG - *logofs << "SplitStore: Going to load split OPCODE#" - << (unsigned int) split -> store_ -> opcode() - << " from file '" << fileName << "'.\n" - << logofs_flush; - #endif - - fileStream = new ifstream(fileName, ios::in | ios::binary); - - if (CheckData(fileStream) < 0) - { - #ifdef TEST - *logofs << "SplitStore: WARNING! Can't open image file '" - << fileName << "' on disk.\n" << logofs_flush; - #endif - - goto SplitStoreLoadError; - } - - fileHeader = new unsigned char[SPLIT_HEADER_SIZE]; - - if (fileHeader == NULL) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot allocate space for " - << "NX image header.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot allocate space for " - << "NX image header.\n"; - - goto SplitStoreLoadError; - } - - if (GetData(fileStream, fileHeader, SPLIT_HEADER_SIZE) < 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot read header from " - << "NX image file '" << fileName << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Cannot read header from " - << "NX image file '" << fileName << "'.\n"; - - goto SplitStoreLoadError; - } - - fileOpcode = *fileHeader; - - fileSize = GetULONG(fileHeader + 4, false); - fileCSize = GetULONG(fileHeader + 8, false); - - // - // Don't complain if we find that data was saved - // in compressed form even if we were not aware - // of the compressed data size. The remote side - // compresses the data only at the time it starts - // the transferral of the split. We replace our - // copy of the data with whatever we find on the - // disk. - // - - if (fileOpcode != split -> store_ -> opcode() || - fileSize != split -> d_size_ || - fileSize > control -> MaximumRequestSize || - fileCSize > control -> MaximumRequestSize) - - { - #ifdef TEST - *logofs << "SplitStore: PANIC! Corrupted image file '" << fileName - << "'. Expected " << (unsigned int) split -> store_ -> opcode() - << "/" << split -> d_size_ << "/" << split -> c_size_ << " found " - << (unsigned int) fileOpcode << "/" << fileSize << "/" - << fileCSize << ".\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Corrupted image file '" << fileName - << "'. Expected " << (unsigned int) split -> store_ -> opcode() - << "/" << split -> d_size_ << "/" << split -> c_size_ << " found " - << (unsigned int) fileOpcode << "/" << fileSize << "/" - << fileCSize << ".\n"; - - goto SplitStoreLoadError; - } - - // - // Update the data size with the size - // we got from the disk record. - // - - split -> d_size_ = fileSize; - split -> c_size_ = fileCSize; - - unsigned int splitSize; - - if (fileCSize > 0) - { - splitSize = fileCSize; - } - else - { - splitSize = fileSize; - } - - // - // Allocate a new buffer if we didn't - // do that already or if the size is - // different. - // - - if (split -> data_.size() != splitSize) - { - split -> data_.clear(); - - split -> data_.resize(splitSize); - } - - if (GetData(fileStream, split -> data_.begin(), splitSize) < 0) - { - #ifdef PANIC - *logofs << "SplitStore: PANIC! Cannot read data from " - << "NX image file '" << fileName << "'.\n" - << logofs_flush; - #endif - - cerr << "Warning" << ": Cannot read data from " - << "NX image file '" << fileName << "'.\n"; - - goto SplitStoreLoadError; - } - - delete fileStream; - - delete [] fileHeader; - delete [] fileName; - - EnableSignals(); - - // - // Update the timestamp as the operation - // may have taken some time. - // - - getNewTimestamp(); - - return 1; - -SplitStoreLoadError: - - delete fileStream; - - unlink(fileName); - - delete [] fileName; - delete [] fileHeader; - - EnableSignals(); - - return -1; -} - -Split *CommitStore::pop() -{ - if (splits_ -> size() == 0) - { - #ifdef TEST - *logofs << "CommitStore: The commit store is empty.\n" - << logofs_flush; - #endif - - return NULL; - } - - Split *split = *(splits_ -> begin()); - - splits_ -> pop_front(); - - #ifdef TEST - *logofs << "CommitStore: Removed commit split at the head " - << "of the list with resource " << split -> resource_ - << " request " << (unsigned) split -> store_ -> - opcode() << " position " << split -> position_ - << ".\n" << logofs_flush; - #endif - - return split; -} - -int CommitStore::expand(Split *split, unsigned char *buffer, const int size) -{ - #ifdef TEST - *logofs << "CommitStore: Expanding split data with " - << size << " bytes to write.\n" - << logofs_flush; - #endif - - #ifdef TEST - - if (size < split -> i_size_ + split -> d_size_) - { - #ifdef PANIC - *logofs << "CommitStore: PANIC! Wrong size of the provided " - << "buffer. It should be " << split -> i_size_ + - split -> d_size_ << " instead of " << size - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Wrong size of the provided " - << "buffer. It should be " << split -> i_size_ + - split -> d_size_ << " instead of " << size - << ".\n"; - - HandleAbort(); - } - - #endif - - #ifdef DEBUG - *logofs << "CommitStore: Copying " << split -> i_size_ - << " bytes of identity.\n" << logofs_flush; - #endif - - memcpy(buffer, split -> identity_.begin(), split -> i_size_); - - // - // Copy data, if any, to the buffer. - // - - if (size > split -> i_size_) - { - // - // Check if message has been stored - // in compressed format. - // - - if (split -> c_size_ == 0) - { - #ifdef DEBUG - *logofs << "CommitStore: Copying " << split -> d_size_ - << " bytes of plain data.\n" << logofs_flush; - #endif - - memcpy(buffer + split -> i_size_, split -> data_.begin(), split -> d_size_); - } - else - { - #ifdef DEBUG - *logofs << "CommitStore: Decompressing " << split -> c_size_ - << " bytes and copying " << split -> d_size_ - << " bytes of data.\n" << logofs_flush; - #endif - - if (compressor_ -> - decompressBuffer(buffer + split -> i_size_, - split -> d_size_, split -> data_.begin(), - split -> c_size_) < 0) - { - #ifdef PANIC - *logofs << "CommitStore: PANIC! Split data decompression failed.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Split data decompression failed.\n"; - - return -1; - } - } - } - - return 1; -} - -int CommitStore::update(Split *split) -{ - if (split -> action_ != IS_ADDED) - { - return 0; - } - - // - // We don't need the identity data at - // the encoding side. - // - - if (split -> identity_.size() == 0) - { - #ifdef TEST - *logofs << "SplitStore: Going to update the size " - << "for object at position " << split -> position_ - << " with data size " << split -> d_size_ - << " and compressed data size " << split -> - c_size_ << ".\n" << logofs_flush; - #endif - - split -> store_ -> updateData(split -> position_, split -> d_size_, - split -> c_size_); - } - else - { - #ifdef TEST - *logofs << "SplitStore: Going to update data and size " - << "for object at position " << split -> position_ - << " with data size " << split -> d_size_ - << " and compressed data size " << split -> - c_size_ << ".\n" << logofs_flush; - #endif - - split -> store_ -> updateData(split -> position_, split -> data_.begin(), - split -> d_size_, split -> c_size_); - } - - // - // Unlock message so that we can remove - // or save it on disk at shutdown. - // - - if (split -> action_ == IS_ADDED) - { - split -> store_ -> unlock(split -> position_); - - #ifdef TEST - - validate(split); - - #endif - } - - return 1; -} - -int CommitStore::validate(Split *split) -{ - MessageStore *store = split -> store_; - - int p, n, s; - - s = store -> cacheSlots; - - for (p = 0, n = 0; p < s; p++) - { - if (store -> getLocks(p) == 1) - { - n++; - } - else if (store -> getLocks(p) != 0) - { - #ifdef PANIC - *logofs << "CommitStore: PANIC! Repository for OPCODE#" - << (unsigned int) store -> opcode() << " has " - << store -> getLocks(p) << " locks for message " - << "at position " << p << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Repository for OPCODE#" - << (unsigned int) store -> opcode() << " has " - << store -> getLocks(p) << " locks for message " - << "at position " << p << ".\n"; - - HandleAbort(); - } - } - - #ifdef TEST - *logofs << "CommitStore: Repository for OPCODE#" - << (unsigned int) store -> opcode() - << " has " << n << " locked messages.\n" - << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/Split.h b/nxcomp/Split.h deleted file mode 100644 index ee5eae7fe..000000000 --- a/nxcomp/Split.h +++ /dev/null @@ -1,543 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Split_H -#define Split_H - -#include "Types.h" -#include "Timestamp.h" -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to know how many splits -// are allocated and deallocated. -// - -#undef REFERENCES - -// -// Size of header of messages saved on -// disk. -// - -#define SPLIT_HEADER_SIZE 12 - -// -// This class is used to divide big messages -// in smaller chunks and send them at idle -// time. -// - -class EncodeBuffer; -class DecodeBuffer; - -class SplitStore; -class CommitStore; - -// -// Preferred message streaming policy. -// - -typedef enum -{ - split_none = -1, - split_async = 1, - split_sync - -} T_split_mode; - -// -// Current state of the split. Used to -// implement the state machine. -// - -typedef enum -{ - split_undefined = -1, - split_added, - split_missed, - split_loaded, - split_aborted, - split_notified - -} T_split_state; - -class Split -{ - friend class SplitStore; - friend class CommitStore; - - public: - - Split(); - - ~Split(); - - // - // Note that, differently from the message - // store, the split store doesn't account - // for the data offset when dealing with - // the data. This means that both the size_ - // and c_size members represent the actual - // size of the data part. - // - - void compressedSize(int size) - { - c_size_ = size; - - store_ -> validateSize(d_size_, c_size_); - } - - int compressedSize() - { - return c_size_; - } - - int plainSize() - { - return i_size_ + d_size_; - } - - T_checksum getChecksum() - { - return checksum_; - } - - MessageStore *getStore() - { - return store_; - } - - T_split_state getState() - { - return state_; - } - - T_store_action getAction() - { - return action_; - } - - // - // We may need to find the resource - // associated to the split message - // because old protocol version use - // a single store for all splits. - // - - int getResource() - { - return resource_; - } - - int getRequest() - { - return store_ -> opcode(); - } - - int getPosition() - { - return position_; - } - - T_split_mode getMode() - { - return mode_; - } - - void setPolicy(int load, int save) - { - load_ = load; - save_ = save; - } - - void setState(T_split_state state) - { - state_ = state; - } - - private: - - // - // The agent's resource which is splitting - // the message. - // - - int resource_; - - // - // Where to find the message in the message - // store or the X sequence number of the - // original request, in recent versions. - // - - int position_; - - // - // Which store is involved. - // - - MessageStore *store_; - - // - // Identity size of the message. - // - - int i_size_; - - // - // This is the uncompressed data size of the - // original message. - // - - int d_size_; - - // - // This is the size of the compressed data, - // if the data is stored in this form. - // - - int c_size_; - - // - // Size of the data buffer, as known by the - // encoding side. This field is only used at - // the decoding side. The remote size can be - // different from the actual data size, if - // the encoding side did not confirm that it - // received the abort split event. - // - - int r_size_; - - // - // Position in the data buffer that will be - // the target of the next send or receive - // operation while streaming the message. - // - - int next_; - - // - // Load or save the split to disk. - // - - int load_; - int save_; - - // - // Checksum of the original message. - // - - T_checksum checksum_; - - // - // Was this split confirmed or aborted? - // - - T_split_state state_; - - // - // What's the policy for sending this split? - // - - T_split_mode mode_; - - // - // Operation that had been performed on the - // store at the time the split was added. - // - - T_store_action action_; - - // - // Container for the identity and data part - // of the X message. - // - - T_data identity_; - T_data data_; - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -class SplitStore -{ - public: - - SplitStore(StaticCompressor *compressor, CommitStore *commits, int resource); - - ~SplitStore(); - - Split *getFirstSplit() const - { - if (splits_ -> size() > 0) - { - return (*(splits_ -> begin())); - } - - return NULL; - } - - Split *getLastSplit() const - { - if (splits_ -> size() > 0) - { - return (*(--(splits_ -> end()))); - } - - return NULL; - } - - int getNodeSize(const Split *split) const - { - // - // Take in account 64 bytes of overhead - // for each node. - // - - return (sizeof(class Split) + 64 + - split -> i_size_ + split -> d_size_); - } - - int getStorageSize() - { - return splitStorageSize_; - } - - static int getTotalSize() - { - return totalSplitSize_; - } - - static int getTotalStorageSize() - { - return totalSplitStorageSize_; - } - - int getResource() - { - return resource_; - } - - int getSize() - { - return splits_ -> size(); - } - - T_splits *getSplits() - { - return splits_; - } - - // - // Used, respectively, at the encoding - // and decoding side. - // - - Split *add(MessageStore *store, int resource, T_split_mode mode, - int position, T_store_action action, T_checksum checksum, - const unsigned char *buffer, const int size); - - Split *add(MessageStore *store, int resource, int position, - T_store_action action, T_checksum checksum, - unsigned char *buffer, const int size); - - // - // Handle the streaming of the message data. - // - - int send(EncodeBuffer &encodeBuffer, int packetSize); - - int receive(DecodeBuffer &decodeBuffer); - - // - // Remove the top element of the split store - // and update the storage size. - // - - void remove(Split *split); - - // - // Load the message from disk and replace the - // message in the store with the new copy. - // - - int load(Split *split); - - // - // Save the data to disk after the message has - // been recomposed at the local side. - // - - int save(Split *split); - - // - // Find the message on disk and update the last - // modification time. This is currently unused. - // - - int find(Split *split); - - // - // Remove the element on top of the queue and - // discard any split data that still needs to - // be transferred. - // - - Split *pop(); - - // - // Dump the content of the store. - // - - void dump(); - - protected: - - // - // Repository where to add the splits. - // - - T_splits *splits_; - - // - // Compress and decompress the data payload. - // - - StaticCompressor *compressor_; - - private: - - int start(EncodeBuffer &encodeBuffer); - - int start(DecodeBuffer &decodeBuffer); - - void push(Split *split); - - // - // Determine the name of the file object based - // on the checksum. - // - - const char *name(const T_checksum checksum); - - // - // The number of elements and data bytes - // in the repository. - // - - int splitStorageSize_; - - static int totalSplitSize_; - static int totalSplitStorageSize_; - - // - // Current element being transferred. - // - - T_splits::iterator current_; - - // - // Repository where to move the splits - // after they are completely recomposed. - // - - CommitStore *commits_; - - // - // Index in the client store or none, - // if this is a commit store. - // - - int resource_; - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -class CommitStore : public SplitStore -{ - // - // This is just a split store. - // - - public: - - CommitStore(StaticCompressor *compressor) - - : SplitStore(compressor, NULL, nothing) - { - } - - // - // Move identity and data of the split to the - // provided buffer, uncompressing the message, - // if needed. - // - - int expand(Split *split, unsigned char *buffer, const int size); - - // - // We recomposed the data part. If the message - // was originally added to the message store, - // replace the data and/or update the size. - // - - int update(Split *split); - - // - // Remove the split from the commit queue. - // - - Split *pop(); - - // - // This is just used for debug. It checks - // if any message in the message store has - // an invalid number of locks. - // - - int validate(Split *split); -}; - -#endif /* Split_H */ diff --git a/nxcomp/StaticCompressor.cpp b/nxcomp/StaticCompressor.cpp deleted file mode 100644 index 93103af41..000000000 --- a/nxcomp/StaticCompressor.cpp +++ /dev/null @@ -1,428 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Z.h" -#include "Misc.h" -#include "Control.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -#include "StaticCompressor.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -StaticCompressor::StaticCompressor(int compressionLevel, - int compressionThreshold) -{ - buffer_ = NULL; - bufferSize_ = 0; - - compressionStream_.zalloc = (alloc_func) 0; - compressionStream_.zfree = (free_func) 0; - compressionStream_.opaque = (voidpf) 0; - - decompressionStream_.zalloc = (alloc_func) 0; - decompressionStream_.zfree = (free_func) 0; - decompressionStream_.opaque = (void *) 0; - - decompressionStream_.next_in = (Bytef *) 0; - decompressionStream_.avail_in = 0; - - #ifdef TEST - *logofs << "StaticCompressor: Compression level is " - << compressionLevel << ".\n" << logofs_flush; - #endif - - int result = deflateInit2(&compressionStream_, compressionLevel, Z_DEFLATED, - 15, 9, Z_DEFAULT_STRATEGY); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Cannot initialize the " - << "compression stream. Error is '" << zError(result) - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot initialize the compression " - << "stream. Error is '" << zError(result) << "'.\n"; - - HandleAbort(); - } - - result = inflateInit2(&decompressionStream_, 15); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Cannot initialize the " - << "decompression stream. Error is '" << zError(result) - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot initialize the decompression " - << "stream. Error is '" << zError(result) << "'.\n"; - - HandleAbort(); - } - - #ifdef TEST - *logofs << "StaticCompressor: Compression threshold is " - << compressionThreshold << ".\n" << logofs_flush; - #endif - - threshold_ = compressionThreshold; -} - -StaticCompressor::~StaticCompressor() -{ - int result = deflateEnd(&compressionStream_); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Cannot deinitialize the " - << "compression stream. Error is '" << zError(result) - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot deinitialize the compression " - << "stream. Error is '" << zError(result) << "'.\n"; - } - - result = inflateEnd(&decompressionStream_); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Cannot deinitialize the " - << "decompression stream. Error is '" << zError(result) - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot deinitialize the decompression " - << "stream. Error is '" << zError(result) << "'.\n"; - } - - delete [] buffer_; -} - -// -// This function compresses and encodes the compressed -// buffer. It returns a pointer to the internal buffer -// where data was compressed. -// - -int StaticCompressor::compressBuffer(const unsigned char *plainBuffer, - const unsigned int plainSize, - unsigned char *&compressedBuffer, - unsigned int &compressedSize, - EncodeBuffer &encodeBuffer) -{ - if (control -> LocalDataCompression == 0 || - compressBuffer(plainBuffer, plainSize, - compressedBuffer, compressedSize) <= 0) - { - encodeBuffer.encodeBoolValue(0); - - encodeBuffer.encodeMemory(plainBuffer, plainSize); - - return 0; - } - else - { - encodeBuffer.encodeBoolValue(1); - - encodeBuffer.encodeValue(compressedSize, 32, 14); - encodeBuffer.encodeValue(plainSize, 32, 14); - - encodeBuffer.encodeMemory(compressedBuffer, compressedSize); - - return 1; - } -} - -// -// This function compresses data into a dynamically -// allocated buffer and returns a pointer to it, so -// application must copy data before the next call. -// - -int StaticCompressor::compressBuffer(const unsigned char *plainBuffer, - const unsigned int plainSize, - unsigned char *&compressedBuffer, - unsigned int &compressedSize) -{ - #ifdef DEBUG - *logofs << "StaticCompressor: Called for buffer at " - << (void *) plainBuffer << ".\n" - << logofs_flush; - #endif - - compressedSize = plainSize; - - if (plainSize < (unsigned int) threshold_) - { - #ifdef TEST - *logofs << "StaticCompressor: Leaving buffer unchanged. " - << "Plain size is " << plainSize << " with threshold " - << (unsigned int) threshold_ << ".\n" << logofs_flush; - #endif - - return 0; - } - - // - // Determine the size of the temporary - // buffer. - // - - unsigned int newSize = plainSize + (plainSize / 1000) + 12; - - // - // Allocate a new buffer if it grows - // beyond 64K. - // - - if (buffer_ == NULL || (bufferSize_ > 65536 && - newSize < bufferSize_ / 2) || newSize > bufferSize_) - { - delete [] buffer_; - - buffer_ = new unsigned char[newSize]; - - if (buffer_ == NULL) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Can't allocate compression " - << "buffer of " << newSize << " bytes. Error is " << EGET() - << " ' " << ESTR() << "'.\n" << logofs_flush; - #endif - - cerr << "Warning" << ": Can't allocate compression buffer of " - << newSize << " bytes. Error is " << EGET() - << " '" << ESTR() << "'.\n"; - - bufferSize_ = 0; - - return 0; - } - - bufferSize_ = newSize; - } - - unsigned int resultingSize = newSize; - - int result = ZCompress(&compressionStream_, buffer_, &resultingSize, - plainBuffer, plainSize); - - if (result == Z_OK) - { - if (resultingSize > newSize) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Overflow in compression " - << "buffer size. " << "Expected size was " << newSize - << " while it is " << resultingSize << ".\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Overflow in compress buffer size. " - << "Expected size was " << newSize << " while it is " - << resultingSize << ".\n"; - - return -1; - } - else if (resultingSize >= plainSize) - { - #ifdef TEST - *logofs << "StaticCompressor: Leaving buffer unchanged. " - << "Plain size is " << plainSize << " compressed " - << "size is " << resultingSize << ".\n" - << logofs_flush; - #endif - - return 0; - } - - compressedBuffer = buffer_; - compressedSize = resultingSize; - - #ifdef TEST - *logofs << "StaticCompressor: Compressed buffer from " - << plainSize << " to " << resultingSize - << " bytes.\n" << logofs_flush; - #endif - - return 1; - } - - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Failed compression of buffer. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failed compression of buffer. " - << "Error is '" << zError(result) << "'.\n"; - - return -1; -} - -int StaticCompressor::decompressBuffer(unsigned char *plainBuffer, - unsigned int plainSize, - const unsigned char *&compressedBuffer, - unsigned int &compressedSize, - DecodeBuffer &decodeBuffer) -{ - #ifdef DEBUG - *logofs << "StaticCompressor: Called for buffer at " - << (void *) plainBuffer << ".\n" - << logofs_flush; - #endif - - unsigned int value; - - decodeBuffer.decodeBoolValue(value); - - if (value == 0) - { - memcpy(plainBuffer, - decodeBuffer.decodeMemory(plainSize), - plainSize); - - return 0; - } - - unsigned int checkSize = plainSize; - - decodeBuffer.decodeValue(value, 32, 14); - compressedSize = value; - - decodeBuffer.decodeValue(value, 32, 14); - checkSize = value; - - // - // If caller needs the original compressed - // data it must copy this to its own buffer - // before using any further decode function. - // - - compressedBuffer = decodeBuffer.decodeMemory(compressedSize); - - int result = ZDecompress(&decompressionStream_, plainBuffer, &checkSize, - compressedBuffer, compressedSize); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Failure decompressing buffer. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Failure decompressing buffer. " - << "Error is '" << zError(result) << "'.\n"; - - return -1; - } - else if (plainSize != checkSize) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Expected decompressed size was " - << plainSize << " while it is " << checkSize - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Expected decompressed size was " - << plainSize << " while it is " << checkSize - << ".\n"; - - return -1; - } - - return 1; -} - -// -// This is used to uncompress on-the-fly -// messages whose data has been stored -// in compressed format. -// - -int StaticCompressor::decompressBuffer(unsigned char *plainBuffer, - const unsigned int plainSize, - const unsigned char *compressedBuffer, - const unsigned int compressedSize) -{ - #ifdef TEST - *logofs << "StaticCompressor: Called for buffer at " - << (void *) plainBuffer << ".\n" - << logofs_flush; - #endif - - unsigned int checkSize = plainSize; - - int result = ZDecompress(&decompressionStream_, plainBuffer, &checkSize, - compressedBuffer, compressedSize); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Failure decompressing buffer. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - return -1; - } - - if (plainSize != checkSize) - { - #ifdef PANIC - *logofs << "StaticCompressor: PANIC! Expected decompressed size was " - << plainSize << " while it is " << checkSize - << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Expected decompressed size was " - << plainSize << " while it is " << checkSize - << ".\n"; - - return -1; - } - - #ifdef TEST - *logofs << "StaticCompressor: Decompressed buffer from " - << compressedSize << " to " << plainSize - << " bytes.\n" << logofs_flush; - #endif - - return 1; -} diff --git a/nxcomp/StaticCompressor.h b/nxcomp/StaticCompressor.h deleted file mode 100644 index e0b81a527..000000000 --- a/nxcomp/StaticCompressor.h +++ /dev/null @@ -1,80 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef StaticCompressor_H -#define StaticCompressor_H - -#include "Z.h" - -class EncodeBuffer; -class DecodeBuffer; - -class StaticCompressor -{ - public: - - StaticCompressor(int compressionLevel, int compressionThreshold); - - ~StaticCompressor(); - - int compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, - unsigned char *&compressedBuffer, unsigned int &compressedSize, - EncodeBuffer &encodeBuffer); - - int compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, - unsigned char *&compressedBuffer, unsigned int &compressedSize); - - int decompressBuffer(unsigned char *plainBuffer, unsigned int plainSize, - const unsigned char *&compressedBuffer, unsigned int &compressedSize, - DecodeBuffer &decodeBuffer); - - int decompressBuffer(unsigned char *plainBuffer, const unsigned int plainSize, - const unsigned char *compressedBuffer, const unsigned compressedSize); - - static int isCompressionLevel(int compressionLevel) - { - return (compressionLevel == Z_DEFAULT_COMPRESSION || - (compressionLevel >= Z_NO_COMPRESSION && - compressionLevel <= Z_BEST_COMPRESSION)); - } - - int fullReset() - { - return (deflateReset(&compressionStream_) == Z_OK && - inflateReset(&decompressionStream_) == Z_OK); - } - - private: - - z_stream compressionStream_; - z_stream decompressionStream_; - - unsigned char *buffer_; - unsigned int bufferSize_; - - int threshold_; -}; - -#endif diff --git a/nxcomp/Statistics.cpp b/nxcomp/Statistics.cpp deleted file mode 100644 index baad7ef60..000000000 --- a/nxcomp/Statistics.cpp +++ /dev/null @@ -1,2003 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include - -#include "Statistics.h" - -#include "Control.h" - -#include "Proxy.h" - -#include "ClientStore.h" -#include "ServerStore.h" - -// -// Length of temporary buffer -// used to format output. -// - -#define FORMAT_LENGTH 1024 - -// -// Log level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Note that when presenting statistics we invert the -// correct semantics of X client and server entities. -// This is questionable, but matches the user's pers- -// pective of running remote X applications on its -// local client. -// - -Statistics::Statistics(Proxy *proxy) : proxy_(proxy) -{ - transportPartial_.idleTime_ = 0; - transportPartial_.readTime_ = 0; - transportPartial_.writeTime_ = 0; - transportPartial_.proxyBytesIn_ = 0; - transportPartial_.proxyBytesOut_ = 0; - transportPartial_.proxyFramesIn_ = 0; - transportPartial_.proxyFramesOut_ = 0; - transportPartial_.proxyWritesOut_ = 0; - transportPartial_.compressedBytesIn_ = 0; - transportPartial_.compressedBytesOut_ = 0; - transportPartial_.decompressedBytesIn_ = 0; - transportPartial_.decompressedBytesOut_ = 0; - transportPartial_.framingBitsOut_ = 0; - - transportTotal_.idleTime_ = 0; - transportTotal_.readTime_ = 0; - transportTotal_.writeTime_ = 0; - transportTotal_.proxyBytesIn_ = 0; - transportTotal_.proxyBytesOut_ = 0; - transportTotal_.proxyFramesIn_ = 0; - transportTotal_.proxyFramesOut_ = 0; - transportTotal_.proxyWritesOut_ = 0; - transportTotal_.compressedBytesIn_ = 0; - transportTotal_.compressedBytesOut_ = 0; - transportTotal_.decompressedBytesIn_ = 0; - transportTotal_.decompressedBytesOut_ = 0; - transportTotal_.framingBitsOut_ = 0; - - for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) - { - protocolPartial_.requestCached_[i] = 0; - protocolPartial_.requestReplied_[i] = 0; - protocolPartial_.requestCount_[i] = 0; - protocolPartial_.requestBitsIn_[i] = 0; - protocolPartial_.requestBitsOut_[i] = 0; - - protocolPartial_.renderRequestCached_[i] = 0; - protocolPartial_.renderRequestCount_[i] = 0; - protocolPartial_.renderRequestBitsIn_[i] = 0; - protocolPartial_.renderRequestBitsOut_[i] = 0; - - protocolPartial_.replyCached_[i] = 0; - protocolPartial_.replyCount_[i] = 0; - protocolPartial_.replyBitsIn_[i] = 0; - protocolPartial_.replyBitsOut_[i] = 0; - - protocolPartial_.eventCached_[i] = 0; - protocolPartial_.eventCount_[i] = 0; - protocolPartial_.eventBitsIn_[i] = 0; - protocolPartial_.eventBitsOut_[i] = 0; - - protocolTotal_.requestCached_[i] = 0; - protocolTotal_.requestReplied_[i] = 0; - protocolTotal_.requestCount_[i] = 0; - protocolTotal_.requestBitsIn_[i] = 0; - protocolTotal_.requestBitsOut_[i] = 0; - - protocolTotal_.renderRequestCached_[i] = 0; - protocolTotal_.renderRequestCount_[i] = 0; - protocolTotal_.renderRequestBitsIn_[i] = 0; - protocolTotal_.renderRequestBitsOut_[i] = 0; - - protocolTotal_.replyCached_[i] = 0; - protocolTotal_.replyCount_[i] = 0; - protocolTotal_.replyBitsIn_[i] = 0; - protocolTotal_.replyBitsOut_[i] = 0; - - protocolTotal_.eventCached_[i] = 0; - protocolTotal_.eventCount_[i] = 0; - protocolTotal_.eventBitsIn_[i] = 0; - protocolTotal_.eventBitsOut_[i] = 0; - } - - protocolPartial_.cupsCount_ = 0; - protocolPartial_.cupsBitsIn_ = 0; - protocolPartial_.cupsBitsOut_ = 0; - - protocolPartial_.smbCount_ = 0; - protocolPartial_.smbBitsIn_ = 0; - protocolPartial_.smbBitsOut_ = 0; - - protocolPartial_.mediaCount_ = 0; - protocolPartial_.mediaBitsIn_ = 0; - protocolPartial_.mediaBitsOut_ = 0; - - protocolPartial_.httpCount_ = 0; - protocolPartial_.httpBitsIn_ = 0; - protocolPartial_.httpBitsOut_ = 0; - - protocolPartial_.fontCount_ = 0; - protocolPartial_.fontBitsIn_ = 0; - protocolPartial_.fontBitsOut_ = 0; - - protocolPartial_.slaveCount_ = 0; - protocolPartial_.slaveBitsIn_ = 0; - protocolPartial_.slaveBitsOut_ = 0; - - protocolTotal_.cupsCount_ = 0; - protocolTotal_.cupsBitsIn_ = 0; - protocolTotal_.cupsBitsOut_ = 0; - - protocolTotal_.smbCount_ = 0; - protocolTotal_.smbBitsIn_ = 0; - protocolTotal_.smbBitsOut_ = 0; - - protocolTotal_.mediaCount_ = 0; - protocolTotal_.mediaBitsIn_ = 0; - protocolTotal_.mediaBitsOut_ = 0; - - protocolTotal_.httpCount_ = 0; - protocolTotal_.httpBitsIn_ = 0; - protocolTotal_.httpBitsOut_ = 0; - - protocolTotal_.fontCount_ = 0; - protocolTotal_.fontBitsIn_ = 0; - protocolTotal_.fontBitsOut_ = 0; - - protocolTotal_.slaveCount_ = 0; - protocolTotal_.slaveBitsIn_ = 0; - protocolTotal_.slaveBitsOut_ = 0; - - packedPartial_.packedBytesIn_ = 0; - packedPartial_.packedBytesOut_ = 0; - - packedTotal_.packedBytesIn_ = 0; - packedTotal_.packedBytesOut_ = 0; - - splitPartial_.splitCount_ = 0; - splitPartial_.splitAborted_ = 0; - splitPartial_.splitAbortedBytesOut_ = 0; - - splitTotal_.splitCount_ = 0; - splitTotal_.splitAborted_ = 0; - splitTotal_.splitAbortedBytesOut_ = 0; - - overallPartial_.overallBytesIn_ = 0; - overallPartial_.overallBytesOut_ = 0; - - overallTotal_.overallBytesIn_ = 0; - overallTotal_.overallBytesOut_ = 0; - - proxyData_.protocolCount_ = 0; - proxyData_.controlCount_ = 0; - proxyData_.splitCount_ = 0; - proxyData_.dataCount_ = 0; - - proxyData_.streamRatio_ = 1; - - startShortFrameTs_ = getTimestamp(); - startLongFrameTs_ = getTimestamp(); - startFrameTs_ = getTimestamp(); - - bytesInShortFrame_ = 0; - bytesInLongFrame_ = 0; - - bitrateInShortFrame_ = 0; - bitrateInLongFrame_ = 0; - - topBitrate_ = 0; - - congestionInFrame_ = 0; -} - -Statistics::~Statistics() -{ -} - -int Statistics::resetPartialStats() -{ - transportPartial_.idleTime_ = 0; - transportPartial_.readTime_ = 0; - transportPartial_.writeTime_ = 0; - transportPartial_.proxyBytesIn_ = 0; - transportPartial_.proxyBytesOut_ = 0; - transportPartial_.proxyFramesIn_ = 0; - transportPartial_.proxyFramesOut_ = 0; - transportPartial_.proxyWritesOut_ = 0; - transportPartial_.compressedBytesIn_ = 0; - transportPartial_.compressedBytesOut_ = 0; - transportPartial_.decompressedBytesIn_ = 0; - transportPartial_.decompressedBytesOut_ = 0; - transportPartial_.framingBitsOut_ = 0; - - for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) - { - protocolPartial_.requestCached_[i] = 0; - protocolPartial_.requestReplied_[i] = 0; - protocolPartial_.requestCount_[i] = 0; - protocolPartial_.requestBitsIn_[i] = 0; - protocolPartial_.requestBitsOut_[i] = 0; - - protocolPartial_.renderRequestCached_[i] = 0; - protocolPartial_.renderRequestCount_[i] = 0; - protocolPartial_.renderRequestBitsIn_[i] = 0; - protocolPartial_.renderRequestBitsOut_[i] = 0; - - protocolPartial_.replyCached_[i] = 0; - protocolPartial_.replyCount_[i] = 0; - protocolPartial_.replyBitsIn_[i] = 0; - protocolPartial_.replyBitsOut_[i] = 0; - - protocolPartial_.eventCached_[i] = 0; - protocolPartial_.eventCount_[i] = 0; - protocolPartial_.eventBitsIn_[i] = 0; - protocolPartial_.eventBitsOut_[i] = 0; - } - - protocolPartial_.cupsCount_ = 0; - protocolPartial_.cupsBitsIn_ = 0; - protocolPartial_.cupsBitsOut_ = 0; - - protocolPartial_.smbCount_ = 0; - protocolPartial_.smbBitsIn_ = 0; - protocolPartial_.smbBitsOut_ = 0; - - protocolPartial_.mediaCount_ = 0; - protocolPartial_.mediaBitsIn_ = 0; - protocolPartial_.mediaBitsOut_ = 0; - - protocolPartial_.httpCount_ = 0; - protocolPartial_.httpBitsIn_ = 0; - protocolPartial_.httpBitsOut_ = 0; - - protocolPartial_.fontCount_ = 0; - protocolPartial_.fontBitsIn_ = 0; - protocolPartial_.fontBitsOut_ = 0; - - protocolPartial_.slaveCount_ = 0; - protocolPartial_.slaveBitsIn_ = 0; - protocolPartial_.slaveBitsOut_ = 0; - - packedPartial_.packedBytesIn_ = 0; - packedPartial_.packedBytesOut_ = 0; - - splitPartial_.splitCount_ = 0; - splitPartial_.splitAborted_ = 0; - splitPartial_.splitAbortedBytesOut_ = 0; - - overallPartial_.overallBytesIn_ = 0; - overallPartial_.overallBytesOut_ = 0; - - return 1; -} - -void Statistics::addCompressedBytes(unsigned int bytesIn, unsigned int bytesOut) -{ - transportPartial_.compressedBytesIn_ += bytesIn; - transportTotal_.compressedBytesIn_ += bytesIn; - - transportPartial_.compressedBytesOut_ += bytesOut; - transportTotal_.compressedBytesOut_ += bytesOut; - - double ratio = bytesIn / bytesOut; - - if (ratio < 1) - { - ratio = 1; - } - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Old ratio was " - << proxyData_.streamRatio_ << " current is " - << (double) ratio << " new ratio is " << (double) - ((proxyData_.streamRatio_ * 2) + ratio) / 3 << ".\n" - << logofs_flush; - #endif - - proxyData_.streamRatio_ = ((proxyData_.streamRatio_ * 2) + ratio) / 3; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Updated compressed bytes " - << "with " << bytesIn << " in " << bytesOut << " out " - << "and ratio " << (double) proxyData_.streamRatio_ - << ".\n" << logofs_flush; - #endif -} - -// -// Recalculate the current bitrate. The bytes written -// are accounted at the time the transport actually -// writes the data to the network, not at the time it -// receives the data from the upper layers. The reason -// is that data can be compressed by the stream com- -// pressor, so we can become aware of the new bitrate -// only afer having flushed the ZLIB stream. This also -// means that, to have a reliable estimate, we need to -// flush the link often. -// - -void Statistics::updateBitrate(int bytes) -{ - T_timestamp thisFrameTs = getNewTimestamp(); - - int diffFramesInMs = diffTimestamp(startFrameTs_, thisFrameTs); - - #ifdef DEBUG - *logofs << "Statistics: Difference since previous timestamp is " - << diffFramesInMs << " Ms.\n" << logofs_flush; - #endif - - if (diffFramesInMs > 0) - { - #ifdef DEBUG - *logofs << "Statistics: Removing " << diffFramesInMs - << " Ms in short and long time frame.\n" - << logofs_flush; - #endif - - int shortBytesToRemove = (int) (((double) bytesInShortFrame_ * (double) diffFramesInMs) / - (double) control -> ShortBitrateTimeFrame); - - int longBytesToRemove = (int) (((double) bytesInLongFrame_ * (double) diffFramesInMs) / - (double) control -> LongBitrateTimeFrame); - - #ifdef DEBUG - *logofs << "Statistics: Removing " << shortBytesToRemove - << " bytes from " << bytesInShortFrame_ - << " in the short frame.\n" << logofs_flush; - #endif - - bytesInShortFrame_ -= shortBytesToRemove; - - if (bytesInShortFrame_ < 0) - { - #ifdef TEST - *logofs << "Statistics: Bytes in short frame are " - << bytesInShortFrame_ << ". Set to 0.\n" - << logofs_flush; - #endif - - bytesInShortFrame_ = 0; - } - - #ifdef DEBUG - *logofs << "Statistics: Removing " << longBytesToRemove - << " bytes from " << bytesInLongFrame_ - << " in the long frame.\n" << logofs_flush; - #endif - - bytesInLongFrame_ -= longBytesToRemove; - - if (bytesInLongFrame_ < 0) - { - #ifdef TEST - *logofs << "Statistics: Bytes in long frame are " - << bytesInLongFrame_ << ". Set to 0.\n" - << logofs_flush; - #endif - - bytesInLongFrame_ = 0; - } - - int diffStartInMs; - - diffStartInMs = diffTimestamp(thisFrameTs, startShortFrameTs_); - - if (diffStartInMs > control -> ShortBitrateTimeFrame) - { - addMsTimestamp(startShortFrameTs_, diffStartInMs); - } - - diffStartInMs = diffTimestamp(thisFrameTs, startLongFrameTs_); - - if (diffStartInMs > control -> LongBitrateTimeFrame) - { - addMsTimestamp(startLongFrameTs_, diffStartInMs); - } - - startFrameTs_ = thisFrameTs; - } - - #ifdef DEBUG - *logofs << "Statistics: Adding " << bytes << " bytes to " - << bytesInShortFrame_ << " in the short frame.\n" - << logofs_flush; - #endif - - bytesInShortFrame_ = bytesInShortFrame_ + bytes; - - #ifdef DEBUG - *logofs << "Statistics: Adding " << bytes << " bytes to " - << bytesInLongFrame_ << " in the long frame.\n" - << logofs_flush; - #endif - - bytesInLongFrame_ = bytesInLongFrame_ + bytes; - - bitrateInShortFrame_ = (int) ((double) bytesInShortFrame_ / - ((double) control -> ShortBitrateTimeFrame / 1000)); - - bitrateInLongFrame_ = (int) ((double) bytesInLongFrame_ / - ((double) control -> LongBitrateTimeFrame / 1000)); - - if (bitrateInShortFrame_ > topBitrate_) - { - topBitrate_ = bitrateInShortFrame_; - } - - #ifdef TEST - *logofs << "Statistics: Current bitrate is short " << bitrateInShortFrame_ - << " long " << bitrateInLongFrame_ << " top " << topBitrate_ - << ".\n" << logofs_flush; - #endif -} - -void Statistics::updateCongestion(int remaining, int limit) -{ - #ifdef TEST - *logofs << "Statistics: Updating the congestion " - << "counters at " << strMsTimestamp() - << ".\n" << logofs_flush; - #endif - - double current = remaining; - - if (current < 0) - { - current = 0; - } - - current = 9 * (limit - current) / limit; - - #ifdef TEST - *logofs << "Statistics: Current congestion is " - << current << " with " << limit << " tokens " - << "and " << remaining << " remaining.\n" - << logofs_flush; - #endif - - // - // If the current congestion counter is greater - // than the previous, take the current value, - // otherwise ramp down the value by calculating - // the average of the last 8 updates. - // - - #ifdef TEST - *logofs << "Statistics: Old congestion was " - << congestionInFrame_; - #endif - - if (current >= congestionInFrame_) - { - congestionInFrame_ = current; - } - else - { - congestionInFrame_ = ((congestionInFrame_ * 7) + current) / 8; - } - - #ifdef TEST - *logofs << " new congestion is " - << ((congestionInFrame_ * 7) + current) / 8 - << ".\n" << logofs_flush; - #endif - - // - // Call the function with 0 bytes flushed - // so the agent can update its congestion - // counter. - // - - FlushCallback(0); -} - -int Statistics::getClientCacheStats(int type, char *&buffer) -{ - if (type != PARTIAL_STATS && type != TOTAL_STATS) - { - #ifdef PANIC - *logofs << "Statistics: PANIC! Cannot produce statistics " - << "with qualifier '" << type << "'.\n" - << logofs_flush; - #endif - - return -1; - } - - // - // Print message cache data according - // to local and remote view. - // - - MessageStore *currentStore = NULL; - MessageStore *anyStore = NULL; - - char format[FORMAT_LENGTH]; - - strcat(buffer, "\nNX Cache Statistics\n"); - strcat(buffer, "-------------------\n\n"); - - for (int m = proxy_client; m <= proxy_server; m++) - { - if (m == proxy_client) - { - strcat(buffer, "Request\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); - strcat(buffer, "-------\t------\t--------------\t\t--------------\t\t-----------\n"); - } - else - { - strcat(buffer, "\nReply\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); - strcat(buffer, "-----\t------\t--------------\t\t--------------\t\t-----------\n"); - } - - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (m == proxy_client) - { - currentStore = proxy_ -> getClientStore() -> getRequestStore(i); - } - else - { - currentStore = proxy_ -> getServerStore() -> getReplyStore(i); - } - - if (currentStore != NULL && - (currentStore -> getLocalStorageSize() || - currentStore -> getRemoteStorageSize())) - { - anyStore = currentStore; - - sprintf(format, "#%d\t%d\t", i, currentStore -> getSize()); - - strcat(buffer, format); - - sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getLocalStorageSize(), - ((double) currentStore -> getLocalStorageSize()) / 1024); - - strcat(buffer, format); - - sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getRemoteStorageSize(), - ((double) currentStore -> getRemoteStorageSize()) / 1024); - - strcat(buffer, format); - - sprintf(format, "%d/%.0f KB\n", currentStore -> cacheSlots, - ((double) control -> getUpperStorageSize() / 100 * - currentStore -> cacheThreshold) / 1024); - - strcat(buffer, format); - } - } - - if (anyStore == NULL) - { - strcat(buffer, "N/A\n"); - } - } - - if (anyStore != NULL) - { - sprintf(format, "\ncache: %d bytes (%d KB) available at server.\n", - control -> ClientTotalStorageSize, - control -> ClientTotalStorageSize / 1024); - - strcat(buffer, format); - - sprintf(format, " %d bytes (%d KB) available at client.\n\n", - control -> ServerTotalStorageSize, - control -> ServerTotalStorageSize / 1024); - - strcat(buffer, format); - - sprintf(format, " %d bytes (%d KB) allocated at server.\n", - anyStore -> getLocalTotalStorageSize(), - anyStore -> getLocalTotalStorageSize() / 1024); - - strcat(buffer, format); - - sprintf(format, " %d bytes (%d KB) allocated at client.\n\n\n", - anyStore -> getRemoteTotalStorageSize(), - anyStore -> getRemoteTotalStorageSize() / 1024); - - strcat(buffer, format); - } - else - { - strcat(buffer, "\ncache: N/A\n\n"); - } - - return 1; -} - -int Statistics::getClientProtocolStats(int type, char *&buffer) -{ - if (type != PARTIAL_STATS && type != TOTAL_STATS) - { - #ifdef PANIC - *logofs << "Statistics: PANIC! Cannot produce statistics " - << "with qualifier '" << type << "'.\n" - << logofs_flush; - #endif - - return -1; - } - - struct T_transportData *transportData; - struct T_protocolData *protocolData; - struct T_overallData *overallData; - - if (type == PARTIAL_STATS) - { - transportData = &transportPartial_; - protocolData = &protocolPartial_; - overallData = &overallPartial_; - } - else - { - transportData = &transportTotal_; - protocolData = &protocolTotal_; - overallData = &overallTotal_; - } - - char format[FORMAT_LENGTH]; - - double countRequestIn = 0; - double countCachedRequestIn = 0; - double countRepliedRequestIn = 0; - - double countRequestBitsIn = 0; - double countRequestBitsOut = 0; - - double countAnyIn = 0; - double countBitsIn = 0; - double countBitsOut = 0; - - // - // Print request data. - // - - strcat(buffer, "NX Server Side Protocol Statistics\n"); - strcat(buffer, "----------------------------------\n\n"); - - // - // Print render data. - // - - strcat(buffer, "Render Total\tCached\tBits In\t\tBits Out\tBits/Request\t\tRatio\n"); - strcat(buffer, "------- -----\t------\t-------\t\t--------\t------------\t\t-----\n"); - - for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) - { - if (protocolData -> renderRequestCount_[i]) - { - sprintf(format, "#%d ", i); - - while (strlen(format) < 8) - { - strcat(format, " "); - } - - strcat(buffer, format); - - if (protocolData -> renderRequestCached_[i] > 0) - { - sprintf(format, "%.0f\t%.0f", protocolData -> renderRequestCount_[i], - protocolData -> renderRequestCached_[i]); - } - else - { - sprintf(format, "%.0f\t", protocolData -> renderRequestCount_[i]); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - protocolData -> renderRequestBitsIn_[i], protocolData -> renderRequestBitsIn_[i] / 8192, - protocolData -> renderRequestBitsOut_[i], protocolData -> renderRequestBitsOut_[i] / 8192, - protocolData -> renderRequestBitsIn_[i] / protocolData -> renderRequestCount_[i], - protocolData -> renderRequestBitsOut_[i] / protocolData -> renderRequestCount_[i]); - - strcat(buffer, format); - - if (protocolData -> renderRequestBitsOut_[i] > 0) - { - sprintf(format, "%5.3f:1\n", protocolData -> renderRequestBitsIn_[i] / - protocolData -> renderRequestBitsOut_[i]); - - strcat(buffer, format); - } - else - { - strcat(buffer, "1:1\n"); - } - } - - countRequestIn += protocolData -> renderRequestCount_[i]; - countCachedRequestIn += protocolData -> renderRequestCached_[i]; - - countRequestBitsIn += protocolData -> renderRequestBitsIn_[i]; - countRequestBitsOut += protocolData -> renderRequestBitsOut_[i]; - - countAnyIn += protocolData -> renderRequestCount_[i]; - countBitsIn += protocolData -> renderRequestBitsIn_[i]; - countBitsOut += protocolData -> renderRequestBitsOut_[i]; - } - - if (countRequestIn > 0) - { - if (countCachedRequestIn > 0) - { - sprintf(format, "\ntotal: %.0f\t%.0f", countRequestIn, countCachedRequestIn); - } - else - { - sprintf(format, "\ntotal: %.0f\t", countRequestIn); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - countRequestBitsIn, countRequestBitsIn / 8192, countRequestBitsOut, - countRequestBitsOut / 8192, countRequestBitsIn / countRequestIn, - countRequestBitsOut / countRequestIn); - - strcat(buffer, format); - - if (countRequestBitsOut > 0) - { - sprintf(format, "%5.3f:1\n", countRequestBitsIn / countRequestBitsOut); - } - else - { - sprintf(format, "1:1\n"); - } - - strcat(buffer, format); - } - else - { - strcat(buffer, "N/A\n\n"); - } - - countRequestIn = 0; - countCachedRequestIn = 0; - - countRequestBitsIn = 0; - countRequestBitsOut = 0; - - countAnyIn = 0; - countBitsIn = 0; - countBitsOut = 0; - - // - // Print other requests' data. - // - - strcat(buffer, "\nRequest Total\tCached\tBits In\t\tBits Out\tBits/Request\t\tRatio\n"); - strcat(buffer, "------- -----\t------\t-------\t\t--------\t------------\t\t-----\n"); - - for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) - { - if (protocolData -> requestCount_[i]) - { - sprintf(format, "#%d ", i); - - while (strlen(format) < 5) - { - strcat(format, " "); - } - - // - // Mark NX agent-related requests, those - // having a reply and finally those that - // have been probably tainted by client - // side. - // - - if (i >= X_NXFirstOpcode && i <= X_NXLastOpcode) - { - strcat(format, "A"); - } - - if (i != X_NXInternalGenericReply && protocolData -> requestReplied_[i] > 0) - { - strcat(format, "R"); - } - - if (i == X_NoOperation && control -> TaintReplies) - { - strcat(format, "T"); - } - - while (strlen(format) < 8) - { - strcat(format, " "); - } - - strcat(buffer, format); - - if (protocolData -> requestCached_[i] > 0) - { - sprintf(format, "%.0f\t%.0f", protocolData -> requestCount_[i], - protocolData -> requestCached_[i]); - } - else - { - sprintf(format, "%.0f\t", protocolData -> requestCount_[i]); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - protocolData -> requestBitsIn_[i], protocolData -> requestBitsIn_[i] / 8192, - protocolData -> requestBitsOut_[i], protocolData -> requestBitsOut_[i] / 8192, - protocolData -> requestBitsIn_[i] / protocolData -> requestCount_[i], - protocolData -> requestBitsOut_[i] / protocolData -> requestCount_[i]); - - strcat(buffer, format); - - if (protocolData -> requestBitsOut_[i] > 0) - { - sprintf(format, "%5.3f:1\n", protocolData -> requestBitsIn_[i] / - protocolData -> requestBitsOut_[i]); - - strcat(buffer, format); - } - else - { - strcat(buffer, "1:1\n"); - } - } - - countRequestIn += protocolData -> requestCount_[i]; - countCachedRequestIn += protocolData -> requestCached_[i]; - countRepliedRequestIn += protocolData -> requestReplied_[i]; - - countRequestBitsIn += protocolData -> requestBitsIn_[i]; - countRequestBitsOut += protocolData -> requestBitsOut_[i]; - - countAnyIn += protocolData -> requestCount_[i]; - countBitsIn += protocolData -> requestBitsIn_[i]; - countBitsOut += protocolData -> requestBitsOut_[i]; - } - - if (countRequestIn > 0) - { - if (countCachedRequestIn > 0) - { - sprintf(format, "\ntotal: %.0f\t%.0f", countRequestIn, countCachedRequestIn); - } - else - { - sprintf(format, "\ntotal: %.0f\t", countRequestIn); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - countRequestBitsIn, countRequestBitsIn / 8192, countRequestBitsOut, - countRequestBitsOut / 8192, countRequestBitsIn / countRequestIn, - countRequestBitsOut / countRequestIn); - - strcat(buffer, format); - - if (countRequestBitsOut > 0) - { - sprintf(format, "%5.3f:1\n", countRequestBitsIn / countRequestBitsOut); - } - else - { - sprintf(format, "1:1\n"); - } - - strcat(buffer, format); - } - else - { - strcat(buffer, "N/A\n\n"); - } - - // - // Print transport data. - // - - getTimeStats(type, buffer); - - countAnyIn += protocolData -> cupsCount_; - countBitsIn += protocolData -> cupsBitsIn_; - countBitsOut += protocolData -> cupsBitsOut_; - - countAnyIn += protocolData -> smbCount_; - countBitsIn += protocolData -> smbBitsIn_; - countBitsOut += protocolData -> smbBitsOut_; - - countAnyIn += protocolData -> mediaCount_; - countBitsIn += protocolData -> mediaBitsIn_; - countBitsOut += protocolData -> mediaBitsOut_; - - countAnyIn += protocolData -> httpCount_; - countBitsIn += protocolData -> httpBitsIn_; - countBitsOut += protocolData -> httpBitsOut_; - - countAnyIn += protocolData -> fontCount_; - countBitsIn += protocolData -> fontBitsIn_; - countBitsOut += protocolData -> fontBitsOut_; - - countAnyIn += protocolData -> slaveCount_; - countBitsIn += protocolData -> slaveBitsIn_; - countBitsOut += protocolData -> slaveBitsOut_; - - // - // Save the overall amount of bytes - // coming from X clients. - // - - overallData -> overallBytesIn_ = countBitsIn / 8; - - // - // Print performance data. - // - - if (transportData -> readTime_ > 0) - { - sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", - countAnyIn / (transportData -> readTime_ / 1000), - (countBitsIn + transportData -> framingBitsOut_) / 8192 / - (transportData -> readTime_ / 1000)); - } - else - { - sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", - countAnyIn, (countBitsIn + transportData -> - framingBitsOut_) / 8192); - } - - strcat(buffer, format); - - strcat(buffer, "link: "); - - // - // ZLIB compression stats. - // - - getStreamStats(type, buffer); - - // - // Save the overall amount of bytes - // sent on NX proxy link. - // - - if (transportData -> compressedBytesOut_ > 0) - { - overallData -> overallBytesOut_ = transportData -> compressedBytesOut_; - } - else - { - overallData -> overallBytesOut_ = countBitsOut / 8; - } - - // - // Print info on multiplexing overhead. - // - - getFramingStats(type, buffer); - - // - // Print stats about additional channels. - // - - getServicesStats(type, buffer); - - // - // Compression summary. - // - - double ratio = 1; - - if (transportData -> compressedBytesOut_ / 1024 > 0) - { - ratio = ((countBitsIn + transportData -> framingBitsOut_) / 8192) / - (transportData -> compressedBytesOut_ / 1024); - - } - else if (countBitsOut > 0) - { - ratio = (countBitsIn + transportData -> framingBitsOut_) / - countBitsOut; - } - - sprintf(format, " Protocol compression ratio is %5.3f:1.\n\n", - ratio); - - strcat(buffer, format); - - getBitrateStats(type, buffer); - - getSplitStats(type, buffer); - - sprintf(format, " %.0f total handled replies (%.0f unmatched).\n\n\n", - countRepliedRequestIn, protocolData -> requestReplied_[X_NXInternalGenericReply]); - - strcat(buffer, format); - - return 1; -} - -int Statistics::getClientOverallStats(int type, char *&buffer) -{ - if (type != PARTIAL_STATS && type != TOTAL_STATS) - { - #ifdef PANIC - *logofs << "Statistics: PANIC! Cannot produce statistics " - << "with qualifier '" << type << "'.\n" - << logofs_flush; - #endif - - return -1; - } - - struct T_overallData *overallData; - struct T_packedData *packedData; - - if (type == PARTIAL_STATS) - { - overallData = &overallPartial_; - packedData = &packedPartial_; - } - else - { - overallData = &overallTotal_; - packedData = &packedTotal_; - } - - char format[FORMAT_LENGTH]; - - // - // Print header including link type, - // followed by info on packed images. - // - - strcat(buffer, "NX Compression Summary\n"); - strcat(buffer, "----------------------\n\n"); - - char label[FORMAT_LENGTH]; - - switch (control -> LinkMode) - { - case LINK_TYPE_NONE: - { - strcpy(label, "NONE"); - - break; - } - case LINK_TYPE_MODEM: - { - strcpy(label, "MODEM"); - - break; - } - case LINK_TYPE_ISDN: - { - strcpy(label, "ISDN"); - - break; - } - case LINK_TYPE_ADSL: - { - strcpy(label, "ADSL"); - - break; - } - case LINK_TYPE_WAN: - { - strcpy(label, "WAN"); - - break; - } - case LINK_TYPE_LAN: - { - strcpy(label, "LAN"); - - break; - } - default: - { - strcpy(label, "Unknown"); - - break; - } - } - - sprintf(format, "link: %s", label); - - if (control -> LocalDeltaCompression == 1) - { - strcat(format, " with protocol compression enabled."); - } - else - { - strcat(format, " with protocol compression disabled."); - } - - strcat(format, "\n\n"); - - strcat(buffer, format); - - if (packedData -> packedBytesIn_ > 0) - { - sprintf(format, "images: %.0f bytes (%.0f KB) packed to %.0f (%.0f KB).\n\n", - packedData -> packedBytesOut_, packedData -> packedBytesOut_ / 1024, - packedData -> packedBytesIn_, packedData -> packedBytesIn_ / 1024); - - strcat(buffer, format); - - sprintf(format, " Images compression ratio is %5.3f:1.\n\n", - packedData -> packedBytesOut_ / packedData -> packedBytesIn_); - - strcat(buffer, format); - } - - double overallIn = overallData -> overallBytesIn_ - packedData -> packedBytesIn_ + - packedData -> packedBytesOut_; - - double overallOut = overallData -> overallBytesOut_; - - sprintf(format, "overall: %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - overallIn, overallIn / 1024, overallOut, overallOut / 1024); - - strcat(buffer, format); - - if (overallData -> overallBytesOut_ > 0) - { - sprintf(format, " Overall NX server compression ratio is %5.3f:1.\n\n\n", - overallIn / overallOut); - } - else - { - sprintf(format, " Overall NX server compression ratio is 1:1.\n\n\n"); - } - - strcat(buffer, format); - - return 1; -} - -int Statistics::getServerCacheStats(int type, char *&buffer) -{ - if (type != PARTIAL_STATS && type != TOTAL_STATS) - { - #ifdef PANIC - *logofs << "Statistics: PANIC! Cannot produce statistics " - << "with qualifier '" << type << "'.\n" - << logofs_flush; - #endif - - return -1; - } - - // - // Print message cache data according - // to local and remote view. - // - - MessageStore *currentStore = NULL; - MessageStore *anyStore = NULL; - - char format[FORMAT_LENGTH]; - - strcat(buffer, "\nNX Cache Statistics\n"); - strcat(buffer, "-------------------\n\n"); - - for (int m = proxy_client; m <= proxy_server; m++) - { - if (m == proxy_client) - { - strcat(buffer, "Request\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); - strcat(buffer, "-------\t------\t--------------\t\t--------------\t\t-----------\n"); - } - else - { - strcat(buffer, "\nReply\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); - strcat(buffer, "-----\t------\t--------------\t\t--------------\t\t-----------\n"); - } - - for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) - { - if (m == proxy_client) - { - currentStore = proxy_ -> getClientStore() -> getRequestStore(i); - } - else - { - currentStore = proxy_ -> getServerStore() -> getReplyStore(i); - } - - if (currentStore != NULL && - (currentStore -> getLocalStorageSize() || - currentStore -> getRemoteStorageSize())) - { - anyStore = currentStore; - - sprintf(format, "#%d\t%d\t", i, currentStore -> getSize()); - - strcat(buffer, format); - - sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getRemoteStorageSize(), - ((double) currentStore -> getRemoteStorageSize()) / 1024); - - strcat(buffer, format); - - sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getLocalStorageSize(), - ((double) currentStore -> getLocalStorageSize()) / 1024); - - strcat(buffer, format); - - sprintf(format, "%d/%.0f KB\n", currentStore -> cacheSlots, - ((double) control -> getUpperStorageSize() / 100 * - currentStore -> cacheThreshold) / 1024); - - strcat(buffer, format); - } - } - - if (anyStore == NULL) - { - strcat(buffer, "N/A\n"); - } - } - - if (anyStore != NULL) - { - sprintf(format, "\ncache: %d bytes (%d KB) available at server.\n", - control -> ClientTotalStorageSize, - control -> ClientTotalStorageSize / 1024); - - strcat(buffer, format); - - sprintf(format, " %d bytes (%d KB) available at client.\n\n", - control -> ServerTotalStorageSize, - control -> ServerTotalStorageSize / 1024); - - strcat(buffer, format); - - sprintf(format, " %d bytes (%d KB) allocated at server.\n", - anyStore -> getRemoteTotalStorageSize(), - anyStore -> getRemoteTotalStorageSize() / 1024); - - strcat(buffer, format); - - sprintf(format, " %d bytes (%d KB) allocated at client.\n\n\n", - anyStore -> getLocalTotalStorageSize(), - anyStore -> getLocalTotalStorageSize() / 1024); - - strcat(buffer, format); - } - else - { - strcat(buffer, "\ncache: N/A\n\n"); - } - - return 1; -} - -int Statistics::getServerProtocolStats(int type, char *&buffer) -{ - if (type != PARTIAL_STATS && type != TOTAL_STATS) - { - #ifdef PANIC - *logofs << "Statistics: PANIC! Cannot produce statistics " - << "with qualifier '" << type << "'.\n" - << logofs_flush; - #endif - - return -1; - } - - struct T_transportData *transportData; - struct T_protocolData *protocolData; - struct T_overallData *overallData; - - if (type == PARTIAL_STATS) - { - transportData = &transportPartial_; - protocolData = &protocolPartial_; - overallData = &overallPartial_; - } - else - { - transportData = &transportTotal_; - protocolData = &protocolTotal_; - overallData = &overallTotal_; - } - - char format[FORMAT_LENGTH]; - - double countReplyBitsIn = 0; - double countReplyBitsOut = 0; - - double countReplyIn = 0; - double countCachedReplyIn = 0; - - double countEventBitsIn = 0; - double countEventBitsOut = 0; - - double countEventIn = 0; - double countCachedEventIn = 0; - - double countAnyIn = 0; - double countBitsIn = 0; - double countBitsOut = 0; - - // - // Print reply data. - // - - strcat(buffer, "NX Client Side Protocol Statistics\n"); - strcat(buffer, "----------------------------------\n\n"); - - strcat(buffer, "Reply Total\tCached\tBits In\t\tBits Out\tBits/Reply\t\tRatio\n"); - strcat(buffer, "------- -----\t------\t-------\t\t--------\t----------\t\t-----\n"); - - for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) - { - if (protocolData -> replyCount_[i]) - { - sprintf(format, "#%d ", i); - - while (strlen(format) < 5) - { - strcat(format, " "); - } - - // - // Mark replies originated - // by NX agent requests. - // - - if (i >= X_NXFirstOpcode && i <= X_NXLastOpcode) - { - strcat(format, "A"); - } - - // - // Mark replies that we didn't - // match against a request. - // - - if (i == 1) - { - strcat(format, "U"); - } - - while (strlen(format) < 8) - { - strcat(format, " "); - } - - strcat(buffer, format); - - if (protocolData -> replyCached_[i] > 0) - { - sprintf(format, "%.0f\t%.0f", protocolData -> replyCount_[i], - protocolData -> replyCached_[i]); - } - else - { - sprintf(format, "%.0f\t", protocolData -> replyCount_[i]); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - protocolData -> replyBitsIn_[i], protocolData -> replyBitsIn_[i] / 8192, - protocolData -> replyBitsOut_[i], protocolData -> replyBitsOut_[i] / 8192, - protocolData -> replyBitsIn_[i] / protocolData -> replyCount_[i], - protocolData -> replyBitsOut_[i] / protocolData -> replyCount_[i]); - - strcat(buffer, format); - - if (protocolData -> replyBitsOut_[i] > 0) - { - sprintf(format, "%5.3f:1\n", protocolData -> replyBitsIn_[i] / - protocolData -> replyBitsOut_[i]); - } - else - { - sprintf(format, "1:1\n"); - } - - strcat(buffer, format); - } - - countReplyIn += protocolData -> replyCount_[i]; - countCachedReplyIn += protocolData -> replyCached_[i]; - - countReplyBitsIn += protocolData -> replyBitsIn_[i]; - countReplyBitsOut += protocolData -> replyBitsOut_[i]; - - countAnyIn += protocolData -> replyCount_[i]; - countBitsIn += protocolData -> replyBitsIn_[i]; - countBitsOut += protocolData -> replyBitsOut_[i]; - } - - if (countReplyIn > 0) - { - if (countCachedReplyIn > 0) - { - sprintf(format, "\ntotal: %.0f\t%.0f", countReplyIn, countCachedReplyIn); - } - else - { - sprintf(format, "\ntotal: %.0f\t", countReplyIn); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - countReplyBitsIn, countReplyBitsIn / 8192, countReplyBitsOut, - countReplyBitsOut / 8192, countReplyBitsIn / countReplyIn, - countReplyBitsOut / countReplyIn); - - strcat(buffer, format); - - if (countReplyBitsOut > 0) - { - sprintf(format, "%5.3f:1\n", countReplyBitsIn / countReplyBitsOut); - } - else - { - sprintf(format, "1:1\n"); - } - - strcat(buffer, format); - } - else - { - strcat(buffer, "N/A\n"); - } - - strcat(buffer, "\n"); - - // - // Print event and error data. - // - - strcat(buffer, "Event Total\tCached\tBits In\t\tBits Out\tBits/Event\t\tRatio\n"); - strcat(buffer, "------- -----\t------\t-------\t\t--------\t----------\t\t-----\n"); - - for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) - { - if (protocolData -> eventCount_[i]) - { - sprintf(format, "#%d ", i); - - while (strlen(format) < 8) - { - strcat(format, " "); - } - - strcat(buffer, format); - - if (protocolData -> eventCached_[i] > 0) - { - sprintf(format, "%.0f\t%.0f", protocolData -> eventCount_[i], - protocolData -> eventCached_[i]); - } - else - { - sprintf(format, "%.0f\t", protocolData -> eventCount_[i]); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - protocolData -> eventBitsIn_[i], protocolData -> eventBitsIn_[i] / 8192, - protocolData -> eventBitsOut_[i], protocolData -> eventBitsOut_[i] / 8192, - protocolData -> eventBitsIn_[i] / protocolData -> eventCount_[i], - protocolData -> eventBitsOut_[i] / protocolData -> eventCount_[i]); - - strcat(buffer, format); - - if (protocolData -> eventBitsOut_[i] > 0) - { - sprintf(format, "%5.3f:1\n", protocolData -> eventBitsIn_[i] / - protocolData -> eventBitsOut_[i]); - } - else - { - sprintf(format, "1:1\n"); - } - - strcat(buffer, format); - } - - countEventIn += protocolData -> eventCount_[i]; - countCachedEventIn += protocolData -> eventCached_[i]; - - countEventBitsIn += protocolData -> eventBitsIn_[i]; - countEventBitsOut += protocolData -> eventBitsOut_[i]; - - countAnyIn += protocolData -> eventCount_[i]; - countBitsIn += protocolData -> eventBitsIn_[i]; - countBitsOut += protocolData -> eventBitsOut_[i]; - } - - if (countEventIn > 0) - { - if (countCachedEventIn > 0) - { - sprintf(format, "\ntotal: %.0f\t%.0f", countEventIn, countCachedEventIn); - } - else - { - sprintf(format, "\ntotal: %.0f\t", countEventIn); - } - - strcat(buffer, format); - - sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", - countEventBitsIn, countEventBitsIn / 8192, countEventBitsOut, - countEventBitsOut / 8192, countEventBitsIn / countEventIn, - countEventBitsOut / countEventIn); - - strcat(buffer, format); - - if (countEventBitsOut > 0) - { - sprintf(format, "%5.3f:1\n", countEventBitsIn / countEventBitsOut); - } - else - { - sprintf(format, "1:1\n"); - } - - strcat(buffer, format); - } - else - { - strcat(buffer, "N/A\n\n"); - } - - // - // Print transport data. - // - - getTimeStats(type, buffer); - - countAnyIn += protocolData -> cupsCount_; - countBitsIn += protocolData -> cupsBitsIn_; - countBitsOut += protocolData -> cupsBitsOut_; - - countAnyIn += protocolData -> smbCount_; - countBitsIn += protocolData -> smbBitsIn_; - countBitsOut += protocolData -> smbBitsOut_; - - countAnyIn += protocolData -> mediaCount_; - countBitsIn += protocolData -> mediaBitsIn_; - countBitsOut += protocolData -> mediaBitsOut_; - - countAnyIn += protocolData -> httpCount_; - countBitsIn += protocolData -> httpBitsIn_; - countBitsOut += protocolData -> httpBitsOut_; - - countAnyIn += protocolData -> fontCount_; - countBitsIn += protocolData -> fontBitsIn_; - countBitsOut += protocolData -> fontBitsOut_; - - countAnyIn += protocolData -> slaveCount_; - countBitsIn += protocolData -> slaveBitsIn_; - countBitsOut += protocolData -> slaveBitsOut_; - - // - // Save the overall amount of bytes - // coming from X clients. - // - - overallData -> overallBytesIn_ = countBitsIn / 8; - - // - // Print performance data. - // - - if (transportData -> readTime_ > 0) - { - sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", - countAnyIn / (transportData -> readTime_ / 1000), - (countBitsIn + transportData -> framingBitsOut_) / 8192 / - (transportData -> readTime_ / 1000)); - } - else - { - sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", - countAnyIn, (countBitsIn + transportData -> - framingBitsOut_) / 8192); - } - - strcat(buffer, format); - - strcat(buffer, "link: "); - - // - // ZLIB compression stats. - // - - getStreamStats(type, buffer); - - // - // Save the overall amount of bytes - // sent on NX proxy link. - // - - if (transportData -> compressedBytesOut_ > 0) - { - overallData -> overallBytesOut_ = transportData -> compressedBytesOut_; - } - else - { - overallData -> overallBytesOut_ = countBitsOut / 8; - } - - // - // Print info on multiplexing overhead. - // - - getFramingStats(type, buffer); - - // - // Print stats about additional channels. - // - - getServicesStats(type, buffer); - - // - // Compression summary. - // - - double ratio = 1; - - if (transportData -> compressedBytesOut_ / 1024 > 0) - { - ratio = ((countBitsIn + transportData -> framingBitsOut_) / 8192) / - (transportData -> compressedBytesOut_ / 1024); - - } - else if (countBitsOut > 0) - { - ratio = (countBitsIn + transportData -> framingBitsOut_) / - countBitsOut; - } - - sprintf(format, " Protocol compression ratio is %5.3f:1.\n\n", - ratio); - - strcat(buffer, format); - - getBitrateStats(type, buffer); - - // - // These are not included in output. - // - // getSplitStats(type, buffer); - // - - strcat(buffer, "\n"); - - // - // These statistics are not included in output. - // You can check it anyway to get the effective - // amount of bytes produced by unpack procedure. - // - // getClientOverallStats(type, buffer); - // - - return 1; -} - -int Statistics::getServerOverallStats(int type, char *&buffer) -{ - return 1; -} - -int Statistics::getTimeStats(int type, char *&buffer) -{ - struct T_transportData *transportData; - - if (type == PARTIAL_STATS) - { - transportData = &transportPartial_; - } - else - { - transportData = &transportTotal_; - } - - char format[FORMAT_LENGTH]; - - sprintf(format, "\ntime: %.0f Ms idle, %.0f Ms (%.0f Ms in read, %.0f Ms in write) running.\n\n", - transportData -> idleTime_, transportData -> readTime_, - transportData -> readTime_ - transportData -> writeTime_, - transportData -> writeTime_); - - strcat(buffer, format); - - return 1; -} - -int Statistics::getStreamStats(int type, char *&buffer) -{ - struct T_transportData *transportData; - - if (type == PARTIAL_STATS) - { - transportData = &transportPartial_; - } - else - { - transportData = &transportTotal_; - } - - char format[FORMAT_LENGTH]; - - if (transportData -> compressedBytesOut_ > 0) - { - sprintf(format, "%.0f bytes (%.0f KB) compressed to %.0f (%.0f KB).\n", - transportData -> compressedBytesIn_, transportData -> compressedBytesIn_ / 1024, - transportData -> compressedBytesOut_, transportData -> compressedBytesOut_ / 1024); - - strcat(buffer, format); - - sprintf(format, " %5.3f:1 stream compression ratio.\n\n", - transportData -> compressedBytesIn_ / transportData -> compressedBytesOut_); - - strcat(buffer, format); - } - - if (transportData -> decompressedBytesOut_ > 0) - { - if (transportData -> compressedBytesOut_ > 0) - { - strcat(buffer, " "); - } - - sprintf(format, "%.0f bytes (%.0f KB) decompressed to %.0f (%.0f KB).\n", - transportData -> decompressedBytesIn_, transportData -> decompressedBytesIn_ / 1024, - transportData -> decompressedBytesOut_, transportData -> decompressedBytesOut_ / 1024); - - strcat(buffer, format); - - sprintf(format, " %5.3f:1 stream compression ratio.\n\n", - transportData -> decompressedBytesOut_ / transportData -> decompressedBytesIn_); - - strcat(buffer, format); - } - - if (transportData -> compressedBytesOut_ > 0 || - transportData -> decompressedBytesOut_ > 0) - { - strcat(buffer, " "); - } - - return 1; -} - -int Statistics::getServicesStats(int type, char *&buffer) -{ - struct T_protocolData *protocolData; - - if (type == PARTIAL_STATS) - { - protocolData = &protocolPartial_; - } - else - { - protocolData = &protocolTotal_; - } - - char format[FORMAT_LENGTH]; - - if (protocolData -> cupsBitsOut_ > 0) - { - sprintf(format, " %.0f CUPS messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - protocolData -> cupsCount_ , protocolData -> cupsBitsIn_ / 8, - protocolData -> cupsBitsIn_ / 8192, protocolData -> cupsBitsOut_ / 8, - protocolData -> cupsBitsOut_ / 8192); - - strcat(buffer, format); - } - - if (protocolData -> smbBitsOut_ > 0) - { - sprintf(format, " %.0f SMB messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - protocolData -> smbCount_ , protocolData -> smbBitsIn_ / 8, - protocolData -> smbBitsIn_ / 8192, protocolData -> smbBitsOut_ / 8, - protocolData -> smbBitsOut_ / 8192); - - strcat(buffer, format); - } - - if (protocolData -> mediaBitsOut_ > 0) - { - sprintf(format, " %.0f multimedia messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - protocolData -> mediaCount_ , protocolData -> mediaBitsIn_ / 8, - protocolData -> mediaBitsIn_ / 8192, protocolData -> mediaBitsOut_ / 8, - protocolData -> mediaBitsOut_ / 8192); - - strcat(buffer, format); - } - - if (protocolData -> httpBitsOut_ > 0) - { - sprintf(format, " %.0f HTTP messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - protocolData -> httpCount_ , protocolData -> httpBitsIn_ / 8, - protocolData -> httpBitsIn_ / 8192, protocolData -> httpBitsOut_ / 8, - protocolData -> httpBitsOut_ / 8192); - - strcat(buffer, format); - } - - if (protocolData -> fontBitsOut_ > 0) - { - sprintf(format, " %.0f font server messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - protocolData -> fontCount_ , protocolData -> fontBitsIn_ / 8, - protocolData -> fontBitsIn_ / 8192, protocolData -> fontBitsOut_ / 8, - protocolData -> fontBitsOut_ / 8192); - - strcat(buffer, format); - } - - if (protocolData -> slaveBitsOut_ > 0) - { - sprintf(format, " %.0f slave messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", - protocolData -> slaveCount_ , protocolData -> slaveBitsIn_ / 8, - protocolData -> slaveBitsIn_ / 8192, protocolData -> slaveBitsOut_ / 8, - protocolData -> slaveBitsOut_ / 8192); - - strcat(buffer, format); - } - - return 1; -} - -int Statistics::getFramingStats(int type, char *&buffer) -{ - struct T_transportData *transportData; - - if (type == PARTIAL_STATS) - { - transportData = &transportPartial_; - } - else - { - transportData = &transportTotal_; - } - - char format[FORMAT_LENGTH]; - - // - // Print info on multiplexing overhead. - // - - sprintf(format, "%.0f frames in, %.0f frames out, %.0f writes out.\n\n", - transportData -> proxyFramesIn_, transportData -> proxyFramesOut_, - transportData -> proxyWritesOut_); - - strcat(buffer, format); - - sprintf(format, " %.0f bytes (%.0f KB) used for framing and multiplexing.\n\n", - transportData -> framingBitsOut_ / 8, transportData -> framingBitsOut_ / 8192); - - strcat(buffer, format); - - return 1; -} - -int Statistics::getBitrateStats(int type, char *&buffer) -{ - struct T_transportData *transportData; - struct T_overallData *overallData; - - if (type == PARTIAL_STATS) - { - transportData = &transportPartial_; - overallData = &overallPartial_; - } - else - { - transportData = &transportTotal_; - overallData = &overallTotal_; - } - - double total = 0; - - if (transportData -> idleTime_ + transportData -> readTime_ > 0) - { - total = overallData -> overallBytesOut_ / - ((transportData -> idleTime_ + transportData -> readTime_) / 1000); - } - - char format[FORMAT_LENGTH]; - - sprintf(format, " %.0f B/s average, %d B/s %ds, %d B/s %ds, %d B/s maximum.\n\n", - total, getBitrateInShortFrame(), control -> ShortBitrateTimeFrame / 1000, - getBitrateInLongFrame(), control -> LongBitrateTimeFrame / 1000, - getTopBitrate()); - - strcat(buffer, format); - - resetTopBitrate(); - - return 1; -} - -int Statistics::getSplitStats(int type, char *&buffer) -{ - // - // Don't print these statistics if persistent - // cache of images is disabled. - // - - if (control -> ImageCacheEnableLoad == 0 && - control -> ImageCacheEnableSave == 0) - { - return 0; - } - - struct T_splitData *splitData; - - if (type == PARTIAL_STATS) - { - splitData = &splitPartial_; - } - else - { - splitData = &splitTotal_; - } - - char format[FORMAT_LENGTH]; - - // - // Print info on split messages restored from disk. - // - - sprintf(format, " %.0f images streamed, %.0f restored, %.0f bytes (%.0f KB) cached.\n\n", - splitData -> splitCount_, splitData -> splitAborted_, splitData -> splitAbortedBytesOut_, - splitData -> splitAbortedBytesOut_ / 1024); - - strcat(buffer, format); - - return 1; -} diff --git a/nxcomp/Statistics.h b/nxcomp/Statistics.h deleted file mode 100644 index 1ffb6b5d6..000000000 --- a/nxcomp/Statistics.h +++ /dev/null @@ -1,745 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Statistics_H -#define Statistics_H - -#include "NXproto.h" - -#include "Misc.h" -#include "Timestamp.h" - -class Proxy; - -// -// Opcode 255 is for generic requests, 1 is for -// generic replies (those which haven't a speci- -// fic differential encoding), opcode 0 is for -// generic messages from the auxiliary channels. -// - -#define STATISTICS_OPCODE_MAX 256 - -// -// Maximum length of the buffer allocated for -// the statistics output. -// - -#define STATISTICS_LENGTH 16384 - -// -// Query type. -// - -#define TOTAL_STATS 1 -#define PARTIAL_STATS 2 -#define NO_STATS 3 - -// -// Log level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Log the operations related to updating -// the control tokens. -// - -#undef TOKEN - -class Statistics -{ - public: - - // - // Use the proxy class to get access - // to the message stores. - // - - Statistics(Proxy *proxy); - - ~Statistics(); - - void addIdleTime(unsigned int numMs) - { - transportPartial_.idleTime_ += numMs; - transportTotal_.idleTime_ += numMs; - } - - void subIdleTime(unsigned int numMs) - { - transportPartial_.idleTime_ -= numMs; - transportTotal_.idleTime_ -= numMs; - } - - void addReadTime(unsigned int numMs) - { - transportPartial_.readTime_ += numMs; - transportTotal_.readTime_ += numMs; - } - - void subReadTime(unsigned int numMs) - { - transportPartial_.readTime_ -= numMs; - transportTotal_.readTime_ -= numMs; - } - - void addWriteTime(unsigned int numMs) - { - transportPartial_.writeTime_ += numMs; - transportTotal_.writeTime_ += numMs; - } - - void subWriteTime(unsigned int numMs) - { - transportPartial_.writeTime_ -= numMs; - transportTotal_.writeTime_ -= numMs; - } - - void addBytesIn(unsigned int numBytes) - { - transportPartial_.proxyBytesIn_ += numBytes; - transportTotal_.proxyBytesIn_ += numBytes; - } - - double getBytesIn() - { - return transportTotal_.proxyBytesIn_; - } - - void addBytesOut(unsigned int numBytes) - { - transportPartial_.proxyBytesOut_ += numBytes; - transportTotal_.proxyBytesOut_ += numBytes; - } - - double getBytesOut() - { - return transportTotal_.proxyBytesOut_; - } - - void addFrameIn() - { - transportPartial_.proxyFramesIn_++; - transportTotal_.proxyFramesIn_++; - - #ifdef TEST - *logofs << "Statistics: Updated total proxy frames in to " - << transportTotal_.proxyFramesIn_ << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - } - - void addFrameOut() - { - transportPartial_.proxyFramesOut_++; - transportTotal_.proxyFramesOut_++; - - #ifdef TEST - *logofs << "Statistics: Updated total proxy frames out to " - << transportTotal_.proxyFramesOut_ << " at " - << strMsTimestamp() << ".\n" - << logofs_flush; - #endif - } - - void addWriteOut() - { - transportPartial_.proxyWritesOut_++; - transportTotal_.proxyWritesOut_++; - - #ifdef TEST - *logofs << "Statistics: Updated total proxy writes out to " - << transportTotal_.proxyWritesOut_ << " at " - << strMsTimestamp() << ".\n" << logofs_flush; - #endif - } - - void addCompressedBytes(unsigned int bytesIn, unsigned int bytesOut); - - void addDecompressedBytes(unsigned int bytesIn, unsigned int bytesOut) - { - transportPartial_.decompressedBytesIn_ += bytesIn; - transportTotal_.decompressedBytesIn_ += bytesIn; - - transportPartial_.decompressedBytesOut_ += bytesOut; - transportTotal_.decompressedBytesOut_ += bytesOut; - } - - void addFramingBits(unsigned int bitsOut) - { - transportPartial_.framingBitsOut_ += bitsOut; - transportTotal_.framingBitsOut_ += bitsOut; - - proxyData_.protocolCount_ += bitsOut; - } - - void addCachedRequest(unsigned int opcode) - { - protocolPartial_.requestCached_[opcode]++; - protocolTotal_.requestCached_[opcode]++; - } - - void addRenderCachedRequest(unsigned int opcode) - { - protocolPartial_.renderRequestCached_[opcode]++; - protocolTotal_.renderRequestCached_[opcode]++; - } - - void addRepliedRequest(unsigned int opcode) - { - protocolPartial_.requestReplied_[opcode]++; - protocolTotal_.requestReplied_[opcode]++; - } - - void addCachedReply(unsigned int opcode) - { - protocolPartial_.replyCached_[opcode]++; - protocolTotal_.replyCached_[opcode]++; - } - - void addRequestBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) - { - #ifdef DEBUG - *logofs << "Statistcs: Added " << bitsIn << " bits in and " - << bitsOut << " bits out to opcode " << opcode - << ".\n" << logofs_flush; - #endif - - protocolPartial_.requestCount_[opcode]++; - protocolTotal_.requestCount_[opcode]++; - - protocolPartial_.requestBitsIn_[opcode] += bitsIn; - protocolTotal_.requestBitsIn_[opcode] += bitsIn; - - protocolPartial_.requestBitsOut_[opcode] += bitsOut; - protocolTotal_.requestBitsOut_[opcode] += bitsOut; - - // - // Don't account the split bits - // to the control token. - // - - if (opcode != X_NXSplitData && opcode != X_NXSplitEvent) - { - proxyData_.protocolCount_ += bitsOut; - } - } - - void addRenderRequestBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) - { - #ifdef DEBUG - *logofs << "Statistcs: Added " << bitsIn << " bits in and " - << bitsOut << " bits out to render opcode " << opcode - << ".\n" << logofs_flush; - #endif - - protocolPartial_.renderRequestCount_[opcode]++; - protocolTotal_.renderRequestCount_[opcode]++; - - protocolPartial_.renderRequestBitsIn_[opcode] += bitsIn; - protocolTotal_.renderRequestBitsIn_[opcode] += bitsIn; - - protocolPartial_.renderRequestBitsOut_[opcode] += bitsOut; - protocolTotal_.renderRequestBitsOut_[opcode] += bitsOut; - } - - void addReplyBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.replyCount_[opcode]++; - protocolTotal_.replyCount_[opcode]++; - - protocolPartial_.replyBitsIn_[opcode] += bitsIn; - protocolTotal_.replyBitsIn_[opcode] += bitsIn; - - protocolPartial_.replyBitsOut_[opcode] += bitsOut; - protocolTotal_.replyBitsOut_[opcode] += bitsOut; - - proxyData_.protocolCount_ += bitsOut; - } - - void addEventBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.eventCount_[opcode]++; - protocolTotal_.eventCount_[opcode]++; - - protocolPartial_.eventBitsIn_[opcode] += bitsIn; - protocolTotal_.eventBitsIn_[opcode] += bitsIn; - - protocolPartial_.eventBitsOut_[opcode] += bitsOut; - protocolTotal_.eventBitsOut_[opcode] += bitsOut; - - proxyData_.protocolCount_ += bitsOut; - } - - void addCupsBits(unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.cupsCount_++; - protocolTotal_.cupsCount_++; - - protocolPartial_.cupsBitsIn_ += bitsIn; - protocolTotal_.cupsBitsIn_ += bitsIn; - - protocolPartial_.cupsBitsOut_ += bitsOut; - protocolTotal_.cupsBitsOut_ += bitsOut; - } - - void addSmbBits(unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.smbCount_++; - protocolTotal_.smbCount_++; - - protocolPartial_.smbBitsIn_ += bitsIn; - protocolTotal_.smbBitsIn_ += bitsIn; - - protocolPartial_.smbBitsOut_ += bitsOut; - protocolTotal_.smbBitsOut_ += bitsOut; - } - - void addMediaBits(unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.mediaCount_++; - protocolTotal_.mediaCount_++; - - protocolPartial_.mediaBitsIn_ += bitsIn; - protocolTotal_.mediaBitsIn_ += bitsIn; - - protocolPartial_.mediaBitsOut_ += bitsOut; - protocolTotal_.mediaBitsOut_ += bitsOut; - } - - void addHttpBits(unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.httpCount_++; - protocolTotal_.httpCount_++; - - protocolPartial_.httpBitsIn_ += bitsIn; - protocolTotal_.httpBitsIn_ += bitsIn; - - protocolPartial_.httpBitsOut_ += bitsOut; - protocolTotal_.httpBitsOut_ += bitsOut; - } - - void addFontBits(unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.fontCount_++; - protocolTotal_.fontCount_++; - - protocolPartial_.fontBitsIn_ += bitsIn; - protocolTotal_.fontBitsIn_ += bitsIn; - - protocolPartial_.fontBitsOut_ += bitsOut; - protocolTotal_.fontBitsOut_ += bitsOut; - } - - void addSlaveBits(unsigned int bitsIn, unsigned int bitsOut) - { - protocolPartial_.slaveCount_++; - protocolTotal_.slaveCount_++; - - protocolPartial_.slaveBitsIn_ += bitsIn; - protocolTotal_.slaveBitsIn_ += bitsIn; - - protocolPartial_.slaveBitsOut_ += bitsOut; - protocolTotal_.slaveBitsOut_ += bitsOut; - } - - void addPackedBytesIn(unsigned int numBytes) - { - packedPartial_.packedBytesIn_ += numBytes; - packedTotal_.packedBytesIn_ += numBytes; - } - - void addPackedBytesOut(unsigned int numBytes) - { - packedPartial_.packedBytesOut_ += numBytes; - packedTotal_.packedBytesOut_ += numBytes; - } - - void addSplit() - { - splitPartial_.splitCount_++; - splitTotal_.splitCount_++; - } - - void addSplitAborted() - { - splitPartial_.splitAborted_++; - splitTotal_.splitAborted_++; - } - - void addSplitAbortedBytesOut(unsigned int numBytes) - { - splitPartial_.splitAbortedBytesOut_ += numBytes; - splitTotal_.splitAbortedBytesOut_ += numBytes; - } - - // - // Add the recorded protocol data to the proxy - // token counters. We want to send bpth the token - // request message and the data payload using a - // single system write, so we must guess how many - // output bytes we will generate. - // - - void updateControlToken(int &count) - { - // - // Total is the total number of protocol bytes - // generated so far. We have saved the number - // of bytes generated the last time the function - // was called so we can calculate the difference. - // - // The number of protocol bits is updated as soon - // as new bits are accumulated, to avoid summing - // up all the opcodes in this routine. We add a - // byte to the control bytes difference to account - // for the framing bits that are very likely to - // be added to the payload. - // - - double total = proxyData_.protocolCount_ / 8; - - double diff = total - proxyData_.controlCount_ + 1; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Protocol bytes are " - << total << " control bytes are " - << proxyData_.controlCount_ << " difference is " - << diff << ".\n" << logofs_flush; - #endif - - count += (int) (diff / proxyData_.streamRatio_); - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Adding " - << (int) (diff / proxyData_.streamRatio_) - << " bytes to the control token with ratio " - << proxyData_.streamRatio_ << ".\n" - << logofs_flush; - #endif - - proxyData_.controlCount_ = total; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! New control token has " - << count << " bytes with total control bytes " - << proxyData_.controlCount_ << ".\n" - << logofs_flush; - #endif - } - - void updateSplitToken(int &count) - { - double total = (protocolTotal_.requestBitsOut_[X_NXSplitData] + - protocolTotal_.eventBitsOut_[X_NXSplitEvent]) / 8; - - double diff = total - proxyData_.splitCount_; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Protocol bytes are " - << total << " split bytes are " - << proxyData_.splitCount_ << " difference is " - << diff << ".\n" << logofs_flush; - #endif - - count += (int) (diff / proxyData_.streamRatio_); - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Adding " - << (int) (diff / proxyData_.streamRatio_) - << " bytes to the split token with ratio " - << proxyData_.streamRatio_ << ".\n" - << logofs_flush; - #endif - - proxyData_.splitCount_ = total; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! New split token has " - << count << " bytes with total split bytes " - << proxyData_.splitCount_ << ".\n" - << logofs_flush; - #endif - } - - void updateDataToken(int &count) - { - double total = (protocolTotal_.cupsBitsOut_ + - protocolTotal_.smbBitsOut_ + - protocolTotal_.mediaBitsOut_ + - protocolTotal_.httpBitsOut_ + - protocolTotal_.fontBitsOut_ + - protocolTotal_.slaveBitsOut_) / 8; - - double diff = total - proxyData_.dataCount_; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Protocol bytes are " - << total << " data bytes are " - << proxyData_.dataCount_ << " difference is " - << diff << ".\n" << logofs_flush; - #endif - - count += (int) (diff / proxyData_.streamRatio_); - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! Adding " - << (int) (diff / proxyData_.streamRatio_) - << " bytes to the data token with ratio " - << proxyData_.streamRatio_ << ".\n" - << logofs_flush; - #endif - - proxyData_.dataCount_ = total; - - #if defined(TEST) || defined(TOKEN) - *logofs << "Statistics: TOKEN! New data token has " - << count << " bytes with total data bytes " - << proxyData_.dataCount_ << ".\n" - << logofs_flush; - #endif - } - - // - // Update the current bitrate. - // - - void updateBitrate(int bytes); - - // - // Return the current bitrate. - // - - int getBitrateInShortFrame() - { - return bitrateInShortFrame_; - } - - int getBitrateInLongFrame() - { - return bitrateInLongFrame_; - } - - int getTopBitrate() - { - return topBitrate_; - } - - void resetTopBitrate() - { - topBitrate_ = 0; - } - - double getStreamRatio() - { - return proxyData_.streamRatio_; - } - - // - // Manage the congestion level. - // - - void updateCongestion(int remaining, int limit); - - double getCongestionInFrame() - { - return congestionInFrame_; - } - - // - // Produce a dump of the statistics on - // the provided buffer. - // - - int getClientCacheStats(int type, char *&buffer); - int getClientProtocolStats(int type, char *&buffer); - int getClientOverallStats(int type, char *&buffer); - - int getServerCacheStats(int type, char *&buffer); - int getServerProtocolStats(int type, char *&buffer); - int getServerOverallStats(int type, char *&buffer); - - int resetPartialStats(); - - private: - - int getTimeStats(int type, char *&buffer); - int getServicesStats(int type, char *&buffer); - int getFramingStats(int type, char *&buffer); - int getBitrateStats(int type, char *&buffer); - int getStreamStats(int type, char *&buffer); - int getSplitStats(int type, char *&buffer); - - struct T_protocolData - { - double requestCached_[STATISTICS_OPCODE_MAX]; - double requestReplied_[STATISTICS_OPCODE_MAX]; - double requestCount_[STATISTICS_OPCODE_MAX]; - double requestBitsIn_[STATISTICS_OPCODE_MAX]; - double requestBitsOut_[STATISTICS_OPCODE_MAX]; - - double renderRequestCached_[STATISTICS_OPCODE_MAX]; - double renderRequestCount_[STATISTICS_OPCODE_MAX]; - double renderRequestBitsIn_[STATISTICS_OPCODE_MAX]; - double renderRequestBitsOut_[STATISTICS_OPCODE_MAX]; - - double replyCached_[STATISTICS_OPCODE_MAX]; - double replyCount_[STATISTICS_OPCODE_MAX]; - double replyBitsIn_[STATISTICS_OPCODE_MAX]; - double replyBitsOut_[STATISTICS_OPCODE_MAX]; - - double eventCached_[STATISTICS_OPCODE_MAX]; - double eventCount_[STATISTICS_OPCODE_MAX]; - double eventBitsIn_[STATISTICS_OPCODE_MAX]; - double eventBitsOut_[STATISTICS_OPCODE_MAX]; - - double cupsCount_; - double cupsBitsIn_; - double cupsBitsOut_; - - double smbCount_; - double smbBitsIn_; - double smbBitsOut_; - - double mediaCount_; - double mediaBitsIn_; - double mediaBitsOut_; - - double httpCount_; - double httpBitsIn_; - double httpBitsOut_; - - double fontCount_; - double fontBitsIn_; - double fontBitsOut_; - - double slaveCount_; - double slaveBitsIn_; - double slaveBitsOut_; - }; - - struct T_transportData - { - double idleTime_; - double readTime_; - double writeTime_; - - double proxyBytesIn_; - double proxyBytesOut_; - - double proxyFramesIn_; - double proxyFramesOut_; - double proxyWritesOut_; - - double compressedBytesIn_; - double compressedBytesOut_; - - double decompressedBytesIn_; - double decompressedBytesOut_; - - double framingBitsOut_; - }; - - struct T_packedData - { - double packedBytesIn_; - double packedBytesOut_; - }; - - struct T_splitData - { - double splitCount_; - double splitAborted_; - double splitAbortedBytesOut_; - }; - - struct T_overallData - { - double overallBytesIn_; - double overallBytesOut_; - }; - - struct T_proxyData - { - double protocolCount_; - double controlCount_; - double splitCount_; - double dataCount_; - - double streamRatio_; - }; - - T_protocolData protocolPartial_; - T_protocolData protocolTotal_; - - T_transportData transportPartial_; - T_transportData transportTotal_; - - T_packedData packedPartial_; - T_packedData packedTotal_; - - T_splitData splitPartial_; - T_splitData splitTotal_; - - T_overallData overallPartial_; - T_overallData overallTotal_; - - T_proxyData proxyData_; - - // - // Used to calculate the bandwidth usage - // of the proxy link. - // - - T_timestamp startShortFrameTs_; - T_timestamp startLongFrameTs_; - T_timestamp startFrameTs_; - - int bytesInShortFrame_; - int bytesInLongFrame_; - - int bitrateInShortFrame_; - int bitrateInLongFrame_; - - int topBitrate_; - - double congestionInFrame_; - - // - // Need the proxy pointer to print the - // statistics related to the client and - // server stores and to add the protocol - // data to the proxy token accumulators. - // - - Proxy *proxy_; -}; - -#endif /* Statistics_H */ diff --git a/nxcomp/Timestamp.cpp b/nxcomp/Timestamp.cpp deleted file mode 100644 index d5b3d613b..000000000 --- a/nxcomp/Timestamp.cpp +++ /dev/null @@ -1,73 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Timestamp.h" - -// -// Log level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Last timestamp taken from the system. -// - -T_timestamp timestamp; - -// -// The following functions all use the ctime -// static buffer from the C library. -// - -char *strTimestamp(const T_timestamp &ts) -{ - char *ctime_now = ctime((time_t *) &ts.tv_sec); - - ctime_now[24] = '\0'; - - return ctime_now; -} - -// -// This is especially dirty. -// - -char *strMsTimestamp(const T_timestamp &ts) -{ - char *ctime_now = ctime((time_t *) &ts.tv_sec); - - char ctime_new[25]; - - sprintf(ctime_new, "%.8s:%3.3f", ctime_now + 11, - (float) ts.tv_usec / 1000); - - strncpy(ctime_now, ctime_new, 24); - - return ctime_now; -} diff --git a/nxcomp/Timestamp.h b/nxcomp/Timestamp.h deleted file mode 100644 index 604f5a3bc..000000000 --- a/nxcomp/Timestamp.h +++ /dev/null @@ -1,307 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Timestamp_H -#define Timestamp_H - -#include -#include -#include - -#include -#include - -#include "Misc.h" - -// -// Log level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// If not defined, always query the system time. -// - -#undef CACHE_TIMESTAMP - -// -// Log a warning if the time difference since -// the last update exceeds the given number -// of milliseconds. -// - -#define DRIFT_TIMESTAMP 1 - -// -// Type used for timeout manipulation. -// - -typedef struct timeval T_timestamp; - -// -// Last timestamp taken from the system. If the -// timestamp is cached, we need to explicitly -// get a new timestamp after any operation that -// may have required a relevant amount of time. -// - -extern T_timestamp timestamp; - -// -// Get a timestamp instance with values set -// at the given amount of milliseconds. -// - -inline T_timestamp getTimestamp(long ms) -{ - struct timeval ts; - - ts.tv_sec = ms / 1000; - ts.tv_usec = (ms % 1000) * 1000; - - return ts; -} - -// -// Return the difference in milliseconds -// between the two timestamps. -// - -inline long diffTimestamp(const T_timestamp &ts1, const T_timestamp &ts2) -{ - // - // Add 500 microseconds to round up - // to the nearest millisecond. - // - - return ((ts2.tv_sec * 1000 + (ts2.tv_usec + 500) / 1000) - - (ts1.tv_sec * 1000 + (ts1.tv_usec + 500) / 1000)); -} - -// -// The same in microseconds. It doesn't -// round the value. -// - -inline long diffUsTimestamp(const T_timestamp &ts1, const T_timestamp &ts2) -{ - return ((ts2.tv_sec * 1000000 + ts2.tv_usec) - - (ts1.tv_sec * 1000000 + ts1.tv_usec)); -} - -// -// Return the last timestamp taken from the -// system. It doesn't update the timestamp. -// - -inline T_timestamp getTimestamp() -{ - #ifdef CACHE_TIMESTAMP - - #ifdef TEST - - T_timestamp ts; - - gettimeofday(&ts, NULL); - - long diffTs = diffTimestamp(timestamp, ts); - - if (diffTs > DRIFT_TIMESTAMP) - { - *logofs << "Timestamp: WARNING! Time difference since the " - << "current timestamp is " << diffTs << " Ms.\n" - << logofs_flush; - } - - #endif - - return timestamp; - - #else - - gettimeofday(×tamp, NULL); - - return timestamp; - - #endif -} - -inline T_timestamp &setTimestamp(T_timestamp &ts, long ms) -{ - ts.tv_sec = ms / 1000; - ts.tv_usec = (ms % 1000) * 1000; - - return ts; -} - -// -// Return the smaller between two timestamps. -// - -inline T_timestamp &setMinTimestamp(T_timestamp &ts, long ms) -{ - if ((ts.tv_sec * 1000 + ts.tv_usec / 1000) > ms) - { - ts.tv_sec = ms / 1000; - ts.tv_usec = (ms % 1000) * 1000; - } - - return ts; -} - -inline T_timestamp &setMinTimestamp(T_timestamp &ts1, T_timestamp &ts2) -{ - if ((ts1.tv_sec * 1000000 + ts1.tv_usec) > - (ts2.tv_sec * 1000000 + ts2.tv_usec)) - { - ts1.tv_sec = ts2.tv_sec; - ts1.tv_usec = ts2.tv_usec; - } - - return ts1; -} - -// -// Convert a timestamp in the total number -// of milliseconds. -// - -inline long getMsTimestamp(const T_timestamp &ts) -{ - return ts.tv_sec * 1000 + ts.tv_usec / 1000; -} - -// -// A 0 value on both seconds and microseconds -// fields means that timestamp is invalid or -// not set. -// - -inline T_timestamp nullTimestamp() -{ - struct timeval ts; - - ts.tv_sec = 0; - ts.tv_usec = 0; - - return ts; -} - -inline bool isTimestamp(const T_timestamp &ts) -{ - if (ts.tv_sec == 0 && ts.tv_usec == 0) - { - return 0; - } - - return 1; -} - -inline void subMsTimestamp(T_timestamp &ts, long ms) -{ - ts.tv_sec -= ms / 1000; - ts.tv_usec -= (ms % 1000) * 1000; -} - -inline void addMsTimestamp(T_timestamp &ts, long ms) -{ - ts.tv_sec += ms / 1000; - ts.tv_usec += (ms % 1000) * 1000; -} - -// -// Check the difference between timestamps. -// Return 0 if the system time went backward -// compared to the second timestamp, or the -// difference between the timestamps exceeds -// the given number of milliseconds. -// - -inline int checkDiffTimestamp(const T_timestamp &ts1, const T_timestamp &ts2, - long ms = 30000) -{ - long diffTs = diffTimestamp(ts1, ts2); - - if (diffTs < 0 || diffTs > ms) - { - return 0; - } - - return 1; -} - -// -// Return a string representing the timestamp. -// - -char *strTimestamp(const T_timestamp &ts); -char *strMsTimestamp(const T_timestamp &ts); - -inline char *strTimestamp() -{ - return strTimestamp(getTimestamp()); -} - -inline char *strMsTimestamp() -{ - return strMsTimestamp(getTimestamp()); -} - -// -// Update the current timestamp. -// - -inline T_timestamp getNewTimestamp() -{ - #ifdef TEST - - T_timestamp ts; - - gettimeofday(&ts, NULL); - - *logofs << "Timestamp: Updating the current timestamp at " - << strMsTimestamp(ts) << ".\n" << logofs_flush; - - long diffTs = diffTimestamp(timestamp, ts); - - if (diffTs > DRIFT_TIMESTAMP) - { - *logofs << "Timestamp: WARNING! Time difference since the " - << "old timestamp is " << diffTs << " Ms.\n" - << logofs_flush; - } - - #endif - - gettimeofday(×tamp, NULL); - - return timestamp; -} - -#endif /* Timestamp_H */ diff --git a/nxcomp/TranslateCoords.cpp b/nxcomp/TranslateCoords.cpp deleted file mode 100644 index 97bd285e1..000000000 --- a/nxcomp/TranslateCoords.cpp +++ /dev/null @@ -1,111 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "TranslateCoords.h" - -#include "ClientCache.h" - -#include "EncodeBuffer.h" -#include "DecodeBuffer.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Here are the methods to handle messages' content. -// - -int TranslateCoordsStore::parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; - - // - // Here is the fingerprint. - // - - translateCoords -> src_window = GetULONG(buffer + 4, bigEndian); - translateCoords -> dst_window = GetULONG(buffer + 8, bigEndian); - - translateCoords -> src_x = GetUINT(buffer + 12, bigEndian); - translateCoords -> src_y = GetUINT(buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -int TranslateCoordsStore::unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; - - // - // Fill all the message's fields. - // - - PutULONG(translateCoords -> src_window, buffer + 4, bigEndian); - PutULONG(translateCoords -> dst_window, buffer + 8, bigEndian); - - PutUINT(translateCoords -> src_x, buffer + 12, bigEndian); - PutUINT(translateCoords -> src_y, buffer + 14, bigEndian); - - #ifdef DEBUG - *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; - #endif - - return 1; -} - -void TranslateCoordsStore::dumpIdentity(const Message *message) const -{ - #ifdef DUMP - - TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; - - *logofs << name() << ": Identity src_window " << translateCoords -> src_window << ", dst_window " - << translateCoords -> dst_window << ", src_x " << translateCoords -> src_x << ", src_y " - << translateCoords -> src_y << ", size " << translateCoords -> size_ << ".\n" << logofs_flush; - - #endif -} - -void TranslateCoordsStore::identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const -{ - md5_append(md5_state_, buffer + 4, 4); - md5_append(md5_state_, buffer + 8, 4); - md5_append(md5_state_, buffer + 12, 2); - md5_append(md5_state_, buffer + 14, 2); -} diff --git a/nxcomp/TranslateCoords.h b/nxcomp/TranslateCoords.h deleted file mode 100644 index 997d079e1..000000000 --- a/nxcomp/TranslateCoords.h +++ /dev/null @@ -1,185 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef TranslateCoords_H -#define TranslateCoords_H - -#include "Message.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef DUMP - -// -// Set default values. -// - -#define TRANSLATECOORDS_ENABLE_CACHE 1 -#define TRANSLATECOORDS_ENABLE_DATA 0 -#define TRANSLATECOORDS_ENABLE_SPLIT 0 -#define TRANSLATECOORDS_ENABLE_COMPRESS 0 - -#define TRANSLATECOORDS_DATA_LIMIT 0 -#define TRANSLATECOORDS_DATA_OFFSET 16 - -#define TRANSLATECOORDS_CACHE_SLOTS 3000 -#define TRANSLATECOORDS_CACHE_THRESHOLD 3 -#define TRANSLATECOORDS_CACHE_LOWER_THRESHOLD 1 - -// -// The message class. -// - -class TranslateCoordsMessage : public Message -{ - friend class TranslateCoordsStore; - - public: - - TranslateCoordsMessage() - { - } - - ~TranslateCoordsMessage() - { - } - - // - // Put here the fields which constitute - // the 'identity' part of the message. - // - - private: - - unsigned int src_window; - unsigned int dst_window; - unsigned int src_x; - unsigned int src_y; - - unsigned char r_same_screen; - unsigned int r_child_window; - unsigned int r_dst_x; - unsigned int r_dst_y; -}; - -class TranslateCoordsStore : public MessageStore -{ - // - // Constructors and destructors. - // - - public: - - TranslateCoordsStore() : MessageStore() - { - enableCache = TRANSLATECOORDS_ENABLE_CACHE; - enableData = TRANSLATECOORDS_ENABLE_DATA; - enableSplit = TRANSLATECOORDS_ENABLE_SPLIT; - enableCompress = TRANSLATECOORDS_ENABLE_COMPRESS; - - dataLimit = TRANSLATECOORDS_DATA_LIMIT; - dataOffset = TRANSLATECOORDS_DATA_OFFSET; - - cacheSlots = TRANSLATECOORDS_CACHE_SLOTS; - cacheThreshold = TRANSLATECOORDS_CACHE_THRESHOLD; - cacheLowerThreshold = TRANSLATECOORDS_CACHE_LOWER_THRESHOLD; - - messages_ -> resize(cacheSlots); - - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - *i = NULL; - } - - temporary_ = NULL; - } - - virtual ~TranslateCoordsStore() - { - for (T_messages::iterator i = messages_ -> begin(); - i < messages_ -> end(); i++) - { - destroy(*i); - } - - destroy(temporary_); - } - - virtual const char *name() const - { - return "TranslateCoords"; - } - - virtual unsigned char opcode() const - { - return X_TranslateCoords; - } - - virtual unsigned int storage() const - { - return sizeof(TranslateCoordsMessage); - } - - // - // Message handling methods. - // - - public: - - virtual Message *create() const - { - return new TranslateCoordsMessage(); - } - - virtual Message *create(const Message &message) const - { - return new TranslateCoordsMessage((const TranslateCoordsMessage &) message); - } - - virtual void destroy(Message *message) const - { - delete (TranslateCoordsMessage *) message; - } - - virtual int parseIdentity(Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual int unparseIdentity(const Message *message, unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void identityChecksum(const Message *message, const unsigned char *buffer, - unsigned int size, int bigEndian) const; - - virtual void dumpIdentity(const Message *message) const; -}; - -#endif /* TranslateCoords_H */ diff --git a/nxcomp/Transport.cpp b/nxcomp/Transport.cpp deleted file mode 100644 index eaf9775af..000000000 --- a/nxcomp/Transport.cpp +++ /dev/null @@ -1,3064 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include -#include - -#include "Transport.h" - -#include "Statistics.h" - -// -// Set the verbosity level. You also -// need to define DUMP in Misc.cpp -// if DUMP is defined here. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG -#undef INSPECT -#undef DUMP - -// -// Used to lock and unlock the transport -// buffers before they are accessed by -// different threads. -// - -#undef THREADS - -// -// Define this to get logging all the -// operations performed by the parent -// thread, the one that enqueues and -// dequeues data. -// - -#define PARENT - -// -// Define this to know when a channel -// is created or destroyed. -// - -#undef REFERENCES - -// -// Reference count for allocated buffers. -// - -#ifdef REFERENCES - -int Transport::references_; -int ProxyTransport::references_; -int InternalTransport::references_; - -#endif - -// -// This is the base class providing methods for read -// and write buffering. -// - -Transport::Transport(int fd) : fd_(fd) -{ - #ifdef TEST - *logofs << "Transport: Going to create base transport " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - type_ = transport_base; - - // - // Set up the write buffer. - // - - w_buffer_.length_ = 0; - w_buffer_.start_ = 0; - - initialSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE; - thresholdSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE << 1; - maximumSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE << 4; - - w_buffer_.data_.resize(initialSize_); - - // - // Set non-blocking IO on socket. - // - - SetNonBlocking(fd_, 1); - - blocked_ = 0; - finish_ = 0; - - #ifdef REFERENCES - *logofs << "Transport: Created new object at " - << this << " out of " << ++references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -Transport::~Transport() -{ - #ifdef TEST - *logofs << "Transport: Going to destroy base class " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - ::close(fd_); - - #ifdef REFERENCES - *logofs << "Transport: Deleted object at " - << this << " out of " << --references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -// -// Read data from its file descriptor. -// - -int Transport::read(unsigned char *data, unsigned int size) -{ - #ifdef DEBUG - *logofs << "Transport: Going to read " << size << " bytes from " - << "FD#" << fd_ << ".\n" << logofs_flush; - #endif - - // - // Read the available data from the socket. - // - - int result = ::read(fd_, data, size); - - // - // Update the current timestamp as the read - // can have scheduled some other process. - // - - getNewTimestamp(); - - if (result < 0) - { - if (EGET() == EAGAIN) - { - #ifdef TEST - *logofs << "Transport: WARNING! Read of " << size << " bytes from " - << "FD#" << fd_ << " would block.\n" << logofs_flush; - #endif - - return 0; - } - else if (EGET() == EINTR) - { - #ifdef TEST - *logofs << "Transport: Read of " << size << " bytes from " - << "FD#" << fd_ << " was interrupted.\n" - << logofs_flush; - #endif - - return 0; - } - else - { - #ifdef TEST - *logofs << "Transport: Error reading from " - << "FD#" << fd_ << ".\n" << logofs_flush; - #endif - - finish(); - - return -1; - } - } - else if (result == 0) - { - #ifdef TEST - *logofs << "Transport: No data read from " - << "FD#" << fd_ << ".\n" << logofs_flush; - #endif - - finish(); - - return -1; - } - - #ifdef TEST - *logofs << "Transport: Read " << result << " bytes out of " - << size << " from FD#" << fd_ << ".\n" << logofs_flush; - #endif - - #ifdef DUMP - - *logofs << "Transport: Dumping content of read data.\n" - << logofs_flush; - - DumpData(data, result); - - #endif - - return result; -} - -// -// Write as many bytes as possible to socket. -// Append the remaining data bytes to the end -// of the buffer and update length to reflect -// changes. -// - -int Transport::write(T_write type, const unsigned char *data, const unsigned int size) -{ - // - // If an immediate write was requested then - // flush the enqueued data first. - // - // Alternatively may try to write only if - // the socket is not blocked. - // - // if (w_buffer_.length_ > 0 && blocked_ == 0 && - // type == write_immediate) - // { - // ... - // } - // - - if (w_buffer_.length_ > 0 && type == write_immediate) - - { - #ifdef TEST - *logofs << "Transport: Writing " << w_buffer_.length_ - << " bytes of previous data to FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - int result = Transport::flush(); - - if (result < 0) - { - return -1; - } - } - - // - // If nothing is remained, write immediately - // to the socket. - // - - unsigned int written = 0; - - if (w_buffer_.length_ == 0 && blocked_ == 0 && - type == write_immediate) - { - // - // Limit the amount of data sent. - // - - unsigned int toWrite = size; - - #ifdef DUMP - - *logofs << "Transport: Going to write " << toWrite - << " bytes to FD#" << fd_ << " with checksum "; - - DumpChecksum(data, size); - - *logofs << ".\n" << logofs_flush; - - #endif - - T_timestamp writeTs; - - int diffTs; - - while (written < toWrite) - { - // - // Trace system time spent writing data. - // - - writeTs = getTimestamp(); - - int result = ::write(fd_, data + written, toWrite - written); - - diffTs = diffTimestamp(writeTs, getNewTimestamp()); - - statistics -> addWriteTime(diffTs); - - if (result <= 0) - { - if (EGET() == EAGAIN) - { - #ifdef TEST - *logofs << "Transport: Write of " << toWrite - written - << " bytes on FD#" << fd_ << " would block.\n" - << logofs_flush; - #endif - - blocked_ = 1; - - break; - } - else if (EGET() == EINTR) - { - #ifdef TEST - *logofs << "Transport: Write of " << toWrite - written - << " bytes on FD#" << fd_ << " was interrupted.\n" - << logofs_flush; - #endif - - continue; - } - else - { - #ifdef TEST - *logofs << "Transport: Write to " << "FD#" - << fd_ << " failed.\n" << logofs_flush; - #endif - - finish(); - - return -1; - } - } - else - { - #ifdef TEST - *logofs << "Transport: Immediately written " << result - << " bytes on " << "FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - written += result; - } - } - - #ifdef DUMP - - if (written > 0) - { - *logofs << "Transport: Dumping content of immediately written data.\n" - << logofs_flush; - - DumpData(data, written); - } - - #endif - } - - if (written == size) - { - // - // We will not affect the write buffer. - // - - return written; - } - - #ifdef DEBUG - *logofs << "Transport: Going to append " << size - written - << " bytes to write buffer for " << "FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - if (resize(w_buffer_, size - written) < 0) - { - return -1; - } - - memmove(w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_, - data + written, size - written); - - w_buffer_.length_ += size - written; - - #ifdef TEST - *logofs << "Transport: Write buffer for FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "Transport: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " size is " - << w_buffer_.data_.size() << " capacity is " - << w_buffer_.data_.capacity() << ".\n" - << logofs_flush; - #endif - - // - // Note that this function always returns the whole - // size of buffer that was provided, either if not - // all the data could be actually written. - // - - return size; -} - -// -// Write pending data to its file descriptor. -// - -int Transport::flush() -{ - if (w_buffer_.length_ == 0) - { - #ifdef TEST - *logofs << "Transport: No data to flush on " - << "FD#" << fd_ << ".\n" << logofs_flush; - #endif - - #ifdef WARNING - if (blocked_ != 0) - { - *logofs << "Transport: Blocked flag is " << blocked_ - << " with no data to flush on FD#" << fd_ - << ".\n" << logofs_flush; - } - #endif - - return 0; - } - - // - // It's time to move data from the - // write buffer to the real link. - // - - int written = 0; - - int toWrite = w_buffer_.length_; - - // - // We will do our best to write any available - // data to the socket, so let's say we start - // from a clean state. - // - - blocked_ = 0; - - #ifdef TEST - *logofs << "Transport: Going to flush " << toWrite - << " bytes on FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - T_timestamp writeTs; - - int diffTs; - - while (written < toWrite) - { - writeTs = getTimestamp(); - - int result = ::write(fd_, w_buffer_.data_.begin() + w_buffer_.start_ + - written, toWrite - written); - - diffTs = diffTimestamp(writeTs, getNewTimestamp()); - - statistics -> addWriteTime(diffTs); - - if (result <= 0) - { - if (EGET() == EAGAIN) - { - #ifdef TEST - *logofs << "Transport: Write of " << toWrite - written - << " bytes on FD#" << fd_ << " would block.\n" - << logofs_flush; - #endif - - blocked_ = 1; - - break; - } - else if (EGET() == EINTR) - { - #ifdef TEST - *logofs << "Transport: Write of " << toWrite - written - << " bytes on FD#" << fd_ << " was interrupted.\n" - << logofs_flush; - #endif - - continue; - } - else - { - #ifdef TEST - *logofs << "Transport: Write to " << "FD#" - << fd_ << " failed.\n" << logofs_flush; - #endif - - finish(); - - return -1; - } - } - else - { - #ifdef TEST - *logofs << "Transport: Flushed " << result << " bytes on " - << "FD#" << fd_ << ".\n" << logofs_flush; - #endif - - written += result; - } - } - - if (written > 0) - { - #ifdef DUMP - - *logofs << "Transport: Dumping content of flushed data.\n" - << logofs_flush; - - DumpData(w_buffer_.data_.begin() + w_buffer_.start_, written); - - #endif - - // - // Update the buffer status. - // - - w_buffer_.length_ -= written; - - if (w_buffer_.length_ == 0) - { - w_buffer_.start_ = 0; - } - else - { - w_buffer_.start_ += written; - } - } - - // - // It can be that we wrote less bytes than - // available because of the write limit. - // - - if (w_buffer_.length_ > 0) - { - #ifdef TEST - *logofs << "Transport: There are still " << w_buffer_.length_ - << " bytes in write buffer for " << "FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - blocked_ = 1; - } - - #ifdef TEST - *logofs << "Transport: Write buffer for FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "Transport: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " size is " - << w_buffer_.data_.size() << " capacity is " - << w_buffer_.data_.capacity() << ".\n" - << logofs_flush; - #endif - - // - // No new data was produced for the link except - // any outstanding data from previous writes. - // - - return 0; -} - -int Transport::drain(int limit, int timeout) -{ - if (w_buffer_.length_ <= limit) - { - return 1; - } - - // - // Write the data accumulated in the write - // buffer until it is below the limit or - // the timeout is elapsed. - // - - int toWrite = w_buffer_.length_; - - int written = 0; - - #ifdef TEST - *logofs << "Transport: Draining " << toWrite - limit - << " bytes on FD#" << fd_ << " with limit set to " - << limit << ".\n" << logofs_flush; - #endif - - T_timestamp startTs = getNewTimestamp(); - - T_timestamp selectTs; - T_timestamp writeTs; - T_timestamp idleTs; - - T_timestamp nowTs = startTs; - - int diffTs; - - fd_set writeSet; - fd_set readSet; - - FD_ZERO(&writeSet); - FD_ZERO(&readSet); - - int result; - int ready; - - while (w_buffer_.length_ - written > limit) - { - nowTs = getNewTimestamp(); - - // - // Wait for descriptor to become - // readable or writable. - // - - FD_SET(fd_, &writeSet); - FD_SET(fd_, &readSet); - - setTimestamp(selectTs, timeout / 2); - - idleTs = nowTs; - - result = select(fd_ + 1, &readSet, &writeSet, NULL, &selectTs); - - nowTs = getNewTimestamp(); - - diffTs = diffTimestamp(idleTs, nowTs); - - statistics -> addIdleTime(diffTs); - - statistics -> subReadTime(diffTs); - - if (result < 0) - { - if (EGET() == EINTR) - { - #ifdef TEST - *logofs << "Transport: Select on FD#" << fd_ - << " was interrupted.\n" << logofs_flush; - #endif - - continue; - } - else - { - #ifdef TEST - *logofs << "Transport: Select on FD#" << fd_ - << " failed.\n" << logofs_flush; - #endif - - finish(); - - return -1; - } - } - else if (result > 0) - { - ready = result; - - if (FD_ISSET(fd_, &writeSet)) - { - writeTs = getNewTimestamp(); - - result = ::write(fd_, w_buffer_.data_.begin() + w_buffer_.start_ + - written, toWrite - written); - - nowTs = getNewTimestamp(); - - diffTs = diffTimestamp(writeTs, nowTs); - - statistics -> addWriteTime(diffTs); - - if (result > 0) - { - #ifdef TEST - *logofs << "Transport: Forced flush of " << result - << " bytes on " << "FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - written += result; - } - else if (result < 0 && EGET() == EINTR) - { - #ifdef TEST - *logofs << "Transport: Write to FD#" << fd_ - << " was interrupted.\n" << logofs_flush; - #endif - - continue; - } - else - { - #ifdef TEST - *logofs << "Transport: Write to FD#" << fd_ - << " failed.\n" << logofs_flush; - #endif - - finish(); - - return -1; - } - - ready--; - } - - if (ready > 0) - { - if (FD_ISSET(fd_, &readSet)) - { - #ifdef TEST - *logofs << "Transport: Not draining further " - << "due to data readable on FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - break; - } - } - } - #ifdef TEST - else - { - *logofs << "Transport: Timeout encountered " - << "waiting for FD#" << fd_ << ".\n" - << logofs_flush; - } - #endif - - nowTs = getNewTimestamp(); - - diffTs = diffTimestamp(startTs, nowTs); - - if (diffTs >= timeout) - { - #ifdef TEST - *logofs << "Transport: Not draining further " - << "due to the timeout on FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - break; - } - } - - if (written > 0) - { - #ifdef DUMP - - *logofs << "Transport: Dumping content of flushed data.\n" - << logofs_flush; - - DumpData(w_buffer_.data_.begin() + w_buffer_.start_, written); - - #endif - - // - // Update the buffer status. - // - - w_buffer_.length_ -= written; - - if (w_buffer_.length_ == 0) - { - w_buffer_.start_ = 0; - - blocked_ = 0; - } - else - { - w_buffer_.start_ += written; - - #ifdef TEST - *logofs << "Transport: There are still " << w_buffer_.length_ - << " bytes in write buffer for " << "FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - blocked_ = 1; - } - } - #ifdef TEST - else - { - *logofs << "Transport: WARNING! No data written to FD#" << fd_ - << " with " << toWrite << " bytes to drain and limit " - << "set to " << limit << ".\n" << logofs_flush; - } - #endif - - #ifdef TEST - *logofs << "Transport: Write buffer for FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "Transport: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " size is " - << w_buffer_.data_.size() << " capacity is " - << w_buffer_.data_.capacity() << ".\n" - << logofs_flush; - #endif - - return (w_buffer_.length_ <= limit); -} - -int Transport::wait(int timeout) const -{ - T_timestamp startTs = getNewTimestamp(); - - T_timestamp idleTs; - T_timestamp selectTs; - - T_timestamp nowTs = startTs; - - long available = 0; - int result = 0; - - int diffTs; - - fd_set readSet; - - FD_ZERO(&readSet); - FD_SET(fd_, &readSet); - - for (;;) - { - available = readable(); - - diffTs = diffTimestamp(startTs, nowTs); - - if (available != 0 || timeout == 0 || - (diffTs + (timeout / 10)) >= timeout) - { - #ifdef TEST - *logofs << "Transport: There are " << available - << " bytes on FD#" << fd_ << " after " - << diffTs << " Ms.\n" << logofs_flush; - #endif - - return available; - } - else if (available == 0 && result > 0) - { - #ifdef TEST - *logofs << "Transport: Read on " << "FD#" - << fd_ << " failed.\n" << logofs_flush; - #endif - - return -1; - } - - // - // TODO: Should subtract the time - // already spent in select. - // - - selectTs.tv_sec = 0; - selectTs.tv_usec = timeout * 1000; - - idleTs = nowTs; - - // - // Wait for descriptor to become readable. - // - - result = select(fd_ + 1, &readSet, NULL, NULL, &selectTs); - - nowTs = getNewTimestamp(); - - diffTs = diffTimestamp(idleTs, nowTs); - - statistics -> addIdleTime(diffTs); - - statistics -> subReadTime(diffTs); - - if (result < 0) - { - if (EGET() == EINTR) - { - #ifdef TEST - *logofs << "Transport: Select on FD#" << fd_ - << " was interrupted.\n" << logofs_flush; - #endif - - continue; - } - else - { - #ifdef TEST - *logofs << "Transport: Select on " << "FD#" - << fd_ << " failed.\n" << logofs_flush; - #endif - - return -1; - } - } - #ifdef TEST - else if (result == 0) - { - *logofs << "Transport: No data available on FD#" << fd_ - << " after " << diffTimestamp(startTs, nowTs) - << " Ms.\n" << logofs_flush; - } - else - { - *logofs << "Transport: Data became available on FD#" << fd_ - << " after " << diffTimestamp(startTs, nowTs) - << " Ms.\n" << logofs_flush; - } - #endif - } -} - -void Transport::setSize(unsigned int initialSize, unsigned int thresholdSize, - unsigned int maximumSize) -{ - initialSize_ = initialSize; - thresholdSize_ = thresholdSize; - maximumSize_ = maximumSize; - - #ifdef TEST - *logofs << "Transport: Set buffer sizes for FD#" << fd_ - << " to " << initialSize_ << "/" << thresholdSize_ - << "/" << maximumSize_ << ".\n" << logofs_flush; - #endif -} - -void Transport::fullReset() -{ - blocked_ = 0; - finish_ = 0; - - fullReset(w_buffer_); -} - -int Transport::resize(T_buffer &buffer, const int &size) -{ - if ((int) buffer.data_.size() >= (buffer.length_ + size) && - (buffer.start_ + buffer.length_ + size) > - (int) buffer.data_.size()) - { - if (buffer.length_ > 0) - { - // - // There is enough space in buffer but we need - // to move existing data at the beginning. - // - - #ifdef TEST - *logofs << "Transport: Moving " << buffer.length_ - << " bytes of data for " << "FD#" << fd_ - << " to make room in the buffer.\n" - << logofs_flush; - #endif - - memmove(buffer.data_.begin(), buffer.data_.begin() + - buffer.start_, buffer.length_); - } - - buffer.start_ = 0; - - #ifdef DEBUG - *logofs << "Transport: Made room for " - << buffer.data_.size() - buffer.start_ - << " bytes in buffer for " << "FD#" - << fd_ << ".\n" << logofs_flush; - #endif - } - else if ((buffer.length_ + size) > (int) buffer.data_.size()) - { - // - // Not enough space, so increase - // the size of the buffer. - // - - if (buffer.start_ != 0 && buffer.length_ > 0) - { - #ifdef TEST - *logofs << "Transport: Moving " << buffer.length_ - << " bytes of data for " << "FD#" << fd_ - << " to resize the buffer.\n" - << logofs_flush; - #endif - - memmove(buffer.data_.begin(), buffer.data_.begin() + - buffer.start_, buffer.length_); - } - - buffer.start_ = 0; - - unsigned int newSize = thresholdSize_; - - while (newSize < (unsigned int) buffer.length_ + size) - { - newSize <<= 1; - - if (newSize >= maximumSize_) - { - newSize = buffer.length_ + size + initialSize_; - } - } - - #ifdef DEBUG - *logofs << "Transport: Buffer for " << "FD#" << fd_ - << " will be enlarged from " << buffer.data_.size() - << " to at least " << buffer.length_ + size - << " bytes.\n" << logofs_flush; - #endif - - buffer.data_.resize(newSize); - - #ifdef TEST - if (newSize >= maximumSize_) - { - *logofs << "Transport: WARNING! Buffer for FD#" << fd_ - << " grown to reach size of " << newSize - << " bytes.\n" << logofs_flush; - } - #endif - - #ifdef TEST - *logofs << "Transport: Data buffer for " << "FD#" - << fd_ << " has now size " << buffer.data_.size() - << " and capacity " << buffer.data_.capacity() - << ".\n" << logofs_flush; - #endif - } - - return (buffer.length_ + size); -} - -void Transport::fullReset(T_buffer &buffer) -{ - // - // Force deallocation and allocation - // of the initial size. - // - - #ifdef TEST - *logofs << "Transport: Resetting buffer for " << "FD#" - << fd_ << " with size " << buffer.data_.size() - << " and capacity " << buffer.data_.capacity() - << ".\n" << logofs_flush; - #endif - - buffer.start_ = 0; - buffer.length_ = 0; - - if (buffer.data_.size() > (unsigned int) initialSize_ && - buffer.data_.capacity() > (unsigned int) initialSize_) - { - buffer.data_.clear(); - - buffer.data_.resize(initialSize_); - - #ifdef TEST - *logofs << "Transport: Data buffer for " << "FD#" - << fd_ << " shrunk to size " << buffer.data_.size() - << " and capacity " << buffer.data_.capacity() - << ".\n" << logofs_flush; - #endif - } -} - -ProxyTransport::ProxyTransport(int fd) : Transport(fd) -{ - #ifdef TEST - *logofs << "ProxyTransport: Going to create proxy transport " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - type_ = transport_proxy; - - // - // Set up the read buffer. - // - - r_buffer_.length_ = 0; - r_buffer_.start_ = 0; - - r_buffer_.data_.resize(initialSize_); - - // - // For now we own the buffer. - // - - owner_ = 1; - - // - // Set up ZLIB compression. - // - - int result; - - r_stream_.zalloc = NULL; - r_stream_.zfree = NULL; - r_stream_.opaque = NULL; - - r_stream_.next_in = NULL; - r_stream_.avail_in = 0; - - if ((result = inflateInit2(&r_stream_, 15)) != Z_OK) - { - #ifdef PANIC - *logofs << "ProxyTransport: PANIC! Failed initialization of ZLIB read stream. " - << "Error is '" << zError(result) << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed initialization of ZLIB read stream. " - << "Error is '" << zError(result) << "'.\n"; - - HandleCleanup(); - } - - if (control -> LocalStreamCompression) - { - w_stream_.zalloc = NULL; - w_stream_.zfree = NULL; - w_stream_.opaque = NULL; - - if ((result = deflateInit2(&w_stream_, control -> LocalStreamCompressionLevel, Z_DEFLATED, - 15, 9, Z_DEFAULT_STRATEGY)) != Z_OK) - { - #ifdef PANIC - *logofs << "ProxyTransport: PANIC! Failed initialization of ZLIB write stream. " - << "Error is '" << zError(result) << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Failed initialization of ZLIB write stream. " - << "Error is '" << zError(result) << "'.\n"; - - HandleCleanup(); - } - } - - // - // No ZLIB stream to flush yet. - // - - flush_ = 0; - - #ifdef REFERENCES - *logofs << "ProxyTransport: Created new object at " - << this << " out of " << ++references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -ProxyTransport::~ProxyTransport() -{ - #ifdef TEST - *logofs << "ProxyTransport: Going to destroy derived class " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - // - // Deallocate the ZLIB stream state. - // - - inflateEnd(&r_stream_); - - if (control -> LocalStreamCompression) - { - deflateEnd(&w_stream_); - } - - #ifdef REFERENCES - *logofs << "ProxyTransport: Deleted object at " - << this << " out of " << --references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -// -// Read data from its file descriptor. -// - -int ProxyTransport::read(unsigned char *data, unsigned int size) -{ - // - // If the remote peer is not compressing - // the stream then just return any byte - // read from the socket. - // - - if (control -> RemoteStreamCompression == 0) - { - int result = Transport::read(data, size); - - if (result <= 0) - { - return result; - } - - statistics -> addBytesIn(result); - - return result; - } - - // - // Return any pending data first. - // - - if (r_buffer_.length_ > 0) - { - // - // If the size of the buffer doesn't - // match the amount of data pending, - // force the caller to retry. - // - - if ((int) size < r_buffer_.length_) - { - #ifdef TEST - *logofs << "ProxyTransport: WARNING! Forcing a retry with " - << r_buffer_.length_ << " bytes pending and " - << size << " in the buffer.\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - - return -1; - } - - int copied = (r_buffer_.length_ > ((int) size) ? - ((int) size) : r_buffer_.length_); - - memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); - - // - // Update the buffer status. - // - - #ifdef DEBUG - *logofs << "ProxyTransport: Going to immediately return " << copied - << " bytes from proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - r_buffer_.length_ -= copied; - - if (r_buffer_.length_ == 0) - { - r_buffer_.start_ = 0; - } - else - { - r_buffer_.start_ += copied; - - #ifdef TEST - *logofs << "ProxyTransport: There are still " << r_buffer_.length_ - << " bytes in read buffer for proxy " << "FD#" - << fd_ << ".\n" << logofs_flush; - #endif - } - - return copied; - } - - // - // Read data in the user buffer. - // - - int result = Transport::read(data, size); - - if (result <= 0) - { - return result; - } - - statistics -> addBytesIn(result); - - // - // Decompress the data into the read - // buffer. - // - - #ifdef DEBUG - *logofs << "ProxyTransport: Going to decompress data for " - << "proxy FD#" << fd_ << ".\n" << logofs_flush; - #endif - - int saveTotalIn = r_stream_.total_in; - int saveTotalOut = r_stream_.total_out; - - int oldTotalIn = saveTotalIn; - int oldTotalOut = saveTotalOut; - - int diffTotalIn; - int diffTotalOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn - << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut - << ".\n" << logofs_flush; - #endif - - r_stream_.next_in = (Bytef *) data; - r_stream_.avail_in = result; - - // - // Let ZLIB use all the space already - // available in the buffer. - // - - unsigned int newAvailOut = r_buffer_.data_.size() - r_buffer_.start_ - - r_buffer_.length_; - - #ifdef TEST - *logofs << "ProxyTransport: Initial decompress buffer is " - << newAvailOut << " bytes.\n" << logofs_flush; - #endif - - for (;;) - { - #ifdef INSPECT - *logofs << "\nProxyTransport: Running the decompress loop.\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_buffer_.length_ = " << r_buffer_.length_ - << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_buffer_.data_.size() = " << r_buffer_.data_.size() - << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: newAvailOut = " << newAvailOut - << ".\n" << logofs_flush; - #endif - - if (resize(r_buffer_, newAvailOut) < 0) - { - return -1; - } - - #ifdef INSPECT - *logofs << "ProxyTransport: r_buffer_.data_.size() = " - << r_buffer_.data_.size() << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.next_in = " - << (void *) r_stream_.next_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.avail_in = " - << r_stream_.avail_in << ".\n" - << logofs_flush; - #endif - - r_stream_.next_out = r_buffer_.data_.begin() + r_buffer_.start_ + - r_buffer_.length_; - - r_stream_.avail_out = newAvailOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.next_out = " - << (void *) r_stream_.next_out << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.avail_out = " - << r_stream_.avail_out << ".\n" - << logofs_flush; - #endif - - int result = inflate(&r_stream_, Z_SYNC_FLUSH); - - #ifdef INSPECT - *logofs << "ProxyTransport: Called inflate() result is " - << result << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.avail_in = " - << r_stream_.avail_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.avail_out = " - << r_stream_.avail_out << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.total_in = " - << r_stream_.total_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_stream_.total_out = " - << r_stream_.total_out << ".\n" - << logofs_flush; - #endif - - diffTotalIn = r_stream_.total_in - oldTotalIn; - diffTotalOut = r_stream_.total_out - oldTotalOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: diffTotalIn = " - << diffTotalIn << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: diffTotalOut = " - << diffTotalOut << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: r_buffer_.length_ = " - << r_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - r_buffer_.length_ += diffTotalOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: r_buffer_.length_ = " - << r_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - oldTotalIn = r_stream_.total_in; - oldTotalOut = r_stream_.total_out; - - if (result == Z_OK) - { - if (r_stream_.avail_in == 0 && r_stream_.avail_out > 0) - { - break; - } - } - else if (result == Z_BUF_ERROR && r_stream_.avail_out > 0 && - r_stream_.avail_in == 0) - { - #ifdef TEST - *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR decompressing data.\n" - << logofs_flush; - #endif - - break; - } - else - { - #ifdef PANIC - *logofs << "ProxyTransport: PANIC! Decompression of data failed. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Decompression of data failed. Error is '" - << zError(result) << "'.\n"; - - finish(); - - return -1; - } - - // - // Add more bytes to the buffer. - // - - if (newAvailOut < thresholdSize_) - { - newAvailOut = thresholdSize_; - } - - #ifdef TEST - *logofs << "ProxyTransport: Need to add " << newAvailOut - << " bytes to the decompress buffer in read.\n" - << logofs_flush; - #endif - } - - diffTotalIn = r_stream_.total_in - saveTotalIn; - diffTotalOut = r_stream_.total_out - saveTotalOut; - - #ifdef DEBUG - *logofs << "ProxyTransport: Decompressed data from " - << diffTotalIn << " to " << diffTotalOut - << " bytes.\n" << logofs_flush; - #endif - - statistics -> addDecompressedBytes(diffTotalIn, diffTotalOut); - - // - // Check if the size of the buffer - // matches the produced data. - // - - if ((int) size < r_buffer_.length_) - { - #ifdef TEST - *logofs << "ProxyTransport: WARNING! Forcing a retry with " - << r_buffer_.length_ << " bytes pending and " - << size << " in the buffer.\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - - return -1; - } - - // - // Copy the decompressed data to the - // provided buffer. - // - - int copied = (r_buffer_.length_ > ((int) size) ? - ((int) size) : r_buffer_.length_); - - #ifdef DEBUG - *logofs << "ProxyTransport: Going to return " << copied - << " bytes from proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); - - // - // Update the buffer status. - // - - r_buffer_.length_ -= copied; - - if (r_buffer_.length_ == 0) - { - r_buffer_.start_ = 0; - } - else - { - r_buffer_.start_ += copied; - - #ifdef TEST - *logofs << "ProxyTransport: There are still " << r_buffer_.length_ - << " bytes in read buffer for proxy FD#" << fd_ - << ".\n" << logofs_flush; - #endif - } - - return copied; -} - -// -// If required compress data, else write it to socket. -// - -int ProxyTransport::write(T_write type, const unsigned char *data, const unsigned int size) -{ - #ifdef TEST - if (size == 0) - { - *logofs << "ProxyTransport: WARNING! Write called for FD#" - << fd_ << " without any data to write.\n" - << logofs_flush; - - return 0; - } - #endif - - // - // If there is no compression revert to - // plain socket management. - // - - if (control -> LocalStreamCompression == 0) - { - int result = Transport::write(type, data, size); - - if (result <= 0) - { - return result; - } - - statistics -> addBytesOut(result); - - statistics -> updateBitrate(result); - - FlushCallback(result); - - return result; - } - - #ifdef DEBUG - *logofs << "ProxyTransport: Going to compress " << size - << " bytes to write buffer for proxy FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - // - // Compress data into the write buffer. - // - - int saveTotalIn = w_stream_.total_in; - int saveTotalOut = w_stream_.total_out; - - int oldTotalIn = saveTotalIn; - int oldTotalOut = saveTotalOut; - - int diffTotalIn; - int diffTotalOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn - << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut - << ".\n" << logofs_flush; - #endif - - w_stream_.next_in = (Bytef *) data; - w_stream_.avail_in = size; - - // - // Let ZLIB use all the space already - // available in the buffer. - // - - unsigned int newAvailOut = w_buffer_.data_.size() - w_buffer_.start_ - - w_buffer_.length_; - - #ifdef TEST - *logofs << "ProxyTransport: Initial compress buffer is " - << newAvailOut << " bytes.\n" << logofs_flush; - #endif - - for (;;) - { - #ifdef INSPECT - *logofs << "\nProxyTransport: Running the compress loop.\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.length_ = " - << w_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.data_.size() = " - << w_buffer_.data_.size() << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: newAvailOut = " - << newAvailOut << ".\n" - << logofs_flush; - #endif - - if (resize(w_buffer_, newAvailOut) < 0) - { - return -1; - } - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.data_.size() = " - << w_buffer_.data_.size() << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.next_in = " - << (void *) w_stream_.next_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_in = " - << w_stream_.avail_in << ".\n" - << logofs_flush; - #endif - - w_stream_.next_out = w_buffer_.data_.begin() + w_buffer_.start_ + - w_buffer_.length_; - - w_stream_.avail_out = newAvailOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.next_out = " - << (void *) w_stream_.next_out << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_out = " - << w_stream_.avail_out << ".\n" - << logofs_flush; - #endif - - int result = deflate(&w_stream_, (type == write_delayed ? - Z_NO_FLUSH : Z_SYNC_FLUSH)); - - #ifdef INSPECT - *logofs << "ProxyTransport: Called deflate() result is " - << result << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_in = " - << w_stream_.avail_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_out = " - << w_stream_.avail_out << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.total_in = " - << w_stream_.total_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.total_out = " - << w_stream_.total_out << ".\n" - << logofs_flush; - #endif - - diffTotalOut = w_stream_.total_out - oldTotalOut; - diffTotalIn = w_stream_.total_in - oldTotalIn; - - #ifdef INSPECT - *logofs << "ProxyTransport: diffTotalIn = " - << diffTotalIn << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: diffTotalOut = " - << diffTotalOut << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.length_ = " - << w_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - w_buffer_.length_ += diffTotalOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.length_ = " - << w_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - oldTotalOut = w_stream_.total_out; - oldTotalIn = w_stream_.total_in; - - if (result == Z_OK) - { - if (w_stream_.avail_in == 0 && w_stream_.avail_out > 0) - { - break; - } - } - else if (result == Z_BUF_ERROR && w_stream_.avail_out > 0 && - w_stream_.avail_in == 0) - { - #ifdef TEST - *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR compressing data.\n" - << logofs_flush; - #endif - - break; - } - else - { - #ifdef PANIC - *logofs << "ProxyTransport: PANIC! Compression of data failed. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Compression of data failed. Error is '" - << zError(result) << "'.\n"; - - finish(); - - return -1; - } - - // - // Add more bytes to the buffer. - // - - if (newAvailOut < thresholdSize_) - { - newAvailOut = thresholdSize_; - } - - #ifdef TEST - *logofs << "ProxyTransport: Need to add " << newAvailOut - << " bytes to the compress buffer in write.\n" - << logofs_flush; - #endif - } - - diffTotalIn = w_stream_.total_in - saveTotalIn; - diffTotalOut = w_stream_.total_out - saveTotalOut; - - #ifdef TEST - - *logofs << "ProxyTransport: Compressed data from " - << diffTotalIn << " to " << diffTotalOut - << " bytes.\n" << logofs_flush; - - if (diffTotalIn != (int) size) - { - #ifdef PANIC - *logofs << "ProxyTransport: PANIC! Bytes provided to ZLIB stream " - << "should be " << size << " but they look to be " - << diffTotalIn << ".\n" << logofs_flush; - #endif - } - - #endif - - // - // Find out what we have to do with the - // produced data. - // - - if (type == write_immediate) - { - // - // If user requested an immediate write we - // flushed the ZLIB buffer. We can now reset - // the counter and write data to socket. - // - - flush_ = 0; - - #ifdef TEST - *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "ProxyTransport: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " flush is " - << flush_ << " size is " << w_buffer_.data_.size() - << " capacity is " << w_buffer_.data_.capacity() - << ".\n" << logofs_flush; - #endif - - // - // Alternatively may try to write only if - // the socket is not blocked. - // - // if (w_buffer_.length_ > 0 && blocked_ == 0) - // { - // ... - // } - // - - if (w_buffer_.length_ > 0) - - { - #ifdef TEST - *logofs << "ProxyTransport: Writing " << w_buffer_.length_ - << " bytes of produced data to FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - int result = Transport::flush(); - - if (result < 0) - { - return -1; - } - } - } - else - { - // - // We haven't flushed the ZLIB compression - // buffer, so user will have to call proxy - // transport's flush explicitly. - // - - flush_ += diffTotalIn; - } - - // - // We either wrote the data or added it to the - // write buffer. It's convenient to update the - // counters at this stage to get the current - // bitrate earlier. - // - - statistics -> addCompressedBytes(diffTotalIn, diffTotalOut); - - statistics -> addBytesOut(diffTotalOut); - - statistics -> updateBitrate(diffTotalOut); - - FlushCallback(diffTotalOut); - - #ifdef TEST - *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "ProxyTransport: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " flush is " - << flush_ << " size is " << w_buffer_.data_.size() - << " capacity is " << w_buffer_.data_.capacity() - << ".\n" << logofs_flush; - #endif - - return size; -} - -// -// Write data to its file descriptor. -// - -int ProxyTransport::flush() -{ - // - // If there is no compression or we already compressed - // outgoing data and just need to write it to socket - // because of previous incomplete writes then revert - // to plain socket management. - // - - if (flush_ == 0 || control -> LocalStreamCompression == 0) - { - int result = Transport::flush(); - - if (result < 0) - { - return -1; - } - - return result; - } - - #ifdef DEBUG - *logofs << "ProxyTransport: Going to flush compression on " - << "proxy FD#" << fd_ << ".\n" << logofs_flush; - #endif - - #ifdef TEST - *logofs << "ProxyTransport: Flush counter for proxy FD#" << fd_ - << " is " << flush_ << " bytes.\n" << logofs_flush; - #endif - - // - // Flush ZLIB stream into the write buffer. - // - - int saveTotalIn = w_stream_.total_in; - int saveTotalOut = w_stream_.total_out; - - int oldTotalIn = saveTotalIn; - int oldTotalOut = saveTotalOut; - - int diffTotalOut; - int diffTotalIn; - - #ifdef INSPECT - *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn - << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut - << ".\n" << logofs_flush; - #endif - - w_stream_.next_in = w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_; - w_stream_.avail_in = 0; - - // - // Let ZLIB use all the space already - // available in the buffer. - // - - unsigned int newAvailOut = w_buffer_.data_.size() - w_buffer_.start_ - - w_buffer_.length_; - - #ifdef DEBUG - *logofs << "ProxyTransport: Initial flush buffer is " - << newAvailOut << " bytes.\n" << logofs_flush; - #endif - - for (;;) - { - #ifdef INSPECT - *logofs << "\nProxyTransport: Running the flush loop.\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.length_ = " - << w_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.data_.size() = " - << w_buffer_.data_.size() << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: newAvailOut = " - << newAvailOut << ".\n" - << logofs_flush; - #endif - - if (resize(w_buffer_, newAvailOut) < 0) - { - return -1; - } - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.data_.size() = " - << w_buffer_.data_.size() << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.next_in = " - << (void *) w_stream_.next_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_in = " - << w_stream_.avail_in << ".\n" - << logofs_flush; - #endif - - w_stream_.next_out = w_buffer_.data_.begin() + w_buffer_.start_ + - w_buffer_.length_; - - w_stream_.avail_out = newAvailOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.next_out = " - << (void *) w_stream_.next_out << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_out = " - << w_stream_.avail_out << ".\n" - << logofs_flush; - #endif - - int result = deflate(&w_stream_, Z_SYNC_FLUSH); - - #ifdef INSPECT - *logofs << "ProxyTransport: Called deflate() result is " - << result << ".\n" << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_in = " - << w_stream_.avail_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.avail_out = " - << w_stream_.avail_out << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.total_in = " - << w_stream_.total_in << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_stream_.total_out = " - << w_stream_.total_out << ".\n" - << logofs_flush; - #endif - - diffTotalOut = w_stream_.total_out - oldTotalOut; - diffTotalIn = w_stream_.total_in - oldTotalIn; - - #ifdef INSPECT - *logofs << "ProxyTransport: diffTotalIn = " - << diffTotalIn << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: diffTotalOut = " - << diffTotalOut << ".\n" - << logofs_flush; - #endif - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.length_ = " - << w_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - w_buffer_.length_ += diffTotalOut; - - #ifdef INSPECT - *logofs << "ProxyTransport: w_buffer_.length_ = " - << w_buffer_.length_ << ".\n" - << logofs_flush; - #endif - - oldTotalOut = w_stream_.total_out; - oldTotalIn = w_stream_.total_in; - - if (result == Z_OK) - { - if (w_stream_.avail_in == 0 && w_stream_.avail_out > 0) - { - break; - } - } - else if (result == Z_BUF_ERROR && w_stream_.avail_out > 0 && - w_stream_.avail_in == 0) - { - #ifdef TEST - *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR flushing data.\n" - << logofs_flush; - #endif - - break; - } - else - { - #ifdef PANIC - *logofs << "ProxyTransport: PANIC! Flush of compressed data failed. " - << "Error is '" << zError(result) << "'.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Flush of compressed data failed. Error is '" - << zError(result) << "'.\n"; - - finish(); - - return -1; - } - - // - // Add more bytes to the buffer. - // - - if (newAvailOut < thresholdSize_) - { - newAvailOut = thresholdSize_; - } - - #ifdef TEST - *logofs << "ProxyTransport: Need to add " << newAvailOut - << " bytes to the compress buffer in flush.\n" - << logofs_flush; - #endif - } - - diffTotalIn = w_stream_.total_in - saveTotalIn; - diffTotalOut = w_stream_.total_out - saveTotalOut; - - #ifdef TEST - *logofs << "ProxyTransport: Compressed flush data from " - << diffTotalIn << " to " << diffTotalOut - << " bytes.\n" << logofs_flush; - #endif - - // - // Time to move data from the write - // buffer to the real link. - // - - #ifdef DEBUG - *logofs << "ProxyTransport: Reset flush counter for proxy FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - flush_ = 0; - - #ifdef TEST - *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "ProxyTransport: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " flush is " - << flush_ << " size is " << w_buffer_.data_.size() - << " capacity is " << w_buffer_.data_.capacity() - << ".\n" << logofs_flush; - #endif - - int result = Transport::flush(); - - if (result < 0) - { - return -1; - } - - // - // Update all the counters. - // - - statistics -> addCompressedBytes(diffTotalIn, diffTotalOut); - - statistics -> addBytesOut(diffTotalOut); - - statistics -> updateBitrate(diffTotalOut); - - FlushCallback(diffTotalOut); - - return result; -} - -unsigned int ProxyTransport::getPending(unsigned char *&data) -{ - // - // Return a pointer to the data in the - // read buffer. It is up to the caller - // to ensure that the data is consumed - // before the read buffer is reused. - // - - if (r_buffer_.length_ > 0) - { - unsigned int size = r_buffer_.length_; - - data = r_buffer_.data_.begin() + r_buffer_.start_; - - #ifdef DEBUG - *logofs << "ProxyTransport: Returning " << size - << " pending bytes from proxy FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - r_buffer_.length_ = 0; - r_buffer_.start_ = 0; - - // - // Prevent the deletion of the buffer. - // - - owner_ = 0; - - return size; - } - - #ifdef TEST - *logofs << "ProxyTransport: WARNING! No pending data " - << "for proxy FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - data = NULL; - - return 0; -} - -void ProxyTransport::fullReset() -{ - blocked_ = 0; - finish_ = 0; - flush_ = 0; - - if (control -> RemoteStreamCompression) - { - inflateReset(&r_stream_); - } - - if (control -> LocalStreamCompression) - { - deflateReset(&w_stream_); - } - - if (owner_ == 1) - { - Transport::fullReset(r_buffer_); - } - - Transport::fullReset(w_buffer_); -} - -AgentTransport::AgentTransport(int fd) : Transport(fd) -{ - #ifdef TEST - *logofs << "AgentTransport: Going to create agent transport " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - type_ = transport_agent; - - // - // Set up the read buffer. - // - - r_buffer_.length_ = 0; - r_buffer_.start_ = 0; - - r_buffer_.data_.resize(initialSize_); - - // - // For now we own the buffer. - // - - owner_ = 1; - - // - // Set up the mutexes. - // - - #ifdef THREADS - - pthread_mutexattr_t m_attributes; - - pthread_mutexattr_init(&m_attributes); - - // - // Interfaces in pthread to handle mutex - // type do not work in current version. - // - - m_attributes.__mutexkind = PTHREAD_MUTEX_ERRORCHECK_NP; - - if (pthread_mutex_init(&m_read_, &m_attributes) != 0) - { - #ifdef TEST - *logofs << "AgentTransport: Child: Creation of read mutex failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - } - - if (pthread_mutex_init(&m_write_, &m_attributes) != 0) - { - #ifdef TEST - *logofs << "AgentTransport: Child: Creation of write mutex failed. " - << "Error is " << EGET() << " '" << ESTR() - << "'.\n" << logofs_flush; - #endif - } - - #endif - - #ifdef REFERENCES - *logofs << "AgentTransport: Child: Created new object at " - << this << " out of " << ++references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -AgentTransport::~AgentTransport() -{ - #ifdef TEST - *logofs << "AgentTransport: Going to destroy derived class " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - // - // Unlock and free all mutexes. - // - - #ifdef THREADS - - pthread_mutex_unlock(&m_read_); - pthread_mutex_unlock(&m_write_); - - pthread_mutex_destroy(&m_read_); - pthread_mutex_destroy(&m_write_); - - #endif - - #ifdef REFERENCES - *logofs << "AgentTransport: Child: Deleted object at " - << this << " out of " << --references_ - << " allocated references.\n" << logofs_flush; - #endif -} - -// -// Read data enqueued by the other thread. -// - -int AgentTransport::read(unsigned char *data, unsigned int size) -{ - #ifdef THREADS - - lockRead(); - - #endif - - #ifdef DEBUG - *logofs << "AgentTransport: Child: Going to read " << size - << " bytes from " << "FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - int copied = -1; - - if (r_buffer_.length_ > 0) - { - if ((int) size < r_buffer_.length_) - { - #ifdef TEST - *logofs << "AgentTransport: WARNING! Forcing a retry with " - << r_buffer_.length_ << " bytes pending and " - << size << " in the buffer.\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - } - else - { - copied = (r_buffer_.length_ > ((int) size) ? - ((int) size) : r_buffer_.length_); - - memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); - - // - // Update the buffer status. - // - - #ifdef TEST - *logofs << "AgentTransport: Child: Going to immediately return " - << copied << " bytes from FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - #ifdef DUMP - - *logofs << "AgentTransport: Child: Dumping content of read data.\n" - << logofs_flush; - - DumpData(data, copied); - - #endif - - r_buffer_.length_ -= copied; - - if (r_buffer_.length_ == 0) - { - r_buffer_.start_ = 0; - } - else - { - r_buffer_.start_ += copied; - - #ifdef TEST - *logofs << "AgentTransport: Child: There are still " - << r_buffer_.length_ << " bytes in read buffer for " - << "FD#" << fd_ << ".\n" << logofs_flush; - #endif - } - } - } - else - { - #ifdef DEBUG - *logofs << "AgentTransport: Child: No data can be got " - << "from read buffer for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - } - - #ifdef THREADS - - unlockRead(); - - #endif - - return copied; -} - -// -// Write data to buffer so that the other -// thread can get it. -// - -int AgentTransport::write(T_write type, const unsigned char *data, const unsigned int size) -{ - #ifdef THREADS - - lockWrite(); - - #endif - - // - // Just append data to socket's write buffer. - // Note that we don't care if buffer exceeds - // the size limits set for this type of - // transport. - // - - #ifdef TEST - *logofs << "AgentTransport: Child: Going to append " << size - << " bytes to write buffer for " << "FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - int copied = -1; - - if (resize(w_buffer_, size) < 0) - { - finish(); - - ESET(EPIPE); - } - else - { - memmove(w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_, data, size); - - w_buffer_.length_ += size; - - #ifdef DUMP - - *logofs << "AgentTransport: Child: Dumping content of written data.\n" - << logofs_flush; - - DumpData(data, size); - - #endif - - #ifdef TEST - *logofs << "AgentTransport: Child: Write buffer for FD#" << fd_ - << " has data for " << w_buffer_.length_ << " bytes.\n" - << logofs_flush; - - *logofs << "AgentTransport: Child: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " size is " - << w_buffer_.data_.size() << " capacity is " - << w_buffer_.data_.capacity() << ".\n" - << logofs_flush; - #endif - - copied = size; - } - - // - // Let child access again the read buffer. - // - - #ifdef THREADS - - unlockWrite(); - - #endif - - return copied; -} - -int AgentTransport::flush() -{ - // - // In case of memory-to-memory transport - // this function should never be called. - // - - #ifdef PANIC - *logofs << "AgentTransport: Child: PANIC! Called flush() for " - << "memory to memory transport on " << "FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Called flush() for " - << "memory to memory transport on " << "FD#" - << fd_ << ".\n"; - - HandleAbort(); -} - -int AgentTransport::drain(int limit, int timeout) -{ - // - // We can't drain the channel in the case - // of the memory-to-memory transport. Data - // is enqueued for the agent to read but - // the agent could require multiple loops - // to read it all. - // - - // - // In case of memory-to-memory transport - // this function should never be called. - // - - #ifdef PANIC - *logofs << "AgentTransport: Child: PANIC! Called drain() for " - << "memory to memory transport on " << "FD#" - << fd_ << ".\n" << logofs_flush; - #endif - - cerr << "Error" << ": Called drain() for " - << "memory to memory transport on " << "FD#" - << fd_ << ".\n"; - - HandleAbort(); -} - -unsigned int AgentTransport::getPending(unsigned char *&data) -{ - #ifdef THREADS - - lockRead(); - - #endif - - if (r_buffer_.length_ > 0) - { - unsigned int size = r_buffer_.length_; - - data = r_buffer_.data_.begin() + r_buffer_.start_; - - #ifdef DEBUG - *logofs << "AgentTransport: Child: Returning " << size - << " pending bytes from FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - r_buffer_.length_ = 0; - r_buffer_.start_ = 0; - - #ifdef THREADS - - unlockRead(); - - #endif - - // - // Prevent the deletion of the buffer. - // - - owner_ = 0; - - return size; - } - - #ifdef TEST - *logofs << "AgentTransport: WARNING! No pending data " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - #ifdef THREADS - - unlockRead(); - - #endif - - data = NULL; - - return 0; -} - -void AgentTransport::fullReset() -{ - #ifdef THREADS - - lockRead(); - lockWrite(); - - #endif - - #ifdef TEST - *logofs << "AgentTransport: Child: Resetting transport " - << "for FD#" << fd_ << ".\n" << logofs_flush; - #endif - - blocked_ = 0; - finish_ = 0; - - if (owner_ == 1) - { - Transport::fullReset(r_buffer_); - } - - Transport::fullReset(w_buffer_); -} - -int AgentTransport::enqueue(const char *data, const int size) -{ - #ifdef THREADS - - lockRead(); - - #endif - - if (finish_ == 1) - { - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Returning EPIPE in " - << "write for finishing FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - ESET(EPIPE); - - return -1; - } - - // - // Always allow the agent to write - // all its data. - // - - int toPut = size; - - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Going to put " << toPut - << " bytes into read buffer for FD#" << fd_ - << ". Buffer length is " << r_buffer_.length_ - << ".\n" << logofs_flush; - #endif - - if (resize(r_buffer_, toPut) < 0) - { - finish(); - - #ifdef THREADS - - unlockRead(); - - #endif - - return -1; - } - - memcpy(r_buffer_.data_.begin() + r_buffer_.start_ + r_buffer_.length_, data, toPut); - - r_buffer_.length_ += toPut; - - #if defined(DUMP) && defined(PARENT) - - *logofs << "AgentTransport: Parent: Dumping content of enqueued data.\n" - << logofs_flush; - - DumpData((const unsigned char *) data, toPut); - - #endif - - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Read buffer for FD#" << fd_ - << " has now data for " << r_buffer_.length_ - << " bytes.\n" << logofs_flush; - - *logofs << "AgentTransport: Parent: Start is " << r_buffer_.start_ - << " length is " << r_buffer_.length_ << " size is " - << r_buffer_.data_.size() << " capacity is " - << r_buffer_.data_.capacity() << ".\n" - << logofs_flush; - #endif - - #ifdef THREADS - - unlockRead(); - - #endif - - return toPut; -} - -int AgentTransport::dequeue(char *data, int size) -{ - #ifdef THREADS - - lockWrite(); - - #endif - - if (w_buffer_.length_ == 0) - { - if (finish_ == 1) - { - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Returning 0 in read " - << "for finishing FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - return 0; - } - - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: No data can be read " - << "from write buffer for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - ESET(EAGAIN); - - #ifdef THREADS - - unlockWrite(); - - #endif - - return -1; - } - - // - // Return as many bytes as possible. - // - - int toGet = ((int) size > w_buffer_.length_ ? w_buffer_.length_ : size); - - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Going to get " << toGet - << " bytes from write buffer for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - memcpy(data, w_buffer_.data_.begin() + w_buffer_.start_, toGet); - - w_buffer_.start_ += toGet; - w_buffer_.length_ -= toGet; - - #if defined(DUMP) && defined(PARENT) - - *logofs << "AgentTransport: Parent: Dumping content of dequeued data.\n" - << logofs_flush; - - DumpData((const unsigned char *) data, toGet); - - #endif - - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Write buffer for FD#" << fd_ - << " has now data for " << length() << " bytes.\n" - << logofs_flush; - - *logofs << "AgentTransport: Parent: Start is " << w_buffer_.start_ - << " length is " << w_buffer_.length_ << " size is " - << w_buffer_.data_.size() << " capacity is " - << w_buffer_.data_.capacity() << ".\n" - << logofs_flush; - #endif - - #ifdef THREADS - - unlockWrite(); - - #endif - - return toGet; -} - -int AgentTransport::dequeuable() -{ - if (finish_ == 1) - { - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Returning EPIPE in " - << "readable for finishing FD#" << fd_ - << ".\n" << logofs_flush; - #endif - - ESET(EPIPE); - - return -1; - } - - #if defined(PARENT) && defined(TEST) - *logofs << "AgentTransport: Parent: Returning " - << w_buffer_.length_ << " as data readable " - << "from read buffer for FD#" << fd_ << ".\n" - << logofs_flush; - #endif - - return w_buffer_.length_; -} - -#ifdef THREADS - -int AgentTransport::lockRead() -{ - for (;;) - { - int result = pthread_mutex_lock(&m_read_); - - if (result == 0) - { - #ifdef DEBUG - *logofs << "AgentTransport: Read mutex locked by thread id " - << pthread_self() << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (EGET() == EINTR) - { - continue; - } - else - { - #ifdef WARNING - *logofs << "AgentTransport: WARNING! Locking of read mutex by thread id " - << pthread_self() << " returned " << result << ". Error is '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - return result; - } - } -} - -int AgentTransport::lockWrite() -{ - for (;;) - { - int result = pthread_mutex_lock(&m_write_); - - if (result == 0) - { - #ifdef DEBUG - *logofs << "AgentTransport: Write mutex locked by thread id " - << pthread_self() << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (EGET() == EINTR) - { - continue; - } - else - { - #ifdef WARNING - *logofs << "AgentTransport: WARNING! Locking of write mutex by thread id " - << pthread_self() << " returned " << result << ". Error is '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - return result; - } - } -} - -int AgentTransport::unlockRead() -{ - for (;;) - { - int result = pthread_mutex_unlock(&m_read_); - - if (result == 0) - { - #ifdef DEBUG - *logofs << "AgentTransport: Read mutex unlocked by thread id " - << pthread_self() << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (EGET() == EINTR) - { - continue; - } - else - { - #ifdef WARNING - *logofs << "AgentTransport: WARNING! Unlocking of read mutex by thread id " - << pthread_self() << " returned " << result << ". Error is '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - return result; - } - } -} - -int AgentTransport::unlockWrite() -{ - for (;;) - { - int result = pthread_mutex_unlock(&m_write_); - - if (result == 0) - { - #ifdef DEBUG - *logofs << "AgentTransport: Write mutex unlocked by thread id " - << pthread_self() << ".\n" << logofs_flush; - #endif - - return 0; - } - else if (EGET() == EINTR) - { - continue; - } - else - { - #ifdef WARNING - *logofs << "AgentTransport: WARNING! Unlocking of write mutex by thread id " - << pthread_self() << " returned " << result << ". Error is '" - << ESTR() << "'.\n" << logofs_flush; - #endif - - return result; - } - } -} - -#endif diff --git a/nxcomp/Transport.h b/nxcomp/Transport.h deleted file mode 100644 index 047396af6..000000000 --- a/nxcomp/Transport.h +++ /dev/null @@ -1,577 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Transport_H -#define Transport_H - -#include -#include - -#include -#include -#include - -#include "Misc.h" -#include "Control.h" - -#include "Types.h" -#include "Timestamp.h" -#include "Socket.h" - -// -// Set the verbosity level. -// - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Define this to lock and unlock the -// memory-to-memory transport buffers -// before they are accessed. The code -// is outdated and doesn't work with -// the current pthread library. -// - -#undef THREADS - -// -// Define this to know when a socket -// is created or destroyed. -// - -#undef REFERENCES - -// -// Size of buffer if not set by user. -// - -#define TRANSPORT_BUFFER_DEFAULT_SIZE 16384 - -// -// Type of transport. -// - -typedef enum -{ - transport_base, - transport_proxy, - transport_agent, - transport_last_tag - -} T_transport_type; - -// -// This class handles the buffered I/O on -// the network sockets. -// - -// -// TODO: This class is useful but adds a lot of -// overhead. There are many improvements we can -// make here: -// -// - There should be a generic Buffer class, ac- -// comodating a list of memory buffers. This -// would enable the use of the readv() and -// writev() functions to perform the I/O on -// the socket. -// -// - The buffering should be moved to the Write- -// Buffer and ReadBuffer classes. By performing -// the buffering here and there, we are dupli- -// cating a lot of code and are adding a lot -// of useless memory copies. -// -// - Stream compression should be removed. The -// proxy should compress the frames based on -// the type and should include the length of -// the decompressed data in the header of the -// packet. Besides avoiding the compression -// of packets that cannot be reduced in size, -// we would also save the additional memory -// allocations due to the fact that we don't -// know the size of the decode buffer at the -// time we read the packet from the network. -// -// - The other utilities implemented here, like -// the functions forcing a write on the socket -// or waiting for more data to become available -// should be moved to the Proxy or the Channel -// classes. -// - -class Transport -{ - public: - - // - // Member functions. - // - - Transport(int fd); - - virtual ~Transport(); - - int fd() const - { - return fd_; - } - - T_transport_type getType() - { - return type_; - } - - // - // Virtual members redefined by proxy - // and 'memory-to-memory' I/O layers. - // - - virtual int read(unsigned char *data, unsigned int size); - - virtual int write(T_write type, const unsigned char *data, const unsigned int size); - - virtual int flush(); - - virtual int drain(int limit, int timeout); - - virtual void finish() - { - fullReset(); - - finish_ = 1; - } - - virtual int length() const - { - return w_buffer_.length_; - } - - virtual int pending() const - { - return 0; - } - - virtual int readable() const - { - return GetBytesReadable(fd_); - } - - virtual int writable() const - { - return GetBytesWritable(fd_); - } - - virtual int queued() const - { - return GetBytesQueued(fd_); - } - - virtual int flushable() const - { - return 0; - } - - virtual int wait(int timeout) const; - - void setSize(unsigned int initialSize, - unsigned int thresholdSize, - unsigned int maximumSize); - - // - // Return a pointer to the data - // in the read buffer. - // - - virtual unsigned int getPending(unsigned char *&data) - { - data = NULL; - - return 0; - } - - virtual void pendingReset() - { - } - - virtual void partialReset() - { - partialReset(w_buffer_); - } - - virtual void fullReset(); - - int blocked() const - { - return blocked_; - } - - protected: - - // - // Make room in the buffer to accommodate - // at least size bytes. - // - - int resize(T_buffer &buffer, const int &size); - - void partialReset(T_buffer &buffer) - { - if (buffer.length_ == 0 && - (buffer.data_.size() > initialSize_ || - buffer.data_.capacity() > initialSize_)) - { - fullReset(buffer); - } - } - - void fullReset(T_buffer &buffer); - - // - // Data members. - // - - int fd_; - - int blocked_; - int finish_; - - T_buffer w_buffer_; - - unsigned int initialSize_; - unsigned int thresholdSize_; - unsigned int maximumSize_; - - T_transport_type type_; - - private: - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -// -// This class handles buffered I/O and -// compression of the proxy stream. -// - -class ProxyTransport : public Transport -{ - public: - - ProxyTransport(int fd); - - virtual ~ProxyTransport(); - - virtual int read(unsigned char *data, unsigned int size); - - virtual int write(T_write type, const unsigned char *data, const unsigned int size); - - virtual int flush(); - - // - // Same as in the base class. - // - // virtual int drain(int limit, int timeout); - // - // virtual void finish(); - // - - // - // Same as in the base class. - // - // virtual int length() const - // - - virtual int pending() const - { - return r_buffer_.length_; - } - - // - // Same as in the base class. - // - // virtual int readable() const; - // - // virtual int writable() const; - // - // virtual int queued() const; - // - - virtual int flushable() const - { - return flush_; - } - - // - // Same as in the base class, but - // should not be called. - // - // int drained() const; - // - // Same as in the base class. - // - // virtual int wait(int timeout) const; - // - // Same as in the base class. - // - // void setSize(unsigned int initialSize, - // unsigned int thresholdSize, - // unsigned int maximumSize); - // - - virtual unsigned int getPending(unsigned char *&data); - - virtual void pendingReset() - { - owner_ = 1; - } - - virtual void partialReset() - { - if (owner_ == 1) - { - Transport::partialReset(r_buffer_); - } - - Transport::partialReset(w_buffer_); - } - - virtual void fullReset(); - - // - // Same as in the base class. - // - // int blocked() const; - // - - protected: - - int flush_; - int owner_; - - T_buffer r_buffer_; - - z_stream r_stream_; - z_stream w_stream_; - - private: - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -// -// Handle memory-to-memory data transfers between -// an agent and the proxy. -// - -class AgentTransport : public Transport -{ - public: - - AgentTransport(int fd); - - virtual ~AgentTransport(); - - virtual int read(unsigned char *data, unsigned int size); - - virtual int write(T_write type, const unsigned char *data, const unsigned int size); - - // - // These two should never be called. - // - - virtual int flush(); - - virtual int drain(int limit, int timeout); - - // - // Same as in the base class. - // - // virtual void finish(); - // - - // - // Same as in the base class. - // - // virtual int length() const - // - - virtual int pending() const - { - return r_buffer_.length_; - } - - // - // These are intended to operate only - // on the internal buffers. - // - - virtual int readable() const - { - return r_buffer_.length_; - } - - virtual int writable() const - { - return control -> TransportMaximumBufferSize; - } - - virtual int queued() const - { - return 0; - } - - // - // Same as in the base class. - // - // virtual int flushable() const; - // - // Same as in the base class, but - // should not be called. - // - // int drained() const; - // - - // - // Return immediately or will - // block until the timeout. - // - - virtual int wait(int timeout) const - { - return 0; - } - - // - // Same as in the base class. - // - // void setSize(unsigned int initialSize, - // unsigned int thresholdSize, - // unsigned int maximumSize); - // - - virtual unsigned int getPending(unsigned char *&data); - - virtual void pendingReset() - { - owner_ = 1; - } - - virtual void partialReset() - { - if (owner_ == 1) - { - Transport::partialReset(r_buffer_); - } - - Transport::partialReset(w_buffer_); - } - - virtual void fullReset(); - - // - // Same as in the base class. - // - // int blocked() const; - // - - // - // The following are specific of the - // memory-to-memory transport. - // - - int enqueue(const char *data, const int size); - - int dequeue(char *data, int size); - - int queuable() - { - // - // Always allow the agent to enqueue - // more data. - // - - return control -> TransportMaximumBufferSize; - } - - int dequeuable(); - - protected: - - // - // Lock the buffer to handle reads and - // writes safely. - // - - #ifdef THREADS - - int lockRead(); - int lockWrite(); - - int unlockRead(); - int unlockWrite(); - - #endif - - // - // Data members. - // - - int owner_; - - T_buffer r_buffer_; - - // - // Mutexes for safe read and write. - // - - #ifdef THREADS - - pthread_mutex_t m_read_; - pthread_mutex_t m_write_; - - #endif - - private: - - #ifdef REFERENCES - - static int references_; - - #endif -}; - -#endif /* Transport_H */ diff --git a/nxcomp/Types.h b/nxcomp/Types.h deleted file mode 100644 index e82664c81..000000000 --- a/nxcomp/Types.h +++ /dev/null @@ -1,271 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Types_H -#define Types_H - -using namespace std; - -#include -#include -#include -#include - -#include "MD5.h" - -// -// This is MD5 length. -// - -#define MD5_LENGTH 16 - -// -// Types of repositories. Replace the original -// clear() methods from STL in order to actually -// free the unused memory. -// - -class Message; - -class T_data : public vector < unsigned char > -{ - public: - - unsigned char *begin() - { - return &*(vector < unsigned char >::begin()); - } - - const unsigned char *begin() const - { - return &*(vector < unsigned char >::begin()); - } - - // Avoid overriding clear() when using libc++. Fiddling with STL internals - // doesn't really seem like a good idea to me anyway. - #ifndef _LIBCPP_VECTOR - void clear() - { - #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) - - #if defined(__GLIBCPP_INTERNAL_VECTOR_H) - - _Destroy(_M_start, _M_finish); - - #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - - destroy(_M_start, _M_finish); - - #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - - _M_start = _M_finish = _M_end_of_storage = 0; - - #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - - #if defined(_GLIBCXX_VECTOR) - - _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); - - _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); - - this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; - - #else /* #if defined(_GLIBCXX_VECTOR) */ - - destroy(start, finish); - - deallocate(); - - start = finish = end_of_storage = 0; - - #endif /* #if defined(_GLIBCXX_VECTOR) */ - - #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - } - #endif /* #ifdef _LIBCPP_VECTOR */ -}; - -class T_messages : public vector < Message * > -{ - public: - - // Avoid overriding clear() when using libc++. Fiddling with STL internals - // doesn't really seem like a good idea to me anyway. - #ifndef _LIBCPP_VECTOR - void clear() - { - #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) - - #if defined(__GLIBCPP_INTERNAL_VECTOR_H) - - _Destroy(_M_start, _M_finish); - - #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - - destroy(_M_start, _M_finish); - - #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - - _M_deallocate(_M_start, _M_end_of_storage - _M_start); - - _M_start = _M_finish = _M_end_of_storage = 0; - - #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - - #if defined(_GLIBCXX_VECTOR) - - _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); - - _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); - - this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; - - #else /* #if defined(_GLIBCXX_VECTOR) */ - - destroy(start, finish); - - deallocate(); - - start = finish = end_of_storage = 0; - - #endif /* #if defined(_GLIBCXX_VECTOR) */ - - #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ - } - #endif /* #ifndef _LIBCPP_VECTOR */ -}; - -typedef md5_byte_t * T_checksum; - -struct T_less -{ - bool operator()(T_checksum a, T_checksum b) const - { - return (memcmp(a, b, MD5_LENGTH) < 0); - } -}; - -typedef map < T_checksum, int, T_less > T_checksums; - -class Split; - -typedef list < Split * > T_splits; - -class File; - -struct T_older -{ - bool operator()(File *a, File *b) const; -}; - -typedef set < File *, T_older > T_files; - -typedef list < int > T_list; - -// -// Used to accommodate data to be read and -// written to a socket. -// - -typedef struct -{ - T_data data_; - int length_; - int start_; -} -T_buffer; - -// -// The message store operation that was -// executed for the message. The channels -// use these values to determine how to -// handle the message after it has been -// received at the decoding side. -// - -// Since ProtoStep8 (#issue 108) -enum T_store_action -{ - is_hit, - is_added, - is_discarded, - is_removed -}; - -// Since ProtoStep8 (#issue 108) -#define IS_HIT is_hit -#define IS_ADDED is_added - -enum T_checksum_action -{ - use_checksum, - discard_checksum -}; - -enum T_data_action -{ - use_data, - discard_data -}; - -// -// Message is going to be weighted for -// deletion at insert or cleanup time? -// - -enum T_rating -{ - rating_for_insert, - rating_for_clean -}; - -// -// How to handle the writes to the X -// and proxy connections. -// - -enum T_write -{ - write_immediate, - write_delayed -}; - -enum T_flush -{ - flush_if_needed, - flush_if_any -}; - -// -// This is the value to indicate an -// invalid position in the message -// store. -// - -static const int nothing = -1; - -#endif /* Types_H */ diff --git a/nxcomp/Unpack.cpp b/nxcomp/Unpack.cpp deleted file mode 100644 index 50ae890b6..000000000 --- a/nxcomp/Unpack.cpp +++ /dev/null @@ -1,1510 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Misc.h" -#include "Unpack.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -// -// Used for the ZLIB decompression -// of RGB, alpha and colormap data. -// - -z_stream unpackStream; - -static int unpackInitialized; - -int Unpack8To8(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To8(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To16(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To16(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To24(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To32(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack8To32(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack15To16(const unsigned char *data, unsigned char *out, - unsigned char *end); - -int Unpack15To24(const unsigned char *data, unsigned char *out, - unsigned char *end); - -int Unpack15To32(const unsigned char *data, unsigned char *out, - unsigned char *end); - -int Unpack16To16(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack16To16(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder); - -int Unpack16To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack16To24(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder); - -int Unpack16To32(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack16To32(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder); - -int Unpack24To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack24To24(const unsigned char *data, unsigned char *out, - unsigned char *end); - -int Unpack24To32(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - -int Unpack24To32(const unsigned char *data, unsigned char *out, unsigned char *end); - -int Unpack32To32(const T_colormask *colormask, const unsigned int *data, - unsigned int *out, unsigned int *end); - - -void UnpackInit() -{ - if (unpackInitialized == 0) - { - unpackStream.zalloc = (alloc_func) 0; - unpackStream.zfree = (free_func) 0; - unpackStream.opaque = (voidpf) 0; - - unpackStream.next_in = (Bytef *) 0; - unpackStream.avail_in = 0; - - int result = inflateInit2(&unpackStream, 15); - - if (result != Z_OK) - { - #ifdef PANIC - *logofs << "UnpackInit: PANIC! Cannot initialize the Z stream " - << "for decompression. Error is '" << zError(result) - << "'.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Cannot initialize the Z stream for " - << "decompression. Error is '" << zError(result) - << "'.\n"; - } - else - { - unpackInitialized = 1; - } - } -} - -void UnpackDestroy() -{ - if (unpackInitialized == 1) - { - inflateEnd(&unpackStream); - - unpackInitialized = 0; - } -} - -// -// Get bits per pixel set by client -// according to display geometry. -// - -int UnpackBitsPerPixel(T_geometry *geometry, unsigned int depth) -{ - switch (depth) - { - case 1: - { - return geometry -> depth1_bpp; - } - case 4: - { - return geometry -> depth4_bpp; - } - case 8: - { - return geometry -> depth8_bpp; - } - case 15: - case 16: - { - return geometry -> depth16_bpp; - } - case 24: - { - return geometry -> depth24_bpp; - } - case 32: - { - return geometry -> depth32_bpp; - } - default: - { - return 0; - } - } -} - -int Unpack8To8(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To8: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - memcpy(out, data, end - out); - - return 1; -} - -int Unpack8To16(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To16: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned short *out16 = (unsigned short *) out; - unsigned short *end16 = (unsigned short *) end; - - while (out16 < end16) - { - if (*data == 0) - { - *out16 = 0x0; - } - else if (*data == 0xff) - { - *out16 = 0xffff; - } - else - { - // - // Pixel layout: - // - // 8bits 00RRGGBB -> 16bits RR000GG0 000BB000. - // - - *out16 = (((((*data & 0x30) << 2) | colormask -> correction_mask) << 8) & 0xf800) | - (((((*data & 0xc) << 4) | colormask -> correction_mask) << 3) & 0x7e0) | - (((((*data & 0x3) << 6) | colormask -> correction_mask) >> 3) & 0x1f); - } - - out16++; - data++; - } - - return 1; -} - -int Unpack8To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To24: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - while (out < (end - 2)) - { - if (*data == 0x00) - { - out[0] = out[1] = out[2] = 0x00; - } - else if (*data == 0xff) - { - out[0] = out[1] = out[2] = 0xff; - } - else - { - // - // Pixel layout: - // - // 8bits 00RRGGBB -> 24bits RR000000 GG00000 BB000000. - // - - out[0] = (((*data & 0x30) << 2) | colormask -> correction_mask); - out[1] = (((*data & 0x0c) << 4) | colormask -> correction_mask); - out[2] = (((*data & 0x03) << 6) | colormask -> correction_mask); - } - - out += 3; - data += 1; - } - - return 1; -} - -int Unpack8To32(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To32: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - while (out32 < end32) - { - if (*data == 0) - { - *out32 = 0x0; - } - else if (*data == 0xff) - { - *out32 = 0xffffff; - } - else - { - *out32 = ((((*data & 0x30) << 2) | colormask -> correction_mask) << 16) | - ((((*data & 0xc) << 4) | colormask -> correction_mask) << 8) | - (((*data & 0x3) << 6) | colormask -> correction_mask); - } - - out32++; - data++; - } - - return 1; -} - -int Unpack8(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size) -{ - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - int (*unpack)(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - - switch (dst_bpp) - { - case 8: - { - unpack = Unpack8To8; - - break; - } - case 16: - { - unpack = Unpack8To16; - - break; - } - case 24: - { - unpack = Unpack8To24; - - break; - } - case 32: - { - unpack = Unpack8To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack8: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 16/24/32 are supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (dst_bpp == 24) - { - unsigned char *dst_end = dst_data; - - #ifdef TEST - *logofs << "Unpack8: Handling 24 bits with dst_size " - << dst_size << ".\n" << logofs_flush; - #endif - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - - dst_end += RoundUp4(dst_width * 3); - - (*unpack)(colormask, src_data, dst_data, dst_end); - - src_data += src_width; - } - } - else - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(colormask, src_data, dst_data, dst_end); - } - - return 1; -} - -int Unpack16To16(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack16To16: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - if (colormask -> correction_mask) - { - unsigned short *data16 = (unsigned short *) data; - - unsigned short *out16 = (unsigned short *) out; - unsigned short *end16 = (unsigned short *) end; - - while (out16 < end16) - { - if (*data16 == 0x0000) - { - *out16 = 0x0000; - } - else if (*data16 == 0xffff) - { - *out16 = 0xffff; - } - else - { - // - // Pixel layout: - // - // 16bit RRRRRGGG GG0BBBBB -> RRRRRGGG GGGBBBBB. - // - - *out16 = (((((*data16 & 0xf100) >> 8) | colormask -> correction_mask) << 8) & 0xf800) | - (((((*data16 & 0x7c0) >> 3) | colormask -> correction_mask) << 3) & 0x7e0) | - (((((*data16 & 0x1f) << 3) | colormask -> correction_mask) >> 3) & 0x1f); - } - - out16++; - data16++; - } - } - else - { - #ifdef TEST - *logofs << "Unpack16To16: Using bitwise copy due to null correction mask.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) out, (unsigned char *) data, end - out); - } - - return 1; -} - -int Unpack16To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack16To24: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - - - while (out < end - 2) - { - if (*data16 == 0x0) - { - out[0] = 0x00; - out[1] = 0x00; - out[2] = 0x00; - } - else if (*data16 == 0xffff) - { - out[0] = 0xff; - out[1] = 0xff; - out[2] = 0xff; - } - else - { - #ifdef TEST - *logofs << "Unpack16To24: Pixel [" << *data16 << "]\n" - << logofs_flush; - #endif - - // - // Pixel layout: - // - // 16bit 0RRRRRGG GGGBBBBB -> 24 bit RRRRR000 GGGGG000 BBBBB000 - // - - out[0] = (((*data16 & 0x7c00) >> 7) | colormask -> correction_mask); - out[1] = (((*data16 & 0x03e0) >> 2) | colormask -> correction_mask); - out[2] = (((*data16 & 0x001f) << 3) | colormask -> correction_mask); - } - - out += 3; - data16 += 1; - } - - return 1; -} - -int Unpack16To32(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack16To32: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - while (out32 < end32) - { - if (*data16 == 0x0) - { - *out32 = 0x0; - } - else if (*data16 == 0xffff) - { - *out32 = 0xffffff; - } - else - { - *out32 = ((((*data16 & 0x7c00) >> 7) | colormask -> correction_mask) << 16) | - ((((*data16 & 0x3e0) >> 2) | colormask -> correction_mask) << 8) | - (((*data16 & 0x1f) << 3) | colormask -> correction_mask); - } - - out32++; - data16++; - } - - return 1; -} - -int Unpack16(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size) -{ - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - int (*unpack)(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - - switch (dst_bpp) - { - case 16: - { - unpack = Unpack16To16; - - break; - } - case 24: - { - unpack = Unpack16To24; - - break; - } - case 32: - { - unpack = Unpack16To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack16: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 24/32 are supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (dst_bpp == 24) - { - unsigned char *dst_end = dst_data; - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - - dst_end += RoundUp4(dst_width * 3); - - (*unpack)(colormask, src_data, dst_data, dst_end); - - src_data += (src_width * 2); - } - - } - else - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(colormask, src_data, dst_data, dst_end); - } - - return 1; -} - -int Unpack24To24(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack24To24: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - if (colormask -> correction_mask) - { - while (out < end) - { - if (data[0] == 0x00 && - data[1] == 0x00 && - data[2] == 0x00) - { - out[0] = out[1] = out[2] = 0x00; - } - else if (data[0] == 0xff && - data[1] == 0xff && - data[2] == 0xff) - { - out[0] = out[1] = out[2] = 0xff; - } - else - { - out[0] = (data[0] | colormask -> correction_mask); - out[1] = (data[1] | colormask -> correction_mask); - out[2] = (data[2] | colormask -> correction_mask); - } - - out += 3; - data += 3; - } - } - else - { - #ifdef TEST - *logofs << "Unpack24To24: Using bitwise copy due to null correction mask.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) out, (unsigned char *) data, end - out); - } - - return 1; -} - -int Unpack24To32(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack24To32: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - while (out32 < end32) - { - if (colormask -> color_mask == 0xff) - { - *out32 = (data[0] << 16) | (data[1] << 8) | data[2]; - } - else - { - if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x0) - { - *out32 = 0x0; - } - else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) - { - *out32 = 0xffffff; - } - else - { - *out32 = (((unsigned int) data[0] | colormask -> correction_mask) << 16) | - (((unsigned int) data[1] | colormask -> correction_mask) << 8) | - ((unsigned int) data[2] | colormask -> correction_mask); - } - } - - out32 += 1; - data += 3; - } - - return 1; -} - -int Unpack24(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size) -{ - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - int (*unpack)(const T_colormask *colormask, const unsigned char *data, - unsigned char *out, unsigned char *end); - - switch (dst_bpp) - { - case 24: - { - unpack = Unpack24To24; - - break; - } - case 32: - { - unpack = Unpack24To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack24: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 32 is supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (dst_bpp == 24) - { - unsigned char *dst_end; - unsigned long scanline_size = RoundUp4(dst_width * dst_bpp / 8); - - dst_end = dst_data; - - #ifdef TEST - *logofs << "Unpack24: Handling 24 bits with dst_height " - << dst_height << " scanline_size " << scanline_size - << " dst_size " << dst_size << ".\n" << logofs_flush; - #endif - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - - dst_end += scanline_size; - - (*unpack)(colormask, src_data, dst_data, dst_end); - - src_data += scanline_size; - } - } - else - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(colormask, src_data, dst_data, dst_end); - } - - return 1; -} - -int Unpack8To8(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To8: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - while (out < end) - { - *(out++) = (unsigned char) colormap -> data[*(data++)]; - } - - return 1; -} - -int Unpack8To16(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To16: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - unsigned short *out16 = (unsigned short *) out; - unsigned short *end16 = (unsigned short *) end; - - while (out16 < end16) - { - *(out16++) = (unsigned short) colormap -> data[*(data++)]; - } - - return 1; -} - -int Unpack8To24(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To24: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - unsigned int value; - - while (out < end) - { - value = colormap -> data[*(data++)]; - - *(out++) = value; - *(out++) = value >> 8; - *(out++) = value >> 16; - } - - return 1; -} - -int Unpack8To32(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack8To32: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - while (out32 < end32) - { - *(out32++) = colormap -> data[*(data++)]; - } - - return 1; -} - -int Unpack8(T_geometry *geometry, T_colormap *colormap, int src_depth, int src_width, int src_height, - unsigned char *src_data, int src_size, int dst_depth, int dst_width, - int dst_height, unsigned char *dst_data, int dst_size) -{ - if (src_depth != 8) - { - #ifdef PANIC - *logofs << "Unpack8: PANIC! Cannot unpack colormapped image of source depth " - << src_depth << ".\n" << logofs_flush; - #endif - - return -1; - } - - int (*unpack)(T_colormap *colormap, const unsigned char *data, - unsigned char *out, unsigned char *end); - - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - switch (dst_bpp) - { - case 8: - { - unpack = Unpack8To8; - - break; - } - case 16: - { - unpack = Unpack8To16; - - break; - } - case 24: - { - unpack = Unpack8To24; - - break; - } - case 32: - { - unpack = Unpack8To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack8: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 8/16/24/32 are supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (src_width == dst_width && - src_height == dst_height) - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(colormap, src_data, dst_data, dst_end); - } - else if (src_width >= dst_width && - src_height >= dst_height) - { - unsigned char *dst_end = dst_data; - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - - dst_end += RoundUp4(dst_width * dst_bpp / 8); - - (*unpack)(colormap, src_data, dst_data, dst_end); - - src_data += src_width; - } - } - else - { - #ifdef PANIC - *logofs << "Unpack8: PANIC! Cannot unpack image. " - << "Destination area " << dst_width << "x" - << dst_height << " is not fully contained in " - << src_width << "x" << src_height << " source.\n" - << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int Unpack15To16(const unsigned char *data, unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack15To16: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - unsigned short *out16 = (unsigned short *) out; - unsigned short *end16 = (unsigned short *) end; - - while (out16 < end16) - { - if (*data16 == 0x0) - { - *out16 = 0x0; - } - else if (*data16 == 0x7fff) - { - *out16 = 0xffff; - } - else - { - #ifdef TEST - *logofs << "Unpack15To16: Pixel [" << *data16 << "]\n" - << logofs_flush; - #endif - - *out16 = ((*data16 & 0x7ff0) << 1) | - (*data16 & 0x001f); - } - - out16 += 1; - data16 += 1; - } - - return 1; -} - -int Unpack15To24(const unsigned char *data, unsigned char *out, unsigned char *end) - -{ - #ifdef TEST - *logofs << "Unpack15To24: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - - while (out < end - 2) - { - if (*data16 == 0x0) - { - out[0] = 0x00; - out[1] = 0x00; - out[2] = 0x00; - } - else if (*data16 == 0x7fff) - { - out[0] = 0xff; - out[1] = 0xff; - out[2] = 0xff; - } - else - { - #ifdef TEST - *logofs << "Unpack15To24: Pixel [" << *data16 << "]\n" - << logofs_flush; - #endif - - out[0] = ((*data16 >> 7) & 0xf8) | ((*data16 >> 12) & 0x07); - out[1] = ((*data16 >> 2) & 0xf8) | ((*data16 >> 8) & 0x07); - out[2] = ((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07); - } - - out += 3; - data16 += 1; - } - - return 1; -} - -int Unpack15To32(const unsigned char *data, unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack15To32: Unpacking " << end - out - << " bytes of data.\n" - << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - while (out32 < end32) - { - if (*data16 == 0x0) - { - *out32 = 0x0; - } - else if (*data16 == 0xffff) - { - *out32 = 0xffffff; - } - else - { - *out32 = ((((*data16 >> 7) & 0xf8) | ((*data16 >> 12) & 0x07)) << 16) | - ((((*data16 >> 2) & 0xf8) | ((*data16 >> 8) & 0x07)) << 8) | - (((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07)); - } - - out32++; - data16++; - } - - return 1; -} - -int Unpack15(T_geometry *geometry, int src_depth, int src_width, int src_height, - unsigned char *src_data, int src_size, int dst_depth, int dst_width, - int dst_height, unsigned char *dst_data, int dst_size) -{ - if (src_depth != 16) - { - #ifdef PANIC - *logofs << "Unpack15: PANIC! Cannot unpack colormapped image of source depth " - << src_depth << ".\n" << logofs_flush; - #endif - - return -1; - } - - int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end); - - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - switch (dst_bpp) - { - case 16: - { - unpack = Unpack15To16; - - break; - } - case 24: - { - unpack = Unpack15To24; - - break; - } - case 32: - { - unpack = Unpack15To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack15: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 16/24/32 are supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (src_width == dst_width && src_height == dst_height) - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(src_data, dst_data, dst_end); - } - else if (src_width >= dst_width && src_height >= dst_height) - { - unsigned char *dst_end = dst_data; - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - dst_end += RoundUp4(dst_width * dst_bpp / 8); - - (*unpack)(src_data, dst_data, dst_end); - - src_data += src_width * 2; - } - } - else - { - #ifdef PANIC - *logofs << "Unpack15: PANIC! Cannot unpack image. " - << "Destination area " << dst_width << "x" - << dst_height << " is not fully contained in " - << src_width << "x" << src_height << " source.\n" - << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int Unpack16To16(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder) -{ - #ifdef TEST - *logofs << "Unpack16To16: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) out, (unsigned char *) data, end - out); - - return 1; -} - -int Unpack16To24(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder) - -{ - #ifdef TEST - *logofs << "Unpack16To24: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - - while (out < end - 2) - { - if (*data16 == 0x0) - { - out[0] = 0x00; - out[1] = 0x00; - out[2] = 0x00; - } - else if (*data16 == 0xffff) - { - out[0] = 0xff; - out[1] = 0xff; - out[2] = 0xff; - } - else - { - #ifdef TEST - *logofs << "Unpack16To24: Pixel [" << *data16 << "]\n" - << logofs_flush; - #endif - - out[0] = ((*data16 >> 8) & 0xf8) | ((*data16 >> 13) & 0x07); - out[1] = ((*data16 >> 3) & 0xfc) | ((*data16 >> 9) & 0x03); - out[2] = ((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07); - } - - out += 3; - data16 += 1; - } - - return 1; -} - - -int Unpack16To32(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder) -{ - #ifdef TEST - *logofs << "Unpack16To32: Unpacking " << end - out - << " bytes of data.\n" - << logofs_flush; - #endif - - unsigned short *data16 = (unsigned short *) data; - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - unsigned short pixel16; - unsigned int pixel32; - - while (out32 < end32) - { - - pixel16 = GetUINT((unsigned char *)data16, 0); - - if (pixel16 == 0x0) - { - PutULONG(0x0, (unsigned char *) out32, imageByteOrder); - } - else if (pixel16 == 0xffff) - { - PutULONG(0xffffff, (unsigned char *) out32, imageByteOrder); - } - else - { - pixel32 = ((((pixel16 >> 8) & 0xf8) | ((pixel16 >> 13) & 0x07)) << 16) | - ((((pixel16 >> 3) & 0xfc) | ((pixel16 >> 9) & 0x03)) << 8) | - (((pixel16 << 3) & 0xf8) | ((pixel16 >> 2) & 0x07)); - - PutULONG(pixel32, (unsigned char *) out32, imageByteOrder); - } - - out32++; - data16++; - } - return 1; -} - -int Unpack16(T_geometry *geometry, int src_depth, int src_width, int src_height, - unsigned char *src_data, int src_size, int dst_depth, int dst_width, - int dst_height, unsigned char *dst_data, int dst_size) -{ - int imageByteOrder = geometry -> image_byte_order; - - if (src_depth != 16) - { - #ifdef PANIC - *logofs << "Unpack16: PANIC! Cannot unpack colormapped image of source depth " - << src_depth << ".\n" << logofs_flush; - #endif - - return -1; - } - - int (*unpack)(const unsigned char *data, unsigned char *out, - unsigned char *end, int imageByteOrder); - - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - switch (dst_bpp) - { - case 16: - { - unpack = Unpack16To16; - - break; - } - case 24: - { - unpack = Unpack16To24; - - break; - } - case 32: - { - unpack = Unpack16To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack16: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 16/24/32 are supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (src_width == dst_width && src_height == dst_height) - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(src_data, dst_data, dst_end, imageByteOrder); - } - else if (src_width >= dst_width && src_height >= dst_height) - { - unsigned char *dst_end = dst_data; - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - dst_end += RoundUp4(dst_width * dst_bpp / 8); - - (*unpack)(src_data, dst_data, dst_end, imageByteOrder); - - src_data += src_width * 2; - } - } - else - { - #ifdef PANIC - *logofs << "Unpack16: PANIC! Cannot unpack image. " - << "Destination area " << dst_width << "x" - << dst_height << " is not fully contained in " - << src_width << "x" << src_height << " source.\n" - << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int Unpack24To24(const unsigned char *data, - unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack124To24: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - while (out < end) - { - *(out++) = *(data++); - } - - return 1; -} - -int Unpack24To32(const unsigned char *data, unsigned char *out, unsigned char *end) -{ - #ifdef TEST - *logofs << "Unpack24To32: Unpacking " << end - out - << " bytes of colormapped data.\n" - << logofs_flush; - #endif - - unsigned int *out32 = (unsigned int *) out; - unsigned int *end32 = (unsigned int *) end; - - while (out32 < end32) - { - if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x0) - { - *out32 = 0x0; - } - else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) - { - *out32 = 0xffffff; - } - else - { - *out32 = (data[2] << 16) | (data[1] << 8) | data[0]; - } - - out32 += 1; - data += 3; - } - - return 1; -} - -int Unpack24(T_geometry *geometry, int src_depth, int src_width, int src_height, - unsigned char *src_data, int src_size, int dst_depth, int dst_width, - int dst_height, unsigned char *dst_data, int dst_size) - -{ - if (src_depth != 24) - { - #ifdef PANIC - *logofs << "Unpack24: PANIC! Cannot unpack colormapped image of source depth " - << src_depth << ".\n" << logofs_flush; - #endif - - return -1; - } - - int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end); - - int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); - - switch (dst_bpp) - { - case 24: - { - unpack = Unpack24To24; - - break; - } - case 32: - { - unpack = Unpack24To32; - - break; - } - default: - { - #ifdef PANIC - *logofs << "Unpack24: PANIC! Bad destination bits per pixel " - << dst_bpp << ". Only 24/32 are supported.\n" - << logofs_flush; - #endif - - return -1; - } - } - - if (src_width == dst_width && src_height == dst_height) - { - unsigned char *dst_end = dst_data + dst_size; - - (*unpack)(src_data, dst_data, dst_end); - } - else if (src_width >= dst_width && src_height >= dst_height) - { - unsigned char *dst_end = dst_data; - - for (int y = 0; y < dst_height; y++) - { - dst_data = dst_end; - dst_end += RoundUp4(dst_width * dst_bpp / 8); - - (*unpack)(src_data, dst_data, dst_end); - - src_data += src_width * 3; - } - } - else - { - #ifdef PANIC - *logofs << "Unpack24: PANIC! Cannot unpack image. " - << "Destination area " << dst_width << "x" - << dst_height << " is not fully contained in " - << src_width << "x" << src_height << " source.\n" - << logofs_flush; - #endif - - return -1; - } - - return 1; -} - -int Unpack32To32(const T_colormask *colormask, const unsigned int *data, - unsigned int *out, unsigned int *end) -{ - #ifdef TEST - *logofs << "Unpack32To32: Unpacking " << end - out - << " bytes of data.\n" << logofs_flush; - #endif - - if (colormask -> correction_mask) - { - while (out < end) - { - if (*data == 0x00000000) - { - *out = 0x00000000; - } - else if (*data == 0xFFFFFFFF) - { - *out = 0xFFFFFFFF; - } - else - { - *out = *data | ((colormask -> correction_mask << 16) | - (colormask -> correction_mask << 8) | - colormask -> correction_mask); - } - - out += 1; - data += 1; - } - } - else - { - #ifdef TEST - *logofs << "Unpack32To32: Using bitwise copy due to null correction mask.\n" - << logofs_flush; - #endif - - memcpy((unsigned char *) out, (unsigned char *) data, end - out); - } - - return 1; -} diff --git a/nxcomp/Unpack.h b/nxcomp/Unpack.h deleted file mode 100644 index faaa41d82..000000000 --- a/nxcomp/Unpack.h +++ /dev/null @@ -1,149 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Unpack_H -#define Unpack_H - -#include "NXpack.h" - -#include "Z.h" - -#define LSBFirst 0 -#define MSBFirst 1 - -#define SPLIT_PATTERN 0x88 - -typedef ColorMask T_colormask; - -// -// Pixel geometry of channel's display. -// - -typedef struct -{ - unsigned int depth1_bpp; - unsigned int depth4_bpp; - unsigned int depth8_bpp; - unsigned int depth16_bpp; - unsigned int depth24_bpp; - unsigned int depth32_bpp; - - unsigned int red_mask; - unsigned int green_mask; - unsigned int blue_mask; - - unsigned int image_byte_order; - unsigned int bitmap_bit_order; - unsigned int scanline_unit; - unsigned int scanline_pad; - -} T_geometry; - -// -// Colormap is used to remap colors -// from source to destination depth. -// - -typedef struct -{ - unsigned int entries; - unsigned int *data; - -} T_colormap; - -// -// Alpha channel data is added to 32 -// bits images at the time they are -// unpacked. -// - -typedef struct -{ - unsigned int entries; - unsigned char *data; - -} T_alpha; - -// -// The ZLIB stream structure used for -// the decompression. -// - -extern z_stream unpackStream; - -// -// Initialize the ZLIB stream used for -// decompression. -// - -void UnpackInit(); - -// -// Free the ZLIB stream. -// - -void UnpackDestroy(); - -// -// Get the destination bits per pixel -// based on the drawable depth. -// - -int UnpackBitsPerPixel(T_geometry *geometry, unsigned int depth); - -// -// Unpack the source data into the X -// bitmap. -// - -int Unpack8(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -int Unpack16(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -int Unpack24(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -int Unpack8(T_geometry *geometry, T_colormap *colormap, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -int Unpack15(T_geometry *geometry, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -int Unpack16(T_geometry *geometry, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -int Unpack24(T_geometry *geometry, int src_depth, int src_width, - int src_height, unsigned char *src_data, int src_size, int dst_depth, - int dst_width, int dst_height, unsigned char *dst_data, int dst_size); - -#endif /* Unpack_H */ diff --git a/nxcomp/Vars.c b/nxcomp/Vars.c deleted file mode 100644 index 685969677..000000000 --- a/nxcomp/Vars.c +++ /dev/null @@ -1,54 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#include "NXvars.h" - -/* - * Allocate here instances of variables and - * pointers declared in NXvars.h. - */ - -int _NXHandleDisplayError = 0; - -NXDisplayErrorPredicate _NXDisplayErrorFunction = NULL; - -int _NXUnsetLibraryPath = 0; - -NXLostSequenceHandler _NXLostSequenceFunction = NULL; - -NXDisplayBlockHandler _NXDisplayBlockFunction = NULL; -NXDisplayWriteHandler _NXDisplayWriteFunction = NULL; -NXDisplayFlushHandler _NXDisplayFlushFunction = NULL; -NXDisplayStatisticsHandler _NXDisplayStatisticsFunction = NULL; - -#ifdef __cplusplus -} -#endif diff --git a/nxcomp/Version.c b/nxcomp/Version.c deleted file mode 100644 index ff1793434..000000000 --- a/nxcomp/Version.c +++ /dev/null @@ -1,97 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2015 Qindel Formacion y Servicios SL. */ -/* */ -/* This program is free software; you can redistribute it and/or modify */ -/* it under the terms of the GNU General Public License Version 2, as */ -/* published by the Free Software Foundation. */ -/* */ -/* This program is distributed in the hope that it will be useful, but */ -/* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- */ -/* BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */ -/* Public License for more details. */ -/* */ -/* You should have received a copy of the GNU General Public License */ -/* along with this program; if not, you can request a copy from Qindel */ -/* or write to the Free Software Foundation, Inc., 51 Franklin Street, */ -/* Fifth Floor, Boston, MA 02110-1301 USA. */ -/* */ -/* All rights reserved. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include "NX.h" - - -static int _NXVersionMajor = -1; -static int _NXVersionMinor = -1; -static int _NXVersionPatch = -1; -static int _NXVersionMaintenancePatch = -1; - - -const char* NXVersion() { - const char *version = VERSION; - return version; -} - -void _parseNXVersion() { - char version[32]; - int i; - strcpy(version, VERSION); - - char *value; - /* Reset values to 0 if undefined */ - _NXVersionMajor = _NXVersionMinor = _NXVersionPatch = _NXVersionMaintenancePatch = 0; - - -#define NXVERSIONSEPARATOR "." - value = strtok(version, NXVERSIONSEPARATOR); - - for (i = 0; value != NULL && i < 4; i++) - { - switch (i) - { - case 0: - _NXVersionMajor = atoi(value); - break; - - case 1: - _NXVersionMinor = atoi(value); - break; - - case 2: - _NXVersionPatch = atoi(value); - break; - - case 3: - _NXVersionMaintenancePatch = atoi(value); - break; - } - - value = strtok(NULL, NXVERSIONSEPARATOR); - } -} - -int NXMajorVersion() { - if (_NXVersionMajor == -1) - _parseNXVersion(); - return _NXVersionMajor; -} -int NXMinorVersion() { - if (_NXVersionMinor == -1) - _parseNXVersion(); - return _NXVersionMinor; -} -int NXPatchVersion() { - if (_NXVersionPatch == -1) - _parseNXVersion(); - return _NXVersionPatch; -} -int NXMaintenancePatchVersion() { - if (_NXVersionMaintenancePatch == -1) - _parseNXVersion(); - return _NXVersionMaintenancePatch; -} diff --git a/nxcomp/WriteBuffer.cpp b/nxcomp/WriteBuffer.cpp deleted file mode 100644 index 07d14fc30..000000000 --- a/nxcomp/WriteBuffer.cpp +++ /dev/null @@ -1,496 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include -#include -#include -#include - -#include "Misc.h" -#include "Control.h" - -#include "WriteBuffer.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -WriteBuffer::WriteBuffer() -{ - size_ = WRITE_BUFFER_DEFAULT_SIZE; - buffer_ = new unsigned char[size_]; - length_ = 0; - index_ = NULL; - - scratchLength_ = 0; - scratchBuffer_ = NULL; - scratchOwner_ = 1; - - initialSize_ = WRITE_BUFFER_DEFAULT_SIZE; - thresholdSize_ = WRITE_BUFFER_DEFAULT_SIZE << 1; - maximumSize_ = WRITE_BUFFER_DEFAULT_SIZE << 4; - - #ifdef VALGRIND - - memset(buffer_, '\0', size_); - - #endif -} - -WriteBuffer::~WriteBuffer() -{ - if (scratchOwner_ == 1 && - scratchBuffer_ != NULL) - { - delete [] scratchBuffer_; - } - - delete [] buffer_; -} - -void WriteBuffer::setSize(unsigned int initialSize, unsigned int thresholdSize, - unsigned int maximumSize) -{ - initialSize_ = initialSize; - thresholdSize_ = thresholdSize; - maximumSize_ = maximumSize; - - #ifdef TEST - *logofs << "WriteBuffer: Set buffer sizes to " - << initialSize_ << "/" << thresholdSize_ - << "/" << maximumSize_ << ".\n" - << logofs_flush; - #endif -} - -void WriteBuffer::partialReset() -{ - if (scratchBuffer_ != NULL) - { - if (scratchOwner_) - { - #ifdef DEBUG - *logofs << "WriteBuffer: Going to delete " - << scratchLength_ << " bytes from the " - << "scratch buffer.\n" << logofs_flush; - #endif - - delete [] scratchBuffer_; - } - - scratchLength_ = 0; - scratchBuffer_ = NULL; - scratchOwner_ = 1; - } - - length_ = 0; - index_ = NULL; - - #ifdef DEBUG - *logofs << "WriteBuffer: Performed partial reset with " - << size_ << " bytes in buffer.\n" - << logofs_flush; - #endif -} - -void WriteBuffer::fullReset() -{ - if (scratchBuffer_ != NULL) - { - if (scratchOwner_ == 1) - { - #ifdef DEBUG - *logofs << "WriteBuffer: Going to delete " - << scratchLength_ << " bytes from the " - << "scratch buffer.\n" << logofs_flush; - #endif - - delete [] scratchBuffer_; - } - - scratchLength_ = 0; - scratchBuffer_ = NULL; - scratchOwner_ = 1; - } - - length_ = 0; - index_ = NULL; - - if (size_ > initialSize_) - { - #ifdef TEST - *logofs << "WriteBuffer: Reallocating a new buffer of " - << initialSize_ << " bytes.\n" << logofs_flush; - #endif - - delete [] buffer_; - - size_ = initialSize_; - - buffer_ = new unsigned char[size_]; - - if (buffer_ == NULL) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't allocate memory for " - << "X messages in context [A].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "X messages in context [A].\n"; - - HandleAbort(); - } - - #ifdef VALGRIND - - memset(buffer_, '\0', size_); - - #endif - } - - #ifdef DEBUG - *logofs << "WriteBuffer: Performed full reset with " - << size_ << " bytes in buffer.\n" - << logofs_flush; - #endif -} - -unsigned char *WriteBuffer::addMessage(unsigned int numBytes) -{ - #ifdef DEBUG - *logofs << "WriteBuffer: Adding " << numBytes << " bytes to " - << length_ << " bytes already in buffer.\n" - << logofs_flush; - #endif - - if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't add a message of " - << numBytes << " bytes.\n" << logofs_flush; - - *logofs << "WriteBuffer: PANIC! Assuming error handling " - << "data in context [B].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't add a message of " - << numBytes << " bytes to write buffer.\n"; - - cerr << "Error" << ": Assuming error handling " - << "data in context [B].\n"; - - HandleAbort(); - } - else if (length_ + numBytes > size_) - { - unsigned int newSize = thresholdSize_; - - while (newSize < length_ + numBytes) - { - newSize <<= 1; - - if (newSize > maximumSize_) - { - newSize = length_ + numBytes + initialSize_; - } - } - - #ifdef TEST - *logofs << "WriteBuffer: Growing buffer from " - << size_ << " to " << newSize << " bytes.\n" - << logofs_flush; - #endif - - unsigned int indexOffset = 0; - - if (index_ && *index_) - { - indexOffset = *index_ - buffer_; - } - - size_ = newSize; - - unsigned char *newBuffer = new unsigned char[size_]; - - if (newBuffer == NULL) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't allocate memory for " - << "X messages in context [C].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "X messages in context [C].\n"; - - HandleAbort(); - } - - #ifdef TEST - if (newSize >= maximumSize_) - { - *logofs << "WriteBuffer: WARNING! Buffer grown to reach " - << "size of " << newSize << " bytes.\n" - << logofs_flush; - } - #endif - - #ifdef VALGRIND - - memset(newBuffer, '\0', size_); - - #endif - - memcpy(newBuffer, buffer_, length_); - - #ifdef DEBUG - *logofs << "WriteBuffer: Going to delete the " - << "old buffer with new size " << size_ - << ".\n" << logofs_flush; - #endif - - delete [] buffer_; - - buffer_ = newBuffer; - - if (index_ && *index_) - { - *index_ = buffer_ + indexOffset; - } - } - - unsigned char *result = buffer_ + length_; - - length_ += numBytes; - - #ifdef DEBUG - *logofs << "WriteBuffer: Bytes in buffer are " - << length_ << " while size is " << size_ - << ".\n" << logofs_flush; - #endif - - return result; -} - -unsigned char *WriteBuffer::removeMessage(unsigned int numBytes) -{ - #ifdef TEST - *logofs << "WriteBuffer: Removing " << numBytes - << " bytes from buffer.\n" << logofs_flush; - #endif - - if (numBytes > length_) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't remove " - << numBytes << " bytes with only " << length_ - << " bytes in buffer.\n" << logofs_flush; - #endif - - cerr << "Error" << ": Buffer underflow handling " - << "write buffer in context [D].\n"; - - HandleAbort(); - } - - length_ -= numBytes; - - #ifdef TEST - *logofs << "WriteBuffer: Bytes in buffer are now " - << length_ << " while size is " - << size_ << ".\n" << logofs_flush; - #endif - - return (buffer_ + length_); -} - -unsigned char *WriteBuffer::addScratchMessage(unsigned int numBytes) -{ - if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't add a message of " - << numBytes << " bytes.\n" << logofs_flush; - - *logofs << "WriteBuffer: PANIC! Assuming error handling " - << "data in context [E].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't add a message of " - << numBytes << " bytes to write buffer.\n"; - - cerr << "Error" << ": Assuming error handling " - << "data in context [E].\n"; - - HandleAbort(); - } - else if (scratchBuffer_ != NULL) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't add a message of " - << numBytes << " bytes with " << scratchLength_ - << " bytes already in scratch buffer.\n" - << logofs_flush; - - *logofs << "WriteBuffer: PANIC! Assuming error handling " - << "data in context [F].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't add a message of " - << numBytes << " bytes with " << scratchLength_ - << " bytes already in scratch buffer.\n"; - - cerr << "Error" << ": Assuming error handling " - << "data in context [F].\n"; - - HandleAbort(); - } - - #ifdef DEBUG - *logofs << "WriteBuffer: Adding " << numBytes << " bytes " - << "to scratch buffer.\n" << logofs_flush; - #endif - - unsigned char *newBuffer = new unsigned char[numBytes]; - - if (newBuffer == NULL) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't allocate memory for " - << "X messages in context [G].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't allocate memory for " - << "X messages in context [G].\n"; - - HandleAbort(); - } - - #ifdef VALGRIND - - memset(newBuffer, '\0', numBytes); - - #endif - - scratchBuffer_ = newBuffer; - scratchOwner_ = 1; - scratchLength_ = numBytes; - - return newBuffer; -} - -unsigned char *WriteBuffer::addScratchMessage(unsigned char *newBuffer, unsigned int numBytes) -{ - if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't add a message of " - << numBytes << " bytes.\n" << logofs_flush; - - *logofs << "WriteBuffer: PANIC! Assuming error handling " - << "data in context [H].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't add a message of " - << numBytes << " bytes to write buffer.\n"; - - cerr << "Error" << ": Assuming error handling " - << "data in context [H].\n"; - - HandleAbort(); - } - else if (scratchBuffer_ != NULL) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't add a foreign " - << "message of " << numBytes << " bytes with " - << scratchLength_ << " bytes already in " - << "scratch buffer.\n" << logofs_flush; - - *logofs << "WriteBuffer: PANIC! Assuming error handling " - << "data in context [I].\n" << logofs_flush; - #endif - - cerr << "Error" << ": Can't add a foreign message of " - << numBytes << " bytes with " << scratchLength_ - << " bytes already in scratch buffer.\n"; - - cerr << "Error" << ": Assuming error handling " - << "data in context [I].\n"; - - HandleAbort(); - } - - #ifdef DEBUG - *logofs << "WriteBuffer: Adding " << numBytes << " bytes " - << "from a foreign message to scratch buffer.\n" - << logofs_flush; - #endif - - scratchBuffer_ = newBuffer; - scratchLength_ = numBytes; - scratchOwner_ = 0; - - return newBuffer; -} - -void WriteBuffer::removeScratchMessage() -{ - #ifdef TEST - - if (scratchLength_ == 0 || scratchBuffer_ == NULL) - { - #ifdef PANIC - *logofs << "WriteBuffer: PANIC! Can't remove non existent scratch message.\n" - << logofs_flush; - #endif - - cerr << "Error" << ": Can't remove non existent scratch message.\n"; - - HandleAbort(); - } - - *logofs << "WriteBuffer: Removing " << scratchLength_ - << " bytes from scratch buffer.\n" - << logofs_flush; - - #endif - - if (scratchOwner_ == 1) - { - #ifdef DEBUG - *logofs << "WriteBuffer: Going to delete " - << scratchLength_ << " bytes from the " - << "scratch buffer.\n" << logofs_flush; - #endif - - delete [] scratchBuffer_; - } - - scratchLength_ = 0; - scratchBuffer_ = NULL; - scratchOwner_ = 1; -} diff --git a/nxcomp/WriteBuffer.h b/nxcomp/WriteBuffer.h deleted file mode 100644 index ce408e210..000000000 --- a/nxcomp/WriteBuffer.h +++ /dev/null @@ -1,134 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef WriteBuffer_H -#define WriteBuffer_H - -#include "Misc.h" - -#define PANIC -#define WARNING -#undef TEST -#undef DEBUG - -#define WRITE_BUFFER_DEFAULT_SIZE 16384 - -// -// Adjust for the biggest reply that we could receive. -// This is likely to be a reply to a X_ListFonts where -// user has a large amount of installed fonts. -// - -#define WRITE_BUFFER_OVERFLOW_SIZE 4194304 - -class WriteBuffer -{ - public: - - WriteBuffer(); - - ~WriteBuffer(); - - void setSize(unsigned int initialSize, unsigned int thresholdSize, - unsigned int maximumSize); - - unsigned char *addMessage(unsigned int numBytes); - - unsigned char *removeMessage(unsigned int numBytes); - - unsigned char *addScratchMessage(unsigned int numBytes); - - // - // This form allows user to provide its own - // buffer as write buffer's scratch area. - // - - unsigned char *addScratchMessage(unsigned char *newBuffer, unsigned int numBytes); - - void removeScratchMessage(); - - void partialReset(); - - void fullReset(); - - unsigned char *getData() const - { - return buffer_; - } - - unsigned int getLength() const - { - return length_; - } - - unsigned int getAvailable() const - { - return (size_ - length_); - } - - unsigned char *getScratchData() const - { - return scratchBuffer_; - } - - unsigned int getScratchLength() const - { - return scratchLength_; - } - - unsigned int getTotalLength() const - { - return (length_ + scratchLength_); - } - - void registerPointer(unsigned char **pointer) - { - index_ = pointer; - } - - void unregisterPointer() - { - index_ = 0; - } - - private: - - unsigned int size_; - unsigned int length_; - - unsigned char *buffer_; - unsigned char **index_; - - unsigned int scratchLength_; - unsigned char *scratchBuffer_; - - int scratchOwner_; - - unsigned int initialSize_; - unsigned int thresholdSize_; - unsigned int maximumSize_; -}; - -#endif /* WriteBuffer_H */ diff --git a/nxcomp/XidCache.cpp b/nxcomp/XidCache.cpp deleted file mode 100644 index 0f83d388f..000000000 --- a/nxcomp/XidCache.cpp +++ /dev/null @@ -1,47 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Control.h" - -#include "XidCache.h" - -XidCache::XidCache() -{ - for (int i = 0; i < 256; i++) - { - base_[i] = new IntCache(8); - } - - slot_ = 0; - last_ = 0; -} - -XidCache::~XidCache() -{ - for (int i = 0; i < 256; i++) - { - delete base_[i]; - } -} diff --git a/nxcomp/XidCache.h b/nxcomp/XidCache.h deleted file mode 100644 index 8a09ef9b1..000000000 --- a/nxcomp/XidCache.h +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef XidCache_H -#define XidCache_H - -#include "IntCache.h" - -class XidCache -{ - friend class EncodeBuffer; - friend class DecodeBuffer; - - public: - - XidCache(); - ~XidCache(); - - private: - - IntCache *base_[256]; - - unsigned int slot_; - unsigned int last_; -}; - -#endif /* XidCache_H */ diff --git a/nxcomp/Z.cpp b/nxcomp/Z.cpp deleted file mode 100644 index 35850b9d0..000000000 --- a/nxcomp/Z.cpp +++ /dev/null @@ -1,142 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#include "Z.h" -#include "Misc.h" - -int ZCompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, - const unsigned char *source, unsigned int sourceLen) -{ - // - // Deal with the possible overflow. - // - - if (stream -> total_out & 0x80000000) - { - #ifdef TEST - *logofs << "ZCompress: Reset stream counters with " - << "total in " << stream -> total_in - << " and total out " << stream -> total_out - << ".\n" << logofs_flush; - #endif - - stream -> total_in = 0; - stream -> total_out = 0; - } - - unsigned int saveOut = stream -> total_out; - - stream -> next_in = (Bytef *) source; - stream -> avail_in = sourceLen; - - // - // Check if the source is bigger than - // 64K on 16-bit machine. - // - - #ifdef MAXSEG_64K - - if ((uLong) stream -> avail_in != sourceLen) return Z_BUF_ERROR; - - #endif - - stream -> next_out = dest; - stream -> avail_out = *destLen; - - #ifdef MAXSEG_64K - - if ((uLong) stream -> avail_out != *destLen) return Z_BUF_ERROR; - - #endif - - int result = deflate(stream, Z_FINISH); - - if (result != Z_STREAM_END) - { - deflateReset(stream); - - return (result == Z_OK ? Z_BUF_ERROR : result); - } - - *destLen = stream -> total_out - saveOut; - - result = deflateReset(stream); - - return result; -} - -int ZDecompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, - const unsigned char *source, unsigned int sourceLen) -{ - stream -> next_in = (Bytef *) source; - stream -> avail_in = sourceLen; - - // - // Deal with the possible overflow. - // - - if (stream -> total_out & 0x80000000) - { - #ifdef TEST - *logofs << "ZDecompress: Reset stream counters with " - << "total in " << stream -> total_in - << " and total out " << stream -> total_out - << ".\n" << logofs_flush; - #endif - - stream -> total_in = 0; - stream -> total_out = 0; - } - - unsigned int saveOut = stream -> total_out; - - if (stream -> avail_in != sourceLen) - { - return Z_BUF_ERROR; - } - - stream -> next_out = dest; - stream -> avail_out = *destLen; - - if (stream -> avail_out != *destLen) - { - return Z_BUF_ERROR; - } - - int result = inflate(stream, Z_FINISH); - - if (result != Z_STREAM_END) - { - inflateReset(stream); - - return (result == Z_OK ? Z_BUF_ERROR : result); - } - - *destLen = stream -> total_out - saveOut; - - result = inflateReset(stream); - - return result; -} diff --git a/nxcomp/Z.h b/nxcomp/Z.h deleted file mode 100644 index 3a6d684c2..000000000 --- a/nxcomp/Z.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* NXCOMP, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE.nxcomp which comes in the */ -/* source distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -#ifndef Z_H -#define Z_H - -#include - -int ZCompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, - const unsigned char *source, unsigned int sourceLen); - -int ZDecompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, - const unsigned char *source, unsigned int sourceLen); - -#endif /* Z_H */ diff --git a/nxcomp/configure.ac b/nxcomp/configure.ac new file mode 100644 index 000000000..87087f32d --- /dev/null +++ b/nxcomp/configure.ac @@ -0,0 +1,83 @@ +# *************************************************************************** +# *** configure.ac for nxcomp *** +# *************************************************************************** + +m4_define([nxcomp_version], m4_esyscmd([tr -d '\n' < VERSION])) + +# Initialize Autoconf +AC_PREREQ(2.60) + +AC_INIT([libXcomp], [nxcomp_version], [https://github.com/ArcticaProject/nx-libs/issues]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_PROG_CXX +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([config.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AM_INIT_AUTOMAKE([foreign no-dist-gzip dist-xz]) + +# Initialize libtool +AC_PROG_LIBTOOL + +COMP_VERSION=nxcomp_version +AC_SUBST([COMP_VERSION]) + +LT_COMP_VERSION=[`echo $COMP_VERSION | sed -r -e 's/^([0-9]+\.[0-9]+\.[0-9]+).*$/\1/' -e 's/\./:/g'`] +AC_SUBST([LT_COMP_VERSION]) + +PKG_CHECK_MODULES(JPEG, libjpeg) +PKG_CHECK_MODULES(PNG, libpng) +PKG_CHECK_MODULES(Z, zlib) + +# Upstream's pkg.m4 (since 0.27) offers this now, but define our own +# compatible version in case the local version of pkgconfig isn't new enough. +# https://bugs.freedesktop.org/show_bug.cgi?id=48743 +m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], + [AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], + [install directory for nxcompshad.pc pkg-config file])], + [],[with_pkgconfigdir='$(libdir)/pkgconfig']) + AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])]) + +AC_LANG([C++]) +NX_COMPILER_BRAND +NX_COMPILER_FLAGS + +NX_BUILD_ON_CYGWIN32 +NX_BUILD_ON_AMD64 +NX_BUILD_ON_DARWIN +NX_BUILD_ON_SUN +NX_BUILD_ON_FreeBSD + +# Build PIC libraries. + +if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then + CXXFLAGS="$CXXFLAGS -fPIC" + CFLAGS="$CFLAGS -fPIC" +fi + +# On FreeBSD search libraries and includes under /usr/local. + +if test "$FreeBSD" = yes; then + LIBS="$LIBS -L/usr/local/lib" + CPPFLAGS="$CPPFLAGS -I/usr/local/include" +fi + +NX_HAS_INADDRT + +# If in_addr_t is not defined use unsigned int. + +if test "$INADDRT" != yes ; then + echo -e "using unsigned int for type in_addr_t" + CPPFLAGS="$CPPFLAGS -DIN_ADDR_T=unsigned" +else + CPPFLAGS="$CPPFLAGS -DIN_ADDR_T=in_addr_t" +fi + +AC_CONFIG_FILES([ +Makefile +src/Makefile +nxcomp.pc +]) + +AC_OUTPUT diff --git a/nxcomp/configure.in b/nxcomp/configure.in deleted file mode 100644 index 8be604836..000000000 --- a/nxcomp/configure.in +++ /dev/null @@ -1,413 +0,0 @@ -dnl /**************************************************************************/ -dnl /* */ -dnl /* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -dnl /* Copyright (c) 2008-2014 Oleksandr Shneyder */ -dnl /* Copyright (c) 2014-2016 Ulrich Sibiller */ -dnl /* Copyright (c) 2014-2016 Mihai Moldovan */ -dnl /* Copyright (c) 2011-2016 Mike Gabriel */ -dnl /* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -dnl /* */ -dnl /* NXCOMP, NX protocol compression and NX extensions to this software */ -dnl /* are copyright of the aforementioned persons and companies. */ -dnl /* */ -dnl /* Redistribution and use of the present software is allowed according */ -dnl /* to terms specified in the file LICENSE.nxcomp which comes in the */ -dnl /* source distribution. */ -dnl /* */ -dnl /* All rights reserved. */ -dnl /* */ -dnl /* NOTE: This software has received contributions from various other */ -dnl /* contributors, only the core maintainers and supporters are listed as */ -dnl /* copyright holders. Please contact us, if you feel you should be listed */ -dnl /* as copyright holder, as well. */ -dnl /* */ -dnl /**************************************************************************/ - - -dnl Process this file with autoconf to produce a configure script. - -dnl Prolog - -AC_INIT(NX.h) -AC_PREREQ(2.13) - -pkgconfigdir=${libdir}/pkgconfig -AC_SUBST(pkgconfigdir) - -dnl Set our default compilation flags. - -if test "x$CXXFLAGS" = "x"; then - CXXFLAGS="-O3 -fno-rtti -fno-exceptions" -fi -if test "x$CFLAGS" = "x"; then - CFLAGS="$CFLAGS -O3" -fi - -dnl Reset default linking directives. - -LIBSTATIC="" -LIBSHARED="" - -dnl Prefer headers and libraries from nx-X11, if present. - -if test -d "../nx-X11/include" ; then - CXXFLAGS="$CXXFLAGS -I../nx-X11/exports/include" - CFLAGS="$CFLAGS -I../nx-X11/exports/include" - LIBS="$LIBS -L../nx-X11/exports/lib" -fi - -dnl Check whether --with-ipaq was given. - -if test "${with_ipaq}" = yes; then - echo -e "enabling IPAQ configuration" - CXX="arm-linux-c++" - CC="arm-linux-gcc" - unset ac_cv_prog_armcxx - unset ac_cv_prog_armcc - unset ac_cv_prog_CXXCPP - AC_CHECK_PROG([armcxx],["$CXX"],[yes],[no],[$PATH]) - AC_CHECK_PROG([armcc],["$CC"],[yes],[no],[$PATH]) - if test $armcxx = "yes" && test $armcc = "yes" ; then - ac_cv_prog_CXX="$CXX" - ac_cv_prog_CC="$CC" - else - AC_MSG_ERROR(Installation or configuration problem. Cannot find compiler for arm-linux.) - fi -else - unset ac_cv_prog_CXX - unset ac_cv_prog_CC - unset ac_cv_prog_CXXCPP -fi - -dnl Check for programs. - -AC_PROG_CXX -AC_PROG_CC -AC_LANG_CPLUSPLUS - -dnl Check whether option -Wno-deprecated -dnl is needed by GCC compiler. - -AC_MSG_CHECKING([whether compiler needs -Wno-deprecated]) -gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1` -case "${gcc_version}" in - gcc*) - AC_MSG_RESULT([yes]) - CXXFLAGS="$CXXFLAGS -Wno-deprecated" - ;; - - *) - AC_MSG_RESULT([no]) - ;; -esac - -AC_MSG_CHECKING([whether compiler accepts -Wmissing-declarations]) -gcc_version=`${CC} --version | grep 'gcc (GCC) [[3-4]].' | head -n 1` -case "${gcc_version}" in - gcc*) - AC_MSG_RESULT([no]) - ;; - - *) - AC_MSG_RESULT([yes]) - CXXFLAGS="$CXXFLAGS -Wmissing-declarations" - ;; -esac - -dnl Check for BSD compatible install. - -AC_PROG_INSTALL - -dnl Check for extra header files. - -AC_PATH_XTRA - -dnl Custom addition. - -ac_help="$ac_help - --with-symbols add the -g flag to produce the debug symbols - --with-use-malloc add the __USE_MALLOC flag to avoid the STL allocators - --with-info define INFO at compile time to get basic log output - --with-valgrind clean up allocated buffers to avoid valgrind warnings - --with-version use this version for produced libraries - - --with-static-png enable static linking of PNG library - --with-static-jpeg enable static linking of JPEG library - --with-static-z enable static linking of Z library" - -dnl Check to see if we're running under Cygwin32. - -AC_DEFUN(nxconf_CYGWIN32, -[AC_CACHE_CHECK(for Cygwin32 environment, nxconf_cv_cygwin32, -[AC_TRY_COMPILE(,[return __CYGWIN32__;], -nxconf_cv_cygwin32=yes, nxconf_cv_cygwin32=no) -rm -f conftest*]) -CYGWIN32= -test "$nxconf_cv_cygwin32" = yes && CYGWIN32=yes]) -nxconf_CYGWIN32 - -dnl Check whether we're building on a AMD64. - -AC_DEFUN(nxconf_AMD64, -[AC_CACHE_CHECK(for Amd64 environment, nxconf_cv_amd64, -[AC_TRY_COMPILE(,[return (__amd64__ || __x86_64__);], -nxconf_cv_amd64=yes, nxconf_cv_amd64=no) -rm -f conftest*]) -AMD64= -test "$nxconf_cv_amd64" = yes && AMD64=yes]) -nxconf_AMD64 - -dnl Check for Darwin environment. - -AC_DEFUN(nxconf_DARWIN, -[AC_CACHE_CHECK(for Darwin environment, nxconf_cv_darwin, -[AC_TRY_COMPILE(,[return __APPLE__;], -nxconf_cv_darwin=yes, nxconf_cv_darwin=no) -rm -f conftest*]) -DARWIN= -test "$nxconf_cv_darwin" = yes && DARWIN=yes]) -nxconf_DARWIN - -dnl Check to see if we're running under Solaris. - -AC_DEFUN(nxconf_SUN, -[AC_CACHE_CHECK(for Solaris environment, nxconf_cv_sun, -[AC_TRY_COMPILE(,[return __sun;], -nxconf_cv_sun=yes, nxconf_cv_sun=no) -rm -f conftest*]) -SUN= -test "$nxconf_cv_sun" = yes && SUN=yes]) -nxconf_SUN - -dnl Check to see if we're running under FreeBSD. - -AC_DEFUN(nxconf_FreeBSD, -[AC_CACHE_CHECK(for FreeBSD environment, nxconf_cv_freebsd, -[AC_TRY_COMPILE(,[return __FreeBSD__;], -nxconf_cv_freebsd=yes, nxconf_cv_freebsd=no) -rm -f conftest*]) -FreeBSD= -test "$nxconf_cv_freebsd" = yes && FreeBSD=yes]) -nxconf_FreeBSD - -dnl Build PIC libraries. - -if test "$CYGWIN32" != yes -a "$DARWIN" != yes; then - CXXFLAGS="$CXXFLAGS -fPIC" - CFLAGS="$CFLAGS -fPIC" -fi - -dnl Solaris requires the socket and gcc_s libs explicitly linked. -dnl Note also that headers from default /usr/openwin/include/X11 -dnl cause a warning due to pragma in Xmd.h. - -if test "$SUN" = yes; then - LIBS="$LIBS -L/usr/sfw/lib -lsocket " - CXXFLAGS="$CXXFLAGS -I/usr/sfw/include" - CFLAGS="$CFLAGS -I/usr/sfw/include" -fi - -dnl On FreeBSD search libraries and includes under /usr/local. - -if test "$FreeBSD" = yes; then - LIBS="$LIBS -L/usr/local/lib" - CXXFLAGS="$CXXFLAGS -I/usr/local/include" - CFLAGS="$CFLAGS -I/usr/local/include" -fi - -dnl Under Darwin we don't have support for -soname option and -dnl we need the -dynamiclib flag. Under Solaris, instead, we need -dnl the options -G -h. - -if test "$DARWIN" = yes; then - LDFLAGS="$LDFLAGS -dynamiclib" -elif test "$SUN" = yes; then - LDFLAGS="$LDFLAGS -G -h \$(LIBLOAD)" -else - LDFLAGS="$LDFLAGS -Wl,-soname,\$(LIBLOAD)" -fi - -dnl Check to see if in_addr_t is defined. -dnl Could use a specific configure test. - -AC_DEFUN(nxconf_INADDRT, -[AC_CACHE_CHECK(for in_addr_t, nxconf_cv_inaddrt, -[AC_TRY_COMPILE([#include ],[in_addr_t t; t = 1; return t;], -nxconf_cv_inaddrt=yes, nxconf_cv_inaddrt=no) -rm -f conftest*]) -INADDRT= -test "$nxconf_cv_inaddrt" = yes && INADDRT=yes]) -nxconf_INADDRT - -dnl If in_addr_t is not defined use unsigned int. - -if test "$INADDRT" != yes ; then - echo -e "using unsigned int for type in_addr_t" - CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=unsigned" - CFLAGS="$CFLAGS -DIN_ADDR_T=unsigned" -else - CXXFLAGS="$CXXFLAGS -DIN_ADDR_T=in_addr_t" - CFLAGS="$CFLAGS -DIN_ADDR_T=in_addr_t" -fi - -dnl Check whether --with-version was given. - -AC_SUBST(LIBVERSION) -AC_SUBST(VERSION) -if test "${with_version}" = yes; then - VERSION=${ac_option} -else - VERSION=`cat VERSION` -fi -echo -e "compiling version ${VERSION}" - -LIBVERSION=`echo ${VERSION} | cut -d '.' -f 1` - -CXXFLAGS="$CXXFLAGS -DVERSION=\\\"${VERSION}\\\"" -CFLAGS="$CFLAGS -DVERSION=\\\"${VERSION}\\\"" - -dnl Check whether --with-static-png was given and -dnl add -lpng or libpng.a to linking. - -if test "${with_static_png}" = yes; then - echo -e "enabling static linking of PNG library" - if test "$SUN" = yes && test -f "/usr/sfw/lib/libpng.a"; then - LIBSTATIC="$LIBSTATIC /usr/sfw/lib/libpng.a" - else - if test -f "/usr/lib/libpng.a" ; then - LIBSTATIC="$LIBSTATIC /usr/lib/libpng.a" - else - if test -f "/usr/local/lib/libpng.a" ; then - echo -e "assuming libpng.a in /usr/local/lib" - LIBSTATIC="$LIBSTATIC /usr/local/lib/libpng.a" - else - echo -e "Warning: assuming libpng.a in the local path" - LIBSTATIC="$LIBSTATIC libpng.a" - fi - fi - fi -else - echo -e "enabling dynamic linking of PNG library" - LIBSHARED="$LIBSHARED -lpng" -fi - -dnl Check whether --with-static-jpeg was given and -dnl add -ljpeg or libjpeg.a to linking. - -if test "${with_static_jpeg}" = yes; then - echo -e "enabling static linking of JPEG library" - if test "$SUN" = yes && test -f "/usr/sfw/lib/libjpeg.a"; then - LIBSTATIC="$LIBSTATIC /usr/sfw/lib/libjpeg.a" - else - if test -f "/usr/lib/libjpeg.a" ; then - LIBSTATIC="$LIBSTATIC /usr/lib/libjpeg.a" - else - if test -f "/usr/local/lib/libjpeg.a" ; then - echo -e "assuming libjpeg.a in /usr/local/lib" - LIBSTATIC="$LIBSTATIC /usr/local/lib/libjpeg.a" - else - echo -e "Warning: assuming libjpeg.a in the local path" - LIBSTATIC="$LIBSTATIC libjpeg.a" - fi - fi - fi -else - echo -e "enabling dynamic linking of JPEG library" - LIBSHARED="$LIBSHARED -ljpeg" -fi - -dnl Check whether --with-static-z was given and -dnl add -lz or libz.a to linking. - -if test "${with_static_z}" = yes; then - echo -e "enabling static linking of Z library" - if test "$SUN" = yes && test -f "/usr/sfw/lib/libz.a"; then - LIBSTATIC="$LIBSTATIC /usr/sfw/lib/libz.a" - else - if test -f "/usr/lib/libz.a" ; then - LIBSTATIC="$LIBSTATIC /usr/lib/libz.a" - else - if test -f "/usr/local/lib/libz.a" ; then - echo -e "assuming libz.a in /usr/local/lib" - LIBSTATIC="$LIBSTATIC /usr/local/lib/libz.a" - else - echo -e "Warning: assuming libz.a in the local path" - LIBSTATIC="$LIBSTATIC libz.a" - fi - fi - fi -else - echo -e "enabling dynamic linking of Z library" - LIBSHARED="$LIBSHARED -lz" -fi - -dnl Finally compose the LIB variable. - -if test "$DARWIN" = yes ; then - LIBS="$LIBS $LIBSTATIC $LIBSHARED" -elif test "$SUN" = yes ; then - LIBS="$LIBS $LIBSTATIC $LIBSHARED" -else - LIBS="$LIBS $LIBSTATIC -shared $LIBSHARED" -fi - -dnl Check whether --with-symbols or --without-symbols was -dnl given and set the required optimization level. - -if test "${with_symbols}" = yes; then - echo -e "enabling production of debug symbols" - CXXFLAGS="-g $CXXFLAGS" - CFLAGS="-g $CFLAGS" -else - echo -e "disabling production of debug symbols" -fi - -dnl Check whether --with-use-malloc or --without-use-malloc -dnl was given. - -if test "${with_use_malloc}" = yes; then - echo -e "disabling use of the STL allocators" - CXXFLAGS="$CXXFLAGS -D__USE_MALLOC" -else - echo -e "enabling use of the STL allocators" -fi - -dnl Check whether --with-info or --without-info was given. - -if test "${with_info}" = yes; then - echo -e "enabling info output in the log file" - CXXFLAGS="$CXXFLAGS -DINFO" - CFLAGS="$CFLAGS -DINFO" -else - echo -e "disabling info output in the log file" -fi - -dnl Check whether --with-valgrind or --without-valgrind was given. - -if test "${with_valgrind}" = yes; then - echo -e "enabling valgrind memory checker workarounds" - CXXFLAGS="$CXXFLAGS -DVALGRIND" - CFLAGS="$CFLAGS -DVALGRIND" -else - echo -e "disabling valgrind memory checker workarounds" -fi - -dnl Find makedepend somewhere. - -AC_SUBST(MAKEDEPEND) -MAKEDEPEND="$(which makedepend)" - -dnl Determine what to build based on the platform. -dnl Override the LIBS settings on Cygwin32 so that -dnl we always link with the exact set of libraries. - -AC_SUBST(ALL) - -if test "$CYGWIN32" = yes; then - ALL="\$(LIBCYGARCHIVE) \$(LIBCYGSHARED) \$(LIBARCHIVE)" - LIBS="-lstdc++ -lpng -ljpeg -lz" -else - ALL="\$(LIBFULL) \$(LIBLOAD) \$(LIBSHARED) \$(LIBARCHIVE)" -fi - -AC_OUTPUT(Makefile nxcomp.pc) diff --git a/nxcomp/include/MD5.h b/nxcomp/include/MD5.h new file mode 100644 index 000000000..698c995d8 --- /dev/null +++ b/nxcomp/include/MD5.h @@ -0,0 +1,91 @@ +/* + Copyright (C) 1999, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.h,v 1.4 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.h is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Removed support for non-ANSI compilers; removed + references to Ghostscript; clarified derivation from RFC 1321; + now handles byte order either statically or dynamically. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5); + added conditionalization for C++ compilation from Martin + Purschke . + 1999-05-03 lpd Original version. + */ + +#ifndef md5_INCLUDED +# define md5_INCLUDED + +/* + * This package supports both compile-time and run-time determination of CPU + * byte order. If ARCH_IS_BIG_ENDIAN is defined as 0, the code will be + * compiled to run only on little-endian CPUs; if ARCH_IS_BIG_ENDIAN is + * defined as non-zero, the code will be compiled to run only on big-endian + * CPUs; if ARCH_IS_BIG_ENDIAN is not defined, the code will be compiled to + * run on either big- or little-endian CPUs, but will run slightly less + * efficiently on either one than if ARCH_IS_BIG_ENDIAN is defined. + */ + +typedef unsigned char md5_byte_t; /* 8-bit byte */ +typedef unsigned int md5_word_t; /* 32-bit word */ + +/* Define the state of the MD5 Algorithm. */ +typedef struct md5_state_s { + md5_word_t count[2]; /* message length in bits, lsw first */ + md5_word_t abcd[4]; /* digest buffer */ + md5_byte_t buf[64]; /* accumulate block */ +} md5_state_t; + +#ifdef __cplusplus +extern "C" +{ +#endif + +/* Initialize the algorithm. */ +void md5_init(md5_state_t *pms); + +/* Append a string to the message. */ +void md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes); + +/* Finish the message and return the digest. */ +void md5_finish(md5_state_t *pms, md5_byte_t digest[16]); + +#ifdef __cplusplus +} /* end extern "C" */ +#endif + +#endif /* md5_INCLUDED */ diff --git a/nxcomp/include/NX.h b/nxcomp/include/NX.h new file mode 100644 index 000000000..7ec79b4b1 --- /dev/null +++ b/nxcomp/include/NX.h @@ -0,0 +1,471 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NX_H +#define NX_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include +#include +#include +#include + +#define NX_FD_ANY -1 + +#define NX_MODE_ANY -1 +#define NX_MODE_CLIENT 1 +#define NX_MODE_SERVER 2 + +#define NX_DISPLAY_ANY NULL + +#define NX_SIGNAL_ANY -1 +#define NX_SIGNAL_ENABLE 1 +#define NX_SIGNAL_DISABLE 2 +#define NX_SIGNAL_RAISE 3 +#define NX_SIGNAL_FORWARD 4 + +#define NX_POLICY_IMMEDIATE 1 +#define NX_POLICY_DEFERRED 2 + +#define NX_ALERT_REMOTE 0 +#define NX_ALERT_LOCAL 1 + +#define NX_HANDLER_FLUSH 0 +#define NX_HANDLER_STATISTICS 1 + +#define NX_STATISTICS_PARTIAL 0 +#define NX_STATISTICS_TOTAL 1 + +#define NX_CHANNEL_X11 0 +#define NX_CHANNEL_CUPS 1 +#define NX_CHANNEL_SMB 2 +#define NX_CHANNEL_MEDIA 3 +#define NX_CHANNEL_HTTP 4 +#define NX_CHANNEL_FONT 5 +#define NX_CHANNEL_SLAVE 6 + +#define NX_FILE_SESSION 0 +#define NX_FILE_ERRORS 1 +#define NX_FILE_OPTIONS 2 +#define NX_FILE_STATS 3 + +/* + * The following are the new interfaces to the NX transport. The + * NX proxy software is now intended to be run as a library of a + * higher level communication manager (nxssh, nxhttp, nxrtp, etc, + * not only nxproxy). This is a work-in-progress, so expect these + * interfaces to change in future. At the present moment, as an + * example, there is no provision for creating and managing mul- + * tiple proxy connections. + */ + +/* + * Attach a NX transport to the provided descriptor. This should be + * done after having created a pair of connected sockets. + */ + +extern int NXTransCreate(int fd, int mode, const char *options); + +/* + * Tell the proxy to use the second descriptor as its own end of + * the internal connection to the NX agent. The NX agent will use + * the first descriptor. Setting an agent connection will have the + * effect of disabling further X client connections and, if it is + * possible, will trigger the use of the memory-to-memory transport. + */ + +extern int NXTransAgent(int fd[2]); + +/* + * Prepare the file sets and the timeout for a later execution of + * the select(). The masks and the timeout must persist across all + * the calls, so if you don't need any of the values, it is requi- + * red that you create empty masks and a default timeout. To save + * a check at each run, all the functions below assume that valid + * pointers are passed. + */ + +extern int NXTransPrepare(int *maxfds, fd_set *readfds, + fd_set *writefds, struct timeval *timeout); + +/* + * Call select() to find out the descriptors in the sets having + * pending data. + */ + +extern int NXTransSelect(int *result, int *error, int *maxfds, fd_set *readfds, + fd_set *writefds, struct timeval *timeout); + +/* + * Perform the required I/O on all the NX descriptors having pen- + * ding data. This can include reading and writing to the NX chan- + * nels, encoding and decoding the proxy data or managing any of + * the other NX resources. + */ + +extern int NXTransExecute(int *result, int *error, int *maxfds, fd_set *readfds, + fd_set *writefds, struct timeval *timeout); + +/* + * Run an empty loop, giving to the NX transport a chance to check + * its descriptors. + */ + +extern int NXTransContinue(struct timeval *timeout); + +/* + * Perform I/O on the given descriptors. If memory-to-memory trans- + * port has been activated and the descriptor is recognized as a + * valid agent connection, then the functions will read and write + * the data directly to the proxy buffer, otherwise the correspond- + * ing network operation will be performed. + */ + +extern int NXTransRead(int fd, char *data, int size); +extern int NXTransWrite(int fd, char *data, int size); +extern int NXTransReadable(int fd, int *readable); + +extern int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize); +extern int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize); + +extern int NXTransClose(int fd); + +/* + * Return true if the NX transport is running. The fd parameter can + * be either the local descriptor attached to the NX transport or + * NX_FD_ANY. + */ + +extern int NXTransRunning(int fd); + +/* + * Close down the NX transport and free all the allocated resources. + * The fd parameter can be either the local descriptor or NX_FD_ANY. + * This must be explicitly called by the agent before the proxy can + * start the tear down procedure. + */ + +extern int NXTransDestroy(int fd); + +/* + * Tell to the proxy how to handle the standard POSIX signals. For + * example, given the SIGINT signal, the caller can specify any of + * the following actions: + * + * NX_SIGNAL_ENABLE: A signal handler will have to be installed by + * the library, so that it can be intercepted by + * the proxy. + * + * NX_SIGNAL_DISABLE: The signal will be handled by the caller and, + * eventually, forwarded to the proxy by calling + * NXTransSignal() explicitly. + * + * NX_SIGNAL_RAISE: The signal must be handled now, as if it had + * been delivered by the operating system. This + * function can be called by the agent with the + * purpose of propagating a signal to the proxy. + * + * NX_SIGNAL_FORWARD: A signal handler will have to be installed by + * the library but the library will have to call + * the original signal handler when the signal + * is received. + * + * As a rule of thumb, agents should let the proxy handle SIGUSR1 + * and SIGUSR2, used for producing the NX protocol statistics, and + * SIGHUP, used for disconnecting the NX transport. + * + * The following signals are blocked by default upon creation of the + * NX transport: + * + * SIGCHLD These signals should be always put under the control + * SIGUSR1 of the proxy. If agents are intercepting them, agents + * SIGUSR2 should later call NXTransSignal(..., NX_SIGNAL_RAISE) + * SIGHUP to forward the signal to the proxy. As an alternative + * they can specify a NX_SIGNAL_FORWARD action, so they, + * in turn, can be notified about the signal. This can + * be especially useful for SIGCHLD. + * + * SIGINT These signals should be intercepted by agents. Agents + * SIGTERM should ensure that NXTransDestroy() is called before + * exiting, to give the proxy a chance to shut down the + * NX transport. + * + * SIGPIPE This signal is blocked by the proxy, but not used to + * implement any functionality. It can be handled by the + * NX agent without affecting the proxy. + * + * SIGALRM This is now used by the proxy and agents should not + * redefine it. Agents can use the signal to implement + * their own timers but should not interleave calls to + * the NX transport and should restore the old handler + * when the timeout is raised. + * + * SIGVTALRM These signals are not used but may be used in future + * SIGWINCH versions of the library. + * SIGIO + * SIGTSTP + * SIGTTIN + * SIGTTOU + * + * By calling NXTransSignal(..., NX_SIGNAL_DISABLE) nxcomp will res- + * tore the signal handler that was saved at the time the proxy hand- + * ler was installed. This means that you should call the function + * just after the XOpenDisplay() or any other function used to init- + * ialize the NX transport. + */ + +extern int NXTransSignal(int signal, int action); + +/* + * Return a value between 0 and 9 indicating the congestion level + * based on the tokens still available. A value of 9 means that + * the link is congested and no further data can be sent. + */ + +extern int NXTransCongestion(int fd); + +/* + * Let the application to be notified by the proxy when an event oc- + * curs. The parameter, as set at the time the handler is installed, + * is passed each time to the callback function. The parameter is + * presumably the display pointer, given that at the present moment + * the NX transport doesn't have access to the display structure and + * so wouldn't be able to determine the display to pass to the call- + * back function. + * + * NX_HANDLER_FLUSH: The handler function is called when some + * more data has been written to the proxy + * link. + * + * The data is the number of bytes written. + * + * NX_HANDLER_STATISTICS: This handler is called to let the agent + * include arbitrary data in the transport + * statistics. The parameter, in this case, + * is a pointer to a pointer to a null term- + * inated string. The pointer is set at the + * time the handler is registered. The point- + * ed string will have to be filled by the + * agent with its statistics data. + * + * The data can be NX_STATISTICS_PARTIAL or NX_STATISTICS_TOTAL. The + * agent can refer to the value by using the NXStatisticsPartial and + * NXStatisticsTotal constants defined in NXvars.h. + * + * Note that these interfaces are used by Xlib and nxcompext. Agents + * should never call these interfaces directly, but use the nxcompext + * wrapper. + */ + +extern int NXTransHandler(int fd, int type, void (*handler)(void *parameter, + int reason), void *parameter); + +/* + * Set the policy to be used by the NX transport to write data to the + * proxy link: + * + * NX_POLICY_IMMEDIATE: When set to immediate, the proxy will try to + * write the data just after having encoded it. + * + * NX_POLICY_DEFERRED: When policy is set to deferred, data will be + * accumulated in a buffer and written to the + * remote proxy when NXTransFlush() is called by + * the agent. + */ + +extern int NXTransPolicy(int fd, int type); + +/* + * Query the number of bytes that have been accumulated for a deferred + * flush. + */ + +extern int NXTransFlushable(int fd); + +/* + * Tell to the NX transport to write all the accumulated data to the + * remote proxy. + */ + +extern int NXTransFlush(int fd); + +/* + * Create a new channel of the given type. It returns 1 on success, + * 0 if the NX transport is not running, or -1 in the case of error. + * On success, the descriptor provided by the caller can be later + * used for the subsequent I/O. The type parameter not only tells to + * the proxy the remote port where the channel has to be connected, + * but also gives a hint about the type of data that will be carried + * by the channel, so that the proxy can try to optimize the traffic + * on the proxy link. + * + * NX_CHANNEL_X: The channel will carry X traffic and it + * will be connected to the remote X display. + * + * NX_CHANNEL_CUPS: The channel will carry CUPS/IPP protocol. + * + * NX_CHANNEL_SMB: The channel will carry SMB/CIFS protocol. + * + * NX_CHANNEL_MEDIA: The channel will transport audio or other + * multimedia data. + * + * NX_CHANNEL_HTTP: The channel will carry HTTP protocol. + * + * NX_CHANNEL_FONT: The channel will forward a X font server + * connection. + * + * Only a proxy running at the NX server/X client side will be able + * to create a X, CUPS, SMB, MEDIA and HTTP channel. A proxy running + * at the NX client/X server side can create font server connections. + * The channel creation will also fail if the remote end has not been + * set up to forward the connection. + * + * To create a new channel the agent will have to set up a socketpair + * and pass to the proxy one of the socket descriptors. + * + * Example: + * + * #include + * #include + * + * int fds[2]; + * + * if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) + * { + * ... + * } + * else + * { + * // + * // Use fds[0] locally and let the + * // proxy use fds[1]. + * // + * + * if (NXTransChannel(NX_FD_ANY, fds[1], NX_CHANNEL_X) <= 0) + * { + * ... + * } + * + * // + * // The agent can now use fds[0] in + * // read(), write() and select() + * // system calls. + * // + * + * ... + * } + * + * Note that all the I/O on the descriptor should be non-blocking, to + * give a chance to the NX transport to run in the background and handle + * the data that will be fed to the agent's side of the socketpair. This + * will happen automatically, as long as the agent uses the XSelect() + * version of the select() function (as it is normal whenever performing + * Xlib I/O). In all the other cases, like presumably in the agent's main + * loop, the agent will have to loop through NXTransPrepare(), NXTrans- + * Select() and NXTransExecute() functions explicitly, adding to the sets + * the descriptors that are awaited by the agent. Please check the imple- + * mentation of _XSelect() in nx-X11/lib/X11/XlibInt.c for an example. + */ + +extern int NXTransChannel(int fd, int channelfd, int type); + +/* + * Return the name of the files used by the proxy for the current session. + * + * The type parameter can be: + * + * NX_FILE_SESSION: Usually the file 'session' in the user's session + * directory. + * + * NX_FILE_ERRORS: The file used for the diagnostic output. Usually + * the file 'errors' in the session directory. + * + * NX_FILE_OPTIONS: The file containing the NX options, if any. + * + * NX_FILE_STATS: The file used for the statistics output. + * + * The returned string is allocated in static memory. The caller should + * copy the string upon returning from the function, without freeing the + * pointer. + */ + +extern const char *NXTransFile(int type); + +/* + * Return the time in milliseconds elapsed since the last call to this + * same function. + */ + +extern long NXTransTime(void); + +/* + * Other interfaces to the internal transport functions. + */ + +extern int NXTransProxy(int fd, int mode, const char *display); + +extern int NXTransClient(const char *display); + +extern int NXTransDialog(const char *caption, const char *message, + const char *window, const char *type, int local, + const char *display); + +extern int NXTransAlert(int code, int local); + +extern int NXTransWatchdog(int timeout); + +extern int NXTransKeeper(int caches, int images, const char *root); + +extern void NXTransExit(int code) __attribute__((noreturn)); + +extern int NXTransParseCommandLine(int argc, const char **argv); +extern int NXTransParseEnvironment(const char *env, int force); + +extern void NXTransCleanup(void) __attribute__((noreturn)); + +/* + * Cleans up the global and local state + * (the same way as NXTransCleanup does) + * but does not exit the process + * Needed for IOS platform + */ +extern void NXTransCleanupForReconnect(void); + +extern const char* NXVersion(void); +extern int NXMajorVersion(void); +extern int NXMinorVersion(void); +extern int NXPatchVersion(void); +extern int NXMaintenancePatchVersion(void); + +#ifdef __cplusplus +} +#endif + +#endif /* NX_H */ diff --git a/nxcomp/include/NXalert.h b/nxcomp/include/NXalert.h new file mode 100644 index 000000000..dca2f44ca --- /dev/null +++ b/nxcomp/include/NXalert.h @@ -0,0 +1,276 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXalert_H +#define NXalert_H + +#define ALERT_CAPTION_PREFIX "NX - " + +#define INTERNAL_ERROR_ALERT 1 +#define INTERNAL_ERROR_ALERT_TYPE "error" +#define INTERNAL_ERROR_ALERT_STRING \ +"\ +An unrecoverable internal error was detected.\n\ +Press OK to terminate the current session.\n\ +" + +#define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT 2 +#define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_TYPE "yesno" +#define CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_STRING \ +"\ +One of the applications currently in use is not responding.\n\ +Do you want to terminate the current session?\n\ +" + +#define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT 3 +#define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_TYPE "yesno" +#define CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_STRING \ +"\ +One of the applications did not behave correctly and caused\n\ +the X server to stop responding in a timely fashion. Do you\n\ +want to terminate the current session?\n\ +" + +#define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT 4 +#define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL +#define CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL + +#define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT 5 +#define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" +#define CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING \ +"\ +No response received from the remote server.\n\ +Do you want to terminate the current session?\n\ +" + +#define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT 6 +#define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL +#define RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL + +#define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT 7 +#define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" +#define RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING \ +"\ +Connection with remote server was shut down. NX will try\n\ +to establish a new server connection. Session could have\n\ +been left in a unusable state. Do you want to terminate\n\ +the session?\n\ +" + +#define CLOSE_UNRESPONSIVE_X_SERVER_ALERT 8 +#define CLOSE_UNRESPONSIVE_X_SERVER_ALERT_TYPE "panic" +#define CLOSE_UNRESPONSIVE_X_SERVER_ALERT_STRING \ +"\ +You pressed the key sequence CTRL+ALT+SHIFT+ESC.\n\ +This is probably because your X server has become\n\ +unresponsive. Session will be terminated in 30\n\ +seconds unless you abort the procedure by pressing\n\ +the Cancel button.\n\ +" + +#define WRONG_PROXY_VERSION_ALERT 9 +#define WRONG_PROXY_VERSION_ALERT_TYPE "ok" +#define WRONG_PROXY_VERSION_ALERT_STRING \ +"\ +Local NX libraries version " VERSION " do not match the NX\n\ +version of the remote server. Please check the error\n\ +log on the server to find out which client version you\n\ +need to install to be able to access this server.\n\ +" + +#define FAILED_PROXY_CONNECTION_CLIENT_ALERT 10 +#define FAILED_PROXY_CONNECTION_CLIENT_ALERT_TYPE NULL +#define FAILED_PROXY_CONNECTION_CLIENT_ALERT_STRING NULL + +#define FAILED_PROXY_CONNECTION_SERVER_ALERT 11 +#define FAILED_PROXY_CONNECTION_SERVER_ALERT_TYPE "yesno" +#define FAILED_PROXY_CONNECTION_SERVER_ALERT_STRING \ +"\ +Could not yet establish the connection to the remote\n\ +proxy. Do you want to terminate the current session?\n\ +" + +#define MISSING_PROXY_CACHE_ALERT 12 +#define MISSING_PROXY_CACHE_ALERT_TYPE "ok" +#define MISSING_PROXY_CACHE_ALERT_STRING \ +"\ +NX was unable to negotiate a cache for this session.\n\ +This may happen if this is the first time you run a\n\ +session on this server or if cache was corrupted or\n\ +produced by an incompatible NX version.\n\ +" + +#define ABORT_PROXY_CONNECTION_ALERT 13 +#define ABORT_PROXY_CONNECTION_ALERT_TYPE "ok" +#define ABORT_PROXY_CONNECTION_ALERT_STRING \ +"\ +The connection with the remote server was shut down.\n\ +Please check the state of your network connection.\n\ +" + +/* + * The one below is a special alert, used to close + * a previous alert that is running on the given + * side. This can be used to get rid of a message + * that has ceased to hold true. + */ + +#define DISPLACE_MESSAGE_ALERT 14 +#define DISPLACE_MESSAGE_ALERT_TYPE NULL +#define DISPLACE_MESSAGE_ALERT_STRING NULL + +/* + * These are the other alert messages that were + * added in the 1.5.0 release. The first is never + * shown and is intended just for testing. + */ + +#define GREETING_MESSAGE_ALERT 15 +#define GREETING_MESSAGE_ALERT_TYPE "ok" +#define GREETING_MESSAGE_ALERT_STRING \ +"\ +Welcome to NX from the NoMachine team. We really\n\ +hope you will enjoy this wonderful software as much\n\ +as we had fun making it ;-).\n\ +" + +/* + * These alerts are intended to notify the user + * of the reason why the agent failed to resume + * the session. + */ + +#define START_RESUME_SESSION_ALERT 16 +#define START_RESUME_SESSION_ALERT_TYPE "ok" +#define START_RESUME_SESSION_ALERT_STRING \ +"\ +You appear to run your NX session across a slow network\n\ +connection. Resuming the session may require some time.\n\ +Please wait.\ +" + +#define FAILED_RESUME_DISPLAY_ALERT 17 +#define FAILED_RESUME_DISPLAY_ALERT_TYPE "error" +#define FAILED_RESUME_DISPLAY_ALERT_STRING \ +"\ +Failed to open the display. Can't resume the NX\n\ +session on this display.\n\ +" + +#define FAILED_RESUME_DISPLAY_BROKEN_ALERT 18 +#define FAILED_RESUME_DISPLAY_BROKEN_TYPE "error" +#define FAILED_RESUME_DISPLAY_BROKEN_STRING \ +"\ +The display connection was broken while trying to\n\ +resume the session. Please, check your network\n\ +connection and try again.\n\ +" + +#define FAILED_RESUME_VISUALS_ALERT 19 +#define FAILED_RESUME_VISUALS_ALERT_TYPE "error" +#define FAILED_RESUME_VISUALS_ALERT_STRING \ +"\ +Failed to restore all the required visuals.\n\ +Can't resume the NX session on this display.\n\ +" + +#define FAILED_RESUME_COLORMAPS_ALERT 20 +#define FAILED_RESUME_COLORMAPS_ALERT_TYPE "error" +#define FAILED_RESUME_COLORMAPS_ALERT_STRING \ +"\ +The number of available colormaps is different\n\ +on the new display. Can't resume the NX session\n\ +on this display.\n\ +" + +#define FAILED_RESUME_PIXMAPS_ALERT 21 +#define FAILED_RESUME_PIXMAPS_ALERT_TYPE "error" +#define FAILED_RESUME_PIXMAPS_ALERT_STRING \ +"\ +Failed to restore all the required pixmap formats.\n\ +Can't resume the NX session on this display.\n\ +" + +#define FAILED_RESUME_DEPTHS_ALERT 22 +#define FAILED_RESUME_DEPTHS_ALERT_TYPE "error" +#define FAILED_RESUME_DEPTHS_ALERT_STRING \ +"\ +Failed to restore all the required screen depths.\n\ +Can't resume the NX session on this display.\n\ +" + +#define FAILED_RESUME_RENDER_ALERT 23 +#define FAILED_RESUME_RENDER_ALERT_TYPE "error" +#define FAILED_RESUME_RENDER_ALERT_STRING \ +"\ +The render extension is missing or an incompatible\n\ +version was detected on your X server. Can't resume\n\ +the NX session on this display.\n\ +" + +#define FAILED_RESUME_FONTS_ALERT 24 +#define FAILED_RESUME_FONTS_ALERT_TYPE "error" +#define FAILED_RESUME_FONTS_ALERT_STRING \ +"\ +One or more of the fonts that are in use by the\n\ +session are missing. Can't resume the NX session\n\ +on this display.\n\ +" + +#define ABORT_PROXY_NEGOTIATION_ALERT 62 +#define ABORT_PROXY_NEGOTIATION_ALERT_TYPE "ok" +#define ABORT_PROXY_NEGOTIATION_ALERT_STRING \ +"\ +The remote proxy closed the connection while negotiating\n\ +the session. This may be due to the wrong authentication\n\ +credentials passed to the server.\n\ +" + +#define ABORT_PROXY_SHUTDOWN_ALERT 64 +#define ABORT_PROXY_SHUTDOWN_ALERT_TYPE "ok" +#define ABORT_PROXY_SHUTDOWN_ALERT_STRING \ +"\ +No response received from the remote proxy while\n\ +waiting for the session shutdown.\n\ +" + +#define FAILED_XDMCP_CONNECTION_ALERT 65 +#define FAILED_XDMCP_CONNECTION_ALERT_TYPE "ok" +#define FAILED_XDMCP_CONNECTION_ALERT_STRING \ +"\ +The XDM host that was contacted by the NX server doesn't\n\ +seem to be able to start the session. Please check your\n\ +server configuration.\n\ +" + +/* + * Used to handle the backward compatibility. + * Update the numbers if you add a new alert. + */ + +#define LAST_PROTO_STEP_6_ALERT 63 +#define LAST_PROTO_STEP_7_ALERT 65 + +#endif /* NXalert_H */ diff --git a/nxcomp/include/NXpack.h b/nxcomp/include/NXpack.h new file mode 100644 index 000000000..3eade6855 --- /dev/null +++ b/nxcomp/include/NXpack.h @@ -0,0 +1,141 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXpack_H +#define NXpack_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define MASK_METHOD_LIMIT 10 + +#define NO_MASK 0 + +#define MASK_8_COLORS 1 +#define MASK_64_COLORS 2 +#define MASK_256_COLORS 3 +#define MASK_512_COLORS 4 +#define MASK_4K_COLORS 5 +#define MASK_32K_COLORS 6 +#define MASK_64K_COLORS 7 +#define MASK_256K_COLORS 8 +#define MASK_2M_COLORS 9 +#define MASK_16M_COLORS 10 + +#define PACK_METHOD_LIMIT 128 + +#define NO_PACK 0 + +#define PACK_MASKED_8_COLORS 1 +#define PACK_MASKED_64_COLORS 2 +#define PACK_MASKED_256_COLORS 3 +#define PACK_MASKED_512_COLORS 4 +#define PACK_MASKED_4K_COLORS 5 +#define PACK_MASKED_32K_COLORS 6 +#define PACK_MASKED_64K_COLORS 7 +#define PACK_MASKED_256K_COLORS 8 +#define PACK_MASKED_2M_COLORS 9 +#define PACK_MASKED_16M_COLORS 10 + +#define PACK_RAW_8_BITS 3 +#define PACK_RAW_16_BITS 7 +#define PACK_RAW_24_BITS 10 + +#define PACK_COLORMAP_256_COLORS 11 + +#define PACK_JPEG_8_COLORS 26 +#define PACK_JPEG_64_COLORS 27 +#define PACK_JPEG_256_COLORS 28 +#define PACK_JPEG_512_COLORS 29 +#define PACK_JPEG_4K_COLORS 30 +#define PACK_JPEG_32K_COLORS 31 +#define PACK_JPEG_64K_COLORS 32 +#define PACK_JPEG_256K_COLORS 33 +#define PACK_JPEG_2M_COLORS 34 +#define PACK_JPEG_16M_COLORS 35 + +#define PACK_PNG_8_COLORS 37 +#define PACK_PNG_64_COLORS 38 +#define PACK_PNG_256_COLORS 39 +#define PACK_PNG_512_COLORS 40 +#define PACK_PNG_4K_COLORS 41 +#define PACK_PNG_32K_COLORS 42 +#define PACK_PNG_64K_COLORS 43 +#define PACK_PNG_256K_COLORS 44 +#define PACK_PNG_2M_COLORS 45 +#define PACK_PNG_16M_COLORS 46 + +#define PACK_RGB_16M_COLORS 63 +#define PACK_RLE_16M_COLORS 64 + +#define PACK_ALPHA 65 +#define PACK_COLORMAP 66 + +#define PACK_BITMAP_16M_COLORS 67 + +/* + * Not really pack methods. These values + * allow dynamic selection of the pack + * method by the agent. + */ + +#define PACK_NONE 0 +#define PACK_LOSSY 253 +#define PACK_LOSSLESS 254 +#define PACK_ADAPTIVE 255 + +/* + * Reduce the number of colors in the + * image by applying a mask. + */ + +typedef struct +{ + unsigned int color_mask; + unsigned int correction_mask; + unsigned int white_threshold; + unsigned int black_threshold; + +} ColorMask; + +extern const ColorMask Mask8TrueColor; +extern const ColorMask Mask64TrueColor; +extern const ColorMask Mask512TrueColor; +extern const ColorMask Mask4KTrueColor; +extern const ColorMask Mask32KTrueColor; +extern const ColorMask Mask256KTrueColor; +extern const ColorMask Mask2MTrueColor; +extern const ColorMask Mask16MTrueColor; + +const ColorMask *MethodColorMask(unsigned int method); + +int MethodBitsPerPixel(unsigned int method); + +#ifdef __cplusplus +} +#endif + +#endif /* NXpack_H */ diff --git a/nxcomp/include/NXproto.h b/nxcomp/include/NXproto.h new file mode 100644 index 000000000..7b988bdbf --- /dev/null +++ b/nxcomp/include/NXproto.h @@ -0,0 +1,447 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXproto_H +#define NXproto_H + +#ifdef __cplusplus +extern "C" { +#endif + +#include +#include +#include + +/* + * Force the size to match the wire protocol. + */ + +#define Drawable CARD32 +#define GContext CARD32 + +#define sz_xNXGetControlParametersReq 4 +#define sz_xNXGetCleanupParametersReq 4 +#define sz_xNXGetImageParametersReq 4 +#define sz_xNXGetUnpackParametersReq 8 +#define sz_xNXGetShmemParametersReq 16 +#define sz_xNXGetFontParametersReq 4 +#define sz_xNXSetExposeParametersReq 8 +#define sz_xNXSetCacheParametersReq 8 +#define sz_xNXStartSplitReq 8 +#define sz_xNXEndSplitReq 4 +#define sz_xNXCommitSplitReq 12 +#define sz_xNXSetUnpackGeometryReq 24 +#define sz_xNXSetUnpackColormapReq 16 +#define sz_xNXSetUnpackAlphaReq 16 +#define sz_xNXPutPackedImageReq 40 +#define sz_xNXFreeUnpackReq 4 +#define sz_xNXFinishSplitReq 4 +#define sz_xNXAbortSplitReq 4 +#define sz_xNXFreeSplitReq 4 + +#define sz_xGetControlParametersReply 32 +#define sz_xGetCleanupParametersReply 32 +#define sz_xGetImageParametersReply 32 +#define sz_xGetUnpackParametersReply 32 +#define sz_xGetShmemParametersReply 32 + +#define LINK_TYPE_LIMIT 5 + +#define LINK_TYPE_NONE 0 +#define LINK_TYPE_MODEM 1 +#define LINK_TYPE_ISDN 2 +#define LINK_TYPE_ADSL 3 +#define LINK_TYPE_WAN 4 +#define LINK_TYPE_LAN 5 + +/* + * NX Replies. + */ + +/* + * The following reply has 4 new boolean + * fields in the last protocol version. + */ + +typedef struct _NXGetControlParametersReply { + BYTE type; /* Is X_Reply. */ + CARD8 linkType; + CARD16 sequenceNumber B16; + CARD32 length B32; /* Is 0. */ + CARD8 localMajor; + CARD8 localMinor; + CARD8 localPatch; + CARD8 remoteMajor; + CARD8 remoteMinor; + CARD8 remotePatch; + CARD16 splitTimeout B16; + CARD16 motionTimeout B16; + CARD8 splitMode; + CARD8 pad1; + CARD32 splitSize B32; + CARD8 packMethod; + CARD8 packQuality; + CARD8 dataLevel; + CARD8 streamLevel; + CARD8 deltaLevel; + CARD8 loadCache; + CARD8 saveCache; + CARD8 startupCache; +} xNXGetControlParametersReply; + +typedef struct _NXGetCleanupParametersReply { + BYTE type; /* Is X_Reply. */ + BYTE pad; + CARD16 sequenceNumber B16; + CARD32 length B32; /* Is 0. */ + BOOL cleanGet; + BOOL cleanAlloc; + BOOL cleanFlush; + BOOL cleanSend; + BOOL cleanImages; + BYTE pad1, pad2, pad3; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xNXGetCleanupParametersReply; + +typedef struct _NXGetImageParametersReply { + BYTE type; /* Is X_Reply. */ + BYTE pad; + CARD16 sequenceNumber B16; + CARD32 length B32; /* Is 0. */ + BOOL imageSplit; + BOOL imageMask; + BOOL imageFrame; + CARD8 imageMaskMethod; + CARD8 imageSplitMethod; + BYTE pad1, pad2, pad3; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xNXGetImageParametersReply; + +/* + * Data is made of PACK_METHOD_LIMIT values of + * type BOOL telling which unpack capabilities + * are implemented in proxy. + */ + +typedef struct _NXGetUnpackParametersReply { + BYTE type; /* Is X_Reply. */ + BYTE pad; + CARD16 sequenceNumber B16; + CARD32 length B32; /* Is PACK_METHOD_LIMIT / 4 from NXpack.h. */ + CARD8 entries; /* Is PACK_METHOD_LIMIT. */ + BYTE pad1, pad2, pad3; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; + CARD32 pad8 B32; +} xNXGetUnpackParametersReply; + +typedef struct _NXGetShmemParametersReply { + BYTE type; /* Is X_Reply. */ + CARD8 stage; /* As in the corresponding request. */ + CARD16 sequenceNumber B16; + CARD32 length B32; /* Is 0. */ + BOOL clientEnabled; /* SHM on path agent to proxy. */ + BOOL serverEnabled; /* SHM on path proxy to X server. */ + BYTE pad1, pad2; /* Previous values can be checked */ + CARD32 clientSize B32; /* at end of stage 2. */ + CARD32 serverSize B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; +} xNXGetShmemParametersReply; + +typedef struct _NXGetFontParametersReply { + BYTE type; /* Is X_Reply. */ + BYTE pad1; + CARD16 sequenceNumber B16; + CARD32 length B32; /* Is length of path string + 1 / 4. */ + CARD32 pad2 B32; + CARD32 pad3 B32; + CARD32 pad4 B32; + CARD32 pad5 B32; + CARD32 pad6 B32; + CARD32 pad7 B32; +} xNXGetFontParametersReply; + +/* + * NX Requests. + */ + +typedef struct _NXGetControlParametersReq { + CARD8 reqType; + BYTE pad; + CARD16 length B16; +} xNXGetControlParametersReq; + +typedef struct _NXGetCleanupParametersReq { + CARD8 reqType; + BYTE pad; + CARD16 length B16; +} xNXGetCleanupParametersReq; + +typedef struct _NXGetImageParametersReq { + CARD8 reqType; + BYTE pad; + CARD16 length B16; +} xNXGetImageParametersReq; + +typedef struct _NXGetUnpackParametersReq { + CARD8 reqType; + BYTE pad; + CARD16 length B16; + CARD8 entries; + BYTE pad1, pad2, pad3; +} xNXGetUnpackParametersReq; + +typedef struct _NXGetShmemParametersReq { + CARD8 reqType; + CARD8 stage; /* It is between 0 and 2. */ + CARD16 length B16; + BOOL enableClient; /* X client side support is */ + BOOL enableServer; /* not implemented yet. */ + BYTE pad1, pad2; + CARD32 clientSegment; /* XID identifying the shared */ + CARD32 serverSegment; /* memory segments. */ +} xNXGetShmemParametersReq; + +typedef struct _NXGetFontParametersReq { + CARD8 reqType; + CARD8 pad; + CARD16 length B16; +} xNXGetFontParametersReq; + +/* + * The available split modes. + */ + +#define NXSplitModeDefault 0 +#define NXSplitModeAsync 1 +#define NXSplitModeSync 2 + +typedef struct _NXStartSplitReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD8 mode; + BYTE pad1, pad2, pad3; +} xNXStartSplitReq; + +typedef struct _NXEndSplitReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; +} xNXEndSplitReq; + +typedef struct _NXCommitSplitReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD8 propagate; + CARD8 request; + BYTE pad1, pad2; + CARD32 position B32; +} xNXCommitSplitReq; + +typedef struct _NXFinishSplitReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; +} xNXFinishSplitReq; + +typedef struct _NXAbortSplitReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; +} xNXAbortSplitReq; + +typedef struct _NXFreeSplitReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; +} xNXFreeSplitReq; + +typedef struct _NXSetExposeParametersReq { + CARD8 reqType; + BYTE pad; + CARD16 length B16; + BOOL expose; + BOOL graphicsExpose; + BOOL noExpose; + BYTE pad1; +} xNXSetExposeParametersReq; + +typedef struct _NXSetCacheParametersReq { + CARD8 reqType; + BYTE pad; + CARD16 length B16; + BOOL enableCache; + BOOL enableSplit; + BOOL enableSave; + BOOL enableLoad; +} xNXSetCacheParametersReq; + +typedef struct _NXSetUnpackGeometryReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD8 depth1Bpp; + CARD8 depth4Bpp; + CARD8 depth8Bpp; + CARD8 depth16Bpp; + CARD8 depth24Bpp; + CARD8 depth32Bpp; + BYTE pad1, pad2; + CARD32 redMask B32; + CARD32 greenMask B32; + CARD32 blueMask B32; +} xNXSetUnpackGeometryReq; + +typedef struct _NXSetUnpackColormapReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD8 method; + BYTE pad1, pad2, pad3; + CARD32 srcLength B32; + CARD32 dstLength B32; +} xNXSetUnpackColormapReq; + +typedef struct _NXSetUnpackAlphaReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + CARD8 method; + BYTE pad1, pad2, pad3; + CARD32 srcLength B32; + CARD32 dstLength B32; +} xNXSetUnpackAlphaReq; + +typedef struct _NXPutPackedImageReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; + Drawable drawable B32; + GContext gc B32; + CARD8 method; + CARD8 format; + CARD8 srcDepth; + CARD8 dstDepth; + CARD32 srcLength B32; + CARD32 dstLength B32; + INT16 srcX B16, srcY B16; + CARD16 srcWidth B16, srcHeight B16; + INT16 dstX B16, dstY B16; + CARD16 dstWidth B16, dstHeight B16; +} xNXPutPackedImageReq; + +typedef struct _NXFreeUnpackReq { + CARD8 reqType; + CARD8 resource; + CARD16 length B16; +} xNXFreeUnpackReq; + +/* + * The X_NXSplitData and X_NXSplitEvent opcodes + * are used internally and are ignored if coming + * from the agent. + */ + +#define X_NXInternalGenericData 0 +#define X_NXInternalGenericReply 1 +#define X_NXInternalGenericRequest 255 + +#define X_NXInternalShapeExtension 128 +#define X_NXInternalRenderExtension 129 + +#define X_NXFirstOpcode 230 +#define X_NXLastOpcode 252 + +#define X_NXGetControlParameters 230 +#define X_NXGetCleanupParameters 231 +#define X_NXGetImageParameters 232 +#define X_NXGetUnpackParameters 233 +#define X_NXStartSplit 234 +#define X_NXEndSplit 235 +#define X_NXSplitData 236 +#define X_NXCommitSplit 237 +#define X_NXSetExposeParameters 240 +#define X_NXSetUnpackGeometry 241 +#define X_NXSetUnpackColormap 242 +#define X_NXPutPackedImage 243 +#define X_NXSplitEvent 244 +#define X_NXGetShmemParameters 245 +#define X_NXSetUnpackAlpha 246 +#define X_NXFreeUnpack 247 +#define X_NXFinishSplit 248 +#define X_NXAbortSplit 249 +#define X_NXFreeSplit 250 +#define X_NXGetFontParameters 251 +#define X_NXSetCacheParameters 252 + +/* + * The following events are received by the agent + * in the form of a ClientMessage with the value + * 0 in fields atom and window. The format is + * always 32. Event specific data starts at byte + * offset 12. + * + * These events are sent by the NX transport to + * notify the agent about the result of a split + * operation. + */ + +#define NXNoSplitNotify 1 +#define NXStartSplitNotify 2 +#define NXCommitSplitNotify 3 +#define NXEndSplitNotify 4 +#define NXEmptySplitNotify 5 + +/* + * Notifications of collect events. These events + * don't come from the NX transport but are put + * back in client's event queue by NXlib. + */ + +#define NXCollectImageNotify 8 +#define NXCollectPropertyNotify 9 +#define NXCollectGrabPointerNotify 10 +#define NXCollectInputFocusNotify 11 + +#undef Drawable +#undef GContext + +#ifdef __cplusplus +} +#endif + +#endif /* NXproto_H */ diff --git a/nxcomp/include/NXvars.h b/nxcomp/include/NXvars.h new file mode 100644 index 000000000..f514000d7 --- /dev/null +++ b/nxcomp/include/NXvars.h @@ -0,0 +1,201 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXvars_H +#define NXvars_H + +/* + * This can be included by the proxy or another + * layer that doesn't use Xlib. + */ + +#if !defined(_XLIB_H_) && !defined(_XKBSRV_H_) + +#define NeedFunctionPrototypes 1 + +#define Display void + +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Display flush policies. + */ + +#define NXPolicyImmediate 1 +#define NXPolicyDeferred 2 + +/* + * Type of flush. + */ + +#define NXFlushBuffer 0 +#define NXFlushLink 1 + +/* + * Type of statistics. + */ + +#define NXStatisticsPartial 0 +#define NXStatisticsTotal 1 + +/* + * Reason why the display is blocking. + */ + +#define NXBlockRead 1 +#define NXBlockWrite 2 + +/* + * Set if the client is interested in ignoring + * the display error and continue with the exe- + * cution of the program. By default the usual + * Xlib behaviour is gotten, and the library + * will call an exit(). + */ + +extern int _NXHandleDisplayError; + +/* + * The function below is called whenever Xlib is + * going to perform an I/O operation. The funct- + * ion can be redefined to include additional + * checks aimed at detecting if the display needs + * to be closed, for example because of an event + * or a signal mandating the end of the session. + * In this way the client program can regain the + * control before Xlib blocks waiting for input + * from the network. + */ + +typedef int (*NXDisplayErrorPredicate)( +#if NeedFunctionPrototypes + Display* /* display */, + int /* reason */ +#endif +); + +extern NXDisplayErrorPredicate _NXDisplayErrorFunction; + +/* + * This is called when Xlib is going to block + * waiting for the display to become readable or + * writable. The client can use the hook to run + * any arbitrary operation that may require some + * time to complete. The user should not try to + * read or write to the display inside the call- + * back routine. + */ + +typedef void (*NXDisplayBlockHandler)( +#if NeedFunctionPrototypes + Display* /* display */, + int /* reason */ +#endif +); + +extern NXDisplayBlockHandler _NXDisplayBlockFunction; + +/* + * Used to notify the program when more data + * is written to the socket. + */ + +typedef void (*NXDisplayWriteHandler)( +#if NeedFunctionPrototypes + Display* /* display */, + int /* length */ +#endif +); + +extern NXDisplayWriteHandler _NXDisplayWriteFunction; + +/* + * This callback is used to notify the agent + * that the proxy link has been flushed. + */ + +typedef void (*NXDisplayFlushHandler)( +#if NeedFunctionPrototypes + Display* /* display */, + int /* length */ +#endif +); + +extern NXDisplayFlushHandler _NXDisplayFlushFunction; + +/* + * Used by the NX transport to get an arbitrary + * string to add to its protocol statistics. + */ + +typedef void (*NXDisplayStatisticsHandler)( +#if NeedFunctionPrototypes + Display* /* display */, + char* /* buffer */, + int /* size */ +#endif +); + +extern NXDisplayStatisticsHandler _NXDisplayStatisticsFunction; + +/* + * Let users redefine the function printing an + * error message in the case of a out-of-order + * sequence number. + */ + +typedef void (*NXLostSequenceHandler)( +#if NeedFunctionPrototypes + Display* /* display */, + unsigned long /* newseq */, + unsigned long /* lastseq */, + unsigned int /* type */ +#endif +); + +extern NXLostSequenceHandler _NXLostSequenceFunction; + +/* + * Let the X server run the children processes + * (as for example the keyboard initialization + * utilities) by using the native system libra- + * ries, instead of the libraries shipped with + * the NX environment. If set, the Popen() in + * the X server will remove the LD_LIBRARY_PATH + * setting from the environment before calling + * the execl() function in the child process. + */ + +extern int _NXUnsetLibraryPath; + +#ifdef __cplusplus +} +#endif + +#endif /* NXvars_H */ diff --git a/nxcomp/install-sh b/nxcomp/install-sh deleted file mode 100755 index 58719246f..000000000 --- a/nxcomp/install-sh +++ /dev/null @@ -1,238 +0,0 @@ -#! /bin/sh -# -# install - install a program, script, or datafile -# This comes from X11R5. -# -# Calling this script install-sh is preferred over install.sh, to prevent -# `make' implicit rules from creating a file called install from it -# when there is no Makefile. -# -# This script is compatible with the BSD install script, but was written -# from scratch. -# - - -# set DOITPROG to echo to test this script - -# Don't use :- since 4.3BSD and earlier shells don't like it. -doit="${DOITPROG-}" - - -# put in absolute paths if you don't have them in your path; or use env. vars. - -mvprog="${MVPROG-mv}" -cpprog="${CPPROG-cp}" -chmodprog="${CHMODPROG-chmod}" -chownprog="${CHOWNPROG-chown}" -chgrpprog="${CHGRPPROG-chgrp}" -stripprog="${STRIPPROG-strip}" -rmprog="${RMPROG-rm}" -mkdirprog="${MKDIRPROG-mkdir}" - -transformbasename="" -transform_arg="" -instcmd="$mvprog" -chmodcmd="$chmodprog 0755" -chowncmd="" -chgrpcmd="" -stripcmd="" -rmcmd="$rmprog -f" -mvcmd="$mvprog" -src="" -dst="" -dir_arg="" - -while [ x"$1" != x ]; do - case $1 in - -c) instcmd="$cpprog" - shift - continue;; - - -d) dir_arg=true - shift - continue;; - - -m) chmodcmd="$chmodprog $2" - shift - shift - continue;; - - -o) chowncmd="$chownprog $2" - shift - shift - continue;; - - -g) chgrpcmd="$chgrpprog $2" - shift - shift - continue;; - - -s) stripcmd="$stripprog" - shift - continue;; - - -t=*) transformarg=`echo $1 | sed 's/-t=//'` - shift - continue;; - - -b=*) transformbasename=`echo $1 | sed 's/-b=//'` - shift - continue;; - - *) if [ x"$src" = x ] - then - src=$1 - else - # this colon is to work around a 386BSD /bin/sh bug - : - dst=$1 - fi - shift - continue;; - esac -done - -if [ x"$src" = x ] -then - echo "install: no input file specified" - exit 1 -else - true -fi - -if [ x"$dir_arg" != x ]; then - dst=$src - src="" - - if [ -d $dst ]; then - instcmd=: - else - instcmd=mkdir - fi -else - -# Waiting for this to be detected by the "$instcmd $src $dsttmp" command -# might cause directories to be created, which would be especially bad -# if $src (and thus $dsttmp) contains '*'. - - if [ -f $src -o -d $src ] - then - true - else - echo "install: $src does not exist" - exit 1 - fi - - if [ x"$dst" = x ] - then - echo "install: no destination specified" - exit 1 - else - true - fi - -# If destination is a directory, append the input filename; if your system -# does not like double slashes in filenames, you may need to add some logic - - if [ -d $dst ] - then - dst="$dst"/`basename $src` - else - true - fi -fi - -## this sed command emulates the dirname command -dstdir=`echo $dst | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'` - -# Make sure that the destination directory exists. -# this part is taken from Noah Friedman's mkinstalldirs script - -# Skip lots of stat calls in the usual case. -if [ ! -d "$dstdir" ]; then -defaultIFS=' -' -IFS="${IFS-${defaultIFS}}" - -oIFS="${IFS}" -# Some sh's can't handle IFS=/ for some reason. -IFS='%' -set - `echo ${dstdir} | sed -e 's@/@%@g' -e 's@^%@/@'` -IFS="${oIFS}" - -pathcomp='' - -while [ $# -ne 0 ] ; do - pathcomp="${pathcomp}${1}" - shift - - if [ ! -d "${pathcomp}" ] ; - then - $mkdirprog "${pathcomp}" - else - true - fi - - pathcomp="${pathcomp}/" -done -fi - -if [ x"$dir_arg" != x ] -then - $doit $instcmd $dst && - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dst; else true ; fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dst; else true ; fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dst; else true ; fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dst; else true ; fi -else - -# If we're going to rename the final executable, determine the name now. - - if [ x"$transformarg" = x ] - then - dstfile=`basename $dst` - else - dstfile=`basename $dst $transformbasename | - sed $transformarg`$transformbasename - fi - -# don't allow the sed command to completely eliminate the filename - - if [ x"$dstfile" = x ] - then - dstfile=`basename $dst` - else - true - fi - -# Make a temp file name in the proper directory. - - dsttmp=$dstdir/#inst.$$# - -# Move or copy the file name to the temp name - - $doit $instcmd $src $dsttmp && - - trap "rm -f ${dsttmp}" 0 && - -# and set any options; do chmod last to preserve setuid bits - -# If any of these fail, we abort the whole thing. If we want to -# ignore errors from any of these, just make sure not to ignore -# errors from the above "$doit $instcmd $src $dsttmp" command. - - if [ x"$chowncmd" != x ]; then $doit $chowncmd $dsttmp; else true;fi && - if [ x"$chgrpcmd" != x ]; then $doit $chgrpcmd $dsttmp; else true;fi && - if [ x"$stripcmd" != x ]; then $doit $stripcmd $dsttmp; else true;fi && - if [ x"$chmodcmd" != x ]; then $doit $chmodcmd $dsttmp; else true;fi && - -# Now rename the file to the real destination. - - $doit $rmcmd -f $dstdir/$dstfile && - $doit $mvcmd $dsttmp $dstdir/$dstfile - -fi && - - -exit 0 diff --git a/nxcomp/m4/nx-macros.m4 b/nxcomp/m4/nx-macros.m4 new file mode 120000 index 000000000..813e9b041 --- /dev/null +++ b/nxcomp/m4/nx-macros.m4 @@ -0,0 +1 @@ +../../m4/nx-macros.m4 \ No newline at end of file diff --git a/nxcomp/mkinstalldirs b/nxcomp/mkinstalldirs deleted file mode 100755 index 936cf3407..000000000 --- a/nxcomp/mkinstalldirs +++ /dev/null @@ -1,34 +0,0 @@ -#! /bin/sh -# mkinstalldirs --- make directory hierarchy -# Author: Noah Friedman -# Created: 1993-05-16 -# Last modified: 1995-03-05 -# Public domain - -errstatus=0 - -for file in ${1+"$@"} ; do - set fnord `echo ":$file" | sed -ne 's/^:\//#/;s/^://;s/\// /g;s/^#/\//;p'` - shift - - pathcomp= - for d in ${1+"$@"} ; do - pathcomp="$pathcomp$d" - case "$pathcomp" in - -* ) pathcomp=./$pathcomp ;; - esac - - if test ! -d "$pathcomp"; then - echo "mkdir $pathcomp" 1>&2 - mkdir "$pathcomp" > /dev/null 2>&1 || lasterr=$? - fi - - if test ! -d "$pathcomp"; then - errstatus=$lasterr - fi - - pathcomp="$pathcomp/" - done -done - -exit $errstatus diff --git a/nxcomp/nxcomp.pc.in b/nxcomp/nxcomp.pc.in index f0963aa17..26206d857 100644 --- a/nxcomp/nxcomp.pc.in +++ b/nxcomp/nxcomp.pc.in @@ -5,7 +5,7 @@ includedir=@includedir@ Name: nxcomp Description: NX Compression Library -Version: @VERSION@ +Version: @COMP_VERSION@ #libjepg does not provide a pkgconfig-file, zlib does not provide it for older versions #Requires: libjpeg zlib Requires: libpng diff --git a/nxcomp/src/ActionCache.cpp b/nxcomp/src/ActionCache.cpp new file mode 100644 index 000000000..783b1724e --- /dev/null +++ b/nxcomp/src/ActionCache.cpp @@ -0,0 +1,51 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Control.h" + +#include "ActionCache.h" + +ActionCache::ActionCache() +{ + for (int i = 0; i < 256; i++) + { + base_[i] = new IntCache(8); + } + + slot_ = 0; + last_ = 0; +} + +ActionCache::~ActionCache() +{ + for (int i = 0; i < 256; i++) + { + delete base_[i]; + } +} diff --git a/nxcomp/src/ActionCache.h b/nxcomp/src/ActionCache.h new file mode 100644 index 000000000..2aedd4a07 --- /dev/null +++ b/nxcomp/src/ActionCache.h @@ -0,0 +1,49 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ActionCache_H +#define ActionCache_H + +#include "IntCache.h" + +class ActionCache +{ + friend class EncodeBuffer; + friend class DecodeBuffer; + + public: + + ActionCache(); + ~ActionCache(); + + private: + + IntCache *base_[256]; + + unsigned int slot_; + unsigned short last_; +}; + +#endif /* ActionCache_H */ diff --git a/nxcomp/src/Agent.cpp b/nxcomp/src/Agent.cpp new file mode 100644 index 000000000..e55620601 --- /dev/null +++ b/nxcomp/src/Agent.cpp @@ -0,0 +1,84 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Agent.h" +#include "Proxy.h" + +extern Proxy *proxy; + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +Agent::Agent(int fd[2]) +{ + remoteFd_ = fd[0]; + localFd_ = fd[1]; + + transport_ = new AgentTransport(localFd_); + + if (transport_ == NULL) + { + #ifdef PANIC + *logofs << "Agent: PANIC! Can't create the memory-to-memory transport " + << "for FD#" << localFd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't create the memory-to-memory transport " + << "for FD#" << localFd_ << ".\n"; + + HandleCleanup(); + } + + FD_ZERO(&saveRead_); + FD_ZERO(&saveWrite_); + + canRead_ = 0; + + #ifdef DEBUG + *logofs << "Agent: Created agent object at " << this + << ".\n" << logofs_flush; + #endif +} + +Agent::~Agent() +{ + delete transport_; + + #ifdef DEBUG + *logofs << "Agent: Deleted agent object at " << this + << ".\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/Agent.h b/nxcomp/src/Agent.h new file mode 100644 index 000000000..3e1a50ae5 --- /dev/null +++ b/nxcomp/src/Agent.h @@ -0,0 +1,263 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Agent_H +#define Agent_H + +#include + +#include +#include +#include + +#include "Misc.h" +#include "Transport.h" +#include "Proxy.h" + +extern Proxy *proxy; + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +class Agent +{ + public: + + // + // Must be created by passing the fake descriptor that + // will be used for simulating socket communication + // betwen the agent and the proxy. I/O will take place + // by copying data to the agent's read and write buf- + // fers. + // + + Agent(int fd[2]); + + ~Agent(); + + AgentTransport *getTransport() const + { + return transport_; + } + + void saveReadMask(fd_set *readSet) + { + saveRead_ = *readSet; + } + + void saveWriteMask(fd_set *writeSet) + { + saveWrite_ = *writeSet; + } + + void clearReadMask(fd_set *readSet) + { + FD_CLR(remoteFd_, readSet); + FD_CLR(localFd_, readSet); + } + + void clearWriteMask(fd_set *writeSet) + { + FD_CLR(remoteFd_, writeSet); + FD_CLR(localFd_, writeSet); + } + + void setLocalRead(fd_set *readSet, int *result) + { + (*result)++; + + FD_SET(localFd_, readSet); + } + + void setRemoteRead(fd_set *readSet, int *result) + { + (*result)++; + + FD_SET(remoteFd_, readSet); + } + + void setRemoteWrite(fd_set *writeSet, int *result) + { + (*result)++; + + FD_SET(remoteFd_, writeSet); + } + + fd_set *getSavedReadMask() + { + return &saveRead_; + } + + fd_set *getSavedWriteMask() + { + return &saveWrite_; + } + + int getRemoteFd() const + { + return remoteFd_; + } + + int getLocalFd() const + { + return localFd_; + } + + int getProxyFd() const + { + return proxy -> getFd(); + } + + int isValid() const + { + return (transport_ != NULL); + } + + int localReadable() + { + return (transport_ -> readable() != 0); + } + + // + // Check if we can process more data from + // the agent descriptor and cache the result + // to avoid multiple calls. This must be + // always called before querying the other + // functions. + // + + void saveChannelState() + { + canRead_ = (proxy != NULL ? proxy -> canRead(localFd_) : 0); + } + + int remoteCanRead(const fd_set * const readSet) + { + // OS X 10.5 requires the second argument to be non-const, so copy readSet. + // It's safe though, as FD_ISSET does not operate on it. + fd_set readWorkSet = *readSet; + + #if defined(TEST) || defined(INFO) + *logofs << "Agent: remoteCanRead() is " << + (FD_ISSET(remoteFd_, &readWorkSet) && transport_ -> dequeuable() != 0) + << " with FD_ISSET() " << (int) FD_ISSET(remoteFd_, &readWorkSet) + << " and dequeuable " << transport_ -> dequeuable() + << ".\n" << logofs_flush; + #endif + + return (FD_ISSET(remoteFd_, &readWorkSet) && + transport_ -> dequeuable() != 0); + } + + int remoteCanWrite(const fd_set * const writeSet) + { + // OS X 10.5 requires the second argument to be non-const, so copy writeSet. + // It's safe though, as FD_ISSET does not operate on it. + fd_set writeWorkSet = *writeSet; + + #if defined(TEST) || defined(INFO) + *logofs << "Agent: remoteCanWrite() is " << + (FD_ISSET(remoteFd_, &writeWorkSet) && transport_ -> + queuable() != 0 && canRead_ == 1) << " with FD_ISSET() " + << (int) FD_ISSET(remoteFd_, &writeWorkSet) << " queueable " + << transport_ -> queuable() << " channel can read " + << canRead_ << ".\n" << logofs_flush; + #endif + + return (FD_ISSET(remoteFd_, &writeWorkSet) && + transport_ -> queuable() != 0 && + canRead_ == 1); + } + + int localCanRead() + { + #if defined(TEST) || defined(INFO) + *logofs << "Agent: localCanRead() is " << + (transport_ -> readable() != 0 && canRead_ == 1) + << " with readable " << transport_ -> readable() + << " channel can read " << canRead_ << ".\n" + << logofs_flush; + #endif + + return (transport_ -> readable() != 0 && + canRead_ == 1); + } + + int proxyCanRead() + { + #if defined(TEST) || defined(INFO) + *logofs << "Agent: proxyCanRead() is " << proxy -> canRead() + << ".\n" << logofs_flush; + #endif + + return (proxy -> canRead()); + } + + int proxyCanRead(const fd_set * const readSet) + { + // OS X 10.5 requires the second argument to be non-const, so copy readSet. + // It's safe though, as FD_ISSET does not operate on it. + fd_set readWorkSet = *readSet; + + #if defined(TEST) || defined(INFO) + *logofs << "Agent: proxyCanRead() is " + << ((int) FD_ISSET(proxy -> getFd(), &readWorkSet)) + << ".\n" << logofs_flush; + #endif + + return (FD_ISSET(proxy -> getFd(), &readWorkSet)); + } + + int enqueueData(const char *data, const int size) const + { + return transport_ -> enqueue(data, size); + } + + int dequeueData(char *data, int size) const + { + return transport_ -> dequeue(data, size); + } + + int dequeuableData() const + { + return transport_ -> dequeuable(); + } + + private: + + int remoteFd_; + int localFd_; + + fd_set saveRead_; + fd_set saveWrite_; + + int canRead_; + + AgentTransport *transport_; +}; + +#endif /* Agent_H */ diff --git a/nxcomp/src/Alpha.cpp b/nxcomp/src/Alpha.cpp new file mode 100644 index 000000000..6157e21e5 --- /dev/null +++ b/nxcomp/src/Alpha.cpp @@ -0,0 +1,138 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Unpack.h" +#include "Alpha.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +int UnpackAlpha(unsigned char method, unsigned char *src_data, int src_size, + unsigned char *dst_data, int dst_size) +{ + if (*src_data == 0) + { + if (dst_size != src_size - 1) + { + #ifdef TEST + *logofs << "UnpackAlpha: PANIC! Invalid destination size " + << dst_size << " with source " << src_size + << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "UnpackAlpha: Expanding " << src_size - 1 + << " bytes of plain alpha data.\n" << logofs_flush; + #endif + + memcpy(dst_data, src_data + 1, src_size - 1); + + return 1; + } + + unsigned int check_size = dst_size; + + int result = ZDecompress(&unpackStream, dst_data, &check_size, + src_data + 1, src_size - 1); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "UnpackAlpha: PANIC! Failure decompressing alpha data. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decompressing alpha data. " + << "Error is '" << zError(result) << "'.\n"; + + return -1; + } + else if (check_size != (unsigned int) dst_size) + { + #ifdef PANIC + *logofs << "UnpackAlpha: PANIC! Size mismatch in alpha data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Size mismatch in alpha data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n"; + + return -1; + } + + #ifdef TEST + *logofs << "UnpackAlpha: Decompressed " << src_size - 1 + << " bytes to " << dst_size << " bytes of alpha data.\n" + << logofs_flush; + #endif + + return 1; +} + +int UnpackAlpha(T_alpha *alpha, unsigned char *dst_data, + int dst_size, int big_endian) +{ + unsigned int count = dst_size >> 2; + + unsigned int i; + + int shift; + + if (count != alpha -> entries) + { + #ifdef WARNING + *logofs << "UnpackAlpha: WARNING! Not applying the alpha with " + << count << " elements needed and " << alpha -> entries + << " available.\n" << logofs_flush; + #endif + + return 0; + } + + shift = (big_endian == 1 ? 0 : 3); + + for (i = 0; i < count; i++) + { + *(dst_data + shift) = *(alpha -> data + i); + + dst_data += 4; + } + + return 1; +} diff --git a/nxcomp/src/Alpha.h b/nxcomp/src/Alpha.h new file mode 100644 index 000000000..ea5068812 --- /dev/null +++ b/nxcomp/src/Alpha.h @@ -0,0 +1,35 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Alpha_H +#define Alpha_H + +int UnpackAlpha(unsigned char method, unsigned char *src_data, int src_size, + unsigned char *dst_data, int dst_size); + +int UnpackAlpha(T_alpha *alpha, unsigned char *dst_data, + int dst_size, int big_endian); + +#endif /* Aplha_H */ diff --git a/nxcomp/src/Auth.cpp b/nxcomp/src/Auth.cpp new file mode 100644 index 000000000..d42c0556d --- /dev/null +++ b/nxcomp/src/Auth.cpp @@ -0,0 +1,671 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Auth.h" + +#include "Misc.h" +#include "Control.h" +#include "Timestamp.h" +#include "Pipe.h" + +#define DEFAULT_STRING_LIMIT 512 + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Store the provided cookie as our 'fake' cookie, then +// read the 'real' cookie from the current X authority +// file. +// + +Auth::Auth(char *display, char *cookie) +{ + display_ = NULL; + + file_ = NULL; + + last_ = nullTimestamp(); + + fakeCookie_ = NULL; + realCookie_ = NULL; + + fakeData_ = NULL; + realData_ = NULL; + + dataSize_ = 0; + + generatedCookie_ = 0; + + if (display == NULL || *display == '\0' || cookie == NULL || + *cookie == '\0' || strlen(cookie) != 32) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Can't create the X authorization data " + << "with cookie '" << cookie << "' and display '" + << display << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't create the X authorization data " + << "with cookie '" << cookie << "' and display '" + << display << "'.\n"; + + return; + } + + #ifdef TEST + *logofs << "Auth: Creating X authorization data with cookie '" + << cookie << "' and display '" << display << "'.\n" + << logofs_flush; + #endif + + // + // Get a local copy of all parameters. + // + + display_ = new char[strlen(display) + 1]; + file_ = new char[DEFAULT_STRING_LIMIT]; + + fakeCookie_ = new char[strlen(cookie) + 1]; + realCookie_ = new char[DEFAULT_STRING_LIMIT]; + + if (display_ == NULL || file_ == NULL || + fakeCookie_ == NULL || realCookie_ == NULL) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Cannot allocate memory for the X " + << "authorization data.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot allocate memory for the X " + << "authorization data.\n"; + + return; + } + + strcpy(display_, display); + + *file_ = '\0'; + + strcpy(fakeCookie_, cookie); + + *realCookie_ = '\0'; + + // + // Get the real cookie from the authorization file. + // + + updateCookie(); +} + +Auth::~Auth() +{ + delete [] display_; + delete [] file_; + + delete [] fakeCookie_; + delete [] realCookie_; + + delete [] fakeData_; + delete [] realData_; +} + +// +// At the present moment the cookie is read only once, +// at the time the instance is initialized. If the auth +// file changes along the life of the session, the old +// cookie will be used. This works with X servers beca- +// use of an undocumented "feature". See nx-X11. +// + +int Auth::updateCookie() +{ + if (isTimestamp(last_) == 0) + { + #ifdef TEST + *logofs << "Auth: Reading the X authorization file " + << "with last update at " << strMsTimestamp(last_) + << ".\n" << logofs_flush; + #endif + + if (getCookie() == 1 && validateCookie() == 1) + { + // + // It should rather be the modification time + // the auth file, so we can read it again if + // the file is changed. + // + + #ifdef TEST + *logofs << "Auth: Setting last X authorization file " + << "update at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + last_ = getTimestamp(); + + return 1; + } + + #ifdef PANIC + *logofs << "Auth: PANIC! Cannot read the cookie from the X " + << "authorization file.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot read the cookie from the X " + << "authorization file.\n"; + + return -1; + } + + #ifdef TEST + *logofs << "Auth: WARNING! Skipping check on the X " + << "authorization file.\n" << logofs_flush; + #endif + + return 0; +} + +int Auth::getCookie() +{ + // + // Check the name of the auth file that we are going to use. + // It can be either the value of the XAUTHORITY environment + // or the default .Xauthority file in the user's home. + // + + char *environment; + + environment = getenv("XAUTHORITY"); + + if (environment != NULL && *environment != '\0') + { + strncpy(file_, environment, DEFAULT_STRING_LIMIT - 1); + } + else + { + snprintf(file_, DEFAULT_STRING_LIMIT - 1, "%s/.Xauthority", + control -> HomePath); + } + + *(file_ + DEFAULT_STRING_LIMIT - 1) = '\0'; + + #ifdef TEST + *logofs << "Auth: Using X authorization file '" << file_ + << "'.\n" << logofs_flush; + #endif + + // + // Use the nxauth command on Windows and the Mac, xauth + // on all the other platforms. On Windows we assume that + // the nxauth command is located under bin in the client + // installation directory. On Mac OS X we assume that the + // command is located directly in the client installation + // directory, to make bundle shipping easier. On all the + // other platforms we use the default xauth command that + // is in our path. + // + + char command[DEFAULT_STRING_LIMIT]; + + #if defined(__CYGWIN32__) + + snprintf(command, DEFAULT_STRING_LIMIT - 1, + "%s/bin/nxauth", control -> SystemPath); + + *(command + DEFAULT_STRING_LIMIT - 1) = '\0'; + + #elif defined(__APPLE__) + + snprintf(command, DEFAULT_STRING_LIMIT - 1, + "%s/nxauth", control -> SystemPath); + + *(command + DEFAULT_STRING_LIMIT - 1) = '\0'; + + #else + + strcpy(command, "xauth"); + + #endif + + #ifdef TEST + *logofs << "Auth: Using X auth command '" << command + << "'.\n" << logofs_flush; + #endif + + // + // The SSH code forces using the unix:n port when passing localhost:n. + // This is probably because localhost:n can fail to return a valid + // entry on machines where the hostname for localhost doesn't match + // exactly the 'localhost' string. For example, on a freshly installed + // Fedora Core 3 I get a 'localhost.localdomain/unix:0' entry. Query- + // ing 'xauth list localhost:0' results in an empty result, while the + // query 'xauth list unix:0' works as expected. Note anyway that if + // the cookie for the TCP connection on 'localhost' is set to a dif- + // ferent cookie than the one for the Unix connections, both SSH and + // NX will match the wrong cookie and session will fail. + // + + char line[DEFAULT_STRING_LIMIT]; + + if (strncmp(display_, "localhost:", 10) == 0) + { + snprintf(line, DEFAULT_STRING_LIMIT, "unix:%s", display_ + 10); + } + else + { + snprintf(line, DEFAULT_STRING_LIMIT, "%.200s", display_); + } + + const char *parameters[256]; + + parameters[0] = command; + parameters[1] = command; + parameters[2] = "-f"; + parameters[3] = file_; + parameters[4] = "list"; + parameters[5] = line; + parameters[6] = NULL; + + #ifdef TEST + *logofs << "Auth: Executing command "; + + for (int i = 0; i < 256 && parameters[i] != NULL; i++) + { + *logofs << "[" << parameters[i] << "]"; + } + + *logofs << ".\n" << logofs_flush; + #endif + + // + // Use the popen() function to read the result + // of the command. We would better use our own + // implementation. + // + + FILE *data = Popen((char *const *) parameters, "r"); + + int result = -1; + + if (data == NULL) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Failed to execute the X auth command.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to execute the X auth command.\n"; + + goto AuthGetCookieResult; + } + + if (fgets(line, DEFAULT_STRING_LIMIT, data) == NULL) + { + #ifdef WARNING + *logofs << "Auth: WARNING! Failed to read data from the X " + << "auth command.\n" << logofs_flush; + #endif + + #ifdef TEST + cerr << "Warning" << ": Failed to read data from the X " + << "auth command.\n"; + #endif + + #ifdef PANIC + *logofs << "Auth: WARNING! Generating a fake cookie for " + << "X authentication.\n" << logofs_flush; + #endif + + #ifdef TEST + cerr << "Warning" << ": Generating a fake cookie for " + << "X authentication.\n"; + #endif + + generateCookie(realCookie_); + } + else + { + #ifdef TEST + *logofs << "Auth: Checking cookie in string '" << line + << "'.\n" << logofs_flush; + #endif + + // + // Skip the hostname in the authority entry + // just in case it includes some white spaces. + // + + char *cookie = NULL; + + cookie = index(line, ':'); + + if (cookie == NULL) + { + cookie = line; + } + + if (sscanf(cookie, "%*s %*s %511s", realCookie_) != 1) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Failed to identify the cookie " + << "in string '" << line << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to identify the cookie " + << "in string '" << line << "'.\n"; + + goto AuthGetCookieResult; + } + + #ifdef TEST + *logofs << "Auth: Got cookie '" << realCookie_ + << "' from file '" << file_ << "'.\n" + << logofs_flush; + #endif + } + + result = 1; + +AuthGetCookieResult: + + if (data != NULL) + { + Pclose(data); + } + + return result; +} + +int Auth::validateCookie() +{ + unsigned int length = strlen(realCookie_); + + if (length > DEFAULT_STRING_LIMIT / 2 - 1 || + strlen(fakeCookie_) != length) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Size mismatch between cookies '" + << realCookie_ << "' and '" << fakeCookie_ << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Size mismatch between cookies '" + << realCookie_ << "' and '" << fakeCookie_ << "'.\n"; + + goto AuthValidateCookieError; + } + + // + // The length of the resulting data will be + // half the size of the Hex cookie. + // + + length = length / 2; + + fakeData_ = new char[length]; + realData_ = new char[length]; + + if (fakeData_ == NULL || realData_ == NULL) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Cannot allocate memory for the binary X " + << "authorization data.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot allocate memory for the binary X " + << "authorization data.\n"; + + goto AuthValidateCookieError; + } + + // + // Translate the real cookie from Hex data + // to its binary representation. + // + + unsigned int value; + + for (unsigned int i = 0; i < length; i++) + { + if (sscanf(realCookie_ + 2 * i, "%2x", &value) != 1) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Bad X authorization data in real " + << "cookie '" << realCookie_ << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Bad X authorization data in real cookie '" + << realCookie_ << "'.\n"; + + goto AuthValidateCookieError; + } + + realData_[i] = value; + + if (sscanf(fakeCookie_ + 2 * i, "%2x", &value) != 1) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Bad X authorization data in fake " + << "cookie '" << fakeCookie_ << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Bad X authorization data in fake cookie '" + << fakeCookie_ << "'.\n"; + + goto AuthValidateCookieError; + } + + fakeData_[i] = value; + } + + dataSize_ = length; + + #ifdef TEST + *logofs << "Auth: Validated real cookie '" + << realCookie_ << "' and fake cookie '" << fakeCookie_ + << "' with data with size " << dataSize_ << ".\n" + << logofs_flush; + + *logofs << "Auth: Ready to accept incoming connections.\n" + << logofs_flush; + #endif + + return 1; + +AuthValidateCookieError: + + delete [] fakeData_; + delete [] realData_; + + fakeData_ = NULL; + realData_ = NULL; + + dataSize_ = 0; + + return -1; +} + +int Auth::checkCookie(unsigned char *buffer) +{ + if (isValid() != 1) + { + #ifdef PANIC + *logofs << "Auth: PANIC! Attempt to check the X cookie with " + << "invalid authorization data.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Attempt to check the X cookie with " + << "invalid authorization data.\n"; + + return -1; + } + + const char *protoName = "MIT-MAGIC-COOKIE-1"; + int protoSize = strlen(protoName); + + int matchedProtoSize; + int matchedDataSize; + + if (buffer[0] == 0x42) + { + // + // Byte order is MSB first. + // + + matchedProtoSize = 256 * buffer[6] + buffer[7]; + matchedDataSize = 256 * buffer[8] + buffer[9]; + } + else if (buffer[0] == 0x6c) + { + // + // Byte order is LSB first. + // + + matchedProtoSize = buffer[6] + 256 * buffer[7]; + matchedDataSize = buffer[8] + 256 * buffer[9]; + } + else + { + #ifdef WARNING + *logofs << "Auth: WARNING! Bad X connection data in the buffer.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Bad X connection data in the buffer.\n"; + + return -1; + } + + // + // Check if both the authentication protocol + // and the fake cookie match our data. + // + + int protoOffset = 12; + + #ifdef TEST + *logofs << "Auth: Received a protocol size of " + << matchedProtoSize << " bytes.\n" + << logofs_flush; + #endif + + if (matchedProtoSize != protoSize || + memcmp(buffer + protoOffset, protoName, protoSize) != 0) + { + #ifdef WARNING + *logofs << "Auth: WARNING! Protocol mismatch or no X " + << "authentication data.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Protocol mismatch or no X " + << "authentication data.\n"; + + return -1; + } + + int dataOffset = protoOffset + ((matchedProtoSize + 3) & ~3); + + #ifdef TEST + *logofs << "Auth: Received a data size of " + << matchedDataSize << " bytes.\n" + << logofs_flush; + #endif + + if (matchedDataSize != dataSize_ || + memcmp(buffer + dataOffset, fakeData_, dataSize_) != 0) + { + #ifdef WARNING + *logofs << "Auth: WARNING! Cookie mismatch in the X " + << "authentication data.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Cookie mismatch in the X " + << "authentication data.\n"; + + return -1; + } + + // + // Everything is OK. Replace the fake data. + // + + #ifdef TEST + *logofs << "Auth: Replacing fake X authentication data " + << "with the real data.\n" << logofs_flush; + #endif + + memcpy(buffer + dataOffset, realData_, dataSize_); + + return 1; +} + +void Auth::generateCookie(char *cookie) +{ + // + // Code is from the SSH implementation, except that + // we use a much weaker random number generator. + // This is not critical, anyway, as this is just a + // fake cookie. The X server doesn't have a cookie + // for the display, so it will ignore the value we + // feed to it. + // + + T_timestamp timer = getTimestamp(); + + srand((unsigned int) timer.tv_usec); + + unsigned int data = rand(); + + for (int i = 0; i < 16; i++) + { + if (i % 4 == 0) + { + data = rand(); + } + + snprintf(cookie + 2 * i, 3, "%02x", data & 0xff); + + data >>= 8; + } + + generatedCookie_ = 1; + + #ifdef TEST + *logofs << "Auth: Generated X cookie string '" + << cookie << "'.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/Auth.h b/nxcomp/src/Auth.h new file mode 100644 index 000000000..d51d9a26f --- /dev/null +++ b/nxcomp/src/Auth.h @@ -0,0 +1,127 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Auth_H +#define Auth_H + +#include "Timestamp.h" + +// +// Handle the forwarding of authorization credentials +// to the X server by replacing the fake cookie with +// the real cookie as it is read from the auth file. +// At the moment only the MIT-MAGIC-COOKIE-1 cookies +// are recognized. The implementation is based on the +// corresponding code found in the SSH client. +// + +class Auth +{ + public: + + // + // Must be created by passing the fake cookie that + // will be forwarded by the remote end and with the + // real X display that is going to be used for the + // session. + // + + Auth(char *display, char *cookie); + + ~Auth(); + + int isValid() + { + return (isTimestamp(last_) == 1 && fakeCookie_ != NULL && + *fakeCookie_ != '\0' && realCookie_ != NULL && + *realCookie_ != '\0' && fakeData_ != NULL && + realData_ != NULL && dataSize_ != 0); + } + + int isFake() const + { + return generatedCookie_; + } + + // + // Method called in the channel class to find if the + // provided cookie matches the fake one. If the data + // matches, the fake cookie is replaced with the real + // one. + // + + int checkCookie(unsigned char *buffer); + + protected: + + // + // Update the real cookie for the display. If called + // a further time, check if the auth file is changed + // and get the new cookie. + // + + int updateCookie(); + + // + // Find out which authorization file is to be used + // and query the cookie for the current display. + // + + int getCookie(); + + // + // Extract the binary data from the cookies so that + // data can be directly compared at the time it is + // taken from the X request. + // + + int validateCookie(); + + // + // Generate a fake random cookie and copy it to the + // provided string. + // + + void generateCookie(char *cookie); + + private: + + char *display_; + char *file_; + + T_timestamp last_; + + char *fakeCookie_; + char *realCookie_; + + char *fakeData_; + char *realData_; + + int dataSize_; + + int generatedCookie_; +}; + +#endif /* Auth_H */ diff --git a/nxcomp/src/Bitmap.cpp b/nxcomp/src/Bitmap.cpp new file mode 100644 index 000000000..c89df53e3 --- /dev/null +++ b/nxcomp/src/Bitmap.cpp @@ -0,0 +1,118 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Bitmap.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +int UnpackBitmap(T_geometry *geometry, unsigned char method, unsigned char *src_data, + int src_size, int dst_bpp, int dst_width, int dst_height, + unsigned char *dst_data, int dst_size) +{ + if (dst_bpp != 32) + { + #ifdef TEST + *logofs << "UnpackBitmap: Nothing to do with " + << "image of " << dst_bpp << " bits per plane " + << "and size " << src_size << ".\n" + << logofs_flush; + #endif + + if (src_size != dst_size) + { + #ifdef PANIC + *logofs << "UnpackBitmap: PANIC! Size mismatch with " + << src_size << " bytes in the source and " + << dst_size << " in the destination.\n" + << logofs_flush; + #endif + + return -1; + } + + memcpy(dst_data, src_data, src_size); + + return 1; + } + else if (src_size != dst_width * dst_height * 3 || + dst_size != dst_width * dst_height * 4) + { + #ifdef PANIC + *logofs << "UnpackBitmap: PANIC! Size mismatch with " + << src_size << " bytes in the source and " + << dst_size << " in the destination.\n" + << logofs_flush; + #endif + + return -1; + } + + /* + * Insert the 4th byte in the bitmap. + */ + + unsigned char *next_src = src_data; + unsigned char *next_dst = dst_data; + + if (geometry -> image_byte_order == LSBFirst) + { + while (next_src < src_data + src_size) + { + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + + next_dst++; + } + } + else + { + while (next_src < src_data + src_size) + { + next_dst++; + + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + *next_dst++ = *next_src++; + } + } + + #ifdef TEST + *logofs << "UnpackBitmap: Unpacked " << src_size + << " bytes to a buffer of " << dst_size + << " with " << dst_bpp << " bits per plane.\n" + << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/Bitmap.h b/nxcomp/src/Bitmap.h new file mode 100644 index 000000000..8143e3125 --- /dev/null +++ b/nxcomp/src/Bitmap.h @@ -0,0 +1,36 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Bitmap_H +#define Bitmap_H + +#include "Unpack.h" + +int UnpackBitmap(T_geometry *geometry, unsigned char method, + unsigned char *src_data, int src_size, int dst_bpp, + int dst_width, int dst_height, unsigned char *dst_data, + int dst_size); + +#endif /* Bitmap_H */ diff --git a/nxcomp/src/BlockCache.cpp b/nxcomp/src/BlockCache.cpp new file mode 100644 index 000000000..161145e3d --- /dev/null +++ b/nxcomp/src/BlockCache.cpp @@ -0,0 +1,81 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include "BlockCache.h" + + +int BlockCache::compare(unsigned int size, const unsigned char *data, + int overwrite) +{ + int match = 0; + if (size == size_) + { + match = 1; + for (unsigned int i = 0; i < size_; i++) + if (data[i] != buffer_[i]) + { + match = 0; + break; + } + } + if (!match && overwrite) + set(size, data); + return match; +} + + +void BlockCache::set(unsigned int size, const unsigned char *data) +{ + if (size_ < size) + { + delete[]buffer_; + buffer_ = new unsigned char[size]; + } + size_ = size; + memcpy(buffer_, data, size); + checksum_ = checksum(size, data); +} + + +unsigned int BlockCache::checksum(unsigned int size, const unsigned char *data) +{ + unsigned int sum = 0; + unsigned int shift = 0; + const unsigned char *next = data; + for (unsigned int i = 0; i < size; i++) + { + unsigned int value = (unsigned int) *next++; + sum += (value << shift); + shift++; + if (shift == 8) + shift = 0; + } + return sum; +} diff --git a/nxcomp/src/BlockCache.h b/nxcomp/src/BlockCache.h new file mode 100644 index 000000000..48e586966 --- /dev/null +++ b/nxcomp/src/BlockCache.h @@ -0,0 +1,67 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef BlockCache_H +#define BlockCache_H + + +// Cache to hold an arbitrary-length block of bytes + +class BlockCache +{ + public: + BlockCache():buffer_(0), size_(0), checksum_(0) + { + } + ~BlockCache() + { + delete[]buffer_; + } + int compare(unsigned int size, const unsigned char *data, + int overwrite = 1); + void set(unsigned int size, const unsigned char *data); + + unsigned int getLength() const + { + return size_; + } + unsigned int getChecksum() const + { + return checksum_; + } + const unsigned char *getData() const + { + return buffer_; + } + + static unsigned int checksum(unsigned int size, const unsigned char *data); + +private: + unsigned char *buffer_; + unsigned int size_; + unsigned int checksum_; +}; + +#endif /* BlockCache_H */ diff --git a/nxcomp/src/BlockCacheSet.cpp b/nxcomp/src/BlockCacheSet.cpp new file mode 100644 index 000000000..1dd6361dc --- /dev/null +++ b/nxcomp/src/BlockCacheSet.cpp @@ -0,0 +1,147 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "BlockCacheSet.h" + + +BlockCacheSet::BlockCacheSet(unsigned int numCaches): + caches_(new BlockCache *[numCaches]), size_(numCaches), + length_(0) +{ + for (unsigned int i = 0; i < numCaches; i++) + caches_[i] = new BlockCache(); +} + + +BlockCacheSet::~BlockCacheSet() +{ + // + // TODO: There is still a strange segfault occurring + // at random time under Cygwin, when proxy is being + // shutdown. Problem appeared just after upgrading + // to the latest version of the Cygwin DLL. A stack + // trace, obtained at the last minute, reveals that + // failure happens in this destructor. + // + + #ifndef __CYGWIN32__ + + for (unsigned int i = 0; i < size_; i++) + delete caches_[i]; + delete[]caches_; + + #endif /* ifdef __CYGWIN32__ */ +} + + +int +BlockCacheSet::lookup(unsigned int dataLength, const unsigned char *data, + unsigned int &index) +{ + unsigned int checksum = BlockCache::checksum(dataLength, data); + for (unsigned int i = 0; i < length_; i++) + if ((caches_[i]->getChecksum() == checksum) && + (caches_[i]->compare(dataLength, data, 0))) + { + // match + index = i; + if (i) + { + BlockCache *save = caches_[i]; + unsigned int target = (i >> 1); + do + { + caches_[i] = caches_[i - 1]; + i--; + } + while (i > target); + caches_[target] = save; + } + return 1; + } + // no match + unsigned int insertionPoint = (length_ >> 1); + unsigned int start; + if (length_ >= size_) + start = size_ - 1; + else + { + start = length_; + length_++; + } + BlockCache *save = caches_[start]; + for (unsigned int k = start; k > insertionPoint; k--) + caches_[k] = caches_[k - 1]; + caches_[insertionPoint] = save; + save->set(dataLength, data); + return 0; +} + + +void +BlockCacheSet::get(unsigned index, unsigned int &size, + const unsigned char *&data) +{ + size = caches_[index]->getLength(); + data = caches_[index]->getData(); + if (index) + { + BlockCache *save = caches_[index]; + unsigned int target = (index >> 1); + do + { + caches_[index] = caches_[index - 1]; + index--; + } + while (index > target); + caches_[target] = save; + } +} + + + +void +BlockCacheSet::set(unsigned int dataLength, const unsigned char *data) +{ + unsigned int insertionPoint = (length_ >> 1); + unsigned int start; + if (length_ >= size_) + start = size_ - 1; + else + { + start = length_; + length_++; + } + BlockCache *save = caches_[start]; + for (unsigned int k = start; k > insertionPoint; k--) + caches_[k] = caches_[k - 1]; + caches_[insertionPoint] = save; + save->set(dataLength, data); +} diff --git a/nxcomp/src/BlockCacheSet.h b/nxcomp/src/BlockCacheSet.h new file mode 100644 index 000000000..97273b0e0 --- /dev/null +++ b/nxcomp/src/BlockCacheSet.h @@ -0,0 +1,49 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef BlockCacheSet_H +#define BlockCacheSet_H + +#include "BlockCache.h" + + +class BlockCacheSet +{ + public: + BlockCacheSet(unsigned int numCaches); + ~BlockCacheSet(); + + int lookup(unsigned int size, const unsigned char *data, + unsigned int &index); + void get(unsigned int index, unsigned int &size, const unsigned char *&data); + void set(unsigned int size, const unsigned char *data); + + private: + BlockCache ** caches_; + unsigned int size_; + unsigned int length_; +}; + +#endif /* BlockCacheSet_H */ diff --git a/nxcomp/src/ChangeGC.cpp b/nxcomp/src/ChangeGC.cpp new file mode 100644 index 000000000..e92178f27 --- /dev/null +++ b/nxcomp/src/ChangeGC.cpp @@ -0,0 +1,184 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ChangeGC.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int ChangeGCStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ChangeGCMessage *changeGC = (ChangeGCMessage *) message; + + // + // Here is the fingerprint. + // + + changeGC -> gcontext = GetULONG(buffer + 4, bigEndian); + changeGC -> value_mask = GetULONG(buffer + 8, bigEndian); + + // + // Clear the unused bytes carried in the + // payload to increase the effectiveness + // of the caching algorithm. + // + + if ((int) size > dataOffset) + { + #ifdef DEBUG + *logofs << name() << ": Removing unused bytes from the " + << "data payload.\n" << logofs_flush; + #endif + + changeGC -> value_mask &= (1 << 23) - 1; + + unsigned int mask = 0x1; + unsigned char *source = (unsigned char *) buffer + CHANGEGC_DATA_OFFSET; + unsigned long value = 0; + + for (unsigned int i = 0; i < 23; i++) + { + if (changeGC -> value_mask & mask) + { + value = GetULONG(source, bigEndian); + + value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i])); + + PutULONG(value, source, bigEndian); + + source += 4; + } + + mask <<= 1; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ChangeGCStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ChangeGCMessage *changeGC = (ChangeGCMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(changeGC -> gcontext, buffer + 4, bigEndian); + PutULONG(changeGC -> value_mask, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ChangeGCStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ChangeGCMessage *changeGC = (ChangeGCMessage *) message; + + *logofs << name() << ": Identity gcontext " << changeGC -> gcontext + << ", mask " << changeGC -> value_mask << ", size " + << changeGC -> size_ << ".\n" << logofs_flush; + #endif +} + +void ChangeGCStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +/* + md5_append(md5_state_, buffer + 4, 8); +*/ + md5_append(md5_state_, buffer + 8, 4); +} + +void ChangeGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + ChangeGCMessage *changeGC = (ChangeGCMessage *) message; + ChangeGCMessage *cachedChangeGC = (ChangeGCMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << changeGC -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(changeGC -> gcontext, clientCache -> gcCache); + + cachedChangeGC -> gcontext = changeGC -> gcontext; +} + +void ChangeGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + ChangeGCMessage *changeGC = (ChangeGCMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + changeGC -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << changeGC -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/ChangeGC.h b/nxcomp/src/ChangeGC.h new file mode 100644 index 000000000..9cac90e66 --- /dev/null +++ b/nxcomp/src/ChangeGC.h @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ChangeGC_H +#define ChangeGC_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define CHANGEGC_ENABLE_CACHE 1 +#define CHANGEGC_ENABLE_DATA 0 +#define CHANGEGC_ENABLE_SPLIT 0 +#define CHANGEGC_ENABLE_COMPRESS 0 + +#define CHANGEGC_DATA_LIMIT 144 +#define CHANGEGC_DATA_OFFSET 12 + +#define CHANGEGC_CACHE_SLOTS 3000 +#define CHANGEGC_CACHE_THRESHOLD 3 +#define CHANGEGC_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class ChangeGCMessage : public Message +{ + friend class ChangeGCStore; + + public: + + ChangeGCMessage() + { + } + + ~ChangeGCMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int gcontext; + unsigned int value_mask; +}; + +class ChangeGCStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ChangeGCStore() : MessageStore() + { + enableCache = CHANGEGC_ENABLE_CACHE; + enableData = CHANGEGC_ENABLE_DATA; + enableSplit = CHANGEGC_ENABLE_SPLIT; + enableCompress = CHANGEGC_ENABLE_COMPRESS; + + dataLimit = CHANGEGC_DATA_LIMIT; + dataOffset = CHANGEGC_DATA_OFFSET; + + cacheSlots = CHANGEGC_CACHE_SLOTS; + cacheThreshold = CHANGEGC_CACHE_THRESHOLD; + cacheLowerThreshold = CHANGEGC_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~ChangeGCStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "ChangeGC"; + } + + virtual unsigned char opcode() const + { + return X_ChangeGC; + } + + virtual unsigned int storage() const + { + return sizeof(ChangeGCMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ChangeGCMessage(); + } + + virtual Message *create(const Message &message) const + { + return new ChangeGCMessage((const ChangeGCMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (ChangeGCMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; +}; + +#endif /* ChangeGC_H */ diff --git a/nxcomp/src/ChangeProperty.cpp b/nxcomp/src/ChangeProperty.cpp new file mode 100644 index 000000000..74814c2ea --- /dev/null +++ b/nxcomp/src/ChangeProperty.cpp @@ -0,0 +1,191 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ChangeProperty.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int ChangePropertyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; + + changeProperty -> mode = *(buffer + 1); + changeProperty -> format = *(buffer + 16); + + changeProperty -> window = GetULONG(buffer + 4, bigEndian); + changeProperty -> property = GetULONG(buffer + 8, bigEndian); + changeProperty -> type = GetULONG(buffer + 12, bigEndian); + changeProperty -> length = GetULONG(buffer + 20, bigEndian); + + // + // Cleanup the padding bytes. + // + + unsigned int uiFormat; + unsigned int uiLengthInBytes; + + if ((int) size > CHANGEPROPERTY_DATA_OFFSET) + { + uiFormat = *(buffer + 16); + + uiLengthInBytes = changeProperty -> length; + + #ifdef DEBUG + *logofs << name() << ": length " << uiLengthInBytes + << ", format " << uiFormat << ", size " + << size << ".\n" << logofs_flush; + #endif + + if (uiFormat == 16) + { + uiLengthInBytes <<= 1; + } + else if (uiFormat == 32) + { + uiLengthInBytes <<= 2; + } + + unsigned char *end = ((unsigned char *) buffer) + size; + unsigned char *pad = ((unsigned char *) buffer) + CHANGEPROPERTY_DATA_OFFSET + uiLengthInBytes; + + CleanData((unsigned char *) pad, end - pad); + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ChangePropertyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; + + *(buffer + 1) = changeProperty -> mode; + *(buffer + 16) = changeProperty -> format; + + PutULONG(changeProperty -> window, buffer + 4, bigEndian); + PutULONG(changeProperty -> property, buffer + 8, bigEndian); + PutULONG(changeProperty -> type, buffer + 12, bigEndian); + PutULONG(changeProperty -> length, buffer + 20, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ChangePropertyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; + + *logofs << name() << ": Identity mode " << (unsigned int) changeProperty -> mode << ", format " + << (unsigned int) changeProperty -> format << ", window " << changeProperty -> window + << ", property " << changeProperty -> property << ", type " << changeProperty -> type + << ", length " << changeProperty -> length << ", size " << changeProperty -> size_ + << ".\n" << logofs_flush; + + #endif +} + +void ChangePropertyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 16, 1); + + md5_append(md5_state_, buffer + 8, 4); + md5_append(md5_state_, buffer + 12, 4); + md5_append(md5_state_, buffer + 20, 4); +} + +void ChangePropertyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; + ChangePropertyMessage *cachedChangeProperty = (ChangePropertyMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << changeProperty -> window + << " as window field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(changeProperty -> window, clientCache -> windowCache); + + cachedChangeProperty -> window = changeProperty -> window; +} + +void ChangePropertyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + ChangePropertyMessage *changeProperty = (ChangePropertyMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> windowCache); + + changeProperty -> window = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << changeProperty -> window + << " as window field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/ChangeProperty.h b/nxcomp/src/ChangeProperty.h new file mode 100644 index 000000000..c06ce10fc --- /dev/null +++ b/nxcomp/src/ChangeProperty.h @@ -0,0 +1,189 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ChangeProperty_H +#define ChangeProperty_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define CHANGEPROPERTY_ENABLE_CACHE 1 +#define CHANGEPROPERTY_ENABLE_DATA 0 +#define CHANGEPROPERTY_ENABLE_SPLIT 0 +#define CHANGEPROPERTY_ENABLE_COMPRESS 0 + +#define CHANGEPROPERTY_DATA_LIMIT 28688 +#define CHANGEPROPERTY_DATA_OFFSET 24 + +#define CHANGEPROPERTY_CACHE_SLOTS 2000 +#define CHANGEPROPERTY_CACHE_THRESHOLD 2 +#define CHANGEPROPERTY_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class ChangePropertyMessage : public Message +{ + friend class ChangePropertyStore; + + public: + + ChangePropertyMessage() + { + } + + ~ChangePropertyMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char mode; + unsigned char format; + unsigned int window; + unsigned int property; + unsigned int type; + unsigned int length; +}; + +class ChangePropertyStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ChangePropertyStore() : MessageStore() + { + enableCache = CHANGEPROPERTY_ENABLE_CACHE; + enableData = CHANGEPROPERTY_ENABLE_DATA; + enableSplit = CHANGEPROPERTY_ENABLE_SPLIT; + enableCompress = CHANGEPROPERTY_ENABLE_COMPRESS; + + dataLimit = CHANGEPROPERTY_DATA_LIMIT; + dataOffset = CHANGEPROPERTY_DATA_OFFSET; + + cacheSlots = CHANGEPROPERTY_CACHE_SLOTS; + cacheThreshold = CHANGEPROPERTY_CACHE_THRESHOLD; + cacheLowerThreshold = CHANGEPROPERTY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~ChangePropertyStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "ChangeProperty"; + } + + virtual unsigned char opcode() const + { + return X_ChangeProperty; + } + + virtual unsigned int storage() const + { + return sizeof(ChangePropertyMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ChangePropertyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new ChangePropertyMessage((const ChangePropertyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (ChangePropertyMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* ChangeProperty_H */ diff --git a/nxcomp/src/Channel.cpp b/nxcomp/src/Channel.cpp new file mode 100644 index 000000000..24a422e37 --- /dev/null +++ b/nxcomp/src/Channel.cpp @@ -0,0 +1,2039 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Channel.h" + +#include "List.h" +#include "Proxy.h" +#include "Statistics.h" + +#include "StaticCompressor.h" + +#include "NXalert.h" + +extern Proxy *proxy; + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Log the operations related to splits. +// + +#undef SPLIT + +#undef COUNT + +#define COUNT_MAJOR_OPCODE 154 + +#undef MONITOR + +#define MONITOR_MAJOR_OPCODE 154 +#define MONITOR_MINOR_OPCODE 23 + +#undef CLEAR + +#define CLEAR_MAJOR_OPCODE 154 +#define CLEAR_MINOR_OPCODE 23 + +// +// Define this to know how many messages +// are allocated and deallocated. +// + +#undef REFERENCES + +// +// Set to the descriptor of the first X +// channel successfully connected. +// + +int Channel::firstClient_ = -1; + +// +// Port used for font server connections. +// + +int Channel::fontPort_ = -1; + +// +// This is used for reference count. +// + +#ifdef REFERENCES + +int Channel::references_ = 0; + +#endif + +Channel::Channel(Transport *transport, StaticCompressor *compressor) + + : transport_(transport), compressor_(compressor) +{ + fd_ = transport_ -> fd(); + + finish_ = 0; + closing_ = 0; + drop_ = 0; + congestion_ = 0; + priority_ = 0; + + alert_ = 0; + + firstRequest_ = 1; + firstReply_ = 1; + + enableCache_ = 1; + enableSplit_ = 1; + enableSave_ = 1; + enableLoad_ = 1; + + // + // Must be set by proxy. + // + + opcodeStore_ = NULL; + + clientStore_ = NULL; + serverStore_ = NULL; + + clientCache_ = NULL; + serverCache_ = NULL; + + #ifdef REFERENCES + *logofs << "Channel: Created new Channel at " + << this << " out of " << ++references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +Channel::~Channel() +{ + if (firstClient_ == fd_) + { + firstClient_ = -1; + } + + #ifdef REFERENCES + *logofs << "Channel: Deleted Channel at " + << this << " out of " << --references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +int Channel::handleEncode(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, + MessageStore *store, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #ifdef MONITOR + + static float totalMessages = 0; + static float totalBits = 0; + + int bits; + int diff; + + bits = encodeBuffer.getBits(); + + #endif + + // + // Check if message can be differentially + // encoded using a similar message in the + // message store. + // + + #ifdef COUNT + + if (*(buffer) == COUNT_MAJOR_OPCODE) + { + if (*(buffer) < 128) + { + *logofs << "handleEncode: Handling OPCODE#" << (unsigned int) *(buffer) + << ".\n" << logofs_flush; + } + else + { + *logofs << "handleEncode: Handling OPCODE#" << (unsigned int) *(buffer) + << " MINOR#" << (unsigned int) *(buffer + 1) << ".\n" + << logofs_flush; + } + } + + #endif + + #ifdef CLEAR + + if (*(buffer) == CLEAR_MAJOR_OPCODE && + (CLEAR_MINOR_OPCODE == -1 || *(buffer + 1) == CLEAR_MINOR_OPCODE)) + { + *((unsigned char *) buffer) = X_NoOperation; + + *((unsigned char *) buffer + 1) = '\0'; + + CleanData((unsigned char *) buffer + 4, size - 4); + } + + #endif + + if (handleEncodeCached(encodeBuffer, channelCache, + store, buffer, size) == 1) + { + #ifdef MONITOR + + diff = encodeBuffer.getBits() - bits; + + if (*(buffer) == MONITOR_MAJOR_OPCODE && + (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) + { + totalMessages++; + + totalBits += diff; + + *logofs << "handleEncode: Handled cached OPCODE#" << (unsigned int) *(buffer) + << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size + << " bytes in, " << diff << " bits (" << ((float) diff) / 8 + << " bytes) out. Average " << totalBits / totalMessages + << "/1.\n" << logofs_flush; + } + + #endif + + // + // Let the channel update the split store + // and notify the agent in the case of a + // cache hit. + // + + if (store -> enableSplit) + { + handleSplit(encodeBuffer, store, store -> lastAction, + store -> lastHit, opcode, buffer, size); + } + + return 1; + } + + // + // A similar message could not be found in + // cache or message must be discarded. Must + // transmit the message using the field by + // field differential encoding. + // + + handleEncodeIdentity(encodeBuffer, channelCache, + store, buffer, size, bigEndian_); + + // + // Check if message has a distinct data part. + // + + if (store -> enableData) + { + // + // If message split was requested by agent then send data + // out-of-band, dividing it in small chunks. Until message + // is completely transferred, keep in the split store a + // dummy version of the message, with data replaced with a + // pattern. + // + // While data is being transferred, agent should have put + // the resource (for example its client) asleep. It can + // happen, though, that a different client would reference + // the same message. We cannot issue a cache hit for images + // being split (such images are put in store in 'incomplete' + // state), so we need to handle this case. + // + + if (store -> enableSplit == 1) + { + // + // Let the channel decide what to do with the + // message. If the split can't take place be- + // cause the split store is full, the channel + // will tell the remote side that the data is + // going to follow. + // + + if (handleSplit(encodeBuffer, store, store -> lastAction, + (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), + opcode, buffer, size) == 1) + { + #ifdef MONITOR + + diff = encodeBuffer.getBits() - bits; + + if (*(buffer) == MONITOR_MAJOR_OPCODE && + (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) + { + totalMessages++; + + totalBits += diff; + + *logofs << "handleEncode: Handled split OPCODE#" << (unsigned int) *(buffer) + << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size + << " bytes in, " << diff << " bits (" << ((float) diff) / 8 + << " bytes) out. Average " << totalBits / totalMessages + << "/1.\n" << logofs_flush; + } + + #endif + + return 0; + } + } + + // + // The split did not take place and we are going + // to transfer the data part. Check if the static + // compression of the data section is enabled. + // This is the case of all messages not having a + // special differential encoding or messages that + // we want to store in cache in compressed form. + // + + unsigned int offset = store -> identitySize(buffer, size); + + if (store -> enableCompress) + { + unsigned char *data = NULL; + unsigned int dataSize = 0; + + int compressed = handleCompress(encodeBuffer, opcode, offset, + buffer, size, data, dataSize); + if (compressed < 0) + { + return -1; + } + else if (compressed > 0) + { + // + // Update the size of the message according + // to the result of the data compression. + // + + handleUpdate(store, size - offset, dataSize); + } + } + else + { + handleCopy(encodeBuffer, opcode, offset, buffer, size); + } + } + + #ifdef MONITOR + + diff = encodeBuffer.getBits() - bits; + + if (*(buffer) == MONITOR_MAJOR_OPCODE && + (MONITOR_MINOR_OPCODE == -1 || *(buffer + 1) == MONITOR_MINOR_OPCODE)) + { + totalMessages++; + + totalBits += diff; + + *logofs << "handleEncode: Handled OPCODE#" << (unsigned int) *(buffer) + << " MINOR#" << (unsigned int) *(buffer + 1) << ". " << size + << " bytes in, " << diff << " bits (" << ((float) diff) / 8 + << " bytes) out. Average " << totalBits / totalMessages + << "/1.\n" << logofs_flush; + } + + #endif + + return 0; +} + +int Channel::handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, + MessageStore *store, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // Check first if the message is in the + // message store. + // + + unsigned int split = 0; + + if (handleDecodeCached(decodeBuffer, channelCache, + store, buffer, size) == 1) + { + // + // Let the channel update the split store + // in the case of a message being cached. + // + + if (store -> enableSplit == 1) + { + // Since ProtoStep7 (#issue 108) + #ifdef DEBUG + *logofs << "handleDecode: " << store -> name() + << ": Checking if the message was split.\n" + << logofs_flush; + #endif + + decodeBuffer.decodeBoolValue(split); + + if (split == 1) + { + handleSplit(decodeBuffer, store, store -> lastAction, + store -> lastHit, opcode, buffer, size); + + handleCleanAndNullRequest(opcode, buffer, size); + } + } + + return 1; + } + + // + // Decode the full identity. + // + + handleDecodeIdentity(decodeBuffer, channelCache, store, buffer, + size, bigEndian_, &writeBuffer_); + + // + // Check if the message has a distinct + // data part. + // + + if (store -> enableData) + { + // + // Check if message has been split. + // + + if (store -> enableSplit) + { + #ifdef DEBUG + *logofs << "handleDecode: " << store -> name() + << ": Checking if the message was split.\n" + << logofs_flush; + #endif + + decodeBuffer.decodeBoolValue(split); + + if (split == 1) + { + // + // If the message was added to the store, + // create the entry without the data part. + // + + handleSaveSplit(store, buffer, size); + + handleSplit(decodeBuffer, store, store -> lastAction, + (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), + opcode, buffer, size); + + handleCleanAndNullRequest(opcode, buffer, size); + + return 0; + } + } + + // + // Decode the data part. + // + + unsigned int offset = store -> identitySize(buffer, size); + + if (store -> enableCompress) + { + const unsigned char *data = NULL; + unsigned int dataSize = 0; + + int decompressed = handleDecompress(decodeBuffer, opcode, offset, + buffer, size, data, dataSize); + if (decompressed < 0) + { + return -1; + } + else if (decompressed > 0) + { + // + // The message has been transferred + // in compressed format. + // + + handleSave(store, buffer, size, data, dataSize); + + if (store -> enableSplit) + { + if (split == 1) + { + handleSplit(decodeBuffer, store, store -> lastAction, + (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), + opcode, buffer, size); + + handleCleanAndNullRequest(opcode, buffer, size); + } + } + + return 0; + } + } + else + { + // + // Static compression of the data part + // was not enabled for this message. + // + + handleCopy(decodeBuffer, opcode, offset, buffer, size); + } + } + + // + // The message doesn't have a data part + // or the data was not compressed. + // + + handleSave(store, buffer, size); + + if (store -> enableSplit) + { + if (split == 1) + { + handleSplit(decodeBuffer, store, store -> lastAction, + (store -> lastAction == IS_ADDED ? store -> lastAdded : 0), + opcode, buffer, size); + + handleCleanAndNullRequest(opcode, buffer, size); + } + } + + return 0; +} + +int Channel::handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, + MessageStore *store, const unsigned char *buffer, + const unsigned int size) +{ + if (control -> LocalDeltaCompression == 0 || + enableCache_ == 0 || store -> enableCache == 0) + { + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(is_discarded, + store -> lastActionCache); + + store -> lastAction = is_discarded; + + return 0; + } + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() + << ": Going to handle a new message of this class.\n" + << logofs_flush; + #endif + + // + // Check if the estimated size of cache is greater + // than the requested limit. If it is the case make + // some room by deleting one or more messages. + // + + int position; + + while (mustCleanStore(store) == 1 && canCleanStore(store) == 1) + { + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() + << ": Trying to reduce size of message store.\n" + << logofs_flush; + #endif + + position = store -> clean(use_checksum); + + if (position == nothing) + { + #ifdef TEST + *logofs << "handleEncodeCached: " << store -> name() + << ": WARNING! No message found to be " + << "actually removed.\n" << logofs_flush; + #endif + + break; + } + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() + << ": Message at position " << position + << " will be removed.\n" << logofs_flush; + #endif + + // + // Encode the position of message to + // be discarded. + // + + store -> lastRemoved = position; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(is_removed, store -> lastRemoved, + store -> lastActionCache); + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() << ": Going to " + << "clean up message at position " << position << ".\n" + << logofs_flush; + #endif + + store -> remove(position, use_checksum, discard_data); + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() << ": There are " + << store -> getSize() << " messages in the store out of " + << store -> cacheSlots << " slots.\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() + << ": Size of store is " << store -> getLocalStorageSize() + << " bytes locally and " << store -> getRemoteStorageSize() + << " bytes remotely.\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() + << ": Size of total cache is " << store -> getLocalTotalStorageSize() + << " bytes locally and " << store -> getRemoteTotalStorageSize() + << " bytes remotely.\n" << logofs_flush; + #endif + } + + #ifdef DEBUG + + if (mustCleanStore(store) == 1 && canCleanStore(store) == 0) + { + *logofs << "handleEncodeCached: " << store -> name() + << ": Store would need a clean but operation will be delayed.\n" + << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() << ": There are " + << store -> getSize() << " messages in the store out of " + << store -> cacheSlots << " slots.\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() + << ": Size of store is " << store -> getLocalStorageSize() + << " bytes locally and " << store -> getRemoteStorageSize() + << " bytes remotely.\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() + << ": Size of total cache is " << store -> getLocalTotalStorageSize() + << " bytes locally and " << store -> getRemoteTotalStorageSize() + << " bytes remotely.\n" << logofs_flush; + } + + #endif + + // + // If 'on the wire' size of message exceeds the + // allowed limit then avoid to store it in the + // cache. + // + + if (store -> validateMessage(buffer, size) == 0) + { + #ifdef TEST + *logofs << "handleEncodeCached: " << store -> name() + << ": Message with size " << size << " ignored.\n" + << logofs_flush; + #endif + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(is_discarded, + store -> lastActionCache); + + store -> lastAction = is_discarded; + + return 0; + } + + // + // Fill the message object with the + // received data. + // + + Message *message = store -> getTemporary(); + + if (message == NULL) + { + #ifdef PANIC + *logofs << "handleEncodeCached: " << store -> name() + << ": PANIC! Can't allocate memory for " + << "a new message.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "a new message in context [D].\n"; + + HandleCleanup(); + } + + // + // As we are at encoding side, it is enough to store the + // checksum for the object while data can be erased. Both + // the identity and the data will never be sent through + // the wire again as long as they are stored in the cache + // at the decoding side. The split parameter is always + // set to 0 as the data will not be stored in any case. + // + + store -> parse(message, 0, buffer, size, use_checksum, + discard_data, bigEndian_); + + #ifdef DUMP + + store -> dump(message); + + #endif + + // + // Search the object in the message + // store. If found get the position. + // + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() + << ": Searching object of size " << size + << " in the cache.\n" << logofs_flush; + #endif + + int added; + int locked; + + position = store -> findOrAdd(message, use_checksum, + discard_data, added, locked); + + if (position == nothing) + { + #ifdef WARNING + *logofs << "handleEncodeCached: " << store -> name() + << ": WARNING! Can't store object in the cache.\n" + << logofs_flush; + #endif + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(is_discarded, + store -> lastActionCache); + + store -> lastAction = is_discarded; + + return 0; + } + else if (locked == 1) + { + // + // We can't issue a cache hit. Encoding identity + // differences while message it's being split + // would later result in agent to commit a wrong + // version of message. + // + + #ifdef WARNING + *logofs << "handleEncodeCached: " << store -> name() + << ": WARNING! Message of size " << store -> plainSize(position) + << " at position " << position << " is locked.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Message of size " << store -> plainSize(position) + << " at position " << position << " is locked.\n"; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(is_discarded, + store -> lastActionCache); + + store -> lastAction = is_discarded; + + return 0; + } + else if (added == 1) + { + store -> resetTemporary(); + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() << ": Message of size " + << store -> plainSize(position) << " has been stored at position " + << position << ".\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() << ": There are " + << store -> getSize() << " messages in the store out of " + << store -> cacheSlots << " slots.\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() + << ": Size of store is " << store -> getLocalStorageSize() + << " bytes locally and " << store -> getRemoteStorageSize() + << " bytes remotely.\n" << logofs_flush; + + *logofs << "handleEncodeCached: " << store -> name() + << ": Size of total cache is " << store -> getLocalTotalStorageSize() + << " bytes locally and " << store -> getRemoteTotalStorageSize() + << " bytes remotely.\n" << logofs_flush; + #endif + + // + // Inform the decoding side that message + // must be inserted in cache and encode + // the position where the insertion took + // place. + // + + store -> lastAction = IS_ADDED; + + store -> lastAdded = position; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(IS_ADDED, store -> lastAdded, + store -> lastActionCache); + + return 0; + } + else + { + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() + << ": Cache hit. Found object at position " + << position << ".\n" << logofs_flush; + #endif + + // + // Must abort the connection if the + // the position is invalid. + // + + Message *cachedMessage = store -> get(position); + + // + // Increase the rating of the cached + // message. + // + + store -> touch(cachedMessage); + + #ifdef DEBUG + *logofs << "handleEncodeCached: " << store -> name() << ": Hits for " + << "object at position " << position << " are now " + << store -> getTouches(position) << ".\n" + << logofs_flush; + #endif + + // + // Send to the decoding side position + // where object can be found in cache. + // + + store -> lastAction = IS_HIT; + + store -> lastHit = position; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeActionValue(IS_HIT, store -> lastHit, + store -> lastActionCache); + + // + // Send the field by field differences in + // respect to the original message stored + // in cache. + // + + store -> updateIdentity(encodeBuffer, message, cachedMessage, channelCache); + + return 1; + } +} + +void Channel::handleUpdateAdded(MessageStore *store, unsigned int dataSize, + unsigned int compressedDataSize) +{ + #ifdef TEST + + if (store -> lastAction != IS_ADDED) + { + #ifdef PANIC + *logofs << "handleUpdateAdded: " << store -> name() + << ": PANIC! Function called for action '" + << store -> lastAction << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Update function called for " + << "store '" << store -> name() << "' with " + << "action '" << store -> lastAction + << "'.\n"; + + HandleCleanup(); + } + + #endif + + #ifdef DEBUG + *logofs << "handleUpdateAdded: " << store -> name() << ": Updating " + << "object at position " << store -> lastAdded << " of size " + << store -> plainSize(store -> lastAdded) << " (" << dataSize + << "/" << compressedDataSize << ").\n" << logofs_flush; + #endif + + store -> updateData(store -> lastAdded, dataSize, compressedDataSize); + + #ifdef DEBUG + *logofs << "handleUpdateAdded: " << store -> name() << ": There are " + << store -> getSize() << " messages in the store out of " + << store -> cacheSlots << " slots.\n" << logofs_flush; + + *logofs << "handleUpdateAdded: " << store -> name() + << ": Size of store is " << store -> getLocalStorageSize() + << " bytes locally and " << store -> getRemoteStorageSize() + << " bytes remotely.\n" << logofs_flush; + + *logofs << "handleUpdateAdded: " << store -> name() + << ": Size of total cache is " << store -> getLocalTotalStorageSize() + << " bytes locally and " << store -> getRemoteTotalStorageSize() + << " bytes remotely.\n" << logofs_flush; + #endif +} + +int Channel::handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, + MessageStore *store, unsigned char *&buffer, + unsigned int &size) +{ + // + // Create a new message object and + // fill it with received data. + // + + #ifdef DEBUG + *logofs << "handleDecodeCached: " << store -> name() + << ": Going to handle a new message of this class.\n" + << logofs_flush; + #endif + + // + // Decode bits telling how to handle + // this message. + // + + unsigned char action; + unsigned short int position; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeActionValue(action, position, + store -> lastActionCache); + + // + // Clean operations must always come + // before any operation on message. + // + + while (action == is_removed) + { + // Since ProtoStep7 (#issue 108) + store -> lastRemoved = position; + + #ifdef DEBUG + + if (store -> get(store -> lastRemoved)) + { + *logofs << "handleDecodeCached: " << store -> name() << ": Cleaning up " + << "object at position " << store -> lastRemoved + << " of size " << store -> plainSize(store -> lastRemoved) + << " (" << store -> plainSize(store -> lastRemoved) << "/" + << store -> compressedSize(store -> lastRemoved) << ").\n" + << logofs_flush; + } + + #endif + + // + // If the message can't be found we + // will abort the connection. + // + + store -> remove(store -> lastRemoved, discard_checksum, use_data); + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeActionValue(action, position, + store -> lastActionCache); + } + + // + // If it's a cache hit, the position + // where object can be found follows. + // + + if ((T_store_action) action == IS_HIT) + { + // Since ProtoStep7 (#issue 108) + store -> lastHit = position; + + // + // Get data from the cache at given position. + // + + #ifdef DEBUG + + if (store -> get(store -> lastHit)) + { + *logofs << "handleDecodeCached: " << store -> name() << ": Retrieving " + << "object at position " << store -> lastHit + << " of size " << store -> plainSize(store -> lastHit) + << " (" << store -> plainSize(store -> lastHit) << "/" + << store -> compressedSize(store -> lastHit) << ").\n" + << logofs_flush; + } + + #endif + + // + // Must abort the connection if the + // the position is invalid. + // + + Message *message = store -> get(store -> lastHit); + + // + // Make room for the outgoing message. + // + + size = store -> plainSize(store -> lastHit); + + buffer = writeBuffer_.addMessage(size); + + #ifdef DEBUG + *logofs << "handleDecodeCached: " << store -> name() + << ": Prepared an outgoing buffer of " + << size << " bytes.\n" << logofs_flush; + #endif + + // + // Decode the variant part. Pass client + // or server cache to the message store. + // + + store -> updateIdentity(decodeBuffer, message, channelCache); + + // + // Write each field in the outgoing buffer. + // + + store -> unparse(message, buffer, size, bigEndian_); + + #ifdef DUMP + + store -> dump(message); + + #endif + + store -> lastAction = IS_HIT; + + return 1; + } + else if ((T_store_action) action == IS_ADDED) + { + // Since ProtoStep7 (#issue 108) + store -> lastAdded = position; + + #ifdef DEBUG + *logofs << "handleDecodeCached: " << store -> name() + << ": Message will be later stored at position " + << store -> lastAdded << ".\n" << logofs_flush; + #endif + + store -> lastAction = IS_ADDED; + + return 0; + } + else + { + #ifdef DEBUG + *logofs << "handleDecodeCached: " << store -> name() + << ": Message will be later discarded.\n" + << logofs_flush; + #endif + + store -> lastAction = is_discarded; + + return 0; + } +} + +void Channel::handleSaveAdded(MessageStore *store, int split, unsigned char *buffer, + unsigned int size, const unsigned char *compressedData, + const unsigned int compressedDataSize) +{ + #ifdef TEST + + if (store -> lastAction != IS_ADDED) + { + #ifdef PANIC + *logofs << "handleSaveAdded: " << store -> name() + << ": PANIC! Function called for action '" + << store -> lastAction << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Save function called for " + << "store '" << store -> name() << "' with " + << "action '" << store -> lastAction + << "'.\n"; + + HandleCleanup(); + } + + #endif + + Message *message = store -> getTemporary(); + + if (message == NULL) + { + #ifdef PANIC + *logofs << "handleSaveAdded: " << store -> name() + << ": PANIC! Can't access temporary storage " + << "for message at position " << store -> lastAdded + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't access temporary storage " + << "for message at position " << store -> lastAdded + << ".\n"; + + HandleCleanup(); + } + + if (compressedData == NULL) + { + // + // If the data part has been split + // avoid to copy it into the message. + // + + store -> parse(message, split, buffer, size, discard_checksum, + use_data, bigEndian_); + } + else + { + store -> parse(message, buffer, size, compressedData, + compressedDataSize, discard_checksum, + use_data, bigEndian_); + } + + if (store -> add(message, store -> lastAdded, + discard_checksum, use_data) == nothing) + { + #ifdef PANIC + *logofs << "handleSaveAdded: " << store -> name() + << ": PANIC! Can't store message in the cache " + << "at position " << store -> lastAdded << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't store message of type " + << store -> name() << "in the cache at position " + << store -> lastAdded << ".\n"; + + HandleCleanup(); + } + else + { + store -> resetTemporary(); + + #ifdef DEBUG + *logofs << "handleSaveAdded: " << store -> name() << ": Stored " + << (compressedData == NULL ? "plain" : "compressed") + << " object at position " << store -> lastAdded + << " of size " << store -> plainSize(store -> lastAdded) + << " (" << store -> plainSize(store -> lastAdded) << "/" + << store -> compressedSize(store -> lastAdded) << ").\n" + << logofs_flush; + #endif + } + + #ifdef DEBUG + *logofs << "handleSaveAdded: " << store -> name() + << ": Size of store is " << store -> getLocalStorageSize() + << " bytes locally and " << store -> getRemoteStorageSize() + << " bytes remotely.\n" << logofs_flush; + + *logofs << "handleSaveAdded: " << store -> name() + << ": Size of total cache is " << store -> getLocalTotalStorageSize() + << " bytes locally and " << store -> getRemoteTotalStorageSize() + << " bytes remotely.\n" << logofs_flush; + #endif +} + +int Channel::handleWait(int timeout) +{ + #ifdef TEST + *logofs << "handleWait: Going to wait for more data " + << "on FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + T_timestamp startTs = getNewTimestamp(); + + T_timestamp nowTs = startTs; + + int readable; + int remaining; + + for (;;) + { + remaining = timeout - diffTimestamp(startTs, nowTs); + + if (transport_ -> blocked() == 1) + { + #ifdef WARNING + *logofs << "handleWait: WARNING! Having to drain with " + << "channel " << "for FD#" << fd_ << " blocked.\n" + << logofs_flush; + #endif + + handleDrain(0, remaining); + + continue; + } + + if (remaining <= 0) + { + #ifdef TEST + *logofs << "handleWait: Timeout raised while waiting " + << "for more data for FD#" << fd_ << " at " + << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + return 0; + } + + #ifdef TEST + *logofs << "handleWait: Waiting " << remaining << " Ms " + << "for a new message on FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + readable = transport_ -> wait(remaining); + + if (readable > 0) + { + #ifdef TEST + *logofs << "handleWait: WARNING! Encoding more data " + << "for FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + if (proxy -> handleAsyncRead(fd_) < 0) + { + return -1; + } + + return 1; + } + else if (readable == -1) + { + return -1; + } + + nowTs = getNewTimestamp(); + } +} + +int Channel::handleDrain(int limit, int timeout) +{ + #ifdef TEST + *logofs << "handleDrain: Going to drain FD#" << fd_ + << " with a limit of " << limit << " bytes " + << "at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + T_timestamp startTs = getNewTimestamp(); + + T_timestamp nowTs = startTs; + + int drained; + int remaining; + + int result; + + for (;;) + { + remaining = timeout - diffTimestamp(startTs, nowTs); + + if (remaining <= 0) + { + #ifdef TEST + *logofs << "handleDrain: Timeout raised while draining " + << "FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + result = 0; + + goto ChannelDrainEnd; + } + + #ifdef TEST + *logofs << "handleDrain: Trying to write to FD#" + << fd_ << " with " << remaining << " Ms " + << "remaining.\n" << logofs_flush; + #endif + + drained = transport_ -> drain(limit, remaining); + + if (drained == 1) + { + #ifdef TEST + *logofs << "handleDrain: Transport for FD#" << fd_ + << " drained to " << transport_ -> length() + << " bytes at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + result = 1; + + goto ChannelDrainEnd; + } + else if (drained == 0 && transport_ -> readable() > 0) + { + #ifdef TEST + *logofs << "handleDrain: WARNING! Encoding more data " + << "for FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + if (proxy -> handleAsyncRead(fd_) < 0) + { + goto ChannelDrainError; + } + } + else if (drained == -1) + { + goto ChannelDrainError; + } + + nowTs = getNewTimestamp(); + + if (diffTimestamp(startTs, nowTs) >= control -> ChannelTimeout) + { + int seconds = (remaining + control -> LatencyTimeout * 10) / 1000; + + #ifdef WARNING + *logofs << "handleDrain: WARNING! Could not drain FD#" + << fd_ << " within " << seconds << " seconds.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Can't write to connection on FD#" + << fd_ << " since " << seconds << " seconds.\n"; + + if (alert_ == 0) + { + if (control -> ProxyMode == proxy_client) + { + alert_ = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT; + } + else + { + alert_ = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT; + } + + HandleAlert(alert_, 1); + } + } + } + +ChannelDrainEnd: + + // + // Maybe we drained the channel and are + // now out of the congestion state. + // + + handleCongestion(); + + return result; + +ChannelDrainError: + + finish_ = 1; + + return -1; +} + +int Channel::handleCongestion() +{ + // + // Send a begin congestion control code + // if the local end of the channel does + // not consume its data. + // + + if (isCongested() == 1) + { + if (congestion_ == 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleCongestion: Sending congestion for FD#" + << fd_ << " with length " << transport_ -> length() + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + congestion_ = 1; + + // + // Use the callback to send the control + // code immediately. + // + + if (proxy -> handleAsyncCongestion(fd_) < 0) + { + finish_ = 1; + + return -1; + } + } + } + else + { + // + // If the channel was in congestion state + // send an end congestion control code. + // + + if (congestion_ == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleCongestion: Sending decongestion for FD#" + << fd_ << " with length " << transport_ -> length() + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + congestion_ = 0; + + if (proxy -> handleAsyncDecongestion(fd_) < 0) + { + finish_ = 1; + + return -1; + } + } + + // + // Remove the "channel unresponsive" + // dialog. + // + + if (alert_ != 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleCongestion: Displacing the dialog " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + HandleAlert(DISPLACE_MESSAGE_ALERT, 1); + } + } + + return 1; +} + +int Channel::handleFlush(T_flush type, int bufferLength, int scratchLength) +{ + if (finish_ == 1) + { + #ifdef TEST + *logofs << "handleFlush: Not flushing data for " + << "finishing channel for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + writeBuffer_.fullReset(); + + return -1; + } + + #ifdef TEST + *logofs << "handleFlush: Flushing " << bufferLength + << " + " << scratchLength << " bytes " + << "to FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + // + // Check if the channel has data available. + // Recent Linux kernels are very picky. + // They require that we read often or they + // assume that the process is non-interact- + // ive. + // + + int result = 0; + + if (handleAsyncEvents() < 0) + { + goto ChannelFlushError; + } + + // + // Write the data in the main buffer first, + // followed by the data in the scratch buffer. + // + + if (bufferLength > 0) + { + result = transport_ -> write(write_immediate, + writeBuffer_.getData(), bufferLength); + } + + if (result >= 0 && scratchLength > 0) + { + result = transport_ -> write(write_immediate, + writeBuffer_.getScratchData(), scratchLength); + } + + if (type == flush_if_any) + { + writeBuffer_.fullReset(); + } + else + { + writeBuffer_.partialReset(); + } + + // + // If we failed to write to the X connection then + // set the finish flag. The caller should continue + // to handle all the remaining messages or it will + // corrupt the decode buffer. At the real end, an + // error will be propagated to the upper layers + // which will perform any needed cleanup. + // + + if (result < 0) + { + goto ChannelFlushError; + } + + // + // Reset transport buffers. + // + + transport_ -> partialReset(); + + // + // Check if the X server has generated + // any event in response to our data. + // + + if (handleAsyncEvents() < 0) + { + goto ChannelFlushError; + } + + // + // Check if the channel has entered in + // congestion state and, in this case, + // send an immediate congestion control + // code to the remote. + // + + handleCongestion(); + + // + // We could optionally drain the output + // buffer if this is X11 channel. + // + // if (isCongested() == 1 && isReliable() == 1) + // { + // if (handleDrain(0, control -> ChannelTimeout) < 0) + // { + // goto ChannelFlushError; + // } + // } + // + + return 1; + +ChannelFlushError: + + finish_ = 1; + + return -1; +} + +int Channel::handleFlush() +{ + #ifdef TEST + *logofs << "handleFlush: Flushing " + << transport_ -> length() << " bytes to FD#" + << fd_ << " with descriptor writable.\n" + << logofs_flush; + #endif + + // + // Check if there is anything to read + // before anf after having written to + // the socket. + // + + if (handleAsyncEvents() < 0) + { + goto ChannelFlushError; + } + + if (transport_ -> flush() < 0) + { + #ifdef TEST + *logofs << "handleFlush: Failure detected " + << "flushing data to FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + goto ChannelFlushError; + } + + if (handleAsyncEvents() < 0) + { + goto ChannelFlushError; + } + + // + // Reset channel's transport buffers. + // + + transport_ -> partialReset(); + + // + // Check if the channel went out of the + // congestion state. + // + + handleCongestion(); + + return 1; + +ChannelFlushError: + + finish_ = 1; + + return -1; +} + +void Channel::handleResetAlert() +{ + if (alert_ != 0) + { + #ifdef TEST + *logofs << "handleResetAlert: The channel alert '" + << alert_ << "' was displaced.\n" + << logofs_flush; + #endif + + alert_ = 0; + } +} + +int Channel::handleCompress(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned int offset, const unsigned char *buffer, + const unsigned int size, unsigned char *&compressedData, + unsigned int &compressedDataSize) +{ + if (size <= offset) + { + #ifdef DEBUG + *logofs << "handleCompress: Not compressing data for FD#" << fd_ + << " as offset is " << offset << " with data size " + << size << ".\n" << logofs_flush; + #endif + + return 0; + } + + #ifdef DEBUG + *logofs << "handleCompress: Compressing data for FD#" << fd_ + << " with data size " << size << " and offset " + << offset << ".\n" << logofs_flush; + #endif + + // + // It is responsibility of the compressor to + // mark the buffer as such if the compression + // couldn't take place. + // + + if (compressor_ -> compressBuffer(buffer + offset, size - offset, compressedData, + compressedDataSize, encodeBuffer) <= 0) + { + #ifdef DEBUG + *logofs << "handleCompress: Sent " << size - offset + << " bytes of plain data for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + return 0; + } + else + { + #ifdef DEBUG + *logofs << "handleCompress: Sent " << compressedDataSize + << " bytes of compressed data for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return 1; + } +} + +int Channel::handleDecompress(DecodeBuffer &decodeBuffer, const unsigned char opcode, + const unsigned int offset, unsigned char *buffer, + const unsigned int size, const unsigned char *&compressedData, + unsigned int &compressedDataSize) +{ + if (size <= offset) + { + return 0; + } + + int result = compressor_ -> decompressBuffer(buffer + offset, size - offset, + compressedData, compressedDataSize, + decodeBuffer); + if (result < 0) + { + #ifdef PANIC + *logofs << "handleDecompress: PANIC! Failed to decompress " + << size - offset << " bytes of data for FD#" << fd_ + << " with OPCODE#" << (unsigned int) opcode << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Data decompression failed for OPCODE#" + << (unsigned int) opcode << ".\n"; + + return -1; + } + else if (result == 0) + { + #ifdef DEBUG + *logofs << "handleDecompress: Received " << size - offset + << " bytes of plain data for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + return 0; + } + else + { + #ifdef DEBUG + *logofs << "handleDecompress: Received " << compressedDataSize + << " bytes of compressed data for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + return 1; + } +} + +int Channel::handleCleanAndNullRequest(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + #ifdef TEST + *logofs << "handleCleanAndNullRequest: Removing the previous data " + << "and sending an X_NoOperation " << "for FD#" << fd_ + << " due to OPCODE#" << (unsigned int) opcode << " (" + << DumpOpcode(opcode) << ").\n" << logofs_flush; + #endif + + writeBuffer_.removeMessage(size - 4); + + size = 4; + opcode = X_NoOperation; + + return 1; +} + +int Channel::handleNullRequest(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + #ifdef TEST + *logofs << "handleNullRequest: Sending an X_NoOperation for FD#" + << fd_ << " due to OPCODE#" << (unsigned int) opcode + << " (" << DumpOpcode(opcode) << ").\n" + << logofs_flush; + #endif + + size = 4; + buffer = writeBuffer_.addMessage(size); + opcode = X_NoOperation; + + return 1; +} + +void Channel::handleSplitStoreError(int resource) +{ + if (resource < 0 || resource >= CONNECTIONS_LIMIT) + { + #ifdef PANIC + *logofs << "handleSplitStoreError: PANIC! Resource " + << resource << " is out of range with limit " + << "set to " << CONNECTIONS_LIMIT << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Resource " << resource + << " is out of range with limit set to " + << CONNECTIONS_LIMIT << ".\n"; + + HandleCleanup(); + } + else + { + #ifdef PANIC + *logofs << "handleSplitStoreError: PANIC! Cannot " + << "allocate the split store for resource " + << resource << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot allocate the " + << "split store for resource " << resource + << ".\n"; + + HandleCleanup(); + } +} + +void Channel::handleSplitStoreAlloc(List *list, int resource) +{ + if (resource < 0 || resource >= CONNECTIONS_LIMIT) + { + handleSplitStoreError(resource); + } + + if (clientStore_ -> getSplitStore(resource) == NULL) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitStoreAlloc: Allocating a new " + << "split store for resource " << resource + << ".\n" << logofs_flush; + #endif + + SplitStore *splitStore = clientStore_ -> createSplitStore(resource); + + if (splitStore == NULL) + { + handleSplitStoreError(resource); + } + + list -> add(resource); + } + #if defined(TEST) || defined(SPLIT) + else + { + // + // Old proxy versions only use a single + // split store. + // + + if (resource != 0) + { + *logofs << "handleSplitStoreAlloc: WARNING! A split " + << "store for resource " << resource + << " already exists.\n" << logofs_flush; + } + } + #endif +} + +void Channel::handleSplitStoreRemove(List *list, int resource) +{ + if (resource < 0 || resource >= CONNECTIONS_LIMIT) + { + handleSplitStoreError(resource); + } + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore != NULL) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitStoreRemove: Deleting the " + << "split store for resource " << resource + << ".\n" << logofs_flush; + #endif + + clientStore_ -> destroySplitStore(resource); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitStoreRemove: Deleting resource " + << resource << " from the list " << ".\n" + << logofs_flush; + #endif + + list -> remove(resource); + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleSplitStoreRemove: WARNING! A split " + << "store for resource " << resource + << " does not exist.\n" << logofs_flush; + } + #endif +} + +Split *Channel::handleSplitCommitRemove(int request, int resource, int position) +{ + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitCommitRemove: SPLIT! Checking split " + << "commit with resource " << resource << " request " + << request << " and position " << position + << ".\n" << logofs_flush; + #endif + + // + // Remove the split from the split queue. + // + + CommitStore *commitStore = clientStore_ -> getCommitStore(); + + Split *split = commitStore -> pop(); + + if (split == NULL) + { + #ifdef PANIC + *logofs << "handleSplitCommitRemove: PANIC! Can't " + << "find the split in the commit queue.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't find the " + << "split in the commit queue.\n"; + + HandleCleanup(); + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitCommitRemove: SPLIT! Element from " + << "the queue has resource " << split -> getResource() + << " request " << split -> getRequest() << " and " + << "position " << split -> getPosition() + << ".\n" << logofs_flush; + #endif + + // Since ProtoStep7 (#issue 108) + if (resource != split -> getResource() || + request != split -> getRequest() || + position != split -> getPosition()) + { + #ifdef PANIC + *logofs << "handleSplitCommitRemove: PANIC! The data in " + << "the split doesn't match the commit request.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": The data in the split doesn't " + << "match the commit request.\n"; + + return NULL; + } + + #if defined(TEST) || defined(SPLIT) + + commitStore -> dump(); + + #endif + + return split; +} + +int Channel::setReferences() +{ + #ifdef TEST + *logofs << "Channel: Initializing the static " + << "members for the base class.\n" + << logofs_flush; + #endif + + firstClient_ = -1; + + fontPort_ = -1; + + #ifdef REFERENCES + + references_ = 0; + + #endif + + return 1; +} + +int Channel::setOpcodes(OpcodeStore *opcodeStore) +{ + opcodeStore_ = opcodeStore; + + #ifdef TEST + *logofs << "setOpcodes: Propagated opcodes store to channel " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return 1; +} + +int Channel::setStores(ClientStore *clientStore, ServerStore *serverStore) +{ + clientStore_ = clientStore; + serverStore_ = serverStore; + + #ifdef TEST + *logofs << "setStores: Propagated message stores to channel " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return 1; +} + +int Channel::setCaches(ClientCache *clientCache, ServerCache *serverCache) +{ + clientCache_ = clientCache; + serverCache_ = serverCache; + + #ifdef TEST + *logofs << "setCaches: Propagated encode caches to channel " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/Channel.h b/nxcomp/src/Channel.h new file mode 100644 index 000000000..93b022630 --- /dev/null +++ b/nxcomp/src/Channel.h @@ -0,0 +1,664 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Channel_H +#define Channel_H + +#include "Transport.h" + +#include "WriteBuffer.h" + +#include "OpcodeStore.h" + +#include "ClientStore.h" +#include "ServerStore.h" + +#include "ClientCache.h" +#include "ServerCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Forward declaration of referenced classes. +// + +class List; + +class StaticCompressor; + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to log a line when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// Type of traffic carried by channel. +// + +typedef enum +{ + channel_none = -1, + channel_x11, + channel_cups, + channel_smb, + channel_media, + channel_http, + channel_font, + channel_slave, + channel_last_tag + +} T_channel_type; + +// +// Type of notification event to be sent +// by proxy to the X channel. +// + +typedef enum +{ + notify_no_split, + notify_start_split, + notify_commit_split, + notify_end_split, + notify_empty_split, + +} T_notification_type; + +class Channel +{ + public: + + // + // Maximum number of X connections supported. + // + + static const int CONNECTIONS_LIMIT = 256; + + Channel(Transport *transport, StaticCompressor *compressor); + + virtual ~Channel(); + + // + // Read any X message available on the X + // connection and encode it to the encode + // buffer. + // + + virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length) = 0; + + // + // Decode any X message encoded in the + // proxy message and write it to the X + // connection. + // + + virtual int handleWrite(const unsigned char *message, unsigned int length) = 0; + + // + // Other methods to be implemented in + // client, server and generic channel + // classes. + // + + virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, + T_store_action action, int position, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) = 0; + + virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, + T_store_action action, int position, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) = 0; + + virtual int handleSplit(EncodeBuffer &encodeBuffer) = 0; + + virtual int handleSplit(DecodeBuffer &decodeBuffer) = 0; + + virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split) = 0; + + virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) = 0; + + virtual int handleMotion(EncodeBuffer &encodeBuffer) = 0; + + virtual int handleCompletion(EncodeBuffer &encodeBuffer) = 0; + + virtual int handleConfiguration() = 0; + + virtual int handleFinish() = 0; + + // + // Interleave reads of the available + // events while writing data to the + // channel socket. + // + + virtual int handleAsyncEvents() = 0; + + // + // Handle the channel tear down. + // + + int handleClosing() + { + closing_ = 1; + + return 1; + } + + int handleDrop() + { + drop_ = 1; + + return 1; + } + + // + // Try to read more data from the socket. In + // the meanwhile flush any enqueued data if + // the channel is blocked. Return as soon as + // more data has been read or the timeout has + // been exceeded. + // + + int handleWait(int timeout); + + // + // Drain the output buffer while handling the + // data that may become readable. + // + + int handleDrain(int timeout, int limit); + + // + // Flush any remaining data in the transport + // buffer. + // + + int handleFlush(); + + // + // Called when the loop has replaced or + // closed a previous alert. + // + + void handleResetAlert(); + + // + // Initialize all the static members. + // + + static int setReferences(); + + // + // Set pointer to object mapping opcodes + // of NX specific messages. + // + + int setOpcodes(OpcodeStore *opcodeStore); + + // + // Update pointers to message stores in + // channels. + // + + int setStores(ClientStore *clientStore, ServerStore *serverStore); + + // + // The same for channels caches. + // + + int setCaches(ClientCache *clientCache, ServerCache *serverCache); + + // + // Set the port used for tunneling of the + // font server connections. + // + + void setPorts(int fontPort) + { + fontPort_ = fontPort; + } + + // + // Check if there are pending split + // to send to the remote side. + // + + virtual int needSplit() const = 0; + + // + // Check if there are motion events + // to flush. + // + + virtual int needMotion() const = 0; + + // + // Return the type of traffic carried + // by this channel. + // + + virtual T_channel_type getType() const = 0; + + // + // Check if the channel has been marked + // as closing down. + // + + int getFinish() const + { + return finish_; + } + + int getClosing() + { + return closing_; + } + + int getDrop() + { + return drop_; + } + + int getCongestion() + { + return congestion_; + } + + protected: + + int handleFlush(T_flush type) + { + // + // We could write the data immediately if there + // is already something queued to the low level + // TCP buffers. + // + // if (... || transport_ -> queued() > 0) + // { + // ... + // } + // + + if (writeBuffer_.getScratchLength() > 0 || + (type == flush_if_any && writeBuffer_.getLength() > 0) || + writeBuffer_.getLength() >= (unsigned int) + control -> TransportFlushBufferSize) + { + return handleFlush(type, writeBuffer_.getLength(), + writeBuffer_.getScratchLength()); + } + + return 0; + } + + // + // Actually flush the data to the + // channel descriptor. + // + + int handleFlush(T_flush type, int bufferLength, int scratchLength); + + // + // Handle the congestion changes. + // + + int handleCongestion(); + + // + // Encode and decode X messages. + // + + int handleEncode(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, + MessageStore *store, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + int handleDecode(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, + MessageStore *store, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Encode the message based on its + // message store. + // + + int handleEncodeCached(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, + MessageStore *store, const unsigned char *buffer, + const unsigned int size); + + int handleDecodeCached(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, + MessageStore *store, unsigned char *&buffer, + unsigned int &size); + + int handleEncodeIdentity(EncodeBuffer &encodeBuffer, ChannelCache *channelCache, + MessageStore *store, const unsigned char *buffer, + const unsigned int size, int bigEndian) + { + return (store -> encodeIdentity(encodeBuffer, buffer, size, + bigEndian, channelCache)); + } + + int handleDecodeIdentity(DecodeBuffer &decodeBuffer, ChannelCache *channelCache, + MessageStore *store, unsigned char *&buffer, + unsigned int &size, int bigEndian, + WriteBuffer *writeBuffer) + { + return (store -> decodeIdentity(decodeBuffer, buffer, size, bigEndian, + writeBuffer, channelCache)); + } + + // + // Other utility functions used by + // the encoding and decoding methods. + // + + void handleCopy(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned int offset, const unsigned char *buffer, + const unsigned int size) + { + if (size > offset) + { + encodeBuffer.encodeMemory(buffer + offset, size - offset); + } + } + + void handleCopy(DecodeBuffer &decodeBuffer, const unsigned char opcode, + const unsigned int offset, unsigned char *buffer, + const unsigned int size) + { + if (size > offset) + { + memcpy(buffer + offset, decodeBuffer.decodeMemory(size - offset), size - offset); + } + } + + void handleUpdate(MessageStore *store, const unsigned int dataSize, + const unsigned int compressedDataSize) + { + if (store -> lastAction == IS_ADDED) + { + handleUpdateAdded(store, dataSize, compressedDataSize); + } + } + + void handleSave(MessageStore *store, unsigned char *buffer, unsigned int size, + const unsigned char *compressedData = NULL, + const unsigned int compressedDataSize = 0) + { + if (store -> lastAction == IS_ADDED) + { + handleSaveAdded(store, 0, buffer, size, compressedData, compressedDataSize); + } + } + + void handleSaveSplit(MessageStore *store, unsigned char *buffer, + unsigned int size) + { + if (store -> lastAction == IS_ADDED) + { + return handleSaveAdded(store, 1, buffer, size, 0, 0); + } + } + + void handleUpdateAdded(MessageStore *store, const unsigned int dataSize, + const unsigned int compressedDataSize); + + void handleSaveAdded(MessageStore *store, int split, unsigned char *buffer, + unsigned int size, const unsigned char *compressedData, + const unsigned int compressedDataSize); + + // + // Compress the data part of a message + // using ZLIB or another compressor + // and send it over the network. + // + + int handleCompress(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned int offset, const unsigned char *buffer, + const unsigned int size, unsigned char *&compressedData, + unsigned int &compressedDataSize); + + int handleDecompress(DecodeBuffer &decodeBuffer, const unsigned char opcode, + const unsigned int offset, unsigned char *buffer, + const unsigned int size, const unsigned char *&compressedData, + unsigned int &compressedDataSize); + + // + // Send an X_NoOperation to the X server. + // The second version also removes any + // previous data in the write buffer. + // + + int handleNullRequest(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + int handleCleanAndNullRequest(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + // + // X11 channels are considered to be in + // congestion state when there was a + // blocking write and, since then, the + // local end didn't consume all the data. + // + + virtual int isCongested() + { + return (transport_ -> getType() != + transport_agent && transport_ -> length() > + control -> TransportFlushBufferSize); + } + + virtual int isReliable() + { + return 1; + } + + // + // Determine how to handle allocation + // of new messages in the message + // stores. + // + + int mustCleanStore(MessageStore *store) + { + return (store -> getRemoteTotalStorageSize() > control -> + RemoteTotalStorageSize || store -> getLocalTotalStorageSize() > + control -> LocalTotalStorageSize || (store -> getRemoteStorageSize() > + (control -> RemoteTotalStorageSize / 100 * store -> + cacheThreshold)) || (store -> getLocalStorageSize() > + (control -> LocalTotalStorageSize / 100 * store -> + cacheThreshold))); + } + + int canCleanStore(MessageStore *store) + { + return ((store -> getSize() > 0 && (store -> getRemoteStorageSize() > + (control -> RemoteTotalStorageSize / 100 * store -> + cacheLowerThreshold))) || (store -> getLocalStorageSize() > + (control -> LocalTotalStorageSize / 100 * store -> + cacheLowerThreshold))); + } + + protected: + + // + // Set up the split stores. + // + + void handleSplitStoreError(int resource); + + void handleSplitStoreAlloc(List *list, int resource); + void handleSplitStoreRemove(List *list, int resource); + + Split *handleSplitCommitRemove(int request, int resource, int position); + + void validateSize(const char *name, int input, int output, + int offset, int size) + { + if (size < offset || size > control -> MaximumMessageSize || + size != (int) RoundUp4(input) + offset || + output > control -> MaximumMessageSize) + { + *logofs << "Channel: PANIC! Invalid size " << size + << " for " << name << " output with data " + << input << "/" << output << "/" << offset + << "/" << size << ".\n" << logofs_flush; + + cerr << "Error" << ": Invalid size " << size + << " for " << name << " output.\n"; + + HandleAbort(); + } + } + + // + // Is the X client big endian? + // + + int bigEndian() const + { + return bigEndian_; + } + + int bigEndian_; + + // + // Other X server's features + // saved at session startup. + // + + unsigned int imageByteOrder_; + unsigned int bitmapBitOrder_; + unsigned int scanlineUnit_; + unsigned int scanlinePad_; + + int firstRequest_; + int firstReply_; + + // + // Use this class for IO operations. + // + + Transport *transport_; + + // + // The static compressor is created by the + // proxy and shared among channels. + // + + StaticCompressor *compressor_; + + // + // Map NX operations to opcodes. Propagated + // by proxy to all channels on the same X + // server. + // + + OpcodeStore *opcodeStore_; + + // + // Also stores are shared between channels. + // + + ClientStore *clientStore_; + ServerStore *serverStore_; + + // + // Caches are specific for each channel. + // + + ClientCache *clientCache_; + ServerCache *serverCache_; + + // + // Data going to X connection. + // + + WriteBuffer writeBuffer_; + + // + // Other data members. + // + + int fd_; + + int finish_; + int closing_; + int drop_; + int congestion_; + int priority_; + + int alert_; + + // + // It will be set to the descriptor of the + // first X channel that is successfully con- + // nected and will print an info message on + // standard error. + // + + static int firstClient_; + + // + // Port used for font server connections. + // + + static int fontPort_; + + // + // Track which cache operations have been + // enabled by the agent. + // + + int enableCache_; + int enableSplit_; + int enableSave_; + int enableLoad_; + + // + // Keep track of object creation and + // deletion. + // + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +#endif /* Channel_H */ diff --git a/nxcomp/src/ChannelCache.cpp b/nxcomp/src/ChannelCache.cpp new file mode 100644 index 000000000..f30f18bc1 --- /dev/null +++ b/nxcomp/src/ChannelCache.cpp @@ -0,0 +1,68 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ChannelCache.h" + +const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7] = +{ + 16, // x + 16, // y + 16, // width + 16, // height + 16, // border width + 29, // sibling window + 3 // stack mode +}; + +const unsigned int CREATEGC_FIELD_WIDTH[23] = +{ + 4, // function + 32, // plane mask + 32, // foreground + 32, // background + 16, // line width + 2, // line style + 2, // cap style + 2, // join style + 2, // fill style + 1, // fill rule + 29, // tile + 29, // stipple + 16, // tile/stipple x origin + 16, // tile/stipple y origin + 29, // font + 1, // subwindow mode + 1, // graphics exposures + 16, // clip x origin + 16, // clip y origin + 29, // clip mask + 16, // card offset + 8, // dashes + 1 // arc mode +}; diff --git a/nxcomp/src/ChannelCache.h b/nxcomp/src/ChannelCache.h new file mode 100644 index 000000000..6a29c3847 --- /dev/null +++ b/nxcomp/src/ChannelCache.h @@ -0,0 +1,61 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ChannelCache_H +#define ChannelCache_H + +// +// Sizes of optional fields for ConfigureWindow +// request. +// + +extern const unsigned int CONFIGUREWINDOW_FIELD_WIDTH[7]; + +// +// Sizes of optional fields for CreateGC request. +// + +extern const unsigned int CREATEGC_FIELD_WIDTH[23]; + +// +// This is just needed to provide a pointer +// to the base cache class in encoding and +// decoding procedures of message stores. +// + +class ChannelCache +{ + public: + + ChannelCache() + { + } + + ~ChannelCache() + { + } +}; + +#endif /* ChannelCache_H */ diff --git a/nxcomp/src/ChannelEndPoint.cpp b/nxcomp/src/ChannelEndPoint.cpp new file mode 100644 index 000000000..921615bae --- /dev/null +++ b/nxcomp/src/ChannelEndPoint.cpp @@ -0,0 +1,349 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "ChannelEndPoint.h" + +#include "NXalert.h" + +ChannelEndPoint::ChannelEndPoint(const char *spec) + : defaultTCPPort_(0), defaultTCPInterface_(0), + defaultUnixPath_(NULL), spec_(NULL) { + setSpec(spec); +} + +ChannelEndPoint::~ChannelEndPoint() +{ + char *unixPath = NULL; + + if (getUnixPath(&unixPath)) + { + struct stat st; + lstat(unixPath, &st); + if(S_ISSOCK(st.st_mode)) + unlink(unixPath); + } +} + +void +ChannelEndPoint::setSpec(const char *spec) { + if (spec_) free(spec_); + + if (spec && strlen(spec)) + { + spec_ = strdup(spec); + isUnix_ = getUnixPath(); + isTCP_ = getTCPHostAndPort(); + } + else + { + spec_ = NULL; + isUnix_ = false; + isTCP_ = false; + } +} + +void +ChannelEndPoint::setSpec(long port) { + if (port >= 0) { + char tmp[20]; + sprintf(tmp, "%ld", port); + setSpec(tmp); + } + else { + disable(); + } +} + +void +ChannelEndPoint::setSpec(const char *hostName, long port) { + int length; + + if (spec_) free(spec_); + isUnix_ = false; + isTCP_ = false; + + if (hostName && strlen(hostName) && port >= 1) + { + length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); + spec_ = (char *)calloc(length + 1, sizeof(char)); + snprintf(spec_, length+1, "tcp:%s:%ld", hostName, port); + isTCP_ = true; + } + else setSpec((char*)NULL); +} + +bool +ChannelEndPoint::getSpec(char **socketUri) const { + + if (socketUri) *socketUri = NULL; + + char *unixPath = NULL; + char *hostName = NULL; + long port = -1; + + char *newSocketUri = NULL; + int length = -1; + + if (getUnixPath(&unixPath)) + { + length = snprintf(NULL, 0, "unix:%s", unixPath); + } + else if (getTCPHostAndPort(&hostName, &port)) + { + length = snprintf(NULL, 0, "tcp:%s:%ld", hostName, port); + } + + if (length > 0) + { + newSocketUri = (char *)calloc(length + 1, sizeof(char)); + if (isUnixSocket()) + snprintf(newSocketUri, length+1, "unix:%s", unixPath); + else + snprintf(newSocketUri, length+1, "tcp:%s:%ld", hostName, port); + + if (socketUri) + *socketUri = strdup(newSocketUri); + } + + free(newSocketUri); + free(unixPath); + free(hostName); + + if (NULL != *socketUri) + return true; + + return false; +} + +void +ChannelEndPoint::setDefaultTCPPort(long port) { + defaultTCPPort_ = port; +} + +void +ChannelEndPoint::setDefaultTCPInterface(int publicInterface) { + defaultTCPInterface_ = publicInterface; +} + +void +ChannelEndPoint::setDefaultUnixPath(char *path) { + if (defaultUnixPath_) free(defaultUnixPath_); + + if (path && strlen(path)) + defaultUnixPath_ = strdup(path); + else + defaultUnixPath_ = NULL; +} + +void +ChannelEndPoint::disable() { + setSpec("0"); +} + +bool +ChannelEndPoint::getPort(long *port) const { + if (port) *port = 0; + long p = -1; + if (spec_) { + char *end; + p = strtol(spec_, &end, 10); + if ((end == spec_) || (*end != '\0')) + return false; + } + + if (port) *port = p; + return true; +} + +bool +ChannelEndPoint::getUnixPath(char **unixPath) const { + + if (unixPath) *unixPath = 0; + + long p; + char *path = NULL; + + if (getPort(&p)) { + if (p != 1) return false; + } + else if (spec_ && (strncmp("unix:", spec_, 5) == 0)) { + path = spec_ + 5; + } + else + return false; + + if (!path || (*path == '\0')) { + path = defaultUnixPath_; + if (!path) + return false; + } + + if (unixPath) + *unixPath = strdup(path); + + return true; +} + +bool +ChannelEndPoint::isUnixSocket() const { + return isUnix_; +} + +// FIXME!!! +static const char * +getComputerName() { + // + // Strangely enough, under some Windows OSes SMB + // service doesn't bind to localhost. Fall back + // to localhost if can't find computer name in + // the environment. In future we should try to + // bind to localhost and then try the other IPs. + // + + const char *hostname = NULL; + + #ifdef __CYGWIN32__ + + hostname = getenv("COMPUTERNAME"); + + #endif + + if (hostname == NULL) + { + hostname = "localhost"; + } + + return hostname; +} + +bool +ChannelEndPoint::getTCPHostAndPort(char **host, long *port) const { + long p; + char *h = NULL; + ssize_t h_len; + + if (host) *host = NULL; + if (port) *port = 0; + + if (getPort(&p)) { + h_len = 0; + } + else if (spec_ && (strncmp("tcp:", spec_, 4) == 0)) { + h = spec_ + 4; + char *colon = strrchr(h, ':'); + if (colon) { + char *end; + h_len = colon++ - h; + p = strtol(colon, &end, 10); + if ((end == colon) || (*end != '\0')) + return false; + } + else { + h_len = strlen(h); + p = 1; + } + } + else + return false; + + if (p == 1) p = defaultTCPPort_; + if (p < 1) return false; + + if (port) + *port = p; + + if (host) + *host = ( h_len + ? strndup(h, h_len) + : strdup(defaultTCPInterface_ ? getComputerName() : "localhost")); + + return true; +} + +bool +ChannelEndPoint::isTCPSocket() const { + return isTCP_; +} + +long ChannelEndPoint::getTCPPort() const { + long port; + if (getTCPHostAndPort(NULL, &port)) return port; + return -1; +} + +bool +ChannelEndPoint::enabled() const { + return (isUnixSocket() || isTCPSocket()); +} + +bool +ChannelEndPoint::validateSpec() { + isTCP_ = getTCPHostAndPort(); + isUnix_ = getUnixPath(); + return ( getPort() || isUnix_ || isTCP_ ); +} + +ChannelEndPoint &ChannelEndPoint::operator=(const ChannelEndPoint &other) { + char *old; + defaultTCPPort_ = other.defaultTCPPort_; + defaultTCPInterface_ = other.defaultTCPInterface_; + old = defaultUnixPath_; + defaultUnixPath_ = (other.defaultUnixPath_ ? strdup(other.defaultUnixPath_) : NULL); + free(old); + old = spec_; + spec_ = (other.spec_ ? strdup(other.spec_) : NULL); + free(old); + isUnix_ = getUnixPath(); + isTCP_ = getTCPHostAndPort(); + return *this; +} + +std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint) { + if (endPoint.enabled()) { + char* endPointSpec = NULL; + if (endPoint.getSpec(&endPointSpec)) + { + os << endPointSpec; + free(endPointSpec); + } + else + os << "(invalid)"; + } + else + { + os << "(disabled)"; + } + return os; +} diff --git a/nxcomp/src/ChannelEndPoint.h b/nxcomp/src/ChannelEndPoint.h new file mode 100644 index 000000000..4c0c728f3 --- /dev/null +++ b/nxcomp/src/ChannelEndPoint.h @@ -0,0 +1,71 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ChannelEndPoint_H +#define ChannelEndPoint_H + +#include +#include + +class ChannelEndPoint +{ + private: + long defaultTCPPort_; + int defaultTCPInterface_; // 0=localhost, otherwise IP of public interface. + char *defaultUnixPath_; + char *spec_; + bool isUnix_; + bool isTCP_; + + bool getPort(long *port = NULL) const; + + public: + ChannelEndPoint(const char *spec = NULL); + ~ChannelEndPoint(); + ChannelEndPoint &operator=(const ChannelEndPoint &other); + + bool enabled() const; + bool disabled() { return !enabled(); } + void disable(); + void setSpec(const char *spec); + void setSpec(long port); + void setSpec(const char *hostName, long port); + bool getSpec(char **socketUri) const; + void setDefaultTCPPort(long port); + void setDefaultTCPInterface(int publicInterface); + void setDefaultUnixPath(char *path); + + bool getUnixPath(char **path = NULL) const; + bool isUnixSocket() const; + bool getTCPHostAndPort(char **hostname = NULL, long *port = NULL) const; + long getTCPPort() const; + bool isTCPSocket() const; + + bool validateSpec(); +}; + +std::ostream& operator<<(std::ostream& os, const ChannelEndPoint& endPoint); + +#endif diff --git a/nxcomp/src/ChannelStore.h b/nxcomp/src/ChannelStore.h new file mode 100644 index 000000000..53bb60f73 --- /dev/null +++ b/nxcomp/src/ChannelStore.h @@ -0,0 +1,54 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ChannelStore_H +#define ChannelStore_H + +// +// One message store for each opcode. +// + +#define CHANNEL_STORE_OPCODE_LIMIT 256 + +// +// One split store for each resource. +// + +#define CHANNEL_STORE_RESOURCE_LIMIT 256 + +class ChannelStore +{ + public: + + ChannelStore() + { + } + + virtual ~ChannelStore() + { + } +}; + +#endif /* ChannelStore_H */ diff --git a/nxcomp/src/CharCache.cpp b/nxcomp/src/CharCache.cpp new file mode 100644 index 000000000..ed0e5a02a --- /dev/null +++ b/nxcomp/src/CharCache.cpp @@ -0,0 +1,73 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "CharCache.h" + +int CharCache::lookup(unsigned char value, unsigned int &index) +{ + for (unsigned int i = 0; i < length_; i++) + if (value == buffer_[i]) + { + index = i; + if (i) + { + unsigned int target = (i >> 1); + do + { + buffer_[i] = buffer_[i - 1]; + i--; + } + while (i > target); + buffer_[target] = value; + } + return 1; + } + insert(value); + return 0; +} + +void CharCache::insert(unsigned char value) +{ + unsigned int insertionPoint = 0; + if (2 >= length_) + insertionPoint = length_; + else + insertionPoint = 2; + unsigned int start; + if (length_ >= 7) + start = 7 - 1; + else + { + start = length_; + length_++; + } + for (unsigned int k = start; k > insertionPoint; k--) + buffer_[k] = buffer_[k - 1]; + buffer_[insertionPoint] = value; +} diff --git a/nxcomp/src/CharCache.h b/nxcomp/src/CharCache.h new file mode 100644 index 000000000..b8891d2df --- /dev/null +++ b/nxcomp/src/CharCache.h @@ -0,0 +1,91 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef CharCache_H +#define CharCache_H + +// +// CharCache is a counterpart of IntCache that is +// optimized for use in compressing text composed +// of 8-bit characters. +// + +class CharCache +{ + public: + + CharCache() : length_(0) + { + } + + ~CharCache() + { + } + + unsigned int getSize() const + { + return (unsigned int) length_; + } + + int lookup(unsigned char value, unsigned int &index); + + // + // This can be inlined as it is only + // called by decodeCachedValue(). + // + + unsigned int get(unsigned int index) + { + unsigned char result = buffer_[index]; + + if (index != 0) + { + unsigned int i = index; + unsigned int target = (i >> 1); + + do + { + buffer_[i] = buffer_[i - 1]; + + i--; + } + while (i > target); + + buffer_[target] = result; + } + + return (unsigned int) result; + } + + void insert(unsigned char value); + + private: + + unsigned char length_; + + unsigned char buffer_[7]; +}; + +#endif /* CharCache_H */ diff --git a/nxcomp/src/Children.cpp b/nxcomp/src/Children.cpp new file mode 100644 index 000000000..49ab13352 --- /dev/null +++ b/nxcomp/src/Children.cpp @@ -0,0 +1,1059 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "NX.h" + +#include "Misc.h" + +#include "Types.h" +#include "Timestamp.h" + +#include "Control.h" +#include "Statistics.h" +#include "Proxy.h" + +#include "Keeper.h" +#include "Fork.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define DISPLAY_LENGTH_LIMIT 256 +#define DEFAULT_STRING_LIMIT 512 + +// +// These are from the main loop. +// + +extern Keeper *keeper; + +extern int (*handler)(int); + +extern int useUnixSocket; + +extern int lastDialog; +extern int lastWatchdog; +extern int lastKeeper; + +extern void CleanupListeners(); +extern void CleanupSockets(); +extern void CleanupAgent(); +extern void CleanupGlobal(); + +extern void InstallSignals(); + +extern char *GetClientPath(); + +extern int CheckParent(const char *name, const char *type, + int parent); + +#ifdef __sun +extern char **environ; +#endif + +// +// Close all the unused descriptors and +// install any signal handler that might +// have been disabled in the main process. +// + +static void SystemCleanup(const char *name); + +// +// Release all objects allocated in the +// heap. + +static void MemoryCleanup(const char *name); + +// +// Remove 'name' from the environment. +// + +static int UnsetEnv(const char *name); + +static int NXTransKeeperHandler(int signal); +static void NXTransKeeperCheck(); + + +// +// Start a nxclient process in dialog mode. +// + +int NXTransDialog(const char *caption, const char *message, + const char *window, const char *type, int local, + const char* display) +{ + // + // Be sure log file is valid. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + int pid; + + #ifdef TEST + *logofs << "NXTransDialog: Going to fork with NX pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + pid = Fork(); + + if (pid != 0) + { + if (pid < 0) + { + #ifdef TEST + *logofs << "NXTransDialog: WARNING! Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + #ifdef TEST + else + { + *logofs << "NXTransDialog: Created NX dialog process " + << "with pid '" << pid << "'.\n" + << logofs_flush; + } + #endif + + return pid; + } + + #ifdef TEST + *logofs << "NXTransDialog: Executing child with pid '" + << getpid() << "' and parent '" << getppid() + << "'.\n" << logofs_flush; + #endif + + SystemCleanup("NXTransDialog"); + + // + // Copy the client command before + // freeing up the control class. + // + + char command[DEFAULT_STRING_LIMIT]; + + if (control != NULL) + { + strcpy(command, control -> ClientPath); + } + else + { + char *path = GetClientPath(); + + strcpy(command, path); + + delete [] path; + } + + // + // Get rid of the unused resources. + // + + MemoryCleanup("NXTransDialog"); + + #ifdef TEST + *logofs << "NXTransDialog: Running external NX dialog with caption '" + << caption << "' message '" << message << "' type '" + << type << "' local '" << local << "' display '" + << display << "'.\n" + << logofs_flush; + #endif + + int pulldown = (strcmp(type, "pulldown") == 0); + + char parent[DEFAULT_STRING_LIMIT]; + + snprintf(parent, DEFAULT_STRING_LIMIT, "%d", getppid()); + + parent[DEFAULT_STRING_LIMIT - 1] = '\0'; + + UnsetEnv("LD_LIBRARY_PATH"); + + for (int i = 0; i < 2; i++) + { + if (local != 0) + { + if (pulldown) + { + execlp(command, command, "--dialog", type, "--caption", caption, + "--window", window, "--local", "--parent", parent, + "--display", display, NULL); + } + else + { + execlp(command, command, "--dialog", type, "--caption", caption, + "--message", message, "--local", "--parent", parent, + "--display", display, NULL); + } + } + else + { + if (pulldown) + { + execlp(command, command, "--dialog", type, "--caption", caption, + "--window", window, "--parent", parent, + "--display", display, NULL); + } + else + { + execlp(command, command, "--dialog", type, "--caption", caption, + "--message", message, "--parent", parent, + "--display", display, NULL); + } + } + + #ifdef WARNING + *logofs << "NXTransDialog: WARNING! Couldn't start '" + << command << "'. " << "Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Couldn't start '" << command + << "'. Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + // + // Retry by looking for the default name + // in the default NX path. + // + + if (i == 0) + { + + strcpy(command, "nxclient"); + + char newPath[DEFAULT_STRING_LIMIT]; + + strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:"); + + #ifdef __APPLE__ + + strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:"); + + #endif + + #ifdef __CYGWIN32__ + + strcat(newPath, ".:"); + + #endif + + int newLength = strlen(newPath); + + char *oldPath = getenv("PATH"); + + strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1); + + newPath[DEFAULT_STRING_LIMIT - 1] = '\0'; + + #ifdef WARNING + *logofs << "NXTransDialog: WARNING! Trying with path '" + << newPath << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Trying with path '" << newPath + << "'.\n"; + + // + // Solaris doesn't seem to have + // function setenv(). + // + + #ifdef __sun + + char newEnv[DEFAULT_STRING_LIMIT + 5]; + + sprintf(newEnv,"PATH=%s", newPath); + + putenv(newEnv); + + #else + + setenv("PATH", newPath, 1); + + #endif + + } + } + + // + // Hopefully useless. + // + + exit(0); +} + +// +// Start a nxclient process in dialog mode. +// + +int NXTransClient(const char* display) +{ + // + // Be sure log file is valid. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + int pid; + + #ifdef TEST + *logofs << "NXTransClient: Going to fork with NX pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + pid = Fork(); + + if (pid != 0) + { + if (pid < 0) + { + #ifdef TEST + *logofs << "NXTransClient: WARNING! Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + #ifdef TEST + else + { + *logofs << "NXTransClient: Created NX client process " + << "with pid '" << pid << "'.\n" + << logofs_flush; + } + #endif + + return pid; + } + + #ifdef TEST + *logofs << "NXTransClient: Executing child with pid '" + << getpid() << "' and parent '" << getppid() + << "'.\n" << logofs_flush; + #endif + + SystemCleanup("NXTransClient"); + + // + // Copy the client command before + // freeing up the control class. + // + + char command[DEFAULT_STRING_LIMIT]; + + if (control != NULL) + { + strcpy(command, control -> ClientPath); + } + else + { + char *path = GetClientPath(); + + strcpy(command, path); + + delete [] path; + } + + // + // Get rid of unused resources. + // + + MemoryCleanup("NXTransClient"); + + #ifdef TEST + *logofs << "NXTransClient: Running external NX client with display '" + << display << "'.\n" << logofs_flush; + #endif + + // + // Provide the display in the environment. + // + + char newDisplay[DISPLAY_LENGTH_LIMIT]; + + #ifdef __sun + + snprintf(newDisplay, DISPLAY_LENGTH_LIMIT - 1, "DISPLAY=%s", display); + + newDisplay[DISPLAY_LENGTH_LIMIT - 1] = '\0'; + + putenv(newDisplay); + + #else + + strncpy(newDisplay, display, DISPLAY_LENGTH_LIMIT - 1); + + newDisplay[DISPLAY_LENGTH_LIMIT - 1] = '\0'; + + setenv("DISPLAY", newDisplay, 1); + + #endif + + UnsetEnv("LD_LIBRARY_PATH"); + + for (int i = 0; i < 2; i++) + { + execlp(command, command, NULL); + + #ifdef WARNING + *logofs << "NXTransClient: WARNING! Couldn't start '" + << command << "'. Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Couldn't start '" << command + << "'. Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + // + // Retry by looking for the default name + // in the default NX path. + // + + if (i == 0) + { + + strcpy(command, "nxclient"); + + char newPath[DEFAULT_STRING_LIMIT]; + + strcpy(newPath, "/usr/NX/bin:/opt/NX/bin:/usr/local/NX/bin:"); + + #ifdef __APPLE__ + + strcat(newPath, "/Applications/NX Client for OSX.app/Contents/MacOS:"); + + #endif + + #ifdef __CYGWIN32__ + + strcat(newPath, ".:"); + + #endif + + int newLength = strlen(newPath); + + char *oldPath = getenv("PATH"); + + strncpy(newPath + newLength, oldPath, DEFAULT_STRING_LIMIT - newLength - 1); + + newPath[DEFAULT_STRING_LIMIT - 1] = '\0'; + + #ifdef WARNING + *logofs << "NXTransClient: WARNING! Trying with path '" + << newPath << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Trying with path '" << newPath + << "'.\n"; + + // + // Solaris doesn't seem to have + // function setenv(). + // + + #ifdef __sun + + char newEnv[DEFAULT_STRING_LIMIT + 5]; + + sprintf(newEnv,"PATH=%s", newPath); + + putenv(newEnv); + + #else + + setenv("PATH", newPath, 1); + + #endif + } + + } + // + // Hopefully useless. + // + + exit(0); +} + +// +// Wait until the timeout is expired. +// The timeout is expressed in milli- +// seconds. +// + +int NXTransWatchdog(int timeout) +{ + // + // Be sure log file is valid. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + int pid; + + #ifdef TEST + *logofs << "NXTransWatchdog: Going to fork with NX pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + pid = Fork(); + + if (pid != 0) + { + if (pid < 0) + { + #ifdef TEST + *logofs << "NXTransWatchdog: WARNING! Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + #ifdef TEST + else + { + *logofs << "NXTransWatchdog: Created NX watchdog process " + << "with pid '" << pid << "'.\n" << logofs_flush; + } + #endif + + return pid; + } + + int parent = getppid(); + + #ifdef TEST + *logofs << "NXTransWatchdog: Executing child with pid '" + << getpid() << "' and parent '" << parent + << "'.\n" << logofs_flush; + #endif + + SystemCleanup("NXTransWatchdog"); + + // + // Get rid of unused resources. + // + + MemoryCleanup("NXTransWatchdog"); + + // + // Run until the timeout is expired + // or forever, if no timeout is + // provided. + // + + T_timestamp startTs = getTimestamp(); + + int diffTs = 0; + + for (;;) + { + // + // Complain if the parent is dead. + // + + if (CheckParent("NXTransWatchdog", "watchdog", parent) == 0) + { + #ifdef TEST + *logofs << "NXTransWatchdog: Exiting with no parent " + << "running.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + if (timeout > 0) + { + if (diffTs >= timeout) + { + #ifdef TEST + *logofs << "NXTransWatchdog: Timeout of " << timeout + << " Ms raised in watchdog.\n" << logofs_flush; + #endif + + // + // We will just exit. Our parent should be + // monitoring us and detect that the process + // is gone. + // + + HandleCleanup(); + } + } + + if (timeout > 0) + { + #ifdef TEST + *logofs << "NXTransWatchdog: Waiting for the timeout " + << "with " << timeout - diffTs << " Ms to run.\n" + << logofs_flush; + #endif + + usleep((timeout - diffTs) * 1000); + + diffTs = diffTimestamp(startTs, getNewTimestamp()); + } + else + { + #ifdef TEST + *logofs << "NXTransWatchdog: Waiting for a signal.\n" + << logofs_flush; + #endif + + sleep(10); + } + } + + // + // Hopefully useless. + // + + exit(0); +} + +int NXTransKeeperHandler(int signal) +{ + if (keeper != NULL) + { + switch (signal) + { + case SIGTERM: + case SIGINT: + case SIGHUP: + { + #ifdef TEST + *logofs << "NXTransKeeperHandler: Requesting giveup " + << "because of signal " << signal << " ,'" + << DumpSignal(signal) << "'.\n" + << logofs_flush; + #endif + + keeper -> setSignal(signal); + + return 0; + } + } + } + + return 1; +} + +void NXTransKeeperCheck() +{ + if (CheckParent("NXTransKeeper", "keeper", + keeper -> getParent()) == 0 || keeper -> getSignal() != 0) + { + #ifdef TEST + *logofs << "NXTransKeeperCheck: Exiting because of signal " + << "or no parent running.\n" << logofs_flush; + #endif + + HandleCleanup(); + } +} + +int NXTransKeeper(int caches, int images, const char *root) +{ + // + // Be sure log file is valid. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + if (caches == 0 && images == 0) + { + #ifdef TEST + *logofs << "NXTransKeeper: No NX cache house-keeping needed.\n" + << logofs_flush; + #endif + + return 0; + } + + int pid; + + #ifdef TEST + *logofs << "NXTransKeeper: Going to fork with NX pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + pid = Fork(); + + if (pid != 0) + { + if (pid < 0) + { + #ifdef TEST + *logofs << "NXTransKeeper: WARNING! Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + #ifdef TEST + else + { + *logofs << "NXTransKeeper: Created NX keeper process " + << "with pid '" << pid << "'.\n" + << logofs_flush; + } + #endif + + return pid; + } + + int parent = getppid(); + + #ifdef TEST + *logofs << "NXTransKeeper: Executing child with pid '" + << getpid() << "' and parent '" << parent + << "'.\n" << logofs_flush; + #endif + + SystemCleanup("NXTransKeeper"); + + #ifdef TEST + *logofs << "NXTransKeeper: Going to run with caches " << caches + << " images " << images << " and root " << root + << " at " << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + // + // Create the house-keeper class. + // + + int timeout = control -> KeeperTimeout; + + keeper = new Keeper(caches, images, root, 100, parent); + + handler = NXTransKeeperHandler; + + if (keeper == NULL) + { + #ifdef PANIC + *logofs << "NXTransKeeper: PANIC! Failed to create the keeper object.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to create the keeper object.\n"; + + HandleCleanup(); + } + + // + // Get rid of unused resources. Root path + // must be copied in keeper's constructor + // before control is deleted. + // + + MemoryCleanup("NXTransKeeper"); + + // + // Decrease the priority of this process. + // + // The following applies to Cygwin: "Cygwin processes can be + // set to IDLE_PRIORITY_CLASS, NORMAL_PRIORITY_CLASS, HIGH_- + // PRIORITY_CLASS, or REALTIME_PRIORITY_CLASS with the nice + // call. If you pass a positive number to nice(), then the + // priority level will decrease by one (within the above list + // of priorities). A negative number would make it increase + // by one. It is not possible to change it by more than one + // at a time without making repeated calls". + // + + if (nice(5) < 0 && errno != 0) + { + #ifdef WARNING + *logofs << "NXTransKeeper: WARNING! Failed to renice process to +5. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to renice process to +5. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + + // + // Delay a bit the first run to give + // a boost to the session startup. + // + + #ifdef TEST + *logofs << "NXTransKeeper: Going to sleep for " + << timeout / 20 << " Ms.\n" << logofs_flush; + #endif + + usleep(timeout / 20 * 1000); + + NXTransKeeperCheck(); + + // + // The house keeping of the persistent + // caches is performed only once. + // + + if (caches != 0) + { + #ifdef TEST + *logofs << "NXTransKeeper: Going to cleanup the NX cache " + << "directories at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + keeper -> cleanupCaches(); + + #ifdef TEST + *logofs << "NXTransKeeper: Completed cleanup of NX cache " + << "directories at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + } + #ifdef TEST + else + { + *logofs << "NXTransKeeper: Nothing to do for the " + << "persistent caches.\n" << logofs_flush; + } + #endif + + if (images == 0) + { + #ifdef TEST + *logofs << "NXTransKeeper: Nothing to do for the " + << "persistent images.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + // + // Take care of the persisten image cache. + // Run a number of iterations and then exit, + // so we can keep the memory consumption + // low. The parent will check our exit code + // and will eventually restart us. + // + + for (int iterations = 0; iterations < 100; iterations++) + { + #ifdef TEST + *logofs << "NXTransKeeper: Running iteration " << iterations + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + NXTransKeeperCheck(); + + #ifdef TEST + *logofs << "NXTransKeeper: Going to cleanup the NX images " + << "directories at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + if (keeper -> cleanupImages() < 0) + { + #ifdef TEST + *logofs << "NXTransKeeper: Exiting because of error " + << "handling the image cache.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "NXTransKeeper: Completed cleanup of NX images " + << "directories at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + NXTransKeeperCheck(); + + #ifdef TEST + *logofs << "NXTransKeeper: Going to sleep for " << timeout + << " Ms.\n" << logofs_flush; + #endif + + usleep(timeout * 1000); + } + + HandleCleanup(2); + + // + // Hopefully useless. + // + + exit(0); +} + +void SystemCleanup(const char *name) +{ + #ifdef TEST + *logofs << name << ": Performing system cleanup in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + // + // Reinstall signals that might + // have been restored by agents. + // + + InstallSignals(); +} + +void MemoryCleanup(const char *name) +{ + #ifdef TEST + *logofs << name << ": Performing memory cleanup in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + DisableSignals(); + + // + // Prevent deletion of unix socket + // and lock file. + // + + useUnixSocket = 0; + + // + // Don't let cleanup kill other + // children. + // + + lastDialog = 0; + lastWatchdog = 0; + lastKeeper = 0; + + CleanupListeners(); + + CleanupSockets(); + + CleanupGlobal(); + + EnableSignals(); +} + +int UnsetEnv(const char *name) +{ + int result; + + #ifdef __sun + + char **pEnv = environ; + + int nameLen = strlen(name) + 1; + + char *varName = new char[nameLen + 1]; + + strcpy(varName, name); + + strcat(varName, "="); + + pEnv = environ; + + while (*pEnv != NULL) + { + if (!strncmp(varName, *pEnv, nameLen)) + { + break; + } + + *pEnv++; + } + + while (*pEnv != NULL) + { + *pEnv = *(pEnv + 1); + + pEnv++; + } + + result = 0; + + #else + + #ifdef __APPLE__ + + unsetenv(name); + result = 0; + + #else + + result = unsetenv(name); + + #endif + + #endif + + return result; +} diff --git a/nxcomp/src/ClearArea.cpp b/nxcomp/src/ClearArea.cpp new file mode 100644 index 000000000..0cb152d95 --- /dev/null +++ b/nxcomp/src/ClearArea.cpp @@ -0,0 +1,125 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ClearArea.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int ClearAreaStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ClearAreaMessage *clearArea = (ClearAreaMessage *) message; + + // + // Here is the fingerprint. + // + + clearArea -> exposures = *(buffer + 1); + + clearArea -> window = GetULONG(buffer + 4, bigEndian); + + clearArea -> x = GetUINT(buffer + 8, bigEndian); + clearArea -> y = GetUINT(buffer + 10, bigEndian); + clearArea -> width = GetUINT(buffer + 12, bigEndian); + clearArea -> height = GetUINT(buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ClearAreaStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ClearAreaMessage *clearArea = (ClearAreaMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = clearArea -> exposures; + + PutULONG(clearArea -> window, buffer + 4, bigEndian); + + PutUINT(clearArea -> x, buffer + 8, bigEndian); + PutUINT(clearArea -> y, buffer + 10, bigEndian); + PutUINT(clearArea -> width, buffer + 12, bigEndian); + PutUINT(clearArea -> height, buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ClearAreaStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ClearAreaMessage *clearArea = (ClearAreaMessage *) message; + + *logofs << name() << ": Identity exposures " << (unsigned int) clearArea -> exposures + << ", window " << clearArea -> window << ", x " << clearArea -> x + << ", y " << clearArea -> y << ", width " << clearArea -> width + << ", height " << clearArea -> height << ", size " << clearArea -> size_ + << ".\n"; + + #endif +} + +void ClearAreaStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 4, 4); + md5_append(md5_state_, buffer + 8, 2); + md5_append(md5_state_, buffer + 10, 2); + md5_append(md5_state_, buffer + 12, 2); + md5_append(md5_state_, buffer + 14, 2); +} diff --git a/nxcomp/src/ClearArea.h b/nxcomp/src/ClearArea.h new file mode 100644 index 000000000..8067edffd --- /dev/null +++ b/nxcomp/src/ClearArea.h @@ -0,0 +1,182 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ClearArea_H +#define ClearArea_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define CLEARAREA_ENABLE_CACHE 1 +#define CLEARAREA_ENABLE_DATA 0 +#define CLEARAREA_ENABLE_SPLIT 0 +#define CLEARAREA_ENABLE_COMPRESS 0 + +#define CLEARAREA_DATA_LIMIT 0 +#define CLEARAREA_DATA_OFFSET 16 + +#define CLEARAREA_CACHE_SLOTS 3000 +#define CLEARAREA_CACHE_THRESHOLD 5 +#define CLEARAREA_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class ClearAreaMessage : public Message +{ + friend class ClearAreaStore; + + public: + + ClearAreaMessage() + { + } + + ~ClearAreaMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char exposures; + unsigned int window; + unsigned short x; + unsigned short y; + unsigned short width; + unsigned short height; +}; + +class ClearAreaStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ClearAreaStore() : MessageStore() + { + enableCache = CLEARAREA_ENABLE_CACHE; + enableData = CLEARAREA_ENABLE_DATA; + enableSplit = CLEARAREA_ENABLE_SPLIT; + enableCompress = CLEARAREA_ENABLE_COMPRESS; + + dataLimit = CLEARAREA_DATA_LIMIT; + dataOffset = CLEARAREA_DATA_OFFSET; + + cacheSlots = CLEARAREA_CACHE_SLOTS; + cacheThreshold = CLEARAREA_CACHE_THRESHOLD; + cacheLowerThreshold = CLEARAREA_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~ClearAreaStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "ClearArea"; + } + + virtual unsigned char opcode() const + { + return X_ClearArea; + } + + virtual unsigned int storage() const + { + return sizeof(ClearAreaMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ClearAreaMessage(); + } + + virtual Message *create(const Message &message) const + { + return new ClearAreaMessage((const ClearAreaMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (ClearAreaMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* ClearArea_H */ diff --git a/nxcomp/src/ClientCache.cpp b/nxcomp/src/ClientCache.cpp new file mode 100644 index 000000000..47bb7db1d --- /dev/null +++ b/nxcomp/src/ClientCache.cpp @@ -0,0 +1,392 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ClientCache.h" + +ClientCache::ClientCache() : + + freeGCCache(16), freeDrawableCache(16), freeWindowCache(16), + + cursorCache(16), colormapCache(16), visualCache(16), lastFont(0), + + changePropertyPropertyCache(16), changePropertyTypeCache(16), + changePropertyData32Cache(16), + + configureWindowBitmaskCache(4), + + convertSelectionRequestorCache(16), + convertSelectionLastTimestamp(0), + + copyPlaneBitPlaneCache(8), + + createGCBitmaskCache(8), + + createPixmapIdCache(16), createPixmapLastId(0), + createPixmapXCache(8), createPixmapYCache(8), + + createWindowBitmaskCache(8), + + fillPolyNumPointsCache(8), fillPolyIndex(0), + + getSelectionOwnerSelectionCache(8), + + grabButtonEventMaskCache(8), grabButtonConfineCache(8), + grabButtonModifierCache(8), + + grabKeyboardLastTimestamp(0), + + imageTextLengthCache(8), + imageTextLastX(0), imageTextLastY(0), + imageTextCacheX(8), imageTextCacheY(8), + + polySegmentCacheX(8), polySegmentCacheY(8), polySegmentCacheIndex(0), + + polyTextLastX(0), polyTextLastY(0), polyTextCacheX(8), + polyTextCacheY(8), polyTextFontCache(8), + + putImageWidthCache(8), putImageHeightCache(8), putImageLastX(0), + putImageLastY(0), putImageXCache(8), putImageYCache(8), + + getImagePlaneMaskCache(8), + + queryColorsLastPixel(0), + + setClipRectanglesXCache(8), setClipRectanglesYCache(8), + + setDashesLengthCache(8), setDashesOffsetCache(8), + + setSelectionOwnerCache(8), setSelectionOwnerTimestampCache(8), + + translateCoordsSrcCache(8), translateCoordsDstCache(8), + translateCoordsXCache(8), translateCoordsYCache(8), + + sendEventMaskCache(16), sendEventLastSequence(0), + sendEventIntDataCache(16), + + putPackedImageSrcLengthCache(16), putPackedImageDstLengthCache(16), + + // + // RenderExtension requests. + // + + renderFreePictureCache(16), + + renderGlyphSetCache(16), + renderFreeGlyphSetCache(16), + + renderIdCache(8), + + renderLengthCache(16), renderFormatCache(16), + renderValueMaskCache(8), renderNumGlyphsCache(8), + + renderXCache(16), renderYCache(16), + renderLastX(0), renderLastY(0), + + renderWidthCache(16), renderHeightCache(16), + + renderLastId(0), + + renderGlyphXCache(16), renderGlyphYCache(16), + renderGlyphX(0), renderGlyphY(0), + + renderLastCompositeGlyphsData(0), + + setCacheParametersCache(8), + + lastIdCache(16), lastId(0) + +{ + unsigned int i; + + for (i = 0; i < 3; i++) + { + allocColorRGBCache[i] = new IntCache(8); + + convertSelectionAtomCache[i] = new IntCache(8); + } + + for (i = 0; i < 4; i++) + { + clearAreaGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 7; i++) + { + configureWindowAttrCache[i] = new IntCache(8); + } + + for (i = 0; i < 6; i++) + { + copyAreaGeomCache[i] = new IntCache(8); + copyPlaneGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 23; i++) + { + if (CREATEGC_FIELD_WIDTH[i] > 16) + { + createGCAttrCache[i] = new IntCache(16); + } + else + { + createGCAttrCache[i] = new IntCache(CREATEGC_FIELD_WIDTH[i]); + } + } + + for (i = 0; i < 6; i++) + { + createWindowGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 15; i++) + { + createWindowAttrCache[i] = new IntCache(8); + } + + for (i = 0; i < 10; i++) + { + fillPolyXRelCache[i] = new IntCache(8); + fillPolyXAbsCache[i] = new IntCache(8); + fillPolyYRelCache[i] = new IntCache(8); + fillPolyYAbsCache[i] = new IntCache(8); + } + + for (i = 0; i < 8; i++) + { + fillPolyRecentX[i] = 0; + fillPolyRecentY[i] = 0; + } + + for (i = 0; i < 4; i++) + { + polyFillRectangleCacheX[i] = new IntCache(8); + polyFillRectangleCacheY[i] = new IntCache(8); + polyFillRectangleCacheWidth[i] = new IntCache(8); + polyFillRectangleCacheHeight[i] = new IntCache(8); + } + + for (i = 0; i < 2; i++) + { + polyLineCacheX[i] = new IntCache(8); + polyLineCacheY[i] = new IntCache(8); + } + + for (i = 0; i < 2; i++) + { + polyPointCacheX[i] = new IntCache(8); + polyPointCacheY[i] = new IntCache(8); + } + + for (i = 0; i < 4; i++) + { + polyRectangleGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 2; i++) + { + polySegmentLastX[i] = 0; + polySegmentLastY[i] = 0; + } + + for (i = 0; i < 4; i++) + { + setClipRectanglesGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 2; i++) + { + polyFillArcCacheX[i] = new IntCache(8); + polyFillArcCacheY[i] = new IntCache(8); + polyFillArcCacheWidth[i] = new IntCache(8); + polyFillArcCacheHeight[i] = new IntCache(8); + polyFillArcCacheAngle1[i] = new IntCache(8); + polyFillArcCacheAngle2[i] = new IntCache(8); + } + + for (i = 0; i < 2; i++) + { + polyArcCacheX[i] = new IntCache(8); + polyArcCacheY[i] = new IntCache(8); + polyArcCacheWidth[i] = new IntCache(8); + polyArcCacheHeight[i] = new IntCache(8); + polyArcCacheAngle1[i] = new IntCache(8); + polyArcCacheAngle2[i] = new IntCache(8); + } + + for (i = 0; i < 8; i++) + { + shapeDataCache[i] = new IntCache(8); + } + + for (i = 0; i < 8; i++) + { + genericRequestDataCache[i] = new IntCache(8); + } + + for (i = 0; i < 16; i++) + { + renderDataCache[i] = new IntCache(16); + } + + for (i = 0; i < 16; i++) + { + renderCompositeGlyphsDataCache[i] = new IntCache(16); + } + + for (i = 0; i < 3; i++) + { + renderCompositeDataCache[i] = new IntCache(16); + } +} + + +ClientCache::~ClientCache() +{ + unsigned int i; + + for (i = 0; i < 3; i++) + { + delete allocColorRGBCache[i]; + delete convertSelectionAtomCache[i]; + } + + for (i = 0; i < 4; i++) + { + delete clearAreaGeomCache[i]; + } + + for (i = 0; i < 7; i++) + { + delete configureWindowAttrCache[i]; + } + + for (i = 0; i < 6; i++) + { + delete copyAreaGeomCache[i]; + delete copyPlaneGeomCache[i]; + } + + for (i = 0; i < 23; i++) + { + delete createGCAttrCache[i]; + } + + for (i = 0; i < 6; i++) + { + delete createWindowGeomCache[i]; + } + + for (i = 0; i < 15; i++) + { + delete createWindowAttrCache[i]; + } + + for (i = 0; i < 10; i++) + { + delete fillPolyXRelCache[i]; + delete fillPolyXAbsCache[i]; + delete fillPolyYRelCache[i]; + delete fillPolyYAbsCache[i]; + } + + for (i = 0; i < 4; i++) + { + delete polyFillRectangleCacheX[i]; + delete polyFillRectangleCacheY[i]; + delete polyFillRectangleCacheWidth[i]; + delete polyFillRectangleCacheHeight[i]; + } + + for (i = 0; i < 2; i++) + { + delete polyLineCacheX[i]; + delete polyLineCacheY[i]; + } + + for (i = 0; i < 2; i++) + { + delete polyPointCacheX[i]; + delete polyPointCacheY[i]; + } + + for (i = 0; i < 4; i++) + { + delete polyRectangleGeomCache[i]; + } + + for (i = 0; i < 4; i++) + { + delete setClipRectanglesGeomCache[i]; + } + + for (i = 0; i < 2; i++) + { + delete polyFillArcCacheX[i]; + delete polyFillArcCacheY[i]; + delete polyFillArcCacheWidth[i]; + delete polyFillArcCacheHeight[i]; + delete polyFillArcCacheAngle1[i]; + delete polyFillArcCacheAngle2[i]; + } + + for (i = 0; i < 2; i++) + { + delete polyArcCacheX[i]; + delete polyArcCacheY[i]; + delete polyArcCacheWidth[i]; + delete polyArcCacheHeight[i]; + delete polyArcCacheAngle1[i]; + delete polyArcCacheAngle2[i]; + } + + for (i = 0; i < 8; i++) + { + delete shapeDataCache[i]; + } + + for (i = 0; i < 8; i++) + { + delete genericRequestDataCache[i]; + } + + for (i = 0; i < 16; i++) + { + delete renderDataCache[i]; + } + + for (i = 0; i < 16; i++) + { + delete renderCompositeGlyphsDataCache[i]; + } + + for (i = 0; i < 3; i++) + { + delete renderCompositeDataCache[i]; + } +} diff --git a/nxcomp/src/ClientCache.h b/nxcomp/src/ClientCache.h new file mode 100644 index 000000000..ed3361097 --- /dev/null +++ b/nxcomp/src/ClientCache.h @@ -0,0 +1,417 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ClientCache_H +#define ClientCache_H + +#include "Misc.h" + +#include "IntCache.h" +#include "CharCache.h" +#include "OpcodeCache.h" +#include "XidCache.h" +#include "FreeCache.h" + +#include "ChannelCache.h" + +class ClientCache : public ChannelCache +{ + public: + + ClientCache(); + + ~ClientCache(); + + // + // Opcode prediction caches. + // + + OpcodeCache opcodeCache; + + // + // GC and drawables caches. + // + + XidCache gcCache; + FreeCache freeGCCache; + + XidCache drawableCache; + FreeCache freeDrawableCache; + + XidCache windowCache; + FreeCache freeWindowCache; + + // + // General-purpose caches. + // + + IntCache cursorCache; + IntCache colormapCache; + IntCache visualCache; + CharCache depthCache; + CharCache resourceCache; + CharCache methodCache; + + unsigned int lastFont; + + // + // AllocColor request. + // + + IntCache *allocColorRGBCache[3]; + + // + // ChangeProperty request. + // + + CharCache changePropertyFormatCache; + IntCache changePropertyPropertyCache; + IntCache changePropertyTypeCache; + IntCache changePropertyData32Cache; + + // + // ClearArea request. + // + + IntCache *clearAreaGeomCache[4]; + + // + // ConfigureWindow request. + // + + IntCache configureWindowBitmaskCache; + IntCache *configureWindowAttrCache[7]; + + // + // ConvertSelection request. + // + + IntCache convertSelectionRequestorCache; + IntCache* convertSelectionAtomCache[3]; + unsigned int convertSelectionLastTimestamp; + + // + // CopyArea request. + // + + IntCache *copyAreaGeomCache[6]; + + // + // CopyPlane request. + // + + IntCache *copyPlaneGeomCache[6]; + IntCache copyPlaneBitPlaneCache; + + // + // CreateGC request. + // + + IntCache createGCBitmaskCache; + IntCache *createGCAttrCache[23]; + + // + // CreatePixmap request. + // + + IntCache createPixmapIdCache; + unsigned int createPixmapLastId; + IntCache createPixmapXCache; + IntCache createPixmapYCache; + + // + // CreateWindow request. + // + + IntCache *createWindowGeomCache[6]; + IntCache createWindowBitmaskCache; + IntCache *createWindowAttrCache[15]; + + // + // FillPoly request. + // + + IntCache fillPolyNumPointsCache; + IntCache *fillPolyXRelCache[10]; + IntCache *fillPolyXAbsCache[10]; + IntCache *fillPolyYRelCache[10]; + IntCache *fillPolyYAbsCache[10]; + unsigned int fillPolyRecentX[8]; + unsigned int fillPolyRecentY[8]; + unsigned int fillPolyIndex; + + // + // GetSelectionOwner request. + // + + IntCache getSelectionOwnerSelectionCache; + + // + // GrabButton request (also used for GrabPointer). + // + + IntCache grabButtonEventMaskCache; + IntCache grabButtonConfineCache; + CharCache grabButtonButtonCache; + IntCache grabButtonModifierCache; + + // + // GrabKeyboard request. + // + + unsigned int grabKeyboardLastTimestamp; + + // + // ImageText8/16 request. + // + + IntCache imageTextLengthCache; + unsigned int imageTextLastX; + unsigned int imageTextLastY; + IntCache imageTextCacheX; + IntCache imageTextCacheY; + + // + // PolyFillRectangle request. + // + + IntCache *polyFillRectangleCacheX[4]; + IntCache *polyFillRectangleCacheY[4]; + IntCache *polyFillRectangleCacheWidth[4]; + IntCache *polyFillRectangleCacheHeight[4]; + + // + // PolyLine request. + // + + IntCache *polyLineCacheX[2]; + IntCache *polyLineCacheY[2]; + + // + // PolyPoint request. + // + + IntCache *polyPointCacheX[2]; + IntCache *polyPointCacheY[2]; + + // + // PolyRectangle request. + // + + IntCache *polyRectangleGeomCache[4]; + + // + // PolySegment request. + // + + IntCache polySegmentCacheX; + IntCache polySegmentCacheY; + unsigned int polySegmentLastX[2]; + unsigned int polySegmentLastY[2]; + unsigned int polySegmentCacheIndex; + + // + // PolyText8/16 request. + // + + unsigned int polyTextLastX; + unsigned int polyTextLastY; + IntCache polyTextCacheX; + IntCache polyTextCacheY; + IntCache polyTextFontCache; + CharCache polyTextDeltaCache; + + // + // PutImage request. + // + + IntCache putImageWidthCache; + IntCache putImageHeightCache; + unsigned int putImageLastX; + unsigned int putImageLastY; + IntCache putImageXCache; + IntCache putImageYCache; + CharCache putImageLeftPadCache; + + // + // GetImage request. + // + + IntCache getImagePlaneMaskCache; + + // + // QueryColors request. + // + + unsigned int queryColorsLastPixel; + + // + // SetClipRectangles request. + // + + IntCache setClipRectanglesXCache; + IntCache setClipRectanglesYCache; + IntCache *setClipRectanglesGeomCache[4]; + + // + // SetDashes request. + // + + IntCache setDashesLengthCache; + IntCache setDashesOffsetCache; + CharCache setDashesDashCache_[2]; + + // + // SetSelectionOwner request. + // + + IntCache setSelectionOwnerCache; + IntCache setSelectionOwnerTimestampCache; + + // + // TranslateCoords request. + // + + IntCache translateCoordsSrcCache; + IntCache translateCoordsDstCache; + IntCache translateCoordsXCache; + IntCache translateCoordsYCache; + + // + // SendEvent request. + // + + IntCache sendEventMaskCache; + CharCache sendEventCodeCache; + CharCache sendEventByteDataCache; + unsigned int sendEventLastSequence; + IntCache sendEventIntDataCache; + CharCache sendEventEventCache; + + // + // PolyFillArc request. + // + + IntCache *polyFillArcCacheX[2]; + IntCache *polyFillArcCacheY[2]; + IntCache *polyFillArcCacheWidth[2]; + IntCache *polyFillArcCacheHeight[2]; + IntCache *polyFillArcCacheAngle1[2]; + IntCache *polyFillArcCacheAngle2[2]; + + // + // PolyArc request. + // + + IntCache *polyArcCacheX[2]; + IntCache *polyArcCacheY[2]; + IntCache *polyArcCacheWidth[2]; + IntCache *polyArcCacheHeight[2]; + IntCache *polyArcCacheAngle1[2]; + IntCache *polyArcCacheAngle2[2]; + + // + // PutPackedImage request. + // + + IntCache putPackedImageSrcLengthCache; + IntCache putPackedImageDstLengthCache; + + // + // Shape extension requests. + // + + CharCache shapeOpcodeCache; + IntCache *shapeDataCache[8]; + + // + // Generic requests. + // + + CharCache genericRequestOpcodeCache; + IntCache *genericRequestDataCache[8]; + + // + // Render extension requests. + // + + OpcodeCache renderOpcodeCache; + + CharCache renderOpCache; + + XidCache renderSrcPictureCache; + XidCache renderMaskPictureCache; + XidCache renderDstPictureCache; + FreeCache renderFreePictureCache; + + IntCache renderGlyphSetCache; + FreeCache renderFreeGlyphSetCache; + + IntCache renderIdCache; + IntCache renderLengthCache; + IntCache renderFormatCache; + IntCache renderValueMaskCache; + IntCache renderNumGlyphsCache; + + IntCache renderXCache; + IntCache renderYCache; + + unsigned int renderLastX; + unsigned int renderLastY; + + IntCache renderWidthCache; + IntCache renderHeightCache; + + unsigned int renderLastId; + + IntCache *renderDataCache[16]; + + IntCache renderGlyphXCache; + IntCache renderGlyphYCache; + + unsigned int renderGlyphX; + unsigned int renderGlyphY; + + IntCache *renderCompositeGlyphsDataCache[16]; + unsigned int renderLastCompositeGlyphsData; + + IntCache *renderCompositeDataCache[3]; + + // + // SetCacheParameters request. + // + + IntCache setCacheParametersCache; + + // + // Encode new XID values based + // on the last value encoded. + // + + IntCache lastIdCache; + unsigned int lastId; +}; + +#endif /* ClientCache_H */ diff --git a/nxcomp/src/ClientChannel.cpp b/nxcomp/src/ClientChannel.cpp new file mode 100644 index 000000000..2a182e49f --- /dev/null +++ b/nxcomp/src/ClientChannel.cpp @@ -0,0 +1,7881 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include +#include + +#include "NXproto.h" +#include "NXrender.h" + +#include "ClientChannel.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "StaticCompressor.h" + +#include "Statistics.h" +#include "Proxy.h" + +#include "PutImage.h" +#include "PutPackedImage.h" + +extern Proxy *proxy; + +// +// Set the verbosity level. You also +// need to define OPCODES in Misc.cpp +// if you want literals instead of +// opcodes' numbers. +// + +#define PANIC +#define WARNING +#undef OPCODES +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Log the important tracepoints related +// to writing packets to the peer proxy. +// + +#undef FLUSH + +// +// Log the operations related to splits. +// + +#undef SPLIT + +// +// Define this to trace the invocations +// of the agent's callbacks. +// + +#undef CALLBACK + +// +// By defining this, a simple procedure is activated at +// startup which just allocates and deallocates plenty +// of cache objects. This is used to help determine the +// current memory requirements. +// + +#undef MEMORY + +// +// Inspects target of common X operations. +// + +#undef TARGETS + +#ifdef TARGETS + +#include +#include + +typedef set < unsigned int, less > T_windows; +typedef set < unsigned int, less > T_pixmaps; +typedef map < unsigned int, unsigned int, less > T_gcontexts; + +T_windows windows; +T_pixmaps pixmaps; +T_gcontexts gcontexts; + +#endif + +// +// Define this to log when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// Here are the static members. +// + +#ifdef REFERENCES + +int ClientChannel::references_ = 0; + +#endif + +ClientChannel::ClientChannel(Transport *transport, StaticCompressor *compressor) + + : Channel(transport, compressor), readBuffer_(transport_, this) +{ + // + // Sequence number of the next message + // being encoded or decoded. + // + + clientSequence_ = 0; + serverSequence_ = 0; + + // + // Current sequence known by NX agent. + // + + lastSequence_ = 0; + + // + // This is used to test the synchronous + // flush in the proxy. + // + + lastRequest_ = 0; + + // + // Store information about the images + // being streamed. + // + + splitState_.resource = nothing; + splitState_.pending = 0; + splitState_.commit = 0; + splitState_.mode = split_none; + + // + // Number of outstanding tainted replies. + // + + taintCounter_ = 0; + + #ifdef MEMORY + + *logofs << "ClientChannel: Created 1 ClientCache and 1 ServerCache. " + << "You have 30 seconds to check the allocated size.\n" + << logofs_flush; + + sleep(30); + + ClientCache *clientCacheTestArray[100]; + ServerCache *serverCacheTestArray[100]; + + for (int i = 0; i < 100; i++) + { + clientCacheTestArray[i] = new ClientCache(); + } + + *logofs << "ClientChannel: Created further 100 ClientCache. " + << "You have 30 seconds to check the allocated size.\n" + << logofs_flush; + + sleep(30); + + for (int i = 0; i < 100; i++) + { + serverCacheTestArray[i] = new ServerCache(); + } + + *logofs << "ClientChannel: Created further 100 ServerCache. " + << "You have 30 seconds to check the allocated size.\n" + << logofs_flush; + + sleep(30); + + for (int i = 0; i < 100; i++) + { + delete clientCacheTestArray[i]; + delete serverCacheTestArray[i]; + } + + *logofs << "ClientChannel: Deleted 100 ClientCache and 100 ServerCache. " + << "You have 30 seconds to check the allocated size.\n" + << logofs_flush; + + sleep(30); + + #endif + + #ifdef REFERENCES + *logofs << "ClientChannel: Created new object at " + << this << " for FD#" << fd_ << " out of " + << ++references_ << " allocated channels.\n" + << logofs_flush; + #endif +} + +ClientChannel::~ClientChannel() +{ + #ifdef REFERENCES + *logofs << "ClientChannel: Deleted object at " + << this << " for FD#" << fd_ << " out of " + << --references_ << " allocated channels.\n" + << logofs_flush; + #endif +} + +// +// Beginning of handleRead(). +// + +int ClientChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length) +{ + #ifdef TEST + *logofs << "handleRead: Called for FD#" << fd_ + << " with " << encodeBuffer.getLength() + << " bytes already encoded.\n" + << logofs_flush; + #endif + + // + // Pointer to located message and + // its size in bytes. + // + + const unsigned char *inputMessage; + unsigned int inputLength; + + // + // Set when message is found in + // cache. + // + + int hit; + + // + // Check if we can borrow the buffer + // from the caller. + // + + if (message != NULL && length != 0) + { + readBuffer_.readMessage(message, length); + } + else + { + // + // Get the data from the transport. + // + + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: Trying to read from FD#" + << fd_ << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + int result = readBuffer_.readMessage(); + + #ifdef DEBUG + *logofs << "handleRead: Read result on FD#" << fd_ + << " is " << result << ".\n" + << logofs_flush; + #endif + + if (result < 0) + { + // + // Let the proxy close the channel. + // + + return -1; + } + else if (result == 0) + { + #if defined(TEST) || defined(INFO) + + *logofs << "handleRead: PANIC! No data read from FD#" + << fd_ << " while encoding messages.\n" + << logofs_flush; + + HandleCleanup(); + + #endif + + return 0; + } + } + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "handleRead: Encoding messages for FD#" << fd_ + << " with " << readBuffer_.getLength() << " bytes " + << "in the buffer.\n" << logofs_flush; + #endif + + // + // Extract any complete message which + // is available in the buffer. + // + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) + { + hit = 0; + + if (firstRequest_) + { + // + // Need to add the length of the first + // request as it was not present in + // previous versions. + // + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeValue(inputLength, 8); + + for (unsigned int i = 0; i < inputLength; i++) + { + encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8); + } + + firstRequest_ = 0; + + #if defined(TEST) || defined(OPCODES) + + int bits = encodeBuffer.diffBits(); + + *logofs << "handleRead: Handled first request. " << inputLength + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + #endif + + priority_++; + } + else + { + // + // First of all we get the opcode. + // + + unsigned char inputOpcode = *inputMessage; + + #if defined(TEST) || defined(INFO) + + // + // This is used to test the synchronous + // flush in the parent proxy. + // + + lastRequest_ = inputOpcode; + + #endif + + // + // Check if the request is supported by the + // remote. If not, only handle it locally and + // taint the opcode as a X_NoOperation. Also + // try to short-circuit some replies at this + // side. XSync requests, for example, weight + // for half of the total round-trips. + // + + if (handleTaintRequest(inputOpcode, inputMessage, + inputLength) < 0) + { + return -1; + } + + encodeBuffer.encodeOpcodeValue(inputOpcode, clientCache_ -> opcodeCache); + + // + // Update the current sequence. + // + + clientSequence_++; + clientSequence_ &= 0xffff; + + #ifdef DEBUG + *logofs << "handleRead: Last client sequence number for FD#" + << fd_ << " is " << clientSequence_ << ".\n" + << logofs_flush; + #endif + + // + // If differential compression is disabled + // then use the most simple encoding. + // + + if (control -> LocalDeltaCompression == 0) + { + int result = handleFastReadRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + // + // Go to the message's specific encoding. + // + + switch (inputOpcode) + { + case X_AllocColor: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> colormapCache); + const unsigned char *nextSrc = inputMessage + 8; + unsigned int colorData[3]; + for (unsigned int i = 0; i < 3; i++) + { + unsigned int value = GetUINT(nextSrc, bigEndian_); + encodeBuffer.encodeCachedValue(value, 16, + *(clientCache_ -> allocColorRGBCache[i]), 4); + colorData[i] = value; + nextSrc += 2; + } + + sequenceQueue_.push(clientSequence_, inputOpcode, + colorData[0], colorData[1], colorData[2]); + + priority_++; + } + break; + case X_ReparentWindow: + { + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), + clientCache_ -> windowCache); + encodeBuffer.encodeValue(GetUINT(inputMessage + 12, bigEndian_), 16, 11); + encodeBuffer.encodeValue(GetUINT(inputMessage + 14, bigEndian_), 16, 11); + } + break; + case X_ChangeProperty: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ChangeProperty); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + unsigned char format = inputMessage[16]; + encodeBuffer.encodeCachedValue(format, 8, + clientCache_ -> changePropertyFormatCache); + unsigned int dataLength = GetULONG(inputMessage + 20, bigEndian_); + encodeBuffer.encodeValue(dataLength, 32, 6); + encodeBuffer.encodeValue(inputMessage[1], 2); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, + clientCache_ -> changePropertyPropertyCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, + clientCache_ -> changePropertyTypeCache, 9); + const unsigned char *nextSrc = inputMessage + 24; + if (format == 8) + { + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, dataLength); + } + else if (format == 32) + { + for (unsigned int i = 0; i < dataLength; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, + clientCache_ -> changePropertyData32Cache); + nextSrc += 4; + } + } + else + { + for (unsigned int i = 0; i < dataLength; i++) + { + encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); + nextSrc += 2; + } + } + } + break; + case X_SendEvent: + { + // + // TODO: This can be improved. In the worst + // cases, it appears to provide a poor 1.6:1 + // ratio. + // + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_SendEvent); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + unsigned int window = GetULONG(inputMessage + 4, bigEndian_); + + if (window == 0 || window == 1) + { + encodeBuffer.encodeBoolValue(1); + encodeBuffer.encodeBoolValue(window); + } + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeXidValue(window, clientCache_ -> windowCache); + } + + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 32, + clientCache_ -> sendEventMaskCache, 9); + encodeBuffer.encodeCachedValue(*(inputMessage + 12), 8, + clientCache_ -> sendEventCodeCache); + encodeBuffer.encodeCachedValue(*(inputMessage + 13), 8, + clientCache_ -> sendEventByteDataCache); + + unsigned int newSeq = GetUINT(inputMessage + 14, bigEndian_); + unsigned int diffSeq = newSeq - clientCache_ -> sendEventLastSequence; + clientCache_ -> sendEventLastSequence = newSeq; + encodeBuffer.encodeValue(diffSeq, 16, 4); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, + clientCache_ -> sendEventIntDataCache); + + for (unsigned int i = 20; i < 44; i++) + { + encodeBuffer.encodeCachedValue((unsigned int) inputMessage[i], 8, + clientCache_ -> sendEventEventCache); + } + } + break; + case X_ChangeWindowAttributes: + { + encodeBuffer.encodeValue((inputLength - 12) >> 2, 4); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + unsigned int bitmask = GetULONG(inputMessage + 8, bigEndian_); + encodeBuffer.encodeCachedValue(bitmask, 15, + clientCache_ -> createWindowBitmaskCache); + const unsigned char *nextSrc = inputMessage + 12; + unsigned int mask = 0x1; + for (unsigned int j = 0; j < 15; j++) + { + if (bitmask & mask) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, + *clientCache_ -> createWindowAttrCache[j]); + nextSrc += 4; + } + mask <<= 1; + } + } + break; + case X_ClearArea: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_ClearArea target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_ClearArea target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_ClearArea target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ClearArea); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + const unsigned char *nextSrc = inputMessage + 8; + for (unsigned int i = 0; i < 4; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> clearAreaGeomCache[i], 8); + nextSrc += 2; + } + } + break; + case X_CloseFont: + { + unsigned int font = GetULONG(inputMessage + 4, bigEndian_); + encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); + clientCache_ -> lastFont = font; + } + break; + case X_ConfigureWindow: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ConfigureWindow); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + unsigned int bitmask = GetUINT(inputMessage + 8, bigEndian_); + encodeBuffer.encodeCachedValue(bitmask, 7, + clientCache_ -> configureWindowBitmaskCache); + unsigned int mask = 0x1; + const unsigned char *nextSrc = inputMessage + 12; + for (unsigned int i = 0; i < 7; i++) + { + if (bitmask & mask) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), + CONFIGUREWINDOW_FIELD_WIDTH[i], + *clientCache_ -> configureWindowAttrCache[i], 8); + nextSrc += 4; + } + mask <<= 1; + } + } + break; + case X_ConvertSelection: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> convertSelectionRequestorCache, 9); + const unsigned char* nextSrc = inputMessage + 8; + for (unsigned int i = 0; i < 3; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, + *(clientCache_ -> convertSelectionAtomCache[i]), 9); + nextSrc += 4; + } + unsigned int timestamp = GetULONG(nextSrc, bigEndian_); + encodeBuffer.encodeValue(timestamp - + clientCache_ -> convertSelectionLastTimestamp, 32, 4); + clientCache_ -> convertSelectionLastTimestamp = timestamp; + } + break; + case X_CopyArea: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_CopyArea source id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_CopyArea source id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_CopyArea source id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + t_id = GetULONG(inputMessage + 8, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_CopyArea target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_CopyArea target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_CopyArea target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_CopyArea); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 12, + bigEndian_), clientCache_ -> gcCache); + const unsigned char *nextSrc = inputMessage + 16; + for (unsigned int i = 0; i < 6; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> copyAreaGeomCache[i], 8); + nextSrc += 2; + } + } + break; + case X_CopyGC: + { + #ifdef TARGETS + + unsigned int s_g_id = GetULONG(inputMessage + 4, bigEndian_); + unsigned int d_g_id = GetULONG(inputMessage + 8, bigEndian_); + + *logofs << "handleRead: X_CopyGC source gcontext id is " << s_g_id + << " destination gcontext id is " << d_g_id << ".\n" + << logofs_flush; + + #endif + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> gcCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, + bigEndian_), 23, clientCache_ -> createGCBitmaskCache); + } + break; + case X_CopyPlane: + { + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 12, + bigEndian_), clientCache_ -> gcCache); + const unsigned char *nextSrc = inputMessage + 16; + for (unsigned int i = 0; i < 6; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> copyPlaneGeomCache[i], 8); + nextSrc += 2; + } + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 28, bigEndian_), 32, + clientCache_ -> copyPlaneBitPlaneCache, 10); + } + break; + case X_CreateGC: + { + #ifdef TARGETS + + unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); + unsigned int t_id = GetULONG(inputMessage + 8, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_CreateGC id " << g_id + << " target id is pixmap " << t_id + << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_CreateGC id " << g_id + << " target id is window " << t_id + << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_CreateGC id " << g_id + << " target id is unrecognized.\n" + << logofs_flush; + } + + gcontexts.insert(T_gcontexts::value_type(g_id, t_id)); + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_CreateGC); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> lastId, clientCache_ -> lastIdCache, + clientCache_ -> gcCache, + clientCache_ -> freeGCCache); + + const unsigned char *nextSrc = inputMessage + 8; + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> drawableCache); + nextSrc += 4; + unsigned int bitmask = GetULONG(nextSrc, bigEndian_); + nextSrc += 4; + encodeBuffer.encodeCachedValue(bitmask, 23, + clientCache_ -> createGCBitmaskCache); + unsigned int mask = 0x1; + for (unsigned int i = 0; i < 23; i++) + { + if (bitmask & mask) + { + unsigned int value = GetULONG(nextSrc, bigEndian_); + nextSrc += 4; + unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; + if (fieldWidth <= 4) + { + encodeBuffer.encodeValue(value, fieldWidth); + } + else + { + encodeBuffer.encodeCachedValue(value, fieldWidth, + *clientCache_ -> createGCAttrCache[i]); + } + } + mask <<= 1; + } + } + break; + case X_ChangeGC: + { + #ifdef TARGETS + + unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); + + T_gcontexts::iterator i = gcontexts.find(g_id); + + if (i != gcontexts.end()) + { + unsigned int t_id = i -> second; + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_ChangeGC gcontext id is " << g_id + << " target id is pixmap " << t_id << ".\n" + << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_ChangeGC gcontext id is " << g_id + << " target id is window " << t_id << ".\n" + << logofs_flush; + } + else + { + *logofs << "handleRead: X_ChangeGC gcontext is " << g_id + << " target id is unrecognized.\n" + << logofs_flush; + } + } + else + { + *logofs << "handleRead: X_ChangeGC gcontext id " << g_id + << " is unrecognized.\n" << logofs_flush; + } + + gcontexts.erase(g_id); + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ChangeGC); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> gcCache); + const unsigned char *nextSrc = inputMessage + 8; + unsigned int bitmask = GetULONG(nextSrc, bigEndian_); + nextSrc += 4; + encodeBuffer.encodeCachedValue(bitmask, 23, + clientCache_ -> createGCBitmaskCache); + unsigned int mask = 0x1; + for (unsigned int i = 0; i < 23; i++) + { + if (bitmask & mask) + { + unsigned int value = GetULONG(nextSrc, bigEndian_); + nextSrc += 4; + unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; + if (fieldWidth <= 4) + { + encodeBuffer.encodeValue(value, fieldWidth); + } + else + { + encodeBuffer.encodeCachedValue(value, fieldWidth, + *clientCache_ -> createGCAttrCache[i]); + } + } + mask <<= 1; + } + } + break; + case X_CreatePixmap: + { + #ifdef TARGETS + + *logofs << "handleRead: X_CreatePixmap depth " << (unsigned) inputMessage[1] + << ", pixmap id " << GetULONG(inputMessage + 4, bigEndian_) + << ", drawable " << GetULONG(inputMessage + 8, bigEndian_) + << ", width " << GetUINT(inputMessage + 12, bigEndian_) + << ", height " << GetUINT(inputMessage + 14, bigEndian_) + << ", size " << GetUINT(inputMessage + 2, bigEndian_) << 2 + << ".\n" << logofs_flush; + + unsigned int p_id = GetULONG(inputMessage + 4, bigEndian_); + unsigned short p_sx = GetUINT(inputMessage + 12, bigEndian_); + unsigned short p_sy = GetUINT(inputMessage + 14, bigEndian_); + + *logofs << "handleRead: X_CreatePixmap id is " << p_id + << " width is " << p_sx << " height is " << p_sy + << ".\n" << logofs_flush; + + if (p_sx * p_sy <= 64 * 64) + { + *logofs << "handleRead: X_CreatePixmap id " << p_id << " of size " + << p_sx << "x" << p_sy << "=" << p_sx * p_sy + << " will be painted at client side.\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_CreatePixmap id " << p_id << " of size " + << p_sx << "x" << p_sy << "=" << p_sx * p_sy + << " will be painted at server side.\n" << logofs_flush; + } + + pixmaps.insert(p_id); + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_CreatePixmap); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + break; + case X_CreateWindow: + { + #ifdef TARGETS + + unsigned int w_id = GetULONG(inputMessage + 4, bigEndian_); + + *logofs << "handleRead: X_CreateWindow id is " << w_id + << ".\n" << logofs_flush; + + windows.insert(w_id); + + #endif + + unsigned bitmask = GetULONG(inputMessage + 28, bigEndian_); + encodeBuffer.encodeCachedValue((unsigned int) inputMessage[1], 8, + clientCache_ -> depthCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), + clientCache_ -> windowCache); + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeNewXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> lastId, clientCache_ -> lastIdCache, + clientCache_ -> windowCache, + clientCache_ -> freeWindowCache); + + const unsigned char *nextSrc = inputMessage + 12; + for (unsigned int i = 0; i < 6; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> createWindowGeomCache[i], 8); + nextSrc += 2; + } + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 24, + bigEndian_), 29, clientCache_ -> visualCache); + encodeBuffer.encodeCachedValue(bitmask, 15, + clientCache_ -> createWindowBitmaskCache); + nextSrc = inputMessage + 32; + unsigned int mask = 0x1; + for (unsigned int j = 0; j < 15; j++) + { + if (bitmask & mask) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 32, + *clientCache_ -> createWindowAttrCache[j]); + nextSrc += 4; + } + mask <<= 1; + } + } + break; + case X_DeleteProperty: + { + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 29, 9); + } + break; + case X_FillPoly: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_FillPoly target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_FillPoly target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_FillPoly target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_FillPoly); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + unsigned int numPoints = ((inputLength - 16) >> 2); + + // Since ProtoStep10 (#issue 108) + encodeBuffer.encodeCachedValue(numPoints, 16, + clientCache_ -> fillPolyNumPointsCache, 4); + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), + clientCache_ -> gcCache); + encodeBuffer.encodeValue((unsigned int) inputMessage[12], 2); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); + int relativeCoordMode = (inputMessage[13] != 0); + const unsigned char *nextSrc = inputMessage + 16; + unsigned int pointIndex = 0; + + for (unsigned int i = 0; i < numPoints; i++) + { + if (relativeCoordMode) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> fillPolyXRelCache[pointIndex], 8); + nextSrc += 2; + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> fillPolyYRelCache[pointIndex], 8); + nextSrc += 2; + } + else + { + unsigned int x = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + unsigned int y = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + unsigned int j; + for (j = 0; j < 8; j++) + if ((x == clientCache_ -> fillPolyRecentX[j]) && + (y == clientCache_ -> fillPolyRecentY[j])) + break; + if (j < 8) + { + encodeBuffer.encodeBoolValue(1); + encodeBuffer.encodeValue(j, 3); + } + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeCachedValue(x, 16, + *clientCache_ -> fillPolyXAbsCache[pointIndex], 8); + encodeBuffer.encodeCachedValue(y, 16, + *clientCache_ -> fillPolyYAbsCache[pointIndex], 8); + clientCache_ -> fillPolyRecentX[clientCache_ -> fillPolyIndex] = x; + clientCache_ -> fillPolyRecentY[clientCache_ -> fillPolyIndex] = y; + clientCache_ -> fillPolyIndex++; + if (clientCache_ -> fillPolyIndex == 8) + clientCache_ -> fillPolyIndex = 0; + } + } + + if (++pointIndex == 10) pointIndex = 0; + } + } + break; + case X_FreeColors: + { + unsigned int numPixels = GetUINT(inputMessage + 2, bigEndian_) - 3; + encodeBuffer.encodeValue(numPixels, 16, 4); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> colormapCache); + encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 32, 4); + const unsigned char *nextSrc = inputMessage + 12; + while (numPixels) + { + encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 8); + nextSrc += 4; + numPixels--; + } + } + break; + case X_FreeCursor: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, clientCache_ -> cursorCache, 9); + } + break; + case X_FreeGC: + { + #ifdef TARGETS + + unsigned int g_id = GetULONG(inputMessage + 4, bigEndian_); + + T_gcontexts::iterator i = gcontexts.find(g_id); + + if (i != gcontexts.end()) + { + unsigned int t_id = i -> second; + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_FreeGC gcontext id is " << g_id + << " target id is pixmap " << t_id << ".\n" + << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_FreeGC gcontext id is " << g_id + << " target id is window " << t_id << ".\n" + << logofs_flush; + } + else + { + *logofs << "handleRead: X_FreeGC gcontext id is " << g_id + << " target id is unrecognized.\n" + << logofs_flush; + } + } + else + { + *logofs << "handleRead: X_FreeGC gcontext id " << g_id + << " is unrecognized.\n" << logofs_flush; + } + + gcontexts.erase(g_id); + + #endif + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> freeGCCache); + } + break; + case X_FreePixmap: + { + #ifdef TARGETS + + unsigned int p_id = GetULONG(inputMessage + 4, bigEndian_); + + *logofs << "handleRead: X_FreePixmap id is " << p_id << ".\n" << logofs_flush; + + pixmaps.erase(p_id); + + #endif + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> freeDrawableCache); + } + break; + case X_GetAtomName: + { + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 29, 9); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetGeometry: + { + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> drawableCache); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetInputFocus: + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetModifierMapping: + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetKeyboardMapping: + { + encodeBuffer.encodeValue((unsigned int) inputMessage[4], 8); + encodeBuffer.encodeValue((unsigned int) inputMessage[5], 8); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetProperty: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_GetProperty); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + unsigned int property = GetULONG(inputMessage + 8, bigEndian_); + + sequenceQueue_.push(clientSequence_, inputOpcode, property); + + priority_++; + + hit = 1; + + break; + } + + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + unsigned int property = GetULONG(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(property, 29, 9); + encodeBuffer.encodeValue(GetULONG(inputMessage + 12, bigEndian_), 29, 9); + encodeBuffer.encodeValue(GetULONG(inputMessage + 16, bigEndian_), 32, 2); + encodeBuffer.encodeValue(GetULONG(inputMessage + 20, bigEndian_), 32, 8); + + sequenceQueue_.push(clientSequence_, inputOpcode, property); + + priority_++; + } + break; + case X_GetSelectionOwner: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> getSelectionOwnerSelectionCache, 9); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GrabButton: + { + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, + clientCache_ -> grabButtonEventMaskCache); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[10]); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[11]); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, + clientCache_ -> grabButtonConfineCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 29, + clientCache_ -> cursorCache, 9); + encodeBuffer.encodeCachedValue(inputMessage[20], 8, + clientCache_ -> grabButtonButtonCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 22, bigEndian_), 16, + clientCache_ -> grabButtonModifierCache); + } + break; + case X_GrabPointer: + { + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, + clientCache_ -> grabButtonEventMaskCache); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[10]); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[11]); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, + bigEndian_), 29, + clientCache_ -> grabButtonConfineCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, + bigEndian_), 29, clientCache_ -> cursorCache, 9); + + unsigned int timestamp = GetULONG(inputMessage + 20, bigEndian_); + encodeBuffer.encodeValue(timestamp - + clientCache_ -> grabKeyboardLastTimestamp, 32, 4); + clientCache_ -> grabKeyboardLastTimestamp = timestamp; + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GrabKeyboard: + { + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + unsigned int timestamp = GetULONG(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(timestamp - + clientCache_ -> grabKeyboardLastTimestamp, 32, 4); + clientCache_ -> grabKeyboardLastTimestamp = timestamp; + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GrabServer: + case X_UngrabServer: + case X_NoOperation: + { + } + break; + case X_PolyText8: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyText8 target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyText8 target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyText8 target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyText8); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + unsigned int x = GetUINT(inputMessage + 12, bigEndian_); + int xDiff = x - clientCache_ -> polyTextLastX; + clientCache_ -> polyTextLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache_ -> polyTextCacheX); + unsigned int y = GetUINT(inputMessage + 14, bigEndian_); + int yDiff = y - clientCache_ -> polyTextLastY; + clientCache_ -> polyTextLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache_ -> polyTextCacheY); + const unsigned char *end = inputMessage + inputLength - 1; + const unsigned char *nextSrc = inputMessage + 16; + while (nextSrc < end) + { + unsigned int textLength = (unsigned int) *nextSrc++; + encodeBuffer.encodeBoolValue(1); + encodeBuffer.encodeValue(textLength, 8); + if (textLength == 255) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, 1), 29, + clientCache_ -> polyTextFontCache); + nextSrc += 4; + } + else + { + encodeBuffer.encodeCachedValue(*nextSrc++, 8, + clientCache_ -> polyTextDeltaCache); + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, textLength); + nextSrc += textLength; + } + } + encodeBuffer.encodeBoolValue(0); + } + break; + case X_PolyText16: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyText16 target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyText16 target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyText16 target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyText16); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + unsigned int x = GetUINT(inputMessage + 12, bigEndian_); + int xDiff = x - clientCache_ -> polyTextLastX; + clientCache_ -> polyTextLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache_ -> polyTextCacheX); + unsigned int y = GetUINT(inputMessage + 14, bigEndian_); + int yDiff = y - clientCache_ -> polyTextLastY; + clientCache_ -> polyTextLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache_ -> polyTextCacheY); + const unsigned char *end = inputMessage + inputLength - 1; + const unsigned char *nextSrc = inputMessage + 16; + while (nextSrc < end) + { + unsigned int textLength = (unsigned int) *nextSrc++; + encodeBuffer.encodeBoolValue(1); + encodeBuffer.encodeValue(textLength, 8); + if (textLength == 255) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, 1), 29, + clientCache_ -> polyTextFontCache); + nextSrc += 4; + } + else + { + encodeBuffer.encodeCachedValue(*nextSrc++, 8, + clientCache_ -> polyTextDeltaCache); + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, textLength * 2); + nextSrc += textLength * 2; + } + } + encodeBuffer.encodeBoolValue(0); + } + break; + case X_ImageText8: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_ImageText8 target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_ImageText8 target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_ImageText8 target id " + << t_id << " is unrecognized.\n" + << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ImageText8); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + unsigned int textLength = (unsigned int) inputMessage[1]; + encodeBuffer.encodeCachedValue(textLength, 8, + clientCache_ -> imageTextLengthCache, 4); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + unsigned int x = GetUINT(inputMessage + 12, bigEndian_); + int xDiff = x - clientCache_ -> imageTextLastX; + clientCache_ -> imageTextLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache_ -> imageTextCacheX); + unsigned int y = GetUINT(inputMessage + 14, bigEndian_); + int yDiff = y - clientCache_ -> imageTextLastY; + clientCache_ -> imageTextLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache_ -> imageTextCacheY); + const unsigned char *nextSrc = inputMessage + 16; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, textLength); + } + break; + case X_ImageText16: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_ImageText16 target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_ImageText16 target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_ImageText16 target id " + << t_id << " is unrecognized.\n" + << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ImageText16); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + unsigned int textLength = (unsigned int) inputMessage[1]; + encodeBuffer.encodeCachedValue(textLength, 8, + clientCache_ -> imageTextLengthCache, 4); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + unsigned int x = GetUINT(inputMessage + 12, bigEndian_); + int xDiff = x - clientCache_ -> imageTextLastX; + clientCache_ -> imageTextLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache_ -> imageTextCacheX); + unsigned int y = GetUINT(inputMessage + 14, bigEndian_); + int yDiff = y - clientCache_ -> imageTextLastY; + clientCache_ -> imageTextLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache_ -> imageTextCacheY); + const unsigned char *nextSrc = inputMessage + 16; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, textLength * 2); + } + break; + case X_InternAtom: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_InternAtom); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + // + // Set the priority, also if doing so will + // penalize all the well written clients + // using XInternAtoms() to pipeline multi- + // ple replies. + // + + priority_++; + + hit = 1; + + break; + } + + unsigned int nameLength = GetUINT(inputMessage + 4, bigEndian_); + encodeBuffer.encodeValue(nameLength, 16, 6); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + const unsigned char *nextSrc = inputMessage + 8; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, nameLength); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_ListExtensions: + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_ListFonts: + { + unsigned int textLength = GetUINT(inputMessage + 6, bigEndian_); + encodeBuffer.encodeValue(textLength, 16, 6); + encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16, 6); + const unsigned char* nextSrc = inputMessage + 8; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, textLength); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_LookupColor: + case X_AllocNamedColor: + { + unsigned int textLength = GetUINT(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(textLength, 16, 6); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, clientCache_ -> colormapCache); + const unsigned char *nextSrc = inputMessage + 12; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, textLength); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_MapWindow: + case X_UnmapWindow: + case X_MapSubwindows: + case X_GetWindowAttributes: + case X_DestroyWindow: + case X_DestroySubwindows: + case X_QueryPointer: + case X_QueryTree: + { + #ifdef TARGETS + + if (inputOpcode == X_DestroyWindow) + { + unsigned int w_id = GetULONG(inputMessage + 4, bigEndian_); + + *logofs << "handleRead: X_DestroyWindow id is " + << w_id << ".\n" << logofs_flush; + + windows.erase(w_id); + } + + #endif + + if (inputOpcode == X_DestroyWindow) + { + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeFreeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> freeWindowCache); + } + else + { + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> windowCache); + } + + if ((inputOpcode == X_QueryPointer) || + (inputOpcode == X_GetWindowAttributes) || + (inputOpcode == X_QueryTree)) + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + } + break; + case X_OpenFont: + { + unsigned int nameLength = GetUINT(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(nameLength, 16, 7); + unsigned int font = GetULONG(inputMessage + 4, bigEndian_); + encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); + clientCache_ -> lastFont = font; + const unsigned char *nextSrc = inputMessage + 12; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, nameLength); + } + break; + case X_PolyFillRectangle: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyFillRectangle target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyFillRectangle target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyFillRectangle target id " + << t_id << " is unrecognized.\n" + << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyFillRectangle); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + unsigned int lastWidth = 0, lastHeight = 0; + + // + // TODO: Could send the size at the beginning + // instead of a bool at each iteration. + // + + for (unsigned int i = 12; i < inputLength;) + { + unsigned int x = GetUINT(inputMessage + i, bigEndian_); + unsigned int newX = x; + x -= lastX; + lastX = newX; + encodeBuffer.encodeCachedValue(x, 16, + *clientCache_ -> polyFillRectangleCacheX[index], 8); + i += 2; + unsigned int y = GetUINT(inputMessage + i, bigEndian_); + unsigned int newY = y; + y -= lastY; + lastY = newY; + encodeBuffer.encodeCachedValue(y, 16, + *clientCache_ -> polyFillRectangleCacheY[index], 8); + i += 2; + unsigned int width = GetUINT(inputMessage + i, bigEndian_); + unsigned int newWidth = width; + width -= lastWidth; + lastWidth = newWidth; + encodeBuffer.encodeCachedValue(width, 16, + *clientCache_ -> polyFillRectangleCacheWidth[index], 8); + i += 2; + unsigned int height = GetUINT(inputMessage + i, bigEndian_); + unsigned int newHeight = height; + height -= lastHeight; + lastHeight = newHeight; + encodeBuffer.encodeCachedValue(height, 16, + *clientCache_ -> polyFillRectangleCacheHeight[index], 8); + i += 2; + + if (++index == 4) index = 0; + + encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); + } + } + break; + case X_PolyFillArc: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyFillArc target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyFillArc target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyFillArc target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyFillArc); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + unsigned int lastWidth = 0, lastHeight = 0; + unsigned int lastAngle1 = 0, lastAngle2 = 0; + + // + // TODO: Could send the size at the beginning + // instead of a bool at each iteration. + // + + for (unsigned int i = 12; i < inputLength;) + { + unsigned int x = GetUINT(inputMessage + i, bigEndian_); + unsigned int newX = x; + x -= lastX; + lastX = newX; + encodeBuffer.encodeCachedValue(x, 16, + *clientCache_ -> polyFillArcCacheX[index], 8); + i += 2; + unsigned int y = GetUINT(inputMessage + i, bigEndian_); + unsigned int newY = y; + y -= lastY; + lastY = newY; + encodeBuffer.encodeCachedValue(y, 16, + *clientCache_ -> polyFillArcCacheY[index], 8); + i += 2; + unsigned int width = GetUINT(inputMessage + i, bigEndian_); + unsigned int newWidth = width; + width -= lastWidth; + lastWidth = newWidth; + encodeBuffer.encodeCachedValue(width, 16, + *clientCache_ -> polyFillArcCacheWidth[index], 8); + i += 2; + unsigned int height = GetUINT(inputMessage + i, bigEndian_); + unsigned int newHeight = height; + height -= lastHeight; + lastHeight = newHeight; + encodeBuffer.encodeCachedValue(height, 16, + *clientCache_ -> polyFillArcCacheHeight[index], 8); + i += 2; + unsigned int angle1 = GetUINT(inputMessage + i, bigEndian_); + unsigned int newAngle1 = angle1; + angle1 -= lastAngle1; + lastAngle1 = newAngle1; + encodeBuffer.encodeCachedValue(angle1, 16, + *clientCache_ -> polyFillArcCacheAngle1[index], 8); + i += 2; + unsigned int angle2 = GetUINT(inputMessage + i, bigEndian_); + unsigned int newAngle2 = angle2; + angle2 -= lastAngle2; + lastAngle2 = newAngle2; + encodeBuffer.encodeCachedValue(angle2, 16, + *clientCache_ -> polyFillArcCacheAngle2[index], 8); + i += 2; + + if (++index == 2) index = 0; + + encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); + } + } + break; + case X_PolyArc: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyArc target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyArc target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyArc target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyArc); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + unsigned int lastWidth = 0, lastHeight = 0; + unsigned int lastAngle1 = 0, lastAngle2 = 0; + + // + // TODO: Could send the size at the beginning + // instead of a bool at each iteration. + // + + for (unsigned int i = 12; i < inputLength;) + { + unsigned int x = GetUINT(inputMessage + i, bigEndian_); + unsigned int newX = x; + x -= lastX; + lastX = newX; + encodeBuffer.encodeCachedValue(x, 16, + *clientCache_ -> polyArcCacheX[index], 8); + i += 2; + unsigned int y = GetUINT(inputMessage + i, bigEndian_); + unsigned int newY = y; + y -= lastY; + lastY = newY; + encodeBuffer.encodeCachedValue(y, 16, + *clientCache_ -> polyArcCacheY[index], 8); + i += 2; + unsigned int width = GetUINT(inputMessage + i, bigEndian_); + unsigned int newWidth = width; + width -= lastWidth; + lastWidth = newWidth; + encodeBuffer.encodeCachedValue(width, 16, + *clientCache_ -> polyArcCacheWidth[index], 8); + i += 2; + unsigned int height = GetUINT(inputMessage + i, bigEndian_); + unsigned int newHeight = height; + height -= lastHeight; + lastHeight = newHeight; + encodeBuffer.encodeCachedValue(height, 16, + *clientCache_ -> polyArcCacheHeight[index], 8); + i += 2; + unsigned int angle1 = GetUINT(inputMessage + i, bigEndian_); + unsigned int newAngle1 = angle1; + angle1 -= lastAngle1; + lastAngle1 = newAngle1; + encodeBuffer.encodeCachedValue(angle1, 16, + *clientCache_ -> polyArcCacheAngle1[index], 8); + i += 2; + unsigned int angle2 = GetUINT(inputMessage + i, bigEndian_); + unsigned int newAngle2 = angle2; + angle2 -= lastAngle2; + lastAngle2 = newAngle2; + encodeBuffer.encodeCachedValue(angle2, 16, + *clientCache_ -> polyArcCacheAngle2[index], 8); + i += 2; + + if (++index == 2) index = 0; + + encodeBuffer.encodeBoolValue((i < inputLength) ? 1 : 0); + } + } + break; + case X_PolyPoint: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyPoint target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyPoint target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyPoint target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyPoint); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_) - 3, 16, 4); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, bigEndian_), + clientCache_ -> gcCache); + const unsigned char *nextSrc = inputMessage + 12; + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + + for (unsigned int i = 12; i < inputLength; i += 4) + { + unsigned int x = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + unsigned int tmp = x; + x -= lastX; + lastX = tmp; + encodeBuffer.encodeCachedValue(x, 16, + *clientCache_ -> polyPointCacheX[index], 8); + unsigned int y = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + tmp = y; + y -= lastY; + lastY = tmp; + encodeBuffer.encodeCachedValue(y, 16, + *clientCache_ -> polyPointCacheY[index], 8); + + if (++index == 2) index = 0; + } + } + break; + case X_PolyLine: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolyLine target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolyLine target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolyLine target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyLine); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_) - 3, 16, 4); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + const unsigned char *nextSrc = inputMessage + 12; + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + + for (unsigned int i = 12; i < inputLength; i += 4) + { + unsigned int x = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + unsigned int tmp = x; + x -= lastX; + lastX = tmp; + encodeBuffer.encodeCachedValue(x, 16, + *clientCache_ -> polyLineCacheX[index], 8); + unsigned int y = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + tmp = y; + y -= lastY; + lastY = tmp; + encodeBuffer.encodeCachedValue(y, 16, + *clientCache_ -> polyLineCacheY[index], 8); + + if (++index == 2) index = 0; + } + } + break; + case X_PolyRectangle: + { + encodeBuffer.encodeValue((GetUINT(inputMessage + 2, + bigEndian_) - 3) >> 1, 16, 3); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + const unsigned char *end = inputMessage + inputLength; + const unsigned char *nextSrc = inputMessage + 12; + while (nextSrc < end) + { + for (unsigned int i = 0; i < 4; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> polyRectangleGeomCache[i], 8); + nextSrc += 2; + } + } + } + break; + case X_PolySegment: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PolySegment target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PolySegment target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PolySegment target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolySegment); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + encodeBuffer.encodeValue((GetUINT(inputMessage + 2, + bigEndian_) - 3) >> 1, 16, 4); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 8, + bigEndian_), clientCache_ -> gcCache); + const unsigned char *end = inputMessage + inputLength; + const unsigned char *nextSrc = inputMessage + 12; + // unsigned int index = 0; + // unsigned int lastX1, lastY1, lastX2, lastY2; + while (nextSrc < end) + { + unsigned int x = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + unsigned int xDiff0 = + x - clientCache_ -> polySegmentLastX[0]; + unsigned int xDiff1 = + x - clientCache_ -> polySegmentLastX[1]; + int xDiff0Abs = (int) xDiff0; + if (xDiff0Abs < 0) + xDiff0Abs = -xDiff0Abs; + int xDiff1Abs = (int) xDiff1; + if (xDiff1Abs < 0) + xDiff1Abs = -xDiff1Abs; + + unsigned int y = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + unsigned int yDiff0 = + y - clientCache_ -> polySegmentLastY[0]; + unsigned int yDiff1 = + y - clientCache_ -> polySegmentLastY[1]; + int yDiff0Abs = (int) yDiff0; + if (yDiff0Abs < 0) + yDiff0Abs = -yDiff0Abs; + int yDiff1Abs = (int) yDiff1; + if (yDiff1Abs < 0) + yDiff1Abs = -yDiff1Abs; + + int diff0 = xDiff0Abs + yDiff0Abs; + int diff1 = xDiff1Abs + yDiff1Abs; + if (diff0 < diff1) + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeCachedValue(xDiff0, 16, + clientCache_ -> polySegmentCacheX, 6); + encodeBuffer.encodeCachedValue(yDiff0, 16, + clientCache_ -> polySegmentCacheY, 6); + } + else + { + encodeBuffer.encodeBoolValue(1); + encodeBuffer.encodeCachedValue(xDiff1, 16, + clientCache_ -> polySegmentCacheX, 6); + encodeBuffer.encodeCachedValue(yDiff1, 16, + clientCache_ -> polySegmentCacheY, 6); + } + + clientCache_ -> polySegmentLastX[clientCache_ -> polySegmentCacheIndex] = x; + clientCache_ -> polySegmentLastY[clientCache_ -> polySegmentCacheIndex] = y; + + clientCache_ -> polySegmentCacheIndex = + clientCache_ -> polySegmentCacheIndex == 1 ? 0 : 1; + } + } + break; + case X_PutImage: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_PutImage target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_PutImage target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_PutImage target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PutImage); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + break; + case X_QueryBestSize: + { + encodeBuffer.encodeValue((unsigned int)inputMessage[1], 2); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + encodeBuffer.encodeValue(GetUINT(inputMessage + 8, bigEndian_), 16, 8); + encodeBuffer.encodeValue(GetUINT(inputMessage + 10, bigEndian_), 16, 8); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_QueryColors: + { + // Differential encoding. + encodeBuffer.encodeBoolValue(1); + + unsigned int numColors = ((inputLength - 8) >> 2); + encodeBuffer.encodeValue(numColors, 16, 5); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> colormapCache); + const unsigned char *nextSrc = inputMessage + 8; + unsigned int predictedPixel = clientCache_ -> queryColorsLastPixel; + for (unsigned int i = 0; i < numColors; i++) + { + unsigned int pixel = GetULONG(nextSrc, bigEndian_); + nextSrc += 4; + if (pixel == predictedPixel) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue(pixel, 32, 9); + } + if (i == 0) + clientCache_ -> queryColorsLastPixel = pixel; + predictedPixel = pixel + 1; + } + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_QueryExtension: + { + #ifdef TEST + + char data[256]; + + int length = GetUINT(inputMessage + 4, bigEndian_); + + if (length > 256) + { + length = 256; + } + + strncpy(data, (char *) inputMessage + 8, length); + + *(data + length) = '\0'; + + *logofs << "handleRead: Going to query extension '" + << data << "' for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + unsigned int nameLength = GetUINT(inputMessage + 4, bigEndian_); + encodeBuffer.encodeValue(nameLength, 16, 6); + const unsigned char *nextSrc = inputMessage + 8; + + for (; nameLength; nameLength--) + { + encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); + } + + unsigned int extension = 0; + + if (strncmp((char *) inputMessage + 8, "SHAPE", 5) == 0) + { + extension = X_NXInternalShapeExtension; + } + else if (strncmp((char *) inputMessage + 8, "RENDER", 6) == 0) + { + extension = X_NXInternalRenderExtension; + } + + sequenceQueue_.push(clientSequence_, inputOpcode, extension); + + priority_++; + } + break; + case X_QueryFont: + { + unsigned int font = GetULONG(inputMessage + 4, bigEndian_); + encodeBuffer.encodeValue(font - clientCache_ -> lastFont, 29, 5); + clientCache_ -> lastFont = font; + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_SetClipRectangles: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_SetClipRectangles); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + hit = 1; + + break; + } + + unsigned int numRectangles = ((inputLength - 12) >> 3); + + // Since ProtoStep9 (#issue 108) + encodeBuffer.encodeValue(numRectangles, 15, 4); + + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> gcCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, + clientCache_ -> setClipRectanglesXCache, 8); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 10, bigEndian_), 16, + clientCache_ -> setClipRectanglesYCache, 8); + const unsigned char *nextSrc = inputMessage + 12; + for (unsigned int i = 0; i < numRectangles; i++) + { + for (unsigned int j = 0; j < 4; j++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *clientCache_ -> setClipRectanglesGeomCache[j], 8); + nextSrc += 2; + } + } + } + break; + case X_SetDashes: + { + unsigned int numDashes = GetUINT(inputMessage + 10, bigEndian_); + encodeBuffer.encodeCachedValue(numDashes, 16, + clientCache_ -> setDashesLengthCache, 5); + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, bigEndian_), + clientCache_ -> gcCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, + clientCache_ -> setDashesOffsetCache, 5); + const unsigned char *nextSrc = inputMessage + 12; + for (unsigned int i = 0; i < numDashes; i++) + encodeBuffer.encodeCachedValue(*nextSrc++, 8, + clientCache_ -> setDashesDashCache_[i & 1], 5); + } + break; + case X_SetSelectionOwner: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> setSelectionOwnerCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, + clientCache_ -> getSelectionOwnerSelectionCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 32, + clientCache_ -> setSelectionOwnerTimestampCache, 9); + } + break; + case X_TranslateCoords: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_TranslateCoords source id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_TranslateCoords source id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_TranslateCoords source id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + t_id = GetULONG(inputMessage + 8, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_TranslateCoords target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_TranslateCoords target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_TranslateCoords target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_TranslateCoords); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + + hit = 1; + + break; + } + + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + clientCache_ -> translateCoordsSrcCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, + clientCache_ -> translateCoordsDstCache, 9); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), 16, + clientCache_ -> translateCoordsXCache, 8); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 14, bigEndian_), 16, + clientCache_ -> translateCoordsYCache, 8); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetImage: + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_GetImage source id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_GetImage source id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_GetImage source id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_GetImage); + + if (handleEncodeCached(encodeBuffer, clientCache_, messageStore, + inputMessage, inputLength)) + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + + hit = 1; + + break; + } + + // Format. + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); + // Drawable. + encodeBuffer.encodeXidValue(GetULONG(inputMessage + 4, + bigEndian_), clientCache_ -> drawableCache); + // X. + unsigned int x = GetUINT(inputMessage + 8, bigEndian_); + int xDiff = x - clientCache_ -> putImageLastX; + clientCache_ -> putImageLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache_ -> putImageXCache, 8); + // Y. + unsigned int y = GetUINT(inputMessage + 10, bigEndian_); + int yDiff = y - clientCache_ -> putImageLastY; + clientCache_ -> putImageLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache_ -> putImageYCache, 8); + // Width. + unsigned int width = GetUINT(inputMessage + 12, bigEndian_); + encodeBuffer.encodeCachedValue(width, 16, + clientCache_ -> putImageWidthCache, 8); + // Height. + unsigned int height = GetUINT(inputMessage + 14, bigEndian_); + encodeBuffer.encodeCachedValue(height, 16, + clientCache_ -> putImageHeightCache, 8); + // Plane mask. + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), 32, + clientCache_ -> getImagePlaneMaskCache, 5); + + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetPointerMapping: + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + case X_GetKeyboardControl: + { + sequenceQueue_.push(clientSequence_, inputOpcode); + + priority_++; + } + break; + default: + { + if (inputOpcode == opcodeStore_ -> renderExtension) + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXInternalRenderExtension); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + else if (inputOpcode == opcodeStore_ -> shapeExtension) + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXInternalShapeExtension); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + else if (inputOpcode == opcodeStore_ -> putPackedImage) + { + #ifdef TARGETS + + unsigned int t_id = GetULONG(inputMessage + 4, bigEndian_); + + if (pixmaps.find(t_id) != pixmaps.end()) + { + *logofs << "handleRead: X_NXPutPackedImage target id is pixmap " + << t_id << ".\n" << logofs_flush; + } + else if (windows.find(t_id) != windows.end()) + { + *logofs << "handleRead: X_NXPutPackedImage target id is window " + << t_id << ".\n" << logofs_flush; + } + else + { + *logofs << "handleRead: X_NXPutPackedImage target id " << t_id + << " is unrecognized.\n" << logofs_flush; + } + + #endif + + #ifdef DEBUG + *logofs << "handleRead: Encoding packed image request for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + // + // The field carries the destination data + // length. We add the request's size of + // the final X_PutImage. + // + + unsigned int outputLength = GetULONG(inputMessage + 20, bigEndian_) + 24; + + statistics -> addPackedBytesIn(inputLength); + + statistics -> addPackedBytesOut(outputLength); + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXPutPackedImage); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + else if (inputOpcode == opcodeStore_ -> setUnpackColormap) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding set unpack colormap request " + << "for FD#" << fd_ << " with size " << inputLength + << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXSetUnpackColormap); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + else if (inputOpcode == opcodeStore_ -> setUnpackAlpha) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding set unpack alpha request " + << "for FD#" << fd_ << " with size " << inputLength + << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXSetUnpackAlpha); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + else if (inputOpcode == opcodeStore_ -> setUnpackGeometry) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding set unpack geometry request " + << "for FD#" << fd_ << " with size " << inputLength + << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXSetUnpackGeometry); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + } + else if (inputOpcode == opcodeStore_ -> startSplit) + { + if (handleStartSplitRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> endSplit) + { + if (handleEndSplitRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> commitSplit) + { + if (handleCommitSplitRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> abortSplit) + { + if (handleAbortSplitRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> finishSplit) + { + if (handleFinishSplitRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> freeSplit) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding free split request " + << "for FD#" << fd_ << " with size " << inputLength + << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, + clientCache_ -> resourceCache); + } + else if (inputOpcode == opcodeStore_ -> freeUnpack) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding free unpack request " + << "for FD#" << fd_ << " with size " << inputLength + << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, + clientCache_ -> resourceCache); + } + else if (inputOpcode == opcodeStore_ -> getControlParameters) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding get control parameters " + << "request for FD#" << fd_ << " with size " + << inputLength << ".\n" << logofs_flush; + #endif + + // + // Add the reply to the write buffer. If found + // to contain a message, it it will be flushed + // to the X client before leaving the loop. + // + + unsigned char *reply = writeBuffer_.addMessage(32); + + *(reply + 0) = X_Reply; + + PutUINT(clientSequence_, reply + 2, bigEndian_); + + PutULONG(0, reply + 4, bigEndian_); + + // + // Save the sequence number we used + // to auto-generate this reply. + // + + lastSequence_ = clientSequence_; + + #ifdef TEST + *logofs << "handleRead: Registered " << lastSequence_ + << " as last auto-generated sequence number.\n" + << logofs_flush; + #endif + + *(reply + 1) = control -> LinkMode; + + *(reply + 8) = control -> LocalVersionMajor; + *(reply + 9) = control -> LocalVersionMinor; + *(reply + 10) = control -> LocalVersionPatch; + + *(reply + 11) = control -> RemoteVersionMajor; + *(reply + 12) = control -> RemoteVersionMinor; + *(reply + 13) = control -> RemoteVersionPatch; + + PutUINT(control -> SplitTimeout, reply + 14, bigEndian_); + PutUINT(control -> MotionTimeout, reply + 16, bigEndian_); + + *(reply + 18) = control -> SplitMode; + + PutULONG(control -> SplitDataThreshold, reply + 20, bigEndian_); + + *(reply + 24) = control -> PackMethod; + *(reply + 25) = control -> PackQuality; + + *(reply + 26) = control -> LocalDataCompressionLevel; + *(reply + 27) = control -> LocalStreamCompressionLevel; + *(reply + 28) = control -> LocalDeltaCompression; + + *(reply + 29) = (control -> LocalDeltaCompression == 1 && + control -> PersistentCacheEnableLoad == 1); + *(reply + 30) = (control -> LocalDeltaCompression == 1 && + control -> PersistentCacheEnableSave == 1); + *(reply + 31) = (control -> LocalDeltaCompression == 1 && + control -> PersistentCacheEnableLoad == 1 && + control -> PersistentCacheName != NULL); + + if (handleFlush(flush_if_any) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> getCleanupParameters) + { + #ifdef WARNING + *logofs << "handleRead: WARNING! Encoding fake get cleanup " + << "parameters request for FD#" << fd_ << " with size " + << inputLength << ".\n" << logofs_flush; + #endif + } + else if (inputOpcode == opcodeStore_ -> getImageParameters) + { + #ifdef WARNING + *logofs << "handleRead: WARNING! Encoding fake get cleanup " + << "parameters request for FD#" << fd_ << " with size " + << inputLength << ".\n" << logofs_flush; + #endif + } + else if (inputOpcode == opcodeStore_ -> getUnpackParameters) + { + #ifdef DEBUG + *logofs << "handleRead: Encoding get unpack parameters " + << "request for FD#" << fd_ << " with size " + << inputLength << ".\n" << logofs_flush; + #endif + + sequenceQueue_.push(clientSequence_, inputOpcode); + } + else if (inputOpcode == opcodeStore_ -> getShmemParameters) + { + if (handleShmemRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> setExposeParameters) + { + // + // Enable or disable expose events + // coming from the real server. + // + + encodeBuffer.encodeBoolValue(*(inputMessage + 4)); + encodeBuffer.encodeBoolValue(*(inputMessage + 5)); + encodeBuffer.encodeBoolValue(*(inputMessage + 6)); + } + else if (inputOpcode == opcodeStore_ -> setCacheParameters) + { + if (handleCacheRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else if (inputOpcode == opcodeStore_ -> getFontParameters) + { + if (handleFontRequest(encodeBuffer, inputOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + else + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXInternalGenericRequest); + + hit = handleEncode(encodeBuffer, clientCache_, messageStore, + inputOpcode, inputMessage, inputLength); + + // + // Don't flush if the opcode is unrecognized. + // We may optionally flush it is an extension + // but would penalize the well written clients. + // + // if (inputOpcode > 127) + // { + // priority_++; + // } + // + } + } + } // End of switch on opcode. + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + + const char *cacheString = (hit ? "cached " : ""); + + *logofs << "handleRead: Handled " << cacheString << "request OPCODE#" + << (unsigned int) inputOpcode << " (" << DumpOpcode(inputOpcode) + << ")" << " for FD#" << fd_ << " sequence " << clientSequence_ + << ". " << inputLength << " bytes in, " << bits << " bits (" + << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; + + #endif + + if (hit) + { + statistics -> addCachedRequest(inputOpcode); + } + + statistics -> addRequestBits(inputOpcode, inputLength << 3, bits); + + if (inputOpcode == opcodeStore_ -> renderExtension) + { + if (hit) + { + statistics -> addRenderCachedRequest(*(inputMessage + 1)); + } + + statistics -> addRenderRequestBits(*(inputMessage + 1), inputLength << 3, bits); + } + + } // End if (firstRequest_)... else ... + + } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != 0) ... + + // + // Check if we need to flush because of + // prioritized data. + // + + if (priority_ > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: WARNING! Requesting flush " + << "because of " << priority_ << " prioritized " + << "messages for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncPriority() < 0) + { + return -1; + } + + // + // Reset the priority flag. + // + + priority_ = 0; + } + + // + // Flush if we exceeded the token length. + // + + if (proxy -> canAsyncFlush() == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: WARNING! Requesting flush " + << "because of token length exceeded.\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncFlush() < 0) + { + return -1; + } + } + + #if defined(TEST) || defined(INFO) + + if (transport_ -> pending() != 0 || + readBuffer_.checkMessage() != 0) + { + *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" + << fd_ << " has " << transport_ -> pending() + << " bytes to read.\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Reset the read buffer. + // + + readBuffer_.fullReset(); + + return 1; +} + +// +// End of handleRead(). +// + +// +// Beginning of handleWrite(). +// + +int ClientChannel::handleWrite(const unsigned char *message, unsigned int length) +{ + #ifdef TEST + *logofs << "handleWrite: Called for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + // + // Create the buffer from which to + // decode messages. + // + + DecodeBuffer decodeBuffer(message, length); + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "handleWrite: Decoding messages for FD#" << fd_ + << " with " << length << " bytes in the buffer.\n" + << logofs_flush; + #endif + + if (firstReply_) + { + #ifdef TEST + *logofs << "handleWrite: First reply detected.\n" << logofs_flush; + #endif + + unsigned int outputOpcode; + + decodeBuffer.decodeValue(outputOpcode, 8); + unsigned int secondByte; + decodeBuffer.decodeValue(secondByte, 8); + unsigned int major; + decodeBuffer.decodeValue(major, 16); + unsigned int minor; + decodeBuffer.decodeValue(minor, 16); + unsigned int extraLength; + decodeBuffer.decodeValue(extraLength, 16); + unsigned int outputLength = 8 + (extraLength << 2); + + unsigned char *outputMessage = writeBuffer_.addMessage(outputLength); + *outputMessage = (unsigned char) outputOpcode; + outputMessage[1] = (unsigned char) secondByte; + PutUINT(major, outputMessage + 2, bigEndian_); + PutUINT(minor, outputMessage + 4, bigEndian_); + PutUINT(extraLength, outputMessage + 6, bigEndian_); + unsigned char *nextDest = outputMessage + 8; + unsigned int cached; + decodeBuffer.decodeBoolValue(cached); + + if (cached) + { + memcpy(nextDest, ServerCache::lastInitReply.getData(), outputLength - 8); + } + else + { + for (unsigned i = 8; i < outputLength; i++) + { + unsigned int nextByte; + decodeBuffer.decodeValue(nextByte, 8); + *nextDest++ = (unsigned char) nextByte; + } + + ServerCache::lastInitReply.set(outputLength - 8, outputMessage + 8); + } + + imageByteOrder_ = outputMessage[30]; + bitmapBitOrder_ = outputMessage[31]; + scanlineUnit_ = outputMessage[32]; + scanlinePad_ = outputMessage[33]; + + firstReply_ = 0; + + } // End of if (firstReply_) + + // + // This was previously in a 'else' block. + // Due to the way the first request was + // handled, we could not decode multiple + // messages in the first frame. + // + + { // Start of the decoding block. + + #ifdef DEBUG + *logofs << "handleWrite: Starting loop on opcodes.\n" + << logofs_flush; + #endif + + unsigned char outputOpcode; + + // + // NX client needs this line to consider + // the initialization phase successfully + // completed. + // + + if (firstClient_ == -1) + { + cerr << "Info" << ": Established X client connection.\n" ; + + firstClient_ = fd_; + } + + while (decodeBuffer.decodeOpcodeValue(outputOpcode, serverCache_ -> opcodeCache, 1)) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoded a new OPCODE#" + << (unsigned int) outputOpcode << ".\n" + << logofs_flush; + #endif + + unsigned char *outputMessage = NULL; + unsigned int outputLength = 0; + + // + // General-purpose temp variables + // for decoding ints and chars. + // + + unsigned int value = 0; + unsigned char cValue = 0; + + // + // Check first if we need to abort any split, + // then if this is a reply, finally if it is + // en event or error. + // + + if (outputOpcode == opcodeStore_ -> splitEvent) + { + // + // It's an abort split, not a normal + // burst of proxy data. + // + + handleSplitEvent(decodeBuffer); + + continue; + } + else if (outputOpcode == X_Reply) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding sequence number of reply.\n" + << logofs_flush; + #endif + + unsigned int sequenceNum; + unsigned int sequenceDiff; + + decodeBuffer.decodeCachedValue(sequenceDiff, 16, + serverCache_ -> replySequenceCache, 7); + + sequenceNum = (serverSequence_ + sequenceDiff) & 0xffff; + + serverSequence_ = sequenceNum; + + #ifdef DEBUG + *logofs << "handleWrite: Last server sequence number for FD#" + << fd_ << " is " << serverSequence_ << " with " + << "difference " << sequenceDiff << ".\n" + << logofs_flush; + #endif + + // + // In case of reply we can follow the X server and + // override any event's sequence number generated + // by this side. + // + + #ifdef TEST + *logofs << "handleWrite: Updating last event's sequence " + << lastSequence_ << " to reply's sequence number " + << serverSequence_ << " for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + lastSequence_ = serverSequence_; + + unsigned short int requestSequenceNum; + unsigned char requestOpcode; + + #ifdef DEBUG + + requestSequenceNum = 0; + requestOpcode = 0; + + *logofs << "handleWrite: Peek of sequence number returns "; + + *logofs << sequenceQueue_.peek(requestSequenceNum, requestOpcode); + + *logofs << " with sequence " << requestSequenceNum << " and opcode " + << (unsigned int) requestOpcode << ".\n" << logofs_flush; + + #endif + + if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) == 1 && + (requestSequenceNum == sequenceNum)) + { + unsigned int requestData[3]; + + sequenceQueue_.pop(requestSequenceNum, requestOpcode, + requestData[0], requestData[1], requestData[2]); + + #ifdef DEBUG + *logofs << "handleWrite: Identified reply to OPCODE#" + << (unsigned int) requestOpcode << ".\n" + << logofs_flush; + #endif + + // + // Is differential encoding disabled? + // + + if (control -> RemoteDeltaCompression == 0) + { + int result = handleFastWriteReply(decodeBuffer, requestOpcode, + outputMessage, outputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + switch (requestOpcode) + { + case X_AllocColor: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + unsigned char *nextDest = outputMessage + 8; + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeBoolValue(value); + if (value) + { + PutUINT(requestData[i], nextDest, bigEndian_); + } + else + { + decodeBuffer.decodeValue(value, 16, 6); + PutUINT(requestData[i] + value, nextDest, bigEndian_); + } + nextDest += 2; + } + decodeBuffer.decodeValue(value, 32, 9); + PutULONG(value, outputMessage + 16, bigEndian_); + } + break; + case X_GetAtomName: + { + unsigned int nameLength; + decodeBuffer.decodeValue(nameLength, 16, 6); + outputLength = RoundUp4(nameLength) + 32; + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(nameLength, outputMessage + 8, bigEndian_); + unsigned char* nextDest = outputMessage + 32; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, nameLength); + } + break; + case X_GetGeometry: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> depthCache); + outputMessage[1] = cValue; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> getGeometryRootCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + for (unsigned int i = 0; i < 5; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *serverCache_ -> getGeometryGeomCache[i], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + } + break; + case X_GetInputFocus: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 2); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> getInputFocusWindowCache); + PutULONG(value, outputMessage + 8, bigEndian_); + } + break; + case X_GetKeyboardMapping: + { + decodeBuffer.decodeBoolValue(value); + if (value) + { + unsigned int dataLength = + ServerCache::getKeyboardMappingLastMap.getLength(); + outputLength = 32 + dataLength; + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = + ServerCache::getKeyboardMappingLastKeysymsPerKeycode; + memcpy(outputMessage + 32, + ServerCache::getKeyboardMappingLastMap.getData(), + dataLength); + break; + } + unsigned int numKeycodes; + decodeBuffer.decodeValue(numKeycodes, 8); + unsigned int keysymsPerKeycode; + decodeBuffer.decodeValue(keysymsPerKeycode, 8, 4); + ServerCache::getKeyboardMappingLastKeysymsPerKeycode = + keysymsPerKeycode; + outputLength = 32 + numKeycodes * keysymsPerKeycode * 4; + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) keysymsPerKeycode; + unsigned char *nextDest = outputMessage + 32; + unsigned char previous = 0; + for (unsigned int count = numKeycodes * keysymsPerKeycode; + count; --count) + { + decodeBuffer.decodeBoolValue(value); + if (value) + PutULONG((unsigned int) NoSymbol, nextDest, bigEndian_); + else + { + unsigned int keysym; + decodeBuffer.decodeCachedValue(keysym, 24, + serverCache_ -> getKeyboardMappingKeysymCache, 9); + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> getKeyboardMappingLastByteCache, 5); + previous += cValue; + PutULONG((keysym << 8) | previous, nextDest, bigEndian_); + } + nextDest += 4; + } + ServerCache::getKeyboardMappingLastMap.set(outputLength - 32, + outputMessage + 32); + } + break; + case X_GetModifierMapping: + { + unsigned int keycodesPerModifier; + decodeBuffer.decodeValue(keycodesPerModifier, 8); + outputLength = 32 + (keycodesPerModifier << 3); + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) keycodesPerModifier; + unsigned char *nextDest = outputMessage + 32; + decodeBuffer.decodeBoolValue(value); + if (value) + { + memcpy(outputMessage + 32, + ServerCache::getModifierMappingLastMap.getData(), + ServerCache::getModifierMappingLastMap.getLength()); + break; + } + for (unsigned int count = outputLength - 32; count; count--) + { + decodeBuffer.decodeBoolValue(value); + if (value) + *nextDest++ = 0; + else + { + decodeBuffer.decodeValue(value, 8); + *nextDest++ = value; + } + } + ServerCache::getModifierMappingLastMap.set(outputLength - 32, + outputMessage + 32); + } + break; + case X_GetProperty: + { + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_GetProperty); + + handleDecode(decodeBuffer, serverCache_, messageStore, + requestOpcode, outputMessage, outputLength); + } + break; + case X_GetSelectionOwner: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> getSelectionOwnerCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + } + break; + case X_GetWindowAttributes: + { + outputLength = 44; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 2); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> visualCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> getWindowAttributesClassCache, 3); + PutUINT(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> getWindowAttributesBitGravityCache); + outputMessage[14] = cValue; + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> getWindowAttributesWinGravityCache); + outputMessage[15] = cValue; + decodeBuffer.decodeCachedValue(value, 32, + serverCache_ -> getWindowAttributesPlanesCache, 9); + PutULONG(value, outputMessage + 16, bigEndian_); + decodeBuffer.decodeCachedValue(value, 32, + serverCache_ -> getWindowAttributesPixelCache, 9); + PutULONG(value, outputMessage + 20, bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[24] = (unsigned char) value; + decodeBuffer.decodeBoolValue(value); + outputMessage[25] = (unsigned char) value; + decodeBuffer.decodeValue(value, 2); + outputMessage[26] = (unsigned char) value; + decodeBuffer.decodeBoolValue(value); + outputMessage[27] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> colormapCache, 9); + PutULONG(value, outputMessage + 28, bigEndian_); + decodeBuffer.decodeCachedValue(value, 32, + serverCache_ -> getWindowAttributesAllEventsCache); + PutULONG(value, outputMessage + 32, bigEndian_); + decodeBuffer.decodeCachedValue(value, 32, + serverCache_ -> getWindowAttributesYourEventsCache); + PutULONG(value, outputMessage + 36, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> getWindowAttributesDontPropagateCache); + PutUINT(value, outputMessage + 40, bigEndian_); + } + break; + case X_GrabKeyboard: + case X_GrabPointer: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 3); + outputMessage[1] = (unsigned char) value; + } + break; + case X_InternAtom: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 29, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + } + break; + case X_ListExtensions: + { + decodeBuffer.decodeValue(value, 32, 8); + outputLength = 32 + (value << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + unsigned int numExtensions; + decodeBuffer.decodeValue(numExtensions, 8); + outputMessage[1] = (unsigned char) numExtensions; + unsigned char *nextDest = outputMessage + 32; + for (; numExtensions; numExtensions--) + { + unsigned int length; + decodeBuffer.decodeValue(length, 8); + *nextDest++ = (unsigned char) length; + for (; length; length--) + { + decodeBuffer.decodeValue(value, 8); + *nextDest++ = value; + } + } + } + break; + case X_ListFonts: + { + // + // Differential compression can achieve a 12:1 to 14:1 + // ratio, while the best ZLIB compression can achieve + // a mere 4:1 to 5:1. In the first case, though, the + // huge amount of data constituting the message would + // be stored uncompressed at the remote side. We need + // to find a compromise. The solution is to use diffe- + // rential compression at startup and ZLIB compression + // later on. + // + + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_ListFonts); + + if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + decodeBuffer.decodeValue(value, 32, 8); + outputLength = 32 + (value << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + unsigned int numFonts; + decodeBuffer.decodeValue(numFonts, 16, 6); + PutUINT(numFonts, outputMessage + 8, bigEndian_); + + // Differential or plain data compression? + decodeBuffer.decodeBoolValue(value); + + if (value) + { + unsigned char* nextDest = outputMessage + 32; + for (; numFonts; numFonts--) + { + unsigned int length; + decodeBuffer.decodeValue(length, 8); + *nextDest++ = (unsigned char)length; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, length); + nextDest += length; + } + + handleSave(messageStore, outputMessage, outputLength); + } + else + { + const unsigned char *compressedData = NULL; + unsigned int compressedDataSize = 0; + + int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset, + outputMessage, outputLength, compressedData, + compressedDataSize); + if (decompressed < 0) + { + return -1; + } + else if (decompressed > 0) + { + handleSave(messageStore, outputMessage, outputLength, + compressedData, compressedDataSize); + } + else + { + handleSave(messageStore, outputMessage, outputLength); + } + } + } + break; + case X_LookupColor: + case X_AllocNamedColor: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + unsigned char *nextDest = outputMessage + 8; + if (requestOpcode == X_AllocNamedColor) + { + decodeBuffer.decodeValue(value, 32, 9); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + unsigned int count = 3; + do + { + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, nextDest, bigEndian_); + unsigned int visualColor; + decodeBuffer.decodeValue(visualColor, 16, 5); + visualColor += value; + visualColor &= 0xffff; + PutUINT(visualColor, nextDest + 6, bigEndian_); + nextDest += 2; + } + while (--count); + } + break; + case X_QueryBestSize: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 16, 8); + PutUINT(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 16, 8); + PutUINT(value, outputMessage + 10, bigEndian_); + } + break; + case X_QueryColors: + { + // Differential or plain data compression? + decodeBuffer.decodeBoolValue(value); + + if (value) + { + decodeBuffer.decodeBoolValue(value); + if (value) + { + unsigned int numColors = + serverCache_ -> queryColorsLastReply.getLength() / 6; + outputLength = 32 + (numColors << 3); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(numColors, outputMessage + 8, bigEndian_); + const unsigned char *nextSrc = + serverCache_ -> queryColorsLastReply.getData(); + unsigned char *nextDest = outputMessage + 32; + for (; numColors; numColors--) + { + for (unsigned int i = 0; i < 6; i++) + *nextDest++ = *nextSrc++; + nextDest += 2; + } + } + else + { + unsigned int numColors; + decodeBuffer.decodeValue(numColors, 16, 5); + outputLength = 32 + (numColors << 3); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(numColors, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 32; + for (unsigned int c = 0; c < numColors; c++) + { + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeValue(value, 16); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + } + serverCache_ -> queryColorsLastReply.set(numColors * 6, + outputMessage + 32); + const unsigned char *nextSrc = nextDest - 1; + nextDest = outputMessage + 32 + ((numColors - 1) << 3) + 5; + for (; numColors > 1; numColors--) + { + for (unsigned int i = 0; i < 6; i++) + *nextDest-- = *nextSrc--; + nextDest -= 2; + } + } + } + else + { + // Reply length. + unsigned int numColors; + decodeBuffer.decodeValue(numColors, 16, 5); + outputLength = 32 + (numColors << 3); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(numColors, outputMessage + 8, bigEndian_); + + const unsigned char *compressedData = NULL; + unsigned int compressedDataSize = 0; + + int decompressed = handleDecompress(decodeBuffer, requestOpcode, 32, + outputMessage, outputLength, compressedData, + compressedDataSize); + if (decompressed < 0) + { + return -1; + } + } + } + break; + case X_QueryExtension: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[8] = (unsigned char) value; + decodeBuffer.decodeValue(value, 8); + outputMessage[9] = (unsigned char) value; + decodeBuffer.decodeValue(value, 8); + outputMessage[10] = (unsigned char) value; + decodeBuffer.decodeValue(value, 8); + outputMessage[11] = (unsigned char) value; + + // + // We use a predefined opcode to address + // extensions' message stores, while real + // opcodes are used for communication with + // X server and clients. + // + + if (requestData[0] == X_NXInternalShapeExtension) + { + opcodeStore_ -> shapeExtension = outputMessage[9]; + + #ifdef TEST + *logofs << "handleWrite: Shape extension opcode for FD#" << fd_ + << " is " << (unsigned int) opcodeStore_ -> shapeExtension + << ".\n" << logofs_flush; + #endif + } + else if (requestData[0] == X_NXInternalRenderExtension) + { + opcodeStore_ -> renderExtension = outputMessage[9]; + + #ifdef TEST + *logofs << "handleWrite: Render extension opcode for FD#" << fd_ + << " is " << (unsigned int) opcodeStore_ -> renderExtension + << ".\n" << logofs_flush; + #endif + } + } + break; + case X_QueryFont: + { + // + // Use differential compression at startup and plain + // data compression later. Check X_ListFonts message + // for an explaination. + // + + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_QueryFont); + + if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + // Differential or plain data compression? + decodeBuffer.decodeBoolValue(value); + + if (value) + { + unsigned int numProperties; + unsigned int numCharInfos; + decodeBuffer.decodeValue(numProperties, 16, 8); + decodeBuffer.decodeValue(numCharInfos, 32, 10); + outputLength = 60 + numProperties * 8 + numCharInfos * 12; + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(numProperties, outputMessage + 46, bigEndian_); + PutULONG(numCharInfos, outputMessage + 56, bigEndian_); + handleDecodeCharInfo(decodeBuffer, outputMessage + 8); + handleDecodeCharInfo(decodeBuffer, outputMessage + 24); + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, outputMessage + 40, bigEndian_); + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, outputMessage + 42, bigEndian_); + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, outputMessage + 44, bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[48] = (unsigned char) value; + decodeBuffer.decodeValue(value, 8); + outputMessage[49] = (unsigned char) value; + decodeBuffer.decodeValue(value, 8); + outputMessage[50] = (unsigned char) value; + decodeBuffer.decodeBoolValue(value); + outputMessage[51] = (unsigned char) value; + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, outputMessage + 52, bigEndian_); + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, outputMessage + 54, bigEndian_); + unsigned char *nextDest = outputMessage + 60; + decodeBuffer.decodeBoolValue(value); + + int end = 0; + + if (value == 1) + { + unsigned int index; + decodeBuffer.decodeValue(index, 4); + unsigned int length; + const unsigned char *data; + ServerCache::queryFontFontCache.get(index, length, data); + memcpy(nextDest, data, length); + + end = 1; + } + + if (end == 0) + { + unsigned char *saveDest = nextDest; + unsigned int length = numProperties * 8 + numCharInfos * 12; + for (; numProperties; numProperties--) + { + decodeBuffer.decodeValue(value, 32, 9); + PutULONG(value, nextDest, bigEndian_); + decodeBuffer.decodeValue(value, 32, 9); + PutULONG(value, nextDest + 4, bigEndian_); + nextDest += 8; + } + for (; numCharInfos; numCharInfos--) + { + handleDecodeCharInfo(decodeBuffer, nextDest); + + nextDest += 12; + } + ServerCache::queryFontFontCache.set(length, saveDest); + } + + handleSave(messageStore, outputMessage, outputLength); + } + else + { + // Reply length. + unsigned int replyLength; + decodeBuffer.decodeValue(replyLength, 32, 16); + outputLength = 32 + (replyLength << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + + const unsigned char *compressedData = NULL; + unsigned int compressedDataSize = 0; + + int decompressed = handleDecompress(decodeBuffer, requestOpcode, messageStore -> dataOffset, + outputMessage, outputLength, compressedData, + compressedDataSize); + if (decompressed < 0) + { + return -1; + } + else if (decompressed > 0) + { + handleSave(messageStore, outputMessage, outputLength, + compressedData, compressedDataSize); + } + else + { + handleSave(messageStore, outputMessage, outputLength); + } + } + } + break; + case X_QueryPointer: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> queryPointerRootCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> queryPointerChildCache, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyRootXCache, 8); + serverCache_ -> motionNotifyLastRootX += value; + PutUINT(serverCache_ -> motionNotifyLastRootX, outputMessage + 16, + bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyRootYCache, 8); + serverCache_ -> motionNotifyLastRootY += value; + PutUINT(serverCache_ -> motionNotifyLastRootY, outputMessage + 18, + bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyEventXCache, 8); + PutUINT(serverCache_ -> motionNotifyLastRootX + value, + outputMessage + 20, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyEventYCache, 8); + PutUINT(serverCache_ -> motionNotifyLastRootY + value, + outputMessage + 22, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyStateCache); + PutUINT(value, outputMessage + 24, bigEndian_); + } + break; + case X_QueryTree: + { + unsigned int children; + decodeBuffer.decodeValue(children, 16, 8); + + outputLength = 32 + (children << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + + PutULONG(outputLength, outputMessage + 4, bigEndian_); + + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> queryTreeWindowCache); + + PutULONG(value, outputMessage + 8, bigEndian_); + + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> queryTreeWindowCache); + + PutULONG(value, outputMessage + 12, bigEndian_); + + unsigned char *next = outputMessage + 32; + + PutUINT(children, outputMessage + 16, bigEndian_); + + for (unsigned int i = 0; i < children; i++) + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> queryTreeWindowCache); + + PutULONG(value, next + (i * 4), bigEndian_); + } + } + break; + case X_TranslateCoords: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> translateCoordsChildCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> translateCoordsXCache, 8); + PutUINT(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> translateCoordsYCache, 8); + PutUINT(value, outputMessage + 14, bigEndian_); + } + break; + case X_GetImage: + { + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_GetImage); + + if (handleDecodeCached(decodeBuffer, serverCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + // Depth. + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> depthCache); + // Reply length. + unsigned int replyLength; + decodeBuffer.decodeValue(replyLength, 32, 9); + outputLength = 32 + (replyLength << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) cValue; + // Visual. + unsigned int visual; + decodeBuffer.decodeCachedValue(visual, 29, + serverCache_ -> visualCache); + PutULONG(visual, outputMessage + 8, bigEndian_); + + // Since ProtoStep8 (#issue 108) + handleCopy(decodeBuffer, requestOpcode, messageStore -> + dataOffset, outputMessage, outputLength); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_GetPointerMapping: + { + unsigned int nextByte; + decodeBuffer.decodeValue(nextByte, 8, 4); + unsigned int replyLength; + decodeBuffer.decodeValue(replyLength, 32, 4); + outputLength = 32 + (replyLength << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) nextByte; + unsigned char *nextDest = outputMessage + 32; + for (unsigned int i = 32; i < outputLength; i++) + { + decodeBuffer.decodeValue(nextByte, 8, 4); + *nextDest++ = (unsigned char) nextByte; + } + } + break; + case X_GetKeyboardControl: + { + unsigned int nextByte; + decodeBuffer.decodeValue(nextByte, 8, 2); + unsigned int replyLength; + decodeBuffer.decodeValue(replyLength, 32, 8); + outputLength = 32 + (replyLength << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) nextByte; + unsigned char *nextDest = outputMessage + 8; + for (unsigned int i = 8; i < outputLength; i++) + { + decodeBuffer.decodeValue(nextByte, 8, 4); + *nextDest++ = (unsigned char) nextByte; + } + } + break; + default: + { + if (requestOpcode == opcodeStore_ -> getUnpackParameters) + { + #ifdef TEST + *logofs << "handleWrite: Received get unpack parameters reply " + << "OPCODE#" << (unsigned int) opcodeStore_ -> getUnpackParameters + << ".\n" << logofs_flush; + #endif + + outputLength = 32 + PACK_METHOD_LIMIT; + + outputMessage = writeBuffer_.addMessage(outputLength); + + unsigned int method; + + // + // Let agent use only the unpack methods + // implemented at both sides. + // + + for (int i = 0; i < PACK_METHOD_LIMIT; i++) + { + decodeBuffer.decodeBoolValue(method); + + control -> RemoteUnpackMethods[i] = method; + + *(outputMessage + 32 + i) = + (control -> LocalUnpackMethods[i] == 1 && + method == 1); + } + } + else if (requestOpcode == opcodeStore_ -> getShmemParameters) + { + if (handleShmemReply(decodeBuffer, requestOpcode, + outputMessage, outputLength) < 0) + { + return -1; + } + } + else if (requestOpcode == opcodeStore_ -> getFontParameters) + { + if (handleFontReply(decodeBuffer, requestOpcode, + outputMessage, outputLength) < 0) + { + return -1; + } + } + else + { + #ifdef PANIC + *logofs << "handleWrite: PANIC! No matching request for " + << "reply with sequence number " << sequenceNum + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": No matching request for " + << "reply with sequence number " << sequenceNum + << ".\n"; + + return -1; + } + } + } + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: Handled reply to OPCODE#" + << (unsigned) requestOpcode << " (" << DumpOpcode(requestOpcode) + << ")" << " for FD#" << fd_ << " with sequence " << serverSequence_ + << ". Output size is " << outputLength << ".\n" << logofs_flush; + #endif + + statistics -> addRepliedRequest(requestOpcode); + } + else // End of if (sequenceQueue_.peek() && ...) + { + // + // Reply didn't match any request opcode. + // Check again if differential encoding + // is disabled. + // + + #ifdef DEBUG + *logofs << "handleWrite: Identified generic reply.\n" + << logofs_flush; + #endif + + requestOpcode = X_Reply; + + if (control -> RemoteDeltaCompression == 0) + { + int result = handleFastWriteReply(decodeBuffer, requestOpcode, + outputMessage, outputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + // + // All replies whose opcode is not pushed in + // sequence number queue are cached together. + // Among such replies are those to extension + // requests. + // + + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_NXInternalGenericReply); + + handleDecode(decodeBuffer, serverCache_, messageStore, + requestOpcode, outputMessage, outputLength); + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: Handled generic reply for FD#" << fd_ + << " with sequence " << serverSequence_ << ". Output size is " + << outputLength << ".\n" << logofs_flush; + #endif + + statistics -> addRepliedRequest(requestOpcode); + + } // End of if (sequenceQueue_.peek() && ...) else ... + + // + // If any output was produced then write opcode, + // sequence number and size to the buffer. + // + + if (outputLength > 0) + { + *outputMessage = outputOpcode; + + PutUINT(serverSequence_, outputMessage + 2, bigEndian_); + + PutULONG((outputLength - 32) >> 2, outputMessage + 4, bigEndian_); + } + + } // End of if (outputOpcode == 1)... + else + { + // + // It's an event or error. + // + + unsigned int sequenceNum; + unsigned int sequenceDiff; + + decodeBuffer.decodeCachedValue(sequenceDiff, 16, + serverCache_ -> eventSequenceCache, 7); + + sequenceNum = (serverSequence_ + sequenceDiff) & 0xffff; + + serverSequence_ = sequenceNum; + + #ifdef DEBUG + *logofs << "handleWrite: Last server sequence number for FD#" + << fd_ << " is " << serverSequence_ << " with " + << "difference " << sequenceDiff << ".\n" + << logofs_flush; + #endif + + // + // Check if this is an error that matches + // a sequence number for which we were + // expecting a reply. + // + + if (outputOpcode == X_Error) + { + unsigned short int errorSequenceNum; + unsigned char errorOpcode; + + if (sequenceQueue_.peek(errorSequenceNum, errorOpcode) && + ((unsigned) errorSequenceNum == serverSequence_)) + { + // + // Remove the queued sequence of the reply. + // + + #ifdef TEST + *logofs << "handleWrite: WARNING! Removing reply to OPCODE#" + << (unsigned) errorOpcode << " sequence " + << errorSequenceNum << " for FD#" << fd_ + << " due to error.\n" << logofs_flush; + #endif + + sequenceQueue_.pop(errorSequenceNum, errorOpcode); + + // + // Send to the client the current sequence + // number, not the number that matched the + // reply. Because we are generating replies + // at our side, Xlib can incur in a sequence + // lost if the error comes after the auto- + // generated reply. + // + + if (control -> SessionMode == session_proxy) + { + #ifdef TEST + *logofs << "handleWrite: Updating last event's sequence " + << lastSequence_ << " to X server's error sequence " + << "number " << serverSequence_ << " for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + lastSequence_ = serverSequence_; + } + } + + // + // In case of errors always send to client the + // original X server's sequence associated to + // the failing request. + // + + if (control -> SessionMode != session_proxy) + { + #ifdef TEST + *logofs << "handleWrite: Updating last event's sequence " + << lastSequence_ << " to X server's error sequence " + << "number " << serverSequence_ << " for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + lastSequence_ = serverSequence_; + } + } + + // + // Check if by producing events at client side we + // have modified the events' sequence numbering. + // In this case taint the original sequence to + // comply with the last one known by client. + // + +/* +FIXME: Recover the sequence number if the proxy + is not connected to an agent. +*/ + if (serverSequence_ > lastSequence_ || + control -> SessionMode != session_proxy) + { + #ifdef DEBUG + *logofs << "handleWrite: Updating last event's sequence " + << lastSequence_ << " to X server's sequence number " + << serverSequence_ << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + lastSequence_ = serverSequence_; + } + #ifdef DEBUG + else if (serverSequence_ < lastSequence_) + { + // + // Use our last auto-generated sequence. + // + + *logofs << "handleWrite: Tainting sequence number " + << serverSequence_ << " to last event's sequence " + << lastSequence_ << " for FD#" << fd_ << ".\n" + << logofs_flush; + } + #endif + + // + // Check if remote side used fast encoding. + // + + if (control -> RemoteDeltaCompression == 0) + { + int result = handleFastWriteEvent(decodeBuffer, outputOpcode, + outputMessage, outputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + // + // Make space for message in the outgoing buffer + // and write opcode and sequence number. + // + + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + + *outputMessage = outputOpcode; + + PutUINT(lastSequence_, outputMessage + 2, bigEndian_); + + #ifdef DEBUG + *logofs << "handleWrite: Going to handle event or error OPCODE#" + << (unsigned int) outputOpcode << " for FD#" << fd_ + << " sequence " << lastSequence_ << " (real was " + << serverSequence_ << ").\n" << logofs_flush; + #endif + + switch (outputOpcode) + { + case X_Error: + { + unsigned char code; + decodeBuffer.decodeCachedValue(code, 8, + serverCache_ -> errorCodeCache); + outputMessage[1] = code; + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: Handled error ERR_CODE#" + << (unsigned int) code << " for FD#" << fd_; + #endif + + if ((code != 11) && (code != 8) && + (code != 15) && (code != 1)) + { + decodeBuffer.decodeValue(value, 32, 16); + PutULONG(value, outputMessage + 4, bigEndian_); + + #if defined(TEST) || defined(OPCODES) + *logofs << " RES_ID#" << value; + #endif + } + + if (code >= 18) + { + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> errorMinorCache); + PutUINT(value, outputMessage + 8, bigEndian_); + + #if defined(TEST) || defined(OPCODES) + *logofs << " MIN_OP#" << value; + #endif + } + + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> errorMajorCache); + outputMessage[10] = cValue; + + #if defined(TEST) || defined(OPCODES) + *logofs << " MAJ_OP#" << (unsigned int) cValue; + #endif + + if (code >= 18) + { + unsigned char *nextDest = outputMessage + 11; + for (unsigned int i = 11; i < 32; i++) + { + decodeBuffer.decodeValue(value, 8); + *nextDest++ = (unsigned char) cValue; + } + } + + #if defined(TEST) || defined(OPCODES) + *logofs << " sequence " << lastSequence_ << " (real was " + << serverSequence_ << ") . Size is " + << (unsigned int) outputLength << ".\n" + << logofs_flush; + #endif + } + break; + case ButtonPress: + case ButtonRelease: + case KeyPress: + case KeyRelease: + case MotionNotify: + case EnterNotify: + case LeaveNotify: + { + if (outputOpcode == MotionNotify) + { + decodeBuffer.decodeBoolValue(value); + } + else if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) + { + decodeBuffer.decodeValue(value, 3); + } + else if (outputOpcode == KeyRelease) + { + decodeBuffer.decodeBoolValue(value); + if (value) + { + value = serverCache_ -> keyPressLastKey; + } + else + { + decodeBuffer.decodeValue(value, 8); + } + } + else if (outputOpcode == ButtonPress || outputOpcode == ButtonRelease) + { + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> buttonCache); + value = (unsigned int) cValue; + } + else + { + decodeBuffer.decodeValue(value, 8); + } + + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 32, + serverCache_ -> motionNotifyTimestampCache, 9); + serverCache_ -> lastTimestamp += value; + PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, + bigEndian_); + unsigned char *nextDest = outputMessage + 8; + int skipRest = 0; + if (outputOpcode == KeyRelease) + { + decodeBuffer.decodeBoolValue(value); + if (value) + { + for (unsigned int i = 0; i < 23; i++) + { + *nextDest++ = serverCache_ -> keyPressCache[i]; + } + skipRest = 1; + } + } + + if (!skipRest) + { + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeCachedValue(value, 29, + *serverCache_ -> motionNotifyWindowCache[i], 6); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyRootXCache, 6); + serverCache_ -> motionNotifyLastRootX += value; + PutUINT(serverCache_ -> motionNotifyLastRootX, outputMessage + 20, + bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyRootYCache, 6); + serverCache_ -> motionNotifyLastRootY += value; + PutUINT(serverCache_ -> motionNotifyLastRootY, outputMessage + 22, + bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyEventXCache, 6); + PutUINT(serverCache_ -> motionNotifyLastRootX + value, + outputMessage + 24, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyEventYCache, 6); + PutUINT(serverCache_ -> motionNotifyLastRootY + value, + outputMessage + 26, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> motionNotifyStateCache); + PutUINT(value, outputMessage + 28, bigEndian_); + if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) + { + decodeBuffer.decodeValue(value, 2); + } + else + { + decodeBuffer.decodeBoolValue(value); + } + outputMessage[30] = (unsigned char) value; + if (outputOpcode == EnterNotify || outputOpcode == LeaveNotify) + { + decodeBuffer.decodeValue(value, 2); + outputMessage[31] = (unsigned char) value; + } + else if (outputOpcode == KeyPress) + { + serverCache_ -> keyPressLastKey = outputMessage[1]; + for (unsigned int i = 8; i < 31; i++) + { + serverCache_ -> keyPressCache[i - 8] = outputMessage[i]; + } + } + } + } + break; + case ColormapNotify: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> colormapNotifyWindowCache, 8); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> colormapNotifyColormapCache, 8); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[12] = (unsigned char) value; + decodeBuffer.decodeBoolValue(value); + outputMessage[13] = (unsigned char) value; + } + break; + case ConfigureNotify: + { + unsigned char *nextDest = outputMessage + 4; + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeCachedValue(value, 29, + *serverCache_ -> configureNotifyWindowCache[i], 9); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + for (unsigned int j = 0; j < 5; j++) + { + decodeBuffer.decodeCachedValue(value, 16, + *serverCache_ -> configureNotifyGeomCache[j], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + decodeBuffer.decodeBoolValue(value); + *nextDest = value; + } + break; + case CreateNotify: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> createNotifyWindowCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 29, 5); + serverCache_ -> createNotifyLastWindow += value; + serverCache_ -> createNotifyLastWindow &= 0x1fffffff; + PutULONG(serverCache_ -> createNotifyLastWindow, outputMessage + 8, + bigEndian_); + unsigned char* nextDest = outputMessage + 12; + for (unsigned int i = 0; i < 5; i++) + { + decodeBuffer.decodeValue(value, 16, 9); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + decodeBuffer.decodeBoolValue(value); + *nextDest = (unsigned char) value; + } + break; + case Expose: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> exposeWindowCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 8; + for (unsigned int i = 0; i < 5; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *serverCache_ -> exposeGeomCache[i], 6); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + } + break; + case FocusIn: + case FocusOut: + { + decodeBuffer.decodeValue(value, 3); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> focusInWindowCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 2); + outputMessage[8] = (unsigned char) value; + } + break; + case KeymapNotify: + { + decodeBuffer.decodeBoolValue(value); + if (value) + memcpy(outputMessage + 1, ServerCache::lastKeymap.getData(), 31); + else + { + unsigned char *nextDest = outputMessage + 1; + for (unsigned int i = 1; i < 32; i++) + { + decodeBuffer.decodeValue(value, 8); + *nextDest++ = (unsigned char) value; + } + ServerCache::lastKeymap.set(31, outputMessage + 1); + } + } + break; + case MapNotify: + case UnmapNotify: + case DestroyNotify: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> mapNotifyEventCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> mapNotifyWindowCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + if (outputOpcode == MapNotify || outputOpcode == UnmapNotify) + { + decodeBuffer.decodeBoolValue(value); + outputMessage[12] = (unsigned char) value; + } + } + break; + case NoExpose: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> noExposeDrawableCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + serverCache_ -> noExposeMinorCache); + PutUINT(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(cValue, 8, + serverCache_ -> noExposeMajorCache); + outputMessage[10] = cValue; + } + break; + case PropertyNotify: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> propertyNotifyWindowCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> propertyNotifyAtomCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 32, 9); + serverCache_ -> lastTimestamp += value; + PutULONG(serverCache_ -> lastTimestamp, outputMessage + 12, + bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[16] = (unsigned char) value; + } + break; + case ReparentNotify: + { + unsigned char* nextDest = outputMessage + 4; + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> reparentNotifyWindowCache, 9); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + decodeBuffer.decodeValue(value, 16, 6); + PutUINT(value, nextDest, bigEndian_); + decodeBuffer.decodeValue(value, 16, 6); + PutUINT(value, nextDest + 2, bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[20] = (unsigned char)value; + } + break; + case SelectionClear: + { + decodeBuffer.decodeValue(value, 32, 9); + serverCache_ -> lastTimestamp += value; + PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, + bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearWindowCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearAtomCache, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + } + break; + case SelectionRequest: + { + decodeBuffer.decodeValue(value, 32, 9); + serverCache_ -> lastTimestamp += value; + PutULONG(serverCache_ -> lastTimestamp, outputMessage + 4, + bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearWindowCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearWindowCache, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearAtomCache, 9); + PutULONG(value, outputMessage + 16, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearAtomCache, 9); + PutULONG(value, outputMessage + 20, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> selectionClearAtomCache, 9); + PutULONG(value, outputMessage + 24, bigEndian_); + } + break; + case VisibilityNotify: + { + decodeBuffer.decodeCachedValue(value, 29, + serverCache_ -> visibilityNotifyWindowCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 2); + outputMessage[8] = (unsigned char) value; + } + break; + default: + { + #ifdef TEST + *logofs << "handleWrite: Using generic event compression " + << "for OPCODE#" << (unsigned int) outputOpcode + << ".\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(*(outputMessage + 1), 8, + serverCache_ -> genericEventCharCache); + + for (unsigned int i = 0; i < 14; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *serverCache_ -> genericEventIntCache[i]); + + PutUINT(value, outputMessage + i * 2 + 4, bigEndian_); + } + } + } // End of switch (outputOpcode)... + + #if defined(TEST) || defined(OPCODES) + if (outputOpcode != X_Error) + { + *logofs << "handleWrite: Handled event OPCODE#" + << (unsigned int) outputOpcode << " for FD#" + << fd_ << " sequence " << lastSequence_ << " (real was " + << serverSequence_ << "). Size is " << outputLength + << ".\n" << logofs_flush; + } + #endif + + // + // Check if we need to suppress the error. + // + + if (outputOpcode == X_Error && + handleTaintSyncError(*(outputMessage + 10)) > 0) + { + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: WARNING! Suppressed error OPCODE#" + << (unsigned int) outputOpcode << " for FD#" + << fd_ << " sequence " << lastSequence_ << ".\n" + << logofs_flush; + #endif + + writeBuffer_.removeMessage(32); + } + + } // End of if (outputOpcode == 1)... else ... + + // + // Check if we produced enough data. We need to + // decode all provided messages. Just update the + // finish flag in case of failure. + // + + handleFlush(flush_if_needed); + + } // End of while (decodeBuffer.decodeOpcodeValue(outputOpcode, 8, ... + + } // End of the decoding block. + + // + // Write any remaining data to the X connection. + // + + if (handleFlush(flush_if_any) < 0) + { + return -1; + } + + return 1; +} + +// +// End of handleWrite(). +// + +// +// Other members. +// + +int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, + T_store_action action, int position, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #if defined(TEST) || defined(SPLIT) + + // Since ProtoStep8 (#issue 108) + *logofs << "handleSplit: PANIC! SPLIT! Split should " + << "not be enabled for message " << "OPCODE#" + << (unsigned int) store -> opcode() << ".\n" + << logofs_flush; + + HandleCleanup(); + + #endif + + // + // Refuse the split if it is not introduced + // by a start split. + // + + // Since ProtoStep7 (#issue 108) + if (splitState_.resource == nothing || enableSplit_ == 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Nothing to do for message " + << "OPCODE#" << (unsigned int) store -> opcode() + << " of size " << size << " position " << position + << " with action [" << DumpAction(action) << "] at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeBoolValue(0); + + return 0; + } + + // + // It's not advisable to allocate the store at + // the time we receive the start-split because + // we may process all the splits received and + // deallocate the store even before we receive + // the end split. Another message for the same + // split sequence may then come and we would + // have a null split store. + // + + handleSplitStoreAlloc(&splitResources_, splitState_.resource); + + // + // Check if the split was actually requested by + // the agent and if the request was saved in the + // message store. The split can also be refused + // if the message is smaller than the threshold + // or if the split store is already full. + // + + if (mustSplitMessage(splitState_.resource) == 0) + { + if (action == IS_HIT || canSplitMessage(splitState_.mode, size) == 0) + { + #if defined(TEST) || defined(SPLIT) + + if (splitState_.mode == split_none) + { + #ifdef PANIC + *logofs << "handleSplit: PANIC! SPLIT! Split state has " + << "mode 'none'.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + if (action != IS_HIT && (int) size >= + control -> SplitDataThreshold) + { + #ifdef WARNING + *logofs << "handleSplit: WARNING! SPLIT! Split stores have " + << clientStore_ -> getSplitTotalSize() << " messages " + << "and " << clientStore_ -> getSplitTotalStorageSize() + << " allocated bytes.\n" << logofs_flush; + #endif + } + + #endif + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Message OPCODE#" + << (unsigned int) store -> opcode() << " of size " << size + << " [not split] with resource " << splitState_.resource + << " mode " << splitState_.mode << " position " << position + << " and action [" << DumpAction(action) << "] at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeBoolValue(0); + + return 0; + } + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Message OPCODE#" + << (unsigned int) store -> opcode() << " of size " << size + << " [split] with resource " << splitState_.resource + << " mode " << splitState_.mode << " position " << position + << " and action [" << DumpAction(action) << "] at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeBoolValue(1); + + T_checksum checksum = NULL; + + if (action == IS_ADDED) + { + checksum = store -> getChecksum(position); + } + else if (action == is_discarded) + { + // + // Generate the checksum on the fly. + // + + checksum = store -> getChecksum(buffer, size, bigEndian_); + } + + // + // The method must abort the connection + // if it can't allocate the split. + // + + Split *splitMessage = clientStore_ -> getSplitStore(splitState_.resource) -> + add(store, splitState_.resource, splitState_.mode, + position, action, checksum, buffer, size); + + // + // Send the checksum. By using the checksum, + // the remote end will try to locate the + // message and load it from disk. + // + + if (action == IS_HIT) + { + splitMessage -> setState(split_loaded); + } + else if (handleSplitChecksum(encodeBuffer, checksum) == 0) + { + // + // If the checksum is not sent, for example + // because loading of messages from disk is + // disabled, then mark the split as missed. + // + + #ifdef WARNING + *logofs << "handleSplit: WARNING! Checksum not sent. " + << "Marking the split as [missed].\n" + << logofs_flush; + #endif + + splitMessage -> setState(split_missed); + } + + if (action == is_discarded) + { + delete [] checksum; + } + + // + // Check if we are ready to send a new split + // for this store. + // + + handleSplitPending(splitState_.resource); + + #if defined(TEST) || defined(SPLIT) + + *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> + getSplitTotalSize() << " messages and " << clientStore_ -> + getSplitTotalStorageSize() << " bytes to send in " + << "the split stores.\n" << logofs_flush; + + clientStore_ -> dumpSplitStore(splitState_.resource); + + #endif + + return 1; +} + +int ClientChannel::handleSplit(EncodeBuffer &encodeBuffer) +{ + // + // Determine the maximum amount of bytes + // we can write in this iteration. + // + + int total = control -> SplitDataPacketLimit; + + int bytes = total; + int splits = 0; + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Handling splits " + << "for FD#" << fd_ << " with " << clientStore_ -> + getSplitTotalSize() << " elements and " << total + << " bytes to write at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Looping to find " + << "if there is any split to send.\n" + << logofs_flush; + #endif + + SplitStore *splitStore; + + Split *splitMessage; + + // + // Divide the available bandwidth among all the active + // split stores by implementing a simple round-robin + // mechanism. This can be extended by using an external + // function returning the number of bytes to be written + // based on the state of the split (splits which didn't + // receive yet a confirmation event could be delayed), + // the current bitrate, and by letting the agent asso- + // ciate a priority to the resource in the start split + // operation. + // + + splitState_.pending = 0; + + splitResources_.rotate(); + + // + // Copy the list since elements can be removed + // in the middle of the loop. + // + + T_list splitList = splitResources_.copyList(); + + for (T_list::iterator j = splitList.begin(); + j != splitList.end(); j++) + { + int resource = *j; + + #ifdef DEBUG + *logofs << "handleSplit: SPLIT! Looping with current " + << "resource " << resource << ".\n" + << logofs_flush; + #endif + + splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore != NULL) + { + // + // Don't send more than the the packet size + // bytes but ensure that we abort any split + // found in the disk cache. + // + + for (;;) + { + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpSplitStore(resource); + + #endif + + splitMessage = splitStore -> getFirstSplit(); + + if (splitMessage == NULL) + { + // + // We have created the store after a start + // split but no message was added yet. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: WARNING! SPLIT! The split store " + << "is still empty.\n" << logofs_flush; + #endif + + break; + } + + // + // Splits already aborted can't be in the + // split store. + // + + #if defined(TEST) || defined(SPLIT) + + if (splitMessage -> getState() == split_aborted) + { + *logofs << "handleSplit: PANIC! SPLIT! Found an " + << "aborted split in store [" << resource + << "].\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Check if there are more messages in the + // store that can be aborted or if we have + // exceeded the number of bytes we can send + // for this iteration. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Checking closure " + << "of the inner loop with " << bytes + << " bytes to write and split state [" + << DumpState(splitMessage -> getState()) + << "].\n" << logofs_flush; + #endif + + if ((splitMessage -> getMode() == split_sync && + splitMessage -> getState() == split_added) || + (bytes <= 0 && splitMessage -> + getState() != split_loaded)) + { + break; + } + + // + // If the split was loaded at the remote + // side abort it immediately. + // + + if (splitMessage -> getState() == split_loaded) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Sending more data " + << "for store [" << resource << "] with " + << "a split to be aborted.\n" + << logofs_flush; + #endif + + if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) + { + return -1; + } + } + else if (bytes > 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Sending more data " + << "for store [" << resource << "] with " + << bytes << " bytes to send.\n" + << logofs_flush; + #endif + + if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) + { + return -1; + } + } + + // + // Check if the split store was deleted. + // + + splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore == NULL) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Exiting from the " + << "inner loop with split store [" << resource + << "] destroyed.\n" << logofs_flush; + #endif + + break; + } + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Completed handling splits " + << "for store [" << resource << "] with " << bytes + << " bytes still to send.\n" << logofs_flush; + #endif + + // + // Check if there is still a split to + // send for the store just processed. + // + + handleSplitPending(resource); + } + } + + #if defined(TEST) || defined(SPLIT) + + if (splits == 0) + { + #ifdef PANIC + *logofs << "handleSplit: PANIC! Function called but " + << "no split message was sent.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + + *logofs << "handleSplit: SPLIT! Sent " << splits + << " splits and " << total - bytes << " bytes for FD#" << fd_ + << " with " << clientStore_ -> getSplitTotalStorageSize() + << " bytes and [" << clientStore_ -> getSplitTotalSize() + << "] splits remaining.\n" << logofs_flush; + + *logofs << "handleSplit: SPLIT! The pending split flag is " + << splitState_.pending << " with " << clientStore_ -> + getSplitTotalSize() << " splits in the split stores.\n" + << logofs_flush; + + clientStore_ -> dumpSplitStores(); + + #endif + + return 1; +} + +int ClientChannel::handleSplitSend(EncodeBuffer &encodeBuffer, int resource, + int &splits, int &bytes) +{ + #if defined(TEST) || defined(SPLIT) + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + Split *splitMessage = splitStore -> getFirstSplit(); + + if (splitStore -> getResource() != resource || + splitMessage -> getResource() != resource) + { + #ifdef PANIC + *logofs << "handleSplitSend: PANIC! The resource doesn't " + << "match the split store.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + *logofs << "handleSplitSend: SPLIT! Sending message " + << "OPCODE#" << (unsigned) opcodeStore_ -> splitData + << " for resource " << splitMessage -> getResource() + << " with request " << splitMessage -> getRequest() + << " position " << splitMessage -> getPosition() + << " and " << bytes << " bytes to write.\n" + << logofs_flush; + #endif + + // + // Use a special opcode to signal the other + // side this is part of a split and not a + // new message. + // + + encodeBuffer.encodeOpcodeValue(opcodeStore_ -> splitData, + clientCache_ -> opcodeCache); + + encodeBuffer.encodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + int result = clientStore_ -> getSplitStore(resource) -> + send(encodeBuffer, bytes); + + if (result < 0) + { + #ifdef PANIC + *logofs << "handleSplit: PANIC! Error sending splits for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Error sending splits for FD#" + << fd_ << ".\n"; + + return -1; + } + + // + // Get the bits written and update the + // statistics for this special opcode. + // + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(SPLIT)|| defined(OPCODES) + *logofs << "handleSplitSend: SPLIT! Handled request OPCODE#" + << (unsigned int) opcodeStore_ -> splitData << " (" + << DumpOpcode(opcodeStore_ -> splitData) << ")" << " for FD#" + << fd_ << " sequence none. 0 bytes in, " << bits << " bits (" + << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; + #endif + + statistics -> addRequestBits(opcodeStore_ -> splitData, 0, bits); + + bytes -= bits >> 3; + + splits++; + + if (result == 1) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitSend: SPLIT! Split at the head " + << "of the list was completely transferred.\n" + << logofs_flush; + #endif + + // + // The split at the head of the list was + // completely transferred. + // + + handleRestart(sequence_deferred, resource); + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleSplitSend: SPLIT! More data to send " + << "for the split at the head of the list.\n" + << logofs_flush; + } + #endif + + return result; +} + +int ClientChannel::handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum) +{ + // + // Send the checksum only if the loading + // or the saving of the message to the + // persistent image cache is enabled. + // + + if ((control -> ImageCacheEnableLoad == 1 || + control -> ImageCacheEnableSave == 1) && + (enableLoad_ == 1 || enableSave_ == 1)) + { + encodeBuffer.encodeBoolValue(1); + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + encodeBuffer.encodeValue((unsigned int) checksum[i], 8); + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitChecksum: SPLIT! Sent checksum " + << "[" << DumpChecksum(checksum) << "].\n" + << logofs_flush; + #endif + + return 1; + } + else + { + encodeBuffer.encodeBoolValue(0); + + return 0; + } +} + +void ClientChannel::handleSplitPending() +{ + #if defined(TEST) || defined(SPLIT) + + int previous = splitState_.pending; + + #endif + + if (clientStore_ -> getSplitTotalSize() == 0) + { + splitState_.pending = 0; + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitPending: SPLIT! Set the pending " + << "split flag to " << splitState_.pending + << " with split stores empty.\n" + << logofs_flush; + #endif + } + else + { + // + // Loop through the stores to find if + // there is any split that has become + // ready. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitPending: WARNING! SPLIT! Looping to " + << "find if there is any split pending.\n" + << logofs_flush; + #endif + + splitState_.pending = 0; + + T_list &splitList = splitResources_.getList(); + + for (T_list::iterator j = splitList.begin(); + j != splitList.end(); j++) + { + int resource = *j; + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore != NULL) + { + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpSplitStore(resource); + + #endif + + Split *splitMessage = splitStore -> getFirstSplit(); + + if (splitMessage != NULL && canSendSplit(splitMessage) == 1) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitPending: SPLIT! Found a pending " + << "split in store [" << resource << "].\n" + << logofs_flush; + #endif + + splitState_.pending = 1; + + #if defined(TEST) || defined(SPLIT) + + if (splitMessage -> getState() == split_loaded) + { + *logofs << "handleSplitPending: PANIC! SPLIT! Found a " + << "loaded split in store [" << resource + << "].\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + break; + } + } + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitPending: SPLIT! Set the pending " + << "split flag to " << splitState_.pending + << " with " << clientStore_ -> getSplitTotalSize() + << " splits in the split stores.\n" + << logofs_flush; + #endif + } + + #if defined(TEST) || defined(SPLIT) + + if (splitState_.pending != previous) + { + *logofs << "handleSplitPending: SPLIT! Pending state " + << "changed from " << previous << " to " + << splitState_.pending << ".\n" + << logofs_flush; + } + + #endif +} + +int ClientChannel::handleSplitEvent(EncodeBuffer &encodeBuffer, Split *splitMessage) +{ + SplitStore *splitStore; + + int resource = splitMessage -> getResource(); + + #if defined(TEST) || defined(INFO) + + splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore == NULL) + { + #ifdef PANIC + *logofs << "handleSplitEvent: PANIC! The split store can't " + << "be NULL handling abort splits.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + else if (splitMessage -> getState() != split_loaded) + { + *logofs << "handleSplitEvent: PANIC! Can't find the split " + << "to be aborted.\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Send any split that it is possible to + // abort until the store is either empty + // or the next split can't be aborted. + // + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + while ((splitStore = clientStore_ -> + getSplitStore(resource)) != NULL && + (splitMessage = splitStore -> getFirstSplit()) != NULL && + splitMessage -> getState() == split_loaded) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Aborting split with " + << "checksum [" << DumpChecksum(splitMessage -> + getChecksum()) << "] for resource " << resource + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + int any = 0; + + if (handleSplitSend(encodeBuffer, resource, any, any) < 0) + { + return -1; + } + } + + #if defined(TEST) || defined(SPLIT) + + if ((splitStore = clientStore_ -> + getSplitStore(resource)) == NULL) + { + *logofs << "handleSplitEvent: SPLIT! The split store [" + << resource << "] has been destroyed.\n" + << logofs_flush; + } + else if ((splitMessage = splitStore -> + getFirstSplit()) == NULL) + { + *logofs << "handleSplitEvent: SPLIT! The split store [" + << resource << "] is empty.\n" + << logofs_flush; + } + else if (splitMessage -> getState() != split_loaded) + { + *logofs << "handleSplitEvent: SPLIT! The split at the " + << "head of store [" << resource << "] doesn't " + << "need to be aborted.\n" << logofs_flush; + } + + #endif + + return 1; +} + +int ClientChannel::handleSplitEvent(DecodeBuffer &decodeBuffer) +{ + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Handling abort " + << "split messages for FD#" << fd_ << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + // Since ProtoStep7 (#issue 108) + + // + // Decode the information about the + // message to be updated. + // + + unsigned char resource; + + decodeBuffer.decodeCachedValue(resource, 8, + serverCache_ -> resourceCache); + + unsigned int loaded; + + decodeBuffer.decodeBoolValue(loaded); + + unsigned char request; + unsigned int size; + + if (loaded == 1) + { + decodeBuffer.decodeOpcodeValue(request, serverCache_ -> abortOpcodeCache); + + decodeBuffer.decodeValue(size, 32, 14); + } + else + { + request = 0; + size = 0; + } + + unsigned int value; + + md5_byte_t checksum[MD5_LENGTH]; + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + decodeBuffer.decodeValue(value, 8); + + checksum[i] = (unsigned char) value; + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Checking split " + << "with checksum [" << DumpChecksum(checksum) + << "] loaded " << loaded << " request " << (unsigned int) + request << " compressed size " << size << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + Split *splitMessage = handleSplitFind(checksum, resource); + + if (splitMessage != NULL) + { + if (loaded == 1) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Marked split with " + << "checksum [" << DumpChecksum(checksum) << "] " + << "as [loaded] at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + splitMessage -> setState(split_loaded); + + #if defined(TEST) || defined(SPLIT) + + if (splitMessage -> compressedSize() != (int) size) + { + *logofs << "handleSplitEvent: WARNING! SPLIT! Updating " + << "compressed data size from " << splitMessage -> + compressedSize() << " to " << size << ".\n" + << logofs_flush; + } + + #endif + + splitMessage -> compressedSize(size); + + // + // The splits to be aborted are checked by the split + // store at the time we are going to send a new chunk + // of split data. The splits must be strictly handled + // in the same order as they were added to the split + // store and the split we want to abort here may be + // not at the head of the list. + // + + if (splitMessage == clientStore_ -> + getSplitStore(resource) -> getFirstSplit()) + { + // + // We don't need to flush this packet immediately. + // The abort can be sent at any time to the remote + // proxy. What's important is that we restart the + // agent resource as soon as possible. + // + + #if defined(TEST) || defined(SPLIT) + + T_timestamp startTs = getTimestamp(); + + *logofs << "handleSplitEvent: SPLIT! Encoding abort " + << "split events for FD#" << fd_ << " with " + << "resource " << (unsigned) resource << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) + { + return -1; + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Spent " + << diffTimestamp(startTs, getTimestamp()) << " Ms " + << "handling abort split events for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + // + // Check if we can clear the pending flag. + // + + handleSplitPending(); + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleSplitEvent: WARNING! SPLIT! Abort split " + << "event not sent because not at the head " + << "of the list.\n" << logofs_flush; + } + #endif + } + else + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Marked split with " + << "checksum [" << DumpChecksum(checksum) << "] " + << "as [missed] at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + splitMessage -> setState(split_missed); + + // + // Check if we can set the pending flag. + // + + handleSplitPending(resource); + } + } + else + { + // + // The split report came after the split was already + // sent or the split store deleted. If the message + // had been loaded from disk by the remote side, we + // need to update the compressed size in our message + // store or the checksum will not match at the time + // we will try to save the message store on disk. + // + + if (loaded == 1 && size != 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: WARNING! SPLIT! Can't find " + << "the split. Updating in the message store.\n" + << logofs_flush; + #endif + + MessageStore *store = clientStore_ -> getRequestStore(request); + + if (store != NULL) + { + store -> updateData(checksum, size); + } + #if defined(TEST) || defined(SPLIT) + else + { + #ifdef PANIC + *logofs << "handleSplitEvent: PANIC! The message store " + << "can't be null.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + #endif + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleSplitEvent: WARNING! SPLIT! No need to " + << "update the store with loaded " << loaded + << " and compressed size " << size << ".\n" + << logofs_flush; + } + #endif + } + + return 1; +} + +Split *ClientChannel::handleSplitFind(T_checksum checksum, int resource) +{ + // + // It can be that we handled all the splits, + // restarted the resource and deleted the + // store before the event could even reach + // our side. + // + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore != NULL) + { + Split *splitMessage; + + T_splits *splitList = splitStore -> getSplits(); + + for (T_splits::iterator i = splitList -> begin(); + i != splitList -> end(); i++) + { + splitMessage = (*i); + + if (splitMessage -> getChecksum() != NULL) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitFind: SPLIT! Comparing with message [" + << DumpChecksum(splitMessage -> getChecksum()) + << "].\n" << logofs_flush; + #endif + + if (memcmp(checksum, splitMessage -> getChecksum(), MD5_LENGTH) == 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitFind: SPLIT! Located split for " + << "checksum [" << DumpChecksum(checksum) << "] " + << "in store [" << splitStore -> getResource() + << "].\n" << logofs_flush; + #endif + + return splitMessage; + } + } + } + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleSplitFind: WARNING! SPLIT! The split store " + << "was already deleted.\n" << logofs_flush; + } + #endif + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitFind: WARNING! SPLIT! Can't find the " + << "split for checksum [" << DumpChecksum(checksum) + << "].\n" << logofs_flush; + #endif + + return NULL; +} + +int ClientChannel::handleRestart(T_sequence_mode mode, int resource) +{ + // + // The agent must send a start-split message, followed by the + // X messages that may be optionally split by the proxy. Usu- + // ally, in the middle of a start-split/end-split sequence is + // a single PutImage() or PutPackedImage(), that, in turn, + // can generate multiple partial requests, like a SetUnpack- + // Colormap() and SetUnpackAlpha() followed by the image that + // must be transferred. Multiple requests may be also genera- + // ted because the maximum size of a X request has been exce- + // eded, so that Xlib has divided the single image in multi- + // ple sub-image requests. The agent doesn't need to take care + // of that, except tracking the result of the split operation. + // + // By monitoring the notify events sent by the proxy, the + // agent will have to implement its own strategy to deal with + // its resources (for example its clients). For example: + // + // - It will issue a new image request and suspend a client + // if the image was not entirely sent in the main X oputput + // stream. + // + // - It will choose to commit or discard the messages after + // they are recomposed at the remote side. The set of mes- + // sages that will have to be committed will include all + // messages that were part of the split (the colormap, the + // alpha channel). + // + // - It will restart its own client, in the case it had been + // suspended. + // + // A more useful strategy would be to replace the original im- + // age with a tiny 'placeholder' if a split took place, and + // synchronize the content of the drawable at later time. This + // is generally referred as 'lazy encoding'. + // + // The agent will be able to identify the original split ope- + // ration (the one marked with the start-spit) by the small + // integer number (0-255) referred to as the 'resource' field. + // + // Before the proxy will be able to report the status of the + // split, the agent will have to close the sequence by issueing + // an end-split. The proxy will then report the result of the + // operation, so that the agent will have the option of suspend- + // ing the client or marking the drawable as dirty and take + // care of synchronizing it at later time. + // + // One of the following cases may be encountered: + // + // notify_no_split: All messages were sent in the main out- + // put stream, so that no split actually + // took place. + // + // notify_start_split: One or more messages were split, so, + // at discrection of the agent, the client + // may be suspended until the transferral + // is completed. + // + // notify_commit_split: One of the requests that made up the + // split was recomposed. The agent should + // either commit the given request or tell + // the proxy to discard it. + // + // notify_end_split: The split was duly completed. The agent + // can restart the client. + // + // notify_empty_split: No more split operation are pending. + // The agent can use this information to + // implement specific strategies requiring + // that all messages have been recomposed + // at the remote end, like updating the + // drawables that were not synchronized + // because of the lazy encoding. + // + // By checking the split and commit store we can determine if we + // need to send a new notification event to the agent. There can + // be four different cases: + // + // - If the split store is not null and not empty, we are still + // in the middle of a split. + // + // - If the commit store is not empty, we completely recomposed + // a full message and can send a new commit notify. + // + // - If the split store has become empty, we recomposed all the + // messages added for the given resource, and so will be able + // to restart the resource. + // + // - If no more messages are in the split stores, we can notify + // an empty split event to the agent. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Handling [" + << (mode == sequence_immediate ? "immediate" : "deferred") + << "] restart events for resource " << resource << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (mode == sequence_immediate) + { + // + // We have received an end-split request. If the store + // was not deleted already, we mark the last split added + // as the one ending the row for this resource. If the + // commit() function returns 0 it means that the split + // store is either empty or that we did not add any split + // for this resource. This is because when connected to + // an old proxy version we only have a single store for + // all the resources. + // + // It can happen that all the split messages that were + // originally appended to the list were completely sent + // before our client had the chance of ending the split + // sequence. In this case the split store will be empty + // or already deleted and so we will be able to restart + // the resource. + // + + #if defined(TEST) || defined(SPLIT) + + if (splitStore == NULL) + { + *logofs << "handleRestart: WARNING! SPLIT! Split store [" + << resource << "] was already deleted.\n" + << logofs_flush; + } + else + { + clientStore_ -> dumpSplitStore(resource); + } + + #endif + + if (splitStore == NULL || splitStore -> getSize() == 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Immediate agent split event " + << "TYPE#" << (unsigned) opcodeStore_ -> noSplitNotify + << " [no split] with resource " << resource + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + if (handleNotify(notify_no_split, sequence_immediate, + resource, nothing, nothing) < 0) + { + return -1; + } + } + else + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Immediate agent split event " + << "TYPE#" << (unsigned) opcodeStore_ -> startSplitNotify + << " [start split] with resource " << resource + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + if (handleNotify(notify_start_split, sequence_immediate, + resource, nothing, nothing) < 0) + { + return -1; + } + } + } + else + { + // + // We have completely transferred a message + // that was put in the split store. + // + // The id of the resource can be different + // than the index of the store if we are + // connected to an old proxy. + // + + #if defined(TEST) || defined(SPLIT) + + if (splitStore == NULL) + { + #ifdef PANIC + *logofs << "handleRestart: PANIC! The split store can't " + << "be NULL handling deferred restart events.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + else + { + clientStore_ -> dumpSplitStore(resource); + } + + #endif + + CommitStore *commitStore = clientStore_ -> getCommitStore(); + + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpCommitStore(); + + #endif + + // + // Check if there is any commit to notify. + // + + Split *split; + + T_splits *commitList = commitStore -> getSplits(); + + for (T_splits::iterator i = commitList -> begin(); + i != commitList -> end(); i++) + { + split = *i; + + if (split -> getState() != split_notified) + { + #if defined(TEST) || defined(SPLIT) + + if (split -> getResource() != resource) + { + #ifdef PANIC + *logofs << "handleSplitSend: PANIC! The resource doesn't " + << "match the split store.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + #endif + + int request = split -> getRequest(); + int position = split -> getPosition(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Deferred agent split event " + << "TYPE#" << (unsigned) opcodeStore_ -> commitSplitNotify + << " [commit split] with resource " << resource << " request " + << request << " position " << position << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + if (handleNotify(notify_commit_split, sequence_deferred, + resource, request, position) < 0) + { + return -1; + } + + // + // Don't send the notification again. + // + + split -> setState(split_notified); + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleRestart: SPLIT! Split for request " + << split -> getRequest() << " and position " + << split -> getPosition() << " was already " + << "notified.\n" << logofs_flush; + } + #endif + } + + // + // Don't send the end split if we are still + // in the middle of a start-split/end-split + // sequence. We'll send a no-split at the + // time the end-split is received. + // + + if (splitStore -> getSize() == 0 && + splitStore -> getResource() != splitState_.resource) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Deferred agent split event " + << "TYPE#" << (unsigned) opcodeStore_ -> endSplitNotify + << " [end split] with resource " << resource << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + if (handleNotify(notify_end_split, sequence_deferred, + resource, nothing, nothing) < 0) + { + return -1; + } + } + #if defined(TEST) || defined(SPLIT) + else if (splitStore -> getSize() == 0 && + splitStore -> getResource() == splitState_.resource) + { + *logofs << "handleRestart: SPLIT! WARNING! The split store " + << "for resource " << resource << " was emptied in the " + << "split sequence at " << strMsTimestamp() << ".\n" + << logofs_flush; + } + #endif + } + + // + // Remove the split store if it's empty. + // + + if (splitStore != NULL && splitStore -> getSize() == 0 && + splitStore -> getResource() != splitState_.resource) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Removing the split store [" + << resource << "] at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + handleSplitStoreRemove(&splitResources_, resource); + + if (clientStore_ -> getSplitTotalSize() == 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! Deferred agent split event " + << "TYPE#" << (unsigned) opcodeStore_ -> emptySplitNotify + << " [empty split] for FD#" << fd_ << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + if (handleNotify(notify_empty_split, sequence_deferred, + nothing, nothing, nothing) < 0) + { + return -1; + } + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleRestart: SPLIT! There are " << clientStore_ -> + getSplitTotalSize() << " messages and " << clientStore_ -> + getSplitTotalStorageSize() << " bytes to send in " + << "the split stores.\n" << logofs_flush; + + if ((clientStore_ -> getSplitTotalSize() != 0 && + clientStore_ -> getSplitTotalStorageSize() == 0) || + (clientStore_ -> getSplitTotalSize() == 0 && + clientStore_ -> getSplitTotalStorageSize() != 0)) + { + #ifdef PANIC + *logofs << "handleRestart: PANIC! Inconsistency detected " + << "while handling the split stores.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + + #endif + } + + return 1; +} + +int ClientChannel::handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer, + unsigned int &size) +{ + // + // Test the efficiency of the encoding + // without these RENDER requests. + // + + if (opcode == opcodeStore_ -> renderExtension && + (*(buffer + 1) == X_RenderCompositeGlyphs8 || + *(buffer + 1) == X_RenderCompositeGlyphs16 || + *(buffer + 1) == X_RenderCompositeGlyphs32 || + *(buffer + 1) == X_RenderAddGlyphs || + *(buffer + 1) == X_RenderTrapezoids)) + { + #ifdef TEST + *logofs << "handleTaintLameRequest: Tainting request " + << "OPCODE#" << (unsigned int) opcode << " MINOR#" + << (unsigned int) *(buffer + 1) << " for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + opcode = X_NoOperation; + + return 1; + } + + return 0; +} + +int ClientChannel::handleTaintSyncRequest(unsigned char &opcode, const unsigned char *&buffer, + unsigned int &size) +{ + // + // Should short-circuit other common replies + // whose values could be queried only once. + // Examples are X_InterAtom, X_ListExtension + // and X_QueryExtension. + // + + if (taintCounter_ >= control -> TaintThreshold) + { + #ifdef DEBUG + *logofs << "handleTaintSyncRequest: Reset taint counter after " + << taintCounter_ << " replies managed.\n" + << logofs_flush; + #endif + + taintCounter_ = 0; + + return 0; + } + + // + // Check if we are rolling the counter. + // The client sequence number has not + // been incremented yet in the loop. + // + + unsigned int sequence = (clientSequence_ + 1) & 0xffff; + + #ifdef DEBUG + *logofs << "handleTaintSyncRequest: Opcode is " << (unsigned) opcode + << " expected client sequence is " << sequence + << ".\n" << logofs_flush; + #endif + + if (sequence == 0xffff) + { + return 0; + } + + unsigned short t1; + unsigned char t2; + + // + // Check if there is a previous reply + // pending. + // + + if (sequenceQueue_.peek(t1, t2) != 0) + { + #ifdef DEBUG + *logofs << "handleTaintSyncRequest: Skipping taint of reply due to " + << "pending request OPCODE#" << t1 << " with sequence " + << (unsigned int) t2 << ".\n" << logofs_flush; + #endif + + return 0; + } + + #ifdef DEBUG + *logofs << "handleTaintSyncRequest: Suppressing get input focus " + << "request for FD#" << fd_ << " with sequence " + << sequence << ".\n" << logofs_flush; + #endif + + unsigned char *reply = writeBuffer_.addMessage(32); + + *(reply + 0) = X_Reply; + + PutUINT(sequence, reply + 2, bigEndian_); + + PutULONG(0, reply + 4, bigEndian_); + + // + // Set revert-to to none. + // + + *(reply + 1) = 0; + + // + // Set focus to none. + // + + PutULONG(0, reply + 8, bigEndian_); + + // + // Save the sequence number, not incremented + // yet, we used to auto-generate this reply. + // + + lastSequence_ = clientSequence_ + 1; + + #ifdef TEST + *logofs << "handleTaintSyncRequest: Registered " << lastSequence_ + << " as last auto-generated sequence number.\n" + << logofs_flush; + #endif + + // + // Taint the request to a X_NoOperation. + // + + opcode = X_NoOperation; + + // + // We may assume that the client has finished + // drawing and flush immediately, even if this + // seems to perceively affect the performance. + // + // priority_++; + // + + if (handleFlush(flush_if_any) < 0) + { + return -1; + } + + taintCounter_++; + + return 1; +} + +int ClientChannel::handleTaintSyncError(unsigned char opcode) +{ + if (control -> TaintReplies > 0) + { + // + // By enabling short-circuiting of replies + // some window managers can get confused + // by some otherwise innocuous X errors. + // + + if (opcode == X_GrabKey || opcode == X_ReparentWindow || + opcode == X_ConfigureWindow) + { + #if defined(TEST) || defined(OPCODES) + *logofs << "handleTaintSyncError: WARNING! Suppressed error " + << "on OPCODE#" << (unsigned int) opcode << " for FD#" + << fd_ << " sequence " << lastSequence_ << " (real was " + << serverSequence_ << ").\n" << logofs_flush; + #endif + + return 1; + } + } + + return 0; +} + +int ClientChannel::handleNotify(T_notification_type type, T_sequence_mode mode, + int resource, int request, int position) +{ + if (finish_ == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleNotify: Discarding notification on " + << "channel for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + // + // Add a new message to the write buffer. + // + + unsigned char *event = writeBuffer_.addMessage(32); + + // + // Event is ClientMessage, atom and + // window are 0, format is 32. + // + + *(event + 0) = ClientMessage; + + PutULONG(0, event + 4, bigEndian_); + PutULONG(0, event + 8, bigEndian_); + + *(event + 1) = 32; + + // + // If the event follows immediately the request (that is the + // sequence mode is 'immediate') then the sequence number is + // the one of the last request, else it should be the last + // sequence number encoded by peer proxy but, as we are ins- + // erting events in the stream, we must ensure that the se- + // quence we send is not less than the last sequence we have + // auto-generated. + // + + if (mode == sequence_immediate) + { + // + // Save the sequence number we used + // to auto-generate this event. + // + + lastSequence_ = clientSequence_; + + #if defined(TEST) || defined(INFO) + *logofs << "handleNotify: Registered " << lastSequence_ + << " as last auto-generated sequence number.\n" + << logofs_flush; + #endif + } + else + { + if (serverSequence_ > lastSequence_) + { + #ifdef DEBUG + *logofs << "handleNotify: Updating last event's sequence " + << lastSequence_ << " to X server's sequence number " + << serverSequence_ << " for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + lastSequence_ = serverSequence_; + } + #ifdef DEBUG + else if (serverSequence_ < lastSequence_) + { + // + // Use our last auto-generated sequence. + // + + *logofs << "handleNotify: Tainting sequence number " + << serverSequence_ << " to last event's sequence " + << lastSequence_ << " for FD#" << fd_ << ".\n" + << logofs_flush; + } + #endif + } + + PutUINT(lastSequence_, event + 2, bigEndian_); + + // + // Be sure we set to void the fields that + // are not significant for the specific + // notification message. + // + + PutULONG(nothing, event + 16, bigEndian_); + PutULONG(nothing, event + 20, bigEndian_); + PutULONG(nothing, event + 24, bigEndian_); + + switch (type) + { + case notify_no_split: + { + PutULONG(opcodeStore_ -> noSplitNotify, + event + 12, bigEndian_); + + PutULONG(resource, event + 16, bigEndian_); + + break; + } + case notify_start_split: + { + PutULONG(opcodeStore_ -> startSplitNotify, + event + 12, bigEndian_); + + PutULONG(resource, event + 16, bigEndian_); + + break; + } + case notify_commit_split: + { + PutULONG(opcodeStore_ -> commitSplitNotify, + event + 12, bigEndian_); + + PutULONG(resource, event + 16, bigEndian_); + + PutULONG(request, event + 20, bigEndian_); + + PutULONG(position, event + 24, bigEndian_); + + break; + } + case notify_end_split: + { + PutULONG(opcodeStore_ -> endSplitNotify, + event + 12, bigEndian_); + + PutULONG(resource, event + 16, bigEndian_); + + break; + } + case notify_empty_split: + { + PutULONG(opcodeStore_ -> emptySplitNotify, + event + 12, bigEndian_); + break; + } + default: + { + #ifdef PANIC + *logofs << "handleNotify: PANIC! Unrecognized notify " + << "TYPE#" << type << ".\n" + << logofs_flush; + #endif + + return -1; + } + } + + #if defined(TEST) || defined(INFO) || defined (SPLIT) + + *logofs << "handleNotify: Sending " + << (mode == sequence_immediate ? "immediate " : "deferred ") + << "agent notify event TYPE#" << GetULONG(event + 12, bigEndian_) + << logofs_flush; + + if (resource != nothing) + { + *logofs << " with resource " << GetULONG(event + 16, bigEndian_) + << logofs_flush; + + if (request != nothing && position != nothing) + { + *logofs << " request " << GetULONG(event + 20, bigEndian_) + << " position " << GetULONG(event + 24, bigEndian_) + << logofs_flush; + } + } + + *logofs << ".\n" << logofs_flush; + + #endif + + // + // Send the notification now. + // + + if (handleFlush(flush_if_any) < 0) + { + return -1; + } + + return 1; +} + +int ClientChannel::handleCommitSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + // + // Get the data of the request to be + // committed. + // + + unsigned char request = *(buffer + 5); + + MessageStore *store = clientStore_ -> getRequestStore(request); + + if (store == NULL) + { + #ifdef PANIC + *logofs << "handleCommitSplitRequest: PANIC! Can't commit split for " + << "request OPCODE#" << (unsigned int) request + << ". No message store found.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't commit split for request " + << "OPCODE#" << (unsigned int) request + << ". No message store found.\n"; + + return -1; + } + + // + // The position in cache of the message + // to commit. Encode it as difference in + // respect to the last encoded value. + // + + unsigned int position = GetULONG(buffer + 8, bigEndian_); + + unsigned char resource = *(buffer + 1); + unsigned int commit = *(buffer + 4); + + #if defined(TEST) || defined(SPLIT) + + if (commit == 1) + { + *logofs << "handleCommitSplitRequest: SPLIT! Committing request " + << "OPCODE#" << (unsigned) request << " at position " + << position << " for FD#" << fd_ << " with resource " + << (unsigned) resource << ".\n" << logofs_flush; + } + else + { + *logofs << "handleCommitSplitRequest: SPLIT! Discarding request " + << "OPCODE#" << (unsigned) request << " at position " + << position << " for FD#" << fd_ << " with resource " + << (unsigned) resource << ".\n" << logofs_flush; + } + + #endif + + encodeBuffer.encodeOpcodeValue(request, clientCache_ -> opcodeCache); + + int diffCommit = position - splitState_.commit; + + splitState_.commit = position; + + encodeBuffer.encodeValue(diffCommit, 32, 5); + + // + // Send the resource id and the commit + // flag. + // + + encodeBuffer.encodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + encodeBuffer.encodeBoolValue(commit); + + // + // Remove the split from the split queue. + // + + Split *split = handleSplitCommitRemove(request, resource, splitState_.commit); + + if (split == NULL) + { + return -1; + } + + clientStore_ -> getCommitStore() -> update(split); + + // + // Free the split. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleCommitSplitRequest: SPLIT! Freeing up the " + << "committed split.\n" << logofs_flush; + #endif + + delete split; + + return 1; +} + +int ClientChannel::handleAbortSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + unsigned char resource = *(buffer + 1); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Handling abort split " + << "request for FD#"<< fd_ << " and resource " + << (unsigned int) resource << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore == NULL) + { + #ifdef WARNING + *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The split " + << "store [" << (unsigned int) resource << "] " + << "is already empty.\n" << logofs_flush; + #endif + + return 0; + } + + // + // Loop through the messages in the split + // store and discard from the memory cache + // the messages that are still incomplete. + // Then remove the message from the split + // store. + // + + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpSplitStore(resource); + + #endif + + int splits = 0; + + Split *splitMessage; + + for (;;) + { + splitMessage = splitStore -> getFirstSplit(); + + if (splitMessage == NULL) + { + // + // Check if we had created the store + // but no message was added yet. + // + + #ifdef WARNING + + if (splits == 0) + { + *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " + << "split store [" << (unsigned int) resource + << "] is unexpectedly empty.\n" + << logofs_flush; + } + + #endif + + break; + } + + // + // Splits already aborted can't be in the + // split store. + // + + #if defined(TEST) || defined(SPLIT) + + if (splitMessage -> getState() == split_aborted) + { + *logofs << "handleAbortSplitRequest: PANIC! SPLIT! Found an " + << "aborted split in store [" << (unsigned int) resource + << "].\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + if (splitMessage -> getAction() == IS_HIT) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Removing the " + << "split from the memory cache.\n" + << logofs_flush; + #endif + + splitMessage -> getStore() -> remove(splitMessage -> getPosition(), + use_checksum, discard_data); + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Removing the " + << "split from the split store.\n" + << logofs_flush; + #endif + + splitMessage = splitStore -> pop(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Freeing up the " + << "aborted split.\n" << logofs_flush; + #endif + + delete splitMessage; + + splits++; + } + + // + // If the start-split/end-split sequence + // was closed, send the notification now, + // else wait for the end-split. + // + + if (resource != splitState_.resource) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Sending the " + << "deferred [end split] event.\n" + << logofs_flush; + #endif + + handleRestart(sequence_deferred, resource); + } + #if defined(TEST) || defined(SPLIT) + else + { + *logofs << "handleAbortSplitRequest: WARNING! SPLIT! Still " + << "waiting for the closure of the split " + << "sequence.\n" << logofs_flush; + } + #endif + + // + // Check if there is any other store + // having splits to send. + // + + handleSplitPending(); + + return (splits > 0); +} + +int ClientChannel::handleFinishSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + unsigned char resource = *(buffer + 1); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleFinishSplitRequest: SPLIT! Handling finish split " + << "request for FD#"<< fd_ << " and resource " + << (unsigned int) resource << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + // + // We need to get the protocol statistics + // for the finish message we are handling + // here because sending a new split will + // reset the bits counter. + // + + int bits = encodeBuffer.diffBits(); + + statistics -> addRequestBits(opcode, size << 3, bits); + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore == NULL) + { + #ifdef WARNING + *logofs << "handleFinishSplitRequest: WARNING! SPLIT! The split " + << "store [" << (unsigned int) resource << "] " + << "is already empty.\n" << logofs_flush; + #endif + + return 0; + } + + // + // Send all the split queued for the given + // resource until the split store becomes + // empty. + // + + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpSplitStore(resource); + + #endif + + Split *splitMessage; + + int total = MESSAGE_DATA_LIMIT; + + int bytes = total; + int splits = 0; + + for (;;) + { + splitMessage = splitStore -> getFirstSplit(); + + if (splitMessage == NULL) + { + // + // We have presumably created the store + // after a start split but no message + // was added yet. + // + + #ifdef WARNING + *logofs << "handleFinishSplitRequest: WARNING! SPLIT! The " + << "split store [" << (unsigned int) resource + << "] is unexpectedly empty.\n" + << logofs_flush; + #endif + + break; + } + + // + // Splits already aborted can't be in the + // split store. + // + + #if defined(TEST) || defined(SPLIT) + + if (splitMessage -> getState() == split_aborted) + { + *logofs << "handleFinishSplitRequest: PANIC! SPLIT! Found an " + << "aborted split in store [" << (unsigned int) resource + << "].\n" << logofs_flush; + + HandleCleanup(); + } + + *logofs << "handleFinishSplitRequest: SPLIT! Sending more " + << "data for store [" << (unsigned int) resource + << "].\n" << logofs_flush; + #endif + + if (handleSplitSend(encodeBuffer, resource, splits, bytes) < 0) + { + return -1; + } + + // + // Check if the split store was deleted. + // + + if (clientStore_ -> getSplitStore(resource) == NULL) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleFinishSplitRequest: SPLIT! Exiting " + << "from the finish loop with split store [" + << (unsigned int) resource << "] destroyed.\n" + << logofs_flush; + #endif + + break; + } + } + + // + // Check if there is any other store + // having splits to send. + // + + handleSplitPending(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleFinishSplitRequest: SPLIT! Sent " << splits + << " splits and " << total - bytes << " bytes for FD#" << fd_ + << " with " << clientStore_ -> getSplitTotalStorageSize() + << " bytes and [" << clientStore_ -> getSplitTotalSize() + << "] splits remaining.\n" << logofs_flush; + #endif + + return (splits > 0); +} + +int ClientChannel::handleConfiguration() +{ + #ifdef TEST + *logofs << "ClientChannel: Setting new buffer parameters.\n" + << logofs_flush; + #endif + + readBuffer_.setSize(control -> ClientInitialReadSize, + control -> ClientMaximumBufferSize); + + writeBuffer_.setSize(control -> TransportXBufferSize, + control -> TransportXBufferThreshold, + control -> TransportMaximumBufferSize); + + transport_ -> setSize(control -> TransportXBufferSize, + control -> TransportXBufferThreshold, + control -> TransportMaximumBufferSize); + + return 1; +} + +int ClientChannel::handleFinish() +{ + #ifdef TEST + *logofs << "ClientChannel: Finishing channel for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + congestion_ = 0; + priority_ = 0; + + finish_ = 1; + + taintCounter_ = 0; + + splitState_.resource = nothing; + splitState_.pending = 0; + splitState_.commit = 0; + splitState_.mode = split_none; + + transport_ -> finish(); + + return 1; +} + +// +// If differential compression is disabled then use the +// most simple encoding but handle the image requests +// and the X_ListExtensions and X_QueryExtension messa- +// ges (needed to detect the opcode of the shape or the +// other extensions) in the usual way. +// + +int ClientChannel::handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsigned char &opcode, + const unsigned char *&buffer, const unsigned int &size) +{ + // + // All the NX requests are handled in the + // main message loop. The X_PutImage can + // be handled here only if the split was + // not requested (since ProtoStep7 #issue 108). + // + + if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || + (opcode == X_PutImage && splitState_.resource != nothing) || + opcode == X_ListExtensions || + opcode == X_QueryExtension) + { + return 0; + } + + #ifdef DEBUG + *logofs << "handleFastReadRequest: Encoding raw request OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << " with size " << size << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeMemory(buffer, size); + + // + // Put request on the fast track + // if it needs a reply. + // + + switch (opcode) + { + case X_GetAtomName: + case X_GetGeometry: + case X_GetInputFocus: + case X_GetModifierMapping: + case X_GetKeyboardMapping: + case X_GetProperty: + case X_GetSelectionOwner: + case X_GrabPointer: + case X_GrabKeyboard: + case X_ListExtensions: + case X_ListFonts: + case X_LookupColor: + case X_AllocNamedColor: + case X_QueryPointer: + case X_GetWindowAttributes: + case X_QueryTree: + case X_QueryBestSize: + case X_QueryColors: + case X_QueryFont: + case X_TranslateCoords: + case X_GetImage: + case X_GetPointerMapping: + case X_GetKeyboardControl: + case X_InternAtom: + case X_AllocColor: + { + sequenceQueue_.push(clientSequence_, opcode); + + priority_++; + + break; + } + default: + { + break; + } + } + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + + *logofs << "handleFastReadRequest: Handled raw request OPCODE#" + << (unsigned int) opcode << " (" << DumpOpcode(opcode) << ")" + << " for FD#" << fd_ << " sequence " << clientSequence_ + << ". " << size << " bytes in, " << bits << " bits (" + << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; + + #endif + + statistics -> addRequestBits(opcode, size << 3, bits); + + if (opcode == opcodeStore_ -> renderExtension) + { + statistics -> addRenderRequestBits(*(buffer + 1), size << 3, bits); + } + + return 1; +} + +int ClientChannel::handleFastWriteReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + if ((opcode >= X_NXFirstOpcode && + opcode <= X_NXLastOpcode) || + opcode == X_ListExtensions || + opcode == X_QueryExtension) + { + return 0; + } + + #ifdef DEBUG + *logofs << "handleFastWriteReply: Decoding raw reply OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + buffer = writeBuffer_.addMessage(8); + + #ifndef __sun + + unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(8); + + *((unsigned int *) buffer) = *next++; + *((unsigned int *) (buffer + 4)) = *next; + + #else /* #ifndef __sun */ + + memcpy(buffer, decodeBuffer.decodeMemory(8), 8); + + #endif /* #ifndef __sun */ + + size = 32 + (GetULONG(buffer + 4, bigEndian_) << 2); + + writeBuffer_.registerPointer(&buffer); + + if (writeBuffer_.getAvailable() < size - 8 || + (int) size >= control -> TransportFlushBufferSize) + { + #ifdef DEBUG + *logofs << "handleFastWriteReply: Using scratch buffer for OPCODE#" + << (unsigned int) opcode << " with size " << size << " and " + << writeBuffer_.getLength() << " bytes in buffer.\n" + << logofs_flush; + #endif + + writeBuffer_.removeMessage(8); + + buffer = writeBuffer_.addScratchMessage(((unsigned char *) + decodeBuffer.decodeMemory(size - 8)) - 8, size); + } + else + { + writeBuffer_.addMessage(size - 8); + + #ifndef __sun + + if (size == 32) + { + next = (unsigned int *) decodeBuffer.decodeMemory(size - 8); + + for (int i = 8; i < 32; i += sizeof(unsigned int)) + { + *((unsigned int *) (buffer + i)) = *next++; + } + } + else + { + memcpy(buffer + 8, decodeBuffer.decodeMemory(size - 8), size - 8); + } + + #else /* #ifndef __sun */ + + memcpy(buffer + 8, decodeBuffer.decodeMemory(size - 8), size - 8); + + #endif /* #ifndef __sun */ + } + + writeBuffer_.unregisterPointer(); + + // + // We don't need to write our local sequence + // number. Replies are always sent with the + // original X server's sequence number. + // + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleFastWriteReply: Handled raw reply OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " + << serverSequence_ << ". Output size is " << size << ".\n" + << logofs_flush; + #endif + + #ifdef DEBUG + *logofs << "handleFastWriteReply: Length of sequence queue is " + << sequenceQueue_.length() << ".\n" << logofs_flush; + #endif + + statistics -> addRepliedRequest(opcode); + + handleFlush(flush_if_needed); + + return 1; +} + +int ClientChannel::handleFastWriteEvent(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + #ifdef DEBUG + *logofs << "handleFastWriteEvent: Decoding raw " + << (opcode == X_Error ? "error" : "event") << " OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + size = 32; + + buffer = writeBuffer_.addMessage(size); + + #ifndef __sun + + unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(size); + + for (int i = 0; i < 32; i += sizeof(unsigned int)) + { + *((unsigned int *) (buffer + i)) = *next++; + } + + #else /* #ifndef __sun */ + + memcpy(buffer, decodeBuffer.decodeMemory(size), size); + + #endif /* #ifndef __sun */ + + // + // Use our local sequence number. + // + + PutUINT(lastSequence_, buffer + 2, bigEndian_); + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleFastWriteEvent: Handled raw " + << (opcode == X_Error ? "error" : "event") << " OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ << " with sequence " + << lastSequence_ << ". Output size is " << size << ".\n" + << logofs_flush; + #endif + + // + // Check if we need to suppress the error. + // + + if (opcode == X_Error && handleTaintSyncError(*(buffer + 10)) > 0) + { + #if defined(TEST) || defined(OPCODES) + *logofs << "handleFastWriteEvent: WARNING! Suppressed error OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << " with sequence " << lastSequence_ << ".\n" + << logofs_flush; + #endif + + writeBuffer_.removeMessage(32); + } + + handleFlush(flush_if_needed); + + return 1; +} + +int ClientChannel::handleShmemRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + // + // Will push sequence and set + // priority according to stage. + // + + unsigned int stage = *(buffer + 1); + + #ifdef TEST + *logofs << "handleShmemRequest: Encoding shmem request " + << "OPCODE#" << (unsigned int) opcode << " for FD#" + << fd_ << " with size " << size << " at stage " + << stage << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeValue(stage, 2); + + if (stage == 0) + { + unsigned int enableClient = 0; + unsigned int enableServer = 0; + + if (control -> ShmemClient == 1) + { + enableClient = *(buffer + 4); + } + + if (control -> ShmemServer == 1) + { + enableServer = *(buffer + 5); + } + + encodeBuffer.encodeBoolValue(enableClient); + encodeBuffer.encodeBoolValue(enableServer); + + unsigned int clientSegment = GetULONG(buffer + 8, bigEndian_); + unsigned int serverSegment = GetULONG(buffer + 12, bigEndian_); + + encodeBuffer.encodeValue(clientSegment, 29, 9); + encodeBuffer.encodeValue(serverSegment, 29, 9); + + #ifdef TEST + *logofs << "handleShmemRequest: Enable client is " + << enableClient << " enable server is " << enableServer + << " client segment is " << (void *) clientSegment + << " server segment is " << (void *) serverSegment + << ".\n" << logofs_flush; + #endif + + #ifdef TEST + *logofs << "handleShmemRequest: Size of the shared memory " + << "segment will be " << control -> ShmemServerSize + << ".\n" << logofs_flush; + #endif + } + + if (stage != 1) + { + sequenceQueue_.push(clientSequence_, opcodeStore_ -> + getShmemParameters); + + priority_++; + } + + return 1; +} + +int ClientChannel::handleShmemReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + #ifdef TEST + *logofs << "handleShmemReply: Received shmem parameters " + << "reply OPCODE#" << (unsigned int) opcode + << ".\n" << logofs_flush; + #endif + + size = 32; + buffer = writeBuffer_.addMessage(size); + + unsigned int stage; + + decodeBuffer.decodeValue(stage, 2); + + *(buffer + 1) = stage; + + if (stage == 2) + { + unsigned int clientEnabled; + unsigned int serverEnabled; + + decodeBuffer.decodeBoolValue(clientEnabled); + decodeBuffer.decodeBoolValue(serverEnabled); + + // + // Client support is not implemented + // and not useful. It is here only + // for compatibility. + // + + clientEnabled = 0; + + *(buffer + 8) = clientEnabled; + *(buffer + 9) = serverEnabled; + + PutULONG(0, buffer + 12, bigEndian_); + + if (serverEnabled == 1) + { + #ifdef TEST + *logofs << "handleShmemReply: Enabled shared memory " + << "support in X server with segment size " + << control -> ShmemServerSize << ".\n" + << logofs_flush; + #endif + + PutULONG(control -> ShmemServerSize, buffer + 16, bigEndian_); + } + else + { + PutULONG(0, buffer + 16, bigEndian_); + } + } + else + { + *(buffer + 8) = 0; + *(buffer + 9) = 0; + + PutULONG(0, buffer + 12, bigEndian_); + PutULONG(0, buffer + 16, bigEndian_); + } + + return 1; +} + +int ClientChannel::handleFontRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #ifdef TEST + *logofs << "handleFontRequest: Encoding font request " + << "OPCODE#" << (unsigned int) opcode << " for FD#" + << fd_ << " with size " << size << ".\n" + << logofs_flush; + #endif + + sequenceQueue_.push(clientSequence_, opcodeStore_ -> + getFontParameters); + + return 1; +} + +int ClientChannel::handleFontReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + #ifdef TEST + *logofs << "handleFontReply: Received font operation " + << "reply OPCODE#" << (unsigned int) opcode + << ".\n" << logofs_flush; + #endif + + unsigned int length; + + decodeBuffer.decodeValue(length, 8); + + size = 32 + RoundUp4(length + 1); + buffer = writeBuffer_.addMessage(size); + + unsigned char *next = buffer + 32; + + *next++ = length; + + decodeBuffer.decodeTextData(next, length); + + #ifdef TEST + + *logofs << "handleFontReply: Received tunneled font server " + << "path '"; + + for (unsigned int i = 0; i < length; i++) + { + *logofs << *(buffer + 32 + 1 + i); + } + + *logofs << "' for FD#" << fd_ << ".\n" << logofs_flush; + + #endif + + if (fontPort_ == -1) + { + // + // The local side is not going to forward + // the font server connections. + // + + #ifdef TEST + *logofs << "handleFontReply: WARNING! Returning an empty " + << "font server path.\n" << logofs_flush; + #endif + + writeBuffer_.removeMessage(size); + + size = 36; + buffer = writeBuffer_.addMessage(size); + + // + // Set the length of the returned + // path to 0. + // + + *(buffer + 32) = 0; + } + #ifdef TEST + else + { + *logofs << "handleFontReply: Returning the received " + << "font server path.\n" << logofs_flush; + } + #endif + + return 1; +} + +int ClientChannel::handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #ifdef TEST + *logofs << "handleCacheRequest: Handling cache request " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + enableCache_ = *(buffer + 4); + enableSplit_ = *(buffer + 5); + enableSave_ = *(buffer + 6); + enableLoad_ = *(buffer + 7); + + #ifdef TEST + *logofs << "handleCacheRequest: Set cache parameters to " + << " cache " << enableCache_ << " split " << enableSplit_ + << " save " << enableSave_ << " load " << enableLoad_ + << ".\n" << logofs_flush; + #endif + + // + // Encode all the parameters as a + // single unsigned int so we can + // use an int cache. + // + + unsigned int mask = enableSave_ << 8 | enableLoad_; + + encodeBuffer.encodeCachedValue(mask, 32, clientCache_ -> + setCacheParametersCache); + return 0; +} + +int ClientChannel::handleStartSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #if defined(TEST) || defined(SPLIT) + *logofs << "handleStartSplitRequest: SPLIT! Handling start split " + << "request for FD#"<< fd_ << ".\n" << logofs_flush; + #endif + + if (splitState_.resource != nothing) + { + #ifdef PANIC + *logofs << "handleStartSplitRequest: PANIC! SPLIT! Split requested " + << "for resource id " << (unsigned int) *(buffer + 1) + << " while handling resource " << splitState_.resource + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Split requested for " + << "resource id " << (unsigned int) *(buffer + 1) + << " while handling resource " << splitState_.resource + << ".\n"; + + return -1; + } + else if (fd_ != firstClient_) + { + // + // It can be that an auxiliary channel is the + // first to connect, then comes the agent that + // is actually using the NX opcodes. + // + + #ifdef WARNING + *logofs << "handleStartSplitRequest: WARNING SPLIT! Split requested " + << "on FD#" << fd_ << " while expecting FD#" << firstClient_ + << ".\n" << logofs_flush; + #endif + + firstClient_ = fd_; + } + + // + // Set the agent's resource for which we are + // going to split the request. + // + + splitState_.resource = *(buffer + 1); + + #if defined(TEST) || defined(SPLIT) + + *logofs << "handleStartSplitRequest: SPLIT! Registered id " + << splitState_.resource << " as resource " + << "waiting for a split.\n" << logofs_flush; + + if (clientStore_ -> getSplitStore(splitState_.resource) != NULL) + { + *logofs << "handleStartSplitRequest: WARNING! SPLIT! A split " + << "store for resource id " << splitState_.resource + << " already exists.\n" << logofs_flush; + + clientStore_ -> dumpSplitStore(splitState_.resource); + } + + #endif + + // + // Send the selected resource to the remote. + // + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeCachedValue(splitState_.resource, 8, + clientCache_ -> resourceCache); + + splitState_.mode = (T_split_mode) *(buffer + 4); + + if (splitState_.mode != NXSplitModeAsync && + splitState_.mode != NXSplitModeSync) + { + splitState_.mode = (T_split_mode) control -> SplitMode; + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleStartSplitRequest: SPLIT! Set split " + << "mode to '" << splitState_.mode << "' with " + << "provided value '" << (unsigned) *(buffer + 4) + << "'.\n" << logofs_flush; + #endif + } + + #if defined(TEST) || defined(SPLIT) + + if (splitState_.mode == NXSplitModeAsync) + { + *logofs << "handleStartSplitRequest: SPLIT! Selected split " + << "mode is [split_async].\n" << logofs_flush; + } + else if (splitState_.mode == NXSplitModeSync) + { + *logofs << "handleStartSplitRequest: SPLIT! Selected split " + << "mode is [split_sync].\n" << logofs_flush; + } + + clientStore_ -> dumpSplitStores(); + + #endif + + return 1; +} + +int ClientChannel::handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #if defined(TEST) || defined(SPLIT) + *logofs << "handleEndSplitRequest: SPLIT! Handling end split " + << "request for FD#"<< fd_ << ".\n" << logofs_flush; + #endif + + // + // Verify that the agent resource matches. + // + + if (splitState_.resource == nothing) + { + #ifdef PANIC + *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of " + << "split for resource id " << (unsigned int) *(buffer + 1) + << " without a previous start.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Received an end of split " + << "for resource id " << (unsigned int) *(buffer + 1) + << " without a previous start.\n"; + + return -1; + } + else if (splitState_.resource != *(buffer + 1)) + { + #ifdef PANIC + *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id " + << (unsigned int) *(buffer + 1) << " received while " + << "waiting for resource id " << splitState_.resource + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid resource id " + << (unsigned int) *(buffer + 1) << " received while " + << "waiting for resource id " << splitState_.resource + << ".\n"; + + return -1; + } + + // + // Send the selected resource to the remote. + // + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeCachedValue(splitState_.resource, 8, + clientCache_ -> resourceCache); + + // + // Send the split notification events + // to the agent. + // + + handleRestart(sequence_immediate, splitState_.resource); + + // + // Check if we still have splits to send. + // + + handleSplitPending(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleEndSplitRequest: SPLIT! Reset id " + << splitState_.resource << " as resource " + << "selected for splits.\n" << logofs_flush; + #endif + + splitState_.resource = nothing; + splitState_.mode = split_none; + + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpSplitStores(); + + #endif + + return 1; +} + +void ClientChannel::handleDecodeCharInfo(DecodeBuffer &decodeBuffer, unsigned char *nextDest) +{ + unsigned int value; + + decodeBuffer.decodeCachedValue(value, 32, + *serverCache_ -> queryFontCharInfoCache[0], 6); + + PutUINT(value & 0xffff, nextDest, bigEndian_); + PutUINT(value >> 16, nextDest + 10, bigEndian_); + + nextDest += 2; + + for (unsigned int i = 1; i < 5; i++) + { + unsigned int value; + + decodeBuffer.decodeCachedValue(value, 16, + *serverCache_ -> queryFontCharInfoCache[i], 6); + + PutUINT(value, nextDest, bigEndian_); + + nextDest += 2; + } +} + +int ClientChannel::setBigEndian(int flag) +{ + bigEndian_ = flag; + + return 1; +} + +int ClientChannel::setReferences() +{ + #ifdef TEST + *logofs << "ClientChannel: Initializing the static " + << "members for the client channels.\n" + << logofs_flush; + #endif + + #ifdef REFERENCES + + references_ = 0; + + #endif + + return 1; +} diff --git a/nxcomp/src/ClientChannel.h b/nxcomp/src/ClientChannel.h new file mode 100644 index 000000000..ae92648d5 --- /dev/null +++ b/nxcomp/src/ClientChannel.h @@ -0,0 +1,434 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ClientChannel_H +#define ClientChannel_H + +#include "List.h" +#include "Channel.h" + +#include "SequenceQueue.h" + +#include "ClientReadBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// If defined, the client channel will +// have the chance of suppressing more +// opcodes for test purposes. +// + +#undef LAME + +// +// Define this to log a line when a +// channel is created or destroyed. +// + +#undef REFERENCES + +// +// This class implements the X client +// side compression of the protocol. +// + +class ClientChannel : public Channel +{ + public: + + ClientChannel(Transport *transport, StaticCompressor *compressor); + + virtual ~ClientChannel(); + + virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length); + + virtual int handleWrite(const unsigned char *message, unsigned int length); + + virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, + T_store_action action, int position, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, + T_store_action action, int position, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) + { + return 0; + } + + virtual int handleSplit(EncodeBuffer &encodeBuffer); + + virtual int handleSplit(DecodeBuffer &decodeBuffer) + { + return 0; + } + + virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split); + + virtual int handleSplitEvent(DecodeBuffer &decodeBuffer); + + virtual int handleMotion(EncodeBuffer &encodeBuffer) + { + return 0; + } + + virtual int handleCompletion(EncodeBuffer &encodeBuffer) + { + return 0; + } + + virtual int handleConfiguration(); + + virtual int handleFinish(); + + virtual int handleAsyncEvents() + { + return 0; + } + + virtual int needSplit() const + { + #if defined(TEST) || defined(SPLIT) + *logofs << "needSplit: SPLIT! Returning pending split " + << "flag " << splitState_.pending << " with " + << clientStore_ -> getSplitTotalSize() + << " splits in the split stores.\n" + << logofs_flush; + #endif + + return splitState_.pending; + } + + virtual int needMotion() const + { + return 0; + } + + virtual T_channel_type getType() const + { + return channel_x11; + } + + int setBigEndian(int flag); + + // + // Initialize the static members. + // + + static int setReferences(); + + private: + + int handleFastReadRequest(EncodeBuffer &encodeBuffer, const unsigned char &opcode, + const unsigned char *&buffer, const unsigned int &size); + + int handleFastWriteReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + int handleFastWriteEvent(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Intercept the request before the opcode + // is encoded. + // + + int handleTaintRequest(unsigned char &opcode, const unsigned char *&buffer, + unsigned int &size) + { + if (control -> TaintReplies > 0 && + opcode == X_GetInputFocus) + { + return handleTaintSyncRequest(opcode, buffer, size); + } + + #ifdef LAME + + return handleTaintLameRequest(opcode, buffer, size); + + #endif + + return 0; + } + + int handleTaintLameRequest(unsigned char &opcode, const unsigned char *&buffer, + unsigned int &size); + + int handleTaintSyncRequest(unsigned char &opcode, const unsigned char *&buffer, + unsigned int &size); + + int handleTaintSyncError(unsigned char opcode); + + // + // How to handle sequence counter + // in notification event. + // + + enum T_sequence_mode + { + sequence_immediate, + sequence_deferred + }; + + // + // Send split notifications to the + // agent. + // + + int handleRestart(T_sequence_mode mode, int resource); + + int handleNotify(T_notification_type type, T_sequence_mode mode, + int resource, int request, int position); + + // + // Other utility functions used in + // handling of the image streaming. + // + + int mustSplitMessage(int resource) + { + return (clientStore_ -> getSplitStore(resource) -> + getSize() != 0); + } + + int canSplitMessage(T_split_mode mode, unsigned int size) + { + return ((int) size >= control -> SplitDataThreshold && + (clientStore_ -> getSplitTotalStorageSize() < control -> + SplitTotalStorageSize && clientStore_ -> + getSplitTotalSize() < control -> SplitTotalSize)); + } + + int canSendSplit(Split *split) + { + return (split -> getMode() != split_sync || + split -> getState() == split_missed || + split -> getState() == split_loaded); + } + + int handleSplitSend(EncodeBuffer &encodeBuffer, int resource, + int &total, int &bytes); + + Split *handleSplitFind(T_checksum checksum, int resource); + + int handleSplitChecksum(EncodeBuffer &encodeBuffer, T_checksum checksum); + + void handleSplitPending(int resource) + { + if (splitState_.pending == 0) + { + if (clientStore_ -> getSplitStore(resource) != NULL && + clientStore_ -> getSplitStore(resource) -> + getFirstSplit() != NULL) + { + splitState_.pending = canSendSplit(clientStore_ -> + getSplitStore(resource) -> getFirstSplit()); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitPending: SPLIT! Set the pending " + << "split flag to " << splitState_.pending + << " with " << clientStore_ -> getSplitTotalSize() + << " splits in the split stores.\n" + << logofs_flush; + #endif + } + } + } + + // + // Scan all the split stores to find + // if there is any split to send. + // + + void handleSplitPending(); + + // + // Handle the MIT-SHM initialization + // messages exchanged with the remote + // proxy. + // + + int handleShmemRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + int handleShmemReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Query the port used to tunnel + // the font server connections. + // + + int handleFontRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + int handleFontReply(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Let the agent set the cache + // policy for image requests. + // + + int handleCacheRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + // + // Encode the start and end split + // requests. + // + + int handleStartSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + int handleEndSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + // + // Empty a split store and send the + // restart event. + // + + int handleAbortSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + // + // Force the proxy to finalize all + // the pending split operations and + // restart a resource. + // + + int handleFinishSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + // + // Tell the remote peer to send the + // split requests to the X server. + // + + int handleCommitSplitRequest(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + // + // Other utilities. + // + + void handleDecodeCharInfo(DecodeBuffer &, unsigned char *); + + // + // Own read buffer. It is able to identify + // full messages read from the X descriptor. + // + + ClientReadBuffer readBuffer_; + + // + // Sequence number of last request coming + // from the X client or the X server. + // + + unsigned int clientSequence_; + unsigned int serverSequence_; + + // + // Last sequence number known by client. It can + // be the real sequence generated by server or + // the one of the last auto-generated event. + // + + unsigned int lastSequence_; + + // + // Used to identify replies based on sequence + // number of original request. + // + + SequenceQueue sequenceQueue_; + + // + // This is used to test the synchronous flush + // in the proxy. + // + + int lastRequest_; + + // + // Current resource id selected as target and + // other information related to the image split. + // The pending and abort flags are set when we + // want the proxy to give us a chance to send + // more split data. We also save the position + // of the last commit operation performed by + // channel so we can differentially encode the + // position of next message to commit. + // + + typedef struct + { + int resource; + int pending; + int commit; + T_split_mode mode; + + } T_split_state; + + T_split_state splitState_; + + // + // List of agent resources. + // + + List splitResources_; + + // + // How many sync requests we + // have tainted so far. + // + + int taintCounter_; + + private: + + // + // Keep track of object + // creation and deletion. + // + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +#endif /* ClientChannel_H */ diff --git a/nxcomp/src/ClientProxy.cpp b/nxcomp/src/ClientProxy.cpp new file mode 100644 index 000000000..3574d3bf3 --- /dev/null +++ b/nxcomp/src/ClientProxy.cpp @@ -0,0 +1,553 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Socket.h" +#include "Agent.h" + +#include "ClientProxy.h" + +#include "ClientChannel.h" +#include "GenericChannel.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Log the operations related to sending +// and receiving the control tokens. +// + +#undef TOKEN + +ClientProxy::ClientProxy(int proxyFd) : Proxy(proxyFd) +{ + fontServerPort_ = NULL; + + #ifdef DEBUG + *logofs << "ClientProxy: Created new object at " << this + << ".\n" << logofs_flush; + #endif +} + +ClientProxy::~ClientProxy() +{ + delete [] fontServerPort_; + + #ifdef DEBUG + *logofs << "ClientProxy: Deleted object at " << this + << ".\n" << logofs_flush; + #endif +} + +void ClientProxy::handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, + sockaddr * xServerAddr, unsigned int xServerAddrLength) +{ + #ifdef DEBUG + *logofs << "ClientProxy: No display configuration to set.\n" + << logofs_flush; + #endif +} + +void ClientProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort, + ChannelEndPoint &smbServerPort, + ChannelEndPoint &mediaServerPort, + ChannelEndPoint &httpServerPort, + const char *fontServerPort) +{ + delete [] fontServerPort_; + + fontServerPort_ = new char[strlen(fontServerPort) + 1]; + + strcpy(fontServerPort_, fontServerPort); + + #ifdef DEBUG + *logofs << "ClientProxy: Set port configuration to font '" + << fontServerPort_ << "'.\n" + << logofs_flush; + #endif +} + +int ClientProxy::handleNewConnection(T_channel_type type, int clientFd) +{ + switch (type) + { + case channel_x11: + { + return handleNewXConnection(clientFd); + } + case channel_cups: + { + return handleNewGenericConnection(clientFd, channel_cups, "CUPS"); + } + case channel_smb: + { + return handleNewGenericConnection(clientFd, channel_smb, "SMB"); + } + case channel_media: + { + return handleNewGenericConnection(clientFd, channel_media, "media"); + } + case channel_http: + { + return handleNewGenericConnection(clientFd, channel_http, "HTTP"); + } + case channel_slave: + { + return handleNewSlaveConnection(clientFd); + } + default: + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Unsupported channel with type '" + << getTypeName(type) << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unsupported channel with type '" + << getTypeName(type) << "'.\n"; + + return -1; + } + } +} + +int ClientProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) +{ + switch (type) + { + case channel_font: + { + int port = atoi(fontServerPort_); + + if (port > 0) + { + // + // Connect on the TCP port number. + // + + return handleNewGenericConnectionFromProxyTCP(channelId, channel_font, "localhost", + port, "font"); + } + else + { + // + // Connect to the Unix path. + // + + return handleNewGenericConnectionFromProxyUnix(channelId, channel_font, + fontServerPort_, "font"); + } + } + case channel_slave: + { + return handleNewSlaveConnectionFromProxy(channelId); + } + default: + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Unsupported channel with type '" + << getTypeName(type) << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unsupported channel with type '" + << getTypeName(type) << "'.\n"; + + return -1; + } + } +} + +int ClientProxy::handleNewAgentConnection(Agent *agent) +{ + int clientFd = agent -> getLocalFd(); + + int channelId = allocateChannelMap(clientFd); + + if (channelId == -1) + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Maximum number of available " + << "channels exceeded.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Maximum number of available " + << "channels exceeded.\n"; + + return -1; + } + + transports_[channelId] = agent -> getTransport(); + + agent_ = channelId; + + return handleNewXConnection(clientFd); +} + +int ClientProxy::handleNewXConnection(int clientFd) +{ + int channelId = getChannel(clientFd); + + // + // Check if the channel has been + // already mapped. + // + + if (channelId == -1) + { + channelId = allocateChannelMap(clientFd); + + if (channelId == -1) + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Maximum number of available " + << "channels exceeded.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Maximum number of available " + << "channels exceeded.\n"; + + return -1; + } + } + + #ifdef TEST + *logofs << "ClientProxy: X client descriptor FD#" << clientFd + << " mapped to channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + // + // Turn queuing off for path proxy-to-X-client. + // + + if (control -> OptionClientNoDelay == 1) + { + SetNoDelay(clientFd, control -> OptionClientNoDelay); + } + + // + // If requested, set the size of the TCP send + // and receive buffers. + // + + if (control -> OptionClientSendBuffer != -1) + { + SetSendBuffer(clientFd, control -> OptionClientSendBuffer); + } + + if (control -> OptionClientReceiveBuffer != -1) + { + SetReceiveBuffer(clientFd, control -> OptionClientReceiveBuffer); + } + + if (allocateTransport(clientFd, channelId) < 0) + { + return -1; + } + + // + // Starting from protocol level 3 client and server + // caches are created in proxy and shared between all + // channels. If remote proxy has older protocol level + // pointers are NULL and channels must create their + // own instances. + // + + channels_[channelId] = new ClientChannel(transports_[channelId], compressor_); + + if (channels_[channelId] == NULL) + { + deallocateTransport(channelId); + + return -1; + } + + increaseChannels(channelId); + + // + // Propagate channel stores and caches to the new + // channel. + // + + channels_[channelId] -> setOpcodes(opcodeStore_); + + channels_[channelId] -> setStores(clientStore_, serverStore_); + + channels_[channelId] -> setCaches(clientCache_, serverCache_); + + int port = atoi(fontServerPort_); + + if (port > 0 || *fontServerPort_ != '\0') + { + channels_[channelId] -> setPorts(1); + } + + if (handleControl(code_new_x_connection, channelId) < 0) + { + return -1; + } + + // + // Let channel configure itself according + // to control parameters. + // + + channels_[channelId] -> handleConfiguration(); + + return 1; +} + +int ClientProxy::handleNewXConnectionFromProxy(int channelId) +{ + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Can't create a new X channel " + << "with ID#" << channelId << " at this side.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create a new X channel " + << "with ID#" << channelId << " at this side.\n"; + + return -1; +} + +int ClientProxy::handleLoad(T_load_type type) +{ + int channelCount = getChannels(channel_x11); + + if ((channelCount == 0 && type == load_if_first) || + (channelCount > 0 && type == load_if_any)) + { + #ifdef TEST + *logofs << "ClientProxy: Going to load content of client store.\n" + << logofs_flush; + #endif + + int result = handleLoadStores(); + + if (result == 1) + { + if (handleControl(code_load_request) < 0) + { + return -1; + } + + priority_ = 1; + } + else if (result < 0) + { + #ifdef WARNING + *logofs << "ClientProxy: WARNING! Failed to load content " + << "of persistent cache.\n" << logofs_flush; + #endif + + // + // Don't abort the proxy connection in the case + // of a corrupted cache. By not sending the load + // message to the remote peer, both sides will + // start encoding messages using empty stores. + // This behaviour is compatible with old proxy + // versions. + // + + if (channelCount == 0 && type == load_if_first) + { + if (handleResetStores() < 0) + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Failed to reset message stores.\n" + << logofs_flush; + #endif + + return -1; + } + } + else + { + return -1; + } + } + } + else + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Can't load the stores with " + << channelCount << " remaining channels.\n" + << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int ClientProxy::handleSave() +{ + // + // If no more X channels are remaining + // then save content of message stores. + // + + int channelCount = getChannels(channel_x11); + + if (channelCount == 0) + { + int result = handleSaveStores(); + + if (result == 1) + { + if (handleControl(code_save_request) < 0) + { + return -1; + } + + priority_ = 1; + + return 1; + } + else if (result < 0) + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Failed to save stores " + << "to persistent cache.\n" << logofs_flush; + #endif + + return -1; + } + } + else + { + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Can't save the stores with " + << channelCount << " remaining channels.\n" + << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int ClientProxy::handleAsyncEvents() +{ + if (canRead() == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: WARNING! Reading while writing " + << "with data available on the proxy link.\n" + << logofs_flush; + #endif + + if (handleRead() < 0) + { + return -1; + } + + return 1; + } + + return 0; +} + +int ClientProxy::handleLoadFromProxy() +{ + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Invalid load control message " + << "received in proxy.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid load control message " + << "received in proxy.\n"; + + return -1; +} + +int ClientProxy::handleSaveFromProxy() +{ + #ifdef PANIC + *logofs << "ClientProxy: PANIC! Invalid save control message " + << "received in proxy.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid save control message " + << "received in proxy.\n"; + + return -1; +} + +int ClientProxy::handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient) const +{ + if (clientStore_ -> saveRequestStores(cachefs, md5StateStream, md5StateClient, + use_checksum, discard_data) < 0) + { + return -1; + } + else if (serverStore_ -> saveReplyStores(cachefs, md5StateStream, md5StateClient, + discard_checksum, use_data) < 0) + { + return -1; + } + else if (serverStore_ -> saveEventStores(cachefs, md5StateStream, md5StateClient, + discard_checksum, use_data) < 0) + { + return -1; + } + + return 1; +} + +int ClientProxy::handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const +{ + if (clientStore_ -> loadRequestStores(cachefs, md5StateStream, + use_checksum, discard_data) < 0) + { + return -1; + } + else if (serverStore_ -> loadReplyStores(cachefs, md5StateStream, + discard_checksum, use_data) < 0) + { + return -1; + } + else if (serverStore_ -> loadEventStores(cachefs, md5StateStream, + discard_checksum, use_data) < 0) + { + return -1; + } + + return 1; +} + diff --git a/nxcomp/src/ClientProxy.h b/nxcomp/src/ClientProxy.h new file mode 100644 index 000000000..b89785b1a --- /dev/null +++ b/nxcomp/src/ClientProxy.h @@ -0,0 +1,113 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ClientProxy_H +#define ClientProxy_H + +#include "Proxy.h" + +// +// Set the verbosity level. +// + +#undef TEST +#undef DEBUG + +class ClientProxy : public Proxy +{ + public: + + ClientProxy(int proxyFD); + + virtual ~ClientProxy(); + + virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, + sockaddr *xServerAddr, unsigned int xServerAddrLength); + + virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, + ChannelEndPoint &smbServerPort, + ChannelEndPoint &mediaServerPort, + ChannelEndPoint &httpServerPort, + const char *fontServerPort); + + protected: + + // + // Create a new channel. + // + + virtual int handleNewConnection(T_channel_type type, int clientFd); + + virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId); + + virtual int handleNewAgentConnection(Agent *agent); + + virtual int handleNewXConnection(int clientFd); + + virtual int handleNewXConnectionFromProxy(int channelId); + + // + // Implement persistence according + // to our proxy mode. + // + + virtual int handleLoad(T_load_type type); + virtual int handleSave(); + + virtual int handleAsyncEvents(); + + virtual int handleLoadFromProxy(); + virtual int handleSaveFromProxy(); + + virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient) const; + + virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const; + + // + // Utility function used to realize + // a new connection. + // + + protected: + + virtual int checkLocalChannelMap(int channelId) + { + // Since ProtoStep7 (#issue 108) + return ((channelId & control -> ChannelMask) != 0); + } + + // + // Ports where to forward extended services' + // TCP connections. + // + + private: + + char *fontServerPort_; +}; + + +#endif /* ClientProxy_H */ diff --git a/nxcomp/src/ClientReadBuffer.cpp b/nxcomp/src/ClientReadBuffer.cpp new file mode 100644 index 000000000..c8f4f69a4 --- /dev/null +++ b/nxcomp/src/ClientReadBuffer.cpp @@ -0,0 +1,178 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ClientReadBuffer.h" + +#include "ClientChannel.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +unsigned int ClientReadBuffer::suggestedLength(unsigned int pendingLength) +{ + // + // Even if the pending data is not + // enough to make a complete message, + // resize the buffer to accommodate + // it all. + // + + unsigned int readLength = pendingLength; + + if (pendingLength < remaining_) + { + readLength = remaining_; + } + + return readLength; +} + +int ClientReadBuffer::locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength) +{ + unsigned int size = end - start; + + #ifdef TEST + *logofs << "ClientReadBuffer: Locating message for FD#" + << transport_ -> fd() << " with " << size + << " bytes.\n" << logofs_flush; + #endif + + if (firstMessage_) + { + if (size < 12) + { + remaining_ = 12 - size; + + #ifdef TEST + *logofs << "ClientReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + if (*start == 0x42) + { + bigEndian_ = 1; + } + else + { + bigEndian_ = 0; + } + + channel_ -> setBigEndian(bigEndian_); + + dataLength = 12 + RoundUp4(GetUINT(start + 6, bigEndian_)) + + RoundUp4(GetUINT(start + 8, bigEndian_)); + + // + // Send the data immediately if this is unlikely + // to be a X connection attempt. + // + + if (dataLength > 4096) + { + #ifdef WARNING + *logofs << "ClientReadBuffer: WARNING! Flushing suspicious X " + << "connection with first request of " << dataLength + << " bytes.\n" << logofs_flush; + #endif + + dataLength = size; + } + } + else + { + if (size < 4) + { + remaining_ = 4 - size; + + #ifdef TEST + *logofs << "ClientReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + dataLength = (GetUINT(start + 2, bigEndian_) << 2); + + if (dataLength < 4) + { + #ifdef TEST + *logofs << "ClientReadBuffer: WARNING! Assuming length 4 " + << "for suspicious message of length " << dataLength + << ".\n" << logofs_flush; + #endif + + dataLength = 4; + } + } + + #ifdef TEST + *logofs << "ClientReadBuffer: Length of the next message is " + << dataLength << ".\n" << logofs_flush; + #endif + + if (size < dataLength) + { + remaining_ = dataLength - size; + + #ifdef TEST + *logofs << "ClientReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + firstMessage_ = 0; + + controlLength = 0; + trailerLength = 0; + + remaining_ = 0; + + #ifdef TEST + *logofs << "ClientReadBuffer: Located message with " + << "remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/ClientReadBuffer.h b/nxcomp/src/ClientReadBuffer.h new file mode 100644 index 000000000..c557417fa --- /dev/null +++ b/nxcomp/src/ClientReadBuffer.h @@ -0,0 +1,65 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ClientReadBuffer_H +#define ClientReadBuffer_H + +#include "Control.h" +#include "ReadBuffer.h" + +class ClientChannel; + +class ClientReadBuffer : public ReadBuffer +{ + public: + + ClientReadBuffer(Transport *transport, ClientChannel *channel) + + : ReadBuffer(transport), firstMessage_(1), channel_(channel) + { + } + + virtual ~ClientReadBuffer() + { + } + + protected: + + virtual unsigned int suggestedLength(unsigned int pendingLength); + + virtual int locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength); + + int bigEndian_; + + int firstMessage_; + + ClientChannel *channel_; +}; + +#endif /* ClientReadBuffer_H */ diff --git a/nxcomp/src/ClientStore.cpp b/nxcomp/src/ClientStore.cpp new file mode 100644 index 000000000..0c12eefd8 --- /dev/null +++ b/nxcomp/src/ClientStore.cpp @@ -0,0 +1,226 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ClientStore.h" + +// +// Cached request classes. +// + +#include "ChangeProperty.h" +#include "SendEvent.h" +#include "CreateGC.h" +#include "ChangeGC.h" +#include "CreatePixmap.h" +#include "SetClipRectangles.h" +#include "CopyArea.h" +#include "PolyLine.h" +#include "PolySegment.h" +#include "PolyFillRectangle.h" +#include "PutImage.h" +#include "TranslateCoords.h" +#include "GetImage.h" +#include "ClearArea.h" +#include "ConfigureWindow.h" +#include "ShapeExtension.h" +#include "RenderExtension.h" +#include "PolyText8.h" +#include "PolyText16.h" +#include "ImageText8.h" +#include "ImageText16.h" +#include "PolyPoint.h" +#include "PolyFillArc.h" +#include "PolyArc.h" +#include "FillPoly.h" +#include "InternAtom.h" +#include "GetProperty.h" +#include "SetUnpackGeometry.h" +#include "SetUnpackColormap.h" +#include "SetUnpackAlpha.h" +#include "PutPackedImage.h" +#include "GenericRequest.h" + +// +// Set the verbosity level. +// + +#define WARNING +#define PANIC +#undef TEST + +ClientStore::ClientStore(StaticCompressor *compressor) + + : compressor_(compressor) +{ + if (logofs == NULL) + { + logofs = &cout; + } + + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + requests_[i] = NULL; + } + + requests_[X_ChangeProperty] = new ChangePropertyStore(); + requests_[X_SendEvent] = new SendEventStore(); + requests_[X_CreateGC] = new CreateGCStore(); + requests_[X_SetClipRectangles] = new SetClipRectanglesStore(); + requests_[X_CopyArea] = new CopyAreaStore(); + requests_[X_PolyLine] = new PolyLineStore(); + requests_[X_PolySegment] = new PolySegmentStore(); + requests_[X_PolyFillRectangle] = new PolyFillRectangleStore(); + requests_[X_PutImage] = new PutImageStore(compressor); + requests_[X_TranslateCoords] = new TranslateCoordsStore(); + requests_[X_GetImage] = new GetImageStore(); + requests_[X_ClearArea] = new ClearAreaStore(); + requests_[X_ConfigureWindow] = new ConfigureWindowStore(); + requests_[X_PolyText8] = new PolyText8Store(); + requests_[X_PolyText16] = new PolyText16Store(); + requests_[X_ImageText8] = new ImageText8Store(); + requests_[X_ImageText16] = new ImageText16Store(); + requests_[X_PolyPoint] = new PolyPointStore(); + requests_[X_PolyFillArc] = new PolyFillArcStore(); + requests_[X_PolyArc] = new PolyArcStore(); + requests_[X_FillPoly] = new FillPolyStore(); + requests_[X_InternAtom] = new InternAtomStore(); + requests_[X_GetProperty] = new GetPropertyStore(); + + requests_[X_NXInternalShapeExtension] = new ShapeExtensionStore(compressor); + requests_[X_NXInternalGenericRequest] = new GenericRequestStore(compressor); + requests_[X_NXInternalRenderExtension] = new RenderExtensionStore(compressor); + requests_[X_NXSetUnpackGeometry] = new SetUnpackGeometryStore(compressor); + requests_[X_NXPutPackedImage] = new PutPackedImageStore(compressor); + + // Since ProtoStep7 (#issue 108) + requests_[X_ChangeGC] = new ChangeGCStore(); + requests_[X_CreatePixmap] = new CreatePixmapStore(); + requests_[X_NXSetUnpackColormap] = new SetUnpackColormapStore(compressor); + requests_[X_NXSetUnpackAlpha] = new SetUnpackAlphaStore(compressor); + + for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) + { + splits_[i] = NULL; + } + + commits_ = new CommitStore(compressor); +} + +ClientStore::~ClientStore() +{ + if (logofs == NULL) + { + logofs = &cout; + } + + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + delete requests_[i]; + } + + for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) + { + delete splits_[i]; + } + + delete commits_; +} + +int ClientStore::saveRequestStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction) const +{ + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (requests_[i] != NULL && + requests_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, + checksumAction, dataAction, + storeBigEndian()) < 0) + { + #ifdef WARNING + *logofs << "ClientStore: WARNING! Error saving request store " + << "for OPCODE#" << (unsigned int) i << ".\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Error saving request store " + << "for opcode '" << (unsigned int) i << "'.\n"; + + return -1; + } + } + + return 1; +} + +int ClientStore::loadRequestStores(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction) const +{ + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (requests_[i] != NULL && + requests_[i] -> loadStore(cachefs, md5StateStream, + checksumAction, dataAction, + storeBigEndian()) < 0) + { + #ifdef WARNING + *logofs << "ClientStore: WARNING! Error loading request store " + << "for OPCODE#" << (unsigned int) i << ".\n" + << logofs_flush; + #endif + + return -1; + } + } + + return 1; +} + +void ClientStore::dumpSplitStores() const +{ + for (int i = 0; i < CHANNEL_STORE_RESOURCE_LIMIT; i++) + { + if (splits_[i] != NULL) + { + splits_[i] -> dump(); + } + } + + if ((getSplitTotalSize() != 0 && getSplitTotalStorageSize() == 0) || + (getSplitTotalSize() == 0 && getSplitTotalStorageSize() != 0)) + { + #ifdef PANIC + *logofs << "ClientStore: PANIC! Inconsistency detected " + << "while handling the split stores.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } +} diff --git a/nxcomp/src/ClientStore.h b/nxcomp/src/ClientStore.h new file mode 100644 index 000000000..009d87d9f --- /dev/null +++ b/nxcomp/src/ClientStore.h @@ -0,0 +1,143 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ClientStore_H +#define ClientStore_H + +#include "Message.h" +#include "Split.h" + +#include "ChannelStore.h" + +class StaticCompressor; + +class ClientStore : public ChannelStore +{ + public: + + ClientStore(StaticCompressor *compressor); + + virtual ~ClientStore(); + + // + // Get the store based on the index. + // + + MessageStore *getRequestStore(unsigned char opcode) const + { + return requests_[opcode]; + } + + SplitStore *getSplitStore(int resource) const + { + return splits_[resource]; + } + + int getSplitTotalSize() const + { + return SplitStore::getTotalSize(); + } + + int getSplitTotalStorageSize() const + { + return SplitStore::getTotalStorageSize(); + } + + CommitStore *getCommitStore() const + { + return commits_; + } + + int getCommitSize() const + { + return commits_ -> getSize(); + } + + void dumpSplitStore(int resource) const + { + splits_[resource] -> dump(); + } + + void dumpCommitStore() const + { + commits_ -> dump(); + } + + void dumpSplitStores() const; + + SplitStore *createSplitStore(int resource) + { + splits_[resource] = new SplitStore(compressor_, commits_, resource); + + return splits_[resource]; + } + + void destroySplitStore(int resource) + { + delete splits_[resource]; + + splits_[resource] = NULL; + } + + // + // Actually save the message store + // to disk according to proxy mode. + // + + int saveRequestStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction) const; + + int loadRequestStores(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction) const; + + private: + + // + // A client store contains requests. + // + + MessageStore *requests_[CHANNEL_STORE_OPCODE_LIMIT]; + + // + // Client messages being split. + // + + SplitStore *splits_[CHANNEL_STORE_RESOURCE_LIMIT]; + + // + // Messages having been recomposed. + // + + CommitStore *commits_; + + // + // Passed forward to the other stores. + // + + StaticCompressor *compressor_; +}; + +#endif /* ClientStore_H */ diff --git a/nxcomp/src/Colormap.cpp b/nxcomp/src/Colormap.cpp new file mode 100644 index 000000000..afe99ecae --- /dev/null +++ b/nxcomp/src/Colormap.cpp @@ -0,0 +1,106 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Unpack.h" +#include "Colormap.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size, + unsigned char *dst_data, int dst_size) +{ + if (*src_data == 0) + { + if (dst_size != src_size - 1) + { + #ifdef TEST + *logofs << "UnpackColormap: PANIC! Invalid destination size " + << dst_size << " with source " << src_size + << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "UnpackColormap: Expanding " << src_size - 1 + << " bytes of plain colormap data.\n" << logofs_flush; + #endif + + memcpy(dst_data, src_data + 1, src_size - 1); + + return 1; + } + + unsigned int check_size = dst_size; + + int result = ZDecompress(&unpackStream, dst_data, &check_size, + src_data + 1, src_size - 1); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "UnpackColormap: PANIC! Failure decompressing colormap data. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decompressing colormap data. " + << "Error is '" << zError(result) << "'.\n"; + + return -1; + } + else if (check_size != (unsigned int) dst_size) + { + #ifdef PANIC + *logofs << "UnpackColormap: PANIC! Size mismatch in colormap data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Size mismatch in colormap data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n"; + + return -1; + } + + #ifdef TEST + *logofs << "UnpackColormap: Decompressed " << src_size - 1 + << " bytes to " << dst_size << " bytes of colormap data.\n" + << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/Colormap.h b/nxcomp/src/Colormap.h new file mode 100644 index 000000000..a96d003fa --- /dev/null +++ b/nxcomp/src/Colormap.h @@ -0,0 +1,32 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Colormap_H +#define Colormap_H + +int UnpackColormap(unsigned char method, unsigned char *src_data, int src_size, + unsigned char *dst_data, int dst_size); + +#endif /* Colormap_H */ diff --git a/nxcomp/src/ConfigureWindow.cpp b/nxcomp/src/ConfigureWindow.cpp new file mode 100644 index 000000000..32d3153b9 --- /dev/null +++ b/nxcomp/src/ConfigureWindow.cpp @@ -0,0 +1,142 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ConfigureWindow.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int ConfigureWindowStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; + + // + // Here is the fingerprint. + // + + configureWindow -> window = GetULONG(buffer + 4, bigEndian); + + configureWindow -> value_mask = GetUINT(buffer + 8, bigEndian); + + // + // To increase effectiveness of the caching algorithm + // we remove the unused bytes carried in the data part. + // + + if ((int) size > dataOffset) + { + #ifdef DEBUG + *logofs << name() << ": Removing unused bytes from the data payload.\n" << logofs_flush; + #endif + + configureWindow -> value_mask &= (1 << 7) - 1; + + unsigned int mask = 0x1; + unsigned char *source = (unsigned char *) buffer + CONFIGUREWINDOW_DATA_OFFSET; + unsigned long value = 0; + + for (unsigned int i = 0; i < 7; i++) + { + if (configureWindow -> value_mask & mask) + { + value = GetULONG(source, bigEndian); + + value &= (1 << CONFIGUREWINDOW_FIELD_WIDTH[i]) - 1; + + PutULONG(value, source, bigEndian); + + source += 4; + } + mask <<= 1; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ConfigureWindowStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(configureWindow -> window, buffer + 4, bigEndian); + + PutUINT(configureWindow -> value_mask, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ConfigureWindowStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ConfigureWindowMessage *configureWindow = (ConfigureWindowMessage *) message; + + *logofs << "ConfigureWindow: window " << configureWindow -> window + << ", value_mask " << configureWindow -> value_mask + << ", size " << configureWindow -> size_ << ".\n"; + + #endif +} + +void ConfigureWindowStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 4, 4); + md5_append(md5_state_, buffer + 8, 2); +} diff --git a/nxcomp/src/ConfigureWindow.h b/nxcomp/src/ConfigureWindow.h new file mode 100644 index 000000000..e02c2aae1 --- /dev/null +++ b/nxcomp/src/ConfigureWindow.h @@ -0,0 +1,178 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ConfigureWindow_H +#define ConfigureWindow_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define CONFIGUREWINDOW_ENABLE_CACHE 1 +#define CONFIGUREWINDOW_ENABLE_DATA 0 +#define CONFIGUREWINDOW_ENABLE_SPLIT 0 +#define CONFIGUREWINDOW_ENABLE_COMPRESS 0 + +#define CONFIGUREWINDOW_DATA_LIMIT 32 +#define CONFIGUREWINDOW_DATA_OFFSET 12 + +#define CONFIGUREWINDOW_CACHE_SLOTS 3000 +#define CONFIGUREWINDOW_CACHE_THRESHOLD 5 +#define CONFIGUREWINDOW_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class ConfigureWindowMessage : public Message +{ + friend class ConfigureWindowStore; + + public: + + ConfigureWindowMessage() + { + } + + ~ConfigureWindowMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int window; + unsigned short value_mask; +}; + +class ConfigureWindowStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ConfigureWindowStore() : MessageStore() + { + enableCache = CONFIGUREWINDOW_ENABLE_CACHE; + enableData = CONFIGUREWINDOW_ENABLE_DATA; + enableSplit = CONFIGUREWINDOW_ENABLE_SPLIT; + enableCompress = CONFIGUREWINDOW_ENABLE_COMPRESS; + + dataLimit = CONFIGUREWINDOW_DATA_LIMIT; + dataOffset = CONFIGUREWINDOW_DATA_OFFSET; + + cacheSlots = CONFIGUREWINDOW_CACHE_SLOTS; + cacheThreshold = CONFIGUREWINDOW_CACHE_THRESHOLD; + cacheLowerThreshold = CONFIGUREWINDOW_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~ConfigureWindowStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "ConfigureWindow"; + } + + virtual unsigned char opcode() const + { + return X_ConfigureWindow; + } + + virtual unsigned int storage() const + { + return sizeof(ConfigureWindowMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ConfigureWindowMessage(); + } + + virtual Message *create(const Message &message) const + { + return new ConfigureWindowMessage((const ConfigureWindowMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (ConfigureWindowMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* ConfigureWindow_H */ diff --git a/nxcomp/src/Control.cpp b/nxcomp/src/Control.cpp new file mode 100644 index 000000000..75fd56e3f --- /dev/null +++ b/nxcomp/src/Control.cpp @@ -0,0 +1,822 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "NX.h" +#include "NXpack.h" + +#include "Control.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Flush immediately on prioritized messages. +// + +#define FLUSH_PRIORITY 0 + +// +// Maximum number of bytes sent for each token. +// + +#define TOKEN_SIZE 1536 + +// +// Maximum number of tokens that can be spent +// by the client proxy before having to block +// waiting for a token reply. +// + +#define TOKEN_LIMIT 24 + +// +// By default assume the proxy is running as a +// standalone program. +// + +#define LINK_ENCRYPTED 0 + +// +// Maximum number of pids the proxy will record +// and kill at shutdown. +// + +#define KILL_LIMIT 16 + +// +// Allocate on the NX client side channels whose +// ids are a multiple of 8 (starting from 0). All +// the other ids can be used to allocate channels +// at the NX server side (X client side). +// + +#define CHANNEL_MASK 0x07 + +// +// Kill session if control parameters cannot be +// negotiated before this timeout. +// + +#define INIT_TIMEOUT 60000 + +// +// Enter the congestion state if the remote does +// not reply to a ping within the given amount +// of time. +// + +#define PING_TIMEOUT 5000 + +// +// Only send one motion event any N milliseconds. +// + +#define MOTION_TIMEOUT 0 + + +// +// Force an update of the congestion counter if +// the proxy is idle for this time. +// + +#define IDLE_TIMEOUT 50 + +// +// Close X connection if can't write before this +// timeout. +// + +#define CHANNEL_TIMEOUT 10000 + +// +// Warn user (or close proxy connection) if don't +// receive any data before this timeout. +// + +#define PROXY_TIMEOUT 120000 + +// +// How many milliseconds to wait for the shared +// memory completion event to become available. +// + +#define SHMEM_TIMEOUT 200 +// +// Before closing down the proxy, wait for the +// given amount of miliseconds to let all the +// running applications to close down their +// connections. +// +// A null timeout will cause the proxy to wait +// indefinitely, until the watchdog process is +// killed. This is usually the way the proxy is +// started by the NX server. If on the other +// hand a timeout is given and there no channel +// is remaining, the proxy will be closed down +// using a small timeout, presently of 500 ms. +// + +#define CLEANUP_TIMEOUT 3000 + +// +// Wait this amount of milliseconds after any +// iteration of the house-keeping process. +// + +#define KEEPER_TIMEOUT 60000 + +// +// In case of timeout, select can return control +// to program earlier or later of this amount of +// ms. Consider this when calculating if timeout +// is elapsed. +// + +#define LATENCY_TIMEOUT 1 + +// +// Control memory allocation in transport +// and other classes. +// + +#define TRANSPORT_X_BUFFER_SIZE 131072 +#define TRANSPORT_PROXY_BUFFER_SIZE 65536 +#define TRANSPORT_GENERIC_BUFFER_SIZE 16384 + +#define TRANSPORT_X_BUFFER_THRESHOLD 262144 +#define TRANSPORT_PROXY_BUFFER_THRESHOLD 131072 +#define TRANSPORT_GENERIC_BUFFER_THRESHOLD 32768 + +// +// Never allow buffers to exceed this limit. +// + +#define TRANSPORT_MAXIMUM_BUFFER_SIZE 393216 + +// +// Immediately flush the accumulated data to +// the X server if the write buffer exceeds +// this size. +// + +#define TRANSPORT_FLUSH_BUFFER_SIZE 16384 + +// +// Defaults used for socket options. +// + +#define OPTION_PROXY_KEEP_ALIVE 0 +#define OPTION_PROXY_LOW_DELAY 1 +#define OPTION_PROXY_CLIENT_NO_DELAY 1 +#define OPTION_PROXY_SERVER_NO_DELAY 1 +#define OPTION_CLIENT_NO_DELAY 1 +#define OPTION_SERVER_NO_DELAY 1 + +#define OPTION_PROXY_RECEIVE_BUFFER -1 +#define OPTION_CLIENT_RECEIVE_BUFFER -1 +#define OPTION_SERVER_RECEIVE_BUFFER -1 + +#define OPTION_PROXY_SEND_BUFFER -1 +#define OPTION_CLIENT_SEND_BUFFER -1 +#define OPTION_SERVER_SEND_BUFFER -1 + +#define OPTION_PROXY_RETRY_CONNECT 30 +#define OPTION_PROXY_RETRY_ACCEPT 3 +#define OPTION_SERVER_RETRY_CONNECT 3 + +// +// Defaults used for cache persistence. +// + +#define PERSISTENT_CACHE_THRESHOLD 102400 + +#define PERSISTENT_CACHE_ENABLE_LOAD 1 +#define PERSISTENT_CACHE_ENABLE_SAVE 1 + +#define PERSISTENT_CACHE_CHECK_ON_SHUTDOWN 0 + +#define PERSISTENT_CACHE_LOAD_PACKED 1 +#define PERSISTENT_CACHE_LOAD_RENDER 1 + +#define PERSISTENT_CACHE_DISK_LIMIT 33554432 + +// +// Defaults used for image cache. +// + +#define IMAGE_CACHE_ENABLE_LOAD 0 +#define IMAGE_CACHE_ENABLE_SAVE 0 + +#define IMAGE_CACHE_DISK_LIMIT 33554432 + +// +// Suggested defaults for read length parameters +// used by read buffer classes. +// + +#define CLIENT_INITIAL_READ_SIZE 8192 +#define CLIENT_MAXIMUM_BUFFER_SIZE 262144 + +#define SERVER_INITIAL_READ_SIZE 8192 +#define SERVER_MAXIMUM_BUFFER_SIZE 65536 + +#define PROXY_INITIAL_READ_SIZE 65536 +#define PROXY_MAXIMUM_BUFFER_SIZE 262144 + 1024 + +#define GENERIC_INITIAL_READ_SIZE 8192 +#define GENERIC_MAXIMUM_BUFFER_SIZE 8192 + +// +// Calculate bitrate in given time frames. +// Values are in milliseconds. +// + +#define SHORT_BITRATE_TIME_FRAME 5000 +#define LONG_BITRATE_TIME_FRAME 30000 + +// +// Bandwidth control. A value of 0 means no +// limit. Values are stored internally in +// bytes per second. +// + +#define CLIENT_BITRATE_LIMIT 0 +#define SERVER_BITRATE_LIMIT 0 + +// +// Default values for cache control. We limit +// the maximum size of a request to 262144 but +// we need to consider the replies, whose size +// may be up to 4MB. +// + +#define MINIMUM_MESSAGE_SIZE 4 +#define MAXIMUM_MESSAGE_SIZE 4194304 +#define MAXIMUM_REQUEST_SIZE 262144 + +#define CLIENT_TOTAL_STORAGE_SIZE 8388608 +#define SERVER_TOTAL_STORAGE_SIZE 8388608 + +#define STORE_TIME_LIMIT 3600 + +#define STORE_HITS_LOAD_BONUS 10 +#define STORE_HITS_ADD_BONUS 20 +#define STORE_HITS_LIMIT 100 + +#define STORE_HITS_TOUCH 1 +#define STORE_HITS_UNTOUCH 2 + +// +// Default parameters for message splitting. +// + +#define SPLIT_MODE 1 +#define SPLIT_TIMEOUT 50 +#define SPLIT_TOTAL_SIZE 128 +#define SPLIT_TOTAL_STORAGE_SIZE 1048576 +#define SPLIT_DATA_THRESHOLD 65536 +#define SPLIT_DATA_PACKET_LIMIT 24576 + +// +// Agent related parameters. +// + +#define PACK_METHOD 63 +#define PACK_QUALITY 9 +#define HIDE_RENDER 0 +#define TAINT_REPLIES 1 +#define TAINT_THRESHOLD 8 + +// +// In current version only X server support is +// implemented. Note that use of shared memory +// is negotiated according to options provided +// by the user. +// + +#define SHMEM_CLIENT 0 +#define SHMEM_SERVER 1 + +// +// Default size of shared memory segments used +// in MIT-SHM support. +// + +#define SHMEM_CLIENT_SIZE 0 +#define SHMEM_SERVER_SIZE 2097152 + +// +// What do we do at the end of session? If this +// flag is set, we launch a new client letting +// the user run a new NX session. +// + +#define ENABLE_RESTART_ON_SHUTDOWN 0 + +// +// Do we produce a core dump on fatal errors? +// + +#define ENABLE_CORE_DUMP_ON_ABORT 0 + +// +// Reopen the log file if it exceeds this size. +// + +#define FILE_SIZE_LIMIT 60000000 + +// +// Check periodically if we need to truncate the +// log file. By default check every minute. +// + +#define FILE_SIZE_CHECK_TIMEOUT 60000 + +// +// Protocol version compatibility values +// + +const int Control::NX_MIN_PROTO_STEP = 10; +const int Control::NX_MAX_PROTO_STEP = 10; +const char* const Control::NXPROXY_COMPATIBILITY_VERSION = "3.5.0"; + +// +// Set defaults for control. They should be what +// you get in case of 'local' connection. +// + +Control::Control() +{ + ProxyMode = proxy_undefined; + ProxyStage = stage_undefined; + SessionMode = session_undefined; + FlushPolicy = policy_undefined; + LinkMode = link_undefined; + + LinkEncrypted = LINK_ENCRYPTED; + FlushPriority = FLUSH_PRIORITY; + + TokenSize = TOKEN_SIZE; + TokenLimit = TOKEN_LIMIT; + + ChannelMask = CHANNEL_MASK; + + InitTimeout = INIT_TIMEOUT; + PingTimeout = PING_TIMEOUT; + MotionTimeout = MOTION_TIMEOUT; + IdleTimeout = IDLE_TIMEOUT; + + ChannelTimeout = CHANNEL_TIMEOUT; + ProxyTimeout = PROXY_TIMEOUT; + ShmemTimeout = SHMEM_TIMEOUT; + + CleanupTimeout = CLEANUP_TIMEOUT; + KeeperTimeout = KEEPER_TIMEOUT; + LatencyTimeout = LATENCY_TIMEOUT; + + FileSizeLimit = FILE_SIZE_LIMIT; + FileSizeCheckTimeout = FILE_SIZE_CHECK_TIMEOUT; + + EnableRestartOnShutdown = ENABLE_RESTART_ON_SHUTDOWN; + + KillDaemonOnShutdownLimit = KILL_LIMIT; + + KillDaemonOnShutdown = new int[KillDaemonOnShutdownLimit]; + + for (int i = 0; i < KILL_LIMIT; i++) + { + KillDaemonOnShutdown[i] = -1; + } + + KillDaemonOnShutdownNumber = 0; + + EnableCoreDumpOnAbort = ENABLE_CORE_DUMP_ON_ABORT; + + // + // Collect statistics by default. + // + + EnableStatistics = 1; + + // + // Memory restrictions if any. + // + + LocalMemoryLevel = -1; + + // + // Compression must be negotiated between proxies. + // + + LocalDeltaCompression = -1; + RemoteDeltaCompression = -1; + + LocalDataCompression = -1; + LocalStreamCompression = -1; + + RemoteDataCompression = -1; + RemoteStreamCompression = -1; + + LocalDataCompressionLevel = -1; + LocalDataCompressionThreshold = -1; + LocalStreamCompressionLevel = -1; + + RemoteDataCompressionLevel = -1; + RemoteStreamCompressionLevel = -1; + + // + // Transport buffers' allocation parameters. + // + + TransportXBufferSize = TRANSPORT_X_BUFFER_SIZE; + TransportProxyBufferSize = TRANSPORT_PROXY_BUFFER_SIZE; + TransportGenericBufferSize = TRANSPORT_GENERIC_BUFFER_SIZE; + + TransportXBufferThreshold = TRANSPORT_X_BUFFER_THRESHOLD; + TransportProxyBufferThreshold = TRANSPORT_PROXY_BUFFER_THRESHOLD; + TransportGenericBufferThreshold = TRANSPORT_GENERIC_BUFFER_THRESHOLD; + + TransportMaximumBufferSize = TRANSPORT_MAXIMUM_BUFFER_SIZE; + + // + // Flush the write buffer if it exceeds + // this size. + // + + TransportFlushBufferSize = TRANSPORT_FLUSH_BUFFER_SIZE; + + // + // Socket options. + // + + OptionProxyKeepAlive = OPTION_PROXY_KEEP_ALIVE; + OptionProxyLowDelay = OPTION_PROXY_LOW_DELAY; + OptionProxyClientNoDelay = OPTION_PROXY_CLIENT_NO_DELAY; + OptionProxyServerNoDelay = OPTION_PROXY_SERVER_NO_DELAY; + OptionClientNoDelay = OPTION_CLIENT_NO_DELAY; + OptionServerNoDelay = OPTION_SERVER_NO_DELAY; + + OptionProxyReceiveBuffer = OPTION_PROXY_RECEIVE_BUFFER; + OptionClientReceiveBuffer = OPTION_CLIENT_RECEIVE_BUFFER; + OptionServerReceiveBuffer = OPTION_SERVER_RECEIVE_BUFFER; + + OptionProxySendBuffer = OPTION_PROXY_SEND_BUFFER; + OptionClientSendBuffer = OPTION_CLIENT_SEND_BUFFER; + OptionServerSendBuffer = OPTION_SERVER_SEND_BUFFER; + + OptionProxyRetryAccept = OPTION_PROXY_RETRY_ACCEPT; + OptionProxyRetryConnect = OPTION_PROXY_RETRY_CONNECT; + OptionServerRetryConnect = OPTION_SERVER_RETRY_CONNECT; + + // + // Base NX directories. + // + + HomePath = NULL; + RootPath = NULL; + SystemPath = NULL; + TempPath = NULL; + ClientPath = NULL; + + // + // Set defaults for handling persistent cache. + // + + PersistentCachePath = NULL; + PersistentCacheName = NULL; + + PersistentCacheThreshold = PERSISTENT_CACHE_THRESHOLD; + + PersistentCacheEnableLoad = PERSISTENT_CACHE_ENABLE_LOAD; + PersistentCacheEnableSave = PERSISTENT_CACHE_ENABLE_SAVE; + + PersistentCacheCheckOnShutdown = PERSISTENT_CACHE_CHECK_ON_SHUTDOWN; + + PersistentCacheLoadPacked = PERSISTENT_CACHE_LOAD_PACKED; + PersistentCacheLoadRender = PERSISTENT_CACHE_LOAD_RENDER; + + PersistentCacheDiskLimit = PERSISTENT_CACHE_DISK_LIMIT; + + // + // Set defaults for image cache. + // + + ImageCachePath = NULL; + + ImageCacheEnableLoad = IMAGE_CACHE_ENABLE_LOAD; + ImageCacheEnableSave = IMAGE_CACHE_ENABLE_SAVE; + + ImageCacheDiskLimit = IMAGE_CACHE_DISK_LIMIT; + + // + // Set defaults for the read buffers. + // + + ClientInitialReadSize = CLIENT_INITIAL_READ_SIZE; + ClientMaximumBufferSize = CLIENT_MAXIMUM_BUFFER_SIZE; + + ServerInitialReadSize = SERVER_INITIAL_READ_SIZE; + ServerMaximumBufferSize = SERVER_MAXIMUM_BUFFER_SIZE; + + ProxyInitialReadSize = PROXY_INITIAL_READ_SIZE; + ProxyMaximumBufferSize = PROXY_MAXIMUM_BUFFER_SIZE; + + GenericInitialReadSize = GENERIC_INITIAL_READ_SIZE; + GenericMaximumBufferSize = GENERIC_MAXIMUM_BUFFER_SIZE; + + ShortBitrateTimeFrame = SHORT_BITRATE_TIME_FRAME; + LongBitrateTimeFrame = LONG_BITRATE_TIME_FRAME; + + // + // Bandwidth control. + // + + LocalBitrateLimit = -1; + + ClientBitrateLimit = CLIENT_BITRATE_LIMIT; + ServerBitrateLimit = SERVER_BITRATE_LIMIT; + + // + // Default parameters for message handling. + // + + ClientTotalStorageSize = CLIENT_TOTAL_STORAGE_SIZE; + ServerTotalStorageSize = SERVER_TOTAL_STORAGE_SIZE; + + LocalTotalStorageSize = -1; + RemoteTotalStorageSize = -1; + + StoreTimeLimit = STORE_TIME_LIMIT; + + StoreHitsLoadBonus = STORE_HITS_LOAD_BONUS; + StoreHitsAddBonus = STORE_HITS_ADD_BONUS; + StoreHitsLimit = STORE_HITS_LIMIT; + + StoreHitsTouch = STORE_HITS_TOUCH; + StoreHitsUntouch = STORE_HITS_UNTOUCH; + + MinimumMessageSize = MINIMUM_MESSAGE_SIZE; + MaximumMessageSize = MAXIMUM_MESSAGE_SIZE; + MaximumRequestSize = MAXIMUM_REQUEST_SIZE; + + SplitMode = SPLIT_MODE; + SplitTimeout = SPLIT_TIMEOUT; + SplitTotalSize = SPLIT_TOTAL_SIZE; + SplitTotalStorageSize = SPLIT_TOTAL_STORAGE_SIZE; + SplitDataThreshold = SPLIT_DATA_THRESHOLD; + SplitDataPacketLimit = SPLIT_DATA_PACKET_LIMIT; + + PackMethod = PACK_METHOD; + PackQuality = PACK_QUALITY; + HideRender = HIDE_RENDER; + TaintReplies = TAINT_REPLIES; + TaintThreshold = TAINT_THRESHOLD; + + ShmemClient = SHMEM_CLIENT; + ShmemServer = SHMEM_SERVER; + + ShmemClientSize = SHMEM_CLIENT_SIZE; + ShmemServerSize = SHMEM_SERVER_SIZE; + + // + // Get local version number from compile time + // settings. Version of remote proxy will be + // checked at connection time. + // + + RemoteVersionMajor = -1; + RemoteVersionMinor = -1; + RemoteVersionPatch = -1; + RemoteVersionMaintenancePatch = -1; + + CompatVersionMajor = -1; + CompatVersionMinor = -1; + CompatVersionPatch = -1; + CompatVersionMaintenancePatch = -1; + + LocalVersionMajor = NXMajorVersion(); + LocalVersionMinor = NXMinorVersion(); + LocalVersionPatch = NXPatchVersion(); + LocalVersionMaintenancePatch = NXMaintenancePatchVersion(); + + #ifdef TEST + *logofs << "Control: Major version is " << LocalVersionMajor + << " minor is " << LocalVersionMinor << " patch is " + << LocalVersionPatch << " Maintenance version is " + << LocalVersionMaintenancePatch << ".\n" << logofs_flush; + #endif + + // + // Initialize local implemented methods later + // and negotiate remote methods at connection + // time. + // + + LocalUnpackMethods = NULL; + RemoteUnpackMethods = NULL; + + // + // Set to 1 those methods which are implemented. + // + + setLocalUnpackMethods(); + + // + // Set the protocol version at the + // time the session is negotiated. + // + + protoStep_ = 0; +} + +Control::~Control() +{ + if (KillDaemonOnShutdown != NULL) + { + delete [] KillDaemonOnShutdown; + } + + if (HomePath != NULL) + { + delete [] HomePath; + } + + if (RootPath != NULL) + { + delete [] RootPath; + } + + if (SystemPath != NULL) + { + delete [] SystemPath; + } + + if (TempPath != NULL) + { + delete [] TempPath; + } + + if (ClientPath != NULL) + { + delete [] ClientPath; + } + + if (PersistentCachePath != NULL) + { + delete [] PersistentCachePath; + } + + if (PersistentCacheName != NULL) + { + delete [] PersistentCacheName; + } + + if (LocalUnpackMethods != NULL) + { + delete [] LocalUnpackMethods; + } + + if (RemoteUnpackMethods != NULL) + { + delete [] RemoteUnpackMethods; + } + + if (ImageCachePath != NULL) + { + delete [] ImageCachePath; + } +} + +// +// Set the protocol step based on the +// remote version. +// + +void Control::setProtoStep(int step) +{ + if (isValidProtoStep(step)) + { + protoStep_ = step; + } + else + { + #ifdef PANIC + *logofs << "Control: PANIC! Invalid protocol step " + << "with value " << step << ".\n" + << logofs_flush; + #endif + + HandleCleanup(); + } +} + +int Control::getProtoStep() +{ + if (isValidProtoStep(protoStep_)) + { + return protoStep_; + } + else + { + #ifdef PANIC + *logofs << "Control: PANIC! Can't identify the " + << "protocol step.\n" << logofs_flush; + #endif + + HandleCleanup(); + } +} + +// +// Set here the pack/unpack methods that are +// implemented by this NX proxy. +// + +void Control::setLocalUnpackMethods() +{ + LocalUnpackMethods = new unsigned char[PACK_METHOD_LIMIT]; + RemoteUnpackMethods = new unsigned char[PACK_METHOD_LIMIT]; + + for (int i = 0; i < PACK_METHOD_LIMIT; i++) + { + LocalUnpackMethods[i] = 0; + RemoteUnpackMethods[i] = 0; + } + + LocalUnpackMethods[NO_PACK] = 1; + + LocalUnpackMethods[PACK_MASKED_8_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_64_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_256_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_512_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_4K_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_32K_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_64K_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_256K_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_2M_COLORS] = 1; + LocalUnpackMethods[PACK_MASKED_16M_COLORS] = 1; + + LocalUnpackMethods[PACK_RAW_8_BITS] = 1; + LocalUnpackMethods[PACK_RAW_16_BITS] = 1; + LocalUnpackMethods[PACK_RAW_24_BITS] = 1; + + LocalUnpackMethods[PACK_COLORMAP_256_COLORS] = 1; + + LocalUnpackMethods[PACK_JPEG_8_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_64_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_256_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_512_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_4K_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_32K_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_64K_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_256K_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_2M_COLORS] = 1; + LocalUnpackMethods[PACK_JPEG_16M_COLORS] = 1; + + LocalUnpackMethods[PACK_PNG_8_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_64_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_256_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_512_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_4K_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_32K_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_64K_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_256K_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_2M_COLORS] = 1; + LocalUnpackMethods[PACK_PNG_16M_COLORS] = 1; + + LocalUnpackMethods[PACK_RGB_16M_COLORS] = 1; + LocalUnpackMethods[PACK_RLE_16M_COLORS] = 1; + + LocalUnpackMethods[PACK_ALPHA] = 1; + LocalUnpackMethods[PACK_COLORMAP] = 1; + + LocalUnpackMethods[PACK_BITMAP_16M_COLORS] = 1; +} diff --git a/nxcomp/src/Control.h b/nxcomp/src/Control.h new file mode 100644 index 000000000..764fca2c1 --- /dev/null +++ b/nxcomp/src/Control.h @@ -0,0 +1,764 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Control_H +#define Control_H + +#include "NXpack.h" + +#include "Misc.h" +#include "Types.h" +#include "Timestamp.h" +#include "Statistics.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// This is the mode proxy is running. +// + +typedef enum +{ + proxy_undefined = -1, + proxy_client, + proxy_server, + proxy_last_tag +} +T_proxy_mode; + +// +// Handle advances in the connection +// procedure. +// + +typedef enum +{ + stage_undefined, + stage_initializing, + stage_connecting, + stage_connected, + stage_waiting_forwarder_version, + stage_waiting_forwarder_options, + stage_sending_forwarder_options, + stage_waiting_proxy_version, + stage_waiting_proxy_options, + stage_sending_proxy_options, + stage_waiting_proxy_caches, + stage_sending_proxy_caches, + stage_operational, + stage_terminating, + stage_terminated +} +T_proxy_stage; + +// +// Hint about whether or not the proxy is +// connected to a NX agen. +// + +typedef enum +{ + session_undefined = -1, + session_agent, + session_shadow, + session_proxy, + session_last_tag +} +T_session_mode; + +// +// Set how data will be written to the peer +// socket. +// + +typedef enum +{ + policy_undefined = -1, + policy_immediate, + policy_deferred +} +T_flush_policy; + +// +// Link mode, after negotiation, will be set to +// any of the values defined in the NXproto.h. +// + +#define link_undefined -1; + +// +// This class collects functioning parameters, +// to be configurable at run-time. They are for +// the most part regarding timeouts, transport +// and message stores handling. +// + +class Control +{ + public: + + // + // Does proxy run in client mode or server mode? + // As soon as we'll have gone through parsing of + // the command line options the current mode will + // be propagated to the control class. + // + + T_proxy_mode ProxyMode; + + // + // Goes from initializing to operational. + // + + T_proxy_stage ProxyStage; + + // + // Hint about type of session currently running. + // + + T_session_mode SessionMode; + + // + // Either immediate or defferred flushes. + // + + T_flush_policy FlushPolicy; + + // + // If set, the channels will try to flush the + // encoded data whenever there is a prioritized + // message. Depending on the flush policy, this + // may determine an immediate flush or an event + // being generated telling to the agent that it + // should flush the proxy link. + // + + int FlushPriority; + + // + // Id corresponding to link speed negotiated + // between proxies. + // + + int LinkMode; + + // + // Set if the proxy is connected to a program + // providing the encryption of the point to + // point communication. + // + + int LinkEncrypted; + + // + // Maximum number of bytes sent for each token. + // + + int TokenSize; + + // + // Maximum number of tokens that can be spent + // by the client proxy before having to block + // waiting for a reply. + // + + int TokenLimit; + + // + // Bitmask used to determine the distribution + // of channel ids between the client and server + // proxies. + // + + int ChannelMask; + + // + // Kill session if control parameters cannot + // be negotiated before this timeout. + // + + int InitTimeout; + + // + // Enter the congestion state if the remote does + // not reply to the ping within the given amount + // of time. + // + + int PingTimeout; + + // + // Enqueue motion notify events in server channel. + // + + int MotionTimeout; + + // + // Force an update of the congestion counter if + // the proxy is idle for this time. + // + + int IdleTimeout; + + // + // Close the connection if can't write before + // this timeout. + // + + int ChannelTimeout; + + // + // Close connection if can't write before + // this timeout. + // + + int ProxyTimeout; + + // + // How many milliseconds to wait for the shared + // memory completion event to become available. + // + + int ShmemTimeout; + + // + // Wait for applications to complete at the time + // proxy is shut down. + // + + int CleanupTimeout; + + // + // Wait this amount of milliseconds before any + // iteration of the house-keeping process. + // + + int KeeperTimeout; + + // + // Adjust timeout calculations. + // + + int LatencyTimeout; + + // + // Maximum allowed size of log files. + // + + int FileSizeLimit; + int FileSizeCheckTimeout; + + // + // What do we do at the end of session? If + // this flag is set we launch a new client + // letting the user run a new NX session. + // + + int EnableRestartOnShutdown; + + // + // The client can request the proxy to kill + // a number of processes before exiting. + // + + int *KillDaemonOnShutdown; + int KillDaemonOnShutdownNumber; + int KillDaemonOnShutdownLimit; + + // + // Do we generate a core dump and exit in + // case of program errors? + // + + int EnableCoreDumpOnAbort; + + // + // Is statistic output enabled? + // + + int EnableStatistics; + + // + // Version number of local and remote proxy. + // + + /* + * LocalVersionMaintenancePatch, RemoteVersionMaintenancePatch + * CompatVersionMaintenancePatch + * + * currently not used, for future compatibility checks + */ + int LocalVersionMajor; + int LocalVersionMinor; + int LocalVersionPatch; + int LocalVersionMaintenancePatch; + + int RemoteVersionMajor; + int RemoteVersionMinor; + int RemoteVersionPatch; + int RemoteVersionMaintenancePatch; + + int CompatVersionMajor; + int CompatVersionMinor; + int CompatVersionPatch; + int CompatVersionMaintenancePatch; + + // + // Compatibility version for the proxy + // + + static const char* const NXPROXY_COMPATIBILITY_VERSION; + + // + // Which unpack methods are implemented in proxy? + // + + unsigned char *LocalUnpackMethods; + unsigned char *RemoteUnpackMethods; + + // + // Memory restriction imposed by user. + // + + int LocalMemoryLevel; + + // + // Use or not differential compression + // and caching of X protocol messages. + // + + int LocalDeltaCompression; + int RemoteDeltaCompression; + + // + // Compression of images and replies. + // + + int LocalDataCompression; + int LocalDataCompressionLevel; + + int RemoteDataCompression; + int RemoteDataCompressionLevel; + + // + // Minimum packet size to be compressed. + // + + int LocalDataCompressionThreshold; + + // + // Compress or not data flowing through the proxy + // link. Level should be one of the ZLIB level as + // Z_DEFAULT_COMPRESSION or Z_BEST_COMPRESSION. + // + + int LocalStreamCompression; + int LocalStreamCompressionLevel; + + int RemoteStreamCompression; + int RemoteStreamCompressionLevel; + + // + // Size of read operations in read buffer classes. + // + + int ClientInitialReadSize; + int ClientMaximumBufferSize; + + int ServerInitialReadSize; + int ServerMaximumBufferSize; + + int ProxyInitialReadSize; + int ProxyMaximumBufferSize; + + int GenericInitialReadSize; + int GenericMaximumBufferSize; + + // + // Set initial size and resize policy of + // transport buffers. If maximum size is + // exceeded, print a warning. + // + + int TransportXBufferSize; + int TransportProxyBufferSize; + int TransportGenericBufferSize; + + int TransportXBufferThreshold; + int TransportProxyBufferThreshold; + int TransportGenericBufferThreshold; + + int TransportMaximumBufferSize; + + // + // Flush the data produced for the channel + // connection if it exceeds this size. + // + + int TransportFlushBufferSize; + + // + // Socket options. + // + + int OptionProxyKeepAlive; + int OptionProxyLowDelay; + int OptionProxyClientNoDelay; + int OptionProxyServerNoDelay; + int OptionClientNoDelay; + int OptionServerNoDelay; + + int OptionProxyReceiveBuffer; + int OptionClientReceiveBuffer; + int OptionServerReceiveBuffer; + + int OptionProxySendBuffer; + int OptionClientSendBuffer; + int OptionServerSendBuffer; + + int OptionProxyRetryAccept; + int OptionProxyRetryConnect; + int OptionServerRetryConnect; + + // + // Calculate current bitrate on proxy link + // using these observation periods. Value + // is in milliseconds. + // + + int ShortBitrateTimeFrame; + int LongBitrateTimeFrame; + + // + // Limit the bandwidth usage of the proxy + // link. + // + + int LocalBitrateLimit; + + int ClientBitrateLimit; + int ServerBitrateLimit; + + // + // This is the limit imposed by user on + // total cache size. + // + + int ClientTotalStorageSize; + int ServerTotalStorageSize; + + int LocalTotalStorageSize; + int RemoteTotalStorageSize; + + // + // Discard messages in store older than + // this amount of seconds. + // + + int StoreTimeLimit; + + // + // Any new message in store starts with + // this amount of hits. + // + + int StoreHitsAddBonus; + + // + // Unless it is loaded from persistent + // cache. + // + + int StoreHitsLoadBonus; + + // + // Stop increasing hits at this threshold. + // + + int StoreHitsLimit; + + // + // Give a special weight to messages put or + // taken from cache during startup time. + // + + int StoreHitsStartup; + + // + // Weight of touch and untoch operations. + // + + int StoreHitsTouch; + int StoreHitsUntouch; + + // + // Directives on size of messages to cache. + // + + int MinimumMessageSize; + int MaximumMessageSize; + + // + // Maximum size of a single X request. + // + + int MaximumRequestSize; + + // + // Currently selected streaming mode. + // + + int SplitMode; + + // + // Send new split data any given amount of + // milliseconds. + // + + int SplitTimeout; + + // + // Maximum number of distinct messages and + // maximum size in bytes of the temporary + // storage. + // + + int SplitTotalSize; + int SplitTotalStorageSize; + + // + // Don't split messages smaller that this + // threshold and send no more than the + // given amount of bytes in a single data + // shot when streaming the split messages. + // + + int SplitDataThreshold; + int SplitDataPacketLimit; + + // + // Agent related parameters. These values apply + // to the agent which, at startup, must query + // the user's settings. + // + + int PackMethod; + int PackQuality; + int HideRender; + int TaintReplies; + int TaintThreshold; + + // + // Do we allow shared memory image support in + // client and or server? + // + + int ShmemClient; + int ShmemServer; + + // + // Default size of shared memory segments used + // in MIT-SHM support. + // + + int ShmemClientSize; + int ShmemServerSize; + + // + // The user's home directory. + // + + char *HomePath; + + // + // The ".nx" directory, usually in + // the user's home. + // + + char *RootPath; + + // + // Usually the /usr/NX" directory. + // + + char *SystemPath; + + // + // Usually the "/tmp" directory. + // + + char *TempPath; + + // + // The complete path to the client. + // + + char *ClientPath; + + // + // String containing path of cache + // file selected for load or save. + // + + char *PersistentCachePath; + + // + // Name of selected cache file. + // + + char *PersistentCacheName; + + // + // Minimum size of cache in memory + // to proceed to its storage on disk. + // + + int PersistentCacheThreshold; + + // + // Is persistent cache enabled? + // + + int PersistentCacheEnableLoad; + int PersistentCacheEnableSave; + + // + // This is used just for test because + // it requires that client and server + // reside on the same machine. + // + + int PersistentCacheCheckOnShutdown; + + // + // Load packed image and render extension + // message stores. This currently depends + // on the type of session. + // + + int PersistentCacheLoadPacked; + int PersistentCacheLoadRender; + + // + // Maximum disk consumption of message + // caches on disk. + // + + int PersistentCacheDiskLimit; + + // + // String containing the base path + // of image cache files. + // + + char *ImageCachePath; + + // + // Is image cache enabled? + // + + int ImageCacheEnableLoad; + int ImageCacheEnableSave; + + // + // Maximum disk consumption of image + // caches on disk. + // + + int ImageCacheDiskLimit; + + // + // Only constructor, destructor + // and a few utility functions. + // + + Control(); + + ~Control(); + + // + // Should not leverage control to find channel + // stores' size limits. As most of values in + // control, this info must be moved elsewhere. + // + + int getUpperStorageSize() const + { + return (ClientTotalStorageSize > + ServerTotalStorageSize ? + ClientTotalStorageSize : + ServerTotalStorageSize); + } + + int getLowerStorageSize() const + { + return (ClientTotalStorageSize < + ServerTotalStorageSize ? + ClientTotalStorageSize : + ServerTotalStorageSize); + } + + void setProtoStep(int step); + + int getProtoStep(); + + private: + + // + // Look in Control.cpp. + // + + void setLocalUnpackMethods(); + + // + // Manage the encoding according + // to the protocol version. + // + + int protoStep_; + + // + // Min and max values allowed for protocol step + // depending on protocol version compatibility + // + + static const int NX_MIN_PROTO_STEP; + static const int NX_MAX_PROTO_STEP; + + // + // Check the validity of protocol step + // + + bool isValidProtoStep(int step) + { + return ((step >= NX_MIN_PROTO_STEP) && (step <= NX_MAX_PROTO_STEP)); + } + +}; + +#endif /* Control_H */ diff --git a/nxcomp/src/CopyArea.cpp b/nxcomp/src/CopyArea.cpp new file mode 100644 index 000000000..c2a19c2df --- /dev/null +++ b/nxcomp/src/CopyArea.cpp @@ -0,0 +1,199 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "CopyArea.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +int CopyAreaStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + CopyAreaMessage *copyArea = (CopyAreaMessage *) message; + + // + // Here is the fingerprint. + // + + copyArea -> src_drawable = GetULONG(buffer + 4, bigEndian); + copyArea -> dst_drawable = GetULONG(buffer + 8, bigEndian); + copyArea -> gcontext = GetULONG(buffer + 12, bigEndian); + + copyArea -> src_x = GetUINT(buffer + 16, bigEndian); + copyArea -> src_y = GetUINT(buffer + 18, bigEndian); + copyArea -> dst_x = GetUINT(buffer + 20, bigEndian); + copyArea -> dst_y = GetUINT(buffer + 22, bigEndian); + + copyArea -> width = GetUINT(buffer + 24, bigEndian); + copyArea -> height = GetUINT(buffer + 26, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int CopyAreaStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + CopyAreaMessage *copyArea = (CopyAreaMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(copyArea -> src_drawable, buffer + 4, bigEndian); + PutULONG(copyArea -> dst_drawable, buffer + 8, bigEndian); + PutULONG(copyArea -> gcontext, buffer + 12, bigEndian); + + PutUINT(copyArea -> src_x, buffer + 16, bigEndian); + PutUINT(copyArea -> src_y, buffer + 18, bigEndian); + PutUINT(copyArea -> dst_x, buffer + 20, bigEndian); + PutUINT(copyArea -> dst_y, buffer + 22, bigEndian); + + PutUINT(copyArea -> width, buffer + 24, bigEndian); + PutUINT(copyArea -> height, buffer + 26, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void CopyAreaStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + CopyAreaMessage *copyArea = (CopyAreaMessage *) message; + + *logofs << name() << ": Identity src_drawable " << copyArea -> src_drawable + << ", dst_drawable " << copyArea -> dst_drawable << ", gcontext " << copyArea -> gcontext + << ", src_x " << copyArea -> src_x << ", src_y " << copyArea -> src_y + << ", dst_x " << copyArea -> dst_x << ", dst_y " << copyArea -> dst_y + << ", width " << copyArea -> width << ", height " << copyArea -> height + << ", size " << copyArea -> size_ << ".\n"; + + #endif +} + +void CopyAreaStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 16, 12); +} + +void CopyAreaStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + CopyAreaMessage *copyArea = (CopyAreaMessage *) message; + CopyAreaMessage *cachedCopyArea = (CopyAreaMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << copyArea -> src_drawable + << " as " << "src_drawable" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(copyArea -> src_drawable, clientCache -> drawableCache); + + cachedCopyArea -> src_drawable = copyArea -> src_drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << copyArea -> dst_drawable + << " as " << "dst_drawable" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(copyArea -> dst_drawable, clientCache -> drawableCache); + + cachedCopyArea -> dst_drawable = copyArea -> dst_drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << copyArea -> gcontext + << " as " << "gcontext" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(copyArea -> gcontext, clientCache -> gcCache); + + cachedCopyArea -> gcontext = copyArea -> gcontext; +} + +void CopyAreaStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + CopyAreaMessage *copyArea = (CopyAreaMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + copyArea -> src_drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << copyArea -> src_drawable + << " as " << "src_drawable" << " field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + copyArea -> dst_drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << copyArea -> dst_drawable + << " as " << "dst_drawable" << " field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + copyArea -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << copyArea -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/CopyArea.h b/nxcomp/src/CopyArea.h new file mode 100644 index 000000000..6b2617875 --- /dev/null +++ b/nxcomp/src/CopyArea.h @@ -0,0 +1,192 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef CopyArea_H +#define CopyArea_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define COPYAREA_ENABLE_CACHE 1 +#define COPYAREA_ENABLE_DATA 0 +#define COPYAREA_ENABLE_SPLIT 0 +#define COPYAREA_ENABLE_COMPRESS 0 + +#define COPYAREA_DATA_LIMIT 0 +#define COPYAREA_DATA_OFFSET 28 + +#define COPYAREA_CACHE_SLOTS 3000 +#define COPYAREA_CACHE_THRESHOLD 5 +#define COPYAREA_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class CopyAreaMessage : public Message +{ + friend class CopyAreaStore; + + public: + + CopyAreaMessage() + { + } + + ~CopyAreaMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int src_drawable; + unsigned int dst_drawable; + unsigned int gcontext; + unsigned short src_x; + unsigned short src_y; + unsigned short dst_x; + unsigned short dst_y; + unsigned short width; + unsigned short height; +}; + +class CopyAreaStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + CopyAreaStore() : MessageStore() + { + enableCache = COPYAREA_ENABLE_CACHE; + enableData = COPYAREA_ENABLE_DATA; + enableSplit = COPYAREA_ENABLE_SPLIT; + enableCompress = COPYAREA_ENABLE_COMPRESS; + + dataLimit = COPYAREA_DATA_LIMIT; + dataOffset = COPYAREA_DATA_OFFSET; + + cacheSlots = COPYAREA_CACHE_SLOTS; + cacheThreshold = COPYAREA_CACHE_THRESHOLD; + cacheLowerThreshold = COPYAREA_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~CopyAreaStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "CopyArea"; + } + + virtual unsigned char opcode() const + { + return X_CopyArea; + } + + virtual unsigned int storage() const + { + return sizeof(CopyAreaMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new CopyAreaMessage(); + } + + virtual Message *create(const Message &message) const + { + return new CopyAreaMessage((const CopyAreaMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (CopyAreaMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* CopyArea_H */ diff --git a/nxcomp/src/CreateGC.cpp b/nxcomp/src/CreateGC.cpp new file mode 100644 index 000000000..34978de13 --- /dev/null +++ b/nxcomp/src/CreateGC.cpp @@ -0,0 +1,194 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "CreateGC.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int CreateGCStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + CreateGCMessage *createGC = (CreateGCMessage *) message; + + // + // Here is the fingerprint. + // + + createGC -> gcontext = GetULONG(buffer + 4, bigEndian); + createGC -> drawable = GetULONG(buffer + 8, bigEndian); + createGC -> value_mask = GetULONG(buffer + 12, bigEndian); + + // + // Clear the unused bytes carried in the + // payload to increase the effectiveness + // of the caching algorithm. + // + + if ((int) size > dataOffset) + { + #ifdef DEBUG + *logofs << name() << ": Removing unused bytes from the " + << "data payload.\n" << logofs_flush; + #endif + + createGC -> value_mask &= (1 << 23) - 1; + + unsigned int mask = 0x1; + unsigned char *source = (unsigned char *) buffer + CREATEGC_DATA_OFFSET; + unsigned long value = 0; + + for (unsigned int i = 0; i < 23; i++) + { + if (createGC -> value_mask & mask) + { + value = GetULONG(source, bigEndian); + + value &= (0xffffffff >> (32 - CREATEGC_FIELD_WIDTH[i])); + + PutULONG(value, source, bigEndian); + + source += 4; + } + + mask <<= 1; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int CreateGCStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + CreateGCMessage *createGC = (CreateGCMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(createGC -> gcontext, buffer + 4, bigEndian); + PutULONG(createGC -> drawable, buffer + 8, bigEndian); + PutULONG(createGC -> value_mask, buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void CreateGCStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + CreateGCMessage *createGC = (CreateGCMessage *) message; + + *logofs << name() << ": Identity gcontext " << createGC -> gcontext << ", drawable " + << createGC -> drawable << ", value_mask " << createGC -> value_mask + << ", size " << createGC -> size_ << ".\n" << logofs_flush; + #endif +} + +void CreateGCStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // This didn't include the drawable + // in previous versions. + // + + md5_append(md5_state_, buffer + 8, 8); +} + +void CreateGCStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + CreateGCMessage *createGC = (CreateGCMessage *) message; + CreateGCMessage *cachedCreateGC = (CreateGCMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + // Since ProtoStep7 (#issue 108) + #ifdef TEST + *logofs << name() << ": Encoding value " << createGC -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeNewXidValue(createGC -> gcontext, clientCache -> lastId, + clientCache -> lastIdCache, clientCache -> gcCache, + clientCache -> freeGCCache); + + cachedCreateGC -> gcontext = createGC -> gcontext; +} + +void CreateGCStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + CreateGCMessage *createGC = (CreateGCMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeNewXidValue(value, clientCache -> lastId, + clientCache -> lastIdCache, clientCache -> gcCache, + clientCache -> freeGCCache); + + createGC -> gcontext = value; + + #ifdef TEST + *logofs << name() << ": Decoded value " << createGC -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/CreateGC.h b/nxcomp/src/CreateGC.h new file mode 100644 index 000000000..03e27d685 --- /dev/null +++ b/nxcomp/src/CreateGC.h @@ -0,0 +1,186 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef CreateGC_H +#define CreateGC_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define CREATEGC_ENABLE_CACHE 1 +#define CREATEGC_ENABLE_DATA 0 +#define CREATEGC_ENABLE_SPLIT 0 +#define CREATEGC_ENABLE_COMPRESS 0 + +#define CREATEGC_DATA_LIMIT 144 +#define CREATEGC_DATA_OFFSET 16 + +#define CREATEGC_CACHE_SLOTS 2000 +#define CREATEGC_CACHE_THRESHOLD 2 +#define CREATEGC_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class CreateGCMessage : public Message +{ + friend class CreateGCStore; + + public: + + CreateGCMessage() + { + } + + ~CreateGCMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int gcontext; + unsigned int drawable; + unsigned int value_mask; +}; + +class CreateGCStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + CreateGCStore() : MessageStore() + { + enableCache = CREATEGC_ENABLE_CACHE; + enableData = CREATEGC_ENABLE_DATA; + enableSplit = CREATEGC_ENABLE_SPLIT; + enableCompress = CREATEGC_ENABLE_COMPRESS; + + dataLimit = CREATEGC_DATA_LIMIT; + dataOffset = CREATEGC_DATA_OFFSET; + + cacheSlots = CREATEGC_CACHE_SLOTS; + cacheThreshold = CREATEGC_CACHE_THRESHOLD; + cacheLowerThreshold = CREATEGC_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~CreateGCStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "CreateGC"; + } + + virtual unsigned char opcode() const + { + return X_CreateGC; + } + + virtual unsigned int storage() const + { + return sizeof(CreateGCMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new CreateGCMessage(); + } + + virtual Message *create(const Message &message) const + { + return new CreateGCMessage((const CreateGCMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (CreateGCMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* CreateGC_H */ diff --git a/nxcomp/src/CreatePixmap.cpp b/nxcomp/src/CreatePixmap.cpp new file mode 100644 index 000000000..a60134cd5 --- /dev/null +++ b/nxcomp/src/CreatePixmap.cpp @@ -0,0 +1,280 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "CreatePixmap.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Constructors and destructors. +// + +CreatePixmapStore::CreatePixmapStore() + + : MessageStore() +{ + enableCache = CREATEPIXMAP_ENABLE_CACHE; + enableData = CREATEPIXMAP_ENABLE_DATA; + enableSplit = CREATEPIXMAP_ENABLE_SPLIT; + enableCompress = CREATEPIXMAP_ENABLE_COMPRESS; + + dataLimit = CREATEPIXMAP_DATA_LIMIT; + dataOffset = CREATEPIXMAP_DATA_OFFSET; + + cacheSlots = CREATEPIXMAP_CACHE_SLOTS; + cacheThreshold = CREATEPIXMAP_CACHE_THRESHOLD; + cacheLowerThreshold = CREATEPIXMAP_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +CreatePixmapStore::~CreatePixmapStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int CreatePixmapStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> depthCache); + + encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> drawableCache, + clientCache -> freeDrawableCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> windowCache); + + encodeBuffer.encodeCachedValue(GetUINT(buffer + 12, bigEndian), 16, + clientCache -> createPixmapXCache, 8); + + encodeBuffer.encodeCachedValue(GetUINT(buffer + 14, bigEndian), 16, + clientCache -> createPixmapYCache, 8); + + #ifdef TEST + *logofs << name() << ": Encoded message. Size is " + << size << ".\n" << logofs_flush; + #endif + + return 1; +} + +int CreatePixmapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned char cValue; + unsigned int value; + + size = 16; + + buffer = writeBuffer -> addMessage(size); + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + + *(buffer + 1) = cValue; + + decodeBuffer.decodeNewXidValue(value, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> drawableCache, + clientCache -> freeDrawableCache); + + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeXidValue(value, + clientCache -> windowCache); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> createPixmapXCache, 8); + + PutUINT(value, buffer + 12, bigEndian); + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> createPixmapYCache, 8); + + PutUINT(value, buffer + 14, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Size is " + << size << ".\n" << logofs_flush; + #endif + + return 1; +} + +int CreatePixmapStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; + + createPixmap -> depth = *(buffer + 1); + + createPixmap -> id = GetULONG(buffer + 4, bigEndian); + createPixmap -> drawable = GetULONG(buffer + 8, bigEndian); + + createPixmap -> width = GetUINT(buffer + 12, bigEndian); + createPixmap -> height = GetUINT(buffer + 14, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Size is " + << createPixmap -> size_ << " identity is " + << createPixmap -> i_size_ << ".\n" + << logofs_flush; + #endif + + return 1; +} + +int CreatePixmapStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; + + *(buffer + 1) = createPixmap -> depth; + + PutULONG(createPixmap -> id, buffer + 4, bigEndian); + PutULONG(createPixmap -> drawable, buffer + 8, bigEndian); + + PutUINT(createPixmap -> width, buffer + 12, bigEndian); + PutUINT(createPixmap -> height, buffer + 14, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Size is " + << createPixmap -> size_ << " identity is " + << createPixmap -> i_size_ << ".\n" + << logofs_flush; + #endif + + return 1; +} + +void CreatePixmapStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + #ifdef WARNING + *logofs << name() << ": WARNING! Dump of identity not implemented.\n" + << logofs_flush; + #endif + + #endif +} + +void CreatePixmapStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 8, 8); +} + +void CreatePixmapStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; + CreatePixmapMessage *cachedCreatePixmap = (CreatePixmapMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeNewXidValue(createPixmap -> id, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> drawableCache, + clientCache -> freeDrawableCache); + + cachedCreatePixmap -> id = createPixmap -> id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Size is " + << createPixmap -> size_ << " identity is " + << createPixmap -> i_size_ << ".\n" + << logofs_flush; + #endif +} + +void CreatePixmapStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + CreatePixmapMessage *createPixmap = (CreatePixmapMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeNewXidValue(createPixmap -> id, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> drawableCache, + clientCache -> freeDrawableCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Size is " + << createPixmap -> size_ << " identity is " + << createPixmap -> i_size_ << ".\n" + << logofs_flush; + #endif +} diff --git a/nxcomp/src/CreatePixmap.h b/nxcomp/src/CreatePixmap.h new file mode 100644 index 000000000..0a3212dd9 --- /dev/null +++ b/nxcomp/src/CreatePixmap.h @@ -0,0 +1,162 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef CreatePixmap_H +#define CreatePixmap_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define CREATEPIXMAP_ENABLE_CACHE 1 +#define CREATEPIXMAP_ENABLE_DATA 0 +#define CREATEPIXMAP_ENABLE_SPLIT 0 +#define CREATEPIXMAP_ENABLE_COMPRESS 0 + +#define CREATEPIXMAP_DATA_LIMIT 16 +#define CREATEPIXMAP_DATA_OFFSET 16 + +#define CREATEPIXMAP_CACHE_SLOTS 1000 +#define CREATEPIXMAP_CACHE_THRESHOLD 2 +#define CREATEPIXMAP_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class CreatePixmapMessage : public Message +{ + friend class CreatePixmapStore; + + public: + + CreatePixmapMessage() + { + } + + ~CreatePixmapMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char depth; + + unsigned int id; + unsigned int drawable; + + unsigned short width; + unsigned short height; +}; + +class CreatePixmapStore : public MessageStore +{ + public: + + CreatePixmapStore(); + + virtual ~CreatePixmapStore(); + + virtual const char *name() const + { + return "CreatePixmap"; + } + + virtual unsigned char opcode() const + { + return X_CreatePixmap; + } + + virtual unsigned int storage() const + { + return sizeof(CreatePixmapMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new CreatePixmapMessage(); + } + + virtual Message *create(const Message &message) const + { + return new CreatePixmapMessage((const CreatePixmapMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (CreatePixmapMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* CreatePixmap_H */ diff --git a/nxcomp/src/DecodeBuffer.cpp b/nxcomp/src/DecodeBuffer.cpp new file mode 100644 index 000000000..4c1530d9b --- /dev/null +++ b/nxcomp/src/DecodeBuffer.cpp @@ -0,0 +1,639 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Control.h" + +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +DecodeBuffer::DecodeBuffer(const unsigned char *data, unsigned int length) + + : buffer_(data), end_(buffer_ + length), nextSrc_(buffer_), srcMask_(0x80) +{ + // Since ProtoStep7 (#issue 108) + end_ = buffer_ + length - DECODE_BUFFER_POSTFIX_SIZE; +} + +int DecodeBuffer::decodeValue(unsigned int &value, unsigned int numBits, + unsigned int blockSize, int endOkay) +{ + #ifdef DUMP + *logofs << "DecodeBuffer: Decoding " << numBits + << " bits value with block " << blockSize + << " and " << (nextSrc_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + unsigned int result = 0; + unsigned int destMask = 0x1; + unsigned int bitsRead = 0; + + if (blockSize == 0) + blockSize = numBits; + + unsigned char nextSrcChar = *nextSrc_; + unsigned int numBlocks = 1; + + do + { + if (numBlocks == 4) + { + blockSize = numBits; + } + + unsigned int bitsToRead = (blockSize > numBits - bitsRead ? + numBits - bitsRead : blockSize); + unsigned int count = 0; + unsigned char lastBit; + + do + { + if (nextSrc_ >= end_) + { + if (!endOkay) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [A] " + << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) + << " end_ = " << (end_ - buffer_) << ".\n" + << logofs_flush; + #endif + + // + // Label "context" is just used to identify + // the routine which detected the problem in + // present source file. + // + + cerr << "Error" << ": Failure decoding data in context [A].\n"; + + HandleAbort(); + } + + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [B] " + << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) + << " end_ = " << (end_ - buffer_) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [B].\n"; + + HandleAbort(); + } + + lastBit = (nextSrcChar & srcMask_); + + if (lastBit) + result |= destMask; + + srcMask_ >>= 1; + + if (srcMask_ == 0) + { + srcMask_ = 0x80; + nextSrc_++; + nextSrcChar = *nextSrc_; + } + + destMask <<= 1; + } + while (bitsToRead > ++count); + + bitsRead += bitsToRead; + + if (bitsRead < numBits) + { + if (nextSrc_ >= end_) + { + if (!endOkay) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [C] " + << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) + << " end_ = " << (end_ - buffer_) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [C].\n"; + + HandleAbort(); + } + + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [D] " + << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) + << " end_ = " << (end_ - buffer_) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [D].\n"; + + HandleAbort(); + } + + unsigned char moreData = (nextSrcChar & srcMask_); + + srcMask_ >>= 1; + + if (srcMask_ == 0) + { + srcMask_ = 0x80; + nextSrc_++; + nextSrcChar = *nextSrc_; + } + + if (!moreData) + { + if (lastBit) + { + do + { + result |= destMask; + destMask <<= 1; + } + while (numBits > ++bitsRead); + } + else + bitsRead = numBits; + } + } + + blockSize >>= 1; + + if (blockSize < 2) + blockSize = 2; + + numBlocks++; + } + while (numBits > bitsRead); + + value = result; + + return 1; +} + +int DecodeBuffer::decodeCachedValue(unsigned int &value, unsigned int numBits, + IntCache &cache, unsigned int blockSize, + int endOkay) +{ + #ifdef DUMP + *logofs << "DecodeBuffer: Decoding " << numBits + << " bits cached value with block " << blockSize + << " and " << (nextSrc_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + if (nextSrc_ >= end_) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [E] " + << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) + << " end_ = " << (end_ - buffer_) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [E].\n"; + + HandleAbort(); + } + + unsigned int index = 0; + unsigned char nextSrcChar = *nextSrc_; + + while (!(nextSrcChar & srcMask_)) + { + index++; + srcMask_ >>= 1; + if (srcMask_ == 0) + { + srcMask_ = 0x80; + nextSrc_++; + if (nextSrc_ >= end_) + { + if (!endOkay) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [F] " + << "in decodeCachedValue() nextSrc_ = " + << (nextSrc_ - buffer_) << " end_ = " + << (end_ - buffer_) << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [F].\n"; + + HandleAbort(); + } + + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [G] " + << "in decodeValue() nextSrc_ = " << (nextSrc_ - buffer_) + << " end_ = " << (end_ - buffer_) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [G].\n"; + + HandleAbort(); + } + + nextSrcChar = *nextSrc_; + } + } + + srcMask_ >>= 1; + + if (srcMask_ == 0) + { + srcMask_ = 0x80; + nextSrc_++; + } + + if (index == 2) + { + // Since ProtoStep8 (#issue 108) + blockSize = cache.getBlockSize(blockSize); + + if (decodeValue(value, numBits, blockSize, endOkay)) + { + cache.insert(value, IntMask[numBits]); + + return 1; + } + + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [H] " + << "in decodeCacheValue() with no value found.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [H].\n"; + + HandleAbort(); + } + else + { + if (index > 2) + { + index--; + } + + if (index > cache.getSize()) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [I] " + << "in decodeCachedValue() index = " << index + << " cache size = " << cache.getSize() << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [I].\n"; + + HandleAbort(); + } + + value = cache.get(index); + + return 1; + } +} + +int DecodeBuffer::decodeCachedValue(unsigned char &value, unsigned int numBits, + CharCache &cache, unsigned int blockSize, + int endOkay) +{ + #ifdef DUMP + *logofs << "DecodeBuffer: Decoding " << numBits + << " bits char cached value with block " << blockSize + << " and " << nextSrc_ - buffer_ << " bytes read out of " + << end_ - buffer_ << ".\n" << logofs_flush; + #endif + + if (nextSrc_ >= end_) + { + #ifdef TEST + *logofs << "DecodeBuffer: End of buffer reached in context [J] with " + << nextSrc_ - buffer_ << " bytes read out of " + << end_ - buffer_ << ".\n" << logofs_flush; + #endif + + return 0; + } + + unsigned int index = 0; + unsigned char nextSrcChar = *nextSrc_; + + while (!(nextSrcChar & srcMask_)) + { + index++; + srcMask_ >>= 1; + + if (srcMask_ == 0) + { + srcMask_ = 0x80; + nextSrc_++; + + if (nextSrc_ >= end_) + { + if (!endOkay) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [K] " + << "in decodeCachedValue() nextSrc_ " + << (nextSrc_ - buffer_) << " end_ " << (end_ - buffer_) + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [K].\n"; + + HandleAbort(); + } + + #ifdef TEST + *logofs << "DecodeBuffer: End of buffer reached in context [L] with " + << nextSrc_ - buffer_ << " bytes read out of " + << end_ - buffer_ << ".\n" << logofs_flush; + #endif + + return 0; + } + + nextSrcChar = *nextSrc_; + } + } + + srcMask_ >>= 1; + + if (srcMask_ == 0) + { + srcMask_ = 0x80; + nextSrc_++; + } + + if (index == 2) + { + unsigned int temp; + + if (decodeValue(temp, numBits, blockSize, endOkay)) + { + value = (unsigned char) temp; + + cache.insert(value); + } + else + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [M] " + << "in decodeValue() with index = 2.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [M].\n"; + + HandleAbort(); + } + } + else + { + if (index > 2) + { + index--; + } + + if (index > cache.getSize()) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [N] " + << "in decodeCachedValue() " << "index = " << index + << " cache size = " << cache.getSize() << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [N].\n"; + + HandleAbort(); + } + + value = cache.get(index); + } + + return 1; +} + +// +// Simply returns a pointer to the correct spot in +// the internal buffer. If the caller needs this +// data to last beyond the lifetime of the internal +// buffer, it must copy the data in its own memory. +// + +const unsigned char *DecodeBuffer::decodeMemory(unsigned int numBytes) +{ + #ifdef DUMP + *logofs << "DecodeBuffer: Decoding " << numBytes + << " bytes of memory with " << (nextSrc_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + const unsigned char *result; + + // + // Force ourselves to a byte boundary. + // Is up to application to ensure data + // is word alligned when needed. + // + + if (srcMask_ != 0x80) + { + srcMask_ = 0x80; + nextSrc_++; + } + + result = nextSrc_; + + if (numBytes > DECODE_BUFFER_OVERFLOW_SIZE) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Can't decode a buffer of " + << numBytes << " bytes with limit set to " + << DECODE_BUFFER_OVERFLOW_SIZE << ".\n" + << logofs_flush; + + *logofs << "DecodeBuffer: PANIC! Assuming failure decoding " + << "data in context [O].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Should never decode buffer of size " + << "greater than " << DECODE_BUFFER_OVERFLOW_SIZE + << " bytes.\n"; + + cerr << "Error" << ": Assuming failure decoding data in " + << "context [O].\n"; + + HandleAbort(); + } + else if (end_ - nextSrc_ < (int) numBytes) + { + #ifdef PANIC + *logofs << "DecodeBuffer: PANIC! Assertion failed. Error [P] " + << "in decodeMemory() " << "with length " << numBytes + << " and " << (end_ - nextSrc_) + << " bytes remaining.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failure decoding data in context [P].\n"; + + HandleAbort(); + } + + nextSrc_ += numBytes; + + return result; +} + +void DecodeBuffer::decodeActionValue(unsigned char &value, unsigned short &position, + ActionCache &cache) +{ + unsigned int t; + + decodeCachedValue(t, 15, *(cache.base_[cache.slot_])); + + cache.last_ += t; + cache.last_ &= 0x7fff; + + value = cache.last_ >> 13; + + position = cache.last_ & 0x1fff; + + #ifdef DEBUG + *logofs << "DecodeBuffer: Decoded value " + << (unsigned) value << " and position " + << position << " with base " << cache.slot_ + << ".\n" << logofs_flush; + #endif + + #ifdef DEBUG + *logofs << "DecodeBuffer: Action block prediction is " + << (*(cache.base_[cache.slot_])).getBlockSize(15) + << ".\n" << logofs_flush; + #endif + + cache.slot_ = (cache.last_ & 0xff); +} + +void DecodeBuffer::decodeNewXidValue(unsigned int &value, unsigned int &lastId, + IntCache &lastIdCache, IntCache &cache, + FreeCache &freeCache) +{ + decodeCachedValue(value, 29, lastIdCache); + + lastId += (value + 1); + lastId &= 0x1fffffff; + + value = lastId; + + cache.push(value, 0x1fffffff); + + freeCache.push(value, 0x1fffffff); +} + +void DecodeBuffer::decodeNewXidValue(unsigned int &value, unsigned int &lastId, + IntCache &lastIdCache, XidCache &cache, + FreeCache &freeCache) +{ + decodeCachedValue(value, 29, lastIdCache); + + #ifdef DEBUG + *logofs << "DecodeBuffer: Decoded new Xid difference " + << value << ".\n" << logofs_flush; + #endif + + lastId += (value + 1); + lastId &= 0x1fffffff; + + value = lastId; + + unsigned int t = (value - cache.last_); + + cache.last_ = value; + + #ifdef DEBUG + *logofs << "DecodeBuffer: Decoded new Xid " << value + << " with base " << cache.slot_ << ".\n" + << logofs_flush; + #endif + + cache.slot_ = (value & 0xff); + + cache.base_[cache.slot_] -> push(t, 0x1fffffff); + + freeCache.push(value, 0x1fffffff); +} + +void DecodeBuffer::decodeXidValue(unsigned int &value, XidCache &cache) +{ + unsigned int t; + + decodeCachedValue(t, 29, *(cache.base_[cache.slot_])); + + cache.last_ += t; + cache.last_ &= 0x1fffffff; + + value = cache.last_; + + #ifdef DEBUG + *logofs << "DecodeBuffer: Decoded Xid " << value + << " with base " << cache.slot_ << ".\n" + << logofs_flush; + #endif + + cache.slot_ = (value & 0xff); + + #ifdef DEBUG + *logofs << "DecodeBuffer: Xid block prediction is " + << (*(cache.base_[cache.slot_])).getBlockSize(29) + << ".\n" << logofs_flush; + #endif +} + +void DecodeBuffer::decodeFreeXidValue(unsigned int &value, FreeCache &cache) +{ + decodeCachedValue(value, 29, cache); +} + diff --git a/nxcomp/src/DecodeBuffer.h b/nxcomp/src/DecodeBuffer.h new file mode 100644 index 000000000..f5f84c54f --- /dev/null +++ b/nxcomp/src/DecodeBuffer.h @@ -0,0 +1,138 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef DecodeBuffer_H +#define DecodeBuffer_H + +#include + +#include "IntCache.h" +#include "CharCache.h" +#include "XidCache.h" +#include "FreeCache.h" +#include "OpcodeCache.h" +#include "ActionCache.h" + +#define DECODE_BUFFER_OVERFLOW_SIZE 4194304 + +#define DECODE_BUFFER_POSTFIX_SIZE 1 + +class DecodeBuffer +{ + public: + + DecodeBuffer(const unsigned char *data, unsigned int length); + + ~DecodeBuffer() + { + } + + int decodeValue(unsigned int &value, unsigned int numBits, + unsigned int blockSize = 0, int endOkay = 0); + + int decodeCachedValue(unsigned int &value, unsigned int numBits, + IntCache &cache, unsigned int blockSize = 0, + int endOkay = 0); + + int decodeCachedValue(unsigned char &value, unsigned int numBits, + CharCache &cache, unsigned int blockSize = 0, + int endOkay = 0); + + void decodeDiffCachedValue(unsigned int &value, unsigned int &previous, + unsigned int numBits, IntCache &cache, + unsigned int blockSize = 0) + { + decodeCachedValue(value, numBits, cache, blockSize); + + previous += (value + 1); + previous &= (0xffffffff >> (32 - numBits)); + + value = previous; + } + + void decodeBoolValue(unsigned int &value) + { + decodeValue(value, 1); + } + + int decodeOpcodeValue(unsigned char &value, OpcodeCache &cache, int endOkay = 0) + { + int result = decodeCachedValue(value, 8, cache.base_[cache.slot_], 8, endOkay); + + if (result == 1) + { + cache.slot_ = value; + } + + return result; + } + + void decodeActionValue(unsigned char &value, unsigned short &position, + ActionCache &cache); + + void decodeNewXidValue(unsigned int &value, unsigned int &lastId, + IntCache &lastIdCache, IntCache &cache, + FreeCache &freeCache); + + void decodeNewXidValue(unsigned int &value, unsigned int &lastId, + IntCache &lastIdCache, XidCache &cache, + FreeCache &freeCache); + + void decodeXidValue(unsigned int &value, XidCache &cache); + + void decodeFreeXidValue(unsigned int &value, FreeCache &cache); + + void decodeTextData(unsigned char *buffer, unsigned int numBytes) + { + decodeMemory(buffer, numBytes); + } + + void decodeIntData(unsigned char *buffer, unsigned int numBytes) + { + decodeMemory(buffer, numBytes); + } + + void decodeLongData(unsigned char *buffer, unsigned int numBytes) + { + decodeMemory(buffer, numBytes); + } + + const unsigned char *decodeMemory(unsigned int numBytes); + + void decodeMemory(unsigned char *buffer, unsigned int numBytes) + { + memcpy(buffer, decodeMemory(numBytes), numBytes); + } + + private: + + const unsigned char *buffer_; + const unsigned char *end_; + const unsigned char *nextSrc_; + + unsigned char srcMask_; +}; + +#endif /* DecodeBuffer_H */ diff --git a/nxcomp/src/EncodeBuffer.cpp b/nxcomp/src/EncodeBuffer.cpp new file mode 100644 index 000000000..e112113a8 --- /dev/null +++ b/nxcomp/src/EncodeBuffer.cpp @@ -0,0 +1,623 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Control.h" + +#include "EncodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +#define ADVANCE_DEST \ +\ +if (destShift_ == 0) \ +{ \ + destShift_ = 7; nextDest_++; *nextDest_ = 0; \ +} \ +else \ +{ \ + destShift_--; \ +} + +EncodeBuffer::EncodeBuffer() +{ + size_ = ENCODE_BUFFER_DEFAULT_SIZE; + + buffer_ = new unsigned char[size_ + ENCODE_BUFFER_PREFIX_SIZE + + ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; + end_ = buffer_ + size_; + + nextDest_ = buffer_; + *nextDest_ = 0; + destShift_ = 7; + + lastBits_ = 0; + + initialSize_ = ENCODE_BUFFER_DEFAULT_SIZE; + thresholdSize_ = ENCODE_BUFFER_DEFAULT_SIZE << 1; + maximumSize_ = ENCODE_BUFFER_DEFAULT_SIZE << 4; +} + +EncodeBuffer::~EncodeBuffer() +{ + delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); +} + +void EncodeBuffer::setSize(unsigned int initialSize, unsigned int thresholdSize, + unsigned int maximumSize) +{ + initialSize_ = initialSize; + thresholdSize_ = thresholdSize; + maximumSize_ = maximumSize; + + #ifdef TEST + *logofs << "EncodeBuffer: Set buffer sizes to " + << initialSize_ << "/" << thresholdSize_ + << "/" << maximumSize_ << ".\n" + << logofs_flush; + #endif +} + +void EncodeBuffer::fullReset() +{ + if (size_ > initialSize_) + { + delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); + + size_ = initialSize_; + + buffer_ = new unsigned char[size_ + ENCODE_BUFFER_PREFIX_SIZE + + ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; + } + + end_ = buffer_ + size_; + + nextDest_ = buffer_; + *nextDest_ = 0; + destShift_ = 7; + + lastBits_ = 0; +} + +void EncodeBuffer::encodeValue(unsigned int value, unsigned int numBits, + unsigned int blockSize) +{ + #ifdef DUMP + *logofs << "EncodeBuffer: Encoding " << numBits + << " bits value with block " << blockSize + << " and " << (nextDest_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + value &= IntMask[numBits]; + + unsigned int srcMask = 0x1; + unsigned int bitsWritten = 0; + + if (blockSize == 0) + blockSize = numBits; + + if (end_ - nextDest_ < 8) + { + growBuffer(); + } + + unsigned int numBlocks = 1; + + do + { + if (numBlocks == 4) + blockSize = numBits; + + unsigned int bitsToWrite = (blockSize > numBits - bitsWritten ? + numBits - bitsWritten : blockSize); + unsigned int count = 0; + unsigned int lastBit; + + do + { + lastBit = (value & srcMask); + if (lastBit) + *nextDest_ |= (1 << destShift_); + ADVANCE_DEST; + srcMask <<= 1; + } + while (bitsToWrite > ++count); + + bitsWritten += bitsToWrite; + + if (bitsWritten < numBits) + { + unsigned int tmpMask = srcMask; + unsigned int i = bitsWritten; + + if (lastBit) + { + do + { + unsigned int nextBit = (value & tmpMask); + + if (!nextBit) + break; + + tmpMask <<= 1; + } + while (numBits > ++i); + } + else + { + do + { + unsigned int nextBit = (value & tmpMask); + + if (nextBit) + break; + + tmpMask <<= 1; + } + while (numBits > ++i); + } + + if (i < numBits) + *nextDest_ |= (1 << destShift_); + else + bitsWritten = numBits; + + ADVANCE_DEST; + } + blockSize >>= 1; + + if (blockSize < 2) + blockSize = 2; + + numBlocks++; + } + while (numBits > bitsWritten); +} + +void EncodeBuffer::encodeCachedValue(unsigned int value, unsigned int numBits, + IntCache &cache, unsigned int blockSize) +{ + #ifdef DUMP + *logofs << "EncodeBuffer: Encoding " << numBits + << " bits cached value with block " << blockSize + << " and " << (nextDest_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + value &= IntMask[numBits]; + + if (end_ - nextDest_ < 8) + { + growBuffer(); + } + + blockSize = cache.getBlockSize(blockSize); + + unsigned int index; + unsigned int sameDiff; + + #ifdef DUMP + + diffBits(); + + #endif + + if (cache.lookup(value, index, IntMask[numBits], sameDiff)) + { + if (index > 1) + index++; + + while (destShift_ < index) + { + index -= destShift_; + index--; + destShift_ = 7; + nextDest_++; + *nextDest_ = 0; + } + + destShift_ -= index; + *nextDest_ |= (1 << destShift_); + ADVANCE_DEST; + + #ifdef DUMP + *logofs << "EncodeBuffer: Encoded cached int using " + << diffBits() << " bits out of " << numBits + << ".\n" << logofs_flush; + #endif + } + else + { + ADVANCE_DEST; + ADVANCE_DEST; + *nextDest_ |= (1 << destShift_); + ADVANCE_DEST; + + // + // The attempt is very seldom successful. + // Avoid to encode the additional bool. + // + + // Since ProtoStep8 (#issue 108) + #ifdef DUMP + *logofs << "EncodeBuffer: Encoded missed int using " + << diffBits() << " bits out of " << numBits + << ".\n" << logofs_flush; + #endif + + encodeValue(value, numBits, blockSize); + } +} + +void EncodeBuffer::encodeCachedValue(unsigned char value, unsigned int numBits, + CharCache &cache, unsigned int blockSize) +{ + #ifdef DUMP + *logofs << "EncodeBuffer: Encoding " << numBits + << " bits char cached value with block " << blockSize + << " and " << (nextDest_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + value &= IntMask[numBits]; + + if (end_ - nextDest_ < 8) + { + growBuffer(); + } + + unsigned int index; + + #ifdef DUMP + + diffBits(); + + #endif + + if (cache.lookup(value, index)) + { + if (index > 1) + index++; + + while (destShift_ < index) + { + index -= destShift_; + index--; + destShift_ = 7; + nextDest_++; + *nextDest_ = 0; + } + + destShift_ -= index; + *nextDest_ |= (1 << destShift_); + ADVANCE_DEST; + + #ifdef DUMP + *logofs << "EncodeBuffer: Encoded cached char using " + << diffBits() << " bits out of " << numBits + << ".\n" << logofs_flush; + #endif + } + else + { + ADVANCE_DEST; + ADVANCE_DEST; + *nextDest_ |= (1 << destShift_); + ADVANCE_DEST; + + encodeValue(value, numBits, blockSize); + + #ifdef DUMP + *logofs << "EncodeBuffer: Encoded missed char using " + << diffBits() << " bits out of " << numBits + << ".\n" << logofs_flush; + #endif + } +} + +void EncodeBuffer::encodeMemory(const unsigned char *buffer, unsigned int numBytes) +{ + #ifdef DUMP + *logofs << "EncodeBuffer: Encoding " << numBytes + << " bytes of memory with " << (nextDest_ - buffer_) + << " bytes in buffer.\n" << logofs_flush; + #endif + + if (numBytes > ENCODE_BUFFER_OVERFLOW_SIZE) + { + #ifdef PANIC + *logofs << "EncodeBuffer: PANIC! Should never encode buffer " + << "of size greater than " << ENCODE_BUFFER_OVERFLOW_SIZE + << " bytes.\n" << logofs_flush; + + *logofs << "EncodeBuffer: PANIC! Assuming failure encoding data " + << "in context [A].\n" << logofs_flush; + #endif + + // + // Label "context" is just used to identify + // the routine which detected the problem in + // present source file. + // + + cerr << "Error" << ": Should never encode buffer of size " + << "greater than " << ENCODE_BUFFER_OVERFLOW_SIZE + << " bytes.\n"; + + cerr << "Error" << ": Assuming failure encoding data " + << "in context [A].\n" ; + + HandleAbort(); + } + + alignBuffer(); + + if (end_ - nextDest_ < (int) numBytes) + { + growBuffer(numBytes); + } + + memcpy(nextDest_, buffer, numBytes); + + nextDest_ += numBytes; + + if (nextDest_ == end_) + { + growBuffer(); + } + else if (nextDest_ > end_) + { + #ifdef PANIC + *logofs << "EncodeBuffer: PANIC! Assertion failed. Error [B] " + << "in encodeMemory() nextDest_ " << (nextDest_ - buffer) + << " end_ " << (end_ - buffer) << ".\n" + << logofs_flush; + #endif + + // + // Label "context" is just used to identify + // the routine which detected the problem in + // present source file. + // + + cerr << "Error" << ": Failure encoding raw data " + << "in context [B].\n" ; + + HandleAbort(); + } + + *nextDest_ = 0; +} + +unsigned int EncodeBuffer::getLength() const +{ + unsigned int length = nextDest_ - buffer_; + + if (destShift_ != 7) + { + length++; + } + + // Since ProtoStep7 (#issue 108) + if (length > 0) + { + return length + ENCODE_BUFFER_POSTFIX_SIZE; + } + + return length; +} + +unsigned int EncodeBuffer::diffBits() +{ + unsigned int bits = ((nextDest_ - buffer_) << 3); + + bits += (7 - destShift_); + + unsigned int diff = bits - lastBits_; + + lastBits_ = bits; + + return diff; +} + +void EncodeBuffer::growBuffer(unsigned int numBytes) +{ + if (numBytes == 0) + { + numBytes = initialSize_; + } + + unsigned int bytesInBuffer = nextDest_ - buffer_; + + unsigned int newSize = thresholdSize_; + + while (newSize < bytesInBuffer + numBytes) + { + newSize <<= 1; + + if (newSize > maximumSize_) + { + newSize = bytesInBuffer + numBytes + initialSize_; + } + } + + unsigned char *newBuffer; + + newBuffer = new unsigned char[newSize + ENCODE_BUFFER_PREFIX_SIZE + + ENCODE_BUFFER_POSTFIX_SIZE] + ENCODE_BUFFER_PREFIX_SIZE; + + if (newBuffer == NULL) + { + #ifdef PANIC + *logofs << "EncodeBuffer: PANIC! Error in context [C] " + << "growing buffer to accommodate " << numBytes + << " bytes .\n" << logofs_flush; + #endif + + cerr << "Error" << ": Error in context [C] " + << "growing encode buffer to accommodate " + << numBytes << " bytes.\n"; + + HandleAbort(); + } + + #ifdef TEST + if (newSize >= maximumSize_) + { + *logofs << "EncodeBuffer: WARNING! Buffer grown to reach " + << "size of " << newSize << " bytes.\n" + << logofs_flush; + } + #endif + + // + // Prefix should not contain any valid data. + // It is proxy that will fill it with control + // messages and data length at the time a new + // frame is written to socket. + // + + memcpy(newBuffer, buffer_, bytesInBuffer + 1); + + newBuffer[bytesInBuffer + 1] = 0; + + delete [] (buffer_ - ENCODE_BUFFER_PREFIX_SIZE); + + buffer_ = newBuffer; + size_ = newSize; + end_ = buffer_ + size_; + + nextDest_ = buffer_ + bytesInBuffer; +} + +void EncodeBuffer::alignBuffer() +{ + if (destShift_ != 7) + { + destShift_ = 7; + nextDest_++; + + if (nextDest_ >= end_) + { + growBuffer(); + } + + *nextDest_ = 0; + } +} + +void EncodeBuffer::encodeActionValue(unsigned char value, unsigned short position, + ActionCache &cache) +{ + unsigned int v = (value << 13) | position; + + unsigned int t = (v - cache.last_); + + encodeCachedValue(t, 15, *(cache.base_[cache.slot_])); + + cache.last_ = v; + + #ifdef DEBUG + *logofs << "EncodeBuffer: Encoded value " + << (unsigned) value << " and position " + << position << " with base " << cache.slot_ + << ".\n" << logofs_flush; + #endif + + cache.slot_ = (cache.last_ & 0xff); +} + +void EncodeBuffer::encodeNewXidValue(unsigned int value, unsigned int &lastId, + IntCache &lastIdCache, IntCache &cache, + FreeCache &freeCache) +{ + encodeCachedValue((value - 1) - lastId, 29, lastIdCache); + + lastId = value; + + cache.push(value, 0x1fffffff); + + freeCache.push(value, 0x1fffffff); +} + +void EncodeBuffer::encodeNewXidValue(unsigned int value, unsigned int &lastId, + IntCache &lastIdCache, XidCache &cache, + FreeCache &freeCache) +{ + encodeCachedValue((value - 1) - lastId, 29, lastIdCache); + + lastId = value; + + unsigned int t = (value - cache.last_); + + cache.last_ = value; + + #ifdef DEBUG + *logofs << "EncodeBuffer: Encoded new Xid " << value + << " with base " << cache.slot_ << ".\n" + << logofs_flush; + #endif + + cache.slot_ = (value & 0xff); + + cache.base_[cache.slot_] -> push(t, 0x1fffffff); + + freeCache.push(value, IntMask[29]); +} + +void EncodeBuffer::encodeXidValue(unsigned int value, XidCache &cache) +{ + unsigned int t = (value - cache.last_); + + encodeCachedValue(t, 29, *(cache.base_[cache.slot_])); + + cache.last_ = value; + + #ifdef DEBUG + *logofs << "EncodeBuffer: Encoded Xid " << value + << " with base " << cache.slot_ << ".\n" + << logofs_flush; + #endif + + cache.slot_ = (value & 0xff); +} + +void EncodeBuffer::encodeFreeXidValue(unsigned int value, FreeCache &cache) +{ + encodeCachedValue(value, 29, cache); +} diff --git a/nxcomp/src/EncodeBuffer.h b/nxcomp/src/EncodeBuffer.h new file mode 100644 index 000000000..67f6ff093 --- /dev/null +++ b/nxcomp/src/EncodeBuffer.h @@ -0,0 +1,183 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef EncodeBuffer_H +#define EncodeBuffer_H + +#include "IntCache.h" +#include "CharCache.h" +#include "XidCache.h" +#include "FreeCache.h" +#include "OpcodeCache.h" +#include "ActionCache.h" + +#define ENCODE_BUFFER_DEFAULT_SIZE 16384 + +// +// This should match the maximum size of +// a single message added to write buffer +// (see WriteBuffer.h). +// + +#define ENCODE_BUFFER_OVERFLOW_SIZE 4194304 + +// +// Adjust for the control messages and the +// frame length added by the proxy. +// + +#define ENCODE_BUFFER_PREFIX_SIZE 64 + +// +// The encode routines may write one byte +// past the nominal end of the encode buffer. +// This additional byte is included in the +// payload. This is actually a harmless bug. +// + +#define ENCODE_BUFFER_POSTFIX_SIZE 1 + +class EncodeBuffer +{ + public: + + EncodeBuffer(); + + ~EncodeBuffer(); + + void setSize(unsigned int initialSize, unsigned int thresholdSize, + unsigned int maximumSize); + + void encodeValue(unsigned int value, unsigned int numBits, + unsigned int blockSize = 0); + + void encodeCachedValue(unsigned int value, unsigned int numBits, + IntCache &cache, unsigned int blockSize = 0); + + void encodeCachedValue(unsigned char value, unsigned int numBits, + CharCache &cache, unsigned int blockSize = 0); + + void encodeDiffCachedValue(const unsigned int value, unsigned int &previous, + unsigned int numBits, IntCache &cache, + unsigned int blockSize = 0) + { + encodeCachedValue((value - 1) - previous, numBits, cache, blockSize); + + previous = value; + } + + void encodeBoolValue(unsigned int value) + { + encodeValue(value, 1); + } + + void encodeOpcodeValue(unsigned char value, OpcodeCache &cache) + { + encodeCachedValue(value, 8, cache.base_[cache.slot_], 8); + + cache.slot_ = value; + } + + void encodeActionValue(unsigned char value, ActionCache &cache) + { + unsigned short position = 0; + + encodeActionValue(value, position, cache); + } + + void encodeActionValue(unsigned char value, unsigned short position, + ActionCache &cache); + + void encodeNewXidValue(unsigned int value, unsigned int &lastId, + IntCache &lastIdCache, IntCache &cache, + FreeCache &freeCache); + + void encodeNewXidValue(unsigned int value, unsigned int &lastId, + IntCache &lastIdCache, XidCache &cache, + FreeCache &freeCache); + + void encodeXidValue(unsigned int value, XidCache &cache); + + void encodeFreeXidValue(unsigned int value, FreeCache &cache); + + void encodeTextData(const unsigned char *buffer, unsigned int numBytes) + { + encodeMemory(buffer, numBytes); + } + + void encodeIntData(const unsigned char *buffer, unsigned int numBytes) + { + encodeMemory(buffer, numBytes); + } + + void encodeLongData(const unsigned char *buffer, unsigned int numBytes) + { + encodeMemory(buffer, numBytes); + } + + void encodeMemory(const unsigned char *buffer, unsigned int numBytes); + + unsigned char *getData() + { + return buffer_; + } + + unsigned int getLength() const; + + unsigned int getBits() const + { + return ((nextDest_ - buffer_) << 3) + (7 - destShift_); + } + + unsigned int diffBits(); + + void fullReset(); + + private: + + void growBuffer(unsigned int numBytes = 0); + + void alignBuffer(); + + unsigned int size_; + unsigned char *buffer_; + + // + // This points to the first byte + // just beyond end of the buffer. + // + + const unsigned char *end_; + + unsigned char *nextDest_; + unsigned int destShift_; + unsigned int lastBits_; + + unsigned int initialSize_; + unsigned int thresholdSize_; + unsigned int maximumSize_; +}; + +#endif /* EncodeBuffer_H */ diff --git a/nxcomp/src/FillPoly.cpp b/nxcomp/src/FillPoly.cpp new file mode 100644 index 000000000..b5928d5cf --- /dev/null +++ b/nxcomp/src/FillPoly.cpp @@ -0,0 +1,239 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "FillPoly.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int FillPolyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + FillPolyMessage *fillPoly = (FillPolyMessage *) message; + + // + // Here is the fingerprint. + // + + fillPoly -> drawable = GetULONG(buffer + 4, bigEndian); + fillPoly -> gcontext = GetULONG(buffer + 8, bigEndian); + + fillPoly -> shape = *(buffer + 12); + fillPoly -> mode = *(buffer + 13); + + // Since ProtoStep8 (#issue 108) + if (size >= (unsigned int) dataOffset) + { + fillPoly -> x_origin = GetUINT(buffer + 16, bigEndian); + fillPoly -> y_origin = GetUINT(buffer + 18, bigEndian); + } + else + { + fillPoly -> x_origin = 0; + fillPoly -> y_origin = 0; + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int FillPolyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + FillPolyMessage *fillPoly = (FillPolyMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(fillPoly -> drawable, buffer + 4, bigEndian); + PutULONG(fillPoly -> gcontext, buffer + 8, bigEndian); + + *(buffer + 12) = fillPoly -> shape; + *(buffer + 13) = fillPoly -> mode; + + // Since ProtoStep8 (#issue 108) + if (size >= (unsigned int) dataOffset) + { + PutUINT(fillPoly -> x_origin, buffer + 16, bigEndian); + PutUINT(fillPoly -> y_origin, buffer + 18, bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void FillPolyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + FillPolyMessage *fillPoly = (FillPolyMessage *) message; + + *logofs << name() << ": Identity drawable " << fillPoly -> drawable + << ", gcontext " << fillPoly -> gcontext << ", shape " + << fillPoly -> shape << ", mode " << fillPoly -> mode + << fillPoly -> size_ << ", x_origin " << fillPoly -> x_origin + << ", y_origin " << fillPoly -> y_origin << ".\n" + << logofs_flush; + #endif +} + +void FillPolyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Fields shape, mode. + // + + md5_append(md5_state_, buffer + 12, 2); +} + +void FillPolyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + FillPolyMessage *fillPoly = (FillPolyMessage *) message; + FillPolyMessage *cachedFillPoly = (FillPolyMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << fillPoly -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(fillPoly -> drawable, clientCache -> drawableCache); + + cachedFillPoly -> drawable = fillPoly -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << fillPoly -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(fillPoly -> gcontext, clientCache -> gcCache); + + cachedFillPoly -> gcontext = fillPoly -> gcontext; + + // Since ProtoStep8 (#issue 108) + if (fillPoly -> size_ >= dataOffset) + { + #ifdef TEST + *logofs << name() << ": Encoding value " << fillPoly -> x_origin + << " as x_origin field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(fillPoly -> x_origin, 16, + *clientCache -> fillPolyXAbsCache[0], 8); + + cachedFillPoly -> x_origin = fillPoly -> x_origin; + + #ifdef TEST + *logofs << name() << ": Encoding value " << fillPoly -> y_origin + << " as y_origin field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(fillPoly -> y_origin, 16, + *clientCache -> fillPolyYAbsCache[0], 8); + + cachedFillPoly -> y_origin = fillPoly -> y_origin; + } +} + +void FillPolyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + FillPolyMessage *fillPoly = (FillPolyMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(fillPoly -> drawable, clientCache -> drawableCache); + + #ifdef TEST + *logofs << name() << ": Decoded value " << fillPoly -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(fillPoly -> gcontext, clientCache -> gcCache); + + #ifdef TEST + *logofs << name() << ": Decoded value " << fillPoly -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + // Since ProtoStep8 (#issue 108) + if (fillPoly -> size_ >= dataOffset) + { + unsigned int value; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> fillPolyXAbsCache[0], 8); + + fillPoly -> x_origin = value; + + #ifdef TEST + *logofs << name() << ": Decoded value " << fillPoly -> x_origin + << " as x_origin field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> fillPolyYAbsCache[0], 8); + + fillPoly -> y_origin = value; + + #ifdef TEST + *logofs << name() << ": Decoded value " << fillPoly -> y_origin + << " as y_origin field.\n" << logofs_flush; + #endif + } +} + + diff --git a/nxcomp/src/FillPoly.h b/nxcomp/src/FillPoly.h new file mode 100644 index 000000000..4ceb96c09 --- /dev/null +++ b/nxcomp/src/FillPoly.h @@ -0,0 +1,200 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef FillPoly_H +#define FillPoly_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define FILLPOLY_ENABLE_CACHE 1 +#define FILLPOLY_ENABLE_DATA 0 +#define FILLPOLY_ENABLE_SPLIT 0 +#define FILLPOLY_ENABLE_COMPRESS 0 + +#define FILLPOLY_DATA_LIMIT 512 + +#define FILLPOLY_CACHE_SLOTS 2000 +#define FILLPOLY_CACHE_THRESHOLD 3 +#define FILLPOLY_CACHE_LOWER_THRESHOLD 1 + +#define FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 20 + +// +// The message class. +// + +class FillPolyMessage : public Message +{ + friend class FillPolyStore; + + public: + + FillPolyMessage() + { + } + + ~FillPolyMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char shape; + unsigned char mode; + unsigned int drawable; + unsigned int gcontext; + + unsigned short x_origin; + unsigned short y_origin; +}; + +class FillPolyStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + FillPolyStore() : MessageStore() + { + enableCache = FILLPOLY_ENABLE_CACHE; + enableData = FILLPOLY_ENABLE_DATA; + enableSplit = FILLPOLY_ENABLE_SPLIT; + enableCompress = FILLPOLY_ENABLE_COMPRESS; + + dataLimit = FILLPOLY_DATA_LIMIT; + + // Since ProtoStep8 (#issue 108) + dataOffset = FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8; + + cacheSlots = FILLPOLY_CACHE_SLOTS; + cacheThreshold = FILLPOLY_CACHE_THRESHOLD; + cacheLowerThreshold = FILLPOLY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~FillPolyStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "FillPoly"; + } + + virtual unsigned char opcode() const + { + return X_FillPoly; + } + + virtual unsigned int storage() const + { + return sizeof(FillPolyMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new FillPolyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new FillPolyMessage((const FillPolyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (FillPolyMessage *) message; + } + + virtual int identitySize(const unsigned char *buffer, unsigned int size) + { + // Since ProtoStep8 (#issue 108) + return (size >= FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 ? + FILLPOLY_DATA_OFFSET_IF_PROTO_STEP_8 : size); + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* FillPoly_H */ diff --git a/nxcomp/src/Fork.cpp b/nxcomp/src/Fork.cpp new file mode 100644 index 000000000..657c36134 --- /dev/null +++ b/nxcomp/src/Fork.cpp @@ -0,0 +1,110 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "Fork.h" +#include "Misc.h" +#include "Timestamp.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Only on Cygwin, retry n times waiting a +// given amount of milliseconds after each +// attempt. +// + +#define RETRY_LIMIT 30 +#define RETRY_TIMEOUT 1000 + +int Fork() +{ + #ifdef __CYGWIN32__ + + int limit = RETRY_LIMIT; + int timeout = RETRY_TIMEOUT; + + #else + + int limit = 1; + int timeout = 0; + + #endif + + int pid = 0; + + for (int i = 0; i < limit; i++) + { + #ifdef TEST + *logofs << "Fork: Trying at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + // + // It could optionally try again only if the + // error code is 11, 'Resource temporarily + // unavailable'. + // + + if ((pid = fork()) >= 0) + { + break; + } + else if (i < limit - 1) + { + #ifdef WARNING + *logofs << "Fork: WARNING! Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'. Retrying...\n" << logofs_flush; + #endif + + usleep(timeout * 1000); + } + } + + #ifdef TEST + + if (pid <= 0) + { + *logofs << "Fork: Returning at " << strMsTimestamp() + << ".\n" << logofs_flush; + } + + #endif + + return pid; +} diff --git a/nxcomp/src/Fork.h b/nxcomp/src/Fork.h new file mode 100644 index 000000000..94238ed90 --- /dev/null +++ b/nxcomp/src/Fork.h @@ -0,0 +1,31 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +// +// Try again if the fork() fails, as it can happen +// often on Cygwin. +// + +extern int Fork(); diff --git a/nxcomp/src/FreeCache.h b/nxcomp/src/FreeCache.h new file mode 100644 index 000000000..bf5c801e5 --- /dev/null +++ b/nxcomp/src/FreeCache.h @@ -0,0 +1,42 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef FreeCache_H +#define FreeCache_H + +#include "IntCache.h" + +class FreeCache : public IntCache +{ + public: + + FreeCache(unsigned int size) + + : IntCache(size) + { + } +}; + +#endif /* FreeCache_H */ diff --git a/nxcomp/src/GenericChannel.cpp b/nxcomp/src/GenericChannel.cpp new file mode 100644 index 000000000..877412cee --- /dev/null +++ b/nxcomp/src/GenericChannel.cpp @@ -0,0 +1,495 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#include "GenericChannel.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "StaticCompressor.h" + +#include "Statistics.h" +#include "Proxy.h" + +extern Proxy *proxy; + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Log the important tracepoints related +// to writing packets to the peer proxy. +// + +#undef FLUSH + +// +// Define this to log when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// Here are the static members. +// + +#ifdef REFERENCES + +int GenericChannel::references_ = 0; + +#endif + +GenericChannel::GenericChannel(Transport *transport, StaticCompressor *compressor) + + : Channel(transport, compressor), readBuffer_(transport_, this) +{ + #ifdef REFERENCES + *logofs << "GenericChannel: Created new object at " + << this << " for FD#" << fd_ << " out of " + << ++references_ << " allocated channels.\n" + << logofs_flush; + #endif +} + +GenericChannel::~GenericChannel() +{ + #ifdef REFERENCES + *logofs << "GenericChannel: Deleted object at " + << this << " for FD#" << fd_ << " out of " + << --references_ << " allocated channels.\n" + << logofs_flush; + #endif +} + +// +// Beginning of handleRead(). +// + +int GenericChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length) +{ + #ifdef TEST + *logofs << "handleRead: Called for FD#" << fd_ + << " with " << encodeBuffer.getLength() + << " bytes already encoded.\n" + << logofs_flush; + #endif + + // + // Pointer to located message and + // its size in bytes. + // + + const unsigned char *inputMessage; + unsigned int inputLength; + + // + // Tag message as generic data in compression + // routine. Opcode is not actually transferred + // over the network. + // + + unsigned char inputOpcode = X_NXInternalGenericData; + + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: Trying to read from FD#" + << fd_ << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + int result = readBuffer_.readMessage(); + + #ifdef DEBUG + *logofs << "handleRead: Read result on FD#" << fd_ + << " is " << result << ".\n" + << logofs_flush; + #endif + + if (result < 0) + { + // + // Let the proxy close the channel. + // + + return -1; + } + else if (result == 0) + { + #if defined(TEST) || defined(INFO) + + *logofs << "handleRead: PANIC! No data read from FD#" + << fd_ << " while encoding messages.\n" + << logofs_flush; + + HandleCleanup(); + + #endif + + return 0; + } + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "handleRead: Encoding messages for FD#" << fd_ + << " with " << readBuffer_.getLength() << " bytes " + << "in the buffer.\n" << logofs_flush; + #endif + + // + // Divide the available data in multiple + // messages and encode them one by one. + // + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) + { + encodeBuffer.encodeValue(inputLength, 32, 14); + + if (isCompressed() == 1) + { + unsigned int compressedDataSize = 0; + unsigned char *compressedData = NULL; + + if (handleCompress(encodeBuffer, inputOpcode, 0, + inputMessage, inputLength, compressedData, + compressedDataSize) < 0) + { + return -1; + } + } + else + { + encodeBuffer.encodeMemory(inputMessage, inputLength); + } + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleRead: Handled generic data for FD#" << fd_ + << ". " << inputLength << " bytes in, " << bits << " bits (" + << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; + #endif + + addProtocolBits(inputLength << 3, bits); + + if (isPrioritized() == 1) + { + priority_++; + } + + } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) ... + + // + // All data has been read from the read buffer. + // We still need to mark the end of the encode + // buffer just before sending the frame. This + // allows us to accommodate multiple reads in + // a single frame. + // + + if (priority_ > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: WARNING! Requesting flush " + << "because of " << priority_ << " prioritized " + << "messages for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncPriority() < 0) + { + return -1; + } + + // + // Reset the priority flag. + // + + priority_ = 0; + } + + // + // Flush if we produced enough data. + // + + if (proxy -> canAsyncFlush() == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: WARNING! Requesting flush " + << "because of enough data or timeout on the " + << "proxy link.\n" << logofs_flush; + #endif + + if (proxy -> handleAsyncFlush() < 0) + { + return -1; + } + } + + #if defined(TEST) || defined(INFO) + + if (transport_ -> pending() != 0 || + readBuffer_.checkMessage() != 0) + { + *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" + << fd_ << " has " << transport_ -> pending() + << " bytes to read.\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Reset the read buffer. + // + + readBuffer_.fullReset(); + + return 1; +} + +// +// End of handleRead(). +// + +// +// Beginning of handleWrite(). +// + +int GenericChannel::handleWrite(const unsigned char *message, unsigned int length) +{ + #ifdef TEST + *logofs << "handleWrite: Called for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + // + // Create the buffer from which to + // decode messages. + // + + DecodeBuffer decodeBuffer(message, length); + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "handleWrite: Decoding messages for FD#" << fd_ + << " with " << length << " bytes in the buffer.\n" + << logofs_flush; + #endif + + unsigned char *outputMessage; + unsigned int outputLength; + + // + // Tag message as generic data + // in decompression. + // + + unsigned char outputOpcode = X_NXInternalGenericData; + + for (;;) + { + decodeBuffer.decodeValue(outputLength, 32, 14); + + if (outputLength == 0) + { + break; + } + + if (isCompressed() == 1) + { + if (writeBuffer_.getAvailable() < outputLength || + (int) outputLength >= control -> TransportFlushBufferSize) + { + #ifdef DEBUG + *logofs << "handleWrite: Using scratch buffer for " + << "generic data with size " << outputLength << " and " + << writeBuffer_.getLength() << " bytes in buffer.\n" + << logofs_flush; + #endif + + outputMessage = writeBuffer_.addScratchMessage(outputLength); + } + else + { + outputMessage = writeBuffer_.addMessage(outputLength); + } + + const unsigned char *compressedData = NULL; + unsigned int compressedDataSize = 0; + + int decompressed = handleDecompress(decodeBuffer, outputOpcode, 0, + outputMessage, outputLength, compressedData, + compressedDataSize); + if (decompressed < 0) + { + return -1; + } + } + else + { + #ifdef DEBUG + *logofs << "handleWrite: Using scratch buffer for " + << "generic data with size " << outputLength << " and " + << writeBuffer_.getLength() << " bytes in buffer.\n" + << logofs_flush; + #endif + + writeBuffer_.addScratchMessage((unsigned char *) + decodeBuffer.decodeMemory(outputLength), outputLength); + } + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: Handled generic data for FD#" << fd_ + << ". " << outputLength << " bytes out.\n" + << logofs_flush; + #endif + + handleFlush(flush_if_needed); + } + + // + // Write any remaining data to socket. + // + + if (handleFlush(flush_if_any) < 0) + { + return -1; + } + + return 1; +} + +// +// End of handleWrite(). +// + +// +// Other members. +// + +int GenericChannel::handleCompletion(EncodeBuffer &encodeBuffer) +{ + // + // Add the bits telling to the remote + // that all data in the frame has been + // encoded. + // + + if (encodeBuffer.getLength() > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleCompletion: Writing completion bits with " + << encodeBuffer.getLength() << " bytes encoded " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeValue(0, 32, 14); + + return 1; + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "handleCompletion: PANIC! No completion to write " + << "for FD#" << fd_ << ".\n" << logofs_flush; + + HandleCleanup(); + } + #endif + + return 0; +} + +int GenericChannel::handleConfiguration() +{ + #ifdef TEST + *logofs << "GenericChannel: Setting new buffer parameters.\n" + << logofs_flush; + #endif + + readBuffer_.setSize(control -> GenericInitialReadSize, + control -> GenericMaximumBufferSize); + + writeBuffer_.setSize(control -> TransportGenericBufferSize, + control -> TransportGenericBufferThreshold, + control -> TransportMaximumBufferSize); + + transport_ -> setSize(control -> TransportGenericBufferSize, + control -> TransportGenericBufferThreshold, + control -> TransportMaximumBufferSize); + + return 1; +} + +int GenericChannel::handleFinish() +{ + #ifdef TEST + *logofs << "GenericChannel: Finishing channel for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + congestion_ = 0; + priority_ = 0; + + finish_ = 1; + + transport_ -> fullReset(); + + return 1; +} + +int GenericChannel::setReferences() +{ + #ifdef TEST + *logofs << "GenericChannel: Initializing the static " + << "members for the generic channels.\n" + << logofs_flush; + #endif + + #ifdef REFERENCES + + references_ = 0; + + #endif + + return 1; +} diff --git a/nxcomp/src/GenericChannel.h b/nxcomp/src/GenericChannel.h new file mode 100644 index 000000000..3df18f444 --- /dev/null +++ b/nxcomp/src/GenericChannel.h @@ -0,0 +1,440 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GenericChannel_H +#define GenericChannel_H + +#include "Channel.h" + +#include "Statistics.h" + +#include "GenericReadBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#undef TEST +#undef DEBUG + +// +// Define this to log a line when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// This class implements the client +// side compression of X protocol. +// + +class GenericChannel : public Channel +{ + public: + + GenericChannel(Transport *transport, StaticCompressor *compressor); + + virtual ~GenericChannel(); + + virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length); + + virtual int handleWrite(const unsigned char *message, unsigned int length); + + + virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, + T_store_action action, int position, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) + { + return 0; + } + + virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, + T_store_action action, int position, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) + { + return 0; + } + + + virtual int handleSplit(EncodeBuffer &encodeBuffer) + { + return 0; + } + + virtual int handleSplit(DecodeBuffer &decodeBuffer) + { + return 0; + } + + virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split) + { + return 0; + } + + virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) + { + return 0; + } + + virtual int handleMotion(EncodeBuffer &encodeBuffer) + { + return 0; + } + + virtual int handleCompletion(EncodeBuffer &encodeBuffer); + + virtual int handleConfiguration(); + + virtual int handleFinish(); + + virtual int handleAsyncEvents() + { + return 0; + } + + virtual int needSplit() const + { + return 0; + } + + virtual int needMotion() const + { + return 0; + } + + virtual T_channel_type getType() const = 0; + + // + // Initialize the static members. + // + + static int setReferences(); + + protected: + + // + // Generic channels are considered to be + // in congestion state as soon as the + // socket is blocked for write. + // + + virtual int isCongested() + { + return (transport_ -> blocked() == 1); + } + + virtual int isReliable() + { + return 0; + } + + // + // Model generic channels' encoding and + // decoding policy. + // + + virtual int isCompressed() = 0; + + // + // Return true if the channel contains + // time sensitive data. + // + + virtual int isPrioritized() = 0; + + // + // Record the protocol bits for the + // specific service. + // + + virtual void addProtocolBits(unsigned int bitsIn, unsigned int bitsOut) = 0; + + // + // Channel's own read buffer. + // + + GenericReadBuffer readBuffer_; + + private: + + // + // Keep track of object's creation + // and deletion. + // + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +class CupsChannel : public GenericChannel +{ + public: + + CupsChannel(Transport *transport, StaticCompressor *compressor) + + : GenericChannel(transport, compressor) + { + } + + virtual ~CupsChannel() + { + } + + protected: + + virtual T_channel_type getType() const + { + return channel_cups; + } + + virtual int isCompressed() + { + // Since ProtoStep8 (#issue 108) + return 0; + } + + virtual int isPrioritized() + { + return 0; + } + + virtual void addProtocolBits(unsigned int bitsIn, + unsigned int bitsOut) + { + statistics -> addCupsBits(bitsIn, bitsOut); + } +}; + +class SmbChannel : public GenericChannel +{ + public: + + SmbChannel(Transport *transport, StaticCompressor *compressor) + + : GenericChannel(transport, compressor) + { + } + + virtual ~SmbChannel() + { + } + + protected: + + virtual T_channel_type getType() const + { + return channel_smb; + } + + virtual int isCompressed() + { + // Since ProtoStep8 (#issue 108) + return 0; + } + + virtual int isPrioritized() + { + return 0; + } + + virtual void addProtocolBits(unsigned int bitsIn, + unsigned int bitsOut) + { + statistics -> addSmbBits(bitsIn, bitsOut); + } +}; + +class MediaChannel : public GenericChannel +{ + public: + + MediaChannel(Transport *transport, StaticCompressor *compressor) + + : GenericChannel(transport, compressor) + { + } + + virtual ~MediaChannel() + { + } + + protected: + + virtual T_channel_type getType() const + { + return channel_media; + } + + // + // Don't try to compress the media data. + // + + virtual int isCompressed() + { + return 0; + } + + // + // Reduce the latency of media channels + // by setting them as prioritized, even + // if this will take away bandwidth from + // the X channels. + // + + virtual int isPrioritized() + { + return 1; + } + + virtual void addProtocolBits(unsigned int bitsIn, + unsigned int bitsOut) + { + statistics -> addMediaBits(bitsIn, bitsOut); + } +}; + +class HttpChannel : public GenericChannel +{ + public: + + HttpChannel(Transport *transport, StaticCompressor *compressor) + + : GenericChannel(transport, compressor) + { + } + + virtual ~HttpChannel() + { + } + + protected: + + virtual T_channel_type getType() const + { + return channel_http; + } + + virtual int isCompressed() + { + // Since ProtoStep8 (#issue 108) + return 0; + } + + virtual int isPrioritized() + { + return 0; + } + + virtual void addProtocolBits(unsigned int bitsIn, + unsigned int bitsOut) + { + statistics -> addHttpBits(bitsIn, bitsOut); + } +}; + +class FontChannel : public GenericChannel +{ + public: + + FontChannel(Transport *transport, StaticCompressor *compressor) + + : GenericChannel(transport, compressor) + { + } + + virtual ~FontChannel() + { + } + + protected: + + virtual T_channel_type getType() const + { + return channel_font; + } + + virtual int isCompressed() + { + // Since ProtoStep8 (#issue 108) + return 0; + } + + virtual int isPrioritized() + { + return 1; + } + + virtual void addProtocolBits(unsigned int bitsIn, + unsigned int bitsOut) + { + statistics -> addFontBits(bitsIn, bitsOut); + } +}; + +class SlaveChannel : public GenericChannel +{ + public: + + SlaveChannel(Transport *transport, StaticCompressor *compressor) + + : GenericChannel(transport, compressor) + { + } + + virtual ~SlaveChannel() + { + } + + protected: + + virtual T_channel_type getType() const + { + return channel_slave; + } + + virtual int isCompressed() + { + return 0; + } + + virtual int isPrioritized() + { + return 0; + } + + virtual void addProtocolBits(unsigned int bitsIn, + unsigned int bitsOut) + { + statistics -> addSlaveBits(bitsIn, bitsOut); + } +}; + +#endif /* GenericChannel_H */ diff --git a/nxcomp/src/GenericReadBuffer.cpp b/nxcomp/src/GenericReadBuffer.cpp new file mode 100644 index 000000000..78217157e --- /dev/null +++ b/nxcomp/src/GenericReadBuffer.cpp @@ -0,0 +1,82 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GenericReadBuffer.h" + +#include "GenericChannel.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +unsigned int GenericReadBuffer::suggestedLength(unsigned int pendingLength) +{ + // + // Always read the initial read size. + // + + return 0; +} + +int GenericReadBuffer::locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength) +{ + // + // We don't care about the endianess + // in generic channels. + // + + unsigned int size = end - start; + + #ifdef TEST + *logofs << "GenericReadBuffer: Locating message for FD#" + << transport_ -> fd() << " with " << size + << " bytes.\n" << logofs_flush; + #endif + + if (size == 0) + { + remaining_ = 1; + + return 0; + } + + dataLength = size; + + controlLength = 0; + trailerLength = 0; + + remaining_ = 0; + + return 1; +} diff --git a/nxcomp/src/GenericReadBuffer.h b/nxcomp/src/GenericReadBuffer.h new file mode 100644 index 000000000..5ea4d939d --- /dev/null +++ b/nxcomp/src/GenericReadBuffer.h @@ -0,0 +1,61 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GenericReadBuffer_H +#define GenericReadBuffer_H + +#include "ReadBuffer.h" +#include "Control.h" + +class GenericChannel; + +class GenericReadBuffer : public ReadBuffer +{ + public: + + GenericReadBuffer(Transport *transport, GenericChannel *channel) + + : ReadBuffer(transport), channel_(channel) + { + } + + virtual ~GenericReadBuffer() + { + } + + protected: + + virtual unsigned int suggestedLength(unsigned int pendingLength); + + virtual int locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength); + + GenericChannel *channel_; +}; + +#endif /* GenericReadBuffer_H */ diff --git a/nxcomp/src/GenericReply.cpp b/nxcomp/src/GenericReply.cpp new file mode 100644 index 000000000..b56e579e8 --- /dev/null +++ b/nxcomp/src/GenericReply.cpp @@ -0,0 +1,302 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GenericReply.h" + +#include "ServerCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +GenericReplyStore::GenericReplyStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = GENERICREPLY_ENABLE_CACHE; + enableData = GENERICREPLY_ENABLE_DATA; + enableSplit = GENERICREPLY_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = GENERICREPLY_DATA_LIMIT; + dataOffset = GENERICREPLY_DATA_OFFSET; + + cacheSlots = GENERICREPLY_CACHE_SLOTS; + cacheThreshold = GENERICREPLY_CACHE_THRESHOLD; + cacheLowerThreshold = GENERICREPLY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +GenericReplyStore::~GenericReplyStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int GenericReplyStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ServerCache *serverCache = (ServerCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" + << logofs_flush; + #endif + + encodeBuffer.encodeValue(GetULONG(buffer + 4, bigEndian), 32, 15); + + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + serverCache -> genericReplyCharCache); + + for (unsigned int i = 0; i < 6; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(buffer + i * 4 + 8, bigEndian), 32, + *serverCache -> genericReplyIntCache[i]); + } + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" + << logofs_flush; + #endif + + return 1; +} + +int GenericReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ServerCache *serverCache = (ServerCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" + << logofs_flush; + #endif + + decodeBuffer.decodeValue(size, 32, 15); + + size = 32 + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + decodeBuffer.decodeCachedValue(*(buffer + 1), 8, + serverCache -> genericReplyCharCache); + + unsigned int value; + + for (unsigned int i = 0; i < 6; i++) + { + decodeBuffer.decodeCachedValue(value, 32, + *serverCache -> genericReplyIntCache[i]); + + PutULONG(value, buffer + i * 4 + 8, bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" + << logofs_flush; + #endif + + return 1; +} + +int GenericReplyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GenericReplyMessage *genericReply = (GenericReplyMessage *) message; + + genericReply -> byte_data = *(buffer + 1); + + for (int i = 0; i < 12; i++) + { + genericReply -> short_data[i] = GetUINT(buffer + i * 2 + 8, bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int GenericReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GenericReplyMessage *genericReply = (GenericReplyMessage *) message; + + *(buffer + 1) = genericReply -> byte_data; + + for (int i = 0; i < 12; i++) + { + PutUINT(genericReply -> short_data[i], buffer + i * 2 + 8, bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void GenericReplyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + GenericReplyMessage *genericReply = (GenericReplyMessage *) message; + + *logofs << name() << ": Identity byte_data " + << (unsigned) genericReply -> byte_data; + + for (int i = 0; i < 12; i++) + { + *logofs << ", short_data[" << i << "]" + << (unsigned) genericReply -> short_data[i]; + } + + *logofs << ", size " << genericReply -> size_ << ".\n"; + + #endif +} + +void GenericReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void GenericReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + GenericReplyMessage *genericReply = (GenericReplyMessage *) message; + GenericReplyMessage *cachedGenericReply = (GenericReplyMessage *) cachedMessage; + + ServerCache *serverCache = (ServerCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " + << (unsigned int) genericReply -> byte_data + << " as byte_data field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(genericReply -> byte_data, 8, + serverCache -> genericReplyCharCache); + + cachedGenericReply -> byte_data = genericReply -> byte_data; + + for (unsigned int i = 0; i < 12; i++) + { + #ifdef TEST + *logofs << name() << ": Encoding value " << genericReply -> short_data[i] + << " as short_data[" << i << "] field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(genericReply -> short_data[i], 16, + *serverCache -> genericReplyIntCache[i]); + + cachedGenericReply -> short_data[i] = genericReply -> short_data[i]; + } +} + +void GenericReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + // + // Decode the variant part. + // + + GenericReplyMessage *genericReply = (GenericReplyMessage *) message; + + ServerCache *serverCache = (ServerCache *) channelCache; + + decodeBuffer.decodeCachedValue(genericReply -> byte_data, 8, + serverCache -> genericReplyCharCache); + + #ifdef TEST + *logofs << name() << ": Decoded value " + << (unsigned int) genericReply -> byte_data + << " as byte_data field.\n" << logofs_flush; + #endif + + unsigned int value; + + for (unsigned int i = 0; i < 12; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *serverCache -> genericReplyIntCache[i]); + + genericReply -> short_data[i] = (unsigned short) value; + + #ifdef TEST + *logofs << name() << ": Decoded value " << genericReply -> short_data[i] + << " as short_data[" << i << "] field.\n" << logofs_flush; + #endif + } +} diff --git a/nxcomp/src/GenericReply.h b/nxcomp/src/GenericReply.h new file mode 100644 index 000000000..e899b8467 --- /dev/null +++ b/nxcomp/src/GenericReply.h @@ -0,0 +1,161 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GenericReply_H +#define GenericReply_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define GENERICREPLY_ENABLE_CACHE 1 +#define GENERICREPLY_ENABLE_DATA 1 +#define GENERICREPLY_ENABLE_SPLIT 0 + +#define GENERICREPLY_DATA_LIMIT 1048576 - 32 +#define GENERICREPLY_DATA_OFFSET 32 + +#define GENERICREPLY_CACHE_SLOTS 400 +#define GENERICREPLY_CACHE_THRESHOLD 5 +#define GENERICREPLY_CACHE_LOWER_THRESHOLD 1 + +#define GENERICREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class GenericReplyMessage : public Message +{ + friend class GenericReplyStore; + + public: + + GenericReplyMessage() + { + } + + ~GenericReplyMessage() + { + } + + // + // Put here the fields which constitute the + // 'identity' part of the message. Starting + // from protocol level 3 we use short data + // to increase cache efficiency. + // + + private: + + unsigned char byte_data; + unsigned int int_data[6]; + unsigned short short_data[12]; +}; + +class GenericReplyStore : public MessageStore +{ + public: + + GenericReplyStore(StaticCompressor *compressor); + + virtual ~GenericReplyStore(); + + virtual const char *name() const + { + return "GenericReply"; + } + + virtual unsigned char opcode() const + { + return X_NXInternalGenericReply; + } + + virtual unsigned int storage() const + { + return sizeof(GenericReplyMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new GenericReplyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new GenericReplyMessage((const GenericReplyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (GenericReplyMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* GenericReply_H */ diff --git a/nxcomp/src/GenericRequest.cpp b/nxcomp/src/GenericRequest.cpp new file mode 100644 index 000000000..c569d6a24 --- /dev/null +++ b/nxcomp/src/GenericRequest.cpp @@ -0,0 +1,334 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GenericRequest.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +GenericRequestStore::GenericRequestStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = GENERICREQUEST_ENABLE_CACHE; + enableData = GENERICREQUEST_ENABLE_DATA; + enableSplit = GENERICREQUEST_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = GENERICREQUEST_DATA_LIMIT; + dataOffset = GENERICREQUEST_DATA_OFFSET; + + cacheSlots = GENERICREQUEST_CACHE_SLOTS; + cacheThreshold = GENERICREQUEST_CACHE_THRESHOLD; + cacheLowerThreshold = GENERICREQUEST_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +GenericRequestStore::~GenericRequestStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int GenericRequestStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + encodeBuffer.encodeValue(size >> 2, 16, 10); + + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> genericRequestOpcodeCache); + + for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) + { + #ifdef DEBUG + *logofs << name() << ": Encoding data[" << i << "] " + << "at position " << i * 2 + 4 << " with value " + << GetUINT(buffer + (i * 2) + 4, bigEndian) + << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(GetUINT(buffer + (i * 2) + 4, bigEndian), 16, + *clientCache -> genericRequestDataCache[i]); + } + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int GenericRequestStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + decodeBuffer.decodeValue(size, 16, 10); + + size <<= 2; + + buffer = writeBuffer -> addMessage(size); + + decodeBuffer.decodeCachedValue(*(buffer + 1), 8, + clientCache -> genericRequestOpcodeCache); + + unsigned int value; + + for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> genericRequestDataCache[i]); + + #ifdef DEBUG + *logofs << name() << ": Decoding data[" << i << "] " + << "at position " << i * 2 + 4 << " with value " + << value << ".\n" << logofs_flush; + #endif + + PutUINT(value, buffer + 4 + (i * 2), bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int GenericRequestStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; + + genericRequest -> opcode = *(buffer + 1); + + for (unsigned int i = 0; i < 8; i++) + { + if ((i * 2 + 4) < size) + { + genericRequest -> data[i] = GetUINT(buffer + i * 2 + 4, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed data[" << i << "] " + << "with value " << genericRequest -> data[i] + << ".\n" << logofs_flush; + #endif + } + else + { + genericRequest -> data[i] = 0; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int GenericRequestStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; + + *(buffer + 1) = genericRequest -> opcode; + + for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) + { + #ifdef DEBUG + *logofs << name() << ": Unparsed data[" << i << "] " + << "with value " << genericRequest -> data[i] + << ".\n" << logofs_flush; + #endif + + PutUINT(genericRequest -> data[i], buffer + i * 2 + 4, bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void GenericRequestStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; + + *logofs << name() << ": Identity opcode " << (unsigned) genericRequest -> opcode; + + for (int i = 0; i < 8; i++) + { + *logofs << ", data[" << i << "] " << genericRequest -> data[i]; + } + + *logofs << ", size " << genericRequest -> size_ << ".\n" << logofs_flush; + + #endif +} + +void GenericRequestStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // As data offset can be beyond the real end of + // the message, we need to include the message's + // size or we will match any message whose size + // is less or equal to the data offset. + // + + md5_append(md5_state_, buffer + 2, 2); +} + +void GenericRequestStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; + GenericRequestMessage *cachedGenericRequest = (GenericRequestMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Updating value " + << (unsigned) genericRequest -> opcode + << " as opcode field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((unsigned int) genericRequest -> opcode, 8, + clientCache -> genericRequestOpcodeCache); + + cachedGenericRequest -> opcode = genericRequest -> opcode; + + for (int i = 0; i < 8 && (i * 2 + 4) < genericRequest -> size_; i++) + { + #ifdef TEST + *logofs << name() << ": Updating data[" << i << "] " + << "with value " << genericRequest -> data[i] + << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((unsigned int) genericRequest -> data[i], 16, + *clientCache -> genericRequestDataCache[i]); + + cachedGenericRequest -> data[i] = genericRequest -> data[i]; + } +} + +void GenericRequestStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + GenericRequestMessage *genericRequest = (GenericRequestMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(genericRequest -> opcode, 8, + clientCache -> genericRequestOpcodeCache); + + #ifdef TEST + *logofs << name() << ": Updated value " + << (unsigned) genericRequest -> opcode + << " as opcode field.\n" << logofs_flush; + #endif + + unsigned int value; + + for (int i = 0; i < 8 && (i * 2 + 4) < genericRequest -> size_; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> genericRequestDataCache[i]); + + genericRequest -> data[i] = (unsigned short) value; + + #ifdef TEST + *logofs << name() << ": Updated data[" << i << "] " + << "with value " << genericRequest -> data[i] + << ".\n" << logofs_flush; + #endif + } +} diff --git a/nxcomp/src/GenericRequest.h b/nxcomp/src/GenericRequest.h new file mode 100644 index 000000000..13ffea718 --- /dev/null +++ b/nxcomp/src/GenericRequest.h @@ -0,0 +1,160 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GenericRequest_H +#define GenericRequest_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define GENERICREQUEST_ENABLE_CACHE 1 +#define GENERICREQUEST_ENABLE_DATA 1 +#define GENERICREQUEST_ENABLE_SPLIT 0 + +#define GENERICREQUEST_DATA_LIMIT 262144 - 20 +#define GENERICREQUEST_DATA_OFFSET 20 + +#define GENERICREQUEST_CACHE_SLOTS 400 +#define GENERICREQUEST_CACHE_THRESHOLD 5 +#define GENERICREQUEST_CACHE_LOWER_THRESHOLD 1 + +#define GENERICREQUEST_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class GenericRequestMessage : public Message +{ + friend class GenericRequestStore; + + public: + + GenericRequestMessage() + { + } + + ~GenericRequestMessage() + { + } + + // + // Note that we consider for this message a data offset + // of 4 (or 20 starting from protocol 3). Bytes from 9 + // to 20, if present, are taken as part of identity and + // encoded through an array of int caches. + // + + private: + + unsigned char opcode; + unsigned short data[8]; +}; + +class GenericRequestStore : public MessageStore +{ + public: + + GenericRequestStore(StaticCompressor *compressor); + + virtual ~GenericRequestStore(); + + virtual const char *name() const + { + return "GenericRequest"; + } + + virtual unsigned char opcode() const + { + return X_NXInternalGenericRequest; + } + + virtual unsigned int storage() const + { + return sizeof(GenericRequestMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new GenericRequestMessage(); + } + + virtual Message *create(const Message &message) const + { + return new GenericRequestMessage((const GenericRequestMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (GenericRequestMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* GenericRequest_H */ diff --git a/nxcomp/src/GetImage.cpp b/nxcomp/src/GetImage.cpp new file mode 100644 index 000000000..20b6a07d1 --- /dev/null +++ b/nxcomp/src/GetImage.cpp @@ -0,0 +1,177 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GetImage.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int GetImageStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetImageMessage *getImage = (GetImageMessage *) message; + + // + // Here is the fingerprint. + // + + getImage -> format = *(buffer + 1); + + #ifdef TEST + if (getImage -> format != 1 && getImage -> format != 2) + { + *logofs << name() << ": WARNING! Dirty value " << getImage -> format + << " for field format.\n" << logofs_flush; + } + #endif + + getImage -> drawable = GetULONG(buffer + 4, bigEndian); + + getImage -> x = GetUINT(buffer + 8, bigEndian); + getImage -> y = GetUINT(buffer + 10, bigEndian); + getImage -> width = GetUINT(buffer + 12, bigEndian); + getImage -> height = GetUINT(buffer + 14, bigEndian); + + getImage -> plane_mask = GetULONG(buffer + 16, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int GetImageStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetImageMessage *getImage = (GetImageMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = getImage -> format; + + PutULONG(getImage -> drawable, buffer + 4, bigEndian); + + PutUINT(getImage -> x, buffer + 8, bigEndian); + PutUINT(getImage -> y, buffer + 10, bigEndian); + PutUINT(getImage -> width, buffer + 12, bigEndian); + PutUINT(getImage -> height, buffer + 14, bigEndian); + + PutULONG(getImage -> plane_mask, buffer + 16, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void GetImageStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + GetImageMessage *getImage = (GetImageMessage *) message; + + *logofs << name() << ": Identity format " << (unsigned) getImage -> format + << ", drawable " << getImage -> drawable << ", x " << getImage -> x + << ", y " << getImage -> y << ", width " << getImage -> width + << ", height " << getImage -> height << ", plane_mask " + << getImage -> plane_mask << ", size " << getImage -> size_ + << ".\n" << logofs_flush; + + #endif +} + +void GetImageStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 8, 2); + md5_append(md5_state_, buffer + 10, 2); + md5_append(md5_state_, buffer + 12, 2); + md5_append(md5_state_, buffer + 14, 2); + md5_append(md5_state_, buffer + 16, 4); +} + +void GetImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + GetImageMessage *getImage = (GetImageMessage *) message; + GetImageMessage *cachedGetImage = (GetImageMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << getImage -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(getImage -> drawable, clientCache -> drawableCache); + + cachedGetImage -> drawable = getImage -> drawable; +} + +void GetImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + GetImageMessage *getImage = (GetImageMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + getImage -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << getImage -> drawable + << " as drawable field.\n" << logofs_flush; + #endif +} + diff --git a/nxcomp/src/GetImage.h b/nxcomp/src/GetImage.h new file mode 100644 index 000000000..1c3558d14 --- /dev/null +++ b/nxcomp/src/GetImage.h @@ -0,0 +1,190 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GetImage_H +#define GetImage_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define GETIMAGE_ENABLE_CACHE 1 +#define GETIMAGE_ENABLE_DATA 0 +#define GETIMAGE_ENABLE_SPLIT 0 +#define GETIMAGE_ENABLE_COMPRESS 0 + +#define GETIMAGE_DATA_LIMIT 0 +#define GETIMAGE_DATA_OFFSET 20 + +#define GETIMAGE_CACHE_SLOTS 200 +#define GETIMAGE_CACHE_THRESHOLD 1 +#define GETIMAGE_CACHE_LOWER_THRESHOLD 0 + +// +// The message class. +// + +class GetImageMessage : public Message +{ + friend class GetImageStore; + + public: + + GetImageMessage() + { + } + + ~GetImageMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char format; + unsigned int drawable; + unsigned short int x; + unsigned short int y; + unsigned short int width; + unsigned short int height; + unsigned int plane_mask; +}; + +class GetImageStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + GetImageStore() : MessageStore() + { + enableCache = GETIMAGE_ENABLE_CACHE; + enableData = GETIMAGE_ENABLE_DATA; + enableSplit = GETIMAGE_ENABLE_SPLIT; + enableCompress = GETIMAGE_ENABLE_COMPRESS; + + dataLimit = GETIMAGE_DATA_LIMIT; + dataOffset = GETIMAGE_DATA_OFFSET; + + cacheSlots = GETIMAGE_CACHE_SLOTS; + cacheThreshold = GETIMAGE_CACHE_THRESHOLD; + cacheLowerThreshold = GETIMAGE_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~GetImageStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "GetImage"; + } + + virtual unsigned char opcode() const + { + return X_GetImage; + } + + virtual unsigned int storage() const + { + return sizeof(GetImageMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new GetImageMessage(); + } + + virtual Message *create(const Message &message) const + { + return new GetImageMessage((const GetImageMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (GetImageMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* GetImage_H */ diff --git a/nxcomp/src/GetImageReply.cpp b/nxcomp/src/GetImageReply.cpp new file mode 100644 index 000000000..5100804ab --- /dev/null +++ b/nxcomp/src/GetImageReply.cpp @@ -0,0 +1,194 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GetImageReply.h" + +#include "ServerCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +GetImageReplyStore::GetImageReplyStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = GETIMAGEREPLY_ENABLE_CACHE; + enableData = GETIMAGEREPLY_ENABLE_DATA; + enableSplit = GETIMAGEREPLY_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = GETIMAGEREPLY_DATA_LIMIT; + dataOffset = GETIMAGEREPLY_DATA_OFFSET; + + cacheSlots = GETIMAGEREPLY_CACHE_SLOTS; + cacheThreshold = GETIMAGEREPLY_CACHE_THRESHOLD; + cacheLowerThreshold = GETIMAGEREPLY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +GetImageReplyStore::~GetImageReplyStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int GetImageReplyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; + + // + // Here is the fingerprint. + // + + getImageReply -> depth = *(buffer + 1); + + getImageReply -> visual = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int GetImageReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = getImageReply -> depth; + + PutULONG(getImageReply -> visual, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void GetImageReplyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; + + *logofs << name() << ": Identity depth " << (unsigned) getImageReply -> depth + << ", visual " << getImageReply -> visual << ", size " + << getImageReply -> size_ << ".\n"; + + #endif +} + +void GetImageReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Field depth. + // + + md5_append(md5_state_, buffer + 1, 1); +} + +void GetImageReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; + + ServerCache *serverCache = (ServerCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << getImageReply -> visual + << " as visual field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(getImageReply -> visual, 29, + serverCache -> visualCache); +} + +void GetImageReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + // + // Decode the variant part. + // + + GetImageReplyMessage *getImageReply = (GetImageReplyMessage *) message; + + ServerCache *serverCache = (ServerCache *) channelCache; + + decodeBuffer.decodeCachedValue(getImageReply -> visual, 29, + serverCache -> visualCache); +} diff --git a/nxcomp/src/GetImageReply.h b/nxcomp/src/GetImageReply.h new file mode 100644 index 000000000..d4f7c4267 --- /dev/null +++ b/nxcomp/src/GetImageReply.h @@ -0,0 +1,150 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GetImageReply_H +#define GetImageReply_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define GETIMAGEREPLY_ENABLE_CACHE 1 +#define GETIMAGEREPLY_ENABLE_DATA 1 +#define GETIMAGEREPLY_ENABLE_SPLIT 0 + +#define GETIMAGEREPLY_DATA_LIMIT 1048576 - 32 +#define GETIMAGEREPLY_DATA_OFFSET 32 + +#define GETIMAGEREPLY_CACHE_SLOTS 1000 +#define GETIMAGEREPLY_CACHE_THRESHOLD 20 +#define GETIMAGEREPLY_CACHE_LOWER_THRESHOLD 2 + +#define GETIMAGEREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class GetImageReplyMessage : public Message +{ + friend class GetImageReplyStore; + + public: + + GetImageReplyMessage() + { + } + + ~GetImageReplyMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char depth; + unsigned int visual; +}; + +class GetImageReplyStore : public MessageStore +{ + public: + + GetImageReplyStore(StaticCompressor *compressor); + + virtual ~GetImageReplyStore(); + + virtual const char *name() const + { + return "GetImageReply"; + } + + virtual unsigned char opcode() const + { + return X_GetImage; + } + + virtual unsigned int storage() const + { + return sizeof(GetImageReplyMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new GetImageReplyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new GetImageReplyMessage((const GetImageReplyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (GetImageReplyMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* GetImageReply_H */ diff --git a/nxcomp/src/GetProperty.cpp b/nxcomp/src/GetProperty.cpp new file mode 100644 index 000000000..1c5e77ccc --- /dev/null +++ b/nxcomp/src/GetProperty.cpp @@ -0,0 +1,119 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GetProperty.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int GetPropertyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetPropertyMessage *getProperty = (GetPropertyMessage *) message; + + // + // Here is the fingerprint. + // + + getProperty -> property_delete = *(buffer + 1); + + getProperty -> window = GetULONG(buffer + 4, bigEndian); + getProperty -> property = GetULONG(buffer + 8, bigEndian); + getProperty -> type = GetULONG(buffer + 12, bigEndian); + getProperty -> long_offset = GetULONG(buffer + 16, bigEndian); + getProperty -> long_length = GetULONG(buffer + 20, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int GetPropertyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + + GetPropertyMessage *getProperty = (GetPropertyMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = getProperty -> property_delete; + + PutULONG(getProperty -> window, buffer + 4, bigEndian); + PutULONG(getProperty -> property, buffer + 8, bigEndian); + PutULONG(getProperty -> type, buffer + 12, bigEndian); + PutULONG(getProperty -> long_offset, buffer + 16, bigEndian); + PutULONG(getProperty -> long_length, buffer + 20, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void GetPropertyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + GetPropertyMessage *getProperty = (GetPropertyMessage *) message; + + *logofs << name() << ": Identity property_delete " << (unsigned int) getProperty -> property_delete + << ", window " << getProperty -> window << ", property " << getProperty -> property + << ", type " << getProperty -> type << ", long-offset " << getProperty -> long_offset + << ", long-length " << getProperty -> long_length << ".\n" << logofs_flush; + + #endif +} + +void GetPropertyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 4, 20); +} diff --git a/nxcomp/src/GetProperty.h b/nxcomp/src/GetProperty.h new file mode 100644 index 000000000..46727280b --- /dev/null +++ b/nxcomp/src/GetProperty.h @@ -0,0 +1,183 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GetProperty_H +#define GetProperty_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define GETPROPERTY_ENABLE_CACHE 1 +#define GETPROPERTY_ENABLE_DATA 0 +#define GETPROPERTY_ENABLE_SPLIT 0 +#define GETPROPERTY_ENABLE_COMPRESS 0 + +#define GETPROPERTY_DATA_LIMIT 0 +#define GETPROPERTY_DATA_OFFSET 24 + +#define GETPROPERTY_CACHE_SLOTS 2000 +#define GETPROPERTY_CACHE_THRESHOLD 2 +#define GETPROPERTY_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class GetPropertyMessage : public Message +{ + friend class GetPropertyStore; + + public: + + GetPropertyMessage() + { + } + + ~GetPropertyMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char property_delete; + unsigned long window; + unsigned long property; + unsigned long type; + unsigned long long_offset; + unsigned long long_length; +}; + +class GetPropertyStore : public MessageStore +{ + + // + // Constructors and destructors. + // + + public: + + GetPropertyStore() : MessageStore() + { + enableCache = GETPROPERTY_ENABLE_CACHE; + enableData = GETPROPERTY_ENABLE_DATA; + enableSplit = GETPROPERTY_ENABLE_SPLIT; + enableCompress = GETPROPERTY_ENABLE_COMPRESS; + + dataLimit = GETPROPERTY_DATA_LIMIT; + dataOffset = GETPROPERTY_DATA_OFFSET; + + cacheSlots = GETPROPERTY_CACHE_SLOTS; + cacheThreshold = GETPROPERTY_CACHE_THRESHOLD; + cacheLowerThreshold = GETPROPERTY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~GetPropertyStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "GetProperty"; + } + + virtual unsigned char opcode() const + { + return X_GetProperty; + } + + virtual unsigned int storage() const + { + return sizeof(GetPropertyMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new GetPropertyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new GetPropertyMessage((const GetPropertyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (GetPropertyMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* GetProperty_H */ diff --git a/nxcomp/src/GetPropertyReply.cpp b/nxcomp/src/GetPropertyReply.cpp new file mode 100644 index 000000000..bf6879c5f --- /dev/null +++ b/nxcomp/src/GetPropertyReply.cpp @@ -0,0 +1,304 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "GetPropertyReply.h" + +#include "ServerCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +GetPropertyReplyStore::GetPropertyReplyStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = GETPROPERTYREPLY_ENABLE_CACHE; + enableData = GETPROPERTYREPLY_ENABLE_DATA; + enableSplit = GETPROPERTYREPLY_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = GETPROPERTYREPLY_DATA_LIMIT; + dataOffset = GETPROPERTYREPLY_DATA_OFFSET; + + cacheSlots = GETPROPERTYREPLY_CACHE_SLOTS; + cacheThreshold = GETPROPERTYREPLY_CACHE_THRESHOLD; + cacheLowerThreshold = GETPROPERTYREPLY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +GetPropertyReplyStore::~GetPropertyReplyStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int GetPropertyReplyStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ServerCache *serverCache = (ServerCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" + << logofs_flush; + #endif + + unsigned char format = (unsigned int) *(buffer + 1); + + encodeBuffer.encodeCachedValue(format, 8, + serverCache -> getPropertyFormatCache); + + unsigned int numBytes = GetULONG(buffer + 16, bigEndian); + + encodeBuffer.encodeValue(numBytes, 32, 9); + + if (format == 16) + { + numBytes <<= 1; + } + else if (format == 32) + { + numBytes <<= 2; + } + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 29, + serverCache -> getPropertyTypeCache, 9); + + encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" + << logofs_flush; + #endif + + return 1; +} + +int GetPropertyReplyStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ServerCache *serverCache = (ServerCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" + << logofs_flush; + #endif + + unsigned char format; + + decodeBuffer.decodeCachedValue(format, 8, + serverCache -> getPropertyFormatCache); + + unsigned int length; + + decodeBuffer.decodeValue(length, 32, 9); + + unsigned int numBytes = length; + + if (format == 16) + { + numBytes <<= 1; + } + else if (format == 32) + { + numBytes <<= 2; + } + + size = 32 + RoundUp4(numBytes); + + buffer = writeBuffer -> addMessage(size); + + *(buffer + 1) = format; + + PutULONG(length, buffer + 16, bigEndian); + + unsigned int value; + + decodeBuffer.decodeCachedValue(value, 29, + serverCache -> getPropertyTypeCache, 9); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeValue(value, 32, 9); + + PutULONG(value, buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" + << logofs_flush; + #endif + + return 1; +} + +int GetPropertyReplyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; + + getPropertyReply -> format = *(buffer + 1); + + getPropertyReply -> type = GetULONG(buffer + 8, bigEndian); + getPropertyReply -> after = GetULONG(buffer + 12, bigEndian); + getPropertyReply -> items = GetULONG(buffer + 16, bigEndian); + + // + // Cleanup the padding bytes. + // + + unsigned int uiLengthInBytes; + unsigned int uiFormat; + + if ((int) size > GETPROPERTYREPLY_DATA_OFFSET) + { + uiLengthInBytes = getPropertyReply -> items; + + uiFormat = *(buffer + 1); + + #ifdef DEBUG + *logofs << name() << ": length " << uiLengthInBytes + << ", format " << uiFormat << ", size " + << size << ".\n" << logofs_flush; + #endif + + if (uiFormat == 16) + { + uiLengthInBytes <<= 1; + } + else if (uiFormat == 32) + { + uiLengthInBytes <<= 2; + } + + unsigned char *end = ((unsigned char *) buffer) + size; + unsigned char *pad = ((unsigned char *) buffer) + GETPROPERTYREPLY_DATA_OFFSET + uiLengthInBytes; + + CleanData((unsigned char *) pad, end - pad); + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int GetPropertyReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; + + *(buffer + 1) = getPropertyReply -> format; + + PutULONG(getPropertyReply -> type, buffer + 8, bigEndian); + PutULONG(getPropertyReply -> after, buffer + 12, bigEndian); + PutULONG(getPropertyReply -> items, buffer + 16, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void GetPropertyReplyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + GetPropertyReplyMessage *getPropertyReply = (GetPropertyReplyMessage *) message; + + *logofs << name() << ": Identity format " + << (unsigned) getPropertyReply -> format << ", type " + << getPropertyReply -> type << ", after " << getPropertyReply -> after + << ", items " << getPropertyReply -> items << ", size " + << getPropertyReply -> size_ << ".\n"; + + #endif +} + +void GetPropertyReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Fields format, type, after, items. + // + + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 8, 12); +} + +void GetPropertyReplyStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ +} + +void GetPropertyReplyStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ +} diff --git a/nxcomp/src/GetPropertyReply.h b/nxcomp/src/GetPropertyReply.h new file mode 100644 index 000000000..01634b408 --- /dev/null +++ b/nxcomp/src/GetPropertyReply.h @@ -0,0 +1,160 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef GetPropertyReply_H +#define GetPropertyReply_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define GETPROPERTYREPLY_ENABLE_CACHE 1 +#define GETPROPERTYREPLY_ENABLE_DATA 1 +#define GETPROPERTYREPLY_ENABLE_SPLIT 0 + +#define GETPROPERTYREPLY_DATA_LIMIT 1048576 - 32 +#define GETPROPERTYREPLY_DATA_OFFSET 32 + +#define GETPROPERTYREPLY_CACHE_SLOTS 400 +#define GETPROPERTYREPLY_CACHE_THRESHOLD 5 +#define GETPROPERTYREPLY_CACHE_LOWER_THRESHOLD 1 + +#define GETPROPERTYREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class GetPropertyReplyMessage : public Message +{ + friend class GetPropertyReplyStore; + + public: + + GetPropertyReplyMessage() + { + } + + ~GetPropertyReplyMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char format; + unsigned int type; + unsigned int after; + unsigned int items; +}; + +class GetPropertyReplyStore : public MessageStore +{ + public: + + GetPropertyReplyStore(StaticCompressor *compressor); + + virtual ~GetPropertyReplyStore(); + + virtual const char *name() const + { + return "GetPropertyReply"; + } + + virtual unsigned char opcode() const + { + return X_GetProperty; + } + + virtual unsigned int storage() const + { + return sizeof(GetPropertyReplyMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new GetPropertyReplyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new GetPropertyReplyMessage((const GetPropertyReplyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (GetPropertyReplyMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* GetPropertyReply_H */ diff --git a/nxcomp/src/ImageText16.cpp b/nxcomp/src/ImageText16.cpp new file mode 100644 index 000000000..af057635f --- /dev/null +++ b/nxcomp/src/ImageText16.cpp @@ -0,0 +1,231 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ImageText16.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int ImageText16Store::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ImageText16Message *imageText16 = (ImageText16Message *) message; + + // + // Here is the fingerprint. + // + + imageText16 -> len = *(buffer + 1); + + imageText16 -> drawable = GetULONG(buffer + 4, bigEndian); + imageText16 -> gcontext = GetULONG(buffer + 8, bigEndian); + + imageText16 -> x = GetUINT(buffer + 12, bigEndian); + imageText16 -> y = GetUINT(buffer + 14, bigEndian); + + if ((int) size > dataOffset) + { + int pad = (size - dataOffset) - (imageText16 -> len * 2); + + if (pad > 0) + { + CleanData((unsigned char *) buffer + size - pad, pad); + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ImageText16Store::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ImageText16Message *imageText16 = (ImageText16Message *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = imageText16 -> len; + + PutULONG(imageText16 -> drawable, buffer + 4, bigEndian); + PutULONG(imageText16 -> gcontext, buffer + 8, bigEndian); + + PutUINT(imageText16 -> x, buffer + 12, bigEndian); + PutUINT(imageText16 -> y, buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ImageText16Store::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ImageText16Message *imageText16 = (ImageText16Message *) message; + + *logofs << name() << ": Identity len " << (unsigned int) imageText16 -> len + << " drawable " << imageText16 -> drawable << ", gcontext " + << imageText16 -> gcontext << ", x " << imageText16 -> x << ", y " + << imageText16 -> y << ", size " << imageText16 -> size_ << ".\n"; + + #endif +} + +void ImageText16Store::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); +} + +void ImageText16Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + ImageText16Message *imageText16 = (ImageText16Message *) message; + ImageText16Message *cachedImageText16 = (ImageText16Message *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText16 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(imageText16 -> drawable, clientCache -> drawableCache); + + cachedImageText16 -> drawable = imageText16 -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText16 -> gcontext + << " as " << "gcontext" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(imageText16 -> gcontext, clientCache -> gcCache); + + cachedImageText16 -> gcontext = imageText16 -> gcontext; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText16 -> x + << " as " << "x" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_x = imageText16 -> x - cachedImageText16 -> x; + + encodeBuffer.encodeCachedValue(diff_x, 16, + clientCache -> imageTextCacheX); + + cachedImageText16 -> x = imageText16 -> x; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText16 -> y + << " as " << "y" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_y = imageText16 -> y - cachedImageText16 -> y; + + encodeBuffer.encodeCachedValue(diff_y, 16, + clientCache -> imageTextCacheY); + + cachedImageText16 -> y = imageText16 -> y; +} + +void ImageText16Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + ImageText16Message *imageText16 = (ImageText16Message *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + imageText16 -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText16 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + imageText16 -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText16 -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> imageTextCacheX); + + imageText16 -> x += value; + imageText16 -> x &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText16 -> x + << " as x field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> imageTextCacheY); + + imageText16 -> y += value; + imageText16 -> y &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText16 -> y + << " as y field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/ImageText16.h b/nxcomp/src/ImageText16.h new file mode 100644 index 000000000..98462ab35 --- /dev/null +++ b/nxcomp/src/ImageText16.h @@ -0,0 +1,190 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ImageText16_H +#define ImageText16_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define IMAGETEXT16_ENABLE_CACHE 1 +#define IMAGETEXT16_ENABLE_DATA 0 +#define IMAGETEXT16_ENABLE_SPLIT 0 +#define IMAGETEXT16_ENABLE_COMPRESS 0 + +#define IMAGETEXT16_DATA_LIMIT 512 +#define IMAGETEXT16_DATA_OFFSET 16 + +#define IMAGETEXT16_CACHE_SLOTS 3000 +#define IMAGETEXT16_CACHE_THRESHOLD 5 +#define IMAGETEXT16_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class ImageText16Message : public Message +{ + friend class ImageText16Store; + + public: + + ImageText16Message() + { + } + + ~ImageText16Message() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char len; + + unsigned int drawable; + unsigned int gcontext; + + unsigned short x; + unsigned short y; +}; + +class ImageText16Store : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ImageText16Store() : MessageStore() + { + enableCache = IMAGETEXT16_ENABLE_CACHE; + enableData = IMAGETEXT16_ENABLE_DATA; + enableSplit = IMAGETEXT16_ENABLE_SPLIT; + enableCompress = IMAGETEXT16_ENABLE_COMPRESS; + + dataLimit = IMAGETEXT16_DATA_LIMIT; + dataOffset = IMAGETEXT16_DATA_OFFSET; + + cacheSlots = IMAGETEXT16_CACHE_SLOTS; + cacheThreshold = IMAGETEXT16_CACHE_THRESHOLD; + cacheLowerThreshold = IMAGETEXT16_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~ImageText16Store() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "ImageText16"; + } + + virtual unsigned char opcode() const + { + return X_ImageText16; + } + + virtual unsigned int storage() const + { + return sizeof(ImageText16Message); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ImageText16Message(); + } + + virtual Message *create(const Message &message) const + { + return new ImageText16Message((const ImageText16Message &) message); + } + + virtual void destroy(Message *message) const + { + delete (ImageText16Message *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* ImageText16_H */ diff --git a/nxcomp/src/ImageText8.cpp b/nxcomp/src/ImageText8.cpp new file mode 100644 index 000000000..61fcef825 --- /dev/null +++ b/nxcomp/src/ImageText8.cpp @@ -0,0 +1,231 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ImageText8.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int ImageText8Store::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ImageText8Message *imageText8 = (ImageText8Message *) message; + + // + // Here is the fingerprint. + // + + imageText8 -> len = *(buffer + 1); + + imageText8 -> drawable = GetULONG(buffer + 4, bigEndian); + imageText8 -> gcontext = GetULONG(buffer + 8, bigEndian); + + imageText8 -> x = GetUINT(buffer + 12, bigEndian); + imageText8 -> y = GetUINT(buffer + 14, bigEndian); + + if ((int) size > dataOffset) + { + int pad = (size - dataOffset) - imageText8 -> len; + + if (pad > 0) + { + CleanData((unsigned char *) buffer + size - pad, pad); + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ImageText8Store::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ImageText8Message *imageText8 = (ImageText8Message *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = imageText8 -> len; + + PutULONG(imageText8 -> drawable, buffer + 4, bigEndian); + PutULONG(imageText8 -> gcontext, buffer + 8, bigEndian); + + PutUINT(imageText8 -> x, buffer + 12, bigEndian); + PutUINT(imageText8 -> y, buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ImageText8Store::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ImageText8Message *imageText8 = (ImageText8Message *) message; + + *logofs << name() << ": Identity len " << (unsigned int) imageText8 -> len + << " drawable " << imageText8 -> drawable << ", gcontext " + << imageText8 -> gcontext << ", x " << imageText8 -> x << ", y " + << imageText8 -> y << ", size " << imageText8 -> size_ << ".\n"; + + #endif +} + +void ImageText8Store::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); +} + +void ImageText8Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + ImageText8Message *imageText8 = (ImageText8Message *) message; + ImageText8Message *cachedImageText8 = (ImageText8Message *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText8 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(imageText8 -> drawable, clientCache -> drawableCache); + + cachedImageText8 -> drawable = imageText8 -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText8 -> gcontext + << " as " << "gcontext" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(imageText8 -> gcontext, clientCache -> gcCache); + + cachedImageText8 -> gcontext = imageText8 -> gcontext; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText8 -> x + << " as " << "x" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_x = imageText8 -> x - cachedImageText8 -> x; + + encodeBuffer.encodeCachedValue(diff_x, 16, + clientCache -> imageTextCacheX); + + cachedImageText8 -> x = imageText8 -> x; + + #ifdef TEST + *logofs << name() << ": Encoding value " << imageText8 -> y + << " as " << "y" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_y = imageText8 -> y - cachedImageText8 -> y; + + encodeBuffer.encodeCachedValue(diff_y, 16, + clientCache -> imageTextCacheY); + + cachedImageText8 -> y = imageText8 -> y; +} + +void ImageText8Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + ImageText8Message *imageText8 = (ImageText8Message *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + imageText8 -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText8 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + imageText8 -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText8 -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> imageTextCacheX); + + imageText8 -> x += value; + imageText8 -> x &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText8 -> x + << " as x field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> imageTextCacheY); + + imageText8 -> y += value; + imageText8 -> y &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << imageText8 -> y + << " as y field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/ImageText8.h b/nxcomp/src/ImageText8.h new file mode 100644 index 000000000..aa9ccb5d9 --- /dev/null +++ b/nxcomp/src/ImageText8.h @@ -0,0 +1,190 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ImageText8_H +#define ImageText8_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define IMAGETEXT8_ENABLE_CACHE 1 +#define IMAGETEXT8_ENABLE_DATA 0 +#define IMAGETEXT8_ENABLE_SPLIT 0 +#define IMAGETEXT8_ENABLE_COMPRESS 0 + +#define IMAGETEXT8_DATA_LIMIT 256 +#define IMAGETEXT8_DATA_OFFSET 16 + +#define IMAGETEXT8_CACHE_SLOTS 3000 +#define IMAGETEXT8_CACHE_THRESHOLD 5 +#define IMAGETEXT8_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class ImageText8Message : public Message +{ + friend class ImageText8Store; + + public: + + ImageText8Message() + { + } + + ~ImageText8Message() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char len; + + unsigned int drawable; + unsigned int gcontext; + + unsigned short x; + unsigned short y; +}; + +class ImageText8Store : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ImageText8Store() : MessageStore() + { + enableCache = IMAGETEXT8_ENABLE_CACHE; + enableData = IMAGETEXT8_ENABLE_DATA; + enableSplit = IMAGETEXT8_ENABLE_SPLIT; + enableCompress = IMAGETEXT8_ENABLE_COMPRESS; + + dataLimit = IMAGETEXT8_DATA_LIMIT; + dataOffset = IMAGETEXT8_DATA_OFFSET; + + cacheSlots = IMAGETEXT8_CACHE_SLOTS; + cacheThreshold = IMAGETEXT8_CACHE_THRESHOLD; + cacheLowerThreshold = IMAGETEXT8_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~ImageText8Store() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "ImageText8"; + } + + virtual unsigned char opcode() const + { + return X_ImageText8; + } + + virtual unsigned int storage() const + { + return sizeof(ImageText8Message); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ImageText8Message(); + } + + virtual Message *create(const Message &message) const + { + return new ImageText8Message((const ImageText8Message &) message); + } + + virtual void destroy(Message *message) const + { + delete (ImageText8Message *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* ImageText8_H */ diff --git a/nxcomp/src/IntCache.cpp b/nxcomp/src/IntCache.cpp new file mode 100644 index 000000000..c72b81200 --- /dev/null +++ b/nxcomp/src/IntCache.cpp @@ -0,0 +1,230 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "Misc.h" +#include "IntCache.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +IntCache::IntCache(unsigned int size) + + : size_(size), length_(0), buffer_(new unsigned int[size]), + lastDiff_(0), lastValueInserted_(0), predictedBlockSize_(0) +{ +} + +int IntCache::lookup(unsigned int &value, unsigned int &index, + unsigned int mask, unsigned int &sameDiff) +{ + for (unsigned int i = 0; i < length_; i++) + { + if (value == buffer_[i]) + { + index = i; + if (i) + { + unsigned int target = (i >> 1); + do + { + buffer_[i] = buffer_[i - 1]; + i--; + } + while (i > target); + buffer_[target] = value; + } + return 1; + } + } + unsigned int insertionPoint; + if (2 >= length_) + insertionPoint = length_; + else + insertionPoint = 2; + unsigned int start; + if (length_ >= size_) + start = size_ - 1; + else + { + start = length_; + length_++; + } + for (unsigned int k = start; k > insertionPoint; k--) + buffer_[k] = buffer_[k - 1]; + buffer_[insertionPoint] = value; + unsigned int diff = value - lastValueInserted_; + + lastValueInserted_ = (value & mask); + value = (diff & mask); + sameDiff = (value == lastDiff_); + if (!sameDiff) + { + lastDiff_ = value; + + unsigned int lastChangeIndex = 0; + unsigned int lastBitIsOne = (lastDiff_ & 0x1); + unsigned int j = 1; + for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) + { + unsigned int nextBitIsOne = (lastDiff_ & nextMask); + if (nextBitIsOne) + { + if (!lastBitIsOne) + { + lastChangeIndex = j; + lastBitIsOne = nextBitIsOne; + } + } + else + { + if (lastBitIsOne) + { + lastChangeIndex = j; + lastBitIsOne = nextBitIsOne; + } + } + j++; + } + predictedBlockSize_ = lastChangeIndex + 1; + if (predictedBlockSize_ < 2) + predictedBlockSize_ = 2; + } + return 0; +} + +void IntCache::insert(unsigned int &value, unsigned int mask) +{ + unsigned int insertionPoint; + if (2 >= length_) + insertionPoint = length_; + else + insertionPoint = 2; + unsigned int start; + if (length_ >= size_) + start = size_ - 1; + else + { + start = length_; + length_++; + } + for (unsigned int k = start; k > insertionPoint; k--) + buffer_[k] = buffer_[k - 1]; + if (lastDiff_ != value) + { + lastDiff_ = value; + unsigned int lastChangeIndex = 0; + unsigned int lastBitIsOne = (lastDiff_ & 0x1); + unsigned int j = 1; + for (unsigned int nextMask = 0x2; nextMask & mask; nextMask <<= 1) + { + unsigned int nextBitIsOne = (lastDiff_ & nextMask); + if (nextBitIsOne) + { + if (!lastBitIsOne) + { + lastChangeIndex = j; + lastBitIsOne = nextBitIsOne; + } + } + else + { + if (lastBitIsOne) + { + lastChangeIndex = j; + lastBitIsOne = nextBitIsOne; + } + } + j++; + } + predictedBlockSize_ = lastChangeIndex + 1; + if (predictedBlockSize_ < 2) + predictedBlockSize_ = 2; + } + lastValueInserted_ += value; + lastValueInserted_ &= mask; + buffer_[insertionPoint] = lastValueInserted_; + value = lastValueInserted_; +} + +void IntCache::push(unsigned int &value, unsigned int mask) +{ + // + // Using a memmove() appears to be slower. + // + // memmove((char *) &buffer_[1], (char *) &buffer_[0], + // sizeof(unsigned int) * (size_ - 1)); + // + // if (length_ < size_) + // { + // length_++; + // } + // + + unsigned int start; + + if (length_ >= size_) + { + start = size_ - 1; + } + else + { + start = length_; + + length_++; + } + + for (unsigned int k = start; k > 0; k--) + { + buffer_[k] = buffer_[k - 1]; + } + + value &= mask; + + buffer_[0] = value; +} + +void IntCache::dump() +{ + #ifdef DUMP + + *logofs << "IntCache: Dumping content of cache at " + << (void *) this << ":\n" << logofs_flush; + + for (unsigned int i = 0; i < length_; i++) + { + *logofs << "IntCache: [" << i << "][" << buffer_[i] << "]\n"; + } + + #endif +} diff --git a/nxcomp/src/IntCache.h b/nxcomp/src/IntCache.h new file mode 100644 index 000000000..69c522325 --- /dev/null +++ b/nxcomp/src/IntCache.h @@ -0,0 +1,119 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef IntCache_H +#define IntCache_H + +class IntCache +{ + public: + + IntCache(unsigned int size); + + ~IntCache() + { + delete [] buffer_; + } + + unsigned int getSize() const + { + return length_; + } + + int lookup(unsigned int &value, unsigned int &index, + unsigned int mask, unsigned int &sameDiff); + + // + // This can be inlined as it is only + // called by decodeCachedValue(). + // + + unsigned int get(unsigned int index) + { + unsigned int result = buffer_[index]; + + if (index != 0) + { + // + // Using a memmove() appears to be slower. + // + // unsigned int target = index >> 1; + // + // memmove((char *) &buffer_[target + 1], (char *) &buffer_[target], + // sizeof(unsigned int) * (index - target)); + // + // buffer_[target] = result; + // + + unsigned int i = index; + + unsigned int target = (i >> 1); + + do + { + buffer_[i] = buffer_[i - 1]; + + i--; + } + while (i > target); + + buffer_[target] = result; + } + + return result; + } + + void insert(unsigned int &value, unsigned int mask); + + void push(unsigned int &value, unsigned int mask); + + void dump(); + + unsigned int getLastDiff(unsigned int mask) const + { + return lastDiff_; + } + + unsigned int getBlockSize(unsigned int bits) const + { + if (bits > 0) + { + return (predictedBlockSize_ < bits ? predictedBlockSize_ : bits); + } + + return predictedBlockSize_; + } + + private: + + unsigned int size_; + unsigned int length_; + unsigned int *buffer_; + unsigned int lastDiff_; + unsigned int lastValueInserted_; + unsigned int predictedBlockSize_; +}; + +#endif /* IntCache_H */ diff --git a/nxcomp/src/InternAtom.cpp b/nxcomp/src/InternAtom.cpp new file mode 100644 index 000000000..9d0ab1b6d --- /dev/null +++ b/nxcomp/src/InternAtom.cpp @@ -0,0 +1,131 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "InternAtom.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int InternAtomStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + InternAtomMessage *internAtom = (InternAtomMessage *) message; + + // + // Here is the fingerprint. + // + + internAtom -> only_if_exists = *(buffer + 1); + internAtom -> name_length = GetUINT(buffer + 4, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + // + // Clean up padding bytes. + // + + if ((int) size > dataOffset) + { + unsigned char *end = ((unsigned char *) buffer) + size; + + for (unsigned char *pad = ((unsigned char *) buffer) + 8 + + internAtom -> name_length; pad < end; pad++) + { + *pad = 0; + } + } + + return 1; +} + +int InternAtomStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + InternAtomMessage *internAtom = (InternAtomMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = internAtom -> only_if_exists; + + PutUINT(internAtom -> name_length, buffer + 4, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void InternAtomStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + InternAtomMessage *internAtom = (InternAtomMessage *) message; + + *logofs << name() << ": Identity only_if_exists " + << (unsigned int) internAtom -> only_if_exists + << ", name_length " << internAtom -> name_length + << ", name '"; + + for (int i = 0; i < internAtom -> name_length; i++) + { + *logofs << internAtom -> data_[i]; + } + + *logofs << "'.\n" << logofs_flush; + + #endif +} + +void InternAtomStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 4, 2); +} diff --git a/nxcomp/src/InternAtom.h b/nxcomp/src/InternAtom.h new file mode 100644 index 000000000..6e69eca24 --- /dev/null +++ b/nxcomp/src/InternAtom.h @@ -0,0 +1,178 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef InternAtom_H +#define InternAtom_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define INTERNATOM_ENABLE_CACHE 1 +#define INTERNATOM_ENABLE_DATA 0 +#define INTERNATOM_ENABLE_SPLIT 0 +#define INTERNATOM_ENABLE_COMPRESS 0 + +#define INTERNATOM_DATA_LIMIT 80 +#define INTERNATOM_DATA_OFFSET 8 + +#define INTERNATOM_CACHE_SLOTS 2000 +#define INTERNATOM_CACHE_THRESHOLD 2 +#define INTERNATOM_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class InternAtomMessage : public Message +{ + friend class InternAtomStore; + + public: + + InternAtomMessage() + { + } + + ~InternAtomMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char only_if_exists; + unsigned short name_length; +}; + +class InternAtomStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + InternAtomStore() : MessageStore() + { + enableCache = INTERNATOM_ENABLE_CACHE; + enableData = INTERNATOM_ENABLE_DATA; + enableSplit = INTERNATOM_ENABLE_SPLIT; + enableCompress = INTERNATOM_ENABLE_COMPRESS; + + dataLimit = INTERNATOM_DATA_LIMIT; + dataOffset = INTERNATOM_DATA_OFFSET; + + cacheSlots = INTERNATOM_CACHE_SLOTS; + cacheThreshold = INTERNATOM_CACHE_THRESHOLD; + cacheLowerThreshold = INTERNATOM_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~InternAtomStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "InternAtom"; + } + + virtual unsigned char opcode() const + { + return X_InternAtom; + } + + virtual unsigned int storage() const + { + return sizeof(InternAtomMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new InternAtomMessage(); + } + + virtual Message *create(const Message &message) const + { + return new InternAtomMessage((const InternAtomMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (InternAtomMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* InternAtom_H */ diff --git a/nxcomp/src/Jpeg.cpp b/nxcomp/src/Jpeg.cpp new file mode 100644 index 000000000..64a537497 --- /dev/null +++ b/nxcomp/src/Jpeg.cpp @@ -0,0 +1,890 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#ifdef ANDROID +#include +#endif +#include +#include +#include + +#ifdef __cplusplus + +extern "C" +{ + #include + #include +} + +#else + +#include +#include + +#endif + +#include "Misc.h" +#include "Jpeg.h" +#include "Unpack.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define RGB24_TO_PIXEL(bpp,r,g,b) \ + ((((CARD##bpp)(r) & 0xff) * srcRedMax + 127) / 255 \ + << srcRedShift | \ + (((CARD##bpp)(g) & 0xff) * srcGreenMax + 127) / 255 \ + << srcGreenShift | \ + (((CARD##bpp)(b) & 0xff) * srcBlueMax + 127) / 255 \ + << srcBlueShift) + +#define RGB24_TO_PIXEL32(r,g,b) \ + (((CARD32)(r) & 0xff) << srcRedShift | \ + ((CARD32)(g) & 0xff) << srcGreenShift | \ + ((CARD32)(b) & 0xff) << srcBlueShift) + +// +// Functions from Unpack.cpp +// + +extern int Unpack32To32(const T_colormask *colormask, const unsigned int *data, + unsigned int *out, unsigned int *end); + +extern int Unpack24To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +extern int Unpack16To16(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +// +// Local functions used for the jpeg decompression. +// + +static void JpegSetSrcManager(j_decompress_ptr cinfo, CARD8 *compressedData, int compressedLen); +static void JpegInitSource(j_decompress_ptr cinfo); +static void JpegTermSource(j_decompress_ptr cinfo); +static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes); + +static boolean JpegFillInputBuffer(j_decompress_ptr cinfo); + +static int DecompressJpeg16(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); + +static int DecompressJpeg24(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); + +static int DecompressJpeg32(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder); + +void UnpackJpegErrorHandler(j_common_ptr cinfo); + +// +// Colormap stuff. +// + +CARD16 srcRedMax, srcGreenMax, srcBlueMax; +CARD8 srcRedShift, srcGreenShift, srcBlueShift; + +// +// Error handler. +// + +static bool jpegError; + +jmp_buf UnpackJpegContext; + +void UnpackJpegErrorHandler(j_common_ptr cinfo) +{ + #ifdef PANIC + *logofs << "UnpackJpegErrorHandler: PANIC! Detected error in JPEG decompression.\n" + << logofs_flush; + + *logofs << "UnpackJpegErrorHandler: PANIC! Trying to revert to the previous context.\n" + << logofs_flush; + #endif + + jpegError = 1; + + longjmp(UnpackJpegContext, 1); +} + +// +// Attributes used for the jpeg decompression. +// + +static struct jpeg_source_mgr jpegSrcManager; +static JOCTET *jpegBufferPtr; +static size_t jpegBufferLen; + +static char *tmpBuf; +static int tmpBufSize = 0; + +int UnpackJpeg(T_geometry *geometry, unsigned char method, unsigned char *srcData, + int srcSize, int dstBpp, int dstWidth, int dstHeight, + unsigned char *dstData, int dstSize) +{ + int byteOrder = geometry -> image_byte_order; + + // + // Check if data is coming from a failed unsplit. + // + + if (srcSize < 2 || (srcData[0] == SPLIT_PATTERN && + srcData[1] == SPLIT_PATTERN)) + { + #ifdef WARNING + *logofs << "UnpackJpeg: WARNING! Skipping unpack of dummy data.\n" + << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << "UnpackJpeg: Decompression. Source size " + << srcSize << " bits per plane " << dstBpp + << ".\n" << logofs_flush; + #endif + + srcRedShift = ffs(geometry -> red_mask) - 1; + srcGreenShift = ffs(geometry -> green_mask) - 1; + srcBlueShift = ffs(geometry -> blue_mask) - 1; + + #ifdef DEBUG + *logofs << "UnpackJpeg: Red shift " << (int) srcRedShift + << " green shift " << (int) srcGreenShift << " blue shift " + << (int) srcBlueShift << ".\n" << logofs_flush; + #endif + + srcRedMax = geometry -> red_mask >> srcRedShift; + srcGreenMax = geometry -> green_mask >> srcGreenShift; + srcBlueMax = geometry -> blue_mask >> srcBlueShift; + + #ifdef DEBUG + *logofs << "UnpackJpeg: Red mask " << (void *) geometry -> red_mask + << " green mask " << (void *) geometry -> green_mask + << " blue mask " << (void *) geometry -> blue_mask + << ".\n" << logofs_flush; + #endif + + #ifdef DEBUG + *logofs << "UnpackJpeg: Red max " << srcRedMax << " green max " + << srcGreenMax << " blue max " << srcBlueMax + << ".\n" << logofs_flush; + #endif + + // + // Make enough space in the temporary + // buffer to have one complete row of + // the image with 3 bytes for a pixel. + // + + tmpBufSize = dstWidth * 3; + tmpBuf = new char[tmpBufSize]; + + if (tmpBuf == NULL) + { + #ifdef PANIC + *logofs << "UnpackJpeg: PANIC! Cannot allocate " + << dstWidth * 3 << " bytes for Jpeg " + << "decompressed data.\n" << logofs_flush; + #endif + + delete [] tmpBuf; + + return -1; + } + + int result = 1; + + switch(dstBpp) + { + case 8: + { + // + // Simply move the data from srcData to dstData + // taking into consideration the correct padding. + // + + int row; + + unsigned char * dstBuff = dstData; + unsigned char * srcBuff = srcData; + + for (row = 0; row < dstHeight; row++) + { + memcpy(dstBuff, srcBuff, dstWidth); + + dstBuff += RoundUp4(dstWidth); + srcBuff += dstWidth; + } + + break; + } + case 16: + { + result = DecompressJpeg16(srcData, srcSize, dstWidth, + dstHeight, dstData, byteOrder); + break; + } + case 24: + { + result = DecompressJpeg24(srcData, srcSize, dstWidth, + dstHeight, dstData, byteOrder); + break; + } + case 32: + { + result = DecompressJpeg32(srcData, srcSize, dstWidth, + dstHeight, dstData, byteOrder); + break; + } + default: + { + #ifdef PANIC + *logofs << "UnpackJpeg: PANIC! Failed to decode Jpeg image. " + << " Unsupported Bpp value " << dstBpp + << " for the Jpeg compression" + << ".\n" << logofs_flush; + #endif + + delete [] tmpBuf; + + result = -1; + } + } + + #ifdef DEBUG + *logofs << "UnpackJpeg: Decompression finished with result " + << result << ".\n" << logofs_flush; + #endif + + if (result == -1) + { + delete [] tmpBuf; + + #ifdef PANIC + *logofs << "UnpackJpeg: PANIC! Failed to decode Jpeg image using " + << dstBpp << " Bpp destination.\n" << logofs_flush; + #endif + + return result; + } + + // + // Apply the correction for the brightness. + // + + int maskMethod; + + switch(method) + { + case PACK_JPEG_8_COLORS: + { + maskMethod = MASK_8_COLORS; + + break; + } + case PACK_JPEG_64_COLORS: + { + maskMethod = MASK_64_COLORS; + + break; + } + case PACK_JPEG_256_COLORS: + { + maskMethod = MASK_256_COLORS; + + break; + } + case PACK_JPEG_512_COLORS: + { + maskMethod = MASK_512_COLORS; + + break; + } + case PACK_JPEG_4K_COLORS: + { + maskMethod = MASK_4K_COLORS; + + break; + } + case PACK_JPEG_32K_COLORS: + { + maskMethod = MASK_32K_COLORS; + + break; + } + case PACK_JPEG_64K_COLORS: + { + maskMethod = MASK_64K_COLORS; + + break; + } + case PACK_JPEG_256K_COLORS: + { + maskMethod = MASK_256K_COLORS; + + break; + } + case PACK_JPEG_2M_COLORS: + { + maskMethod = MASK_2M_COLORS; + + break; + } + case PACK_JPEG_16M_COLORS: + { + maskMethod = MASK_16M_COLORS; + + break; + } + default: + { + delete [] tmpBuf; + + return -1; + } + } + + const T_colormask *colorMask = MethodColorMask(maskMethod); + + unsigned char *dstBuff = dstData; + + switch (dstBpp) + { + case 16: + { + Unpack16To16(colorMask, dstBuff, dstBuff, dstBuff + dstSize); + + break; + } + case 24: + { + break; + } + case 32: + { + Unpack32To32(colorMask, (unsigned int *) dstBuff, (unsigned int *) dstBuff, + (unsigned int *) (dstBuff + dstSize)); + break; + } + default: + { + delete [] tmpBuf; + + return -1; + } + } + + delete [] tmpBuf; + + return 1; +} + +// +// Functions that actually do the Jpeg decompression. +// + +int DecompressJpeg16(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + unsigned char *data; + JSAMPROW rowPointer[1]; + + unsigned int dx = 0; + unsigned int dy = 0; + + #ifdef DEBUG + *logofs << "DecompressJpeg16: Decompressing with length " + << compressedLen << " width " << w << " height " + << h << ".\n" << logofs_flush; + #endif + + jpegError = 0; + + cinfo.err = jpeg_std_error(&jerr); + + jerr.error_exit = UnpackJpegErrorHandler; + + if (setjmp(UnpackJpegContext) == 1) + { + #ifdef TEST + *logofs << "DecompressJpeg16: Out of the long jump with error '" + << jpegError << "'.\n" << logofs_flush; + #endif + + goto AbortDecompressJpeg16; + } + + jpeg_create_decompress(&cinfo); + + if (jpegError) goto AbortDecompressJpeg16; + + JpegSetSrcManager(&cinfo, compressedData, compressedLen); + + jpeg_read_header(&cinfo, TRUE); + + if (jpegError) goto AbortDecompressJpeg16; + + cinfo.out_color_space = JCS_RGB; + + jpeg_start_decompress(&cinfo); + + if (jpegError) goto AbortDecompressJpeg16; + + if (cinfo.output_width != w || + cinfo.output_height != h || + cinfo.output_components != 3) + { + #ifdef PANIC + *logofs << "DecompressJpeg16: PANIC! Wrong JPEG data received.\n" + << logofs_flush; + #endif + + jpeg_destroy_decompress(&cinfo); + + return -1; + } + + // + // PixelPtr points to dstBuf which is + // already padded correctly for the final + // image to put + // + + data = dstBuf; + + rowPointer[0] = (JSAMPROW) tmpBuf; + + unsigned long pixel; + + while (cinfo.output_scanline < cinfo.output_height) + { + jpeg_read_scanlines(&cinfo, rowPointer, 1); + + if (jpegError) goto AbortDecompressJpeg16; + + for (dx = 0; dx < w; dx++) + { + pixel = RGB24_TO_PIXEL(16, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], + tmpBuf[dx * 3 + 2]); + + // + // Follow the server byte order when arranging data. + // + + if (byteOrder == LSBFirst) + { + data[0] = (unsigned char) (pixel & 0xff); + data[1] = (unsigned char) ((pixel >> 8) & 0xff); + } + else + { + data[1] = (unsigned char) (pixel & 0xff); + data[0] = (unsigned char) ((pixel >> 8) & 0xff); + } + + data += 2; + } + + // + // Move data at the beginning of the + // next line. + // + + data = data + (RoundUp4(w * 2) - w * 2); + + dy++; + } + + AbortDecompressJpeg16: + + if (jpegError == 0) + { + jpeg_finish_decompress(&cinfo); + } + + jpeg_destroy_decompress(&cinfo); + + if (jpegError == 1) + { + #ifdef PANIC + *logofs << "DecompressJpeg16: Failed to decompress JPEG image.\n" + << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "DecompressJpeg16: Decompression finished with " + << dy << " lines handled.\n" << logofs_flush; + #endif + + return 1; +} + +int DecompressJpeg24(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + CARD8 *pixelPtr = NULL; + JSAMPROW rowPointer[1]; + + unsigned int dx = 0; + unsigned int dy = 0; + + #ifdef TEST + *logofs << "DecompressJpeg24: Decompressing with length " + << compressedLen << " width " << w << " height " + << h << ".\n" << logofs_flush; + #endif + + jpegError = 0; + + cinfo.err = jpeg_std_error(&jerr); + + jerr.error_exit = UnpackJpegErrorHandler; + + if (setjmp(UnpackJpegContext) == 1) + { + #ifdef TEST + *logofs << "DecompressJpeg24: Out of the long jump with error '" + << jpegError << "'.\n" << logofs_flush; + #endif + + goto AbortDecompressJpeg24; + } + + jpeg_create_decompress(&cinfo); + + if (jpegError) goto AbortDecompressJpeg24; + + JpegSetSrcManager(&cinfo, compressedData, compressedLen); + + jpeg_read_header(&cinfo, TRUE); + + if (jpegError) goto AbortDecompressJpeg24; + + cinfo.out_color_space = JCS_RGB; + + jpeg_start_decompress(&cinfo); + + if (jpegError) goto AbortDecompressJpeg24; + + if (cinfo.output_width != w || + cinfo.output_height != h || + cinfo.output_components != 3) + { + #ifdef PANIC + *logofs << "DecompressJpeg24: PANIC! Wrong JPEG data received.\n" + << logofs_flush; + #endif + + jpeg_destroy_decompress(&cinfo); + + return -1; + } + + // + // PixelPtr points to dstBuf which is + // already padded correctly for the final + // image to put. + // + + pixelPtr = (CARD8 *) dstBuf; + + rowPointer[0] = (JSAMPROW) tmpBuf; + + while (cinfo.output_scanline < cinfo.output_height) + { + jpeg_read_scanlines(&cinfo, rowPointer, 1); + + if (jpegError) goto AbortDecompressJpeg24; + + for (dx = 0; dx < w; dx++) + { + // + // Follow the server byte order when arranging data. + // + + if (byteOrder == LSBFirst) + { + pixelPtr[0] = tmpBuf[dx * 3]; + pixelPtr[1] = tmpBuf[dx * 3 + 1]; + pixelPtr[2] = tmpBuf[dx * 3 + 2]; + } + else + { + pixelPtr[2] = tmpBuf[dx * 3]; + pixelPtr[1] = tmpBuf[dx * 3 + 1]; + pixelPtr[0] = tmpBuf[dx * 3 + 2]; + } + + pixelPtr += 3; + } + + // + // Go to the next line. + // + + pixelPtr = (CARD8 *) (((char *) pixelPtr) + (RoundUp4(w * 3) - w * 3)); + + dy++; + } + + AbortDecompressJpeg24: + + if (jpegError == 0) + { + jpeg_finish_decompress(&cinfo); + } + + jpeg_destroy_decompress(&cinfo); + + if (jpegError == 1) + { + #ifdef PANIC + *logofs << "DecompressJpeg24: Failed to decompress JPEG image.\n" + << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "DecompressJpeg24: Decompression finished with " + << dy << " lines handled.\n" << logofs_flush; + #endif + + return 1; +} + +int DecompressJpeg32(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) +{ + struct jpeg_decompress_struct cinfo; + struct jpeg_error_mgr jerr; + unsigned char *data; + JSAMPROW rowPointer[1]; + + unsigned int dx = 0; + unsigned int dy = 0; + + #ifdef TEST + *logofs << "DecompressJpeg32: Decompressing with length " + << compressedLen << " width " << w << " height " + << h << ".\n" << logofs_flush; + #endif + + jpegError = 0; + + cinfo.err = jpeg_std_error(&jerr); + + jerr.error_exit = UnpackJpegErrorHandler; + + if (setjmp(UnpackJpegContext) == 1) + { + #ifdef TEST + *logofs << "DecompressJpeg32: Out of the long jump with error '" + << jpegError << "'.\n" << logofs_flush; + #endif + + goto AbortDecompressJpeg32; + } + + jpeg_create_decompress(&cinfo); + + if (jpegError) goto AbortDecompressJpeg32; + + JpegSetSrcManager(&cinfo, compressedData, compressedLen); + + jpeg_read_header(&cinfo, TRUE); + + if (jpegError) goto AbortDecompressJpeg32; + + cinfo.out_color_space = JCS_RGB; + + jpeg_start_decompress(&cinfo); + + if (jpegError) goto AbortDecompressJpeg32; + + if (cinfo.output_width != w || + cinfo.output_height != h || + cinfo.output_components != 3) + { + #ifdef PANIC + *logofs << "DecompressJpeg32 : PANIC! Wrong JPEG data received.\n" + << logofs_flush; + #endif + + jpeg_destroy_decompress(&cinfo); + + return -1; + } + + // + // PixelPtr points to dstBuf which is + // already padded correctly for the final + // image to put + // + + data = dstBuf; + + rowPointer[0] = (JSAMPROW) tmpBuf; + + unsigned long pixel; + + int i; + + while (cinfo.output_scanline < cinfo.output_height) + { + jpeg_read_scanlines(&cinfo, rowPointer, 1); + + if (jpegError) goto AbortDecompressJpeg32; + + for (dx = 0; dx < w; dx++) + { + pixel = RGB24_TO_PIXEL(32, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], + tmpBuf[dx * 3 + 2]); + + // + // Follow the server byte order when arranging data. + // + + if (byteOrder == LSBFirst) + { + for (i = 0; i < 4; i++) + { + data[i] = (unsigned char)(pixel & 0xff); + pixel >>= 8; + } + } + else + { + for (i = 3; i >= 0; i--) + { + data[i] = (unsigned char) (pixel & 0xff); + pixel >>= 8; + } + } + + data += 4; + } + + dy++; + } + + AbortDecompressJpeg32: + + if (jpegError == 0) + { + jpeg_finish_decompress(&cinfo); + } + + jpeg_destroy_decompress(&cinfo); + + if (jpegError == 1) + { + #ifdef PANIC + *logofs << "DecompressJpeg32: Failed to decompress JPEG image.\n" + << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "DecompressJpeg32: Decompression finished with " + << dy << " lines handled.\n" << logofs_flush; + #endif + + return 1; +} + +static void JpegInitSource(j_decompress_ptr cinfo) +{ + jpegError = 0; +} + +static boolean JpegFillInputBuffer(j_decompress_ptr cinfo) +{ + jpegError = 1; + + jpegSrcManager.bytes_in_buffer = jpegBufferLen; + jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; + + return TRUE; +} + +static void JpegSkipInputData(j_decompress_ptr cinfo, long num_bytes) +{ + if (num_bytes < 0 || (unsigned long) num_bytes > jpegSrcManager.bytes_in_buffer) + { + jpegError = 1; + + jpegSrcManager.bytes_in_buffer = jpegBufferLen; + jpegSrcManager.next_input_byte = (JOCTET *)jpegBufferPtr; + } + else + { + jpegSrcManager.next_input_byte += (size_t) num_bytes; + jpegSrcManager.bytes_in_buffer -= (size_t) num_bytes; + } +} + +static void JpegTermSource(j_decompress_ptr cinfo) +{ +} + +static void JpegSetSrcManager(j_decompress_ptr cinfo, + CARD8 *compressedData, + int compressedLen) +{ + jpegBufferPtr = (JOCTET *) compressedData; + jpegBufferLen = (size_t) compressedLen; + + jpegSrcManager.init_source = JpegInitSource; + jpegSrcManager.fill_input_buffer = JpegFillInputBuffer; + jpegSrcManager.skip_input_data = JpegSkipInputData; + jpegSrcManager.resync_to_restart = jpeg_resync_to_restart; + jpegSrcManager.term_source = JpegTermSource; + jpegSrcManager.next_input_byte = jpegBufferPtr; + jpegSrcManager.bytes_in_buffer = jpegBufferLen; + + cinfo->src = &jpegSrcManager; +} diff --git a/nxcomp/src/Jpeg.h b/nxcomp/src/Jpeg.h new file mode 100644 index 000000000..58a5bffef --- /dev/null +++ b/nxcomp/src/Jpeg.h @@ -0,0 +1,36 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Jpeg_H +#define Jpeg_H + +#include "Misc.h" +#include "Unpack.h" + +int UnpackJpeg(T_geometry *geometry, unsigned char method, unsigned char *srcData, + int srcSize, int dstBpp, int dstWidth, int dstHeight, + unsigned char *dstData, int dstSize); + +#endif /* Jpeg_H */ diff --git a/nxcomp/src/Keeper.cpp b/nxcomp/src/Keeper.cpp new file mode 100644 index 000000000..4babbe8a6 --- /dev/null +++ b/nxcomp/src/Keeper.cpp @@ -0,0 +1,612 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "Keeper.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Remove the directory if it's empty +// since more than 30 * 24 h. +// + +#define EMPTY_DIR_TIME 2592000 + +// +// Sleep once any ONCE entries. +// + +#define ONCE 2 + +// +// Define this to trace messages while +// they are allocated and deallocated. +// + +#undef REFERENCES + +// +// This is used for reference count. +// + +#ifdef REFERENCES + +int File::references_ = 0; + +#endif + +bool T_older::operator () (File *a, File *b) const +{ + return a -> compare(b); +} + +File::File() +{ + name_ = NULL; + + size_ = 0; + time_ = 0; + + #ifdef REFERENCES + + references_++; + + *logofs << "Keeper: Created new File at " + << this << " out of " << references_ + << " allocated references.\n" + << logofs_flush; + + #endif +} + +// +// TODO: This class can leak industrial amounts of memory. +// I'm 100% sure that the desctructor is called and that +// also the string pointed in the File structure is dele- +// ted. Everything is logged, but still the memory is not +// freed. This is less a problem on Windows, where the me- +// mory occupation remains almost constant. Obviously the +// problem lies in the STL allocators of the GNU libstc++. +// + +File::~File() +{ + #ifdef TEST + *logofs << "Keeper: Deleting name for File at " + << this << ".\n" << logofs_flush; + #endif + + delete [] name_; + + #ifdef REFERENCES + + *logofs << "Keeper: Deleted File at " + << this << " out of " << references_ + << " allocated references.\n" + << logofs_flush; + + references_--; + + #endif +} + +bool File::compare(File *b) const +{ + if (this -> time_ == b -> time_) + { + return (this -> size_ < b -> size_); + } + + return (this -> time_ < b -> time_); +} + +Keeper::Keeper(int caches, int images, const char *root, + int sleep, int parent) +{ + caches_ = caches; + images_ = images; + sleep_ = sleep; + parent_ = parent; + + root_ = new char[strlen(root) + 1]; + + strcpy(root_, root); + + total_ = 0; + signal_ = 0; + + files_ = new T_files; +} + +Keeper::~Keeper() +{ + empty(); + + delete files_; + + delete [] root_; +} + +int Keeper::cleanupCaches() +{ + #ifdef TEST + *logofs << "Keeper: Looking for cache directories in '" + << root_ << "'.\n" << logofs_flush; + #endif + + DIR *rootDir = opendir(root_); + + if (rootDir != NULL) + { + dirent *dirEntry; + + struct stat fileStat; + + int baseSize = strlen(root_); + + int s = 0; + + while (((dirEntry = readdir(rootDir)) != NULL)) + { + if (s++ % ONCE == 0) usleep(sleep_ * 1000); + + if (signal_ != 0) break; + + if (strcmp(dirEntry -> d_name, "cache") == 0 || + strncmp(dirEntry -> d_name, "cache-", 6) == 0) + { + char *dirName = new char[baseSize + strlen(dirEntry -> d_name) + 2]; + + if (dirName == NULL) + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Can't check directory entry '" + << dirEntry -> d_name << "'.\n" << logofs_flush; + #endif + + delete [] dirName; + + continue; + } + + strcpy(dirName, root_); + strcpy(dirName + baseSize, "/"); + strcpy(dirName + baseSize + 1, dirEntry -> d_name); + + #ifdef TEST + *logofs << "Keeper: Checking directory '" << dirName + << "'.\n" << logofs_flush; + #endif + + if (stat(dirName, &fileStat) == 0 && + S_ISDIR(fileStat.st_mode) != 0) + { + // + // Add to repository all the "C-" and + // "S-" files in the given directory. + // + + collect(dirName); + } + + delete [] dirName; + } + } + + closedir(rootDir); + } + else + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Can't open NX root directory '" + << root_ << "'. Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Can't open NX root directory '" + << root_ << "'. Error is " << EGET() << " '" + << ESTR() << "'.\n"; + } + + // + // Remove older files. + // + + cleanup(caches_); + + // + // Empty the repository. + // + + empty(); + + return 1; +} + +int Keeper::cleanupImages() +{ + #ifdef TEST + *logofs << "Keeper: Looking for image directory in '" + << root_ << "'.\n" << logofs_flush; + #endif + + char *imagesPath = new char[strlen(root_) + strlen("/images") + 1]; + + if (imagesPath == NULL) + { + return -1; + } + + strcpy(imagesPath, root_); + strcat(imagesPath, "/images"); + + // + // Check if the cache directory does exist. + // + + struct stat dirStat; + + if (stat(imagesPath, &dirStat) == -1) + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Can't stat NX images cache directory '" + << imagesPath << ". Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Can't stat NX images cache directory '" + << imagesPath << ". Error is " << EGET() << " '" + << ESTR() << "'.\n"; + + delete [] imagesPath; + + return -1; + } + + // + // Check any of the 16 directories in the + // images root path. + // + + char *digitPath = new char[strlen(imagesPath) + 5]; + + strcpy(digitPath, imagesPath); + + for (char digit = 0; digit < 16; digit++) + { + // + // Give up if we received a signal or + // our parent is gone. + // + + if (signal_ != 0) + { + #ifdef TEST + *logofs << "Keeper: Signal detected. Aborting.\n" + << logofs_flush; + #endif + + goto KeeperCleanupImagesAbort; + } + else if (parent_ != getppid() || parent_ == 1) + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Parent process appears " + << "to be dead. Returning.\n" + << logofs_flush; + #endif + + goto KeeperCleanupImagesAbort; + + return 0; + } + + sprintf(digitPath + strlen(imagesPath), "/I-%01X", digit); + + // + // Add to the repository all the files + // in the given directory. + // + + collect(digitPath); + } + + delete [] imagesPath; + delete [] digitPath; + + // + // Remove the oldest files. + // + + cleanup(images_); + + // + // Empty the repository. + // + + empty(); + + return 1; + +KeeperCleanupImagesAbort: + + delete [] imagesPath; + delete [] digitPath; + + empty(); + + return 0; +} + +int Keeper::collect(const char *path) +{ + #ifdef TEST + *logofs << "Keeper: Looking for files in directory '" + << path << "'.\n" << logofs_flush; + #endif + + DIR *cacheDir = opendir(path); + + if (cacheDir != NULL) + { + File *file; + + dirent *dirEntry; + + struct stat fileStat; + + int baseSize = strlen(path); + int fileSize = baseSize + 3 + MD5_LENGTH * 2 + 1; + + int n = 0; + int s = 0; + + while (((dirEntry = readdir(cacheDir)) != NULL)) + { + if (s++ % ONCE == 0) usleep(sleep_ * 1000); + + if (signal_ != 0) break; + + if (strcmp(dirEntry -> d_name, ".") == 0 || + strcmp(dirEntry -> d_name, "..") == 0) + { + continue; + } + + n++; + + if (strlen(dirEntry -> d_name) == (MD5_LENGTH * 2 + 2) && + (strncmp(dirEntry -> d_name, "I-", 2) == 0 || + strncmp(dirEntry -> d_name, "S-", 2) == 0 || + strncmp(dirEntry -> d_name, "C-", 2) == 0)) + { + file = new File(); + + char *fileName = new char[fileSize]; + + if (file == NULL || fileName == NULL) + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Can't add file '" + << dirEntry -> d_name << "' to repository.\n" + << logofs_flush; + #endif + + delete [] fileName; + + delete file; + + continue; + } + + strcpy(fileName, path); + strcpy(fileName + baseSize, "/"); + strcpy(fileName + baseSize + 1, dirEntry -> d_name); + + file -> name_ = fileName; + + #ifdef DEBUG + *logofs << "Keeper: Adding file '" << file -> name_ + << "'.\n" << logofs_flush; + #endif + + if (stat(file -> name_, &fileStat) == -1) + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Can't stat NX file '" + << file -> name_ << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + delete file; + + continue; + } + + file -> size_ = fileStat.st_size; + file -> time_ = fileStat.st_mtime; + + files_ -> insert(T_files::value_type(file)); + + total_ += file -> size_; + } + } + + closedir(cacheDir); + + if (n == 0) + { + time_t now = time(NULL); + + if (now > 0 && stat(path, &fileStat) == 0) + { + #ifdef TEST + *logofs << "Keeper: Empty NX subdirectory '" << path + << "' unused since " << now - fileStat.st_mtime + << " S.\n" << logofs_flush; + #endif + + if (now - fileStat.st_mtime > EMPTY_DIR_TIME) + { + #ifdef TEST + *logofs << "Keeper: Removing empty NX subdirectory '" + << path << "'.\n" << logofs_flush; + #endif + + rmdir(path); + } + } + } + } + else + { + #ifdef WARNING + *logofs << "Keeper: WARNING! Can't open NX subdirectory '" + << path << ". Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Can't open NX subdirectory '" + << path << ". Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + + return 1; +} + +int Keeper::cleanup(int threshold) +{ + #ifdef TEST + *logofs << "Keeper: Deleting the oldest files with " + << files_ -> size() << " elements threshold " + << threshold << " and size " << total_ << ".\n" + << logofs_flush; + #endif + + // + // At least some versions of the standard + // library don't allow erasing an element + // while looping. This is not the most ef- + // ficient way to release the objects, but + // it's better than making a copy of the + // container. + // + + while (total_ > threshold && files_ -> size() > 0) + { + T_files::iterator i = files_ -> begin(); + + File *file = *i; + + #ifdef TEST + *logofs << "Keeper: Removing '" << file -> name_ + << "' with time " << file -> time_ << " and size " + << file -> size_ << ".\n" << logofs_flush; + #endif + + unlink(file -> name_); + + total_ -= file -> size_; + + #ifdef DEBUG + *logofs << "Keeper: Going to delete the file at " + << file << " while cleaning up.\n" + << logofs_flush; + #endif + + delete file; + + #ifdef DEBUG + *logofs << "Keeper: Going to erase the element " + << "while cleaning up.\n" + << logofs_flush; + #endif + + files_ -> erase(i); + } + + #ifdef TEST + *logofs << "Keeper: Bytes in repository are " + << total_ << ".\n" << logofs_flush; + #endif + + return 1; +} + +void Keeper::empty() +{ + #ifdef TEST + *logofs << "Keeper: Getting rid of files in repository.\n" + << logofs_flush; + #endif + + while (files_ -> size() > 0) + { + T_files::iterator i = files_ -> begin(); + + File *file = *i; + + #ifdef DEBUG + *logofs << "Keeper: Going to delete the file at " + << file << " while emptying.\n" + << logofs_flush; + #endif + + delete file; + + #ifdef DEBUG + *logofs << "Keeper: Going to erase the element " + << "while emptying.\n" + << logofs_flush; + #endif + + files_ -> erase(i); + } + + total_ = 0; + + #ifdef TEST + *logofs << "Keeper: Bytes in repository are " + << total_ << ".\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/Keeper.h b/nxcomp/src/Keeper.h new file mode 100644 index 000000000..b440beceb --- /dev/null +++ b/nxcomp/src/Keeper.h @@ -0,0 +1,199 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Keeper_H +#define Keeper_H + +#include "Misc.h" +#include "Types.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to check how many file +// nodes are allocated and deallocated. +// + +#undef REFERENCES + +class Keeper; + +class File +{ + friend class Keeper; + + public: + + File(); + + ~File(); + + // + // Allow sort by time and size. If time + // is the same, keep the bigger element. + // + + bool compare(File *b) const; + + private: + + char *name_; + + int size_; + time_t time_; + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +class Keeper +{ + public: + + Keeper(int caches, int images, const char *root, + int sleep, int parent); + + ~Keeper(); + + // + // Call this just once. + // + + int cleanupCaches(); + + // + // Call this at any given interval. + // + + int cleanupImages(); + + // + // Call this if it's time to exit. + // + + void setSignal(int signal) + { + signal_ = signal; + } + + int getSignal() + { + return signal_; + } + + int getParent() + { + return parent_; + } + + private: + + // + // Get a list of files in directory. + // + + int collect(const char *path); + + // + // Sort the collected files according to + // last modification time and delete the + // older ones until disk size is below + // the threshold. + // + + int cleanup(int threshold); + + // + // Empty the files repository. + // + + void empty(); + + // + // Size in bytes of total allowed + // storage for persistent caches. + // + + int caches_; + + // + // Size in bytes of total allowed + // storage for images cache. + // + + int images_; + + // + // Path of the NX root directory. + // + + char *root_; + + // + // The little delay to be introduced + // before reading a new entry. + // + + int sleep_; + + // + // Total size of files in repository. + // + + int total_; + + // + // The parent process, so we can exit + // if it is gone. + // + + int parent_; + + // + // Set if we need to give up because + // of a signal. + // + + int signal_; + + // + // Repository where to collect files. + // + + T_files *files_; +}; + +#endif /* Keeper_H */ + diff --git a/nxcomp/src/List.cpp b/nxcomp/src/List.cpp new file mode 100644 index 000000000..b2db7151c --- /dev/null +++ b/nxcomp/src/List.cpp @@ -0,0 +1,112 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "List.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to know how many instances +// are allocated and deallocated. +// + +#undef REFERENCES + +#ifdef REFERENCES + +int List::references_ = 0; + +#endif + +List::List() +{ + #ifdef REFERENCES + + references_++; + + *logofs << "List: Created new List at " + << this << " out of " << references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +List::~List() +{ + #ifdef REFERENCES + + references_--; + + *logofs << "List: Deleted List at " + << this << " out of " << references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +void List::remove(int value) +{ + for (T_list::iterator i = list_.begin(); i != list_.end(); i++) + { + if (*i == value) + { + list_.erase(i); + + return; + } + } + + #ifdef PANIC + *logofs << "List: PANIC! Should not try to remove " + << "an element not found in the list.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Should not try to remove " + << "an element not found in the list.\n"; + + HandleAbort(); +} + +void List::rotate() +{ + if (list_.size() > 1) + { + int value = *(list_.begin()); + + list_.pop_front(); + + list_.push_back(value); + } +} diff --git a/nxcomp/src/List.h b/nxcomp/src/List.h new file mode 100644 index 000000000..31c80f835 --- /dev/null +++ b/nxcomp/src/List.h @@ -0,0 +1,95 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef List_H +#define List_H + +#include "Misc.h" +#include "Types.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to log when lists are +// allocated and deallocated. +// + +#undef REFERENCES + +class List +{ + public: + + List(); + + ~List(); + + int getSize() + { + return list_.size(); + } + + T_list &getList() + { + return list_; + } + + T_list copyList() + { + return list_; + } + + void add(int value) + { + list_.push_back(value); + } + + void remove(int value); + + void rotate(); + + private: + + // + // The list container. + // + + T_list list_; + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +#endif /* List_H */ diff --git a/nxcomp/src/ListFontsReply.cpp b/nxcomp/src/ListFontsReply.cpp new file mode 100644 index 000000000..16be522a1 --- /dev/null +++ b/nxcomp/src/ListFontsReply.cpp @@ -0,0 +1,213 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ListFontsReply.h" + +#include "ServerCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef DUMP +#undef TEST +#undef DEBUG + +ListFontsReplyStore::ListFontsReplyStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = LISTFONTSREPLY_ENABLE_CACHE; + enableData = LISTFONTSREPLY_ENABLE_DATA; + enableSplit = LISTFONTSREPLY_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = LISTFONTSREPLY_DATA_LIMIT; + dataOffset = LISTFONTSREPLY_DATA_OFFSET; + + cacheSlots = LISTFONTSREPLY_CACHE_SLOTS; + cacheThreshold = LISTFONTSREPLY_CACHE_THRESHOLD; + cacheLowerThreshold = LISTFONTSREPLY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +ListFontsReplyStore::~ListFontsReplyStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int ListFontsReplyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; + + // + // Here is the fingerprint. + // + + listFontsReply -> number_of_names = GetUINT(buffer + 8, bigEndian); + + // + // Clean up padding bytes. + // + + if ((int) size > dataOffset) + { + unsigned int current; + unsigned int length; + unsigned int nstringInNames; + + unsigned char *end = NULL; + unsigned char *pad = NULL; + + #ifdef DUMP + + *logofs << "\n" << logofs_flush; + + *logofs << "Number of STRING8 " << listFontsReply -> number_of_names << ".\n" << logofs_flush; + + *logofs << "Size " << size << ".\n" << logofs_flush; + + DumpHexData(buffer, size); + + *logofs << "\n" << logofs_flush; + + #endif + + length = LISTFONTSREPLY_DATA_OFFSET; + + for (nstringInNames = 0; + nstringInNames < listFontsReply -> number_of_names && + listFontsReply -> number_of_names > 0; + nstringInNames++) + { + // + // Start with offset LISTFONTSREPLY_DATA_OFFSET 32. + // + + current = buffer[length]; + + length += current + 1; + + #ifdef DUMP + *logofs << "\nString number : " << nstringInNames << " Current length : " + << current << "\n" << logofs_flush; + #endif + } + + #ifdef DUMP + *logofs << "\nFinal length " << length << "\n" << logofs_flush; + #endif + + end = ((unsigned char *) buffer) + size; + + for (pad = ((unsigned char *) buffer) + length; pad < end; pad++) + { + *pad = 0; + + #ifdef DUMP + *logofs << "\nPadding ." << "\n" << logofs_flush; + #endif + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ListFontsReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; + + // + // Fill all the message's fields. + // + + PutUINT(listFontsReply -> number_of_names, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ListFontsReplyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ListFontsReplyMessage *listFontsReply = (ListFontsReplyMessage *) message; + + *logofs << name() << ": Identity number_of_names " + << listFontsReply -> number_of_names << ", size " + << listFontsReply -> size_ << ".\n"; + + #endif +} + +void ListFontsReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Field number_of_names. + // + + md5_append(md5_state_, buffer + 8, 2); +} diff --git a/nxcomp/src/ListFontsReply.h b/nxcomp/src/ListFontsReply.h new file mode 100644 index 000000000..c731878e0 --- /dev/null +++ b/nxcomp/src/ListFontsReply.h @@ -0,0 +1,146 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ListFontsReply_H +#define ListFontsReply_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define LISTFONTSREPLY_ENABLE_CACHE 1 +#define LISTFONTSREPLY_ENABLE_DATA 1 +#define LISTFONTSREPLY_ENABLE_SPLIT 0 + +#define LISTFONTSREPLY_DATA_LIMIT 1048576 - 32 +#define LISTFONTSREPLY_DATA_OFFSET 32 + +#define LISTFONTSREPLY_CACHE_SLOTS 200 +#define LISTFONTSREPLY_CACHE_THRESHOLD 20 +#define LISTFONTSREPLY_CACHE_LOWER_THRESHOLD 5 + +#define LISTFONTSREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class ListFontsReplyMessage : public Message +{ + friend class ListFontsReplyStore; + + public: + + ListFontsReplyMessage() + { + } + + ~ListFontsReplyMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned short int number_of_names; +}; + +class ListFontsReplyStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + ListFontsReplyStore(StaticCompressor *compressor); + + virtual ~ListFontsReplyStore(); + + virtual const char *name() const + { + return "ListFontsReply"; + } + + virtual unsigned char opcode() const + { + return X_ListFonts; + } + + virtual unsigned int storage() const + { + return sizeof(ListFontsReplyMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new ListFontsReplyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new ListFontsReplyMessage((const ListFontsReplyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (ListFontsReplyMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* ListFontsReply_H */ diff --git a/nxcomp/src/Loop.cpp b/nxcomp/src/Loop.cpp new file mode 100644 index 000000000..238e503b7 --- /dev/null +++ b/nxcomp/src/Loop.cpp @@ -0,0 +1,16693 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include "Misc.h" + +#ifdef __sun +#include +#endif + +// +// MacOSX 10.4 defines socklen_t. This is +// intended to ensure compatibility with +// older versions. +// + +#ifdef __APPLE__ +#include +#if MAC_OS_X_VERSION_MAX_ALLOWED <= MAC_OS_X_VERSION_10_3 +typedef int socklen_t; +#endif +#endif + +#ifdef _AIX +#include +#include +#endif + +#ifndef __CYGWIN32__ +#include +#endif + +// +// NX include files. +// + +#include "NX.h" +#include "NXalert.h" + +#include "Misc.h" +#include "Control.h" +#include "Socket.h" +#include "Statistics.h" +#include "Auth.h" +#include "Keeper.h" +#include "Agent.h" + +#include "ClientProxy.h" +#include "ServerProxy.h" + +#include "Message.h" +#include "ChannelEndPoint.h" + +// +// System specific defines. +// + + +// +// HP-UX hides this define. +// + +#if defined(hpux) && !defined(RLIM_INFINITY) + +#define RLIM_INFINITY 0x7fffffff + +#endif + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Enable log output in signal handler. +// This is likely to hang the proxy at +// random, at least on Linux. +// + +#undef UNSAFE + +// +// Let all logs go to the standard error. +// This is useful to interleave the Xlib +// log output with the proxy output in a +// single file. +// + +#undef MIXED + +// +// Define this to check if the client and +// server caches match at shutdown. This +// is a test facility as it requires that +// both proxies are running on the same +// host. +// + +#undef MATCH + +// +// If defined, reduce the size of the log +// file and be sure it never exceeds the +// limit. +// + +#undef QUOTA + +// +// If defined, force very strict limits for +// the proxy tokens and force the proxy to +// enter often in congestion state. +// + +#undef STRICT + +// +// Print a line in the log if the time we +// spent inside the select or handling the +// messages exceeded a given time value. +// + +#undef TIME + +// +// This can be useful when testing the forwarding +// of the SSHD connection by nxssh to the agent. +// The debug output will go to a well known file +// that will be opened also by nxssh when BINDER +// is enabled there. +// + +#undef BINDER + +// +// Define this to override the limits on +// the core dump size. +// + +#define COREDUMPS + +// +// Upper limit of pre-allocated buffers +// for string parameters. +// + +#define DEFAULT_STRING_LENGTH 256 + +// +// Maximum length of remote options data +// passed by peer proxy at startup. +// + +#define DEFAULT_REMOTE_OPTIONS_LENGTH 512 + +// +// Maximum length of NX display string. +// + +#define DEFAULT_DISPLAY_OPTIONS_LENGTH 1024 + +// +// Maximum number of cache file names to +// send to the server side. +// + +#define DEFAULT_REMOTE_CACHE_ENTRIES 100 + +// +// Maximum length of remote options string +// that can be received from the peer proxy. +// + +#define MAXIMUM_REMOTE_OPTIONS_LENGTH 4096 + +// +// Macro is true if we determined our proxy +// mode. +// + +#define WE_SET_PROXY_MODE (control -> ProxyMode != proxy_undefined) + +// +// Macro is true if our side is the one that +// should connect to remote. +// + +#define WE_INITIATE_CONNECTION (connectSocket.enabled()) + +// +// Is true if we must provide our credentials +// to the remote peer. +// + +#define WE_PROVIDE_CREDENTIALS (control -> ProxyMode == proxy_server) + +// +// Is true if we listen for a local forwarder +// that will tunnel the traffic through a SSH +// or HTTP link. +// + +#define WE_LISTEN_FORWARDER (control -> ProxyMode == proxy_server && \ + listenSocket.enabled()) + +// +// You must define FLUSH in Misc.h if +// you want an immediate flush of the +// log output. +// + +ostream *logofs = NULL; + +// +// Other stream destriptors used for +// logging. +// + +ostream *statofs = NULL; +ostream *errofs = NULL; + +// +// Save standard error's rdbuf here +// and restore it when exiting. +// + +static streambuf *errsbuf = NULL; + +// +// Allow faults to be recovered by +// jumping back into the main loop. +// + +jmp_buf context; + +// +// Provide operational parameters. +// + +Control *control = NULL; + +// +// Collect and print statistics. +// + +Statistics *statistics = NULL; + +// +// Keep data for X11 authentication. +// + +Auth *auth = NULL; + +// +// This class makes the hard work. +// + +Proxy *proxy = NULL; + +// +// Used to handle memory-to-memory +// transport to the X agent. +// + +Agent *agent = NULL; + +// +// The image cache house-keeping class. +// + +Keeper *keeper = NULL; + +// +// Callback set by the child process +// to be notified about signals. +// + +int (*handler)(int) = NULL; + +// +// Signal handling functions. +// + +void DisableSignals(); +void EnableSignals(); +void InstallSignals(); + +static void RestoreSignals(); +static void HandleSignal(int signal); + +// +// Signal handling utilities. +// + +static void InstallSignal(int signal, int action); +static void RestoreSignal(int signal); + +static int HandleChildren(); + +int HandleChild(int child); +static int CheckChild(int pid, int status); +static int WaitChild(int child, const char *label, int force); + +int CheckParent(const char *name, const char *type, int parent); + +void RegisterChild(int child); + +static int CheckAbort(); + +// +// Timer handling utilities. +// + +void SetTimer(int timeout); +void ResetTimer(); + +static void HandleTimer(int signal); + +// +// Kill or check a running child. +// + +static int KillProcess(int pid, const char *label, int signal, int wait); +static int CheckProcess(int pid, const char *label); + +// +// Macros used to test the pid of a child. +// + +#define IsFailed(pid) ((pid) < 0) +#define IsRunning(pid) ((pid) > 1) +#define IsNotRunning(pid) ((pid) == 0) +#define IsRestarting(pid) ((pid) == 1) + +#define SetNotRunning(pid) ((pid) = 0) +#define SetRestarting(pid) ((pid) = 1) + +// +// Start or restart the house-keeper process. +// + +static int StartKeeper(); + +// +// Cleanup functions. +// + +void CleanupConnections(); +void CleanupListeners(); +void CleanupSockets(); +void CleanupGlobal(); + +static void CleanupChildren(); +static void CleanupLocal(); +static void CleanupKeeper(); +static void CleanupStreams(); + +// +// Loop forever until the connections +// to the peer proxy is dropped. +// + +static void WaitCleanup(); + +// +// Initialization functions. +// + +static int InitBeforeNegotiation(); +static int SetupProxyConnection(); +static int InitAfterNegotiation(); +static int SetupProxyInstance(); +static int SetupAuthInstance(); +static int SetupAgentInstance(); + +static int SetupTcpSocket(); +static int SetupUnixSocket(); +static int SetupServiceSockets(); +static int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr, + unsigned int &xServerAddrLength); + +// +// Setup a listening socket and accept +// a new connection. +// + +static int ListenConnection(ChannelEndPoint &endPoint, const char *label); +static int ListenConnectionTCP(const char *host, long port, const char *label); +static int ListenConnectionUnix(const char *path, const char *label); +static int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label); +static int AcceptConnection(int fd, int domain, const char *label); + +// +// Other convenience functions. +// + +static int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFD, int* reason); +static int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* reason); + +static int WaitForRemote(ChannelEndPoint &socketAddress); +static int ConnectToRemote(ChannelEndPoint &socketAddress); + +static int SendProxyOptions(int fd); +static int SendProxyCaches(int fd); +static int ReadProxyVersion(int fd); +static int ReadProxyOptions(int fd); +static int ReadProxyCaches(int fd); +static int ReadForwarderVersion(int fd); +static int ReadForwarderOptions(int fd); + +static int ReadRemoteData(int fd, char *buffer, int size, char stop); +static int WriteLocalData(int fd, const char *buffer, int size); + +static void PrintVersionInfo(); +static void PrintProcessInfo(); +static void PrintConnectionInfo(); +static void PrintUsageInfo(const char *option, const int error); +static void PrintOptionIgnored(const char *type, const char *name, const char *value); + +// +// This is not static to avoid a warning. +// + +void PrintCopyrightInfo(); + +static const char *GetOptions(const char *options); +static const char *GetArg(int &argi, int argc, const char **argv); +static int CheckArg(const char *type, const char *name, const char *value); +static int ParseArg(const char *type, const char *name, const char *value); +static int ValidateArg(const char *type, const char *name, const char *value); +static void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value, + ChannelEndPoint &endPoint); +static int LowercaseArg(const char *type, const char *name, char *value); +static int CheckSignal(int signal); + +extern "C" +{ + int ParseCommandLineOptions(int argc, const char **argv); + int ParseEnvironmentOptions(const char *env, int force); + int ParseBindOptions(char **host, int *port); +} + +static int ParseFileOptions(const char *file); +static int ParseRemoteOptions(char *opts); +static int ParseForwarderOptions(char *opts); + +// +// These functions are used to parse literal +// values provided by the user and set the +// control parameters accordingly. +// + +static int ParseLinkOption(const char *opt); +static int ParseBitrateOption(const char *opt); +static int ParseCacheOption(const char *opt); +static int ParseShmemOption(const char *opt); +static int ParseImagesOption(const char *opt); +static int ParsePackOption(const char *opt); + +// +// Set host and port where NX proxy is supposed +// to be listening in case such parameters are +// given on the command line. +// + +static int ParseHostOption(const char *opt, char *host, long &port); + +// +// Translate a font server port specification +// to the corresponding Unix socket path. +// + +static int ParseFontPath(char *path); + +// +// Translate a pack method id in a literal. +// + +static int ParsePackMethod(const int method, const int quality); + +// +// Try to increase the size of the allowed +// core dumps. +// + +static int SetCore(); + +// +// Set the proxy mode to either client or +// server. +// + +static int SetMode(int mode); + +// +// Determine the path of the NX_* directories +// from the environment. +// + +static int SetDirectories(); + +// +// Set the defaults used for the log file and +// statistics. +// + +static int SetLogs(); + +// +// Check if local and remote protocol versions +// are compatible and, eventually, downgrade +// local version to the minimum level that is +// known to work. +// + +static int SetVersion(); + +// +// Setup the listening TCP ports used for the +// additional channels according to user's +// wishes. +// + +static int SetPorts(); + +// +// Set the maximum number of open descriptors. +// + +static int SetDescriptors(); + +// +// Set the path used for choosing the cache. +// It must be selected after determining the +// session type. +// + +static int SetCaches(); + +// +// Initialize, one after the other, all the +// configuration parameters. +// + +static int SetParameters(); + +// +// Set the specific configuration parameter. +// + +static int SetSession(); +static int SetStorage(); +static int SetShmem(); +static int SetPack(); +static int SetImages(); +static int SetLimits(); + +// +// Set up the control parameters based on +// the link speed negotiated between the +// proxies. +// + +static int SetLink(); + +static int SetLinkModem(); +static int SetLinkIsdn(); +static int SetLinkAdsl(); +static int SetLinkWan(); +static int SetLinkLan(); + +// +// Adjust the compression parameters. +// + +static int SetCompression(); + +static int SetCompressionModem(); +static int SetCompressionIsdn(); +static int SetCompressionAdsl(); +static int SetCompressionWan(); +static int SetCompressionLan(); + +// +// Determine the NX paths based on the +// user's parameters or the environment. +// + +char *GetClientPath(); + +static char *GetSystemPath(); +static char *GetHomePath(); +static char *GetTempPath(); +static char *GetRootPath(); +static char *GetCachePath(); +static char *GetImagesPath(); +static char *GetSessionPath(); +static char *GetLastCache(char *list, const char *path); + +static int OpenLogFile(char *name, ostream *&stream); +static int ReopenLogFile(char *name, ostream *&stream, int limit); + +// +// Perform operations on the managed +// descriptors in the main loop. +// + +static void handleCheckSessionInLoop(); +static void handleCheckBitrateInLoop(); + +#if defined(TEST) || defined(INFO) +static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, + fd_set &writeSet, T_timestamp selectTs); +static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs, + struct timeval &startTs); +static void handleCheckStateInLoop(int &setFDs); +#endif + +static void handleCheckSessionInConnect(); + +static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs); +static inline void handleSetWriteInLoop(fd_set &writeSet, int &setFDs, struct timeval &selectTs); +static inline void handleSetListenersInLoop(fd_set &writeSet, int &setFDs); +static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet, fd_set &writeSet, + struct timeval &selectTs); + +static void handleAlertInLoop(); +static void handleStatisticsInLoop(); + +static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs); +static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs); + +static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet); +static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet); + +static inline void handleRotateInLoop(); +static inline void handleEventsInLoop(); +static inline void handleFlushInLoop(); + +// +// Manage the proxy link during the negotiation +// phase. +// + +static void handleNegotiationInLoop(int &setFDs, fd_set &readSet, + fd_set &writeSet, T_timestamp &selectTs); + +// +// Print the 'terminating' messages in the +// session log. +// + +static inline void handleTerminatingInLoop(); +static inline void handleTerminatedInLoop(); + +// +// Monitor the size of the log file. +// + +static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs); + +// +// Directory where the NX binaries and libraries reside. +// + +static char systemDir[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Directory used for temporary files. +// + +static char tempDir[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Actually the full path to the client. +// + +static char clientDir[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// User's home directory. +// + +static char homeDir[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Root of directory structure to be created by proxy. +// + +static char rootDir[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Root of statistics and log files to be created by proxy. +// + +static char sessionDir[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Log files for errors and statistics. Error log is +// the place where we print also debug informations. +// Both files are closed, deleted and reopened as +// their size exceed the limit set in control class. +// The session log is not reopened, as it is used by +// the NX client and server to track the advance of +// the session. +// + +static char errorsFileName[DEFAULT_STRING_LENGTH] = { 0 }; +static char statsFileName[DEFAULT_STRING_LENGTH] = { 0 }; +static char sessionFileName[DEFAULT_STRING_LENGTH] = { 0 }; +static char optionsFileName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// String literal representing selected link speed +// parameter. Value is translated in control values +// used by proxies to stay synchronized. +// + +static char linkSpeedName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// String literal representing selected +// cache size. +// + +static char cacheSizeName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// String literal representing selected +// shared memory segment size. +// + +static char shsegSizeName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// String literal of images cache size. +// + +static char imagesSizeName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// String literal for bandwidth limit. +// + +static char bitrateLimitName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// String literal for image packing method. +// + +static char packMethodName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Product name provided by the server or client. +// + +static char productName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Its corresponding value from NXpack.h. +// + +static int packMethod = -1; +static int packQuality = -1; + +// +// String literal for session type. Persistent caches +// are searched in directory whose name matches this +// parameter. +// + +static char sessionType[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Unique id assigned to session. It is used as +// name of directory where all files are placed. +// + +static char sessionId[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Set if we already parsed the options. +// + +static int parsedOptions = 0; +static int parsedCommand = 0; + +// +// Buffer data received from the remote proxy at +// session negotiation. +// + +static char remoteData[MAXIMUM_REMOTE_OPTIONS_LENGTH] = { 0 }; +static int remotePosition = 0; + +// +// Main loop file descriptors. +// + +static int tcpFD = -1; +static int unixFD = -1; +static int cupsFD = -1; +static int auxFD = -1; +static int smbFD = -1; +static int mediaFD = -1; +static int httpFD = -1; +static int fontFD = -1; +static int slaveFD = -1; +static int proxyFD = -1; + +// +// Used for internal communication +// with the X agent. +// + +static int agentFD[2] = { -1, -1 }; + +// +// Flags determining which protocols and +// ports are forwarded. +// + +int useUnixSocket = 1; + +static int useTcpSocket = 1; +static int useCupsSocket = 0; +static int useAuxSocket = 0; +static int useSmbSocket = 0; +static int useMediaSocket = 0; +static int useHttpSocket = 0; +static int useFontSocket = 0; +static int useSlaveSocket = 0; +static int useAgentSocket = 0; + +// +// Set if the launchd service is running +// and its socket must be used as X socket. +// + +static int useLaunchdSocket = 0; + +// +// Set by user if he/she wants to modify +// the default TCP_NODELAY option as set +// in control. +// + +static int useNoDelay = -1; + +// +// Set if user wants to override default +// flush timeout set according to link. +// + +static int usePolicy = -1; + +// +// Set if user wants to hide the RENDER +// extension or wants to short-circuit +// some simple replies at client side. +// + +static int useRender = -1; +static int useTaint = -1; + +// +// Set if the user wants to reduce the +// nominal size of the token messages +// exchanged between the proxies. +// + +static int useStrict = -1; + +// +// Set if the proxy is running as part +// of SSH on the client. +// + +static int useEncryption = -1; + +// +// Name of Unix socket created by the client proxy to +// accept client connections. File must be unlinked +// by cleanup function. +// + +static char unixSocketName[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Other parameters. +// + +static char acceptHost[DEFAULT_STRING_LENGTH] = { 0 }; +static char displayHost[DEFAULT_STRING_LENGTH] = { 0 }; +static char authCookie[DEFAULT_STRING_LENGTH] = { 0 }; + +static int loopbackBind = DEFAULT_LOOPBACK_BIND; +static int proxyPort = DEFAULT_NX_PROXY_PORT; +static int xPort = DEFAULT_NX_X_PORT; + +// +// Used to setup the connection the real +// X display socket. +// + +static int xServerAddrFamily = -1; +static sockaddr *xServerAddr = NULL; +static unsigned int xServerAddrLength = 0; + +// +// The representation of a Unix socket path or +// a bind address, denoting where the local proxy +// will await the peer connection. +// + +static ChannelEndPoint listenSocket; + +// +// The TCP host and port or Unix file socket where +// the remote proxy will be contacted. +// + +static ChannelEndPoint connectSocket; + +// +// Helper channels are disabled by default. +// + +static ChannelEndPoint cupsPort; +static ChannelEndPoint auxPort; +static ChannelEndPoint smbPort; +static ChannelEndPoint mediaPort; +static ChannelEndPoint httpPort; +static ChannelEndPoint slavePort; + +// +// Can be either a port number or a Unix +// socket. +// + +static char fontPort[DEFAULT_STRING_LENGTH] = { 0 }; + +// +// Host and port where the existing proxy +// is running. +// + +static char bindHost[DEFAULT_STRING_LENGTH] = { 0 }; +static int bindPort = -1; + +// +// Pointers to the callback functions and +// parameter set by the agent +// + +static void (*flushCallback)(void *, int) = NULL; +static void *flushParameter = NULL; + +static void (*statisticsCallback)(void *, int) = NULL; +static void *statisticsParameter = NULL; + +// +// State variables shared between the init +// function and the main loop. +// + +T_timestamp initTs; +T_timestamp startTs; +T_timestamp logsTs; +T_timestamp nowTs; + +int diffTs; + +// +// This is set to the main proxy process id. +// + +int lastProxy = 0; + +// +// Set to last dialog process launched by proxy. +// + +int lastDialog = 0; + +// +// Set to watchdog process launched by proxy. +// + +int lastWatchdog = 0; + +// +// Set if a cache house-keeper process is running. +// + +int lastKeeper = 0; + +// +// Let an inner routine register the pid of a slave +// process. +// + +static int lastChild = 0; + +// +// Exit code of the last child process exited. +// + +static int lastStatus = 0; + +// +// Set if shutdown was requested through a signal. +// + +static int lastKill = 0; + +// +// Set if the agent confirmed the destruction of +// the NX transport. +// + +static int lastDestroy = 0; + +// +// This is set to the code and local flag of the +// last requested alert. +// + +static struct +{ + int code; + int local; + +} lastAlert; + +// +// Manage the current signal masks. +// + +static struct +{ + sigset_t saved; + + int blocked; + int installed; + + int enabled[32]; + int forward[32]; + + struct sigaction action[32]; + +} lastMasks; + +// +// Manage the current timer. +// + +static struct +{ + struct sigaction action; + struct itimerval value; + struct timeval start; + struct timeval next; + +} lastTimer; + +// +// This is set to last signal received in handler. +// + +static int lastSignal = 0; + +// +// Set to the last time bytes readable were queried +// by the agent. +// + +static T_timestamp lastReadableTs = nullTimestamp(); + +// +// Here are interfaces declared in NX.h. +// + +int NXTransProxy(int fd, int mode, const char* options) +{ + // + // Let the log temporarily go to the standard + // error. Be also sure we have a jump context, + // in the case any subsequent operation will + // cause a cleanup. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + if (setjmp(context) == 1) + { + #ifdef TEST + *logofs << "NXTransProxy: Out of the long jump with pid '" + << lastProxy << "'.\n" << logofs_flush; + #endif + + return -1; + } + + // + // Check if have already performed a parsing of + // parameters, as in the case we are running as + // a stand-alone process. If needed create the + // parameters repository + // + + if (control == NULL) + { + control = new Control(); + } + + lastProxy = getpid(); + + #ifdef TEST + *logofs << "NXTransProxy: Main process started with pid '" + << lastProxy << "'.\n" << logofs_flush; + #endif + + SetMode(mode); + + if (mode == NX_MODE_CLIENT) + { + if (fd != NX_FD_ANY) + { + #ifdef TEST + + *logofs << "NXTransProxy: Agent descriptor for X client connections is FD#" + << fd << ".\n" << logofs_flush; + + *logofs << "NXTransProxy: Disabling listening on further X client connections.\n" + << logofs_flush; + + #endif + + useTcpSocket = 0; + useUnixSocket = 0; + useAgentSocket = 1; + + agentFD[1] = fd; + } + } + else if (mode == NX_MODE_SERVER) + { + if (fd != NX_FD_ANY) + { + #ifdef TEST + *logofs << "NXTransProxy: PANIC! Agent descriptor for X server connections " + << "not supported yet.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Agent descriptor for X server connections " + << "not supported yet.\n"; + + return -1; + } + } + + const char *env = GetOptions(options); + + if (ParseEnvironmentOptions(env, 0) < 0) + { + cerr << "Error" << ": Parsing of NX transport options failed.\n"; + + return -1; + } + + // + // Set the path of the NX directories. + // + + SetDirectories(); + + // + // Open the log files. + // + + SetLogs(); + + #ifdef TEST + *logofs << "NXTransProxy: Going to run the NX transport loop.\n" + << logofs_flush; + #endif + + WaitCleanup(); + + // + // This function should never return. + // + + exit(0); +} + +void NXTransExit(int code) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + static int recurse; + + if (++recurse > 1) + { + #ifdef TEST + *logofs << "NXTransExit: Aborting process with pid '" + << getpid() << "' due to recursion through " + << "exit.\n" << logofs_flush; + #endif + + abort(); + } + + #ifdef TEST + *logofs << "NXTransExit: Process with pid '" + << getpid() << "' called exit with code '" + << code << "'.\n" << logofs_flush; + #endif + + if (control != NULL) + { + // + // Be sure that there we can detect the + // termination of the watchdog. + // + + EnableSignals(); + + // + // Close the NX transport if it was not + // shut down already. + // + + NXTransDestroy(NX_FD_ANY); + } + + exit(code); +} + +int NXTransParseCommandLine(int argc, const char **argv) +{ + return ParseCommandLineOptions(argc, argv); +} + +int NXTransParseEnvironment(const char *env, int force) +{ + return ParseEnvironmentOptions(env, force); +} + +void NXTransCleanup() +{ + HandleCleanup(); +} + +void NXTransCleanupForReconnect() +{ + HandleCleanupForReconnect(); +} + +// +// Check the parameters for subsequent +// initialization of the NX transport. +// + +int NXTransCreate(int fd, int mode, const char* options) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + // + // Be sure we have a jump context, in the + // case a subsequent operation will cause + // a cleanup. + // + + if (setjmp(context) == 1) + { + return -1; + } + + // + // Create the parameters repository + // + + if (control != NULL) + { + #ifdef PANIC + *logofs << "NXTransCreate: PANIC! The NX transport seems " + << "to be already running.\n" << logofs_flush; + #endif + + cerr << "Error" << ": The NX transport seems " + << "to be already running.\n"; + + return -1; + } + + control = new Control(); + + if (control == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating the NX transport.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error creating the NX transport.\n"; + + return -1; + } + + lastProxy = getpid(); + + #ifdef TEST + *logofs << "NXTransCreate: Caller process running with pid '" + << lastProxy << "'.\n" << logofs_flush; + #endif + + // + // Set the local proxy mode an parse the + // display NX options. + // + + SetMode(mode); + + const char *env = GetOptions(options); + + if (ParseEnvironmentOptions(env, 0) < 0) + { + cerr << "Error" << ": Parsing of NX transport options failed.\n"; + + return -1; + } + + // + // Set the path of the NX directories. + // + + SetDirectories(); + + // + // Open the log files. + // + + SetLogs(); + + // + // Use the provided descriptor. + // + + proxyFD = fd; + + #ifdef TEST + *logofs << "NXTransCreate: Called with NX proxy descriptor '" + << proxyFD << "'.\n" << logofs_flush; + #endif + + #ifdef TEST + *logofs << "NXTransCreate: Creation of the NX transport completed.\n" + << logofs_flush; + #endif + + return 1; +} + +// +// Tell the proxy to use the descriptor as the internal +// connection to the X client side NX agent. This will +// have the side effect of disabling listening for add- +// itional X client connections. +// + +int NXTransAgent(int fd[2]) +{ + // + // Be sure we have a jump context, in the + // case a subsequent operation will cause + // a cleanup. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + if (setjmp(context) == 1) + { + return -1; + } + + if (control == NULL) + { + cerr << "Error" << ": Can't set the NX agent without a NX transport.\n"; + + return -1; + } + else if (control -> ProxyMode != proxy_client) + { + #ifdef PANIC + *logofs << "NXTransAgent: Invalid mode while setting the NX agent.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid mode while setting the NX agent.\n\n"; + + return -1; + } + + useTcpSocket = 0; + useUnixSocket = 0; + useAgentSocket = 1; + + agentFD[0] = fd[0]; + agentFD[1] = fd[1]; + + #ifdef TEST + + *logofs << "NXTransAgent: Internal descriptors for agent are FD#" + << agentFD[0] << " and FD#" << agentFD[1] << ".\n" + << logofs_flush; + + *logofs << "NXTransAgent: Disabling listening for further X client " + << "connections.\n" << logofs_flush; + + #endif + + agent = new Agent(agentFD); + + if (agent == NULL || agent -> isValid() != 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating the NX memory transport .\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error creating the NX memory transport.\n"; + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "NXTransAgent: Enabling memory-to-memory transport.\n" + << logofs_flush; + #endif + + return 1; +} + +int NXTransClose(int fd) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + /* + * Only handle the proxy connection. The X + * transport will take care of closing its + * end of the socket pair. + */ + + if (control != NULL && ((agent != NULL && + (fd == agentFD[0] || fd == NX_FD_ANY)) || + (fd == proxyFD || fd == NX_FD_ANY))) + { + if (proxy != NULL) + { + #ifdef TEST + *logofs << "NXTransClose: Closing down all the X connections.\n" + << logofs_flush; + #endif + + CleanupConnections(); + } + } + #ifdef TEST + else + { + *logofs << "NXTransClose: The NX transport is not running.\n" + << logofs_flush; + } + #endif + + return 1; +} + +// +// Close down the transport and free the +// allocated NX resources. +// + +int NXTransDestroy(int fd) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + if (control != NULL && ((agent != NULL && + (fd == agentFD[0] || fd == NX_FD_ANY)) || + (fd == proxyFD || fd == NX_FD_ANY))) + { + // + // Shut down the X connections and + // wait the cleanup to complete. + // + + if (proxy != NULL) + { + #ifdef TEST + *logofs << "NXTransDestroy: Closing down all the X connections.\n" + << logofs_flush; + #endif + + CleanupConnections(); + } + + #ifdef TEST + *logofs << "NXTransDestroy: Waiting for the NX transport to terminate.\n" + << logofs_flush; + #endif + + lastDestroy = 1; + + WaitCleanup(); + } + #ifdef TEST + else + { + *logofs << "NXTransDestroy: The NX transport is not running.\n" + << logofs_flush; + } + #endif + + return 1; +} + +// +// Assume that the NX transport is valid +// as long as the control class has not +// been destroyed. +// + +int NXTransRunning(int fd) +{ + return (control != NULL); +} + +int NXTransContinue(struct timeval *selectTs) +{ + if (control != NULL) + { + // + // If no timeout is provided use + // the default. + // + + T_timestamp newTs; + + if (selectTs == NULL) + { + setTimestamp(newTs, control -> PingTimeout); + + selectTs = &newTs; + } + + // + // Use empty masks and only get the + // descriptors set by the proxy. + // + + fd_set readSet; + fd_set writeSet; + + int setFDs; + int errorFDs; + int resultFDs; + + setFDs = 0; + + FD_ZERO(&readSet); + FD_ZERO(&writeSet); + + // + // Run a new loop. If the transport + // is gone avoid sleeping until the + // timeout. + // + + if (NXTransPrepare(&setFDs, &readSet, &writeSet, selectTs) != 0) + { + NXTransSelect(&resultFDs, &errorFDs, &setFDs, &readSet, &writeSet, selectTs); + + NXTransExecute(&resultFDs, &errorFDs, &setFDs, &readSet, &writeSet, selectTs); + } + } + + return (control != NULL); +} + +int NXTransSignal(int signal, int action) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + if (control == NULL) + { + return 0; + } + + if (action == NX_SIGNAL_RAISE) + { + #ifdef TEST + *logofs << "NXTransSignal: Raising signal '" << DumpSignal(signal) + << "' in the proxy handler.\n" << logofs_flush; + #endif + + HandleSignal(signal); + + return 1; + } + else if (signal == NX_SIGNAL_ANY) + { + #ifdef TEST + *logofs << "NXTransSignal: Setting action of all signals to '" + << action << "'.\n" << logofs_flush; + #endif + + for (int i = 0; i < 32; i++) + { + if (CheckSignal(i) == 1) + { + NXTransSignal(i, action); + } + } + + return 1; + } + else if (CheckSignal(signal) == 1) + { + #ifdef TEST + *logofs << "NXTransSignal: Setting action of signal '" + << DumpSignal(signal) << "' to '" << action + << "'.\n" << logofs_flush; + #endif + + if (action == NX_SIGNAL_ENABLE || + action == NX_SIGNAL_FORWARD) + { + InstallSignal(signal, action); + + return 1; + } + else if (action == NX_SIGNAL_DISABLE) + { + RestoreSignal(signal); + + return 1; + } + } + + #ifdef WARNING + *logofs << "NXTransSignal: WARNING! Unable to perform action '" + << action << "' on signal '" << DumpSignal(signal) + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Unable to perform action '" << action + << "' on signal '" << DumpSignal(signal) + << "'.\n"; + + return -1; +} + +int NXTransCongestion(int fd) +{ + if (control != NULL && proxy != NULL) + { + #ifdef DUMP + + int congestion = proxy -> getCongestion(proxyFD); + + *logofs << "NXTransCongestion: Returning " << congestion + << " as current congestion level.\n" << logofs_flush; + + return congestion; + + #endif + + return (proxy -> getCongestion(proxyFD)); + } + + return 0; +} + +int NXTransHandler(int fd, int type, void (*handler)(void *parameter, + int reason), void *parameter) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + switch (type) + { + case NX_HANDLER_FLUSH: + { + flushCallback = handler; + flushParameter = parameter; + + break; + } + case NX_HANDLER_STATISTICS: + { + // + // Reporting of statistics by the agent + // still needs to be implemented. + // + + statisticsCallback = handler; + statisticsParameter = parameter; + + break; + } + default: + { + #ifdef TEST + *logofs << "NXTransHandler: WARNING! Failed to set " + << "the NX callback for event '" << type << "' to '" + << (void *) handler << "' and parameter '" + << parameter << "'.\n" << logofs_flush; + #endif + + return 0; + } + } + + #ifdef TEST + *logofs << "NXTransHandler: Set the NX " + << "callback for event '" << type << "' to '" + << (void *) handler << "' and parameter '" + << parameter << "'.\n" << logofs_flush; + #endif + + return 1; +} + +int NXTransRead(int fd, char *data, int size) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + if (control != NULL && agent != NULL && + fd == agentFD[0]) + { + #ifdef DUMP + *logofs << "NXTransRead: Dequeuing " << size << " bytes " + << "from FD#" << agentFD[0] << ".\n" << logofs_flush; + #endif + + int result = agent -> dequeueData(data, size); + + #ifdef DUMP + + if (result < 0 && EGET() == EAGAIN) + { + *logofs << "NXTransRead: WARNING! Dequeuing from FD#" + << agentFD[0] << " would block.\n" << logofs_flush; + } + else + { + *logofs << "NXTransRead: Dequeued " << result << " bytes " + << "to FD#" << agentFD[0] << ".\n" << logofs_flush; + } + + #endif + + return result; + } + else + { + #ifdef DUMP + *logofs << "NXTransRead: Reading " << size << " bytes " + << "from FD#" << fd << ".\n" << logofs_flush; + #endif + + return read(fd, data, size); + } +} + +int NXTransReadVector(int fd, struct iovec *iovdata, int iovsize) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + if (control != NULL && agent != NULL && + fd == agentFD[0]) + { + #if defined(DUMP) + + if (control -> ProxyStage >= stage_operational && + agent -> localReadable() > 0) + { + *logofs << "NXTransReadVector: WARNING! Agent has data readable.\n" + << logofs_flush; + } + + #endif + + char *base; + + int length; + int result; + + struct iovec *vector = iovdata; + int count = iovsize; + + ESET(0); + + int i = 0; + int total = 0; + + for (; i < count; i++, vector++) + { + length = vector -> iov_len; + base = (char *) vector -> iov_base; + + while (length > 0) + { + #ifdef DUMP + *logofs << "NXTransReadVector: Dequeuing " << length + << " bytes " << "from FD#" << agentFD[0] << ".\n" + << logofs_flush; + #endif + + result = agent -> dequeueData(base, length); + + #ifdef DUMP + + if (result < 0 && EGET() == EAGAIN) + { + *logofs << "NXTransReadVector: WARNING! Dequeuing from FD#" + << agentFD[0] << " would block.\n" << logofs_flush; + } + else + { + *logofs << "NXTransReadVector: Dequeued " << result + << " bytes " << "from FD#" << agentFD[0] << ".\n" + << logofs_flush; + } + + #endif + + if (result < 0 && total == 0) + { + return result; + } + else if (result <= 0) + { + return total; + } + + ESET(0); + + length -= result; + total += result; + base += result; + } + } + + return total; + } + else + { + #ifdef DUMP + *logofs << "NXTransReadVector: Reading vector with " + << iovsize << " elements from FD#" << fd << ".\n" + << logofs_flush; + #endif + + return readv(fd, iovdata, iovsize); + } +} + +int NXTransReadable(int fd, int *readable) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + if (control == NULL || agent == NULL || + fd != agentFD[0]) + { + #ifdef DUMP + + int result = GetBytesReadable(fd, readable); + + if (result == -1) + { + *logofs << "NXTransReadable: Error detected on FD#" + << fd << ".\n" << logofs_flush; + } + else + { + *logofs << "NXTransReadable: Returning " << *readable + << " bytes as readable from FD#" << fd + << ".\n" << logofs_flush; + } + + return result; + + #else + + return GetBytesReadable(fd, readable); + + #endif + } + + int result = agent -> dequeuableData(); + + switch (result) + { + case 0: + { + // + // The client might have enqueued data to our side + // and is now checking for the available events. As + // _XEventsQueued() may omit to call _XSelect(), we + // handle here the new data that is coming from the + // proxy to avoid spinning through this function + // again. + // + + if (proxy != NULL && proxy -> canRead() == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "NXTransReadable: WARNING! Trying to " + << "read to generate new agent data.\n" + << logofs_flush; + #endif + + // + // Set the context as the function + // can cause a cleanup. + // + + if (setjmp(context) == 1) + { + return -1; + } + + if (proxy -> handleRead() < 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "NXTransReadable: Failure reading " + << "messages from proxy FD#" << proxyFD + << ".\n" << logofs_flush; + #endif + + HandleShutdown(); + } + + // + // Call again the routine. By reading + // new control messages from the proxy + // the agent channel may be gone. + // + + return NXTransReadable(fd, readable); + } + + #ifdef DUMP + *logofs << "NXTransReadable: Returning " << 0 + << " bytes as readable from FD#" << fd + << " with result 0.\n" << logofs_flush; + #endif + + *readable = 0; + + return 0; + } + case -1: + { + #ifdef DUMP + *logofs << "NXTransReadable: Returning " << 0 + << " bytes as readable from FD#" << fd + << " with result -1.\n" << logofs_flush; + #endif + + *readable = 0; + + return -1; + } + default: + { + #ifdef DUMP + *logofs << "NXTransReadable: Returning " << result + << " bytes as readable from FD#" << fd + << " with result 0.\n" << logofs_flush; + #endif + + *readable = result; + + return 0; + } + } +} + +int NXTransWrite(int fd, char *data, int size) +{ + // + // Be sure we have a valid log file. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + if (control != NULL && agent != NULL && + fd == agentFD[0]) + { + int result; + + if (proxy != NULL) + { + if (proxy -> canRead(agentFD[1]) == 0) + { + #if defined(DUMP) || defined(TEST) + *logofs << "NXTransWrite: WARNING! Delayed enqueuing to FD#" + << agentFD[0] << " with proxy unable to read.\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + + return -1; + } + + // + // Set the context as the function + // can cause a cleanup. + // + + if (setjmp(context) == 1) + { + return -1; + } + + // + // Don't enqueue the data to the transport + // but let the channel borrow the buffer. + // + + #ifdef DUMP + *logofs << "NXTransWrite: Letting the channel borrow " + << size << " bytes from FD#" << agentFD[0] + << ".\n" << logofs_flush; + #endif + + result = proxy -> handleRead(agentFD[1], data, size); + + if (result == 1) + { + result = size; + } + else + { + if (result == 0) + { + ESET(EAGAIN); + } + else + { + ESET(EPIPE); + } + + result = -1; + } + } + else + { + // + // We don't have a proxy connection, yet. + // Enqueue the data to the agent transport. + // + + #ifdef DUMP + *logofs << "NXTransWrite: Enqueuing " << size << " bytes " + << "to FD#" << agentFD[0] << ".\n" << logofs_flush; + #endif + + result = agent -> enqueueData(data, size); + } + + #ifdef DUMP + + if (result < 0) + { + if (EGET() == EAGAIN) + { + *logofs << "NXTransWrite: WARNING! Enqueuing to FD#" + << agentFD[0] << " would block.\n" + << logofs_flush; + } + else + { + *logofs << "NXTransWrite: WARNING! Error enqueuing to FD#" + << agentFD[0] << ".\n" << logofs_flush; + } + } + else + { + *logofs << "NXTransWrite: Enqueued " << result << " bytes " + << "to FD#" << agentFD[0] << ".\n" << logofs_flush; + } + + #endif + + return result; + } + else + { + #ifdef DUMP + *logofs << "NXTransWrite: Writing " << size << " bytes " + << "to FD#" << fd << ".\n" << logofs_flush; + #endif + + return write(fd, data, size); + } +} + +int NXTransWriteVector(int fd, struct iovec *iovdata, int iovsize) +{ + // + // Be sure we have a valid log file and a + // jump context because we will later call + // functions that can perform a cleanup. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + int result = 0; + + if (control != NULL && agent != NULL && + fd == agentFD[0]) + { + // + // See the comment in NXTransWrite(). + // + + if (proxy != NULL) + { + if (proxy -> canRead(agentFD[1]) == 0) + { + #if defined(DUMP) || defined(TEST) + *logofs << "NXTransWriteVector: WARNING! Delayed enqueuing to FD#" + << agentFD[0] << " with proxy unable to read.\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + + return -1; + } + } + + // + // Set the context as the function + // can cause a cleanup. + // + + if (setjmp(context) == 1) + { + return -1; + } + + char *base; + + int length; + + struct iovec *vector = iovdata; + int count = iovsize; + + ESET(0); + + int i = 0; + int total = 0; + + for (; i < count; i++, vector++) + { + length = vector -> iov_len; + base = (char *) vector -> iov_base; + + while (length > 0) + { + if (proxy != NULL) + { + // + // Don't enqueue the data to the transport + // but let the channel borrow the buffer. + // + + #ifdef DUMP + *logofs << "NXTransWriteVector: Letting the channel borrow " + << length << " bytes from FD#" << agentFD[0] + << ".\n" << logofs_flush; + #endif + + result = proxy -> handleRead(agentFD[1], base, length); + + if (result == 1) + { + result = length; + } + else + { + if (result == 0) + { + ESET(EAGAIN); + } + else + { + ESET(EPIPE); + } + + result = -1; + } + } + else + { + // + // We don't have a proxy connection, yet. + // Enqueue the data to the agent transport. + // + + #ifdef DUMP + *logofs << "NXTransWriteVector: Enqueuing " << length + << " bytes " << "to FD#" << agentFD[0] << ".\n" + << logofs_flush; + #endif + + result = agent -> enqueueData(base, length); + } + + #ifdef DUMP + + if (result < 0) + { + if (EGET() == EAGAIN) + { + *logofs << "NXTransWriteVector: WARNING! Enqueuing to FD#" + << agentFD[0] << " would block.\n" + << logofs_flush; + } + else + { + *logofs << "NXTransWriteVector: WARNING! Error enqueuing to FD#" + << agentFD[0] << ".\n" << logofs_flush; + } + } + else + { + *logofs << "NXTransWriteVector: Enqueued " << result + << " bytes " << "to FD#" << agentFD[0] << ".\n" + << logofs_flush; + } + + #endif + + if (result < 0 && total == 0) + { + return result; + } + else if (result <= 0) + { + return total; + } + + ESET(0); + + length -= result; + total += result; + base += result; + } + } + + return total; + } + else + { + #ifdef DUMP + *logofs << "NXTransWriteVector: Writing vector with " + << iovsize << " elements to FD#" << fd << ".\n" + << logofs_flush; + #endif + + return writev(fd, iovdata, iovsize); + } +} + +int NXTransPolicy(int fd, int type) +{ + if (control != NULL) + { + if (usePolicy == -1) + { + #if defined(TEST) || defined(INFO) + *logofs << "NXTransPolicy: Setting flush policy on " + << "proxy FD#" << proxyFD << " to '" + << DumpPolicy(type == NX_POLICY_DEFERRED ? + policy_deferred : policy_immediate) + << "'.\n" << logofs_flush; + #endif + + control -> FlushPolicy = (type == NX_POLICY_DEFERRED ? + policy_deferred : policy_immediate); + + if (proxy != NULL) + { + proxy -> handleFlush(); + } + + return 1; + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "NXTransPolicy: Ignoring the agent " + << "setting with user policy set to '" + << DumpPolicy(control -> FlushPolicy) + << "'.\n" << logofs_flush; + #endif + + return 0; + } + } + + return 0; +} + +int NXTransFlushable(int fd) +{ + if (proxy == NULL || agent == NULL || + fd != agentFD[0]) + { + #ifdef DUMP + *logofs << "NXTransFlushable: Returning 0 bytes as " + << "flushable for unrecognized FD#" << fd + << ".\n" << logofs_flush; + #endif + + return 0; + } + else + { + #if defined(DUMP) || defined(INFO) + *logofs << "NXTransFlushable: Returning " << proxy -> + getFlushable(proxyFD) << " as bytes flushable on " + << "proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + return proxy -> getFlushable(proxyFD); + } +} + +int NXTransFlush(int fd) +{ + if (proxy != NULL) + { + #if defined(TEST) || defined(INFO) + *logofs << "NXTransFlush: Requesting an immediate flush of " + << "proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + return proxy -> handleFlush(); + } + + return 0; +} + +int NXTransChannel(int fd, int channelFd, int type) +{ + if (proxy != NULL) + { + // + // Set the context as the function + // can cause a cleanup. + // + + if (setjmp(context) == 1) + { + return -1; + } + + #if defined(TEST) || defined(INFO) + *logofs << "NXTransChannel: Going to create a new channel " + << "with type '" << type << "' on FD#" << channelFd + << ".\n" << logofs_flush; + #endif + + int result = -1; + + switch (type) + { + case NX_CHANNEL_X11: + { + if (useUnixSocket == 1 || useTcpSocket == 1 || + useAgentSocket == 1 || useAuxSocket == 1) + { + result = proxy -> handleNewConnection(channel_x11, channelFd); + } + + break; + } + case NX_CHANNEL_CUPS: + { + if (useCupsSocket == 1) + { + result = proxy -> handleNewConnection(channel_cups, channelFd); + } + + break; + } + case NX_CHANNEL_SMB: + { + if (useSmbSocket == 1) + { + result = proxy -> handleNewConnection(channel_smb, channelFd); + } + + break; + } + case NX_CHANNEL_MEDIA: + { + if (useMediaSocket == 1) + { + result = proxy -> handleNewConnection(channel_media, channelFd); + } + + break; + } + case NX_CHANNEL_HTTP: + { + if (useHttpSocket == 1) + { + result = proxy -> handleNewConnection(channel_http, channelFd); + } + + break; + } + case NX_CHANNEL_FONT: + { + if (useFontSocket == 1) + { + result = proxy -> handleNewConnection(channel_font, channelFd); + } + + break; + } + case NX_CHANNEL_SLAVE: + { + if (useSlaveSocket == 1) + { + result = proxy -> handleNewConnection(channel_slave, channelFd); + } + + break; + } + default: + { + #ifdef WARNING + *logofs << "NXTransChannel: WARNING! Unrecognized channel " + << "type '" << type << "'.\n" << logofs_flush; + #endif + + break; + } + } + + #ifdef WARNING + + if (result != 1) + { + *logofs << "NXTransChannel: WARNING! Could not create the " + << "new channel with type '" << type << "' on FD#" + << channelFd << ".\n" << logofs_flush; + } + + #endif + + return result; + } + + return 0; +} + +const char *NXTransFile(int type) +{ + char *name = NULL; + + switch (type) + { + case NX_FILE_SESSION: + { + name = sessionFileName; + + break; + } + case NX_FILE_ERRORS: + { + name = errorsFileName; + + break; + } + case NX_FILE_OPTIONS: + { + name = optionsFileName; + + break; + } + case NX_FILE_STATS: + { + name = statsFileName; + + break; + } + } + + if (name != NULL && *name != '\0') + { + return name; + } + + return NULL; +} + +long NXTransTime() +{ + static T_timestamp last = getTimestamp(); + + T_timestamp now = getTimestamp(); + + long diff = diffTimestamp(last, now); + + last = now; + + return diff; +} + +int NXTransAlert(int code, int local) +{ + if (proxy != NULL) + { + #if defined(DUMP) || defined(INFO) + *logofs << "NXTransAlert: Requesting a NX dialog with code " + << code << " and local " << local << ".\n" + << logofs_flush; + #endif + + if (local == 0) + { + // + // Set the context as the function + // can cause a cleanup. + // + + if (setjmp(context) == 1) + { + return -1; + } + + proxy -> handleAlert(code); + } + else + { + // + // Show the alert at the next loop. + // + + HandleAlert(code, local); + } + + return 1; + } + #if defined(DUMP) || defined(INFO) + else + { + if (logofs == NULL) + { + logofs = &cerr; + } + + *logofs << "NXTransAlert: Can't request an alert without " + << "a valid NX transport.\n" << logofs_flush; + } + #endif + + return 0; +} + +// +// Prepare the file sets and the timeout +// for a later execution of the select(). +// + +int NXTransPrepare(int *setFDs, fd_set *readSet, + fd_set *writeSet, struct timeval *selectTs) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + // + // Control is NULL if the NX transport was + // reset or was never created. If control + // is valid then prepare to jump back when + // the transport is destroyed. + // + + if (control == NULL || setjmp(context) == 1) + { + return 0; + } + + #if defined(TEST) || defined(INFO) + *logofs << "\nNXTransPrepare: Going to prepare the NX transport.\n" + << logofs_flush; + #endif + + if (control -> ProxyStage < stage_operational) + { + handleNegotiationInLoop(*setFDs, *readSet, *writeSet, *selectTs); + } + else + { + #if defined(TEST) || defined(INFO) + + if (isTimestamp(*selectTs) == 0) + { + *logofs << "Loop: WARNING! Preparing the select with requested " + << "timeout of " << selectTs -> tv_sec << " S and " + << (double) selectTs -> tv_usec / 1000 << " Ms.\n" + << logofs_flush; + } + else + { + *logofs << "Loop: Preparing the select with requested " + << "timeout of " << selectTs -> tv_sec << " S and " + << (double) selectTs -> tv_usec / 1000 << " Ms.\n" + << logofs_flush; + } + + #endif + + // + // Set descriptors of listening sockets. + // + + handleSetListenersInLoop(*readSet, *setFDs); + + // + // Set descriptors of both proxy and X + // connections. + // + + handleSetReadInLoop(*readSet, *setFDs, *selectTs); + + // + // Find out which file descriptors have + // data to write. + // + + handleSetWriteInLoop(*writeSet, *setFDs, *selectTs); + } + + // + // Prepare the masks for handling the memory- + // to-memory transport. This is required even + // during session negotiation. + // + + if (agent != NULL) + { + handleSetAgentInLoop(*setFDs, *readSet, *writeSet, *selectTs); + } + + // + // Register time spent handling messages. + // + + nowTs = getNewTimestamp(); + + diffTs = diffTimestamp(startTs, nowTs); + + #ifdef TEST + *logofs << "Loop: Mark - 0 - at " << strMsTimestamp() + << " with " << diffTs << " Ms elapsed.\n" + << logofs_flush; + #endif + + // + // TODO: Should add the read time in two + // parts otherwise the limits are checked + // before the counters are updated with + // time spent in the last loop. + // + + if (control -> ProxyStage >= stage_operational) + { + statistics -> addReadTime(diffTs); + } + + startTs = nowTs; + + #ifdef DEBUG + *logofs << "Loop: New timestamp is " << strMsTimestamp(startTs) + << ".\n" << logofs_flush; + #endif + + return 1; +} + +// +// Let's say that we call select() to find out +// if any of the handled descriptors has data, +// but actually things are a bit more complex +// than that. +// + +int NXTransSelect(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet, + fd_set *writeSet, struct timeval *selectTs) +{ + #ifdef TIME + + static T_timestamp lastTs; + + #endif + + if (logofs == NULL) + { + logofs = &cerr; + } + + // + // Control is NULL if the NX transport was + // reset or never created. If control is + // valid then prepare for jumping back in + // the case of an error. + // + + if (control == NULL || setjmp(context) == 1) + { + *resultFDs = select(*setFDs, readSet, writeSet, NULL, selectTs); + + *errorFDs = errno; + + return 0; + } + + #if defined(TEST) || defined(INFO) + *logofs << "\nNXTransSelect: Going to select the NX descriptors.\n" + << logofs_flush; + #endif + + #if defined(TEST) || defined(INFO) + + handleCheckSelectInLoop(*setFDs, *readSet, *writeSet, *selectTs); + + #endif + + #ifdef TIME + + diffTs = diffTimestamp(lastTs, getNewTimestamp()); + + if (diffTs > 20) + { + *logofs << "Loop: TIME! Spent " << diffTs + << " Ms handling messages for proxy FD#" + << proxyFD << ".\n" << logofs_flush; + } + + lastTs = getNewTimestamp(); + + #endif + + #if defined(TEST) || defined(INFO) + + if (isTimestamp(*selectTs) == 0) + { + *logofs << "Loop: WARNING! Executing the select with requested " + << "timeout of " << selectTs -> tv_sec << " S and " + << (double) selectTs -> tv_usec / 1000 << " Ms.\n" + << logofs_flush; + } + else if (proxy != NULL && proxy -> getFlushable(proxyFD) > 0) + { + *logofs << "Loop: WARNING! Proxy FD#" << proxyFD + << " has " << proxy -> getFlushable(proxyFD) + << " bytes to write but timeout is " + << selectTs -> tv_sec << " S and " + << selectTs -> tv_usec / 1000 << " Ms.\n" + << logofs_flush; + } + + #endif + + // + // Wait for the selected sockets + // or the timeout. + // + + ESET(0); + + *resultFDs = select(*setFDs, readSet, writeSet, NULL, selectTs); + + *errorFDs = EGET(); + + #ifdef TIME + + diffTs = diffTimestamp(lastTs, getNewTimestamp()); + + if (diffTs > 100) + { + *logofs << "Loop: TIME! Spent " << diffTs + << " Ms waiting for new data for proxy FD#" + << proxyFD << ".\n" << logofs_flush; + } + + lastTs = getNewTimestamp(); + + #endif + + // + // Check the result of the select. + // + + #if defined(TEST) || defined(INFO) + + handleCheckResultInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs, startTs); + + #endif + + // + // Get time spent in select. The accouting is done + // in milliseconds. This is a real problem on fast + // machines where each loop is unlikely to take + // more than 500 us, so consider that the results + // can be inaccurate. + // + + nowTs = getNewTimestamp(); + + diffTs = diffTimestamp(startTs, nowTs); + + #ifdef TEST + *logofs << "Loop: Out of select after " << diffTs << " Ms " + << "at " << strMsTimestamp(nowTs) << " with result " + << *resultFDs << ".\n" << logofs_flush; + #endif + + startTs = nowTs; + + #ifdef DEBUG + *logofs << "Loop: New timestamp is " << strMsTimestamp(startTs) + << ".\n" << logofs_flush; + #endif + + if (control -> ProxyStage >= stage_operational) + { + statistics -> addIdleTime(diffTs); + } + + if (*resultFDs < 0) + { + // + // Check if the call was interrupted or if any of the + // managed descriptors has become invalid. This can + // happen to the X11 code, before the descriptor is + // removed from the managed set. + // + + #ifdef __sun + + if (*errorFDs == EINTR || *errorFDs == EBADF || + *errorFDs == EINVAL) + + #else + + if (*errorFDs == EINTR || *errorFDs == EBADF) + + #endif + + { + #ifdef TEST + + if (*errorFDs == EINTR) + { + *logofs << "Loop: Select failed due to EINTR error.\n" + << logofs_flush; + } + else + { + *logofs << "Loop: WARNING! Call to select failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + } + + #endif + } + else + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to select failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Call to select failed. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + HandleCleanup(); + } + } + + return 1; +} + +// +// Perform the required actions on all +// the descriptors having I/O pending. +// + +int NXTransExecute(int *resultFDs, int *errorFDs, int *setFDs, fd_set *readSet, + fd_set *writeSet, struct timeval *selectTs) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + // + // Control is NULL if the NX transport was + // reset or never created. If control is + // valid then prepare for jumping back in + // the case of an error. + // + + if (control == NULL || setjmp(context) == 1) + { + return 0; + } + + #if defined(TEST) || defined(INFO) + *logofs << "\nNXTransExecute: Going to execute I/O on the NX descriptors.\n" + << logofs_flush; + #endif + + if (control -> ProxyStage >= stage_operational) + { + // + // Check if I/O is possible on the proxy and + // local agent descriptors. + // + + if (agent != NULL) + { + handleAgentInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs); + } + + #ifdef TEST + *logofs << "Loop: Mark - 1 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + + // + // Rotate the channel that will be handled + // first. + // + + handleRotateInLoop(); + + // + // Flush any data on newly writable sockets. + // + + handleWritableInLoop(*resultFDs, *writeSet); + + #ifdef TEST + *logofs << "Loop: Mark - 2 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + + // + // Check if any socket has become readable. + // + + handleReadableInLoop(*resultFDs, *readSet); + + #ifdef TEST + *logofs << "Loop: Mark - 3 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + + // + // Handle the scheduled events on channels. + // + // - Restart, if possible, any client that was + // put to sleep. + // + // - Check if there are pointer motion events to + // flush. This applies only to X server side. + // + // - Check if any channel has exited the conges- + // tion state. + // + // - Check if there are images that are currently + // being streamed. + // + + handleEventsInLoop(); + + #ifdef TEST + *logofs << "Loop: Mark - 4 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + + // + // Check if user sent a signal to produce + // statistics. + // + + handleStatisticsInLoop(); + + // + // We may have flushed the proxy link or + // handled data coming from the remote. + // Post-process the masks and set the + // selected agent descriptors as ready. + // + + if (agent != NULL) + { + handleAgentLateInLoop(*resultFDs, *errorFDs, *setFDs, *readSet, *writeSet, *selectTs); + } + + #ifdef TEST + *logofs << "Loop: Mark - 5 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + + // + // Check if there is any data to flush. + // Agents should flush the proxy link + // explicitly. + // + + handleFlushInLoop(); + + #ifdef TEST + *logofs << "Loop: Mark - 6 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + } + + // + // Check if we have an alert to show. + // + + handleAlertInLoop(); + + if (control -> ProxyStage >= stage_operational) + { + // + // Check if it's time to give up. + // + + handleCheckSessionInLoop(); + + // + // Check if local proxy is consuming + // too many resources. + // + + handleCheckBitrateInLoop(); + + // + // Check coherency of internal state. + // + + #if defined(TEST) || defined(INFO) + + handleCheckStateInLoop(*setFDs); + + #endif + + #ifdef TEST + *logofs << "Loop: Mark - 7 - at " << strMsTimestamp() + << " with " << diffTimestamp(startTs, getTimestamp()) + << " Ms elapsed.\n" << logofs_flush; + #endif + } + + // + // Truncate the logs if needed. + // + + handleLogReopenInLoop(logsTs, nowTs); + + return 1; +} + +// +// Initialize the connection parameters and +// prepare for negotiating the link with the +// remote proxy. +// + +int InitBeforeNegotiation() +{ + // + // Disable limits on core dumps. + // + + SetCore(); + + // + // Install the signal handlers. + // + + InstallSignals(); + + // + // Track how much time we spent in initialization. + // + + nowTs = getNewTimestamp(); + + startTs = nowTs; + initTs = nowTs; + + #ifdef TEST + *logofs << "Loop: INIT! Taking mark for initialization at " + << strMsTimestamp(initTs) << ".\n" + << logofs_flush; + #endif + + // + // If not explicitly specified, determine if local + // mode is client or server according to parameters + // provided so far. + // + + if (WE_SET_PROXY_MODE == 0) + { + cerr << "Error" << ": Please specify either the -C or -S option.\n"; + + HandleCleanup(); + } + + // + // Start a watchdog. If initialization cannot + // be completed before timeout, then clean up + // everything and exit. + // + + if (control -> ProxyMode == proxy_client) + { + #ifdef TEST + *logofs << "Loop: Starting watchdog process with timeout of " + << control -> InitTimeout / 1000 << " seconds.\n" + << logofs_flush; + #endif + + lastWatchdog = NXTransWatchdog(control -> InitTimeout); + + if (IsFailed(lastWatchdog)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't start the NX watchdog process.\n" + << logofs_flush; + #endif + + SetNotRunning(lastWatchdog); + } + #ifdef TEST + else + { + *logofs << "Loop: Watchdog started with pid '" + << lastWatchdog << "'.\n" << logofs_flush; + } + #endif + } + + // + // Print preliminary info. + // + + PrintProcessInfo(); + + // + // Set cups, multimedia and other + // auxiliary ports. + // + + SetPorts(); + + // + // Increase the number of maximum open + // file descriptors for this process. + // + + SetDescriptors(); + + // + // Set local endianess. + // + + unsigned int test = 1; + + setHostBigEndian(*((unsigned char *) (&test)) == 0); + + #ifdef TEST + *logofs << "Loop: Local host is " + << (hostBigEndian() ? "big endian" : "little endian") + << ".\n" << logofs_flush; + #endif + + if (control -> ProxyMode == proxy_client) + { + // + // Listen on sockets that mimic an X display to + // which X clients will be able to connect (e.g. + // unix:8 and/or localhost:8). + // + + if (useTcpSocket == 1) + { + SetupTcpSocket(); + } + + if (useUnixSocket == 1) + { + SetupUnixSocket(); + } + } + else + { + // + // Don't listen for X connections. + // + + useUnixSocket = 0; + useTcpSocket = 0; + useAgentSocket = 0; + + // + // Get ready to open the local display. + // + + SetupDisplaySocket(xServerAddrFamily, xServerAddr, xServerAddrLength); + } + + // + // If we are the NX server-side proxy we need to + // complete our initializazion. We will mandate + // our parameters at the time the NX client will + // connect. + // + + if (control -> ProxyMode == proxy_client) + { + SetParameters(); + } + + return 1; +} + +int SetupProxyConnection() +{ + + if (proxyFD == -1) + { + + char *socketUri = NULL; + + // Let's make sure, the default value for listenSocket is properly set. Doing this + // here, because we have to make sure that we call it after the connectSocket + // declaration is really really complete. + + if (listenSocket.disabled() && connectSocket.disabled()) + { + char listenPortValue[20] = { 0 }; + sprintf(listenPortValue, "%ld", (long)(proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET)); + + SetAndValidateChannelEndPointArg("local", "listen", listenPortValue, listenSocket); + } + + #ifdef TEST + connectSocket.getSpec(&socketUri); + *logofs << "Loop: connectSocket is "<< ( connectSocket.enabled() ? "enabled" : "disabled") << ". " + << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "") << "'.\n" << logofs_flush; + listenSocket.getSpec(&socketUri); + *logofs << "Loop: listenSocket is "<< ( listenSocket.enabled() ? "enabled" : "disabled") << ". " + << "The socket URI is '"<< ( socketUri != NULL ? socketUri : "") << "'.\n" << logofs_flush; + free(socketUri); + socketUri = NULL; + #endif + + if (WE_INITIATE_CONNECTION) + { + if (connectSocket.getSpec(&socketUri)) + { + #ifdef TEST + *logofs << "Loop: Going to connect to '" << socketUri + << "'.\n" << logofs_flush; + #endif + free(socketUri); + + proxyFD = ConnectToRemote(connectSocket); + + #ifdef TEST + *logofs << "Loop: Connected to remote proxy on FD#" + << proxyFD << ".\n" << logofs_flush; + #endif + + cerr << "Info" << ": Connected to remote proxy on FD#" + << proxyFD << ".\n"; + } + } + else + { + + if (listenSocket.isTCPSocket() && (listenSocket.getTCPPort() < 0)) + { + listenSocket.setSpec(DEFAULT_NX_PROXY_PORT_OFFSET + proxyPort); + } + + if (listenSocket.getSpec(&socketUri)) + { + #ifdef TEST + *logofs << "Loop: Going to wait for connection at '" + << socketUri << "'.\n" << logofs_flush; + #endif + free(socketUri); + + proxyFD = WaitForRemote(listenSocket); + + #ifdef TEST + if (WE_LISTEN_FORWARDER) + { + *logofs << "Loop: Connected to remote forwarder on FD#" + << proxyFD << ".\n" << logofs_flush; + } + else + { + *logofs << "Loop: Connected to remote proxy on FD#" + << proxyFD << ".\n" << logofs_flush; + } + #endif + + } + } + } + #ifdef TEST + else + { + *logofs << "Loop: Using the inherited connection on FD#" + << proxyFD << ".\n" << logofs_flush; + } + #endif + + // + // Set TCP_NODELAY on proxy descriptor + // to reduce startup time. Option will + // later be disabled if needed. + // + // either listenSocket or connectSocket is used here... + + if(listenSocket.isTCPSocket() || connectSocket.isTCPSocket()) + + SetNoDelay(proxyFD, 1); + + // + // We need non-blocking input since the + // negotiation phase. + // + + SetNonBlocking(proxyFD, 1); + + return 1; +} + +// +// Create the required proxy and channel classes +// and get ready for handling the encoded traffic. +// + +int InitAfterNegotiation() +{ + #ifdef TEST + *logofs << "Loop: Connection with remote proxy completed.\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Connection with remote proxy completed.\n" + << logofs_flush; + + // + // If we are the server proxy we completed + // our initializazion phase according to + // the values provided by the client side. + // + + if (control -> ProxyMode == proxy_server) + { + SetParameters(); + } + + // + // Set up the listeners for the additional + // services. + // + + SetupServiceSockets(); + + // + // Create the proxy class and the statistics + // repository and pass all the configuration + // data we negotiated with the remote peer. + // + + SetupProxyInstance(); + + // + // We completed both parsing of user's parameters + // and handlshaking with remote proxy. Now print + // a brief summary including the most significant + // control values. + // + + PrintConnectionInfo(); + + // + // Cancel the initialization watchdog. + // + + if (IsRunning(lastWatchdog)) + { + KillProcess(lastWatchdog, "watchdog", SIGTERM, 1); + + SetNotRunning(lastWatchdog); + + lastSignal = 0; + } + + // + // Start the house-keeper process. It will + // remove the oldest persistent caches, if + // the amount of storage exceed the limits + // set by the user. + // + + StartKeeper(); + + // + // Set the log size check timestamp. + // + + nowTs = getNewTimestamp(); + + logsTs = nowTs; + + // + // TODO: Due to the way the new NX transport is working, + // the accounting of time spent handling messages must + // be rewritten. In particular, at the moment it only + // shows the time spent encoding and decoding messages + // in the main loop, after executing a select. It doesn't + // take into account the time spent in the NXTrans* calls + // where messages can be encoded and decoded implicitly, + // on demand of the agent. When the agent transport is + // in use, these calls constitute the vast majority of + // the encoding activity. The result is that the number + // of KB encoded per second shown by the proxy statistics + // is actually much lower than the real throughput gene- + // rated by the proxy. + // + + #ifdef TEST + *logofs << "Loop: INIT! Completed initialization at " + << strMsTimestamp(nowTs) << " with " + << diffTimestamp(initTs, nowTs) << " Ms " + << "since the init mark.\n" << logofs_flush; + #endif + + initTs = getNewTimestamp(); + + // + // We can now start handling binary data from + // our peer proxy. + // + + if (agent == NULL) + { + cerr << "Session" << ": Session started at '" + << strTimestamp() << "'.\n"; + } + + return 1; +} + +int SetMode(int mode) +{ + // + // Set the local proxy mode. + // + + if (control -> ProxyMode == proxy_undefined) + { + if (mode == NX_MODE_CLIENT) + { + #ifdef TEST + *logofs << "Loop: INIT! Initializing with mode " + << "NX_MODE_CLIENT at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + control -> ProxyMode = proxy_client; + } + else if (mode == NX_MODE_SERVER) + { + #ifdef TEST + *logofs << "Loop: INIT! Initializing with mode " + << "NX_MODE_SERVER at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + control -> ProxyMode = proxy_server; + } + else + { + cerr << "Error" << ": Please specify either " + << "the -C or -S option.\n"; + + HandleCleanup(); + } + } + + return 1; +} + +int SetupProxyInstance() +{ + if (control -> ProxyMode == proxy_client) + { + proxy = new ClientProxy(proxyFD); + } + else + { + proxy = new ServerProxy(proxyFD); + } + + if (proxy == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating the NX proxy.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error creating the NX proxy.\n"; + + HandleCleanup(); + } + + // + // Create the statistics repository. + // + + statistics = new Statistics(proxy); + + if (statistics == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating the NX statistics.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error creating the NX statistics.\n"; + + HandleCleanup(); + } + + // + // If user gave us a proxy cookie than create the + // X11 authorization repository and find the real + // cookie to be used for our X display. + // + + SetupAuthInstance(); + + // + // Reset the static members in channels. + // + + proxy -> handleChannelConfiguration(); + + // + // Inform the proxies about the ports where they + // will have to forward the network connections. + // + + proxy -> handleDisplayConfiguration(displayHost, xServerAddrFamily, + xServerAddr, xServerAddrLength); + + proxy -> handlePortConfiguration(cupsPort, smbPort, mediaPort, + httpPort, fontPort); + + // + // We handed over the sockaddr structure we + // created when we set up the display socket + // to the proxy. + // + + xServerAddr = NULL; + + // + // Set socket options on proxy link, then propagate link + // configuration to proxy. This includes translating some + // control parameters in 'local' and 'remote'. Finally + // adjust cache parameters according to pack method and + // session type selected by user. + // + + if (proxy -> handleSocketConfiguration() < 0 || + proxy -> handleLinkConfiguration() < 0 || + proxy -> handleCacheConfiguration() < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error configuring the NX transport.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error configuring the NX transport.\n"; + + HandleCleanup(); + } + + // + // Load the message stores from the persistent + // cache. + // + + proxy -> handleLoad(load_if_first); + + // + // Inform the proxy that from now on it can + // start handling the encoded data. + // + + proxy -> setOperational(); + + // + // Are we going to use an internal IPC connection + // with an agent? In this case create the channel + // by using the socket descriptor provided by the + // caller at the proxy initialization. + // + + SetupAgentInstance(); + + // + // Check if we need to verify the existence of + // a matching client cache at shutdown. + // + + #ifdef MATCH + + control -> PersistentCacheCheckOnShutdown = 1; + + #endif + + // + // Flush any data produced so far. + // + + proxy -> handleFlush(); + + #if defined(TEST) || defined(INFO) + + if (proxy -> getFlushable(proxyFD) > 0) + { + *logofs << "Loop: WARNING! Proxy FD#" << proxyFD << " has data " + << "to flush after setup of the NX transport.\n" + << logofs_flush; + } + + #endif + + return 1; +} + +int SetupAuthInstance() +{ + // + // If user gave us a proxy cookie, then create the + // X11 authorization repository and find the real + // cookie to be used for our X display. + // + + if (control -> ProxyMode == proxy_server) + { + if (authCookie != NULL && *authCookie != '\0') + { + if (useLaunchdSocket == 1) + { + // + // If we are going to retrieve the X11 autho- + // rization through the launchd service, make + // a connection to its socket to trigger the + // X server starting. + // + + sockaddr_un launchdAddrUnix; + + unsigned int launchdAddrLength = sizeof(sockaddr_un); + + int launchdAddrFamily = AF_UNIX; + + launchdAddrUnix.sun_family = AF_UNIX; + + const int launchdAddrNameLength = 108; + + int success = -1; + + strncpy(launchdAddrUnix.sun_path, displayHost, launchdAddrNameLength); + + *(launchdAddrUnix.sun_path + launchdAddrNameLength - 1) = '\0'; + + #ifdef TEST + *logofs << "Loop: Connecting to launchd service " + << "on Unix port '" << displayHost << "'.\n" << logofs_flush; + #endif + + int launchdFd = socket(launchdAddrFamily, SOCK_STREAM, PF_UNSPEC); + + if (launchdFd < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + } + else if ((success = connect(launchdFd, (sockaddr *) &launchdAddrUnix, launchdAddrLength)) < 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Connection to launchd service " + << "on Unix port '" << displayHost << "' failed " + << "with error " << EGET() << ", '" << ESTR() << "'.\n" + << logofs_flush; + #endif + } + + if (launchdFd >= 0) + { + close(launchdFd); + } + + // + // The real cookie will not be available + // until the X server starts. Query for the + // cookie in a loop, unless the connection + // to the launchd service failed. + // + + int attempts = (success < 0 ? 1 : 10); + + for (int i = 0; i < attempts; i++) + { + delete auth; + + auth = new Auth(displayHost, authCookie); + + if (auth != NULL && auth -> isFake() == 1) + { + usleep(200000); + + continue; + } + + break; + } + } + else + { + auth = new Auth(displayHost, authCookie); + } + + if (auth == NULL || auth -> isValid() != 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating the X authorization.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error creating the X authorization.\n"; + + HandleCleanup(); + } + else if (auth -> isFake() == 1) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Could not retrieve the X server " + << "authentication cookie.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to read data from the X " + << "auth command.\n"; + + cerr << "Warning" << ": Generated a fake cookie for X " + << "authentication.\n"; + } + } + else + { + #ifdef TEST + *logofs << "Loop: No proxy cookie was provided for " + << "authentication.\n" << logofs_flush; + #endif + + cerr << "Info" << ": No proxy cookie was provided for " + << "authentication.\n"; + + #ifdef TEST + *logofs << "Loop: Forwarding the real X authorization " + << "cookie.\n" << logofs_flush; + #endif + + cerr << "Info" << ": Forwarding the real X authorization " + << "cookie.\n"; + } + } + + return 1; +} + +int SetupAgentInstance() +{ + if (control -> ProxyMode == proxy_client && + useAgentSocket == 1) + { + // + // This will temporarily disable signals to safely + // load the cache, then will send a control packet + // to the remote end, telling that cache has to be + // loaded, so it's important that proxy is already + // set in operational state. + // + + int result; + + if (agent != NULL) + { + result = proxy -> handleNewAgentConnection(agent); + } + else + { + result = proxy -> handleNewConnection(channel_x11, agentFD[1]); + } + + if (result < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating the NX agent connection.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error creating the NX agent connection.\n"; + + HandleCleanup(); + } + } + + return 1; +} + +int SetupTcpSocket() +{ + // + // Open TCP socket emulating local display. + // + + return ListenConnectionTCP((loopbackBind ? "localhost" : "*"), X_TCP_PORT + proxyPort, "X11"); +} + +int SetupUnixSocket() +{ + // + // Open UNIX domain socket for display. + // + + if (!control->TempPath) { + #ifdef PANIC + *logofs << "Loop: PANIC! Temporal path is null.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Temporal path is null.\n"; + HandleCleanup(); + } + + unsigned int required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s/.X11-unix", control->TempPath); + if (required < sizeof(unixSocketName)) { + + // No need to execute the following actions conditionally + mkdir(unixSocketName, (0777 | S_ISVTX)); + chmod(unixSocketName, (0777 | S_ISVTX)); + + required = snprintf(unixSocketName, DEFAULT_STRING_LENGTH, "%s/.X11-unix/X%d", control->TempPath, proxyPort); + if (required < sizeof(unixSocketName)) { + + unixFD = ListenConnectionUnix(unixSocketName, "x11"); + if (unixFD >= 0) + chmod(unixSocketName, 0777); + return unixFD; + } + } + + unixSocketName[0] = '\0'; // Just in case! + + #ifdef PANIC + *logofs << "Loop: PANIC! path for unix socket is too long.\n" << logofs_flush; + #endif + + cerr << "Error" << ": path for Unix socket is too long.\n"; + HandleCleanup(); +} + +// +// The following is a dumb copy-paste. The +// nxcompsh library should offer a better +// implementation. +// + +int SetupDisplaySocket(int &xServerAddrFamily, sockaddr *&xServerAddr, + unsigned int &xServerAddrLength) +{ + xServerAddrFamily = AF_INET; + xServerAddr = NULL; + xServerAddrLength = 0; + + char *display; + + if (*displayHost == '\0') + { + // + // Assume DISPLAY as the X server to which + // we will forward the proxied connections. + // This means that NX parameters have been + // passed through other means. + // + + display = getenv("DISPLAY"); + + if (display == NULL || *display == '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! Host X server DISPLAY is not set.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Host X server DISPLAY is not set.\n"; + + HandleCleanup(); + } + else if (strncasecmp(display, "nx/nx,", 6) == 0 || + strncasecmp(display, "nx,", 3) == 0 || + strncasecmp(display, "nx/nx:", 6) == 0 || + strncasecmp(display, "nx:", 3) == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! NX transport on host X server '" + << display << "' not supported.\n" << logofs_flush; + #endif + + cerr << "Error" << ": NX transport on host X server '" + << display << "' not supported.\n"; + + cerr << "Error" << ": Please run the local proxy specifying " + << "the host X server to connect to.\n"; + + HandleCleanup(); + } + else if (strlen(display) >= DEFAULT_STRING_LENGTH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Host X server DISPLAY cannot exceed " + << DEFAULT_STRING_LENGTH << " characters.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Host X server DISPLAY cannot exceed " + << DEFAULT_STRING_LENGTH << " characters.\n"; + + HandleCleanup(); + } + + strcpy(displayHost, display); + } + + display = new char[strlen(displayHost) + 1]; + + if (display == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Out of memory handling DISPLAY variable.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Out of memory handling DISPLAY variable.\n"; + + HandleCleanup(); + } + + strcpy(display, displayHost); + + #ifdef __APPLE__ + + if ((strncasecmp(display, "/tmp/launch", 11) == 0) || (strncasecmp(display, "/private/tmp/com.apple.launchd", 30) == 0)) + { + #ifdef TEST + *logofs << "Loop: Using launchd service on socket '" + << display << "'.\n" << logofs_flush; + #endif + + useLaunchdSocket = 1; + } + + #endif + + char *separator = strrchr(display, ':'); + + if ((separator == NULL) || !isdigit(*(separator + 1))) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid display '" << display << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid display '" << display << "'.\n"; + + HandleCleanup(); + } + + *separator = '\0'; + + xPort = atoi(separator + 1); + + #ifdef TEST + *logofs << "Loop: Using local X display '" << displayHost + << "' with host '" << display << "' and port '" + << xPort << "'.\n" << logofs_flush; + #endif + + #ifdef __APPLE__ + + if (separator == display || strcmp(display, "unix") == 0 || + useLaunchdSocket == 1) + + #else + + if (separator == display || strcmp(display, "unix") == 0) + + #endif + { + // + // UNIX domain port. + // + + #ifdef TEST + *logofs << "Loop: Using real X server on UNIX domain socket.\n" + << logofs_flush; + #endif + + sockaddr_un *xServerAddrUNIX = new sockaddr_un; + + xServerAddrFamily = AF_UNIX; + xServerAddrUNIX -> sun_family = AF_UNIX; + + // + // The scope of this function is to fill either the sockaddr_un + // (when the display is set to the Unix Domain socket) or the + // sockaddr_in structure (when connecting by TCP) only once, so + // that the structure will be later used at the time the server + // proxy will try to forward the connection to the X server. We + // don't need to verify that the socket does exist at the pre- + // sent moment. The method that forwards the connection will + // perform the required checks and will retry, if needed. Anyway + // we need to select the name of the socket, so we check if the + // well-known directory exists and take that as an indication of + // where the socket will be created. + // + + // Try abstract X11 socket first (via a test connect), if that fails + // fall back to Unix domain socket file. + + #ifdef __linux__ + int testSocketFD; + testSocketFD = socket(xServerAddrFamily, SOCK_STREAM, PF_UNSPEC); + + int len = sprintf(unixSocketName + 1, "/tmp/.X11-unix/X%d", xPort); + unixSocketName[0] = '\0'; + + sockaddr_un *xServerAddrABSTRACT = new sockaddr_un; + memset(xServerAddrABSTRACT, 0, xServerAddrLength); + xServerAddrABSTRACT -> sun_family = AF_UNIX; + memcpy(xServerAddrABSTRACT -> sun_path, unixSocketName, len+1); + xServerAddrLength = len +3; + + int ret = connect(testSocketFD, (struct sockaddr *) xServerAddrABSTRACT, xServerAddrLength); + if (ret == 0) { + + cerr << "Info" << ": Using abstract X11 socket in kernel namespace " + << "for accessing DISPLAY=:" << xPort << ".\n"; + + close(testSocketFD); + xServerAddr = (sockaddr *) xServerAddrABSTRACT; + return 1; + + } else { + + cerr << "Info" << ": Falling back to file system X11 socket " + << "for accessing DISPLAY=:" << xPort << ".\n"; + + #endif + + struct stat statInfo; + + char unixSocketDir[DEFAULT_STRING_LENGTH]; + + snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "%s/.X11-unix", + control -> TempPath); + + #ifdef __APPLE__ + + if (useLaunchdSocket == 1) + { + char *slash = rindex(display, '/'); + + if (slash != NULL) + { + *slash = '\0'; + } + + snprintf(unixSocketDir, DEFAULT_STRING_LENGTH - 1, "%s", display); + } + + #endif + + *(unixSocketDir + DEFAULT_STRING_LENGTH - 1) = '\0'; + + #ifdef TEST + *logofs << "Loop: Assuming X socket in directory '" + << unixSocketDir << "'.\n" << logofs_flush; + #endif + + if (stat(unixSocketDir, &statInfo) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't determine the location of " + << "the X display socket.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't determine the location of " + << "the X display socket.\n"; + + #ifdef PANIC + *logofs << "Loop: PANIC! Error " << EGET() << " '" << ESTR() + << "' checking '" << unixSocketDir << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error " << EGET() << " '" << ESTR() + << "' checking '" << unixSocketDir << "'.\n"; + + HandleCleanup(); + } + + sprintf(unixSocketName, "%s/X%d", unixSocketDir, xPort); + + #ifdef __APPLE__ + + if (useLaunchdSocket == 1) + { + strncpy(unixSocketName, displayHost, DEFAULT_STRING_LENGTH - 1); + } + + #endif + + #ifdef TEST + *logofs << "Loop: Assuming X socket name '" << unixSocketName + << "'.\n" << logofs_flush; + #endif + + strcpy(xServerAddrUNIX -> sun_path, unixSocketName); + + xServerAddr = (sockaddr *) xServerAddrUNIX; + xServerAddrLength = sizeof(sockaddr_un); + + #ifdef __linux__ + + } + #endif + } + else + { + // + // TCP port. + // + + #ifdef TEST + *logofs << "Loop: Using real X server on TCP port.\n" + << logofs_flush; + #endif + + xServerAddrFamily = AF_INET; + + int xServerIPAddr = GetHostAddress(display); + + if (xServerIPAddr == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Unknown display host '" << display + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unknown display host '" << display + << "'.\n"; + + HandleCleanup(); + } + + sockaddr_in *xServerAddrTCP = new sockaddr_in; + + xServerAddrTCP -> sin_family = AF_INET; + xServerAddrTCP -> sin_port = htons(X_TCP_PORT + xPort); + xServerAddrTCP -> sin_addr.s_addr = xServerIPAddr; + + xServerAddr = (sockaddr *) xServerAddrTCP; + xServerAddrLength = sizeof(sockaddr_in); + } + + delete [] display; + + return 1; +} + +int SetupServiceSockets() +{ + if (control -> ProxyMode == proxy_client) + { + if (useCupsSocket) + { + if ((cupsFD = ListenConnection(cupsPort, "CUPS")) < 0) + { + useCupsSocket = 0; + } + } + + if (useAuxSocket) + { + if ((auxFD = ListenConnection(auxPort, "auxiliary X11")) < 0) + { + useAuxSocket = 0; + } + } + + if (useSmbSocket) + { + if ((smbFD = ListenConnection(smbPort, "SMB")) < 0) + { + useSmbSocket = 0; + } + } + + if (useMediaSocket) + { + if ((mediaFD = ListenConnection(mediaPort, "media")) < 0) + { + useMediaSocket = 0; + } + } + + if (useHttpSocket) + { + if ((httpFD = ListenConnection(httpPort, "http")) < 0) + { + useHttpSocket = 0; + } + } + + useFontSocket = 0; + } + else + { + // + // Get ready to listen for the font server connections + // + + if (useFontSocket) + { + // Since ProtoStep7 (#issue 108) + int port = atoi(fontPort); + + if ((fontFD = ListenConnectionTCP("localhost", port, "font")) < 0) + { + useFontSocket = 0; + } + } + + useCupsSocket = 0; + useAuxSocket = 0; + useSmbSocket = 0; + useMediaSocket = 0; + useHttpSocket = 0; + } + + // + // Slave channels can be originated + // by both sides. + // + + if (useSlaveSocket) + { + // Since ProtoStep7 (#issue 108) + if ((slaveFD = ListenConnection(slavePort, "slave")) < 0) + { + useSlaveSocket = 0; + } + } + + return 1; +} + +int ListenConnectionAny(sockaddr *addr, socklen_t addrlen, const char *label) +{ + int newFD = socket(addr->sa_family, SOCK_STREAM, PF_UNSPEC); + + if (newFD == -1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to socket failed for " << label + << " socket. Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to socket failed for " << label + << " socket. Error is " << EGET() << " '" + << ESTR() << "'.\n"; + + goto SetupSocketError; + } + + if (addr->sa_family == AF_INET) + if (SetReuseAddress(newFD) < 0) + { + // SetReuseAddress already warns with an error + goto SetupSocketError; + } + + if (bind(newFD, addr, addrlen) == -1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to bind failed for " << label + << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to bind failed for " << label + << ". Error is " << EGET() + << " '" << ESTR() << "'.\n"; + goto SetupSocketError; + } + + if (listen(newFD, 8) == -1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to listen failed for " << label + << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to listen failed for " << label + << ". Error is " << EGET() + << " '" << ESTR() << "'.\n"; + + goto SetupSocketError; + } + + return newFD; + +SetupSocketError: + + if (newFD != -1) + { + close(newFD); + } + + // + // May optionally return. The session would + // continue without the service. The problem + // with this approach is that it would make + // harder to track problems with allocation + // of ports in clients and server. + // + + HandleCleanup(); + return -1; +} + +int ListenConnectionUnix(const char *path, const char *label) +{ + + sockaddr_un unixAddr; + unixAddr.sun_family = AF_UNIX; +#ifdef UNIX_PATH_MAX + if (strlen(path) >= UNIX_PATH_MAX) +#else + if (strlen(path) >= sizeof(unixAddr.sun_path)) +#endif + { + #ifdef PANIC + *logofs << "Loop: PANIC! Socket path \"" << path << "\" for " + << label << " is too long.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Socket path \"" << path << "\" for " + << label << " is too long.\n"; + + HandleCleanup(); + return -1; + } + + strcpy(unixAddr.sun_path, path); + return ListenConnectionAny((sockaddr *)&unixAddr, sizeof(unixAddr), label); +} + +int ListenConnectionTCP(const char *host, long port, const char *label) +{ + sockaddr_in tcpAddr; + tcpAddr.sin_family = AF_INET; + tcpAddr.sin_port = htons(port); + + if (loopbackBind || + !host || + !strcmp(host, "") || + !strcmp(host, "localhost")) { + tcpAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); + } + else if(strcmp(host, "*") == 0) { + tcpAddr.sin_addr.s_addr = htonl(INADDR_ANY); + } + else { + int ip = tcpAddr.sin_addr.s_addr = GetHostAddress(host); + if (ip == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Unknown " << label << " host '" << host + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unknown " << label << " host '" << host + << "'.\n"; + + HandleCleanup(); + return -1; + } + } + + return ListenConnectionAny((sockaddr *)&tcpAddr, sizeof(tcpAddr), label); +} + +int ListenConnection(ChannelEndPoint &endpoint, const char *label) +{ + char *unixPath, *host; + long port; + if (endpoint.getUnixPath(&unixPath)) { + return ListenConnectionUnix(unixPath, label); + } + else if (endpoint.getTCPHostAndPort(&host, &port)) { + return ListenConnectionTCP(host, port, label); + } + return -1; +} + +static int AcceptConnection(int fd, int domain, const char *label) +{ + struct sockaddr newAddr; + + socklen_t addrLen = sizeof(newAddr); + + #ifdef TEST + + if (domain == AF_UNIX) + { + *logofs << "Loop: Going to accept new Unix " << label + << " connection on FD#" << fd << ".\n" + << logofs_flush; + } + else + { + *logofs << "Loop: Going to accept new TCP " << label + << " connection on FD#" << fd << ".\n" + << logofs_flush; + } + + #endif + + int newFD = accept(fd, &newAddr, &addrLen); + + if (newFD < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to accept failed for " + << label << " connection. Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to accept failed for " + << label << " connection. Error is " << EGET() + << " '" << ESTR() << "'.\n"; + } + + return newFD; +} + +void HandleShutdown() +{ + if (proxy -> getShutdown() == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! No shutdown of proxy link " + << "performed by remote proxy.\n" + << logofs_flush; + #endif + + // + // Close the socket before showing the alert. + // It seems that the closure of the socket can + // sometimes take several seconds, even after + // the connection is broken. The result is that + // the dialog can be shown long after the user + // has gone after the failed session. Note that + // disabling the linger timeout does not seem + // to make any difference. + // + + CleanupSockets(); + + cerr << "Error" << ": Connection with remote peer broken.\n"; + + #ifdef TEST + *logofs << "Loop: Bytes received so far are " + << (unsigned long long) statistics -> getBytesIn() + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Please check the state of your " + << "network and retry.\n"; + + handleTerminatingInLoop(); + + if (control -> ProxyMode == proxy_server) + { + #ifdef TEST + *logofs << "Loop: Showing the proxy abort dialog.\n" + << logofs_flush; + #endif + + HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1); + + handleAlertInLoop(); + } + } + #ifdef TEST + else + { + *logofs << "Loop: Finalized the remote proxy shutdown.\n" + << logofs_flush; + } + #endif + + HandleCleanup(); +} + + +void WaitCleanup() +{ + T_timestamp selectTs; + + while (NXTransRunning(NX_FD_ANY)) + { + setTimestamp(selectTs, control -> PingTimeout); + + NXTransContinue(&selectTs); + } +} + +int KillProcess(int pid, const char *label, int signal, int wait) +{ + if (pid > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Killing the " << label << " process '" + << pid << "' from process with pid '" << getpid() + << "' with signal '" << DumpSignal(signal) + << "'.\n" << logofs_flush; + #endif + + signal = (signal == 0 ? SIGTERM : signal); + + if (kill(pid, signal) < 0 && EGET() != ESRCH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Couldn't kill the " << label + << " process with pid '" << pid << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Couldn't kill the " << label + << " process with pid '" << pid << "'.\n"; + } + + if (wait == 1) + { + WaitChild(pid, label, 1); + } + + return 1; + } + else + { + #ifdef TEST + *logofs << "Loop: No " << label << " process " + << "to kill with pid '" << pid + << "'.\n" << logofs_flush; + #endif + + return 0; + } +} + +int CheckProcess(int pid, const char *label) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Checking the " << label << " process '" + << pid << "' from process with pid '" << getpid() + << "'.\n" << logofs_flush; + #endif + + if (kill(pid, SIGCONT) < 0 && EGET() == ESRCH) + { + #ifdef WARNING + *logofs << "Loop: WARNING! The " << label << " process " + << "with pid '" << pid << "' has exited.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": The " << label << " process " + << "with pid '" << pid << "' has exited.\n"; + + return 0; + } + + return 1; +} + +int StartKeeper() +{ + #if defined(TEST) || defined(INFO) + + if (IsRunning(lastKeeper) == 1 || + IsRestarting(lastKeeper) == 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! The house-keeping process is " + << "alreay running with pid '" << lastKeeper + << "'.\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + #endif + + // + // Don't care harvesting the persistent caches if + // the memory cache is not enabled. If the memory + // cache is not enabled neither we produced per- + // sistent caches. The user can still delete any + // persistent cache produced by the previous runs + // by using the client GUI. + // + // TODO: At the moment the user doesn't have a way + // to specify the amount of disk space to use for + // the persistent caches, but only the amount of + // space to use for images. + // + + if (control -> LocalTotalStorageSize > 0) + { + #ifdef TEST + *logofs << "Loop: Starting the house-keeping process with " + << "storage size " << control -> PersistentCacheDiskLimit + << ".\n" << logofs_flush; + #endif + + lastKeeper = NXTransKeeper(control -> PersistentCacheDiskLimit, + 0, control -> RootPath); + + if (IsFailed(lastKeeper)) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Failed to start the NX keeper process.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to start the NX keeper process.\n"; + + SetNotRunning(lastKeeper); + } + #ifdef TEST + else + { + *logofs << "Loop: Keeper started with pid '" + << lastKeeper << "'.\n" << logofs_flush; + } + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Nothing to do for the keeper process " + << "with persistent cache not enabled.\n" + << logofs_flush; + } + #endif + + return 1; +} + +void HandleCleanupForReconnect() +{ + #ifdef TEST + *logofs << "Loop: Going to clean up system resources for Reconnect " + << "in process '" << getpid() << "'.\n" + << logofs_flush; + #endif + handleTerminatedInLoop(); + DisableSignals(); + if (control) + CleanupChildren(); + CleanupListeners(); + CleanupSockets(); + CleanupKeeper(); + CleanupStreams(); + CleanupLocal(); + CleanupGlobal(); + RestoreSignals(); + ServerCache::lastInitReply.set(0,NULL); + ServerCache::lastKeymap.set(0,NULL); + ServerCache::getKeyboardMappingLastMap.set(0,NULL); +} +void HandleCleanup(int code) +{ + #ifdef TEST + *logofs << "Loop: Going to clean up system resources " + << "in process '" << getpid() << "'.\n" + << logofs_flush; + #endif + + handleTerminatedInLoop(); + + // + // Suspend any signal while cleaning up. + // + + DisableSignals(); + + if (getpid() == lastProxy) + { + // + // Terminate all the children. + // + + CleanupChildren(); + + // + // Close all listeners. + // + + CleanupListeners(); + + // + // Close all sockets. + // + + CleanupSockets(); + + // + // Release the global objects. + // + + CleanupGlobal(); + + // + // Restore the original signal handlers. + // + + RestoreSignals(); + } + + // + // This is our last chance to print a message. If this + // is the process which created the transport we will + // jump back into the loop, letting the caller find out + // that the connection is broken, otherwise we assume + // that this is a child of the proxy and so we will + // safely exit. + // + + #ifdef TEST + + if (getpid() == lastProxy) + { + *logofs << "Loop: Reverting to loop context in process with " + << "pid '" << getpid() << "' at " << strMsTimestamp() + << ".\n" << logofs_flush; + } + else + { + *logofs << "Loop: Exiting from child process with pid '" + << getpid() << "' at " << strMsTimestamp() + << ".\n" << logofs_flush; + } + + #endif + + if (getpid() == lastProxy) + { + // + // Reset all values to their default. + // + + CleanupLocal(); + + CleanupStreams(); + + longjmp(context, 1); + } + else + { + // + // Give a last chance to the process + // to cleanup the ancillary classes. + // + + CleanupKeeper(); + + CleanupStreams(); + + exit(code); + } +} + +void CleanupKeeper() +{ + if (keeper != NULL) + { + #ifdef TEST + *logofs << "Loop: Freeing up keeper in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + delete keeper; + + keeper = NULL; + } +} + +void CleanupStreams() +{ + // + // TODO: The cleanup procedure skips deletion of + // the I/O streams under Windows. This is intended + // to avoid a strange segfault occurring randomly, + // at the time the proxy is being shut down. + // + + #ifndef __CYGWIN32__ + + #ifdef TEST + *logofs << "Loop: Freeing up streams in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + if (logofs != NULL && logofs != &cerr && + *errorsFileName != '\0') + { + *logofs << flush; + + delete logofs; + + // + // Let the log go again to the standard + // error. + // + + logofs = &cerr; + } + + if (statofs != NULL && statofs != &cerr && + *statsFileName != '\0') + { + *statofs << flush; + + delete statofs; + + statofs = NULL; + } + + if (errofs != NULL) + { + *errofs << flush; + + if (errofs == &cerr) + { + errofs = NULL; + } + else if (errsbuf != NULL) + { + cerr.rdbuf(errsbuf); + + errsbuf = NULL; + + delete errofs; + } + + errofs = NULL; + } + + #endif /* #ifndef __CYGWIN32__ */ + + // + // Reset these as they can't be reset + // in CleanupLocal(). + // + + *sessionFileName = '\0'; + *errorsFileName = '\0'; + *optionsFileName = '\0'; + *statsFileName = '\0'; +} + +void CleanupChildren() +{ + // + // Remove any watchdog. + // + + if (IsRunning(lastWatchdog)) + { + KillProcess(lastWatchdog, "watchdog", SIGTERM, 1); + + SetNotRunning(lastWatchdog); + + lastSignal = 0; + } + + // + // Kill the cache house-keeping process. + // + + if (IsRunning(lastKeeper)) + { + KillProcess(lastKeeper, "house-keeping", SIGTERM, 1); + + SetNotRunning(lastKeeper); + } + + // + // Let any running dialog to continue until it is + // closed by the user. In general this is the exp- + // ected behaviour, as for example when we are + // exiting because the link was abrouptedly shut + // down. + // + + if (IsRunning(lastDialog)) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: WARNING! Leaving the dialog process '" + << lastDialog << "' running in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + SetNotRunning(lastDialog); + } + + // + // Give user a chance to start a new session. + // + + if (control -> EnableRestartOnShutdown == 1) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Respawning the NX client " + << "on display '" << displayHost << "'.\n" + << logofs_flush; + #endif + + NXTransClient(displayHost); + } + + for (int i = 0; i < control -> KillDaemonOnShutdownNumber; i++) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Killing the NX daemon with " + << "pid '" << control -> KillDaemonOnShutdown[i] + << "'.\n" << logofs_flush; + #endif + + KillProcess(control -> KillDaemonOnShutdown[i], "daemon", SIGTERM, 0); + } +} + +void CleanupGlobal() +{ + if (proxy != NULL) + { + #ifdef TEST + *logofs << "Loop: Freeing up proxy in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + delete proxy; + + proxy = NULL; + } + + if (agent != NULL) + { + #ifdef TEST + *logofs << "Loop: Freeing up agent in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + delete agent; + + agent = NULL; + } + + if (auth != NULL) + { + #ifdef TEST + *logofs << "Loop: Freeing up auth data in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + delete auth; + + auth = NULL; + } + + if (statistics != NULL) + { + #ifdef TEST + *logofs << "Loop: Freeing up statistics in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + delete statistics; + + statistics = NULL; + } + + if (control != NULL) + { + #ifdef TEST + *logofs << "Loop: Freeing up control in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + delete control; + + control = NULL; + } +} + +void CleanupConnections() +{ + if (proxy -> getChannels(channel_x11) != 0) + { + #ifdef TEST + *logofs << "Loop: Closing any remaining X connections.\n" + << logofs_flush; + #endif + + proxy -> handleCloseAllXConnections(); + + #ifdef TEST + *logofs << "Loop: Closing any remaining listener.\n" + << logofs_flush; + #endif + + proxy -> handleCloseAllListeners(); + } + + proxy -> handleFinish(); +} + +void CleanupListeners() +{ + if (useTcpSocket == 1) + { + if (tcpFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing TCP listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(tcpFD); + + tcpFD = -1; + } + + useTcpSocket = 0; + } + + if (useUnixSocket == 1) + { + if (unixFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing UNIX listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(unixFD); + + unixFD = -1; + } + + if (*unixSocketName != '\0') + { + #ifdef TEST + *logofs << "Loop: Going to remove the Unix domain socket '" + << unixSocketName << "' in process " << "with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + unlink(unixSocketName); + } + + useUnixSocket = 0; + } + + if (useAgentSocket == 1) + { + // + // There is no listener for the + // agent descriptor. + // + + useAgentSocket = 0; + } + + if (useCupsSocket == 1) + { + if (cupsFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing CUPS listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(cupsFD); + + cupsFD = -1; + } + + useCupsSocket = 0; + } + + if (useAuxSocket == 1) + { + if (auxFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing auxiliary X11 listener " + << "in process " << "with pid '" << getpid() + << "'.\n" << logofs_flush; + #endif + + close(auxFD); + + auxFD = -1; + } + + useAuxSocket = 0; + } + + if (useSmbSocket == 1) + { + if (smbFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing SMB listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(smbFD); + + smbFD = -1; + } + + useSmbSocket = 0; + } + + if (useMediaSocket == 1) + { + if (mediaFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing multimedia listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(mediaFD); + + mediaFD = -1; + } + + useMediaSocket = 0; + } + + if (useHttpSocket == 1) + { + if (httpFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing http listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(httpFD); + + httpFD = -1; + } + + useHttpSocket = 0; + } + + if (useFontSocket == 1) + { + if (fontFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing font server listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(fontFD); + + fontFD = -1; + } + + useFontSocket = 0; + } + + if (useSlaveSocket == 1) + { + if (slaveFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing slave listener in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(slaveFD); + + slaveFD = -1; + } + + useSlaveSocket = 0; + } +} + +void CleanupSockets() +{ + if (proxyFD != -1) + { + #ifdef TEST + *logofs << "Loop: Closing proxy FD in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(proxyFD); + + proxyFD = -1; + } + + if (agentFD[1] != -1) + { + #ifdef TEST + *logofs << "Loop: Closing agent FD in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + close(agentFD[1]); + + agentFD[0] = -1; + agentFD[1] = -1; + } +} + +void CleanupLocal() +{ + *homeDir = '\0'; + *rootDir = '\0'; + *tempDir = '\0'; + *systemDir = '\0'; + *sessionDir = '\0'; + + *linkSpeedName = '\0'; + *cacheSizeName = '\0'; + *shsegSizeName = '\0'; + *imagesSizeName = '\0'; + *bitrateLimitName = '\0'; + *packMethodName = '\0'; + *productName = '\0'; + + packMethod = -1; + packQuality = -1; + + *sessionType = '\0'; + *sessionId = '\0'; + + parsedOptions = 0; + parsedCommand = 0; + + *remoteData = '\0'; + remotePosition = 0; + + tcpFD = -1; + unixFD = -1; + cupsFD = -1; + auxFD = -1; + smbFD = -1; + mediaFD = -1; + httpFD = -1; + fontFD = -1; + slaveFD = -1; + proxyFD = -1; + + agentFD[0] = -1; + agentFD[1] = -1; + + useUnixSocket = 1; + useTcpSocket = 1; + useCupsSocket = 0; + useAuxSocket = 0; + useSmbSocket = 0; + useMediaSocket = 0; + useHttpSocket = 0; + useFontSocket = 0; + useSlaveSocket = 0; + useAgentSocket = 0; + + useNoDelay = -1; + usePolicy = -1; + useRender = -1; + useTaint = -1; + + *unixSocketName = '\0'; + + *acceptHost = '\0'; + *displayHost = '\0'; + *authCookie = '\0'; + + proxyPort = DEFAULT_NX_PROXY_PORT; + xPort = DEFAULT_NX_X_PORT; + + xServerAddrFamily = -1; + xServerAddrLength = 0; + + delete xServerAddr; + + xServerAddr = NULL; + + listenSocket.disable(); + connectSocket.disable(); + + cupsPort.disable(); + auxPort.disable(); + smbPort.disable(); + mediaPort.disable(); + httpPort.disable(); + slavePort.disable(); + + *fontPort = '\0'; + + *bindHost = '\0'; + bindPort = -1; + + initTs = nullTimestamp(); + startTs = nullTimestamp(); + logsTs = nullTimestamp(); + nowTs = nullTimestamp(); + + diffTs = 0; + + lastProxy = 0; + lastDialog = 0; + lastWatchdog = 0; + lastKeeper = 0; + lastStatus = 0; + lastKill = 0; + lastDestroy = 0; + + lastReadableTs = nullTimestamp(); + + lastAlert.code = 0; + lastAlert.local = 0; + + lastMasks.blocked = 0; + lastMasks.installed = 0; + + memset(&lastMasks.saved, 0, sizeof(sigset_t)); + + for (int i = 0; i < 32; i++) + { + lastMasks.enabled[i] = 0; + lastMasks.forward[i] = 0; + + memset(&lastMasks.action[i], 0, sizeof(struct sigaction)); + } + + lastSignal = 0; + + memset(&lastTimer.action, 0, sizeof(struct sigaction)); + memset(&lastTimer.value, 0, sizeof(struct itimerval)); + + lastTimer.start = nullTimestamp(); + lastTimer.next = nullTimestamp(); +} + +int CheckAbort() +{ + if (lastSignal != 0) + { + #ifdef TEST + *logofs << "Loop: Aborting the procedure due to signal '" + << lastSignal << "', '" << DumpSignal(lastSignal) + << "'.\n" << logofs_flush; + #endif + + cerr << "Info" << ": Aborting the procedure due to signal '" + << lastSignal << "'.\n"; + + lastSignal = 0; + + return 1; + } + + return 0; +} + +void HandleAbort() +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + *logofs << flush; + + handleTerminatingInLoop(); + + if (lastSignal == SIGHUP) + { + lastSignal = 0; + } + + // + // The current default is to just quit the program. + // Code has not been updated to deal with the new + // NX transport loop. + // + + if (control -> EnableCoreDumpOnAbort == 1) + { + if (agent != NULL) + { + cerr << "Session" << ": Terminating session at '" + << strTimestamp() << "'.\n"; + } + + cerr << "Error" << ": Generating a core file to help " + << "the investigations.\n"; + + cerr << "Session" << ": Session terminated at '" + << strTimestamp() << "'.\n"; + + cerr << flush; + + signal(SIGABRT, SIG_DFL); + + raise(SIGABRT); + } + + #ifdef TEST + *logofs << "Loop: Showing the proxy abort dialog.\n" + << logofs_flush; + #endif + + if (control -> ProxyMode == proxy_server) + { + // + // Close the socket before showing the alert. + // It seems that the closure of the socket can + // sometimes take several seconds, even after + // the connection is broken. + // + + CleanupSockets(); + + if (lastKill == 0) + { + HandleAlert(ABORT_PROXY_CONNECTION_ALERT, 1); + } + else + { + HandleAlert(ABORT_PROXY_SHUTDOWN_ALERT, 1); + } + + handleAlertInLoop(); + } + + HandleCleanup(); +} + +void HandleAlert(int code, int local) +{ + if (lastAlert.code == 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Requesting an alert dialog with code " + << code << " and local " << local << ".\n" + << logofs_flush; + #endif + + lastAlert.code = code; + lastAlert.local = local; + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "Loop: WARNING! Alert dialog already requested " + << "with code " << lastAlert.code << ".\n" + << logofs_flush; + } + #endif + + return; +} + +void FlushCallback(int length) +{ + if (flushCallback != NULL) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Reporting a flush request at " + << strMsTimestamp() << " with " << length + << " bytes written.\n" << logofs_flush; + #endif + + (*flushCallback)(flushParameter, length); + } + #if defined(TEST) || defined(INFO) + else if (control -> ProxyMode == proxy_client) + { + *logofs << "Loop: WARNING! Can't find a flush " + << "callback in process with pid '" << getpid() + << "'.\n" << logofs_flush; + } + #endif +} + +void KeeperCallback() +{ + if (IsRunning(lastKeeper) == 0) + { + // + // Let the house-keeping process take care + // of the persistent image cache. + // + + if (control -> ImageCacheEnableLoad == 1 || + control -> ImageCacheEnableSave == 1) + { + #ifdef TEST + *logofs << "Loop: Starting the house-keeping process with " + << "image storage size " << control -> ImageCacheDiskLimit + << ".\n" << logofs_flush; + #endif + + lastKeeper = NXTransKeeper(0, control -> ImageCacheDiskLimit, + control -> RootPath); + + if (IsFailed(lastKeeper)) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Can't start the NX keeper process.\n" + << logofs_flush; + #endif + + SetNotRunning(lastKeeper); + } + #ifdef TEST + else + { + *logofs << "Loop: Keeper started with pid '" + << lastKeeper << "'.\n" << logofs_flush; + } + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Nothing to do for the keeper process " + << "with image cache not enabled.\n" + << logofs_flush; + } + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Nothing to do with the keeper process " + << "already running.\n" << logofs_flush; + } + #endif +} + +void InstallSignals() +{ + #ifdef TEST + *logofs << "Loop: Installing signals in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + for (int i = 0; i < 32; i++) + { + if (CheckSignal(i) == 1 && + lastMasks.enabled[i] == 0) + { + InstallSignal(i, NX_SIGNAL_ENABLE); + } + } + + lastMasks.installed = 1; +} + +void RestoreSignals() +{ + #ifdef TEST + *logofs << "Loop: Restoring signals in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + if (lastMasks.installed == 1) + { + // + // Need to keep monitoring the children. + // + + for (int i = 0; i < 32; i++) + { + if (lastMasks.enabled[i] == 1) + { + RestoreSignal(i); + } + } + } + + lastMasks.installed = 0; + + if (lastMasks.blocked == 1) + { + EnableSignals(); + } +} + +void DisableSignals() +{ + if (lastMasks.blocked == 0) + { + sigset_t newMask; + + sigemptyset(&newMask); + + // + // Block also the other signals that may be + // installed by the agent, that are those + // signals for which the function returns 2. + // + + for (int i = 0; i < 32; i++) + { + if (CheckSignal(i) > 0) + { + #ifdef DUMP + *logofs << "Loop: Disabling signal " << i << " '" + << DumpSignal(i) << "' in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + sigaddset(&newMask, i); + } + } + + sigprocmask(SIG_BLOCK, &newMask, &lastMasks.saved); + + lastMasks.blocked++; + } + #ifdef TEST + else + { + *logofs << "Loop: WARNING! Signals were already blocked in " + << "process with pid '" << getpid() << "'.\n" + << logofs_flush; + } + #endif +} + +void EnableSignals() +{ + if (lastMasks.blocked == 1) + { + #ifdef TEST + *logofs << "Loop: Enabling signals in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + sigprocmask(SIG_SETMASK, &lastMasks.saved, NULL); + + lastMasks.blocked = 0; + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Signals were not blocked in " + << "process with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Signals were not blocked in " + << "process with pid '" << getpid() << "'.\n"; + } +} + +void InstallSignal(int signal, int action) +{ + if (lastMasks.enabled[signal] == 1) + { + if (action == NX_SIGNAL_FORWARD) + { + #ifdef TEST + *logofs << "Loop: Forwarding handler for signal " << signal + << " '" << DumpSignal(signal) << "' in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + lastMasks.forward[signal] = 1; + + return; + } + #ifdef TEST + else + { + *logofs << "Loop: Reinstalling handler for signal " << signal + << " '" << DumpSignal(signal) << "' in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + } + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Installing handler for signal " << signal + << " '" << DumpSignal(signal) << "' in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + } + #endif + + if (signal == SIGALRM && isTimestamp(lastTimer.start)) + { + ResetTimer(); + } + + struct sigaction newAction; + + memset(&newAction, 0, sizeof(newAction)); + + newAction.sa_handler = HandleSignal; + + sigemptyset(&(newAction.sa_mask)); + + if (signal == SIGCHLD) + { + newAction.sa_flags = SA_NOCLDSTOP; + } + else + { + newAction.sa_flags = 0; + } + + sigaction(signal, &newAction, &lastMasks.action[signal]); + + lastMasks.enabled[signal] = 1; + + if (action == NX_SIGNAL_FORWARD) + { + lastMasks.forward[signal] = 1; + } +} + +void RestoreSignal(int signal) +{ + if (lastMasks.enabled[signal] == 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Signal '" << DumpSignal(signal) + << " not installed in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Signal '" << DumpSignal(signal) + << " not installed in process with pid '" + << getpid() << "'.\n"; + + return; + } + + #ifdef TEST + *logofs << "Loop: Restoring handler for signal " << signal + << " '" << DumpSignal(signal) << "' in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + if (signal == SIGALRM && isTimestamp(lastTimer.start)) + { + ResetTimer(); + } + + sigaction(signal, &lastMasks.action[signal], NULL); + + lastMasks.enabled[signal] = 0; + lastMasks.forward[signal] = 0; +} + +void HandleSignal(int signal) +{ + if (logofs == NULL) + { + logofs = &cerr; + } + + #if defined(UNSAFE) && (defined(TEST) || defined(INFO)) + + if (lastSignal != 0) + { + *logofs << "Loop: WARNING! Last signal is '" << lastSignal + << "', '" << DumpSignal(signal) << "' and not zero " + << "in process with pid '" << getpid() << "'.\n" + << logofs_flush; + } + + *logofs << "Loop: Signal '" << signal << "', '" + << DumpSignal(signal) << "' received in process " + << "with pid '" << getpid() << "'.\n" << logofs_flush; + + #endif + + if (getpid() != lastProxy && handler != NULL) + { + #if defined(UNSAFE) && (defined(TEST) || defined(INFO)) + *logofs << "Loop: Calling slave handler in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + if ((*handler)(signal) == 0) + { + return; + } + } + + switch (signal) + { + case SIGUSR1: + { + if (proxy != NULL && lastSignal == 0) + { + lastSignal = SIGUSR1; + } + + break; + } + case SIGUSR2: + { + if (proxy != NULL && lastSignal == 0) + { + lastSignal = SIGUSR2; + } + + break; + } + case SIGPIPE: + { + // + // It can happen that SIGPIPE is delivered + // to the proxy even in the case some other + // descriptor is unexpectedly closed. + // + // if (agentFD[1] != -1) + // { + // cerr << "Info" << ": Received signal 'SIGPIPE'. " + // << "Closing agent conection.\n"; + // + // shutdown(agentFD[1], SHUT_RDWR); + // } + // + + break; + } + case SIGALRM: + { + // + // Nothing to do. Just wake up the + // process on blocking operations. + // + + break; + } + case SIGCHLD: + { + // + // Check if any of our children has exited. + // + + if (HandleChildren() != 0) + { + signal = 0; + } + + // + // Don't save this signal or it will override + // any previous signal sent by child before + // exiting. + // + + break; + } + + #ifdef __CYGWIN32__ + + case 12: + { + // + // Nothing to do. This signal is what is delivered + // by the Cygwin library when trying use a shared + // memory function if the daemon is not running. + // + + #ifdef TEST + *logofs << "Loop: WARNING! Received signal '12' in " + << "process with pid '" << getpid() << "'.\n" + << logofs_flush; + + *logofs << "Loop: WARNING! Please check that the " + << "cygserver daemon is running.\n" + << logofs_flush; + #endif + + break; + } + + #endif + + default: + { + // + // Register the signal so we can handle it + // inside the main loop. We will probably + // dispose any resource and exit. + // + + if (getpid() == lastProxy) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Registering end of session request " + << "due to signal '" << signal << "', '" + << DumpSignal(signal) << "'.\n" + << logofs_flush; + #endif + + lastSignal = signal; + } + else + { + // + // This is a child, so exit immediately. + // + + HandleCleanup(); + } + } + } + + if (signal != 0 && lastMasks.forward[signal] == 1) + { + if (lastMasks.action[signal].sa_handler != NULL && + lastMasks.action[signal].sa_handler != HandleSignal) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Forwarding signal '" << signal << "', '" + << DumpSignal(signal) << "' to previous handler.\n" + << logofs_flush; + #endif + + lastMasks.action[signal].sa_handler(signal); + } + #ifdef WARNING + else if (lastMasks.action[signal].sa_handler == NULL) + { + *logofs << "Loop: WARNING! Parent requested to forward " + << "signal '" << signal << "', '" << DumpSignal(signal) + << "' but didn't set a handler.\n" << logofs_flush; + } + #endif + } +} + +int HandleChildren() +{ + // + // Try to waitpid() for each child because the + // call might have return ECHILD and so we may + // have lost any of the processes. + // + + if (IsRunning(lastDialog) && HandleChild(lastDialog) == 1) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Resetting pid of last dialog process " + << "in handler.\n" << logofs_flush; + #endif + + SetNotRunning(lastDialog); + + if (proxy != NULL) + { + proxy -> handleResetAlert(); + } + + return 1; + } + + if (IsRunning(lastWatchdog) && HandleChild(lastWatchdog) == 1) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Watchdog is gone. Setting the last " + << "signal to SIGHUP.\n" << logofs_flush; + #endif + + lastSignal = SIGHUP; + + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Resetting pid of last watchdog process " + << "in handler.\n" << logofs_flush; + #endif + + SetNotRunning(lastWatchdog); + + return 1; + } + + // + // The house-keeping process exits after a + // number of iterations to keep the memory + // pollution low. It is restarted on demand + // by the lower layers, using the callback + // function. + // + + if (IsRunning(lastKeeper) && HandleChild(lastKeeper) == 1) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Resetting pid of last house-keeping " + << "process in handler.\n" << logofs_flush; + #endif + + SetNotRunning(lastKeeper); + + return 1; + } + + // + // The pid will be checked by the code + // that registered the child. + // + + if (IsRunning(lastChild)) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Resetting pid of last child process " + << "in handler.\n" << logofs_flush; + #endif + + SetNotRunning(lastChild); + + return 1; + } + + proxy->checkSlaves(); + + // + // This can actually happen either because we + // reset the pid of the child process as soon + // as we kill it, or because of a child process + // of our parent. + // + + #if defined(UNSAFE) && (defined(TEST) || defined(INFO)) + *logofs << "Loop: Ignoring signal received for the " + << "unregistered child.\n" << logofs_flush; + #endif + + return 0; +} + +int HandleChild(int child) +{ + int pid; + + int status = 0; + int options = WNOHANG | WUNTRACED; + + while ((pid = waitpid(child, &status, options)) && + pid == -1 && EGET() == EINTR); + + return CheckChild(pid, status); +} + +int WaitChild(int child, const char* label, int force) +{ + int pid; + + int status = 0; + int options = WUNTRACED; + + for (;;) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Waiting for the " << label + << " process '" << child << "' to die.\n" + << logofs_flush; + #endif + + pid = waitpid(child, &status, options); + + if (pid == -1 && EGET() == EINTR) + { + if (force == 0) + { + return 0; + } + + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring signal while " + << "waiting for the " << label << " process '" + << child << "' to die.\n" + << logofs_flush; + #endif + + continue; + } + + break; + } + + return (EGET() == ECHILD ? 1 : CheckChild(pid, status)); +} + +int CheckChild(int pid, int status) +{ + lastStatus = 0; + + if (pid > 0) + { + if (WIFSTOPPED(status)) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Child process '" << pid << "' was stopped " + << "with signal " << (WSTOPSIG(status)) << ".\n" + << logofs_flush; + #endif + + return 0; + } + else + { + if (WIFEXITED(status)) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Child process '" << pid << "' exited " + << "with status '" << (WEXITSTATUS(status)) + << "'.\n" << logofs_flush; + #endif + + lastStatus = WEXITSTATUS(status); + } + else if (WIFSIGNALED(status)) + { + if (CheckSignal(WTERMSIG(status)) != 1) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Child process '" << pid + << "' died because of signal " << (WTERMSIG(status)) + << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Child process '" << pid + << "' died because of signal " << (WTERMSIG(status)) + << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n"; + } + #if defined(UNSAFE) && defined(TEST) + else + { + *logofs << "Loop: Child process '" << pid + << "' died because of signal " << (WTERMSIG(status)) + << ", '" << DumpSignal(WTERMSIG(status)) << "'.\n" + << logofs_flush; + } + #endif + + lastStatus = 1; + } + + return 1; + } + } + else if (pid < 0) + { + if (EGET() != ECHILD) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to waitpid failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to waitpid failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + HandleCleanup(); + } + + // + // This can happen when the waitpid() is + // blocking, as the SIGCHLD is received + // within the call. + // + + #ifdef TEST + *logofs << "Loop: No more children processes running.\n" + << logofs_flush; + #endif + + return 1; + } + + return 0; +} + +void RegisterChild(int child) +{ + #if defined(TEST) || defined(INFO) + + if (IsNotRunning(lastChild)) + { + *logofs << "Loop: Registering child process '" << child + << "' in process with pid '" << getpid() + << "'.\n" << logofs_flush; + } + else + { + *logofs << "Loop: WARNING! Overriding registered child '" + << lastChild << "' with new child '" << child + << "' in process with pid '" << getpid() + << "'.\n" << logofs_flush; + } + + #endif + + lastChild = child; +} + +int CheckParent(const char *name, const char *type, int parent) +{ + if (parent != getppid() || parent == 1) + { + #ifdef WARNING + *logofs << name << ": WARNING! Parent process appears " + << "to be dead. Exiting " << type << ".\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Parent process appears " + << "to be dead. Exiting " << type << ".\n"; + + return 0; + } + + return 1; +} + +void HandleTimer(int signal) +{ + if (signal == SIGALRM) + { + if (isTimestamp(lastTimer.start)) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Timer expired at " << strMsTimestamp() + << " in process with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + if (proxy != NULL) + { + proxy -> handleTimer(); + } + + ResetTimer(); + } + else + { + #ifdef PANIC + *logofs << "Loop: PANIC! Inconsistent timer state " + << " in process with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Inconsistent timer state " + << " in process with pid '" << getpid() << "'.\n"; + } + } + else + { + #ifdef PANIC + *logofs << "Loop: PANIC! Inconsistent signal '" + << signal << "', '" << DumpSignal(signal) + << "' received in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Inconsistent signal '" + << signal << "', '" << DumpSignal(signal) + << "' received in process with pid '" + << getpid() << "'.\n"; + } +} + +void SetTimer(int value) +{ + getNewTimestamp(); + + if (isTimestamp(lastTimer.start)) + { + int diffTs = diffTimestamp(lastTimer.start, getTimestamp()); + + if (diffTs > lastTimer.next.tv_usec / 1000 * 2) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Timer missed to expire at " + << strMsTimestamp() << " in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Timer missed to expire at " + << strMsTimestamp() << " in process with pid '" + << getpid() << "'.\n"; + + HandleTimer(SIGALRM); + } + else + { + #ifdef TEST + *logofs << "Loop: Timer already running at " + << strMsTimestamp() << " in process with pid '" + << getpid() << "'.\n" << logofs_flush; + #endif + + return; + } + } + + // + // Save the former handler. + // + + struct sigaction action; + + memset(&action, 0, sizeof(action)); + + action.sa_handler = HandleTimer; + + sigemptyset(&action.sa_mask); + + action.sa_flags = 0; + + sigaction(SIGALRM, &action, &lastTimer.action); + + // + // Start the timer. + // + + lastTimer.next = getTimestamp(value); + + struct itimerval timer; + + timer.it_interval = lastTimer.next; + timer.it_value = lastTimer.next; + + #ifdef TEST + *logofs << "Loop: Timer set to " << lastTimer.next.tv_sec + << " S and " << lastTimer.next.tv_usec / 1000 + << " Ms at " << strMsTimestamp() << " in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + if (setitimer(ITIMER_REAL, &timer, &lastTimer.value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to setitimer failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to setitimer failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + lastTimer.next = nullTimestamp(); + + return; + } + + lastTimer.start = getTimestamp(); +} + +void ResetTimer() +{ + if (isTimestamp(lastTimer.start) == 0) + { + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Timer not running in process " + << "with pid '" << getpid() << "'.\n" + << logofs_flush; + #endif + + return; + } + + #if defined(UNSAFE) && defined(TEST) + *logofs << "Loop: Timer reset at " << strMsTimestamp() + << " in process with pid '" << getpid() + << "'.\n" << logofs_flush; + #endif + + // + // Restore the old signal mask and timer. + // + + if (setitimer(ITIMER_REAL, &lastTimer.value, NULL) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to setitimer failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to setitimer failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + + if (sigaction(SIGALRM, &lastTimer.action, NULL) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to sigaction failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to sigaction failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + } + + lastTimer.start = lastTimer.next = nullTimestamp(); +} + +// +// Open TCP or UNIX file socket to listen for remote proxy +// and block until remote connects. If successful close +// the listening socket and return FD on which the other +// party is connected. +// + +int WaitForRemote(ChannelEndPoint &socketAddress) +{ + char hostLabel[DEFAULT_STRING_LENGTH] = { 0 }; + char *socketUri = NULL; + + int retryAccept = -1; + + int proxyFD = -1; + int newFD = -1; + + int acceptIPAddr = 0; + + if (socketAddress.isTCPSocket()) + { + + // + // Get IP address of host to be awaited. + // + + if (*acceptHost != '\0') + { + acceptIPAddr = GetHostAddress(acceptHost); + + if (acceptIPAddr == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Cannot accept connections from unknown host '" + << acceptHost << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot accept connections from unknown host '" + << acceptHost << "'.\n"; + + goto WaitForRemoteError; + } + snprintf(hostLabel, sizeof(hostLabel), "'%s'", acceptHost); + } + else + { + strcpy(hostLabel, "any host"); + } + + long bindPort; + if (socketAddress.getTCPHostAndPort(NULL, &bindPort)) + { + socketAddress.setSpec(loopbackBind ? "localhost" : "*", bindPort); + } + else + { + // This should never happen + cerr << "Error" << ": Unable to change bind host\n"; + } + } + else if (socketAddress.isUnixSocket()) + strcpy(hostLabel, "this host"); + else + strcpy(hostLabel, "unknown origin (something went wrong!!!)"); + + + proxyFD = ListenConnection(socketAddress, "NX"); + + socketAddress.getSpec(&socketUri); + #ifdef TEST + *logofs << "Loop: Waiting for connection from " + << hostLabel << " on socket '" << socketUri + << "'.\n" << logofs_flush; + #endif + cerr << "Info" << ": Waiting for connection from " + << hostLabel << " on socket '" << socketUri + << "'.\n"; + free(socketUri); + + // + // How many times to loop waiting for connections + // from the selected host? Each loop wait for at + // most 20 seconds so a default value of 3 gives + // a timeout of 1 minute. + // + // TODO: Handling of timeouts and retry attempts + // must be rewritten. + // + + retryAccept = control -> OptionProxyRetryAccept; + + for (;;) + { + fd_set readSet; + + FD_ZERO(&readSet); + FD_SET(proxyFD, &readSet); + + T_timestamp selectTs; + + selectTs.tv_sec = 20; + selectTs.tv_usec = 0; + + int result = select(proxyFD + 1, &readSet, NULL, NULL, &selectTs); + + getNewTimestamp(); + + if (result == -1) + { + if (EGET() == EINTR) + { + if (CheckAbort() != 0) + { + goto WaitForRemoteError; + } + + continue; + } + + #ifdef PANIC + *logofs << "Loop: PANIC! Call to select failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Call to select failed. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + goto WaitForRemoteError; + } + else if (result > 0 && FD_ISSET(proxyFD, &readSet)) + { + + sockaddr_in newAddrINET; + + if (socketAddress.isUnixSocket()) + { + socklen_t addrLen = sizeof(sockaddr_un); + newFD = accept(proxyFD, NULL, &addrLen); + } + else if (socketAddress.isTCPSocket()) + { + socklen_t addrLen = sizeof(sockaddr_in); + newFD = accept(proxyFD, (sockaddr *) &newAddrINET, &addrLen); + } + if (newFD == -1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to accept failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Call to accept failed. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + goto WaitForRemoteError; + } + + if (socketAddress.isUnixSocket()) + { + + char * unixPath = NULL; + socketAddress.getUnixPath(&unixPath); + #ifdef TEST + *logofs << "Loop: Accepted connection from this host on Unix file socket '" + << unixPath << "'.\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Accepted connection from this host on Unix file socket '" + << unixPath << "'.\n"; + free(unixPath); + + break; + } + else if (socketAddress.isTCPSocket()) + { + + char *connectedHost = inet_ntoa(newAddrINET.sin_addr); + + if (*acceptHost == '\0' || (int) newAddrINET.sin_addr.s_addr == acceptIPAddr) + { + + #ifdef TEST + + unsigned int connectedPort = ntohs(newAddrINET.sin_port); + + *logofs << "Loop: Accepted connection from '" << connectedHost + << "' with port '" << connectedPort << "'.\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Accepted connection from '" + << connectedHost << "'.\n"; + + break; + } + else + { + #ifdef PANIC + *logofs << "Loop: WARNING! Refusing connection from '" << connectedHost + << "' on port '" << socketAddress.getTCPPort() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Refusing connection from '" + << connectedHost << "'.\n"; + } + + // + // Not the best way to elude a DOS attack... + // + + sleep(5); + + close(newFD); + + } + + } + + if (--retryAccept == 0) + { + if (socketAddress.isUnixSocket()) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Connection via Unix file socket from this host " + << "could not be established.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Connection via Unix file socket from this host " + << "could not be established.\n"; + } + else if (*acceptHost == '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! Connection with remote host " + << "could not be established.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Connection with remote host " + << "could not be established.\n"; + } + else + { + #ifdef PANIC + *logofs << "Loop: PANIC! Connection with remote host '" + << acceptHost << "' could not be established.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Connection with remote host '" + << acceptHost << "' could not be established.\n"; + } + + goto WaitForRemoteError; + } + else + { + handleCheckSessionInConnect(); + } + } + + close(proxyFD); + + return newFD; + +WaitForRemoteError: + + close(proxyFD); + + HandleCleanup(); +} + +int PrepareProxyConnectionTCP(char** hostName, long int* portNum, int* timeout, int* proxyFD, int* reason) +{ + + if (!proxyFD) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). " + << "'proxyFD' must not be a NULL pointer.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). " + << "'proxyFD' must not be a NULL pointer.\n"; + + return -1; + } + + if (!reason) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionTCP). " + << "'reason' must not be a NULL pointer.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Implementation error (PrepareProxyConnectionTCP). " + << "'reason' must not be a NULL pointer.\n"; + + return -1; + } + + int remoteIPAddr = GetHostAddress(*hostName); + if (remoteIPAddr == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Unknown remote host '" + << *hostName << "'.\n" << logofs_flush; + #endif + cerr << "Error" << ": Unknown remote host '" + << *hostName << "'.\n"; + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "Loop: Connecting to remote host '" + << *hostName << ":" << *portNum << "'.\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Connecting to remote host '" + << *hostName << ":" << *portNum << "'.\n" + << logofs_flush; + + *proxyFD = -1; + *reason = -1; + + sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(*portNum); + addr.sin_addr.s_addr = remoteIPAddr; + + *proxyFD = socket(AF_INET, SOCK_STREAM, PF_UNSPEC); + *reason = EGET(); + + if (*proxyFD == -1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to socket failed. " + << "Error is " << *reason << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to socket failed. " + << "Error is " << *reason << " '" << ESTR() + << "'.\n"; + return -1; + + } + else if (SetReuseAddress(*proxyFD) < 0) + { + return -1; + } + + // + // Ensure operation is timed out + // if there is a network problem. + // + + if (timeout) + SetTimer(*timeout); + else + SetTimer(20000); + + int result = connect(*proxyFD, (sockaddr *) &addr, sizeof(sockaddr_in)); + + *reason = EGET(); + + ResetTimer(); + + return result; + +} + +int PrepareProxyConnectionUnix(char** path, int* timeout, int* proxyFD, int* reason) +{ + + if (!proxyFD) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). " + << "proxyFD must not be a NULL pointer.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). " + << "proxyFD must not be a NULL pointer.\n"; + + return -1; + } + + if (!reason) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Implementation error (PrepareProxyConnectionUnix). " + << "'reason' must not be a NULL pointer.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Implementation error (PrepareProxyConnectionUnix). " + << "'reason' must not be a NULL pointer.\n"; + + return -1; + } + + /* FIXME: Add socket file existence and permission checks */ + + *proxyFD = -1; + *reason = -1; + + sockaddr_un addr; + addr.sun_family = AF_UNIX; + strncpy(addr.sun_path, *path, 108 - 1); + + *proxyFD = socket(AF_UNIX, SOCK_STREAM, PF_UNSPEC); + *reason = EGET(); + + if (*proxyFD == -1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Call to socket failed. " + << "Error is " << *reason << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to socket failed. " + << "Error is " << *reason << " '" << ESTR() + << "'.\n"; + + return -1; + } + + // + // Ensure operation is timed out + // if there is a network problem. + // + + if (timeout) + SetTimer(*timeout); + else + SetTimer(20000); + + int result = connect(*proxyFD, (sockaddr *) &addr, sizeof(sockaddr_un)); + + *reason = EGET(); + + ResetTimer(); + + return result; +} + +// +// Connect to remote proxy. If successful +// return FD of connection, else return -1. +// + +int ConnectToRemote(ChannelEndPoint &socketAddress) +{ + + // + // How many times we retry to connect to remote + // host / Unix domain socket in case of failure? + // + + int retryConnect = control -> OptionProxyRetryConnect; + + // + // Show an alert after 20 seconds and use the + // same timeout to interrupt the connect. The + // retry timeout is incremental, starting from + // 100 miliseconds up to 1 second. + // + + int alertTimeout = 20000; + int connectTimeout = 20000; + int retryTimeout = 100; + + T_timestamp lastRetry = getNewTimestamp(); + + int result = -1; + int reason = -1; + int proxyFD = -1; + + char *hostName = NULL; + long int portNum = -1; + char *unixPath = NULL; + + for (;;) + { + + #ifdef DEBUG + *logofs << "Loop: Timer set to " << connectTimeout / 1000 + << " S " << "with retry set to " << retryConnect + << " in process with pid '" << getpid() + << "'.\n" << logofs_flush; + #endif + + if (socketAddress.getUnixPath(&unixPath)) + result = PrepareProxyConnectionUnix(&unixPath, &connectTimeout, &proxyFD, &reason); + else if (socketAddress.getTCPHostAndPort(&hostName, &portNum)) + result = PrepareProxyConnectionTCP(&hostName, &portNum, &connectTimeout, &proxyFD, &reason); + + if (result < 0) + { + close(proxyFD); + + if (CheckAbort() != 0) + { + goto ConnectToRemoteError; + } + else if (--retryConnect == 0) + { + ESET(reason); + + if (socketAddress.isUnixSocket()) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Connection to Unix file socket '" + << unixPath << "' failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Connection to Unix file socket '" + << unixPath << "' failed. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + } + else + { + + #ifdef PANIC + *logofs << "Loop: PANIC! Connection to '" << hostName + << ":" << portNum << "' failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Connection to '" << hostName + << ":" << portNum << "' failed. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + } + goto ConnectToRemoteError; + } + else + { + #ifdef TEST + *logofs << "Loop: Sleeping " << retryTimeout + << " ms before retrying.\n" + << logofs_flush; + #endif + + usleep(retryTimeout * 1000); + + retryTimeout <<= 1; + + if (retryTimeout > 1000 * 1000) + { + retryTimeout = 1000 * 1000; + } + } + + // + // Check if it is time to show an alert dialog. + // + + if (diffTimestamp(lastRetry, getNewTimestamp()) >= + (alertTimeout - control -> LatencyTimeout)) + { + if (IsNotRunning(lastDialog)) + { + handleCheckSessionInConnect(); + + // + // Wait for the dialog process to die + // unless a signal is received. + // + + while (IsRunning(lastDialog)) + { + WaitChild(lastDialog, "dialog", 0); + + if (CheckAbort() != 0) + { + // + // The client ignores the TERM signal + // on Windows. + // + + #ifdef __CYGWIN32__ + + KillProcess(lastDialog, "dialog", SIGKILL, 1); + + #else + + KillProcess(lastDialog, "dialog", SIGTERM, 1); + + #endif + + goto ConnectToRemoteError; + } + } + + lastRetry = getTimestamp(); + } + } + #ifdef TEST + { + *logofs << "Loop: Not showing the dialog with " + << (diffTimestamp(lastRetry, getTimestamp()) / 1000) + << " seconds elapsed.\n" << logofs_flush; + } + #endif + + ESET(reason); + + #ifdef TEST + if (unixPath && unixPath[0] != '\0' ) + { + *logofs << "Loop: Connection to Unix socket file '" + << unixPath << "' failed with error '" + << ESTR() << "'. Retrying.\n" + << logofs_flush; + } + else + { + *logofs << "Loop: Connection to '" << hostName + << ":" << portNum << "' failed with error '" + << ESTR() << "'. Retrying.\n" + << logofs_flush; + } + #endif + } + else + { + // + // Connection was successful. + // + + break; + } + } + + return proxyFD; + +ConnectToRemoteError: + + if (proxyFD != -1) + { + close(proxyFD); + } + + HandleCleanup(); +} + +// +// Make a string of options for the remote +// proxy and write it to the descriptor. +// The string includes the local version. +// + +int SendProxyOptions(int fd) +{ + char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; + + // + // Send the "compatibility" version first, then our + // actual version. Old proxies will take the first + // value and ignore the second. + // + + sprintf(options, "NXPROXY-%s-%i.%i.%i", + control -> NXPROXY_COMPATIBILITY_VERSION, + control -> LocalVersionMajor, + control -> LocalVersionMinor, + control -> LocalVersionPatch); + + // + // If you want to send options from proxy + // initiating the connection use something + // like this: + // + // if (WE_PROVIDE_CREDENTIALS) + // { + // sprintf(options + strlen(options), "%s=%s", option, value); + // } + // + // If you want to send options according to + // local proxy mode use something like this: + // + // if (control -> ProxyMode == proxy_client) + // { + // sprintf(options + strlen(options), "%s=%s", option, value); + // } + // + + // + // Send the authorization cookie if any. We assume + // user can choose to not provide any auth cookie + // and allow any connection to be accepted. + // + + if (WE_PROVIDE_CREDENTIALS && *authCookie != '\0') + { + sprintf(options + strlen(options), " cookie=%s,", authCookie); + } + else + { + sprintf(options + strlen(options), " "); + } + + // + // Now link characteristics and compression + // options. Delta compression, as well as + // preferred pack method, are imposed by + // client proxy. + // + + if (control -> ProxyMode == proxy_client) + { + sprintf(options + strlen(options), "link=%s,pack=%s,cache=%s,", + linkSpeedName, packMethodName, cacheSizeName); + + if (*bitrateLimitName != '\0') + { + sprintf(options + strlen(options), "limit=%s,", + bitrateLimitName); + } + + // + // Let the user disable the render extension + // and let the X client proxy know if it can + // short-circuit the X replies. Also pass + // along the session type to ensure that the + // remote proxy gets the right value. + // + + sprintf(options + strlen(options), "render=%d,taint=%d,", + (control -> HideRender == 0), + control -> TaintReplies); + + if (*sessionType != '\0') + { + sprintf(options + strlen(options), "type=%s,", sessionType); + } + else + { + sprintf(options + strlen(options), "type=default,"); + } + + // + // Add the 'strict' option, if needed. + // + + // Since ProtoStep7 (#issue 108) + if (useStrict != -1) + { + sprintf(options + strlen(options), "strict=%d,", useStrict); + } + + // + // Tell the remote the size of the shared + // memory segment. + // + + // Since ProtoStep7 (#issue 108) + if (*shsegSizeName != '\0') + { + sprintf(options + strlen(options), "shseg=%s,", shsegSizeName); + } + + // + // Send image cache parameters. + // + + sprintf(options + strlen(options), "images=%s,", imagesSizeName); + + sprintf(options + strlen(options), "delta=%d,stream=%d,data=%d ", + control -> LocalDeltaCompression, + control -> LocalStreamCompressionLevel, + control -> LocalDataCompressionLevel); + } + else + { + // + // If no special compression level was selected, + // server side will use compression levels set + // by client. + // + + if (control -> LocalStreamCompressionLevel < 0) + { + sprintf(options + strlen(options), "stream=default,"); + } + else + { + sprintf(options + strlen(options), "stream=%d,", + control -> LocalStreamCompressionLevel); + } + + if (control -> LocalDataCompressionLevel < 0) + { + sprintf(options + strlen(options), "data=default "); + } + else + { + sprintf(options + strlen(options), "data=%d ", + control -> LocalDataCompressionLevel); + } + } + + #ifdef TEST + *logofs << "Loop: Sending remote options '" + << options << "'.\n" << logofs_flush; + #endif + + return WriteLocalData(fd, options, strlen(options)); +} + +int ReadProxyVersion(int fd) +{ + #ifdef TEST + *logofs << "Loop: Going to read the remote proxy version " + << "from FD#" << fd << ".\n" << logofs_flush; + #endif + + // + // Read until the first space in string. + // We expect the remote version number. + // + + char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; + + int result = ReadRemoteData(fd, options, sizeof(options), ' '); + + if (result <= 0) + { + if (result < 0) + { + if (control -> ProxyMode == proxy_server) + { + HandleAlert(ABORT_PROXY_NEGOTIATION_ALERT, 1); + } + + handleAlertInLoop(); + } + + return result; + } + + #ifdef TEST + *logofs << "Loop: Received remote version string '" + << options << "' from FD#" << fd << ".\n" + << logofs_flush; + #endif + + if (strncmp(options, "NXPROXY-", strlen("NXPROXY-")) != 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Parse error in remote options string '" + << options << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Parse error in remote options string '" + << options << "'.\n"; + + return -1; + } + + // + // Try to determine if this is a pre-2.0.0 + // version advertising itself as compatible + // with the 1.2.2. + // + + int major = -1; + int minor = -1; + int patch = -1; + + sscanf(options, "NXPROXY-%i.%i.%i-%i.%i.%i", &(control -> RemoteVersionMajor), + &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch), + &major, &minor, &patch); + + if (control -> RemoteVersionMajor == 1 && + control -> RemoteVersionMinor == 2 && + control -> RemoteVersionPatch == 2 && + major != -1 && minor != -1 && patch != -1) + { + #ifdef TEST + *logofs << "Loop: Read trailing remote version '" << major + << "." << minor << "." << patch << "'.\n" + << logofs_flush; + #endif + + control -> CompatVersionMajor = major; + control -> CompatVersionMinor = minor; + control -> CompatVersionPatch = patch; + + control -> RemoteVersionMajor = major; + control -> RemoteVersionMinor = minor; + control -> RemoteVersionPatch = patch; + } + else + { + // + // We read the remote version at the first + // round. If the second version is missing, + // we will retain the values read before. + // + + sscanf(options, "NXPROXY-%i.%i.%i-%i.%i.%i", &(control -> CompatVersionMajor), + &(control -> CompatVersionMinor), &(control -> CompatVersionPatch), + &(control -> RemoteVersionMajor), &(control -> RemoteVersionMinor), + &(control -> RemoteVersionPatch)); + } + + *logofs << "Loop: Identified remote version '" << control -> RemoteVersionMajor + << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch + << "'.\n" << logofs_flush; + + *logofs << "Loop: Remote compatibility version '" << control -> CompatVersionMajor + << "." << control -> CompatVersionMinor << "." << control -> CompatVersionPatch + << "'.\n" << logofs_flush; + + *logofs << "Loop: Local version '" << control -> LocalVersionMajor + << "." << control -> LocalVersionMinor << "." << control -> LocalVersionPatch + << "'.\n" << logofs_flush; + + if (SetVersion() < 0) + { + if (control -> ProxyMode == proxy_server) + { + HandleAlert(WRONG_PROXY_VERSION_ALERT, 1); + } + + handleAlertInLoop(); + + return -1; + } + + return 1; +} + +int ReadProxyOptions(int fd) +{ + #ifdef TEST + *logofs << "Loop: Going to read the remote proxy options " + << "from FD#" << fd << ".\n" << logofs_flush; + #endif + + char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; + + int result = ReadRemoteData(fd, options, sizeof(options), ' '); + + if (result <= 0) + { + return result; + } + + #ifdef TEST + *logofs << "Loop: Received remote options string '" + << options << "' from FD#" << fd << ".\n" + << logofs_flush; + #endif + + // + // Get the remote options, delimited by a space character. + // Note that there will be a further initialization phase + // at the time proxies negotiate cache file to restore. + // + + if (ParseRemoteOptions(options) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Couldn't negotiate a valid " + << "session with remote NX proxy.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Couldn't negotiate a valid " + << "session with remote NX proxy.\n"; + + return -1; + } + + return 1; +} + +int SendProxyCaches(int fd) +{ + #ifdef TEST + *logofs << "Loop: Synchronizing local and remote caches.\n" + << logofs_flush; + #endif + + if (control -> ProxyMode == proxy_client) + { + // + // Prepare a list of caches matching this + // session type and send it to the remote. + // + + #ifdef TEST + *logofs << "Loop: Going to send the list of local caches.\n" + << logofs_flush; + #endif + + SetCaches(); + + int entries = DEFAULT_REMOTE_CACHE_ENTRIES; + + const char prefix = 'C'; + + if (control -> LocalDeltaCompression == 0 || + control -> PersistentCacheEnableLoad == 0) + { + #ifdef TEST + *logofs << "Loop: Writing an empty list to FD#" << fd + << ".\n" << logofs_flush; + #endif + + return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none ")); + } + + int count = 0; + + #ifdef TEST + *logofs << "Loop: Looking for cache files in directory '" + << control -> PersistentCachePath << "'.\n" << logofs_flush; + #endif + + DIR *cacheDir = opendir(control -> PersistentCachePath); + + if (cacheDir != NULL) + { + dirent *dirEntry; + + int prologue = 0; + + while (((dirEntry = readdir(cacheDir)) != NULL) && (count < entries)) + { + if (*dirEntry -> d_name == prefix && + strlen(dirEntry -> d_name) == (MD5_LENGTH * 2 + 2)) + { + if (prologue == 0) + { + WriteLocalData(fd, "cachelist=", strlen("cachelist=")); + + prologue = 1; + } + else + { + WriteLocalData(fd, ",", strlen(",")); + } + + #ifdef TEST + *logofs << "Loop: Writing entry '" << control -> PersistentCachePath + << "/" << dirEntry -> d_name << "' to FD#" << fd + << ".\n" << logofs_flush; + #endif + + // + // Write cache file name to the socket, + // including leading 'C-' or 'S-'. + // + + WriteLocalData(fd, dirEntry -> d_name, MD5_LENGTH * 2 + 2); + + count++; + } + } + + closedir(cacheDir); + } + + if (count == 0) + { + #ifdef TEST + *logofs << "Loop: Writing an empty list to FD#" << fd + << ".\n" << logofs_flush; + #endif + + return WriteLocalData(fd, "cachelist=none ", strlen("cachelist=none ")); + } + else + { + return WriteLocalData(fd, " ", 1); + } + } + else + { + // + // Send back the selected cache name. + // + + #ifdef TEST + *logofs << "Loop: Going to send the selected cache.\n" + << logofs_flush; + #endif + + char buffer[DEFAULT_STRING_LENGTH]; + + if (control -> PersistentCacheName != NULL) + { + #ifdef TEST + *logofs << "Loop: Name of selected cache file is '" + << control -> PersistentCacheName << "'.\n" + << logofs_flush; + #endif + + sprintf(buffer, "cachefile=%s%s ", + *(control -> PersistentCacheName) == 'C' ? "S-" : "C-", + control -> PersistentCacheName + 2); + } + else + { + #ifdef TEST + *logofs << "Loop: No valid cache file was selected.\n" + << logofs_flush; + #endif + + sprintf(buffer, "cachefile=none "); + } + + #ifdef TEST + *logofs << "Loop: Sending string '" << buffer + << "' as selected cache file.\n" + << logofs_flush; + #endif + + return WriteLocalData(fd, buffer, strlen(buffer)); + } +} + +int ReadProxyCaches(int fd) +{ + if (control -> ProxyMode == proxy_client) + { + #ifdef TEST + *logofs << "Loop: Going to receive the selected proxy cache.\n" + << logofs_flush; + #endif + + // + // We will read the name of cache plus the stop character. + // + + char buffer[DEFAULT_STRING_LENGTH]; + + // + // Leave space for a trailing null. + // + + int result = ReadRemoteData(fd, buffer, sizeof("cachefile=") + MD5_LENGTH * 2 + 3, ' '); + + if (result <= 0) + { + return result; + } + + char *cacheName = strstr(buffer, "cachefile="); + + if (cacheName == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid cache file option '" + << buffer << "' provided by remote proxy.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid cache file option '" + << buffer << "' provided by remote proxy.\n"; + + HandleCleanup(); + } + + cacheName += strlen("cachefile="); + + if (control -> PersistentCacheName != NULL) + { + delete [] control -> PersistentCacheName; + } + + control -> PersistentCacheName = NULL; + + if (strncasecmp(cacheName, "none", strlen("none")) == 0) + { + #ifdef TEST + *logofs << "Loop: No cache file selected by remote proxy.\n" + << logofs_flush; + #endif + } + else if (strlen(cacheName) != MD5_LENGTH * 2 + 3 || + *(cacheName + MD5_LENGTH * 2 + 2) != ' ') + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid cache file name '" + << cacheName << "' provided by remote proxy.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid cache file name '" + << cacheName << "' provided by remote proxy.\n"; + + HandleCleanup(); + } + else + { + // + // It is "C-" + 32 + "\0". + // + + control -> PersistentCacheName = new char[MD5_LENGTH * 2 + 3]; + + *(cacheName + MD5_LENGTH * 2 + 2) = '\0'; + + strcpy(control -> PersistentCacheName, cacheName); + + #ifdef TEST + *logofs << "Loop: Cache file '" << control -> PersistentCacheName + << "' selected by remote proxy.\n" << logofs_flush; + #endif + } + } + else + { + #ifdef TEST + *logofs << "Loop: Going to receive the list of remote caches.\n" + << logofs_flush; + #endif + + SetCaches(); + + int size = ((MD5_LENGTH * 2 + 2) + strlen(",")) * DEFAULT_REMOTE_CACHE_ENTRIES + + strlen("cachelist=") + strlen(" ") + 1; + + char *buffer = new char[size]; + + int result = ReadRemoteData(fd, buffer, size - 1, ' '); + + if (result <= 0) + { + delete [] buffer; + + return result; + } + + #ifdef TEST + *logofs << "Loop: Read list of caches from remote side as '" + << buffer << "'.\n" << logofs_flush; + #endif + + // + // Prepare the buffer. What we want is a list + // like "cache1,cache2,cache2" terminated by + // null. + // + + *(buffer + strlen(buffer) - 1) = '\0'; + + if (strncasecmp(buffer, "cachelist=", strlen("cachelist=")) != 0) + { + #ifdef PANIC + *logofs << "Loop: Wrong format for list of cache files " + << "read from FD#" << fd << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Wrong format for list of cache files.\n"; + + delete [] buffer; + + return -1; + } + + control -> PersistentCacheName = GetLastCache(buffer, control -> PersistentCachePath); + + // + // Get rid of list of caches. + // + + delete [] buffer; + } + + return 1; +} + +int ReadForwarderVersion(int fd) +{ + #ifdef TEST + *logofs << "Loop: Going to negotiate the forwarder version.\n" + << logofs_flush; + #endif + + // + // Check if we actually expect the session cookie. + // + + if (*authCookie == '\0') + { + #ifdef TEST + *logofs << "Loop: No authentication cookie required " + << "from FD#" << fd << ".\n" << logofs_flush; + #endif + + return 1; + } + + char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; + + int result = ReadRemoteData(fd, options, sizeof(options), ' '); + + if (result <= 0) + { + return result; + } + + #ifdef TEST + *logofs << "Loop: Received forwarder version string '" << options + << "' from FD#" << fd << ".\n" << logofs_flush; + #endif + + if (strncmp(options, "NXSSH-", strlen("NXSSH-")) != 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Parse error in forwarder options string '" + << options << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Parse error in forwarder options string '" + << options << "'.\n"; + + return -1; + } + + // + // Accept whatever forwarder version. + // + + sscanf(options, "NXSSH-%i.%i.%i", &(control -> RemoteVersionMajor), + &(control -> RemoteVersionMinor), &(control -> RemoteVersionPatch)); + + #ifdef TEST + *logofs << "Loop: Read forwarder version '" << control -> RemoteVersionMajor + << "." << control -> RemoteVersionMinor << "." << control -> RemoteVersionPatch + << "'.\n" << logofs_flush; + #endif + + return 1; +} + +int ReadForwarderOptions(int fd) +{ + // + // Get the forwarder cookie. + // + + if (*authCookie == '\0') + { + #ifdef TEST + *logofs << "Loop: No authentication cookie required " + << "from FD#" << fd << ".\n" << logofs_flush; + #endif + + return 1; + } + + char options[DEFAULT_REMOTE_OPTIONS_LENGTH]; + + int result = ReadRemoteData(fd, options, sizeof(options), ' '); + + if (result <= 0) + { + return result; + } + + #ifdef TEST + *logofs << "Loop: Received forwarder options string '" + << options << "' from FD#" << fd << ".\n" + << logofs_flush; + #endif + + if (ParseForwarderOptions(options) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Couldn't negotiate a valid " + << "cookie with the NX forwarder.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Couldn't negotiate a valid " + << "cookie with the NX forwarder.\n"; + + return -1; + } + + return 1; +} + +int ReadRemoteData(int fd, char *buffer, int size, char stop) +{ + #ifdef TEST + *logofs << "Loop: Going to read remote data from FD#" + << fd << ".\n" << logofs_flush; + #endif + + if (size >= MAXIMUM_REMOTE_OPTIONS_LENGTH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Maximum remote options buffer " + << "limit exceeded.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Maximum remote options buffer " + << "limit exceeded.\n"; + + HandleCleanup(); + } + + while (remotePosition < (size - 1)) + { + int result = read(fd, remoteData + remotePosition, 1); + + getNewTimestamp(); + + if (result <= 0) + { + if (result == -1) + { + if (EGET() == EAGAIN) + { + #ifdef TEST + *logofs << "Loop: Reading data from FD#" << fd + << " would block.\n" << logofs_flush; + #endif + + return 0; + } + else if (EGET() == EINTR) + { + if (CheckAbort() != 0) + { + return -1; + } + + continue; + } + } + + #ifdef PANIC + *logofs << "Loop: PANIC! The remote NX proxy closed " + << "the connection.\n" << logofs_flush; + #endif + + cerr << "Error" << ": The remote NX proxy closed " + << "the connection.\n"; + + return -1; + } + else if (*(remoteData + remotePosition) == stop) + { + #ifdef TEST + *logofs << "Loop: Read stop character from FD#" + << fd << ".\n" << logofs_flush; + #endif + + remotePosition++; + + // + // Copy the fake terminating null + // in the buffer. + // + + *(remoteData + remotePosition) = '\0'; + + memcpy(buffer, remoteData, remotePosition + 1); + + #ifdef TEST + *logofs << "Loop: Remote string '" << remoteData + << "' read from FD#" << fd << ".\n" + << logofs_flush; + #endif + + int t = remotePosition; + + remotePosition = 0; + + return t; + } + else + { + // + // Make sure string received + // from far end is printable. + // + + if (isgraph(*(remoteData + remotePosition)) == 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Non printable character decimal '" + << (unsigned int) *(remoteData + remotePosition) + << "' received in remote data from FD#" + << fd << ".\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Non printable character decimal '" + << (unsigned int) *(remoteData + remotePosition) + << "' received in remote data from FD#" + << fd << ".\n" << logofs_flush; + + *(remoteData + remotePosition) = ' '; + } + + #ifdef DEBUG + *logofs << "Loop: Read a further character " + << "from FD#" << fd << ".\n" + << logofs_flush; + #endif + + remotePosition++; + } + } + + *(remoteData + remotePosition) = '\0'; + + #ifdef PANIC + *logofs << "Loop: PANIC! Stop character missing " + << "from FD#" << fd << " after " << remotePosition + << " characters read in string '" << remoteData + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Stop character missing " + << "from FD#" << fd << " after " << remotePosition + << " characters read in string '" << remoteData + << "'.\n"; + + memcpy(buffer, remoteData, remotePosition); + + remotePosition = 0; + + return -1; +} + +static int +hexval(char c) { + if ((c >= '0') && (c <= '9')) + return c - '0'; + if ((c >= 'a') && (c <= 'f')) + return c - 'a' + 10; + if ((c >= 'A') && (c <= 'F')) + return c - 'A' + 10; + return -1; +} + +static void +URLDecodeInPlace(char *str) { + if (str) { + char *to = str; + while (str[0]) { + if ((str[0] == '%') && + (hexval(str[1]) >= 0) && + (hexval(str[2]) >= 0)) { + *(to++) = hexval(str[1]) * 16 + hexval(str[2]); + str += 3; + } + else + *(to++) = *(str++); + } + *to = '\0'; + } +} + +int WriteLocalData(int fd, const char *buffer, int size) +{ + int position = 0; + int ret = 0; + fd_set writeSet; + struct timeval selectTs = {30, 0}; + + while (position < size) + { + + // A write to a non-blocking socket may fail with EAGAIN. The problem is + // that cache data is done in several writes, and there's no easy way + // to handle failure without rewriting a significant amount of code. + // + // Bailing out of the outer loop would result in restarting the sending + // of the entire cache list, which would confuse the other side. + + FD_ZERO(&writeSet); + FD_SET(fd, &writeSet); + + ret = select(fd+1, NULL, &writeSet, NULL, &selectTs); + + #ifdef DEBUG + *logofs << "Loop: WriteLocalData: select() returned with a code of " << ret << " and remaining timeout of " + << selectTs.tv_sec << " sec, " << selectTs.tv_usec << "usec\n" << logofs_flush; + #endif + + if ( ret < 0 ) + { + *logofs << "Loop: Error in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush; + + if ( EGET() == EINTR ) + continue; + + return -1; + } + else if ( ret == 0 ) + { + *logofs << "Loop: Timeout expired in select() when writing data to FD#" << fd << ": " << strerror(EGET()) << "\n" << logofs_flush; + return -1; + } + + int result = write(fd, buffer + position, size - position); + + getNewTimestamp(); + + if (result <= 0) + { + if (result < 0 && (EGET() == EINTR || EGET() == EAGAIN || EGET() == EWOULDBLOCK)) + { + continue; + } + + #ifdef TEST + *logofs << "Loop: Error writing data to FD#" + << fd << ".\n" << logofs_flush; + #endif + + return -1; + } + + position += result; + } + + return position; +} + +// +// Parse the string passed by calling process in +// the environment. This is not necessarily the +// content of DISPLAY variable, but can be the +// parameters passed when creating the process +// or thread. +// + +int ParseEnvironmentOptions(const char *env, int force) +{ + // + // Be sure log file is valid. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + // + // Be sure we have a parameters repository + // and a context to jump into because this + // can be called before creating the proxy. + // + + if (control == NULL) + { + control = new Control(); + } + + if (setjmp(context) == 1) + { + #ifdef TEST + *logofs << "Loop: Out of the long jump while parsing " + << "the environment options.\n" + << logofs_flush; + #endif + + return -1; + } + + if (force == 0 && parsedOptions == 1) + { + #ifdef TEST + *logofs << "Loop: Skipping a further parse of environment " + << "options string '" << (env != NULL ? env : "") + << "'.\n" << logofs_flush; + #endif + + return 1; + } + + if (env == NULL || *env == '\0') + { + #ifdef TEST + *logofs << "Loop: Nothing to do with empty environment " + << "options string '" << (env != NULL ? env : "") + << "'.\n" << logofs_flush; + #endif + + return 0; + } + + #ifdef TEST + *logofs << "Loop: Going to parse the environment options " + << "string '" << env << "'.\n" + << logofs_flush; + #endif + + parsedOptions = 1; + + // + // Copy the string passed as parameter + // because we need to modify it. + // + + char opts[DEFAULT_DISPLAY_OPTIONS_LENGTH]; + + #ifdef VALGRIND + + memset(opts, '\0', DEFAULT_DISPLAY_OPTIONS_LENGTH); + + #endif + + if (strlen(env) >= DEFAULT_DISPLAY_OPTIONS_LENGTH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Environment options string '" << env + << "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH + << " characters.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Environment options string '" << env + << "' exceeds length of " << DEFAULT_DISPLAY_OPTIONS_LENGTH + << " characters.\n"; + + return -1; + } + + strcpy(opts, env); + + char *nextOpts = opts; + + // + // Ensure that DISPLAY environment variable + // (roughly) follows the X convention for + // transport notation. + // + + if (strncasecmp(opts, "nx/nx,:", 7) == 0 || + strncasecmp(opts, "nx,:", 4) == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Parse error in options string '" + << opts << "' at 'nx,:'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Parse error in options string '" + << opts << "' at 'nx,:'.\n"; + + return -1; + } + else if (strncasecmp(opts, "nx/nx,", 6) == 0) + { + nextOpts += 6; + } + else if (strncasecmp(opts, "nx,", 3) == 0) + { + nextOpts += 3; + } + else if (strncasecmp(opts, "nx:", 3) == 0) + { + nextOpts += 3; + } + else if (force == 0) + { + #ifdef TEST + *logofs << "Loop: Ignoring host X server display string '" + << opts << "'.\n" << logofs_flush; + #endif + + return 0; + } + + // + // Save here the name of the options file and + // parse it after all the other options. + // + + char fileOptions[DEFAULT_STRING_LENGTH] = { 0 }; + + // + // The options string is intended to be a series + // of name/value tuples in the form name=value + // separated by the ',' character ended by a ':' + // followed by remote NX proxy port. + // + + char *name; + char *value; + + value = strrchr(nextOpts, ':'); + + if (value != NULL) + { + char *check = value + 1; + + if (*check == '\0' || isdigit(*check) == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify NX port in string '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify NX port in string '" + << value << "'.\n"; + + return -1; + } + + proxyPort = atoi(check); + + // + // Get rid of the port specification. + // + + *value = '\0'; + } + else if (proxyPort == DEFAULT_NX_PROXY_PORT && force == 0) + { + // + // Complain only if user didn't specify + // the port on the command line. + // + + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify NX port in string '" + << opts << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify NX port in string '" + << opts << "'.\n"; + + return -1; + } + + #ifdef TEST + *logofs << "Loop: Parsing options string '" + << nextOpts << "'.\n" << logofs_flush; + #endif + + // + // Now all the other optional parameters. + // + + name = strtok(nextOpts, "="); + + char connectHost[DEFAULT_STRING_LENGTH] = { 0 }; + long connectPort = -1; + + while (name) + { + value = strtok(NULL, ","); + URLDecodeInPlace(value); + + if (CheckArg("environment", name, value) < 0) + { + return -1; + } + + if (strcasecmp(name, "options") == 0) + { + strncpy(fileOptions, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "display") == 0) + { + strncpy(displayHost, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "link") == 0) + { + + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else if (ParseLinkOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify 'link' option in string '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify 'link' option in string '" + << value << "'.\n"; + if (ParseLinkOption("adsl") < 0) + return -1; + } + } + else if (strcasecmp(name, "limit") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else if (ParseBitrateOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify option 'limit' in string '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify option 'limit' in string '" + << value << "'.\n"; + + return -1; + } + } + else if (strcasecmp(name, "type") == 0) + { + // + // Type of session, for example "desktop", + // "application", "windows", etc. + // + + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + if (strcasecmp(value, "default") == 0) + { + *sessionType = '\0'; + } + else + { + strncpy(sessionType, value, DEFAULT_STRING_LENGTH - 1); + } + } + } + else if (strcasecmp(name, "listen") == 0) + { + char *socketUri = NULL; + if (connectSocket.getSpec(&socketUri)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't handle 'listen' and 'connect' parameters " + << "at the same time.\n" << logofs_flush; + + *logofs << "Loop: PANIC! Refusing 'listen' parameter with 'connect' being '" + << socketUri << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't handle 'listen' and 'connect' parameters " + << "at the same time.\n"; + + cerr << "Error" << ": Refusing 'listen' parameter with 'connect' being '" + << socketUri << "'.\n"; + + free(socketUri); + return -1; + } + + SetAndValidateChannelEndPointArg("local", name, value, listenSocket); + + } + else if (strcasecmp(name, "loopback") == 0) + { + loopbackBind = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "accept") == 0) + { + char *socketUri = NULL; + if (connectSocket.getSpec(&socketUri)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't handle 'accept' and 'connect' parameters " + << "at the same time.\n" << logofs_flush; + + *logofs << "Loop: PANIC! Refusing 'accept' parameter with 'connect' being '" + << socketUri << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't handle 'accept' and 'connect' parameters " + << "at the same time.\n"; + + cerr << "Error" << ": Refusing 'accept' parameter with 'connect' being '" + << socketUri << "'.\n"; + + free(socketUri); + return -1; + } + + strncpy(acceptHost, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "connect") == 0) + { + if (*acceptHost != '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't handle 'connect' and 'accept' parameters " + << "at the same time.\n" << logofs_flush; + + *logofs << "Loop: PANIC! Refusing 'connect' parameter with 'accept' being '" + << acceptHost << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't handle 'connect' and 'accept' parameters " + << "at the same time.\n"; + + cerr << "Error" << ": Refusing 'connect' parameter with 'accept' being '" + << acceptHost << "'.\n"; + + return -1; + } + if ((strncmp(value, "tcp:", 4) == 0) || (strncmp(value, "unix:", 5) == 0)) + SetAndValidateChannelEndPointArg("local", name, value, connectSocket); + else + // if the "connect" parameter does not start with "unix:" or "tcp:" assume + // old parameter usage style (providing hostname string only). + strcpy(connectHost, value); + } + else if (strcasecmp(name, "port") == 0) + { + connectPort = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "retry") == 0) + { + control -> OptionProxyRetryConnect = ValidateArg("local", name, value); + control -> OptionServerRetryConnect = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "session") == 0) + { + strncpy(sessionFileName, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "errors") == 0) + { + // + // The old name of the parameter was 'log' + // but the default name for the file is + // 'errors' so it is more logical to use + // the same name. + // + + strncpy(errorsFileName, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "root") == 0) + { + strncpy(rootDir, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "id") == 0) + { + strncpy(sessionId, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "stats") == 0) + { + control -> EnableStatistics = 1; + + strncpy(statsFileName, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "cookie") == 0) + { + LowercaseArg("local", name, value); + + strncpy(authCookie, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "nodelay") == 0) + { + useNoDelay = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "policy") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + usePolicy = ValidateArg("local", name, value); + } + } + else if (strcasecmp(name, "render") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + useRender = ValidateArg("local", name, value); + } + } + else if (strcasecmp(name, "taint") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + useTaint = ValidateArg("local", name, value); + } + } + else if (strcasecmp(name, "delta") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + control -> LocalDeltaCompression = ValidateArg("local", name, value); + } + } + else if (strcasecmp(name, "data") == 0) + { + control -> LocalDataCompressionLevel = ValidateArg("local", name, value); + + if (control -> LocalDataCompressionLevel == 0) + { + control -> LocalDataCompression = 0; + } + else + { + control -> LocalDataCompression = 1; + } + } + else if (strcasecmp(name, "stream") == 0) + { + control -> LocalStreamCompressionLevel = ValidateArg("local", name, value); + + if (control -> LocalStreamCompressionLevel == 0) + { + control -> LocalStreamCompression = 0; + } + else + { + control -> LocalStreamCompression = 1; + } + } + else if (strcasecmp(name, "memory") == 0) + { + control -> LocalMemoryLevel = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "cache") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else if (ParseCacheOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify cache size for string '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify cache size for string '" + << value << "'.\n"; + + return -1; + } + } + else if (strcasecmp(name, "images") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else if (ParseImagesOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify images cache size for string '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify images cache size for string '" + << value << "'.\n"; + + return -1; + } + } + else if (strcasecmp(name, "shseg") == 0) + { + // + // The 'shmem' option is used by the agent, together + // with 'shpix' literal. We make the 'shseg' option + // specific to the proxy and use it to determine the + // size of the shared memory segment, or otherwise 0, + // if the use of the shared memory extension should + // not be enabled on the real X server. + // + + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else if (ParseShmemOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify size of shared memory " + << "segment in string '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify size of shared memory " + << "segment in string '" << value << "'.\n"; + + return -1; + } + } + else if (strcasecmp(name, "load") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + control -> PersistentCacheEnableLoad = ValidateArg("local", name, value); + + if (control -> PersistentCacheEnableLoad > 0) + { + control -> PersistentCacheEnableLoad = 1; + } + else + { + if (control -> PersistentCacheName != NULL) + { + delete [] control -> PersistentCacheName; + } + + control -> PersistentCacheName = NULL; + + control -> PersistentCacheEnableLoad = 0; + } + } + } + else if (strcasecmp(name, "save") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + control -> PersistentCacheEnableSave = ValidateArg("local", name, value); + + if (control -> PersistentCacheEnableSave > 0) + { + control -> PersistentCacheEnableSave = 1; + } + else + { + if (control -> PersistentCacheName != NULL) + { + delete [] control -> PersistentCacheName; + } + + control -> PersistentCacheName = NULL; + + control -> PersistentCacheEnableSave = 0; + } + } + } + else if (strcasecmp(name, "cups") == 0) + { + SetAndValidateChannelEndPointArg("local", name, value, cupsPort); + } + else if (strcasecmp(name, "sync") == 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! No 'sync' channel in current version. " + << "Assuming 'cups' channel.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": No 'sync' channel in current version. " + << "Assuming 'cups' channel.\n"; + + SetAndValidateChannelEndPointArg("local", name, value, cupsPort); + } + else if (strcasecmp(name, "keybd") == 0 || + strcasecmp(name, "aux") == 0) + { + SetAndValidateChannelEndPointArg("local", name, value, auxPort); + } + else if (strcasecmp(name, "samba") == 0 || + strcasecmp(name, "smb") == 0) + { + SetAndValidateChannelEndPointArg("local", name, value, smbPort); + } + else if (strcasecmp(name, "media") == 0) + { + SetAndValidateChannelEndPointArg("local", name, value, mediaPort); + } + else if (strcasecmp(name, "http") == 0) + { + SetAndValidateChannelEndPointArg("local", name, value, httpPort); + } + else if (strcasecmp(name, "font") == 0) + { + strncpy(fontPort, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "slave") == 0) + { + SetAndValidateChannelEndPointArg("local", name, value, slavePort); + } + else if (strcasecmp(name, "mask") == 0) + { + control -> ChannelMask = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "timeout") == 0) + { + int timeout = ValidateArg("local", name, value); + + if (timeout == 0) + { + #ifdef TEST + *logofs << "Loop: Disabling timeout on broken " + << "proxy connection.\n" << logofs_flush; + #endif + + control -> ProxyTimeout = 0; + } + else + { + control -> ProxyTimeout = timeout * 1000; + } + } + else if (strcasecmp(name, "cleanup") == 0) + { + int cleanup = ValidateArg("local", name, value); + + if (cleanup == 0) + { + #ifdef TEST + *logofs << "Loop: Disabling grace timeout on " + << "proxy shutdown.\n" << logofs_flush; + #endif + + control -> CleanupTimeout = 0; + } + else + { + control -> CleanupTimeout = cleanup * 1000; + } + } + else if (strcasecmp(name, "pack") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else if (ParsePackOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify pack method for string '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify pack method for string '" + << value << "'.\n"; + if (ParsePackOption("nopack")<0) + return -1; + } + } + else if (strcasecmp(name, "core") == 0) + { + control -> EnableCoreDumpOnAbort = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "kill") == 0) + { + if (control -> KillDaemonOnShutdownNumber < + control -> KillDaemonOnShutdownLimit) + { + #ifdef TEST + *logofs << "Loop: WARNING! Adding process with pid '" + << ValidateArg("local", name, value) << " to the " + << "daemons to kill at shutdown.\n" + << logofs_flush; + #endif + + control -> KillDaemonOnShutdown[control -> + KillDaemonOnShutdownNumber] = + ValidateArg("local", name, value); + + control -> KillDaemonOnShutdownNumber++; + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Number of daemons to kill " + << "at shutdown exceeded.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Number of daemons to kill " + << "at shutdown exceeded.\n"; + } + } + else if (strcasecmp(name, "strict") == 0) + { + if (control -> ProxyMode == proxy_server) + { + PrintOptionIgnored("local", name, value); + } + else + { + useStrict = ValidateArg("local", name, value); + } + } + else if (strcasecmp(name, "encryption") == 0) + { + useEncryption = ValidateArg("local", name, value); + } + else if (strcasecmp(name, "product") == 0) + { + strncpy(productName, value, DEFAULT_STRING_LENGTH - 1); + } + else if (strcasecmp(name, "rootless") == 0 || + strcasecmp(name, "geometry") == 0 || + strcasecmp(name, "resize") == 0 || + strcasecmp(name, "fullscreen") == 0 || + strcasecmp(name, "keyboard") == 0 || + strcasecmp(name, "clipboard") == 0 || + strcasecmp(name, "streaming") == 0 || + strcasecmp(name, "backingstore") == 0 || + strcasecmp(name, "sleep") == 0 || + strcasecmp(name, "tolerancechecks") == 0) + { + #ifdef DEBUG + *logofs << "Loop: Ignoring agent option '" << name + << "' with value '" << value << "'.\n" + << logofs_flush; + #endif + } + else if (strcasecmp(name, "composite") == 0 || + strcasecmp(name, "shmem") == 0 || + strcasecmp(name, "shpix") == 0 || + strcasecmp(name, "kbtype") == 0 || + strcasecmp(name, "client") == 0 || + strcasecmp(name, "shadow") == 0 || + strcasecmp(name, "shadowuid") == 0 || + strcasecmp(name, "shadowmode") == 0 || + strcasecmp(name, "clients") == 0 || + strcasecmp(name, "xinerama") == 0) + { + #ifdef DEBUG + *logofs << "Loop: Ignoring agent option '" << name + << "' with value '" << value << "'.\n" + << logofs_flush; + #endif + } + else if (strcasecmp(name, "defer") == 0 || + strcasecmp(name, "tile") == 0 || + strcasecmp(name, "menu") == 0 || + strcasecmp(name, "state") == 0 ) + { + #ifdef DEBUG + *logofs << "Loop: Ignoring agent option '" << name + << "' with value '" << value << "'.\n" + << logofs_flush; + #endif + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring unknown option '" + << name << "' with value '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Ignoring unknown option '" + << name << "' with value '" << value << "'.\n"; + } + + name = strtok(NULL, "="); + + } // End of while (name) ... + + // Assemble the connectSocket channel end point if parameter values have been old-school... + if (connectSocket.disabled() && (connectHost[0] != '\0') && (proxyPort > 0 || connectPort > 0)) + { + if (connectPort < 0) + connectPort = proxyPort + DEFAULT_NX_PROXY_PORT_OFFSET; + + char tcpHostAndPort[DEFAULT_STRING_LENGTH] = { 0 }; + sprintf(tcpHostAndPort, "tcp:%s:%ld", connectHost, connectPort); + SetAndValidateChannelEndPointArg("local", name, tcpHostAndPort, connectSocket); + } + + #ifdef TEST + *logofs << "Loop: Completed parsing of string '" + << env << "'.\n" << logofs_flush; + #endif + + if ((*fileOptions != '\0') && (strncmp(fileOptions, "/dev/", 5) != 0) && (strncmp(fileOptions, "/proc/", 6) != 0) && (strncmp(fileOptions, "/sys/", 5) != 0)) + { + if (strcmp(fileOptions, optionsFileName) != 0) + { + #ifdef TEST + *logofs << "Loop: Reading options from '" << fileOptions + << "'.\n" << logofs_flush; + #endif + + if (ParseFileOptions(fileOptions) < 0) + { + return -1; + } + } + #ifdef WARNING + else + { + *logofs << "Loop: WARNING! Name of the options file " + << "specified multiple times. Not parsing " + << "again.\n" << logofs_flush; + } + #endif + + if (*optionsFileName == '\0') + { + strncpy(optionsFileName, value, DEFAULT_STRING_LENGTH - 1); + + #ifdef TEST + *logofs << "Loop: Assuming name of options file '" + << optionsFileName << "'.\n" + << logofs_flush; + #endif + } + } + + // + // If port where proxy is acting as an X server + // was not specified assume the same port where + // proxy is listening for the remote peer. + // + + if (xPort == DEFAULT_NX_X_PORT) + { + xPort = proxyPort; + } + + return 1; +} + +// +// Parse the command line options passed by user when +// running proxy in stand alone mode. Note that passing +// parameters this way is strongly discouraged. These +// command line switch can change (and they do often). +// Please, use the form "option=value" instead and set +// the DISPLAY environment variable. +// + +int ParseCommandLineOptions(int argc, const char **argv) +{ + // + // Be sure log file is valid. + // + + if (logofs == NULL) + { + logofs = &cerr; + } + + if (setjmp(context) == 1) + { + #ifdef TEST + *logofs << "Loop: Out of the long jump while parsing " + << "the command line options.\n" + << logofs_flush; + #endif + + return -1; + } + + // + // Be sure we have a parameters repository + // + + if (control == NULL) + { + control = new Control(); + } + + if (parsedCommand == 1) + { + #ifdef TEST + *logofs << "Loop: Skipping a further parse of command line options.\n" + << logofs_flush; + #endif + + return 1; + } + + #ifdef TEST + *logofs << "Loop: Going to parse the command line options.\n" + << logofs_flush; + #endif + + parsedCommand = 1; + + // + // Print out arguments. + // + + #ifdef TEST + + *logofs << "Loop: Argc is " << argc << ".\n" << logofs_flush; + + for (int argi = 0; argi < argc; argi++) + { + *logofs << "Loop: Argv[" << argi << "] is " << argv[argi] + << ".\n" << logofs_flush; + } + + #endif + + // + // Shall use getopt here. + // + + for (int argi = 1; argi < argc; argi++) + { + const char *nextArg = argv[argi]; + + if (*nextArg == '-') + { + switch (*(nextArg + 1)) + { + case 'h': + { + PrintUsageInfo(nextArg, 0); + + return -1; + } + case 'C': + { + // + // Start proxy in CLIENT mode. + // + + if (WE_SET_PROXY_MODE == 0) + { + #ifdef TEST + *logofs << "Loop: Setting local proxy mode to proxy_client.\n" + << logofs_flush; + #endif + + control -> ProxyMode = proxy_client; + } + else if (control -> ProxyMode != proxy_client) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't redefine local proxy to " + << "client mode.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't redefine local proxy to " + << "client mode.\n"; + + return -1; + } + + break; + } + case 'S': + { + // + // Start proxy in SERVER mode. + // + + if (WE_SET_PROXY_MODE == 0) + { + #ifdef TEST + *logofs << "Loop: Setting local proxy mode to proxy_server.\n" + << logofs_flush; + #endif + + control -> ProxyMode = proxy_server; + } + else if (control -> ProxyMode != proxy_server) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't redefine local proxy to " + << "server mode.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't redefine local proxy to " + << "server mode.\n"; + + return -1; + } + + break; + } + case 'v': + { + PrintVersionInfo(); + + return -1; + } + default: + { + PrintUsageInfo(nextArg, 1); + + // + // Function GetArg() is not used anymore. + // Add a dummy call to avoid the warning. + // + + if (0) + { + GetArg(argi, argc, argv); + } + + return -1; + } + } + } + else + { + if (nextArg) + { + // + // Try to parse the option as a remote host:port + // specification as in 'localhost:8'. Such a + // parameter can be specified at the end of the + // command line at the connecting side. + // + + char cHost[DEFAULT_STRING_LENGTH] = { '\0' }; + long cPort = 0; + + if (ParseHostOption(nextArg, cHost, cPort) > 0) + { + // + // Assume port is at a proxied display offset. + // + + proxyPort = cPort; + + cPort += DEFAULT_NX_PROXY_PORT_OFFSET; + connectSocket.setSpec(cHost, cPort); + + } + else if (ParseEnvironmentOptions(nextArg, 1) < 0) + { + return -1; + } + } + } + } + + return 1; +} + +// +// Set the variable to the values of host and +// port where this proxy is going to hook to +// an existing proxy. +// + +int ParseBindOptions(char **host, int *port) +{ + if (*bindHost != '\0') + { + *host = bindHost; + *port = bindPort; + + return 1; + } + else + { + return 0; + } +} + +// +// Read options from file and merge with environment. +// + +int ParseFileOptions(const char *file) +{ + char *fileName; + + if (*file != '/' && *file != '.') + { + char *filePath = GetSessionPath(); + + if (filePath == NULL) + { + cerr << "Error" << ": Cannot determine directory for NX option file.\n"; + + HandleCleanup(); + } + + fileName = new char[strlen(filePath) + strlen("/") + + strlen(file) + 1]; + + strcpy(fileName, filePath); + + strcat(fileName, "/"); + strcat(fileName, file); + + delete [] filePath; + } + else + { + fileName = new char[strlen(file) + 1]; + + strcpy(fileName, file); + } + + #ifdef TEST + *logofs << "Loop: Going to read options from file '" + << fileName << "'.\n" << logofs_flush; + #endif + + FILE *filePtr = fopen(fileName, "r"); + + if (filePtr == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't open options file '" << fileName + << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't open options file '" << fileName + << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; + + delete [] fileName; + + return -1; + } + + char options[DEFAULT_DISPLAY_OPTIONS_LENGTH]; + + #ifdef VALGRIND + + memset(options, '\0', DEFAULT_DISPLAY_OPTIONS_LENGTH); + + #endif + + if (fgets(options, DEFAULT_DISPLAY_OPTIONS_LENGTH, filePtr) == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't read options from file '" << fileName + << "'. Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't read options from file '" << fileName + << "'. Error is " << EGET() << " '" << ESTR() << "'.\n"; + + fclose(filePtr); + + delete [] fileName; + + return -1; + } + + fclose(filePtr); + + // + // Purge the newline and the other non- + // printable characters in the string. + // + + char *next = options; + + while (*next != '\0') + { + if (isprint(*next) == 0) + { + *next = '\0'; + } + + next++; + } + + #ifdef TEST + *logofs << "Loop: Read options '" << options << "' from file '" + << fileName << "'.\n" << logofs_flush; + #endif + + if (ParseEnvironmentOptions(options, 1) < 0) + { + delete [] fileName; + + return -1; + } + + delete [] fileName; + + return 1; +} + +// +// Parse the option string passed from the +// remote proxy at startup. +// + +int ParseRemoteOptions(char *opts) +{ + #ifdef TEST + *logofs << "Loop: Going to parse the remote options " + << "string '" << opts << "'.\n" + << logofs_flush; + #endif + + char *name; + char *value; + + // + // The options string is intended to be a series + // of name/value tuples in the form name=value + // separated by the ',' character. + // + + int hasCookie = 0; + int hasLink = 0; + int hasPack = 0; + int hasCache = 0; + int hasImages = 0; + int hasDelta = 0; + int hasStream = 0; + int hasData = 0; + int hasType = 0; + + // + // Get rid of the terminating space. + // + + if (*(opts + strlen(opts) - 1) == ' ') + { + *(opts + strlen(opts) - 1) = '\0'; + } + + name = strtok(opts, "="); + + while (name) + { + value = strtok(NULL, ","); + + if (CheckArg("remote", name, value) < 0) + { + return -1; + } + + if (strcasecmp(name, "cookie") == 0) + { + if (WE_PROVIDE_CREDENTIALS) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring remote option 'cookie' " + << "with value '" << value << "' when initiating " + << "connection.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Ignoring remote option 'cookie' " + << "with value '" << value << "' when initiating " + << "connection.\n"; + } + else if (strncasecmp(authCookie, value, strlen(authCookie)) != 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Authentication cookie '" << value + << "' doesn't match '" << authCookie << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Authentication cookie '" << value + << "' doesn't match '" << authCookie << "'.\n"; + + return -1; + } + + hasCookie = 1; + } + else if (strcasecmp(name, "link") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + if (*linkSpeedName != '\0' && strcasecmp(linkSpeedName, value) != 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Overriding option 'link' " + << "with new value '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Overriding option 'link' " + << "with new value '" << value << "'.\n"; + } + + if (ParseLinkOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify remote 'link' " + << "option in string '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify remote 'link' " + << "option in string '" << value << "'.\n"; + + return -1; + } + } + + hasLink = 1; + } + else if (strcasecmp(name, "pack") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + if (*packMethodName != '\0' && strcasecmp(packMethodName, value) != 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Overriding option 'pack' " + << "with remote value '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Overriding option 'pack' " + << "with remote value '" << value << "'.\n"; + } + + if (ParsePackOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid pack option '" + << value << "' requested by remote.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid pack option '" + << value << "' requested by remote.\n"; + + return -1; + } + } + + hasPack = 1; + } + else if (strcasecmp(name, "cache") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + // + // Cache size is sent as a hint of how much memory + // the remote proxy is going to consume. A very low + // powered thin client could choose to refuse the + // connection. + // + + if (ParseCacheOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify remote 'cache' " + << "option in string '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify remote 'cache' " + << "option in string '" << value << "'.\n"; + + return -1; + } + } + + hasCache = 1; + } + else if (strcasecmp(name, "images") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + // + // Images cache size is sent as a hint. + // There is no obbligation for the local + // proxy to use the persistent cache. + // + + if (ParseImagesOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify remote 'images' " + << "option in string '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify remote 'images' " + << "option in string '" << value << "'.\n"; + + return -1; + } + } + + hasImages = 1; + } + else if (strcasecmp(name, "limit") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + if (*bitrateLimitName != '\0' && + strcasecmp(bitrateLimitName, value) != 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Overriding option 'limit' " + << "with new value '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Overriding option 'limit' " + << "with new value '" << value << "'.\n"; + } + + if (ParseBitrateOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify 'limit' " + << "option in string '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify 'limit' " + << "option in string '" << value << "'.\n"; + + return -1; + } + } + + } + else if (strcasecmp(name, "render") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + useRender = ValidateArg("remote", name, value); + } + + } + else if (strcasecmp(name, "taint") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + useTaint = ValidateArg("remote", name, value); + } + + } + else if (strcasecmp(name, "type") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + if (strcasecmp(value, "default") == 0) + { + *sessionType = '\0'; + } + else + { + strncpy(sessionType, value, DEFAULT_STRING_LENGTH - 1); + } + } + + hasType = 1; + } + else if (strcasecmp(name, "strict") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + useStrict = ValidateArg("remote", name, value); + } + + } + else if (strcasecmp(name, "shseg") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else if (ParseShmemOption(value) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't identify size of shared memory " + << "segment in string '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify size of shared memory " + << "segment in string '" << value << "'.\n"; + + return -1; + } + + } + else if (strcasecmp(name, "delta") == 0) + { + if (control -> ProxyMode == proxy_client) + { + PrintOptionIgnored("remote", name, value); + } + else + { + control -> RemoteDeltaCompression = ValidateArg("remote", name, value); + + // + // Follow for delta compression the + // same settings as the client proxy. + // + + control -> LocalDeltaCompression = control -> RemoteDeltaCompression; + } + + hasDelta = 1; + } + else if (strcasecmp(name, "stream") == 0) + { + // + // If remote side didn't choose its own + // stream compression level then assume + // local settings. + // + + if (strcasecmp(value, "default") == 0) + { + // + // This applies only at client side. + // + + control -> RemoteStreamCompression = + control -> LocalStreamCompression; + + control -> RemoteStreamCompressionLevel = + control -> LocalStreamCompressionLevel; + } + else + { + control -> RemoteStreamCompressionLevel = ValidateArg("remote", name, value); + + if (control -> RemoteStreamCompressionLevel > 0) + { + control -> RemoteStreamCompression = 1; + } + else + { + control -> RemoteStreamCompression = 0; + } + + if (control -> LocalStreamCompressionLevel < 0) + { + control -> LocalStreamCompressionLevel = ValidateArg("remote", name, value); + + if (control -> LocalStreamCompressionLevel > 0) + { + control -> LocalStreamCompression = 1; + } + else + { + control -> LocalStreamCompression = 0; + } + } + } + + hasStream = 1; + } + else if (strcasecmp(name, "data") == 0) + { + // + // Apply the same to data compression level. + // + + if (strcasecmp(value, "default") == 0) + { + control -> RemoteDataCompression = + control -> LocalDataCompression; + + control -> RemoteDataCompressionLevel = + control -> LocalDataCompressionLevel; + } + else + { + control -> RemoteDataCompressionLevel = ValidateArg("remote", name, value); + + if (control -> RemoteDataCompressionLevel > 0) + { + control -> RemoteDataCompression = 1; + } + else + { + control -> RemoteDataCompression = 0; + } + + if (control -> LocalDataCompressionLevel < 0) + { + control -> LocalDataCompressionLevel = ValidateArg("remote", name, value); + + if (control -> LocalDataCompressionLevel > 0) + { + control -> LocalDataCompression = 1; + } + else + { + control -> LocalDataCompression = 0; + } + } + } + + hasData = 1; + } + else if (strcasecmp(name, "flush") == 0) + { + // + // This option has no effect in recent + // versions. + // + + #ifdef DEBUG + *logofs << "Loop: Ignoring obsolete remote option '" + << name << "' with value '" << value + << "'.\n" << logofs_flush; + #endif + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring unknown remote option '" + << name << "' with value '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Ignoring unknown remote option '" + << name << "' with value '" << value << "'.\n"; + } + + name = strtok(NULL, "="); + + } // End of while (name) ... + + // + // If we are client side, we need remote 'stream' + // and 'data' options. If we are server, we need + // all the above plus 'link' and some others. + // + + char missing[DEFAULT_STRING_LENGTH]; + + *missing = '\0'; + + if (control -> ProxyMode == proxy_client) + { + if (hasStream == 0) + { + strcpy(missing, "stream"); + } + else if (hasData == 0) + { + strcpy(missing, "data"); + } + } + else + { + // + // Don't complain if the optional 'flush', + // 'render' and 'taint' options are not + // provided. + // + + if (hasLink == 0) + { + strcpy(missing, "link"); + } + else if (hasCache == 0) + { + strcpy(missing, "cache"); + } + else if (hasPack == 0) + { + strcpy(missing, "pack"); + } + else if (hasDelta == 0) + { + strcpy(missing, "delta"); + } + else if (hasStream == 0) + { + strcpy(missing, "stream"); + } + else if (hasData == 0) + { + strcpy(missing, "data"); + } + else if (hasType == 0) + { + strcpy(missing, "type"); + } + else if (hasImages == 0) + { + strcpy(missing, "images"); + } + } + + if (WE_PROVIDE_CREDENTIALS == 0) + { + // + // Can be that user doesn't have requested to + // check the authorization cookie provided by + // the connecting peer. + // + + if (hasCookie == 0 && *authCookie != '\0') + { + strcpy(missing, "cookie"); + } + } + + if (*missing != '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! The remote peer didn't specify the option '" + << missing << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": The remote peer didn't specify the option '" + << missing << "'.\n"; + + return -1; + } + + return 1; +} + +// +// Parse the cookie provided by the NX proxy +// connection forwarder. +// + +int ParseForwarderOptions(char *opts) +{ + #ifdef TEST + *logofs << "Loop: Going to parse the forwarder options " + << "string '" << opts << "'.\n" + << logofs_flush; + #endif + + char *name; + char *value; + + int hasCookie = 0; + + // + // Get rid of the terminating space. + // + + if (*(opts + strlen(opts) - 1) == ' ') + { + *(opts + strlen(opts) - 1) = '\0'; + } + + name = strtok(opts, "="); + + while (name) + { + value = strtok(NULL, ","); + + if (CheckArg("forwarder", name, value) < 0) + { + return -1; + } + + if (strcasecmp(name, "cookie") == 0) + { + if (strncasecmp(authCookie, value, strlen(authCookie)) != 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! The NX forwarder cookie '" << value + << "' doesn't match '" << authCookie << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": The NX forwarder cookie '" << value + << "' doesn't match '" << authCookie << "'.\n"; + + return -1; + } + + hasCookie = 1; + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring unknown forwarder option '" + << name << "' with value '" << value << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Ignoring unknown forwarder option '" + << name << "' with value '" << value << "'.\n"; + } + + name = strtok(NULL, "="); + + } // End of while (name) ... + + if (hasCookie == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! The NX forwarder didn't provide " + << "the authentication cookie.\n" << logofs_flush; + #endif + + cerr << "Error" << ": The NX forwarder didn't provide " + << "the authentication cookie.\n"; + + return -1; + } + + return 1; +} + +int SetCore() +{ + #ifdef COREDUMPS + + rlimit rlim; + + if (getrlimit(RLIMIT_CORE, &rlim)) + { + #ifdef TEST + *logofs << "Loop: Cannot read RLIMIT_CORE. Error is '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + return -1; + } + + if (rlim.rlim_cur < rlim.rlim_max) + { + rlim.rlim_cur = rlim.rlim_max; + + if (setrlimit(RLIMIT_CORE, &rlim)) + { + #ifdef TEST + *logofs << "Loop: Cannot set RLIMIT_CORE. Error is '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + return -2; + } + } + + #ifdef TEST + *logofs << "Loop: RLIMIT_CORE is "<< rlim.rlim_max + << ".\n" << logofs_flush; + #endif + + #endif // #ifdef COREDUMPS + + return 1; +} + +char *GetLastCache(char *listBuffer, const char *searchPath) +{ + if (listBuffer == NULL || searchPath == NULL || + strncmp(listBuffer, "cachelist=", strlen("cachelist=")) != 0) + { + #ifdef TEST + *logofs << "Loop: Invalid parameters '" << listBuffer << "' and '" + << (searchPath != NULL ? searchPath : "") + << "'. Can't select any cache.\n" << logofs_flush; + #endif + + return NULL; + } + + char *selectedName = new char[MD5_LENGTH * 2 + 3]; + + *selectedName = '\0'; + + const char *localPrefix; + const char *remotePrefix; + + if (control -> ProxyMode == proxy_client) + { + localPrefix = "C-"; + remotePrefix = "S-"; + } + else + { + localPrefix = "S-"; + remotePrefix = "C-"; + } + + // + // Get rid of prefix. + // + + listBuffer += strlen("cachelist="); + + char *fileName; + + fileName = strtok(listBuffer, ","); + + // + // It is "/path/to/file" + "/" + "C-" + 32 + "\0". + // + + char fullPath[strlen(searchPath) + MD5_LENGTH * 2 + 4]; + + time_t selectedTime = 0; + + struct stat fileStat; + + while (fileName) + { + if (strncmp(fileName, "none", strlen("none")) == 0) + { + #ifdef TEST + *logofs << "Loop: No cache files seem to be available.\n" + << logofs_flush; + #endif + + delete [] selectedName; + + return NULL; + } + else if (strlen(fileName) != MD5_LENGTH * 2 + 2 || + strncmp(fileName, remotePrefix, 2) != 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Bad cache file name '" + << fileName << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Bad cache file name '" + << fileName << "'.\n"; + + delete [] selectedName; + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "Loop: Parsing remote cache name '" + << fileName << "'.\n" << logofs_flush; + #endif + + // + // Prefix, received as "S-", becomes + // "C-" and viceversa. + // + + *fileName = *localPrefix; + + strcpy(fullPath, searchPath); + strcat(fullPath, "/"); + strcat(fullPath, fileName); + + if (stat(fullPath, &fileStat) == 0) + { + #ifdef TEST + *logofs << "Loop: Found a matching cache '" + << fullPath << "'.\n" << logofs_flush; + #endif + + if (fileStat.st_mtime >= selectedTime) + { + strcpy(selectedName, fileName); + + selectedTime = fileStat.st_mtime; + } + } + #ifdef TEST + else + { + *logofs << "Loop: Can't get stats of file '" + << fullPath << "'.\n" << logofs_flush; + } + #endif + + fileName = strtok(NULL, ","); + } + + if (*selectedName != '\0') + { + return selectedName; + } + else + { + delete [] selectedName; + + return NULL; + } +} + +char *GetTempPath() +{ + if (*tempDir == '\0') + { + // + // Check the NX_TEMP environment, first, + // then the TEMP variable. + // + + const char *tempEnv = getenv("NX_TEMP"); + + if (tempEnv == NULL || *tempEnv == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No environment for NX_TEMP.\n" + << logofs_flush; + #endif + + tempEnv = getenv("TEMP"); + + if (tempEnv == NULL || *tempEnv == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No environment for TEMP.\n" + << logofs_flush; + #endif + + tempEnv = "/tmp"; + } + } + + if (strlen(tempEnv) > DEFAULT_STRING_LENGTH - 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value for the NX " + << "temporary directory '" << tempEnv + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value for the NX " + << "temporary directory '" << tempEnv + << "'.\n"; + + HandleCleanup(); + } + + strcpy(tempDir, tempEnv); + + #ifdef TEST + *logofs << "Loop: Assuming temporary NX directory '" + << tempDir << "'.\n" << logofs_flush; + #endif + } + + char *tempPath = new char[strlen(tempDir) + 1]; + + if (tempPath == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't allocate memory " + << "for the temp path.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the temp path.\n"; + + HandleCleanup(); + } + + strcpy(tempPath, tempDir); + + return tempPath; +} + +char *GetClientPath() +{ + if (*clientDir == '\0') + { + // + // Check the NX_CLIENT environment. + // + + const char *clientEnv = getenv("NX_CLIENT"); + + if (clientEnv == NULL || *clientEnv == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No environment for NX_CLIENT.\n" + << logofs_flush; + #endif + + // + // Try to guess the location of the client. + // + + clientEnv = "/usr/NX/bin/nxclient"; + + #ifdef __APPLE__ + + clientEnv = "/Applications/NX Client for OSX.app/Contents/MacOS/nxclient"; + + #endif + + #ifdef __CYGWIN32__ + + clientEnv = "C:\\Program Files\\NX Client for Windows\\nxclient"; + + #endif + } + + if (strlen(clientEnv) > DEFAULT_STRING_LENGTH - 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value for the NX " + << "client directory '" << clientEnv + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value for the NX " + << "client directory '" << clientEnv + << "'.\n"; + + HandleCleanup(); + } + + strcpy(clientDir, clientEnv); + + #ifdef TEST + *logofs << "Loop: Assuming NX client location '" + << clientDir << "'.\n" << logofs_flush; + #endif + } + + char *clientPath = new char[strlen(clientDir) + 1]; + + if (clientPath == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't allocate memory " + << "for the client path.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the client path.\n"; + + HandleCleanup(); + } + + strcpy(clientPath, clientDir); + + return clientPath; +} + +char *GetSystemPath() +{ + if (*systemDir == '\0') + { + // + // Check the NX_SYSTEM environment. + // + + const char *systemEnv = getenv("NX_SYSTEM"); + + if (systemEnv == NULL || *systemEnv == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No environment for NX_SYSTEM.\n" + << logofs_flush; + #endif + + systemEnv = "/usr/NX"; + } + + if (strlen(systemEnv) > DEFAULT_STRING_LENGTH - 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value for the NX " + << "system directory '" << systemEnv + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value for the NX " + << "system directory '" << systemEnv + << "'.\n"; + + HandleCleanup(); + } + + strcpy(systemDir, systemEnv); + + #ifdef TEST + *logofs << "Loop: Assuming system NX directory '" + << systemDir << "'.\n" << logofs_flush; + #endif + } + + char *systemPath = new char[strlen(systemDir) + 1]; + + if (systemPath == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't allocate memory " + << "for the system path.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the system path.\n"; + + HandleCleanup(); + } + + strcpy(systemPath, systemDir); + + return systemPath; +} + +char *GetHomePath() +{ + if (*homeDir == '\0') + { + // + // Check the NX_HOME environment. + // + + const char *homeEnv = getenv("NX_HOME"); + + if (homeEnv == NULL || *homeEnv == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No environment for NX_HOME.\n" + << logofs_flush; + #endif + + homeEnv = getenv("HOME"); + + if (homeEnv == NULL || *homeEnv == '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! No environment for HOME.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No environment for HOME.\n"; + + HandleCleanup(); + } + } + + if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value for the NX " + << "home directory '" << homeEnv + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value for the NX " + << "home directory '" << homeEnv + << "'.\n"; + + HandleCleanup(); + } + + strcpy(homeDir, homeEnv); + + #ifdef TEST + *logofs << "Loop: Assuming NX user's home directory '" + << homeDir << "'.\n" << logofs_flush; + #endif + } + + char *homePath = new char[strlen(homeDir) + 1]; + + if (homePath == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't allocate memory " + << "for the home path.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the home path.\n"; + + HandleCleanup(); + } + + strcpy(homePath, homeDir); + + return homePath; +} + +char *GetRootPath() +{ + if (*rootDir == '\0') + { + // + // Check the NX_ROOT environment. + // + + const char *rootEnv = getenv("NX_ROOT"); + + if (rootEnv == NULL || *rootEnv == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No environment for NX_ROOT.\n" + << logofs_flush; + #endif + + // + // We will determine the root NX directory + // based on the NX_HOME or HOME directory + // settings. + // + + const char *homeEnv = GetHomePath(); + + if (strlen(homeEnv) > DEFAULT_STRING_LENGTH - + strlen("/.nx") - 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value for the NX " + << "home directory '" << homeEnv + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value for the NX " + << "home directory '" << homeEnv + << "'.\n"; + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "Loop: Assuming NX root directory in " + << "the user's home '" << homeEnv + << "'.\n" << logofs_flush; + #endif + + strcpy(rootDir, homeEnv); + strcat(rootDir, "/.nx"); + + delete [] homeEnv; + + // + // Create the NX root directory. + // + + struct stat dirStat; + + if ((stat(rootDir, &dirStat) == -1) && (EGET() == ENOENT)) + { + if (mkdir(rootDir, 0700) < 0 && (EGET() != EEXIST)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't create directory '" + << rootDir << ". Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't create directory '" + << rootDir << ". Error is " << EGET() << " '" + << ESTR() << "'.\n"; + + HandleCleanup(); + } + } + } + else + { + if (strlen(rootEnv) > DEFAULT_STRING_LENGTH - 1) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value for the NX " + << "root directory '" << rootEnv + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value for the NX " + << "root directory '" << rootEnv + << "'.\n"; + + HandleCleanup(); + } + + strcpy(rootDir, rootEnv); + } + + #ifdef TEST + *logofs << "Loop: Assuming NX root directory '" + << rootDir << "'.\n" << logofs_flush; + #endif + } + + char *rootPath = new char[strlen(rootDir) + 1]; + + if (rootPath == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't allocate memory " + << "for the root path.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the root path.\n"; + + HandleCleanup(); + } + + strcpy(rootPath, rootDir); + + return rootPath; +} + +char *GetCachePath() +{ + char *rootPath = GetRootPath(); + + char *cachePath; + + if (*sessionType != '\0') + { + cachePath = new char[strlen(rootPath) + strlen("/cache-") + + strlen(sessionType) + 1]; + } + else + { + cachePath = new char[strlen(rootPath) + strlen("/cache") + 1]; + } + + strcpy(cachePath, rootPath); + + if (*sessionType != '\0') + { + strcat(cachePath, "/cache-"); + + strcat(cachePath, sessionType); + } + else + { + strcat(cachePath, "/cache"); + } + + // + // Create the cache directory if needed. + // + + struct stat dirStat; + + if ((stat(cachePath, &dirStat) == -1) && (EGET() == ENOENT)) + { + if (mkdir(cachePath, 0700) < 0 && (EGET() != EEXIST)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't create directory '" << cachePath + << ". Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create directory '" << cachePath + << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; + + delete [] rootPath; + delete [] cachePath; + + return NULL; + } + } + + delete [] rootPath; + + return cachePath; +} + +char *GetImagesPath() +{ + char *rootPath = GetRootPath(); + + char *imagesPath = new char[strlen(rootPath) + strlen("/images") + 1]; + + strcpy(imagesPath, rootPath); + + strcat(imagesPath, "/images"); + + // + // Create the cache directory if needed. + // + + struct stat dirStat; + + if ((stat(imagesPath, &dirStat) == -1) && (EGET() == ENOENT)) + { + if (mkdir(imagesPath, 0700) < 0 && (EGET() != EEXIST)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't create directory '" << imagesPath + << ". Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create directory '" << imagesPath + << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; + + delete [] rootPath; + delete [] imagesPath; + + return NULL; + } + } + + // + // Create 16 directories in the path to + // hold the images whose name begins with + // the corresponding hexadecimal digit. + // + + char *digitPath = new char[strlen(imagesPath) + 5]; + + strcpy(digitPath, imagesPath); + + // + // Image paths have format "[path][/I-c][\0]", + // where c is the first digit of the checksum. + // + + for (char digit = 0; digit < 16; digit++) + { + sprintf(digitPath + strlen(imagesPath), "/I-%01X", digit); + + if ((stat(digitPath, &dirStat) == -1) && (EGET() == ENOENT)) + { + if (mkdir(digitPath, 0700) < 0 && (EGET() != EEXIST)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't create directory '" << digitPath + << ". Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create directory '" << digitPath + << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; + + delete [] rootPath; + delete [] imagesPath; + delete [] digitPath; + + return NULL; + } + } + } + + delete [] rootPath; + delete [] digitPath; + + return imagesPath; +} + +char *GetSessionPath() +{ + if (*sessionDir == '\0') + { + char *rootPath = GetRootPath(); + + strcpy(sessionDir, rootPath); + + if (control -> ProxyMode == proxy_client) + { + strcat(sessionDir, "/C-"); + } + else + { + strcat(sessionDir, "/S-"); + } + + if (*sessionId == '\0') + { + char port[DEFAULT_STRING_LENGTH]; + + sprintf(port, "%d", proxyPort); + + strcpy(sessionId, port); + } + + strcat(sessionDir, sessionId); + + struct stat dirStat; + + if ((stat(sessionDir, &dirStat) == -1) && (EGET() == ENOENT)) + { + if (mkdir(sessionDir, 0700) < 0 && (EGET() != EEXIST)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't create directory '" << sessionDir + << ". Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create directory '" << sessionDir + << ". Error is " << EGET() << " '" << ESTR() << "'.\n"; + + delete [] rootPath; + + return NULL; + } + } + + #ifdef TEST + *logofs << "Loop: Root of NX session is '" << sessionDir + << "'.\n" << logofs_flush; + #endif + + delete [] rootPath; + } + + char *sessionPath = new char[strlen(sessionDir) + 1]; + + strcpy(sessionPath, sessionDir); + + return sessionPath; +} + +// +// Identify requested link characteristics +// and set control parameters accordingly. +// + +int ParseLinkOption(const char *opt) +{ + // + // Normalize the user input. + // + + if (strcasecmp(opt, "modem") == 0 || + strcasecmp(opt, "33k") == 0 || + strcasecmp(opt, "56k") == 0) + { + strcpy(linkSpeedName, "MODEM"); + } + else if (strcasecmp(opt, "isdn") == 0 || + strcasecmp(opt, "64k") == 0 || + strcasecmp(opt, "128k") == 0) + { + strcpy(linkSpeedName, "ISDN"); + } + else if (strcasecmp(opt, "adsl") == 0 || + strcasecmp(opt, "256k") == 0 || + strcasecmp(opt, "640k") == 0) + { + strcpy(linkSpeedName, "ADSL"); + } + else if (strcasecmp(opt, "wan") == 0 || + strcasecmp(opt, "1m") == 0 || + strcasecmp(opt, "2m") == 0 || + strcasecmp(opt, "34m") == 0) + { + strcpy(linkSpeedName, "WAN"); + } + else if (strcasecmp(opt, "lan") == 0 || + strcasecmp(opt, "10m") == 0 || + strcasecmp(opt, "100m") == 0 || + strcasecmp(opt, "local") == 0) + { + strcpy(linkSpeedName, "LAN"); + } + + if (strcasecmp(linkSpeedName, "modem") != 0 && + strcasecmp(linkSpeedName, "isdn") != 0 && + strcasecmp(linkSpeedName, "adsl") != 0 && + strcasecmp(linkSpeedName, "wan") != 0 && + strcasecmp(linkSpeedName, "lan") != 0) + { + return -1; + } + + return 1; +} + +int ParsePackOption(const char *opt) +{ + #ifdef DEBUG + *logofs << "Loop: Pack method is " << packMethod + << " quality is " << packQuality << ".\n" + << logofs_flush; + #endif + + #ifdef DEBUG + *logofs << "Loop: Parsing pack method '" << opt + << "'.\n" << logofs_flush; + #endif + + if (strcasecmp(opt, "0") == 0 || + strcasecmp(opt, "none") == 0 || + strcasecmp(opt, "nopack") == 0 || + strcasecmp(opt, "no-pack") == 0) + { + packMethod = PACK_NONE; + } + else if (strcasecmp(opt, "8") == 0) + { + packMethod = PACK_MASKED_8_COLORS; + } + else if (strcasecmp(opt, "64") == 0) + { + packMethod = PACK_MASKED_64_COLORS; + } + else if (strcasecmp(opt, "256") == 0) + { + packMethod = PACK_MASKED_256_COLORS; + } + else if (strcasecmp(opt, "512") == 0) + { + packMethod = PACK_MASKED_512_COLORS; + } + else if (strcasecmp(opt, "4k") == 0) + { + packMethod = PACK_MASKED_4K_COLORS; + } + else if (strcasecmp(opt, "32k") == 0) + { + packMethod = PACK_MASKED_32K_COLORS; + } + else if (strcasecmp(opt, "64k") == 0) + { + packMethod = PACK_MASKED_64K_COLORS; + } + else if (strcasecmp(opt, "256k") == 0) + { + packMethod = PACK_MASKED_256K_COLORS; + } + else if (strcasecmp(opt, "2m") == 0) + { + packMethod = PACK_MASKED_2M_COLORS; + } + else if (strcasecmp(opt, "16m") == 0) + { + packMethod = PACK_MASKED_16M_COLORS; + } + else if (strncasecmp(opt, "8-jpeg", strlen("8-jpeg")) == 0) + { + packMethod = PACK_JPEG_8_COLORS; + } + else if (strncasecmp(opt, "64-jpeg", strlen("64-jpeg")) == 0) + { + packMethod = PACK_JPEG_64_COLORS; + } + else if (strncasecmp(opt, "256-jpeg", strlen("256-jpeg")) == 0) + { + packMethod = PACK_JPEG_256_COLORS; + } + else if (strncasecmp(opt, "512-jpeg", strlen("512-jpeg")) == 0) + { + packMethod = PACK_JPEG_512_COLORS; + } + else if (strncasecmp(opt, "4k-jpeg", strlen("4k-jpeg")) == 0) + { + packMethod = PACK_JPEG_4K_COLORS; + } + else if (strncasecmp(opt, "32k-jpeg", strlen("32k-jpeg")) == 0) + { + packMethod = PACK_JPEG_32K_COLORS; + } + else if (strncasecmp(opt, "64k-jpeg", strlen("64k-jpeg")) == 0) + { + packMethod = PACK_JPEG_64K_COLORS; + } + else if (strncasecmp(opt, "256k-jpeg", strlen("256k-jpeg")) == 0) + { + packMethod = PACK_JPEG_256K_COLORS; + } + else if (strncasecmp(opt, "2m-jpeg", strlen("2m-jpeg")) == 0) + { + packMethod = PACK_JPEG_2M_COLORS; + } + else if (strncasecmp(opt, "16m-jpeg", strlen("16m-jpeg")) == 0) + { + packMethod = PACK_JPEG_16M_COLORS; + } + else if (strncasecmp(opt, "8-png", strlen("8-png")) == 0) + { + packMethod = PACK_PNG_8_COLORS; + } + else if (strncasecmp(opt, "64-png", strlen("64-png")) == 0) + { + packMethod = PACK_PNG_64_COLORS; + } + else if (strncasecmp(opt, "256-png", strlen("256-png")) == 0) + { + packMethod = PACK_PNG_256_COLORS; + } + else if (strncasecmp(opt, "512-png", strlen("512-png")) == 0) + { + packMethod = PACK_PNG_512_COLORS; + } + else if (strncasecmp(opt, "4k-png", strlen("4k-png")) == 0) + { + packMethod = PACK_PNG_4K_COLORS; + } + else if (strncasecmp(opt, "32k-png", strlen("32k-png")) == 0) + { + packMethod = PACK_PNG_32K_COLORS; + } + else if (strncasecmp(opt, "64k-png", strlen("64k-png")) == 0) + { + packMethod = PACK_PNG_64K_COLORS; + } + else if (strncasecmp(opt, "256k-png", strlen("256k-png")) == 0) + { + packMethod = PACK_PNG_256K_COLORS; + } + else if (strncasecmp(opt, "2m-png", strlen("2m-png")) == 0) + { + packMethod = PACK_PNG_2M_COLORS; + } + else if (strncasecmp(opt, "16m-png", strlen("16m-png")) == 0) + { + packMethod = PACK_PNG_16M_COLORS; + } + else if (strncasecmp(opt, "16m-rgb", strlen("16m-rgb")) == 0 || + strncasecmp(opt, "rgb", strlen("rgb")) == 0) + { + packMethod = PACK_RGB_16M_COLORS; + } + else if (strncasecmp(opt, "16m-rle", strlen("16m-rle")) == 0 || + strncasecmp(opt, "rle", strlen("rle")) == 0) + { + packMethod = PACK_RLE_16M_COLORS; + } + else if (strncasecmp(opt, "16m-bitmap", strlen("16m-bitmap")) == 0 || + strncasecmp(opt, "bitmap", strlen("bitmap")) == 0) + { + packMethod = PACK_BITMAP_16M_COLORS; + } + else if (strncasecmp(opt, "lossy", strlen("lossy")) == 0) + { + packMethod = PACK_LOSSY; + } + else if (strncasecmp(opt, "lossless", strlen("lossless")) == 0) + { + packMethod = PACK_LOSSLESS; + } + else if (strncasecmp(opt, "adaptive", strlen("adaptive")) == 0) + { + packMethod = PACK_ADAPTIVE; + } + else + { + return -1; + } + + if (packMethod == PACK_NONE) + { + strcpy(packMethodName, "none"); + } + else + { + strcpy(packMethodName, opt); + } + + if (packMethod == PACK_RGB_16M_COLORS || + packMethod == PACK_RLE_16M_COLORS || + packMethod == PACK_BITMAP_16M_COLORS || + (packMethod >= PACK_JPEG_8_COLORS && + packMethod <= PACK_JPEG_16M_COLORS) || + (packMethod >= PACK_PNG_8_COLORS && + packMethod <= PACK_PNG_16M_COLORS) || + packMethod == PACK_LOSSY || + packMethod == PACK_LOSSLESS || + packMethod == PACK_ADAPTIVE) + { + const char *dash = strrchr(opt, '-'); + + if (dash != NULL && strlen(dash) == 2 && + *(dash + 1) >= '0' && *(dash + 1) <= '9') + { + packQuality = atoi(dash + 1); + + #ifdef DEBUG + *logofs << "Loop: Using pack quality '" + << packQuality << "'.\n" << logofs_flush; + #endif + } + } + else + { + packQuality = 0; + } + + return 1; +} + +int ParsePackMethod(const int method, const int quality) +{ + switch (method) + { + case PACK_NONE: + { + strcpy(packMethodName, "none"); + + break; + } + case PACK_MASKED_8_COLORS: + { + strcpy(packMethodName, "8"); + + break; + } + case PACK_MASKED_64_COLORS: + { + strcpy(packMethodName, "64"); + + break; + } + case PACK_MASKED_256_COLORS: + { + strcpy(packMethodName, "256"); + + break; + } + case PACK_MASKED_512_COLORS: + { + strcpy(packMethodName, "512"); + + break; + } + case PACK_MASKED_4K_COLORS: + { + strcpy(packMethodName, "4k"); + + break; + } + case PACK_MASKED_32K_COLORS: + { + strcpy(packMethodName, "32k"); + + break; + } + case PACK_MASKED_64K_COLORS: + { + strcpy(packMethodName, "64k"); + + break; + } + case PACK_MASKED_256K_COLORS: + { + strcpy(packMethodName, "256k"); + + break; + } + case PACK_MASKED_2M_COLORS: + { + strcpy(packMethodName, "2m"); + + break; + } + case PACK_MASKED_16M_COLORS: + { + strcpy(packMethodName, "16m"); + + break; + } + case PACK_JPEG_8_COLORS: + { + strcpy(packMethodName, "8-jpeg"); + + break; + } + case PACK_JPEG_64_COLORS: + { + strcpy(packMethodName, "64-jpeg"); + + break; + } + case PACK_JPEG_256_COLORS: + { + strcpy(packMethodName, "256-jpeg"); + + break; + } + case PACK_JPEG_512_COLORS: + { + strcpy(packMethodName, "512-jpeg"); + + break; + } + case PACK_JPEG_4K_COLORS: + { + strcpy(packMethodName, "4k-jpeg"); + + break; + } + case PACK_JPEG_32K_COLORS: + { + strcpy(packMethodName, "32k-jpeg"); + + break; + } + case PACK_JPEG_64K_COLORS: + { + strcpy(packMethodName, "64k-jpeg"); + + break; + } + case PACK_JPEG_256K_COLORS: + { + strcpy(packMethodName, "256k-jpeg"); + + break; + } + case PACK_JPEG_2M_COLORS: + { + strcpy(packMethodName, "2m-jpeg"); + + break; + } + case PACK_JPEG_16M_COLORS: + { + strcpy(packMethodName, "16m-jpeg"); + + break; + } + case PACK_PNG_8_COLORS: + { + strcpy(packMethodName, "8-png"); + + break; + } + case PACK_PNG_64_COLORS: + { + strcpy(packMethodName, "64-png"); + + break; + } + case PACK_PNG_256_COLORS: + { + strcpy(packMethodName, "256-png"); + + break; + } + case PACK_PNG_512_COLORS: + { + strcpy(packMethodName, "512-png"); + + break; + } + case PACK_PNG_4K_COLORS: + { + strcpy(packMethodName, "4k-png"); + + break; + } + case PACK_PNG_32K_COLORS: + { + strcpy(packMethodName, "32k-png"); + + break; + } + case PACK_PNG_64K_COLORS: + { + strcpy(packMethodName, "64k-png"); + + break; + } + case PACK_PNG_256K_COLORS: + { + strcpy(packMethodName, "256k-png"); + + break; + } + case PACK_PNG_2M_COLORS: + { + strcpy(packMethodName, "2m-png"); + + break; + } + case PACK_PNG_16M_COLORS: + { + strcpy(packMethodName, "16m-png"); + + break; + } + case PACK_RGB_16M_COLORS: + { + strcpy(packMethodName, "16m-rgb"); + + break; + } + case PACK_RLE_16M_COLORS: + { + strcpy(packMethodName, "16m-rle"); + + break; + } + case PACK_BITMAP_16M_COLORS: + { + strcpy(packMethodName, "16m-bitmap"); + + break; + } + case PACK_LOSSY: + { + strcpy(packMethodName, "lossy"); + + break; + } + case PACK_LOSSLESS: + { + strcpy(packMethodName, "lossless"); + + break; + } + case PACK_ADAPTIVE: + { + strcpy(packMethodName, "adaptive"); + + break; + } + default: + { + return -1; + } + } + + if (quality < 0 || quality > 9) + { + return -1; + } + + if (packMethod == PACK_RGB_16M_COLORS || + packMethod == PACK_RLE_16M_COLORS || + packMethod == PACK_BITMAP_16M_COLORS || + (packMethod >= PACK_JPEG_8_COLORS && + packMethod <= PACK_JPEG_16M_COLORS) || + (packMethod >= PACK_PNG_8_COLORS && + packMethod <= PACK_PNG_16M_COLORS) || + packMethod == PACK_LOSSY || + packMethod == PACK_LOSSLESS || + packMethod == PACK_ADAPTIVE) + { + sprintf(packMethodName + strlen(packMethodName), + "-%d", quality); + } + + packMethod = method; + packQuality = quality; + + control -> PackMethod = packMethod; + control -> PackQuality = packQuality; + + return 1; +} + +int SetDirectories() +{ + // + // Determine the location of the user's NX + // directory and the other relevant paths. + // The functions below will check the pa- + // rameters passed to the program and will + // query the environment, if needed. + // + + control -> HomePath = GetHomePath(); + control -> RootPath = GetRootPath(); + control -> SystemPath = GetSystemPath(); + control -> TempPath = GetTempPath(); + control -> ClientPath = GetClientPath(); + + return 1; +} + +int SetLogs() +{ + // + // So far we used stderr (or stdout under + // WIN32). Now use the files selected by + // the user. + // + + if (*statsFileName == '\0') + { + strcpy(statsFileName, "stats"); + + #ifdef TEST + *logofs << "Loop: Assuming default statistics file '" + << statsFileName << "'.\n" << logofs_flush; + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Name selected for statistics is '" + << statsFileName << "'.\n" << logofs_flush; + } + #endif + + if (OpenLogFile(statsFileName, statofs) < 0) + { + HandleCleanup(); + } + + #ifndef MIXED + + if (*errorsFileName == '\0') + { + strcpy(errorsFileName, "errors"); + + #ifdef TEST + *logofs << "Loop: Assuming default log file name '" + << errorsFileName << "'.\n" << logofs_flush; + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Name selected for log file is '" + << errorsFileName << "'.\n" << logofs_flush; + } + #endif + + // + // Share the bebug output with the nxssh binder + // process. The file must be made writable by + // everybody because the nxssh process is run by + // nxserver as the nx user. + // + + #ifdef BINDER + + strcpy(errorsFileName, "/tmp/errors"); + + ostream *tmpfs = new ofstream(errorsFileName, ios::out); + + delete tmpfs; + + chmod(errorsFileName, S_IRUSR | S_IWUSR | S_IRGRP | + S_IWGRP | S_IROTH | S_IWOTH); + + #endif + + if (OpenLogFile(errorsFileName, logofs) < 0) + { + HandleCleanup(); + } + + // + // By default the session log is the standard error + // of the process. It is anyway required to set the + // option when running inside SSH, otherwise the + // output will go to the same file as the SSH log, + // depending where the NX client has redirected the + // output. + // + + if (*sessionFileName != '\0') + { + #ifdef TEST + *logofs << "Loop: Name selected for session file is '" + << sessionFileName << "'.\n" << logofs_flush; + #endif + + if (errofs != NULL) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Unexpected value for stream errofs.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Unexpected value for stream errofs.\n"; + } + + if (errsbuf != NULL) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Unexpected value for buffer errsbuf.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Unexpected value for buffer errsbuf.\n"; + } + + errofs = NULL; + errsbuf = NULL; + + if (OpenLogFile(sessionFileName, errofs) < 0) + { + HandleCleanup(); + } + + // + // Redirect the standard error to the file. + // + + errsbuf = cerr.rdbuf(errofs -> rdbuf()); + } + + #endif + + return 1; +} + +int SetPorts() +{ + // + // Depending on the proxy side, we need to determine on which + // port to listen for the given protocol or to which port we + // will have to forward the connection. Three possibilities + // are given for each supported protocol: + // + // Port <= 0: Disable port forwarding. + // Port == 1: Use the default port. + // Port > 1: Use the specified port. + // + // At the connectiong side the user should always explicitly + // set the ports where the connections will be forwarded. This + // is both for security reasons and because, when running both + // proxies on the same host, there is a concrete possibility + // that, by using the default ports, the connection will be + // forwarded to the same port where the peer proxy is listen- + // ing, causing a loop. + // + + useCupsSocket = 0; + if (cupsPort.enabled()) { + if (control -> ProxyMode == proxy_client) { + cupsPort.setDefaultTCPPort(DEFAULT_NX_CUPS_PORT_OFFSET + proxyPort); + useCupsSocket = 1; + } + else + cupsPort.setDefaultTCPPort(631); + } + +#ifdef TEST + *logofs << "Loop: cups port: " << cupsPort << "\n" + << logofs_flush; +#endif + + useAuxSocket = 0; + if (auxPort.enabled()) { + if (control -> ProxyMode == proxy_client) { + auxPort.setDefaultTCPPort(DEFAULT_NX_AUX_PORT_OFFSET + proxyPort); + useAuxSocket = 1; + } + else { + auxPort.setDefaultTCPPort(1); + + if (auxPort.getTCPPort() != 1) { + +#ifdef WARNING + *logofs << "Loop: WARNING! Overriding auxiliary X11 " + << "port with new value '" << 1 << "'.\n" + << logofs_flush; +#endif + + cerr << "Warning" << ": Overriding auxiliary X11 " + << "port with new value '" << 1 << "'.\n"; + + auxPort.setSpec("1"); + } + } + } + +#ifdef TEST + *logofs << "Loop: aux port: " << auxPort << "\n" + << logofs_flush; +#endif + + useSmbSocket = 0; + if (smbPort.enabled()) { + if (control -> ProxyMode == proxy_client) { + auxPort.setDefaultTCPPort(DEFAULT_NX_SMB_PORT_OFFSET + proxyPort); + useAuxSocket = 1; + } + else + auxPort.setDefaultTCPPort(139); + } + + +#ifdef TEST + *logofs << "Loop: smb port: " << smbPort << "\n" + << logofs_flush; +#endif + + useMediaSocket = 0; + if (mediaPort.enabled()) { + if (control -> ProxyMode == proxy_client) { + mediaPort.setDefaultTCPPort(DEFAULT_NX_MEDIA_PORT_OFFSET + proxyPort); + useMediaSocket = 1; + } + else if (mediaPort.getTCPPort() == 1) { +#ifdef PANIC + *logofs << "Loop: PANIC! No port specified for multimedia connections.\n" + << logofs_flush; +#endif + + cerr << "Error" << ": No port specified for multimedia connections.\n"; + + HandleCleanup(); + } + } + +#ifdef TEST + *logofs << "Loop: Using multimedia port '" << mediaPort + << "'.\n" << logofs_flush; +#endif + + useHttpSocket = 0; + if (httpPort.enabled()) { + if (control -> ProxyMode == proxy_client) { + httpPort.setDefaultTCPPort(DEFAULT_NX_HTTP_PORT_OFFSET + proxyPort); + useHttpSocket = 1; + } + else + httpPort.setDefaultTCPPort(80); + } + +#ifdef TEST + *logofs << "Loop: Using HTTP port '" << httpPort + << "'.\n" << logofs_flush; +#endif + + if (ParseFontPath(fontPort) <= 0) + { + #ifdef TEST + *logofs << "Loop: Disabling font server connections.\n" + << logofs_flush; + #endif + + *fontPort = '\0'; + + useFontSocket = 0; + } + else + { + // + // We don't know yet if the remote proxy supports + // the font server connections. If needed, we will + // disable the font server connections at later + // time. + // + + if (control -> ProxyMode == proxy_server) + { + useFontSocket = 1; + } + else + { + useFontSocket = 0; + } + + #ifdef TEST + *logofs << "Loop: Using font server port '" << fontPort + << "'.\n" << logofs_flush; + #endif + } + + useSlaveSocket = 0; + if (slavePort.enabled()) { + useSlaveSocket = 1; + if (control -> ProxyMode == proxy_client) + slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET + proxyPort); + else + slavePort.setDefaultTCPPort(DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET + proxyPort); + } + +#ifdef TEST + *logofs << "Loop: Using slave port '" << slavePort + << "'.\n" << logofs_flush; +#endif + + return 1; +} + +int SetDescriptors() +{ + unsigned int limit = 0; + + #ifdef RLIMIT_NOFILE + + rlimit limits; + + if (getrlimit(RLIMIT_NOFILE, &limits) == 0) + { + if (limits.rlim_max == RLIM_INFINITY) + { + limit = 0; + } + else + { + limit = (unsigned int) limits.rlim_max; + } + } + + #endif + + #ifdef _SC_OPEN_MAX + + if (limit == 0) + { + limit = sysconf(_SC_OPEN_MAX); + } + + #endif + + #ifdef FD_SETSIZE + + if (limit > FD_SETSIZE) + { + limit = FD_SETSIZE; + } + + #endif + + #ifdef RLIMIT_NOFILE + + if (limits.rlim_cur < limit) + { + limits.rlim_cur = limit; + + setrlimit(RLIMIT_NOFILE, &limits); + } + + #endif + + if (limit == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Cannot determine number of available " + << "file descriptors.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot determine number of available " + << "file descriptors.\n"; + + return -1; + } + + return 1; +} + +// +// Find the directory containing the caches +// matching the session type. +// + +int SetCaches() +{ + if ((control -> PersistentCachePath = GetCachePath()) == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error getting or creating the cache path.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error getting or creating the cache path.\n"; + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "Loop: Path of cache files is '" << control -> PersistentCachePath + << "'.\n" << logofs_flush; + #endif + + return 1; +} + +// +// Initialize all configuration parameters. +// + +int SetParameters() +{ + // + // Find out the type of session. + // + + SetSession(); + + // + // Initialize the network and compression + // parameters according to the settings + // suggested by the user. + // + + SetLink(); + + // + // Set compression according to link speed. + // + + SetCompression(); + + // + // Be sure that we have a literal for current + // cache size. Value will reflect control's + // default unless we already parsed a 'cache' + // option. Server side has no control on size + // of cache but is informed at session nego- + // tiation about how much memory is going to + // be used. + // + + SetStorage(); + + // + // Set size of shared memory segments. + // + + SetShmem(); + + // + // Make adjustments to cache based + // on the pack method. + // + + SetPack(); + + // + // Set disk-based image cache. + // + + SetImages(); + + // + // Set CPU and bandwidth limits. + // + + SetLimits(); + + return 1; +} + +// +// According to session literal determine +// the type of traffic that is going to be +// transported. Literals should be better +// standardized in future NX versions. +// + +int SetSession() +{ + if (strncmp(sessionType, "agent", strlen("agent")) == 0 || + strncmp(sessionType, "desktop", strlen("desktop")) == 0 || + strncmp(sessionType, "rootless", strlen("rootless")) == 0 || + strncmp(sessionType, "console", strlen("console")) == 0 || + strncmp(sessionType, "default", strlen("default")) == 0 || + strncmp(sessionType, "gnome", strlen("gnome")) == 0 || + strncmp(sessionType, "kde", strlen("kde")) == 0 || + strncmp(sessionType, "cde", strlen("cde")) == 0 || + strncmp(sessionType, "xdm", strlen("xdm")) == 0) + { + control -> SessionMode = session_agent; + } + else if (strncmp(sessionType, "win", strlen("win")) == 0 || + strncmp(sessionType, "vnc", strlen("vnc")) == 0) + { + control -> SessionMode = session_agent; + } + else if (strncmp(sessionType, "shadow", strlen("shadow")) == 0) + { + control -> SessionMode = session_shadow; + } + else if (strncmp(sessionType, "proxy", strlen("proxy")) == 0 || + strncmp(sessionType, "application", strlen("application")) == 0 || + strncmp(sessionType, "raw", strlen("raw")) == 0) + { + control -> SessionMode = session_proxy; + } + else + { + // + // If the session type is not passed or + // it is not among the recognized strings, + // we assume that the proxy is connected + // to the agent. + // + + // + // Since ProtoStep8 (#issue 108) and also + // with older "unix-" sessions + // + + if (*sessionType != '\0') + { + #ifdef WARNING + *logofs << "Loop: WARNING! Unrecognized session type '" + << sessionType << "'. Assuming agent session.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Unrecognized session type '" + << sessionType << "'. Assuming agent session.\n"; + } + + control -> SessionMode = session_agent; + } + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Assuming session type '" + << DumpSession(control -> SessionMode) << "' with " + << "string '" << sessionType << "'.\n" + << logofs_flush; + #endif + + // + // By default the policy is immediate. Agents + // will set a different policy, if they like. + // Anyway we need to check if the user has + // provided a custom flush policy. + // + + if (usePolicy != -1) + { + if (usePolicy > 0) + { + control -> FlushPolicy = policy_deferred; + } + else + { + control -> FlushPolicy = policy_immediate; + } + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: WARNING! Forcing flush policy to '" + << DumpPolicy(control -> FlushPolicy) + << ".\n" << logofs_flush; + #endif + } + else + { + control -> FlushPolicy = policy_immediate; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Setting initial flush policy to '" + << DumpPolicy(control -> FlushPolicy) + << "'.\n" << logofs_flush; + #endif + } + + // + // Check if the proxy library is run inside + // another program providing encryption, as + // it is the case of the SSH client. + // + + if (useEncryption != -1) + { + if (useEncryption > 0) + { + control -> LinkEncrypted = 1; + } + else + { + control -> LinkEncrypted = 0; + } + } + + if (control -> LinkEncrypted == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Proxy running as part of an " + << "encrypting client.\n" + << logofs_flush; + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Assuming proxy running as a " + << "standalone program.\n" + << logofs_flush; + #endif + } + + // + // Check if the system administrator has + // enabled the respawn of the client at + // the end of session. + // + + if (control -> ProxyMode == proxy_server) + { + struct stat fileStat; + + char fileName[DEFAULT_STRING_LENGTH]; + + snprintf(fileName, DEFAULT_STRING_LENGTH - 1, + "%s/share/noexit", control -> SystemPath); + + *(fileName + DEFAULT_STRING_LENGTH - 1) = '\0'; + + if (stat(fileName, &fileStat) == 0) + { + #ifdef TEST + *logofs << "Loop: Enabling respawn of client at session shutdown.\n" + << logofs_flush; + #endif + + control -> EnableRestartOnShutdown = 1; + } + } + + return 1; +} + +int SetStorage() +{ + // + // If differential compression is disabled + // we don't need a cache at all. + // + + if (control -> LocalDeltaCompression == 0) + { + control -> ClientTotalStorageSize = 0; + control -> ServerTotalStorageSize = 0; + } + + // + // Set a a cache size literal. + // + + int size = control -> getUpperStorageSize(); + + if (size / 1024 > 0) + { + sprintf(cacheSizeName, "%dk", size / 1024); + } + else + { + sprintf(cacheSizeName, "%d", size); + } + + if (control -> ProxyMode == proxy_client) + { + control -> LocalTotalStorageSize = + control -> ClientTotalStorageSize; + + control -> RemoteTotalStorageSize = + control -> ServerTotalStorageSize; + } + else + { + control -> LocalTotalStorageSize = + control -> ServerTotalStorageSize; + + control -> RemoteTotalStorageSize = + control -> ClientTotalStorageSize; + } + + #ifdef DEBUG + *logofs << "Loop: Storage size limit is " + << control -> ClientTotalStorageSize + << " at client and " + << control -> ServerTotalStorageSize + << " at server.\n" + << logofs_flush; + #endif + + #ifdef DEBUG + *logofs << "Loop: Storage local limit set to " + << control -> LocalTotalStorageSize + << " remote limit set to " + << control -> RemoteTotalStorageSize + << ".\n" << logofs_flush; + #endif + + // + // Never reserve for split store more than + // half the memory available for messages. + // + + if (size > 0 && control -> + SplitTotalStorageSize > size / 2) + { + #ifdef TEST + *logofs << "Loop: Reducing size of split store to " + << size / 2 << " bytes.\n" + << logofs_flush; + #endif + + control -> SplitTotalStorageSize = size / 2; + } + + // + // Don't load render from persistent + // cache if extension is hidden or + // not supported by agent. + // + + if (control -> HideRender == 1) + { + #ifdef TEST + *logofs << "Loop: Not loading render extension " + << "from persistent cache.\n" + << logofs_flush; + #endif + + control -> PersistentCacheLoadRender = 0; + } + + return 1; +} + +int SetShmem() +{ + // + // If not set, adjust the size of the shared + // memory segment according to size of the + // message cache. + // + + if (*shsegSizeName == '\0') + { + int size = control -> getUpperStorageSize(); + + const int mega = 1048576; + + if (size > 0) + { + if (size <= 1 * mega) + { + size = 0; + } + else if (size <= 2 * mega) + { + size = 524288; + } + else if (size < 4 * mega) + { + size = 1048576; + } + else + { + size = size / 4; + } + + if (size > 4194304) + { + size = 4194304; + } + + control -> ShmemClientSize = size; + control -> ShmemServerSize = size; + } + else + { + // + // The delta compression is disabled. + // Use a default segment size of 2 MB. + // + + control -> ShmemServerSize = 2 * mega; + } + } + + // + // Client side shared memory support is + // not useful and not implemented. + // + + if (control -> ShmemServerSize >= 524288) + { + control -> ShmemServer = 1; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Set initial shared memory size " + << "to " << control -> ShmemServerSize + << " bytes.\n" << logofs_flush; + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Disabled use of the shared memory " + << "extension.\n" << logofs_flush; + #endif + + control -> ShmemServer = 0; + } + + // For android, no shared memory available + control -> ShmemServer = 0; + control -> ShmemClientSize = 0; + + return 1; +} + +// +// Adjust the pack method according to the +// type of the session. +// + +int SetPack() +{ + #ifdef TEST + *logofs << "Loop: Setting pack with initial method " + << packMethod << " and quality " << packQuality + << ".\n" << logofs_flush; + #endif + + // + // Check if this is a proxy session and, in + // this case, set the pack method to none. + // Packed images are not supported by plain + // X applications. + // + + if (control -> SessionMode == session_proxy) + { + #ifdef TEST + *logofs << "Loop: WARNING! Disabling pack with proxy session.\n" + << logofs_flush; + #endif + + packMethod = PACK_NONE; + } + + // + // Adjust the internal settings according + // to the newly selected pack method. + // + + ParsePackMethod(packMethod, packQuality); + + // + // Don't load messages from persistent + // cache if packed images are disabled. + // + + if (control -> PackMethod == PACK_NONE) + { + control -> PersistentCacheLoadPacked = 0; + + #ifdef TEST + *logofs << "Loop: Not loading packed images " + << "from persistent cache.\n" + << logofs_flush; + #endif + } + + return 1; +} + +// +// Set the disk-based image cache parameters +// according to the user's wishes. +// + +int SetImages() +{ + // + // Be sure we disable the image cache if we + // are connecting to plain X clients. + // + + if (control -> SessionMode == session_proxy) + { + #ifdef TEST + *logofs << "Loop: Disabling image cache with " + << "session '" << DumpSession(control -> + SessionMode) << "'.\n" << logofs_flush; + #endif + + sprintf(imagesSizeName, "0"); + + control -> ImageCacheEnableLoad = 0; + control -> ImageCacheEnableSave = 0; + + return 1; + } + + int size = control -> ImageCacheDiskLimit; + + if (size / 1024 > 0) + { + sprintf(imagesSizeName, "%dk", size / 1024); + } + else + { + sprintf(imagesSizeName, "%d", size); + } + + if (size > 0) + { + control -> ImageCacheEnableLoad = 1; + control -> ImageCacheEnableSave = 1; + + if (control -> ProxyMode == proxy_server) + { + if ((control -> ImageCachePath = GetImagesPath()) == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error getting or creating image cache path.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error getting or creating image cache path.\n"; + + HandleCleanup(); + } + + #ifdef TEST + *logofs << "Loop: Path of image cache files is '" << control -> ImageCachePath + << "'.\n" << logofs_flush; + #endif + } + } + else + { + #ifdef TEST + *logofs << "Loop: Disabling the persistent image cache.\n" + << logofs_flush; + #endif + + control -> ImageCacheEnableLoad = 0; + control -> ImageCacheEnableSave = 0; + } + + return 1; +} + +int SetVersion() +{ + // + // Normalize the different proxy versions. + // + + int local = (control -> LocalVersionMajor << 24) | + (control -> LocalVersionMinor << 16) | + control -> LocalVersionPatch; + + int remote = (control -> RemoteVersionMajor << 24) | + (control -> RemoteVersionMinor << 16) | + control -> RemoteVersionPatch; + + int major = -1; + int minor = -1; + int patch = -1; + + if (control -> RemoteVersionMajor <= 1) + { + // + // The remote proxy uses a different + // logic to determine the version so + // we default to the compatibility + // version. + // + + major = control -> CompatVersionMajor; + minor = control -> CompatVersionMinor; + patch = control -> CompatVersionPatch; + + #ifdef TEST + *logofs << "Loop: Using compatibility version '" + << major << "." << minor << "." << patch + << "'.\n" << logofs_flush; + #endif + } + else if (control -> LocalVersionMajor > + control -> RemoteVersionMajor) + { + // + // We use a more recent version. Let's + // negotiate the version based on the + // version supported by the remote. + // + + major = control -> RemoteVersionMajor; + minor = control -> RemoteVersionMinor; + patch = control -> RemoteVersionPatch; + + #ifdef TEST + *logofs << "Loop: Using remote version '" + << major << "." << minor << "." << patch + << "'.\n" << logofs_flush; + #endif + } + else + { + // + // We support a major version that is + // equal or older than the remote. We + // assume the smaller version between + // the two, including the minor and + // the patch numbers. + // + + if (local > remote) + { + major = control -> RemoteVersionMajor; + minor = control -> RemoteVersionMinor; + patch = control -> RemoteVersionPatch; + + #ifdef TEST + *logofs << "Loop: Using remote version '" + << major << "." << minor << "." << patch + << "'.\n" << logofs_flush; + #endif + } + else + { + major = control -> LocalVersionMajor; + minor = control -> LocalVersionMinor; + patch = control -> LocalVersionPatch; + + #ifdef TEST + *logofs << "Loop: Using local version '" + << major << "." << minor << "." << patch + << "'.\n" << logofs_flush; + #endif + } + } + + // + // Handle versions from 3.5.0. The protocol + // step 10 is the minimum supported version. + // + + int step = 0; + + if (major == 3) + { + if (minor >= 5) + { + step = 10; + } + } + else if (major > 3) + { + step = 10; + } + + if (step == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Unable to set the protocol step value from " + << "the negotiated protocol version " << major << "." << minor + << "." << patch << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unable to set the protocol step value from " + << "the negotiated protocol version " << major << "." << minor + << "." << patch << ".\n"; + + #ifdef PANIC + *logofs << "Loop: PANIC! Incompatible remote version " + << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor + << "." << control -> RemoteVersionPatch << " with local version " + << control -> LocalVersionMajor << "." << control -> LocalVersionMinor + << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Incompatible remote version " + << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor + << "." << control -> RemoteVersionPatch << " with local version " + << control -> LocalVersionMajor << "." << control -> LocalVersionMinor + << "." << control -> LocalVersionPatch << ".\n"; + + return -1; + } + + #ifdef TEST + *logofs << "Loop: Using NX protocol step " + << step << ".\n" << logofs_flush; + #endif + + control -> setProtoStep(step); + + // + // Ignore the differences in patch version + // and print a warning if the local version + // is different or obsolete compared to + // the remote. + // + + local &= 0xffff0000; + remote &= 0xffff0000; + + if (local != remote) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Connected to remote version " + << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor + << "." << control -> RemoteVersionPatch << " with local version " + << control -> LocalVersionMajor << "." << control -> LocalVersionMinor + << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Connected to remote version " + << control -> RemoteVersionMajor << "." << control -> RemoteVersionMinor + << "." << control -> RemoteVersionPatch << " with local version " + << control -> LocalVersionMajor << "." << control -> LocalVersionMinor + << "." << control -> LocalVersionPatch << ".\n" << logofs_flush; + } + + if (local < remote) + { + cerr << "Warning" << ": Consider checking https://github.com/ArcticaProject/nx-libs/releases for updates.\n"; + } + + // + // Now that we are aware of the remote + // version, let's adjust the options to + // be compatible with the remote proxy. + // + + if (control -> ProxyMode == proxy_client) + { + // + // Since ProtoStep8 (#issue 108) + // + // Now it's assumed that the remote is + // able to handle the selected pack + // method + // + + #ifdef TEST + *logofs << __FILE__ << " : " << __LINE__ << " - " + << "step = " << control -> getProtoStep() + << " packMethod = " << packMethod + << " packQuality = " << packQuality + << ".\n" << logofs_flush; + #endif + + // + // Update the pack method name. + // + + ParsePackMethod(packMethod, packQuality); + } + + // + // At the moment the image cache is not used by the + // agent. Proxy versions older than 3.0.0 assumed + // that it was enabled and sent specific bits as part + // of the encoding. Conversely, it is advisable to + // disable the cache right now. By not enabling the + // the image cache, the house-keeping process will + // only take care of cleaning up the "cache-" direc- + // tories. + // + + // + // Considering that compatibility with older versions + // has been set to cover as far as 3.5.0, the cache can + // be disabled at this point without any concern + // + + // Since ProtoStep8 (#issue 108) + #ifdef TEST + *logofs << "Loop: Disabling image cache with protocol " + << "step '" << control -> getProtoStep() + << "'.\n" << logofs_flush; + #endif + + sprintf(imagesSizeName, "0"); + + control -> ImageCacheEnableLoad = 0; + control -> ImageCacheEnableSave = 0; + + return 1; +} + +// +// Identify the requested link settings +// and update the control parameters +// accordingly. +// + +int SetLink() +{ + #ifdef TEST + *logofs << "Loop: Setting link with initial value " + << linkSpeedName << ".\n" << logofs_flush; + #endif + + if (*linkSpeedName == '\0') + { + strcpy(linkSpeedName, "lan"); + } + + #ifdef TEST + *logofs << "Loop: Link speed is " << linkSpeedName + << ".\n" << logofs_flush; + #endif + + if (strcasecmp(linkSpeedName, "modem") == 0) + { + SetLinkModem(); + } + else if (strcasecmp(linkSpeedName, "isdn") == 0) + { + SetLinkIsdn(); + } + else if (strcasecmp(linkSpeedName, "adsl") == 0) + { + SetLinkAdsl(); + } + else if (strcasecmp(linkSpeedName, "wan") == 0) + { + SetLinkWan(); + } + else if (strcasecmp(linkSpeedName, "lan") == 0) + { + SetLinkLan(); + } + else + { + return -1; + } + + // + // Set TCP_NODELAY according to the user's + // wishes. + // + + if (useNoDelay != -1) + { + control -> OptionProxyClientNoDelay = useNoDelay; + control -> OptionProxyServerNoDelay = useNoDelay; + } + + // + // Select the image compression method. + // + + if (packMethod == -1) + { + packMethod = control -> PackMethod; + } + + if (packQuality == -1) + { + packQuality = control -> PackQuality; + } + + if (ParsePackMethod(packMethod, packQuality) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Unrecognized pack method id " + << packMethod << " with quality " << packQuality + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unrecognized pack method id " + << packMethod << " with quality " << packQuality + << ".\n"; + + HandleCleanup(); + } + + // + // Check if the user disabled the ability + // to generate simple replies at the client + // side. + // + + if (control -> SessionMode == session_proxy) + { + if (useTaint != -1) + { + control -> TaintReplies = (useTaint == 1); + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Forcing taint of replies " + << "with a proxy session.\n" + << logofs_flush; + #endif + + control -> TaintReplies = 1; + } + } + else + { + // + // There is no need to taint the + // replies if we have an agent. + // + + control -> TaintReplies = 0; + } + + // + // Be sure that the requests needing a reply + // are flushed immediately. Normal X clients + // use so many replies to make the queuing + // completely useless. + // + + if (control -> SessionMode == session_proxy) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Forcing flush on priority " + << "with a proxy session.\n" + << logofs_flush; + #endif + + control -> FlushPriority = 1; + } + + return 1; +} + +// +// Parameters for MODEM 28.8/33.6/56 Kbps. +// + +int SetLinkModem() +{ + #ifdef TEST + *logofs << "Loop: Setting parameters for MODEM.\n" + << logofs_flush; + #endif + + control -> LinkMode = LINK_TYPE_MODEM; + + control -> TokenSize = 256; + control -> TokenLimit = 24; + + control -> SplitMode = 1; + control -> SplitTotalSize = 128; + control -> SplitTotalStorageSize = 1048576; + + control -> SplitTimeout = 50; + control -> MotionTimeout = 50; + control -> IdleTimeout = 50; + + control -> PackMethod = PACK_ADAPTIVE; + control -> PackQuality = 3; + + return 1; +} + +// +// Parameters for ISDN 64/128 Kbps. +// + +int SetLinkIsdn() +{ + #ifdef TEST + *logofs << "Loop: Setting parameters for ISDN.\n" + << logofs_flush; + #endif + + control -> LinkMode = LINK_TYPE_ISDN; + + control -> TokenSize = 384; + control -> TokenLimit = 24; + + control -> SplitMode = 1; + control -> SplitTotalSize = 128; + control -> SplitTotalStorageSize = 1048576; + + control -> SplitTimeout = 50; + control -> MotionTimeout = 20; + control -> IdleTimeout = 50; + + control -> PackMethod = PACK_ADAPTIVE; + control -> PackQuality = 5; + + return 1; +} + +// +// Parameters for ADSL 256 Kbps. +// + +int SetLinkAdsl() +{ + #ifdef TEST + *logofs << "Loop: Setting parameters for ADSL.\n" + << logofs_flush; + #endif + + control -> LinkMode = LINK_TYPE_ADSL; + + control -> TokenSize = 1536; + control -> TokenLimit = 24; + + control -> SplitMode = 1; + control -> SplitTotalSize = 128; + control -> SplitTotalStorageSize = 1048576; + + control -> SplitTimeout = 50; + control -> MotionTimeout = 10; + control -> IdleTimeout = 50; + + control -> PackMethod = PACK_ADAPTIVE; + control -> PackQuality = 7; + + return 1; +} + +// +// Parameters for XDSL/FDDI/ATM 1/2/34 Mbps WAN. +// + +int SetLinkWan() +{ + #ifdef TEST + *logofs << "Loop: Setting parameters for WAN.\n" + << logofs_flush; + #endif + + control -> LinkMode = LINK_TYPE_WAN; + + control -> TokenSize = 1536; + control -> TokenLimit = 24; + + control -> SplitMode = 1; + control -> SplitTotalSize = 128; + control -> SplitTotalStorageSize = 1048576; + + control -> SplitTimeout = 50; + control -> MotionTimeout = 5; + control -> IdleTimeout = 50; + + control -> PackMethod = PACK_ADAPTIVE; + control -> PackQuality = 9; + + return 1; +} + +// +// Parameters for LAN 10/100 Mbps. +// + +int SetLinkLan() +{ + #ifdef TEST + *logofs << "Loop: Setting parameters for LAN.\n" + << logofs_flush; + #endif + + control -> LinkMode = LINK_TYPE_LAN; + + control -> TokenSize = 1536; + control -> TokenLimit = 24; + + control -> SplitMode = 1; + control -> SplitTotalSize = 128; + control -> SplitTotalStorageSize = 1048576; + + control -> SplitTimeout = 50; + control -> MotionTimeout = 0; + control -> IdleTimeout = 50; + + control -> PackMethod = PACK_ADAPTIVE; + control -> PackQuality = 9; + + return 1; +} + +// +// Identify the requested link type and set +// the control parameters accordingly. +// + +int SetCompression() +{ + if (strcasecmp(linkSpeedName, "modem") == 0) + { + SetCompressionModem(); + } + else if (strcasecmp(linkSpeedName, "isdn") == 0) + { + SetCompressionIsdn(); + } + else if (strcasecmp(linkSpeedName, "adsl") == 0) + { + SetCompressionAdsl(); + } + else if (strcasecmp(linkSpeedName, "wan") == 0) + { + SetCompressionWan(); + } + else if (strcasecmp(linkSpeedName, "lan") == 0) + { + SetCompressionLan(); + } + else + { + return -1; + } + + if (control -> LocalDeltaCompression < 0) + { + control -> LocalDeltaCompression = 1; + } + + // + // If we didn't set remote delta compression + // (as it should always be the case at client + // side) assume value of local side. + // + + if (control -> RemoteDeltaCompression < 0) + { + control -> RemoteDeltaCompression = + control -> LocalDeltaCompression; + } + + // + // If we didn't set remote compression levels + // assume values of local side. + // + + if (control -> RemoteStreamCompression < 0) + { + control -> RemoteStreamCompressionLevel = + control -> LocalStreamCompressionLevel; + + if (control -> RemoteStreamCompressionLevel > 0) + { + control -> RemoteStreamCompression = 1; + } + else + { + control -> RemoteStreamCompression = 0; + } + } + + if (control -> RemoteDataCompression < 0) + { + control -> RemoteDataCompressionLevel = + control -> LocalDataCompressionLevel; + + if (control -> RemoteDataCompressionLevel > 0) + { + control -> RemoteDataCompression = 1; + } + else + { + control -> RemoteDataCompression = 0; + } + } + + return 1; +} + +// +// Compression for MODEM. +// + +int SetCompressionModem() +{ + if (control -> LocalDataCompression < 0) + { + control -> LocalDataCompression = 1; + control -> LocalDataCompressionLevel = 1; + } + + if (control -> LocalDataCompressionThreshold < 0) + { + control -> LocalDataCompressionThreshold = 32; + } + + if (control -> LocalStreamCompression < 0) + { + control -> LocalStreamCompression = 1; + control -> LocalStreamCompressionLevel = 9; + } + + return 1; +} + +// +// Compression for ISDN. +// + +int SetCompressionIsdn() +{ + if (control -> LocalDataCompression < 0) + { + control -> LocalDataCompression = 1; + control -> LocalDataCompressionLevel = 1; + } + + if (control -> LocalDataCompressionThreshold < 0) + { + control -> LocalDataCompressionThreshold = 32; + } + + if (control -> LocalStreamCompression < 0) + { + control -> LocalStreamCompression = 1; + control -> LocalStreamCompressionLevel = 6; + } + + return 1; +} + +// +// Compression for ADSL. +// + +int SetCompressionAdsl() +{ + if (control -> LocalDataCompression < 0) + { + control -> LocalDataCompression = 1; + control -> LocalDataCompressionLevel = 1; + } + + if (control -> LocalDataCompressionThreshold < 0) + { + control -> LocalDataCompressionThreshold = 32; + } + + if (control -> LocalStreamCompression < 0) + { + control -> LocalStreamCompression = 1; + control -> LocalStreamCompressionLevel = 4; + } + + return 1; +} + +// +// Compression for WAN. +// + +int SetCompressionWan() +{ + if (control -> LocalDataCompression < 0) + { + control -> LocalDataCompression = 1; + control -> LocalDataCompressionLevel = 1; + } + + if (control -> LocalDataCompressionThreshold < 0) + { + control -> LocalDataCompressionThreshold = 32; + } + + if (control -> LocalStreamCompression < 0) + { + control -> LocalStreamCompression = 1; + control -> LocalStreamCompressionLevel = 1; + } + + return 1; +} + +// +// Compression for LAN. +// + +int SetCompressionLan() +{ + // + // Disable delta compression if not + // explicitly enabled. + // + + if (control -> LocalDeltaCompression < 0) + { + control -> LocalDeltaCompression = 0; + } + + if (control -> LocalDataCompression < 0) + { + control -> LocalDataCompression = 0; + control -> LocalDataCompressionLevel = 0; + } + + if (control -> LocalDataCompressionThreshold < 0) + { + control -> LocalDataCompressionThreshold = 0; + } + + if (control -> LocalStreamCompression < 0) + { + control -> LocalStreamCompression = 0; + control -> LocalStreamCompressionLevel = 0; + } + + return 1; +} + +int SetLimits() +{ + // + // Check if the user requested strict + // control flow parameters. + // + + if (useStrict == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: LIMIT! Decreasing the token limit " + << "to " << control -> TokenLimit / 2 + << " with option 'strict'.\n" + << logofs_flush; + #endif + + control -> TokenLimit /= 2; + } + + #ifdef STRICT + + control -> TokenLimit = 1; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: WARNING! LIMIT! Setting the token limit " + << "to " << control -> TokenLimit + << " to simulate the proxy congestion.\n" + << logofs_flush; + #endif + + #endif + + // + // Reduce the size of the log file. + // + + #ifdef QUOTA + + control -> FileSizeLimit = 8388608; + + #endif + + // + // Check the bitrate limits. + // + + if (control -> LocalBitrateLimit == -1) + { + if (control -> ProxyMode == proxy_client) + { + control -> LocalBitrateLimit = + control -> ClientBitrateLimit; + } + else + { + control -> LocalBitrateLimit = + control -> ServerBitrateLimit; + } + } + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: LIMIT! Setting client bitrate limit " + << "to " << control -> ClientBitrateLimit + << " server bitrate limit to " << control -> + ServerBitrateLimit << " with local limit " + << control -> LocalBitrateLimit << ".\n" + << logofs_flush; + #endif + + return 1; +} + +// +// These functions are used to parse literal +// values provided by the user and set the +// control parameters accordingly. +// + +int ParseCacheOption(const char *opt) +{ + int size = ParseArg("", "cache", opt); + + if (size < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value '" + << opt << "' for option 'cache'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value '" + << opt << "' for option 'cache'.\n"; + + return -1; + } + + #ifdef TEST + *logofs << "Loop: Setting size of cache to " + << size << " bytes.\n" << logofs_flush; + #endif + + control -> ClientTotalStorageSize = size; + control -> ServerTotalStorageSize = size; + + strcpy(cacheSizeName, opt); + + if (size == 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Disabling NX delta compression.\n" + << logofs_flush; + #endif + + control -> LocalDeltaCompression = 0; + + #ifdef WARNING + *logofs << "Loop: WARNING! Disabling use of NX persistent cache.\n" + << logofs_flush; + #endif + + control -> PersistentCacheEnableLoad = 0; + control -> PersistentCacheEnableSave = 0; + } + + return 1; +} + +int ParseImagesOption(const char *opt) +{ + int size = ParseArg("", "images", opt); + + if (size < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value '" + << opt << "' for option 'images'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value '" + << opt << "' for option 'images'.\n"; + + return -1; + } + + #ifdef TEST + *logofs << "Loop: Setting size of images cache to " + << size << " bytes.\n" << logofs_flush; + #endif + + control -> ImageCacheDiskLimit = size; + + strcpy(imagesSizeName, opt); + + return 1; +} + +int ParseShmemOption(const char *opt) +{ + int size = ParseArg("", "shseg", opt); + + if (size < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value '" + << opt << "' for option 'shseg'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value '" + << opt << "' for option 'shseg'.\n"; + + return -1; + } + + control -> ShmemClientSize = size; + control -> ShmemServerSize = size; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Set shared memory size to " + << control -> ShmemServerSize << " bytes.\n" + << logofs_flush; + #endif + + strcpy(shsegSizeName, opt); + + return 1; +} + +int ParseBitrateOption(const char *opt) +{ + int bitrate = ParseArg("", "limit", opt); + + if (bitrate < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid value '" + << opt << "' for option 'limit'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Invalid value '" + << opt << "' for option 'limit'.\n"; + + return -1; + } + + strcpy(bitrateLimitName, opt); + + if (bitrate == 0) + { + #ifdef TEST + *logofs << "Loop: Disabling bitrate limit on proxy link.\n" + << logofs_flush; + #endif + + control -> LocalBitrateLimit = 0; + } + else + { + #ifdef TEST + *logofs << "Loop: Setting bitrate to " << bitrate + << " bits per second.\n" << logofs_flush; + #endif + + // + // Internal representation is in bytes + // per second. + // + + control -> LocalBitrateLimit = bitrate >> 3; + } + + return 1; +} + +int ParseHostOption(const char *opt, char *host, long &port) +{ + #ifdef TEST + *logofs << "Loop: Trying to parse options string '" << opt + << "' as a remote NX host.\n" << logofs_flush; + #endif + + if (opt == NULL || *opt == '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! No host parameter provided.\n" + << logofs_flush; + #endif + + return 0; + } + else if (strlen(opt) >= DEFAULT_STRING_LENGTH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Host parameter exceeds length of " + << DEFAULT_STRING_LENGTH << " characters.\n" + << logofs_flush; + #endif + + return 0; + } + + // + // Look for a host name followed + // by a colon followed by port. + // + + int newPort = port; + + const char *separator = strrchr(opt, ':'); + + if (separator != NULL) + { + const char *check = separator + 1; + + while (*check != '\0' && *check != ',' && + *check != '=' && isdigit(*check) != 0) + { + check++; + } + + newPort = atoi(separator + 1); + + if (newPort < 0 || *check != '\0') + { + #ifdef TEST + *logofs << "Loop: Can't identify remote NX port in string '" + << separator << "'.\n" << logofs_flush; + #endif + + return 0; + } + } + else if (newPort < 0) + { + // + // Complain if port was not passed + // by other means. + // + + #ifdef TEST + *logofs << "Loop: Can't identify remote NX port in string '" + << opt << "'.\n" << logofs_flush; + #endif + + return 0; + } + else + { + separator = opt + strlen(opt); + } + + char newHost[DEFAULT_STRING_LENGTH] = { 0 }; + + strncpy(newHost, opt, strlen(opt) - strlen(separator)); + + *(newHost + strlen(opt) - strlen(separator)) = '\0'; + + const char *check = newHost; + + while (*check != '\0' && *check != ',' && + *check != '=') + { + check++; + } + + if (*check != '\0') + { + #ifdef TEST + *logofs << "Loop: Can't identify remote NX host in string '" + << newHost << "'.\n" << logofs_flush; + #endif + + return 0; + } + else if (*acceptHost != '\0') + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't manage to connect and accept connections " + << "at the same time.\n" << logofs_flush; + + *logofs << "Loop: PANIC! Refusing remote NX host with string '" + << opt << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't manage to connect and accept connections " + << "at the same time.\n"; + + cerr << "Error" << ": Refusing remote NX host with string '" + << opt << "'.\n"; + + return -1; + } + + if (*host != '\0' && strcmp(host, newHost) != 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Overriding remote NX host '" + << host << "' with new value '" << newHost + << "'.\n" << logofs_flush; + #endif + } + + strcpy(host, newHost); + + if (port != -1 && port != newPort) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Overriding remote NX port '" + << port << "' with new value '" << newPort + << "'.\n" << logofs_flush; + #endif + } + + #ifdef TEST + *logofs << "Loop: Parsed options string '" << opt + << "' with host '" << newHost << "' and port '" + << newPort << "'.\n" << logofs_flush; + #endif + + port = newPort; + + return 1; +} + +int ParseFontPath(char *path) +{ + char oldPath[DEFAULT_STRING_LENGTH]; + + strcpy(oldPath, path); + + if (path == NULL || *path == '\0' || strcmp(path, "0") == 0) + { + return 0; + } + + #ifdef TEST + *logofs << "Loop: Parsing font server option '" << path + << "'.\n" << logofs_flush; + #endif + + // + // Convert the value to our default port. + // + + if (strcmp(fontPort, "1") == 0) + { + if (control -> ProxyMode == proxy_server) + { + snprintf(fontPort, DEFAULT_STRING_LENGTH - 1, "%d", + DEFAULT_NX_FONT_PORT_OFFSET + proxyPort); + } + else + { + // + // Let the client use the well-known + // "unix/:7100" font path. + // + + snprintf(fontPort, DEFAULT_STRING_LENGTH - 1, "unix/:7100"); + } + } + + // + // Check if a simple numaric value was given. + // + + if (atoi(path) > 0) + { + #ifdef TEST + *logofs << "Loop: Assuming numeric TCP port '" << atoi(path) + << "' for font server.\n" << logofs_flush; + #endif + + return 1; + } + + // + // Let's assume that a port specification "unix/:7100" + // corresponds to "$TEMP/.font-unix/fs7100" and a port + // "unix/:-1" corresponds to "$TEMP/.font-unix/fs-1". + // + + if (strncmp("unix/:", path, 6) == 0) + { + snprintf(path, DEFAULT_STRING_LENGTH - 1, "%s/.font-unix/fs%s", + control -> TempPath, oldPath + 6); + + *(path + DEFAULT_STRING_LENGTH - 1) = '\0'; + + #ifdef TEST + *logofs << "Loop: Assuming Unix socket '" << path + << "' for font server.\n" << logofs_flush; + #endif + } + else if (strncmp("tcp/:", path, 5) == 0) + { + snprintf(path, DEFAULT_STRING_LENGTH - 1, "%d", atoi(oldPath + 5)); + + *(path + DEFAULT_STRING_LENGTH - 1) = '\0'; + + if (atoi(path) <= 0) + { + goto ParseFontPathError; + } + + #ifdef TEST + *logofs << "Loop: Assuming TCP port '" << atoi(path) + << "' for font server.\n" << logofs_flush; + #endif + } + else + { + // + // Accept an absolute file path as + // a valid Unix socket. + // + + if (*path != '/') + { + goto ParseFontPathError; + } + + #ifdef TEST + *logofs << "Loop: Assuming Unix socket '" << path + << "' for font server.\n" << logofs_flush; + #endif + } + + return 1; + +ParseFontPathError: + + #ifdef TEST + *logofs << "Loop: Unable to determine the font server " + << "port in string '" << path << "'.\n" + << logofs_flush; + #endif + + return -1; +} + +int OpenLogFile(char *name, ostream *&stream) +{ + if (name == NULL || *name == '\0') + { + #ifdef TEST + *logofs << "Loop: WARNING! No name provided for output. Using standard error.\n" + << logofs_flush; + #endif + + if (stream == NULL) + { + stream = &cerr; + } + + return 1; + } + + if (stream == NULL || stream == &cerr) + { + if (*name != '/' && *name != '.') + { + char *filePath = GetSessionPath(); + + if (filePath == NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Cannot determine directory of NX session file.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Cannot determine directory of NX session file.\n"; + + return -1; + } + + if (strlen(filePath) + strlen("/") + + strlen(name) + 1 > DEFAULT_STRING_LENGTH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Full name of NX file '" << name + << " would exceed length of " << DEFAULT_STRING_LENGTH + << " characters.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Full name of NX file '" << name + << " would exceed length of " << DEFAULT_STRING_LENGTH + << " characters.\n"; + + return -1; + } + + char *file = new char[strlen(filePath) + strlen("/") + + strlen(name) + 1]; + + // + // Transform name in a fully qualified name. + // + + strcpy(file, filePath); + strcat(file, "/"); + strcat(file, name); + + strcpy(name, file); + + delete [] filePath; + delete [] file; + } + + mode_t fileMode = umask(0077); + + for (;;) + { + if ((stream = new ofstream(name, ios::app)) != NULL) + { + break; + } + + usleep(200000); + } + + umask(fileMode); + } + else + { + #ifdef PANIC + *logofs << "Loop: PANIC! Bad stream provided for output.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Bad stream provided for output.\n"; + + return -1; + } + + return 1; +} + +int ReopenLogFile(char *name, ostream *&stream, int limit) +{ + if (*name != '\0' && limit >= 0) + { + struct stat fileStat; + + if (limit > 0) + { + // + // This is used for the log file, if the + // size exceeds the limit. + // + + if (stat(name, &fileStat) != 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Can't get stats of file '" + << name << "'. Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + return 0; + } + else if (fileStat.st_size < (long) limit) + { + return 0; + } + } + + #ifdef TEST + *logofs << "Loop: Deleting file '" << name + << "' with size " << fileStat.st_size + << ".\n" << logofs_flush; + #endif + + // + // Create a new stream over the previous + // file. Trying to delete the file fails + // to work on recent Cygwin installs. + // + + *stream << flush; + + delete stream; + + mode_t fileMode = umask(0077); + + for (;;) + { + if ((stream = new ofstream(name, ios::out)) != NULL) + { + break; + } + + usleep(200000); + } + + umask(fileMode); + + #ifdef TEST + *logofs << "Loop: Reopened file '" << name + << "'.\n" << logofs_flush; + #endif + } + + return 1; +} + +void PrintProcessInfo() +{ + if (agent == NULL) + { + + cerr << endl; + + PrintVersionInfo(); + + cerr << endl; + + cerr << GetCopyrightInfo() + << endl + << GetOtherCopyrightInfo() + << endl + << "See https://github.com/ArcticaProject/nx-libs for more information." << endl << endl; + } + + // + // People get confused by the fact that client + // mode is running on NX server and viceversa. + // Let's adopt an user-friendly naming conven- + // tion here. + // + + cerr << "Info: Proxy running in " + << (control -> ProxyMode == proxy_client ? "client" : "server") + << " mode with pid '" << getpid() << "'.\n"; + + if (agent == NULL) + { + cerr << "Session" << ": Starting session at '" + << strTimestamp() << "'.\n"; + } + + #ifdef TEST + + if (*errorsFileName != '\0') + { + cerr << "Info" << ": Using errors file '" << errorsFileName << "'.\n"; + } + + if (*statsFileName != '\0') + { + cerr << "Info" << ": Using stats file '" << statsFileName << "'.\n"; + } + + #endif +} + +void PrintConnectionInfo() +{ + cerr << "Info" << ": Using " + << linkSpeedName << " link parameters " + << control -> TokenSize + << "/" << control -> TokenLimit + << "/" << control -> FlushPolicy + 1 + << "/" << control -> FlushPriority + << ".\n"; + + if (control -> ProxyMode == proxy_client) + { + cerr << "Info" << ": Using agent parameters " + << control -> PingTimeout + << "/" << control -> MotionTimeout + << "/" << control -> IdleTimeout + << "/" << control -> TaintReplies + << "/" << control -> HideRender + << ".\n"; + } + + if (control -> LocalDeltaCompression == 1) + { + cerr << "Info" << ": Using cache parameters " + << control -> MinimumMessageSize + << "/" << control -> MaximumMessageSize / 1024 << "KB" + << "/" << control -> ClientTotalStorageSize / 1024 << "KB" + << "/" << control -> ServerTotalStorageSize / 1024 << "KB" + << ".\n"; + } + + if (control -> ImageCacheEnableLoad == 1 || + control -> ImageCacheEnableSave == 1) + { + cerr << "Info" << ": Using image streaming parameters " + << control -> SplitTimeout + << "/" << control -> SplitTotalSize + << "/" << control -> SplitTotalStorageSize / 1024 << "KB" + << "/" << control -> SplitDataThreshold + << "/" << control -> SplitDataPacketLimit + << ".\n"; + + cerr << "Info" << ": Using image cache parameters " + << control -> ImageCacheEnableLoad + << "/" << control -> ImageCacheEnableSave + << "/" << control -> ImageCacheDiskLimit / 1024 << "KB" + << ".\n"; + } + + cerr << "Info" << ": Using pack method '" + << packMethodName << "' with session '" + << sessionType << "'.\n"; + + if (*productName != '\0') + { + cerr << "Info" << ": Using product '" << productName + << "'.\n" << logofs_flush; + } + + if (control -> LocalDeltaCompression == 0) + { + cerr << "Info" << ": Not using NX delta compression.\n"; + } + + if (control -> LocalDataCompression == 1 || + control -> RemoteDataCompression == 1) + { + cerr << "Info" << ": Using ZLIB data compression " + << control -> LocalDataCompressionLevel + << "/" << control -> RemoteDataCompressionLevel + << "/" << control -> LocalDataCompressionThreshold + << ".\n"; + } + else + { + cerr << "Info" << ": Not using ZLIB data compression.\n"; + } + + if (control -> LocalStreamCompression == 1 || + control -> RemoteStreamCompression == 1) + { + cerr << "Info" << ": Using ZLIB stream compression " + << control -> LocalStreamCompressionLevel + << "/" << control -> RemoteStreamCompressionLevel + << ".\n"; + } + else + { + cerr << "Info" << ": Not using ZLIB stream compression.\n"; + } + + if (control -> LocalBitrateLimit > 0) + { + cerr << "Info" << ": Using bandwidth limit of " + << bitrateLimitName << " bits per second.\n"; + } + + if (control -> PersistentCacheName != NULL) + { + cerr << "Info" << ": Using cache file '" + << control -> PersistentCachePath << "/" + << control -> PersistentCacheName << "'.\n"; + } + else + { + if (control -> PersistentCacheEnableLoad == 0 || + control -> LocalDeltaCompression == 0) + { + cerr << "Info" << ": Not using a persistent cache.\n"; + } + else + { + cerr << "Info" << ": No suitable cache file found.\n"; + } + } + + if (control -> ProxyMode == proxy_client && + (useUnixSocket > 0 || useTcpSocket > 0 || + useAgentSocket > 0)) + { + cerr << "Info" << ": Listening to X11 connections " + << "on display ':" << xPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_server) + { + cerr << "Info" << ": Forwarding X11 connections " + << "to display '" << displayHost << "'.\n"; + } + + if (control -> ProxyMode == proxy_client && + useCupsSocket > 0 && cupsPort.enabled()) + { + cerr << "Info" << ": Listening to CUPS connections " + << "on port '" << cupsPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_server && + cupsPort.enabled()) + { + cerr << "Info" << ": Forwarding CUPS connections " + << "to port '" << cupsPort << "'.\n"; + } + + if (control -> ProxyMode == proxy_client && + useAuxSocket > 0 && auxPort.enabled()) + { + cerr << "Info" << ": Listening to auxiliary X11 connections " + << "on port '" << auxPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_server && + auxPort.enabled()) + { + cerr << "Info" << ": Forwarding auxiliary X11 connections " + << "to display '" << displayHost << "'.\n"; + } + + if (control -> ProxyMode == proxy_client && + useSmbSocket > 0 && smbPort.enabled()) + { + cerr << "Info" << ": Listening to SMB connections " + << "on port '" << smbPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_server && + smbPort.enabled()) + { + cerr << "Info" << ": Forwarding SMB connections " + << "to port '" << smbPort << "'.\n"; + } + + if (control -> ProxyMode == proxy_client && + useMediaSocket > 0 && mediaPort.enabled()) + { + cerr << "Info" << ": Listening to multimedia connections " + << "on port '" << mediaPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_server && + mediaPort.enabled()) + { + cerr << "Info" << ": Forwarding multimedia connections " + << "to port '" << mediaPort << "'.\n"; + } + + if (control -> ProxyMode == proxy_client && + useHttpSocket > 0 && httpPort.enabled()) + { + cerr << "Info" << ": Listening to HTTP connections " + << "on port '" << httpPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_server && + httpPort.enabled()) + { + cerr << "Info" << ": Forwarding HTTP connections " + << "to port '" << httpPort << "'.\n"; + } + + if (control -> ProxyMode == proxy_server && + useFontSocket > 0 && *fontPort != '\0') + { + cerr << "Info" << ": Listening to font server connections " + << "on port '" << fontPort << "'.\n"; + } + else if (control -> ProxyMode == proxy_client && + *fontPort != '\0') + { + cerr << "Info" << ": Forwarding font server connections " + << "to port '" << fontPort << "'.\n"; + } + + if (useSlaveSocket > 0 && slavePort.enabled()) + { + cerr << "Info" << ": Listening to slave connections " + << "on port '" << slavePort << "'.\n"; + } +} + +void PrintVersionInfo() +{ + cerr << "NXPROXY - " << "Version " + << control -> LocalVersionMajor << "." + << control -> LocalVersionMinor << "." + << control -> LocalVersionPatch << "." + << control -> LocalVersionMaintenancePatch; + + cerr << endl; +} + +void PrintCopyrightInfo() +{ + cerr << endl; + + PrintVersionInfo(); + + cerr << endl; + + cerr << GetCopyrightInfo(); + + // + // Print third party's copyright info. + // + + cerr << endl; + + cerr << GetOtherCopyrightInfo(); + + cerr << endl; +} + +void PrintOptionIgnored(const char *type, const char *name, const char *value) +{ + if (control -> ProxyMode == proxy_server) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring " << type + << " option '" << name << "' with value '" + << value << "' at " << "NX client side.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Ignoring " << type + << " option '" << name << "' with value '" + << value << "' at " << "NX client side.\n"; + } + else + { + #ifdef WARNING + *logofs << "Loop: WARNING! Ignoring " << type + << " option '" << name << "' with value '" + << value << "' at " << "NX server side.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Ignoring " << type + << " option '" << name << "' with value '" + << value << "' at " << "NX server side.\n"; + } +} + +const char *GetOptions(const char *options) +{ + if (options != NULL) + { + if (strncasecmp(options, "nx/nx,", 6) != 0 && + strncasecmp(options, "nx,", 3) != 0 && + strncasecmp(options, "nx:", 3) != 0) + { + #ifdef TEST + *logofs << "Loop: PANIC! Display options string '" << options + << "' must start with 'nx' or 'nx/nx' prefix.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Display options string '" << options + << "' must start with 'nx' or 'nx/nx' prefix.\n"; + + HandleCleanup(); + } + } + else + { + options = getenv("DISPLAY"); + } + + return options; +} + +const char *GetArg(int &argi, int argc, const char **argv) +{ + // + // Skip "-" and flag character. + // + + const char *arg = argv[argi] + 2; + + if (*arg == 0) + { + if (argi + 1 == argc) + { + return NULL; + } + else + { + argi++; + + return (*argv[argi] == '-' ? NULL : argv[argi]); + } + } + else + { + return (*arg == '-' ? NULL : arg); + } +} + +int CheckArg(const char *type, const char *name, const char *value) +{ + #ifdef TEST + *logofs << "Loop: Parsing " << type << " option '" << name + << "' with value '" << (value ? value : "(null)") + << "'.\n" << logofs_flush; + #endif + + if (value == NULL || strstr(value, "=") != NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error in " << type << " option '" + << name << "'. No value found.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error in " << type << " option '" + << name << "'. No value found.\n"; + + return -1; + } + else if (strstr(name, ",") != NULL) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Parse error at " << type << " option '" + << name << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Parse error at " << type << " option '" + << name << "'.\n"; + + return -1; + } + else if (strlen(value) >= DEFAULT_STRING_LENGTH) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Value '" << value << "' of " + << type << " option '" << name << "' exceeds length of " + << DEFAULT_STRING_LENGTH << " characters.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Value '" << value << "' of " + << type << " option '" << name << "' exceeds length of " + << DEFAULT_STRING_LENGTH << " characters.\n"; + + return -1; + } + + return 1; +} + +int ParseArg(const char *type, const char *name, const char *value) +{ + if (strcasecmp(value, "0") == 0) + { + return 0; + } + + // + // Find the base factor. + // + + double base; + + const char *id = value + strlen(value) - 1; + + if (strcasecmp(id, "g") == 0) + { + base = 1024 * 1024 * 1024; + } + else if (strcasecmp(id, "m") == 0) + { + base = 1024 * 1024; + } + else if (strcasecmp(id, "k") == 0) + { + base = 1024; + } + else if (strcasecmp(id, "b") == 0 || isdigit(*id) == 1) + { + base = 1; + } + else + { + return -1; + } + + char *string = new char[strlen(value)]; + + strncpy(string, value, strlen(value) - 1); + + *(string + (strlen(value) - 1)) = '\0'; + + #ifdef TEST + + *logofs << "Loop: Parsing integer option '" << name + << "' from string '" << string << "' with base set to "; + + switch (tolower(*id)) + { + case 'k': + case 'm': + case 'g': + { + *logofs << (char) toupper(*id); + } + break; + } + + *logofs << ".\n" << logofs_flush; + + #endif + + double result = atof(string) * base; + + if (result < 0 || result > (((unsigned) -1) >> 1)) + { + delete [] string; + + return -1; + } + + delete [] string; + + #ifdef TEST + *logofs << "Loop: Integer option parsed to '" + << (int) result << "'.\n" << logofs_flush; + #endif + + return (int) result; +} + +void SetAndValidateChannelEndPointArg(const char *type, const char *name, const char *value, + ChannelEndPoint &endPoint) { + endPoint.setSpec(value); + if (!endPoint.validateSpec()) { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid " << type + << " option '" << name << "' with value '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid " << type + << " option '" << name << "' with value '" + << value << "'.\n"; + + HandleCleanup(); + } +} + + +int ValidateArg(const char *type, const char *name, const char *value) +{ + int number = atoi(value); + + if (number < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Invalid " << type + << " option '" << name << "' with value '" + << value << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid " << type + << " option '" << name << "' with value '" + << value << "'.\n"; + + HandleCleanup(); + } + + return number; +} + +int LowercaseArg(const char *type, const char *name, char *value) +{ + char *next = value; + + while (*next != '\0') + { + *next = tolower(*next); + + next++; + } + + return 1; +} + +int CheckSignal(int signal) +{ + // + // Return 1 if the signal needs to be handled + // by the proxy, 2 if the signal just needs to + // be blocked to avoid interrupting a system + // call. + // + + switch (signal) + { + case SIGCHLD: + case SIGUSR1: + case SIGUSR2: + case SIGHUP: + case SIGINT: + case SIGTERM: + case SIGPIPE: + case SIGALRM: + { + return 1; + } + case SIGVTALRM: + case SIGWINCH: + case SIGIO: + case SIGTSTP: + case SIGTTIN: + case SIGTTOU: + { + return 2; + } + default: + { + #ifdef __CYGWIN32__ + + // + // This signal can be raised by the Cygwin + // library. + // + + if (signal == 12) + { + return 1; + } + + #endif + + return 0; + } + } +} + +static void PrintUsageInfo(const char *option, int error) +{ + if (error == 1) + { + cerr << "Error" << ": Invalid command line option '" << option << "'.\n"; + } + + cerr << GetUsageInfo(); + + if (error == 1) + { + cerr << "Error" << ": NX transport initialization failed.\n"; + } +} + +static void handleCheckSessionInLoop() +{ + // + // Check if we completed the shutdown procedure + // and the remote confirmed the shutdown. The + // tear down should be always initiated by the + // agent, but the X server side may unilateral- + // ly shut down the link without our permission. + // + + if (proxy -> getShutdown() > 0) + { + #ifdef TEST + *logofs << "Loop: End of NX transport requested " + << "by remote.\n" << logofs_flush; + #endif + + handleTerminatingInLoop(); + + if (control -> ProxyMode == proxy_server) + { + #ifdef TEST + *logofs << "Loop: Bytes received so far are " + << (unsigned long long) statistics -> getBytesIn() + << ".\n" << logofs_flush; + #endif + + if (statistics -> getBytesIn() < 1024) + { + cerr << "Info" << ": Your session was closed before reaching " + << "a usable state.\n"; + cerr << "Info" << ": This can be due to the local X server " + << "refusing access to the client.\n"; + cerr << "Info" << ": Please check authorization provided " + << "by the remote X application.\n"; + } + } + + #ifdef TEST + *logofs << "Loop: Shutting down the NX transport.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + else if (proxy -> handlePing() < 0) + { + #ifdef TEST + *logofs << "Loop: Failure handling the ping for " + << "proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + HandleShutdown(); + } + + // + // Check if the watchdog has exited and we didn't + // get the SIGCHLD. This can happen if the parent + // has overridden our signal handlers. + // + + if (IsRunning(lastWatchdog) && CheckProcess(lastWatchdog, "watchdog") == 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Watchdog is gone unnoticed. " + << "Setting the last signal to SIGTERM.\n" + << logofs_flush; + #endif + + lastSignal = SIGTERM; + + #ifdef WARNING + *logofs << "Loop: WARNING! Resetting pid of last " + << "watchdog process.\n" << logofs_flush; + #endif + + SetNotRunning(lastWatchdog); + } + + // + // Let the client proxy find out if the agent's + // channel is gone. This is the normal shutdown + // procedure in the case of an internal connect- + // ion to the agent. + // + + int cleanup = 0; + + if (control -> ProxyMode == proxy_client && + agent != NULL && proxy -> getType(agentFD[1]) == + channel_none && lastKill == 0 && lastDestroy == 1) + { + #ifdef TEST + *logofs << "Loop: End of NX transport requested " + << "by agent.\n" << logofs_flush; + #endif + + #ifdef TEST + *logofs << "Loop: Bytes sent so far are " + << (unsigned long long) statistics -> getBytesOut() + << ".\n" << logofs_flush; + #endif + + if (statistics -> getBytesOut() < 1024) + { + cerr << "Info" << ": Your session has died before reaching " + << "an usable state.\n"; + cerr << "Info" << ": This can be due to the remote X server " + << "refusing access to the client.\n"; + cerr << "Info" << ": Please check the authorization provided " + << "by your X application.\n"; + } + + cleanup = 1; + } + + // + // Check if the user requested the end of the + // session by sending a signal to the proxy. + // All signals are handled in the main loop + // so we need to reset the value to get ready + // for the next iteration. + // + + int signal = 0; + + if (lastSignal != 0) + { + switch (lastSignal) + { + case SIGCHLD: + case SIGUSR1: + case SIGUSR2: + { + break; + } + default: + { + signal = lastSignal; + + cleanup = 1; + + break; + } + } + + lastSignal = 0; + } + + if (cleanup == 1) + { + // + // The first time termination signal is received + // disable all further connections, close down any + // X channel and wait for a second signal. + // + + if (lastKill == 0) + { + // + // Don't print a message if cleanup is + // due to normal termination of agent. + // + + if (signal != 0) + { + #ifdef TEST + *logofs << "Loop: End of NX transport requested by signal '" + << signal << "' '" << DumpSignal(signal) + << "'.\n" << logofs_flush; + #endif + + handleTerminatingInLoop(); + } + + // + // Disable any further connection. + // + + CleanupListeners(); + + // + // Close all the remaining X channels and + // let proxies save their persistent cache + // on disk. + // + + CleanupConnections(); + + // + // We'll need to wait for the X channels + // to be shut down before waiting for the + // cleanup signal. + // + + lastKill = 1; + } + else if (lastKill == 2) + { + #ifdef TEST + *logofs << "Loop: Shutting down the NX transport.\n" + << logofs_flush; + #endif + + proxy -> handleShutdown(); + + HandleCleanup(); + } + } + + if (lastKill == 1 && proxy -> getChannels(channel_x11) == 0) + { + // + // Save the message stores to the + // persistent cache. + // + + proxy -> handleSave(); + + // + // Run a watchdog process so we can finally + // give up at the time the watchdog exits. + // + + if (IsNotRunning(lastWatchdog)) + { + int timeout = control -> CleanupTimeout; + + if (timeout > 0) + { + if (proxy -> getChannels() == 0) + { + timeout = 500; + } + + #ifdef TEST + *logofs << "Loop: Starting watchdog process with timeout " + << "of " << timeout << " Ms.\n" + << logofs_flush; + #endif + } + #ifdef TEST + else + { + *logofs << "Loop: Starting watchdog process without " + << "a timeout.\n" << logofs_flush; + } + #endif + + lastWatchdog = NXTransWatchdog(timeout); + + if (IsFailed(lastWatchdog)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't start the NX watchdog " + << "process in shutdown.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't start the NX watchdog " + << "process in shutdown.\n"; + + HandleCleanup(); + } + #ifdef TEST + else + { + *logofs << "Loop: Watchdog started with pid '" + << lastWatchdog << "'.\n" << logofs_flush; + } + #endif + } + else + { + #ifdef PANIC + *logofs << "Loop: PANIC! Previous watchdog detected " + << "in shutdown with pid '" << lastWatchdog + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Previous watchdog detected " + << "in shutdown with pid '" << lastWatchdog + << "'.\n"; + + HandleCleanup(); + } + + if (control -> CleanupTimeout > 0) + { + #ifdef TEST + *logofs << "Loop: Waiting the cleanup timeout to complete.\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Waiting the cleanup timeout to complete.\n"; + } + else + { + // + // The NX server will kill the watchdog + // process after having shut down the + // service channels. + // + + cerr << "Info" << ": Watchdog running with pid '" << lastWatchdog + << "'.\n"; + + #ifdef TEST + *logofs << "Loop: Waiting the watchdog process to complete.\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Waiting the watchdog process to complete.\n"; + } + + lastKill = 2; + } +} + +static void handleCheckBitrateInLoop() +{ + static long int slept = 0; + + #ifdef TEST + *logofs << "Loop: Bitrate is " << statistics -> getBitrateInShortFrame() + << " B/s and " << statistics -> getBitrateInLongFrame() + << " B/s in " << control -> ShortBitrateTimeFrame / 1000 + << "/" << control -> LongBitrateTimeFrame / 1000 + << " seconds timeframes.\n" << logofs_flush; + #endif + + // + // This can be improved. We may not jump out + // of the select often enough to guarantee + // the necessary accuracy. + // + + if (control -> LocalBitrateLimit > 0) + { + #ifdef TEST + *logofs << "Loop: Calculating bandwidth usage with limit " + << control -> LocalBitrateLimit << ".\n" + << logofs_flush; + #endif + + int reference = (statistics -> getBitrateInLongFrame() + + statistics -> getBitrateInShortFrame()) / 2; + + if (reference > control -> LocalBitrateLimit) + { + double ratio = ((double) reference) / + ((double) control -> LocalBitrateLimit); + + if (ratio > 1.2) + { + ratio = 1.2; + } + + slept += (unsigned int) (pow(50000, ratio) / 1000); + + if (slept > 2000) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Sleeping due to " + << "reference bitrate of " << reference + << " B/s.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Sleeping due to " + << "reference bitrate of " << reference + << " B/s.\n"; + + slept %= 2000; + } + + T_timestamp idleTs = getNewTimestamp(); + + usleep((unsigned int) pow(50000, ratio)); + + int diffTs = diffTimestamp(idleTs, getNewTimestamp()); + + statistics -> addIdleTime(diffTs); + + statistics -> subReadTime(diffTs); + } + } +} + +#if defined(TEST) || defined(INFO) + +static void handleCheckStateInLoop(int &setFDs) +{ + int fdLength; + int fdPending; + int fdSplits; + + for (int j = 0; j < setFDs; j++) + { + if (j != proxyFD) + { + fdPending = proxy -> getPending(j); + + if (fdPending > 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Buffer for descriptor FD#" + << j << " has pending bytes to read.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + + fdLength = proxy -> getLength(j); + + if (fdLength > 0) + { + #ifdef TEST + *logofs << "Loop: WARNING! Buffer for descriptor FD#" + << j << " has " << fdLength << " bytes to write.\n" + << logofs_flush; + #endif + } + } + } + + fdPending = proxy -> getPending(proxyFD); + + if (fdPending > 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Buffer for proxy descriptor FD#" + << proxyFD << " has pending bytes to read.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + + fdLength = proxy -> getFlushable(proxyFD); + + if (fdLength > 0) + { + if (control -> FlushPolicy == policy_immediate && + proxy -> getBlocked(proxyFD) == 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Buffer for proxy descriptor FD#" + << proxyFD << " has " << fdLength << " bytes " + << "to write with policy 'immediate'.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + else + { + #ifdef TEST + *logofs << "Loop: WARNING! Buffer for proxy descriptor FD#" + << proxyFD << " has " << fdLength << " bytes " + << "to write.\n" << logofs_flush; + #endif + } + } + + fdSplits = proxy -> getSplitSize(); + + if (fdSplits > 0) + { + #ifdef WARNING + *logofs << "Loop: WARNING! Proxy descriptor FD#" << proxyFD + << " has " << fdSplits << " splits to send.\n" + << logofs_flush; + #endif + } +} + +static void handleCheckSelectInLoop(int &setFDs, fd_set &readSet, + fd_set &writeSet, T_timestamp selectTs) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Maximum descriptors is [" + << setFDs << "] at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + int i; + + if (setFDs > 0) + { + i = 0; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Selected for read are "; + #endif + + for (int j = 0; j < setFDs; j++) + { + if (FD_ISSET(j, &readSet)) + { + #if defined(TEST) || defined(INFO) + *logofs << "[" << j << "]" << logofs_flush; + #endif + + i++; + } + } + + if (i > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << ".\n" << logofs_flush; + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "[none].\n" << logofs_flush; + #endif + } + + i = 0; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Selected for write are "; + #endif + + for (int j = 0; j < setFDs; j++) + { + if (FD_ISSET(j, &writeSet)) + { + #if defined(TEST) || defined(INFO) + *logofs << "[" << j << "]" << logofs_flush; + #endif + + i++; + } + } + + if (i > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << ".\n" << logofs_flush; + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "[none].\n" << logofs_flush; + #endif + } + } + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Select timeout is " + << selectTs.tv_sec << " S and " + << (double) selectTs.tv_usec / 1000 + << " Ms.\n" << logofs_flush; + #endif +} + +static void handleCheckResultInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs, + struct timeval &startTs) +{ + int diffTs = diffTimestamp(startTs, getNewTimestamp()); + + #if defined(TEST) || defined(INFO) + + if (diffTs >= (control -> PingTimeout - + (control -> LatencyTimeout * 4))) + { + *logofs << "Loop: Select result is [" << resultFDs + << "] at " << strMsTimestamp() << " with no " + << "communication within " << diffTs + << " Ms.\n" << logofs_flush; + } + else + { + *logofs << "Loop: Select result is [" << resultFDs + << "] error is [" << errorFDs << "] at " + << strMsTimestamp() << " after " << diffTs + << " Ms.\n" << logofs_flush; + } + + #endif + + int i; + + if (resultFDs > 0) + { + i = 0; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Selected for read are "; + #endif + + for (int j = 0; j < setFDs; j++) + { + if (FD_ISSET(j, &readSet)) + { + #if defined(TEST) || defined(INFO) + *logofs << "[" << j << "]" << logofs_flush; + #endif + + i++; + } + } + + if (i > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << ".\n" << logofs_flush; + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "[none].\n" << logofs_flush; + #endif + } + + i = 0; + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Selected for write are "; + #endif + + for (int j = 0; j < setFDs; j++) + { + if (FD_ISSET(j, &writeSet)) + { + #if defined(TEST) || defined(INFO) + *logofs << "[" << j << "]" << logofs_flush; + #endif + + i++; + } + } + + if (i > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << ".\n" << logofs_flush; + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "[none].\n" << logofs_flush; + #endif + } + } +} + +#endif + +static void handleCheckSessionInConnect() +{ + #ifdef TEST + *logofs << "Loop: Going to check session in connect.\n" + << logofs_flush; + #endif + + if (control -> ProxyMode == proxy_client) + { + HandleAlert(FAILED_PROXY_CONNECTION_CLIENT_ALERT, 1); + } + else if (IsNotRunning(lastDialog)) + { + HandleAlert(FAILED_PROXY_CONNECTION_SERVER_ALERT, 1); + } + + handleAlertInLoop(); +} + +static void handleStatisticsInLoop() +{ + if (lastSignal == 0) + { + return; + } + + int mode = NO_STATS; + + if (control -> EnableStatistics == 1) + { + if (lastSignal == SIGUSR1) + { + // + // Print overall statistics. + // + + mode = TOTAL_STATS; + } + else if (lastSignal == SIGUSR2) + { + // + // Print partial statistics. + // + + mode = PARTIAL_STATS; + } + + if (mode == TOTAL_STATS || mode == PARTIAL_STATS) + { + #ifdef TEST + *logofs << "Loop: Going to request proxy statistics " + << "with signal '" << DumpSignal(lastSignal) + << "'.\n" << logofs_flush; + #endif + + if (proxy != NULL) + { + if (ReopenLogFile(statsFileName, statofs, 0) < 0) + { + HandleCleanup(); + } + + proxy -> handleStatistics(mode, statofs); + } + } + } +} + +static void handleNegotiationInLoop(int &setFDs, fd_set &readSet, + fd_set &writeSet, T_timestamp &selectTs) +{ + int yield = 0; + + while (yield == 0) + { + #ifdef TEST + *logofs << "Loop: Going to run a new negotiation loop " + << "with stage " << control -> ProxyStage + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + switch (control -> ProxyStage) + { + case stage_undefined: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_undefined" << "'.\n" + << logofs_flush; + #endif + + control -> ProxyStage = stage_initializing; + + break; + } + case stage_initializing: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_initializing" << "'.\n" + << logofs_flush; + #endif + + InitBeforeNegotiation(); + + control -> ProxyStage = stage_connecting; + + break; + } + case stage_connecting: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_connecting" << "'.\n" + << logofs_flush; + #endif + + SetupProxyConnection(); + + control -> ProxyStage = stage_connected; + + break; + } + case stage_connected: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_connected" << "'.\n" + << logofs_flush; + #endif + + // + // Server side proxy must always be the one that + // sends its version and options first, so, in + // some way, client side can be the the one that + // has the last word on the matter. + // + + if (control -> ProxyMode == proxy_server) + { + // + // Check if we have been listening for a + // forwarder. In this case it will have to + // authenticate itself. + // + + if (WE_LISTEN_FORWARDER) + { + control -> ProxyStage = stage_waiting_forwarder_version; + + break; + } + + control -> ProxyStage = stage_sending_proxy_options; + } + else + { + // + // The X client side is the side that has to wait + // for the authorization cookie and any remote + // option. + // + + control -> ProxyStage = stage_waiting_proxy_version; + } + + break; + } + case stage_sending_proxy_options: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_sending_proxy_options" << "'.\n" + << logofs_flush; + #endif + + if (SendProxyOptions(proxyFD) < 0) + { + goto handleNegotiationInLoopError; + } + + if (control -> ProxyMode == proxy_server) + { + control -> ProxyStage = stage_waiting_proxy_version; + } + else + { + control -> ProxyStage = stage_sending_proxy_caches; + } + + break; + } + case stage_waiting_forwarder_version: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_waiting_forwarder_version" << "'.\n" + << logofs_flush; + #endif + + int result = ReadForwarderVersion(proxyFD); + + if (result == 0) + { + yield = 1; + } + else if (result == 1) + { + control -> ProxyStage = stage_waiting_forwarder_options; + } + else + { + goto handleNegotiationInLoopError; + } + + break; + } + case stage_waiting_forwarder_options: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_waiting_forwarder_options" << "'.\n" + << logofs_flush; + #endif + + int result = ReadForwarderOptions(proxyFD); + + if (result == 0) + { + yield = 1; + } + else if (result == 1) + { + control -> ProxyStage = stage_sending_proxy_options; + } + else + { + goto handleNegotiationInLoopError; + } + + break; + } + case stage_waiting_proxy_version: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_waiting_proxy_version" << "'.\n" + << logofs_flush; + #endif + + int result = ReadProxyVersion(proxyFD); + + if (result == 0) + { + yield = 1; + } + else if (result == 1) + { + control -> ProxyStage = stage_waiting_proxy_options; + } + else + { + goto handleNegotiationInLoopError; + } + + break; + } + case stage_waiting_proxy_options: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_waiting_proxy_options" << "'.\n" + << logofs_flush; + #endif + + int result = ReadProxyOptions(proxyFD); + + if (result == 0) + { + yield = 1; + } + else if (result == 1) + { + if (control -> ProxyMode == proxy_server) + { + control -> ProxyStage = stage_waiting_proxy_caches; + } + else + { + control -> ProxyStage = stage_sending_proxy_options; + } + } + else + { + goto handleNegotiationInLoopError; + } + + break; + } + case stage_sending_proxy_caches: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_sending_proxy_caches" << "'.\n" + << logofs_flush; + #endif + + if (SendProxyCaches(proxyFD) < 0) + { + goto handleNegotiationInLoopError; + } + + if (control -> ProxyMode == proxy_server) + { + control -> ProxyStage = stage_operational; + } + else + { + control -> ProxyStage = stage_waiting_proxy_caches; + } + + break; + } + case stage_waiting_proxy_caches: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_waiting_proxy_caches" << "'.\n" + << logofs_flush; + #endif + + int result = ReadProxyCaches(proxyFD); + + if (result == 0) + { + yield = 1; + } + else if (result == 1) + { + if (control -> ProxyMode == proxy_server) + { + control -> ProxyStage = stage_sending_proxy_caches; + } + else + { + control -> ProxyStage = stage_operational; + } + } + else + { + goto handleNegotiationInLoopError; + } + + break; + } + case stage_operational: + { + #ifdef TEST + *logofs << "Loop: Handling negotiation with '" + << "stage_operational" << "'.\n" + << logofs_flush; + #endif + + InitAfterNegotiation(); + + yield = 1; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Loop: PANIC! Unmanaged case '" << control -> ProxyStage + << "' while handling negotiation.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unmanaged case '" << control -> ProxyStage + << "' while handling negotiation.\n"; + + HandleCleanup(); + } + } + } + + // + // Check if the user requested the end of + // the session. + // + + if (CheckAbort() != 0) + { + HandleCleanup(); + } + + // + // Select the proxy descriptor so that we + // can proceed negotiating the session. + // + + FD_SET(proxyFD, &readSet); + + if (proxyFD >= setFDs) + { + setFDs = proxyFD + 1; + } + + setMinTimestamp(selectTs, control -> PingTimeout); + + #ifdef TEST + *logofs << "Loop: Selected proxy FD#" << proxyFD << " in negotiation " + << "phase with timeout of " << selectTs.tv_sec << " S and " + << selectTs.tv_usec << " Ms.\n" << logofs_flush; + #endif + + return; + +handleNegotiationInLoopError: + + #ifdef PANIC + *logofs << "Loop: PANIC! Failure negotiating the session in stage '" + << control -> ProxyStage << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failure negotiating the session in stage '" + << control -> ProxyStage << "'.\n"; + + + if (control -> ProxyMode == proxy_server && + control -> ProxyStage == stage_waiting_proxy_version) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Wrong version or invalid session " + << "authentication cookie.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Wrong version or invalid session " + << "authentication cookie.\n"; + } + + handleTerminatingInLoop(); + + HandleCleanup(); +} + +static void handleTerminatingInLoop() +{ + if (getpid() == lastProxy) + { + if (control -> ProxyStage < stage_terminating) + { + if (agent == NULL) + { + cerr << "Session" << ": Terminating session at '" + << strTimestamp() << "'.\n"; + } + + control -> ProxyStage = stage_terminating; + } + } +} + +static void handleTerminatedInLoop() +{ + if (getpid() == lastProxy) + { + if (control -> ProxyStage < stage_terminated) + { + if (agent == NULL) + { + cerr << "Session" << ": Session terminated at '" + << strTimestamp() << "'.\n"; + } + + control -> ProxyStage = stage_terminated; + } + } +} + +static void handleAlertInLoop() +{ + if (lastAlert.code == 0) + { + return; + } + + // + // Since ProtoStep7 (#issue 108) + // + // Now the remote proxy should always + // be able to handle the alert + // + + if (lastAlert.local == 0) + { + if (proxy != NULL) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Requesting a remote alert with code '" + << lastAlert.code << "'.\n" << logofs_flush; + #endif + + if (proxy -> handleAlert(lastAlert.code) < 0) + { + HandleShutdown(); + } + } + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Handling a local alert with code '" + << lastAlert.code << "'.\n" << logofs_flush; + #endif + + if (control -> ProxyMode == proxy_client) + { + // + // If we are at X client side and server + // proxy is not responding, we don't have + // any possibility to interact with user. + // + + if (lastAlert.code != CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT && + lastAlert.code != RESTART_DEAD_PROXY_CONNECTION_CLIENT_ALERT && + lastAlert.code != FAILED_PROXY_CONNECTION_CLIENT_ALERT) + { + // + // Let the server proxy show the dialog. + // + + if (proxy != NULL && + proxy -> handleAlert(lastAlert.code) < 0) + { + HandleShutdown(); + } + } + } + else + { + char caption[DEFAULT_STRING_LENGTH]; + + strcpy(caption, ALERT_CAPTION_PREFIX); + + int length = strlen(sessionId); + + // + // Get rid of the trailing MD5 from session id. + // + + if (length > (MD5_LENGTH * 2 + 1) && + *(sessionId + (length - (MD5_LENGTH * 2 + 1))) == '-') + { + strncat(caption, sessionId, length - (MD5_LENGTH * 2 + 1)); + } + else + { + strcat(caption, sessionId); + } + + // + // Use the display to which we are forwarding + // the remote X connections. + // + + char *display = displayHost; + + int replace = 1; + int local = 1; + + const char *message; + const char *type; + + switch (lastAlert.code) + { + case CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT: + { + message = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_STRING; + type = CLOSE_DEAD_X_CONNECTION_CLIENT_ALERT_TYPE; + + break; + } + case CLOSE_DEAD_X_CONNECTION_SERVER_ALERT: + { + message = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_STRING; + type = CLOSE_DEAD_X_CONNECTION_SERVER_ALERT_TYPE; + + break; + } + case CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT: + { + message = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING; + type = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE; + + break; + } + case RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT: + { + message = RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_STRING; + type = RESTART_DEAD_PROXY_CONNECTION_SERVER_ALERT_TYPE; + + break; + } + case CLOSE_UNRESPONSIVE_X_SERVER_ALERT: + { + message = CLOSE_UNRESPONSIVE_X_SERVER_ALERT_STRING; + type = CLOSE_UNRESPONSIVE_X_SERVER_ALERT_TYPE; + + break; + } + case WRONG_PROXY_VERSION_ALERT: + { + message = WRONG_PROXY_VERSION_ALERT_STRING; + type = WRONG_PROXY_VERSION_ALERT_TYPE; + + break; + } + case FAILED_PROXY_CONNECTION_SERVER_ALERT: + { + message = FAILED_PROXY_CONNECTION_SERVER_ALERT_STRING; + type = FAILED_PROXY_CONNECTION_SERVER_ALERT_TYPE; + + break; + } + case MISSING_PROXY_CACHE_ALERT: + { + message = MISSING_PROXY_CACHE_ALERT_STRING; + type = MISSING_PROXY_CACHE_ALERT_TYPE; + + break; + } + case ABORT_PROXY_CONNECTION_ALERT: + { + message = ABORT_PROXY_CONNECTION_ALERT_STRING; + type = ABORT_PROXY_CONNECTION_ALERT_TYPE; + + break; + } + case DISPLACE_MESSAGE_ALERT: + { + message = DISPLACE_MESSAGE_ALERT_STRING; + type = DISPLACE_MESSAGE_ALERT_TYPE; + + break; + } + case GREETING_MESSAGE_ALERT: + { + message = GREETING_MESSAGE_ALERT_STRING; + type = GREETING_MESSAGE_ALERT_TYPE; + + break; + } + case START_RESUME_SESSION_ALERT: + { + message = START_RESUME_SESSION_ALERT_STRING; + type = START_RESUME_SESSION_ALERT_TYPE; + + break; + } + case FAILED_RESUME_DISPLAY_ALERT: + { + message = FAILED_RESUME_DISPLAY_ALERT_STRING; + type = FAILED_RESUME_DISPLAY_ALERT_TYPE; + + break; + } + case FAILED_RESUME_DISPLAY_BROKEN_ALERT: + { + message = FAILED_RESUME_DISPLAY_BROKEN_STRING; + type = FAILED_RESUME_DISPLAY_BROKEN_TYPE; + + break; + } + case FAILED_RESUME_VISUALS_ALERT: + { + message = FAILED_RESUME_VISUALS_ALERT_STRING; + type = FAILED_RESUME_VISUALS_ALERT_TYPE; + + break; + } + case FAILED_RESUME_COLORMAPS_ALERT: + { + message = FAILED_RESUME_COLORMAPS_ALERT_STRING; + type = FAILED_RESUME_COLORMAPS_ALERT_TYPE; + + break; + } + case FAILED_RESUME_PIXMAPS_ALERT: + { + message = FAILED_RESUME_PIXMAPS_ALERT_STRING; + type = FAILED_RESUME_PIXMAPS_ALERT_TYPE; + + break; + } + case FAILED_RESUME_DEPTHS_ALERT: + { + message = FAILED_RESUME_DEPTHS_ALERT_STRING; + type = FAILED_RESUME_DEPTHS_ALERT_TYPE; + + break; + } + case FAILED_RESUME_RENDER_ALERT: + { + message = FAILED_RESUME_RENDER_ALERT_STRING; + type = FAILED_RESUME_RENDER_ALERT_TYPE; + + break; + } + case FAILED_RESUME_FONTS_ALERT: + { + message = FAILED_RESUME_FONTS_ALERT_STRING; + type = FAILED_RESUME_FONTS_ALERT_TYPE; + + break; + } + case INTERNAL_ERROR_ALERT: + { + message = INTERNAL_ERROR_ALERT_STRING; + type = INTERNAL_ERROR_ALERT_TYPE; + + break; + } + case ABORT_PROXY_NEGOTIATION_ALERT: + { + message = ABORT_PROXY_NEGOTIATION_ALERT_STRING; + type = ABORT_PROXY_NEGOTIATION_ALERT_TYPE; + + break; + } + case ABORT_PROXY_SHUTDOWN_ALERT: + { + message = ABORT_PROXY_SHUTDOWN_ALERT_STRING; + type = ABORT_PROXY_SHUTDOWN_ALERT_TYPE; + + break; + } + case FAILED_XDMCP_CONNECTION_ALERT: + { + message = FAILED_XDMCP_CONNECTION_ALERT_STRING; + type = FAILED_XDMCP_CONNECTION_ALERT_TYPE; + + break; + } + default: + { + if (lastAlert.code > LAST_PROTO_STEP_7_ALERT) + { + #ifdef WARNING + *logofs << "Loop: WARNING! An unrecognized alert type '" + << lastAlert.code << "' was requested.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": An unrecognized alert type '" + << lastAlert.code << "' was requested.\n"; + } + #ifdef WARNING + else + { + *logofs << "Loop: WARNING! Ignoring obsolete alert type '" + << lastAlert.code << "'.\n" << logofs_flush; + } + #endif + + message = NULL; + type = NULL; + + replace = 0; + + break; + } + } + + if (replace == 1 && IsRunning(lastDialog)) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Killing the previous dialog with pid '" + << lastDialog << "'.\n" << logofs_flush; + #endif + + // + // The client ignores the TERM signal + // on Windows. + // + + #ifdef __CYGWIN32__ + + KillProcess(lastDialog, "dialog", SIGKILL, 0); + + #else + + KillProcess(lastDialog, "dialog", SIGTERM, 0); + + #endif + + SetNotRunning(lastDialog); + + if (proxy != NULL) + { + proxy -> handleResetAlert(); + } + } + + if (message != NULL && type != NULL) + { + lastDialog = NXTransDialog(caption, message, 0, type, local, display); + + if (IsFailed(lastDialog)) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Can't start the NX dialog process.\n" + << logofs_flush; + #endif + + SetNotRunning(lastDialog); + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "Loop: Dialog started with pid '" + << lastDialog << "'.\n" << logofs_flush; + } + #endif + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "Loop: No new dialog required for code '" + << lastAlert.code << "'.\n" << logofs_flush; + } + #endif + } + } + + // + // Reset state. + // + + lastAlert.code = 0; + lastAlert.local = 0; +} + +static inline void handleSetAgentInLoop(int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs) +{ + #ifdef TEST + *logofs << "Loop: Preparing the masks for the agent descriptors.\n" + << logofs_flush; + #endif + + agent -> saveChannelState(); + + agent -> saveReadMask(&readSet); + agent -> saveWriteMask(&writeSet); + + if (control -> ProxyStage >= stage_operational) + { + if (agent -> remoteCanRead(&readSet) || + agent -> remoteCanWrite(&writeSet) || + agent -> localCanRead() || + agent -> proxyCanRead()) + { + #ifdef TEST + *logofs << "Loop: Setting a null timeout with agent descriptors ready.\n" + << logofs_flush; + #endif + + // + // Force a null timeout so we'll bail out + // of the select immediately. We will ac- + // comodate the result code later. + // + + selectTs.tv_sec = 0; + selectTs.tv_usec = 0; + } + } + + #ifdef TEST + *logofs << "Loop: Clearing the read and write agent descriptors.\n" + << logofs_flush; + #endif + + agent -> clearReadMask(&readSet); + agent -> clearWriteMask(&writeSet); +} + +static inline void handleAgentInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Setting proxy and local agent descriptors.\n" + << logofs_flush; + #endif + + // + // Check if I/O is possible on the local + // agent or the proxy descriptor. + // + + if (resultFDs >= 0) + { + // + // Save if the proxy can read from the + // the agent descriptor. + // + + agent -> saveChannelState(); + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Values were resultFDs " << resultFDs + << " errorFDs " << errorFDs << " setFDs " + << setFDs << ".\n" << logofs_flush; + #endif + + if (agent -> localCanRead() == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Setting agent descriptor FD#" << agent -> + getLocalFd() << " as ready to read.\n" + << logofs_flush; + #endif + + agent -> setLocalRead(&readSet, &resultFDs); + } + + #if defined(TEST) || defined(INFO) + + if (agent -> proxyCanRead(&readSet) == 0 && + agent -> proxyCanRead() == 1) + { + *logofs << "Loop: WARNING! Can read from proxy FD#" + << proxyFD << " but the descriptor " + << "is not selected.\n" << logofs_flush; + } + + if (agent -> proxyCanRead(&readSet) == 1) + { + *logofs << "Loop: Setting proxy descriptor FD#" << agent -> + getProxyFd() << " as ready to read.\n" + << logofs_flush; + } + + #endif + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Values are now resultFDs " << resultFDs + << " errorFDs " << errorFDs << " setFDs " + << setFDs << ".\n" << logofs_flush; + #endif + } +} + +static inline void handleAgentLateInLoop(int &resultFDs, int &errorFDs, int &setFDs, fd_set &readSet, + fd_set &writeSet, struct timeval &selectTs) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Setting remote agent descriptors.\n" + << logofs_flush; + #endif + + // + // We reset the masks before calling our select. + // We now set the descriptors that are ready but + // only if they were set in the original mask. + // We do this after having executed our loop as + // we may have produced more data and the agent + // descriptors may have become readable or writ- + // able in the meanwhile. + // + + if (resultFDs >= 0) + { + // + // Save if the proxy can read from the + // the agent descriptor. + // + + agent -> saveChannelState(); + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Values were resultFDs " << resultFDs + << " errorFDs " << errorFDs << " setFDs " + << setFDs << ".\n" << logofs_flush; + #endif + + if (agent -> remoteCanRead(agent -> + getSavedReadMask()) == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Setting agent descriptor FD#" << agent -> + getRemoteFd() << " as ready to read.\n" + << logofs_flush; + #endif + + agent -> setRemoteRead(&readSet, &resultFDs); + } + + if (agent -> remoteCanWrite(agent -> + getSavedWriteMask()) == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Setting agent descriptor FD#" << agent -> + getRemoteFd() << " as ready to write.\n" + << logofs_flush; + #endif + + agent -> setRemoteWrite(&writeSet, &resultFDs); + } + + #if defined(TEST) || defined(INFO) + *logofs << "Loop: Values are now resultFDs " << resultFDs + << " errorFDs " << errorFDs << " setFDs " + << setFDs << ".\n" << logofs_flush; + #endif + } +} + +static inline void handleReadableInLoop(int &resultFDs, fd_set &readSet) +{ + if (resultFDs > 0) + { + T_channel_type type = channel_none; + + const char *label = NULL; + int domain = -1; + int fd = -1; + + if (tcpFD != -1 && FD_ISSET(tcpFD, &readSet)) + { + type = channel_x11; + label = "X"; + domain = AF_INET; + fd = tcpFD; + + resultFDs--; + } + + if (unixFD != -1 && FD_ISSET(unixFD, &readSet)) + { + type = channel_x11; + label = "X"; + domain = AF_UNIX; + fd = unixFD; + + resultFDs--; + } + + if (cupsFD != -1 && FD_ISSET(cupsFD, &readSet)) + { + type = channel_cups; + label = "CUPS"; + domain = AF_INET; + fd = cupsFD; + + resultFDs--; + } + + if (auxFD != -1 && FD_ISSET(auxFD, &readSet)) + { + // + // Starting from version 1.5.0 we create real X + // connections for the keyboard channel, so they + // can use the fake authorization cookie. This + // means that there is not such a thing like a + // channel_aux anymore. + // + + type = channel_x11; + label = "auxiliary X11"; + domain = AF_INET; + fd = auxFD; + + resultFDs--; + } + + if (smbFD != -1 && FD_ISSET(smbFD, &readSet)) + { + type = channel_smb; + label = "SMB"; + domain = AF_INET; + fd = smbFD; + + resultFDs--; + } + + if (mediaFD != -1 && FD_ISSET(mediaFD, &readSet)) + { + type = channel_media; + label = "media"; + domain = AF_INET; + fd = mediaFD; + + resultFDs--; + } + + if (httpFD != -1 && FD_ISSET(httpFD, &readSet)) + { + type = channel_http; + label = "HTTP"; + domain = AF_INET; + fd = httpFD; + + resultFDs--; + } + + if (fontFD != -1 && FD_ISSET(fontFD, &readSet)) + { + type = channel_font; + label = "font server"; + domain = AF_INET; + fd = fontFD; + + resultFDs--; + } + + if (slaveFD != -1 && FD_ISSET(slaveFD, &readSet)) + { + type = channel_slave; + label = "slave"; + domain = AF_INET; + fd = slaveFD; + + resultFDs--; + } + + if (type != channel_none) + { + int newFD = AcceptConnection(fd, domain, label); + + if (newFD != -1) + { + if (proxy -> handleNewConnection(type, newFD) < 0) + { + #ifdef PANIC + *logofs << "Loop: PANIC! Error creating new " << label + << " connection.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Error creating new " << label + << " connection.\n"; + + close(newFD); + + // + // Don't kill the proxy in the case of an error. + // + // HandleCleanup(); + // + } + else if (proxy -> getReadable(newFD) > 0) + { + // + // Add the descriptor, so we can try + // to read immediately. + // + + #ifdef TEST + *logofs << "Loop: Trying to read immediately " + << "from descriptor FD#" << newFD + << ".\n" << logofs_flush; + #endif + + FD_SET(newFD, &readSet); + + resultFDs++; + } + #ifdef TEST + else + { + *logofs << "Loop: Nothing to read immediately " + << "from descriptor FD#" << newFD + << ".\n" << logofs_flush; + } + #endif + } + } + } + + #ifdef DEBUG + *logofs << "Loop: Going to check the readable descriptors.\n" + << logofs_flush; + #endif + + if (proxy -> handleRead(resultFDs, readSet) < 0) + { + #ifdef TEST + *logofs << "Loop: Failure reading from descriptors " + << "for proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + HandleShutdown(); + } +} + +static inline void handleWritableInLoop(int &resultFDs, fd_set &writeSet) +{ + #ifdef DEBUG + *logofs << "Loop: Going to check the writable descriptors.\n" + << logofs_flush; + #endif + + if (resultFDs > 0 && proxy -> handleFlush(resultFDs, writeSet) < 0) + { + #ifdef TEST + *logofs << "Loop: Failure writing to descriptors " + << "for proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + HandleShutdown(); + } +} + +static inline void handleFlushInLoop() +{ + #ifdef DEBUG + *logofs << "Loop: Going to flush any data to the proxy.\n" + << logofs_flush; + #endif + + if (agent == NULL || control -> + FlushPolicy == policy_immediate) + { + #if defined(TEST) || defined(INFO) + + if (usePolicy == -1 && control -> + ProxyMode == proxy_client) + { + *logofs << "Loop: WARNING! Flushing the proxy link " + << "on behalf of the agent.\n" << logofs_flush; + } + + #endif + + if (proxy -> handleFlush() < 0) + { + #ifdef TEST + *logofs << "Loop: Failure flushing the proxy FD#" + << proxyFD << ".\n" << logofs_flush; + #endif + + HandleShutdown(); + } + } +} + +static inline void handleRotateInLoop() +{ + #ifdef DEBUG + *logofs << "Loop: Going to rotate channels " + << "for proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + proxy -> handleRotate(); +} + +static inline void handleEventsInLoop() +{ + #ifdef DEBUG + *logofs << "Loop: Going to check channel events " + << "for proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + if (proxy -> handleEvents() < 0) + { + #ifdef TEST + *logofs << "Loop: Failure handling channel events " + << "for proxy FD#" << proxyFD << ".\n" + << logofs_flush; + #endif + + HandleShutdown(); + } +} + +static void handleLogReopenInLoop(T_timestamp &logsTs, T_timestamp &nowTs) +{ + // + // If need to limit the size of the + // log file, check the size at each + // loop. + // + + #ifndef QUOTA + + if (diffTimestamp(logsTs, nowTs) > control -> FileSizeCheckTimeout) + + #endif + { + #ifdef DEBUG + *logofs << "Loop: Checking size of log file '" + << errorsFileName << "'.\n" << logofs_flush; + #endif + + #ifndef MIXED + + if (ReopenLogFile(errorsFileName, logofs, control -> FileSizeLimit) < 0) + { + HandleShutdown(); + } + + #endif + + // + // Reset to current timestamp. + // + + logsTs = nowTs; + } +} + +static inline void handleSetReadInLoop(fd_set &readSet, int &setFDs, struct timeval &selectTs) +{ + proxy -> setReadDescriptors(&readSet, setFDs, selectTs); +} + +static inline void handleSetWriteInLoop(fd_set &writeSet, int &setFDs, struct timeval &selectTs) +{ + proxy -> setWriteDescriptors(&writeSet, setFDs, selectTs); +} + +static void handleSetListenersInLoop(fd_set &readSet, int &setFDs) +{ + // + // Set descriptors of listening sockets. + // + + if (control -> ProxyMode == proxy_client) + { + if (useTcpSocket == 1) + { + FD_SET(tcpFD, &readSet); + + if (tcpFD >= setFDs) + { + setFDs = tcpFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener tcpFD " << tcpFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + + if (useUnixSocket == 1) + { + FD_SET(unixFD, &readSet); + + if (unixFD >= setFDs) + { + setFDs = unixFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener unixFD " << unixFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + + if (useCupsSocket == 1) + { + FD_SET(cupsFD, &readSet); + + if (cupsFD >= setFDs) + { + setFDs = cupsFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener cupsFD " << cupsFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + + if (useAuxSocket == 1) + { + FD_SET(auxFD, &readSet); + + if (auxFD >= setFDs) + { + setFDs = auxFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener auxFD " << auxFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + + if (useSmbSocket == 1) + { + FD_SET(smbFD, &readSet); + + if (smbFD >= setFDs) + { + setFDs = smbFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener smbFD " << smbFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + + if (useMediaSocket == 1) + { + FD_SET(mediaFD, &readSet); + + if (mediaFD >= setFDs) + { + setFDs = mediaFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener mediaFD " << mediaFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + + if (useHttpSocket == 1) + { + FD_SET(httpFD, &readSet); + + if (httpFD >= setFDs) + { + setFDs = httpFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener httpFD " << httpFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + } + else + { + if (useFontSocket == 1) + { + FD_SET(fontFD, &readSet); + + if (fontFD >= setFDs) + { + setFDs = fontFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener fontFD " << fontFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } + } + + if (useSlaveSocket == 1) + { + FD_SET(slaveFD, &readSet); + + if (slaveFD >= setFDs) + { + setFDs = slaveFD + 1; + } + + #ifdef DEBUG + *logofs << "Loop: Selected listener slaveFD " << slaveFD + << " with setFDs " << setFDs << ".\n" + << logofs_flush; + #endif + } +} diff --git a/nxcomp/src/MD5.c b/nxcomp/src/MD5.c new file mode 100644 index 000000000..7255ca5c0 --- /dev/null +++ b/nxcomp/src/MD5.c @@ -0,0 +1,403 @@ +/* + Copyright (C) 1999, 2000, 2002 Aladdin Enterprises. All rights reserved. + + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages + arising from the use of this software. + + Permission is granted to anyone to use this software for any purpose, + including commercial applications, and to alter it and redistribute it + freely, subject to the following restrictions: + + 1. The origin of this software must not be misrepresented; you must not + claim that you wrote the original software. If you use this software + in a product, an acknowledgment in the product documentation would be + appreciated but is not required. + 2. Altered source versions must be plainly marked as such, and must not be + misrepresented as being the original software. + 3. This notice may not be removed or altered from any source distribution. + + L. Peter Deutsch + ghost@aladdin.com + + */ +/* $Id: md5.c,v 1.6 2002/04/13 19:20:28 lpd Exp $ */ +/* + Independent implementation of MD5 (RFC 1321). + + This code implements the MD5 Algorithm defined in RFC 1321, whose + text is available at + http://www.ietf.org/rfc/rfc1321.txt + The code is derived from the text of the RFC, including the test suite + (section A.5) but excluding the rest of Appendix A. It does not include + any code or documentation that is identified in the RFC as being + copyrighted. + + The original and principal author of md5.c is L. Peter Deutsch + . Other authors are noted in the change history + that follows (in reverse chronological order): + + 2002-04-13 lpd Clarified derivation from RFC 1321; now handles byte order + either statically or dynamically; added missing #include + in library. + 2002-03-11 lpd Corrected argument list for main(), and added int return + type, in test program and T value program. + 2002-02-21 lpd Added missing #include in test program. + 2000-07-03 lpd Patched to eliminate warnings about "constant is + unsigned in ANSI C, signed in traditional"; made test program + self-checking. + 1999-11-04 lpd Edited comments slightly for automatic TOC extraction. + 1999-10-18 lpd Fixed typo in header comment (ansi2knr rather than md5). + 1999-05-03 lpd Original version. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "MD5.h" + +#include + +/* + * Try to determine the CPU endianess + * at compile time. + */ + +#if defined(__linux) || defined(__CYGWIN32__) + +#include + +#if (__BYTE_ORDER == __LITTLE_ENDIAN) +#define ARCH_IS_BIG_ENDIAN 0 +#else +#define ARCH_IS_BIG_ENDIAN 1 +#endif + +#endif /* #if defined(__linux) || defined(__CYGWIN32__) */ + +#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */ +#ifdef ARCH_IS_BIG_ENDIAN +# define BYTE_ORDER (ARCH_IS_BIG_ENDIAN ? 1 : -1) +#else +# define BYTE_ORDER 0 +#endif + +#define T_MASK ((md5_word_t)~0) +#define T1 /* 0xd76aa478 */ (T_MASK ^ 0x28955b87) +#define T2 /* 0xe8c7b756 */ (T_MASK ^ 0x173848a9) +#define T3 0x242070db +#define T4 /* 0xc1bdceee */ (T_MASK ^ 0x3e423111) +#define T5 /* 0xf57c0faf */ (T_MASK ^ 0x0a83f050) +#define T6 0x4787c62a +#define T7 /* 0xa8304613 */ (T_MASK ^ 0x57cfb9ec) +#define T8 /* 0xfd469501 */ (T_MASK ^ 0x02b96afe) +#define T9 0x698098d8 +#define T10 /* 0x8b44f7af */ (T_MASK ^ 0x74bb0850) +#define T11 /* 0xffff5bb1 */ (T_MASK ^ 0x0000a44e) +#define T12 /* 0x895cd7be */ (T_MASK ^ 0x76a32841) +#define T13 0x6b901122 +#define T14 /* 0xfd987193 */ (T_MASK ^ 0x02678e6c) +#define T15 /* 0xa679438e */ (T_MASK ^ 0x5986bc71) +#define T16 0x49b40821 +#define T17 /* 0xf61e2562 */ (T_MASK ^ 0x09e1da9d) +#define T18 /* 0xc040b340 */ (T_MASK ^ 0x3fbf4cbf) +#define T19 0x265e5a51 +#define T20 /* 0xe9b6c7aa */ (T_MASK ^ 0x16493855) +#define T21 /* 0xd62f105d */ (T_MASK ^ 0x29d0efa2) +#define T22 0x02441453 +#define T23 /* 0xd8a1e681 */ (T_MASK ^ 0x275e197e) +#define T24 /* 0xe7d3fbc8 */ (T_MASK ^ 0x182c0437) +#define T25 0x21e1cde6 +#define T26 /* 0xc33707d6 */ (T_MASK ^ 0x3cc8f829) +#define T27 /* 0xf4d50d87 */ (T_MASK ^ 0x0b2af278) +#define T28 0x455a14ed +#define T29 /* 0xa9e3e905 */ (T_MASK ^ 0x561c16fa) +#define T30 /* 0xfcefa3f8 */ (T_MASK ^ 0x03105c07) +#define T31 0x676f02d9 +#define T32 /* 0x8d2a4c8a */ (T_MASK ^ 0x72d5b375) +#define T33 /* 0xfffa3942 */ (T_MASK ^ 0x0005c6bd) +#define T34 /* 0x8771f681 */ (T_MASK ^ 0x788e097e) +#define T35 0x6d9d6122 +#define T36 /* 0xfde5380c */ (T_MASK ^ 0x021ac7f3) +#define T37 /* 0xa4beea44 */ (T_MASK ^ 0x5b4115bb) +#define T38 0x4bdecfa9 +#define T39 /* 0xf6bb4b60 */ (T_MASK ^ 0x0944b49f) +#define T40 /* 0xbebfbc70 */ (T_MASK ^ 0x4140438f) +#define T41 0x289b7ec6 +#define T42 /* 0xeaa127fa */ (T_MASK ^ 0x155ed805) +#define T43 /* 0xd4ef3085 */ (T_MASK ^ 0x2b10cf7a) +#define T44 0x04881d05 +#define T45 /* 0xd9d4d039 */ (T_MASK ^ 0x262b2fc6) +#define T46 /* 0xe6db99e5 */ (T_MASK ^ 0x1924661a) +#define T47 0x1fa27cf8 +#define T48 /* 0xc4ac5665 */ (T_MASK ^ 0x3b53a99a) +#define T49 /* 0xf4292244 */ (T_MASK ^ 0x0bd6ddbb) +#define T50 0x432aff97 +#define T51 /* 0xab9423a7 */ (T_MASK ^ 0x546bdc58) +#define T52 /* 0xfc93a039 */ (T_MASK ^ 0x036c5fc6) +#define T53 0x655b59c3 +#define T54 /* 0x8f0ccc92 */ (T_MASK ^ 0x70f3336d) +#define T55 /* 0xffeff47d */ (T_MASK ^ 0x00100b82) +#define T56 /* 0x85845dd1 */ (T_MASK ^ 0x7a7ba22e) +#define T57 0x6fa87e4f +#define T58 /* 0xfe2ce6e0 */ (T_MASK ^ 0x01d3191f) +#define T59 /* 0xa3014314 */ (T_MASK ^ 0x5cfebceb) +#define T60 0x4e0811a1 +#define T61 /* 0xf7537e82 */ (T_MASK ^ 0x08ac817d) +#define T62 /* 0xbd3af235 */ (T_MASK ^ 0x42c50dca) +#define T63 0x2ad7d2bb +#define T64 /* 0xeb86d391 */ (T_MASK ^ 0x14792c6e) + + +static void +md5_process(md5_state_t *pms, const md5_byte_t *data /*[64]*/) +{ + md5_word_t + a = pms->abcd[0], b = pms->abcd[1], + c = pms->abcd[2], d = pms->abcd[3]; + md5_word_t t; +#if BYTE_ORDER > 0 + /* Define storage only for big-endian CPUs. */ + md5_word_t X[16]; +#else + /* Define storage for little-endian or both types of CPUs. */ + md5_word_t xbuf[16]; + const md5_word_t *X; +#endif + + { +#if BYTE_ORDER == 0 + /* + * Determine dynamically whether this is a big-endian or + * little-endian machine, since we can use a more efficient + * algorithm on the latter. + */ + static const int w = 1; + + if (*((const md5_byte_t *)&w)) /* dynamic little-endian */ +#endif +#if BYTE_ORDER <= 0 /* little-endian */ + { + /* + * On little-endian machines, we can process properly aligned + * data without copying it. + */ + if (!((data - (const md5_byte_t *)0) & 3)) { + /* data are properly aligned */ + X = (const md5_word_t *)data; + } else { + /* not aligned */ + memcpy(xbuf, data, 64); + X = xbuf; + } + } +#endif +#if BYTE_ORDER == 0 + else /* dynamic big-endian */ +#endif +#if BYTE_ORDER >= 0 /* big-endian */ + { + /* + * On big-endian machines, we must arrange the bytes in the + * right order. + */ + const md5_byte_t *xp = data; + int i; + +# if BYTE_ORDER == 0 + X = xbuf; /* (dynamic only) */ +# else +# define xbuf X /* (static only) */ +# endif + for (i = 0; i < 16; ++i, xp += 4) + xbuf[i] = xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24); + } +#endif + } + +#define ROTATE_LEFT(x, n) (((x) << (n)) | ((x) >> (32 - (n)))) + + /* Round 1. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + F(b,c,d) + X[k] + T[i]) <<< s). */ +#define F(x, y, z) (((x) & (y)) | (~(x) & (z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + F(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 0, 7, T1); + SET(d, a, b, c, 1, 12, T2); + SET(c, d, a, b, 2, 17, T3); + SET(b, c, d, a, 3, 22, T4); + SET(a, b, c, d, 4, 7, T5); + SET(d, a, b, c, 5, 12, T6); + SET(c, d, a, b, 6, 17, T7); + SET(b, c, d, a, 7, 22, T8); + SET(a, b, c, d, 8, 7, T9); + SET(d, a, b, c, 9, 12, T10); + SET(c, d, a, b, 10, 17, T11); + SET(b, c, d, a, 11, 22, T12); + SET(a, b, c, d, 12, 7, T13); + SET(d, a, b, c, 13, 12, T14); + SET(c, d, a, b, 14, 17, T15); + SET(b, c, d, a, 15, 22, T16); +#undef SET + + /* Round 2. */ + /* Let [abcd k s i] denote the operation + a = b + ((a + G(b,c,d) + X[k] + T[i]) <<< s). */ +#define G(x, y, z) (((x) & (z)) | ((y) & ~(z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + G(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 1, 5, T17); + SET(d, a, b, c, 6, 9, T18); + SET(c, d, a, b, 11, 14, T19); + SET(b, c, d, a, 0, 20, T20); + SET(a, b, c, d, 5, 5, T21); + SET(d, a, b, c, 10, 9, T22); + SET(c, d, a, b, 15, 14, T23); + SET(b, c, d, a, 4, 20, T24); + SET(a, b, c, d, 9, 5, T25); + SET(d, a, b, c, 14, 9, T26); + SET(c, d, a, b, 3, 14, T27); + SET(b, c, d, a, 8, 20, T28); + SET(a, b, c, d, 13, 5, T29); + SET(d, a, b, c, 2, 9, T30); + SET(c, d, a, b, 7, 14, T31); + SET(b, c, d, a, 12, 20, T32); +#undef SET + + /* Round 3. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + H(b,c,d) + X[k] + T[i]) <<< s). */ +#define H(x, y, z) ((x) ^ (y) ^ (z)) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + H(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 5, 4, T33); + SET(d, a, b, c, 8, 11, T34); + SET(c, d, a, b, 11, 16, T35); + SET(b, c, d, a, 14, 23, T36); + SET(a, b, c, d, 1, 4, T37); + SET(d, a, b, c, 4, 11, T38); + SET(c, d, a, b, 7, 16, T39); + SET(b, c, d, a, 10, 23, T40); + SET(a, b, c, d, 13, 4, T41); + SET(d, a, b, c, 0, 11, T42); + SET(c, d, a, b, 3, 16, T43); + SET(b, c, d, a, 6, 23, T44); + SET(a, b, c, d, 9, 4, T45); + SET(d, a, b, c, 12, 11, T46); + SET(c, d, a, b, 15, 16, T47); + SET(b, c, d, a, 2, 23, T48); +#undef SET + + /* Round 4. */ + /* Let [abcd k s t] denote the operation + a = b + ((a + I(b,c,d) + X[k] + T[i]) <<< s). */ +#define I(x, y, z) ((y) ^ ((x) | ~(z))) +#define SET(a, b, c, d, k, s, Ti)\ + t = a + I(b,c,d) + X[k] + Ti;\ + a = ROTATE_LEFT(t, s) + b + /* Do the following 16 operations. */ + SET(a, b, c, d, 0, 6, T49); + SET(d, a, b, c, 7, 10, T50); + SET(c, d, a, b, 14, 15, T51); + SET(b, c, d, a, 5, 21, T52); + SET(a, b, c, d, 12, 6, T53); + SET(d, a, b, c, 3, 10, T54); + SET(c, d, a, b, 10, 15, T55); + SET(b, c, d, a, 1, 21, T56); + SET(a, b, c, d, 8, 6, T57); + SET(d, a, b, c, 15, 10, T58); + SET(c, d, a, b, 6, 15, T59); + SET(b, c, d, a, 13, 21, T60); + SET(a, b, c, d, 4, 6, T61); + SET(d, a, b, c, 11, 10, T62); + SET(c, d, a, b, 2, 15, T63); + SET(b, c, d, a, 9, 21, T64); +#undef SET + + /* Then perform the following additions. (That is increment each + of the four registers by the value it had before this block + was started.) */ + pms->abcd[0] += a; + pms->abcd[1] += b; + pms->abcd[2] += c; + pms->abcd[3] += d; +} + +void +md5_init(md5_state_t *pms) +{ + pms->count[0] = pms->count[1] = 0; + pms->abcd[0] = 0x67452301; + pms->abcd[1] = /*0xefcdab89*/ T_MASK ^ 0x10325476; + pms->abcd[2] = /*0x98badcfe*/ T_MASK ^ 0x67452301; + pms->abcd[3] = 0x10325476; +} + +void +md5_append(md5_state_t *pms, const md5_byte_t *data, int nbytes) +{ + const md5_byte_t *p = data; + int left = nbytes; + int offset = (pms->count[0] >> 3) & 63; + md5_word_t nbits = (md5_word_t)(nbytes << 3); + + if (nbytes <= 0) + return; + + /* Update the message length. */ + pms->count[1] += nbytes >> 29; + pms->count[0] += nbits; + if (pms->count[0] < nbits) + pms->count[1]++; + + /* Process an initial partial block. */ + if (offset) { + int copy = (offset + nbytes > 64 ? 64 - offset : nbytes); + + memcpy(pms->buf + offset, p, copy); + if (offset + copy < 64) + return; + p += copy; + left -= copy; + md5_process(pms, pms->buf); + } + + /* Process full blocks. */ + for (; left >= 64; p += 64, left -= 64) + md5_process(pms, p); + + /* Process a final partial block. */ + if (left) + memcpy(pms->buf, p, left); +} + +void +md5_finish(md5_state_t *pms, md5_byte_t digest[16]) +{ + static const md5_byte_t pad[64] = { + 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 + }; + md5_byte_t data[8]; + int i; + + /* Save the length before padding. */ + for (i = 0; i < 8; ++i) + data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3)); + /* Pad to 56 bytes mod 64. */ + md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1); + /* Append the length. */ + md5_append(pms, data, 8); + for (i = 0; i < 16; ++i) + digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3)); +} diff --git a/nxcomp/src/Makefile.am b/nxcomp/src/Makefile.am new file mode 100644 index 000000000..2264cb347 --- /dev/null +++ b/nxcomp/src/Makefile.am @@ -0,0 +1,146 @@ +NULL = + +lib_LTLIBRARIES = libXcomp.la + +libXcomp_la_SOURCES = \ + ActionCache.cpp \ + Agent.cpp \ + Alpha.cpp \ + Auth.cpp \ + Bitmap.cpp \ + BlockCache.cpp \ + BlockCacheSet.cpp \ + ChangeGC.cpp \ + ChangeProperty.cpp \ + ChannelCache.cpp \ + Channel.cpp \ + ChannelEndPoint.cpp \ + CharCache.cpp \ + Children.cpp \ + ClearArea.cpp \ + ClientCache.cpp \ + ClientChannel.cpp \ + ClientProxy.cpp \ + ClientReadBuffer.cpp \ + ClientStore.cpp \ + Colormap.cpp \ + ConfigureWindow.cpp \ + Control.cpp \ + CopyArea.cpp \ + CreateGC.cpp \ + CreatePixmap.cpp \ + DecodeBuffer.cpp \ + EncodeBuffer.cpp \ + FillPoly.cpp \ + Fork.cpp \ + GenericChannel.cpp \ + GenericReadBuffer.cpp \ + GenericReply.cpp \ + GenericRequest.cpp \ + GetImage.cpp \ + GetImageReply.cpp \ + GetProperty.cpp \ + GetPropertyReply.cpp \ + ImageText16.cpp \ + ImageText8.cpp \ + IntCache.cpp \ + InternAtom.cpp \ + Jpeg.cpp \ + Keeper.cpp \ + List.cpp \ + ListFontsReply.cpp \ + Loop.cpp \ + Message.cpp \ + MD5.c \ + Misc.cpp \ + OpcodeStore.cpp \ + Pack.c \ + Pgn.cpp \ + Pipe.cpp \ + PolyArc.cpp \ + PolyFillArc.cpp \ + PolyFillRectangle.cpp \ + PolyLine.cpp \ + PolyPoint.cpp \ + PolySegment.cpp \ + PolyText16.cpp \ + PolyText8.cpp \ + Proxy.cpp \ + ProxyReadBuffer.cpp \ + PutImage.cpp \ + PutPackedImage.cpp \ + QueryFontReply.cpp \ + ReadBuffer.cpp \ + RenderAddGlyphs.cpp \ + RenderChangePicture.cpp \ + RenderComposite.cpp \ + RenderCompositeGlyphs.cpp \ + RenderCreateGlyphSet.cpp \ + RenderCreatePicture.cpp \ + RenderExtension.cpp \ + RenderFillRectangles.cpp \ + RenderFreeGlyphSet.cpp \ + RenderFreePicture.cpp \ + RenderGenericRequest.cpp \ + RenderPictureClip.cpp \ + RenderPictureFilter.cpp \ + RenderPictureTransform.cpp \ + RenderTrapezoids.cpp \ + RenderTriangles.cpp \ + Rgb.cpp \ + Rle.cpp \ + SendEvent.cpp \ + SequenceQueue.cpp \ + ServerCache.cpp \ + ServerChannel.cpp \ + ServerProxy.cpp \ + ServerReadBuffer.cpp \ + ServerStore.cpp \ + SetClipRectangles.cpp \ + SetUnpackAlpha.cpp \ + SetUnpackColormap.cpp \ + SetUnpackGeometry.cpp \ + ShapeExtension.cpp \ + Socket.cpp \ + Split.cpp \ + StaticCompressor.cpp \ + Statistics.cpp \ + Timestamp.cpp \ + TranslateCoords.cpp \ + Transport.cpp \ + Unpack.cpp \ + Vars.c \ + Version.c \ + WriteBuffer.cpp \ + XidCache.cpp \ + Z.cpp \ + $(NULL) + +libXcomp_la_LIBADD = \ + @JPEG_LIBS@ \ + @PNG_LIBS@ \ + @Z_LIBS@ \ + $(NULL) + +AM_CXXFLAGS = \ + $(BASE_CXXFLAGS) \ + $(JPEG_CFLAGS) \ + $(PNG_CFLAGS) \ + $(Z_CFLAGS) \ + $(NULL) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + $(NULL) + +libXcomp_la_LDFLAGS = -version-number @LT_COMP_VERSION@ -no-undefined + +libXcompincludedir = $(includedir)/nx +libXcompinclude_HEADERS = \ + $(top_srcdir)/include/MD5.h \ + $(top_srcdir)/include/NX.h \ + $(top_srcdir)/include/NXalert.h \ + $(top_srcdir)/include/NXpack.h \ + $(top_srcdir)/include/NXproto.h \ + $(top_srcdir)/include/NXvars.h \ + $(NULL) diff --git a/nxcomp/src/Message.cpp b/nxcomp/src/Message.cpp new file mode 100644 index 000000000..b75d90c24 --- /dev/null +++ b/nxcomp/src/Message.cpp @@ -0,0 +1,2343 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include + +#include + +#include "Misc.h" + +// +// We need channel's cache data. +// + +#include "Message.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. You also +// need to define DUMP in Misc.cpp +// if DUMP is defined here. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Define this to log when messages +// are allocated and deallocated. +// + +#undef REFERENCES + +// +// Keep track of how many bytes are +// occupied by cache. +// + +int MessageStore::totalLocalStorageSize_ = 0; +int MessageStore::totalRemoteStorageSize_ = 0; + +// +// These are used for reference count. +// + +#ifdef REFERENCES + +int Message::references_ = 0; +int MessageStore::references_ = 0; + +#endif + +// +// Here are the methods to handle cached messages. +// + +MessageStore::MessageStore(StaticCompressor *compressor) + + : compressor_(compressor) +{ + // + // Public members. + // + + enableCache = MESSAGE_ENABLE_CACHE; + enableData = MESSAGE_ENABLE_DATA; + enableSplit = MESSAGE_ENABLE_SPLIT; + enableCompress = MESSAGE_ENABLE_COMPRESS; + + dataLimit = MESSAGE_DATA_LIMIT; + dataOffset = MESSAGE_DATA_OFFSET; + + cacheSlots = MESSAGE_CACHE_SLOTS; + cacheThreshold = MESSAGE_CACHE_THRESHOLD; + cacheLowerThreshold = MESSAGE_CACHE_LOWER_THRESHOLD; + + #ifdef TEST + *logofs << "MessageStore: Static compressor is at " + << compressor_ << ".\n" << logofs_flush; + #endif + + md5_state_ = new md5_state_t(); + + #ifdef DEBUG + *logofs << "MessageStore: Created MD5 state for object at " + << this << ".\n" << logofs_flush; + #endif + + lastAdded = cacheSlots; + lastHit = 0; + lastRemoved = 0; + lastRated = nothing; + lastAction = is_discarded; + + // + // Private members. + // + + localStorageSize_ = 0; + remoteStorageSize_ = 0; + + #ifdef TEST + *logofs << "MessageStore: Size of total cache is " + << totalLocalStorageSize_ << " bytes at local side and " + << totalRemoteStorageSize_ << " bytes at remote side.\n" + << logofs_flush; + #endif + + messages_ = new T_messages(); + checksums_ = new T_checksums(); + + temporary_ = NULL; + + #ifdef REFERENCES + + references_++; + + *logofs << "MessageStore: Created new store at " + << this << "out of " << references_ + << " allocated stores.\n" << logofs_flush; + + #endif +} + +MessageStore::~MessageStore() +{ + // + // The virtual destructor of specialized class + // must get rid of both messages in container + // and temporary. + // + + #ifdef DEBUG + *logofs << "MessageStore: Deleting MD5 state for object at " + << this << ".\n" << logofs_flush; + #endif + + delete md5_state_; + + delete messages_; + delete checksums_; + + // + // Update the static members tracking + // size of total memory allocated for + // all stores. + // + + totalLocalStorageSize_ -= localStorageSize_; + totalRemoteStorageSize_ -= remoteStorageSize_; + + #ifdef TEST + *logofs << "MessageStore: Size of total cache is " + << totalLocalStorageSize_ << " bytes at local side and " + << totalRemoteStorageSize_ << " bytes at remote side.\n" + << logofs_flush; + #endif + + #ifdef REFERENCES + + references_--; + + *logofs << "MessageStore: Deleted store at " + << this << " out of " << references_ + << " allocated stores.\n" << logofs_flush; + + #endif +} + +// +// Here are the methods to parse and cache +// messages in the message stores. +// + +int MessageStore::parse(Message *message, int split, const unsigned char *buffer, + unsigned int size, T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian) +{ + // + // Save the message size as received on the link. + // This information will be used to create an ap- + // propriate buffer at the time the message will + // be unparsed. + // + + message -> size_ = size; + message -> i_size_ = identitySize(buffer, size); + message -> c_size_ = 0; + + validateSize(size); + + if (checksumAction == use_checksum) + { + beginChecksum(message); + + parseIdentity(message, buffer, size, bigEndian); + + identityChecksum(message, buffer, size, bigEndian); + + parseData(message, split, buffer, size, checksumAction, dataAction, bigEndian); + + endChecksum(message); + } + else + { + parseIdentity(message, buffer, size, bigEndian); + + parseData(message, split, buffer, size, checksumAction, dataAction, bigEndian); + } + + return 1; +} + +int MessageStore::parse(Message *message, const unsigned char *buffer, + unsigned int size, const unsigned char *compressedData, + const unsigned int compressedDataSize, + T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian) +{ + int offset = identitySize(buffer, size); + + message -> size_ = size; + message -> i_size_ = offset; + message -> c_size_ = compressedDataSize + offset; + + validateSize(message -> size_ - offset, compressedDataSize); + + if (checksumAction == use_checksum) + { + beginChecksum(message); + + parseIdentity(message, buffer, size, bigEndian); + + identityChecksum(message, buffer, size, bigEndian); + + parseData(message, buffer, size, compressedData, compressedDataSize, + checksumAction, dataAction, bigEndian); + + endChecksum(message); + } + else + { + parseIdentity(message, buffer, size, bigEndian); + + parseData(message, buffer, size, compressedData, compressedDataSize, + checksumAction, dataAction, bigEndian); + } + + return 1; +} + +int MessageStore::parseData(Message *message, int split, const unsigned char *buffer, + unsigned int size, T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian) +{ + if ((int) size > message -> i_size_) + { + unsigned int dataSize = size - message -> i_size_; + + if (checksumAction == use_checksum) + { + #ifdef DEBUG + *logofs << name() << ": Calculating checksum of object at " + << message << " with data size " << dataSize + << ".\n" << logofs_flush; + #endif + + dataChecksum(message, buffer, size, bigEndian); + } + + if (dataAction == discard_data) + { + #ifdef DEBUG + *logofs << name() << ": Discarded " << dataSize + << " bytes of plain data. Real size is " + << message -> size_ << " compressed size is " + << message -> c_size_ << ".\n" << logofs_flush; + #endif + + return 1; + } + + // + // Accept anyway data beyond the + // expected limit. + // + + #ifdef TEST + + if (dataSize > (unsigned int) dataLimit) + { + *logofs << name() << ": WARNING! Data is " << dataSize + << " bytes. Ignoring the established limit.\n" + << logofs_flush; + } + + #endif + + if (dataSize != message -> data_.size()) + { + #ifdef DEBUG + *logofs << name() << ": Data will be resized from " + << message -> data_.size() << " to hold a plain buffer of " + << dataSize << " bytes.\n" << logofs_flush; + #endif + + message -> data_.clear(); + + message -> data_.resize(dataSize); + } + + if (split == 0) + { + memcpy(message -> data_.begin(), buffer + message -> i_size_, dataSize); + } + #ifdef TEST + else + { + *logofs << name() << ": Not copied " << dataSize + << " bytes of fake data for the split message.\n" + << logofs_flush; + } + #endif + + #ifdef DEBUG + *logofs << name() << ": Parsed " << dataSize + << " bytes of plain data. Real size is " + << message -> size_ << " compressed size is " + << message -> c_size_ << ".\n" << logofs_flush; + #endif + } + + return 1; +} + +// +// Store the data part in compressed format. +// + +int MessageStore::parseData(Message *message, const unsigned char *buffer, + unsigned int size, const unsigned char *compressedData, + const unsigned int compressedDataSize, + T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian) +{ + if ((int) size > message -> i_size_) + { + unsigned int dataSize = size - message -> i_size_; + + if (checksumAction == use_checksum) + { + #ifdef DEBUG + *logofs << name() << ": Calculating checksum of object at " + << message << " with data size " << dataSize + << ".\n" << logofs_flush; + #endif + + dataChecksum(message, buffer, size, bigEndian); + } + + if (dataAction == discard_data) + { + #ifdef DEBUG + *logofs << name() << ": Discarded " << dataSize + << " bytes of compressed data. Real size is " + << message -> size_ << " compressed size is " + << message -> c_size_ << ".\n" << logofs_flush; + #endif + + return 1; + } + + #ifdef WARNING + if (dataSize > (unsigned int) dataLimit) + { + *logofs << name() << ": WARNING! Data is " << dataSize + << " bytes. Ignoring the established limit!\n" + << logofs_flush; + } + #endif + + dataSize = compressedDataSize; + + if (dataSize != message -> data_.size()) + { + #ifdef DEBUG + *logofs << name() << ": Data will be resized from " + << message -> data_.size() << " to hold a compressed buffer of " + << dataSize << " bytes.\n" << logofs_flush; + #endif + + message -> data_.clear(); + + message -> data_.resize(compressedDataSize); + } + + memcpy(message -> data_.begin(), compressedData, compressedDataSize); + + #ifdef DEBUG + *logofs << name() << ": Parsed " << dataSize + << " bytes of compressed data. Real size is " + << message -> size_ << " compressed size is " + << message -> c_size_ << ".\n" << logofs_flush; + #endif + } + + return 1; +} + +int MessageStore::unparseData(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) +{ + // + // Copy data, if any, to the buffer. + // + + if ((int) size > message -> i_size_) + { + // + // Check if message has been stored + // in compressed format. + // + + if (message -> c_size_ == 0) + { + memcpy(buffer + message -> i_size_, message -> data_.begin(), size - message -> i_size_); + + #ifdef DEBUG + *logofs << name() << ": Unparsed " << message -> size_ - message -> i_size_ + << " bytes of data to a buffer of " << message -> size_ - message -> i_size_ + << ".\n" << logofs_flush; + #endif + } + else + { + #ifdef DEBUG + *logofs << name() << ": Using static compressor at " << (void *) compressor_ + << ".\n" << logofs_flush; + #endif + + if (compressor_ -> + decompressBuffer(buffer + message -> i_size_, + size - message -> i_size_, + message -> data_.begin(), + message -> c_size_ - message -> i_size_) < 0) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Data decompression failed.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Data decompression failed.\n"; + + return -1; + } + + #ifdef DEBUG + *logofs << name() << ": Unparsed " << message -> c_size_ - message -> i_size_ + << " bytes of compressed data to a buffer of " + << message -> size_ - message -> i_size_ << ".\n" << logofs_flush; + #endif + } + } + + // + // We could write size to the buffer but this + // is something the channel class is doing by + // itself. + // + // PutUINT(size >> 2, buffer + 2, bigEndian); + // + + return 1; +} + +void MessageStore::dumpData(const Message *message) const +{ + #ifdef DUMP + + *logofs << name() << ": Dumping enumerated data:\n" << logofs_flush; + + DumpData(message -> data_.begin(), message -> data_.size()); + + #endif + + #ifdef DUMP + + *logofs << name() << ": Dumping checksum data:\n" << logofs_flush; + + DumpData(message -> md5_digest_, MD5_LENGTH); + + #endif +} + +T_checksum MessageStore::getChecksum(const unsigned char *buffer, + unsigned int size, int bigEndian) +{ + Message *message = getTemporary(); + + message -> size_ = size; + message -> i_size_ = identitySize(buffer, size); + message -> c_size_ = 0; + + validateSize(size); + + beginChecksum(message); + + // + // We don't need to extract the identity + // data from the buffer. + // + // parseIdentity(message, buffer, size, bigEndian); + // + + identityChecksum(message, buffer, size, bigEndian); + + parseData(message, 0, buffer, size, use_checksum, discard_data, bigEndian); + + endChecksum(message); + + // + // The caller will have to explicitly + // deallocated the memory after use. + // + + T_checksum checksum = new md5_byte_t[MD5_LENGTH]; + + memcpy(checksum, message -> md5_digest_, MD5_LENGTH); + + return checksum; +} + +int MessageStore::clean(T_checksum_action checksumAction) +{ + int position = lastRemoved + 1; + + if (position >= cacheSlots) + { + position = 0; + } + + #ifdef DEBUG + *logofs << name() << ": Searching a message to remove " + << "starting at position " << position + << " with " << checksums_ -> size() + << " elements in cache.\n" + << logofs_flush; + #endif + + while (position != lastRemoved) + { + #ifdef DEBUG + *logofs << name() << ": Examining position " + << position << ".\n" << logofs_flush; + #endif + + if ((*messages_)[position] != NULL) + { + if (getRating((*messages_)[position], rating_for_clean) == 0) + { + break; + } + else + { + untouch((*messages_)[position]); + } + } + + if (++position == cacheSlots) + { + #ifdef DEBUG + *logofs << name() << ": Rolled position at " + << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + position = 0; + } + } + + // + // If no message is a good candidate, + // then try the object at the next slot + // in respect to last element removed. + // + + if (position == lastRemoved) + { + position = lastRemoved + 1; + + if (position >= cacheSlots) + { + position = 0; + } + + if ((*messages_)[position] == NULL || + (*messages_)[position] -> locks_ != 0) + { + #ifdef DEBUG + *logofs << name() << ": WARNING! No message found " + << "to be actually removed.\n" + << logofs_flush; + #endif + + return nothing; + } + + #ifdef DEBUG + *logofs << name() << ": WARNING! Assuming object " + << "at position " << position << ".\n" + << logofs_flush; + #endif + } + + return position; +} + +// +// This is the insertion method used at local side +// side. Cache at remote side side will be kept in +// sync by telling the to other party where to +// store the message. +// + +int MessageStore::findOrAdd(Message *message, T_checksum_action checksumAction, + T_data_action dataAction, int &added, int &locked) +{ + if (checksumAction != use_checksum) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Internal error in context [A]. " + << "Cannot find or add message to repository " + << "without using checksum.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Internal error in context [A]. " + << "Cannot find or add message to repository " + << "without using checksum.\n"; + + HandleAbort(); + } + + // + // Set added to true only if message + // is inserted in cache. + // + + added = 0; + locked = 0; + + // + // First of all figure out where to + // store this object. + // + + #ifdef DEBUG + *logofs << name() << ": Searching an empty slot " + << "with last rated " << lastRated << " and " + << "last added " << lastAdded << ".\n" + << logofs_flush; + #endif + + int position = lastRated; + + if (position == nothing) + { + position = lastAdded + 1; + + if (position >= cacheSlots) + { + position = 0; + } + + #ifdef DEBUG + *logofs << name() << ": Searching an empty slot " + << "starting at position " << position + << " with " << checksums_ -> size() + << " elements in cache.\n" + << logofs_flush; + #endif + + while (position != lastAdded) + { + #ifdef DEBUG + *logofs << name() << ": Examining position " + << position << ".\n" << logofs_flush; + #endif + + if ((*messages_)[position] == NULL) + { + break; + } + else if (getRating((*messages_)[position], rating_for_insert) == 0) + { + break; + } + else + { + untouch((*messages_)[position]); + } + + if (++position == cacheSlots) + { + #ifdef DEBUG + *logofs << name() << ": Rolled position at " + << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + position = 0; + } + } + } + #ifdef DEBUG + else + { + *logofs << name() << ": Using last rated position " + << position << ".\n" << logofs_flush; + } + #endif + + // + // If we made an extensive check but did not + // find neither a free slot or a message to + // replace, assume slot at next position in + // respect to last added. This can happen if + // all objects in repository have got an hit + // recently. + // + + if (position == lastAdded) + { + position = lastAdded + 1; + + if (position >= cacheSlots) + { + position = 0; + } + + #ifdef DEBUG + *logofs << name() << ": WARNING! Assuming slot " + << "at position " << position << ".\n" + << logofs_flush; + #endif + } + #ifdef DEBUG + else + { + *logofs << name() << ": Found candidate slot " + << "at position " << position << ".\n" + << logofs_flush; + } + #endif + + // + // Save the search result so if the message + // is found in cache, we can use the slot + // at next run. + // + + lastRated = position; + + if ((*messages_)[position] != NULL && + (*messages_)[position] -> locks_ != 0) + { + #ifdef WARNING + *logofs << name() << ": WARNING! Insertion at position " + << position << " would replace a locked message. " + << "Forcing channel to discard the message.\n" + << logofs_flush; + #endif + + #ifdef TEST + *logofs << name() << ": Invalidating rating of object " + << "at position " << position << ".\n" + << logofs_flush; + #endif + + return (lastRated = nothing); + } + + if (checksumAction == use_checksum) + { + T_checksum checksum = getChecksum(message); + + #ifdef TEST + *logofs << name() << ": Searching checksum [" + << DumpChecksum(checksum) << "] in repository.\n" + << logofs_flush; + + #endif + + pair result; + + result = checksums_ -> insert(T_checksums::value_type(checksum, position)); + + // + // Message was found in cache or + // insertion couldn't take place. + // + + if (result.second == 0) + { + if (result.first == checksums_ -> end()) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Failed to insert object " + << "in the cache.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to insert object of type " + << name() << " in the cache.\n"; + + return nothing; + } + + // + // Message is in cache. + // + + #ifdef TEST + *logofs << name() << ": Object is already in cache " + << "at position " << (result.first) -> second + << ".\n" << logofs_flush; + #endif + + #ifdef DEBUG + + printStorageSize(); + + #endif + + // + // Message is locked, probably because + // it has not completely recomposed at + // remote side after a split. + // + + if ((*messages_)[(result.first) -> second] -> locks_ != 0) + { + #ifdef TEST + *logofs << name() << ": WARNING! Object at position " + << (result.first) -> second << " is locked.\n" + << logofs_flush; + #endif + + locked = 1; + } + + // + // Object got a hit, so prevent + // its removal. + // + + if (lastRated == (result.first) -> second) + { + #ifdef TEST + *logofs << name() << ": Resetting rating of object " + << "at position " << (result.first) -> second + << ".\n" << logofs_flush; + #endif + + lastRated = nothing; + } + + return (result.first) -> second; + } + + #ifdef DEBUG + *logofs << name() << ": Could not find message in cache.\n" + << logofs_flush; + #endif + } + + // + // Message not found in hash table (or insertion + // of checksum in hash table was not requested). + // Message was added to cache. + // + + added = 1; + + // + // Log data about the missed message. + // + + #ifdef TEST + + if (opcode() == X_PutImage || opcode() == X_NXPutPackedImage) + { + #ifdef WARNING + *logofs << name() << ": WARNING! Dumping identity of " + << "missed image object of type " << name() + << ".\n" << logofs_flush; + #endif + + dumpIdentity(message); + } + + #endif + + if ((*messages_)[position] != NULL) + { + #ifdef DEBUG + *logofs << name() << ": The message replaces " + << "the old one at position " << position + << ".\n" << logofs_flush; + #endif + + remove(position, checksumAction, dataAction); + } + + (*messages_)[position] = message; + + // + // We used the slot. Perform a new + // search at next run. + // + + lastRated = nothing; + + #ifdef TEST + *logofs << name() << ": Stored message object of size " + << plainSize(position) << " (" << message -> size_ + << "/" << message -> c_size_ << ") at position " + << position << ".\n" << logofs_flush; + #endif + + unsigned int localSize; + unsigned int remoteSize; + + storageSize(message, localSize, remoteSize); + + localStorageSize_ += localSize; + remoteStorageSize_ += remoteSize; + + totalLocalStorageSize_ += localSize; + totalRemoteStorageSize_ += remoteSize; + + #ifdef DEBUG + + printStorageSize(); + + #endif + + // + // Set hits and timestamp at insertion in cache. + // + + message -> hits_ = control -> StoreHitsAddBonus; + message -> last_ = (getTimestamp()).tv_sec; + + message -> locks_ = 0; + + #ifdef DEBUG + *logofs << name() << ": Set last hit of object at " + << strMsTimestamp() << " with a bonus of " + << message -> hits_ << ".\n" << logofs_flush; + #endif + + return position; +} + +// +// Add a parsed message to repository. It is normally used +// at decoding side or at encoding side when we load store +// from disk. To handle messages coming from network, the +// encoding side uses the optimized method findOrAdd(). +// + +int MessageStore::add(Message *message, const int position, + T_checksum_action checksumAction, T_data_action dataAction) +{ + if (position < 0 || position >= cacheSlots) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Cannot add a message " + << "at non existing position " << position + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot add a message " + << "at non existing position " << position + << ".\n"; + + HandleAbort(); + } + + if ((*messages_)[position] != NULL) + { + #ifdef DEBUG + *logofs << name() << ": The message will replace " + << "the old one at position " << position + << ".\n" << logofs_flush; + #endif + + remove(position, checksumAction, dataAction); + } + + #ifdef DEBUG + *logofs << name() << ": Inserting object in repository at position " + << position << ".\n" << logofs_flush; + #endif + + (*messages_)[position] = message; + + // + // Get the object's checksum value + // and insert it in the table. + // + + if (checksumAction == use_checksum) + { + #ifdef DEBUG + *logofs << name() << ": Inserting object's checksum in repository.\n"; + #endif + + T_checksum checksum = getChecksum(message); + + checksums_ -> insert(T_checksums::value_type(checksum, position)); + } + + #ifdef DEBUG + *logofs << name() << ": Stored message object of size " + << plainSize(position) << " (" << message -> size_ + << "/" << message -> c_size_ << ") at position " + << position << ".\n" << logofs_flush; + #endif + + unsigned int localSize; + unsigned int remoteSize; + + storageSize(message, localSize, remoteSize); + + localStorageSize_ += localSize; + remoteStorageSize_ += remoteSize; + + totalLocalStorageSize_ += localSize; + totalRemoteStorageSize_ += remoteSize; + + #ifdef DEBUG + + printStorageSize(); + + #endif + + // + // Set hits and timestamp at insertion in cache. + // + + message -> hits_ = control -> StoreHitsAddBonus; + message -> last_ = (getTimestamp()).tv_sec; + + message -> locks_ = 0; + + #ifdef DEBUG + *logofs << name() << ": Set last hit of object at " + << strMsTimestamp() << " with a bonus of " + << message -> hits_ << ".\n" << logofs_flush; + #endif + + return position; +} + +// +// The following functions don't modify data, +// so they are supposed to be called only at +// the encoding side. +// + +void MessageStore::updateData(const int position, unsigned int dataSize, + unsigned int compressedDataSize) +{ + Message *message = (*messages_)[position]; + + validateSize(dataSize, compressedDataSize); + + if (compressedDataSize != 0) + { + unsigned int localSize; + unsigned int remoteSize; + + storageSize(message, localSize, remoteSize); + + localStorageSize_ -= localSize; + remoteStorageSize_ -= remoteSize; + + totalLocalStorageSize_ -= localSize; + totalRemoteStorageSize_ -= remoteSize; + + message -> c_size_ = compressedDataSize + message -> i_size_; + + #ifdef TEST + + if (message -> size_ != (int) (dataSize + message -> i_size_)) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Size of object looks " + << message -> size_ << " bytes while it " + << "should be " << dataSize + message -> i_size_ + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Size of object looks " + << message -> size_ << " bytes while it " + << "should be " << dataSize + message -> i_size_ + << ".\n"; + + HandleAbort(); + } + + #endif + + storageSize(message, localSize, remoteSize); + + localStorageSize_ += localSize; + remoteStorageSize_ += remoteSize; + + totalLocalStorageSize_ += localSize; + totalRemoteStorageSize_ += remoteSize; + + #ifdef DEBUG + + printStorageSize(); + + #endif + } +} + +void MessageStore::updateData(const T_checksum checksum, unsigned int compressedDataSize) +{ + #ifdef TEST + *logofs << name() << ": Searching checksum [" + << DumpChecksum(checksum) << "] in repository.\n" + << logofs_flush; + #endif + + T_checksums::iterator found = checksums_ -> find(checksum); + + if (found != checksums_ -> end()) + { + Message *message = (*messages_)[found -> second]; + + #ifdef TEST + *logofs << name() << ": Message found in cache at " + << "position " << found -> second << " with size " + << message -> size_ << " and compressed size " + << message -> c_size_ << ".\n" << logofs_flush; + #endif + + updateData(found -> second, message -> size_ - + message -> i_size_, compressedDataSize); + } + #ifdef TEST + else if (checksums_ -> size() > 0) + { + *logofs << name() << ": WARNING! Can't locate the " + << "checksum [" << DumpChecksum(checksum) + << "] for the update.\n" << logofs_flush; + } + #endif +} + +// +// This function replaces the data part of the message +// and updates the information about its size. Split +// messages are advertised to the decoding side with +// their uncompressed size, data is then compressed +// before sending the first chunk. This function is +// called by the decoding side after the split message +// is fully recomposed to replace the dummy data and +// set the real size. +// + +void MessageStore::updateData(const int position, const unsigned char *newData, + unsigned int dataSize, unsigned int compressedDataSize) +{ + Message *message = (*messages_)[position]; + + validateSize(dataSize, compressedDataSize); + + #ifdef TEST + + if (message -> size_ != (int) (dataSize + message -> i_size_)) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Data of object looks " + << dataSize << " bytes while it " << "should be " + << message -> size_ - message -> i_size_ + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Data of object looks " + << dataSize << " bytes while it " << "should be " + << message -> size_ - message -> i_size_ + << ".\n"; + + HandleAbort(); + } + + #endif + + // + // A compressed data size of 0 means that + // message's data was not compressed. + // + + if (compressedDataSize != 0) + { + unsigned int localSize; + unsigned int remoteSize; + + storageSize(message, localSize, remoteSize); + + localStorageSize_ -= localSize; + remoteStorageSize_ -= remoteSize; + + totalLocalStorageSize_ -= localSize; + totalRemoteStorageSize_ -= remoteSize; + + if (message -> c_size_ != (int) compressedDataSize + + message -> i_size_) + { + #ifdef TEST + *logofs << name() << ": Resizing data of message at " + << "position " << position << " from " << message -> + c_size_ << " to " << compressedDataSize + + message -> i_size_ << " bytes.\n" + << logofs_flush; + #endif + + message -> data_.clear(); + + message -> data_.resize(compressedDataSize); + } + + memcpy(message -> data_.begin(), newData, compressedDataSize); + + #ifdef TEST + *logofs << name() << ": Data of message at position " + << position << " has size " << message -> data_.size() + << " and capacity " << message -> data_.capacity() + << ".\n" << logofs_flush; + #endif + + message -> c_size_ = compressedDataSize + message -> i_size_; + + storageSize(message, localSize, remoteSize); + + localStorageSize_ += localSize; + remoteStorageSize_ += remoteSize; + + totalLocalStorageSize_ += localSize; + totalRemoteStorageSize_ += remoteSize; + + #ifdef DEBUG + + printStorageSize(); + + #endif + } + else + { + #ifdef TEST + *logofs << name() << ": No changes to data size for message " + << "at position " << position << ".\n" << logofs_flush; + #endif + + memcpy(message -> data_.begin(), newData, dataSize); + } +} + +int MessageStore::remove(const int position, T_checksum_action checksumAction, + T_data_action dataAction) +{ + Message *message; + + if (position < 0 || position >= cacheSlots || + (message = (*messages_)[position]) == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Cannot remove " + << "a non existing message at position " + << position << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot remove " + << "a non existing message at position " + << position << ".\n"; + + HandleAbort(); + } + + #if defined(TEST) || defined(INFO) + + if (opcode() == X_PutImage || opcode() == X_NXPutPackedImage) + { + #ifdef WARNING + *logofs << name() << ": WARNING! Discarding image object " + << "of type " << name() << " at position " + << position << ".\n" << logofs_flush; + #endif + } + + #endif + + // + // The checksum is only stored at the encoding + // side. + // + + if (checksumAction == use_checksum) + { + #ifdef DEBUG + *logofs << name() << ": Removing checksum for object at " + << "position " << position << ".\n" << logofs_flush; + #endif + + // + // TODO: If we had stored the iterator and + // not the pointer to the message, we could + // have removed the message without having + // to look up the checksum. + // + + T_checksum checksum = getChecksum(message); + + #ifdef TEST + *logofs << name() << ": Searching checksum [" + << DumpChecksum(checksum) << "] in repository.\n" + << logofs_flush; + #endif + + T_checksums::iterator found = checksums_ -> find(checksum); + + if (found == checksums_ -> end()) + { + #ifdef PANIC + *logofs << name() << ": PANIC! No checksum found for " + << "object at position " << position << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No checksum found for " + << "object at position " << position << ".\n"; + + HandleAbort(); + } + + #ifdef TEST + + else if (position != found -> second) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Value of position for object " + << "doesn't match position " << position << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Value of position for object " + << "doesn't match position " << position << ".\n"; + + HandleAbort(); + } + + #endif + + checksums_ -> erase(found); + } + + #ifdef DEBUG + *logofs << name() << ": Removing message at position " + << position << " of size " << plainSize(position) + << " (" << message -> size_ << "/" << message -> c_size_ + << ").\n" << logofs_flush; + #endif + + unsigned int localSize; + unsigned int remoteSize; + + storageSize(message, localSize, remoteSize); + + localStorageSize_ -= localSize; + remoteStorageSize_ -= remoteSize; + + totalLocalStorageSize_ -= localSize; + totalRemoteStorageSize_ -= remoteSize; + + recycle(message); + + (*messages_)[position] = NULL; + + #ifdef DEBUG + + printStorageSize(); + + #endif + + return position; +} + +// +// This should only be called at encoding side. +// The decoding side can't rely on the counter +// as it is decremented by the encoding side +// every time the repository is searched for a +// message to be removed. +// + +int MessageStore::getRating(Message *message, T_rating type) const +{ + if (message -> locks_ != 0) + { + #ifdef TEST + *logofs << name() << ": Rate set to -1 as locks of object are " + << (int) message -> locks_ << ".\n" + << logofs_flush; + #endif + + return -1; + } + else if ((type == rating_for_clean || + (int) checksums_ -> size() == cacheSlots) && + message -> hits_ <= control -> StoreHitsLoadBonus) + { + // + // We don't have any free slot or we exceeded the + // available storage size. This is likely to happen + // after having loaded objects from persistent cache. + // It's not a bad idea to discard some messages that + // were restored but never referenced. + // + + #ifdef TEST + + if (type == rating_for_clean) + { + *logofs << name() << ": Rate set to 0 with hits " + << message -> hits_ << " as maximum storage size " + << "was exceeded.\n" << logofs_flush; + } + else + { + *logofs << name() << ": Rate set to 0 with hits " + << message -> hits_ << " as there are no available " + << "slots in store.\n" << logofs_flush; + } + + #endif + + return 0; + } + else if (type == rating_for_clean && + (getTimestamp()).tv_sec - message -> last_ >= + control -> StoreTimeLimit) + { + #ifdef TEST + *logofs << name() << ": Rate set to 0 as last hit of object was " + << (getTimestamp()).tv_sec - message -> last_ + << " seconds ago with limit set to " << control -> + StoreTimeLimit << ".\n" << logofs_flush; + #endif + + return 0; + } + else + { + #ifdef TEST + if (message -> hits_ < 0) + { + *logofs << name() << ": PANIC! Rate of object shouldn't be " + << message -> hits_ << ".\n" << logofs_flush; + + cerr << "Error" << ": Rate of object of type " << name() + << " shouldn't be " << message -> hits_ << ".\n"; + + HandleAbort(); + } + #endif + + #ifdef TEST + *logofs << name() << ": Rate of object is " << message -> hits_ + << " with last hit " << (getTimestamp()).tv_sec - + message -> last_ << " seconds ago.\n" + << logofs_flush; + #endif + + return message -> hits_; + } +} + +int MessageStore::touch(Message *message) const +{ + message -> last_ = (getTimestamp()).tv_sec; + + message -> hits_ += control -> StoreHitsTouch; + + if (message -> hits_ > control -> StoreHitsLimit) + { + message -> hits_ = control -> StoreHitsLimit; + } + + #ifdef TEST + *logofs << name() << ": Increased hits of object to " + << message -> hits_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + return message -> hits_; +} + +int MessageStore::untouch(Message *message) const +{ + message -> hits_ -= control -> StoreHitsUntouch; + + if (message -> hits_ < 0) + { + message -> hits_ = 0; + } + + #ifdef TEST + *logofs << name() << ": Decreased hits of object to " + << message -> hits_ << ".\n" + << logofs_flush; + #endif + + return message -> hits_; +} + +int MessageStore::lock(const int position) const +{ + Message *message = (*messages_)[position]; + + if (message == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Can't lock the null " + << "object at position " << position + << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << name() << ": Increasing locks of object to " + << (int) message -> locks_ + 1 << ".\n" + << logofs_flush; + #endif + + return ++(message -> locks_); +} + +int MessageStore::unlock(const int position) const +{ + Message *message = (*messages_)[position]; + + if (message == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Can't unlock the null " + << "object at position " << position + << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << name() << ": Decreasing locks of object to " + << (int) message -> locks_ - 1 << ".\n" + << logofs_flush; + #endif + + return --(message -> locks_); +} + +int MessageStore::saveStore(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian) +{ + Message *message; + + #ifdef TEST + *logofs << name() << ": Opcode of this store is " + << (unsigned int) opcode() << " default size of " + << "identity is " << dataOffset << ".\n" + << logofs_flush; + #endif + + unsigned char *identityBuffer = new unsigned char[dataOffset]; + unsigned char *sizeBuffer = new unsigned char[4 * 2]; + unsigned char *positionBuffer = new unsigned char[4]; + unsigned char *opcodeBuffer = new unsigned char[4]; + + #ifdef DUMP + + char *md5ClientDump = new char[dataOffset * 2 + 128]; + + #endif + + unsigned char value; + + int offset; + + int failed = 0; + + for (int position = 0; position < cacheSlots; position++) + { + message = (*messages_)[position]; + + // + // Don't save split messages. + // + + if (message != NULL && message -> locks_ == 0) + { + // + // Use the total size if offset is + // beyond the real end of message. + // + + offset = dataOffset; + + if (offset > message -> size_) + { + offset = message -> size_; + } + + #ifdef TEST + *logofs << name() << ": Going to save message at position " + << position << ".\n" << logofs_flush; + #endif + + value = 1; + + PutULONG(position, positionBuffer, bigEndian); + PutULONG(opcode(), opcodeBuffer, bigEndian); + + md5_append(md5StateClient, positionBuffer, 4); + md5_append(md5StateClient, opcodeBuffer, 4); + + #ifdef DUMP + + *logofs << "Name=" << name() << logofs_flush; + + sprintf(md5ClientDump," Pos=%d Op=%d\n", position, opcode()); + + *logofs << md5ClientDump << logofs_flush; + + #endif + + if (PutData(cachefs, &value, 1) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure writing " << 1 + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, &value, 1); + + PutULONG(message -> size_, sizeBuffer, bigEndian); + PutULONG(message -> c_size_, sizeBuffer + 4, bigEndian); + + // + // Note that the identity size is not saved with + // the message and will be determined from the + // data read when restoring the identity. + // + + if (PutData(cachefs, sizeBuffer, 4 * 2) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure writing " << 4 * 2 + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, sizeBuffer, 4 * 2); + md5_append(md5StateClient, sizeBuffer, 4 * 2); + + #ifdef DUMP + + sprintf(md5ClientDump, "size = %d c_size = %d\n", + message -> size_, message -> c_size_); + + *logofs << md5ClientDump << logofs_flush; + + #endif + + // + // Prepare a clean buffer for unparse. + // + + CleanData(identityBuffer, offset); + + unparseIdentity(message, identityBuffer, offset, bigEndian); + + if (PutData(cachefs, identityBuffer, offset) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure writing " << offset + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, identityBuffer, offset); + md5_append(md5StateClient, identityBuffer, offset); + + #ifdef DUMP + + for (int i = 0; i < offset; i++) + { + sprintf(md5ClientDump + (i * 2), "%02X", identityBuffer[i]); + } + + *logofs << "Identity = " << md5ClientDump << "\n" << logofs_flush; + + #endif + + // + // Set the real identity size before + // saving the data. + // + + offset = message -> i_size_; + + if (offset > message -> size_) + { + offset = message -> size_; + } + + if (checksumAction == use_checksum) + { + if (PutData(cachefs, message -> md5_digest_, MD5_LENGTH) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure writing " << MD5_LENGTH + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, message -> md5_digest_, MD5_LENGTH); + } + else if (dataAction == use_data) + { + int dataSize = (message -> c_size_ == 0 ? + message -> size_ - offset : + message -> c_size_ - offset); + if (dataSize > 0) + { + if (PutData(cachefs, message -> data_.begin(), dataSize) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure writing " << dataSize + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, message -> data_.begin(), dataSize); + } + } + } + else + { + #ifdef TEST + *logofs << name() << ": Not saving message at position " + << position << ".\n" << logofs_flush; + #endif + + value = 0; + + if (PutData(cachefs, &value, 1) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure writing " << 1 + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, &value, 1); + } + } + + if (failed == 1) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Write to persistent cache file failed.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Write to persistent cache file failed.\n"; + } + + delete [] identityBuffer; + delete [] sizeBuffer; + delete [] positionBuffer; + delete [] opcodeBuffer; + + #ifdef DUMP + + delete [] md5ClientDump; + + #endif + + return (failed == 0 ? 1 : -1); +} + +int MessageStore::loadStore(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction, + int bigEndian) +{ + Message *message; + + #ifdef TEST + *logofs << name() << ": Opcode of this store is " + << (unsigned int) opcode() << " default size of " + << "identity is " << dataOffset << " slots are " + << cacheSlots << ".\n" << logofs_flush; + #endif + + // + // If packed images or the render extension has been + // disabled we don't need to restore these messages + // in the cache. Encoding of RENDER in 1.4.0 is also + // changed so we want to skip messages saved using + // the old format. We want to restore all the other + // messages so we'll need to skip these one by one. + // + + int skip = 0; + + if ((opcode() == X_NXPutPackedImage && + control -> PersistentCacheLoadPacked == 0) || + (opcode() == X_NXInternalRenderExtension && + control -> PersistentCacheLoadRender == 0)) + { + #ifdef TEST + *logofs << name() << ": All messages for OPCODE#" + << (unsigned int) opcode() << " will be discarded.\n" + << logofs_flush; + #endif + + skip = 1; + } + + unsigned char *identityBuffer = new unsigned char[dataOffset]; + unsigned char *sizeBuffer = new unsigned char[4 * 2]; + + unsigned char value; + + int offset; + + int failed = 0; + + for (int position = 0; position < cacheSlots; position++) + { + if (GetData(cachefs, &value, 1) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure reading " << 1 + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, &value, 1); + + if (value == 1) + { + #ifdef TEST + *logofs << name() << ": Going to load message at position " + << position << ".\n" << logofs_flush; + #endif + + if (GetData(cachefs, sizeBuffer, 4 * 2) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure reading " << 4 * 2 + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, sizeBuffer, 4 * 2); + + message = getTemporary(); + + if (message == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Can't access temporary storage " + << "for message in context [B].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't access temporary storage " + << "for message in context [B].\n"; + + failed = 1; + + break; + } + + message -> size_ = GetULONG(sizeBuffer, bigEndian); + message -> c_size_ = GetULONG(sizeBuffer + 4, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Size is " << message -> size_ + << " compressed size is " << message -> c_size_ + << ".\n" << logofs_flush; + #endif + + // + // Use the total size if offset is + // beyond the real end of message. + // + + offset = dataOffset; + + if (offset > message -> size_) + { + offset = message -> size_; + } + + if (GetData(cachefs, identityBuffer, offset) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure reading " << offset + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, identityBuffer, offset); + + // + // Get the real identity size based on the value + // reported by the message store. The dataOffset + // value is guaranteed to be greater or equal to + // the maximum identity size of the messages in + // the major store. + // + + offset = identitySize(identityBuffer, offset); + + if (offset > message -> size_) + { + offset = message -> size_; + } + + message -> i_size_ = offset; + + // + // Get identity of message from the buffer we just + // created. Don't calculate neither checksum nor + // data, restore them from stream. Don't pass the + // message's size but the default size of identity. + // + + parseIdentity(message, identityBuffer, offset, bigEndian); + + if (checksumAction == use_checksum) + { + if (message -> md5_digest_ == NULL) + { + message -> md5_digest_ = new md5_byte_t[MD5_LENGTH]; + } + + if (GetData(cachefs, message -> md5_digest_, MD5_LENGTH) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure reading " << MD5_LENGTH + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + // + // Add message's checksum to checksum that will + // be saved together with this cache. Checksum + // will be verified when cache file is restored + // to ensure file is not corrupted. + // + + md5_append(md5StateStream, message -> md5_digest_, MD5_LENGTH); + + if (skip == 1) + { + #ifdef TEST + *logofs << name() << ": Discarding message for OPCODE#" + << (unsigned int) opcode() << ".\n" + << logofs_flush; + #endif + + continue; + } + } + else if (dataAction == use_data) + { + // + // Restore the data part. + // + + int dataSize = (message -> c_size_ == 0 ? + message -> size_ - offset : + message -> c_size_ - offset); + + if (dataSize < 0 || dataSize > control -> MaximumMessageSize) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Bad data size " + << dataSize << " loading persistent cache.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Bad data size " << dataSize + << " loading persistent cache.\n"; + + failed = 1; + + break; + } + else if (dataSize > 0) + { + // + // If need to skip the message let anyway + // it to be part of the calculated MD5. + // + + if (skip == 1) + { + unsigned char *dummy = new unsigned char[dataSize]; + + if (dummy == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Can't allocate dummy buffer " + << "of size " << dataSize << " loading cache.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate dummy buffer " + << "of size " << dataSize << " loading cache.\n"; + + failed = 1; + + break; + } + + if (GetData(cachefs, dummy, dataSize) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure reading " << dataSize + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + md5_append(md5StateStream, dummy, dataSize); + + delete [] dummy; + + #ifdef TEST + *logofs << name() << ": Discarding message for OPCODE#" + << (unsigned int) opcode() << ".\n" + << logofs_flush; + #endif + + continue; + } + else + { + message -> data_.clear(); + + message -> data_.resize(dataSize); + + if (GetData(cachefs, message -> data_.begin(), dataSize) < 0) + { + #ifdef DEBUG + *logofs << name() << ": PANIC! Failure reading " << dataSize + << " bytes.\n" << logofs_flush; + #endif + + failed = 1; + + break; + } + + // + // Add message's data to cache checksum. + // + + md5_append(md5StateStream, message -> data_.begin(), dataSize); + } + } + else + { + // + // We are here if data part is zero. + // + + if (skip == 1) + { + #ifdef TEST + *logofs << name() << ": Discarding message for OPCODE#" + << (unsigned int) opcode() << ".\n" + << logofs_flush; + #endif + + continue; + } + } + } + + int added; + + added = add(message, position, checksumAction, dataAction); + + if (added != position) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Can't store message " + << "in the cache at position " << position + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't store message " + << "in the cache at position " << position + << ".\n"; + + failed = 1; + + break; + } + else + { + // + // Replace default value of hits set by add + // function. Messages read from cache start + // with a lower bonus than fresh messages + // inserted. + // + + message -> hits_ = control -> StoreHitsLoadBonus; + + #ifdef DEBUG + *logofs << name() << ": Updated last hit of object at " + << strMsTimestamp() << " with a bonus of " + << message -> hits_ << ".\n" << logofs_flush; + #endif + + resetTemporary(); + } + } + else if ((*messages_)[position] != NULL) + { + #ifdef TEST + *logofs << name() << ": Going to remove message at position " + << position << ".\n" << logofs_flush; + #endif + + int removed; + + removed = remove(position, checksumAction, dataAction); + + if (removed != position) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Can't remove message from cache " + << "at position " << position << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't remove message from cache " + << "at position " << position << ".\n"; + + failed = 1; + + break; + } + } + #ifdef TEST + else + { + *logofs << name() << ": Not loading message at position " + << position << ".\n" << logofs_flush; + } + #endif + } + + #ifdef WARNING + + if (failed == 1) + { + *logofs << name() << ": WARNING! Read from persistent cache file failed.\n" + << logofs_flush; + } + + #endif + + delete [] identityBuffer; + delete [] sizeBuffer; + + return (failed == 0 ? 1 : -1); +} + +void MessageStore::storageSize(const Message *message, unsigned int &local, + unsigned int &remote) const +{ + local = remote = storage(); + + // + // Encoding side includes 48 bytes for + // the map of checksums and 24 bytes + // of adjustment for total overhead. + // + + local += MD5_LENGTH + 48 + 24; + + // + // At decoding side we include size of + // data part and 24 bytes of adjustment + // for total overhead. + // + + if (message -> c_size_ == 0) + { + remote += message -> size_ + 24; + } + else + { + remote += message -> c_size_ + 24; + } + + // + // Check if we are the encoding or the + // decoding side and, if needed, swap + // the values. + // + + if (message -> md5_digest_ == NULL) + { + unsigned int t = local; + + local = remote; + + remote = t; + } +} + +void MessageStore::printStorageSize() +{ + #ifdef TEST + + *logofs << name() << ": There are " + << checksums_ -> size() << " checksums in this store " + << "out of " << cacheSlots << " slots.\n" + << logofs_flush; + + *logofs << name() << ": Size of this store is " + << localStorageSize_ << " bytes at local side and " + << remoteStorageSize_ << " bytes at remote side.\n" + << logofs_flush; + + *logofs << name() << ": Size of total cache is " + << totalLocalStorageSize_ << " bytes at local side and " + << totalRemoteStorageSize_ << " bytes at remote side.\n" + << logofs_flush; + + #endif +} diff --git a/nxcomp/src/Message.h b/nxcomp/src/Message.h new file mode 100644 index 000000000..30883f101 --- /dev/null +++ b/nxcomp/src/Message.h @@ -0,0 +1,1089 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Message_H +#define Message_H + +#include + +#include "NXproto.h" + +#include "Misc.h" +#include "Control.h" + +#include "Types.h" +#include "Timestamp.h" + +#include "ActionCache.h" + +#include "StaticCompressor.h" + +// +// Forward class declarations. +// + +class ChannelCache; + +class EncodeBuffer; +class DecodeBuffer; + +class WriteBuffer; + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to know how many messages +// are allocated and deallocated. +// + +#undef REFERENCES + +// +// Set default values. We limit the maximum +// size of a request to 262144 but we need to +// consider the replies, whose size may be up +// to 4MB. +// + +#define MESSAGE_ENABLE_CACHE 0 +#define MESSAGE_ENABLE_DATA 0 +#define MESSAGE_ENABLE_SPLIT 0 +#define MESSAGE_ENABLE_COMPRESS 0 + +#define MESSAGE_DATA_LIMIT 4194304 - 4 +#define MESSAGE_DATA_OFFSET 4 + +#define MESSAGE_CACHE_SLOTS 6000 +#define MESSAGE_CACHE_THRESHOLD 50 +#define MESSAGE_CACHE_LOWER_THRESHOLD 5 + +// +// Base message class. +// + +class Message +{ + friend class MessageStore; + friend class RenderExtensionStore; + + public: + + Message() + { + hits_ = 0; + last_ = 0; + locks_ = 0; + + size_ = 0; + c_size_ = 0; + + md5_digest_ = NULL; + + #ifdef REFERENCES + + references_++; + + *logofs << "Message: Created new message at " + << this << " out of " << references_ + << " allocated messages.\n" + << logofs_flush; + + #endif + } + + Message(const Message &message) + { + size_ = message.size_; + c_size_ = message.c_size_; + i_size_ = message.i_size_; + + hits_ = message.hits_; + last_ = message.last_; + locks_ = message.locks_; + + data_ = message.data_; + + #ifdef REFERENCES + + references_++; + + *logofs << "Message: Creating new copied message at " + << this << " out of " << references_ + << " allocated messages.\n" + << logofs_flush; + #endif + + if (message.md5_digest_ != NULL) + { + md5_digest_ = new md5_byte_t[MD5_LENGTH]; + + memcpy(md5_digest_, message.md5_digest_, MD5_LENGTH); + + #ifdef DEBUG + *logofs << "Message: Created MD5 digest for object at " + << this << ".\n" << logofs_flush; + #endif + } + else + { + md5_digest_ = NULL; + } + } + + ~Message() + { + #ifdef DEBUG + if (md5_digest_ != NULL) + { + *logofs << "Message: Deleted MD5 digest for object at " + << this << ".\n" << logofs_flush; + } + #endif + + delete [] md5_digest_; + + #ifdef REFERENCES + + references_--; + + *logofs << "Message: Deleted message at " + << this << " out of " << references_ + << " allocated messages.\n" + << logofs_flush; + #endif + } + + // + // This is the original message size + // including the data part regardless + // data is still stored in the object. + // + + int size_; + + // + // This is the size of the identity. + // + + int i_size_; + + // + // This is the size, including identity, + // after message has been 'updated' to + // reflect storage of data in compressed + // format. + // + + int c_size_; + + protected: + + // + // This is the data part. + // + + T_data data_; + + // + // Time of last hit. + // + + time_t last_; + + // + // This is the number of cache hits + // registered for the object. + // + + short int hits_; + + // + // This is used to mark messages + // that have been split. + // + + short int locks_; + + // + // This is the MD5 checksum. + // + + md5_byte_t *md5_digest_; + + // + // Keep a reference counter + // of allocated objects. + // + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +// +// Repository of messages. +// + +class MessageStore +{ + public: + + // + // Enable or disable cache of messages in store. + // + + int enableCache; + + // + // Does message have a distinct data part. + // + + int enableData; + + // + // Enable or disable split of data part. + // + + int enableSplit; + + // + // Enable or disable compression of data part. + // + + int enableCompress; + + // + // Set starting point of data part in the message. + // + + int dataOffset; + + // + // Set maximum size for the data part of each message. + // + + int dataLimit; + + // + // Set maximum elements in cache. + // + + int cacheSlots; + + // + // Set the percentage of total cache memory which + // a given type of message is allowed to occupy. + // When threshold is exceeded store is cleaned to + // make room for a new message of the same type. + // + + int cacheThreshold; + + // + // Don't clean the store if percentage of cache + // memory occupied by messages of this type is + // below the threshold. + // + + int cacheLowerThreshold; + + // + // Last operation performed on cache. + // + + T_store_action lastAction; + + // + // Position of last element stored in cache. + // + + short int lastAdded; + + // + // Positions of last element found in cache. + // + + short int lastHit; + + // + // Position of last element erased. + // + + short int lastRemoved; + + // + // Used to encode the the action to + // perform on the store and the slot + // involved. + // + + ActionCache lastActionCache; + + // + // Position in cache where next insertion + // is going to take place. + // + + short int lastRated; + + // + // Constructors and destructors. + // + + public: + + MessageStore(StaticCompressor *compressor = NULL); + + virtual ~MessageStore(); + + virtual const char *name() const = 0; + + virtual unsigned char opcode() const = 0; + + virtual unsigned int storage() const = 0; + + // + // These are members that must be specialized. + // + + public: + + virtual Message *create() const = 0; + + virtual Message *create(const Message &message) const = 0; + + virtual void destroy(Message *message) const = 0; + + void validateSize(int size) + { + if (size < control -> MinimumMessageSize || + size > control -> MaximumMessageSize) + { + *logofs << name() << ": PANIC! Invalid size " << size + << " for message.\n" << logofs_flush; + + cerr << "Error" << ": Invalid size " << size + << " for message opcode " << opcode() << ".\n"; + + HandleAbort(); + } + } + + void validateSize(int dataSize, int compressedDataSize) + { + if (dataSize < 0 || dataSize > control -> + MaximumMessageSize - 4 || compressedDataSize < 0 || + compressedDataSize >= dataSize) + { + *logofs << name() << ": PANIC! Invalid data size " + << dataSize << " and compressed data size " + << compressedDataSize << " for message.\n" + << logofs_flush; + + cerr << "Error" << ": Invalid data size " + << dataSize << " and compressed data size " + << compressedDataSize << " for message " + << "opcode " << (unsigned) opcode() << ".\n"; + + HandleAbort(); + } + } + + // + // Determine if the message can be stored + // in the cache. + // + + virtual int validateMessage(const unsigned char *buffer, int size) + { + return (size >= control -> MinimumMessageSize && + size <= control -> MaximumMessageSize); + } + + // + // Get data offset based on major and minor + // opcode of the message. + // + + virtual int identitySize(const unsigned char *buffer, unsigned int size) + { + return dataOffset; + } + + // + // Encode identity and data using the + // specific message encoding. + // + // Some messages do not implement these + // methods because the encoding is done + // directly in the channel loop. Should + // move the encoding methods in in the + // message classes. + // + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const + { + return 1; + } + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const + { + return 1; + } + + // + // Encode differences between message + // in cache and the one to be encoded. + // + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, ChannelCache *channelCache) const + { + } + + // + // Decode differences and update the + // cached version of the same message. + // + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const + { + } + + // + // Post process the message information + // contained in the store by either up- + // dating the size record or the actual + // data part once the message has been + // completely sent to our peer. + // + + void updateData(const int position, unsigned int dataSize, + unsigned int compressedDataSize); + + void updateData(const T_checksum checksum, unsigned int compressedDataSize); + + void updateData(const int position, const unsigned char *newData, + unsigned int dataSize, unsigned int compressedDataSize); + + // + // These members, used internally + // in the message store class, are + // mandatory. + // + + protected: + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual void dumpIdentity(const Message *message) const = 0; + + // + // Design should preserve these from being + // virtual. + // + + int parseData(Message *message, int split, const unsigned char *buffer, + unsigned int size, T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian); + + int parseData(Message *message, const unsigned char *buffer, + unsigned int size, const unsigned char *compressedData, + const unsigned int compressedDataSize, T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian); + + int unparseData(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian); + + // + // Manage efficient allocation of messages + // in the heap. + // + + void recycle(Message *message) + { + #ifdef TEST + + if (message == NULL) + { + *logofs << name() << ": PANIC! Cannot recycle a null message.\n" + << logofs_flush; + + cerr << "Error" << ": Cannot recycle a null message.\n"; + + HandleAbort(); + } + + #endif + + if (temporary_ == NULL) + { + // + // Be careful when reusing the message as + // it can contain valid data that must be + // explicitly deallocated if not needed. + // Note also that you cannot count on the + // initialization made in costructor. + // + + temporary_ = message; + } + else + { + destroy(message); + } + } + + void beginChecksum(Message *message) + { + if (message -> md5_digest_ == NULL) + { + message -> md5_digest_ = new md5_byte_t[MD5_LENGTH]; + + #ifdef DEBUG + *logofs << name() << ": Created MD5 digest structure " + << "for object at " << message << ".\n" + << logofs_flush; + #endif + } + #ifdef DEBUG + else + { + *logofs << name() << ": Using existing MD5 digest structure " + << "for object at " << message << ".\n" + << logofs_flush; + } + #endif + + #ifdef DEBUG + *logofs << name() << ": Prepared MD5 digest for object at " + << message << ".\n" << logofs_flush; + #endif + + md5_init(md5_state_); + } + + void endChecksum(Message *message) + { + md5_finish(md5_state_, message -> md5_digest_); + + #ifdef DEBUG + *logofs << name() << ": Calculated checksum for object at " + << message << ".\n" << logofs_flush; + #endif + } + + void dataChecksum(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) + { + // + // Messages that have a data part starting + // at an offset possibly beyond the end of + // the message, must include the size in + // the identity checksum. + // + + if ((int) size > message -> i_size_) + { + md5_append(md5_state_, buffer + message -> i_size_, + size - message -> i_size_); + } + } + + // + // Repository handling methods. + // + + public: + + // + // Extract identity and data from buffer. + // The size field will be updated at the + // time of data parsing. + // + + int parse(Message *message, int split, const unsigned char *buffer, unsigned int size, + T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); + + int parse(Message *message, const unsigned char *buffer, unsigned int size, + const unsigned char *compressedData, const unsigned int compressedDataSize, + T_checksum_action checksumAction, T_data_action dataAction, int bigEndian); + + // + // From identity and data write the + // final message to the raw buffer. + // + + int unparse(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) + { + return (unparseData(message, buffer, size, bigEndian) && + unparseIdentity(message, buffer, size, bigEndian)); + } + + void dump(const Message *message) const + { + dumpIdentity(message); + + dumpData(message); + } + + void dumpData(const Message *message) const; + + // + // This returns the original message size as it + // was received on the link. It takes in account + // the data part, regardless data is still stored + // in the message object. This information will + // be used at the time message is unparsed. + // + + int plainSize(const int position) const + { + return (*messages_)[position] -> size_; + } + + // + // This returns either the size of identity plus + // the compressed data part or 0 if message is + // stored in uncompressed format. + // + + int compressedSize(const int position) const + { + return (*messages_)[position] -> c_size_; + } + + // + // Returns a pointer to message + // given its position in cache. + // + + Message *get(const int position) const + { + if (position < 0 || position >= cacheSlots) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Requested position " + << position << " is not inside the " + << "container.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Requested position " + << position << " is not inside the" + << "container.\n"; + + HandleAbort(); + } + else if ((*messages_)[position] == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Message at position " + << position << " is NULL.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Message at position " + << position << " is NULL.\n"; + + HandleAbort(); + } + + return (*messages_)[position]; + } + + // + // This is the method called at encoding + // side to add a message to cache. + // + + int findOrAdd(Message *message, T_checksum_action checksumAction, + T_data_action dataAction, int &added, int &locked); + + // + // Utility interfaces to message insertion + // and deletion. + // + + int add(Message *message, const int position, + T_checksum_action checksumAction, T_data_action dataAction); + + int remove(const int position, T_checksum_action checksumAction, + T_data_action dataAction); + + // + // Make space in the repository by remove + // the first suitable message object. + // + + int clean(T_checksum_action checksumAction); + + // + // Increase or decrease the "rating" of + // the message object. + // + + int touch(Message *message) const; + int untouch(Message *message) const; + + int getTouches(const int position) const + { + Message *message = (*messages_)[position]; + + if (message == NULL) + { + return 0; + } + + return message -> hits_; + } + + // + // Gives a 'weight' to the cached message. A zero + // value means object can be safely removed. A value + // greater than zero means it is advisable to retain + // the object. A negative result means it is mandato- + // ry to keep object in cache. + // + + int getRating(Message *message, T_rating type) const; + + // + // Increase or decrease locks of message at given + // position. A locked message will not be removed + // from the message store until the lock counter + // is zero. + // + + int lock(const int position) const; + int unlock(const int position) const; + + int getLocks(const int position) const + { + Message *message = (*messages_)[position]; + + if (message == NULL) + { + return 0; + } + + return message -> locks_; + } + + T_checksum const getChecksum(const int position) const + { + return getChecksum(get(position)); + } + + T_checksum const getChecksum(const Message *message) const + { + if (message -> md5_digest_ == NULL) + { + #ifdef PANIC + *logofs << name() << ": PANIC! Checksum not initialized " + << "for object at " << message << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Checksum not initialized " + << "for object at " << message << ".\n"; + + HandleAbort(); + } + + #ifdef DEBUG + *logofs << name() << ": Got checksum for object at " + << message << ".\n" << logofs_flush; + #endif + + return message -> md5_digest_; + } + + // + // Calculate the checksum on the fly based the + // opcode in the buffer. Useful in the case a + // message was not processed or was not stored + // in the cache. The returned checksum must be + // explicitly deallocated by the caller, after + // use. + // + + T_checksum getChecksum(const unsigned char *buffer, + unsigned int size, int bigEndian); + + const unsigned char *getData(const Message *message) const + { + return message -> data_.begin(); + } + + int plainSize(const Message *message) const + { + return message -> size_; + } + + int identitySize(Message *message) + { + return message -> i_size_; + } + + int compressedSize(const Message *message) const + { + return message -> c_size_; + } + + Message *getTemporary() + { + if (temporary_ == NULL) + { + temporary_ = create(); + } + + return temporary_; + } + + void resetTemporary() + { + temporary_ = NULL; + } + + // + // On side where we don't have checksums, we + // count how many messages are in the array. + // This is obviously expensive and should be + // only performed when reporting statistics. + // + + int getSize() const + { + int size = checksums_ -> size(); + + if (size == 0) + { + for (int i = 0; i < cacheSlots; i++) + { + if ((*messages_)[i] != NULL) + { + size++; + } + } + } + + return size; + } + + int getLocalStorageSize() const + { + return localStorageSize_; + } + + int getRemoteStorageSize() const + { + return remoteStorageSize_; + } + + int getLocalTotalStorageSize() const + { + return totalLocalStorageSize_; + } + + int getRemoteTotalStorageSize() const + { + return totalRemoteStorageSize_; + } + + static int getCumulativeTotalStorageSize() + { + return (totalLocalStorageSize_ > totalRemoteStorageSize_ ? + totalLocalStorageSize_ : totalRemoteStorageSize_); + } + + int saveStore(ostream *cachefs, md5_state_t *md5_state_stream, + md5_state_t *md5_state_client, T_checksum_action checksumAction, + T_data_action dataAction, int bigEndian); + + int loadStore(istream *cachefs, md5_state_t *md5_state_stream, + T_checksum_action checksumAction, T_data_action dataAction, + int bigEndian); + + protected: + + // + // Estimate the memory requirements of given + // instance of message. Size includes memory + // allocated from heap to store checksum and + // data. + // + + void storageSize(const Message *message, unsigned int &local, + unsigned int &remote) const; + + // + // Just used for debug. + // + + void printStorageSize(); + + // + // Repositories where to save cached messages. + // First is a vector of pointers, the second + // is a hash table used for fast lookups. + // + + T_messages *messages_; + T_checksums *checksums_; + + // + // A message object to be used as a temporary. + // Reuse the temporary object if possible, if + // not, create a new instance. + // + + Message *temporary_; + + // + // Used to calculate message's checksum. + // + + md5_state_t *md5_state_; + + private: + + // + // Used to compress data payload. + // + + StaticCompressor *compressor_; + + // + // Keep track of how many bytes + // are taken by cache. + // + + int localStorageSize_; + int remoteStorageSize_; + + static int totalLocalStorageSize_; + static int totalRemoteStorageSize_; + + // + // Used to track object allocation and deallocation. + // + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +// +// This is an ancillary class of the message +// store, used to encode extensions based on +// the minor opcode. +// + +class MinorMessageStore +{ + public: + + virtual ~MinorMessageStore() + { + } + + virtual const char *name() const = 0; + + virtual int identitySize(const unsigned char *buffer, unsigned int size) = 0; + + virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const + { + return 1; + } + + virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, unsigned char type, int bigEndian, + WriteBuffer *writeBuffer, ChannelCache *channelCache) const + { + return 1; + } + + virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const + { + } + + virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const + { + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const + { + } + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const + { + } + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, md5_state_t *md5_state, + int bigEndian) const = 0; +}; + +#endif /* Message_H */ + diff --git a/nxcomp/src/Misc.cpp b/nxcomp/src/Misc.cpp new file mode 100644 index 000000000..b40e6409e --- /dev/null +++ b/nxcomp/src/Misc.cpp @@ -0,0 +1,1934 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#include "NXproto.h" + +#include "MD5.h" + +#include "Misc.h" +#include "Proxy.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#define OPCODES +#undef TEST +#undef DEBUG + +// +// By default nxproxy binds to all network interfaces, setting +// DEFAULT_LOOPBACK_BIND to 1 enables binding to the loopback +// device only. +// + +const int DEFAULT_LOOPBACK_BIND = 0; + +// +// TCP port offset applied to any NX port specification. +// + +const int DEFAULT_NX_PROXY_PORT_OFFSET = 4000; + +// +// Default TCP port used by client proxy to listen to +// X clients and by server proxy to connect to remote. +// + +const int DEFAULT_NX_PROXY_PORT = 8; + +// +// Default X display number that client proxy imitates. +// + +const int DEFAULT_NX_X_PORT = 8; + +// +// Default ports used for listening for cups, samba, http, +// multimedia and auxiliary X connections. Arbitrary ports +// can be used by passing the service's port at the proxy +// startup. By default ports are determined by adding the +// offset below to the offset of the proxied display. For +// example, if the proxy is impersonating the display :8, +// SMB tunnels can be created by connecting to port 3008. +// +// Considering that the NX server uses to start the first +// session at display offset 1000, we must lower the CUPS +// and SMB ports to avoid interference with normal X ses- +// sions run on the server. +// +// Font server connections are used to let the X server on +// the client connect to a font server on the NX server. +// +// Slave channels can be originated by both sides so we need +// different offsets in the case the user runs both proxies +// on the same host. +// + +const int DEFAULT_NX_CUPS_PORT_OFFSET = 2000; +const int DEFAULT_NX_SMB_PORT_OFFSET = 3000; +const int DEFAULT_NX_MEDIA_PORT_OFFSET = 7000; +const int DEFAULT_NX_AUX_PORT_OFFSET = 8000; +const int DEFAULT_NX_HTTP_PORT_OFFSET = 9000; +const int DEFAULT_NX_FONT_PORT_OFFSET = 10000; + +const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET = 11000; +const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET = 12000; + +// +// Usage info and copyright. +// + +static const char UsageInfo[] = +"\n\ + Usage: nxproxy [OPTIONS] host:port\n\ +\n\ + -C Specify that nxproxy has to run on the 'X client'\n\ + side, listening for connections and impersonating\n\ + an X server.\n\ +\n\ + -S Specify that nxproxy has to run in 'X server' mode,\n\ + thus forwarding the connections to daemons running\n\ + on the client.\n\ +\n\ + -h Print this message.\n\ +\n\ + -v Print version information.\n\ +\n\ + host:port Put at the end, specifies the host and port of the\n\ + listening proxy.\n\ +\n\ + name=value Set the NX option to the provided value.\n\ +\n\ + Multiple NX options can be specified in the DISPLAY environment\n\ + or on the command line, by using the nx/nx,option=value notation.\n\ +\n\ + Options:\n\ +\n\ + link=s An indication of the link speed that is going to be\n\ + used between the proxies. Usually the compression\n\ + and the other link parameters depend on this setting.\n\ + The value can be either 'modem', 'isdn', 'adsl',\n\ + 'wan', 'lan', 'local' or a bandwidth specification,\n\ + like for example '56k', '1m', '100m', etc.\n\ +\n\ + type=s Type of session, for example 'windows', 'unix-kde'.\n\ + 'unix-application', etc.\n\ +\n\ + display=s Specify the real display where X connections have\n\ + to be forwarded by the proxy running on the client.\n\ +\n\ + listen=n Local port used for accepting the proxy connection.\n\ +\n\ + loopback=b Bind to the loopback device only.\n\ +\n\ + accept=s Name or IP of host that can connect to the proxy.\n\ +\n\ + connect=s Name or IP of host that the proxy will connect to.\n\ +\n\ + port=n Remote port used for the connection.\n\ +\n\ + retry=n Number of connection atempts.\n\ +\n\ + root=s The root directory for the session. Usually is the\n\ + C-* or S-* in the .nx directory in the user's home,\n\ + with '*' being the virtual display.\n\ +\n\ + session=s Name of the session file. The default is the name\n\ + 'session' in the session directory.\n\ +\n\ + errors=s Name of the log file used by the proxy. The default\n\ + is the name 'errors' in the session directory.\n\ +\n\ + stats=s Name of the file where are written the proxy stat-\n\ + istics. The default is a file 'stats' in the session\n\ + directory. The proxy replaces the data in the file\n\ + whenever it receives a SIGUSR1 or SIGUSR2 signal:\n\ +\n\ + SIGUSR1 Gives total statistics, i.e. statistics\n\ + collected since the beginning of the\n\ + session.\n\ +\n\ + SIGUSR2 Gives partial statistics, i.e. statist-\n\ + ics collected since the last time this\n\ + signal was received.\n\ +\n\ + cookie=s Use the provided cookie for authenticating to the\n\ + remote proxy. The same cookie is used as the fake\n\ + value used for the X authorization. The fake cookie\n\ + is replaced on the X server side with the real cookie\n\ + to be used for the display, so that the real cookie\n\ + doesn't have to travel over the net. When not using\n\ + a proxy cookie, any host will be able to connect to\n\ + the proxy. See also the 'accept' parameter.\n\ +\n\ + nodelay=b A boolean indicating if TCP_NODELAY has to be set\n\ + on the proxy link. Old Linux kernels had problems\n\ + with handling TCP_NODELAY on PPP links.\n\ +\n\ + policy=b Let or not the agent decide when it is the best time\n\ + to flush the proxy link. If set to 0, the proxy will\n\ + flush any encoded data immediately. The option has\n\ + only effect on the X client side proxy.\n\ +\n\ + render=b Enable or disable use of the RENDER extension.\n\ +\n\ + taint=b Try to suppress trivial sources of X roundtrips by\n\ + generating the reply on the X client side.\n\ +\n\ + delta=b Enable X differential compression.\n\ +\n\ + data=n Enable or disable the ZLIB data compression. It is\n\ + possible to specify a value between 0 and 9. Usual-\n\ + ly the value is chosen automatically based on the\n\ + requested link setting.\n\ +\n\ + stream=n Enable or disable the ZLIB stream compression. The\n\ + value, between 0 and 9, is usually determined accor-\n\ + ding to the requested link setting.\n\ +\n\ + limit=n Specify a bitrate limit allowed for this session.\n\ +\n\ + memory=n Trigger memory optimizations used to keep small the\n\ + size of X buffers. This is useful on embedded plat-\n\ + forms, or where memory is scarce.\n\ +\n\ + cache=n Size of the in-memory X message cache. Setting the\n\ + value to 0 will disable the memory cache as well\n\ + as the NX differential compression.\n\ +\n\ + images=n Size of the persistent image cache.\n\ +\n\ + shseg=n Enable the use of the MIT-SHM extension between the\n\ + NX client proxy and the real X server. A value greater\n\ + than 1 is assumed to be the size of requested shared\n\ + memory segment. By default, the size of the segment is\n\ + determined based on the size of the in-memory cache.\n\ +\n\ + load=b Enable loading a persistent X message cache at the\n\ + proxy startup.\n\ +\n\ + save=b Enable saving a persistent X message cache at the\n\ + end of session.\n\ +\n\ + cups=n Enable or disable forwarding of CUPS connections,\n\ + by listening on the optional port 'n'.\n\ +\n\ + aux=n Enable or disable forwarding of the auxiliary X chan-\n\ + nel used for controlling the keyboard. The 'keybd=n'\n\ + form is accepted for backward compatibility.\n\ +\n\ + smb=n Enable or disable forwarding of SMB connections. The\n\ + 'samba=n' form is accepted for backward compatibility.\n\ +\n\ + media=n Enable forwarding of audio connections.\n\ +\n\ + http=n Enable forwarding of HTTP connections.\n\ +\n\ + font=n Enable forwarding of reversed connections to a font\n\ + server running on the NX server.\n\ +\n\ + file=n Enable forwarding of file transfer connections.\n\ +\n\ + mask=n Determine the distribution of channel ids between the\n\ + proxies. By default, channels whose ids are multiple\n\ + of 8 (starting from 0) are reserved for the NX client\n\ + side. All the other channels can be allocated by the\n\ + NX server side.\n\ +\n\ + timeout=t Specify the keep-alive timeout used by proxies to\n\ + determine if there is a network problem preventing\n\ + communication with the remote peer. A value of 0\n\ + disables the check.\n\ +\n\ + cleanup=t Specify the number of seconds the proxy has to wait\n\ + at session shutdown before closing all channels.\n\ + The feature is used by the NX server to ensure that\n\ + services are disconnected before shutting down the\n\ + link.\n\ +\n\ + pack=s Determine the method used to compress images.\n\ +\n\ + product=s The product id of the client or server. The value is\n\ + ignored by the proxy, but the client or server can\n\ + provide it to facilitate the support.\n\ +\n\ + core=b Enable production of core dumps when aborting the\n\ + proxy connection.\n\ +\n\ + options=s Specify an additional file containing options that\n\ + has to be merged with option read from the command\n\ + line or the environment.\n\ +\n\ + kill=n Add the given process to the list of daemons that\n\ + must be terminated at session shutdown. Multiple\n\ + 'kill=n' options can be specified. The proxy will\n\ + send them a SIGTERM signal just before exiting.\n\ +\n\ + strict=b Optimize for responsiveness, rather than for the best\n\ + use of all the available bandwidth.\n\ +\n\ + encryption=b Should be set to 1 if the proxy is running as part of\n\ + a program providing encryption of the point to point\n\ + communication.\n\ +\n\ +rootless=b\n\ +geometry=s\n\ +resize=b\n\ +fullscreen=b\n\ +keyboard=s\n\ +clipboard=s\n\ +streaming=n\n\ +backingstore=n\n\ +composite=n\n\ +xinerama=n\n\ +shmem=b\n\ +shpix=b\n\ +kbtype=s\n\ +client=s\n\ +shadow=n\n\ +shadowuid=n\n\ +shadowmode=s\n\ +defer=n\n\ +tile=s\n\ +menu=n\n\ +sleep=n\n\ +tolerancechecks=s\n\ + These options are interpreted by the NX agent. They\n\ + are ignored by the proxy.\n\ +\n\ + Environment:\n\ +\n\ + NX_ROOT The root NX directory is the place where the session\n\ + directory and the cache files are created. This is\n\ + usually overridden by passing the 'root=' option. By\n\ + default, the root NX directory is assumed to be the\n\ + directory '.nx' in the user's home.\n\ +\n\ + NX_SYSTEM The directory where NX programs and libraries reside.\n\ + If not set, the value is assumed to be '/usr/NX'.\n\ + Programs, libraries and data files are respectedly\n\ + searched in the 'bin', 'lib' and 'share' subdirecto-\n\ + ries.\n\ +\n\ + NX_HOME The NX user's home directory. If NX_ROOT is not set\n\ + or invalid, the user's NX directory is created here.\n\ +\n\ + NX_TEMP The directory where the X11 Unix Domain Sockets and\n\ + all temporary files are to be created.\n\ +\n\ + NX_CLIENT The full path to the nxclient executable. If the va-\n\ + riable is not set, the nxclient executable will be\n\ + run assuming that the program is in the system path.\n\ + This can be useful on platforms like Windows and the\n\ + Mac where nxclient is located in a different direct-\n\ + ory compared to the other programs, to make easier\n\ + for the user to execute the program from the shell.\n\ +\n\ + NX_SLAVE_CMD The full path to the slave channel handler. When the\n\ + slave channel is enabled, the agent will listen on a\n\ + port and forward the connection to the NX_SLAVE_CMD\n\ + program. This can be used to implement agent/proxy\n\ + communication for applications such as serial port and\n\ + USB forwarding.\n\ +\n\ + Shell environment:\n\ +\n\ + HOME The variable is checked in the case NX_HOME is not\n\ + set, null or invalid.\n\ +\n\ + TEMP The variable is checked whenever the NX_TEMP direct-\n\ + ory is not set, null or invalid.\n\ +\n\ + PATH The path where all executables are searched, except\n\ + nxclient. If NX_CLIENT is not set, also the client\n\ + executable is searched in the system path.\n\ +\n\ + LD_LIBRARY_PATH\n\ + System-wide library search order. This should be set\n\ + by the program invoking the proxy.\n\ +\n\ + DISPLAY On the X server side, the DISPLAY variable indicates\n\ + the location of the X11 server. When nxcomp is used\n\ + as a transport library, the DISPLAY may represent a\n\ + NX transport specification and options can passed in\n\ + the form nx/nx,option=value...\n\ +\n\ + XAUTHORITY This is the file containing the X11 authorization\n\ + cookie. If not set, the file is assumed to be in\n\ + the user's home (either NX_HOME or HOME).\n\ +\n\ +"; + +const char *GetUsageInfo() +{ + return UsageInfo; +} + +static const char CopyrightInfo[] = +"\ +Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com)\n\ +Copyright (c) 2008-2014 Oleksandr Shneyder \n\ +Copyright (c) 2014-2016 Ulrich Sibiller \n\ +Copyright (c) 2014-2016 Mihai Moldovan \n\ +Copyright (c) 2011-2016 Mike Gabriel \n\ +Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com)\n\ +\n\ +NXCOMP, NX protocol compression and NX extensions to this software\n\ +are copyright of the aforementioned persons and companies.\n\ +\n\ +Redistribution and use of the present software is allowed according\n\ +to terms specified in the file LICENSE.nxcomp which comes in the\n\ +source distribution.\n\ +\n\ +All rights reserved.\n\ +\n\ +NOTE: This software has received contributions from various other\n\ +contributors, only the core maintainers and supporters are listed as\n\ +copyright holders. Please contact us, if you feel you should be listed\n\ +as copyright holder, as well.\n\ +"; + +const char *GetCopyrightInfo() +{ + return CopyrightInfo; +} + +static const char OtherCopyrightInfo[] = +"\ +NX protocol compression is derived from DXPC project.\n\ +\n\ +Copyright (c) 1995,1996 Brian Pane\n\ +Copyright (c) 1996,1997 Zachary Vonler and Brian Pane\n\ +Copyright (c) 1999 Kevin Vigor and Brian Pane\n\ +Copyright (c) 2000,2003 Gian Filippo Pinzari and Brian Pane\n\ +\n\ +All rights reserved.\n\ +"; + +const char *GetOtherCopyrightInfo() +{ + return OtherCopyrightInfo; +} + +int _hostBigEndian = 0; +int _storeBigEndian = 0; + +const unsigned int IntMask[33] = +{ + 0x00000000, + 0x00000001, + 0x00000003, + 0x00000007, + 0x0000000f, + 0x0000001f, + 0x0000003f, + 0x0000007f, + 0x000000ff, + 0x000001ff, + 0x000003ff, + 0x000007ff, + 0x00000fff, + 0x00001fff, + 0x00003fff, + 0x00007fff, + 0x0000ffff, + 0x0001ffff, + 0x0003ffff, + 0x0007ffff, + 0x000fffff, + 0x001fffff, + 0x003fffff, + 0x007fffff, + 0x00ffffff, + 0x01ffffff, + 0x03ffffff, + 0x07ffffff, + 0x0fffffff, + 0x1fffffff, + 0x3fffffff, + 0x7fffffff, + 0xffffffff +}; + +unsigned int GetUINT(unsigned const char *buffer, int bigEndian) +{ + // + // It doesn't work on SPARCs if the buffer + // is not aligned to the word boundary. We + // should check the CPU, not the OS as this + // surely applies to other architectures. + // + + #ifndef __sun + + if (_hostBigEndian == bigEndian) + { + return *((unsigned short *) buffer); + } + + #else + + if (_hostBigEndian == bigEndian && ((unsigned int) buffer) & 0x1 == 0) + { + return *((unsigned short *) buffer); + } + + #endif + + unsigned int result; + + if (bigEndian) + { + result = *buffer; + + result <<= 8; + + result += buffer[1]; + } + else + { + result = buffer[1]; + + result <<= 8; + + result += *buffer; + } + + return result; +} + +unsigned int GetULONG(unsigned const char *buffer, int bigEndian) +{ + // + // It doesn't work on SPARCs if the buffer + // is not aligned to word the boundary. + // + + #ifndef __sun + + if (_hostBigEndian == bigEndian) + { + return *((unsigned int *) buffer); + } + + #else + + if (_hostBigEndian == bigEndian && ((unsigned int) buffer) & 0x3 == 0) + { + return *((unsigned int *) buffer); + } + + #endif + + const unsigned char *next = (bigEndian ? buffer : buffer + 3); + + unsigned int result = 0; + + for (int i = 0; i < 4; i++) + { + result <<= 8; + + result += *next; + + if (bigEndian) + { + next++; + } + else + { + next--; + } + } + + return result; +} + +void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian) +{ + if (_hostBigEndian == bigEndian) + { + *((unsigned short *) buffer) = value; + + return; + } + + if (bigEndian) + { + buffer[1] = (unsigned char) (value & 0xff); + + value >>= 8; + + *buffer = (unsigned char) value; + } + else + { + *buffer = (unsigned char) (value & 0xff); + + value >>= 8; + + buffer[1] = (unsigned char) value; + } +} + +void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian) +{ + if (_hostBigEndian == bigEndian) + { + *((unsigned int *) buffer) = value; + + return; + } + + if (bigEndian) + { + buffer += 3; + + for (int i = 4; i > 0; i--) + { + *buffer-- = (unsigned char) (value & 0xff); + + value >>= 8; + } + } + else + { + for (int i = 4; i > 0; i--) + { + *buffer++ = (unsigned char) (value & 0xff); + + value >>= 8; + } + } +} + +int CheckData(istream *fs) +{ + if (fs == NULL || fs -> fail()) + { + return -1; + } + + return 1; +} + +int CheckData(ostream *fs) +{ + if (fs == NULL || fs -> fail()) + { + return -1; + } + + return 1; +} + +int PutData(ostream *fs, const unsigned char *buffer, int size) +{ + fs -> write((char *) buffer, size); + + #ifdef DEBUG + *logofs << "PutData: Written " << size << " bytes with eof " + << fs -> eof() << " fail " << fs -> fail() << " and bad " + << fs -> bad() << ".\n" << logofs_flush; + #endif + + if (fs -> fail()) + { + return -1; + } + + return size; +} + +int GetData(istream *fs, unsigned char *buffer, int size) +{ + fs -> read((char *) buffer, size); + + #ifdef DEBUG + *logofs << "GetData: Read " << size << " bytes with eof " + << fs -> eof() << " fail " << fs -> fail() + << " and bad " << fs -> bad() << ".\n" + << logofs_flush; + #endif + + #ifdef __APPLE__ + + if (fs -> bad()) + { + return -1; + } + + #else + + if (fs -> fail()) + { + return -1; + } + + #endif + + return size; +} + +int FlushData(ostream *fs) +{ + fs -> flush(); + + if (fs -> fail()) + { + return -1; + } + + return 1; +} + +unsigned int RoundUp2(unsigned int x) +{ + unsigned int y = x / 2; + + y *= 2; + + if (y != x) + { + y += 2; + } + + return y; +} + +unsigned int RoundUp4(unsigned int x) +{ + unsigned int y = x / 4; + + y *= 4; + + if (y != x) + { + y += 4; + } + + return y; +} + +unsigned int RoundUp8(unsigned int x) +{ + unsigned int y = x / 8; + + y *= 8; + + if (y != x) + { + y += 8; + } + + return y; +} + +const char *DumpSignal(int signal) +{ + switch (signal) + { + case SIGCHLD: + { + return "SIGCHLD"; + } + case SIGUSR1: + { + return "SIGUSR1"; + } + case SIGUSR2: + { + return "SIGUSR2"; + } + case SIGHUP: + { + return "SIGHUP"; + } + case SIGINT: + { + return "SIGINT"; + } + case SIGTERM: + { + return "SIGTERM"; + } + case SIGPIPE: + { + return "SIGPIPE"; + } + case SIGALRM: + { + return "SIGALRM"; + } + case SIGVTALRM: + { + return "SIGVTALRM"; + } + case SIGWINCH: + { + return "SIGWINCH"; + } + case SIGIO: + { + return "SIGIO"; + } + case SIGTSTP: + { + return "SIGTSTP"; + } + case SIGTTIN: + { + return "SIGTTIN"; + } + case SIGTTOU: + { + return "SIGTTOU"; + } + case SIGSEGV: + { + return "SIGSEGV"; + } + case SIGABRT: + { + return "SIGABRT"; + } + default: + { + return "Unknown"; + } + } +} + +const char *DumpPolicy(int type) +{ + switch ((T_flush_policy) type) + { + case policy_immediate: + { + return "immediate"; + } + case policy_deferred: + { + return "deferred"; + } + default: + { + #ifdef PANIC + *logofs << "Misc: PANIC! Unknown policy type '" + << type << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unknown policy type '" + << type << "'.\n"; + + HandleCleanup(); + } + } +} + +const char *DumpAction(int type) +{ + T_store_action action = (T_store_action) type; + + if (action == IS_HIT) + { + return "is_hit"; + } + else if (action == IS_ADDED) + { + return "is_added"; + } + else if (action == is_discarded) + { + return "is_discarded"; + } + else if (action == is_removed) + { + return "is_removed"; + } + else + { + #ifdef PANIC + *logofs << "Misc: PANIC! Unknown store action '" + << type << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unknown store action '" + << type << "'.\n"; + + HandleCleanup(); + } +} + +const char *DumpState(int type) +{ + switch ((T_split_state) type) + { + case split_added: + { + return "split_added"; + } + case split_missed: + { + return "split_missed"; + } + case split_loaded: + { + return "split_loaded"; + } + case split_aborted: + { + return "split_aborted"; + } + case split_notified: + { + return "split_notified"; + } + default: + { + #ifdef PANIC + *logofs << "Misc: PANIC! Unknown split state '" + << type << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unknown split state '" + << type << "'.\n"; + + HandleCleanup(); + } + } +} + +const char *DumpControl(int code) +{ + switch ((T_proxy_code) code) + { + case code_new_x_connection: + { + return "code_new_x_connection"; + } + case code_new_cups_connection: + { + return "code_new_cups_connection"; + } + case code_new_aux_connection: + { + return "code_new_aux_connection"; + } + case code_new_smb_connection: + { + return "code_new_smb_connection"; + } + case code_new_media_connection: + { + return "code_new_media_connection"; + } + case code_switch_connection: + { + return "code_switch_connection"; + } + case code_drop_connection: + { + return "code_drop_connection"; + } + case code_finish_connection: + { + return "code_finish_connection"; + } + case code_begin_congestion: + { + return "code_begin_congestion"; + } + case code_end_congestion: + { + return "code_end_congestion"; + } + case code_alert_request: + { + return "code_alert_request"; + } + case code_alert_reply: + { + return "code_alert_reply"; + } + case code_reset_request: + { + return "code_reset_request"; + } + case code_reset_reply: + { + return "code_reset_reply"; + } + case code_load_request: + { + return "code_load_request"; + } + case code_load_reply: + { + return "code_load_reply"; + } + case code_save_request: + { + return "code_save_request"; + } + case code_save_reply: + { + return "code_save_reply"; + } + case code_shutdown_request: + { + return "code_shutdown_request"; + } + case code_shutdown_reply: + { + return "code_shutdown_reply"; + } + case code_control_token_request: + { + return "code_control_token_request"; + } + case code_control_token_reply: + { + return "code_control_token_reply"; + } + case code_configuration_request: + { + return "code_configuration_request"; + } + case code_configuration_reply: + { + return "code_configuration_reply"; + } + case code_statistics_request: + { + return "code_statistics_request"; + } + case code_statistics_reply: + { + return "code_statistics_reply"; + } + case code_new_http_connection: + { + return "code_new_http_connection"; + } + case code_sync_request: + { + return "code_sync_request"; + } + case code_sync_reply: + { + return "code_sync_reply"; + } + case code_new_font_connection: + { + return "code_new_font_connection"; + } + case code_new_slave_connection: + { + return "code_new_slave_connection"; + } + case code_finish_listeners: + { + return "code_finish_listeners"; + } + case code_split_token_request: + { + return "code_split_token_request"; + } + case code_split_token_reply: + { + return "code_split_token_reply"; + } + case code_data_token_request: + { + return "code_data_token_request"; + } + case code_data_token_reply: + { + return "code_data_token_reply"; + } + default: + { + #ifdef WARNING + *logofs << "Misc: WARNING! Unknown control code '" + << code << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Unknown control code '" + << code << "'.\n"; + + return "unknown"; + } + } +} + +const char *DumpSession(int code) +{ + switch ((T_session_mode) code) + { + case session_agent: + { + return "session_agent"; + } + case session_shadow: + { + return "session_shadow"; + } + case session_proxy: + { + return "session_proxy"; + } + default: + { + #ifdef WARNING + *logofs << "Misc: WARNING! Unknown session type '" + << code << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Unknown session type '" + << code << "'.\n"; + + return "unknown"; + } + } +} + +const char *DumpToken(int type) +{ + switch ((T_token_type) type) + { + case token_control: + { + return "token_control"; + } + case token_split: + { + return "token_split"; + } + case token_data: + { + return "token_data"; + } + default: + { + #ifdef WARNING + *logofs << "Misc: WARNING! Unknown token type '" + << type << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Unknown token type '" + << type << "'.\n"; + + return "unknown"; + } + } +} + +// +// Always include this in code as it is generally +// needed to test channels and split store. +// + +const char *DumpChecksum(const void *checksum) +{ + static char string[MD5_LENGTH * 2 + 1]; + + if (checksum != NULL) + { + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + sprintf(string + (i * 2), "%02X", ((unsigned char *) checksum)[i]); + } + } + else + { + strcpy(string, "null"); + } + + return string; +} + +// +// Define OPCODES here and in the channel +// if you want to log the opcode literal. +// + +#ifdef OPCODES + +const char *DumpOpcode(const int &opcode) +{ + switch (opcode) + { + case X_CreateWindow: + { + return "X_CreateWindow"; + } + case X_ChangeWindowAttributes: + { + return "X_ChangeWindowAttributes"; + } + case X_GetWindowAttributes: + { + return "X_GetWindowAttributes"; + } + case X_DestroyWindow: + { + return "X_DestroyWindow"; + } + case X_DestroySubwindows: + { + return "X_DestroySubwindows"; + } + case X_ChangeSaveSet: + { + return "X_ChangeSaveSet"; + } + case X_ReparentWindow: + { + return "X_ReparentWindow"; + } + case X_MapWindow: + { + return "X_MapWindow"; + } + case X_MapSubwindows: + { + return "X_MapSubwindows"; + } + case X_UnmapWindow: + { + return "X_UnmapWindow"; + } + case X_UnmapSubwindows: + { + return "X_UnmapSubwindows"; + } + case X_ConfigureWindow: + { + return "X_ConfigureWindow"; + } + case X_CirculateWindow: + { + return "X_CirculateWindow"; + } + case X_GetGeometry: + { + return "X_GetGeometry"; + } + case X_QueryTree: + { + return "X_QueryTree"; + } + case X_InternAtom: + { + return "X_InternAtom"; + } + case X_GetAtomName: + { + return "X_GetAtomName"; + } + case X_ChangeProperty: + { + return "X_ChangeProperty"; + } + case X_DeleteProperty: + { + return "X_DeleteProperty"; + } + case X_GetProperty: + { + return "X_GetProperty"; + } + case X_ListProperties: + { + return "X_ListProperties"; + } + case X_SetSelectionOwner: + { + return "X_SetSelectionOwner"; + } + case X_GetSelectionOwner: + { + return "X_GetSelectionOwner"; + } + case X_ConvertSelection: + { + return "X_ConvertSelection"; + } + case X_SendEvent: + { + return "X_SendEvent"; + } + case X_GrabPointer: + { + return "X_GrabPointer"; + } + case X_UngrabPointer: + { + return "X_UngrabPointer"; + } + case X_GrabButton: + { + return "X_GrabButton"; + } + case X_UngrabButton: + { + return "X_UngrabButton"; + } + case X_ChangeActivePointerGrab: + { + return "X_ChangeActivePointerGrab"; + } + case X_GrabKeyboard: + { + return "X_GrabKeyboard"; + } + case X_UngrabKeyboard: + { + return "X_UngrabKeyboard"; + } + case X_GrabKey: + { + return "X_GrabKey"; + } + case X_UngrabKey: + { + return "X_UngrabKey"; + } + case X_AllowEvents: + { + return "X_AllowEvents"; + } + case X_GrabServer: + { + return "X_GrabServer"; + } + case X_UngrabServer: + { + return "X_UngrabServer"; + } + case X_QueryPointer: + { + return "X_QueryPointer"; + } + case X_GetMotionEvents: + { + return "X_GetMotionEvents"; + } + case X_TranslateCoords: + { + return "X_TranslateCoords"; + } + case X_WarpPointer: + { + return "X_WarpPointer"; + } + case X_SetInputFocus: + { + return "X_SetInputFocus"; + } + case X_GetInputFocus: + { + return "X_GetInputFocus"; + } + case X_QueryKeymap: + { + return "X_QueryKeymap"; + } + case X_OpenFont: + { + return "X_OpenFont"; + } + case X_CloseFont: + { + return "X_CloseFont"; + } + case X_QueryFont: + { + return "X_QueryFont"; + } + case X_QueryTextExtents: + { + return "X_QueryTextExtents"; + } + case X_ListFonts: + { + return "X_ListFonts"; + } + case X_ListFontsWithInfo: + { + return "X_ListFontsWithInfo"; + } + case X_SetFontPath: + { + return "X_SetFontPath"; + } + case X_GetFontPath: + { + return "X_GetFontPath"; + } + case X_CreatePixmap: + { + return "X_CreatePixmap"; + } + case X_FreePixmap: + { + return "X_FreePixmap"; + } + case X_CreateGC: + { + return "X_CreateGC"; + } + case X_ChangeGC: + { + return "X_ChangeGC"; + } + case X_CopyGC: + { + return "X_CopyGC"; + } + case X_SetDashes: + { + return "X_SetDashes"; + } + case X_SetClipRectangles: + { + return "X_SetClipRectangles"; + } + case X_FreeGC: + { + return "X_FreeGC"; + } + case X_ClearArea: + { + return "X_ClearArea"; + } + case X_CopyArea: + { + return "X_CopyArea"; + } + case X_CopyPlane: + { + return "X_CopyPlane"; + } + case X_PolyPoint: + { + return "X_PolyPoint"; + } + case X_PolyLine: + { + return "X_PolyLine"; + } + case X_PolySegment: + { + return "X_PolySegment"; + } + case X_PolyRectangle: + { + return "X_PolyRectangle"; + } + case X_PolyArc: + { + return "X_PolyArc"; + } + case X_FillPoly: + { + return "X_FillPoly"; + } + case X_PolyFillRectangle: + { + return "X_PolyFillRectangle"; + } + case X_PolyFillArc: + { + return "X_PolyFillArc"; + } + case X_PutImage: + { + return "X_PutImage"; + } + case X_GetImage: + { + return "X_GetImage"; + } + case X_PolyText8: + { + return "X_PolyText8"; + } + case X_PolyText16: + { + return "X_PolyText16"; + } + case X_ImageText8: + { + return "X_ImageText8"; + } + case X_ImageText16: + { + return "X_ImageText16"; + } + case X_CreateColormap: + { + return "X_CreateColormap"; + } + case X_FreeColormap: + { + return "X_FreeColormap"; + } + case X_CopyColormapAndFree: + { + return "X_CopyColormapAndFree"; + } + case X_InstallColormap: + { + return "X_InstallColormap"; + } + case X_UninstallColormap: + { + return "X_UninstallColormap"; + } + case X_ListInstalledColormaps: + { + return "X_ListInstalledColormaps"; + } + case X_AllocColor: + { + return "X_AllocColor"; + } + case X_AllocNamedColor: + { + return "X_AllocNamedColor"; + } + case X_AllocColorCells: + { + return "X_AllocColorCells"; + } + case X_AllocColorPlanes: + { + return "X_AllocColorPlanes"; + } + case X_FreeColors: + { + return "X_FreeColors"; + } + case X_StoreColors: + { + return "X_StoreColors"; + } + case X_StoreNamedColor: + { + return "X_StoreNamedColor"; + } + case X_QueryColors: + { + return "X_QueryColors"; + } + case X_LookupColor: + { + return "X_LookupColor"; + } + case X_CreateCursor: + { + return "X_CreateCursor"; + } + case X_CreateGlyphCursor: + { + return "X_CreateGlyphCursor"; + } + case X_FreeCursor: + { + return "X_FreeCursor"; + } + case X_RecolorCursor: + { + return "X_RecolorCursor"; + } + case X_QueryBestSize: + { + return "X_QueryBestSize"; + } + case X_QueryExtension: + { + return "X_QueryExtension"; + } + case X_ListExtensions: + { + return "X_ListExtensions"; + } + case X_ChangeKeyboardMapping: + { + return "X_ChangeKeyboardMapping"; + } + case X_GetKeyboardMapping: + { + return "X_GetKeyboardMapping"; + } + case X_ChangeKeyboardControl: + { + return "X_ChangeKeyboardControl"; + } + case X_GetKeyboardControl: + { + return "X_GetKeyboardControl"; + } + case X_Bell: + { + return "X_Bell"; + } + case X_ChangePointerControl: + { + return "X_ChangePointerControl"; + } + case X_GetPointerControl: + { + return "X_GetPointerControl"; + } + case X_SetScreenSaver: + { + return "X_SetScreenSaver"; + } + case X_GetScreenSaver: + { + return "X_GetScreenSaver"; + } + case X_ChangeHosts: + { + return "X_ChangeHosts"; + } + case X_ListHosts: + { + return "X_ListHosts"; + } + case X_SetAccessControl: + { + return "X_SetAccessControl"; + } + case X_SetCloseDownMode: + { + return "X_SetCloseDownMode"; + } + case X_KillClient: + { + return "X_KillClient"; + } + case X_RotateProperties: + { + return "X_RotateProperties"; + } + case X_ForceScreenSaver: + { + return "X_ForceScreenSaver"; + } + case X_SetPointerMapping: + { + return "X_SetPointerMapping"; + } + case X_GetPointerMapping: + { + return "X_GetPointerMapping"; + } + case X_SetModifierMapping: + { + return "X_SetModifierMapping"; + } + case X_GetModifierMapping: + { + return "X_GetModifierMapping"; + } + case X_NoOperation: + { + return "X_NoOperation"; + } + case X_NXInternalGenericData: + { + return "X_NXInternalGenericData"; + } + // + // case X_NXInternalGenericReply: + // { + // return "X_NXInternalGenericReply"; + // } + // + case X_NXInternalGenericRequest: + { + return "X_NXInternalGenericRequest"; + } + case X_NXInternalShapeExtension: + { + return "X_NXInternalShapeExtension"; + } + case X_NXGetControlParameters: + { + return "X_NXGetControlParameters"; + } + case X_NXGetCleanupParameters: + { + return "X_NXGetCleanupParameters"; + } + case X_NXGetImageParameters: + { + return "X_NXGetImageParameters"; + } + case X_NXGetUnpackParameters: + { + return "X_NXGetUnpackParameters"; + } + case X_NXGetShmemParameters: + { + return "X_NXGetShmemParameters"; + } + case X_NXGetFontParameters: + { + return "X_NXGetFontParameters"; + } + case X_NXSetExposeParameters: + { + return "X_NXSetExposeParameters"; + } + case X_NXSetCacheParameters: + { + return "X_NXSetCacheParameters"; + } + case X_NXStartSplit: + { + return "X_NXStartSplit"; + } + case X_NXEndSplit: + { + return "X_NXEndSplit"; + } + case X_NXSplitData: + { + return "X_NXSplitData"; + } + case X_NXSplitEvent: + { + return "X_NXSplitEvent"; + } + case X_NXCommitSplit: + { + return "X_NXCommitSplit"; + } + case X_NXFinishSplit: + { + return "X_NXFinishSplit"; + } + case X_NXAbortSplit: + { + return "X_NXAbortSplit"; + } + case X_NXFreeSplit: + { + return "X_NXFreeSplit"; + } + case X_NXSetUnpackGeometry: + { + return "X_NXSetUnpackGeometry"; + } + case X_NXSetUnpackColormap: + { + return "X_NXSetUnpackColormap"; + } + case X_NXSetUnpackAlpha: + { + return "X_NXSetUnpackAlpha"; + } + case X_NXPutPackedImage: + { + return "X_NXPutPackedImage"; + } + case X_NXFreeUnpack: + { + return "X_NXFreeUnpack"; + } + default: + { + if (opcode > 127) + { + return "Extension"; + } + else + { + return "?"; + } + } + } +} + +#else /* #ifdef OPCODES */ + +const char *DumpOpcode(const int &opcode) +{ + return "?"; +} + +#endif /* #ifdef OPCODES */ + +void DumpData(const unsigned char *buffer, unsigned int size) +{ + if (buffer != NULL) + { + unsigned int i = 0; + + while (i < size) + { + *logofs << "[" << i << "]\t"; + + for (unsigned int ii = 0; i < size && ii < 8; i++, ii++) + { + *logofs << (unsigned int) (buffer[i]) << "\t"; + } + + *logofs << "\n" << logofs_flush; + } + } +} + +void DumpChecksum(const unsigned char *buffer, unsigned int size) +{ + if (buffer != NULL) + { + md5_byte_t md5_digest[MD5_LENGTH]; + + md5_state_t md5_state; + + md5_init(&md5_state); + + md5_append(&md5_state, buffer, size); + + md5_finish(&md5_state, md5_digest); + + char md5_string[MD5_LENGTH * 2 + 1]; + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + sprintf(md5_string + (i * 2), "%02X", md5_digest[i]); + } + + *logofs << "[" << md5_string << "]" << logofs_flush; + } +} + +void DumpBlockChecksums(const unsigned char *buffer, + unsigned int size, unsigned int block) +{ + for (unsigned int i = 0; i < (size / block); i++) + { + *logofs << "[" << i * block << "]"; + + DumpChecksum(buffer + (i * block), block); + + *logofs << "\n"; + } + + if (size % block > 0) + { + *logofs << "[" << size / block * block << "]"; + + DumpChecksum(buffer + (size / block * block), size % block); + + *logofs << "\n"; + } +} + +void DumpHexData(const unsigned char *buffer, unsigned int size) +{ + char message [65536]; + char ascii [17]; + + unsigned int index = 0; + unsigned int linescan = 0; + unsigned int index_ascii = 0; + + sprintf (message,"\n#### Start Dump Buffer of [%.5d] Bytes ####\n\n",size); + + *logofs << message << logofs_flush; + + // + // "Index 0 1 2 3 4 5 6 7 8 9 a b c d e f Ascii " + // "----- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------" + // "00000 : 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................" + // + + sprintf (message,"Index 0 1 2 3 4 5 6 7 8 9 a b c d e f Ascii \n"); + *logofs << message << logofs_flush; + sprintf (message,"----- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- ----------------\n"); + *logofs << message << logofs_flush; + + index = 0; + + while (index < size) + { + memset (ascii, ' ', sizeof(ascii)); + + ascii[16] = '\0'; + + sprintf (message,"%.5d ", index); + + for (index_ascii = 0, linescan = index; + ((index < (linescan + 16)) && (index < size)); + index++, index_ascii++) + { + if (isprint(buffer [index])) + { + ascii[index_ascii] = buffer [index]; + } + else + { + ascii[index_ascii] = '.'; + } + + sprintf (&message [strlen (message)],"%.2x ", (unsigned char) buffer [index]); + } + + for (linescan = index_ascii; linescan < 16; linescan++) + { + strcat (&message [strlen (message)], " "); + } + + sprintf (&message [strlen (message)]," %s\n", ascii); + + *logofs << message << logofs_flush; + } + + sprintf (message,"\n#### End Dump Buffer ####\n\n"); + + *logofs << message << logofs_flush; +} diff --git a/nxcomp/src/Misc.h b/nxcomp/src/Misc.h new file mode 100644 index 000000000..997630137 --- /dev/null +++ b/nxcomp/src/Misc.h @@ -0,0 +1,279 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Misc_H +#define Misc_H + +#include +#include + +#include +#include + +#ifdef __sun + +#include + +#endif + +using namespace std; + +// +// This is MD5 length. +// + +#define MD5_LENGTH 16 + +// +// Error handling macros. +// + +#define ESET(e) (errno = (e)) +#define EGET() (errno) +#define ESTR() strerror(errno) + +// +// TCP port offset applied to NX port specification. +// + +extern const int DEFAULT_NX_PROXY_PORT_OFFSET; + +// +// Default TCP port used by client proxy to listen +// to X clients and by server proxy to connect to +// remote. +// + +extern const int DEFAULT_NX_PROXY_PORT; + +// +// Default X display number that client +// proxy imitates. +// + +extern const int DEFAULT_NX_X_PORT; + +// +// Establish the port offsets for the additional +// services. +// + +extern const int DEFAULT_NX_CUPS_PORT_OFFSET; +extern const int DEFAULT_NX_SMB_PORT_OFFSET; +extern const int DEFAULT_NX_MEDIA_PORT_OFFSET; +extern const int DEFAULT_NX_AUX_PORT_OFFSET; +extern const int DEFAULT_NX_HTTP_PORT_OFFSET; +extern const int DEFAULT_NX_FONT_PORT_OFFSET; + +// +// Slave channels can be originated by both sides +// so they need to have different port offsets +// in the case the user runs both proxies on the +// same host. +// + +extern const int DEFAULT_NX_SLAVE_PORT_CLIENT_OFFSET; +extern const int DEFAULT_NX_SLAVE_PORT_SERVER_OFFSET; + +// +// NX proxy binds to all network interfaces by default +// With the -loopback parameter, you can switch +// over to binding to the loopback device only. +// + +extern const int DEFAULT_LOOPBACK_BIND; + +// +// Return strings containing various info. +// + +const char *GetUsageInfo(); +const char *GetCopyrightInfo(); +const char *GetOtherCopyrightInfo(); + +// +// Define this if you want immediate flush of +// the log output. +// + +#define FLUSH_LOGOFS + +// +// Global objects providing shared functions. +// + +class Auth; +class Control; +class Statistics; + +extern Auth *auth; +extern Control *control; +extern Statistics *statistics; + +// +// Log file. +// + +extern ostream *logofs; + +// +// Cleanup code. +// + +void HandleAbort() __attribute__((noreturn)); +void HandleShutdown() __attribute__((noreturn)); + +extern "C" +{ + void HandleCleanup(int code = 0) __attribute__((noreturn)); + void HandleCleanupForReconnect(); +} + +// +// Manage signal handlers. +// + +void DisableSignals(); +void EnableSignals(); + +// +// Manage timers. +// + +void SetTimer(int value); +void ResetTimer(); + +// +// Show a dialog asking the user if he/she +// wants to close the current session. Look +// in the alerts file for the known critical +// events. +// + +void HandleAlert(int code, int local); + +// +// Run the callback registered by the proxy +// or the agent. +// + +void KeeperCallback(); +void FlushCallback(int length); + +// +// Return the string literal corresponding +// the value. +// + +const char *DumpSignal(int signal); +const char *DumpPolicy(int type); +const char *DumpControl(int code); +const char *DumpSession(int code); +const char *DumpAction(int type); +const char *DumpState(int type); +const char *DumpToken(int type); + +// +// Print out content of buffer to log file. +// You need to define DUMP or OPCODES in +// the source to have these compiled. +// + +const char *DumpOpcode(const int &opcode); +const char *DumpChecksum(const void *checksum); + +void DumpData(const unsigned char *data, unsigned int length); +void DumpHexData(const unsigned char *data, unsigned int length); +void DumpChecksum(const unsigned char *data, unsigned int length); +void DumpBlockChecksums(const unsigned char *data, unsigned int length, + unsigned int block); + +// +// Defines logofs_flush as an empty string to +// avoid calling the corresponding ostream's +// flush() function. +// + +#ifdef FLUSH_LOGOFS + +#define logofs_flush "" ; logofs -> flush() + +#else + +#define logofs_flush "" + +#endif + +// +// Is the host where local proxy is running +// big-endian? +// + +extern int _hostBigEndian; +extern int _storeBigEndian; + +inline void setHostBigEndian(int flag) +{ + _hostBigEndian = flag; +} + +inline int hostBigEndian() +{ + return _hostBigEndian; +} + +inline int storeBigEndian() +{ + return _storeBigEndian; +} + +extern const unsigned int IntMask[33]; + +unsigned int GetUINT(unsigned const char *buffer, int bigEndian); +unsigned int GetULONG(unsigned const char *buffer, int bigEndian); +void PutUINT(unsigned int value, unsigned char *buffer, int bigEndian); +void PutULONG(unsigned int value, unsigned char *buffer, int bigEndian); + +inline void CleanData(unsigned char *buffer, int size) +{ + unsigned char *end = buffer + size; + + while (buffer < end) + { + *buffer++ = 0x00; + } +} + +int CheckData(istream *fs); +int CheckData(ostream *fs); +int PutData(ostream *fs, const unsigned char *buffer, int size); +int GetData(istream *fs, unsigned char *buffer, int size); +int FlushData(ostream *fs); + +unsigned int RoundUp2(unsigned int x); +unsigned int RoundUp4(unsigned int x); +unsigned int RoundUp8(unsigned int x); + +#endif /* Misc_H */ diff --git a/nxcomp/src/NXmitshm.h b/nxcomp/src/NXmitshm.h new file mode 100644 index 000000000..939d488fb --- /dev/null +++ b/nxcomp/src/NXmitshm.h @@ -0,0 +1,56 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXmitshm_H +#define NXmitshm_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Import opcodes from + * to get rid of weird dependencies from other + * headers of X environment. + */ + +#define X_ShmQueryVersion 0 +#define X_ShmAttach 1 +#define X_ShmDetach 2 +#define X_ShmPutImage 3 +#define X_ShmGetImage 4 +#define X_ShmCreatePixmap 5 + +#define ShmCompletion 0 +#define ShmNumberEvents (ShmCompletion + 1) + +#define BadShmSeg 0 +#define ShmNumberErrors (BadShmSeg + 1) + +#ifdef __cplusplus +} +#endif + +#endif /* NXmitshm_H */ diff --git a/nxcomp/src/NXrender.h b/nxcomp/src/NXrender.h new file mode 100644 index 000000000..280715833 --- /dev/null +++ b/nxcomp/src/NXrender.h @@ -0,0 +1,78 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef NXrender_H +#define NXrender_H + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Import this from + * to compile under old XFree86 distributions + * when render extension was not present yet. + */ + +#define X_RenderQueryVersion 0 +#define X_RenderQueryPictFormats 1 +#define X_RenderQueryPictIndexValues 2 +#define X_RenderQueryDithers 3 +#define X_RenderCreatePicture 4 +#define X_RenderChangePicture 5 +#define X_RenderSetPictureClipRectangles 6 +#define X_RenderFreePicture 7 +#define X_RenderComposite 8 +#define X_RenderScale 9 +#define X_RenderTrapezoids 10 +#define X_RenderTriangles 11 +#define X_RenderTriStrip 12 +#define X_RenderTriFan 13 +#define X_RenderColorTrapezoids 14 +#define X_RenderColorTriangles 15 +#define X_RenderTransform 16 +#define X_RenderCreateGlyphSet 17 +#define X_RenderReferenceGlyphSet 18 +#define X_RenderFreeGlyphSet 19 +#define X_RenderAddGlyphs 20 +#define X_RenderAddGlyphsFromPicture 21 +#define X_RenderFreeGlyphs 22 +#define X_RenderCompositeGlyphs8 23 +#define X_RenderCompositeGlyphs16 24 +#define X_RenderCompositeGlyphs32 25 +#define X_RenderFillRectangles 26 +/* 0.5 */ +#define X_RenderCreateCursor 27 +/* 0.6 */ +#define X_RenderSetPictureTransform 28 +#define X_RenderQueryFilters 29 +#define X_RenderSetPictureFilter 30 +#define X_RenderCreateAnimCursor 31 + +#ifdef __cplusplus +} +#endif + +#endif /* NXrender_H */ diff --git a/nxcomp/src/OpcodeCache.h b/nxcomp/src/OpcodeCache.h new file mode 100644 index 000000000..e07a1b997 --- /dev/null +++ b/nxcomp/src/OpcodeCache.h @@ -0,0 +1,53 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef OpcodeCache_H +#define OpcodeCache_H + +#include "CharCache.h" + +class OpcodeCache +{ + friend class EncodeBuffer; + friend class DecodeBuffer; + + public: + + OpcodeCache() + { + slot_ = 0; + } + + ~OpcodeCache() + { + } + + private: + + CharCache base_[256]; + unsigned char slot_; +}; + +#endif /* OpcodeCache_H */ diff --git a/nxcomp/src/OpcodeStore.cpp b/nxcomp/src/OpcodeStore.cpp new file mode 100644 index 000000000..21b919c8a --- /dev/null +++ b/nxcomp/src/OpcodeStore.cpp @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "OpcodeStore.h" + +OpcodeStore::OpcodeStore() +{ + // + // Assign values of the specific + // NX opcodes. + // + + getControlParameters = X_NXGetControlParameters; + getCleanupParameters = X_NXGetCleanupParameters; + getImageParameters = X_NXGetImageParameters; + getUnpackParameters = X_NXGetUnpackParameters; + getShmemParameters = X_NXGetShmemParameters; + getFontParameters = X_NXGetFontParameters; + + startSplit = X_NXStartSplit; + endSplit = X_NXEndSplit; + commitSplit = X_NXCommitSplit; + finishSplit = X_NXFinishSplit; + abortSplit = X_NXAbortSplit; + + splitData = X_NXSplitData; + splitEvent = X_NXSplitEvent; + + setCacheParameters = X_NXSetCacheParameters; + setExposeParameters = X_NXSetExposeParameters; + + setUnpackGeometry = X_NXSetUnpackGeometry; + setUnpackColormap = X_NXSetUnpackColormap; + setUnpackAlpha = X_NXSetUnpackAlpha; + + putPackedImage = X_NXPutPackedImage; + + freeUnpack = X_NXFreeUnpack; + freeSplit = X_NXFreeSplit; + + // + // These values must be fetched + // from the X server. + // + + shapeExtension = 0; + renderExtension = 0; + + // + // Events sent as ClientMessage. + // + + noSplitNotify = NXNoSplitNotify; + startSplitNotify = NXStartSplitNotify; + commitSplitNotify = NXCommitSplitNotify; + endSplitNotify = NXEndSplitNotify; + emptySplitNotify = NXEmptySplitNotify; +} + +OpcodeStore::~OpcodeStore() +{ +} diff --git a/nxcomp/src/OpcodeStore.h b/nxcomp/src/OpcodeStore.h new file mode 100644 index 000000000..d041ed4b8 --- /dev/null +++ b/nxcomp/src/OpcodeStore.h @@ -0,0 +1,91 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef OpcodeStore_H +#define OpcodeStore_H + +#include "NXproto.h" + +class OpcodeStore +{ + public: + + OpcodeStore(); + + ~OpcodeStore(); + + // + // Map NX protocol messages. At the moment mapping is hard- + // coded. Opcodes should be instead agreed with the proxied + // X server (by excluding all opcodes used for extensions) + // and exported by the proxy class to channels. + // + // Some toolkits query the server only once for extensions' + // opcodes and share the same settings across all channels. + // This could be a problem as channels needed to monitor the + // traffic to find out the extensions' opcodes themselves, + // so it is important that proxy passes an instance of this + // class to new channels. + // + + unsigned char getControlParameters; + unsigned char getCleanupParameters; + unsigned char getImageParameters; + unsigned char getUnpackParameters; + unsigned char getShmemParameters; + unsigned char getFontParameters; + + unsigned char startSplit; + unsigned char endSplit; + unsigned char commitSplit; + unsigned char finishSplit; + unsigned char abortSplit; + + unsigned char splitData; + unsigned char splitEvent; + + unsigned char setCacheParameters; + unsigned char setExposeParameters; + + unsigned char setUnpackGeometry; + unsigned char setUnpackColormap; + unsigned char setUnpackAlpha; + + unsigned char putPackedImage; + + unsigned char freeUnpack; + unsigned char freeSplit; + + unsigned char shapeExtension; + unsigned char renderExtension; + + unsigned char noSplitNotify; + unsigned char startSplitNotify; + unsigned char commitSplitNotify; + unsigned char endSplitNotify; + unsigned char emptySplitNotify; +}; + +#endif /* OpcodeStore_H */ diff --git a/nxcomp/src/Pack.c b/nxcomp/src/Pack.c new file mode 100644 index 000000000..97fb93b5f --- /dev/null +++ b/nxcomp/src/Pack.c @@ -0,0 +1,180 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "NXpack.h" + +const ColorMask Mask8TrueColor = { 128, 63, 240, 7 }; +const ColorMask Mask64TrueColor = { 192, 7, 240, 4 }; +const ColorMask Mask256TrueColor = { 255, 0, 255, 0 }; +const ColorMask Mask512TrueColor = { 224, 5, 240, 4 }; +const ColorMask Mask4KTrueColor = { 240, 4, 240, 2 }; +const ColorMask Mask32KTrueColor = { 248, 3, 248, 2 }; +const ColorMask Mask64KTrueColor = { 255, 0, 255, 0 }; +const ColorMask Mask256KTrueColor = { 252, 1, 252, 1 }; +const ColorMask Mask2MTrueColor = { 255, 0, 254, 1 }; +const ColorMask Mask16MTrueColor = { 255, 0, 255, 0 }; + +const ColorMask *MethodColorMask(unsigned int method) +{ + switch (method) + { + case MASK_8_COLORS: + { + return &Mask8TrueColor; + } + case MASK_64_COLORS: + { + return &Mask64TrueColor; + } + case MASK_256_COLORS: + { + return &Mask256TrueColor; + } + case MASK_512_COLORS: + { + return &Mask512TrueColor; + } + case MASK_4K_COLORS: + { + return &Mask4KTrueColor; + } + case MASK_32K_COLORS: + { + return &Mask32KTrueColor; + } + case MASK_64K_COLORS: + { + return &Mask64KTrueColor; + } + case MASK_256K_COLORS: + { + return &Mask256KTrueColor; + } + case MASK_2M_COLORS: + { + return &Mask2MTrueColor; + } + case MASK_16M_COLORS: + { + return &Mask16MTrueColor; + } + default: + { + return NULL; + } + } +} + +int MethodBitsPerPixel(unsigned int method) +{ + switch (method) + { + case PACK_MASKED_8_COLORS: + case PACK_JPEG_8_COLORS: + case PACK_PNG_8_COLORS: + { + return 8; + } + case PACK_MASKED_64_COLORS: + case PACK_JPEG_64_COLORS: + case PACK_PNG_64_COLORS: + { + return 8; + } + case PACK_MASKED_256_COLORS: + case PACK_JPEG_256_COLORS: + case PACK_PNG_256_COLORS: + { + return 8; + } + case PACK_MASKED_512_COLORS: + case PACK_JPEG_512_COLORS: + case PACK_PNG_512_COLORS: + { + return 16; + } + case PACK_MASKED_4K_COLORS: + case PACK_JPEG_4K_COLORS: + case PACK_PNG_4K_COLORS: + { + return 16; + } + case PACK_MASKED_32K_COLORS: + case PACK_JPEG_32K_COLORS: + case PACK_PNG_32K_COLORS: + { + return 16; + } + case PACK_MASKED_64K_COLORS: + case PACK_JPEG_64K_COLORS: + case PACK_PNG_64K_COLORS: + { + return 16; + } + case PACK_MASKED_256K_COLORS: + case PACK_JPEG_256K_COLORS: + case PACK_PNG_256K_COLORS: + { + return 24; + } + case PACK_MASKED_2M_COLORS: + case PACK_JPEG_2M_COLORS: + case PACK_PNG_2M_COLORS: + { + return 24; + } + case PACK_MASKED_16M_COLORS: + case PACK_JPEG_16M_COLORS: + case PACK_PNG_16M_COLORS: + { + return 24; + } + case PACK_BITMAP_16M_COLORS: + case PACK_RGB_16M_COLORS: + case PACK_RLE_16M_COLORS: + { + return 24; + } + default: + { + return 0; + } + } +} + +#ifdef __cplusplus +} +#endif diff --git a/nxcomp/src/Pgn.cpp b/nxcomp/src/Pgn.cpp new file mode 100644 index 000000000..649227f52 --- /dev/null +++ b/nxcomp/src/Pgn.cpp @@ -0,0 +1,809 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// This file obviously supports PNG +// decompression. It was renamed to +// avoid name clashes on Windows. +// + +#include + +#ifdef ANDROID +#include +#endif +#include +#include +#include + +#include "Unpack.h" +#include "Pgn.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define RGB24_TO_PIXEL(bpp,r,g,b) \ + ((((CARD##bpp)(r) & 0xFF) * srcRedMax2 + 127) / 255 \ + << srcRedShift2 | \ + (((CARD##bpp)(g) & 0xFF) * srcGreenMax2 + 127) / 255 \ + << srcGreenShift2 | \ + (((CARD##bpp)(b) & 0xFF) * srcBlueMax2 + 127) / 255 \ + << srcBlueShift2) + +#define RGB24_TO_PIXEL32(r,g,b) \ + (((CARD32)(r) & 0xFF) << srcRedShift2 | \ + ((CARD32)(g) & 0xFF) << srcGreenShift2 | \ + ((CARD32)(b) & 0xFF) << srcBlueShift2) + +// +// Functions from Unpack.cpp +// + +extern int Unpack32To32(const T_colormask *colormask, const unsigned int *data, + unsigned int *out, unsigned int *end); + +extern int Unpack24To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +extern int Unpack16To16(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +// +// Local functions used for the png decompression. +// + +static int DecompressPng16(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, + int byteOrder); + +static int DecompressPng24(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, + int byteOrder); + +static int DecompressPng32(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, + int byteOrder); + +static void PngReadData(png_structp png_ptr, png_bytep data, png_size_t length); + +// +// Colormap stuff. +// + +CARD16 srcRedMax2, srcGreenMax2, srcBlueMax2; +CARD8 srcRedShift2, srcGreenShift2, srcBlueShift2; + +// +// Attributes used for the png decompression. +// + +static char *tmpBuf; +static int tmpBufSize = 0; +static int streamPos; + +int UnpackPng(T_geometry *geometry, unsigned char method, unsigned char *srcData, + int srcSize, int dstBpp, int dstWidth, int dstHeight, + unsigned char *dstData, int dstSize) +{ + int byteOrder = geometry -> image_byte_order; + + // + // Check if data is coming from a failed unsplit. + // + + if (srcSize < 2 || (srcData[0] == SPLIT_PATTERN && + srcData[1] == SPLIT_PATTERN)) + { + #ifdef WARNING + *logofs << "UnpackPng: WARNING! Skipping unpack of dummy data.\n" + << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << "UnpackPng: Decompressing image with " + << "srcSize " << srcSize << " and bpp " + << dstBpp << ".\n" << logofs_flush; + #endif + + srcRedShift2 = ffs(geometry -> red_mask) - 1; + srcGreenShift2 = ffs(geometry -> green_mask) - 1; + srcBlueShift2 = ffs(geometry -> blue_mask) - 1; + srcRedMax2 = geometry -> red_mask >> srcRedShift2; + srcGreenMax2 = geometry -> green_mask >> srcGreenShift2; + srcBlueMax2 = geometry -> blue_mask >> srcBlueShift2; + + // + // Make enough space in the temporary + // buffer to have one complete row of + // the image with 3 bytes per pixel. + // + + tmpBufSize = dstWidth * 3; + tmpBuf = new char [tmpBufSize]; + + if (tmpBuf == NULL) + { + #ifdef PANIC + *logofs << "UnpackPng: PANIC! Cannot allocate " + << dstWidth * 3 << " bytes for PNG " + << "decompressed data.\n" << logofs_flush; + #endif + + delete [] tmpBuf; + + return -1; + } + + int result = 1; + + switch (dstBpp) + { + case 8: + { + // + // Simply move the data from srcData to dstData + // taking into consideration the correct padding. + // + + int row; + + unsigned char * dstBuff = dstData; + unsigned char * srcBuff = srcData; + + for (row = 0; row < dstHeight; row++) + { + memcpy(dstBuff, srcBuff, dstWidth ); + + dstBuff += RoundUp4(dstWidth); + srcBuff += dstWidth; + } + } + case 16: + { + result = DecompressPng16(srcData, srcSize, dstWidth, + dstHeight, dstData, byteOrder); + break; + } + case 24: + { + result = DecompressPng24(srcData, srcSize, dstWidth, + dstHeight, dstData, byteOrder); + break; + } + case 32: + { + result = DecompressPng32(srcData, srcSize, dstWidth, + dstHeight, dstData, byteOrder); + break; + } + default: + { + #ifdef PANIC + *logofs << "UnpackPng: PANIC! Error in PNG compression. " + << " Unsupported Bpp value " << dstBpp + << " for the PNG compression" + << ".\n" << logofs_flush; + #endif + + delete [] tmpBuf; + + result = -1; + } + } + + if (result == -1) + { + delete [] tmpBuf; + + return result; + } + + // + // Apply the correction for the brightness + // + + int maskMethod; + + switch (method) + { + case PACK_PNG_8_COLORS: + { + maskMethod = MASK_8_COLORS; + + break; + } + case PACK_PNG_64_COLORS: + { + maskMethod = MASK_64_COLORS; + + break; + } + case PACK_PNG_256_COLORS: + { + maskMethod = MASK_256_COLORS; + + break; + } + case PACK_PNG_512_COLORS: + { + maskMethod = MASK_512_COLORS; + + break; + } + case PACK_PNG_4K_COLORS: + { + maskMethod = MASK_4K_COLORS; + + break; + } + case PACK_PNG_32K_COLORS: + { + maskMethod = MASK_32K_COLORS; + + break; + } + case PACK_PNG_64K_COLORS: + { + maskMethod = MASK_64K_COLORS; + + break; + } + case PACK_PNG_256K_COLORS: + { + maskMethod = MASK_256K_COLORS; + + break; + } + case PACK_PNG_2M_COLORS: + { + maskMethod = MASK_2M_COLORS; + + break; + } + case PACK_PNG_16M_COLORS: + { + maskMethod = MASK_16M_COLORS; + + break; + } + default: + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << " No matching decompression method.\n" + << logofs_flush; + #endif + + delete [] tmpBuf; + + return -1; + } + } + + const T_colormask *colorMask = MethodColorMask(maskMethod); + + unsigned char *dstBuff = dstData; + + switch (dstBpp) + { + case 16: + { + Unpack16To16(colorMask, dstBuff, dstBuff, dstBuff + dstSize); + + break; + } + case 24: + { + break; + } + case 32: + { + Unpack32To32(colorMask, (unsigned int *)dstBuff, (unsigned int *)dstBuff, + (unsigned int *)(dstBuff + dstSize)); + break; + } + default: + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << " No matching destination bits per plane.\n" + << logofs_flush; + #endif + + delete [] tmpBuf; + + return -1; + } + } + + delete [] tmpBuf; + + return 1; +} + + +// +// Functions that actually do +// the PNG decompression. +// + +int DecompressPng16(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) +{ + unsigned char *data; + unsigned int dx, dy; + + png_structp pngPtr; + png_infop infoPtr; + png_bytep rowPointers; + + + streamPos = 0; + + pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!pngPtr) + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << " Failed png_create_read_struct operation" + << ".\n" << logofs_flush; + #endif + + return -1; + } + + infoPtr = png_create_info_struct(pngPtr); + + if (!infoPtr) + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << "Failed png_create_info_struct operation" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, NULL, NULL); + + return -1; + } + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << "Error during IO initialization" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << "Error during read of PNG header" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + png_read_info(pngPtr, infoPtr); + + if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) + { + png_set_expand(pngPtr); + } + + // + // data points to dstBuf which is + // already padded correctly for the final + // image to put + // + + data = dstBuf; + rowPointers = (png_byte *) tmpBuf; + + // + // We use setjmp() to save our context. + // The PNG library will call longjmp() + // in case of error. + // + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng16: PANIC! " + << "Error during read of PNG rows" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + unsigned long pixel; + + for (dy = 0; dy < h; dy++) + { + png_read_row(pngPtr, rowPointers, NULL); + + for (dx = 0; dx < w; dx++) + { + pixel = RGB24_TO_PIXEL(16, tmpBuf[dx*3], tmpBuf[dx*3+1], tmpBuf[dx*3+2]); + + // + // Follow the server byte order when arranging data. + // + + if (byteOrder == LSBFirst) + { + data[0] = (unsigned char) (pixel & 0xff); + data[1] = (unsigned char) ((pixel >> 8) & 0xff); + } + else + { + data[1] = (unsigned char) (pixel & 0xff); + data[0] = (unsigned char) ((pixel >> 8) & 0xff); + } + + data += 2; + } + + // + // Move pixelPtr at the beginning of the + // next line. + // + + data = data + (RoundUp4(w * 2) - w * 2); + } + + png_destroy_read_struct(&pngPtr, &infoPtr,NULL); + + #ifdef DEBUG + *logofs << "DecompressPng16: Decompression finished." + << dy << " lines handled.\n" + << logofs_flush; + #endif + + return 1; +} + +int DecompressPng24(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) +{ + static CARD8 *pixelPtr = NULL; + unsigned int dx, dy; + + png_structp pngPtr; + png_infop infoPtr; + png_bytep rowPointers; + + + streamPos = 0; + + pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!pngPtr) + { + #ifdef PANIC + *logofs << "DecompressPng24: PANIC! " + << "Failed png_create_read_struct operation" + << ".\n" << logofs_flush; + #endif + + return -1; + } + + infoPtr = png_create_info_struct(pngPtr); + + if (!infoPtr) + { + #ifdef PANIC + *logofs << "DecompressPng24: PANIC! " + << "Failed png_create_info_struct operation" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, NULL, NULL); + + return -1; + } + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng24: PANIC! " + << "Error during IO initialization" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng24: PANIC! " + << "Error during read of PNG header" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + png_read_info( pngPtr, infoPtr ) ; + + if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) + { + png_set_expand(pngPtr); + } + + // + // PixelPtr points to dstBuf which is + // already padded correctly for the final + // image to put + // + + pixelPtr = (CARD8 *) dstBuf; + + rowPointers = (png_byte *)tmpBuf; + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng24: PANIC! " + << "Error during read of PNG rows" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + for (dy = 0; dy < h; dy++) + { + png_read_row(pngPtr, rowPointers, NULL); + + for (dx = 0; dx < w; dx++) + { + // + // Follow the server byte order when arranging data. + // + + if (byteOrder == LSBFirst) + { + pixelPtr[0] = tmpBuf[dx * 3]; + pixelPtr[1] = tmpBuf[dx * 3 + 1]; + pixelPtr[2] = tmpBuf[dx * 3 + 2]; + } + else + { + pixelPtr[2] = tmpBuf[dx * 3]; + pixelPtr[1] = tmpBuf[dx * 3 + 1]; + pixelPtr[0] = tmpBuf[dx * 3 + 2]; + } + + pixelPtr += 3; + } + + // + // Go to the next line. + // + + pixelPtr = (CARD8 *) (((char *) pixelPtr) + (RoundUp4(w * 3) - w * 3)); + } + + png_destroy_read_struct(&pngPtr, &infoPtr,NULL); + + #ifdef DEBUG + *logofs << "DecompressPng24: Decompression finished." + << dy << " lines handled.\n" + << logofs_flush; + #endif + + return 1; +} + +int DecompressPng32(unsigned char *compressedData, int compressedLen, + unsigned int w, unsigned int h, unsigned char *dstBuf, int byteOrder) +{ + unsigned char *data; + + unsigned int dx, dy; + + png_structp pngPtr; + png_infop infoPtr; + png_bytep rowPointers; + + streamPos = 0; + + pngPtr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL); + + if (!pngPtr) + { + #ifdef PANIC + *logofs << "DecompressPng32: PANIC! " + << "Failed png_create_read_struct operation" + << ".\n" << logofs_flush; + #endif + + return -1; + } + + infoPtr = png_create_info_struct(pngPtr); + + if (!infoPtr) + { + #ifdef PANIC + *logofs << "DecompressPng32: PANIC! " + << "Failed png_create_info_struct operation." + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, NULL, NULL); + + return -1; + } + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng32: PANIC! " + << "Error during IO initialization" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + png_set_read_fn(pngPtr, (void *)compressedData, PngReadData); + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng32: PANIC! " + << "Error during read of PNG header" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + png_read_info(pngPtr, infoPtr) ; + + + if (png_get_color_type(pngPtr, infoPtr) == PNG_COLOR_TYPE_PALETTE) + { + png_set_expand(pngPtr); + } + + // + // data points to dstBuf which is + // already padded correctly for the final + // image to put + // + + data = dstBuf; + + rowPointers = (png_byte *) tmpBuf; + + if (setjmp(png_jmpbuf(pngPtr))) + { + #ifdef PANIC + *logofs << "DecompressPng32: PANIC! " + << "Error during read of PNG rows" + << ".\n" << logofs_flush; + #endif + + png_destroy_read_struct(&pngPtr, &infoPtr, NULL); + + return -1; + } + + unsigned long pixel; + + int i; + + for (dy = 0; dy < h; dy++) + { + png_read_row(pngPtr, rowPointers, NULL); + + for (dx = 0; dx < w; dx++) + { + pixel = RGB24_TO_PIXEL(32, tmpBuf[dx * 3], tmpBuf[dx * 3 + 1], + tmpBuf[dx * 3 + 2]); + + // + // Follow the server byte order when arranging data. + // + + if (byteOrder == LSBFirst) + { + for (i = 0; i < 4; i++) + { + data[i] = (unsigned char)(pixel & 0xff); + pixel >>= 8; + } + } + else + { + for (i = 3; i >= 0; i--) + { + data[i] = (unsigned char) (pixel & 0xff); + pixel >>= 8; + } + } + + data += 4; + } + } + + png_destroy_read_struct(&pngPtr, &infoPtr,NULL); + + #ifdef DEBUG + *logofs << "DecompressPng32: Decompression finished." + << dy << " lines handled.\n" + << logofs_flush; + #endif + + return 1; +} + +static void PngReadData(png_structp png_ptr, png_bytep data, png_size_t length) +{ + memcpy((char *) data, (char *) png_get_io_ptr(png_ptr) + streamPos, length); + + streamPos += length; +} diff --git a/nxcomp/src/Pgn.h b/nxcomp/src/Pgn.h new file mode 100644 index 000000000..e5ea36715 --- /dev/null +++ b/nxcomp/src/Pgn.h @@ -0,0 +1,42 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Pgn_H +#define Pgn_H + +// +// This file obviously supports PNG +// decompression. It was renamed to +// avoid name clashes on Windows. +// + +#include "Misc.h" +#include "Unpack.h" + +int UnpackPng(T_geometry *geometry, unsigned char method, unsigned char *srcData, + int srcSize, int dstBpp, int dstWidth, int dstHeight, + unsigned char *dstData, int dstSize); + +#endif /* Pgn_H */ diff --git a/nxcomp/src/Pipe.cpp b/nxcomp/src/Pipe.cpp new file mode 100644 index 000000000..4fa149412 --- /dev/null +++ b/nxcomp/src/Pipe.cpp @@ -0,0 +1,433 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +#include "Pipe.h" +#include "Misc.h" +#include "Fork.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +extern void RegisterChild(int child); + +static int Psplit(const char *command, char *parameters[], int limit); + +// +// These are slightly modified versions of popen(3) and pclose(3) +// that don't rely on a shell to be available on the system, so +// that they can also work on Windows. As an additional benefit, +// these functions give up all privileges before running the com- +// mand. Code is taken from the X distribution and, in turn, is +// based on libc from FreeBSD 2.2. +// + +static struct pid +{ + struct pid *next; + FILE *fp; + int self; + +} *pidlist; + +// +// A very unsofisticated attempt to parse the command line and +// split each parameter in distinct strings. This is not going +// to work when dealing with parameters containing spaces, even +// if they are enclosed in quotes. +// + +int Psplit(const char *command, char *parameters[], int limit) +{ + char *line; + char *value; + + int number; + + // + // Preapare the list of parameters. + // + + for (number = 0; number < limit; number++) + { + parameters[number] = NULL; + } + + // + // Copy the command to get rid of the + // const qualifier. + // + + line = new char[strlen(command) + 1]; + + if (line == NULL) + { + goto PsplitError; + } + + strcpy(line, command); + + number = 0; + + value = strtok(line, " "); + + while (value != NULL && number < limit) + { + #ifdef DEBUG + *logofs << "Psplit: Got parameter '" << value + << "'.\n" << logofs_flush; + #endif + + parameters[number] = new char[strlen(value) + 1]; + + if (parameters[number] == NULL) + { + goto PsplitError; + } + + strcpy(parameters[number], value); + + number++; + + // + // If this is the first parameter, then + // copy it in the second position and + // use it as the name of the command. + // + + if (number == 1) + { + parameters[number] = new char[strlen(value) + 1]; + + if (parameters[number] == NULL) + { + goto PsplitError; + } + + strcpy(parameters[number], value); + + number++; + } + + value = strtok(NULL, " "); + } + + // + // Needs at least to have the command itself and + // the first argument, being again the name of + // the command. + // + + if (number < 2) + { + goto PsplitError; + } + + return number; + +PsplitError: + + #ifdef PANIC + *logofs << "Psplit: PANIC! Can't split command line '" + << command << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't split command line '" + << command << "'.\n"; + + delete [] line; + + return -1; +} + +FILE *Popen(char * const parameters[], const char *type) +{ + FILE *iop; + + struct pid *cur; + int pdes[2], pid; + + if (parameters == NULL || type == NULL) + { + return NULL; + } + + if ((*type != 'r' && *type != 'w') || type[1]) + { + return NULL; + } + + if ((cur = (struct pid *) malloc(sizeof(struct pid))) == NULL) + { + return NULL; + } + + if (pipe(pdes) < 0) + { + free(cur); + + return NULL; + } + + // + // Block all signals until command is exited. + // We need to gather information about the + // child in Pclose(). + // + + DisableSignals(); + + switch (pid = Fork()) + { + case -1: + { + // + // Error. + // + + #ifdef PANIC + *logofs << "Popen: PANIC! Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Function fork failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + close(pdes[0]); + close(pdes[1]); + + free(cur); + + return NULL; + } + case 0: + { + // + // Child. + // + + struct passwd *pwent = getpwuid(getuid()); + if (pwent) initgroups(pwent->pw_name,getgid()); + if (setgid(getgid()) == -1) + { + _exit(127); + } + if (setuid(getuid()) == -1) + { + _exit(127); + } + + if (*type == 'r') + { + if (pdes[1] != 1) + { + // + // Set up stdout. + // + + dup2(pdes[1], 1); + close(pdes[1]); + } + + close(pdes[0]); + } + else + { + if (pdes[0] != 0) + { + // + // Set up stdin. + // + + dup2(pdes[0], 0); + close(pdes[0]); + } + + close(pdes[1]); + } + + execvp(parameters[0], parameters + 1); + + exit(127); + } + } + + // + // Parent. Save data about the child. + // + + RegisterChild(pid); + + if (*type == 'r') + { + iop = fdopen(pdes[0], type); + + close(pdes[1]); + } + else + { + iop = fdopen(pdes[1], type); + + close(pdes[0]); + } + + cur -> fp = iop; + cur -> self = pid; + cur -> next = pidlist; + + pidlist = cur; + + #ifdef TEST + *logofs << "Popen: Executing "; + + for (int i = 0; i < 256 && parameters[i] != NULL; i++) + { + *logofs << "[" << parameters[i] << "]"; + } + + *logofs << " with descriptor " << fileno(iop) + << ".\n" << logofs_flush; + #endif + + return iop; +} + +FILE *Popen(const char *command, const char *type) +{ + char *parameters[256]; + + if (Psplit(command, parameters, 256) > 0) + { + FILE *file = Popen(parameters, type); + + for (int i = 0; i < 256; i++) + { + delete [] parameters[i]; + } + + return file; + } + else + { + #ifdef PANIC + *logofs << "Popen: PANIC! Failed to parse command '" + << command << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to parse command '" + << command << "'.\n"; + + return NULL; + } +} + +int Pclose(FILE *iop) +{ + struct pid *cur, *last; + + int pstat; + int pid; + + #ifdef TEST + *logofs << "Pclose: Closing command with output " + << "on descriptor " << fileno(iop) << ".\n" + << logofs_flush; + #endif + + fclose((FILE *) iop); + + for (last = NULL, cur = pidlist; cur; last = cur, cur = cur -> next) + { + if (cur -> fp == iop) + { + break; + } + } + + if (cur == NULL) + { + #ifdef PANIC + *logofs << "Pclose: PANIC! Failed to find the process " + << "for descriptor " << fileno(iop) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to find the process " + << "for descriptor " << fileno(iop) << ".\n"; + + return -1; + } + + do + { + #ifdef TEST + *logofs << "Pclose: Going to wait for process " + << "with pid '" << cur -> self << "'.\n" + << logofs_flush; + #endif + + pid = waitpid(cur -> self, &pstat, 0); + } + while (pid == -1 && errno == EINTR); + + if (last == NULL) + { + pidlist = cur -> next; + } + else + { + last -> next = cur -> next; + } + + free(cur); + + // + // Child has finished and we called the + // waitpid(). We can enable signals again. + // + + EnableSignals(); + + return (pid == -1 ? -1 : pstat); +} diff --git a/nxcomp/src/Pipe.h b/nxcomp/src/Pipe.h new file mode 100644 index 000000000..fd1061d30 --- /dev/null +++ b/nxcomp/src/Pipe.h @@ -0,0 +1,35 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +// +// These are slightly modified versions of popen(3) and pclose(3) +// that don't rely on a shell to be available on the system, so +// that they can also work on Windows. +// + +extern FILE *Popen(char * const parameters[], const char *type); +extern FILE *Popen(const char *command, const char *type); + +extern int Pclose(FILE *file); diff --git a/nxcomp/src/PolyArc.cpp b/nxcomp/src/PolyArc.cpp new file mode 100644 index 000000000..42dbb265d --- /dev/null +++ b/nxcomp/src/PolyArc.cpp @@ -0,0 +1,162 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyArc.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyArcStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyArcMessage *polyArc = (PolyArcMessage *) message; + + // + // Here is the fingerprint. + // + + polyArc -> drawable = GetULONG(buffer + 4, bigEndian); + polyArc -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyArcStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyArcMessage *polyArc = (PolyArcMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(polyArc -> drawable, buffer + 4, bigEndian); + PutULONG(polyArc -> gcontext, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyArcStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyArcMessage *polyArc = (PolyArcMessage *) message; + + *logofs << name() << ": Identity drawable " << polyArc -> drawable + << ", gcontext " << polyArc -> gcontext + << ", size " << polyArc -> size_ << ".\n" << logofs_flush; + #endif +} + +void PolyArcStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void PolyArcStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyArcMessage *polyArc = (PolyArcMessage *) message; + PolyArcMessage *cachedPolyArc = (PolyArcMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyArc -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyArc -> drawable, clientCache -> drawableCache); + + cachedPolyArc -> drawable = polyArc -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyArc -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyArc -> gcontext, clientCache -> gcCache); + + cachedPolyArc -> gcontext = polyArc -> gcontext; +} + +void PolyArcStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyArcMessage *polyArc = (PolyArcMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyArc -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyArc -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyArc -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyArc -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/PolyArc.h b/nxcomp/src/PolyArc.h new file mode 100644 index 000000000..d744d6a10 --- /dev/null +++ b/nxcomp/src/PolyArc.h @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyArc_H +#define PolyArc_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYARC_ENABLE_CACHE 1 +#define POLYARC_ENABLE_DATA 0 +#define POLYARC_ENABLE_SPLIT 0 +#define POLYARC_ENABLE_COMPRESS 0 + +#define POLYARC_DATA_LIMIT 1980 +#define POLYARC_DATA_OFFSET 12 + +#define POLYARC_CACHE_SLOTS 2000 +#define POLYARC_CACHE_THRESHOLD 2 +#define POLYARC_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyArcMessage : public Message +{ + friend class PolyArcStore; + + public: + + PolyArcMessage() + { + } + + ~PolyArcMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int drawable; + unsigned int gcontext; +}; + +class PolyArcStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyArcStore() : MessageStore() + { + enableCache = POLYARC_ENABLE_CACHE; + enableData = POLYARC_ENABLE_DATA; + enableSplit = POLYARC_ENABLE_SPLIT; + enableCompress = POLYARC_ENABLE_COMPRESS; + + dataLimit = POLYARC_DATA_LIMIT; + dataOffset = POLYARC_DATA_OFFSET; + + cacheSlots = POLYARC_CACHE_SLOTS; + cacheThreshold = POLYARC_CACHE_THRESHOLD; + cacheLowerThreshold = POLYARC_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyArcStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyArc"; + } + + virtual unsigned char opcode() const + { + return X_PolyArc; + } + + virtual unsigned int storage() const + { + return sizeof(PolyArcMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyArcMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PolyArcMessage((const PolyArcMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyArcMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyArc_H */ diff --git a/nxcomp/src/PolyFillArc.cpp b/nxcomp/src/PolyFillArc.cpp new file mode 100644 index 000000000..35125f0d3 --- /dev/null +++ b/nxcomp/src/PolyFillArc.cpp @@ -0,0 +1,162 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyFillArc.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyFillArcStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; + + // + // Here is the fingerprint. + // + + polyFillArc -> drawable = GetULONG(buffer + 4, bigEndian); + polyFillArc -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyFillArcStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(polyFillArc -> drawable, buffer + 4, bigEndian); + PutULONG(polyFillArc -> gcontext, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyFillArcStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; + + *logofs << name() << ": Identity drawable " << polyFillArc -> drawable + << ", gcontext " << polyFillArc -> gcontext + << ", size " << polyFillArc -> size_ << ".\n" << logofs_flush; + #endif +} + +void PolyFillArcStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void PolyFillArcStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; + PolyFillArcMessage *cachedPolyFillArc = (PolyFillArcMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyFillArc -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyFillArc -> drawable, clientCache -> drawableCache); + + cachedPolyFillArc -> drawable = polyFillArc -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyFillArc -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyFillArc -> gcontext, clientCache -> gcCache); + + cachedPolyFillArc -> gcontext = polyFillArc -> gcontext; +} + +void PolyFillArcStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyFillArcMessage *polyFillArc = (PolyFillArcMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyFillArc -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyFillArc -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyFillArc -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyFillArc -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/PolyFillArc.h b/nxcomp/src/PolyFillArc.h new file mode 100644 index 000000000..a4eff5b48 --- /dev/null +++ b/nxcomp/src/PolyFillArc.h @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyFillArc_H +#define PolyFillArc_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYFILLARC_ENABLE_CACHE 1 +#define POLYFILLARC_ENABLE_DATA 0 +#define POLYFILLARC_ENABLE_SPLIT 0 +#define POLYFILLARC_ENABLE_COMPRESS 0 + +#define POLYFILLARC_DATA_LIMIT 6144 +#define POLYFILLARC_DATA_OFFSET 12 + +#define POLYFILLARC_CACHE_SLOTS 2000 +#define POLYFILLARC_CACHE_THRESHOLD 2 +#define POLYFILLARC_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyFillArcMessage : public Message +{ + friend class PolyFillArcStore; + + public: + + PolyFillArcMessage() + { + } + + ~PolyFillArcMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int drawable; + unsigned int gcontext; +}; + +class PolyFillArcStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyFillArcStore() : MessageStore() + { + enableCache = POLYFILLARC_ENABLE_CACHE; + enableData = POLYFILLARC_ENABLE_DATA; + enableSplit = POLYFILLARC_ENABLE_SPLIT; + enableCompress = POLYFILLARC_ENABLE_COMPRESS; + + dataLimit = POLYFILLARC_DATA_LIMIT; + dataOffset = POLYFILLARC_DATA_OFFSET; + + cacheSlots = POLYFILLARC_CACHE_SLOTS; + cacheThreshold = POLYFILLARC_CACHE_THRESHOLD; + cacheLowerThreshold = POLYFILLARC_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyFillArcStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyFillArc"; + } + + virtual unsigned char opcode() const + { + return X_PolyFillArc; + } + + virtual unsigned int storage() const + { + return sizeof(PolyFillArcMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyFillArcMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PolyFillArcMessage((const PolyFillArcMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyFillArcMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyFillArc_H */ diff --git a/nxcomp/src/PolyFillRectangle.cpp b/nxcomp/src/PolyFillRectangle.cpp new file mode 100644 index 000000000..95694e582 --- /dev/null +++ b/nxcomp/src/PolyFillRectangle.cpp @@ -0,0 +1,160 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyFillRectangle.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyFillRectangleStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; + + // + // Here is the fingerprint. + // + + polyFillRectangle -> drawable = GetULONG(buffer + 4, bigEndian); + polyFillRectangle -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyFillRectangleStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(polyFillRectangle -> drawable, buffer + 4, bigEndian); + PutULONG(polyFillRectangle -> gcontext, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyFillRectangleStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; + + *logofs << name() << ": Identity drawable " << polyFillRectangle -> drawable + << ", gcontext " << polyFillRectangle -> gcontext + << ", size " << polyFillRectangle -> size_ << ".\n" << logofs_flush; + #endif +} + +void PolyFillRectangleStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void PolyFillRectangleStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; + PolyFillRectangleMessage *cachedPolyFillRectangle = (PolyFillRectangleMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding value " << polyFillRectangle -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyFillRectangle -> drawable, clientCache -> drawableCache); + + cachedPolyFillRectangle -> drawable = polyFillRectangle -> drawable; + + #ifdef DEBUG + *logofs << name() << ": Encoding value " << polyFillRectangle -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyFillRectangle -> gcontext, clientCache -> gcCache); + + cachedPolyFillRectangle -> gcontext = polyFillRectangle -> gcontext; +} + +void PolyFillRectangleStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyFillRectangleMessage *polyFillRectangle = (PolyFillRectangleMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyFillRectangle -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyFillRectangle -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyFillRectangle -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyFillRectangle -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/PolyFillRectangle.h b/nxcomp/src/PolyFillRectangle.h new file mode 100644 index 000000000..7ebb9270d --- /dev/null +++ b/nxcomp/src/PolyFillRectangle.h @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyFillRectangle_H +#define PolyFillRectangle_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYFILLRECTANGLE_ENABLE_CACHE 1 +#define POLYFILLRECTANGLE_ENABLE_DATA 0 +#define POLYFILLRECTANGLE_ENABLE_SPLIT 0 +#define POLYFILLRECTANGLE_ENABLE_COMPRESS 0 + +#define POLYFILLRECTANGLE_DATA_LIMIT 2048 +#define POLYFILLRECTANGLE_DATA_OFFSET 12 + +#define POLYFILLRECTANGLE_CACHE_SLOTS 4000 +#define POLYFILLRECTANGLE_CACHE_THRESHOLD 5 +#define POLYFILLRECTANGLE_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyFillRectangleMessage : public Message +{ + friend class PolyFillRectangleStore; + + public: + + PolyFillRectangleMessage() + { + } + + ~PolyFillRectangleMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int drawable; + unsigned int gcontext; +}; + +class PolyFillRectangleStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyFillRectangleStore() : MessageStore() + { + enableCache = POLYFILLRECTANGLE_ENABLE_CACHE; + enableData = POLYFILLRECTANGLE_ENABLE_DATA; + enableSplit = POLYFILLRECTANGLE_ENABLE_SPLIT; + enableCompress = POLYFILLRECTANGLE_ENABLE_COMPRESS; + + dataLimit = POLYFILLRECTANGLE_DATA_LIMIT; + dataOffset = POLYFILLRECTANGLE_DATA_OFFSET; + + cacheSlots = POLYFILLRECTANGLE_CACHE_SLOTS; + cacheThreshold = POLYFILLRECTANGLE_CACHE_THRESHOLD; + cacheLowerThreshold = POLYFILLRECTANGLE_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyFillRectangleStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyFillRectangle"; + } + + virtual unsigned char opcode() const + { + return X_PolyFillRectangle; + } + + virtual unsigned int storage() const + { + return sizeof(PolyFillRectangleMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyFillRectangleMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PolyFillRectangleMessage((const PolyFillRectangleMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyFillRectangleMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyFillRectangle_H */ diff --git a/nxcomp/src/PolyLine.cpp b/nxcomp/src/PolyLine.cpp new file mode 100644 index 000000000..1b12bbe98 --- /dev/null +++ b/nxcomp/src/PolyLine.cpp @@ -0,0 +1,168 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyLine.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyLineStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyLineMessage *polyLine = (PolyLineMessage *) message; + + // + // Here is the fingerprint. + // + + polyLine -> mode = *(buffer + 1); + + polyLine -> drawable = GetULONG(buffer + 4, bigEndian); + polyLine -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyLineStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyLineMessage *polyLine = (PolyLineMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = polyLine -> mode; + + PutULONG(polyLine -> drawable, buffer + 4, bigEndian); + PutULONG(polyLine -> gcontext, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyLineStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyLineMessage *polyLine = (PolyLineMessage *) message; + + *logofs << name() << ": Identity drawable " << polyLine -> drawable + << ", gcontext " << polyLine -> gcontext + << ", size " << polyLine -> size_ << ".\n" << logofs_flush; + #endif +} + +void PolyLineStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // Since ProtoStep8 (#issue 108) + md5_append(md5_state_, buffer + 1, 1); +} + +void PolyLineStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyLineMessage *polyLine = (PolyLineMessage *) message; + PolyLineMessage *cachedPolyLine = (PolyLineMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyLine -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyLine -> drawable, clientCache -> drawableCache); + + cachedPolyLine -> drawable = polyLine -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyLine -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyLine -> gcontext, clientCache -> gcCache); + + cachedPolyLine -> gcontext = polyLine -> gcontext; +} + +void PolyLineStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyLineMessage *polyLine = (PolyLineMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyLine -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyLine -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyLine -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyLine -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/PolyLine.h b/nxcomp/src/PolyLine.h new file mode 100644 index 000000000..66fa5df1a --- /dev/null +++ b/nxcomp/src/PolyLine.h @@ -0,0 +1,186 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyLine_H +#define PolyLine_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYLINE_ENABLE_CACHE 1 +#define POLYLINE_ENABLE_DATA 0 +#define POLYLINE_ENABLE_SPLIT 0 +#define POLYLINE_ENABLE_COMPRESS 0 + +#define POLYLINE_DATA_LIMIT 144 +#define POLYLINE_DATA_OFFSET 12 + +#define POLYLINE_CACHE_SLOTS 3000 +#define POLYLINE_CACHE_THRESHOLD 3 +#define POLYLINE_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyLineMessage : public Message +{ + friend class PolyLineStore; + + public: + + PolyLineMessage() + { + } + + ~PolyLineMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char mode; + unsigned int drawable; + unsigned int gcontext; +}; + +class PolyLineStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyLineStore() : MessageStore() + { + enableCache = POLYLINE_ENABLE_CACHE; + enableData = POLYLINE_ENABLE_DATA; + enableSplit = POLYLINE_ENABLE_SPLIT; + enableCompress = POLYLINE_ENABLE_COMPRESS; + + dataLimit = POLYLINE_DATA_LIMIT; + dataOffset = POLYLINE_DATA_OFFSET; + + cacheSlots = POLYLINE_CACHE_SLOTS; + cacheThreshold = POLYLINE_CACHE_THRESHOLD; + cacheLowerThreshold = POLYLINE_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyLineStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyLine"; + } + + virtual unsigned char opcode() const + { + return X_PolyLine; + } + + virtual unsigned int storage() const + { + return sizeof(PolyLineMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyLineMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PolyLineMessage((const PolyLineMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyLineMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyLine_H */ diff --git a/nxcomp/src/PolyPoint.cpp b/nxcomp/src/PolyPoint.cpp new file mode 100644 index 000000000..70151cc0d --- /dev/null +++ b/nxcomp/src/PolyPoint.cpp @@ -0,0 +1,168 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyPoint.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyPointStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyPointMessage *polyPoint = (PolyPointMessage *) message; + + // + // Here is the fingerprint. + // + + polyPoint -> mode = *(buffer + 1); + + polyPoint -> drawable = GetULONG(buffer + 4, bigEndian); + polyPoint -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyPointStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyPointMessage *polyPoint = (PolyPointMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = polyPoint -> mode; + + PutULONG(polyPoint -> drawable, buffer + 4, bigEndian); + PutULONG(polyPoint -> gcontext, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyPointStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyPointMessage *polyPoint = (PolyPointMessage *) message; + + *logofs << name() << ": Identity drawable " << polyPoint -> drawable + << ", gcontext " << polyPoint -> gcontext + << ", size " << polyPoint -> size_ << ".\n" << logofs_flush; + #endif +} + +void PolyPointStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // Since ProtoStep8 (#issue 108) + md5_append(md5_state_, buffer + 1, 1); +} + +void PolyPointStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyPointMessage *polyPoint = (PolyPointMessage *) message; + PolyPointMessage *cachedPolyPoint = (PolyPointMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyPoint -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyPoint -> drawable, clientCache -> drawableCache); + + cachedPolyPoint -> drawable = polyPoint -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyPoint -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyPoint -> gcontext, clientCache -> gcCache); + + cachedPolyPoint -> gcontext = polyPoint -> gcontext; +} + +void PolyPointStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyPointMessage *polyPoint = (PolyPointMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyPoint -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyPoint -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyPoint -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyPoint -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/PolyPoint.h b/nxcomp/src/PolyPoint.h new file mode 100644 index 000000000..b8ea183bf --- /dev/null +++ b/nxcomp/src/PolyPoint.h @@ -0,0 +1,186 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyPoint_H +#define PolyPoint_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYPOINT_ENABLE_CACHE 1 +#define POLYPOINT_ENABLE_DATA 0 +#define POLYPOINT_ENABLE_SPLIT 0 +#define POLYPOINT_ENABLE_COMPRESS 0 + +#define POLYPOINT_DATA_LIMIT 3200 +#define POLYPOINT_DATA_OFFSET 12 + +#define POLYPOINT_CACHE_SLOTS 3000 +#define POLYPOINT_CACHE_THRESHOLD 3 +#define POLYPOINT_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyPointMessage : public Message +{ + friend class PolyPointStore; + + public: + + PolyPointMessage() + { + } + + ~PolyPointMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char mode; + unsigned int drawable; + unsigned int gcontext; +}; + +class PolyPointStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyPointStore() : MessageStore() + { + enableCache = POLYPOINT_ENABLE_CACHE; + enableData = POLYPOINT_ENABLE_DATA; + enableSplit = POLYPOINT_ENABLE_SPLIT; + enableCompress = POLYPOINT_ENABLE_COMPRESS; + + dataLimit = POLYPOINT_DATA_LIMIT; + dataOffset = POLYPOINT_DATA_OFFSET; + + cacheSlots = POLYPOINT_CACHE_SLOTS; + cacheThreshold = POLYPOINT_CACHE_THRESHOLD; + cacheLowerThreshold = POLYPOINT_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyPointStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyPoint"; + } + + virtual unsigned char opcode() const + { + return X_PolyPoint; + } + + virtual unsigned int storage() const + { + return sizeof(PolyPointMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyPointMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PolyPointMessage((const PolyPointMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyPointMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyPoint_H */ diff --git a/nxcomp/src/PolySegment.cpp b/nxcomp/src/PolySegment.cpp new file mode 100644 index 000000000..aa2d4efe3 --- /dev/null +++ b/nxcomp/src/PolySegment.cpp @@ -0,0 +1,162 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolySegment.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolySegmentStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolySegmentMessage *polySegment = (PolySegmentMessage *) message; + + // + // Here is the fingerprint. + // + + polySegment -> drawable = GetULONG(buffer + 4, bigEndian); + polySegment -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolySegmentStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolySegmentMessage *polySegment = (PolySegmentMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(polySegment -> drawable, buffer + 4, bigEndian); + PutULONG(polySegment -> gcontext, buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolySegmentStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolySegmentMessage *polySegment = (PolySegmentMessage *) message; + + *logofs << name() << ": Identity drawable " << polySegment -> drawable + << ", gcontext " << polySegment -> gcontext + << ", size " << polySegment -> size_ << ".\n" << logofs_flush; + #endif +} + +void PolySegmentStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void PolySegmentStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolySegmentMessage *polySegment = (PolySegmentMessage *) message; + PolySegmentMessage *cachedPolySegment = (PolySegmentMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polySegment -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polySegment -> drawable, clientCache -> drawableCache); + + cachedPolySegment -> drawable = polySegment -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polySegment -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polySegment -> gcontext, clientCache -> gcCache); + + cachedPolySegment -> gcontext = polySegment -> gcontext; +} + +void PolySegmentStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolySegmentMessage *polySegment = (PolySegmentMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polySegment -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polySegment -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polySegment -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polySegment -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/PolySegment.h b/nxcomp/src/PolySegment.h new file mode 100644 index 000000000..53fd42c60 --- /dev/null +++ b/nxcomp/src/PolySegment.h @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolySegment_H +#define PolySegment_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYSEGMENT_ENABLE_CACHE 1 +#define POLYSEGMENT_ENABLE_DATA 0 +#define POLYSEGMENT_ENABLE_SPLIT 0 +#define POLYSEGMENT_ENABLE_COMPRESS 0 + +#define POLYSEGMENT_DATA_LIMIT 8192 +#define POLYSEGMENT_DATA_OFFSET 12 + +#define POLYSEGMENT_CACHE_SLOTS 3000 +#define POLYSEGMENT_CACHE_THRESHOLD 5 +#define POLYSEGMENT_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolySegmentMessage : public Message +{ + friend class PolySegmentStore; + + public: + + PolySegmentMessage() + { + } + + ~PolySegmentMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int drawable; + unsigned int gcontext; +}; + +class PolySegmentStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolySegmentStore() : MessageStore() + { + enableCache = POLYSEGMENT_ENABLE_CACHE; + enableData = POLYSEGMENT_ENABLE_DATA; + enableSplit = POLYSEGMENT_ENABLE_SPLIT; + enableCompress = POLYSEGMENT_ENABLE_COMPRESS; + + dataLimit = POLYSEGMENT_DATA_LIMIT; + dataOffset = POLYSEGMENT_DATA_OFFSET; + + cacheSlots = POLYSEGMENT_CACHE_SLOTS; + cacheThreshold = POLYSEGMENT_CACHE_THRESHOLD; + cacheLowerThreshold = POLYSEGMENT_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolySegmentStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolySegment"; + } + + virtual unsigned char opcode() const + { + return X_PolySegment; + } + + virtual unsigned int storage() const + { + return sizeof(PolySegmentMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolySegmentMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PolySegmentMessage((const PolySegmentMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolySegmentMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolySegment_H */ diff --git a/nxcomp/src/PolyText16.cpp b/nxcomp/src/PolyText16.cpp new file mode 100644 index 000000000..32be45482 --- /dev/null +++ b/nxcomp/src/PolyText16.cpp @@ -0,0 +1,312 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyText16.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyText16Store::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyText16Message *polyText16 = (PolyText16Message *) message; + + // + // Here is the fingerprint. + // + + polyText16 -> drawable = GetULONG(buffer + 4, bigEndian); + polyText16 -> gcontext = GetULONG(buffer + 8, bigEndian); + + polyText16 -> x = GetUINT(buffer + 12, bigEndian); + polyText16 -> y = GetUINT(buffer + 14, bigEndian); + + // + // Clean up padding bytes. + // + + #ifdef DUMP + + DumpData(buffer, size); + + *logofs << "\n" << logofs_flush; + + #endif + + if ((int) size > dataOffset) + { + int current; + int length; + int delta; + int item; + + unsigned int nitem; + + unsigned char *pad = NULL; + unsigned char *end = NULL; + + delta = 1; + nitem = 0; + + #ifdef DUMP + *logofs << name() << " Size " << size << ".\n" << logofs_flush; + #endif + + // + // Data is a list of TextItem where element + // can be a string or a font shift. + // + + current = POLYTEXT16_DATA_OFFSET; + length = POLYTEXT16_DATA_OFFSET; + + do + { + #ifdef DUMP + *logofs << name() << " Current " << current << ".\n" << logofs_flush; + #endif + + item = GetUINT(buffer + length , bigEndian); + + if (item < 255) + { + // + // Text element. Number represents + // the 'Length of CHAR2B string' + // field. + // + + length += ((item * 2) + delta + 1); + + nitem++; + } + else if (item == 255) + { + // + // Element is a font shift. + // + + length += 5; + + nitem++; + } + + #ifdef DUMP + *logofs << name() << " Item " << item << ".\n" << logofs_flush; + #endif + + current += length; + } + while(current < (int) size && item != 0); + + #ifdef DUMP + *logofs << name() << " Final length " << length << ".\n" << logofs_flush; + #endif + + end = ((unsigned char *) buffer) + size; + + pad = ((unsigned char *) buffer) + length; + + for (; pad < end && nitem >= 1; pad++) + { + #ifdef DUMP + *logofs << name() << " Padding " << " .\n" << logofs_flush; + #endif + + *pad = 0; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyText16Store::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyText16Message *polyText16 = (PolyText16Message *) message; + + // + // Fill all the message's fields. + // + + PutULONG(polyText16 -> drawable, buffer + 4, bigEndian); + PutULONG(polyText16 -> gcontext, buffer + 8, bigEndian); + + PutUINT(polyText16 -> x, buffer + 12, bigEndian); + PutUINT(polyText16 -> y, buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyText16Store::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyText16Message *polyText16 = (PolyText16Message *) message; + + *logofs << name() << ": Identity drawable " << polyText16 -> drawable + << ", gcontext " << polyText16 -> gcontext << ", x " << polyText16 -> x + << ", y " << polyText16 -> y << ", size " << polyText16 -> size_ + << ".\n"; + + #endif +} + +void PolyText16Store::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void PolyText16Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyText16Message *polyText16 = (PolyText16Message *) message; + PolyText16Message *cachedPolyText16 = (PolyText16Message *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText16 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyText16 -> drawable, clientCache -> drawableCache); + + cachedPolyText16 -> drawable = polyText16 -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText16 -> gcontext + << " as " << "gcontext" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyText16 -> gcontext, clientCache -> gcCache); + + cachedPolyText16 -> gcontext = polyText16 -> gcontext; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText16 -> x + << " as " << "x" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_x = polyText16 -> x - cachedPolyText16 -> x; + + encodeBuffer.encodeCachedValue(diff_x, 16, + clientCache -> polyTextCacheX); + + cachedPolyText16 -> x = polyText16 -> x; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText16 -> y + << " as " << "y" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_y = polyText16 -> y - cachedPolyText16 -> y; + + encodeBuffer.encodeCachedValue(diff_y, 16, + clientCache -> polyTextCacheY); + + cachedPolyText16 -> y = polyText16 -> y; +} + +void PolyText16Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyText16Message *polyText16 = (PolyText16Message *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyText16 -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText16 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyText16 -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText16 -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> polyTextCacheX); + + polyText16 -> x += value; + polyText16 -> x &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText16 -> x + << " as x field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> polyTextCacheY); + + polyText16 -> y += value; + polyText16 -> y &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText16 -> y + << " as y field.\n" << logofs_flush; + #endif +} + + diff --git a/nxcomp/src/PolyText16.h b/nxcomp/src/PolyText16.h new file mode 100644 index 000000000..805e1fa04 --- /dev/null +++ b/nxcomp/src/PolyText16.h @@ -0,0 +1,188 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyText16_H +#define PolyText16_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYTEXT16_ENABLE_CACHE 1 +#define POLYTEXT16_ENABLE_DATA 0 +#define POLYTEXT16_ENABLE_SPLIT 0 +#define POLYTEXT16_ENABLE_COMPRESS 0 + +#define POLYTEXT16_DATA_LIMIT 420 +#define POLYTEXT16_DATA_OFFSET 16 + +#define POLYTEXT16_CACHE_SLOTS 3000 +#define POLYTEXT16_CACHE_THRESHOLD 4 +#define POLYTEXT16_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyText16Message : public Message +{ + friend class PolyText16Store; + + public: + + PolyText16Message() + { + } + + ~PolyText16Message() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int drawable; + unsigned int gcontext; + + unsigned short x; + unsigned short y; +}; + +class PolyText16Store : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyText16Store() : MessageStore() + { + enableCache = POLYTEXT16_ENABLE_CACHE; + enableData = POLYTEXT16_ENABLE_DATA; + enableSplit = POLYTEXT16_ENABLE_SPLIT; + enableCompress = POLYTEXT16_ENABLE_COMPRESS; + + dataLimit = POLYTEXT16_DATA_LIMIT; + dataOffset = POLYTEXT16_DATA_OFFSET; + + cacheSlots = POLYTEXT16_CACHE_SLOTS; + cacheThreshold = POLYTEXT16_CACHE_THRESHOLD; + cacheLowerThreshold = POLYTEXT16_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyText16Store() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyText16"; + } + + virtual unsigned char opcode() const + { + return X_PolyText16; + } + + virtual unsigned int storage() const + { + return sizeof(PolyText16Message); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyText16Message(); + } + + virtual Message *create(const Message &message) const + { + return new PolyText16Message((const PolyText16Message &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyText16Message *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyText16_H */ diff --git a/nxcomp/src/PolyText8.cpp b/nxcomp/src/PolyText8.cpp new file mode 100644 index 000000000..61fef5a4f --- /dev/null +++ b/nxcomp/src/PolyText8.cpp @@ -0,0 +1,310 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PolyText8.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int PolyText8Store::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyText8Message *polyText8 = (PolyText8Message *) message; + + // + // Here is the fingerprint. + // + + polyText8 -> drawable = GetULONG(buffer + 4, bigEndian); + polyText8 -> gcontext = GetULONG(buffer + 8, bigEndian); + + polyText8 -> x = GetUINT(buffer + 12, bigEndian); + polyText8 -> y = GetUINT(buffer + 14, bigEndian); + + // + // Clean up padding bytes. + // + + #ifdef DUMP + + DumpData(buffer, size); + + *logofs << "\n\n" << logofs_flush; + + #endif + + if ((int) size > dataOffset) + { + int length; + int current; + int delta; + int item; + + unsigned int nitem; + + unsigned char *pad = NULL; + unsigned char *end = NULL; + + delta = 1; + nitem = 0; + + #ifdef DUMP + *logofs << name() << " Size " << size << ".\n" << logofs_flush; + #endif + + // + // Data is a list of TextItem where element + // can be a string or a font shift. + // + + current = POLYTEXT8_DATA_OFFSET; + length = POLYTEXT8_DATA_OFFSET; + + do + { + #ifdef DUMP + *logofs << name() << " Current " << current << ".\n" << logofs_flush; + #endif + + item = GetUINT(buffer + length , bigEndian); + + if (item < 255) + { + // + // Text element. Number represents + // the 'Length of string' field. + // + + length += (item + delta + 1); + + nitem++; + } + else if (item == 255) + { + // + // Element is a font shift. + // + + length += 5; + + nitem++; + } + + #ifdef DUMP + *logofs << name() << " Item " << item << ".\n" << logofs_flush; + #endif + + current += length; + } + while(current < (int) size && item != 0); + + + #ifdef DUMP + *logofs << name() << " Final length " << length << ".\n" << logofs_flush; + #endif + + end = ((unsigned char *) buffer) + size; + + pad = ((unsigned char *) buffer) + length; + + for (; pad < end && nitem >= 1; pad++) + { + #ifdef DUMP + *logofs << name() << " Padding " << " .\n" << logofs_flush; + #endif + + *pad = 0; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PolyText8Store::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PolyText8Message *polyText8 = (PolyText8Message *) message; + + // + // Fill all the message's fields. + // + + PutULONG(polyText8 -> drawable, buffer + 4, bigEndian); + PutULONG(polyText8 -> gcontext, buffer + 8, bigEndian); + + PutUINT(polyText8 -> x, buffer + 12, bigEndian); + PutUINT(polyText8 -> y, buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PolyText8Store::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PolyText8Message *polyText8 = (PolyText8Message *) message; + + *logofs << name() << ": Identity drawable " << polyText8 -> drawable + << ", gcontext " << polyText8 -> gcontext << ", x " << polyText8 -> x + << ", y " << polyText8 -> y << ", size " << polyText8 -> size_ + << ".\n"; + + #endif +} + +void PolyText8Store::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void PolyText8Store::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + PolyText8Message *polyText8 = (PolyText8Message *) message; + PolyText8Message *cachedPolyText8 = (PolyText8Message *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText8 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyText8 -> drawable, clientCache -> drawableCache); + + cachedPolyText8 -> drawable = polyText8 -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText8 -> gcontext + << " as " << "gcontext" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(polyText8 -> gcontext, clientCache -> gcCache); + + cachedPolyText8 -> gcontext = polyText8 -> gcontext; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText8 -> x + << " as " << "x" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_x = polyText8 -> x - cachedPolyText8 -> x; + + encodeBuffer.encodeCachedValue(diff_x, 16, + clientCache -> polyTextCacheX); + + cachedPolyText8 -> x = polyText8 -> x; + + #ifdef TEST + *logofs << name() << ": Encoding value " << polyText8 -> y + << " as " << "y" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_y = polyText8 -> y - cachedPolyText8 -> y; + + encodeBuffer.encodeCachedValue(diff_y, 16, + clientCache -> polyTextCacheY); + + cachedPolyText8 -> y = polyText8 -> y; +} + +void PolyText8Store::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + PolyText8Message *polyText8 = (PolyText8Message *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + polyText8 -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText8 -> drawable + << " as " << "drawable" << " field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + polyText8 -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText8 -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> polyTextCacheX); + + polyText8 -> x += value; + polyText8 -> x &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText8 -> x + << " as x field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> polyTextCacheY); + + polyText8 -> y += value; + polyText8 -> y &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << polyText8 -> y + << " as y field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/PolyText8.h b/nxcomp/src/PolyText8.h new file mode 100644 index 000000000..3d5ff533a --- /dev/null +++ b/nxcomp/src/PolyText8.h @@ -0,0 +1,188 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PolyText8_H +#define PolyText8_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define POLYTEXT8_ENABLE_CACHE 1 +#define POLYTEXT8_ENABLE_DATA 0 +#define POLYTEXT8_ENABLE_SPLIT 0 +#define POLYTEXT8_ENABLE_COMPRESS 0 + +#define POLYTEXT8_DATA_LIMIT 380 +#define POLYTEXT8_DATA_OFFSET 16 + +#define POLYTEXT8_CACHE_SLOTS 3000 +#define POLYTEXT8_CACHE_THRESHOLD 5 +#define POLYTEXT8_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class PolyText8Message : public Message +{ + friend class PolyText8Store; + + public: + + PolyText8Message() + { + } + + ~PolyText8Message() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int drawable; + unsigned int gcontext; + + unsigned short x; + unsigned short y; +}; + +class PolyText8Store : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PolyText8Store() : MessageStore() + { + enableCache = POLYTEXT8_ENABLE_CACHE; + enableData = POLYTEXT8_ENABLE_DATA; + enableSplit = POLYTEXT8_ENABLE_SPLIT; + enableCompress = POLYTEXT8_ENABLE_COMPRESS; + + dataLimit = POLYTEXT8_DATA_LIMIT; + dataOffset = POLYTEXT8_DATA_OFFSET; + + cacheSlots = POLYTEXT8_CACHE_SLOTS; + cacheThreshold = POLYTEXT8_CACHE_THRESHOLD; + cacheLowerThreshold = POLYTEXT8_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~PolyText8Store() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "PolyText8"; + } + + virtual unsigned char opcode() const + { + return X_PolyText8; + } + + virtual unsigned int storage() const + { + return sizeof(PolyText8Message); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new PolyText8Message(); + } + + virtual Message *create(const Message &message) const + { + return new PolyText8Message((const PolyText8Message &) message); + } + + virtual void destroy(Message *message) const + { + delete (PolyText8Message *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PolyText8_H */ diff --git a/nxcomp/src/Proxy.cpp b/nxcomp/src/Proxy.cpp new file mode 100644 index 000000000..72b2cee21 --- /dev/null +++ b/nxcomp/src/Proxy.cpp @@ -0,0 +1,6529 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include +#include +#include + +#ifdef ANDROID +#include +#include +#include +#endif + +#include "Misc.h" + +#if defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) +#include +#endif + +#ifndef ANDROID +#include +#include +#include +#endif + +#include "NXalert.h" +#include "NXvars.h" + +#include "Proxy.h" + +#include "Socket.h" +#include "Channel.h" +#include "Statistics.h" + +#include "ClientChannel.h" +#include "ServerChannel.h" +#include "GenericChannel.h" +#include "ChannelEndPoint.h" + +// +// We need to adjust some values related +// to these messages at the time the mes- +// sage stores are reconfigured. +// + +#include "PutImage.h" +#include "ChangeGC.h" +#include "PolyFillRectangle.h" +#include "PutPackedImage.h" + +// +// This is from the main loop. +// + +extern void CleanupListeners(); + +extern int HandleChild(int); + +// +// Default size of string buffers. +// + +#define DEFAULT_STRING_LENGTH 512 + +// +// Set the verbosity level. You also need +// to define DUMP in Misc.cpp if DUMP is +// defined here. +// + +#define WARNING +#define PANIC +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Log the important tracepoints related +// to writing packets to the peer proxy. +// + +#undef FLUSH + +// +// Log the operations related to splits. +// + +#undef SPLIT + +// +// Log the operations related to sending +// and receiving the control tokens. +// + +#undef TOKEN + +// +// Log the operations related to setting +// the token limits. +// + +#undef LIMIT + +// +// Log a warning if no data is written by +// the proxy within a timeout. +// + +#undef TIME + +// +// Log the operation related to generating +// the ping message at idle time. +// + +#undef PING + +Proxy::Proxy(int fd) + + : transport_(new ProxyTransport(fd)), fd_(fd), readBuffer_(transport_) +{ + for (int channelId = 0; + channelId < CONNECTIONS_LIMIT; + channelId++) + { + channels_[channelId] = NULL; + transports_[channelId] = NULL; + congestions_[channelId] = 0; + + fdMap_[channelId] = nothing; + channelMap_[channelId] = nothing; + slavePidMap_[channelId] = nothing; + } + + inputChannel_ = nothing; + outputChannel_ = nothing; + + controlLength_ = 0; + + operation_ = operation_in_negotiation; + + draining_ = 0; + priority_ = 0; + finish_ = 0; + shutdown_ = 0; + congestion_ = 0; + + timer_ = 0; + alert_ = 0; + + agent_ = nothing; + + // + // Set null timeouts. This will require + // a new link configuration. + // + + timeouts_.split = 0; + timeouts_.motion = 0; + + timeouts_.readTs = getTimestamp(); + timeouts_.writeTs = getTimestamp(); + + timeouts_.loopTs = getTimestamp(); + timeouts_.pingTs = getTimestamp(); + timeouts_.alertTs = nullTimestamp(); + timeouts_.loadTs = nullTimestamp(); + + timeouts_.splitTs = nullTimestamp(); + timeouts_.motionTs = nullTimestamp(); + + // + // Initialize the token counters. This + // will require a new link configuration. + // + + for (int i = token_control; i <= token_data; i++) + { + tokens_[i].size = 0; + tokens_[i].limit = 0; + + tokens_[i].bytes = 0; + tokens_[i].remaining = 0; + } + + tokens_[token_control].request = code_control_token_request; + tokens_[token_control].reply = code_control_token_reply; + tokens_[token_control].type = token_control; + + tokens_[token_split].request = code_split_token_request; + tokens_[token_split].reply = code_split_token_reply; + tokens_[token_split].type = token_split; + + tokens_[token_data].request = code_data_token_request; + tokens_[token_data].reply = code_data_token_reply; + tokens_[token_data].type = token_data; + + currentStatistics_ = NULL; + + // + // Create compressor and decompressor + // for image and data payload. + // + + compressor_ = new StaticCompressor(control -> LocalDataCompressionLevel, + control -> LocalDataCompressionThreshold); + + // + // Create object storing NX specific + // opcodes. + // + + opcodeStore_ = new OpcodeStore(); + + // + // Create the message stores. + // + + clientStore_ = new ClientStore(compressor_); + serverStore_ = new ServerStore(compressor_); + + clientCache_ = new ClientCache(); + serverCache_ = new ServerCache(); + + if (clientCache_ == NULL || serverCache_ == NULL) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Failed to create the channel cache.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to create the channel cache.\n"; + + HandleCleanup(); + } + + // + // Prepare for image decompression. + // + + UnpackInit(); + + #ifdef DEBUG + *logofs << "Proxy: Created new object at " << this + << ".\n" << logofs_flush; + #endif +} + +Proxy::~Proxy() +{ + for (int channelId = 0; + channelId < CONNECTIONS_LIMIT; + channelId++) + { + if (channels_[channelId] != NULL) + { + deallocateTransport(channelId); + + delete channels_[channelId]; + channels_[channelId] = NULL; + } + } + + // + // Kill all active slave channel children, and + // give them 5 seconds to exit nicely. + + #ifdef DEBUG + *logofs << "Proxy: Killing active slaves" << endl; + #endif + + int slave_count = 999; + int loop_count = 0; + + while(slave_count > 0 && loop_count < 50) + { + slave_count = 0; + + for (int channelId = 0; channelId 1) { + slave_count++; + + #ifdef DEBUG + *logofs << "Proxy: Active slave with pid " << pid << logofs_flush; + #endif + + if ( loop_count == 0 ) + { + #ifdef DEBUG + *logofs << "Proxy: Sending SIGTERM to " << pid << logofs_flush; + #endif + kill(pid, SIGTERM); + } + else if ( loop_count == 25 ) + { + #ifdef DEBUG + *logofs << "Proxy: Sending SIGKILL to " << pid << logofs_flush; + #endif + kill(pid, SIGKILL); + } + + if (HandleChild(pid)) + { + #ifdef DEBUG + *logofs << "Proxy: Slave " << pid << " terminated" << logofs_flush; + #endif + slavePidMap_[channelId] = nothing; + } + } + } + + if ( slave_count > 0 ) + { + cerr << "Proxy: Error: Failed to kill all slave channel processes. " << slave_count << " processes still remaining." << endl; + } + + usleep(200000); + loop_count++; + } + + delete transport_; + delete compressor_; + + // + // Delete storage shared among channels. + // + + delete opcodeStore_; + + delete clientStore_; + delete serverStore_; + + delete clientCache_; + delete serverCache_; + + // + // Get rid of the image decompression + // resources. + // + + UnpackDestroy(); + + #ifdef DEBUG + *logofs << "Proxy: Deleted proxy object at " << this + << ".\n" << logofs_flush; + #endif +} + +int Proxy::setOperational() +{ + #ifdef TEST + *logofs << "Proxy: Entering operational mode.\n" + << logofs_flush; + #endif + + operation_ = operation_in_messages; + + return 1; +} + +int Proxy::setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax) +{ + // + // Set the initial timeout to the time of + // the next ping. If the congestion count + // is greater than zero, anyway, use a + // shorter timeout to force a congestion + // update. + // + + if (agent_ != nothing && congestions_[agent_] == 0 && + statistics -> getCongestionInFrame() >= 1 && + tokens_[token_control].remaining >= + (tokens_[token_control].limit - 1)) + { + setMinTimestamp(tsMax, control -> IdleTimeout); + + #ifdef TEST + *logofs << "Proxy: Initial timeout is " << tsMax.tv_sec + << " S and " << (double) tsMax.tv_usec / + 1000 << " Ms with congestion " + << statistics -> getCongestionInFrame() + << ".\n" << logofs_flush; + #endif + } + else + { + setMinTimestamp(tsMax, control -> PingTimeout); + + #ifdef TEST + *logofs << "Proxy: Initial timeout is " << tsMax.tv_sec + << " S and " << (double) tsMax.tv_usec / + 1000 << " Ms.\n" << logofs_flush; + #endif + } + + int fd = -1; + + if (isTimeToRead() == 1) + { + // + // If we don't have split tokens available + // don't set the timeout. + // + + if (tokens_[token_split].remaining > 0 && + isTimestamp(timeouts_.splitTs) == 1) + { + int diffTs = getTimeToNextSplit(); + + #if defined(TEST) || defined(INFO) || \ + defined(FLUSH) || defined(SPLIT) + + if (diffTimestamp(timeouts_.splitTs, + getTimestamp()) > timeouts_.split) + { + *logofs << "Proxy: FLUSH! SPLIT! WARNING! Running with " + << diffTimestamp(timeouts_.splitTs, getTimestamp()) + << " Ms elapsed since the last split.\n" + << logofs_flush; + } + + *logofs << "Proxy: FLUSH! SPLIT! Requesting timeout of " + << diffTs << " Ms as there are splits to send.\n" + << logofs_flush; + + #endif + + setMinTimestamp(tsMax, diffTs); + } + #if defined(TEST) || defined(INFO) + else if (isTimestamp(timeouts_.splitTs) == 1) + { + *logofs << "Proxy: WARNING! Not requesting a split " + << "timeout with " << tokens_[token_split].remaining + << " split tokens remaining.\n" << logofs_flush; + } + #endif + + // + // Loop through the valid channels and set + // the descriptors selected for read and + // the timeout. + // + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] == NULL) + { + continue; + } + + fd = getFd(channelId); + + if (channels_[channelId] -> getFinish() == 0 && + (channels_[channelId] -> getType() == channel_x11 || + tokens_[token_data].remaining > 0) && + congestions_[channelId] == 0) + { + FD_SET(fd, fdSet); + + if (fd >= fdMax) + { + fdMax = fd + 1; + } + + #ifdef TEST + *logofs << "Proxy: Descriptor FD#" << fd + << " selected for read with buffer length " + << transports_[channelId] -> length() + << ".\n" << logofs_flush; + #endif + + // + // Wakeup the proxy if there are motion + // events to flush. + // + + if (isTimestamp(timeouts_.motionTs) == 1) + { + int diffTs = getTimeToNextMotion(); + + #if defined(TEST) || defined(INFO) + + if (diffTimestamp(timeouts_.motionTs, + getTimestamp()) > timeouts_.motion) + { + *logofs << "Proxy: FLUSH! WARNING! Running with " + << diffTimestamp(timeouts_.motionTs, getTimestamp()) + << " Ms elapsed since the last motion.\n" + << logofs_flush; + } + + *logofs << "Proxy: FLUSH! Requesting timeout of " + << diffTs << " Ms as FD#" << fd << " has motion " + << "events to send.\n" << logofs_flush; + + #endif + + setMinTimestamp(tsMax, diffTs); + } + } + #if defined(TEST) || defined(INFO) + else + { + if (channels_[channelId] -> getType() != channel_x11 && + tokens_[token_data].remaining <= 0) + { + *logofs << "Proxy: WARNING! Descriptor FD#" << fd + << " not selected for read with " + << tokens_[token_data].remaining << " data " + << "tokens remaining.\n" << logofs_flush; + } + } + #endif + } + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "Proxy: WARNING! Disabled reading from channels.\n" + << logofs_flush; + + *logofs << "Proxy: WARNING! Congestion is " << congestion_ + << " pending " << transport_ -> pending() << " blocked " + << transport_ -> blocked() << " length " << transport_ -> + length() << ".\n" << logofs_flush; + } + #endif + + // + // Include the proxy descriptor. + // + + FD_SET(fd_, fdSet); + + if (fd_ >= fdMax) + { + fdMax = fd_ + 1; + } + + #ifdef TEST + *logofs << "Proxy: Proxy descriptor FD#" << fd_ + << " selected for read with buffer length " + << transport_ -> length() << ".\n" + << logofs_flush; + #endif + + return 1; +} + +// +// Add to the mask the file descriptors of all +// X connections to write to. +// + +int Proxy::setWriteDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax) +{ + int fd = -1; + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL) + { + fd = getFd(channelId); + + if (transports_[channelId] -> length() > 0) + { + FD_SET(fd, fdSet); + + #ifdef TEST + *logofs << "Proxy: Descriptor FD#" << fd << " selected " + << "for write with blocked " << transports_[channelId] -> + blocked() << " and length " << transports_[channelId] -> + length() << ".\n" << logofs_flush; + #endif + + if (fd >= fdMax) + { + fdMax = fd + 1; + } + } + #ifdef TEST + else + { + *logofs << "Proxy: Descriptor FD#" << fd << " not selected " + << "for write with blocked " << transports_[channelId] -> + blocked() << " and length " << transports_[channelId] -> + length() << ".\n" << logofs_flush; + } + #endif + + #if defined(TEST) || defined(INFO) + + if (transports_[channelId] -> getType() != + transport_agent && transports_[channelId] -> + length() > 0 && transports_[channelId] -> + blocked() != 1) + { + *logofs << "Proxy: PANIC! Descriptor FD#" << fd + << " has data to write but blocked flag is " + << transports_[channelId] -> blocked() + << ".\n" << logofs_flush; + + cerr << "Error" << ": Descriptor FD#" << fd + << " has data to write but blocked flag is " + << transports_[channelId] -> blocked() + << ".\n"; + + HandleCleanup(); + } + + #endif + } + } + + // + // Check if the proxy transport has data + // from a previous blocking write. + // + + if (transport_ -> blocked() == 1) + { + FD_SET(fd_, fdSet); + + #ifdef TEST + *logofs << "Proxy: Proxy descriptor FD#" + << fd_ << " selected for write. Blocked is " + << transport_ -> blocked() << " length is " + << transport_ -> length() << ".\n" + << logofs_flush; + #endif + + if (fd_ >= fdMax) + { + fdMax = fd_ + 1; + } + } + #ifdef TEST + else + { + *logofs << "Proxy: Proxy descriptor FD#" + << fd_ << " not selected for write. Blocked is " + << transport_ -> blocked() << " length is " + << transport_ -> length() << ".\n" + << logofs_flush; + } + #endif + + // + // We are entering the main select. Save + // the timestamp of the last loop so that + // we can detect the clock drifts. + // + + timeouts_.loopTs = getTimestamp(); + + return 1; +} + +int Proxy::getChannels(T_channel_type type) +{ + int channels = 0; + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL && + (type == channel_none || + type == channels_[channelId] -> + getType())) + { + channels++; + } + } + + return channels; +} + +T_channel_type Proxy::getType(int fd) +{ + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + return channel_none; + } + + return channels_[channelId] -> getType(); +} + +const char *Proxy::getTypeName(T_channel_type type) +{ + switch (type) + { + case channel_x11: + { + return "X"; + } + case channel_cups: + { + return "CUPS"; + } + case channel_smb: + { + return "SMB"; + } + case channel_media: + { + return "media"; + } + case channel_http: + { + return "HTTP"; + } + case channel_font: + { + return "font"; + } + case channel_slave: + { + return "slave"; + } + default: + { + return "unknown"; + } + } +} + +const char *Proxy::getComputerName() +{ + // + // Strangely enough, under some Windows OSes SMB + // service doesn't bind to localhost. Fall back + // to localhost if can't find computer name in + // the environment. In future we should try to + // bind to localhost and then try the other IPs. + // + + const char *hostname = NULL; + + #ifdef __CYGWIN32__ + + hostname = getenv("COMPUTERNAME"); + + #endif + + if (hostname == NULL) + { + hostname = "localhost"; + } + + return hostname; +} + +// +// Handle data from channels selected for read. +// + +int Proxy::handleRead(int &resultFds, fd_set &readSet) +{ + #ifdef DEBUG + *logofs << "Proxy: Checking descriptors selected for read.\n" + << logofs_flush; + #endif + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + #ifdef DEBUG + *logofs << "Proxy: Looping with current channel " + << *j << ".\n" << logofs_flush; + #endif + + int fd = getFd(*j); + + if (fd >= 0 && resultFds > 0 && FD_ISSET(fd, &readSet)) + { + #ifdef DEBUG + *logofs << "Proxy: Going to read messages from FD#" + << fd << ".\n" << logofs_flush; + #endif + + int result = handleRead(fd); + + if (result < 0) + { + #ifdef TEST + *logofs << "Proxy: Failure reading messages from FD#" + << fd << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << "Proxy: Clearing the read descriptor " + << "for FD#" << fd << ".\n" << logofs_flush; + #endif + + FD_CLR(fd, &readSet); + + resultFds--; + } + } + + if (resultFds > 0 && FD_ISSET(fd_, &readSet)) + { + #ifdef DEBUG + *logofs << "Proxy: Going to read messages from " + << "proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + if (handleRead() < 0) + { + #ifdef TEST + *logofs << "Proxy: Failure reading from proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << "Proxy: Clearing the read descriptor " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + FD_CLR(fd_, &readSet); + + resultFds--; + } + + return 1; +} + +// +// Perform flush on descriptors selected for write. +// + +int Proxy::handleFlush(int &resultFds, fd_set &writeSet) +{ + #ifdef DEBUG + *logofs << "Proxy: Checking descriptors selected for write.\n" + << logofs_flush; + #endif + + if (resultFds > 0 && FD_ISSET(fd_, &writeSet)) + { + #ifdef TEST + *logofs << "Proxy: FLUSH! Proxy descriptor FD#" << fd_ + << " reported to be writable.\n" + << logofs_flush; + #endif + + if (handleFlush() < 0) + { + #ifdef TEST + *logofs << "Proxy: Failure flushing the writable " + << "proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + return -1; + } + + #ifdef DEBUG + *logofs << "Proxy: Clearing the write descriptor " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + FD_CLR(fd_, &writeSet); + + resultFds--; + } + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + resultFds > 0 && j != channelList.end(); j++) + { + #ifdef DEBUG + *logofs << "Proxy: Looping with current channel " + << *j << ".\n" << logofs_flush; + #endif + + int fd = getFd(*j); + + if (fd >= 0 && FD_ISSET(fd, &writeSet)) + { + #ifdef TEST + *logofs << "Proxy: X descriptor FD#" << fd + << " reported to be writable.\n" + << logofs_flush; + #endif + + // + // It can happen that, in handling reads, we + // have destroyed the buffer associated to a + // closed socket, so don't complain about + // the errors. + // + + handleFlush(fd); + + // + // Clear the descriptor from the mask so + // we don't confuse the agent if it's + // not checking only its own descriptors. + // + + #ifdef DEBUG + *logofs << "Proxy: Clearing the write descriptor " + << "for FD#" << fd << ".\n" + << logofs_flush; + #endif + + FD_CLR(fd, &writeSet); + + resultFds--; + } + } + + return 1; +} + +int Proxy::handleRead() +{ + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Decoding data from proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + // + // Decode all the available messages from + // the remote proxy until is not possible + // to read more. + // + + for (;;) + { + int result = readBuffer_.readMessage(); + + #if defined(TEST) || defined(DEBUG) || defined(INFO) + *logofs << "Proxy: Read result on proxy FD#" << fd_ + << " is " << result << ".\n" + << logofs_flush; + #endif + + if (result < 0) + { + if (shutdown_ == 0) + { + if (finish_ == 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Failure reading from the " + << "peer proxy on FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure reading from the " + << "peer proxy.\n"; + } + } + #ifdef TEST + else + { + *logofs << "Proxy: Closure of the proxy link detected " + << "after clean shutdown.\n" << logofs_flush; + } + #endif + + priority_ = 0; + finish_ = 1; + congestion_ = 0; + + return -1; + } + else if (result == 0) + { + #if defined(TEST) || defined(DEBUG) || defined(INFO) + *logofs << "Proxy: No data read from proxy FD#" + << fd_ << "\n" << logofs_flush; + #endif + + return 0; + } + + // + // We read some data from the remote. If we set + // the congestion flag because we couldn't read + // before the timeout and have tokens available, + // then reset the congestion flag. + // + + if (congestion_ == 1 && + tokens_[token_control].remaining > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Exiting congestion due to " + << "proxy data with " << tokens_[token_control].remaining + << " tokens.\n" << logofs_flush; + #endif + + congestion_ = 0; + } + + // + // Set the timestamp of the last read + // operation from the remote proxy and + // enable again showing the 'no data + // received' dialog at the next timeout. + // + + timeouts_.readTs = getTimestamp(); + + if (alert_ != 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Displacing the dialog " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + HandleAlert(DISPLACE_MESSAGE_ALERT, 1); + } + + timeouts_.alertTs = nullTimestamp(); + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Getting messages from proxy FD#" << fd_ + << " with " << readBuffer_.getLength() << " bytes " + << "in the read buffer.\n" << logofs_flush; + #endif + + unsigned int controlLength; + unsigned int dataLength; + + const unsigned char *message; + + while ((message = readBuffer_.getMessage(controlLength, dataLength)) != NULL) + { + statistics -> addFrameIn(); + + if (controlLength == 3 && *message == 0 && + *(message + 1) < code_last_tag) + { + if (handleControlFromProxy(message) < 0) + { + return -1; + } + } + else if (operation_ == operation_in_messages) + { + int channelId = inputChannel_; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Identified message of " << dataLength + << " bytes for FD#" << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && + channels_[channelId] != NULL) + { + int finish = channels_[channelId] -> getFinish(); + + #ifdef WARNING + + if (finish == 1) + { + *logofs << "Proxy: WARNING! Handling data for finishing " + << "FD#" << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + } + + #endif + + // + // We need to decode all the data to preserve + // the consistency of the cache, so can't re- + // turn as soon as the first error is encount- + // ered. Check if this is the first time that + // the failure is detected. + // + + int result = channels_[channelId] -> handleWrite(message, dataLength); + + if (result < 0 && finish == 0) + { + #ifdef TEST + *logofs << "Proxy: Failed to write proxy data to FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + if (handleFinish(channelId) < 0) + { + return -1; + } + } + + // + // Check if we have splits or motion + // events to send. + // + + setSplitTimeout(channelId); + setMotionTimeout(channelId); + } + #ifdef WARNING + else + { + *logofs << "Proxy: WARNING! Received data for " + << "invalid channel ID#" << channelId + << ".\n" << logofs_flush; + } + #endif + } + else if (operation_ == operation_in_statistics) + { + #ifdef TEST + *logofs << "Proxy: Received statistics data from remote proxy.\n" + << logofs_flush; + #endif + + if (handleStatisticsFromProxy(message, dataLength) < 0) + { + return -1; + } + + operation_ = operation_in_messages; + } + else if (operation_ == operation_in_negotiation) + { + #ifdef TEST + *logofs << "Proxy: Received new negotiation data from remote proxy.\n" + << logofs_flush; + #endif + + if (handleNegotiationFromProxy(message, dataLength) < 0) + { + return -1; + } + } + + // + // if (controlLength == 3 && *message == 0 && ...) ... + // else if (operation_ == operation_in_statistics) ... + // else if (operation_ == operation_in_messages) ... + // else if (operation_ == operation_in_negotiation) ... + // else ... + // + + else + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Unrecognized message received on proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unrecognized message received on proxy FD#" + << fd_ << ".\n"; + + return -1; + } + + } // while ((message = readBuffer_.getMessage(controlLength, dataLength)) != NULL) ... + + // + // Reset the read buffer. + // + + readBuffer_.fullReset(); + + // + // Give up if no data is readable. + // + + if (transport_ -> readable() == 0) + { + break; + } + + } // End of for (;;) ... + + return 1; +} + +int Proxy::handleControlFromProxy(const unsigned char *message) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Received message '" << DumpControl(*(message + 1)) + << "' at " << strMsTimestamp() << " with data ID#" + << (int) *(message + 2) << ".\n" << logofs_flush; + #endif + + T_channel_type channelType = channel_none; + + switch (*(message + 1)) + { + case code_switch_connection: + { + int channelId = *(message + 2); + + // + // If channel is invalid further messages will + // be ignored. The acknowledged shutdown of + // channels should prevent this. + // + + inputChannel_ = channelId; + + break; + } + case code_begin_congestion: + { + // + // Set the congestion state for the + // channel reported by the remote. + // + + int channelId = *(message + 2); + + if (channels_[channelId] != NULL) + { + congestions_[channelId] = 1; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Received a begin congestion " + << "for channel id ID#" << channelId + << ".\n" << logofs_flush; + #endif + + if (channelId == agent_ && congestions_[agent_] != 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Forcing an update of the congestion " + << "counter with agent congested.\n" + << logofs_flush; + #endif + + statistics -> updateCongestion(-tokens_[token_control].remaining, + tokens_[token_control].limit); + } + } + #ifdef WARNING + else + { + *logofs << "Proxy: WARNING! Received a begin congestion " + << "for invalid channel id ID#" << channelId + << ".\n" << logofs_flush; + } + #endif + + break; + } + case code_end_congestion: + { + // + // Attend again to the channel. + // + + int channelId = *(message + 2); + + if (channels_[channelId] != NULL) + { + congestions_[channelId] = 0; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Received an end congestion " + << "for channel id ID#" << channelId + << ".\n" << logofs_flush; + #endif + + if (channelId == agent_ && congestions_[agent_] != 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Forcing an update of the congestion " + << "counter with agent decongested.\n" + << logofs_flush; + #endif + + statistics -> updateCongestion(tokens_[token_control].remaining, + tokens_[token_control].limit); + } + } + #ifdef WARNING + else + { + *logofs << "Proxy: WARNING! Received an end congestion " + << "for invalid channel id ID#" << channelId + << ".\n" << logofs_flush; + } + #endif + + break; + } + case code_control_token_request: + { + T_proxy_token &token = tokens_[token_control]; + + if (handleTokenFromProxy(token, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_split_token_request: + { + T_proxy_token &token = tokens_[token_split]; + + if (handleTokenFromProxy(token, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_data_token_request: + { + T_proxy_token &token = tokens_[token_data]; + + if (handleTokenFromProxy(token, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_control_token_reply: + { + T_proxy_token &token = tokens_[token_control]; + + if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_split_token_reply: + { + T_proxy_token &token = tokens_[token_split]; + + if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_data_token_reply: + { + T_proxy_token &token = tokens_[token_data]; + + if (handleTokenReplyFromProxy(token, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_new_x_connection: + { + // + // Opening the channel is handled later. + // + + channelType = channel_x11; + + break; + } + case code_new_cups_connection: + { + channelType = channel_cups; + + break; + } + case code_new_aux_connection: + { + // + // Starting from version 1.5.0 we create real X + // connections for the keyboard channel. We need + // to refuse old auxiliary X connections because + // they would be unable to leverage the new fake + // authorization cookie. + // + + #ifdef WARNING + *logofs << "Proxy: WARNING! Can't open outdated auxiliary X " + << "channel for code " << *(message + 1) << ".\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Can't open outdated auxiliary X " + << "channel for code " << *(message + 1) << ".\n"; + + if (handleControl(code_drop_connection, *(message + 2)) < 0) + { + return -1; + } + + break; + } + case code_new_smb_connection: + { + channelType = channel_smb; + + break; + } + case code_new_media_connection: + { + channelType = channel_media; + + break; + } + case code_new_http_connection: + { + channelType = channel_http; + + break; + } + case code_new_font_connection: + { + channelType = channel_font; + + break; + } + case code_new_slave_connection: + { + channelType = channel_slave; + + break; + } + case code_drop_connection: + { + int channelId = *(message + 2); + + if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && + channels_[channelId] != NULL) + { + handleDropFromProxy(channelId); + } + #ifdef WARNING + else + { + *logofs << "Proxy: WARNING! Received a drop message " + << "for invalid channel id ID#" << channelId + << ".\n" << logofs_flush; + } + #endif + + break; + } + case code_finish_connection: + { + int channelId = *(message + 2); + + if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && + channels_[channelId] != NULL) + { + // + // Force the finish state on the channel. + // We can receive this message while in + // the read loop, so we only mark the + // channel for deletion. + // + + #ifdef TEST + *logofs << "Proxy: Received a finish message for FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + handleFinishFromProxy(channelId); + } + #ifdef WARNING + else + { + *logofs << "Proxy: WARNING! Received a finish message " + << "for invalid channel id ID#" << channelId + << ".\n" << logofs_flush; + } + #endif + + break; + } + case code_finish_listeners: + { + // + // This is from the main loop. + // + + #ifdef TEST + *logofs << "Proxy: Closing down all local listeners.\n" + << logofs_flush; + #endif + + CleanupListeners(); + + finish_ = 1; + + break; + } + case code_reset_request: + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Proxy reset not supported " + << "in this version.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Proxy reset not supported " + << "in this version.\n"; + + HandleCleanup(); + } + case code_shutdown_request: + { + // + // Time to rest in peace. + // + + shutdown_ = 1; + + break; + } + case code_load_request: + { + if (handleLoadFromProxy() < 0) + { + return -1; + } + + break; + } + case code_save_request: + { + // + // Don't abort the connection + // if can't write to disk. + // + + handleSaveFromProxy(); + + break; + } + case code_statistics_request: + { + int type = *(message + 2); + + if (handleStatisticsFromProxy(type) < 0) + { + return -1; + } + + break; + } + case code_statistics_reply: + { + operation_ = operation_in_statistics; + + break; + } + case code_alert_request: + { + HandleAlert(*(message + 2), 1); + + break; + } + case code_sync_request: + { + int channelId = *(message + 2); + + if (handleSyncFromProxy(channelId) < 0) + { + return -1; + } + + break; + } + case code_sync_reply: + { + // + // We are not the one that issued + // the request. + // + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: PANIC! Received an unexpected " + << "synchronization reply.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Received an unexpected " + << "synchronization reply.\n"; + + HandleCleanup(); + } + default: + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Received bad control message number " + << (unsigned int) *(message + 1) << " with attribute " + << (unsigned int) *(message + 2) << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Received bad control message number " + << (unsigned int) *(message + 1) << " with attribute " + << (unsigned int) *(message + 2) << ".\n"; + + HandleCleanup(); + } + + } // End of switch (*(message + 1)) ... + + if (channelType == channel_none) + { + return 1; + } + + // + // Handle the channel allocation that we + // left from the main switch case. + // + + int channelId = *(message + 2); + + // + // Check if the channel has been dropped. + // + + if (channels_[channelId] != NULL && + (channels_[channelId] -> getDrop() == 1 || + channels_[channelId] -> getClosing() == 1)) + { + #ifdef TEST + *logofs << "Proxy: Dropping the descriptor FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + handleDrop(channelId); + } + + // + // Check if the channel is in the valid + // range. + // + + int result = checkChannelMap(channelId); + + if (result >= 0) + { + result = handleNewConnectionFromProxy(channelType, channelId); + } + + if (result < 0) + { + // + // Realization of new channel failed. + // Send channel shutdown message to + // the peer proxy. + // + + if (handleControl(code_drop_connection, channelId) < 0) + { + return -1; + } + } + else + { + int fd = getFd(channelId); + + if (getReadable(fd) > 0) + { + #ifdef TEST + *logofs << "Proxy: Trying to read immediately " + << "from descriptor FD#" << fd << ".\n" + << logofs_flush; + #endif + + if (handleRead(fd) < 0) + { + return -1; + } + } + #ifdef TEST + *logofs << "Proxy: Nothing to read immediately " + << "from descriptor FD#" << fd << ".\n" + << logofs_flush; + #endif + } + + return 1; +} + +int Proxy::handleRead(int fd, const char *data, int size) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Handling data for connection on FD#" + << fd << ".\n" << logofs_flush; + #endif + + if (canRead(fd) == 0) + { + #if defined(TEST) || defined(INFO) + + if (getChannel(fd) < 0) + { + *logofs << "Proxy: PANIC! Can't read from invalid FD#" + << fd << ".\n" << logofs_flush; + + HandleCleanup(); + } + else + { + *logofs << "Proxy: WARNING! Read method called for FD#" + << fd << " but operation is not possible.\n" + << logofs_flush; + } + + #endif + + return 0; + } + + int channelId = getChannel(fd); + + // + // Let the channel object read all the new data from + // its file descriptor, isolate messages, compress + // those messages, and append the compressed form to + // the encode buffer. + // + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Reading messages from FD#" << fd + << " channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + int result = channels_[channelId] -> handleRead(encodeBuffer_, (const unsigned char *) data, + (unsigned int) size); + + // + // Even in the case of a failure, write the produced + // data to the proxy connection. To keep the stores + // synchronized, the remote side needs to decode any + // message encoded by this side, also if the X socket + // was closed in the meanwhile. If this is the case, + // the decompressed output will be silently discarded. + // + + if (result < 0) + { + #ifdef TEST + *logofs << "Proxy: Failed to read data from connection FD#" + << fd << " channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + if (handleFinish(channelId) < 0) + { + return -1; + } + } + + // + // Check if there are new splits or + // motion events to send. + // + + setSplitTimeout(channelId); + setMotionTimeout(channelId); + + return 1; +} + +int Proxy::handleEvents() +{ + #ifdef TEST + *logofs << "Proxy: Going to check the events on channels.\n" + << logofs_flush; + #endif + + // + // Check if we can safely write to the + // proxy link. + // + + int read = isTimeToRead(); + + // + // Loop on channels and send the pending + // events. We must copy the list because + // channels can be removed in the middle + // of the loop. + // + + T_list channelList = activeChannels_.copyList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] == NULL) + { + continue; + } + + // + // Check if we need to drop the channel. + // + + if (channels_[channelId] -> getDrop() == 1 || + channels_[channelId] -> getClosing() == 1) + { + #ifdef TEST + *logofs << "Proxy: Dropping the descriptor FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + if (handleDrop(channelId) < 0) + { + return -1; + } + + continue; + } + else if (channels_[channelId] -> getFinish() == 1) + { + #ifdef TEST + *logofs << "Proxy: Skipping finishing " + << "descriptor FD#" << getFd(channelId) + << " channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + continue; + } + + // + // If the proxy link or the channel is + // in congestion state, don't handle + // the further events. + // + + if (read == 0 || congestions_[channelId] == 1) + { + #ifdef TEST + + if (read == 0) + { + *logofs << "Proxy: Can't handle events for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " with proxy not available.\n" + << logofs_flush; + } + else + { + *logofs << "Proxy: Can't handle events for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " with channel congested.\n" + << logofs_flush; + } + + #endif + + continue; + } + + // + // Handle the timeouts on the channel + // operations. + // + + int result = 0; + + // + // Handle the motion events. + // + + if (result >= 0 && channels_[channelId] -> needMotion() == 1) + { + if (isTimeToMotion() == 1) + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + + *logofs << "Proxy: FLUSH! Motion timeout expired after " + << diffTimestamp(timeouts_.motionTs, getTimestamp()) + << " Ms.\n" << logofs_flush; + + #endif + + result = channels_[channelId] -> handleMotion(encodeBuffer_); + + #ifdef TEST + + if (result < 0) + { + *logofs << "Proxy: Failed to handle motion events for FD#" + << getFd(channelId) << " channel ID#" << channelId + << ".\n" << logofs_flush; + } + + #endif + + timeouts_.motionTs = nullTimestamp(); + + setMotionTimeout(channelId); + } + #if defined(TEST) || defined(INFO) + else if (isTimestamp(timeouts_.motionTs) == 1) + { + *logofs << "Proxy: Running with " + << diffTimestamp(timeouts_.motionTs, getTimestamp()) + << " Ms elapsed since the last motion.\n" + << logofs_flush; + } + #endif + } + + if (result >= 0 && channels_[channelId] -> needSplit() == 1) + { + // + // Check if it is time to send more splits + // and how many bytes are going to be sent. + // + + if (isTimeToSplit() == 1) + { + #if defined(TEST) || defined(INFO) || defined(SPLIT) + *logofs << "Proxy: SPLIT! Split timeout expired after " + << diffTimestamp(timeouts_.splitTs, getTimestamp()) + << " Ms.\n" << logofs_flush; + #endif + + #if defined(TEST) || defined(INFO) || defined(SPLIT) + + *logofs << "Proxy: SPLIT! Encoding splits for FD#" + << getFd(channelId) << " at " << strMsTimestamp() + << " with " << clientStore_ -> getSplitTotalStorageSize() + << " total bytes and " << control -> SplitDataPacketLimit + << " bytes " << "to write.\n" + << logofs_flush; + + #endif + + result = channels_[channelId] -> handleSplit(encodeBuffer_); + + #ifdef TEST + + if (result < 0) + { + *logofs << "Proxy: Failed to handle splits for FD#" + << getFd(channelId) << " channel ID#" << channelId + << ".\n" << logofs_flush; + } + + #endif + + timeouts_.splitTs = nullTimestamp(); + + setSplitTimeout(channelId); + } + #if defined(TEST) || defined(INFO) || defined(SPLIT) + else if (channels_[channelId] -> needSplit() == 1 && + isTimestamp(timeouts_.splitTs) == 0) + { + *logofs << "Proxy: SPLIT! WARNING! Channel for FD#" + << getFd(channelId) << " has split to send but " + << "there is no timeout.\n" << logofs_flush; + } + else if (isTimestamp(timeouts_.splitTs) == 1) + { + *logofs << "Proxy: SPLIT! Running with " + << diffTimestamp(timeouts_.splitTs, getTimestamp()) + << " Ms elapsed since the last split.\n" + << logofs_flush; + } + #endif + } + + if (result < 0) + { + #ifdef TEST + *logofs << "Proxy: Error handling events for FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + if (handleFinish(channelId) < 0) + { + return -1; + } + } + } + + return 1; +} + +int Proxy::handleFrame(T_frame_type type) +{ + // + // Write any outstanding control message, followed by the + // content of the encode buffer, to the proxy transport. + // + // This code assumes that the encode buffer data is at an + // offset several bytes from start of the buffer, so that + // the length header and any necessary control bytes can + // be inserted in front of the data already in the buffer. + // This is the easiest way to encapsulate header and data + // together in a single frame. + // + // The way framing is implemented is very efficient but + // inherently limited and does not allow for getting the + // best performance, especially when running over a fast + // link. Framing should be rewritten to include the length + // of the packets in a fixed size header and, possibly, + // to incapsulate the control messages and the channel's + // data in a pseudo X protocol message, so that the proxy + // itself would be treated like any other channel. + // + + #if defined(TEST) || defined(INFO) + + if (congestion_ == 1) + { + // + // This can happen because there may be control + // messages to send, like a proxy shutdown mes- + // sage or a statistics request. All the other + // cases should be considered an error. + // + + #ifdef WARNING + *logofs << "Proxy: WARNING! Data is to be sent while " + << "congestion is " << congestion_ << ".\n" + << logofs_flush; + #endif + } + + #endif + + // + // Check if there is any data available on + // the socket. Recent Linux kernels are very + // picky. They require that we read often or + // they assume that the process is non-inter- + // active. + // + + if (handleAsyncEvents() < 0) + { + return -1; + } + + // + // Check if this is a ping, not a data frame. + // + + if (type == frame_ping) + { + if (handleToken(frame_ping) < 0) + { + return -1; + } + } + + unsigned int dataLength = encodeBuffer_.getLength(); + + #ifdef DEBUG + *logofs << "Proxy: Data length is " << dataLength + << " control length is " << controlLength_ + << ".\n" << logofs_flush; + #endif + + if (dataLength > 0) + { + // + // If this is a generic channel we need + // to add the completion bits. Data can + // also have been encoded because of a + // statistics request, even if no output + // channel was currently selected. + // + + if (outputChannel_ != -1) + { + #if defined(TEST) || defined(INFO) + + if (channels_[outputChannel_] == NULL) + { + *logofs << "Proxy: PANIC! A new frame was requested " + << "but the channel is invalid.\n" + << logofs_flush; + + HandleCleanup(); + } + + #endif + + channels_[outputChannel_] -> handleCompletion(encodeBuffer_); + + dataLength = encodeBuffer_.getLength(); + } + } + else if (controlLength_ == 0) + { + #if defined(TEST) || defined(INFO) + + *logofs << "Proxy: PANIC! A new frame was requested " + << "but there is no data to write.\n" + << logofs_flush; + + HandleCleanup(); + + #endif + + return 0; + } + + #ifdef DEBUG + *logofs << "Proxy: Data length is now " << dataLength + << " control length is " << controlLength_ + << ".\n" << logofs_flush; + #endif + + // + // Check if this frame needs to carry a new + // token request. + // + + if (type == frame_data) + { + if (handleToken(frame_data) < 0) + { + return -1; + } + } + + #ifdef DEBUG + *logofs << "Proxy: Adding a new frame for the remote proxy.\n" + << logofs_flush; + #endif + + unsigned char temp[5]; + + unsigned int lengthLength = 0; + unsigned int shift = dataLength; + + while (shift) + { + temp[lengthLength++] = (unsigned char) (shift & 0x7f); + + shift >>= 7; + } + + unsigned char *data = encodeBuffer_.getData(); + + unsigned char *outputMessage = data - (controlLength_ + lengthLength); + + unsigned char *nextDest = outputMessage; + + for (int i = 0; i < controlLength_; i++) + { + *nextDest++ = controlCodes_[i]; + } + + for (int j = lengthLength - 1; j > 0; j--) + { + *nextDest++ = (temp[j] | 0x80); + } + + if (lengthLength) + { + *nextDest++ = temp[0]; + } + + unsigned int outputLength = dataLength + controlLength_ + lengthLength; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Produced plain output for " << dataLength << "+" + << controlLength_ << "+" << lengthLength << " out of " + << outputLength << " bytes.\n" << logofs_flush; + #endif + + #if defined(TEST) || defined(INFO) || defined(FLUSH) || defined(TIME) + + T_timestamp nowTs = getTimestamp(); + + *logofs << "Proxy: FLUSH! Immediate with blocked " << transport_ -> + blocked() << " length " << transport_ -> length() + << " new " << outputLength << " flushable " << transport_ -> + flushable() << " tokens " << tokens_[token_control].remaining + << " after " << diffTimestamp(timeouts_.writeTs, nowTs) + << " Ms.\n" << logofs_flush; + + *logofs << "Proxy: FLUSH! Immediate flush to proxy FD#" << fd_ + << " of " << outputLength << " bytes at " << strMsTimestamp() + << " with priority " << priority_ << ".\n" << logofs_flush; + + *logofs << "Proxy: FLUSH! Current bitrate is " + << statistics -> getBitrateInShortFrame() << " with " + << statistics -> getBitrateInLongFrame() << " in the " + << "long frame and top " << statistics -> + getTopBitrate() << ".\n" << logofs_flush; + #endif + + statistics -> addWriteOut(); + + int result = transport_ -> write(write_immediate, outputMessage, outputLength); + + #ifdef TIME + + if (diffTimestamp(timeouts_.writeTs, nowTs) > 50) + { + *logofs << "Proxy: WARNING! TIME! Data written to proxy FD#" + << fd_ << " at " << strMsTimestamp() << " after " + << diffTimestamp(timeouts_.writeTs, nowTs) + << " Ms.\n" << logofs_flush; + } + + #endif + + #ifdef DUMP + *logofs << "Proxy: Sent " << outputLength << " bytes of data " + << "with checksum "; + + DumpChecksum(outputMessage, outputLength); + + *logofs << " on proxy FD#" << fd_ << ".\n" << logofs_flush; + #endif + + #ifdef DUMP + *logofs << "Proxy: Partial checksums are:\n"; + + DumpBlockChecksums(outputMessage, outputLength, 256); + + *logofs << logofs_flush; + #endif + + // + // Clean up the encode buffer and + // bring it to the initial size. + // + + encodeBuffer_.fullReset(); + + // + // Close the connection if we got + // an error. + // + + if (result < 0) + { + #ifdef TEST + *logofs << "Proxy: Failed write to proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return -1; + } + + // + // Account for the data frame and the + // framing overhead. + // + + if (dataLength > 0) + { + statistics -> addFrameOut(); + } + + statistics -> addFramingBits((controlLength_ + lengthLength) << 3); + + controlLength_ = 0; + + // + // Reset all buffers, counters and the + // priority flag. + // + + handleResetFlush(); + + // + // Check if more data became available + // after writing. + // + + if (handleAsyncEvents() < 0) + { + return -1; + } + + // + // Drain the proxy link if we are in + // congestion state. + // + // if (needDrain() == 1 && draining_ == 0) + // { + // if (handleDrain() < 0) + // { + // return -1; + // } + // } + // + + return result; +} + +int Proxy::handleFlush() +{ + // + // We can have data in the encode buffer or + // control bytes to send. In the case make + // up a new frame. + // + + if (encodeBuffer_.getLength() + controlLength_ > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Flushing data in the encode buffer.\n" + << logofs_flush; + #endif + + priority_ = 1; + + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + // + // Check if we have something to write. + // + + if (transport_ -> length() + transport_ -> flushable() == 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Nothing else to flush for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return 0; + } + + #if defined(TEST) || defined(INFO) + + if (transport_ -> blocked() == 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Proxy descriptor FD#" << fd_ + << " has data to flush but the transport " + << "is not blocked.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Proxy descriptor FD#" << fd_ + << " has data to flush but the transport " + << "is not blocked.\n"; + + HandleCleanup(); + } + + #endif + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: FLUSH! Deferred with blocked " << transport_ -> + blocked() << " length " << transport_ -> length() + << " flushable " << transport_ -> flushable() << " tokens " + << tokens_[token_control].remaining << ".\n" + << logofs_flush; + + *logofs << "Proxy: FLUSH! Deferred flush to proxy FD#" << fd_ + << " of " << transport_ -> length() + transport_ -> + flushable() << " bytes at " << strMsTimestamp() + << " with priority " << priority_ << ".\n" + << logofs_flush; + + *logofs << "Proxy: FLUSH! Current bitrate is " + << statistics -> getBitrateInShortFrame() << " with " + << statistics -> getBitrateInLongFrame() << " in the " + << "long frame and top " << statistics -> + getTopBitrate() << ".\n" << logofs_flush; + #endif + + statistics -> addWriteOut(); + + int result = transport_ -> flush(); + + if (result < 0) + { + return -1; + } + + // + // Reset the counters and update the + // timestamp of the last write. + // + + handleResetFlush(); + + return result; +} + +int Proxy::handleDrain() +{ + // + // If the proxy is run in the same process + // as SSH, we can't block or the program + // would not have a chance to read or write + // its data. + // + + if (control -> LinkEncrypted == 1) + { + return 0; + } + + if (needDrain() == 0 || draining_ == 1) + { + #if defined(TEST) || defined(INFO) + + if (draining_ == 1) + { + *logofs << "Proxy: WARNING! Already draining proxy FD#" + << fd_ << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + } + else + { + *logofs << "Proxy: WARNING! No need to drain proxy FD#" + << fd_ << " with congestion " << congestion_ + << " length " << transport_ -> length() + << " and blocked " << transport_ -> blocked() + << ".\n" << logofs_flush; + } + + #endif + + return 0; + } + + draining_ = 1; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Going to drain the proxy FD#" << fd_ + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + int timeout = control -> PingTimeout / 2; + + T_timestamp startTs = getNewTimestamp(); + + T_timestamp nowTs = startTs; + + int remaining; + int result; + + // + // Keep draining the proxy socket while + // reading the incoming messages until + // the timeout is expired. + // + + for (;;) + { + remaining = timeout - diffTimestamp(startTs, nowTs); + + if (remaining <= 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Timeout raised while draining " + << "FD#" << fd_ << " at " << strMsTimestamp() + << " after " << diffTimestamp(startTs, nowTs) + << " Ms.\n" << logofs_flush; + #endif + + result = 0; + + goto ProxyDrainEnd; + } + + if (transport_ -> length() > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Trying to write to FD#" << fd_ + << " at " << strMsTimestamp() << " with length " + << transport_ -> length() << " and " + << remaining << " Ms remaining.\n" + << logofs_flush; + #endif + + result = transport_ -> drain(0, remaining); + + if (result == -1) + { + result = -1; + + goto ProxyDrainEnd; + } + else if (result == 0 && transport_ -> readable() > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Decoding more data from proxy FD#" + << fd_ << " at " << strMsTimestamp() << " with " + << transport_ -> length() << " bytes to write and " + << transport_ -> readable() << " readable.\n" + << logofs_flush; + #endif + + if (handleRead() < 0) + { + result = -1; + + goto ProxyDrainEnd; + } + } + #if defined(TEST) || defined(INFO) + else if (result == 1) + { + *logofs << "Proxy: Transport for proxy FD#" << fd_ + << " drained down to " << transport_ -> length() + << " bytes.\n" << logofs_flush; + } + #endif + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Waiting for more data from proxy " + << "FD#" << fd_ << " at " << strMsTimestamp() + << " with " << remaining << " Ms remaining.\n" + << logofs_flush; + #endif + + + result = transport_ -> wait(remaining); + + if (result == -1) + { + result = -1; + + goto ProxyDrainEnd; + } + else if (result > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Decoding more data from proxy FD#" + << fd_ << " at " << strMsTimestamp() << " with " + << transport_ -> readable() << " bytes readable.\n" + << logofs_flush; + #endif + + if (handleRead() < 0) + { + result = -1; + + goto ProxyDrainEnd; + } + } + } + + // + // Check if we finally got the tokens + // that would allow us to come out of + // the congestion state. + // + + if (needDrain() == 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Got decongestion for proxy FD#" + << fd_ << " at " << strMsTimestamp() << " after " + << diffTimestamp(startTs, getTimestamp()) + << " Ms.\n" << logofs_flush; + #endif + + result = 1; + + goto ProxyDrainEnd; + } + + nowTs = getNewTimestamp(); + } + +ProxyDrainEnd: + + draining_ = 0; + + return result; +} + +int Proxy::handleFlush(int fd) +{ + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + #ifdef TEST + *logofs << "Proxy: WARNING! Skipping flush on invalid " + << "descriptor FD#" << fd << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (channels_[channelId] -> getFinish() == 1) + { + #ifdef TEST + *logofs << "Proxy: Skipping flush on finishing " + << "descriptor FD#" << fd << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + return 0; + } + + #ifdef TEST + *logofs << "Proxy: Going to flush FD#" << fd + << " with blocked " << transports_[channelId] -> blocked() + << " length " << transports_[channelId] -> length() + << ".\n" << logofs_flush; + #endif + + if (channels_[channelId] -> handleFlush() < 0) + { + #ifdef TEST + *logofs << "Proxy: Failed to flush data to FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + handleFinish(channelId); + + return -1; + } + + return 1; +} + +int Proxy::handleStatistics(int type, ostream *stream) +{ + if (stream == NULL || control -> EnableStatistics == 0) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Cannot produce statistics " + << " for proxy FD#" << fd_ << ". Invalid settings " + << "for statistics or stream.\n" << logofs_flush; + #endif + + return 0; + } + else if (currentStatistics_ != NULL) + { + // + // Need to update the stream pointer as the + // previous one could have been destroyed. + // + + #ifdef WARNING + *logofs << "Proxy: WARNING! Replacing stream while producing " + << "statistics in stream at " << currentStatistics_ + << " for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + } + + currentStatistics_ = stream; + + // + // Get statistics of remote peer. + // + + if (handleControl(code_statistics_request, type) < 0) + { + return -1; + } + + return 1; +} + +int Proxy::handleStatisticsFromProxy(int type) +{ + if (needFlush() == 1) + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: WARNING! Data for the previous " + << "channel ID#" << outputChannel_ + << " flushed in statistics.\n" + << logofs_flush; + #endif + + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + if (control -> EnableStatistics == 1) + { + // + // Allocate a buffer for the output. + // + + char *buffer = new char[STATISTICS_LENGTH]; + + *buffer = '\0'; + + if (control -> ProxyMode == proxy_client) + { + #ifdef TEST + *logofs << "Proxy: Producing " + << (type == TOTAL_STATS ? "total" : "partial") + << " client statistics for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + statistics -> getClientProtocolStats(type, buffer); + + statistics -> getClientOverallStats(type, buffer); + } + else + { + #ifdef TEST + *logofs << "Proxy: Producing " + << (type == TOTAL_STATS ? "total" : "partial") + << " server statistics for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + statistics -> getServerProtocolStats(type, buffer); + } + + if (type == PARTIAL_STATS) + { + statistics -> resetPartialStats(); + } + + unsigned int length = strlen((char *) buffer) + 1; + + encodeBuffer_.encodeValue(type, 8); + + encodeBuffer_.encodeValue(length, 32); + + #ifdef TEST + *logofs << "Proxy: Encoding " << length + << " bytes of statistics data for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + encodeBuffer_.encodeMemory((unsigned char *) buffer, length); + + // + // Account statistics data as framing bits. + // + + statistics -> addFramingBits(length << 3); + + delete [] buffer; + } + else + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Got statistics request " + << "but local statistics are disabled.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Got statistics request " + << "but local statistics are disabled.\n"; + + type = NO_STATS; + + encodeBuffer_.encodeValue(type, 8); + + #ifdef TEST + *logofs << "Proxy: Sending error code to remote proxy on FD#" + << fd_ << ".\n" << logofs_flush; + #endif + } + + // + // The next write will flush the statistics + // data and the control message. + // + + if (handleControl(code_statistics_reply, type) < 0) + { + return -1; + } + + return 1; +} + +int Proxy::handleStatisticsFromProxy(const unsigned char *message, unsigned int length) +{ + if (currentStatistics_ == NULL) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Unexpected statistics data received " + << "from remote proxy on FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Unexpected statistics data received " + << "from remote proxy.\n"; + + return 0; + } + + // + // Allocate the decode buffer and at least + // the 'type' field to see if there was an + // error. + // + + DecodeBuffer decodeBuffer(message, length); + + unsigned int type; + + decodeBuffer.decodeValue(type, 8); + + if (type == NO_STATS) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Couldn't get statistics from remote " + << "proxy on FD#" << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Couldn't get statistics from remote proxy.\n"; + } + else if (type != TOTAL_STATS && type != PARTIAL_STATS) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Cannot produce statistics " + << "with qualifier '" << type << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Cannot produce statistics " + << "with qualifier '" << type << "'.\n"; + + return -1; + } + else + { + unsigned int size; + + decodeBuffer.decodeValue(size, 32); + + char *buffer = new char[STATISTICS_LENGTH]; + + *buffer = '\0'; + + if (control -> EnableStatistics == 1) + { + if (control -> ProxyMode == proxy_client) + { + #ifdef TEST + *logofs << "Proxy: Finalizing " + << (type == TOTAL_STATS ? "total" : "partial") + << " client statistics for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + statistics -> getClientCacheStats(type, buffer); + + #ifdef TEST + *logofs << "Proxy: Decoding " << size + << " bytes of statistics data for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); + + statistics -> getClientProtocolStats(type, buffer); + + statistics -> getClientOverallStats(type, buffer); + } + else + { + #ifdef TEST + *logofs << "Proxy: Finalizing " + << (type == TOTAL_STATS ? "total" : "partial") + << " server statistics for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + statistics -> getServerCacheStats(type, buffer); + + statistics -> getServerProtocolStats(type, buffer); + + #ifdef TEST + *logofs << "Proxy: Decoding " << size + << " bytes of statistics data for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); + } + + if (type == PARTIAL_STATS) + { + statistics -> resetPartialStats(); + } + + *currentStatistics_ << buffer; + + // + // Mark the end of text to help external parsing. + // + + *currentStatistics_ << '\4'; + + *currentStatistics_ << flush; + } + else + { + // + // It can be that statistics were enabled at the time + // we issued the request (otherwise we could not have + // set the stream), but now they have been disabled + // by user. We must decode statistics data if we want + // to keep the connection. + // + + #ifdef TEST + *logofs << "Proxy: Discarding " << size + << " bytes of statistics data for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + strncat(buffer, (char *) decodeBuffer.decodeMemory(size), size); + } + + delete [] buffer; + } + + currentStatistics_ = NULL; + + return 1; +} + +int Proxy::handleNegotiation(const unsigned char *message, unsigned int length) +{ + #ifdef PANIC + *logofs << "Proxy: PANIC! Writing data during proxy " + << "negotiation is not implemented.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Writing data during proxy " + << "negotiation is not implemented.\n"; + + return -1; +} + +int Proxy::handleNegotiationFromProxy(const unsigned char *message, unsigned int length) +{ + #ifdef PANIC + *logofs << "Proxy: PANIC! Reading data during proxy " + << "negotiation is not implemented.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Reading data during proxy " + << "negotiation is not implemented.\n"; + + return -1; +} + +int Proxy::handleAlert(int alert) +{ + if (handleControl(code_alert_request, alert) < 0) + { + return -1; + } + + return 1; +} + +int Proxy::handleCloseConnection(int clientFd) +{ + int channelId = getChannel(clientFd); + + if (channels_[channelId] != NULL && + channels_[channelId] -> getFinish() == 0) + { + #ifdef TEST + *logofs << "Proxy: Closing down the channel for FD#" + << clientFd << ".\n" << logofs_flush; + #endif + + if (handleFinish(channelId) < 0) + { + return -1; + } + + return 1; + } + + return 0; +} + +int Proxy::handleCloseAllXConnections() +{ + #ifdef TEST + *logofs << "Proxy: Closing down any remaining X channel.\n" + << logofs_flush; + #endif + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL && + channels_[channelId] -> getType() == channel_x11 && + channels_[channelId] -> getFinish() == 0) + { + #ifdef TEST + *logofs << "Proxy: Closing down the channel for FD#" + << getFd(channelId) << ".\n" << logofs_flush; + #endif + + if (handleFinish(channelId) < 0) + { + return -1; + } + } + } + + return 1; +} + +int Proxy::handleCloseAllListeners() +{ + // Since ProtoStep7 (#issue 108) + if (finish_ == 0) + { + #ifdef TEST + *logofs << "Proxy: Closing down all remote listeners.\n" + << logofs_flush; + #endif + + if (handleControl(code_finish_listeners) < 0) + { + return -1; + } + + finish_ = 1; + } + + return 1; +} + +void Proxy::handleResetAlert() +{ + if (alert_ != 0) + { + #ifdef TEST + *logofs << "Proxy: The proxy alert '" << alert_ + << "' was displaced.\n" << logofs_flush; + #endif + + alert_ = 0; + } + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL) + { + channels_[channelId] -> handleResetAlert(); + } + } +} + +int Proxy::handleFinish(int channelId) +{ + // + // Send any outstanding encoded data and + // do any finalization needed on the + // channel. + // + + if (needFlush(channelId) == 1) + { + if (channels_[channelId] -> getFinish() == 1) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! The finishing channel ID#" + << channelId << " has data to flush.\n" + << logofs_flush; + #endif + } + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: WARNING! Flushing data for the " + << "finishing channel ID#" << channelId + << ".\n" << logofs_flush; + #endif + + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + // + // Reset the congestion state and the + // timeouts, if needed. + // + + congestions_[channelId] = 0; + + setSplitTimeout(channelId); + setMotionTimeout(channelId); + + if (channels_[channelId] -> getFinish() == 0) + { + channels_[channelId] -> handleFinish(); + + // + // Force a failure in the case somebody + // would try to read from the channel. + // + + shutdown(getFd(channelId), SHUT_RD); + + // + // If the failure was not originated by + // the remote, send a channel shutdown + // message. + // + + if (channels_[channelId] -> getClosing() == 0) + { + #ifdef TEST + *logofs << "Proxy: Finishing channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " because of failure.\n" + << logofs_flush; + #endif + + if (handleControl(code_finish_connection, channelId) < 0) + { + return -1; + } + } + } + + return 1; +} + +int Proxy::handleFinishFromProxy(int channelId) +{ + // + // Check if this channel has pending + // data to send. + // + + if (needFlush(channelId) == 1) + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: WARNING! Flushing data for the " + << "finishing channel ID#" << channelId + << ".\n" << logofs_flush; + #endif + + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + // + // Mark the channel. We will free its + // resources at the next loop and will + // send the drop message to the remote. + // + + if (channels_[channelId] -> getClosing() == 0) + { + #ifdef TEST + *logofs << "Proxy: Marking channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " as closing.\n" + << logofs_flush; + #endif + + channels_[channelId] -> handleClosing(); + } + + if (channels_[channelId] -> getFinish() == 0) + { + #ifdef TEST + *logofs << "Proxy: Finishing channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " because of proxy.\n" + << logofs_flush; + #endif + + channels_[channelId] -> handleFinish(); + } + + if (handleFinish(channelId) < 0) + { + return -1; + } + + return 1; +} + +int Proxy::handleDropFromProxy(int channelId) +{ + // + // Only mark the channel. + // + + #ifdef TEST + *logofs << "Proxy: Marking channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " as being dropped.\n" + << logofs_flush; + #endif + + if (channels_[channelId] -> getDrop() == 0) + { + channels_[channelId] -> handleDrop(); + } + + return 1; +} + +// +// Close the channel and deallocate all its +// resources. +// + +int Proxy::handleDrop(int channelId) +{ + // + // Check if this channel has pending + // data to send. + // + + if (needFlush(channelId) == 1) + { + if (channels_[channelId] -> getFinish() == 1) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! The dropping channel ID#" + << channelId << " has data to flush.\n" + << logofs_flush; + #endif + } + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: WARNING! Flushing data for the " + << "dropping channel ID#" << channelId + << ".\n" << logofs_flush; + #endif + + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + #ifdef TEST + *logofs << "Proxy: Dropping channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + if (channels_[channelId] -> getFinish() == 0) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! The channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " was not marked as " + << "finishing.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": The channel for FD#" + << getFd(channelId) << " channel ID#" + << channelId << " was not marked as " + << "finishing.\n"; + + channels_[channelId] -> handleFinish(); + } + + // + // Send the channel shutdown message + // to the peer proxy. + // + + if (channels_[channelId] -> getClosing() == 1) + { + if (handleControl(code_drop_connection, channelId) < 0) + { + return -1; + } + } + + // + // Get rid of the channel. + // + + if (channels_[channelId] -> getType() != channel_x11) + { + #ifdef TEST + *logofs << "Proxy: Closed connection to " + << getTypeName(channels_[channelId] -> getType()) + << " server.\n" << logofs_flush; + #endif + + cerr << "Info" << ": Closed connection to " + << getTypeName(channels_[channelId] -> getType()) + << " server.\n"; + } + + delete channels_[channelId]; + channels_[channelId] = NULL; + + cleanupChannelMap(channelId); + + // + // Get rid of the transport. + // + + deallocateTransport(channelId); + + congestions_[channelId] = 0; + + decreaseChannels(channelId); + + // + // Check if the channel was the + // one currently selected for + // output. + // + + if (outputChannel_ == channelId) + { + outputChannel_ = -1; + } + + return 1; +} + +// +// Send an empty message to the remote peer +// to verify if the link is alive and let +// the remote proxy detect a congestion. +// + +int Proxy::handlePing() +{ + T_timestamp nowTs = getTimestamp(); + + #if defined(DEBUG) || defined(PING) + + *logofs << "Proxy: Checking ping at " + << strMsTimestamp(nowTs) << logofs_flush; + + *logofs << " with last loop at " + << strMsTimestamp(timeouts_.loopTs) << ".\n" + << logofs_flush; + + *logofs << "Proxy: Last bytes in at " + << strMsTimestamp(timeouts_.readTs) << logofs_flush; + + *logofs << " last bytes out at " + << strMsTimestamp(timeouts_.writeTs) << ".\n" + << logofs_flush; + + *logofs << "Proxy: Last ping at " + << strMsTimestamp(timeouts_.pingTs) << ".\n" + << logofs_flush; + + #endif + + // + // Be sure we take into account any clock drift. This + // can be caused by the user changing the system timer + // or by small adjustments introduced by the operating + // system making the clock go backward. + // + + if (checkDiffTimestamp(timeouts_.loopTs, nowTs) == 0) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Detected drift in system " + << "timer. Resetting to current time.\n" + << logofs_flush; + #endif + + timeouts_.pingTs = nowTs; + timeouts_.readTs = nowTs; + timeouts_.writeTs = nowTs; + } + + // + // Check timestamp of last read from remote proxy. It can + // happen that we stayed in the main loop long enough to + // have idle timeout expired, for example if the proxy was + // stopped and restarted or because of an extremely high + // load of the system. In this case we don't complain if + // there is something new to read from the remote. + // + + int diffIn = diffTimestamp(timeouts_.readTs, nowTs); + + if (diffIn >= (control -> PingTimeout * 2) - + control -> LatencyTimeout) + { + // + // Force a read to detect whether the remote proxy + // aborted the connection. + // + + int result = handleRead(); + + if (result < 0) + { + #if defined(TEST) || defined(INFO) || defined(PING) + *logofs << "Proxy: WARNING! Detected shutdown waiting " + << "for the ping after " << diffIn / 1000 + << " seconds.\n" << logofs_flush; + #endif + + return -1; + } + else if (result > 0) + { + diffIn = diffTimestamp(timeouts_.readTs, nowTs); + + if (handleFlush() < 0) + { + return -1; + } + } + } + + if (diffIn >= (control -> PingTimeout * 2) - + control -> LatencyTimeout) + { + #if defined(TEST) || defined(INFO) || defined(PING) + *logofs << "Proxy: Detected congestion at " + << strMsTimestamp() << " with " << diffIn / 1000 + << " seconds since the last read.\n" + << logofs_flush; + #endif + + // + // There are two types of proxy congestion. The first, + // affecting the ability of the proxy to write the + // encoded data to the network, is controlled by the + // congestion_ flag. The flag is raised when no data + // is received from the remote proxy within a timeout. + // On the X client side, the flag is also raised when + // the proxy runs out of tokens. + // + + if (control -> ProxyMode == proxy_server) + { + // + // At X server side we must return to read data + // from the channels after a while, because we + // need to give a chance to the channel to read + // the key sequence CTRL+ALT+SHIFT+ESC. + // + + if (congestion_ == 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Forcibly entering congestion due to " + << "timeout with " << tokens_[token_control].remaining + << " tokens.\n" << logofs_flush; + #endif + + congestion_ = 1; + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Forcibly exiting congestion due to " + << "timeout with " << tokens_[token_control].remaining + << " tokens.\n" << logofs_flush; + #endif + + congestion_ = 0; + } + } + else + { + #if defined(TEST) || defined(INFO) + + if (congestion_ == 0) + { + *logofs << "Proxy: Entering congestion due to timeout " + << "with " << tokens_[token_control].remaining + << " tokens.\n" << logofs_flush; + } + + #endif + + congestion_ = 1; + } + + if (control -> ProxyTimeout > 0 && + diffIn >= (control -> ProxyTimeout - + control -> LatencyTimeout)) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No data received from " + << "remote proxy on FD#" << fd_ << " within " + << (diffIn + control -> LatencyTimeout) / 1000 + << " seconds.\n" << logofs_flush; + #endif + + cerr << "Error" << ": No data received from remote " + << "proxy within " << (diffIn + control -> + LatencyTimeout) / 1000 << " seconds.\n"; + + HandleAbort(); + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: WARNING! No data received from " + << "remote proxy on FD#" << fd_ << " since " + << diffIn << " Ms.\n" << logofs_flush; + #endif + + if (control -> ProxyTimeout > 0 && + isTimestamp(timeouts_.alertTs) == 0 && + diffIn >= (control -> ProxyTimeout - + control -> LatencyTimeout) / 4) + { + // + // If we are in the middle of a shutdown + // procedure but the remote is not resp- + // onding, force the closure of the link. + // + + if (finish_ != 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No response received from " + << "the remote proxy on FD#" << fd_ << " while " + << "waiting for the shutdown.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No response received from remote " + << "proxy while waiting for the shutdown.\n"; + + HandleAbort(); + } + else + { + cerr << "Warning" << ": No data received from remote " + << "proxy within " << (diffIn + control -> + LatencyTimeout) / 1000 << " seconds.\n"; + + if (alert_ == 0) + { + if (control -> ProxyMode == proxy_client) + { + alert_ = CLOSE_DEAD_PROXY_CONNECTION_CLIENT_ALERT; + } + else + { + alert_ = CLOSE_DEAD_PROXY_CONNECTION_SERVER_ALERT; + } + + HandleAlert(alert_, 1); + } + + timeouts_.alertTs = nowTs; + } + } + } + } + + // + // Check if we need to update the congestion + // counter. + // + + int diffOut = diffTimestamp(timeouts_.writeTs, nowTs); + + if (agent_ != nothing && congestions_[agent_] == 0 && + statistics -> getCongestionInFrame() >= 1 && + diffOut >= (control -> IdleTimeout - + control -> LatencyTimeout * 5)) + { + #if defined(TEST) || defined(INFO) || defined(PING) + *logofs << "Proxy: Forcing an update of the " + << "congestion counter after timeout.\n" + << logofs_flush; + #endif + + statistics -> updateCongestion(tokens_[token_control].remaining, + tokens_[token_control].limit); + } + + // + // Send a new token if we didn't send any data to + // the remote for longer than the ping timeout. + // The client side sends a token, the server side + // responds with a token reply. + // + // VMWare virtual machines can have the system + // timer deadly broken. Try to send a ping regard- + // less we are the client or the server proxy to + // force a write by the remote. + // + + if (control -> ProxyMode == proxy_client || + diffIn >= (control -> PingTimeout * 4) - + control -> LatencyTimeout) + { + // + // We need to send a new ping even if we didn't + // receive anything from the remote within the + // ping timeout. The server side will respond + // to our ping, so we use the ping to force the + // remote end to send some data. + // + + if (diffIn >= (control -> PingTimeout - + control -> LatencyTimeout * 5) || + diffOut >= (control -> PingTimeout - + control -> LatencyTimeout * 5)) + { + int diffPing = diffTimestamp(timeouts_.pingTs, nowTs); + + if (diffPing < 0 || diffPing >= (control -> PingTimeout - + control -> LatencyTimeout * 5)) + { + #if defined(TEST) || defined(INFO) || defined(PING) + *logofs << "Proxy: Sending a new ping at " << strMsTimestamp() + << " with " << tokens_[token_control].remaining + << " tokens and elapsed in " << diffIn << " out " + << diffOut << " ping " << diffPing + << ".\n" << logofs_flush; + #endif + + if (handleFrame(frame_ping) < 0) + { + return -1; + } + + timeouts_.pingTs = nowTs; + } + #if defined(TEST) || defined(INFO) || defined(PING) + else + { + *logofs << "Proxy: Not sending a new ping with " + << "elapsed in " << diffIn << " out " + << diffOut << " ping " << diffPing + << ".\n" << logofs_flush; + } + #endif + } + } + + return 1; +} + +int Proxy::handleSyncFromProxy(int channelId) +{ + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: WARNING! Received a synchronization " + << "request from the remote proxy.\n" + << logofs_flush; + #endif + + if (handleControl(code_sync_reply, channelId) < 0) + { + return -1; + } + + return 1; +} + +int Proxy::handleResetStores() +{ + // + // Recreate the message stores. + // + + delete clientStore_; + delete serverStore_; + + clientStore_ = new ClientStore(compressor_); + serverStore_ = new ServerStore(compressor_); + + timeouts_.loadTs = nullTimestamp(); + + // + // Replace message stores in channels. + // + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL) + { + if (channels_[channelId] -> setStores(clientStore_, serverStore_) < 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Failed to replace message stores in " + << "channel for FD#" << getFd(channelId) << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to replace message stores in " + << "channel for FD#" << getFd(channelId) << ".\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Proxy: Replaced message stores in channel " + << "for FD#" << getFd(channelId) << ".\n" + << logofs_flush; + } + #endif + } + } + + return 1; +} + +int Proxy::handleResetPersistentCache() +{ + char *fullName = new char[strlen(control -> PersistentCachePath) + + strlen(control -> PersistentCacheName) + 2]; + + strcpy(fullName, control -> PersistentCachePath); + strcat(fullName, "/"); + strcat(fullName, control -> PersistentCacheName); + + #ifdef TEST + *logofs << "Proxy: Going to remove persistent cache file '" + << fullName << "'\n" << logofs_flush; + #endif + + unlink(fullName); + + delete [] fullName; + + delete [] control -> PersistentCacheName; + + control -> PersistentCacheName = NULL; + + return 1; +} + +void Proxy::handleResetFlush() +{ + #ifdef TEST + *logofs << "Proxy: Going to reset flush counters " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + // + // Reset the proxy priority flag. + // + + priority_ = 0; + + // + // Restore buffers to their initial + // size. + // + + transport_ -> partialReset(); + + // + // Update the timestamp of the last + // write operation performed on the + // socket. + // + + timeouts_.writeTs = getTimestamp(); +} + +int Proxy::handleFinish() +{ + // + // Reset the timestamps to give the proxy + // another chance to show the 'no response' + // dialog if the shutdown message doesn't + // come in time. + // + + timeouts_.readTs = getTimestamp(); + + timeouts_.alertTs = nullTimestamp(); + + finish_ = 1; + + return 1; +} + +int Proxy::handleShutdown() +{ + // + // Send shutdown message to remote proxy. + // + + shutdown_ = 1; + + handleControl(code_shutdown_request); + + #ifdef TEST + *logofs << "Proxy: Starting shutdown procedure " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + // + // Ensure that all the data accumulated + // in the transport buffer is flushed + // to the network layer. + // + + for (int i = 0; i < 100; i++) + { + if (canFlush() == 1) + { + handleFlush(); + } + else + { + break; + } + + usleep(100000); + } + + // + // Now wait for the network layers to + // consume all the data. + // + + for (int i = 0; i < 100; i++) + { + if (transport_ -> queued() <= 0) + { + break; + } + + usleep(100000); + } + + // + // Give time to the remote end to read + // the shutdown message and close the + // connection. + // + + transport_ -> wait(10000); + + #ifdef TEST + *logofs << "Proxy: Ending shutdown procedure " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + return 1; +} + +int Proxy::handleChannelConfiguration() +{ + if (activeChannels_.getSize() == 0) + { + #ifdef TEST + *logofs << "Proxy: Going to initialize the static " + << "members in channels for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + Channel::setReferences(); + + ClientChannel::setReferences(); + ServerChannel::setReferences(); + + GenericChannel::setReferences(); + } + + return 1; +} + +int Proxy::handleSocketConfiguration() +{ + // + // Set linger mode on proxy to correctly + // get shutdown notification. + // + + SetLingerTimeout(fd_, 30); + + // + // Set keep-alive on socket so that if remote link + // terminates abnormally (as killed hard or because + // of a power-off) process will get a SIGPIPE. In + // practice this is useless as proxies already ping + // each other every few seconds. + // + + if (control -> OptionProxyKeepAlive == 1) + { + SetKeepAlive(fd_); + } + + // + // Set 'priority' flag at TCP layer for path + // proxy-to-proxy. Look at IPTOS_LOWDELAY in + // man 7 ip. + // + + if (control -> OptionProxyLowDelay == 1) + { + SetLowDelay(fd_); + } + + // + // Update size of TCP send and receive buffers. + // + + if (control -> OptionProxySendBuffer != -1) + { + SetSendBuffer(fd_, control -> OptionProxySendBuffer); + } + + if (control -> OptionProxyReceiveBuffer != -1) + { + SetReceiveBuffer(fd_, control -> OptionProxyReceiveBuffer); + } + + // + // Update TCP_NODELAY settings. Note that on old Linux + // kernels turning off the Nagle algorithm didn't work + // when proxy was run through a PPP link. Trying to do + // so caused the kernel to stop delivering data to us + // if a serious network congestion was encountered. + // + + if (control -> ProxyMode == proxy_client) + { + if (control -> OptionProxyClientNoDelay != -1) + { + SetNoDelay(fd_, control -> OptionProxyClientNoDelay); + } + } + else + { + if (control -> OptionProxyServerNoDelay != -1) + { + SetNoDelay(fd_, control -> OptionProxyServerNoDelay); + } + } + + return 1; +} + +int Proxy::handleLinkConfiguration() +{ + #ifdef TEST + *logofs << "Proxy: Propagating parameters to " + << "channels' read buffers.\n" + << logofs_flush; + #endif + + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL) + { + channels_[channelId] -> handleConfiguration(); + } + } + + #ifdef TEST + *logofs << "Proxy: Propagating parameters to " + << "proxy buffers.\n" + << logofs_flush; + #endif + + readBuffer_.setSize(control -> ProxyInitialReadSize, + control -> ProxyMaximumBufferSize); + + encodeBuffer_.setSize(control -> TransportProxyBufferSize, + control -> TransportProxyBufferThreshold, + control -> TransportMaximumBufferSize); + + transport_ -> setSize(control -> TransportProxyBufferSize, + control -> TransportProxyBufferThreshold, + control -> TransportMaximumBufferSize); + + #ifdef TEST + *logofs << "Proxy: Configuring the proxy timeouts.\n" + << logofs_flush; + #endif + + timeouts_.split = control -> SplitTimeout; + timeouts_.motion = control -> MotionTimeout; + + #ifdef TEST + *logofs << "Proxy: Configuring the proxy tokens.\n" + << logofs_flush; + #endif + + tokens_[token_control].size = control -> TokenSize; + tokens_[token_control].limit = control -> TokenLimit; + + if (tokens_[token_control].limit < 1) + { + tokens_[token_control].limit = 1; + } + + #if defined(TEST) || defined(INFO) || defined(LIMIT) + *logofs << "Proxy: TOKEN! LIMIT! Setting token [" + << DumpToken(token_control) << "] size to " + << tokens_[token_control].size << " and limit to " + << tokens_[token_control].limit << ".\n" + << logofs_flush; + #endif + + tokens_[token_split].size = control -> TokenSize; + tokens_[token_split].limit = control -> TokenLimit / 2; + + if (tokens_[token_split].limit < 1) + { + tokens_[token_split].limit = 1; + } + + #if defined(TEST) || defined(INFO) || defined(LIMIT) + *logofs << "Proxy: TOKEN! LIMIT! Setting token [" + << DumpToken(token_split) << "] size to " + << tokens_[token_split].size << " and limit to " + << tokens_[token_split].limit << ".\n" + << logofs_flush; + #endif + + tokens_[token_data].size = control -> TokenSize; + tokens_[token_data].limit = control -> TokenLimit / 4; + + if (tokens_[token_data].limit < 1) + { + tokens_[token_data].limit = 1; + } + + #if defined(TEST) || defined(INFO) || defined(LIMIT) + *logofs << "Proxy: TOKEN! LIMIT! Setting token [" + << DumpToken(token_data) << "] size to " + << tokens_[token_data].size << " and limit to " + << tokens_[token_data].limit << ".\n" + << logofs_flush; + #endif + + for (int i = token_control; i <= token_data; i++) + { + tokens_[i].remaining = tokens_[i].limit; + } + + #if defined(TEST) || defined(INFO) || defined(LIMIT) + *logofs << "Proxy: LIMIT! Using client bitrate " + << "limit " << control -> ClientBitrateLimit + << " server bitrate limit " << control -> + ServerBitrateLimit << " with local limit " + << control -> LocalBitrateLimit << ".\n" + << logofs_flush; + #endif + + // + // Set the other parameters based on + // the token size. + // + + int base = control -> TokenSize; + + control -> SplitDataThreshold = base * 4; + control -> SplitDataPacketLimit = base / 2; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: LIMIT! Setting split data threshold " + << "to " << control -> SplitDataThreshold + << " split packet limit to " << control -> + SplitDataPacketLimit << " with base " + << base << ".\n" << logofs_flush; + #endif + + // + // Set the number of bytes read from the + // data channels at each loop. This will + // basically determine the maximum band- + // width available for the generic chan- + // nels. + // + + control -> GenericInitialReadSize = base / 2; + control -> GenericMaximumBufferSize = base / 2; + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: LIMIT! Setting generic channel " + << "initial read size to " << control -> + GenericInitialReadSize << " maximum read " + << "size to " << control -> GenericMaximumBufferSize + << " with base " << base << ".\n" + << logofs_flush; + #endif + + return 1; +} + +int Proxy::handleCacheConfiguration() +{ + #ifdef TEST + *logofs << "Proxy: Configuring cache according to pack parameters.\n" + << logofs_flush; + #endif + + // + // Further adjust the cache parameters. If + // packing of the images is enabled, reduce + // the size available for plain images. + // + + if (control -> SessionMode == session_agent) + { + if (control -> PackMethod != NO_PACK) + { + clientStore_ -> getRequestStore(X_PutImage) -> + cacheThreshold = PUTIMAGE_CACHE_THRESHOLD_IF_PACKED; + + clientStore_ -> getRequestStore(X_PutImage) -> + cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED; + } + } + + // + // If this is a shadow session increase the + // size of the image cache. + // + + if (control -> SessionMode == session_shadow) + { + if (control -> PackMethod != NO_PACK) + { + clientStore_ -> getRequestStore(X_NXPutPackedImage) -> + cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD_IF_PACKED_SHADOW; + + clientStore_ -> getRequestStore(X_NXPutPackedImage) -> + cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED_SHADOW; + } + else + { + clientStore_ -> getRequestStore(X_PutImage) -> + cacheThreshold = PUTIMAGE_CACHE_THRESHOLD_IF_SHADOW; + + clientStore_ -> getRequestStore(X_PutImage) -> + cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_SHADOW; + } + } + + return 1; +} + +int Proxy::handleSaveStores() +{ + // + // Save content of stores on disk. + // + + char *cacheToAdopt = NULL; + + // + // Set to false the indicator for cumulative store + // size too small + // + bool isTooSmall = false; + + if (control -> PersistentCacheEnableSave) + { + #ifdef TEST + *logofs << "Proxy: Going to save content of client store.\n" + << logofs_flush; + #endif + + cacheToAdopt = handleSaveAllStores(control -> PersistentCachePath, isTooSmall); + } + #ifdef TEST + else + { + if (control -> ProxyMode == proxy_client) + { + *logofs << "Proxy: Saving persistent cache to disk disabled.\n" + << logofs_flush; + } + else + { + *logofs << "Proxy: PANIC! Protocol violation in command save.\n" + << logofs_flush; + + cerr << "Error" << ": Protocol violation in command save.\n"; + + HandleCleanup(); + } + } + #endif + + if (cacheToAdopt != NULL) + { + // + // Do we have a cache already? + // + + if (control -> PersistentCacheName != NULL) + { + // + // Check if old and new cache are the same. + // In this case don't remove the old cache. + // + + if (strcasecmp(control -> PersistentCacheName, cacheToAdopt) != 0) + { + handleResetPersistentCache(); + } + + delete [] control -> PersistentCacheName; + } + + #ifdef TEST + *logofs << "Proxy: Setting current persistent cache file to '" + << cacheToAdopt << "'\n" << logofs_flush; + #endif + + control -> PersistentCacheName = cacheToAdopt; + + return 1; + } + else + { + #ifdef TEST + *logofs << "Proxy: No cache file produced from message stores.\n" + << logofs_flush; + #endif + + // + // It can be that we didn't generate a new cache + // because store was too small or persistent cache + // was disabled. This is not an error. + // + + if (control -> PersistentCacheEnableSave && !isTooSmall) + { + return -1; + } + else + { + return 0; + } + } +} + +int Proxy::handleLoadStores() +{ + // + // Restore the content of the client store + // from disk if a valid cache was negotiated + // at session startup. + // + + if (control -> PersistentCacheEnableLoad == 1 && + control -> PersistentCachePath != NULL && + control -> PersistentCacheName != NULL) + { + #ifdef TEST + *logofs << "Proxy: Going to load content of client store.\n" + << logofs_flush; + #endif + + // + // Returns the same string passed as name of + // the cache, or NULL if it was not possible + // to load the cache from disk. + // + + if (handleLoadAllStores(control -> PersistentCachePath, + control -> PersistentCacheName) == NULL) + { + // + // The corrupted cache should have been + // removed from disk. Get rid of the + // reference so we don't try to delete + // it once again. + // + + if (control -> PersistentCacheName != NULL) + { + delete [] control -> PersistentCacheName; + } + + control -> PersistentCacheName = NULL; + + return -1; + } + + // + // Set timestamp of last time cache + // was loaded from data on disk. + // + + timeouts_.loadTs = getTimestamp(); + + return 1; + } + #ifdef TEST + else + { + if (control -> ProxyMode == proxy_client) + { + *logofs << "Proxy: Loading of cache disabled or no cache file selected.\n" + << logofs_flush; + } + else + { + *logofs << "Proxy: PANIC! Protocol violation in command load.\n" + << logofs_flush; + + cerr << "Error" << ": Protocol violation in command load.\n"; + + HandleCleanup(); + } + } + #endif + + return 0; +} + +int Proxy::handleControl(T_proxy_code code, int data) +{ + // + // Send the given control messages + // to the remote proxy. + // + + #if defined(TEST) || defined(INFO) + + if (data != -1) + { + if (code == code_control_token_reply || + code == code_split_token_reply || + code == code_data_token_reply) + { + *logofs << "Proxy: TOKEN! Sending message '" << DumpControl(code) + << "' at " << strMsTimestamp() << " with count " + << data << ".\n" << logofs_flush; + } + else + { + *logofs << "Proxy: Sending message '" << DumpControl(code) + << "' at " << strMsTimestamp() << " with data ID#" + << data << ".\n" << logofs_flush; + } + } + else + { + *logofs << "Proxy: Sending message '" << DumpControl(code) + << "' at " << strMsTimestamp() << ".\n" + << logofs_flush; + } + + #endif + + // + // Add the control message and see if the + // data has to be flushed immediately. + // + + if (addControlCodes(code, data) < 0) + { + return -1; + } + + switch (code) + { + // + // Append the first data read from the opened + // channel to the control code. + // + + case code_new_x_connection: + case code_new_cups_connection: + case code_new_aux_connection: + case code_new_smb_connection: + case code_new_media_connection: + case code_new_http_connection: + case code_new_font_connection: + case code_new_slave_connection: + + // + // Do we send the token reply immediately? + // The control messages are put at the begin- + // ning of the of the encode buffer, so we may + // reply to multiple tokens before having the + // chance of handling the actual frame data. + // On the other hand, the sooner we reply, the + // sooner the remote proxy is restarted. + // + + case code_control_token_reply: + case code_split_token_reply: + case code_data_token_reply: + { + break; + } + + // + // Also send the congestion control codes + // immediately. + // + // case code_begin_congestion: + // case code_end_congestion: + // + + default: + { + priority_ = 1; + + break; + } + } + + if (priority_ == 1) + { + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + return 1; +} + +int Proxy::handleSwitch(int channelId) +{ + // + // If data is for a different channel than last + // selected for output, prepend to the data the + // new channel id. + // + + #ifdef DEBUG + *logofs << "Proxy: Requested a switch with " + << "current channel ID#" << outputChannel_ + << " new channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + if (channelId != outputChannel_) + { + if (needFlush() == 1) + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: WARNING! Flushing data for the " + << "previous channel ID#" << outputChannel_ + << ".\n" << logofs_flush; + #endif + + if (handleFrame(frame_data) < 0) + { + return -1; + } + } + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Sending message '" + << DumpControl(code_switch_connection) << "' at " + << strMsTimestamp() << " with FD#" << getFd(channelId) + << " channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + if (addControlCodes(code_switch_connection, channelId) < 0) + { + return -1; + } + + outputChannel_ = channelId; + } + + return 1; +} + +int Proxy::addTokenCodes(T_proxy_token &token) +{ + #if defined(TEST) || defined(INFO) || defined(TOKEN) + *logofs << "Proxy: TOKEN! Sending token [" + << DumpToken(token.type) << "] with " + << token.bytes << " bytes accumulated size " + << token.size << " and " << token.remaining + << " available.\n" << logofs_flush; + #endif + + // + // Give a 'weight' to the token. The tokens + // remaining can become negative if we sent + // a packet that was exceptionally big. + // + + int count = 0; + + // Since ProtoStep7 (#issue 108) + count = token.bytes / token.size; + + // + // Force a count of 1, for example + // if this is a ping. + // + + if (count < 1) + { + count = 1; + + token.bytes = 0; + } + else + { + // Since ProtoStep7 (#issue 108) + if (count > 255) + { + count = 255; + } + + // + // Let the next token account for the + // remaining bytes. + // + + token.bytes %= token.size; + } + + #if defined(TEST) || defined(INFO) || defined(TOKEN) + *logofs << "Proxy: Sending message '" + << DumpControl(token.request) << "' at " + << strMsTimestamp() << " with count " << count + << ".\n" << logofs_flush; + #endif + + controlCodes_[controlLength_++] = 0; + controlCodes_[controlLength_++] = (unsigned char) token.request; + controlCodes_[controlLength_++] = (unsigned char) count; + + statistics -> addFrameOut(); + + token.remaining -= count; + + return 1; +} + +int Proxy::handleToken(T_frame_type type) +{ + #if defined(TEST) || defined(INFO) || defined(TOKEN) + *logofs << "Proxy: TOKEN! Checking tokens with " + << "frame type ["; + + *logofs << (type == frame_ping ? "frame_ping" : "frame_data"); + + *logofs << "] with stream ratio " << statistics -> + getStreamRatio() << ".\n" << logofs_flush; + #endif + + if (type == frame_data) + { + // + // Since ProtoStep7 (#issue 108) + // + + // Send a distinct token for each data type. + // We don't want to slow down the sending of + // the X events, X replies and split confir- + // mation events on the X server side, so + // take care only of the generic data token. + // + + if (control -> ProxyMode == proxy_client) + { + statistics -> updateControlToken(tokens_[token_control].bytes); + + if (tokens_[token_control].bytes > tokens_[token_control].size) + { + if (addTokenCodes(tokens_[token_control]) < 0) + { + return -1; + } + + #if defined(TEST) || defined(INFO) || defined(TOKEN) + + T_proxy_token &token = tokens_[token_control]; + + *logofs << "Proxy: TOKEN! Token class [" + << DumpToken(token.type) << "] has now " + << token.bytes << " bytes accumulated and " + << token.remaining << " tokens remaining.\n" + << logofs_flush; + #endif + } + + statistics -> updateSplitToken(tokens_[token_split].bytes); + + if (tokens_[token_split].bytes > tokens_[token_split].size) + { + if (addTokenCodes(tokens_[token_split]) < 0) + { + return -1; + } + + #if defined(TEST) || defined(INFO) || defined(TOKEN) + + T_proxy_token &token = tokens_[token_split]; + + *logofs << "Proxy: TOKEN! Token class [" + << DumpToken(token.type) << "] has now " + << token.bytes << " bytes accumulated and " + << token.remaining << " tokens remaining.\n" + << logofs_flush; + #endif + } + } + + statistics -> updateDataToken(tokens_[token_data].bytes); + + if (tokens_[token_data].bytes > tokens_[token_data].size) + { + if (addTokenCodes(tokens_[token_data]) < 0) + { + return -1; + } + + #if defined(TEST) || defined(INFO) || defined(TOKEN) + + T_proxy_token &token = tokens_[token_data]; + + *logofs << "Proxy: TOKEN! Token class [" + << DumpToken(token.type) << "] has now " + << token.bytes << " bytes accumulated and " + << token.remaining << " tokens remaining.\n" + << logofs_flush; + #endif + } + } + else + { + if (addTokenCodes(tokens_[token_control]) < 0) + { + return -1; + } + + // + // Reset all counters on a ping. + // + + tokens_[token_control].bytes = 0; + tokens_[token_split].bytes = 0; + tokens_[token_data].bytes = 0; + + #if defined(TEST) || defined(INFO) || defined(TOKEN) + + T_proxy_token &token = tokens_[token_control]; + + *logofs << "Proxy: TOKEN! Token class [" + << DumpToken(token.type) << "] has now " + << token.bytes << " bytes accumulated and " + << token.remaining << " tokens remaining.\n" + << logofs_flush; + #endif + } + + // + // Check if we have entered in + // congestion state. + // + + if (congestion_ == 0 && + tokens_[token_control].remaining <= 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Entering congestion with " + << tokens_[token_control].remaining + << " tokens remaining.\n" << logofs_flush; + #endif + + congestion_ = 1; + } + + statistics -> updateCongestion(tokens_[token_control].remaining, + tokens_[token_control].limit); + + return 1; +} + +int Proxy::handleTokenFromProxy(T_proxy_token &token, int count) +{ + #if defined(TEST) || defined(INFO) || defined(TOKEN) + *logofs << "Proxy: TOKEN! Received token [" + << DumpToken(token.type) << "] request at " + << strMsTimestamp() << " with count " + << count << ".\n" << logofs_flush; + #endif + + // + // Since ProtoStep7 (#issue 108) with no limitations + // concerning invalid token requests at this point + // + + // + // Add our token reply. + // + + if (handleControl(token.reply, count) < 0) + { + return -1; + } + + return 1; +} + +int Proxy::handleTokenReplyFromProxy(T_proxy_token &token, int count) +{ + #if defined(TEST) || defined(INFO) || defined(TOKEN) + *logofs << "Proxy: TOKEN! Received token [" + << DumpToken(token.type) << "] reply at " + << strMsTimestamp() << " with count " << count + << ".\n" << logofs_flush; + #endif + + // + // Since ProtoStep7 (#issue 108) with no limitations + // concerning invalid token requests at this point + // + + // + // Increment the available tokens. + // + + token.remaining += count; + + if (token.remaining > token.limit) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Token overflow handling messages.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Token overflow handling messages.\n"; + + HandleCleanup(); + } + + #if defined(TEST) || defined(INFO) || defined(TOKEN) + *logofs << "Proxy: TOKEN! Token class [" + << DumpToken(token.type) << "] has now " << token.bytes + << " bytes accumulated and " << token.remaining + << " tokens remaining.\n" << logofs_flush; + #endif + + // + // Check if we can jump out of the + // congestion state. + // + + if (congestion_ == 1 && + tokens_[token_control].remaining > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Exiting congestion with " + << tokens_[token_control].remaining + << " tokens remaining.\n" << logofs_flush; + #endif + + congestion_ = 0; + } + + statistics -> updateCongestion(tokens_[token_control].remaining, + tokens_[token_control].limit); + + return 1; +} + +void Proxy::handleFailOnSave(const char *fullName, const char *failContext) const +{ + #ifdef WARNING + *logofs << "Proxy: WARNING! Error saving stores to cache file " + << "in context [" << failContext << "].\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Error saving stores to cache file " + << "in context [" << failContext << "].\n"; + + #ifdef WARNING + *logofs << "Proxy: WARNING! Removing invalid cache '" + << fullName << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Removing invalid cache '" + << fullName << "'.\n"; + + unlink(fullName); +} + +void Proxy::handleFailOnLoad(const char *fullName, const char *failContext) const +{ + #ifdef WARNING + *logofs << "Proxy: WARNING! Error loading stores from cache file " + << "in context [" << failContext << "].\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Error loading stores from cache file " + << "in context [" << failContext << "].\n"; + + #ifdef WARNING + *logofs << "Proxy: WARNING! Removing invalid cache '" + << fullName << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Removing invalid cache '" + << fullName << "'.\n"; + + unlink(fullName); +} + +int Proxy::handleSaveVersion(unsigned char *buffer, int &major, + int &minor, int &patch) const +{ + // Since ProtoStep8 (#issue 108) + major = 3; + minor = 0; + patch = 0; + + *(buffer + 0) = major; + *(buffer + 1) = minor; + + PutUINT(patch, buffer + 2, storeBigEndian()); + + return 1; +} + +int Proxy::handleLoadVersion(const unsigned char *buffer, int &major, + int &minor, int &patch) const +{ + major = *(buffer + 0); + minor = *(buffer + 1); + + patch = GetUINT(buffer + 2, storeBigEndian()); + + // + // Force the proxy to discard the + // incompatible caches. + // + + // Since ProtoStep8 (#issue 108) + if (major < 3) + { + return -1; + } + + return 1; +} + +char *Proxy::handleSaveAllStores(const char *savePath, bool & isTooSmall) const +{ + isTooSmall = false; + + int cumulativeSize = MessageStore::getCumulativeTotalStorageSize(); + + if (cumulativeSize < control -> PersistentCacheThreshold) + { + #ifdef TEST + *logofs << "Proxy: Cache not saved as size is " + << cumulativeSize << " with threshold set to " + << control -> PersistentCacheThreshold + << ".\n" << logofs_flush; + #endif + + // + // Cumulative store size is smaller than threshold + // so the indicator is set to true + // + + isTooSmall = true; + + return NULL; + } + else if (savePath == NULL) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No name provided for save path.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No name provided for save path.\n"; + + return NULL; + } + + #ifdef TEST + *logofs << "Proxy: Going to save content of message stores.\n" + << logofs_flush; + #endif + + // + // Our parent process is likely going to terminate. + // Until we finish saving cache we must ignore its + // SIGIPE. + // + + DisableSignals(); + + ofstream *cachefs = NULL; + + md5_state_t *md5StateStream = NULL; + md5_byte_t *md5DigestStream = NULL; + + md5_state_t *md5StateClient = NULL; + md5_byte_t *md5DigestClient = NULL; + + char md5String[MD5_LENGTH * 2 + 2]; + + char fullName[strlen(savePath) + MD5_LENGTH * 2 + 4]; + + // + // Prepare the template for the temporary file + // + + const char* const uniqueTemplate = "XXXXXX"; + char tempName[strlen(savePath) + strlen("/") + 4 + strlen(uniqueTemplate) + 1]; + + snprintf(tempName, sizeof tempName, "%s/%s%s", + savePath, + control -> ProxyMode == proxy_client ? + "Z-C-" : + "Z-S-", + uniqueTemplate); + + #ifdef TEST + *logofs << "Proxy: Generating temporary file with template '" + << tempName << "'.\n" << logofs_flush; + #endif + + // + // Change the mask to make the file only + // readable by the user, then restore the + // old mask. + // + + mode_t fileMode = umask(0077); + + // + // Generate a unique temporary filename from tempName + // and then create and open the file + // + + int fdTemp = mkstemp(tempName); + if (fdTemp == -1) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't create temporary file in '" + << savePath << "'. Cause = " << strerror(errno) << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't create temporary file in '" + << savePath << "'. Cause = " << strerror(errno) << ".\n"; + + umask(fileMode); + + EnableSignals(); + + return NULL; + } + + #ifdef TEST + *logofs << "Proxy: Saving cache to file '" + << tempName << "'.\n" << logofs_flush; + #endif + + // + // Create and open the output stream for the new temporary + // file + // + + cachefs = new (std::nothrow) ofstream(tempName, ios::out | ios::binary); + if ((cachefs == NULL) || cachefs->fail()) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't create stream for temporary file '" + << tempName << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't create stream for temporary file '" + << tempName << "'.\n"; + + close(fdTemp); + unlink(tempName); + + umask(fileMode); + + EnableSignals(); + + return NULL; + } + + // + // Close the file descriptor returned by mkstemp + // and restore the old mask + // + + close(fdTemp); + umask(fileMode); + + md5StateStream = new md5_state_t(); + md5DigestStream = new md5_byte_t[MD5_LENGTH]; + + md5_init(md5StateStream); + + // + // First write the proxy version. + // + + unsigned char version[4]; + + int major; + int minor; + int patch; + + handleSaveVersion(version, major, minor, patch); + + #ifdef TEST + *logofs << "Proxy: Saving cache using version '" + << major << "." << minor << "." << patch + << "'.\n" << logofs_flush; + #endif + + if (PutData(cachefs, version, 4) < 0) + { + handleFailOnSave(tempName, "A"); + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + EnableSignals(); + + return NULL; + } + + // + // Make space for the calculated MD5 so we + // can later rewind the file and write it + // at this position. + // + + if (PutData(cachefs, md5DigestStream, MD5_LENGTH) < 0) + { + handleFailOnSave(tempName, "B"); + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + EnableSignals(); + + return NULL; + } + + md5StateClient = new md5_state_t(); + md5DigestClient = new md5_byte_t[MD5_LENGTH]; + + md5_init(md5StateClient); + + #ifdef DUMP + + ofstream *cacheDump = NULL; + + ofstream *tempfs = (ofstream*) logofs; + + char cacheDumpName[DEFAULT_STRING_LENGTH]; + + if (control -> ProxyMode == proxy_client) + { + snprintf(cacheDumpName, DEFAULT_STRING_LENGTH - 1, + "%s/client-cache-dump", control -> TempPath); + } + else + { + snprintf(cacheDumpName, DEFAULT_STRING_LENGTH - 1, + "%s/server-cache-dump", control -> TempPath); + } + + *(cacheDumpName + DEFAULT_STRING_LENGTH - 1) = '\0'; + + fileMode = umask(0077); + + cacheDump = new ofstream(cacheDumpName, ios::out); + + umask(fileMode); + + logofs = cacheDump; + + #endif + + // + // Use the virtual method of the concrete proxy class. + // + + int allSaved = handleSaveAllStores(cachefs, md5StateStream, md5StateClient); + + #ifdef DUMP + + logofs = tempfs; + + delete cacheDump; + + #endif + + if (allSaved == -1) + { + handleFailOnSave(tempName, "C"); + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + delete md5StateClient; + delete [] md5DigestClient; + + EnableSignals(); + + return NULL; + } + + md5_finish(md5StateClient, md5DigestClient); + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + sprintf(md5String + (i * 2), "%02X", md5DigestClient[i]); + } + + strcpy(fullName, (control -> ProxyMode == proxy_client) ? "C-" : "S-"); + + strcat(fullName, md5String); + + md5_append(md5StateStream, (const md5_byte_t *) fullName, strlen(fullName)); + md5_finish(md5StateStream, md5DigestStream); + + // + // Go to the beginning of file plus + // the integer where we wrote our + // proxy version. + // + + cachefs -> seekp(4); + + if (PutData(cachefs, md5DigestStream, MD5_LENGTH) < 0) + { + handleFailOnSave(tempName, "D"); + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + delete md5StateClient; + delete [] md5DigestClient; + + EnableSignals(); + + return NULL; + } + + delete cachefs; + + // + // Copy the resulting cache name without + // the path so that we can return it to + // the caller. + // + + char *cacheName = new char[MD5_LENGTH * 2 + 4]; + + strcpy(cacheName, fullName); + + // + // Add the path to the full name and move + // the cache into the path. + // + + strcpy(fullName, savePath); + strcat(fullName, (control -> ProxyMode == proxy_client) ? "/C-" : "/S-"); + strcat(fullName, md5String); + + #ifdef TEST + *logofs << "Proxy: Renaming cache file from '" + << tempName << "' to '" << fullName + << "'.\n" << logofs_flush; + #endif + + rename(tempName, fullName); + + delete md5StateStream; + delete [] md5DigestStream; + + delete md5StateClient; + delete [] md5DigestClient; + + // + // Restore the original handlers. + // + + EnableSignals(); + + #ifdef TEST + *logofs << "Proxy: Successfully saved cache file '" + << cacheName << "'.\n" << logofs_flush; + #endif + + // + // This must be enabled only for test + // because it requires that client and + // server reside on the same machine. + // + + if (control -> PersistentCacheCheckOnShutdown == 1 && + control -> ProxyMode == proxy_server) + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: MATCH! Checking if the file '" + << fullName << "' matches a client cache.\n" + << logofs_flush; + #endif + + strcpy(fullName, savePath); + strcat(fullName, "/C-"); + strcat(fullName, md5String); + + struct stat fileStat; + + if (stat(fullName, &fileStat) != 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't find a client cache " + << "with name '" << fullName << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't find a client cache " + << "with name '" << fullName << "'.\n"; + + HandleShutdown(); + } + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: MATCH! Client cache '" << fullName + << "' matches the local cache.\n" + << logofs_flush; + #endif + } + + return cacheName; +} + +const char *Proxy::handleLoadAllStores(const char *loadPath, const char *loadName) const +{ + #ifdef TEST + *logofs << "Proxy: Going to load content of message stores.\n" + << logofs_flush; + #endif + + // + // Until we finish loading cache we + // must at least ignore any SIGIPE. + // + + DisableSignals(); + + if (loadPath == NULL || loadName == NULL) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No path or no file name provided for cache to restore.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No path or no file name provided for cache to restore.\n"; + + EnableSignals(); + + return NULL; + } + else if (strlen(loadName) != MD5_LENGTH * 2 + 2) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Bad file name provided for cache to restore.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Bad file name provided for cache to restore.\n"; + + EnableSignals(); + + return NULL; + } + + istream *cachefs = NULL; + char md5String[(MD5_LENGTH * 2) + 2]; + md5_byte_t md5FromFile[MD5_LENGTH]; + + char *cacheName = new char[strlen(loadPath) + strlen(loadName) + 3]; + + strcpy(cacheName, loadPath); + strcat(cacheName, "/"); + strcat(cacheName, loadName); + + #ifdef TEST + *logofs << "Proxy: Name of cache file is '" + << cacheName << "'.\n" << logofs_flush; + #endif + + cachefs = new ifstream(cacheName, ios::in | ios::binary); + + unsigned char version[4]; + + if (cachefs == NULL || GetData(cachefs, version, 4) < 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't read cache file '" + << cacheName << "'.\n" << logofs_flush;; + #endif + + handleFailOnLoad(cacheName, "A"); + + delete cachefs; + + delete [] cacheName; + + EnableSignals(); + + return NULL; + } + + int major; + int minor; + int patch; + + if (handleLoadVersion(version, major, minor, patch) < 0) + { + #ifdef PANIC + *logofs << "Proxy: WARNING! Incompatible version '" + << major << "." << minor << "." << patch + << "' in cache file '" << cacheName + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Incompatible version '" + << major << "." << minor << "." << patch + << "' in cache file '" << cacheName + << "'.\n" << logofs_flush; + + if (control -> ProxyMode == proxy_server) + { + handleFailOnLoad(cacheName, "B"); + } + else + { + // + // Simply remove the cache file. + // + + unlink(cacheName); + } + + delete cachefs; + + delete [] cacheName; + + EnableSignals(); + + return NULL; + } + + #ifdef TEST + *logofs << "Proxy: Reading from cache file version '" + << major << "." << minor << "." << patch + << "'.\n" << logofs_flush; + #endif + + if (GetData(cachefs, md5FromFile, MD5_LENGTH) < 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No checksum in cache file '" + << loadName << "'.\n" << logofs_flush; + #endif + + handleFailOnLoad(cacheName, "C"); + + delete cachefs; + + delete [] cacheName; + + EnableSignals(); + + return NULL; + } + + md5_state_t *md5StateStream = NULL; + md5_byte_t *md5DigestStream = NULL; + + md5StateStream = new md5_state_t(); + md5DigestStream = new md5_byte_t[MD5_LENGTH]; + + md5_init(md5StateStream); + + // + // Use the virtual method of the proxy class. + // + + if (handleLoadAllStores(cachefs, md5StateStream) < 0) + { + handleFailOnLoad(cacheName, "D"); + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + delete [] cacheName; + + EnableSignals(); + + return NULL; + } + + md5_append(md5StateStream, (const md5_byte_t *) loadName, strlen(loadName)); + md5_finish(md5StateStream, md5DigestStream); + + for (int i = 0; i < MD5_LENGTH; i++) + { + if (md5DigestStream[i] != md5FromFile[i]) + { + #ifdef PANIC + + *logofs << "Proxy: PANIC! Bad checksum for cache file '" + << cacheName << "'.\n" << logofs_flush; + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + sprintf(md5String + (i * 2), "%02X", md5FromFile[i]); + } + + *logofs << "Proxy: PANIC! Saved checksum is '" + << md5String << "'.\n" << logofs_flush; + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + sprintf(md5String + (i * 2),"%02X", md5DigestStream[i]); + } + + *logofs << "Proxy: PANIC! Calculated checksum is '" + << md5String << "'.\n" << logofs_flush; + + #endif + + handleFailOnLoad(cacheName, "E"); + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + delete [] cacheName; + + EnableSignals(); + + return NULL; + } + } + + delete cachefs; + + delete md5StateStream; + delete [] md5DigestStream; + + delete [] cacheName; + + // + // Restore the original handlers. + // + + EnableSignals(); + + #ifdef TEST + *logofs << "Proxy: Successfully loaded cache file '" + << loadName << "'.\n" << logofs_flush; + #endif + + // + // Return the string provided by caller. + // + + return loadName; +} + +int Proxy::allocateChannelMap(int fd) +{ + // + // We assume that the fd is lower than + // the maximum allowed number. This is + // checked at the time the connection + // is accepted. + // + + if (fd < 0 || fd >= CONNECTIONS_LIMIT) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Internal error allocating " + << "new channel with FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Internal error allocating " + << "new channel with FD#" << fd_ << ".\n"; + + HandleCleanup(); + } + + for (int channelId = 0; + channelId < CONNECTIONS_LIMIT; + channelId++) + { + if (checkLocalChannelMap(channelId) == 1 && + fdMap_[channelId] == -1) + { + fdMap_[channelId] = fd; + channelMap_[fd] = channelId; + + #ifdef TEST + *logofs << "Proxy: Allocated new channel ID#" + << channelId << " with FD#" << fd << ".\n" + << logofs_flush; + #endif + + return channelId; + } + } + + // + // No available channel is remaining. + // + + #ifdef TEST + *logofs << "Proxy: WARNING! Can't allocate a new channel " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return -1; +} + +int Proxy::checkChannelMap(int channelId) +{ + // + // To be acceptable, the channel id must + // be an id that is not possible to use + // to allocate channels at this side. + // + + if (checkLocalChannelMap(channelId) == 1) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't open a new channel " + << "with invalid ID#" << channelId << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't open a new channel " + << "with invalid ID#" << channelId << ".\n"; + + return -1; + } + else if (channels_[channelId] != NULL) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't open a new channel " + << "over an existing ID#" << channelId + << " with FD#" << getFd(channelId) + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't open a new channel " + << "over an existing ID#" << channelId + << " with FD#" << getFd(channelId) + << ".\n"; + + return -1; + } + + return 1; +} + +int Proxy::assignChannelMap(int channelId, int fd) +{ + // + // We assume that the fd is lower than + // the maximum allowed number. This is + // checked at the time the connection + // is accepted. + // + + if (channelId < 0 || channelId >= CONNECTIONS_LIMIT || + fd < 0 || fd >= CONNECTIONS_LIMIT) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Internal error assigning " + << "new channel with FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Internal error assigning " + << "new channel with FD#" << fd_ << ".\n"; + + HandleCleanup(); + } + + fdMap_[channelId] = fd; + channelMap_[fd] = channelId; + + return 1; +} + +void Proxy::cleanupChannelMap(int channelId) +{ + int fd = fdMap_[channelId]; + + if (fd != -1) + { + fdMap_[channelId] = -1; + channelMap_[fd] = -1; + } +} + +int Proxy::addControlCodes(T_proxy_code code, int data) +{ + // + // Flush the encode buffer plus all the outstanding + // control codes if there is not enough space for + // the new control message. We need to ensure that + // there are further bytes available, in the case + // we will need to add more token control messages. + // + + if (controlLength_ + 3 > CONTROL_CODES_THRESHOLD) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Flushing control messages " + << "while sending code '" << DumpControl(code) + << "'.\n" << logofs_flush; + #endif + + if (handleFlush() < 0) + { + return -1; + } + } + + controlCodes_[controlLength_++] = 0; + controlCodes_[controlLength_++] = (unsigned char) code; + controlCodes_[controlLength_++] = (unsigned char) (data == -1 ? 0 : data); + + // + // Account for the control frame. + // + + statistics -> addFrameOut(); + + return 1; +} + +void Proxy::setSplitTimeout(int channelId) +{ + int needed = channels_[channelId] -> needSplit(); + + if (needed != isTimestamp(timeouts_.splitTs)) + { + if (needed == 1) + { + #if defined(TEST) || defined(INFO) || defined(SPLIT) + *logofs << "Proxy: SPLIT! Allocating split timestamp at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + timeouts_.splitTs = getTimestamp(); + } + else + { + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL && + channels_[channelId] -> needSplit() == 1) + { + #ifdef TEST + *logofs << "Proxy: SPLIT! Channel for FD#" + << getFd(channelId) << " still needs splits.\n" + << logofs_flush; + #endif + + return; + } + } + + #if defined(TEST) || defined(INFO) || defined(SPLIT) + *logofs << "Proxy: SPLIT! Resetting split timestamp at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + timeouts_.splitTs = nullTimestamp(); + } + } +} + +void Proxy::setMotionTimeout(int channelId) +{ + int needed = channels_[channelId] -> needMotion(); + + if (needed != isTimestamp(timeouts_.motionTs)) + { + if (channels_[channelId] -> needMotion() == 1) + { + #if defined(TEST) || defined(INFO) || defined(SPLIT) + *logofs << "Proxy: Allocating motion timestamp at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + timeouts_.motionTs = getTimestamp(); + } + else + { + T_list &channelList = activeChannels_.getList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL && + channels_[channelId] -> needMotion() == 1) + { + #ifdef TEST + *logofs << "Proxy: SPLIT! Channel for FD#" + << getFd(channelId) << " still needs motions.\n" + << logofs_flush; + #endif + + return; + } + } + + #if defined(TEST) || defined(INFO) || defined(SPLIT) + *logofs << "Proxy: Resetting motion timestamp at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + timeouts_.motionTs = nullTimestamp(); + } + } +} + +void Proxy::increaseChannels(int channelId) +{ + #ifdef TEST + *logofs << "Proxy: Adding channel " << channelId + << " to the list of active channels.\n" + << logofs_flush; + #endif + + activeChannels_.add(channelId); + + #ifdef TEST + *logofs << "Proxy: There are " << activeChannels_.getSize() + << " allocated channels for proxy FD#" << fd_ + << ".\n" << logofs_flush; + #endif +} + +void Proxy::decreaseChannels(int channelId) +{ + #ifdef TEST + *logofs << "Proxy: Removing channel " << channelId + << " from the list of active channels.\n" + << logofs_flush; + #endif + + activeChannels_.remove(channelId); + + #ifdef TEST + *logofs << "Proxy: There are " << activeChannels_.getSize() + << " allocated channels for proxy FD#" << fd_ + << ".\n" << logofs_flush; + #endif +} + +int Proxy::allocateTransport(int channelFd, int channelId) +{ + if (transports_[channelId] == NULL) + { + transports_[channelId] = new Transport(channelFd); + + if (transports_[channelId] == NULL) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Can't allocate transport for " + << "channel id " << channelId << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate transport for " + << "channel id " << channelId << ".\n"; + + return -1; + } + } + else if (transports_[channelId] -> + getType() != transport_agent) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Transport for channel id " + << channelId << " should be null.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Transport for channel id " + << channelId << " should be null.\n"; + + return -1; + } + + return 1; +} + +int Proxy::deallocateTransport(int channelId) +{ + // + // Transport for the agent connection + // is passed from the outside when + // creating the channel. + // + + if (transports_[channelId] -> + getType() != transport_agent) + { + delete transports_[channelId]; + } + + transports_[channelId] = NULL; + + return 1; +} + +int Proxy::handleNewGenericConnection(int clientFd, T_channel_type type, const char *label) +{ + int channelId = allocateChannelMap(clientFd); + + if (channelId == -1) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Maximum number of available " + << "channels exceeded.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Maximum number of available " + << "channels exceeded.\n"; + + return -1; + } + + #ifdef TEST + *logofs << "Proxy: Channel for " << label << " descriptor " + << "FD#" << clientFd << " mapped to ID#" + << channelId << ".\n" + << logofs_flush; + #endif + + // + // Turn queuing off for path server-to-proxy. + // + + SetNoDelay(clientFd, 1); + + if (allocateTransport(clientFd, channelId) < 0) + { + return -1; + } + + switch (type) + { + case channel_cups: + { + channels_[channelId] = new CupsChannel(transports_[channelId], compressor_); + + break; + } + case channel_smb: + { + channels_[channelId] = new SmbChannel(transports_[channelId], compressor_); + + break; + } + case channel_media: + { + channels_[channelId] = new MediaChannel(transports_[channelId], compressor_); + + break; + } + case channel_http: + { + channels_[channelId] = new HttpChannel(transports_[channelId], compressor_); + + break; + } + case channel_font: + { + channels_[channelId] = new FontChannel(transports_[channelId], compressor_); + + break; + } + default: + { + channels_[channelId] = new SlaveChannel(transports_[channelId], compressor_); + + break; + } + } + + if (channels_[channelId] == NULL) + { + deallocateTransport(channelId); + + return -1; + } + + #ifdef TEST + *logofs << "Proxy: Accepted new connection to " + << label << " server.\n" << logofs_flush; + #endif + + cerr << "Info" << ": Accepted new connection to " + << label << " server.\n"; + + increaseChannels(channelId); + + switch (type) + { + case channel_cups: + { + if (handleControl(code_new_cups_connection, channelId) < 0) + { + return -1; + } + + break; + } + case channel_smb: + { + if (handleControl(code_new_smb_connection, channelId) < 0) + { + return -1; + } + + break; + } + case channel_media: + { + if (handleControl(code_new_media_connection, channelId) < 0) + { + return -1; + } + + break; + } + case channel_http: + { + if (handleControl(code_new_http_connection, channelId) < 0) + { + return -1; + } + + break; + } + case channel_font: + { + if (handleControl(code_new_font_connection, channelId) < 0) + { + return -1; + } + + break; + } + default: + { + if (handleControl(code_new_slave_connection, channelId) < 0) + { + return -1; + } + + break; + } + } + + channels_[channelId] -> handleConfiguration(); + + return 1; +} + +int Proxy::handleNewSlaveConnection(int clientFd) +{ + // Since ProtoStep7 (#issue 108) + return handleNewGenericConnection(clientFd, channel_slave, "slave"); +} + + + +int Proxy::handleNewGenericConnectionFromProxy(int channelId, T_channel_type type, + ChannelEndPoint &endPoint, const char *label) +{ + char *unixPath, *host; + long port; + + if (endPoint.getUnixPath(&unixPath)) { + return handleNewGenericConnectionFromProxyUnix(channelId, type, unixPath, label); + } + + if (endPoint.getTCPHostAndPort(&host, &port)) { + return handleNewGenericConnectionFromProxyTCP(channelId, type, host, port, label); + } + + #ifdef WARNING + *logofs << "Proxy: WARNING! Refusing attempted connection " + << "to " << label << " server.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Refusing attempted connection " + << "to " << label << " server.\n"; + + return -1; +} + +int Proxy::handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type, + const char *hostname, long port, const char *label) + +{ + if (port <= 0) + { + // + // This happens when user has disabled + // forwarding of the specific service. + // + + #ifdef WARNING + *logofs << "Proxy: WARNING! Refusing attempted connection " + << "to " << label << " server.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Refusing attempted connection " + << "to " << label << " server.\n"; + + return -1; + } + + const char *serverHost = hostname; + int serverAddrFamily = AF_INET; + sockaddr *serverAddr = NULL; + unsigned int serverAddrLength = 0; + + #ifdef TEST + *logofs << "Proxy: Connecting to " << label + << " server '" << serverHost << "' on TCP port '" + << port << "'.\n" << logofs_flush; + #endif + + int serverIPAddr = GetHostAddress(serverHost); + + if (serverIPAddr == 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Unknown " << label + << " server host '" << serverHost << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Unknown " << label + << " server host '" << serverHost + << "'.\n"; + + return -1; + } + + sockaddr_in *serverAddrTCP = new sockaddr_in; + + serverAddrTCP -> sin_family = AF_INET; + serverAddrTCP -> sin_port = htons(port); + serverAddrTCP -> sin_addr.s_addr = serverIPAddr; + + serverAddr = (sockaddr *) serverAddrTCP; + serverAddrLength = sizeof(sockaddr_in); + + // + // Connect to the requested server. + // + + int serverFd = socket(serverAddrFamily, SOCK_STREAM, PF_UNSPEC); + + if (serverFd < 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + delete serverAddrTCP; + + return -1; + } + else if (connect(serverFd, serverAddr, serverAddrLength) < 0) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Connection to " << label + << " server '" << serverHost << ":" << port + << "' failed with error '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Connection to " << label + << " server '" << serverHost << ":" << port + << "' failed with error '" << ESTR() << "'.\n"; + + close(serverFd); + + delete serverAddrTCP; + + return -1; + } + + delete serverAddrTCP; + + if (handlePostConnectionFromProxy(channelId, serverFd, type, label) < 0) + { + return -1; + } + + #ifdef TEST + *logofs << "Proxy: Forwarded new connection to " + << label << " server on port '" << port + << "'.\n" << logofs_flush; + #endif + + cerr << "Info" << ": Forwarded new connection to " + << label << " server on port '" << port + << "'.\n"; + + return 1; +} + +int Proxy::handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type, + const char *path, const char *label) +{ + if (path == NULL || *path == '\0' ) + { + // + // This happens when user has disabled + // forwarding of the specific service. + // + + #ifdef WARNING + *logofs << "Proxy: WARNING! Refusing attempted connection " + << "to " << label << " server.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Refusing attempted connection " + << "to " << label << " server.\n"; + + return -1; + } + + sockaddr_un serverAddrUnix; + + unsigned int serverAddrLength = sizeof(sockaddr_un); + + int serverAddrFamily = AF_UNIX; + + serverAddrUnix.sun_family = AF_UNIX; + + const int serverAddrNameLength = 108; + + strncpy(serverAddrUnix.sun_path, path, serverAddrNameLength); + + *(serverAddrUnix.sun_path + serverAddrNameLength - 1) = '\0'; + + #ifdef TEST + *logofs << "Proxy: Connecting to " << label << " server " + << "on Unix port '" << path << "'.\n" << logofs_flush; + #endif + + // + // Connect to the requested server. + // + + int serverFd = socket(serverAddrFamily, SOCK_STREAM, PF_UNSPEC); + + if (serverFd < 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + return -1; + } + else if (connect(serverFd, (sockaddr *) &serverAddrUnix, serverAddrLength) < 0) + { + #ifdef WARNING + *logofs << "Proxy: WARNING! Connection to " << label + << " server on Unix port '" << path << "' failed " + << "with error " << EGET() << ", '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Connection to " << label + << " server on Unix port '" << path << "' failed " + << "with error " << EGET() << ", '" << ESTR() << "'.\n"; + + close(serverFd); + + return -1; + } + + if (handlePostConnectionFromProxy(channelId, serverFd, type, label) < 0) + { + return -1; + } + + #ifdef TEST + *logofs << "Proxy: Forwarded new connection to " + << label << " server on Unix port '" << path + << "'.\n" << logofs_flush; + #endif + + cerr << "Info" << ": Forwarded new connection to " + << label << " server on Unix port '" << path + << "'.\n"; + + return 1; +} + +int Proxy::handleNewSlaveConnectionFromProxy(int channelId) +{ + + cerr << "Info" << ": New slave connection on " + << "channel ID#" << channelId << "\n"; + + char *nx_slave_cmd = getenv("NX_SLAVE_CMD"); + if (nx_slave_cmd == NULL) { + return -1; + } + + int spair[2]; + if (socketpair(AF_UNIX, SOCK_STREAM, 0, spair) == -1) { + perror("socketpair"); + return -1; + } + + int serverFd = spair[0]; + int clientFd = spair[1]; + + if (handlePostConnectionFromProxy(channelId, serverFd, channel_slave, "slave") < 0) + { + close(serverFd); + close(clientFd); + return -1; + } + + + int pid = fork(); + if (pid == 0) + { + + if (dup2(clientFd, 0) == -1) + { + perror("dup2"); + exit(1); + } + + if (dup2(clientFd, 1) == -1) + { + perror("dup2"); + exit(1); + } + + close(serverFd); + close(clientFd); + + /* Close FDs used by NX, QVD #1208 */ + for (int fd = 3; fd < 256; fd++) { + close(fd); + } + + char *const argv[2] = {nx_slave_cmd, NULL}; + + if (execv(nx_slave_cmd, argv) == -1) + { + perror("execv"); + } + exit(1); + + } + else if (pid == -1) + { + // TODO Test this! + perror("fork"); + close(serverFd); + close(clientFd); + return -1; + } + + close(clientFd); + slavePidMap_[channelId] = pid; + + cerr << "Info" << ": slave channel ID#" << channelId << " handler has PID " << pid << endl; + + return 1; +} + +void Proxy::checkSlaves() +{ + for (int channelId = 0; channelId 1 && HandleChild(pid)) + { + slavePidMap_[channelId] = nothing; + cerr << "Info:" << " Handled death of slave with pid " << pid << endl; + } + } +} + +int Proxy::handlePostConnectionFromProxy(int channelId, int serverFd, + T_channel_type type, const char *label) +{ + // + // Turn queuing off for path proxy-to-server. + // + + SetNoDelay(serverFd, 1); + + assignChannelMap(channelId, serverFd); + + #ifdef TEST + *logofs << "Proxy: Descriptor FD#" << serverFd + << " mapped to channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + if (allocateTransport(serverFd, channelId) < 0) + { + return -1; + } + + switch (type) + { + case channel_cups: + { + channels_[channelId] = new CupsChannel(transports_[channelId], compressor_); + break; + } + case channel_smb: + { + channels_[channelId] = new SmbChannel(transports_[channelId], compressor_); + + break; + } + case channel_media: + { + channels_[channelId] = new MediaChannel(transports_[channelId], compressor_); + + break; + } + case channel_http: + { + channels_[channelId] = new HttpChannel(transports_[channelId], compressor_); + + break; + } + case channel_font: + { + channels_[channelId] = new FontChannel(transports_[channelId], compressor_); + + break; + } + default: + { + channels_[channelId] = new SlaveChannel(transports_[channelId], compressor_); + + break; + } + } + + if (channels_[channelId] == NULL) + { + deallocateTransport(channelId); + + return -1; + } + + increaseChannels(channelId); + + channels_[channelId] -> handleConfiguration(); + + return 1; +} diff --git a/nxcomp/src/Proxy.h b/nxcomp/src/Proxy.h new file mode 100644 index 000000000..ea60c827a --- /dev/null +++ b/nxcomp/src/Proxy.h @@ -0,0 +1,1276 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Proxy_H +#define Proxy_H + +#include + +#ifdef _AIX +#include +#endif + +#include "Misc.h" +#include "Timestamp.h" + +#include "List.h" +#include "Channel.h" +#include "Transport.h" +#include "EncodeBuffer.h" +#include "ProxyReadBuffer.h" +#include "ChannelEndPoint.h" + +// +// Forward declaration as we +// need a pointer. +// + +class Agent; + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Log the important tracepoints related +// to writing packets to the peer proxy. +// + +#undef FLUSH + +// +// Codes used for control messages in +// proxy-to-proxy protocol. +// +// The following codes are currently +// unused. +// +// code_alert_reply, +// code_reset_request, +// code_reset_reply, +// code_load_reply, +// code_save_reply, +// code_shutdown_reply, +// code_configuration_request, +// code_configuration_reply. +// +// These are for compatibility with +// old versions. +// +// code_sync_request, +// code_sync_reply, +// +// The code_new_aux_connection should not +// be used anymore. Auxiliary X connections +// are treated as normal X channels since +// version 1.5.0. +// + +typedef enum +{ + code_new_x_connection, + code_new_cups_connection, + code_new_aux_connection, + code_new_smb_connection, + code_new_media_connection, + code_switch_connection, + code_drop_connection, + code_finish_connection, + code_begin_congestion, + code_end_congestion, + code_alert_request, + code_alert_reply, + code_reset_request, + code_reset_reply, + code_load_request, + code_load_reply, + code_save_request, + code_save_reply, + code_shutdown_request, + code_shutdown_reply, + code_control_token_request, + code_control_token_reply, + code_configuration_request, + code_configuration_reply, + code_statistics_request, + code_statistics_reply, + code_new_http_connection, + code_sync_request, + code_sync_reply, + code_new_font_connection, + code_new_slave_connection, + code_finish_listeners, + code_split_token_request, + code_split_token_reply, + code_data_token_request, + code_data_token_reply, + code_last_tag + +} T_proxy_code; + +typedef enum +{ + operation_in_negotiation, + operation_in_messages, + operation_in_configuration, + operation_in_statistics, + operation_last_tag + +} T_proxy_operation; + +typedef enum +{ + frame_ping, + frame_data, + +} T_frame_type; + +typedef enum +{ + token_control, + token_split, + token_data + +} T_token_type; + +typedef enum +{ + load_if_any, + load_if_first + +} T_load_type; + +class Proxy +{ + public: + + // + // Maximum number of supported channels. + // + + static const int CONNECTIONS_LIMIT = 256; + + // + // Numboer of token types. + // + + static const int TOKEN_TYPES = 3; + + // + // Lenght of buffer we use to add our + // control messages plus the length of + // the data frame. + // + + static const int CONTROL_CODES_LENGTH = ENCODE_BUFFER_PREFIX_SIZE - 5; + + static const int CONTROL_CODES_THRESHOLD = CONTROL_CODES_LENGTH - 9; + + Proxy(int fd); + + virtual ~Proxy(); + + // + // Inform the proxy that the negotiation phase is + // completed and that it can start handling binary + // messages. + // + + int setOperational(); + + int getOperational() + { + return (operation_ != operation_in_negotiation); + } + + int setReadDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax); + + int setWriteDescriptors(fd_set *fdSet, int &fdMax, T_timestamp &tsMax); + + // + // Perform the operation on the proxy + // link or its own channels. + // + + int handleRead(int &resultFds, fd_set &fdSet); + + int handleFlush(int &resultFds, fd_set &fdSet); + + int handleRead(); + + int handleRead(int fd, const char *data = NULL, int size = 0); + + int handleEvents(); + + int handleFlush(); + + int handleFlush(int fd); + + int handlePing(); + + int handleFinish(); + + int handleShutdown(); + + int handleStatistics(int type, ostream *statofs); + + int handleAlert(int alert); + + int handleRotate() + { + activeChannels_.rotate(); + + return 1; + } + + int handleChannelConfiguration(); + + int handleSocketConfiguration(); + + int handleLinkConfiguration(); + + int handleCacheConfiguration(); + + // + // These must be called just after initialization to + // tell to the proxy where the network connections + // have to be forwarded. + // + + virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, + sockaddr * xServerAddr, unsigned int xServerAddrLength) = 0; + + virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, + ChannelEndPoint &smbServerPort, + ChannelEndPoint &mediaServerPort, + ChannelEndPoint &httpServerPort, + const char *fontServerPort) = 0; + + // + // Create new tunneled channels. + // + + virtual int handleNewConnection(T_channel_type type, int clientFd) = 0; + + virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId) = 0; + + virtual int handleNewAgentConnection(Agent *agent) = 0; + + virtual int handleNewXConnection(int clientFd) = 0; + + virtual int handleNewXConnectionFromProxy(int channelId) = 0; + + int handleNewGenericConnection(int clientFd, T_channel_type type, const char *label); + + int handleNewGenericConnectionFromProxy(int channelId, T_channel_type type, + ChannelEndPoint &endpoint, const char *label); + + int handleNewGenericConnectionFromProxyUnix(int channelId, T_channel_type type, + const char *path, const char *label); + + int handleNewGenericConnectionFromProxyTCP(int channelId, T_channel_type type, + const char *hostname, long port, const char *label); + + int handleNewSlaveConnection(int clientFd); + + int handleNewSlaveConnectionFromProxy(int channelId); + + void checkSlaves(); + + // + // Force closure of channels. + // + + int handleCloseConnection(int clientFd); + + int handleCloseAllXConnections(); + + int handleCloseAllListeners(); + + // + // Called when the loop has replaced + // or closed a previous alert. + // + + void handleResetAlert(); + + // + // Handle the persistent cache. + // + + virtual int handleLoad(T_load_type type) = 0; + + virtual int handleSave() = 0; + + protected: + + // + // Timeout related data: + // + // flush + // split + // motion + // + // Timeouts in milliseconds after which the + // proxy will have to perform the operation. + // + // readTs, writeTs + // + // Timestamp of last packet received or sent + // to remote proxy. Used to detect lost con- + // nection. + // + // loopTs + // + // Timestamp of last loop completed by the + // proxy + // + // pingTs + // + // Timestamp of last ping request sent to the + // remote peer. + // + // alertTs + // + // Timestamp of last 'no data received' alert + // dialog shown to the user. + // + // loadTs + // + // Were message stores populated from data on + // disk. + // + // splitTs + // motionTs + // + // Timestamps of the last operation of this + // kind handled by the proxy. + // + + typedef struct + { + int split; + int motion; + + T_timestamp readTs; + T_timestamp writeTs; + + T_timestamp loopTs; + T_timestamp pingTs; + T_timestamp alertTs; + T_timestamp loadTs; + + T_timestamp splitTs; + T_timestamp motionTs; + + } T_proxy_timeouts; + + // + // Bytes accumulated so far while waiting + // to send the next token, number of tokens + // remaining for each token type and other + // token related information. + // + + typedef struct + { + int size; + int limit; + + int bytes; + int remaining; + + T_proxy_code request; + T_proxy_code reply; + + T_token_type type; + + } T_proxy_token; + + int handlePostConnectionFromProxy(int channelId, int serverFd, + T_channel_type type, const char *label); + + int handleDrain(); + + int handleFrame(T_frame_type type); + + int handleFinish(int channelId); + + int handleDrop(int channelId); + + int handleFinishFromProxy(int channelId); + + int handleDropFromProxy(int channelId); + + int handleStatisticsFromProxy(int type); + + int handleStatisticsFromProxy(const unsigned char *message, unsigned int length); + + int handleNegotiation(const unsigned char *message, unsigned int length); + + int handleNegotiationFromProxy(const unsigned char *message, unsigned int length); + + int handleToken(T_frame_type type); + + int handleTokenFromProxy(T_proxy_token &token, int count); + + int handleTokenReplyFromProxy(T_proxy_token &token, int count); + + int handleSyncFromProxy(int channelId); + + int handleSwitch(int channelId); + + int handleControl(T_proxy_code code, int data = -1); + + int handleControlFromProxy(const unsigned char *message); + + // + // Interleave reads of the X server + // events while writing data to the + // remote proxy. + // + + virtual int handleAsyncEvents() = 0; + + // + // Timer related functions. + // + + protected: + + void setTimer(int value) + { + SetTimer(value); + } + + void resetTimer() + { + ResetTimer(); + + timer_ = 0; + } + + public: + + void handleTimer() + { + timer_ = 1; + } + + int getTimer() + { + return timer_; + } + + // + // Can the channel consume data and the + // proxy produce more output? + // + + int canRead(int fd) const + { + return (isTimeToRead() == 1 && + isTimeToRead(getChannel(fd)) == 1); + } + + // + // Can the proxy read more data from its + // peer? + // + + int canRead() const + { + return (transport_ -> readable() != 0); + } + + int canFlush() const + { + return (encodeBuffer_.getLength() + + controlLength_ + transport_ -> length() + + transport_ -> flushable() > 0); + } + + int needFlush(int channelId) const + { + return (outputChannel_ == channelId && + encodeBuffer_.getLength() > 0); + } + + int needFlush() const + { + return (encodeBuffer_.getLength() > 0); + } + + int shouldFlush() const + { + if ((int) ((encodeBuffer_.getLength() + + controlLength_) / statistics -> + getStreamRatio()) >= control -> TokenSize) + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: FLUSH! Requesting a flush with " + << (encodeBuffer_.getLength() + controlLength_) + << " bytes and stream ratio " << (double) statistics -> + getStreamRatio() << ".\n" << logofs_flush; + #endif + + return 1; + } + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "Proxy: Not requesting a flush with " + << (encodeBuffer_.getLength() + controlLength_) + << " bytes and stream ratio " << (double) statistics -> + getStreamRatio() << ".\n" << logofs_flush; + #endif + + return 0; + } + + int needDrain() const + { + return (congestion_ == 1 || transport_ -> length() > + control -> TransportProxyBufferThreshold); + } + + int getFd() const + { + return fd_; + } + + int getFlushable(int fd) const + { + if (fd == fd_) + { + return (encodeBuffer_.getLength() + controlLength_ + + transport_ -> flushable()); + } + + return 0; + } + + int getSplitSize() + { + return (clientStore_ != NULL ? clientStore_ -> + getSplitTotalSize() : 0); + } + + int getSplitStorageSize() + { + return (clientStore_ != NULL ? clientStore_ -> + getSplitTotalStorageSize() : 0); + } + + // + // Returns the number of active channels + // that currently managed by this proxy. + // + + int getChannels(T_channel_type type = channel_none); + + // + // If descriptor corresponds to a valid + // channel, returns the type of traffic + // carried by it. + // + + T_channel_type getType(int fd); + + // + // Given a channel type, returns the + // literal name. + // + + const char *getTypeName(T_channel_type type); + + // + // Get a convenient name for 'localhost'. + // + + const char *getComputerName(); + + // + // Set if we have initiated the shutdown + // procedure and if the shutdown request + // has been received from the remote. + // + + int getFinish() const + { + return finish_; + } + + int getShutdown() const + { + return shutdown_; + } + + // + // Interfaces to the transport buffers. + // + + int getLength(int fd) const + { + if (fd == fd_) + { + return transport_ -> length(); + } + + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + return 0; + } + + return transports_[channelId] -> length(); + } + + int getPending(int fd) const + { + if (fd == fd_) + { + return transport_ -> pending(); + } + + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + return 0; + } + + return transports_[channelId] -> pending(); + } + + // + // Check if the proxy or the given channel + // has data in the buffer because of a + // blocking write. + // + + int getBlocked(int fd) const + { + if (fd == fd_) + { + return transport_ -> blocked(); + } + + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + return 0; + } + + return transports_[channelId] -> blocked(); + } + + // + // Check if the proxy or the given channel has + // data to read. + // + + int getReadable(int fd) const + { + if (fd == fd_) + { + return transport_ -> readable(); + } + + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + return 0; + } + + return transports_[channelId] -> readable(); + } + + // + // Return a vale between 0 and 9 in the case + // of the proxy descriptor. + // + + int getCongestion(int fd) const + { + if (fd == fd_) + { + return (agent_ != nothing && congestions_[agent_] == 1 ? 9 : + (int) statistics -> getCongestionInFrame()); + } + + int channelId = getChannel(fd); + + if (channelId < 0 || channels_[channelId] == NULL) + { + return 0; + } + + return channels_[channelId] -> getCongestion(); + } + + // + // Let the statistics class get info + // from the message stores. + // + + const ClientStore * const getClientStore() const + { + return clientStore_; + } + + const ServerStore * const getServerStore() const + { + return serverStore_; + } + + // + // These can be called asynchronously by + // channels during their read or write + // loop. + // + + int handleAsyncRead(int fd) + { + return handleRead(fd); + } + + int handleAsyncCongestion(int fd) + { + int channelId = getChannel(fd); + + return handleControl(code_begin_congestion, channelId); + } + + int handleAsyncDecongestion(int fd) + { + int channelId = getChannel(fd); + + return handleControl(code_end_congestion, channelId); + } + + int handleAsyncSplit(int fd, Split *split) + { + return channels_[getChannel(fd)] -> + handleSplitEvent(encodeBuffer_, split); + } + + int handleAsyncPriority() + { + if (control -> FlushPriority == 1) + { + return handleFlush(); + } + + return 0; + } + + int canAsyncFlush() const + { + return shouldFlush(); + } + + int handleAsyncFlush() + { + return handleFlush(); + } + + int handleAsyncSwitch(int fd) + { + return handleSwitch(getChannel(fd)); + } + + int handleAsyncKeeperCallback() + { + KeeperCallback(); + + return 1; + } + + // + // Internal interfaces used to verify the + // availability of channels and the proxy + // link. + // + + protected: + + int isTimeToRead() const + { + if (congestion_ == 0 && transport_ -> + blocked() == 0) + { + return 1; + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Can't read from channels " + << "with congestion " << congestion_ + << " and blocked " << transport_ -> + blocked() << ".\n" << logofs_flush; + #endif + + return 0; + } + } + + int isTimeToRead(int channelId) const + { + if (channelId >= 0 && channelId < CONNECTIONS_LIMIT && + channels_[channelId] != NULL && + congestions_[channelId] == 0) + { + if (channels_[channelId] -> getType() == channel_x11 || + tokens_[token_data].remaining > 0 || + channels_[channelId] -> + getFinish() == 1) + { + return 1; + } + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: Can't read from generic " + << "descriptor FD#" << getFd(channelId) + << " channel ID#" << channelId << " with " + << tokens_[token_data].remaining + << " data tokens remaining.\n" + << logofs_flush; + #endif + + return 0; + } + + #if defined(TEST) || defined(INFO) + + if (channelId < 0 || channelId >= CONNECTIONS_LIMIT || + channels_[channelId] == NULL) + { + *logofs << "Proxy: WARNING! No valid channel for ID#" + << channelId << ".\n" << logofs_flush; + } + else if (channels_[channelId] -> getFinish()) + { + *logofs << "Proxy: Can't read from finishing " + << "descriptor FD#" << getFd(channelId) + << " channel ID#" << channelId << ".\n" + << logofs_flush; + } + else if (congestions_[channelId] == 1) + { + *logofs << "Proxy: Can't read from congested " + << "descriptor FD#" << getFd(channelId) + << " channel ID#" << channelId << ".\n" + << logofs_flush; + } + + #endif + + return 0; + } + + // + // Handle the flush and split timeouts. + // All these functions should round up + // to the value of the latency timeout + // to save a further loop. + // + + protected: + + int isTimeToSplit() const + { + if (isTimestamp(timeouts_.splitTs) && + getTimeToNextSplit() <= control -> + LatencyTimeout) + { + if (tokens_[token_split].remaining > 0) + { + return 1; + } + + #if defined(TEST) || defined(INFO) + *logofs << "Proxy: WARNING! Can't encode splits " + << "with " << tokens_[token_split].remaining + << " split tokens remaining.\n" + << logofs_flush; + #endif + } + + return 0; + } + + int isTimeToMotion() const + { + return (isTimestamp(timeouts_.motionTs) && + getTimeToNextMotion() <= control -> + LatencyTimeout); + } + + int getTimeToNextSplit() const + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + + if (isTimestamp(timeouts_.splitTs) == 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No split timeout was set " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No split timeout was set " + << "for proxy FD#" << fd_ << ".\n"; + + HandleCleanup(); + } + + #endif + + int diffTs = timeouts_.split - + diffTimestamp(timeouts_.splitTs, + getTimestamp()); + + return (diffTs > 0 ? diffTs : 0); + } + + int getTimeToNextMotion() const + { + #if defined(TEST) || defined(INFO) || defined(FLUSH) + + if (isTimestamp(timeouts_.motionTs) == 0) + { + #ifdef PANIC + *logofs << "Proxy: PANIC! No motion timeout was set " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No motion timeout was set " + << "for proxy FD#" << fd_ << ".\n"; + + HandleCleanup(); + } + + #endif + + int diffTs = timeouts_.motion - + diffTimestamp(timeouts_.motionTs, + getTimestamp()); + + return (diffTs > 0 ? diffTs : 0); + } + + protected: + + // + // Implement persistence of cache on disk. + // + + virtual int handleLoadFromProxy() = 0; + virtual int handleSaveFromProxy() = 0; + + int handleLoadStores(); + int handleSaveStores(); + + char *handleSaveAllStores(const char *savePath, bool & isTooSmall) const; + + virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient) const = 0; + + int handleSaveVersion(unsigned char *buffer, int &major, int &minor, int &patch) const; + + void handleFailOnSave(const char *fullName, const char *failContext) const; + + const char *handleLoadAllStores(const char *loadPath, const char *loadName) const; + + virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const = 0; + + int handleLoadVersion(const unsigned char *buffer, int &major, int &minor, int &patch) const; + + void handleFailOnLoad(const char *fullName, const char *failContext) const; + + // + // Prepare for a new persistent cache. + // + + int handleResetPersistentCache(); + + // + // Reset the stores in the case of a + // failure loading the cache. + // + + int handleResetStores(); + + // + // Reset the transport buffer and the + // other counters. + // + + void handleResetFlush(); + + // + // Utility functions used to map file + // descriptors to channel ids. + // + + protected: + + int allocateChannelMap(int fd); + int checkChannelMap(int channelId); + int assignChannelMap(int channelId, int fd); + + void cleanupChannelMap(int channelId); + + virtual int checkLocalChannelMap(int channelId) = 0; + + int addControlCodes(T_proxy_code code, int data); + int addTokenCodes(T_proxy_token &token); + + int getFd(int channelId) const + { + if (channelId >= 0 && channelId < CONNECTIONS_LIMIT) + { + return fdMap_[channelId]; + } + + return -1; + } + + int getChannel(int fd) const + { + if (fd >= 0 && fd < CONNECTIONS_LIMIT) + { + return channelMap_[fd]; + } + + return -1; + } + + protected: + + void setSplitTimeout(int channelId); + void setMotionTimeout(int channelId); + + void increaseChannels(int channelId); + void decreaseChannels(int channelId); + + int allocateTransport(int channelFd, int channelId); + int deallocateTransport(int channelId); + + // + // The proxy has its own transport. + // + + ProxyTransport *transport_; + + // + // The static compressor is shared among + // channels and all the message stores. + // + + StaticCompressor *compressor_; + + // + // Map NX specific opcodes. + // + + OpcodeStore *opcodeStore_; + + // + // Stores are shared between channels. + // + + ClientStore *clientStore_; + ServerStore *serverStore_; + + // + // Client and server caches are shared + // between channels. + // + + ClientCache *clientCache_; + ServerCache *serverCache_; + + // + // The proxy's file descriptor. + // + + int fd_; + + // + // Channels currently selected for I/O + // operations. + // + + int inputChannel_; + int outputChannel_; + + // + // List of active channels. + // + + List activeChannels_; + + // + // Used to read data sent from peer proxy. + // + + ProxyReadBuffer readBuffer_; + + // + // Used to send data to peer proxy. + // + + EncodeBuffer encodeBuffer_; + + // + // Control messages' array. + // + + int controlLength_; + + unsigned char controlCodes_[CONTROL_CODES_LENGTH]; + + // + // Table of channel classes taking + // care of open X connections. + // + + Channel *channels_[CONNECTIONS_LIMIT]; + + // + // Table of open sockets. + // + + Transport *transports_[CONNECTIONS_LIMIT]; + + // + // Timeout related data. + // + + T_proxy_timeouts timeouts_; + + // + // Proxy can be decoding messages, + // handling a link reconfiguration, + // or decoding statistics. + // + + int operation_; + + // + // True if we are currently draining + // the proxy link. + // + + int draining_; + + // + // Force flush because of prioritized + // control messages to send. + // + + int priority_; + + // + // Set if we have initiated the close + // down procedure. + // + + int finish_; + + // + // Remote peer requested the shutdown. + // + + int shutdown_; + + // + // We are in the middle of a network + // congestion in the path to remote + // proxy. + // + + int congestion_; + + // + // Channels at the remote end that + // are not consuming their data. + // + + int congestions_[CONNECTIONS_LIMIT]; + + // + // Is the timer expired? + // + + int timer_; + + // + // Did the proxy request an alert? + // + + int alert_; + + // + // The channel id of the agent. + // + + int agent_; + + // + // Token related data. + // + + T_proxy_token tokens_[TOKEN_TYPES]; + + // + // Pointer to stream descriptor where + // proxy is producing statistics. + // + + ostream *currentStatistics_; + + private: + + // + // Map channel ids to file descriptors. + // + + int channelMap_[CONNECTIONS_LIMIT]; + int fdMap_[CONNECTIONS_LIMIT]; + int slavePidMap_[CONNECTIONS_LIMIT]; +}; + +#endif /* Proxy_H */ diff --git a/nxcomp/src/ProxyReadBuffer.cpp b/nxcomp/src/ProxyReadBuffer.cpp new file mode 100644 index 000000000..77f12771b --- /dev/null +++ b/nxcomp/src/ProxyReadBuffer.cpp @@ -0,0 +1,211 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ProxyReadBuffer.h" + +#include "Transport.h" + +// +// Set the verbosity level. You also +// need to define DUMP in Misc.cpp +// if DUMP is defined here. +// + +#define WARNING +#define PANIC +#undef TEST +#undef DEBUG +#undef DUMP + +unsigned int ProxyReadBuffer::suggestedLength(unsigned int pendingLength) +{ + // + // Always read all the data that + // is available. + // + + int readable = transport_ -> readable(); + + unsigned int readLength = (readable == -1 ? 0 : (unsigned int) readable); + + if (readLength < pendingLength) + { + readLength = pendingLength; + } + + // + // Even if the readable data is not + // enough to make a complete message, + // resize the buffer to accommodate + // it all. + // + + if (pendingLength < remaining_) + { + readLength = remaining_; + } + + return readLength; +} + +int ProxyReadBuffer::locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength) +{ + unsigned int lengthLength = 0; + const unsigned char *nextSrc = start; + unsigned char next; + + dataLength = 0; + + #ifdef TEST + *logofs << "ProxyReadBuffer: Locating message for FD#" + << transport_ -> fd() << " with " << end - start + << " bytes.\n" << logofs_flush; + #endif + + // + // Use something like the following if + // you are looking for errors. + // + + #ifdef DUMP + if (control -> ProxyMode == proxy_server && start < end && + transport_ -> fd() == 6 || transport_ -> fd() == 11) + { + *logofs << "ProxyReadBuffer: Partial checksums are:\n"; + + DumpBlockChecksums(start, end - start, 256); + + *logofs << logofs_flush; + } + #endif + + do + { + if (nextSrc >= end) + { + remaining_ = 1; + + #ifdef TEST + *logofs << "ProxyReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + next = *nextSrc++; + + dataLength <<= 7; + dataLength |= (unsigned int) (next & 0x7f); + + lengthLength++; + } + while (next & 0x80); + + unsigned int totalLength; + + if (dataLength == 0) + { + trailerLength = 0; + controlLength = 3; + totalLength = controlLength; + } + else + { + trailerLength = lengthLength; + controlLength = 0; + totalLength = dataLength + trailerLength; + } + + if (start + totalLength > end) + { + // + // When having to decompress a ZLIB stream, + // a single byte can be enough to complete + // the frame. + // + + if (control -> RemoteStreamCompression == 0) + { + remaining_ = totalLength - (end - start); + } + else + { + remaining_ = 1; + } + + #ifdef TEST + *logofs << "ProxyReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + else + { + #ifdef DUMP + *logofs << "ProxyReadBuffer: Received " << totalLength << " bytes of data " + << "with checksum "; + + DumpChecksum(start, totalLength); + + *logofs << " on proxy FD#" << transport_ -> fd() << ".\n" << logofs_flush; + #endif + + #if defined(TEST) || defined(INFO) + *logofs << "ProxyReadBuffer: Produced plain input for " << dataLength + << "+" << trailerLength << "+" << controlLength << " bytes out of " + << totalLength << " bytes.\n" << logofs_flush; + #endif + + #ifdef DUMP + *logofs << "ProxyReadBuffer: Partial checksums are:\n"; + + DumpBlockChecksums(start, totalLength, 256); + + *logofs << logofs_flush; + #endif + + remaining_ = 0; + + #ifdef TEST + *logofs << "ProxyReadBuffer: Located message with " + << "remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 1; + } +} diff --git a/nxcomp/src/ProxyReadBuffer.h b/nxcomp/src/ProxyReadBuffer.h new file mode 100644 index 000000000..68e9e95fa --- /dev/null +++ b/nxcomp/src/ProxyReadBuffer.h @@ -0,0 +1,57 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ProxyReadBuffer_H +#define ProxyReadBuffer_H + +#include "ReadBuffer.h" +#include "Control.h" + +class ProxyReadBuffer : public ReadBuffer +{ + public: + + ProxyReadBuffer(Transport *transport) + + : ReadBuffer(transport) + { + } + + virtual ~ProxyReadBuffer() + { + } + + protected: + + virtual unsigned int suggestedLength(unsigned int pendingLength); + + virtual int locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength); +}; + +#endif /* ProxyReadBuffer_H */ diff --git a/nxcomp/src/PutImage.cpp b/nxcomp/src/PutImage.cpp new file mode 100644 index 000000000..d14f922c3 --- /dev/null +++ b/nxcomp/src/PutImage.cpp @@ -0,0 +1,411 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PutImage.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +PutImageStore::PutImageStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = PUTIMAGE_ENABLE_CACHE; + enableData = PUTIMAGE_ENABLE_DATA; + + // Since ProtoStep7 (#issue 108) + enableCompress = PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = PUTIMAGE_DATA_LIMIT; + dataOffset = PUTIMAGE_DATA_OFFSET; + + cacheSlots = PUTIMAGE_CACHE_SLOTS; + cacheThreshold = PUTIMAGE_CACHE_THRESHOLD; + cacheLowerThreshold = PUTIMAGE_CACHE_LOWER_THRESHOLD; + + // Since ProtoStep8 (#issue 108) + enableSplit = PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +PutImageStore::~PutImageStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int PutImageStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian), 16, 8); + + encodeBuffer.encodeValue((unsigned int) buffer[1], 2); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> drawableCache); + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> gcCache); + + unsigned int width = GetUINT(buffer + 12, bigEndian); + encodeBuffer.encodeCachedValue(width, 16, + clientCache -> putImageWidthCache, 8); + + unsigned int height = GetUINT(buffer + 14, bigEndian); + encodeBuffer.encodeCachedValue(height, 16, + clientCache -> putImageHeightCache, 8); + + unsigned int x = GetUINT(buffer + 16, bigEndian); + int xDiff = x - clientCache -> putImageLastX; + clientCache -> putImageLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache -> putImageXCache, 8); + + unsigned int y = GetUINT(buffer + 18, bigEndian); + int yDiff = y - clientCache -> putImageLastY; + clientCache -> putImageLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache -> putImageYCache, 8); + + encodeBuffer.encodeCachedValue(buffer[20], 8, + clientCache -> putImageLeftPadCache); + + encodeBuffer.encodeCachedValue(buffer[21], 8, + clientCache -> depthCache); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int PutImageStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + unsigned int value; + unsigned char cValue; + + decodeBuffer.decodeValue(value, 16, 8); + + size = (value << 2); + + buffer = writeBuffer -> addMessage(size); + + decodeBuffer.decodeValue(value, 2); + buffer[1] = (unsigned char) value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + PutULONG(value, buffer + 8, bigEndian); + + unsigned int width; + decodeBuffer.decodeCachedValue(width, 16, + clientCache -> putImageWidthCache, 8); + PutUINT(width, buffer + 12, bigEndian); + + unsigned int height; + decodeBuffer.decodeCachedValue(height, 16, + clientCache -> putImageHeightCache, 8); + PutUINT(height, buffer + 14, bigEndian); + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageXCache, 8); + clientCache -> putImageLastX += value; + clientCache -> putImageLastX &= 0xffff; + PutUINT(clientCache -> putImageLastX, buffer + 16, bigEndian); + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageYCache, 8); + clientCache -> putImageLastY += value; + clientCache -> putImageLastY &= 0xffff; + PutUINT(clientCache -> putImageLastY, buffer + 18, bigEndian); + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> putImageLeftPadCache); + buffer[20] = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + buffer[21] = cValue; + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int PutImageStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PutImageMessage *putImage = (PutImageMessage *) message; + + // + // Here is the fingerprint. + // + + putImage -> format = *(buffer + 1); + putImage -> depth = *(buffer + 21); + putImage -> left_pad = *(buffer + 20); + + putImage -> width = GetUINT(buffer + 12, bigEndian); + putImage -> height = GetUINT(buffer + 14, bigEndian); + putImage -> pos_x = GetUINT(buffer + 16, bigEndian); + putImage -> pos_y = GetUINT(buffer + 18, bigEndian); + + putImage -> drawable = GetULONG(buffer + 4, bigEndian); + putImage -> gcontext = GetULONG(buffer + 8, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PutImageStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PutImageMessage *putImage = (PutImageMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = putImage -> format; + + PutULONG(putImage -> drawable, buffer + 4, bigEndian); + PutULONG(putImage -> gcontext, buffer + 8, bigEndian); + + PutUINT(putImage -> width, buffer + 12, bigEndian); + PutUINT(putImage -> height, buffer + 14, bigEndian); + PutUINT(putImage -> pos_x, buffer + 16, bigEndian); + PutUINT(putImage -> pos_y, buffer + 18, bigEndian); + + *(buffer + 20) = (unsigned char) putImage -> left_pad; + *(buffer + 21) = (unsigned char) putImage -> depth; + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PutImageStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PutImageMessage *putImage = (PutImageMessage *) message; + + *logofs << name() << ": Identity format " << (unsigned) putImage -> format + << ", depth " << (unsigned) putImage -> depth << ", left_pad " + << (unsigned) putImage -> left_pad << ", width " << putImage -> width + << ", height " << putImage -> height << ", pos_x " << putImage -> pos_x + << ", pos_y " << putImage -> pos_y << ", drawable " << putImage -> drawable + << ", gcontext " << putImage -> gcontext << ", size " << putImage -> size_ + << ".\n" << logofs_flush; + + #endif +} + +void PutImageStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Fields format, width, height, left_pad, depth. + // + + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 12, 4); + md5_append(md5_state_, buffer + 20, 2); +} + +void PutImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + PutImageMessage *putImage = (PutImageMessage *) message; + PutImageMessage *cachedPutImage = (PutImageMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putImage -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(putImage -> drawable, clientCache -> drawableCache); + + cachedPutImage -> drawable = putImage -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putImage -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(putImage -> gcontext, clientCache -> gcCache); + + cachedPutImage -> gcontext = putImage -> gcontext; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putImage -> pos_x + << " as " << "pos_x" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_x = putImage -> pos_x - cachedPutImage -> pos_x; + + encodeBuffer.encodeCachedValue(diff_x, 16, + clientCache -> putImageXCache, 8); + + cachedPutImage -> pos_x = putImage -> pos_x; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putImage -> pos_y + << " as " << "pos_y" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_y = putImage -> pos_y - cachedPutImage -> pos_y; + + encodeBuffer.encodeCachedValue(diff_y, 16, + clientCache -> putImageYCache, 8); + + cachedPutImage -> pos_y = putImage -> pos_y; +} + +void PutImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + // + // Decode the variant part. + // + + PutImageMessage *putImage = (PutImageMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + putImage -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putImage -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + putImage -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putImage -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageXCache, 8); + + putImage -> pos_x += value; + putImage -> pos_x &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putImage -> pos_x + << " as pos_x field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageYCache, 8); + + putImage -> pos_y += value; + putImage -> pos_y &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putImage -> pos_y + << " as pos_y field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/PutImage.h b/nxcomp/src/PutImage.h new file mode 100644 index 000000000..93dde9dfb --- /dev/null +++ b/nxcomp/src/PutImage.h @@ -0,0 +1,172 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PutImage_H +#define PutImage_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define PUTIMAGE_ENABLE_CACHE 1 +#define PUTIMAGE_ENABLE_DATA 1 + +#define PUTIMAGE_DATA_LIMIT 262144 - 24 +#define PUTIMAGE_DATA_OFFSET 24 + +#define PUTIMAGE_CACHE_SLOTS 6000 +#define PUTIMAGE_CACHE_THRESHOLD 70 +#define PUTIMAGE_CACHE_LOWER_THRESHOLD 50 + +#define PUTIMAGE_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +#define PUTIMAGE_CACHE_THRESHOLD_IF_PACKED 10 +#define PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED 5 + +#define PUTIMAGE_CACHE_THRESHOLD_IF_SHADOW 97 +#define PUTIMAGE_CACHE_LOWER_THRESHOLD_IF_SHADOW 90 + +#define PUTIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8 0 + +// +// The message class. +// + +class PutImageMessage : public Message +{ + friend class PutImageStore; + + public: + + PutImageMessage() + { + } + + ~PutImageMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char format; + unsigned char depth; + unsigned char left_pad; + unsigned short width; + unsigned short height; + unsigned int drawable; + unsigned int gcontext; + unsigned short pos_x; + unsigned short pos_y; +}; + +class PutImageStore : public MessageStore +{ + public: + + PutImageStore(StaticCompressor *compressor); + + virtual ~PutImageStore(); + + virtual const char *name() const + { + return "PutImage"; + } + + virtual unsigned char opcode() const + { + return X_PutImage; + } + + virtual unsigned int storage() const + { + return sizeof(PutImageMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new PutImageMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PutImageMessage((const PutImageMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PutImageMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PutImage_H */ diff --git a/nxcomp/src/PutPackedImage.cpp b/nxcomp/src/PutPackedImage.cpp new file mode 100644 index 000000000..0bae2c0d4 --- /dev/null +++ b/nxcomp/src/PutPackedImage.cpp @@ -0,0 +1,604 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "PutPackedImage.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +PutPackedImageStore::PutPackedImageStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = PUTPACKEDIMAGE_ENABLE_CACHE; + enableData = PUTPACKEDIMAGE_ENABLE_DATA; + enableCompress = PUTPACKEDIMAGE_ENABLE_COMPRESS; + + dataLimit = PUTPACKEDIMAGE_DATA_LIMIT; + dataOffset = PUTPACKEDIMAGE_DATA_OFFSET; + + cacheSlots = PUTPACKEDIMAGE_CACHE_SLOTS; + cacheThreshold = PUTPACKEDIMAGE_CACHE_THRESHOLD; + cacheLowerThreshold = PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD; + + // Since ProtoStep8 (#issue 108) + enableSplit = PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +PutPackedImageStore::~PutPackedImageStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int PutPackedImageStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + // Client. + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> resourceCache); + + // Size. + encodeBuffer.encodeValue(GetUINT(buffer + 2, bigEndian), 16, 10); + + // Drawable. + encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> drawableCache); + // GC. + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> gcCache); + // Method. + encodeBuffer.encodeCachedValue(*(buffer + 12), 8, + clientCache -> methodCache); + // Format. + encodeBuffer.encodeValue(*(buffer + 13), 2); + + // SrcDepth. + encodeBuffer.encodeCachedValue(*(buffer + 14), 8, + clientCache -> depthCache); + // DstDepth. + encodeBuffer.encodeCachedValue(*(buffer + 15), 8, + clientCache -> depthCache); + // SrcLength. + encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 24, + clientCache -> putPackedImageSrcLengthCache); + // DstLength. + encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 24, + clientCache -> putPackedImageDstLengthCache); + // SrcX. + unsigned int x = GetUINT(buffer + 24, bigEndian); + int xDiff = x - clientCache -> putImageLastX; + clientCache -> putImageLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache -> putImageXCache, 8); + // SrcY. + unsigned int y = GetUINT(buffer + 26, bigEndian); + int yDiff = y - clientCache -> putImageLastY; + clientCache -> putImageLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache -> putImageYCache, 8); + // SrcWidth. + encodeBuffer.encodeCachedValue(GetUINT(buffer + 28, bigEndian), 16, + clientCache -> putImageWidthCache, 8); + // SrcHeight. + encodeBuffer.encodeCachedValue(GetUINT(buffer + 30, bigEndian), 16, + clientCache -> putImageHeightCache, 8); + // DstX. + x = GetUINT(buffer + 32, bigEndian); + xDiff = x - clientCache -> putImageLastX; + clientCache -> putImageLastX = x; + encodeBuffer.encodeCachedValue(xDiff, 16, + clientCache -> putImageXCache, 8); + // DstY. + y = GetUINT(buffer + 34, bigEndian); + yDiff = y - clientCache -> putImageLastY; + clientCache -> putImageLastY = y; + encodeBuffer.encodeCachedValue(yDiff, 16, + clientCache -> putImageYCache, 8); + // DstWidth. + encodeBuffer.encodeCachedValue(GetUINT(buffer + 36, bigEndian), 16, + clientCache -> putImageWidthCache, 8); + // DstHeight. + encodeBuffer.encodeCachedValue(GetUINT(buffer + 38, bigEndian), 16, + clientCache -> putImageHeightCache, 8); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int PutPackedImageStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + unsigned int value; + unsigned char cValue; + + // Client. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> resourceCache); + + // Size. + decodeBuffer.decodeValue(size, 16, 10); + + size <<= 2; + + buffer = writeBuffer -> addMessage(size); + + *(buffer + 1) = cValue; + + // Drawable. + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + PutULONG(value, buffer + 4, bigEndian); + + // GC. + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + PutULONG(value, buffer + 8, bigEndian); + + // Method. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> methodCache); + *(buffer + 12) = cValue; + + // Format. + decodeBuffer.decodeValue(value, 2); + *(buffer + 13) = value; + + // SrcDepth. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 14) = cValue; + + // DstDepth. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 15) = cValue; + + // SrcLength. + decodeBuffer.decodeCachedValue(value, 24, + clientCache -> putPackedImageSrcLengthCache); + PutULONG(value, buffer + 16, bigEndian); + + // DstLength. + decodeBuffer.decodeCachedValue(value, 24, + clientCache -> putPackedImageDstLengthCache); + PutULONG(value, buffer + 20, bigEndian); + + // SrcX. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageXCache, 8); + clientCache -> putImageLastX += value; + clientCache -> putImageLastX &= 0xffff; + PutUINT(clientCache -> putImageLastX, buffer + 24, bigEndian); + + // SrcY. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageYCache, 8); + clientCache -> putImageLastY += value; + clientCache -> putImageLastY &= 0xffff; + PutUINT(clientCache -> putImageLastY, buffer + 26, bigEndian); + + // SrcWidth. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageWidthCache, 8); + PutUINT(value, buffer + 28, bigEndian); + + // SrcHeight. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageHeightCache, 8); + PutUINT(value, buffer + 30, bigEndian); + + // DstX. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageXCache, 8); + clientCache -> putImageLastX += value; + clientCache -> putImageLastX &= 0xffff; + PutUINT(clientCache -> putImageLastX, buffer + 32, bigEndian); + + // DstY. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageYCache, 8); + clientCache -> putImageLastY += value; + clientCache -> putImageLastY &= 0xffff; + PutUINT(clientCache -> putImageLastY, buffer + 34, bigEndian); + + // DstWidth. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageWidthCache, 8); + PutUINT(value, buffer + 36, bigEndian); + + // DstHeight. + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageHeightCache, 8); + PutUINT(value, buffer + 38, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int PutPackedImageStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; + + // + // Here is the fingerprint. + // + + putPackedImage -> client = *(buffer + 1); + + putPackedImage -> drawable = GetULONG(buffer + 4, bigEndian); + putPackedImage -> gcontext = GetULONG(buffer + 8, bigEndian); + + putPackedImage -> method = *(buffer + 12); + + putPackedImage -> format = *(buffer + 13); + putPackedImage -> src_depth = *(buffer + 14); + putPackedImage -> dst_depth = *(buffer + 15); + + putPackedImage -> src_length = GetULONG(buffer + 16, bigEndian); + putPackedImage -> dst_length = GetULONG(buffer + 20, bigEndian); + + putPackedImage -> src_x = GetUINT(buffer + 24, bigEndian); + putPackedImage -> src_y = GetUINT(buffer + 26, bigEndian); + putPackedImage -> src_width = GetUINT(buffer + 28, bigEndian); + putPackedImage -> src_height = GetUINT(buffer + 30, bigEndian); + + putPackedImage -> dst_x = GetUINT(buffer + 32, bigEndian); + putPackedImage -> dst_y = GetUINT(buffer + 34, bigEndian); + putPackedImage -> dst_width = GetUINT(buffer + 36, bigEndian); + putPackedImage -> dst_height = GetUINT(buffer + 38, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int PutPackedImageStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = putPackedImage -> client; + + PutULONG(putPackedImage -> drawable, buffer + 4, bigEndian); + PutULONG(putPackedImage -> gcontext, buffer + 8, bigEndian); + + *(buffer + 12) = putPackedImage -> method; + + *(buffer + 13) = putPackedImage -> format; + *(buffer + 14) = putPackedImage -> src_depth; + *(buffer + 15) = putPackedImage -> dst_depth; + + PutULONG(putPackedImage -> src_length, buffer + 16, bigEndian); + PutULONG(putPackedImage -> dst_length, buffer + 20, bigEndian); + + PutUINT(putPackedImage -> src_x, buffer + 24, bigEndian); + PutUINT(putPackedImage -> src_y, buffer + 26, bigEndian); + PutUINT(putPackedImage -> src_width, buffer + 28, bigEndian); + PutUINT(putPackedImage -> src_height, buffer + 30, bigEndian); + + PutUINT(putPackedImage -> dst_x, buffer + 32, bigEndian); + PutUINT(putPackedImage -> dst_y, buffer + 34, bigEndian); + PutUINT(putPackedImage -> dst_width, buffer + 36, bigEndian); + PutUINT(putPackedImage -> dst_height, buffer + 38, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void PutPackedImageStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; + + *logofs << name() << ": Identity format " + + << "drawable " << putPackedImage -> drawable << ", " + << "gcontext " << putPackedImage -> gcontext << ", " + + << "format " << (unsigned int) putPackedImage -> format << ", " + << "method " << (unsigned int) putPackedImage -> method << ", " + + << "src_depth " << (unsigned int) putPackedImage -> src_depth << ", " + << "dst_depth " << (unsigned int) putPackedImage -> dst_depth << ", " + + << "src_length " << putPackedImage -> src_length << ", " + << "dst_length " << putPackedImage -> dst_length << ", " + + << "src_x " << putPackedImage -> src_x << ", " + << "src_y " << putPackedImage -> src_y << ", " + << "src_width " << putPackedImage -> src_width << ", " + << "src_height " << putPackedImage -> src_height << ", " + + << "dst_x " << putPackedImage -> dst_x << ", " + << "dst_y " << putPackedImage -> dst_y << ", " + << "dst_width " << putPackedImage -> dst_width << ", " + << "dst_height " << putPackedImage -> dst_height << ", " + + << "size " << putPackedImage -> size_ << ".\n" + << logofs_flush; + + #endif +} + +void PutPackedImageStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Fields method, format, src_depth, dst_depth, + // src_length, dst_length, src_x, src_y, src_width, + // src_height. + // + // + // TODO: We should better investigate the effect of + // having fields src_x and src_y in identity instead + // of keeping them in differences. + // + + md5_append(md5_state_, buffer + 12, 20); +} + +void PutPackedImageStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; + PutPackedImageMessage *cachedPutPackedImage = (PutPackedImageMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " + << (unsigned int) putPackedImage -> client + << " as client field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(putPackedImage -> client, 8, + clientCache -> resourceCache); + + cachedPutPackedImage -> client = putPackedImage -> client; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putPackedImage -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(putPackedImage -> drawable, clientCache -> drawableCache); + + cachedPutPackedImage -> drawable = putPackedImage -> drawable; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putPackedImage -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(putPackedImage -> gcontext, clientCache -> gcCache); + + cachedPutPackedImage -> gcontext = putPackedImage -> gcontext; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putPackedImage -> dst_x + << " as " << "dst_x" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_x = putPackedImage -> dst_x - cachedPutPackedImage -> dst_x; + + encodeBuffer.encodeCachedValue(diff_x, 16, + clientCache -> putImageXCache, 8); + + cachedPutPackedImage -> dst_x = putPackedImage -> dst_x; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putPackedImage -> dst_y + << " as " << "dst_y" << " field.\n" << logofs_flush; + #endif + + unsigned short int diff_y = putPackedImage -> dst_y - cachedPutPackedImage -> dst_y; + + encodeBuffer.encodeCachedValue(diff_y, 16, + clientCache -> putImageYCache, 8); + + cachedPutPackedImage -> dst_y = putPackedImage -> dst_y; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putPackedImage -> dst_width + << " as " << "dst_width" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(putPackedImage -> dst_width, 16, + clientCache -> putImageWidthCache, 8); + + cachedPutPackedImage -> dst_width = putPackedImage -> dst_width; + + #ifdef TEST + *logofs << name() << ": Encoding value " << putPackedImage -> dst_height + << " as " << "dst_height" << " field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(putPackedImage -> dst_height, 16, + clientCache -> putImageHeightCache, 8); + + cachedPutPackedImage -> dst_height = putPackedImage -> dst_height; +} + +void PutPackedImageStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + // + // Decode the variant part. + // + + PutPackedImageMessage *putPackedImage = (PutPackedImageMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeCachedValue(putPackedImage -> client, 8, + clientCache -> resourceCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " + << (unsigned int) putPackedImage -> client + << " as client field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> drawableCache); + + putPackedImage -> drawable = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putPackedImage -> drawable + << " as drawable field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + putPackedImage -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putPackedImage -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageXCache, 8); + + putPackedImage -> dst_x += value; + putPackedImage -> dst_x &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putPackedImage -> dst_x + << " as dst_x field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageYCache, 8); + + putPackedImage -> dst_y += value; + putPackedImage -> dst_y &= 0xffff; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putPackedImage -> dst_y + << " as dst_y field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageWidthCache, 8); + + putPackedImage -> dst_width = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putPackedImage -> dst_width + << " as dst_width field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> putImageHeightCache, 8); + + putPackedImage -> dst_height = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << putPackedImage -> dst_height + << " as dst_height field.\n" << logofs_flush; + #endif +} + diff --git a/nxcomp/src/PutPackedImage.h b/nxcomp/src/PutPackedImage.h new file mode 100644 index 000000000..d28ad39eb --- /dev/null +++ b/nxcomp/src/PutPackedImage.h @@ -0,0 +1,218 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef PutPackedImage_H +#define PutPackedImage_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define PUTPACKEDIMAGE_ENABLE_CACHE 1 +#define PUTPACKEDIMAGE_ENABLE_DATA 1 +#define PUTPACKEDIMAGE_ENABLE_COMPRESS 0 + +// +// We can't exceed lenght of 262144 bytes. +// + +#define PUTPACKEDIMAGE_DATA_LIMIT 262144 - 40 +#define PUTPACKEDIMAGE_DATA_OFFSET 40 + +#define PUTPACKEDIMAGE_CACHE_SLOTS 6000 +#define PUTPACKEDIMAGE_CACHE_THRESHOLD 70 +#define PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD 50 + +#define PUTPACKEDIMAGE_CACHE_THRESHOLD_IF_PACKED_SHADOW 97 +#define PUTPACKEDIMAGE_CACHE_LOWER_THRESHOLD_IF_PACKED_SHADOW 90 + +#define PUTPACKEDIMAGE_ENABLE_SPLIT_IF_PROTO_STEP_8 0 + +// +// The message class. +// + +class PutPackedImageMessage : public Message +{ + friend class PutPackedImageStore; + + public: + + PutPackedImageMessage() + { + } + + ~PutPackedImageMessage() + { + } + + // + // Here are the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char client; + + unsigned int drawable; + unsigned int gcontext; + + unsigned char format; + unsigned char method; + + unsigned char src_depth; + unsigned char dst_depth; + + unsigned int src_length; + unsigned int dst_length; + + short int src_x; + short int src_y; + unsigned short src_width; + unsigned short src_height; + + short int dst_x; + short int dst_y; + unsigned short dst_width; + unsigned short dst_height; +}; + +class PutPackedImageStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + PutPackedImageStore(StaticCompressor *compressor); + + virtual ~PutPackedImageStore(); + + virtual const char *name() const + { + return "PutPackedImage"; + } + + virtual unsigned char opcode() const + { + return X_NXPutPackedImage; + } + + virtual unsigned int storage() const + { + return sizeof(PutPackedImageMessage); + } + + // + // Very special of this class. + // + + int getPackedSize(const int position) const + { + PutPackedImageMessage *message = (PutPackedImageMessage *) (*messages_)[position]; + + if (message == NULL) + { + return 0; + } + + return dataOffset + message -> src_length; + } + + int getUnpackedSize(const int position) const + { + PutPackedImageMessage *message = (PutPackedImageMessage *) (*messages_)[position]; + + if (message == NULL) + { + return 0; + } + + return dataOffset + message -> dst_length; + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new PutPackedImageMessage(); + } + + virtual Message *create(const Message &message) const + { + return new PutPackedImageMessage((const PutPackedImageMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (PutPackedImageMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* PutPackedImage_H */ diff --git a/nxcomp/src/QueryFontReply.cpp b/nxcomp/src/QueryFontReply.cpp new file mode 100644 index 000000000..fde873140 --- /dev/null +++ b/nxcomp/src/QueryFontReply.cpp @@ -0,0 +1,154 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "QueryFontReply.h" + +#include "ServerCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +QueryFontReplyStore::QueryFontReplyStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = QUERYFONTREPLY_ENABLE_CACHE; + enableData = QUERYFONTREPLY_ENABLE_DATA; + enableSplit = QUERYFONTREPLY_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = QUERYFONTREPLY_DATA_LIMIT; + dataOffset = QUERYFONTREPLY_DATA_OFFSET; + + cacheSlots = QUERYFONTREPLY_CACHE_SLOTS; + cacheThreshold = QUERYFONTREPLY_CACHE_THRESHOLD; + cacheLowerThreshold = QUERYFONTREPLY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +QueryFontReplyStore::~QueryFontReplyStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int QueryFontReplyStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Clear the padding bytes. + // + + unsigned char *pad = (unsigned char *) buffer; + + if (size >= 24) + { + PutULONG(0, pad + 20, bigEndian); + } + + if (size >= 40) + { + PutULONG(0, pad + 36, bigEndian); + } + + // + // TODO: This doesn't work. Probably these + // padding bytes are not padding anymore. + // This is to be investigated. + // + // pad += 60; + // + // while (pad + 16 <= (buffer + size)) + // { + // PutULONG(0, pad + 12, bigEndian); + // + // pad += 16; + // } + // + + #ifdef DEBUG + *logofs << name() << ": Cleaned padding bytes of " + << "message at " << message << ".\n" + << logofs_flush; + #endif + + return 1; +} + +int QueryFontReplyStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + return 1; +} + +void QueryFontReplyStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + QueryFontReplyMessage *queryFontReply = (QueryFontReplyMessage *) message; + + *logofs << name() << ": Identity size " << queryFontReply -> size_ << ".\n"; + + #endif +} + +void QueryFontReplyStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} diff --git a/nxcomp/src/QueryFontReply.h b/nxcomp/src/QueryFontReply.h new file mode 100644 index 000000000..e12fe4e4b --- /dev/null +++ b/nxcomp/src/QueryFontReply.h @@ -0,0 +1,136 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef QueryFontReply_H +#define QueryFontReply_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// +#define QUERYFONTREPLY_ENABLE_CACHE 1 +#define QUERYFONTREPLY_ENABLE_DATA 1 +#define QUERYFONTREPLY_ENABLE_SPLIT 0 + +#define QUERYFONTREPLY_DATA_LIMIT 1048576 - 32 +#define QUERYFONTREPLY_DATA_OFFSET 8 + +#define QUERYFONTREPLY_CACHE_SLOTS 200 +#define QUERYFONTREPLY_CACHE_THRESHOLD 20 +#define QUERYFONTREPLY_CACHE_LOWER_THRESHOLD 5 + +#define QUERYFONTREPLY_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class QueryFontReplyMessage : public Message +{ + friend class QueryFontReplyStore; + + public: + + QueryFontReplyMessage() + { + } + + ~QueryFontReplyMessage() + { + } +}; + +class QueryFontReplyStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + QueryFontReplyStore(StaticCompressor *compressor); + + virtual ~QueryFontReplyStore(); + + virtual const char *name() const + { + return "QueryFontReply"; + } + + virtual unsigned char opcode() const + { + return X_QueryFont; + } + + virtual unsigned int storage() const + { + return sizeof(QueryFontReplyMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new QueryFontReplyMessage(); + } + + virtual Message *create(const Message &message) const + { + return new QueryFontReplyMessage((const QueryFontReplyMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (QueryFontReplyMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* QueryFontReply_H */ diff --git a/nxcomp/src/ReadBuffer.cpp b/nxcomp/src/ReadBuffer.cpp new file mode 100644 index 000000000..154225e75 --- /dev/null +++ b/nxcomp/src/ReadBuffer.cpp @@ -0,0 +1,639 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ReadBuffer.h" + +#include "Transport.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +ReadBuffer::ReadBuffer(Transport *transport) + + : transport_(transport) +{ + // + // The read buffer will grow until + // reaching the maximum buffer size + // and then will remain stable at + // that size. + // + + initialReadSize_ = READ_BUFFER_DEFAULT_SIZE; + maximumBufferSize_ = READ_BUFFER_DEFAULT_SIZE; + + size_ = 0; + buffer_ = NULL; + + owner_ = 1; + length_ = 0; + start_ = 0; + + remaining_ = 0; +} + +ReadBuffer::~ReadBuffer() +{ + if (owner_ == 1) + { + delete [] buffer_; + } +} + +void ReadBuffer::readMessage(const unsigned char *message, unsigned int length) +{ + // + // To be here we must be the real owner + // of the buffer and there must not be + // pending bytes in the transport. + // + + #ifdef TEST + + if (owner_ == 0) + { + *logofs << "ReadBuffer: PANIC! Class for FD#" + << transport_ -> fd() << " doesn't " + << "appear to be the owner of the buffer " + << "while borrowing from the caller.\n" + << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Be sure that any outstanding data from + // the transport is appended to our own + // byffer. + // + + if (transport_ -> pending() != 0) + { + #ifdef WARNING + *logofs << "ReadBuffer: WARNING! Class for FD#" + << transport_ -> fd() << " has pending " + << "data in the transport while " + << "borrowing from the caller.\n" + << logofs_flush; + #endif + + readMessage(); + + if (owner_ == 0) + { + convertBuffer(); + } + } + + // + // Can't borrow the buffer if there is data + // from a partial message. In this case add + // the new data to the end of our buffer. + // + + if (length_ == 0) + { + #ifdef TEST + *logofs << "ReadBuffer: Borrowing " << length + << " bytes from the caller for FD#" + << transport_ -> fd() << " with " + << length_ << " bytes in the buffer.\n" + << logofs_flush; + #endif + + delete [] buffer_; + + buffer_ = (unsigned char *) message; + size_ = length; + + length_ = length; + + owner_ = 0; + start_ = 0; + } + else + { + #ifdef TEST + *logofs << "ReadBuffer: Appending " << length + << " bytes from the caller for FD#" + << transport_ -> fd() << " with " + << length_ << " bytes in the buffer.\n" + << logofs_flush; + #endif + + appendBuffer(message, length); + } +} + +int ReadBuffer::readMessage() +{ + int pendingLength = transport_ -> pending(); + + if (pendingLength > 0) + { + // + // Can't move the data in the borrowed buffer, + // so use the tansport buffer only if we don't + // have any partial message. This can happen + // with the proxy where we need to deflate the + // stream. + // + + if (length_ == 0) + { + unsigned char *newBuffer; + + length_ = transport_ -> getPending(newBuffer); + + if (newBuffer == NULL) + { + #ifdef PANIC + *logofs << "ReadBuffer: PANIC! Failed to borrow " + << length_ << " bytes of memory for buffer " + << "in context [A].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to borrow memory for " + << "read buffer in context [A].\n"; + + HandleCleanup(); + } + + delete [] buffer_; + + buffer_ = newBuffer; + size_ = length_; + + owner_ = 0; + start_ = 0; + + #ifdef TEST + *logofs << "ReadBuffer: Borrowed " << length_ + << " pending bytes for FD#" << transport_ -> + fd() << ".\n" << logofs_flush; + #endif + + return length_; + } + #ifdef TEST + else + { + *logofs << "ReadBuffer: WARNING! Cannot borrow " + << pendingLength << " bytes for FD#" + << transport_ -> fd() << " with " + << length_ << " bytes in the buffer.\n" + << logofs_flush; + } + #endif + } + + unsigned int readLength = suggestedLength(pendingLength); + + #ifdef DEBUG + *logofs << "ReadBuffer: Requested " << readLength + << " bytes for FD#" << transport_ -> fd() + << " with readable " << transport_ -> readable() + << " remaining " << remaining_ << " pending " + << transport_ -> pending() << ".\n" + << logofs_flush; + #endif + + if (readLength < initialReadSize_) + { + readLength = initialReadSize_; + } + + #ifdef DEBUG + *logofs << "ReadBuffer: Buffer size is " << size_ + << " length " << length_ << " and start " + << start_ << ".\n" << logofs_flush; + #endif + + // + // We can't use the transport buffer + // to read our own data in it. + // + + #ifdef TEST + + if (owner_ == 0) + { + *logofs << "ReadBuffer: PANIC! Class for FD#" + << transport_ -> fd() << " doesn't " + << "appear to be the owner of the buffer " + << "while reading.\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Be sure that we have enough space + // to store all the requested data. + // + + if (buffer_ == NULL || length_ + readLength > size_) + { + unsigned int newSize = length_ + readLength; + + #ifdef TEST + *logofs << "ReadBuffer: Resizing buffer for FD#" + << transport_ -> fd() << " in read from " + << size_ << " to " << newSize << " bytes.\n" + << logofs_flush; + #endif + + unsigned char *newBuffer = allocateBuffer(newSize); + + memcpy(newBuffer, buffer_ + start_, length_); + + delete [] buffer_; + + buffer_ = newBuffer; + size_ = newSize; + + transport_ -> pendingReset(); + + owner_ = 1; + } + else if (start_ != 0 && length_ != 0) + { + // + // If any bytes are left due to a partial + // message, shift them to the beginning + // of the buffer. + // + + #ifdef TEST + *logofs << "ReadBuffer: Moving " << length_ + << " bytes of data " << "at beginning of " + << "the buffer for FD#" << transport_ -> fd() + << ".\n" << logofs_flush; + #endif + + memmove(buffer_, buffer_ + start_, length_); + } + + start_ = 0; + + #ifdef DEBUG + *logofs << "ReadBuffer: Buffer size is now " << size_ + << " length is " << length_ << " and start is " + << start_ << ".\n" << logofs_flush; + #endif + + unsigned char *readData = buffer_ + length_; + + #ifdef DEBUG + *logofs << "ReadBuffer: Going to read " << readLength + << " bytes from FD#" << transport_ -> fd() << ".\n" + << logofs_flush; + #endif + + int bytesRead = transport_ -> read(readData, readLength); + + if (bytesRead > 0) + { + #ifdef TEST + *logofs << "ReadBuffer: Read " << bytesRead + << " bytes from FD#" << transport_ -> fd() + << ".\n" << logofs_flush; + #endif + + length_ += bytesRead; + } + else if (bytesRead < 0) + { + // + // Check if there is more data pending than the + // size of the provided buffer. After reading + // the requested amount, in fact, the transport + // may have decompressed the data and produced + // more input. This trick allows us to always + // borrow the buffer from the transport, even + // when the partial read would have prevented + // that. + // + + if (transport_ -> pending() > 0) + { + #ifdef TEST + *logofs << "ReadBuffer: WARNING! Trying to read some " + << "more with " << transport_ -> pending() + << " bytes pending for FD#" << transport_ -> + fd() << ".\n" << logofs_flush; + #endif + + return readMessage(); + } + + #ifdef TEST + *logofs << "ReadBuffer: Error detected reading " + << "from FD#" << transport_ -> fd() + << ".\n" << logofs_flush; + #endif + + return -1; + } + #ifdef TEST + else + { + *logofs << "ReadBuffer: No data read from FD#" + << transport_ -> fd() << " with remaining " + << remaining_ << ".\n" << logofs_flush; + } + #endif + + return bytesRead; +} + +const unsigned char *ReadBuffer::getMessage(unsigned int &controlLength, + unsigned int &dataLength) +{ + #ifdef TEST + + if (transport_ -> pending() > 0) + { + *logofs << "ReadBuffer: PANIC! The transport " + << "appears to have data pending.\n" + << logofs_flush; + + HandleCleanup(); + } + + #endif + + if (length_ == 0) + { + #ifdef DEBUG + *logofs << "ReadBuffer: No message can be located " + << "for FD#" << transport_ -> fd() << ".\n" + << logofs_flush; + #endif + + if (owner_ == 0) + { + buffer_ = NULL; + size_ = 0; + + transport_ -> pendingReset(); + + owner_ = 1; + start_ = 0; + } + + return NULL; + } + + unsigned int trailerLength; + + #ifdef DEBUG + *logofs << "ReadBuffer: Going to locate message with " + << "start at " << start_ << " and length " + << length_ << " for FD#" << transport_ -> fd() + << ".\n" << logofs_flush; + #endif + + int located = locateMessage(buffer_ + start_, buffer_ + start_ + length_, + controlLength, dataLength, trailerLength); + + if (located == 0) + { + // + // No more complete messages are in + // the buffer. + // + + #ifdef DEBUG + *logofs << "ReadBuffer: No message was located " + << "for FD#" << transport_ -> fd() + << ".\n" << logofs_flush; + #endif + + if (owner_ == 0) + { + // + // Must move the remaining bytes in + // our own buffer. + // + + convertBuffer(); + } + + return NULL; + } + else + { + const unsigned char *result = buffer_ + start_; + + if (dataLength > 0) + { + // + // Message contains data, so go to the + // first byte of payload. + // + + result += trailerLength; + + start_ += (dataLength + trailerLength); + length_ -= (dataLength + trailerLength); + } + else + { + // + // It is a control message. + // + + start_ += (controlLength + trailerLength); + length_ -= (controlLength + trailerLength); + } + + #ifdef DEBUG + *logofs << "ReadBuffer: Located message for FD#" + << transport_ -> fd() << " with control length " + << controlLength << " and data length " + << dataLength << ".\n" << logofs_flush; + #endif + + remaining_ = 0; + + return result; + } +} + +int ReadBuffer::setSize(int initialReadSize, int maximumBufferSize) +{ + initialReadSize_ = initialReadSize; + maximumBufferSize_ = maximumBufferSize; + + #ifdef TEST + *logofs << "ReadBuffer: WARNING! Set buffer parameters to " + << initialReadSize_ << "/" << maximumBufferSize_ + << " for object at "<< this << ".\n" + << logofs_flush; + #endif + + return 1; +} + +void ReadBuffer::fullReset() +{ + #ifdef TEST + + if (owner_ == 0) + { + *logofs << "ReadBuffer: PANIC! Class for FD#" + << transport_ -> fd() << " doesn't " + << "appear to be the owner of the buffer " + << "in reset.\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + if (length_ == 0 && size_ > maximumBufferSize_) + { + #ifdef TEST + *logofs << "ReadBuffer: Resizing buffer for FD#" + << transport_ -> fd() << " in reset from " + << size_ << " to " << maximumBufferSize_ + << " bytes.\n" << logofs_flush; + #endif + + delete [] buffer_; + + int newSize = maximumBufferSize_; + + unsigned char *newBuffer = allocateBuffer(newSize); + + buffer_ = newBuffer; + size_ = newSize; + + transport_ -> pendingReset(); + + owner_ = 1; + start_ = 0; + } +} + +unsigned char *ReadBuffer::allocateBuffer(unsigned int newSize) +{ + unsigned char *newBuffer = new unsigned char[newSize]; + + if (newBuffer == NULL) + { + #ifdef PANIC + *logofs << "ReadBuffer: PANIC! Can't allocate " + << newSize << " bytes of memory for buffer " + << "in context [B].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "read buffer in context [B].\n"; + + HandleCleanup(); + } + + #ifdef VALGRIND + + memset(newBuffer, '\0', newSize); + + #endif + + return newBuffer; +} + +void ReadBuffer::appendBuffer(const unsigned char *message, unsigned int length) +{ + if (start_ + length_ + length > size_) + { + unsigned int newSize = length_ + length + initialReadSize_; + + #ifdef TEST + *logofs << "ReadBuffer: WARNING! Resizing buffer " + << "for FD#" << transport_ -> fd() + << " from " << size_ << " to " << newSize + << " bytes.\n" << logofs_flush; + #endif + + unsigned char *newBuffer = allocateBuffer(newSize); + + memcpy(newBuffer, buffer_ + start_, length_); + + delete [] buffer_; + + buffer_ = newBuffer; + size_ = newSize; + + start_ = 0; + } + + memcpy(buffer_ + start_ + length_, message, length); + + length_ += length; + + transport_ -> pendingReset(); + + owner_ = 1; +} + +void ReadBuffer::convertBuffer() +{ + unsigned int newSize = length_ + initialReadSize_; + + #ifdef TEST + *logofs << "ReadBuffer: WARNING! Converting " + << length_ << " bytes to own buffer " + << "for FD#" << transport_ -> fd() + << " with new size " << newSize + << " bytes.\n" << logofs_flush; + #endif + + unsigned char *newBuffer = allocateBuffer(newSize); + + memcpy(newBuffer, buffer_ + start_, length_); + + buffer_ = newBuffer; + size_ = newSize; + + transport_ -> pendingReset(); + + owner_ = 1; + start_ = 0; +} diff --git a/nxcomp/src/ReadBuffer.h b/nxcomp/src/ReadBuffer.h new file mode 100644 index 000000000..a12bcc9b3 --- /dev/null +++ b/nxcomp/src/ReadBuffer.h @@ -0,0 +1,128 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ReadBuffer_H +#define ReadBuffer_H + +#include "Misc.h" +#include "Timestamp.h" +#include "Transport.h" + +#define READ_BUFFER_DEFAULT_SIZE 8192 + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +class ReadBuffer +{ + public: + + ReadBuffer(Transport *transport); + + virtual ~ReadBuffer(); + + int readMessage(); + + void readMessage(const unsigned char *message, unsigned int length); + + const unsigned char *getMessage(unsigned int &dataLength) + { + unsigned int controlLength; + + return getMessage(controlLength, dataLength); + } + + const unsigned char *getMessage(unsigned int &controlLength, unsigned int &dataLength); + + unsigned int getLength() const + { + return length_; + } + + unsigned int getRemaining() const + { + return remaining_; + } + + int setSize(int initialReadSize, int initialbufferSize); + + void fullReset(); + + // + // Check if there is a complete + // message in the buffer. + // + + int checkMessage() + { + if (length_ == 0) + { + return 0; + } + else + { + unsigned int controlLength; + unsigned int dataLength; + unsigned int trailerLength; + + return (locateMessage(buffer_ + start_, buffer_ + start_ + length_, + controlLength, dataLength, trailerLength)); + } + } + + protected: + + virtual unsigned int suggestedLength(unsigned int pendingLength) = 0; + + virtual int locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength) = 0; + + unsigned char *allocateBuffer(unsigned int newSize); + + void appendBuffer(const unsigned char *message, unsigned int length); + + void convertBuffer(); + + Transport *transport_; + + unsigned char *buffer_; + + unsigned int length_; + unsigned int size_; + unsigned int start_; + unsigned int remaining_; + + int owner_; + + unsigned int initialReadSize_; + unsigned int maximumBufferSize_; +}; + +#endif /* ReadBuffer_H */ diff --git a/nxcomp/src/RenderAddGlyphs.cpp b/nxcomp/src/RenderAddGlyphs.cpp new file mode 100644 index 000000000..ef13d6890 --- /dev/null +++ b/nxcomp/src/RenderAddGlyphs.cpp @@ -0,0 +1,233 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +// +// Include the template for +// this message class. +// + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "RenderAddGlyphs.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 4, bigEndian), 29, + clientCache -> renderGlyphSetCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 32, + clientCache -> renderNumGlyphsCache, 8); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeCachedValue(value, 29, + clientCache -> renderGlyphSetCache); + + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderNumGlyphsCache, 8); + + PutULONG(value, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.add_glyphs.type = *(buffer + 1); + + renderExtension -> data.add_glyphs.set_id = GetULONG(buffer + 4, bigEndian); + renderExtension -> data.add_glyphs.num_elm = GetULONG(buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.add_glyphs.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.add_glyphs.type; + + PutULONG(renderExtension -> data.add_glyphs.set_id, buffer + 4, bigEndian); + PutULONG(renderExtension -> data.add_glyphs.num_elm, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.add_glyphs.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); + md5_append(md5_state, buffer + 8, 4); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(renderExtension -> data.add_glyphs.set_id, 29, + clientCache -> renderGlyphSetCache); + + cachedRenderExtension -> data.add_glyphs.set_id = + renderExtension -> data.add_glyphs.set_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.add_glyphs.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(renderExtension -> data.add_glyphs.set_id, 29, + clientCache -> renderGlyphSetCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.add_glyphs.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderAddGlyphs.h b/nxcomp/src/RenderAddGlyphs.h new file mode 100644 index 000000000..d3c8cd158 --- /dev/null +++ b/nxcomp/src/RenderAddGlyphs.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderAddGlyphs_H +#define RenderAddGlyphs_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderAddGlyphs" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderAddGlyphsStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 12 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderAddGlyphs_H */ diff --git a/nxcomp/src/RenderChangePicture.cpp b/nxcomp/src/RenderChangePicture.cpp new file mode 100644 index 000000000..d202b92ad --- /dev/null +++ b/nxcomp/src/RenderChangePicture.cpp @@ -0,0 +1,238 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +// +// Include the template for +// this message class. +// + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "RenderChangePicture.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + #ifdef DEBUG + + if (size == MESSAGE_OFFSET + 4) + { + *logofs << name() << ": Mask is " << GetULONG(buffer + 8, bigEndian) + << " value is " << GetULONG(buffer + 12, bigEndian) + << ".\n" << logofs_flush; + } + else + { + *logofs << name() << ": WARNING! Unexpected size. Mask is " + << GetULONG(buffer + 8, bigEndian) << ".\n" + << logofs_flush; + } + + #endif + + encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.change_picture.type = *(buffer + 1); + + renderExtension -> data.change_picture.src_id = GetULONG(buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.change_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.change_picture.type; + + PutULONG(renderExtension -> data.change_picture.src_id, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.change_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.change_picture.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.change_picture.src_id = + renderExtension -> data.change_picture.src_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.change_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.change_picture.src_id, + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.change_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderChangePicture.h b/nxcomp/src/RenderChangePicture.h new file mode 100644 index 000000000..4bab1ef98 --- /dev/null +++ b/nxcomp/src/RenderChangePicture.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderChangePicture_H +#define RenderChangePicture_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderChangePicture" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderChangePictureStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 8 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderChangePicture_H */ diff --git a/nxcomp/src/RenderComposite.cpp b/nxcomp/src/RenderComposite.cpp new file mode 100644 index 000000000..f82f80f06 --- /dev/null +++ b/nxcomp/src/RenderComposite.cpp @@ -0,0 +1,400 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +// +// Include the template for +// this message class. +// + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "RenderComposite.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> renderSrcPictureCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), + clientCache -> renderMaskPictureCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 16, bigEndian), + clientCache -> renderDstPictureCache); + + // + // Src X and Y. + // + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + // + // Mask X and Y. + // + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 24, bigEndian), + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 26, bigEndian), + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + // + // Dst X and Y. + // + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 28, bigEndian), + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 30, bigEndian), + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + // + // Width and height. + // + + encodeBuffer.encodeCachedValue(GetUINT(buffer + 32, bigEndian), 16, + clientCache -> renderWidthCache, 11); + + encodeBuffer.encodeCachedValue(GetUINT(buffer + 34, bigEndian), 16, + clientCache -> renderHeightCache, 11); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeXidValue(value, clientCache -> renderMaskPictureCache); + + PutULONG(value, buffer + 12, bigEndian); + + decodeBuffer.decodeXidValue(value, clientCache -> renderDstPictureCache); + + PutULONG(value, buffer + 16, bigEndian); + + // + // Src X and Y. + // + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); + + // + // Mask X and Y. + // + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + PutUINT(clientCache -> renderLastX, buffer + 24, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + PutUINT(clientCache -> renderLastY, buffer + 26, bigEndian); + + // + // Dst X and Y. + // + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + PutUINT(clientCache -> renderLastX, buffer + 28, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + PutUINT(clientCache -> renderLastY, buffer + 30, bigEndian); + + // + // Width and height. + // + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> renderWidthCache, 11); + + PutUINT(value, buffer + 32, bigEndian); + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> renderHeightCache, 11); + + PutUINT(value, buffer + 34, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.composite.type = *(buffer + 1); + renderExtension -> data.composite.op = *(buffer + 4); + + renderExtension -> data.composite.src_id = GetULONG(buffer + 8, bigEndian); + renderExtension -> data.composite.msk_id = GetULONG(buffer + 12, bigEndian); + renderExtension -> data.composite.dst_id = GetULONG(buffer + 16, bigEndian); + + renderExtension -> data.composite.src_x = GetUINT(buffer + 20, bigEndian); + renderExtension -> data.composite.src_y = GetUINT(buffer + 22, bigEndian); + + renderExtension -> data.composite.msk_x = GetUINT(buffer + 24, bigEndian); + renderExtension -> data.composite.msk_y = GetUINT(buffer + 26, bigEndian); + + renderExtension -> data.composite.dst_x = GetUINT(buffer + 28, bigEndian); + renderExtension -> data.composite.dst_y = GetUINT(buffer + 30, bigEndian); + + renderExtension -> data.composite.width = GetUINT(buffer + 32, bigEndian); + renderExtension -> data.composite.height = GetUINT(buffer + 34, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.composite.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.composite.type; + *(buffer + 4) = renderExtension -> data.composite.op; + + PutULONG(renderExtension -> data.composite.src_id, buffer + 8, bigEndian); + PutULONG(renderExtension -> data.composite.msk_id, buffer + 12, bigEndian); + PutULONG(renderExtension -> data.composite.dst_id, buffer + 16, bigEndian); + + PutUINT(renderExtension -> data.composite.src_x, buffer + 20, bigEndian); + PutUINT(renderExtension -> data.composite.src_y, buffer + 22, bigEndian); + + PutUINT(renderExtension -> data.composite.msk_x, buffer + 24, bigEndian); + PutUINT(renderExtension -> data.composite.msk_y, buffer + 26, bigEndian); + + PutUINT(renderExtension -> data.composite.dst_x, buffer + 28, bigEndian); + PutUINT(renderExtension -> data.composite.dst_y, buffer + 30, bigEndian); + + PutUINT(renderExtension -> data.composite.width, buffer + 32, bigEndian); + PutUINT(renderExtension -> data.composite.height, buffer + 34, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.composite.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + // + // Include the minor opcode and size in the + // identity, plus the operator, the x and y + // of the source and mask and the width and + // height of the destination. + // + + md5_append(md5_state, buffer + 1, 4); + md5_append(md5_state, buffer + 20, 8); + md5_append(md5_state, buffer + 32, 4); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Source " << renderExtension -> data.composite.src_id + << " mask " << renderExtension -> data.composite.msk_id + << " destination " << renderExtension -> data.composite.msk_id + << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(renderExtension -> data.composite.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.composite.src_id = + renderExtension -> data.composite.src_id; + + encodeBuffer.encodeXidValue(renderExtension -> data.composite.msk_id, + clientCache -> renderMaskPictureCache); + + cachedRenderExtension -> data.composite.msk_id = + renderExtension -> data.composite.msk_id; + + encodeBuffer.encodeXidValue(renderExtension -> data.composite.dst_id, + clientCache -> renderDstPictureCache); + + cachedRenderExtension -> data.composite.dst_id = + renderExtension -> data.composite.dst_id; + + // + // Dst X and Y. + // + + unsigned int value; + unsigned int previous; + + value = renderExtension -> data.composite.dst_x; + previous = cachedRenderExtension -> data.composite.dst_x; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + cachedRenderExtension -> data.composite.dst_x = value; + + value = renderExtension -> data.composite.dst_y; + previous = cachedRenderExtension -> data.composite.dst_y; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + cachedRenderExtension -> data.composite.dst_y = value; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.composite.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.composite.src_id, + clientCache -> renderSrcPictureCache); + + decodeBuffer.decodeXidValue(renderExtension -> data.composite.msk_id, + clientCache -> renderMaskPictureCache); + + decodeBuffer.decodeXidValue(renderExtension -> data.composite.dst_id, + clientCache -> renderDstPictureCache); + + // + // Dst X and Y. + // + + unsigned int value; + unsigned int previous; + + previous = renderExtension -> data.composite.dst_x; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + renderExtension -> data.composite.dst_x = value; + + previous = renderExtension -> data.composite.dst_y; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + renderExtension -> data.composite.dst_y = value; + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.composite.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderComposite.h b/nxcomp/src/RenderComposite.h new file mode 100644 index 000000000..aafa1e776 --- /dev/null +++ b/nxcomp/src/RenderComposite.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderComposite_H +#define RenderComposite_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderComposite" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderCompositeStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 36 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 0 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 0 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderComposite_H */ diff --git a/nxcomp/src/RenderCompositeGlyphs.cpp b/nxcomp/src/RenderCompositeGlyphs.cpp new file mode 100644 index 000000000..0949d3e2c --- /dev/null +++ b/nxcomp/src/RenderCompositeGlyphs.cpp @@ -0,0 +1,629 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderCompositeGlyphs.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding value " + << ((size - MESSAGE_OFFSET) >> 2) << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << size + << ".\n" << logofs_flush; + #endif + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> renderSrcPictureCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), + clientCache -> renderDstPictureCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, + clientCache -> renderFormatCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 20, bigEndian), 29, + clientCache -> renderGlyphSetCache); + + unsigned int src_x = GetUINT(buffer + 24, bigEndian); + unsigned int src_y = GetUINT(buffer + 26, bigEndian); + + // Since ProtoStep8 (#issue 108) + encodeBuffer.encodeDiffCachedValue(src_x, + clientCache -> renderGlyphX, 16, + clientCache -> renderGlyphXCache, 11); + + encodeBuffer.encodeDiffCachedValue(src_y, + clientCache -> renderGlyphY, 16, + clientCache -> renderGlyphYCache, 11); + + #ifdef TEST + *logofs << name() << ": Encoded source X " + << GetUINT(buffer + 24, bigEndian) << " source Y " + << GetUINT(buffer + 26, bigEndian) << ".\n" + << logofs_flush; + #endif + + // + // Bytes from 28 to 36 contain in the order: + // + // 1 byte for the length of the first string. + // 3 bytes of padding. + // 2 bytes for the X offset. + // 2 bytes for the Y offset. + // + // Encode these bytes differentially to match + // all the strings that have equal glyphs. + // + // Only manage the first string of glyphs. The + // others strings should match, if they contain + // the same glyphs, since the offset are rela- + // tive to the first offset coordinates. + // + + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + unsigned int numGlyphs = *(buffer + 28); + + encodeBuffer.encodeCachedValue(numGlyphs, 8, + clientCache -> renderNumGlyphsCache); + + unsigned int offset_x = GetUINT(buffer + 32, bigEndian); + unsigned int offset_y = GetUINT(buffer + 34, bigEndian); + + if (offset_x == src_x && offset_y == src_y) + { + encodeBuffer.encodeBoolValue(0); + + #ifdef TEST + *logofs << name() << ": Matched offset X " + << GetUINT(buffer + 32, bigEndian) << " offset Y " + << GetUINT(buffer + 34, bigEndian) << ".\n" + << logofs_flush; + #endif + } + else + { + encodeBuffer.encodeBoolValue(1); + + encodeBuffer.encodeDiffCachedValue(offset_x, + clientCache -> renderGlyphX, 16, + clientCache -> renderGlyphXCache, 11); + + encodeBuffer.encodeDiffCachedValue(offset_y, + clientCache -> renderGlyphY, 16, + clientCache -> renderGlyphYCache, 11); + + #ifdef TEST + *logofs << name() << ": Missed offset X " + << GetUINT(buffer + 32, bigEndian) << " offset Y " + << GetUINT(buffer + 34, bigEndian) << ".\n" + << logofs_flush; + #endif + } + } + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + decodeBuffer.decodeXidValue(value, + clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeXidValue(value, + clientCache -> renderDstPictureCache); + + PutULONG(value, buffer + 12, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderFormatCache); + + PutULONG(value, buffer + 16, bigEndian); + + decodeBuffer.decodeCachedValue(value, 29, + clientCache -> renderGlyphSetCache); + + PutULONG(value, buffer + 20, bigEndian); + + unsigned int src_x; + unsigned int src_y; + + // Since ProtoStep8 (#issue 108) + decodeBuffer.decodeDiffCachedValue(src_x, + clientCache -> renderGlyphX, 16, + clientCache -> renderGlyphXCache, 11); + + decodeBuffer.decodeDiffCachedValue(src_y, + clientCache -> renderGlyphY, 16, + clientCache -> renderGlyphYCache, 11); + + PutUINT(src_x, buffer + 24, bigEndian); + PutUINT(src_y, buffer + 26, bigEndian); + + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + decodeBuffer.decodeCachedValue(value, 8, + clientCache -> renderNumGlyphsCache); + + *(buffer + 28) = value; + + decodeBuffer.decodeBoolValue(value); + + if (value == 0) + { + PutUINT(src_x, buffer + 32, bigEndian); + PutUINT(src_y, buffer + 34, bigEndian); + } + else + { + decodeBuffer.decodeDiffCachedValue(src_x, + clientCache -> renderGlyphX, 16, + clientCache -> renderGlyphXCache, 11); + + PutUINT(src_x, buffer + 32, bigEndian); + + decodeBuffer.decodeDiffCachedValue(src_y, + clientCache -> renderGlyphY, 16, + clientCache -> renderGlyphYCache, 11); + + PutUINT(src_y, buffer + 34, bigEndian); + } + } + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8, + size, bigEndian, channelCache); + } + else if (size > MESSAGE_OFFSET) + { + encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + } + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of text data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET_IF_PROTO_STEP_8, + size, bigEndian, channelCache); + } + else if (size > MESSAGE_OFFSET) + { + decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + } + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.composite_glyphs.type = *(buffer + 1); + renderExtension -> data.composite_glyphs.op = *(buffer + 4); + + renderExtension -> data.composite_glyphs.src_id = GetULONG(buffer + 8, bigEndian); + renderExtension -> data.composite_glyphs.dst_id = GetULONG(buffer + 12, bigEndian); + + renderExtension -> data.composite_glyphs.format = GetULONG(buffer + 16, bigEndian); + renderExtension -> data.composite_glyphs.set_id = GetULONG(buffer + 20, bigEndian); + + renderExtension -> data.composite_glyphs.src_x = GetUINT(buffer + 24, bigEndian); + renderExtension -> data.composite_glyphs.src_y = GetUINT(buffer + 26, bigEndian); + + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + renderExtension -> data.composite_glyphs.num_elm = *(buffer + 28); + + renderExtension -> data.composite_glyphs.offset_x = GetUINT(buffer + 32, bigEndian); + renderExtension -> data.composite_glyphs.offset_y = GetUINT(buffer + 34, bigEndian); + } + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.composite_glyphs.type + << " size is " << renderExtension -> size_ << " identity size " + << renderExtension -> i_size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.composite_glyphs.type; + *(buffer + 4) = renderExtension -> data.composite_glyphs.op; + + PutULONG(renderExtension -> data.composite_glyphs.src_id, buffer + 8, bigEndian); + PutULONG(renderExtension -> data.composite_glyphs.dst_id, buffer + 12, bigEndian); + + PutULONG(renderExtension -> data.composite_glyphs.format, buffer + 16, bigEndian); + PutULONG(renderExtension -> data.composite_glyphs.set_id, buffer + 20, bigEndian); + + PutUINT(renderExtension -> data.composite_glyphs.src_x, buffer + 24, bigEndian); + PutUINT(renderExtension -> data.composite_glyphs.src_y, buffer + 26, bigEndian); + + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + *(buffer + 28) = renderExtension -> data.composite_glyphs.num_elm; + + PutUINT(renderExtension -> data.composite_glyphs.offset_x, buffer + 32, bigEndian); + PutUINT(renderExtension -> data.composite_glyphs.offset_y, buffer + 34, bigEndian); + } + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.composite_glyphs.type + << " size is " << renderExtension -> size_ << " identity size " + << renderExtension -> i_size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + // + // Include minor opcode, size and + // the composite operator in the + // identity. + // + + md5_append(md5_state, buffer + 1, 4); + + // + // Include the format. + // + + md5_append(md5_state, buffer + 16, 4); + + // + // Also include the length of the + // first string. + // + + // Since ProtoStep8 (#issue 108) + if (size >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + md5_append(md5_state, buffer + 28, 1); + } +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.composite_glyphs.src_id = + renderExtension -> data.composite_glyphs.src_id; + + encodeBuffer.encodeXidValue(renderExtension -> data.composite_glyphs.dst_id, + clientCache -> renderDstPictureCache); + + cachedRenderExtension -> data.composite_glyphs.dst_id = + renderExtension -> data.composite_glyphs.dst_id; + + encodeBuffer.encodeCachedValue(renderExtension -> data.composite_glyphs.set_id, 29, + clientCache -> renderGlyphSetCache); + + cachedRenderExtension -> data.composite_glyphs.set_id = + renderExtension -> data.composite_glyphs.set_id; + + // + // Src X and Y. + // + // The source X and Y coordinates are + // encoded as differerences in respect + // to the cached message. + // + + unsigned int value; + unsigned int previous; + + // Since ProtoStep8 (#issue 108) + value = renderExtension -> data.composite_glyphs.src_x; + previous = cachedRenderExtension -> data.composite_glyphs.src_x; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphXCache, 11); + + cachedRenderExtension -> data.composite_glyphs.src_x = value; + + value = renderExtension -> data.composite_glyphs.src_y; + previous = cachedRenderExtension -> data.composite_glyphs.src_y; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphYCache, 11); + + cachedRenderExtension -> data.composite_glyphs.src_y = value; + + #ifdef TEST + *logofs << name() << ": Encoded source X " + << renderExtension -> data.composite_glyphs.src_x << " source Y " + << renderExtension -> data.composite_glyphs.src_y << ".\n" + << logofs_flush; + #endif + + // Since ProtoStep8 (#issue 108) + if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + // + // Offset X and Y. + // + + if (renderExtension -> data.composite_glyphs.offset_x == + renderExtension -> data.composite_glyphs.src_x && + renderExtension -> data.composite_glyphs.offset_y == + renderExtension -> data.composite_glyphs.src_y) + { + encodeBuffer.encodeBoolValue(0); + + cachedRenderExtension -> data.composite_glyphs.offset_x = + renderExtension -> data.composite_glyphs.offset_x; + + cachedRenderExtension -> data.composite_glyphs.offset_y = + renderExtension -> data.composite_glyphs.offset_y; + + #ifdef TEST + *logofs << name() << ": Matched offset X " + << renderExtension -> data.composite_glyphs.offset_x << " offset Y " + << renderExtension -> data.composite_glyphs.offset_y << ".\n" + << logofs_flush; + #endif + } + else + { + encodeBuffer.encodeBoolValue(1); + + value = renderExtension -> data.composite_glyphs.offset_x; + previous = cachedRenderExtension -> data.composite_glyphs.offset_x; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphXCache, 11); + + cachedRenderExtension -> data.composite_glyphs.offset_x = value; + + value = renderExtension -> data.composite_glyphs.offset_y; + previous = cachedRenderExtension -> data.composite_glyphs.offset_y; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphYCache, 11); + + cachedRenderExtension -> data.composite_glyphs.offset_y = value; + + #ifdef TEST + *logofs << name() << ": Missed offset X " + << renderExtension -> data.composite_glyphs.offset_x << " offset Y " + << renderExtension -> data.composite_glyphs.offset_y << ".\n" + << logofs_flush; + #endif + } + } + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.composite_glyphs.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs.src_id, + clientCache -> renderSrcPictureCache); + + decodeBuffer.decodeXidValue(renderExtension -> data.composite_glyphs.dst_id, + clientCache -> renderDstPictureCache); + + decodeBuffer.decodeCachedValue(renderExtension -> data.composite_glyphs.set_id, 29, + clientCache -> renderGlyphSetCache); + + // + // Src X and Y. + // + + unsigned int value; + unsigned int previous; + + // Since ProtoStep8 (#issue 108) + previous = renderExtension -> data.composite_glyphs.src_x; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphXCache, 11); + + renderExtension -> data.composite_glyphs.src_x = value; + + previous = renderExtension -> data.composite_glyphs.src_y; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphYCache, 11); + + renderExtension -> data.composite_glyphs.src_y = value; + + // Since ProtoStep8 (#issue 108) + if (renderExtension -> size_ >= MESSAGE_OFFSET_IF_PROTO_STEP_8) + { + // + // Offset X and Y. + // + + decodeBuffer.decodeBoolValue(value); + + if (value == 0) + { + renderExtension -> data.composite_glyphs.offset_x = + renderExtension -> data.composite_glyphs.src_x; + + renderExtension -> data.composite_glyphs.offset_y = + renderExtension -> data.composite_glyphs.src_y; + } + else + { + previous = renderExtension -> data.composite_glyphs.offset_x; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphXCache, 11); + + renderExtension -> data.composite_glyphs.offset_x = value; + + previous = renderExtension -> data.composite_glyphs.offset_y; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderGlyphYCache, 11); + + renderExtension -> data.composite_glyphs.offset_y = value; + } + } + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.composite_glyphs.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderCompositeGlyphs.h b/nxcomp/src/RenderCompositeGlyphs.h new file mode 100644 index 000000000..1062ee781 --- /dev/null +++ b/nxcomp/src/RenderCompositeGlyphs.h @@ -0,0 +1,100 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderCompositeGlyphs_H +#define RenderCompositeGlyphs_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderCompositeGlyphs" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderCompositeGlyphsStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 28 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Encode the first 8 bytes of the +// data differentially in newer +// protocol versions. +// + +#undef MESSAGE_OFFSET_IF_PROTO_STEP_8 +#define MESSAGE_OFFSET_IF_PROTO_STEP_8 36 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + // Since ProtoStep8 (#issue 108) + unsigned int offset = MESSAGE_OFFSET_IF_PROTO_STEP_8; + + return (size >= offset ? offset : size); + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderCompositeGlyphs_H */ diff --git a/nxcomp/src/RenderCreateGlyphSet.cpp b/nxcomp/src/RenderCreateGlyphSet.cpp new file mode 100644 index 000000000..e3a842de9 --- /dev/null +++ b/nxcomp/src/RenderCreateGlyphSet.cpp @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderCreateGlyphSet.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderGlyphSetCache, + clientCache -> renderFreeGlyphSetCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 8, bigEndian), 32, + clientCache -> renderFormatCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeNewXidValue(value, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderGlyphSetCache, + clientCache -> renderFreeGlyphSetCache); + + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderFormatCache); + + PutULONG(value, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.create_set.type = *(buffer + 1); + + renderExtension -> data.create_set.set_id = GetULONG(buffer + 4, bigEndian); + renderExtension -> data.create_set.format = GetULONG(buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.create_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.create_set.type; + + PutULONG(renderExtension -> data.create_set.set_id, buffer + 4, bigEndian); + PutULONG(renderExtension -> data.create_set.format, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.create_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); + md5_append(md5_state, buffer + 8, 4); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeNewXidValue(renderExtension -> data.create_set.set_id, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderGlyphSetCache, + clientCache -> renderFreeGlyphSetCache); + + cachedRenderExtension -> data.create_set.set_id = + renderExtension -> data.create_set.set_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.create_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeNewXidValue(renderExtension -> data.create_set.set_id, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderGlyphSetCache, + clientCache -> renderFreeGlyphSetCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.create_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderCreateGlyphSet.h b/nxcomp/src/RenderCreateGlyphSet.h new file mode 100644 index 000000000..10f5d6699 --- /dev/null +++ b/nxcomp/src/RenderCreateGlyphSet.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderCreateGlyphSet_H +#define RenderCreateGlyphSet_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderCreateGlyphSet" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderCreateGlyphSetStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 12 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 0 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 0 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderCreateGlyphSet_H */ diff --git a/nxcomp/src/RenderCreatePicture.cpp b/nxcomp/src/RenderCreatePicture.cpp new file mode 100644 index 000000000..f3f9f8b8a --- /dev/null +++ b/nxcomp/src/RenderCreatePicture.cpp @@ -0,0 +1,278 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderCreatePicture.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeNewXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderSrcPictureCache, + clientCache -> renderFreePictureCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> drawableCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 12, bigEndian), 32, + clientCache -> renderFormatCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, + clientCache -> renderValueMaskCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeNewXidValue(value, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderSrcPictureCache, + clientCache -> renderFreePictureCache); + + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeXidValue(value, + clientCache -> drawableCache); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderFormatCache); + + PutULONG(value, buffer + 12, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderValueMaskCache); + + PutULONG(value, buffer + 16, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.create_picture.type = *(buffer + 1); + + renderExtension -> data.create_picture.src_id = GetULONG(buffer + 4, bigEndian); + renderExtension -> data.create_picture.dst_id = GetULONG(buffer + 8, bigEndian); + + renderExtension -> data.create_picture.format = GetULONG(buffer + 12, bigEndian); + renderExtension -> data.create_picture.mask = GetULONG(buffer + 16, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.create_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.create_picture.type; + + PutULONG(renderExtension -> data.create_picture.src_id, buffer + 4, bigEndian); + PutULONG(renderExtension -> data.create_picture.dst_id, buffer + 8, bigEndian); + + PutULONG(renderExtension -> data.create_picture.format, buffer + 12, bigEndian); + PutULONG(renderExtension -> data.create_picture.mask, buffer + 16, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.create_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); + md5_append(md5_state, buffer + 12, 8); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding new id value " + << renderExtension -> data.create_picture.src_id + << ".\n"; + #endif + + encodeBuffer.encodeNewXidValue(renderExtension -> data.create_picture.src_id, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderSrcPictureCache, + clientCache -> renderFreePictureCache); + + cachedRenderExtension -> data.create_picture.src_id = + renderExtension -> data.create_picture.src_id; + + encodeBuffer.encodeXidValue(renderExtension -> data.create_picture.dst_id, + clientCache -> drawableCache); + + cachedRenderExtension -> data.create_picture.dst_id = + renderExtension -> data.create_picture.dst_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.create_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeNewXidValue(renderExtension -> data.create_picture.src_id, + clientCache -> lastId, clientCache -> lastIdCache, + clientCache -> renderSrcPictureCache, + clientCache -> renderFreePictureCache); + + decodeBuffer.decodeXidValue(renderExtension -> data.create_picture.dst_id, + clientCache -> drawableCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.create_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderCreatePicture.h b/nxcomp/src/RenderCreatePicture.h new file mode 100644 index 000000000..ae2f583a0 --- /dev/null +++ b/nxcomp/src/RenderCreatePicture.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderCreatePicture_H +#define RenderCreatePicture_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderCreatePicture" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderCreatePictureStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 20 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderCreatePicture_H */ diff --git a/nxcomp/src/RenderExtension.cpp b/nxcomp/src/RenderExtension.cpp new file mode 100644 index 000000000..64761bc05 --- /dev/null +++ b/nxcomp/src/RenderExtension.cpp @@ -0,0 +1,427 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "NXrender.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +#include "RenderExtension.h" + +#include "RenderGenericRequest.h" +#include "RenderCreatePicture.h" +#include "RenderChangePicture.h" +#include "RenderFreePicture.h" +#include "RenderPictureClip.h" +#include "RenderPictureTransform.h" +#include "RenderPictureFilter.h" +#include "RenderCreateGlyphSet.h" +#include "RenderFreeGlyphSet.h" +#include "RenderAddGlyphs.h" +#include "RenderComposite.h" +#include "RenderCompositeGlyphs.h" +#include "RenderFillRectangles.h" +#include "RenderTrapezoids.h" +#include "RenderTriangles.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Constructor and destructor. +// + +RenderExtensionStore::RenderExtensionStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = RENDEREXTENSION_ENABLE_CACHE; + enableData = RENDEREXTENSION_ENABLE_DATA; + enableSplit = RENDEREXTENSION_ENABLE_SPLIT; + enableCompress = RENDEREXTENSION_ENABLE_COMPRESS; + + generic_ = new RenderGenericRequestStore(); + + for (int i = 0; i < RENDEREXTENSION_MINOR_OPCODE_LIMIT; i++) + { + minors_[i] = generic_; + } + + minors_[X_RenderChangePicture] = new RenderChangePictureStore(); + minors_[X_RenderFillRectangles] = new RenderFillRectanglesStore(); + minors_[X_RenderAddGlyphs] = new RenderAddGlyphsStore(); + + // Since ProtoStep7 (#issue 108) + minors_[X_RenderCreatePicture] = new RenderCreatePictureStore(); + minors_[X_RenderFreePicture] = new RenderFreePictureStore(); + minors_[X_RenderSetPictureClipRectangles] = new RenderPictureClipStore(); + minors_[X_RenderCreateGlyphSet] = new RenderCreateGlyphSetStore(); + minors_[X_RenderComposite] = new RenderCompositeStore(); + minors_[X_RenderCompositeGlyphs8] = new RenderCompositeGlyphsStore(); + minors_[X_RenderCompositeGlyphs16] = new RenderCompositeGlyphsStore(); + minors_[X_RenderCompositeGlyphs32] = new RenderCompositeGlyphsStore(); + + minors_[X_RenderSetPictureTransform] = new RenderPictureTransformStore(); + minors_[X_RenderSetPictureFilter] = new RenderPictureFilterStore(); + minors_[X_RenderFreeGlyphSet] = new RenderFreeGlyphSetStore(); + minors_[X_RenderTrapezoids] = new RenderTrapezoidsStore(); + minors_[X_RenderTriangles] = new RenderTrianglesStore(); + + dataLimit = RENDEREXTENSION_DATA_LIMIT; + dataOffset = RENDEREXTENSION_DATA_OFFSET; + + // Since ProtoStep7 (#issue 108) + cacheSlots = RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7; + + cacheThreshold = RENDEREXTENSION_CACHE_THRESHOLD; + cacheLowerThreshold = RENDEREXTENSION_CACHE_LOWER_THRESHOLD; + + opcode_ = X_NXInternalRenderExtension; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +RenderExtensionStore::~RenderExtensionStore() +{ + for (int i = 0; i < RENDEREXTENSION_MINOR_OPCODE_LIMIT; i++) + { + if (minors_[i] != generic_) + { + delete minors_[i]; + } + } + + delete generic_; + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +int RenderExtensionStore::validateMessage(const unsigned char *buffer, int size) +{ + #ifdef TEST + *logofs << name() << ": Encoding message OPCODE#" + << (unsigned) *buffer << " MINOR#" << (unsigned) + *(buffer + 1) << " with size " << size + << ".\n" << logofs_flush; + #endif + + return (size >= control -> MinimumMessageSize && + size <= control -> MaximumMessageSize); +} + +// +// Here are the methods to handle the messages' content. +// + +int RenderExtensionStore::identitySize(const unsigned char *buffer, unsigned int size) +{ + return minors_[*(buffer + 1)] -> identitySize(buffer, size); +} + +int RenderExtensionStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + encodeBuffer.encodeOpcodeValue(*(buffer + 1), + ((ClientCache *) channelCache) -> renderOpcodeCache); + + minors_[*(buffer + 1)] -> encodeMessage(encodeBuffer, buffer, size, + bigEndian, channelCache); + + return 1; +} + +int RenderExtensionStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + unsigned char type; + + decodeBuffer.decodeOpcodeValue(type, + ((ClientCache *) channelCache) -> renderOpcodeCache); + + minors_[type] -> decodeMessage(decodeBuffer, buffer, size, type, + bigEndian, writeBuffer, channelCache); + + return 1; +} + +int RenderExtensionStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + return minors_[*(buffer + 1)] -> parseIdentity(message, buffer, size, bigEndian); +} + +int RenderExtensionStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + return minors_[((RenderExtensionMessage *) message) -> data.any.type] -> + unparseIdentity(message, buffer, size, bigEndian); +} + +void RenderExtensionStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + minors_[*(buffer + 1)] -> identityChecksum(message, buffer, size, md5_state_, bigEndian); +} + +void RenderExtensionStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + minors_[((RenderExtensionMessage *) message) -> data.any.type] -> + updateIdentity(encodeBuffer, message, cachedMessage, channelCache); +} + +void RenderExtensionStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + minors_[((RenderExtensionMessage *) message) -> data.any.type] -> + updateIdentity(decodeBuffer, message, channelCache); +} + +void RenderExtensionStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + #ifdef WARNING + *logofs << name() << ": WARNING! Dump of identity not implemented.\n" + << logofs_flush; + #endif + + #endif +} + +// +// TODO: The following encoding and decoding functions +// could be generalized further, for example by passing +// the pointer to the data cache, the number of caches +// made available by the caller and the first cache to +// iterate through. +// + +void RenderMinorExtensionStore::encodeLongData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeLongData(buffer + offset, size - offset); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - offset + << " bytes of long data.\n" << logofs_flush; + #endif +} + +void RenderMinorExtensionStore::encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeIntData(buffer + offset, size - offset); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - offset + << " bytes of int data.\n" << logofs_flush; + #endif +} + +void RenderMinorExtensionStore::encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(buffer + offset, size - offset); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - offset + << " bytes of text data.\n" << logofs_flush; + #endif +} + +void RenderMinorExtensionStore::decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeLongData(buffer + offset, size - offset); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - offset + << " bytes of long data.\n" << logofs_flush; + #endif +} + +void RenderMinorExtensionStore::decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeIntData(buffer + offset, size - offset); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - offset + << " bytes of int data.\n" << logofs_flush; + #endif +} + +void RenderMinorExtensionStore::decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(buffer + offset, size - offset); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - offset + << " bytes of text data.\n" << logofs_flush; + #endif +} + +void RenderMinorExtensionStore::parseIntData(const Message *message, const unsigned char *buffer, + unsigned int offset, unsigned int size, + int bigEndian) const +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); + + for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) + { + #ifdef DEBUG + *logofs << name() << ": Parsing int with i = " << i << " c = " + << c << ".\n" << logofs_flush; + #endif + + renderExtension -> data.any.short_data[c] = GetUINT(buffer + i, bigEndian); + + if (++c == 16) c = 0; + } +} + +void RenderMinorExtensionStore::unparseIntData(const Message *message, unsigned char *buffer, + unsigned int offset, unsigned int size, + int bigEndian) const +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); + + for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) + { + #ifdef DEBUG + *logofs << name() << ": Unparsing int with i = " << i << " c = " + << c << ".\n" << logofs_flush; + #endif + + PutUINT(renderExtension -> data.any.short_data[c], buffer + i, bigEndian); + + if (++c == 16) c = 0; + } +} + +void RenderMinorExtensionStore::updateIntData(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, unsigned int offset, + unsigned int size, ChannelCache *channelCache) const +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); + + for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) + { + #ifdef DEBUG + *logofs << name() << ": Encoding int update with i = " << i + << " c = " << c << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(renderExtension -> data.any.short_data[c], 16, + *clientCache -> renderDataCache[c]); + + cachedRenderExtension -> data.any.short_data[c] = + renderExtension -> data.any.short_data[c]; + + if (++c == 16) c = 0; + } +} + +void RenderMinorExtensionStore::updateIntData(DecodeBuffer &decodeBuffer, const Message *message, + unsigned int offset, unsigned int size, + ChannelCache *channelCache) const +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int last = ((unsigned) message -> i_size_ > size ? size : message -> i_size_); + + unsigned int value; + + for (unsigned int i = offset, c = (offset - 4) % 16; i < last; i += 2) + { + #ifdef DEBUG + *logofs << name() << ": Decoding int update with i = " << i + << " c = " << c << ".\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> renderDataCache[c]); + + renderExtension -> data.any.short_data[c] = value; + + if (++c == 16) c = 0; + } +} diff --git a/nxcomp/src/RenderExtension.h b/nxcomp/src/RenderExtension.h new file mode 100644 index 000000000..aa9db1b55 --- /dev/null +++ b/nxcomp/src/RenderExtension.h @@ -0,0 +1,504 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderExtension_H +#define RenderExtension_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Compression of data part is not enabled as +// most messages of this type are smaller than +// the current data size compression threshold. +// + +#define RENDEREXTENSION_ENABLE_CACHE 1 +#define RENDEREXTENSION_ENABLE_DATA 0 +#define RENDEREXTENSION_ENABLE_SPLIT 0 +#define RENDEREXTENSION_ENABLE_COMPRESS 0 + +#define RENDEREXTENSION_DATA_LIMIT 6144 +#define RENDEREXTENSION_DATA_OFFSET 36 + +#define RENDEREXTENSION_CACHE_THRESHOLD 20 +#define RENDEREXTENSION_CACHE_LOWER_THRESHOLD 10 + +#define RENDEREXTENSION_CACHE_SLOTS_IF_PROTO_STEP_7 8000 + +// +// Used to build the table of minor opcodes. +// + +#define RENDEREXTENSION_MINOR_OPCODE_LIMIT 256 + +// +// The message class. +// + +class RenderMinorExtensionStore; + +class RenderExtensionMessage : public Message +{ + friend class RenderExtensionStore; + friend class RenderMinorExtensionStore; + + friend class RenderGenericRequestStore; + friend class RenderCreatePictureStore; + friend class RenderChangePictureStore; + friend class RenderFreePictureStore; + friend class RenderPictureClipStore; + friend class RenderPictureTransformStore; + friend class RenderPictureFilterStore; + friend class RenderCreateGlyphSetStore; + friend class RenderFreeGlyphSetStore; + friend class RenderAddGlyphsStore; + friend class RenderCompositeStore; + friend class RenderCompositeGlyphsStore; + friend class RenderFillRectanglesStore; + friend class RenderTrapezoidsStore; + friend class RenderTrianglesStore; + + public: + + RenderExtensionMessage() + { + } + + ~RenderExtensionMessage() + { + } + + // + // We consider for this message a data offset of 36, + // that is size of the biggest among all requests of + // this extension. The most common requests have a + // specific differential encoding, others are simply + // encoded through an array of int or char caches. + // + + private: + + union + { + struct + { + unsigned char type; + + unsigned char char_data[32]; + unsigned short short_data[16]; + unsigned short long_data[8]; + } + any; + + struct + { + unsigned char type; + + unsigned int src_id; + unsigned int dst_id; + + unsigned int format; + unsigned int mask; + } + create_picture; + + struct + { + unsigned char type; + + unsigned int src_id; + } + change_picture; + + struct + { + unsigned char type; + + unsigned int src_id; + } + free_picture; + + struct + { + unsigned char type; + + unsigned int src_id; + + unsigned short src_x; + unsigned short src_y; + } + picture_clip; + + struct + { + unsigned char type; + + unsigned int src_id; + } + picture_transform; + + struct + { + unsigned char type; + + unsigned int src_id; + unsigned int num_elm; + } + picture_filter; + + struct + { + unsigned char type; + + unsigned int set_id; + unsigned int format; + } + create_set; + + struct + { + unsigned char type; + + unsigned int set_id; + } + free_set; + + struct + { + unsigned char type; + + unsigned int set_id; + unsigned int num_elm; + } + add_glyphs; + + struct + { + unsigned char type; + + unsigned char op; + + unsigned int src_id; + unsigned int msk_id; + unsigned int dst_id; + + unsigned short src_x; + unsigned short src_y; + + unsigned short msk_x; + unsigned short msk_y; + + unsigned short dst_x; + unsigned short dst_y; + + unsigned short width; + unsigned short height; + } + composite; + + struct + { + unsigned char type; + + unsigned char op; + + unsigned char num_elm; + + unsigned int src_id; + unsigned int dst_id; + + unsigned int format; + unsigned int set_id; + + unsigned short src_x; + unsigned short src_y; + + unsigned short offset_x; + unsigned short offset_y; + } + composite_glyphs; + + struct + { + unsigned char type; + + unsigned char op; + + unsigned int dst_id; + } + fill_rectangles; + + struct + { + unsigned char type; + + unsigned char op; + + unsigned int src_id; + unsigned int dst_id; + + unsigned int format; + + unsigned short src_x; + unsigned short src_y; + } + trapezoids; + + struct + { + unsigned char type; + + unsigned char op; + + unsigned int src_id; + unsigned int dst_id; + + unsigned int format; + + unsigned short src_x; + unsigned short src_y; + } + triangles; + + struct + { + unsigned char type; + + unsigned char op; + + unsigned char num_elm; + + unsigned int src_id; + unsigned int dst_id; + + unsigned int format; + unsigned int set_id; + + unsigned short src_x; + unsigned short src_y; + + unsigned short delta_x; + unsigned short delta_y; + } + composite_glyphs_compat; + + } + data; +}; + +class RenderExtensionStore : public MessageStore +{ + public: + + RenderExtensionStore(StaticCompressor *compressor); + + virtual ~RenderExtensionStore(); + + virtual const char *name() const + { + return "RenderExtension"; + } + + virtual unsigned char opcode() const + { + return opcode_; + } + + virtual unsigned int storage() const + { + return sizeof(RenderExtensionMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new RenderExtensionMessage(); + } + + virtual Message *create(const Message &message) const + { + return new RenderExtensionMessage((const RenderExtensionMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (RenderExtensionMessage *) message; + } + + // + // Determine if the message must be stored + // in the cache. + // + + virtual int validateMessage(const unsigned char *buffer, int size); + + // + // Since protocol step 5 these methods are + // specialized in their minor opcode stores. + // + + virtual int identitySize(const unsigned char *buffer, unsigned int size); + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; + + private: + + unsigned char opcode_; + + // + // Keep pointers to specialized classes. + // + + RenderMinorExtensionStore *minors_[RENDEREXTENSION_MINOR_OPCODE_LIMIT]; + + RenderMinorExtensionStore *generic_; +}; + +class RenderMinorExtensionStore : public MinorMessageStore +{ + public: + + virtual const char *name() const = 0; + + virtual int identitySize(const unsigned char *buffer, unsigned int size) = 0; + + virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const = 0; + + virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, unsigned char type, int bigEndian, + WriteBuffer *writeBuffer, ChannelCache *channelCache) const = 0; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const = 0; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const = 0; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const = 0; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, md5_state_t *md5_state, + int bigEndian) const = 0; + + // + // Internal encode and decode utilities. + // + + protected: + + void encodeLongData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + void encodeIntData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + void encodeCharData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + void decodeLongData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + void decodeIntData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + void decodeCharData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int offset, unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + /* + * The following methods are only used in the + * encoding of the generic render request. To + * be removed in future. + */ + + void parseIntData(const Message *message, const unsigned char *buffer, + unsigned int offset, unsigned int size, + int bigEndian) const; + + void unparseIntData(const Message *message, unsigned char *buffer, + unsigned int offset, unsigned int size, + int bigEndian) const; + + void updateIntData(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, unsigned int offset, + unsigned int size, ChannelCache *channelCache) const; + + void updateIntData(DecodeBuffer &decodeBuffer, const Message *message, + unsigned int offset, unsigned int size, + ChannelCache *channelCache) const; +}; + +#endif /* RenderExtension_H */ diff --git a/nxcomp/src/RenderFillRectangles.cpp b/nxcomp/src/RenderFillRectangles.cpp new file mode 100644 index 000000000..db05887ab --- /dev/null +++ b/nxcomp/src/RenderFillRectangles.cpp @@ -0,0 +1,237 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderFillRectangles.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + // + // The color structure (4 components, 2 bytes + // each) is included in the data part, so that + // it gets into the checksum. The rectangles + // are in the format x, y, width, height with + // 2 bytes per each field, so each request is + // at least 12 + 8 + 8 = 28 bytes long. + // + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + decodeBuffer.decodeXidValue(value, clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.fill_rectangles.type = *(buffer + 1); + renderExtension -> data.fill_rectangles.op = *(buffer + 4); + + renderExtension -> data.fill_rectangles.dst_id = GetULONG(buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.fill_rectangles.type << " size is " + << renderExtension -> size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.fill_rectangles.type; + *(buffer + 4) = renderExtension -> data.fill_rectangles.op; + + PutULONG(renderExtension -> data.fill_rectangles.dst_id, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.fill_rectangles.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 4); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.fill_rectangles.dst_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.fill_rectangles.dst_id = + renderExtension -> data.fill_rectangles.dst_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.fill_rectangles.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.fill_rectangles.dst_id, + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.fill_rectangles.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderFillRectangles.h b/nxcomp/src/RenderFillRectangles.h new file mode 100644 index 000000000..9efaeffa8 --- /dev/null +++ b/nxcomp/src/RenderFillRectangles.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderFillRectangles_H +#define RenderFillRectangles_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderFillRectangles" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderFillRectanglesStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 12 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderFillRectangles_H */ diff --git a/nxcomp/src/RenderFreeGlyphSet.cpp b/nxcomp/src/RenderFreeGlyphSet.cpp new file mode 100644 index 000000000..88dfb791a --- /dev/null +++ b/nxcomp/src/RenderFreeGlyphSet.cpp @@ -0,0 +1,166 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderFreeGlyphSet.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeFreeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> renderFreeGlyphSetCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + unsigned int value; + + ClientCache *clientCache = (ClientCache *) channelCache; + + *(buffer + 1) = type; + + decodeBuffer.decodeFreeXidValue(value, + clientCache -> renderFreeGlyphSetCache); + + PutULONG(value, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.free_set.type = *(buffer + 1); + + renderExtension -> data.free_set.set_id = GetULONG(buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.free_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.free_set.type; + + PutULONG(renderExtension -> data.free_set.set_id, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.free_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeFreeXidValue(renderExtension -> data.free_set.set_id, + clientCache -> renderFreeGlyphSetCache); + + cachedRenderExtension -> data.free_set.set_id = + renderExtension -> data.free_set.set_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.free_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeFreeXidValue(renderExtension -> data.free_set.set_id, + clientCache -> renderFreeGlyphSetCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.free_set.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderFreeGlyphSet.h b/nxcomp/src/RenderFreeGlyphSet.h new file mode 100644 index 000000000..8817e8d99 --- /dev/null +++ b/nxcomp/src/RenderFreeGlyphSet.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderFreeGlyphSet_H +#define RenderFreeGlyphSet_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderFreeGlyphSet" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderFreeGlyphSetStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 8 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 0 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 0 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderFreeGlyphSet_H */ diff --git a/nxcomp/src/RenderFreePicture.cpp b/nxcomp/src/RenderFreePicture.cpp new file mode 100644 index 000000000..31662a7e2 --- /dev/null +++ b/nxcomp/src/RenderFreePicture.cpp @@ -0,0 +1,166 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderFreePicture.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeFreeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> renderFreePictureCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + unsigned int value; + + ClientCache *clientCache = (ClientCache *) channelCache; + + *(buffer + 1) = type; + + decodeBuffer.decodeFreeXidValue(value, + clientCache -> renderFreePictureCache); + + PutULONG(value, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.free_picture.type = *(buffer + 1); + + renderExtension -> data.free_picture.src_id = GetULONG(buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.free_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.free_picture.type; + + PutULONG(renderExtension -> data.free_picture.src_id, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.free_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeFreeXidValue(renderExtension -> data.free_picture.src_id, + clientCache -> renderFreePictureCache); + + cachedRenderExtension -> data.free_picture.src_id = + renderExtension -> data.free_picture.src_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.free_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeFreeXidValue(renderExtension -> data.free_picture.src_id, + clientCache -> renderFreePictureCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.free_picture.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderFreePicture.h b/nxcomp/src/RenderFreePicture.h new file mode 100644 index 000000000..b50191a72 --- /dev/null +++ b/nxcomp/src/RenderFreePicture.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderFreePicture_H +#define RenderFreePicture_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderFreePicture" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderFreePictureStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 8 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 0 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 0 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderFreePicture_H */ diff --git a/nxcomp/src/RenderGenericRequest.cpp b/nxcomp/src/RenderGenericRequest.cpp new file mode 100644 index 000000000..cff34e61e --- /dev/null +++ b/nxcomp/src/RenderGenericRequest.cpp @@ -0,0 +1,270 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "NXrender.h" + +#include "RenderExtension.h" +#include "RenderGenericRequest.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Here are the methods to handle the messages' content. +// + +int RenderGenericRequestStore::encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message.\n" + << logofs_flush; + + unsigned char type = *(buffer + 1); + + #endif + + encodeBuffer.encodeCachedValue(size >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef DEBUG + *logofs << name() << ": Encoding full unhandled message. " + << "Type is " << (unsigned int) type << " size is " + << size << ".\n" << logofs_flush; + #endif + + encodeIntData(encodeBuffer, buffer, 4, size, + bigEndian, clientCache); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message.\n" + << logofs_flush; + #endif + + return 1; +} + +int RenderGenericRequestStore::decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, unsigned char type, int bigEndian, + WriteBuffer *writeBuffer, ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message.\n" + << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + size <<= 2; + + buffer = writeBuffer -> addMessage(size); + + *(buffer + 1) = type; + + #ifdef DEBUG + *logofs << name() << ": Decoding full unhandled message. " + << "Type is " << (unsigned int) type << " size is " + << size << ".\n" << logofs_flush; + #endif + + decodeIntData(decodeBuffer, buffer, 4, size, + bigEndian, clientCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded full message.\n" + << logofs_flush; + #endif + + return 1; +} + +void RenderGenericRequestStore::encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ +} + +void RenderGenericRequestStore::decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ +} + +int RenderGenericRequestStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + #ifdef DEBUG + *logofs << name() << ": Parsing identity for message at " + << this << ".\n" << logofs_flush; + #endif + + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + unsigned char type = *(buffer + 1); + + renderExtension -> data.any.type = type; + + #ifdef DEBUG + *logofs << name() << ": Parsing unhandled identity. " + << "Type is " << (unsigned int) renderExtension -> data.any.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif + + parseIntData(message, buffer, 4, size, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int RenderGenericRequestStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + #ifdef DEBUG + *logofs << name() << ": Unparsing identity for message at " + << this << ".\n" << logofs_flush; + #endif + + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + unsigned char type = renderExtension -> data.any.type; + + *(buffer + 1) = type; + + #ifdef DEBUG + *logofs << name() << ": Unparsing unhandled identity. " + << "Type is " << (unsigned int) renderExtension -> data.any.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif + + unparseIntData(message, buffer, 4, size, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void RenderGenericRequestStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, md5_state_t *md5_state, + int bigEndian) const +{ + // + // Include the minor opcode in the checksum. + // Because the data offset can be beyond the + // real end of the message, we need to include + // the size or we will match any message whose + // size is less or equal to the data offset. + // + + md5_append(md5_state, buffer + 1, 3); +} + +void RenderGenericRequestStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + #ifdef DEBUG + *logofs << name() << ": Updating identity for message at " + << this << ".\n" << logofs_flush; + #endif + + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + #ifdef DEBUG + *logofs << name() << ": Encoding unhandled update. " + << "Type is " << (unsigned int) renderExtension -> data.any.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif + + updateIntData(encodeBuffer, message, cachedMessage, 4, + renderExtension -> size_, channelCache); + + #ifdef DEBUG + *logofs << name() << ": Updated identity for message at " + << this << ".\n" << logofs_flush; + #endif +} + +void RenderGenericRequestStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + #ifdef DEBUG + *logofs << name() << ": Updating identity for message at " + << this << ".\n" << logofs_flush; + #endif + + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + #ifdef DEBUG + *logofs << name() << ": Decoding unhandled update. " + << "Type is " << (unsigned int) renderExtension -> data.any.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif + + updateIntData(decodeBuffer, message, 4, + renderExtension -> size_, channelCache); + + #ifdef DEBUG + *logofs << name() << ": Updated identity for message at " + << this << ".\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/RenderGenericRequest.h b/nxcomp/src/RenderGenericRequest.h new file mode 100644 index 000000000..fdf5ca876 --- /dev/null +++ b/nxcomp/src/RenderGenericRequest.h @@ -0,0 +1,89 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderGenericRequest_H +#define RenderGenericRequest_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +class RenderGenericRequestStore : public RenderMinorExtensionStore +{ + public: + + virtual const char *name() const + { + return "RenderGenericRequest"; + } + + virtual int identitySize(const unsigned char *buffer, unsigned int size) + { + return RENDEREXTENSION_DATA_OFFSET; + } + + virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, unsigned char type, int bigEndian, + WriteBuffer *writeBuffer, ChannelCache *channelCache) const; + + virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, md5_state_t *md5_state, + int bigEndian) const; +}; + +#endif /* RenderGenericRequest_H */ diff --git a/nxcomp/src/RenderMinorExtensionHeaders.h b/nxcomp/src/RenderMinorExtensionHeaders.h new file mode 100644 index 000000000..b7f6efc5a --- /dev/null +++ b/nxcomp/src/RenderMinorExtensionHeaders.h @@ -0,0 +1,42 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderMinorExtensionHeaders_H +#define RenderMinorExtensionHeaders_H + +#include "NXrender.h" + +#include "Message.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +#include "RenderExtension.h" + +#endif /* RenderMinorExtensionHeaders_H */ diff --git a/nxcomp/src/RenderMinorExtensionMethods.h b/nxcomp/src/RenderMinorExtensionMethods.h new file mode 100644 index 000000000..d272337e0 --- /dev/null +++ b/nxcomp/src/RenderMinorExtensionMethods.h @@ -0,0 +1,81 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +// +// This file is included multiple times, +// one for each message inheriting the +// parent class. +// + +public: + +#if MESSAGE_HAS_SIZE + +virtual void encodeSize(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + +virtual void decodeSize(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, unsigned char type, int bigEndian, + WriteBuffer *writeBuffer, ChannelCache *channelCache) const; + +#endif + +#if MESSAGE_HAS_DATA + +virtual void encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + +virtual void decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, + unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + +#endif + +virtual int encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + +virtual int decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, unsigned char type, int bigEndian, + WriteBuffer *writeBuffer, ChannelCache *channelCache) const; + +virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + +virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + +virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + +virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + +virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, md5_state_t *md5_state, + int bigEndian) const; diff --git a/nxcomp/src/RenderMinorExtensionTags.h b/nxcomp/src/RenderMinorExtensionTags.h new file mode 100644 index 000000000..c24a99638 --- /dev/null +++ b/nxcomp/src/RenderMinorExtensionTags.h @@ -0,0 +1,194 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderMinorExtensionTags_H +#define RenderMinorExtensionTags_H + +// +// Set in the message header file. +// + +#if MESSAGE_HAS_SIZE + +#define MESSAGE_ENCODE_SIZE encodeSize(encodeBuffer, buffer, size, bigEndian, channelCache) +#define MESSAGE_DECODE_SIZE decodeSize(decodeBuffer, buffer, size, type, bigEndian, writeBuffer, channelCache) + +#else + +#define MESSAGE_ENCODE_SIZE +#define MESSAGE_DECODE_SIZE size = MESSAGE_OFFSET; buffer = writeBuffer -> addMessage(size); + +#endif + +#if MESSAGE_HAS_DATA + +#define MESSAGE_ENCODE_DATA encodeData(encodeBuffer, buffer, size, bigEndian, channelCache) +#define MESSAGE_DECODE_DATA decodeData(decodeBuffer, buffer, size, bigEndian, channelCache) + +#else + +#define MESSAGE_ENCODE_DATA +#define MESSAGE_DECODE_DATA + +#endif + +// +// Prologue an epilogue of the message +// handling functions. +// + +#define MESSAGE_BEGIN_ENCODE_SIZE \ +\ +void MESSAGE_STORE::encodeSize(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ + const unsigned int size, int bigEndian, \ + ChannelCache *channelCache) const \ +{ + +#define MESSAGE_END_ENCODE_SIZE \ +\ +} + +#define MESSAGE_BEGIN_DECODE_SIZE \ +\ +void MESSAGE_STORE::decodeSize(DecodeBuffer &decodeBuffer, unsigned char *&buffer, \ + unsigned int &size, unsigned char type, int bigEndian, \ + WriteBuffer *writeBuffer, ChannelCache *channelCache) const \ +{ + +#define MESSAGE_END_DECODE_SIZE \ +\ +} + +#define MESSAGE_BEGIN_ENCODE_MESSAGE \ +\ +int MESSAGE_STORE::encodeMessage(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ + const unsigned int size, int bigEndian, \ + ChannelCache *channelCache) const \ +{ \ + MESSAGE_ENCODE_SIZE; + + +#define MESSAGE_END_ENCODE_MESSAGE \ +\ + MESSAGE_ENCODE_DATA; \ +\ + return 1; \ +} + +#define MESSAGE_BEGIN_DECODE_MESSAGE \ +\ +int MESSAGE_STORE::decodeMessage(DecodeBuffer &decodeBuffer, unsigned char *&buffer, \ + unsigned int &size, unsigned char type, int bigEndian, \ + WriteBuffer *writeBuffer, ChannelCache *channelCache) const \ +{ \ + MESSAGE_DECODE_SIZE; + + +#define MESSAGE_END_DECODE_MESSAGE \ +\ + MESSAGE_DECODE_DATA; \ +\ + return 1; \ +} + +#define MESSAGE_BEGIN_ENCODE_DATA \ +\ +void MESSAGE_STORE::encodeData(EncodeBuffer &encodeBuffer, const unsigned char *buffer, \ + unsigned int size, int bigEndian, \ + ChannelCache *channelCache) const \ +{ + +#define MESSAGE_END_ENCODE_DATA \ +\ +} + +#define MESSAGE_BEGIN_DECODE_DATA \ +\ +void MESSAGE_STORE::decodeData(DecodeBuffer &decodeBuffer, unsigned char *buffer, \ + unsigned int size, int bigEndian, \ + ChannelCache *channelCache) const \ +{ + +#define MESSAGE_END_DECODE_DATA \ +\ +} + +#define MESSAGE_BEGIN_PARSE_IDENTITY \ +\ +int MESSAGE_STORE::parseIdentity(Message *message, const unsigned char *buffer, \ + unsigned int size, int bigEndian) const \ +{ + +#define MESSAGE_END_PARSE_IDENTITY \ +\ + return 1; \ +\ +} + +#define MESSAGE_BEGIN_UNPARSE_IDENTITY \ +\ +int MESSAGE_STORE::unparseIdentity(const Message *message, unsigned char *buffer, \ + unsigned int size, int bigEndian) const \ +{ + +#define MESSAGE_END_UNPARSE_IDENTITY \ +\ + return 1; \ +\ +} + +#define MESSAGE_BEGIN_IDENTITY_CHECKSUM \ +\ +void MESSAGE_STORE::identityChecksum(const Message *message, const unsigned char *buffer, \ + unsigned int size, md5_state_t *md5_state, \ + int bigEndian) const \ +{ + +#define MESSAGE_END_IDENTITY_CHECKSUM \ +\ +} + +#define MESSAGE_BEGIN_ENCODE_UPDATE \ +\ +void MESSAGE_STORE::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, \ + const Message *cachedMessage, \ + ChannelCache *channelCache) const \ +{ + +#define MESSAGE_END_ENCODE_UPDATE \ +\ +} + +#define MESSAGE_BEGIN_DECODE_UPDATE \ +\ +void MESSAGE_STORE::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, \ + ChannelCache *channelCache) const \ +{ + +#define MESSAGE_END_DECODE_UPDATE \ +\ +} + +#endif /* RenderMinorExtensionTags_H */ diff --git a/nxcomp/src/RenderPictureClip.cpp b/nxcomp/src/RenderPictureClip.cpp new file mode 100644 index 000000000..0d6b505eb --- /dev/null +++ b/nxcomp/src/RenderPictureClip.cpp @@ -0,0 +1,303 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderPictureClip.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + // + // The data is constituted by a number of + // rectangles. Each rectangle is in the + // format x, y, width, height with 2 bytes + // per each field, so each request is at + // least 12 + 8 = 20 bytes long. + // + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> renderSrcPictureCache); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 8, bigEndian), + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 10, bigEndian), + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeXidValue(value, + clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + PutUINT(clientCache -> renderLastX, buffer + 8, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + PutUINT(clientCache -> renderLastY, buffer + 10, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + encodeIntData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeIntData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.picture_clip.type = *(buffer + 1); + + renderExtension -> data.picture_clip.src_id = GetULONG(buffer + 4, bigEndian); + + renderExtension -> data.picture_clip.src_x = GetUINT(buffer + 8, bigEndian); + renderExtension -> data.picture_clip.src_y = GetUINT(buffer + 10, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.picture_clip.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.picture_clip.type; + + PutULONG(renderExtension -> data.picture_clip.src_id, buffer + 4, bigEndian); + + PutUINT(renderExtension -> data.picture_clip.src_x, buffer + 8, bigEndian); + PutUINT(renderExtension -> data.picture_clip.src_y, buffer + 10, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.picture_clip.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + // + // Encode the picture id and the + // source x and y differentially. + // + + md5_append(md5_state, buffer + 1, 3); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.picture_clip.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.picture_clip.src_id = + renderExtension -> data.picture_clip.src_id; + + // + // The source x and y coordinates are + // encoded as differerences in respect + // to the previous cached value. + // + + unsigned int value; + unsigned int previous; + + value = renderExtension -> data.picture_clip.src_x; + previous = cachedRenderExtension -> data.picture_clip.src_x; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + cachedRenderExtension -> data.picture_clip.src_x = value; + + value = renderExtension -> data.picture_clip.src_y; + previous = cachedRenderExtension -> data.picture_clip.src_y; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + cachedRenderExtension -> data.picture_clip.src_y = value; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.picture_clip.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.picture_clip.src_id, + clientCache -> renderSrcPictureCache); + + unsigned int value; + unsigned int previous; + + previous = renderExtension -> data.picture_clip.src_x; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + renderExtension -> data.picture_clip.src_x = value; + + previous = renderExtension -> data.picture_clip.src_y; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + renderExtension -> data.picture_clip.src_y = value; + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.picture_clip.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderPictureClip.h b/nxcomp/src/RenderPictureClip.h new file mode 100644 index 000000000..bd811dfcd --- /dev/null +++ b/nxcomp/src/RenderPictureClip.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderPictureClip_H +#define RenderPictureClip_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderPictureClip" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderPictureClipStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 12 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderPictureClip_H */ diff --git a/nxcomp/src/RenderPictureFilter.cpp b/nxcomp/src/RenderPictureFilter.cpp new file mode 100644 index 000000000..ce40e051a --- /dev/null +++ b/nxcomp/src/RenderPictureFilter.cpp @@ -0,0 +1,278 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderPictureFilter.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding value " + << ((size - MESSAGE_OFFSET) >> 2) << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << size + << ".\n" << logofs_flush; + #endif + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> renderSrcPictureCache); + + encodeBuffer.encodeCachedValue(GetUINT(buffer + 8, bigEndian), 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeXidValue(value, + clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 4, bigEndian); + + decodeBuffer.decodeCachedValue(value, 16, + clientCache -> renderLengthCache, 5); + + PutUINT(value, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + encodeCharData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeCharData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.picture_filter.type = *(buffer + 1); + + renderExtension -> data.picture_filter.src_id = GetULONG(buffer + 4, bigEndian); + renderExtension -> data.picture_filter.num_elm = GetUINT(buffer + 8, bigEndian); + + // + // Clean the padding bytes. This + // should be the purpose of the + // filter. + // + + #ifdef TEST + *logofs << name() << ": Cleaning " + << RoundUp4(renderExtension -> data.picture_filter.num_elm) - + renderExtension -> data.picture_filter.num_elm << " bytes " + << "at offset " << MESSAGE_OFFSET + renderExtension -> + data.picture_filter.num_elm << " with " << renderExtension -> + data.picture_filter.num_elm << " elements and size " + << renderExtension -> size_ << ".\n" << logofs_flush; + #endif + + if (size >= MESSAGE_OFFSET + renderExtension -> + data.picture_filter.num_elm) + { + unsigned char *next = (unsigned char *) buffer + + MESSAGE_OFFSET + renderExtension -> + data.picture_filter.num_elm; + + while (next < buffer + size) + { + *next++ = '\0'; + } + } + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.picture_filter.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.picture_filter.type; + + PutULONG(renderExtension -> data.picture_filter.src_id, buffer + 4, bigEndian); + PutUINT(renderExtension -> data.picture_filter.num_elm, buffer + 8, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.picture_filter.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + // + // Include the length of the filter name + // in the checksum. + // + + md5_append(md5_state, buffer + 1, 3); + md5_append(md5_state, buffer + 8, 2); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.picture_filter.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.picture_filter.src_id = + renderExtension -> data.picture_filter.src_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.picture_filter.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.picture_filter.src_id, + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.picture_filter.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderPictureFilter.h b/nxcomp/src/RenderPictureFilter.h new file mode 100644 index 000000000..a3e37538b --- /dev/null +++ b/nxcomp/src/RenderPictureFilter.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderPictureFilter_H +#define RenderPictureFilter_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderPictureFilter" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderPictureFilterStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 12 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderPictureFilter_H */ diff --git a/nxcomp/src/RenderPictureTransform.cpp b/nxcomp/src/RenderPictureTransform.cpp new file mode 100644 index 000000000..0048e61f4 --- /dev/null +++ b/nxcomp/src/RenderPictureTransform.cpp @@ -0,0 +1,214 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderPictureTransform.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + // + // Size is always 44. The identity size + // is set to 8, so we encode the 36 bytes + // of the transformation matrix as our + // data. + // +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + size = MESSAGE_OFFSET + 36; + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(GetULONG(buffer + 4, bigEndian), + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeXidValue(value, + clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.picture_transform.type = *(buffer + 1); + + renderExtension -> data.picture_transform.src_id = GetULONG(buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.picture_transform.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.picture_transform.type; + + PutULONG(renderExtension -> data.picture_transform.src_id, buffer + 4, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.picture_transform.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + md5_append(md5_state, buffer + 1, 3); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.picture_transform.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.picture_transform.src_id = + renderExtension -> data.picture_transform.src_id; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.picture_transform.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.picture_transform.src_id, + clientCache -> renderSrcPictureCache); + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.picture_transform.type + << " size is " << renderExtension -> size_ << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderPictureTransform.h b/nxcomp/src/RenderPictureTransform.h new file mode 100644 index 000000000..649cd05d3 --- /dev/null +++ b/nxcomp/src/RenderPictureTransform.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderPictureTransform_H +#define RenderPictureTransform_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderPictureTransform" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderPictureTransformStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 8 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return MESSAGE_OFFSET; + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderPictureTransform_H */ diff --git a/nxcomp/src/RenderTrapezoids.cpp b/nxcomp/src/RenderTrapezoids.cpp new file mode 100644 index 000000000..bf84509dc --- /dev/null +++ b/nxcomp/src/RenderTrapezoids.cpp @@ -0,0 +1,372 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderTrapezoids.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + // + // The trapezoid data is made up of a structure + // containing a top and bottom coordinate in 4 + // bytes format, plus two lines, each represent- + // ed as four points in 4 bytes format. Thus + // each trapezoid is 4 * 2 + (4 * 4) * 2 = 40 + // bytes. Bytes are all padded to an long int, + // so we don't need to clean the message. + // + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding value " + << ((size - MESSAGE_OFFSET) >> 2) << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << size + << ".\n" << logofs_flush; + #endif + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> renderSrcPictureCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), + clientCache -> renderDstPictureCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, + clientCache -> renderFormatCache); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + decodeBuffer.decodeXidValue(value, + clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeXidValue(value, + clientCache -> renderDstPictureCache); + + PutULONG(value, buffer + 12, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderFormatCache); + + PutULONG(value, buffer + 16, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + if (size > MESSAGE_OFFSET) + { + encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + } + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of text data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + if (size > MESSAGE_OFFSET) + { + decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + } + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.trapezoids.type = *(buffer + 1); + renderExtension -> data.trapezoids.op = *(buffer + 4); + + renderExtension -> data.trapezoids.src_id = GetULONG(buffer + 8, bigEndian); + renderExtension -> data.trapezoids.dst_id = GetULONG(buffer + 12, bigEndian); + + renderExtension -> data.trapezoids.format = GetULONG(buffer + 16, bigEndian); + + renderExtension -> data.trapezoids.src_x = GetUINT(buffer + 20, bigEndian); + renderExtension -> data.trapezoids.src_y = GetUINT(buffer + 22, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.trapezoids.type + << " size is " << renderExtension -> size_ << " identity size " + << renderExtension -> i_size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.trapezoids.type; + *(buffer + 4) = renderExtension -> data.trapezoids.op; + + PutULONG(renderExtension -> data.trapezoids.src_id, buffer + 8, bigEndian); + PutULONG(renderExtension -> data.trapezoids.dst_id, buffer + 12, bigEndian); + + PutULONG(renderExtension -> data.trapezoids.format, buffer + 16, bigEndian); + + PutUINT(renderExtension -> data.trapezoids.src_x, buffer + 20, bigEndian); + PutUINT(renderExtension -> data.trapezoids.src_y, buffer + 22, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.trapezoids.type + << " size is " << renderExtension -> size_ << " identity size " + << renderExtension -> i_size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + // + // Include minor opcode, size and the + // operator in the identity. + // + + md5_append(md5_state, buffer + 1, 4); + + // + // Also include the format but not the + // x and y source. + // + + md5_append(md5_state, buffer + 16, 4); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.trapezoids.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.trapezoids.src_id = + renderExtension -> data.trapezoids.src_id; + + encodeBuffer.encodeXidValue(renderExtension -> data.trapezoids.dst_id, + clientCache -> renderDstPictureCache); + + cachedRenderExtension -> data.trapezoids.dst_id = + renderExtension -> data.trapezoids.dst_id; + + // + // The source x and y coordinates are + // encoded as differerences in respect + // to the previous cached value. + // + + unsigned int value; + unsigned int previous; + + value = renderExtension -> data.trapezoids.src_x; + previous = cachedRenderExtension -> data.trapezoids.src_x; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + cachedRenderExtension -> data.trapezoids.src_x = value; + + value = renderExtension -> data.trapezoids.src_y; + previous = cachedRenderExtension -> data.trapezoids.src_y; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + cachedRenderExtension -> data.trapezoids.src_y = value; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.trapezoids.type + << " size is " << renderExtension -> size_ << " source x " + << renderExtension -> data.trapezoids.src_x << " y " + << renderExtension -> data.trapezoids.src_y << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.trapezoids.src_id, + clientCache -> renderSrcPictureCache); + + decodeBuffer.decodeXidValue(renderExtension -> data.trapezoids.dst_id, + clientCache -> renderDstPictureCache); + + unsigned int value; + unsigned int previous; + + previous = renderExtension -> data.trapezoids.src_x; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + renderExtension -> data.trapezoids.src_x = value; + + previous = renderExtension -> data.trapezoids.src_y; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + renderExtension -> data.trapezoids.src_y = value; + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.trapezoids.type + << " size is " << renderExtension -> size_ << " source x " + << renderExtension -> data.trapezoids.src_x << " y " + << renderExtension -> data.trapezoids.src_y << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderTrapezoids.h b/nxcomp/src/RenderTrapezoids.h new file mode 100644 index 000000000..faf524c76 --- /dev/null +++ b/nxcomp/src/RenderTrapezoids.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderTrapezoids_H +#define RenderTrapezoids_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderTrapezoids" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderTrapezoidsStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 24 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size); + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderTrapezoids_H */ diff --git a/nxcomp/src/RenderTriangles.cpp b/nxcomp/src/RenderTriangles.cpp new file mode 100644 index 000000000..a5eb4d83d --- /dev/null +++ b/nxcomp/src/RenderTriangles.cpp @@ -0,0 +1,362 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +// +// Include the template for +// this message class. +// + +#include "RenderTriangles.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#include MESSAGE_TAGS + +// +// Message handling methods. +// + +MESSAGE_BEGIN_ENCODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding value " + << ((size - MESSAGE_OFFSET) >> 2) << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((size - MESSAGE_OFFSET) >> 2, 16, + clientCache -> renderLengthCache, 5); + + #ifdef TEST + *logofs << name() << ": Encoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_SIZE + +MESSAGE_BEGIN_DECODE_SIZE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(size, 16, + clientCache -> renderLengthCache, 5); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << size + << ".\n" << logofs_flush; + #endif + + size = MESSAGE_OFFSET + (size << 2); + + buffer = writeBuffer -> addMessage(size); + + #ifdef TEST + *logofs << name() << ": Decoded size with value " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_SIZE + +MESSAGE_BEGIN_ENCODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 8, bigEndian), + clientCache -> renderSrcPictureCache); + + encodeBuffer.encodeXidValue(GetULONG(buffer + 12, bigEndian), + clientCache -> renderDstPictureCache); + + encodeBuffer.encodeCachedValue(GetULONG(buffer + 16, bigEndian), 32, + clientCache -> renderFormatCache); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 20, bigEndian), + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + encodeBuffer.encodeDiffCachedValue(GetUINT(buffer + 22, bigEndian), + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + #ifdef TEST + *logofs << name() << ": Encoded message. Type is " + << (unsigned int) *(buffer + 1) << " size is " + << size << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_MESSAGE + +MESSAGE_BEGIN_DECODE_MESSAGE +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + *(buffer + 1) = type; + + decodeBuffer.decodeCachedValue(*(buffer + 4), 8, + clientCache -> renderOpCache); + + decodeBuffer.decodeXidValue(value, + clientCache -> renderSrcPictureCache); + + PutULONG(value, buffer + 8, bigEndian); + + decodeBuffer.decodeXidValue(value, + clientCache -> renderDstPictureCache); + + PutULONG(value, buffer + 12, bigEndian); + + decodeBuffer.decodeCachedValue(value, 32, + clientCache -> renderFormatCache); + + PutULONG(value, buffer + 16, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastX, 16, + clientCache -> renderXCache, 11); + + PutUINT(clientCache -> renderLastX, buffer + 20, bigEndian); + + decodeBuffer.decodeDiffCachedValue(value, + clientCache -> renderLastY, 16, + clientCache -> renderYCache, 11); + + PutUINT(clientCache -> renderLastY, buffer + 22, bigEndian); + + #ifdef TEST + *logofs << name() << ": Decoded message. Type is " + << (unsigned int) type << " size is " << size + << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_MESSAGE + +MESSAGE_BEGIN_ENCODE_DATA +{ + if (size > MESSAGE_OFFSET) + { + encodeLongData(encodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + } + + #ifdef TEST + *logofs << name() << ": Encoded " << size - MESSAGE_OFFSET + << " bytes of text data.\n" << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_DATA + +MESSAGE_BEGIN_DECODE_DATA +{ + if (size > MESSAGE_OFFSET) + { + decodeLongData(decodeBuffer, buffer, MESSAGE_OFFSET, + size, bigEndian, channelCache); + } + + #ifdef TEST + *logofs << name() << ": Decoded " << size - MESSAGE_OFFSET + << " bytes of data.\n" << logofs_flush; + #endif +} +MESSAGE_END_DECODE_DATA + +MESSAGE_BEGIN_PARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + renderExtension -> data.triangles.type = *(buffer + 1); + renderExtension -> data.triangles.op = *(buffer + 4); + + renderExtension -> data.triangles.src_id = GetULONG(buffer + 8, bigEndian); + renderExtension -> data.triangles.dst_id = GetULONG(buffer + 12, bigEndian); + + renderExtension -> data.triangles.format = GetULONG(buffer + 16, bigEndian); + + renderExtension -> data.triangles.src_x = GetUINT(buffer + 20, bigEndian); + renderExtension -> data.triangles.src_y = GetUINT(buffer + 22, bigEndian); + + #ifdef TEST + *logofs << name() << ": Parsed identity. Type is " + << (unsigned int) renderExtension -> data.triangles.type + << " size is " << renderExtension -> size_ << " identity size " + << renderExtension -> i_size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_PARSE_IDENTITY + +MESSAGE_BEGIN_UNPARSE_IDENTITY +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + *(buffer + 1) = renderExtension -> data.triangles.type; + *(buffer + 4) = renderExtension -> data.triangles.op; + + PutULONG(renderExtension -> data.triangles.src_id, buffer + 8, bigEndian); + PutULONG(renderExtension -> data.triangles.dst_id, buffer + 12, bigEndian); + + PutULONG(renderExtension -> data.triangles.format, buffer + 16, bigEndian); + + PutUINT(renderExtension -> data.triangles.src_x, buffer + 20, bigEndian); + PutUINT(renderExtension -> data.triangles.src_y, buffer + 22, bigEndian); + + #ifdef TEST + *logofs << name() << ": Unparsed identity. Type is " + << (unsigned int) renderExtension -> data.triangles.type + << " size is " << renderExtension -> size_ << " identity size " + << renderExtension -> i_size_ << ".\n" << logofs_flush; + #endif +} +MESSAGE_END_UNPARSE_IDENTITY + +MESSAGE_BEGIN_IDENTITY_CHECKSUM +{ + // + // Include minor opcode, size and the + // operator in the identity. + // + + md5_append(md5_state, buffer + 1, 4); + + // + // Also include the format but not the + // x and y source. + // + + md5_append(md5_state, buffer + 16, 4); +} +MESSAGE_END_IDENTITY_CHECKSUM + +MESSAGE_BEGIN_ENCODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + RenderExtensionMessage *cachedRenderExtension = (RenderExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeXidValue(renderExtension -> data.triangles.src_id, + clientCache -> renderSrcPictureCache); + + cachedRenderExtension -> data.triangles.src_id = + renderExtension -> data.triangles.src_id; + + encodeBuffer.encodeXidValue(renderExtension -> data.triangles.dst_id, + clientCache -> renderDstPictureCache); + + cachedRenderExtension -> data.triangles.dst_id = + renderExtension -> data.triangles.dst_id; + + // + // The source x and y coordinates are + // encoded as differerences in respect + // to the previous cached value. + // + + unsigned int value; + unsigned int previous; + + value = renderExtension -> data.triangles.src_x; + previous = cachedRenderExtension -> data.triangles.src_x; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + cachedRenderExtension -> data.triangles.src_x = value; + + value = renderExtension -> data.triangles.src_y; + previous = cachedRenderExtension -> data.triangles.src_y; + + encodeBuffer.encodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + cachedRenderExtension -> data.triangles.src_y = value; + + #ifdef TEST + *logofs << name() << ": Encoded update. Type is " + << (unsigned int) renderExtension -> data.triangles.type + << " size is " << renderExtension -> size_ << " source x " + << renderExtension -> data.triangles.src_x << " y " + << renderExtension -> data.triangles.src_y << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_ENCODE_UPDATE + +MESSAGE_BEGIN_DECODE_UPDATE +{ + RenderExtensionMessage *renderExtension = (RenderExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeXidValue(renderExtension -> data.triangles.src_id, + clientCache -> renderSrcPictureCache); + + decodeBuffer.decodeXidValue(renderExtension -> data.triangles.dst_id, + clientCache -> renderDstPictureCache); + + unsigned int value; + unsigned int previous; + + previous = renderExtension -> data.triangles.src_x; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderXCache, 11); + + renderExtension -> data.triangles.src_x = value; + + previous = renderExtension -> data.triangles.src_y; + + decodeBuffer.decodeDiffCachedValue(value, previous, 16, + clientCache -> renderYCache, 11); + + renderExtension -> data.triangles.src_y = value; + + #ifdef TEST + *logofs << name() << ": Decoded update. Type is " + << (unsigned int) renderExtension -> data.triangles.type + << " size is " << renderExtension -> size_ << " source x " + << renderExtension -> data.triangles.src_x << " y " + << renderExtension -> data.triangles.src_y << ".\n" + << logofs_flush; + #endif +} +MESSAGE_END_DECODE_UPDATE diff --git a/nxcomp/src/RenderTriangles.h b/nxcomp/src/RenderTriangles.h new file mode 100644 index 000000000..d73efb7b8 --- /dev/null +++ b/nxcomp/src/RenderTriangles.h @@ -0,0 +1,88 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef RenderTriangles_H +#define RenderTriangles_H + +// +// Define the characteristics +// of this message class here. +// + +#undef MESSAGE_NAME +#define MESSAGE_NAME "RenderTriangles" + +#undef MESSAGE_STORE +#define MESSAGE_STORE RenderTrianglesStore + +#undef MESSAGE_CLASS +#define MESSAGE_CLASS RenderMinorExtensionStore + +#undef MESSAGE_METHODS +#define MESSAGE_METHODS "RenderMinorExtensionMethods.h" + +#undef MESSAGE_HEADERS +#define MESSAGE_HEADERS "RenderMinorExtensionHeaders.h" + +#undef MESSAGE_TAGS +#define MESSAGE_TAGS "RenderMinorExtensionTags.h" + +#undef MESSAGE_OFFSET +#define MESSAGE_OFFSET 24 + +#undef MESSAGE_HAS_SIZE +#define MESSAGE_HAS_SIZE 1 + +#undef MESSAGE_HAS_DATA +#define MESSAGE_HAS_DATA 1 + +#undef MESSAGE_HAS_FILTER +#define MESSAGE_HAS_FILTER 0 + +// +// Declare the message class. +// + +#include MESSAGE_HEADERS + +class MESSAGE_STORE : public MESSAGE_CLASS +{ + public: + + virtual const char *name() const + { + return MESSAGE_NAME; + } + + virtual int identitySize(const unsigned char *buffer, + unsigned int size) + { + return (size >= MESSAGE_OFFSET ? MESSAGE_OFFSET : size); + } + + #include MESSAGE_METHODS +}; + +#endif /* RenderTriangles_H */ diff --git a/nxcomp/src/Rgb.cpp b/nxcomp/src/Rgb.cpp new file mode 100644 index 000000000..c98fa5147 --- /dev/null +++ b/nxcomp/src/Rgb.cpp @@ -0,0 +1,106 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Rgb.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +int UnpackRgb(T_geometry *geometry, unsigned char method, unsigned char *src_data, + int src_size, int dst_bpp, int dst_width, int dst_height, + unsigned char *dst_data, int dst_size) +{ + if (*src_data == 0) + { + if (dst_size != src_size - 1) + { + #ifdef TEST + *logofs << "UnpackRgb: PANIC! Invalid destination size " + << dst_size << " with source " << src_size + << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "UnpackRgb: Expanding " << src_size - 1 + << " bytes of plain RGB data.\n" << logofs_flush; + #endif + + memcpy(dst_data, src_data + 1, src_size - 1); + + return 1; + } + + unsigned int check_size = dst_size; + + int result = ZDecompress(&unpackStream, dst_data, &check_size, + src_data + 1, src_size - 1); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "UnpackRgb: PANIC! Failure decompressing RGB data. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decompressing RGB data. " + << "Error is '" << zError(result) << "'.\n"; + + return -1; + } + else if (check_size != (unsigned int) dst_size) + { + #ifdef PANIC + *logofs << "UnpackRgb: PANIC! Size mismatch in RGB data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Size mismatch in RGB data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n"; + + return -1; + } + + #ifdef TEST + *logofs << "UnpackRgb: Decompressed " << src_size - 1 + << " bytes to " << dst_size << " bytes of RGB data.\n" + << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/Rgb.h b/nxcomp/src/Rgb.h new file mode 100644 index 000000000..ec088dd1b --- /dev/null +++ b/nxcomp/src/Rgb.h @@ -0,0 +1,36 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Rgb_H +#define Rgb_H + +#include "Unpack.h" + +int UnpackRgb(T_geometry *geometry, unsigned char method, + unsigned char *src_data, int src_size, int dst_bpp, + int dst_width, int dst_height, unsigned char *dst_data, + int dst_size); + +#endif /* Rgb_H */ diff --git a/nxcomp/src/Rle.cpp b/nxcomp/src/Rle.cpp new file mode 100644 index 000000000..2a145aa0c --- /dev/null +++ b/nxcomp/src/Rle.cpp @@ -0,0 +1,106 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Rle.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +int UnpackRle(T_geometry *geometry, unsigned char method, unsigned char *src_data, + int src_size, int dst_bpp, int dst_width, int dst_height, + unsigned char *dst_data, int dst_size) +{ + if (*src_data == 0) + { + if (dst_size != src_size - 1) + { + #ifdef TEST + *logofs << "UnpackRle: PANIC! Invalid destination size " + << dst_size << " with source " << src_size + << ".\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "UnpackRle: Expanding " << src_size - 1 + << " bytes of plain RLE data.\n" << logofs_flush; + #endif + + memcpy(dst_data, src_data + 1, src_size - 1); + + return 1; + } + + unsigned int check_size = dst_size; + + int result = ZDecompress(&unpackStream, dst_data, &check_size, + src_data + 1, src_size - 1); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "UnpackRle: PANIC! Failure decompressing RLE data. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decompressing RLE data. " + << "Error is '" << zError(result) << "'.\n"; + + return -1; + } + else if (check_size != (unsigned int) dst_size) + { + #ifdef PANIC + *logofs << "UnpackRle: PANIC! Size mismatch in RLE data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Size mismatch in RLE data. " + << "Resulting size is " << check_size << " with " + << "expected size " << dst_size << ".\n"; + + return -1; + } + + #ifdef TEST + *logofs << "UnpackRle: Decompressed " << src_size - 1 + << " bytes to " << dst_size << " bytes of RLE data.\n" + << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/Rle.h b/nxcomp/src/Rle.h new file mode 100644 index 000000000..cc5dab0e8 --- /dev/null +++ b/nxcomp/src/Rle.h @@ -0,0 +1,36 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Rle_H +#define Rle_H + +#include "Unpack.h" + +int UnpackRle(T_geometry *geometry, unsigned char method, + unsigned char *src_data, int src_size, int dst_bpp, + int dst_width, int dst_height, unsigned char *dst_data, + int dst_size); + +#endif /* Rle_H */ diff --git a/nxcomp/src/SendEvent.cpp b/nxcomp/src/SendEvent.cpp new file mode 100644 index 000000000..8867d0a9e --- /dev/null +++ b/nxcomp/src/SendEvent.cpp @@ -0,0 +1,304 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SendEvent.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "IntCache.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int SendEventStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SendEventMessage *sendEvent = (SendEventMessage *) message; + + // + // Here is the fingerprint. + // + + sendEvent -> propagate = *(buffer + 1); + + sendEvent -> window = GetULONG(buffer + 4, bigEndian); + sendEvent -> mask = GetULONG(buffer + 8, bigEndian); + + sendEvent -> code = *(buffer + 12); + sendEvent -> byte_data = *(buffer + 13); + + sendEvent -> sequence = GetUINT(buffer + 14, bigEndian); + + sendEvent -> int_data = GetULONG(buffer + 16, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int SendEventStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SendEventMessage *sendEvent = (SendEventMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = sendEvent -> propagate; + + PutULONG(sendEvent -> window, buffer + 4, bigEndian); + PutULONG(sendEvent -> mask, buffer + 8, bigEndian); + + *(buffer + 12) = sendEvent -> code; + *(buffer + 13) = sendEvent -> byte_data; + + PutUINT(sendEvent -> sequence, buffer + 14, bigEndian); + + PutULONG(sendEvent -> int_data, buffer + 16, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void SendEventStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + SendEventMessage *sendEvent = (SendEventMessage *) message; + + *logofs << name() << ": Identity propagate " << (unsigned int) sendEvent -> propagate + << ", window " << sendEvent -> window << ", mask " << sendEvent -> mask + << ", code " << (unsigned int) sendEvent -> code << ", byte_data " + << (unsigned int) sendEvent -> byte_data << ", sequence " + << sendEvent -> sequence << ", int_data " << sendEvent -> int_data + << ", size " << sendEvent -> size_ << ".\n" << logofs_flush; + + #endif +} + +void SendEventStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ +} + +void SendEventStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + SendEventMessage *sendEvent = (SendEventMessage *) message; + SendEventMessage *cachedSendEvent = (SendEventMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << (unsigned int) sendEvent -> propagate + << " as propagate field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeBoolValue(sendEvent -> propagate); + + cachedSendEvent -> propagate = sendEvent -> propagate; + + #ifdef TEST + *logofs << name() << ": Encoding value " << sendEvent -> window + << " as window field.\n" << logofs_flush; + #endif + + if (sendEvent -> window == 0 || sendEvent -> window == 1) + { + encodeBuffer.encodeBoolValue(1); + + encodeBuffer.encodeBoolValue(sendEvent -> window); + } + else + { + encodeBuffer.encodeBoolValue(0); + + encodeBuffer.encodeXidValue(sendEvent -> window, clientCache -> windowCache); + } + + cachedSendEvent -> window = sendEvent -> window; + + #ifdef TEST + *logofs << name() << ": Encoding value " << sendEvent -> mask + << " as mask field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sendEvent -> mask, 32, + clientCache -> sendEventMaskCache); + + cachedSendEvent -> mask = sendEvent -> mask; + + #ifdef TEST + *logofs << name() << ": Encoding value " << sendEvent -> code + << " as code field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sendEvent -> code, 8, + clientCache -> sendEventCodeCache); + + cachedSendEvent -> code = sendEvent -> code; + + #ifdef TEST + *logofs << name() << ": Encoding value " << sendEvent -> byte_data + << " as byte_data field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sendEvent -> byte_data, 8, + clientCache -> sendEventByteDataCache); + + cachedSendEvent -> byte_data = sendEvent -> byte_data; + + #ifdef TEST + *logofs << name() << ": Encoding value " << sendEvent -> sequence + << " as sequence field.\n" << logofs_flush; + #endif + + unsigned int diffSeq = sendEvent -> sequence - + clientCache -> sendEventLastSequence; + + clientCache -> sendEventLastSequence = sendEvent -> sequence; + + encodeBuffer.encodeValue(diffSeq, 16, 4); + + cachedSendEvent -> sequence = sendEvent -> sequence; + + #ifdef TEST + *logofs << name() << ": Encoding value " << sendEvent -> int_data + << " as int_data field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sendEvent -> int_data, 32, + clientCache -> sendEventIntDataCache); + + cachedSendEvent -> int_data = sendEvent -> int_data; +} + +void SendEventStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + SendEventMessage *sendEvent = (SendEventMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeBoolValue(value); + + sendEvent -> propagate = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << (unsigned int) sendEvent -> propagate + << " as propagate field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeBoolValue(value); + + if (value) + { + decodeBuffer.decodeBoolValue(value); + } + else + { + decodeBuffer.decodeXidValue(value, clientCache -> windowCache); + } + + sendEvent -> window = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << sendEvent -> window + << " as window field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(sendEvent -> mask, 32, + clientCache -> sendEventMaskCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << sendEvent -> mask + << " as mask field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(sendEvent -> code, 8, + clientCache -> sendEventCodeCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << sendEvent -> code + << " as code field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(sendEvent -> byte_data, 8, + clientCache -> sendEventByteDataCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << sendEvent -> byte_data + << " as byte_data field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeValue(value, 16, 4); + + clientCache -> sendEventLastSequence += value; + clientCache -> sendEventLastSequence &= 0xffff; + + sendEvent -> sequence = clientCache -> sendEventLastSequence; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << sendEvent -> sequence + << " as sequence field.\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(sendEvent -> int_data, 32, + clientCache -> sendEventIntDataCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << sendEvent -> int_data + << " as int_data field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/SendEvent.h b/nxcomp/src/SendEvent.h new file mode 100644 index 000000000..a8841a706 --- /dev/null +++ b/nxcomp/src/SendEvent.h @@ -0,0 +1,195 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef SendEvent_H +#define SendEvent_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define SENDEVENT_ENABLE_CACHE 1 +#define SENDEVENT_ENABLE_DATA 0 +#define SENDEVENT_ENABLE_SPLIT 0 +#define SENDEVENT_ENABLE_COMPRESS 0 + +#define SENDEVENT_DATA_LIMIT 24 +#define SENDEVENT_DATA_OFFSET 20 + +#define SENDEVENT_CACHE_SLOTS 2000 +#define SENDEVENT_CACHE_THRESHOLD 2 +#define SENDEVENT_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class SendEventMessage : public Message +{ + friend class SendEventStore; + + public: + + SendEventMessage() + { + } + + ~SendEventMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char propagate; + unsigned int window; + unsigned int mask; + + // + // These are part of the event data. + // + + unsigned char code; + unsigned char byte_data; + unsigned short sequence; + unsigned int int_data; +}; + +class SendEventStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + SendEventStore() : MessageStore() + { + enableCache = SENDEVENT_ENABLE_CACHE; + enableData = SENDEVENT_ENABLE_DATA; + enableSplit = SENDEVENT_ENABLE_SPLIT; + enableCompress = SENDEVENT_ENABLE_COMPRESS; + + dataLimit = SENDEVENT_DATA_LIMIT; + dataOffset = SENDEVENT_DATA_OFFSET; + + cacheSlots = SENDEVENT_CACHE_SLOTS; + cacheThreshold = SENDEVENT_CACHE_THRESHOLD; + cacheLowerThreshold = SENDEVENT_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~SendEventStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "SendEvent"; + } + + virtual unsigned char opcode() const + { + return X_SendEvent; + } + + virtual unsigned int storage() const + { + return sizeof(SendEventMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new SendEventMessage(); + } + + virtual Message *create(const Message &message) const + { + return new SendEventMessage((const SendEventMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (SendEventMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* SendEvent_H */ diff --git a/nxcomp/src/SequenceQueue.cpp b/nxcomp/src/SequenceQueue.cpp new file mode 100644 index 000000000..a045875d7 --- /dev/null +++ b/nxcomp/src/SequenceQueue.cpp @@ -0,0 +1,174 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SequenceQueue.h" + +static const unsigned int INITIAL_SIZE_ = 16; +static const unsigned int GROWTH_INCREMENT = 16; + +SequenceQueue::SequenceQueue() + + : queue_(new RequestSequence[INITIAL_SIZE_]), size_(INITIAL_SIZE_), + length_(0), start_(0), end_(0) +{ +} + +SequenceQueue::~SequenceQueue() +{ + delete [] queue_; +} + +void SequenceQueue::push(unsigned short int sequence, unsigned char opcode, + unsigned int data1, unsigned int data2, + unsigned int data3) +{ + if (length_ == 0) + { + start_ = end_ = 0; + + queue_[0].opcode = opcode; + queue_[0].sequence = sequence; + + queue_[0].data1 = data1; + queue_[0].data2 = data2; + queue_[0].data3 = data3; + + length_ = 1; + + return; + } + + if (length_ == size_) + { + size_ += GROWTH_INCREMENT; + + RequestSequence *newQueue = new RequestSequence[size_]; + + for (int i = start_; (unsigned int) i < length_; i++) + { + newQueue[i - start_] = queue_[i]; + } + + for (int i1 = 0; (unsigned int) i1 < start_; i1++) + { + newQueue[i1 + length_ - start_] = queue_[i1]; + } + + delete [] queue_; + + queue_ = newQueue; + + start_ = 0; + + end_ = length_ - 1; + } + + end_++; + + if (end_ == size_) + { + end_ = 0; + } + + queue_[end_].opcode = opcode; + queue_[end_].sequence = sequence; + + queue_[end_].data1 = data1; + queue_[end_].data2 = data2; + queue_[end_].data3 = data3; + + length_++; +} + +int SequenceQueue::peek(unsigned short int &sequence, + unsigned char &opcode) +{ + if (length_ == 0) + { + return 0; + } + else + { + opcode = queue_[start_].opcode; + sequence = queue_[start_].sequence; + + return 1; + } +} + +int SequenceQueue::peek(unsigned short int &sequence, unsigned char &opcode, + unsigned int &data1, unsigned int &data2, + unsigned int &data3) +{ + if (length_ == 0) + { + return 0; + } + else + { + opcode = queue_[start_].opcode; + sequence = queue_[start_].sequence; + + data1 = queue_[start_].data1; + data2 = queue_[start_].data2; + data3 = queue_[start_].data3; + + return 1; + } +} + +int SequenceQueue::pop(unsigned short int &sequence, unsigned char &opcode, + unsigned int &data1, unsigned int &data2, + unsigned int &data3) +{ + if (length_ == 0) + { + return 0; + } + else + { + opcode = queue_[start_].opcode; + sequence = queue_[start_].sequence; + + data1 = queue_[start_].data1; + data2 = queue_[start_].data2; + data3 = queue_[start_].data3; + + start_++; + + if (start_ == size_) + { + start_ = 0; + } + + length_--; + + return 1; + } +} diff --git a/nxcomp/src/SequenceQueue.h b/nxcomp/src/SequenceQueue.h new file mode 100644 index 000000000..2a72bc3fe --- /dev/null +++ b/nxcomp/src/SequenceQueue.h @@ -0,0 +1,91 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef SequenceQueue_H +#define SequenceQueue_H + +// +// List of outstanding request messages which +// are waiting for a reply. This class is used +// in X client and server channels to correlate +// the replies sequence numbers to the original +// request type. +// + +class SequenceQueue +{ + public: + + SequenceQueue(); + + virtual ~SequenceQueue(); + + void push(unsigned short int sequence, unsigned char opcode, + unsigned int data1 = 0, unsigned int data2 = 0, + unsigned int data3 = 0); + + int peek(unsigned short int &sequence, unsigned char &opcode); + + int peek(unsigned short int &sequence, unsigned char &opcode, + unsigned int &data1, unsigned int &data2, + unsigned int &data3); + + int pop(unsigned short int &sequence, unsigned char &opcode, + unsigned int &data1, unsigned int &data2, + unsigned int &data3); + + int pop(unsigned short int &sequence, unsigned char &opcode) + { + unsigned int data1, data2, data3; + + return pop(sequence, opcode, data1, data2, data3); + } + + int length() + { + return length_; + } + + private: + + struct RequestSequence + { + unsigned short int sequence; + unsigned char opcode; + unsigned int data1; + unsigned int data2; + unsigned int data3; + }; + + RequestSequence *queue_; + + unsigned int size_; + unsigned int length_; + + unsigned int start_; + unsigned int end_; +}; + +#endif /* SequenceQueue_H */ diff --git a/nxcomp/src/ServerCache.cpp b/nxcomp/src/ServerCache.cpp new file mode 100644 index 000000000..c4c088dca --- /dev/null +++ b/nxcomp/src/ServerCache.cpp @@ -0,0 +1,195 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ServerCache.h" + +// +// Some global caches used to store information +// common to all X connections. +// + +BlockCache ServerCache::lastInitReply; +BlockCache ServerCache::lastKeymap; +unsigned char ServerCache::getKeyboardMappingLastKeysymsPerKeycode = 0; +BlockCache ServerCache::getKeyboardMappingLastMap; +BlockCache ServerCache::getModifierMappingLastMap; +BlockCache ServerCache::xResources; +BlockCacheSet ServerCache::queryFontFontCache(16); + +ServerCache::ServerCache() : + + replySequenceCache(6), eventSequenceCache(6), + lastTimestamp(0), visualCache(8), colormapCache(8), + + errorMinorCache(8), + + colormapNotifyWindowCache(8), colormapNotifyColormapCache(8), + + createNotifyWindowCache(8), createNotifyLastWindow(0), + + exposeWindowCache(12), + + focusInWindowCache(8), + + keyPressLastKey(0), + + mapNotifyEventCache(8), mapNotifyWindowCache(8), + + motionNotifyTimestampCache(8), motionNotifyLastRootX(0), + motionNotifyLastRootY(0), motionNotifyRootXCache(8), + motionNotifyRootYCache(8), motionNotifyEventXCache(8), + motionNotifyEventYCache(8), motionNotifyStateCache(8), + + noExposeDrawableCache(8), noExposeMinorCache(8), + + propertyNotifyWindowCache(8), propertyNotifyAtomCache(8), + + reparentNotifyWindowCache(8), + + selectionClearWindowCache(8), selectionClearAtomCache(8), + + visibilityNotifyWindowCache(8), + + getGeometryRootCache(8), + + getInputFocusWindowCache(8), + + getKeyboardMappingKeysymCache(8), + + getPropertyTypeCache(8), + + getSelectionOwnerCache(8), + + getWindowAttributesClassCache(8), getWindowAttributesPlanesCache(8), + getWindowAttributesPixelCache(8), getWindowAttributesAllEventsCache(8), + getWindowAttributesYourEventsCache(8), + getWindowAttributesDontPropagateCache(8), + + queryPointerRootCache(8), queryPointerChildCache(8), + + translateCoordsChildCache(8), translateCoordsXCache(8), + translateCoordsYCache(8), + + queryTreeWindowCache(8) + +{ + unsigned int i; + + for (i = 0; i < 3; i++) + { + configureNotifyWindowCache[i] = new IntCache(8); + } + + for (i = 0; i < 5; i++) + { + configureNotifyGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 5; i++) + { + exposeGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 3; i++) + { + motionNotifyWindowCache[i] = new IntCache(8); + } + + for (i = 0; i < 5; i++) + { + getGeometryGeomCache[i] = new IntCache(8); + } + + for (i = 0; i < 23; i++) + { + keyPressCache[i] = 0; + } + + for (i = 0; i < 6; i++) + { + queryFontCharInfoCache[i] = new IntCache(8); + queryFontLastCharInfo[i] = 0; + } + + for (i = 0; i < 12; i++) + { + genericReplyIntCache[i] = new IntCache(8); + } + + for (i = 0; i < 14; i++) + { + genericEventIntCache[i] = new IntCache(8); + } +} + + +ServerCache::~ServerCache() +{ + unsigned int i; + + for (i = 0; i < 3; i++) + { + delete configureNotifyWindowCache[i]; + } + + for (i = 0; i < 5; i++) + { + delete configureNotifyGeomCache[i]; + } + + for (i = 0; i < 5; i++) + { + delete exposeGeomCache[i]; + } + + for (i = 0; i < 3; i++) + { + delete motionNotifyWindowCache[i]; + } + + for (i = 0; i < 5; i++) + { + delete getGeometryGeomCache[i]; + } + + for (i = 0; i < 6; i++) + { + delete queryFontCharInfoCache[i]; + } + + for (i = 0; i < 12; i++) + { + delete genericReplyIntCache[i]; + } + + for (i = 0; i < 14; i++) + { + delete genericEventIntCache[i]; + } +} diff --git a/nxcomp/src/ServerCache.h b/nxcomp/src/ServerCache.h new file mode 100644 index 000000000..c6e2b81b6 --- /dev/null +++ b/nxcomp/src/ServerCache.h @@ -0,0 +1,303 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ServerCache_H +#define ServerCache_H + +#include "Misc.h" + +#include "IntCache.h" +#include "CharCache.h" +#include "OpcodeCache.h" +#include "BlockCache.h" +#include "BlockCacheSet.h" + +#include "ChannelCache.h" + +class ServerCache : public ChannelCache +{ + public: + + ServerCache(); + + ~ServerCache(); + + // + // Opcode prediction caches. + // + + OpcodeCache opcodeCache; + + // + // General-purpose caches. + // + + IntCache replySequenceCache; + IntCache eventSequenceCache; + unsigned int lastTimestamp; + CharCache depthCache; + IntCache visualCache; + IntCache colormapCache; + CharCache resourceCache; + + // + // X connection startup. + // + + static BlockCache lastInitReply; + + // + // X errors. + // + + CharCache errorCodeCache; + IntCache errorMinorCache; + CharCache errorMajorCache; + + // + // ButtonPress and ButtonRelease events. + // + + CharCache buttonCache; + + // + // ColormapNotify event. + // + + IntCache colormapNotifyWindowCache; + IntCache colormapNotifyColormapCache; + + // + // ConfigureNotify event. + // + + IntCache *configureNotifyWindowCache[3]; + IntCache *configureNotifyGeomCache[5]; + + // + // CreateNotify event. + // + + IntCache createNotifyWindowCache; + unsigned int createNotifyLastWindow; + + // + // Expose event. + // + + IntCache exposeWindowCache; + IntCache *exposeGeomCache[5]; + + // + // FocusIn event (also used for FocusOut). + // + + IntCache focusInWindowCache; + + // + // KeymapNotify event. + // + + static BlockCache lastKeymap; + + // + // KeyPress event. + // + + unsigned char keyPressLastKey; + unsigned char keyPressCache[23]; + + // + // MapNotify event (also used for UnmapNotify). + // + + IntCache mapNotifyEventCache; + IntCache mapNotifyWindowCache; + + // + // MotionNotify event (also used for KeyPress, + // KeyRelease, ButtonPress, ButtonRelease, + // EnterNotify, and LeaveNotify events and + // QueryPointer reply). + // + + IntCache motionNotifyTimestampCache; + unsigned int motionNotifyLastRootX; + unsigned int motionNotifyLastRootY; + IntCache motionNotifyRootXCache; + IntCache motionNotifyRootYCache; + IntCache motionNotifyEventXCache; + IntCache motionNotifyEventYCache; + IntCache motionNotifyStateCache; + IntCache *motionNotifyWindowCache[3]; + + // + // NoExpose event. + // + + IntCache noExposeDrawableCache; + IntCache noExposeMinorCache; + CharCache noExposeMajorCache; + + // + // PropertyNotify event. + // + + IntCache propertyNotifyWindowCache; + IntCache propertyNotifyAtomCache; + + // + // ReparentNotify event. + // + + IntCache reparentNotifyWindowCache; + + // + // SelectionClear event. + // + + IntCache selectionClearWindowCache; + IntCache selectionClearAtomCache; + + // + // VisibilityNotify event. + // + + IntCache visibilityNotifyWindowCache; + + // + // GetGeometry reply. + // + + IntCache getGeometryRootCache; + IntCache *getGeometryGeomCache[5]; + + // + // GetInputFocus reply. + // + + IntCache getInputFocusWindowCache; + + // + // GetKeyboardMapping reply. + // + + static unsigned char getKeyboardMappingLastKeysymsPerKeycode; + static BlockCache getKeyboardMappingLastMap; + IntCache getKeyboardMappingKeysymCache; + CharCache getKeyboardMappingLastByteCache; + + // + // GetModifierMapping reply. + // + + static BlockCache getModifierMappingLastMap; + + // + // GetProperty reply. + // + + CharCache getPropertyFormatCache; + IntCache getPropertyTypeCache; + static BlockCache xResources; + + // + // GetSelection reply. + // + + IntCache getSelectionOwnerCache; + + // + // GetWindowAttributes reply. + // + + IntCache getWindowAttributesClassCache; + CharCache getWindowAttributesBitGravityCache; + CharCache getWindowAttributesWinGravityCache; + IntCache getWindowAttributesPlanesCache; + IntCache getWindowAttributesPixelCache; + IntCache getWindowAttributesAllEventsCache; + IntCache getWindowAttributesYourEventsCache; + IntCache getWindowAttributesDontPropagateCache; + + // + // QueryColors reply. + // + + BlockCache queryColorsLastReply; + + // + // QueryFont reply. + // + + static BlockCacheSet queryFontFontCache; + IntCache *queryFontCharInfoCache[6]; + unsigned int queryFontLastCharInfo[6]; + + // + // QueryPointer reply. + // + + IntCache queryPointerRootCache; + IntCache queryPointerChildCache; + + // + // TranslateCoords reply. + // + + IntCache translateCoordsChildCache; + IntCache translateCoordsXCache; + IntCache translateCoordsYCache; + + // + // QueryTree reply. + // + + IntCache queryTreeWindowCache; + + // + // Generic reply. Use short data + // in protocol versions >= 3. + // + + CharCache genericReplyCharCache; + IntCache *genericReplyIntCache[12]; + + // + // Generic event. Only in protocol + // versions >= 3. + // + + CharCache genericEventCharCache; + IntCache *genericEventIntCache[14]; + + // + // Used in the abort split events. + // + + OpcodeCache abortOpcodeCache; +}; + +#endif /* ServerCache_H */ diff --git a/nxcomp/src/ServerChannel.cpp b/nxcomp/src/ServerChannel.cpp new file mode 100644 index 000000000..a560eca6d --- /dev/null +++ b/nxcomp/src/ServerChannel.cpp @@ -0,0 +1,7946 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#ifndef ANDROID +#include +#endif + +#include +#include + +#include "NXproto.h" +#include "NXalert.h" +#include "NXpack.h" +#include "NXmitshm.h" + +#include "ServerChannel.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "StaticCompressor.h" + +#include "Statistics.h" +#include "Proxy.h" + +#include "Auth.h" +#include "Unpack.h" + +// +// Available unpack methods. +// + +#include "Alpha.h" +#include "Colormap.h" +#include "Bitmap.h" +#include "Jpeg.h" +#include "Pgn.h" +#include "Rgb.h" +#include "Rle.h" + +extern Proxy *proxy; + +// +// Set the verbosity level. You also +// need to define OPCODES in Misc.cpp +// if you want literals instead of +// opcodes' numbers. +// + +#define PANIC +#define WARNING +#undef OPCODES +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Log the important tracepoints related +// to writing packets to the peer proxy. +// + +#undef FLUSH + +// +// Log the operations related to splits. +// + +#undef SPLIT + +// +// Define this to log when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// Define this to exit and suspend the +// session after a given number of X +// messages decoded by the proxy. +// + +#undef SUSPEND + +// +// Define these to hide the server extensions. +// + +#define HIDE_MIT_SHM_EXTENSION +#define HIDE_BIG_REQUESTS_EXTENSION +#define HIDE_XFree86_Bigfont_EXTENSION +#undef HIDE_SHAPE_EXTENSION +#undef HIDE_XKEYBOARD_EXTENSION + +// +// Known reasons of connection failures. +// + +#define INVALID_COOKIE_DATA "Invalid MIT-MAGIC-COOKIE-1 key" +#define INVALID_COOKIE_SIZE ((int) sizeof(INVALID_COOKIE_DATA) - 1) + +#define NO_AUTH_PROTO_DATA "No protocol specified" +#define NO_AUTH_PROTO_SIZE ((int) sizeof(NO_AUTH_PROTO_DATA) - 1) + +// +// Here are the static members. +// + +#ifdef REFERENCES + +int ServerChannel::references_ = 0; + +#endif + +ServerChannel::ServerChannel(Transport *transport, StaticCompressor *compressor) + + : Channel(transport, compressor), readBuffer_(transport_, this) +{ + // + // Sequence number of the next message + // being encoded or decoded. + // + + clientSequence_ = 0; + serverSequence_ = 0; + + // + // Save the last motion event and flush + // it only when the timeout expires. + // + + lastMotion_[0] = '\0'; + + // + // Clear the queue of sequence numbers + // of split commits. Used to mask the + // errors. + // + + initCommitQueue(); + + // + // Do we enable or not sending of expose + // events to the X client. + // + + enableExpose_ = 1; + enableGraphicsExpose_ = 1; + enableNoExpose_ = 1; + + // + // Track data of image currently being + // decompressed. + // + + imageState_ = NULL; + + // + // Track MIT-SHM resources. + // + + shmemState_ = NULL; + + // + // Store the unpack state for each agent + // resource. + // + + for (int i = 0; i < CONNECTIONS_LIMIT; i++) + { + unpackState_[i] = NULL; + } + + // + // Data about the split parameters requested + // by the encoding side. + // + + splitState_.resource = nothing; + splitState_.current = 0; + splitState_.save = 1; + splitState_.load = 1; + splitState_.commit = 0; + + // + // It will be eventually set by + // the server proxy. + // + + fontPort_ = -1; + + #ifdef REFERENCES + *logofs << "ServerChannel: Created new object at " + << this << " for FD#" << fd_ << " out of " + << ++references_ << " allocated channels.\n" + << logofs_flush; + #endif +} + +ServerChannel::~ServerChannel() +{ + #ifdef TEST + *logofs << "ServerChannel: Freeing image state information.\n" + << logofs_flush; + #endif + + handleImageStateRemove(); + + #ifdef TEST + *logofs << "ServerChannel: Freeing shared memory information.\n" + << logofs_flush; + #endif + + handleShmemStateRemove(); + + #ifdef TEST + *logofs << "ServerChannel: Freeing unpack state information.\n" + << logofs_flush; + #endif + + for (int i = 0; i < CONNECTIONS_LIMIT; i++) + { + handleUnpackStateRemove(i); + } + + #ifdef TEST + *logofs << "ServerChannel: Freeing channel caches.\n" + << logofs_flush; + #endif + + #ifdef REFERENCES + *logofs << "ServerChannel: Deleted object at " + << this << " for FD#" << fd_ << " out of " + << --references_ << " allocated channels.\n" + << logofs_flush; + #endif +} + +// +// Beginning of handleRead(). +// + +int ServerChannel::handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length) +{ + #ifdef DEBUG + *logofs << "handleRead: Called for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + // + // Pointer to located message and + // its size in bytes. + // + + const unsigned char *inputMessage; + unsigned int inputLength; + + // + // Set when message is found in + // cache. + // + + int hit; + + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: Trying to read from FD#" + << fd_ << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + int result = readBuffer_.readMessage(); + + #if defined(DEBUG) || defined(INFO) + *logofs << "handleRead: Read result on FD#" << fd_ + << " is " << result << ".\n" + << logofs_flush; + #endif + + if (result < 0) + { + // + // Let the proxy close the channel. + // + + return -1; + } + else if (result == 0) + { + #if defined(TEST) || defined(INFO) + + // + // This can happen because we have the descriptor + // selected in the read set but we already read + // the data asynchronously, while decoding data + // read from the proxy. + // + + *logofs << "handleRead: WARNING! No data read from FD#" + << fd_ << " while encoding messages.\n" + << logofs_flush; + + #endif + + return 0; + } + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "handleRead: Encoding messages for FD#" << fd_ + << " with " << readBuffer_.getLength() << " bytes " + << "in the buffer.\n" << logofs_flush; + #endif + + // + // Extract any complete message which + // is available in the buffer. + // + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + while ((inputMessage = readBuffer_.getMessage(inputLength)) != NULL) + { + hit = 0; + + if (firstReply_) + { + // + // Handle the X server's authorization reply. + // + + if (handleAuthorization(inputMessage, inputLength) < 0) + { + return -1; + } + + imageByteOrder_ = inputMessage[30]; + bitmapBitOrder_ = inputMessage[31]; + scanlineUnit_ = inputMessage[32]; + scanlinePad_ = inputMessage[33]; + + encodeBuffer.encodeValue((unsigned int) inputMessage[0], 8); + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 8); + encodeBuffer.encodeValue(GetUINT(inputMessage + 2, bigEndian_), 16); + encodeBuffer.encodeValue(GetUINT(inputMessage + 4, bigEndian_), 16); + encodeBuffer.encodeValue(GetUINT(inputMessage + 6, bigEndian_), 16); + + if (ServerCache::lastInitReply.compare(inputLength - 8, inputMessage + 8)) + { + encodeBuffer.encodeBoolValue(1); + } + else + { + encodeBuffer.encodeBoolValue(0); + + for (unsigned int i = 8; i < inputLength; i++) + { + encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8); + } + } + + firstReply_ = 0; + + #if defined(TEST) || defined(OPCODES) + + int bits = encodeBuffer.diffBits(); + + *logofs << "handleRead: Handled first reply. " << inputLength + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + + #endif + + priority_++; + + } + else + { + // + // NX client needs this line to consider + // the initialization phase successfully + // completed. + // + + if (firstClient_ == -1) + { + cerr << "Info" << ": Established X server connection.\n" ; + + firstClient_ = fd_; + } + + // + // Check if this is a reply. + // + + if (*inputMessage == X_Reply) + { + int bits = 0; + + unsigned char inputOpcode = *inputMessage; + + unsigned short int requestSequenceNum; + unsigned char requestOpcode; + unsigned int requestData[3]; + + unsigned int sequenceNum = GetUINT(inputMessage + 2, bigEndian_); + + #ifdef SUSPEND + + if (sequenceNum >= 1000) + { + cerr << "Warning" << ": Exiting to test the resilience of the agent.\n"; + + sleep(2); + + HandleAbort(); + } + + #endif + + // + // We managed all the events and errors caused + // by the previous requests. We can now reset + // the queue of split commits. + // + + clearCommitQueue(); + + // + // Encode opcode and difference between + // current sequence and the last one. + // + + encodeBuffer.encodeOpcodeValue(inputOpcode, serverCache_ -> opcodeCache); + + unsigned int sequenceDiff = sequenceNum - serverSequence_; + + serverSequence_ = sequenceNum; + + #ifdef DEBUG + *logofs << "handleRead: Last server sequence number for FD#" + << fd_ << " is " << serverSequence_ << " with " + << "difference " << sequenceDiff << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sequenceDiff, 16, + serverCache_ -> replySequenceCache, 7); + + // + // Now handle the data part. + // + + if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) && + requestSequenceNum == sequenceNum) + { + // + // We've found the request that generated this reply. + // It is possible to compress the reply based on the + // specific request type. + // + + sequenceQueue_.pop(requestSequenceNum, requestOpcode, + requestData[0], requestData[1], requestData[2]); + + // + // If differential compression is disabled + // then use the most simple encoding. + // + + if (control -> LocalDeltaCompression == 0) + { + int result = handleFastReadReply(encodeBuffer, requestOpcode, + inputMessage, inputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + switch (requestOpcode) + { + case X_AllocColor: + { + const unsigned char *nextSrc = inputMessage + 8; + for (unsigned int i = 0; i < 3; i++) + { + unsigned int colorValue = GetUINT(nextSrc, bigEndian_); + nextSrc += 2; + if (colorValue == requestData[i]) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue(colorValue - colorValue, 16, 6); + } + } + unsigned int pixel = GetULONG(inputMessage + 16, bigEndian_); + encodeBuffer.encodeValue(pixel, 32, 9); + + priority_++; + } + break; + case X_GetAtomName: + { + unsigned int nameLength = GetUINT(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(nameLength, 16, 6); + const unsigned char *nextSrc = inputMessage + 32; + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, nameLength); + + priority_++; + } + break; + case X_GetGeometry: + { + // + // TODO: This obtains a satisfactory 10:1, but + // could be cached to leverage the big amount + // of such requests issued by QT clients. + // + + encodeBuffer.encodeCachedValue(inputMessage[1], 8, + serverCache_ -> depthCache); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> getGeometryRootCache, 9); + const unsigned char *nextSrc = inputMessage + 12; + for (unsigned int i = 0; i < 5; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *serverCache_ -> getGeometryGeomCache[i], 8); + nextSrc += 2; + } + + priority_++; + } + break; + case X_GetInputFocus: + { + // + // Is it a real X_GetInputFocus or a + // masqueraded reply? + // + + if (requestData[0] == X_GetInputFocus) + { + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> getInputFocusWindowCache); + + priority_++; + } + else + { + // + // TODO: We are not setting priority in case + // of replies other than real X_GetInputFocus + // or X_NXGetUnpackParameters. We should check + // once again that this is OK. + // + + #ifdef TEST + *logofs << "handleRead: Received tainted X_GetInputFocus reply " + << "for request OPCODE#" << requestData[0] << " with " + << "sequence " << sequenceNum << ".\n" + << logofs_flush; + #endif + + // + // Don't encode any data in case of sync + // messages or any other reply for which + // opcode is enough. + // + + if (requestData[0] == opcodeStore_ -> getUnpackParameters) + { + for (int i = 0; i < PACK_METHOD_LIMIT; i++) + { + encodeBuffer.encodeBoolValue(control -> LocalUnpackMethods[i]); + } + + priority_++; + } + else if (requestData[0] == opcodeStore_ -> getShmemParameters) + { + if (handleShmemReply(encodeBuffer, requestOpcode, requestData[1], + inputMessage, inputLength) < 0) + { + return -1; + } + + priority_++; + } + else if (requestData[0] == opcodeStore_ -> getFontParameters) + { + if (handleFontReply(encodeBuffer, requestOpcode, + inputMessage, inputLength) < 0) + { + return -1; + } + } + + // + // Account this data to the original opcode. + // + + requestOpcode = requestData[0]; + } + } + break; + case X_GetKeyboardMapping: + { + unsigned int keysymsPerKeycode = (unsigned int) inputMessage[1]; + if (ServerCache::getKeyboardMappingLastMap.compare(inputLength - 32, + inputMessage + 32) && (keysymsPerKeycode == + ServerCache::getKeyboardMappingLastKeysymsPerKeycode)) + { + encodeBuffer.encodeBoolValue(1); + + priority_++; + + break; + } + ServerCache::getKeyboardMappingLastKeysymsPerKeycode = keysymsPerKeycode; + encodeBuffer.encodeBoolValue(0); + unsigned int numKeycodes = + (((inputLength - 32) / keysymsPerKeycode) >> 2); + encodeBuffer.encodeValue(numKeycodes, 8); + encodeBuffer.encodeValue(keysymsPerKeycode, 8, 4); + const unsigned char *nextSrc = inputMessage + 32; + unsigned char previous = 0; + for (unsigned int count = numKeycodes * keysymsPerKeycode; + count; --count) + { + unsigned int keysym = GetULONG(nextSrc, bigEndian_); + nextSrc += 4; + if (keysym == NoSymbol) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + unsigned int first3Bytes = (keysym >> 8); + encodeBuffer.encodeCachedValue(first3Bytes, 24, + serverCache_ -> getKeyboardMappingKeysymCache, 9); + unsigned char lastByte = (unsigned char) (keysym & 0xff); + encodeBuffer.encodeCachedValue(lastByte - previous, 8, + serverCache_ -> getKeyboardMappingLastByteCache, 5); + previous = lastByte; + } + } + + priority_++; + } + break; + case X_GetModifierMapping: + { + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 8); + const unsigned char *nextDest = inputMessage + 32; + if (ServerCache::getModifierMappingLastMap.compare(inputLength - 32, + nextDest)) + { + encodeBuffer.encodeBoolValue(1); + + priority_++; + + break; + } + encodeBuffer.encodeBoolValue(0); + for (unsigned int count = inputLength - 32; count; count--) + { + unsigned char next = *nextDest++; + if (next == 0) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue(next, 8); + } + } + + priority_++; + } + break; + case X_GetProperty: + { + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_GetProperty); + + hit = handleEncode(encodeBuffer, serverCache_, messageStore, + requestOpcode, inputMessage, inputLength); + + priority_++; + } + break; + case X_GetSelectionOwner: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> getSelectionOwnerCache, 9); + priority_++; + } + break; + case X_GetWindowAttributes: + { + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 2); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> visualCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), + 16, serverCache_ -> getWindowAttributesClassCache, 3); + encodeBuffer.encodeCachedValue(inputMessage[14], 8, + serverCache_ -> getWindowAttributesBitGravityCache); + encodeBuffer.encodeCachedValue(inputMessage[15], 8, + serverCache_ -> getWindowAttributesWinGravityCache); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), + 32, serverCache_ -> getWindowAttributesPlanesCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 20, bigEndian_), + 32, serverCache_ -> getWindowAttributesPixelCache, 9); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[24]); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[25]); + encodeBuffer.encodeValue((unsigned int) inputMessage[26], 2); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[27]); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 28, bigEndian_), + 29, serverCache_ -> colormapCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 32, bigEndian_), + 32, serverCache_ -> getWindowAttributesAllEventsCache); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 36, bigEndian_), + 32, serverCache_ -> getWindowAttributesYourEventsCache); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 40, bigEndian_), + 16, serverCache_ -> getWindowAttributesDontPropagateCache); + + priority_++; + } + break; + case X_GrabKeyboard: + case X_GrabPointer: + { + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 3); + + priority_++; + } + break; + case X_InternAtom: + { + encodeBuffer.encodeValue(GetULONG(inputMessage + 8, bigEndian_), 29, 9); + + priority_++; + } + break; + case X_ListExtensions: + { + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); + unsigned int numExtensions = (unsigned int) inputMessage[1]; + encodeBuffer.encodeValue(numExtensions, 8); + const unsigned char *nextSrc = inputMessage + 32; + + for (; numExtensions; numExtensions--) + { + unsigned int length = (unsigned int) (*nextSrc++); + + encodeBuffer.encodeValue(length, 8); + + #ifdef HIDE_MIT_SHM_EXTENSION + + if (!strncmp((char *) nextSrc, "MIT-SHM", 7)) + { + #ifdef TEST + *logofs << "handleRead: Hiding MIT-SHM extension in reply.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) nextSrc, "NO-MIT-", 7); + } + + #endif + + #ifdef HIDE_BIG_REQUESTS_EXTENSION + + if (!strncmp((char *) nextSrc, "BIG-REQUESTS", 12)) + { + #ifdef TEST + *logofs << "handleRead: Hiding BIG-REQUESTS extension in reply.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) nextSrc, "NO-BIG-REQUE", 12); + } + + #endif + + #ifdef HIDE_XKEYBOARD_EXTENSION + + if (!strncmp((char *) nextSrc, "XKEYBOARD", 9)) + { + #ifdef TEST + *logofs << "handleRead: Hiding XKEYBOARD extension in reply.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) nextSrc, "NO-XKEYBO", 9); + } + + #endif + + #ifdef HIDE_XFree86_Bigfont_EXTENSION + + if (!strncmp((char *) nextSrc, "XFree86-Bigfont", 15)) + { + #ifdef TEST + *logofs << "handleRead: Hiding XFree86-Bigfont extension in reply.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) nextSrc, "NO-XFree86-Bigf", 15); + } + + #endif + + #ifdef HIDE_SHAPE_EXTENSION + + if (!strncmp((char *) nextSrc, "SHAPE", 5)) + { + #ifdef TEST + *logofs << "handleRead: Hiding SHAPE extension in reply.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) nextSrc, "NO-SH", 5); + } + + #endif + + // + // Check if user disabled RENDER extension. + // + + if (control -> HideRender == 1 && + !strncmp((char *) nextSrc, "RENDER", 6)) + { + #ifdef TEST + *logofs << "handleRead: Hiding RENDER extension in reply.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) nextSrc, "NO-REN", 6); + } + + for (; length; length--) + { + encodeBuffer.encodeValue((unsigned int) (*nextSrc++), 8); + } + } + + priority_++; + } + break; + case X_ListFonts: + { + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_ListFonts); + + if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, + inputMessage, inputLength)) + { + priority_++; + + hit = 1; + + break; + } + + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); + unsigned int numFonts = GetUINT(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(numFonts, 16, 6); + + // Differential encoding. + encodeBuffer.encodeBoolValue(1); + + const unsigned char* nextSrc = inputMessage + 32; + for (; numFonts; numFonts--) + { + unsigned int length = (unsigned int) (*nextSrc++); + encodeBuffer.encodeValue(length, 8); + + // Since ProtoStep7 (#issue 108) + encodeBuffer.encodeTextData(nextSrc, length); + + nextSrc += length; + } + + priority_++; + } + break; + case X_LookupColor: + case X_AllocNamedColor: + { + const unsigned char *nextSrc = inputMessage + 8; + if (requestOpcode == X_AllocNamedColor) + { + encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); + nextSrc += 4; + } + unsigned int count = 3; + do + { + unsigned int exactColor = GetUINT(nextSrc, bigEndian_); + encodeBuffer.encodeValue(exactColor, 16, 9); + unsigned int visualColor = GetUINT(nextSrc + 6, bigEndian_) - + exactColor; + encodeBuffer.encodeValue(visualColor, 16, 5); + nextSrc += 2; + } + while (--count); + + priority_++; + } + break; + case X_QueryBestSize: + { + encodeBuffer.encodeValue(GetUINT(inputMessage + 8, bigEndian_), 16, 8); + encodeBuffer.encodeValue(GetUINT(inputMessage + 10, bigEndian_), 16, 8); + + priority_++; + } + break; + case X_QueryColors: + { + // Differential encoding. + encodeBuffer.encodeBoolValue(1); + + unsigned int numColors = ((inputLength - 32) >> 3); + const unsigned char *nextSrc = inputMessage + 40; + unsigned char *nextDest = (unsigned char *) inputMessage + 38; + for (unsigned int c = 1; c < numColors; c++) + { + for (unsigned int i = 0; i < 6; i++) + *nextDest++ = *nextSrc++; + nextSrc += 2; + } + unsigned int colorsLength = numColors * 6; + if (serverCache_ -> queryColorsLastReply.compare(colorsLength, + inputMessage + 32)) + encodeBuffer.encodeBoolValue(1); + else + { + const unsigned char *nextSrc = inputMessage + 32; + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue(numColors, 16, 5); + for (numColors *= 3; numColors; numColors--) + { + encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16); + nextSrc += 2; + } + } + + priority_++; + } + break; + case X_QueryExtension: + { + if (requestData[0] == X_QueryExtension) + { + // + // Value in requestData[0] will be nonzero + // if the request is for an extension that + // we should hide to the X client. + // + + if (requestData[1]) + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue(0, 8); + } + else + { + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[8]); + encodeBuffer.encodeValue((unsigned int) inputMessage[9], 8); + } + + encodeBuffer.encodeValue((unsigned int) inputMessage[10], 8); + encodeBuffer.encodeValue((unsigned int) inputMessage[11], 8); + + if (requestData[2] == X_NXInternalShapeExtension) + { + opcodeStore_ -> shapeExtension = inputMessage[9]; + + #ifdef TEST + *logofs << "handleRead: Shape extension opcode for FD#" << fd_ + << " is " << (unsigned int) opcodeStore_ -> shapeExtension + << ".\n" << logofs_flush; + #endif + } + else if (requestData[2] == X_NXInternalRenderExtension) + { + opcodeStore_ -> renderExtension = inputMessage[9]; + + #ifdef TEST + *logofs << "handleRead: Render extension opcode for FD#" << fd_ + << " is " << (unsigned int) opcodeStore_ -> renderExtension + << ".\n" << logofs_flush; + #endif + } + + priority_++; + } + else + { + #ifdef TEST + *logofs << "handleRead: Received tainted X_QueryExtension reply " + << "for request OPCODE#" << requestData[0] << " with " + << "sequence " << sequenceNum << ".\n" + << logofs_flush; + #endif + + if (requestData[0] == opcodeStore_ -> getShmemParameters) + { + if (handleShmemReply(encodeBuffer, requestOpcode, requestData[1], + inputMessage, inputLength) < 0) + { + return -1; + } + + priority_++; + } + // + // Account this data to the original opcode. + // + + requestOpcode = requestData[0]; + } + } + break; + case X_QueryFont: + { + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_QueryFont); + + if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, + inputMessage, inputLength)) + { + priority_++; + + hit = 1; + + break; + } + + // Differential encoding. + encodeBuffer.encodeBoolValue(1); + + unsigned int numProperties = GetUINT(inputMessage + 46, bigEndian_); + unsigned int numCharInfos = GetULONG(inputMessage + 56, bigEndian_); + encodeBuffer.encodeValue(numProperties, 16, 8); + encodeBuffer.encodeValue(numCharInfos, 32, 10); + handleEncodeCharInfo(inputMessage + 8, encodeBuffer); + handleEncodeCharInfo(inputMessage + 24, encodeBuffer); + encodeBuffer.encodeValue(GetUINT(inputMessage + 40, bigEndian_), 16, 9); + encodeBuffer.encodeValue(GetUINT(inputMessage + 42, bigEndian_), 16, 9); + encodeBuffer.encodeValue(GetUINT(inputMessage + 44, bigEndian_), 16, 9); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[48]); + encodeBuffer.encodeValue((unsigned int) inputMessage[49], 8); + encodeBuffer.encodeValue((unsigned int) inputMessage[50], 8); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[51]); + encodeBuffer.encodeValue(GetUINT(inputMessage + 52, bigEndian_), 16, 9); + encodeBuffer.encodeValue(GetUINT(inputMessage + 54, bigEndian_), 16, 9); + const unsigned char *nextSrc = inputMessage + 60; + unsigned int index; + + int end = 0; + + if (ServerCache::queryFontFontCache.lookup(numProperties * 8 + + numCharInfos * 12, nextSrc, index)) + { + encodeBuffer.encodeBoolValue(1); + encodeBuffer.encodeValue(index, 4); + + end = 1; + } + + if (end == 0) + { + encodeBuffer.encodeBoolValue(0); + for (; numProperties; numProperties--) + { + encodeBuffer.encodeValue(GetULONG(nextSrc, bigEndian_), 32, 9); + encodeBuffer.encodeValue(GetULONG(nextSrc + 4, bigEndian_), 32, 9); + nextSrc += 8; + } + for (; numCharInfos; numCharInfos--) + { + handleEncodeCharInfo(nextSrc, encodeBuffer); + + nextSrc += 12; + } + } + + priority_++; + } + break; + case X_QueryPointer: + { + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> queryPointerRootCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), + 29, serverCache_ -> queryPointerChildCache, 9); + unsigned int rootX = GetUINT(inputMessage + 16, bigEndian_); + unsigned int rootY = GetUINT(inputMessage + 18, bigEndian_); + unsigned int eventX = GetUINT(inputMessage + 20, bigEndian_); + unsigned int eventY = GetUINT(inputMessage + 22, bigEndian_); + eventX -= rootX; + eventY -= rootY; + encodeBuffer.encodeCachedValue( + rootX - serverCache_ -> motionNotifyLastRootX, 16, + serverCache_ -> motionNotifyRootXCache, 8); + serverCache_ -> motionNotifyLastRootX = rootX; + encodeBuffer.encodeCachedValue( + rootY - serverCache_ -> motionNotifyLastRootY, 16, + serverCache_ -> motionNotifyRootYCache, 8); + serverCache_ -> motionNotifyLastRootY = rootY; + encodeBuffer.encodeCachedValue(eventX, 16, + serverCache_ -> motionNotifyEventXCache, 8); + encodeBuffer.encodeCachedValue(eventY, 16, + serverCache_ -> motionNotifyEventYCache, 8); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 24, bigEndian_), + 16, serverCache_ -> motionNotifyStateCache); + priority_++; + } + break; + case X_QueryTree: + { + // + // This was very inefficient. In practice + // it just copied data on the output. Now + // it obtains an average 7:1 compression + // and could optionally be cached. + // + + unsigned int children = GetUINT(inputMessage + 16, bigEndian_); + + encodeBuffer.encodeValue(children, 16, 8); + + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, + serverCache_ -> queryTreeWindowCache); + + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), 29, + serverCache_ -> queryTreeWindowCache); + + const unsigned char *next = inputMessage + 32; + + for (unsigned int i = 0; i < children; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(next + (i * 4), bigEndian_), 29, + serverCache_ -> queryTreeWindowCache); + } + + priority_++; + } + break; + case X_TranslateCoords: + { + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[1]); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> translateCoordsChildCache, 9); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 12, bigEndian_), + 16, serverCache_ -> translateCoordsXCache, 8); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 14, bigEndian_), + 16, serverCache_ -> translateCoordsYCache, 8); + priority_++; + } + break; + case X_GetImage: + { + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_GetImage); + + if (handleEncodeCached(encodeBuffer, serverCache_, messageStore, + inputMessage, inputLength)) + { + priority_++; + + hit = 1; + + break; + } + + // Depth. + encodeBuffer.encodeCachedValue(inputMessage[1], 8, + serverCache_ -> depthCache); + // Reply length. + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 9); + + // Visual. + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), 29, + serverCache_ -> visualCache); + + // Since ProtoStep8 (#issue 108) + handleCopy(encodeBuffer, requestOpcode, messageStore -> + dataOffset, inputMessage, inputLength); + + priority_++; + } + break; + case X_GetPointerMapping: + { + encodeBuffer.encodeValue(inputMessage[1], 8, 4); + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 4); + for (unsigned int i = 32; i < inputLength; i++) + encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8, 4); + + priority_++; + } + break; + case X_GetKeyboardControl: + { + encodeBuffer.encodeValue(inputMessage[1], 8, 2); + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 8); + for (unsigned int i = 8; i < inputLength; i++) + encodeBuffer.encodeValue((unsigned int) inputMessage[i], 8, 4); + + priority_++; + } + break; + default: + { + #ifdef PANIC + *logofs << "ServerChannel: PANIC! No matching request with " + << "OPCODE#" << (unsigned int) requestOpcode + << " for reply with sequence number " + << requestSequenceNum << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": No matching request with OPCODE#" + << (unsigned int) requestOpcode << " for reply with " + << "sequence number " << requestSequenceNum << ".\n"; + + return -1; + } + } + + bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + + const char *cacheString = (hit ? "cached " : ""); + + *logofs << "handleRead: Handled " << cacheString << "reply to OPCODE#" + << (unsigned int) requestOpcode << " (" << DumpOpcode(requestOpcode) + << ") for FD#" << fd_ << " sequence " << serverSequence_ + << ". " << inputLength << " bytes in, " << bits << " bits (" + << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; + + #endif + + } // End of if (sequenceQueue_.peek(requestSequenceNum, requestOpcode) && ... + else + { + // + // We didn't push the request opcode. + // Check if fast encoding is required. + // + + requestOpcode = X_Reply; + + if (control -> LocalDeltaCompression == 0) + { + int result = handleFastReadReply(encodeBuffer, requestOpcode, + inputMessage, inputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + // + // Group all replies whose opcode was not + // pushed in sequence number queue under + // the category 'generic reply'. + // + + #ifdef DEBUG + *logofs << "handleRead: Identified generic reply.\n" + << logofs_flush; + #endif + + MessageStore *messageStore = serverStore_ -> + getReplyStore(X_NXInternalGenericReply); + + hit = handleEncode(encodeBuffer, serverCache_, messageStore, + requestOpcode, inputMessage, inputLength); + + priority_++; + + bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + + const char *cacheString = (hit ? "cached " : ""); + + *logofs << "handleRead: Handled " << cacheString << "generic reply " + << "OPCODE#" << X_NXInternalGenericReply << " for FD#" << fd_ + << " sequence " << serverSequence_ << ". " << inputLength + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + + #endif + } + + if (hit) + { + statistics -> addCachedReply(requestOpcode); + } + + statistics -> addReplyBits(requestOpcode, inputLength << 3, bits); + + } // End of if (inputMessage[0] == 1) ... + else + { + // + // Event or error. + // + + unsigned char inputOpcode = *inputMessage; + + unsigned int inputSequence = GetUINT(inputMessage + 2, bigEndian_); + + // + // Check if this is an event which we can discard. + // + + if ((inputOpcode == Expose && enableExpose_ == 0) || + (inputOpcode == GraphicsExpose && enableGraphicsExpose_ == 0) || + (inputOpcode == NoExpose && enableNoExpose_ == 0)) + { + continue; + } + else if (shmemState_ != NULL && shmemState_ -> enabled == 1 && + inputOpcode == shmemState_ -> event && + checkShmemEvent(inputOpcode, inputSequence, + inputMessage) > 0) + { + continue; + } + else if (inputOpcode == MotionNotify) + { + // + // Save the motion event and send when another + // event or error is received or the motion ti- + // meout is elapsed. If a previous motion event + // was already saved, we replace it with the + // new one and don't reset the timeout, so we + // still have a motion event every given ms. + // + + memcpy(lastMotion_, inputMessage, 32); + + #ifdef TEST + *logofs << "handleRead: Saved suppressed motion event for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + continue; + } + else if (inputOpcode == X_Error) + { + // + // Check if this is an error that matches a + // sequence number for which we are expecting + // a reply. + // + + unsigned short int errorSequenceNum; + unsigned char errorOpcode; + + if (sequenceQueue_.peek(errorSequenceNum, errorOpcode) && + ((unsigned int) errorSequenceNum == inputSequence)) + { + sequenceQueue_.pop(errorSequenceNum, errorOpcode); + } + + // + // Check if error is due to an image commit + // generated at the end of a split. + // + + if (checkCommitError(*(inputMessage + 1), inputSequence, inputMessage) > 0) + { + #ifdef TEST + *logofs << "handleRead: Skipping error on image commit for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + continue; + } + + // + // Check if it's an error generated by a request + // concerning shared memory support. + // + + else if (shmemState_ != NULL && (shmemState_ -> sequence == + inputSequence || (shmemState_ -> enabled == 1 && + (shmemState_ -> opcode == *(inputMessage + 10) || + shmemState_ -> error == *(inputMessage + 1)))) && + checkShmemError(*(inputMessage + 1), inputSequence, + inputMessage) > 0) + { + #ifdef TEST + *logofs << "handleRead: Skipping error on shmem operation for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + continue; + } + } + // + // Check if user pressed the CTRL+ALT+SHIFT+ESC key + // sequence because was unable to kill the session + // through the normal procedure. + // + + if (inputOpcode == KeyPress) + { + if (checkKeyboardEvent(inputOpcode, inputSequence, inputMessage) == 1) + { + #ifdef TEST + *logofs << "handleRead: Removing the key sequence from the " + << "event stream for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + continue; + } + } + + // + // We are going to handle an event or error + // that's not a mouse motion. Prepend any + // saved motion to it. + // + + if (lastMotion_[0] != '\0') + { + if (handleMotion(encodeBuffer) < 0) + { + #ifdef PANIC + *logofs << "handleRead: PANIC! Can't encode motion event for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't encode motion event for FD#" + << fd_ << ".\n"; + + return -1; + } + } + + // + // Encode opcode and difference between + // current sequence and the last one. + // + + encodeBuffer.encodeOpcodeValue(inputOpcode, serverCache_ -> opcodeCache); + + unsigned int sequenceDiff = inputSequence - serverSequence_; + + serverSequence_ = inputSequence; + + #ifdef DEBUG + *logofs << "handleRead: Last server sequence number for FD#" + << fd_ << " is " << serverSequence_ << " with " + << "difference " << sequenceDiff << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sequenceDiff, 16, + serverCache_ -> eventSequenceCache, 7); + + // + // If differential compression is disabled + // then use the most simple encoding. + // + + if (control -> LocalDeltaCompression == 0) + { + int result = handleFastReadEvent(encodeBuffer, inputOpcode, + inputMessage, inputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + switch (inputOpcode) + { + case X_Error: + { + // + // Set the priority flag in the case of + // a X protocol error. This may restart + // the client if it was waiting for the + // reply. + // + + priority_++; + + unsigned char errorCode = *(inputMessage + 1); + + encodeBuffer.encodeCachedValue(errorCode, 8, + serverCache_ -> errorCodeCache); + + if (errorCode != 11 && errorCode != 8 && + errorCode != 15 && errorCode != 1) + { + encodeBuffer.encodeValue(GetULONG(inputMessage + 4, bigEndian_), 32, 16); + } + + if (errorCode >= 18) + { + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, + serverCache_ -> errorMinorCache); + } + + encodeBuffer.encodeCachedValue(inputMessage[10], 8, + serverCache_ -> errorMajorCache); + + if (errorCode >= 18) + { + const unsigned char *nextSrc = inputMessage + 11; + for (unsigned int i = 11; i < 32; i++) + encodeBuffer.encodeValue(*nextSrc++, 8); + } + } + break; + case ButtonPress: + case ButtonRelease: + case KeyPress: + case KeyRelease: + case MotionNotify: + case EnterNotify: + case LeaveNotify: + { + // + // Set the priority in the case this is + // an event that the remote side may + // care to receive as soon as possible. + // + + switch (inputOpcode) + { + case ButtonPress: + case ButtonRelease: + case KeyPress: + case KeyRelease: + { + priority_++; + } + } + + unsigned char detail = inputMessage[1]; + if (*inputMessage == MotionNotify) + encodeBuffer.encodeBoolValue((unsigned int) detail); + else if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) + encodeBuffer.encodeValue((unsigned int) detail, 3); + else if (*inputMessage == KeyRelease) + { + if (detail == serverCache_ -> keyPressLastKey) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue((unsigned int) detail, 8); + } + } + else if ((*inputMessage == ButtonPress) || (*inputMessage == ButtonRelease)) + encodeBuffer.encodeCachedValue(detail, 8, + serverCache_ -> buttonCache); + else + encodeBuffer.encodeValue((unsigned int) detail, 8); + unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); + unsigned int timestampDiff = + timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = timestamp; + encodeBuffer.encodeCachedValue(timestampDiff, 32, + serverCache_ -> motionNotifyTimestampCache, 9); + int skipRest = 0; + if (*inputMessage == KeyRelease) + { + skipRest = 1; + for (unsigned int i = 8; i < 31; i++) + { + if (inputMessage[i] != serverCache_ -> keyPressCache[i - 8]) + { + skipRest = 0; + break; + } + } + encodeBuffer.encodeBoolValue(skipRest); + } + + if (!skipRest) + { + const unsigned char *nextSrc = inputMessage + 8; + for (unsigned int i = 0; i < 3; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, + *serverCache_ -> motionNotifyWindowCache[i], 6); + nextSrc += 4; + } + unsigned int rootX = GetUINT(inputMessage + 20, bigEndian_); + unsigned int rootY = GetUINT(inputMessage + 22, bigEndian_); + unsigned int eventX = GetUINT(inputMessage + 24, bigEndian_); + unsigned int eventY = GetUINT(inputMessage + 26, bigEndian_); + eventX -= rootX; + eventY -= rootY; + encodeBuffer.encodeCachedValue(rootX - + serverCache_ -> motionNotifyLastRootX, 16, + serverCache_ -> motionNotifyRootXCache, 6); + serverCache_ -> motionNotifyLastRootX = rootX; + encodeBuffer.encodeCachedValue(rootY - + serverCache_ -> motionNotifyLastRootY, 16, + serverCache_ -> motionNotifyRootYCache, 6); + serverCache_ -> motionNotifyLastRootY = rootY; + encodeBuffer.encodeCachedValue(eventX, 16, + serverCache_ -> motionNotifyEventXCache, 6); + encodeBuffer.encodeCachedValue(eventY, 16, + serverCache_ -> motionNotifyEventYCache, 6); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 28, bigEndian_), + 16, serverCache_ -> motionNotifyStateCache); + if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) + encodeBuffer.encodeValue((unsigned int) inputMessage[30], 2); + else + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[30]); + if ((*inputMessage == EnterNotify) || (*inputMessage == LeaveNotify)) + encodeBuffer.encodeValue((unsigned int) inputMessage[31], 2); + else if (*inputMessage == KeyPress) + { + serverCache_ -> keyPressLastKey = detail; + for (unsigned int i = 8; i < 31; i++) + { + serverCache_ -> keyPressCache[i - 8] = inputMessage[i]; + } + } + } + } + break; + case ColormapNotify: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> colormapNotifyWindowCache, 8); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> colormapNotifyColormapCache, 8); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[13]); + } + break; + case ConfigureNotify: + { + const unsigned char *nextSrc = inputMessage + 4; + for (unsigned int i = 0; i < 3; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, + *serverCache_ -> configureNotifyWindowCache[i], 9); + nextSrc += 4; + } + for (unsigned int j = 0; j < 5; j++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *serverCache_ -> configureNotifyGeomCache[j], 8); + nextSrc += 2; + } + encodeBuffer.encodeBoolValue(*nextSrc); + } + break; + case CreateNotify: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> createNotifyWindowCache, 9); + unsigned int window = GetULONG(inputMessage + 8, bigEndian_); + encodeBuffer.encodeValue(window - + serverCache_ -> createNotifyLastWindow, 29, 5); + serverCache_ -> createNotifyLastWindow = window; + const unsigned char* nextSrc = inputMessage + 12; + for (unsigned int i = 0; i < 5; i++) + { + encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 9); + nextSrc += 2; + } + encodeBuffer.encodeBoolValue(*nextSrc); + } + break; + case Expose: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), 29, + serverCache_ -> exposeWindowCache, 9); + const unsigned char *nextSrc = inputMessage + 8; + for (unsigned int i = 0; i < 5; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(nextSrc, bigEndian_), 16, + *serverCache_ -> exposeGeomCache[i], 6); + nextSrc += 2; + } + } + break; + case FocusIn: + case FocusOut: + { + encodeBuffer.encodeValue((unsigned int) inputMessage[1], 3); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> focusInWindowCache, 9); + encodeBuffer.encodeValue((unsigned int) inputMessage[8], 2); + } + break; + case KeymapNotify: + { + if (ServerCache::lastKeymap.compare(31, inputMessage + 1)) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + const unsigned char *nextSrc = inputMessage + 1; + for (unsigned int i = 1; i < 32; i++) + encodeBuffer.encodeValue((unsigned int) *nextSrc++, 8); + } + } + break; + case MapNotify: + case UnmapNotify: + case DestroyNotify: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> mapNotifyEventCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> mapNotifyWindowCache, 9); + if ((*inputMessage == MapNotify) || (*inputMessage == UnmapNotify)) + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[12]); + } + break; + case NoExpose: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> noExposeDrawableCache, 9); + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + 8, bigEndian_), 16, + serverCache_ -> noExposeMinorCache); + encodeBuffer.encodeCachedValue(inputMessage[10], 8, + serverCache_ -> noExposeMajorCache); + } + break; + case PropertyNotify: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> propertyNotifyWindowCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> propertyNotifyAtomCache, 9); + unsigned int timestamp = GetULONG(inputMessage + 12, bigEndian_); + unsigned int timestampDiff = + timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = timestamp; + encodeBuffer.encodeValue(timestampDiff, 32, 9); + encodeBuffer.encodeBoolValue((unsigned int) inputMessage[16]); + } + break; + case ReparentNotify: + { + const unsigned char* nextSrc = inputMessage + 4; + for (unsigned int i = 0; i < 3; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), + 29, serverCache_ -> reparentNotifyWindowCache, 9); + nextSrc += 4; + } + encodeBuffer.encodeValue(GetUINT(nextSrc, bigEndian_), 16, 6); + encodeBuffer.encodeValue(GetUINT(nextSrc + 2, bigEndian_), 16, 6); + encodeBuffer.encodeBoolValue((unsigned int)inputMessage[20]); + } + break; + case SelectionClear: + { + unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); + unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = timestamp; + encodeBuffer.encodeValue(timestampDiff, 32, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> selectionClearWindowCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), + 29, serverCache_ -> selectionClearAtomCache, 9); + } + break; + case SelectionRequest: + { + unsigned int timestamp = GetULONG(inputMessage + 4, bigEndian_); + unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = timestamp; + encodeBuffer.encodeValue(timestampDiff, 32, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 8, bigEndian_), + 29, serverCache_ -> selectionClearWindowCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 12, bigEndian_), + 29, serverCache_ -> selectionClearWindowCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 16, bigEndian_), + 29, serverCache_ -> selectionClearAtomCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 20, bigEndian_), + 29, serverCache_ -> selectionClearAtomCache, 9); + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 24, bigEndian_), + 29, serverCache_ -> selectionClearAtomCache, 9); + } + break; + case VisibilityNotify: + { + encodeBuffer.encodeCachedValue(GetULONG(inputMessage + 4, bigEndian_), + 29, serverCache_ -> visibilityNotifyWindowCache, 9); + encodeBuffer.encodeValue((unsigned int) inputMessage[8], 2); + } + break; + default: + { + #ifdef TEST + *logofs << "handleRead: Using generic event compression " + << "for OPCODE#" << (unsigned int) inputOpcode + << ".\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(*(inputMessage + 1), 8, + serverCache_ -> genericEventCharCache); + + for (unsigned int i = 0; i < 14; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(inputMessage + i * 2 + 4, bigEndian_), + 16, *serverCache_ -> genericEventIntCache[i]); + } + } + + } // switch (inputOpcode)... + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + + if (*inputMessage == X_Error) + { + unsigned char code = *(inputMessage + 1); + + *logofs << "handleRead: Handled error ERR_CODE#" + << (unsigned int) code << " for FD#" << fd_; + + *logofs << " RES_ID#" << GetULONG(inputMessage + 4, bigEndian_); + + *logofs << " MIN_OP#" << GetUINT(inputMessage + 8, bigEndian_); + + *logofs << " MAJ_OP#" << (unsigned int) *(inputMessage + 10); + + *logofs << " sequence " << inputSequence << ". " << inputLength + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + } + else + { + *logofs << "handleRead: Handled event OPCODE#" + << (unsigned int) *inputMessage << " for FD#" << fd_ + << " sequence " << inputSequence << ". " << inputLength + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + } + + #endif + + statistics -> addEventBits(*inputMessage, inputLength << 3, bits); + + } // End of if (inputMessage[0] == X_Reply) ... else ... + + } // End of if (firstReply_) ... else ... + + } // End of while ((inputMessage = readBuffer_.getMessage(inputLength)) != 0) ... + + // + // Check if we need to flush because of + // prioritized data. + // + + if (priority_ > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: WARNING! Requesting flush " + << "because of " << priority_ << " prioritized " + << "messages for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncPriority() < 0) + { + return -1; + } + + // + // Reset the priority flag. + // + + priority_ = 0; + } + + // + // Flush if we produced enough data. + // + + if (proxy -> canAsyncFlush() == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleRead: WARNING! Requesting flush " + << "because of token length exceeded.\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncFlush() < 0) + { + return -1; + } + } + + #if defined(TEST) || defined(INFO) + + if (transport_ -> pending() != 0 || + readBuffer_.checkMessage() != 0) + { + *logofs << "handleRead: PANIC! Buffer for X descriptor FD#" + << fd_ << " has " << transport_ -> pending() + << " bytes to read.\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // Reset the read buffer. + // + + readBuffer_.fullReset(); + + return 1; +} + +// +// End of handleRead(). +// + +// +// Beginning of handleWrite(). +// + +int ServerChannel::handleWrite(const unsigned char *message, unsigned int length) +{ + #ifdef TEST + *logofs << "handleWrite: Called for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + // + // Create the buffer from which to + // decode messages. + // + + DecodeBuffer decodeBuffer(message, length); + + #if defined(TEST) || defined(INFO) || defined(FLUSH) + *logofs << "handleWrite: Decoding messages for FD#" << fd_ + << " with " << length << " bytes in the buffer.\n" + << logofs_flush; + #endif + + if (firstRequest_) + { + // + // Need to add the length of the first request + // because it was not present in the previous + // versions. Length of the first request was + // assumed to be the same as the encode buffer + // but this may be not the case if a different + // encoding is used. + // + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeValue(length, 8); + + unsigned int nextByte; + unsigned char *outputMessage = writeBuffer_.addMessage(length); + unsigned char *nextDest = outputMessage; + + for (unsigned int i = 0; i < length; i++) + { + decodeBuffer.decodeValue(nextByte, 8); + + *nextDest++ = (unsigned char) nextByte; + } + + if (*outputMessage == 0x42) + { + setBigEndian(1); + } + else + { + setBigEndian(0); + } + + #ifdef TEST + *logofs << "handleWrite: First request detected.\n" << logofs_flush; + #endif + + // + // Handle the fake authorization cookie. + // + + if (handleAuthorization(outputMessage) < 0) + { + return -1; + } + + firstRequest_ = 0; + + } // End of if (firstRequest_) + + // + // This was previously in a 'else' block. + // Due to the way the first request was + // handled, we could not decode multiple + // messages in the first frame. + // + + { // Start of the decoding block. + + unsigned char outputOpcode; + + unsigned char *outputMessage; + unsigned int outputLength; + + // + // Set when message is found in cache. + // + + int hit; + + while (decodeBuffer.decodeOpcodeValue(outputOpcode, clientCache_ -> opcodeCache, 1)) + { + hit = 0; + + // + // Splits are sent by client proxy outside the + // normal read loop. As we 'insert' splits in + // the real client-server X protocol, we must + // avoid to increment the sequence number or + // our clients would get confused. + // + + if (outputOpcode != opcodeStore_ -> splitData) + { + clientSequence_++; + clientSequence_ &= 0xffff; + + #ifdef DEBUG + *logofs << "handleWrite: Last client sequence number for FD#" + << fd_ << " is " << clientSequence_ << ".\n" + << logofs_flush; + #endif + } + else + { + // + // It's a split, not a normal + // burst of proxy data. + // + + handleSplit(decodeBuffer); + + continue; + } + + #ifdef SUSPEND + + if (clientSequence_ == 1000) + { + cerr << "Warning" << ": Exiting to test the resilience of the agent.\n"; + + sleep(2); + + HandleAbort(); + } + + #endif + + // + // Is differential encoding disabled? + // + + if (control -> RemoteDeltaCompression == 0) + { + int result = handleFastWriteRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength); + if (result < 0) + { + return -1; + } + else if (result > 0) + { + continue; + } + } + + // + // General-purpose temp variables for + // decoding ints and chars. + // + + unsigned int value; + unsigned char cValue; + + #ifdef DEBUG + *logofs << "handleWrite: Going to handle request OPCODE#" + << (unsigned int) outputOpcode << " (" << DumpOpcode(outputOpcode) + << ") for FD#" << fd_ << " sequence " << clientSequence_ + << ".\n" << logofs_flush; + #endif + + switch (outputOpcode) + { + case X_AllocColor: + { + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> colormapCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 8; + unsigned int colorData[3]; + + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *(clientCache_ -> allocColorRGBCache[i]), 4); + PutUINT(value, nextDest, bigEndian_); + colorData[i] = value; + nextDest += 2; + } + + sequenceQueue_.push(clientSequence_, outputOpcode, + colorData[0], colorData[1], colorData[2]); + } + break; + case X_ReparentWindow: + { + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 16, 11); + PutUINT(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeValue(value, 16, 11); + PutUINT(value, outputMessage + 14, bigEndian_); + } + break; + case X_ChangeProperty: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ChangeProperty); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned char format; + decodeBuffer.decodeCachedValue(format, 8, + clientCache_ -> changePropertyFormatCache); + unsigned int dataLength; + decodeBuffer.decodeValue(dataLength, 32, 6); + outputLength = 24 + RoundUp4(dataLength * (format >> 3)); + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 2); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> changePropertyPropertyCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> changePropertyTypeCache, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + outputMessage[16] = format; + PutULONG(dataLength, outputMessage + 20, bigEndian_); + unsigned char *nextDest = outputMessage + 24; + + if (format == 8) + { + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, dataLength); + } + else if (format == 32) + { + for (unsigned int i = 0; i < dataLength; i++) + { + decodeBuffer.decodeCachedValue(value, 32, + clientCache_ -> changePropertyData32Cache); + + PutULONG(value, nextDest, bigEndian_); + + nextDest += 4; + } + } + else + { + for (unsigned int i = 0; i < dataLength; i++) + { + decodeBuffer.decodeValue(value, 16); + + PutUINT(value, nextDest, bigEndian_); + + nextDest += 2; + } + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_SendEvent: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_SendEvent); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 44; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + *(outputMessage + 1) = value; + decodeBuffer.decodeBoolValue(value); + if (value) + { + decodeBuffer.decodeBoolValue(value); + } + else + { + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + } + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 32, + clientCache_ -> sendEventMaskCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(*(outputMessage + 12), 8, + clientCache_ -> sendEventCodeCache); + decodeBuffer.decodeCachedValue(*(outputMessage + 13), 8, + clientCache_ -> sendEventByteDataCache); + decodeBuffer.decodeValue(value, 16, 4); + clientCache_ -> sendEventLastSequence += value; + clientCache_ -> sendEventLastSequence &= 0xffff; + PutUINT(clientCache_ -> sendEventLastSequence, outputMessage + 14, bigEndian_); + decodeBuffer.decodeCachedValue(value, 32, + clientCache_ -> sendEventIntDataCache); + PutULONG(value, outputMessage + 16, bigEndian_); + + for (unsigned int i = 20; i < 44; i++) + { + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> sendEventEventCache); + *(outputMessage + i) = cValue; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_ChangeWindowAttributes: + { + unsigned int numAttrs; + decodeBuffer.decodeValue(numAttrs, 4); + outputLength = 12 + (numAttrs << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned int bitmask; + decodeBuffer.decodeCachedValue(bitmask, 15, + clientCache_ -> createWindowBitmaskCache); + PutULONG(bitmask, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + unsigned int mask = 0x1; + for (unsigned int i = 0; i < 15; i++) + { + if (bitmask & mask) + { + decodeBuffer.decodeCachedValue(value, 32, + *clientCache_ -> createWindowAttrCache[i]); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + mask <<= 1; + } + } + break; + case X_ClearArea: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ClearArea); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 8; + for (unsigned int i = 0; i < 4; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> clearAreaGeomCache[i], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_CloseFont: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 29, 5); + clientCache_ -> lastFont += value; + clientCache_ -> lastFont &= 0x1fffffff; + PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); + } + break; + case X_ConfigureWindow: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ConfigureWindow); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned int bitmask; + decodeBuffer.decodeCachedValue(bitmask, 7, + clientCache_ -> configureWindowBitmaskCache); + PutUINT(bitmask, outputMessage + 8, bigEndian_); + unsigned int mask = 0x1; + for (unsigned int i = 0; i < 7; i++) + { + if (bitmask & mask) + { + unsigned char* nextDest = writeBuffer_.addMessage(4); + outputLength += 4; + decodeBuffer.decodeCachedValue(value, CONFIGUREWINDOW_FIELD_WIDTH[i], + *clientCache_ -> configureWindowAttrCache[i], 8); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + mask <<= 1; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_ConvertSelection: + { + outputLength = 24; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> convertSelectionRequestorCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned char* nextDest = outputMessage + 8; + for (unsigned int i = 0; i < 3; i++) + { + decodeBuffer.decodeCachedValue(value, 29, + *(clientCache_ -> convertSelectionAtomCache[i]), 9); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + } + decodeBuffer.decodeValue(value, 32, 4); + clientCache_ -> convertSelectionLastTimestamp += value; + PutULONG(clientCache_ -> convertSelectionLastTimestamp, + nextDest, bigEndian_); + } + break; + case X_CopyArea: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_CopyArea); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 28; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 12, bigEndian_); + unsigned char *nextDest = outputMessage + 16; + for (unsigned int i = 0; i < 6; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> copyAreaGeomCache[i], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_CopyGC: + { + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 23, + clientCache_ -> createGCBitmaskCache); + PutULONG(value, outputMessage + 12, bigEndian_); + } + break; + case X_CopyPlane: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 12, bigEndian_); + unsigned char *nextDest = outputMessage + 16; + for (unsigned int i = 0; i < 6; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> copyPlaneGeomCache[i], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + decodeBuffer.decodeCachedValue(value, 32, + clientCache_ -> copyPlaneBitPlaneCache, 10); + PutULONG(value, outputMessage + 28, bigEndian_); + } + break; + case X_CreateGC: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_CreateGC); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId, + clientCache_ -> lastIdCache, clientCache_ -> gcCache, + clientCache_ -> freeGCCache); + + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned int offset = 8; + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + offset, bigEndian_); + offset += 4; + unsigned int bitmask; + decodeBuffer.decodeCachedValue(bitmask, 23, + clientCache_ -> createGCBitmaskCache); + PutULONG(bitmask, outputMessage + offset, bigEndian_); + unsigned int mask = 0x1; + for (unsigned int i = 0; i < 23; i++) + { + if (bitmask & mask) + { + unsigned char* nextDest = writeBuffer_.addMessage(4); + outputLength += 4; + unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; + if (fieldWidth <= 4) + decodeBuffer.decodeValue(value, fieldWidth); + else + decodeBuffer.decodeCachedValue(value, fieldWidth, + *clientCache_ -> createGCAttrCache[i]); + PutULONG(value, nextDest, bigEndian_); + } + mask <<= 1; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_ChangeGC: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ChangeGC); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned int offset = 8; + unsigned int bitmask; + decodeBuffer.decodeCachedValue(bitmask, 23, + clientCache_ -> createGCBitmaskCache); + PutULONG(bitmask, outputMessage + offset, bigEndian_); + unsigned int mask = 0x1; + for (unsigned int i = 0; i < 23; i++) + { + if (bitmask & mask) + { + unsigned char* nextDest = writeBuffer_.addMessage(4); + outputLength += 4; + unsigned int fieldWidth = CREATEGC_FIELD_WIDTH[i]; + if (fieldWidth <= 4) + decodeBuffer.decodeValue(value, fieldWidth); + else + decodeBuffer.decodeCachedValue(value, fieldWidth, + *clientCache_ -> createGCAttrCache[i]); + PutULONG(value, nextDest, bigEndian_); + } + mask <<= 1; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_CreatePixmap: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_CreatePixmap); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + } + break; + case X_CreateWindow: + { + outputLength = 32; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> depthCache); + outputMessage[1] = cValue; + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 8, bigEndian_); + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeNewXidValue(value, clientCache_ -> lastId, + clientCache_ -> lastIdCache, clientCache_ -> windowCache, + clientCache_ -> freeWindowCache); + + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + unsigned int i; + for (i = 0; i < 6; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> createWindowGeomCache[i], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> visualCache); + PutULONG(value, outputMessage + 24, bigEndian_); + unsigned int bitmask; + decodeBuffer.decodeCachedValue(bitmask, 15, + clientCache_ -> createWindowBitmaskCache); + PutULONG(bitmask, outputMessage + 28, bigEndian_); + unsigned int mask = 0x1; + for (i = 0; i < 15; i++) + { + if (bitmask & mask) + { + nextDest = writeBuffer_.addMessage(4); + outputLength += 4; + decodeBuffer.decodeCachedValue(value, 32, + *clientCache_ -> createWindowAttrCache[i]); + PutULONG(value, nextDest, bigEndian_); + } + mask <<= 1; + } + writeBuffer_.unregisterPointer(); + } + break; + case X_DeleteProperty: + { + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 29, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + } + break; + case X_FillPoly: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_FillPoly); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int numPoints; + + // Since ProtoStep10 (#issue 108) + decodeBuffer.decodeCachedValue(numPoints, 16, + clientCache_ -> fillPolyNumPointsCache, 4); + + outputLength = 16 + (numPoints << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 2); + outputMessage[12] = (unsigned char) value; + unsigned int relativeCoordMode; + decodeBuffer.decodeBoolValue(relativeCoordMode); + outputMessage[13] = (unsigned char) relativeCoordMode; + unsigned char *nextDest = outputMessage + 16; + unsigned int pointIndex = 0; + for (unsigned int i = 0; i < numPoints; i++) + { + if (relativeCoordMode) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> fillPolyXRelCache[pointIndex], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> fillPolyYRelCache[pointIndex], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + else + { + unsigned int x, y; + decodeBuffer.decodeBoolValue(value); + if (value) + { + decodeBuffer.decodeValue(value, 3); + x = clientCache_ -> fillPolyRecentX[value]; + y = clientCache_ -> fillPolyRecentY[value]; + } + else + { + decodeBuffer.decodeCachedValue(x, 16, + *clientCache_ -> fillPolyXAbsCache[pointIndex], 8); + decodeBuffer.decodeCachedValue(y, 16, + *clientCache_ -> fillPolyYAbsCache[pointIndex], 8); + clientCache_ -> fillPolyRecentX[clientCache_ -> fillPolyIndex] = x; + clientCache_ -> fillPolyRecentY[clientCache_ -> fillPolyIndex] = y; + clientCache_ -> fillPolyIndex++; + if (clientCache_ -> fillPolyIndex == 8) + clientCache_ -> fillPolyIndex = 0; + } + PutUINT(x, nextDest, bigEndian_); + nextDest += 2; + PutUINT(y, nextDest, bigEndian_); + nextDest += 2; + } + + if (++pointIndex == 10) pointIndex = 0; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_FreeColors: + { + unsigned int numPixels; + decodeBuffer.decodeValue(numPixels, 16, 4); + outputLength = 12 + (numPixels << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> colormapCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 32, 4); + PutULONG(value, outputMessage + 8, bigEndian_); + unsigned char* nextDest = outputMessage + 12; + while (numPixels) + { + decodeBuffer.decodeValue(value, 32, 8); + PutULONG(value, nextDest, bigEndian_); + nextDest += 4; + numPixels--; + } + } + break; + case X_FreeCursor: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> cursorCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + } + break; + case X_FreeGC: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeGCCache); + + PutULONG(value, outputMessage + 4, bigEndian_); + } + break; + case X_FreePixmap: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeDrawableCache); + + PutULONG(value, outputMessage + 4, bigEndian_); + } + break; + case X_GetAtomName: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 29, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GetGeometry: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GetInputFocus: + { + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + + sequenceQueue_.push(clientSequence_, outputOpcode, outputOpcode); + } + break; + case X_GetModifierMapping: + { + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GetKeyboardMapping: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 8); + outputMessage[4] = value; + decodeBuffer.decodeValue(value, 8); + outputMessage[5] = value; + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GetProperty: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_GetProperty); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + // + // Save a reference to identify the reply. + // + + unsigned int property = GetULONG(outputMessage + 8, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode, property); + + break; + } + + outputLength = 24; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned int property; + decodeBuffer.decodeValue(property, 29, 9); + PutULONG(property, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 29, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeValue(value, 32, 2); + PutULONG(value, outputMessage + 16, bigEndian_); + decodeBuffer.decodeValue(value, 32, 8); + PutULONG(value, outputMessage + 20, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode, property); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_GetSelectionOwner: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> getSelectionOwnerSelectionCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GrabButton: + case X_GrabPointer: + { + outputLength = 24; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> grabButtonEventMaskCache); + PutUINT(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[10] = (unsigned char) value; + decodeBuffer.decodeBoolValue(value); + outputMessage[11] = (unsigned char) value; + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> grabButtonConfineCache, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> cursorCache, 9); + PutULONG(value, outputMessage + 16, bigEndian_); + if (outputOpcode == X_GrabButton) + { + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> grabButtonButtonCache); + outputMessage[20] = cValue; + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> grabButtonModifierCache); + PutUINT(value, outputMessage + 22, bigEndian_); + } + else + { + decodeBuffer.decodeValue(value, 32, 4); + clientCache_ -> grabKeyboardLastTimestamp += value; + PutULONG(clientCache_ -> grabKeyboardLastTimestamp, + outputMessage + 20, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + } + break; + case X_GrabKeyboard: + { + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 32, 4); + clientCache_ -> grabKeyboardLastTimestamp += value; + PutULONG(clientCache_ -> grabKeyboardLastTimestamp, outputMessage + 8, + bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[12] = (unsigned char) value; + decodeBuffer.decodeBoolValue(value); + outputMessage[13] = (unsigned char) value; + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GrabServer: + case X_UngrabServer: + case X_NoOperation: + { + #ifdef DEBUG + *logofs << "handleWrite: Managing (probably tainted) X_NoOperation request for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + } + break; + case X_PolyText8: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyText8); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> polyTextCacheX); + clientCache_ -> polyTextLastX += value; + clientCache_ -> polyTextLastX &= 0xffff; + PutUINT(clientCache_ -> polyTextLastX, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> polyTextCacheY); + clientCache_ -> polyTextLastY += value; + clientCache_ -> polyTextLastY &= 0xffff; + PutUINT(clientCache_ -> polyTextLastY, outputMessage + 14, bigEndian_); + unsigned int addedLength = 0; + writeBuffer_.registerPointer(&outputMessage); + for (;;) + { + decodeBuffer.decodeBoolValue(value); + if (!value) + break; + unsigned int textLength; + decodeBuffer.decodeValue(textLength, 8); + if (textLength == 255) + { + addedLength += 5; + unsigned char *nextSegment = writeBuffer_.addMessage(5); + *nextSegment = (unsigned char) textLength; + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> polyTextFontCache); + PutULONG(value, nextSegment + 1, 1); + } + else + { + addedLength += (textLength + 2); + unsigned char *nextSegment = + writeBuffer_.addMessage(textLength + 2); + *nextSegment = (unsigned char) textLength; + unsigned char *nextDest = nextSegment + 1; + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> polyTextDeltaCache); + *nextDest++ = cValue; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, textLength); + + nextDest += textLength; + } + } + outputLength += addedLength; + unsigned int mod4 = (addedLength & 0x3); + if (mod4) + { + unsigned int extra = 4 - mod4; + unsigned char *nextDest = writeBuffer_.addMessage(extra); + for (unsigned int i = 0; i < extra; i++) + *nextDest++ = 0; + outputLength += extra; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PolyText16: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyText16); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> polyTextCacheX); + clientCache_ -> polyTextLastX += value; + clientCache_ -> polyTextLastX &= 0xffff; + PutUINT(clientCache_ -> polyTextLastX, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> polyTextCacheY); + clientCache_ -> polyTextLastY += value; + clientCache_ -> polyTextLastY &= 0xffff; + PutUINT(clientCache_ -> polyTextLastY, outputMessage + 14, bigEndian_); + unsigned int addedLength = 0; + writeBuffer_.registerPointer(&outputMessage); + for (;;) + { + decodeBuffer.decodeBoolValue(value); + if (!value) + break; + unsigned int textLength; + decodeBuffer.decodeValue(textLength, 8); + if (textLength == 255) + { + addedLength += 5; + unsigned char *nextSegment = writeBuffer_.addMessage(5); + *nextSegment = (unsigned char) textLength; + decodeBuffer.decodeCachedValue(value, 29, clientCache_ -> polyTextFontCache); + PutULONG(value, nextSegment + 1, 1); + } + else + { + addedLength += (textLength * 2 + 2); + unsigned char *nextSegment = + writeBuffer_.addMessage(textLength * 2 + 2); + *nextSegment = (unsigned char) textLength; + unsigned char *nextDest = nextSegment + 1; + decodeBuffer.decodeCachedValue(cValue, 8, clientCache_ -> polyTextDeltaCache); + *nextDest++ = cValue; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, textLength * 2); + + nextDest += textLength * 2; + } + } + outputLength += addedLength; + + unsigned int mod4 = (addedLength & 0x3); + if (mod4) + { + unsigned int extra = 4 - mod4; + unsigned char *nextDest = writeBuffer_.addMessage(extra); + for (unsigned int i = 0; i < extra; i++) + *nextDest++ = 0; + outputLength += extra; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_ImageText8: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ImageText8); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int textLength; + decodeBuffer.decodeCachedValue(textLength, 8, + clientCache_ -> imageTextLengthCache, 4); + outputLength = 16 + RoundUp4(textLength); + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) textLength; + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> imageTextCacheX); + clientCache_ -> imageTextLastX += value; + clientCache_ -> imageTextLastX &= 0xffff; + PutUINT(clientCache_ -> imageTextLastX, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> imageTextCacheY); + clientCache_ -> imageTextLastY += value; + clientCache_ -> imageTextLastY &= 0xffff; + PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_); + unsigned char *nextDest = outputMessage + 16; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, textLength); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_ImageText16: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_ImageText16); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int textLength; + decodeBuffer.decodeCachedValue(textLength, 8, + clientCache_ -> imageTextLengthCache, 4); + outputLength = 16 + RoundUp4(textLength * 2); + outputMessage = writeBuffer_.addMessage(outputLength); + outputMessage[1] = (unsigned char) textLength; + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> imageTextCacheX); + clientCache_ -> imageTextLastX += value; + clientCache_ -> imageTextLastX &= 0xffff; + PutUINT(clientCache_ -> imageTextLastX, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> imageTextCacheY); + clientCache_ -> imageTextLastY += value; + clientCache_ -> imageTextLastY &= 0xffff; + PutUINT(clientCache_ -> imageTextLastY, outputMessage + 14, bigEndian_); + unsigned char *nextDest = outputMessage + 16; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, textLength * 2); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_InternAtom: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_InternAtom); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + sequenceQueue_.push(clientSequence_, outputOpcode); + + break; + } + + unsigned int nameLength; + decodeBuffer.decodeValue(nameLength, 16, 6); + outputLength = RoundUp4(nameLength) + 8; + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(nameLength, outputMessage + 4, bigEndian_); + decodeBuffer.decodeBoolValue(value); + outputMessage[1] = (unsigned char) value; + unsigned char *nextDest = outputMessage + 8; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, nameLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_ListExtensions: + { + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_ListFonts: + { + unsigned int textLength; + decodeBuffer.decodeValue(textLength, 16, 6); + outputLength = 8 + RoundUp4(textLength); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(textLength, outputMessage + 6, bigEndian_); + decodeBuffer.decodeValue(value, 16, 6); + PutUINT(value, outputMessage + 4, bigEndian_); + unsigned char* nextDest = outputMessage + 8; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, textLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_LookupColor: + case X_AllocNamedColor: + { + unsigned int textLength; + decodeBuffer.decodeValue(textLength, 16, 6); + outputLength = 12 + RoundUp4(textLength); + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> colormapCache); + PutULONG(value, outputMessage + 4, bigEndian_); + PutUINT(textLength, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, textLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_MapWindow: + case X_UnmapWindow: + case X_MapSubwindows: + case X_GetWindowAttributes: + case X_DestroyWindow: + case X_DestroySubwindows: + case X_QueryPointer: + case X_QueryTree: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + + if (outputOpcode == X_DestroyWindow) // Since ProtoStep7 (#issue 108) + { + decodeBuffer.decodeFreeXidValue(value, clientCache_ -> freeWindowCache); + } + else + { + decodeBuffer.decodeXidValue(value, clientCache_ -> windowCache); + } + + PutULONG(value, outputMessage + 4, bigEndian_); + if (outputOpcode == X_QueryPointer || + outputOpcode == X_GetWindowAttributes || + outputOpcode == X_QueryTree) + { + sequenceQueue_.push(clientSequence_, outputOpcode); + } + } + break; + case X_OpenFont: + { + unsigned int nameLength; + decodeBuffer.decodeValue(nameLength, 16, 7); + outputLength = RoundUp4(12 + nameLength); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(nameLength, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 29, 5); + clientCache_ -> lastFont += value; + clientCache_ -> lastFont &= 0x1fffffff; + PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeTextData(nextDest, nameLength); + } + break; + case X_PolyFillRectangle: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyFillRectangle); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0, lastWidth = 0, lastHeight = 0; + unsigned int numRectangles = 0; + + for (;;) + { + outputLength += 8; + writeBuffer_.addMessage(8); + unsigned char *nextDest = outputMessage + 12 + + (numRectangles << 3); + numRectangles++; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillRectangleCacheX[index], 8); + value += lastX; + PutUINT(value, nextDest, bigEndian_); + lastX = value; + nextDest += 2; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillRectangleCacheY[index], 8); + value += lastY; + PutUINT(value, nextDest, bigEndian_); + lastY = value; + nextDest += 2; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillRectangleCacheWidth[index], 8); + value += lastWidth; + PutUINT(value, nextDest, bigEndian_); + lastWidth = value; + nextDest += 2; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillRectangleCacheHeight[index], 8); + value += lastHeight; + PutUINT(value, nextDest, bigEndian_); + lastHeight = value; + nextDest += 2; + + if (++index == 4) index = 0; + + decodeBuffer.decodeBoolValue(value); + + if (!value) break; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PolyFillArc: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyFillArc); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0, + lastWidth = 0, lastHeight = 0, + lastAngle1 = 0, lastAngle2 = 0; + + unsigned int numArcs = 0; + + for (;;) + { + outputLength += 12; + writeBuffer_.addMessage(12); + + unsigned char *nextDest = outputMessage + 12 + + (numArcs * 12); + numArcs++; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillArcCacheX[index], 8); + value += lastX; + PutUINT(value, nextDest, bigEndian_); + lastX = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillArcCacheY[index], 8); + value += lastY; + PutUINT(value, nextDest, bigEndian_); + lastY = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillArcCacheWidth[index], 8); + value += lastWidth; + PutUINT(value, nextDest, bigEndian_); + lastWidth = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillArcCacheHeight[index], 8); + value += lastHeight; + PutUINT(value, nextDest, bigEndian_); + lastHeight = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillArcCacheAngle1[index], 8); + value += lastAngle1; + PutUINT(value, nextDest, bigEndian_); + lastAngle1 = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyFillArcCacheAngle2[index], 8); + value += lastAngle2; + PutUINT(value, nextDest, bigEndian_); + lastAngle2 = value; + nextDest += 2; + + if (++index == 2) index = 0; + + decodeBuffer.decodeBoolValue(value); + + if (!value) break; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PolyArc: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyArc); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + writeBuffer_.registerPointer(&outputMessage); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0, + lastWidth = 0, lastHeight = 0, + lastAngle1 = 0, lastAngle2 = 0; + + unsigned int numArcs = 0; + + for (;;) + { + outputLength += 12; + writeBuffer_.addMessage(12); + + unsigned char *nextDest = outputMessage + 12 + + (numArcs * 12); + numArcs++; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyArcCacheX[index], 8); + value += lastX; + PutUINT(value, nextDest, bigEndian_); + lastX = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyArcCacheY[index], 8); + value += lastY; + PutUINT(value, nextDest, bigEndian_); + lastY = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyArcCacheWidth[index], 8); + value += lastWidth; + PutUINT(value, nextDest, bigEndian_); + lastWidth = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyArcCacheHeight[index], 8); + value += lastHeight; + PutUINT(value, nextDest, bigEndian_); + lastHeight = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyArcCacheAngle1[index], 8); + value += lastAngle1; + PutUINT(value, nextDest, bigEndian_); + lastAngle1 = value; + nextDest += 2; + + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyArcCacheAngle2[index], 8); + value += lastAngle2; + PutUINT(value, nextDest, bigEndian_); + lastAngle2 = value; + nextDest += 2; + + if (++index == 2) index = 0; + + decodeBuffer.decodeBoolValue(value); + + if (!value) break; + } + writeBuffer_.unregisterPointer(); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PolyPoint: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyPoint); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int numPoints; + decodeBuffer.decodeValue(numPoints, 16, 4); + outputLength = (numPoints << 2) + 12; + outputMessage = writeBuffer_.addMessage(outputLength); + unsigned int relativeCoordMode; + decodeBuffer.decodeBoolValue(relativeCoordMode); + outputMessage[1] = (unsigned char) relativeCoordMode; + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + + for (unsigned int i = 0; i < numPoints; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyPointCacheX[index], 8); + lastX += value; + PutUINT(lastX, nextDest, bigEndian_); + nextDest += 2; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyPointCacheY[index], 8); + lastY += value; + PutUINT(lastY, nextDest, bigEndian_); + nextDest += 2; + + if (++index == 2) index = 0; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PolyLine: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolyLine); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int numPoints; + decodeBuffer.decodeValue(numPoints, 16, 4); + outputLength = (numPoints << 2) + 12; + outputMessage = writeBuffer_.addMessage(outputLength); + unsigned int relativeCoordMode; + decodeBuffer.decodeBoolValue(relativeCoordMode); + outputMessage[1] = (unsigned char) relativeCoordMode; + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + + unsigned int index = 0; + unsigned int lastX = 0, lastY = 0; + + for (unsigned int i = 0; i < numPoints; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyLineCacheX[index], 8); + lastX += value; + PutUINT(lastX, nextDest, bigEndian_); + nextDest += 2; + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyLineCacheY[index], 8); + lastY += value; + PutUINT(lastY, nextDest, bigEndian_); + nextDest += 2; + + if (++index == 2) index = 0; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PolyRectangle: + { + unsigned int numRectangles; + decodeBuffer.decodeValue(numRectangles, 16, 3); + outputLength = (numRectangles << 3) + 12; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + for (unsigned int i = 0; i < numRectangles; i++) + for (unsigned int k = 0; k < 4; k++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> polyRectangleGeomCache[k], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + } + break; + case X_PolySegment: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PolySegment); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int numSegments; + decodeBuffer.decodeValue(numSegments, 16, 4); + outputLength = (numSegments << 3) + 12; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + + for (numSegments *= 2; numSegments; numSegments--) + { + unsigned int index; + decodeBuffer.decodeBoolValue(index); + unsigned int x; + decodeBuffer.decodeCachedValue(x, 16, + clientCache_ -> polySegmentCacheX, 6); + x += clientCache_ -> polySegmentLastX[index]; + PutUINT(x, nextDest, bigEndian_); + nextDest += 2; + + unsigned int y; + decodeBuffer.decodeCachedValue(y, 16, + clientCache_ -> polySegmentCacheY, 6); + y += clientCache_ -> polySegmentLastY[index]; + PutUINT(y, nextDest, bigEndian_); + nextDest += 2; + + clientCache_ -> polySegmentLastX[clientCache_ -> polySegmentCacheIndex] = x; + clientCache_ -> polySegmentLastY[clientCache_ -> polySegmentCacheIndex] = y; + + if (clientCache_ -> polySegmentCacheIndex == 1) + clientCache_ -> polySegmentCacheIndex = 0; + else + clientCache_ -> polySegmentCacheIndex = 1; + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_PutImage: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_PutImage); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + + if (outputOpcode == X_PutImage) + { + handleImage(outputOpcode, outputMessage, outputLength); + } + } + break; + case X_QueryBestSize: + { + outputLength = 12; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 2); + outputMessage[1] = (unsigned char)value; + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeValue(value, 16, 8); + PutUINT(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeValue(value, 16, 8); + PutUINT(value, outputMessage + 10, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_QueryColors: + { + // Differential or plain data compression? + decodeBuffer.decodeBoolValue(value); + + if (value) + { + unsigned int numColors; + decodeBuffer.decodeValue(numColors, 16, 5); + outputLength = (numColors << 2) + 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> colormapCache); + PutULONG(value, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 8; + unsigned int predictedPixel = clientCache_ -> queryColorsLastPixel; + for (unsigned int i = 0; i < numColors; i++) + { + unsigned int pixel; + decodeBuffer.decodeBoolValue(value); + if (value) + pixel = predictedPixel; + else + decodeBuffer.decodeValue(pixel, 32, 9); + PutULONG(pixel, nextDest, bigEndian_); + if (i == 0) + clientCache_ -> queryColorsLastPixel = pixel; + predictedPixel = pixel + 1; + nextDest += 4; + } + } + else + { + // Request length. + unsigned int requestLength; + decodeBuffer.decodeValue(requestLength, 16, 10); + outputLength = (requestLength << 2); + outputMessage = writeBuffer_.addMessage(outputLength); + + const unsigned char *compressedData = NULL; + unsigned int compressedDataSize = 0; + + int decompressed = handleDecompress(decodeBuffer, outputOpcode, 4, + outputMessage, outputLength, compressedData, + compressedDataSize); + if (decompressed < 0) + { + return -1; + } + } + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_QueryExtension: + { + unsigned int nameLength; + decodeBuffer.decodeValue(nameLength, 16, 6); + outputLength = 8 + RoundUp4(nameLength); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(nameLength, outputMessage + 4, bigEndian_); + unsigned char *nextDest = outputMessage + 8; + for (unsigned int i = 0; i < nameLength; i++) + { + decodeBuffer.decodeValue(value, 8); + *nextDest++ = (unsigned char) value; + } + + unsigned int hide = 0; + + #ifdef HIDE_MIT_SHM_EXTENSION + + if (!strncmp((char *) outputMessage + 8, "MIT-SHM", 7)) + { + #ifdef TEST + *logofs << "handleWrite: Going to hide MIT-SHM extension in reply.\n" + << logofs_flush; + #endif + + hide = 1; + } + + #endif + + #ifdef HIDE_BIG_REQUESTS_EXTENSION + + if (!strncmp((char *) outputMessage + 8, "BIG-REQUESTS", 12)) + { + #ifdef TEST + *logofs << "handleWrite: Going to hide BIG-REQUESTS extension in reply.\n" + << logofs_flush; + #endif + + hide = 1; + } + + #endif + + #ifdef HIDE_XKEYBOARD_EXTENSION + + else if (!strncmp((char *) outputMessage + 8, "XKEYBOARD", 9)) + { + #ifdef TEST + *logofs << "handleWrite: Going to hide XKEYBOARD extension in reply.\n" + << logofs_flush; + #endif + + hide = 1; + } + + #endif + + #ifdef HIDE_XFree86_Bigfont_EXTENSION + + else if (!strncmp((char *) outputMessage + 8, "XFree86-Bigfont", 15)) + { + #ifdef TEST + *logofs << "handleWrite: Going to hide XFree86-Bigfont extension in reply.\n" + << logofs_flush; + #endif + + hide = 1; + } + + #endif + + // + // This is if you want to experiment disabling SHAPE extensions. + // + + #ifdef HIDE_SHAPE_EXTENSION + + if (!strncmp((char *) outputMessage + 8, "SHAPE", 5)) + { + #ifdef DEBUG + *logofs << "handleWrite: Going to hide SHAPE extension in reply.\n" + << logofs_flush; + #endif + + hide = 1; + } + + #endif + + // + // Check if user disabled RENDER extension. + // + + if (control -> HideRender == 1 && + strncmp((char *) outputMessage + 8, "RENDER", 6) == 0) + { + #ifdef TEST + *logofs << "handleWrite: Going to hide RENDER extension in reply.\n" + << logofs_flush; + #endif + + hide = 1; + } + + unsigned int extension = 0; + + if (strncmp((char *) outputMessage + 8, "SHAPE", 5) == 0) + { + extension = X_NXInternalShapeExtension; + } + else if (strncmp((char *) outputMessage + 8, "RENDER", 6) == 0) + { + extension = X_NXInternalRenderExtension; + } + + sequenceQueue_.push(clientSequence_, outputOpcode, + outputOpcode, hide, extension); + } + break; + case X_QueryFont: + { + outputLength = 8; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 29, 5); + clientCache_ -> lastFont += value; + clientCache_ -> lastFont &= 0x1fffffff; + PutULONG(clientCache_ -> lastFont, outputMessage + 4, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_SetClipRectangles: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_SetClipRectangles); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + break; + } + + unsigned int numRectangles; + + // Since ProtoStep9 (#issue 108) + decodeBuffer.decodeValue(numRectangles, 15, 4); + + outputLength = (numRectangles << 3) + 12; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeValue(value, 2); + outputMessage[1] = (unsigned char) value; + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> setClipRectanglesXCache, 8); + PutUINT(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> setClipRectanglesYCache, 8); + PutUINT(value, outputMessage + 10, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + for (unsigned int i = 0; i < numRectangles; i++) + { + for (unsigned int k = 0; k < 4; k++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache_ -> setClipRectanglesGeomCache[k], 8); + PutUINT(value, nextDest, bigEndian_); + nextDest += 2; + } + } + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_SetDashes: + { + unsigned int numDashes; + decodeBuffer.decodeCachedValue(numDashes, 16, + clientCache_ -> setDashesLengthCache, 5); + outputLength = 12 + RoundUp4(numDashes); + outputMessage = writeBuffer_.addMessage(outputLength); + PutUINT(numDashes, outputMessage + 10, bigEndian_); + decodeBuffer.decodeXidValue(value, clientCache_ -> gcCache); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> setDashesOffsetCache, 5); + PutUINT(value, outputMessage + 8, bigEndian_); + unsigned char *nextDest = outputMessage + 12; + for (unsigned int i = 0; i < numDashes; i++) + { + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> setDashesDashCache_[i & 1], 5); + *nextDest++ = cValue; + } + } + break; + case X_SetSelectionOwner: + { + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> setSelectionOwnerCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> getSelectionOwnerSelectionCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 32, + clientCache_ -> setSelectionOwnerTimestampCache, 9); + PutULONG(value, outputMessage + 12, bigEndian_); + } + break; + case X_TranslateCoords: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_TranslateCoords); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + sequenceQueue_.push(clientSequence_, outputOpcode); + + break; + } + + outputLength = 16; + outputMessage = writeBuffer_.addMessage(outputLength); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> translateCoordsSrcCache, 9); + PutULONG(value, outputMessage + 4, bigEndian_); + decodeBuffer.decodeCachedValue(value, 29, + clientCache_ -> translateCoordsDstCache, 9); + PutULONG(value, outputMessage + 8, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> translateCoordsXCache, 8); + PutUINT(value, outputMessage + 12, bigEndian_); + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> translateCoordsYCache, 8); + PutUINT(value, outputMessage + 14, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_GetImage: + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_GetImage); + + if (handleDecodeCached(decodeBuffer, clientCache_, messageStore, + outputMessage, outputLength)) + { + sequenceQueue_.push(clientSequence_, outputOpcode); + + break; + } + + outputLength = 20; + outputMessage = writeBuffer_.addMessage(outputLength); + // Format. + unsigned int format; + decodeBuffer.decodeValue(format, 2); + outputMessage[1] = (unsigned char) format; + // Drawable. + decodeBuffer.decodeXidValue(value, clientCache_ -> drawableCache); + PutULONG(value, outputMessage + 4, bigEndian_); + // X. + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> putImageXCache, 8); + clientCache_ -> putImageLastX += value; + clientCache_ -> putImageLastX &= 0xffff; + PutUINT(clientCache_ -> putImageLastX, outputMessage + 8, bigEndian_); + // Y. + decodeBuffer.decodeCachedValue(value, 16, + clientCache_ -> putImageYCache, 8); + clientCache_ -> putImageLastY += value; + clientCache_ -> putImageLastY &= 0xffff; + PutUINT(clientCache_ -> putImageLastY, outputMessage + 10, bigEndian_); + // Width. + unsigned int width; + decodeBuffer.decodeCachedValue(width, 16, + clientCache_ -> putImageWidthCache, 8); + PutUINT(width, outputMessage + 12, bigEndian_); + // Height. + unsigned int height; + decodeBuffer.decodeCachedValue(height, 16, + clientCache_ -> putImageHeightCache, 8); + PutUINT(height, outputMessage + 14, bigEndian_); + // Plane mask. + decodeBuffer.decodeCachedValue(value, 32, + clientCache_ -> getImagePlaneMaskCache, 5); + PutULONG(value, outputMessage + 16, bigEndian_); + + sequenceQueue_.push(clientSequence_, outputOpcode); + + handleSave(messageStore, outputMessage, outputLength); + } + break; + case X_GetPointerMapping: + { + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + case X_GetKeyboardControl: + { + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + + sequenceQueue_.push(clientSequence_, outputOpcode); + } + break; + default: + { + if (outputOpcode == opcodeStore_ -> renderExtension) + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXInternalRenderExtension); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> shapeExtension) + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXInternalShapeExtension); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> putPackedImage) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding packed image request for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXPutPackedImage); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + + if (outputOpcode == opcodeStore_ -> putPackedImage) + { + handleImage(outputOpcode, outputMessage, outputLength); + } + } + else if (outputOpcode == opcodeStore_ -> setUnpackColormap) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding set unpack colormap request " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXSetUnpackColormap); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + // + // Message could have been split. + // + + if (outputOpcode == opcodeStore_ -> setUnpackColormap) + { + handleColormap(outputOpcode, outputMessage, outputLength); + } + } + else if (outputOpcode == opcodeStore_ -> setUnpackAlpha) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding unpack alpha request for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXSetUnpackAlpha); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + // + // Message could have been split. + // + + if (outputOpcode == opcodeStore_ -> setUnpackAlpha) + { + handleAlpha(outputOpcode, outputMessage, outputLength); + } + } + else if (outputOpcode == opcodeStore_ -> setUnpackGeometry) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding set unpack geometry request " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXSetUnpackGeometry); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + + handleGeometry(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> startSplit) + { + handleStartSplitRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> endSplit) + { + handleEndSplitRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> commitSplit) + { + int result = handleCommitSplitRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength); + + // + // Check if message has been successfully + // extracted from the split store. In this + // case post-process it in the usual way. + // + + if (result > 0) + { + if (outputOpcode == opcodeStore_ -> putPackedImage || + outputOpcode == X_PutImage) + { + handleImage(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> setUnpackColormap) + { + handleColormap(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> setUnpackAlpha) + { + handleAlpha(outputOpcode, outputMessage, outputLength); + } + } + else if (result < 0) + { + return -1; + } + } + else if (outputOpcode == opcodeStore_ -> abortSplit) + { + handleAbortSplitRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> finishSplit) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding finish split request " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> resourceCache); + + handleNullRequest(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> freeSplit) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding free split request " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> resourceCache); + + handleNullRequest(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> freeUnpack) + { + #ifdef DEBUG + *logofs << "handleWrite: Decoding free unpack request " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache_ -> resourceCache); + + #ifdef DEBUG + *logofs << "handleWrite: Freeing unpack state for resource " + << (unsigned int) cValue << ".\n" << logofs_flush; + #endif + + handleUnpackStateRemove(cValue); + + handleNullRequest(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> setExposeParameters) + { + // + // Send expose events according to agent's wish. + // + + decodeBuffer.decodeBoolValue(enableExpose_); + decodeBuffer.decodeBoolValue(enableGraphicsExpose_); + decodeBuffer.decodeBoolValue(enableNoExpose_); + + handleNullRequest(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> getUnpackParameters) + { + // + // Client proxy needs the list of supported + // unpack methods. We would need an encode + // buffer, but this is in proxy, not here in + // channel. + // + + #ifdef TEST + *logofs << "handleWrite: Sending X_GetInputFocus request for FD#" + << fd_ << " due to OPCODE#" << (unsigned int) outputOpcode + << ".\n" << logofs_flush; + #endif + + outputOpcode = X_GetInputFocus; + + outputLength = 4; + outputMessage = writeBuffer_.addMessage(outputLength); + + sequenceQueue_.push(clientSequence_, outputOpcode, + opcodeStore_ -> getUnpackParameters); + } + else if (outputOpcode == opcodeStore_ -> getControlParameters || + outputOpcode == opcodeStore_ -> getCleanupParameters || + outputOpcode == opcodeStore_ -> getImageParameters) + { + handleNullRequest(outputOpcode, outputMessage, outputLength); + } + else if (outputOpcode == opcodeStore_ -> getShmemParameters) + { + if (handleShmemRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength) < 0) + { + return -1; + } + } + else if (outputOpcode == opcodeStore_ -> setCacheParameters) + { + if (handleCacheRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength) < 0) + { + return -1; + } + } + else if (outputOpcode == opcodeStore_ -> getFontParameters) + { + if (handleFontRequest(decodeBuffer, outputOpcode, + outputMessage, outputLength) < 0) + { + return -1; + } + } + else + { + MessageStore *messageStore = clientStore_ -> + getRequestStore(X_NXInternalGenericRequest); + + hit = handleDecode(decodeBuffer, clientCache_, messageStore, + outputOpcode, outputMessage, outputLength); + } + } + } // End of switch on opcode. + + // + // TODO: at the moment the variable hit was being set + // but not used, so to avoid the corresponding warning + // this logging block has been added. + // This code will probably be optimized away when none + // of the defines is set, but if there is no additional + // use for the hit variable in the future, then maybe + // it could be removed completely. + // + + if (hit) + { + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: Cached flag enabled in handled request.\n" + << logofs_flush; + #endif + } + + // + // A packed image request can generate more than just + // a single X_PutImage. Write buffer is handled inside + // handleUnpack(). Cannot simply assume that the final + // opcode and size must be put at the buffer offset as + // as buffer could have been grown or could have been + // replaced by a scratch buffer. The same is true in + // the case of a shared memory image. + // + + if (outputOpcode != 0) + { + // + // Commit opcode and size to the buffer. + // + + *outputMessage = (unsigned char) outputOpcode; + + PutUINT(outputLength >> 2, outputMessage + 2, bigEndian_); + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleWrite: Handled request OPCODE#" + << (unsigned int) outputOpcode << " (" + << DumpOpcode(outputOpcode) << ") for FD#" + << fd_ << " sequence " << clientSequence_ + << ". " << outputLength << " bytes out.\n" + << logofs_flush; + #endif + } + #if defined(TEST) || defined(OPCODES) + else + { + // + // In case of shared memory images the log doesn't + // reflect the actual opcode of the request that is + // going to be written. It would be possible to find + // the opcode of the original request received from + // the remote proxy in member imageState_ -> opcode, + // but we have probably already deleted the struct. + // + + *logofs << "handleWrite: Handled image request for FD#" + << fd_ << " new sequence " << clientSequence_ + << ". " << outputLength << " bytes out.\n" + << logofs_flush; + } + #endif + + // + // Check if we produced enough data. We need to + // decode all the proxy messages or the decode + // buffer will be left in an inconsistent state, + // so we just update the finish flag in case of + // failure. + // + + handleFlush(flush_if_needed); + + } // End of while (decodeBuffer.decodeOpcodeValue(outputOpcode, 8, ... + + } // End of the decoding block. + + // + // Write any remaining data to the X connection. + // + + if (handleFlush(flush_if_any) < 0) + { + return -1; + } + + // + // Reset offset at which we read the + // last event looking for the shared + // memory completion. + // + + if (shmemState_ != NULL) + { + shmemState_ -> checked = 0; + } + + return 1; +} + +// +// End of handleWrite(). +// + +// +// Other members. +// + +int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, + T_store_action action, int position, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // Since ProtoStep7 (#issue 108) + splitState_.current = splitState_.resource; + + handleSplitStoreAlloc(&splitResources_, splitState_.current); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Message OPCODE#" + << (unsigned int) store -> opcode() << " of size " << size + << " [split] with resource " << splitState_.current + << " position " << position << " and action [" + << DumpAction(action) << "] at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + // + // Get the MD5 of the message being + // split. + // + + T_checksum checksum = NULL; + + if (action != IS_HIT) + { + handleSplitChecksum(decodeBuffer, checksum); + } + + // + // The method must abort the connection + // if it can't allocate the split. + // + + Split *splitMessage = clientStore_ -> getSplitStore(splitState_.current) -> + add(store, splitState_.current, position, + action, checksum, buffer, size); + + // + // If the encoding side didn't provide + // a checksum, then don't send the split + // report. + // + + if (checksum == NULL) + { + if (action == IS_HIT) + { + splitMessage -> setState(split_loaded); + } + else + { + splitMessage -> setState(split_missed); + } + + #if defined(TEST) || defined(SPLIT) + + *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> + getSplitTotalSize() << " messages and " << clientStore_ -> + getSplitTotalStorageSize() << " bytes to send in " + << "the split stores.\n" << logofs_flush; + + clientStore_ -> dumpSplitStore(splitState_.current); + + #endif + + return 1; + } + + delete [] checksum; + + // + // Tell the split store if it must use + // the disk cache to retrieve and save + // the message. + // + + splitMessage -> setPolicy(splitState_.load, splitState_.save); + + // + // Try to locate the message on disk. + // + + if (clientStore_ -> getSplitStore(splitState_.current) -> + load(splitMessage) == 1) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Loaded the message " + << "from the image cache.\n" << logofs_flush; + #endif + + splitMessage -> setState(split_loaded); + } + else + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: WARNING! SPLIT! Can't find the message " + << "in the image cache.\n" << logofs_flush; + #endif + + splitMessage -> setState(split_missed); + } + + #if defined(TEST) || defined(SPLIT) + + T_timestamp startTs = getTimestamp(); + + *logofs << "handleSplit: SPLIT! Encoding abort " + << "split events for FD#" << fd_ << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + + if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) + { + return -1; + } + + // + // Send the encoded data immediately. We + // want the abort split message to reach + // the remote proxy as soon as possible. + // + + if (proxy -> handleAsyncFlush() < 0) + { + return -1; + } + + #if defined(TEST) || defined(SPLIT) + + *logofs << "handleSplit: SPLIT! Spent " + << diffTimestamp(startTs, getTimestamp()) << " Ms " + << "handling abort split events for FD#" << fd_ + << ".\n" << logofs_flush; + + *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> + getSplitTotalSize() << " messages and " << clientStore_ -> + getSplitTotalStorageSize() << " bytes to send in " + << "the split stores.\n" << logofs_flush; + + clientStore_ -> dumpSplitStore(splitState_.current); + + #endif + + return 1; +} + +int ServerChannel::handleSplit(DecodeBuffer &decodeBuffer) +{ + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Going to handle splits " + << "for FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + unsigned char resource; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + splitState_.current = resource; + + handleSplitStoreAlloc(&splitResources_, splitState_.current); + + SplitStore *splitStore = clientStore_ -> getSplitStore(splitState_.current); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Handling splits for " + << "resource [" << splitState_.current << "] with " + << splitStore -> getSize() << " elements " + << "in the split store.\n" << logofs_flush; + #endif + + int result = splitStore -> receive(decodeBuffer); + + if (result < 0) + { + #ifdef PANIC + *logofs << "handleSplit: PANIC! Receive of split for FD#" << fd_ + << " failed.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Receive of split for FD#" << fd_ + << " failed.\n"; + + return -1; + } + else if (result == 0) + { + // + // The split is still incomplete. It's time + // to check if we need to start the house- + // keeping process to take care of the image + // cache. + // + + if (proxy -> handleAsyncKeeperCallback() < 0) + { + return -1; + } + } + else + { + // + // Note that we don't need the resource id at the + // X server side and, thus, we don't provide it + // at the time we add split to the split store. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Remote agent should " + << "now commit a new split for resource [" + << splitState_.current << "].\n" + << logofs_flush; + + clientStore_ -> dumpCommitStore(); + + #endif + + if (splitStore -> getSize() == 0) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! Removing split store " + << "for resource [" << splitState_.current + << "] at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + handleSplitStoreRemove(&splitResources_, splitState_.current); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: SPLIT! There are [" << clientStore_ -> + getSplitTotalSize() << "] messages and " << clientStore_ -> + getSplitTotalStorageSize() << " bytes to send in " + << "the split stores.\n" << logofs_flush; + #endif + } + else + { + // + // If the next split is discarded, it can be + // that, since the beginning of the split, we + // have saved the message on the disk, due to + // a more recent split operation. This is also + // the case when we had to discard the message + // because it was locked but, since then, we + // completed the transferral of the split. + // + + Split *splitMessage = splitStore -> getFirstSplit(); + + if (splitMessage -> getAction() == is_discarded && + splitMessage -> getState() == split_missed && + splitStore -> load(splitMessage) == 1) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplit: WARNING! SPLIT! Asynchronously " + << "loaded the message from the image cache.\n" + << logofs_flush; + #endif + + splitMessage -> setState(split_loaded); + + #if defined(TEST) || defined(SPLIT) + + T_timestamp startTs = getTimestamp(); + + *logofs << "handleSplit: WARNING! SPLIT! Asynchronously " + << "encoding abort split events for FD#" << fd_ + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncSplit(fd_, splitMessage) < 0) + { + return -1; + } + + // + // Send the encoded data immediately. We + // want the abort split message to reach + // the remote proxy as soon as possible. + // + + if (proxy -> handleAsyncFlush() < 0) + { + return -1; + } + + #if defined(TEST) || defined(SPLIT) + + *logofs << "handleSplit: WARNING! SPLIT! Spent " + << diffTimestamp(startTs, getTimestamp()) << " Ms " + << "handling asynchronous abort split events for " + << "FD#" << fd_ << ".\n" << logofs_flush; + + *logofs << "handleSplit: SPLIT! There are " << clientStore_ -> + getSplitTotalSize() << " messages and " << clientStore_ -> + getSplitTotalStorageSize() << " bytes to send in " + << "the split stores.\n" << logofs_flush; + + clientStore_ -> dumpSplitStore(splitState_.current); + + #endif + } + } + } + + return 1; +} + +int ServerChannel::handleSplitEvent(EncodeBuffer &encodeBuffer, Split *splitMessage) +{ + int resource = splitMessage -> getResource(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Going to send a " + << "split report for resource " << resource + << ".\n" << logofs_flush; + #endif + + // + // This function is called only after the message + // has been searched in the disk cache. We need to + // inform the other side if the data transfer can + // start or it must be aborted to let the local + // side use the copy that was found on the disk. + // + + #if defined(TEST) || defined(INFO) + + if (splitMessage -> getState() != split_loaded && + splitMessage -> getState() != split_missed) + { + *logofs << "handleSplitEvent: PANIC! Can't find the split to be aborted.\n" + << logofs_flush; + + HandleCleanup(); + } + + #endif + + // + // We need to send a boolean telling if the split + // was found or not, followed by the checksum of + // message we are referencing. + // + + T_checksum checksum = splitMessage -> getChecksum(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Sending split report for " + << "checksum [" << DumpChecksum(checksum) << "].\n" + << logofs_flush; + #endif + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + encodeBuffer.encodeOpcodeValue(opcodeStore_ -> splitEvent, + serverCache_ -> opcodeCache); + + // + // The encoding in older protocol versions + // is different but we will never try to + // send a split report if the remote does + // not support our version. + // + + encodeBuffer.encodeCachedValue(resource, 8, + serverCache_ -> resourceCache); + + if (splitMessage -> getState() == split_loaded) + { + encodeBuffer.encodeBoolValue(1); + + encodeBuffer.encodeOpcodeValue(splitMessage -> getStore() -> opcode(), + serverCache_ -> abortOpcodeCache); + + encodeBuffer.encodeValue(splitMessage -> compressedSize(), 32, 14); + } + else + { + encodeBuffer.encodeBoolValue(0); + } + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + encodeBuffer.encodeValue((unsigned int) checksum[i], 8); + } + + // + // Update statistics for this special opcode. + // + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) || defined(INFO) || defined(SPLIT) + *logofs << "handleSplitEvent: SPLIT! Handled event OPCODE#" + << (unsigned int) opcodeStore_ -> splitEvent << " (" + << DumpOpcode(opcodeStore_ -> splitEvent) << ")" << " for FD#" + << fd_ << " sequence none. 0 bytes in, " << bits << " bits (" + << ((float) bits) / 8 << " bytes) out.\n" << logofs_flush; + #endif + + statistics -> addEventBits(opcodeStore_ -> splitEvent, 0, bits); + + return 1; +} + +int ServerChannel::handleAbortSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + unsigned char resource; + + decodeBuffer.decodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Handling abort split " + << "request for FD#" << fd_ << " and resource " + << (unsigned) resource << ".\n" + << logofs_flush; + #endif + + int splits = 0; + + SplitStore *splitStore = clientStore_ -> getSplitStore(resource); + + if (splitStore != NULL) + { + // + // Discard from the memory cache the messages + // that are still incomplete and then get rid + // of the splits in the store. + // + + #if defined(TEST) || defined(SPLIT) + + clientStore_ -> dumpSplitStore(resource); + + #endif + + Split *splitMessage; + + for (;;) + { + splitMessage = splitStore -> getFirstSplit(); + + if (splitMessage == NULL) + { + // + // Check if we had created the store + // but no message was added yet. + // + + #ifdef WARNING + + if (splits == 0) + { + *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " + << "split store for resource [" << (unsigned int) + resource << "] is unexpectedly empty.\n" + << logofs_flush; + } + + #endif + + break; + } + + // + // Splits already aborted can't be in the + // split store. + // + + #if defined(TEST) || defined(SPLIT) + + if (splitMessage -> getState() == split_aborted) + { + *logofs << "handleAbortSplitRequest: PANIC! SPLIT! Found an " + << "aborted split in store [" << (unsigned int) resource + << "].\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + if (splitMessage -> getAction() == IS_HIT) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Removing the " + << "split from the memory cache.\n" + << logofs_flush; + #endif + + splitMessage -> getStore() -> remove(splitMessage -> getPosition(), + discard_checksum, use_data); + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Removing the " + << "split from the split store.\n" + << logofs_flush; + #endif + + splitMessage = splitStore -> pop(); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleAbortSplitRequest: SPLIT! Freeing up the " + << "aborted split.\n" << logofs_flush; + #endif + + delete splitMessage; + + splits++; + } + } + #ifdef WARNING + else + { + *logofs << "handleAbortSplitRequest: WARNING! SPLIT! The " + << "split store for resource [" << (unsigned int) + resource << "] is already empty.\n" + << logofs_flush; + } + #endif + + handleNullRequest(opcode, buffer, size); + + return (splits > 0); +} + +int ServerChannel::handleCommitSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // Get request type and position of the image + // to commit. + // + + unsigned char request; + + decodeBuffer.decodeOpcodeValue(request, clientCache_ -> opcodeCache); + + unsigned int diffCommit; + + decodeBuffer.decodeValue(diffCommit, 32, 5); + + splitState_.commit += diffCommit; + + unsigned char resource = 0; + unsigned int commit = 1; + + // + // Send the resource id and the commit flag. + // The resource id is ignored at the moment. + // The message will be handled based on the + // resource id that was sent together with + // the original message. + // + + decodeBuffer.decodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + decodeBuffer.decodeBoolValue(commit); + + Split *split = handleSplitCommitRemove(request, resource, splitState_.commit); + + if (split == NULL) + { + return -1; + } + + clientStore_ -> getCommitStore() -> update(split); + + if (commit == 1) + { + #if defined(TEST) || defined(SPLIT) + *logofs << "handleCommitSplitRequest: SPLIT! Handling split commit " + << "for FD#" << fd_ << " with commit " << commit + << " request " << (unsigned) request << " resource " + << (unsigned) resource << " and position " + << splitState_.commit << ".\n" + << logofs_flush; + #endif + + // + // Allocate as many bytes in the write + // buffer as the final length of the + // message in uncompressed form. + // + + size = split -> plainSize(); + + buffer = writeBuffer_.addMessage(size); + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleCommitSplitRequest: SPLIT! Prepared an " + << "outgoing buffer of " << size << " bytes.\n" + << logofs_flush; + #endif + + if (clientStore_ -> getCommitStore() -> expand(split, buffer, size) < 0) + { + writeBuffer_.removeMessage(size); + + commit = 0; + } + } + + // + // Free the split. + // + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleCommitSplitRequest: SPLIT! Freeing up the " + << "committed split.\n" << logofs_flush; + #endif + + delete split; + + // + // Discard the operation and send a null + // message. + // + + if (commit == 0) + { + handleNullRequest(opcode, buffer, size); + } + else + { + // + // Save the sequence number to be able + // to mask any error generated by the + // request. + // + + updateCommitQueue(clientSequence_); + + // + // Now in the write buffer there is + // a copy of this request. + // + + opcode = request; + } + + return commit; +} + +int ServerChannel::handleGeometry(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + // + // Replace the old geometry and taint + // the message into a X_NoOperation. + // + + int resource = *(buffer + 1); + + #ifdef TEST + *logofs << "handleGeometry: Setting new unpack geometry " + << "for resource " << resource << ".\n" + << logofs_flush; + #endif + + handleUnpackStateInit(resource); + + handleUnpackAllocGeometry(resource); + + unpackState_[resource] -> geometry -> depth1_bpp = *(buffer + 4); + unpackState_[resource] -> geometry -> depth4_bpp = *(buffer + 5); + unpackState_[resource] -> geometry -> depth8_bpp = *(buffer + 6); + unpackState_[resource] -> geometry -> depth16_bpp = *(buffer + 7); + unpackState_[resource] -> geometry -> depth24_bpp = *(buffer + 8); + unpackState_[resource] -> geometry -> depth32_bpp = *(buffer + 9); + + unpackState_[resource] -> geometry -> red_mask = GetULONG(buffer + 12, bigEndian_); + unpackState_[resource] -> geometry -> green_mask = GetULONG(buffer + 16, bigEndian_); + unpackState_[resource] -> geometry -> blue_mask = GetULONG(buffer + 20, bigEndian_); + + handleCleanAndNullRequest(opcode, buffer, size); + + return 1; +} + +int ServerChannel::handleColormap(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + // + // Replace the old colormap and taint + // the message into a X_NoOperation. + // + + int resource = *(buffer + 1); + + #ifdef TEST + *logofs << "handleColormap: Setting new unpack colormap " + << "for resource " << resource << ".\n" + << logofs_flush; + #endif + + handleUnpackStateInit(resource); + + handleUnpackAllocColormap(resource); + + // + // New protocol versions send the alpha + // data in compressed form. + // + + // + // Since ProtoStep7 (#issue 108) + // + + { // An anonymous block is used here to limit the scope of local variables + unsigned int packed = GetULONG(buffer + 8, bigEndian_); + unsigned int unpacked = GetULONG(buffer + 12, bigEndian_); + + validateSize("colormap", packed, unpacked, 16, size); + + if (unpackState_[resource] -> colormap -> entries != unpacked >> 2 && + unpackState_[resource] -> colormap -> data != NULL) + { + #ifdef TEST + *logofs << "handleColormap: Freeing previously allocated " + << "unpack colormap data.\n" << logofs_flush; + #endif + + delete [] unpackState_[resource] -> colormap -> data; + + unpackState_[resource] -> colormap -> data = NULL; + unpackState_[resource] -> colormap -> entries = 0; + } + + #ifdef TEST + *logofs << "handleColormap: Setting " << unpacked + << " bytes of unpack colormap data for resource " + << resource << ".\n" << logofs_flush; + #endif + + if (unpackState_[resource] -> colormap -> data == NULL) + { + unpackState_[resource] -> colormap -> data = + (unsigned int *) new unsigned char[unpacked]; + + if (unpackState_[resource] -> colormap -> data == NULL) + { + #ifdef PANIC + *logofs << "handleColormap: PANIC! Can't allocate " + << unpacked << " entries for unpack colormap data " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + goto handleColormapEnd; + } + + #ifdef DEBUG + *logofs << "handleColormap: Size of new colormap data is " + << unpacked << ".\n" << logofs_flush; + #endif + } + + unsigned int method = *(buffer + 4); + + if (method == PACK_COLORMAP) + { + if (UnpackColormap(method, buffer + 16, packed, + (unsigned char *) unpackState_[resource] -> + colormap -> data, unpacked) < 0) + { + #ifdef PANIC + *logofs << "handleColormap: PANIC! Can't unpack " << packed + << " bytes to " << unpacked << " entries for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + delete [] unpackState_[resource] -> colormap -> data; + + unpackState_[resource] -> colormap -> data = NULL; + unpackState_[resource] -> colormap -> entries = 0; + + goto handleColormapEnd; + } + } + else + { + memcpy((unsigned char *) unpackState_[resource] -> + colormap -> data, buffer + 16, unpacked); + } + + unpackState_[resource] -> colormap -> entries = unpacked >> 2; + + #if defined(DEBUG) && defined(DUMP) + + *logofs << "handleColormap: Dumping colormap entries:\n" + << logofs_flush; + + const unsigned char *p = (const unsigned char *) unpackState_[resource] -> colormap -> data; + + for (unsigned int i = 0; i < unpackState_[resource] -> + colormap -> entries; i++) + { + *logofs << "handleColormap: [" << i << "] [" + << (void *) ((int) p[i]) << "].\n" + << logofs_flush; + } + + #endif + } // end anonymous block + +handleColormapEnd: + + handleCleanAndNullRequest(opcode, buffer, size); + + return 1; +} + +int ServerChannel::handleAlpha(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + int resource = *(buffer + 1); + + #ifdef TEST + *logofs << "handleAlpha: Setting new unpack alpha " + << "for resource " << resource << ".\n" + << logofs_flush; + #endif + + handleUnpackStateInit(resource); + + handleUnpackAllocAlpha(resource); + + // + // New protocol versions send the alpha + // data in compressed form. + // + + // + // Since ProtoStep7 (#issue 108) + // + + { // An anonymous block is used here to limit the scope of local variables + unsigned int packed = GetULONG(buffer + 8, bigEndian_); + unsigned int unpacked = GetULONG(buffer + 12, bigEndian_); + + validateSize("alpha", packed, unpacked, 16, size); + + if (unpackState_[resource] -> alpha -> entries != unpacked && + unpackState_[resource] -> alpha -> data != NULL) + { + #ifdef TEST + *logofs << "handleAlpha: Freeing previously allocated " + << "unpack alpha data.\n" << logofs_flush; + #endif + + delete [] unpackState_[resource] -> alpha -> data; + + unpackState_[resource] -> alpha -> data = NULL; + unpackState_[resource] -> alpha -> entries = 0; + } + + #ifdef TEST + *logofs << "handleAlpha: Setting " << unpacked + << " bytes of unpack alpha data for resource " + << resource << ".\n" << logofs_flush; + #endif + + if (unpackState_[resource] -> alpha -> data == NULL) + { + unpackState_[resource] -> alpha -> data = new unsigned char[unpacked]; + + if (unpackState_[resource] -> alpha -> data == NULL) + { + #ifdef PANIC + *logofs << "handleAlpha: PANIC! Can't allocate " + << unpacked << " entries for unpack alpha data " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + goto handleAlphaEnd; + } + + #ifdef DEBUG + *logofs << "handleAlpha: Size of new alpha data is " + << unpacked << ".\n" << logofs_flush; + #endif + } + + unsigned int method = *(buffer + 4); + + if (method == PACK_ALPHA) + { + if (UnpackAlpha(method, buffer + 16, packed, + unpackState_[resource] -> alpha -> + data, unpacked) < 0) + { + #ifdef PANIC + *logofs << "handleAlpha: PANIC! Can't unpack " << packed + << " bytes to " << unpacked << " entries for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + delete [] unpackState_[resource] -> alpha -> data; + + unpackState_[resource] -> alpha -> data = NULL; + unpackState_[resource] -> alpha -> entries = 0; + + goto handleAlphaEnd; + } + } + else + { + memcpy((unsigned char *) unpackState_[resource] -> + alpha -> data, buffer + 16, unpacked); + } + + unpackState_[resource] -> alpha -> entries = unpacked; + + #if defined(DEBUG) && defined(DUMP) + + *logofs << "handleAlpha: Dumping alpha entries:\n" + << logofs_flush; + + const unsigned char *p = unpackState_[resource] -> alpha -> data; + + for (unsigned int i = 0; i < unpackState_[resource] -> + alpha -> entries; i++) + { + *logofs << "handleAlpha: [" << i << "] [" + << (void *) ((int) p[i]) << "].\n" + << logofs_flush; + } + + #endif + } //end anonymous block + +handleAlphaEnd: + + handleCleanAndNullRequest(opcode, buffer, size); + + return 1; +} + +int ServerChannel::handleImage(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + int result = 1; + + // + // Save the original opcode together with + // the image state so we can later find if + // this is a plain or a packed image when + // moving data to the shared memory area. + // + + handleImageStateAlloc(opcode); + + if (opcode == opcodeStore_ -> putPackedImage) + { + // + // Unpack the image and put a X_PutImage in a + // new buffer. Save the expected output size, + // so, in the case of a decoding error we can + // still update the statistics. + // + + int length = GetULONG(buffer + 20, bigEndian_); + + #ifdef TEST + *logofs << "handleImage: Sending image for FD#" << fd_ + << " due to OPCODE#" << (unsigned int) opcode << " with " + << GetULONG(buffer + 16, bigEndian_) << " bytes packed " + << "and " << GetULONG(buffer + 20, bigEndian_) + << " bytes unpacked.\n" << logofs_flush; + #endif + + statistics -> addPackedBytesIn(size); + + result = handleUnpack(opcode, buffer, size); + + if (result < 0) + { + // + // Recover from the error. Send a X_NoOperation + // to keep the sequence counter in sync with + // the remote peer. + // + + size = 4; + buffer = writeBuffer_.addMessage(size); + + *buffer = X_NoOperation; + + PutUINT(size >> 2, buffer + 2, bigEndian_); + + #ifdef PANIC + *logofs << "handleImage: PANIC! Sending X_NoOperation for FD#" + << fd_ << " to recover from failed unpack.\n" + << logofs_flush; + #endif + + // + // Set the output length to reflect the amount of + // data that would have been produced by unpacking + // the image. This is advisable to keep the count- + // ers in sync with those at remote proxy. Setting + // the size here doesn't have any effect on the + // size of data sent to the X server as the actual + // size will be taken from the content of the write + // buffer. + // + + size = length; + } + + statistics -> addPackedBytesOut(size); + + // + // Refrain the write loop from putting + // opcode and size in the output buffer. + // + + opcode = 0; + } + + // + // Now image is unpacked as a X_PutImage + // in write buffer. Check if we can send + // the image using the MIT-SHM extension. + // + + if (result > 0) + { + result = handleShmem(opcode, buffer, size); + + // + // We already put opcode and size in + // the resulting buffer. + // + + if (result > 0) + { + opcode = 0; + } + } + + return 1; +} + +int ServerChannel::handleMotion(EncodeBuffer &encodeBuffer) +{ + #if defined(TEST) || defined(INFO) + + if (lastMotion_[0] == '\0') + { + *logofs << "handleMotion: PANIC! No motion events to send " + << "for FD#" << fd_ << ".\n" << logofs_flush; + + HandleCleanup(); + } + + #endif + + #if defined(TEST) || defined(INFO) + *logofs << "handleMotion: Sending motion events for FD#" + << fd_ << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + // + // Replicate code from read loop. When have + // time and wish, try to split everything + // in functions. + // + + if (proxy -> handleAsyncSwitch(fd_) < 0) + { + return -1; + } + + const unsigned char *buffer = lastMotion_; + unsigned char opcode = *lastMotion_; + unsigned int size = 32; + + if (GetUINT(buffer + 2, bigEndian_) < serverSequence_) + { + PutUINT(serverSequence_, (unsigned char *) buffer + 2, bigEndian_); + } + + encodeBuffer.encodeOpcodeValue(opcode, serverCache_ -> opcodeCache); + + unsigned int sequenceNum = GetUINT(buffer + 2, bigEndian_); + + unsigned int sequenceDiff = sequenceNum - serverSequence_; + + serverSequence_ = sequenceNum; + + #ifdef DEBUG + *logofs << "handleMotion: Last server sequence number for FD#" + << fd_ << " is " << serverSequence_ << " with " + << "difference " << sequenceDiff << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(sequenceDiff, 16, + serverCache_ -> eventSequenceCache, 7); + + // + // If we fast encoded the message + // then skip the rest. + // + + if (control -> LocalDeltaCompression == 0) + { + int result = handleFastReadEvent(encodeBuffer, opcode, + buffer, size); + + #ifdef DEBUG + *logofs << "handleMotion: Sent saved motion event for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + lastMotion_[0] = '\0'; + + #ifdef DEBUG + *logofs << "handleMotion: Reset last motion event for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + if (result < 0) + { + return -1; + } + else if (result > 0) + { + return 1; + } + } + + // + // This should be just the part specific + // for motion events but is currently a + // copy-paste of code from the read loop. + // + + unsigned char detail = buffer[1]; + if (*buffer == MotionNotify) + encodeBuffer.encodeBoolValue((unsigned int) detail); + else if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) + encodeBuffer.encodeValue((unsigned int) detail, 3); + else if (*buffer == KeyRelease) + { + if (detail == serverCache_ -> keyPressLastKey) + encodeBuffer.encodeBoolValue(1); + else + { + encodeBuffer.encodeBoolValue(0); + encodeBuffer.encodeValue((unsigned int) detail, 8); + } + } + else if ((*buffer == ButtonPress) || (*buffer == ButtonRelease)) + encodeBuffer.encodeCachedValue(detail, 8, + serverCache_ -> buttonCache); + else + encodeBuffer.encodeValue((unsigned int) detail, 8); + unsigned int timestamp = GetULONG(buffer + 4, bigEndian_); + unsigned int timestampDiff = timestamp - serverCache_ -> lastTimestamp; + serverCache_ -> lastTimestamp = timestamp; + encodeBuffer.encodeCachedValue(timestampDiff, 32, + serverCache_ -> motionNotifyTimestampCache, 9); + int skipRest = 0; + if (*buffer == KeyRelease) + { + skipRest = 1; + for (unsigned int i = 8; i < 31; i++) + { + if (buffer[i] != serverCache_ -> keyPressCache[i - 8]) + { + skipRest = 0; + break; + } + } + encodeBuffer.encodeBoolValue(skipRest); + } + if (!skipRest) + { + const unsigned char *nextSrc = buffer + 8; + for (unsigned int i = 0; i < 3; i++) + { + encodeBuffer.encodeCachedValue(GetULONG(nextSrc, bigEndian_), 29, + *serverCache_ -> motionNotifyWindowCache[i], 6); + nextSrc += 4; + } + unsigned int rootX = GetUINT(buffer + 20, bigEndian_); + unsigned int rootY = GetUINT(buffer + 22, bigEndian_); + unsigned int eventX = GetUINT(buffer + 24, bigEndian_); + unsigned int eventY = GetUINT(buffer + 26, bigEndian_); + eventX -= rootX; + eventY -= rootY; + encodeBuffer.encodeCachedValue(rootX - + serverCache_ -> motionNotifyLastRootX, 16, + serverCache_ -> motionNotifyRootXCache, 6); + serverCache_ -> motionNotifyLastRootX = rootX; + encodeBuffer.encodeCachedValue(rootY - + serverCache_ -> motionNotifyLastRootY, 16, + serverCache_ -> motionNotifyRootYCache, 6); + serverCache_ -> motionNotifyLastRootY = rootY; + encodeBuffer.encodeCachedValue(eventX, 16, + serverCache_ -> motionNotifyEventXCache, 6); + encodeBuffer.encodeCachedValue(eventY, 16, + serverCache_ -> motionNotifyEventYCache, 6); + encodeBuffer.encodeCachedValue(GetUINT(buffer + 28, bigEndian_), + 16, serverCache_ -> motionNotifyStateCache); + if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) + encodeBuffer.encodeValue((unsigned int) buffer[30], 2); + else + encodeBuffer.encodeBoolValue((unsigned int) buffer[30]); + if ((*buffer == EnterNotify) || (*buffer == LeaveNotify)) + encodeBuffer.encodeValue((unsigned int) buffer[31], 2); + else if (*buffer == KeyPress) + { + serverCache_ -> keyPressLastKey = detail; + for (unsigned int i = 8; i < 31; i++) + { + serverCache_ -> keyPressCache[i - 8] = buffer[i]; + } + } + } + + // + // Print info about achieved compression + // and update the statistics. + // + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleMotion: Handled event OPCODE#" << (unsigned int) buffer[0] + << " for FD#" << fd_ << " sequence " << sequenceNum << ". " + << size << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + #endif + + statistics -> addEventBits(*buffer, size << 3, bits); + + #ifdef DEBUG + *logofs << "handleMotion: Sent saved motion event for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + lastMotion_[0] = '\0'; + + #ifdef DEBUG + *logofs << "handleMotion: Reset last motion event for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ServerChannel::handleConfiguration() +{ + #ifdef TEST + *logofs << "ServerChannel: Setting new buffer parameters " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + readBuffer_.setSize(control -> ServerInitialReadSize, + control -> ServerMaximumBufferSize); + + writeBuffer_.setSize(control -> TransportXBufferSize, + control -> TransportXBufferThreshold, + control -> TransportMaximumBufferSize); + + transport_ -> setSize(control -> TransportXBufferSize, + control -> TransportXBufferThreshold, + control -> TransportMaximumBufferSize); + return 1; +} + +int ServerChannel::handleFinish() +{ + #ifdef TEST + *logofs << "ServerChannel: Finishing connection for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + congestion_ = 0; + priority_ = 0; + + finish_ = 1; + + // + // Reset the motion event. + // + + lastMotion_[0] = '\0'; + + transport_ -> fullReset(); + + return 1; +} + +int ServerChannel::handleAsyncEvents() +{ + // + // Encode more events while decoding the + // proxy messages. + // + + if (transport_ -> readable() > 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleAsyncEvents: WARNING! Encoding events " + << "for FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + #if defined(TEST) || defined(INFO) + + T_timestamp startTs = getTimestamp(); + + #endif + + if (proxy -> handleAsyncRead(fd_) < 0) + { + return -1; + } + + #if defined(TEST) || defined(INFO) + *logofs << "handleAsyncEvents: Spent " << diffTimestamp(startTs, + getTimestamp()) << " Ms handling events for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return 1; + } + + return 0; +} + +int ServerChannel::handleUnpack(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + int resource = *(buffer + 1); + + #ifdef DEBUG + *logofs << "handleUnpack: Unpacking image for resource " << resource + << " with method " << (unsigned int) *(buffer + 12) + << ".\n" << logofs_flush; + #endif + + handleUnpackStateInit(resource); + + T_geometry *geometryState = unpackState_[resource] -> geometry; + T_colormap *colormapState = unpackState_[resource] -> colormap; + T_alpha *alphaState = unpackState_[resource] -> alpha; + + if (geometryState == NULL) + { + #ifdef PANIC + *logofs << "handleUnpack: PANIC! Missing geometry unpacking " + << "image for resource " << resource << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Missing geometry unpacking " + << "image for resource " << resource << ".\n"; + + return -1; + } + + // + // Get the image data from the buffer. + // + + imageState_ -> drawable = GetULONG(buffer + 4, bigEndian_); + imageState_ -> gcontext = GetULONG(buffer + 8, bigEndian_); + + imageState_ -> method = *(buffer + 12); + + imageState_ -> format = *(buffer + 13); + imageState_ -> srcDepth = *(buffer + 14); + imageState_ -> dstDepth = *(buffer + 15); + + imageState_ -> srcLength = GetULONG(buffer + 16, bigEndian_); + imageState_ -> dstLength = GetULONG(buffer + 20, bigEndian_); + + imageState_ -> srcX = GetUINT(buffer + 24, bigEndian_); + imageState_ -> srcY = GetUINT(buffer + 26, bigEndian_); + imageState_ -> srcWidth = GetUINT(buffer + 28, bigEndian_); + imageState_ -> srcHeight = GetUINT(buffer + 30, bigEndian_); + + imageState_ -> dstX = GetUINT(buffer + 32, bigEndian_); + imageState_ -> dstY = GetUINT(buffer + 34, bigEndian_); + imageState_ -> dstWidth = GetUINT(buffer + 36, bigEndian_); + imageState_ -> dstHeight = GetUINT(buffer + 38, bigEndian_); + + #ifdef TEST + *logofs << "handleUnpack: Source X is " << imageState_ -> srcX + << " Y is " << imageState_ -> srcY << " width is " + << imageState_ -> srcWidth << " height is " + << imageState_ -> srcHeight << ".\n" + << logofs_flush; + #endif + + #ifdef TEST + *logofs << "handleUnpack: Destination X is " << imageState_ -> dstX + << " Y is " << imageState_ -> dstY << " width is " + << imageState_ -> dstWidth << " height is " + << imageState_ -> dstHeight << ".\n" + << logofs_flush; + #endif + + if (imageState_ -> srcX != 0 || imageState_ -> srcY != 0) + { + #ifdef PANIC + *logofs << "handleUnpack: PANIC! Unsupported source coordinates " + << "in unpack request.\n" << logofs_flush; + #endif + + return -1; + } + else if (imageState_ -> method == PACK_COLORMAP_256_COLORS && + (colormapState == NULL || colormapState -> data == NULL)) + { + #ifdef PANIC + *logofs << "handleUnpack: PANIC! Cannot find any unpack colormap.\n" + << logofs_flush; + #endif + + return -1; + } + + // + // Field srcLength carries size of image data in + // packed format. Field dstLength is size of the + // image in the original X bitmap format. + // + + unsigned int srcDataOffset = 40; + + unsigned int srcSize = imageState_ -> srcLength; + + unsigned int removeSize = size; + + unsigned char *srcData = buffer + srcDataOffset; + + // + // Get source and destination bits per pixel. + // + + int srcBitsPerPixel = MethodBitsPerPixel(imageState_ -> method); + + if (srcBitsPerPixel <= 0) + { + #ifdef PANIC + *logofs << "handleUnpack: PANIC! Can't identify source " + << "bits per pixel for method " << (unsigned int) + imageState_ -> method << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify source bits " + << "per pixel for method " << (unsigned int) + imageState_ -> method << ".\n"; + + writeBuffer_.removeMessage(removeSize); + + return -1; + } + + #ifdef TEST + *logofs << "handleUnpack: Source bits per pixel are " + << srcBitsPerPixel << " source data size is " + << srcSize << ".\n" << logofs_flush; + #endif + + int dstBitsPerPixel = UnpackBitsPerPixel(geometryState, imageState_ -> dstDepth); + + if (dstBitsPerPixel <= 0) + { + #ifdef PANIC + *logofs << "handleUnpack: PANIC! Can't identify " + << "destination bits per pixel for depth " + << (unsigned int) imageState_ -> dstDepth + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't identify " + << "destination bits per pixel for depth " + << (unsigned int) imageState_ -> dstDepth + << ".\n"; + + writeBuffer_.removeMessage(removeSize); + + return -1; + } + + // + // Destination is a PutImage request. + // + + unsigned int dstDataOffset = 24; + + // + // Output buffer size must match the number of input + // pixels multiplied by the number of bytes per pixel + // of current geometry. + // + + size = (RoundUp4(imageState_ -> dstWidth * dstBitsPerPixel / 8) * + imageState_ -> dstHeight) + dstDataOffset; + + #ifdef TEST + *logofs << "handleUnpack: Destination bits per pixel are " + << dstBitsPerPixel << " destination data size is " + << size - dstDataOffset << ".\n" << logofs_flush; + #endif + + unsigned int dstSize = size - dstDataOffset; + + imageState_ -> dstLines = imageState_ -> dstHeight; + + unsigned char *dstData; + + // + // Size of the final output buffer had to be stored + // in the offset field of XImage/NXPackedImage. + // + + #ifdef WARNING + + if (dstSize != imageState_ -> dstLength) + { + *logofs << "handleUnpack: WARNING! Destination size mismatch " + << "with reported " << imageState_ -> dstLength + << " and actual " << dstSize << ".\n" + << logofs_flush; + } + + #endif + + // + // The decoding algorithm has put the packed image + // in the plain write buffer. Let's use the scratch + // buffer to uncompress the image. + // + + buffer = writeBuffer_.addScratchMessage(size); + + dstData = buffer + dstDataOffset; + + // + // Unpack image into the buffer. + // + + *buffer = (unsigned char) X_PutImage; + + *(buffer + 1) = imageState_ -> format; + + PutUINT(size >> 2, buffer + 2, bigEndian_); + + PutULONG(imageState_ -> drawable, buffer + 4, bigEndian_); + PutULONG(imageState_ -> gcontext, buffer + 8, bigEndian_); + + PutUINT(imageState_ -> dstWidth, buffer + 12, bigEndian_); + PutUINT(imageState_ -> dstLines, buffer + 14, bigEndian_); + + PutUINT(imageState_ -> dstX, buffer + 16, bigEndian_); + PutUINT(imageState_ -> dstY, buffer + 18, bigEndian_); + + *(buffer + 20) = 0; + *(buffer + 21) = imageState_ -> dstDepth; + + #ifdef TEST + *logofs << "handleUnpack: Write buffer size is " + << writeBuffer_.getLength() << " scratch size is " + << writeBuffer_.getScratchLength() << ".\n" + << logofs_flush; + #endif + + int result = 0; + + switch (imageState_ -> method) + { + case PACK_JPEG_8_COLORS: + case PACK_JPEG_64_COLORS: + case PACK_JPEG_256_COLORS: + case PACK_JPEG_512_COLORS: + case PACK_JPEG_4K_COLORS: + case PACK_JPEG_32K_COLORS: + case PACK_JPEG_64K_COLORS: + case PACK_JPEG_256K_COLORS: + case PACK_JPEG_2M_COLORS: + case PACK_JPEG_16M_COLORS: + { + result = UnpackJpeg(geometryState, imageState_ -> method, srcData, + srcSize, dstBitsPerPixel, imageState_ -> dstWidth, + imageState_ -> dstHeight, dstData, dstSize); + break; + } + case PACK_PNG_8_COLORS: + case PACK_PNG_64_COLORS: + case PACK_PNG_256_COLORS: + case PACK_PNG_512_COLORS: + case PACK_PNG_4K_COLORS: + case PACK_PNG_32K_COLORS: + case PACK_PNG_64K_COLORS: + case PACK_PNG_256K_COLORS: + case PACK_PNG_2M_COLORS: + case PACK_PNG_16M_COLORS: + { + result = UnpackPng(geometryState, imageState_ -> method, srcData, + srcSize, dstBitsPerPixel, imageState_ -> dstWidth, + imageState_ -> dstHeight, dstData, dstSize); + break; + } + case PACK_RGB_16M_COLORS: + { + result = UnpackRgb(geometryState, imageState_ -> method, srcData, + srcSize, dstBitsPerPixel, imageState_ -> dstWidth, + imageState_ -> dstHeight, dstData, dstSize); + break; + } + case PACK_RLE_16M_COLORS: + { + result = UnpackRle(geometryState, imageState_ -> method, srcData, + srcSize, dstBitsPerPixel, imageState_ -> dstWidth, + imageState_ -> dstHeight, dstData, dstSize); + break; + } + case PACK_BITMAP_16M_COLORS: + { + result = UnpackBitmap(geometryState, imageState_ -> method, srcData, + srcSize, dstBitsPerPixel, imageState_ -> dstWidth, + imageState_ -> dstHeight, dstData, dstSize); + break; + } + case PACK_COLORMAP_256_COLORS: + { + result = Unpack8(geometryState, colormapState, srcBitsPerPixel, + imageState_ -> srcWidth, imageState_ -> srcHeight, srcData, + srcSize, dstBitsPerPixel, imageState_ -> dstWidth, + imageState_ -> dstHeight, dstData, dstSize); + + break; + } + default: + { + const T_colormask *colorMask = MethodColorMask(imageState_ -> method); + + switch (imageState_ -> method) + { + case PACK_MASKED_8_COLORS: + case PACK_MASKED_64_COLORS: + case PACK_MASKED_256_COLORS: + { + result = Unpack8(geometryState, colorMask, imageState_ -> srcDepth, + imageState_ -> srcWidth, imageState_ -> srcHeight, + srcData, srcSize, imageState_ -> dstDepth, + imageState_ -> dstWidth, imageState_ -> dstHeight, + dstData, dstSize); + break; + } + case PACK_MASKED_512_COLORS: + case PACK_MASKED_4K_COLORS: + case PACK_MASKED_32K_COLORS: + case PACK_MASKED_64K_COLORS: + { + result = Unpack16(geometryState, colorMask, imageState_ -> srcDepth, + imageState_ -> srcWidth, imageState_ -> srcHeight, + srcData, srcSize, imageState_ -> dstDepth, + imageState_ -> dstWidth, imageState_ -> dstHeight, + dstData, dstSize); + break; + } + case PACK_MASKED_256K_COLORS: + case PACK_MASKED_2M_COLORS: + case PACK_MASKED_16M_COLORS: + { + result = Unpack24(geometryState, colorMask, imageState_ -> srcDepth, + imageState_ -> srcWidth, imageState_ -> srcHeight, + srcData, srcSize, imageState_ -> dstDepth, + imageState_ -> dstWidth, imageState_ -> dstHeight, + dstData, dstSize); + break; + } + default: + { + break; + } + } + } + } + + writeBuffer_.removeMessage(removeSize); + + if (result <= 0) + { + #ifdef PANIC + *logofs << "handleUnpack: PANIC! Failed to unpack image " + << "with method '" << (unsigned int) imageState_ -> method + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to unpack image " + << "with method '" << (unsigned int) imageState_ -> method + << "'.\n"; + + // + // TODO: We should mark the image somehow, + // and force the remote to remove it from + // the cache. + // + + writeBuffer_.removeScratchMessage(); + + return -1; + } + + // + // Alpha channel is used only on some 32 bits pixmaps + // and only if render extension is in use. Presently + // we don't have an efficient way to know in advance + // if mask must be applied or not to the image. If an + // alpha channel is set, the function will check if + // the size of the alpha data matches the size of the + // image. In the worst case we'll create an useless + // alpha plane for a pixmap that doesn't need it. + // + + if (alphaState != NULL && alphaState -> data != NULL && + imageState_ -> dstDepth == 32) + { + UnpackAlpha(alphaState, dstData, dstSize, imageByteOrder_); + } + + return 1; +} + +int ServerChannel::handleAuthorization(unsigned char *buffer) +{ + // + // At the present moment we don't support more than + // a single display for each proxy, so authorization + // data is shared among all the channels. + // + // Use the following code to simulate authentication + // failures on a LSB machine: + // + // memcpy(buffer + 12 + (((buffer[6] + 256 * + // buffer[7]) + 3) & ~3), "1234567890123456", 16); + // + + if (auth == NULL) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleAuthorization: Forwarding the real cookie " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (auth -> checkCookie(buffer) == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleAuthorization: Matched the fake cookie " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return 1; + } + else + { + #if defined(TEST) || defined(INFO) + *logofs << "handleAuthorization: WARNING! Failed to match " + << "the fake cookie for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + return -1; + } +} + +int ServerChannel::handleAuthorization(const unsigned char *buffer, int size) +{ + // + // Check the X server's response and, in the case of + // an error, print the textual information reported + // by the server. + // + + if (*buffer != 1) + { + const char *reason = NULL; + + // + // At the moment we don't take into account the end- + // ianess of the reply. This should work in any case + // because we simply try to match a few well-known + // error strings. + // + + if (size >= INVALID_COOKIE_SIZE + 8 && + memcmp(buffer + 8, INVALID_COOKIE_DATA, + INVALID_COOKIE_SIZE) == 0) + { + reason = INVALID_COOKIE_DATA; + } + else if (size >= NO_AUTH_PROTO_SIZE + 8 && + memcmp(buffer + 8, NO_AUTH_PROTO_DATA, + NO_AUTH_PROTO_SIZE) == 0) + { + reason = NO_AUTH_PROTO_DATA; + } + else + { + reason = "Unknown"; + } + + #ifdef WARNING + *logofs << "handleAuthorization: WARNING! X connection failed " + << "with error '" << reason << "' on FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + cerr << "Warning" << ": X connection failed " + << "with error '" << reason << "'.\n"; + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "handleAuthorization: X connection successful " + << "on FD#" << fd_ << ".\n" << logofs_flush; + } + #endif + + return 1; +} + +// +// Use a simple encoding. Need to handle the image +// requests in the usual way and the X_ListExtensions +// and X_QueryExtension to hide MIT-SHM and RENDER +// in the reply. +// + +int ServerChannel::handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // All the NX requests are handled in the + // main message loop. + // + + // + // Since ProtoStep7 (#issue 108) + // + // The X_PutImage can be handled here only + // if a split was not requested. + // + + if ((opcode >= X_NXFirstOpcode && opcode <= X_NXLastOpcode) || + (opcode == X_PutImage && splitState_.resource != nothing) || + opcode == X_ListExtensions || + opcode == X_QueryExtension) + { + return 0; + } + + #ifdef DEBUG + *logofs << "handleFastWriteRequest: Decoding raw request OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + buffer = writeBuffer_.addMessage(4); + + #ifndef __sun + + unsigned int *next = (unsigned int *) decodeBuffer.decodeMemory(4); + + *((unsigned int *) buffer) = *next; + + #else /* #ifndef __sun */ + + memcpy(buffer, decodeBuffer.decodeMemory(4), 4); + + #endif /* #ifndef __sun */ + + size = GetUINT(buffer + 2, bigEndian_) << 2; + + if (size < 4) + { + #ifdef WARNING + *logofs << "handleFastWriteRequest: WARNING! Assuming size 4 " + << "for suspicious message of size " << size + << ".\n" << logofs_flush; + #endif + + size = 4; + } + + writeBuffer_.registerPointer(&buffer); + + if (writeBuffer_.getAvailable() < size - 4 || + (int) size >= control -> TransportFlushBufferSize) + { + #ifdef DEBUG + *logofs << "handleFastWriteRequest: Using scratch buffer for OPCODE#" + << (unsigned int) opcode << " with size " << size << " and " + << writeBuffer_.getLength() << " bytes in buffer.\n" + << logofs_flush; + #endif + + // + // The procedure moving data to shared memory + // assumes that the full message is stored in + // the scratch buffer. We can safely let the + // scratch buffer inherit the decode buffer + // at the next offset. + // + + writeBuffer_.removeMessage(4); + + buffer = writeBuffer_.addScratchMessage(((unsigned char *) + decodeBuffer.decodeMemory(size - 4)) - 4, size); + } + else + { + writeBuffer_.addMessage(size - 4); + + #ifndef __sun + + if (size <= 32) + { + next = (unsigned int *) decodeBuffer.decodeMemory(size - 4); + + for (unsigned int i = 4; i < size; i += sizeof(unsigned int)) + { + *((unsigned int *) (buffer + i)) = *next++; + } + } + else + { + memcpy(buffer + 4, decodeBuffer.decodeMemory(size - 4), size - 4); + } + + #else /* #ifndef __sun */ + + memcpy(buffer + 4, decodeBuffer.decodeMemory(size - 4), size - 4); + + #endif /* #ifndef __sun */ + } + + // + // Opcode could have been tainted by the client + // proxy. Replace the original opcode with the + // one sent in the decode buffer. + // + + *buffer = opcode; + + writeBuffer_.unregisterPointer(); + + if (opcode == X_PutImage) + { + handleImage(opcode, buffer, size); + } + + #if defined(TEST) || defined(OPCODES) + + if (opcode != 0) + { + *logofs << "handleFastWriteRequest: Handled request " + << "OPCODE#" << (unsigned int) opcode << " (" + << DumpOpcode(opcode) << ") for FD#" << fd_ + << " sequence " << clientSequence_ << ". " + << size << " bytes out.\n" << logofs_flush; + } + else + { + *logofs << "handleFastWriteRequest: Handled image or " + << "other request for FD#" << fd_ + << " sequence " << clientSequence_ << ". " + << size << " bytes out.\n" << logofs_flush; + } + + #endif + + handleFlush(flush_if_needed); + + return 1; +} + +// +// Use the simplest encoding except for replies that +// need to be managed some way. +// + +int ServerChannel::handleFastReadReply(EncodeBuffer &encodeBuffer, const unsigned char &opcode, + const unsigned char *&buffer, const unsigned int &size) +{ + // + // If we pushed a X_GetInputFocus in the sequence + // queue this means that the original message was + // a NX request for which we have to provide a NX + // reply. + // + + if ((opcode >= X_NXFirstOpcode && + opcode <= X_NXLastOpcode) || + opcode == X_QueryExtension || + opcode == X_ListExtensions || + opcode == X_GetInputFocus) + { + return 0; + } + + #ifdef DEBUG + *logofs << "handleFastReadReply: Encoding raw reply OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << " with size " << size << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeMemory(buffer, size); + + // + // Send back the reply as soon + // as possible. + // + + priority_++; + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + *logofs << "handleFastReadReply: Handled raw reply OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ << " sequence " + << serverSequence_ << ". " << size << " bytes in, " + << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + #endif + + statistics -> addReplyBits(opcode, size << 3, bits); + + return 1; +} + +int ServerChannel::handleFastReadEvent(EncodeBuffer &encodeBuffer, const unsigned char &opcode, + const unsigned char *&buffer, const unsigned int &size) +{ + #ifdef DEBUG + *logofs << "handleFastReadEvent: Encoding raw " + << (opcode == X_Error ? "error" : "event") << " OPCODE#" + << (unsigned int) opcode << " for FD#" << fd_ + << " with size " << size << ".\n" + << logofs_flush; + #endif + + encodeBuffer.encodeMemory(buffer, size); + + switch (opcode) + { + case X_Error: + case ButtonPress: + case ButtonRelease: + case KeyPress: + case KeyRelease: + { + priority_++; + } + } + + int bits = encodeBuffer.diffBits(); + + #if defined(TEST) || defined(OPCODES) + + if (opcode == X_Error) + { + unsigned char code = *(buffer + 1); + + *logofs << "handleFastReadEvent: Handled error ERR_CODE#" + << (unsigned int) code << " for FD#" << fd_; + + *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); + + *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); + + *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); + + *logofs << " sequence " << serverSequence_ << ". " << size + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + } + else + { + *logofs << "handleFastReadEvent: Handled event OPCODE#" + << (unsigned int) *buffer << " for FD#" << fd_ + << " sequence " << serverSequence_ << ". " << size + << " bytes in, " << bits << " bits (" << ((float) bits) / 8 + << " bytes) out.\n" << logofs_flush; + } + + #endif + + statistics -> addEventBits(opcode, size << 3, bits); + + return 1; +} + +void ServerChannel::initCommitQueue() +{ + #ifdef TEST + *logofs << "initCommitQueue: Resetting the queue of split commits " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE; i++) + { + commitSequenceQueue_[i] = 0; + } +} + +void ServerChannel::updateCommitQueue(unsigned short sequence) +{ + for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE - 1; i++) + { + commitSequenceQueue_[i + 1] = commitSequenceQueue_[i]; + } + + #ifdef TEST + *logofs << "updateCommitQueue: Saved " << sequence + << " as last sequence number of image to commit.\n" + << logofs_flush; + #endif + + commitSequenceQueue_[0] = sequence; +} + +int ServerChannel::checkCommitError(unsigned char error, unsigned short sequence, + const unsigned char *buffer) +{ + // + // Check if error is due to an image commit + // generated at the end of a split. + // + // TODO: It should zero the head of the list + // when an event comes with a sequence number + // greater than the value of the last element + // added. + // + + for (int i = 0; i < MAX_COMMIT_SEQUENCE_QUEUE && + commitSequenceQueue_[i] != 0; i++) + { + #ifdef TEST + *logofs << "checkCommitError: Checking committed image's " + << "sequence number " << commitSequenceQueue_[i] + << " with input sequence " << sequence << ".\n" + << logofs_flush; + #endif + + if (commitSequenceQueue_[i] == sequence) + { + #ifdef WARNING + + *logofs << "checkCommitError: WARNING! Failed operation for " + << "FD#" << fd_ << " with ERR_CODE#" + << (unsigned int) *(buffer + 1); + + *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); + + *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); + + *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); + + *logofs << " sequence " << sequence << ".\n"; + + *logofs << logofs_flush; + + #endif + + cerr << "Warning" << ": Failed commit operation " + << "with ERR_CODE#" << (unsigned int) error; + + cerr << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); + + cerr << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); + + cerr << " MAJ_OP#" << (unsigned int) *(buffer + 10); + + cerr << ".\n"; + + #ifdef WARNING + *logofs << "checkCommitError: WARNING! Suppressing error on " + << "OPCODE#" << (unsigned int) opcodeStore_ -> commitSplit + << " for FD#" << fd_ << " with sequence " << sequence + << " at position " << i << ".\n" << logofs_flush; + #endif + + return 0; + } + } + + return 0; +} + +// +// Check if the user pressed the CTRL+ALT+SHIFT+ESC +// keystroke. At the present moment it uses different +// keycodes based on the client OS. This should be +// implemented in a way that is platform independent +// (that's not an easy task, considered that we don't +// have access to the higher level X libraries). +// + +int ServerChannel::checkKeyboardEvent(unsigned char event, unsigned short sequence, + const unsigned char *buffer) +{ + #ifdef TEST + *logofs << "checkKeyboardEvent: Checking escape sequence with byte [1] " + << (void *) ((unsigned) *(buffer + 1)) << " and bytes [28-29] " + << (void *) ((unsigned) GetUINT(buffer + 28, bigEndian_)) + << " for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + #ifdef __APPLE__ + + int alert = (*(buffer + 1) == 0x3d && + GetUINT(buffer + 28, bigEndian_) == 0x2005); + + #else + + int alert = (*(buffer + 1) == 0x09 && + ((GetUINT(buffer + 28, bigEndian_) & + 0x0d) == 0x0d)); + + #endif + + if (alert == 1) + { + #ifdef PANIC + *logofs << "checkKeyboardEvent: PANIC! Received sequence " + << "CTRL+ALT+SHIFT+ESC " << "for FD#"<< fd_ + << ". Showing the abort dialog.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Received sequence CTRL+ALT+SHIFT+ESC. " + << "Showing the abort dialog.\n"; + + HandleAlert(CLOSE_UNRESPONSIVE_X_SERVER_ALERT, 1); + } + + return alert; +} + +// +// Handle the MIT-SHM initialization +// messages exchanged with the remote +// proxy. +// + +int ServerChannel::handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned int stage, const unsigned char *buffer, + const unsigned int size) +{ + #ifdef TEST + *logofs << "handleShmemReply: Returning shmem reply for " + << "stage " << stage << ".\n" << logofs_flush; + #endif + + if (opcode == X_QueryExtension) + { + encodeBuffer.encodeValue(stage, 2); + +#ifndef ANDROID + shmemState_ -> present = *(buffer + 8); +#else + shmemState_ -> present = 0; + cerr << "Info: handleShmemReply: In android no shared memory. Setting present to 0 hardcoded\n"; +#endif + shmemState_ -> opcode = *(buffer + 9); + shmemState_ -> event = *(buffer + 10); + shmemState_ -> error = *(buffer + 11); + + #ifdef TEST + *logofs << "handleShmemReply: Extension present is " + << shmemState_ -> present << " with base OPCODE#" + << (unsigned int) shmemState_ -> opcode << " base event " + << (unsigned int) shmemState_ -> event << " base error " + << (unsigned int) shmemState_ -> error << ".\n" + << logofs_flush; + #endif + } + else if (opcode == X_GetInputFocus) + { + encodeBuffer.encodeValue(stage, 2); + + encodeBuffer.encodeBoolValue(0); + + if (shmemState_ -> present == 1 && + shmemState_ -> address != NULL && + shmemState_ -> segment > 0 && + shmemState_ -> id > 0) + { + cerr << "Info" << ": Using shared memory parameters 1/" + << (shmemState_ -> size / 1024) << "K.\n"; + +#ifndef ANDROID + shmemState_ -> enabled = 1; +#else + cerr << "Info: handleShmemReply: In android no shared memory. Setting enabled to -1. This should not be displayed\n"; + shmemState_ -> enabled = -1; +#endif + + encodeBuffer.encodeBoolValue(1); + } + else + { + #ifdef TEST + *logofs << "handleShmemReply: WARNING! Not using shared memory " + << "support in X server for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Info" << ": Using shared memory parameters 0/0K.\n"; + + handleShmemStateRemove(); + + encodeBuffer.encodeBoolValue(0); + } + } + else + { + #ifdef PANIC + *logofs << "handleShmemReply: PANIC! Conversation error " + << "handling shared memory support for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Conversation error handling " + << "shared memory support.\n"; + + return -1; + } + + return 1; +} + +int ServerChannel::handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // We need to query and initialize MIT-SHM on + // the real X server. To do this we'll need 3 + // requests. At the end we'll have to encode + // the final reply for the X client side. + // + + handleShmemStateAlloc(); + + unsigned int stage; + + decodeBuffer.decodeValue(stage, 2); + + unsigned int expected = shmemState_ -> stage + 1; + + if (stage != expected || stage > 2) + { + #ifdef PANIC + *logofs << "handleShmemRequest: PANIC! Unexpected stage " + << stage << " in handling shared memory " + << "support for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Unexpected stage " + << stage << " in handling shared memory " + << "support for FD#" << fd_ << ".\n"; + + return -1; + } + + switch (stage) + { + case 0: + { + unsigned int enableClient; + unsigned int enableServer; + + decodeBuffer.decodeBoolValue(enableClient); + decodeBuffer.decodeBoolValue(enableServer); + + unsigned int clientSegment; + unsigned int serverSegment; + + decodeBuffer.decodeValue(clientSegment, 29, 9); + decodeBuffer.decodeValue(serverSegment, 29, 9); + + shmemState_ -> segment = serverSegment; + + #ifdef TEST + *logofs << "handleShmemRequest: Size of the shared memory " + << "segment will be " << control -> ShmemServerSize + << ".\n" << logofs_flush; + #endif + + #ifdef TEST + *logofs << "handleShmemRequest: Sending X_QueryExtension request " + << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) + opcodeStore_ -> getShmemParameters << " in stage " + << stage << ".\n" << logofs_flush; + #endif + + opcode = X_QueryExtension; + + size = 16; + buffer = writeBuffer_.addMessage(size); + + PutUINT(7, buffer + 4, bigEndian_); + + // + // Simply make the query fail if shared + // memory support is disabled by the + // user. + // +#ifndef ANDROID + if (control -> ShmemServer == 1 && + control -> ShmemServerSize > 0 && + enableServer == 1) + { + memcpy(buffer + 8, "MIT-SHM", 7); + } + else + { + memcpy(buffer + 8, "NO-MIT-", 7); + } +#else + cerr << "Info: handleShmemRequest: In android no shared memory. Returning NO-MIT- answer\n"; + + memcpy(buffer + 8, "NO-MIT-", 7); +#endif + sequenceQueue_.push(clientSequence_, opcode, + opcodeStore_ -> getShmemParameters, stage); + + // + // Save the sequence number so we can + // later identify any matching X error + // received from server. + // + + shmemState_ -> sequence = clientSequence_; + + break; + } + case 1: + { + if (shmemState_ -> present == 1) + { + // + // Make the segment read-write for everybody on + // Cygwin (to avoid any lack of support or any + // performance issue) and on MacOS/X (where the + // 0600 mask doesn't seem to work). + // + + #if defined(__CYGWIN32__) || defined(__APPLE__) + + int permissions = 0777; + + #else + + int permissions = 0600; + + #endif + + shmemState_ -> size = control -> ShmemServerSize; + +#ifndef ANDROID + shmemState_ -> id = shmget(IPC_PRIVATE, shmemState_ -> size, + IPC_CREAT | permissions); +#else + cerr << "Info: handleShmemReqyest: In android no shared memory (shmget). This message should not be displayed present should never be 1 in android\n"; + shmemState_ -> id = -1; +#endif + if (shmemState_ -> id >= 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleShmemRequest: Allocated shared memory " + << "segment of " << shmemState_ -> size + << " bytes with id " << shmemState_ -> id + << ".\n" << logofs_flush; + #endif + + +#ifndef ANDROID + shmemState_ -> address = shmat(shmemState_ -> id, 0, 0); +#else + cerr << "Info: handleShmemReqyest: In android no shared memory (shmat). This message should not be displayed. present should never be 1 in android\n"; + shmemState_ -> address = NULL; +#endif + if (shmemState_ -> address != NULL) + { + #ifdef TEST + *logofs << "handleShmemRequest: Sending X_ShmAttach request " + << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) + opcodeStore_ -> getShmemParameters << " in stage " + << stage << ".\n" << logofs_flush; + #endif + + opcode = shmemState_ -> opcode; + + size = 16; + buffer = writeBuffer_.addMessage(size); + + *(buffer + 1) = X_ShmAttach; + + PutULONG(shmemState_ -> segment, buffer + 4, bigEndian_); + PutULONG(shmemState_ -> id, buffer + 8, bigEndian_); + + *(buffer + 12) = 1; + + shmemState_ -> sequence = clientSequence_; + + break; + } + else + { + #ifdef WARNING + *logofs << "handleShmemRequest: WARNING! Can't attach the shared " + << "memory segment. Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Can't attach the shared memory " + << "segment. Error is " << EGET() << " '" + << ESTR() << "'.\n"; + } + } + else + { + #ifndef __CYGWIN32__ + + #ifdef WARNING + *logofs << "handleShmemRequest: WARNING! Can't create the shared " + << "memory segment. Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Can't create the shared memory " + << "segment. Error is " << EGET() << " '" + << ESTR() << "'.\n"; + + #else + + #ifdef TEST + *logofs << "handleShmemRequest: WARNING! Can't create the shared " + << "memory segment. Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + #endif + } + } + + if (shmemState_ -> present != 0) + { + #ifdef TEST + *logofs << "handleShmemRequest: Resetting shared memory " + << "presence flag for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + shmemState_ -> present = 0; + } + + handleNullRequest(opcode, buffer, size); + + break; + } + default: + { + #ifdef TEST + *logofs << "handleShmemRequest: Sending X_GetInputFocus request " + << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) + opcodeStore_ -> getShmemParameters << " in stage " + << stage << ".\n" << logofs_flush; + #endif + + opcode = X_GetInputFocus; + + size = 4; + buffer = writeBuffer_.addMessage(size); + + sequenceQueue_.push(clientSequence_, opcode, + opcodeStore_ -> getShmemParameters, stage); + break; + } + } + + shmemState_ -> stage += 1; + + return 1; +} + +// +// Handling of MIT-SHM extension has been plugged late in +// the design, so we have to make some assumptions. Image +// is a X_PutImage request contained either in the scratch +// buffer or in the normal write buffer. We need to move +// the image data to the shared memory segment and replace +// the X_PutImage request with a X_ShmPutImage. +// + +int ServerChannel::handleShmem(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size) +{ + if (shmemState_ == NULL || shmemState_ -> enabled != 1) + { + #ifdef TEST + + if (shmemState_ != NULL) + { + *logofs << "handleShmem: PANIC! Shared memory " + << "state found but support is not enabled " + << "for FD#" << fd_ << " in stage " + << shmemState_ -> stage << ".\n" + << logofs_flush; + } + + #endif + + return 0; + } +#ifdef ANDROID + cerr << "Info: handleShmem: In android no shared memory. enabled should never be 1. This should not be displayed\n"; + return 0; +#endif + + // + // Ignore null requests and requests that will not result + // in a single X_PutImage. To conform with the other func- + // tions, we get the opcode passed as a parameter. It can + // be zero if we don't want the write loop to put opcode + // and length in the resulting buffer. Anyway we are only + // interested in the original opcode of the request, that + // is stored in the image state. + // + + unsigned char *dstData = buffer + 24; + unsigned int dstDataSize = size - 24; + + if (dstDataSize == 0 || dstDataSize > + (unsigned int) control -> MaximumRequestSize) + { + #ifdef TEST + *logofs << "handleShmem: Ignoring image with opcode " + << (unsigned int) imageState_ -> opcode + << " and size " << size << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + return 0; + } + + #ifdef TEST + *logofs << "handleShmem: Handling image with opcode " + << (unsigned int) imageState_ -> opcode + << " and size " << size << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + // + // Get image data from buffer. + // + + if (imageState_ -> opcode == X_PutImage) + { + // + // We still need to get the image's data. + // + + imageState_ -> format = *(buffer + 1); + + imageState_ -> drawable = GetULONG(buffer + 4, bigEndian_); + imageState_ -> gcontext = GetULONG(buffer + 8, bigEndian_); + + imageState_ -> dstWidth = GetUINT(buffer + 12, bigEndian_); + imageState_ -> dstHeight = GetUINT(buffer + 14, bigEndian_); + + imageState_ -> srcX = 0; + imageState_ -> srcY = 0; + + imageState_ -> srcWidth = imageState_ -> dstWidth; + imageState_ -> srcHeight = imageState_ -> dstHeight; + + imageState_ -> dstX = GetUINT(buffer + 16, bigEndian_); + imageState_ -> dstY = GetUINT(buffer + 18, bigEndian_); + + imageState_ -> leftPad = *(buffer + 20); + imageState_ -> dstDepth = *(buffer + 21); + + imageState_ -> dstLines = imageState_ -> dstHeight; + + imageState_ -> dstLength = size - 24; + } + + // + // Skip the MIT-SHM operation if the image + // is 1 bits-per-plane. + // + + if (imageState_ -> dstDepth == 1) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleShmem: Ignoring image with opcode " + << (unsigned int) imageState_ -> opcode << " depth " + << (unsigned int) imageState_ -> dstDepth << " and " + << "size " << size << " for FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + return 0; + } + + // + // If the image can't fit in the available + // space, check if the completion event is + // arrived. + // + + #if defined(TEST) || defined(INFO) + + if (isTimestamp(shmemState_ -> last) == 0 && + shmemState_ -> offset != 0) + { + *logofs << "handleShmem: PANIC! No timestamp for sequence " + << shmemState_ -> sequence << " with offset " + << shmemState_ -> offset << ".\n" + << logofs_flush; + } + + #endif + + if (shmemState_ -> offset + imageState_ -> dstLength > + shmemState_ -> size) + { + if (imageState_ -> dstLength > shmemState_ -> size) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleShmem: WARNING! Can't fit the image " + << "in the available memory segment for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (handleShmemEvent() <= 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleShmem: WARNING! Missing completion " + << "after " << diffTimestamp(shmemState_ -> last, + getTimestamp()) << " Ms for shared memory " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + return 0; + } + } + + // + // Let image start at current offset + // in the shared segment. + // + + #ifdef TEST + *logofs << "handleShmem: Copying " << dstDataSize + << " bytes to shared memory at offset " + << shmemState_ -> offset << " for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + memcpy((unsigned char *) shmemState_ -> address + + shmemState_ -> offset, dstData, dstDataSize); + + // + // Get rid of the original X_PutImage + // request. + // + + if (writeBuffer_.getScratchData() != NULL) + { + writeBuffer_.removeScratchMessage(); + } + else + { + writeBuffer_.removeMessage(size); + } + + // + // Add a X_ShmPutImage request to the + // write buffer. + // + + buffer = writeBuffer_.addMessage(40); + + *buffer = shmemState_ -> opcode; + + *(buffer + 1) = X_ShmPutImage; + + PutUINT(40 >> 2, buffer + 2, bigEndian_); + + PutULONG(imageState_ -> drawable, buffer + 4, bigEndian_); + PutULONG(imageState_ -> gcontext, buffer + 8, bigEndian_); + + PutUINT(imageState_ -> dstWidth, buffer + 12, bigEndian_); + PutUINT(imageState_ -> dstLines, buffer + 14, bigEndian_); + + PutUINT(imageState_ -> srcX, buffer + 16, bigEndian_); + PutUINT(imageState_ -> srcY, buffer + 18, bigEndian_); + + PutUINT(imageState_ -> dstWidth, buffer + 20, bigEndian_); + PutUINT(imageState_ -> dstLines, buffer + 22, bigEndian_); + + PutUINT(imageState_ -> dstX, buffer + 24, bigEndian_); + PutUINT(imageState_ -> dstY, buffer + 26, bigEndian_); + + *(buffer + 28) = imageState_ -> dstDepth; + *(buffer + 29) = imageState_ -> format; + *(buffer + 30) = 1; + + PutULONG(shmemState_ -> segment, buffer + 32, bigEndian_); + PutULONG(shmemState_ -> offset, buffer + 36, bigEndian_); + + shmemState_ -> offset += dstDataSize; + + shmemState_ -> sequence = clientSequence_; + shmemState_ -> last = getTimestamp(); + + #ifdef TEST + *logofs << "handleShmem: Saved shared memory sequence " + << shmemState_ -> sequence << " for FD#" << fd_ + << " with offset " << shmemState_ -> offset + << " at " << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + + // + // Make the X server read immediately + // from the shared memory buffer and + // produce the completion event. + // + + handleFlush(flush_if_any); + + return 1; +} + +// +// Try to read more events from the socket in the +// attempt to get the completion event required +// to reset the MIT-SHM segment. +// + +int ServerChannel::handleShmemEvent() +{ + #if defined(TEST) || defined(INFO) + *logofs << "handleShmemEvent: Waiting for shared memory " + << "sequence " << shmemState_ -> sequence + << " for X server FD#" << fd_ << ".\n" + << logofs_flush; + + T_timestamp startTs = getTimestamp(); + + #endif + + while (isTimestamp(shmemState_ -> last) != 0) + { + if (handleWait(control -> ShmemTimeout) <= 0) + { + break; + } + #if defined(TEST) || defined(INFO) + else + { + *logofs << "handleShmemEvent: WARNING! Encoded events " + << "for FD#" << fd_ << " at " << strMsTimestamp() + << ".\n" << logofs_flush; + } + #endif + } + + if (isTimestamp(shmemState_ -> last) == 0) + { + #if defined(TEST) || defined(INFO) + *logofs << "handleShmemEvent: Spent " + << diffTimestamp(startTs, getTimestamp()) << " Ms " + << "waiting for shared memory sequence for FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + return 1; + } + + #if defined(TEST) || defined(INFO) + *logofs << "handleShmemEvent: WARNING! Can't reset shared " + << "memory sequence for FD#" << fd_ << " after " + << diffTimestamp(shmemState_ -> last, getTimestamp()) + << " Ms.\n" << logofs_flush; + #endif + + return 0; +} + +int ServerChannel::checkShmemEvent(unsigned char event, unsigned short sequence, + const unsigned char *buffer) +{ + if (isTimestamp(shmemState_ -> last) == 1 && + sequence == shmemState_ -> sequence) + { + #ifdef TEST + *logofs << "checkShmemEvent: Reset shared memory sequence " + << shmemState_ -> sequence << " for FD#" << fd_ + << " after " << diffTimestamp(shmemState_ -> last, + getTimestamp()) << " Ms.\n" << logofs_flush; + #endif + + shmemState_ -> sequence = 0; + shmemState_ -> offset = 0; + shmemState_ -> last = nullTimestamp(); + } + #ifdef TEST + else + { + *logofs << "checkShmemEvent: Skipping past shared memory " + << "image sequence " << sequence << " for FD#" + << fd_ << ".\n" << logofs_flush; + } + #endif + + return 1; +} + +int ServerChannel::checkShmemError(unsigned char error, unsigned short sequence, + const unsigned char *buffer) +{ + #ifdef TEST + + *logofs << "checkShmemError: WARNING! Failed operation for " + << "FD#" << fd_ << " in stage " << shmemState_ -> stage + << " with ERR_CODE#" << (unsigned int) *(buffer + 1); + + *logofs << " RES_ID#" << GetULONG(buffer + 4, bigEndian_); + + *logofs << " MIN_OP#" << GetUINT(buffer + 8, bigEndian_); + + *logofs << " MAJ_OP#" << (unsigned int) *(buffer + 10); + + *logofs << " sequence " << sequence << ".\n"; + + *logofs << logofs_flush; + + #endif + + // + // If enabled flag is <= 0 we are still + // in the inizialization phase. In this + // case force presence to false. + // + + if (shmemState_ -> enabled != 1) + { + if (shmemState_ -> present != 0) + { + #ifdef TEST + *logofs << "checkShmemError: Resetting shared memory " + << "presence flag for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + shmemState_ -> present = 0; + } + + return 0; + } + + if (shmemState_ -> sequence == sequence) + { + // + // Reset the sequence and timestamp. + // + + shmemState_ -> sequence = 0; + shmemState_ -> offset = 0; + shmemState_ -> last = nullTimestamp(); + } + + return 1; +} + +int ServerChannel::handleFontRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // Send a synchronization request and use + // the reply to return the requested font + // path. + // + + #ifdef TEST + *logofs << "handleFontRequest: Sending X_GetInputFocus request " + << "for FD#" << fd_ << " due to OPCODE#" << (unsigned int) + opcodeStore_ -> getFontParameters << ".\n" + << logofs_flush; + #endif + + opcode = X_GetInputFocus; + + size = 4; + buffer = writeBuffer_.addMessage(size); + + sequenceQueue_.push(clientSequence_, X_GetInputFocus, + opcodeStore_ -> getFontParameters); + + return 1; +} + +int ServerChannel::handleFontReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) +{ + #ifdef TEST + *logofs << "handleFontReply: Encoding font operation " + << "reply with size " << size << ".\n" + << logofs_flush; + #endif + + char data[256]; + + if (fontPort_ != -1) + { + sprintf(data + 1, "tcp/localhost:%d", fontPort_); + } + else + { + *(data + 1) = '\0'; + } + + *data = strlen(data + 1); + + unsigned char *next = (unsigned char *) data; + + unsigned int length = (unsigned int) (*next++); + + encodeBuffer.encodeValue(length, 8); + + encodeBuffer.encodeTextData(next, length); + + return 1; +} + +int ServerChannel::handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + unsigned int mask; + + decodeBuffer.decodeCachedValue(mask, 32, clientCache_ -> + setCacheParametersCache); + + splitState_.save = (mask >> 8) & 0xff; + splitState_.load = mask & 0xff; + + #ifdef TEST + *logofs << "handleCacheRequest: Set cache parameters to " + << "save " << splitState_.save << " load " + << splitState_.load << ".\n" << logofs_flush; + #endif + + handleNullRequest(opcode, buffer, size); + + return 1; +} + +int ServerChannel::handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // Prepare for the split for the selected + // resource. Old proxy versions only used + // the split store at position 0. + // + + // Since ProtoStep7 (#issue 108) + unsigned char resource; + + decodeBuffer.decodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + splitState_.resource = resource; + + splitState_.current = splitState_.resource; + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleStartSplitRequest: SPLIT! Registered id " + << splitState_.resource << " as resource " + << "waiting for a split.\n" << logofs_flush; + #endif + + handleNullRequest(opcode, buffer, size); + + return 1; +} + +int ServerChannel::handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size) +{ + // + // Verify that the agent resource matches. + // + + // Since ProtoStep7 (#issue 108) + unsigned char resource; + + decodeBuffer.decodeCachedValue(resource, 8, + clientCache_ -> resourceCache); + + #ifdef TEST + + if (splitState_.resource == nothing) + { + #ifdef PANIC + *logofs << "handleEndSplitRequest: PANIC! SPLIT! Received an end of " + << "split for resource id " << (unsigned int) *(buffer + 1) + << " without a previous start.\n" + << logofs_flush; + #endif + + HandleCleanup(); + } + else if (resource != splitState_.resource) + { + #ifdef PANIC + *logofs << "handleEndSplitRequest: PANIC! SPLIT! Invalid resource id " + << resource << " received while waiting for resource id " + << splitState_.resource << ".\n" << logofs_flush; + #endif + + HandleCleanup(); + } + + #endif + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleEndSplitRequest: SPLIT! Reset id " + << splitState_.resource << " as resource " + << "selected for splits.\n" << logofs_flush; + #endif + + splitState_.resource = nothing; + + handleNullRequest(opcode, buffer, size); + + return 1; +} + +int ServerChannel::handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum) +{ + unsigned int receive; + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeBoolValue(receive); + + if (receive == 1) + { + checksum = new md5_byte_t[MD5_LENGTH]; + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + decodeBuffer.decodeValue(receive, 8); + + if (checksum != NULL) + { + checksum[i] = (unsigned char) receive; + } + } + + #if defined(TEST) || defined(SPLIT) + *logofs << "handleSplitChecksum: SPLIT! Received checksum " + << "[" << DumpChecksum(checksum) << "].\n" + << logofs_flush; + #endif + + return 1; + } + + return 0; +} + +void ServerChannel::handleShmemStateAlloc() +{ + if (shmemState_ == NULL) + { + shmemState_ = new T_shmem_state(); + + shmemState_ -> stage = -1; + shmemState_ -> present = -1; + shmemState_ -> enabled = -1; + + shmemState_ -> segment = -1; + shmemState_ -> id = -1; + shmemState_ -> address = NULL; + shmemState_ -> size = 0; + + shmemState_ -> opcode = 0xff; + shmemState_ -> event = 0xff; + shmemState_ -> error = 0xff; + + shmemState_ -> sequence = 0; + shmemState_ -> offset = 0; + shmemState_ -> last = nullTimestamp(); + + shmemState_ -> checked = 0; + } +} + +void ServerChannel::handleShmemStateRemove() +{ + if (shmemState_ != NULL) + { + if (shmemState_ -> address != NULL) + { +#ifndef ANDROID + shmdt((char *) shmemState_ -> address); +#else + cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. address should always be NULL\n"; +#endif + } + + if (shmemState_ -> id > 0) + { +#ifndef ANDROID + shmctl(shmemState_ -> id, IPC_RMID, 0); +#else + cerr << "Info: handleShmemStateRemove: In android no shared memory. This should not be displayed. id should always be 0\n"; +#endif + } + + delete shmemState_; + + shmemState_ = NULL; + } +} + +void ServerChannel::handleUnpackStateInit(int resource) +{ + if (unpackState_[resource] == NULL) + { + unpackState_[resource] = new T_unpack_state(); + + if (unpackState_[resource] == NULL) + { + #ifdef PANIC + *logofs << "handleUnpackStateInit: PANIC! Can't allocate " + << "memory for unpack state in context [A].\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "unpack state in context [A].\n"; + + HandleAbort(); + } + + unpackState_[resource] -> geometry = NULL; + unpackState_[resource] -> colormap = NULL; + unpackState_[resource] -> alpha = NULL; + } +} + +void ServerChannel::handleUnpackAllocGeometry(int resource) +{ + if (unpackState_[resource] -> geometry == NULL) + { + unpackState_[resource] -> geometry = new T_geometry(); + + if (unpackState_[resource] -> geometry == NULL) + { + #ifdef PANIC + *logofs << "handleUnpackAllocGeometry: PANIC! Can't allocate " + << "memory for unpack state in context [B].\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "unpack state in context [B].\n"; + + HandleAbort(); + } + + unpackState_[resource] -> geometry -> depth1_bpp = 4; + unpackState_[resource] -> geometry -> depth4_bpp = 4; + unpackState_[resource] -> geometry -> depth8_bpp = 8; + unpackState_[resource] -> geometry -> depth16_bpp = 16; + unpackState_[resource] -> geometry -> depth24_bpp = 32; + unpackState_[resource] -> geometry -> depth32_bpp = 32; + + unpackState_[resource] -> geometry -> red_mask = 0xff0000; + unpackState_[resource] -> geometry -> green_mask = 0x00ff00; + unpackState_[resource] -> geometry -> blue_mask = 0x0000ff; + + unpackState_[resource] -> geometry -> image_byte_order = imageByteOrder_; + unpackState_[resource] -> geometry -> bitmap_bit_order = bitmapBitOrder_; + unpackState_[resource] -> geometry -> scanline_unit = scanlineUnit_; + unpackState_[resource] -> geometry -> scanline_pad = scanlinePad_; + } +} + +void ServerChannel::handleUnpackAllocColormap(int resource) +{ + if (unpackState_[resource] -> colormap == NULL) + { + unpackState_[resource] -> colormap = new T_colormap(); + + if (unpackState_[resource] -> colormap == NULL) + { + #ifdef PANIC + *logofs << "handleUnpackAllocColormap: PANIC! Can't allocate " + << "memory for unpack state in context [C].\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "unpack state in context [C].\n"; + + HandleAbort(); + } + + unpackState_[resource] -> colormap -> entries = 0; + unpackState_[resource] -> colormap -> data = NULL; + } +} + +void ServerChannel::handleUnpackAllocAlpha(int resource) +{ + if (unpackState_[resource] -> alpha == NULL) + { + unpackState_[resource] -> alpha = new T_alpha(); + + if (unpackState_[resource] -> alpha == NULL) + { + #ifdef PANIC + *logofs << "handleUnpackAllocAlpha: PANIC! Can't allocate " + << "memory for unpack state in context [D].\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "unpack state in context [D].\n"; + + HandleAbort(); + } + + unpackState_[resource] -> alpha -> entries = 0; + unpackState_[resource] -> alpha -> data = NULL; + } +} + +void ServerChannel::handleUnpackStateRemove(int resource) +{ + if (unpackState_[resource] != NULL) + { + delete unpackState_[resource] -> geometry; + + if (unpackState_[resource] -> colormap != NULL) + { + delete [] unpackState_[resource] -> colormap -> data; + } + + delete unpackState_[resource] -> colormap; + + if (unpackState_[resource] -> alpha != NULL) + { + delete [] unpackState_[resource] -> alpha -> data; + } + + delete unpackState_[resource] -> alpha; + + delete unpackState_[resource]; + + unpackState_[resource] = NULL; + } +} + +void ServerChannel::handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuffer &encodeBuffer) +{ + unsigned int value = GetUINT(nextSrc, bigEndian_) | + (GetUINT(nextSrc + 10, bigEndian_) << 16); + + encodeBuffer.encodeCachedValue(value, 32, + *serverCache_ -> queryFontCharInfoCache[0], 6); + + nextSrc += 2; + + for (unsigned int i = 1; i < 5; i++) + { + unsigned int value = GetUINT(nextSrc, bigEndian_); + + nextSrc += 2; + + encodeBuffer.encodeCachedValue(value, 16, + *serverCache_ -> queryFontCharInfoCache[i], 6); + } +} + +int ServerChannel::setBigEndian(int flag) +{ + bigEndian_ = flag; + + readBuffer_.setBigEndian(flag); + + return 1; +} + +int ServerChannel::setReferences() +{ + #ifdef TEST + *logofs << "ServerChannel: Initializing the static " + << "members for the server channels.\n" + << logofs_flush; + #endif + + #ifdef REFERENCES + + references_ = 0; + + #endif + + return 1; +} diff --git a/nxcomp/src/ServerChannel.h b/nxcomp/src/ServerChannel.h new file mode 100644 index 000000000..374e52896 --- /dev/null +++ b/nxcomp/src/ServerChannel.h @@ -0,0 +1,529 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ServerChannel_H +#define ServerChannel_H + +#include "List.h" +#include "Channel.h" + +#include "SequenceQueue.h" + +#include "ServerReadBuffer.h" + +#include "Unpack.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// How many sequence numbers of split commit +// requests we are going to save in order to +// mask errors. +// + +#define MAX_COMMIT_SEQUENCE_QUEUE 16 + +// +// Define this to know when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// This class implements the X server +// side compression of X protocol. +// + +class ServerChannel : public Channel +{ + public: + + ServerChannel(Transport *transport, StaticCompressor *compressor); + + virtual ~ServerChannel(); + + virtual int handleRead(EncodeBuffer &encodeBuffer, const unsigned char *message, + unsigned int length); + + virtual int handleWrite(const unsigned char *message, unsigned int length); + + virtual int handleSplit(EncodeBuffer &encodeBuffer, MessageStore *store, + T_store_action action, int position, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size) + { + return 0; + } + + virtual int handleSplit(DecodeBuffer &decodeBuffer, MessageStore *store, + T_store_action action, int position, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + virtual int handleSplit(EncodeBuffer &encodeBuffer) + { + return 0; + } + + virtual int handleSplit(DecodeBuffer &decodeBuffer); + + virtual int handleSplitEvent(EncodeBuffer &encodeBuffer, Split *split); + + virtual int handleSplitEvent(DecodeBuffer &decodeBuffer) + { + return 0; + } + + // + // Send the last motion notify event + // received from the X server to the + // remote proxy. + // + + virtual int handleMotion(EncodeBuffer &encodeBuffer); + + virtual int handleCompletion(EncodeBuffer &encodeBuffer) + { + return 0; + } + + virtual int handleConfiguration(); + + virtual int handleFinish(); + + virtual int handleAsyncEvents(); + + virtual int needSplit() const + { + return 0; + } + + virtual int needMotion() const + { + return (lastMotion_[0] != '\0'); + } + + virtual T_channel_type getType() const + { + return channel_x11; + } + + int setBigEndian(int flag); + + // + // Initialize the static members. + // + + static int setReferences(); + + private: + + int handleFastReadReply(EncodeBuffer &encodeBuffer, const unsigned char &opcode, + const unsigned char *&buffer, const unsigned int &size); + + int handleFastReadEvent(EncodeBuffer &encodeBuffer, const unsigned char &opcode, + const unsigned char *&buffer, const unsigned int &size); + + int handleFastWriteRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Handle the fake authorization cookie + // and the X server's reply. + // + + int handleAuthorization(unsigned char *buffer); + int handleAuthorization(const unsigned char *buffer, int size); + + // + // Set the unpack colormap and the alpha + // blending data to be used to unpack + // images. + // + + int handleGeometry(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + int handleColormap(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + int handleAlpha(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + // + // Manage the decoded buffer to unpack + // the image and move the data to the + // shared memory segment. + // + + int handleImage(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + // + // Uncompress a packed image in one + // or more graphic X requests. + // + + int handleUnpack(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + // + // Move the image to the shared + // memory buffer. + // + + int handleShmem(unsigned char &opcode, unsigned char *&buffer, + unsigned int &size); + + // + // Handle suppression of error on + // commit of image splits. + // + + void initCommitQueue(); + + void updateCommitQueue(unsigned short sequence); + + int checkCommitError(unsigned char error, unsigned short sequence, + const unsigned char *buffer); + + void clearCommitQueue() + { + if (commitSequenceQueue_[0] != 0) + { + initCommitQueue(); + } + } + + // + // Check if the user pressed the + // CTRL+ALT+SHIFT+ESC keystroke. + // + + int checkKeyboardEvent(unsigned char event, unsigned short sequence, + const unsigned char *buffer); + + // + // Other utilities. + // + + void handleEncodeCharInfo(const unsigned char *nextSrc, EncodeBuffer &encodeBuffer); + + // + // Handle the MIT-SHM initialization + // messages exchanged with the remote + // proxy. + // + + int handleShmemRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + + int handleShmemReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned int stage, const unsigned char *buffer, + const unsigned int size); + + // + // Try to read more events in the attempt to + // get the MIT-SHM image completion event + // from the X server. + // + + int handleShmemEvent(); + + // + // Handle the MIT-SHM events as they are read + // from the socket. + // + + int checkShmemEvent(unsigned char event, unsigned short sequence, + const unsigned char *buffer); + + int checkShmemError(unsigned char error, unsigned short sequence, + const unsigned char *buffer); + + // + // Query the port used to tunnel + // the font server connections. + // + + int handleFontRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + int handleFontReply(EncodeBuffer &encodeBuffer, const unsigned char opcode, + const unsigned char *buffer, const unsigned int size); + + // + // Set the cache policy for image + // requests. + // + + int handleCacheRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Decode the start and end split + // requests. + // + + int handleStartSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + int handleEndSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Remove the split store and the + // incomplete messages from the + // memory cache. + // + + int handleAbortSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + // + // Send the split requests to the + // X server once they have been + // recomposed. + // + + int handleCommitSplitRequest(DecodeBuffer &decodeBuffer, unsigned char &opcode, + unsigned char *&buffer, unsigned int &size); + + int handleSplitChecksum(DecodeBuffer &decodeBuffer, T_checksum &checksum); + + // + // Allocate and free the shared memory + // support resources. + // + + void handleShmemStateAlloc(); + void handleShmemStateRemove(); + + // + // Temporary storage for the image info. + // + + void handleImageStateAlloc(unsigned char opcode) + { + if (imageState_ == NULL) + { + imageState_ = new T_image_state(); + } + + imageState_ -> opcode = opcode; + } + + void handleImageStateRemove() + { + if (imageState_ != NULL) + { + delete imageState_; + + imageState_ = NULL; + } + } + + // + // Store the information needed to unpack + // images per each known agent's client. + // + + void handleUnpackStateInit(int resource); + + void handleUnpackAllocGeometry(int resource); + void handleUnpackAllocColormap(int resource); + void handleUnpackAllocAlpha(int resource); + + void handleUnpackStateRemove(int resource); + + typedef struct + { + T_geometry *geometry; + T_colormap *colormap; + T_alpha *alpha; + + } T_unpack_state; + + T_unpack_state *unpackState_[256]; + + // + // Own read buffer. It is able to identify + // full messages read from X descriptor. + // + + ServerReadBuffer readBuffer_; + + // + // Sequence number of last request coming + // from X client or X server. + // + + unsigned int clientSequence_; + unsigned int serverSequence_; + + // + // Used to identify replies based on sequence + // number of original request. + // + + SequenceQueue sequenceQueue_; + + // + // Last motion notify read from the X server. + // + + unsigned char lastMotion_[32]; + + // + // Sequence numbers of last auto-generated + // put image requests. Needed to intercept + // and suppress errors generated by such + // requests. + // + + unsigned int commitSequenceQueue_[MAX_COMMIT_SEQUENCE_QUEUE]; + + // + // Let agent select which expose + // events is going to receive. + // + + unsigned int enableExpose_; + unsigned int enableGraphicsExpose_; + unsigned int enableNoExpose_; + + // + // Used in initialization and handling + // of MIT-SHM shared memory put images. + // + + typedef struct + { + int stage; + int present; + int enabled; + int segment; + int id; + void *address; + unsigned int size; + + unsigned char opcode; + unsigned char event; + unsigned char error; + + unsigned int sequence; + unsigned int offset; + T_timestamp last; + + unsigned int checked; + + } T_shmem_state; + + T_shmem_state *shmemState_; + + // + // Used to pass current image data between + // the different decompression stages. + // + + typedef struct + { + unsigned char opcode; + + unsigned int drawable; + unsigned int gcontext; + + unsigned char method; + + unsigned char format; + unsigned char srcDepth; + unsigned char dstDepth; + + unsigned int srcLength; + unsigned int dstLength; + unsigned int dstLines; + + short int srcX; + short int srcY; + unsigned short srcWidth; + unsigned short srcHeight; + + short int dstX; + short int dstY; + unsigned short dstWidth; + unsigned short dstHeight; + + unsigned char leftPad; + + } T_image_state; + + T_image_state *imageState_; + + // + // The flags is set according to the + // split load and save policy set by + // the encoding side. + // + + typedef struct + { + int resource; + int current; + int load; + int save; + int commit; + + } T_split_state; + + T_split_state splitState_; + + // + // List of agent resources. + // + + List splitResources_; + + // + // Keep track of object creation and + // deletion. + // + + private: + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +#endif /* ServerChannel_H */ diff --git a/nxcomp/src/ServerProxy.cpp b/nxcomp/src/ServerProxy.cpp new file mode 100644 index 000000000..28f94842a --- /dev/null +++ b/nxcomp/src/ServerProxy.cpp @@ -0,0 +1,621 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "NXalert.h" + +#include "Socket.h" + +#include "ServerProxy.h" + +#include "ServerChannel.h" +#include "GenericChannel.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Log the operations related to sending +// and receiving the control tokens. +// + +#undef TOKEN + +ServerProxy::ServerProxy(int proxyFd) : Proxy(proxyFd) + +{ + xServerAddrFamily_ = -1; + xServerAddrLength_ = 0; + + xServerAddr_ = NULL; + xServerDisplay_ = NULL; + + cupsServerPort_ = NULL; + smbServerPort_ = NULL; + mediaServerPort_ = NULL; + httpServerPort_ = NULL; + + fontServerPort_ = NULL; + + #ifdef DEBUG + *logofs << "ServerProxy: Created new object at " << this + << ".\n" << logofs_flush; + #endif +} + +ServerProxy::~ServerProxy() +{ + delete xServerAddr_; + + delete [] xServerDisplay_; + + delete [] fontServerPort_; + + #ifdef DEBUG + *logofs << "ServerProxy: Deleted object at " << this + << ".\n" << logofs_flush; + #endif +} + +void ServerProxy::handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, + sockaddr *xServerAddr, unsigned int xServerAddrLength) +{ + delete xServerAddr_; + + xServerAddr_ = xServerAddr; + + xServerAddrFamily_ = xServerAddrFamily; + xServerAddrLength_ = xServerAddrLength; + + delete [] xServerDisplay_; + + xServerDisplay_ = new char[strlen(xServerDisplay) + 1]; + + strcpy(xServerDisplay_, xServerDisplay); + + #ifdef DEBUG + *logofs << "ServerProxy: Set display configuration to display '" + << xServerDisplay_ << "'.\n" + << logofs_flush; + #endif +} + +void ServerProxy::handlePortConfiguration(ChannelEndPoint &cupsServerPort, + ChannelEndPoint &smbServerPort, + ChannelEndPoint &mediaServerPort, + ChannelEndPoint &httpServerPort, + const char *fontServerPort) +{ + cupsServerPort_ = cupsServerPort; + smbServerPort_ = smbServerPort; + mediaServerPort_ = mediaServerPort; + httpServerPort_ = httpServerPort; + + delete [] fontServerPort_; + + fontServerPort_ = new char[strlen(fontServerPort) + 1]; + + strcpy(fontServerPort_, fontServerPort); + + #ifdef DEBUG + *logofs << "ServerProxy: Set port configuration to CUPS " + << cupsServerPort_ << ", SMB " << smbServerPort_ + << ", media " << mediaServerPort_ << ", HTTP " + << httpServerPort_ << ".\n" + << logofs_flush; + #endif +} + +int ServerProxy::handleNewConnection(T_channel_type type, int clientFd) +{ + switch (type) + { + case channel_font: + { + return handleNewGenericConnection(clientFd, channel_font, "font"); + } + case channel_slave: + { + return handleNewSlaveConnection(clientFd); + } + default: + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Unsupported channel with type '" + << getTypeName(type) << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unsupported channel with type '" + << getTypeName(type) << "'.\n"; + + return -1; + } + } +} + +int ServerProxy::handleNewConnectionFromProxy(T_channel_type type, int channelId) +{ + switch (type) + { + case channel_x11: + { + return handleNewXConnectionFromProxy(channelId); + } + case channel_cups: + { + return handleNewGenericConnectionFromProxy(channelId, channel_cups, + cupsServerPort_, "CUPS"); + } + case channel_smb: + { + smbServerPort_.setDefaultTCPInterface(1); + return handleNewGenericConnectionFromProxy(channelId, channel_smb, + smbServerPort_, "SMB"); + } + case channel_media: + { + return handleNewGenericConnectionFromProxy(channelId, channel_media, + mediaServerPort_, "media"); + } + case channel_http: + { + return handleNewGenericConnectionFromProxy(channelId, channel_http, + httpServerPort_, "HTTP"); + } + case channel_slave: + { + return handleNewSlaveConnectionFromProxy(channelId); + } + default: + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Unsupported channel with type '" + << getTypeName(type) << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Unsupported channel with type '" + << getTypeName(type) << "'.\n"; + + return -1; + } + } +} + +int ServerProxy::handleNewAgentConnection(Agent *agent) +{ + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Can't create an agent " + << "connection at this side.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create an agent " + << "connection at this side.\n"; + + return -1; +} + +int ServerProxy::handleNewXConnection(int clientFd) +{ + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Can't create a new X channel " + << "with FD#" << clientFd << " at this side.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't create a new X channel " + << "with FD#" << clientFd << " at this side.\n"; + + return -1; +} + +int ServerProxy::handleNewXConnectionFromProxy(int channelId) +{ + // + // Connect to the real X server. + // + + int retryConnect = control -> OptionServerRetryConnect; + + int xServerFd; + + for (;;) + { + xServerFd = socket(xServerAddrFamily_, SOCK_STREAM, PF_UNSPEC); + + if (xServerFd < 0) + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Call to socket failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + return -1; + } + + #ifdef TEST + *logofs << "ServerProxy: Trying to connect to X server '" + << xServerDisplay_ << "'.\n" << logofs_flush; + #endif + + int result = connect(xServerFd, xServerAddr_, xServerAddrLength_); + + getNewTimestamp(); + + if (result < 0) + { + #ifdef WARNING + *logofs << "ServerProxy: WARNING! Connection to '" + << xServerDisplay_ << "' failed with error '" + << ESTR() << "'. Retrying.\n" << logofs_flush; + #endif + + close(xServerFd); + + if (--retryConnect == 0) + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Connection to '" + << xServerDisplay_ << "' for channel ID#" + << channelId << " failed. Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Connection to '" + << xServerDisplay_ << "' failed. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + close(xServerFd); + + return -1; + } + + if (activeChannels_.getSize() == 0) + { + sleep(2); + } + else + { + sleep(1); + } + } + else + { + break; + } + } + + assignChannelMap(channelId, xServerFd); + + #ifdef TEST + *logofs << "ServerProxy: X server descriptor FD#" << xServerFd + << " mapped to channel ID#" << channelId << ".\n" + << logofs_flush; + #endif + + // + // Turn queuing off for path proxy-to-X-server. + // + + if (control -> OptionServerNoDelay == 1) + { + SetNoDelay(xServerFd, control -> OptionServerNoDelay); + } + + // + // If requested, set the size of the TCP send + // and receive buffers. + // + + if (control -> OptionServerSendBuffer != -1) + { + SetSendBuffer(xServerFd, control -> OptionServerSendBuffer); + } + + if (control -> OptionServerReceiveBuffer != -1) + { + SetReceiveBuffer(xServerFd, control -> OptionServerReceiveBuffer); + } + + if (allocateTransport(xServerFd, channelId) < 0) + { + return -1; + } + + // + // Starting from protocol level 3 client and server + // caches are created in proxy and shared between all + // channels. If remote proxy has older protocol level + // pointers are NULL and channels must create their + // own instances. + // + + channels_[channelId] = new ServerChannel(transports_[channelId], compressor_); + + if (channels_[channelId] == NULL) + { + deallocateTransport(channelId); + + return -1; + } + + increaseChannels(channelId); + + // + // Propagate channel stores and caches to the new + // channel. + // + + channels_[channelId] -> setOpcodes(opcodeStore_); + + channels_[channelId] -> setStores(clientStore_, serverStore_); + + channels_[channelId] -> setCaches(clientCache_, serverCache_); + + int port = atoi(fontServerPort_); + + if (port > 0) + { + channels_[channelId] -> setPorts(port); + } + + // + // Let channel configure itself according + // to control parameters. + // + + channels_[channelId] -> handleConfiguration(); + + // + // Check if we have successfully loaded the + // selected cache and, if not, remove it + // from disk. + // + + handleCheckLoad(); + + return 1; +} + +// +// Check if we still need to drop a channel. We need +// to check this explicitly at the time we receive a +// request to load or save the cache because we could +// receive the control message before having entered +// the function handling the channel events. +// + +int ServerProxy::handleCheckDrop() +{ + T_list channelList = activeChannels_.copyList(); + + for (T_list::iterator j = channelList.begin(); + j != channelList.end(); j++) + { + int channelId = *j; + + if (channels_[channelId] != NULL && + (channels_[channelId] -> getDrop() == 1 || + channels_[channelId] -> getClosing() == 1)) + { + #ifdef TEST + *logofs << "ServerProxy: Dropping the descriptor FD#" + << getFd(channelId) << " channel ID#" + << channelId << ".\n" << logofs_flush; + #endif + + handleDrop(channelId); + } + } + + return 1; +} + +int ServerProxy::handleCheckLoad() +{ + // + // Check if we just created the first X channel + // but the client side didn't tell us to load + // the cache selected at the session negotiation. + // This is very likely because the load operation + // failed at the remote side, for example because + // the cache was invalid or corrupted. + // + + int channelCount = getChannels(channel_x11); + + if (channelCount != 1) + { + return 0; + } + + if (control -> PersistentCacheEnableLoad == 1 && + control -> PersistentCachePath != NULL && + control -> PersistentCacheName != NULL && + isTimestamp(timeouts_.loadTs) == 0) + { + #ifdef WARNING + *logofs << "ServerProxy: WARNING! Cache file '" << control -> PersistentCachePath + << "/" << control -> PersistentCacheName << "' not loaded.\n" + << logofs_flush; + #endif + + // + // Remove the cache file. + // + + #ifdef WARNING + *logofs << "ServerProxy: WARNING! Removing supposedly " + << "incompatible cache '" << control -> PersistentCachePath + << "/" << control -> PersistentCacheName + << "'.\n" << logofs_flush; + #endif + + handleResetPersistentCache(); + } + + return 1; +} + +int ServerProxy::handleLoadFromProxy() +{ + // + // Be sure we drop any confirmed channel. + // + + handleCheckDrop(); + + // + // Check that either no X channel is + // remaining or we are inside a reset. + // + + int channelCount = getChannels(channel_x11); + + if (channelCount > 0) + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Protocol violation " + << "in command load with " << channelCount + << " channels.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Protocol violation " + << "in command load from proxy.\n"; + + return -1; + } + else if (handleLoadStores() < 0) + { + #ifdef WARNING + *logofs << "ServerProxy: WARNING! Failed to load content " + << "of persistent cache.\n" << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int ServerProxy::handleSaveFromProxy() +{ + // + // Be sure we drop any confirmed channel. + // + + handleCheckDrop(); + + // + // Now verify that all channels are gone. + // + + int channelCount = getChannels(channel_x11); + + if (channelCount > 0) + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Protocol violation " + << "in command save with " << channelCount + << " channels.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Protocol violation " + << "in command save from proxy.\n"; + + return -1; + } + else if (handleSaveStores() < 0) + { + #ifdef PANIC + *logofs << "ServerProxy: PANIC! Failed to save stores " + << "to persistent cache.\n" << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int ServerProxy::handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient) const +{ + if (clientStore_ -> saveRequestStores(cachefs, md5StateStream, md5StateClient, + discard_checksum, use_data) < 0) + { + return -1; + } + else if (serverStore_ -> saveReplyStores(cachefs, md5StateStream, md5StateClient, + use_checksum, discard_data) < 0) + { + return -1; + } + else if (serverStore_ -> saveEventStores(cachefs, md5StateStream, md5StateClient, + use_checksum, discard_data) < 0) + { + return -1; + } + + return 1; +} + +int ServerProxy::handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const +{ + if (clientStore_ -> loadRequestStores(cachefs, md5StateStream, + discard_checksum, use_data) < 0) + { + return -1; + } + else if (serverStore_ -> loadReplyStores(cachefs, md5StateStream, + use_checksum, discard_data) < 0) + { + return -1; + } + else if (serverStore_ -> loadEventStores(cachefs, md5StateStream, + use_checksum, discard_data) < 0) + { + return -1; + } + + return 1; +} diff --git a/nxcomp/src/ServerProxy.h b/nxcomp/src/ServerProxy.h new file mode 100644 index 000000000..e169c4aec --- /dev/null +++ b/nxcomp/src/ServerProxy.h @@ -0,0 +1,154 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ServerProxy_H +#define ServerProxy_H + +#include +#include + +#include "Proxy.h" + +#include "Misc.h" +#include "ChannelEndPoint.h" + +// +// Set the verbosity level. +// + +#undef TEST +#undef DEBUG + +class ServerProxy : public Proxy +{ + public: + + ServerProxy(int proxyFd); + + virtual ~ServerProxy(); + + virtual void handleDisplayConfiguration(const char *xServerDisplay, int xServerAddrFamily, + sockaddr *xServerAddr, unsigned int xServerAddrLength); + + virtual void handlePortConfiguration(ChannelEndPoint &cupsServerPort, + ChannelEndPoint &smbServerPort, + ChannelEndPoint &mediaServerPort, + ChannelEndPoint &httpServerPort, + const char *fontServerPort); + + protected: + + // + // Create a new channel. + // + + virtual int handleNewConnection(T_channel_type type, int clientFd); + + virtual int handleNewConnectionFromProxy(T_channel_type type, int channelId); + + virtual int handleNewAgentConnection(Agent *agent); + + virtual int handleNewXConnection(int clientFd); + + virtual int handleNewXConnectionFromProxy(int channelId); + + // + // Implement persistence according + // to our proxy mode. + // + + virtual int handleLoad(T_load_type type) + { + return 0; + } + + virtual int handleSave() + { + return 0; + } + + virtual int handleAsyncEvents() + { + return 0; + } + + virtual int handleLoadFromProxy(); + virtual int handleSaveFromProxy(); + + virtual int handleSaveAllStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient) const; + + virtual int handleLoadAllStores(istream *cachefs, md5_state_t *md5StateStream) const; + + int handleCheckDrop(); + int handleCheckLoad(); + + // + // Utility function used to realize + // a new connection. + // + + protected: + + virtual int checkLocalChannelMap(int channelId) + { + // Since ProtoStep7 (#issue 108) + return ((channelId & control -> ChannelMask) == 0); + } + + private: + + // FIXME: Use a ChannelEndPoint object also for the X server! + int xServerAddrFamily_; + sockaddr *xServerAddr_; + unsigned int xServerAddrLength_; + + // + // This is the name of the X display where + // we are going to forward connections. + // + + char *xServerDisplay_; + + // + // Ports where to forward extended services' + // TCP connections. + // + + ChannelEndPoint cupsServerPort_; + ChannelEndPoint smbServerPort_; + ChannelEndPoint mediaServerPort_; + ChannelEndPoint httpServerPort_; + + // + // It will have to be passed to the channel + // so that it can set the port where the + // font server connections are tunneled. + // + + char *fontServerPort_; +}; + +#endif /* ServerProxy_H */ diff --git a/nxcomp/src/ServerReadBuffer.cpp b/nxcomp/src/ServerReadBuffer.cpp new file mode 100644 index 000000000..277b85216 --- /dev/null +++ b/nxcomp/src/ServerReadBuffer.cpp @@ -0,0 +1,247 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ServerReadBuffer.h" +#include "ServerChannel.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +unsigned int ServerReadBuffer::suggestedLength(unsigned int pendingLength) +{ + // + // Always read all the data that + // is available. + // + + int readable = transport_ -> readable(); + + unsigned int readLength = (readable == -1 ? 0 : (unsigned int) readable); + + if (readLength < pendingLength) + { + readLength = pendingLength; + } + + // + // Even if the readable data is not + // enough to make a complete message, + // resize the buffer to accommodate + // it all. + // + + if (pendingLength < remaining_) + { + readLength = remaining_; + } + + return readLength; +} + +int ServerReadBuffer::locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength) +{ + unsigned int size = end - start; + + #ifdef TEST + *logofs << "ServerReadBuffer: Locating message for FD#" + << transport_ -> fd() << " with " << size + << " bytes.\n" << logofs_flush; + #endif + + if (firstMessage_) + { + if (size < 8) + { + remaining_ = 8 - size; + + #ifdef TEST + *logofs << "ServerReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + dataLength = 8 + (GetUINT(start + 6, bigEndian_) << 2); + } + else + { + if (size < 32) + { + remaining_ = 32 - size; + + #ifdef TEST + *logofs << "ServerReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + if (*start == 1) + { + dataLength = 32 + (GetULONG(start + 4, bigEndian_) << 2); + } + else + { + dataLength = 32; + } + + if (dataLength < 32) + { + #ifdef TEST + *logofs << "ServerReadBuffer: WARNING! Assuming length 32 " + << "for suspicious message of length " << dataLength + << ".\n" << logofs_flush; + #endif + + dataLength = 32; + } + } + + #ifdef TEST + *logofs << "ServerReadBuffer: Length of the next message is " + << dataLength << ".\n" << logofs_flush; + #endif + + if (size < dataLength) + { + remaining_ = dataLength - size; + + #ifdef TEST + *logofs << "ServerReadBuffer: No message was located " + << "with remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + firstMessage_ = 0; + + controlLength = 0; + trailerLength = 0; + + remaining_ = 0; + + #ifdef TEST + *logofs << "ServerReadBuffer: Located message with " + << "remaining " << remaining_ << ".\n" + << logofs_flush; + #endif + + return 1; +} + +// +// Check if the data already read contains a +// message matching the opcode and sequence, +// starting at the given offset. +// + +unsigned char *ServerReadBuffer::peekMessage(unsigned int &offset, unsigned char opcode, + unsigned short sequence) +{ + #ifdef TEST + *logofs << "ServerReadBuffer: Peeking message " + << "for FD#" << transport_ -> fd() << " with size " + << length_ << " offset " << offset << " opcode " + << (unsigned int) opcode << " and sequence " + << sequence << ".\n" << logofs_flush; + #endif + + if (firstMessage_) + { + return NULL; + } + + unsigned char *next = buffer_ + start_ + offset; + unsigned char *end = buffer_ + start_ + length_; + + int found = 0; + + while (end - next >= 32) + { + #ifdef DEBUG + *logofs << "ServerReadBuffer: Checking opcode " + << (unsigned int) *next << " sequence " + << GetUINT(next + 2, bigEndian_) + << " at " << next - buffer_ + start_ + << ".\n" << logofs_flush; + #endif + + if (*next == opcode && GetUINT(next + 2, bigEndian_) == sequence) + { + found = 1; + + break; + } + else if (*next == 1) + { + next += (32 + (GetULONG(next + 4, bigEndian_) << 2)); + } + else + { + next += 32; + } + } + + offset = next - buffer_ + start_; + + if (found == 1) + { + #ifdef TEST + *logofs << "ServerReadBuffer: Found message at " + << "offset " << next - buffer_ + start_ + << ".\n" << logofs_flush; + #endif + + return next; + } + + #ifdef TEST + *logofs << "ServerReadBuffer: Quitting loop at " + << "offset " << next - buffer_ + start_ + << ".\n" << logofs_flush; + #endif + + return NULL; +} diff --git a/nxcomp/src/ServerReadBuffer.h b/nxcomp/src/ServerReadBuffer.h new file mode 100644 index 000000000..d6c207ead --- /dev/null +++ b/nxcomp/src/ServerReadBuffer.h @@ -0,0 +1,73 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ServerReadBuffer_H +#define ServerReadBuffer_H + +#include "ReadBuffer.h" +#include "Control.h" + +class ServerChannel; + +class ServerReadBuffer : public ReadBuffer +{ + public: + + ServerReadBuffer(Transport *transport, ServerChannel *channel) + + : ReadBuffer(transport), firstMessage_(1), channel_(channel) + { + } + + virtual ~ServerReadBuffer() + { + } + + void setBigEndian(int flag) + { + bigEndian_ = flag; + } + + unsigned char *peekMessage(unsigned int &offset, unsigned char opcode, + unsigned short sequence); + + protected: + + virtual unsigned int suggestedLength(unsigned int pendingLength); + + virtual int locateMessage(const unsigned char *start, + const unsigned char *end, + unsigned int &controlLength, + unsigned int &dataLength, + unsigned int &trailerLength); + + int bigEndian_; + + int firstMessage_; + + ServerChannel *channel_; +}; + +#endif /* ServerReadBuffer_H */ diff --git a/nxcomp/src/ServerStore.cpp b/nxcomp/src/ServerStore.cpp new file mode 100644 index 000000000..8123b6de0 --- /dev/null +++ b/nxcomp/src/ServerStore.cpp @@ -0,0 +1,183 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ServerStore.h" + +// +// Cached reply classes. +// + +#include "GetImageReply.h" +#include "ListFontsReply.h" +#include "QueryFontReply.h" +#include "GetPropertyReply.h" +#include "GenericReply.h" + +// +// Set the verbosity level. +// + +#define WARNING +#define PANIC +#undef TEST + +ServerStore::ServerStore(StaticCompressor *compressor) +{ + if (logofs == NULL) + { + logofs = &cout; + } + + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + replies_[i] = NULL; + events_[i] = NULL; + } + + replies_[X_ListFonts] = new ListFontsReplyStore(compressor); + replies_[X_QueryFont] = new QueryFontReplyStore(compressor); + replies_[X_GetImage] = new GetImageReplyStore(compressor); + replies_[X_GetProperty] = new GetPropertyReplyStore(compressor); + + replies_[X_NXInternalGenericReply] = new GenericReplyStore(compressor); +} + +ServerStore::~ServerStore() +{ + if (logofs == NULL) + { + logofs = &cout; + } + + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + delete replies_[i]; + delete events_[i]; + } +} + +int ServerStore::saveReplyStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction) const +{ + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (replies_[i] != NULL && + replies_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, + checksumAction, dataAction, + storeBigEndian()) < 0) + { + #ifdef PANIC + *logofs << "ServerStore: PANIC! Error saving reply store " + << "for OPCODE#" << (unsigned int) i << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error saving reply store " + << "for opcode '" << (unsigned int) i << "'.\n"; + + return -1; + } + } + + return 1; +} + +int ServerStore::saveEventStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction) const +{ + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (events_[i] != NULL && + events_[i] -> saveStore(cachefs, md5StateStream, md5StateClient, + checksumAction, dataAction, + storeBigEndian()) < 0) + { + #ifdef PANIC + *logofs << "ServerStore: PANIC! Error saving event store " + << "for OPCODE#" << (unsigned int) i << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Error saving event store " + << "for opcode '" << (unsigned int) i << "'.\n"; + + return -1; + } + } + + return 1; +} + +int ServerStore::loadReplyStores(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction) const +{ + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (replies_[i] != NULL && + replies_[i] -> loadStore(cachefs, md5StateStream, + checksumAction, dataAction, + storeBigEndian()) < 0) + { + #ifdef PANIC + *logofs << "ServerStore: PANIC! Error loading reply store " + << "for OPCODE#" << (unsigned int) i << ".\n" + << logofs_flush; + #endif + + return -1; + } + } + + return 1; +} + +int ServerStore::loadEventStores(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction) const +{ + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (events_[i] != NULL && + events_[i] -> loadStore(cachefs, md5StateStream, + checksumAction, dataAction, + storeBigEndian()) < 0) + { + #ifdef PANIC + *logofs << "ServerStore: PANIC! Error loading event store " + << "for OPCODE#" << (unsigned int) i << ".\n" + << logofs_flush; + #endif + + return -1; + } + } + + return 1; +} diff --git a/nxcomp/src/ServerStore.h b/nxcomp/src/ServerStore.h new file mode 100644 index 000000000..dbbb968e5 --- /dev/null +++ b/nxcomp/src/ServerStore.h @@ -0,0 +1,83 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ServerStore_H +#define ServerStore_H + +#include "Message.h" + +#include "ChannelStore.h" + +class StaticCompressor; + +class ServerStore : public ChannelStore +{ + public: + + ServerStore(StaticCompressor *compressor); + + virtual ~ServerStore(); + + MessageStore *getReplyStore(unsigned char opcode) const + { + return replies_[opcode]; + } + + MessageStore *getEventStore(unsigned char opcode) const + { + return events_[opcode]; + } + + // + // Actually save the message store + // to disk according to proxy mode. + // + + int saveReplyStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction) const; + + int saveEventStores(ostream *cachefs, md5_state_t *md5StateStream, + md5_state_t *md5StateClient, T_checksum_action checksumAction, + T_data_action dataAction) const; + + + int loadReplyStores(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction) const; + + int loadEventStores(istream *cachefs, md5_state_t *md5StateStream, + T_checksum_action checksumAction, T_data_action dataAction) const; + + private: + + // + // A server store contains replies and events. + // + + MessageStore *replies_[CHANNEL_STORE_OPCODE_LIMIT]; + MessageStore *events_[CHANNEL_STORE_OPCODE_LIMIT]; +}; + +#endif /* ServerStore_H */ diff --git a/nxcomp/src/SetClipRectangles.cpp b/nxcomp/src/SetClipRectangles.cpp new file mode 100644 index 000000000..b43cea938 --- /dev/null +++ b/nxcomp/src/SetClipRectangles.cpp @@ -0,0 +1,154 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SetClipRectangles.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int SetClipRectanglesStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; + + // + // Here is the fingerprint. + // + + setClipRectangles -> ordering = *(buffer + 1); + + setClipRectangles -> gcontext = GetULONG(buffer + 4, bigEndian); + + setClipRectangles -> x_origin = GetUINT(buffer + 8, bigEndian); + setClipRectangles -> y_origin = GetUINT(buffer + 10, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int SetClipRectanglesStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; + + // + // Fill all the message's fields. + // + + *(buffer + 1) = setClipRectangles -> ordering; + + PutULONG(setClipRectangles -> gcontext, buffer + 4, bigEndian); + + PutUINT(setClipRectangles -> x_origin, buffer + 8, bigEndian); + PutUINT(setClipRectangles -> y_origin, buffer + 10, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void SetClipRectanglesStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; + + *logofs << name() << ": Identity ordering " << (unsigned int) setClipRectangles -> ordering + << ", gcontext " << setClipRectangles -> gcontext << ", x_origin " + << setClipRectangles -> x_origin << ", y_origin " + << setClipRectangles -> y_origin << ", size " + << setClipRectangles -> size_ << ".\n" << logofs_flush; + #endif +} + +void SetClipRectanglesStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 1, 1); + md5_append(md5_state_, buffer + 8, 4); +} + +void SetClipRectanglesStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; + SetClipRectanglesMessage *cachedSetClipRectangles = (SetClipRectanglesMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " << setClipRectangles -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeXidValue(setClipRectangles -> gcontext, clientCache -> gcCache); + + cachedSetClipRectangles -> gcontext = setClipRectangles -> gcontext; +} + +void SetClipRectanglesStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + SetClipRectanglesMessage *setClipRectangles = (SetClipRectanglesMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + decodeBuffer.decodeXidValue(value, clientCache -> gcCache); + + setClipRectangles -> gcontext = value; + + #ifdef DEBUG + *logofs << name() << ": Decoded value " << setClipRectangles -> gcontext + << " as gcontext field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/SetClipRectangles.h b/nxcomp/src/SetClipRectangles.h new file mode 100644 index 000000000..a2245360c --- /dev/null +++ b/nxcomp/src/SetClipRectangles.h @@ -0,0 +1,187 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef SetClipRectangles_H +#define SetClipRectangles_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define SETCLIPRECTANGLES_ENABLE_CACHE 1 +#define SETCLIPRECTANGLES_ENABLE_DATA 0 +#define SETCLIPRECTANGLES_ENABLE_SPLIT 0 +#define SETCLIPRECTANGLES_ENABLE_COMPRESS 0 + +#define SETCLIPRECTANGLES_DATA_LIMIT 2048 +#define SETCLIPRECTANGLES_DATA_OFFSET 12 + +#define SETCLIPRECTANGLES_CACHE_SLOTS 3000 +#define SETCLIPRECTANGLES_CACHE_THRESHOLD 3 +#define SETCLIPRECTANGLES_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class SetClipRectanglesMessage : public Message +{ + friend class SetClipRectanglesStore; + + public: + + SetClipRectanglesMessage() + { + } + + ~SetClipRectanglesMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char ordering; + unsigned int gcontext; + unsigned short x_origin; + unsigned short y_origin; +}; + +class SetClipRectanglesStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + SetClipRectanglesStore() : MessageStore() + { + enableCache = SETCLIPRECTANGLES_ENABLE_CACHE; + enableData = SETCLIPRECTANGLES_ENABLE_DATA; + enableSplit = SETCLIPRECTANGLES_ENABLE_SPLIT; + enableCompress = SETCLIPRECTANGLES_ENABLE_COMPRESS; + + dataLimit = SETCLIPRECTANGLES_DATA_LIMIT; + dataOffset = SETCLIPRECTANGLES_DATA_OFFSET; + + cacheSlots = SETCLIPRECTANGLES_CACHE_SLOTS; + cacheThreshold = SETCLIPRECTANGLES_CACHE_THRESHOLD; + cacheLowerThreshold = SETCLIPRECTANGLES_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~SetClipRectanglesStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "SetClipRectangles"; + } + + virtual unsigned char opcode() const + { + return X_SetClipRectangles; + } + + virtual unsigned int storage() const + { + return sizeof(SetClipRectanglesMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new SetClipRectanglesMessage(); + } + + virtual Message *create(const Message &message) const + { + return new SetClipRectanglesMessage((const SetClipRectanglesMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (SetClipRectanglesMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* SetClipRectangles_H */ diff --git a/nxcomp/src/SetUnpackAlpha.cpp b/nxcomp/src/SetUnpackAlpha.cpp new file mode 100644 index 000000000..5a352d26a --- /dev/null +++ b/nxcomp/src/SetUnpackAlpha.cpp @@ -0,0 +1,266 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SetUnpackAlpha.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +SetUnpackAlphaStore::SetUnpackAlphaStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = SETUNPACKALPHA_ENABLE_CACHE; + enableData = SETUNPACKALPHA_ENABLE_DATA; + enableCompress = SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = SETUNPACKALPHA_DATA_LIMIT; + dataOffset = SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7; + + cacheSlots = SETUNPACKALPHA_CACHE_SLOTS; + cacheThreshold = SETUNPACKALPHA_CACHE_THRESHOLD; + cacheLowerThreshold = SETUNPACKALPHA_CACHE_LOWER_THRESHOLD; + + // Since ProtoStep8 (#issue 108) + enableSplit = SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +SetUnpackAlphaStore::~SetUnpackAlphaStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int SetUnpackAlphaStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + // + // Encode the source length first because + // we need it to determine the size of + // the output buffer. + // + + // SrcLength. + encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian), 32, 9); + + // Client. + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> resourceCache); + // Method. + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> methodCache); + // DstLength. + encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackAlphaStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + unsigned int value; + unsigned char cValue; + + // SrcLength. + decodeBuffer.decodeValue(value, 32, 9); + + size = RoundUp4(value) + 16; + + buffer = writeBuffer -> addMessage(size); + + PutULONG(value, buffer + 8, bigEndian); + + // Client. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> resourceCache); + + *(buffer + 1) = cValue; + + // Method. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> methodCache); + + *(buffer + 4) = cValue; + + // DstLength. + decodeBuffer.decodeValue(value, 32, 9); + + PutULONG(value, buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackAlphaStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; + + setUnpackAlpha -> client = *(buffer + 1); + setUnpackAlpha -> method = *(buffer + 4); + + setUnpackAlpha -> src_length = GetULONG(buffer + 8, bigEndian); + setUnpackAlpha -> dst_length = GetULONG(buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackAlphaStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; + + *(buffer + 1) = setUnpackAlpha -> client; + *(buffer + 4) = setUnpackAlpha -> method; + + PutULONG(setUnpackAlpha -> src_length, buffer + 8, bigEndian); + PutULONG(setUnpackAlpha -> dst_length, buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void SetUnpackAlphaStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; + + *logofs << name() << ": Identity client " + << (unsigned int) setUnpackAlpha -> client << " method " + << (unsigned int) setUnpackAlpha -> method << " source length " + << setUnpackAlpha -> src_length << " destination length " + << setUnpackAlpha -> dst_length << " size " + << setUnpackAlpha -> size_ << ".\n"; + + #endif +} + +void SetUnpackAlphaStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Include the pack method and the source + // and destination length. + // + + md5_append(md5_state_, buffer + 4, 1); + md5_append(md5_state_, buffer + 8, 8); +} + +void SetUnpackAlphaStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; + SetUnpackAlphaMessage *cachedSetUnpackAlpha = (SetUnpackAlphaMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(setUnpackAlpha -> client, 8, + clientCache -> resourceCache); + + cachedSetUnpackAlpha -> client = setUnpackAlpha -> client; +} + +void SetUnpackAlphaStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + SetUnpackAlphaMessage *setUnpackAlpha = (SetUnpackAlphaMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(setUnpackAlpha -> client, 8, + clientCache -> resourceCache); +} diff --git a/nxcomp/src/SetUnpackAlpha.h b/nxcomp/src/SetUnpackAlpha.h new file mode 100644 index 000000000..54714efaa --- /dev/null +++ b/nxcomp/src/SetUnpackAlpha.h @@ -0,0 +1,162 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef SetUnpackAlpha_H +#define SetUnpackAlpha_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define SETUNPACKALPHA_ENABLE_CACHE 1 +#define SETUNPACKALPHA_ENABLE_DATA 1 + +#define SETUNPACKALPHA_DATA_LIMIT 16384 + +#define SETUNPACKALPHA_CACHE_SLOTS 2000 +#define SETUNPACKALPHA_CACHE_THRESHOLD 10 +#define SETUNPACKALPHA_CACHE_LOWER_THRESHOLD 5 + +#define SETUNPACKALPHA_DATA_OFFSET_IF_PROTO_STEP_7 16 +#define SETUNPACKALPHA_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +#define SETUNPACKALPHA_ENABLE_SPLIT_IF_PROTO_STEP_8 0 + +// +// The message class. +// + +class SetUnpackAlphaMessage : public Message +{ + friend class SetUnpackAlphaStore; + + public: + + SetUnpackAlphaMessage() + { + } + + ~SetUnpackAlphaMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char client; + unsigned char method; + + unsigned int src_length; + unsigned int dst_length; +}; + +class SetUnpackAlphaStore : public MessageStore +{ + public: + + SetUnpackAlphaStore(StaticCompressor *compressor); + + virtual ~SetUnpackAlphaStore(); + + virtual const char *name() const + { + return "SetUnpackAlpha"; + } + + virtual unsigned char opcode() const + { + return X_NXSetUnpackAlpha; + } + + virtual unsigned int storage() const + { + return sizeof(SetUnpackAlphaMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new SetUnpackAlphaMessage(); + } + + virtual Message *create(const Message &message) const + { + return new SetUnpackAlphaMessage((const SetUnpackAlphaMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (SetUnpackAlphaMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* SetUnpackAlpha_H */ diff --git a/nxcomp/src/SetUnpackColormap.cpp b/nxcomp/src/SetUnpackColormap.cpp new file mode 100644 index 000000000..2c9bba1bd --- /dev/null +++ b/nxcomp/src/SetUnpackColormap.cpp @@ -0,0 +1,266 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SetUnpackColormap.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +SetUnpackColormapStore::SetUnpackColormapStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = SETUNPACKCOLORMAP_ENABLE_CACHE; + enableData = SETUNPACKCOLORMAP_ENABLE_DATA; + enableCompress = SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = SETUNPACKCOLORMAP_DATA_LIMIT; + dataOffset = SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7; + + cacheSlots = SETUNPACKCOLORMAP_CACHE_SLOTS; + cacheThreshold = SETUNPACKCOLORMAP_CACHE_THRESHOLD; + cacheLowerThreshold = SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD; + + // Since ProtoStep8 (#issue 108) + enableSplit = SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +SetUnpackColormapStore::~SetUnpackColormapStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int SetUnpackColormapStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + // + // Encode the source length first because + // we need it to determine the size of + // the output buffer. + // + + // SrcLength. + encodeBuffer.encodeValue(GetULONG(buffer + 8, bigEndian), 32, 9); + + // Client. + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> resourceCache); + // Method. + encodeBuffer.encodeCachedValue(*(buffer + 4), 8, + clientCache -> methodCache); + // DstLength. + encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32, 9); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackColormapStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + unsigned int value; + unsigned char cValue; + + // SrcLength. + decodeBuffer.decodeValue(value, 32, 9); + + size = RoundUp4(value) + 16; + + buffer = writeBuffer -> addMessage(size); + + PutULONG(value, buffer + 8, bigEndian); + + // Client. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> resourceCache); + + *(buffer + 1) = cValue; + + // Method. + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> methodCache); + + *(buffer + 4) = cValue; + + // DstLength. + decodeBuffer.decodeValue(value, 32, 9); + + PutULONG(value, buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackColormapStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; + + setUnpackColormap -> client = *(buffer + 1); + setUnpackColormap -> method = *(buffer + 4); + + setUnpackColormap -> src_length = GetULONG(buffer + 8, bigEndian); + setUnpackColormap -> dst_length = GetULONG(buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackColormapStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; + + *(buffer + 1) = setUnpackColormap -> client; + *(buffer + 4) = setUnpackColormap -> method; + + PutULONG(setUnpackColormap -> src_length, buffer + 8, bigEndian); + PutULONG(setUnpackColormap -> dst_length, buffer + 12, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void SetUnpackColormapStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; + + *logofs << name() << ": Identity client " + << (unsigned int) setUnpackColormap -> client << " method " + << (unsigned int) setUnpackColormap -> method << " source length " + << setUnpackColormap -> src_length << " destination length " + << setUnpackColormap -> dst_length << " size " + << setUnpackColormap -> size_ << ".\n"; + + #endif +} + +void SetUnpackColormapStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Include the pack method and the source + // and destination length. + // + + md5_append(md5_state_, buffer + 4, 1); + md5_append(md5_state_, buffer + 8, 8); +} + +void SetUnpackColormapStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; + SetUnpackColormapMessage *cachedSetUnpackColormap = (SetUnpackColormapMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + encodeBuffer.encodeCachedValue(setUnpackColormap -> client, 8, + clientCache -> resourceCache); + + cachedSetUnpackColormap -> client = setUnpackColormap -> client; +} + +void SetUnpackColormapStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + SetUnpackColormapMessage *setUnpackColormap = (SetUnpackColormapMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(setUnpackColormap -> client, 8, + clientCache -> resourceCache); +} diff --git a/nxcomp/src/SetUnpackColormap.h b/nxcomp/src/SetUnpackColormap.h new file mode 100644 index 000000000..779366531 --- /dev/null +++ b/nxcomp/src/SetUnpackColormap.h @@ -0,0 +1,162 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef SetUnpackColormap_H +#define SetUnpackColormap_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define SETUNPACKCOLORMAP_ENABLE_CACHE 1 +#define SETUNPACKCOLORMAP_ENABLE_DATA 1 + +#define SETUNPACKCOLORMAP_DATA_LIMIT 4096 + +#define SETUNPACKCOLORMAP_CACHE_SLOTS 2000 +#define SETUNPACKCOLORMAP_CACHE_THRESHOLD 5 +#define SETUNPACKCOLORMAP_CACHE_LOWER_THRESHOLD 0 + +#define SETUNPACKCOLORMAP_DATA_OFFSET_IF_PROTO_STEP_7 16 +#define SETUNPACKCOLORMAP_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +#define SETUNPACKCOLORMAP_ENABLE_SPLIT_IF_PROTO_STEP_8 0 + +// +// The message class. +// + +class SetUnpackColormapMessage : public Message +{ + friend class SetUnpackColormapStore; + + public: + + SetUnpackColormapMessage() + { + } + + ~SetUnpackColormapMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char client; + unsigned char method; + + unsigned int src_length; + unsigned int dst_length; +}; + +class SetUnpackColormapStore : public MessageStore +{ + public: + + SetUnpackColormapStore(StaticCompressor *compressor); + + virtual ~SetUnpackColormapStore(); + + virtual const char *name() const + { + return "SetUnpackColormap"; + } + + virtual unsigned char opcode() const + { + return X_NXSetUnpackColormap; + } + + virtual unsigned int storage() const + { + return sizeof(SetUnpackColormapMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new SetUnpackColormapMessage(); + } + + virtual Message *create(const Message &message) const + { + return new SetUnpackColormapMessage((const SetUnpackColormapMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (SetUnpackColormapMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* SetUnpackColormap_H */ diff --git a/nxcomp/src/SetUnpackGeometry.cpp b/nxcomp/src/SetUnpackGeometry.cpp new file mode 100644 index 000000000..edff6a544 --- /dev/null +++ b/nxcomp/src/SetUnpackGeometry.cpp @@ -0,0 +1,305 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "SetUnpackGeometry.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +SetUnpackGeometryStore::SetUnpackGeometryStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = SETUNPACKGEOMETRY_ENABLE_CACHE; + enableData = SETUNPACKGEOMETRY_ENABLE_DATA; + enableSplit = SETUNPACKGEOMETRY_ENABLE_SPLIT; + enableCompress = SETUNPACKGEOMETRY_ENABLE_COMPRESS; + + dataLimit = SETUNPACKGEOMETRY_DATA_LIMIT; + dataOffset = SETUNPACKGEOMETRY_DATA_OFFSET; + + cacheSlots = SETUNPACKGEOMETRY_CACHE_SLOTS; + cacheThreshold = SETUNPACKGEOMETRY_CACHE_THRESHOLD; + cacheLowerThreshold = SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +SetUnpackGeometryStore::~SetUnpackGeometryStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int SetUnpackGeometryStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> resourceCache); + + const unsigned char *nextChar = buffer + 4; + + for (int i = 0; i < 6; i++) + { + encodeBuffer.encodeCachedValue(*nextChar++, 8, + clientCache -> depthCache); + } + + encodeBuffer.encodeValue(GetULONG(buffer + 12, bigEndian), 32); + encodeBuffer.encodeValue(GetULONG(buffer + 16, bigEndian), 32); + encodeBuffer.encodeValue(GetULONG(buffer + 20, bigEndian), 32); + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackGeometryStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + size = 24; + buffer = writeBuffer -> addMessage(size); + + unsigned char cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> resourceCache); + *(buffer + 1) = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 4) = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 5) = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 6) = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 7) = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 8) = cValue; + + decodeBuffer.decodeCachedValue(cValue, 8, + clientCache -> depthCache); + *(buffer + 9) = cValue; + + unsigned int value; + + decodeBuffer.decodeValue(value, 32); + PutULONG(value, buffer + 12, bigEndian); + + decodeBuffer.decodeValue(value, 32); + PutULONG(value, buffer + 16, bigEndian); + + decodeBuffer.decodeValue(value, 32); + PutULONG(value, buffer + 20, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackGeometryStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; + + setUnpackGeometry -> client = *(buffer + 1); + + setUnpackGeometry -> depth_1_bpp = *(buffer + 4); + setUnpackGeometry -> depth_4_bpp = *(buffer + 5); + setUnpackGeometry -> depth_8_bpp = *(buffer + 6); + setUnpackGeometry -> depth_16_bpp = *(buffer + 7); + setUnpackGeometry -> depth_24_bpp = *(buffer + 8); + setUnpackGeometry -> depth_32_bpp = *(buffer + 9); + + setUnpackGeometry -> red_mask = GetULONG(buffer + 12, bigEndian); + setUnpackGeometry -> green_mask = GetULONG(buffer + 16, bigEndian); + setUnpackGeometry -> blue_mask = GetULONG(buffer + 20, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +int SetUnpackGeometryStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; + + *(buffer + 1) = setUnpackGeometry -> client; + + *(buffer + 4) = setUnpackGeometry -> depth_1_bpp; + *(buffer + 5) = setUnpackGeometry -> depth_4_bpp; + *(buffer + 6) = setUnpackGeometry -> depth_8_bpp; + *(buffer + 7) = setUnpackGeometry -> depth_16_bpp; + *(buffer + 8) = setUnpackGeometry -> depth_24_bpp; + *(buffer + 9) = setUnpackGeometry -> depth_32_bpp; + + PutULONG(setUnpackGeometry -> red_mask, buffer + 12, bigEndian); + PutULONG(setUnpackGeometry -> green_mask, buffer + 16, bigEndian); + PutULONG(setUnpackGeometry -> blue_mask, buffer + 20, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << message << ".\n" << logofs_flush; + #endif + + return 1; +} + +void SetUnpackGeometryStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; + + *logofs << name() << ": Identity client " + << (unsigned) setUnpackGeometry -> client << " depth_1_bpp " + << (unsigned) setUnpackGeometry -> depth_1_bpp << " depth_4_bpp " + << (unsigned int) setUnpackGeometry -> depth_4_bpp << " depth_8_bpp " + << (unsigned int) setUnpackGeometry -> depth_8_bpp << " depth_16_bpp " + << (unsigned int) setUnpackGeometry -> depth_16_bpp << " depth_24_bpp " + << (unsigned int) setUnpackGeometry -> depth_24_bpp << " depth_32_bpp " + << (unsigned int) setUnpackGeometry -> depth_32_bpp + + << " red_mask " << setUnpackGeometry -> red_mask + << " green_mask " << setUnpackGeometry -> green_mask + << " blue_mask " << setUnpackGeometry -> blue_mask + + << " size " << setUnpackGeometry -> size_ << ".\n"; + + #endif +} + +void SetUnpackGeometryStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 4, 6); + md5_append(md5_state_, buffer + 12, 12); +} + +void SetUnpackGeometryStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; + SetUnpackGeometryMessage *cachedSetUnpackGeometry = (SetUnpackGeometryMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef TEST + *logofs << name() << ": Encoding value " + << (unsigned int) setUnpackGeometry -> client + << " as client field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue(setUnpackGeometry -> client, 8, + clientCache -> resourceCache); + + cachedSetUnpackGeometry -> client = setUnpackGeometry -> client; +} + +void SetUnpackGeometryStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + SetUnpackGeometryMessage *setUnpackGeometry = (SetUnpackGeometryMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + decodeBuffer.decodeCachedValue(setUnpackGeometry -> client, 8, + clientCache -> resourceCache); + + #ifdef DEBUG + *logofs << name() << ": Decoded value " + << (unsigned int) setUnpackGeometry -> client + << " as client field.\n" << logofs_flush; + #endif +} diff --git a/nxcomp/src/SetUnpackGeometry.h b/nxcomp/src/SetUnpackGeometry.h new file mode 100644 index 000000000..96104f57f --- /dev/null +++ b/nxcomp/src/SetUnpackGeometry.h @@ -0,0 +1,167 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef SetUnpackGeometry_H +#define SetUnpackGeometry_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define SETUNPACKGEOMETRY_ENABLE_CACHE 1 +#define SETUNPACKGEOMETRY_ENABLE_DATA 0 +#define SETUNPACKGEOMETRY_ENABLE_SPLIT 0 +#define SETUNPACKGEOMETRY_ENABLE_COMPRESS 0 + +#define SETUNPACKGEOMETRY_DATA_LIMIT 24 +#define SETUNPACKGEOMETRY_DATA_OFFSET 24 + +#define SETUNPACKGEOMETRY_CACHE_SLOTS 20 +#define SETUNPACKGEOMETRY_CACHE_THRESHOLD 1 +#define SETUNPACKGEOMETRY_CACHE_LOWER_THRESHOLD 0 + +// +// The message class. +// + +class SetUnpackGeometryMessage : public Message +{ + friend class SetUnpackGeometryStore; + + public: + + SetUnpackGeometryMessage() + { + } + + ~SetUnpackGeometryMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned char client; + + unsigned char depth_1_bpp; + unsigned char depth_4_bpp; + unsigned char depth_8_bpp; + unsigned char depth_16_bpp; + unsigned char depth_24_bpp; + unsigned char depth_32_bpp; + + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; +}; + +class SetUnpackGeometryStore : public MessageStore +{ + public: + + SetUnpackGeometryStore(StaticCompressor *compressor); + + virtual ~SetUnpackGeometryStore(); + + virtual const char *name() const + { + return "SetUnpackGeometry"; + } + + virtual unsigned char opcode() const + { + return X_NXSetUnpackGeometry; + } + + virtual unsigned int storage() const + { + return sizeof(SetUnpackGeometryMessage); + } + + // + // Message handling methods. + // + + protected: + + virtual Message *create() const + { + return new SetUnpackGeometryMessage(); + } + + virtual Message *create(const Message &message) const + { + return new SetUnpackGeometryMessage((const SetUnpackGeometryMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (SetUnpackGeometryMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* SetUnpackGeometry_H */ diff --git a/nxcomp/src/ShapeExtension.cpp b/nxcomp/src/ShapeExtension.cpp new file mode 100644 index 000000000..2ee2b67db --- /dev/null +++ b/nxcomp/src/ShapeExtension.cpp @@ -0,0 +1,305 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "ShapeExtension.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "WriteBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Constructors and destructors. +// + +ShapeExtensionStore::ShapeExtensionStore(StaticCompressor *compressor) + + : MessageStore(compressor) +{ + enableCache = SHAPEEXTENSION_ENABLE_CACHE; + enableData = SHAPEEXTENSION_ENABLE_DATA; + enableSplit = SHAPEEXTENSION_ENABLE_SPLIT; + + // Since ProtoStep7 (#issue 108) + enableCompress = SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7; + + dataLimit = SHAPEEXTENSION_DATA_LIMIT; + dataOffset = SHAPEEXTENSION_DATA_OFFSET; + + cacheSlots = SHAPEEXTENSION_CACHE_SLOTS; + cacheThreshold = SHAPEEXTENSION_CACHE_THRESHOLD; + cacheLowerThreshold = SHAPEEXTENSION_CACHE_LOWER_THRESHOLD; + + opcode_ = X_NXInternalShapeExtension; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; +} + +ShapeExtensionStore::~ShapeExtensionStore() +{ + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); +} + +// +// Here are the methods to handle messages' content. +// + +int ShapeExtensionStore::encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const +{ + // + // Handle this extension in a way similar to shape. + // + + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Encoding full message identity.\n" << logofs_flush; + #endif + + // + // We handle all possible requests of this extension + // using the same opcode. We give to message a data + // offset of 4 (or 16 if proto is >= 3) and handle + // the first 16 bytes through an array of caches. + // + + encodeBuffer.encodeValue(size >> 2, 16, 10); + + encodeBuffer.encodeCachedValue(*(buffer + 1), 8, + clientCache -> shapeOpcodeCache); + + for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) + { + encodeBuffer.encodeCachedValue(GetUINT(buffer + (i * 2) + 4, bigEndian), 16, + *clientCache -> shapeDataCache[i]); + } + + #ifdef DEBUG + *logofs << name() << ": Encoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int ShapeExtensionStore::decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const +{ + ClientCache *clientCache = (ClientCache *) channelCache; + + #ifdef DEBUG + *logofs << name() << ": Decoding full message identity.\n" << logofs_flush; + #endif + + decodeBuffer.decodeValue(size, 16, 10); + + size <<= 2; + + buffer = writeBuffer -> addMessage(size); + + decodeBuffer.decodeCachedValue(*(buffer + 1), 8, + clientCache -> shapeOpcodeCache); + + unsigned int value; + + for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> shapeDataCache[i]); + + PutUINT(value, buffer + 4 + (i * 2), bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Decoded full message identity.\n" << logofs_flush; + #endif + + return 1; +} + +int ShapeExtensionStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; + + shapeExtension -> opcode = *(buffer + 1); + + for (unsigned int i = 0; i < 8; i++) + { + if ((i * 2 + 4) < size) + { + shapeExtension -> data[i] = GetUINT(buffer + i * 2 + 4, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed data[" << i << "].\n" + << logofs_flush; + #endif + } + else + { + shapeExtension -> data[i] = 0; + } + } + + #ifdef DEBUG + *logofs << name() << ": Parsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int ShapeExtensionStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; + + *(buffer + 1) = shapeExtension -> opcode; + + for (unsigned int i = 0; i < 8 && (i * 2 + 4) < size; i++) + { + PutUINT(shapeExtension -> data[i], buffer + i * 2 + 4, bigEndian); + } + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " + << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void ShapeExtensionStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; + + *logofs << name() << ": Identity opcode " << (unsigned) shapeExtension -> opcode; + + for (int i = 0; i < 8; i++) + { + *logofs << ", data[" << i << "] " << shapeExtension -> data[i]; + } + + *logofs << ", size " << shapeExtension -> size_ << ".\n" << logofs_flush; + + #endif +} + +void ShapeExtensionStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + // + // Include minor opcode in the checksum. As data + // offset can be beyond the real end of message, + // we need to include size or we will match any + // message of size less or equal to data offset. + // + + md5_append(md5_state_, buffer + 1, 3); +} + +void ShapeExtensionStore::updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const +{ + // + // Encode the variant part. + // + + ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; + ShapeExtensionMessage *cachedShapeExtension = (ShapeExtensionMessage *) cachedMessage; + + ClientCache *clientCache = (ClientCache *) channelCache; + + for (int i = 0; i < 8 && (i * 2 + 4) < shapeExtension -> size_; i++) + { + #ifdef TEST + *logofs << name() << ": Encoding value " << shapeExtension -> data[i] + << " as data[" << i << "] field.\n" << logofs_flush; + #endif + + encodeBuffer.encodeCachedValue((unsigned int) shapeExtension -> data[i], 16, + *clientCache -> shapeDataCache[i]); + + cachedShapeExtension -> data[i] = shapeExtension -> data[i]; + } +} + +void ShapeExtensionStore::updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const +{ + ShapeExtensionMessage *shapeExtension = (ShapeExtensionMessage *) message; + + ClientCache *clientCache = (ClientCache *) channelCache; + + unsigned int value; + + for (int i = 0; i < 8 && (i * 2 + 4) < shapeExtension -> size_; i++) + { + decodeBuffer.decodeCachedValue(value, 16, + *clientCache -> shapeDataCache[i]); + + shapeExtension -> data[i] = (unsigned short) value; + + #ifdef TEST + *logofs << name() << ": Decoded value " << shapeExtension -> data[i] + << " as data[" << i << "] field.\n" << logofs_flush; + #endif + } +} diff --git a/nxcomp/src/ShapeExtension.h b/nxcomp/src/ShapeExtension.h new file mode 100644 index 000000000..4dd636847 --- /dev/null +++ b/nxcomp/src/ShapeExtension.h @@ -0,0 +1,164 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef ShapeExtension_H +#define ShapeExtension_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define SHAPEEXTENSION_ENABLE_CACHE 1 +#define SHAPEEXTENSION_ENABLE_DATA 1 +#define SHAPEEXTENSION_ENABLE_SPLIT 0 + +#define SHAPEEXTENSION_DATA_LIMIT 3200 +#define SHAPEEXTENSION_DATA_OFFSET 20 + +#define SHAPEEXTENSION_CACHE_SLOTS 3000 +#define SHAPEEXTENSION_CACHE_THRESHOLD 10 +#define SHAPEEXTENSION_CACHE_LOWER_THRESHOLD 5 + +#define SHAPEEXTENSION_ENABLE_COMPRESS_IF_PROTO_STEP_7 0 + +// +// The message class. +// + +class ShapeExtensionMessage : public Message +{ + friend class ShapeExtensionStore; + + public: + + ShapeExtensionMessage() + { + } + + ~ShapeExtensionMessage() + { + } + + // + // Note for encoding in protocol level 1: we consider + // for this message a data offset of 4. Bytes from 5 + // to 20, if present, are taken as part of identity + // and encoded through an array of int caches. + // + + private: + + unsigned char opcode; + unsigned short data[8]; +}; + +class ShapeExtensionStore : public MessageStore +{ + public: + + ShapeExtensionStore(StaticCompressor *compressor); + + virtual ~ShapeExtensionStore(); + + virtual const char *name() const + { + return "ShapeExtension"; + } + + virtual unsigned char opcode() const + { + return opcode_; + } + + virtual unsigned int storage() const + { + return sizeof(ShapeExtensionMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new ShapeExtensionMessage(); + } + + virtual Message *create(const Message &message) const + { + return new ShapeExtensionMessage((const ShapeExtensionMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (ShapeExtensionMessage *) message; + } + + virtual int encodeIdentity(EncodeBuffer &encodeBuffer, const unsigned char *buffer, + const unsigned int size, int bigEndian, + ChannelCache *channelCache) const; + + virtual int decodeIdentity(DecodeBuffer &decodeBuffer, unsigned char *&buffer, + unsigned int &size, int bigEndian, WriteBuffer *writeBuffer, + ChannelCache *channelCache) const; + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void updateIdentity(EncodeBuffer &encodeBuffer, const Message *message, + const Message *cachedMessage, + ChannelCache *channelCache) const; + + virtual void updateIdentity(DecodeBuffer &decodeBuffer, const Message *message, + ChannelCache *channelCache) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; + + private: + + unsigned char opcode_; +}; + +#endif /* ShapeExtension_H */ diff --git a/nxcomp/src/Socket.cpp b/nxcomp/src/Socket.cpp new file mode 100644 index 000000000..8be04d76d --- /dev/null +++ b/nxcomp/src/Socket.cpp @@ -0,0 +1,757 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include + +#if defined(__CYGWIN32__) || defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) +#include +#endif + +#ifdef __sun +#include +#include +#endif + +#include +#include +#include +#include + +#include +#include + +// +// System specific defines. +// + +#if defined(__APPLE__) || defined(__FreeBSD__) || defined(__sun) +#define SOL_IP IPPROTO_IP +#endif + +#ifdef __sun +#define INADDR_NONE ((unsigned int) -1) +#endif + +// +// The TIOCOUTQ ioctl is not implemented on Cygwin. +// Note also that TIOCOUTQ and IPTOS_LOWDELAY are +// disabled when running on MacOS/X. +// + +#ifdef __CYGWIN32__ +#define TIOCOUTQ ((unsigned int) -1) +#endif + +// +// NX includes. +// + +#include "Misc.h" +#include "Socket.h" + +// +// Set verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Set this only once by querying OS details. +// + +static int _kernelStep = -1; + +int GetKernelStep() +{ + if (_kernelStep < 0) + { + // + // At the moment only NX clients run on Win32 + // and MacOS/X so we are not really interested + // in the relevant OS dependent functions. + // + + #if defined(__CYGWIN32__) || defined(__APPLE__) + + _kernelStep = 0; + + #else + + struct utsname buffer; + + if (uname(&buffer) < 0) + { + #ifdef WARNING + *logofs << "Socket: WARNING! Failed to get system info. Error is " + << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; + + *logofs << "Socket: WARNING! Assuming lowest system support.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to get system info. Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + cerr << "Warning" << ": Assuming lowest system support.\n"; + + _kernelStep = 0; + } + else + { + #ifdef TEST + *logofs << "Socket: System is '" << buffer.sysname + << "' nodename '" << buffer.nodename << "' release '" + << buffer.release << "'.\n" << logofs_flush; + + *logofs << "Socket: Version is '" << buffer.version << "' machine '" + << buffer.machine << "'.\n" << logofs_flush; + #endif + + // + // Should test support on other operating systems. + // + + if (strcmp(buffer.sysname, "Linux") == 0) + { + if (strncmp(buffer.release, "2.0.", 4) == 0 || + strncmp(buffer.release, "2.2.", 4) == 0) + { + #ifdef TEST + *logofs << "Socket: Assuming level 2 system support.\n" + << logofs_flush; + #endif + + _kernelStep = 2; + } + else + { + #ifdef TEST + *logofs << "Socket: Assuming level 3 system support.\n" + << logofs_flush; + #endif + + _kernelStep = 3; + } + } + else if (strcmp(buffer.sysname, "SunOS") == 0) + { + #ifdef TEST + *logofs << "Socket: Assuming level 1 system support.\n" + << logofs_flush; + #endif + + _kernelStep = 1; + } + else + { + #ifdef TEST + *logofs << "Socket: Assuming level 0 system support.\n" + << logofs_flush; + #endif + + _kernelStep = 0; + } + } + + #endif /* #if defined(__CYGWIN32__) || defined(__APPLE__) */ + } + + return _kernelStep; +} + +int SetReuseAddress(int fd) +{ + int flag = 1; + + if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR, + (char *) &flag, sizeof(flag)) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set SO_REUSEADDR flag on FD#" + << fd << ". Error is " << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set SO_REUSEADDR flag on FD#" + << fd << ". Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Socket: Set SO_REUSEADDR flag on FD#" + << fd << ".\n" << logofs_flush; + } + #endif + + return 1; +} + +int SetNonBlocking(int fd, int value) +{ + int flags = fcntl(fd, F_GETFL); + + if (flags >= 0) + { + if (value == 0) + { + flags &= ~O_NONBLOCK; + } + else + { + flags |= O_NONBLOCK; + } + } + + if (flags < 0 || fcntl(fd, F_SETFL, flags) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set O_NONBLOCK flag on FD#" + << fd << " to " << value << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set O_NONBLOCK flag on FD#" + << fd << " to " << value << ". Error is " << EGET() + << " '" << ESTR() << "'.\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Socket: Set O_NONBLOCK flag on FD#" + << fd << " to " << value << ".\n" + << logofs_flush; + } + #endif + + return 1; +} + +int SetLingerTimeout(int fd, int timeout) +{ + struct linger linger_value; + + if (timeout > 0) + { + linger_value.l_onoff = 1; + linger_value.l_linger = timeout; + } + else + { + linger_value.l_onoff = 0; + linger_value.l_linger = 0; + } + + if (setsockopt(fd, SOL_SOCKET, SO_LINGER, &linger_value, sizeof(linger_value)) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set SO_LINGER values to " + << linger_value.l_onoff << " and " << linger_value.l_linger + << " on FD#" << fd << ". Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set SO_LINGER values to " + << linger_value.l_onoff << " and " << linger_value.l_linger + << " on FD#" << fd << ". Error is " << EGET() << " '" + << ESTR() << "'.\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Socket: Set SO_LINGER values to " + << linger_value.l_onoff << " and " << linger_value.l_linger + << " on FD#" << fd << ".\n" << logofs_flush; + } + #endif + + return 1; +} + +int SetSendBuffer(int fd, int size) +{ + if (setsockopt(fd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set SO_SNDBUF size to " + << size << " on FD#" << fd << ". Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set SO_SNDBUF size to " + << size << " on FD#" << fd << ". Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Socket: Set SO_SNDBUF on FD#" << fd + << " to " << size << " bytes.\n" + << logofs_flush; + } + #endif + + return 1; +} + +int SetReceiveBuffer(int fd, int size) +{ + if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set SO_RCVBUF size to " + << size << " on FD#" << fd << ". Error is " + << EGET() << " '" << ESTR() << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set SO_RCVBUF size to " + << size << " on FD#" << fd << ". Error is " + << EGET() << " '" << ESTR() << "'.\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Socket: Set SO_RCVBUF on FD#" << fd + << " to " << size << " bytes.\n" + << logofs_flush; + } + #endif + + return 1; +} + +int SetNoDelay(int fd, int value) +{ + int result = setsockopt(fd, IPPROTO_TCP, TCP_NODELAY, &value, sizeof(value)); + + if (result == 0) + { + result = 1; + } + else if (result < 0) + { + // + // Is it become a different error on + // Mac OSX 10.4? + // + + #if defined(__APPLE__) + + result = 0; + + #endif + + #if defined(__sun) + + if (EGET() == ENOPROTOOPT) + { + result = 0; + } + + #endif + + #if !defined(__APPLE__) && !defined(__sun) + + if (EGET() == EOPNOTSUPP) + { + result = 0; + } + + #endif + } + + if (result < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set TCP_NODELAY flag on " + << "FD#" << fd << " to " << value << ". Error is " + << EGET() << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set TCP_NODELAY flag on " + << "FD#" << fd << " to " << value << ". Error is " + << EGET() << " '" << ESTR() << "'.\n"; + } + #ifdef TEST + else if (result == 0) + { + #ifdef TEST + *logofs << "Socket: Option TCP_NODELAY not supported " + << "on FD#" << fd << ".\n" << logofs_flush; + #endif + } + else + { + *logofs << "Socket: Set TCP_NODELAY flag on FD#" + << fd << " to " << value << ".\n" + << logofs_flush; + } + #endif + + return result; +} + +int SetKeepAlive(int fd) +{ + int flag = 1; + + if (setsockopt(fd, SOL_SOCKET, SO_KEEPALIVE, &flag, sizeof(flag)) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to set SO_KEEPALIVE flag on " + << "FD#" << fd << ". Error is " << EGET() << " '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to set SO_KEEPALIVE flag on " + << "FD#" << fd << ". Error is " << EGET() << " '" + << ESTR() << "'.\n"; + + return -1; + } + #ifdef TEST + else + { + *logofs << "Socket: Set SO_KEEPALIVE flag on FD#" + << fd << ".\n" << logofs_flush; + } + #endif + + return 1; +} + +int SetLowDelay(int fd) +{ + if (_kernelStep < 0) + { + GetKernelStep(); + } + + switch (_kernelStep) + { + case 3: + case 2: + case 1: + { + int flag = IPTOS_LOWDELAY; + + if (setsockopt(fd, SOL_IP, IP_TOS, &flag, sizeof(flag)) < 0) + { + if (EGET() == EOPNOTSUPP) + { + #ifdef TEST + *logofs << "Socket: Option IPTOS_LOWDELAY not supported " + << "on FD#" << fd << ".\n" << logofs_flush; + #endif + + return 0; + } + else + { + #ifdef WARNING + *logofs << "Socket: WARNING! Failed to set IPTOS_LOWDELAY flag on " + << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to set IPTOS_LOWDELAY flag on " + << "FD#" << fd << ". Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + return -1; + } + } + #ifdef TEST + else + { + *logofs << "Socket: Set IPTOS_LOWDELAY flag on FD#" + << fd << ".\n" << logofs_flush; + } + #endif + + return 1; + } + default: + { + #ifdef TEST + *logofs << "Socket: Option IPTOS_LOWDELAY not " + << "supported on FD#" << fd << ".\n" + << logofs_flush; + #endif + + return 0; + } + } +} + +int SetCloseOnExec(int fd) +{ + if (fcntl(fd, F_SETFD, 1) != 0) + { + #ifdef TEST + *logofs << "NXClient: PANIC! Cannot set close-on-exec " + << "on FD#" << fd << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot set close-on-exec on FD#" + << fd << ". Error is " << EGET() << " '" << ESTR() + << "'.\n"; + + return -1; + } + + return 1; +} + +int GetBytesReadable(int fd) +{ + long readable = 0; + + // + // It may fail, for example at session + // shutdown. + // + + if (ioctl(fd, FIONREAD, &readable) < 0) + { + #ifdef TEST + *logofs << "Socket: PANIC! Failed to get bytes readable " + << "from FD#" << fd << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + return -1; + } + + #ifdef TEST + *logofs << "Socket: Returning " << (int) readable + << " bytes readable on FD#" << fd << ".\n" + << logofs_flush; + #endif + + return (int) readable; +} + +int GetBytesWritable(int fd) +{ + if (_kernelStep < 0) + { + GetKernelStep(); + } + + long writable; + + switch (_kernelStep) + { + case 3: + { + // + // TODO: Should query the real size + // of the TCP write buffer. + // + + writable = 16384 - GetBytesQueued(fd); + + if (writable < 0) + { + writable = 0; + } + + break; + } + case 2: + { + if (ioctl(fd, TIOCOUTQ, (void *) &writable) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to get bytes writable " + << "on FD#" << fd << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to get bytes writable " + << "on FD#" << fd << ". Error is " << EGET() + << " '" << ESTR() << "'.\n"; + + return -1; + } + + break; + } + default: + { + #ifdef TEST + *logofs << "Socket: Option TIOCOUTQ not supported " + << "on FD#" << fd << ",\n" << logofs_flush; + #endif + + // + // TODO: Should query the real size + // of the TCP write buffer. + // + + writable = 16384; + + break; + } + } + + #ifdef TEST + *logofs << "Socket: Returning " << writable + << " bytes writable on FD#" << fd + << ".\n" << logofs_flush; + #endif + + return (int) writable; +} + +int GetBytesQueued(int fd) +{ + // + // The TIOCOUTQ ioctl is not implemented on Cygwin + // and returns the space available on Linux Kernels + // 2.0 and 2.2 (like current MIPS for PS/2). + // + + if (_kernelStep < 0) + { + GetKernelStep(); + } + + long queued; + + switch (_kernelStep) + { + case 3: + { + if (ioctl(fd, TIOCOUTQ, (void *) &queued) < 0) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to get bytes queued " + << "on FD#" << fd << ". Error is " << EGET() + << " '" << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to get bytes queued " + << "on FD#" << fd << ". Error is " << EGET() + << " '" << ESTR() << "'.\n"; + + return -1; + } + + break; + } + case 2: + { + // + // TODO: Should query the real size + // of the TCP write buffer. + // + + queued = 16384 - GetBytesWritable(fd); + + if (queued < 0) + { + queued = 0; + } + + break; + } + default: + { + #ifdef TEST + *logofs << "Socket: Option TIOCOUTQ not supported " + << "on FD#" << fd << ",\n" << logofs_flush; + #endif + + queued = 0; + + break; + } + } + + #ifdef TEST + *logofs << "Socket: Returning " << queued + << " bytes queued on FD#" << fd + << ".\n" << logofs_flush; + #endif + + return (int) queued; +} + +int GetHostAddress(const char *name) +{ + hostent *host = gethostbyname(name); + + if (host == NULL) + { + // + // On some Unices gethostbyname() doesn't + // accept IP addresses, so try inet_addr. + // + + IN_ADDR_T address = inet_addr(name); + + if (address == INADDR_NONE) + { + #ifdef PANIC + *logofs << "Socket: PANIC! Failed to resolve address of '" + << name << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed to resolve address of '" + << name << "'.\n"; + + return 0; + } + + return (int) address; + } + else + { + return (*((int *) host -> h_addr_list[0])); + } +} diff --git a/nxcomp/src/Socket.h b/nxcomp/src/Socket.h new file mode 100644 index 000000000..5e7e47705 --- /dev/null +++ b/nxcomp/src/Socket.h @@ -0,0 +1,96 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Socket_H +#define Socket_H + +#include +#include +#include + +#ifdef __sun +#include +#include +#endif + +// +// Set socket options. +// + +int SetReuseAddress(int fd); +int SetNonBlocking(int fd, int value); +int SetLingerTimeout(int fd, int timeout); +int SetSendBuffer(int fd, int size); +int SetReceiveBuffer(int fd, int size); +int SetNoDelay(int fd, int value); +int SetKeepAlive(int fd); +int SetLowDelay(int fd); +int SetCloseOnExec(int fd); + +// +// Get kernel support level. +// + +int GetKernelStep(); + +// +// Get socket info. +// + +int GetBytesReadable(int fd); +int GetBytesWritable(int fd); +int GetBytesQueued(int fd); + +// +// Inline version, providing direct access +// to the interface. +// + +#include "Misc.h" + +inline int GetBytesReadable(int fd, int *readable) +{ + long t; + + int result = ioctl(fd, FIONREAD, &t); + + #ifdef DEBUG + *logofs << "Socket: Bytes readable from FD#" + << fd << " are " << t << " with result " + << result << ".\n" << logofs_flush; + #endif + + *readable = (int) t; + + return result; +} + +// +// Query Internet address. +// + +int GetHostAddress(const char *name); + +#endif /* Socket_H */ diff --git a/nxcomp/src/Split.cpp b/nxcomp/src/Split.cpp new file mode 100644 index 000000000..e2fea97cc --- /dev/null +++ b/nxcomp/src/Split.cpp @@ -0,0 +1,1839 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "Misc.h" + +#include "Split.h" + +#include "Control.h" +#include "Statistics.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "StaticCompressor.h" + +#include "Unpack.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Define this to trace elements +// allocated and deallocated. +// + +#undef REFERENCES + +// +// Counters used for store control. +// + +int SplitStore::totalSplitSize_; +int SplitStore::totalSplitStorageSize_; + +// +// This is used for reference count. +// + +#ifdef REFERENCES + +int Split::references_ = 0; + +#endif + +Split::Split() +{ + resource_ = nothing; + position_ = nothing; + + store_ = NULL; + + d_size_ = 0; + i_size_ = 0; + c_size_ = 0; + r_size_ = 0; + + next_ = 0; + load_ = 0; + save_ = 0; + + checksum_ = NULL; + state_ = split_undefined; + mode_ = split_none; + action_ = is_discarded; + + #ifdef REFERENCES + + references_++; + + *logofs << "Split: Created new Split at " + << this << " out of " << references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +Split::~Split() +{ + delete [] checksum_; + + #ifdef REFERENCES + + references_--; + + *logofs << "Split: Deleted Split at " + << this << " out of " << references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +SplitStore::SplitStore(StaticCompressor *compressor, CommitStore *commits, int resource) + + : compressor_(compressor), commits_(commits), resource_(resource) +{ + splits_ = new T_splits(); + + current_ = splits_ -> end(); + + splitStorageSize_ = 0; + + #ifdef TEST + *logofs << "SplitStore: Created new store ["; + + if (resource_ != nothing) + { + *logofs << resource_; + } + else + { + *logofs << "commit"; + } + + *logofs << "].\n" << logofs_flush; + + *logofs << "SplitStore: Total messages in stores are " + << totalSplitSize_ << " with total storage size " + << totalSplitStorageSize_ << ".\n" + << logofs_flush; + #endif +} + +SplitStore::~SplitStore() +{ + totalSplitSize_ -= splits_ -> size(); + + totalSplitStorageSize_ -= splitStorageSize_; + + for (T_splits::iterator i = splits_ -> begin(); + i != splits_ -> end(); i++) + { + delete *i; + } + + delete splits_; + + #ifdef TEST + *logofs << "SplitStore: Deleted store ["; + + if (resource_ != nothing) + { + *logofs << resource_; + } + else + { + *logofs << "commit"; + } + + *logofs << "] with storage size " << splitStorageSize_ + << ".\n" << logofs_flush; + + *logofs << "SplitStore: Total messages in stores are " + << totalSplitSize_ << " with total storage size " + << totalSplitStorageSize_ << ".\n" + << logofs_flush; + #endif +} + +// +// This is called at the encoding side. +// + +Split *SplitStore::add(MessageStore *store, int resource, T_split_mode mode, + int position, T_store_action action, T_checksum checksum, + const unsigned char *buffer, const int size) +{ + #ifdef TEST + *logofs << "SplitStore: Adding message [" << (unsigned int) store -> + opcode() << "] resource " << resource << " mode " << mode + << " position " << position << " action [" << DumpAction(action) + << "] and checksum [" << DumpChecksum(checksum) << "]" + << ".\n" << logofs_flush; + #endif + + Split *split = new Split(); + + if (split == NULL) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Can't allocate " + << "memory for the split.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the split.\n"; + + HandleAbort(); + } + + split -> store_ = store; + split -> resource_ = resource; + split -> mode_ = mode; + split -> position_ = position; + split -> action_ = action; + + split -> store_ -> validateSize(size); + + // + // The checksum is not provided if the + // message is cached. + // + + if (checksum != NULL) + { + split -> checksum_ = new md5_byte_t[MD5_LENGTH]; + + memcpy(split -> checksum_, checksum, MD5_LENGTH); + } + + // + // We don't need the identity data at the + // encoding side. This qualifies the split + // as a split generated at the encoding + // side. + // + + split -> i_size_ = store -> identitySize(buffer, size); + + split -> d_size_ = size - split -> i_size_; + + if (action == IS_ADDED || action == is_discarded) + { + // + // If the message was added to message + // store or discarded we need to save + // the real data so we can transfer it + // at later time. + // + + split -> data_.resize(split -> d_size_); + + memcpy(split -> data_.begin(), buffer + split -> i_size_, split -> d_size_); + + // + // If the message was added, lock it so + // it will not be used by the encoding + // side until it is recomposed. + // + + if (action == IS_ADDED) + { + split -> store_ -> lock(split -> position_); + + #ifdef TEST + + commits_ -> validate(split); + + #endif + } + } + #ifdef WARNING + else + { + *logofs << "SplitStore: WARNING! Not copying data for the cached message.\n" + << logofs_flush; + } + #endif + + push(split); + + return split; +} + +// +// This is called at decoding side. If checksum +// is provided, the message can be searched on +// disk, then, if message is found, an event is +// sent to abort the data transfer. +// + +Split *SplitStore::add(MessageStore *store, int resource, int position, + T_store_action action, T_checksum checksum, + unsigned char *buffer, const int size) +{ + #ifdef TEST + *logofs << "SplitStore: Adding message [" + << (unsigned int) store -> opcode() << "] resource " + << resource << " position " << position << " action [" + << DumpAction(action) << "] and checksum [" + << DumpChecksum(checksum) << "].\n" << logofs_flush; + #endif + + Split *split = new Split(); + + if (split == NULL) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Can't allocate " + << "memory for the split.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory " + << "for the split.\n"; + + HandleAbort(); + } + + split -> store_ = store; + split -> resource_ = resource; + split -> position_ = position; + split -> action_ = action; + + split -> store_ -> validateSize(size); + + // + // Check if the checksum was provided + // by the remote. + // + + if (checksum != NULL) + { + split -> checksum_ = new md5_byte_t[MD5_LENGTH]; + + memcpy(split -> checksum_, checksum, MD5_LENGTH); + } + + split -> i_size_ = store -> identitySize(buffer, size); + + // + // Copy the identity so we can expand the + // message when it is committed. + // + + split -> identity_.resize(split -> i_size_); + + memcpy(split -> identity_.begin(), buffer, split -> i_size_); + + split -> d_size_ = size - split -> i_size_; + + if (action == IS_ADDED || action == is_discarded) + { + // + // The unpack procedure will check if the + // first 2 bytes of the buffer contain the + // pattern and will not try to expand the + // image. + // + + split -> data_.resize(2); + + unsigned char *data = split -> data_.begin(); + + data[0] = SPLIT_PATTERN; + data[1] = SPLIT_PATTERN; + + // + // If the message was added to the store, + // we don't have the data part, yet, so + // we need to lock the message until it + // is recomposed. + // + + if (action == IS_ADDED) + { + split -> store_ -> lock(split -> position_); + + #ifdef TEST + + commits_ -> validate(split); + + #endif + } + } + else + { + #ifdef WARNING + *logofs << "SplitStore: WARNING! Copying data for the cached message.\n" + << logofs_flush; + #endif + + // + // We may optionally take the data from the + // message store in compressed form, but, + // as the data has been decompressed in the + // buffer, we save a further decompression. + // + + split -> data_.resize(split -> d_size_); + + memcpy(split -> data_.begin(), buffer + split -> i_size_, split -> d_size_); + } + + push(split); + + return split; +} + +void SplitStore::push(Split *split) +{ + splits_ -> push_back(split); + + splitStorageSize_ += getNodeSize(split); + + totalSplitSize_++; + + totalSplitStorageSize_ += getNodeSize(split); + + statistics -> addSplit(); + + #ifdef TEST + *logofs << "SplitStore: There are " << splits_ -> size() + << " messages in store [" << resource_ << "] with " + << "storage size " << splitStorageSize_ << ".\n" + << logofs_flush; + + *logofs << "SplitStore: Total messages in stores are " + << totalSplitSize_ << " with total storage size " + << totalSplitStorageSize_ << ".\n" + << logofs_flush; + #endif + + split -> state_ = split_added; +} + +void SplitStore::dump() +{ + #ifdef DUMP + + int n; + + Split *split; + + *logofs << "SplitStore: DUMP! Dumping content of "; + + if (commits_ == NULL) + { + *logofs << "[commits]"; + } + else + { + *logofs << "[splits] for store [" << resource_ << "]"; + } + + *logofs << " with [" << getSize() << "] elements " + << "in the store.\n" << logofs_flush; + + n = 0; + + for (T_splits::iterator i = splits_ -> begin(); i != splits_ -> end(); i++, n++) + { + split = *i; + + *logofs << "SplitStore: DUMP! Split [" << n << "] has action [" + << DumpAction(split -> action_) << "] state [" + << DumpState(split -> state_) << "] "; + + if (split -> resource_ >= 0) + { + *logofs << "resource " << split -> resource_; + } + + *logofs << " request " << (unsigned) split -> store_ -> opcode() + << " position " << split -> position_ << " size is " + << split -> data_.size() << " (" << split -> d_size_ + << "/" << split -> c_size_ << "/" << split -> r_size_ + << ") with " << split -> data_.size() - split -> next_ + << "] bytes to go.\n" << logofs_flush; + } + + #endif +} + +int SplitStore::send(EncodeBuffer &encodeBuffer, int packetSize) +{ + if (splits_ -> size() == 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Function send called with no splits available.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Function send called with no splits available.\n"; + + HandleAbort(); + } + + // + // A start operation must always be executed on + // the split, even in the case the split will be + // later aborted. + // + + if (current_ == splits_ -> end()) + { + start(encodeBuffer); + } + + // + // If we have matched the checksum received from + // the remote side then we must abort the current + // split, else we can send another block of data + // to the remote peer. + // + + Split *split = *current_; + + unsigned int abort = 0; + + if (split -> state_ == split_loaded) + { + abort = 1; + } + + encodeBuffer.encodeBoolValue(abort); + + if (abort == 1) + { + #ifdef TEST + *logofs << "SplitStore: Aborting split for checksum [" + << DumpChecksum(split -> checksum_) << "] position " + << split -> position_ << " with " << (split -> + data_.size() - split -> next_) << " bytes to go " + << "out of " << split -> data_.size() + << ".\n" << logofs_flush; + #endif + + statistics -> addSplitAborted(); + + statistics -> addSplitAbortedBytesOut(split -> data_.size() - split -> next_); + + split -> next_ = split -> data_.size(); + + split -> state_ = split_aborted; + } + else + { + int count = (packetSize <= 0 || split -> next_ + + packetSize > (int) split -> data_.size() ? + split -> data_.size() - split -> next_ : packetSize); + + #ifdef TEST + *logofs << "SplitStore: Sending split for checksum [" + << DumpChecksum(split -> checksum_) << "] count " + << count << " position " << split -> position_ + << ". Data size is " << split -> data_.size() << " (" + << split -> d_size_ << "/" << split -> c_size_ << "), " + << split -> data_.size() - (split -> next_ + count) + << " to go.\n" << logofs_flush; + #endif + + encodeBuffer.encodeValue(count, 32, 10); + + encodeBuffer.encodeMemory(split -> data_.begin() + split -> next_, count); + + split -> next_ += count; + } + + // + // Was data completely transferred? We are the + // sending side. We must update the message in + // store, even if split was aborted. + // + + if (split -> next_ != ((int) split -> data_.size())) + { + return 0; + } + + // + // Move the split at the head of the + // list to the commits. + // + + remove(split); + + // + // Reset current position to the + // end of repository. + // + + current_ = splits_ -> end(); + + #ifdef TEST + *logofs << "SplitStore: Removed split at head of the list. " + << "Resource is " << split -> resource_ << " request " + << (unsigned) split -> store_ -> opcode() << " position " + << split -> position_ << ".\n" << logofs_flush; + #endif + + return 1; +} + +int SplitStore::start(EncodeBuffer &encodeBuffer) +{ + // + // Get the element at the top of the + // list. + // + + current_ = splits_ -> begin(); + + Split *split = *current_; + + #ifdef TEST + *logofs << "SplitStore: Starting split for checksum [" + << DumpChecksum(split -> checksum_) << "] position " + << split -> position_ << " with " << (split -> + data_.size() - split -> next_) << " bytes to go " + << "out of " << split -> data_.size() + << ".\n" << logofs_flush; + #endif + + // + // See if compression of the data part is + // enabled. + // + + if (split -> store_ -> enableCompress) + { + // + // If the split is going to be aborted don't + // compress the data and go straight to the + // send. The new data size will be assumed + // from the disk cache. + // + + if (split -> state_ != split_loaded) + { + unsigned int compressedSize = 0; + unsigned char *compressedData = NULL; + + if (control -> LocalDataCompression && + (compressor_ -> compressBuffer(split -> data_.begin(), split -> d_size_, + compressedData, compressedSize))) + { + // + // Replace the data with the one in + // compressed form. + // + + #ifdef TEST + *logofs << "SplitStore: Split data of size " << split -> d_size_ + << " has been compressed to " << compressedSize + << " bytes.\n" << logofs_flush; + #endif + + split -> data_.clear(); + + split -> data_.resize(compressedSize); + + memcpy(split -> data_.begin(), compressedData, compressedSize); + + split -> c_size_ = compressedSize; + + // + // Inform our peer that the data is + // compressed and send the new size. + // + + encodeBuffer.encodeBoolValue(1); + + encodeBuffer.encodeValue(compressedSize, 32, 14); + + #ifdef TEST + *logofs << "SplitStore: Signaled " << split -> c_size_ + << " bytes of compressed data for this message.\n" + << logofs_flush; + #endif + + return 1; + } + } + #ifdef TEST + else + { + *logofs << "SplitStore: Not trying to compress the " + << "loaded message.\n" << logofs_flush; + } + #endif + + // + // Tell to the remote that data will + // follow uncompressed. + // + + encodeBuffer.encodeBoolValue(0); + } + + return 1; +} + +int SplitStore::start(DecodeBuffer &decodeBuffer) +{ + #ifdef TEST + *logofs << "SplitStore: Going to receive a new split from the remote side.\n" + << logofs_flush; + #endif + + // + // Get the element at the head + // of the list. + // + + current_ = splits_ -> begin(); + + Split *split = *current_; + + unsigned int compressedSize = 0; + + // + // Save the data size known by the remote. + // This information will be needed if the + // remote will not have a chance to abort + // the split. + // + + split -> r_size_ = split -> d_size_; + + // + // Find out if data was compressed by the + // remote. + // + + if (split -> store_ -> enableCompress) + { + decodeBuffer.decodeBoolValue(compressedSize); + + if (compressedSize == 1) + { + // + // Get the compressed size. + // + + // Since ProtoStep7 (#issue 108) + decodeBuffer.decodeValue(compressedSize, 32, 14); + + split -> store_ -> validateSize(split -> d_size_, compressedSize); + + split -> r_size_ = compressedSize; + } + } + + // + // Update the size if the split + // was not already loaded. + // + + if (split -> state_ != split_loaded) + { + split -> data_.clear(); + + if (compressedSize > 0) + { + split -> c_size_ = compressedSize; + + #ifdef TEST + *logofs << "SplitStore: Split data of size " + << split -> d_size_ << " was compressed to " + << split -> c_size_ << " bytes.\n" + << logofs_flush; + #endif + + split -> data_.resize(split -> c_size_); + } + else + { + split -> data_.resize(split -> d_size_); + } + + unsigned char *data = split -> data_.begin(); + + data[0] = SPLIT_PATTERN; + data[1] = SPLIT_PATTERN; + } + #ifdef TEST + else + { + // + // The message had been already + // loaded from disk. + // + + if (compressedSize > 0) + { + if ((int) compressedSize != split -> c_size_) + { + *logofs << "SplitStore: WARNING! Compressed data size is " + << "different than the loaded compressed size.\n" + << logofs_flush; + } + + *logofs << "SplitStore: Ignoring the new size with " + << "loaded compressed size " << split -> c_size_ + << ".\n" << logofs_flush; + } + } + #endif + + return 1; +} + +int SplitStore::receive(DecodeBuffer &decodeBuffer) +{ + if (splits_ -> size() == 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Function receive called with no splits available.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Function receive called with no splits available.\n"; + + HandleAbort(); + } + + if (current_ == splits_ -> end()) + { + start(decodeBuffer); + } + + // + // Check first if split was aborted, else add + // any new data to message being recomposed. + // + + Split *split = *current_; + + unsigned int abort = 0; + + decodeBuffer.decodeBoolValue(abort); + + if (abort == 1) + { + #ifdef TEST + *logofs << "SplitStore: Aborting split for checksum [" + << DumpChecksum(split -> checksum_) << "] position " + << split -> position_ << " with " << (split -> + data_.size() - split -> next_) << " bytes to go " + << "out of " << split -> data_.size() + << ".\n" << logofs_flush; + #endif + + statistics -> addSplitAborted(); + + statistics -> addSplitAbortedBytesOut(split -> r_size_ - split -> next_); + + split -> next_ = split -> r_size_; + + split -> state_ = split_aborted; + } + else + { + // + // Get the size of the packet. + // + + unsigned int count; + + decodeBuffer.decodeValue(count, 32, 10); + + // + // If the split was not already loaded from + // disk, decode the packet and update our + // copy of the data. The encoding side may + // have not received the abort event, yet, + // and may be unaware that the message is + // stored in compressed form at our side. + // + + #ifdef TEST + *logofs << "SplitStore: Receiving split for checksum [" + << DumpChecksum(split -> checksum_) << "] count " + << count << " position " << split -> position_ + << ". Data size is " << split -> data_.size() << " (" + << split -> d_size_ << "/" << split -> c_size_ << "/" + << split -> r_size_ << "), " << split -> r_size_ - + (split -> next_ + count) << " to go.\n" + << logofs_flush; + #endif + + if (split -> next_ + count > (unsigned) split -> r_size_) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Invalid data count " + << count << "provided in the split.\n" + << logofs_flush; + + *logofs << "SplitStore: PANIC! While receiving split for " + << "checksum [" << DumpChecksum(split -> checksum_) + << "] with count " << count << " action [" + << DumpAction(split -> action_) << "] state [" + << DumpState(split -> state_) << "]. Data size is " + << split -> data_.size() << " (" << split -> d_size_ + << "/" << split -> c_size_ << "), " << split -> + data_.size() - (split -> next_ + count) + << " to go.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Invalid data count " + << count << "provided in the split.\n"; + + HandleAbort(); + } + + if (split -> state_ != split_loaded) + { + #ifdef TEST + + if (split -> next_ + count > split -> data_.size()) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Inconsistent split data size " + << split -> data_.size() << " with expected size " + << split -> r_size_ << ".\n" + << logofs_flush; + #endif + + HandleAbort(); + } + + #endif + + memcpy(split -> data_.begin() + split -> next_, + decodeBuffer.decodeMemory(count), count); + } + else + { + #ifdef TEST + *logofs << "SplitStore: WARNING! Data discarded with split " + << "loaded from disk.\n" << logofs_flush; + #endif + + decodeBuffer.decodeMemory(count); + } + + split -> next_ += count; + } + + // + // Is unsplit complete? + // + + if (split -> next_ != split -> r_size_) + { + return 0; + } + + // + // If the persistent cache is enabled, + // we have a valid checksum and the + // split was not originally retrieved + // from disk, save the message on disk. + // + + if (split -> state_ != split_loaded && + split -> state_ != split_aborted) + { + save(split); + } + + // + // Move the split at the head of the + // list to the commits. + // + + remove(split); + + // + // Reset the current position to the + // end of the repository. + // + + current_ = splits_ -> end(); + + #ifdef TEST + *logofs << "SplitStore: Removed split at head of the list. " + << "Resource is " << split -> resource_ << " request " + << (unsigned) split -> store_ -> opcode() << " position " + << split -> position_ << ".\n" << logofs_flush; + #endif + + return 1; +} + +Split *SplitStore::pop() +{ + if (splits_ -> size() == 0) + { + #ifdef TEST + *logofs << "SplitStore: The split store is empty.\n" + << logofs_flush; + #endif + + return NULL; + } + + // + // Move the pointer at the end of the list. + // The next send operation will eventually + // start a new split. + // + + current_ = splits_ -> end(); + + Split *split = *(splits_ -> begin()); + + splits_ -> pop_front(); + + #ifdef TEST + *logofs << "SplitStore: Removed split at the head of the " + << "list with resource " << split -> resource_ + << " request " << (unsigned) split -> store_ -> + opcode() << " position " << split -> position_ + << ".\n" << logofs_flush; + #endif + + splitStorageSize_ -= getNodeSize(split); + + totalSplitSize_--; + + totalSplitStorageSize_ -= getNodeSize(split); + + #ifdef TEST + *logofs << "SplitStore: There are " << splits_ -> size() + << " messages in store [" << resource_ << "] with " + << "storage size " << splitStorageSize_ << ".\n" + << logofs_flush; + + *logofs << "SplitStore: Total messages in stores are " + << totalSplitSize_ << " with total storage size " + << totalSplitStorageSize_ << ".\n" + << logofs_flush; + #endif + + return split; +} + +void SplitStore::remove(Split *split) +{ + #ifdef TEST + *logofs << "SplitStore: Going to remove the split from the list.\n" + << logofs_flush; + #endif + + #ifdef TEST + + if (split != getFirstSplit()) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Trying to remove a split " + << "not at the head of the list.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Trying to remove a split " + << "not at the head of the list.\n"; + + HandleAbort(); + } + + #endif + + // + // Move the split to the commit store. + // + + splits_ -> pop_front(); + + commits_ -> splits_ -> push_back(split); + + splitStorageSize_ -= getNodeSize(split); + + totalSplitSize_--; + + totalSplitStorageSize_ -= getNodeSize(split); + + #ifdef TEST + *logofs << "SplitStore: There are " << splits_ -> size() + << " messages in store [" << resource_ << "] with " + << "storage size " << splitStorageSize_ << ".\n" + << logofs_flush; + + *logofs << "SplitStore: Total messages in stores are " + << totalSplitSize_ << " with total storage size " + << totalSplitStorageSize_ << ".\n" + << logofs_flush; + #endif + + #ifdef TEST + + if (splits_ -> size() == 0) + { + if (splitStorageSize_ != 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Internal error calculating " + << "split data size. It is " << splitStorageSize_ + << " while should be 0.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Internal error calculating " + << "split data size. It is " << splitStorageSize_ + << " while should be 0.\n"; + + HandleAbort(); + } + } + + #endif +} + +const char *SplitStore::name(const T_checksum checksum) +{ + if (checksum == NULL) + { + return NULL; + } + + char *pathName = control -> ImageCachePath; + + if (pathName == NULL) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot determine directory of " + << "NX image files.\n" << logofs_flush; + #endif + + return NULL; + } + + int pathSize = strlen(pathName); + + // + // File name is "[path][/I-c/I-][checksum][\0]", + // where c is the first hex digit of checksum. + // + + int nameSize = pathSize + 7 + MD5_LENGTH * 2 + 1; + + char *fileName = new char[nameSize]; + + if (fileName == NULL) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot allocate space for " + << "NX image file name.\n" << logofs_flush; + #endif + + return NULL; + } + + strcpy(fileName, pathName); + + sprintf(fileName + pathSize, "/I-%1X/I-", + *((unsigned char *) checksum) >> 4); + + for (unsigned int i = 0; i < MD5_LENGTH; i++) + { + sprintf(fileName + pathSize + 7 + (i * 2), "%02X", + ((unsigned char *) checksum)[i]); + } + + return fileName; +} + +int SplitStore::save(Split *split) +{ + // + // Check if saving the message on the + // persistent cache is enabled. + // + + if (split -> save_ == 0) + { + return 0; + } + + T_checksum checksum = split -> checksum_; + + const char *fileName = name(checksum); + + if (fileName == NULL) + { + return 0; + } + + unsigned int splitSize; + + ostream *fileStream = NULL; + + unsigned char *fileHeader = NULL; + + // + // Get the other data from the split. + // + + unsigned char opcode = split -> store_ -> opcode(); + + unsigned char *data = split -> data_.begin(); + + int dataSize = split -> d_size_; + int compressedSize = split -> c_size_; + + #ifdef DEBUG + *logofs << "SplitStore: Going to save split OPCODE#" + << (unsigned int) opcode << " to file '" << fileName + << "' with size " << dataSize << " and compressed size " + << compressedSize << ".\n" << logofs_flush; + #endif + + DisableSignals(); + + // + // Change the mask to make the file only + // readable by the user, then restore the + // old mask. + // + + mode_t fileMode; + + // + // Check if the file already exists. We try to + // load the message when the split is started + // and save it only if it is not found. Still + // the remote side may send the same image mul- + // tiple time and we may not have the time to + // notify the abort. + // + + struct stat fileStat; + + if (stat(fileName, &fileStat) == 0) + { + #ifdef TEST + *logofs << "SplitStore: Image file '" << fileName + << "' already present on disk.\n" + << logofs_flush; + #endif + + goto SplitStoreSaveError; + } + + fileMode = umask(0077); + + fileStream = new ofstream(fileName, ios::out | ios::binary); + + umask(fileMode); + + if (CheckData(fileStream) < 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot open file '" << fileName + << "' for output.\n" << logofs_flush; + #endif + + goto SplitStoreSaveError; + } + + fileHeader = new unsigned char[SPLIT_HEADER_SIZE]; + + if (fileHeader == NULL) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot allocate space for " + << "NX image header.\n" << logofs_flush; + #endif + + goto SplitStoreSaveError; + } + + // + // Leave 3 bytes for future use. Please note + // that, on some CPUs, we can't use PutULONG() + // to write integers that are not aligned to + // the word boundary. + // + + *fileHeader = opcode; + + *(fileHeader + 1) = 0; + *(fileHeader + 2) = 0; + *(fileHeader + 3) = 0; + + PutULONG(dataSize, fileHeader + 4, false); + PutULONG(compressedSize, fileHeader + 8, false); + + splitSize = (compressedSize > 0 ? compressedSize : dataSize); + + if (PutData(fileStream, fileHeader, SPLIT_HEADER_SIZE) < 0 || + PutData(fileStream, data, splitSize) < 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot write to NX " + << "image file '" << fileName << "'.\n" + << logofs_flush; + #endif + + goto SplitStoreSaveError; + } + + // + // Check if all the data was written on the + // disk and, if not, remove the faulty copy. + // + + FlushData(fileStream); + + if (CheckData(fileStream) < 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Failed to write NX " + << "image file '" << fileName << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Failed to write NX " + << "image file '" << fileName << "'.\n"; + + goto SplitStoreSaveError; + } + + #ifdef TEST + *logofs << "SplitStore: Saved split to file '" << fileName + << "' with data size " << dataSize << " and " + << "compressed data size " << compressedSize + << ".\n" << logofs_flush; + #endif + + delete fileStream; + + delete [] fileName; + delete [] fileHeader; + + EnableSignals(); + + // + // Update the timestamp as the operation + // may have taken some time. + // + + getNewTimestamp(); + + return 1; + +SplitStoreSaveError: + + delete fileStream; + + if (fileName != NULL) + { + unlink(fileName); + } + + delete [] fileName; + delete [] fileHeader; + + EnableSignals(); + + return -1; +} + +int SplitStore::find(Split *split) +{ + const char *fileName = name(split -> checksum_); + + if (fileName == NULL) + { + return 0; + } + + #ifdef DEBUG + *logofs << "SplitStore: Going to find split OPCODE#" + << (unsigned) split -> store_ -> opcode() + << " in file '" << fileName << "'.\n" + << logofs_flush; + #endif + + // + // Check if the file exists and, at the + // same time, update the modification + // time to prevent its deletion. + // + + if (utime(fileName, NULL) == 0) + { + #ifdef TEST + *logofs << "SplitStore: Found split OPCODE#" + << (unsigned) split -> store_ -> opcode() + << " in file '" << fileName << "'.\n" + << logofs_flush; + #endif + + delete [] fileName; + + return 1; + } + + #ifdef TEST + *logofs << "SplitStore: WARNING! Can't find split " + << "OPCODE#" << (unsigned) split -> store_ -> + opcode() << " in file '" << fileName + << "'.\n" << logofs_flush; + #endif + + delete [] fileName; + + return 0; +} + +int SplitStore::load(Split *split) +{ + // + // Check if loading the image is enabled. + // + + if (split -> load_ == 0) + { + return 0; + } + + const char *fileName = name(split -> checksum_); + + if (fileName == NULL) + { + return 0; + } + + unsigned char fileOpcode; + + int fileSize; + int fileCSize; + + istream *fileStream = NULL; + + unsigned char *fileHeader = NULL; + + DisableSignals(); + + #ifdef DEBUG + *logofs << "SplitStore: Going to load split OPCODE#" + << (unsigned int) split -> store_ -> opcode() + << " from file '" << fileName << "'.\n" + << logofs_flush; + #endif + + fileStream = new ifstream(fileName, ios::in | ios::binary); + + if (CheckData(fileStream) < 0) + { + #ifdef TEST + *logofs << "SplitStore: WARNING! Can't open image file '" + << fileName << "' on disk.\n" << logofs_flush; + #endif + + goto SplitStoreLoadError; + } + + fileHeader = new unsigned char[SPLIT_HEADER_SIZE]; + + if (fileHeader == NULL) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot allocate space for " + << "NX image header.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot allocate space for " + << "NX image header.\n"; + + goto SplitStoreLoadError; + } + + if (GetData(fileStream, fileHeader, SPLIT_HEADER_SIZE) < 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot read header from " + << "NX image file '" << fileName << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Cannot read header from " + << "NX image file '" << fileName << "'.\n"; + + goto SplitStoreLoadError; + } + + fileOpcode = *fileHeader; + + fileSize = GetULONG(fileHeader + 4, false); + fileCSize = GetULONG(fileHeader + 8, false); + + // + // Don't complain if we find that data was saved + // in compressed form even if we were not aware + // of the compressed data size. The remote side + // compresses the data only at the time it starts + // the transferral of the split. We replace our + // copy of the data with whatever we find on the + // disk. + // + + if (fileOpcode != split -> store_ -> opcode() || + fileSize != split -> d_size_ || + fileSize > control -> MaximumRequestSize || + fileCSize > control -> MaximumRequestSize) + + { + #ifdef TEST + *logofs << "SplitStore: PANIC! Corrupted image file '" << fileName + << "'. Expected " << (unsigned int) split -> store_ -> opcode() + << "/" << split -> d_size_ << "/" << split -> c_size_ << " found " + << (unsigned int) fileOpcode << "/" << fileSize << "/" + << fileCSize << ".\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Corrupted image file '" << fileName + << "'. Expected " << (unsigned int) split -> store_ -> opcode() + << "/" << split -> d_size_ << "/" << split -> c_size_ << " found " + << (unsigned int) fileOpcode << "/" << fileSize << "/" + << fileCSize << ".\n"; + + goto SplitStoreLoadError; + } + + // + // Update the data size with the size + // we got from the disk record. + // + + split -> d_size_ = fileSize; + split -> c_size_ = fileCSize; + + unsigned int splitSize; + + if (fileCSize > 0) + { + splitSize = fileCSize; + } + else + { + splitSize = fileSize; + } + + // + // Allocate a new buffer if we didn't + // do that already or if the size is + // different. + // + + if (split -> data_.size() != splitSize) + { + split -> data_.clear(); + + split -> data_.resize(splitSize); + } + + if (GetData(fileStream, split -> data_.begin(), splitSize) < 0) + { + #ifdef PANIC + *logofs << "SplitStore: PANIC! Cannot read data from " + << "NX image file '" << fileName << "'.\n" + << logofs_flush; + #endif + + cerr << "Warning" << ": Cannot read data from " + << "NX image file '" << fileName << "'.\n"; + + goto SplitStoreLoadError; + } + + delete fileStream; + + delete [] fileHeader; + delete [] fileName; + + EnableSignals(); + + // + // Update the timestamp as the operation + // may have taken some time. + // + + getNewTimestamp(); + + return 1; + +SplitStoreLoadError: + + delete fileStream; + + unlink(fileName); + + delete [] fileName; + delete [] fileHeader; + + EnableSignals(); + + return -1; +} + +Split *CommitStore::pop() +{ + if (splits_ -> size() == 0) + { + #ifdef TEST + *logofs << "CommitStore: The commit store is empty.\n" + << logofs_flush; + #endif + + return NULL; + } + + Split *split = *(splits_ -> begin()); + + splits_ -> pop_front(); + + #ifdef TEST + *logofs << "CommitStore: Removed commit split at the head " + << "of the list with resource " << split -> resource_ + << " request " << (unsigned) split -> store_ -> + opcode() << " position " << split -> position_ + << ".\n" << logofs_flush; + #endif + + return split; +} + +int CommitStore::expand(Split *split, unsigned char *buffer, const int size) +{ + #ifdef TEST + *logofs << "CommitStore: Expanding split data with " + << size << " bytes to write.\n" + << logofs_flush; + #endif + + #ifdef TEST + + if (size < split -> i_size_ + split -> d_size_) + { + #ifdef PANIC + *logofs << "CommitStore: PANIC! Wrong size of the provided " + << "buffer. It should be " << split -> i_size_ + + split -> d_size_ << " instead of " << size + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Wrong size of the provided " + << "buffer. It should be " << split -> i_size_ + + split -> d_size_ << " instead of " << size + << ".\n"; + + HandleAbort(); + } + + #endif + + #ifdef DEBUG + *logofs << "CommitStore: Copying " << split -> i_size_ + << " bytes of identity.\n" << logofs_flush; + #endif + + memcpy(buffer, split -> identity_.begin(), split -> i_size_); + + // + // Copy data, if any, to the buffer. + // + + if (size > split -> i_size_) + { + // + // Check if message has been stored + // in compressed format. + // + + if (split -> c_size_ == 0) + { + #ifdef DEBUG + *logofs << "CommitStore: Copying " << split -> d_size_ + << " bytes of plain data.\n" << logofs_flush; + #endif + + memcpy(buffer + split -> i_size_, split -> data_.begin(), split -> d_size_); + } + else + { + #ifdef DEBUG + *logofs << "CommitStore: Decompressing " << split -> c_size_ + << " bytes and copying " << split -> d_size_ + << " bytes of data.\n" << logofs_flush; + #endif + + if (compressor_ -> + decompressBuffer(buffer + split -> i_size_, + split -> d_size_, split -> data_.begin(), + split -> c_size_) < 0) + { + #ifdef PANIC + *logofs << "CommitStore: PANIC! Split data decompression failed.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Split data decompression failed.\n"; + + return -1; + } + } + } + + return 1; +} + +int CommitStore::update(Split *split) +{ + if (split -> action_ != IS_ADDED) + { + return 0; + } + + // + // We don't need the identity data at + // the encoding side. + // + + if (split -> identity_.size() == 0) + { + #ifdef TEST + *logofs << "SplitStore: Going to update the size " + << "for object at position " << split -> position_ + << " with data size " << split -> d_size_ + << " and compressed data size " << split -> + c_size_ << ".\n" << logofs_flush; + #endif + + split -> store_ -> updateData(split -> position_, split -> d_size_, + split -> c_size_); + } + else + { + #ifdef TEST + *logofs << "SplitStore: Going to update data and size " + << "for object at position " << split -> position_ + << " with data size " << split -> d_size_ + << " and compressed data size " << split -> + c_size_ << ".\n" << logofs_flush; + #endif + + split -> store_ -> updateData(split -> position_, split -> data_.begin(), + split -> d_size_, split -> c_size_); + } + + // + // Unlock message so that we can remove + // or save it on disk at shutdown. + // + + if (split -> action_ == IS_ADDED) + { + split -> store_ -> unlock(split -> position_); + + #ifdef TEST + + validate(split); + + #endif + } + + return 1; +} + +int CommitStore::validate(Split *split) +{ + MessageStore *store = split -> store_; + + int p, n, s; + + s = store -> cacheSlots; + + for (p = 0, n = 0; p < s; p++) + { + if (store -> getLocks(p) == 1) + { + n++; + } + else if (store -> getLocks(p) != 0) + { + #ifdef PANIC + *logofs << "CommitStore: PANIC! Repository for OPCODE#" + << (unsigned int) store -> opcode() << " has " + << store -> getLocks(p) << " locks for message " + << "at position " << p << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Repository for OPCODE#" + << (unsigned int) store -> opcode() << " has " + << store -> getLocks(p) << " locks for message " + << "at position " << p << ".\n"; + + HandleAbort(); + } + } + + #ifdef TEST + *logofs << "CommitStore: Repository for OPCODE#" + << (unsigned int) store -> opcode() + << " has " << n << " locked messages.\n" + << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/Split.h b/nxcomp/src/Split.h new file mode 100644 index 000000000..ee5eae7fe --- /dev/null +++ b/nxcomp/src/Split.h @@ -0,0 +1,543 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Split_H +#define Split_H + +#include "Types.h" +#include "Timestamp.h" +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to know how many splits +// are allocated and deallocated. +// + +#undef REFERENCES + +// +// Size of header of messages saved on +// disk. +// + +#define SPLIT_HEADER_SIZE 12 + +// +// This class is used to divide big messages +// in smaller chunks and send them at idle +// time. +// + +class EncodeBuffer; +class DecodeBuffer; + +class SplitStore; +class CommitStore; + +// +// Preferred message streaming policy. +// + +typedef enum +{ + split_none = -1, + split_async = 1, + split_sync + +} T_split_mode; + +// +// Current state of the split. Used to +// implement the state machine. +// + +typedef enum +{ + split_undefined = -1, + split_added, + split_missed, + split_loaded, + split_aborted, + split_notified + +} T_split_state; + +class Split +{ + friend class SplitStore; + friend class CommitStore; + + public: + + Split(); + + ~Split(); + + // + // Note that, differently from the message + // store, the split store doesn't account + // for the data offset when dealing with + // the data. This means that both the size_ + // and c_size members represent the actual + // size of the data part. + // + + void compressedSize(int size) + { + c_size_ = size; + + store_ -> validateSize(d_size_, c_size_); + } + + int compressedSize() + { + return c_size_; + } + + int plainSize() + { + return i_size_ + d_size_; + } + + T_checksum getChecksum() + { + return checksum_; + } + + MessageStore *getStore() + { + return store_; + } + + T_split_state getState() + { + return state_; + } + + T_store_action getAction() + { + return action_; + } + + // + // We may need to find the resource + // associated to the split message + // because old protocol version use + // a single store for all splits. + // + + int getResource() + { + return resource_; + } + + int getRequest() + { + return store_ -> opcode(); + } + + int getPosition() + { + return position_; + } + + T_split_mode getMode() + { + return mode_; + } + + void setPolicy(int load, int save) + { + load_ = load; + save_ = save; + } + + void setState(T_split_state state) + { + state_ = state; + } + + private: + + // + // The agent's resource which is splitting + // the message. + // + + int resource_; + + // + // Where to find the message in the message + // store or the X sequence number of the + // original request, in recent versions. + // + + int position_; + + // + // Which store is involved. + // + + MessageStore *store_; + + // + // Identity size of the message. + // + + int i_size_; + + // + // This is the uncompressed data size of the + // original message. + // + + int d_size_; + + // + // This is the size of the compressed data, + // if the data is stored in this form. + // + + int c_size_; + + // + // Size of the data buffer, as known by the + // encoding side. This field is only used at + // the decoding side. The remote size can be + // different from the actual data size, if + // the encoding side did not confirm that it + // received the abort split event. + // + + int r_size_; + + // + // Position in the data buffer that will be + // the target of the next send or receive + // operation while streaming the message. + // + + int next_; + + // + // Load or save the split to disk. + // + + int load_; + int save_; + + // + // Checksum of the original message. + // + + T_checksum checksum_; + + // + // Was this split confirmed or aborted? + // + + T_split_state state_; + + // + // What's the policy for sending this split? + // + + T_split_mode mode_; + + // + // Operation that had been performed on the + // store at the time the split was added. + // + + T_store_action action_; + + // + // Container for the identity and data part + // of the X message. + // + + T_data identity_; + T_data data_; + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +class SplitStore +{ + public: + + SplitStore(StaticCompressor *compressor, CommitStore *commits, int resource); + + ~SplitStore(); + + Split *getFirstSplit() const + { + if (splits_ -> size() > 0) + { + return (*(splits_ -> begin())); + } + + return NULL; + } + + Split *getLastSplit() const + { + if (splits_ -> size() > 0) + { + return (*(--(splits_ -> end()))); + } + + return NULL; + } + + int getNodeSize(const Split *split) const + { + // + // Take in account 64 bytes of overhead + // for each node. + // + + return (sizeof(class Split) + 64 + + split -> i_size_ + split -> d_size_); + } + + int getStorageSize() + { + return splitStorageSize_; + } + + static int getTotalSize() + { + return totalSplitSize_; + } + + static int getTotalStorageSize() + { + return totalSplitStorageSize_; + } + + int getResource() + { + return resource_; + } + + int getSize() + { + return splits_ -> size(); + } + + T_splits *getSplits() + { + return splits_; + } + + // + // Used, respectively, at the encoding + // and decoding side. + // + + Split *add(MessageStore *store, int resource, T_split_mode mode, + int position, T_store_action action, T_checksum checksum, + const unsigned char *buffer, const int size); + + Split *add(MessageStore *store, int resource, int position, + T_store_action action, T_checksum checksum, + unsigned char *buffer, const int size); + + // + // Handle the streaming of the message data. + // + + int send(EncodeBuffer &encodeBuffer, int packetSize); + + int receive(DecodeBuffer &decodeBuffer); + + // + // Remove the top element of the split store + // and update the storage size. + // + + void remove(Split *split); + + // + // Load the message from disk and replace the + // message in the store with the new copy. + // + + int load(Split *split); + + // + // Save the data to disk after the message has + // been recomposed at the local side. + // + + int save(Split *split); + + // + // Find the message on disk and update the last + // modification time. This is currently unused. + // + + int find(Split *split); + + // + // Remove the element on top of the queue and + // discard any split data that still needs to + // be transferred. + // + + Split *pop(); + + // + // Dump the content of the store. + // + + void dump(); + + protected: + + // + // Repository where to add the splits. + // + + T_splits *splits_; + + // + // Compress and decompress the data payload. + // + + StaticCompressor *compressor_; + + private: + + int start(EncodeBuffer &encodeBuffer); + + int start(DecodeBuffer &decodeBuffer); + + void push(Split *split); + + // + // Determine the name of the file object based + // on the checksum. + // + + const char *name(const T_checksum checksum); + + // + // The number of elements and data bytes + // in the repository. + // + + int splitStorageSize_; + + static int totalSplitSize_; + static int totalSplitStorageSize_; + + // + // Current element being transferred. + // + + T_splits::iterator current_; + + // + // Repository where to move the splits + // after they are completely recomposed. + // + + CommitStore *commits_; + + // + // Index in the client store or none, + // if this is a commit store. + // + + int resource_; + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +class CommitStore : public SplitStore +{ + // + // This is just a split store. + // + + public: + + CommitStore(StaticCompressor *compressor) + + : SplitStore(compressor, NULL, nothing) + { + } + + // + // Move identity and data of the split to the + // provided buffer, uncompressing the message, + // if needed. + // + + int expand(Split *split, unsigned char *buffer, const int size); + + // + // We recomposed the data part. If the message + // was originally added to the message store, + // replace the data and/or update the size. + // + + int update(Split *split); + + // + // Remove the split from the commit queue. + // + + Split *pop(); + + // + // This is just used for debug. It checks + // if any message in the message store has + // an invalid number of locks. + // + + int validate(Split *split); +}; + +#endif /* Split_H */ diff --git a/nxcomp/src/StaticCompressor.cpp b/nxcomp/src/StaticCompressor.cpp new file mode 100644 index 000000000..b47193354 --- /dev/null +++ b/nxcomp/src/StaticCompressor.cpp @@ -0,0 +1,432 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Z.h" +#include "Misc.h" +#include "Control.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +#include "StaticCompressor.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +StaticCompressor::StaticCompressor(int compressionLevel, + int compressionThreshold) +{ + buffer_ = NULL; + bufferSize_ = 0; + + compressionStream_.zalloc = (alloc_func) 0; + compressionStream_.zfree = (free_func) 0; + compressionStream_.opaque = (voidpf) 0; + + decompressionStream_.zalloc = (alloc_func) 0; + decompressionStream_.zfree = (free_func) 0; + decompressionStream_.opaque = (void *) 0; + + decompressionStream_.next_in = (Bytef *) 0; + decompressionStream_.avail_in = 0; + + #ifdef TEST + *logofs << "StaticCompressor: Compression level is " + << compressionLevel << ".\n" << logofs_flush; + #endif + + int result = deflateInit2(&compressionStream_, compressionLevel, Z_DEFLATED, + 15, 9, Z_DEFAULT_STRATEGY); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Cannot initialize the " + << "compression stream. Error is '" << zError(result) + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot initialize the compression " + << "stream. Error is '" << zError(result) << "'.\n"; + + HandleAbort(); + } + + result = inflateInit2(&decompressionStream_, 15); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Cannot initialize the " + << "decompression stream. Error is '" << zError(result) + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot initialize the decompression " + << "stream. Error is '" << zError(result) << "'.\n"; + + HandleAbort(); + } + + #ifdef TEST + *logofs << "StaticCompressor: Compression threshold is " + << compressionThreshold << ".\n" << logofs_flush; + #endif + + threshold_ = compressionThreshold; +} + +StaticCompressor::~StaticCompressor() +{ + int result = deflateEnd(&compressionStream_); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Cannot deinitialize the " + << "compression stream. Error is '" << zError(result) + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot deinitialize the compression " + << "stream. Error is '" << zError(result) << "'.\n"; + } + + result = inflateEnd(&decompressionStream_); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Cannot deinitialize the " + << "decompression stream. Error is '" << zError(result) + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot deinitialize the decompression " + << "stream. Error is '" << zError(result) << "'.\n"; + } + + delete [] buffer_; +} + +// +// This function compresses and encodes the compressed +// buffer. It returns a pointer to the internal buffer +// where data was compressed. +// + +int StaticCompressor::compressBuffer(const unsigned char *plainBuffer, + const unsigned int plainSize, + unsigned char *&compressedBuffer, + unsigned int &compressedSize, + EncodeBuffer &encodeBuffer) +{ + if (control -> LocalDataCompression == 0 || + compressBuffer(plainBuffer, plainSize, + compressedBuffer, compressedSize) <= 0) + { + encodeBuffer.encodeBoolValue(0); + + encodeBuffer.encodeMemory(plainBuffer, plainSize); + + return 0; + } + else + { + encodeBuffer.encodeBoolValue(1); + + encodeBuffer.encodeValue(compressedSize, 32, 14); + encodeBuffer.encodeValue(plainSize, 32, 14); + + encodeBuffer.encodeMemory(compressedBuffer, compressedSize); + + return 1; + } +} + +// +// This function compresses data into a dynamically +// allocated buffer and returns a pointer to it, so +// application must copy data before the next call. +// + +int StaticCompressor::compressBuffer(const unsigned char *plainBuffer, + const unsigned int plainSize, + unsigned char *&compressedBuffer, + unsigned int &compressedSize) +{ + #ifdef DEBUG + *logofs << "StaticCompressor: Called for buffer at " + << (void *) plainBuffer << ".\n" + << logofs_flush; + #endif + + compressedSize = plainSize; + + if (plainSize < (unsigned int) threshold_) + { + #ifdef TEST + *logofs << "StaticCompressor: Leaving buffer unchanged. " + << "Plain size is " << plainSize << " with threshold " + << (unsigned int) threshold_ << ".\n" << logofs_flush; + #endif + + return 0; + } + + // + // Determine the size of the temporary + // buffer. + // + + unsigned int newSize = plainSize + (plainSize / 1000) + 12; + + // + // Allocate a new buffer if it grows + // beyond 64K. + // + + if (buffer_ == NULL || (bufferSize_ > 65536 && + newSize < bufferSize_ / 2) || newSize > bufferSize_) + { + delete [] buffer_; + + buffer_ = new unsigned char[newSize]; + + if (buffer_ == NULL) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Can't allocate compression " + << "buffer of " << newSize << " bytes. Error is " << EGET() + << " ' " << ESTR() << "'.\n" << logofs_flush; + #endif + + cerr << "Warning" << ": Can't allocate compression buffer of " + << newSize << " bytes. Error is " << EGET() + << " '" << ESTR() << "'.\n"; + + bufferSize_ = 0; + + return 0; + } + + bufferSize_ = newSize; + } + + unsigned int resultingSize = newSize; + + int result = ZCompress(&compressionStream_, buffer_, &resultingSize, + plainBuffer, plainSize); + + if (result == Z_OK) + { + if (resultingSize > newSize) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Overflow in compression " + << "buffer size. " << "Expected size was " << newSize + << " while it is " << resultingSize << ".\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Overflow in compress buffer size. " + << "Expected size was " << newSize << " while it is " + << resultingSize << ".\n"; + + return -1; + } + else if (resultingSize >= plainSize) + { + #ifdef TEST + *logofs << "StaticCompressor: Leaving buffer unchanged. " + << "Plain size is " << plainSize << " compressed " + << "size is " << resultingSize << ".\n" + << logofs_flush; + #endif + + return 0; + } + + compressedBuffer = buffer_; + compressedSize = resultingSize; + + #ifdef TEST + *logofs << "StaticCompressor: Compressed buffer from " + << plainSize << " to " << resultingSize + << " bytes.\n" << logofs_flush; + #endif + + return 1; + } + + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Failed compression of buffer. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failed compression of buffer. " + << "Error is '" << zError(result) << "'.\n"; + + return -1; +} + +int StaticCompressor::decompressBuffer(unsigned char *plainBuffer, + unsigned int plainSize, + const unsigned char *&compressedBuffer, + unsigned int &compressedSize, + DecodeBuffer &decodeBuffer) +{ + #ifdef DEBUG + *logofs << "StaticCompressor: Called for buffer at " + << (void *) plainBuffer << ".\n" + << logofs_flush; + #endif + + unsigned int value; + + decodeBuffer.decodeBoolValue(value); + + if (value == 0) + { + memcpy(plainBuffer, + decodeBuffer.decodeMemory(plainSize), + plainSize); + + return 0; + } + + unsigned int checkSize = plainSize; + + decodeBuffer.decodeValue(value, 32, 14); + compressedSize = value; + + decodeBuffer.decodeValue(value, 32, 14); + checkSize = value; + + // + // If caller needs the original compressed + // data it must copy this to its own buffer + // before using any further decode function. + // + + compressedBuffer = decodeBuffer.decodeMemory(compressedSize); + + int result = ZDecompress(&decompressionStream_, plainBuffer, &checkSize, + compressedBuffer, compressedSize); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Failure decompressing buffer. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Failure decompressing buffer. " + << "Error is '" << zError(result) << "'.\n"; + + return -1; + } + else if (plainSize != checkSize) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Expected decompressed size was " + << plainSize << " while it is " << checkSize + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Expected decompressed size was " + << plainSize << " while it is " << checkSize + << ".\n"; + + return -1; + } + + return 1; +} + +// +// This is used to uncompress on-the-fly +// messages whose data has been stored +// in compressed format. +// + +int StaticCompressor::decompressBuffer(unsigned char *plainBuffer, + const unsigned int plainSize, + const unsigned char *compressedBuffer, + const unsigned int compressedSize) +{ + #ifdef TEST + *logofs << "StaticCompressor: Called for buffer at " + << (void *) plainBuffer << ".\n" + << logofs_flush; + #endif + + unsigned int checkSize = plainSize; + + int result = ZDecompress(&decompressionStream_, plainBuffer, &checkSize, + compressedBuffer, compressedSize); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Failure decompressing buffer. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + return -1; + } + + if (plainSize != checkSize) + { + #ifdef PANIC + *logofs << "StaticCompressor: PANIC! Expected decompressed size was " + << plainSize << " while it is " << checkSize + << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Expected decompressed size was " + << plainSize << " while it is " << checkSize + << ".\n"; + + return -1; + } + + #ifdef TEST + *logofs << "StaticCompressor: Decompressed buffer from " + << compressedSize << " to " << plainSize + << " bytes.\n" << logofs_flush; + #endif + + return 1; +} diff --git a/nxcomp/src/StaticCompressor.h b/nxcomp/src/StaticCompressor.h new file mode 100644 index 000000000..e0b81a527 --- /dev/null +++ b/nxcomp/src/StaticCompressor.h @@ -0,0 +1,80 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef StaticCompressor_H +#define StaticCompressor_H + +#include "Z.h" + +class EncodeBuffer; +class DecodeBuffer; + +class StaticCompressor +{ + public: + + StaticCompressor(int compressionLevel, int compressionThreshold); + + ~StaticCompressor(); + + int compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, + unsigned char *&compressedBuffer, unsigned int &compressedSize, + EncodeBuffer &encodeBuffer); + + int compressBuffer(const unsigned char *plainBuffer, const unsigned int plainSize, + unsigned char *&compressedBuffer, unsigned int &compressedSize); + + int decompressBuffer(unsigned char *plainBuffer, unsigned int plainSize, + const unsigned char *&compressedBuffer, unsigned int &compressedSize, + DecodeBuffer &decodeBuffer); + + int decompressBuffer(unsigned char *plainBuffer, const unsigned int plainSize, + const unsigned char *compressedBuffer, const unsigned compressedSize); + + static int isCompressionLevel(int compressionLevel) + { + return (compressionLevel == Z_DEFAULT_COMPRESSION || + (compressionLevel >= Z_NO_COMPRESSION && + compressionLevel <= Z_BEST_COMPRESSION)); + } + + int fullReset() + { + return (deflateReset(&compressionStream_) == Z_OK && + inflateReset(&decompressionStream_) == Z_OK); + } + + private: + + z_stream compressionStream_; + z_stream decompressionStream_; + + unsigned char *buffer_; + unsigned int bufferSize_; + + int threshold_; +}; + +#endif diff --git a/nxcomp/src/Statistics.cpp b/nxcomp/src/Statistics.cpp new file mode 100644 index 000000000..ab8fd74dc --- /dev/null +++ b/nxcomp/src/Statistics.cpp @@ -0,0 +1,2007 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include + +#include "Statistics.h" + +#include "Control.h" + +#include "Proxy.h" + +#include "ClientStore.h" +#include "ServerStore.h" + +// +// Length of temporary buffer +// used to format output. +// + +#define FORMAT_LENGTH 1024 + +// +// Log level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Note that when presenting statistics we invert the +// correct semantics of X client and server entities. +// This is questionable, but matches the user's pers- +// pective of running remote X applications on its +// local client. +// + +Statistics::Statistics(Proxy *proxy) : proxy_(proxy) +{ + transportPartial_.idleTime_ = 0; + transportPartial_.readTime_ = 0; + transportPartial_.writeTime_ = 0; + transportPartial_.proxyBytesIn_ = 0; + transportPartial_.proxyBytesOut_ = 0; + transportPartial_.proxyFramesIn_ = 0; + transportPartial_.proxyFramesOut_ = 0; + transportPartial_.proxyWritesOut_ = 0; + transportPartial_.compressedBytesIn_ = 0; + transportPartial_.compressedBytesOut_ = 0; + transportPartial_.decompressedBytesIn_ = 0; + transportPartial_.decompressedBytesOut_ = 0; + transportPartial_.framingBitsOut_ = 0; + + transportTotal_.idleTime_ = 0; + transportTotal_.readTime_ = 0; + transportTotal_.writeTime_ = 0; + transportTotal_.proxyBytesIn_ = 0; + transportTotal_.proxyBytesOut_ = 0; + transportTotal_.proxyFramesIn_ = 0; + transportTotal_.proxyFramesOut_ = 0; + transportTotal_.proxyWritesOut_ = 0; + transportTotal_.compressedBytesIn_ = 0; + transportTotal_.compressedBytesOut_ = 0; + transportTotal_.decompressedBytesIn_ = 0; + transportTotal_.decompressedBytesOut_ = 0; + transportTotal_.framingBitsOut_ = 0; + + for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) + { + protocolPartial_.requestCached_[i] = 0; + protocolPartial_.requestReplied_[i] = 0; + protocolPartial_.requestCount_[i] = 0; + protocolPartial_.requestBitsIn_[i] = 0; + protocolPartial_.requestBitsOut_[i] = 0; + + protocolPartial_.renderRequestCached_[i] = 0; + protocolPartial_.renderRequestCount_[i] = 0; + protocolPartial_.renderRequestBitsIn_[i] = 0; + protocolPartial_.renderRequestBitsOut_[i] = 0; + + protocolPartial_.replyCached_[i] = 0; + protocolPartial_.replyCount_[i] = 0; + protocolPartial_.replyBitsIn_[i] = 0; + protocolPartial_.replyBitsOut_[i] = 0; + + protocolPartial_.eventCached_[i] = 0; + protocolPartial_.eventCount_[i] = 0; + protocolPartial_.eventBitsIn_[i] = 0; + protocolPartial_.eventBitsOut_[i] = 0; + + protocolTotal_.requestCached_[i] = 0; + protocolTotal_.requestReplied_[i] = 0; + protocolTotal_.requestCount_[i] = 0; + protocolTotal_.requestBitsIn_[i] = 0; + protocolTotal_.requestBitsOut_[i] = 0; + + protocolTotal_.renderRequestCached_[i] = 0; + protocolTotal_.renderRequestCount_[i] = 0; + protocolTotal_.renderRequestBitsIn_[i] = 0; + protocolTotal_.renderRequestBitsOut_[i] = 0; + + protocolTotal_.replyCached_[i] = 0; + protocolTotal_.replyCount_[i] = 0; + protocolTotal_.replyBitsIn_[i] = 0; + protocolTotal_.replyBitsOut_[i] = 0; + + protocolTotal_.eventCached_[i] = 0; + protocolTotal_.eventCount_[i] = 0; + protocolTotal_.eventBitsIn_[i] = 0; + protocolTotal_.eventBitsOut_[i] = 0; + } + + protocolPartial_.cupsCount_ = 0; + protocolPartial_.cupsBitsIn_ = 0; + protocolPartial_.cupsBitsOut_ = 0; + + protocolPartial_.smbCount_ = 0; + protocolPartial_.smbBitsIn_ = 0; + protocolPartial_.smbBitsOut_ = 0; + + protocolPartial_.mediaCount_ = 0; + protocolPartial_.mediaBitsIn_ = 0; + protocolPartial_.mediaBitsOut_ = 0; + + protocolPartial_.httpCount_ = 0; + protocolPartial_.httpBitsIn_ = 0; + protocolPartial_.httpBitsOut_ = 0; + + protocolPartial_.fontCount_ = 0; + protocolPartial_.fontBitsIn_ = 0; + protocolPartial_.fontBitsOut_ = 0; + + protocolPartial_.slaveCount_ = 0; + protocolPartial_.slaveBitsIn_ = 0; + protocolPartial_.slaveBitsOut_ = 0; + + protocolTotal_.cupsCount_ = 0; + protocolTotal_.cupsBitsIn_ = 0; + protocolTotal_.cupsBitsOut_ = 0; + + protocolTotal_.smbCount_ = 0; + protocolTotal_.smbBitsIn_ = 0; + protocolTotal_.smbBitsOut_ = 0; + + protocolTotal_.mediaCount_ = 0; + protocolTotal_.mediaBitsIn_ = 0; + protocolTotal_.mediaBitsOut_ = 0; + + protocolTotal_.httpCount_ = 0; + protocolTotal_.httpBitsIn_ = 0; + protocolTotal_.httpBitsOut_ = 0; + + protocolTotal_.fontCount_ = 0; + protocolTotal_.fontBitsIn_ = 0; + protocolTotal_.fontBitsOut_ = 0; + + protocolTotal_.slaveCount_ = 0; + protocolTotal_.slaveBitsIn_ = 0; + protocolTotal_.slaveBitsOut_ = 0; + + packedPartial_.packedBytesIn_ = 0; + packedPartial_.packedBytesOut_ = 0; + + packedTotal_.packedBytesIn_ = 0; + packedTotal_.packedBytesOut_ = 0; + + splitPartial_.splitCount_ = 0; + splitPartial_.splitAborted_ = 0; + splitPartial_.splitAbortedBytesOut_ = 0; + + splitTotal_.splitCount_ = 0; + splitTotal_.splitAborted_ = 0; + splitTotal_.splitAbortedBytesOut_ = 0; + + overallPartial_.overallBytesIn_ = 0; + overallPartial_.overallBytesOut_ = 0; + + overallTotal_.overallBytesIn_ = 0; + overallTotal_.overallBytesOut_ = 0; + + proxyData_.protocolCount_ = 0; + proxyData_.controlCount_ = 0; + proxyData_.splitCount_ = 0; + proxyData_.dataCount_ = 0; + + proxyData_.streamRatio_ = 1; + + startShortFrameTs_ = getTimestamp(); + startLongFrameTs_ = getTimestamp(); + startFrameTs_ = getTimestamp(); + + bytesInShortFrame_ = 0; + bytesInLongFrame_ = 0; + + bitrateInShortFrame_ = 0; + bitrateInLongFrame_ = 0; + + topBitrate_ = 0; + + congestionInFrame_ = 0; +} + +Statistics::~Statistics() +{ +} + +int Statistics::resetPartialStats() +{ + transportPartial_.idleTime_ = 0; + transportPartial_.readTime_ = 0; + transportPartial_.writeTime_ = 0; + transportPartial_.proxyBytesIn_ = 0; + transportPartial_.proxyBytesOut_ = 0; + transportPartial_.proxyFramesIn_ = 0; + transportPartial_.proxyFramesOut_ = 0; + transportPartial_.proxyWritesOut_ = 0; + transportPartial_.compressedBytesIn_ = 0; + transportPartial_.compressedBytesOut_ = 0; + transportPartial_.decompressedBytesIn_ = 0; + transportPartial_.decompressedBytesOut_ = 0; + transportPartial_.framingBitsOut_ = 0; + + for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) + { + protocolPartial_.requestCached_[i] = 0; + protocolPartial_.requestReplied_[i] = 0; + protocolPartial_.requestCount_[i] = 0; + protocolPartial_.requestBitsIn_[i] = 0; + protocolPartial_.requestBitsOut_[i] = 0; + + protocolPartial_.renderRequestCached_[i] = 0; + protocolPartial_.renderRequestCount_[i] = 0; + protocolPartial_.renderRequestBitsIn_[i] = 0; + protocolPartial_.renderRequestBitsOut_[i] = 0; + + protocolPartial_.replyCached_[i] = 0; + protocolPartial_.replyCount_[i] = 0; + protocolPartial_.replyBitsIn_[i] = 0; + protocolPartial_.replyBitsOut_[i] = 0; + + protocolPartial_.eventCached_[i] = 0; + protocolPartial_.eventCount_[i] = 0; + protocolPartial_.eventBitsIn_[i] = 0; + protocolPartial_.eventBitsOut_[i] = 0; + } + + protocolPartial_.cupsCount_ = 0; + protocolPartial_.cupsBitsIn_ = 0; + protocolPartial_.cupsBitsOut_ = 0; + + protocolPartial_.smbCount_ = 0; + protocolPartial_.smbBitsIn_ = 0; + protocolPartial_.smbBitsOut_ = 0; + + protocolPartial_.mediaCount_ = 0; + protocolPartial_.mediaBitsIn_ = 0; + protocolPartial_.mediaBitsOut_ = 0; + + protocolPartial_.httpCount_ = 0; + protocolPartial_.httpBitsIn_ = 0; + protocolPartial_.httpBitsOut_ = 0; + + protocolPartial_.fontCount_ = 0; + protocolPartial_.fontBitsIn_ = 0; + protocolPartial_.fontBitsOut_ = 0; + + protocolPartial_.slaveCount_ = 0; + protocolPartial_.slaveBitsIn_ = 0; + protocolPartial_.slaveBitsOut_ = 0; + + packedPartial_.packedBytesIn_ = 0; + packedPartial_.packedBytesOut_ = 0; + + splitPartial_.splitCount_ = 0; + splitPartial_.splitAborted_ = 0; + splitPartial_.splitAbortedBytesOut_ = 0; + + overallPartial_.overallBytesIn_ = 0; + overallPartial_.overallBytesOut_ = 0; + + return 1; +} + +void Statistics::addCompressedBytes(unsigned int bytesIn, unsigned int bytesOut) +{ + transportPartial_.compressedBytesIn_ += bytesIn; + transportTotal_.compressedBytesIn_ += bytesIn; + + transportPartial_.compressedBytesOut_ += bytesOut; + transportTotal_.compressedBytesOut_ += bytesOut; + + double ratio = bytesIn / bytesOut; + + if (ratio < 1) + { + ratio = 1; + } + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Old ratio was " + << proxyData_.streamRatio_ << " current is " + << (double) ratio << " new ratio is " << (double) + ((proxyData_.streamRatio_ * 2) + ratio) / 3 << ".\n" + << logofs_flush; + #endif + + proxyData_.streamRatio_ = ((proxyData_.streamRatio_ * 2) + ratio) / 3; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Updated compressed bytes " + << "with " << bytesIn << " in " << bytesOut << " out " + << "and ratio " << (double) proxyData_.streamRatio_ + << ".\n" << logofs_flush; + #endif +} + +// +// Recalculate the current bitrate. The bytes written +// are accounted at the time the transport actually +// writes the data to the network, not at the time it +// receives the data from the upper layers. The reason +// is that data can be compressed by the stream com- +// pressor, so we can become aware of the new bitrate +// only afer having flushed the ZLIB stream. This also +// means that, to have a reliable estimate, we need to +// flush the link often. +// + +void Statistics::updateBitrate(int bytes) +{ + T_timestamp thisFrameTs = getNewTimestamp(); + + int diffFramesInMs = diffTimestamp(startFrameTs_, thisFrameTs); + + #ifdef DEBUG + *logofs << "Statistics: Difference since previous timestamp is " + << diffFramesInMs << " Ms.\n" << logofs_flush; + #endif + + if (diffFramesInMs > 0) + { + #ifdef DEBUG + *logofs << "Statistics: Removing " << diffFramesInMs + << " Ms in short and long time frame.\n" + << logofs_flush; + #endif + + int shortBytesToRemove = (int) (((double) bytesInShortFrame_ * (double) diffFramesInMs) / + (double) control -> ShortBitrateTimeFrame); + + int longBytesToRemove = (int) (((double) bytesInLongFrame_ * (double) diffFramesInMs) / + (double) control -> LongBitrateTimeFrame); + + #ifdef DEBUG + *logofs << "Statistics: Removing " << shortBytesToRemove + << " bytes from " << bytesInShortFrame_ + << " in the short frame.\n" << logofs_flush; + #endif + + bytesInShortFrame_ -= shortBytesToRemove; + + if (bytesInShortFrame_ < 0) + { + #ifdef TEST + *logofs << "Statistics: Bytes in short frame are " + << bytesInShortFrame_ << ". Set to 0.\n" + << logofs_flush; + #endif + + bytesInShortFrame_ = 0; + } + + #ifdef DEBUG + *logofs << "Statistics: Removing " << longBytesToRemove + << " bytes from " << bytesInLongFrame_ + << " in the long frame.\n" << logofs_flush; + #endif + + bytesInLongFrame_ -= longBytesToRemove; + + if (bytesInLongFrame_ < 0) + { + #ifdef TEST + *logofs << "Statistics: Bytes in long frame are " + << bytesInLongFrame_ << ". Set to 0.\n" + << logofs_flush; + #endif + + bytesInLongFrame_ = 0; + } + + int diffStartInMs; + + diffStartInMs = diffTimestamp(thisFrameTs, startShortFrameTs_); + + if (diffStartInMs > control -> ShortBitrateTimeFrame) + { + addMsTimestamp(startShortFrameTs_, diffStartInMs); + } + + diffStartInMs = diffTimestamp(thisFrameTs, startLongFrameTs_); + + if (diffStartInMs > control -> LongBitrateTimeFrame) + { + addMsTimestamp(startLongFrameTs_, diffStartInMs); + } + + startFrameTs_ = thisFrameTs; + } + + #ifdef DEBUG + *logofs << "Statistics: Adding " << bytes << " bytes to " + << bytesInShortFrame_ << " in the short frame.\n" + << logofs_flush; + #endif + + bytesInShortFrame_ = bytesInShortFrame_ + bytes; + + #ifdef DEBUG + *logofs << "Statistics: Adding " << bytes << " bytes to " + << bytesInLongFrame_ << " in the long frame.\n" + << logofs_flush; + #endif + + bytesInLongFrame_ = bytesInLongFrame_ + bytes; + + bitrateInShortFrame_ = (int) ((double) bytesInShortFrame_ / + ((double) control -> ShortBitrateTimeFrame / 1000)); + + bitrateInLongFrame_ = (int) ((double) bytesInLongFrame_ / + ((double) control -> LongBitrateTimeFrame / 1000)); + + if (bitrateInShortFrame_ > topBitrate_) + { + topBitrate_ = bitrateInShortFrame_; + } + + #ifdef TEST + *logofs << "Statistics: Current bitrate is short " << bitrateInShortFrame_ + << " long " << bitrateInLongFrame_ << " top " << topBitrate_ + << ".\n" << logofs_flush; + #endif +} + +void Statistics::updateCongestion(int remaining, int limit) +{ + #ifdef TEST + *logofs << "Statistics: Updating the congestion " + << "counters at " << strMsTimestamp() + << ".\n" << logofs_flush; + #endif + + double current = remaining; + + if (current < 0) + { + current = 0; + } + + current = 9 * (limit - current) / limit; + + #ifdef TEST + *logofs << "Statistics: Current congestion is " + << current << " with " << limit << " tokens " + << "and " << remaining << " remaining.\n" + << logofs_flush; + #endif + + // + // If the current congestion counter is greater + // than the previous, take the current value, + // otherwise ramp down the value by calculating + // the average of the last 8 updates. + // + + #ifdef TEST + *logofs << "Statistics: Old congestion was " + << congestionInFrame_; + #endif + + if (current >= congestionInFrame_) + { + congestionInFrame_ = current; + } + else + { + congestionInFrame_ = ((congestionInFrame_ * 7) + current) / 8; + } + + #ifdef TEST + *logofs << " new congestion is " + << ((congestionInFrame_ * 7) + current) / 8 + << ".\n" << logofs_flush; + #endif + + // + // Call the function with 0 bytes flushed + // so the agent can update its congestion + // counter. + // + + FlushCallback(0); +} + +int Statistics::getClientCacheStats(int type, char *&buffer) +{ + if (type != PARTIAL_STATS && type != TOTAL_STATS) + { + #ifdef PANIC + *logofs << "Statistics: PANIC! Cannot produce statistics " + << "with qualifier '" << type << "'.\n" + << logofs_flush; + #endif + + return -1; + } + + // + // Print message cache data according + // to local and remote view. + // + + MessageStore *currentStore = NULL; + MessageStore *anyStore = NULL; + + char format[FORMAT_LENGTH]; + + strcat(buffer, "\nNX Cache Statistics\n"); + strcat(buffer, "-------------------\n\n"); + + for (int m = proxy_client; m <= proxy_server; m++) + { + if (m == proxy_client) + { + strcat(buffer, "Request\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); + strcat(buffer, "-------\t------\t--------------\t\t--------------\t\t-----------\n"); + } + else + { + strcat(buffer, "\nReply\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); + strcat(buffer, "-----\t------\t--------------\t\t--------------\t\t-----------\n"); + } + + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (m == proxy_client) + { + currentStore = proxy_ -> getClientStore() -> getRequestStore(i); + } + else + { + currentStore = proxy_ -> getServerStore() -> getReplyStore(i); + } + + if (currentStore != NULL && + (currentStore -> getLocalStorageSize() || + currentStore -> getRemoteStorageSize())) + { + anyStore = currentStore; + + sprintf(format, "#%d\t%d\t", i, currentStore -> getSize()); + + strcat(buffer, format); + + sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getLocalStorageSize(), + ((double) currentStore -> getLocalStorageSize()) / 1024); + + strcat(buffer, format); + + sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getRemoteStorageSize(), + ((double) currentStore -> getRemoteStorageSize()) / 1024); + + strcat(buffer, format); + + sprintf(format, "%d/%.0f KB\n", currentStore -> cacheSlots, + ((double) control -> getUpperStorageSize() / 100 * + currentStore -> cacheThreshold) / 1024); + + strcat(buffer, format); + } + } + + if (anyStore == NULL) + { + strcat(buffer, "N/A\n"); + } + } + + if (anyStore != NULL) + { + sprintf(format, "\ncache: %d bytes (%d KB) available at server.\n", + control -> ClientTotalStorageSize, + control -> ClientTotalStorageSize / 1024); + + strcat(buffer, format); + + sprintf(format, " %d bytes (%d KB) available at client.\n\n", + control -> ServerTotalStorageSize, + control -> ServerTotalStorageSize / 1024); + + strcat(buffer, format); + + sprintf(format, " %d bytes (%d KB) allocated at server.\n", + anyStore -> getLocalTotalStorageSize(), + anyStore -> getLocalTotalStorageSize() / 1024); + + strcat(buffer, format); + + sprintf(format, " %d bytes (%d KB) allocated at client.\n\n\n", + anyStore -> getRemoteTotalStorageSize(), + anyStore -> getRemoteTotalStorageSize() / 1024); + + strcat(buffer, format); + } + else + { + strcat(buffer, "\ncache: N/A\n\n"); + } + + return 1; +} + +int Statistics::getClientProtocolStats(int type, char *&buffer) +{ + if (type != PARTIAL_STATS && type != TOTAL_STATS) + { + #ifdef PANIC + *logofs << "Statistics: PANIC! Cannot produce statistics " + << "with qualifier '" << type << "'.\n" + << logofs_flush; + #endif + + return -1; + } + + struct T_transportData *transportData; + struct T_protocolData *protocolData; + struct T_overallData *overallData; + + if (type == PARTIAL_STATS) + { + transportData = &transportPartial_; + protocolData = &protocolPartial_; + overallData = &overallPartial_; + } + else + { + transportData = &transportTotal_; + protocolData = &protocolTotal_; + overallData = &overallTotal_; + } + + char format[FORMAT_LENGTH]; + + double countRequestIn = 0; + double countCachedRequestIn = 0; + double countRepliedRequestIn = 0; + + double countRequestBitsIn = 0; + double countRequestBitsOut = 0; + + double countAnyIn = 0; + double countBitsIn = 0; + double countBitsOut = 0; + + // + // Print request data. + // + + strcat(buffer, "NX Server Side Protocol Statistics\n"); + strcat(buffer, "----------------------------------\n\n"); + + // + // Print render data. + // + + strcat(buffer, "Render Total\tCached\tBits In\t\tBits Out\tBits/Request\t\tRatio\n"); + strcat(buffer, "------- -----\t------\t-------\t\t--------\t------------\t\t-----\n"); + + for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) + { + if (protocolData -> renderRequestCount_[i]) + { + sprintf(format, "#%d ", i); + + while (strlen(format) < 8) + { + strcat(format, " "); + } + + strcat(buffer, format); + + if (protocolData -> renderRequestCached_[i] > 0) + { + sprintf(format, "%.0f\t%.0f", protocolData -> renderRequestCount_[i], + protocolData -> renderRequestCached_[i]); + } + else + { + sprintf(format, "%.0f\t", protocolData -> renderRequestCount_[i]); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + protocolData -> renderRequestBitsIn_[i], protocolData -> renderRequestBitsIn_[i] / 8192, + protocolData -> renderRequestBitsOut_[i], protocolData -> renderRequestBitsOut_[i] / 8192, + protocolData -> renderRequestBitsIn_[i] / protocolData -> renderRequestCount_[i], + protocolData -> renderRequestBitsOut_[i] / protocolData -> renderRequestCount_[i]); + + strcat(buffer, format); + + if (protocolData -> renderRequestBitsOut_[i] > 0) + { + sprintf(format, "%5.3f:1\n", protocolData -> renderRequestBitsIn_[i] / + protocolData -> renderRequestBitsOut_[i]); + + strcat(buffer, format); + } + else + { + strcat(buffer, "1:1\n"); + } + } + + countRequestIn += protocolData -> renderRequestCount_[i]; + countCachedRequestIn += protocolData -> renderRequestCached_[i]; + + countRequestBitsIn += protocolData -> renderRequestBitsIn_[i]; + countRequestBitsOut += protocolData -> renderRequestBitsOut_[i]; + + countAnyIn += protocolData -> renderRequestCount_[i]; + countBitsIn += protocolData -> renderRequestBitsIn_[i]; + countBitsOut += protocolData -> renderRequestBitsOut_[i]; + } + + if (countRequestIn > 0) + { + if (countCachedRequestIn > 0) + { + sprintf(format, "\ntotal: %.0f\t%.0f", countRequestIn, countCachedRequestIn); + } + else + { + sprintf(format, "\ntotal: %.0f\t", countRequestIn); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + countRequestBitsIn, countRequestBitsIn / 8192, countRequestBitsOut, + countRequestBitsOut / 8192, countRequestBitsIn / countRequestIn, + countRequestBitsOut / countRequestIn); + + strcat(buffer, format); + + if (countRequestBitsOut > 0) + { + sprintf(format, "%5.3f:1\n", countRequestBitsIn / countRequestBitsOut); + } + else + { + sprintf(format, "1:1\n"); + } + + strcat(buffer, format); + } + else + { + strcat(buffer, "N/A\n\n"); + } + + countRequestIn = 0; + countCachedRequestIn = 0; + + countRequestBitsIn = 0; + countRequestBitsOut = 0; + + countAnyIn = 0; + countBitsIn = 0; + countBitsOut = 0; + + // + // Print other requests' data. + // + + strcat(buffer, "\nRequest Total\tCached\tBits In\t\tBits Out\tBits/Request\t\tRatio\n"); + strcat(buffer, "------- -----\t------\t-------\t\t--------\t------------\t\t-----\n"); + + for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) + { + if (protocolData -> requestCount_[i]) + { + sprintf(format, "#%d ", i); + + while (strlen(format) < 5) + { + strcat(format, " "); + } + + // + // Mark NX agent-related requests, those + // having a reply and finally those that + // have been probably tainted by client + // side. + // + + if (i >= X_NXFirstOpcode && i <= X_NXLastOpcode) + { + strcat(format, "A"); + } + + if (i != X_NXInternalGenericReply && protocolData -> requestReplied_[i] > 0) + { + strcat(format, "R"); + } + + if (i == X_NoOperation && control -> TaintReplies) + { + strcat(format, "T"); + } + + while (strlen(format) < 8) + { + strcat(format, " "); + } + + strcat(buffer, format); + + if (protocolData -> requestCached_[i] > 0) + { + sprintf(format, "%.0f\t%.0f", protocolData -> requestCount_[i], + protocolData -> requestCached_[i]); + } + else + { + sprintf(format, "%.0f\t", protocolData -> requestCount_[i]); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + protocolData -> requestBitsIn_[i], protocolData -> requestBitsIn_[i] / 8192, + protocolData -> requestBitsOut_[i], protocolData -> requestBitsOut_[i] / 8192, + protocolData -> requestBitsIn_[i] / protocolData -> requestCount_[i], + protocolData -> requestBitsOut_[i] / protocolData -> requestCount_[i]); + + strcat(buffer, format); + + if (protocolData -> requestBitsOut_[i] > 0) + { + sprintf(format, "%5.3f:1\n", protocolData -> requestBitsIn_[i] / + protocolData -> requestBitsOut_[i]); + + strcat(buffer, format); + } + else + { + strcat(buffer, "1:1\n"); + } + } + + countRequestIn += protocolData -> requestCount_[i]; + countCachedRequestIn += protocolData -> requestCached_[i]; + countRepliedRequestIn += protocolData -> requestReplied_[i]; + + countRequestBitsIn += protocolData -> requestBitsIn_[i]; + countRequestBitsOut += protocolData -> requestBitsOut_[i]; + + countAnyIn += protocolData -> requestCount_[i]; + countBitsIn += protocolData -> requestBitsIn_[i]; + countBitsOut += protocolData -> requestBitsOut_[i]; + } + + if (countRequestIn > 0) + { + if (countCachedRequestIn > 0) + { + sprintf(format, "\ntotal: %.0f\t%.0f", countRequestIn, countCachedRequestIn); + } + else + { + sprintf(format, "\ntotal: %.0f\t", countRequestIn); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + countRequestBitsIn, countRequestBitsIn / 8192, countRequestBitsOut, + countRequestBitsOut / 8192, countRequestBitsIn / countRequestIn, + countRequestBitsOut / countRequestIn); + + strcat(buffer, format); + + if (countRequestBitsOut > 0) + { + sprintf(format, "%5.3f:1\n", countRequestBitsIn / countRequestBitsOut); + } + else + { + sprintf(format, "1:1\n"); + } + + strcat(buffer, format); + } + else + { + strcat(buffer, "N/A\n\n"); + } + + // + // Print transport data. + // + + getTimeStats(type, buffer); + + countAnyIn += protocolData -> cupsCount_; + countBitsIn += protocolData -> cupsBitsIn_; + countBitsOut += protocolData -> cupsBitsOut_; + + countAnyIn += protocolData -> smbCount_; + countBitsIn += protocolData -> smbBitsIn_; + countBitsOut += protocolData -> smbBitsOut_; + + countAnyIn += protocolData -> mediaCount_; + countBitsIn += protocolData -> mediaBitsIn_; + countBitsOut += protocolData -> mediaBitsOut_; + + countAnyIn += protocolData -> httpCount_; + countBitsIn += protocolData -> httpBitsIn_; + countBitsOut += protocolData -> httpBitsOut_; + + countAnyIn += protocolData -> fontCount_; + countBitsIn += protocolData -> fontBitsIn_; + countBitsOut += protocolData -> fontBitsOut_; + + countAnyIn += protocolData -> slaveCount_; + countBitsIn += protocolData -> slaveBitsIn_; + countBitsOut += protocolData -> slaveBitsOut_; + + // + // Save the overall amount of bytes + // coming from X clients. + // + + overallData -> overallBytesIn_ = countBitsIn / 8; + + // + // Print performance data. + // + + if (transportData -> readTime_ > 0) + { + sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", + countAnyIn / (transportData -> readTime_ / 1000), + (countBitsIn + transportData -> framingBitsOut_) / 8192 / + (transportData -> readTime_ / 1000)); + } + else + { + sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", + countAnyIn, (countBitsIn + transportData -> + framingBitsOut_) / 8192); + } + + strcat(buffer, format); + + strcat(buffer, "link: "); + + // + // ZLIB compression stats. + // + + getStreamStats(type, buffer); + + // + // Save the overall amount of bytes + // sent on NX proxy link. + // + + if (transportData -> compressedBytesOut_ > 0) + { + overallData -> overallBytesOut_ = transportData -> compressedBytesOut_; + } + else + { + overallData -> overallBytesOut_ = countBitsOut / 8; + } + + // + // Print info on multiplexing overhead. + // + + getFramingStats(type, buffer); + + // + // Print stats about additional channels. + // + + getServicesStats(type, buffer); + + // + // Compression summary. + // + + double ratio = 1; + + if (transportData -> compressedBytesOut_ / 1024 > 0) + { + ratio = ((countBitsIn + transportData -> framingBitsOut_) / 8192) / + (transportData -> compressedBytesOut_ / 1024); + + } + else if (countBitsOut > 0) + { + ratio = (countBitsIn + transportData -> framingBitsOut_) / + countBitsOut; + } + + sprintf(format, " Protocol compression ratio is %5.3f:1.\n\n", + ratio); + + strcat(buffer, format); + + getBitrateStats(type, buffer); + + getSplitStats(type, buffer); + + sprintf(format, " %.0f total handled replies (%.0f unmatched).\n\n\n", + countRepliedRequestIn, protocolData -> requestReplied_[X_NXInternalGenericReply]); + + strcat(buffer, format); + + return 1; +} + +int Statistics::getClientOverallStats(int type, char *&buffer) +{ + if (type != PARTIAL_STATS && type != TOTAL_STATS) + { + #ifdef PANIC + *logofs << "Statistics: PANIC! Cannot produce statistics " + << "with qualifier '" << type << "'.\n" + << logofs_flush; + #endif + + return -1; + } + + struct T_overallData *overallData; + struct T_packedData *packedData; + + if (type == PARTIAL_STATS) + { + overallData = &overallPartial_; + packedData = &packedPartial_; + } + else + { + overallData = &overallTotal_; + packedData = &packedTotal_; + } + + char format[FORMAT_LENGTH]; + + // + // Print header including link type, + // followed by info on packed images. + // + + strcat(buffer, "NX Compression Summary\n"); + strcat(buffer, "----------------------\n\n"); + + char label[FORMAT_LENGTH]; + + switch (control -> LinkMode) + { + case LINK_TYPE_NONE: + { + strcpy(label, "NONE"); + + break; + } + case LINK_TYPE_MODEM: + { + strcpy(label, "MODEM"); + + break; + } + case LINK_TYPE_ISDN: + { + strcpy(label, "ISDN"); + + break; + } + case LINK_TYPE_ADSL: + { + strcpy(label, "ADSL"); + + break; + } + case LINK_TYPE_WAN: + { + strcpy(label, "WAN"); + + break; + } + case LINK_TYPE_LAN: + { + strcpy(label, "LAN"); + + break; + } + default: + { + strcpy(label, "Unknown"); + + break; + } + } + + sprintf(format, "link: %s", label); + + if (control -> LocalDeltaCompression == 1) + { + strcat(format, " with protocol compression enabled."); + } + else + { + strcat(format, " with protocol compression disabled."); + } + + strcat(format, "\n\n"); + + strcat(buffer, format); + + if (packedData -> packedBytesIn_ > 0) + { + sprintf(format, "images: %.0f bytes (%.0f KB) packed to %.0f (%.0f KB).\n\n", + packedData -> packedBytesOut_, packedData -> packedBytesOut_ / 1024, + packedData -> packedBytesIn_, packedData -> packedBytesIn_ / 1024); + + strcat(buffer, format); + + sprintf(format, " Images compression ratio is %5.3f:1.\n\n", + packedData -> packedBytesOut_ / packedData -> packedBytesIn_); + + strcat(buffer, format); + } + + double overallIn = overallData -> overallBytesIn_ - packedData -> packedBytesIn_ + + packedData -> packedBytesOut_; + + double overallOut = overallData -> overallBytesOut_; + + sprintf(format, "overall: %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + overallIn, overallIn / 1024, overallOut, overallOut / 1024); + + strcat(buffer, format); + + if (overallData -> overallBytesOut_ > 0) + { + sprintf(format, " Overall NX server compression ratio is %5.3f:1.\n\n\n", + overallIn / overallOut); + } + else + { + sprintf(format, " Overall NX server compression ratio is 1:1.\n\n\n"); + } + + strcat(buffer, format); + + return 1; +} + +int Statistics::getServerCacheStats(int type, char *&buffer) +{ + if (type != PARTIAL_STATS && type != TOTAL_STATS) + { + #ifdef PANIC + *logofs << "Statistics: PANIC! Cannot produce statistics " + << "with qualifier '" << type << "'.\n" + << logofs_flush; + #endif + + return -1; + } + + // + // Print message cache data according + // to local and remote view. + // + + MessageStore *currentStore = NULL; + MessageStore *anyStore = NULL; + + char format[FORMAT_LENGTH]; + + strcat(buffer, "\nNX Cache Statistics\n"); + strcat(buffer, "-------------------\n\n"); + + for (int m = proxy_client; m <= proxy_server; m++) + { + if (m == proxy_client) + { + strcat(buffer, "Request\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); + strcat(buffer, "-------\t------\t--------------\t\t--------------\t\t-----------\n"); + } + else + { + strcat(buffer, "\nReply\tCached\tSize at Server\t\tSize at Client\t\tCache limit\n"); + strcat(buffer, "-----\t------\t--------------\t\t--------------\t\t-----------\n"); + } + + for (int i = 0; i < CHANNEL_STORE_OPCODE_LIMIT; i++) + { + if (m == proxy_client) + { + currentStore = proxy_ -> getClientStore() -> getRequestStore(i); + } + else + { + currentStore = proxy_ -> getServerStore() -> getReplyStore(i); + } + + if (currentStore != NULL && + (currentStore -> getLocalStorageSize() || + currentStore -> getRemoteStorageSize())) + { + anyStore = currentStore; + + sprintf(format, "#%d\t%d\t", i, currentStore -> getSize()); + + strcat(buffer, format); + + sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getRemoteStorageSize(), + ((double) currentStore -> getRemoteStorageSize()) / 1024); + + strcat(buffer, format); + + sprintf(format, "%d (%.0f KB)\t\t", currentStore -> getLocalStorageSize(), + ((double) currentStore -> getLocalStorageSize()) / 1024); + + strcat(buffer, format); + + sprintf(format, "%d/%.0f KB\n", currentStore -> cacheSlots, + ((double) control -> getUpperStorageSize() / 100 * + currentStore -> cacheThreshold) / 1024); + + strcat(buffer, format); + } + } + + if (anyStore == NULL) + { + strcat(buffer, "N/A\n"); + } + } + + if (anyStore != NULL) + { + sprintf(format, "\ncache: %d bytes (%d KB) available at server.\n", + control -> ClientTotalStorageSize, + control -> ClientTotalStorageSize / 1024); + + strcat(buffer, format); + + sprintf(format, " %d bytes (%d KB) available at client.\n\n", + control -> ServerTotalStorageSize, + control -> ServerTotalStorageSize / 1024); + + strcat(buffer, format); + + sprintf(format, " %d bytes (%d KB) allocated at server.\n", + anyStore -> getRemoteTotalStorageSize(), + anyStore -> getRemoteTotalStorageSize() / 1024); + + strcat(buffer, format); + + sprintf(format, " %d bytes (%d KB) allocated at client.\n\n\n", + anyStore -> getLocalTotalStorageSize(), + anyStore -> getLocalTotalStorageSize() / 1024); + + strcat(buffer, format); + } + else + { + strcat(buffer, "\ncache: N/A\n\n"); + } + + return 1; +} + +int Statistics::getServerProtocolStats(int type, char *&buffer) +{ + if (type != PARTIAL_STATS && type != TOTAL_STATS) + { + #ifdef PANIC + *logofs << "Statistics: PANIC! Cannot produce statistics " + << "with qualifier '" << type << "'.\n" + << logofs_flush; + #endif + + return -1; + } + + struct T_transportData *transportData; + struct T_protocolData *protocolData; + struct T_overallData *overallData; + + if (type == PARTIAL_STATS) + { + transportData = &transportPartial_; + protocolData = &protocolPartial_; + overallData = &overallPartial_; + } + else + { + transportData = &transportTotal_; + protocolData = &protocolTotal_; + overallData = &overallTotal_; + } + + char format[FORMAT_LENGTH]; + + double countReplyBitsIn = 0; + double countReplyBitsOut = 0; + + double countReplyIn = 0; + double countCachedReplyIn = 0; + + double countEventBitsIn = 0; + double countEventBitsOut = 0; + + double countEventIn = 0; + double countCachedEventIn = 0; + + double countAnyIn = 0; + double countBitsIn = 0; + double countBitsOut = 0; + + // + // Print reply data. + // + + strcat(buffer, "NX Client Side Protocol Statistics\n"); + strcat(buffer, "----------------------------------\n\n"); + + strcat(buffer, "Reply Total\tCached\tBits In\t\tBits Out\tBits/Reply\t\tRatio\n"); + strcat(buffer, "------- -----\t------\t-------\t\t--------\t----------\t\t-----\n"); + + for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) + { + if (protocolData -> replyCount_[i]) + { + sprintf(format, "#%d ", i); + + while (strlen(format) < 5) + { + strcat(format, " "); + } + + // + // Mark replies originated + // by NX agent requests. + // + + if (i >= X_NXFirstOpcode && i <= X_NXLastOpcode) + { + strcat(format, "A"); + } + + // + // Mark replies that we didn't + // match against a request. + // + + if (i == 1) + { + strcat(format, "U"); + } + + while (strlen(format) < 8) + { + strcat(format, " "); + } + + strcat(buffer, format); + + if (protocolData -> replyCached_[i] > 0) + { + sprintf(format, "%.0f\t%.0f", protocolData -> replyCount_[i], + protocolData -> replyCached_[i]); + } + else + { + sprintf(format, "%.0f\t", protocolData -> replyCount_[i]); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + protocolData -> replyBitsIn_[i], protocolData -> replyBitsIn_[i] / 8192, + protocolData -> replyBitsOut_[i], protocolData -> replyBitsOut_[i] / 8192, + protocolData -> replyBitsIn_[i] / protocolData -> replyCount_[i], + protocolData -> replyBitsOut_[i] / protocolData -> replyCount_[i]); + + strcat(buffer, format); + + if (protocolData -> replyBitsOut_[i] > 0) + { + sprintf(format, "%5.3f:1\n", protocolData -> replyBitsIn_[i] / + protocolData -> replyBitsOut_[i]); + } + else + { + sprintf(format, "1:1\n"); + } + + strcat(buffer, format); + } + + countReplyIn += protocolData -> replyCount_[i]; + countCachedReplyIn += protocolData -> replyCached_[i]; + + countReplyBitsIn += protocolData -> replyBitsIn_[i]; + countReplyBitsOut += protocolData -> replyBitsOut_[i]; + + countAnyIn += protocolData -> replyCount_[i]; + countBitsIn += protocolData -> replyBitsIn_[i]; + countBitsOut += protocolData -> replyBitsOut_[i]; + } + + if (countReplyIn > 0) + { + if (countCachedReplyIn > 0) + { + sprintf(format, "\ntotal: %.0f\t%.0f", countReplyIn, countCachedReplyIn); + } + else + { + sprintf(format, "\ntotal: %.0f\t", countReplyIn); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + countReplyBitsIn, countReplyBitsIn / 8192, countReplyBitsOut, + countReplyBitsOut / 8192, countReplyBitsIn / countReplyIn, + countReplyBitsOut / countReplyIn); + + strcat(buffer, format); + + if (countReplyBitsOut > 0) + { + sprintf(format, "%5.3f:1\n", countReplyBitsIn / countReplyBitsOut); + } + else + { + sprintf(format, "1:1\n"); + } + + strcat(buffer, format); + } + else + { + strcat(buffer, "N/A\n"); + } + + strcat(buffer, "\n"); + + // + // Print event and error data. + // + + strcat(buffer, "Event Total\tCached\tBits In\t\tBits Out\tBits/Event\t\tRatio\n"); + strcat(buffer, "------- -----\t------\t-------\t\t--------\t----------\t\t-----\n"); + + for (int i = 0; i < STATISTICS_OPCODE_MAX; i++) + { + if (protocolData -> eventCount_[i]) + { + sprintf(format, "#%d ", i); + + while (strlen(format) < 8) + { + strcat(format, " "); + } + + strcat(buffer, format); + + if (protocolData -> eventCached_[i] > 0) + { + sprintf(format, "%.0f\t%.0f", protocolData -> eventCount_[i], + protocolData -> eventCached_[i]); + } + else + { + sprintf(format, "%.0f\t", protocolData -> eventCount_[i]); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + protocolData -> eventBitsIn_[i], protocolData -> eventBitsIn_[i] / 8192, + protocolData -> eventBitsOut_[i], protocolData -> eventBitsOut_[i] / 8192, + protocolData -> eventBitsIn_[i] / protocolData -> eventCount_[i], + protocolData -> eventBitsOut_[i] / protocolData -> eventCount_[i]); + + strcat(buffer, format); + + if (protocolData -> eventBitsOut_[i] > 0) + { + sprintf(format, "%5.3f:1\n", protocolData -> eventBitsIn_[i] / + protocolData -> eventBitsOut_[i]); + } + else + { + sprintf(format, "1:1\n"); + } + + strcat(buffer, format); + } + + countEventIn += protocolData -> eventCount_[i]; + countCachedEventIn += protocolData -> eventCached_[i]; + + countEventBitsIn += protocolData -> eventBitsIn_[i]; + countEventBitsOut += protocolData -> eventBitsOut_[i]; + + countAnyIn += protocolData -> eventCount_[i]; + countBitsIn += protocolData -> eventBitsIn_[i]; + countBitsOut += protocolData -> eventBitsOut_[i]; + } + + if (countEventIn > 0) + { + if (countCachedEventIn > 0) + { + sprintf(format, "\ntotal: %.0f\t%.0f", countEventIn, countCachedEventIn); + } + else + { + sprintf(format, "\ntotal: %.0f\t", countEventIn); + } + + strcat(buffer, format); + + sprintf(format, "\t%.0f (%.0f KB)\t%.0f (%.0f KB)\t%.0f/1 -> %.0f/1 \t", + countEventBitsIn, countEventBitsIn / 8192, countEventBitsOut, + countEventBitsOut / 8192, countEventBitsIn / countEventIn, + countEventBitsOut / countEventIn); + + strcat(buffer, format); + + if (countEventBitsOut > 0) + { + sprintf(format, "%5.3f:1\n", countEventBitsIn / countEventBitsOut); + } + else + { + sprintf(format, "1:1\n"); + } + + strcat(buffer, format); + } + else + { + strcat(buffer, "N/A\n\n"); + } + + // + // Print transport data. + // + + getTimeStats(type, buffer); + + countAnyIn += protocolData -> cupsCount_; + countBitsIn += protocolData -> cupsBitsIn_; + countBitsOut += protocolData -> cupsBitsOut_; + + countAnyIn += protocolData -> smbCount_; + countBitsIn += protocolData -> smbBitsIn_; + countBitsOut += protocolData -> smbBitsOut_; + + countAnyIn += protocolData -> mediaCount_; + countBitsIn += protocolData -> mediaBitsIn_; + countBitsOut += protocolData -> mediaBitsOut_; + + countAnyIn += protocolData -> httpCount_; + countBitsIn += protocolData -> httpBitsIn_; + countBitsOut += protocolData -> httpBitsOut_; + + countAnyIn += protocolData -> fontCount_; + countBitsIn += protocolData -> fontBitsIn_; + countBitsOut += protocolData -> fontBitsOut_; + + countAnyIn += protocolData -> slaveCount_; + countBitsIn += protocolData -> slaveBitsIn_; + countBitsOut += protocolData -> slaveBitsOut_; + + // + // Save the overall amount of bytes + // coming from X clients. + // + + overallData -> overallBytesIn_ = countBitsIn / 8; + + // + // Print performance data. + // + + if (transportData -> readTime_ > 0) + { + sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", + countAnyIn / (transportData -> readTime_ / 1000), + (countBitsIn + transportData -> framingBitsOut_) / 8192 / + (transportData -> readTime_ / 1000)); + } + else + { + sprintf(format, " %.0f messages (%.0f KB) encoded per second.\n\n", + countAnyIn, (countBitsIn + transportData -> + framingBitsOut_) / 8192); + } + + strcat(buffer, format); + + strcat(buffer, "link: "); + + // + // ZLIB compression stats. + // + + getStreamStats(type, buffer); + + // + // Save the overall amount of bytes + // sent on NX proxy link. + // + + if (transportData -> compressedBytesOut_ > 0) + { + overallData -> overallBytesOut_ = transportData -> compressedBytesOut_; + } + else + { + overallData -> overallBytesOut_ = countBitsOut / 8; + } + + // + // Print info on multiplexing overhead. + // + + getFramingStats(type, buffer); + + // + // Print stats about additional channels. + // + + getServicesStats(type, buffer); + + // + // Compression summary. + // + + double ratio = 1; + + if (transportData -> compressedBytesOut_ / 1024 > 0) + { + ratio = ((countBitsIn + transportData -> framingBitsOut_) / 8192) / + (transportData -> compressedBytesOut_ / 1024); + + } + else if (countBitsOut > 0) + { + ratio = (countBitsIn + transportData -> framingBitsOut_) / + countBitsOut; + } + + sprintf(format, " Protocol compression ratio is %5.3f:1.\n\n", + ratio); + + strcat(buffer, format); + + getBitrateStats(type, buffer); + + // + // These are not included in output. + // + // getSplitStats(type, buffer); + // + + strcat(buffer, "\n"); + + // + // These statistics are not included in output. + // You can check it anyway to get the effective + // amount of bytes produced by unpack procedure. + // + // getClientOverallStats(type, buffer); + // + + return 1; +} + +int Statistics::getServerOverallStats(int type, char *&buffer) +{ + return 1; +} + +int Statistics::getTimeStats(int type, char *&buffer) +{ + struct T_transportData *transportData; + + if (type == PARTIAL_STATS) + { + transportData = &transportPartial_; + } + else + { + transportData = &transportTotal_; + } + + char format[FORMAT_LENGTH]; + + sprintf(format, "\ntime: %.0f Ms idle, %.0f Ms (%.0f Ms in read, %.0f Ms in write) running.\n\n", + transportData -> idleTime_, transportData -> readTime_, + transportData -> readTime_ - transportData -> writeTime_, + transportData -> writeTime_); + + strcat(buffer, format); + + return 1; +} + +int Statistics::getStreamStats(int type, char *&buffer) +{ + struct T_transportData *transportData; + + if (type == PARTIAL_STATS) + { + transportData = &transportPartial_; + } + else + { + transportData = &transportTotal_; + } + + char format[FORMAT_LENGTH]; + + if (transportData -> compressedBytesOut_ > 0) + { + sprintf(format, "%.0f bytes (%.0f KB) compressed to %.0f (%.0f KB).\n", + transportData -> compressedBytesIn_, transportData -> compressedBytesIn_ / 1024, + transportData -> compressedBytesOut_, transportData -> compressedBytesOut_ / 1024); + + strcat(buffer, format); + + sprintf(format, " %5.3f:1 stream compression ratio.\n\n", + transportData -> compressedBytesIn_ / transportData -> compressedBytesOut_); + + strcat(buffer, format); + } + + if (transportData -> decompressedBytesOut_ > 0) + { + if (transportData -> compressedBytesOut_ > 0) + { + strcat(buffer, " "); + } + + sprintf(format, "%.0f bytes (%.0f KB) decompressed to %.0f (%.0f KB).\n", + transportData -> decompressedBytesIn_, transportData -> decompressedBytesIn_ / 1024, + transportData -> decompressedBytesOut_, transportData -> decompressedBytesOut_ / 1024); + + strcat(buffer, format); + + sprintf(format, " %5.3f:1 stream compression ratio.\n\n", + transportData -> decompressedBytesOut_ / transportData -> decompressedBytesIn_); + + strcat(buffer, format); + } + + if (transportData -> compressedBytesOut_ > 0 || + transportData -> decompressedBytesOut_ > 0) + { + strcat(buffer, " "); + } + + return 1; +} + +int Statistics::getServicesStats(int type, char *&buffer) +{ + struct T_protocolData *protocolData; + + if (type == PARTIAL_STATS) + { + protocolData = &protocolPartial_; + } + else + { + protocolData = &protocolTotal_; + } + + char format[FORMAT_LENGTH]; + + if (protocolData -> cupsBitsOut_ > 0) + { + sprintf(format, " %.0f CUPS messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + protocolData -> cupsCount_ , protocolData -> cupsBitsIn_ / 8, + protocolData -> cupsBitsIn_ / 8192, protocolData -> cupsBitsOut_ / 8, + protocolData -> cupsBitsOut_ / 8192); + + strcat(buffer, format); + } + + if (protocolData -> smbBitsOut_ > 0) + { + sprintf(format, " %.0f SMB messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + protocolData -> smbCount_ , protocolData -> smbBitsIn_ / 8, + protocolData -> smbBitsIn_ / 8192, protocolData -> smbBitsOut_ / 8, + protocolData -> smbBitsOut_ / 8192); + + strcat(buffer, format); + } + + if (protocolData -> mediaBitsOut_ > 0) + { + sprintf(format, " %.0f multimedia messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + protocolData -> mediaCount_ , protocolData -> mediaBitsIn_ / 8, + protocolData -> mediaBitsIn_ / 8192, protocolData -> mediaBitsOut_ / 8, + protocolData -> mediaBitsOut_ / 8192); + + strcat(buffer, format); + } + + if (protocolData -> httpBitsOut_ > 0) + { + sprintf(format, " %.0f HTTP messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + protocolData -> httpCount_ , protocolData -> httpBitsIn_ / 8, + protocolData -> httpBitsIn_ / 8192, protocolData -> httpBitsOut_ / 8, + protocolData -> httpBitsOut_ / 8192); + + strcat(buffer, format); + } + + if (protocolData -> fontBitsOut_ > 0) + { + sprintf(format, " %.0f font server messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + protocolData -> fontCount_ , protocolData -> fontBitsIn_ / 8, + protocolData -> fontBitsIn_ / 8192, protocolData -> fontBitsOut_ / 8, + protocolData -> fontBitsOut_ / 8192); + + strcat(buffer, format); + } + + if (protocolData -> slaveBitsOut_ > 0) + { + sprintf(format, " %.0f slave messages, %.0f bytes (%.0f KB) in, %.0f bytes (%.0f KB) out.\n\n", + protocolData -> slaveCount_ , protocolData -> slaveBitsIn_ / 8, + protocolData -> slaveBitsIn_ / 8192, protocolData -> slaveBitsOut_ / 8, + protocolData -> slaveBitsOut_ / 8192); + + strcat(buffer, format); + } + + return 1; +} + +int Statistics::getFramingStats(int type, char *&buffer) +{ + struct T_transportData *transportData; + + if (type == PARTIAL_STATS) + { + transportData = &transportPartial_; + } + else + { + transportData = &transportTotal_; + } + + char format[FORMAT_LENGTH]; + + // + // Print info on multiplexing overhead. + // + + sprintf(format, "%.0f frames in, %.0f frames out, %.0f writes out.\n\n", + transportData -> proxyFramesIn_, transportData -> proxyFramesOut_, + transportData -> proxyWritesOut_); + + strcat(buffer, format); + + sprintf(format, " %.0f bytes (%.0f KB) used for framing and multiplexing.\n\n", + transportData -> framingBitsOut_ / 8, transportData -> framingBitsOut_ / 8192); + + strcat(buffer, format); + + return 1; +} + +int Statistics::getBitrateStats(int type, char *&buffer) +{ + struct T_transportData *transportData; + struct T_overallData *overallData; + + if (type == PARTIAL_STATS) + { + transportData = &transportPartial_; + overallData = &overallPartial_; + } + else + { + transportData = &transportTotal_; + overallData = &overallTotal_; + } + + double total = 0; + + if (transportData -> idleTime_ + transportData -> readTime_ > 0) + { + total = overallData -> overallBytesOut_ / + ((transportData -> idleTime_ + transportData -> readTime_) / 1000); + } + + char format[FORMAT_LENGTH]; + + sprintf(format, " %.0f B/s average, %d B/s %ds, %d B/s %ds, %d B/s maximum.\n\n", + total, getBitrateInShortFrame(), control -> ShortBitrateTimeFrame / 1000, + getBitrateInLongFrame(), control -> LongBitrateTimeFrame / 1000, + getTopBitrate()); + + strcat(buffer, format); + + resetTopBitrate(); + + return 1; +} + +int Statistics::getSplitStats(int type, char *&buffer) +{ + // + // Don't print these statistics if persistent + // cache of images is disabled. + // + + if (control -> ImageCacheEnableLoad == 0 && + control -> ImageCacheEnableSave == 0) + { + return 0; + } + + struct T_splitData *splitData; + + if (type == PARTIAL_STATS) + { + splitData = &splitPartial_; + } + else + { + splitData = &splitTotal_; + } + + char format[FORMAT_LENGTH]; + + // + // Print info on split messages restored from disk. + // + + sprintf(format, " %.0f images streamed, %.0f restored, %.0f bytes (%.0f KB) cached.\n\n", + splitData -> splitCount_, splitData -> splitAborted_, splitData -> splitAbortedBytesOut_, + splitData -> splitAbortedBytesOut_ / 1024); + + strcat(buffer, format); + + return 1; +} diff --git a/nxcomp/src/Statistics.h b/nxcomp/src/Statistics.h new file mode 100644 index 000000000..1ffb6b5d6 --- /dev/null +++ b/nxcomp/src/Statistics.h @@ -0,0 +1,745 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Statistics_H +#define Statistics_H + +#include "NXproto.h" + +#include "Misc.h" +#include "Timestamp.h" + +class Proxy; + +// +// Opcode 255 is for generic requests, 1 is for +// generic replies (those which haven't a speci- +// fic differential encoding), opcode 0 is for +// generic messages from the auxiliary channels. +// + +#define STATISTICS_OPCODE_MAX 256 + +// +// Maximum length of the buffer allocated for +// the statistics output. +// + +#define STATISTICS_LENGTH 16384 + +// +// Query type. +// + +#define TOTAL_STATS 1 +#define PARTIAL_STATS 2 +#define NO_STATS 3 + +// +// Log level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Log the operations related to updating +// the control tokens. +// + +#undef TOKEN + +class Statistics +{ + public: + + // + // Use the proxy class to get access + // to the message stores. + // + + Statistics(Proxy *proxy); + + ~Statistics(); + + void addIdleTime(unsigned int numMs) + { + transportPartial_.idleTime_ += numMs; + transportTotal_.idleTime_ += numMs; + } + + void subIdleTime(unsigned int numMs) + { + transportPartial_.idleTime_ -= numMs; + transportTotal_.idleTime_ -= numMs; + } + + void addReadTime(unsigned int numMs) + { + transportPartial_.readTime_ += numMs; + transportTotal_.readTime_ += numMs; + } + + void subReadTime(unsigned int numMs) + { + transportPartial_.readTime_ -= numMs; + transportTotal_.readTime_ -= numMs; + } + + void addWriteTime(unsigned int numMs) + { + transportPartial_.writeTime_ += numMs; + transportTotal_.writeTime_ += numMs; + } + + void subWriteTime(unsigned int numMs) + { + transportPartial_.writeTime_ -= numMs; + transportTotal_.writeTime_ -= numMs; + } + + void addBytesIn(unsigned int numBytes) + { + transportPartial_.proxyBytesIn_ += numBytes; + transportTotal_.proxyBytesIn_ += numBytes; + } + + double getBytesIn() + { + return transportTotal_.proxyBytesIn_; + } + + void addBytesOut(unsigned int numBytes) + { + transportPartial_.proxyBytesOut_ += numBytes; + transportTotal_.proxyBytesOut_ += numBytes; + } + + double getBytesOut() + { + return transportTotal_.proxyBytesOut_; + } + + void addFrameIn() + { + transportPartial_.proxyFramesIn_++; + transportTotal_.proxyFramesIn_++; + + #ifdef TEST + *logofs << "Statistics: Updated total proxy frames in to " + << transportTotal_.proxyFramesIn_ << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + } + + void addFrameOut() + { + transportPartial_.proxyFramesOut_++; + transportTotal_.proxyFramesOut_++; + + #ifdef TEST + *logofs << "Statistics: Updated total proxy frames out to " + << transportTotal_.proxyFramesOut_ << " at " + << strMsTimestamp() << ".\n" + << logofs_flush; + #endif + } + + void addWriteOut() + { + transportPartial_.proxyWritesOut_++; + transportTotal_.proxyWritesOut_++; + + #ifdef TEST + *logofs << "Statistics: Updated total proxy writes out to " + << transportTotal_.proxyWritesOut_ << " at " + << strMsTimestamp() << ".\n" << logofs_flush; + #endif + } + + void addCompressedBytes(unsigned int bytesIn, unsigned int bytesOut); + + void addDecompressedBytes(unsigned int bytesIn, unsigned int bytesOut) + { + transportPartial_.decompressedBytesIn_ += bytesIn; + transportTotal_.decompressedBytesIn_ += bytesIn; + + transportPartial_.decompressedBytesOut_ += bytesOut; + transportTotal_.decompressedBytesOut_ += bytesOut; + } + + void addFramingBits(unsigned int bitsOut) + { + transportPartial_.framingBitsOut_ += bitsOut; + transportTotal_.framingBitsOut_ += bitsOut; + + proxyData_.protocolCount_ += bitsOut; + } + + void addCachedRequest(unsigned int opcode) + { + protocolPartial_.requestCached_[opcode]++; + protocolTotal_.requestCached_[opcode]++; + } + + void addRenderCachedRequest(unsigned int opcode) + { + protocolPartial_.renderRequestCached_[opcode]++; + protocolTotal_.renderRequestCached_[opcode]++; + } + + void addRepliedRequest(unsigned int opcode) + { + protocolPartial_.requestReplied_[opcode]++; + protocolTotal_.requestReplied_[opcode]++; + } + + void addCachedReply(unsigned int opcode) + { + protocolPartial_.replyCached_[opcode]++; + protocolTotal_.replyCached_[opcode]++; + } + + void addRequestBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) + { + #ifdef DEBUG + *logofs << "Statistcs: Added " << bitsIn << " bits in and " + << bitsOut << " bits out to opcode " << opcode + << ".\n" << logofs_flush; + #endif + + protocolPartial_.requestCount_[opcode]++; + protocolTotal_.requestCount_[opcode]++; + + protocolPartial_.requestBitsIn_[opcode] += bitsIn; + protocolTotal_.requestBitsIn_[opcode] += bitsIn; + + protocolPartial_.requestBitsOut_[opcode] += bitsOut; + protocolTotal_.requestBitsOut_[opcode] += bitsOut; + + // + // Don't account the split bits + // to the control token. + // + + if (opcode != X_NXSplitData && opcode != X_NXSplitEvent) + { + proxyData_.protocolCount_ += bitsOut; + } + } + + void addRenderRequestBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) + { + #ifdef DEBUG + *logofs << "Statistcs: Added " << bitsIn << " bits in and " + << bitsOut << " bits out to render opcode " << opcode + << ".\n" << logofs_flush; + #endif + + protocolPartial_.renderRequestCount_[opcode]++; + protocolTotal_.renderRequestCount_[opcode]++; + + protocolPartial_.renderRequestBitsIn_[opcode] += bitsIn; + protocolTotal_.renderRequestBitsIn_[opcode] += bitsIn; + + protocolPartial_.renderRequestBitsOut_[opcode] += bitsOut; + protocolTotal_.renderRequestBitsOut_[opcode] += bitsOut; + } + + void addReplyBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.replyCount_[opcode]++; + protocolTotal_.replyCount_[opcode]++; + + protocolPartial_.replyBitsIn_[opcode] += bitsIn; + protocolTotal_.replyBitsIn_[opcode] += bitsIn; + + protocolPartial_.replyBitsOut_[opcode] += bitsOut; + protocolTotal_.replyBitsOut_[opcode] += bitsOut; + + proxyData_.protocolCount_ += bitsOut; + } + + void addEventBits(unsigned int opcode, unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.eventCount_[opcode]++; + protocolTotal_.eventCount_[opcode]++; + + protocolPartial_.eventBitsIn_[opcode] += bitsIn; + protocolTotal_.eventBitsIn_[opcode] += bitsIn; + + protocolPartial_.eventBitsOut_[opcode] += bitsOut; + protocolTotal_.eventBitsOut_[opcode] += bitsOut; + + proxyData_.protocolCount_ += bitsOut; + } + + void addCupsBits(unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.cupsCount_++; + protocolTotal_.cupsCount_++; + + protocolPartial_.cupsBitsIn_ += bitsIn; + protocolTotal_.cupsBitsIn_ += bitsIn; + + protocolPartial_.cupsBitsOut_ += bitsOut; + protocolTotal_.cupsBitsOut_ += bitsOut; + } + + void addSmbBits(unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.smbCount_++; + protocolTotal_.smbCount_++; + + protocolPartial_.smbBitsIn_ += bitsIn; + protocolTotal_.smbBitsIn_ += bitsIn; + + protocolPartial_.smbBitsOut_ += bitsOut; + protocolTotal_.smbBitsOut_ += bitsOut; + } + + void addMediaBits(unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.mediaCount_++; + protocolTotal_.mediaCount_++; + + protocolPartial_.mediaBitsIn_ += bitsIn; + protocolTotal_.mediaBitsIn_ += bitsIn; + + protocolPartial_.mediaBitsOut_ += bitsOut; + protocolTotal_.mediaBitsOut_ += bitsOut; + } + + void addHttpBits(unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.httpCount_++; + protocolTotal_.httpCount_++; + + protocolPartial_.httpBitsIn_ += bitsIn; + protocolTotal_.httpBitsIn_ += bitsIn; + + protocolPartial_.httpBitsOut_ += bitsOut; + protocolTotal_.httpBitsOut_ += bitsOut; + } + + void addFontBits(unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.fontCount_++; + protocolTotal_.fontCount_++; + + protocolPartial_.fontBitsIn_ += bitsIn; + protocolTotal_.fontBitsIn_ += bitsIn; + + protocolPartial_.fontBitsOut_ += bitsOut; + protocolTotal_.fontBitsOut_ += bitsOut; + } + + void addSlaveBits(unsigned int bitsIn, unsigned int bitsOut) + { + protocolPartial_.slaveCount_++; + protocolTotal_.slaveCount_++; + + protocolPartial_.slaveBitsIn_ += bitsIn; + protocolTotal_.slaveBitsIn_ += bitsIn; + + protocolPartial_.slaveBitsOut_ += bitsOut; + protocolTotal_.slaveBitsOut_ += bitsOut; + } + + void addPackedBytesIn(unsigned int numBytes) + { + packedPartial_.packedBytesIn_ += numBytes; + packedTotal_.packedBytesIn_ += numBytes; + } + + void addPackedBytesOut(unsigned int numBytes) + { + packedPartial_.packedBytesOut_ += numBytes; + packedTotal_.packedBytesOut_ += numBytes; + } + + void addSplit() + { + splitPartial_.splitCount_++; + splitTotal_.splitCount_++; + } + + void addSplitAborted() + { + splitPartial_.splitAborted_++; + splitTotal_.splitAborted_++; + } + + void addSplitAbortedBytesOut(unsigned int numBytes) + { + splitPartial_.splitAbortedBytesOut_ += numBytes; + splitTotal_.splitAbortedBytesOut_ += numBytes; + } + + // + // Add the recorded protocol data to the proxy + // token counters. We want to send bpth the token + // request message and the data payload using a + // single system write, so we must guess how many + // output bytes we will generate. + // + + void updateControlToken(int &count) + { + // + // Total is the total number of protocol bytes + // generated so far. We have saved the number + // of bytes generated the last time the function + // was called so we can calculate the difference. + // + // The number of protocol bits is updated as soon + // as new bits are accumulated, to avoid summing + // up all the opcodes in this routine. We add a + // byte to the control bytes difference to account + // for the framing bits that are very likely to + // be added to the payload. + // + + double total = proxyData_.protocolCount_ / 8; + + double diff = total - proxyData_.controlCount_ + 1; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Protocol bytes are " + << total << " control bytes are " + << proxyData_.controlCount_ << " difference is " + << diff << ".\n" << logofs_flush; + #endif + + count += (int) (diff / proxyData_.streamRatio_); + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Adding " + << (int) (diff / proxyData_.streamRatio_) + << " bytes to the control token with ratio " + << proxyData_.streamRatio_ << ".\n" + << logofs_flush; + #endif + + proxyData_.controlCount_ = total; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! New control token has " + << count << " bytes with total control bytes " + << proxyData_.controlCount_ << ".\n" + << logofs_flush; + #endif + } + + void updateSplitToken(int &count) + { + double total = (protocolTotal_.requestBitsOut_[X_NXSplitData] + + protocolTotal_.eventBitsOut_[X_NXSplitEvent]) / 8; + + double diff = total - proxyData_.splitCount_; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Protocol bytes are " + << total << " split bytes are " + << proxyData_.splitCount_ << " difference is " + << diff << ".\n" << logofs_flush; + #endif + + count += (int) (diff / proxyData_.streamRatio_); + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Adding " + << (int) (diff / proxyData_.streamRatio_) + << " bytes to the split token with ratio " + << proxyData_.streamRatio_ << ".\n" + << logofs_flush; + #endif + + proxyData_.splitCount_ = total; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! New split token has " + << count << " bytes with total split bytes " + << proxyData_.splitCount_ << ".\n" + << logofs_flush; + #endif + } + + void updateDataToken(int &count) + { + double total = (protocolTotal_.cupsBitsOut_ + + protocolTotal_.smbBitsOut_ + + protocolTotal_.mediaBitsOut_ + + protocolTotal_.httpBitsOut_ + + protocolTotal_.fontBitsOut_ + + protocolTotal_.slaveBitsOut_) / 8; + + double diff = total - proxyData_.dataCount_; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Protocol bytes are " + << total << " data bytes are " + << proxyData_.dataCount_ << " difference is " + << diff << ".\n" << logofs_flush; + #endif + + count += (int) (diff / proxyData_.streamRatio_); + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! Adding " + << (int) (diff / proxyData_.streamRatio_) + << " bytes to the data token with ratio " + << proxyData_.streamRatio_ << ".\n" + << logofs_flush; + #endif + + proxyData_.dataCount_ = total; + + #if defined(TEST) || defined(TOKEN) + *logofs << "Statistics: TOKEN! New data token has " + << count << " bytes with total data bytes " + << proxyData_.dataCount_ << ".\n" + << logofs_flush; + #endif + } + + // + // Update the current bitrate. + // + + void updateBitrate(int bytes); + + // + // Return the current bitrate. + // + + int getBitrateInShortFrame() + { + return bitrateInShortFrame_; + } + + int getBitrateInLongFrame() + { + return bitrateInLongFrame_; + } + + int getTopBitrate() + { + return topBitrate_; + } + + void resetTopBitrate() + { + topBitrate_ = 0; + } + + double getStreamRatio() + { + return proxyData_.streamRatio_; + } + + // + // Manage the congestion level. + // + + void updateCongestion(int remaining, int limit); + + double getCongestionInFrame() + { + return congestionInFrame_; + } + + // + // Produce a dump of the statistics on + // the provided buffer. + // + + int getClientCacheStats(int type, char *&buffer); + int getClientProtocolStats(int type, char *&buffer); + int getClientOverallStats(int type, char *&buffer); + + int getServerCacheStats(int type, char *&buffer); + int getServerProtocolStats(int type, char *&buffer); + int getServerOverallStats(int type, char *&buffer); + + int resetPartialStats(); + + private: + + int getTimeStats(int type, char *&buffer); + int getServicesStats(int type, char *&buffer); + int getFramingStats(int type, char *&buffer); + int getBitrateStats(int type, char *&buffer); + int getStreamStats(int type, char *&buffer); + int getSplitStats(int type, char *&buffer); + + struct T_protocolData + { + double requestCached_[STATISTICS_OPCODE_MAX]; + double requestReplied_[STATISTICS_OPCODE_MAX]; + double requestCount_[STATISTICS_OPCODE_MAX]; + double requestBitsIn_[STATISTICS_OPCODE_MAX]; + double requestBitsOut_[STATISTICS_OPCODE_MAX]; + + double renderRequestCached_[STATISTICS_OPCODE_MAX]; + double renderRequestCount_[STATISTICS_OPCODE_MAX]; + double renderRequestBitsIn_[STATISTICS_OPCODE_MAX]; + double renderRequestBitsOut_[STATISTICS_OPCODE_MAX]; + + double replyCached_[STATISTICS_OPCODE_MAX]; + double replyCount_[STATISTICS_OPCODE_MAX]; + double replyBitsIn_[STATISTICS_OPCODE_MAX]; + double replyBitsOut_[STATISTICS_OPCODE_MAX]; + + double eventCached_[STATISTICS_OPCODE_MAX]; + double eventCount_[STATISTICS_OPCODE_MAX]; + double eventBitsIn_[STATISTICS_OPCODE_MAX]; + double eventBitsOut_[STATISTICS_OPCODE_MAX]; + + double cupsCount_; + double cupsBitsIn_; + double cupsBitsOut_; + + double smbCount_; + double smbBitsIn_; + double smbBitsOut_; + + double mediaCount_; + double mediaBitsIn_; + double mediaBitsOut_; + + double httpCount_; + double httpBitsIn_; + double httpBitsOut_; + + double fontCount_; + double fontBitsIn_; + double fontBitsOut_; + + double slaveCount_; + double slaveBitsIn_; + double slaveBitsOut_; + }; + + struct T_transportData + { + double idleTime_; + double readTime_; + double writeTime_; + + double proxyBytesIn_; + double proxyBytesOut_; + + double proxyFramesIn_; + double proxyFramesOut_; + double proxyWritesOut_; + + double compressedBytesIn_; + double compressedBytesOut_; + + double decompressedBytesIn_; + double decompressedBytesOut_; + + double framingBitsOut_; + }; + + struct T_packedData + { + double packedBytesIn_; + double packedBytesOut_; + }; + + struct T_splitData + { + double splitCount_; + double splitAborted_; + double splitAbortedBytesOut_; + }; + + struct T_overallData + { + double overallBytesIn_; + double overallBytesOut_; + }; + + struct T_proxyData + { + double protocolCount_; + double controlCount_; + double splitCount_; + double dataCount_; + + double streamRatio_; + }; + + T_protocolData protocolPartial_; + T_protocolData protocolTotal_; + + T_transportData transportPartial_; + T_transportData transportTotal_; + + T_packedData packedPartial_; + T_packedData packedTotal_; + + T_splitData splitPartial_; + T_splitData splitTotal_; + + T_overallData overallPartial_; + T_overallData overallTotal_; + + T_proxyData proxyData_; + + // + // Used to calculate the bandwidth usage + // of the proxy link. + // + + T_timestamp startShortFrameTs_; + T_timestamp startLongFrameTs_; + T_timestamp startFrameTs_; + + int bytesInShortFrame_; + int bytesInLongFrame_; + + int bitrateInShortFrame_; + int bitrateInLongFrame_; + + int topBitrate_; + + double congestionInFrame_; + + // + // Need the proxy pointer to print the + // statistics related to the client and + // server stores and to add the protocol + // data to the proxy token accumulators. + // + + Proxy *proxy_; +}; + +#endif /* Statistics_H */ diff --git a/nxcomp/src/Timestamp.cpp b/nxcomp/src/Timestamp.cpp new file mode 100644 index 000000000..e7e0c494a --- /dev/null +++ b/nxcomp/src/Timestamp.cpp @@ -0,0 +1,77 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Timestamp.h" + +// +// Log level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Last timestamp taken from the system. +// + +T_timestamp timestamp; + +// +// The following functions all use the ctime +// static buffer from the C library. +// + +char *strTimestamp(const T_timestamp &ts) +{ + char *ctime_now = ctime((time_t *) &ts.tv_sec); + + ctime_now[24] = '\0'; + + return ctime_now; +} + +// +// This is especially dirty. +// + +char *strMsTimestamp(const T_timestamp &ts) +{ + char *ctime_now = ctime((time_t *) &ts.tv_sec); + + char ctime_new[25]; + + sprintf(ctime_new, "%.8s:%3.3f", ctime_now + 11, + (float) ts.tv_usec / 1000); + + strncpy(ctime_now, ctime_new, 24); + + return ctime_now; +} diff --git a/nxcomp/src/Timestamp.h b/nxcomp/src/Timestamp.h new file mode 100644 index 000000000..604f5a3bc --- /dev/null +++ b/nxcomp/src/Timestamp.h @@ -0,0 +1,307 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Timestamp_H +#define Timestamp_H + +#include +#include +#include + +#include +#include + +#include "Misc.h" + +// +// Log level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// If not defined, always query the system time. +// + +#undef CACHE_TIMESTAMP + +// +// Log a warning if the time difference since +// the last update exceeds the given number +// of milliseconds. +// + +#define DRIFT_TIMESTAMP 1 + +// +// Type used for timeout manipulation. +// + +typedef struct timeval T_timestamp; + +// +// Last timestamp taken from the system. If the +// timestamp is cached, we need to explicitly +// get a new timestamp after any operation that +// may have required a relevant amount of time. +// + +extern T_timestamp timestamp; + +// +// Get a timestamp instance with values set +// at the given amount of milliseconds. +// + +inline T_timestamp getTimestamp(long ms) +{ + struct timeval ts; + + ts.tv_sec = ms / 1000; + ts.tv_usec = (ms % 1000) * 1000; + + return ts; +} + +// +// Return the difference in milliseconds +// between the two timestamps. +// + +inline long diffTimestamp(const T_timestamp &ts1, const T_timestamp &ts2) +{ + // + // Add 500 microseconds to round up + // to the nearest millisecond. + // + + return ((ts2.tv_sec * 1000 + (ts2.tv_usec + 500) / 1000) - + (ts1.tv_sec * 1000 + (ts1.tv_usec + 500) / 1000)); +} + +// +// The same in microseconds. It doesn't +// round the value. +// + +inline long diffUsTimestamp(const T_timestamp &ts1, const T_timestamp &ts2) +{ + return ((ts2.tv_sec * 1000000 + ts2.tv_usec) - + (ts1.tv_sec * 1000000 + ts1.tv_usec)); +} + +// +// Return the last timestamp taken from the +// system. It doesn't update the timestamp. +// + +inline T_timestamp getTimestamp() +{ + #ifdef CACHE_TIMESTAMP + + #ifdef TEST + + T_timestamp ts; + + gettimeofday(&ts, NULL); + + long diffTs = diffTimestamp(timestamp, ts); + + if (diffTs > DRIFT_TIMESTAMP) + { + *logofs << "Timestamp: WARNING! Time difference since the " + << "current timestamp is " << diffTs << " Ms.\n" + << logofs_flush; + } + + #endif + + return timestamp; + + #else + + gettimeofday(×tamp, NULL); + + return timestamp; + + #endif +} + +inline T_timestamp &setTimestamp(T_timestamp &ts, long ms) +{ + ts.tv_sec = ms / 1000; + ts.tv_usec = (ms % 1000) * 1000; + + return ts; +} + +// +// Return the smaller between two timestamps. +// + +inline T_timestamp &setMinTimestamp(T_timestamp &ts, long ms) +{ + if ((ts.tv_sec * 1000 + ts.tv_usec / 1000) > ms) + { + ts.tv_sec = ms / 1000; + ts.tv_usec = (ms % 1000) * 1000; + } + + return ts; +} + +inline T_timestamp &setMinTimestamp(T_timestamp &ts1, T_timestamp &ts2) +{ + if ((ts1.tv_sec * 1000000 + ts1.tv_usec) > + (ts2.tv_sec * 1000000 + ts2.tv_usec)) + { + ts1.tv_sec = ts2.tv_sec; + ts1.tv_usec = ts2.tv_usec; + } + + return ts1; +} + +// +// Convert a timestamp in the total number +// of milliseconds. +// + +inline long getMsTimestamp(const T_timestamp &ts) +{ + return ts.tv_sec * 1000 + ts.tv_usec / 1000; +} + +// +// A 0 value on both seconds and microseconds +// fields means that timestamp is invalid or +// not set. +// + +inline T_timestamp nullTimestamp() +{ + struct timeval ts; + + ts.tv_sec = 0; + ts.tv_usec = 0; + + return ts; +} + +inline bool isTimestamp(const T_timestamp &ts) +{ + if (ts.tv_sec == 0 && ts.tv_usec == 0) + { + return 0; + } + + return 1; +} + +inline void subMsTimestamp(T_timestamp &ts, long ms) +{ + ts.tv_sec -= ms / 1000; + ts.tv_usec -= (ms % 1000) * 1000; +} + +inline void addMsTimestamp(T_timestamp &ts, long ms) +{ + ts.tv_sec += ms / 1000; + ts.tv_usec += (ms % 1000) * 1000; +} + +// +// Check the difference between timestamps. +// Return 0 if the system time went backward +// compared to the second timestamp, or the +// difference between the timestamps exceeds +// the given number of milliseconds. +// + +inline int checkDiffTimestamp(const T_timestamp &ts1, const T_timestamp &ts2, + long ms = 30000) +{ + long diffTs = diffTimestamp(ts1, ts2); + + if (diffTs < 0 || diffTs > ms) + { + return 0; + } + + return 1; +} + +// +// Return a string representing the timestamp. +// + +char *strTimestamp(const T_timestamp &ts); +char *strMsTimestamp(const T_timestamp &ts); + +inline char *strTimestamp() +{ + return strTimestamp(getTimestamp()); +} + +inline char *strMsTimestamp() +{ + return strMsTimestamp(getTimestamp()); +} + +// +// Update the current timestamp. +// + +inline T_timestamp getNewTimestamp() +{ + #ifdef TEST + + T_timestamp ts; + + gettimeofday(&ts, NULL); + + *logofs << "Timestamp: Updating the current timestamp at " + << strMsTimestamp(ts) << ".\n" << logofs_flush; + + long diffTs = diffTimestamp(timestamp, ts); + + if (diffTs > DRIFT_TIMESTAMP) + { + *logofs << "Timestamp: WARNING! Time difference since the " + << "old timestamp is " << diffTs << " Ms.\n" + << logofs_flush; + } + + #endif + + gettimeofday(×tamp, NULL); + + return timestamp; +} + +#endif /* Timestamp_H */ diff --git a/nxcomp/src/TranslateCoords.cpp b/nxcomp/src/TranslateCoords.cpp new file mode 100644 index 000000000..f61caea47 --- /dev/null +++ b/nxcomp/src/TranslateCoords.cpp @@ -0,0 +1,115 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "TranslateCoords.h" + +#include "ClientCache.h" + +#include "EncodeBuffer.h" +#include "DecodeBuffer.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Here are the methods to handle messages' content. +// + +int TranslateCoordsStore::parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; + + // + // Here is the fingerprint. + // + + translateCoords -> src_window = GetULONG(buffer + 4, bigEndian); + translateCoords -> dst_window = GetULONG(buffer + 8, bigEndian); + + translateCoords -> src_x = GetUINT(buffer + 12, bigEndian); + translateCoords -> src_y = GetUINT(buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Parsed Identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +int TranslateCoordsStore::unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; + + // + // Fill all the message's fields. + // + + PutULONG(translateCoords -> src_window, buffer + 4, bigEndian); + PutULONG(translateCoords -> dst_window, buffer + 8, bigEndian); + + PutUINT(translateCoords -> src_x, buffer + 12, bigEndian); + PutUINT(translateCoords -> src_y, buffer + 14, bigEndian); + + #ifdef DEBUG + *logofs << name() << ": Unparsed identity for message at " << this << ".\n" << logofs_flush; + #endif + + return 1; +} + +void TranslateCoordsStore::dumpIdentity(const Message *message) const +{ + #ifdef DUMP + + TranslateCoordsMessage *translateCoords = (TranslateCoordsMessage *) message; + + *logofs << name() << ": Identity src_window " << translateCoords -> src_window << ", dst_window " + << translateCoords -> dst_window << ", src_x " << translateCoords -> src_x << ", src_y " + << translateCoords -> src_y << ", size " << translateCoords -> size_ << ".\n" << logofs_flush; + + #endif +} + +void TranslateCoordsStore::identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const +{ + md5_append(md5_state_, buffer + 4, 4); + md5_append(md5_state_, buffer + 8, 4); + md5_append(md5_state_, buffer + 12, 2); + md5_append(md5_state_, buffer + 14, 2); +} diff --git a/nxcomp/src/TranslateCoords.h b/nxcomp/src/TranslateCoords.h new file mode 100644 index 000000000..997d079e1 --- /dev/null +++ b/nxcomp/src/TranslateCoords.h @@ -0,0 +1,185 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef TranslateCoords_H +#define TranslateCoords_H + +#include "Message.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef DUMP + +// +// Set default values. +// + +#define TRANSLATECOORDS_ENABLE_CACHE 1 +#define TRANSLATECOORDS_ENABLE_DATA 0 +#define TRANSLATECOORDS_ENABLE_SPLIT 0 +#define TRANSLATECOORDS_ENABLE_COMPRESS 0 + +#define TRANSLATECOORDS_DATA_LIMIT 0 +#define TRANSLATECOORDS_DATA_OFFSET 16 + +#define TRANSLATECOORDS_CACHE_SLOTS 3000 +#define TRANSLATECOORDS_CACHE_THRESHOLD 3 +#define TRANSLATECOORDS_CACHE_LOWER_THRESHOLD 1 + +// +// The message class. +// + +class TranslateCoordsMessage : public Message +{ + friend class TranslateCoordsStore; + + public: + + TranslateCoordsMessage() + { + } + + ~TranslateCoordsMessage() + { + } + + // + // Put here the fields which constitute + // the 'identity' part of the message. + // + + private: + + unsigned int src_window; + unsigned int dst_window; + unsigned int src_x; + unsigned int src_y; + + unsigned char r_same_screen; + unsigned int r_child_window; + unsigned int r_dst_x; + unsigned int r_dst_y; +}; + +class TranslateCoordsStore : public MessageStore +{ + // + // Constructors and destructors. + // + + public: + + TranslateCoordsStore() : MessageStore() + { + enableCache = TRANSLATECOORDS_ENABLE_CACHE; + enableData = TRANSLATECOORDS_ENABLE_DATA; + enableSplit = TRANSLATECOORDS_ENABLE_SPLIT; + enableCompress = TRANSLATECOORDS_ENABLE_COMPRESS; + + dataLimit = TRANSLATECOORDS_DATA_LIMIT; + dataOffset = TRANSLATECOORDS_DATA_OFFSET; + + cacheSlots = TRANSLATECOORDS_CACHE_SLOTS; + cacheThreshold = TRANSLATECOORDS_CACHE_THRESHOLD; + cacheLowerThreshold = TRANSLATECOORDS_CACHE_LOWER_THRESHOLD; + + messages_ -> resize(cacheSlots); + + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + *i = NULL; + } + + temporary_ = NULL; + } + + virtual ~TranslateCoordsStore() + { + for (T_messages::iterator i = messages_ -> begin(); + i < messages_ -> end(); i++) + { + destroy(*i); + } + + destroy(temporary_); + } + + virtual const char *name() const + { + return "TranslateCoords"; + } + + virtual unsigned char opcode() const + { + return X_TranslateCoords; + } + + virtual unsigned int storage() const + { + return sizeof(TranslateCoordsMessage); + } + + // + // Message handling methods. + // + + public: + + virtual Message *create() const + { + return new TranslateCoordsMessage(); + } + + virtual Message *create(const Message &message) const + { + return new TranslateCoordsMessage((const TranslateCoordsMessage &) message); + } + + virtual void destroy(Message *message) const + { + delete (TranslateCoordsMessage *) message; + } + + virtual int parseIdentity(Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual int unparseIdentity(const Message *message, unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void identityChecksum(const Message *message, const unsigned char *buffer, + unsigned int size, int bigEndian) const; + + virtual void dumpIdentity(const Message *message) const; +}; + +#endif /* TranslateCoords_H */ diff --git a/nxcomp/src/Transport.cpp b/nxcomp/src/Transport.cpp new file mode 100644 index 000000000..e34544994 --- /dev/null +++ b/nxcomp/src/Transport.cpp @@ -0,0 +1,3068 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include +#include + +#include "Transport.h" + +#include "Statistics.h" + +// +// Set the verbosity level. You also +// need to define DUMP in Misc.cpp +// if DUMP is defined here. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG +#undef INSPECT +#undef DUMP + +// +// Used to lock and unlock the transport +// buffers before they are accessed by +// different threads. +// + +#undef THREADS + +// +// Define this to get logging all the +// operations performed by the parent +// thread, the one that enqueues and +// dequeues data. +// + +#define PARENT + +// +// Define this to know when a channel +// is created or destroyed. +// + +#undef REFERENCES + +// +// Reference count for allocated buffers. +// + +#ifdef REFERENCES + +int Transport::references_; +int ProxyTransport::references_; +int InternalTransport::references_; + +#endif + +// +// This is the base class providing methods for read +// and write buffering. +// + +Transport::Transport(int fd) : fd_(fd) +{ + #ifdef TEST + *logofs << "Transport: Going to create base transport " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + type_ = transport_base; + + // + // Set up the write buffer. + // + + w_buffer_.length_ = 0; + w_buffer_.start_ = 0; + + initialSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE; + thresholdSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE << 1; + maximumSize_ = TRANSPORT_BUFFER_DEFAULT_SIZE << 4; + + w_buffer_.data_.resize(initialSize_); + + // + // Set non-blocking IO on socket. + // + + SetNonBlocking(fd_, 1); + + blocked_ = 0; + finish_ = 0; + + #ifdef REFERENCES + *logofs << "Transport: Created new object at " + << this << " out of " << ++references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +Transport::~Transport() +{ + #ifdef TEST + *logofs << "Transport: Going to destroy base class " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + ::close(fd_); + + #ifdef REFERENCES + *logofs << "Transport: Deleted object at " + << this << " out of " << --references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +// +// Read data from its file descriptor. +// + +int Transport::read(unsigned char *data, unsigned int size) +{ + #ifdef DEBUG + *logofs << "Transport: Going to read " << size << " bytes from " + << "FD#" << fd_ << ".\n" << logofs_flush; + #endif + + // + // Read the available data from the socket. + // + + int result = ::read(fd_, data, size); + + // + // Update the current timestamp as the read + // can have scheduled some other process. + // + + getNewTimestamp(); + + if (result < 0) + { + if (EGET() == EAGAIN) + { + #ifdef TEST + *logofs << "Transport: WARNING! Read of " << size << " bytes from " + << "FD#" << fd_ << " would block.\n" << logofs_flush; + #endif + + return 0; + } + else if (EGET() == EINTR) + { + #ifdef TEST + *logofs << "Transport: Read of " << size << " bytes from " + << "FD#" << fd_ << " was interrupted.\n" + << logofs_flush; + #endif + + return 0; + } + else + { + #ifdef TEST + *logofs << "Transport: Error reading from " + << "FD#" << fd_ << ".\n" << logofs_flush; + #endif + + finish(); + + return -1; + } + } + else if (result == 0) + { + #ifdef TEST + *logofs << "Transport: No data read from " + << "FD#" << fd_ << ".\n" << logofs_flush; + #endif + + finish(); + + return -1; + } + + #ifdef TEST + *logofs << "Transport: Read " << result << " bytes out of " + << size << " from FD#" << fd_ << ".\n" << logofs_flush; + #endif + + #ifdef DUMP + + *logofs << "Transport: Dumping content of read data.\n" + << logofs_flush; + + DumpData(data, result); + + #endif + + return result; +} + +// +// Write as many bytes as possible to socket. +// Append the remaining data bytes to the end +// of the buffer and update length to reflect +// changes. +// + +int Transport::write(T_write type, const unsigned char *data, const unsigned int size) +{ + // + // If an immediate write was requested then + // flush the enqueued data first. + // + // Alternatively may try to write only if + // the socket is not blocked. + // + // if (w_buffer_.length_ > 0 && blocked_ == 0 && + // type == write_immediate) + // { + // ... + // } + // + + if (w_buffer_.length_ > 0 && type == write_immediate) + + { + #ifdef TEST + *logofs << "Transport: Writing " << w_buffer_.length_ + << " bytes of previous data to FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + int result = Transport::flush(); + + if (result < 0) + { + return -1; + } + } + + // + // If nothing is remained, write immediately + // to the socket. + // + + unsigned int written = 0; + + if (w_buffer_.length_ == 0 && blocked_ == 0 && + type == write_immediate) + { + // + // Limit the amount of data sent. + // + + unsigned int toWrite = size; + + #ifdef DUMP + + *logofs << "Transport: Going to write " << toWrite + << " bytes to FD#" << fd_ << " with checksum "; + + DumpChecksum(data, size); + + *logofs << ".\n" << logofs_flush; + + #endif + + T_timestamp writeTs; + + int diffTs; + + while (written < toWrite) + { + // + // Trace system time spent writing data. + // + + writeTs = getTimestamp(); + + int result = ::write(fd_, data + written, toWrite - written); + + diffTs = diffTimestamp(writeTs, getNewTimestamp()); + + statistics -> addWriteTime(diffTs); + + if (result <= 0) + { + if (EGET() == EAGAIN) + { + #ifdef TEST + *logofs << "Transport: Write of " << toWrite - written + << " bytes on FD#" << fd_ << " would block.\n" + << logofs_flush; + #endif + + blocked_ = 1; + + break; + } + else if (EGET() == EINTR) + { + #ifdef TEST + *logofs << "Transport: Write of " << toWrite - written + << " bytes on FD#" << fd_ << " was interrupted.\n" + << logofs_flush; + #endif + + continue; + } + else + { + #ifdef TEST + *logofs << "Transport: Write to " << "FD#" + << fd_ << " failed.\n" << logofs_flush; + #endif + + finish(); + + return -1; + } + } + else + { + #ifdef TEST + *logofs << "Transport: Immediately written " << result + << " bytes on " << "FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + written += result; + } + } + + #ifdef DUMP + + if (written > 0) + { + *logofs << "Transport: Dumping content of immediately written data.\n" + << logofs_flush; + + DumpData(data, written); + } + + #endif + } + + if (written == size) + { + // + // We will not affect the write buffer. + // + + return written; + } + + #ifdef DEBUG + *logofs << "Transport: Going to append " << size - written + << " bytes to write buffer for " << "FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + if (resize(w_buffer_, size - written) < 0) + { + return -1; + } + + memmove(w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_, + data + written, size - written); + + w_buffer_.length_ += size - written; + + #ifdef TEST + *logofs << "Transport: Write buffer for FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "Transport: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " size is " + << w_buffer_.data_.size() << " capacity is " + << w_buffer_.data_.capacity() << ".\n" + << logofs_flush; + #endif + + // + // Note that this function always returns the whole + // size of buffer that was provided, either if not + // all the data could be actually written. + // + + return size; +} + +// +// Write pending data to its file descriptor. +// + +int Transport::flush() +{ + if (w_buffer_.length_ == 0) + { + #ifdef TEST + *logofs << "Transport: No data to flush on " + << "FD#" << fd_ << ".\n" << logofs_flush; + #endif + + #ifdef WARNING + if (blocked_ != 0) + { + *logofs << "Transport: Blocked flag is " << blocked_ + << " with no data to flush on FD#" << fd_ + << ".\n" << logofs_flush; + } + #endif + + return 0; + } + + // + // It's time to move data from the + // write buffer to the real link. + // + + int written = 0; + + int toWrite = w_buffer_.length_; + + // + // We will do our best to write any available + // data to the socket, so let's say we start + // from a clean state. + // + + blocked_ = 0; + + #ifdef TEST + *logofs << "Transport: Going to flush " << toWrite + << " bytes on FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + T_timestamp writeTs; + + int diffTs; + + while (written < toWrite) + { + writeTs = getTimestamp(); + + int result = ::write(fd_, w_buffer_.data_.begin() + w_buffer_.start_ + + written, toWrite - written); + + diffTs = diffTimestamp(writeTs, getNewTimestamp()); + + statistics -> addWriteTime(diffTs); + + if (result <= 0) + { + if (EGET() == EAGAIN) + { + #ifdef TEST + *logofs << "Transport: Write of " << toWrite - written + << " bytes on FD#" << fd_ << " would block.\n" + << logofs_flush; + #endif + + blocked_ = 1; + + break; + } + else if (EGET() == EINTR) + { + #ifdef TEST + *logofs << "Transport: Write of " << toWrite - written + << " bytes on FD#" << fd_ << " was interrupted.\n" + << logofs_flush; + #endif + + continue; + } + else + { + #ifdef TEST + *logofs << "Transport: Write to " << "FD#" + << fd_ << " failed.\n" << logofs_flush; + #endif + + finish(); + + return -1; + } + } + else + { + #ifdef TEST + *logofs << "Transport: Flushed " << result << " bytes on " + << "FD#" << fd_ << ".\n" << logofs_flush; + #endif + + written += result; + } + } + + if (written > 0) + { + #ifdef DUMP + + *logofs << "Transport: Dumping content of flushed data.\n" + << logofs_flush; + + DumpData(w_buffer_.data_.begin() + w_buffer_.start_, written); + + #endif + + // + // Update the buffer status. + // + + w_buffer_.length_ -= written; + + if (w_buffer_.length_ == 0) + { + w_buffer_.start_ = 0; + } + else + { + w_buffer_.start_ += written; + } + } + + // + // It can be that we wrote less bytes than + // available because of the write limit. + // + + if (w_buffer_.length_ > 0) + { + #ifdef TEST + *logofs << "Transport: There are still " << w_buffer_.length_ + << " bytes in write buffer for " << "FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + blocked_ = 1; + } + + #ifdef TEST + *logofs << "Transport: Write buffer for FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "Transport: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " size is " + << w_buffer_.data_.size() << " capacity is " + << w_buffer_.data_.capacity() << ".\n" + << logofs_flush; + #endif + + // + // No new data was produced for the link except + // any outstanding data from previous writes. + // + + return 0; +} + +int Transport::drain(int limit, int timeout) +{ + if (w_buffer_.length_ <= limit) + { + return 1; + } + + // + // Write the data accumulated in the write + // buffer until it is below the limit or + // the timeout is elapsed. + // + + int toWrite = w_buffer_.length_; + + int written = 0; + + #ifdef TEST + *logofs << "Transport: Draining " << toWrite - limit + << " bytes on FD#" << fd_ << " with limit set to " + << limit << ".\n" << logofs_flush; + #endif + + T_timestamp startTs = getNewTimestamp(); + + T_timestamp selectTs; + T_timestamp writeTs; + T_timestamp idleTs; + + T_timestamp nowTs = startTs; + + int diffTs; + + fd_set writeSet; + fd_set readSet; + + FD_ZERO(&writeSet); + FD_ZERO(&readSet); + + int result; + int ready; + + while (w_buffer_.length_ - written > limit) + { + nowTs = getNewTimestamp(); + + // + // Wait for descriptor to become + // readable or writable. + // + + FD_SET(fd_, &writeSet); + FD_SET(fd_, &readSet); + + setTimestamp(selectTs, timeout / 2); + + idleTs = nowTs; + + result = select(fd_ + 1, &readSet, &writeSet, NULL, &selectTs); + + nowTs = getNewTimestamp(); + + diffTs = diffTimestamp(idleTs, nowTs); + + statistics -> addIdleTime(diffTs); + + statistics -> subReadTime(diffTs); + + if (result < 0) + { + if (EGET() == EINTR) + { + #ifdef TEST + *logofs << "Transport: Select on FD#" << fd_ + << " was interrupted.\n" << logofs_flush; + #endif + + continue; + } + else + { + #ifdef TEST + *logofs << "Transport: Select on FD#" << fd_ + << " failed.\n" << logofs_flush; + #endif + + finish(); + + return -1; + } + } + else if (result > 0) + { + ready = result; + + if (FD_ISSET(fd_, &writeSet)) + { + writeTs = getNewTimestamp(); + + result = ::write(fd_, w_buffer_.data_.begin() + w_buffer_.start_ + + written, toWrite - written); + + nowTs = getNewTimestamp(); + + diffTs = diffTimestamp(writeTs, nowTs); + + statistics -> addWriteTime(diffTs); + + if (result > 0) + { + #ifdef TEST + *logofs << "Transport: Forced flush of " << result + << " bytes on " << "FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + written += result; + } + else if (result < 0 && EGET() == EINTR) + { + #ifdef TEST + *logofs << "Transport: Write to FD#" << fd_ + << " was interrupted.\n" << logofs_flush; + #endif + + continue; + } + else + { + #ifdef TEST + *logofs << "Transport: Write to FD#" << fd_ + << " failed.\n" << logofs_flush; + #endif + + finish(); + + return -1; + } + + ready--; + } + + if (ready > 0) + { + if (FD_ISSET(fd_, &readSet)) + { + #ifdef TEST + *logofs << "Transport: Not draining further " + << "due to data readable on FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + break; + } + } + } + #ifdef TEST + else + { + *logofs << "Transport: Timeout encountered " + << "waiting for FD#" << fd_ << ".\n" + << logofs_flush; + } + #endif + + nowTs = getNewTimestamp(); + + diffTs = diffTimestamp(startTs, nowTs); + + if (diffTs >= timeout) + { + #ifdef TEST + *logofs << "Transport: Not draining further " + << "due to the timeout on FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + break; + } + } + + if (written > 0) + { + #ifdef DUMP + + *logofs << "Transport: Dumping content of flushed data.\n" + << logofs_flush; + + DumpData(w_buffer_.data_.begin() + w_buffer_.start_, written); + + #endif + + // + // Update the buffer status. + // + + w_buffer_.length_ -= written; + + if (w_buffer_.length_ == 0) + { + w_buffer_.start_ = 0; + + blocked_ = 0; + } + else + { + w_buffer_.start_ += written; + + #ifdef TEST + *logofs << "Transport: There are still " << w_buffer_.length_ + << " bytes in write buffer for " << "FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + blocked_ = 1; + } + } + #ifdef TEST + else + { + *logofs << "Transport: WARNING! No data written to FD#" << fd_ + << " with " << toWrite << " bytes to drain and limit " + << "set to " << limit << ".\n" << logofs_flush; + } + #endif + + #ifdef TEST + *logofs << "Transport: Write buffer for FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "Transport: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " size is " + << w_buffer_.data_.size() << " capacity is " + << w_buffer_.data_.capacity() << ".\n" + << logofs_flush; + #endif + + return (w_buffer_.length_ <= limit); +} + +int Transport::wait(int timeout) const +{ + T_timestamp startTs = getNewTimestamp(); + + T_timestamp idleTs; + T_timestamp selectTs; + + T_timestamp nowTs = startTs; + + long available = 0; + int result = 0; + + int diffTs; + + fd_set readSet; + + FD_ZERO(&readSet); + FD_SET(fd_, &readSet); + + for (;;) + { + available = readable(); + + diffTs = diffTimestamp(startTs, nowTs); + + if (available != 0 || timeout == 0 || + (diffTs + (timeout / 10)) >= timeout) + { + #ifdef TEST + *logofs << "Transport: There are " << available + << " bytes on FD#" << fd_ << " after " + << diffTs << " Ms.\n" << logofs_flush; + #endif + + return available; + } + else if (available == 0 && result > 0) + { + #ifdef TEST + *logofs << "Transport: Read on " << "FD#" + << fd_ << " failed.\n" << logofs_flush; + #endif + + return -1; + } + + // + // TODO: Should subtract the time + // already spent in select. + // + + selectTs.tv_sec = 0; + selectTs.tv_usec = timeout * 1000; + + idleTs = nowTs; + + // + // Wait for descriptor to become readable. + // + + result = select(fd_ + 1, &readSet, NULL, NULL, &selectTs); + + nowTs = getNewTimestamp(); + + diffTs = diffTimestamp(idleTs, nowTs); + + statistics -> addIdleTime(diffTs); + + statistics -> subReadTime(diffTs); + + if (result < 0) + { + if (EGET() == EINTR) + { + #ifdef TEST + *logofs << "Transport: Select on FD#" << fd_ + << " was interrupted.\n" << logofs_flush; + #endif + + continue; + } + else + { + #ifdef TEST + *logofs << "Transport: Select on " << "FD#" + << fd_ << " failed.\n" << logofs_flush; + #endif + + return -1; + } + } + #ifdef TEST + else if (result == 0) + { + *logofs << "Transport: No data available on FD#" << fd_ + << " after " << diffTimestamp(startTs, nowTs) + << " Ms.\n" << logofs_flush; + } + else + { + *logofs << "Transport: Data became available on FD#" << fd_ + << " after " << diffTimestamp(startTs, nowTs) + << " Ms.\n" << logofs_flush; + } + #endif + } +} + +void Transport::setSize(unsigned int initialSize, unsigned int thresholdSize, + unsigned int maximumSize) +{ + initialSize_ = initialSize; + thresholdSize_ = thresholdSize; + maximumSize_ = maximumSize; + + #ifdef TEST + *logofs << "Transport: Set buffer sizes for FD#" << fd_ + << " to " << initialSize_ << "/" << thresholdSize_ + << "/" << maximumSize_ << ".\n" << logofs_flush; + #endif +} + +void Transport::fullReset() +{ + blocked_ = 0; + finish_ = 0; + + fullReset(w_buffer_); +} + +int Transport::resize(T_buffer &buffer, const int &size) +{ + if ((int) buffer.data_.size() >= (buffer.length_ + size) && + (buffer.start_ + buffer.length_ + size) > + (int) buffer.data_.size()) + { + if (buffer.length_ > 0) + { + // + // There is enough space in buffer but we need + // to move existing data at the beginning. + // + + #ifdef TEST + *logofs << "Transport: Moving " << buffer.length_ + << " bytes of data for " << "FD#" << fd_ + << " to make room in the buffer.\n" + << logofs_flush; + #endif + + memmove(buffer.data_.begin(), buffer.data_.begin() + + buffer.start_, buffer.length_); + } + + buffer.start_ = 0; + + #ifdef DEBUG + *logofs << "Transport: Made room for " + << buffer.data_.size() - buffer.start_ + << " bytes in buffer for " << "FD#" + << fd_ << ".\n" << logofs_flush; + #endif + } + else if ((buffer.length_ + size) > (int) buffer.data_.size()) + { + // + // Not enough space, so increase + // the size of the buffer. + // + + if (buffer.start_ != 0 && buffer.length_ > 0) + { + #ifdef TEST + *logofs << "Transport: Moving " << buffer.length_ + << " bytes of data for " << "FD#" << fd_ + << " to resize the buffer.\n" + << logofs_flush; + #endif + + memmove(buffer.data_.begin(), buffer.data_.begin() + + buffer.start_, buffer.length_); + } + + buffer.start_ = 0; + + unsigned int newSize = thresholdSize_; + + while (newSize < (unsigned int) buffer.length_ + size) + { + newSize <<= 1; + + if (newSize >= maximumSize_) + { + newSize = buffer.length_ + size + initialSize_; + } + } + + #ifdef DEBUG + *logofs << "Transport: Buffer for " << "FD#" << fd_ + << " will be enlarged from " << buffer.data_.size() + << " to at least " << buffer.length_ + size + << " bytes.\n" << logofs_flush; + #endif + + buffer.data_.resize(newSize); + + #ifdef TEST + if (newSize >= maximumSize_) + { + *logofs << "Transport: WARNING! Buffer for FD#" << fd_ + << " grown to reach size of " << newSize + << " bytes.\n" << logofs_flush; + } + #endif + + #ifdef TEST + *logofs << "Transport: Data buffer for " << "FD#" + << fd_ << " has now size " << buffer.data_.size() + << " and capacity " << buffer.data_.capacity() + << ".\n" << logofs_flush; + #endif + } + + return (buffer.length_ + size); +} + +void Transport::fullReset(T_buffer &buffer) +{ + // + // Force deallocation and allocation + // of the initial size. + // + + #ifdef TEST + *logofs << "Transport: Resetting buffer for " << "FD#" + << fd_ << " with size " << buffer.data_.size() + << " and capacity " << buffer.data_.capacity() + << ".\n" << logofs_flush; + #endif + + buffer.start_ = 0; + buffer.length_ = 0; + + if (buffer.data_.size() > (unsigned int) initialSize_ && + buffer.data_.capacity() > (unsigned int) initialSize_) + { + buffer.data_.clear(); + + buffer.data_.resize(initialSize_); + + #ifdef TEST + *logofs << "Transport: Data buffer for " << "FD#" + << fd_ << " shrunk to size " << buffer.data_.size() + << " and capacity " << buffer.data_.capacity() + << ".\n" << logofs_flush; + #endif + } +} + +ProxyTransport::ProxyTransport(int fd) : Transport(fd) +{ + #ifdef TEST + *logofs << "ProxyTransport: Going to create proxy transport " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + type_ = transport_proxy; + + // + // Set up the read buffer. + // + + r_buffer_.length_ = 0; + r_buffer_.start_ = 0; + + r_buffer_.data_.resize(initialSize_); + + // + // For now we own the buffer. + // + + owner_ = 1; + + // + // Set up ZLIB compression. + // + + int result; + + r_stream_.zalloc = NULL; + r_stream_.zfree = NULL; + r_stream_.opaque = NULL; + + r_stream_.next_in = NULL; + r_stream_.avail_in = 0; + + if ((result = inflateInit2(&r_stream_, 15)) != Z_OK) + { + #ifdef PANIC + *logofs << "ProxyTransport: PANIC! Failed initialization of ZLIB read stream. " + << "Error is '" << zError(result) << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed initialization of ZLIB read stream. " + << "Error is '" << zError(result) << "'.\n"; + + HandleCleanup(); + } + + if (control -> LocalStreamCompression) + { + w_stream_.zalloc = NULL; + w_stream_.zfree = NULL; + w_stream_.opaque = NULL; + + if ((result = deflateInit2(&w_stream_, control -> LocalStreamCompressionLevel, Z_DEFLATED, + 15, 9, Z_DEFAULT_STRATEGY)) != Z_OK) + { + #ifdef PANIC + *logofs << "ProxyTransport: PANIC! Failed initialization of ZLIB write stream. " + << "Error is '" << zError(result) << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Failed initialization of ZLIB write stream. " + << "Error is '" << zError(result) << "'.\n"; + + HandleCleanup(); + } + } + + // + // No ZLIB stream to flush yet. + // + + flush_ = 0; + + #ifdef REFERENCES + *logofs << "ProxyTransport: Created new object at " + << this << " out of " << ++references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +ProxyTransport::~ProxyTransport() +{ + #ifdef TEST + *logofs << "ProxyTransport: Going to destroy derived class " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + // + // Deallocate the ZLIB stream state. + // + + inflateEnd(&r_stream_); + + if (control -> LocalStreamCompression) + { + deflateEnd(&w_stream_); + } + + #ifdef REFERENCES + *logofs << "ProxyTransport: Deleted object at " + << this << " out of " << --references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +// +// Read data from its file descriptor. +// + +int ProxyTransport::read(unsigned char *data, unsigned int size) +{ + // + // If the remote peer is not compressing + // the stream then just return any byte + // read from the socket. + // + + if (control -> RemoteStreamCompression == 0) + { + int result = Transport::read(data, size); + + if (result <= 0) + { + return result; + } + + statistics -> addBytesIn(result); + + return result; + } + + // + // Return any pending data first. + // + + if (r_buffer_.length_ > 0) + { + // + // If the size of the buffer doesn't + // match the amount of data pending, + // force the caller to retry. + // + + if ((int) size < r_buffer_.length_) + { + #ifdef TEST + *logofs << "ProxyTransport: WARNING! Forcing a retry with " + << r_buffer_.length_ << " bytes pending and " + << size << " in the buffer.\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + + return -1; + } + + int copied = (r_buffer_.length_ > ((int) size) ? + ((int) size) : r_buffer_.length_); + + memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); + + // + // Update the buffer status. + // + + #ifdef DEBUG + *logofs << "ProxyTransport: Going to immediately return " << copied + << " bytes from proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + r_buffer_.length_ -= copied; + + if (r_buffer_.length_ == 0) + { + r_buffer_.start_ = 0; + } + else + { + r_buffer_.start_ += copied; + + #ifdef TEST + *logofs << "ProxyTransport: There are still " << r_buffer_.length_ + << " bytes in read buffer for proxy " << "FD#" + << fd_ << ".\n" << logofs_flush; + #endif + } + + return copied; + } + + // + // Read data in the user buffer. + // + + int result = Transport::read(data, size); + + if (result <= 0) + { + return result; + } + + statistics -> addBytesIn(result); + + // + // Decompress the data into the read + // buffer. + // + + #ifdef DEBUG + *logofs << "ProxyTransport: Going to decompress data for " + << "proxy FD#" << fd_ << ".\n" << logofs_flush; + #endif + + int saveTotalIn = r_stream_.total_in; + int saveTotalOut = r_stream_.total_out; + + int oldTotalIn = saveTotalIn; + int oldTotalOut = saveTotalOut; + + int diffTotalIn; + int diffTotalOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn + << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut + << ".\n" << logofs_flush; + #endif + + r_stream_.next_in = (Bytef *) data; + r_stream_.avail_in = result; + + // + // Let ZLIB use all the space already + // available in the buffer. + // + + unsigned int newAvailOut = r_buffer_.data_.size() - r_buffer_.start_ - + r_buffer_.length_; + + #ifdef TEST + *logofs << "ProxyTransport: Initial decompress buffer is " + << newAvailOut << " bytes.\n" << logofs_flush; + #endif + + for (;;) + { + #ifdef INSPECT + *logofs << "\nProxyTransport: Running the decompress loop.\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_buffer_.length_ = " << r_buffer_.length_ + << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_buffer_.data_.size() = " << r_buffer_.data_.size() + << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: newAvailOut = " << newAvailOut + << ".\n" << logofs_flush; + #endif + + if (resize(r_buffer_, newAvailOut) < 0) + { + return -1; + } + + #ifdef INSPECT + *logofs << "ProxyTransport: r_buffer_.data_.size() = " + << r_buffer_.data_.size() << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.next_in = " + << (void *) r_stream_.next_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.avail_in = " + << r_stream_.avail_in << ".\n" + << logofs_flush; + #endif + + r_stream_.next_out = r_buffer_.data_.begin() + r_buffer_.start_ + + r_buffer_.length_; + + r_stream_.avail_out = newAvailOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.next_out = " + << (void *) r_stream_.next_out << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.avail_out = " + << r_stream_.avail_out << ".\n" + << logofs_flush; + #endif + + int result = inflate(&r_stream_, Z_SYNC_FLUSH); + + #ifdef INSPECT + *logofs << "ProxyTransport: Called inflate() result is " + << result << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.avail_in = " + << r_stream_.avail_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.avail_out = " + << r_stream_.avail_out << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.total_in = " + << r_stream_.total_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_stream_.total_out = " + << r_stream_.total_out << ".\n" + << logofs_flush; + #endif + + diffTotalIn = r_stream_.total_in - oldTotalIn; + diffTotalOut = r_stream_.total_out - oldTotalOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: diffTotalIn = " + << diffTotalIn << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: diffTotalOut = " + << diffTotalOut << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: r_buffer_.length_ = " + << r_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + r_buffer_.length_ += diffTotalOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: r_buffer_.length_ = " + << r_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + oldTotalIn = r_stream_.total_in; + oldTotalOut = r_stream_.total_out; + + if (result == Z_OK) + { + if (r_stream_.avail_in == 0 && r_stream_.avail_out > 0) + { + break; + } + } + else if (result == Z_BUF_ERROR && r_stream_.avail_out > 0 && + r_stream_.avail_in == 0) + { + #ifdef TEST + *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR decompressing data.\n" + << logofs_flush; + #endif + + break; + } + else + { + #ifdef PANIC + *logofs << "ProxyTransport: PANIC! Decompression of data failed. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Decompression of data failed. Error is '" + << zError(result) << "'.\n"; + + finish(); + + return -1; + } + + // + // Add more bytes to the buffer. + // + + if (newAvailOut < thresholdSize_) + { + newAvailOut = thresholdSize_; + } + + #ifdef TEST + *logofs << "ProxyTransport: Need to add " << newAvailOut + << " bytes to the decompress buffer in read.\n" + << logofs_flush; + #endif + } + + diffTotalIn = r_stream_.total_in - saveTotalIn; + diffTotalOut = r_stream_.total_out - saveTotalOut; + + #ifdef DEBUG + *logofs << "ProxyTransport: Decompressed data from " + << diffTotalIn << " to " << diffTotalOut + << " bytes.\n" << logofs_flush; + #endif + + statistics -> addDecompressedBytes(diffTotalIn, diffTotalOut); + + // + // Check if the size of the buffer + // matches the produced data. + // + + if ((int) size < r_buffer_.length_) + { + #ifdef TEST + *logofs << "ProxyTransport: WARNING! Forcing a retry with " + << r_buffer_.length_ << " bytes pending and " + << size << " in the buffer.\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + + return -1; + } + + // + // Copy the decompressed data to the + // provided buffer. + // + + int copied = (r_buffer_.length_ > ((int) size) ? + ((int) size) : r_buffer_.length_); + + #ifdef DEBUG + *logofs << "ProxyTransport: Going to return " << copied + << " bytes from proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); + + // + // Update the buffer status. + // + + r_buffer_.length_ -= copied; + + if (r_buffer_.length_ == 0) + { + r_buffer_.start_ = 0; + } + else + { + r_buffer_.start_ += copied; + + #ifdef TEST + *logofs << "ProxyTransport: There are still " << r_buffer_.length_ + << " bytes in read buffer for proxy FD#" << fd_ + << ".\n" << logofs_flush; + #endif + } + + return copied; +} + +// +// If required compress data, else write it to socket. +// + +int ProxyTransport::write(T_write type, const unsigned char *data, const unsigned int size) +{ + #ifdef TEST + if (size == 0) + { + *logofs << "ProxyTransport: WARNING! Write called for FD#" + << fd_ << " without any data to write.\n" + << logofs_flush; + + return 0; + } + #endif + + // + // If there is no compression revert to + // plain socket management. + // + + if (control -> LocalStreamCompression == 0) + { + int result = Transport::write(type, data, size); + + if (result <= 0) + { + return result; + } + + statistics -> addBytesOut(result); + + statistics -> updateBitrate(result); + + FlushCallback(result); + + return result; + } + + #ifdef DEBUG + *logofs << "ProxyTransport: Going to compress " << size + << " bytes to write buffer for proxy FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + // + // Compress data into the write buffer. + // + + int saveTotalIn = w_stream_.total_in; + int saveTotalOut = w_stream_.total_out; + + int oldTotalIn = saveTotalIn; + int oldTotalOut = saveTotalOut; + + int diffTotalIn; + int diffTotalOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn + << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut + << ".\n" << logofs_flush; + #endif + + w_stream_.next_in = (Bytef *) data; + w_stream_.avail_in = size; + + // + // Let ZLIB use all the space already + // available in the buffer. + // + + unsigned int newAvailOut = w_buffer_.data_.size() - w_buffer_.start_ - + w_buffer_.length_; + + #ifdef TEST + *logofs << "ProxyTransport: Initial compress buffer is " + << newAvailOut << " bytes.\n" << logofs_flush; + #endif + + for (;;) + { + #ifdef INSPECT + *logofs << "\nProxyTransport: Running the compress loop.\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.length_ = " + << w_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.data_.size() = " + << w_buffer_.data_.size() << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: newAvailOut = " + << newAvailOut << ".\n" + << logofs_flush; + #endif + + if (resize(w_buffer_, newAvailOut) < 0) + { + return -1; + } + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.data_.size() = " + << w_buffer_.data_.size() << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.next_in = " + << (void *) w_stream_.next_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_in = " + << w_stream_.avail_in << ".\n" + << logofs_flush; + #endif + + w_stream_.next_out = w_buffer_.data_.begin() + w_buffer_.start_ + + w_buffer_.length_; + + w_stream_.avail_out = newAvailOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.next_out = " + << (void *) w_stream_.next_out << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_out = " + << w_stream_.avail_out << ".\n" + << logofs_flush; + #endif + + int result = deflate(&w_stream_, (type == write_delayed ? + Z_NO_FLUSH : Z_SYNC_FLUSH)); + + #ifdef INSPECT + *logofs << "ProxyTransport: Called deflate() result is " + << result << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_in = " + << w_stream_.avail_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_out = " + << w_stream_.avail_out << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.total_in = " + << w_stream_.total_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.total_out = " + << w_stream_.total_out << ".\n" + << logofs_flush; + #endif + + diffTotalOut = w_stream_.total_out - oldTotalOut; + diffTotalIn = w_stream_.total_in - oldTotalIn; + + #ifdef INSPECT + *logofs << "ProxyTransport: diffTotalIn = " + << diffTotalIn << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: diffTotalOut = " + << diffTotalOut << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.length_ = " + << w_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + w_buffer_.length_ += diffTotalOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.length_ = " + << w_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + oldTotalOut = w_stream_.total_out; + oldTotalIn = w_stream_.total_in; + + if (result == Z_OK) + { + if (w_stream_.avail_in == 0 && w_stream_.avail_out > 0) + { + break; + } + } + else if (result == Z_BUF_ERROR && w_stream_.avail_out > 0 && + w_stream_.avail_in == 0) + { + #ifdef TEST + *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR compressing data.\n" + << logofs_flush; + #endif + + break; + } + else + { + #ifdef PANIC + *logofs << "ProxyTransport: PANIC! Compression of data failed. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Compression of data failed. Error is '" + << zError(result) << "'.\n"; + + finish(); + + return -1; + } + + // + // Add more bytes to the buffer. + // + + if (newAvailOut < thresholdSize_) + { + newAvailOut = thresholdSize_; + } + + #ifdef TEST + *logofs << "ProxyTransport: Need to add " << newAvailOut + << " bytes to the compress buffer in write.\n" + << logofs_flush; + #endif + } + + diffTotalIn = w_stream_.total_in - saveTotalIn; + diffTotalOut = w_stream_.total_out - saveTotalOut; + + #ifdef TEST + + *logofs << "ProxyTransport: Compressed data from " + << diffTotalIn << " to " << diffTotalOut + << " bytes.\n" << logofs_flush; + + if (diffTotalIn != (int) size) + { + #ifdef PANIC + *logofs << "ProxyTransport: PANIC! Bytes provided to ZLIB stream " + << "should be " << size << " but they look to be " + << diffTotalIn << ".\n" << logofs_flush; + #endif + } + + #endif + + // + // Find out what we have to do with the + // produced data. + // + + if (type == write_immediate) + { + // + // If user requested an immediate write we + // flushed the ZLIB buffer. We can now reset + // the counter and write data to socket. + // + + flush_ = 0; + + #ifdef TEST + *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "ProxyTransport: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " flush is " + << flush_ << " size is " << w_buffer_.data_.size() + << " capacity is " << w_buffer_.data_.capacity() + << ".\n" << logofs_flush; + #endif + + // + // Alternatively may try to write only if + // the socket is not blocked. + // + // if (w_buffer_.length_ > 0 && blocked_ == 0) + // { + // ... + // } + // + + if (w_buffer_.length_ > 0) + + { + #ifdef TEST + *logofs << "ProxyTransport: Writing " << w_buffer_.length_ + << " bytes of produced data to FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + int result = Transport::flush(); + + if (result < 0) + { + return -1; + } + } + } + else + { + // + // We haven't flushed the ZLIB compression + // buffer, so user will have to call proxy + // transport's flush explicitly. + // + + flush_ += diffTotalIn; + } + + // + // We either wrote the data or added it to the + // write buffer. It's convenient to update the + // counters at this stage to get the current + // bitrate earlier. + // + + statistics -> addCompressedBytes(diffTotalIn, diffTotalOut); + + statistics -> addBytesOut(diffTotalOut); + + statistics -> updateBitrate(diffTotalOut); + + FlushCallback(diffTotalOut); + + #ifdef TEST + *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "ProxyTransport: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " flush is " + << flush_ << " size is " << w_buffer_.data_.size() + << " capacity is " << w_buffer_.data_.capacity() + << ".\n" << logofs_flush; + #endif + + return size; +} + +// +// Write data to its file descriptor. +// + +int ProxyTransport::flush() +{ + // + // If there is no compression or we already compressed + // outgoing data and just need to write it to socket + // because of previous incomplete writes then revert + // to plain socket management. + // + + if (flush_ == 0 || control -> LocalStreamCompression == 0) + { + int result = Transport::flush(); + + if (result < 0) + { + return -1; + } + + return result; + } + + #ifdef DEBUG + *logofs << "ProxyTransport: Going to flush compression on " + << "proxy FD#" << fd_ << ".\n" << logofs_flush; + #endif + + #ifdef TEST + *logofs << "ProxyTransport: Flush counter for proxy FD#" << fd_ + << " is " << flush_ << " bytes.\n" << logofs_flush; + #endif + + // + // Flush ZLIB stream into the write buffer. + // + + int saveTotalIn = w_stream_.total_in; + int saveTotalOut = w_stream_.total_out; + + int oldTotalIn = saveTotalIn; + int oldTotalOut = saveTotalOut; + + int diffTotalOut; + int diffTotalIn; + + #ifdef INSPECT + *logofs << "ProxyTransport: oldTotalIn = " << oldTotalIn + << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: oldTotalOut = " << oldTotalOut + << ".\n" << logofs_flush; + #endif + + w_stream_.next_in = w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_; + w_stream_.avail_in = 0; + + // + // Let ZLIB use all the space already + // available in the buffer. + // + + unsigned int newAvailOut = w_buffer_.data_.size() - w_buffer_.start_ - + w_buffer_.length_; + + #ifdef DEBUG + *logofs << "ProxyTransport: Initial flush buffer is " + << newAvailOut << " bytes.\n" << logofs_flush; + #endif + + for (;;) + { + #ifdef INSPECT + *logofs << "\nProxyTransport: Running the flush loop.\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.length_ = " + << w_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.data_.size() = " + << w_buffer_.data_.size() << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: newAvailOut = " + << newAvailOut << ".\n" + << logofs_flush; + #endif + + if (resize(w_buffer_, newAvailOut) < 0) + { + return -1; + } + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.data_.size() = " + << w_buffer_.data_.size() << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.next_in = " + << (void *) w_stream_.next_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_in = " + << w_stream_.avail_in << ".\n" + << logofs_flush; + #endif + + w_stream_.next_out = w_buffer_.data_.begin() + w_buffer_.start_ + + w_buffer_.length_; + + w_stream_.avail_out = newAvailOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.next_out = " + << (void *) w_stream_.next_out << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_out = " + << w_stream_.avail_out << ".\n" + << logofs_flush; + #endif + + int result = deflate(&w_stream_, Z_SYNC_FLUSH); + + #ifdef INSPECT + *logofs << "ProxyTransport: Called deflate() result is " + << result << ".\n" << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_in = " + << w_stream_.avail_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.avail_out = " + << w_stream_.avail_out << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.total_in = " + << w_stream_.total_in << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_stream_.total_out = " + << w_stream_.total_out << ".\n" + << logofs_flush; + #endif + + diffTotalOut = w_stream_.total_out - oldTotalOut; + diffTotalIn = w_stream_.total_in - oldTotalIn; + + #ifdef INSPECT + *logofs << "ProxyTransport: diffTotalIn = " + << diffTotalIn << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: diffTotalOut = " + << diffTotalOut << ".\n" + << logofs_flush; + #endif + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.length_ = " + << w_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + w_buffer_.length_ += diffTotalOut; + + #ifdef INSPECT + *logofs << "ProxyTransport: w_buffer_.length_ = " + << w_buffer_.length_ << ".\n" + << logofs_flush; + #endif + + oldTotalOut = w_stream_.total_out; + oldTotalIn = w_stream_.total_in; + + if (result == Z_OK) + { + if (w_stream_.avail_in == 0 && w_stream_.avail_out > 0) + { + break; + } + } + else if (result == Z_BUF_ERROR && w_stream_.avail_out > 0 && + w_stream_.avail_in == 0) + { + #ifdef TEST + *logofs << "ProxyTransport: WARNING! Raised Z_BUF_ERROR flushing data.\n" + << logofs_flush; + #endif + + break; + } + else + { + #ifdef PANIC + *logofs << "ProxyTransport: PANIC! Flush of compressed data failed. " + << "Error is '" << zError(result) << "'.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Flush of compressed data failed. Error is '" + << zError(result) << "'.\n"; + + finish(); + + return -1; + } + + // + // Add more bytes to the buffer. + // + + if (newAvailOut < thresholdSize_) + { + newAvailOut = thresholdSize_; + } + + #ifdef TEST + *logofs << "ProxyTransport: Need to add " << newAvailOut + << " bytes to the compress buffer in flush.\n" + << logofs_flush; + #endif + } + + diffTotalIn = w_stream_.total_in - saveTotalIn; + diffTotalOut = w_stream_.total_out - saveTotalOut; + + #ifdef TEST + *logofs << "ProxyTransport: Compressed flush data from " + << diffTotalIn << " to " << diffTotalOut + << " bytes.\n" << logofs_flush; + #endif + + // + // Time to move data from the write + // buffer to the real link. + // + + #ifdef DEBUG + *logofs << "ProxyTransport: Reset flush counter for proxy FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + flush_ = 0; + + #ifdef TEST + *logofs << "ProxyTransport: Write buffer for proxy FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "ProxyTransport: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " flush is " + << flush_ << " size is " << w_buffer_.data_.size() + << " capacity is " << w_buffer_.data_.capacity() + << ".\n" << logofs_flush; + #endif + + int result = Transport::flush(); + + if (result < 0) + { + return -1; + } + + // + // Update all the counters. + // + + statistics -> addCompressedBytes(diffTotalIn, diffTotalOut); + + statistics -> addBytesOut(diffTotalOut); + + statistics -> updateBitrate(diffTotalOut); + + FlushCallback(diffTotalOut); + + return result; +} + +unsigned int ProxyTransport::getPending(unsigned char *&data) +{ + // + // Return a pointer to the data in the + // read buffer. It is up to the caller + // to ensure that the data is consumed + // before the read buffer is reused. + // + + if (r_buffer_.length_ > 0) + { + unsigned int size = r_buffer_.length_; + + data = r_buffer_.data_.begin() + r_buffer_.start_; + + #ifdef DEBUG + *logofs << "ProxyTransport: Returning " << size + << " pending bytes from proxy FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + r_buffer_.length_ = 0; + r_buffer_.start_ = 0; + + // + // Prevent the deletion of the buffer. + // + + owner_ = 0; + + return size; + } + + #ifdef TEST + *logofs << "ProxyTransport: WARNING! No pending data " + << "for proxy FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + data = NULL; + + return 0; +} + +void ProxyTransport::fullReset() +{ + blocked_ = 0; + finish_ = 0; + flush_ = 0; + + if (control -> RemoteStreamCompression) + { + inflateReset(&r_stream_); + } + + if (control -> LocalStreamCompression) + { + deflateReset(&w_stream_); + } + + if (owner_ == 1) + { + Transport::fullReset(r_buffer_); + } + + Transport::fullReset(w_buffer_); +} + +AgentTransport::AgentTransport(int fd) : Transport(fd) +{ + #ifdef TEST + *logofs << "AgentTransport: Going to create agent transport " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + type_ = transport_agent; + + // + // Set up the read buffer. + // + + r_buffer_.length_ = 0; + r_buffer_.start_ = 0; + + r_buffer_.data_.resize(initialSize_); + + // + // For now we own the buffer. + // + + owner_ = 1; + + // + // Set up the mutexes. + // + + #ifdef THREADS + + pthread_mutexattr_t m_attributes; + + pthread_mutexattr_init(&m_attributes); + + // + // Interfaces in pthread to handle mutex + // type do not work in current version. + // + + m_attributes.__mutexkind = PTHREAD_MUTEX_ERRORCHECK_NP; + + if (pthread_mutex_init(&m_read_, &m_attributes) != 0) + { + #ifdef TEST + *logofs << "AgentTransport: Child: Creation of read mutex failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + } + + if (pthread_mutex_init(&m_write_, &m_attributes) != 0) + { + #ifdef TEST + *logofs << "AgentTransport: Child: Creation of write mutex failed. " + << "Error is " << EGET() << " '" << ESTR() + << "'.\n" << logofs_flush; + #endif + } + + #endif + + #ifdef REFERENCES + *logofs << "AgentTransport: Child: Created new object at " + << this << " out of " << ++references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +AgentTransport::~AgentTransport() +{ + #ifdef TEST + *logofs << "AgentTransport: Going to destroy derived class " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + // + // Unlock and free all mutexes. + // + + #ifdef THREADS + + pthread_mutex_unlock(&m_read_); + pthread_mutex_unlock(&m_write_); + + pthread_mutex_destroy(&m_read_); + pthread_mutex_destroy(&m_write_); + + #endif + + #ifdef REFERENCES + *logofs << "AgentTransport: Child: Deleted object at " + << this << " out of " << --references_ + << " allocated references.\n" << logofs_flush; + #endif +} + +// +// Read data enqueued by the other thread. +// + +int AgentTransport::read(unsigned char *data, unsigned int size) +{ + #ifdef THREADS + + lockRead(); + + #endif + + #ifdef DEBUG + *logofs << "AgentTransport: Child: Going to read " << size + << " bytes from " << "FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + int copied = -1; + + if (r_buffer_.length_ > 0) + { + if ((int) size < r_buffer_.length_) + { + #ifdef TEST + *logofs << "AgentTransport: WARNING! Forcing a retry with " + << r_buffer_.length_ << " bytes pending and " + << size << " in the buffer.\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + } + else + { + copied = (r_buffer_.length_ > ((int) size) ? + ((int) size) : r_buffer_.length_); + + memcpy(data, r_buffer_.data_.begin() + r_buffer_.start_, copied); + + // + // Update the buffer status. + // + + #ifdef TEST + *logofs << "AgentTransport: Child: Going to immediately return " + << copied << " bytes from FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + #ifdef DUMP + + *logofs << "AgentTransport: Child: Dumping content of read data.\n" + << logofs_flush; + + DumpData(data, copied); + + #endif + + r_buffer_.length_ -= copied; + + if (r_buffer_.length_ == 0) + { + r_buffer_.start_ = 0; + } + else + { + r_buffer_.start_ += copied; + + #ifdef TEST + *logofs << "AgentTransport: Child: There are still " + << r_buffer_.length_ << " bytes in read buffer for " + << "FD#" << fd_ << ".\n" << logofs_flush; + #endif + } + } + } + else + { + #ifdef DEBUG + *logofs << "AgentTransport: Child: No data can be got " + << "from read buffer for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + } + + #ifdef THREADS + + unlockRead(); + + #endif + + return copied; +} + +// +// Write data to buffer so that the other +// thread can get it. +// + +int AgentTransport::write(T_write type, const unsigned char *data, const unsigned int size) +{ + #ifdef THREADS + + lockWrite(); + + #endif + + // + // Just append data to socket's write buffer. + // Note that we don't care if buffer exceeds + // the size limits set for this type of + // transport. + // + + #ifdef TEST + *logofs << "AgentTransport: Child: Going to append " << size + << " bytes to write buffer for " << "FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + int copied = -1; + + if (resize(w_buffer_, size) < 0) + { + finish(); + + ESET(EPIPE); + } + else + { + memmove(w_buffer_.data_.begin() + w_buffer_.start_ + w_buffer_.length_, data, size); + + w_buffer_.length_ += size; + + #ifdef DUMP + + *logofs << "AgentTransport: Child: Dumping content of written data.\n" + << logofs_flush; + + DumpData(data, size); + + #endif + + #ifdef TEST + *logofs << "AgentTransport: Child: Write buffer for FD#" << fd_ + << " has data for " << w_buffer_.length_ << " bytes.\n" + << logofs_flush; + + *logofs << "AgentTransport: Child: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " size is " + << w_buffer_.data_.size() << " capacity is " + << w_buffer_.data_.capacity() << ".\n" + << logofs_flush; + #endif + + copied = size; + } + + // + // Let child access again the read buffer. + // + + #ifdef THREADS + + unlockWrite(); + + #endif + + return copied; +} + +int AgentTransport::flush() +{ + // + // In case of memory-to-memory transport + // this function should never be called. + // + + #ifdef PANIC + *logofs << "AgentTransport: Child: PANIC! Called flush() for " + << "memory to memory transport on " << "FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Called flush() for " + << "memory to memory transport on " << "FD#" + << fd_ << ".\n"; + + HandleAbort(); +} + +int AgentTransport::drain(int limit, int timeout) +{ + // + // We can't drain the channel in the case + // of the memory-to-memory transport. Data + // is enqueued for the agent to read but + // the agent could require multiple loops + // to read it all. + // + + // + // In case of memory-to-memory transport + // this function should never be called. + // + + #ifdef PANIC + *logofs << "AgentTransport: Child: PANIC! Called drain() for " + << "memory to memory transport on " << "FD#" + << fd_ << ".\n" << logofs_flush; + #endif + + cerr << "Error" << ": Called drain() for " + << "memory to memory transport on " << "FD#" + << fd_ << ".\n"; + + HandleAbort(); +} + +unsigned int AgentTransport::getPending(unsigned char *&data) +{ + #ifdef THREADS + + lockRead(); + + #endif + + if (r_buffer_.length_ > 0) + { + unsigned int size = r_buffer_.length_; + + data = r_buffer_.data_.begin() + r_buffer_.start_; + + #ifdef DEBUG + *logofs << "AgentTransport: Child: Returning " << size + << " pending bytes from FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + r_buffer_.length_ = 0; + r_buffer_.start_ = 0; + + #ifdef THREADS + + unlockRead(); + + #endif + + // + // Prevent the deletion of the buffer. + // + + owner_ = 0; + + return size; + } + + #ifdef TEST + *logofs << "AgentTransport: WARNING! No pending data " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + #ifdef THREADS + + unlockRead(); + + #endif + + data = NULL; + + return 0; +} + +void AgentTransport::fullReset() +{ + #ifdef THREADS + + lockRead(); + lockWrite(); + + #endif + + #ifdef TEST + *logofs << "AgentTransport: Child: Resetting transport " + << "for FD#" << fd_ << ".\n" << logofs_flush; + #endif + + blocked_ = 0; + finish_ = 0; + + if (owner_ == 1) + { + Transport::fullReset(r_buffer_); + } + + Transport::fullReset(w_buffer_); +} + +int AgentTransport::enqueue(const char *data, const int size) +{ + #ifdef THREADS + + lockRead(); + + #endif + + if (finish_ == 1) + { + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Returning EPIPE in " + << "write for finishing FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + ESET(EPIPE); + + return -1; + } + + // + // Always allow the agent to write + // all its data. + // + + int toPut = size; + + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Going to put " << toPut + << " bytes into read buffer for FD#" << fd_ + << ". Buffer length is " << r_buffer_.length_ + << ".\n" << logofs_flush; + #endif + + if (resize(r_buffer_, toPut) < 0) + { + finish(); + + #ifdef THREADS + + unlockRead(); + + #endif + + return -1; + } + + memcpy(r_buffer_.data_.begin() + r_buffer_.start_ + r_buffer_.length_, data, toPut); + + r_buffer_.length_ += toPut; + + #if defined(DUMP) && defined(PARENT) + + *logofs << "AgentTransport: Parent: Dumping content of enqueued data.\n" + << logofs_flush; + + DumpData((const unsigned char *) data, toPut); + + #endif + + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Read buffer for FD#" << fd_ + << " has now data for " << r_buffer_.length_ + << " bytes.\n" << logofs_flush; + + *logofs << "AgentTransport: Parent: Start is " << r_buffer_.start_ + << " length is " << r_buffer_.length_ << " size is " + << r_buffer_.data_.size() << " capacity is " + << r_buffer_.data_.capacity() << ".\n" + << logofs_flush; + #endif + + #ifdef THREADS + + unlockRead(); + + #endif + + return toPut; +} + +int AgentTransport::dequeue(char *data, int size) +{ + #ifdef THREADS + + lockWrite(); + + #endif + + if (w_buffer_.length_ == 0) + { + if (finish_ == 1) + { + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Returning 0 in read " + << "for finishing FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + return 0; + } + + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: No data can be read " + << "from write buffer for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + ESET(EAGAIN); + + #ifdef THREADS + + unlockWrite(); + + #endif + + return -1; + } + + // + // Return as many bytes as possible. + // + + int toGet = ((int) size > w_buffer_.length_ ? w_buffer_.length_ : size); + + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Going to get " << toGet + << " bytes from write buffer for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + memcpy(data, w_buffer_.data_.begin() + w_buffer_.start_, toGet); + + w_buffer_.start_ += toGet; + w_buffer_.length_ -= toGet; + + #if defined(DUMP) && defined(PARENT) + + *logofs << "AgentTransport: Parent: Dumping content of dequeued data.\n" + << logofs_flush; + + DumpData((const unsigned char *) data, toGet); + + #endif + + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Write buffer for FD#" << fd_ + << " has now data for " << length() << " bytes.\n" + << logofs_flush; + + *logofs << "AgentTransport: Parent: Start is " << w_buffer_.start_ + << " length is " << w_buffer_.length_ << " size is " + << w_buffer_.data_.size() << " capacity is " + << w_buffer_.data_.capacity() << ".\n" + << logofs_flush; + #endif + + #ifdef THREADS + + unlockWrite(); + + #endif + + return toGet; +} + +int AgentTransport::dequeuable() +{ + if (finish_ == 1) + { + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Returning EPIPE in " + << "readable for finishing FD#" << fd_ + << ".\n" << logofs_flush; + #endif + + ESET(EPIPE); + + return -1; + } + + #if defined(PARENT) && defined(TEST) + *logofs << "AgentTransport: Parent: Returning " + << w_buffer_.length_ << " as data readable " + << "from read buffer for FD#" << fd_ << ".\n" + << logofs_flush; + #endif + + return w_buffer_.length_; +} + +#ifdef THREADS + +int AgentTransport::lockRead() +{ + for (;;) + { + int result = pthread_mutex_lock(&m_read_); + + if (result == 0) + { + #ifdef DEBUG + *logofs << "AgentTransport: Read mutex locked by thread id " + << pthread_self() << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (EGET() == EINTR) + { + continue; + } + else + { + #ifdef WARNING + *logofs << "AgentTransport: WARNING! Locking of read mutex by thread id " + << pthread_self() << " returned " << result << ". Error is '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + return result; + } + } +} + +int AgentTransport::lockWrite() +{ + for (;;) + { + int result = pthread_mutex_lock(&m_write_); + + if (result == 0) + { + #ifdef DEBUG + *logofs << "AgentTransport: Write mutex locked by thread id " + << pthread_self() << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (EGET() == EINTR) + { + continue; + } + else + { + #ifdef WARNING + *logofs << "AgentTransport: WARNING! Locking of write mutex by thread id " + << pthread_self() << " returned " << result << ". Error is '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + return result; + } + } +} + +int AgentTransport::unlockRead() +{ + for (;;) + { + int result = pthread_mutex_unlock(&m_read_); + + if (result == 0) + { + #ifdef DEBUG + *logofs << "AgentTransport: Read mutex unlocked by thread id " + << pthread_self() << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (EGET() == EINTR) + { + continue; + } + else + { + #ifdef WARNING + *logofs << "AgentTransport: WARNING! Unlocking of read mutex by thread id " + << pthread_self() << " returned " << result << ". Error is '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + return result; + } + } +} + +int AgentTransport::unlockWrite() +{ + for (;;) + { + int result = pthread_mutex_unlock(&m_write_); + + if (result == 0) + { + #ifdef DEBUG + *logofs << "AgentTransport: Write mutex unlocked by thread id " + << pthread_self() << ".\n" << logofs_flush; + #endif + + return 0; + } + else if (EGET() == EINTR) + { + continue; + } + else + { + #ifdef WARNING + *logofs << "AgentTransport: WARNING! Unlocking of write mutex by thread id " + << pthread_self() << " returned " << result << ". Error is '" + << ESTR() << "'.\n" << logofs_flush; + #endif + + return result; + } + } +} + +#endif diff --git a/nxcomp/src/Transport.h b/nxcomp/src/Transport.h new file mode 100644 index 000000000..047396af6 --- /dev/null +++ b/nxcomp/src/Transport.h @@ -0,0 +1,577 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Transport_H +#define Transport_H + +#include +#include + +#include +#include +#include + +#include "Misc.h" +#include "Control.h" + +#include "Types.h" +#include "Timestamp.h" +#include "Socket.h" + +// +// Set the verbosity level. +// + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Define this to lock and unlock the +// memory-to-memory transport buffers +// before they are accessed. The code +// is outdated and doesn't work with +// the current pthread library. +// + +#undef THREADS + +// +// Define this to know when a socket +// is created or destroyed. +// + +#undef REFERENCES + +// +// Size of buffer if not set by user. +// + +#define TRANSPORT_BUFFER_DEFAULT_SIZE 16384 + +// +// Type of transport. +// + +typedef enum +{ + transport_base, + transport_proxy, + transport_agent, + transport_last_tag + +} T_transport_type; + +// +// This class handles the buffered I/O on +// the network sockets. +// + +// +// TODO: This class is useful but adds a lot of +// overhead. There are many improvements we can +// make here: +// +// - There should be a generic Buffer class, ac- +// comodating a list of memory buffers. This +// would enable the use of the readv() and +// writev() functions to perform the I/O on +// the socket. +// +// - The buffering should be moved to the Write- +// Buffer and ReadBuffer classes. By performing +// the buffering here and there, we are dupli- +// cating a lot of code and are adding a lot +// of useless memory copies. +// +// - Stream compression should be removed. The +// proxy should compress the frames based on +// the type and should include the length of +// the decompressed data in the header of the +// packet. Besides avoiding the compression +// of packets that cannot be reduced in size, +// we would also save the additional memory +// allocations due to the fact that we don't +// know the size of the decode buffer at the +// time we read the packet from the network. +// +// - The other utilities implemented here, like +// the functions forcing a write on the socket +// or waiting for more data to become available +// should be moved to the Proxy or the Channel +// classes. +// + +class Transport +{ + public: + + // + // Member functions. + // + + Transport(int fd); + + virtual ~Transport(); + + int fd() const + { + return fd_; + } + + T_transport_type getType() + { + return type_; + } + + // + // Virtual members redefined by proxy + // and 'memory-to-memory' I/O layers. + // + + virtual int read(unsigned char *data, unsigned int size); + + virtual int write(T_write type, const unsigned char *data, const unsigned int size); + + virtual int flush(); + + virtual int drain(int limit, int timeout); + + virtual void finish() + { + fullReset(); + + finish_ = 1; + } + + virtual int length() const + { + return w_buffer_.length_; + } + + virtual int pending() const + { + return 0; + } + + virtual int readable() const + { + return GetBytesReadable(fd_); + } + + virtual int writable() const + { + return GetBytesWritable(fd_); + } + + virtual int queued() const + { + return GetBytesQueued(fd_); + } + + virtual int flushable() const + { + return 0; + } + + virtual int wait(int timeout) const; + + void setSize(unsigned int initialSize, + unsigned int thresholdSize, + unsigned int maximumSize); + + // + // Return a pointer to the data + // in the read buffer. + // + + virtual unsigned int getPending(unsigned char *&data) + { + data = NULL; + + return 0; + } + + virtual void pendingReset() + { + } + + virtual void partialReset() + { + partialReset(w_buffer_); + } + + virtual void fullReset(); + + int blocked() const + { + return blocked_; + } + + protected: + + // + // Make room in the buffer to accommodate + // at least size bytes. + // + + int resize(T_buffer &buffer, const int &size); + + void partialReset(T_buffer &buffer) + { + if (buffer.length_ == 0 && + (buffer.data_.size() > initialSize_ || + buffer.data_.capacity() > initialSize_)) + { + fullReset(buffer); + } + } + + void fullReset(T_buffer &buffer); + + // + // Data members. + // + + int fd_; + + int blocked_; + int finish_; + + T_buffer w_buffer_; + + unsigned int initialSize_; + unsigned int thresholdSize_; + unsigned int maximumSize_; + + T_transport_type type_; + + private: + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +// +// This class handles buffered I/O and +// compression of the proxy stream. +// + +class ProxyTransport : public Transport +{ + public: + + ProxyTransport(int fd); + + virtual ~ProxyTransport(); + + virtual int read(unsigned char *data, unsigned int size); + + virtual int write(T_write type, const unsigned char *data, const unsigned int size); + + virtual int flush(); + + // + // Same as in the base class. + // + // virtual int drain(int limit, int timeout); + // + // virtual void finish(); + // + + // + // Same as in the base class. + // + // virtual int length() const + // + + virtual int pending() const + { + return r_buffer_.length_; + } + + // + // Same as in the base class. + // + // virtual int readable() const; + // + // virtual int writable() const; + // + // virtual int queued() const; + // + + virtual int flushable() const + { + return flush_; + } + + // + // Same as in the base class, but + // should not be called. + // + // int drained() const; + // + // Same as in the base class. + // + // virtual int wait(int timeout) const; + // + // Same as in the base class. + // + // void setSize(unsigned int initialSize, + // unsigned int thresholdSize, + // unsigned int maximumSize); + // + + virtual unsigned int getPending(unsigned char *&data); + + virtual void pendingReset() + { + owner_ = 1; + } + + virtual void partialReset() + { + if (owner_ == 1) + { + Transport::partialReset(r_buffer_); + } + + Transport::partialReset(w_buffer_); + } + + virtual void fullReset(); + + // + // Same as in the base class. + // + // int blocked() const; + // + + protected: + + int flush_; + int owner_; + + T_buffer r_buffer_; + + z_stream r_stream_; + z_stream w_stream_; + + private: + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +// +// Handle memory-to-memory data transfers between +// an agent and the proxy. +// + +class AgentTransport : public Transport +{ + public: + + AgentTransport(int fd); + + virtual ~AgentTransport(); + + virtual int read(unsigned char *data, unsigned int size); + + virtual int write(T_write type, const unsigned char *data, const unsigned int size); + + // + // These two should never be called. + // + + virtual int flush(); + + virtual int drain(int limit, int timeout); + + // + // Same as in the base class. + // + // virtual void finish(); + // + + // + // Same as in the base class. + // + // virtual int length() const + // + + virtual int pending() const + { + return r_buffer_.length_; + } + + // + // These are intended to operate only + // on the internal buffers. + // + + virtual int readable() const + { + return r_buffer_.length_; + } + + virtual int writable() const + { + return control -> TransportMaximumBufferSize; + } + + virtual int queued() const + { + return 0; + } + + // + // Same as in the base class. + // + // virtual int flushable() const; + // + // Same as in the base class, but + // should not be called. + // + // int drained() const; + // + + // + // Return immediately or will + // block until the timeout. + // + + virtual int wait(int timeout) const + { + return 0; + } + + // + // Same as in the base class. + // + // void setSize(unsigned int initialSize, + // unsigned int thresholdSize, + // unsigned int maximumSize); + // + + virtual unsigned int getPending(unsigned char *&data); + + virtual void pendingReset() + { + owner_ = 1; + } + + virtual void partialReset() + { + if (owner_ == 1) + { + Transport::partialReset(r_buffer_); + } + + Transport::partialReset(w_buffer_); + } + + virtual void fullReset(); + + // + // Same as in the base class. + // + // int blocked() const; + // + + // + // The following are specific of the + // memory-to-memory transport. + // + + int enqueue(const char *data, const int size); + + int dequeue(char *data, int size); + + int queuable() + { + // + // Always allow the agent to enqueue + // more data. + // + + return control -> TransportMaximumBufferSize; + } + + int dequeuable(); + + protected: + + // + // Lock the buffer to handle reads and + // writes safely. + // + + #ifdef THREADS + + int lockRead(); + int lockWrite(); + + int unlockRead(); + int unlockWrite(); + + #endif + + // + // Data members. + // + + int owner_; + + T_buffer r_buffer_; + + // + // Mutexes for safe read and write. + // + + #ifdef THREADS + + pthread_mutex_t m_read_; + pthread_mutex_t m_write_; + + #endif + + private: + + #ifdef REFERENCES + + static int references_; + + #endif +}; + +#endif /* Transport_H */ diff --git a/nxcomp/src/Types.h b/nxcomp/src/Types.h new file mode 100644 index 000000000..e82664c81 --- /dev/null +++ b/nxcomp/src/Types.h @@ -0,0 +1,271 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Types_H +#define Types_H + +using namespace std; + +#include +#include +#include +#include + +#include "MD5.h" + +// +// This is MD5 length. +// + +#define MD5_LENGTH 16 + +// +// Types of repositories. Replace the original +// clear() methods from STL in order to actually +// free the unused memory. +// + +class Message; + +class T_data : public vector < unsigned char > +{ + public: + + unsigned char *begin() + { + return &*(vector < unsigned char >::begin()); + } + + const unsigned char *begin() const + { + return &*(vector < unsigned char >::begin()); + } + + // Avoid overriding clear() when using libc++. Fiddling with STL internals + // doesn't really seem like a good idea to me anyway. + #ifndef _LIBCPP_VECTOR + void clear() + { + #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) + + #if defined(__GLIBCPP_INTERNAL_VECTOR_H) + + _Destroy(_M_start, _M_finish); + + #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + destroy(_M_start, _M_finish); + + #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + + _M_start = _M_finish = _M_end_of_storage = 0; + + #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + #if defined(_GLIBCXX_VECTOR) + + _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); + + _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); + + this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; + + #else /* #if defined(_GLIBCXX_VECTOR) */ + + destroy(start, finish); + + deallocate(); + + start = finish = end_of_storage = 0; + + #endif /* #if defined(_GLIBCXX_VECTOR) */ + + #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + } + #endif /* #ifdef _LIBCPP_VECTOR */ +}; + +class T_messages : public vector < Message * > +{ + public: + + // Avoid overriding clear() when using libc++. Fiddling with STL internals + // doesn't really seem like a good idea to me anyway. + #ifndef _LIBCPP_VECTOR + void clear() + { + #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) + + #if defined(__GLIBCPP_INTERNAL_VECTOR_H) + + _Destroy(_M_start, _M_finish); + + #else /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + destroy(_M_start, _M_finish); + + #endif /* #if defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + _M_deallocate(_M_start, _M_end_of_storage - _M_start); + + _M_start = _M_finish = _M_end_of_storage = 0; + + #else /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + + #if defined(_GLIBCXX_VECTOR) + + _Destroy(this->_M_impl._M_start, this->_M_impl._M_finish); + + _M_deallocate(this->_M_impl._M_start, this->_M_impl._M_end_of_storage - this->_M_impl._M_start); + + this->_M_impl._M_start = this->_M_impl._M_finish = this->_M_impl._M_end_of_storage = 0; + + #else /* #if defined(_GLIBCXX_VECTOR) */ + + destroy(start, finish); + + deallocate(); + + start = finish = end_of_storage = 0; + + #endif /* #if defined(_GLIBCXX_VECTOR) */ + + #endif /* #if defined(__STL_USE_STD_ALLOCATORS) || defined(__GLIBCPP_INTERNAL_VECTOR_H) */ + } + #endif /* #ifndef _LIBCPP_VECTOR */ +}; + +typedef md5_byte_t * T_checksum; + +struct T_less +{ + bool operator()(T_checksum a, T_checksum b) const + { + return (memcmp(a, b, MD5_LENGTH) < 0); + } +}; + +typedef map < T_checksum, int, T_less > T_checksums; + +class Split; + +typedef list < Split * > T_splits; + +class File; + +struct T_older +{ + bool operator()(File *a, File *b) const; +}; + +typedef set < File *, T_older > T_files; + +typedef list < int > T_list; + +// +// Used to accommodate data to be read and +// written to a socket. +// + +typedef struct +{ + T_data data_; + int length_; + int start_; +} +T_buffer; + +// +// The message store operation that was +// executed for the message. The channels +// use these values to determine how to +// handle the message after it has been +// received at the decoding side. +// + +// Since ProtoStep8 (#issue 108) +enum T_store_action +{ + is_hit, + is_added, + is_discarded, + is_removed +}; + +// Since ProtoStep8 (#issue 108) +#define IS_HIT is_hit +#define IS_ADDED is_added + +enum T_checksum_action +{ + use_checksum, + discard_checksum +}; + +enum T_data_action +{ + use_data, + discard_data +}; + +// +// Message is going to be weighted for +// deletion at insert or cleanup time? +// + +enum T_rating +{ + rating_for_insert, + rating_for_clean +}; + +// +// How to handle the writes to the X +// and proxy connections. +// + +enum T_write +{ + write_immediate, + write_delayed +}; + +enum T_flush +{ + flush_if_needed, + flush_if_any +}; + +// +// This is the value to indicate an +// invalid position in the message +// store. +// + +static const int nothing = -1; + +#endif /* Types_H */ diff --git a/nxcomp/src/Unpack.cpp b/nxcomp/src/Unpack.cpp new file mode 100644 index 000000000..e63e836f0 --- /dev/null +++ b/nxcomp/src/Unpack.cpp @@ -0,0 +1,1514 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Misc.h" +#include "Unpack.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +// +// Used for the ZLIB decompression +// of RGB, alpha and colormap data. +// + +z_stream unpackStream; + +static int unpackInitialized; + +int Unpack8To8(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To8(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To16(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To16(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To24(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To32(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack8To32(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack15To16(const unsigned char *data, unsigned char *out, + unsigned char *end); + +int Unpack15To24(const unsigned char *data, unsigned char *out, + unsigned char *end); + +int Unpack15To32(const unsigned char *data, unsigned char *out, + unsigned char *end); + +int Unpack16To16(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack16To16(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder); + +int Unpack16To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack16To24(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder); + +int Unpack16To32(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack16To32(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder); + +int Unpack24To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack24To24(const unsigned char *data, unsigned char *out, + unsigned char *end); + +int Unpack24To32(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + +int Unpack24To32(const unsigned char *data, unsigned char *out, unsigned char *end); + +int Unpack32To32(const T_colormask *colormask, const unsigned int *data, + unsigned int *out, unsigned int *end); + + +void UnpackInit() +{ + if (unpackInitialized == 0) + { + unpackStream.zalloc = (alloc_func) 0; + unpackStream.zfree = (free_func) 0; + unpackStream.opaque = (voidpf) 0; + + unpackStream.next_in = (Bytef *) 0; + unpackStream.avail_in = 0; + + int result = inflateInit2(&unpackStream, 15); + + if (result != Z_OK) + { + #ifdef PANIC + *logofs << "UnpackInit: PANIC! Cannot initialize the Z stream " + << "for decompression. Error is '" << zError(result) + << "'.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Cannot initialize the Z stream for " + << "decompression. Error is '" << zError(result) + << "'.\n"; + } + else + { + unpackInitialized = 1; + } + } +} + +void UnpackDestroy() +{ + if (unpackInitialized == 1) + { + inflateEnd(&unpackStream); + + unpackInitialized = 0; + } +} + +// +// Get bits per pixel set by client +// according to display geometry. +// + +int UnpackBitsPerPixel(T_geometry *geometry, unsigned int depth) +{ + switch (depth) + { + case 1: + { + return geometry -> depth1_bpp; + } + case 4: + { + return geometry -> depth4_bpp; + } + case 8: + { + return geometry -> depth8_bpp; + } + case 15: + case 16: + { + return geometry -> depth16_bpp; + } + case 24: + { + return geometry -> depth24_bpp; + } + case 32: + { + return geometry -> depth32_bpp; + } + default: + { + return 0; + } + } +} + +int Unpack8To8(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To8: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + memcpy(out, data, end - out); + + return 1; +} + +int Unpack8To16(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To16: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned short *out16 = (unsigned short *) out; + unsigned short *end16 = (unsigned short *) end; + + while (out16 < end16) + { + if (*data == 0) + { + *out16 = 0x0; + } + else if (*data == 0xff) + { + *out16 = 0xffff; + } + else + { + // + // Pixel layout: + // + // 8bits 00RRGGBB -> 16bits RR000GG0 000BB000. + // + + *out16 = (((((*data & 0x30) << 2) | colormask -> correction_mask) << 8) & 0xf800) | + (((((*data & 0xc) << 4) | colormask -> correction_mask) << 3) & 0x7e0) | + (((((*data & 0x3) << 6) | colormask -> correction_mask) >> 3) & 0x1f); + } + + out16++; + data++; + } + + return 1; +} + +int Unpack8To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To24: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + while (out < (end - 2)) + { + if (*data == 0x00) + { + out[0] = out[1] = out[2] = 0x00; + } + else if (*data == 0xff) + { + out[0] = out[1] = out[2] = 0xff; + } + else + { + // + // Pixel layout: + // + // 8bits 00RRGGBB -> 24bits RR000000 GG00000 BB000000. + // + + out[0] = (((*data & 0x30) << 2) | colormask -> correction_mask); + out[1] = (((*data & 0x0c) << 4) | colormask -> correction_mask); + out[2] = (((*data & 0x03) << 6) | colormask -> correction_mask); + } + + out += 3; + data += 1; + } + + return 1; +} + +int Unpack8To32(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To32: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + while (out32 < end32) + { + if (*data == 0) + { + *out32 = 0x0; + } + else if (*data == 0xff) + { + *out32 = 0xffffff; + } + else + { + *out32 = ((((*data & 0x30) << 2) | colormask -> correction_mask) << 16) | + ((((*data & 0xc) << 4) | colormask -> correction_mask) << 8) | + (((*data & 0x3) << 6) | colormask -> correction_mask); + } + + out32++; + data++; + } + + return 1; +} + +int Unpack8(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size) +{ + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + int (*unpack)(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + + switch (dst_bpp) + { + case 8: + { + unpack = Unpack8To8; + + break; + } + case 16: + { + unpack = Unpack8To16; + + break; + } + case 24: + { + unpack = Unpack8To24; + + break; + } + case 32: + { + unpack = Unpack8To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack8: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 16/24/32 are supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (dst_bpp == 24) + { + unsigned char *dst_end = dst_data; + + #ifdef TEST + *logofs << "Unpack8: Handling 24 bits with dst_size " + << dst_size << ".\n" << logofs_flush; + #endif + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + + dst_end += RoundUp4(dst_width * 3); + + (*unpack)(colormask, src_data, dst_data, dst_end); + + src_data += src_width; + } + } + else + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(colormask, src_data, dst_data, dst_end); + } + + return 1; +} + +int Unpack16To16(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack16To16: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + if (colormask -> correction_mask) + { + unsigned short *data16 = (unsigned short *) data; + + unsigned short *out16 = (unsigned short *) out; + unsigned short *end16 = (unsigned short *) end; + + while (out16 < end16) + { + if (*data16 == 0x0000) + { + *out16 = 0x0000; + } + else if (*data16 == 0xffff) + { + *out16 = 0xffff; + } + else + { + // + // Pixel layout: + // + // 16bit RRRRRGGG GG0BBBBB -> RRRRRGGG GGGBBBBB. + // + + *out16 = (((((*data16 & 0xf100) >> 8) | colormask -> correction_mask) << 8) & 0xf800) | + (((((*data16 & 0x7c0) >> 3) | colormask -> correction_mask) << 3) & 0x7e0) | + (((((*data16 & 0x1f) << 3) | colormask -> correction_mask) >> 3) & 0x1f); + } + + out16++; + data16++; + } + } + else + { + #ifdef TEST + *logofs << "Unpack16To16: Using bitwise copy due to null correction mask.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) out, (unsigned char *) data, end - out); + } + + return 1; +} + +int Unpack16To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack16To24: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + + + while (out < end - 2) + { + if (*data16 == 0x0) + { + out[0] = 0x00; + out[1] = 0x00; + out[2] = 0x00; + } + else if (*data16 == 0xffff) + { + out[0] = 0xff; + out[1] = 0xff; + out[2] = 0xff; + } + else + { + #ifdef TEST + *logofs << "Unpack16To24: Pixel [" << *data16 << "]\n" + << logofs_flush; + #endif + + // + // Pixel layout: + // + // 16bit 0RRRRRGG GGGBBBBB -> 24 bit RRRRR000 GGGGG000 BBBBB000 + // + + out[0] = (((*data16 & 0x7c00) >> 7) | colormask -> correction_mask); + out[1] = (((*data16 & 0x03e0) >> 2) | colormask -> correction_mask); + out[2] = (((*data16 & 0x001f) << 3) | colormask -> correction_mask); + } + + out += 3; + data16 += 1; + } + + return 1; +} + +int Unpack16To32(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack16To32: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + while (out32 < end32) + { + if (*data16 == 0x0) + { + *out32 = 0x0; + } + else if (*data16 == 0xffff) + { + *out32 = 0xffffff; + } + else + { + *out32 = ((((*data16 & 0x7c00) >> 7) | colormask -> correction_mask) << 16) | + ((((*data16 & 0x3e0) >> 2) | colormask -> correction_mask) << 8) | + (((*data16 & 0x1f) << 3) | colormask -> correction_mask); + } + + out32++; + data16++; + } + + return 1; +} + +int Unpack16(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size) +{ + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + int (*unpack)(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + + switch (dst_bpp) + { + case 16: + { + unpack = Unpack16To16; + + break; + } + case 24: + { + unpack = Unpack16To24; + + break; + } + case 32: + { + unpack = Unpack16To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack16: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 24/32 are supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (dst_bpp == 24) + { + unsigned char *dst_end = dst_data; + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + + dst_end += RoundUp4(dst_width * 3); + + (*unpack)(colormask, src_data, dst_data, dst_end); + + src_data += (src_width * 2); + } + + } + else + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(colormask, src_data, dst_data, dst_end); + } + + return 1; +} + +int Unpack24To24(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack24To24: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + if (colormask -> correction_mask) + { + while (out < end) + { + if (data[0] == 0x00 && + data[1] == 0x00 && + data[2] == 0x00) + { + out[0] = out[1] = out[2] = 0x00; + } + else if (data[0] == 0xff && + data[1] == 0xff && + data[2] == 0xff) + { + out[0] = out[1] = out[2] = 0xff; + } + else + { + out[0] = (data[0] | colormask -> correction_mask); + out[1] = (data[1] | colormask -> correction_mask); + out[2] = (data[2] | colormask -> correction_mask); + } + + out += 3; + data += 3; + } + } + else + { + #ifdef TEST + *logofs << "Unpack24To24: Using bitwise copy due to null correction mask.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) out, (unsigned char *) data, end - out); + } + + return 1; +} + +int Unpack24To32(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack24To32: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + while (out32 < end32) + { + if (colormask -> color_mask == 0xff) + { + *out32 = (data[0] << 16) | (data[1] << 8) | data[2]; + } + else + { + if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x0) + { + *out32 = 0x0; + } + else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) + { + *out32 = 0xffffff; + } + else + { + *out32 = (((unsigned int) data[0] | colormask -> correction_mask) << 16) | + (((unsigned int) data[1] | colormask -> correction_mask) << 8) | + ((unsigned int) data[2] | colormask -> correction_mask); + } + } + + out32 += 1; + data += 3; + } + + return 1; +} + +int Unpack24(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size) +{ + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + int (*unpack)(const T_colormask *colormask, const unsigned char *data, + unsigned char *out, unsigned char *end); + + switch (dst_bpp) + { + case 24: + { + unpack = Unpack24To24; + + break; + } + case 32: + { + unpack = Unpack24To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack24: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 32 is supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (dst_bpp == 24) + { + unsigned char *dst_end; + unsigned long scanline_size = RoundUp4(dst_width * dst_bpp / 8); + + dst_end = dst_data; + + #ifdef TEST + *logofs << "Unpack24: Handling 24 bits with dst_height " + << dst_height << " scanline_size " << scanline_size + << " dst_size " << dst_size << ".\n" << logofs_flush; + #endif + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + + dst_end += scanline_size; + + (*unpack)(colormask, src_data, dst_data, dst_end); + + src_data += scanline_size; + } + } + else + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(colormask, src_data, dst_data, dst_end); + } + + return 1; +} + +int Unpack8To8(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To8: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + while (out < end) + { + *(out++) = (unsigned char) colormap -> data[*(data++)]; + } + + return 1; +} + +int Unpack8To16(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To16: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + unsigned short *out16 = (unsigned short *) out; + unsigned short *end16 = (unsigned short *) end; + + while (out16 < end16) + { + *(out16++) = (unsigned short) colormap -> data[*(data++)]; + } + + return 1; +} + +int Unpack8To24(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To24: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + unsigned int value; + + while (out < end) + { + value = colormap -> data[*(data++)]; + + *(out++) = value; + *(out++) = value >> 8; + *(out++) = value >> 16; + } + + return 1; +} + +int Unpack8To32(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack8To32: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + while (out32 < end32) + { + *(out32++) = colormap -> data[*(data++)]; + } + + return 1; +} + +int Unpack8(T_geometry *geometry, T_colormap *colormap, int src_depth, int src_width, int src_height, + unsigned char *src_data, int src_size, int dst_depth, int dst_width, + int dst_height, unsigned char *dst_data, int dst_size) +{ + if (src_depth != 8) + { + #ifdef PANIC + *logofs << "Unpack8: PANIC! Cannot unpack colormapped image of source depth " + << src_depth << ".\n" << logofs_flush; + #endif + + return -1; + } + + int (*unpack)(T_colormap *colormap, const unsigned char *data, + unsigned char *out, unsigned char *end); + + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + switch (dst_bpp) + { + case 8: + { + unpack = Unpack8To8; + + break; + } + case 16: + { + unpack = Unpack8To16; + + break; + } + case 24: + { + unpack = Unpack8To24; + + break; + } + case 32: + { + unpack = Unpack8To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack8: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 8/16/24/32 are supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (src_width == dst_width && + src_height == dst_height) + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(colormap, src_data, dst_data, dst_end); + } + else if (src_width >= dst_width && + src_height >= dst_height) + { + unsigned char *dst_end = dst_data; + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + + dst_end += RoundUp4(dst_width * dst_bpp / 8); + + (*unpack)(colormap, src_data, dst_data, dst_end); + + src_data += src_width; + } + } + else + { + #ifdef PANIC + *logofs << "Unpack8: PANIC! Cannot unpack image. " + << "Destination area " << dst_width << "x" + << dst_height << " is not fully contained in " + << src_width << "x" << src_height << " source.\n" + << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int Unpack15To16(const unsigned char *data, unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack15To16: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + unsigned short *out16 = (unsigned short *) out; + unsigned short *end16 = (unsigned short *) end; + + while (out16 < end16) + { + if (*data16 == 0x0) + { + *out16 = 0x0; + } + else if (*data16 == 0x7fff) + { + *out16 = 0xffff; + } + else + { + #ifdef TEST + *logofs << "Unpack15To16: Pixel [" << *data16 << "]\n" + << logofs_flush; + #endif + + *out16 = ((*data16 & 0x7ff0) << 1) | + (*data16 & 0x001f); + } + + out16 += 1; + data16 += 1; + } + + return 1; +} + +int Unpack15To24(const unsigned char *data, unsigned char *out, unsigned char *end) + +{ + #ifdef TEST + *logofs << "Unpack15To24: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + + while (out < end - 2) + { + if (*data16 == 0x0) + { + out[0] = 0x00; + out[1] = 0x00; + out[2] = 0x00; + } + else if (*data16 == 0x7fff) + { + out[0] = 0xff; + out[1] = 0xff; + out[2] = 0xff; + } + else + { + #ifdef TEST + *logofs << "Unpack15To24: Pixel [" << *data16 << "]\n" + << logofs_flush; + #endif + + out[0] = ((*data16 >> 7) & 0xf8) | ((*data16 >> 12) & 0x07); + out[1] = ((*data16 >> 2) & 0xf8) | ((*data16 >> 8) & 0x07); + out[2] = ((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07); + } + + out += 3; + data16 += 1; + } + + return 1; +} + +int Unpack15To32(const unsigned char *data, unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack15To32: Unpacking " << end - out + << " bytes of data.\n" + << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + while (out32 < end32) + { + if (*data16 == 0x0) + { + *out32 = 0x0; + } + else if (*data16 == 0xffff) + { + *out32 = 0xffffff; + } + else + { + *out32 = ((((*data16 >> 7) & 0xf8) | ((*data16 >> 12) & 0x07)) << 16) | + ((((*data16 >> 2) & 0xf8) | ((*data16 >> 8) & 0x07)) << 8) | + (((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07)); + } + + out32++; + data16++; + } + + return 1; +} + +int Unpack15(T_geometry *geometry, int src_depth, int src_width, int src_height, + unsigned char *src_data, int src_size, int dst_depth, int dst_width, + int dst_height, unsigned char *dst_data, int dst_size) +{ + if (src_depth != 16) + { + #ifdef PANIC + *logofs << "Unpack15: PANIC! Cannot unpack colormapped image of source depth " + << src_depth << ".\n" << logofs_flush; + #endif + + return -1; + } + + int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end); + + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + switch (dst_bpp) + { + case 16: + { + unpack = Unpack15To16; + + break; + } + case 24: + { + unpack = Unpack15To24; + + break; + } + case 32: + { + unpack = Unpack15To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack15: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 16/24/32 are supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (src_width == dst_width && src_height == dst_height) + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(src_data, dst_data, dst_end); + } + else if (src_width >= dst_width && src_height >= dst_height) + { + unsigned char *dst_end = dst_data; + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + dst_end += RoundUp4(dst_width * dst_bpp / 8); + + (*unpack)(src_data, dst_data, dst_end); + + src_data += src_width * 2; + } + } + else + { + #ifdef PANIC + *logofs << "Unpack15: PANIC! Cannot unpack image. " + << "Destination area " << dst_width << "x" + << dst_height << " is not fully contained in " + << src_width << "x" << src_height << " source.\n" + << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int Unpack16To16(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder) +{ + #ifdef TEST + *logofs << "Unpack16To16: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) out, (unsigned char *) data, end - out); + + return 1; +} + +int Unpack16To24(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder) + +{ + #ifdef TEST + *logofs << "Unpack16To24: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + + while (out < end - 2) + { + if (*data16 == 0x0) + { + out[0] = 0x00; + out[1] = 0x00; + out[2] = 0x00; + } + else if (*data16 == 0xffff) + { + out[0] = 0xff; + out[1] = 0xff; + out[2] = 0xff; + } + else + { + #ifdef TEST + *logofs << "Unpack16To24: Pixel [" << *data16 << "]\n" + << logofs_flush; + #endif + + out[0] = ((*data16 >> 8) & 0xf8) | ((*data16 >> 13) & 0x07); + out[1] = ((*data16 >> 3) & 0xfc) | ((*data16 >> 9) & 0x03); + out[2] = ((*data16 << 3) & 0xf8) | ((*data16 >> 2) & 0x07); + } + + out += 3; + data16 += 1; + } + + return 1; +} + + +int Unpack16To32(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder) +{ + #ifdef TEST + *logofs << "Unpack16To32: Unpacking " << end - out + << " bytes of data.\n" + << logofs_flush; + #endif + + unsigned short *data16 = (unsigned short *) data; + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + unsigned short pixel16; + unsigned int pixel32; + + while (out32 < end32) + { + + pixel16 = GetUINT((unsigned char *)data16, 0); + + if (pixel16 == 0x0) + { + PutULONG(0x0, (unsigned char *) out32, imageByteOrder); + } + else if (pixel16 == 0xffff) + { + PutULONG(0xffffff, (unsigned char *) out32, imageByteOrder); + } + else + { + pixel32 = ((((pixel16 >> 8) & 0xf8) | ((pixel16 >> 13) & 0x07)) << 16) | + ((((pixel16 >> 3) & 0xfc) | ((pixel16 >> 9) & 0x03)) << 8) | + (((pixel16 << 3) & 0xf8) | ((pixel16 >> 2) & 0x07)); + + PutULONG(pixel32, (unsigned char *) out32, imageByteOrder); + } + + out32++; + data16++; + } + return 1; +} + +int Unpack16(T_geometry *geometry, int src_depth, int src_width, int src_height, + unsigned char *src_data, int src_size, int dst_depth, int dst_width, + int dst_height, unsigned char *dst_data, int dst_size) +{ + int imageByteOrder = geometry -> image_byte_order; + + if (src_depth != 16) + { + #ifdef PANIC + *logofs << "Unpack16: PANIC! Cannot unpack colormapped image of source depth " + << src_depth << ".\n" << logofs_flush; + #endif + + return -1; + } + + int (*unpack)(const unsigned char *data, unsigned char *out, + unsigned char *end, int imageByteOrder); + + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + switch (dst_bpp) + { + case 16: + { + unpack = Unpack16To16; + + break; + } + case 24: + { + unpack = Unpack16To24; + + break; + } + case 32: + { + unpack = Unpack16To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack16: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 16/24/32 are supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (src_width == dst_width && src_height == dst_height) + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(src_data, dst_data, dst_end, imageByteOrder); + } + else if (src_width >= dst_width && src_height >= dst_height) + { + unsigned char *dst_end = dst_data; + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + dst_end += RoundUp4(dst_width * dst_bpp / 8); + + (*unpack)(src_data, dst_data, dst_end, imageByteOrder); + + src_data += src_width * 2; + } + } + else + { + #ifdef PANIC + *logofs << "Unpack16: PANIC! Cannot unpack image. " + << "Destination area " << dst_width << "x" + << dst_height << " is not fully contained in " + << src_width << "x" << src_height << " source.\n" + << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int Unpack24To24(const unsigned char *data, + unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack124To24: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + while (out < end) + { + *(out++) = *(data++); + } + + return 1; +} + +int Unpack24To32(const unsigned char *data, unsigned char *out, unsigned char *end) +{ + #ifdef TEST + *logofs << "Unpack24To32: Unpacking " << end - out + << " bytes of colormapped data.\n" + << logofs_flush; + #endif + + unsigned int *out32 = (unsigned int *) out; + unsigned int *end32 = (unsigned int *) end; + + while (out32 < end32) + { + if (data[0] == 0x0 && data[1] == 0x0 && data[2] == 0x0) + { + *out32 = 0x0; + } + else if (data[0] == 0xff && data[1] == 0xff && data[2] == 0xff) + { + *out32 = 0xffffff; + } + else + { + *out32 = (data[2] << 16) | (data[1] << 8) | data[0]; + } + + out32 += 1; + data += 3; + } + + return 1; +} + +int Unpack24(T_geometry *geometry, int src_depth, int src_width, int src_height, + unsigned char *src_data, int src_size, int dst_depth, int dst_width, + int dst_height, unsigned char *dst_data, int dst_size) + +{ + if (src_depth != 24) + { + #ifdef PANIC + *logofs << "Unpack24: PANIC! Cannot unpack colormapped image of source depth " + << src_depth << ".\n" << logofs_flush; + #endif + + return -1; + } + + int (*unpack)(const unsigned char *data, unsigned char *out, unsigned char *end); + + int dst_bpp = UnpackBitsPerPixel(geometry, dst_depth); + + switch (dst_bpp) + { + case 24: + { + unpack = Unpack24To24; + + break; + } + case 32: + { + unpack = Unpack24To32; + + break; + } + default: + { + #ifdef PANIC + *logofs << "Unpack24: PANIC! Bad destination bits per pixel " + << dst_bpp << ". Only 24/32 are supported.\n" + << logofs_flush; + #endif + + return -1; + } + } + + if (src_width == dst_width && src_height == dst_height) + { + unsigned char *dst_end = dst_data + dst_size; + + (*unpack)(src_data, dst_data, dst_end); + } + else if (src_width >= dst_width && src_height >= dst_height) + { + unsigned char *dst_end = dst_data; + + for (int y = 0; y < dst_height; y++) + { + dst_data = dst_end; + dst_end += RoundUp4(dst_width * dst_bpp / 8); + + (*unpack)(src_data, dst_data, dst_end); + + src_data += src_width * 3; + } + } + else + { + #ifdef PANIC + *logofs << "Unpack24: PANIC! Cannot unpack image. " + << "Destination area " << dst_width << "x" + << dst_height << " is not fully contained in " + << src_width << "x" << src_height << " source.\n" + << logofs_flush; + #endif + + return -1; + } + + return 1; +} + +int Unpack32To32(const T_colormask *colormask, const unsigned int *data, + unsigned int *out, unsigned int *end) +{ + #ifdef TEST + *logofs << "Unpack32To32: Unpacking " << end - out + << " bytes of data.\n" << logofs_flush; + #endif + + if (colormask -> correction_mask) + { + while (out < end) + { + if (*data == 0x00000000) + { + *out = 0x00000000; + } + else if (*data == 0xFFFFFFFF) + { + *out = 0xFFFFFFFF; + } + else + { + *out = *data | ((colormask -> correction_mask << 16) | + (colormask -> correction_mask << 8) | + colormask -> correction_mask); + } + + out += 1; + data += 1; + } + } + else + { + #ifdef TEST + *logofs << "Unpack32To32: Using bitwise copy due to null correction mask.\n" + << logofs_flush; + #endif + + memcpy((unsigned char *) out, (unsigned char *) data, end - out); + } + + return 1; +} diff --git a/nxcomp/src/Unpack.h b/nxcomp/src/Unpack.h new file mode 100644 index 000000000..faaa41d82 --- /dev/null +++ b/nxcomp/src/Unpack.h @@ -0,0 +1,149 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Unpack_H +#define Unpack_H + +#include "NXpack.h" + +#include "Z.h" + +#define LSBFirst 0 +#define MSBFirst 1 + +#define SPLIT_PATTERN 0x88 + +typedef ColorMask T_colormask; + +// +// Pixel geometry of channel's display. +// + +typedef struct +{ + unsigned int depth1_bpp; + unsigned int depth4_bpp; + unsigned int depth8_bpp; + unsigned int depth16_bpp; + unsigned int depth24_bpp; + unsigned int depth32_bpp; + + unsigned int red_mask; + unsigned int green_mask; + unsigned int blue_mask; + + unsigned int image_byte_order; + unsigned int bitmap_bit_order; + unsigned int scanline_unit; + unsigned int scanline_pad; + +} T_geometry; + +// +// Colormap is used to remap colors +// from source to destination depth. +// + +typedef struct +{ + unsigned int entries; + unsigned int *data; + +} T_colormap; + +// +// Alpha channel data is added to 32 +// bits images at the time they are +// unpacked. +// + +typedef struct +{ + unsigned int entries; + unsigned char *data; + +} T_alpha; + +// +// The ZLIB stream structure used for +// the decompression. +// + +extern z_stream unpackStream; + +// +// Initialize the ZLIB stream used for +// decompression. +// + +void UnpackInit(); + +// +// Free the ZLIB stream. +// + +void UnpackDestroy(); + +// +// Get the destination bits per pixel +// based on the drawable depth. +// + +int UnpackBitsPerPixel(T_geometry *geometry, unsigned int depth); + +// +// Unpack the source data into the X +// bitmap. +// + +int Unpack8(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +int Unpack16(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +int Unpack24(T_geometry *geometry, const T_colormask *colormask, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +int Unpack8(T_geometry *geometry, T_colormap *colormap, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +int Unpack15(T_geometry *geometry, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +int Unpack16(T_geometry *geometry, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +int Unpack24(T_geometry *geometry, int src_depth, int src_width, + int src_height, unsigned char *src_data, int src_size, int dst_depth, + int dst_width, int dst_height, unsigned char *dst_data, int dst_size); + +#endif /* Unpack_H */ diff --git a/nxcomp/src/Vars.c b/nxcomp/src/Vars.c new file mode 100644 index 000000000..685969677 --- /dev/null +++ b/nxcomp/src/Vars.c @@ -0,0 +1,54 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef __cplusplus +extern "C" { +#endif + +#include + +#include "NXvars.h" + +/* + * Allocate here instances of variables and + * pointers declared in NXvars.h. + */ + +int _NXHandleDisplayError = 0; + +NXDisplayErrorPredicate _NXDisplayErrorFunction = NULL; + +int _NXUnsetLibraryPath = 0; + +NXLostSequenceHandler _NXLostSequenceFunction = NULL; + +NXDisplayBlockHandler _NXDisplayBlockFunction = NULL; +NXDisplayWriteHandler _NXDisplayWriteFunction = NULL; +NXDisplayFlushHandler _NXDisplayFlushFunction = NULL; +NXDisplayStatisticsHandler _NXDisplayStatisticsFunction = NULL; + +#ifdef __cplusplus +} +#endif diff --git a/nxcomp/src/Version.c b/nxcomp/src/Version.c new file mode 100644 index 000000000..509bd8344 --- /dev/null +++ b/nxcomp/src/Version.c @@ -0,0 +1,101 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2015 Qindel Formacion y Servicios SL. */ +/* */ +/* This program is free software; you can redistribute it and/or modify */ +/* it under the terms of the GNU General Public License Version 2, as */ +/* published by the Free Software Foundation. */ +/* */ +/* This program is distributed in the hope that it will be useful, but */ +/* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTA- */ +/* BILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General */ +/* Public License for more details. */ +/* */ +/* You should have received a copy of the GNU General Public License */ +/* along with this program; if not, you can request a copy from Qindel */ +/* or write to the Free Software Foundation, Inc., 51 Franklin Street, */ +/* Fifth Floor, Boston, MA 02110-1301 USA. */ +/* */ +/* All rights reserved. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include "NX.h" + + +static int _NXVersionMajor = -1; +static int _NXVersionMinor = -1; +static int _NXVersionPatch = -1; +static int _NXVersionMaintenancePatch = -1; + + +const char* NXVersion() { + const char *version = VERSION; + return version; +} + +void _parseNXVersion() { + char version[32]; + int i; + strcpy(version, VERSION); + + char *value; + /* Reset values to 0 if undefined */ + _NXVersionMajor = _NXVersionMinor = _NXVersionPatch = _NXVersionMaintenancePatch = 0; + + +#define NXVERSIONSEPARATOR "." + value = strtok(version, NXVERSIONSEPARATOR); + + for (i = 0; value != NULL && i < 4; i++) + { + switch (i) + { + case 0: + _NXVersionMajor = atoi(value); + break; + + case 1: + _NXVersionMinor = atoi(value); + break; + + case 2: + _NXVersionPatch = atoi(value); + break; + + case 3: + _NXVersionMaintenancePatch = atoi(value); + break; + } + + value = strtok(NULL, NXVERSIONSEPARATOR); + } +} + +int NXMajorVersion() { + if (_NXVersionMajor == -1) + _parseNXVersion(); + return _NXVersionMajor; +} +int NXMinorVersion() { + if (_NXVersionMinor == -1) + _parseNXVersion(); + return _NXVersionMinor; +} +int NXPatchVersion() { + if (_NXVersionPatch == -1) + _parseNXVersion(); + return _NXVersionPatch; +} +int NXMaintenancePatchVersion() { + if (_NXVersionMaintenancePatch == -1) + _parseNXVersion(); + return _NXVersionMaintenancePatch; +} diff --git a/nxcomp/src/WriteBuffer.cpp b/nxcomp/src/WriteBuffer.cpp new file mode 100644 index 000000000..70b4e3b53 --- /dev/null +++ b/nxcomp/src/WriteBuffer.cpp @@ -0,0 +1,500 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include +#include +#include +#include + +#include "Misc.h" +#include "Control.h" + +#include "WriteBuffer.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +WriteBuffer::WriteBuffer() +{ + size_ = WRITE_BUFFER_DEFAULT_SIZE; + buffer_ = new unsigned char[size_]; + length_ = 0; + index_ = NULL; + + scratchLength_ = 0; + scratchBuffer_ = NULL; + scratchOwner_ = 1; + + initialSize_ = WRITE_BUFFER_DEFAULT_SIZE; + thresholdSize_ = WRITE_BUFFER_DEFAULT_SIZE << 1; + maximumSize_ = WRITE_BUFFER_DEFAULT_SIZE << 4; + + #ifdef VALGRIND + + memset(buffer_, '\0', size_); + + #endif +} + +WriteBuffer::~WriteBuffer() +{ + if (scratchOwner_ == 1 && + scratchBuffer_ != NULL) + { + delete [] scratchBuffer_; + } + + delete [] buffer_; +} + +void WriteBuffer::setSize(unsigned int initialSize, unsigned int thresholdSize, + unsigned int maximumSize) +{ + initialSize_ = initialSize; + thresholdSize_ = thresholdSize; + maximumSize_ = maximumSize; + + #ifdef TEST + *logofs << "WriteBuffer: Set buffer sizes to " + << initialSize_ << "/" << thresholdSize_ + << "/" << maximumSize_ << ".\n" + << logofs_flush; + #endif +} + +void WriteBuffer::partialReset() +{ + if (scratchBuffer_ != NULL) + { + if (scratchOwner_) + { + #ifdef DEBUG + *logofs << "WriteBuffer: Going to delete " + << scratchLength_ << " bytes from the " + << "scratch buffer.\n" << logofs_flush; + #endif + + delete [] scratchBuffer_; + } + + scratchLength_ = 0; + scratchBuffer_ = NULL; + scratchOwner_ = 1; + } + + length_ = 0; + index_ = NULL; + + #ifdef DEBUG + *logofs << "WriteBuffer: Performed partial reset with " + << size_ << " bytes in buffer.\n" + << logofs_flush; + #endif +} + +void WriteBuffer::fullReset() +{ + if (scratchBuffer_ != NULL) + { + if (scratchOwner_ == 1) + { + #ifdef DEBUG + *logofs << "WriteBuffer: Going to delete " + << scratchLength_ << " bytes from the " + << "scratch buffer.\n" << logofs_flush; + #endif + + delete [] scratchBuffer_; + } + + scratchLength_ = 0; + scratchBuffer_ = NULL; + scratchOwner_ = 1; + } + + length_ = 0; + index_ = NULL; + + if (size_ > initialSize_) + { + #ifdef TEST + *logofs << "WriteBuffer: Reallocating a new buffer of " + << initialSize_ << " bytes.\n" << logofs_flush; + #endif + + delete [] buffer_; + + size_ = initialSize_; + + buffer_ = new unsigned char[size_]; + + if (buffer_ == NULL) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't allocate memory for " + << "X messages in context [A].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "X messages in context [A].\n"; + + HandleAbort(); + } + + #ifdef VALGRIND + + memset(buffer_, '\0', size_); + + #endif + } + + #ifdef DEBUG + *logofs << "WriteBuffer: Performed full reset with " + << size_ << " bytes in buffer.\n" + << logofs_flush; + #endif +} + +unsigned char *WriteBuffer::addMessage(unsigned int numBytes) +{ + #ifdef DEBUG + *logofs << "WriteBuffer: Adding " << numBytes << " bytes to " + << length_ << " bytes already in buffer.\n" + << logofs_flush; + #endif + + if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't add a message of " + << numBytes << " bytes.\n" << logofs_flush; + + *logofs << "WriteBuffer: PANIC! Assuming error handling " + << "data in context [B].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't add a message of " + << numBytes << " bytes to write buffer.\n"; + + cerr << "Error" << ": Assuming error handling " + << "data in context [B].\n"; + + HandleAbort(); + } + else if (length_ + numBytes > size_) + { + unsigned int newSize = thresholdSize_; + + while (newSize < length_ + numBytes) + { + newSize <<= 1; + + if (newSize > maximumSize_) + { + newSize = length_ + numBytes + initialSize_; + } + } + + #ifdef TEST + *logofs << "WriteBuffer: Growing buffer from " + << size_ << " to " << newSize << " bytes.\n" + << logofs_flush; + #endif + + unsigned int indexOffset = 0; + + if (index_ && *index_) + { + indexOffset = *index_ - buffer_; + } + + size_ = newSize; + + unsigned char *newBuffer = new unsigned char[size_]; + + if (newBuffer == NULL) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't allocate memory for " + << "X messages in context [C].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "X messages in context [C].\n"; + + HandleAbort(); + } + + #ifdef TEST + if (newSize >= maximumSize_) + { + *logofs << "WriteBuffer: WARNING! Buffer grown to reach " + << "size of " << newSize << " bytes.\n" + << logofs_flush; + } + #endif + + #ifdef VALGRIND + + memset(newBuffer, '\0', size_); + + #endif + + memcpy(newBuffer, buffer_, length_); + + #ifdef DEBUG + *logofs << "WriteBuffer: Going to delete the " + << "old buffer with new size " << size_ + << ".\n" << logofs_flush; + #endif + + delete [] buffer_; + + buffer_ = newBuffer; + + if (index_ && *index_) + { + *index_ = buffer_ + indexOffset; + } + } + + unsigned char *result = buffer_ + length_; + + length_ += numBytes; + + #ifdef DEBUG + *logofs << "WriteBuffer: Bytes in buffer are " + << length_ << " while size is " << size_ + << ".\n" << logofs_flush; + #endif + + return result; +} + +unsigned char *WriteBuffer::removeMessage(unsigned int numBytes) +{ + #ifdef TEST + *logofs << "WriteBuffer: Removing " << numBytes + << " bytes from buffer.\n" << logofs_flush; + #endif + + if (numBytes > length_) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't remove " + << numBytes << " bytes with only " << length_ + << " bytes in buffer.\n" << logofs_flush; + #endif + + cerr << "Error" << ": Buffer underflow handling " + << "write buffer in context [D].\n"; + + HandleAbort(); + } + + length_ -= numBytes; + + #ifdef TEST + *logofs << "WriteBuffer: Bytes in buffer are now " + << length_ << " while size is " + << size_ << ".\n" << logofs_flush; + #endif + + return (buffer_ + length_); +} + +unsigned char *WriteBuffer::addScratchMessage(unsigned int numBytes) +{ + if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't add a message of " + << numBytes << " bytes.\n" << logofs_flush; + + *logofs << "WriteBuffer: PANIC! Assuming error handling " + << "data in context [E].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't add a message of " + << numBytes << " bytes to write buffer.\n"; + + cerr << "Error" << ": Assuming error handling " + << "data in context [E].\n"; + + HandleAbort(); + } + else if (scratchBuffer_ != NULL) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't add a message of " + << numBytes << " bytes with " << scratchLength_ + << " bytes already in scratch buffer.\n" + << logofs_flush; + + *logofs << "WriteBuffer: PANIC! Assuming error handling " + << "data in context [F].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't add a message of " + << numBytes << " bytes with " << scratchLength_ + << " bytes already in scratch buffer.\n"; + + cerr << "Error" << ": Assuming error handling " + << "data in context [F].\n"; + + HandleAbort(); + } + + #ifdef DEBUG + *logofs << "WriteBuffer: Adding " << numBytes << " bytes " + << "to scratch buffer.\n" << logofs_flush; + #endif + + unsigned char *newBuffer = new unsigned char[numBytes]; + + if (newBuffer == NULL) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't allocate memory for " + << "X messages in context [G].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't allocate memory for " + << "X messages in context [G].\n"; + + HandleAbort(); + } + + #ifdef VALGRIND + + memset(newBuffer, '\0', numBytes); + + #endif + + scratchBuffer_ = newBuffer; + scratchOwner_ = 1; + scratchLength_ = numBytes; + + return newBuffer; +} + +unsigned char *WriteBuffer::addScratchMessage(unsigned char *newBuffer, unsigned int numBytes) +{ + if (numBytes > WRITE_BUFFER_OVERFLOW_SIZE) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't add a message of " + << numBytes << " bytes.\n" << logofs_flush; + + *logofs << "WriteBuffer: PANIC! Assuming error handling " + << "data in context [H].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't add a message of " + << numBytes << " bytes to write buffer.\n"; + + cerr << "Error" << ": Assuming error handling " + << "data in context [H].\n"; + + HandleAbort(); + } + else if (scratchBuffer_ != NULL) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't add a foreign " + << "message of " << numBytes << " bytes with " + << scratchLength_ << " bytes already in " + << "scratch buffer.\n" << logofs_flush; + + *logofs << "WriteBuffer: PANIC! Assuming error handling " + << "data in context [I].\n" << logofs_flush; + #endif + + cerr << "Error" << ": Can't add a foreign message of " + << numBytes << " bytes with " << scratchLength_ + << " bytes already in scratch buffer.\n"; + + cerr << "Error" << ": Assuming error handling " + << "data in context [I].\n"; + + HandleAbort(); + } + + #ifdef DEBUG + *logofs << "WriteBuffer: Adding " << numBytes << " bytes " + << "from a foreign message to scratch buffer.\n" + << logofs_flush; + #endif + + scratchBuffer_ = newBuffer; + scratchLength_ = numBytes; + scratchOwner_ = 0; + + return newBuffer; +} + +void WriteBuffer::removeScratchMessage() +{ + #ifdef TEST + + if (scratchLength_ == 0 || scratchBuffer_ == NULL) + { + #ifdef PANIC + *logofs << "WriteBuffer: PANIC! Can't remove non existent scratch message.\n" + << logofs_flush; + #endif + + cerr << "Error" << ": Can't remove non existent scratch message.\n"; + + HandleAbort(); + } + + *logofs << "WriteBuffer: Removing " << scratchLength_ + << " bytes from scratch buffer.\n" + << logofs_flush; + + #endif + + if (scratchOwner_ == 1) + { + #ifdef DEBUG + *logofs << "WriteBuffer: Going to delete " + << scratchLength_ << " bytes from the " + << "scratch buffer.\n" << logofs_flush; + #endif + + delete [] scratchBuffer_; + } + + scratchLength_ = 0; + scratchBuffer_ = NULL; + scratchOwner_ = 1; +} diff --git a/nxcomp/src/WriteBuffer.h b/nxcomp/src/WriteBuffer.h new file mode 100644 index 000000000..ce408e210 --- /dev/null +++ b/nxcomp/src/WriteBuffer.h @@ -0,0 +1,134 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef WriteBuffer_H +#define WriteBuffer_H + +#include "Misc.h" + +#define PANIC +#define WARNING +#undef TEST +#undef DEBUG + +#define WRITE_BUFFER_DEFAULT_SIZE 16384 + +// +// Adjust for the biggest reply that we could receive. +// This is likely to be a reply to a X_ListFonts where +// user has a large amount of installed fonts. +// + +#define WRITE_BUFFER_OVERFLOW_SIZE 4194304 + +class WriteBuffer +{ + public: + + WriteBuffer(); + + ~WriteBuffer(); + + void setSize(unsigned int initialSize, unsigned int thresholdSize, + unsigned int maximumSize); + + unsigned char *addMessage(unsigned int numBytes); + + unsigned char *removeMessage(unsigned int numBytes); + + unsigned char *addScratchMessage(unsigned int numBytes); + + // + // This form allows user to provide its own + // buffer as write buffer's scratch area. + // + + unsigned char *addScratchMessage(unsigned char *newBuffer, unsigned int numBytes); + + void removeScratchMessage(); + + void partialReset(); + + void fullReset(); + + unsigned char *getData() const + { + return buffer_; + } + + unsigned int getLength() const + { + return length_; + } + + unsigned int getAvailable() const + { + return (size_ - length_); + } + + unsigned char *getScratchData() const + { + return scratchBuffer_; + } + + unsigned int getScratchLength() const + { + return scratchLength_; + } + + unsigned int getTotalLength() const + { + return (length_ + scratchLength_); + } + + void registerPointer(unsigned char **pointer) + { + index_ = pointer; + } + + void unregisterPointer() + { + index_ = 0; + } + + private: + + unsigned int size_; + unsigned int length_; + + unsigned char *buffer_; + unsigned char **index_; + + unsigned int scratchLength_; + unsigned char *scratchBuffer_; + + int scratchOwner_; + + unsigned int initialSize_; + unsigned int thresholdSize_; + unsigned int maximumSize_; +}; + +#endif /* WriteBuffer_H */ diff --git a/nxcomp/src/XidCache.cpp b/nxcomp/src/XidCache.cpp new file mode 100644 index 000000000..ab6574cc9 --- /dev/null +++ b/nxcomp/src/XidCache.cpp @@ -0,0 +1,51 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Control.h" + +#include "XidCache.h" + +XidCache::XidCache() +{ + for (int i = 0; i < 256; i++) + { + base_[i] = new IntCache(8); + } + + slot_ = 0; + last_ = 0; +} + +XidCache::~XidCache() +{ + for (int i = 0; i < 256; i++) + { + delete base_[i]; + } +} diff --git a/nxcomp/src/XidCache.h b/nxcomp/src/XidCache.h new file mode 100644 index 000000000..8a09ef9b1 --- /dev/null +++ b/nxcomp/src/XidCache.h @@ -0,0 +1,49 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef XidCache_H +#define XidCache_H + +#include "IntCache.h" + +class XidCache +{ + friend class EncodeBuffer; + friend class DecodeBuffer; + + public: + + XidCache(); + ~XidCache(); + + private: + + IntCache *base_[256]; + + unsigned int slot_; + unsigned int last_; +}; + +#endif /* XidCache_H */ diff --git a/nxcomp/src/Z.cpp b/nxcomp/src/Z.cpp new file mode 100644 index 000000000..af3b380f2 --- /dev/null +++ b/nxcomp/src/Z.cpp @@ -0,0 +1,146 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include "Z.h" +#include "Misc.h" + +int ZCompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, + const unsigned char *source, unsigned int sourceLen) +{ + // + // Deal with the possible overflow. + // + + if (stream -> total_out & 0x80000000) + { + #ifdef TEST + *logofs << "ZCompress: Reset stream counters with " + << "total in " << stream -> total_in + << " and total out " << stream -> total_out + << ".\n" << logofs_flush; + #endif + + stream -> total_in = 0; + stream -> total_out = 0; + } + + unsigned int saveOut = stream -> total_out; + + stream -> next_in = (Bytef *) source; + stream -> avail_in = sourceLen; + + // + // Check if the source is bigger than + // 64K on 16-bit machine. + // + + #ifdef MAXSEG_64K + + if ((uLong) stream -> avail_in != sourceLen) return Z_BUF_ERROR; + + #endif + + stream -> next_out = dest; + stream -> avail_out = *destLen; + + #ifdef MAXSEG_64K + + if ((uLong) stream -> avail_out != *destLen) return Z_BUF_ERROR; + + #endif + + int result = deflate(stream, Z_FINISH); + + if (result != Z_STREAM_END) + { + deflateReset(stream); + + return (result == Z_OK ? Z_BUF_ERROR : result); + } + + *destLen = stream -> total_out - saveOut; + + result = deflateReset(stream); + + return result; +} + +int ZDecompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, + const unsigned char *source, unsigned int sourceLen) +{ + stream -> next_in = (Bytef *) source; + stream -> avail_in = sourceLen; + + // + // Deal with the possible overflow. + // + + if (stream -> total_out & 0x80000000) + { + #ifdef TEST + *logofs << "ZDecompress: Reset stream counters with " + << "total in " << stream -> total_in + << " and total out " << stream -> total_out + << ".\n" << logofs_flush; + #endif + + stream -> total_in = 0; + stream -> total_out = 0; + } + + unsigned int saveOut = stream -> total_out; + + if (stream -> avail_in != sourceLen) + { + return Z_BUF_ERROR; + } + + stream -> next_out = dest; + stream -> avail_out = *destLen; + + if (stream -> avail_out != *destLen) + { + return Z_BUF_ERROR; + } + + int result = inflate(stream, Z_FINISH); + + if (result != Z_STREAM_END) + { + inflateReset(stream); + + return (result == Z_OK ? Z_BUF_ERROR : result); + } + + *destLen = stream -> total_out - saveOut; + + result = inflateReset(stream); + + return result; +} diff --git a/nxcomp/src/Z.h b/nxcomp/src/Z.h new file mode 100644 index 000000000..3a6d684c2 --- /dev/null +++ b/nxcomp/src/Z.h @@ -0,0 +1,37 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* NXCOMP, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE.nxcomp which comes in the */ +/* source distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +#ifndef Z_H +#define Z_H + +#include + +int ZCompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, + const unsigned char *source, unsigned int sourceLen); + +int ZDecompress(z_stream *stream, unsigned char *dest, unsigned int *destLen, + const unsigned char *source, unsigned int sourceLen); + +#endif /* Z_H */ diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index 5ec1f9401..60ace92ce 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -9,9 +9,9 @@ nxproxy_SOURCES = \ $(NULL) nxproxy_LDADD = \ - -L$(top_srcdir)/../nxcomp/ -lXcomp \ + -L$(top_srcdir)/../nxcomp/src/.libs -lXcomp \ $(NULL) AM_CPPFLAGS = \ - -I$(top_srcdir)/../nxcomp/ \ + -I$(top_srcdir)/../nxcomp/include/ \ $(NULL) -- cgit v1.2.3 From c350873c7c977efe5210484f04160be45f84ba7e Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 21 Jul 2017 12:31:09 +0200 Subject: Convert nx-X11/lib/ build flow from imake to autotools. --- Makefile | 96 +- debian/libnx-x11-6.symbols | 6 +- debian/libnx-x11-dev.install | 2 + debian/nx-x11-common.install | 4 +- debian/rules | 1 + m4/nx-macros.m4 | 47 + m4/nx-xtrans.m4 | 168 + nx-X11/Imakefile | 7 +- nx-X11/Makefile | 63 +- nx-X11/lib/Imakefile | 19 - nx-X11/lib/Makefile.am | 37 + nx-X11/lib/X11/.gitignore | 1 - nx-X11/lib/X11/AddDIC.c | 149 - nx-X11/lib/X11/AddSF.c | 145 - nx-X11/lib/X11/AllCells.c | 68 - nx-X11/lib/X11/AllPlanes.c | 74 - nx-X11/lib/X11/AllowEv.c | 51 - nx-X11/lib/X11/AuDispose.c | 49 - nx-X11/lib/X11/AuFileName.c | 73 - nx-X11/lib/X11/AuGetBest.c | 136 - nx-X11/lib/X11/AuRead.c | 135 - nx-X11/lib/X11/AutoRep.c | 50 - nx-X11/lib/X11/Backgnd.c | 49 - nx-X11/lib/X11/BdrWidth.c | 53 - nx-X11/lib/X11/Bell.c | 46 - nx-X11/lib/X11/Border.c | 49 - nx-X11/lib/X11/CCC.c | 285 - nx-X11/lib/X11/ChAccCon.c | 59 - nx-X11/lib/X11/ChActPGb.c | 49 - nx-X11/lib/X11/ChClMode.c | 46 - nx-X11/lib/X11/ChCmap.c | 49 - nx-X11/lib/X11/ChGC.c | 52 - nx-X11/lib/X11/ChKeyCon.c | 83 - nx-X11/lib/X11/ChPntCon.c | 55 - nx-X11/lib/X11/ChProp.c | 99 - nx-X11/lib/X11/ChSaveSet.c | 63 - nx-X11/lib/X11/ChWAttrs.c | 57 - nx-X11/lib/X11/ChWindow.c | 54 - nx-X11/lib/X11/ChkIfEv.c | 138 - nx-X11/lib/X11/ChkMaskEv.c | 90 - nx-X11/lib/X11/ChkTypEv.c | 81 - nx-X11/lib/X11/ChkTypWEv.c | 83 - nx-X11/lib/X11/ChkWinEv.c | 91 - nx-X11/lib/X11/CirWin.c | 48 - nx-X11/lib/X11/CirWinDn.c | 47 - nx-X11/lib/X11/CirWinUp.c | 47 - nx-X11/lib/X11/ClDisplay.c | 82 - nx-X11/lib/X11/Clear.c | 49 - nx-X11/lib/X11/ClearArea.c | 56 - nx-X11/lib/X11/Cmap.h | 12 - nx-X11/lib/X11/ConfWind.c | 58 - nx-X11/lib/X11/ConnDis.c | 1479 ----- nx-X11/lib/X11/Context.c | 302 - nx-X11/lib/X11/ConvSel.c | 53 - nx-X11/lib/X11/CopyArea.c | 64 - nx-X11/lib/X11/CopyCmap.c | 64 - nx-X11/lib/X11/CopyGC.c | 138 - nx-X11/lib/X11/CopyPlane.c | 66 - nx-X11/lib/X11/Cr.h | 29 - nx-X11/lib/X11/CrBFData.c | 80 - nx-X11/lib/X11/CrCmap.c | 59 - nx-X11/lib/X11/CrCursor.c | 79 - nx-X11/lib/X11/CrGC.c | 345 -- nx-X11/lib/X11/CrGlCur.c | 225 - nx-X11/lib/X11/CrPFBData.c | 89 - nx-X11/lib/X11/CrPixmap.c | 65 - nx-X11/lib/X11/CrWindow.c | 69 - nx-X11/lib/X11/Cursor.c | 53 - nx-X11/lib/X11/Cv.h | 189 - nx-X11/lib/X11/CvColW.c | 141 - nx-X11/lib/X11/CvCols.c | 1030 ---- nx-X11/lib/X11/DefCursor.c | 49 - nx-X11/lib/X11/DelProp.c | 47 - nx-X11/lib/X11/Depths.c | 62 - nx-X11/lib/X11/DestSubs.c | 45 - nx-X11/lib/X11/DestWind.c | 45 - nx-X11/lib/X11/DisName.c | 64 - nx-X11/lib/X11/DrArc.c | 73 - nx-X11/lib/X11/DrArcs.c | 57 - nx-X11/lib/X11/DrLine.c | 85 - nx-X11/lib/X11/DrLines.c | 57 - nx-X11/lib/X11/DrPoint.c | 82 - nx-X11/lib/X11/DrPoints.c | 85 - nx-X11/lib/X11/DrRect.c | 84 - nx-X11/lib/X11/DrRects.c | 65 - nx-X11/lib/X11/DrSegs.c | 66 - nx-X11/lib/X11/ErrDes.c | 212 - nx-X11/lib/X11/ErrHndlr.c | 86 - nx-X11/lib/X11/EvToWire.c | 406 -- nx-X11/lib/X11/FSSaver.c | 60 - nx-X11/lib/X11/FSWrap.c | 262 - nx-X11/lib/X11/FetchName.c | 95 - nx-X11/lib/X11/FillArc.c | 86 - nx-X11/lib/X11/FillArcs.c | 67 - nx-X11/lib/X11/FillPoly.c | 64 - nx-X11/lib/X11/FillRct.c | 82 - nx-X11/lib/X11/FillRcts.c | 66 - nx-X11/lib/X11/FilterEv.c | 106 - nx-X11/lib/X11/Flush.c | 42 - nx-X11/lib/X11/Font.c | 708 --- nx-X11/lib/X11/FontInfo.c | 227 - nx-X11/lib/X11/FontNames.c | 137 - nx-X11/lib/X11/FreeCmap.c | 52 - nx-X11/lib/X11/FreeCols.c | 57 - nx-X11/lib/X11/FreeCurs.c | 44 - nx-X11/lib/X11/FreeEData.c | 45 - nx-X11/lib/X11/FreeEventData.c | 42 - nx-X11/lib/X11/FreeGC.c | 50 - nx-X11/lib/X11/FreePix.c | 44 - nx-X11/lib/X11/GCMisc.c | 110 - nx-X11/lib/X11/Geom.c | 89 - nx-X11/lib/X11/GetAtomNm.c | 189 - nx-X11/lib/X11/GetColor.c | 111 - nx-X11/lib/X11/GetDflt.c | 223 - nx-X11/lib/X11/GetEventData.c | 42 - nx-X11/lib/X11/GetFPath.c | 99 - nx-X11/lib/X11/GetFProp.c | 52 - nx-X11/lib/X11/GetGCVals.c | 128 - nx-X11/lib/X11/GetGeom.c | 63 - nx-X11/lib/X11/GetHColor.c | 58 - nx-X11/lib/X11/GetHints.c | 338 -- nx-X11/lib/X11/GetIFocus.c | 49 - nx-X11/lib/X11/GetImage.c | 143 - nx-X11/lib/X11/GetKCnt.c | 55 - nx-X11/lib/X11/GetMoEv.c | 81 - nx-X11/lib/X11/GetNrmHint.c | 127 - nx-X11/lib/X11/GetPCnt.c | 52 - nx-X11/lib/X11/GetPntMap.c | 132 - nx-X11/lib/X11/GetProp.c | 146 - nx-X11/lib/X11/GetRGBCMap.c | 134 - nx-X11/lib/X11/GetSOwner.c | 45 - nx-X11/lib/X11/GetSSaver.c | 56 - nx-X11/lib/X11/GetStCmap.c | 117 - nx-X11/lib/X11/GetTxtProp.c | 113 - nx-X11/lib/X11/GetWAttrs.c | 155 - nx-X11/lib/X11/GetWMCMapW.c | 87 - nx-X11/lib/X11/GetWMProto.c | 87 - nx-X11/lib/X11/GrButton.c | 60 - nx-X11/lib/X11/GrKey.c | 58 - nx-X11/lib/X11/GrKeybd.c | 58 - nx-X11/lib/X11/GrPointer.c | 64 - nx-X11/lib/X11/GrServer.c | 42 - nx-X11/lib/X11/HVC.c | 625 -- nx-X11/lib/X11/HVCGcC.c | 149 - nx-X11/lib/X11/HVCGcV.c | 201 - nx-X11/lib/X11/HVCGcVC.c | 262 - nx-X11/lib/X11/HVCMnV.c | 163 - nx-X11/lib/X11/HVCMxC.c | 243 - nx-X11/lib/X11/HVCMxV.c | 247 - nx-X11/lib/X11/HVCMxVC.c | 235 - nx-X11/lib/X11/HVCMxVs.c | 161 - nx-X11/lib/X11/HVCWpAj.c | 114 - nx-X11/lib/X11/Host.c | 144 - nx-X11/lib/X11/ICWrap.c | 432 -- nx-X11/lib/X11/IMWrap.c | 204 - nx-X11/lib/X11/Iconify.c | 89 - nx-X11/lib/X11/IdOfPr.c | 106 - nx-X11/lib/X11/IfEvent.c | 79 - nx-X11/lib/X11/ImText.c | 101 - nx-X11/lib/X11/ImText16.c | 103 - nx-X11/lib/X11/ImUtil.c | 1013 ---- nx-X11/lib/X11/ImUtil.h | 31 - nx-X11/lib/X11/Imakefile | 1132 ---- nx-X11/lib/X11/InitExt.c | 409 -- nx-X11/lib/X11/InsCmap.c | 44 - nx-X11/lib/X11/IntAtom.c | 297 - nx-X11/lib/X11/Key.h | 20 - nx-X11/lib/X11/KeyBind.c | 1005 ---- nx-X11/lib/X11/KeysymStr.c | 146 - nx-X11/lib/X11/KillCl.c | 44 - nx-X11/lib/X11/LRGB.c | 1841 ------ nx-X11/lib/X11/Lab.c | 431 -- nx-X11/lib/X11/LabGcC.c | 127 - nx-X11/lib/X11/LabGcL.c | 174 - nx-X11/lib/X11/LabGcLC.c | 223 - nx-X11/lib/X11/LabMnL.c | 216 - nx-X11/lib/X11/LabMxC.c | 203 - nx-X11/lib/X11/LabMxL.c | 216 - nx-X11/lib/X11/LabMxLC.c | 218 - nx-X11/lib/X11/LabWpAj.c | 97 - nx-X11/lib/X11/LiHosts.c | 157 - nx-X11/lib/X11/LiICmaps.c | 71 - nx-X11/lib/X11/LiProps.c | 69 - nx-X11/lib/X11/ListExt.c | 109 - nx-X11/lib/X11/LoadFont.c | 55 - nx-X11/lib/X11/LockDis.c | 84 - nx-X11/lib/X11/LookupCol.c | 104 - nx-X11/lib/X11/LowerWin.c | 49 - nx-X11/lib/X11/Luv.c | 401 -- nx-X11/lib/X11/LuvGcC.c | 127 - nx-X11/lib/X11/LuvGcL.c | 174 - nx-X11/lib/X11/LuvGcLC.c | 223 - nx-X11/lib/X11/LuvMnL.c | 216 - nx-X11/lib/X11/LuvMxC.c | 204 - nx-X11/lib/X11/LuvMxL.c | 216 - nx-X11/lib/X11/LuvMxLC.c | 218 - nx-X11/lib/X11/LuvWpAj.c | 96 - nx-X11/lib/X11/Macros.c | 303 - nx-X11/lib/X11/MapRaised.c | 51 - nx-X11/lib/X11/MapSubs.c | 43 - nx-X11/lib/X11/MapWindow.c | 44 - nx-X11/lib/X11/MaskEvent.c | 86 - nx-X11/lib/X11/Misc.c | 66 - nx-X11/lib/X11/ModMap.c | 184 - nx-X11/lib/X11/MoveWin.c | 56 - nx-X11/lib/X11/NextEvent.c | 64 - nx-X11/lib/X11/OCWrap.c | 140 - nx-X11/lib/X11/OMWrap.c | 129 - nx-X11/lib/X11/OfCCC.c | 162 - nx-X11/lib/X11/OpenDis.c | 990 ---- nx-X11/lib/X11/ParseCmd.c | 225 - nx-X11/lib/X11/ParseCol.c | 138 - nx-X11/lib/X11/ParseGeom.c | 162 - nx-X11/lib/X11/PeekEvent.c | 61 - nx-X11/lib/X11/PeekIfEv.c | 84 - nx-X11/lib/X11/Pending.c | 69 - nx-X11/lib/X11/PixFormats.c | 62 - nx-X11/lib/X11/PmapBgnd.c | 48 - nx-X11/lib/X11/PmapBord.c | 48 - nx-X11/lib/X11/PolyReg.c | 635 -- nx-X11/lib/X11/PolyTxt.c | 234 - nx-X11/lib/X11/PolyTxt16.c | 245 - nx-X11/lib/X11/PrOfId.c | 97 - nx-X11/lib/X11/PropAlloc.c | 69 - nx-X11/lib/X11/PutBEvent.c | 87 - nx-X11/lib/X11/PutImage.c | 1030 ---- nx-X11/lib/X11/QBlack.c | 84 - nx-X11/lib/X11/QBlue.c | 84 - nx-X11/lib/X11/QGreen.c | 84 - nx-X11/lib/X11/QRed.c | 84 - nx-X11/lib/X11/QWhite.c | 84 - nx-X11/lib/X11/QuBest.c | 61 - nx-X11/lib/X11/QuCol.c | 78 - nx-X11/lib/X11/QuColor.c | 61 - nx-X11/lib/X11/QuColors.c | 99 - nx-X11/lib/X11/QuCols.c | 78 - nx-X11/lib/X11/QuCurShp.c | 60 - nx-X11/lib/X11/QuExt.c | 56 - nx-X11/lib/X11/QuKeybd.c | 53 - nx-X11/lib/X11/QuPntr.c | 65 - nx-X11/lib/X11/QuStipShp.c | 60 - nx-X11/lib/X11/QuTextE16.c | 81 - nx-X11/lib/X11/QuTextExt.c | 80 - nx-X11/lib/X11/QuTileShp.c | 61 - nx-X11/lib/X11/QuTree.c | 72 - nx-X11/lib/X11/Quarks.c | 408 -- nx-X11/lib/X11/RaiseWin.c | 49 - nx-X11/lib/X11/RdBitF.c | 258 - nx-X11/lib/X11/RecolorC.c | 54 - nx-X11/lib/X11/ReconfWM.c | 142 - nx-X11/lib/X11/ReconfWin.c | 81 - nx-X11/lib/X11/Region.c | 1605 ----- nx-X11/lib/X11/RegstFlt.c | 155 - nx-X11/lib/X11/RepWindow.c | 52 - nx-X11/lib/X11/RestackWs.c | 61 - nx-X11/lib/X11/RotProp.c | 63 - nx-X11/lib/X11/ScrResStr.c | 54 - nx-X11/lib/X11/SelInput.c | 49 - nx-X11/lib/X11/SendEvent.c | 76 - nx-X11/lib/X11/SetBack.c | 46 - nx-X11/lib/X11/SetCCC.c | 138 - nx-X11/lib/X11/SetCRects.c | 81 - nx-X11/lib/X11/SetClMask.c | 47 - nx-X11/lib/X11/SetClOrig.c | 53 - nx-X11/lib/X11/SetDashes.c | 55 - nx-X11/lib/X11/SetFPath.c | 77 - nx-X11/lib/X11/SetFont.c | 47 - nx-X11/lib/X11/SetFore.c | 46 - nx-X11/lib/X11/SetFunc.c | 46 - nx-X11/lib/X11/SetGetCols.c | 301 - nx-X11/lib/X11/SetHints.c | 319 - nx-X11/lib/X11/SetIFocus.c | 50 - nx-X11/lib/X11/SetLStyle.c | 63 - nx-X11/lib/X11/SetLocale.c | 188 - nx-X11/lib/X11/SetNrmHint.c | 127 - nx-X11/lib/X11/SetPMask.c | 46 - nx-X11/lib/X11/SetPntMap.c | 77 - nx-X11/lib/X11/SetRGBCMap.c | 100 - nx-X11/lib/X11/SetSOwner.c | 49 - nx-X11/lib/X11/SetSSaver.c | 53 - nx-X11/lib/X11/SetStCmap.c | 95 - nx-X11/lib/X11/SetState.c | 64 - nx-X11/lib/X11/SetStip.c | 46 - nx-X11/lib/X11/SetTSOrig.c | 53 - nx-X11/lib/X11/SetTile.c | 46 - nx-X11/lib/X11/SetTxtProp.c | 93 - nx-X11/lib/X11/SetWMCMapW.c | 74 - nx-X11/lib/X11/SetWMProto.c | 74 - nx-X11/lib/X11/StBytes.c | 107 - nx-X11/lib/X11/StCol.c | 82 - nx-X11/lib/X11/StColor.c | 58 - nx-X11/lib/X11/StColors.c | 65 - nx-X11/lib/X11/StCols.c | 112 - nx-X11/lib/X11/StNColor.c | 87 - nx-X11/lib/X11/StName.c | 53 - nx-X11/lib/X11/StrKeysym.c | 181 - nx-X11/lib/X11/StrToText.c | 90 - nx-X11/lib/X11/Sync.c | 60 - nx-X11/lib/X11/Synchro.c | 79 - nx-X11/lib/X11/Text.c | 139 - nx-X11/lib/X11/Text16.c | 129 - nx-X11/lib/X11/TextExt.c | 234 - nx-X11/lib/X11/TextExt16.c | 210 - nx-X11/lib/X11/TextToStr.c | 118 - nx-X11/lib/X11/TrCoords.c | 64 - nx-X11/lib/X11/UIThrStubs.c | 157 - nx-X11/lib/X11/UNDEFINED.c | 131 - nx-X11/lib/X11/UndefCurs.c | 49 - nx-X11/lib/X11/UngrabBut.c | 49 - nx-X11/lib/X11/UngrabKbd.c | 45 - nx-X11/lib/X11/UngrabKey.c | 52 - nx-X11/lib/X11/UngrabPtr.c | 44 - nx-X11/lib/X11/UngrabSvr.c | 44 - nx-X11/lib/X11/UninsCmap.c | 44 - nx-X11/lib/X11/UnldFont.c | 45 - nx-X11/lib/X11/UnmapSubs.c | 44 - nx-X11/lib/X11/UnmapWin.c | 45 - nx-X11/lib/X11/VisUtil.c | 252 - nx-X11/lib/X11/WMGeom.c | 183 - nx-X11/lib/X11/WMProps.c | 139 - nx-X11/lib/X11/WarpPtr.c | 60 - nx-X11/lib/X11/WinEvent.c | 90 - nx-X11/lib/X11/Window.c | 140 - nx-X11/lib/X11/Withdraw.c | 84 - nx-X11/lib/X11/WrBitF.c | 153 - nx-X11/lib/X11/XErrorDB | 1022 ---- nx-X11/lib/X11/XKB.c | 771 --- nx-X11/lib/X11/XKBAlloc.c | 495 -- nx-X11/lib/X11/XKBBell.c | 179 - nx-X11/lib/X11/XKBBind.c | 784 --- nx-X11/lib/X11/XKBCompat.c | 252 - nx-X11/lib/X11/XKBCtrls.c | 351 -- nx-X11/lib/X11/XKBCvt.c | 341 -- nx-X11/lib/X11/XKBExtDev.c | 843 --- nx-X11/lib/X11/XKBGAlloc.c | 994 ---- nx-X11/lib/X11/XKBGeom.c | 724 --- nx-X11/lib/X11/XKBGetByName.c | 226 - nx-X11/lib/X11/XKBGetMap.c | 882 --- nx-X11/lib/X11/XKBList.c | 256 - nx-X11/lib/X11/XKBMAlloc.c | 1016 ---- nx-X11/lib/X11/XKBMisc.c | 1021 ---- nx-X11/lib/X11/XKBNames.c | 879 --- nx-X11/lib/X11/XKBRdBuf.c | 203 - nx-X11/lib/X11/XKBSetGeom.c | 478 -- nx-X11/lib/X11/XKBSetMap.c | 598 -- nx-X11/lib/X11/XKBUse.c | 814 --- nx-X11/lib/X11/XKBleds.c | 338 -- nx-X11/lib/X11/XKBlib.h | 1150 ---- nx-X11/lib/X11/XKBlibint.h | 337 -- nx-X11/lib/X11/XRGB.c | 242 - nx-X11/lib/X11/XYZ.c | 203 - nx-X11/lib/X11/Xatomtype.h | 133 - nx-X11/lib/X11/Xcms.h | 816 --- nx-X11/lib/X11/Xcms.txt | 44 - nx-X11/lib/X11/Xcmsint.h | 260 - nx-X11/lib/X11/XimImSw.h | 46 - nx-X11/lib/X11/XimProto.h | 226 - nx-X11/lib/X11/XimThai.h | 110 - nx-X11/lib/X11/XimTrInt.h | 85 - nx-X11/lib/X11/XimTrX.h | 85 - nx-X11/lib/X11/XimTrans.h | 136 - nx-X11/lib/X11/Ximint.h | 995 ---- nx-X11/lib/X11/XimintL.h | 106 - nx-X11/lib/X11/XimintP.h | 310 - nx-X11/lib/X11/Xintatom.h | 33 - nx-X11/lib/X11/Xintconn.h | 38 - nx-X11/lib/X11/XlcGeneric.h | 162 - nx-X11/lib/X11/XlcPubI.h | 298 - nx-X11/lib/X11/XlcPublic.h | 324 - nx-X11/lib/X11/Xlcint.h | 964 --- nx-X11/lib/X11/Xlib.h | 4036 ------------- nx-X11/lib/X11/XlibAsync.c | 182 - nx-X11/lib/X11/XlibConf.h | 7 - nx-X11/lib/X11/XlibInt.c | 4199 ------------- nx-X11/lib/X11/Xlibint.h | 1361 ----- nx-X11/lib/X11/Xlocale.h | 38 - nx-X11/lib/X11/XomGeneric.h | 316 - nx-X11/lib/X11/Xprivate.h | 30 - nx-X11/lib/X11/Xregion.h | 191 - nx-X11/lib/X11/Xresinternal.h | 18 - nx-X11/lib/X11/Xresource.h | 359 -- nx-X11/lib/X11/Xrm.c | 2651 --------- nx-X11/lib/X11/Xutil.h | 839 --- nx-X11/lib/X11/cmsAllCol.c | 74 - nx-X11/lib/X11/cmsAllNCol.c | 198 - nx-X11/lib/X11/cmsCmap.c | 492 -- nx-X11/lib/X11/cmsColNm.c | 1050 ---- nx-X11/lib/X11/cmsGlobls.c | 126 - nx-X11/lib/X11/cmsInt.c | 411 -- nx-X11/lib/X11/cmsLkCol.c | 193 - nx-X11/lib/X11/cmsMath.c | 140 - nx-X11/lib/X11/cmsProp.c | 153 - nx-X11/lib/X11/cmsTrig.c | 578 -- nx-X11/lib/X11/cursorfont.h | 112 - nx-X11/lib/X11/evtomask.c | 74 - nx-X11/lib/X11/globals.c | 108 - nx-X11/lib/X11/imCallbk.c | 747 --- nx-X11/lib/X11/imConv.c | 356 -- nx-X11/lib/X11/imDefFlt.c | 413 -- nx-X11/lib/X11/imDefIc.c | 1576 ----- nx-X11/lib/X11/imDefIm.c | 2042 ------- nx-X11/lib/X11/imDefLkup.c | 1178 ---- nx-X11/lib/X11/imDispch.c | 104 - nx-X11/lib/X11/imEvToWire.c | 788 --- nx-X11/lib/X11/imExten.c | 576 -- nx-X11/lib/X11/imImSw.c | 55 - nx-X11/lib/X11/imInsClbk.c | 288 - nx-X11/lib/X11/imInt.c | 260 - nx-X11/lib/X11/imKStoUCS.c | 322 - nx-X11/lib/X11/imLcFlt.c | 157 - nx-X11/lib/X11/imLcGIc.c | 47 - nx-X11/lib/X11/imLcIc.c | 199 - nx-X11/lib/X11/imLcIm.c | 711 --- nx-X11/lib/X11/imLcLkup.c | 417 -- nx-X11/lib/X11/imLcPrs.c | 741 --- nx-X11/lib/X11/imLcSIc.c | 54 - nx-X11/lib/X11/imRm.c | 3212 ---------- nx-X11/lib/X11/imRmAttr.c | 1514 ----- nx-X11/lib/X11/imThaiFlt.c | 1421 ----- nx-X11/lib/X11/imThaiIc.c | 229 - nx-X11/lib/X11/imThaiIm.c | 235 - nx-X11/lib/X11/imTrX.c | 518 -- nx-X11/lib/X11/imTrans.c | 321 - nx-X11/lib/X11/imTransR.c | 306 - nx-X11/lib/X11/lcCT.c | 1303 ---- nx-X11/lib/X11/lcCharSet.c | 225 - nx-X11/lib/X11/lcConv.c | 339 -- nx-X11/lib/X11/lcDB.c | 1327 ----- nx-X11/lib/X11/lcDefConv.c | 806 --- nx-X11/lib/X11/lcFile.c | 711 --- nx-X11/lib/X11/lcGenConv.c | 3112 ---------- nx-X11/lib/X11/lcGeneric.c | 1171 ---- nx-X11/lib/X11/lcInit.c | 168 - nx-X11/lib/X11/lcPrTxt.c | 289 - nx-X11/lib/X11/lcPubWrap.c | 98 - nx-X11/lib/X11/lcPublic.c | 311 - nx-X11/lib/X11/lcRM.c | 224 - nx-X11/lib/X11/lcStd.c | 358 -- nx-X11/lib/X11/lcTxtPr.c | 254 - nx-X11/lib/X11/lcUTF8.c | 2389 -------- nx-X11/lib/X11/lcUTF8Load.c | 70 - nx-X11/lib/X11/lcUniConv/armscii_8.h | 97 - nx-X11/lib/X11/lcUniConv/big5.h | 4141 ------------- nx-X11/lib/X11/lcUniConv/big5_emacs.h | 163 - nx-X11/lib/X11/lcUniConv/big5hkscs.h | 6252 -------------------- nx-X11/lib/X11/lcUniConv/cp1133.h | 91 - nx-X11/lib/X11/lcUniConv/cp1251.h | 112 - nx-X11/lib/X11/lcUniConv/cp1255.h | 120 - nx-X11/lib/X11/lcUniConv/cp1256.h | 134 - nx-X11/lib/X11/lcUniConv/gb2312.h | 2552 -------- nx-X11/lib/X11/lcUniConv/gbk.h | 6200 ------------------- nx-X11/lib/X11/lcUniConv/georgian_academy.h | 87 - nx-X11/lib/X11/lcUniConv/georgian_ps.h | 104 - nx-X11/lib/X11/lcUniConv/iso8859_1.h | 22 - nx-X11/lib/X11/lcUniConv/iso8859_10.h | 87 - nx-X11/lib/X11/lcUniConv/iso8859_11.h | 77 - nx-X11/lib/X11/lcUniConv/iso8859_13.h | 90 - nx-X11/lib/X11/lcUniConv/iso8859_14.h | 108 - nx-X11/lib/X11/lcUniConv/iso8859_15.h | 62 - nx-X11/lib/X11/lcUniConv/iso8859_16.h | 97 - nx-X11/lib/X11/lcUniConv/iso8859_2.h | 93 - nx-X11/lib/X11/lcUniConv/iso8859_3.h | 99 - nx-X11/lib/X11/lcUniConv/iso8859_4.h | 93 - nx-X11/lib/X11/lcUniConv/iso8859_5.h | 76 - nx-X11/lib/X11/lcUniConv/iso8859_6.h | 79 - nx-X11/lib/X11/lcUniConv/iso8859_7.h | 87 - nx-X11/lib/X11/lcUniConv/iso8859_8.h | 88 - nx-X11/lib/X11/lcUniConv/iso8859_9.h | 66 - nx-X11/lib/X11/lcUniConv/iso8859_9e.h | 102 - nx-X11/lib/X11/lcUniConv/jisx0201.h | 47 - nx-X11/lib/X11/lcUniConv/jisx0208.h | 2396 -------- nx-X11/lib/X11/lcUniConv/jisx0212.h | 2163 ------- nx-X11/lib/X11/lcUniConv/koi8_c.h | 102 - nx-X11/lib/X11/lcUniConv/koi8_r.h | 134 - nx-X11/lib/X11/lcUniConv/koi8_u.h | 142 - nx-X11/lib/X11/lcUniConv/ksc5601.h | 3002 ---------- nx-X11/lib/X11/lcUniConv/mulelao.h | 77 - nx-X11/lib/X11/lcUniConv/tatar_cyr.h | 122 - nx-X11/lib/X11/lcUniConv/tcvn.h | 133 - nx-X11/lib/X11/lcUniConv/tis620.h | 77 - nx-X11/lib/X11/lcUniConv/ucs2be.h | 31 - nx-X11/lib/X11/lcUniConv/utf8.h | 109 - nx-X11/lib/X11/lcUniConv/viscii.h | 122 - nx-X11/lib/X11/lcUtil.c | 86 - nx-X11/lib/X11/lcWrap.c | 648 -- nx-X11/lib/X11/locking.c | 625 -- nx-X11/lib/X11/locking.h | 156 - nx-X11/lib/X11/mbWMProps.c | 69 - nx-X11/lib/X11/mbWrap.c | 161 - nx-X11/lib/X11/omDefault.c | 449 -- nx-X11/lib/X11/omGeneric.c | 2100 ------- nx-X11/lib/X11/omImText.c | 86 - nx-X11/lib/X11/omText.c | 370 -- nx-X11/lib/X11/omTextEsc.c | 300 - nx-X11/lib/X11/omTextExt.c | 135 - nx-X11/lib/X11/omTextPer.c | 202 - nx-X11/lib/X11/omXChar.c | 404 -- nx-X11/lib/X11/pathmax.h | 81 - nx-X11/lib/X11/poly.h | 294 - nx-X11/lib/X11/utf8WMProps.c | 91 - nx-X11/lib/X11/utf8Wrap.c | 183 - nx-X11/lib/X11/util/makekeys.c | 317 - nx-X11/lib/X11/utlist.h | 116 - nx-X11/lib/X11/uvY.c | 423 -- nx-X11/lib/X11/wcWrap.c | 161 - nx-X11/lib/X11/x11_trans.c | 30 - nx-X11/lib/X11/xim_trans.c | 30 - nx-X11/lib/X11/xyY.c | 395 -- nx-X11/lib/configure.ac | 309 + nx-X11/lib/include/Makefile.am | 32 + nx-X11/lib/include/X11/.gitignore | 1 + nx-X11/lib/include/X11/ImUtil.h | 31 + nx-X11/lib/include/X11/XKBlib.h | 1150 ++++ nx-X11/lib/include/X11/Xcms.h | 816 +++ nx-X11/lib/include/X11/Xlib.h | 4036 +++++++++++++ nx-X11/lib/include/X11/XlibConf.h.in | 37 + nx-X11/lib/include/X11/Xlibint.h | 1361 +++++ nx-X11/lib/include/X11/Xlocale.h | 38 + nx-X11/lib/include/X11/Xregion.h | 191 + nx-X11/lib/include/X11/Xresource.h | 359 ++ nx-X11/lib/include/X11/Xutil.h | 839 +++ nx-X11/lib/include/X11/cursorfont.h | 112 + nx-X11/lib/include/xtrans/Xtrans.c | 1367 +++++ nx-X11/lib/include/xtrans/Xtrans.h | 426 ++ nx-X11/lib/include/xtrans/Xtransint.h | 433 ++ nx-X11/lib/include/xtrans/Xtranslcl.c | 2486 ++++++++ nx-X11/lib/include/xtrans/Xtranssock.c | 3554 +++++++++++ nx-X11/lib/include/xtrans/Xtransutil.c | 639 ++ nx-X11/lib/include/xtrans/transport.c | 74 + nx-X11/lib/m4/ax_define_dir.m4 | 49 + nx-X11/lib/m4/nx-macros.m4 | 1 + nx-X11/lib/m4/nx-xtrans.m4 | 1 + nx-X11/lib/modules/Makefile.am | 1 + nx-X11/lib/modules/im/Makefile.am | 1 + nx-X11/lib/modules/im/ximcp/Makefile.am | 56 + nx-X11/lib/modules/im/ximcp/imCallbk.c | 747 +++ nx-X11/lib/modules/im/ximcp/imDefFlt.c | 413 ++ nx-X11/lib/modules/im/ximcp/imDefIc.c | 1576 +++++ nx-X11/lib/modules/im/ximcp/imDefIm.c | 2042 +++++++ nx-X11/lib/modules/im/ximcp/imDefLkup.c | 1178 ++++ nx-X11/lib/modules/im/ximcp/imDispch.c | 104 + nx-X11/lib/modules/im/ximcp/imEvToWire.c | 788 +++ nx-X11/lib/modules/im/ximcp/imExten.c | 576 ++ nx-X11/lib/modules/im/ximcp/imImSw.c | 55 + nx-X11/lib/modules/im/ximcp/imInsClbk.c | 288 + nx-X11/lib/modules/im/ximcp/imInt.c | 260 + nx-X11/lib/modules/im/ximcp/imLcFlt.c | 157 + nx-X11/lib/modules/im/ximcp/imLcGIc.c | 47 + nx-X11/lib/modules/im/ximcp/imLcIc.c | 199 + nx-X11/lib/modules/im/ximcp/imLcIm.c | 711 +++ nx-X11/lib/modules/im/ximcp/imLcLkup.c | 417 ++ nx-X11/lib/modules/im/ximcp/imLcPrs.c | 741 +++ nx-X11/lib/modules/im/ximcp/imLcSIc.c | 54 + nx-X11/lib/modules/im/ximcp/imRm.c | 3212 ++++++++++ nx-X11/lib/modules/im/ximcp/imRmAttr.c | 1514 +++++ nx-X11/lib/modules/im/ximcp/imThaiFlt.c | 1421 +++++ nx-X11/lib/modules/im/ximcp/imThaiIc.c | 229 + nx-X11/lib/modules/im/ximcp/imThaiIm.c | 235 + nx-X11/lib/modules/im/ximcp/imTrX.c | 518 ++ nx-X11/lib/modules/im/ximcp/imTrans.c | 321 + nx-X11/lib/modules/im/ximcp/imTransR.c | 306 + nx-X11/lib/modules/lc/Makefile.am | 1 + nx-X11/lib/modules/lc/Utf8/Makefile.am | 28 + nx-X11/lib/modules/lc/Utf8/lcUTF8Load.c | 70 + nx-X11/lib/modules/lc/def/Makefile.am | 27 + nx-X11/lib/modules/lc/def/lcDefConv.c | 806 +++ nx-X11/lib/modules/lc/gen/Makefile.am | 27 + nx-X11/lib/modules/lc/gen/lcGenConv.c | 3112 ++++++++++ nx-X11/lib/modules/om/Makefile.am | 1 + nx-X11/lib/modules/om/generic/Makefile.am | 36 + nx-X11/lib/modules/om/generic/omDefault.c | 449 ++ nx-X11/lib/modules/om/generic/omGeneric.c | 2100 +++++++ nx-X11/lib/modules/om/generic/omImText.c | 86 + nx-X11/lib/modules/om/generic/omText.c | 370 ++ nx-X11/lib/modules/om/generic/omTextEsc.c | 300 + nx-X11/lib/modules/om/generic/omTextExt.c | 135 + nx-X11/lib/modules/om/generic/omTextPer.c | 202 + nx-X11/lib/modules/om/generic/omXChar.c | 404 ++ nx-X11/lib/nx-x11.pc.in | 18 + nx-X11/lib/src/.gitignore | 1 + nx-X11/lib/src/AllCells.c | 68 + nx-X11/lib/src/AllPlanes.c | 74 + nx-X11/lib/src/AllowEv.c | 51 + nx-X11/lib/src/AuDispose.c | 49 + nx-X11/lib/src/AuFileName.c | 73 + nx-X11/lib/src/AuGetBest.c | 136 + nx-X11/lib/src/AuRead.c | 135 + nx-X11/lib/src/AutoRep.c | 50 + nx-X11/lib/src/Backgnd.c | 49 + nx-X11/lib/src/BdrWidth.c | 53 + nx-X11/lib/src/Bell.c | 46 + nx-X11/lib/src/Border.c | 49 + nx-X11/lib/src/ChAccCon.c | 59 + nx-X11/lib/src/ChActPGb.c | 49 + nx-X11/lib/src/ChClMode.c | 46 + nx-X11/lib/src/ChCmap.c | 49 + nx-X11/lib/src/ChGC.c | 52 + nx-X11/lib/src/ChKeyCon.c | 83 + nx-X11/lib/src/ChPntCon.c | 55 + nx-X11/lib/src/ChProp.c | 99 + nx-X11/lib/src/ChSaveSet.c | 63 + nx-X11/lib/src/ChWAttrs.c | 57 + nx-X11/lib/src/ChWindow.c | 54 + nx-X11/lib/src/ChkIfEv.c | 138 + nx-X11/lib/src/ChkMaskEv.c | 90 + nx-X11/lib/src/ChkTypEv.c | 81 + nx-X11/lib/src/ChkTypWEv.c | 83 + nx-X11/lib/src/ChkWinEv.c | 91 + nx-X11/lib/src/CirWin.c | 48 + nx-X11/lib/src/CirWinDn.c | 47 + nx-X11/lib/src/CirWinUp.c | 47 + nx-X11/lib/src/ClDisplay.c | 82 + nx-X11/lib/src/Clear.c | 49 + nx-X11/lib/src/ClearArea.c | 56 + nx-X11/lib/src/Cmap.h | 12 + nx-X11/lib/src/ConfWind.c | 58 + nx-X11/lib/src/ConnDis.c | 1479 +++++ nx-X11/lib/src/Context.c | 302 + nx-X11/lib/src/ConvSel.c | 53 + nx-X11/lib/src/CopyArea.c | 64 + nx-X11/lib/src/CopyCmap.c | 64 + nx-X11/lib/src/CopyGC.c | 138 + nx-X11/lib/src/CopyPlane.c | 66 + nx-X11/lib/src/Cr.h | 29 + nx-X11/lib/src/CrBFData.c | 80 + nx-X11/lib/src/CrCmap.c | 59 + nx-X11/lib/src/CrCursor.c | 79 + nx-X11/lib/src/CrGC.c | 345 ++ nx-X11/lib/src/CrGlCur.c | 225 + nx-X11/lib/src/CrPFBData.c | 89 + nx-X11/lib/src/CrPixmap.c | 65 + nx-X11/lib/src/CrWindow.c | 69 + nx-X11/lib/src/Cursor.c | 53 + nx-X11/lib/src/DefCursor.c | 49 + nx-X11/lib/src/DelProp.c | 47 + nx-X11/lib/src/Depths.c | 62 + nx-X11/lib/src/DestSubs.c | 45 + nx-X11/lib/src/DestWind.c | 45 + nx-X11/lib/src/DisName.c | 64 + nx-X11/lib/src/DrArc.c | 73 + nx-X11/lib/src/DrArcs.c | 57 + nx-X11/lib/src/DrLine.c | 85 + nx-X11/lib/src/DrLines.c | 57 + nx-X11/lib/src/DrPoint.c | 82 + nx-X11/lib/src/DrPoints.c | 85 + nx-X11/lib/src/DrRect.c | 84 + nx-X11/lib/src/DrRects.c | 65 + nx-X11/lib/src/DrSegs.c | 66 + nx-X11/lib/src/ErrDes.c | 212 + nx-X11/lib/src/ErrHndlr.c | 86 + nx-X11/lib/src/EvToWire.c | 406 ++ nx-X11/lib/src/FSSaver.c | 60 + nx-X11/lib/src/FSWrap.c | 262 + nx-X11/lib/src/FetchName.c | 95 + nx-X11/lib/src/FillArc.c | 86 + nx-X11/lib/src/FillArcs.c | 67 + nx-X11/lib/src/FillPoly.c | 64 + nx-X11/lib/src/FillRct.c | 82 + nx-X11/lib/src/FillRcts.c | 66 + nx-X11/lib/src/FilterEv.c | 106 + nx-X11/lib/src/Flush.c | 42 + nx-X11/lib/src/Font.c | 708 +++ nx-X11/lib/src/FontInfo.c | 227 + nx-X11/lib/src/FontNames.c | 137 + nx-X11/lib/src/FreeCmap.c | 52 + nx-X11/lib/src/FreeCols.c | 57 + nx-X11/lib/src/FreeCurs.c | 44 + nx-X11/lib/src/FreeEData.c | 45 + nx-X11/lib/src/FreeEventData.c | 42 + nx-X11/lib/src/FreeGC.c | 50 + nx-X11/lib/src/FreePix.c | 44 + nx-X11/lib/src/GCMisc.c | 110 + nx-X11/lib/src/Geom.c | 89 + nx-X11/lib/src/GetAtomNm.c | 189 + nx-X11/lib/src/GetColor.c | 111 + nx-X11/lib/src/GetDflt.c | 223 + nx-X11/lib/src/GetEventData.c | 42 + nx-X11/lib/src/GetFPath.c | 99 + nx-X11/lib/src/GetFProp.c | 52 + nx-X11/lib/src/GetGCVals.c | 128 + nx-X11/lib/src/GetGeom.c | 63 + nx-X11/lib/src/GetHColor.c | 58 + nx-X11/lib/src/GetHints.c | 338 ++ nx-X11/lib/src/GetIFocus.c | 49 + nx-X11/lib/src/GetImage.c | 143 + nx-X11/lib/src/GetKCnt.c | 55 + nx-X11/lib/src/GetMoEv.c | 81 + nx-X11/lib/src/GetNrmHint.c | 127 + nx-X11/lib/src/GetPCnt.c | 52 + nx-X11/lib/src/GetPntMap.c | 132 + nx-X11/lib/src/GetProp.c | 146 + nx-X11/lib/src/GetRGBCMap.c | 134 + nx-X11/lib/src/GetSOwner.c | 45 + nx-X11/lib/src/GetSSaver.c | 56 + nx-X11/lib/src/GetStCmap.c | 117 + nx-X11/lib/src/GetTxtProp.c | 113 + nx-X11/lib/src/GetWAttrs.c | 155 + nx-X11/lib/src/GetWMCMapW.c | 87 + nx-X11/lib/src/GetWMProto.c | 87 + nx-X11/lib/src/GrButton.c | 60 + nx-X11/lib/src/GrKey.c | 58 + nx-X11/lib/src/GrKeybd.c | 58 + nx-X11/lib/src/GrPointer.c | 64 + nx-X11/lib/src/GrServer.c | 42 + nx-X11/lib/src/Host.c | 144 + nx-X11/lib/src/Iconify.c | 89 + nx-X11/lib/src/IfEvent.c | 79 + nx-X11/lib/src/ImText.c | 101 + nx-X11/lib/src/ImText16.c | 103 + nx-X11/lib/src/ImUtil.c | 1013 ++++ nx-X11/lib/src/InitExt.c | 409 ++ nx-X11/lib/src/InsCmap.c | 44 + nx-X11/lib/src/IntAtom.c | 297 + nx-X11/lib/src/Key.h | 20 + nx-X11/lib/src/KeyBind.c | 1005 ++++ nx-X11/lib/src/KeysymStr.c | 146 + nx-X11/lib/src/KillCl.c | 44 + nx-X11/lib/src/LiHosts.c | 157 + nx-X11/lib/src/LiICmaps.c | 71 + nx-X11/lib/src/LiProps.c | 69 + nx-X11/lib/src/ListExt.c | 109 + nx-X11/lib/src/LoadFont.c | 55 + nx-X11/lib/src/LockDis.c | 84 + nx-X11/lib/src/LookupCol.c | 104 + nx-X11/lib/src/LowerWin.c | 49 + nx-X11/lib/src/Macros.c | 303 + nx-X11/lib/src/Makefile.am | 387 ++ nx-X11/lib/src/MapRaised.c | 51 + nx-X11/lib/src/MapSubs.c | 43 + nx-X11/lib/src/MapWindow.c | 44 + nx-X11/lib/src/MaskEvent.c | 86 + nx-X11/lib/src/Misc.c | 66 + nx-X11/lib/src/ModMap.c | 184 + nx-X11/lib/src/MoveWin.c | 56 + nx-X11/lib/src/NextEvent.c | 64 + nx-X11/lib/src/OCWrap.c | 140 + nx-X11/lib/src/OMWrap.c | 129 + nx-X11/lib/src/OpenDis.c | 990 ++++ nx-X11/lib/src/ParseCmd.c | 225 + nx-X11/lib/src/ParseCol.c | 138 + nx-X11/lib/src/ParseGeom.c | 162 + nx-X11/lib/src/PeekEvent.c | 61 + nx-X11/lib/src/PeekIfEv.c | 84 + nx-X11/lib/src/Pending.c | 69 + nx-X11/lib/src/PixFormats.c | 62 + nx-X11/lib/src/PmapBgnd.c | 48 + nx-X11/lib/src/PmapBord.c | 48 + nx-X11/lib/src/PolyReg.c | 635 ++ nx-X11/lib/src/PolyTxt.c | 234 + nx-X11/lib/src/PolyTxt16.c | 245 + nx-X11/lib/src/PropAlloc.c | 69 + nx-X11/lib/src/PutBEvent.c | 87 + nx-X11/lib/src/PutImage.c | 1030 ++++ nx-X11/lib/src/QuBest.c | 61 + nx-X11/lib/src/QuColor.c | 61 + nx-X11/lib/src/QuColors.c | 99 + nx-X11/lib/src/QuCurShp.c | 60 + nx-X11/lib/src/QuExt.c | 56 + nx-X11/lib/src/QuKeybd.c | 53 + nx-X11/lib/src/QuPntr.c | 65 + nx-X11/lib/src/QuStipShp.c | 60 + nx-X11/lib/src/QuTextE16.c | 81 + nx-X11/lib/src/QuTextExt.c | 80 + nx-X11/lib/src/QuTileShp.c | 61 + nx-X11/lib/src/QuTree.c | 72 + nx-X11/lib/src/Quarks.c | 408 ++ nx-X11/lib/src/RaiseWin.c | 49 + nx-X11/lib/src/RdBitF.c | 258 + nx-X11/lib/src/RecolorC.c | 54 + nx-X11/lib/src/ReconfWM.c | 142 + nx-X11/lib/src/ReconfWin.c | 81 + nx-X11/lib/src/Region.c | 1605 +++++ nx-X11/lib/src/RegstFlt.c | 155 + nx-X11/lib/src/RepWindow.c | 52 + nx-X11/lib/src/RestackWs.c | 61 + nx-X11/lib/src/RotProp.c | 63 + nx-X11/lib/src/ScrResStr.c | 54 + nx-X11/lib/src/SelInput.c | 49 + nx-X11/lib/src/SendEvent.c | 76 + nx-X11/lib/src/SetBack.c | 46 + nx-X11/lib/src/SetCRects.c | 81 + nx-X11/lib/src/SetClMask.c | 47 + nx-X11/lib/src/SetClOrig.c | 53 + nx-X11/lib/src/SetDashes.c | 55 + nx-X11/lib/src/SetFPath.c | 77 + nx-X11/lib/src/SetFont.c | 47 + nx-X11/lib/src/SetFore.c | 46 + nx-X11/lib/src/SetFunc.c | 46 + nx-X11/lib/src/SetHints.c | 319 + nx-X11/lib/src/SetIFocus.c | 50 + nx-X11/lib/src/SetLStyle.c | 63 + nx-X11/lib/src/SetLocale.c | 188 + nx-X11/lib/src/SetNrmHint.c | 127 + nx-X11/lib/src/SetPMask.c | 46 + nx-X11/lib/src/SetPntMap.c | 77 + nx-X11/lib/src/SetRGBCMap.c | 100 + nx-X11/lib/src/SetSOwner.c | 49 + nx-X11/lib/src/SetSSaver.c | 53 + nx-X11/lib/src/SetStCmap.c | 95 + nx-X11/lib/src/SetState.c | 64 + nx-X11/lib/src/SetStip.c | 46 + nx-X11/lib/src/SetTSOrig.c | 53 + nx-X11/lib/src/SetTile.c | 46 + nx-X11/lib/src/SetTxtProp.c | 93 + nx-X11/lib/src/SetWMCMapW.c | 74 + nx-X11/lib/src/SetWMProto.c | 74 + nx-X11/lib/src/StBytes.c | 107 + nx-X11/lib/src/StColor.c | 58 + nx-X11/lib/src/StColors.c | 65 + nx-X11/lib/src/StNColor.c | 87 + nx-X11/lib/src/StName.c | 53 + nx-X11/lib/src/StrKeysym.c | 181 + nx-X11/lib/src/StrToText.c | 90 + nx-X11/lib/src/Sync.c | 60 + nx-X11/lib/src/Synchro.c | 79 + nx-X11/lib/src/Text.c | 139 + nx-X11/lib/src/Text16.c | 129 + nx-X11/lib/src/TextExt.c | 234 + nx-X11/lib/src/TextExt16.c | 210 + nx-X11/lib/src/TextToStr.c | 118 + nx-X11/lib/src/TrCoords.c | 64 + nx-X11/lib/src/UIThrStubs.c | 157 + nx-X11/lib/src/UndefCurs.c | 49 + nx-X11/lib/src/UngrabBut.c | 49 + nx-X11/lib/src/UngrabKbd.c | 45 + nx-X11/lib/src/UngrabKey.c | 52 + nx-X11/lib/src/UngrabPtr.c | 44 + nx-X11/lib/src/UngrabSvr.c | 44 + nx-X11/lib/src/UninsCmap.c | 44 + nx-X11/lib/src/UnldFont.c | 45 + nx-X11/lib/src/UnmapSubs.c | 44 + nx-X11/lib/src/UnmapWin.c | 45 + nx-X11/lib/src/VisUtil.c | 252 + nx-X11/lib/src/WMGeom.c | 183 + nx-X11/lib/src/WMProps.c | 139 + nx-X11/lib/src/WarpPtr.c | 60 + nx-X11/lib/src/WinEvent.c | 90 + nx-X11/lib/src/Window.c | 140 + nx-X11/lib/src/Withdraw.c | 84 + nx-X11/lib/src/WrBitF.c | 153 + nx-X11/lib/src/XErrorDB | 1022 ++++ nx-X11/lib/src/Xatomtype.h | 133 + nx-X11/lib/src/Xintatom.h | 33 + nx-X11/lib/src/Xintconn.h | 38 + nx-X11/lib/src/XlibAsync.c | 182 + nx-X11/lib/src/XlibInt.c | 4199 +++++++++++++ nx-X11/lib/src/XomGeneric.h | 316 + nx-X11/lib/src/Xprivate.h | 30 + nx-X11/lib/src/Xresinternal.h | 18 + nx-X11/lib/src/Xrm.c | 2651 +++++++++ nx-X11/lib/src/evtomask.c | 74 + nx-X11/lib/src/globals.c | 108 + nx-X11/lib/src/imConv.c | 356 ++ nx-X11/lib/src/locking.c | 625 ++ nx-X11/lib/src/locking.h | 156 + nx-X11/lib/src/pathmax.h | 81 + nx-X11/lib/src/poly.h | 294 + nx-X11/lib/src/util/Makefile.am | 15 + nx-X11/lib/src/util/makekeys.c | 317 + nx-X11/lib/src/util/mkks.sh | 10 + nx-X11/lib/src/utlist.h | 116 + nx-X11/lib/src/x11_trans.c | 30 + nx-X11/lib/src/xcms/AddDIC.c | 149 + nx-X11/lib/src/xcms/AddSF.c | 145 + nx-X11/lib/src/xcms/CCC.c | 285 + nx-X11/lib/src/xcms/Cv.h | 189 + nx-X11/lib/src/xcms/CvColW.c | 141 + nx-X11/lib/src/xcms/CvCols.c | 1030 ++++ nx-X11/lib/src/xcms/HVC.c | 625 ++ nx-X11/lib/src/xcms/HVCGcC.c | 149 + nx-X11/lib/src/xcms/HVCGcV.c | 201 + nx-X11/lib/src/xcms/HVCGcVC.c | 262 + nx-X11/lib/src/xcms/HVCMnV.c | 163 + nx-X11/lib/src/xcms/HVCMxC.c | 243 + nx-X11/lib/src/xcms/HVCMxV.c | 247 + nx-X11/lib/src/xcms/HVCMxVC.c | 235 + nx-X11/lib/src/xcms/HVCMxVs.c | 161 + nx-X11/lib/src/xcms/HVCWpAj.c | 114 + nx-X11/lib/src/xcms/IdOfPr.c | 106 + nx-X11/lib/src/xcms/LRGB.c | 1841 ++++++ nx-X11/lib/src/xcms/Lab.c | 431 ++ nx-X11/lib/src/xcms/LabGcC.c | 127 + nx-X11/lib/src/xcms/LabGcL.c | 174 + nx-X11/lib/src/xcms/LabGcLC.c | 223 + nx-X11/lib/src/xcms/LabMnL.c | 216 + nx-X11/lib/src/xcms/LabMxC.c | 203 + nx-X11/lib/src/xcms/LabMxL.c | 216 + nx-X11/lib/src/xcms/LabMxLC.c | 218 + nx-X11/lib/src/xcms/LabWpAj.c | 97 + nx-X11/lib/src/xcms/Luv.c | 401 ++ nx-X11/lib/src/xcms/LuvGcC.c | 127 + nx-X11/lib/src/xcms/LuvGcL.c | 174 + nx-X11/lib/src/xcms/LuvGcLC.c | 223 + nx-X11/lib/src/xcms/LuvMnL.c | 216 + nx-X11/lib/src/xcms/LuvMxC.c | 204 + nx-X11/lib/src/xcms/LuvMxL.c | 216 + nx-X11/lib/src/xcms/LuvMxLC.c | 218 + nx-X11/lib/src/xcms/LuvWpAj.c | 96 + nx-X11/lib/src/xcms/Makefile.am | 92 + nx-X11/lib/src/xcms/OfCCC.c | 162 + nx-X11/lib/src/xcms/PrOfId.c | 97 + nx-X11/lib/src/xcms/QBlack.c | 84 + nx-X11/lib/src/xcms/QBlue.c | 84 + nx-X11/lib/src/xcms/QGreen.c | 84 + nx-X11/lib/src/xcms/QRed.c | 84 + nx-X11/lib/src/xcms/QWhite.c | 84 + nx-X11/lib/src/xcms/QuCol.c | 78 + nx-X11/lib/src/xcms/QuCols.c | 78 + nx-X11/lib/src/xcms/SetCCC.c | 138 + nx-X11/lib/src/xcms/SetGetCols.c | 301 + nx-X11/lib/src/xcms/StCol.c | 82 + nx-X11/lib/src/xcms/StCols.c | 112 + nx-X11/lib/src/xcms/UNDEFINED.c | 131 + nx-X11/lib/src/xcms/XRGB.c | 242 + nx-X11/lib/src/xcms/XYZ.c | 203 + nx-X11/lib/src/xcms/Xcms.txt | 44 + nx-X11/lib/src/xcms/Xcmsint.h | 260 + nx-X11/lib/src/xcms/cmsAllCol.c | 74 + nx-X11/lib/src/xcms/cmsAllNCol.c | 198 + nx-X11/lib/src/xcms/cmsCmap.c | 492 ++ nx-X11/lib/src/xcms/cmsColNm.c | 1050 ++++ nx-X11/lib/src/xcms/cmsGlobls.c | 126 + nx-X11/lib/src/xcms/cmsInt.c | 411 ++ nx-X11/lib/src/xcms/cmsLkCol.c | 193 + nx-X11/lib/src/xcms/cmsMath.c | 140 + nx-X11/lib/src/xcms/cmsProp.c | 153 + nx-X11/lib/src/xcms/cmsTrig.c | 578 ++ nx-X11/lib/src/xcms/uvY.c | 423 ++ nx-X11/lib/src/xcms/xyY.c | 395 ++ nx-X11/lib/src/xkb/Makefile.am | 46 + nx-X11/lib/src/xkb/XKB.c | 771 +++ nx-X11/lib/src/xkb/XKBAlloc.c | 495 ++ nx-X11/lib/src/xkb/XKBBell.c | 179 + nx-X11/lib/src/xkb/XKBBind.c | 784 +++ nx-X11/lib/src/xkb/XKBCompat.c | 252 + nx-X11/lib/src/xkb/XKBCtrls.c | 351 ++ nx-X11/lib/src/xkb/XKBCvt.c | 341 ++ nx-X11/lib/src/xkb/XKBExtDev.c | 843 +++ nx-X11/lib/src/xkb/XKBGAlloc.c | 994 ++++ nx-X11/lib/src/xkb/XKBGeom.c | 724 +++ nx-X11/lib/src/xkb/XKBGetByName.c | 226 + nx-X11/lib/src/xkb/XKBGetMap.c | 882 +++ nx-X11/lib/src/xkb/XKBList.c | 256 + nx-X11/lib/src/xkb/XKBMAlloc.c | 1016 ++++ nx-X11/lib/src/xkb/XKBMisc.c | 1021 ++++ nx-X11/lib/src/xkb/XKBNames.c | 879 +++ nx-X11/lib/src/xkb/XKBRdBuf.c | 203 + nx-X11/lib/src/xkb/XKBSetGeom.c | 478 ++ nx-X11/lib/src/xkb/XKBSetMap.c | 598 ++ nx-X11/lib/src/xkb/XKBUse.c | 814 +++ nx-X11/lib/src/xkb/XKBleds.c | 338 ++ nx-X11/lib/src/xkb/XKBlibint.h | 337 ++ nx-X11/lib/src/xlibi18n/ICWrap.c | 432 ++ nx-X11/lib/src/xlibi18n/IMWrap.c | 204 + nx-X11/lib/src/xlibi18n/Makefile.am | 72 + nx-X11/lib/src/xlibi18n/XimImSw.h | 46 + nx-X11/lib/src/xlibi18n/XimProto.h | 226 + nx-X11/lib/src/xlibi18n/XimThai.h | 110 + nx-X11/lib/src/xlibi18n/XimTrInt.h | 85 + nx-X11/lib/src/xlibi18n/XimTrX.h | 85 + nx-X11/lib/src/xlibi18n/XimTrans.h | 136 + nx-X11/lib/src/xlibi18n/Ximint.h | 995 ++++ nx-X11/lib/src/xlibi18n/XimintL.h | 106 + nx-X11/lib/src/xlibi18n/XimintP.h | 310 + nx-X11/lib/src/xlibi18n/XlcGeneric.h | 162 + nx-X11/lib/src/xlibi18n/XlcPubI.h | 298 + nx-X11/lib/src/xlibi18n/XlcPublic.h | 324 + nx-X11/lib/src/xlibi18n/Xlcint.h | 964 +++ nx-X11/lib/src/xlibi18n/imKStoUCS.c | 322 + nx-X11/lib/src/xlibi18n/lcCT.c | 1303 ++++ nx-X11/lib/src/xlibi18n/lcCharSet.c | 225 + nx-X11/lib/src/xlibi18n/lcConv.c | 339 ++ nx-X11/lib/src/xlibi18n/lcDB.c | 1327 +++++ nx-X11/lib/src/xlibi18n/lcFile.c | 711 +++ nx-X11/lib/src/xlibi18n/lcGeneric.c | 1171 ++++ nx-X11/lib/src/xlibi18n/lcInit.c | 168 + nx-X11/lib/src/xlibi18n/lcPrTxt.c | 289 + nx-X11/lib/src/xlibi18n/lcPubWrap.c | 98 + nx-X11/lib/src/xlibi18n/lcPublic.c | 311 + nx-X11/lib/src/xlibi18n/lcRM.c | 224 + nx-X11/lib/src/xlibi18n/lcStd.c | 358 ++ nx-X11/lib/src/xlibi18n/lcTxtPr.c | 254 + nx-X11/lib/src/xlibi18n/lcUTF8.c | 2389 ++++++++ nx-X11/lib/src/xlibi18n/lcUniConv/armscii_8.h | 97 + nx-X11/lib/src/xlibi18n/lcUniConv/big5.h | 4141 +++++++++++++ nx-X11/lib/src/xlibi18n/lcUniConv/big5_emacs.h | 163 + nx-X11/lib/src/xlibi18n/lcUniConv/big5hkscs.h | 6252 ++++++++++++++++++++ nx-X11/lib/src/xlibi18n/lcUniConv/cp1133.h | 91 + nx-X11/lib/src/xlibi18n/lcUniConv/cp1251.h | 112 + nx-X11/lib/src/xlibi18n/lcUniConv/cp1255.h | 120 + nx-X11/lib/src/xlibi18n/lcUniConv/cp1256.h | 134 + nx-X11/lib/src/xlibi18n/lcUniConv/gb2312.h | 2552 ++++++++ nx-X11/lib/src/xlibi18n/lcUniConv/gbk.h | 6200 +++++++++++++++++++ .../lib/src/xlibi18n/lcUniConv/georgian_academy.h | 87 + nx-X11/lib/src/xlibi18n/lcUniConv/georgian_ps.h | 104 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_1.h | 22 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_10.h | 87 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_11.h | 77 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_13.h | 90 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_14.h | 108 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h | 62 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_16.h | 97 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_2.h | 93 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_3.h | 99 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_4.h | 93 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_5.h | 76 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_6.h | 79 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_7.h | 87 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_8.h | 88 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9.h | 66 + nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9e.h | 102 + nx-X11/lib/src/xlibi18n/lcUniConv/jisx0201.h | 47 + nx-X11/lib/src/xlibi18n/lcUniConv/jisx0208.h | 2396 ++++++++ nx-X11/lib/src/xlibi18n/lcUniConv/jisx0212.h | 2163 +++++++ nx-X11/lib/src/xlibi18n/lcUniConv/koi8_c.h | 102 + nx-X11/lib/src/xlibi18n/lcUniConv/koi8_r.h | 134 + nx-X11/lib/src/xlibi18n/lcUniConv/koi8_u.h | 142 + nx-X11/lib/src/xlibi18n/lcUniConv/ksc5601.h | 3002 ++++++++++ nx-X11/lib/src/xlibi18n/lcUniConv/mulelao.h | 77 + nx-X11/lib/src/xlibi18n/lcUniConv/tatar_cyr.h | 122 + nx-X11/lib/src/xlibi18n/lcUniConv/tcvn.h | 133 + nx-X11/lib/src/xlibi18n/lcUniConv/tis620.h | 77 + nx-X11/lib/src/xlibi18n/lcUniConv/ucs2be.h | 31 + nx-X11/lib/src/xlibi18n/lcUniConv/utf8.h | 109 + nx-X11/lib/src/xlibi18n/lcUniConv/viscii.h | 122 + nx-X11/lib/src/xlibi18n/lcUtil.c | 86 + nx-X11/lib/src/xlibi18n/lcWrap.c | 648 ++ nx-X11/lib/src/xlibi18n/mbWMProps.c | 69 + nx-X11/lib/src/xlibi18n/mbWrap.c | 161 + nx-X11/lib/src/xlibi18n/utf8WMProps.c | 91 + nx-X11/lib/src/xlibi18n/utf8Wrap.c | 183 + nx-X11/lib/src/xlibi18n/wcWrap.c | 161 + nx-X11/lib/src/xlibi18n/xim_trans.c | 30 + nx-X11/lib/xtrans/Imakefile | 19 - nx-X11/lib/xtrans/Xtrans.c | 1367 ----- nx-X11/lib/xtrans/Xtrans.h | 426 -- nx-X11/lib/xtrans/Xtransint.h | 433 -- nx-X11/lib/xtrans/Xtranslcl.c | 2486 -------- nx-X11/lib/xtrans/Xtranssock.c | 3554 ----------- nx-X11/lib/xtrans/Xtransutil.c | 639 -- nx-X11/lib/xtrans/transport.c | 74 - nx-X11/programs/Xserver/Imakefile | 5 +- nx-X11/programs/Xserver/hw/nxagent/Imakefile | 3 + .../programs/Xserver/hw/nxagent/compext/Imakefile | 1 + nxcompshad/src/Makefile.am | 2 +- 1045 files changed, 163310 insertions(+), 162915 deletions(-) create mode 100644 m4/nx-xtrans.m4 delete mode 100644 nx-X11/lib/Imakefile create mode 100644 nx-X11/lib/Makefile.am delete mode 100644 nx-X11/lib/X11/.gitignore delete mode 100644 nx-X11/lib/X11/AddDIC.c delete mode 100644 nx-X11/lib/X11/AddSF.c delete mode 100644 nx-X11/lib/X11/AllCells.c delete mode 100644 nx-X11/lib/X11/AllPlanes.c delete mode 100644 nx-X11/lib/X11/AllowEv.c delete mode 100644 nx-X11/lib/X11/AuDispose.c delete mode 100644 nx-X11/lib/X11/AuFileName.c delete mode 100644 nx-X11/lib/X11/AuGetBest.c delete mode 100644 nx-X11/lib/X11/AuRead.c delete mode 100644 nx-X11/lib/X11/AutoRep.c delete mode 100644 nx-X11/lib/X11/Backgnd.c delete mode 100644 nx-X11/lib/X11/BdrWidth.c delete mode 100644 nx-X11/lib/X11/Bell.c delete mode 100644 nx-X11/lib/X11/Border.c delete mode 100644 nx-X11/lib/X11/CCC.c delete mode 100644 nx-X11/lib/X11/ChAccCon.c delete mode 100644 nx-X11/lib/X11/ChActPGb.c delete mode 100644 nx-X11/lib/X11/ChClMode.c delete mode 100644 nx-X11/lib/X11/ChCmap.c delete mode 100644 nx-X11/lib/X11/ChGC.c delete mode 100644 nx-X11/lib/X11/ChKeyCon.c delete mode 100644 nx-X11/lib/X11/ChPntCon.c delete mode 100644 nx-X11/lib/X11/ChProp.c delete mode 100644 nx-X11/lib/X11/ChSaveSet.c delete mode 100644 nx-X11/lib/X11/ChWAttrs.c delete mode 100644 nx-X11/lib/X11/ChWindow.c delete mode 100644 nx-X11/lib/X11/ChkIfEv.c delete mode 100644 nx-X11/lib/X11/ChkMaskEv.c delete mode 100644 nx-X11/lib/X11/ChkTypEv.c delete mode 100644 nx-X11/lib/X11/ChkTypWEv.c delete mode 100644 nx-X11/lib/X11/ChkWinEv.c delete mode 100644 nx-X11/lib/X11/CirWin.c delete mode 100644 nx-X11/lib/X11/CirWinDn.c delete mode 100644 nx-X11/lib/X11/CirWinUp.c delete mode 100644 nx-X11/lib/X11/ClDisplay.c delete mode 100644 nx-X11/lib/X11/Clear.c delete mode 100644 nx-X11/lib/X11/ClearArea.c delete mode 100644 nx-X11/lib/X11/Cmap.h delete mode 100644 nx-X11/lib/X11/ConfWind.c delete mode 100644 nx-X11/lib/X11/ConnDis.c delete mode 100644 nx-X11/lib/X11/Context.c delete mode 100644 nx-X11/lib/X11/ConvSel.c delete mode 100644 nx-X11/lib/X11/CopyArea.c delete mode 100644 nx-X11/lib/X11/CopyCmap.c delete mode 100644 nx-X11/lib/X11/CopyGC.c delete mode 100644 nx-X11/lib/X11/CopyPlane.c delete mode 100644 nx-X11/lib/X11/Cr.h delete mode 100644 nx-X11/lib/X11/CrBFData.c delete mode 100644 nx-X11/lib/X11/CrCmap.c delete mode 100644 nx-X11/lib/X11/CrCursor.c delete mode 100644 nx-X11/lib/X11/CrGC.c delete mode 100644 nx-X11/lib/X11/CrGlCur.c delete mode 100644 nx-X11/lib/X11/CrPFBData.c delete mode 100644 nx-X11/lib/X11/CrPixmap.c delete mode 100644 nx-X11/lib/X11/CrWindow.c delete mode 100644 nx-X11/lib/X11/Cursor.c delete mode 100644 nx-X11/lib/X11/Cv.h delete mode 100644 nx-X11/lib/X11/CvColW.c delete mode 100644 nx-X11/lib/X11/CvCols.c delete mode 100644 nx-X11/lib/X11/DefCursor.c delete mode 100644 nx-X11/lib/X11/DelProp.c delete mode 100644 nx-X11/lib/X11/Depths.c delete mode 100644 nx-X11/lib/X11/DestSubs.c delete mode 100644 nx-X11/lib/X11/DestWind.c delete mode 100644 nx-X11/lib/X11/DisName.c delete mode 100644 nx-X11/lib/X11/DrArc.c delete mode 100644 nx-X11/lib/X11/DrArcs.c delete mode 100644 nx-X11/lib/X11/DrLine.c delete mode 100644 nx-X11/lib/X11/DrLines.c delete mode 100644 nx-X11/lib/X11/DrPoint.c delete mode 100644 nx-X11/lib/X11/DrPoints.c delete mode 100644 nx-X11/lib/X11/DrRect.c delete mode 100644 nx-X11/lib/X11/DrRects.c delete mode 100644 nx-X11/lib/X11/DrSegs.c delete mode 100644 nx-X11/lib/X11/ErrDes.c delete mode 100644 nx-X11/lib/X11/ErrHndlr.c delete mode 100644 nx-X11/lib/X11/EvToWire.c delete mode 100644 nx-X11/lib/X11/FSSaver.c delete mode 100644 nx-X11/lib/X11/FSWrap.c delete mode 100644 nx-X11/lib/X11/FetchName.c delete mode 100644 nx-X11/lib/X11/FillArc.c delete mode 100644 nx-X11/lib/X11/FillArcs.c delete mode 100644 nx-X11/lib/X11/FillPoly.c delete mode 100644 nx-X11/lib/X11/FillRct.c delete mode 100644 nx-X11/lib/X11/FillRcts.c delete mode 100644 nx-X11/lib/X11/FilterEv.c delete mode 100644 nx-X11/lib/X11/Flush.c delete mode 100644 nx-X11/lib/X11/Font.c delete mode 100644 nx-X11/lib/X11/FontInfo.c delete mode 100644 nx-X11/lib/X11/FontNames.c delete mode 100644 nx-X11/lib/X11/FreeCmap.c delete mode 100644 nx-X11/lib/X11/FreeCols.c delete mode 100644 nx-X11/lib/X11/FreeCurs.c delete mode 100644 nx-X11/lib/X11/FreeEData.c delete mode 100644 nx-X11/lib/X11/FreeEventData.c delete mode 100644 nx-X11/lib/X11/FreeGC.c delete mode 100644 nx-X11/lib/X11/FreePix.c delete mode 100644 nx-X11/lib/X11/GCMisc.c delete mode 100644 nx-X11/lib/X11/Geom.c delete mode 100644 nx-X11/lib/X11/GetAtomNm.c delete mode 100644 nx-X11/lib/X11/GetColor.c delete mode 100644 nx-X11/lib/X11/GetDflt.c delete mode 100644 nx-X11/lib/X11/GetEventData.c delete mode 100644 nx-X11/lib/X11/GetFPath.c delete mode 100644 nx-X11/lib/X11/GetFProp.c delete mode 100644 nx-X11/lib/X11/GetGCVals.c delete mode 100644 nx-X11/lib/X11/GetGeom.c delete mode 100644 nx-X11/lib/X11/GetHColor.c delete mode 100644 nx-X11/lib/X11/GetHints.c delete mode 100644 nx-X11/lib/X11/GetIFocus.c delete mode 100644 nx-X11/lib/X11/GetImage.c delete mode 100644 nx-X11/lib/X11/GetKCnt.c delete mode 100644 nx-X11/lib/X11/GetMoEv.c delete mode 100644 nx-X11/lib/X11/GetNrmHint.c delete mode 100644 nx-X11/lib/X11/GetPCnt.c delete mode 100644 nx-X11/lib/X11/GetPntMap.c delete mode 100644 nx-X11/lib/X11/GetProp.c delete mode 100644 nx-X11/lib/X11/GetRGBCMap.c delete mode 100644 nx-X11/lib/X11/GetSOwner.c delete mode 100644 nx-X11/lib/X11/GetSSaver.c delete mode 100644 nx-X11/lib/X11/GetStCmap.c delete mode 100644 nx-X11/lib/X11/GetTxtProp.c delete mode 100644 nx-X11/lib/X11/GetWAttrs.c delete mode 100644 nx-X11/lib/X11/GetWMCMapW.c delete mode 100644 nx-X11/lib/X11/GetWMProto.c delete mode 100644 nx-X11/lib/X11/GrButton.c delete mode 100644 nx-X11/lib/X11/GrKey.c delete mode 100644 nx-X11/lib/X11/GrKeybd.c delete mode 100644 nx-X11/lib/X11/GrPointer.c delete mode 100644 nx-X11/lib/X11/GrServer.c delete mode 100644 nx-X11/lib/X11/HVC.c delete mode 100644 nx-X11/lib/X11/HVCGcC.c delete mode 100644 nx-X11/lib/X11/HVCGcV.c delete mode 100644 nx-X11/lib/X11/HVCGcVC.c delete mode 100644 nx-X11/lib/X11/HVCMnV.c delete mode 100644 nx-X11/lib/X11/HVCMxC.c delete mode 100644 nx-X11/lib/X11/HVCMxV.c delete mode 100644 nx-X11/lib/X11/HVCMxVC.c delete mode 100644 nx-X11/lib/X11/HVCMxVs.c delete mode 100644 nx-X11/lib/X11/HVCWpAj.c delete mode 100644 nx-X11/lib/X11/Host.c delete mode 100644 nx-X11/lib/X11/ICWrap.c delete mode 100644 nx-X11/lib/X11/IMWrap.c delete mode 100644 nx-X11/lib/X11/Iconify.c delete mode 100644 nx-X11/lib/X11/IdOfPr.c delete mode 100644 nx-X11/lib/X11/IfEvent.c delete mode 100644 nx-X11/lib/X11/ImText.c delete mode 100644 nx-X11/lib/X11/ImText16.c delete mode 100644 nx-X11/lib/X11/ImUtil.c delete mode 100644 nx-X11/lib/X11/ImUtil.h delete mode 100644 nx-X11/lib/X11/Imakefile delete mode 100644 nx-X11/lib/X11/InitExt.c delete mode 100644 nx-X11/lib/X11/InsCmap.c delete mode 100644 nx-X11/lib/X11/IntAtom.c delete mode 100644 nx-X11/lib/X11/Key.h delete mode 100644 nx-X11/lib/X11/KeyBind.c delete mode 100644 nx-X11/lib/X11/KeysymStr.c delete mode 100644 nx-X11/lib/X11/KillCl.c delete mode 100644 nx-X11/lib/X11/LRGB.c delete mode 100644 nx-X11/lib/X11/Lab.c delete mode 100644 nx-X11/lib/X11/LabGcC.c delete mode 100644 nx-X11/lib/X11/LabGcL.c delete mode 100644 nx-X11/lib/X11/LabGcLC.c delete mode 100644 nx-X11/lib/X11/LabMnL.c delete mode 100644 nx-X11/lib/X11/LabMxC.c delete mode 100644 nx-X11/lib/X11/LabMxL.c delete mode 100644 nx-X11/lib/X11/LabMxLC.c delete mode 100644 nx-X11/lib/X11/LabWpAj.c delete mode 100644 nx-X11/lib/X11/LiHosts.c delete mode 100644 nx-X11/lib/X11/LiICmaps.c delete mode 100644 nx-X11/lib/X11/LiProps.c delete mode 100644 nx-X11/lib/X11/ListExt.c delete mode 100644 nx-X11/lib/X11/LoadFont.c delete mode 100644 nx-X11/lib/X11/LockDis.c delete mode 100644 nx-X11/lib/X11/LookupCol.c delete mode 100644 nx-X11/lib/X11/LowerWin.c delete mode 100644 nx-X11/lib/X11/Luv.c delete mode 100644 nx-X11/lib/X11/LuvGcC.c delete mode 100644 nx-X11/lib/X11/LuvGcL.c delete mode 100644 nx-X11/lib/X11/LuvGcLC.c delete mode 100644 nx-X11/lib/X11/LuvMnL.c delete mode 100644 nx-X11/lib/X11/LuvMxC.c delete mode 100644 nx-X11/lib/X11/LuvMxL.c delete mode 100644 nx-X11/lib/X11/LuvMxLC.c delete mode 100644 nx-X11/lib/X11/LuvWpAj.c delete mode 100644 nx-X11/lib/X11/Macros.c delete mode 100644 nx-X11/lib/X11/MapRaised.c delete mode 100644 nx-X11/lib/X11/MapSubs.c delete mode 100644 nx-X11/lib/X11/MapWindow.c delete mode 100644 nx-X11/lib/X11/MaskEvent.c delete mode 100644 nx-X11/lib/X11/Misc.c delete mode 100644 nx-X11/lib/X11/ModMap.c delete mode 100644 nx-X11/lib/X11/MoveWin.c delete mode 100644 nx-X11/lib/X11/NextEvent.c delete mode 100644 nx-X11/lib/X11/OCWrap.c delete mode 100644 nx-X11/lib/X11/OMWrap.c delete mode 100644 nx-X11/lib/X11/OfCCC.c delete mode 100644 nx-X11/lib/X11/OpenDis.c delete mode 100644 nx-X11/lib/X11/ParseCmd.c delete mode 100644 nx-X11/lib/X11/ParseCol.c delete mode 100644 nx-X11/lib/X11/ParseGeom.c delete mode 100644 nx-X11/lib/X11/PeekEvent.c delete mode 100644 nx-X11/lib/X11/PeekIfEv.c delete mode 100644 nx-X11/lib/X11/Pending.c delete mode 100644 nx-X11/lib/X11/PixFormats.c delete mode 100644 nx-X11/lib/X11/PmapBgnd.c delete mode 100644 nx-X11/lib/X11/PmapBord.c delete mode 100644 nx-X11/lib/X11/PolyReg.c delete mode 100644 nx-X11/lib/X11/PolyTxt.c delete mode 100644 nx-X11/lib/X11/PolyTxt16.c delete mode 100644 nx-X11/lib/X11/PrOfId.c delete mode 100644 nx-X11/lib/X11/PropAlloc.c delete mode 100644 nx-X11/lib/X11/PutBEvent.c delete mode 100644 nx-X11/lib/X11/PutImage.c delete mode 100644 nx-X11/lib/X11/QBlack.c delete mode 100644 nx-X11/lib/X11/QBlue.c delete mode 100644 nx-X11/lib/X11/QGreen.c delete mode 100644 nx-X11/lib/X11/QRed.c delete mode 100644 nx-X11/lib/X11/QWhite.c delete mode 100644 nx-X11/lib/X11/QuBest.c delete mode 100644 nx-X11/lib/X11/QuCol.c delete mode 100644 nx-X11/lib/X11/QuColor.c delete mode 100644 nx-X11/lib/X11/QuColors.c delete mode 100644 nx-X11/lib/X11/QuCols.c delete mode 100644 nx-X11/lib/X11/QuCurShp.c delete mode 100644 nx-X11/lib/X11/QuExt.c delete mode 100644 nx-X11/lib/X11/QuKeybd.c delete mode 100644 nx-X11/lib/X11/QuPntr.c delete mode 100644 nx-X11/lib/X11/QuStipShp.c delete mode 100644 nx-X11/lib/X11/QuTextE16.c delete mode 100644 nx-X11/lib/X11/QuTextExt.c delete mode 100644 nx-X11/lib/X11/QuTileShp.c delete mode 100644 nx-X11/lib/X11/QuTree.c delete mode 100644 nx-X11/lib/X11/Quarks.c delete mode 100644 nx-X11/lib/X11/RaiseWin.c delete mode 100644 nx-X11/lib/X11/RdBitF.c delete mode 100644 nx-X11/lib/X11/RecolorC.c delete mode 100644 nx-X11/lib/X11/ReconfWM.c delete mode 100644 nx-X11/lib/X11/ReconfWin.c delete mode 100644 nx-X11/lib/X11/Region.c delete mode 100644 nx-X11/lib/X11/RegstFlt.c delete mode 100644 nx-X11/lib/X11/RepWindow.c delete mode 100644 nx-X11/lib/X11/RestackWs.c delete mode 100644 nx-X11/lib/X11/RotProp.c delete mode 100644 nx-X11/lib/X11/ScrResStr.c delete mode 100644 nx-X11/lib/X11/SelInput.c delete mode 100644 nx-X11/lib/X11/SendEvent.c delete mode 100644 nx-X11/lib/X11/SetBack.c delete mode 100644 nx-X11/lib/X11/SetCCC.c delete mode 100644 nx-X11/lib/X11/SetCRects.c delete mode 100644 nx-X11/lib/X11/SetClMask.c delete mode 100644 nx-X11/lib/X11/SetClOrig.c delete mode 100644 nx-X11/lib/X11/SetDashes.c delete mode 100644 nx-X11/lib/X11/SetFPath.c delete mode 100644 nx-X11/lib/X11/SetFont.c delete mode 100644 nx-X11/lib/X11/SetFore.c delete mode 100644 nx-X11/lib/X11/SetFunc.c delete mode 100644 nx-X11/lib/X11/SetGetCols.c delete mode 100644 nx-X11/lib/X11/SetHints.c delete mode 100644 nx-X11/lib/X11/SetIFocus.c delete mode 100644 nx-X11/lib/X11/SetLStyle.c delete mode 100644 nx-X11/lib/X11/SetLocale.c delete mode 100644 nx-X11/lib/X11/SetNrmHint.c delete mode 100644 nx-X11/lib/X11/SetPMask.c delete mode 100644 nx-X11/lib/X11/SetPntMap.c delete mode 100644 nx-X11/lib/X11/SetRGBCMap.c delete mode 100644 nx-X11/lib/X11/SetSOwner.c delete mode 100644 nx-X11/lib/X11/SetSSaver.c delete mode 100644 nx-X11/lib/X11/SetStCmap.c delete mode 100644 nx-X11/lib/X11/SetState.c delete mode 100644 nx-X11/lib/X11/SetStip.c delete mode 100644 nx-X11/lib/X11/SetTSOrig.c delete mode 100644 nx-X11/lib/X11/SetTile.c delete mode 100644 nx-X11/lib/X11/SetTxtProp.c delete mode 100644 nx-X11/lib/X11/SetWMCMapW.c delete mode 100644 nx-X11/lib/X11/SetWMProto.c delete mode 100644 nx-X11/lib/X11/StBytes.c delete mode 100644 nx-X11/lib/X11/StCol.c delete mode 100644 nx-X11/lib/X11/StColor.c delete mode 100644 nx-X11/lib/X11/StColors.c delete mode 100644 nx-X11/lib/X11/StCols.c delete mode 100644 nx-X11/lib/X11/StNColor.c delete mode 100644 nx-X11/lib/X11/StName.c delete mode 100644 nx-X11/lib/X11/StrKeysym.c delete mode 100644 nx-X11/lib/X11/StrToText.c delete mode 100644 nx-X11/lib/X11/Sync.c delete mode 100644 nx-X11/lib/X11/Synchro.c delete mode 100644 nx-X11/lib/X11/Text.c delete mode 100644 nx-X11/lib/X11/Text16.c delete mode 100644 nx-X11/lib/X11/TextExt.c delete mode 100644 nx-X11/lib/X11/TextExt16.c delete mode 100644 nx-X11/lib/X11/TextToStr.c delete mode 100644 nx-X11/lib/X11/TrCoords.c delete mode 100644 nx-X11/lib/X11/UIThrStubs.c delete mode 100644 nx-X11/lib/X11/UNDEFINED.c delete mode 100644 nx-X11/lib/X11/UndefCurs.c delete mode 100644 nx-X11/lib/X11/UngrabBut.c delete mode 100644 nx-X11/lib/X11/UngrabKbd.c delete mode 100644 nx-X11/lib/X11/UngrabKey.c delete mode 100644 nx-X11/lib/X11/UngrabPtr.c delete mode 100644 nx-X11/lib/X11/UngrabSvr.c delete mode 100644 nx-X11/lib/X11/UninsCmap.c delete mode 100644 nx-X11/lib/X11/UnldFont.c delete mode 100644 nx-X11/lib/X11/UnmapSubs.c delete mode 100644 nx-X11/lib/X11/UnmapWin.c delete mode 100644 nx-X11/lib/X11/VisUtil.c delete mode 100644 nx-X11/lib/X11/WMGeom.c delete mode 100644 nx-X11/lib/X11/WMProps.c delete mode 100644 nx-X11/lib/X11/WarpPtr.c delete mode 100644 nx-X11/lib/X11/WinEvent.c delete mode 100644 nx-X11/lib/X11/Window.c delete mode 100644 nx-X11/lib/X11/Withdraw.c delete mode 100644 nx-X11/lib/X11/WrBitF.c delete mode 100644 nx-X11/lib/X11/XErrorDB delete mode 100644 nx-X11/lib/X11/XKB.c delete mode 100644 nx-X11/lib/X11/XKBAlloc.c delete mode 100644 nx-X11/lib/X11/XKBBell.c delete mode 100644 nx-X11/lib/X11/XKBBind.c delete mode 100644 nx-X11/lib/X11/XKBCompat.c delete mode 100644 nx-X11/lib/X11/XKBCtrls.c delete mode 100644 nx-X11/lib/X11/XKBCvt.c delete mode 100644 nx-X11/lib/X11/XKBExtDev.c delete mode 100644 nx-X11/lib/X11/XKBGAlloc.c delete mode 100644 nx-X11/lib/X11/XKBGeom.c delete mode 100644 nx-X11/lib/X11/XKBGetByName.c delete mode 100644 nx-X11/lib/X11/XKBGetMap.c delete mode 100644 nx-X11/lib/X11/XKBList.c delete mode 100644 nx-X11/lib/X11/XKBMAlloc.c delete mode 100644 nx-X11/lib/X11/XKBMisc.c delete mode 100644 nx-X11/lib/X11/XKBNames.c delete mode 100644 nx-X11/lib/X11/XKBRdBuf.c delete mode 100644 nx-X11/lib/X11/XKBSetGeom.c delete mode 100644 nx-X11/lib/X11/XKBSetMap.c delete mode 100644 nx-X11/lib/X11/XKBUse.c delete mode 100644 nx-X11/lib/X11/XKBleds.c delete mode 100644 nx-X11/lib/X11/XKBlib.h delete mode 100644 nx-X11/lib/X11/XKBlibint.h delete mode 100644 nx-X11/lib/X11/XRGB.c delete mode 100644 nx-X11/lib/X11/XYZ.c delete mode 100644 nx-X11/lib/X11/Xatomtype.h delete mode 100644 nx-X11/lib/X11/Xcms.h delete mode 100644 nx-X11/lib/X11/Xcms.txt delete mode 100644 nx-X11/lib/X11/Xcmsint.h delete mode 100644 nx-X11/lib/X11/XimImSw.h delete mode 100644 nx-X11/lib/X11/XimProto.h delete mode 100644 nx-X11/lib/X11/XimThai.h delete mode 100644 nx-X11/lib/X11/XimTrInt.h delete mode 100644 nx-X11/lib/X11/XimTrX.h delete mode 100644 nx-X11/lib/X11/XimTrans.h delete mode 100644 nx-X11/lib/X11/Ximint.h delete mode 100644 nx-X11/lib/X11/XimintL.h delete mode 100644 nx-X11/lib/X11/XimintP.h delete mode 100644 nx-X11/lib/X11/Xintatom.h delete mode 100644 nx-X11/lib/X11/Xintconn.h delete mode 100644 nx-X11/lib/X11/XlcGeneric.h delete mode 100644 nx-X11/lib/X11/XlcPubI.h delete mode 100644 nx-X11/lib/X11/XlcPublic.h delete mode 100644 nx-X11/lib/X11/Xlcint.h delete mode 100644 nx-X11/lib/X11/Xlib.h delete mode 100644 nx-X11/lib/X11/XlibAsync.c delete mode 100644 nx-X11/lib/X11/XlibConf.h delete mode 100644 nx-X11/lib/X11/XlibInt.c delete mode 100644 nx-X11/lib/X11/Xlibint.h delete mode 100644 nx-X11/lib/X11/Xlocale.h delete mode 100644 nx-X11/lib/X11/XomGeneric.h delete mode 100644 nx-X11/lib/X11/Xprivate.h delete mode 100644 nx-X11/lib/X11/Xregion.h delete mode 100644 nx-X11/lib/X11/Xresinternal.h delete mode 100644 nx-X11/lib/X11/Xresource.h delete mode 100644 nx-X11/lib/X11/Xrm.c delete mode 100644 nx-X11/lib/X11/Xutil.h delete mode 100644 nx-X11/lib/X11/cmsAllCol.c delete mode 100644 nx-X11/lib/X11/cmsAllNCol.c delete mode 100644 nx-X11/lib/X11/cmsCmap.c delete mode 100644 nx-X11/lib/X11/cmsColNm.c delete mode 100644 nx-X11/lib/X11/cmsGlobls.c delete mode 100644 nx-X11/lib/X11/cmsInt.c delete mode 100644 nx-X11/lib/X11/cmsLkCol.c delete mode 100644 nx-X11/lib/X11/cmsMath.c delete mode 100644 nx-X11/lib/X11/cmsProp.c delete mode 100644 nx-X11/lib/X11/cmsTrig.c delete mode 100644 nx-X11/lib/X11/cursorfont.h delete mode 100644 nx-X11/lib/X11/evtomask.c delete mode 100644 nx-X11/lib/X11/globals.c delete mode 100644 nx-X11/lib/X11/imCallbk.c delete mode 100644 nx-X11/lib/X11/imConv.c delete mode 100644 nx-X11/lib/X11/imDefFlt.c delete mode 100644 nx-X11/lib/X11/imDefIc.c delete mode 100644 nx-X11/lib/X11/imDefIm.c delete mode 100644 nx-X11/lib/X11/imDefLkup.c delete mode 100644 nx-X11/lib/X11/imDispch.c delete mode 100644 nx-X11/lib/X11/imEvToWire.c delete mode 100644 nx-X11/lib/X11/imExten.c delete mode 100644 nx-X11/lib/X11/imImSw.c delete mode 100644 nx-X11/lib/X11/imInsClbk.c delete mode 100644 nx-X11/lib/X11/imInt.c delete mode 100644 nx-X11/lib/X11/imKStoUCS.c delete mode 100644 nx-X11/lib/X11/imLcFlt.c delete mode 100644 nx-X11/lib/X11/imLcGIc.c delete mode 100644 nx-X11/lib/X11/imLcIc.c delete mode 100644 nx-X11/lib/X11/imLcIm.c delete mode 100644 nx-X11/lib/X11/imLcLkup.c delete mode 100644 nx-X11/lib/X11/imLcPrs.c delete mode 100644 nx-X11/lib/X11/imLcSIc.c delete mode 100644 nx-X11/lib/X11/imRm.c delete mode 100644 nx-X11/lib/X11/imRmAttr.c delete mode 100644 nx-X11/lib/X11/imThaiFlt.c delete mode 100644 nx-X11/lib/X11/imThaiIc.c delete mode 100644 nx-X11/lib/X11/imThaiIm.c delete mode 100644 nx-X11/lib/X11/imTrX.c delete mode 100644 nx-X11/lib/X11/imTrans.c delete mode 100644 nx-X11/lib/X11/imTransR.c delete mode 100644 nx-X11/lib/X11/lcCT.c delete mode 100644 nx-X11/lib/X11/lcCharSet.c delete mode 100644 nx-X11/lib/X11/lcConv.c delete mode 100644 nx-X11/lib/X11/lcDB.c delete mode 100644 nx-X11/lib/X11/lcDefConv.c delete mode 100644 nx-X11/lib/X11/lcFile.c delete mode 100644 nx-X11/lib/X11/lcGenConv.c delete mode 100644 nx-X11/lib/X11/lcGeneric.c delete mode 100644 nx-X11/lib/X11/lcInit.c delete mode 100644 nx-X11/lib/X11/lcPrTxt.c delete mode 100644 nx-X11/lib/X11/lcPubWrap.c delete mode 100644 nx-X11/lib/X11/lcPublic.c delete mode 100644 nx-X11/lib/X11/lcRM.c delete mode 100644 nx-X11/lib/X11/lcStd.c delete mode 100644 nx-X11/lib/X11/lcTxtPr.c delete mode 100644 nx-X11/lib/X11/lcUTF8.c delete mode 100644 nx-X11/lib/X11/lcUTF8Load.c delete mode 100644 nx-X11/lib/X11/lcUniConv/armscii_8.h delete mode 100644 nx-X11/lib/X11/lcUniConv/big5.h delete mode 100644 nx-X11/lib/X11/lcUniConv/big5_emacs.h delete mode 100644 nx-X11/lib/X11/lcUniConv/big5hkscs.h delete mode 100644 nx-X11/lib/X11/lcUniConv/cp1133.h delete mode 100644 nx-X11/lib/X11/lcUniConv/cp1251.h delete mode 100644 nx-X11/lib/X11/lcUniConv/cp1255.h delete mode 100644 nx-X11/lib/X11/lcUniConv/cp1256.h delete mode 100644 nx-X11/lib/X11/lcUniConv/gb2312.h delete mode 100644 nx-X11/lib/X11/lcUniConv/gbk.h delete mode 100644 nx-X11/lib/X11/lcUniConv/georgian_academy.h delete mode 100644 nx-X11/lib/X11/lcUniConv/georgian_ps.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_1.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_10.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_11.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_13.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_14.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_15.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_16.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_2.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_3.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_4.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_5.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_6.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_7.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_8.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_9.h delete mode 100644 nx-X11/lib/X11/lcUniConv/iso8859_9e.h delete mode 100644 nx-X11/lib/X11/lcUniConv/jisx0201.h delete mode 100644 nx-X11/lib/X11/lcUniConv/jisx0208.h delete mode 100644 nx-X11/lib/X11/lcUniConv/jisx0212.h delete mode 100644 nx-X11/lib/X11/lcUniConv/koi8_c.h delete mode 100644 nx-X11/lib/X11/lcUniConv/koi8_r.h delete mode 100644 nx-X11/lib/X11/lcUniConv/koi8_u.h delete mode 100644 nx-X11/lib/X11/lcUniConv/ksc5601.h delete mode 100644 nx-X11/lib/X11/lcUniConv/mulelao.h delete mode 100644 nx-X11/lib/X11/lcUniConv/tatar_cyr.h delete mode 100644 nx-X11/lib/X11/lcUniConv/tcvn.h delete mode 100644 nx-X11/lib/X11/lcUniConv/tis620.h delete mode 100644 nx-X11/lib/X11/lcUniConv/ucs2be.h delete mode 100644 nx-X11/lib/X11/lcUniConv/utf8.h delete mode 100644 nx-X11/lib/X11/lcUniConv/viscii.h delete mode 100644 nx-X11/lib/X11/lcUtil.c delete mode 100644 nx-X11/lib/X11/lcWrap.c delete mode 100644 nx-X11/lib/X11/locking.c delete mode 100644 nx-X11/lib/X11/locking.h delete mode 100644 nx-X11/lib/X11/mbWMProps.c delete mode 100644 nx-X11/lib/X11/mbWrap.c delete mode 100644 nx-X11/lib/X11/omDefault.c delete mode 100644 nx-X11/lib/X11/omGeneric.c delete mode 100644 nx-X11/lib/X11/omImText.c delete mode 100644 nx-X11/lib/X11/omText.c delete mode 100644 nx-X11/lib/X11/omTextEsc.c delete mode 100644 nx-X11/lib/X11/omTextExt.c delete mode 100644 nx-X11/lib/X11/omTextPer.c delete mode 100644 nx-X11/lib/X11/omXChar.c delete mode 100644 nx-X11/lib/X11/pathmax.h delete mode 100644 nx-X11/lib/X11/poly.h delete mode 100644 nx-X11/lib/X11/utf8WMProps.c delete mode 100644 nx-X11/lib/X11/utf8Wrap.c delete mode 100644 nx-X11/lib/X11/util/makekeys.c delete mode 100644 nx-X11/lib/X11/utlist.h delete mode 100644 nx-X11/lib/X11/uvY.c delete mode 100644 nx-X11/lib/X11/wcWrap.c delete mode 100644 nx-X11/lib/X11/x11_trans.c delete mode 100644 nx-X11/lib/X11/xim_trans.c delete mode 100644 nx-X11/lib/X11/xyY.c create mode 100644 nx-X11/lib/configure.ac create mode 100644 nx-X11/lib/include/Makefile.am create mode 100644 nx-X11/lib/include/X11/.gitignore create mode 100644 nx-X11/lib/include/X11/ImUtil.h create mode 100644 nx-X11/lib/include/X11/XKBlib.h create mode 100644 nx-X11/lib/include/X11/Xcms.h create mode 100644 nx-X11/lib/include/X11/Xlib.h create mode 100644 nx-X11/lib/include/X11/XlibConf.h.in create mode 100644 nx-X11/lib/include/X11/Xlibint.h create mode 100644 nx-X11/lib/include/X11/Xlocale.h create mode 100644 nx-X11/lib/include/X11/Xregion.h create mode 100644 nx-X11/lib/include/X11/Xresource.h create mode 100644 nx-X11/lib/include/X11/Xutil.h create mode 100644 nx-X11/lib/include/X11/cursorfont.h create mode 100644 nx-X11/lib/include/xtrans/Xtrans.c create mode 100644 nx-X11/lib/include/xtrans/Xtrans.h create mode 100644 nx-X11/lib/include/xtrans/Xtransint.h create mode 100644 nx-X11/lib/include/xtrans/Xtranslcl.c create mode 100644 nx-X11/lib/include/xtrans/Xtranssock.c create mode 100644 nx-X11/lib/include/xtrans/Xtransutil.c create mode 100644 nx-X11/lib/include/xtrans/transport.c create mode 100644 nx-X11/lib/m4/ax_define_dir.m4 create mode 120000 nx-X11/lib/m4/nx-macros.m4 create mode 120000 nx-X11/lib/m4/nx-xtrans.m4 create mode 100644 nx-X11/lib/modules/Makefile.am create mode 100644 nx-X11/lib/modules/im/Makefile.am create mode 100644 nx-X11/lib/modules/im/ximcp/Makefile.am create mode 100644 nx-X11/lib/modules/im/ximcp/imCallbk.c create mode 100644 nx-X11/lib/modules/im/ximcp/imDefFlt.c create mode 100644 nx-X11/lib/modules/im/ximcp/imDefIc.c create mode 100644 nx-X11/lib/modules/im/ximcp/imDefIm.c create mode 100644 nx-X11/lib/modules/im/ximcp/imDefLkup.c create mode 100644 nx-X11/lib/modules/im/ximcp/imDispch.c create mode 100644 nx-X11/lib/modules/im/ximcp/imEvToWire.c create mode 100644 nx-X11/lib/modules/im/ximcp/imExten.c create mode 100644 nx-X11/lib/modules/im/ximcp/imImSw.c create mode 100644 nx-X11/lib/modules/im/ximcp/imInsClbk.c create mode 100644 nx-X11/lib/modules/im/ximcp/imInt.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcFlt.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcGIc.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcIc.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcIm.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcLkup.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcPrs.c create mode 100644 nx-X11/lib/modules/im/ximcp/imLcSIc.c create mode 100644 nx-X11/lib/modules/im/ximcp/imRm.c create mode 100644 nx-X11/lib/modules/im/ximcp/imRmAttr.c create mode 100644 nx-X11/lib/modules/im/ximcp/imThaiFlt.c create mode 100644 nx-X11/lib/modules/im/ximcp/imThaiIc.c create mode 100644 nx-X11/lib/modules/im/ximcp/imThaiIm.c create mode 100644 nx-X11/lib/modules/im/ximcp/imTrX.c create mode 100644 nx-X11/lib/modules/im/ximcp/imTrans.c create mode 100644 nx-X11/lib/modules/im/ximcp/imTransR.c create mode 100644 nx-X11/lib/modules/lc/Makefile.am create mode 100644 nx-X11/lib/modules/lc/Utf8/Makefile.am create mode 100644 nx-X11/lib/modules/lc/Utf8/lcUTF8Load.c create mode 100644 nx-X11/lib/modules/lc/def/Makefile.am create mode 100644 nx-X11/lib/modules/lc/def/lcDefConv.c create mode 100644 nx-X11/lib/modules/lc/gen/Makefile.am create mode 100644 nx-X11/lib/modules/lc/gen/lcGenConv.c create mode 100644 nx-X11/lib/modules/om/Makefile.am create mode 100644 nx-X11/lib/modules/om/generic/Makefile.am create mode 100644 nx-X11/lib/modules/om/generic/omDefault.c create mode 100644 nx-X11/lib/modules/om/generic/omGeneric.c create mode 100644 nx-X11/lib/modules/om/generic/omImText.c create mode 100644 nx-X11/lib/modules/om/generic/omText.c create mode 100644 nx-X11/lib/modules/om/generic/omTextEsc.c create mode 100644 nx-X11/lib/modules/om/generic/omTextExt.c create mode 100644 nx-X11/lib/modules/om/generic/omTextPer.c create mode 100644 nx-X11/lib/modules/om/generic/omXChar.c create mode 100644 nx-X11/lib/nx-x11.pc.in create mode 100644 nx-X11/lib/src/.gitignore create mode 100644 nx-X11/lib/src/AllCells.c create mode 100644 nx-X11/lib/src/AllPlanes.c create mode 100644 nx-X11/lib/src/AllowEv.c create mode 100644 nx-X11/lib/src/AuDispose.c create mode 100644 nx-X11/lib/src/AuFileName.c create mode 100644 nx-X11/lib/src/AuGetBest.c create mode 100644 nx-X11/lib/src/AuRead.c create mode 100644 nx-X11/lib/src/AutoRep.c create mode 100644 nx-X11/lib/src/Backgnd.c create mode 100644 nx-X11/lib/src/BdrWidth.c create mode 100644 nx-X11/lib/src/Bell.c create mode 100644 nx-X11/lib/src/Border.c create mode 100644 nx-X11/lib/src/ChAccCon.c create mode 100644 nx-X11/lib/src/ChActPGb.c create mode 100644 nx-X11/lib/src/ChClMode.c create mode 100644 nx-X11/lib/src/ChCmap.c create mode 100644 nx-X11/lib/src/ChGC.c create mode 100644 nx-X11/lib/src/ChKeyCon.c create mode 100644 nx-X11/lib/src/ChPntCon.c create mode 100644 nx-X11/lib/src/ChProp.c create mode 100644 nx-X11/lib/src/ChSaveSet.c create mode 100644 nx-X11/lib/src/ChWAttrs.c create mode 100644 nx-X11/lib/src/ChWindow.c create mode 100644 nx-X11/lib/src/ChkIfEv.c create mode 100644 nx-X11/lib/src/ChkMaskEv.c create mode 100644 nx-X11/lib/src/ChkTypEv.c create mode 100644 nx-X11/lib/src/ChkTypWEv.c create mode 100644 nx-X11/lib/src/ChkWinEv.c create mode 100644 nx-X11/lib/src/CirWin.c create mode 100644 nx-X11/lib/src/CirWinDn.c create mode 100644 nx-X11/lib/src/CirWinUp.c create mode 100644 nx-X11/lib/src/ClDisplay.c create mode 100644 nx-X11/lib/src/Clear.c create mode 100644 nx-X11/lib/src/ClearArea.c create mode 100644 nx-X11/lib/src/Cmap.h create mode 100644 nx-X11/lib/src/ConfWind.c create mode 100644 nx-X11/lib/src/ConnDis.c create mode 100644 nx-X11/lib/src/Context.c create mode 100644 nx-X11/lib/src/ConvSel.c create mode 100644 nx-X11/lib/src/CopyArea.c create mode 100644 nx-X11/lib/src/CopyCmap.c create mode 100644 nx-X11/lib/src/CopyGC.c create mode 100644 nx-X11/lib/src/CopyPlane.c create mode 100644 nx-X11/lib/src/Cr.h create mode 100644 nx-X11/lib/src/CrBFData.c create mode 100644 nx-X11/lib/src/CrCmap.c create mode 100644 nx-X11/lib/src/CrCursor.c create mode 100644 nx-X11/lib/src/CrGC.c create mode 100644 nx-X11/lib/src/CrGlCur.c create mode 100644 nx-X11/lib/src/CrPFBData.c create mode 100644 nx-X11/lib/src/CrPixmap.c create mode 100644 nx-X11/lib/src/CrWindow.c create mode 100644 nx-X11/lib/src/Cursor.c create mode 100644 nx-X11/lib/src/DefCursor.c create mode 100644 nx-X11/lib/src/DelProp.c create mode 100644 nx-X11/lib/src/Depths.c create mode 100644 nx-X11/lib/src/DestSubs.c create mode 100644 nx-X11/lib/src/DestWind.c create mode 100644 nx-X11/lib/src/DisName.c create mode 100644 nx-X11/lib/src/DrArc.c create mode 100644 nx-X11/lib/src/DrArcs.c create mode 100644 nx-X11/lib/src/DrLine.c create mode 100644 nx-X11/lib/src/DrLines.c create mode 100644 nx-X11/lib/src/DrPoint.c create mode 100644 nx-X11/lib/src/DrPoints.c create mode 100644 nx-X11/lib/src/DrRect.c create mode 100644 nx-X11/lib/src/DrRects.c create mode 100644 nx-X11/lib/src/DrSegs.c create mode 100644 nx-X11/lib/src/ErrDes.c create mode 100644 nx-X11/lib/src/ErrHndlr.c create mode 100644 nx-X11/lib/src/EvToWire.c create mode 100644 nx-X11/lib/src/FSSaver.c create mode 100644 nx-X11/lib/src/FSWrap.c create mode 100644 nx-X11/lib/src/FetchName.c create mode 100644 nx-X11/lib/src/FillArc.c create mode 100644 nx-X11/lib/src/FillArcs.c create mode 100644 nx-X11/lib/src/FillPoly.c create mode 100644 nx-X11/lib/src/FillRct.c create mode 100644 nx-X11/lib/src/FillRcts.c create mode 100644 nx-X11/lib/src/FilterEv.c create mode 100644 nx-X11/lib/src/Flush.c create mode 100644 nx-X11/lib/src/Font.c create mode 100644 nx-X11/lib/src/FontInfo.c create mode 100644 nx-X11/lib/src/FontNames.c create mode 100644 nx-X11/lib/src/FreeCmap.c create mode 100644 nx-X11/lib/src/FreeCols.c create mode 100644 nx-X11/lib/src/FreeCurs.c create mode 100644 nx-X11/lib/src/FreeEData.c create mode 100644 nx-X11/lib/src/FreeEventData.c create mode 100644 nx-X11/lib/src/FreeGC.c create mode 100644 nx-X11/lib/src/FreePix.c create mode 100644 nx-X11/lib/src/GCMisc.c create mode 100644 nx-X11/lib/src/Geom.c create mode 100644 nx-X11/lib/src/GetAtomNm.c create mode 100644 nx-X11/lib/src/GetColor.c create mode 100644 nx-X11/lib/src/GetDflt.c create mode 100644 nx-X11/lib/src/GetEventData.c create mode 100644 nx-X11/lib/src/GetFPath.c create mode 100644 nx-X11/lib/src/GetFProp.c create mode 100644 nx-X11/lib/src/GetGCVals.c create mode 100644 nx-X11/lib/src/GetGeom.c create mode 100644 nx-X11/lib/src/GetHColor.c create mode 100644 nx-X11/lib/src/GetHints.c create mode 100644 nx-X11/lib/src/GetIFocus.c create mode 100644 nx-X11/lib/src/GetImage.c create mode 100644 nx-X11/lib/src/GetKCnt.c create mode 100644 nx-X11/lib/src/GetMoEv.c create mode 100644 nx-X11/lib/src/GetNrmHint.c create mode 100644 nx-X11/lib/src/GetPCnt.c create mode 100644 nx-X11/lib/src/GetPntMap.c create mode 100644 nx-X11/lib/src/GetProp.c create mode 100644 nx-X11/lib/src/GetRGBCMap.c create mode 100644 nx-X11/lib/src/GetSOwner.c create mode 100644 nx-X11/lib/src/GetSSaver.c create mode 100644 nx-X11/lib/src/GetStCmap.c create mode 100644 nx-X11/lib/src/GetTxtProp.c create mode 100644 nx-X11/lib/src/GetWAttrs.c create mode 100644 nx-X11/lib/src/GetWMCMapW.c create mode 100644 nx-X11/lib/src/GetWMProto.c create mode 100644 nx-X11/lib/src/GrButton.c create mode 100644 nx-X11/lib/src/GrKey.c create mode 100644 nx-X11/lib/src/GrKeybd.c create mode 100644 nx-X11/lib/src/GrPointer.c create mode 100644 nx-X11/lib/src/GrServer.c create mode 100644 nx-X11/lib/src/Host.c create mode 100644 nx-X11/lib/src/Iconify.c create mode 100644 nx-X11/lib/src/IfEvent.c create mode 100644 nx-X11/lib/src/ImText.c create mode 100644 nx-X11/lib/src/ImText16.c create mode 100644 nx-X11/lib/src/ImUtil.c create mode 100644 nx-X11/lib/src/InitExt.c create mode 100644 nx-X11/lib/src/InsCmap.c create mode 100644 nx-X11/lib/src/IntAtom.c create mode 100644 nx-X11/lib/src/Key.h create mode 100644 nx-X11/lib/src/KeyBind.c create mode 100644 nx-X11/lib/src/KeysymStr.c create mode 100644 nx-X11/lib/src/KillCl.c create mode 100644 nx-X11/lib/src/LiHosts.c create mode 100644 nx-X11/lib/src/LiICmaps.c create mode 100644 nx-X11/lib/src/LiProps.c create mode 100644 nx-X11/lib/src/ListExt.c create mode 100644 nx-X11/lib/src/LoadFont.c create mode 100644 nx-X11/lib/src/LockDis.c create mode 100644 nx-X11/lib/src/LookupCol.c create mode 100644 nx-X11/lib/src/LowerWin.c create mode 100644 nx-X11/lib/src/Macros.c create mode 100644 nx-X11/lib/src/Makefile.am create mode 100644 nx-X11/lib/src/MapRaised.c create mode 100644 nx-X11/lib/src/MapSubs.c create mode 100644 nx-X11/lib/src/MapWindow.c create mode 100644 nx-X11/lib/src/MaskEvent.c create mode 100644 nx-X11/lib/src/Misc.c create mode 100644 nx-X11/lib/src/ModMap.c create mode 100644 nx-X11/lib/src/MoveWin.c create mode 100644 nx-X11/lib/src/NextEvent.c create mode 100644 nx-X11/lib/src/OCWrap.c create mode 100644 nx-X11/lib/src/OMWrap.c create mode 100644 nx-X11/lib/src/OpenDis.c create mode 100644 nx-X11/lib/src/ParseCmd.c create mode 100644 nx-X11/lib/src/ParseCol.c create mode 100644 nx-X11/lib/src/ParseGeom.c create mode 100644 nx-X11/lib/src/PeekEvent.c create mode 100644 nx-X11/lib/src/PeekIfEv.c create mode 100644 nx-X11/lib/src/Pending.c create mode 100644 nx-X11/lib/src/PixFormats.c create mode 100644 nx-X11/lib/src/PmapBgnd.c create mode 100644 nx-X11/lib/src/PmapBord.c create mode 100644 nx-X11/lib/src/PolyReg.c create mode 100644 nx-X11/lib/src/PolyTxt.c create mode 100644 nx-X11/lib/src/PolyTxt16.c create mode 100644 nx-X11/lib/src/PropAlloc.c create mode 100644 nx-X11/lib/src/PutBEvent.c create mode 100644 nx-X11/lib/src/PutImage.c create mode 100644 nx-X11/lib/src/QuBest.c create mode 100644 nx-X11/lib/src/QuColor.c create mode 100644 nx-X11/lib/src/QuColors.c create mode 100644 nx-X11/lib/src/QuCurShp.c create mode 100644 nx-X11/lib/src/QuExt.c create mode 100644 nx-X11/lib/src/QuKeybd.c create mode 100644 nx-X11/lib/src/QuPntr.c create mode 100644 nx-X11/lib/src/QuStipShp.c create mode 100644 nx-X11/lib/src/QuTextE16.c create mode 100644 nx-X11/lib/src/QuTextExt.c create mode 100644 nx-X11/lib/src/QuTileShp.c create mode 100644 nx-X11/lib/src/QuTree.c create mode 100644 nx-X11/lib/src/Quarks.c create mode 100644 nx-X11/lib/src/RaiseWin.c create mode 100644 nx-X11/lib/src/RdBitF.c create mode 100644 nx-X11/lib/src/RecolorC.c create mode 100644 nx-X11/lib/src/ReconfWM.c create mode 100644 nx-X11/lib/src/ReconfWin.c create mode 100644 nx-X11/lib/src/Region.c create mode 100644 nx-X11/lib/src/RegstFlt.c create mode 100644 nx-X11/lib/src/RepWindow.c create mode 100644 nx-X11/lib/src/RestackWs.c create mode 100644 nx-X11/lib/src/RotProp.c create mode 100644 nx-X11/lib/src/ScrResStr.c create mode 100644 nx-X11/lib/src/SelInput.c create mode 100644 nx-X11/lib/src/SendEvent.c create mode 100644 nx-X11/lib/src/SetBack.c create mode 100644 nx-X11/lib/src/SetCRects.c create mode 100644 nx-X11/lib/src/SetClMask.c create mode 100644 nx-X11/lib/src/SetClOrig.c create mode 100644 nx-X11/lib/src/SetDashes.c create mode 100644 nx-X11/lib/src/SetFPath.c create mode 100644 nx-X11/lib/src/SetFont.c create mode 100644 nx-X11/lib/src/SetFore.c create mode 100644 nx-X11/lib/src/SetFunc.c create mode 100644 nx-X11/lib/src/SetHints.c create mode 100644 nx-X11/lib/src/SetIFocus.c create mode 100644 nx-X11/lib/src/SetLStyle.c create mode 100644 nx-X11/lib/src/SetLocale.c create mode 100644 nx-X11/lib/src/SetNrmHint.c create mode 100644 nx-X11/lib/src/SetPMask.c create mode 100644 nx-X11/lib/src/SetPntMap.c create mode 100644 nx-X11/lib/src/SetRGBCMap.c create mode 100644 nx-X11/lib/src/SetSOwner.c create mode 100644 nx-X11/lib/src/SetSSaver.c create mode 100644 nx-X11/lib/src/SetStCmap.c create mode 100644 nx-X11/lib/src/SetState.c create mode 100644 nx-X11/lib/src/SetStip.c create mode 100644 nx-X11/lib/src/SetTSOrig.c create mode 100644 nx-X11/lib/src/SetTile.c create mode 100644 nx-X11/lib/src/SetTxtProp.c create mode 100644 nx-X11/lib/src/SetWMCMapW.c create mode 100644 nx-X11/lib/src/SetWMProto.c create mode 100644 nx-X11/lib/src/StBytes.c create mode 100644 nx-X11/lib/src/StColor.c create mode 100644 nx-X11/lib/src/StColors.c create mode 100644 nx-X11/lib/src/StNColor.c create mode 100644 nx-X11/lib/src/StName.c create mode 100644 nx-X11/lib/src/StrKeysym.c create mode 100644 nx-X11/lib/src/StrToText.c create mode 100644 nx-X11/lib/src/Sync.c create mode 100644 nx-X11/lib/src/Synchro.c create mode 100644 nx-X11/lib/src/Text.c create mode 100644 nx-X11/lib/src/Text16.c create mode 100644 nx-X11/lib/src/TextExt.c create mode 100644 nx-X11/lib/src/TextExt16.c create mode 100644 nx-X11/lib/src/TextToStr.c create mode 100644 nx-X11/lib/src/TrCoords.c create mode 100644 nx-X11/lib/src/UIThrStubs.c create mode 100644 nx-X11/lib/src/UndefCurs.c create mode 100644 nx-X11/lib/src/UngrabBut.c create mode 100644 nx-X11/lib/src/UngrabKbd.c create mode 100644 nx-X11/lib/src/UngrabKey.c create mode 100644 nx-X11/lib/src/UngrabPtr.c create mode 100644 nx-X11/lib/src/UngrabSvr.c create mode 100644 nx-X11/lib/src/UninsCmap.c create mode 100644 nx-X11/lib/src/UnldFont.c create mode 100644 nx-X11/lib/src/UnmapSubs.c create mode 100644 nx-X11/lib/src/UnmapWin.c create mode 100644 nx-X11/lib/src/VisUtil.c create mode 100644 nx-X11/lib/src/WMGeom.c create mode 100644 nx-X11/lib/src/WMProps.c create mode 100644 nx-X11/lib/src/WarpPtr.c create mode 100644 nx-X11/lib/src/WinEvent.c create mode 100644 nx-X11/lib/src/Window.c create mode 100644 nx-X11/lib/src/Withdraw.c create mode 100644 nx-X11/lib/src/WrBitF.c create mode 100644 nx-X11/lib/src/XErrorDB create mode 100644 nx-X11/lib/src/Xatomtype.h create mode 100644 nx-X11/lib/src/Xintatom.h create mode 100644 nx-X11/lib/src/Xintconn.h create mode 100644 nx-X11/lib/src/XlibAsync.c create mode 100644 nx-X11/lib/src/XlibInt.c create mode 100644 nx-X11/lib/src/XomGeneric.h create mode 100644 nx-X11/lib/src/Xprivate.h create mode 100644 nx-X11/lib/src/Xresinternal.h create mode 100644 nx-X11/lib/src/Xrm.c create mode 100644 nx-X11/lib/src/evtomask.c create mode 100644 nx-X11/lib/src/globals.c create mode 100644 nx-X11/lib/src/imConv.c create mode 100644 nx-X11/lib/src/locking.c create mode 100644 nx-X11/lib/src/locking.h create mode 100644 nx-X11/lib/src/pathmax.h create mode 100644 nx-X11/lib/src/poly.h create mode 100644 nx-X11/lib/src/util/Makefile.am create mode 100644 nx-X11/lib/src/util/makekeys.c create mode 100644 nx-X11/lib/src/util/mkks.sh create mode 100644 nx-X11/lib/src/utlist.h create mode 100644 nx-X11/lib/src/x11_trans.c create mode 100644 nx-X11/lib/src/xcms/AddDIC.c create mode 100644 nx-X11/lib/src/xcms/AddSF.c create mode 100644 nx-X11/lib/src/xcms/CCC.c create mode 100644 nx-X11/lib/src/xcms/Cv.h create mode 100644 nx-X11/lib/src/xcms/CvColW.c create mode 100644 nx-X11/lib/src/xcms/CvCols.c create mode 100644 nx-X11/lib/src/xcms/HVC.c create mode 100644 nx-X11/lib/src/xcms/HVCGcC.c create mode 100644 nx-X11/lib/src/xcms/HVCGcV.c create mode 100644 nx-X11/lib/src/xcms/HVCGcVC.c create mode 100644 nx-X11/lib/src/xcms/HVCMnV.c create mode 100644 nx-X11/lib/src/xcms/HVCMxC.c create mode 100644 nx-X11/lib/src/xcms/HVCMxV.c create mode 100644 nx-X11/lib/src/xcms/HVCMxVC.c create mode 100644 nx-X11/lib/src/xcms/HVCMxVs.c create mode 100644 nx-X11/lib/src/xcms/HVCWpAj.c create mode 100644 nx-X11/lib/src/xcms/IdOfPr.c create mode 100644 nx-X11/lib/src/xcms/LRGB.c create mode 100644 nx-X11/lib/src/xcms/Lab.c create mode 100644 nx-X11/lib/src/xcms/LabGcC.c create mode 100644 nx-X11/lib/src/xcms/LabGcL.c create mode 100644 nx-X11/lib/src/xcms/LabGcLC.c create mode 100644 nx-X11/lib/src/xcms/LabMnL.c create mode 100644 nx-X11/lib/src/xcms/LabMxC.c create mode 100644 nx-X11/lib/src/xcms/LabMxL.c create mode 100644 nx-X11/lib/src/xcms/LabMxLC.c create mode 100644 nx-X11/lib/src/xcms/LabWpAj.c create mode 100644 nx-X11/lib/src/xcms/Luv.c create mode 100644 nx-X11/lib/src/xcms/LuvGcC.c create mode 100644 nx-X11/lib/src/xcms/LuvGcL.c create mode 100644 nx-X11/lib/src/xcms/LuvGcLC.c create mode 100644 nx-X11/lib/src/xcms/LuvMnL.c create mode 100644 nx-X11/lib/src/xcms/LuvMxC.c create mode 100644 nx-X11/lib/src/xcms/LuvMxL.c create mode 100644 nx-X11/lib/src/xcms/LuvMxLC.c create mode 100644 nx-X11/lib/src/xcms/LuvWpAj.c create mode 100644 nx-X11/lib/src/xcms/Makefile.am create mode 100644 nx-X11/lib/src/xcms/OfCCC.c create mode 100644 nx-X11/lib/src/xcms/PrOfId.c create mode 100644 nx-X11/lib/src/xcms/QBlack.c create mode 100644 nx-X11/lib/src/xcms/QBlue.c create mode 100644 nx-X11/lib/src/xcms/QGreen.c create mode 100644 nx-X11/lib/src/xcms/QRed.c create mode 100644 nx-X11/lib/src/xcms/QWhite.c create mode 100644 nx-X11/lib/src/xcms/QuCol.c create mode 100644 nx-X11/lib/src/xcms/QuCols.c create mode 100644 nx-X11/lib/src/xcms/SetCCC.c create mode 100644 nx-X11/lib/src/xcms/SetGetCols.c create mode 100644 nx-X11/lib/src/xcms/StCol.c create mode 100644 nx-X11/lib/src/xcms/StCols.c create mode 100644 nx-X11/lib/src/xcms/UNDEFINED.c create mode 100644 nx-X11/lib/src/xcms/XRGB.c create mode 100644 nx-X11/lib/src/xcms/XYZ.c create mode 100644 nx-X11/lib/src/xcms/Xcms.txt create mode 100644 nx-X11/lib/src/xcms/Xcmsint.h create mode 100644 nx-X11/lib/src/xcms/cmsAllCol.c create mode 100644 nx-X11/lib/src/xcms/cmsAllNCol.c create mode 100644 nx-X11/lib/src/xcms/cmsCmap.c create mode 100644 nx-X11/lib/src/xcms/cmsColNm.c create mode 100644 nx-X11/lib/src/xcms/cmsGlobls.c create mode 100644 nx-X11/lib/src/xcms/cmsInt.c create mode 100644 nx-X11/lib/src/xcms/cmsLkCol.c create mode 100644 nx-X11/lib/src/xcms/cmsMath.c create mode 100644 nx-X11/lib/src/xcms/cmsProp.c create mode 100644 nx-X11/lib/src/xcms/cmsTrig.c create mode 100644 nx-X11/lib/src/xcms/uvY.c create mode 100644 nx-X11/lib/src/xcms/xyY.c create mode 100644 nx-X11/lib/src/xkb/Makefile.am create mode 100644 nx-X11/lib/src/xkb/XKB.c create mode 100644 nx-X11/lib/src/xkb/XKBAlloc.c create mode 100644 nx-X11/lib/src/xkb/XKBBell.c create mode 100644 nx-X11/lib/src/xkb/XKBBind.c create mode 100644 nx-X11/lib/src/xkb/XKBCompat.c create mode 100644 nx-X11/lib/src/xkb/XKBCtrls.c create mode 100644 nx-X11/lib/src/xkb/XKBCvt.c create mode 100644 nx-X11/lib/src/xkb/XKBExtDev.c create mode 100644 nx-X11/lib/src/xkb/XKBGAlloc.c create mode 100644 nx-X11/lib/src/xkb/XKBGeom.c create mode 100644 nx-X11/lib/src/xkb/XKBGetByName.c create mode 100644 nx-X11/lib/src/xkb/XKBGetMap.c create mode 100644 nx-X11/lib/src/xkb/XKBList.c create mode 100644 nx-X11/lib/src/xkb/XKBMAlloc.c create mode 100644 nx-X11/lib/src/xkb/XKBMisc.c create mode 100644 nx-X11/lib/src/xkb/XKBNames.c create mode 100644 nx-X11/lib/src/xkb/XKBRdBuf.c create mode 100644 nx-X11/lib/src/xkb/XKBSetGeom.c create mode 100644 nx-X11/lib/src/xkb/XKBSetMap.c create mode 100644 nx-X11/lib/src/xkb/XKBUse.c create mode 100644 nx-X11/lib/src/xkb/XKBleds.c create mode 100644 nx-X11/lib/src/xkb/XKBlibint.h create mode 100644 nx-X11/lib/src/xlibi18n/ICWrap.c create mode 100644 nx-X11/lib/src/xlibi18n/IMWrap.c create mode 100644 nx-X11/lib/src/xlibi18n/Makefile.am create mode 100644 nx-X11/lib/src/xlibi18n/XimImSw.h create mode 100644 nx-X11/lib/src/xlibi18n/XimProto.h create mode 100644 nx-X11/lib/src/xlibi18n/XimThai.h create mode 100644 nx-X11/lib/src/xlibi18n/XimTrInt.h create mode 100644 nx-X11/lib/src/xlibi18n/XimTrX.h create mode 100644 nx-X11/lib/src/xlibi18n/XimTrans.h create mode 100644 nx-X11/lib/src/xlibi18n/Ximint.h create mode 100644 nx-X11/lib/src/xlibi18n/XimintL.h create mode 100644 nx-X11/lib/src/xlibi18n/XimintP.h create mode 100644 nx-X11/lib/src/xlibi18n/XlcGeneric.h create mode 100644 nx-X11/lib/src/xlibi18n/XlcPubI.h create mode 100644 nx-X11/lib/src/xlibi18n/XlcPublic.h create mode 100644 nx-X11/lib/src/xlibi18n/Xlcint.h create mode 100644 nx-X11/lib/src/xlibi18n/imKStoUCS.c create mode 100644 nx-X11/lib/src/xlibi18n/lcCT.c create mode 100644 nx-X11/lib/src/xlibi18n/lcCharSet.c create mode 100644 nx-X11/lib/src/xlibi18n/lcConv.c create mode 100644 nx-X11/lib/src/xlibi18n/lcDB.c create mode 100644 nx-X11/lib/src/xlibi18n/lcFile.c create mode 100644 nx-X11/lib/src/xlibi18n/lcGeneric.c create mode 100644 nx-X11/lib/src/xlibi18n/lcInit.c create mode 100644 nx-X11/lib/src/xlibi18n/lcPrTxt.c create mode 100644 nx-X11/lib/src/xlibi18n/lcPubWrap.c create mode 100644 nx-X11/lib/src/xlibi18n/lcPublic.c create mode 100644 nx-X11/lib/src/xlibi18n/lcRM.c create mode 100644 nx-X11/lib/src/xlibi18n/lcStd.c create mode 100644 nx-X11/lib/src/xlibi18n/lcTxtPr.c create mode 100644 nx-X11/lib/src/xlibi18n/lcUTF8.c create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/armscii_8.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/big5.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/big5_emacs.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/big5hkscs.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/cp1133.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/cp1251.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/cp1255.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/cp1256.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/gb2312.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/gbk.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/georgian_academy.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/georgian_ps.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_1.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_10.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_11.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_13.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_14.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_16.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_2.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_3.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_4.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_5.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_6.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_7.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_8.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9e.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/jisx0201.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/jisx0208.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/jisx0212.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/koi8_c.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/koi8_r.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/koi8_u.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/ksc5601.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/mulelao.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/tatar_cyr.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/tcvn.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/tis620.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/ucs2be.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/utf8.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUniConv/viscii.h create mode 100644 nx-X11/lib/src/xlibi18n/lcUtil.c create mode 100644 nx-X11/lib/src/xlibi18n/lcWrap.c create mode 100644 nx-X11/lib/src/xlibi18n/mbWMProps.c create mode 100644 nx-X11/lib/src/xlibi18n/mbWrap.c create mode 100644 nx-X11/lib/src/xlibi18n/utf8WMProps.c create mode 100644 nx-X11/lib/src/xlibi18n/utf8Wrap.c create mode 100644 nx-X11/lib/src/xlibi18n/wcWrap.c create mode 100644 nx-X11/lib/src/xlibi18n/xim_trans.c delete mode 100644 nx-X11/lib/xtrans/Imakefile delete mode 100644 nx-X11/lib/xtrans/Xtrans.c delete mode 100644 nx-X11/lib/xtrans/Xtrans.h delete mode 100644 nx-X11/lib/xtrans/Xtransint.h delete mode 100644 nx-X11/lib/xtrans/Xtranslcl.c delete mode 100644 nx-X11/lib/xtrans/Xtranssock.c delete mode 100644 nx-X11/lib/xtrans/Xtransutil.c delete mode 100644 nx-X11/lib/xtrans/transport.c (limited to 'Makefile') diff --git a/Makefile b/Makefile index 2b4e5dfbd..906b3715e 100644 --- a/Makefile +++ b/Makefile @@ -1,11 +1,17 @@ #!/usr/bin/make -f +NULL = + +# helpers for "install" target INSTALL_DIR=install -d -m 755 INSTALL_FILE=install -m 644 INSTALL_PROGRAM=install -m 755 INSTALL_SYMLINK=ln -s -f -COPY_SYMLINK=cp -a -COPY_DEREFERENCED=cp -RH + +# helpers for "build" target +SYMLINK_FILE=ln -f -s + +# helpers for "clean" and "uninstall" targets RM_FILE=rm -f RM_DIR=rmdir -p --ignore-fail-on-non-empty @@ -30,22 +36,48 @@ NX_VERSION_PATCH=$(shell ./version.sh 4) SHELL:=/bin/bash +NX_X11_HEADERS = \ + Xlib.h \ + Xresource.h \ + Xutil.h \ + cursorfont.h \ + Xlibint.h \ + Xcms.h \ + Xlocale.h \ + XKBlib.h \ + XlibConf.h \ + Xregion.h \ + ImUtil.h \ + $(NULL) + +NX_XTRANS_HEADERS = \ + transport.c \ + Xtrans.c \ + Xtrans.h \ + Xtransint.h \ + Xtranslcl.c \ + Xtranssock.c \ + Xtransutil.c \ + $(NULL) + %: if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi if test -d nx-X11; then \ + if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib $@; fi; \ if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ fi # clean auto-generated files if [ "x$@" == "xclean" ] || [ "x$@" = "xdistclean" ]; then \ - ./mesa-quilt pop -a; \ + if [ -x ./mesa-quilt ]; then ./mesa-quilt pop -a; fi; \ rm -Rf nx-X11/extras/Mesa/.pc/; \ rm -f nx-X11/config/cf/nxversion.def; \ rm -f nx-X11/config/cf/date.def; \ rm -f bin/nxagent; \ rm -f bin/nxproxy; \ + ${MAKE} clean-env; \ fi all: @@ -54,7 +86,7 @@ all: test: echo "No testing for NX (redistributed)" -build-env: +version: # prepare nx-X11/config/cf/nxversion.def sed \ -e 's/###NX_VERSION_MAJOR###/$(NX_VERSION_MAJOR)/' \ @@ -64,8 +96,34 @@ build-env: nx-X11/config/cf/nxversion.def.in \ > nx-X11/config/cf/nxversion.def +build-env: version # prepare Makefiles and the nx-X11 symlinking magic - cd nx-X11 && make BuildEnv FONT_DEFINES=$(FONT_DEFINES) + ${MAKE} -C nx-X11 BuildIncludes FONT_DEFINES=$(FONT_DEFINES) + + # set up environment for libNX_X11 build (X11 header files) + mkdir -p nx-X11/exports/include/nx-X11/ + for header in $(NX_X11_HEADERS); do \ + ${SYMLINK_FILE} ../../../lib/include/X11/$${header} nx-X11/exports/include/nx-X11/$${header}; \ + done + + # set up environment for libNX_X11 build (Xtrans header/include files) + mkdir -p nx-X11/exports/include/nx-X11/Xtrans/ + for header in $(NX_XTRANS_HEADERS); do \ + ${SYMLINK_FILE} ../../../../lib/include/xtrans/$${header} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \ + done + +clean-env: version + for header in $(NX_X11_HEADERS); do \ + ${RM_FILE} nx-X11/exports/include/nx-X11/$${header}; \ + done + for header in $(NX_XTRANS_HEADERS); do \ + ${RM_FILE} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \ + done + + -rmdir exports/include/nx-X11/Xtrans/ + -rmdir exports/include/nx-X11/ + + ${MAKE} -C nx-X11 CleanEnv FONT_DEFINES=$(FONT_DEFINES) build-lite: cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} @@ -73,17 +131,26 @@ build-lite: build-full: build-env # in the full case, we rely on "magic" in the nx-X11 imake-based makefiles... + + # build nxcomp first cd nxcomp && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} - # build libNX_X11 and libNX_Xext prior to building - # nxcomp{ext,shad}. - cd nx-X11/lib && make + # build libNX_X11 second + cd nx-X11/lib && autoreconf -vfsi && (${CONFIGURE} --disable-poll) && ${MAKE} + mkdir -p nx-X11/exports/lib/ + $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so nx-X11/exports/lib/libNX_X11.so + $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6 nx-X11/exports/lib/libNX_X11.so.6 + $(SYMLINK_FILE) ../../lib/src/.libs/libNX_X11.so.6.3.0 nx-X11/exports/lib/libNX_X11.so.6.3.0 + + # build nxcompshad third cd nxcompshad && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} + # build nxagent fourth ./mesa-quilt push -a + ${MAKE} -C nx-X11 BuildDependsOnly FONT_DEFINES=$(FONT_DEFINES) + ${MAKE} -C nx-X11 World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB) - cd nx-X11 && ${MAKE} World USRLIBDIR=$(USRLIBDIR) SHLIBDIR=$(SHLIBDIR) FONT_DEFINES=$(FONT_DEFINES) XFONTLIB=$(XFONTLIB) - + # build nxproxy fifth cd nxproxy && autoreconf -vfsi && (${CONFIGURE}) && ${MAKE} build: @@ -149,12 +216,9 @@ install-full: done; $(INSTALL_DIR) $(DESTDIR)$(SHLIBDIR) - $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so $(DESTDIR)$(SHLIBDIR)/ - $(COPY_SYMLINK) nx-X11/.build-exports/lib/libNX_X11.so.6 $(DESTDIR)$(SHLIBDIR)/ - $(COPY_DEREFERENCED) nx-X11/.build-exports/lib/libNX_X11.so.6.2 $(DESTDIR)$(SHLIBDIR)/ $(INSTALL_DIR) $(DESTDIR)$(USRLIBDIR) $(INSTALL_SYMLINK) ../../libNX_X11.so.6 $(DESTDIR)$(USRLIBDIR)/libX11.so.6 - $(INSTALL_SYMLINK) ../../libNX_X11.so.6.2 $(DESTDIR)$(USRLIBDIR)/libX11.so.6.2 + $(INSTALL_SYMLINK) ../../libNX_X11.so.6.3.0 $(DESTDIR)$(USRLIBDIR)/libX11.so.6.3.0 . replace.sh; set -x; find nx-X11/.build-exports/include/{nx*,GL} -type d | \ while read dirname; do \ @@ -168,11 +232,11 @@ install-full: $(INSTALL_FILE) etc/nxagent.keyboard $(DESTDIR)$(ETCDIR_NX)/ $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx - $(INSTALL_FILE) nx-X11/lib/X11/XErrorDB $(DESTDIR)$(PREFIX)/share/nx/ - $(INSTALL_FILE) nx-X11/lib/X11/Xcms.txt $(DESTDIR)$(PREFIX)/share/nx/ $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(INSTALL_FILE) VERSION $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy + $(MAKE) -C nx-X11/lib install + uninstall: $(MAKE) uninstall-lite [ ! -d nx-X11 ] || $(MAKE) uninstall-full diff --git a/debian/libnx-x11-6.symbols b/debian/libnx-x11-6.symbols index 0724aac2f..2901c1d83 100644 --- a/debian/libnx-x11-6.symbols +++ b/debian/libnx-x11-6.symbols @@ -874,8 +874,8 @@ libNX_X11.so.6 libnx-x11-6 #MINVER# _XLockMutex_fn@Base 3.5.0.29 _XLookupKeysym@Base 3.5.0.29 _XLookupString@Base 3.5.0.29 - _XNoticeCreateBitmap@Base 3.5.0.29 - _XNoticePutBitmap@Base 3.5.0.29 +#MISSING: 3.5.99.9# _XNoticeCreateBitmap@Base 3.5.0.29 +#MISSING: 3.5.99.9# _XNoticePutBitmap@Base 3.5.0.29 _XOpenLC@Base 3.5.0.29 _XParseBaseFontNameList@Base 3.5.0.29 _XPollfdCacheAdd@Base 3.5.0.29 @@ -909,7 +909,7 @@ libNX_X11.so.6 libnx-x11-6 #MINVER# _XTextHeight@Base 3.5.0.29 _XTranslateKey@Base 3.5.0.29 _XTranslateKeySym@Base 3.5.0.29 - _XTryShapeBitmapCursor@Base 3.5.0.29 +#MISSING: 2:3.5.99.9# _XTryShapeBitmapCursor@Base 3.5.0.29 _XUnknownCopyEventCookie@Base 2:3.5.99.2 _XUnknownNativeEvent@Base 3.5.0.29 _XUnknownWireEvent@Base 3.5.0.29 diff --git a/debian/libnx-x11-dev.install b/debian/libnx-x11-dev.install index 5f9590cbc..169f0f6ef 100644 --- a/debian/libnx-x11-dev.install +++ b/debian/libnx-x11-dev.install @@ -1,4 +1,5 @@ usr/lib/*/libNX_X11.so +usr/lib/*/libNX_X11.a usr/include/*/nx-X11/ImUtil.h usr/include/*/nx-X11/Xauth.h usr/include/*/nx-X11/XKBlib.h @@ -13,3 +14,4 @@ usr/include/*/nx-X11/Xutil.h usr/include/*/nx-X11/cursorfont.h usr/include/*/nx-X11/misc.h usr/include/*/nx-X11/os.h +usr/lib/*/pkgconfig/nx-x11.pc diff --git a/debian/nx-x11-common.install b/debian/nx-x11-common.install index 00880c3d7..ad6c1ef74 100644 --- a/debian/nx-x11-common.install +++ b/debian/nx-x11-common.install @@ -1,3 +1,3 @@ usr/share/nx/SecurityPolicy -usr/share/nx/XErrorDB -usr/share/nx/Xcms.txt +usr/share/nx/X11/XErrorDB +usr/share/nx/X11/Xcms.txt diff --git a/debian/rules b/debian/rules index e0a6b952c..0ef8ab488 100755 --- a/debian/rules +++ b/debian/rules @@ -26,6 +26,7 @@ override_dh_install: # remove static libs rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcomp.la rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libXcompshad.la + rm debian/tmp/usr/lib/$(DEB_BUILD_MULTIARCH)/libNX_X11.la # remove extras, GL, and other unneeded headers rm -R debian/tmp/usr/include/$(DEB_BUILD_MULTIARCH)/GL/ diff --git a/m4/nx-macros.m4 b/m4/nx-macros.m4 index 61acfb58a..b40f628b0 100644 --- a/m4/nx-macros.m4 +++ b/m4/nx-macros.m4 @@ -304,6 +304,53 @@ m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])], [AC_SUBST([AM_DEFAULT_VERBOSITY], [1])]) ]) # NX_DEFAULT_OPTIONS +# NX_CHECK_MALLOC_ZERO +# ---------------------- +# Minimum version: 1.0.0 +# +# Defines {MALLOC,XMALLOC,XTMALLOC}_ZERO_CFLAGS appropriately if +# malloc(0) returns NULL. Packages should add one of these cflags to +# their AM_CFLAGS (or other appropriate *_CFLAGS) to use them. +AC_DEFUN([NX_CHECK_MALLOC_ZERO],[ +AC_ARG_ENABLE(malloc0returnsnull, + AS_HELP_STRING([--enable-malloc0returnsnull], + [malloc(0) returns NULL (default: auto)]), + [MALLOC_ZERO_RETURNS_NULL=$enableval], + [MALLOC_ZERO_RETURNS_NULL=auto]) + +AC_MSG_CHECKING([whether malloc(0) returns NULL]) +if test "x$MALLOC_ZERO_RETURNS_NULL" = xauto; then + AC_RUN_IFELSE([AC_LANG_PROGRAM([ +#include +],[ + char *m0, *r0, *c0, *p; + m0 = malloc(0); + p = malloc(10); + r0 = realloc(p,0); + c0 = calloc(0,10); + exit((m0 == 0 || r0 == 0 || c0 == 0) ? 0 : 1); +])], + [MALLOC_ZERO_RETURNS_NULL=yes], + [MALLOC_ZERO_RETURNS_NULL=no], + [MALLOC_ZERO_RETURNS_NULL=yes]) +fi +AC_MSG_RESULT([$MALLOC_ZERO_RETURNS_NULL]) + +if test "x$MALLOC_ZERO_RETURNS_NULL" = xyes; then + MALLOC_ZERO_CFLAGS="-DMALLOC_0_RETURNS_NULL" + XMALLOC_ZERO_CFLAGS=$MALLOC_ZERO_CFLAGS + XTMALLOC_ZERO_CFLAGS="$MALLOC_ZERO_CFLAGS -DXTMALLOC_BC" +else + MALLOC_ZERO_CFLAGS="" + XMALLOC_ZERO_CFLAGS="" + XTMALLOC_ZERO_CFLAGS="" +fi + +AC_SUBST([MALLOC_ZERO_CFLAGS]) +AC_SUBST([XMALLOC_ZERO_CFLAGS]) +AC_SUBST([XTMALLOC_ZERO_CFLAGS]) +]) # NX_CHECK_MALLOC_ZERO + dnl Check to see if we're running under Cygwin32. diff --git a/m4/nx-xtrans.m4 b/m4/nx-xtrans.m4 new file mode 100644 index 000000000..1ac7b0e75 --- /dev/null +++ b/m4/nx-xtrans.m4 @@ -0,0 +1,168 @@ +dnl +dnl Copyright (c) 2005, Oracle and/or its affiliates. All rights reserved. +dnl +dnl Permission is hereby granted, free of charge, to any person obtaining a +dnl copy of this software and associated documentation files (the "Software"), +dnl to deal in the Software without restriction, including without limitation +dnl the rights to use, copy, modify, merge, publish, distribute, sublicense, +dnl and/or sell copies of the Software, and to permit persons to whom the +dnl Software is furnished to do so, subject to the following conditions: +dnl +dnl The above copyright notice and this permission notice (including the next +dnl paragraph) shall be included in all copies or substantial portions of the +dnl Software. +dnl +dnl THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +dnl IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +dnl FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL +dnl THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +dnl LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING +dnl FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +dnl DEALINGS IN THE SOFTWARE. +dnl + +# NX_XTRANS_TCP_FLAGS() +# ------------------ +# Find needed libraries for TCP sockets, and check for IPv6 support +AC_DEFUN([NX_XTRANS_TCP_FLAGS],[ + # SVR4 hides these in libraries other than libc + AC_SEARCH_LIBS(socket, [socket]) + AC_SEARCH_LIBS(gethostbyname, [nsl]) + if test "$ac_cv_search_socket$ac_cv_search_gethostbyname" = "nono"; then + AC_CHECK_LIB([ws2_32],[main]) + fi + + # Needs to come after above checks for libsocket & libnsl for SVR4 systems + AC_ARG_ENABLE(ipv6, + AS_HELP_STRING([--enable-ipv6],[Enable IPv6 support]), + [IPV6CONN=$enableval], + [AC_CHECK_FUNC(getaddrinfo,[IPV6CONN=yes],[IPV6CONN=no])]) + AC_MSG_CHECKING([if IPv6 support should be built]) + if test "$IPV6CONN" = "yes"; then + AC_DEFINE(IPv6,1,[Support IPv6 for TCP connections]) + fi + AC_MSG_RESULT($IPV6CONN) + + # 4.3BSD-Reno added a new member to struct sockaddr_in + AC_CHECK_MEMBER([struct sockaddr_in.sin_len], + AC_DEFINE([BSD44SOCKETS],1, + [Define to 1 if `struct sockaddr_in' has a `sin_len' member]), [], [ +#include +#include +#include + ]) + + # POSIX.1g changed the type of pointer passed to getsockname/getpeername/etc. + AC_CHECK_TYPES([socklen_t], [], [], [ +AC_INCLUDES_DEFAULT +#include ]) + + # XPG4v2/UNIX95 added msg_control - check to see if we need to define + # _XOPEN_SOURCE to get it (such as on Solaris) + AC_CHECK_MEMBER([struct msghdr.msg_control], [], [], + [ +AC_INCLUDES_DEFAULT +#include + ]) + # First try for Solaris in C99 compliant mode, which requires XPG6/UNIX03 + if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then + unset ac_cv_member_struct_msghdr_msg_control + AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=600]) + AC_CHECK_MEMBER([struct msghdr.msg_control], + [AC_DEFINE([_XOPEN_SOURCE], [600], + [Defined if needed to expose struct msghdr.msg_control]) + ], [], [ +#define _XOPEN_SOURCE 600 +AC_INCLUDES_DEFAULT +#include + ]) + fi + # If that didn't work, fall back to XPG5/UNIX98 with C89 + if test "x$ac_cv_member_struct_msghdr_msg_control" = xno; then + unset ac_cv_member_struct_msghdr_msg_control + AC_MSG_NOTICE([trying again with _XOPEN_SOURCE=500]) + AC_CHECK_MEMBER([struct msghdr.msg_control], + [AC_DEFINE([_XOPEN_SOURCE], [500], + [Defined if needed to expose struct msghdr.msg_control]) + ], [], [ +#define _XOPEN_SOURCE 500 +AC_INCLUDES_DEFAULT +#include + ]) + fi + + +]) # NX_XTRANS_TCP_FLAGS + +# NX_XTRANS_CONNECTION_FLAGS() +# ------------------------- +# Standard checks for which Xtrans transports to use by the Xorg packages +# that use Xtrans functions +AC_DEFUN([NX_XTRANS_CONNECTION_FLAGS],[ + AC_REQUIRE([AC_CANONICAL_HOST]) + [case $host_os in + mingw*) unixdef="no" ;; + *) unixdef="yes" ;; + esac] + AC_ARG_ENABLE(unix-transport, + AS_HELP_STRING([--enable-unix-transport],[Enable UNIX domain socket transport]), + [UNIXCONN=$enableval], [UNIXCONN=$unixdef]) + AC_MSG_CHECKING([if Xtrans should support UNIX socket connections]) + if test "$UNIXCONN" = "yes"; then + AC_DEFINE(UNIXCONN,1,[Support UNIX socket connections]) + fi + AC_MSG_RESULT($UNIXCONN) + AC_ARG_ENABLE(tcp-transport, + AS_HELP_STRING([--enable-tcp-transport],[Enable TCP socket transport]), + [TCPCONN=$enableval], [TCPCONN=yes]) + AC_MSG_CHECKING([if Xtrans should support TCP socket connections]) + AC_MSG_RESULT($TCPCONN) + if test "$TCPCONN" = "yes"; then + AC_DEFINE(TCPCONN,1,[Support TCP socket connections]) + NX_XTRANS_TCP_FLAGS + fi + AC_ARG_ENABLE(nxcomp-transport, + AS_HELP_STRING([--enable-nxcomp-transport],[Enable nxcomp mediated transport]), + [NXCOMPCONN=$enableval], [NXCOMPCONN=yes]) + AC_MSG_CHECKING([if Xtrans should support nxcomp mediated connections]) + AC_MSG_RESULT($NXCOMPCONN) + if test "$NXCOMPCONN" = "yes"; then + AC_DEFINE(NX_TRANS_SOCKET,1,[Support nxcomp mediated socket connections]) + AC_DEFINE(NX_TRANS_EXIT,1,[Support nxcomp NX_TRANS_EXIT feature]) + NX_XTRANS_TCP_FLAGS + fi + +]) # NX_XTRANS_CONNECTION_FLAGS + + +# NX_XTRANS_SECURE_RPC_FLAGS() +# ------------------------- +# Check for Secure RPC functions - must come after NX_XTRANS_TCP_FLAGS +# so that any necessary networking libraries are already found +AC_DEFUN([NX_XTRANS_SECURE_RPC_FLAGS], +[AC_REQUIRE([NX_XTRANS_TCP_FLAGS]) + AC_ARG_ENABLE(secure-rpc, + AS_HELP_STRING([--enable-secure-rpc],[Enable Secure RPC]), + [SECURE_RPC=$enableval], [SECURE_RPC="try"]) + + if test "x$SECURE_RPC" = "xyes" -o "x$SECURE_RPC" = "xtry" ; then + FOUND_SECURE_RPC="no" + AC_CHECK_FUNCS([authdes_seccreate authdes_create], + [FOUND_SECURE_RPC="yes"]) + if test "x$FOUND_SECURE_RPC" = "xno" ; then + if test "x$SECURE_RPC" = "xyes" ; then + AC_MSG_ERROR([Secure RPC requested, but required functions not found]) + fi + SECURE_RPC="no" + else + dnl FreeBSD keeps getsecretkey in librpcsvc + AC_SEARCH_LIBS(getsecretkey, [rpcsvc]) + SECURE_RPC="yes" + fi + fi + AC_MSG_CHECKING([if Secure RPC authentication ("SUN-DES-1") should be supported]) + if test "x$SECURE_RPC" = "xyes" ; then + AC_DEFINE(SECURE_RPC, 1, [Support Secure RPC ("SUN-DES-1") authentication for X11 clients]) + fi + AC_MSG_RESULT($SECURE_RPC) +]) # NX_XTRANS_SECURE_RPC_FLAGS diff --git a/nx-X11/Imakefile b/nx-X11/Imakefile index 9c8eb5a04..b2874c3a8 100644 --- a/nx-X11/Imakefile +++ b/nx-X11/Imakefile @@ -27,8 +27,7 @@ RELEASE = XOrgReleaseString #define OSName Unknown Operating System! #endif - SUBDIRS = include config lib programs - LNINSTALLDIRS = lib + SUBDIRS = include config programs #if HasParallelMake #ifdef ParallelDefines @@ -38,10 +37,6 @@ RELEASE = XOrgReleaseString MakeSubdirs($(SUBDIRS)) -MakeLintSubdirs($(LNINSTALLDIRS),install.ln,install.ln) - -MakeLintSubdirs($(LNINSTALLDIRS),external.ln,lintlib) - DependSubdirs($(SUBDIRS)) #define IHaveSpecialMakefileTarget diff --git a/nx-X11/Makefile b/nx-X11/Makefile index bd3e284ae..5845a4c77 100644 --- a/nx-X11/Makefile +++ b/nx-X11/Makefile @@ -24,8 +24,8 @@ MAKE_OPTS = -f xmakefile MAKE_CMD = $(MAKE) $(MAKE_OPTS) all: - @${MAKE} ${MAKE_OPTS} xmakefile-exists || $(MAKE) all-initial - @${MAKE} ${MAKE_OPTS} $@ + @${MAKE_CMD} xmakefile-exists || $(MAKE) all-initial + @${MAKE_CMD} $@ all-initial: @echo Please use make World, or on NT use nmake World.Win32. @@ -40,27 +40,32 @@ World: @date @echo "" if [ ! -f xmakefile ]; then ${MAKE} ${MFLAGS} BuildEnv; fi - ${MAKE} ${MAKE_OPTS} $(MFLAGS) $(WORLDOPTS) World + ${MAKE_CMD} $(MFLAGS) $(WORLDOPTS) World @echo "" @date @echo "" @echo Full build of $(RELEASE) complete. @echo "" -BuildEnv: +CleanEnv: @if [ -f xmakefile ]; then \ - ${MAKE} ${MAKE_OPTS} -k distclean || \ - ${MAKE} ${MAKE_OPTS} -k clean || \ + ${MAKE_CMD} -k distclean || \ + ${MAKE_CMD} -k clean || \ $(RM) xmakefile; \ fi @rm -f $(IRULESRC)/date.def; echo "" > $(IRULESRC)/date.def; ${MAKE} $(MFLAGS) xmakefile - ${MAKE} ${MAKE_OPTS} $(MFLAGS) VerifyOS - ${MAKE} ${MAKE_OPTS} $(MFLAGS) Makefiles - ${MAKE} ${MAKE_OPTS} $(MFLAGS) BOOTSTRAPSUBDIRS= clean - ${MAKE} ${MAKE_OPTS} $(MFLAGS) includes - ${MAKE} ${MAKE_OPTS} $(MFLAGS) depend + ${MAKE_CMD} $(MFLAGS) VerifyOS + ${MAKE_CMD} $(MFLAGS) Makefiles + ${MAKE_CMD} $(MFLAGS) BOOTSTRAPSUBDIRS= clean +BuildEnv: CleanEnv BuildIncludes BuildDependsOnly + +BuildIncludes: CleanEnv + ${MAKE_CMD} $(MFLAGS) includes + +BuildDependsOnly: + ${MAKE_CMD} $(MFLAGS) depend .PRECIOUS: Makefile @@ -86,37 +91,35 @@ xmakefile: Imakefile # a copy of every rule that might be invoked at top level clean: - -${MAKE_CMD} ${MAKE_OPTS} $@ - find config -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done - find lib -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done - find programs -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done - find include -type f | egrep '.*/Makefile$$' | while read makefile; do rm -f $$makefile; done + -${MAKE_CMD} $@ + find config lib programs include -type f -name Makefile | while read makefile; do rm -f $$makefile; done + dangerous_strip_clean: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ distclean: - -${MAKE} ${MAKE_OPTS} $@ + -${MAKE_CMD} $@ $(RM) xmakefile depend: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ Everything: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ external.ln: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ includes: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ install.sdk: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ install.ln: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ install.man: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ install: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ Makefiles: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ man_keywords: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ tags: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ VerifyOS: - ${MAKE} ${MAKE_OPTS} $@ + ${MAKE_CMD} $@ diff --git a/nx-X11/lib/Imakefile b/nx-X11/lib/Imakefile deleted file mode 100644 index 1d11c977b..000000000 --- a/nx-X11/lib/Imakefile +++ /dev/null @@ -1,19 +0,0 @@ -#define IHaveSubdirs -#define PassCDebugFlags - -NULL = - -#if BuildX11Lib -X11LIBDIR = X11 -#endif - -LINTSUBDIRS = \ - $(X11LIBDIR) \ - $(NULL) - -SUBDIRS = xtrans $(LINTSUBDIRS) - -MakeSubdirs($(SUBDIRS)) -DependSubdirs($(SUBDIRS)) -MakeLintLibSubdirs($(LINTSUBDIRS)) -MakeLintSubdirs($(LINTSUBDIRS),install.ln,install.ln) diff --git a/nx-X11/lib/Makefile.am b/nx-X11/lib/Makefile.am new file mode 100644 index 000000000..1d8eb3ada --- /dev/null +++ b/nx-X11/lib/Makefile.am @@ -0,0 +1,37 @@ +NULL = + +SUBDIRS = modules src + +pkgconfig_DATA = nx-x11.pc + +MAINTAINERCLEANFILES = \ + $(srcdir)/autom4te.cache/* \ + $(srcdir)/build-aux/* \ + $(srcdir)/Makefile.in \ + $(srcdir)/src/Makefile.in \ + $(srcdir)/src/xkb/Makefile.in \ + $(srcdir)/src/util/Makefile.in \ + $(srcdir)/src/xcms/Makefile.in \ + $(srcdir)/src/xlibi18n/Makefile.in \ + $(srcdir)/modules/om/generic/Makefile.in \ + $(srcdir)/modules/om/Makefile.in \ + $(srcdir)/modules/Makefile.in \ + $(srcdir)/modules/im/ximcp/Makefile.in \ + $(srcdir)/modules/im/Makefile.in \ + $(srcdir)/modules/lc/Makefile.in \ + $(srcdir)/modules/lc/gen/Makefile.in \ + $(srcdir)/modules/lc/def/Makefile.in \ + $(srcdir)/modules/lc/Utf8/Makefile.in \ + $(srcdir)/include/Makefile.in \ + $(srcdir)/aclocal.m4 \ + $(srcdir)/src/config.h.in \ + $(srcdir)/src/config.h.in~ \ + $(srcdir)/configure \ + $(srcdir)/m4/libtool.m4 \ + $(srcdir)/m4/lt~obsolete.m4 \ + $(srcdir)/m4/ltoptions.m4 \ + $(srcdir)/m4/ltsugar.m4 \ + $(srcdir)/m4/ltversion.m4 \ + $(NULL) + +DISTCLEANFILES=$(MAINTAINERCLEANFILES) diff --git a/nx-X11/lib/X11/.gitignore b/nx-X11/lib/X11/.gitignore deleted file mode 100644 index 8215e21de..000000000 --- a/nx-X11/lib/X11/.gitignore +++ /dev/null @@ -1 +0,0 @@ -ks_tables.h \ No newline at end of file diff --git a/nx-X11/lib/X11/AddDIC.c b/nx-X11/lib/X11/AddDIC.c deleted file mode 100644 index ecc6650ab..000000000 --- a/nx-X11/lib/X11/AddDIC.c +++ /dev/null @@ -1,149 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsAddDIC.c - * - * DESCRIPTION - * Source for XcmsAddColorSpace - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/* - * DEFINES - */ -#define NextUnregDiCsID(lastid) \ - (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DI_ID) -#define MAX(x,y) ((x) < (y) ? (y) : (x)) - - -/* - * NAME - * XcmsAddColorSpace - Add a Device-Independent Color Space - * - * SYNOPSIS - */ -Status -XcmsAddColorSpace(XcmsColorSpace *pCS) -/* - * DESCRIPTION - * DI Color Spaces are managed on a global basis. - * This means that with exception of the provided DI color spaces: - * CIEXYZ, CIExyY, CIELab, CIEuvY, CIELuv, and TekHVC - * DI color spaces may have different XcmsColorFormat IDs between - * clients. So, you must be careful when using XcmsColor - * structures between clients! Use the routines XcmsFormatOfPrefix() - * and XcmsPrefixOfFormat() appropriately. - * - * RETURNS - * XcmsSuccess if succeeded, otherwise XcmsFailure - */ -{ - XcmsColorSpace **papColorSpaces; - XcmsColorSpace *ptmpCS; - XcmsColorFormat lastID = 0; - - if ((pCS->id = _XcmsRegFormatOfPrefix(pCS->prefix)) != 0) { - if (XCMS_DD_ID(pCS->id)) { - /* This is a Device-Dependent Color Space */ - return(XcmsFailure); - } - /* - * REGISTERED DI Color Space - * then see if the color space has already been added to the - * system: - * a. If the same ID/prefix and same XcmsColorSpec is found, - * then its a duplicate, so return success. - * b. If same ID/prefix but different XcmsColorSpec is - * found, then add the color space to the front of the - * list using the same ID. This allows one to override - * an existing DI Color Space. - * c. Otherwise none found so just add the color space. - */ - if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { - while ((ptmpCS = *papColorSpaces++) != NULL) { - if (pCS->id == ptmpCS->id) { - if (pCS == ptmpCS) { - /* a. duplicate*/ - return(XcmsSuccess); - } - /* b. same ID/prefix but different XcmsColorSpace */ - break; - } - } - } - /* c. None found */ - } else { - /* - * UNREGISTERED DI Color Space - * then see if the color space has already been added to the - * system: - * a. If same prefix and XcmsColorSpec, then - * its a duplicate ... return success. - * b. If same prefix but different XcmsColorSpec, then - * add the color space to the front of the list using - * the same ID. This allows one to override an existing - * DI Color Space. - * c. Otherwise none found so, add the color space using the - * next unregistered ID for the connection. - */ - if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { - while ((ptmpCS = *papColorSpaces++) != NULL) { - lastID = MAX(lastID, ptmpCS->id); - if (strcmp(pCS->prefix, ptmpCS->prefix) == 0) { - if (pCS == ptmpCS) { - /* a. duplicate */ - return(XcmsSuccess); - } - /* b. same prefix but different XcmsColorSpec */ - pCS->id = ptmpCS->id; - goto AddColorSpace; - } - } - } - /* c. None found */ - pCS->id = NextUnregDiCsID(lastID); - } - - -AddColorSpace: - if ((papColorSpaces = (XcmsColorSpace **) - _XcmsPushPointerArray((XPointer *)_XcmsDIColorSpaces, - (XPointer)pCS, - (XPointer *)_XcmsDIColorSpacesInit)) == NULL) { - return(XcmsFailure); - } - _XcmsDIColorSpaces = papColorSpaces; - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/AddSF.c b/nx-X11/lib/X11/AddSF.c deleted file mode 100644 index 2e244e73b..000000000 --- a/nx-X11/lib/X11/AddSF.c +++ /dev/null @@ -1,145 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsAddSF.c - * - * DESCRIPTION - * Source for XcmsAddFunctionSet - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - */ -#define NextUnregDdCsID(lastid) \ - (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DD_ID) -#define MIN(x,y) ((x) > (y) ? (y) : (x)) - - -/* - * NAME - * XcmsAddFunctionSet - Add an Screen Color Characterization - * Function Set - * - * SYNOPSIS - */ -Status -XcmsAddFunctionSet(XcmsFunctionSet *pNewFS) -/* - * DESCRIPTION - * Additional Screen Color Characterization Function Sets are - * managed on a global basis. This means that with exception - * of the provided DD color spaces: - * RGB and RGBi - * DD color spaces may have different XcmsColorFormat IDs between - * clients. So, you must be careful when using XcmsColorFormat - * across clients! Use the routines XcmsFormatOfPrefix() - * and XcmsPrefixOfFormat() appropriately. - * - * RETURNS - * XcmsSuccess if succeeded, otherwise XcmsFailure - * - * CAVEATS - * Additional Screen Color Characterization Function Sets - * should be added prior to any use of the routine - * XcmsCreateCCC(). If not, XcmsCCC structures created - * prior to the call of this routines will not have had - * a chance to initialize using the added Screen Color - * Characterization Function Set. - */ -{ - XcmsFunctionSet **papSCCFuncSets = _XcmsSCCFuncSets; - XcmsColorSpace **papNewCSs; - XcmsColorSpace *pNewCS, **paptmpCS; - XcmsColorFormat lastID = 0; - - - if (papSCCFuncSets != NULL) { - if ((papNewCSs = pNewFS->DDColorSpaces) == NULL) { - /* - * Error, new Screen Color Characterization Function Set - * missing color spaces - */ - return(XcmsFailure); - } - while ((pNewCS = *papNewCSs++) != NULL) { - if ((pNewCS->id = _XcmsRegFormatOfPrefix(pNewCS->prefix)) != 0) { - if (XCMS_DI_ID(pNewCS->id)) { - /* This is a Device-Independent Color Space */ - return(XcmsFailure); - } - /* - * REGISTERED DD Color Space - * therefore use the registered ID. - */ - } else { - /* - * UNREGISTERED DD Color Space - * then see if the color space is already in - * _XcmsDDColorSpaces. - * a. If same prefix, then use the same ID. - * b. Otherwise, use a new ID. - */ - for (paptmpCS = _XcmsDDColorSpaces; *paptmpCS != NULL; - paptmpCS++){ - lastID = MIN(lastID, (*paptmpCS)->id); - if (strcmp(pNewCS->prefix, (*paptmpCS)->prefix) == 0) { - pNewCS->id = (*paptmpCS)->id; - break; - } - } - if (pNewCS->id == 0) { - /* still haven't found one */ - pNewCS->id = NextUnregDdCsID(lastID); - if ((paptmpCS = (XcmsColorSpace **)_XcmsPushPointerArray( - (XPointer *) _XcmsDDColorSpaces, - (XPointer) pNewCS, - (XPointer *) _XcmsDDColorSpacesInit)) == NULL) { - return(XcmsFailure); - } - _XcmsDDColorSpaces = paptmpCS; - } - } - } - } - if ((papSCCFuncSets = (XcmsFunctionSet **) - _XcmsPushPointerArray((XPointer *) _XcmsSCCFuncSets, - (XPointer) pNewFS, - (XPointer *)_XcmsSCCFuncSetsInit)) == NULL) { - return(XcmsFailure); - } - _XcmsSCCFuncSets = papSCCFuncSets; - - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/AllCells.c b/nx-X11/lib/X11/AllCells.c deleted file mode 100644 index 6e97e1181..000000000 --- a/nx-X11/lib/X11/AllCells.c +++ /dev/null @@ -1,68 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XAllocColorCells( - register Display *dpy, - Colormap cmap, - Bool contig, - unsigned long *masks, /* LISTofCARD32 */ /* RETURN */ - unsigned int nplanes, /* CARD16 */ - unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ - unsigned int ncolors) /* CARD16 */ -{ - - Status status; - xAllocColorCellsReply rep; - register xAllocColorCellsReq *req; - LockDisplay(dpy); - GetReq(AllocColorCells, req); - - req->cmap = cmap; - req->colors = ncolors; - req->planes = nplanes; - req->contiguous = contig; - - status = _XReply(dpy, (xReply *)&rep, 0, xFalse); - - if (status) { - if ((rep.nPixels > ncolors) || (rep.nMasks > nplanes)) { - _XEatDataWords(dpy, rep.length); - status = 0; /* Failure */ - } else { - _XRead32 (dpy, (long *) pixels, 4L * (long) (rep.nPixels)); - _XRead32 (dpy, (long *) masks, 4L * (long) (rep.nMasks)); - } - } - - UnlockDisplay(dpy); - SyncHandle(); - return(status); -} diff --git a/nx-X11/lib/X11/AllPlanes.c b/nx-X11/lib/X11/AllPlanes.c deleted file mode 100644 index b2e245387..000000000 --- a/nx-X11/lib/X11/AllPlanes.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XAllocColorPlanes( - register Display *dpy, - Colormap cmap, - Bool contig, - unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ - int ncolors, - int nreds, - int ngreens, - int nblues, - unsigned long *rmask, - unsigned long *gmask, - unsigned long *bmask) /* CARD32 */ /* RETURN */ -{ - xAllocColorPlanesReply rep; - Status status; - register xAllocColorPlanesReq *req; - - LockDisplay(dpy); - GetReq(AllocColorPlanes,req); - - req->cmap = cmap; - req->colors = ncolors; - req->red = nreds; - req->green = ngreens; - req->blue = nblues; - req->contiguous = contig; - - status = _XReply(dpy, (xReply *)&rep, 0, xFalse); - - - if (status) { - *rmask = rep.redMask; - *gmask = rep.greenMask; - *bmask = rep.blueMask; - - /* sizeof(CARD32) = 4 */ - _XRead32 (dpy, (long *) pixels, (long)(ncolors * 4)); - } - - UnlockDisplay(dpy); - SyncHandle(); - return(status); -} diff --git a/nx-X11/lib/X11/AllowEv.c b/nx-X11/lib/X11/AllowEv.c deleted file mode 100644 index 4a17e7b2d..000000000 --- a/nx-X11/lib/X11/AllowEv.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XAllowEvents( - register Display *dpy, - int mode, - Time time) - -{ - register xAllowEventsReq *req; - - LockDisplay(dpy); - GetReq(AllowEvents,req); - req->mode = mode; - req->time = time; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - - - diff --git a/nx-X11/lib/X11/AuDispose.c b/nx-X11/lib/X11/AuDispose.c deleted file mode 100644 index bb890201d..000000000 --- a/nx-X11/lib/X11/AuDispose.c +++ /dev/null @@ -1,49 +0,0 @@ - -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -void -XauDisposeAuth (auth) -Xauth *auth; -{ - if (auth) { - if (auth->address) (void) free (auth->address); - if (auth->number) (void) free (auth->number); - if (auth->name) (void) free (auth->name); - if (auth->data) { - (void) bzero (auth->data, auth->data_length); - (void) free (auth->data); - } - free ((char *) auth); - } - return; -} diff --git a/nx-X11/lib/X11/AuFileName.c b/nx-X11/lib/X11/AuFileName.c deleted file mode 100644 index 6c4fb7dc3..000000000 --- a/nx-X11/lib/X11/AuFileName.c +++ /dev/null @@ -1,73 +0,0 @@ - -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -char * -XauFileName () -{ - char *slashDotXauthority = "/.Xauthority"; - char *name; - static char *buf; - static int bsize; -#ifdef WIN32 - char dir[128]; -#endif - int size; - - if ((name = getenv ("XAUTHORITY"))) - return name; - name = getenv ("HOME"); - if (!name) { -#ifdef WIN32 - (void) strcpy (dir, "/users/"); - if ((name = getenv("USERNAME"))) { - (void) strcat (dir, name); - name = dir; - } - if (!name) -#endif - return 0; - } - size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; - if (size > bsize) { - if (buf) - free (buf); - buf = malloc ((unsigned) size); - if (!buf) - return 0; - bsize = size; - } - strcpy (buf, name); - strcat (buf, slashDotXauthority + (name[1] == '\0' ? 1 : 0)); - return buf; -} diff --git a/nx-X11/lib/X11/AuGetBest.c b/nx-X11/lib/X11/AuGetBest.c deleted file mode 100644 index 2518805cc..000000000 --- a/nx-X11/lib/X11/AuGetBest.c +++ /dev/null @@ -1,136 +0,0 @@ - -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#ifdef XTHREADS -#include -#endif - -static int -binaryEqual (_Xconst char *a, _Xconst char *b, int len) -{ - while (len--) - if (*a++ != *b++) - return 0; - return 1; -} - -Xauth * -XauGetBestAuthByAddr ( -#if NeedWidePrototypes - unsigned int family, - unsigned int address_length, -#else - unsigned short family, - unsigned short address_length, -#endif - _Xconst char* address, -#if NeedWidePrototypes - unsigned int number_length, -#else - unsigned short number_length, -#endif - _Xconst char* number, - int types_length, - char** types, - _Xconst int* type_lengths) -{ - FILE *auth_file; - char *auth_name; - Xauth *entry; - Xauth *best; - int best_type; - int type; - - auth_name = XauFileName (); - if (!auth_name) - return 0; - if (access (auth_name, R_OK) != 0) /* checks REAL id */ - return 0; - auth_file = fopen (auth_name, "rb"); - if (!auth_file) - return 0; - - best = 0; - best_type = types_length; - for (;;) { - entry = XauReadAuth (auth_file); - if (!entry) - break; - /* - * Match when: - * either family or entry->family are FamilyWild or - * family and entry->family are the same and - * address and entry->address are the same - * and - * either number or entry->number are empty or - * number and entry->number are the same - * and - * either name or entry->name are empty or - * name and entry->name are the same - */ - - if ((family == FamilyWild || entry->family == FamilyWild || - (entry->family == family && - ((address_length == entry->address_length && - binaryEqual (entry->address, address, (int)address_length)) - ))) && - (number_length == 0 || entry->number_length == 0 || - (number_length == entry->number_length && - binaryEqual (entry->number, number, (int)number_length)))) - { - if (best_type == 0) - { - best = entry; - break; - } - for (type = 0; type < best_type; type++) - if (type_lengths[type] == entry->name_length && - !(strncmp (types[type], entry->name, entry->name_length))) - { - break; - } - if (type < best_type) - { - if (best) - XauDisposeAuth (best); - best = entry; - best_type = type; - if (type == 0) - break; - continue; - } - } - XauDisposeAuth (entry); - } - (void) fclose (auth_file); - return best; -} diff --git a/nx-X11/lib/X11/AuRead.c b/nx-X11/lib/X11/AuRead.c deleted file mode 100644 index 61814792d..000000000 --- a/nx-X11/lib/X11/AuRead.c +++ /dev/null @@ -1,135 +0,0 @@ - -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -static int -read_short (unsigned short *shortp, FILE *file) -{ - unsigned char file_short[2]; - - /* - * Added a check on EINTR to prevent the fread() call to be - * interrupted by any signal not blocked by OsBlockSignals(). - */ - - for (;;) { - if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) { - if (errno == EINTR && ferror (file)) { - perror ("Reading from auth file"); - clearerr (file); - continue; - } - return 0; - } - break; - } - *shortp = file_short[0] * 256 + file_short[1]; - return 1; -} - -static int -read_counted_string (unsigned short *countp, char **stringp, FILE *file) -{ - unsigned short len; - char *data; - - if (read_short (&len, file) == 0) - return 0; - if (len == 0) { - data = 0; - } else { - data = malloc ((unsigned) len); - if (!data) - return 0; - for (;;) - { - if (fread (data, (int) sizeof (char), (int) len, file) != len) - { - if (errno == EINTR && ferror (file)) - { - perror ("Reading from auth file"); - clearerr (file); - continue; - } - bzero (data, len); - free (data); - return 0; - } - break; - } - } - *stringp = data; - *countp = len; - return 1; -} - -Xauth * -XauReadAuth (auth_file) -FILE *auth_file; -{ - Xauth local; - Xauth *ret; - - if (read_short (&local.family, auth_file) == 0) - return 0; - if (read_counted_string (&local.address_length, &local.address, auth_file) == 0) - return 0; - if (read_counted_string (&local.number_length, &local.number, auth_file) == 0) { - if (local.address) free (local.address); - return 0; - } - if (read_counted_string (&local.name_length, &local.name, auth_file) == 0) { - if (local.address) free (local.address); - if (local.number) free (local.number); - return 0; - } - if (read_counted_string (&local.data_length, &local.data, auth_file) == 0) { - if (local.address) free (local.address); - if (local.number) free (local.number); - if (local.name) free (local.name); - return 0; - } - ret = (Xauth *) malloc (sizeof (Xauth)); - if (!ret) { - if (local.address) free (local.address); - if (local.number) free (local.number); - if (local.name) free (local.name); - if (local.data) { - bzero (local.data, local.data_length); - free (local.data); - } - return 0; - } - *ret = local; - return ret; -} diff --git a/nx-X11/lib/X11/AutoRep.c b/nx-X11/lib/X11/AutoRep.c deleted file mode 100644 index 66b4097a8..000000000 --- a/nx-X11/lib/X11/AutoRep.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - -Copyright 1985, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XAutoRepeatOn (register Display *dpy) -{ - XKeyboardControl values; - values.auto_repeat_mode = AutoRepeatModeOn; - XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); - return 1; -} - -int -XAutoRepeatOff (register Display *dpy) -{ - XKeyboardControl values; - values.auto_repeat_mode = AutoRepeatModeOff; - XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); - return 1; -} - - diff --git a/nx-X11/lib/X11/Backgnd.c b/nx-X11/lib/X11/Backgnd.c deleted file mode 100644 index bf7d75f8f..000000000 --- a/nx-X11/lib/X11/Backgnd.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetWindowBackground( - register Display *dpy, - Window w, - unsigned long pixel) -{ - register xChangeWindowAttributesReq *req; - - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWBackPixel; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/BdrWidth.c b/nx-X11/lib/X11/BdrWidth.c deleted file mode 100644 index 5da8ce772..000000000 --- a/nx-X11/lib/X11/BdrWidth.c +++ /dev/null @@ -1,53 +0,0 @@ - -/* - -Copyright 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetWindowBorderWidth( - Display *dpy, - Window w, - unsigned int width) -{ - unsigned long lwidth = width; /* must be CARD32 */ - - register xConfigureWindowReq *req; - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 4, req); - req->window = w; - req->mask = CWBorderWidth; - OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), lwidth); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/Bell.c b/nx-X11/lib/X11/Bell.c deleted file mode 100644 index 7da8772cf..000000000 --- a/nx-X11/lib/X11/Bell.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XBell( - register Display *dpy, - int percent) -{ - register xBellReq *req; - - LockDisplay(dpy); - GetReq(Bell,req); - req->percent = percent; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/Border.c b/nx-X11/lib/X11/Border.c deleted file mode 100644 index 133043a5b..000000000 --- a/nx-X11/lib/X11/Border.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetWindowBorder( - register Display *dpy, - Window w, - unsigned long pixel) -{ - register xChangeWindowAttributesReq *req; - - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWBorderPixel; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/CCC.c b/nx-X11/lib/X11/CCC.c deleted file mode 100644 index de6d6318a..000000000 --- a/nx-X11/lib/X11/CCC.c +++ /dev/null @@ -1,285 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsCCC.c - Color Conversion Context Routines - * - * DESCRIPTION - * Routines to create, access, and free Color Conversion - * Context structures. - * - * - */ - -/* - -Copyright 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCreateCCC - * - * SYNOPSIS - */ - -XcmsCCC -XcmsCreateCCC( - Display *dpy, - int screenNumber, - Visual *visual, - XcmsColor *clientWhitePt, - XcmsCompressionProc gamutCompProc, - XPointer gamutCompClientData, - XcmsWhiteAdjustProc whitePtAdjProc, - XPointer whitePtAdjClientData) -/* - * DESCRIPTION - * Given a Display, Screen, Visual, etc., this routine creates - * an appropriate Color Conversion Context. - * - * RETURNS - * Returns NULL if failed; otherwise address of the newly - * created XcmsCCC. - * - */ -{ - XcmsCCC pDefaultCCC = XcmsDefaultCCC(dpy, screenNumber); - XcmsCCC newccc; - XcmsIntensityMap *pIMap; - XcmsPerScrnInfo *pNewScrnInfo; - - if (pDefaultCCC == NULL || - !(newccc = Xcalloc(1, sizeof(XcmsCCCRec)))) { - return(NULL); - } - - /* - * Should inherit the following as result of a memmove(): - * dpy - * screenNumber - * pPerScrnInfo - */ - memcpy((char *)newccc, (char *)pDefaultCCC, sizeof(XcmsCCCRec)); - if (clientWhitePt) { - memcpy((char *)&newccc->clientWhitePt, (char *)clientWhitePt, - sizeof(XcmsColor)); - } - if (gamutCompProc) { - newccc->gamutCompProc = gamutCompProc; - } - if (gamutCompClientData) { - newccc->gamutCompClientData = gamutCompClientData; - } - if (whitePtAdjProc) { - newccc->whitePtAdjProc = whitePtAdjProc; - } - if (whitePtAdjClientData) { - newccc->whitePtAdjClientData = whitePtAdjClientData; - } - - /* - * Now check our list of per-Visual Intensity tables. - * If one exists replace the pPerScrnInfo. - */ - if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) { - if (!(pNewScrnInfo = Xcalloc(1, sizeof(XcmsPerScrnInfo)))) { - Xfree(newccc); - return(NULL); - } - memcpy((char *)pNewScrnInfo, (char *)newccc->pPerScrnInfo, - sizeof(XcmsPerScrnInfo)); - pNewScrnInfo->screenData = pIMap->screenData; - newccc->pPerScrnInfo = pNewScrnInfo; - } - - /* - * Set visual component - */ - newccc->visual = visual; - - return(newccc); -} - - -/* - * NAME - * XcmsDefaultCCC - * - * SYNOPSIS - */ -XcmsCCC -XcmsDefaultCCC( - Display *dpy, - int screenNumber) -/* - * DESCRIPTION - * Given a Display and Screen, this routine creates - * returns the Screen's default Color Conversion Context. - * Note that a Screen's default CCC is built with the - * screen default visual. - * - * RETURNS - * Returns NULL if failed; otherwise address of the - * XcmsCCC for the Screen's default CCC. - * - */ -{ - XcmsCCC ccc; - - - if ((screenNumber < 0) || (screenNumber >= ScreenCount(dpy))) { - return((XcmsCCC)NULL); - } - - /* - * Check if the XcmsCCC's for each screen has been created - */ - if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) { - if (!_XcmsInitDefaultCCCs(dpy)) { - return((XcmsCCC)NULL); - } - } - - ccc = (XcmsCCC)dpy->cms.defaultCCCs + screenNumber; - - if (!ccc->pPerScrnInfo) { - /* - * Need to create the XcmsPerScrnInfo structure. The - * _XcmsInitScrnInfo routine will create the XcmsPerScrnInfo - * structure as well as initialize its functionSet and pScreenData - * components. - */ - if (!_XcmsInitScrnInfo(dpy, screenNumber)) { - return((XcmsCCC)NULL); - } - return(ccc); - } else { - /* - * If ccc->pPerScrnInfo->state == XcmsInitSuccess, - * then the pPerScrnInfo component has already been initialized - * therefore, just return ccc. - * If ccc->pPerScrnInfo->state == XcmsInitFailure, - * then this means that we already attempted to initialize - * the pPerScrnInfo component but failed therefore stuffing - * the pPerScrnInfo component with defaults. Just return ccc. - * If ccc->pPerScrnInfo->state == XcmsInitNone, - * then attempt to initialize the pPerScrnInfo component. - */ - switch (ccc->pPerScrnInfo->state) { - case XcmsInitFailure : - /* fall through */ - case XcmsInitSuccess : - return(ccc); - case XcmsInitNone : - /* XcmsPerScreenInfo has not been initialized */ - if (!_XcmsInitScrnInfo(dpy, screenNumber)) { - return((XcmsCCC)NULL); - } - return(ccc); - default : - return((XcmsCCC)NULL); - } - } -} - - -/* - * NAME - * XcmsFreeCCC - * - * SYNOPSIS - */ -void -XcmsFreeCCC(XcmsCCC ccc) -/* - * DESCRIPTION - * Frees memory associated with a Color Conversion Context - * that was created with XcmsCreateCCC(). - * - * RETURNS - * void - * - */ -{ - if (ccc->dpy->cms.defaultCCCs && - ccc == ((XcmsCCC)ccc->dpy->cms.defaultCCCs) + ccc->screenNumber) { - /* do not allow clients to free DefaultCCC's */ - return; - } - - /* - * Note that XcmsPerScrnInfo sub-structures are freed here only if - * they are for visuals that have per-Visual intensity tables. - * Otherwise the XcmsPerScrnInfo structure is being shared! - * For the latter, there is only one allocated per Screen and it just - * so happens * that we place its initial reference is placed in the - * default CCC. The routine _XcmsFreeDefaultCCCs frees them. - */ - if (_XcmsGetIntensityMap(ccc->dpy, ccc->visual) != NULL) { - Xfree(ccc->pPerScrnInfo); - } - - Xfree(ccc); -} diff --git a/nx-X11/lib/X11/ChAccCon.c b/nx-X11/lib/X11/ChAccCon.c deleted file mode 100644 index f8d099668..000000000 --- a/nx-X11/lib/X11/ChAccCon.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XEnableAccessControl(register Display *dpy) -{ - return XSetAccessControl(dpy, EnableAccess); -} - -int -XDisableAccessControl(register Display *dpy) -{ - return XSetAccessControl(dpy, DisableAccess); -} - -int -XSetAccessControl( - register Display *dpy, - int mode) - -{ - register xSetAccessControlReq *req; - - LockDisplay(dpy); - GetReq(SetAccessControl, req); - req->mode = mode; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ChActPGb.c b/nx-X11/lib/X11/ChActPGb.c deleted file mode 100644 index bebef2b01..000000000 --- a/nx-X11/lib/X11/ChActPGb.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XChangeActivePointerGrab( - register Display *dpy, - unsigned int event_mask, /* CARD16 */ - Cursor curs, - Time time) -{ - register xChangeActivePointerGrabReq *req; - - LockDisplay(dpy); - GetReq(ChangeActivePointerGrab, req); - req->eventMask = event_mask; - req->cursor = curs; - req->time = time; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/ChClMode.c b/nx-X11/lib/X11/ChClMode.c deleted file mode 100644 index 5250a80bc..000000000 --- a/nx-X11/lib/X11/ChClMode.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetCloseDownMode( - register Display *dpy, - int mode) -{ - register xSetCloseDownModeReq *req; - - LockDisplay(dpy); - GetReq(SetCloseDownMode, req); - req->mode = mode; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ChCmap.c b/nx-X11/lib/X11/ChCmap.c deleted file mode 100644 index d9372cdf3..000000000 --- a/nx-X11/lib/X11/ChCmap.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetWindowColormap( - register Display *dpy, - Window w, - Colormap colormap) -{ - register xChangeWindowAttributesReq *req; - - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWColormap; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), colormap); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ChGC.c b/nx-X11/lib/X11/ChGC.c deleted file mode 100644 index 8f677dc3a..000000000 --- a/nx-X11/lib/X11/ChGC.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Cr.h" - -int -XChangeGC ( - register Display *dpy, - GC gc, - unsigned long valuemask, - XGCValues *values) -{ - LockDisplay(dpy); - - valuemask &= (1L << (GCLastBit + 1)) - 1; - if (valuemask) _XUpdateGCCache (gc, valuemask, values); - - /* if any Resource ID changed, must flush */ - if (gc->dirty & (GCFont | GCTile | GCStipple)) - _XFlushGCCache(dpy, gc); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ChKeyCon.c b/nx-X11/lib/X11/ChKeyCon.c deleted file mode 100644 index bcf522340..000000000 --- a/nx-X11/lib/X11/ChKeyCon.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XChangeKeyboardControl( - register Display *dpy, - unsigned long mask, - XKeyboardControl *value_list) -{ - unsigned long values[8]; - register unsigned long *value = values; - long nvalues; - register xChangeKeyboardControlReq *req; - - LockDisplay(dpy); - GetReq(ChangeKeyboardControl, req); - req->mask = mask; - - if (mask & KBKeyClickPercent) - *value++ = value_list->key_click_percent; - - if (mask & KBBellPercent) - *value++ = value_list->bell_percent; - - if (mask & KBBellPitch) - *value++ = value_list->bell_pitch; - - if (mask & KBBellDuration) - *value++ = value_list->bell_duration; - - if (mask & KBLed) - *value++ = value_list->led; - - if (mask & KBLedMode) - *value++ = value_list->led_mode; - - if (mask & KBKey) - *value++ = value_list->key; - - if (mask & KBAutoRepeatMode) - *value++ = value_list->auto_repeat_mode; - - - req->length += (nvalues = value - values); - - /* note: Data is a macro that uses its arguments multiple - times, so "nvalues" is changed in a separate assignment - statement */ - - nvalues <<= 2; - Data32 (dpy, (long *) values, nvalues); - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } diff --git a/nx-X11/lib/X11/ChPntCon.c b/nx-X11/lib/X11/ChPntCon.c deleted file mode 100644 index c177c0045..000000000 --- a/nx-X11/lib/X11/ChPntCon.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XChangePointerControl( - register Display *dpy, - Bool do_acc, - Bool do_thresh, - int acc_numerator, - int acc_denominator, - int threshold) - -{ - register xChangePointerControlReq *req; - - LockDisplay(dpy); - GetReq(ChangePointerControl, req); - req->doAccel = do_acc; - req->doThresh = do_thresh; - req->accelNum = acc_numerator; - req->accelDenum = acc_denominator; - req->threshold = threshold; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ChProp.c b/nx-X11/lib/X11/ChProp.c deleted file mode 100644 index 190a224f8..000000000 --- a/nx-X11/lib/X11/ChProp.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XChangeProperty ( - register Display *dpy, - Window w, - Atom property, - Atom type, - int format, /* 8, 16, or 32 */ - int mode, /* PropModeReplace, PropModePrepend, PropModeAppend */ - _Xconst unsigned char *data, - int nelements) - { - register xChangePropertyReq *req; - register long len; - - LockDisplay(dpy); - GetReq (ChangeProperty, req); - req->window = w; - req->property = property; - req->type = type; - req->mode = mode; - if (nelements < 0) { - req->nUnits = 0; - req->format = 0; /* ask for garbage, get garbage */ - } else { - req->nUnits = nelements; - req->format = format; - } - - switch (req->format) { - case 8: - len = ((long)nelements + 3)>>2; - if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { - SetReqLen(req, len, len); - Data (dpy, (_Xconst char *)data, nelements); - } /* else force BadLength */ - break; - - case 16: - len = ((long)nelements + 1)>>1; - if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { - SetReqLen(req, len, len); - len = (long)nelements << 1; - Data16 (dpy, (_Xconst short *) data, len); - } /* else force BadLength */ - break; - - case 32: - len = nelements; - if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { - SetReqLen(req, len, len); - len = (long)nelements << 2; - Data32 (dpy, (_Xconst long *) data, len); - } /* else force BadLength */ - break; - - default: - /* BadValue will be generated */ ; - } - - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } - - - - - diff --git a/nx-X11/lib/X11/ChSaveSet.c b/nx-X11/lib/X11/ChSaveSet.c deleted file mode 100644 index 068b042d2..000000000 --- a/nx-X11/lib/X11/ChSaveSet.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XChangeSaveSet( - register Display *dpy, - Window win, - int mode) -{ - register xChangeSaveSetReq *req; - - LockDisplay(dpy); - GetReq(ChangeSaveSet, req); - req->window = win; - req->mode = mode; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XAddToSaveSet( - register Display *dpy, - Window win) -{ - return XChangeSaveSet(dpy,win,SetModeInsert); -} - -int -XRemoveFromSaveSet ( - register Display *dpy, - Window win) -{ - return XChangeSaveSet(dpy,win,SetModeDelete); -} diff --git a/nx-X11/lib/X11/ChWAttrs.c b/nx-X11/lib/X11/ChWAttrs.c deleted file mode 100644 index 25cbcbd05..000000000 --- a/nx-X11/lib/X11/ChWAttrs.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\ - CWBorderPixel|CWBitGravity|CWWinGravity|\ - CWBackingStore|CWBackingPlanes|CWBackingPixel|\ - CWOverrideRedirect|CWSaveUnder|CWEventMask|\ - CWDontPropagate|CWColormap|CWCursor) - -int -XChangeWindowAttributes ( - register Display *dpy, - Window w, - unsigned long valuemask, - XSetWindowAttributes *attributes) -{ - register xChangeWindowAttributesReq *req; - - LockDisplay(dpy); - GetReq(ChangeWindowAttributes,req); - req->window = w; - valuemask &= AllMaskBits; - if ((req->valueMask = valuemask)) - _XProcessWindowAttributes (dpy, req, valuemask, attributes); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ChWindow.c b/nx-X11/lib/X11/ChWindow.c deleted file mode 100644 index 89a81e12a..000000000 --- a/nx-X11/lib/X11/ChWindow.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XResizeWindow( - register Display *dpy, - Window w, - unsigned int width, - unsigned int height) -{ - register xConfigureWindowReq *req; - - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 8, req); /* 2 4-byte quantities */ - - req->window = w; - req->mask = CWWidth | CWHeight; - { - CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); - *valuePtr++ = width; - *valuePtr = height; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/ChkIfEv.c b/nx-X11/lib/X11/ChkIfEv.c deleted file mode 100644 index 313e4395c..000000000 --- a/nx-X11/lib/X11/ChkIfEv.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - -Copyright 1985, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ - -Bool XCheckIfEvent ( - register Display *dpy, - register XEvent *event, /* XEvent to be filled in. */ - Bool (*predicate)( - Display* /* display */, - XEvent* /* event */, - char* /* arg */ - ), /* function to call */ - char *arg) -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if(qelt->qserial_num > qe_serial - && (*predicate)(dpy, &qelt->event, arg)) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - _XStoreEventCookie(dpy, event); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} - -#ifdef NX_TRANS_SOCKET - -/* - * This is just like XCheckIfEvent() but doesn't - * flush the output buffer if it can't read new - * events. - */ - -Bool XCheckIfEventNoFlush ( - register Display *dpy, - register XEvent *event, /* XEvent to be filled in. */ - Bool (*predicate)( - Display* /* display */, - XEvent* /* event */, - char* /* arg */ - ), /* function to call */ - char *arg) - -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - prev = NULL; - for (n = 2; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if(qelt->qserial_num > qe_serial - && (*predicate)(dpy, &qelt->event, arg)) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - _XStoreEventCookie(dpy, event); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 1: - _XEventsQueued(dpy, QueuedAfterReading); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} - -#endif diff --git a/nx-X11/lib/X11/ChkMaskEv.c b/nx-X11/lib/X11/ChkMaskEv.c deleted file mode 100644 index 78928e079..000000000 --- a/nx-X11/lib/X11/ChkMaskEv.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - -Copyright 1985, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -extern long const _Xevent_to_mask[]; - -#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) -#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ - Button4MotionMask|Button5MotionMask) - -/* - * Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ - -Bool XCheckMaskEvent ( - register Display *dpy, - long mask, /* Selected event mask. */ - register XEvent *event) /* XEvent to be filled in. */ -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if ((qelt->event.type < GenericEvent) && - (_Xevent_to_mask[qelt->event.type] & mask) && - ((qelt->event.type != MotionNotify) || - (mask & AllPointers) || - (mask & AllButtons & qelt->event.xmotion.state))) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} diff --git a/nx-X11/lib/X11/ChkTypEv.c b/nx-X11/lib/X11/ChkTypEv.c deleted file mode 100644 index 2e9bcdd0a..000000000 --- a/nx-X11/lib/X11/ChkTypEv.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - -Copyright 1985, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ - -Bool XCheckTypedEvent ( - register Display *dpy, - int type, /* Selected event type. */ - register XEvent *event) /* XEvent to be filled in. */ -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if (qelt->event.type == type) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - _XStoreEventCookie(dpy, event); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} diff --git a/nx-X11/lib/X11/ChkTypWEv.c b/nx-X11/lib/X11/ChkTypWEv.c deleted file mode 100644 index 2f247be26..000000000 --- a/nx-X11/lib/X11/ChkTypWEv.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - -Copyright 1985, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ - -Bool XCheckTypedWindowEvent ( - register Display *dpy, - Window w, /* Selected window. */ - int type, /* Selected event type. */ - register XEvent *event) /* XEvent to be filled in. */ -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if ((qelt->event.xany.window == w) && - (qelt->event.type == type)) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - _XStoreEventCookie(dpy, event); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} diff --git a/nx-X11/lib/X11/ChkWinEv.c b/nx-X11/lib/X11/ChkWinEv.c deleted file mode 100644 index 9fb7db06a..000000000 --- a/nx-X11/lib/X11/ChkWinEv.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - -Copyright 1985, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -extern long const _Xevent_to_mask[]; -#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) -#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ - Button4MotionMask|Button5MotionMask) - -/* - * Check existing events in queue to find if any match. If so, return. - * If not, flush buffer and see if any more events are readable. If one - * matches, return. If all else fails, tell the user no events found. - */ - -Bool XCheckWindowEvent ( - register Display *dpy, - Window w, /* Selected window. */ - long mask, /* Selected event mask. */ - register XEvent *event) /* XEvent to be filled in. */ -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - int n; /* time through count */ - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - prev = NULL; - for (n = 3; --n >= 0;) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if ((qelt->event.xany.window == w) && - (qelt->event.type < GenericEvent) && - (_Xevent_to_mask[qelt->event.type] & mask) && - ((qelt->event.type != MotionNotify) || - (mask & AllPointers) || - (mask & AllButtons & qelt->event.xmotion.state))) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - UnlockDisplay(dpy); - return True; - } - } - if (prev) - qe_serial = prev->qserial_num; - switch (n) { - case 2: - _XEventsQueued(dpy, QueuedAfterReading); - break; - case 1: - _XFlush(dpy); - break; - } - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; - } - UnlockDisplay(dpy); - return False; -} diff --git a/nx-X11/lib/X11/CirWin.c b/nx-X11/lib/X11/CirWin.c deleted file mode 100644 index e37a42ade..000000000 --- a/nx-X11/lib/X11/CirWin.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XCirculateSubwindows( - register Display *dpy, - Window w, - int direction) -{ - register xCirculateWindowReq *req; - - LockDisplay(dpy); - GetReq(CirculateWindow, req); - req->window = w; - req->direction = direction; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/CirWinDn.c b/nx-X11/lib/X11/CirWinDn.c deleted file mode 100644 index f2b54852b..000000000 --- a/nx-X11/lib/X11/CirWinDn.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XCirculateSubwindowsDown( - register Display *dpy, - Window w) -{ - register xCirculateWindowReq *req; - - LockDisplay(dpy); - GetReq(CirculateWindow, req); - req->window = w; - req->direction = LowerHighest; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/CirWinUp.c b/nx-X11/lib/X11/CirWinUp.c deleted file mode 100644 index be9f094cd..000000000 --- a/nx-X11/lib/X11/CirWinUp.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XCirculateSubwindowsUp( - register Display *dpy, - Window w) -{ - register xCirculateWindowReq *req; - - LockDisplay(dpy); - GetReq(CirculateWindow, req); - req->window = w; - req->direction = RaiseLowest; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ClDisplay.c b/nx-X11/lib/X11/ClDisplay.c deleted file mode 100644 index 898fc9144..000000000 --- a/nx-X11/lib/X11/ClDisplay.c +++ /dev/null @@ -1,82 +0,0 @@ - -/* - -Copyright 1985, 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#if USE_XCB -#include "Xxcbint.h" -#else /* !USE_XCB */ -#include -#endif /* USE_XCB */ -#include "Xlib.h" -#include "Xlibint.h" -#include "Xintconn.h" - -/* - * XCloseDisplay - XSync the connection to the X Server, close the connection, - * and free all associated storage. Extension close procs should only free - * memory and must be careful about the types of requests they generate. - */ - -int -XCloseDisplay ( - register Display *dpy) -{ - register _XExtension *ext; - register int i; - - if (!(dpy->flags & XlibDisplayClosing)) - { - dpy->flags |= XlibDisplayClosing; - for (i = 0; i < dpy->nscreens; i++) { - register Screen *sp = &dpy->screens[i]; - XFreeGC (dpy, sp->default_gc); - } - if (dpy->cursor_font != None) { - XUnloadFont (dpy, dpy->cursor_font); - } - XSync(dpy, 1); /* throw away pending events, catch errors */ - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->close_display) - (*ext->close_display)(dpy, &ext->codes); - } - /* if the closes generated more protocol, sync them up */ - if (dpy->request != dpy->last_request_read) - XSync(dpy, 1); - } -#if USE_XCB - xcb_disconnect(dpy->xcb->connection); -#else /* !USE_XCB */ - _XDisconnectDisplay(dpy->trans_conn); -#endif /* USE_XCB */ - _XFreeDisplayStructure (dpy); - return 0; -} diff --git a/nx-X11/lib/X11/Clear.c b/nx-X11/lib/X11/Clear.c deleted file mode 100644 index 63dc64045..000000000 --- a/nx-X11/lib/X11/Clear.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XClearWindow( - register Display *dpy, - Window w) -{ - register xClearAreaReq *req; - - LockDisplay(dpy); - GetReq(ClearArea, req); - req->window = w; - req->x = req->y = req->width = req->height = 0; - /* these values mean "clear the entire window" */ - req->exposures = xFalse; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ClearArea.c b/nx-X11/lib/X11/ClearArea.c deleted file mode 100644 index 41fd17c80..000000000 --- a/nx-X11/lib/X11/ClearArea.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XClearArea ( - register Display *dpy, - Window w, - int x, - int y, - unsigned int width, - unsigned int height, - Bool exposures) -{ - register xClearAreaReq *req; - - LockDisplay(dpy); - GetReq(ClearArea, req); - req->window = w; - req->x = x; - req->y = y; - req->width = width; - req->height = height; - req->exposures = exposures; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/Cmap.h b/nx-X11/lib/X11/Cmap.h deleted file mode 100644 index db2de5697..000000000 --- a/nx-X11/lib/X11/Cmap.h +++ /dev/null @@ -1,12 +0,0 @@ - -#ifndef _CMAP_H_ -#define _CMAP_H_ - -#include - -extern void -_XcmsDeleteCmapRec( - Display *dpy, - Colormap cmap); - -#endif /* _CMAP_H_ */ diff --git a/nx-X11/lib/X11/ConfWind.c b/nx-X11/lib/X11/ConfWind.c deleted file mode 100644 index eefce4dd5..000000000 --- a/nx-X11/lib/X11/ConfWind.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XMoveResizeWindow( - register Display *dpy, - Window w, - int x, - int y, - unsigned int width, - unsigned int height) -{ - register xConfigureWindowReq *req; - - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 16, req); - req->window = w; - req->mask = CWX | CWY | CWWidth | CWHeight; - { - register CARD32 *valuePtr = - (CARD32 *) NEXTPTR(req,xConfigureWindowReq); - *valuePtr++ = x; - *valuePtr++ = y; - *valuePtr++ = width; - *valuePtr = height; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/ConnDis.c b/nx-X11/lib/X11/ConnDis.c deleted file mode 100644 index dfc0227fe..000000000 --- a/nx-X11/lib/X11/ConnDis.c +++ /dev/null @@ -1,1479 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * This file contains operating system dependencies. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#ifdef HASXDMAUTH -#include -#endif -#include -#include -#include - -#if !defined(WIN32) -#include -#else -#include -#endif - -#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */ -#define X_CONNECTION_RETRIES 5 -#endif - -#include "Xintconn.h" - -/* prototypes */ -static void GetAuthorization( - XtransConnInfo trans_conn, - int family, - char *saddr, - int saddrlen, - int idisplay, - char **auth_namep, - int *auth_namelenp, - char **auth_datap, - int *auth_datalenp); - -/* functions */ -static char *copystring (const char *src, int len) -{ - char *dst = Xmalloc (len + 1); - - if (dst) { - strncpy (dst, src, len); - dst[len] = '\0'; - } - - return dst; -} - -#define Xstrdup(s) copystring(s, strlen(s)) - -#ifdef TCPCONN -# define TCP_TRANS "tcp" -#endif -#ifdef UNIXCONN -# define UNIX_TRANS "unix" -#endif -#if defined(LOCALCONN) || defined(UNIXCONN) -# define LOCAL_TRANS "local" -#endif - -/* FIXME: This should be handled through Makefile/configure logic. See configure.ac in upstream libX11 */ - -#ifdef UNIXCONN -# ifdef TCPCONN -# define LOCAL_TRANSPORT_LIST LOCAL_TRANS,UNIX_TRANS,TCP_TRANS -# else -# define LOCAL_TRANSPORT_LIST LOCAL_TRANS,UNIX_TRANS -# endif -#else -# ifdef TCPCONN -# define LOCAL_TRANSPORT_LIST TCP_TRANS -# else -# define LOCAL_TRANSPORT_LIST -# endif -#endif - - - - -/* - * Attempts to connect to server, given display name. Returns file descriptor - * (network socket) or -1 if connection fails. Display names may be of the - * following format: - * - * [protocol/] [hostname] : [:] displaynumber [.screennumber] - * - * A string with exactly two colons seperating hostname from the - * display indicates a (now unsupported) DECnet style name. Colons in - * the hostname may occur if an IPv6 numeric address is used as the - * hostname. An IPv6 numeric address may also end in a double colon, - * so three colons in a row indicates an IPv6 address ending in :: - * followed by :display. To make it easier for people to read, an - * IPv6 numeric address hostname may be surrounded by [ ] in a similar - * fashion to the IPv6 numeric address URL syntax defined by IETF RFC - * 2732. - * - * If no hostname and no protocol is specified, the string is interpreted - * as the most efficient local connection to a server on the same machine. - * This is usually: - * - * o shared memory - * o local stream - * o UNIX domain socket - * o TCP to local host - * - * This function will eventually call the X Transport Interface functions - * which expects the hostname in the format: - * - * [protocol/] [hostname] : [:] displaynumber - * - */ -XtransConnInfo -_X11TransConnectDisplay ( - char *display_name, - char **fullnamep, /* RETURN */ - int *dpynump, /* RETURN */ - int *screenp, /* RETURN */ - char **auth_namep, /* RETURN */ - int *auth_namelenp, /* RETURN */ - char **auth_datap, /* RETURN */ - int *auth_datalenp) /* RETURN */ -{ - int family; - int saddrlen; - Xtransaddr *saddr; - char *lastp, *lastc, *p; /* char pointers */ - char *pprotocol = NULL; /* start of protocol name */ - char *phostname = NULL; /* start of host of display */ - char *pdpynum = NULL; /* start of dpynum of display */ - char *pscrnum = NULL; /* start of screen of display */ - int idisplay = 0; /* required display number */ - int iscreen = 0; /* optional screen number */ - /* int (*connfunc)(); */ /* method to create connection */ - int len, hostlen; /* length tmp variable */ - int retry; /* retry counter */ - char addrbuf[128]; /* final address passed to - X Transport Interface */ - char* address = addrbuf; - XtransConnInfo trans_conn = NULL; /* transport connection object */ - int connect_stat; -#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) - Bool reset_hostname = False; /* Reset hostname? */ - char *original_hostname = NULL; - int local_transport_index = -1; - const char *local_transport[] = { LOCAL_TRANSPORT_LIST, NULL }; -#endif - - p = display_name; - - saddrlen = 0; /* set so that we can clear later */ - saddr = NULL; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Called with display_name [%s].\n", display_name); -#endif - -#ifdef NX_TRANS_SOCKET - - /* - * Check if user selected the "nx" - * protocol or an "nx" hostname. - */ - - if (!strncasecmp(p, "nx/", 3) || !strcasecmp(p, "nx") || - !strncasecmp(p, "nx:", 3) || !strncasecmp(p, "nx,", 3)) - { - if (*(display_name + 2) == '/') - { - p += 3; - } - - pprotocol = copystring ("nx", 2); - - if (!pprotocol) goto bad; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_X11TransConnectDisplay: Forced protocol to [%s].\n", pprotocol); -#endif - - } - else - { - -#endif - - /* - * Step 0, find the protocol. This is delimited by the optional - * slash ('/'). - */ - for (lastp = p; *p && *p != ':' && *p != '/'; p++) ; - if (!*p) return NULL; /* must have a colon */ - - if (p != lastp && *p != ':') { /* protocol given? */ - pprotocol = copystring (lastp, p - lastp); - if (!pprotocol) goto bad; /* no memory */ - p++; /* skip the '/' */ - } else - p = display_name; /* reset the pointer in - case no protocol was given */ -#ifdef NX_TRANS_SOCKET - - } /* End of step 0. */ - - /* - * Check if user specified the "nx" protocol or - * hostname is "nx" or in the form "nx,...". - */ - - if (pprotocol && !strcasecmp(pprotocol, "nx")) - { - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_X11TransConnectDisplay: Checking hostname [%s].\n", p); -#endif - - /* - * Options can include a "display=" tuple so - * need to scan right to left. - */ - - lastp = p; - lastc = NULL; - - for (; *p; p++) - if (*p == ':') - lastc = p; - - /* - * Don't complain if no screen was provided. - */ - - if (lastc) - { - phostname = copystring (lastp, lastc - lastp); - - p = lastc; - } - else - { - phostname = copystring (lastp, strlen(lastp)); - } - - if (!phostname) goto bad; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_X11TransConnectDisplay: Forced hostname [%s].\n", phostname); -#endif - - } - else - { - -#endif - - /* - * Step 1, find the hostname. This is delimited by either one colon, - * or two colons in the case of DECnet (DECnet Phase V allows a single - * colon in the hostname). (See note above regarding IPv6 numeric - * addresses with triple colons or [] brackets.) - * FIXME: we do not support DECnet anymore, so maybe remove these checks? - */ - - lastp = p; - lastc = NULL; - for (; *p; p++) - if (*p == ':') - lastc = p; - - if (!lastc) return NULL; /* must have a colon */ - - if ((lastp != lastc) && (*(lastc - 1) == ':') -#if defined(IPv6) && defined(AF_INET6) - && ( ((lastc - 1) == lastp) || (*(lastc - 2) != ':')) -#endif - ) { - /* DECnet display specified */ - - goto bad; - } - else - hostlen = lastc - lastp; - - if (hostlen > 0) { /* hostname given? */ - phostname = copystring (lastp, hostlen); - if (!phostname) goto bad; /* no memory */ - } - - p = lastc; - -#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) - /* check if phostname == localnodename AND protocol not specified */ - if (!pprotocol && phostname) { - char localhostname[256]; - - if ((_XGetHostname (localhostname, sizeof localhostname) > 0) - && (strcmp(phostname, localhostname) == 0)) { - original_hostname = phostname; - phostname = NULL; - reset_hostname = True; - } - } -#endif - -#ifdef NX_TRANS_SOCKET - - } /* End of step 1. */ - - /* - * Check if no display was specified. In this case - * search the "port=n" option in NX host string. - */ - - if (*p) - { - -#endif - - - /* - * Step 2, find the display number. This field is required and is - * delimited either by a nul or a period, depending on whether or not - * a screen number is present. - */ - - for (lastp = ++p; *p && isascii(*p) && isdigit(*p); p++) ; - if ((p == lastp) || /* required field */ - (*p != '\0' && *p != '.') || /* invalid non-digit terminator */ - !(pdpynum = copystring (lastp, p - lastp))) /* no memory */ - goto bad; - idisplay = atoi (pdpynum); - -#ifdef NX_TRANS_SOCKET - - } - else - { - char *host = NULL; - char *name = NULL; - char *value = NULL; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_X11TransConnectDisplay: Searching port in port [%s].\n", phostname); -#endif - - if (!strncasecmp(phostname, "nx,", 3)) - { - host = copystring(phostname + 3, strlen(phostname) - 3); - } - - if (!host) goto bad; - - idisplay = -1; - - name = strtok(host, "="); - - while (name) - { - value = strtok(NULL, ","); - - if (value == NULL || strstr(value, "=") != NULL || - strstr(name, ",") != NULL || strlen(value) >= 128) - { - Xfree(host); - - goto bad; - } - else if (strcasecmp(name, "port") == 0) - { - idisplay = atoi(value); - - pdpynum = copystring(value, strlen(value)); - - if (!pdpynum) goto bad; - - break; - } - - name = strtok(NULL, "="); - } - - Xfree(host); - - if (idisplay == -1) - { - goto bad; - } - - } /* End of step 2. */ - -#endif - - - /* - * Step 3, find the screen number. This field is optional. It is - * present only if the display number was followed by a period (which - * we've already verified is the only non-nul character). - */ - - if (*p) { - for (lastp = ++p; *p && isascii(*p) && isdigit (*p); p++) ; - if (p != lastp) { - if (*p || /* non-digits */ - !(pscrnum = copystring (lastp, p - lastp))) /* no memory */ - goto bad; - iscreen = atoi (lastp); - } - } - - /* - * At this point, we know the following information: - * - * pprotocol protocol string or NULL - * phostname hostname string or NULL - * idisplay display number - * iscreen screen number - * - * We can now decide which transport to use based on the ConnectionFlags - * build parameter the hostname string. If phostname is NULL or equals - * the string "local", then choose the best transport. If phostname - * is "unix", then choose BSD UNIX domain sockets (if configured). - */ - -#ifdef NX_TRANS_SOCKET - - /* - * If user selected the "nx" protocol - * force "local" transport. - */ - - if (pprotocol && !strcasecmp(pprotocol, "nx")) - { - pprotocol = copystring ("local", 5); - - if (!pprotocol) goto bad; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_X11TransConnectDisplay: Converted protocol to [%s].\n", pprotocol); -#endif - - } - -#endif - -#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) - if (!pprotocol) { -#if defined(UNIXCONN) - if (phostname && (strcmp (phostname, "unix") == 0)) { - Xfree(pprotocol); - pprotocol = copystring ("unix", 4); - } else -#endif -#ifdef HAVE_LAUNCHD - if (phostname && phostname[0]=='/') { - pprotocol = copystring ("local", 5); - } -#endif - if (!phostname) - { - if (local_transport[0] != NULL) { - pprotocol = Xstrdup(local_transport[0]); - local_transport_index = 0; - } - } - - if (!pprotocol) { /* if still not found one, tcp is our last resort */ - pprotocol = copystring ("tcp", 3); - } - } -#endif - - - connect: - /* - * This seems kind of backwards, but we need to put the protocol, - * host, and port back together to pass to _X11TransOpenCOTSClient(). - */ - - { - int olen = 3 + (pprotocol ? strlen(pprotocol) : 0) + - (phostname ? strlen(phostname) : 0) + - (pdpynum ? strlen(pdpynum) : 0); - if (olen > sizeof addrbuf) address = Xmalloc (olen); - } - if (!address) goto bad; - - sprintf(address,"%s/%s:%d", - pprotocol ? pprotocol : "", - phostname ? phostname : "", - idisplay ); - - /* - * Make the connection, also need to get the auth address info for - * the connection. Do retries in case server host has hit its - * backlog (which, unfortunately, isn't distinguishable from there not - * being a server listening at all, which is why we have to not retry - * too many times). - */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Entering connection loop.\n"); -#endif - for(retry=X_CONNECTION_RETRIES; retry>=0; retry-- ) - { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address); -#endif - if ( (trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) - { - break; - } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConnect(trans_conn,address).\n"); -#endif - if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 ) - { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n"); -#endif - _X11TransClose(trans_conn); - trans_conn = NULL; - - if (connect_stat == TRANS_TRY_CONNECT_AGAIN) - continue; - else - break; - } - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n"); -#endif - _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr); - - /* - * The family is given in a socket format (ie AF_INET). This - * will convert it to the format used by the authorization and - * X protocol (ie FamilyInternet). - */ - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n"); -#endif - if( _X11TransConvertAddress(&family, &saddrlen, &saddr) < 0 ) - { - _X11TransClose(trans_conn); - trans_conn = NULL; - if (saddr) - { - free ((char *) saddr); - saddr = NULL; - } - continue; - } - - break; - } - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "_X11TransConnectDisplay: Out of connection loop.\n"); -#endif - if (address != addrbuf) Xfree (address); - address = addrbuf; - - if( trans_conn == NULL ) - goto bad; - - /* - * Set close-on-exec so that programs that fork() doesn't get confused. - */ - - _X11TransSetOption(trans_conn,TRANS_CLOSEONEXEC,1); - - /* - * Build the expanded display name: - * - * [host] : [:] dpy . scr \0 - */ -#if defined(LOCALCONN) || defined(TCPCONN) || defined(UNIXCONN) - /* - * If we computed the host name, get rid of it so that - * XDisplayString() and XDisplayName() agree. - */ - if (reset_hostname && (phostname != original_hostname)) { - Xfree (phostname); - phostname = original_hostname; - original_hostname = NULL; - } -#endif - len = ((phostname ? strlen(phostname) : 0) + 1 + - strlen(pdpynum) + 1 + (pscrnum ? strlen(pscrnum) : 1) + 1); - *fullnamep = (char *) Xmalloc (len); - if (!*fullnamep) goto bad; - -#ifdef HAVE_LAUNCHD - if (phostname && strlen(phostname) > 11 && !strncmp(phostname, "/tmp/launch", 11)) - sprintf (*fullnamep, "%s%s%d", - (phostname ? phostname : ""), - ":", - idisplay); - else -#endif - sprintf (*fullnamep, "%s%s%d.%d", - (phostname ? phostname : ""), - ":", - idisplay, iscreen); - - *dpynump = idisplay; - *screenp = iscreen; - if (pprotocol) Xfree (pprotocol); - if (phostname) Xfree (phostname); - if (pdpynum) Xfree (pdpynum); - if (pscrnum) Xfree (pscrnum); -#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) - if (original_hostname) Xfree (original_hostname); -#endif - - GetAuthorization(trans_conn, family, (char *) saddr, saddrlen, idisplay, - auth_namep, auth_namelenp, auth_datap, auth_datalenp); - return trans_conn; - - - /* - * error return; make sure everything is cleaned up. - */ - bad: - if (trans_conn) (void)_X11TransClose(trans_conn); - if (saddr) free ((char *) saddr); - if (pprotocol) Xfree (pprotocol); - if (phostname) Xfree (phostname); - if (address && address != addrbuf) { Xfree(address); address = addrbuf; } - -#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) - /* If connecting to the local machine, and we failed, try again with - * the next transport type available, if there is one. - */ - if (local_transport_index >= 0) { - if (local_transport[++local_transport_index] != NULL) { - pprotocol = Xstrdup(local_transport[local_transport_index]); -#ifdef TCPCONN - if (strcmp(pprotocol, "tcp") == 0) { - if (original_hostname != NULL) { - phostname = original_hostname; - original_hostname = NULL; - } else { - phostname = copystring("localhost", 9); - } - } else -#endif /* TCPCONN */ - { - if ((phostname != NULL) && (original_hostname == NULL)) { - original_hostname = phostname; - } - phostname = NULL; - } - goto connect; - } - } - - /* No more to try, we've failed all available local transports */ - if (original_hostname) Xfree(original_hostname); -#endif /* LOCALCONN || UNIXCONN || TCPCONN */ - - if (pdpynum) Xfree (pdpynum); - if (pscrnum) Xfree (pscrnum); - return NULL; - -} - -/* - * This is gross, but we need it for compatiblity. - * The test suite relies on the following interface. - * - */ - -int _XConnectDisplay ( - char *display_name, - char **fullnamep, /* RETURN */ - int *dpynump, /* RETURN */ - int *screenp, /* RETURN */ - char **auth_namep, /* RETURN */ - int *auth_namelenp, /* RETURN */ - char **auth_datap, /* RETURN */ - int *auth_datalenp) /* RETURN */ -{ - XtransConnInfo trans_conn; - - trans_conn = _X11TransConnectDisplay ( - display_name, fullnamep, dpynump, screenp, - auth_namep, auth_namelenp, auth_datap, auth_datalenp); - - if (trans_conn) - { - int fd = _X11TransGetConnectionNumber (trans_conn); - _X11TransFreeConnInfo (trans_conn); - return (fd); - } - else - return (-1); -} - - -/***************************************************************************** - * * - * Connection Utility Routines * - * * - *****************************************************************************/ - -/* - * Disconnect from server. - */ - -int _XDisconnectDisplay (XtransConnInfo trans_conn) -{ - _X11TransDisconnect(trans_conn); - _X11TransClose(trans_conn); - return 0; -} - - - -Bool -_XSendClientPrefix( - Display *dpy, - xConnClientPrefix *client, /* contains count for auth_* */ - char *auth_proto, char *auth_string, /* NOT null-terminated */ - xConnSetupPrefix *prefix) /* prefix information */ -{ - int auth_length = client->nbytesAuthProto; - int auth_strlen = client->nbytesAuthString; - static char padbuf[3]; /* for padding to 4x bytes */ - int pad; - struct iovec iovarray[5], *iov = iovarray; - int niov = 0; - int len = 0; - -#define add_to_iov(b,l) \ - { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; len += (l); } - - add_to_iov ((caddr_t) client, SIZEOF(xConnClientPrefix)); - - /* - * write authorization protocol name and data - */ - if (auth_length > 0) { - add_to_iov (auth_proto, auth_length); - pad = -auth_length & 3; /* pad auth_length to a multiple of 4 */ - if (pad) add_to_iov (padbuf, pad); - } - if (auth_strlen > 0) { - add_to_iov (auth_string, auth_strlen); - pad = -auth_strlen & 3; /* pad auth_strlen to a multiple of 4 */ - if (pad) add_to_iov (padbuf, pad); - } - -#undef add_to_iov - - len -= _X11TransWritev (dpy->trans_conn, iovarray, niov); - - /* - * Set the connection non-blocking since we use select() to block. - */ - - _X11TransSetOption(dpy->trans_conn, TRANS_NONBLOCKING, 1); - - if (len != 0) - return -1; -#ifdef NX_TRANS_SOCKET - if (_NXDisplayWriteFunction != NULL) { - (*_NXDisplayWriteFunction)(dpy, len); - } -#ifdef NX_TRANS_CHANGE - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } -#endif -#endif - -#ifdef K5AUTH - if (auth_length == 14 && - !strncmp(auth_proto, "MIT-KERBEROS-5", 14)) - { - return k5_clientauth(dpy, prefix); - } else -#endif - return 0; -} - - - -#ifdef SECURE_RPC -#include -#ifdef ultrix -#include -#include -#endif -#endif - -#ifdef HASXDMAUTH -#include -#define Time_t time_t -#endif - -/* - * First, a routine for setting authorization data - */ -static int xauth_namelen = 0; -static char *xauth_name = NULL; /* NULL means use default mechanism */ -static int xauth_datalen = 0; -static char *xauth_data = NULL; /* NULL means get default data */ - -/* - * This is a list of the authorization names which Xlib currently supports. - * Xau will choose the file entry which matches the earliest entry in this - * array, allowing us to prioritize these in terms of the most secure first - */ - -static char *default_xauth_names[] = { -#ifdef K5AUTH - "MIT-KERBEROS-5", -#endif -#ifdef SECURE_RPC - "SUN-DES-1", -#endif -#ifdef HASXDMAUTH - "XDM-AUTHORIZATION-1", -#endif - "MIT-MAGIC-COOKIE-1" -}; - -static _Xconst int default_xauth_lengths[] = { -#ifdef K5AUTH - 14, /* strlen ("MIT-KERBEROS-5") */ -#endif -#ifdef SECURE_RPC - 9, /* strlen ("SUN-DES-1") */ -#endif -#ifdef HASXDMAUTH - 19, /* strlen ("XDM-AUTHORIZATION-1") */ -#endif - 18 /* strlen ("MIT-MAGIC-COOKIE-1") */ -}; - -#define NUM_DEFAULT_AUTH (sizeof (default_xauth_names) / sizeof (default_xauth_names[0])) - -static char **xauth_names = default_xauth_names; -static _Xconst int *xauth_lengths = default_xauth_lengths; - -static int xauth_names_length = NUM_DEFAULT_AUTH; - -void XSetAuthorization ( - char *name, int namelen, /* *len are lengths of name and data */ - char *data, int datalen) /* name/data are NULL or arbitrary array of bytes */ -{ - char *tmpname, *tmpdata; - - _XLockMutex(_Xglobal_lock); - if (xauth_name) Xfree (xauth_name); /* free any existing data */ - if (xauth_data) Xfree (xauth_data); - - xauth_name = xauth_data = NULL; /* mark it no longer valid */ - xauth_namelen = xauth_datalen = 0; - _XUnlockMutex(_Xglobal_lock); - - if (namelen < 0) namelen = 0; /* check for bogus inputs */ - if (datalen < 0) datalen = 0; /* maybe should return? */ - - if (namelen > 0) { /* try to allocate space */ - tmpname = Xmalloc ((unsigned) namelen); - if (!tmpname) return; - memcpy (tmpname, name, namelen); - } else { - tmpname = NULL; - } - - if (datalen > 0) { - tmpdata = Xmalloc ((unsigned) datalen); - if (!tmpdata) { - if (tmpname) (void) Xfree (tmpname); - return; - } - memcpy (tmpdata, data, datalen); - } else { - tmpdata = NULL; - } - - _XLockMutex(_Xglobal_lock); - xauth_name = tmpname; /* and store the suckers */ - xauth_namelen = namelen; - if (tmpname) - { - xauth_names = &xauth_name; - xauth_lengths = &xauth_namelen; - xauth_names_length = 1; - } - else - { - xauth_names = default_xauth_names; - xauth_lengths = default_xauth_lengths; - xauth_names_length = NUM_DEFAULT_AUTH; - } - xauth_data = tmpdata; - xauth_datalen = datalen; - _XUnlockMutex(_Xglobal_lock); - return; -} - -#ifdef SECURE_RPC -/* - * Create a credential that we can send to the X server. - */ -static int -auth_ezencode( - char *servername, - int window, - char *cred_out, - int *len) -{ - AUTH *a; - XDR xdr; - -#if defined(SVR4) && defined(sun) - a = authdes_seccreate(servername, window, NULL, NULL); -#else - a = (AUTH *)authdes_create(servername, window, NULL, NULL); -#endif - if (a == (AUTH *)NULL) { - perror("auth_create"); - return 0; - } - xdrmem_create(&xdr, cred_out, *len, XDR_ENCODE); - if (AUTH_MARSHALL(a, &xdr) == FALSE) { - perror("auth_marshall"); - AUTH_DESTROY(a); - return 0; - } - *len = xdr_getpos(&xdr); - AUTH_DESTROY(a); - return 1; -} -#endif - -#ifdef K5AUTH -#include - -extern krb5_flags krb5_kdc_default_options; - -/* - * k5_clientauth - * - * Returns non-zero if the setup prefix has been read, - * so we can tell XOpenDisplay to not bother looking for it by - * itself. - */ -static int k5_clientauth(dpy, sprefix) - Display *dpy; - xConnSetupPrefix *sprefix; -{ - krb5_error_code retval; - xReq prefix; - char *buf; - CARD16 plen, tlen; - krb5_data kbuf; - krb5_ccache cc; - krb5_creds creds; - krb5_principal cprinc, sprinc; - krb5_ap_rep_enc_part *repl; - - krb5_init_ets(); - /* - * stage 0: get encoded principal and tgt from server - */ - _XRead(dpy, (char *)&prefix, sz_xReq); - if (prefix.reqType != 2 && prefix.reqType != 3) - /* not an auth packet... so deal */ - if (prefix.reqType == 0 || prefix.reqType == 1) - { - memcpy((char *)sprefix, (char *)&prefix, sz_xReq); - _XRead(dpy, (char *)sprefix + sz_xReq, - sz_xConnSetupPrefix - sz_xReq); /* ewww... gross */ - return 1; - } - else - { - fprintf(stderr, - "Xlib: Krb5 stage 0: got illegal connection setup success code %d\n", - prefix.reqType); - return -1; - } - if (prefix.data != 0) - { - fprintf(stderr, "Xlib: got out of sequence (%d) packet in Krb5 auth\n", - prefix.data); - return -1; - } - buf = (char *)malloc((prefix.length << 2) - sz_xReq); - if (buf == NULL) /* malloc failed. Run away! */ - { - fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); - return -1; - } - tlen = (prefix.length << 2) - sz_xReq; - _XRead(dpy, buf, tlen); - if (prefix.reqType == 2 && tlen < 6) - { - fprintf(stderr, "Xlib: Krb5 stage 0 reply from server too short\n"); - free(buf); - return -1; - } - if (prefix.reqType == 2) - { - plen = *(CARD16 *)buf; - kbuf.data = buf + 2; - kbuf.length = (plen > tlen) ? tlen : plen; - } - else - { - kbuf.data = buf; - kbuf.length = tlen; - } - if (XauKrb5Decode(kbuf, &sprinc)) - { - free(buf); - fprintf(stderr, "Xlib: XauKrb5Decode bombed\n"); - return -1; - } - if (prefix.reqType == 3) /* do some special stuff here */ - { - char *sname, *hostname = NULL; - - sname = (char *)malloc(krb5_princ_component(sprinc, 0)->length + 1); - if (sname == NULL) - { - free(buf); - krb5_free_principal(sprinc); - fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); - return -1; - } - memcpy(sname, krb5_princ_component(sprinc, 0)->data, - krb5_princ_component(sprinc, 0)->length); - sname[krb5_princ_component(sprinc, 0)->length] = '\0'; - krb5_free_principal(sprinc); - if (dpy->display_name[0] != ':') /* hunt for a hostname */ - { - char *t; - - if ((hostname = (char *)malloc(strlen(dpy->display_name))) - == NULL) - { - free(buf); - free(sname); - fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); - return -1; - } - strcpy(hostname, dpy->display_name); - t = strchr(hostname, ':'); - if (t == NULL) - { - free(buf); - free(sname); - free(hostname); - fprintf(stderr, - "Xlib: shouldn't get here! malformed display name."); - return -1; - } - if ((t - hostname + 1 < strlen(hostname)) && t[1] == ':') - t++; - *t = '\0'; /* truncate the dpy number out */ - } - retval = krb5_sname_to_principal(hostname, sname, - KRB5_NT_SRV_HST, &sprinc); - free(sname); - if (hostname) - free(hostname); - if (retval) - { - free(buf); - fprintf(stderr, "Xlib: krb5_sname_to_principal failed: %s\n", - error_message(retval)); - return -1; - } - } - if (retval = krb5_cc_default(&cc)) - { - free(buf); - krb5_free_principal(sprinc); - fprintf(stderr, "Xlib: krb5_cc_default failed: %s\n", - error_message(retval)); - return -1; - } - if (retval = krb5_cc_get_principal(cc, &cprinc)) - { - free(buf); - krb5_free_principal(sprinc); - fprintf(stderr, "Xlib: cannot get Kerberos principal from \"%s\": %s\n", - krb5_cc_default_name(), error_message(retval)); - return -1; - } - bzero((char *)&creds, sizeof(creds)); - creds.server = sprinc; - creds.client = cprinc; - if (prefix.reqType == 2) - { - creds.second_ticket.length = tlen - plen - 2; - creds.second_ticket.data = buf + 2 + plen; - retval = krb5_get_credentials(KRB5_GC_USER_USER | - krb5_kdc_default_options, - cc, &creds); - } - else - retval = krb5_get_credentials(krb5_kdc_default_options, - cc, &creds); - if (retval) - { - free(buf); - krb5_free_cred_contents(&creds); - fprintf(stderr, "Xlib: cannot get Kerberos credentials: %s\n", - error_message(retval)); - return -1; - } - /* - * now format the ap_req to send to the server - */ - if (prefix.reqType == 2) - retval = krb5_mk_req_extended(AP_OPTS_USE_SESSION_KEY | - AP_OPTS_MUTUAL_REQUIRED, NULL, - 0, 0, NULL, cc, - &creds, NULL, &kbuf); - else - retval = krb5_mk_req_extended(AP_OPTS_MUTUAL_REQUIRED, NULL, - 0, 0, NULL, cc, &creds, NULL, - &kbuf); - free(buf); - if (retval) /* Some manner of Kerberos lossage */ - { - krb5_free_cred_contents(&creds); - fprintf(stderr, "Xlib: krb5_mk_req_extended failed: %s\n", - error_message(retval)); - return -1; - } - prefix.reqType = 1; - prefix.data = 0; - prefix.length = (kbuf.length + sz_xReq + 3) >> 2; - /* - * stage 1: send ap_req to server - */ - _XSend(dpy, (char *)&prefix, sz_xReq); - _XSend(dpy, (char *)kbuf.data, kbuf.length); - free(kbuf.data); - /* - * stage 2: get ap_rep from server to mutually authenticate - */ - _XRead(dpy, (char *)&prefix, sz_xReq); - if (prefix.reqType != 2) - if (prefix.reqType == 0 || prefix.reqType == 1) - { - memcpy((char *)sprefix, (char *)&prefix, sz_xReq); - _XRead(dpy, (char *)sprefix + sz_xReq, - sz_xConnSetupPrefix - sz_xReq); - return 1; - } - else - { - fprintf(stderr, - "Xlib: Krb5 stage 2: got illegal connection setup success code %d\n", - prefix.reqType); - return -1; - } - if (prefix.data != 2) - return -1; - kbuf.length = (prefix.length << 2) - sz_xReq; - kbuf.data = (char *)malloc(kbuf.length); - if (kbuf.data == NULL) - { - fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); - return -1; - } - _XRead(dpy, (char *)kbuf.data, kbuf.length); - retval = krb5_rd_rep(&kbuf, &creds.keyblock, &repl); - if (retval) - { - free(kbuf.data); - fprintf(stderr, "Xlib: krb5_rd_rep failed: %s\n", - error_message(retval)); - return -1; - } - free(kbuf.data); - /* - * stage 3: send a short ack to the server and return - */ - prefix.reqType = 3; - prefix.data = 0; - prefix.length = sz_xReq >> 2; - _XSend(dpy, (char *)&prefix, sz_xReq); - return 0; -} -#endif /* K5AUTH */ - -static void -GetAuthorization( - XtransConnInfo trans_conn, - int family, - char *saddr, - int saddrlen, - int idisplay, - char **auth_namep, /* RETURN */ - int *auth_namelenp, /* RETURN */ - char **auth_datap, /* RETURN */ - int *auth_datalenp) /* RETURN */ -{ -#ifdef SECURE_RPC - char rpc_cred[MAX_AUTH_BYTES]; -#endif -#ifdef HASXDMAUTH - unsigned char xdmcp_data[192/8]; -#endif - char *auth_name; - int auth_namelen; - unsigned char *auth_data; - int auth_datalen; - Xauth *authptr = NULL; - -/* - * Look up the authorization protocol name and data if necessary. - */ - if (xauth_name && xauth_data) { - auth_namelen = xauth_namelen; - auth_name = xauth_name; - auth_datalen = xauth_datalen; - auth_data = (unsigned char *) xauth_data; - } else { - char dpynumbuf[40]; /* big enough to hold 2^64 and more */ - (void) sprintf (dpynumbuf, "%d", idisplay); - - authptr = XauGetBestAuthByAddr ((unsigned short) family, - (unsigned short) saddrlen, - saddr, - (unsigned short) strlen (dpynumbuf), - dpynumbuf, - xauth_names_length, - xauth_names, - xauth_lengths); - if (authptr) { - auth_namelen = authptr->name_length; - auth_name = (char *)authptr->name; - auth_datalen = authptr->data_length; - auth_data = (unsigned char *) authptr->data; - } else { - auth_namelen = 0; - auth_name = NULL; - auth_datalen = 0; - auth_data = NULL; - } - } -#ifdef HASXDMAUTH - /* - * build XDM-AUTHORIZATION-1 data - */ - if (auth_namelen == 19 && !strncmp (auth_name, "XDM-AUTHORIZATION-1", 19)) - { - int i, j; - Time_t now; - int family, addrlen; - Xtransaddr *addr = NULL; - - for (j = 0; j < 8; j++) - xdmcp_data[j] = auth_data[j]; - - _X11TransGetMyAddr(trans_conn, &family, &addrlen, &addr); - - switch( family ) - { -#ifdef AF_INET - case AF_INET: - { - /* - * addr will contain a sockaddr_in with all - * of the members already in network byte order. - */ - - for(i=4; i<8; i++) /* do sin_addr */ - xdmcp_data[j++] = ((char *)addr)[i]; - for(i=2; i<4; i++) /* do sin_port */ - xdmcp_data[j++] = ((char *)addr)[i]; - break; - } -#endif /* AF_INET */ -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: - /* XXX This should probably never happen */ - { - unsigned char ipv4mappedprefix[] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; - - /* In the case of v4 mapped addresses send the v4 - part of the address - addr is already in network byte order */ - if (memcmp((char*)addr+8, ipv4mappedprefix, 12) == 0) { - for (i = 20 ; i < 24; i++) - xdmcp_data[j++] = ((char *)addr)[i]; - - /* Port number */ - for (i=2; i<4; i++) - xdmcp_data[j++] = ((char *)addr)[i]; - } else { - /* Fake data to keep the data aligned. Otherwise the - the server will bail about incorrect timing data */ - for (i = 0; i < 6; i++) { - xdmcp_data[j++] = 0; - } - } - break; - } -#endif /* AF_INET6 */ -#ifdef AF_UNIX - case AF_UNIX: - { - /* - * We don't use the sockaddr_un for this encoding. - * Instead, we create a sockaddr_in filled with - * a decreasing counter for the address, and the - * pid for the port. - */ - - static unsigned long unix_addr = 0xFFFFFFFF; - unsigned long the_addr; - unsigned short the_port; - unsigned long the_utime; - struct timeval tp; - - X_GETTIMEOFDAY(&tp); - _XLockMutex(_Xglobal_lock); - the_addr = unix_addr--; - _XUnlockMutex(_Xglobal_lock); - the_utime = (unsigned long) tp.tv_usec; - the_port = getpid (); - - xdmcp_data[j++] = (the_utime >> 24) & 0xFF; - xdmcp_data[j++] = (the_utime >> 16) & 0xFF; - xdmcp_data[j++] = ((the_utime >> 8) & 0xF0) - | ((the_addr >> 8) & 0x0F); - xdmcp_data[j++] = (the_addr >> 0) & 0xFF; - xdmcp_data[j++] = (the_port >> 8) & 0xFF; - xdmcp_data[j++] = (the_port >> 0) & 0xFF; - break; - } -#endif /* AF_UNIX */ - default: - /* - * Need to return some kind of errro status here. - * maybe a NULL auth?? - */ - break; - } /* switch */ - - if (addr) - free ((char *) addr); - - time (&now); - xdmcp_data[j++] = (now >> 24) & 0xFF; - xdmcp_data[j++] = (now >> 16) & 0xFF; - xdmcp_data[j++] = (now >> 8) & 0xFF; - xdmcp_data[j++] = (now >> 0) & 0xFF; - while (j < 192 / 8) - xdmcp_data[j++] = 0; - _XLockMutex(_Xglobal_lock); - /* this function might use static data, hence the lock around it */ - XdmcpWrap (xdmcp_data, auth_data + 8, - xdmcp_data, j); - _XUnlockMutex(_Xglobal_lock); - auth_data = xdmcp_data; - auth_datalen = j; - } -#endif /* HASXDMAUTH */ -#ifdef SECURE_RPC - /* - * The SUN-DES-1 authorization protocol uses the - * "secure RPC" mechanism in SunOS 4.0+. - */ - if (auth_namelen == 9 && !strncmp(auth_name, "SUN-DES-1", 9)) { - char servernetname[MAXNETNAMELEN + 1]; - - /* - * Copy over the server's netname from the authorization - * data field filled in by XauGetAuthByAddr(). - */ - if (auth_datalen > MAXNETNAMELEN) { - auth_datalen = 0; - auth_data = NULL; - } else { - memcpy(servernetname, auth_data, auth_datalen); - servernetname[auth_datalen] = '\0'; - - auth_datalen = sizeof (rpc_cred); - if (auth_ezencode(servernetname, 100, rpc_cred, - &auth_datalen)) - auth_data = (unsigned char *) rpc_cred; - else { - auth_datalen = 0; - auth_data = NULL; - } - } - } -#endif - if (saddr) free ((char *) saddr); - if ((*auth_namelenp = auth_namelen)) - { - if ((*auth_namep = Xmalloc(auth_namelen))) - memcpy(*auth_namep, auth_name, auth_namelen); - else - *auth_namelenp = 0; - } - else - *auth_namep = NULL; - if ((*auth_datalenp = auth_datalen)) - { - if ((*auth_datap = Xmalloc(auth_datalen))) - memcpy(*auth_datap, auth_data, auth_datalen); - else - *auth_datalenp = 0; - } - else - *auth_datap = NULL; - if (authptr) XauDisposeAuth (authptr); -} diff --git a/nx-X11/lib/X11/Context.c b/nx-X11/lib/X11/Context.c deleted file mode 100644 index 8a078713a..000000000 --- a/nx-X11/lib/X11/Context.c +++ /dev/null @@ -1,302 +0,0 @@ - -/*********************************************************** -Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, - - All Rights Reserved - -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 -supporting documentation, and that the name Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -/* - -Copyright 1987, 1988, 1990, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* This module implements a simple sparse array. - - XSaveContext(a,b,c,d) will store d in position (a,b,c) of the array. - XFindContext(a,b,c,&d) will set d to be the value in position (a,b,c). - XDeleteContext(a,b,c) will delete the entry in (a,b,c). - - a is a display id, b is a resource id, and c is a Context. d is just an - XPointer. This code will work with any range of parameters, but is geared - to be most efficient with very few (one or two) different a's. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" -#ifdef XTHREADS -#include "locking.h" -#endif - -#define INITHASHMASK 63 /* Number of entries originally in the hash table. */ - -typedef struct _TableEntryRec { /* Stores one entry. */ - XID rid; - XContext context; - XPointer data; - struct _TableEntryRec *next; -} TableEntryRec, *TableEntry; - -typedef struct _XContextDB { /* Stores hash table for one display. */ - TableEntry *table; /* Pointer to array of hash entries. */ - int mask; /* Current size of hash table minus 1. */ - int numentries; /* Number of entries currently in table. */ -#ifdef XTHREADS - LockInfoRec linfo; -#endif -} DBRec, *DB; - -#ifdef MOTIFBC -static DB NullDB = (DB)0; -#endif - -/* Given an XID and a context, returns a value between 0 and HashSize-1. - Currently, this requires that HashSize be a power of 2. -*/ - -#define Hash(db,rid,context) \ - (db)->table[(((rid) << 1) + context) & (db)->mask] - -/* Resize the given db */ - -static void ResizeTable(DB db) -{ - TableEntry *otable; - register TableEntry entry, next, *pold, *head; - register int i, j; - - otable = db->table; - for (i = INITHASHMASK+1; (i + i) < db->numentries; ) - i += i; - db->table = Xcalloc(i, sizeof(TableEntry)); - if (!db->table) { - db->table = otable; - return; - } - j = db->mask + 1; - db->mask = i - 1; - for (pold = otable ; --j >= 0; pold++) { - for (entry = *pold; entry; entry = next) { - next = entry->next; - head = &Hash(db, entry->rid, entry->context); - entry->next = *head; - *head = entry; - } - } - Xfree(otable); -} - -static void _XFreeContextDB(Display *display) -{ - register DB db; - register int i; - register TableEntry *pentry, entry, next; - - db = display->context_db; - if (db) { - for (i = db->mask + 1, pentry = db->table ; --i >= 0; pentry++) { - for (entry = *pentry; entry; entry = next) { - next = entry->next; - Xfree(entry); - } - } - Xfree(db->table); - _XFreeMutex(&db->linfo); - Xfree(db); - } -} - -/* Public routines. */ - -/* Save the given value of data to correspond with the keys XID and context. - Returns nonzero error code if an error has occured, 0 otherwise. - Possible errors are Out-of-memory. -*/ - -int XSaveContext( - Display *display, - register XID rid, - register XContext context, - _Xconst char* data) -{ - DB *pdb; - register DB db; - TableEntry *head; - register TableEntry entry; - -#ifdef MOTIFBC - if (!display) { - pdb = &NullDB; - db = *pdb; - } else -#endif - { - LockDisplay(display); - pdb = &display->context_db; - db = *pdb; - UnlockDisplay(display); - } - if (!db) { - db = Xmalloc(sizeof(DBRec)); - if (!db) - return XCNOMEM; - db->mask = INITHASHMASK; - db->table = Xcalloc(db->mask + 1, sizeof(TableEntry)); - if (!db->table) { - Xfree(db); - return XCNOMEM; - } - db->numentries = 0; - _XCreateMutex(&db->linfo); -#ifdef MOTIFBC - if (!display) *pdb = db; else -#endif - { - LockDisplay(display); - *pdb = db; - display->free_funcs->context_db = _XFreeContextDB; - UnlockDisplay(display); - } - } - _XLockMutex(&db->linfo); - head = &Hash(db, rid, context); - _XUnlockMutex(&db->linfo); - for (entry = *head; entry; entry = entry->next) { - if (entry->rid == rid && entry->context == context) { - entry->data = (XPointer)data; - return 0; - } - } - entry = Xmalloc(sizeof(TableEntryRec)); - if (!entry) - return XCNOMEM; - entry->rid = rid; - entry->context = context; - entry->data = (XPointer)data; - entry->next = *head; - *head = entry; - _XLockMutex(&db->linfo); - db->numentries++; - if (db->numentries > (db->mask << 2)) - ResizeTable(db); - _XUnlockMutex(&db->linfo); - return 0; -} - - - -/* Given an XID and context, returns the associated data. Note that data - here is a pointer since it is a return value. Returns nonzero error code - if an error has occured, 0 otherwise. Possible errors are Entry-not-found. -*/ - -int XFindContext(Display *display, XID rid, XContext context, XPointer *data) -{ - register DB db; - register TableEntry entry; - -#ifdef MOTIFBC - if (!display) db = NullDB; else -#endif - { - LockDisplay(display); - db = display->context_db; - UnlockDisplay(display); - } - if (!db) - return XCNOENT; - _XLockMutex(&db->linfo); - for (entry = Hash(db, rid, context); entry; entry = entry->next) - { - if (entry->rid == rid && entry->context == context) { - *data = (XPointer)entry->data; - _XUnlockMutex(&db->linfo); - return 0; - } - } - _XUnlockMutex(&db->linfo); - return XCNOENT; -} - - - -/* Deletes the entry for the given XID and context from the datastructure. - This returns the same thing that FindContext would have returned if called - with the same arguments. -*/ - -int XDeleteContext(Display *display, XID rid, XContext context) -{ - register DB db; - register TableEntry entry, *prev; - -#ifdef MOTIFBC - if (!display) db = NullDB; else -#endif - { - LockDisplay(display); - db = display->context_db; - UnlockDisplay(display); - } - if (!db) - return XCNOENT; - _XLockMutex(&db->linfo); - for (prev = &Hash(db, rid, context); - (entry = *prev); - prev = &entry->next) { - if (entry->rid == rid && entry->context == context) { - *prev = entry->next; - Xfree(entry); - db->numentries--; - if (db->numentries < db->mask && db->mask > INITHASHMASK) - ResizeTable(db); - _XUnlockMutex(&db->linfo); - return 0; - } - } - _XUnlockMutex(&db->linfo); - return XCNOENT; -} diff --git a/nx-X11/lib/X11/ConvSel.c b/nx-X11/lib/X11/ConvSel.c deleted file mode 100644 index fb6e8e338..000000000 --- a/nx-X11/lib/X11/ConvSel.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1986,1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XConvertSelection( - register Display *dpy, - Atom selection, - Atom target, - Atom property, - Window requestor, - Time time) -{ - register xConvertSelectionReq *req; - - LockDisplay(dpy); - GetReq(ConvertSelection, req); - req->selection = selection; - req->target = target; - req->property = property; - req->requestor = requestor; - req->time = time; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/CopyArea.c b/nx-X11/lib/X11/CopyArea.c deleted file mode 100644 index 582582120..000000000 --- a/nx-X11/lib/X11/CopyArea.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XCopyArea( - register Display *dpy, - Drawable src_drawable, - Drawable dst_drawable, - GC gc, - int src_x, - int src_y, - unsigned int width, - unsigned int height, - int dst_x, - int dst_y) - -{ - register xCopyAreaReq *req; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq(CopyArea, req); - req->srcDrawable = src_drawable; - req->dstDrawable = dst_drawable; - req->gc = gc->gid; - req->srcX = src_x; - req->srcY = src_y; - req->dstX = dst_x; - req->dstY = dst_y; - req->width = width; - req->height = height; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/CopyCmap.c b/nx-X11/lib/X11/CopyCmap.c deleted file mode 100644 index 5444550cd..000000000 --- a/nx-X11/lib/X11/CopyCmap.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#else -#define XCMS 1 -#endif -#include "Xlibint.h" - -#if XCMS -#include "Xcmsint.h" - -/* cmsCmap.c */ -extern XcmsCmapRec * _XcmsCopyCmapRecAndFree(Display *dpy, - Colormap src_cmap, - Colormap copy_cmap); -#endif - -Colormap XCopyColormapAndFree( - register Display *dpy, - Colormap src_cmap) -{ - Colormap mid; - register xCopyColormapAndFreeReq *req; - - LockDisplay(dpy); - GetReq(CopyColormapAndFree, req); - - mid = req->mid = XAllocID(dpy); - req->srcCmap = src_cmap; - - UnlockDisplay(dpy); - SyncHandle(); - -#if XCMS - _XcmsCopyCmapRecAndFree(dpy, src_cmap, mid); -#endif - - return(mid); -} diff --git a/nx-X11/lib/X11/CopyGC.c b/nx-X11/lib/X11/CopyGC.c deleted file mode 100644 index 9c71249cf..000000000 --- a/nx-X11/lib/X11/CopyGC.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XCopyGC ( - register Display *dpy, - GC srcGC, - unsigned long mask, /* which ones to set initially */ - GC destGC) -{ - register XGCValues *destgv = &destGC->values, - *srcgv = &srcGC->values; - register xCopyGCReq *req; - register _XExtension *ext; - - LockDisplay(dpy); - - mask &= (1L << (GCLastBit + 1)) - 1; - /* if some of the source values to be copied are "dirty", flush them - out before sending the CopyGC request. */ - if (srcGC->dirty & mask) - _XFlushGCCache(dpy, srcGC); - - /* mark the copied values "not dirty" in the destination. */ - destGC->dirty &= ~mask; - - GetReq(CopyGC, req); - req->srcGC = srcGC->gid; - req->dstGC = destGC->gid; - req->mask = mask; - - if (mask & GCFunction) - destgv->function = srcgv->function; - - if (mask & GCPlaneMask) - destgv->plane_mask = srcgv->plane_mask; - - if (mask & GCForeground) - destgv->foreground = srcgv->foreground; - - if (mask & GCBackground) - destgv->background = srcgv->background; - - if (mask & GCLineWidth) - destgv->line_width = srcgv->line_width; - - if (mask & GCLineStyle) - destgv->line_style = srcgv->line_style; - - if (mask & GCCapStyle) - destgv->cap_style = srcgv->cap_style; - - if (mask & GCJoinStyle) - destgv->join_style = srcgv->join_style; - - if (mask & GCFillStyle) - destgv->fill_style = srcgv->fill_style; - - if (mask & GCFillRule) - destgv->fill_rule = srcgv->fill_rule; - - if (mask & GCArcMode) - destgv->arc_mode = srcgv->arc_mode; - - if (mask & GCTile) - destgv->tile = srcgv->tile; - - if (mask & GCStipple) - destgv->stipple = srcgv->stipple; - - if (mask & GCTileStipXOrigin) - destgv->ts_x_origin = srcgv->ts_x_origin; - - if (mask & GCTileStipYOrigin) - destgv->ts_y_origin = srcgv->ts_y_origin; - - if (mask & GCFont) - destgv->font = srcgv->font; - - if (mask & GCSubwindowMode) - destgv->subwindow_mode = srcgv->subwindow_mode; - - if (mask & GCGraphicsExposures) - destgv->graphics_exposures = srcgv->graphics_exposures; - - if (mask & GCClipXOrigin) - destgv->clip_x_origin = srcgv->clip_x_origin; - - if (mask & GCClipYOrigin) - destgv->clip_y_origin = srcgv->clip_y_origin; - - if (mask & GCClipMask) { - destGC->rects = srcGC->rects; - destgv->clip_mask = srcgv->clip_mask; - } - - if (mask & GCDashOffset) - destgv->dash_offset = srcgv->dash_offset; - - if (mask & GCDashList) { - destGC->dashes = srcGC->dashes; - destgv->dashes = srcgv->dashes; - } - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->copy_GC) (*ext->copy_GC)(dpy, destGC, &ext->codes); - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } diff --git a/nx-X11/lib/X11/CopyPlane.c b/nx-X11/lib/X11/CopyPlane.c deleted file mode 100644 index 818687687..000000000 --- a/nx-X11/lib/X11/CopyPlane.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XCopyPlane( - register Display *dpy, - Drawable src_drawable, - Drawable dst_drawable, - GC gc, - int src_x, - int src_y, - unsigned int width, - unsigned int height, - int dst_x, - int dst_y, - unsigned long bit_plane) - -{ - register xCopyPlaneReq *req; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq(CopyPlane, req); - req->srcDrawable = src_drawable; - req->dstDrawable = dst_drawable; - req->gc = gc->gid; - req->srcX = src_x; - req->srcY = src_y; - req->dstX = dst_x; - req->dstY = dst_y; - req->width = width; - req->height = height; - req->bitPlane = bit_plane; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/Cr.h b/nx-X11/lib/X11/Cr.h deleted file mode 100644 index e71d86d1c..000000000 --- a/nx-X11/lib/X11/Cr.h +++ /dev/null @@ -1,29 +0,0 @@ - -#ifndef _CR_H_ -#define _CR_H_ - -#include - -extern int _XUpdateGCCache( - register GC gc, - register unsigned long mask, - register XGCValues *attr); -extern void _XNoticeCreateBitmap( - Display *dpy, - Pixmap pid, - unsigned int width, - unsigned int height); -extern void _XNoticePutBitmap( - Display *dpy, - Drawable draw, - XImage *image); -extern Cursor _XTryShapeBitmapCursor( - Display *dpy, - Pixmap source, - Pixmap mask, - XColor *foreground, - XColor *background, - unsigned int x, - unsigned int y); - -#endif /* _CR_H_ */ diff --git a/nx-X11/lib/X11/CrBFData.c b/nx-X11/lib/X11/CrBFData.c deleted file mode 100644 index 6708a9b91..000000000 --- a/nx-X11/lib/X11/CrBFData.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlib.h" - -/* - * XCreateBitmapFromData: Routine to make a pixmap of depth 1 from user - * supplied data. - * D is any drawable on the same screen that the pixmap will be used in. - * Data is a pointer to the bit data, and - * width & height give the size in bits of the pixmap. - * - * The following format is assumed for data: - * - * format=XYPixmap - * bit_order=LSBFirst - * byte_order=LSBFirst - * padding=8 - * bitmap_unit=8 - * xoffset=0 - * no extra bytes per line - */ -Pixmap XCreateBitmapFromData( - Display *display, - Drawable d, - _Xconst char *data, - unsigned int width, - unsigned int height) -{ - Pixmap pix = XCreatePixmap(display, d, width, height, 1); - GC gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); - if (gc == NULL) { - XFreePixmap(display, pix); - return (Pixmap) None; - } else { - XImage ximage = { - .height = height, - .width = width, - .depth = 1, - .bits_per_pixel = 1, - .xoffset = 0, - .format = XYPixmap, - .data = (char *) data, - .byte_order = LSBFirst, - .bitmap_unit = 8, - .bitmap_bit_order = LSBFirst, - .bitmap_pad = 8, - .bytes_per_line = (width + 7) / 8, - }; - XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); - XFreeGC(display, gc); - return(pix); - } -} diff --git a/nx-X11/lib/X11/CrCmap.c b/nx-X11/lib/X11/CrCmap.c deleted file mode 100644 index 9904c7dda..000000000 --- a/nx-X11/lib/X11/CrCmap.c +++ /dev/null @@ -1,59 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" - - -Colormap XCreateColormap( - register Display *dpy, - Window w, - Visual *visual, - int alloc) -{ - register xCreateColormapReq *req; - Colormap mid; - - LockDisplay(dpy); - GetReq(CreateColormap, req); - req->window = w; - mid = req->mid = XAllocID(dpy); - req->alloc = alloc; - if (visual == CopyFromParent) req->visual = CopyFromParent; - else req->visual = visual->visualid; - - UnlockDisplay(dpy); - SyncHandle(); - -#ifdef XCMS - _XcmsAddCmapRec(dpy, mid, w, visual); -#endif - - return(mid); -} diff --git a/nx-X11/lib/X11/CrCursor.c b/nx-X11/lib/X11/CrCursor.c deleted file mode 100644 index c8c174e5f..000000000 --- a/nx-X11/lib/X11/CrCursor.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#ifdef USE_DYNAMIC_XCURSOR -Cursor -_XTryShapeBitmapCursor (Display *dpy, - Pixmap source, - Pixmap mask, - XColor *foreground, - XColor *background, - unsigned int x, - unsigned int y); -#endif - -Cursor XCreatePixmapCursor( - register Display *dpy, - Pixmap source, - Pixmap mask, - XColor *foreground, - XColor *background, - unsigned int x, - unsigned int y) - -{ - register xCreateCursorReq *req; - Cursor cid; - -#ifdef USE_DYNAMIC_XCURSOR - cid = _XTryShapeBitmapCursor (dpy, source, mask, - foreground, background, x, y); - if (cid) - return cid; -#endif - LockDisplay(dpy); - GetReq(CreateCursor, req); - req->cid = cid = XAllocID(dpy); - req->source = source; - req->mask = mask; - req->foreRed = foreground->red; - req->foreGreen = foreground->green; - req->foreBlue = foreground->blue; - req->backRed = background->red; - req->backGreen = background->green; - req->backBlue = background->blue; - req->x = x; - req->y = y; - UnlockDisplay(dpy); - SyncHandle(); - return (cid); -} - diff --git a/nx-X11/lib/X11/CrGC.c b/nx-X11/lib/X11/CrGC.c deleted file mode 100644 index 2d5f17c00..000000000 --- a/nx-X11/lib/X11/CrGC.c +++ /dev/null @@ -1,345 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Cr.h" - -static XGCValues const initial_GC = { - GXcopy, /* function */ - AllPlanes, /* plane_mask */ - 0L, /* foreground */ - 1L, /* background */ - 0, /* line_width */ - LineSolid, /* line_style */ - CapButt, /* cap_style */ - JoinMiter, /* join_style */ - FillSolid, /* fill_style */ - EvenOddRule,/* fill_rule */ - ArcPieSlice,/* arc_mode */ - (Pixmap)~0L,/* tile, impossible (unknown) resource */ - (Pixmap)~0L,/* stipple, impossible (unknown) resource */ - 0, /* ts_x_origin */ - 0, /* ts_y_origin */ - (Font)~0L, /* font, impossible (unknown) resource */ - ClipByChildren, /* subwindow_mode */ - True, /* graphics_exposures */ - 0, /* clip_x_origin */ - 0, /* clip_y_origin */ - None, /* clip_mask */ - 0, /* dash_offset */ - 4 /* dashes (list [4,4]) */ -}; - -static void _XGenerateGCList( - register Display *dpy, - GC gc, - xReq *req); - -GC XCreateGC ( - register Display *dpy, - Drawable d, /* Window or Pixmap for which depth matches */ - unsigned long valuemask, /* which ones to set initially */ - XGCValues *values) /* the values themselves */ -{ - register GC gc; - register xCreateGCReq *req; - register _XExtension *ext; - - LockDisplay(dpy); - if ((gc = Xmalloc (sizeof(struct _XGC))) == NULL) { - UnlockDisplay(dpy); - SyncHandle(); - return (NULL); - } - gc->rects = 0; - gc->dashes = 0; - gc->ext_data = NULL; - gc->values = initial_GC; - gc->dirty = 0L; - - valuemask &= (1L << (GCLastBit + 1)) - 1; - if (valuemask) _XUpdateGCCache (gc, valuemask, values); - - GetReq(CreateGC, req); - req->drawable = d; - req->gc = gc->gid = XAllocID(dpy); - - if ((req->mask = gc->dirty)) - _XGenerateGCList (dpy, gc, (xReq *) req); - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->create_GC) (*ext->create_GC)(dpy, gc, &ext->codes); - gc->dirty = 0L; /* allow extensions to see dirty bits */ - UnlockDisplay(dpy); - SyncHandle(); - return (gc); - } - -/* - * GenerateGCList looks at the GC dirty bits, and appends all the required - * long words to the request being generated. - */ - -static void -_XGenerateGCList ( - register Display *dpy, - GC gc, - xReq *req) - { - unsigned long values[32]; - register unsigned long *value = values; - long nvalues; - register XGCValues *gv = &gc->values; - register unsigned long dirty = gc->dirty; - - /* - * Note: The order of these tests are critical; the order must be the - * same as the GC mask bits in the word. - */ - if (dirty & GCFunction) *value++ = gv->function; - if (dirty & GCPlaneMask) *value++ = gv->plane_mask; - if (dirty & GCForeground) *value++ = gv->foreground; - if (dirty & GCBackground) *value++ = gv->background; - if (dirty & GCLineWidth) *value++ = gv->line_width; - if (dirty & GCLineStyle) *value++ = gv->line_style; - if (dirty & GCCapStyle) *value++ = gv->cap_style; - if (dirty & GCJoinStyle) *value++ = gv->join_style; - if (dirty & GCFillStyle) *value++ = gv->fill_style; - if (dirty & GCFillRule) *value++ = gv->fill_rule; - if (dirty & GCTile) *value++ = gv->tile; - if (dirty & GCStipple) *value++ = gv->stipple; - if (dirty & GCTileStipXOrigin) *value++ = gv->ts_x_origin; - if (dirty & GCTileStipYOrigin) *value++ = gv->ts_y_origin; - if (dirty & GCFont) *value++ = gv->font; - if (dirty & GCSubwindowMode) *value++ = gv->subwindow_mode; - if (dirty & GCGraphicsExposures) *value++ = gv->graphics_exposures; - if (dirty & GCClipXOrigin) *value++ = gv->clip_x_origin; - if (dirty & GCClipYOrigin) *value++ = gv->clip_y_origin; - if (dirty & GCClipMask) *value++ = gv->clip_mask; - if (dirty & GCDashOffset) *value++ = gv->dash_offset; - if (dirty & GCDashList) *value++ = gv->dashes; - if (dirty & GCArcMode) *value++ = gv->arc_mode; - - req->length += (nvalues = value - values); - - /* - * note: Data is a macro that uses its arguments multiple - * times, so "nvalues" is changed in a separate assignment - * statement - */ - - nvalues <<= 2; - Data32 (dpy, (long *) values, nvalues); - - } - - -int -_XUpdateGCCache ( - register GC gc, - register unsigned long mask, - register XGCValues *attr) -{ - register XGCValues *gv = &gc->values; - - if (mask & GCFunction) - if (gv->function != attr->function) { - gv->function = attr->function; - gc->dirty |= GCFunction; - } - - if (mask & GCPlaneMask) - if (gv->plane_mask != attr->plane_mask) { - gv->plane_mask = attr->plane_mask; - gc->dirty |= GCPlaneMask; - } - - if (mask & GCForeground) - if (gv->foreground != attr->foreground) { - gv->foreground = attr->foreground; - gc->dirty |= GCForeground; - } - - if (mask & GCBackground) - if (gv->background != attr->background) { - gv->background = attr->background; - gc->dirty |= GCBackground; - } - - if (mask & GCLineWidth) - if (gv->line_width != attr->line_width) { - gv->line_width = attr->line_width; - gc->dirty |= GCLineWidth; - } - - if (mask & GCLineStyle) - if (gv->line_style != attr->line_style) { - gv->line_style = attr->line_style; - gc->dirty |= GCLineStyle; - } - - if (mask & GCCapStyle) - if (gv->cap_style != attr->cap_style) { - gv->cap_style = attr->cap_style; - gc->dirty |= GCCapStyle; - } - - if (mask & GCJoinStyle) - if (gv->join_style != attr->join_style) { - gv->join_style = attr->join_style; - gc->dirty |= GCJoinStyle; - } - - if (mask & GCFillStyle) - if (gv->fill_style != attr->fill_style) { - gv->fill_style = attr->fill_style; - gc->dirty |= GCFillStyle; - } - - if (mask & GCFillRule) - if (gv->fill_rule != attr->fill_rule) { - gv->fill_rule = attr->fill_rule; - gc->dirty |= GCFillRule; - } - - if (mask & GCArcMode) - if (gv->arc_mode != attr->arc_mode) { - gv->arc_mode = attr->arc_mode; - gc->dirty |= GCArcMode; - } - - /* always write through tile change, since client may have changed pixmap contents */ - if (mask & GCTile) { - gv->tile = attr->tile; - gc->dirty |= GCTile; - } - - /* always write through stipple change, since client may have changed pixmap contents */ - if (mask & GCStipple) { - gv->stipple = attr->stipple; - gc->dirty |= GCStipple; - } - - if (mask & GCTileStipXOrigin) - if (gv->ts_x_origin != attr->ts_x_origin) { - gv->ts_x_origin = attr->ts_x_origin; - gc->dirty |= GCTileStipXOrigin; - } - - if (mask & GCTileStipYOrigin) - if (gv->ts_y_origin != attr->ts_y_origin) { - gv->ts_y_origin = attr->ts_y_origin; - gc->dirty |= GCTileStipYOrigin; - } - - if (mask & GCFont) - if (gv->font != attr->font) { - gv->font = attr->font; - gc->dirty |= GCFont; - } - - if (mask & GCSubwindowMode) - if (gv->subwindow_mode != attr->subwindow_mode) { - gv->subwindow_mode = attr->subwindow_mode; - gc->dirty |= GCSubwindowMode; - } - - if (mask & GCGraphicsExposures) - if (gv->graphics_exposures != attr->graphics_exposures) { - gv->graphics_exposures = attr->graphics_exposures; - gc->dirty |= GCGraphicsExposures; - } - - if (mask & GCClipXOrigin) - if (gv->clip_x_origin != attr->clip_x_origin) { - gv->clip_x_origin = attr->clip_x_origin; - gc->dirty |= GCClipXOrigin; - } - - if (mask & GCClipYOrigin) - if (gv->clip_y_origin != attr->clip_y_origin) { - gv->clip_y_origin = attr->clip_y_origin; - gc->dirty |= GCClipYOrigin; - } - - /* always write through mask change, since client may have changed pixmap contents */ - if (mask & GCClipMask) { - gv->clip_mask = attr->clip_mask; - gc->dirty |= GCClipMask; - gc->rects = 0; - } - - if (mask & GCDashOffset) - if (gv->dash_offset != attr->dash_offset) { - gv->dash_offset = attr->dash_offset; - gc->dirty |= GCDashOffset; - } - - if (mask & GCDashList) - if ((gv->dashes != attr->dashes) || (gc->dashes == True)) { - gv->dashes = attr->dashes; - gc->dirty |= GCDashList; - gc->dashes = 0; - } - return 0; -} - -/* can only call when display is already locked. */ - -void _XFlushGCCache( - Display *dpy, - GC gc) -{ - register xChangeGCReq *req; - register _XExtension *ext; - - if (gc->dirty) { - GetReq(ChangeGC, req); - req->gc = gc->gid; - req->mask = gc->dirty; - _XGenerateGCList (dpy, gc, (xReq *) req); - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); - gc->dirty = 0L; /* allow extensions to see dirty bits */ - } -} - -void -XFlushGC( - Display *dpy, - GC gc) -{ - FlushGC(dpy, gc); -} - -GContext XGContextFromGC(GC gc) -{ - return (gc->gid); -} diff --git a/nx-X11/lib/X11/CrGlCur.c b/nx-X11/lib/X11/CrGlCur.c deleted file mode 100644 index 88133b7f4..000000000 --- a/nx-X11/lib/X11/CrGlCur.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#ifdef USE_DYNAMIC_XCURSOR - -#include -#include -#include -#include "Cr.h" - -#ifdef __CYGWIN__ -#define LIBXCURSOR "cygXcursor-1.dll" -#endif - -typedef void *XModuleType; - -#ifndef LIBXCURSOR -#define LIBXCURSOR "libXcursor.so.1" -#endif - -static char libraryName[] = LIBXCURSOR; - -static XModuleType -open_library (void) -{ - char *library = libraryName; - char *dot; - XModuleType module; - for (;;) - { - module = dlopen(library, RTLD_LAZY); - if (module) - return module; - dot = strrchr (library, '.'); - if (!dot) - break; - *dot = '\0'; - } - return NULL; -} - -static void * -fetch_symbol (XModuleType module, const char *under_symbol) -{ - void *result = NULL; - const char *symbol = under_symbol + 1; - result = dlsym (module, symbol); - if (!result) - result = dlsym (module, under_symbol); - return result; -} - -typedef void (*NoticeCreateBitmapFunc) (Display *dpy, - Pixmap pid, - unsigned int width, - unsigned int height); - -typedef void (*NoticePutBitmapFunc) (Display *dpy, - Drawable draw, - XImage *image); - -typedef Cursor (*TryShapeBitmapCursorFunc) (Display *dpy, - Pixmap source, - Pixmap mask, - XColor *foreground, - XColor *background, - unsigned int x, - unsigned int y); - -typedef Cursor (*TryShapeCursorFunc) (Display *dpy, - Font source_font, - Font mask_font, - unsigned int source_char, - unsigned int mask_char, - XColor _Xconst *foreground, - XColor _Xconst *background); - -static XModuleType _XcursorModule; -static Bool _XcursorModuleTried; - -#define GetFunc(type,name,ret) {\ - static Bool been_here; \ - static type staticFunc; \ - \ - _XLockMutex (_Xglobal_lock); \ - if (!been_here) \ - { \ - been_here = True; \ - if (!_XcursorModuleTried) \ - { \ - _XcursorModuleTried = True; \ - _XcursorModule = open_library (); \ - } \ - if (_XcursorModule) \ - staticFunc = (type) fetch_symbol (_XcursorModule, "_" name); \ - } \ - ret = staticFunc; \ - _XUnlockMutex (_Xglobal_lock); \ -} - -static Cursor -_XTryShapeCursor (Display *dpy, - Font source_font, - Font mask_font, - unsigned int source_char, - unsigned int mask_char, - XColor _Xconst *foreground, - XColor _Xconst *background) -{ - TryShapeCursorFunc func; - - GetFunc (TryShapeCursorFunc, "XcursorTryShapeCursor", func); - if (func) - return (*func) (dpy, source_font, mask_font, source_char, mask_char, - foreground, background); - return None; -} - -void -_XNoticeCreateBitmap (Display *dpy, - Pixmap pid, - unsigned int width, - unsigned int height) -{ - NoticeCreateBitmapFunc func; - - GetFunc (NoticeCreateBitmapFunc, "XcursorNoticeCreateBitmap", func); - if (func) - (*func) (dpy, pid, width, height); -} - -void -_XNoticePutBitmap (Display *dpy, - Drawable draw, - XImage *image) -{ - NoticePutBitmapFunc func; - - GetFunc (NoticePutBitmapFunc, "XcursorNoticePutBitmap", func); - if (func) - (*func) (dpy, draw, image); -} - -Cursor -_XTryShapeBitmapCursor (Display *dpy, - Pixmap source, - Pixmap mask, - XColor *foreground, - XColor *background, - unsigned int x, - unsigned int y) -{ - TryShapeBitmapCursorFunc func; - - GetFunc (TryShapeBitmapCursorFunc, "XcursorTryShapeBitmapCursor", func); - if (func) - return (*func) (dpy, source, mask, foreground, background, x, y); - return None; -} -#endif - -Cursor XCreateGlyphCursor( - register Display *dpy, - Font source_font, - Font mask_font, - unsigned int source_char, - unsigned int mask_char, - XColor _Xconst *foreground, - XColor _Xconst *background) -{ - Cursor cid; - register xCreateGlyphCursorReq *req; - -#ifdef USE_DYNAMIC_XCURSOR - cid = _XTryShapeCursor (dpy, source_font, mask_font, - source_char, mask_char, foreground, background); - if (cid) - return cid; -#endif - LockDisplay(dpy); - GetReq(CreateGlyphCursor, req); - cid = req->cid = XAllocID(dpy); - req->source = source_font; - req->mask = mask_font; - req->sourceChar = source_char; - req->maskChar = mask_char; - req->foreRed = foreground->red; - req->foreGreen = foreground->green; - req->foreBlue = foreground->blue; - req->backRed = background->red; - req->backGreen = background->green; - req->backBlue = background->blue; - UnlockDisplay(dpy); - SyncHandle(); - return (cid); -} - diff --git a/nx-X11/lib/X11/CrPFBData.c b/nx-X11/lib/X11/CrPFBData.c deleted file mode 100644 index 17d551bb7..000000000 --- a/nx-X11/lib/X11/CrPFBData.c +++ /dev/null @@ -1,89 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlib.h" -#include - -/* - * XCreatePixmapFromBitmapData: Routine to make a pixmap from user supplied bitmap data. - * D is any drawable on the same screen that the pixmap will be used in. - * Data is a pointer to the bit data, and - * width & height give the size in bits of the pixmap. - * Fg and Bg are the pixel values to use for the two colors. - * Depth is the depth of the pixmap to create. - * - * The following format is assumed for data: - * - * format=XYPixmap - * bit_order=LSBFirst - * byte_order=LSBFirst - * padding=8 - * bitmap_unit=8 - * xoffset=0 - * no extra bytes per line - */ -Pixmap XCreatePixmapFromBitmapData( - Display *display, - Drawable d, - char *data, - unsigned int width, - unsigned int height, - unsigned long fg, - unsigned long bg, - unsigned int depth) -{ - Pixmap pix = XCreatePixmap(display, d, width, height, depth); - XGCValues gcv = { - .foreground = fg, - .background = bg - }; - GC gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); - if (gc == NULL) { - XFreePixmap(display, pix); - return (Pixmap) None; - } else { - XImage ximage = { - .height = height, - .width = width, - .depth = 1, - .bits_per_pixel = 1, - .xoffset = 0, - .format = XYBitmap, - .data = data, - .byte_order = LSBFirst, - .bitmap_unit = 8, - .bitmap_bit_order = LSBFirst, - .bitmap_pad = 8, - .bytes_per_line = (width + 7) / 8 - }; - XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); - XFreeGC(display, gc); - return(pix); - } -} diff --git a/nx-X11/lib/X11/CrPixmap.c b/nx-X11/lib/X11/CrPixmap.c deleted file mode 100644 index cdf312076..000000000 --- a/nx-X11/lib/X11/CrPixmap.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#ifdef USE_DYNAMIC_XCURSOR -void -_XNoticeCreateBitmap (Display *dpy, - Pixmap pid, - unsigned int width, - unsigned int height); -#endif - -Pixmap XCreatePixmap ( - register Display *dpy, - Drawable d, - unsigned int width, - unsigned int height, - unsigned int depth) -{ - Pixmap pid; - register xCreatePixmapReq *req; - - LockDisplay(dpy); - GetReq(CreatePixmap, req); - req->drawable = d; - req->width = width; - req->height = height; - req->depth = depth; - pid = req->pid = XAllocID(dpy); - UnlockDisplay(dpy); - SyncHandle(); -#ifdef USE_DYNAMIC_XCURSOR - if (depth == 1) - _XNoticeCreateBitmap (dpy, pid, width, height); -#endif - return (pid); -} - diff --git a/nx-X11/lib/X11/CrWindow.c b/nx-X11/lib/X11/CrWindow.c deleted file mode 100644 index 7b5460186..000000000 --- a/nx-X11/lib/X11/CrWindow.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Window XCreateSimpleWindow( - register Display *dpy, - Window parent, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned int borderWidth, - unsigned long border, - unsigned long background) -{ - Window wid; - register xCreateWindowReq *req; - - LockDisplay(dpy); - GetReqExtra(CreateWindow, 8, req); - req->parent = parent; - req->x = x; - req->y = y; - req->width = width; - req->height = height; - req->borderWidth = borderWidth; - req->depth = 0; - req->class = CopyFromParent; - req->visual = CopyFromParent; - wid = req->wid = XAllocID(dpy); - req->mask = CWBackPixel | CWBorderPixel; - - { - register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xCreateWindowReq); - *valuePtr++ = background; - *valuePtr = border; - } - - UnlockDisplay(dpy); - SyncHandle(); - return (wid); - } diff --git a/nx-X11/lib/X11/Cursor.c b/nx-X11/lib/X11/Cursor.c deleted file mode 100644 index 80b91c36d..000000000 --- a/nx-X11/lib/X11/Cursor.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */ -static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */ - -Cursor XCreateFontCursor( - Display *dpy, - unsigned int which) -{ - /* - * the cursor font contains the shape glyph followed by the mask - * glyph; so character position 0 contains a shape, 1 the mask for 0, - * 2 a shape, etc. contains hash define names - * for all of these. - */ - - if (dpy->cursor_font == None) { - dpy->cursor_font = XLoadFont (dpy, CURSORFONT); - if (dpy->cursor_font == None) return None; - } - - return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, - which, which + 1, &foreground, &background); -} - diff --git a/nx-X11/lib/X11/Cv.h b/nx-X11/lib/X11/Cv.h deleted file mode 100644 index 0b662811f..000000000 --- a/nx-X11/lib/X11/Cv.h +++ /dev/null @@ -1,189 +0,0 @@ - -#ifndef _CV_H_ -#define _CV_H_ - -/* variables */ -extern const char _XcmsCIEXYZ_prefix[]; -extern const char _XcmsCIEuvY_prefix[]; -extern const char _XcmsCIExyY_prefix[]; -extern const char _XcmsCIELab_prefix[]; -extern const char _XcmsCIELuv_prefix[]; -extern const char _XcmsTekHVC_prefix[]; -extern const char _XcmsRGBi_prefix[]; -extern const char _XcmsRGB_prefix[]; - -extern XcmsColorSpace XcmsUNDEFINEDColorSpace; -extern XcmsColorSpace XcmsTekHVCColorSpace; -extern XcmsColorSpace XcmsCIEXYZColorSpace; -extern XcmsColorSpace XcmsCIEuvYColorSpace; -extern XcmsColorSpace XcmsCIExyYColorSpace; -extern XcmsColorSpace XcmsCIELabColorSpace; -extern XcmsColorSpace XcmsCIELuvColorSpace; -extern XcmsColorSpace XcmsRGBColorSpace; -extern XcmsColorSpace XcmsRGBiColorSpace; - -extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; -extern XcmsColorSpace **_XcmsDIColorSpaces; - -extern XcmsColorSpace *_XcmsDDColorSpacesInit[]; -extern XcmsColorSpace **_XcmsDDColorSpaces; - -extern XcmsFunctionSet XcmsLinearRGBFunctionSet; - -extern XcmsFunctionSet *_XcmsSCCFuncSetsInit[]; -extern XcmsFunctionSet **_XcmsSCCFuncSets; - -extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[]; - -/* functions */ -extern XPointer * -_XcmsCopyPointerArray( - XPointer *pap); -extern void -_XcmsFreePointerArray( - XPointer *pap); -extern XPointer * -_XcmsPushPointerArray( - XPointer *pap, - XPointer p, - XPointer *papNoFree); -extern Status -_XcmsCIEXYZ_ValidSpec( - XcmsColor *pColor); -extern Status -_XcmsCIEuvY_ValidSpec( - XcmsColor *pColor); -extern int -_XcmsTekHVC_CheckModify( - XcmsColor *pColor); - -extern Status -_XcmsTekHVCQueryMaxVCRGB( - XcmsCCC ccc, - XcmsFloat hue, - XcmsColor *pColor_return, - XcmsRGBi *pRGB_return); -extern Status -_XcmsCIELabQueryMaxLCRGB( - XcmsCCC ccc, - XcmsFloat hue, /* hue in radians */ - XcmsColor *pColor_return, - XcmsRGBi *pRGB_return); -extern Status -_XcmsConvertColorsWithWhitePt( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - XcmsColor *pWhitePt, - unsigned int nColors, - XcmsColorFormat newFormat, - Bool *pCompressed); - -extern Status -_XcmsDIConvertColors( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - XcmsColor *pWhitePt, - unsigned int nColors, - XcmsColorFormat newFormat); -extern Status -_XcmsDDConvertColors( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - XcmsColorFormat newFormat, - Bool *pCompressed); -extern XcmsColorFormat -_XcmsRegFormatOfPrefix( - _Xconst char *prefix); -extern void -_XColor_to_XcmsRGB( - XcmsCCC ccc, - XColor *pXColors, - XcmsColor *pColors, - unsigned int nColors); -extern Status -_XcmsSetGetColor( - Status (*xColorProc)( - Display* /* display */, - Colormap /* colormap */, - XColor* /* screen_in_out */), - Display *dpy, - Colormap cmap, - XcmsColor *pColors_in_out, - XcmsColorFormat result_format, - Bool *pCompressed); -extern Status -_XcmsSetGetColors( - Status (*xColorProc)( - Display* /* display */, - Colormap /* colormap */, - XColor* /* screen_in_out */, - int /* nColors */), - Display *dpy, - Colormap cmap, - XcmsColor *pColors_in_out, - int nColors, - XcmsColorFormat result_format, - Bool *pCompressed); -extern Status -_XcmsCIELuvQueryMaxLCRGB( - XcmsCCC ccc, - XcmsFloat hue, /* hue in radians */ - XcmsColor *pColor_return, - XcmsRGBi *pRGB_return); - -extern XcmsIntensityMap * -_XcmsGetIntensityMap( - Display *dpy, - Visual *visual); -extern int -_XcmsInitDefaultCCCs( - Display *dpy); -extern int -_XcmsInitScrnInfo( - register Display *dpy, - int screenNumber); -extern XcmsCmapRec * -_XcmsCopyCmapRecAndFree( - Display *dpy, - Colormap src_cmap, - Colormap copy_cmap); -extern void -_XcmsCopyISOLatin1Lowered( - char *dst, - const char *src); -extern int -_XcmsEqualWhitePts( - XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2); -extern int -_XcmsLRGB_InitScrnDefault( - Display *dpy, - int screenNumber, - XcmsPerScrnInfo *pPerScrnInfo); -extern void -_XcmsFreeIntensityMaps( - Display *dpy); -extern int -_XcmsGetProperty( - Display *pDpy, - Window w, - Atom property, - int *pFormat, - unsigned long *pNItems, - unsigned long *pNBytes, - char **pValue); -extern unsigned long -_XcmsGetElement( - int format, - char **pValue, - unsigned long *pCount); -extern void -_XcmsUnresolveColor( - XcmsCCC ccc, - XcmsColor *pColor); -extern void -_XcmsResolveColor( - XcmsCCC ccc, - XcmsColor *pXcmsColor); - -#endif /* _CV_H_ */ diff --git a/nx-X11/lib/X11/CvColW.c b/nx-X11/lib/X11/CvColW.c deleted file mode 100644 index 4aabded0d..000000000 --- a/nx-X11/lib/X11/CvColW.c +++ /dev/null @@ -1,141 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * XcmsCvColW.c - * - * DESCRIPTION - * - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - - -/* - * NAME - * _XcmsConvertColorsWithWhitePt - Convert XcmsColor structures - * - * SYNOPSIS - */ -Status -_XcmsConvertColorsWithWhitePt( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - XcmsColor *pWhitePt, - unsigned int nColors, - XcmsColorFormat newFormat, - Bool *pCompressed) -/* - * DESCRIPTION - * Convert XcmsColor structures between device-independent - * and/or device-dependent formats but allowing the calling - * routine to specify the white point to be associated - * with the color specifications (overriding - * ccc->clientWhitePt). - * - * This routine has been provided for use in white point - * adjustment routines. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression, - * XcmsSuccessWithCompression if succeeded with gamut - * compression. - * - */ -{ - if (ccc == NULL || pColors_in_out == NULL || - pColors_in_out->format == XcmsUndefinedFormat) { - return(XcmsFailure); - } - - if (nColors == 0 || pColors_in_out->format == newFormat) { - /* do nothing */ - return(XcmsSuccess); - } - - if (XCMS_DI_ID(pColors_in_out->format) && XCMS_DI_ID(newFormat)) { - /* - * Device-Independent to Device-Independent Conversion - */ - return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, - newFormat)); - } - if (XCMS_DD_ID(pColors_in_out->format) && XCMS_DD_ID(newFormat)) { - /* - * Device-Dependent to Device-Dependent Conversion - */ - return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, - pCompressed)); - } - - /* - * Otherwise we have: - * 1. Device-Independent to Device-Dependent Conversion - * OR - * 2. Device-Dependent to Device-Independent Conversion - */ - - if (XCMS_DI_ID(pColors_in_out->format)) { - /* - * 1. Device-Independent to Device-Dependent Conversion - */ - /* First convert to CIEXYZ */ - if (_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, - XcmsCIEXYZFormat) == XcmsFailure) { - return(XcmsFailure); - } - /* Then convert to DD Format */ - return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, - pCompressed)); - } else { - /* - * 2. Device-Dependent to Device-Independent Conversion - */ - /* First convert to CIEXYZ */ - if (_XcmsDDConvertColors(ccc, pColors_in_out, nColors, - XcmsCIEXYZFormat, pCompressed) == XcmsFailure) { - return(XcmsFailure); - } - /* Then convert to DI Format */ - return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, - newFormat)); - } -} diff --git a/nx-X11/lib/X11/CvCols.c b/nx-X11/lib/X11/CvCols.c deleted file mode 100644 index 87d49311c..000000000 --- a/nx-X11/lib/X11/CvCols.c +++ /dev/null @@ -1,1030 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsCvCols.c - * - * DESCRIPTION - * Xcms API routine that converts between the - * device-independent color spaces. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * LOCAL DEFINES - */ -#define DD_FORMAT 0x01 -#define DI_FORMAT 0x02 -#define MIX_FORMAT 0x04 -#ifndef MAX -# define MAX(x,y) ((x) > (y) ? (x) : (y)) -#endif - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * EqualCIEXYZ - * - * SYNOPSIS - */ -static int -EqualCIEXYZ( - XcmsColor *p1, XcmsColor *p2) -/* - * DESCRIPTION - * Compares two XcmsColor structures that are in XcmsCIEXYZFormat - * - * RETURNS - * Returns 1 if equal; 0 otherwise. - * - */ -{ - if (p1->format != XcmsCIEXYZFormat || p2->format != XcmsCIEXYZFormat) { - return(0); - } - if ((p1->spec.CIEXYZ.X != p2->spec.CIEXYZ.X) - || (p1->spec.CIEXYZ.Y != p2->spec.CIEXYZ.Y) - || (p1->spec.CIEXYZ.Z != p2->spec.CIEXYZ.Z)) { - return(0); - } - return(1); -} - - -/* - * NAME - * XcmsColorSpace - * - * SYNOPSIS - */ -static XcmsColorSpace * -ColorSpaceOfID( - XcmsCCC ccc, - XcmsColorFormat id) -/* - * DESCRIPTION - * Returns a pointer to the color space structure - * (XcmsColorSpace) associated with the specified color space - * ID. - * - * RETURNS - * Pointer to matching XcmsColorSpace structure if found; - * otherwise NULL. - */ -{ - XcmsColorSpace **papColorSpaces; - - if (ccc == NULL) { - return(NULL); - } - - /* - * First try Device-Independent color spaces - */ - papColorSpaces = _XcmsDIColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if ((*papColorSpaces)->id == id) { - return(*papColorSpaces); - } - papColorSpaces++; - } - } - - /* - * Next try Device-Dependent color spaces - */ - papColorSpaces = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if ((*papColorSpaces)->id == id) { - return(*papColorSpaces); - } - papColorSpaces++; - } - } - - return(NULL); -} - - -/* - * NAME - * ValidDIColorSpaceID - * - * SYNOPSIS - */ -static int -ValidDIColorSpaceID( - XcmsColorFormat id) -/* - * DESCRIPTION - * Determines if the specified color space ID is a valid - * Device-Independent color space in the specified Color - * Conversion Context. - * - * RETURNS - * Returns zero if not valid; otherwise non-zero. - */ -{ - XcmsColorSpace **papRec; - papRec = _XcmsDIColorSpaces; - if (papRec != NULL) { - while (*papRec != NULL) { - if ((*papRec)->id == id) { - return(1); - } - papRec++; - } - } - return(0); -} - - -/* - * NAME - * ValidDDColorSpaceID - * - * SYNOPSIS - */ -static int -ValidDDColorSpaceID( - XcmsCCC ccc, - XcmsColorFormat id) -/* - * DESCRIPTION - * Determines if the specified color space ID is a valid - * Device-Dependent color space in the specified Color - * Conversion Context. - * - * RETURNS - * Returns zero if not valid; otherwise non-zero. - */ -{ - XcmsColorSpace **papRec; - - if (ccc->pPerScrnInfo->state != XcmsInitNone) { - papRec = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; - while (*papRec != NULL) { - if ((*papRec)->id == id) { - return(1); - } - papRec++; - } - } - return(0); -} - - -/* - * NAME - * ConvertMixedColors - Convert XcmsColor structures - * - * SYNOPSIS - */ -static Status -ConvertMixedColors( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - XcmsColor *pWhitePt, - unsigned int nColors, - XcmsColorFormat targetFormat, - unsigned char format_flag) -/* - * DESCRIPTION - * This routine will only convert the following types of - * batches: - * DI to DI - * DD to DD - * DD to CIEXYZ - * In other words, it will not convert the following types of - * batches: - * DI to DD - * DD to DI(not CIEXYZ) - * - * format_flag: - * 0x01 : convert Device-Dependent only specifications to the - * target format. - * 0x02 : convert Device-Independent only specifications to the - * target format. - * 0x03 : convert all specifications to the target format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if none of the color specifications were - * compressed in the conversion process - * XcmsSuccessWithCompression if at least one of the - * color specifications were compressed in the - * conversion process. - * - */ -{ - XcmsColor *pColor, *pColors_start; - XcmsColorFormat format; - Status retval_tmp; - Status retval = XcmsSuccess; - unsigned int iColors; - unsigned int nBatch; - - /* - * Convert array of mixed color specifications in batches of - * contiguous formats to the target format - */ - iColors = 0; - while (iColors < nColors) { - /* - * Find contiguous array of color specifications with the - * same format - */ - pColor = pColors_start = pColors_in_out + iColors; - format = pColors_start->format; - nBatch = 0; - while (iColors < nColors && pColor->format == format) { - pColor++; - nBatch++; - iColors++; - } - if (format != targetFormat) { - /* - * Need to convert this batch from current format to target format. - */ - if (XCMS_DI_ID(format) && (format_flag & DI_FORMAT) && - XCMS_DI_ID(targetFormat)) { - /* - * DI->DI - * - * Format of interest is Device-Independent, - * This batch contains Device-Independent specifications, and - * the Target format is Device-Independent. - */ - retval_tmp = _XcmsDIConvertColors(ccc, pColors_start, pWhitePt, - nBatch, targetFormat); - } else if (XCMS_DD_ID(format) && (format_flag & DD_FORMAT) && - (targetFormat == XcmsCIEXYZFormat)) { - /* - * DD->CIEXYZ - * - * Format of interest is Device-Dependent, - * This batch contains Device-Dependent specifications, and - * the Target format is CIEXYZ. - * - * Since DD->CIEXYZ we can use NULL instead of pCompressed. - */ - if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, - pWhitePt, ScreenWhitePointOfCCC(ccc))) { - /* - * Need to call WhiteAdjustProc (Screen White Point to - * White Point). - */ - retval_tmp = (*ccc->whitePtAdjProc)(ccc, - ScreenWhitePointOfCCC(ccc), pWhitePt, - XcmsCIEXYZFormat, pColors_start, nBatch, - (Bool *)NULL); - } else { - retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, - nBatch, XcmsCIEXYZFormat, (Bool *)NULL); - } - } else if (XCMS_DD_ID(format) && (format_flag & DD_FORMAT) && - XCMS_DD_ID(targetFormat)) { - /* - * DD->DD(not CIEXYZ) - * - * Format of interest is Device-Dependent, - * This batch contains Device-Dependent specifications, and - * the Target format is Device-Dependent and not CIEXYZ. - */ - retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, nBatch, - targetFormat, (Bool *)NULL); - } else { - /* - * This routine is called for the wrong reason. - */ - return(XcmsFailure); - } - if (retval_tmp == XcmsFailure) { - return(XcmsFailure); - } - retval = MAX(retval, retval_tmp); - } - } - return(retval); -} - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsEqualWhitePts - * - * SYNOPSIS - */ -int -_XcmsEqualWhitePts(XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2) -/* - * DESCRIPTION - * - * RETURNS - * Returns 0 if not equal; otherwise 1. - * - */ -{ - XcmsColor tmp1, tmp2; - - memcpy((char *)&tmp1, (char *)pWhitePt1, sizeof(XcmsColor)); - memcpy((char *)&tmp2, (char *)pWhitePt2, sizeof(XcmsColor)); - - if (tmp1.format != XcmsCIEXYZFormat) { - if (_XcmsDIConvertColors(ccc, &tmp1, (XcmsColor *) NULL, 1, - XcmsCIEXYZFormat)==0) { - return(0); - } - } - - if (tmp2.format != XcmsCIEXYZFormat) { - if (_XcmsDIConvertColors(ccc, &tmp2, (XcmsColor *) NULL, 1, - XcmsCIEXYZFormat)==0) { - return(0); - } - } - - return (EqualCIEXYZ(&tmp1, &tmp2)); -} - - -/* - * NAME - * _XcmsDIConvertColors - Convert XcmsColor structures - * - * SYNOPSIS - */ -Status -_XcmsDIConvertColors( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - XcmsColor *pWhitePt, - unsigned int nColors, - XcmsColorFormat newFormat) -/* - * DESCRIPTION - * Convert XcmsColor structures to another Device-Independent - * form. - * - * Here are some assumptions that this routine makes: - * 1. The calling routine has already checked if - * pColors_in_out->format == newFormat, therefore - * there is no need to check again here. - * 2. The calling routine has already checked nColors, - * therefore this routine assumes nColors > 0. - * 3. The calling routine may want to convert only between - * CIExyY <-> CIEXYZ <-> CIEuvY - * therefore, this routine allows pWhitePt to equal NULL. - * - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsColorSpace *pFrom, *pTo; - XcmsDIConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; - XcmsDIConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; - XcmsDIConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start; - XcmsDIConversionProc *tmp; - - /* - * Allow pWhitePt to equal NULL. This appropriate when converting - * anywhere between: - * CIExyY <-> CIEXYZ <-> CIEuvY - */ - - if (pColors_in_out == NULL || - !ValidDIColorSpaceID(pColors_in_out->format) || - !ValidDIColorSpaceID(newFormat)) { - return(XcmsFailure); - } - - /* - * Get a handle on the function list for the current specification format - */ - if ((pFrom = ColorSpaceOfID(ccc, pColors_in_out->format)) - == NULL) { - return(XcmsFailure); - } - - /* - * Get a handle on the function list for the new specification format - */ - if ((pTo = ColorSpaceOfID(ccc, newFormat)) == NULL) { - return(XcmsFailure); - } - - src_to_CIEXYZ = pFrom->to_CIEXYZ; - src_from_CIEXYZ = pFrom->from_CIEXYZ; - dest_to_CIEXYZ = pTo->to_CIEXYZ; - dest_from_CIEXYZ = pTo->from_CIEXYZ; - - if (pTo->inverse_flag && pFrom->inverse_flag) { - /* - * Find common function pointers - */ - for (to_CIEXYZ_stop = src_to_CIEXYZ; *to_CIEXYZ_stop; to_CIEXYZ_stop++){ - for (tmp = dest_to_CIEXYZ; *tmp; tmp++) { - if (*to_CIEXYZ_stop == *tmp) { - goto Continue; - } - } - } - -Continue: - - /* - * Execute the functions to CIEXYZ, stopping short as necessary - */ - while (src_to_CIEXYZ != to_CIEXYZ_stop) { - if ((*src_to_CIEXYZ++)(ccc, pWhitePt, pColors_in_out, - nColors) == XcmsFailure) { - return(XcmsFailure); - } - } - - /* - * Determine where to start on the from_CIEXYZ path. - */ - from_CIEXYZ_start = dest_from_CIEXYZ; - tmp = src_from_CIEXYZ; - while ((*from_CIEXYZ_start == *tmp) && (*from_CIEXYZ_start != NULL)) { - from_CIEXYZ_start++; - tmp++; - } - - } else { - /* - * The function in at least one of the Color Spaces are not - * complementary, i.e., - * for an i, 0 <= i < n elements - * from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i] - * - * Execute the functions all the way to CIEXYZ - */ - while (*src_to_CIEXYZ) { - if ((*src_to_CIEXYZ++)(ccc, pWhitePt, pColors_in_out, - nColors) == XcmsFailure) { - return(XcmsFailure); - } - } - - /* - * Determine where to start on the from_CIEXYZ path. - */ - from_CIEXYZ_start = dest_from_CIEXYZ; - } - - - /* - * Execute the functions from CIEXYZ. - */ - while (*from_CIEXYZ_start) { - if ((*from_CIEXYZ_start++)(ccc, pWhitePt, pColors_in_out, - nColors) == XcmsFailure) { - return(XcmsFailure); - } - } - - return(XcmsSuccess); -} - - -/* - * NAME - * _XcmsDDConvertColors - Convert XcmsColor structures - * - * SYNOPSIS - */ -Status -_XcmsDDConvertColors( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - XcmsColorFormat newFormat, - Bool *pCompressed) -/* - * DESCRIPTION - * Convert XcmsColor structures: - * - * 1. From CIEXYZ to Device-Dependent formats (typically RGB and - * RGBi), - * or - * 2. Between Device-Dependent formats (typically RGB and RGBi). - * - * Assumes that these specifications have already been white point - * adjusted if necessary from Client White Point to Screen - * White Point. Therefore, the white point now associated - * with the specifications is the Screen White Point. - * - * pCompressed may be NULL. If so this indicates that the - * calling routine is not interested in knowing exactly which - * color was compressed, if any. - * - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if none of the color specifications were - * compressed in the conversion process - * XcmsSuccessWithCompression if at least one of the - * color specifications were compressed in the - * conversion process. - * - */ -{ - XcmsColorSpace *pFrom, *pTo; - XcmsDDConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; - XcmsDDConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; - XcmsDDConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop; - XcmsDDConversionProc *tmp; - int retval; - int hasCompressed = 0; - - if (ccc == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - if (nColors == 0 || pColors_in_out->format == newFormat) { - /* do nothing */ - return(XcmsSuccess); - } - - if (((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet) == NULL) { - return(XcmsFailure); /* hmm, an internal error? */ - } - - /* - * Its ok if pColors_in_out->format == XcmsCIEXYZFormat - * or - * if newFormat == XcmsCIEXYZFormat - */ - if ( !( ValidDDColorSpaceID(ccc, pColors_in_out->format) - || - (pColors_in_out->format == XcmsCIEXYZFormat)) - || - !(ValidDDColorSpaceID(ccc, newFormat) - || - newFormat == XcmsCIEXYZFormat)) { - return(XcmsFailure); - } - - if ((pFrom = ColorSpaceOfID(ccc, pColors_in_out->format)) == NULL){ - return(XcmsFailure); - } - - if ((pTo = ColorSpaceOfID(ccc, newFormat)) == NULL) { - return(XcmsFailure); - } - - src_to_CIEXYZ = (XcmsDDConversionProc *)pFrom->to_CIEXYZ; - src_from_CIEXYZ = (XcmsDDConversionProc *)pFrom->from_CIEXYZ; - dest_to_CIEXYZ = (XcmsDDConversionProc *)pTo->to_CIEXYZ; - dest_from_CIEXYZ = (XcmsDDConversionProc *)pTo->from_CIEXYZ; - - if (pTo->inverse_flag && pFrom->inverse_flag) { - /* - * Find common function pointers - */ - for (to_CIEXYZ_stop = src_to_CIEXYZ; *to_CIEXYZ_stop; to_CIEXYZ_stop++){ - for (tmp = dest_to_CIEXYZ; *tmp; tmp++) { - if (*to_CIEXYZ_stop == *tmp) { - goto Continue; - } - } - } -Continue: - - /* - * Execute the functions - */ - while (src_to_CIEXYZ != to_CIEXYZ_stop) { - retval = (*src_to_CIEXYZ++)(ccc, pColors_in_out, nColors, - pCompressed); - if (retval == XcmsFailure) { - return(XcmsFailure); - } - hasCompressed |= (retval == XcmsSuccessWithCompression); - } - - /* - * Determine where to start on the from_CIEXYZ path. - */ - from_CIEXYZ_start = dest_from_CIEXYZ; - tmp = src_from_CIEXYZ; - while ((*from_CIEXYZ_start == *tmp) && (*from_CIEXYZ_start != NULL)) { - from_CIEXYZ_start++; - tmp++; - } - - } else { - /* - * The function in at least one of the Color Spaces are not - * complementary, i.e., - * for an i, 0 <= i < n elements - * from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i] - * - * Execute the functions all the way to CIEXYZ - */ - while (*src_to_CIEXYZ) { - retval = (*src_to_CIEXYZ++)(ccc, pColors_in_out, nColors, - pCompressed); - if (retval == XcmsFailure) { - return(XcmsFailure); - } - hasCompressed |= (retval == XcmsSuccessWithCompression); - } - - /* - * Determine where to start on the from_CIEXYZ path. - */ - from_CIEXYZ_start = dest_from_CIEXYZ; - } - - while (*from_CIEXYZ_start) { - retval = (*from_CIEXYZ_start++)(ccc, pColors_in_out, nColors, - pCompressed); - if (retval == XcmsFailure) { - return(XcmsFailure); - } - hasCompressed |= (retval == XcmsSuccessWithCompression); - } - - return(hasCompressed ? XcmsSuccessWithCompression : XcmsSuccess); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsConvertColors - Convert XcmsColor structures - * - * SYNOPSIS - */ -Status -XcmsConvertColors( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - XcmsColorFormat targetFormat, - Bool *pCompressed) -/* - * DESCRIPTION - * Convert XcmsColor structures to another format - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression, - * XcmsSuccessWithCompression if succeeded with gamut - * compression. - * - */ -{ - XcmsColor clientWhitePt; - XcmsColor Color1; - XcmsColor *pColors_tmp; - int callWhiteAdjustProc = 0; - XcmsColorFormat format; - Status retval; - unsigned char contents_flag = 0x00; - unsigned int iColors; - - if (ccc == NULL || pColors_in_out == NULL || - !(ValidDIColorSpaceID(targetFormat) || - ValidDDColorSpaceID(ccc, targetFormat))) { - return(XcmsFailure); - } - - /* - * Check formats in color specification array - */ - format = pColors_in_out->format; - for (pColors_tmp = pColors_in_out, iColors = nColors; iColors; pColors_tmp++, iColors--) { - if (!(ValidDIColorSpaceID(pColors_tmp->format) || - ValidDDColorSpaceID(ccc, pColors_tmp->format))) { - return(XcmsFailure); - } - if (XCMS_DI_ID(pColors_tmp->format)) { - contents_flag |= DI_FORMAT; - } else { - contents_flag |= DD_FORMAT; - } - if (pColors_tmp->format != format) { - contents_flag |= MIX_FORMAT; - } - } - - /* - * Check if we need the Client White Point. - */ - if ((contents_flag & DI_FORMAT) || XCMS_DI_ID(targetFormat)) { - /* To proceed, we need to get the Client White Point */ - memcpy((char *)&clientWhitePt, (char *)&ccc->clientWhitePt, - sizeof(XcmsColor)); - if (clientWhitePt.format == XcmsUndefinedFormat) { - /* - * Client White Point is undefined, therefore set to the Screen - * White Point. - * Since Client White Point == Screen White Point, WhiteAdjustProc - * is not called. - */ - memcpy((char *)&clientWhitePt, - (char *)&ccc->pPerScrnInfo->screenWhitePt, - sizeof(XcmsColor)); - } else if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, - &clientWhitePt, ScreenWhitePointOfCCC(ccc))) { - /* - * Client White Point != Screen White Point, and WhiteAdjustProc - * is not NULL, therefore, will need to call it when - * converting between DI and DD specifications. - */ - callWhiteAdjustProc = 1; - } - } - - /* - * Make copy of array of color specifications - */ - if (nColors > 1) { - pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); - } else { - pColors_tmp = &Color1; - } - memcpy((char *)pColors_tmp, (char *)pColors_in_out, - nColors * sizeof(XcmsColor)); - - /* - * zero out pCompressed - */ - if (pCompressed) { - bzero((char *)pCompressed, nColors * sizeof(Bool)); - } - - if (contents_flag == DD_FORMAT || contents_flag == DI_FORMAT) { - /* - * ENTIRE ARRAY IS IN ONE FORMAT. - */ - if (XCMS_DI_ID(format) && XCMS_DI_ID(targetFormat)) { - /* - * DI-to-DI only conversion - */ - retval = _XcmsDIConvertColors(ccc, pColors_tmp, - &clientWhitePt, nColors, targetFormat); - } else if (XCMS_DD_ID(format) && XCMS_DD_ID(targetFormat)) { - /* - * DD-to-DD only conversion - * Since DD->DD there will be no compressed thus we can - * pass NULL instead of pCompressed. - */ - retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, - targetFormat, (Bool *)NULL); - } else { - /* - * Otherwise we have: - * 1. Device-Independent to Device-Dependent Conversion - * OR - * 2. Device-Dependent to Device-Independent Conversion - * - * We need to go from oldFormat -> CIEXYZ -> targetFormat - * adjusting for white points as necessary. - */ - - if (XCMS_DI_ID(format)) { - /* - * 1. Device-Independent to Device-Dependent Conversion - */ - if (callWhiteAdjustProc) { - /* - * White Point Adjustment - * Client White Point to Screen White Point - */ - retval = (*ccc->whitePtAdjProc)(ccc, &clientWhitePt, - ScreenWhitePointOfCCC(ccc), targetFormat, - pColors_tmp, nColors, pCompressed); - } else { - if (_XcmsDIConvertColors(ccc, pColors_tmp, - &clientWhitePt, nColors, XcmsCIEXYZFormat) - == XcmsFailure) { - goto Failure; - } - retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, - targetFormat, pCompressed); - } - } else { - /* - * 2. Device-Dependent to Device-Independent Conversion - */ - if (callWhiteAdjustProc) { - /* - * White Point Adjustment - * Screen White Point to Client White Point - */ - retval = (*ccc->whitePtAdjProc)(ccc, - ScreenWhitePointOfCCC(ccc), &clientWhitePt, - targetFormat, pColors_tmp, nColors, pCompressed); - } else { - /* - * Since DD->CIEXYZ, no compression takes place therefore - * we can pass NULL instead of pCompressed. - */ - if (_XcmsDDConvertColors(ccc, pColors_tmp, nColors, - XcmsCIEXYZFormat, (Bool *)NULL) == XcmsFailure) { - goto Failure; - } - retval = _XcmsDIConvertColors(ccc, pColors_tmp, - &clientWhitePt, nColors, targetFormat); - } - } - } - } else { - /* - * ARRAY HAS MIXED FORMATS. - */ - if ((contents_flag == (DI_FORMAT | MIX_FORMAT)) && - XCMS_DI_ID(targetFormat)) { - /* - * Convert from DI to DI in batches of contiguous formats - * - * Because DI->DI, WhiteAdjustProc not called. - */ - retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, - nColors, targetFormat, (unsigned char)DI_FORMAT); - } else if ((contents_flag == (DD_FORMAT | MIX_FORMAT)) && - XCMS_DD_ID(targetFormat)) { - /* - * Convert from DD to DD in batches of contiguous formats - * - * Because DD->DD, WhiteAdjustProc not called. - */ - retval = ConvertMixedColors(ccc, pColors_tmp, - (XcmsColor *)NULL, nColors, targetFormat, - (unsigned char)DD_FORMAT); - } else if (XCMS_DI_ID(targetFormat)) { - /* - * We need to convert from DI-to-DI and DD-to-DI, therefore - * 1. convert DD specifications to CIEXYZ, then - * 2. convert all in batches to the target DI format. - * - * Note that ConvertMixedColors will call WhiteAdjustProc - * as necessary. - */ - - /* - * Convert only DD specifications in batches of contiguous formats - * to CIEXYZ - * - * Since DD->CIEXYZ, ConvertMixedColors will apply WhiteAdjustProc - * if required. - */ - retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, - nColors, XcmsCIEXYZFormat, (unsigned char)DD_FORMAT); - - /* - * Because at this point we may have a mix of DI formats - * (e.g., CIEXYZ, CIELuv) we must convert the specs to the - * target DI format in batches of contiguous source formats. - */ - retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, - nColors, targetFormat, (unsigned char)DI_FORMAT); - } else { - /* - * We need to convert from DI-to-DD and DD-to-DD, therefore - * 1. convert DI specifications to CIEXYZ, then - * 2. convert all to the DD target format. - * - * This allows white point adjustment and gamut compression - * to be applied to all the color specifications in one - * swoop if those functions do in fact modify the entire - * group of color specifications. - */ - - /* - * Convert in batches to CIEXYZ - * - * If DD->CIEXYZ, ConvertMixedColors will apply WhiteAdjustProc - * if required. - */ - if ((retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, - nColors, XcmsCIEXYZFormat, - (unsigned char)(DI_FORMAT | DD_FORMAT))) == XcmsFailure) { - goto Failure; - } - - /* - * Convert all specifications (now in CIEXYZ format) to - * the target DD format. - * Since CIEXYZ->DD, compression MAY take place therefore - * we must pass pCompressed. - * Note that WhiteAdjustProc must be used if necessary. - */ - if (callWhiteAdjustProc) { - /* - * White Point Adjustment - * Client White Point to Screen White Point - */ - retval = (*ccc->whitePtAdjProc)(ccc, - &clientWhitePt, ScreenWhitePointOfCCC(ccc), - targetFormat, pColors_tmp, nColors, pCompressed); - } else { - retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, - targetFormat, pCompressed); - } - } - } - - if (retval != XcmsFailure) { - memcpy((char *)pColors_in_out, (char *)pColors_tmp, - nColors * sizeof(XcmsColor)); - } - if (nColors > 1) { - Xfree(pColors_tmp); - } - return(retval); - -Failure: - if (nColors > 1) { - Xfree(pColors_tmp); - } - return(XcmsFailure); -} - - -/* - * NAME - * XcmsRegFormatOfPrefix - * - * SYNOPSIS - */ -XcmsColorFormat -_XcmsRegFormatOfPrefix( - _Xconst char *prefix) -/* - * DESCRIPTION - * Returns a color space ID associated with the specified - * X Consortium registered color space prefix. - * - * RETURNS - * The color space ID if found; - * otherwise NULL. - */ -{ - XcmsRegColorSpaceEntry *pEntry = _XcmsRegColorSpaces; - - while (pEntry->prefix != NULL) { - if (strcmp(prefix, pEntry->prefix) == 0) { - return(pEntry->id); - } - pEntry++; - } - return(XcmsUndefinedFormat); -} diff --git a/nx-X11/lib/X11/DefCursor.c b/nx-X11/lib/X11/DefCursor.c deleted file mode 100644 index e3cee0649..000000000 --- a/nx-X11/lib/X11/DefCursor.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986,1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDefineCursor ( - register Display *dpy, - Window w, - Cursor cursor) -{ - register xChangeWindowAttributesReq *req; - - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWCursor; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), cursor); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/DelProp.c b/nx-X11/lib/X11/DelProp.c deleted file mode 100644 index da486b8ef..000000000 --- a/nx-X11/lib/X11/DelProp.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDeleteProperty( - register Display *dpy, - Window window, - Atom property) -{ - register xDeletePropertyReq *req; - - LockDisplay(dpy); - GetReq(DeleteProperty, req); - req->window = window; - req->property = property; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/Depths.c b/nx-X11/lib/X11/Depths.c deleted file mode 100644 index a8b719d00..000000000 --- a/nx-X11/lib/X11/Depths.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -/* - * XListDepths - return info from connection setup - */ -int *XListDepths ( - Display *dpy, - int scrnum, - int *countp) -{ - Screen *scr; - int count; - int *depths; - - if (scrnum < 0 || scrnum >= dpy->nscreens) return NULL; - - scr = &dpy->screens[scrnum]; - if ((count = scr->ndepths) > 0) { - register Depth *dp; - register int i; - - depths = Xmalloc (count * sizeof(int)); - if (!depths) return NULL; - for (i = 0, dp = scr->depths; i < count; i++, dp++) - depths[i] = dp->depth; - } else { - /* a screen must have a depth */ - return NULL; - } - *countp = count; - return depths; -} diff --git a/nx-X11/lib/X11/DestSubs.c b/nx-X11/lib/X11/DestSubs.c deleted file mode 100644 index 7c6c428be..000000000 --- a/nx-X11/lib/X11/DestSubs.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDestroySubwindows( - register Display *dpy, - Window win) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq (DestroySubwindows,win, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/DestWind.c b/nx-X11/lib/X11/DestWind.c deleted file mode 100644 index c1aec893a..000000000 --- a/nx-X11/lib/X11/DestWind.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDestroyWindow ( - register Display *dpy, - Window w) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(DestroyWindow, w, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/DisName.c b/nx-X11/lib/X11/DisName.c deleted file mode 100644 index 87a1e2f0e..000000000 --- a/nx-X11/lib/X11/DisName.c +++ /dev/null @@ -1,64 +0,0 @@ - -/* - -Copyright 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* XDisplayName.c */ -/* - * Returns the name of the display XOpenDisplay would use. This is better - * than just printing the "display" variable in a program because that - * could be NULL and/or there could be an environment variable set. - * This makes it easier for programmers to provide meaningful error - * messages. - * - * - * For example, this is used in XOpenDisplay() as - * strncpy( displaybuf, XDisplayName( display ), sizeof(displaybuf) ); - * if ( *displaybuf == '\0' ) return( NULL ); - * This check is actually unnecessary because the next thing is an index() - * call looking for a ':' which will fail and we'll return(NULL). - */ -/* Written at Waterloo - JMSellens */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlib.h" - -char * -XDisplayName( - _Xconst char *display) -{ - char *d; - if ( display != (char *)NULL && *display != '\0' ) - return( (char *)display ); - if ( (d = getenv( "DISPLAY" )) != (char *)NULL ) - return( d ); - return( "" ); -} diff --git a/nx-X11/lib/X11/DrArc.c b/nx-X11/lib/X11/DrArc.c deleted file mode 100644 index d72fac9d7..000000000 --- a/nx-X11/lib/X11/DrArc.c +++ /dev/null @@ -1,73 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* Note to future maintainers: XDrawArc does NOT batch successive PolyArc - requests into a single request like XDrawLine, XDrawPoint, etc. - We don't do this because X_PolyArc applies the GC's join-style if - the last point in one arc coincides with the first point in another. - The client wouldn't expect this and would have no easy way to defeat it. */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawArc( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, /* INT16 */ - unsigned int width, - unsigned int height, /* CARD16 */ - int angle1, - int angle2) /* INT16 */ -{ - register xPolyArcReq *req; - register xArc *arc; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReqExtra (PolyArc, SIZEOF(xArc), req); - - req->drawable = d; - req->gc = gc->gid; - - arc = (xArc *) NEXTPTR(req,xPolyArcReq); - - arc->x = x; - arc->y = y; - arc->width = width; - arc->height = height; - arc->angle1 = angle1; - arc->angle2 = angle2; - - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/DrArcs.c b/nx-X11/lib/X11/DrArcs.c deleted file mode 100644 index 14405aa3d..000000000 --- a/nx-X11/lib/X11/DrArcs.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define arc_scale (SIZEOF(xArc) / 4) - -int -XDrawArcs( - register Display *dpy, - Drawable d, - GC gc, - XArc *arcs, - int n_arcs) -{ - register xPolyArcReq *req; - register long len; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq(PolyArc,req); - req->drawable = d; - req->gc = gc->gid; - len = ((long)n_arcs) * arc_scale; - SetReqLen(req, len, 1); - len <<= 2; /* watch out for macros... */ - Data16 (dpy, (short *) arcs, len); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/DrLine.c b/nx-X11/lib/X11/DrLine.c deleted file mode 100644 index dc82d5a15..000000000 --- a/nx-X11/lib/X11/DrLine.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* precompute the maximum size of batching request allowed */ - -#define wsize (SIZEOF(xPolySegmentReq) + WLNSPERBATCH * SIZEOF(xSegment)) -#define zsize (SIZEOF(xPolySegmentReq) + ZLNSPERBATCH * SIZEOF(xSegment)) - -int -XDrawLine ( - register Display *dpy, - Drawable d, - GC gc, - int x1, - int y1, - int x2, - int y2) -{ - register xSegment *segment; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - { - register xPolySegmentReq *req = (xPolySegmentReq *) dpy->last_req; - - /* if same as previous request, with same drawable, batch requests */ - if ( - (req->reqType == X_PolySegment) - && (req->drawable == d) - && (req->gc == gc->gid) - && ((dpy->bufptr + SIZEOF(xSegment)) <= dpy->bufmax) - && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? - wsize : zsize)) ) { - req->length += SIZEOF(xSegment) >> 2; - segment = (xSegment *) dpy->bufptr; - dpy->bufptr += SIZEOF(xSegment); - } - - else { - GetReqExtra (PolySegment, SIZEOF(xSegment), req); - req->drawable = d; - req->gc = gc->gid; - segment = (xSegment *) NEXTPTR(req,xPolySegmentReq); - } - - segment->x1 = x1; - segment->y1 = y1; - segment->x2 = x2; - segment->y2 = y2; - - UnlockDisplay(dpy); - SyncHandle(); - } - return 1; -} - diff --git a/nx-X11/lib/X11/DrLines.c b/nx-X11/lib/X11/DrLines.c deleted file mode 100644 index 68071b6b4..000000000 --- a/nx-X11/lib/X11/DrLines.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawLines ( - register Display *dpy, - Drawable d, - GC gc, - XPoint *points, - int npoints, - int mode) -{ - register xPolyLineReq *req; - register long length; - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq (PolyLine, req); - req->drawable = d; - req->gc = gc->gid; - req->coordMode = mode; - SetReqLen(req, npoints, 65535 - req->length); - /* each point is 2 16-bit integers */ - length = npoints << 2; /* watch out for macros... */ - Data16 (dpy, (short *) points, length); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/DrPoint.c b/nx-X11/lib/X11/DrPoint.c deleted file mode 100644 index f0332e853..000000000 --- a/nx-X11/lib/X11/DrPoint.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* precompute the maximum size of batching request allowed */ - -#define size (SIZEOF(xPolyPointReq) + PTSPERBATCH * SIZEOF(xPoint)) - -int -XDrawPoint( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y) /* INT16 */ -{ - xPoint *point; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - { - register xPolyPointReq *req = (xPolyPointReq *) dpy->last_req; - - - /* if same as previous request, with same drawable, batch requests */ - if ( - (req->reqType == X_PolyPoint) - && (req->drawable == d) - && (req->gc == gc->gid) - && (req->coordMode == CoordModeOrigin) - && ((dpy->bufptr + SIZEOF(xPoint)) <= dpy->bufmax) - && (((char *)dpy->bufptr - (char *)req) < size) ) { - req->length += SIZEOF(xPoint) >> 2; - point = (xPoint *) dpy->bufptr; - dpy->bufptr += SIZEOF(xPoint); - } - - else { - GetReqExtra(PolyPoint, 4, req); /* 1 point = 4 bytes */ - req->drawable = d; - req->gc = gc->gid; - req->coordMode = CoordModeOrigin; - point = (xPoint *) NEXTPTR(req,xPolyPointReq); - } - - point->x = x; - point->y = y; - - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/DrPoints.c b/nx-X11/lib/X11/DrPoints.c deleted file mode 100644 index 287fa057d..000000000 --- a/nx-X11/lib/X11/DrPoints.c +++ /dev/null @@ -1,85 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawPoints( - register Display *dpy, - Drawable d, - GC gc, - XPoint *points, - int n_points, - int mode) /* CoordMode */ -{ - register xPolyPointReq *req; - register long nbytes; - int n; - int xoff, yoff; - XPoint pt; - - xoff = yoff = 0; - LockDisplay(dpy); - FlushGC(dpy, gc); - while (n_points) { - GetReq(PolyPoint, req); - req->drawable = d; - req->gc = gc->gid; - req->coordMode = mode; - n = n_points; - if (!dpy->bigreq_size && n > (dpy->max_request_size - req->length)) - n = dpy->max_request_size - req->length; - SetReqLen(req, n, n); - nbytes = ((long)n) << 2; /* watch out for macros... */ - if (xoff || yoff) { - pt.x = xoff + points->x; - pt.y = yoff + points->y; - Data16 (dpy, (short *) &pt, 4); - if (nbytes > 4) { - Data16 (dpy, (short *) (points + 1), nbytes - 4); - } - } else { - Data16 (dpy, (short *) points, nbytes); - } - n_points -= n; - if (n_points && (mode == CoordModePrevious)) { - register XPoint *pptr = points; - points += n; - while (pptr != points) { - xoff += pptr->x; - yoff += pptr->y; - pptr++; - } - } else - points += n; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/DrRect.c b/nx-X11/lib/X11/DrRect.c deleted file mode 100644 index d9141eef9..000000000 --- a/nx-X11/lib/X11/DrRect.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* precompute the maximum size of batching request allowed */ - -#define wsize (SIZEOF(xPolyRectangleReq) + WRCTSPERBATCH * SIZEOF(xRectangle)) -#define zsize (SIZEOF(xPolyRectangleReq) + ZRCTSPERBATCH * SIZEOF(xRectangle)) - -int -XDrawRectangle( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, /* INT16 */ - unsigned int width, - unsigned int height) /* CARD16 */ -{ - xRectangle *rect; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - { - register xPolyRectangleReq *req = (xPolyRectangleReq *) dpy->last_req; - - /* if same as previous request, with same drawable, batch requests */ - if ( - (req->reqType == X_PolyRectangle) - && (req->drawable == d) - && (req->gc == gc->gid) - && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) - && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? - wsize : zsize)) ) { - req->length += SIZEOF(xRectangle) >> 2; - rect = (xRectangle *) dpy->bufptr; - dpy->bufptr += SIZEOF(xRectangle); - } - - else { - GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req); - req->drawable = d; - req->gc = gc->gid; - rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq); - } - - rect->x = x; - rect->y = y; - rect->width = width; - rect->height = height; - - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/DrRects.c b/nx-X11/lib/X11/DrRects.c deleted file mode 100644 index 7827bf18d..000000000 --- a/nx-X11/lib/X11/DrRects.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawRectangles( - register Display *dpy, - Drawable d, - GC gc, - XRectangle *rects, - int n_rects) -{ - register xPolyRectangleReq *req; - long len; - int n; - - LockDisplay(dpy); - FlushGC(dpy, gc); - while (n_rects) { - GetReq(PolyRectangle, req); - req->drawable = d; - req->gc = gc->gid; - n = n_rects; - len = ((long)n) << 1; - if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; - len = ((long)n) << 1; - } - SetReqLen(req, len, len); - len <<= 2; /* watch out for macros... */ - Data16 (dpy, (short *) rects, len); - n_rects -= n; - rects += n; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/DrSegs.c b/nx-X11/lib/X11/DrSegs.c deleted file mode 100644 index 93eab4d08..000000000 --- a/nx-X11/lib/X11/DrSegs.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawSegments ( - register Display *dpy, - Drawable d, - GC gc, - XSegment *segments, - int nsegments) -{ - register xPolySegmentReq *req; - long len; - int n; - - LockDisplay(dpy); - FlushGC(dpy, gc); - while (nsegments) { - GetReq (PolySegment, req); - req->drawable = d; - req->gc = gc->gid; - n = nsegments; - len = ((long)n) << 1; - if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; - len = ((long)n) << 1; - } - SetReqLen(req, len, len); - len <<= 2; /* watch out for macros... */ - Data16 (dpy, (short *) segments, len); - nsegments -= n; - segments += n; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ErrDes.c b/nx-X11/lib/X11/ErrDes.c deleted file mode 100644 index f13e3dce4..000000000 --- a/nx-X11/lib/X11/ErrDes.c +++ /dev/null @@ -1,212 +0,0 @@ -/* - */ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "Xresource.h" -#include - -#ifndef ERRORDB -#ifndef XERRORDB -#define ERRORDB "/usr/lib/X11/XErrorDB" -#else -#define ERRORDB XERRORDB -#endif -#endif - -/* - * descriptions of errors in Section 4 of Protocol doc (pp. 350-351); more - * verbose descriptions are given in the error database - */ -static const char _XErrorList[] = - /* No error */ "no error\0" - /* BadRequest */ "BadRequest\0" - /* BadValue */ "BadValue\0" - /* BadWindow */ "BadWindow\0" - /* BadPixmap */ "BadPixmap\0" - /* BadAtom */ "BadAtom\0" - /* BadCursor */ "BadCursor\0" - /* BadFont */ "BadFont\0" - /* BadMatch */ "BadMatch\0" - /* BadDrawable */ "BadDrawable\0" - /* BadAccess */ "BadAccess\0" - /* BadAlloc */ "BadAlloc\0" - /* BadColor */ "BadColor\0" - /* BadGC */ "BadGC\0" - /* BadIDChoice */ "BadIDChoice\0" - /* BadName */ "BadName\0" - /* BadLength */ "BadLength\0" - /* BadImplementation */ "BadImplementation" -; - -/* offsets into _XErrorList */ -static const unsigned char _XErrorOffsets[] = { - 0, 9, 20, 29, 39, 49, 57, 67, 75, 84, 96, - 106, 115, 124, 130, 142, 150, 160 -}; - - -int -XGetErrorText( - register Display *dpy, - register int code, - char *buffer, - int nbytes) -{ - char buf[150]; - register _XExtension *ext; - _XExtension *bext = (_XExtension *)NULL; - - if (nbytes == 0) return 0; - if (code <= BadImplementation && code > 0) { - snprintf(buf, sizeof(buf), "%d", code); - (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, - _XErrorList + _XErrorOffsets[code], - buffer, nbytes); - } else - buffer[0] = '\0'; - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_string) - (*ext->error_string)(dpy, code, &ext->codes, buffer, nbytes); - if (ext->codes.first_error && - ext->codes.first_error <= code && - (!bext || ext->codes.first_error > bext->codes.first_error)) - bext = ext; - } - if (!buffer[0] && bext) { - snprintf(buf, sizeof(buf), "%s.%d", - bext->name, code - bext->codes.first_error); - (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); - } - if (!buffer[0]) - snprintf(buffer, nbytes, "%d", code); - return 0; -} - -int -/*ARGSUSED*/ -XGetErrorDatabaseText( - Display *dpy, - register _Xconst char *name, - register _Xconst char *type, - _Xconst char *defaultp, - char *buffer, - int nbytes) -{ - - static XrmDatabase db = NULL; - XrmString type_str; - XrmValue result; - char temp[BUFSIZ]; - char* tptr; - unsigned long tlen; - - if (nbytes == 0) return 0; - - if (!db) { - /* the Xrm routines expect to be called with the global - mutex unlocked. */ - XrmDatabase temp_db; - int do_destroy; - const char *dbname; - - XrmInitialize(); -#ifdef WIN32 - dbname = getenv("XERRORDB"); - if (!dbname) - dbname = ERRORDB; -#else - dbname = ERRORDB; -#endif - temp_db = XrmGetFileDatabase(dbname); - - _XLockMutex(_Xglobal_lock); - if (!db) { - db = temp_db; - do_destroy = 0; - } else - do_destroy = 1; /* we didn't need to get it after all */ - _XUnlockMutex(_Xglobal_lock); - - if (do_destroy) - XrmDestroyDatabase(temp_db); - } - - if (db) - { - tlen = strlen (name) + strlen (type) + 2; - if (tlen <= sizeof(temp)) - tptr = temp; - else - tptr = Xmalloc (tlen); - if (tptr) { - snprintf(tptr, tlen, "%s.%s", name, type); - XrmGetResource(db, tptr, "ErrorType.ErrorNumber", - &type_str, &result); - if (tptr != temp) - Xfree (tptr); - } else { - result.addr = (XPointer) NULL; - } - } - else - result.addr = (XPointer)NULL; - if (!result.addr) { - result.addr = (XPointer) defaultp; - result.size = strlen(defaultp) + 1; - } - (void) strncpy (buffer, (char *) result.addr, nbytes); - if (result.size > nbytes) buffer[nbytes-1] = '\0'; - return 0; -} diff --git a/nx-X11/lib/X11/ErrHndlr.c b/nx-X11/lib/X11/ErrHndlr.c deleted file mode 100644 index 167a68b1e..000000000 --- a/nx-X11/lib/X11/ErrHndlr.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * XErrorHandler - This procedure sets the X non-fatal error handler - * (_XErrorFunction) to be the specified routine. If NULL is passed in - * the original error handler is restored. - */ - -XErrorHandler -XSetErrorHandler(XErrorHandler handler) -{ - int (*oldhandler)(Display *dpy, XErrorEvent *event); - - _XLockMutex(_Xglobal_lock); - oldhandler = _XErrorFunction; - - if (!oldhandler) - oldhandler = _XDefaultError; - - if (handler != NULL) { - _XErrorFunction = handler; - } - else { - _XErrorFunction = _XDefaultError; - } - _XUnlockMutex(_Xglobal_lock); - - return (XErrorHandler) oldhandler; -} - -/* - * XIOErrorHandler - This procedure sets the X fatal I/O error handler - * (_XIOErrorFunction) to be the specified routine. If NULL is passed in - * the original error handler is restored. - */ - -XIOErrorHandler -XSetIOErrorHandler(XIOErrorHandler handler) -{ - int (*oldhandler)(Display *dpy); - - _XLockMutex(_Xglobal_lock); - oldhandler = _XIOErrorFunction; - - if (!oldhandler) - oldhandler = _XDefaultIOError; - - if (handler != NULL) { - _XIOErrorFunction = handler; - } - else { - _XIOErrorFunction = _XDefaultIOError; - } - _XUnlockMutex(_Xglobal_lock); - - return (XIOErrorHandler) oldhandler; -} diff --git a/nx-X11/lib/X11/EvToWire.c b/nx-X11/lib/X11/EvToWire.c deleted file mode 100644 index 4aca053ab..000000000 --- a/nx-X11/lib/X11/EvToWire.c +++ /dev/null @@ -1,406 +0,0 @@ - -/* - -Copyright 1985, 1986, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * XEvToWire.c - Internal support routines for the C subroutine - * interface library (Xlib) to the X Window System Protocol V11.0. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Reformat an XEvent structure to a wire event of the right type. - * Return True on success. If the type is unrecognized, return what - * _XUnknownNativeEvent returns (i.e., False). - */ -Status -_XEventToWire( - register Display *dpy, - register XEvent *re, /* in: from */ - register xEvent *event) /* out: to */ -{ - switch (event->u.u.type = re->type) { - case KeyPress: - case KeyRelease: - { - register XKeyEvent *ev = (XKeyEvent*) re; - event->u.keyButtonPointer.root = ev->root; - event->u.keyButtonPointer.event = ev->window; - event->u.keyButtonPointer.child = ev->subwindow; - event->u.keyButtonPointer.time = ev->time; - event->u.keyButtonPointer.eventX = ev->x ; - event->u.keyButtonPointer.eventY = ev->y ; - event->u.keyButtonPointer.rootX = ev->x_root; - event->u.keyButtonPointer.rootY = ev->y_root; - event->u.keyButtonPointer.state = ev->state; - event->u.keyButtonPointer.sameScreen = ev->same_screen; - event->u.u.detail = ev->keycode; - } - break; - case ButtonPress: - case ButtonRelease: - { - register XButtonEvent *ev = (XButtonEvent *) re; - event->u.keyButtonPointer.root = ev->root; - event->u.keyButtonPointer.event = ev->window; - event->u.keyButtonPointer.child = ev->subwindow; - event->u.keyButtonPointer.time = ev->time; - event->u.keyButtonPointer.eventX = ev->x; - event->u.keyButtonPointer.eventY = ev->y; - event->u.keyButtonPointer.rootX = ev->x_root; - event->u.keyButtonPointer.rootY = ev->y_root; - event->u.keyButtonPointer.state = ev->state; - event->u.keyButtonPointer.sameScreen = ev->same_screen; - event->u.u.detail = ev->button; - } - break; - case MotionNotify: - { - register XMotionEvent *ev = (XMotionEvent *)re; - event->u.keyButtonPointer.root = ev->root; - event->u.keyButtonPointer.event = ev->window; - event->u.keyButtonPointer.child = ev->subwindow; - event->u.keyButtonPointer.time = ev->time; - event->u.keyButtonPointer.eventX= ev->x; - event->u.keyButtonPointer.eventY= ev->y; - event->u.keyButtonPointer.rootX = ev->x_root; - event->u.keyButtonPointer.rootY = ev->y_root; - event->u.keyButtonPointer.state = ev->state; - event->u.keyButtonPointer.sameScreen= ev->same_screen; - event->u.u.detail = ev->is_hint; - } - break; - case EnterNotify: - case LeaveNotify: - { - register XCrossingEvent *ev = (XCrossingEvent *) re; - event->u.enterLeave.root = ev->root; - event->u.enterLeave.event = ev->window; - event->u.enterLeave.child = ev->subwindow; - event->u.enterLeave.time = ev->time; - event->u.enterLeave.eventX = ev->x; - event->u.enterLeave.eventY = ev->y; - event->u.enterLeave.rootX = ev->x_root; - event->u.enterLeave.rootY = ev->y_root; - event->u.enterLeave.state = ev->state; - event->u.enterLeave.mode = ev->mode; - event->u.enterLeave.flags = 0; - if (ev->same_screen) { - event->u.enterLeave.flags |= ELFlagSameScreen; - } - if (ev->focus) { - event->u.enterLeave.flags |= ELFlagFocus; - } - event->u.u.detail = ev->detail; - } - break; - case FocusIn: - case FocusOut: - { - register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; - event->u.focus.window = ev->window; - event->u.focus.mode = ev->mode; - event->u.u.detail = ev->detail; - } - break; - case KeymapNotify: - { - register XKeymapEvent *ev = (XKeymapEvent *) re; - memcpy ((char *)(((xKeymapEvent *) event)->map), - &ev->key_vector[1], - sizeof (((xKeymapEvent *) event)->map)); - } - break; - case Expose: - { - register XExposeEvent *ev = (XExposeEvent *) re; - event->u.expose.window = ev->window; - event->u.expose.x = ev->x; - event->u.expose.y = ev->y; - event->u.expose.width = ev->width; - event->u.expose.height = ev->height; - event->u.expose.count = ev->count; - } - break; - case GraphicsExpose: - { - register XGraphicsExposeEvent *ev = - (XGraphicsExposeEvent *) re; - event->u.graphicsExposure.drawable = ev->drawable; - event->u.graphicsExposure.x = ev->x; - event->u.graphicsExposure.y = ev->y; - event->u.graphicsExposure.width = ev->width; - event->u.graphicsExposure.height = ev->height; - event->u.graphicsExposure.count = ev->count; - event->u.graphicsExposure.majorEvent= ev->major_code; - event->u.graphicsExposure.minorEvent= ev->minor_code; - } - break; - case NoExpose: - { - register XNoExposeEvent *ev = (XNoExposeEvent *) re; - event->u.noExposure.drawable = ev->drawable; - event->u.noExposure.majorEvent = ev->major_code; - event->u.noExposure.minorEvent = ev->minor_code; - } - break; - case VisibilityNotify: - { - register XVisibilityEvent *ev = (XVisibilityEvent *) re; - event->u.visibility.window = ev->window; - event->u.visibility.state = ev->state; - } - break; - case CreateNotify: - { - register XCreateWindowEvent *ev = - (XCreateWindowEvent *) re; - event->u.createNotify.window = ev->window; - event->u.createNotify.parent = ev->parent; - event->u.createNotify.x = ev->x; - event->u.createNotify.y = ev->y; - event->u.createNotify.width = ev->width; - event->u.createNotify.height = ev->height; - event->u.createNotify.borderWidth = ev->border_width; - event->u.createNotify.override = ev->override_redirect; - } - break; - case DestroyNotify: - { - register XDestroyWindowEvent *ev = - (XDestroyWindowEvent *) re; - event->u.destroyNotify.window = ev->window; - event->u.destroyNotify.event = ev->event; - } - break; - case UnmapNotify: - { - register XUnmapEvent *ev = (XUnmapEvent *) re; - event->u.unmapNotify.window = ev->window; - event->u.unmapNotify.event = ev->event; - event->u.unmapNotify.fromConfigure = ev->from_configure; - } - break; - case MapNotify: - { - register XMapEvent *ev = (XMapEvent *) re; - event->u.mapNotify.window = ev->window; - event->u.mapNotify.event = ev->event; - event->u.mapNotify.override = ev->override_redirect; - } - break; - case MapRequest: - { - register XMapRequestEvent *ev = (XMapRequestEvent *) re; - event->u.mapRequest.window = ev->window; - event->u.mapRequest.parent = ev->parent; - } - break; - case ReparentNotify: - { - register XReparentEvent *ev = (XReparentEvent *) re; - event->u.reparent.window = ev->window; - event->u.reparent.event = ev->event; - event->u.reparent.parent = ev->parent; - event->u.reparent.x = ev->x; - event->u.reparent.y = ev->y; - event->u.reparent.override = ev->override_redirect; - } - break; - case ConfigureNotify: - { - register XConfigureEvent *ev = (XConfigureEvent *) re; - event->u.configureNotify.window = ev->window; - event->u.configureNotify.event = ev->event; - event->u.configureNotify.aboveSibling = ev->above; - event->u.configureNotify.x = ev->x; - event->u.configureNotify.y = ev->y; - event->u.configureNotify.width = ev->width; - event->u.configureNotify.height = ev->height; - event->u.configureNotify.borderWidth= ev->border_width; - event->u.configureNotify.override = ev->override_redirect; - } - break; - case ConfigureRequest: - { - register XConfigureRequestEvent *ev = - (XConfigureRequestEvent *) re; - event->u.configureRequest.window = ev->window; - event->u.configureRequest.parent = ev->parent; - event->u.configureRequest.sibling = ev->above; - event->u.configureRequest.x = ev->x; - event->u.configureRequest.y = ev->y; - event->u.configureRequest.width = ev->width; - event->u.configureRequest.height = ev->height; - event->u.configureRequest.borderWidth= ev->border_width; - event->u.configureRequest.valueMask= ev->value_mask; - event->u.u.detail = ev->detail; - } - break; - case GravityNotify: - { - register XGravityEvent *ev = (XGravityEvent *) re; - event->u.gravity.window = ev->window; - event->u.gravity.event = ev->event; - event->u.gravity.x = ev->x; - event->u.gravity.y = ev->y; - } - break; - case ResizeRequest: - { - register XResizeRequestEvent *ev = - (XResizeRequestEvent *) re; - event->u.resizeRequest.window = ev->window; - event->u.resizeRequest.width = ev->width; - event->u.resizeRequest.height = ev->height; - } - break; - case CirculateNotify: - { - register XCirculateEvent *ev = (XCirculateEvent *) re; - event->u.circulate.window = ev->window; - event->u.circulate.event = ev->event; - event->u.circulate.place = ev->place; - } - break; - case CirculateRequest: - { - register XCirculateRequestEvent *ev = - (XCirculateRequestEvent *) re; - event->u.circulate.window = ev->window; - event->u.circulate.event = ev->parent; - event->u.circulate.place = ev->place; - } - break; - case PropertyNotify: - { - register XPropertyEvent *ev = (XPropertyEvent *) re; - event->u.property.window = ev->window; - event->u.property.atom = ev->atom; - event->u.property.time = ev->time; - event->u.property.state = ev->state; - } - break; - case SelectionClear: - { - register XSelectionClearEvent *ev = - (XSelectionClearEvent *) re; - event->u.selectionClear.window = ev->window; - event->u.selectionClear.atom = ev->selection; - event->u.selectionClear.time = ev->time; - } - break; - case SelectionRequest: - { - register XSelectionRequestEvent *ev = - (XSelectionRequestEvent *) re; - event->u.selectionRequest.owner = ev->owner; - event->u.selectionRequest.requestor = ev->requestor; - event->u.selectionRequest.selection = ev->selection; - event->u.selectionRequest.target = ev->target; - event->u.selectionRequest.property = ev->property; - event->u.selectionRequest.time = ev->time; - } - break; - case SelectionNotify: - { - register XSelectionEvent *ev = (XSelectionEvent *) re; - event->u.selectionNotify.requestor = ev->requestor; - event->u.selectionNotify.selection = ev->selection; - event->u.selectionNotify.target = ev->target; - event->u.selectionNotify.property = ev->property; - event->u.selectionNotify.time = ev->time; - } - break; - case ColormapNotify: - { - register XColormapEvent *ev = (XColormapEvent *) re; - event->u.colormap.window = ev->window; - event->u.colormap.colormap = ev->colormap; - event->u.colormap.new = ev->new; - event->u.colormap.state = ev->state; - } - break; - case ClientMessage: - { - register int i; - register XClientMessageEvent *ev - = (XClientMessageEvent *) re; - event->u.clientMessage.window = ev->window; - event->u.u.detail = ev->format; - switch (ev->format) { - case 8: - event->u.clientMessage.u.b.type = ev->message_type; - for (i = 0; i < 20; i++) - event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; - break; - case 16: - event->u.clientMessage.u.s.type = ev->message_type; - event->u.clientMessage.u.s.shorts0 = ev->data.s[0]; - event->u.clientMessage.u.s.shorts1 = ev->data.s[1]; - event->u.clientMessage.u.s.shorts2 = ev->data.s[2]; - event->u.clientMessage.u.s.shorts3 = ev->data.s[3]; - event->u.clientMessage.u.s.shorts4 = ev->data.s[4]; - event->u.clientMessage.u.s.shorts5 = ev->data.s[5]; - event->u.clientMessage.u.s.shorts6 = ev->data.s[6]; - event->u.clientMessage.u.s.shorts7 = ev->data.s[7]; - event->u.clientMessage.u.s.shorts8 = ev->data.s[8]; - event->u.clientMessage.u.s.shorts9 = ev->data.s[9]; - break; - case 32: - event->u.clientMessage.u.l.type = ev->message_type; - event->u.clientMessage.u.l.longs0 = ev->data.l[0]; - event->u.clientMessage.u.l.longs1 = ev->data.l[1]; - event->u.clientMessage.u.l.longs2 = ev->data.l[2]; - event->u.clientMessage.u.l.longs3 = ev->data.l[3]; - event->u.clientMessage.u.l.longs4 = ev->data.l[4]; - break; - default: - /* client passing bogus data, let server complain */ - break; - } - } - break; - case MappingNotify: - { - register XMappingEvent *ev = (XMappingEvent *) re; - event->u.mappingNotify.firstKeyCode = ev->first_keycode; - event->u.mappingNotify.request = ev->request; - event->u.mappingNotify.count = ev->count; - } - break; - - default: - return(_XUnknownNativeEvent(dpy, re, event)); - } - return(1); -} diff --git a/nx-X11/lib/X11/FSSaver.c b/nx-X11/lib/X11/FSSaver.c deleted file mode 100644 index 3df8ae681..000000000 --- a/nx-X11/lib/X11/FSSaver.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XActivateScreenSaver(register Display *dpy) -{ - XForceScreenSaver (dpy, ScreenSaverActive); - return 1; -} - -int -XResetScreenSaver(register Display *dpy) -{ - XForceScreenSaver (dpy, ScreenSaverReset); - return 1; -} - -int -XForceScreenSaver( - register Display *dpy, - int mode) -{ - register xForceScreenSaverReq *req; - - LockDisplay(dpy); - GetReq(ForceScreenSaver, req); - req->mode = mode; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/FSWrap.c b/nx-X11/lib/X11/FSWrap.c deleted file mode 100644 index 015965779..000000000 --- a/nx-X11/lib/X11/FSWrap.c +++ /dev/null @@ -1,262 +0,0 @@ - -/* - * Copyright 1991 by the Open Software Foundation - * Copyright 1993 by the TOSHIBA Corp. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 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 - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * 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 - * 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 - * - * Katsuhisa Yano TOSHIBA Corp. - */ - -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include -#include - - -#define XMAXLIST 256 - -char ** -_XParseBaseFontNameList( - char *str, - int *num) -{ - char *plist[XMAXLIST]; - char **list; - char *ptr, *psave; - - *num = 0; - if (!str || !*str) { - return (char **)NULL; - } - while (*str && isspace(*str)) - str++; - if (!*str) - return (char **)NULL; - - if (!(ptr = strdup(str))) { - return (char **)NULL; - } - - psave = ptr; - /* somebody who specifies more than XMAXLIST basefontnames will lose */ - while (*num < (sizeof plist / sizeof plist[0])) { - char *back; - - plist[*num] = ptr; - if ((ptr = strchr(ptr, ','))) { - back = ptr; - } else { - back = plist[*num] + strlen(plist[*num]); - } - while (isspace(*(back - 1))) - back--; - *back = '\0'; - (*num)++; - if (!ptr) - break; - ptr++; - while (*ptr && isspace(*ptr)) - ptr++; - if (!*ptr) - break; - } - if (!(list = Xmalloc(sizeof(char *) * (*num + 1)))) { - Xfree(psave); - return (char **)NULL; - } - memcpy((char *)list, (char *)plist, sizeof(char *) * (*num)); - *(list + *num) = NULL; - - return list; -} - -static char ** -copy_string_list( - char **string_list, - int list_count) -{ - char **string_list_ret, **list_src, **list_dst, *dst; - int length, count; - - if (string_list == NULL || list_count <= 0) - return (char **) NULL; - - string_list_ret = Xmalloc(sizeof(char *) * list_count); - if (string_list_ret == NULL) - return (char **) NULL; - - list_src = string_list; - count = list_count; - for (length = 0; count-- > 0; list_src++) - length += strlen(*list_src) + 1; - - dst = Xmalloc(length); - if (dst == NULL) { - Xfree(string_list_ret); - return (char **) NULL; - } - - list_src = string_list; - count = list_count; - list_dst = string_list_ret; - for ( ; count-- > 0; list_src++) { - strcpy(dst, *list_src); - *list_dst++ = dst; - dst += strlen(dst) + 1; - } - - return string_list_ret; -} - -XFontSet -XCreateFontSet ( - Display *dpy, - _Xconst char *base_font_name_list, - char ***missing_charset_list, - int *missing_charset_count, - char **def_string) -{ - XOM om; - XOC oc; - XOMCharSetList *list; - - *missing_charset_list = NULL; - *missing_charset_count = 0; - - om = XOpenOM(dpy, NULL, NULL, NULL); - if (om == NULL) - return (XFontSet) NULL; - - if ((oc = XCreateOC(om, XNBaseFontName, base_font_name_list, NULL))) { - list = &oc->core.missing_list; - oc->core.om_automatic = True; - } else - list = &om->core.required_charset; - - *missing_charset_list = copy_string_list(list->charset_list, - list->charset_count); - *missing_charset_count = list->charset_count; - - if (list->charset_list && *missing_charset_list == NULL) - oc = NULL; - - if (oc && def_string) { - *def_string = oc->core.default_string; - if (!*def_string) - *def_string = ""; - } - - if (oc == NULL) - XCloseOM(om); - - return (XFontSet) oc; -} - -int -XFontsOfFontSet( - XFontSet font_set, - XFontStruct ***font_struct_list, - char ***font_name_list) -{ - *font_name_list = font_set->core.font_info.font_name_list; - *font_struct_list = font_set->core.font_info.font_struct_list; - return font_set->core.font_info.num_font; -} - -char * -XBaseFontNameListOfFontSet(XFontSet font_set) -{ - return font_set->core.base_name_list; -} - -char * -XLocaleOfFontSet(XFontSet font_set) -{ - return font_set->core.om->core.lcd->core->name; -} - -Bool -XContextDependentDrawing(XFontSet font_set) -{ - return font_set->core.om->core.context_dependent; -} - -Bool -XDirectionalDependentDrawing(XFontSet font_set) -{ - return font_set->core.om->core.directional_dependent; -} - -Bool -XContextualDrawing(XFontSet font_set) -{ - return font_set->core.om->core.contextual_drawing; -} - -XFontSetExtents * -XExtentsOfFontSet(XFontSet font_set) -{ - if (!font_set) - return NULL; - return &font_set->core.font_set_extents; -} - -void -XFreeFontSet( - Display *dpy, - XFontSet font_set) -{ - XCloseOM(font_set->core.om); -} diff --git a/nx-X11/lib/X11/FetchName.c b/nx-X11/lib/X11/FetchName.c deleted file mode 100644 index 52c65c52c..000000000 --- a/nx-X11/lib/X11/FetchName.c +++ /dev/null @@ -1,95 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - - -Status XFetchName ( - register Display *dpy, - Window w, - char **name) -{ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long leftover; - unsigned char *data = NULL; - if (XGetWindowProperty(dpy, w, XA_WM_NAME, 0L, (long)BUFSIZ, False, XA_STRING, - &actual_type, - &actual_format, &nitems, &leftover, &data) != Success) { - *name = NULL; - return (0); - } - if ( (actual_type == XA_STRING) && (actual_format == 8) ) { - - /* The data returned by XGetWindowProperty is guarranteed to - contain one extra byte that is null terminated to make retrieveing - string properties easy. */ - - *name = (char *)data; - return(1); - } - Xfree (data); - *name = NULL; - return(0); -} - -Status XGetIconName ( - register Display *dpy, - Window w, - char **icon_name) -{ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long leftover; - unsigned char *data = NULL; - if (XGetWindowProperty(dpy, w, XA_WM_ICON_NAME, 0L, (long)BUFSIZ, False, - XA_STRING, - &actual_type, - &actual_format, &nitems, &leftover, &data) != Success) { - *icon_name = NULL; - return (0); - } - if ( (actual_type == XA_STRING) && (actual_format == 8) ) { - - /* The data returned by XGetWindowProperty is guarranteed to - contain one extra byte that is null terminated to make retrieveing - string properties easy. */ - - *icon_name = (char*)data; - return(1); - } - Xfree (data); - *icon_name = NULL; - return(0); -} diff --git a/nx-X11/lib/X11/FillArc.c b/nx-X11/lib/X11/FillArc.c deleted file mode 100644 index c67f977b7..000000000 --- a/nx-X11/lib/X11/FillArc.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* precompute the maximum size of batching request allowed */ - -#define size (SIZEOF(xPolyFillArcReq) + FARCSPERBATCH * SIZEOF(xArc)) - -int -XFillArc( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, /* INT16 */ - unsigned int width, - unsigned int height, /* CARD16 */ - int angle1, - int angle2) /* INT16 */ -{ - xArc *arc; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - { - register xPolyFillArcReq *req = (xPolyFillArcReq *) dpy->last_req; - - /* if same as previous request, with same drawable, batch requests */ - if ( - (req->reqType == X_PolyFillArc) - && (req->drawable == d) - && (req->gc == gc->gid) - && ((dpy->bufptr + SIZEOF(xArc)) <= dpy->bufmax) - && (((char *)dpy->bufptr - (char *)req) < size) ) { - req->length += SIZEOF(xArc) >> 2; - arc = (xArc *) dpy->bufptr; - dpy->bufptr += SIZEOF(xArc); - } - - else { - GetReqExtra(PolyFillArc, SIZEOF(xArc), req); - - req->drawable = d; - req->gc = gc->gid; - arc = (xArc *) NEXTPTR(req,xPolyFillArcReq); - } - arc->x = x; - arc->y = y; - arc->width = width; - arc->height = height; - arc->angle1 = angle1; - arc->angle2 = angle2; - - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/FillArcs.c b/nx-X11/lib/X11/FillArcs.c deleted file mode 100644 index 62cfabf8f..000000000 --- a/nx-X11/lib/X11/FillArcs.c +++ /dev/null @@ -1,67 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define arc_scale (SIZEOF(xArc) / 4) - -int -XFillArcs( - register Display *dpy, - Drawable d, - GC gc, - XArc *arcs, - int n_arcs) -{ - register xPolyFillArcReq *req; - long len; - int n; - - LockDisplay(dpy); - FlushGC(dpy, gc); - while (n_arcs) { - GetReq(PolyFillArc, req); - req->drawable = d; - req->gc = gc->gid; - n = n_arcs; - len = ((long)n) * arc_scale; - if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) / arc_scale; - len = ((long)n) * arc_scale; - } - SetReqLen(req, len, len); - len <<= 2; /* watch out for macros... */ - Data16 (dpy, (short *) arcs, len); - n_arcs -= n; - arcs += n; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/FillPoly.c b/nx-X11/lib/X11/FillPoly.c deleted file mode 100644 index ea162a41e..000000000 --- a/nx-X11/lib/X11/FillPoly.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XFillPolygon( - register Display *dpy, - Drawable d, - GC gc, - XPoint *points, - int n_points, - int shape, - int mode) -{ - register xFillPolyReq *req; - register long nbytes; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq(FillPoly, req); - - req->drawable = d; - req->gc = gc->gid; - req->shape = shape; - req->coordMode = mode; - - SetReqLen(req, n_points, 65535 - req->length); - - /* shift (mult. by 4) before passing to the (possible) macro */ - - nbytes = n_points << 2; - - Data16 (dpy, (short *) points, nbytes); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/FillRct.c b/nx-X11/lib/X11/FillRct.c deleted file mode 100644 index 3ca9afe9e..000000000 --- a/nx-X11/lib/X11/FillRct.c +++ /dev/null @@ -1,82 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* precompute the maximum size of batching request allowed */ - -#define size (SIZEOF(xPolyFillRectangleReq) + FRCTSPERBATCH * SIZEOF(xRectangle)) - -int -XFillRectangle( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, /* INT16 */ - unsigned int width, - unsigned int height) /* CARD16 */ -{ - xRectangle *rect; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - { - register xPolyFillRectangleReq *req - = (xPolyFillRectangleReq *) dpy->last_req; - - /* if same as previous request, with same drawable, batch requests */ - if ( - (req->reqType == X_PolyFillRectangle) - && (req->drawable == d) - && (req->gc == gc->gid) - && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) - && (((char *)dpy->bufptr - (char *)req) < size) ) { - req->length += SIZEOF(xRectangle) >> 2; - rect = (xRectangle *) dpy->bufptr; - dpy->bufptr += SIZEOF(xRectangle); - } - - else { - GetReqExtra(PolyFillRectangle, SIZEOF(xRectangle), req); - req->drawable = d; - req->gc = gc->gid; - rect = (xRectangle *) NEXTPTR(req,xPolyFillRectangleReq); - } - rect->x = x; - rect->y = y; - rect->width = width; - rect->height = height; - - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/FillRcts.c b/nx-X11/lib/X11/FillRcts.c deleted file mode 100644 index ad334244f..000000000 --- a/nx-X11/lib/X11/FillRcts.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XFillRectangles( - register Display *dpy, - Drawable d, - GC gc, - XRectangle *rectangles, - int n_rects) -{ - register xPolyFillRectangleReq *req; - long len; - int n; - - LockDisplay(dpy); - FlushGC(dpy, gc); - while (n_rects) { - GetReq(PolyFillRectangle, req); - req->drawable = d; - req->gc = gc->gid; - n = n_rects; - len = ((long)n) << 1; - if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { - n = (dpy->max_request_size - req->length) >> 1; - len = ((long)n) << 1; - } - SetReqLen(req, len, len); - len <<= 2; /* watch out for macros... */ - Data16 (dpy, (short *) rectangles, len); - n_rects -= n; - rectangles += n; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/FilterEv.c b/nx-X11/lib/X11/FilterEv.c deleted file mode 100644 index 0a48e5486..000000000 --- a/nx-X11/lib/X11/FilterEv.c +++ /dev/null @@ -1,106 +0,0 @@ - - /* - * Copyright 1990, 1991 by OMRON Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 OMRON not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OMRON makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OMRON 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 - * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Author: Seiji Kuwari OMRON Corporation - * kuwa@omron.co.jp - * kuwa%omron.co.jp@uunet.uu.net - */ - -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#else -#define XLOCALE 1 -#endif -#include "Xlibint.h" -#if XLOCALE -#include "Xlcint.h" -#endif - -extern long const _Xevent_to_mask[]; - -/* - * Look up if there is a specified filter for the event. - */ -Bool -XFilterEvent( - XEvent *ev, - Window window) -{ -#if XLOCALE - XFilterEventList p; - Window win; - long mask; - Bool ret; - - if (window) - win = window; - else - win = ev->xany.window; - if (ev->type >= LASTEvent) - mask = 0; - else - mask = _Xevent_to_mask[ev->type]; - - LockDisplay(ev->xany.display); - for (p = ev->xany.display->im_filters; p != NULL; p = p->next) { - if (win == p->window) { - if ((mask & p->event_mask) || - (ev->type >= p->start_type && ev->type <= p->end_type)) { - UnlockDisplay(ev->xany.display); - ret = (*(p->filter))(ev->xany.display, p->window, ev, - p->client_data); - return(ret); - } - } - } - UnlockDisplay(ev->xany.display); -#endif - return(False); -} diff --git a/nx-X11/lib/X11/Flush.c b/nx-X11/lib/X11/Flush.c deleted file mode 100644 index 46168999b..000000000 --- a/nx-X11/lib/X11/Flush.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* Flush all buffered output requests. */ -/* NOTE: NOT necessary when calling any of the Xlib routines. */ - -int -XFlush (register Display *dpy) -{ - LockDisplay(dpy); - _XFlush (dpy); - UnlockDisplay(dpy); - return 1; - } diff --git a/nx-X11/lib/X11/Font.c b/nx-X11/lib/X11/Font.c deleted file mode 100644 index 6bbab3f19..000000000 --- a/nx-X11/lib/X11/Font.c +++ /dev/null @@ -1,708 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group -Copyright (c) 2000 The XFree86 Project, Inc. - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -X CONSORTIUM OR THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. - -Except as contained in this notice, the name of the X Consortium or of the -XFree86 Project shall not be used in advertising or otherwise to promote the -sale, use or other dealings in this Software without prior written -authorization from the X Consortium and the XFree86 Project. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -#if defined(XF86BIGFONT) -#define USE_XF86BIGFONT -#endif -#ifdef USE_XF86BIGFONT -#include -#ifdef HAS_SHM -#include -#include -#endif - -#include -#include -#include -#endif - -#include "Xlcint.h" -#include "XlcPubI.h" - - -static XFontStruct *_XQueryFont( - Display* /* dpy */, - Font /* fid */, - unsigned long /* seq */ -); - -#ifdef USE_XF86BIGFONT - -/* Private data for this extension. */ -typedef struct { - XExtCodes *codes; - CARD32 serverSignature; - CARD32 serverCapabilities; -} XF86BigfontCodes; - -/* Additional bit masks that can be set in serverCapabilities */ -#define CAP_VerifiedLocal 256 - -static XF86BigfontCodes *_XF86BigfontCodes( - Display* /* dpy */ -); - -static XFontStruct *_XF86BigfontQueryFont( - Display* /* dpy */, - XF86BigfontCodes* /* extcodes */, - Font /* fid */, - unsigned long /* seq */ -); - -void _XF86BigfontFreeFontMetrics( - XFontStruct* /* fs */ -); - -#endif /* USE_XF86BIGFONT */ - - -XFontStruct *XLoadQueryFont( - register Display *dpy, - _Xconst char *name) -{ - XFontStruct *font_result; - register long nbytes; - Font fid; - xOpenFontReq *req; - unsigned long seq; -#ifdef USE_XF86BIGFONT - XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy); -#endif - - if (_XF86LoadQueryLocaleFont(dpy, name, &font_result, (Font *)0)) - return font_result; - LockDisplay(dpy); - GetReq(OpenFont, req); - seq = dpy->request; - nbytes = req->nbytes = name ? strlen(name) : 0; - req->fid = fid = XAllocID(dpy); - req->length += (nbytes+3)>>2; - Data (dpy, name, nbytes); - font_result = NULL; -#ifdef USE_XF86BIGFONT - if (extcodes) { - font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, seq); - seq = 0; - } -#endif - if (!font_result) - font_result = _XQueryFont(dpy, fid, seq); - UnlockDisplay(dpy); - SyncHandle(); - return font_result; -} - -XFontStruct *XQueryFont ( - register Display *dpy, - Font fid) -{ - XFontStruct *font_result; -#ifdef USE_XF86BIGFONT - XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy); -#endif - - LockDisplay(dpy); - font_result = NULL; -#ifdef USE_XF86BIGFONT - if (extcodes) { - font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, 0L); - } -#endif - if (!font_result) - font_result = _XQueryFont(dpy, fid, 0L); - UnlockDisplay(dpy); - SyncHandle(); - return font_result; -} - -int -XFreeFont( - register Display *dpy, - XFontStruct *fs) -{ - register xResourceReq *req; - register _XExtension *ext; - - LockDisplay(dpy); - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->free_Font) (*ext->free_Font)(dpy, fs, &ext->codes); - GetResReq (CloseFont, fs->fid, req); - UnlockDisplay(dpy); - SyncHandle(); - if (fs->per_char) { -#ifdef USE_XF86BIGFONT - _XF86BigfontFreeFontMetrics(fs); -#else - Xfree (fs->per_char); -#endif - } - _XFreeExtData(fs->ext_data); - - Xfree (fs->properties); - Xfree (fs); - return 1; -} - - -static XFontStruct * -_XQueryFont ( - register Display *dpy, - Font fid, - unsigned long seq) -{ - register XFontStruct *fs; - unsigned long nbytes; - unsigned long reply_left; /* unused data words left in reply buffer */ - xQueryFontReply reply; - register xResourceReq *req; - register _XExtension *ext; - _XAsyncHandler async; - _XAsyncErrorState async_state; - - if (seq) { - async_state.min_sequence_number = seq; - async_state.max_sequence_number = seq; - async_state.error_code = BadName; - async_state.major_opcode = X_OpenFont; - async_state.minor_opcode = 0; - async_state.error_count = 0; - async.next = dpy->async_handlers; - async.handler = _XAsyncErrorHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - } - GetResReq(QueryFont, fid, req); - if (!_XReply (dpy, (xReply *) &reply, - ((SIZEOF(xQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) { - if (seq) - DeqAsyncHandler(dpy, &async); - return (XFontStruct *)NULL; - } - if (seq) - DeqAsyncHandler(dpy, &async); - reply_left = reply.length - - ((SIZEOF(xQueryFontReply) - SIZEOF(xReply)) >> 2); - if (! (fs = Xmalloc (sizeof (XFontStruct)))) { - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - fs->ext_data = NULL; - fs->fid = fid; - fs->direction = reply.drawDirection; - fs->min_char_or_byte2 = reply.minCharOrByte2; - fs->max_char_or_byte2 = reply.maxCharOrByte2; - fs->min_byte1 = reply.minByte1; - fs->max_byte1 = reply.maxByte1; - fs->default_char = reply.defaultChar; - fs->all_chars_exist = reply.allCharsExist; - fs->ascent = cvtINT16toInt (reply.fontAscent); - fs->descent = cvtINT16toInt (reply.fontDescent); - - /* XXX the next two statements won't work if short isn't 16 bits */ - fs->min_bounds = * (XCharStruct *) &reply.minBounds; - fs->max_bounds = * (XCharStruct *) &reply.maxBounds; - - fs->n_properties = reply.nFontProps; - /* - * if no properties defined for the font, then it is bad - * font, but shouldn't try to read nothing. - */ - fs->properties = NULL; - if (fs->n_properties > 0) { - /* nFontProps is a CARD16 */ - nbytes = reply.nFontProps * SIZEOF(xFontProp); - if ((nbytes >> 2) <= reply_left) { - size_t pbytes = reply.nFontProps * sizeof(XFontProp); - fs->properties = Xmalloc (pbytes); - } - if (! fs->properties) { - Xfree(fs); - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - _XRead32 (dpy, (long *)fs->properties, nbytes); - reply_left -= (nbytes >> 2); - } - /* - * If no characters in font, then it is a bad font, but - * shouldn't try to read nothing. - */ - fs->per_char = NULL; - if (reply.nCharInfos > 0){ - /* nCharInfos is a CARD32 */ - if (reply.nCharInfos < (INT_MAX / sizeof(XCharStruct))) { - nbytes = reply.nCharInfos * SIZEOF(xCharInfo); - if ((nbytes >> 2) <= reply_left) { - size_t cibytes = reply.nCharInfos * sizeof(XCharStruct); - fs->per_char = Xmalloc (cibytes); - } - } - if (! fs->per_char) { - Xfree(fs->properties); - Xfree(fs); - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - - _XRead16 (dpy, (char *)fs->per_char, nbytes); - } - - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes); - return fs; -} - -#ifdef USE_XF86BIGFONT - -/* Magic cookie for finding the right XExtData structure on the display's - extension list. */ -static int XF86BigfontNumber = 1040697125; - -static int -_XF86BigfontFreeCodes ( - XExtData *extension) -{ - /* Don't Xfree(extension->private_data) because it is on the same malloc - chunk as extension. */ - /* Don't Xfree(extension->private_data->codes) because this is shared with - the display's ext_procs list. */ - return 0; -} - -static XF86BigfontCodes * -_XF86BigfontCodes ( - register Display *dpy) -{ - XEDataObject dpy_union; - XExtData *pData; - XF86BigfontCodes *pCodes; - char *envval; - - dpy_union.display = dpy; - - /* If the server is known to support the XF86Bigfont extension, - * return the extension codes. If the server is known to not support - * the extension, don't bother checking again. - */ - pData = XFindOnExtensionList(XEHeadOfExtensionList(dpy_union), - XF86BigfontNumber); - if (pData) - return (XF86BigfontCodes *) pData->private_data; - - pData = Xmalloc(sizeof(XExtData) + sizeof(XF86BigfontCodes)); - if (!pData) { - /* Out of luck. */ - return (XF86BigfontCodes *) NULL; - } - - /* See if the server supports the XF86Bigfont extension. */ - envval = getenv("XF86BIGFONT_DISABLE"); /* Let the user disable it. */ - if (envval != NULL && envval[0] != '\0') - pCodes = NULL; - else { - XExtCodes *codes = XInitExtension(dpy, XF86BIGFONTNAME); - if (codes == NULL) - pCodes = NULL; - else { - pCodes = (XF86BigfontCodes *) &pData[1]; - pCodes->codes = codes; - } - } - pData->number = XF86BigfontNumber; - pData->private_data = (XPointer) pCodes; - pData->free_private = _XF86BigfontFreeCodes; - XAddToExtensionList(XEHeadOfExtensionList(dpy_union), pData); - if (pCodes) { - int result; - - /* See if the server supports the XF86BigfontQueryFont request. */ - xXF86BigfontQueryVersionReply reply; - register xXF86BigfontQueryVersionReq *req; - - LockDisplay(dpy); - - GetReq(XF86BigfontQueryVersion, req); - req->reqType = pCodes->codes->major_opcode; - req->xf86bigfontReqType = X_XF86BigfontQueryVersion; - - result = _XReply (dpy, (xReply *) &reply, - (SIZEOF(xXF86BigfontQueryVersionReply) - SIZEOF(xReply)) >> 2, - xFalse); - - UnlockDisplay(dpy); - SyncHandle(); - - if(!result) - goto ignore_extension; - - /* No need to provide backward compatibility with version 1.0. It - was never widely distributed. */ - if (!(reply.majorVersion > 1 - || (reply.majorVersion == 1 && reply.minorVersion >= 1))) - goto ignore_extension; - - pCodes->serverSignature = reply.signature; - pCodes->serverCapabilities = reply.capabilities; - } - return pCodes; - - ignore_extension: - /* No need to Xfree(pCodes) or Xfree(pCodes->codes), see - _XF86BigfontFreeCodes comment. */ - pCodes = (XF86BigfontCodes *) NULL; - pData->private_data = (XPointer) pCodes; - return pCodes; -} - -static int -_XF86BigfontFreeNop ( - XExtData *extension) -{ - return 0; -} - -static XFontStruct * -_XF86BigfontQueryFont ( - register Display *dpy, - XF86BigfontCodes *extcodes, - Font fid, - unsigned long seq) -{ - register XFontStruct *fs; - unsigned long nbytes; - unsigned long reply_left; /* unused data left in reply buffer */ - xXF86BigfontQueryFontReply reply; - register xXF86BigfontQueryFontReq *req; - register _XExtension *ext; - _XAsyncHandler async1; - _XAsyncErrorState async1_state; - _XAsyncHandler async2; - _XAsyncErrorState async2_state; - - if (seq) { - async1_state.min_sequence_number = seq; - async1_state.max_sequence_number = seq; - async1_state.error_code = BadName; - async1_state.major_opcode = X_OpenFont; - async1_state.minor_opcode = 0; - async1_state.error_count = 0; - async1.next = dpy->async_handlers; - async1.handler = _XAsyncErrorHandler; - async1.data = (XPointer)&async1_state; - dpy->async_handlers = &async1; - } - - GetReq(XF86BigfontQueryFont, req); - req->reqType = extcodes->codes->major_opcode; - req->xf86bigfontReqType = X_XF86BigfontQueryFont; - req->id = fid; - req->flags = (extcodes->serverCapabilities & XF86Bigfont_CAP_LocalShm - ? XF86Bigfont_FLAGS_Shm : 0); - - /* The function _XQueryFont benefits from a "magic" error handler for - BadFont coming from a X_QueryFont request. (See function _XReply.) - We have to establish an error handler ourselves. */ - async2_state.min_sequence_number = dpy->request; - async2_state.max_sequence_number = dpy->request; - async2_state.error_code = BadFont; - async2_state.major_opcode = extcodes->codes->major_opcode; - async2_state.minor_opcode = X_XF86BigfontQueryFont; - async2_state.error_count = 0; - async2.next = dpy->async_handlers; - async2.handler = _XAsyncErrorHandler; - async2.data = (XPointer)&async2_state; - dpy->async_handlers = &async2; - - if (!_XReply (dpy, (xReply *) &reply, - ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) { - DeqAsyncHandler(dpy, &async2); - if (seq) - DeqAsyncHandler(dpy, &async1); - return (XFontStruct *)NULL; - } - DeqAsyncHandler(dpy, &async2); - if (seq) - DeqAsyncHandler(dpy, &async1); - reply_left = reply.length - - ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2); - if (! (fs = Xmalloc (sizeof (XFontStruct)))) { - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - fs->ext_data = NULL; - fs->fid = fid; - fs->direction = reply.drawDirection; - fs->min_char_or_byte2 = reply.minCharOrByte2; - fs->max_char_or_byte2 = reply.maxCharOrByte2; - fs->min_byte1 = reply.minByte1; - fs->max_byte1 = reply.maxByte1; - fs->default_char = reply.defaultChar; - fs->all_chars_exist = reply.allCharsExist; - fs->ascent = cvtINT16toInt (reply.fontAscent); - fs->descent = cvtINT16toInt (reply.fontDescent); - - /* XXX the next two statements won't work if short isn't 16 bits */ - fs->min_bounds = * (XCharStruct *) &reply.minBounds; - fs->max_bounds = * (XCharStruct *) &reply.maxBounds; - - fs->n_properties = reply.nFontProps; - /* - * if no properties defined for the font, then it is bad - * font, but shouldn't try to read nothing. - */ - fs->properties = NULL; - if (fs->n_properties > 0) { - /* nFontProps is a CARD16 */ - nbytes = reply.nFontProps * SIZEOF(xFontProp); - if ((nbytes >> 2) <= reply_left) { - size_t pbytes = reply.nFontProps * sizeof(XFontProp); - fs->properties = Xmalloc (pbytes); - } - if (! fs->properties) { - Xfree(fs); - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - _XRead32 (dpy, (long *)fs->properties, nbytes); - reply_left -= (nbytes >> 2); - } - - fs->per_char = NULL; -#ifndef LONG64 - /* compares each part to half the maximum, which should be far more than - any real font needs, so the combined total doesn't overflow either */ - if (reply.nUniqCharInfos > ((ULONG_MAX / 2) / SIZEOF(xCharInfo)) || - reply.nCharInfos > ((ULONG_MAX / 2) / sizeof(CARD16))) { - Xfree(fs->properties); - Xfree(fs); - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } -#endif - if (reply.nCharInfos > 0) { - /* fprintf(stderr, "received font metrics, nCharInfos = %d, nUniqCharInfos = %d, shmid = %d\n", reply.nCharInfos, reply.nUniqCharInfos, reply.shmid); */ - if (reply.shmid == (CARD32)(-1)) { - xCharInfo* pUniqCI; - CARD16* pIndex2UniqIndex; - int i; - - nbytes = reply.nUniqCharInfos * SIZEOF(xCharInfo) - + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16); - pUniqCI = Xmalloc (nbytes); - if (!pUniqCI) { - Xfree(fs->properties); - Xfree(fs); - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - if (! (fs->per_char = Xmalloc (reply.nCharInfos * sizeof(XCharStruct)))) { - Xfree(pUniqCI); - Xfree(fs->properties); - Xfree(fs); - _XEatDataWords(dpy, reply_left); - return (XFontStruct *)NULL; - } - _XRead16 (dpy, (char *) pUniqCI, nbytes); - pIndex2UniqIndex = (CARD16*) (pUniqCI + reply.nUniqCharInfos); - for (i = 0; i < reply.nCharInfos; i++) { - if (pIndex2UniqIndex[i] >= reply.nUniqCharInfos) { - fprintf(stderr, "_XF86BigfontQueryFont: server returned wrong data\n"); - Xfree(pUniqCI); - Xfree(fs->properties); - Xfree(fs); - return (XFontStruct *)NULL; - } - /* XXX the next statement won't work if short isn't 16 bits */ - fs->per_char[i] = * (XCharStruct *) &pUniqCI[pIndex2UniqIndex[i]]; - } - Xfree(pUniqCI); - } else { -#ifdef HAS_SHM - XExtData *pData; - XEDataObject fs_union; - char *addr; - - pData = Xmalloc(sizeof(XExtData)); - if (!pData) { - Xfree(fs->properties); - Xfree(fs); - return (XFontStruct *)NULL; - } - - /* In some cases (e.g. an ssh daemon forwarding an X session to - a remote machine) it is possible that the X server thinks we - are running on the same machine (because getpeername() and - LocalClient() cannot know about the forwarding) but we are - not really local. Therefore, when we attach the first shared - memory segment, we verify that we are on the same machine as - the X server by checking that 1. shmat() succeeds, 2. the - segment has a sufficient size, 3. it contains the X server's - signature. Then we set the CAP_VerifiedLocal bit to indicate - the verification was successful. */ - - if ((addr = shmat(reply.shmid, NULL, SHM_RDONLY)) == (char *)-1) { - if (extcodes->serverCapabilities & CAP_VerifiedLocal) - fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n"); - Xfree(pData); - Xfree(fs->properties); - Xfree(fs); - /* Stop requesting shared memory transport from now on. */ - extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; - return (XFontStruct *)NULL; - } - - if (!(extcodes->serverCapabilities & CAP_VerifiedLocal)) { - struct shmid_ds buf; - if (!(shmctl(reply.shmid, IPC_STAT, &buf) >= 0 - && reply.nCharInfos < (INT_MAX / sizeof(XCharStruct)) - && buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32) - && *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) { - shmdt(addr); - Xfree(pData); - Xfree(fs->properties); - Xfree(fs); - /* Stop requesting shared memory transport from now on. */ - extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; - return (XFontStruct *)NULL; - } - extcodes->serverCapabilities |= CAP_VerifiedLocal; - } - - pData->number = XF86BigfontNumber; - pData->private_data = (XPointer) addr; - pData->free_private = _XF86BigfontFreeNop; - fs_union.font = fs; - XAddToExtensionList(XEHeadOfExtensionList(fs_union), pData); - - fs->per_char = (XCharStruct *) (addr + reply.shmsegoffset); -#else - fprintf(stderr, "_XF86BigfontQueryFont: try recompiling libX11 with HasShm, Xserver has shm support\n"); - if (fs->properties) Xfree(fs->properties); - Xfree(fs); - /* Stop requesting shared memory transport from now on. */ - extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; - return (XFontStruct *)NULL; -#endif - } - } - - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes); - return fs; -} - -void -_XF86BigfontFreeFontMetrics (XFontStruct *fs) -{ -#ifdef HAS_SHM - XExtData *pData; - XEDataObject fs_union; - - fs_union.font = fs; - if ((pData = XFindOnExtensionList(XEHeadOfExtensionList(fs_union), - XF86BigfontNumber))) - shmdt ((char *) pData->private_data); - else - Xfree (fs->per_char); -#else - Xfree (fs->per_char); -#endif -} - -#endif /* USE_XF86BIGFONT */ - -int _XF86LoadQueryLocaleFont( - Display *dpy, - _Xconst char *name, - XFontStruct **xfp, - Font *fidp) -{ - int l; - const char *charset, *p; - char buf[256]; - XFontStruct *fs; - XLCd lcd; - - if (!name) - return 0; - l = strlen(name); - if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-') - return 0; - charset = NULL; - /* next three lines stolen from _XkbGetCharset() */ - lcd = _XlcCurrentLC(); - if ((lcd = _XlcCurrentLC()) != 0) - charset = XLC_PUBLIC(lcd, encoding_name); - if (!charset || (p = strrchr(charset, '-')) == 0 || p == charset || p[1] == 0 || (p[1] == '*' && p[2] == 0)) { - /* prefer latin1 if no encoding found */ - charset = "ISO8859-1"; - p = charset + 7; - } - if (l - 2 - (p - charset) < 0) - return 0; - if (_XlcNCompareISOLatin1(name + l - 2 - (p - charset), charset, p - charset)) - return 0; - if (strlen(p + 1) + l - 1 >= sizeof(buf) - 1) - return 0; - strcpy(buf, name); - strcpy(buf + l - 1, p + 1); - fs = XLoadQueryFont(dpy, buf); - if (!fs) - return 0; - if (xfp) { - *xfp = fs; - if (fidp) - *fidp = fs->fid; - } else if (fidp) { - if (fs->per_char) { -#ifdef USE_XF86BIGFONT - _XF86BigfontFreeFontMetrics(fs); -#else - Xfree (fs->per_char); -#endif - } - _XFreeExtData(fs->ext_data); - - Xfree (fs->properties); - *fidp = fs->fid; - Xfree (fs); - } else { - XFreeFont(dpy, fs); - } - return 1; -} diff --git a/nx-X11/lib/X11/FontInfo.c b/nx-X11/lib/X11/FontInfo.c deleted file mode 100644 index a2d12c2ec..000000000 --- a/nx-X11/lib/X11/FontInfo.c +++ /dev/null @@ -1,227 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -#if defined(XF86BIGFONT) -#define USE_XF86BIGFONT -#endif -#ifdef USE_XF86BIGFONT -extern void _XF86BigfontFreeFontMetrics( - XFontStruct* /* fs */ -); -#endif - -char **XListFontsWithInfo( -register Display *dpy, -_Xconst char *pattern, /* null-terminated */ -int maxNames, -int *actualCount, /* RETURN */ -XFontStruct **info) /* RETURN */ -{ - unsigned long nbytes; - unsigned long reply_left; /* unused data left in reply buffer */ - register int i; - register XFontStruct *fs; - unsigned int size = 0; - XFontStruct *finfo = NULL; - char **flist = NULL; - xListFontsWithInfoReply reply; - register xListFontsReq *req; - int j; - - LockDisplay(dpy); - GetReq(ListFontsWithInfo, req); - req->maxNames = maxNames; - nbytes = req->nbytes = pattern ? strlen (pattern) : 0; - req->length += (nbytes + 3) >> 2; - _XSend (dpy, pattern, nbytes); - /* use _XSend instead of Data, since subsequent _XReply will flush buffer */ - - for (i = 0; ; i++) { - if (!_XReply (dpy, (xReply *) &reply, - ((SIZEOF(xListFontsWithInfoReply) - - SIZEOF(xGenericReply)) >> 2), xFalse)) { - reply.nameLength = 0; /* avoid trying to read more replies */ - reply_left = 0; - goto badmem; - } - reply_left = reply.length - - ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) >> 2); - if (reply.nameLength == 0) { - _XEatDataWords(dpy, reply_left); - break; - } - if (reply.nReplies >= (INT_MAX - i)) /* avoid overflowing size */ - goto badmem; - if ((i + reply.nReplies) >= size) { - size = i + reply.nReplies + 1; - - if (size >= (INT_MAX / sizeof(XFontStruct))) - goto badmem; - - if (finfo) { - XFontStruct * tmp_finfo; - char ** tmp_flist; - - tmp_finfo = Xrealloc (finfo, sizeof(XFontStruct) * size); - if (tmp_finfo) - finfo = tmp_finfo; - else - goto badmem; - - tmp_flist = Xrealloc (flist, sizeof(char *) * (size+1)); - if (tmp_flist) - flist = tmp_flist; - else - goto badmem; - } - else { - if (! (finfo = Xmalloc(sizeof(XFontStruct) * size))) - goto clearwire; - if (! (flist = Xmalloc(sizeof(char *) * (size+1)))) { - Xfree(finfo); - goto clearwire; - } - } - } - fs = &finfo[i]; - - fs->ext_data = NULL; - fs->per_char = NULL; - fs->fid = None; - fs->direction = reply.drawDirection; - fs->min_char_or_byte2 = reply.minCharOrByte2; - fs->max_char_or_byte2 = reply.maxCharOrByte2; - fs->min_byte1 = reply.minByte1; - fs->max_byte1 = reply.maxByte1; - fs->default_char = reply.defaultChar; - fs->all_chars_exist = reply.allCharsExist; - fs->ascent = cvtINT16toInt (reply.fontAscent); - fs->descent = cvtINT16toInt (reply.fontDescent); - - /* XXX the next two statements won't work if short isn't 16 bits */ - fs->min_bounds = * (XCharStruct *) &reply.minBounds; - fs->max_bounds = * (XCharStruct *) &reply.maxBounds; - - fs->n_properties = reply.nFontProps; - fs->properties = NULL; - if (fs->n_properties > 0) { - /* nFontProps is a CARD16 */ - nbytes = reply.nFontProps * SIZEOF(xFontProp); - if ((nbytes >> 2) <= reply_left) { - size_t pbytes = reply.nFontProps * sizeof(XFontProp); - fs->properties = Xmalloc (pbytes); - } - if (! fs->properties) - goto badmem; - _XRead32 (dpy, (long *)fs->properties, nbytes); - reply_left -= (nbytes >> 2); - } - - /* nameLength is a CARD8 */ - nbytes = reply.nameLength + 1; - if (!i) - nbytes++; /* make first string 1 byte longer, to match XListFonts */ - flist[i] = Xmalloc (nbytes); - if (! flist[i]) { - if (finfo[i].properties) Xfree(finfo[i].properties); - goto badmem; - } - if (!i) { - *flist[0] = 0; /* zero to distinguish from XListFonts */ - flist[0]++; - } - flist[i][reply.nameLength] = '\0'; - _XReadPad (dpy, flist[i], (long) reply.nameLength); - } - *info = finfo; - *actualCount = i; - if (flist) - flist[i] = NULL; /* required in case XFreeFontNames is called */ - UnlockDisplay(dpy); - SyncHandle(); - return (flist); - - - badmem: - /* Free all memory allocated by this function. */ - for (j=(i-1); (j >= 0); j--) { - if (j == 0) - flist[j]--; /* was incremented above */ - Xfree(flist[j]); - if (finfo[j].properties) Xfree(finfo[j].properties); - } - Xfree(flist); - Xfree(finfo); - - clearwire: - /* Clear the wire. */ - _XEatDataWords(dpy, reply_left); - while ((reply.nameLength != 0) && - _XReply(dpy, (xReply *) &reply, - ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) - >> 2), xTrue)); - UnlockDisplay(dpy); - SyncHandle(); - *info = NULL; - *actualCount = 0; - return (char **) NULL; -} - -int -XFreeFontInfo ( - char **names, - XFontStruct *info, - int actualCount) -{ - register int i; - if (names) { - Xfree (names[0]-1); - for (i = 1; i < actualCount; i++) { - Xfree (names[i]); - } - Xfree(names); - } - if (info) { - for (i = 0; i < actualCount; i++) { - if (info[i].per_char) -#ifdef USE_XF86BIGFONT - _XF86BigfontFreeFontMetrics(&info[i]); -#else - Xfree (info[i].per_char); -#endif - if (info[i].properties) - Xfree (info[i].properties); - } - Xfree(info); - } - return 1; -} diff --git a/nx-X11/lib/X11/FontNames.c b/nx-X11/lib/X11/FontNames.c deleted file mode 100644 index 9ffdfd299..000000000 --- a/nx-X11/lib/X11/FontNames.c +++ /dev/null @@ -1,137 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -char ** -XListFonts( -register Display *dpy, -_Xconst char *pattern, /* null-terminated */ -int maxNames, -int *actualCount) /* RETURN */ -{ - register long nbytes; - register unsigned i; - register int length; - char **flist = NULL; - char *ch = NULL; - char *chstart; - char *chend; - int count = 0; - xListFontsReply rep; - register xListFontsReq *req; - unsigned long rlen = 0; - - LockDisplay(dpy); - GetReq(ListFonts, req); - req->maxNames = maxNames; - nbytes = req->nbytes = pattern ? strlen (pattern) : 0; - req->length += (nbytes + 3) >> 2; - _XSend (dpy, pattern, nbytes); - /* use _XSend instead of Data, since following _XReply will flush buffer */ - - if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { - *actualCount = 0; - UnlockDisplay(dpy); - SyncHandle(); - return (char **) NULL; - } - - if (rep.nFonts) { - flist = Xmalloc (rep.nFonts * sizeof(char *)); - if (rep.length > 0 && rep.length < (INT_MAX >> 2)) { - rlen = rep.length << 2; - ch = Xmalloc(rlen + 1); - /* +1 to leave room for last null-terminator */ - } - - if ((! flist) || (! ch)) { - Xfree(flist); - Xfree(ch); - _XEatDataWords(dpy, rep.length); - *actualCount = 0; - UnlockDisplay(dpy); - SyncHandle(); - return (char **) NULL; - } - - _XReadPad (dpy, ch, rlen); - /* - * unpack into null terminated strings. - */ - chstart = ch; - chend = ch + (rlen + 1); - length = *(unsigned char *)ch; - *ch = 1; /* make sure it is non-zero for XFreeFontNames */ - for (i = 0; i < rep.nFonts; i++) { - if (ch + length < chend) { - flist[i] = ch + 1; /* skip over length */ - ch += length + 1; /* find next length ... */ - if (ch <= chend) { - length = *(unsigned char *)ch; - *ch = '\0'; /* and replace with null-termination */ - count++; - } else { - Xfree(chstart); - Xfree(flist); - flist = NULL; - count = 0; - break; - } - } else { - Xfree(chstart); - Xfree(flist); - flist = NULL; - count = 0; - break; - } - } - } - *actualCount = count; - UnlockDisplay(dpy); - SyncHandle(); - return (flist); -} - -int -XFreeFontNames(char **list) -{ - if (list) { - if (!*(list[0]-1)) { /* from ListFontsWithInfo */ - register char **names; - for (names = list+1; *names; names++) - Xfree (*names); - } - Xfree (list[0]-1); - Xfree (list); - } - return 1; -} diff --git a/nx-X11/lib/X11/FreeCmap.c b/nx-X11/lib/X11/FreeCmap.c deleted file mode 100644 index e2b76fa6f..000000000 --- a/nx-X11/lib/X11/FreeCmap.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlib.h" -#include "Xlibint.h" -#include "Cmap.h" - -int -XFreeColormap( - register Display *dpy, - Colormap cmap) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(FreeColormap, cmap, req); - - UnlockDisplay(dpy); - SyncHandle(); - -#ifdef XCMS - _XcmsDeleteCmapRec(dpy, cmap); -#endif - - return 1; -} diff --git a/nx-X11/lib/X11/FreeCols.c b/nx-X11/lib/X11/FreeCols.c deleted file mode 100644 index a8b7f8867..000000000 --- a/nx-X11/lib/X11/FreeCols.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XFreeColors( - register Display *dpy, - Colormap cmap, - unsigned long *pixels, /* LISTofCARD32 */ - int npixels, - unsigned long planes) /* CARD32 */ -{ - register xFreeColorsReq *req; - register long nbytes; - - LockDisplay(dpy); - GetReq(FreeColors, req); - req->cmap = cmap; - req->planeMask = planes; - - /* on the VAX, each pixel is a 32-bit (unsigned) integer */ - req->length += npixels; - - nbytes = npixels << 2; /* watch out for macros... */ - Data32 (dpy, (long *) pixels, nbytes); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/FreeCurs.c b/nx-X11/lib/X11/FreeCurs.c deleted file mode 100644 index 89fb577cc..000000000 --- a/nx-X11/lib/X11/FreeCurs.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XFreeCursor( - register Display *dpy, - Cursor cursor) -{ - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(FreeCursor, cursor, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/FreeEData.c b/nx-X11/lib/X11/FreeEData.c deleted file mode 100644 index ce78467d3..000000000 --- a/nx-X11/lib/X11/FreeEData.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -_XFreeExtData (XExtData *extension) -{ - XExtData *temp; - while (extension) { - if (extension->free_private) - (*extension->free_private)(extension); - else Xfree (extension->private_data); - temp = extension->next; - Xfree (extension); - extension = temp; - } - return 0; -} diff --git a/nx-X11/lib/X11/FreeEventData.c b/nx-X11/lib/X11/FreeEventData.c deleted file mode 100644 index e2d40b0db..000000000 --- a/nx-X11/lib/X11/FreeEventData.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -void -XFreeEventData(Display *dpy, XGenericEventCookie *event) -{ - - if (_XIsEventCookie(dpy, (XEvent*)event) && event->data) - { - XFree(event->data); - event->data = NULL; - event->cookie = 0; - } - return; -} - diff --git a/nx-X11/lib/X11/FreeGC.c b/nx-X11/lib/X11/FreeGC.c deleted file mode 100644 index 926d50745..000000000 --- a/nx-X11/lib/X11/FreeGC.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XFreeGC ( - register Display *dpy, - GC gc) - { - register xResourceReq *req; - register _XExtension *ext; - LockDisplay(dpy); - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->free_GC) (*ext->free_GC)(dpy, gc, &ext->codes); - GetResReq (FreeGC, gc->gid, req); - UnlockDisplay(dpy); - SyncHandle(); - _XFreeExtData(gc->ext_data); - Xfree (gc); - return 1; - } - diff --git a/nx-X11/lib/X11/FreePix.c b/nx-X11/lib/X11/FreePix.c deleted file mode 100644 index 21367978e..000000000 --- a/nx-X11/lib/X11/FreePix.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XFreePixmap( - register Display *dpy, - Pixmap pixmap) -{ - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(FreePixmap, pixmap, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/GCMisc.c b/nx-X11/lib/X11/GCMisc.c deleted file mode 100644 index 751e27dca..000000000 --- a/nx-X11/lib/X11/GCMisc.c +++ /dev/null @@ -1,110 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetArcMode ( - register Display *dpy, - register GC gc, - int arc_mode) -{ - LockDisplay(dpy); - if (gc->values.arc_mode != arc_mode) { - gc->values.arc_mode = arc_mode; - gc->dirty |= GCArcMode; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XSetFillRule ( - register Display *dpy, - register GC gc, - int fill_rule) -{ - LockDisplay(dpy); - if (gc->values.fill_rule != fill_rule) { - gc->values.fill_rule = fill_rule; - gc->dirty |= GCFillRule; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XSetFillStyle ( - register Display *dpy, - register GC gc, - int fill_style) -{ - LockDisplay(dpy); - if (gc->values.fill_style != fill_style) { - gc->values.fill_style = fill_style; - gc->dirty |= GCFillStyle; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XSetGraphicsExposures ( - register Display *dpy, - register GC gc, - Bool graphics_exposures) -{ - LockDisplay(dpy); - if (gc->values.graphics_exposures != graphics_exposures) { - gc->values.graphics_exposures = graphics_exposures; - gc->dirty |= GCGraphicsExposures; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XSetSubwindowMode ( - register Display *dpy, - register GC gc, - int subwindow_mode) -{ - LockDisplay(dpy); - if (gc->values.subwindow_mode != subwindow_mode) { - gc->values.subwindow_mode = subwindow_mode; - gc->dirty |= GCSubwindowMode; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/Geom.c b/nx-X11/lib/X11/Geom.c deleted file mode 100644 index 1da74f1c3..000000000 --- a/nx-X11/lib/X11/Geom.c +++ /dev/null @@ -1,89 +0,0 @@ - -/* - -Copyright 1985, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" - -/* - * This routine given a user supplied positional argument and a default - * argument (fully qualified) will return the position the window should take - * returns 0 if there was some problem, else the position bitmask. - */ - -int -XGeometry ( - Display *dpy, /* user's display connection */ - int screen, /* screen on which to do computation */ - _Xconst char *pos, /* user provided geometry spec */ - _Xconst char *def, /* default geometry spec for window */ - unsigned int bwidth, /* border width */ - unsigned int fwidth, /* size of position units */ - unsigned int fheight, - int xadd, /* any additional interior space */ - int yadd, - register int *x, /* always set on successful RETURN */ - register int *y, /* always set on successful RETURN */ - register int *width, /* always set on successful RETURN */ - register int *height) /* always set on successful RETURN */ -{ - int px, py; /* returned values from parse */ - unsigned int pwidth, pheight; /* returned values from parse */ - int dx, dy; /* default values from parse */ - unsigned int dwidth, dheight; /* default values from parse */ - int pmask, dmask; /* values back from parse */ - - pmask = XParseGeometry(pos, &px, &py, &pwidth, &pheight); - dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight); - - /* set default values */ - *x = (dmask & XNegative) ? - DisplayWidth(dpy, screen) + dx - dwidth * fwidth - - 2 * bwidth - xadd : dx; - *y = (dmask & YNegative) ? - DisplayHeight(dpy, screen) + dy - dheight * fheight - - 2 * bwidth - yadd : dy; - *width = dwidth; - *height = dheight; - - if (pmask & WidthValue) *width = pwidth; - if (pmask & HeightValue) *height = pheight; - - if (pmask & XValue) - *x = (pmask & XNegative) ? - DisplayWidth(dpy, screen) + px - *width * fwidth - - 2 * bwidth - xadd : px; - if (pmask & YValue) - *y = (pmask & YNegative) ? - DisplayHeight(dpy, screen) + py - *height * fheight - - 2 * bwidth - yadd : py; - return (pmask); -} diff --git a/nx-X11/lib/X11/GetAtomNm.c b/nx-X11/lib/X11/GetAtomNm.c deleted file mode 100644 index 32de50d23..000000000 --- a/nx-X11/lib/X11/GetAtomNm.c +++ /dev/null @@ -1,189 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xintatom.h" - -static -char *_XGetAtomName( - Display *dpy, - Atom atom) -{ - xResourceReq *req; - char *name; - register Entry *table; - register int idx; - register Entry e; - - if (dpy->atoms) { - table = dpy->atoms->table; - for (idx = TABLESIZE; --idx >= 0; ) { - if ((e = *table++) && (e->atom == atom)) { - idx = strlen(EntryName(e)) + 1; - if ((name = Xmalloc(idx))) - strcpy(name, EntryName(e)); - return name; - } - } - } - GetResReq(GetAtomName, atom, req); - return (char *)NULL; -} - -char *XGetAtomName( - register Display *dpy, - Atom atom) -{ - xGetAtomNameReply rep; - char *name; - - LockDisplay(dpy); - if ((name = _XGetAtomName(dpy, atom))) { - UnlockDisplay(dpy); - return name; - } - if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(NULL); - } - if ((name = Xmalloc(rep.nameLength + 1))) { - _XReadPad(dpy, name, (long)rep.nameLength); - name[rep.nameLength] = '\0'; - _XUpdateAtomCache(dpy, name, atom, 0, -1, 0); - } else { - _XEatDataWords(dpy, rep.length); - name = (char *) NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - return(name); -} - -typedef struct { - unsigned long start_seq; - unsigned long stop_seq; - Atom *atoms; - char **names; - int idx; - int count; - Status status; -} _XGetAtomNameState; - -static -Bool _XGetAtomNameHandler( - register Display *dpy, - register xReply *rep, - char *buf, - int len, - XPointer data) -{ - register _XGetAtomNameState *state; - xGetAtomNameReply replbuf; - register xGetAtomNameReply *repl; - - state = (_XGetAtomNameState *)data; - if (dpy->last_request_read < state->start_seq || - dpy->last_request_read > state->stop_seq) - return False; - while (state->idx < state->count && state->names[state->idx]) - state->idx++; - if (state->idx >= state->count) - return False; - if (rep->generic.type == X_Error) { - state->status = 0; - return False; - } - repl = (xGetAtomNameReply *) - _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, - (SIZEOF(xGetAtomNameReply) - SIZEOF(xReply)) >> 2, - False); - state->names[state->idx] = Xmalloc(repl->nameLength + 1); - _XGetAsyncData(dpy, state->names[state->idx], buf, len, - SIZEOF(xGetAtomNameReply), repl->nameLength, - repl->length << 2); - if (state->names[state->idx]) { - state->names[state->idx][repl->nameLength] = '\0'; - _XUpdateAtomCache(dpy, state->names[state->idx], - state->atoms[state->idx], 0, -1, 0); - } else { - state->status = 0; - } - return True; -} - -Status -XGetAtomNames ( - Display *dpy, - Atom *atoms, - int count, - char **names_return) -{ - _XAsyncHandler async; - _XGetAtomNameState async_state; - xGetAtomNameReply rep; - int i; - int missed = -1; - - LockDisplay(dpy); - async_state.start_seq = dpy->request + 1; - async_state.atoms = atoms; - async_state.names = names_return; - async_state.idx = 0; - async_state.count = count - 1; - async_state.status = 1; - async.next = dpy->async_handlers; - async.handler = _XGetAtomNameHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - for (i = 0; i < count; i++) { - if (!(names_return[i] = _XGetAtomName(dpy, atoms[i]))) { - missed = i; - async_state.stop_seq = dpy->request; - } - } - if (missed >= 0) { - if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - if ((names_return[missed] = Xmalloc(rep.nameLength + 1))) { - _XReadPad(dpy, names_return[missed], (long)rep.nameLength); - names_return[missed][rep.nameLength] = '\0'; - _XUpdateAtomCache(dpy, names_return[missed], atoms[missed], - 0, -1, 0); - } else { - _XEatDataWords(dpy, rep.length); - async_state.status = 0; - } - } - } - DeqAsyncHandler(dpy, &async); - UnlockDisplay(dpy); - if (missed >= 0) - SyncHandle(); - return async_state.status; -} diff --git a/nx-X11/lib/X11/GetColor.c b/nx-X11/lib/X11/GetColor.c deleted file mode 100644 index cd0eb9f63..000000000 --- a/nx-X11/lib/X11/GetColor.c +++ /dev/null @@ -1,111 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" - -Status -XAllocNamedColor( -register Display *dpy, -Colormap cmap, -_Xconst char *colorname, /* STRING8 */ -XColor *hard_def, /* RETURN */ -XColor *exact_def) /* RETURN */ -{ - - long nbytes; - xAllocNamedColorReply rep; - xAllocNamedColorReq *req; - - XcmsCCC ccc; - XcmsColor cmsColor_exact; - Status ret; - -#ifdef XCMS - /* - * Let's Attempt to use Xcms and i18n approach to Parse Color - */ - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { - const char *tmpName = colorname; - - switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, - XcmsRGBFormat)) { - case XcmsSuccess: - case XcmsSuccessWithCompression: - _XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1); - memcpy((char *)hard_def, (char *)exact_def, sizeof(XColor)); - ret = XAllocColor(dpy, cmap, hard_def); - exact_def->pixel = hard_def->pixel; - return(ret); - case XcmsFailure: - case _XCMS_NEWNAME: - /* - * if the result was _XCMS_NEWNAME tmpName points to - * a string in cmsColNm.c:pairs table, for example, - * gray70 would become tekhvc:0.0/70.0/0.0 - */ - break; - } - } -#endif - - /* - * Xcms and i18n approach failed. - */ - LockDisplay(dpy); - GetReq(AllocNamedColor, req); - - req->cmap = cmap; - nbytes = req->nbytes = strlen(colorname); - req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */ - - _XSend(dpy, colorname, nbytes); - /* _XSend is more efficient that Data, since _XReply follows */ - - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - - exact_def->red = rep.exactRed; - exact_def->green = rep.exactGreen; - exact_def->blue = rep.exactBlue; - - hard_def->red = rep.screenRed; - hard_def->green = rep.screenGreen; - hard_def->blue = rep.screenBlue; - - exact_def->pixel = hard_def->pixel = rep.pixel; - - UnlockDisplay(dpy); - SyncHandle(); - return (1); -} diff --git a/nx-X11/lib/X11/GetDflt.c b/nx-X11/lib/X11/GetDflt.c deleted file mode 100644 index c2cc1da47..000000000 --- a/nx-X11/lib/X11/GetDflt.c +++ /dev/null @@ -1,223 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include -#include "pathmax.h" - -#ifdef XTHREADS -#include -#endif -#ifndef WIN32 -#define X_INCLUDE_PWD_H -#define XOS_USE_XLIB_LOCKING -#include -#endif -#include -#include - - -/*ARGSUSED*/ -static char * -GetHomeDir( - char *dest, - int len) -{ -#ifdef WIN32 - register char *ptr1 = NULL; - register char *ptr2 = NULL; - int len1 = 0, len2 = 0; - - if ((ptr1 = getenv("HOME"))) { /* old, deprecated */ - len1 = strlen (ptr1); - } else if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) { - len1 = strlen (ptr1); - len2 = strlen (ptr2); - } else if ((ptr2 = getenv("USERNAME"))) { - len1 = strlen (ptr1 = "/users/"); - len2 = strlen (ptr2); - } - if ((len1 + len2 + 1) < len) - snprintf (dest, len, "%s%s", ptr1, (ptr2) ? ptr2 : ""); - else - *dest = '\0'; -#else -#ifdef X_NEEDS_PWPARAMS - _Xgetpwparams pwparams; -#endif - struct passwd *pw; - register char *ptr; - - if (len <= 0 || dest == NULL) - return NULL; - - if ((ptr = getenv("HOME"))) { - (void) strncpy(dest, ptr, len-1); - dest[len-1] = '\0'; - } else { - if ((ptr = getenv("USER"))) - pw = _XGetpwnam(ptr,pwparams); - else - pw = _XGetpwuid(getuid(),pwparams); - if (pw != NULL) { - (void) strncpy(dest, pw->pw_dir, len-1); - dest[len-1] = '\0'; - } else - *dest = '\0'; - } -#endif - return dest; -} - - -static XrmDatabase -InitDefaults( - Display *dpy) /* display for defaults.... */ -{ - XrmDatabase userdb; - XrmDatabase xdb; - char fname[PATH_MAX]; /* longer than any conceivable size */ - char *xenv; - - XrmInitialize(); - - /* - * See lib/Xt/Initialize.c - * - * First, get the defaults from the server; if none, then load from - * ~/.Xdefaults. Next, if there is an XENVIRONMENT environment variable, - * then load that file. - */ - - if (dpy->xdefaults == NULL) { - const char *slashDotXdefaults = "/.Xdefaults"; - - (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaults) - 1); - (void) strcat (fname, slashDotXdefaults); - xdb = XrmGetFileDatabase (fname); - } else { - xdb = XrmGetStringDatabase(dpy->xdefaults); - } - - if (!(xenv = getenv ("XENVIRONMENT"))) { - const char *slashDotXdefaultsDash = "/.Xdefaults-"; - int len; - - (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaultsDash) - 1); - (void) strcat (fname, slashDotXdefaultsDash); - len = strlen (fname); - (void) _XGetHostname (fname+len, PATH_MAX-len); - xenv = fname; - } - userdb = XrmGetFileDatabase (xenv); - XrmMergeDatabases (userdb, &xdb); - return (xdb); - -#ifdef old - if (fname[0] != '\0') userdb = XrmGetFileDatabase(fname); - xdb = XrmGetStringDatabase(dpy->xdefaults); - XrmMergeDatabases(userdb, &xdb); - return xdb; -#endif -} - -char * -XGetDefault( - Display *dpy, /* display for defaults.... */ - char _Xconst *prog, /* name of program for option */ - register _Xconst char *name) /* name of option program wants */ -{ /* to get, for example, "font" */ - XrmName names[3]; - XrmClass classes[3]; - XrmRepresentation fromType; - XrmValue result; - char *progname; -#ifdef WIN32 - char *progname2; -#endif - - /* - * strip path off of program name (XXX - this is OS specific) - */ - progname = strrchr (prog, '/'); -#ifdef WIN32 - progname2 = strrchr (prog, '\\'); - if (progname2 && (!progname || progname < progname2)) - progname = progname2; -#endif - - if (progname) - progname++; - else - progname = (char *)prog; - - /* - * see if database has ever been initialized. Lookups can be done - * without locks held. - */ - LockDisplay(dpy); - if (dpy->db == NULL) { - dpy->db = InitDefaults(dpy); - dpy->flags |= XlibDisplayDfltRMDB; - } - UnlockDisplay(dpy); - - names[0] = XrmStringToName(progname); - names[1] = XrmStringToName(name); - names[2] = NULLQUARK; - classes[0] = XrmStringToClass("Program"); - classes[1] = XrmStringToClass("Name"); - classes[2] = NULLQUARK; - (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result); - return (result.addr); -} - diff --git a/nx-X11/lib/X11/GetEventData.c b/nx-X11/lib/X11/GetEventData.c deleted file mode 100644 index b93dee6cd..000000000 --- a/nx-X11/lib/X11/GetEventData.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - * Copyright © 2009 Red Hat, Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Bool -XGetEventData(Display *dpy, XGenericEventCookie *event) -{ - Bool rc; - LockDisplay(dpy); - - rc = _XFetchEventCookie(dpy, event); - - UnlockDisplay(dpy); - - return rc; -} - diff --git a/nx-X11/lib/X11/GetFPath.c b/nx-X11/lib/X11/GetFPath.c deleted file mode 100644 index 3d87e4f64..000000000 --- a/nx-X11/lib/X11/GetFPath.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -char **XGetFontPath( - register Display *dpy, - int *npaths) /* RETURN */ -{ - xGetFontPathReply rep; - unsigned long nbytes = 0; - char **flist = NULL; - char *ch = NULL; - char *chend; - int count = 0; - register unsigned i; - register int length; - _X_UNUSED register xReq *req; - - LockDisplay(dpy); - GetEmptyReq (GetFontPath, req); - (void) _XReply (dpy, (xReply *) &rep, 0, xFalse); - - if (rep.nPaths) { - flist = Xmalloc(rep.nPaths * sizeof (char *)); - if (rep.length < (INT_MAX >> 2)) { - nbytes = (unsigned long) rep.length << 2; - ch = Xmalloc (nbytes + 1); - /* +1 to leave room for last null-terminator */ - } - - if ((! flist) || (! ch)) { - Xfree(flist); - Xfree(ch); - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return (char **) NULL; - } - - _XReadPad (dpy, ch, nbytes); - /* - * unpack into null terminated strings. - */ - chend = ch + (nbytes + 1); - length = *ch; - for (i = 0; i < rep.nPaths; i++) { - if (ch + length < chend) { - flist[i] = ch+1; /* skip over length */ - ch += length + 1; /* find next length ... */ - length = *ch; - *ch = '\0'; /* and replace with null-termination */ - count++; - } else - flist[i] = NULL; - } - } - *npaths = count; - UnlockDisplay(dpy); - SyncHandle(); - return (flist); -} - -int -XFreeFontPath (char **list) -{ - if (list != NULL) { - Xfree (list[0]-1); - Xfree (list); - } - return 1; -} diff --git a/nx-X11/lib/X11/GetFProp.c b/nx-X11/lib/X11/GetFProp.c deleted file mode 100644 index 1e0cd3285..000000000 --- a/nx-X11/lib/X11/GetFProp.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Bool -XGetFontProperty( - XFontStruct *fs, - register Atom name, - unsigned long *valuePtr) -{ - /* XXX this is a simple linear search for now. If the - protocol is changed to sort the property list, this should - become a binary search. */ - register XFontProp *prop = fs->properties; - register XFontProp *last = prop + fs->n_properties; - - while (prop != last) { - if (prop->name == name) { - *valuePtr = prop->card32; - return (1); - } - prop++; - } - return (0); -} diff --git a/nx-X11/lib/X11/GetGCVals.c b/nx-X11/lib/X11/GetGCVals.c deleted file mode 100644 index 4861739a6..000000000 --- a/nx-X11/lib/X11/GetGCVals.c +++ /dev/null @@ -1,128 +0,0 @@ - -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * All gc fields except GCClipMask and GCDashList - */ -#define ValidGCValuesBits (GCFunction | GCPlaneMask | GCForeground | \ - GCBackground | GCLineWidth | GCLineStyle | \ - GCCapStyle | GCJoinStyle | GCFillStyle | \ - GCFillRule | GCTile | GCStipple | \ - GCTileStipXOrigin | GCTileStipYOrigin | \ - GCFont | GCSubwindowMode | GCGraphicsExposures | \ - GCClipXOrigin | GCClipYOrigin | GCDashOffset | \ - GCArcMode) - -/*ARGSUSED*/ -Status XGetGCValues ( - Display *dpy, - GC gc, - unsigned long valuemask, - XGCValues *values) -{ - if (valuemask == ValidGCValuesBits) { - char dashes = values->dashes; - Pixmap clip_mask = values->clip_mask; - *values = gc->values; - values->dashes = dashes; - values->clip_mask = clip_mask; - return True; - } - - if (valuemask & ~ValidGCValuesBits) return False; - - if (valuemask & GCFunction) - values->function = gc->values.function; - - if (valuemask & GCPlaneMask) - values->plane_mask = gc->values.plane_mask; - - if (valuemask & GCForeground) - values->foreground = gc->values.foreground; - - if (valuemask & GCBackground) - values->background = gc->values.background; - - if (valuemask & GCLineWidth) - values->line_width = gc->values.line_width; - - if (valuemask & GCLineStyle) - values->line_style = gc->values.line_style; - - if (valuemask & GCCapStyle) - values->cap_style = gc->values.cap_style; - - if (valuemask & GCJoinStyle) - values->join_style = gc->values.join_style; - - if (valuemask & GCFillStyle) - values->fill_style = gc->values.fill_style; - - if (valuemask & GCFillRule) - values->fill_rule = gc->values.fill_rule; - - if (valuemask & GCTile) - values->tile = gc->values.tile; - - if (valuemask & GCStipple) - values->stipple = gc->values.stipple; - - if (valuemask & GCTileStipXOrigin) - values->ts_x_origin = gc->values.ts_x_origin; - - if (valuemask & GCTileStipYOrigin) - values->ts_y_origin = gc->values.ts_y_origin; - - if (valuemask & GCFont) - values->font = gc->values.font; - - if (valuemask & GCSubwindowMode) - values->subwindow_mode = gc->values.subwindow_mode; - - if (valuemask & GCGraphicsExposures) - values->graphics_exposures = gc->values.graphics_exposures; - - if (valuemask & GCClipXOrigin) - values->clip_x_origin = gc->values.clip_x_origin; - - if (valuemask & GCClipYOrigin) - values->clip_y_origin = gc->values.clip_y_origin; - - if (valuemask & GCDashOffset) - - values->dash_offset = gc->values.dash_offset; - - if (valuemask & GCArcMode) - values->arc_mode = gc->values.arc_mode; - - return True; -} diff --git a/nx-X11/lib/X11/GetGeom.c b/nx-X11/lib/X11/GetGeom.c deleted file mode 100644 index 1e1249d81..000000000 --- a/nx-X11/lib/X11/GetGeom.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XGetGeometry ( - register Display *dpy, - Drawable d, - Window *root, /* RETURN */ - int *x, - int *y, /* RETURN */ - unsigned int *width, - unsigned int *height, - unsigned int *borderWidth, - unsigned int *depth) /* RETURN */ -{ - xGetGeometryReply rep; - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(GetGeometry, d, req); - if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - *root = rep.root; - *x = cvtINT16toInt (rep.x); - *y = cvtINT16toInt (rep.y); - *width = rep.width; - *height = rep.height; - *borderWidth = rep.borderWidth; - *depth = rep.depth; - UnlockDisplay(dpy); - SyncHandle(); - return (1); -} - diff --git a/nx-X11/lib/X11/GetHColor.c b/nx-X11/lib/X11/GetHColor.c deleted file mode 100644 index 081a2248d..000000000 --- a/nx-X11/lib/X11/GetHColor.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XAllocColor( - register Display *dpy, - Colormap cmap, - XColor *def) -{ - Status status; - xAllocColorReply rep; - register xAllocColorReq *req; - LockDisplay(dpy); - GetReq(AllocColor, req); - - req->cmap = cmap; - req->red = def->red; - req->green = def->green; - req->blue = def->blue; - - status = _XReply(dpy, (xReply *) &rep, 0, xTrue); - if (status) { - def->pixel = rep.pixel; - def->red = rep.red; - def->green = rep.green; - def->blue = rep.blue; - } - UnlockDisplay(dpy); - SyncHandle(); - return(status); -} diff --git a/nx-X11/lib/X11/GetHints.c b/nx-X11/lib/X11/GetHints.c deleted file mode 100644 index 7bfd35358..000000000 --- a/nx-X11/lib/X11/GetHints.c +++ /dev/null @@ -1,338 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xatomtype.h" -#include -#include - -Status XGetSizeHints ( - Display *dpy, - Window w, - XSizeHints *hints, - Atom property) -{ - xPropSizeHints *prop = NULL; - Atom actual_type; - int actual_format; - unsigned long leftover; - unsigned long nitems; - if (XGetWindowProperty(dpy, w, property, 0L, - (long) OldNumPropSizeElements, - False, XA_WM_SIZE_HINTS, &actual_type, &actual_format, - &nitems, &leftover, (unsigned char **)&prop) - != Success) return (0); - - if ((actual_type != XA_WM_SIZE_HINTS) || - (nitems < OldNumPropSizeElements) || (actual_format != 32)) { - Xfree (prop); - return(0); - } - hints->flags = (prop->flags & (USPosition|USSize|PAllHints)); - hints->x = cvtINT32toInt (prop->x); - hints->y = cvtINT32toInt (prop->y); - hints->width = cvtINT32toInt (prop->width); - hints->height = cvtINT32toInt (prop->height); - hints->min_width = cvtINT32toInt (prop->minWidth); - hints->min_height = cvtINT32toInt (prop->minHeight); - hints->max_width = cvtINT32toInt (prop->maxWidth); - hints->max_height = cvtINT32toInt (prop->maxHeight); - hints->width_inc = cvtINT32toInt (prop->widthInc); - hints->height_inc = cvtINT32toInt (prop->heightInc); - hints->min_aspect.x = cvtINT32toInt (prop->minAspectX); - hints->min_aspect.y = cvtINT32toInt (prop->minAspectY); - hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX); - hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY); - Xfree(prop); - return(1); -} - -/* - * must return a pointer to the hint, in malloc'd memory, or routine is not - * extensible; any use of the caller's memory would cause things to be stepped - * on. - */ - -XWMHints *XGetWMHints ( - Display *dpy, - Window w) -{ - xPropWMHints *prop = NULL; - register XWMHints *hints; - Atom actual_type; - int actual_format; - unsigned long leftover; - unsigned long nitems; - if (XGetWindowProperty(dpy, w, XA_WM_HINTS, - 0L, (long)NumPropWMHintsElements, - False, XA_WM_HINTS, &actual_type, &actual_format, - &nitems, &leftover, (unsigned char **)&prop) - != Success) return (NULL); - - /* If the property is undefined on the window, return null pointer. */ - /* pre-R3 bogusly truncated window_group, don't fail on them */ - - if ((actual_type != XA_WM_HINTS) || - (nitems < (NumPropWMHintsElements - 1)) || (actual_format != 32)) { - Xfree (prop); - return(NULL); - } - /* static copies not allowed in library, due to reentrancy constraint*/ - if ((hints = Xcalloc (1, sizeof(XWMHints)))) { - hints->flags = prop->flags; - hints->input = (prop->input ? True : False); - hints->initial_state = cvtINT32toInt (prop->initialState); - hints->icon_pixmap = prop->iconPixmap; - hints->icon_window = prop->iconWindow; - hints->icon_x = cvtINT32toInt (prop->iconX); - hints->icon_y = cvtINT32toInt (prop->iconY); - hints->icon_mask = prop->iconMask; - if (nitems >= NumPropWMHintsElements) - hints->window_group = prop->windowGroup; - else - hints->window_group = 0; - } - Xfree (prop); - return(hints); -} - -Status -XGetZoomHints ( - Display *dpy, - Window w, - XSizeHints *zhints) -{ - return (XGetSizeHints(dpy, w, zhints, XA_WM_ZOOM_HINTS)); -} - -Status -XGetNormalHints ( - Display *dpy, - Window w, - XSizeHints *hints) -{ - return (XGetSizeHints(dpy, w, hints, XA_WM_NORMAL_HINTS)); -} - - -/* - * XGetIconSizes reads the property - * ICONSIZE_ATOM type: ICONSIZE_ATOM format: 32 - */ - -Status XGetIconSizes ( - Display *dpy, - Window w, /* typically, root */ - XIconSize **size_list, /* RETURN */ - int *count) /* RETURN number of items on the list */ -{ - xPropIconSize *prop = NULL; - register xPropIconSize *pp; - register XIconSize *hp, *hints; - Atom actual_type; - int actual_format; - unsigned long leftover; - unsigned long nitems; - register int i; - - if (XGetWindowProperty(dpy, w, XA_WM_ICON_SIZE, 0L, 60L, - False, XA_WM_ICON_SIZE, &actual_type, &actual_format, - &nitems, &leftover, (unsigned char **)&prop) - != Success) return (0); - - pp = prop; - - if ((actual_type != XA_WM_ICON_SIZE) || - (nitems < NumPropIconSizeElements) || - (nitems % NumPropIconSizeElements != 0) || - (actual_format != 32)) { - Xfree (prop); - return(0); - } - - /* static copies not allowed in library, due to reentrancy constraint*/ - - nitems /= NumPropIconSizeElements; - if (! (hp = hints = Xcalloc (nitems, sizeof(XIconSize)))) { - Xfree (prop); - return 0; - } - - /* march down array putting things into native form */ - for (i = 0; i < nitems; i++) { - hp->min_width = cvtINT32toInt (pp->minWidth); - hp->min_height = cvtINT32toInt (pp->minHeight); - hp->max_width = cvtINT32toInt (pp->maxWidth); - hp->max_height = cvtINT32toInt (pp->maxHeight); - hp->width_inc = cvtINT32toInt (pp->widthInc); - hp->height_inc = cvtINT32toInt (pp->heightInc); - hp += 1; - pp += 1; - } - *count = nitems; - *size_list = hints; - Xfree (prop); - return(1); -} - - -Status XGetCommand ( - Display *dpy, - Window w, - char ***argvp, - int *argcp) -{ - XTextProperty tp; - int argc; - char **argv; - - if (!XGetTextProperty (dpy, w, &tp, XA_WM_COMMAND)) return 0; - - if (tp.encoding != XA_STRING || tp.format != 8) { - Xfree (tp.value); - return 0; - } - - - /* - * ignore final if present since UNIX WM_COMMAND is nul-terminated - */ - if (tp.nitems && (tp.value[tp.nitems - 1] == '\0')) tp.nitems--; - - - /* - * create a string list and return if successful - */ - if (!XTextPropertyToStringList (&tp, &argv, &argc)) { - Xfree (tp.value); - return (0); - } - - Xfree (tp.value); - *argvp = argv; - *argcp = argc; - return 1; -} - - -Status -XGetTransientForHint( - Display *dpy, - Window w, - Window *propWindow) -{ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long leftover; - Window *data = NULL; - if (XGetWindowProperty(dpy, w, XA_WM_TRANSIENT_FOR, 0L, 1L, False, - XA_WINDOW, - &actual_type, - &actual_format, &nitems, &leftover, (unsigned char **) &data) - != Success) { - *propWindow = None; - return (0); - } - if ( (actual_type == XA_WINDOW) && (actual_format == 32) && - (nitems != 0) ) { - *propWindow = *data; - Xfree( (char *) data); - return (1); - } - *propWindow = None; - Xfree( (char *) data); - return(0); -} - -Status -XGetClassHint( - Display *dpy, - Window w, - XClassHint *classhint) /* RETURN */ -{ - int len_name, len_class; - - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long leftover; - unsigned char *data = NULL; - if (XGetWindowProperty(dpy, w, XA_WM_CLASS, 0L, (long)BUFSIZ, False, - XA_STRING, - &actual_type, - &actual_format, &nitems, &leftover, &data) != Success) - return (0); - - if ( (actual_type == XA_STRING) && (actual_format == 8) ) { - len_name = strlen((char *) data); - if (! (classhint->res_name = Xmalloc(len_name + 1))) { - Xfree(data); - return (0); - } - strcpy(classhint->res_name, (char *) data); - if (len_name == nitems) len_name--; - len_class = strlen((char *) (data+len_name+1)); - if (! (classhint->res_class = Xmalloc(len_class + 1))) { - Xfree(classhint->res_name); - classhint->res_name = (char *) NULL; - Xfree(data); - return (0); - } - strcpy(classhint->res_class, (char *) (data+len_name+1)); - Xfree( (char *) data); - return(1); - } - Xfree( (char *) data); - return(0); -} diff --git a/nx-X11/lib/X11/GetIFocus.c b/nx-X11/lib/X11/GetIFocus.c deleted file mode 100644 index 0a7f36e8d..000000000 --- a/nx-X11/lib/X11/GetIFocus.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGetInputFocus( - register Display *dpy, - Window *focus, - int *revert_to) -{ - xGetInputFocusReply rep; - _X_UNUSED register xReq *req; - LockDisplay(dpy); - GetEmptyReq(GetInputFocus, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - *focus = rep.focus; - *revert_to = rep.revertTo; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/GetImage.c b/nx-X11/lib/X11/GetImage.c deleted file mode 100644 index d80f6715f..000000000 --- a/nx-X11/lib/X11/GetImage.c +++ /dev/null @@ -1,143 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include /* for XDestroyImage */ -#include "ImUtil.h" -#include - -#define ROUNDUP(nbytes, pad) (((((nbytes) - 1) + (pad)) / (pad)) * (pad)) - -static unsigned int Ones( /* HACKMEM 169 */ - unsigned long mask) -{ - register unsigned long y; - - y = (mask >> 1) &033333333333; - y = mask - y - ((y >>1) & 033333333333); - return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); -} - -XImage *XGetImage ( - register Display *dpy, - Drawable d, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned long plane_mask, - int format) /* either XYPixmap or ZPixmap */ -{ - xGetImageReply rep; - register xGetImageReq *req; - char *data; - unsigned long nbytes; - XImage *image; - int planes; - LockDisplay(dpy); - GetReq (GetImage, req); - /* - * first set up the standard stuff in the request - */ - req->drawable = d; - req->x = x; - req->y = y; - req->width = width; - req->height = height; - req->planeMask = plane_mask; - req->format = format; - - if (_XReply (dpy, (xReply *) &rep, 0, xFalse) == 0 || - rep.length == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return (XImage *)NULL; - } - - if (rep.length < (INT_MAX >> 2)) { - nbytes = (unsigned long)rep.length << 2; - data = Xmalloc(nbytes); - } else - data = NULL; - if (! data) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return (XImage *) NULL; - } - _XReadPad (dpy, data, nbytes); - if (format == XYPixmap) { - image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual), - Ones (plane_mask & - (((unsigned long)0xFFFFFFFF) >> (32 - rep.depth))), - format, 0, data, width, height, dpy->bitmap_pad, 0); - planes = image->depth; - } else { /* format == ZPixmap */ - image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual), - rep.depth, ZPixmap, 0, data, width, height, - _XGetScanlinePad(dpy, (int) rep.depth), 0); - planes = 1; - } - - if (!image) - Xfree(data); - if (planes < 1 || image->height < 1 || image->bytes_per_line < 1 || - INT_MAX / image->height <= image->bytes_per_line || - INT_MAX / planes <= image->height * image->bytes_per_line || - nbytes < planes * image->height * image->bytes_per_line) { - XDestroyImage(image); - image = NULL; - } - UnlockDisplay(dpy); - SyncHandle(); - return (image); -} - -XImage *XGetSubImage( - register Display *dpy, - Drawable d, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned long plane_mask, - int format, /* either XYPixmap or ZPixmap */ - XImage *dest_image, - int dest_x, - int dest_y) -{ - XImage *temp_image; - temp_image = XGetImage(dpy, d, x, y, width, height, - plane_mask, format); - if (!temp_image) - return (XImage *)NULL; - _XSetImage(temp_image, dest_image, dest_x, dest_y); - XDestroyImage(temp_image); - return (dest_image); -} diff --git a/nx-X11/lib/X11/GetKCnt.c b/nx-X11/lib/X11/GetKCnt.c deleted file mode 100644 index 5829fbeaa..000000000 --- a/nx-X11/lib/X11/GetKCnt.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGetKeyboardControl ( - register Display *dpy, - register XKeyboardState *state) -{ - xGetKeyboardControlReply rep; - _X_UNUSED register xReq *req; - LockDisplay(dpy); - GetEmptyReq (GetKeyboardControl, req); - (void) _XReply (dpy, (xReply *) &rep, - (SIZEOF(xGetKeyboardControlReply) - SIZEOF(xReply)) >> 2, xTrue); - - state->key_click_percent = rep.keyClickPercent; - state->bell_percent = rep.bellPercent; - state->bell_pitch = rep.bellPitch; - state->bell_duration = rep.bellDuration; - state->led_mask = rep.ledMask; - state->global_auto_repeat = rep.globalAutoRepeat; - memcpy (state->auto_repeats, rep.map, sizeof state->auto_repeats); - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } - diff --git a/nx-X11/lib/X11/GetMoEv.c b/nx-X11/lib/X11/GetMoEv.c deleted file mode 100644 index ad9c77277..000000000 --- a/nx-X11/lib/X11/GetMoEv.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -XTimeCoord *XGetMotionEvents( - register Display *dpy, - Window w, - Time start, - Time stop, - int *nEvents) /* RETURN */ -{ - xGetMotionEventsReply rep; - register xGetMotionEventsReq *req; - XTimeCoord *tc = NULL; - LockDisplay(dpy); - GetReq(GetMotionEvents, req); - req->window = w; -/* XXX is this right for all machines? */ - req->start = start; - req->stop = stop; - if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return (NULL); - } - - if (rep.nEvents && (rep.nEvents < (INT_MAX / sizeof(XTimeCoord)))) - tc = Xmalloc(rep.nEvents * sizeof(XTimeCoord)); - if (tc == NULL) { - /* server returned either no events or a bad event count */ - *nEvents = 0; - _XEatDataWords (dpy, rep.length); - } - else - { - register XTimeCoord *tcptr; - unsigned int i; - xTimecoord xtc; - - *nEvents = (int) rep.nEvents; - for (i = rep.nEvents, tcptr = tc; i > 0; i--, tcptr++) { - _XRead (dpy, (char *) &xtc, SIZEOF (xTimecoord)); - tcptr->time = xtc.time; - tcptr->x = cvtINT16toShort (xtc.x); - tcptr->y = cvtINT16toShort (xtc.y); - } - } - - UnlockDisplay(dpy); - SyncHandle(); - return (tc); -} - diff --git a/nx-X11/lib/X11/GetNrmHint.c b/nx-X11/lib/X11/GetNrmHint.c deleted file mode 100644 index cc8fd235e..000000000 --- a/nx-X11/lib/X11/GetNrmHint.c +++ /dev/null @@ -1,127 +0,0 @@ -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL OR WYSE 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. - -******************************************************************/ - -/* - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include -#include - -Status XGetWMSizeHints ( - Display *dpy, - Window w, - XSizeHints *hints, - long *supplied, - Atom property) -{ - xPropSizeHints *prop = NULL; - Atom actual_type; - int actual_format; - unsigned long leftover; - unsigned long nitems; - - if (XGetWindowProperty (dpy, w, property, 0L, - (long)NumPropSizeElements, - False, XA_WM_SIZE_HINTS, &actual_type, - &actual_format, &nitems, &leftover, - (unsigned char **)&prop) - != Success) - return False; - - if ((actual_type != XA_WM_SIZE_HINTS) || - (nitems < OldNumPropSizeElements) || (actual_format != 32)) { - Xfree (prop); - return False; - } - - hints->flags = prop->flags; - /* XSizeHints misdeclares these as int instead of long */ - hints->x = cvtINT32toInt (prop->x); - hints->y = cvtINT32toInt (prop->y); - hints->width = cvtINT32toInt (prop->width); - hints->height = cvtINT32toInt (prop->height); - hints->min_width = cvtINT32toInt (prop->minWidth); - hints->min_height = cvtINT32toInt (prop->minHeight); - hints->max_width = cvtINT32toInt (prop->maxWidth); - hints->max_height = cvtINT32toInt (prop->maxHeight); - hints->width_inc = cvtINT32toInt (prop->widthInc); - hints->height_inc = cvtINT32toInt (prop->heightInc); - hints->min_aspect.x = cvtINT32toInt (prop->minAspectX); - hints->min_aspect.y = cvtINT32toInt (prop->minAspectY); - hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX); - hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY); - - *supplied = (USPosition | USSize | PAllHints); - if (nitems >= NumPropSizeElements) { - hints->base_width= cvtINT32toInt (prop->baseWidth); - hints->base_height= cvtINT32toInt (prop->baseHeight); - hints->win_gravity= cvtINT32toInt (prop->winGravity); - *supplied |= (PBaseSize | PWinGravity); - } - hints->flags &= (*supplied); /* get rid of unwanted bits */ - Xfree(prop); - return True; -} - - -Status XGetWMNormalHints ( - Display *dpy, - Window w, - XSizeHints *hints, - long *supplied) -{ - return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS)); -} diff --git a/nx-X11/lib/X11/GetPCnt.c b/nx-X11/lib/X11/GetPCnt.c deleted file mode 100644 index 72d9495b5..000000000 --- a/nx-X11/lib/X11/GetPCnt.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGetPointerControl( - register Display *dpy, - /* the following are return only vars */ - int *accel_numer, - int *accel_denom, - int *threshold) -{ - xGetPointerControlReply rep; - _X_UNUSED xReq *req; - LockDisplay(dpy); - GetEmptyReq(GetPointerControl, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - *accel_numer = rep.accelNumerator; - *accel_denom = rep.accelDenominator; - *threshold = rep.threshold; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/GetPntMap.c b/nx-X11/lib/X11/GetPntMap.c deleted file mode 100644 index 07625f8a0..000000000 --- a/nx-X11/lib/X11/GetPntMap.c +++ /dev/null @@ -1,132 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -#ifdef MIN /* some systems define this in */ -#undef MIN -#endif -#define MIN(a, b) ((a) < (b) ? (a) : (b)) - -int XGetPointerMapping ( - register Display *dpy, - unsigned char *map, /* RETURN */ - int nmaps) - -{ - unsigned char mapping[256]; /* known fixed size */ - unsigned long nbytes, remainder = 0; - xGetPointerMappingReply rep; - _X_UNUSED register xReq *req; - - LockDisplay(dpy); - GetEmptyReq(GetPointerMapping, req); - if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - - /* Don't count on the server returning a valid value */ - if (rep.length >= (INT_MAX >> 2)) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - - nbytes = (unsigned long) rep.length << 2; - if (nbytes > sizeof mapping) { - remainder = nbytes - sizeof mapping; - nbytes = sizeof mapping; - } - _XRead (dpy, (char *)mapping, nbytes); - /* don't return more data than the user asked for. */ - if (rep.nElts) { - memcpy ((char *) map, (char *) mapping, - MIN((int)rep.nElts, nmaps) ); - } - - if (remainder) - _XEatData(dpy, remainder); - - UnlockDisplay(dpy); - SyncHandle(); - return ((int) rep.nElts); -} - -KeySym * -XGetKeyboardMapping (Display *dpy, -#if NeedWidePrototypes - unsigned int first_keycode, -#else - KeyCode first_keycode, -#endif - int count, - int *keysyms_per_keycode) -{ - unsigned long nbytes; - CARD32 nkeysyms; - register KeySym *mapping = NULL; - xGetKeyboardMappingReply rep; - register xGetKeyboardMappingReq *req; - - LockDisplay(dpy); - GetReq(GetKeyboardMapping, req); - req->firstKeyCode = first_keycode; - req->count = count; - if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return (KeySym *) NULL; - } - - nkeysyms = rep.length; - if (nkeysyms > 0) { - if (nkeysyms < (INT_MAX / sizeof (KeySym))) { - nbytes = nkeysyms * sizeof (KeySym); - mapping = Xmalloc (nbytes); - } - if (! mapping) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return (KeySym *) NULL; - } - nbytes = nkeysyms << 2; - _XRead32 (dpy, (long *) mapping, nbytes); - } - *keysyms_per_keycode = rep.keySymsPerKeyCode; - UnlockDisplay(dpy); - SyncHandle(); - return (mapping); -} - diff --git a/nx-X11/lib/X11/GetProp.c b/nx-X11/lib/X11/GetProp.c deleted file mode 100644 index 9eb422ee3..000000000 --- a/nx-X11/lib/X11/GetProp.c +++ /dev/null @@ -1,146 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -int -XGetWindowProperty( - register Display *dpy, - Window w, - Atom property, - long offset, - long length, - Bool delete, - Atom req_type, - Atom *actual_type, /* RETURN */ - int *actual_format, /* RETURN 8, 16, or 32 */ - unsigned long *nitems, /* RETURN # of 8-, 16-, or 32-bit entities */ - unsigned long *bytesafter, /* RETURN */ - unsigned char **prop) /* RETURN */ -{ - xGetPropertyReply reply; - register xGetPropertyReq *req; - xError error = {0}; - - /* Always initialize return values, in case callers fail to initialize - them and fail to check the return code for an error. */ - *actual_type = None; - *actual_format = 0; - *nitems = *bytesafter = 0L; - *prop = (unsigned char *) NULL; - - LockDisplay(dpy); - GetReq (GetProperty, req); - req->window = w; - req->property = property; - req->type = req_type; - req->delete = delete; - req->longOffset = offset; - req->longLength = length; - error.sequenceNumber = dpy->request; - - if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return (1); /* not Success */ - } - - if (reply.propertyType != None) { - unsigned long nbytes, netbytes; - int format = reply.format; - - /* - * Protect against both integer overflow and just plain oversized - * memory allocation - no server should ever return this many props. - */ - if (reply.nItems >= (INT_MAX >> 4)) - format = -1; /* fall through to default error case */ - - switch (format) { - /* - * One extra byte is malloced than is needed to contain the property - * data, but this last byte is null terminated and convenient for - * returning string properties, so the client doesn't then have to - * recopy the string to make it null terminated. - */ - case 8: - nbytes = netbytes = reply.nItems; - if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) - _XReadPad (dpy, (char *) *prop, netbytes); - break; - - case 16: - nbytes = reply.nItems * sizeof (short); - netbytes = reply.nItems << 1; - if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) - _XRead16Pad (dpy, (short *) *prop, netbytes); - break; - - case 32: - nbytes = reply.nItems * sizeof (long); - netbytes = reply.nItems << 2; - if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) - _XRead32 (dpy, (long *) *prop, netbytes); - break; - - default: - /* - * This part of the code should never be reached. If it is, - * the server sent back a property with an invalid format. - * This is a BadImplementation error. - */ - { - /* sequence number stored above */ - error.type = X_Error; - error.majorCode = X_GetProperty; - error.minorCode = 0; - error.errorCode = BadImplementation; - _XError(dpy, &error); - } - nbytes = netbytes = 0L; - break; - } - if (! *prop) { - _XEatDataWords(dpy, reply.length); - UnlockDisplay(dpy); - SyncHandle(); - return(BadAlloc); /* not Success */ - } - (*prop)[nbytes] = '\0'; - } - *actual_type = reply.propertyType; - *actual_format = reply.format; - *nitems = reply.nItems; - *bytesafter = reply.bytesAfter; - UnlockDisplay(dpy); - SyncHandle(); - return(Success); -} - diff --git a/nx-X11/lib/X11/GetRGBCMap.c b/nx-X11/lib/X11/GetRGBCMap.c deleted file mode 100644 index 746b53fbf..000000000 --- a/nx-X11/lib/X11/GetRGBCMap.c +++ /dev/null @@ -1,134 +0,0 @@ - -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include - -Status XGetRGBColormaps ( - Display *dpy, - Window w, - XStandardColormap **stdcmap, /* RETURN */ - int *count, /* RETURN */ - Atom property) /* XA_RGB_BEST_MAP, etc. */ -{ - register int i; /* iterator variable */ - xPropStandardColormap *data = NULL; /* data read in from prop */ - Atom actual_type; /* how the prop was actually stored */ - int actual_format; /* ditto */ - unsigned long leftover; /* how much was left over */ - unsigned long nitems; /* number of 32bits read */ - int ncmaps; /* number of structs this makes */ - Bool old_style = False; /* if was too short */ - VisualID def_visual = None; /* visual to use if prop too short */ - XStandardColormap *cmaps; /* return value */ - - - if (XGetWindowProperty (dpy, w, property, 0L, 1000000L, False, - XA_RGB_COLOR_MAP, &actual_type, &actual_format, - &nitems, &leftover, (unsigned char **)&data) - != Success) - return False; - - /* if wrong type or format, or too small for us, then punt */ - if ((actual_type != XA_RGB_COLOR_MAP) || (actual_format != 32) || - (nitems < OldNumPropStandardColormapElements)) { - Xfree (data); - return False; - } - - /* - * See how many properties were found; if pre-ICCCM then assume - * default visual and a kill id of 1. - */ - if (nitems < NumPropStandardColormapElements) { - ncmaps = 1; - old_style = True; - if (nitems < (NumPropStandardColormapElements - 1)) { - Screen *sp = _XScreenOfWindow (dpy, w); - - if (!sp) { - Xfree (data); - return False; - } - def_visual = sp->root_visual->visualid; - } - } else { - /* - * make sure we have an integral number of colormaps - */ - ncmaps = (nitems / NumPropStandardColormapElements); - if ((((unsigned long) ncmaps) * NumPropStandardColormapElements) != - nitems) { - Xfree (data); - return False; - } - } - - - /* - * allocate array - */ - cmaps = Xmalloc (ncmaps * sizeof (XStandardColormap)); - if (!cmaps) { - Xfree (data); - return False; - } - - - /* - * and fill it in, handling compatibility with pre-ICCCM short stdcmaps - */ - { - register XStandardColormap *map; - register xPropStandardColormap *prop; - - for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) { - map->colormap = prop->colormap; - map->red_max = prop->red_max; - map->red_mult = prop->red_mult; - map->green_max = prop->green_max; - map->green_mult = prop->green_mult; - map->blue_max = prop->blue_max; - map->blue_mult = prop->blue_mult; - map->base_pixel = prop->base_pixel; - map->visualid = (def_visual ? def_visual : prop->visualid); - map->killid = (old_style ? None : prop->killid); - } - } - Xfree (data); - *stdcmap = cmaps; - *count = ncmaps; - return True; -} - diff --git a/nx-X11/lib/X11/GetSOwner.c b/nx-X11/lib/X11/GetSOwner.c deleted file mode 100644 index 2258f8ce1..000000000 --- a/nx-X11/lib/X11/GetSOwner.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Window XGetSelectionOwner( - register Display *dpy, - Atom selection) -{ - xGetSelectionOwnerReply rep; - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(GetSelectionOwner, selection, req); - - if (_XReply(dpy, (xReply *)&rep, 0, xTrue) == 0) rep.owner = None; - UnlockDisplay(dpy); - SyncHandle(); - return(rep.owner); -} diff --git a/nx-X11/lib/X11/GetSSaver.c b/nx-X11/lib/X11/GetSSaver.c deleted file mode 100644 index 7c2a3061a..000000000 --- a/nx-X11/lib/X11/GetSSaver.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGetScreenSaver( - register Display *dpy, - /* the following are return only vars */ - int *timeout, - int *interval, - int *prefer_blanking, - int *allow_exp) /*boolean */ - -{ - xGetScreenSaverReply rep; - _X_UNUSED register xReq *req; - LockDisplay(dpy); - GetEmptyReq(GetScreenSaver, req); - - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - *timeout = rep.timeout; - *interval = rep.interval; - *prefer_blanking = rep.preferBlanking; - *allow_exp = rep.allowExposures; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/GetStCmap.c b/nx-X11/lib/X11/GetStCmap.c deleted file mode 100644 index 560de67ba..000000000 --- a/nx-X11/lib/X11/GetStCmap.c +++ /dev/null @@ -1,117 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include - -/* - * WARNING - * - * This is a pre-ICCCM routine. It must not reference any of the new fields - * in the XStandardColormap structure. - */ - -Status XGetStandardColormap ( - Display *dpy, - Window w, - XStandardColormap *cmap, - Atom property) /* XA_RGB_BEST_MAP, etc. */ -{ - Status stat; /* return value */ - XStandardColormap *stdcmaps; /* will get malloced value */ - int nstdcmaps; /* count of above */ - - stat = XGetRGBColormaps (dpy, w, &stdcmaps, &nstdcmaps, property); - if (stat) { - XStandardColormap *use; - - if (nstdcmaps > 1) { - VisualID vid; - Screen *sp = _XScreenOfWindow (dpy, w); - int i; - - if (!sp) { - Xfree (stdcmaps); - return False; - } - vid = sp->root_visual->visualid; - - for (i = 0; i < nstdcmaps; i++) { - if (stdcmaps[i].visualid == vid) break; - } - - if (i == nstdcmaps) { /* not found */ - Xfree (stdcmaps); - return False; - } - use = &stdcmaps[i]; - } else { - use = stdcmaps; - } - - /* - * assign only those fields which were in the pre-ICCCM version - */ - cmap->colormap = use->colormap; - cmap->red_max = use->red_max; - cmap->red_mult = use->red_mult; - cmap->green_max = use->green_max; - cmap->green_mult = use->green_mult; - cmap->blue_max = use->blue_max; - cmap->blue_mult = use->blue_mult; - cmap->base_pixel = use->base_pixel; - - Xfree (stdcmaps); /* don't need alloced memory */ - } - return stat; -} diff --git a/nx-X11/lib/X11/GetTxtProp.c b/nx-X11/lib/X11/GetTxtProp.c deleted file mode 100644 index 2694b8184..000000000 --- a/nx-X11/lib/X11/GetTxtProp.c +++ /dev/null @@ -1,113 +0,0 @@ -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., - - All Rights Reserved - -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 -supporting documentation, and that the name Wyse not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -Status XGetTextProperty ( - Display *display, - Window window, - XTextProperty *tp, - Atom property) -{ - Atom actual_type; - int actual_format = 0; - unsigned long nitems = 0L, leftover = 0L; - unsigned char *prop = NULL; - - if (XGetWindowProperty (display, window, property, 0L, 1000000L, False, - AnyPropertyType, &actual_type, &actual_format, - &nitems, &leftover, &prop) == Success && - actual_type != None) { - /* okay, fill it in */ - tp->value = prop; - tp->encoding = actual_type; - tp->format = actual_format; - tp->nitems = nitems; - return True; - } - - tp->value = NULL; - tp->encoding = None; - tp->format = 0; - tp->nitems = 0; - return False; -} - -Status XGetWMName ( - Display *dpy, - Window w, - XTextProperty *tp) -{ - return (XGetTextProperty (dpy, w, tp, XA_WM_NAME)); -} - -Status XGetWMIconName ( - Display *dpy, - Window w, - XTextProperty *tp) -{ - return (XGetTextProperty (dpy, w, tp, XA_WM_ICON_NAME)); -} - -Status XGetWMClientMachine ( - Display *dpy, - Window w, - XTextProperty *tp) -{ - return (XGetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE)); -} - diff --git a/nx-X11/lib/X11/GetWAttrs.c b/nx-X11/lib/X11/GetWAttrs.c deleted file mode 100644 index c10824cf4..000000000 --- a/nx-X11/lib/X11/GetWAttrs.c +++ /dev/null @@ -1,155 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -typedef struct _WAttrsState { - unsigned long attr_seq; - unsigned long geom_seq; - XWindowAttributes *attr; -} _XWAttrsState; - -static Bool -_XWAttrsHandler( - register Display *dpy, - register xReply *rep, - char *buf, - int len, - XPointer data) -{ - register _XWAttrsState *state; - xGetWindowAttributesReply replbuf; - register xGetWindowAttributesReply *repl; - register XWindowAttributes *attr; - - state = (_XWAttrsState *)data; - if (dpy->last_request_read != state->attr_seq) { - if (dpy->last_request_read == state->geom_seq && - !state->attr && - rep->generic.type == X_Error && - rep->error.errorCode == BadDrawable) - return True; - return False; - } - if (rep->generic.type == X_Error) { - state->attr = (XWindowAttributes *)NULL; - return False; - } - repl = (xGetWindowAttributesReply *) - _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, - (SIZEOF(xGetWindowAttributesReply) - SIZEOF(xReply)) >> 2, - True); - attr = state->attr; - attr->class = repl->class; - attr->bit_gravity = repl->bitGravity; - attr->win_gravity = repl->winGravity; - attr->backing_store = repl->backingStore; - attr->backing_planes = repl->backingBitPlanes; - attr->backing_pixel = repl->backingPixel; - attr->save_under = repl->saveUnder; - attr->colormap = repl->colormap; - attr->map_installed = repl->mapInstalled; - attr->map_state = repl->mapState; - attr->all_event_masks = repl->allEventMasks; - attr->your_event_mask = repl->yourEventMask; - attr->do_not_propagate_mask = repl->doNotPropagateMask; - attr->override_redirect = repl->override; - attr->visual = _XVIDtoVisual (dpy, repl->visualID); - return True; -} - -Status -_XGetWindowAttributes( - register Display *dpy, - Window w, - XWindowAttributes *attr) -{ - xGetGeometryReply rep; - register xResourceReq *req; - register int i; - register Screen *sp; - _XAsyncHandler async; - _XWAttrsState async_state; - - GetResReq(GetWindowAttributes, w, req); - - async_state.attr_seq = dpy->request; - async_state.geom_seq = 0; - async_state.attr = attr; - async.next = dpy->async_handlers; - async.handler = _XWAttrsHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - - GetResReq(GetGeometry, w, req); - - async_state.geom_seq = dpy->request; - - if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { - DeqAsyncHandler(dpy, &async); - return (0); - } - DeqAsyncHandler(dpy, &async); - if (!async_state.attr) { - return (0); - } - attr->x = cvtINT16toInt (rep.x); - attr->y = cvtINT16toInt (rep.y); - attr->width = rep.width; - attr->height = rep.height; - attr->border_width = rep.borderWidth; - attr->depth = rep.depth; - attr->root = rep.root; - /* find correct screen so that applications find it easier.... */ - for (i = 0; i < dpy->nscreens; i++) { - sp = &dpy->screens[i]; - if (sp->root == attr->root) { - attr->screen = sp; - break; - } - } - return(1); -} - -Status -XGetWindowAttributes( - Display *dpy, - Window w, - XWindowAttributes *attr) -{ - Status ret; - - LockDisplay(dpy); - ret = _XGetWindowAttributes(dpy, w, attr); - UnlockDisplay(dpy); - SyncHandle(); - - return ret; -} - diff --git a/nx-X11/lib/X11/GetWMCMapW.c b/nx-X11/lib/X11/GetWMCMapW.c deleted file mode 100644 index 722ec60f8..000000000 --- a/nx-X11/lib/X11/GetWMCMapW.c +++ /dev/null @@ -1,87 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include - -Status XGetWMColormapWindows ( - Display *dpy, - Window w, - Window **colormapWindows, - int *countReturn) -{ - Atom *data = NULL; - Atom actual_type; - Atom prop; - int actual_format; - unsigned long leftover, nitems; - - prop = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False); - if (prop == None) return False; - - /* get the property */ - if (XGetWindowProperty (dpy, w, prop, - 0L, 1000000L, False, - XA_WINDOW, &actual_type, &actual_format, - &nitems, &leftover, (unsigned char **) &data) - != Success) - return False; - - if (actual_type != XA_WINDOW || actual_format != 32) { - Xfree (data); - return False; - } - - *colormapWindows = (Window *) data; - *countReturn = (int) nitems; - return True; -} diff --git a/nx-X11/lib/X11/GetWMProto.c b/nx-X11/lib/X11/GetWMProto.c deleted file mode 100644 index 1ea4f55d5..000000000 --- a/nx-X11/lib/X11/GetWMProto.c +++ /dev/null @@ -1,87 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include - -Status XGetWMProtocols ( - Display *dpy, - Window w, - Atom **protocols, - int *countReturn) -{ - Atom *data = NULL; - Atom actual_type; - Atom prop; - int actual_format; - unsigned long leftover, nitems; - - prop = XInternAtom(dpy, "WM_PROTOCOLS", False); - if (prop == None) return False; - - /* get the property */ - if (XGetWindowProperty (dpy, w, prop, - 0L, 1000000L, False, - XA_ATOM, &actual_type, &actual_format, - &nitems, &leftover, (unsigned char **) &data) - != Success) - return False; - - if (actual_type != XA_ATOM || actual_format != 32) { - Xfree (data); - return False; - } - - *protocols = (Atom *) data; - *countReturn = (int) nitems; - return True; -} diff --git a/nx-X11/lib/X11/GrButton.c b/nx-X11/lib/X11/GrButton.c deleted file mode 100644 index 621f49a5c..000000000 --- a/nx-X11/lib/X11/GrButton.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGrabButton( - register Display *dpy, - unsigned int button, /* CARD8 */ - unsigned int modifiers, /* CARD16 */ - Window grab_window, - Bool owner_events, - unsigned int event_mask, /* CARD16 */ - int pointer_mode, - int keyboard_mode, - Window confine_to, - Cursor curs) -{ - register xGrabButtonReq *req; - LockDisplay(dpy); - GetReq(GrabButton, req); - req->modifiers = modifiers; - req->button = button; - req->grabWindow = grab_window; - req->ownerEvents = owner_events; - req->eventMask = event_mask; - req->pointerMode = pointer_mode; - req->keyboardMode = keyboard_mode; - req->confineTo = confine_to; - req->cursor = curs; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/GrKey.c b/nx-X11/lib/X11/GrKey.c deleted file mode 100644 index d2da5952f..000000000 --- a/nx-X11/lib/X11/GrKey.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGrabKey( - register Display *dpy, - int key, - unsigned int modifiers, - Window grab_window, - Bool owner_events, - int pointer_mode, - int keyboard_mode) - -{ - register xGrabKeyReq *req; - LockDisplay(dpy); - GetReq(GrabKey, req); - req->ownerEvents = owner_events; - req->grabWindow = grab_window; - req->modifiers = modifiers; - req->key = key; - req->pointerMode = pointer_mode; - req->keyboardMode = keyboard_mode; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - - - diff --git a/nx-X11/lib/X11/GrKeybd.c b/nx-X11/lib/X11/GrKeybd.c deleted file mode 100644 index 07dc84115..000000000 --- a/nx-X11/lib/X11/GrKeybd.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -int XGrabKeyboard ( - register Display *dpy, - Window window, - Bool ownerEvents, - int pointerMode, - int keyboardMode, - Time time) -{ - xGrabKeyboardReply rep; - register xGrabKeyboardReq *req; - register int status; - LockDisplay(dpy); - GetReq(GrabKeyboard, req); - req->grabWindow = window; - req->ownerEvents = ownerEvents; - req->pointerMode = pointerMode; - req->keyboardMode = keyboardMode; - req->time = time; - - /* if we ever return, suppress the error */ - if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) - rep.status = GrabSuccess; - status = rep.status; - UnlockDisplay(dpy); - SyncHandle(); - return (status); -} - diff --git a/nx-X11/lib/X11/GrPointer.c b/nx-X11/lib/X11/GrPointer.c deleted file mode 100644 index a0d98277c..000000000 --- a/nx-X11/lib/X11/GrPointer.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int XGrabPointer( - register Display *dpy, - Window grab_window, - Bool owner_events, - unsigned int event_mask, /* CARD16 */ - int pointer_mode, - int keyboard_mode, - Window confine_to, - Cursor curs, - Time time) -{ - xGrabPointerReply rep; - register xGrabPointerReq *req; - register int status; - LockDisplay(dpy); - GetReq(GrabPointer, req); - req->grabWindow = grab_window; - req->ownerEvents = owner_events; - req->eventMask = event_mask; - req->pointerMode = pointer_mode; - req->keyboardMode = keyboard_mode; - req->confineTo = confine_to; - req->cursor = curs; - req->time = time; - - /* if we ever return, suppress the error */ - if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) - rep.status = GrabSuccess; - status = rep.status; - UnlockDisplay(dpy); - SyncHandle(); - return (status); -} diff --git a/nx-X11/lib/X11/GrServer.c b/nx-X11/lib/X11/GrServer.c deleted file mode 100644 index c4c62bef3..000000000 --- a/nx-X11/lib/X11/GrServer.c +++ /dev/null @@ -1,42 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XGrabServer (register Display *dpy) -{ - _X_UNUSED register xReq *req; - LockDisplay(dpy); - GetEmptyReq(GrabServer, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/HVC.c b/nx-X11/lib/X11/HVC.c deleted file mode 100644 index 98d7142c3..000000000 --- a/nx-X11/lib/X11/HVC.c +++ /dev/null @@ -1,625 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVC.c - * - * DESCRIPTION - * This file contains routines that support the TekHVC - * color space to include conversions to and from the CIE - * XYZ space. - * - * DOCUMENTATION - * "TekColor Color Management System, System Implementor's Manual" - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include -#include "Cv.h" - -#include - -/* - * DEFINES - */ -#define u_BR 0.7127 /* u' Best Red */ -#define v_BR 0.4931 /* v' Best Red */ -#define EPS 0.001 -#define CHROMA_SCALE_FACTOR 7.50725 -#ifndef PI -# ifdef M_PI -# define PI M_PI -# else -# define PI 3.14159265358979323846264338327950 -# endif -#endif -#ifndef degrees -# define degrees(r) ((XcmsFloat)(r) * 180.0 / PI) -#endif /* degrees */ -#ifndef radians -# define radians(d) ((XcmsFloat)(d) * PI / 180.0) -#endif /* radians */ - -/************************************************************************* - * Note: The DBL_EPSILON for ANSI is 1e-5 so my checks need to take - * this into account. If your DBL_EPSILON is different then - * adjust this define. - * - * Also note that EPS is the error factor in the calculations - * This may need to be the same as XMY_DBL_EPSILON in - * some implementations. - **************************************************************************/ -#ifdef DBL_EPSILON -# define XMY_DBL_EPSILON DBL_EPSILON -#else -# define XMY_DBL_EPSILON 0.00001 -#endif - -/* - * FORWARD DECLARATIONS - */ -static int TekHVC_ParseString(register char *spec, XcmsColor *pColor); -static Status XcmsTekHVC_ValidSpec(XcmsColor *pColor); - -/* - * LOCAL VARIABLES - */ - - /* - * NULL terminated list of functions applied to get from TekHVC to CIEXYZ - */ -static XcmsConversionProc Fl_TekHVC_to_CIEXYZ[] = { - XcmsTekHVCToCIEuvY, - XcmsCIEuvYToCIEXYZ, - NULL -}; - - /* - * NULL terminated list of functions applied to get from CIEXYZ to TekHVC - */ -static XcmsConversionProc Fl_CIEXYZ_to_TekHVC[] = { - XcmsCIEXYZToCIEuvY, - XcmsCIEuvYToTekHVC, - NULL -}; - -/* - * GLOBALS - */ - - /* - * TekHVC Color Space - */ -XcmsColorSpace XcmsTekHVCColorSpace = - { - _XcmsTekHVC_prefix, /* prefix */ - XcmsTekHVCFormat, /* id */ - TekHVC_ParseString, /* parseString */ - Fl_TekHVC_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_TekHVC, /* from_CIEXYZ */ - 1 - }; - - - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * TekHVC_ParseString - * - * SYNOPSIS - */ -static int -TekHVC_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsTekHVCFormat. - * The assumed TekHVC string syntax is: - * TekHVC:// - * Where H, V, and C are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - * XcmsFailure if invalid; - * XcmsSuccess if valid. - */ -{ - size_t n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (size_t)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsTekHVC_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.TekHVC.H, - &pColor->spec.TekHVC.V, - &pColor->spec.TekHVC.C) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.TekHVC.H, - &pColor->spec.TekHVC.V, - &pColor->spec.TekHVC.C) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - pColor->format = XcmsTekHVCFormat; - pColor->pixel = 0; - return(XcmsTekHVC_ValidSpec(pColor)); -} - - -/* - * NAME - * ThetaOffset -- compute thetaOffset - * - * SYNOPSIS - */ -static int -ThetaOffset( - XcmsColor *pWhitePt, - XcmsFloat *pThetaOffset) -/* - * DESCRIPTION - * This routine computes the theta offset of a given - * white point, i.e. XcmsColor. It is used in both this - * conversion and the printer conversions. - * - * RETURNS - * 0 if failed. - * 1 if succeeded with no modifications. - * - * ASSUMPTIONS - * Assumes: - * pWhitePt != NULL - * pWhitePt->format == XcmsCIEuvYFormat - * - */ -{ - double div, slopeuv; - - if (pWhitePt == NULL || pWhitePt->format != XcmsCIEuvYFormat) { - return(0); - } - - if ((div = u_BR - pWhitePt->spec.CIEuvY.u_prime) == 0.0) { - return(0); - } - slopeuv = (v_BR - pWhitePt->spec.CIEuvY.v_prime) / div; - *pThetaOffset = degrees(XCMS_ATAN(slopeuv)); - return(1); -} - - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVC_ValidSpec() - * - * SYNOPSIS - */ -static int -XcmsTekHVC_ValidSpec( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks if values in the color specification are valid. - * Also brings hue into the range 0.0 <= Hue < 360.0 - * - * RETURNS - * 0 if not valid. - * 1 if valid. - * - */ -{ - if (pColor->format != XcmsTekHVCFormat) { - return(XcmsFailure); - } - if (pColor->spec.TekHVC.V < (0.0 - XMY_DBL_EPSILON) - || pColor->spec.TekHVC.V > (100.0 + XMY_DBL_EPSILON) - || (pColor->spec.TekHVC.C < 0.0 - XMY_DBL_EPSILON)) { - return(XcmsFailure); - } - - if (pColor->spec.TekHVC.V < 0.0) { - pColor->spec.TekHVC.V = 0.0 + XMY_DBL_EPSILON; - } else if (pColor->spec.TekHVC.V > 100.0) { - pColor->spec.TekHVC.V = 100.0 - XMY_DBL_EPSILON; - } - - if (pColor->spec.TekHVC.C < 0.0) { - pColor->spec.TekHVC.C = 0.0 - XMY_DBL_EPSILON; - } - - while (pColor->spec.TekHVC.H < 0.0) { - pColor->spec.TekHVC.H += 360.0; - } - while (pColor->spec.TekHVC.H >= 360.0) { - pColor->spec.TekHVC.H -= 360.0; - } - return(XcmsSuccess); -} - -/* - * NAME - * XcmsTekHVCToCIEuvY - convert TekHVC to CIEuvY - * - * SYNOPSIS - */ -Status -XcmsTekHVCToCIEuvY( - XcmsCCC ccc, - XcmsColor *pHVC_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Transforms an array of TekHVC color specifications, given - * their associated white point, to CIECIEuvY.color - * specifications. - * - * RETURNS - * XcmsFailure if failed, XcmsSuccess otherwise. - * - */ -{ - XcmsFloat thetaOffset; - XcmsColor *pColor = pColors_in_out; - XcmsColor whitePt; - XcmsCIEuvY uvY_return; - XcmsFloat tempHue, u, v; - XcmsFloat tmpVal; - unsigned int i; - - /* - * Check arguments - */ - if (pHVC_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Make sure white point is in CIEuvY form - */ - if (pHVC_WhitePt->format != XcmsCIEuvYFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pHVC_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, - XcmsCIEuvYFormat)) { - return(XcmsFailure); - } - pHVC_WhitePt = &whitePt; - } - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (pHVC_WhitePt->spec.CIEuvY.Y != 1.0) { - return(XcmsFailure); - } - - /* Get the thetaOffset */ - if (!ThetaOffset(pHVC_WhitePt, &thetaOffset)) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - /* Make sure original format is TekHVC and is valid */ - if (!XcmsTekHVC_ValidSpec(pColor)) { - return(XcmsFailure); - } - - if (pColor->spec.TekHVC.V == 0.0 || pColor->spec.TekHVC.V == 100.0) { - if (pColor->spec.TekHVC.V == 100.0) { - uvY_return.Y = 1.0; - } else { /* pColor->spec.TekHVC.V == 0.0 */ - uvY_return.Y = 0.0; - } - uvY_return.u_prime = pHVC_WhitePt->spec.CIEuvY.u_prime; - uvY_return.v_prime = pHVC_WhitePt->spec.CIEuvY.v_prime; - } else { - - /* Find the hue based on the white point offset */ - tempHue = pColor->spec.TekHVC.H + thetaOffset; - - while (tempHue < 0.0) { - tempHue += 360.0; - } - while (tempHue >= 360.0) { - tempHue -= 360.0; - } - - tempHue = radians(tempHue); - - /* Calculate u'v' for the obtained hue */ - u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) / - (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR)); - v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) / - (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR)); - - /* Based on the white point get the offset from best red */ - uvY_return.u_prime = u + pHVC_WhitePt->spec.CIEuvY.u_prime; - uvY_return.v_prime = v + pHVC_WhitePt->spec.CIEuvY.v_prime; - - /* Calculate the Y value based on the L* = V. */ - if (pColor->spec.TekHVC.V < 7.99953624) { - uvY_return.Y = pColor->spec.TekHVC.V / 903.29; - } else { - tmpVal = (pColor->spec.TekHVC.V + 16.0) / 116.0; - uvY_return.Y = tmpVal * tmpVal * tmpVal; /* tmpVal ** 3 */ - } - } - - /* Copy result to pColor */ - memcpy((char *)&pColor->spec, (char *)&uvY_return, sizeof(XcmsCIEuvY)); - - /* Identify that the format is now CIEuvY */ - pColor->format = XcmsCIEuvYFormat; - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIEuvYToTekHVC - convert CIEuvY to TekHVC - * - * SYNOPSIS - */ -Status -XcmsCIEuvYToTekHVC( - XcmsCCC ccc, - XcmsColor *pHVC_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Transforms an array of CIECIEuvY.color specifications, given - * their assiciated white point, to TekHVC specifications. - * - * RETURNS - * XcmsFailure if failed, XcmsSuccess otherwise. - * - */ -{ - XcmsFloat theta, L2, u, v, nThetaLow, nThetaHigh; - XcmsFloat thetaOffset; - XcmsColor *pColor = pColors_in_out; - XcmsColor whitePt; - XcmsTekHVC HVC_return; - unsigned int i; - - /* - * Check arguments - */ - if (pHVC_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Make sure white point is in CIEuvY form - */ - if (pHVC_WhitePt->format != XcmsCIEuvYFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pHVC_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, - XcmsCIEuvYFormat)) { - return(XcmsFailure); - } - pHVC_WhitePt = &whitePt; - } - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (pHVC_WhitePt->spec.CIEuvY.Y != 1.0) { - return(XcmsFailure); - } - if (!ThetaOffset(pHVC_WhitePt, &thetaOffset)) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - if (!_XcmsCIEuvY_ValidSpec(pColor)) { - return(XcmsFailure); - } - - /* Use the white point offset to determine HVC */ - u = pColor->spec.CIEuvY.u_prime - pHVC_WhitePt->spec.CIEuvY.u_prime; - v = pColor->spec.CIEuvY.v_prime - pHVC_WhitePt->spec.CIEuvY.v_prime; - - /* Calculate the offset */ - if (u == 0.0) { - theta = 0.0; - } else { - theta = v / u; - theta = (XcmsFloat) XCMS_ATAN((double)theta); - theta = degrees(theta); - } - - nThetaLow = 0.0; - nThetaHigh = 360.0; - if (u > 0.0 && v > 0.0) { - nThetaLow = 0.0; - nThetaHigh = 90.0; - } else if (u < 0.0 && v > 0.0) { - nThetaLow = 90.0; - nThetaHigh = 180.0; - } else if (u < 0.0 && v < 0.0) { - nThetaLow = 180.0; - nThetaHigh = 270.0; - } else if (u > 0.0 && v < 0.0) { - nThetaLow = 270.0; - nThetaHigh = 360.0; - } - while (theta < nThetaLow) { - theta += 90.0; - } - while (theta >= nThetaHigh) { - theta -= 90.0; - } - - /* calculate the L value from the given Y */ - L2 = (pColor->spec.CIEuvY.Y < 0.008856) - ? - (pColor->spec.CIEuvY.Y * 903.29) - : - ((XcmsFloat)(XCMS_CUBEROOT(pColor->spec.CIEuvY.Y) * 116.0) - 16.0); - HVC_return.C = L2 * CHROMA_SCALE_FACTOR * XCMS_SQRT((double) ((u * u) + (v * v))); - if (HVC_return.C < 0.0) { - theta = 0.0; - } - HVC_return.V = L2; - HVC_return.H = theta - thetaOffset; - - /* - * If this is within the error margin let some other routine later - * in the chain worry about the slop in the calculations. - */ - while (HVC_return.H < -EPS) { - HVC_return.H += 360.0; - } - while (HVC_return.H >= 360.0 + EPS) { - HVC_return.H -= 360.0; - } - - /* Copy result to pColor */ - memcpy((char *)&pColor->spec, (char *)&HVC_return, sizeof(XcmsTekHVC)); - - /* Identify that the format is now CIEuvY */ - pColor->format = XcmsTekHVCFormat; - } - return(XcmsSuccess); -} - - -/* - * NAME - * _XcmsTekHVC_CheckModify - * - * SYNOPSIS - */ -int -_XcmsTekHVC_CheckModify( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks if values in the color specification are valid. - * If they are not it modifies the values. - * Also brings hue into the range 0.0 <= Hue < 360.0 - * - * RETURNS - * 0 if not valid. - * 1 if valid. - * - */ -{ - int n; - - /* For now only use the TekHVC numbers as inputs */ - if (pColor->format != XcmsTekHVCFormat) { - return(0); - } - - if (pColor->spec.TekHVC.V < 0.0) { - pColor->spec.TekHVC.V = 0.0 + XMY_DBL_EPSILON; - } else if (pColor->spec.TekHVC.V > 100.0) { - pColor->spec.TekHVC.V = 100.0 - XMY_DBL_EPSILON; - } - - if (pColor->spec.TekHVC.C < 0.0) { - pColor->spec.TekHVC.C = 0.0 - XMY_DBL_EPSILON; - } - - if (pColor->spec.TekHVC.H < 0.0) { - n = -pColor->spec.TekHVC.H / 360.0; - pColor->spec.TekHVC.H += (n + 1) * 360.0; - if (pColor->spec.TekHVC.H >= 360.0) - pColor->spec.TekHVC.H -= 360.0; - } else if (pColor->spec.TekHVC.H >= 360.0) { - n = pColor->spec.TekHVC.H / 360.0; - pColor->spec.TekHVC.H -= n * 360.0; - } - return(1); -} diff --git a/nx-X11/lib/X11/HVCGcC.c b/nx-X11/lib/X11/HVCGcC.c deleted file mode 100644 index 6d52eac63..000000000 --- a/nx-X11/lib/X11/HVCGcC.c +++ /dev/null @@ -1,149 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCGcC.c - * - * DESCRIPTION - * Source for XcmsTekHVCClipC() gamut compression routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCClipC - Reduce the chroma for a hue and value - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsTekHVCClipC ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * Reduce the Chroma for a specific hue and value to - * to bring the given color into the gamut of the - * specified device. As required of gamut compression - * functions in Xcms, this routine returns pColor_in_out - * in XcmsCIEXYZFormat on successful completion. - * - * Since this routine works with the value within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - Status retval; - XcmsColor *pColor; - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor && - FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { - /* - * GRAY ! - */ - _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, - 1, XcmsTekHVCFormat); - pColor->spec.TekHVC.H = pColor->spec.TekHVC.C = 0.0; - _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, - 1, XcmsCIEXYZFormat); - if (pCompressed) { - *(pCompressed + i) = True; - } - return(XcmsSuccess); - } else { - if (pColor->format != XcmsTekHVCFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsTekHVCQueryMaxC(ccc, - pColor->spec.TekHVC.H, - pColor->spec.TekHVC.V, - pColor) - == XcmsFailure) { - return(XcmsFailure); - } - retval = _XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/HVCGcV.c b/nx-X11/lib/X11/HVCGcV.c deleted file mode 100644 index 0752a0724..000000000 --- a/nx-X11/lib/X11/HVCGcV.c +++ /dev/null @@ -1,201 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCGcV.c - * - * DESCRIPTION - * Source for XcmsTekHVCClipV() gamut compression routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCClipV - Return the closest value - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsTekHVCClipV ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * Return the closest value for a specific hue and chroma. - * This routine takes any color as input and outputs - * a CIE XYZ color. - * - * Since this routine works with the value within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsColor *pColor; - XcmsColor hvc_max; - XcmsCCCRec myCCC; - Status retval; - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor && - FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { - /* - * GRAY ! - */ - return(XcmsFailure); - } else { - /* Convert from CIEXYZ to TekHVC format */ - if (_XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) - == XcmsFailure) { - return(XcmsFailure); - } - - /* check to make sure we have a valid TekHVC number */ - if (!_XcmsTekHVC_CheckModify (pColor)) { - return (XcmsFailure); - } - - /* Step 1: compute the maximum value and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - memcpy((char *)&hvc_max, (char *)pColor, sizeof(XcmsColor)); - if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, - (XcmsRGBi *)NULL) == XcmsFailure) { - return (XcmsFailure); - } - - /* Now check and return the appropriate value */ - if (pColor->spec.TekHVC.C == hvc_max.spec.TekHVC.C) { - /* When the chroma input is equal to the maximum chroma */ - /* merely return the value for that chroma. */ - pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; - if (!_XcmsTekHVC_CheckModify (pColor)) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - } else if (pColor->spec.TekHVC.C > hvc_max.spec.TekHVC.C) { - /* When the chroma input is greater than the maximum chroma */ - /* merely return the value and chroma for the given hue. */ - pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; - pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; - return (XcmsFailure); - } else if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) { - /* When the value input is less than the maximum value point */ - /* compute the intersection of the line from 0,0 to max_V, max_C */ - /* using the chroma input. */ - pColor->spec.TekHVC.V = pColor->spec.TekHVC.C * - hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C; - if (pColor->spec.TekHVC.V >= hvc_max.spec.TekHVC.V) { - pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; - pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; - } - if (!_XcmsTekHVC_CheckModify (pColor)) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - } else { - /* When the value input is greater than the maximum value point */ - /* use HvcMaxValue to find the maximum value for the given chroma. */ - if (pColor->format != XcmsTekHVCFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsTekHVCQueryMaxV(&myCCC, - pColor->spec.TekHVC.H, - pColor->spec.TekHVC.C, - pColor) - == XcmsFailure) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - } - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/HVCGcVC.c b/nx-X11/lib/X11/HVCGcVC.c deleted file mode 100644 index 7ace5f13f..000000000 --- a/nx-X11/lib/X11/HVCGcVC.c +++ /dev/null @@ -1,262 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCGcVC.c - * - * DESCRIPTION - * Source for XcmsTekHVCClipVC() gamut - * compression function. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * INTERNALS - * Internal defines that need NOT be exported to any package or - * program using this package. - */ -#define MAXBISECTCOUNT 100 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCClipVC - Return the closest value and chroma - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsTekHVCClipVC ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * This routine will find the closest value and chroma - * for a specific hue. The color input is converted to - * HVC format and returned as CIE XYZ format. - * - * Since this routine works with the value within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - Status retval; - XcmsCCCRec myCCC; - XcmsColor *pColor; - XcmsColor hvc_max; - XcmsRGBi rgb_max; - int nCount, nMaxCount, nI, nILast; - XcmsFloat Chroma, Value, bestChroma, bestValue, nT, saveDist, tmpDist; - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white pt */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor && - FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { - /* - * GRAY ! - */ - _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, - 1, XcmsTekHVCFormat); - pColor->spec.TekHVC.H = pColor->spec.TekHVC.C = 0.0; - _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, - 1, XcmsCIEXYZFormat); - if (pCompressed) { - *(pCompressed + i) = True; - } - return(XcmsSuccess); - } else { - /* Convert from CIEXYZ to TekHVC format */ - if (_XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) - == XcmsFailure) { - return(XcmsFailure); - } - - if (!_XcmsTekHVC_CheckModify(pColor)) { - return (XcmsFailure); - } - - /* Step 1: compute the maximum value and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - memcpy((char *)&hvc_max, (char *)pColor, sizeof(XcmsColor)); - if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, - &rgb_max) == XcmsFailure) { - return (XcmsFailure); - } - - /* Now check and return the appropriate value */ - if (pColor->spec.TekHVC.V == hvc_max.spec.TekHVC.V) { - /* When the value input is equal to the maximum value */ - /* merely return the chroma for that value. */ - pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; - retval = _XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - } - - if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) { - /* return the intersection of the perpindicular line through */ - /* the value and chroma given and the line from 0,0 and hvc_max. */ - Chroma = pColor->spec.TekHVC.C; - Value = pColor->spec.TekHVC.V; - pColor->spec.TekHVC.C = - (Value + (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V * Chroma)) / - ((hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C) + - (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V)); - if (pColor->spec.TekHVC.C >= hvc_max.spec.TekHVC.C) { - pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; - pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; - } else { - pColor->spec.TekHVC.V = pColor->spec.TekHVC.C * - hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C; - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return (retval); - } - - /* return the closest point on the upper part of the hue leaf. */ - /* must do a bisection here to compute the delta e. */ - nMaxCount = MAXBISECTCOUNT; - nI = nMaxCount / 2; - bestValue = Value = pColor->spec.TekHVC.V; - bestChroma = Chroma = pColor->spec.TekHVC.C; - saveDist = (XcmsFloat) XCMS_SQRT ((double) (((Chroma - hvc_max.spec.TekHVC.C) * - (Chroma - hvc_max.spec.TekHVC.C)) + - ((Value - hvc_max.spec.TekHVC.V) * - (Value - hvc_max.spec.TekHVC.V)))); - for (nCount = 0; nCount < nMaxCount; nCount++) { - nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; - pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; - pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; - pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; - pColor->format = XcmsRGBiFormat; - - /* Convert from RGBi to HVC */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, - (Bool *) NULL) - == XcmsFailure) { - return (XcmsFailure); - } - if (!_XcmsTekHVC_CheckModify(pColor)) { - return (XcmsFailure); - } - tmpDist = (XcmsFloat) XCMS_SQRT ((double) - (((Chroma - pColor->spec.TekHVC.C) * - (Chroma - pColor->spec.TekHVC.C)) + - ((Value - pColor->spec.TekHVC.V) * - (Value - pColor->spec.TekHVC.V)))); - nILast = nI; - if (tmpDist > saveDist) { - nI /= 2; - } else { - nI = (nMaxCount + nI) / 2; - saveDist = tmpDist; - bestValue = pColor->spec.TekHVC.V; - bestChroma = pColor->spec.TekHVC.C; - } - if (nI == nILast || nI == 0) { - break; - } - - } - - if (bestChroma >= hvc_max.spec.TekHVC.C) { - pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; - pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; - } else { - pColor->spec.TekHVC.C = bestChroma; - pColor->spec.TekHVC.V = bestValue; - } - if (!_XcmsTekHVC_CheckModify(pColor)) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/HVCMnV.c b/nx-X11/lib/X11/HVCMnV.c deleted file mode 100644 index 10a9f857a..000000000 --- a/nx-X11/lib/X11/HVCMnV.c +++ /dev/null @@ -1,163 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCMnV.c - * - * DESCRIPTION - * Source for XcmsTekHVCQueryMinV gamut boundary querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - */ -#define EPS 0.001 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCQueryMinV - Compute minimum value for hue and chroma - * - * SYNOPSIS - */ -Status -XcmsTekHVCQueryMinV ( - XcmsCCC ccc, - XcmsFloat hue, - XcmsFloat chroma, - XcmsColor *pColor_return) - -/* - * DESCRIPTION - * Return the minimum value for a specific hue, and the - * corresponding chroma. The input color specification - * may be in any format, however output is in XcmsTekHVCFormat. - * - * Since this routine works with the value within - * pColor_return intermediate results may be returned - * even though it may be invalid. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded with no modifications - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor tmp; - XcmsColor max_vc; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white pt */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ - - tmp.spec.TekHVC.H = hue; - tmp.spec.TekHVC.V = 100.0; - tmp.spec.TekHVC.C = chroma; - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsTekHVCFormat; - - - /* Check for a valid HVC */ - if (!_XcmsTekHVC_CheckModify (&tmp)) { - return(XcmsFailure); - } - - /* Step 1: compute the maximum value and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); - if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, max_vc.spec.TekHVC.H, &max_vc, - (XcmsRGBi *)NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Step 2: find the intersection with the maximum hvc and chroma line. */ - if (tmp.spec.TekHVC.C > max_vc.spec.TekHVC.C + EPS) { - /* If the chroma is to large then return maximum hvc. */ - tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; - tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; - } else { - tmp.spec.TekHVC.V = tmp.spec.TekHVC.C * - max_vc.spec.TekHVC.V / max_vc.spec.TekHVC.C; - if (tmp.spec.TekHVC.V > max_vc.spec.TekHVC.V) { - tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; - } else if (tmp.spec.TekHVC.V < 0.0) { - tmp.spec.TekHVC.V = tmp.spec.TekHVC.C = 0.0; - } - } - if (_XcmsTekHVC_CheckModify (&tmp)) { - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } else { - return(XcmsFailure); - } -} diff --git a/nx-X11/lib/X11/HVCMxC.c b/nx-X11/lib/X11/HVCMxC.c deleted file mode 100644 index 074844ccc..000000000 --- a/nx-X11/lib/X11/HVCMxC.c +++ /dev/null @@ -1,243 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCMxC.c - * - * DESCRIPTION - * Source for the XcmsTekHVCQueryMaxC() gamut boudary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS 0.001 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCQueryMaxC - Compute the maximum chroma for a hue and value - * - * SYNOPSIS - */ -Status -XcmsTekHVCQueryMaxC( - XcmsCCC ccc, - XcmsFloat hue, - XcmsFloat value, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum chroma for a specific hue and value. - * The returned format is in XcmsTekHVCFormat. - * - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor tmp; - XcmsColor max_vc; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - XcmsFloat nValue, savedValue, lastValue, lastChroma, prevValue; - XcmsFloat maxDist, nT, rFactor; - XcmsFloat ftmp1, ftmp2; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; /* inherit screen white Pt */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ - - tmp.spec.TekHVC.H = hue; - tmp.spec.TekHVC.V = value; - tmp.spec.TekHVC.C = 100.0; - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsTekHVCFormat; - - /* check to make sure we have a valid TekHVC number */ - if (!_XcmsTekHVC_CheckModify(&tmp)) { - return(XcmsFailure); - } - - /* Step 1: compute the maximum value and chroma for this hue. */ - memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); - if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, hue, &max_vc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - /* Step 2: If the value is less than the value for the maximum */ - /* value, chroma point then the chroma is on the line */ - /* from max_vc to 0,0. */ - if (value <= max_vc.spec.TekHVC.V) { - tmp.spec.TekHVC.C = value - * max_vc.spec.TekHVC.C / max_vc.spec.TekHVC.V; - if (_XcmsTekHVC_CheckModify (&tmp)) { - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); - } else { - return(XcmsFailure); - } - } else { - /* must do a bisection here to compute the maximum chroma */ - /* save the structure input so that any elements that */ - /* are not touched are recopied later in the routine. */ - nValue = savedValue = value; - lastChroma = -1.0; - lastValue = -1.0; - nMaxCount = MAXBISECTCOUNT; - maxDist = 100.0 - max_vc.spec.TekHVC.V; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prevValue = lastValue; - lastValue = tmp.spec.TekHVC.V; - lastChroma = tmp.spec.TekHVC.C; - nT = (nValue - max_vc.spec.TekHVC.V) / maxDist * rFactor; - tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to HVC */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Now check the return against what is expected */ - if (tmp.spec.TekHVC.V <= savedValue + EPS && - tmp.spec.TekHVC.V >= savedValue - EPS) { - /* make sure to return the input hue */ - tmp.spec.TekHVC.H = hue; - if (_XcmsTekHVC_CheckModify (&tmp)) { - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); - } else { - return(XcmsFailure); - } - } - nValue += savedValue - tmp.spec.TekHVC.V; - if (nValue < max_vc.spec.TekHVC.V) { - nValue = max_vc.spec.TekHVC.V; - rFactor *= 0.5; /* selective relaxation employed */ - } else if (nValue > 100.0) { - /* make sure to return the input hue */ - tmp.spec.TekHVC.H = hue; - /* avoid using fabs */ - ftmp1 = lastValue - savedValue; - if (ftmp1 < 0.0) - ftmp1 = -ftmp1; - ftmp2 = tmp.spec.TekHVC.V - savedValue; - if (ftmp2 < 0.0) - ftmp2 = -ftmp2; - if (ftmp1 < ftmp2) { - tmp.spec.TekHVC.V = lastValue; - tmp.spec.TekHVC.C = lastChroma; - } - if (_XcmsTekHVC_CheckModify (&tmp)) { - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); - } else { - return(XcmsFailure); - } - } else if (tmp.spec.TekHVC.V <= prevValue + EPS && - tmp.spec.TekHVC.V >= prevValue - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - } - } - if (nCount >= nMaxCount) { - /* avoid using fabs */ - ftmp1 = lastValue - savedValue; - if (ftmp1 < 0.0) - ftmp1 = -ftmp1; - ftmp2 = tmp.spec.TekHVC.V - savedValue; - if (ftmp2 < 0.0) - ftmp2 = -ftmp2; - if (ftmp1 < ftmp2) { - tmp.spec.TekHVC.V = lastValue; - tmp.spec.TekHVC.C = lastChroma; - } - } - } - /* make sure to return the input hue */ - tmp.spec.TekHVC.H = hue; - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/HVCMxV.c b/nx-X11/lib/X11/HVCMxV.c deleted file mode 100644 index d5ef94ec5..000000000 --- a/nx-X11/lib/X11/HVCMxV.c +++ /dev/null @@ -1,247 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCMxV.c - * - * DESCRIPTION - * Source for the XcmsTekHVCQueryMaxV() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS 0.001 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCQueryMaxV - Compute maximum value for a hue and chroma - * - * SYNOPSIS - */ -Status -XcmsTekHVCQueryMaxV( - XcmsCCC ccc, - XcmsFloat hue, - XcmsFloat chroma, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum value for a specified hue and chroma. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded with no modifications - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor tmp; - XcmsColor max_vc; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - XcmsFloat nT, nChroma, savedChroma, lastValue, lastChroma, prevChroma; - XcmsFloat rFactor; - XcmsFloat ftmp1, ftmp2; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* setup the CCC to use for the conversions. */ - memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc) NULL; - - tmp.spec.TekHVC.H = hue; - tmp.spec.TekHVC.V = 0.0; - tmp.spec.TekHVC.C = chroma; - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsTekHVCFormat; - - if (!_XcmsTekHVC_CheckModify (&tmp)) { - return(XcmsFailure); - } - - /* Step 1: compute the maximum value and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); - hue = max_vc.spec.TekHVC.H; - if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, max_vc.spec.TekHVC.H, &max_vc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - if (max_vc.spec.TekHVC.C < tmp.spec.TekHVC.C) { - /* - * If the chroma is greater than the chroma for the - * maximum value/chroma point then the value is the - * the value for the maximum value, chroma point. - * This is an error but it I return the best approximation I can. - * Thus the inconsistency. - */ - tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; - tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } else if (max_vc.spec.TekHVC.C == tmp.spec.TekHVC.C) { - /* - * If the chroma is equal to the chroma for the - * maximum value/chroma point then the value is the - * the value for the maximum value, chroma point. - */ - tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } else { - /* must do a bisection here to compute the maximum value */ - /* save the structure input so that any elements that */ - /* are not touched are recopied later in the routine. */ - nChroma = savedChroma = tmp.spec.TekHVC.C; - tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; - tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; - lastChroma = -1.0; - lastValue = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prevChroma = lastChroma; - lastValue = tmp.spec.TekHVC.V; - lastChroma = tmp.spec.TekHVC.C; - nT = (1.0 - (nChroma / max_vc.spec.TekHVC.C)) * rFactor; - tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to HVC */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Now check the return against what is expected */ - if (tmp.spec.TekHVC.C <= savedChroma + EPS && - tmp.spec.TekHVC.C >= savedChroma - EPS) { - tmp.spec.TekHVC.H = hue; /* use the saved hue */ - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } - nChroma += savedChroma - tmp.spec.TekHVC.C; - if (nChroma > max_vc.spec.TekHVC.C) { - nChroma = max_vc.spec.TekHVC.C; - rFactor *= 0.5; /* selective relaxation employed */ - } else if (nChroma < 0.0) { - /* avoid using fabs */ - ftmp1 = lastChroma - savedChroma; - if (ftmp1 < 0.0) - ftmp1 = -ftmp1; - ftmp2 = tmp.spec.TekHVC.C - savedChroma; - if (ftmp2 < 0.0) - ftmp2 = -ftmp2; - if (ftmp1 < ftmp2) { - tmp.spec.TekHVC.V = lastValue; - tmp.spec.TekHVC.C = lastChroma; - } - /* make sure to return the input hue */ - tmp.spec.TekHVC.H = hue; - if (!_XcmsTekHVC_CheckModify(&tmp)) { - return(XcmsFailure); - } - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } else if (tmp.spec.TekHVC.C <= prevChroma + EPS && - tmp.spec.TekHVC.C >= prevChroma - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - } - } - if (nCount >= nMaxCount) { - /* avoid using fabs */ - ftmp1 = lastChroma - savedChroma; - if (ftmp1 < 0.0) - ftmp1 = -ftmp1; - ftmp2 = tmp.spec.TekHVC.C - savedChroma; - if (ftmp2 < 0.0) - ftmp2 = -ftmp2; - if (ftmp1 < ftmp2) { - tmp.spec.TekHVC.V = lastValue; - tmp.spec.TekHVC.C = lastChroma; - } - } - } - - /* make sure to return the input hue */ - tmp.spec.TekHVC.H = hue; - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/HVCMxVC.c b/nx-X11/lib/X11/HVCMxVC.c deleted file mode 100644 index c7e087866..000000000 --- a/nx-X11/lib/X11/HVCMxVC.c +++ /dev/null @@ -1,235 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCMxVC.c - * - * DESCRIPTION - * Source for the XcmsTekHVCQueryMaxVC() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - */ -#define MIN(x,y) ((x) > (y) ? (y) : (x)) -#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) -#define START_V 40.0 -#define START_C 120.0 - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsTekHVCQueryMaxVCRGB - Compute maximum value/chroma. - * - * SYNOPSIS - */ -Status -_XcmsTekHVCQueryMaxVCRGB( - XcmsCCC ccc, - XcmsFloat hue, - XcmsColor *pColor_return, - XcmsRGBi *pRGB_return) - -/* - * DESCRIPTION - * Return the maximum chroma for a specified hue, and the - * corresponding value. This is computed by a binary search of - * all possible chromas. An assumption is made that there are - * no local maxima. Use the unrounded Max Chroma because - * the difference check can be small. - * - * NOTE: No local CCC is used because this is a private - * routine and all routines that call it are expected - * to behave properly, i.e. send a local CCC with - * no white adjust function and no gamut compression - * function. - * - * This routine only accepts hue as input and outputs - * HVC's and RGBi's. - * - * RETURNS - * XcmsFailure - Failure - * XCMS_SUCCUSS - Succeeded - * - */ -{ - XcmsFloat nSmall, nLarge; - XcmsColor tmp; - - tmp.format = XcmsTekHVCFormat; - tmp.spec.TekHVC.H = hue; - /* Use some unreachable color on the given hue */ - tmp.spec.TekHVC.V = START_V; - tmp.spec.TekHVC.C = START_C; - - - /* - * Convert from HVC to RGB - * - * Note that the CIEXYZ to RGBi conversion routine must stuff the - * out of bounds RGBi values in tmp when the ccc->gamutCompProc - * is NULL. - */ - if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsRGBiFormat, (Bool *) NULL) - == XcmsFailure) && tmp.format != XcmsRGBiFormat) { - return (XcmsFailure); - } - - /* Now pick the smallest RGB */ - nSmall = MIN3(tmp.spec.RGBi.red, - tmp.spec.RGBi.green, - tmp.spec.RGBi.blue); - /* Make the smallest RGB equal to zero */ - tmp.spec.RGBi.red -= nSmall; - tmp.spec.RGBi.green -= nSmall; - tmp.spec.RGBi.blue -= nSmall; - - /* Now pick the largest RGB */ - nLarge = MAX3(tmp.spec.RGBi.red, - tmp.spec.RGBi.green, - tmp.spec.RGBi.blue); - /* Scale the RGB values based on the largest one */ - tmp.spec.RGBi.red /= nLarge; - tmp.spec.RGBi.green /= nLarge; - tmp.spec.RGBi.blue /= nLarge; - tmp.format = XcmsRGBiFormat; - - /* If the calling routine wants RGB value give them the ones used. */ - if (pRGB_return) { - pRGB_return->red = tmp.spec.RGBi.red; - pRGB_return->green = tmp.spec.RGBi.green; - pRGB_return->blue = tmp.spec.RGBi.blue; - } - - /* Convert from RGBi to HVC */ - if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) - == XcmsFailure) { - return (XcmsFailure); - } - - /* make sure to return the input hue */ - tmp.spec.TekHVC.H = hue; - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return (XcmsSuccess); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCQueryMaxVC - Compute maximum value and chroma. - * - * SYNOPSIS - */ -Status -XcmsTekHVCQueryMaxVC ( - XcmsCCC ccc, - XcmsFloat hue, - XcmsColor *pColor_return) - -/* - * DESCRIPTION - * Return the maximum chroma for the specified hue, and the - * corresponding value. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc)NULL; - - while (hue < 0.0) { - hue += 360.0; - } - while (hue >= 360.0) { - hue -= 360.0; - } - - return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return, - (XcmsRGBi *)NULL)); -} diff --git a/nx-X11/lib/X11/HVCMxVs.c b/nx-X11/lib/X11/HVCMxVs.c deleted file mode 100644 index 540e5c2f4..000000000 --- a/nx-X11/lib/X11/HVCMxVs.c +++ /dev/null @@ -1,161 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * TekHVCMxVs.c - * - * DESCRIPTION - * Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary - * querying routine. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCQueryMaxVSamples - Compute a set of value/chroma - * pairs. - * - * SYNOPSIS - */ -Status -XcmsTekHVCQueryMaxVSamples( - XcmsCCC ccc, - XcmsFloat hue, - XcmsColor *pColor_in_out, - unsigned int nSamples) - -/* - * DESCRIPTION - * Return a set of values and chromas for the input Hue. - * This routine will take any color as input. - * It returns TekHVC colors. - * - * Since this routine works with the value within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor *pHVC; - XcmsRGBi rgb_saved; - unsigned short nI; - XcmsFloat nT; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_in_out == NULL || nSamples == 0) { - return(XcmsFailure); - } - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* setup the CCC to use for the conversions. */ - memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc) NULL; - - /* Step 1: compute the maximum value and chroma for this hue. */ - - - /* save the Hue for use later. */ - while (hue < 0.0) { - hue += 360.0; - } - while (hue > 360.0) { - hue -= 360.0; - } - pColor_in_out->spec.TekHVC.H = hue; - pColor_in_out->format = XcmsTekHVCFormat; - - /* Get the maximum value and chroma point for this hue */ - if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, pColor_in_out->spec.TekHVC.H, - pColor_in_out, (XcmsRGBi *)&rgb_saved) == XcmsFailure) { - return (XcmsFailure); - } - - /* Step 2: Convert each of the RGBi's to HVC's */ - pHVC = pColor_in_out; - for (nI = 0; nI < nSamples; nI++, pHVC++) { - nT = (XcmsFloat) nI / (XcmsFloat) nSamples; - pHVC->spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - pHVC->spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - pHVC->spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - pHVC->format = XcmsRGBiFormat; - pHVC->pixel = pColor_in_out->pixel; - /* convert from RGB to HVC */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, pHVC, - &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* make sure to return the input hue */ - pHVC->spec.TekHVC.H = hue; - } - - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/HVCWpAj.c b/nx-X11/lib/X11/HVCWpAj.c deleted file mode 100644 index dcefe7535..000000000 --- a/nx-X11/lib/X11/HVCWpAj.c +++ /dev/null @@ -1,114 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. TekColor is a - * trademark of Tektronix, Inc. The term "TekHVC" designates a particular - * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent - * foreign patents pending). Permission is hereby granted to use, copy, - * modify, sell, and otherwise distribute this software and its - * documentation for any purpose and without fee, provided that: - * - * 1. This copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and any modification thereof and in - * supporting documentation; - * 2. Any color-handling application which displays TekHVC color - * cooordinates identifies these as TekHVC color coordinates in any - * interface that displays these coordinates and in any associated - * documentation; - * 3. The term "TekHVC" is always used, and is only used, in association - * with the mathematical derivations of the TekHVC Color Space, - * including those provided in this file and any equivalent pathways and - * mathematical derivations, regardless of digital (e.g., floating point - * or integer) representation. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * DESCRIPTION - * TekHVCWpAj.c - * - * DESCRIPTION - * This file contains routine(s) that support white point - * adjustment of color specifications in the TekHVC color - * space. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsTekHVCWhiteShiftColors - * - * SYNOPSIS - */ -Status -XcmsTekHVCWhiteShiftColors( - XcmsCCC ccc, - XcmsColor *pWhitePtFrom, - XcmsColor *pWhitePtTo, - XcmsColorFormat destSpecFmt, - XcmsColor *pColors_in_out, - unsigned int nColors, - Bool *pCompressed) -/* - * DESCRIPTION - * Convert color specifications in an array of XcmsColor structures - * for differences in white points. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression, - * XcmsSuccessWithCompression if succeeded with - * gamut compression. - */ -{ - if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Insure TekHVC installed - */ - if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Convert to TekHVC using pWhitePtFrom - * We can ignore return value for compression because we are converting - * to XcmsTekHVCFormat which is device-independent, not device-dependent. - */ - if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, - nColors, XcmsTekHVCFormat, pCompressed) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Convert from TekHVC to destSpecFmt using pWhitePtTo - */ - return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, - nColors, destSpecFmt, pCompressed)); -} diff --git a/nx-X11/lib/X11/Host.c b/nx-X11/lib/X11/Host.c deleted file mode 100644 index b07c9c312..000000000 --- a/nx-X11/lib/X11/Host.c +++ /dev/null @@ -1,144 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -of the copyright holder. - -X Window System is a trademark of The Open Group. - -*/ - -/* - * Copyright 2004 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -/* this might be rightly regarded an os dependent file */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -static inline int -changehost (Display *dpy, XHostAddress *host, BYTE mode) -{ - xChangeHostsReq *req; - int length; - XServerInterpretedAddress *siAddr; - int addrlen; - - siAddr = host->family == FamilyServerInterpreted ? - (XServerInterpretedAddress *)host->address : NULL; - addrlen = siAddr ? - siAddr->typelength + siAddr->valuelength + 1 : host->length; - - length = (addrlen + 3) & ~0x3; /* round up */ - - LockDisplay(dpy); - GetReqExtra (ChangeHosts, length, req); - if (!req) { - UnlockDisplay(dpy); - return 0; - } - req->mode = mode; - req->hostFamily = host->family; - req->hostLength = addrlen; - if (siAddr) { - char *dest = (char *) NEXTPTR(req,xChangeHostsReq); - memcpy(dest, siAddr->type, siAddr->typelength); - dest[siAddr->typelength] = '\0'; - memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength); - } else { - memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen); - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XAddHost ( - register Display *dpy, - XHostAddress *host) -{ - return changehost(dpy, host, HostInsert); -} - -int -XRemoveHost ( - register Display *dpy, - XHostAddress *host) -{ - return changehost(dpy, host, HostDelete); -} - -int -XAddHosts ( - register Display *dpy, - XHostAddress *hosts, - int n) -{ - register int i; - for (i = 0; i < n; i++) { - (void) XAddHost(dpy, &hosts[i]); - } - return 1; -} - -int -XRemoveHosts ( - register Display *dpy, - XHostAddress *hosts, - int n) -{ - register int i; - for (i = 0; i < n; i++) { - (void) XRemoveHost(dpy, &hosts[i]); - } - return 1; -} diff --git a/nx-X11/lib/X11/ICWrap.c b/nx-X11/lib/X11/ICWrap.c deleted file mode 100644 index 69f080d87..000000000 --- a/nx-X11/lib/X11/ICWrap.c +++ /dev/null @@ -1,432 +0,0 @@ -/* - * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, - * and Nippon Telegraph and Telephone Corporation - * Copyright 1991 by the Open Software Foundation - * Copyright 1993 by the FUJITSU LIMITED - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 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, - * 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 - * SHALL OMRON, NTT SOFTWARE, NTT, OR OPEN SOFTWARE FOUNDATION 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. - * - * Authors: Li Yuhong OMRON Corporation - * Tatsuya Kato NTT Software Corporation - * Hiroshi Kuribayashi OMRON Coproration - * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. - * - * M. Collins OSF - * Takashi Fujiwara FUJITSU LIMITED - */ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -static int -_XIMNestedListToNestedList( - XIMArg *nlist, /* This is the new list */ - XIMArg *list) /* The original list */ -{ - register XIMArg *ptr = list; - - while (ptr->name) { - if (!strcmp(ptr->name, XNVaNestedList)) { - nlist += _XIMNestedListToNestedList(nlist, (XIMArg *)ptr->value); - } else { - nlist->name = ptr->name; - nlist->value = ptr->value; - ptr++; - nlist++; - } - } - return ptr - list; -} - -static void -_XIMCountNestedList( - XIMArg *args, - int *total_count) -{ - for (; args->name; args++) { - if (!strcmp(args->name, XNVaNestedList)) - _XIMCountNestedList((XIMArg *)args->value, total_count); - else - ++(*total_count); - } -} - -static void -_XIMCountVaList(va_list var, int *total_count) -{ - char *attr; - - *total_count = 0; - - for (attr = va_arg(var, char*); attr; attr = va_arg(var, char*)) { - if (!strcmp(attr, XNVaNestedList)) { - _XIMCountNestedList(va_arg(var, XIMArg*), total_count); - } else { - (void)va_arg(var, XIMArg*); - ++(*total_count); - } - } -} - -static void -_XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return) -{ - XIMArg *args; - char *attr; - - if (max_count <= 0) { - *args_return = (XIMArg *)NULL; - return; - } - - args = Xmalloc(((unsigned)max_count + 1) * sizeof(XIMArg)); - *args_return = args; - if (!args) return; - - for (attr = va_arg(var, char*); attr; attr = va_arg(var, char*)) { - if (!strcmp(attr, XNVaNestedList)) { - args += _XIMNestedListToNestedList(args, va_arg(var, XIMArg*)); - } else { - args->name = attr; - args->value = va_arg(var, XPointer); - args++; - } - } - args->name = (char*)NULL; -} - -/*ARGSUSED*/ -XVaNestedList -XVaCreateNestedList(int dummy, ...) -{ - va_list var; - XIMArg *args = NULL; - int total_count; - - va_start(var, dummy); - _XIMCountVaList(var, &total_count); - va_end(var); - - va_start(var, dummy); - _XIMVaToNestedList(var, total_count, &args); - va_end(var); - - return (XVaNestedList)args; -} - -char * -XSetIMValues(XIM im, ...) -{ - va_list var; - int total_count; - XIMArg *args; - char *ret = NULL; - - /* - * so count the stuff dangling here - */ - va_start(var, im); - _XIMCountVaList(var, &total_count); - va_end(var); - - /* - * now package it up so we can send it along - */ - va_start(var, im); - _XIMVaToNestedList(var, total_count, &args); - va_end(var); - - if (im && im->methods) - ret = (*im->methods->set_values) (im, args); - Xfree(args); - return ret; -} - -char * -XGetIMValues(XIM im, ...) -{ - va_list var; - int total_count; - XIMArg *args; - char *ret = NULL; - - /* - * so count the stuff dangling here - */ - va_start(var, im); - _XIMCountVaList(var, &total_count); - va_end(var); - - /* - * now package it up so we can send it along - */ - va_start(var, im); - _XIMVaToNestedList(var, total_count, &args); - va_end(var); - - if (im && im->methods) - ret = (*im->methods->get_values) (im, args); - Xfree(args); - return ret; -} - -/* - * Create an input context within the input method, - * and return a pointer to the input context. - */ - -XIC -XCreateIC(XIM im, ...) -{ - va_list var; - int total_count; - XIMArg *args; - XIC ic = NULL; - - /* - * so count the stuff dangling here - */ - va_start(var, im); - _XIMCountVaList(var, &total_count); - va_end(var); - - /* - * now package it up so we can send it along - */ - va_start(var, im); - _XIMVaToNestedList(var, total_count, &args); - va_end(var); - - if (im && im->methods) - ic = (XIC) (*im->methods->create_ic) (im, args); - Xfree(args); - if (ic) { - ic->core.next = im->core.ic_chain; - im->core.ic_chain = ic; - } - return ic; -} - -/* - * Free the input context. - */ -void -XDestroyIC(XIC ic) -{ - XIM im = ic->core.im; - XIC *prev; - - (*ic->methods->destroy) (ic); - if (im) { - for (prev = &im->core.ic_chain; *prev; prev = &(*prev)->core.next) { - if (*prev == ic) { - *prev = ic->core.next; - break; - } - } - } - Xfree (ic); -} - -char * -XGetICValues(XIC ic, ...) -{ - va_list var; - int total_count; - XIMArg *args; - char *ret; - - if (!ic->core.im) - return (char *) NULL; - - /* - * so count the stuff dangling here - */ - va_start(var, ic); - _XIMCountVaList(var, &total_count); - va_end(var); - - /* - * now package it up so we can send it along - */ - va_start(var, ic); - _XIMVaToNestedList(var, total_count, &args); - va_end(var); - - ret = (*ic->methods->get_values) (ic, args); - Xfree(args); - return ret; -} - -char * -XSetICValues(XIC ic, ...) -{ - va_list var; - int total_count; - XIMArg *args; - char *ret; - - if (!ic->core.im) - return (char *) NULL; - - /* - * so count the stuff dangling here - */ - va_start(var, ic); - _XIMCountVaList(var, &total_count); - va_end(var); - - /* - * now package it up so we can send it along - */ - va_start(var, ic); - _XIMVaToNestedList(var, total_count, &args); - va_end(var); - - ret = (*ic->methods->set_values) (ic, args); - Xfree(args); - return ret; -} - -/* - * Require the input manager to focus the focus window attached to the ic - * argument. - */ -void -XSetICFocus(XIC ic) -{ - if (ic && ic->core.im) - (*ic->methods->set_focus) (ic); -} - -/* - * Require the input manager to unfocus the focus window attached to the ic - * argument. - */ -void -XUnsetICFocus(XIC ic) -{ - if (ic->core.im) - (*ic->methods->unset_focus) (ic); -} - -/* - * Return the XIM associated with the input context. - */ -XIM -XIMOfIC(XIC ic) -{ - return ic->core.im; -} - -char * -XmbResetIC(XIC ic) -{ - if (ic->core.im) - return (*ic->methods->mb_reset)(ic); - return (char *)NULL; -} - -wchar_t * -XwcResetIC(XIC ic) -{ - if (ic->core.im) - return (*ic->methods->wc_reset)(ic); - return (wchar_t *)NULL; -} - -char * -Xutf8ResetIC(XIC ic) -{ - if (ic->core.im) { - if (ic->methods->utf8_reset) - return (*ic->methods->utf8_reset)(ic); - else if (ic->methods->mb_reset) - return (*ic->methods->mb_reset)(ic); - } - return (char *)NULL; -} - -int -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, - keysym, status); - return XLookupNone; -} - -int -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, - keysym, status); - return XLookupNone; -} - -int -Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, - KeySym *keysym, Status *status) -{ - if (ic->core.im) { - if (ic->methods->utf8_lookup_string) - return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes, - keysym, status); - else if (ic->methods->mb_lookup_string) - return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes, - keysym, status); - } - return XLookupNone; -} diff --git a/nx-X11/lib/X11/IMWrap.c b/nx-X11/lib/X11/IMWrap.c deleted file mode 100644 index a7c1d98c1..000000000 --- a/nx-X11/lib/X11/IMWrap.c +++ /dev/null @@ -1,204 +0,0 @@ -/* - * Copyright 1991 by the Open Software Foundation - * Copyright 1993, 1994 by the Sony Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 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. - * It is provided "as is" without express or implied warranty. - * - * 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 OPEN - * SOFTWARE FOUNDATIONN 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 OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * M. Collins OSF - * Makoto Wakamatsu Sony Corporation - */ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -/* - * Compile the resource name. (resource_name ---> xrm_name) - */ -void -_XIMCompileResourceList(XIMResourceList res, unsigned int num_res) -{ - register unsigned int count; - - for (count = 0; count < num_res; res++, count++) { - res->xrm_name = XrmStringToQuark(res->resource_name); - } -} - -void -_XCopyToArg(XPointer src, XPointer *dst, unsigned int size) -{ - if (!*dst) { - union { - long longval; -#ifdef LONG64 - int intval; -#endif - short shortval; - char charval; - char* charptr; - XPointer ptr; - } u; - if (size <= sizeof(XPointer)) { - memcpy((char *)&u, (char *)src, (int)size); - if (size == sizeof(long)) *dst = (XPointer)u.longval; -#ifdef LONG64 - else if (size == sizeof(int)) *dst = (XPointer)(long)u.intval; -#endif - else if (size == sizeof(short)) *dst = (XPointer)(long)u.shortval; - else if (size == sizeof(char)) *dst = (XPointer)(long)u.charval; - else if (size == sizeof(char*)) *dst = (XPointer)u.charptr; - else if (size == sizeof(XPointer)) *dst = (XPointer)u.ptr; - else memcpy( (char*)dst, (char*)src, (int)size ); - } else { - memcpy( (char*)dst, (char*)src, (int)size ); - } - } else { - memcpy( (char*)*dst, (char*)src, (int)size ); - } -} - -/* - * Connects to an input method matching current locale specification, creates - * a XIM object and return a pointer the newly created XIM back to the caller. - */ - -XIM -XOpenIM(Display *display, XrmDatabase rdb, char *res_name, char *res_class) -{ - XLCd lcd = _XOpenLC( (char *)NULL ); - - if( !lcd ) - return( (XIM)NULL ); - return (*lcd->methods->open_im) (lcd, display, rdb, res_name, res_class); -} - -/* - * Close the connection to the input manager, and free the XIM structure - */ -Status -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; - Xfree (im); - _XCloseLC (lcd); - return (s); -} - -/* - * Return the Display associated with the input method. - */ -Display * -XDisplayOfIM(XIM im) -{ - return im->core.display; -} - -/* - * Return the Locale associated with the input method. - */ -char * -XLocaleOfIM(XIM im) -{ - return im->core.lcd->core->name; -} - -/* - * Register to a input method instantiation callback to prepare the - * on-demand input method instantiation. - */ -Bool -XRegisterIMInstantiateCallback( - Display *display, - XrmDatabase rdb, - char *res_name, - char *res_class, - XIDProc callback, - XPointer client_data) -{ - XLCd lcd = _XOpenLC( (char *)NULL ); - - if( !lcd ) - return( False ); - return( (*lcd->methods->register_callback)( lcd, display, rdb, res_name, - res_class, callback, - client_data ) ); -} - -/* - * Unregister to a input method instantiation callback. - */ -Bool -XUnregisterIMInstantiateCallback( - Display *display, - XrmDatabase rdb, - char *res_name, - char *res_class, - XIDProc callback, - XPointer client_data) -{ - XLCd lcd = _XlcCurrentLC(); - - if( !lcd ) - return( False ); - if( lcd->methods->unregister_callback == NULL ) - return( False ); - return( (*lcd->methods->unregister_callback)( lcd, display, rdb, res_name, - res_class, callback, - client_data ) ); -} - diff --git a/nx-X11/lib/X11/Iconify.c b/nx-X11/lib/X11/Iconify.c deleted file mode 100644 index 542f5885c..000000000 --- a/nx-X11/lib/X11/Iconify.c +++ /dev/null @@ -1,89 +0,0 @@ - -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. - - All Rights Reserved - -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 -supporting documentation, and that the name Wyse not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -/* - * This function instructs the window manager to change this window from - * NormalState to IconicState. - */ -Status XIconifyWindow ( - Display *dpy, - Window w, - int screen) -{ - Atom prop; - - prop = XInternAtom (dpy, "WM_CHANGE_STATE", False); - if (prop == None) - return False; - else { - XClientMessageEvent ev = { - .type = ClientMessage, - .window = w, - .message_type = prop, - .format = 32, - .data.l[0] = IconicState - }; - Window root = RootWindow (dpy, screen); - - return (XSendEvent (dpy, root, False, - SubstructureRedirectMask|SubstructureNotifyMask, - (XEvent *)&ev)); - } -} diff --git a/nx-X11/lib/X11/IdOfPr.c b/nx-X11/lib/X11/IdOfPr.c deleted file mode 100644 index 9f43dd387..000000000 --- a/nx-X11/lib/X11/IdOfPr.c +++ /dev/null @@ -1,106 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsIdOfPr.c - * - * DESCRIPTION - * Source for XcmsFormatOfPrefix() - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/* - * NAME - * XcmsFormatOfPrefix - * - * SYNOPSIS - */ -XcmsColorFormat -XcmsFormatOfPrefix(char *prefix) -/* - * DESCRIPTION - * Returns the Color Space ID for the specified prefix - * if the color space is found in the Color Conversion - * Context. - * - * RETURNS - * Color Space ID if found; zero otherwise. - */ -{ - XcmsColorSpace **papColorSpaces; - char string_buf[64]; - char *string_lowered; - size_t len; - - /* - * While copying prefix to string_lowered, convert to lowercase - */ - if ((len = strlen(prefix)) >= sizeof(string_buf)) { - string_lowered = Xmalloc(len+1); - } else { - string_lowered = string_buf; - } - _XcmsCopyISOLatin1Lowered(string_lowered, prefix); - - /* - * First try Device-Independent color spaces - */ - papColorSpaces = _XcmsDIColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) { - if (len >= sizeof(string_buf)) Xfree(string_lowered); - return((*papColorSpaces)->id); - } - papColorSpaces++; - } - } - - /* - * Next try Device-Dependent color spaces - */ - papColorSpaces = _XcmsDDColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) { - if (len >= sizeof(string_buf)) Xfree(string_lowered); - return((*papColorSpaces)->id); - } - papColorSpaces++; - } - } - - if (len >= sizeof(string_buf)) Xfree(string_lowered); - return(XcmsUndefinedFormat); -} diff --git a/nx-X11/lib/X11/IfEvent.c b/nx-X11/lib/X11/IfEvent.c deleted file mode 100644 index 1a5eef7ce..000000000 --- a/nx-X11/lib/X11/IfEvent.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Flush output and (wait for and) return the next event matching the - * predicate in the queue. - */ - -int -XIfEvent ( - register Display *dpy, - register XEvent *event, - Bool (*predicate)( - Display* /* display */, - XEvent* /* event */, - char* /* arg */ - ), /* function to call */ - char *arg) -{ - register _XQEvent *qelt, *prev; - unsigned long qe_serial = 0; - - LockDisplay(dpy); - prev = NULL; - while (1) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if(qelt->qserial_num > qe_serial - && (*predicate)(dpy, &qelt->event, arg)) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - _XStoreEventCookie(dpy, event); - UnlockDisplay(dpy); - return 0; - } - } - if (prev) - qe_serial = prev->qserial_num; - _XReadEvents(dpy); - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockDisplay(dpy); - return 0; - } -#endif - } -} diff --git a/nx-X11/lib/X11/ImText.c b/nx-X11/lib/X11/ImText.c deleted file mode 100644 index c12f26854..000000000 --- a/nx-X11/lib/X11/ImText.c +++ /dev/null @@ -1,101 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawImageString( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, - _Xconst char *string, - int length) -{ - register xImageText8Req *req; - char *CharacterOffset = (char *)string; - int FirstTimeThrough = True; - int lastX = 0; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - while (length > 0) - { - int Unit; - - if (length > 255) Unit = 255; - else Unit = length; - - if (FirstTimeThrough) - { - FirstTimeThrough = False; - } - else - { - char buf[512]; - char *ptr, *str; - xQueryTextExtentsReq *qreq; - xQueryTextExtentsReply rep; - int i; - - GetReq(QueryTextExtents, qreq); - qreq->fid = gc->gid; - qreq->length += (510 + 3)>>2; - qreq->oddLength = 1; - str = CharacterOffset - 255; - for (ptr = buf, i = 255; --i >= 0; ) { - *ptr++ = 0; - *ptr++ = *str++; - } - Data (dpy, buf, 510); - if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) - break; - - x = lastX + cvtINT32toInt (rep.overallWidth); - } - - GetReq (ImageText8, req); - req->length += (Unit + 3) >> 2; - req->nChars = Unit; - req->drawable = d; - req->gc = gc->gid; - req->y = y; - - lastX = req->x = x; - Data (dpy, CharacterOffset, (long)Unit); - CharacterOffset += Unit; - length -= Unit; - } - UnlockDisplay(dpy); - SyncHandle(); - return 0; -} - diff --git a/nx-X11/lib/X11/ImText16.c b/nx-X11/lib/X11/ImText16.c deleted file mode 100644 index b0b60710c..000000000 --- a/nx-X11/lib/X11/ImText16.c +++ /dev/null @@ -1,103 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawImageString16( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, - _Xconst XChar2b *string, - int length) -{ - register xImageText16Req *req; - XChar2b *CharacterOffset = (XChar2b *)string; - int FirstTimeThrough = True; - int lastX = 0; - - LockDisplay(dpy); - FlushGC(dpy, gc); - - while (length > 0) - { - int Unit, Datalength; - - if (length > 255) Unit = 255; - else Unit = length; - - if (FirstTimeThrough) - { - FirstTimeThrough = False; - } - else - { - char buf[512]; - xQueryTextExtentsReq *qreq; - xQueryTextExtentsReply rep; - unsigned char *ptr; - XChar2b *str; - int i; - - GetReq(QueryTextExtents, qreq); - qreq->fid = gc->gid; - qreq->length += (510 + 3)>>2; - qreq->oddLength = 1; - str = CharacterOffset - 255; - for (ptr = (unsigned char *)buf, i = 255; --i >= 0; str++) { - *ptr++ = str->byte1; - *ptr++ = str->byte2; - } - Data (dpy, buf, 510); - if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) - break; - - x = lastX + cvtINT32toInt (rep.overallWidth); - } - - GetReq (ImageText16, req); - req->length += ((Unit << 1) + 3) >> 2; - req->nChars = Unit; - req->drawable = d; - req->gc = gc->gid; - req->y = y; - - lastX = req->x = x; - Datalength = Unit << 1; - Data (dpy, (char *)CharacterOffset, (long)Datalength); - CharacterOffset += Unit; - length -= Unit; - } - UnlockDisplay(dpy); - SyncHandle(); - return 0; -} - diff --git a/nx-X11/lib/X11/ImUtil.c b/nx-X11/lib/X11/ImUtil.c deleted file mode 100644 index 79ba80ecc..000000000 --- a/nx-X11/lib/X11/ImUtil.c +++ /dev/null @@ -1,1013 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "ImUtil.h" - -static int _XDestroyImage(XImage *); -static unsigned long _XGetPixel(XImage *, int, int); -static unsigned long _XGetPixel1(XImage *, int, int); -static unsigned long _XGetPixel8(XImage *, int, int); -static unsigned long _XGetPixel16(XImage *, int, int); -static unsigned long _XGetPixel32(XImage *, int, int); -static int _XPutPixel(XImage *, int, int, unsigned long); -static int _XPutPixel1(XImage *, int, int, unsigned long); -static int _XPutPixel8(XImage *, int, int, unsigned long); -static int _XPutPixel16(XImage *, int, int, unsigned long); -static int _XPutPixel32(XImage *, int, int, unsigned long); -static XImage *_XSubImage(XImage *, int, int, unsigned int, unsigned int); -static int _XAddPixel(XImage *, long); - -static unsigned char const _lomask[0x09] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; -static unsigned char const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00 }; - -/* These two convenience routines return the scanline_pad and bits_per_pixel - associated with a specific depth of ZPixmap format image for a - display. */ - -int -_XGetScanlinePad( - Display *dpy, - int depth) - { - register ScreenFormat *fmt = dpy->pixmap_format; - register int i; - - for (i = dpy->nformats + 1; --i; ++fmt) - if (fmt->depth == depth) - return(fmt->scanline_pad); - - return(dpy->bitmap_pad); - } - -int -_XGetBitsPerPixel( - Display *dpy, - int depth) - { - register ScreenFormat *fmt = dpy->pixmap_format; - register int i; - - for (i = dpy->nformats + 1; --i; ++fmt) - if (fmt->depth == depth) - return(fmt->bits_per_pixel); - if (depth <= 4) - return 4; - if (depth <= 8) - return 8; - if (depth <= 16) - return 16; - return 32; - } - - -/* - * This module provides rudimentary manipulation routines for image data - * structures. The functions provided are: - * - * XCreateImage Creates a default XImage data structure - * _XDestroyImage Deletes an XImage data structure - * _XGetPixel Reads a pixel from an image data structure - * _XGetPixel32 Reads a pixel from a 32-bit Z image data structure - * _XGetPixel16 Reads a pixel from a 16-bit Z image data structure - * _XGetPixel8 Reads a pixel from an 8-bit Z image data structure - * _XGetPixel1 Reads a pixel from an 1-bit image data structure - * _XPutPixel Writes a pixel into an image data structure - * _XPutPixel32 Writes a pixel into a 32-bit Z image data structure - * _XPutPixel16 Writes a pixel into a 16-bit Z image data structure - * _XPutPixel8 Writes a pixel into an 8-bit Z image data structure - * _XPutPixel1 Writes a pixel into an 1-bit image data structure - * _XSubImage Clones a new (sub)image from an existing one - * _XSetImage Writes an image data pattern into another image - * _XAddPixel Adds a constant value to every pixel in an image - * - * The logic contained in these routines makes several assumptions about - * the image data structures, and at least for current implementations - * these assumptions are believed to be true. They are: - * - * For all formats, bits_per_pixel is less than or equal to 32. - * For XY formats, bitmap_unit is always less than or equal to bitmap_pad. - * For XY formats, bitmap_unit is 8, 16, or 32 bits. - * For Z format, bits_per_pixel is 1, 4, 8, 16, 24, or 32 bits. - */ -static void _xynormalizeimagebits ( - register unsigned char *bp, - register XImage *img) -{ - register unsigned char c; - - if (img->byte_order != img->bitmap_bit_order) { - switch (img->bitmap_unit) { - - case 16: - c = *bp; - *bp = *(bp + 1); - *(bp + 1) = c; - break; - - case 32: - c = *(bp + 3); - *(bp + 3) = *bp; - *bp = c; - c = *(bp + 2); - *(bp + 2) = *(bp + 1); - *(bp + 1) = c; - break; - } - } - if (img->bitmap_bit_order == MSBFirst) - _XReverse_Bytes (bp, img->bitmap_unit >> 3); -} - -static void _znormalizeimagebits ( - register unsigned char *bp, - register XImage *img) -{ - register unsigned char c; - switch (img->bits_per_pixel) { - - case 4: - *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF); - break; - - case 16: - c = *bp; - *bp = *(bp + 1); - *(bp + 1) = c; - break; - - case 24: - c = *(bp + 2); - *(bp + 2) = *bp; - *bp = c; - break; - - case 32: - c = *(bp + 3); - *(bp + 3) = *bp; - *bp = c; - c = *(bp + 2); - *(bp + 2) = *(bp + 1); - *(bp + 1) = c; - break; - } -} - -static void _putbits( - register char *src, /* address of source bit string */ - int dstoffset, /* bit offset into destination; range is 0-31 */ - register int numbits,/* number of bits to copy to destination */ - register char *dst) /* address of destination bit string */ -{ - register unsigned char chlo, chhi; - int hibits; - dst = dst + (dstoffset >> 3); - dstoffset = dstoffset & 7; - hibits = 8 - dstoffset; - chlo = *dst & _lomask[dstoffset]; - for (;;) { - chhi = (*src << dstoffset) & _himask[dstoffset]; - if (numbits <= hibits) { - chhi = chhi & _lomask[dstoffset + numbits]; - *dst = (*dst & _himask[dstoffset + numbits]) | chlo | chhi; - break; - } - *dst = chhi | chlo; - dst++; - numbits = numbits - hibits; - chlo = (unsigned char) (*src & _himask[hibits]) >> hibits; - src++; - if (numbits <= dstoffset) { - chlo = chlo & _lomask[numbits]; - *dst = (*dst & _himask[numbits]) | chlo; - break; - } - numbits = numbits - dstoffset; - } -} - - -/* - * Macros - * - * The ROUNDUP macro rounds up a quantity to the specified boundary, - * then truncates to bytes. - * - * The XYNORMALIZE macro determines whether XY format data requires - * normalization and calls a routine to do so if needed. The logic in - * this module is designed for LSBFirst byte and bit order, so - * normalization is done as required to present the data in this order. - * - * The ZNORMALIZE macro performs byte and nibble order normalization if - * required for Z format data. - * - * The XYINDEX macro computes the index to the starting byte (char) boundary - * for a bitmap_unit containing a pixel with coordinates x and y for image - * data in XY format. - * - * The ZINDEX macro computes the index to the starting byte (char) boundary - * for a pixel with coordinates x and y for image data in ZPixmap format. - * - */ - -#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) - -#define XYNORMALIZE(bp, img) \ - if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \ - _xynormalizeimagebits((unsigned char *)(bp), img) - -#define ZNORMALIZE(bp, img) \ - if (img->byte_order == MSBFirst) \ - _znormalizeimagebits((unsigned char *)(bp), img) - -#define XYINDEX(x, y, img) \ - ((y) * img->bytes_per_line) + \ - (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3) - -#define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \ - (((x) * img->bits_per_pixel) >> 3) - -/* - * This routine initializes the image object function pointers. The - * intent is to provide native (i.e. fast) routines for native format images - * only using the generic (i.e. slow) routines when fast ones don't exist. - * However, with the current rather botched external interface, clients may - * have to mung image attributes after the image gets created, so the fast - * routines always have to check to make sure the optimization is still - * valid, and reinit the functions if not. - */ -void _XInitImageFuncPtrs ( - register XImage *image) -{ - image->f.create_image = XCreateImage; - image->f.destroy_image = _XDestroyImage; - if ((image->format == ZPixmap) && (image->bits_per_pixel == 8)) { - image->f.get_pixel = _XGetPixel8; - image->f.put_pixel = _XPutPixel8; - } else if (((image->bits_per_pixel | image->depth) == 1) && - (image->byte_order == image->bitmap_bit_order)) { - image->f.get_pixel = _XGetPixel1; - image->f.put_pixel = _XPutPixel1; - } else if ((image->format == ZPixmap) && - (image->bits_per_pixel == 32)) { - image->f.get_pixel = _XGetPixel32; - image->f.put_pixel = _XPutPixel32; - } else if ((image->format == ZPixmap) && - (image->bits_per_pixel == 16)) { - image->f.get_pixel = _XGetPixel16; - image->f.put_pixel = _XPutPixel16; - } else { - image->f.get_pixel = _XGetPixel; - image->f.put_pixel = _XPutPixel; - } - image->f.sub_image = _XSubImage; -/* image->f.set_image = _XSetImage;*/ - image->f.add_pixel = _XAddPixel; -} - -/* - * CreateImage - * - * Allocates the memory necessary for an XImage data structure. - * Initializes the structure with "default" values and returns XImage. - * - */ - -XImage *XCreateImage ( - register Display *dpy, - register Visual *visual, - unsigned int depth, - int format, - int offset, /*How many pixels from the start of the data does the - picture to be transmitted start?*/ - - char *data, - unsigned int width, - unsigned int height, - int xpad, - int image_bytes_per_line) - /*How many bytes between a pixel on one line and the pixel with - the same X coordinate on the next line? 0 means - XCreateImage can calculate it.*/ -{ - register XImage *image; - int bits_per_pixel = 1; - int min_bytes_per_line; - - if (depth == 0 || depth > 32 || - (format != XYBitmap && format != XYPixmap && format != ZPixmap) || - (format == XYBitmap && depth != 1) || - (xpad != 8 && xpad != 16 && xpad != 32) || - offset < 0) - return (XImage *) NULL; - if ((image = Xcalloc(1, sizeof(XImage))) == NULL) - return (XImage *) NULL; - - image->width = width; - image->height = height; - image->format = format; - image->byte_order = dpy->byte_order; - image->bitmap_unit = dpy->bitmap_unit; - image->bitmap_bit_order = dpy->bitmap_bit_order; - if (visual != NULL) { - image->red_mask = visual->red_mask; - image->green_mask = visual->green_mask; - image->blue_mask = visual->blue_mask; - } - else { - image->red_mask = image->green_mask = image->blue_mask = 0; - } - if (format == ZPixmap) - { - bits_per_pixel = _XGetBitsPerPixel(dpy, (int) depth); - } - - image->xoffset = offset; - image->bitmap_pad = xpad; - image->depth = depth; - image->data = data; - /* - * compute per line accelerator. - */ - { - if (format == ZPixmap) - min_bytes_per_line = - ROUNDUP((bits_per_pixel * width), image->bitmap_pad); - else - min_bytes_per_line = - ROUNDUP((width + offset), image->bitmap_pad); - } - if (image_bytes_per_line == 0) { - image->bytes_per_line = min_bytes_per_line; - } else if (image_bytes_per_line < min_bytes_per_line) { - Xfree(image); - return NULL; - } else { - image->bytes_per_line = image_bytes_per_line; - } - - image->bits_per_pixel = bits_per_pixel; - image->obdata = NULL; - _XInitImageFuncPtrs (image); - - return image; -} - -Status XInitImage (XImage *image) -{ - int min_bytes_per_line; - - if (image->depth == 0 || image->depth > 32 || - image->bits_per_pixel > 32 || image->bitmap_unit > 32 || - image->bits_per_pixel < 0 || image->bitmap_unit < 0 || - (image->format != XYBitmap && - image->format != XYPixmap && - image->format != ZPixmap) || - (image->format == XYBitmap && image->depth != 1) || - (image->bitmap_pad != 8 && - image->bitmap_pad != 16 && - image->bitmap_pad != 32) || - image->xoffset < 0) - return 0; - - /* - * compute per line accelerator. - */ - if (image->format == ZPixmap) - min_bytes_per_line = - ROUNDUP((image->bits_per_pixel * image->width), - image->bitmap_pad); - else - min_bytes_per_line = - ROUNDUP((image->width + image->xoffset), image->bitmap_pad); - - if (image->bytes_per_line == 0) { - image->bytes_per_line = min_bytes_per_line; - } else if (image->bytes_per_line < min_bytes_per_line) { - return 0; - } - - _XInitImageFuncPtrs (image); - - return 1; -} - -/* - * _DestroyImage - * - * Deallocates the memory associated with the ximage data structure. - * this version handles the case of the image data being malloc'd - * entirely by the library. - */ - -static int _XDestroyImage (XImage *ximage) -{ - Xfree(ximage->data); - Xfree(ximage->obdata); - Xfree(ximage); - return 1; -} - - -/* - * GetPixel - * - * Returns the specified pixel. The X and Y coordinates are relative to - * the origin (upper left [0,0]) of the image. The pixel value is returned - * in normalized format, i.e. the LSB of the long is the LSB of the pixel. - * The algorithm used is: - * - * copy the source bitmap_unit or Zpixel into temp - * normalize temp if needed - * extract the pixel bits into return value - * - */ - -static unsigned long const low_bits_table[] = { - 0x00000000, 0x00000001, 0x00000003, 0x00000007, - 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, - 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, - 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, - 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, - 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, - 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, - 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, - 0xffffffff -}; - -static unsigned long _XGetPixel ( - register XImage *ximage, - int x, - int y) - -{ - unsigned long pixel, px; - register char *src; - register char *dst; - register int i, j; - int bits, nbytes; - long plane; - - if ((ximage->bits_per_pixel | ximage->depth) == 1) { - src = &ximage->data[XYINDEX(x, y, ximage)]; - dst = (char *)&pixel; - pixel = 0; - for (i = ximage->bitmap_unit >> 3; --i >= 0; ) *dst++ = *src++; - XYNORMALIZE(&pixel, ximage); - bits = (x + ximage->xoffset) % ximage->bitmap_unit; - pixel = ((((char *)&pixel)[bits>>3])>>(bits&7)) & 1; - } else if (ximage->format == XYPixmap) { - pixel = 0; - plane = 0; - nbytes = ximage->bitmap_unit >> 3; - for (i = ximage->depth; --i >= 0; ) { - src = &ximage->data[XYINDEX(x, y, ximage)+ plane]; - dst = (char *)&px; - px = 0; - for (j = nbytes; --j >= 0; ) *dst++ = *src++; - XYNORMALIZE(&px, ximage); - bits = (x + ximage->xoffset) % ximage->bitmap_unit; - pixel = (pixel << 1) | - (((((char *)&px)[bits>>3])>>(bits&7)) & 1); - plane = plane + (ximage->bytes_per_line * ximage->height); - } - } else if (ximage->format == ZPixmap) { - src = &ximage->data[ZINDEX(x, y, ximage)]; - dst = (char *)&px; - px = 0; - for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; ) - *dst++ = *src++; - ZNORMALIZE(&px, ximage); - pixel = 0; - for (i=sizeof(unsigned long); --i >= 0; ) - pixel = (pixel << 8) | ((unsigned char *)&px)[i]; - if (ximage->bits_per_pixel == 4) { - if (x & 1) - pixel >>= 4; - else - pixel &= 0xf; - } - } else { - return 0; /* bad image */ - } - if (ximage->bits_per_pixel == ximage->depth) - return pixel; - else - return (pixel & low_bits_table[ximage->depth]); -} - -static CARD32 const byteorderpixel = MSBFirst << 24; - -static unsigned long _XGetPixel32 ( - register XImage *ximage, - int x, - int y) -{ - register unsigned char *addr; - unsigned long pixel; - - if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { - addr = &((unsigned char *)ximage->data) - [y * ximage->bytes_per_line + (x << 2)]; - if (*((const char *)&byteorderpixel) == ximage->byte_order) - pixel = *((CARD32 *)addr); - else if (ximage->byte_order == MSBFirst) - pixel = ((unsigned long)addr[0] << 24 | - (unsigned long)addr[1] << 16 | - (unsigned long)addr[2] << 8 | - addr[3]); - else - pixel = ((unsigned long)addr[3] << 24 | - (unsigned long)addr[2] << 16 | - (unsigned long)addr[1] << 8 | - addr[0]); - if (ximage->depth != 32) - pixel &= low_bits_table[ximage->depth]; - return pixel; - } else { - _XInitImageFuncPtrs(ximage); - return XGetPixel(ximage, x, y); - } -} - -static unsigned long _XGetPixel16 ( - register XImage *ximage, - int x, - int y) -{ - register unsigned char *addr; - unsigned long pixel; - - if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16)) { - addr = &((unsigned char *)ximage->data) - [y * ximage->bytes_per_line + (x << 1)]; - if (ximage->byte_order == MSBFirst) - pixel = addr[0] << 8 | addr[1]; - else - pixel = addr[1] << 8 | addr[0]; - if (ximage->depth != 16) - pixel &= low_bits_table[ximage->depth]; - return pixel; - } else { - _XInitImageFuncPtrs(ximage); - return XGetPixel(ximage, x, y); - } -} - -static unsigned long _XGetPixel8 ( - register XImage *ximage, - int x, - int y) -{ - unsigned char pixel; - - if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { - pixel = ((unsigned char *)ximage->data) - [y * ximage->bytes_per_line + x]; - if (ximage->depth != 8) - pixel &= low_bits_table[ximage->depth]; - return pixel; - } else { - _XInitImageFuncPtrs(ximage); - return XGetPixel(ximage, x, y); - } -} - -static unsigned long _XGetPixel1 ( - register XImage *ximage, - int x, - int y) -{ - unsigned char bit; - int xoff, yoff; - - if (((ximage->bits_per_pixel | ximage->depth) == 1) && - (ximage->byte_order == ximage->bitmap_bit_order)) { - xoff = x + ximage->xoffset; - yoff = y * ximage->bytes_per_line + (xoff >> 3); - xoff &= 7; - if (ximage->bitmap_bit_order == MSBFirst) - bit = 0x80 >> xoff; - else - bit = 1 << xoff; - return (ximage->data[yoff] & bit) ? 1 : 0; - } else { - _XInitImageFuncPtrs(ximage); - return XGetPixel(ximage, x, y); - } -} - -/* - * PutPixel - * - * Overwrites the specified pixel. The X and Y coordinates are relative to - * the origin (upper left [0,0]) of the image. The input pixel value must be - * in normalized format, i.e. the LSB of the long is the LSB of the pixel. - * The algorithm used is: - * - * copy the destination bitmap_unit or Zpixel to temp - * normalize temp if needed - * copy the pixel bits into the temp - * renormalize temp if needed - * copy the temp back into the destination image data - * - */ - -static int _XPutPixel ( - register XImage *ximage, - int x, - int y, - unsigned long pixel) - -{ - unsigned long px, npixel; - register char *src; - register char *dst; - register int i; - int j, nbytes; - long plane; - - if (ximage->depth == 4) - pixel &= 0xf; - npixel = pixel; - for (i=0, px=pixel; i>=8) - ((unsigned char *)&pixel)[i] = px; - if ((ximage->bits_per_pixel | ximage->depth) == 1) { - src = &ximage->data[XYINDEX(x, y, ximage)]; - dst = (char *)&px; - px = 0; - nbytes = ximage->bitmap_unit >> 3; - for (i = nbytes; --i >= 0; ) *dst++ = *src++; - XYNORMALIZE(&px, ximage); - i = ((x + ximage->xoffset) % ximage->bitmap_unit); - _putbits ((char *)&pixel, i, 1, (char *)&px); - XYNORMALIZE(&px, ximage); - src = (char *) &px; - dst = &ximage->data[XYINDEX(x, y, ximage)]; - for (i = nbytes; --i >= 0; ) *dst++ = *src++; - } else if (ximage->format == XYPixmap) { - plane = (ximage->bytes_per_line * ximage->height) * - (ximage->depth - 1); /* do least signif plane 1st */ - nbytes = ximage->bitmap_unit >> 3; - for (j = ximage->depth; --j >= 0; ) { - src = &ximage->data[XYINDEX(x, y, ximage) + plane]; - dst = (char *) &px; - px = 0; - for (i = nbytes; --i >= 0; ) *dst++ = *src++; - XYNORMALIZE(&px, ximage); - i = ((x + ximage->xoffset) % ximage->bitmap_unit); - _putbits ((char *)&pixel, i, 1, (char *)&px); - XYNORMALIZE(&px, ximage); - src = (char *)&px; - dst = &ximage->data[XYINDEX(x, y, ximage) + plane]; - for (i = nbytes; --i >= 0; ) *dst++ = *src++; - npixel = npixel >> 1; - for (i=0, px=npixel; i>=8) - ((unsigned char *)&pixel)[i] = px; - plane = plane - (ximage->bytes_per_line * ximage->height); - } - } else if (ximage->format == ZPixmap) { - src = &ximage->data[ZINDEX(x, y, ximage)]; - dst = (char *)&px; - px = 0; - nbytes = (ximage->bits_per_pixel + 7) >> 3; - for (i = nbytes; --i >= 0; ) *dst++ = *src++; - ZNORMALIZE(&px, ximage); - _putbits ((char *)&pixel, - (x * ximage->bits_per_pixel) & 7, - ximage->bits_per_pixel, (char *)&px); - ZNORMALIZE(&px, ximage); - src = (char *)&px; - dst = &ximage->data[ZINDEX(x, y, ximage)]; - for (i = nbytes; --i >= 0; ) *dst++ = *src++; - } else { - return 0; /* bad image */ - } - return 1; -} - -static int _XPutPixel32 ( - register XImage *ximage, - int x, - int y, - unsigned long pixel) -{ - unsigned char *addr; - - if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { - addr = &((unsigned char *)ximage->data) - [y * ximage->bytes_per_line + (x << 2)]; - if (*((const char *)&byteorderpixel) == ximage->byte_order) - *((CARD32 *)addr) = pixel; - else if (ximage->byte_order == MSBFirst) { - addr[0] = pixel >> 24; - addr[1] = pixel >> 16; - addr[2] = pixel >> 8; - addr[3] = pixel; - } else { - addr[3] = pixel >> 24; - addr[2] = pixel >> 16; - addr[1] = pixel >> 8; - addr[0] = pixel; - } - return 1; - } else { - _XInitImageFuncPtrs(ximage); - return XPutPixel(ximage, x, y, pixel); - } -} - -static int _XPutPixel16 ( - register XImage *ximage, - int x, - int y, - unsigned long pixel) -{ - unsigned char *addr; - - if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16)) { - addr = &((unsigned char *)ximage->data) - [y * ximage->bytes_per_line + (x << 1)]; - if (ximage->byte_order == MSBFirst) { - addr[0] = pixel >> 8; - addr[1] = pixel; - } else { - addr[1] = pixel >> 8; - addr[0] = pixel; - } - return 1; - } else { - _XInitImageFuncPtrs(ximage); - return XPutPixel(ximage, x, y, pixel); - } -} - -static int _XPutPixel8 ( - register XImage *ximage, - int x, - int y, - unsigned long pixel) -{ - if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { - ximage->data[y * ximage->bytes_per_line + x] = pixel; - return 1; - } else { - _XInitImageFuncPtrs(ximage); - return XPutPixel(ximage, x, y, pixel); - } -} - -static int _XPutPixel1 ( - register XImage *ximage, - int x, - int y, - unsigned long pixel) -{ - unsigned char bit; - int xoff, yoff; - - if (((ximage->bits_per_pixel | ximage->depth) == 1) && - (ximage->byte_order == ximage->bitmap_bit_order)) { - xoff = x + ximage->xoffset; - yoff = y * ximage->bytes_per_line + (xoff >> 3); - xoff &= 7; - if (ximage->bitmap_bit_order == MSBFirst) - bit = 0x80 >> xoff; - else - bit = 1 << xoff; - if (pixel & 1) - ximage->data[yoff] |= bit; - else - ximage->data[yoff] &= ~bit; - return 1; - } else { - _XInitImageFuncPtrs(ximage); - return XPutPixel(ximage, x, y, pixel); - } -} - -/* - * SubImage - * - * Creates a new image that is a subsection of an existing one. - * Allocates the memory necessary for the new XImage data structure. - * Pointer to new image is returned. The algorithm used is repetitive - * calls to get and put pixel. - * - */ - -static XImage *_XSubImage ( - XImage *ximage, - register int x, /* starting x coordinate in existing image */ - register int y, /* starting y coordinate in existing image */ - unsigned int width, /* width in pixels of new subimage */ - unsigned int height)/* height in pixels of new subimage */ - -{ - register XImage *subimage; - int dsize; - register int row, col; - register unsigned long pixel; - char *data; - - if ((subimage = Xcalloc (1, sizeof (XImage))) == NULL) - return (XImage *) NULL; - subimage->width = width; - subimage->height = height; - subimage->xoffset = 0; - subimage->format = ximage->format; - subimage->byte_order = ximage->byte_order; - subimage->bitmap_unit = ximage->bitmap_unit; - subimage->bitmap_bit_order = ximage->bitmap_bit_order; - subimage->bitmap_pad = ximage->bitmap_pad; - subimage->bits_per_pixel = ximage->bits_per_pixel; - subimage->depth = ximage->depth; - /* - * compute per line accelerator. - */ - if (subimage->format == ZPixmap) - subimage->bytes_per_line = - ROUNDUP(subimage->bits_per_pixel * width, - subimage->bitmap_pad); - else - subimage->bytes_per_line = - ROUNDUP(width, subimage->bitmap_pad); - subimage->obdata = NULL; - _XInitImageFuncPtrs (subimage); - dsize = subimage->bytes_per_line * height; - if (subimage->format == XYPixmap) dsize = dsize * subimage->depth; - if (((data = Xcalloc (1, dsize)) == NULL) && (dsize > 0)) { - Xfree(subimage); - return (XImage *) NULL; - } - subimage->data = data; - - /* - * Test for cases where the new subimage is larger than the region - * that we are copying from the existing data. In those cases, - * copy the area of the existing image, and allow the "uncovered" - * area of new subimage to remain with zero filled pixels. - */ - if (height > ximage->height - y ) height = ximage->height - y; - if (width > ximage->width - x ) width = ximage->width - x; - - for (row = y; row < (y + height); row++) { - for (col = x; col < (x + width); col++) { - pixel = XGetPixel(ximage, col, row); - XPutPixel(subimage, (col - x), (row - y), pixel); - } - } - return subimage; -} - - -/* - * SetImage - * - * Overwrites a section of one image with all of the data from another. - * If the two images are not of the same format (i.e. XYPixmap and ZPixmap), - * the image data is converted to the destination format. The following - * restrictions apply: - * - * 1. The depths of the source and destination images must be equal. - * - * 2. If the height of the source image is too large to fit between - * the specified y starting point and the bottom of the image, - * then scanlines are truncated on the bottom. - * - * 3. If the width of the source image is too large to fit between - * the specified x starting point and the end of the scanline, - * then pixels are truncated on the right. - * - * The images need not have the same bitmap_bit_order, byte_order, - * bitmap_unit, bits_per_pixel, bitmap_pad, or xoffset. - * - */ - -int _XSetImage( - XImage *srcimg, - register XImage *dstimg, - register int x, - register int y) -{ - register unsigned long pixel; - register int row, col; - int width, height, startrow, startcol; - if (x < 0) { - startcol = -x; - x = 0; - } else - startcol = 0; - if (y < 0) { - startrow = -y; - y = 0; - } else - startrow = 0; - width = dstimg->width - x; - if (srcimg->width < width) - width = srcimg->width; - height = dstimg->height - y; - if (srcimg->height < height) - height = srcimg->height; - - /* this is slow, will do better later */ - for (row = startrow; row < height; row++) { - for (col = startcol; col < width; col++) { - pixel = XGetPixel(srcimg, col, row); - XPutPixel(dstimg, x + col, y + row, pixel); - } - } - return 1; -} - -/* - * AddPixel - * - * Adds a constant value to every pixel in a pixmap. - * - */ - -static int -_XAddPixel ( - register XImage *ximage, - register long value) -{ - register int x; - register int y; - - if (!value) - return 0; - if ((ximage->bits_per_pixel | ximage->depth) == 1) { - /* The only value that we can add here to an XYBitmap - * is one. Since 1 + value = ~value for one bit wide - * data, we do this quickly by taking the ones complement - * of the entire bitmap data (offset and pad included!). - * Note that we don't need to be concerned with bit or - * byte order at all. - */ - register unsigned char *dp = (unsigned char *) ximage->data; - x = ximage->bytes_per_line * ximage->height; - while (--x >= 0) { - *dp = ~*dp; - dp++; - } - } else if ((ximage->format == ZPixmap) && - (ximage->bits_per_pixel == 8)) { - register unsigned char *dp = (unsigned char *) ximage->data; - x = ximage->bytes_per_line * ximage->height; - while (--x >= 0) - *dp++ += value; - } else if ((ximage->format == ZPixmap) && - (ximage->bits_per_pixel == 16) && - (*((const char *)&byteorderpixel) == ximage->byte_order)) { - register unsigned short *dp = (unsigned short *) ximage->data; - x = (ximage->bytes_per_line >> 1) * ximage->height; - while (--x >= 0) - *dp++ += value; - } else if ((ximage->format == ZPixmap) && - (ximage->bits_per_pixel == 32) && - (*((const char *)&byteorderpixel) == ximage->byte_order)) { - register CARD32 *dp = (CARD32 *) ximage->data; - x = (ximage->bytes_per_line >> 2) * ximage->height; - while (--x >= 0) - *dp++ += value; - } else { - for (y = ximage->height; --y >= 0; ) { - for (x = ximage->width; --x >= 0; ) { - register unsigned long pixel = XGetPixel(ximage, x, y); - pixel = pixel + value; - XPutPixel(ximage, x, y, pixel); - } - } - } - return 0; -} - diff --git a/nx-X11/lib/X11/ImUtil.h b/nx-X11/lib/X11/ImUtil.h deleted file mode 100644 index a8b95eead..000000000 --- a/nx-X11/lib/X11/ImUtil.h +++ /dev/null @@ -1,31 +0,0 @@ - -#if !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) -#define _X11_IMUTIL_H_ -#define _IMUTIL_H_ - -extern int -_XGetScanlinePad( - Display *dpy, - int depth); - -extern int -_XGetBitsPerPixel( - Display *dpy, - int depth); - -extern int -_XSetImage( - XImage *srcimg, - register XImage *dstimg, - register int x, - register int y); - -extern int -_XReverse_Bytes( - register unsigned char *bpt, - register int nb); -extern void -_XInitImageFuncPtrs( - register XImage *image); - -#endif /* !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) */ diff --git a/nx-X11/lib/X11/Imakefile b/nx-X11/lib/X11/Imakefile deleted file mode 100644 index a6471bff1..000000000 --- a/nx-X11/lib/X11/Imakefile +++ /dev/null @@ -1,1132 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - - HEADERS = Xlib.h Xresource.h Xutil.h cursorfont.h Xlibint.h \ - Xcms.h Xlocale.h XKBlib.h XlibConf.h Xregion.h ImUtil.h - -#if BuildServersOnly && !BuildClients && !NXAgentServer -all:: - -BuildIncludes($(HEADERS),IncSubdir,..) - -#else - -#if NXLibraries - -#ifdef SunArchitecture -NX_INCLUDES = -I../../../nxcomp/include -I/usr/sfw/include -#else -NX_INCLUDES = -I../../../nxcomp/include -#endif - -NX_DEFINES = -DNX_TRANS_SOCKET \ - -DNX_TRANS_EXIT - -# -DNX_TRANS_CHANGE \ -# -DNX_TRANS_WARN \ -# -DNX_TRANS_INFO \ -# -DNX_TRANS_TEST \ -# -DNX_TRANS_DEBUG \ - -/* - This is used to create libX11* links in exports/lib. - It is a dependency of the part that links the libNX_X11.so - to exports/lib and is therefore called _before_ any libNX* - links exist. - The make target libX11-links is at the end of the file. -*/ -/* - Currently, this breaks our builds. Autoconf-based packages - like nxcompext try to detect host X11 libraries, but will - find links to libNX_X11 in exports/lib as libX11 files, - which in turn will be test-linked in configure and always - fail (for instance, because necessary dependencies like - libXcomp will not be available on clean systems.) - - Keep this disabled for now. - - If anything, this code needs to be reworked to create - libX11 symlinks only *after* everything has been - installed. -*/ -#EXTRALIBRARYDEPS = libX11-links - -#ifdef cygwinArchitecture -NX_XCOMPLIBNAME = cygXcomp.dll -NX_XCOMPEXTLIBNAME = cygXcompext.dll -#else -NX_XCOMPLIBNAME = libXcomp.so -NX_XCOMPEXTLIBNAME = libXcompext.so -#endif - -NX_XCOMPLIBDIR = $(XTOP)/../nxcomp/src/.libs -NX_XCOMPLIBLINK = Xcomp -NX_XCOMPLIBTARGET = $(NX_XCOMPLIBDIR)/$(NX_XCOMPLIBNAME) -NX_REQUIREDLIBS = -L$(NX_XCOMPLIBDIR) -l$(NX_XCOMPLIBLINK) -NX_XCOMPCONFIGTARGET = $(NX_XCOMPLIBDIR)/config.status - -NX_XCOMPEXTLIBDIR = $(XTOP)/../nxcompext/src/.libs -NX_XCOMPEXTLIBTARGET = $(NX_XCOMPEXTLIBDIR)/$(NX_XCOMPEXTLIBNAME) -NX_XCOMPEXTCONFIGTARGET = $(NX_XCOMPEXTLIBDIR)/config.status - -#endif - -#define DoNormalLib NormalLibX11 -#define DoSharedLib SharedLibX11 -#define DoExtraLib SharedLibX11 -#define DoDebugLib DebugLibX11 -#define DoProfileLib ProfileLibX11 -#define LibName NX_X11 -#define SoRev SOXLIBREV -#define HugeLibrary YES -#define IncSubdir nx-X11 - -/* - FIXME: This is switchable upstream via configure option, we leave it - on for now as this is the upstream default. -*/ -XCMS_DEFINES = -DXCMS -XCB_DEFINES = -DUSE_XCB=0 - -#include - -#ifndef MotifBC -#define MotifBC NO -#endif - -#ifdef SharedX11Reqs -REQUIREDX11LIBS = SharedX11Reqs -#endif -#ifdef cygwinArchitecture -EXCLUDE_SYMBOL = -Wl,--exclude-symbol,XdmcpWrap:_XdmcpWrapperToOddParity -#endif - -REQUIREDLIBS=$(REQUIREDX11LIBS) $(REQUIREDI18NLIBS) $(EXCLUDE_SYMBOL) $(NX_REQUIREDLIBS) - -#if defined(MacIIArchitecture) || defined(SequentArchitecture) || defined(i386ScoArchitecture) -XBSDLIB = /**/ -#endif -#if defined(LunaArchitecture) && defined(Mc88000Architecture) -EXTRA_LIBRARIES = /**/ -#endif -#if Malloc0ReturnsNull - MALLOC_DEFINES = XMalloc0ReturnsNullDefines -#endif -#if HasXdmAuth - XDMAUTHDEFS = -DHASXDMAUTH -#endif -#if BuildXKBlib - XKB_DEFINES = -DXKB - XKBSRCS = XKB.c XKBBind.c XKBCompat.c XKBCtrls.c XKBCvt.c XKBGetMap.c \ - XKBGetByName.c XKBNames.c XKBRdBuf.c XKBSetMap.c XKBUse.c \ - XKBleds.c XKBBell.c XKBGeom.c XKBSetGeom.c XKBExtDev.c \ - XKBList.c XKBMisc.c \ - XKBMAlloc.c XKBGAlloc.c XKBAlloc.c - XKBOBJS = XKB.o XKBBind.o XKBCompat.o XKBCtrls.o XKBCvt.o XKBGetMap.o \ - XKBGetByName.o XKBNames.o XKBRdBuf.o XKBSetMap.o XKBUse.o \ - XKBleds.o XKBBell.o XKBGeom.o XKBSetGeom.o XKBExtDev.o \ - XKBList.o XKBMisc.o \ - XKBMAlloc.o XKBGAlloc.o XKBAlloc.o -#endif -#if HasSecureRPC - RPCDEFS = -DSECURE_RPC -#endif -#if HasPoll - POLL_DEFINES = -DUSE_POLL -#endif - CONN_DEFINES = $(CONNECTION_FLAGS) - XTRANS_X_DEFINES = -DX11_t -DTRANS_CLIENT $(XTRANS_FAILDEFINES) -DXTRANS_SEND_FDS=0 - XTRANS_XIM_DEFINES = -DXIM_t -DTRANS_CLIENT $(XTRANS_FAILDEFINES) -DXTRANS_SEND_FDS=0 -#if HasBSD44Sockets - SOCK_DEFINES = -DBSD44SOCKETS -#endif -#if HasShm - SHM_DEFINES = -DHAS_SHM -#endif - - XF86BIGFONT_DEFINES = XF86BigfontExtensionDefines - - EDB_DEFINES = -DERRORDB=\"$(USRDATADIR)/XErrorDB\" - CMS_DEFINES = -DXCMSDB=\"$(USRDATADIR)/Xcms.txt\" -DXCMSDIR=\"$(USRDATADIR)\" -#if HasSnprintf - MISC_DEFINES = -DHAS_SNPRINTF -DLIBX11 -#endif -#if MotifBC - BC_DEFINES = -DMOTIFBC -#endif -#if NoRConst - RCONST_DEFINES = -DNORCONST -#endif -#if DisableXLocaleDirEnv - SETID_DEFINES = -DNO_XLOCALEDIR -#elif HasIssetugid - SETID_DEFINES = -DHASSETUGID -#elif HasGetresuid - SETID_DEFINES = -DHASGETRESUID -#endif - XLC_DEFINES = -DXLOCALEDIR=\"$(XLOCALEDIR)\" -DXLOCALELIBDIR=\"$(XLOCALELIBDIR)\" -#if (defined(FreeBSDArchitecture) && OSRelVersion < 500016) || \ - defined(OpenBSDArchitecture) -THRSTUBSRCS = UIThrStubs.c -THRSTUBOBJS = UIThrStubs.o -#endif -#if BuildLoadableXlibXcursor -XCURSOR_DEFINES = -DUSE_DYNAMIC_XCURSOR -DLIBXCURSOR=\"libXcursor.so.$(SOXCURSORREV)\" -#endif -#if NeedLibInsideFlag - LIB_DEFINES = -D_XLIBINT_ -#endif -#if defined(LibDirName) - POSTLOCALELIBDIR = LibDirName - POSTLOCALELIBDEFINES = -DPOSTLOCALELIBDIR=\"$(POSTLOCALELIBDIR)\" -#endif - DEFINES = $(MALLOC_DEFINES) $(LIB_DEFINES) $(MISC_DEFINES)\ - $(POSTLOCALELIBDEFINES) $(NX_INCLUDES) $(NX_DEFINES) ${XCMS_DEFINES} ${XCB_DEFINES} - OPEN_DEFINES = -I$(EXTINCSRC) $(K5INCL) $(K5DEFS) - DEPEND_DEFINES = $(OPEN_DEFINES) $(TRANS_INCLUDES) $(CONN_DEFINES) $(THREADS_DEFINES) DependDefines - AUTHOBJS = AuDispose.o AuGetBest.o AuFileName.o AuRead.o - AUTHSRCS = AuDispose.c AuGetBest.c AuFileName.c AuRead.c - SRCS = $(SRCS1) $(SRCS2) $(SRCS3) $(EXTRASRCS) /* try *.c if you have trouble */ - OBJS = $(OBJS1) $(OBJS2) $(OBJS3) $(EXTRAOBJS) - LINTLIBS = - -EXTRASRCS = $(STATICLCSRCS) -EXTRAOBJS = $(STATICLCOBJS) - -SRCS1 = \ - Context.c \ - Depths.c \ - ParseCmd.c \ - Quarks.c \ - AllCells.c \ - AllPlanes.c \ - AllowEv.c \ - AutoRep.c \ - Backgnd.c \ - BdrWidth.c \ - Bell.c \ - Border.c \ - ChAccCon.c \ - ChClMode.c \ - ChActPGb.c \ - ChCmap.c \ - ChGC.c \ - ChKeyCon.c \ - ChPntCon.c \ - ChProp.c \ - ChSaveSet.c \ - ChWAttrs.c \ - ChWindow.c \ - ChkIfEv.c \ - ChkMaskEv.c \ - ChkWinEv.c \ - ChkTypEv.c \ - ChkTypWEv.c \ - CirWin.c \ - CirWinDn.c \ - CirWinUp.c \ - ClDisplay.c \ - Clear.c \ - ClearArea.c \ - ConfWind.c \ - ConnDis.c \ - ConvSel.c \ - CopyArea.c \ - CopyCmap.c \ - CopyGC.c \ - CopyPlane.c \ - CrBFData.c \ - CrCmap.c \ - CrCursor.c \ - CrGC.c \ - CrGlCur.c \ - CrPFBData.c \ - CrPixmap.c \ - CrWindow.c \ - Cursor.c \ - DefCursor.c \ - DelProp.c \ - DestSubs.c \ - DestWind.c \ - DisName.c \ - DrArc.c \ - DrArcs.c \ - DrLine.c \ - DrLines.c \ - DrPoint.c \ - DrPoints.c \ - DrRect.c \ - DrRects.c \ - DrSegs.c \ - ErrDes.c \ - ErrHndlr.c \ - EvToWire.c \ - FetchName.c \ - FillArc.c \ - FillArcs.c \ - FillPoly.c \ - FillRct.c \ - FillRcts.c \ - Flush.c \ - Font.c \ - FontNames.c \ - FontInfo.c \ - FreeCmap.c \ - FreeCols.c \ - FreeCurs.c \ - FreeEData.c \ - FreeEventData.c \ - FreeGC.c \ - FreePix.c \ - FSSaver.c \ - GCMisc.c \ - Geom.c \ - GetAtomNm.c \ - GetColor.c \ - GetDflt.c \ - GetEventData.c \ - GetFPath.c \ - GetFProp.c \ - GetGeom.c \ - GetHColor.c \ - GetHints.c \ - GetIFocus.c \ - GetImage.c \ - GetKCnt.c \ - GetMoEv.c \ - GetPCnt.c \ - GetPntMap.c \ - GetProp.c \ - GetSOwner.c \ - GetSSaver.c \ - GetStCmap.c \ - GetWAttrs.c \ - GrButton.c \ - GrKey.c \ - GrKeybd.c \ - GrPointer.c \ - GrServer.c \ - Host.c \ - IfEvent.c \ - ImUtil.c \ - ImText.c \ - ImText16.c \ - InitExt.c \ - InsCmap.c \ - IntAtom.c \ - KeyBind.c \ - KeysymStr.c \ - KillCl.c \ - LiHosts.c \ - LiICmaps.c \ - LiProps.c \ - ListExt.c \ - LoadFont.c \ - LookupCol.c \ - LowerWin.c - -OBJS1 = \ - Context.o \ - Depths.o \ - ParseCmd.o \ - Quarks.o \ - AllCells.o \ - AllPlanes.o \ - AllowEv.o \ - AutoRep.o \ - Backgnd.o \ - BdrWidth.o \ - Bell.o \ - Border.o \ - ChAccCon.o \ - ChClMode.o \ - ChActPGb.o \ - ChCmap.o \ - ChGC.o \ - ChKeyCon.o \ - ChPntCon.o \ - ChProp.o \ - ChSaveSet.o \ - ChWAttrs.o \ - ChWindow.o \ - ChkIfEv.o \ - ChkMaskEv.o \ - ChkWinEv.o \ - ChkTypEv.o \ - ChkTypWEv.o \ - CirWin.o \ - CirWinDn.o \ - CirWinUp.o \ - ClDisplay.o \ - Clear.o \ - ClearArea.o \ - ConfWind.o \ - ConnDis.o \ - ConvSel.o \ - CopyArea.o \ - CopyCmap.o \ - CopyGC.o \ - CopyPlane.o \ - CrBFData.o \ - CrCmap.o \ - CrCursor.o \ - CrGC.o \ - CrGlCur.o \ - CrPFBData.o \ - CrPixmap.o \ - CrWindow.o \ - Cursor.o \ - DefCursor.o \ - DelProp.o \ - DestSubs.o \ - DestWind.o \ - DisName.o \ - DrArc.o \ - DrArcs.o \ - DrLine.o \ - DrLines.o \ - DrPoint.o \ - DrPoints.o \ - DrRect.o \ - DrRects.o \ - DrSegs.o \ - ErrDes.o \ - ErrHndlr.o \ - EvToWire.o \ - FetchName.o \ - FillArc.o \ - FillArcs.o \ - FillPoly.o \ - FillRct.o \ - FillRcts.o \ - Flush.o \ - Font.o \ - FontNames.o \ - FontInfo.o \ - FreeCmap.o \ - FreeCols.o \ - FreeCurs.o \ - FreeEData.o \ - FreeEventData.o \ - FreeGC.o \ - FreePix.o \ - FSSaver.o \ - GCMisc.o \ - Geom.o \ - GetAtomNm.o \ - GetColor.o \ - GetDflt.o \ - GetEventData.o \ - GetFPath.o \ - GetFProp.o \ - GetGeom.o \ - GetHColor.o \ - GetHints.o \ - GetIFocus.o \ - GetImage.o \ - GetKCnt.o \ - GetMoEv.o \ - GetPCnt.o \ - GetPntMap.o \ - GetProp.o \ - GetSOwner.o \ - GetSSaver.o \ - GetStCmap.o \ - GetWAttrs.o \ - GrButton.o \ - GrKey.o \ - GrKeybd.o \ - GrPointer.o \ - GrServer.o \ - Host.o \ - IfEvent.o \ - ImUtil.o \ - ImText.o \ - ImText16.o \ - InitExt.o \ - InsCmap.o \ - IntAtom.o \ - KeyBind.o \ - KeysymStr.o \ - KillCl.o \ - LiHosts.o \ - LiICmaps.o \ - LiProps.o \ - ListExt.o \ - LoadFont.o \ - LookupCol.o \ - LowerWin.o - -SRCS2 = \ - Macros.c \ - MapRaised.c \ - MapSubs.c \ - MapWindow.c \ - MaskEvent.c \ - Misc.c \ - ModMap.c \ - MoveWin.c \ - NextEvent.c \ - OpenDis.c \ - ParseCol.c \ - ParseGeom.c \ - PeekEvent.c \ - PeekIfEv.c \ - Pending.c \ - PmapBgnd.c \ - PmapBord.c \ - PolyReg.c \ - PolyTxt.c \ - PolyTxt16.c \ - PutBEvent.c \ - PutImage.c \ - QuBest.c \ - QuColor.c \ - QuColors.c \ - QuCurShp.c \ - QuExt.c \ - QuKeybd.c \ - QuPntr.c \ - QuStipShp.c \ - QuTextE16.c \ - QuTextExt.c \ - QuTileShp.c \ - QuTree.c \ - RaiseWin.c \ - RdBitF.c \ - RecolorC.c \ - ReconfWin.c \ - Region.c \ - RepWindow.c \ - RestackWs.c \ - RotProp.c \ - ScrResStr.c \ - SelInput.c \ - SendEvent.c \ - SetBack.c \ - SetCRects.c \ - SetClMask.c \ - SetClOrig.c \ - SetDashes.c \ - SetFPath.c \ - SetFont.c \ - SetFore.c \ - SetFunc.c \ - SetHints.c \ - SetIFocus.c \ - SetLStyle.c \ - SetPMask.c \ - SetPntMap.c \ - SetSOwner.c \ - SetSSaver.c \ - SetState.c \ - SetStip.c \ - SetStCmap.c \ - SetTile.c \ - SetTSOrig.c \ - StBytes.c \ - StColor.c \ - StColors.c \ - StNColor.c \ - StName.c \ - StrKeysym.c \ - Sync.c \ - Synchro.c \ - Text.c \ - Text16.c \ - TextExt.c \ - TextExt16.c \ - TrCoords.c \ - UndefCurs.c \ - UngrabBut.c \ - UngrabKbd.c \ - UngrabKey.c \ - UngrabPtr.c \ - UngrabSvr.c \ - UninsCmap.c \ - UnldFont.c \ - UnmapSubs.c \ - UnmapWin.c \ - VisUtil.c \ - WarpPtr.c \ - WinEvent.c \ - Window.c \ - WrBitF.c \ - XlibAsync.c \ - XlibInt.c \ - Xrm.c \ - evtomask.c \ - globals.c \ - GetGCVals.c \ - GetNrmHint.c \ - GetRGBCMap.c \ - GetTxtProp.c \ - GetWMCMapW.c \ - GetWMProto.c \ - Iconify.c \ - PixFormats.c \ - PropAlloc.c \ - ReconfWM.c \ - SetNrmHint.c \ - SetRGBCMap.c \ - SetTxtProp.c \ - SetWMCMapW.c \ - SetWMProto.c \ - StrToText.c \ - TextToStr.c \ - Withdraw.c \ - WMGeom.c \ - WMProps.c \ - $(AUTHSRCS) $(K5SRCS) $(THRSTUBSRCS) - -OBJS2 = \ - Macros.o \ - MapRaised.o \ - MapSubs.o \ - MapWindow.o \ - MaskEvent.o \ - Misc.o \ - ModMap.o \ - MoveWin.o \ - NextEvent.o \ - OpenDis.o \ - ParseCol.o \ - ParseGeom.o \ - PeekEvent.o \ - PeekIfEv.o \ - Pending.o \ - PmapBgnd.o \ - PmapBord.o \ - PolyReg.o \ - PolyTxt.o \ - PolyTxt16.o \ - PutBEvent.o \ - PutImage.o \ - QuBest.o \ - QuColor.o \ - QuColors.o \ - QuCurShp.o \ - QuExt.o \ - QuKeybd.o \ - QuPntr.o \ - QuStipShp.o \ - QuTextE16.o \ - QuTextExt.o \ - QuTileShp.o \ - QuTree.o \ - RaiseWin.o \ - RdBitF.o \ - RecolorC.o \ - ReconfWin.o \ - Region.o \ - RepWindow.o \ - RestackWs.o \ - RotProp.o \ - ScrResStr.o \ - SelInput.o \ - SendEvent.o \ - SetBack.o \ - SetCRects.o \ - SetClMask.o \ - SetClOrig.o \ - SetDashes.o \ - SetFPath.o \ - SetFont.o \ - SetFore.o \ - SetFunc.o \ - SetHints.o \ - SetIFocus.o \ - SetLStyle.o \ - SetPMask.o \ - SetPntMap.o \ - SetSOwner.o \ - SetSSaver.o \ - SetState.o \ - SetStip.o \ - SetStCmap.o \ - SetTile.o \ - SetTSOrig.o \ - StBytes.o \ - StColor.o \ - StColors.o \ - StNColor.o \ - StName.o \ - StrKeysym.o \ - Sync.o \ - Synchro.o \ - Text.o \ - Text16.o \ - TextExt.o \ - TextExt16.o \ - TrCoords.o \ - UndefCurs.o \ - UngrabBut.o \ - UngrabKbd.o \ - UngrabKey.o \ - UngrabPtr.o \ - UngrabSvr.o \ - UninsCmap.o \ - UnldFont.o \ - UnmapSubs.o \ - UnmapWin.o \ - VisUtil.o \ - WarpPtr.o \ - WinEvent.o \ - Window.o \ - WrBitF.o \ - XlibAsync.o \ - XlibInt.o \ - Xrm.o \ - evtomask.o \ - globals.o \ - GetGCVals.o \ - GetNrmHint.o \ - GetRGBCMap.o \ - GetTxtProp.o \ - GetWMCMapW.o \ - GetWMProto.o \ - Iconify.o \ - PixFormats.o \ - PropAlloc.o \ - ReconfWM.o \ - SetNrmHint.o \ - SetRGBCMap.o \ - SetTxtProp.o \ - SetWMCMapW.o \ - SetWMProto.o \ - StrToText.o \ - TextToStr.o \ - Withdraw.o \ - WMGeom.o \ - WMProps.o \ - $(AUTHOBJS) \ - $(K5OBJS) \ - $(THRSTUBOBJS) - -SRCS3 = \ - Lab.c \ - LabGcC.c \ - LabGcL.c \ - LabGcLC.c \ - LabMnL.c \ - LabMxC.c \ - LabMxL.c \ - LabMxLC.c \ - LabWpAj.c \ - Luv.c \ - LuvGcC.c \ - LuvGcL.c \ - LuvGcLC.c \ - LuvMnL.c \ - LuvMxC.c \ - LuvMxL.c \ - LuvMxLC.c \ - LuvWpAj.c \ - XYZ.c \ - uvY.c \ - xyY.c \ - HVC.c \ - HVCGcC.c \ - HVCGcV.c \ - HVCGcVC.c \ - HVCMnV.c \ - HVCMxC.c \ - HVCMxV.c \ - HVCMxVC.c \ - HVCMxVs.c \ - HVCWpAj.c \ - UNDEFINED.c \ - AddDIC.c \ - AddSF.c \ - cmsAllNCol.c \ - cmsAllCol.c \ - CCC.c \ - cmsCmap.c \ - cmsColNm.c \ - CvColW.c \ - CvCols.c \ - cmsGlobls.c \ - IdOfPr.c \ - cmsInt.c \ - LRGB.c \ - cmsLkCol.c \ - cmsMath.c \ - OfCCC.c \ - PrOfId.c \ - cmsProp.c \ - QBlack.c \ - QBlue.c \ - QGreen.c \ - QRed.c \ - QWhite.c \ - QuCol.c \ - QuCols.c \ - SetCCC.c \ - SetGetCols.c \ - StCol.c \ - StCols.c \ - cmsTrig.c \ - XRGB.c \ - FSWrap.c \ - ICWrap.c \ - IMWrap.c \ - OCWrap.c \ - OMWrap.c \ - lcWrap.c \ - mbWMProps.c \ - utf8WMProps.c \ - mbWrap.c \ - wcWrap.c \ - utf8Wrap.c \ - FilterEv.c \ - RegstFlt.c \ - locking.c \ - LockDis.c \ - x11_trans.c \ - xim_trans.c \ - $(XKBSRCS) $(LCSRCS) - -OBJS3 = \ - Lab.o \ - LabGcC.o \ - LabGcL.o \ - LabGcLC.o \ - LabMnL.o \ - LabMxC.o \ - LabMxL.o \ - LabMxLC.o \ - LabWpAj.o \ - Luv.o \ - LuvGcC.o \ - LuvGcL.o \ - LuvGcLC.o \ - LuvMnL.o \ - LuvMxC.o \ - LuvMxL.o \ - LuvMxLC.o \ - LuvWpAj.o \ - XYZ.o \ - uvY.o \ - xyY.o \ - HVC.o \ - HVCGcC.o \ - HVCGcV.o \ - HVCGcVC.o \ - HVCMnV.o \ - HVCMxC.o \ - HVCMxV.o \ - HVCMxVC.o \ - HVCMxVs.o \ - HVCWpAj.o \ - UNDEFINED.o \ - AddDIC.o \ - AddSF.o \ - cmsAllNCol.o \ - cmsAllCol.o \ - CCC.o \ - cmsCmap.o \ - cmsColNm.o \ - CvColW.o \ - CvCols.o \ - cmsGlobls.o \ - IdOfPr.o \ - cmsInt.o \ - LRGB.o \ - cmsLkCol.o \ - cmsMath.o \ - OfCCC.o \ - PrOfId.o \ - cmsProp.o \ - QBlack.o \ - QBlue.o \ - QGreen.o \ - QRed.o \ - QWhite.o \ - QuCol.o \ - QuCols.o \ - SetCCC.o \ - SetGetCols.o \ - StCol.o \ - StCols.o \ - cmsTrig.o \ - XRGB.o \ - FSWrap.o \ - ICWrap.o \ - IMWrap.o \ - OCWrap.o \ - OMWrap.o \ - lcWrap.o \ - mbWMProps.o \ - utf8WMProps.o \ - mbWrap.o \ - wcWrap.o \ - utf8Wrap.o \ - FilterEv.o \ - RegstFlt.o \ - locking.o \ - LockDis.o \ - x11_trans.o \ - xim_trans.o \ - $(XKBOBJS) $(LCOBJS) - -STATICI18NSTATICSRCS = \ - imCallbk.c \ - imDefFlt.c \ - imDefIc.c \ - imDefIm.c \ - imDefLkup.c \ - imDispch.c \ - imEvToWire.c \ - imExten.c \ - imImSw.c \ - imInsClbk.c \ - imInt.c \ - imLcFlt.c \ - imLcGIc.c \ - imLcIc.c \ - imLcIm.c \ - imLcLkup.c \ - imLcPrs.c \ - imLcSIc.c \ - imRm.c \ - imRmAttr.c \ - imThaiFlt.c \ - imThaiIc.c \ - imThaiIm.c \ - imTrX.c \ - imTransR.c \ - imTrans.c \ - lcGenConv.c \ - lcUTF8Load.c \ - omDefault.c \ - omGeneric.c \ - omImText.c \ - omText.c \ - omTextEsc.c \ - omTextExt.c \ - omTextPer.c \ - omXChar.c - -LCSRCS = \ - SetLocale.c \ - imConv.c \ - imKStoUCS.c \ - lcCT.c \ - lcCharSet.c \ - lcConv.c \ - lcDB.c \ - lcDefConv.c \ - lcFile.c \ - lcGeneric.c \ - lcInit.c \ - lcPrTxt.c \ - lcPubWrap.c \ - lcPublic.c \ - lcRM.c \ - lcStd.c \ - lcTxtPr.c \ - lcUtil.c \ - lcUTF8.c - -STATICLCSRCS = \ - $(STATICI18NSTATICSRCS) - -STATICI18NSTATICOBJS = \ - imCallbk.o \ - imDefFlt.o \ - imDefIc.o \ - imDefIm.o \ - imDefLkup.o \ - imDispch.o \ - imEvToWire.o \ - imExten.o \ - imImSw.o \ - imInsClbk.o \ - imInt.o \ - imLcFlt.o \ - imLcGIc.o \ - imLcIc.o \ - imLcIm.o \ - imLcLkup.o \ - imLcPrs.o \ - imLcSIc.o \ - imRm.o \ - imRmAttr.o \ - imThaiFlt.o \ - imThaiIc.o \ - imThaiIm.o \ - imTrX.o \ - imTransR.o \ - imTrans.o \ - lcGenConv.o \ - lcUTF8Load.o \ - omDefault.o \ - omGeneric.o \ - omImText.o \ - omText.o \ - omTextEsc.o \ - omTextExt.o \ - omTextPer.o \ - omXChar.o - -LCOBJS = \ - SetLocale.o \ - imConv.o \ - imKStoUCS.o \ - lcCT.o \ - lcCharSet.o \ - lcConv.o \ - lcDB.o \ - lcDefConv.o \ - lcFile.o \ - lcGeneric.o \ - lcInit.o \ - lcPrTxt.o \ - lcPubWrap.o \ - lcPublic.o \ - lcRM.o \ - lcStd.o \ - lcTxtPr.o \ - lcUtil.o \ - lcUTF8.o - -STATICLCOBJS = \ - $(STATICI18NSTATICOBJS) - -#include - -SpecialCLibObjectRule(ErrDes,$(ICONFIGFILES),$(EDB_DEFINES)) -SpecialCLibObjectRule(ConnDis,$(ICONFIGFILES),$(XDMAUTHDEFS) $(RPCDEFS) $(CONN_DEFINES) $(SOCK_DEFINES) $(POLL_DEFINES) $(XTRANS_X_DEFINES) $(K5INCL) $(K5DEFS)) -SpecialCLibObjectRule(x11_trans,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES) $(XTRANS_X_DEFINES) $(POLL_DEFINES)) -SpecialCLibObjectRule(xim_trans,$(ICONFIGFILES),$(TRANS_INCLUDES) $(CONN_DEFINES) $(SOCK_DEFINES) $(XTRANS_XIM_DEFINES) $(POLL_DEFINES)) -SpecialCLibObjectRule(OpenDis,$(ICONFIGFILES),$(BC_DEFINES) $(OPEN_DEFINES) $(XTRANS_X_DEFINES) $(XKB_DEFINES)) -SpecialCLibObjectRule(XlibInt,$(ICONFIGFILES),$(CONN_DEFINES) $(POLL_DEFINES) $(XTRANS_X_DEFINES)) -SpecialCLibObjectRule(Font,$(ICONFIGFILES),$(SHM_DEFINES) $(XF86BIGFONT_DEFINES)) -SpecialCLibObjectRule(FontInfo,$(ICONFIGFILES),$(SHM_DEFINES) $(XF86BIGFONT_DEFINES)) -SpecialCLibObjectRule(cmsColNm,$(ICONFIGFILES),$(CMS_DEFINES)) -SpecialCLibObjectRule(globals,$(ICONFIGFILES),$(CONN_DEFINES)) -SpecialCLibObjectRule(Context,$(ICONFIGFILES),$(BC_DEFINES)) -SpecialCLibObjectRule(Xrm,$(_NOOP_),$(RCONST_DEFINES)) -SpecialCLibObjectRule(imTransR,$(ICONFIGFILES),$(CONN_DEFINES) $(XTRANS_XIM_DEFINES)) -SpecialCLibObjectRule(imTrans,$(ICONFIGFILES),$(CONN_DEFINES) $(XTRANS_XIM_DEFINES)) -SpecialCLibObjectRule(lcFile,$(ICONFIGFILES),$(XLC_DEFINES) $(SETID_DEFINES)) -#if BuildXKBlib -SpecialCLibObjectRule(XKBCvt,$(_NOOP_),$(RCONST_DEFINES)) -SpecialCLibObjectRule(KeyBind,$(ICONFIGFILES),$(XKB_DEFINES)) -SpecialCLibObjectRule(XKBBind,$(ICONFIGFILES),$(XKB_DEFINES)) -SpecialCLibObjectRule(imConv,$(ICONFIGFILES),$(XKB_DEFINES)) -#endif -#if BuildLoadableXlibXcursor -SpecialCLibObjectRuleSeparateOpts(CrCursor,$(ICONFIGFILES),$(_NOOP_),$(XCURSOR_DEFINES)) -SpecialCLibObjectRuleSeparateOpts(CrGlCur,$(ICONFIGFILES),$(_NOOP_),$(XCURSOR_DEFINES)) -SpecialCLibObjectRuleSeparateOpts(CrPixmap,$(ICONFIGFILES),$(_NOOP_),$(XCURSOR_DEFINES)) -SpecialCLibObjectRuleSeparateOpts(PutImage,$(ICONFIGFILES),$(_NOOP_),$(XCURSOR_DEFINES)) -#endif - -#if InstallXcmsTxt -InstallNonExecFile(Xcms.txt,$(LIBDIR)) -#endif -InstallNonExecFile(XErrorDB,$(LIBDIR)) -InstallLintLibrary(X11,$(LINTLIBDIR)) - -MAKEKEYS = ./makekeys -KEYSYMDEFS = $(XINCLUDESRC)/keysymdef.h $(XINCLUDESRC)/XF86keysym.h $(XINCLUDESRC)/Sunkeysym.h $(XINCLUDESRC)/DECkeysym.h $(XINCLUDESRC)/HPkeysym.h - -#if CrossCompiling -HOST_LDLIBS= -HOST_CFLAGS=$(TOP_INCLUDES) $(INCLUDES) $(BOOTSTRAPCFLAGS) \ - $(CROSSCOMPILEDEFINES) $(CROSSCOMPILEBOOTSTRAPDEFINES) -#else -HOST_LDLIBS=$(LDLIBS) -HOST_CFLAGS=$(CFLAGS) -#endif - -ks_tables.h: $(KEYSYMDEFS) util/makekeys.c - RemoveFiles($@ HostProgramTargetName(makekeys) makekeys.Osuf) - -HostLinkRule(HostProgramTargetName(makekeys),$(HOST_CFLAGS) $(LOCAL_LDFLAGS),util/makekeys.c,$(HOST_LDLIBS)) - RunProgram(MAKEKEYS, $(KEYSYMDEFS) > ks_tables_h) - $(MV) ks_tables_h $@ - RemoveFiles(HostProgramTargetName(makekeys) makekeys.Osuf ks_tables_h) - -includes:: ks_tables.h - -CONFIGURE ?= ./configure - -depend:: ks_tables.h - -clean:: - RemoveFiles(ks_tables_h ks_tables.h HostProgramTargetName(makekeys)) - -KeysymStr.o: ks_tables.h - -StrKeysym.o: ks_tables.h - -DependTarget3($(SRCS1),$(SRCS2),$(SRCS3) $(EXTRASRCS)) - -#endif - -includes:: XlibConf.h pathmax.h - -#include - -#if ThreadedProject -#define XThreadsDefine echo '#ifndef XTHREADS' >> $@ @@\ - echo '#define XTHREADS' >> $@ @@\ - echo '#endif' >> $@ -#else -#define XThreadsDefine echo '#undef XTHREADS' >> $@ -#endif - -#if HasThreadSafeAPI -#define MTSafeAPIDefine echo '#ifndef XUSE_MTSAFE_API' >> $@ @@\ - echo '#define XUSE_MTSAFE_API' >> $@ @@\ - echo '#endif' >> $@ -#else -#define MTSafeAPIDefine echo '#undef XUSE_MTSAFE_API' >> $@ -#endif - -XlibConf.h: - echo '/* Defines needed to use Xlib from non-imake projects */' > $@ - XThreadsDefine - MTSafeAPIDefine - -/* create libX11 links in exports/lib */ -libX11-links: - MakeDir($(BUILDLIBDIR)) - @MAJREV=`echo $(SOXLIBREV) | cut -d. -f1`;\ - (for i in "" .$$MAJREV .$(SOXLIBREV); do\ - t="lib$(LIBNAME).so$$i";\ - l="libX11.so$$i";\ - $(RM) "$(BUILDLIBDIR)/$$l";\ - (set -x; $(LN) "$$t" "$(BUILDLIBDIR)/$$l");\ - done) - -/* remove libX11 _and_ libNX_X11 links in epxorts/lib */ -/* Disable this for now, refer to the comments regarding libX11-links. */ -#clean:: -# @MAJREV=`echo $(SOXLIBREV) | cut -d. -f1`;\ -# set -x; for i in "" .$$MAJREV .$(SOXLIBREV); do\ -# $(RM) "$(BUILDLIBDIR)/lib$(LIBNAME).so$$i" "$(BUILDLIBDIR)/libX11.so$$i";\ -# done diff --git a/nx-X11/lib/X11/InitExt.c b/nx-X11/lib/X11/InitExt.c deleted file mode 100644 index d02527d5c..000000000 --- a/nx-X11/lib/X11/InitExt.c +++ /dev/null @@ -1,409 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -/* - * This routine is used to link a extension in so it will be called - * at appropriate times. - */ - -XExtCodes *XInitExtension ( - Display *dpy, - _Xconst char *name) -{ - XExtCodes codes; /* temp. place for extension information. */ - register _XExtension *ext;/* need a place to build it all */ - if (!XQueryExtension(dpy, name, - &codes.major_opcode, &codes.first_event, - &codes.first_error)) return (NULL); - - LockDisplay (dpy); - if (! (ext = Xcalloc (1, sizeof (_XExtension))) || - ! (ext->name = strdup(name))) { - Xfree(ext); - UnlockDisplay(dpy); - return (XExtCodes *) NULL; - } - codes.extension = dpy->ext_number++; - ext->codes = codes; - - /* chain it onto the display list */ - ext->next = dpy->ext_procs; - dpy->ext_procs = ext; - UnlockDisplay (dpy); - - return (&ext->codes); /* tell him which extension */ -} - -XExtCodes *XAddExtension (Display *dpy) -{ - register _XExtension *ext; - - LockDisplay (dpy); - if (! (ext = Xcalloc (1, sizeof (_XExtension)))) { - UnlockDisplay(dpy); - return (XExtCodes *) NULL; - } - ext->codes.extension = dpy->ext_number++; - - /* chain it onto the display list */ - ext->next = dpy->ext_procs; - dpy->ext_procs = ext; - UnlockDisplay (dpy); - - return (&ext->codes); /* tell him which extension */ -} - -static _XExtension *XLookupExtension ( - register Display *dpy, /* display */ - register int extension) /* extension number */ -{ - register _XExtension *ext; - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->codes.extension == extension) return (ext); - return (NULL); -} - -XExtData **XEHeadOfExtensionList(XEDataObject object) -{ - return *(XExtData ***)&object; -} - -int -XAddToExtensionList( - XExtData **structure, - XExtData *ext_data) -{ - ext_data->next = *structure; - *structure = ext_data; - return 1; -} - -XExtData *XFindOnExtensionList( - XExtData **structure, - int number) -{ - XExtData *ext; - - ext = *structure; - while (ext && (ext->number != number)) - ext = ext->next; - return ext; -} - -/* - * Routines to hang procs on the extension structure. - */ -CreateGCType XESetCreateGC( - Display *dpy, /* display */ - int extension, /* extension number */ - CreateGCType proc) /* routine to call when GC created */ -{ - register _XExtension *e; /* for lookup of extension */ - register CreateGCType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->create_GC; - e->create_GC = proc; - UnlockDisplay(dpy); - return (CreateGCType)oldproc; -} - -CopyGCType XESetCopyGC( - Display *dpy, /* display */ - int extension, /* extension number */ - CopyGCType proc) /* routine to call when GC copied */ -{ - register _XExtension *e; /* for lookup of extension */ - register CopyGCType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->copy_GC; - e->copy_GC = proc; - UnlockDisplay(dpy); - return (CopyGCType)oldproc; -} - -FlushGCType XESetFlushGC( - Display *dpy, /* display */ - int extension, /* extension number */ - FlushGCType proc) /* routine to call when GC copied */ -{ - register _XExtension *e; /* for lookup of extension */ - register FlushGCType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->flush_GC; - e->flush_GC = proc; - UnlockDisplay(dpy); - return (FlushGCType)oldproc; -} - -FreeGCType XESetFreeGC( - Display *dpy, /* display */ - int extension, /* extension number */ - FreeGCType proc) /* routine to call when GC freed */ -{ - register _XExtension *e; /* for lookup of extension */ - register FreeGCType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->free_GC; - e->free_GC = proc; - UnlockDisplay(dpy); - return (FreeGCType)oldproc; -} - -CreateFontType XESetCreateFont( - Display *dpy, /* display */ - int extension, /* extension number */ - CreateFontType proc) /* routine to call when font created */ -{ - register _XExtension *e; /* for lookup of extension */ - register CreateFontType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->create_Font; - e->create_Font = proc; - UnlockDisplay(dpy); - return (CreateFontType)oldproc; -} - -FreeFontType XESetFreeFont( - Display *dpy, /* display */ - int extension, /* extension number */ - FreeFontType proc) /* routine to call when font freed */ -{ - register _XExtension *e; /* for lookup of extension */ - register FreeFontType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->free_Font; - e->free_Font = proc; - UnlockDisplay(dpy); - return (FreeFontType)oldproc; -} - -CloseDisplayType XESetCloseDisplay( - Display *dpy, /* display */ - int extension, /* extension number */ - CloseDisplayType proc) /* routine to call when display closed */ -{ - register _XExtension *e; /* for lookup of extension */ - register CloseDisplayType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->close_display; - e->close_display = proc; - UnlockDisplay(dpy); - return (CloseDisplayType)oldproc; -} - -typedef Bool (*WireToEventType) ( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -); - -WireToEventType XESetWireToEvent( - Display *dpy, /* display */ - int event_number, /* event routine to replace */ - WireToEventType proc) /* routine to call when converting event */ -{ - register WireToEventType oldproc; - if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent; - LockDisplay (dpy); - oldproc = dpy->event_vec[event_number]; - dpy->event_vec[event_number] = proc; - UnlockDisplay (dpy); - return (WireToEventType)oldproc; -} - -typedef Bool (*WireToEventCookieType) ( - Display* /* display */, - XGenericEventCookie* /* re */, - xEvent* /* event */ -); - -WireToEventCookieType XESetWireToEventCookie( - Display *dpy, /* display */ - int extension, /* extension major opcode */ - WireToEventCookieType proc /* routine to call for generic events */ - ) -{ - WireToEventCookieType oldproc; - if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie; - LockDisplay (dpy); - oldproc = dpy->generic_event_vec[extension & 0x7F]; - dpy->generic_event_vec[extension & 0x7F] = proc; - UnlockDisplay (dpy); - return (WireToEventCookieType)oldproc; -} - -typedef Bool (*CopyEventCookieType) ( - Display* /* display */, - XGenericEventCookie* /* in */, - XGenericEventCookie* /* out */ -); - -CopyEventCookieType XESetCopyEventCookie( - Display *dpy, /* display */ - int extension, /* extension major opcode */ - CopyEventCookieType proc /* routine to copy generic events */ - ) -{ - CopyEventCookieType oldproc; - if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie; - LockDisplay (dpy); - oldproc = dpy->generic_event_copy_vec[extension & 0x7F]; - dpy->generic_event_copy_vec[extension & 0x7F] = proc; - UnlockDisplay (dpy); - return (CopyEventCookieType)oldproc; -} - - -typedef Status (*EventToWireType) ( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ -); - -EventToWireType XESetEventToWire( - Display *dpy, /* display */ - int event_number, /* event routine to replace */ - EventToWireType proc) /* routine to call when converting event */ -{ - register EventToWireType oldproc; - if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent; - LockDisplay (dpy); - oldproc = dpy->wire_vec[event_number]; - dpy->wire_vec[event_number] = proc; - UnlockDisplay(dpy); - return (EventToWireType)oldproc; -} - -typedef Bool (*WireToErrorType) ( - Display* /* display */, - XErrorEvent* /* he */, - xError* /* we */ -); - -WireToErrorType XESetWireToError( - Display *dpy, /* display */ - int error_number, /* error routine to replace */ - WireToErrorType proc) /* routine to call when converting error */ -{ - register WireToErrorType oldproc = NULL; - if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError; - LockDisplay (dpy); - if (!dpy->error_vec) { - int i; - dpy->error_vec = Xmalloc(256 * sizeof(oldproc)); - for (i = 1; i < 256; i++) - dpy->error_vec[i] = _XDefaultWireError; - } - if (dpy->error_vec) { - oldproc = dpy->error_vec[error_number]; - dpy->error_vec[error_number] = proc; - } - UnlockDisplay (dpy); - return (WireToErrorType)oldproc; -} - -ErrorType XESetError( - Display *dpy, /* display */ - int extension, /* extension number */ - ErrorType proc) /* routine to call when X error happens */ -{ - register _XExtension *e; /* for lookup of extension */ - register ErrorType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->error; - e->error = proc; - UnlockDisplay(dpy); - return (ErrorType)oldproc; -} - -ErrorStringType XESetErrorString( - Display *dpy, /* display */ - int extension, /* extension number */ - ErrorStringType proc) /* routine to call when I/O error happens */ -{ - register _XExtension *e; /* for lookup of extension */ - register ErrorStringType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->error_string; - e->error_string = proc; - UnlockDisplay(dpy); - return (ErrorStringType)oldproc; -} - -PrintErrorType XESetPrintErrorValues( - Display *dpy, /* display */ - int extension, /* extension number */ - PrintErrorType proc) /* routine to call to print */ -{ - register _XExtension *e; /* for lookup of extension */ - register PrintErrorType oldproc; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->error_values; - e->error_values = proc; - UnlockDisplay(dpy); - return (PrintErrorType)oldproc; -} - -BeforeFlushType XESetBeforeFlush( - Display *dpy, /* display */ - int extension, /* extension number */ - BeforeFlushType proc) /* routine to call on flush */ -{ - register _XExtension *e; /* for lookup of extension */ - register BeforeFlushType oldproc; - register _XExtension *ext; - if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); - LockDisplay(dpy); - oldproc = e->before_flush; - e->before_flush = proc; - for (ext = dpy->flushes; ext && ext != e; ext = ext->next) - ; - if (!ext) { - e->next_flush = dpy->flushes; - dpy->flushes = e; - } - UnlockDisplay(dpy); - return (BeforeFlushType)oldproc; -} diff --git a/nx-X11/lib/X11/InsCmap.c b/nx-X11/lib/X11/InsCmap.c deleted file mode 100644 index 735ab080e..000000000 --- a/nx-X11/lib/X11/InsCmap.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XInstallColormap( - register Display *dpy, - Colormap cmap) -{ - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(InstallColormap, cmap, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/IntAtom.c b/nx-X11/lib/X11/IntAtom.c deleted file mode 100644 index 3042b65dd..000000000 --- a/nx-X11/lib/X11/IntAtom.c +++ /dev/null @@ -1,297 +0,0 @@ -/* - -Copyright 1986, 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xintatom.h" - -#define HASH(sig) ((sig) & (TABLESIZE-1)) -#define REHASHVAL(sig) ((((sig) % (TABLESIZE-3)) + 2) | 1) -#define REHASH(idx,rehash) ((idx + rehash) & (TABLESIZE-1)) - -void -_XFreeAtomTable(Display *dpy) -{ - register Entry *table; - register int i; - register Entry e; - - if (dpy->atoms) { - table = dpy->atoms->table; - for (i = TABLESIZE; --i >= 0; ) { - if ((e = *table++) && (e != RESERVED)) - Xfree(e); - } - Xfree(dpy->atoms); - } -} - -static -Atom _XInternAtom( - Display *dpy, - _Xconst char *name, - Bool onlyIfExists, - unsigned long *psig, - int *pidx, - int *pn) -{ - register AtomTable *atoms; - register char *s1, c, *s2; - register unsigned long sig; - register int idx = 0, i; - Entry e; - int n, firstidx, rehash = 0; - xInternAtomReq *req; - - /* look in the cache first */ - if (!(atoms = dpy->atoms)) { - dpy->atoms = atoms = Xcalloc(1, sizeof(AtomTable)); - dpy->free_funcs->atoms = _XFreeAtomTable; - } - sig = 0; - for (s1 = (char *)name; (c = *s1++); ) - sig += c; - n = s1 - (char *)name - 1; - if (atoms) { - firstidx = idx = HASH(sig); - while ((e = atoms->table[idx])) { - if (e != RESERVED && e->sig == sig) { - for (i = n, s1 = (char *)name, s2 = EntryName(e); --i >= 0; ) { - if (*s1++ != *s2++) - goto nomatch; - } - if (!*s2) - return e->atom; - } -nomatch: if (idx == firstidx) - rehash = REHASHVAL(sig); - idx = REHASH(idx, rehash); - if (idx == firstidx) - break; - } - } - *psig = sig; - *pidx = idx; - if (atoms && !atoms->table[idx]) - atoms->table[idx] = RESERVED; /* reserve slot */ - *pn = n; - /* not found, go to the server */ - GetReq(InternAtom, req); - req->nbytes = n; - req->onlyIfExists = onlyIfExists; - req->length += (n+3)>>2; - Data(dpy, name, n); - return None; -} - -void -_XUpdateAtomCache( - Display *dpy, - const char *name, - Atom atom, - unsigned long sig, - int idx, - int n) -{ - Entry e, oe; - register char *s1; - register char c; - int firstidx, rehash; - - if (!dpy->atoms) { - if (idx < 0) { - dpy->atoms = Xcalloc(1, sizeof(AtomTable)); - dpy->free_funcs->atoms = _XFreeAtomTable; - } - if (!dpy->atoms) - return; - } - if (!sig) { - for (s1 = (char *)name; (c = *s1++); ) - sig += c; - n = s1 - (char *)name - 1; - if (idx < 0) { - firstidx = idx = HASH(sig); - if (dpy->atoms->table[idx]) { - rehash = REHASHVAL(sig); - do - idx = REHASH(idx, rehash); - while (idx != firstidx && dpy->atoms->table[idx]); - } - } - } - e = Xmalloc(sizeof(EntryRec) + n + 1); - if (e) { - e->sig = sig; - e->atom = atom; - strcpy(EntryName(e), name); - if ((oe = dpy->atoms->table[idx]) && (oe != RESERVED)) - Xfree(oe); - dpy->atoms->table[idx] = e; - } -} - -Atom -XInternAtom ( - Display *dpy, - const char *name, - Bool onlyIfExists) -{ - Atom atom; - unsigned long sig; - int idx, n; - xInternAtomReply rep; - - if (!name) - name = ""; - LockDisplay(dpy); - if ((atom = _XInternAtom(dpy, name, onlyIfExists, &sig, &idx, &n))) { - UnlockDisplay(dpy); - return atom; - } - if (dpy->atoms && dpy->atoms->table[idx] == RESERVED) - dpy->atoms->table[idx] = NULL; /* unreserve slot */ - if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { - if ((atom = rep.atom)) - _XUpdateAtomCache(dpy, name, atom, sig, idx, n); - } - UnlockDisplay(dpy); - SyncHandle(); - return (rep.atom); -} - -typedef struct { - unsigned long start_seq; - unsigned long stop_seq; - char **names; - Atom *atoms; - int count; - Status status; -} _XIntAtomState; - -static -Bool _XIntAtomHandler( - register Display *dpy, - register xReply *rep, - char *buf, - int len, - XPointer data) -{ - register _XIntAtomState *state; - register int i, idx = 0; - xInternAtomReply replbuf; - register xInternAtomReply *repl; - - state = (_XIntAtomState *)data; - if (dpy->last_request_read < state->start_seq || - dpy->last_request_read > state->stop_seq) - return False; - for (i = 0; i < state->count; i++) { - if (state->atoms[i] & 0x80000000) { - idx = ~state->atoms[i]; - state->atoms[i] = None; - break; - } - } - if (i >= state->count) - return False; - if (rep->generic.type == X_Error) { - state->status = 0; - return False; - } - repl = (xInternAtomReply *) - _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, - (SIZEOF(xInternAtomReply) - SIZEOF(xReply)) >> 2, - True); - if ((state->atoms[i] = repl->atom)) - _XUpdateAtomCache(dpy, state->names[i], (Atom) repl->atom, - (unsigned long)0, idx, 0); - return True; -} - -Status -XInternAtoms ( - Display *dpy, - char **names, - int count, - Bool onlyIfExists, - Atom *atoms_return) -{ - int i, idx, n, tidx; - unsigned long sig; - _XAsyncHandler async; - _XIntAtomState async_state; - int missed = -1; - xInternAtomReply rep; - - LockDisplay(dpy); - async_state.start_seq = dpy->request + 1; - async_state.atoms = atoms_return; - async_state.names = names; - async_state.count = count - 1; - async_state.status = 1; - async.next = dpy->async_handlers; - async.handler = _XIntAtomHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - for (i = 0; i < count; i++) { - if (!(atoms_return[i] = _XInternAtom(dpy, names[i], onlyIfExists, - &sig, &idx, &n))) { - missed = i; - atoms_return[i] = ~((Atom)idx); - async_state.stop_seq = dpy->request; - } - } - if (missed >= 0) { - if (dpy->atoms) { - /* unreserve anything we just reserved */ - for (i = 0; i < count; i++) { - if (atoms_return[i] & 0x80000000) { - tidx = ~atoms_return[i]; - if (dpy->atoms->table[tidx] == RESERVED) - dpy->atoms->table[tidx] = NULL; - } - } - } - if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { - if ((atoms_return[missed] = rep.atom)) - _XUpdateAtomCache(dpy, names[missed], (Atom) rep.atom, - sig, idx, n); - } else { - atoms_return[missed] = None; - async_state.status = 0; - } - } - DeqAsyncHandler(dpy, &async); - UnlockDisplay(dpy); - if (missed >= 0) - SyncHandle(); - return async_state.status; -} diff --git a/nx-X11/lib/X11/Key.h b/nx-X11/lib/X11/Key.h deleted file mode 100644 index 3a1639c5c..000000000 --- a/nx-X11/lib/X11/Key.h +++ /dev/null @@ -1,20 +0,0 @@ - -#ifndef _KEY_H_ -#define _KEY_H_ - -#include -#include - -#ifndef NEEDKTABLE -extern const unsigned char _XkeyTable[]; -#endif - -extern int -_XKeyInitialize( - Display *dpy); - -extern XrmDatabase -_XInitKeysymDB( - void); - -#endif /* _KEY_H_ */ diff --git a/nx-X11/lib/X11/KeyBind.c b/nx-X11/lib/X11/KeyBind.c deleted file mode 100644 index acaf7fd8f..000000000 --- a/nx-X11/lib/X11/KeyBind.c +++ /dev/null @@ -1,1005 +0,0 @@ -/* - -Copyright 1985, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* Beware, here be monsters (still under construction... - JG */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#define XK_MISCELLANY -#define XK_LATIN1 -#define XK_LATIN2 -#define XK_LATIN3 -#define XK_LATIN4 -#define XK_LATIN8 -#define XK_LATIN9 -#define XK_CYRILLIC -#define XK_GREEK -#define XK_ARMENIAN -#define XK_CAUCASUS -#define XK_VIETNAMESE -#define XK_XKB_KEYS -#define XK_SINHALA -#include -#include - -#include "Xresource.h" -#include "Key.h" - -#ifdef XKB -#include "XKBlib.h" -#include "XKBlibint.h" -#define XKeycodeToKeysym _XKeycodeToKeysym -#define XKeysymToKeycode _XKeysymToKeycode -#define XLookupKeysym _XLookupKeysym -#define XRefreshKeyboardMapping _XRefreshKeyboardMapping -#define XLookupString _XLookupString -/* XKBBind.c */ -#else -#define XkbKeysymToModifiers _XKeysymToModifiers -#endif - -#define AllMods (ShiftMask|LockMask|ControlMask| \ - Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) - -static void -ComputeMaskFromKeytrans( - Display *dpy, - register struct _XKeytrans *p); - -struct _XKeytrans { - struct _XKeytrans *next;/* next on list */ - char *string; /* string to return when the time comes */ - int len; /* length of string (since NULL is legit)*/ - KeySym key; /* keysym rebound */ - unsigned int state; /* modifier state */ - KeySym *modifiers; /* modifier keysyms you want */ - int mlen; /* length of modifier list */ -}; - -static KeySym -KeyCodetoKeySym(register Display *dpy, KeyCode keycode, int col) -{ - register int per = dpy->keysyms_per_keycode; - register KeySym *syms; - KeySym lsym, usym; - - if ((col < 0) || ((col >= per) && (col > 3)) || - ((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) - return NoSymbol; - - syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; - if (col < 4) { - if (col > 1) { - while ((per > 2) && (syms[per - 1] == NoSymbol)) - per--; - if (per < 3) - col -= 2; - } - if ((per <= (col|1)) || (syms[col|1] == NoSymbol)) { - XConvertCase(syms[col&~1], &lsym, &usym); - if (!(col & 1)) - return lsym; - else if (usym == lsym) - return NoSymbol; - else - return usym; - } - } - return syms[col]; -} - -KeySym -XKeycodeToKeysym(Display *dpy, -#if NeedWidePrototypes - unsigned int kc, -#else - KeyCode kc, -#endif - int col) -{ - if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) - return NoSymbol; - return KeyCodetoKeySym(dpy, kc, col); -} - -KeyCode -XKeysymToKeycode( - Display *dpy, - KeySym ks) -{ - register int i, j; - - if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) - return (KeyCode) 0; - for (j = 0; j < dpy->keysyms_per_keycode; j++) { - for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) { - if (KeyCodetoKeySym(dpy, (KeyCode) i, j) == ks) - return i; - } - } - return 0; -} - -KeySym -XLookupKeysym( - register XKeyEvent *event, - int col) -{ - if ((! event->display->keysyms) && (! _XKeyInitialize(event->display))) - return NoSymbol; - return KeyCodetoKeySym(event->display, event->keycode, col); -} - -static void -ResetModMap( - Display *dpy) -{ - register XModifierKeymap *map; - register int i, j, n; - KeySym sym; - register struct _XKeytrans *p; - - map = dpy->modifiermap; - /* If any Lock key contains Caps_Lock, then interpret as Caps_Lock, - * else if any contains Shift_Lock, then interpret as Shift_Lock, - * else ignore Lock altogether. - */ - dpy->lock_meaning = NoSymbol; - /* Lock modifiers are in the second row of the matrix */ - n = 2 * map->max_keypermod; - for (i = map->max_keypermod; i < n; i++) { - for (j = 0; j < dpy->keysyms_per_keycode; j++) { - sym = KeyCodetoKeySym(dpy, map->modifiermap[i], j); - if (sym == XK_Caps_Lock) { - dpy->lock_meaning = XK_Caps_Lock; - break; - } else if (sym == XK_Shift_Lock) { - dpy->lock_meaning = XK_Shift_Lock; - } - else if (sym == XK_ISO_Lock) { - dpy->lock_meaning = XK_Caps_Lock; - break; - } - } - } - /* Now find any Mod modifier acting as the Group or Numlock modifier */ - dpy->mode_switch = 0; - dpy->num_lock = 0; - n *= 4; - for (i = 3*map->max_keypermod; i < n; i++) { - for (j = 0; j < dpy->keysyms_per_keycode; j++) { - sym = KeyCodetoKeySym(dpy, map->modifiermap[i], j); - if (sym == XK_Mode_switch) - dpy->mode_switch |= 1 << (i / map->max_keypermod); - if (sym == XK_Num_Lock) - dpy->num_lock |= 1 << (i / map->max_keypermod); - } - } - for (p = dpy->key_bindings; p; p = p->next) - ComputeMaskFromKeytrans(dpy, p); -} - -static int -InitModMap( - Display *dpy) -{ - register XModifierKeymap *map; - - if (! (map = XGetModifierMapping(dpy))) - return 0; - LockDisplay(dpy); - if (dpy->modifiermap) - XFreeModifiermap(dpy->modifiermap); - dpy->modifiermap = map; - dpy->free_funcs->modifiermap = XFreeModifiermap; - if (dpy->keysyms) - ResetModMap(dpy); - UnlockDisplay(dpy); - return 1; -} - -int -XRefreshKeyboardMapping(register XMappingEvent *event) -{ - - if(event->request == MappingKeyboard) { - /* XXX should really only refresh what is necessary - * for now, make initialize test fail - */ - LockDisplay(event->display); - if (event->display->keysyms) { - Xfree (event->display->keysyms); - event->display->keysyms = NULL; - } - UnlockDisplay(event->display); - } - if(event->request == MappingModifier) { - LockDisplay(event->display); - if (event->display->modifiermap) { - XFreeModifiermap(event->display->modifiermap); - event->display->modifiermap = NULL; - } - UnlockDisplay(event->display); - /* go ahead and get it now, since initialize test may not fail */ - if (event->display->keysyms) - (void) InitModMap(event->display); - } - return 1; -} - -int -_XKeyInitialize( - Display *dpy) -{ - int per, n; - KeySym *keysyms; - - /* - * lets go get the keysyms from the server. - */ - if (!dpy->keysyms) { - n = dpy->max_keycode - dpy->min_keycode + 1; - keysyms = XGetKeyboardMapping (dpy, (KeyCode) dpy->min_keycode, - n, &per); - /* keysyms may be NULL */ - if (! keysyms) return 0; - - LockDisplay(dpy); - - Xfree (dpy->keysyms); - dpy->keysyms = keysyms; - dpy->keysyms_per_keycode = per; - if (dpy->modifiermap) - ResetModMap(dpy); - - UnlockDisplay(dpy); - } - if (!dpy->modifiermap) - return InitModMap(dpy); - return 1; -} - -static void -UCSConvertCase( register unsigned code, - KeySym *lower, - KeySym *upper ) -{ - /* Case conversion for UCS, as in Unicode Data version 4.0.0 */ - /* NB: Only converts simple one-to-one mappings. */ - - /* Tables are used where they take less space than */ - /* the code to work out the mappings. Zero values mean */ - /* undefined code points. */ - - static unsigned short const IPAExt_upper_mapping[] = { /* part only */ - 0x0181, 0x0186, 0x0255, 0x0189, 0x018A, - 0x0258, 0x018F, 0x025A, 0x0190, 0x025C, 0x025D, 0x025E, 0x025F, - 0x0193, 0x0261, 0x0262, 0x0194, 0x0264, 0x0265, 0x0266, 0x0267, - 0x0197, 0x0196, 0x026A, 0x026B, 0x026C, 0x026D, 0x026E, 0x019C, - 0x0270, 0x0271, 0x019D, 0x0273, 0x0274, 0x019F, 0x0276, 0x0277, - 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, 0x027D, 0x027E, 0x027F, - 0x01A6, 0x0281, 0x0282, 0x01A9, 0x0284, 0x0285, 0x0286, 0x0287, - 0x01AE, 0x0289, 0x01B1, 0x01B2, 0x028C, 0x028D, 0x028E, 0x028F, - 0x0290, 0x0291, 0x01B7 - }; - - static unsigned short const LatinExtB_upper_mapping[] = { /* first part only */ - 0x0180, 0x0181, 0x0182, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, - 0x0187, 0x0189, 0x018A, 0x018B, 0x018B, 0x018D, 0x018E, 0x018F, - 0x0190, 0x0191, 0x0191, 0x0193, 0x0194, 0x01F6, 0x0196, 0x0197, - 0x0198, 0x0198, 0x019A, 0x019B, 0x019C, 0x019D, 0x0220, 0x019F, - 0x01A0, 0x01A0, 0x01A2, 0x01A2, 0x01A4, 0x01A4, 0x01A6, 0x01A7, - 0x01A7, 0x01A9, 0x01AA, 0x01AB, 0x01AC, 0x01AC, 0x01AE, 0x01AF, - 0x01AF, 0x01B1, 0x01B2, 0x01B3, 0x01B3, 0x01B5, 0x01B5, 0x01B7, - 0x01B8, 0x01B8, 0x01BA, 0x01BB, 0x01BC, 0x01BC, 0x01BE, 0x01F7, - 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C4, 0x01C4, 0x01C7, - 0x01C7, 0x01C7, 0x01CA, 0x01CA, 0x01CA - }; - - static unsigned short const LatinExtB_lower_mapping[] = { /* first part only */ - 0x0180, 0x0253, 0x0183, 0x0183, 0x0185, 0x0185, 0x0254, 0x0188, - 0x0188, 0x0256, 0x0257, 0x018C, 0x018C, 0x018D, 0x01DD, 0x0259, - 0x025B, 0x0192, 0x0192, 0x0260, 0x0263, 0x0195, 0x0269, 0x0268, - 0x0199, 0x0199, 0x019A, 0x019B, 0x026F, 0x0272, 0x019E, 0x0275, - 0x01A1, 0x01A1, 0x01A3, 0x01A3, 0x01A5, 0x01A5, 0x0280, 0x01A8, - 0x01A8, 0x0283, 0x01AA, 0x01AB, 0x01AD, 0x01AD, 0x0288, 0x01B0, - 0x01B0, 0x028A, 0x028B, 0x01B4, 0x01B4, 0x01B6, 0x01B6, 0x0292, - 0x01B9, 0x01B9, 0x01BA, 0x01BB, 0x01BD, 0x01BD, 0x01BE, 0x01BF, - 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C6, 0x01C6, 0x01C6, 0x01C9, - 0x01C9, 0x01C9, 0x01CC, 0x01CC, 0x01CC - }; - - static unsigned short const Greek_upper_mapping[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, - 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x0386, 0x0387, - 0x0388, 0x0389, 0x038A, 0x0000, 0x038C, 0x0000, 0x038E, 0x038F, - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x0386, 0x0388, 0x0389, 0x038A, - 0x03B0, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, - 0x03A0, 0x03A1, 0x03A3, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, - 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x038C, 0x038E, 0x038F, 0x0000, - 0x0392, 0x0398, 0x03D2, 0x03D3, 0x03D4, 0x03A6, 0x03A0, 0x03D7, - 0x03D8, 0x03D8, 0x03DA, 0x03DA, 0x03DC, 0x03DC, 0x03DE, 0x03DE, - 0x03E0, 0x03E0, 0x03E2, 0x03E2, 0x03E4, 0x03E4, 0x03E6, 0x03E6, - 0x03E8, 0x03E8, 0x03EA, 0x03EA, 0x03EC, 0x03EC, 0x03EE, 0x03EE, - 0x039A, 0x03A1, 0x03F9, 0x03F3, 0x03F4, 0x0395, 0x03F6, 0x03F7, - 0x03F7, 0x03F9, 0x03FA, 0x03FA, 0x0000, 0x0000, 0x0000, 0x0000 - }; - - static unsigned short const Greek_lower_mapping[] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, - 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, - 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x03AC, 0x0387, - 0x03AD, 0x03AE, 0x03AF, 0x0000, 0x03CC, 0x0000, 0x03CD, 0x03CE, - 0x0390, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x0000, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, - 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, - 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, - 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, - 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000, - 0x03D0, 0x03D1, 0x03D2, 0x03D3, 0x03D4, 0x03D5, 0x03D6, 0x03D7, - 0x03D9, 0x03D9, 0x03DB, 0x03DB, 0x03DD, 0x03DD, 0x03DF, 0x03DF, - 0x03E1, 0x03E1, 0x03E3, 0x03E3, 0x03E5, 0x03E5, 0x03E7, 0x03E7, - 0x03E9, 0x03E9, 0x03EB, 0x03EB, 0x03ED, 0x03ED, 0x03EF, 0x03EF, - 0x03F0, 0x03F1, 0x03F2, 0x03F3, 0x03B8, 0x03F5, 0x03F6, 0x03F8, - 0x03F8, 0x03F2, 0x03FB, 0x03FB, 0x0000, 0x0000, 0x0000, 0x0000 - }; - - static unsigned short const GreekExt_lower_mapping[] = { - 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, - 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, - 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, - 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, - 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, - 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, - 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, - 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, - 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, - 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, - 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, - 0x0000, 0x1F51, 0x0000, 0x1F53, 0x0000, 0x1F55, 0x0000, 0x1F57, - 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, - 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, - 0x1F70, 0x1F71, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1F76, 0x1F77, - 0x1F78, 0x1F79, 0x1F7A, 0x1F7B, 0x1F7C, 0x1F7D, 0x0000, 0x0000, - 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, - 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, - 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, - 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, - 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, - 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, - 0x1FB0, 0x1FB1, 0x1FB2, 0x1FB3, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, - 0x1FB0, 0x1FB1, 0x1F70, 0x1F71, 0x1FB3, 0x1FBD, 0x1FBE, 0x1FBF, - 0x1FC0, 0x1FC1, 0x1FC2, 0x1FC3, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, - 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1FC3, 0x1FCD, 0x1FCE, 0x1FCF, - 0x1FD0, 0x1FD1, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, - 0x1FD0, 0x1FD1, 0x1F76, 0x1F77, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, - 0x1FE0, 0x1FE1, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FE5, 0x1FE6, 0x1FE7, - 0x1FE0, 0x1FE1, 0x1F7A, 0x1F7B, 0x1FE5, 0x1FED, 0x1FEE, 0x1FEF, - 0x0000, 0x0000, 0x1FF2, 0x1FF3, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, - 0x1F78, 0x1F79, 0x1F7C, 0x1F7D, 0x1FF3, 0x1FFD, 0x1FFE, 0x0000 - }; - - static unsigned short const GreekExt_upper_mapping[] = { - 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, - 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, - 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, - 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, - 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, - 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, - 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, - 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, - 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, - 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, - 0x1F50, 0x1F59, 0x1F52, 0x1F5B, 0x1F54, 0x1F5D, 0x1F56, 0x1F5F, - 0x0000, 0x1F59, 0x0000, 0x1F5B, 0x0000, 0x1F5D, 0x0000, 0x1F5F, - 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, - 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, - 0x1FBA, 0x1FBB, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FDA, 0x1FDB, - 0x1FF8, 0x1FF9, 0x1FEA, 0x1FEB, 0x1FFA, 0x1FFB, 0x0000, 0x0000, - 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, - 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, - 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, - 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, - 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, - 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, - 0x1FB8, 0x1FB9, 0x1FB2, 0x1FBC, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, - 0x1FB8, 0x1FB9, 0x1FBA, 0x1FBB, 0x1FBC, 0x1FBD, 0x0399, 0x1FBF, - 0x1FC0, 0x1FC1, 0x1FC2, 0x1FCC, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, - 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FCC, 0x1FCD, 0x1FCE, 0x1FCF, - 0x1FD8, 0x1FD9, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, - 0x1FD8, 0x1FD9, 0x1FDA, 0x1FDB, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, - 0x1FE8, 0x1FE9, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FEC, 0x1FE6, 0x1FE7, - 0x1FE8, 0x1FE9, 0x1FEA, 0x1FEB, 0x1FEC, 0x1FED, 0x1FEE, 0x1FEF, - 0x0000, 0x0000, 0x1FF2, 0x1FFC, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, - 0x1FF8, 0x1FF9, 0x1FFA, 0x1FFB, 0x1FFC, 0x1FFD, 0x1FFE, 0x0000 - }; - - *lower = code; - *upper = code; - - /* Basic Latin and Latin-1 Supplement, U+0000 to U+00FF */ - if (code <= 0x00ff) { - if (code >= 0x0041 && code <= 0x005a) /* A-Z */ - *lower += 0x20; - else if (code >= 0x0061 && code <= 0x007a) /* a-z */ - *upper -= 0x20; - else if ( (code >= 0x00c0 && code <= 0x00d6) || - (code >= 0x00d8 && code <= 0x00de) ) - *lower += 0x20; - else if ( (code >= 0x00e0 && code <= 0x00f6) || - (code >= 0x00f8 && code <= 0x00fe) ) - *upper -= 0x20; - else if (code == 0x00ff) /* y with diaeresis */ - *upper = 0x0178; - else if (code == 0x00b5) /* micro sign */ - *upper = 0x039c; - return; - } - - /* Latin Extended-A, U+0100 to U+017F */ - if (code >= 0x0100 && code <= 0x017f) { - if ( (code >= 0x0100 && code <= 0x012f) || - (code >= 0x0132 && code <= 0x0137) || - (code >= 0x014a && code <= 0x0177) ) { - *upper = code & ~1; - *lower = code | 1; - } - else if ( (code >= 0x0139 && code <= 0x0148) || - (code >= 0x0179 && code <= 0x017e) ) { - if (code & 1) - *lower += 1; - else - *upper -= 1; - } - else if (code == 0x0130) - *lower = 0x0069; - else if (code == 0x0131) - *upper = 0x0049; - else if (code == 0x0178) - *lower = 0x00ff; - else if (code == 0x017f) - *upper = 0x0053; - return; - } - - /* Latin Extended-B, U+0180 to U+024F */ - if (code >= 0x0180 && code <= 0x024f) { - if (code >= 0x01cd && code <= 0x01dc) { - if (code & 1) - *lower += 1; - else - *upper -= 1; - } - else if ( (code >= 0x01de && code <= 0x01ef) || - (code >= 0x01f4 && code <= 0x01f5) || - (code >= 0x01f8 && code <= 0x021f) || - (code >= 0x0222 && code <= 0x0233) ) { - *lower |= 1; - *upper &= ~1; - } - else if (code >= 0x0180 && code <= 0x01cc) { - *lower = LatinExtB_lower_mapping[code - 0x0180]; - *upper = LatinExtB_upper_mapping[code - 0x0180]; - } - else if (code == 0x01dd) - *upper = 0x018e; - else if (code == 0x01f1 || code == 0x01f2) { - *lower = 0x01f3; - *upper = 0x01f1; - } - else if (code == 0x01f3) - *upper = 0x01f1; - else if (code == 0x01f6) - *lower = 0x0195; - else if (code == 0x01f7) - *lower = 0x01bf; - else if (code == 0x0220) - *lower = 0x019e; - return; - } - - /* IPA Extensions, U+0250 to U+02AF */ - if (code >= 0x0253 && code <= 0x0292) { - *upper = IPAExt_upper_mapping[code - 0x0253]; - } - - /* Combining Diacritical Marks, U+0300 to U+036F */ - if (code == 0x0345) { - *upper = 0x0399; - } - - /* Greek and Coptic, U+0370 to U+03FF */ - if (code >= 0x0370 && code <= 0x03ff) { - *lower = Greek_lower_mapping[code - 0x0370]; - *upper = Greek_upper_mapping[code - 0x0370]; - if (*upper == 0) - *upper = code; - if (*lower == 0) - *lower = code; - } - - /* Cyrillic and Cyrillic Supplementary, U+0400 to U+052F */ - if ( (code >= 0x0400 && code <= 0x04ff) || - (code >= 0x0500 && code <= 0x052f) ) { - if (code >= 0x0400 && code <= 0x040f) - *lower += 0x50; - else if (code >= 0x0410 && code <= 0x042f) - *lower += 0x20; - else if (code >= 0x0430 && code <= 0x044f) - *upper -= 0x20; - else if (code >= 0x0450 && code <= 0x045f) - *upper -= 0x50; - else if ( (code >= 0x0460 && code <= 0x0481) || - (code >= 0x048a && code <= 0x04bf) || - (code >= 0x04d0 && code <= 0x04f5) || - (code >= 0x04f8 && code <= 0x04f9) || - (code >= 0x0500 && code <= 0x050f) ) { - *upper &= ~1; - *lower |= 1; - } - else if (code >= 0x04c1 && code <= 0x04ce) { - if (code & 1) - *lower += 1; - else - *upper -= 1; - } - } - - /* Armenian, U+0530 to U+058F */ - if (code >= 0x0530 && code <= 0x058f) { - if (code >= 0x0531 && code <= 0x0556) - *lower += 0x30; - else if (code >=0x0561 && code <= 0x0586) - *upper -= 0x30; - } - - /* Latin Extended Additional, U+1E00 to U+1EFF */ - if (code >= 0x1e00 && code <= 0x1eff) { - if ( (code >= 0x1e00 && code <= 0x1e95) || - (code >= 0x1ea0 && code <= 0x1ef9) ) { - *upper &= ~1; - *lower |= 1; - } - else if (code == 0x1e9b) - *upper = 0x1e60; - } - - /* Greek Extended, U+1F00 to U+1FFF */ - if (code >= 0x1f00 && code <= 0x1fff) { - *lower = GreekExt_lower_mapping[code - 0x1f00]; - *upper = GreekExt_upper_mapping[code - 0x1f00]; - if (*upper == 0) - *upper = code; - if (*lower == 0) - *lower = code; - } - - /* Letterlike Symbols, U+2100 to U+214F */ - if (code >= 0x2100 && code <= 0x214f) { - switch (code) { - case 0x2126: *lower = 0x03c9; break; - case 0x212a: *lower = 0x006b; break; - case 0x212b: *lower = 0x00e5; break; - } - } - /* Number Forms, U+2150 to U+218F */ - else if (code >= 0x2160 && code <= 0x216f) - *lower += 0x10; - else if (code >= 0x2170 && code <= 0x217f) - *upper -= 0x10; - /* Enclosed Alphanumerics, U+2460 to U+24FF */ - else if (code >= 0x24b6 && code <= 0x24cf) - *lower += 0x1a; - else if (code >= 0x24d0 && code <= 0x24e9) - *upper -= 0x1a; - /* Halfwidth and Fullwidth Forms, U+FF00 to U+FFEF */ - else if (code >= 0xff21 && code <= 0xff3a) - *lower += 0x20; - else if (code >= 0xff41 && code <= 0xff5a) - *upper -= 0x20; - /* Deseret, U+10400 to U+104FF */ - else if (code >= 0x10400 && code <= 0x10427) - *lower += 0x28; - else if (code >= 0x10428 && code <= 0x1044f) - *upper -= 0x28; -} - -void -XConvertCase( - register KeySym sym, - KeySym *lower, - KeySym *upper) -{ - /* Latin 1 keysym */ - if (sym < 0x100) { - UCSConvertCase(sym, lower, upper); - return; - } - - /* Unicode keysym */ - if ((sym & 0xff000000) == 0x01000000) { - UCSConvertCase((sym & 0x00ffffff), lower, upper); - *upper |= 0x01000000; - *lower |= 0x01000000; - return; - } - - /* Legacy keysym */ - - *lower = sym; - *upper = sym; - - switch(sym >> 8) { - case 1: /* Latin 2 */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym == XK_Aogonek) - *lower = XK_aogonek; - else if (sym >= XK_Lstroke && sym <= XK_Sacute) - *lower += (XK_lstroke - XK_Lstroke); - else if (sym >= XK_Scaron && sym <= XK_Zacute) - *lower += (XK_scaron - XK_Scaron); - else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) - *lower += (XK_zcaron - XK_Zcaron); - else if (sym == XK_aogonek) - *upper = XK_Aogonek; - else if (sym >= XK_lstroke && sym <= XK_sacute) - *upper -= (XK_lstroke - XK_Lstroke); - else if (sym >= XK_scaron && sym <= XK_zacute) - *upper -= (XK_scaron - XK_Scaron); - else if (sym >= XK_zcaron && sym <= XK_zabovedot) - *upper -= (XK_zcaron - XK_Zcaron); - else if (sym >= XK_Racute && sym <= XK_Tcedilla) - *lower += (XK_racute - XK_Racute); - else if (sym >= XK_racute && sym <= XK_tcedilla) - *upper -= (XK_racute - XK_Racute); - break; - case 2: /* Latin 3 */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) - *lower += (XK_hstroke - XK_Hstroke); - else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) - *lower += (XK_gbreve - XK_Gbreve); - else if (sym >= XK_hstroke && sym <= XK_hcircumflex) - *upper -= (XK_hstroke - XK_Hstroke); - else if (sym >= XK_gbreve && sym <= XK_jcircumflex) - *upper -= (XK_gbreve - XK_Gbreve); - else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) - *lower += (XK_cabovedot - XK_Cabovedot); - else if (sym >= XK_cabovedot && sym <= XK_scircumflex) - *upper -= (XK_cabovedot - XK_Cabovedot); - break; - case 3: /* Latin 4 */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Rcedilla && sym <= XK_Tslash) - *lower += (XK_rcedilla - XK_Rcedilla); - else if (sym >= XK_rcedilla && sym <= XK_tslash) - *upper -= (XK_rcedilla - XK_Rcedilla); - else if (sym == XK_ENG) - *lower = XK_eng; - else if (sym == XK_eng) - *upper = XK_ENG; - else if (sym >= XK_Amacron && sym <= XK_Umacron) - *lower += (XK_amacron - XK_Amacron); - else if (sym >= XK_amacron && sym <= XK_umacron) - *upper -= (XK_amacron - XK_Amacron); - break; - case 6: /* Cyrillic */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) - *lower -= (XK_Serbian_DJE - XK_Serbian_dje); - else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) - *upper += (XK_Serbian_DJE - XK_Serbian_dje); - else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) - *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); - else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) - *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); - break; - case 7: /* Greek */ - /* Assume the KeySym is a legal value (ignore discontinuities) */ - if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) - *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); - else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && - sym != XK_Greek_iotaaccentdieresis && - sym != XK_Greek_upsilonaccentdieresis) - *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); - else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) - *lower += (XK_Greek_alpha - XK_Greek_ALPHA); - else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && - sym != XK_Greek_finalsmallsigma) - *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); - break; - case 0x13: /* Latin 9 */ - if (sym == XK_OE) - *lower = XK_oe; - else if (sym == XK_oe) - *upper = XK_OE; - else if (sym == XK_Ydiaeresis) - *lower = XK_ydiaeresis; - break; - } -} - -int -_XTranslateKey( register Display *dpy, - KeyCode keycode, - register unsigned int modifiers, - unsigned int *modifiers_return, - KeySym *keysym_return) -{ - int per; - register KeySym *syms; - KeySym sym, lsym, usym; - - if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) - return 0; - *modifiers_return = ((ShiftMask|LockMask) - | dpy->mode_switch | dpy->num_lock); - if (((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) - { - *keysym_return = NoSymbol; - return 1; - } - per = dpy->keysyms_per_keycode; - syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; - while ((per > 2) && (syms[per - 1] == NoSymbol)) - per--; - if ((per > 2) && (modifiers & dpy->mode_switch)) { - syms += 2; - per -= 2; - } - if ((modifiers & dpy->num_lock) && - (per > 1 && (IsKeypadKey(syms[1]) || IsPrivateKeypadKey(syms[1])))) { - if ((modifiers & ShiftMask) || - ((modifiers & LockMask) && (dpy->lock_meaning == XK_Shift_Lock))) - *keysym_return = syms[0]; - else - *keysym_return = syms[1]; - } else if (!(modifiers & ShiftMask) && - (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) { - if ((per == 1) || (syms[1] == NoSymbol)) - XConvertCase(syms[0], keysym_return, &usym); - else - *keysym_return = syms[0]; - } else if (!(modifiers & LockMask) || - (dpy->lock_meaning != XK_Caps_Lock)) { - if ((per == 1) || ((usym = syms[1]) == NoSymbol)) - XConvertCase(syms[0], &lsym, &usym); - *keysym_return = usym; - } else { - if ((per == 1) || ((sym = syms[1]) == NoSymbol)) - sym = syms[0]; - XConvertCase(sym, &lsym, &usym); - if (!(modifiers & ShiftMask) && (sym != syms[0]) && - ((sym != usym) || (lsym == usym))) - XConvertCase(syms[0], &lsym, &usym); - *keysym_return = usym; - } - if (*keysym_return == XK_VoidSymbol) - *keysym_return = NoSymbol; - return 1; -} - -int -_XTranslateKeySym( - Display *dpy, - register KeySym symbol, - unsigned int modifiers, - char *buffer, - int nbytes) -{ - register struct _XKeytrans *p; - int length; - unsigned long hiBytes; - register unsigned char c; - - if (!symbol) - return 0; - /* see if symbol rebound, if so, return that string. */ - for (p = dpy->key_bindings; p; p = p->next) { - if (((modifiers & AllMods) == p->state) && (symbol == p->key)) { - length = p->len; - if (length > nbytes) length = nbytes; - memcpy (buffer, p->string, length); - return length; - } - } - /* try to convert to Latin-1, handling control */ - hiBytes = symbol >> 8; - if (!(nbytes && - ((hiBytes == 0) || - ((hiBytes == 0xFF) && - (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) || - (symbol == XK_Return) || - (symbol == XK_Escape) || - (symbol == XK_KP_Space) || - (symbol == XK_KP_Tab) || - (symbol == XK_KP_Enter) || - ((symbol >= XK_KP_Multiply) && (symbol <= XK_KP_9)) || - (symbol == XK_KP_Equal) || - (symbol == XK_Delete)))))) - return 0; - - /* if X keysym, convert to ascii by grabbing low 7 bits */ - if (symbol == XK_KP_Space) - c = XK_space & 0x7F; /* patch encoding botch */ - else if (hiBytes == 0xFF) - c = symbol & 0x7F; - else - c = symbol & 0xFF; - /* only apply Control key if it makes sense, else ignore it */ - if (modifiers & ControlMask) { - if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; - else if (c == '2') c = '\000'; - else if (c >= '3' && c <= '7') c -= ('3' - '\033'); - else if (c == '8') c = '\177'; - else if (c == '/') c = '_' & 0x1F; - } - buffer[0] = c; - return 1; -} - -/*ARGSUSED*/ -int -XLookupString ( - register XKeyEvent *event, - char *buffer, /* buffer */ - int nbytes, /* space in buffer for characters */ - KeySym *keysym, - XComposeStatus *status) /* not implemented */ -{ - unsigned int modifiers; - KeySym symbol; - - if (! _XTranslateKey(event->display, event->keycode, event->state, - &modifiers, &symbol)) - return 0; - - if (keysym) - *keysym = symbol; - /* arguable whether to use (event->state & ~modifiers) here */ - return _XTranslateKeySym(event->display, symbol, event->state, - buffer, nbytes); -} - -static void -_XFreeKeyBindings( - Display *dpy) -{ - register struct _XKeytrans *p, *np; - - for (p = dpy->key_bindings; p; p = np) { - np = p->next; - Xfree(p->string); - Xfree(p->modifiers); - Xfree(p); - } -} - -int -XRebindKeysym ( - Display *dpy, - KeySym keysym, - KeySym *mlist, - int nm, /* number of modifiers in mlist */ - _Xconst unsigned char *str, - int nbytes) -{ - register struct _XKeytrans *tmp, *p; - int nb; - - if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) - return 0; - LockDisplay(dpy); - tmp = dpy->key_bindings; - nb = sizeof(KeySym) * nm; - - if ((! (p = Xcalloc( 1, sizeof(struct _XKeytrans)))) || - ((! (p->string = Xmalloc(nbytes))) && (nbytes > 0)) || - ((! (p->modifiers = Xmalloc(nb))) && (nb > 0))) { - if (p) { - Xfree(p->string); - Xfree(p->modifiers); - Xfree(p); - } - UnlockDisplay(dpy); - return 0; - } - - dpy->key_bindings = p; - dpy->free_funcs->key_bindings = _XFreeKeyBindings; - p->next = tmp; /* chain onto list */ - memcpy (p->string, str, nbytes); - p->len = nbytes; - memcpy ((char *) p->modifiers, (char *) mlist, nb); - p->key = keysym; - p->mlen = nm; - ComputeMaskFromKeytrans(dpy, p); - UnlockDisplay(dpy); - return 0; -} - -unsigned -_XKeysymToModifiers( - Display *dpy, - KeySym ks) -{ - CARD8 code,mods; - register KeySym *kmax; - register KeySym *k; - register XModifierKeymap *m; - - if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) - return 0; - kmax = dpy->keysyms + - (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; - k = dpy->keysyms; - m = dpy->modifiermap; - mods= 0; - while (kmax_keypermod<<3; - - code=(((k-dpy->keysyms)/dpy->keysyms_per_keycode)+dpy->min_keycode); - - while (--j >= 0) { - if (code == m->modifiermap[j]) - mods|= (1<<(j/m->max_keypermod)); - } - } - k++; - } - return mods; -} - -/* - * given a list of modifiers, computes the mask necessary for later matching. - * This routine must lookup the key in the Keymap and then search to see - * what modifier it is bound to, if any. Sets the AnyModifier bit if it - * can't map some keysym to a modifier. - */ -static void -ComputeMaskFromKeytrans( - Display *dpy, - register struct _XKeytrans *p) -{ - register int i; - - p->state = AnyModifier; - for (i = 0; i < p->mlen; i++) { - p->state|= XkbKeysymToModifiers(dpy,p->modifiers[i]); - } - p->state &= AllMods; -} diff --git a/nx-X11/lib/X11/KeysymStr.c b/nx-X11/lib/X11/KeysymStr.c deleted file mode 100644 index ba6c8450a..000000000 --- a/nx-X11/lib/X11/KeysymStr.c +++ /dev/null @@ -1,146 +0,0 @@ - -/* - -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include -#include "Xresinternal.h" - -#include /* sprintf */ - -#define NEEDVTABLE -#include "ks_tables.h" -#include "Key.h" - - -typedef struct _GRNData { - char *name; - XrmRepresentation type; - XrmValuePtr value; -} GRNData; - -/*ARGSUSED*/ -static Bool -SameValue( - XrmDatabase* db, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation* type, - XrmValuePtr value, - XPointer data -) -{ - GRNData *gd = (GRNData *)data; - - if ((*type == gd->type) && (value->size == gd->value->size) && - !strncmp((char *)value->addr, (char *)gd->value->addr, value->size)) - { - gd->name = XrmQuarkToString(*quarks); /* XXX */ - return True; - } - return False; -} - -char *XKeysymToString(KeySym ks) -{ - XrmDatabase keysymdb; - - if (!ks || (ks & ((unsigned long) ~0x1fffffff)) != 0) - return ((char *)NULL); - if (ks == XK_VoidSymbol) - ks = 0; - if (ks <= 0x1fffffff) - { - unsigned char val1 = ks >> 24; - unsigned char val2 = (ks >> 16) & 0xff; - unsigned char val3 = (ks >> 8) & 0xff; - unsigned char val4 = ks & 0xff; - int i = ks % VTABLESIZE; - int h = i + 1; - int n = VMAXHASH; - int idx; - while ((idx = hashKeysym[i])) - { - const unsigned char *entry = &_XkeyTable[idx]; - if ((entry[0] == val1) && (entry[1] == val2) && - (entry[2] == val3) && (entry[3] == val4)) - return ((char *)entry + 4); - if (!--n) - break; - i += h; - if (i >= VTABLESIZE) - i -= VTABLESIZE; - } - } - - if ((keysymdb = _XInitKeysymDB())) - { - char buf[9]; - XrmValue resval; - XrmQuark empty = NULLQUARK; - GRNData data; - - snprintf(buf, sizeof(buf), "%lX", ks); - resval.addr = (XPointer)buf; - resval.size = strlen(buf) + 1; - data.name = (char *)NULL; - data.type = XrmPermStringToQuark("String"); - data.value = &resval; - (void)XrmEnumerateDatabase(keysymdb, &empty, &empty, XrmEnumAllLevels, - SameValue, (XPointer)&data); - if (data.name) - return data.name; - } - if (ks >= 0x01000100 && ks <= 0x0110ffff) { - KeySym val = ks & 0xffffff; - char *s; - int i; - if (val & 0xff0000) - i = 10; - else - i = 6; - s = Xmalloc(i); - if (s == NULL) - return s; - i--; - s[i--] = '\0'; - for (; i; i--){ - unsigned char val1 = val & 0xf; - val >>= 4; - if (val1 < 10) - s[i] = '0'+ val1; - else - s[i] = 'A'+ val1 - 10; - } - s[i] = 'U'; - return s; - } - return ((char *) NULL); -} diff --git a/nx-X11/lib/X11/KillCl.c b/nx-X11/lib/X11/KillCl.c deleted file mode 100644 index cfd8cb000..000000000 --- a/nx-X11/lib/X11/KillCl.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XKillClient( - register Display *dpy, - XID resource) -{ - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(KillClient, resource, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/LRGB.c b/nx-X11/lib/X11/LRGB.c deleted file mode 100644 index 38cc6cfb4..000000000 --- a/nx-X11/lib/X11/LRGB.c +++ /dev/null @@ -1,1841 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsLRGB.c - * - * DESCRIPTION - * This file contains the conversion routines: - * 1. CIE XYZ to RGB intensity - * 2. RGB intensity to device RGB - * 3. device RGB to RGB intensity - * 4. RGB intensity to CIE XYZ - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * LOCAL DEFINES - * #define declarations local to this package. - */ -#define EPS 0.001 -#ifndef MIN -#define MIN(x,y) ((x) > (y) ? (y) : (x)) -#endif /* MIN */ -#ifndef MAX -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#endif /* MAX */ -#ifndef MIN3 -#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) -#endif /* MIN3 */ -#ifndef MAX3 -#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) -#endif /* MAX3 */ - -/* - * LOCAL TYPEDEFS - * typedefs local to this package (for use with local vars). - * - */ - -/* - * FORWARD DECLARATIONS - */ -static void LINEAR_RGB_FreeSCCData(XPointer pScreenDataTemp); -static int LINEAR_RGB_InitSCCData(Display *dpy, - int screenNumber, XcmsPerScrnInfo *pPerScrnInfo); -static int XcmsLRGB_RGB_ParseString(register char *spec, XcmsColor *pColor); -static int XcmsLRGB_RGBi_ParseString(register char *spec, XcmsColor *pColor); -static Status -_XcmsGetTableType0( - IntensityTbl *pTbl, - int format, - char **pChar, - unsigned long *pCount); -static Status -_XcmsGetTableType1( - IntensityTbl *pTbl, - int format, - char **pChar, - unsigned long *pCount); - -/* - * LOCALS VARIABLES - * Variables local to this package. - * Usage example: - * static int ExampleLocalVar; - */ - -static unsigned short const MASK[17] = { - 0x0000, /* 0 bitsPerRGB */ - 0x8000, /* 1 bitsPerRGB */ - 0xc000, /* 2 bitsPerRGB */ - 0xe000, /* 3 bitsPerRGB */ - 0xf000, /* 4 bitsPerRGB */ - 0xf800, /* 5 bitsPerRGB */ - 0xfc00, /* 6 bitsPerRGB */ - 0xfe00, /* 7 bitsPerRGB */ - 0xff00, /* 8 bitsPerRGB */ - 0xff80, /* 9 bitsPerRGB */ - 0xffc0, /* 10 bitsPerRGB */ - 0xffe0, /* 11 bitsPerRGB */ - 0xfff0, /* 12 bitsPerRGB */ - 0xfff8, /* 13 bitsPerRGB */ - 0xfffc, /* 14 bitsPerRGB */ - 0xfffe, /* 15 bitsPerRGB */ - 0xffff /* 16 bitsPerRGB */ -}; - - - /* - * A NULL terminated array of function pointers that when applied - * in series will convert an XcmsColor structure from XcmsRGBFormat - * to XcmsCIEXYZFormat. - */ -static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = { - (XcmsConversionProc)XcmsRGBToRGBi, - (XcmsConversionProc)XcmsRGBiToCIEXYZ, - NULL -}; - - /* - * A NULL terminated array of function pointers that when applied - * in series will convert an XcmsColor structure from XcmsCIEXYZFormat - * to XcmsRGBFormat. - */ -static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = { - (XcmsConversionProc)XcmsCIEXYZToRGBi, - (XcmsConversionProc)XcmsRGBiToRGB, - NULL -}; - - /* - * A NULL terminated array of function pointers that when applied - * in series will convert an XcmsColor structure from XcmsRGBiFormat - * to XcmsCIEXYZFormat. - */ -static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = { - (XcmsConversionProc)XcmsRGBiToCIEXYZ, - NULL -}; - - /* - * A NULL terminated array of function pointers that when applied - * in series will convert an XcmsColor structure from XcmsCIEXYZFormat - * to XcmsRGBiFormat. - */ -static XcmsConversionProc Fl_CIEXYZ_to_RGBi[] = { - (XcmsConversionProc)XcmsCIEXYZToRGBi, - NULL -}; - - /* - * RGBi Color Spaces - */ -XcmsColorSpace XcmsRGBiColorSpace = - { - _XcmsRGBi_prefix, /* prefix */ - XcmsRGBiFormat, /* id */ - XcmsLRGB_RGBi_ParseString, /* parseString */ - Fl_RGBi_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_RGBi, /* from_CIEXYZ */ - 1 - }; - - /* - * RGB Color Spaces - */ -XcmsColorSpace XcmsRGBColorSpace = - { - _XcmsRGB_prefix, /* prefix */ - XcmsRGBFormat, /* id */ - XcmsLRGB_RGB_ParseString, /* parseString */ - Fl_RGB_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_RGB, /* from_CIEXYZ */ - 1 - }; - - /* - * Device-Independent Color Spaces known to the - * LINEAR_RGB Screen Color Characteristics Function Set. - */ -static XcmsColorSpace *DDColorSpaces[] = { - &XcmsRGBColorSpace, - &XcmsRGBiColorSpace, - NULL -}; - - -/* - * GLOBALS - * Variables declared in this package that are allowed - * to be used globally. - */ - - /* - * LINEAR_RGB Screen Color Characteristics Function Set. - */ -XcmsFunctionSet XcmsLinearRGBFunctionSet = - { - &DDColorSpaces[0], /* pDDColorSpaces */ - LINEAR_RGB_InitSCCData, /* pInitScrnFunc */ - LINEAR_RGB_FreeSCCData /* pFreeSCCData */ - }; - -/* - * DESCRIPTION - * Contents of Default SCCData should be replaced if other - * data should be used as default. - * - * - */ - -/* - * NAME Tektronix 19" (Sony) CRT - * PART_NUMBER 119-2451-00 - * MODEL Tek4300, Tek4800 - */ - -static IntensityRec const Default_RGB_RedTuples[] = { - /* {unsigned short value, XcmsFloat intensity} */ - { 0x0000, 0.000000 }, - { 0x0909, 0.000000 }, - { 0x0a0a, 0.000936 }, - { 0x0f0f, 0.001481 }, - { 0x1414, 0.002329 }, - { 0x1919, 0.003529 }, - { 0x1e1e, 0.005127 }, - { 0x2323, 0.007169 }, - { 0x2828, 0.009699 }, - { 0x2d2d, 0.012759 }, - { 0x3232, 0.016392 }, - { 0x3737, 0.020637 }, - { 0x3c3c, 0.025533 }, - { 0x4141, 0.031119 }, - { 0x4646, 0.037431 }, - { 0x4b4b, 0.044504 }, - { 0x5050, 0.052373 }, - { 0x5555, 0.061069 }, - { 0x5a5a, 0.070624 }, - { 0x5f5f, 0.081070 }, - { 0x6464, 0.092433 }, - { 0x6969, 0.104744 }, - { 0x6e6e, 0.118026 }, - { 0x7373, 0.132307 }, - { 0x7878, 0.147610 }, - { 0x7d7d, 0.163958 }, - { 0x8282, 0.181371 }, - { 0x8787, 0.199871 }, - { 0x8c8c, 0.219475 }, - { 0x9191, 0.240202 }, - { 0x9696, 0.262069 }, - { 0x9b9b, 0.285089 }, - { 0xa0a0, 0.309278 }, - { 0xa5a5, 0.334647 }, - { 0xaaaa, 0.361208 }, - { 0xafaf, 0.388971 }, - { 0xb4b4, 0.417945 }, - { 0xb9b9, 0.448138 }, - { 0xbebe, 0.479555 }, - { 0xc3c3, 0.512202 }, - { 0xc8c8, 0.546082 }, - { 0xcdcd, 0.581199 }, - { 0xd2d2, 0.617552 }, - { 0xd7d7, 0.655144 }, - { 0xdcdc, 0.693971 }, - { 0xe1e1, 0.734031 }, - { 0xe6e6, 0.775322 }, - { 0xebeb, 0.817837 }, - { 0xf0f0, 0.861571 }, - { 0xf5f5, 0.906515 }, - { 0xfafa, 0.952662 }, - { 0xffff, 1.000000 } -}; - -static IntensityRec const Default_RGB_GreenTuples[] = { - /* {unsigned short value, XcmsFloat intensity} */ - { 0x0000, 0.000000 }, - { 0x1313, 0.000000 }, - { 0x1414, 0.000832 }, - { 0x1919, 0.001998 }, - { 0x1e1e, 0.003612 }, - { 0x2323, 0.005736 }, - { 0x2828, 0.008428 }, - { 0x2d2d, 0.011745 }, - { 0x3232, 0.015740 }, - { 0x3737, 0.020463 }, - { 0x3c3c, 0.025960 }, - { 0x4141, 0.032275 }, - { 0x4646, 0.039449 }, - { 0x4b4b, 0.047519 }, - { 0x5050, 0.056520 }, - { 0x5555, 0.066484 }, - { 0x5a5a, 0.077439 }, - { 0x5f5f, 0.089409 }, - { 0x6464, 0.102418 }, - { 0x6969, 0.116485 }, - { 0x6e6e, 0.131625 }, - { 0x7373, 0.147853 }, - { 0x7878, 0.165176 }, - { 0x7d7d, 0.183604 }, - { 0x8282, 0.203140 }, - { 0x8787, 0.223783 }, - { 0x8c8c, 0.245533 }, - { 0x9191, 0.268384 }, - { 0x9696, 0.292327 }, - { 0x9b9b, 0.317351 }, - { 0xa0a0, 0.343441 }, - { 0xa5a5, 0.370580 }, - { 0xaaaa, 0.398747 }, - { 0xafaf, 0.427919 }, - { 0xb4b4, 0.458068 }, - { 0xb9b9, 0.489165 }, - { 0xbebe, 0.521176 }, - { 0xc3c3, 0.554067 }, - { 0xc8c8, 0.587797 }, - { 0xcdcd, 0.622324 }, - { 0xd2d2, 0.657604 }, - { 0xd7d7, 0.693588 }, - { 0xdcdc, 0.730225 }, - { 0xe1e1, 0.767459 }, - { 0xe6e6, 0.805235 }, - { 0xebeb, 0.843491 }, - { 0xf0f0, 0.882164 }, - { 0xf5f5, 0.921187 }, - { 0xfafa, 0.960490 }, - { 0xffff, 1.000000 } -}; - -static IntensityRec const Default_RGB_BlueTuples[] = { - /* {unsigned short value, XcmsFloat intensity} */ - { 0x0000, 0.000000 }, - { 0x0e0e, 0.000000 }, - { 0x0f0f, 0.001341 }, - { 0x1414, 0.002080 }, - { 0x1919, 0.003188 }, - { 0x1e1e, 0.004729 }, - { 0x2323, 0.006766 }, - { 0x2828, 0.009357 }, - { 0x2d2d, 0.012559 }, - { 0x3232, 0.016424 }, - { 0x3737, 0.021004 }, - { 0x3c3c, 0.026344 }, - { 0x4141, 0.032489 }, - { 0x4646, 0.039481 }, - { 0x4b4b, 0.047357 }, - { 0x5050, 0.056154 }, - { 0x5555, 0.065903 }, - { 0x5a5a, 0.076634 }, - { 0x5f5f, 0.088373 }, - { 0x6464, 0.101145 }, - { 0x6969, 0.114968 }, - { 0x6e6e, 0.129862 }, - { 0x7373, 0.145841 }, - { 0x7878, 0.162915 }, - { 0x7d7d, 0.181095 }, - { 0x8282, 0.200386 }, - { 0x8787, 0.220791 }, - { 0x8c8c, 0.242309 }, - { 0x9191, 0.264937 }, - { 0x9696, 0.288670 }, - { 0x9b9b, 0.313499 }, - { 0xa0a0, 0.339410 }, - { 0xa5a5, 0.366390 }, - { 0xaaaa, 0.394421 }, - { 0xafaf, 0.423481 }, - { 0xb4b4, 0.453547 }, - { 0xb9b9, 0.484592 }, - { 0xbebe, 0.516587 }, - { 0xc3c3, 0.549498 }, - { 0xc8c8, 0.583291 }, - { 0xcdcd, 0.617925 }, - { 0xd2d2, 0.653361 }, - { 0xd7d7, 0.689553 }, - { 0xdcdc, 0.726454 }, - { 0xe1e1, 0.764013 }, - { 0xe6e6, 0.802178 }, - { 0xebeb, 0.840891 }, - { 0xf0f0, 0.880093 }, - { 0xf5f5, 0.919723 }, - { 0xfafa, 0.959715 }, - { 0xffff, 1.00000 } -}; - -static IntensityTbl Default_RGB_RedTbl = { - /* IntensityRec *pBase */ - (IntensityRec *) Default_RGB_RedTuples, - /* unsigned int nEntries */ - 52 -}; - -static IntensityTbl Default_RGB_GreenTbl = { - /* IntensityRec *pBase */ - (IntensityRec *)Default_RGB_GreenTuples, - /* unsigned int nEntries */ - 50 -}; - -static IntensityTbl Default_RGB_BlueTbl = { - /* IntensityRec *pBase */ - (IntensityRec *)Default_RGB_BlueTuples, - /* unsigned int nEntries */ - 51 -}; - -static LINEAR_RGB_SCCData Default_RGB_SCCData = { - /* XcmsFloat XYZtoRGBmatrix[3][3] */ - { - { 3.48340481253539000, -1.52176374927285200, -0.55923133354049780 }, - {-1.07152751306193600, 1.96593795204372400, 0.03673691339553462 }, - { 0.06351179790497788, -0.20020501000496480, 0.81070942031648220 } - }, - - /* XcmsFloat RGBtoXYZmatrix[3][3] */ - { - { 0.38106149108714790, 0.32025712365352110, 0.24834578525933100 }, - { 0.20729745115140850, 0.68054638776373240, 0.11215616108485920 }, - { 0.02133944350088028, 0.14297193020246480, 1.24172892629665500 } - }, - - /* IntensityTbl *pRedTbl */ - &Default_RGB_RedTbl, - - /* IntensityTbl *pGreenTbl */ - &Default_RGB_GreenTbl, - - /* IntensityTbl *pBlueTbl */ - &Default_RGB_BlueTbl -}; - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * LINEAR_RGB_InitSCCData() - * - * SYNOPSIS - */ -static Status -LINEAR_RGB_InitSCCData( - Display *dpy, - int screenNumber, - XcmsPerScrnInfo *pPerScrnInfo) -/* - * DESCRIPTION - * - * RETURNS - * XcmsFailure if failed. - * XcmsSuccess if succeeded. - * - */ -{ - Atom CorrectAtom = XInternAtom (dpy, XDCCC_CORRECT_ATOM_NAME, True); - Atom MatrixAtom = XInternAtom (dpy, XDCCC_MATRIX_ATOM_NAME, True); - int format_return, count, cType, nTables; - unsigned long nitems, nbytes_return; - char *property_return, *pChar; - XcmsFloat *pValue; -#ifdef ALLDEBUG - IntensityRec *pIRec; -#endif /* ALLDEBUG */ - VisualID visualID; - - LINEAR_RGB_SCCData *pScreenData, *pScreenDefaultData; - XcmsIntensityMap *pNewMap; - - /* - * Allocate memory for pScreenData - */ - if (!(pScreenData = pScreenDefaultData = (LINEAR_RGB_SCCData *) - Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) { - return(XcmsFailure); - } - - /* - * 1. Get the XYZ->RGB and RGB->XYZ matrices - */ - - if (MatrixAtom == None || - !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), MatrixAtom, - &format_return, &nitems, &nbytes_return, &property_return) || - nitems != 18 || format_return != 32) { - /* - * As per the XDCCC, there must be 18 data items and each must be - * in 32 bits ! - */ - goto FreeSCCData; - - } else { - - /* - * RGBtoXYZ and XYZtoRGB matrices - */ - pValue = (XcmsFloat *) pScreenData; - pChar = property_return; - for (count = 0; count < 18; count++) { - *pValue++ = (long)_XcmsGetElement(format_return, &pChar, - &nitems) / (XcmsFloat)XDCCC_NUMBER; - } - Xfree (property_return); - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X = - pScreenData->RGBtoXYZmatrix[0][0] + - pScreenData->RGBtoXYZmatrix[0][1] + - pScreenData->RGBtoXYZmatrix[0][2]; - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = - pScreenData->RGBtoXYZmatrix[1][0] + - pScreenData->RGBtoXYZmatrix[1][1] + - pScreenData->RGBtoXYZmatrix[1][2]; - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z = - pScreenData->RGBtoXYZmatrix[2][0] + - pScreenData->RGBtoXYZmatrix[2][1] + - pScreenData->RGBtoXYZmatrix[2][2]; - - /* - * Compute the Screen White Point - */ - if ((pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y < (1.0 - EPS) ) - || (pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y > (1.0 + EPS))) { - goto FreeSCCData; - } else { - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = 1.0; - } - pPerScrnInfo->screenWhitePt.format = XcmsCIEXYZFormat; - pPerScrnInfo->screenWhitePt.pixel = 0; - -#ifdef PDEBUG - printf ("RGB to XYZ Matrix values:\n"); - printf (" %f %f %f\n %f %f %f\n %f %f %f\n", - pScreenData->RGBtoXYZmatrix[0][0], - pScreenData->RGBtoXYZmatrix[0][1], - pScreenData->RGBtoXYZmatrix[0][2], - pScreenData->RGBtoXYZmatrix[1][0], - pScreenData->RGBtoXYZmatrix[1][1], - pScreenData->RGBtoXYZmatrix[1][2], - pScreenData->RGBtoXYZmatrix[2][0], - pScreenData->RGBtoXYZmatrix[2][1], - pScreenData->RGBtoXYZmatrix[2][2]); - printf ("XYZ to RGB Matrix values:\n"); - printf (" %f %f %f\n %f %f %f\n %f %f %f\n", - pScreenData->XYZtoRGBmatrix[0][0], - pScreenData->XYZtoRGBmatrix[0][1], - pScreenData->XYZtoRGBmatrix[0][2], - pScreenData->XYZtoRGBmatrix[1][0], - pScreenData->XYZtoRGBmatrix[1][1], - pScreenData->XYZtoRGBmatrix[1][2], - pScreenData->XYZtoRGBmatrix[2][0], - pScreenData->XYZtoRGBmatrix[2][1], - pScreenData->XYZtoRGBmatrix[2][2]); - printf ("Screen White Pt value: %f %f %f\n", - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X, - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y, - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z); -#endif /* PDEBUG */ - } - - /* - * 2. Get the Intensity Profile - */ - if (CorrectAtom == None || - !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), CorrectAtom, - &format_return, &nitems, &nbytes_return, &property_return)) { - goto FreeSCCData; - } - - pChar = property_return; - - while (nitems) { - switch (format_return) { - case 8: - /* - * Must have at least: - * VisualID0 - * VisualID1 - * VisualID2 - * VisualID3 - * type - * count - * length - * intensity1 - * intensity2 - */ - if (nitems < 9) { - goto Free_property_return; - } - count = 3; - break; - case 16: - /* - * Must have at least: - * VisualID0 - * VisualID3 - * type - * count - * length - * intensity1 - * intensity2 - */ - if (nitems < 7) { - goto Free_property_return; - } - count = 1; - break; - case 32: - /* - * Must have at least: - * VisualID0 - * type - * count - * length - * intensity1 - * intensity2 - */ - if (nitems < 6) { - goto Free_property_return; - } - count = 0; - break; - default: - goto Free_property_return; - } - - /* - * Get VisualID - */ - visualID = _XcmsGetElement(format_return, &pChar, &nitems); - while (count--) { - visualID = visualID << format_return; - visualID |= _XcmsGetElement(format_return, &pChar, &nitems); - } - - if (visualID == 0) { - /* - * This is a shared intensity table - */ - pScreenData = pScreenDefaultData; - } else { - /* - * This is a per-Visual intensity table - */ - if (!(pScreenData = (LINEAR_RGB_SCCData *) - Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) { - goto Free_property_return; - } - /* copy matrices */ - memcpy((char *)pScreenData, (char *)pScreenDefaultData, - 18 * sizeof(XcmsFloat)); - - /* Create, initialize, and add map */ - if (!(pNewMap = (XcmsIntensityMap *) - Xcalloc (1, sizeof(XcmsIntensityMap)))) { - Xfree(pScreenData); - goto Free_property_return; - } - pNewMap->visualID = visualID; - pNewMap->screenData = (XPointer)pScreenData; - pNewMap->pFreeScreenData = LINEAR_RGB_FreeSCCData; - pNewMap->pNext = - (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; - dpy->cms.perVisualIntensityMaps = (XPointer)pNewMap; - dpy->free_funcs->intensityMaps = _XcmsFreeIntensityMaps; - } - - cType = _XcmsGetElement(format_return, &pChar, &nitems); - nTables = _XcmsGetElement(format_return, &pChar, &nitems); - - if (cType == 0) { - - /* Red Intensity Table */ - if (!(pScreenData->pRedTbl = (IntensityTbl *) - Xcalloc (1, sizeof(IntensityTbl)))) { - goto Free_property_return; - } - if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar, - &nitems) == XcmsFailure) { - goto FreeRedTbl; - } - - if (nTables == 1) { - /* Green Intensity Table */ - pScreenData->pGreenTbl = pScreenData->pRedTbl; - /* Blue Intensity Table */ - pScreenData->pBlueTbl = pScreenData->pRedTbl; - } else { - /* Green Intensity Table */ - if (!(pScreenData->pGreenTbl = (IntensityTbl *) - Xcalloc (1, sizeof(IntensityTbl)))) { - goto FreeRedTblElements; - } - if (_XcmsGetTableType0(pScreenData->pGreenTbl, format_return, &pChar, - &nitems) == XcmsFailure) { - goto FreeGreenTbl; - } - - /* Blue Intensity Table */ - if (!(pScreenData->pBlueTbl = (IntensityTbl *) - Xcalloc (1, sizeof(IntensityTbl)))) { - goto FreeGreenTblElements; - } - if (_XcmsGetTableType0(pScreenData->pBlueTbl, format_return, &pChar, - &nitems) == XcmsFailure) { - goto FreeBlueTbl; - } - } - } else if (cType == 1) { - /* Red Intensity Table */ - if (!(pScreenData->pRedTbl = (IntensityTbl *) - Xcalloc (1, sizeof(IntensityTbl)))) { - goto Free_property_return; - } - if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar, - &nitems) == XcmsFailure) { - goto FreeRedTbl; - } - - if (nTables == 1) { - - /* Green Intensity Table */ - pScreenData->pGreenTbl = pScreenData->pRedTbl; - /* Blue Intensity Table */ - pScreenData->pBlueTbl = pScreenData->pRedTbl; - - } else { - - /* Green Intensity Table */ - if (!(pScreenData->pGreenTbl = (IntensityTbl *) - Xcalloc (1, sizeof(IntensityTbl)))) { - goto FreeRedTblElements; - } - if (_XcmsGetTableType1(pScreenData->pGreenTbl, format_return, &pChar, - &nitems) == XcmsFailure) { - goto FreeGreenTbl; - } - - /* Blue Intensity Table */ - if (!(pScreenData->pBlueTbl = (IntensityTbl *) - Xcalloc (1, sizeof(IntensityTbl)))) { - goto FreeGreenTblElements; - } - if (_XcmsGetTableType1(pScreenData->pBlueTbl, format_return, &pChar, - &nitems) == XcmsFailure) { - goto FreeBlueTbl; - } - } - } else { - goto Free_property_return; - } - -#ifdef ALLDEBUG - printf ("Intensity Table RED %d\n", pScreenData->pRedTbl->nEntries); - pIRec = (IntensityRec *) pScreenData->pRedTbl->pBase; - for (count = 0; count < pScreenData->pRedTbl->nEntries; count++, pIRec++) { - printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); - } - if (pScreenData->pGreenTbl->pBase != pScreenData->pRedTbl->pBase) { - printf ("Intensity Table GREEN %d\n", pScreenData->pGreenTbl->nEntries); - pIRec = (IntensityRec *)pScreenData->pGreenTbl->pBase; - for (count = 0; count < pScreenData->pGreenTbl->nEntries; count++, pIRec++) { - printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); - } - } - if (pScreenData->pBlueTbl->pBase != pScreenData->pRedTbl->pBase) { - printf ("Intensity Table BLUE %d\n", pScreenData->pBlueTbl->nEntries); - pIRec = (IntensityRec *) pScreenData->pBlueTbl->pBase; - for (count = 0; count < pScreenData->pBlueTbl->nEntries; count++, pIRec++) { - printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); - } - } -#endif /* ALLDEBUG */ - } - - Xfree (property_return); - - /* Free the old memory and use the new structure created. */ - LINEAR_RGB_FreeSCCData(pPerScrnInfo->screenData); - - pPerScrnInfo->functionSet = (XPointer) &XcmsLinearRGBFunctionSet; - - pPerScrnInfo->screenData = (XPointer) pScreenData; - - pPerScrnInfo->state = XcmsInitSuccess; - - return(XcmsSuccess); - -FreeBlueTbl: - Xfree(pScreenData->pBlueTbl); - -FreeGreenTblElements: - Xfree(pScreenData->pGreenTbl->pBase); - -FreeGreenTbl: - Xfree(pScreenData->pGreenTbl); - -FreeRedTblElements: - Xfree(pScreenData->pRedTbl->pBase); - -FreeRedTbl: - Xfree(pScreenData->pRedTbl); - -Free_property_return: - Xfree (property_return); - -FreeSCCData: - Xfree(pScreenDefaultData); - pPerScrnInfo->state = XcmsInitNone; - return(XcmsFailure); -} - - -/* - * NAME - * LINEAR_RGB_FreeSCCData() - * - * SYNOPSIS - */ -static void -LINEAR_RGB_FreeSCCData( - XPointer pScreenDataTemp) -/* - * DESCRIPTION - * - * RETURNS - * 0 if failed. - * 1 if succeeded with no modifications. - * - */ -{ - LINEAR_RGB_SCCData *pScreenData = (LINEAR_RGB_SCCData *) pScreenDataTemp; - - if (pScreenData && pScreenData != &Default_RGB_SCCData) { - if (pScreenData->pRedTbl) { - if (pScreenData->pGreenTbl) { - if (pScreenData->pRedTbl->pBase != - pScreenData->pGreenTbl->pBase) { - if (pScreenData->pGreenTbl->pBase) { - Xfree (pScreenData->pGreenTbl->pBase); - } - } - if (pScreenData->pGreenTbl != pScreenData->pRedTbl) { - Xfree (pScreenData->pGreenTbl); - } - } - if (pScreenData->pBlueTbl) { - if (pScreenData->pRedTbl->pBase != - pScreenData->pBlueTbl->pBase) { - if (pScreenData->pBlueTbl->pBase) { - Xfree (pScreenData->pBlueTbl->pBase); - } - } - if (pScreenData->pBlueTbl != pScreenData->pRedTbl) { - Xfree (pScreenData->pBlueTbl); - } - } - if (pScreenData->pRedTbl->pBase) { - Xfree (pScreenData->pRedTbl->pBase); - } - Xfree (pScreenData->pRedTbl); - } - Xfree (pScreenData); - } -} - - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsGetTableType0 - * - * SYNOPSIS - */ -static Status -_XcmsGetTableType0( - IntensityTbl *pTbl, - int format, - char **pChar, - unsigned long *pCount) -/* - * DESCRIPTION - * - * RETURNS - * XcmsFailure if failed. - * XcmsSuccess if succeeded. - * - */ -{ - unsigned int nElements; - IntensityRec *pIRec; - - nElements = pTbl->nEntries = - _XcmsGetElement(format, pChar, pCount) + 1; - if (!(pIRec = pTbl->pBase = (IntensityRec *) - Xcalloc (nElements, sizeof(IntensityRec)))) { - return(XcmsFailure); - } - - switch (format) { - case 8: - for (; nElements--; pIRec++) { - /* 0xFFFF/0xFF = 0x101 */ - pIRec->value = _XcmsGetElement (format, pChar, pCount) * 0x101; - pIRec->intensity = - _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)255.0; - } - break; - case 16: - for (; nElements--; pIRec++) { - pIRec->value = _XcmsGetElement (format, pChar, pCount); - pIRec->intensity = _XcmsGetElement (format, pChar, pCount) - / (XcmsFloat)65535.0; - } - break; - case 32: - for (; nElements--; pIRec++) { - pIRec->value = _XcmsGetElement (format, pChar, pCount); - pIRec->intensity = _XcmsGetElement (format, pChar, pCount) - / (XcmsFloat)4294967295.0; - } - break; - default: - return(XcmsFailure); - } - return(XcmsSuccess); -} - - -/* - * NAME - * _XcmsGetTableType1 - * - * SYNOPSIS - */ -static Status -_XcmsGetTableType1( - IntensityTbl *pTbl, - int format, - char **pChar, - unsigned long *pCount) -/* - * DESCRIPTION - * - * RETURNS - * XcmsFailure if failed. - * XcmsSuccess if succeeded. - * - */ -{ - unsigned int count; - unsigned int max_index; - IntensityRec *pIRec; - - max_index = _XcmsGetElement(format, pChar, pCount); - pTbl->nEntries = max_index + 1; - if (!(pIRec = pTbl->pBase = (IntensityRec *) - Xcalloc (max_index+1, sizeof(IntensityRec)))) { - return(XcmsFailure); - } - - switch (format) { - case 8: - for (count = 0; count < max_index+1; count++, pIRec++) { - pIRec->value = (count * 65535) / max_index; - pIRec->intensity = _XcmsGetElement (format, pChar, pCount) - / (XcmsFloat)255.0; - } - break; - case 16: - for (count = 0; count < max_index+1; count++, pIRec++) { - pIRec->value = (count * 65535) / max_index; - pIRec->intensity = _XcmsGetElement (format, pChar, pCount) - / (XcmsFloat)65535.0; - } - break; - case 32: - for (count = 0; count < max_index+1; count++, pIRec++) { - pIRec->value = (count * 65535) / max_index; - pIRec->intensity = _XcmsGetElement (format, pChar, pCount) - / (XcmsFloat)4294967295.0; - } - break; - default: - return(XcmsFailure); - } - - return(XcmsSuccess); -} - - -/* - * NAME - * ValueCmp - * - * SYNOPSIS - */ -static int -_XcmsValueCmp( - IntensityRec *p1, IntensityRec *p2) -/* - * DESCRIPTION - * Compares the value component of two IntensityRec - * structures. - * - * RETURNS - * 0 if p1->value is equal to p2->value - * < 0 if p1->value is less than p2->value - * > 0 if p1->value is greater than p2->value - * - */ -{ - return (p1->value - p2->value); -} - - -/* - * NAME - * IntensityCmp - * - * SYNOPSIS - */ -static int -_XcmsIntensityCmp( - IntensityRec *p1, IntensityRec *p2) -/* - * DESCRIPTION - * Compares the intensity component of two IntensityRec - * structures. - * - * RETURNS - * 0 if equal; - * < 0 if first precedes second - * > 0 if first succeeds second - * - */ -{ - if (p1->intensity < p2->intensity) { - return (-1); - } - if (p1->intensity > p2->intensity) { - return (XcmsSuccess); - } - return (XcmsFailure); -} - -/* - * NAME - * ValueInterpolation - * - * SYNOPSIS - */ -/* ARGSUSED */ -static int -_XcmsValueInterpolation( - IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, - int bitsPerRGB) -/* - * DESCRIPTION - * Based on a given value, performs a linear interpolation - * on the intensities between two IntensityRec structures. - * Note that the bitsPerRGB parameter is ignored. - * - * RETURNS - * Returns 0 if failed; otherwise non-zero. - */ -{ - XcmsFloat ratio; - - ratio = ((XcmsFloat)key->value - (XcmsFloat)lo->value) / - ((XcmsFloat)hi->value - (XcmsFloat)lo->value); - answer->value = key->value; - answer->intensity = (hi->intensity - lo->intensity) * ratio; - answer->intensity += lo->intensity; - return (XcmsSuccess); -} - -/* - * NAME - * IntensityInterpolation - * - * SYNOPSIS - */ -static int -_XcmsIntensityInterpolation( - IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, - int bitsPerRGB) -/* - * DESCRIPTION - * Based on a given intensity, performs a linear interpolation - * on the values between two IntensityRec structures. - * The bitsPerRGB parameter is necessary to perform rounding - * to the correct number of significant bits. - * - * RETURNS - * Returns 0 if failed; otherwise non-zero. - */ -{ - XcmsFloat ratio; - long target, up, down; - int shift = 16 - bitsPerRGB; - int max_color = (1 << bitsPerRGB) - 1; - - ratio = (key->intensity - lo->intensity) / (hi->intensity - lo->intensity); - answer->intensity = key->intensity; - target = hi->value - lo->value; - target *= ratio; - target += lo->value; - - /* - * Ok now, lets find the closest in respects to bits per RGB - */ - up = ((target >> shift) * 0xFFFF) / max_color; - if (up < target) { - down = up; - up = (MIN((down >> shift) + 1, max_color) * 0xFFFF) / max_color; - } else { - down = (MAX((up >> shift) - 1, 0) * 0xFFFF) / max_color; - } - answer->value = ((up - target) < (target - down) ? up : down); - answer->value &= MASK[bitsPerRGB]; - return (XcmsSuccess); -} - - - -typedef int (*comparProcp)( - char *p1, - char *p2); -typedef int (*interpolProcp)( - char *key, - char *lo, - char *hi, - char *answer, - int bitsPerRGB); - -/* - * NAME - * _XcmsTableSearch - * - * SYNOPSIS - */ -static int -_XcmsTableSearch( - char *key, - int bitsPerRGB, - char *base, - unsigned nel, - unsigned nKeyPtrSize, - int (*compar)( - char *p1, - char *p2), - int (*interpol)( - char *key, - char *lo, - char *hi, - char *answer, - int bitsPerRGB), - char *answer) - -/* - * DESCRIPTION - * A binary search through the specificied table. - * - * RETURNS - * Returns 0 if failed; otherwise non-zero. - * - */ -{ - char *hi, *lo, *mid, *last; - int result; - - last = hi = base + ((nel - 1) * nKeyPtrSize); - mid = lo = base; - - /* use only the significants bits, then scale into 16 bits */ - ((IntensityRec *)key)->value = ((unsigned long) - (((IntensityRec *)key)->value >> (16 - bitsPerRGB)) * 0xFFFF) - / ((1 << bitsPerRGB) - 1); - - /* Special case so that zero intensity always maps to zero value */ - if ((*compar) (key,lo) <= 0) { - memcpy (answer, lo, nKeyPtrSize); - ((IntensityRec *)answer)->value &= MASK[bitsPerRGB]; - return XcmsSuccess; - } - while (mid != last) { - last = mid; - mid = lo + (((unsigned)(hi - lo) / nKeyPtrSize) / 2) * nKeyPtrSize; - result = (*compar) (key, mid); - if (result == 0) { - - memcpy(answer, mid, nKeyPtrSize); - ((IntensityRec *)answer)->value &= MASK[bitsPerRGB]; - return (XcmsSuccess); - } else if (result < 0) { - hi = mid; - } else { - lo = mid; - } - } - - /* - * If we got to here, we didn't find a solution, so we - * need to apply interpolation. - */ - return ((*interpol)(key, lo, hi, answer, bitsPerRGB)); -} - - -/* - * NAME - * _XcmsMatVec - multiply a 3 x 3 by a 3 x 1 vector - * - * SYNOPSIS - */ -static void _XcmsMatVec( - XcmsFloat *pMat, XcmsFloat *pIn, XcmsFloat *pOut) -/* - * DESCRIPTION - * Multiply the passed vector by the passed matrix to return a - * vector. Matrix is 3x3, vectors are of length 3. - * - * RETURNS - * void - */ -{ - int i, j; - - for (i = 0; i < 3; i++) { - pOut[i] = 0.0; - for (j = 0; j < 3; j++) - pOut[i] += *(pMat+(i*3)+j) * pIn[j]; - } -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - - -/* - * NAME - * XcmsLRGB_RGB_ParseString - * - * SYNOPSIS - */ -static int -XcmsLRGB_RGB_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsRGBFormat. - * - * RETURNS - * 0 if failed, non-zero otherwise. - */ -{ - register int n, i; - unsigned short r, g, b; - char c; - char *pchar; - unsigned short *pShort; - - /* - * Check for old # format - */ - if (*spec == '#') { - /* - * Attempt to parse the value portion. - */ - spec++; - n = strlen(spec); - if (n != 3 && n != 6 && n != 9 && n != 12) { - return(XcmsFailure); - } - - n /= 3; - g = b = 0; - do { - r = g; - g = b; - b = 0; - for (i = n; --i >= 0; ) { - c = *spec++; - b <<= 4; - if (c >= '0' && c <= '9') - b |= c - '0'; - /* assume string in lowercase - else if (c >= 'A' && c <= 'F') - b |= c - ('A' - 10); - */ - else if (c >= 'a' && c <= 'f') - b |= c - ('a' - 10); - else return (XcmsFailure); - } - } while (*spec != '\0'); - - /* - * Succeeded ! - */ - n <<= 2; - n = 16 - n; - /* shift instead of scale, to match old broken semantics */ - pColor->spec.RGB.red = r << n; - pColor->spec.RGB.green = g << n; - pColor->spec.RGB.blue = b << n; - } else { - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (int)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsRGB_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - spec += (n + 1); - pShort = &pColor->spec.RGB.red; - for (i = 0; i < 3; i++, pShort++, spec++) { - n = 0; - *pShort = 0; - while (*spec != '/' && *spec != '\0') { - if (++n > 4) { - return(XcmsFailure); - } - c = *spec++; - *pShort <<= 4; - if (c >= '0' && c <= '9') - *pShort |= c - '0'; - /* assume string in lowercase - else if (c >= 'A' && c <= 'F') - *pShort |= c - ('A' - 10); - */ - else if (c >= 'a' && c <= 'f') - *pShort |= c - ('a' - 10); - else return (XcmsFailure); - } - if (n == 0) - return (XcmsFailure); - if (n < 4) { - *pShort = ((unsigned long)*pShort * 0xFFFF) / ((1 << n*4) - 1); - } - } - } - pColor->format = XcmsRGBFormat; - pColor->pixel = 0; - return (XcmsSuccess); -} - - -/* - * NAME - * XcmsLRGB_RGBi_ParseString - * - * SYNOPSIS - */ -static int -XcmsLRGB_RGBi_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsRGBiFormat. - * The assumed RGBi string syntax is: - * RGBi:// - * Where r, g, and b are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - * 0 if failed, non-zero otherwise. - */ -{ - size_t n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (size_t)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsRGBi_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.RGBi.red, - &pColor->spec.RGBi.green, - &pColor->spec.RGBi.blue) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.RGBi.red, - &pColor->spec.RGBi.green, - &pColor->spec.RGBi.blue) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - - /* - * Succeeded ! - */ - pColor->format = XcmsRGBiFormat; - pColor->pixel = 0; - return (XcmsSuccess); -} - - -/* - * NAME - * XcmsCIEXYZToRGBi - convert CIE XYZ to RGB - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIEXYZToRGBi( - XcmsCCC ccc, - XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ - unsigned int nColors, /* Number of colors */ - Bool *pCompressed) /* pointer to an array of Bool */ -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from RGB format to RGBi format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression. - * XcmsSuccessWithCompression if succeeded with gamut - * compression. - */ -{ - LINEAR_RGB_SCCData *pScreenData; - XcmsFloat tmp[3]; - int hasCompressed = 0; - unsigned int i; - XcmsColor *pColor = pXcmsColors_in_out; - - if (ccc == NULL) { - return(XcmsFailure); - } - - pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; - - /* - * XcmsColors should be White Point Adjusted, if necessary, by now! - */ - - /* - * NEW!!! for extended gamut compression - * - * 1. Need to zero out pCompressed - * - * 2. Need to save initial address of pColor - * - * 3. Need to save initial address of pCompressed - */ - - for (i = 0; i < nColors; i++) { - - /* Make sure format is XcmsCIEXYZFormat */ - if (pColor->format != XcmsCIEXYZFormat) { - return(XcmsFailure); - } - - /* Multiply [A]-1 * [XYZ] to get RGB intensity */ - _XcmsMatVec((XcmsFloat *) pScreenData->XYZtoRGBmatrix, - (XcmsFloat *) &pColor->spec, tmp); - - if ((MIN3 (tmp[0], tmp[1], tmp[2]) < -EPS) || - (MAX3 (tmp[0], tmp[1], tmp[2]) > (1.0 + EPS))) { - - /* - * RGBi out of screen's gamut - */ - - if (ccc->gamutCompProc == NULL) { - /* - * Aha!! Here's that little trick that will allow - * gamut compression routines to get the out of bound - * RGBi. - */ - memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp)); - pColor->format = XcmsRGBiFormat; - return(XcmsFailure); - } else if ((*ccc->gamutCompProc)(ccc, pXcmsColors_in_out, nColors, - i, pCompressed) == 0) { - return(XcmsFailure); - } - - /* - * The gamut compression function should return colors in CIEXYZ - * Also check again to if the new color is within gamut. - */ - if (pColor->format != XcmsCIEXYZFormat) { - return(XcmsFailure); - } - _XcmsMatVec((XcmsFloat *) pScreenData->XYZtoRGBmatrix, - (XcmsFloat *) &pColor->spec, tmp); - if ((MIN3 (tmp[0], tmp[1], tmp[2]) < -EPS) || - (MAX3 (tmp[0], tmp[1], tmp[2]) > (1.0 + EPS))) { - return(XcmsFailure); - } - hasCompressed++; - } - memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp)); - /* These if statements are done to ensure the fudge factor is */ - /* is taken into account. */ - if (pColor->spec.RGBi.red < 0.0) { - pColor->spec.RGBi.red = 0.0; - } else if (pColor->spec.RGBi.red > 1.0) { - pColor->spec.RGBi.red = 1.0; - } - if (pColor->spec.RGBi.green < 0.0) { - pColor->spec.RGBi.green = 0.0; - } else if (pColor->spec.RGBi.green > 1.0) { - pColor->spec.RGBi.green = 1.0; - } - if (pColor->spec.RGBi.blue < 0.0) { - pColor->spec.RGBi.blue = 0.0; - } else if (pColor->spec.RGBi.blue > 1.0) { - pColor->spec.RGBi.blue = 1.0; - } - (pColor++)->format = XcmsRGBiFormat; - } - return (hasCompressed ? XcmsSuccessWithCompression : XcmsSuccess); -} - - -/* - * NAME - * LINEAR_RGBi_to_CIEXYZ - convert RGBi to CIEXYZ - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsRGBiToCIEXYZ( - XcmsCCC ccc, - XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ - unsigned int nColors, /* Number of colors */ - Bool *pCompressed) /* pointer to a bit array */ -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from RGBi format to CIEXYZ format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - */ -{ - LINEAR_RGB_SCCData *pScreenData; - XcmsFloat tmp[3]; - - /* - * pCompressed ignored in this function. - */ - - if (ccc == NULL) { - return(XcmsFailure); - } - - pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; - - /* - * XcmsColors should be White Point Adjusted, if necessary, by now! - */ - - while (nColors--) { - - /* Multiply [A]-1 * [XYZ] to get RGB intensity */ - _XcmsMatVec((XcmsFloat *) pScreenData->RGBtoXYZmatrix, - (XcmsFloat *) &pXcmsColors_in_out->spec, tmp); - - memcpy((char *)&pXcmsColors_in_out->spec, (char *)tmp, sizeof(tmp)); - (pXcmsColors_in_out++)->format = XcmsCIEXYZFormat; - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsRGBiToRGB - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsRGBiToRGB( - XcmsCCC ccc, - XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ - unsigned int nColors, /* Number of colors */ - Bool *pCompressed) /* pointer to a bit array */ -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from RGBi format to RGB format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression. - * XcmsSuccessWithCompression if succeeded with gamut - * compression. - */ -{ - LINEAR_RGB_SCCData *pScreenData; - XcmsRGB tmpRGB; - IntensityRec keyIRec, answerIRec; - - /* - * pCompressed ignored in this function. - */ - - if (ccc == NULL) { - return(XcmsFailure); - } - - pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; - - while (nColors--) { - - /* Make sure format is XcmsRGBiFormat */ - if (pXcmsColors_in_out->format != XcmsRGBiFormat) { - return(XcmsFailure); - } - - keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.red; - if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, - (char *)pScreenData->pRedTbl->pBase, - (unsigned)pScreenData->pRedTbl->nEntries, - (unsigned)sizeof(IntensityRec), - (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { - return(XcmsFailure); - } - tmpRGB.red = answerIRec.value; - - keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.green; - if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, - (char *)pScreenData->pGreenTbl->pBase, - (unsigned)pScreenData->pGreenTbl->nEntries, - (unsigned)sizeof(IntensityRec), - (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { - return(XcmsFailure); - } - tmpRGB.green = answerIRec.value; - - keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.blue; - if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, - (char *)pScreenData->pBlueTbl->pBase, - (unsigned)pScreenData->pBlueTbl->nEntries, - (unsigned)sizeof(IntensityRec), - (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { - return(XcmsFailure); - } - tmpRGB.blue = answerIRec.value; - - memcpy((char *)&pXcmsColors_in_out->spec, (char *)&tmpRGB, sizeof(XcmsRGB)); - (pXcmsColors_in_out++)->format = XcmsRGBFormat; - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsRGBToRGBi - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsRGBToRGBi( - XcmsCCC ccc, - XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ - unsigned int nColors, /* Number of colors */ - Bool *pCompressed) /* pointer to a bit array */ -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from RGB format to RGBi format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - */ -{ - LINEAR_RGB_SCCData *pScreenData; - XcmsRGBi tmpRGBi; - IntensityRec keyIRec, answerIRec; - - /* - * pCompressed ignored in this function. - */ - - if (ccc == NULL) { - return(XcmsFailure); - } - - pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; - - while (nColors--) { - - /* Make sure format is XcmsRGBFormat */ - if (pXcmsColors_in_out->format != XcmsRGBFormat) { - return(XcmsFailure); - } - - keyIRec.value = pXcmsColors_in_out->spec.RGB.red; - if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, - (char *)pScreenData->pRedTbl->pBase, - (unsigned)pScreenData->pRedTbl->nEntries, - (unsigned)sizeof(IntensityRec), - (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { - return(XcmsFailure); - } - tmpRGBi.red = answerIRec.intensity; - - keyIRec.value = pXcmsColors_in_out->spec.RGB.green; - if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, - (char *)pScreenData->pGreenTbl->pBase, - (unsigned)pScreenData->pGreenTbl->nEntries, - (unsigned)sizeof(IntensityRec), - (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { - return(XcmsFailure); - } - tmpRGBi.green = answerIRec.intensity; - - keyIRec.value = pXcmsColors_in_out->spec.RGB.blue; - if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, - (char *)pScreenData->pBlueTbl->pBase, - (unsigned)pScreenData->pBlueTbl->nEntries, - (unsigned)sizeof(IntensityRec), - (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { - return(XcmsFailure); - } - tmpRGBi.blue = answerIRec.intensity; - - memcpy((char *)&pXcmsColors_in_out->spec, (char *)&tmpRGBi, sizeof(XcmsRGBi)); - (pXcmsColors_in_out++)->format = XcmsRGBiFormat; - } - return(XcmsSuccess); -} - -/* - * NAME - * _XcmsInitScrnDefaultInfo - * - * SYNOPSIS - */ -/* ARGSUSED */ -int -_XcmsLRGB_InitScrnDefault( - Display *dpy, - int screenNumber, - XcmsPerScrnInfo *pPerScrnInfo) -/* - * DESCRIPTION - * Given a display and screen number, this routine attempts - * to initialize the Xcms per Screen Info structure - * (XcmsPerScrnInfo) with defaults. - * - * RETURNS - * Returns zero if initialization failed; non-zero otherwise. - */ -{ - pPerScrnInfo->screenData = (XPointer)&Default_RGB_SCCData; - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X = - Default_RGB_SCCData.RGBtoXYZmatrix[0][0] + - Default_RGB_SCCData.RGBtoXYZmatrix[0][1] + - Default_RGB_SCCData.RGBtoXYZmatrix[0][2]; - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = - Default_RGB_SCCData.RGBtoXYZmatrix[1][0] + - Default_RGB_SCCData.RGBtoXYZmatrix[1][1] + - Default_RGB_SCCData.RGBtoXYZmatrix[1][2]; - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z = - Default_RGB_SCCData.RGBtoXYZmatrix[2][0] + - Default_RGB_SCCData.RGBtoXYZmatrix[2][1] + - Default_RGB_SCCData.RGBtoXYZmatrix[2][2]; - if ((pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y < (1.0 - EPS) ) - || (pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y > (1.0 + EPS))) { - pPerScrnInfo->screenData = (XPointer)NULL; - pPerScrnInfo->state = XcmsInitNone; - return(0); - } - pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = 1.0; - pPerScrnInfo->screenWhitePt.format = XcmsCIEXYZFormat; - pPerScrnInfo->screenWhitePt.pixel = 0; - pPerScrnInfo->functionSet = (XPointer)&XcmsLinearRGBFunctionSet; - pPerScrnInfo->state = XcmsInitFailure; /* default initialization */ - return(1); -} diff --git a/nx-X11/lib/X11/Lab.c b/nx-X11/lib/X11/Lab.c deleted file mode 100644 index 6f7075643..000000000 --- a/nx-X11/lib/X11/Lab.c +++ /dev/null @@ -1,431 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * CIELab.c - * - * DESCRIPTION - * This file contains routines that support the CIE L*a*b* - * color space to include conversions to and from the CIE - * XYZ space. These conversions are from Principles of - * Color Technology Second Edition, Fred W. Billmeyer, Jr. - * and Max Saltzman, John Wiley & Sons, Inc., 1981. - * - * Note that the range for L* is 0 to 1. - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include /* sscanf */ -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - * Internal definitions that need NOT be exported to any package - * or program using this package. - */ -#ifdef DBL_EPSILON -# define XMY_DBL_EPSILON DBL_EPSILON -#else -# define XMY_DBL_EPSILON 0.00001 -#endif -#define DIV16BY116 0.137931 - -/* - * FORWARD DECLARATIONS - */ - -static int CIELab_ParseString(register char *spec, XcmsColor *pColor); -static Status XcmsCIELab_ValidSpec(XcmsColor *pColor); - - -/* - * LOCAL VARIABLES - */ - - - /* - * NULL terminated list of functions applied to get from CIELab to CIEXYZ - */ -static XcmsConversionProc Fl_CIELab_to_CIEXYZ[] = { - XcmsCIELabToCIEXYZ, - NULL -}; - - /* - * NULL terminated list of functions applied to get from CIEXYZ to CIELab - */ -static XcmsConversionProc Fl_CIEXYZ_to_CIELab[] = { - XcmsCIEXYZToCIELab, - NULL -}; - - -/* - * GLOBALS - */ - /* - * CIE Lab Color Space - */ -XcmsColorSpace XcmsCIELabColorSpace = - { - _XcmsCIELab_prefix, /* prefix */ - XcmsCIELabFormat, /* id */ - CIELab_ParseString, /* parseString */ - Fl_CIELab_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_CIELab, /* from_CIEXYZ */ - 1 - }; - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * CIELab_ParseString - * - * SYNOPSIS - */ -static int -CIELab_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsCIELabFormat. - * The assumed CIELab string syntax is: - * CIELab:// - * Where L, a, and b are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - * 0 if failed, non-zero otherwise. - */ -{ - int n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (int)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsCIELab_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIELab.L_star, - &pColor->spec.CIELab.a_star, - &pColor->spec.CIELab.b_star) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIELab.L_star, - &pColor->spec.CIELab.a_star, - &pColor->spec.CIELab.b_star) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - pColor->format = XcmsCIELabFormat; - pColor->pixel = 0; - - return(XcmsCIELab_ValidSpec(pColor)); -} - - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELab_ValidSpec - * - * SYNOPSIS - */ -static Status -XcmsCIELab_ValidSpec( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks if color specification valid for CIE L*a*b*. - * - * RETURNS - * XcmsFailure if invalid, - * XcmsSuccess if valid. - * - */ -{ - if (pColor->format != XcmsCIELabFormat - || - (pColor->spec.CIELab.L_star < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIELab.L_star > 100.0 + XMY_DBL_EPSILON)) { - return(XcmsFailure); - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIELabToCIEXYZ - convert CIELab to CIEXYZ - * - * SYNOPSIS - */ -Status -XcmsCIELabToCIEXYZ( - XcmsCCC ccc, - XcmsColor *pLab_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIELab format to CIEXYZ format. - * - * WARNING: This routine assumes that Yn = 1.0; - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsCIEXYZ XYZ_return; - XcmsFloat tmpFloat, tmpL; - XcmsColor whitePt; - unsigned int i; - XcmsColor *pColor = pColors_in_out; - - /* - * Check arguments - */ - if (pLab_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Make sure white point is in CIEXYZ form, if not, convert it. - */ - if (pLab_WhitePt->format != XcmsCIEXYZFormat) { - /* Make a copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pLab_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, - (XcmsColor *)NULL, 1, XcmsCIEXYZFormat)) { - return(XcmsFailure); - } - pLab_WhitePt = &whitePt; - } - - /* - * Make sure it is a white point, i.e., Y == 1.0 - */ - if (pLab_WhitePt->spec.CIEXYZ.Y != 1.0) { - return (0); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - /* Make sure original format is CIELab */ - if (!XcmsCIELab_ValidSpec(pColor)) { - return(XcmsFailure); - } - - /* Calculate Y: assume that Yn = 1.0 */ - tmpL = (pColor->spec.CIELab.L_star + 16.0) / 116.0; - XYZ_return.Y = tmpL * tmpL * tmpL; - - if (XYZ_return.Y < 0.008856) { - /* Calculate Y: assume that Yn = 1.0 */ - tmpL = pColor->spec.CIELab.L_star / 9.03292; - - /* Calculate X */ - XYZ_return.X = pLab_WhitePt->spec.CIEXYZ.X * - ((pColor->spec.CIELab.a_star / 3893.5) + tmpL); - /* Calculate Y */ - XYZ_return.Y = tmpL; - /* Calculate Z */ - XYZ_return.Z = pLab_WhitePt->spec.CIEXYZ.Z * - (tmpL - (pColor->spec.CIELab.b_star / 1557.4)); - } else { - /* Calculate X */ - tmpFloat = tmpL + (pColor->spec.CIELab.a_star / 5.0); - XYZ_return.X = pLab_WhitePt->spec.CIEXYZ.X * tmpFloat * tmpFloat * tmpFloat; - - /* Calculate Z */ - tmpFloat = tmpL - (pColor->spec.CIELab.b_star / 2.0); - XYZ_return.Z = pLab_WhitePt->spec.CIEXYZ.Z * tmpFloat * tmpFloat * tmpFloat; - } - - memcpy((char *)&pColor->spec.CIEXYZ, (char *)&XYZ_return, - sizeof(XcmsCIEXYZ)); - pColor->format = XcmsCIEXYZFormat; - } - - return (1); -} - - -/* - * NAME - * XcmsCIEXYZToCIELab - convert CIEXYZ to CIELab - * - * SYNOPSIS - */ -Status -XcmsCIEXYZToCIELab( - XcmsCCC ccc, - XcmsColor *pLab_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIEXYZ format to CIELab format. - * - * WARNING: This routine assumes that Yn = 1.0; - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsCIELab Lab_return; - XcmsFloat fX_Xn, fY_Yn, fZ_Zn; - XcmsColor whitePt; - unsigned int i; - XcmsColor *pColor = pColors_in_out; - - /* - * Check arguments - */ - if (pLab_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Make sure white point is in CIEXYZ form, if not, convert it. - */ - if (pLab_WhitePt->format != XcmsCIEXYZFormat) { - /* Make a copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pLab_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, - 1, XcmsCIEXYZFormat)) { - return(XcmsFailure); - } - pLab_WhitePt = &whitePt; - } - - /* - * Make sure it is a white point, i.e., Y == 1.0 - */ - if (pLab_WhitePt->spec.CIEXYZ.Y != 1.0) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - /* Make sure original format is CIELab */ - if (!_XcmsCIEXYZ_ValidSpec(pColor)) { - return(XcmsFailure); - } - - /* Calculate L*: assume Yn = 1.0 */ - if (pColor->spec.CIEXYZ.Y < 0.008856) { - fY_Yn = (0.07787 * pColor->spec.CIEXYZ.Y) + DIV16BY116; - /* note fY_Yn used to compute Lab_return.a below */ - Lab_return.L_star = 116.0 * (fY_Yn - DIV16BY116); - } else { - fY_Yn = (XcmsFloat)XCMS_CUBEROOT(pColor->spec.CIEXYZ.Y); - /* note fY_Yn used to compute Lab_return.a_star below */ - Lab_return.L_star = (116.0 * fY_Yn) - 16.0; - } - - /* Calculate f(X/Xn) */ - if ((fX_Xn = pColor->spec.CIEXYZ.X / pLab_WhitePt->spec.CIEXYZ.X) < 0.008856) { - fX_Xn = (0.07787 * fX_Xn) + DIV16BY116; - } else { - fX_Xn = (XcmsFloat) XCMS_CUBEROOT(fX_Xn); - } - - /* Calculate f(Z/Zn) */ - if ((fZ_Zn = pColor->spec.CIEXYZ.Z / pLab_WhitePt->spec.CIEXYZ.Z) < 0.008856) { - fZ_Zn = (0.07787 * fZ_Zn) + DIV16BY116; - } else { - fZ_Zn = (XcmsFloat) XCMS_CUBEROOT(fZ_Zn); - } - - Lab_return.a_star = 5.0 * (fX_Xn - fY_Yn); - Lab_return.b_star = 2.0 * (fY_Yn - fZ_Zn); - - memcpy((char *)&pColor->spec.CIELab, (char *)&Lab_return, - sizeof(XcmsCIELab)); - pColor->format = XcmsCIELabFormat; - } - - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LabGcC.c b/nx-X11/lib/X11/LabGcC.c deleted file mode 100644 index a5ec9f457..000000000 --- a/nx-X11/lib/X11/LabGcC.c +++ /dev/null @@ -1,127 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELabGcC.c - * - * DESCRIPTION - * Source for XcmsCIELabClipuv() gamut compression routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabClipab - Reduce the chroma for a hue and L* - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIELabClipab ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * Reduce the Chroma for a specific hue and chroma to - * to bring the given color into the gamut of the - * specified device. As required of gamut compression - * functions, this routine returns pColor_in_out - * in XcmsCIEXYZFormat on successful completion. - * - * Since this routine works with the L* within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - Status retval; - XcmsColor *pColor; - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < PseudoColor) { - /* - * GRAY ! - */ - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIELabFormat); - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIEXYZFormat); - if (pCompressed) { - *(pCompressed + i) = True; - } - return(XcmsSuccess); - } else { - if (pColor->format != XcmsCIELabFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIELabFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsCIELabQueryMaxC(ccc, - degrees(XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, - pColor->spec.CIELab.b_star)), - pColor->spec.CIELab.L_star, - pColor) == XcmsFailure) { - return(XcmsFailure); - } - retval = _XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/LabGcL.c b/nx-X11/lib/X11/LabGcL.c deleted file mode 100644 index 3038b18a8..000000000 --- a/nx-X11/lib/X11/LabGcL.c +++ /dev/null @@ -1,174 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELabGcL.c - * - * DESCRIPTION - * Source for XcmsCIELabClipL() gamut compression routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabClipL - Return the closest L* - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIELabClipL ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * Return the closest L* for a specific hue and chroma. - * This routine takes any color as input and outputs - * a CIE XYZ color. - * - * Since this routine works with the L* within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor *pColor; - XcmsColor Lab_max; - XcmsFloat hue, chroma, maxChroma; - Status retval; - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor) { - /* - * GRAY ! - */ - return(XcmsFailure); - } else { - /* Convert from CIEXYZ to CIE L*u*v* format */ - if (_XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat) - == XcmsFailure) { - return(XcmsFailure); - } - - hue = XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, - pColor->spec.CIELab.b_star); - chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, - pColor->spec.CIELab.b_star); - /* Step 1: compute the maximum L* and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor)); - if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, - (XcmsRGBi *)NULL) == XcmsFailure) { - return (XcmsFailure); - } - maxChroma = XCMS_CIELAB_PMETRIC_CHROMA(Lab_max.spec.CIELab.a_star, - Lab_max.spec.CIELab.b_star); - - /* Now check and return the appropriate L* */ - if (chroma == maxChroma) { - /* When the chroma input is equal to the maximum chroma */ - /* merely return the L* for that chroma. */ - memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } else if (chroma > maxChroma) { - /* When the chroma input is greater than the maximum chroma */ - /* merely return the L* and chroma for the given hue. */ - memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); - return (XcmsFailure); - } else if (pColor->spec.CIELab.L_star < Lab_max.spec.CIELab.L_star) { - /* Find the minimum lightness for the given chroma. */ - if (pColor->format != XcmsCIELabFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsCIELabQueryMinL(&myCCC, degrees(hue), chroma, pColor) - == XcmsFailure) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } else { - /* Find the maximum lightness for the given chroma. */ - if (pColor->format != XcmsCIELabFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsCIELabQueryMaxL(&myCCC, degrees(hue), chroma, pColor) - == XcmsFailure) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/LabGcLC.c b/nx-X11/lib/X11/LabGcLC.c deleted file mode 100644 index 494d34e57..000000000 --- a/nx-X11/lib/X11/LabGcLC.c +++ /dev/null @@ -1,223 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELabGcLC.c - * - * DESCRIPTION - * Source for XcmsCIELabClipLab() gamut - * compression function. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * INTERNALS - * Internal defines that need NOT be exported to any package or - * program using this package. - */ -#define MAXBISECTCOUNT 100 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabClipLab - Return the closest L* and chroma - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIELabClipLab ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * This routine will find the closest L* and chroma - * for a specific hue. The color input is converted to - * CIE L*u*v* format and returned as CIE XYZ format. - * - * Since this routine works with the L* within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - Status retval; - XcmsCCCRec myCCC; - XcmsColor *pColor; - XcmsColor Lab_max; - XcmsFloat hue, chroma, maxChroma; - XcmsFloat Chroma, bestChroma, Lstar, maxLstar, saveLstar; - XcmsFloat bestLstar, bestastar, bestbstar; - XcmsFloat nT, saveDist, tmpDist; - XcmsRGBi rgb_max; - int nCount, nMaxCount, nI, nILast; - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor) { - /* - * GRAY ! - */ - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIELabFormat); - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIEXYZFormat); - if (pCompressed) { - *(pCompressed + i) = True; - } - return(XcmsSuccess); - } - - /* Convert from CIEXYZ to CIELab format */ - if (_XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat) - == XcmsFailure) { - return(XcmsFailure); - } - - /* Step 1: compute the maximum L* and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - saveLstar = pColor->spec.CIELab.L_star; - hue = XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, - pColor->spec.CIELab.b_star); - chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, - pColor->spec.CIELab.b_star); - memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor)); - if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max) - == XcmsFailure) { - return (XcmsFailure); - } - maxLstar = Lab_max.spec.CIELab.L_star; - - /* Now check and return the appropriate L* */ - if (saveLstar == maxLstar) { - /* When the L* input is equal to the maximum L* */ - /* merely return the maximum Lab point. */ - memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } else { - /* return the closest point on the hue leaf. */ - /* must do a bisection here to compute the delta e. */ - maxChroma = XCMS_CIELAB_PMETRIC_CHROMA(Lab_max.spec.CIELab.a_star, - Lab_max.spec.CIELab.b_star); - nMaxCount = MAXBISECTCOUNT; - nI = nMaxCount / 2; - bestLstar = Lstar = pColor->spec.CIELab.L_star; - bestastar = pColor->spec.CIELab.a_star; - bestbstar = pColor->spec.CIELab.b_star; - bestChroma = Chroma = chroma; - saveDist = XCMS_SQRT(((Chroma - maxChroma) * (Chroma - maxChroma)) + - ((Lstar - maxLstar) * (Lstar - maxLstar))); - for (nCount = 0; nCount < nMaxCount; nCount++) { - nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; - if (saveLstar > maxLstar) { - pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; - pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; - pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; - } else { - pColor->spec.RGBi.red = rgb_max.red - (rgb_max.red * nT); - pColor->spec.RGBi.green = rgb_max.green - (rgb_max.green * nT); - pColor->spec.RGBi.blue = rgb_max.blue - (rgb_max.blue * nT); - } - pColor->format = XcmsRGBiFormat; - - /* Convert from RGBi to CIE Lab */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, - (Bool *) NULL) == XcmsFailure) { - return (XcmsFailure); - } - chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, - pColor->spec.CIELab.b_star); - tmpDist = XCMS_SQRT(((Chroma - chroma) * (Chroma - chroma)) + - ((Lstar - pColor->spec.CIELab.L_star) * - (Lstar - pColor->spec.CIELab.L_star))); - nILast = nI; - if (tmpDist > saveDist) { - nI /= 2; - } else { - nI = (nMaxCount + nI) / 2; - saveDist = tmpDist; - bestLstar = pColor->spec.CIELab.L_star; - bestastar = pColor->spec.CIELab.a_star; - bestbstar = pColor->spec.CIELab.b_star; - bestChroma = chroma; - } - if (nI == nILast || nI == 0) { - break; - } - } - if (bestChroma >= maxChroma) { - pColor->spec.CIELab.L_star = maxLstar; - pColor->spec.CIELab.a_star = Lab_max.spec.CIELab.a_star; - pColor->spec.CIELab.b_star = Lab_max.spec.CIELab.b_star; - } else { - pColor->spec.CIELab.L_star = bestLstar; - pColor->spec.CIELab.a_star = bestastar; - pColor->spec.CIELab.b_star = bestbstar; - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - } - return(retval); -} diff --git a/nx-X11/lib/X11/LabMnL.c b/nx-X11/lib/X11/LabMnL.c deleted file mode 100644 index 18ff04cd1..000000000 --- a/nx-X11/lib/X11/LabMnL.c +++ /dev/null @@ -1,216 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELabMnL.c - * - * DESCRIPTION - * Source for the XcmsCIELabQueryMinL() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS (XcmsFloat)0.001 -#define START_L_STAR (XcmsFloat)40.0 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabQueryMinL - Compute max Lstar for a hue and chroma - * - * SYNOPSIS - */ -Status -XcmsCIELabQueryMinL( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue angle in degrees */ - XcmsFloat chroma, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum Lstar for a specified hue_angle and chroma. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded with no modifications - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor max_lc, tmp, prev; - XcmsFloat max_chroma, tmp_chroma; - XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; - XcmsFloat rFactor; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* setup the CCC to use for the conversions. */ - memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc) NULL; - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - hue = radians(hue_angle); - tmp.spec.CIELab.L_star = START_L_STAR; - tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, chroma); - tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma); - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsCIELabFormat; - - /* Step 1: Obtain the maximum L_star and chroma for this hue. */ - if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - max_chroma = XCMS_CIELAB_PMETRIC_CHROMA(max_lc.spec.CIELab.a_star, - max_lc.spec.CIELab.b_star); - - if (max_chroma <= chroma) { - /* - * If the chroma is greater than the chroma for the - * maximum L/chroma point then the L_star is the - * the L_star for the maximum L_star/chroma point. - * This is an error but I return the best approximation I can. - * Thus the inconsistency. - */ - memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - return(XcmsSuccess); - } - - /* - * If the chroma is equal to the chroma for the - * maximum L_star/chroma point then the L_star is the - * the L_star for the maximum L* and chroma point. - */ - /* if (max_chroma == chroma) { - * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - * return(XcmsSuccess); - * } - */ - - /* must do a bisection here to compute the maximum L* */ - /* save the structure input so that any elements that */ - /* are not touched are recopied later in the routine. */ - nChroma = chroma; - tmp_chroma = max_chroma; - lastChroma = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prevChroma = lastChroma; - lastChroma = tmp_chroma; - nT = (nChroma - max_chroma) / max_chroma * rFactor; - memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); - tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); - tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); - tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to CIELab */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Now check the return against what is expected */ - tmp_chroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, - tmp.spec.CIELab.b_star); - if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { - /* Found It! */ - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } - nChroma += chroma - tmp_chroma; - if (nChroma > max_chroma) { - nChroma = max_chroma; - rFactor *= 0.5; /* selective relaxation employed */ - } else if (nChroma < 0.0) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - return(XcmsSuccess); - } else if (tmp_chroma <= prevChroma + EPS && - tmp_chroma >= prevChroma - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - } - } - - if (nCount >= nMaxCount) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - } - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LabMxC.c b/nx-X11/lib/X11/LabMxC.c deleted file mode 100644 index fcadd236a..000000000 --- a/nx-X11/lib/X11/LabMxC.c +++ /dev/null @@ -1,203 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * CIELabMxC.c - * - * DESCRIPTION - * Source for the XcmsCIELabQueryMaxC() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS (XcmsFloat)0.001 -#define START_CHROMA (XcmsFloat)3.6 -#define TOPL (XcmsFloat)100.0 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabQueryMaxC - max chroma for a hue_angle and L_star - * - * SYNOPSIS - */ -Status -XcmsCIELabQueryMaxC( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue angle in degrees */ - XcmsFloat L_star, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum chroma for a specific hue_angle and L_star. - * The returned format is in XcmsCIELabFormat. - * - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor tmp; - XcmsColor max_lc; - XcmsFloat n_L_star, last_L_star, prev_L_star; - XcmsFloat hue, lastaStar, lastbStar, /*lastChroma,*/ maxDist, nT, rFactor; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* Use my own CCC and inherit screen white Pt */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - hue = radians(hue_angle); - tmp.spec.CIELab.L_star = L_star; - tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, START_CHROMA); - tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, START_CHROMA); - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsCIELabFormat; - - /* Step 1: compute the maximum L_star and chroma for this hue. */ - memcpy((char *)&max_lc, (char *)&tmp, sizeof(XcmsColor)); - if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Step 2: Do a bisection here to compute the maximum chroma - * Note the differences between when the point to be found - * is above the maximum LC point and when it is below. - */ - if (L_star <= max_lc.spec.CIELab.L_star) { - maxDist = max_lc.spec.CIELab.L_star; - } else { - maxDist = TOPL - max_lc.spec.CIELab.L_star; - } - - n_L_star = L_star; - last_L_star = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prev_L_star = last_L_star; - last_L_star = tmp.spec.CIELab.L_star; -/* lastChroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, */ -/* tmp.spec.CIELab.b_star); */ - lastaStar = tmp.spec.CIELab.a_star; - lastbStar = tmp.spec.CIELab.b_star; - nT = (n_L_star - max_lc.spec.CIELab.L_star) / maxDist * rFactor; - if (nT > 0) { - tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - } else { - tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); - tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); - tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); - } - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to CIELab */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Now check if we've reached the target L_star - */ - /* printf("result Lstar = %lf\n", tmp.spec.CIELab.L_star); */ - if (tmp.spec.CIELab.L_star <= L_star + EPS && - tmp.spec.CIELab.L_star >= L_star - EPS) { - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); - } - if (nT > 0) { - n_L_star += ((TOPL - n_L_star) * - (L_star - tmp.spec.CIELab.L_star)) / (TOPL - L_star); - } else { - n_L_star *= L_star / tmp.spec.CIELuv.L_star; - } - if (tmp.spec.CIELab.L_star <= prev_L_star + EPS && - tmp.spec.CIELab.L_star >= prev_L_star - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - /* printf("rFactor = %lf\n", rFactor); */ - } - } - if (XCMS_FABS(last_L_star - L_star) < - XCMS_FABS(tmp.spec.CIELab.L_star - L_star)) { - tmp.spec.CIELab.a_star = lastaStar; - tmp.spec.CIELab.b_star = lastbStar; -/* tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, lastChroma); */ -/* tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, lastChroma); */ - } - tmp.spec.CIELab.L_star = L_star; - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LabMxL.c b/nx-X11/lib/X11/LabMxL.c deleted file mode 100644 index 66ef48481..000000000 --- a/nx-X11/lib/X11/LabMxL.c +++ /dev/null @@ -1,216 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELabMxL.c - * - * DESCRIPTION - * Source for the XcmsCIELabQueryMaxL() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS (XcmsFloat)0.001 -#define START_L_STAR (XcmsFloat)40 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabQueryMaxL - Compute max Lstar for a hue and chroma - * - * SYNOPSIS - */ -Status -XcmsCIELabQueryMaxL( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue in degrees */ - XcmsFloat chroma, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum Lstar for a specified hue_angle and chroma. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded with no modifications - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor max_lc, tmp, prev; - XcmsFloat max_chroma, tmp_chroma; - XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; - XcmsFloat rFactor; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* setup the CCC to use for the conversions. */ - memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc) NULL; - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - hue = radians(hue_angle); - tmp.spec.CIELab.L_star = START_L_STAR; - tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, chroma); - tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma); - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsCIELabFormat; - - /* Step 1: Obtain the maximum L_star and chroma for this hue. */ - if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - max_chroma = XCMS_CIELAB_PMETRIC_CHROMA(max_lc.spec.CIELab.a_star, - max_lc.spec.CIELab.b_star); - - if (max_chroma <= chroma) { - /* - * If the chroma is greater than the chroma for the - * maximum L/chroma point then the L_star is the - * the L_star for the maximum L_star/chroma point. - * This is an error but I return the best approximation I can. - * Thus the inconsistency. - */ - memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - return(XcmsSuccess); - } - - /* - * If the chroma is equal to the chroma for the - * maximum L_star/chroma point then the L_star is the - * the L_star for the maximum L* and chroma point. - */ - /* if (max_chroma == chroma) { - * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - * return(XcmsSuccess); - * } - */ - - /* must do a bisection here to compute the maximum L* */ - /* save the structure input so that any elements that */ - /* are not touched are recopied later in the routine. */ - nChroma = chroma; - tmp_chroma = max_chroma; - lastChroma = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prevChroma = lastChroma; - lastChroma = tmp_chroma; - nT = (1.0 - (nChroma / max_chroma)) * rFactor; - memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); - tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to CIELab */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Now check the return against what is expected */ - tmp_chroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, - tmp.spec.CIELab.b_star); - if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { - /* Found It! */ - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } - nChroma += chroma - tmp_chroma; - if (nChroma > max_chroma) { - nChroma = max_chroma; - rFactor *= 0.5; /* selective relaxation employed */ - } else if (nChroma < 0.0) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - return(XcmsSuccess); - } else if (tmp_chroma <= prevChroma + EPS && - tmp_chroma >= prevChroma - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - } - } - - if (nCount >= nMaxCount) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - } - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LabMxLC.c b/nx-X11/lib/X11/LabMxLC.c deleted file mode 100644 index 8cc089a22..000000000 --- a/nx-X11/lib/X11/LabMxLC.c +++ /dev/null @@ -1,218 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * CIELabMxVC.c - * - * DESCRIPTION - * Source for the XcmsCIELabQueryMaxLC() gamut boundary - * querying routine. - * - * DOCUMENTATION - * "TekColor Color Management System, System Implementor's Manual" - * and - * Fred W. Billmeyer & Max Saltzman, "Principles of Color - * Technology", John Wily & Sons, Inc, 1981. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - */ -#define MIN(x,y) ((x) > (y) ? (y) : (x)) -#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) -#define START_LSTAR (XcmsFloat)40.0 -#define START_CHROMA (XcmsFloat)3.6 - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsCIELabQueryMaxLCRGB - Compute maximum L* and chroma. - * - * SYNOPSIS - */ -Status -_XcmsCIELabQueryMaxLCRGB( - XcmsCCC ccc, - XcmsFloat hue, /* hue in radians */ - XcmsColor *pColor_return, - XcmsRGBi *pRGB_return) -/* - * DESCRIPTION - * Return the maximum psychometric chroma for a specified - * hue, and the corresponding L*. This is computed - * by a binary search of all possible chromas. An assumption - * is made that there are no local maxima. Use the unrounded - * Max psychometric chroma because the difference check can be - * small. - * - * NOTE: No local CCC is used because this is a private - * routine and all routines that call it are expected - * to behave properly, i.e. send a local CCC with - * no white adjust function and no gamut compression - * function. - * - * This routine only accepts hue in radians as input and outputs - * Lab and RGBi. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsFloat nSmall, nLarge; - XcmsColor tmp; - - tmp.format = XcmsCIELabFormat; - /* Use some unreachable color on the given hue */ - tmp.spec.CIELab.L_star = START_LSTAR; - tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, START_CHROMA); - tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, START_CHROMA); - /* - * Convert from Lab to RGB - * - * Note that the CIEXYZ to RGBi conversion routine must stuff the - * out of bounds RGBi values in tmp when the ccc->gamutCompProc - * is NULL. - */ - if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), - (unsigned int)1, XcmsRGBiFormat, (Bool *) NULL) - == XcmsFailure) && tmp.format != XcmsRGBiFormat) { - return (XcmsFailure); - } - - /* Now pick the smallest RGB */ - nSmall = MIN3(tmp.spec.RGBi.red, - tmp.spec.RGBi.green, - tmp.spec.RGBi.blue); - /* Make the smallest RGB equal to zero */ - tmp.spec.RGBi.red -= nSmall; - tmp.spec.RGBi.green -= nSmall; - tmp.spec.RGBi.blue -= nSmall; - - /* Now pick the largest RGB */ - nLarge = MAX3(tmp.spec.RGBi.red, - tmp.spec.RGBi.green, - tmp.spec.RGBi.blue); - /* Scale the RGB values based on the largest one */ - tmp.spec.RGBi.red /= nLarge; - tmp.spec.RGBi.green /= nLarge; - tmp.spec.RGBi.blue /= nLarge; - tmp.format = XcmsRGBiFormat; - - /* If the calling routine wants RGB value give them the ones used. */ - if (pRGB_return) { - pRGB_return->red = tmp.spec.RGBi.red; - pRGB_return->green = tmp.spec.RGBi.green; - pRGB_return->blue = tmp.spec.RGBi.blue; - } - - /* Convert from RGBi to Lab */ - if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, - ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat, (Bool *) NULL) - == XcmsFailure) { - return (XcmsFailure); - } - - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return (XcmsSuccess); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabQueryMaxLC - Compute maximum L* and chroma. - * - * SYNOPSIS - */ -Status -XcmsCIELabQueryMaxLC ( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue_angle in degrees */ - XcmsColor *pColor_return) - -/* - * DESCRIPTION - * Return the point of maximum chroma for the specified - * hue_angle. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc)NULL; - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, - (XcmsRGBi *)NULL)); -} diff --git a/nx-X11/lib/X11/LabWpAj.c b/nx-X11/lib/X11/LabWpAj.c deleted file mode 100644 index 0559fdee3..000000000 --- a/nx-X11/lib/X11/LabWpAj.c +++ /dev/null @@ -1,97 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * CIELabWpAj.c - * - * DESCRIPTION - * This file contains routine(s) that support white point - * adjustment of color specifications in the CIE L*a*b* color - * space. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * EXTERNS - */ - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELabWhiteShiftColors - * - * SYNOPSIS - */ -Status -XcmsCIELabWhiteShiftColors( - XcmsCCC ccc, - XcmsColor *pWhitePtFrom, - XcmsColor *pWhitePtTo, - XcmsColorFormat destSpecFmt, - XcmsColor *pColors_in_out, - unsigned int nColors, - Bool *pCompressed) -/* - * DESCRIPTION - * Adjust color specifications in XcmsColor structures for - * differences in white points. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression, - * XcmsSuccessWithCompression if succeeded with gamut - * compression. - */ -{ - if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { - return(0); - } - - /* - * Convert to CIELab using pWhitePtFrom - */ - if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, - nColors, XcmsCIELabFormat, pCompressed) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Convert from CIELab to destSpecFmt using pWhitePtTo - */ - return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, - pWhitePtTo, nColors, destSpecFmt, pCompressed)); -} diff --git a/nx-X11/lib/X11/LiHosts.c b/nx-X11/lib/X11/LiHosts.c deleted file mode 100644 index 29c36ffb5..000000000 --- a/nx-X11/lib/X11/LiHosts.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -All rights reserved. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, and/or sell copies of the Software, and to permit persons -to whom the Software is furnished to do so, provided that the above -copyright notice(s) and this permission notice appear in all copies of -the Software and that both the above copyright notice(s) and this -permission notice appear in supporting documentation. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT -OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR -HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. - -Except as contained in this notice, the name of a copyright holder -shall not be used in advertising or otherwise to promote the sale, use -or other dealings in this Software without prior written authorization -of the copyright holder. - -X Window System is a trademark of The Open Group. - -*/ - -/* - * Copyright 2004 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/* This can really be considered an os dependent routine */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -/* - * can be freed using XFree. - */ - -XHostAddress *XListHosts ( - register Display *dpy, - int *nhosts, /* RETURN */ - Bool *enabled) /* RETURN */ -{ - register XHostAddress *outbuf = NULL, *op; - xListHostsReply reply; - unsigned char *buf, *bp; - register unsigned i; - _X_UNUSED register xListHostsReq *req; - XServerInterpretedAddress *sip; - - *nhosts = 0; - LockDisplay(dpy); - GetReq (ListHosts, req); - - if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return (XHostAddress *) NULL; - } - - if (reply.nHosts) { - unsigned long nbytes = reply.length << 2; /* number of bytes in reply */ - const unsigned long max_hosts = INT_MAX / - (sizeof(XHostAddress) + sizeof(XServerInterpretedAddress)); - - if (reply.nHosts < max_hosts) { - unsigned long hostbytes = reply.nHosts * - (sizeof(XHostAddress) + sizeof(XServerInterpretedAddress)); - - if (reply.length < (INT_MAX >> 2) && - (hostbytes >> 2) < ((INT_MAX >> 2) - reply.length)) - outbuf = Xmalloc(nbytes + hostbytes); - } - - if (! outbuf) { - _XEatDataWords(dpy, reply.length); - UnlockDisplay(dpy); - SyncHandle(); - return (XHostAddress *) NULL; - } - op = outbuf; - sip = (XServerInterpretedAddress *) - (((unsigned char *) outbuf) + (reply.nHosts * sizeof(XHostAddress))); - bp = buf = ((unsigned char *) sip) - + (reply.nHosts * sizeof(XServerInterpretedAddress)); - - _XRead (dpy, (char *) buf, nbytes); - - for (i = 0; i < reply.nHosts; i++) { - op->family = ((xHostEntry *) bp)->family; - op->length =((xHostEntry *) bp)->length; - if (op->family == FamilyServerInterpreted) { - char *tp = (char *) (bp + SIZEOF(xHostEntry)); - char *vp = memchr(tp, 0, op->length); - - if (vp != NULL) { - sip->type = tp; - sip->typelength = vp - tp; - sip->value = vp + 1; - sip->valuelength = op->length - (sip->typelength + 1); - } else { - sip->type = sip->value = NULL; - sip->typelength = sip->valuelength = 0; - } - op->address = (char *) sip; - sip++; - } else { - op->address = (char *) (bp + SIZEOF(xHostEntry)); - } - bp += SIZEOF(xHostEntry) + (((op->length + 3) >> 2) << 2); - op++; - } - } - - *enabled = reply.enabled; - *nhosts = reply.nHosts; - UnlockDisplay(dpy); - SyncHandle(); - return (outbuf); -} - - - - - diff --git a/nx-X11/lib/X11/LiICmaps.c b/nx-X11/lib/X11/LiICmaps.c deleted file mode 100644 index 45a2f2fd3..000000000 --- a/nx-X11/lib/X11/LiICmaps.c +++ /dev/null @@ -1,71 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Colormap *XListInstalledColormaps( - register Display *dpy, - Window win, - int *n) /* RETURN */ -{ - unsigned long nbytes; - Colormap *cmaps; - xListInstalledColormapsReply rep; - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(ListInstalledColormaps, win, req); - - if(_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - *n = 0; - return((Colormap *) NULL); - } - - if (rep.nColormaps) { - nbytes = rep.nColormaps * sizeof(Colormap); - cmaps = Xmalloc(nbytes); - if (! cmaps) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return((Colormap *) NULL); - } - nbytes = rep.nColormaps << 2; - _XRead32 (dpy, (long *) cmaps, nbytes); - } - else cmaps = (Colormap *) NULL; - - *n = rep.nColormaps; - UnlockDisplay(dpy); - SyncHandle(); - return(cmaps); -} - diff --git a/nx-X11/lib/X11/LiProps.c b/nx-X11/lib/X11/LiProps.c deleted file mode 100644 index d9c746563..000000000 --- a/nx-X11/lib/X11/LiProps.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Atom *XListProperties( - register Display *dpy, - Window window, - int *n_props) /* RETURN */ -{ - unsigned long nbytes; - xListPropertiesReply rep; - Atom *properties; - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(ListProperties, window, req); - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - *n_props = 0; - UnlockDisplay(dpy); - SyncHandle(); - return ((Atom *) NULL); - } - - if (rep.nProperties) { - nbytes = rep.nProperties * sizeof(Atom); - properties = Xmalloc (nbytes); - if (! properties) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return (Atom *) NULL; - } - nbytes = rep.nProperties << 2; - _XRead32 (dpy, (long *) properties, nbytes); - } - else properties = (Atom *) NULL; - - *n_props = rep.nProperties; - UnlockDisplay(dpy); - SyncHandle(); - return (properties); -} diff --git a/nx-X11/lib/X11/ListExt.c b/nx-X11/lib/X11/ListExt.c deleted file mode 100644 index 7fdf9932c..000000000 --- a/nx-X11/lib/X11/ListExt.c +++ /dev/null @@ -1,109 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -char **XListExtensions( - register Display *dpy, - int *nextensions) /* RETURN */ -{ - xListExtensionsReply rep; - char **list = NULL; - char *ch = NULL; - char *chend; - int count = 0; - register unsigned i; - register int length; - _X_UNUSED register xReq *req; - unsigned long rlen = 0; - - LockDisplay(dpy); - GetEmptyReq (ListExtensions, req); - - if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return (char **) NULL; - } - - if (rep.nExtensions) { - list = Xmalloc (rep.nExtensions * sizeof (char *)); - if (rep.length > 0 && rep.length < (INT_MAX >> 2)) { - rlen = rep.length << 2; - ch = Xmalloc (rlen + 1); - /* +1 to leave room for last null-terminator */ - } - - if ((!list) || (!ch)) { - Xfree(list); - Xfree(ch); - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return (char **) NULL; - } - - _XReadPad (dpy, ch, rlen); - /* - * unpack into null terminated strings. - */ - chend = ch + (rlen + 1); - length = *ch; - for (i = 0; i < rep.nExtensions; i++) { - if (ch + length < chend) { - list[i] = ch+1; /* skip over length */ - ch += length + 1; /* find next length ... */ - if (ch <= chend) { - length = *ch; - *ch = '\0'; /* and replace with null-termination */ - count++; - } else { - list[i] = NULL; - } - } else - list[i] = NULL; - } - } - - *nextensions = count; - UnlockDisplay(dpy); - SyncHandle(); - return (list); -} - -int -XFreeExtensionList (char **list) -{ - if (list != NULL) { - Xfree (list[0]-1); - Xfree (list); - } - return 1; -} diff --git a/nx-X11/lib/X11/LoadFont.c b/nx-X11/lib/X11/LoadFont.c deleted file mode 100644 index f547976ba..000000000 --- a/nx-X11/lib/X11/LoadFont.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Font -XLoadFont ( - register Display *dpy, - _Xconst char *name) -{ - register long nbytes; - Font fid; - register xOpenFontReq *req; - - if (_XF86LoadQueryLocaleFont(dpy, name, (XFontStruct **)0, &fid)) - return fid; - - LockDisplay(dpy); - GetReq(OpenFont, req); - nbytes = req->nbytes = name ? strlen(name) : 0; - req->fid = fid = XAllocID(dpy); - req->length += (nbytes+3)>>2; - Data (dpy, name, nbytes); - UnlockDisplay(dpy); - SyncHandle(); - return (fid); - /* can't return (req->fid) since request may have already been sent */ -} - diff --git a/nx-X11/lib/X11/LockDis.c b/nx-X11/lib/X11/LockDis.c deleted file mode 100644 index 12dd97df0..000000000 --- a/nx-X11/lib/X11/LockDis.c +++ /dev/null @@ -1,84 +0,0 @@ - -/* - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Author: Stephen Gildea, MIT X Consortium - * - * XLockDis.c - multi-thread application-level locking routines - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#ifdef XTHREADS -#include "locking.h" -#endif - -void -XLockDisplay( - register Display* dpy) -{ -#ifdef XTHREADS - LockDisplay(dpy); - if (dpy->lock) - (*dpy->lock->user_lock_display)(dpy); - /* - * We want the threads in the reply queue to all get out before - * XLockDisplay returns, in case they have any side effects the - * caller of XLockDisplay was trying to protect against. - * XLockDisplay puts itself at the head of the event waiters queue - * to wait for all the replies to come in. - */ - if (dpy->lock && dpy->lock->reply_awaiters) { - struct _XCVList *cvl; - - cvl = (*dpy->lock->create_cvl)(dpy); - - /* stuff ourselves on the head of the queue */ - cvl->next = dpy->lock->event_awaiters; - dpy->lock->event_awaiters = cvl; - - while (dpy->lock->reply_awaiters) - ConditionWait(dpy, cvl->cv); - UnlockNextEventReader(dpy); /* pass the signal on */ - } - UnlockDisplay(dpy); -#endif -} - -void -XUnlockDisplay( - register Display* dpy) -{ -#ifdef XTHREADS - LockDisplay(dpy); - if (dpy->lock) - (*dpy->lock->user_unlock_display)(dpy); - UnlockDisplay(dpy); -#endif -} diff --git a/nx-X11/lib/X11/LookupCol.c b/nx-X11/lib/X11/LookupCol.c deleted file mode 100644 index f7f969f56..000000000 --- a/nx-X11/lib/X11/LookupCol.c +++ /dev/null @@ -1,104 +0,0 @@ -/* - -Copyright 1985, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" - - -Status -XLookupColor ( - register Display *dpy, - Colormap cmap, - _Xconst char *spec, - XColor *def, - XColor *scr) -{ - register int n; - xLookupColorReply reply; - register xLookupColorReq *req; - XcmsCCC ccc; - XcmsColor cmsColor_exact; - -#ifdef XCMS - /* - * Let's Attempt to use Xcms and i18n approach to Parse Color - */ - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { - const char *tmpName = spec; - - switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, - XcmsRGBFormat)) { - case XcmsSuccess: - case XcmsSuccessWithCompression: - _XcmsRGB_to_XColor(&cmsColor_exact, def, 1); - memcpy((char *)scr, (char *)def, sizeof(XColor)); - _XUnresolveColor(ccc, scr); - return(1); - case XcmsFailure: - case _XCMS_NEWNAME: - /* - * if the result was _XCMS_NEWNAME tmpName points to - * a string in cmsColNm.c:pairs table, for example, - * gray70 would become tekhvc:0.0/70.0/0.0 - */ - break; - } - } -#endif - - /* - * Xcms and i18n methods failed, so lets pass it to the server - * for parsing. - */ - - n = strlen (spec); - LockDisplay(dpy); - GetReq (LookupColor, req); - req->cmap = cmap; - req->nbytes = n; - req->length += (n + 3) >> 2; - Data (dpy, spec, (long)n); - if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - def->red = reply.exactRed; - def->green = reply.exactGreen; - def->blue = reply.exactBlue; - - scr->red = reply.screenRed; - scr->green = reply.screenGreen; - scr->blue = reply.screenBlue; - - UnlockDisplay(dpy); - SyncHandle(); - return (1); -} diff --git a/nx-X11/lib/X11/LowerWin.c b/nx-X11/lib/X11/LowerWin.c deleted file mode 100644 index d430e6fd7..000000000 --- a/nx-X11/lib/X11/LowerWin.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XLowerWindow( - Display *dpy, - Window w) -{ - register xConfigureWindowReq *req; - unsigned long val = Below; /* needed for macro */ - - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 4, req); - req->window = w; - req->mask = CWStackMode; - OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/Luv.c b/nx-X11/lib/X11/Luv.c deleted file mode 100644 index 2bce977ea..000000000 --- a/nx-X11/lib/X11/Luv.c +++ /dev/null @@ -1,401 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * CIELuv.c - * - * DESCRIPTION - * This file contains routines that support the CIE L*u*v* - * color space to include conversions to and from the CIE - * XYZ space. - * - * DOCUMENTATION - * "TekColor Color Management System, System Implementor's Manual" - * and - * Fred W. Billmeyer & Max Saltzman, "Principles of Color - * Technology", John Wily & Sons, Inc, 1981. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -#include /* sscanf */ - - -/* - * FORWARD DECLARATIONS - */ - -static int CIELuv_ParseString(register char *spec, XcmsColor *pColor); -static Status XcmsCIELuv_ValidSpec(XcmsColor *pColor); - -/* - * DEFINES - * Internal definitions that need NOT be exported to any package - * or program using this package. - */ -#ifdef DBL_EPSILON -# define XMY_DBL_EPSILON DBL_EPSILON -#else -# define XMY_DBL_EPSILON 0.00001 -#endif - - -/* - * LOCAL VARIABLES - */ - - /* - * NULL terminated list of functions applied to get from CIELuv to CIEXYZ - */ -static XcmsConversionProc Fl_CIELuv_to_CIEXYZ[] = { - XcmsCIELuvToCIEuvY, - XcmsCIEuvYToCIEXYZ, - NULL -}; - - /* - * NULL terminated list of functions applied to get from CIEXYZ to CIELuv - */ -static XcmsConversionProc Fl_CIEXYZ_to_CIELuv[] = { - XcmsCIEXYZToCIEuvY, - XcmsCIEuvYToCIELuv, - NULL -}; - -/* - * GLOBALS - */ - - /* - * CIE Luv Color Space - */ -XcmsColorSpace XcmsCIELuvColorSpace = - { - _XcmsCIELuv_prefix, /* prefix */ - XcmsCIELuvFormat, /* id */ - CIELuv_ParseString, /* parseString */ - Fl_CIELuv_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_CIELuv, /* from_CIEXYZ */ - 1 - }; - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * CIELuv_ParseString - * - * SYNOPSIS - */ -static int -CIELuv_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsCIELuvFormat. - * The assumed CIELuv string syntax is: - * CIELuv:// - * Where L, u, and v are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - * 0 if failed, non-zero otherwise. - */ -{ - int n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (int)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsCIELuv_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIELuv.L_star, - &pColor->spec.CIELuv.u_star, - &pColor->spec.CIELuv.v_star) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIELuv.L_star, - &pColor->spec.CIELuv.u_star, - &pColor->spec.CIELuv.v_star) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - pColor->format = XcmsCIELuvFormat; - pColor->pixel = 0; - return(XcmsCIELuv_ValidSpec(pColor)); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuv_ValidSpec - * - * SYNOPSIS - */ -static Status -XcmsCIELuv_ValidSpec( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks if color specification valid for CIE L*u*v*. - * - * RETURNS - * XcmsFailure if invalid, - * XcmsSuccess if valid. - * - */ -{ - if (pColor->format != XcmsCIELuvFormat - || - (pColor->spec.CIELuv.L_star < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIELuv.L_star > 100.0 + XMY_DBL_EPSILON)) { - return(XcmsFailure); - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIELuvToCIEuvY - convert CIELuv to CIEuvY - * - * SYNOPSIS - */ -Status -XcmsCIELuvToCIEuvY( - XcmsCCC ccc, - XcmsColor *pLuv_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIELuv format to CIEuvY format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsColor *pColor = pColors_in_out; - XcmsColor whitePt; - XcmsCIEuvY uvY_return; - XcmsFloat tmpVal; - unsigned int i; - - /* - * Check arguments - */ - if (pLuv_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Make sure white point is in CIEuvY form - */ - if (pLuv_WhitePt->format != XcmsCIEuvYFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pLuv_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, - 1, XcmsCIEuvYFormat)) { - return(XcmsFailure); - } - pLuv_WhitePt = &whitePt; - } - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (pLuv_WhitePt->spec.CIEuvY.Y != 1.0) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - /* Make sure original format is CIELuv and is valid */ - if (!XcmsCIELuv_ValidSpec(pColor)) { - return(XcmsFailure); - } - - if (pColor->spec.CIELuv.L_star < 7.99953624) { - uvY_return.Y = pColor->spec.CIELuv.L_star / 903.29; - } else { - tmpVal = (pColor->spec.CIELuv.L_star + 16.0) / 116.0; - uvY_return.Y = tmpVal * tmpVal * tmpVal; /* tmpVal ** 3 */ - } - - - - if (pColor->spec.CIELuv.L_star == 0.0) { - uvY_return.u_prime = pLuv_WhitePt->spec.CIEuvY.u_prime; - uvY_return.v_prime = pLuv_WhitePt->spec.CIEuvY.v_prime; - } else { - tmpVal = 13.0 * (pColor->spec.CIELuv.L_star / 100.0); - uvY_return.u_prime = pColor->spec.CIELuv.u_star/tmpVal + - pLuv_WhitePt->spec.CIEuvY.u_prime; - uvY_return.v_prime = pColor->spec.CIELuv.v_star/tmpVal + - pLuv_WhitePt->spec.CIEuvY.v_prime; - } - /* Copy result to pColor */ - memcpy((char *)&pColor->spec, (char *)&uvY_return, sizeof(XcmsCIEuvY)); - - /* Identify that the format is now CIEuvY */ - pColor->format = XcmsCIEuvYFormat; - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIEuvYToCIELuv - convert CIEuvY to CIELuv - * - * SYNOPSIS - */ -Status -XcmsCIEuvYToCIELuv( - XcmsCCC ccc, - XcmsColor *pLuv_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIEuvY format to CIELab format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsColor *pColor = pColors_in_out; - XcmsColor whitePt; - XcmsCIELuv Luv_return; - XcmsFloat tmpVal; - unsigned int i; - - /* - * Check arguments - */ - if (pLuv_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Make sure white point is in CIEuvY form - */ - if (pLuv_WhitePt->format != XcmsCIEuvYFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pLuv_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, - (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { - return(XcmsFailure); - } - pLuv_WhitePt = &whitePt; - } - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (pLuv_WhitePt->spec.CIEuvY.Y != 1.0) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - if (!_XcmsCIEuvY_ValidSpec(pColor)) { - return(XcmsFailure); - } - - /* Now convert the uvY to Luv */ - Luv_return.L_star = - (pColor->spec.CIEuvY.Y < 0.008856) - ? - (pColor->spec.CIEuvY.Y * 903.29) - : - ((XcmsFloat)(XCMS_CUBEROOT(pColor->spec.CIEuvY.Y) * 116.0) - 16.0); - tmpVal = 13.0 * (Luv_return.L_star / 100.0); - Luv_return.u_star = tmpVal * - (pColor->spec.CIEuvY.u_prime - pLuv_WhitePt->spec.CIEuvY.u_prime); - Luv_return.v_star = tmpVal * - (pColor->spec.CIEuvY.v_prime - pLuv_WhitePt->spec.CIEuvY.v_prime); - - /* Copy result to pColor */ - memcpy((char *)&pColor->spec, (char *)&Luv_return, sizeof(XcmsCIELuv)); - - /* Identify that the format is now CIEuvY */ - pColor->format = XcmsCIELuvFormat; - } - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LuvGcC.c b/nx-X11/lib/X11/LuvGcC.c deleted file mode 100644 index cadf4a8b2..000000000 --- a/nx-X11/lib/X11/LuvGcC.c +++ /dev/null @@ -1,127 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELuvGcC.c - * - * DESCRIPTION - * Source for XcmsCIELuvClipuv() gamut compression routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvClipuv - Reduce the chroma for a hue and L* - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIELuvClipuv ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * Reduce the Chroma for a specific hue and chroma to - * to bring the given color into the gamut of the - * specified device. As required of gamut compression - * functions, this routine returns pColor_in_out - * in XcmsCIEXYZFormat on successful completion. - * - * Since this routine works with the L* within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - Status retval; - XcmsColor *pColor; - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < PseudoColor) { - /* - * GRAY ! - */ - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIELuvFormat); - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIEXYZFormat); - if (pCompressed) { - *(pCompressed + i) = True; - } - return(XcmsSuccess); - } else { - if (pColor->format != XcmsCIELuvFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIELuvFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsCIELuvQueryMaxC(ccc, - degrees(XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, - pColor->spec.CIELuv.v_star)), - pColor->spec.CIELuv.L_star, - pColor) == XcmsFailure) { - return(XcmsFailure); - } - retval = _XcmsDIConvertColors(ccc, pColor, - &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/LuvGcL.c b/nx-X11/lib/X11/LuvGcL.c deleted file mode 100644 index f5b6d99e4..000000000 --- a/nx-X11/lib/X11/LuvGcL.c +++ /dev/null @@ -1,174 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELuvGcL.c - * - * DESCRIPTION - * Source for XcmsCIELuvClipL() gamut compression routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvClipL - Return the closest L* - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIELuvClipL ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * Return the closest L* for a specific hue and chroma. - * This routine takes any color as input and outputs - * a CIE XYZ color. - * - * Since this routine works with the L* within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor *pColor; - XcmsColor Luv_max; - XcmsFloat hue, chroma, maxChroma; - Status retval; - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor) { - /* - * GRAY ! - */ - return(XcmsFailure); - } else { - /* Convert from CIEXYZ to CIE L*u*v* format */ - if (_XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat) - == XcmsFailure) { - return(XcmsFailure); - } - - hue = XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, - pColor->spec.CIELuv.v_star); - chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, - pColor->spec.CIELuv.v_star); - /* Step 1: compute the maximum L* and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor)); - if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, - (XcmsRGBi *)NULL) == XcmsFailure) { - return (XcmsFailure); - } - maxChroma = XCMS_CIELUV_PMETRIC_CHROMA(Luv_max.spec.CIELuv.u_star, - Luv_max.spec.CIELuv.v_star); - - /* Now check and return the appropriate L* */ - if (chroma == maxChroma) { - /* When the chroma input is equal to the maximum chroma */ - /* merely return the L* for that chroma. */ - memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } else if (chroma > maxChroma) { - /* When the chroma input is greater than the maximum chroma */ - /* merely return the L* and chroma for the given hue. */ - memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); - return (XcmsFailure); - } else if (pColor->spec.CIELuv.L_star < Luv_max.spec.CIELuv.L_star) { - /* Find the minimum lightness for the given chroma. */ - if (pColor->format != XcmsCIELuvFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsCIELuvQueryMinL(&myCCC, degrees(hue), chroma, pColor) - == XcmsFailure) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } else { - /* Find the maximum lightness for the given chroma. */ - if (pColor->format != XcmsCIELuvFormat) { - if (_XcmsDIConvertColors(ccc, pColor, - ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat) - == XcmsFailure) { - return(XcmsFailure); - } - } - if (XcmsCIELuvQueryMaxL(&myCCC, degrees(hue), chroma, pColor) - == XcmsFailure) { - return (XcmsFailure); - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - return(retval); - } -} diff --git a/nx-X11/lib/X11/LuvGcLC.c b/nx-X11/lib/X11/LuvGcLC.c deleted file mode 100644 index a9f8cbaf1..000000000 --- a/nx-X11/lib/X11/LuvGcLC.c +++ /dev/null @@ -1,223 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELuvGcLC.c - * - * DESCRIPTION - * Source for XcmsCIELuvClipLuv() gamut - * compression function. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * INTERNALS - * Internal defines that need NOT be exported to any package or - * program using this package. - */ -#define MAXBISECTCOUNT 100 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvClipLuv - Return the closest L* and chroma - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIELuvClipLuv ( - XcmsCCC ccc, - XcmsColor *pColors_in_out, - unsigned int nColors, - unsigned int i, - Bool *pCompressed) -/* - * DESCRIPTION - * This routine will find the closest L* and chroma - * for a specific hue. The color input is converted to - * CIE L*u*v* format and returned as CIE XYZ format. - * - * Since this routine works with the L* within - * pColor_in_out intermediate results may be returned - * even though it may be invalid. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - Status retval; - XcmsCCCRec myCCC; - XcmsColor *pColor; - XcmsColor Luv_max; - XcmsFloat hue, chroma, maxChroma; - XcmsFloat Chroma, bestChroma, Lstar, maxLstar, saveLstar; - XcmsFloat bestLstar, bestustar, bestvstar; - XcmsFloat nT, saveDist, tmpDist; - XcmsRGBi rgb_max; - int nCount, nMaxCount, nI, nILast; - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white */ - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ - - /* - * Color specification passed as input can be assumed to: - * 1. Be in XcmsCIEXYZFormat - * 2. Already be white point adjusted for the Screen White Point. - * This means that the white point now associated with this - * color spec is the Screen White Point (even if the - * ccc->clientWhitePt differs). - */ - - pColor = pColors_in_out + i; - - if (ccc->visual->class < StaticColor) { - /* - * GRAY ! - */ - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIELuvFormat); - _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), - 1, XcmsCIEXYZFormat); - if (pCompressed) { - *(pCompressed + i) = True; - } - return(XcmsSuccess); - } - - /* Convert from CIEXYZ to CIELuv format */ - if (_XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat) - == XcmsFailure) { - return(XcmsFailure); - } - - /* Step 1: compute the maximum L* and chroma for this hue. */ - /* This copy may be overkill but it preserves the pixel etc. */ - saveLstar = pColor->spec.CIELuv.L_star; - hue = XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, - pColor->spec.CIELuv.v_star); - chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, - pColor->spec.CIELuv.v_star); - memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor)); - if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max) - == XcmsFailure) { - return (XcmsFailure); - } - maxLstar = Luv_max.spec.CIELuv.L_star; - - /* Now check and return the appropriate L* */ - if (saveLstar == maxLstar) { - /* When the L* input is equal to the maximum L* */ - /* merely return the maximum Luv point. */ - memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - } else { - /* return the closest point on the hue leaf. */ - /* must do a bisection here to compute the delta e. */ - maxChroma = XCMS_CIELUV_PMETRIC_CHROMA(Luv_max.spec.CIELuv.u_star, - Luv_max.spec.CIELuv.v_star); - nMaxCount = MAXBISECTCOUNT; - nI = nMaxCount / 2; - bestLstar = Lstar = pColor->spec.CIELuv.L_star; - bestustar = pColor->spec.CIELuv.u_star; - bestvstar = pColor->spec.CIELuv.v_star; - bestChroma = Chroma = chroma; - saveDist = XCMS_SQRT(((Chroma - maxChroma) * (Chroma - maxChroma)) + - ((Lstar - maxLstar) * (Lstar - maxLstar))); - for (nCount = 0; nCount < nMaxCount; nCount++) { - nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; - if (saveLstar > maxLstar) { - pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; - pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; - pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; - } else { - pColor->spec.RGBi.red = rgb_max.red - (rgb_max.red * nT); - pColor->spec.RGBi.green = rgb_max.green - (rgb_max.green * nT); - pColor->spec.RGBi.blue = rgb_max.blue - (rgb_max.blue * nT); - } - pColor->format = XcmsRGBiFormat; - - /* Convert from RGBi to CIE Luv */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, - (Bool *) NULL) == XcmsFailure) { - return (XcmsFailure); - } - chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, - pColor->spec.CIELuv.v_star); - tmpDist = XCMS_SQRT(((Chroma - chroma) * (Chroma - chroma)) + - ((Lstar - pColor->spec.CIELuv.L_star) * - (Lstar - pColor->spec.CIELuv.L_star))); - nILast = nI; - if (tmpDist > saveDist) { - nI /= 2; - } else { - nI = (nMaxCount + nI) / 2; - saveDist = tmpDist; - bestLstar = pColor->spec.CIELuv.L_star; - bestustar = pColor->spec.CIELuv.u_star; - bestvstar = pColor->spec.CIELuv.v_star; - bestChroma = chroma; - } - if (nI == nILast || nI == 0) { - break; - } - } - if (bestChroma >= maxChroma) { - pColor->spec.CIELuv.L_star = maxLstar; - pColor->spec.CIELuv.u_star = Luv_max.spec.CIELuv.u_star; - pColor->spec.CIELuv.v_star = Luv_max.spec.CIELuv.v_star; - } else { - pColor->spec.CIELuv.L_star = bestLstar; - pColor->spec.CIELuv.u_star = bestustar; - pColor->spec.CIELuv.v_star = bestvstar; - } - retval = _XcmsDIConvertColors(&myCCC, pColor, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); - - if (retval != XcmsFailure && pCompressed != NULL) { - *(pCompressed + i) = True; - } - } - return(retval); -} diff --git a/nx-X11/lib/X11/LuvMnL.c b/nx-X11/lib/X11/LuvMnL.c deleted file mode 100644 index b873fa652..000000000 --- a/nx-X11/lib/X11/LuvMnL.c +++ /dev/null @@ -1,216 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELuvMnL.c - * - * DESCRIPTION - * Source for the XcmsCIELuvQueryMinL() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS (XcmsFloat)0.001 -#define START_L_STAR (XcmsFloat)40.0 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvQueryMinL - Compute max Lstar for a hue and chroma - * - * SYNOPSIS - */ -Status -XcmsCIELuvQueryMinL( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue angle in degrees */ - XcmsFloat chroma, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum Lstar for a specified hue_angle and chroma. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded with no modifications - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor max_lc, tmp, prev; - XcmsFloat max_chroma, tmp_chroma; - XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; - XcmsFloat rFactor; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* setup the CCC to use for the conversions. */ - memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc) NULL; - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - hue = radians(hue_angle); - tmp.spec.CIELuv.L_star = START_L_STAR; - tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, chroma); - tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma); - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsCIELuvFormat; - - /* Step 1: Obtain the maximum L_star and chroma for this hue. */ - if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - max_chroma = XCMS_CIELUV_PMETRIC_CHROMA(max_lc.spec.CIELuv.u_star, - max_lc.spec.CIELuv.v_star); - - if (max_chroma <= chroma) { - /* - * If the chroma is greater than the chroma for the - * maximum L/chroma point then the L_star is the - * the L_star for the maximum L_star/chroma point. - * This is an error but I return the best approximation I can. - * Thus the inconsistency. - */ - memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - return(XcmsSuccess); - } - - /* - * If the chroma is equal to the chroma for the - * maximum L_star/chroma point then the L_star is the - * the L_star for the maximum L* and chroma point. - */ - /* if (max_chroma == chroma) { - * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - * return(XcmsSuccess); - * } - */ - - /* must do a bisection here to compute the maximum L* */ - /* save the structure input so that any elements that */ - /* are not touched are recopied later in the routine. */ - nChroma = chroma; - tmp_chroma = max_chroma; - lastChroma = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prevChroma = lastChroma; - lastChroma = tmp_chroma; - nT = (nChroma - max_chroma) / max_chroma * rFactor; - memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); - tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); - tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); - tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to CIELuv */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Now check the return against what is expected */ - tmp_chroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, - tmp.spec.CIELuv.v_star); - if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { - /* Found It! */ - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } - nChroma += chroma - tmp_chroma; - if (nChroma > max_chroma) { - nChroma = max_chroma; - rFactor *= 0.5; /* selective relaxation employed */ - } else if (nChroma < 0.0) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - return(XcmsSuccess); - } else if (tmp_chroma <= prevChroma + EPS && - tmp_chroma >= prevChroma - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - } - } - - if (nCount >= nMaxCount) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - } - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LuvMxC.c b/nx-X11/lib/X11/LuvMxC.c deleted file mode 100644 index a67251477..000000000 --- a/nx-X11/lib/X11/LuvMxC.c +++ /dev/null @@ -1,204 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * CIELuvMxC.c - * - * DESCRIPTION - * Source for the XcmsCIELuvQueryMaxC() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS (XcmsFloat)0.001 -#define START_CHROMA (XcmsFloat)2.2 -#define TOPL (XcmsFloat)100.0 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvQueryMaxC - max chroma for a hue_angle and L_star - * - * SYNOPSIS - */ -Status -XcmsCIELuvQueryMaxC( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue angle in degrees */ - XcmsFloat L_star, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum chroma for a specific hue_angle and L_star. - * The returned format is in XcmsCIELuvFormat. - * - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor tmp; - XcmsColor max_lc; - XcmsFloat n_L_star, last_L_star, prev_L_star; - XcmsFloat hue, lastuStar, lastvStar, /*lastChroma,*/ maxDist, nT, rFactor; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* Use my own CCC and inherit screen white Pt */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - hue = radians(hue_angle); - tmp.spec.CIELuv.L_star = L_star; - tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, START_CHROMA); - tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, START_CHROMA); - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsCIELuvFormat; - - /* Step 1: compute the maximum L_star and chroma for this hue. */ - memcpy((char *)&max_lc, (char *)&tmp, sizeof(XcmsColor)); - if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Step 2: Do a bisection here to compute the maximum chroma - * Note the differences between when the point to be found - * is above the maximum LC point and when it is below. - */ - if (L_star <= max_lc.spec.CIELuv.L_star) { - maxDist = max_lc.spec.CIELuv.L_star; - } else { - maxDist = TOPL - max_lc.spec.CIELuv.L_star; - } - - n_L_star = L_star; - last_L_star = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prev_L_star = last_L_star; - last_L_star = tmp.spec.CIELuv.L_star; -/* lastChroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, */ -/* tmp.spec.CIELuv.v_star); */ - lastuStar = tmp.spec.CIELuv.u_star; - lastvStar = tmp.spec.CIELuv.v_star; - nT = (n_L_star - max_lc.spec.CIELuv.L_star) / maxDist * rFactor; - /* printf("(n_L_star, nT) = %lf %lf ", n_L_star, nT); */ - if (nT > 0) { - tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - } else { - tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); - tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); - tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); - } - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to CIELuv */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Now check if we've reached the target L_star - */ - /* printf("result Lstar = %lf\n", tmp.spec.CIELuv.L_star); */ - if (tmp.spec.CIELuv.L_star <= L_star + EPS && - tmp.spec.CIELuv.L_star >= L_star - EPS) { - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); - } - if (nT > 0) { - n_L_star += ((TOPL - n_L_star) * - (L_star - tmp.spec.CIELuv.L_star)) / (TOPL - L_star); - } else { - n_L_star *= L_star / tmp.spec.CIELuv.L_star; - } - if (tmp.spec.CIELuv.L_star <= prev_L_star + EPS && - tmp.spec.CIELuv.L_star >= prev_L_star - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - /* printf("rFactor = %lf\n", rFactor); */ - } - } - if (XCMS_FABS(last_L_star - L_star) < - XCMS_FABS(tmp.spec.CIELuv.L_star - L_star)) { - tmp.spec.CIELuv.u_star = lastuStar; - tmp.spec.CIELuv.v_star = lastvStar; -/* tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, lastChroma); */ -/* tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, lastChroma); */ - } - tmp.spec.CIELuv.L_star = L_star; - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LuvMxL.c b/nx-X11/lib/X11/LuvMxL.c deleted file mode 100644 index d1d495b08..000000000 --- a/nx-X11/lib/X11/LuvMxL.c +++ /dev/null @@ -1,216 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIELuvMxL.c - * - * DESCRIPTION - * Source for the XcmsCIELuvQueryMaxL() gamut boundary - * querying routine. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include "Cv.h" - -/* - * DEFINES - */ -#define MAXBISECTCOUNT 100 -#define EPS (XcmsFloat)0.001 -#define START_L_STAR (XcmsFloat)40.0 - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvQueryMaxL - Compute max Lstar for a hue and chroma - * - * SYNOPSIS - */ -Status -XcmsCIELuvQueryMaxL( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue angle in degrees */ - XcmsFloat chroma, - XcmsColor *pColor_return) -/* - * DESCRIPTION - * Return the maximum Lstar for a specified hue_angle and chroma. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded with no modifications - * - */ -{ - XcmsCCCRec myCCC; - XcmsColor max_lc, tmp, prev; - XcmsFloat max_chroma, tmp_chroma; - XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; - XcmsFloat rFactor; - XcmsRGBi rgb_saved; - int nCount, nMaxCount; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* setup the CCC to use for the conversions. */ - memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc) NULL; - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - hue = radians(hue_angle); - tmp.spec.CIELuv.L_star = START_L_STAR; - tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, chroma); - tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma); - tmp.pixel = pColor_return->pixel; - tmp.format = XcmsCIELuvFormat; - - /* Step 1: Obtain the maximum L_star and chroma for this hue. */ - if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) - == XcmsFailure) { - return(XcmsFailure); - } - - max_chroma = XCMS_CIELUV_PMETRIC_CHROMA(max_lc.spec.CIELuv.u_star, - max_lc.spec.CIELuv.v_star); - - if (max_chroma <= chroma) { - /* - * If the chroma is greater than the chroma for the - * maximum L/chroma point then the L_star is the - * the L_star for the maximum L_star/chroma point. - * This is an error but I return the best approximation I can. - * Thus the inconsistency. - */ - memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - return(XcmsSuccess); - } - - /* - * If the chroma is equal to the chroma for the - * maximum L_star/chroma point then the L_star is the - * the L_star for the maximum L* and chroma point. - */ - /* if (max_chroma == chroma) { - * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); - * return(XcmsSuccess); - * } - */ - - /* must do a bisection here to compute the maximum L* */ - /* save the structure input so that any elements that */ - /* are not touched are recopied later in the routine. */ - nChroma = chroma; - tmp_chroma = max_chroma; - lastChroma = -1.0; - nMaxCount = MAXBISECTCOUNT; - rFactor = 1.0; - - for (nCount = 0; nCount < nMaxCount; nCount++) { - prevChroma = lastChroma; - lastChroma = tmp_chroma; - nT = (1.0 - (nChroma / max_chroma)) * rFactor; - memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); - tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; - tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; - tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; - tmp.format = XcmsRGBiFormat; - - /* convert from RGB to CIELuv */ - if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, - ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - - /* Now check the return against what is expected */ - tmp_chroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, - tmp.spec.CIELuv.v_star); - if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { - /* Found It! */ - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); - } - nChroma += chroma - tmp_chroma; - if (nChroma > max_chroma) { - nChroma = max_chroma; - rFactor *= 0.5; /* selective relaxation employed */ - } else if (nChroma < 0.0) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - return(XcmsSuccess); - } else if (tmp_chroma <= prevChroma + EPS && - tmp_chroma >= prevChroma - EPS) { - rFactor *= 0.5; /* selective relaxation employed */ - } - } - - if (nCount >= nMaxCount) { - if (XCMS_FABS(lastChroma - chroma) < - XCMS_FABS(tmp_chroma - chroma)) { - memcpy ((char *)pColor_return, (char *)&prev, - sizeof(XcmsColor)); - } else { - memcpy ((char *)pColor_return, (char *)&tmp, - sizeof(XcmsColor)); - } - } - memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/LuvMxLC.c b/nx-X11/lib/X11/LuvMxLC.c deleted file mode 100644 index 60b954916..000000000 --- a/nx-X11/lib/X11/LuvMxLC.c +++ /dev/null @@ -1,218 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * CIELuvMxVC.c - * - * DESCRIPTION - * Source for the XcmsCIELuvQueryMaxLC() gamut boundary - * querying routine. - * - * DOCUMENTATION - * "TekColor Color Management System, System Implementor's Manual" - * and - * Fred W. Billmeyer & Max Saltzman, "Principles of Color - * Technology", John Wily & Sons, Inc, 1981. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - */ -#define MIN(x,y) ((x) > (y) ? (y) : (x)) -#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) -#define MAX(x,y) ((x) > (y) ? (x) : (y)) -#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) -#define START_LSTAR (XcmsFloat)40.0 -#define START_CHROMA (XcmsFloat)2.2 - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsCIELuvQueryMaxLCRGB - Compute maximum L* and chroma. - * - * SYNOPSIS - */ -Status -_XcmsCIELuvQueryMaxLCRGB( - XcmsCCC ccc, - XcmsFloat hue, /* hue in radians */ - XcmsColor *pColor_return, - XcmsRGBi *pRGB_return) -/* - * DESCRIPTION - * Return the maximum psychometric chroma for a specified - * hue angle(radians), and the corresponding L*. This is computed - * by a binary search of all possible chromas. An assumption - * is made that there are no local maxima. Use the unrounded - * Max psychometric chroma because the difference check can be - * small. - * - * NOTE: No local CCC is used because this is a private - * routine and all routines that call it are expected - * to behave properly, i.e. send a local CCC with - * no white adjust function and no gamut compression - * function. - * - * This routine only accepts hue as input and outputs - * Luv and RGBi. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsFloat nSmall, nLarge; - XcmsColor tmp; - - tmp.format = XcmsCIELuvFormat; - /* Use some unreachable color on the given hue angle */ - tmp.spec.CIELuv.L_star = START_LSTAR; - tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, START_CHROMA); - tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, START_CHROMA); - /* - * Convert from Luv to RGB - * - * Note that the CIEXYZ to RGBi conversion routine must stuff the - * out of bounds RGBi values in tmp when the ccc->gamutCompProc - * is NULL. - */ - if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), - (unsigned int)1, XcmsRGBiFormat, (Bool *) NULL) - == XcmsFailure) && tmp.format != XcmsRGBiFormat) { - return (XcmsFailure); - } - - /* Now pick the smallest RGB */ - nSmall = MIN3(tmp.spec.RGBi.red, - tmp.spec.RGBi.green, - tmp.spec.RGBi.blue); - /* Make the smallest RGB equal to zero */ - tmp.spec.RGBi.red -= nSmall; - tmp.spec.RGBi.green -= nSmall; - tmp.spec.RGBi.blue -= nSmall; - - /* Now pick the largest RGB */ - nLarge = MAX3(tmp.spec.RGBi.red, - tmp.spec.RGBi.green, - tmp.spec.RGBi.blue); - /* Scale the RGB values based on the largest one */ - tmp.spec.RGBi.red /= nLarge; - tmp.spec.RGBi.green /= nLarge; - tmp.spec.RGBi.blue /= nLarge; - tmp.format = XcmsRGBiFormat; - - /* If the calling routine wants RGB value give them the ones used. */ - if (pRGB_return) { - pRGB_return->red = tmp.spec.RGBi.red; - pRGB_return->green = tmp.spec.RGBi.green; - pRGB_return->blue = tmp.spec.RGBi.blue; - } - - /* Convert from RGBi to Luv */ - if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, - ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat, (Bool *) NULL) - == XcmsFailure) { - return (XcmsFailure); - } - - memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); - return (XcmsSuccess); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvQueryMaxLC - Compute maximum L* and chroma. - * - * SYNOPSIS - */ -Status -XcmsCIELuvQueryMaxLC ( - XcmsCCC ccc, - XcmsFloat hue_angle, /* hue angle in degrees */ - XcmsColor *pColor_return) - -/* - * DESCRIPTION - * Return the point of maximum chroma for the specified - * hue angle. - * - * ASSUMPTIONS - * This routine assumes that the white point associated with - * the color specification is the Screen White Point. The - * Screen White Point will also be associated with the - * returned color specification. - * - * RETURNS - * XcmsFailure - Failure - * XcmsSuccess - Succeeded - * - */ -{ - XcmsCCCRec myCCC; - - /* - * Check Arguments - */ - if (ccc == NULL || pColor_return == NULL) { - return(XcmsFailure); - } - - /* Use my own CCC */ - memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); - myCCC.clientWhitePt.format = XcmsUndefinedFormat; - myCCC.gamutCompProc = (XcmsCompressionProc)NULL; - - while (hue_angle < 0.0) { - hue_angle += 360.0; - } - while (hue_angle >= 360.0) { - hue_angle -= 360.0; - } - - return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, - (XcmsRGBi *)NULL)); -} diff --git a/nx-X11/lib/X11/LuvWpAj.c b/nx-X11/lib/X11/LuvWpAj.c deleted file mode 100644 index aa2a3f462..000000000 --- a/nx-X11/lib/X11/LuvWpAj.c +++ /dev/null @@ -1,96 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * CIELuvWpAj.c - * - * DESCRIPTION - * This file contains routine(s) that support white point - * adjustment of color specifications in the CIE CIELuv.color - * space. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELuvWhiteShiftColors - * - * SYNOPSIS - */ -Status -XcmsCIELuvWhiteShiftColors( - XcmsCCC ccc, - XcmsColor *pWhitePtFrom, - XcmsColor *pWhitePtTo, - XcmsColorFormat destSpecFmt, - XcmsColor *pColors_in_out, - unsigned int nColors, - Bool *pCompressed) -/* - * DESCRIPTION - * Adjusts color specifications in an array of XcmsColor - * structures for white point differences. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded without gamut compression, - * XcmsSuccessWithCompression if succeeded with - * gamut compression. - */ -{ - if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Convert to CIELuv using pWhitePtFrom - * We can ignore return value for compression because we are converting - * to XcmsCIELuvFormat which is device-independent, not device-dependent. - */ - if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, - nColors, XcmsCIELuvFormat, pCompressed) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Convert from CIELuv to destSpecFmt using pWhitePtTo - */ - return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, - nColors, destSpecFmt, pCompressed)); -} diff --git a/nx-X11/lib/X11/Macros.c b/nx-X11/lib/X11/Macros.c deleted file mode 100644 index e29dcd4e8..000000000 --- a/nx-X11/lib/X11/Macros.c +++ /dev/null @@ -1,303 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#define XUTIL_DEFINE_FUNCTIONS -#include "Xutil.h" -#if USE_XCB -#include "Xxcbint.h" -#endif - -/* - * This file makes full definitions of routines for each macro. - * We do not expect C programs to use these, but other languages may - * need them. - */ - -int XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); } - -Window XRootWindow (Display *dpy, int scr) -{ - return (RootWindow(dpy,scr)); -} - -int XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); } - -Window XDefaultRootWindow (Display *dpy) -{ - return (RootWindow(dpy,DefaultScreen(dpy))); -} - -Visual *XDefaultVisual(Display *dpy, int scr) -{ - return (DefaultVisual(dpy, scr)); -} - -GC XDefaultGC(Display *dpy, int scr) -{ - return (DefaultGC(dpy,scr)); -} - -unsigned long XBlackPixel(Display *dpy, int scr) -{ - return (BlackPixel(dpy, scr)); -} - -unsigned long XWhitePixel(Display *dpy, int scr) -{ - return (WhitePixel(dpy,scr)); -} - -unsigned long XAllPlanes(void) { return AllPlanes; } - -int XQLength(Display *dpy) { return (QLength(dpy)); } - -int XDisplayWidth(Display *dpy, int scr) -{ - return (DisplayWidth(dpy,scr)); -} - -int XDisplayHeight(Display *dpy, int scr) -{ - return (DisplayHeight(dpy, scr)); -} - -int XDisplayWidthMM(Display *dpy, int scr) -{ - return (DisplayWidthMM(dpy, scr)); -} - -int XDisplayHeightMM(Display *dpy, int scr) -{ - return (DisplayHeightMM(dpy, scr)); -} - -int XDisplayPlanes(Display *dpy, int scr) -{ - return (DisplayPlanes(dpy, scr)); -} - -int XDisplayCells(Display *dpy, int scr) -{ - return (DisplayCells (dpy, scr)); -} - -int XScreenCount(Display *dpy) { return (ScreenCount(dpy)); } - -char *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); } - -int XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); } - -int XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));} - -int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); } - -char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); } - -int XDefaultDepth(Display *dpy, int scr) -{ - return(DefaultDepth(dpy, scr)); -} - -Colormap XDefaultColormap(Display *dpy, int scr) -{ - return (DefaultColormap(dpy, scr)); -} - -int XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); } - -int XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); } - -int XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); } - -int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } - -#if !USE_XCB -unsigned long XNextRequest(Display *dpy) -{ - return (NextRequest(dpy)); -} -#else -/* XNextRequest() differs from the rest of the functions here because it is - * no longer a macro wrapper - when libX11 is being used mixed together - * with direct use of xcb, the next request field of the Display structure will - * not be updated. We can't fix the NextRequest() macro in any easy way, - * but we can at least make XNextRequest() do the right thing. - */ -unsigned long XNextRequest(Display *dpy) -{ - unsigned long next_request; - LockDisplay(dpy); - next_request = _XNextRequest(dpy); - UnlockDisplay(dpy); - - return next_request; -} -#endif - -unsigned long XLastKnownRequestProcessed(Display *dpy) -{ - return (LastKnownRequestProcessed(dpy)); -} - -/* screen oriented macros (toolkit) */ -Screen *XScreenOfDisplay(Display *dpy, int scr) -{ - return (ScreenOfDisplay(dpy, scr)); -} - -Screen *XDefaultScreenOfDisplay(Display *dpy) -{ - return (DefaultScreenOfDisplay(dpy)); -} - -Display *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); } - -Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } - -unsigned long XBlackPixelOfScreen(Screen *s) -{ - return (BlackPixelOfScreen(s)); -} - -unsigned long XWhitePixelOfScreen(Screen *s) -{ - return (WhitePixelOfScreen(s)); -} - -Colormap XDefaultColormapOfScreen(Screen *s) -{ - return (DefaultColormapOfScreen(s)); -} - -int XDefaultDepthOfScreen(Screen *s) -{ - return (DefaultDepthOfScreen(s)); -} - -GC XDefaultGCOfScreen(Screen *s) -{ - return (DefaultGCOfScreen(s)); -} - -Visual *XDefaultVisualOfScreen(Screen *s) -{ - return (DefaultVisualOfScreen(s)); -} - -int XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); } - -int XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); } - -int XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); } - -int XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); } - -int XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); } - -int XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); } - -int XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); } - -int XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); } - -Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); } - -int XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); } - -long XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); } - -int XScreenNumberOfScreen (register Screen *scr) -{ - register Display *dpy = scr->display; - register Screen *dpyscr = dpy->screens; - register int i; - - for (i = 0; i < dpy->nscreens; i++, dpyscr++) { - if (scr == dpyscr) return i; - } - return -1; -} - -/* - * These macros are used to give some sugar to the image routines so that - * naive people are more comfortable with them. - */ -#undef XDestroyImage -int -XDestroyImage( - XImage *ximage) -{ - return((*((ximage)->f.destroy_image))((ximage))); -} -#undef XGetPixel -unsigned long XGetPixel( - XImage *ximage, - int x, int y) -{ - return ((*((ximage)->f.get_pixel))((ximage), (x), (y))); -} -#undef XPutPixel -int XPutPixel( - XImage *ximage, - int x, int y, - unsigned long pixel) -{ - return((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))); -} -#undef XSubImage -XImage *XSubImage( - XImage *ximage, - int x, int y, - unsigned int width, unsigned int height) -{ - return((*((ximage)->f.sub_image))((ximage), (x), - (y), (width), (height))); -} -#undef XAddPixel -int XAddPixel( - XImage *ximage, - long value) -{ - return((*((ximage)->f.add_pixel))((ximage), (value))); -} - - -int -XNoOp (register Display *dpy) -{ - _X_UNUSED register xReq *req; - - LockDisplay(dpy); - GetEmptyReq(NoOperation, req); - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/MapRaised.c b/nx-X11/lib/X11/MapRaised.c deleted file mode 100644 index 6ad6aef08..000000000 --- a/nx-X11/lib/X11/MapRaised.c +++ /dev/null @@ -1,51 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XMapRaised ( - register Display *dpy, - Window w) -{ - register xConfigureWindowReq *req; - register xResourceReq *req2; - unsigned long val = Above; /* needed for macro */ - - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 4, req); - req->window = w; - req->mask = CWStackMode; - OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); - GetResReq (MapWindow, w, req2); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/MapSubs.c b/nx-X11/lib/X11/MapSubs.c deleted file mode 100644 index 14e8b8af5..000000000 --- a/nx-X11/lib/X11/MapSubs.c +++ /dev/null @@ -1,43 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XMapSubwindows( - register Display *dpy, - Window win) -{ - register xResourceReq *req; - LockDisplay(dpy); - GetResReq(MapSubwindows, win, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/MapWindow.c b/nx-X11/lib/X11/MapWindow.c deleted file mode 100644 index cc041ff51..000000000 --- a/nx-X11/lib/X11/MapWindow.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XMapWindow ( - register Display *dpy, - Window w) -{ - register xResourceReq *req; - LockDisplay (dpy); - GetResReq(MapWindow, w, req); - UnlockDisplay (dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/MaskEvent.c b/nx-X11/lib/X11/MaskEvent.c deleted file mode 100644 index 1fadc487e..000000000 --- a/nx-X11/lib/X11/MaskEvent.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -extern long const _Xevent_to_mask[]; -#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) -#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ - Button4MotionMask|Button5MotionMask) - -/* - * return the next event in the queue matching one of the events in the mask. - * If no event, flush output, and wait until match succeeds. - * Events earlier in the queue are not discarded. - */ - -int -XMaskEvent ( - register Display *dpy, - long mask, /* Selected event mask. */ - register XEvent *event) /* XEvent to be filled in. */ -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - prev = NULL; - while (1) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if ((qelt->event.type < GenericEvent) && - (_Xevent_to_mask[qelt->event.type] & mask) && - ((qelt->event.type != MotionNotify) || - (mask & AllPointers) || - (mask & AllButtons & qelt->event.xmotion.state))) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - UnlockDisplay(dpy); - return 0; - } - } - if (prev) - qe_serial = prev->qserial_num; - _XReadEvents(dpy); - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockDisplay(dpy); - return 0; - } -#endif - } -} diff --git a/nx-X11/lib/X11/Misc.c b/nx-X11/lib/X11/Misc.c deleted file mode 100644 index c3a028408..000000000 --- a/nx-X11/lib/X11/Misc.c +++ /dev/null @@ -1,66 +0,0 @@ -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -long XMaxRequestSize(Display *dpy) -{ - return dpy->max_request_size; -} - -char *XResourceManagerString(Display *dpy) -{ - return dpy->xdefaults; -} - -unsigned long XDisplayMotionBufferSize(Display *dpy) -{ - return dpy->motion_buffer; -} - -int -XDisplayKeycodes( - Display *dpy, - int *min_keycode_return, - int *max_keycode_return) -{ - *min_keycode_return = dpy->min_keycode; - *max_keycode_return = dpy->max_keycode; - return 1; -} - -VisualID XVisualIDFromVisual(Visual *visual) -{ - return visual->visualid; -} - -long XExtendedMaxRequestSize(Display *dpy) -{ - return dpy->bigreq_size; -} diff --git a/nx-X11/lib/X11/ModMap.c b/nx-X11/lib/X11/ModMap.c deleted file mode 100644 index ca15dde25..000000000 --- a/nx-X11/lib/X11/ModMap.c +++ /dev/null @@ -1,184 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -XModifierKeymap * -XGetModifierMapping(register Display *dpy) -{ - xGetModifierMappingReply rep; - _X_UNUSED register xReq *req; - unsigned long nbytes; - XModifierKeymap *res; - - LockDisplay(dpy); - GetEmptyReq(GetModifierMapping, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xFalse); - - if (rep.length < (INT_MAX >> 2) && - (rep.length >> 1) == rep.numKeyPerModifier) { - nbytes = (unsigned long)rep.length << 2; - res = Xmalloc(sizeof (XModifierKeymap)); - if (res) - res->modifiermap = Xmalloc (nbytes); - } else - res = NULL; - if ((! res) || (! res->modifiermap)) { - Xfree(res); - res = (XModifierKeymap *) NULL; - _XEatDataWords(dpy, rep.length); - } else { - _XReadPad(dpy, (char *) res->modifiermap, (long) nbytes); - res->max_keypermod = rep.numKeyPerModifier; - } - - UnlockDisplay(dpy); - SyncHandle(); - return (res); -} - -/* - * Returns: - * MappingSuccess (0) Success - * MappingBusy (1) Busy - one or more old or new modifiers are down - * MappingFailed (2) Failed - one or more new modifiers unacceptable - */ -int -XSetModifierMapping( - register Display *dpy, - register XModifierKeymap *modifier_map) -{ - register xSetModifierMappingReq *req; - xSetModifierMappingReply rep; - int mapSize = modifier_map->max_keypermod << 3; /* 8 modifiers */ - - LockDisplay(dpy); - GetReq(SetModifierMapping, req); - req->length += mapSize >> 2; - req->numKeyPerModifier = modifier_map->max_keypermod; - - Data(dpy, (const char *)modifier_map->modifiermap, mapSize); - - (void) _XReply(dpy, (xReply *) & rep, - (SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue); - UnlockDisplay(dpy); - SyncHandle(); - return (rep.success); -} - -XModifierKeymap * -XNewModifiermap(int keyspermodifier) -{ - XModifierKeymap *res = Xmalloc((sizeof (XModifierKeymap))); - if (res) { - res->max_keypermod = keyspermodifier; - res->modifiermap = (keyspermodifier > 0 ? - Xmalloc(8 * keyspermodifier) - : (KeyCode *) NULL); - if (keyspermodifier && (res->modifiermap == NULL)) { - Xfree(res); - return (XModifierKeymap *) NULL; - } - } - return (res); -} - - -int -XFreeModifiermap(XModifierKeymap *map) -{ - if (map) { - Xfree(map->modifiermap); - Xfree(map); - } - return 1; -} - -XModifierKeymap * -XInsertModifiermapEntry(XModifierKeymap *map, -#if NeedWidePrototypes - unsigned int keycode, -#else - KeyCode keycode, -#endif - int modifier) -{ - XModifierKeymap *newmap; - int i, - row = modifier * map->max_keypermod, - newrow, - lastrow; - - for (i=0; imax_keypermod; i++) { - if (map->modifiermap[ row+i ] == keycode) - return(map); /* already in the map */ - if (map->modifiermap[ row+i ] == 0) { - map->modifiermap[ row+i ] = keycode; - return(map); /* we added it without stretching the map */ - } - } - - /* stretch the map */ - if ((newmap = XNewModifiermap(map->max_keypermod+1)) == NULL) - return (XModifierKeymap *) NULL; - newrow = row = 0; - lastrow = newmap->max_keypermod * 8; - while (newrow < lastrow) { - for (i=0; imax_keypermod; i++) - newmap->modifiermap[ newrow+i ] = map->modifiermap[ row+i ]; - newmap->modifiermap[ newrow+i ] = 0; - row += map->max_keypermod; - newrow += newmap->max_keypermod; - } - (void) XFreeModifiermap(map); - newrow = newmap->max_keypermod * modifier + newmap->max_keypermod - 1; - newmap->modifiermap[ newrow ] = keycode; - return(newmap); -} - -XModifierKeymap * -XDeleteModifiermapEntry(XModifierKeymap *map, -#if NeedWidePrototypes - unsigned int keycode, -#else - KeyCode keycode, -#endif - int modifier) -{ - int i, - row = modifier * map->max_keypermod; - - for (i=0; imax_keypermod; i++) { - if (map->modifiermap[ row+i ] == keycode) - map->modifiermap[ row+i ] = 0; - } - /* should we shrink the map?? */ - return (map); -} diff --git a/nx-X11/lib/X11/MoveWin.c b/nx-X11/lib/X11/MoveWin.c deleted file mode 100644 index 2eb2283be..000000000 --- a/nx-X11/lib/X11/MoveWin.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XMoveWindow ( - register Display *dpy, - Window w, - int x, - int y) -{ - register xConfigureWindowReq *req; - - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 8, req); - - req->window = w; - req->mask = CWX | CWY; - - { - CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); - *valuePtr++ = x; - *valuePtr = y; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/NextEvent.c b/nx-X11/lib/X11/NextEvent.c deleted file mode 100644 index d3048aee2..000000000 --- a/nx-X11/lib/X11/NextEvent.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Return next event in queue, or if none, flush output and wait for - * events. - */ - -int -XNextEvent ( - register Display *dpy, - register XEvent *event) -{ - register _XQEvent *qelt; - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - if (dpy->head == NULL) - _XReadEvents(dpy); -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockDisplay(dpy); - return 0; - } -#endif - qelt = dpy->head; - *event = qelt->event; - _XDeq(dpy, NULL, qelt); - _XStoreEventCookie(dpy, event); - UnlockDisplay(dpy); - return 0; -} - diff --git a/nx-X11/lib/X11/OCWrap.c b/nx-X11/lib/X11/OCWrap.c deleted file mode 100644 index fe23a3495..000000000 --- a/nx-X11/lib/X11/OCWrap.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -XOC -XCreateOC(XOM om, ...) -{ - va_list var; - XlcArgList args; - XOC oc; - int num_args; - - va_start(var, om); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, om); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (XOC) NULL; - - oc = (*om->methods->create_oc)(om, args, num_args); - - Xfree(args); - - if (oc) { - oc->core.next = om->core.oc_list; - om->core.oc_list = oc; - } - - return oc; -} - -void -XDestroyOC(XOC oc) -{ - XOC prev, oc_list; - - prev = oc_list = oc->core.om->core.oc_list; - if (oc_list == oc) - oc->core.om->core.oc_list = oc_list->core.next; - else { - while ((oc_list = oc_list->core.next)) { - if (oc_list == oc) { - prev->core.next = oc_list->core.next; - break; - } - prev = oc_list; - } - } - - (*oc->methods->destroy)(oc); -} - -XOM -XOMOfOC(XOC oc) -{ - return oc->core.om; -} - -char * -XSetOCValues(XOC oc, ...) -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - - va_start(var, oc); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, oc); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - ret = (*oc->methods->set_values)(oc, args, num_args); - - Xfree(args); - - return ret; -} - -char * -XGetOCValues(XOC oc, ...) -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - - va_start(var, oc); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, oc); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - ret = (*oc->methods->get_values)(oc, args, num_args); - - Xfree(args); - - return ret; -} diff --git a/nx-X11/lib/X11/OMWrap.c b/nx-X11/lib/X11/OMWrap.c deleted file mode 100644 index 045ca16bc..000000000 --- a/nx-X11/lib/X11/OMWrap.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -XOM -XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, - _Xconst char *res_class) -{ - XLCd lcd = _XOpenLC((char *) NULL); - - if (lcd == NULL) - return (XOM) NULL; - - if (lcd->methods->open_om) - return (*lcd->methods->open_om)(lcd, dpy, rdb, res_name, res_class); - - return (XOM) NULL; -} - -Status -XCloseOM(XOM om) -{ - XOC oc, next; - XLCd lcd = om->core.lcd; - - next = om->core.oc_list; - - while ((oc = next)) { - next = oc->core.next; - (*oc->methods->destroy)(oc); - } - - om->core.oc_list = NULL; - - _XCloseLC(lcd); - - return (*om->methods->close)(om); -} - -char * -XSetOMValues(XOM om, ...) -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - - va_start(var, om); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, om); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - ret = (*om->methods->set_values)(om, args, num_args); - - Xfree(args); - - return ret; -} - -char * -XGetOMValues(XOM om, ...) -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - - va_start(var, om); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, om); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - ret = (*om->methods->get_values)(om, args, num_args); - - Xfree(args); - - return ret; -} - -Display * -XDisplayOfOM(XOM om) -{ - return om->core.display; -} - -char * -XLocaleOfOM(XOM om) -{ - return om->core.lcd->core->name; -} diff --git a/nx-X11/lib/X11/OfCCC.c b/nx-X11/lib/X11/OfCCC.c deleted file mode 100644 index 06fc3d7a1..000000000 --- a/nx-X11/lib/X11/OfCCC.c +++ /dev/null @@ -1,162 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsOfCCC.c - Color Conversion Context Querying Routines - * - * DESCRIPTION - * Routines to query components of a Color Conversion - * Context structure. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlib.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsDisplayOfCCC - * - * SYNOPSIS - */ - -Display * -XcmsDisplayOfCCC( - XcmsCCC ccc) -/* - * DESCRIPTION - * Queries the Display of the specified CCC. - * - * RETURNS - * Pointer to the Display. - * - */ -{ - return(ccc->dpy); -} - - -/* - * NAME - * XcmsVisualOfCCC - * - * SYNOPSIS - */ - -Visual * -XcmsVisualOfCCC( - XcmsCCC ccc) -/* - * DESCRIPTION - * Queries the Visual of the specified CCC. - * - * RETURNS - * Pointer to the Visual. - * - */ -{ - return(ccc->visual); -} - - -/* - * NAME - * XcmsScreenNumberOfCCC - * - * SYNOPSIS - */ - -int -XcmsScreenNumberOfCCC( - XcmsCCC ccc) -/* - * DESCRIPTION - * Queries the screen number of the specified CCC. - * - * RETURNS - * screen number. - * - */ -{ - return(ccc->screenNumber); -} - - -/* - * NAME - * XcmsScreenWhitePointOfCCC - * - * SYNOPSIS - */ - -XcmsColor * -XcmsScreenWhitePointOfCCC( - XcmsCCC ccc) -/* - * DESCRIPTION - * Queries the screen white point of the specified CCC. - * - * RETURNS - * Pointer to the XcmsColor containing the screen white point. - * - */ -{ - return(&ccc->pPerScrnInfo->screenWhitePt); -} - - -/* - * NAME - * XcmsClientWhitePointOfCCC - * - * SYNOPSIS - */ - -XcmsColor * -XcmsClientWhitePointOfCCC( - XcmsCCC ccc) -/* - * DESCRIPTION - * Queries the client white point of the specified CCC. - * - * RETURNS - * Pointer to the XcmsColor containing the client white point. - * - */ -{ - return(&ccc->clientWhitePt); -} diff --git a/nx-X11/lib/X11/OpenDis.c b/nx-X11/lib/X11/OpenDis.c deleted file mode 100644 index 965924650..000000000 --- a/nx-X11/lib/X11/OpenDis.c +++ /dev/null @@ -1,990 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - -Copyright 1985, 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#if USE_XCB -#include "Xxcbint.h" -#else /* !USE_XCB */ -#include -#include -#endif /* USE_XCB */ -#include -#include -#include -#include "Xintconn.h" - -#ifdef XKB -#include "XKBlib.h" -#endif /* XKB */ - -#ifdef NX_TRANS_SOCKET -extern void *_X11TransSocketProxyConnInfo(XtransConnInfo); -#endif - -#if !USE_XCB -#define bignamelen (sizeof(XBigReqExtensionName) - 1) - -typedef struct { - unsigned long seq; - int opcode; -} _XBigReqState; -#endif /* !USE_XCB */ - -#ifdef XTHREADS -#include "locking.h" -int (*_XInitDisplayLock_fn)(Display *dpy) = NULL; -void (*_XFreeDisplayLock_fn)(Display *dpy) = NULL; - -#define InitDisplayLock(d) (_XInitDisplayLock_fn ? (*_XInitDisplayLock_fn)(d) : Success) -#define FreeDisplayLock(d) if (_XFreeDisplayLock_fn) (*_XFreeDisplayLock_fn)(d) -#else -#define InitDisplayLock(dis) Success -#define FreeDisplayLock(dis) -#endif /* XTHREADS */ - -static xReq _dummy_request = { - 0, 0, 0 -}; - -static void OutOfMemory(Display *dpy, char *setup); -#if !USE_XCB -static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len, - XPointer data); -#endif /* !USE_XCB */ - -/* - * Connects to a server, creates a Display object and returns a pointer to - * the newly created Display back to the caller. - */ -Display * -XOpenDisplay ( - register _Xconst char *display) -{ - register Display *dpy; /* New Display object being created. */ - register int i; - int j, k; /* random iterator indexes */ - char *display_name; /* pointer to display name */ -#if !USE_XCB - int endian; /* to determine which endian. */ - xConnClientPrefix client; /* client information */ - int idisplay; /* display number */ - int prefixread = 0; /* setup prefix already read? */ - char *conn_auth_name, *conn_auth_data; - int conn_auth_namelen, conn_auth_datalen; -#endif /* !USE_XCB */ - char *setup = NULL; /* memory allocated at startup */ - char *fullname = NULL; /* expanded name of display */ - int iscreen; /* screen number */ - xConnSetupPrefix prefix; /* prefix information */ - int vendorlen; /* length of vendor string */ - union { - xConnSetup *setup; - char *failure; - char *vendor; - xPixmapFormat *sf; - xWindowRoot *rp; - xDepth *dp; - xVisualType *vp; - } u; /* proto data returned from server */ - long setuplength; /* number of bytes in setup message */ - long usedbytes = 0; /* number of bytes we have processed */ - unsigned long mask; - long int conn_buf_size; - char *xlib_buffer_size; - -#if !USE_XCB - bzero((char *) &client, sizeof(client)); - bzero((char *) &prefix, sizeof(prefix)); -#endif /* !USE_XCB */ - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "\nXOpenDisplay: Called with display [%s].\n", display); -#endif - /* - * If the display specifier string supplied as an argument to this - * routine is NULL or a pointer to NULL, read the DISPLAY variable. - */ - if (display == NULL || *display == '\0') { - if ((display_name = getenv("DISPLAY")) == NULL) { - /* Oops! No DISPLAY environment variable - error. */ - return(NULL); - } - } - else { - /* Display is non-NULL, copy the pointer */ - display_name = (char *)display; - } - -/* - * Set the default error handlers. This allows the global variables to - * default to NULL for use with shared libraries. - */ - if (_XErrorFunction == NULL) (void) XSetErrorHandler (NULL); - if (_XIOErrorFunction == NULL) (void) XSetIOErrorHandler (NULL); - -/* - * Attempt to allocate a display structure. Return NULL if allocation fails. - */ - if ((dpy = Xcalloc(1, sizeof(Display))) == NULL) { - return(NULL); - } - -/* - * Call the Connect routine to get the transport connection object. - * If NULL is returned, the connection failed. The connect routine - * will set fullname to point to the expanded name. - */ - -#if USE_XCB - if(!_XConnectXCB(dpy, display, &fullname, &iscreen)) { - /* Try falling back on other transports if no transport specified */ - const char *slash = strrchr(display_name, '/'); - if(slash == NULL) { - const char *protocols[] = {"local", "unix", "tcp", "inet6", "inet", NULL}; - const char **s; - size_t buf_size = strlen(display_name) + 7; // max strlen + 2 (null + /) - char *buf = Xmalloc(buf_size * sizeof(char)); - - if(buf) { - for(s = protocols; buf && *s; s++) { - snprintf(buf, buf_size, "%s/%s", *s, display_name); - if(_XConnectXCB(dpy, buf, &fullname, &iscreen)) - goto fallback_success; - } - Xfree(buf); - } - } - - dpy->display_name = fullname; - OutOfMemory(dpy, NULL); - return NULL; - } -fallback_success: -#else /* !USE_XCB */ - if ((dpy->trans_conn = _X11TransConnectDisplay ( - display_name, &fullname, &idisplay, - &iscreen, &conn_auth_name, - &conn_auth_namelen, &conn_auth_data, - &conn_auth_datalen)) == NULL) { - Xfree ((char *) dpy); - return(NULL); - } - - dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn); -#endif /* USE_XCB */ - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "\nXOpenDisplay: Connected display with dpy->fd = [%d].\n", dpy->fd); -#endif - /* Initialize as much of the display structure as we can. - * Initialize pointers to NULL so that XFreeDisplayStructure will - * work if we run out of memory before we finish initializing. - */ - dpy->display_name = fullname; - dpy->keysyms = (KeySym *) NULL; - dpy->modifiermap = NULL; - dpy->lock_meaning = NoSymbol; - dpy->keysyms_per_keycode = 0; - dpy->xdefaults = (char *)NULL; - dpy->scratch_length = 0L; - dpy->scratch_buffer = NULL; - dpy->key_bindings = NULL; - dpy->ext_procs = (_XExtension *)NULL; - dpy->ext_data = (XExtData *)NULL; - dpy->ext_number = 0; - dpy->event_vec[X_Error] = _XUnknownWireEvent; - dpy->event_vec[X_Reply] = _XUnknownWireEvent; - dpy->wire_vec[X_Error] = _XUnknownNativeEvent; - dpy->wire_vec[X_Reply] = _XUnknownNativeEvent; - for (i = KeyPress; i < LASTEvent; i++) { - dpy->event_vec[i] = _XWireToEvent; - dpy->wire_vec[i] = NULL; - } - for (i = LASTEvent; i < 128; i++) { - dpy->event_vec[i] = _XUnknownWireEvent; - dpy->wire_vec[i] = _XUnknownNativeEvent; - } - dpy->resource_id = 0; - dpy->db = (struct _XrmHashBucketRec *)NULL; - dpy->cursor_font = None; - dpy->flags = 0; - dpy->async_handlers = NULL; - dpy->screens = NULL; - dpy->vendor = NULL; - dpy->buffer = NULL; - dpy->atoms = NULL; - dpy->error_vec = NULL; - dpy->context_db = NULL; - dpy->free_funcs = NULL; - dpy->pixmap_format = NULL; - dpy->cms.clientCmaps = NULL; - dpy->cms.defaultCCCs = NULL; - dpy->cms.perVisualIntensityMaps = NULL; - dpy->im_filters = NULL; - dpy->bigreq_size = 0; - dpy->lock = NULL; - dpy->lock_fns = NULL; - dpy->qfree = NULL; - dpy->next_event_serial_num = 1; - dpy->im_fd_info = NULL; - dpy->im_fd_length = 0; - dpy->conn_watchers = NULL; - dpy->watcher_count = 0; - dpy->filedes = NULL; - dpy->flushes = NULL; - dpy->xcmisc_opcode = 0; - dpy->xkb_info = NULL; - -/* - * Setup other information in this display structure. - */ - dpy->vnumber = X_PROTOCOL; - dpy->resource_alloc = _XAllocID; - dpy->idlist_alloc = _XAllocIDs; - dpy->synchandler = NULL; - dpy->savedsynchandler = NULL; - dpy->request = 0; - dpy->last_request_read = 0; - dpy->default_screen = iscreen; /* Value returned by ConnectDisplay */ - dpy->last_req = (char *)&_dummy_request; - - /* Initialize the display lock */ - if (InitDisplayLock(dpy) != 0) { - OutOfMemory (dpy, setup); - return(NULL); - } - - if (!_XPollfdCacheInit(dpy)) { - OutOfMemory (dpy, setup); - return(NULL); - } - - /* Set up the output buffers. */ -#ifndef XLIBDEFAULTBUFSIZE -#define XLIBDEFAULTBUFSIZE 16384 /* 16k */ -#endif -#ifndef XLIBMINBUFSIZE -#define XLIBMINBUFSIZE BUFSIZE /* old default buffer size */ -#endif - xlib_buffer_size = getenv("XLIBBUFFERSIZE"); - -#ifdef __sun /* Backwards compatibility for old Solaris libX11 name */ - if (xlib_buffer_size == NULL) - xlib_buffer_size = getenv("XSUNBUFFERSIZE"); -#endif - - if (xlib_buffer_size == NULL) - conn_buf_size = XLIBDEFAULTBUFSIZE; - else - conn_buf_size = 1024 * strtol(xlib_buffer_size, NULL, 10); - if (conn_buf_size < XLIBMINBUFSIZE) - conn_buf_size = XLIBMINBUFSIZE; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf (stderr, "Xlib: Running with XLIBBUFFERSIZE [%d] XLIBMINBUFSIZE [%d] " - "buffer size [%ld].\n", XLIBDEFAULTBUFSIZE, XLIBMINBUFSIZE, conn_buf_size); -#endif - - if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) { - OutOfMemory (dpy, setup); - return(NULL); - } - dpy->bufmax = dpy->buffer + conn_buf_size; -#if USE_XCB - dpy->xcb->real_bufmax = dpy->bufmax; - dpy->bufmax = dpy->buffer; -#endif - - /* Set up the input event queue and input event queue parameters. */ - dpy->head = dpy->tail = NULL; - dpy->qlen = 0; - - /* Set up free-function record */ - if ((dpy->free_funcs = Xcalloc(1, sizeof(_XFreeFuncRec))) == NULL) { - OutOfMemory (dpy, setup); - return(NULL); - } - -#if !USE_XCB -/* - * The xConnClientPrefix describes the initial connection setup information - * and is followed by the authorization information. Sites that are interested - * in security are strongly encouraged to use an authentication and - * authorization system such as Kerberos. - */ - endian = 1; - if (*(char *) &endian) - client.byteOrder = '\154'; /* 'l' */ - else - client.byteOrder = '\102'; /* 'B' */ - client.majorVersion = X_PROTOCOL; - client.minorVersion = X_PROTOCOL_REVISION; - client.nbytesAuthProto = conn_auth_namelen; - client.nbytesAuthString = conn_auth_datalen; - prefixread = _XSendClientPrefix(dpy, &client, - conn_auth_name, conn_auth_data, - &prefix); - if (prefixread < 0) - { - _XDisconnectDisplay (dpy->trans_conn); - Xfree ((char *)dpy); - return(NULL); - } - if (conn_auth_name) Xfree(conn_auth_name); - if (conn_auth_data) Xfree(conn_auth_data); -/* - * Now see if connection was accepted... - */ - /* these internal functions expect the display to be locked */ - LockDisplay(dpy); - - if (prefixread == 0) - _XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix)); - - /* an Authenticate reply we weren't expecting? */ - if (prefix.success != xTrue && prefix.success != xFalse) { - fprintf (stderr, - "Xlib: unexpected connection setup reply from server, type %d.\r\n", - prefix.success); - _XDisconnectDisplay (dpy->trans_conn); - Xfree ((char *)dpy); - return(NULL); - } - - if (prefix.majorVersion != X_PROTOCOL) { - /* XXX - printing messages marks a bad programming interface */ -#ifdef NX_TRANS_SOCKET - if (_X11TransSocketProxyConnInfo(dpy->trans_conn) == NULL) { - fprintf (stderr, "Xlib: client uses different protocol version (%d) " - "than server (%d)!\r\n", X_PROTOCOL, prefix.majorVersion); - } -#else - fprintf (stderr, - "Xlib: client uses different protocol version (%d) than server (%d)!\r\n", - X_PROTOCOL, prefix.majorVersion); -#endif - _XDisconnectDisplay (dpy->trans_conn); - Xfree ((char *)dpy); - return(NULL); - } -#endif /* !USE_XCB */ - -#if USE_XCB - { - const struct xcb_setup_t *xcbsetup = xcb_get_setup(dpy->xcb->connection); - memcpy(&prefix, xcbsetup, sizeof(prefix)); - setuplength = prefix.length << 2; - setup = (char *) xcbsetup; - setup += SIZEOF(xConnSetupPrefix); - u.setup = (xConnSetup *) setup; - } -#else /* !USE_XCB */ - setuplength = prefix.length << 2; - if ( (u.setup = (xConnSetup *) - (setup = Xmalloc ((unsigned) setuplength))) == NULL) { - _XDisconnectDisplay (dpy->trans_conn); - Xfree ((char *)dpy); - return(NULL); - } - _XRead (dpy, (char *)u.setup, setuplength); - -/* - * If the connection was not accepted by the server due to problems, - * give error message to the user.... - */ - if (prefix.success != xTrue) { - /* XXX - printing messages marks a bad programming interface */ - fprintf (stderr, - "Xlib: connection to \"%s\" refused by server\r\nXlib: ", - fullname); - - if (prefix.lengthReason > setuplength) { - fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n"); - }else{ - (void) fwrite (u.failure, (size_t)sizeof(char), - (size_t)prefix.lengthReason, stderr); - (void) fwrite ("\r\n", sizeof(char), 2, stderr); - } - - OutOfMemory(dpy, setup); - return (NULL); - } -#endif /* USE_XCB */ - -/* - * Check if the reply was long enough to get any information out of it. - */ - usedbytes = sz_xConnSetup; - if (setuplength < usedbytes ) { - fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); - OutOfMemory(dpy, setup); - return (NULL); - } - -/* - * We succeeded at authorization, so let us move the data into - * the display structure. - */ - dpy->proto_major_version= prefix.majorVersion; - dpy->proto_minor_version= prefix.minorVersion; - dpy->release = u.setup->release; - dpy->resource_base = u.setup->ridBase; - dpy->resource_mask = u.setup->ridMask; - dpy->min_keycode = u.setup->minKeyCode; - dpy->max_keycode = u.setup->maxKeyCode; - dpy->motion_buffer = u.setup->motionBufferSize; - dpy->nformats = u.setup->numFormats; - dpy->nscreens = u.setup->numRoots; - dpy->byte_order = u.setup->imageByteOrder; - dpy->bitmap_unit = u.setup->bitmapScanlineUnit; - dpy->bitmap_pad = u.setup->bitmapScanlinePad; - dpy->bitmap_bit_order = u.setup->bitmapBitOrder; - dpy->max_request_size = u.setup->maxRequestSize; - mask = dpy->resource_mask; - dpy->resource_shift = 0; - if (!mask) - { - fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n", - fullname); - OutOfMemory(dpy, setup); - return (NULL); - } - - while (!(mask & 1)) { - dpy->resource_shift++; - mask = mask >> 1; - } - dpy->resource_max = (dpy->resource_mask >> dpy->resource_shift) - 5; -/* - * now extract the vendor string... String must be null terminated, - * padded to multiple of 4 bytes. - */ - /* Check for a sane vendor string length */ - if (u.setup->nbytesVendor > 256) { - OutOfMemory(dpy, setup); - return (NULL); - } - - dpy->vendor = Xmalloc(u.setup->nbytesVendor + 1); - if (dpy->vendor == NULL) { - OutOfMemory(dpy, setup); - return (NULL); - } - vendorlen = u.setup->nbytesVendor; - -/* - * validate setup length - */ - usedbytes += (vendorlen + 3) & ~3; - if (setuplength < usedbytes) { - fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); - OutOfMemory(dpy, setup); - return (NULL); - } - - u.setup = (xConnSetup *) (((char *) u.setup) + sz_xConnSetup); - (void) strncpy(dpy->vendor, u.vendor, vendorlen); - dpy->vendor[vendorlen] = '\0'; - vendorlen = (vendorlen + 3) & ~3; /* round up */ - u.vendor += vendorlen; - -/* - * Now iterate down setup information..... - */ - dpy->pixmap_format = Xcalloc(dpy->nformats, sizeof(ScreenFormat)); - if (dpy->pixmap_format == NULL) { - OutOfMemory (dpy, setup); - return(NULL); - } -/* - * First decode the Z axis Screen format information. - */ - usedbytes += dpy->nformats * sz_xPixmapFormat; - - if (setuplength < usedbytes) { - fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); - OutOfMemory (dpy, setup); - return(NULL); - } - - for (i = 0; i < dpy->nformats; i++) { - register ScreenFormat *fmt = &dpy->pixmap_format[i]; - fmt->depth = u.sf->depth; - fmt->bits_per_pixel = u.sf->bitsPerPixel; - fmt->scanline_pad = u.sf->scanLinePad; - fmt->ext_data = NULL; - u.sf = (xPixmapFormat *) (((char *) u.sf) + sz_xPixmapFormat); - } - -/* - * next the Screen structures. - */ - dpy->screens = Xcalloc(dpy->nscreens, sizeof(Screen)); - if (dpy->screens == NULL) { - OutOfMemory (dpy, setup); - return(NULL); - } - -/* - * Now go deal with each screen structure. - */ - for (i = 0; i < dpy->nscreens; i++) { - register Screen *sp = &dpy->screens[i]; - VisualID root_visualID; - - usedbytes += sz_xWindowRoot; - if (setuplength < usedbytes) { - fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); - OutOfMemory (dpy, setup); - return(NULL); - } - - root_visualID = u.rp->rootVisualID; - sp->display = dpy; - sp->root = u.rp->windowId; - sp->cmap = u.rp->defaultColormap; - sp->white_pixel = u.rp->whitePixel; - sp->black_pixel = u.rp->blackPixel; - sp->root_input_mask = u.rp->currentInputMask; - sp->width = u.rp->pixWidth; - sp->height = u.rp->pixHeight; - sp->mwidth = u.rp->mmWidth; - sp->mheight = u.rp->mmHeight; - sp->min_maps = u.rp->minInstalledMaps; - sp->max_maps = u.rp->maxInstalledMaps; - sp->backing_store= u.rp->backingStore; - sp->save_unders = u.rp->saveUnders; - sp->root_depth = u.rp->rootDepth; - sp->ndepths = u.rp->nDepths; - sp->ext_data = NULL; - u.rp = (xWindowRoot *) (((char *) u.rp) + sz_xWindowRoot); -/* - * lets set up the depth structures. - */ - sp->depths = Xcalloc(sp->ndepths, sizeof(Depth)); - if (sp->depths == NULL) { - OutOfMemory (dpy, setup); - return(NULL); - } - /* - * for all depths on this screen. - */ - for (j = 0; j < sp->ndepths; j++) { - Depth *dp = &sp->depths[j]; - - usedbytes += sz_xDepth; - if (setuplength < usedbytes) { - fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); - OutOfMemory (dpy, setup); - return(NULL); - } - - dp->depth = u.dp->depth; - dp->nvisuals = u.dp->nVisuals; - u.dp = (xDepth *) (((char *) u.dp) + sz_xDepth); - if (dp->nvisuals > 0) { - dp->visuals = Xcalloc(dp->nvisuals, sizeof(Visual)); - if (dp->visuals == NULL) { - OutOfMemory (dpy, setup); - return(NULL); - } - for (k = 0; k < dp->nvisuals; k++) { - register Visual *vp = &dp->visuals[k]; - - usedbytes += sz_xVisualType; - if (setuplength < usedbytes) { - fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); - OutOfMemory (dpy, setup); - return(NULL); - } - - vp->visualid = u.vp->visualID; - vp->class = u.vp->class; - vp->bits_per_rgb= u.vp->bitsPerRGB; - vp->map_entries = u.vp->colormapEntries; - vp->red_mask = u.vp->redMask; - vp->green_mask = u.vp->greenMask; - vp->blue_mask = u.vp->blueMask; - vp->ext_data = NULL; - u.vp = (xVisualType *) (((char *) u.vp) + - sz_xVisualType); - } - if (dp->depth == 32 && getenv ("XLIB_SKIP_ARGB_VISUALS")) - { - Xfree (dp->visuals); - dp->visuals = NULL; - dp->nvisuals = 0; - } - } else { - dp->visuals = (Visual *) NULL; - } - } - sp->root_visual = _XVIDtoVisual(dpy, root_visualID); - } - - if(usedbytes != setuplength){ - /* Sanity check, shouldn't happen. */ - fprintf(stderr, "Xlib: Did not parse entire setup message: " - "parsed: %ld, message: %ld\n", - usedbytes, setuplength); - OutOfMemory(dpy, setup); - return(NULL); - } - -/* - * Now start talking to the server to setup all other information... - */ - -#if !USE_XCB - Xfree (setup); /* all finished with setup information */ -#endif /* !USE_XCB */ - -/* - * Make sure default screen is legal. - */ - if (iscreen >= dpy->nscreens) { - OutOfMemory(dpy, (char *) NULL); - return(NULL); - } - -#if !USE_XCB -/* - * finished calling internal routines, now unlock for external routines - */ - UnlockDisplay(dpy); -#endif /* !USE_XCB */ - -#if USE_XCB -/* - * get availability of large requests - */ - dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection); - if(dpy->bigreq_size <= dpy->max_request_size) - dpy->bigreq_size = 0; -#endif /* USE_XCB */ - -/* - * Set up other stuff clients are always going to use. - */ - for (i = 0; i < dpy->nscreens; i++) { - register Screen *sp = &dpy->screens[i]; - XGCValues values; - values.foreground = sp->black_pixel; - values.background = sp->white_pixel; - if ((sp->default_gc = XCreateGC (dpy, sp->root, - GCForeground|GCBackground, - &values)) == NULL) { - OutOfMemory(dpy, (char *) NULL); - return (NULL); - } - } -/* - * call into synchronization routine so that all programs can be - * forced synchronous - */ - (void) XSynchronize(dpy, _Xdebug); - -/* - * get the resource manager database off the root window. - */ - LockDisplay(dpy); - { - xGetPropertyReply reply; - xGetPropertyReq *req; -#if !USE_XCB - _XAsyncHandler async; - _XBigReqState async_state; - xQueryExtensionReq *qreq; - xBigReqEnableReq *breq; - xBigReqEnableReply brep; - - GetReq(QueryExtension, qreq); - async_state.seq = dpy->request; - async_state.opcode = 0; - async.next = dpy->async_handlers; - async.handler = _XBigReqHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - qreq->nbytes = bignamelen; - qreq->length += (bignamelen+3)>>2; - Data(dpy, XBigReqExtensionName, bignamelen); -#endif /* !USE_XCB */ - - GetReq (GetProperty, req); - req->window = RootWindow(dpy, 0); - req->property = XA_RESOURCE_MANAGER; - req->type = XA_STRING; - req->delete = False; - req->longOffset = 0; - req->longLength = 100000000L; - - if (_XReply (dpy, (xReply *) &reply, 0, xFalse)) { - if (reply.format == 8 && reply.propertyType == XA_STRING && - (reply.nItems + 1 > 0) && - (reply.nItems <= req->longLength * 4) && - (dpy->xdefaults = Xmalloc (reply.nItems + 1))) { - _XReadPad (dpy, dpy->xdefaults, reply.nItems); - dpy->xdefaults[reply.nItems] = '\0'; - } - else if (reply.propertyType != None) - _XEatDataWords(dpy, reply.length); - } -#if !USE_XCB - DeqAsyncHandler(dpy, &async); - if (async_state.opcode) { - GetReq(BigReqEnable, breq); - breq->reqType = async_state.opcode; - breq->brReqType = X_BigReqEnable; - if (_XReply(dpy, (xReply *)&brep, 0, xFalse)) - dpy->bigreq_size = brep.max_request_size; - } -#endif /* !USE_XCB */ - } - UnlockDisplay(dpy); - -#ifdef MOTIFBC - { - extern Display *_XHeadOfDisplayList; - _XHeadOfDisplayList = dpy; - } -#endif -#ifdef XKB - XkbUseExtension(dpy,NULL,NULL); -#endif -/* - * and return successfully - */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "XOpenDisplay: Returning display at [%p].\n", dpy); -#endif - return(dpy); -} - -#if !USE_XCB -static Bool -_XBigReqHandler( - register Display *dpy, - register xReply *rep, - char *buf, - int len, - XPointer data) -{ - _XBigReqState *state; - xQueryExtensionReply replbuf; - xQueryExtensionReply *repl; - - state = (_XBigReqState *)data; - if (dpy->last_request_read != state->seq) - return False; - if (rep->generic.type == X_Error) - return True; - repl = (xQueryExtensionReply *) - _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, - (SIZEOF(xQueryExtensionReply) - SIZEOF(xReply)) >> 2, - True); - if (repl->present) - state->opcode = repl->major_opcode; - return True; -} -#endif /* !USE_XCB */ - - -/* XFreeDisplayStructure frees all the storage associated with a - * Display. It is used by XOpenDisplay if it runs out of memory, - * and also by XCloseDisplay. It needs to check whether all pointers - * are non-NULL before dereferencing them, since it may be called - * by XOpenDisplay before the Display structure is fully formed. - * XOpenDisplay must be sure to initialize all the pointers to NULL - * before the first possible call on this. - */ - -void _XFreeDisplayStructure(Display *dpy) -{ - /* move all cookies in the EQ to the jar, then free them. */ - if (dpy->qfree) { - _XQEvent *qelt = dpy->qfree; - while (qelt) { - if (_XIsEventCookie(dpy, &qelt->event)) - _XStoreEventCookie(dpy, &qelt->event); - qelt = qelt->next; - } - } - if (dpy->cookiejar) - _XFreeEventCookies(dpy); - while (dpy->ext_procs) { - _XExtension *ext = dpy->ext_procs; - dpy->ext_procs = ext->next; - Xfree (ext->name); - Xfree (ext); - } - if (dpy->im_filters) - (*dpy->free_funcs->im_filters)(dpy); - if (dpy->cms.clientCmaps) - (*dpy->free_funcs->clientCmaps)(dpy); - if (dpy->cms.defaultCCCs) - (*dpy->free_funcs->defaultCCCs)(dpy); - if (dpy->cms.perVisualIntensityMaps) - (*dpy->free_funcs->intensityMaps)(dpy); - if (dpy->atoms) - (*dpy->free_funcs->atoms)(dpy); - if (dpy->modifiermap) - (*dpy->free_funcs->modifiermap)(dpy->modifiermap); - if (dpy->key_bindings) - (*dpy->free_funcs->key_bindings)(dpy); - if (dpy->context_db) - (*dpy->free_funcs->context_db)(dpy); - if (dpy->xkb_info) - (*dpy->free_funcs->xkb)(dpy); - - /* if RM database was allocated by XGetDefault() free it */ - if (dpy->db && (dpy->flags & XlibDisplayDfltRMDB)) - XrmDestroyDatabase(dpy->db); - - if (dpy->screens) { - register int i; - - for (i = 0; i < dpy->nscreens; i++) { - Screen *sp = &dpy->screens[i]; - - if (sp->depths) { - register int j; - - for (j = 0; j < sp->ndepths; j++) { - Depth *dp = &sp->depths[j]; - - if (dp->visuals) { - register int k; - - for (k = 0; k < dp->nvisuals; k++) - _XFreeExtData (dp->visuals[k].ext_data); - Xfree (dp->visuals); - } - } - - Xfree (sp->depths); - } - - _XFreeExtData (sp->ext_data); - } - - Xfree (dpy->screens); - } - - if (dpy->pixmap_format) { - register int i; - - for (i = 0; i < dpy->nformats; i++) - _XFreeExtData (dpy->pixmap_format[i].ext_data); - Xfree (dpy->pixmap_format); - } - - free(dpy->display_name); - - Xfree (dpy->vendor); - Xfree (dpy->buffer); - Xfree (dpy->keysyms); - Xfree (dpy->xdefaults); - Xfree (dpy->error_vec); - - _XFreeExtData (dpy->ext_data); - - Xfree (dpy->free_funcs); - Xfree (dpy->scratch_buffer); - FreeDisplayLock(dpy); - - if (dpy->qfree) { - register _XQEvent *qelt = dpy->qfree; - - while (qelt) { - register _XQEvent *qnxt = qelt->next; - Xfree (qelt); - qelt = qnxt; - } - } - while (dpy->im_fd_info) { - struct _XConnectionInfo *conni = dpy->im_fd_info; - dpy->im_fd_info = conni->next; - Xfree (conni->watch_data); - Xfree (conni); - } - if (dpy->conn_watchers) { - struct _XConnWatchInfo *watcher = dpy->conn_watchers; - dpy->conn_watchers = watcher->next; - Xfree (watcher); - } - - Xfree (dpy->filedes); - -#if USE_XCB - _XFreeX11XCBStructure(dpy); -#endif /* USE_XCB */ - - Xfree (dpy); -} - -/* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL - after this returns. */ - -static void OutOfMemory(Display *dpy, char *setup) -{ -#if USE_XCB - if(dpy->xcb->connection) - xcb_disconnect(dpy->xcb->connection); -#else /* !USE_XCB */ - _XDisconnectDisplay (dpy->trans_conn); -#endif /* USE_XCB */ - _XFreeDisplayStructure (dpy); -#if !USE_XCB - if (setup) Xfree (setup); -#endif /* !USE_XCB */ -} diff --git a/nx-X11/lib/X11/ParseCmd.c b/nx-X11/lib/X11/ParseCmd.c deleted file mode 100644 index b4bb97654..000000000 --- a/nx-X11/lib/X11/ParseCmd.c +++ /dev/null @@ -1,225 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -/* XrmParseCommand() - - Parse command line and store argument values into resource database - - Allows any un-ambiguous abbreviation for an option name, but requires - that the table be ordered with any options that are prefixes of - other options appearing before the longer version in the table. -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include - - -static void _XReportParseError(XrmOptionDescRec *arg, const char *msg) -{ - (void) fprintf(stderr, "Error parsing argument \"%s\" (%s); %s\n", - arg->option, arg->specifier, msg); - exit(1); -} - -void -XrmParseCommand( - XrmDatabase *pdb, /* data base */ - register XrmOptionDescList options, /* pointer to table of valid options */ - int num_options, /* number of options */ - _Xconst char *prefix, /* name to prefix resources with */ - int *argc, /* address of argument count */ - char **argv) /* argument list (command line) */ -{ - int foundOption; - char **argsave; - register int i, myargc; - XrmBinding bindings[100]; - XrmQuark quarks[100]; - XrmBinding *start_bindings; - XrmQuark *start_quarks; - char *optP, *argP = NULL, optchar, argchar = 0; - int matches; - enum {DontCare, Check, NotSorted, Sorted} table_is_sorted; - char **argend; - -#define PutCommandResource(value_str) \ - { \ - XrmStringToBindingQuarkList( \ - options[i].specifier, start_bindings, start_quarks); \ - XrmQPutStringResource(pdb, bindings, quarks, value_str); \ - } /* PutCommandResource */ - - myargc = (*argc); - argend = argv + myargc; - argsave = ++argv; - - /* Initialize bindings/quark list with prefix (typically app name). */ - quarks[0] = XrmStringToName(prefix); - bindings[0] = XrmBindTightly; - start_quarks = quarks+1; - start_bindings = bindings+1; - - table_is_sorted = (myargc > 2) ? Check : DontCare; - for (--myargc; myargc > 0; --myargc, ++argv) { - foundOption = False; - matches = 0; - for (i=0; i < num_options; ++i) { - /* checking the sort order first insures we don't have to - re-do the check if the arg hits on the last entry in - the table. Useful because usually '=' is the last entry - and users frequently specify geometry early in the command */ - if (table_is_sorted == Check && i > 0 && - strcmp(options[i].option, options[i-1].option) < 0) { - table_is_sorted = NotSorted; - } - for (argP = *argv, optP = options[i].option; - (optchar = *optP++) && - (argchar = *argP++) && - argchar == optchar;); - if (!optchar) { - if (!*argP || - options[i].argKind == XrmoptionStickyArg || - options[i].argKind == XrmoptionIsArg) { - /* give preference to exact matches, StickyArg and IsArg */ - matches = 1; - foundOption = i; - break; - } - } - else if (!argchar) { - /* may be an abbreviation for this option */ - matches++; - foundOption = i; - } - else if (table_is_sorted == Sorted && optchar > argchar) { - break; - } - if (table_is_sorted == Check && i > 0 && - strcmp(options[i].option, options[i-1].option) < 0) { - table_is_sorted = NotSorted; - } - } - if (table_is_sorted == Check && i >= (num_options-1)) - table_is_sorted = Sorted; - if (matches == 1) { - i = foundOption; - switch (options[i].argKind){ - case XrmoptionNoArg: - --(*argc); - PutCommandResource(options[i].value); - break; - - case XrmoptionIsArg: - --(*argc); - PutCommandResource(*argv); - break; - - case XrmoptionStickyArg: - --(*argc); - PutCommandResource(argP); - break; - - case XrmoptionSepArg: - if (myargc > 1) { - ++argv; --myargc; --(*argc); --(*argc); - PutCommandResource(*argv); - } else - (*argsave++) = (*argv); - break; - - case XrmoptionResArg: - if (myargc > 1) { - ++argv; --myargc; --(*argc); --(*argc); - XrmPutLineResource(pdb, *argv); - } else - (*argsave++) = (*argv); - break; - - case XrmoptionSkipArg: - if (myargc > 1) { - --myargc; - (*argsave++) = (*argv++); - } - (*argsave++) = (*argv); - break; - - case XrmoptionSkipLine: - for (; myargc > 0; myargc--) - (*argsave++) = (*argv++); - break; - - case XrmoptionSkipNArgs: - { - register int j = 1 + (long) options[i].value; - - if (j > myargc) j = myargc; - for (; j > 0; j--) { - (*argsave++) = (*argv++); - myargc--; - } - argv--; /* went one too far before */ - myargc++; - } - break; - - default: - _XReportParseError (&options[i], "unknown kind"); - break; - } - } - else - (*argsave++) = (*argv); /*compress arglist*/ - } - - if (argsave < argend) - (*argsave)=NULL; /* put NULL terminator on compressed argv */ -} diff --git a/nx-X11/lib/X11/ParseCol.c b/nx-X11/lib/X11/ParseCol.c deleted file mode 100644 index e997b1b8c..000000000 --- a/nx-X11/lib/X11/ParseCol.c +++ /dev/null @@ -1,138 +0,0 @@ -/* - -Copyright 1985, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" - - -Status -XParseColor ( - register Display *dpy, - Colormap cmap, - _Xconst char *spec, - XColor *def) -{ - register int n, i; - int r, g, b; - char c; - XcmsCCC ccc; - XcmsColor cmsColor; - - if (!spec) return(0); - n = strlen (spec); - if (*spec == '#') { - /* - * RGB - */ - spec++; - n--; - if (n != 3 && n != 6 && n != 9 && n != 12) - return (0); - n /= 3; - g = b = 0; - do { - r = g; - g = b; - b = 0; - for (i = n; --i >= 0; ) { - c = *spec++; - b <<= 4; - if (c >= '0' && c <= '9') - b |= c - '0'; - else if (c >= 'A' && c <= 'F') - b |= c - ('A' - 10); - else if (c >= 'a' && c <= 'f') - b |= c - ('a' - 10); - else return (0); - } - } while (*spec != '\0'); - n <<= 2; - n = 16 - n; - def->red = r << n; - def->green = g << n; - def->blue = b << n; - def->flags = DoRed | DoGreen | DoBlue; - return (1); - } - - -#ifdef XCMS - /* - * Let's Attempt to use Xcms and i18n approach to Parse Color - */ - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { - const char *tmpName = spec; - - switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor, - XcmsRGBFormat)) { - case XcmsSuccess: - case XcmsSuccessWithCompression: - cmsColor.pixel = def->pixel; - _XcmsRGB_to_XColor(&cmsColor, def, 1); - return(1); - case XcmsFailure: - case _XCMS_NEWNAME: - /* - * if the result was _XCMS_NEWNAME tmpName points to - * a string in cmsColNm.c:pairs table, for example, - * gray70 would become tekhvc:0.0/70.0/0.0 - */ - break; - } - } -#endif - - /* - * Xcms and i18n methods failed, so lets pass it to the server - * for parsing. - */ - { - xLookupColorReply reply; - register xLookupColorReq *req; - LockDisplay(dpy); - GetReq (LookupColor, req); - req->cmap = cmap; - req->nbytes = n = strlen(spec); - req->length += (n + 3) >> 2; - Data (dpy, spec, (long)n); - if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - def->red = reply.exactRed; - def->green = reply.exactGreen; - def->blue = reply.exactBlue; - def->flags = DoRed | DoGreen | DoBlue; - UnlockDisplay(dpy); - SyncHandle(); - return (1); - } -} diff --git a/nx-X11/lib/X11/ParseGeom.c b/nx-X11/lib/X11/ParseGeom.c deleted file mode 100644 index dfd812fc9..000000000 --- a/nx-X11/lib/X11/ParseGeom.c +++ /dev/null @@ -1,162 +0,0 @@ - -/* - -Copyright 1985, 1986, 1987,1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" - -/* - * XParseGeometry parses strings of the form - * "=x{+-}{+-}", where - * width, height, xoffset, and yoffset are unsigned integers. - * Example: "=80x24+300-49" - * The equal sign is optional. - * It returns a bitmask that indicates which of the four values - * were actually found in the string. For each value found, - * the corresponding argument is updated; for each value - * not found, the corresponding argument is left unchanged. - */ - -static int -ReadInteger(char *string, char **NextString) -{ - register int Result = 0; - int Sign = 1; - - if (*string == '+') - string++; - else if (*string == '-') - { - string++; - Sign = -1; - } - for (; (*string >= '0') && (*string <= '9'); string++) - { - Result = (Result * 10) + (*string - '0'); - } - *NextString = string; - if (Sign >= 0) - return (Result); - else - return (-Result); -} - -int -XParseGeometry ( -_Xconst char *string, -int *x, -int *y, -unsigned int *width, /* RETURN */ -unsigned int *height) /* RETURN */ -{ - int mask = NoValue; - register char *strind; - unsigned int tempWidth = 0, tempHeight = 0; - int tempX = 0, tempY = 0; - char *nextCharacter; - - if ( (string == NULL) || (*string == '\0')) return(mask); - if (*string == '=') - string++; /* ignore possible '=' at beg of geometry spec */ - - strind = (char *)string; - if (*strind != '+' && *strind != '-' && *strind != 'x') { - tempWidth = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= WidthValue; - } - - if (*strind == 'x' || *strind == 'X') { - strind++; - tempHeight = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= HeightValue; - } - - if ((*strind == '+') || (*strind == '-')) { - if (*strind == '-') { - strind++; - tempX = -ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return (0); - strind = nextCharacter; - mask |= XNegative; - - } - else - { strind++; - tempX = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return(0); - strind = nextCharacter; - } - mask |= XValue; - if ((*strind == '+') || (*strind == '-')) { - if (*strind == '-') { - strind++; - tempY = -ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return(0); - strind = nextCharacter; - mask |= YNegative; - - } - else - { - strind++; - tempY = ReadInteger(strind, &nextCharacter); - if (strind == nextCharacter) - return(0); - strind = nextCharacter; - } - mask |= YValue; - } - } - - /* If strind isn't at the end of the string the it's an invalid - geometry specification. */ - - if (*strind != '\0') return (0); - - if (mask & XValue) - *x = tempX; - if (mask & YValue) - *y = tempY; - if (mask & WidthValue) - *width = tempWidth; - if (mask & HeightValue) - *height = tempHeight; - return (mask); -} diff --git a/nx-X11/lib/X11/PeekEvent.c b/nx-X11/lib/X11/PeekEvent.c deleted file mode 100644 index ffbaa05b4..000000000 --- a/nx-X11/lib/X11/PeekEvent.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * Return the next event in the queue, - * BUT do not remove it from the queue. - * If none found, flush and wait until there is an event to peek. - */ - -int -XPeekEvent ( - register Display *dpy, - register XEvent *event) -{ - XEvent copy; - LockDisplay(dpy); - if (dpy->head == NULL) - _XReadEvents(dpy); -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockDisplay(dpy); - return 1; - } -#endif - *event = (dpy->head)->event; - if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { - _XStoreEventCookie(dpy, ©); - *event = copy; - } - UnlockDisplay(dpy); - return 1; -} - diff --git a/nx-X11/lib/X11/PeekIfEv.c b/nx-X11/lib/X11/PeekIfEv.c deleted file mode 100644 index f2f2cede4..000000000 --- a/nx-X11/lib/X11/PeekIfEv.c +++ /dev/null @@ -1,84 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * return the next event in the queue that satisfies the predicate. - * BUT do not remove it from the queue. - * If none found, flush, and then wait until one satisfies the predicate. - */ - -int -XPeekIfEvent ( - register Display *dpy, - register XEvent *event, - Bool (*predicate)( - Display* /* display */, - XEvent* /* event */, - char* /* arg */ - ), - char *arg) -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - - LockDisplay(dpy); - prev = NULL; - while (1) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if(qelt->qserial_num > qe_serial - && (*predicate)(dpy, &qelt->event, arg)) { - XEvent copy; - *event = qelt->event; - if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { - _XStoreEventCookie(dpy, ©); - *event = copy; - } - UnlockDisplay(dpy); - return 0; - } - } - if (prev) - qe_serial = prev->qserial_num; - _XReadEvents(dpy); - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockDisplay(dpy); - return 0; - } -#endif - } -} - diff --git a/nx-X11/lib/X11/Pending.c b/nx-X11/lib/X11/Pending.c deleted file mode 100644 index d3804c629..000000000 --- a/nx-X11/lib/X11/Pending.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) -#include -#endif - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* Read in pending events if needed and return the number of queued events. */ - -int XEventsQueued ( - register Display *dpy, - int mode) -{ - int ret_val; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "\nXEventsQueued: Called with a display at [%p].\n", (void *)dpy); -#endif - - LockDisplay(dpy); - if (dpy->qlen || (mode == QueuedAlready)) - ret_val = dpy->qlen; - else - ret_val = _XEventsQueued (dpy, mode); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "\nXEventsQueued: Going to unlock the display at [%p].\n", (void *)dpy); -#endif - UnlockDisplay(dpy); - return ret_val; -} - -int XPending (register Display *dpy) -{ - int ret_val; - LockDisplay(dpy); - if (dpy->qlen) - ret_val = dpy->qlen; - else - ret_val = _XEventsQueued (dpy, QueuedAfterFlush); - UnlockDisplay(dpy); - return ret_val; -} diff --git a/nx-X11/lib/X11/PixFormats.c b/nx-X11/lib/X11/PixFormats.c deleted file mode 100644 index 6d9f64d2c..000000000 --- a/nx-X11/lib/X11/PixFormats.c +++ /dev/null @@ -1,62 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -/* - * XListPixmapFormats - return info from connection setup - */ - -XPixmapFormatValues *XListPixmapFormats ( - Display *dpy, - int *count) /* RETURN */ -{ - XPixmapFormatValues *formats = - Xmalloc(dpy->nformats * sizeof (XPixmapFormatValues)); - - if (formats) { - register int i; - register XPixmapFormatValues *f; - register ScreenFormat *sf; - - /* - * copy data from internal Xlib data structure in display - */ - for (i = dpy->nformats, f = formats, sf = dpy->pixmap_format; i > 0; - i--, f++, sf++) { - f->depth = sf->depth; - f->bits_per_pixel = sf->bits_per_pixel; - f->scanline_pad = sf->scanline_pad; - } - - *count = dpy->nformats; - } - return formats; -} diff --git a/nx-X11/lib/X11/PmapBgnd.c b/nx-X11/lib/X11/PmapBgnd.c deleted file mode 100644 index 9c5155833..000000000 --- a/nx-X11/lib/X11/PmapBgnd.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetWindowBackgroundPixmap( - register Display *dpy, - Window w, - Pixmap pixmap) -{ - register xChangeWindowAttributesReq *req; - LockDisplay (dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWBackPixmap; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixmap); - UnlockDisplay (dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/PmapBord.c b/nx-X11/lib/X11/PmapBord.c deleted file mode 100644 index 7e1be616e..000000000 --- a/nx-X11/lib/X11/PmapBord.c +++ /dev/null @@ -1,48 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetWindowBorderPixmap( - register Display *dpy, - Window w, - Pixmap pixmap) -{ - register xChangeWindowAttributesReq *req; - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWBorderPixmap; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixmap); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/PolyReg.c b/nx-X11/lib/X11/PolyReg.c deleted file mode 100644 index cb30f8422..000000000 --- a/nx-X11/lib/X11/PolyReg.c +++ /dev/null @@ -1,635 +0,0 @@ -/************************************************************************ - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -************************************************************************/ - -#define LARGE_COORDINATE 1000000 -#define SMALL_COORDINATE -LARGE_COORDINATE - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" -#include -#include "poly.h" - -/* - * InsertEdgeInET - * - * Insert the given edge into the edge table. - * First we must find the correct bucket in the - * Edge table, then find the right slot in the - * bucket. Finally, we can insert it. - * - */ -static void -InsertEdgeInET( - EdgeTable *ET, - EdgeTableEntry *ETE, - int scanline, - ScanLineListBlock **SLLBlock, - int *iSLLBlock) -{ - register EdgeTableEntry *start, *prev; - register ScanLineList *pSLL, *pPrevSLL; - ScanLineListBlock *tmpSLLBlock; - - /* - * find the right bucket to put the edge into - */ - pPrevSLL = &ET->scanlines; - pSLL = pPrevSLL->next; - while (pSLL && (pSLL->scanline < scanline)) - { - pPrevSLL = pSLL; - pSLL = pSLL->next; - } - - /* - * reassign pSLL (pointer to ScanLineList) if necessary - */ - if ((!pSLL) || (pSLL->scanline > scanline)) - { - if (*iSLLBlock > SLLSPERBLOCK-1) - { - tmpSLLBlock = Xmalloc(sizeof(ScanLineListBlock)); - (*SLLBlock)->next = tmpSLLBlock; - tmpSLLBlock->next = (ScanLineListBlock *)NULL; - *SLLBlock = tmpSLLBlock; - *iSLLBlock = 0; - } - pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); - - pSLL->next = pPrevSLL->next; - pSLL->edgelist = (EdgeTableEntry *)NULL; - pPrevSLL->next = pSLL; - } - pSLL->scanline = scanline; - - /* - * now insert the edge in the right bucket - */ - prev = (EdgeTableEntry *)NULL; - start = pSLL->edgelist; - while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) - { - prev = start; - start = start->next; - } - ETE->next = start; - - if (prev) - prev->next = ETE; - else - pSLL->edgelist = ETE; -} - -/* - * CreateEdgeTable - * - * This routine creates the edge table for - * scan converting polygons. - * The Edge Table (ET) looks like: - * - * EdgeTable - * -------- - * | ymax | ScanLineLists - * |scanline|-->------------>-------------->... - * -------- |scanline| |scanline| - * |edgelist| |edgelist| - * --------- --------- - * | | - * | | - * V V - * list of ETEs list of ETEs - * - * where ETE is an EdgeTableEntry data structure, - * and there is one ScanLineList per scanline at - * which an edge is initially entered. - * - */ - -static void -CreateETandAET( - register int count, - register XPoint *pts, - EdgeTable *ET, - EdgeTableEntry *AET, - register EdgeTableEntry *pETEs, - ScanLineListBlock *pSLLBlock) -{ - register XPoint *top, *bottom; - register XPoint *PrevPt, *CurrPt; - int iSLLBlock = 0; - int dy; - - if (count < 2) return; - - /* - * initialize the Active Edge Table - */ - AET->next = (EdgeTableEntry *)NULL; - AET->back = (EdgeTableEntry *)NULL; - AET->nextWETE = (EdgeTableEntry *)NULL; - AET->bres.minor_axis = SMALL_COORDINATE; - - /* - * initialize the Edge Table. - */ - ET->scanlines.next = (ScanLineList *)NULL; - ET->ymax = SMALL_COORDINATE; - ET->ymin = LARGE_COORDINATE; - pSLLBlock->next = (ScanLineListBlock *)NULL; - - PrevPt = &pts[count-1]; - - /* - * for each vertex in the array of points. - * In this loop we are dealing with two vertices at - * a time -- these make up one edge of the polygon. - */ - while (count--) - { - CurrPt = pts++; - - /* - * find out which point is above and which is below. - */ - if (PrevPt->y > CurrPt->y) - { - bottom = PrevPt, top = CurrPt; - pETEs->ClockWise = 0; - } - else - { - bottom = CurrPt, top = PrevPt; - pETEs->ClockWise = 1; - } - - /* - * don't add horizontal edges to the Edge table. - */ - if (bottom->y != top->y) - { - pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */ - - /* - * initialize integer edge algorithm - */ - dy = bottom->y - top->y; - BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres); - - InsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock); - - if (PrevPt->y > ET->ymax) - ET->ymax = PrevPt->y; - if (PrevPt->y < ET->ymin) - ET->ymin = PrevPt->y; - pETEs++; - } - - PrevPt = CurrPt; - } -} - -/* - * loadAET - * - * This routine moves EdgeTableEntries from the - * EdgeTable into the Active Edge Table, - * leaving them sorted by smaller x coordinate. - * - */ - -static void -loadAET( - register EdgeTableEntry *AET, - register EdgeTableEntry *ETEs) -{ - register EdgeTableEntry *pPrevAET; - register EdgeTableEntry *tmp; - - pPrevAET = AET; - AET = AET->next; - while (ETEs) - { - while (AET && (AET->bres.minor_axis < ETEs->bres.minor_axis)) - { - pPrevAET = AET; - AET = AET->next; - } - tmp = ETEs->next; - ETEs->next = AET; - if (AET) - AET->back = ETEs; - ETEs->back = pPrevAET; - pPrevAET->next = ETEs; - pPrevAET = ETEs; - - ETEs = tmp; - } -} - -/* - * computeWAET - * - * This routine links the AET by the - * nextWETE (winding EdgeTableEntry) link for - * use by the winding number rule. The final - * Active Edge Table (AET) might look something - * like: - * - * AET - * ---------- --------- --------- - * |ymax | |ymax | |ymax | - * | ... | |... | |... | - * |next |->|next |->|next |->... - * |nextWETE| |nextWETE| |nextWETE| - * --------- --------- ^-------- - * | | | - * V-------------------> V---> ... - * - */ -static void -computeWAET( - register EdgeTableEntry *AET) -{ - register EdgeTableEntry *pWETE; - register int inside = 1; - register int isInside = 0; - - AET->nextWETE = (EdgeTableEntry *)NULL; - pWETE = AET; - AET = AET->next; - while (AET) - { - if (AET->ClockWise) - isInside++; - else - isInside--; - - if ((!inside && !isInside) || - ( inside && isInside)) - { - pWETE->nextWETE = AET; - pWETE = AET; - inside = !inside; - } - AET = AET->next; - } - pWETE->nextWETE = (EdgeTableEntry *)NULL; -} - -/* - * InsertionSort - * - * Just a simple insertion sort using - * pointers and back pointers to sort the Active - * Edge Table. - * - */ - -static int -InsertionSort( - register EdgeTableEntry *AET) -{ - register EdgeTableEntry *pETEchase; - register EdgeTableEntry *pETEinsert; - register EdgeTableEntry *pETEchaseBackTMP; - register int changed = 0; - - AET = AET->next; - while (AET) - { - pETEinsert = AET; - pETEchase = AET; - while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis) - pETEchase = pETEchase->back; - - AET = AET->next; - if (pETEchase != pETEinsert) - { - pETEchaseBackTMP = pETEchase->back; - pETEinsert->back->next = AET; - if (AET) - AET->back = pETEinsert->back; - pETEinsert->next = pETEchase; - pETEchase->back->next = pETEinsert; - pETEchase->back = pETEinsert; - pETEinsert->back = pETEchaseBackTMP; - changed = 1; - } - } - return(changed); -} - -/* - * Clean up our act. - */ -static void -FreeStorage( - register ScanLineListBlock *pSLLBlock) -{ - register ScanLineListBlock *tmpSLLBlock; - - while (pSLLBlock) - { - tmpSLLBlock = pSLLBlock->next; - Xfree(pSLLBlock); - pSLLBlock = tmpSLLBlock; - } -} - -/* - * Create an array of rectangles from a list of points. - * If indeed these things (POINTS, RECTS) are the same, - * then this proc is still needed, because it allocates - * storage for the array, which was allocated on the - * stack by the calling procedure. - * - */ -static int PtsToRegion( - register int numFullPtBlocks, - register int iCurPtBlock, - POINTBLOCK *FirstPtBlock, - REGION *reg) -{ - register BOX *rects; - register XPoint *pts; - register POINTBLOCK *CurPtBlock; - register int i; - register BOX *extents; - register int numRects; - BOX *prevRects = reg->rects; - - extents = ®->extents; - - numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; - - if (!(reg->rects = Xrealloc(reg->rects, sizeof(BOX) * numRects))) { - Xfree(prevRects); - return(0); - } - - reg->size = numRects; - CurPtBlock = FirstPtBlock; - rects = reg->rects - 1; - numRects = 0; - extents->x1 = MAXSHORT, extents->x2 = MINSHORT; - - for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) { - /* the loop uses 2 points per iteration */ - i = NUMPTSTOBUFFER >> 1; - if (!numFullPtBlocks) - i = iCurPtBlock >> 1; - for (pts = CurPtBlock->pts; i--; pts += 2) { - if (pts->x == pts[1].x) - continue; - if (numRects && pts->x == rects->x1 && pts->y == rects->y2 && - pts[1].x == rects->x2 && - (numRects == 1 || rects[-1].y1 != rects->y1) && - (i && pts[2].y > pts[1].y)) { - rects->y2 = pts[1].y + 1; - continue; - } - numRects++; - rects++; - rects->x1 = pts->x; rects->y1 = pts->y; - rects->x2 = pts[1].x; rects->y2 = pts[1].y + 1; - if (rects->x1 < extents->x1) - extents->x1 = rects->x1; - if (rects->x2 > extents->x2) - extents->x2 = rects->x2; - } - CurPtBlock = CurPtBlock->next; - } - - if (numRects) { - extents->y1 = reg->rects->y1; - extents->y2 = rects->y2; - } else { - extents->x1 = 0; - extents->y1 = 0; - extents->x2 = 0; - extents->y2 = 0; - } - reg->numRects = numRects; - - return(TRUE); -} - -/* - * polytoregion - * - * Scan converts a polygon by returning a run-length - * encoding of the resultant bitmap -- the run-length - * encoding is in the form of an array of rectangles. - */ -Region -XPolygonRegion( - XPoint *Pts, /* the pts */ - int Count, /* number of pts */ - int rule) /* winding rule */ -{ - Region region; - register EdgeTableEntry *pAET; /* Active Edge Table */ - register int y; /* current scanline */ - register int iPts = 0; /* number of pts in buffer */ - register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ - register ScanLineList *pSLL; /* current scanLineList */ - register XPoint *pts; /* output buffer */ - EdgeTableEntry *pPrevAET; /* ptr to previous AET */ - EdgeTable ET; /* header node for ET */ - EdgeTableEntry AET; /* header node for AET */ - EdgeTableEntry *pETEs; /* EdgeTableEntries pool */ - ScanLineListBlock SLLBlock; /* header for scanlinelist */ - int fixWAET = FALSE; - POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */ - POINTBLOCK *tmpPtBlock; - int numFullPtBlocks = 0; - - if (! (region = XCreateRegion())) return (Region) NULL; - - /* special case a rectangle */ - pts = Pts; - if (((Count == 4) || - ((Count == 5) && (pts[4].x == pts[0].x) && (pts[4].y == pts[0].y))) && - (((pts[0].y == pts[1].y) && - (pts[1].x == pts[2].x) && - (pts[2].y == pts[3].y) && - (pts[3].x == pts[0].x)) || - ((pts[0].x == pts[1].x) && - (pts[1].y == pts[2].y) && - (pts[2].x == pts[3].x) && - (pts[3].y == pts[0].y)))) { - region->extents.x1 = min(pts[0].x, pts[2].x); - region->extents.y1 = min(pts[0].y, pts[2].y); - region->extents.x2 = max(pts[0].x, pts[2].x); - region->extents.y2 = max(pts[0].y, pts[2].y); - if ((region->extents.x1 != region->extents.x2) && - (region->extents.y1 != region->extents.y2)) { - region->numRects = 1; - *(region->rects) = region->extents; - } - return(region); - } - - if (Count < 2) return region; - - if (! (pETEs = Xmalloc(sizeof(EdgeTableEntry) * Count))) { - XDestroyRegion(region); - return (Region) NULL; - } - - pts = FirstPtBlock.pts; - CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); - pSLL = ET.scanlines.next; - curPtBlock = &FirstPtBlock; - - if (rule == EvenOddRule) { - /* - * for each scanline - */ - for (y = ET.ymin; y < ET.ymax; y++) { - /* - * Add a new edge to the active edge table when we - * get to the next edge. - */ - if (pSLL != NULL && y == pSLL->scanline) { - loadAET(&AET, pSLL->edgelist); - pSLL = pSLL->next; - } - pPrevAET = &AET; - pAET = AET.next; - - /* - * for each active edge - */ - while (pAET) { - pts->x = pAET->bres.minor_axis, pts->y = y; - pts++, iPts++; - - /* - * send out the buffer - */ - if (iPts == NUMPTSTOBUFFER) { - tmpPtBlock = Xmalloc(sizeof(POINTBLOCK)); - curPtBlock->next = tmpPtBlock; - curPtBlock = tmpPtBlock; - pts = curPtBlock->pts; - numFullPtBlocks++; - iPts = 0; - } - EVALUATEEDGEEVENODD(pAET, pPrevAET, y); - } - (void) InsertionSort(&AET); - } - } - else { - /* - * for each scanline - */ - for (y = ET.ymin; y < ET.ymax; y++) { - /* - * Add a new edge to the active edge table when we - * get to the next edge. - */ - if (pSLL != NULL && y == pSLL->scanline) { - loadAET(&AET, pSLL->edgelist); - computeWAET(&AET); - pSLL = pSLL->next; - } - pPrevAET = &AET; - pAET = AET.next; - pWETE = pAET; - - /* - * for each active edge - */ - while (pAET) { - /* - * add to the buffer only those edges that - * are in the Winding active edge table. - */ - if (pWETE == pAET) { - pts->x = pAET->bres.minor_axis, pts->y = y; - pts++, iPts++; - - /* - * send out the buffer - */ - if (iPts == NUMPTSTOBUFFER) { - tmpPtBlock = Xmalloc(sizeof(POINTBLOCK)); - curPtBlock->next = tmpPtBlock; - curPtBlock = tmpPtBlock; - pts = curPtBlock->pts; - numFullPtBlocks++; iPts = 0; - } - pWETE = pWETE->nextWETE; - } - EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); - } - - /* - * recompute the winding active edge table if - * we just resorted or have exited an edge. - */ - if (InsertionSort(&AET) || fixWAET) { - computeWAET(&AET); - fixWAET = FALSE; - } - } - } - FreeStorage(SLLBlock.next); - (void) PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); - for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { - tmpPtBlock = curPtBlock->next; - Xfree(curPtBlock); - curPtBlock = tmpPtBlock; - } - Xfree(pETEs); - return(region); -} diff --git a/nx-X11/lib/X11/PolyTxt.c b/nx-X11/lib/X11/PolyTxt.c deleted file mode 100644 index 471383b57..000000000 --- a/nx-X11/lib/X11/PolyTxt.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawText( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, - XTextItem *items, - int nitems) -{ - register int i; - register XTextItem *item; - int length = 0; - register xPolyText8Req *req; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq (PolyText8, req); - req->drawable = d; - req->gc = gc->gid; - req->x = x; - req->y = y; - - item = items; - for (i=0; i < nitems; i++) { - if (item->font) - length += 5; /* a 255 byte, plus size of Font id */ - if (item->delta) - { - if (item->delta > 0) - { - length += SIZEOF(xTextElt) * ((item->delta + 126) / 127); - } - else - { - length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128); - } - } - if (item->nchars > 0) - { - length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1); - if (!item->delta) length += SIZEOF(xTextElt); - length += item->nchars; - } - item++; - } - - req->length += (length + 3)>>2; /* convert to number of 32-bit words */ - - - /* - * If the entire request does not fit into the remaining space in the - * buffer, flush the buffer first. If the request does fit into the - * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. - */ - - if (dpy->bufptr + length > dpy->bufmax) - _XFlush (dpy); - - item = items; - for (i=0; i< nitems; i++) { - - if (item->font) { - /* to mark a font shift, write a 255 byte followed by - the 4 bytes of font ID, big-end first */ - register unsigned char *f; - BufAlloc (unsigned char *, f, 5); - - f[0] = 255; - f[1] = (item->font & 0xff000000) >> 24; - f[2] = (item->font & 0x00ff0000) >> 16; - f[3] = (item->font & 0x0000ff00) >> 8; - f[4] = item->font & 0x000000ff; - - /* update GC shadow */ - gc->values.font = item->font; - } - - { - int nbytes = SIZEOF(xTextElt); - int PartialNChars = item->nchars; - int PartialDelta = item->delta; - /* register xTextElt *elt; */ - int FirstTimeThrough = True; - char *CharacterOffset = item->chars; - char *tbuf = NULL; - - while((PartialDelta < -128) || (PartialDelta > 127)) - { - int nb = SIZEOF(xTextElt); - - BufAlloc (char *, tbuf, nb); - *tbuf = 0; /* elt->len */ - if (PartialDelta > 0 ) - { - *(tbuf+1) = 127; /* elt->delta */ - PartialDelta = PartialDelta - 127; - } - else - { - /* -128 = 0x8, need to be careful of signed chars... */ - *((unsigned char *)(tbuf+1)) = 0x80; /* elt->delta */ - PartialDelta = PartialDelta + 128; - } - } - if (PartialDelta) - { - BufAlloc (char *, tbuf , nbytes); - *tbuf = 0; /* elt->len */ - *(tbuf+1) = PartialDelta; /* elt->delta */ - } - while(PartialNChars > 254) - { - nbytes = 254; - if (FirstTimeThrough) - { - FirstTimeThrough = False; - if (!item->delta) - { - nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); - *(tbuf+1) = 0; /* elt->delta */ - } - else - { - char *DummyChar; - BufAlloc(char *, DummyChar, nbytes); - } - } - else - { - nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); - *(tbuf+1) = 0; /* elt->delta */ - } - /* watch out for signs on chars */ - *(unsigned char *)tbuf = 254; /* elt->len */ - memcpy (tbuf+2 , CharacterOffset, 254); - PartialNChars = PartialNChars - 254; - CharacterOffset += 254; - - } - if (PartialNChars) - { - nbytes = PartialNChars; - if (FirstTimeThrough) - { - FirstTimeThrough = False; - if (!item->delta) - { - nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); - *(tbuf+1) = 0; /* elt->delta */ - } - else - { - char *DummyChar; - BufAlloc(char *, DummyChar, nbytes); - } - } - else - { - nbytes += SIZEOF(xTextElt); - BufAlloc (char *, tbuf, nbytes); - *(tbuf+1) = 0; /* elt->delta */ - } - *tbuf = PartialNChars; /* elt->len */ - memcpy (tbuf+2 , CharacterOffset, PartialNChars); - } - } - item++; - } - - /* Pad request out to a 32-bit boundary */ - - if (length &= 3) { - char *pad; - /* - * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" - */ - length = 4 - length; - BufAlloc (char *, pad, length); - /* - * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt - */ - *pad = 0; - } - - /* - * If the buffer pointer is not now pointing to a 32-bit boundary, - * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. - */ - - if ((dpy->bufptr - dpy->buffer) & 3) - _XFlush (dpy); - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } diff --git a/nx-X11/lib/X11/PolyTxt16.c b/nx-X11/lib/X11/PolyTxt16.c deleted file mode 100644 index 2e4be1673..000000000 --- a/nx-X11/lib/X11/PolyTxt16.c +++ /dev/null @@ -1,245 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawText16( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, - XTextItem16 *items, - int nitems) -{ - register int i; - register XTextItem16 *item; - int length = 0; - register xPolyText16Req *req; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq (PolyText16, req); - req->drawable = d; - req->gc = gc->gid; - req->x = x; - req->y = y; - - item = items; - for (i=0; i < nitems; i++) { - if (item->font) - length += 5; /* a 255 byte, plus size of Font id */ - if (item->delta) - { - if (item->delta > 0) - { - length += SIZEOF(xTextElt) * ((item->delta + 126) / 127); - } - else - { - length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128); - } - } - if (item->nchars > 0) - { - length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1); - if (!item->delta) length += SIZEOF(xTextElt); - length += item->nchars << 1; - } - item++; - } - - req->length += (length + 3)>>2; /* convert to number of 32-bit words */ - - - /* - * If the entire request does not fit into the remaining space in the - * buffer, flush the buffer first. If the request does fit into the - * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. - */ - - if (dpy->bufptr + length > dpy->bufmax) - _XFlush (dpy); - - item = items; - for (i=0; i< nitems; i++) { - - if (item->font) { - /* to mark a font shift, write a 255 byte followed by - the 4 bytes of font ID, big-end first */ - register unsigned char *f; - BufAlloc (unsigned char *, f, 5); - - f[0] = 255; - f[1] = (item->font & 0xff000000) >> 24; - f[2] = (item->font & 0x00ff0000) >> 16; - f[3] = (item->font & 0x0000ff00) >> 8; - f[4] = item->font & 0x000000ff; - - /* update GC shadow */ - gc->values.font = item->font; - } - - { - int nbytes = SIZEOF(xTextElt); - int PartialNChars = item->nchars; - int PartialDelta = item->delta; - register xTextElt *elt = NULL; - int FirstTimeThrough = True; - XChar2b *CharacterOffset = item->chars; - - while((PartialDelta < -128) || (PartialDelta > 127)) - { - int nb = SIZEOF(xTextElt); - - BufAlloc (xTextElt *, elt, nb); - elt->len = 0; - if (PartialDelta > 0 ) - { - elt->delta = 127; - PartialDelta = PartialDelta - 127; - } - else - { - elt->delta = -128; - PartialDelta = PartialDelta + 128; - } - } - if (PartialDelta) - { - BufAlloc (xTextElt *, elt, nbytes); - elt->len = 0; - elt->delta = PartialDelta; - } - while(PartialNChars > 254) - { - nbytes = 254 * 2; - if (FirstTimeThrough) - { - FirstTimeThrough = False; - if (!item->delta) - { - nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); - elt->delta = 0; - } - else - { - char *DummyChar; - BufAlloc(char *, DummyChar, nbytes); -#ifdef lint - DummyChar = DummyChar; -#endif - } - } - else - { - nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); - elt->delta = 0; - } - elt->len = 254; - - memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2); - PartialNChars = PartialNChars - 254; - CharacterOffset += 254; - - } - if (PartialNChars) - { - nbytes = PartialNChars * 2; - if (FirstTimeThrough) - { - FirstTimeThrough = False; - if (!item->delta) - { - nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); - elt->delta = 0; - } - else - { - char *DummyChar; - BufAlloc(char *, DummyChar, nbytes); -#ifdef lint - DummyChar = DummyChar; -#endif - } - } - else - { - nbytes += SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); - elt->delta = 0; - } - elt->len = PartialNChars; - - memcpy ((char *) (elt + 1), (char *)CharacterOffset, - PartialNChars * -2); - } - } - item++; - } - - /* Pad request out to a 32-bit boundary */ - - if (length &= 3) { - char *pad; - /* - * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" - */ - length = 4 - length; - BufAlloc (char *, pad, length); - /* - * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt - */ - *pad = 0; - } - - /* - * If the buffer pointer is not now pointing to a 32-bit boundary, - * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. - */ - - if ((dpy->bufptr - dpy->buffer) & 3) - _XFlush (dpy); - - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } - - - diff --git a/nx-X11/lib/X11/PrOfId.c b/nx-X11/lib/X11/PrOfId.c deleted file mode 100644 index a96d28cec..000000000 --- a/nx-X11/lib/X11/PrOfId.c +++ /dev/null @@ -1,97 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsPrOfId.c - * - * DESCRIPTION - * Source for XcmsPrefixOfFormat() - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/* - * NAME - * XcmsPrefixOfId - * - * SYNOPSIS - */ -char * -XcmsPrefixOfFormat( - XcmsColorFormat id) -/* - * DESCRIPTION - * Returns the color space prefix for the specified color - * space ID if the color space is found in the Color - * Conversion Context. - * - * RETURNS - * Returns a color space prefix. - * - * CAVEATS - * Space is allocated for the returned string, therefore, - * the application is responsible for freeing (using XFree) - * the space. - * - */ -{ - XcmsColorSpace **papColorSpaces; - - /* - * First try Device-Independent color spaces - */ - papColorSpaces = _XcmsDIColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if ((*papColorSpaces)->id == id) { - return strdup((*papColorSpaces)->prefix); - } - papColorSpaces++; - } - } - - /* - * Next try Device-Dependent color spaces - */ - papColorSpaces = _XcmsDDColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if ((*papColorSpaces)->id == id) { - return strdup((*papColorSpaces)->prefix); - } - papColorSpaces++; - } - } - - return(NULL); -} diff --git a/nx-X11/lib/X11/PropAlloc.c b/nx-X11/lib/X11/PropAlloc.c deleted file mode 100644 index 87817d88a..000000000 --- a/nx-X11/lib/X11/PropAlloc.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" -#include - - -/* - * Routines for allocating space for structures that are expected to get - * longer at some point. - */ - -XSizeHints *XAllocSizeHints (void) -{ - return Xcalloc (1, sizeof (XSizeHints)); -} - - -XStandardColormap *XAllocStandardColormap (void) -{ - return Xcalloc (1, sizeof (XStandardColormap)); -} - - -XWMHints *XAllocWMHints (void) -{ - return Xcalloc (1, sizeof (XWMHints)); -} - - -XClassHint *XAllocClassHint (void) -{ - return Xcalloc (1, sizeof (XClassHint)); -} - - -XIconSize *XAllocIconSize (void) -{ - return Xcalloc (1, sizeof (XIconSize)); -} - - diff --git a/nx-X11/lib/X11/PutBEvent.c b/nx-X11/lib/X11/PutBEvent.c deleted file mode 100644 index 1768e032c..000000000 --- a/nx-X11/lib/X11/PutBEvent.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* XPutBackEvent puts an event back at the head of the queue. */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -_XPutBackEvent ( - register Display *dpy, - register XEvent *event) - { - register _XQEvent *qelt; - XEvent store = *event; - - if (!dpy->qfree) { - if ((dpy->qfree = Xmalloc (sizeof (_XQEvent))) == NULL) { - return 0; - } - dpy->qfree->next = NULL; - } - - /* unclaimed cookie? */ - if (_XIsEventCookie(dpy, event)) - { - XEvent copy = {0}; - /* if not claimed, then just fetch and store again */ - if (!event->xcookie.data) { - _XFetchEventCookie(dpy, &event->xcookie); - store = *event; - } else { /* if claimed, copy, client must free */ - _XCopyEventCookie(dpy, &event->xcookie, ©.xcookie); - store = copy; - } - } - - qelt = dpy->qfree; - dpy->qfree = qelt->next; - qelt->qserial_num = dpy->next_event_serial_num++; - qelt->next = dpy->head; - qelt->event = store; - dpy->head = qelt; - if (dpy->tail == NULL) - dpy->tail = qelt; - dpy->qlen++; - return 0; - } - -int -XPutBackEvent ( - register Display * dpy, - register XEvent *event) - { - int ret; - - LockDisplay(dpy); - ret = _XPutBackEvent(dpy, event); - UnlockDisplay(dpy); - return ret; - } diff --git a/nx-X11/lib/X11/PutImage.c b/nx-X11/lib/X11/PutImage.c deleted file mode 100644 index daf172cf0..000000000 --- a/nx-X11/lib/X11/PutImage.c +++ /dev/null @@ -1,1030 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" -#include -#include "Cr.h" -#include "ImUtil.h" - -#if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) -#define RConst /**/ -#else -#define RConst const -#endif - -/* assumes pad is a power of 2 */ -#define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & ~(long)((pad) - 1)) - -static unsigned char const _reverse_byte[0x100] = { - 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, - 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, - 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, - 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, - 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, - 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, - 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, - 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, - 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, - 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, - 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, - 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, - 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, - 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, - 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, - 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, - 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, - 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, - 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, - 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, - 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, - 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, - 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, - 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, - 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, - 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, - 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, - 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, - 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, - 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, - 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, - 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff -}; - -static unsigned char const _reverse_nibs[0x100] = { - 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, - 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, - 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, - 0x81, 0x91, 0xa1, 0xb1, 0xc1, 0xd1, 0xe1, 0xf1, - 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72, - 0x82, 0x92, 0xa2, 0xb2, 0xc2, 0xd2, 0xe2, 0xf2, - 0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, - 0x83, 0x93, 0xa3, 0xb3, 0xc3, 0xd3, 0xe3, 0xf3, - 0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, - 0x84, 0x94, 0xa4, 0xb4, 0xc4, 0xd4, 0xe4, 0xf4, - 0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75, - 0x85, 0x95, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, - 0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76, - 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, - 0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, - 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, - 0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, - 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, 0xe8, 0xf8, - 0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, - 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xd9, 0xe9, 0xf9, - 0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, - 0x8a, 0x9a, 0xaa, 0xba, 0xca, 0xda, 0xea, 0xfa, - 0x0b, 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, - 0x8b, 0x9b, 0xab, 0xbb, 0xcb, 0xdb, 0xeb, 0xfb, - 0x0c, 0x1c, 0x2c, 0x3c, 0x4c, 0x5c, 0x6c, 0x7c, - 0x8c, 0x9c, 0xac, 0xbc, 0xcc, 0xdc, 0xec, 0xfc, - 0x0d, 0x1d, 0x2d, 0x3d, 0x4d, 0x5d, 0x6d, 0x7d, - 0x8d, 0x9d, 0xad, 0xbd, 0xcd, 0xdd, 0xed, 0xfd, - 0x0e, 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, - 0x8e, 0x9e, 0xae, 0xbe, 0xce, 0xde, 0xee, 0xfe, - 0x0f, 0x1f, 0x2f, 0x3f, 0x4f, 0x5f, 0x6f, 0x7f, - 0x8f, 0x9f, 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff -}; - -int -_XReverse_Bytes( - register unsigned char *bpt, - register int nb) -{ - do { - *bpt = _reverse_byte[*bpt]; - bpt++; - } while (--nb > 0); - return 0; -} - - -/* XXX the following functions are declared int instead of void because various - * compilers and lints complain about later initialization of SwapFunc and/or - * (swapfunc == NoSwap) when void is used. - */ - -/*ARGSUSED*/ -static void -NoSwap ( - register unsigned char *src, - register unsigned char *dest, - long srclen, - long srcinc, - long destinc, - unsigned int height, - int half_order) -{ - long h = height; - - if (srcinc == destinc) - memcpy((char *)dest, (char *)src, (int)(srcinc * (h - 1) + srclen)); - else - for (; --h >= 0; src += srcinc, dest += destinc) - memcpy((char *)dest, (char *)src, (int)srclen); -} - -static void -SwapTwoBytes ( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - long length = ROUNDUP(srclen, 2); - register long h, n; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 2; - if (half_order == MSBFirst) - *(dest + length) = *(src + length + 1); - else - *(dest + length + 1) = *(src + length); - } - for (n = length; n > 0; n -= 2, src += 2) { - *dest++ = *(src + 1); - *dest++ = *src; - } - } -} - -static void -SwapThreeBytes ( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int byte_order) -{ - long length = ((srclen + 2) / 3) * 3; - register long h, n; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 3; - if ((srclen - length) == 2) - *(dest + length + 1) = *(src + length + 1); - if (byte_order == MSBFirst) - *(dest + length) = *(src + length + 2); - else - *(dest + length + 2) = *(src + length); - } - for (n = length; n > 0; n -= 3, src += 3) { - *dest++ = *(src + 2); - *dest++ = *(src + 1); - *dest++ = *src; - } - } -} - -static void -SwapFourBytes ( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - long length = ROUNDUP(srclen, 4); - register long h, n; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 4; - if (half_order == MSBFirst) - *(dest + length) = *(src + length + 3); - if (((half_order == LSBFirst) && ((srclen - length) == 3)) || - ((half_order == MSBFirst) && (srclen & 2))) - *(dest + length + 1) = *(src + length + 2); - if (((half_order == MSBFirst) && ((srclen - length) == 3)) || - ((half_order == LSBFirst) && (srclen & 2))) - *(dest + length + 2) = *(src + length + 1); - if (half_order == LSBFirst) - *(dest + length + 3) = *(src + length); - } - for (n = length; n > 0; n -= 4, src += 4) { - *dest++ = *(src + 3); - *dest++ = *(src + 2); - *dest++ = *(src + 1); - *dest++ = *src; - } - } -} - -static void -SwapWords ( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - long length = ROUNDUP(srclen, 4); - register long h, n; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 4; - if (half_order == MSBFirst) - *(dest + length + 1) = *(src + length + 3); - if (((half_order == LSBFirst) && ((srclen - length) == 3)) || - ((half_order == MSBFirst) && (srclen & 2))) - *(dest + length) = *(src + length + 2); - if (((half_order == MSBFirst) && ((srclen - length) == 3)) || - ((half_order == LSBFirst) && (srclen & 2))) - *(dest + length + 3) = *(src + length + 1); - if (half_order == LSBFirst) - *(dest + length + 2) = *(src + length); - } - for (n = length; n > 0; n -= 4, src += 2) { - *dest++ = *(src + 2); - *dest++ = *(src + 3); - *dest++ = *src++; - *dest++ = *src++; - } - } -} - -static void -SwapNibbles( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height) -{ - register long h, n; - register const unsigned char *rev = _reverse_nibs; - - srcinc -= srclen; - destinc -= srclen; - for (h = height; --h >= 0; src += srcinc, dest += destinc) - for (n = srclen; --n >= 0; ) - *dest++ = rev[*src++]; -} - -static void -ShiftNibblesLeft ( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int nibble_order) -{ - register long h, n; - register unsigned char c1, c2; - - srcinc -= srclen; - destinc -= srclen; - if (nibble_order == MSBFirst) { - for (h = height; --h >= 0; src += srcinc, dest += destinc) - for (n = srclen; --n >= 0; ) { - c1 = *src++; - c2 = *src; - *dest++ = ((c1 & 0x0f) << 4) | ((c2 & (unsigned)0xf0) >> 4); - } - } else { - for (h = height; --h >= 0; src += srcinc, dest += destinc) - for (n = srclen; --n >= 0; ) { - c1 = *src++; - c2 = *src; - *dest++ = ((c2 & 0x0f) << 4) | ((c1 & (unsigned)0xf0) >> 4); - } - } -} - -/*ARGSUSED*/ -static void -SwapBits( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - register long h, n; - register const unsigned char *rev = _reverse_byte; - - srcinc -= srclen; - destinc -= srclen; - for (h = height; --h >= 0; src += srcinc, dest += destinc) - for (n = srclen; --n >= 0; ) - *dest++ = rev[*src++]; -} - -static void -SwapBitsAndTwoBytes( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - long length = ROUNDUP(srclen, 2); - register long h, n; - register const unsigned char *rev = _reverse_byte; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 2; - if (half_order == MSBFirst) - *(dest + length) = rev[*(src + length + 1)]; - else - *(dest + length + 1) = rev[*(src + length)]; - } - for (n = length; n > 0; n -= 2, src += 2) { - *dest++ = rev[*(src + 1)]; - *dest++ = rev[*src]; - } - } -} - -static void -SwapBitsAndFourBytes( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - long length = ROUNDUP(srclen, 4); - register long h, n; - register const unsigned char *rev = _reverse_byte; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 4; - if (half_order == MSBFirst) - *(dest + length) = rev[*(src + length + 3)]; - if (((half_order == LSBFirst) && ((srclen - length) == 3)) || - ((half_order == MSBFirst) && (srclen & 2))) - *(dest + length + 1) = rev[*(src + length + 2)]; - if (((half_order == MSBFirst) && ((srclen - length) == 3)) || - ((half_order == LSBFirst) && (srclen & 2))) - *(dest + length + 2) = rev[*(src + length + 1)]; - if (half_order == LSBFirst) - *(dest + length + 3) = rev[*(src + length)]; - } - for (n = length; n > 0; n -= 4, src += 4) { - *dest++ = rev[*(src + 3)]; - *dest++ = rev[*(src + 2)]; - *dest++ = rev[*(src + 1)]; - *dest++ = rev[*src]; - } - } -} - -static void -SwapBitsAndWords( - register unsigned char *src, - register unsigned char *dest, - long srclen, long srcinc, long destinc, - unsigned int height, - int half_order) -{ - long length = ROUNDUP(srclen, 4); - register long h, n; - register const unsigned char *rev = _reverse_byte; - - srcinc -= length; - destinc -= length; - for (h = height; --h >= 0; src += srcinc, dest += destinc) { - if ((h == 0) && (srclen != length)) { - length -= 4; - if (half_order == MSBFirst) - *(dest + length + 1) = rev[*(src + length + 3)]; - if (((half_order == LSBFirst) && ((srclen - length) == 3)) || - ((half_order == MSBFirst) && (srclen & 2))) - *(dest + length) = rev[*(src + length + 2)]; - if (((half_order == MSBFirst) && ((srclen - length) == 3)) || - ((half_order == LSBFirst) && (srclen & 2))) - *(dest + length + 3) = rev[*(src + length + 1)]; - if (half_order == LSBFirst) - *(dest + length + 2) = rev[*(src + length)]; - } - for (n = length; n > 0; n -= 4, src += 2) { - *dest++ = rev[*(src + 2)]; - *dest++ = rev[*(src + 3)]; - *dest++ = rev[*src++]; - *dest++ = rev[*src++]; - } - } -} - -/* - -The following table gives the bit ordering within bytes (when accessed -sequentially) for a scanline containing 32 bits, with bits numbered 0 to -31, where bit 0 should be leftmost on the display. For a given byte -labelled A-B, A is for the most significant bit of the byte, and B is -for the least significant bit. - -legend: - 1 scanline-unit = 8 - 2 scanline-unit = 16 - 4 scanline-unit = 32 - M byte-order = MostSignificant - L byte-order = LeastSignificant - m bit-order = MostSignificant - l bit-order = LeastSignificant - - -format ordering - -1Mm 00-07 08-15 16-23 24-31 -2Mm 00-07 08-15 16-23 24-31 -4Mm 00-07 08-15 16-23 24-31 -1Ml 07-00 15-08 23-16 31-24 -2Ml 15-08 07-00 31-24 23-16 -4Ml 31-24 23-16 15-08 07-00 -1Lm 00-07 08-15 16-23 24-31 -2Lm 08-15 00-07 24-31 16-23 -4Lm 24-31 16-23 08-15 00-07 -1Ll 07-00 15-08 23-16 31-24 -2Ll 07-00 15-08 23-16 31-24 -4Ll 07-00 15-08 23-16 31-24 - - -The following table gives the required conversion between any two -formats. It is based strictly on the table above. If you believe one, -you should believe the other. - -legend: - n no changes - s reverse 8-bit units within 16-bit units - l reverse 8-bit units within 32-bit units - w reverse 16-bit units within 32-bit units - R reverse bits within 8-bit units - S s+R - L l+R - W w+R - -*/ - -static void (* RConst (SwapFunction[12][12]))( - register unsigned char *src, - register unsigned char *dest, - long srclen, - long srcinc, - long destinc, - unsigned int height, - int half_order) = { -#define n NoSwap, -#define s SwapTwoBytes, -#define l SwapFourBytes, -#define w SwapWords, -#define R SwapBits, -#define S SwapBitsAndTwoBytes, -#define L SwapBitsAndFourBytes, -#define W SwapBitsAndWords, - -/* 1Mm 2Mm 4Mm 1Ml 2Ml 4Ml 1Lm 2Lm 4Lm 1Ll 2Ll 4Ll */ -/* 1Mm */ { n n n R S L n s l R R R }, -/* 2Mm */ { n n n R S L n s l R R R }, -/* 4Mm */ { n n n R S L n s l R R R }, -/* 1Ml */ { R R R n s l R S L n n n }, -/* 2Ml */ { S S S s n w S R W s s s }, -/* 4Ml */ { L L L l w n L W R l l l }, -/* 1Lm */ { n n n R S L n s l R R R }, -/* 2Lm */ { s s s S R W s n w S S S }, -/* 4Lm */ { l l l L W R l w n L L L }, -/* 1Ll */ { R R R n s l R S L n n n }, -/* 2Ll */ { R R R n s l R S L n n n }, -/* 4Ll */ { R R R n s l R S L n n n } - -#undef n -#undef s -#undef l -#undef w -#undef R -#undef S -#undef L -#undef W - -}; - -/* Of course, the table above is a lie. We also need to factor in the - * order of the source data to cope with swapping half of a unit at the - * end of a scanline, since we are trying to avoid de-ref'ing off the - * end of the source. - * - * Defines whether the first half of a unit has the first half of the data - */ -static int const HalfOrder[12] = { - LSBFirst, /* 1Mm */ - LSBFirst, /* 2Mm */ - LSBFirst, /* 4Mm */ - LSBFirst, /* 1Ml */ - MSBFirst, /* 2Ml */ - MSBFirst, /* 4Ml */ - LSBFirst, /* 1Lm */ - MSBFirst, /* 2Lm */ - MSBFirst, /* 4Lm */ - LSBFirst, /* 1Ll */ - LSBFirst, /* 2Ll */ - LSBFirst /* 4Ll */ - }; - -/* Finally, for SwapWords cases, the half order depends not just on the source - * but also on the destination scanline unit. Use of this table changes some - * MSBFirsts to LSBFirsts that are "do not care" (because the function will be - * NoSwap or SwapBits) in addition to changing the desired ones. - */ - -static int const HalfOrderWord[12] = { - MSBFirst, /* 1Mm */ - MSBFirst, /* 2Mm */ - MSBFirst, /* 4Mm */ - MSBFirst, /* 1Ml */ - MSBFirst, /* 2Ml */ - LSBFirst, /* 4Ml */ - MSBFirst, /* 1Lm */ - MSBFirst, /* 2Lm */ - LSBFirst, /* 4Lm */ - MSBFirst, /* 1Ll */ - MSBFirst, /* 2Ll */ - MSBFirst /* 4Ll */ - }; - -/* - * This macro creates a value from 0 to 11 suitable for indexing - * into the table above. - */ -#define ComposeIndex(bitmap_unit, bitmap_bit_order, byte_order) \ - (((bitmap_unit == 32) ? 2 : ((bitmap_unit == 16) ? 1 : 0)) \ - + (((bitmap_bit_order == MSBFirst) ? 0 : 3) \ - + ((byte_order == MSBFirst) ? 0 : 6))) - -/* Cancel a GetReq operation, before doing _XSend or Data */ - -#define UnGetReq(name)\ - dpy->bufptr -= SIZEOF(x##name##Req);\ - dpy->request-- - -static void -SendXYImage( - register Display *dpy, - register xPutImageReq *req, - register XImage *image, - int req_xoffset, int req_yoffset) -{ - register int j; - long total_xoffset, bytes_per_src, bytes_per_dest, length; - long bytes_per_line, bytes_per_src_plane, bytes_per_dest_plane; - char *src, *dest, *buf; - char *extra = (char *)NULL; - register void (*swapfunc)( - register unsigned char *src, - register unsigned char *dest, - long srclen, - long srcinc, - long destinc, - unsigned int height, - int half_order); - int half_order; - - total_xoffset = image->xoffset + req_xoffset; - req->leftPad = total_xoffset & (dpy->bitmap_unit - 1); - total_xoffset = (unsigned)(total_xoffset - req->leftPad) >> 3; - /* The protocol requires left-pad of zero on all ZPixmap, even - * though the 1-bit case is identical to bitmap format. This is a - * bug in the protocol, caused because 1-bit ZPixmap was added late - * in the game. Hairy shifting code compensation isn't worth it, - * just use XYPixmap format instead. - */ - if ((req->leftPad != 0) && (req->format == ZPixmap)) - req->format = XYPixmap; - bytes_per_dest = (unsigned long)ROUNDUP((long)req->width + req->leftPad, - dpy->bitmap_pad) >> 3; - bytes_per_dest_plane = bytes_per_dest * req->height; - length = bytes_per_dest_plane * image->depth; - req->length += (length + 3) >> 2; - - swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, - image->bitmap_bit_order, - image->byte_order)] - [ComposeIndex(dpy->bitmap_unit, - dpy->bitmap_bit_order, - dpy->byte_order)]; - half_order = HalfOrder[ComposeIndex(image->bitmap_unit, - image->bitmap_bit_order, - image->byte_order)]; - if (half_order == MSBFirst) - half_order = HalfOrderWord[ComposeIndex(dpy->bitmap_unit, - dpy->bitmap_bit_order, - dpy->byte_order)]; - - src = image->data + (image->bytes_per_line * req_yoffset) + total_xoffset; - - /* when total_xoffset > 0, we have to worry about stepping off the - * end of image->data. - */ - if ((swapfunc == NoSwap) && - (image->bytes_per_line == bytes_per_dest) && - (((total_xoffset == 0) && - ((image->depth == 1) || (image->height == req->height))) || - ((image->depth == 1) && - ((req_yoffset + req->height) < (unsigned)image->height)))) { - Data(dpy, src, length); - return; - } - - length = ROUNDUP(length, 4); - if ((dpy->bufptr + length) > dpy->bufmax) { - if ((buf = _XAllocScratch(dpy, length)) == NULL) { - UnGetReq(PutImage); - return; - } - } - else - buf = dpy->bufptr; - - bytes_per_src = (req->width + req->leftPad + (unsigned)7) >> 3; - bytes_per_line = image->bytes_per_line; - bytes_per_src_plane = bytes_per_line * image->height; - total_xoffset &= (image->bitmap_unit - 1) >> 3; - - if ((total_xoffset > 0) && - (image->byte_order != image->bitmap_bit_order)) { - char *temp; - long bytes_per_temp_plane, temp_length; - - bytes_per_line = bytes_per_src + total_xoffset; - src -= total_xoffset; - bytes_per_temp_plane = bytes_per_line * req->height; - temp_length = ROUNDUP(bytes_per_temp_plane * image->depth, 4); - if (buf == dpy->bufptr) { - if (! (temp = _XAllocScratch(dpy, temp_length))) { - UnGetReq(PutImage); - return; - } - } - else - if ((extra = temp = Xmalloc(temp_length)) == NULL) { - UnGetReq(PutImage); - return; - } - - swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, - image->bitmap_bit_order, - image->byte_order)] - [ComposeIndex(image->bitmap_unit, - dpy->byte_order, - dpy->byte_order)]; - for (dest = temp, j = image->depth; - --j >= 0; - src += bytes_per_src_plane, dest += bytes_per_temp_plane) - (*swapfunc)((unsigned char *)src, (unsigned char *)dest, - bytes_per_line, (long)image->bytes_per_line, - bytes_per_line, req->height, half_order); - swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, - dpy->byte_order, - dpy->byte_order)] - [ComposeIndex(dpy->bitmap_unit, - dpy->bitmap_bit_order, - dpy->byte_order)]; - half_order = HalfOrder[ComposeIndex(image->bitmap_unit, - dpy->byte_order, - dpy->byte_order)]; - src = temp + total_xoffset; - bytes_per_src_plane = bytes_per_temp_plane; - } - - for (dest = buf, j = image->depth; - --j >= 0; - src += bytes_per_src_plane, dest += bytes_per_dest_plane) - (*swapfunc)((unsigned char *)src, (unsigned char *)dest, - bytes_per_src, bytes_per_line, - bytes_per_dest, req->height, half_order); - - Xfree(extra); - - if (buf == dpy->bufptr) - dpy->bufptr += length; - else - _XSend(dpy, buf, length); - } - -static void -SendZImage( - register Display *dpy, - register xPutImageReq *req, - register XImage *image, - int req_xoffset, int req_yoffset, - int dest_bits_per_pixel, int dest_scanline_pad) -{ - long bytes_per_src, bytes_per_dest, length; - unsigned char *src, *dest; - unsigned char *shifted_src = NULL; - - req->leftPad = 0; - bytes_per_src = ROUNDUP((long)req->width * image->bits_per_pixel, 8) >> 3; - bytes_per_dest = ROUNDUP((long)req->width * dest_bits_per_pixel, - dest_scanline_pad) >> 3; - length = bytes_per_dest * req->height; - req->length += (length + 3) >> 2; - - src = (unsigned char *)image->data + - (req_yoffset * image->bytes_per_line) + - ((req_xoffset * image->bits_per_pixel) >> 3); - if ((image->bits_per_pixel == 4) && ((unsigned int) req_xoffset & 0x01)) { - if (! (shifted_src = Xmalloc(req->height * image->bytes_per_line))) { - UnGetReq(PutImage); - return; - } - - ShiftNibblesLeft(src, shifted_src, bytes_per_src, - (long) image->bytes_per_line, - (long) image->bytes_per_line, req->height, - image->byte_order); - src = shifted_src; - } - - /* when req_xoffset > 0, we have to worry about stepping off the - * end of image->data. - */ - if (((image->byte_order == dpy->byte_order) || - (image->bits_per_pixel == 8)) && - ((long)image->bytes_per_line == bytes_per_dest) && - ((req_xoffset == 0) || - ((req_yoffset + req->height) < (unsigned)image->height))) { - Data(dpy, (char *)src, length); - Xfree(shifted_src); - return; - } - - length = ROUNDUP(length, 4); - if ((dpy->bufptr + length) <= dpy->bufmax) - dest = (unsigned char *)dpy->bufptr; - else - if ((dest = (unsigned char *) - _XAllocScratch(dpy, length)) == NULL) { - Xfree(shifted_src); - UnGetReq(PutImage); - return; - } - - if ((image->byte_order == dpy->byte_order) || - (image->bits_per_pixel == 8)) - NoSwap(src, dest, bytes_per_src, (long)image->bytes_per_line, - bytes_per_dest, req->height, image->byte_order); - else if (image->bits_per_pixel == 32) - SwapFourBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, - bytes_per_dest, req->height, image->byte_order); - else if (image->bits_per_pixel == 24) - SwapThreeBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, - bytes_per_dest, req->height, image->byte_order); - else if (image->bits_per_pixel == 16) - SwapTwoBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, - bytes_per_dest, req->height, image->byte_order); - else - SwapNibbles(src, dest, bytes_per_src, (long)image->bytes_per_line, - bytes_per_dest, req->height); - - if (dest == (unsigned char *)dpy->bufptr) - dpy->bufptr += length; - else - _XSend(dpy, (char *)dest, length); - - Xfree(shifted_src); -} - -static void -PutImageRequest( - register Display *dpy, - Drawable d, - GC gc, - register XImage *image, - int req_xoffset, int req_yoffset, - int x, int y, - unsigned int req_width, unsigned int req_height, - int dest_bits_per_pixel, int dest_scanline_pad) -{ - register xPutImageReq *req; - - GetReq(PutImage, req); - req->drawable = d; - req->gc = gc->gid; - req->dstX = x; - req->dstY = y; - req->width = req_width; - req->height = req_height; - req->depth = image->depth; - req->format = image->format; - if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) - SendXYImage(dpy, req, image, req_xoffset, req_yoffset); - else - SendZImage(dpy, req, image, req_xoffset, req_yoffset, - dest_bits_per_pixel, dest_scanline_pad); -} - -static void -PutSubImage ( - register Display *dpy, - Drawable d, - GC gc, - register XImage *image, - int req_xoffset, - int req_yoffset, - int x, int y, - unsigned int req_width, - unsigned int req_height, - int dest_bits_per_pixel, - int dest_scanline_pad) -{ - int left_pad, BytesPerRow, Available; - - if ((req_width == 0) || (req_height == 0)) - return; - - Available = ((65536 < dpy->max_request_size) ? (65536 << 2) - : (dpy->max_request_size << 2)) - - SIZEOF(xPutImageReq); - - if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) { - left_pad = (image->xoffset + req_xoffset) & (dpy->bitmap_unit - 1); - BytesPerRow = (ROUNDUP((long)req_width + left_pad, - dpy->bitmap_pad) >> 3) * image->depth; - } else { - left_pad = 0; - BytesPerRow = ROUNDUP((long)req_width * dest_bits_per_pixel, - dest_scanline_pad) >> 3; - } - - if ((BytesPerRow * req_height) <= Available) { - PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, - req_width, req_height, - dest_bits_per_pixel, dest_scanline_pad); - } else if (req_height > 1) { - int SubImageHeight = Available / BytesPerRow; - - if (SubImageHeight == 0) - SubImageHeight = 1; - - PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, - req_width, (unsigned int) SubImageHeight, - dest_bits_per_pixel, dest_scanline_pad); - - PutSubImage(dpy, d, gc, image, req_xoffset, - req_yoffset + SubImageHeight, x, y + SubImageHeight, - req_width, req_height - SubImageHeight, - dest_bits_per_pixel, dest_scanline_pad); - } else { - int SubImageWidth = (((Available << 3) / dest_scanline_pad) - * dest_scanline_pad) - left_pad; - - PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, - (unsigned int) SubImageWidth, 1, - dest_bits_per_pixel, dest_scanline_pad); - - PutSubImage(dpy, d, gc, image, req_xoffset + SubImageWidth, - req_yoffset, x + SubImageWidth, y, - req_width - SubImageWidth, 1, - dest_bits_per_pixel, dest_scanline_pad); - } -} - - -int -XPutImage ( - register Display *dpy, - Drawable d, - GC gc, - register XImage *image, - int req_xoffset, - int req_yoffset, - int x, - int y, - unsigned int req_width, - unsigned int req_height) - -{ - long width = req_width; - long height = req_height; - int dest_bits_per_pixel, dest_scanline_pad; - - if (req_xoffset < 0) { - width += req_xoffset; - req_xoffset = 0; - } - if (req_yoffset < 0) { - height += req_yoffset; - req_yoffset = 0; - } - if ((req_xoffset + width) > image->width) - width = image->width - req_xoffset; - if ((req_yoffset + height) > image->height) - height = image->height - req_yoffset; - if ((width <= 0) || (height <= 0)) - return 0; - - if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) { - dest_bits_per_pixel = 1; - dest_scanline_pad = dpy->bitmap_pad; - } else { - register int n; - register ScreenFormat *format; - - dest_bits_per_pixel = image->bits_per_pixel; - dest_scanline_pad = image->bitmap_pad; - for (n = dpy->nformats, format = dpy->pixmap_format; --n >= 0; format++) - if (format->depth == image->depth) { - dest_bits_per_pixel = format->bits_per_pixel; - dest_scanline_pad = format->scanline_pad; - } - if (dest_bits_per_pixel != image->bits_per_pixel) { - XImage img; - register long i, j; - /* XXX slow, but works */ - img.width = width; - img.height = height; - img.xoffset = 0; - img.format = ZPixmap; - img.byte_order = dpy->byte_order; - img.bitmap_unit = dpy->bitmap_unit; - img.bitmap_bit_order = dpy->bitmap_bit_order; - img.bitmap_pad = dest_scanline_pad; - img.depth = image->depth; - img.bits_per_pixel = dest_bits_per_pixel; - img.bytes_per_line = ROUNDUP((dest_bits_per_pixel * width), - dest_scanline_pad) >> 3; - img.data = Xmalloc(img.bytes_per_line * height); - if (img.data == NULL) - return 0; - _XInitImageFuncPtrs(&img); - for (j = height; --j >= 0; ) - for (i = width; --i >= 0; ) - XPutPixel(&img, i, j, XGetPixel(image, req_xoffset + i, - req_yoffset + j)); - LockDisplay(dpy); - FlushGC(dpy, gc); - PutSubImage(dpy, d, gc, &img, 0, 0, x, y, - (unsigned int) width, (unsigned int) height, - dest_bits_per_pixel, dest_scanline_pad); - UnlockDisplay(dpy); - SyncHandle(); - Xfree(img.data); - return 0; - } - } - - LockDisplay(dpy); - FlushGC(dpy, gc); - - PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, - (unsigned int) width, (unsigned int) height, - dest_bits_per_pixel, dest_scanline_pad); - - UnlockDisplay(dpy); - SyncHandle(); -#ifdef USE_DYNAMIC_XCURSOR - if (image->bits_per_pixel == 1 && - x == 0 && y == 0 && - width == image->width && height == image->height && - gc->values.function == GXcopy && - (gc->values.plane_mask & 1)) - { - _XNoticePutBitmap (dpy, d, image); - } -#endif - return 0; -} diff --git a/nx-X11/lib/X11/QBlack.c b/nx-X11/lib/X11/QBlack.c deleted file mode 100644 index d7a69d399..000000000 --- a/nx-X11/lib/X11/QBlack.c +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQBlack.c - Query Black - * - * DESCRIPTION - * Routine to obtain a color specification for zero - * red, green, and blue intensities. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsQueryBlack - * - * SYNOPSIS - */ - -Status -XcmsQueryBlack( - XcmsCCC ccc, - XcmsColorFormat target_format, - XcmsColor *pColor_ret) -/* - * DESCRIPTION - * Returns the color specification in the target format for - * zero intensity red, green, and blue. - * - * RETURNS - * Returns XcmsSuccess, if failed; otherwise XcmsFailure - * - */ -{ - XcmsColor tmp; - - tmp.format = XcmsRGBiFormat; - tmp.pixel = 0; - tmp.spec.RGBi.red = 0.0; - tmp.spec.RGBi.green = 0.0; - tmp.spec.RGBi.blue = 0.0; - if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { - return(XcmsFailure); - } - memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/QBlue.c b/nx-X11/lib/X11/QBlue.c deleted file mode 100644 index 4555344e6..000000000 --- a/nx-X11/lib/X11/QBlue.c +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQBlue.c - Query Blue - * - * DESCRIPTION - * Routine to obtain a color specification for full - * blue intensity and zero red and green intensities. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsQueryBlue - * - * SYNOPSIS - */ - -Status -XcmsQueryBlue( - XcmsCCC ccc, - XcmsColorFormat target_format, - XcmsColor *pColor_ret) -/* - * DESCRIPTION - * Returns the color specification in the target format for - * full intensity blue and zero intensity red and green. - * - * RETURNS - * Returns XcmsSuccess, if failed; otherwise XcmsFailure - * - */ -{ - XcmsColor tmp; - - tmp.format = XcmsRGBiFormat; - tmp.pixel = 0; - tmp.spec.RGBi.red = 0.0; - tmp.spec.RGBi.green = 0.0; - tmp.spec.RGBi.blue = 1.0; - if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { - return(XcmsFailure); - } - memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/QGreen.c b/nx-X11/lib/X11/QGreen.c deleted file mode 100644 index 0c888358a..000000000 --- a/nx-X11/lib/X11/QGreen.c +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQGreen.c - Query Green - * - * DESCRIPTION - * Routine to obtain a color specification for full - * green intensity and zero red and blue intensities. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsQueryGreen - * - * SYNOPSIS - */ - -Status -XcmsQueryGreen( - XcmsCCC ccc, - XcmsColorFormat target_format, - XcmsColor *pColor_ret) -/* - * DESCRIPTION - * Returns the color specification in the target format for - * full intensity green and zero intensity red and blue. - * - * RETURNS - * Returns XcmsSuccess, if failed; otherwise XcmsFailure - * - */ -{ - XcmsColor tmp; - - tmp.format = XcmsRGBiFormat; - tmp.pixel = 0; - tmp.spec.RGBi.red = 0.0; - tmp.spec.RGBi.green = 1.0; - tmp.spec.RGBi.blue = 0.0; - if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { - return(XcmsFailure); - } - memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/QRed.c b/nx-X11/lib/X11/QRed.c deleted file mode 100644 index 357380d60..000000000 --- a/nx-X11/lib/X11/QRed.c +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQRed.c - Query Red - * - * DESCRIPTION - * Routine to obtain a color specification for full - * red intensity and zero green and blue intensities. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsQueryRed - * - * SYNOPSIS - */ - -Status -XcmsQueryRed( - XcmsCCC ccc, - XcmsColorFormat target_format, - XcmsColor *pColor_ret) -/* - * DESCRIPTION - * Returns the color specification in the target format for - * full intensity red and zero intensity green and blue. - * - * RETURNS - * Returns XcmsSuccess, if failed; otherwise XcmsFailure - * - */ -{ - XcmsColor tmp; - - tmp.format = XcmsRGBiFormat; - tmp.pixel = 0; - tmp.spec.RGBi.red = 1.0; - tmp.spec.RGBi.green = 0.0; - tmp.spec.RGBi.blue = 0.0; - if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { - return(XcmsFailure); - } - memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/QWhite.c b/nx-X11/lib/X11/QWhite.c deleted file mode 100644 index 36b764c9d..000000000 --- a/nx-X11/lib/X11/QWhite.c +++ /dev/null @@ -1,84 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQWhite.c - Query White - * - * DESCRIPTION - * Routine to obtain a color specification for full - * red, green, and blue intensities. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsQueryWhite - * - * SYNOPSIS - */ - -Status -XcmsQueryWhite( - XcmsCCC ccc, - XcmsColorFormat target_format, - XcmsColor *pColor_ret) -/* - * DESCRIPTION - * Returns the color specification in the target format for - * full intensity red, green, and blue. - * - * RETURNS - * Returns XcmsSuccess, if failed; otherwise XcmsFailure - * - */ -{ - XcmsColor tmp; - - tmp.format = XcmsRGBiFormat; - tmp.pixel = 0; - tmp.spec.RGBi.red = 1.0; - tmp.spec.RGBi.green = 1.0; - tmp.spec.RGBi.blue = 1.0; - if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { - return(XcmsFailure); - } - memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/QuBest.c b/nx-X11/lib/X11/QuBest.c deleted file mode 100644 index 97b1f116b..000000000 --- a/nx-X11/lib/X11/QuBest.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XQueryBestSize( - register Display *dpy, - int class, - Drawable drawable, - unsigned int width, - unsigned int height, - unsigned int *ret_width, - unsigned int *ret_height) -{ - xQueryBestSizeReply rep; - register xQueryBestSizeReq *req; - - LockDisplay(dpy); - GetReq(QueryBestSize, req); - req->class = class; - req->drawable = drawable; - req->width = width; - req->height = height; - if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - *ret_width = rep.width; - *ret_height = rep.height; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/QuCol.c b/nx-X11/lib/X11/QuCol.c deleted file mode 100644 index b4c1cd33a..000000000 --- a/nx-X11/lib/X11/QuCol.c +++ /dev/null @@ -1,78 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQuCol.c - * - * DESCRIPTION - * Source for XcmsQueryColors - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsQueryColor - Query Color - * - * SYNOPSIS - */ -Status -XcmsQueryColor( - Display *dpy, - Colormap colormap, - XcmsColor *pXcmsColor_in_out, - XcmsColorFormat result_format) -/* - * DESCRIPTION - * This routine uses XQueryColor to obtain the X RGB values - * stored in the specified colormap for the specified pixel. - * The X RGB values are then converted to the target format as - * specified by the format component of the XcmsColor structure. - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded. - * - * Returns a color specification of the color stored in the - * specified pixel. - */ -{ - return(_XcmsSetGetColor(XQueryColor, dpy, colormap, - pXcmsColor_in_out, result_format, (Bool *) NULL)); -} diff --git a/nx-X11/lib/X11/QuColor.c b/nx-X11/lib/X11/QuColor.c deleted file mode 100644 index 4638095c0..000000000 --- a/nx-X11/lib/X11/QuColor.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XQueryColor( - register Display *dpy, - Colormap cmap, - XColor *def) /* RETURN */ -{ - xrgb color; - xQueryColorsReply rep; - register xQueryColorsReq *req; - unsigned long val = def->pixel; /* needed for macro below */ - - LockDisplay(dpy); - GetReqExtra(QueryColors, 4, req); /* a pixel (CARD32) is 4 bytes */ - req->cmap = cmap; - - OneDataCard32 (dpy, NEXTPTR(req,xQueryColorsReq), val); - - if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { - - _XRead(dpy, (char *)&color, (long) SIZEOF(xrgb)); - - def->red = color.red; - def->blue = color.blue; - def->green = color.green; - def->flags = DoRed | DoGreen | DoBlue; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/QuColors.c b/nx-X11/lib/X11/QuColors.c deleted file mode 100644 index 0b9bc508f..000000000 --- a/nx-X11/lib/X11/QuColors.c +++ /dev/null @@ -1,99 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -static void -_XQueryColors( - register Display *dpy, - Colormap cmap, - XColor *defs, /* RETURN */ - int ncolors) -{ - register int i; - xQueryColorsReply rep; - register xQueryColorsReq *req; - - GetReq(QueryColors, req); - - req->cmap = cmap; - SetReqLen(req, ncolors, ncolors); /* each pixel is a CARD32 */ - - for (i = 0; i < ncolors; i++) - Data32 (dpy, (long *)&defs[i].pixel, 4L); - /* XXX this isn't very efficient */ - - if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { - unsigned long nbytes = (long) ncolors * SIZEOF(xrgb); - xrgb *color = Xmalloc(nbytes); - if (color != NULL) { - - _XRead(dpy, (char *) color, nbytes); - - for (i = 0; i < ncolors; i++) { - register XColor *def = &defs[i]; - register xrgb *rgb = &color[i]; - def->red = rgb->red; - def->green = rgb->green; - def->blue = rgb->blue; - def->flags = DoRed | DoGreen | DoBlue; - } - Xfree(color); - } - else - _XEatDataWords(dpy, rep.length); - } -} - -int -XQueryColors( - register Display * const dpy, - const Colormap cmap, - XColor *defs, /* RETURN */ - int ncolors) -{ - int n; - - if (dpy->bigreq_size > 0) - n = dpy->bigreq_size - (sizeof (xQueryColorsReq) >> 2) - 1; - else - n = dpy->max_request_size - (sizeof (xQueryColorsReq) >> 2); - - LockDisplay(dpy); - while (ncolors >= n) { - _XQueryColors(dpy, cmap, defs, n); - defs += n; - ncolors -= n; - } - if (ncolors > 0) - _XQueryColors(dpy, cmap, defs, ncolors); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/QuCols.c b/nx-X11/lib/X11/QuCols.c deleted file mode 100644 index 25a38b818..000000000 --- a/nx-X11/lib/X11/QuCols.c +++ /dev/null @@ -1,78 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsQuCol.c - * - * DESCRIPTION - * Source for XcmsQueryColors - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ -/* - * NAME - * XcmsQueryColors - Query Colors - * - * SYNOPSIS - */ -Status -XcmsQueryColors( - Display *dpy, - Colormap colormap, - XcmsColor *pXcmsColors_in_out, - unsigned int nColors, - XcmsColorFormat result_format) -/* - * DESCRIPTION - * This routine uses XQueryColors to obtain the X RGB values - * stored in the specified colormap for the specified pixels. - * The X RGB values are then converted to the target format as - * specified by the format component of the XcmsColor structure. - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded. - * - * Returns the color specifications of the colors stored in the - * specified pixels. - */ -{ - return(_XcmsSetGetColors(XQueryColors, dpy, colormap, - pXcmsColors_in_out, nColors, result_format, (Bool *) NULL)); -} diff --git a/nx-X11/lib/X11/QuCurShp.c b/nx-X11/lib/X11/QuCurShp.c deleted file mode 100644 index bb17c42fc..000000000 --- a/nx-X11/lib/X11/QuCurShp.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XQueryBestCursor( - register Display *dpy, - Drawable drawable, - unsigned int width, - unsigned int height, - unsigned int *ret_width, - unsigned int *ret_height) -{ - xQueryBestSizeReply rep; - register xQueryBestSizeReq *req; - - LockDisplay(dpy); - GetReq(QueryBestSize, req); - req->class = CursorShape; - req->drawable = drawable; - req->width = width; - req->height = height; - if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - *ret_width = rep.width; - *ret_height = rep.height; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/QuExt.c b/nx-X11/lib/X11/QuExt.c deleted file mode 100644 index 4e230e776..000000000 --- a/nx-X11/lib/X11/QuExt.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Bool -XQueryExtension( - register Display *dpy, - _Xconst char *name, - int *major_opcode, /* RETURN */ - int *first_event, /* RETURN */ - int *first_error) /* RETURN */ -{ - xQueryExtensionReply rep; - register xQueryExtensionReq *req; - - LockDisplay(dpy); - GetReq(QueryExtension, req); - req->nbytes = name ? strlen(name) : 0; - req->length += (req->nbytes+(unsigned)3)>>2; - _XSend(dpy, name, (long)req->nbytes); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - *major_opcode = rep.major_opcode; - *first_event = rep.first_event; - *first_error = rep.first_error; - UnlockDisplay(dpy); - SyncHandle(); - return (rep.present); -} - diff --git a/nx-X11/lib/X11/QuKeybd.c b/nx-X11/lib/X11/QuKeybd.c deleted file mode 100644 index 0a2d4d0fc..000000000 --- a/nx-X11/lib/X11/QuKeybd.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -struct kmap { - char map[32]; -}; - -int -XQueryKeymap( - register Display *dpy, - char keys[32]) -{ - xQueryKeymapReply rep; - _X_UNUSED register xReq *req; - - LockDisplay(dpy); - GetEmptyReq(QueryKeymap, req); - (void) _XReply(dpy, (xReply *)&rep, - (SIZEOF(xQueryKeymapReply) - SIZEOF(xReply)) >> 2, xTrue); - *(struct kmap *) keys = *(struct kmap *)rep.map; /* faster than memcpy */ - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/QuPntr.c b/nx-X11/lib/X11/QuPntr.c deleted file mode 100644 index e1379a6f5..000000000 --- a/nx-X11/lib/X11/QuPntr.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Bool XQueryPointer( - register Display *dpy, - Window w, - Window *root, - Window *child, - int *root_x, - int *root_y, - int *win_x, - int *win_y, - unsigned int *mask) -{ - xQueryPointerReply rep; - xResourceReq *req; - - LockDisplay(dpy); - GetResReq(QueryPointer, w, req); - if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(False); - } - - *root = rep.root; - *child = rep.child; - *root_x = cvtINT16toInt (rep.rootX); - *root_y = cvtINT16toInt (rep.rootY); - *win_x = cvtINT16toInt (rep.winX); - *win_y = cvtINT16toInt (rep.winY); - *mask = rep.mask; - UnlockDisplay(dpy); - SyncHandle(); - return (rep.sameScreen); -} - diff --git a/nx-X11/lib/X11/QuStipShp.c b/nx-X11/lib/X11/QuStipShp.c deleted file mode 100644 index 9f612fcb1..000000000 --- a/nx-X11/lib/X11/QuStipShp.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XQueryBestStipple( - register Display *dpy, - Drawable drawable, - unsigned int width, - unsigned int height, - unsigned int *ret_width, - unsigned int *ret_height) -{ - xQueryBestSizeReply rep; - register xQueryBestSizeReq *req; - - LockDisplay(dpy); - GetReq(QueryBestSize, req); - req->class = StippleShape; - req->drawable = drawable; - req->width = width; - req->height = height; - if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - *ret_width = rep.width; - *ret_height = rep.height; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/QuTextE16.c b/nx-X11/lib/X11/QuTextE16.c deleted file mode 100644 index e458bc52c..000000000 --- a/nx-X11/lib/X11/QuTextE16.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - -Copyright 1986, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XQueryTextExtents16 ( - register Display *dpy, - Font fid, - _Xconst XChar2b *string, - register int nchars, - int *dir, - int *font_ascent, - int *font_descent, - register XCharStruct *overall) -{ - register long i; - register unsigned char *ptr; - char *buf; - xQueryTextExtentsReply rep; - long nbytes; - register xQueryTextExtentsReq *req; - - LockDisplay(dpy); - nbytes = nchars << 1; - GetReq(QueryTextExtents, req); - req->fid = fid; - if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { - req->length += (nbytes + 3)>>2; - req->oddLength = nchars & 1; - for (ptr = (unsigned char *)buf, i = nchars; --i >= 0; string++) { - *ptr++ = string->byte1; - *ptr++ = string->byte2; - } - Data (dpy, buf, nbytes); - } - if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - *dir = rep.drawDirection; - *font_ascent = cvtINT16toInt (rep.fontAscent); - *font_descent = cvtINT16toInt (rep.fontDescent); - overall->ascent = (short) cvtINT16toShort (rep.overallAscent); - overall->descent = (short) cvtINT16toShort (rep.overallDescent); - /* XXX bogus - we're throwing away information!!! */ - overall->width = (short) cvtINT32toInt (rep.overallWidth); - overall->lbearing = (short) cvtINT32toInt (rep.overallLeft); - overall->rbearing = (short) cvtINT32toInt (rep.overallRight); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/QuTextExt.c b/nx-X11/lib/X11/QuTextExt.c deleted file mode 100644 index 8a17dbb27..000000000 --- a/nx-X11/lib/X11/QuTextExt.c +++ /dev/null @@ -1,80 +0,0 @@ -/* - -Copyright 1986, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XQueryTextExtents ( - register Display *dpy, - Font fid, - register _Xconst char *string, - register int nchars, - int *dir, - int *font_ascent, - int *font_descent, - register XCharStruct *overall) -{ - register int i; - register char *ptr; - char *buf; - xQueryTextExtentsReply rep; - long nbytes; - register xQueryTextExtentsReq *req; - - LockDisplay(dpy); - nbytes = nchars << 1; - GetReq(QueryTextExtents, req); - req->fid = fid; - if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { - req->length += (nbytes + 3)>>2; - req->oddLength = nchars & 1; - for (ptr = buf, i = nchars; --i >= 0;) { - *ptr++ = 0; - *ptr++ = *string++; - } - Data (dpy, buf, nbytes); - } - if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - *dir = rep.drawDirection; - *font_ascent = cvtINT16toInt (rep.fontAscent); - *font_descent = cvtINT16toInt (rep.fontDescent); - overall->ascent = (short) cvtINT16toShort (rep.overallAscent); - overall->descent = (short) cvtINT16toShort (rep.overallDescent); - /* XXX bogus - we're throwing away information!!! */ - overall->width = (short) cvtINT32toInt (rep.overallWidth); - overall->lbearing = (short) cvtINT32toInt (rep.overallLeft); - overall->rbearing = (short) cvtINT32toInt (rep.overallRight); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/QuTileShp.c b/nx-X11/lib/X11/QuTileShp.c deleted file mode 100644 index f713f4248..000000000 --- a/nx-X11/lib/X11/QuTileShp.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XQueryBestTile( - register Display *dpy, - Drawable drawable, - unsigned int width, - unsigned int height, - unsigned int *ret_width, - unsigned int *ret_height) -{ - xQueryBestSizeReply rep; - register xQueryBestSizeReq *req; - - LockDisplay(dpy); - GetReq(QueryBestSize, req); - req->class = TileShape; - req->drawable = drawable; - req->width = width; - req->height = height; - if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(0); - } - - *ret_width = rep.width; - *ret_height = rep.height; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/QuTree.c b/nx-X11/lib/X11/QuTree.c deleted file mode 100644 index 8da2ae261..000000000 --- a/nx-X11/lib/X11/QuTree.c +++ /dev/null @@ -1,72 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Status XQueryTree ( - register Display *dpy, - Window w, - Window *root, /* RETURN */ - Window *parent, /* RETURN */ - Window **children, /* RETURN */ - unsigned int *nchildren) /* RETURN */ -{ - unsigned long nbytes; - xQueryTreeReply rep; - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(QueryTree, w, req); - if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - - *children = (Window *) NULL; - if (rep.nChildren != 0) { - nbytes = rep.nChildren * sizeof(Window); - *children = Xmalloc(nbytes); - if (! *children) { - _XEatDataWords(dpy, rep.length); - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - nbytes = rep.nChildren << 2; - _XRead32 (dpy, (long *) *children, nbytes); - } - *parent = rep.parent; - *root = rep.root; - *nchildren = rep.nChildren; - UnlockDisplay(dpy); - SyncHandle(); - return (1); -} - diff --git a/nx-X11/lib/X11/Quarks.c b/nx-X11/lib/X11/Quarks.c deleted file mode 100644 index 132ec6f67..000000000 --- a/nx-X11/lib/X11/Quarks.c +++ /dev/null @@ -1,408 +0,0 @@ - -/*********************************************************** -Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, - - All Rights Reserved - -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 -supporting documentation, and that the name Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ -/* - -Copyright 1987, 1988, 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "Xresinternal.h" - -/* Not cost effective, at least for vanilla MIT clients */ -/* #define PERMQ */ - -#ifdef PERMQ -typedef unsigned char Bits; -#endif -typedef unsigned long Entry; /* dont confuse with EntryRec from Xintatom.h */ - -static XrmQuark nextQuark = 1; /* next available quark number */ -static unsigned long quarkMask = 0; -static Entry zero = 0; -static Entry *quarkTable = &zero; /* crock */ -static unsigned long quarkRehash; -static XrmString **stringTable = NULL; -#ifdef PERMQ -static Bits **permTable = NULL; -#endif -static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */ - -#define QUANTUMSHIFT 8 -#define QUANTUMMASK ((1 << QUANTUMSHIFT) - 1) -#define CHUNKPER 8 -#define CHUNKMASK ((CHUNKPER << QUANTUMSHIFT) - 1) - -#define LARGEQUARK ((Entry)0x80000000L) -#define QUARKSHIFT 18 -#define QUARKMASK ((LARGEQUARK - 1) >> QUARKSHIFT) -#define XSIGMASK ((1L << QUARKSHIFT) - 1) - -#define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1)) -#ifdef PERMQ -#define QUANTSIZE (STRQUANTSIZE + \ - (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3)) -#else -#define QUANTSIZE STRQUANTSIZE -#endif - -#define HASH(sig) ((sig) & quarkMask) -#define REHASHVAL(sig) ((((sig) % quarkRehash) + 2) | 1) -#define REHASH(idx,rehash) ((idx + rehash) & quarkMask) -#define NAME(q) stringTable[(q) >> QUANTUMSHIFT][(q) & QUANTUMMASK] -#ifdef PERMQ -#define BYTEREF(q) permTable[(q) >> QUANTUMSHIFT][((q) & QUANTUMMASK) >> 3] -#define ISPERM(q) (BYTEREF(q) & (1 << ((q) & 7))) -#define SETPERM(q) BYTEREF(q) |= (1 << ((q) & 7)) -#define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7)) -#endif - -/* Permanent memory allocation */ - -#define WALIGN sizeof(unsigned long) -#define DALIGN sizeof(double) - -#define NEVERFREETABLESIZE ((8192-12) & ~(DALIGN-1)) -static char *neverFreeTable = NULL; -static int neverFreeTableSize = 0; - -static char *permalloc(unsigned int length) -{ - char *ret; - - if (neverFreeTableSize < length) { - if (length >= NEVERFREETABLESIZE) - return Xmalloc(length); - if (! (ret = Xmalloc(NEVERFREETABLESIZE))) - return (char *) NULL; - neverFreeTableSize = NEVERFREETABLESIZE; - neverFreeTable = ret; - } - ret = neverFreeTable; - neverFreeTable += length; - neverFreeTableSize -= length; - return(ret); -} - -typedef struct {char a; double b;} TestType1; -typedef struct {char a; unsigned long b;} TestType2; - -#ifdef XTHREADS -static char *_Xpermalloc(unsigned int length); - -char *Xpermalloc(unsigned int length) -{ - char *p; - - _XLockMutex(_Xglobal_lock); - p = _Xpermalloc(length); - _XUnlockMutex(_Xglobal_lock); - return p; -} -#define Xpermalloc _Xpermalloc - -static -#endif /* XTHREADS */ -char *Xpermalloc(unsigned int length) -{ - int i; - - if (neverFreeTableSize && length < NEVERFREETABLESIZE) { - if ((sizeof(TestType1) != - (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && - !(length & (DALIGN-1)) && - ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (DALIGN-1)))) { - neverFreeTableSize -= DALIGN - i; - neverFreeTable += DALIGN - i; - } else - if ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1))) { - neverFreeTableSize -= WALIGN - i; - neverFreeTable += WALIGN - i; - } - } - return permalloc(length); -} - -static Bool -ExpandQuarkTable(void) -{ - unsigned long oldmask, newmask; - register char c, *s; - register Entry *oldentries, *entries; - register Entry entry; - register int oldidx, newidx, rehash; - Signature sig; - XrmQuark q; - - oldentries = quarkTable; - if ((oldmask = quarkMask)) - newmask = (oldmask << 1) + 1; - else { - if (!stringTable) { - stringTable = Xmalloc(sizeof(XrmString *) * CHUNKPER); - if (!stringTable) - return False; - stringTable[0] = (XrmString *)NULL; - } -#ifdef PERMQ - if (!permTable) - permTable = Xmalloc(sizeof(Bits *) * CHUNKPER); - if (!permTable) - return False; -#endif - stringTable[0] = (XrmString *)Xpermalloc(QUANTSIZE); - if (!stringTable[0]) - return False; -#ifdef PERMQ - permTable[0] = (Bits *)((char *)stringTable[0] + STRQUANTSIZE); -#endif - newmask = 0x1ff; - } - entries = Xcalloc(newmask + 1, sizeof(Entry)); - if (!entries) - return False; - quarkTable = entries; - quarkMask = newmask; - quarkRehash = quarkMask - 2; - for (oldidx = 0; oldidx <= oldmask; oldidx++) { - if ((entry = oldentries[oldidx])) { - if (entry & LARGEQUARK) - q = entry & (LARGEQUARK-1); - else - q = (entry >> QUARKSHIFT) & QUARKMASK; - for (sig = 0, s = NAME(q); (c = *s++); ) - sig = (sig << 1) + c; - newidx = HASH(sig); - if (entries[newidx]) { - rehash = REHASHVAL(sig); - do { - newidx = REHASH(newidx, rehash); - } while (entries[newidx]); - } - entries[newidx] = entry; - } - } - if (oldmask) - Xfree(oldentries); - return True; -} - -XrmQuark -_XrmInternalStringToQuark( - register _Xconst char *name, register int len, register Signature sig, - Bool permstring) -{ - register XrmQuark q; - register Entry entry; - register int idx, rehash; - register int i; - register char *s1, *s2; - char *new; - - rehash = 0; - idx = HASH(sig); - _XLockMutex(_Xglobal_lock); - while ((entry = quarkTable[idx])) { - if (entry & LARGEQUARK) - q = entry & (LARGEQUARK-1); - else { - if ((entry - sig) & XSIGMASK) - goto nomatch; - q = (entry >> QUARKSHIFT) & QUARKMASK; - } - for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) { - if (*s1++ != *s2++) - goto nomatch; - } - if (*s2) { -nomatch: if (!rehash) - rehash = REHASHVAL(sig); - idx = REHASH(idx, rehash); - continue; - } -#ifdef PERMQ - if (permstring && !ISPERM(q)) { - Xfree(NAME(q)); - NAME(q) = (char *)name; - SETPERM(q); - } -#endif - _XUnlockMutex(_Xglobal_lock); - return q; - } - if (nextUniq == nextQuark) - goto fail; - if ((nextQuark + (nextQuark >> 2)) > quarkMask) { - if (!ExpandQuarkTable()) - goto fail; - _XUnlockMutex(_Xglobal_lock); - return _XrmInternalStringToQuark(name, len, sig, permstring); - } - q = nextQuark; - if (!(q & QUANTUMMASK)) { - if (!(q & CHUNKMASK)) { - if (!(new = Xrealloc(stringTable, - sizeof(XrmString *) * - ((q >> QUANTUMSHIFT) + CHUNKPER)))) - goto fail; - stringTable = (XrmString **)new; -#ifdef PERMQ - if (!(new = Xrealloc(permTable, - sizeof(Bits *) * - ((q >> QUANTUMSHIFT) + CHUNKPER)))) - goto fail; - permTable = (Bits **)new; -#endif - } - new = Xpermalloc(QUANTSIZE); - if (!new) - goto fail; - stringTable[q >> QUANTUMSHIFT] = (XrmString *)new; -#ifdef PERMQ - permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE); -#endif - } - if (!permstring) { - s2 = (char *)name; -#ifdef PERMQ - name = Xmalloc(len+1); -#else - name = permalloc(len+1); -#endif - if (!name) - goto fail; - for (i = len, s1 = (char *)name; --i >= 0; ) - *s1++ = *s2++; - *s1++ = '\0'; -#ifdef PERMQ - CLEARPERM(q); - } - else { - SETPERM(q); -#endif - } - NAME(q) = (char *)name; - if (q <= QUARKMASK) - entry = (q << QUARKSHIFT) | (sig & XSIGMASK); - else - entry = q | LARGEQUARK; - quarkTable[idx] = entry; - nextQuark++; - _XUnlockMutex(_Xglobal_lock); - return q; - fail: - _XUnlockMutex(_Xglobal_lock); - return NULLQUARK; -} - -XrmQuark -XrmStringToQuark( - _Xconst char *name) -{ - register char c, *tname; - register Signature sig = 0; - - if (!name) - return (NULLQUARK); - - for (tname = (char *)name; (c = *tname++); ) - sig = (sig << 1) + c; - - return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); -} - -XrmQuark -XrmPermStringToQuark( - _Xconst char *name) -{ - register char c, *tname; - register Signature sig = 0; - - if (!name) - return (NULLQUARK); - - for (tname = (char *)name; (c = *tname++); ) - sig = (sig << 1) + c; - - return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); -} - -XrmQuark XrmUniqueQuark(void) -{ - XrmQuark q; - - _XLockMutex(_Xglobal_lock); - if (nextUniq == nextQuark) - q = NULLQUARK; - else - q = nextUniq--; - _XUnlockMutex(_Xglobal_lock); - return q; -} - -XrmString XrmQuarkToString(register XrmQuark quark) -{ - XrmString s; - - _XLockMutex(_Xglobal_lock); - if (quark <= 0 || quark >= nextQuark) - s = NULLSTRING; - else { -#ifdef PERMQ - /* We have to mark the quark as permanent, since the caller might hold - * onto the string pointer forver. - */ - SETPERM(quark); -#endif - s = NAME(quark); - } - _XUnlockMutex(_Xglobal_lock); - return s; -} diff --git a/nx-X11/lib/X11/RaiseWin.c b/nx-X11/lib/X11/RaiseWin.c deleted file mode 100644 index f431db579..000000000 --- a/nx-X11/lib/X11/RaiseWin.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XRaiseWindow ( - register Display *dpy, - Window w) -{ - register xConfigureWindowReq *req; - unsigned long val = Above; /* needed for macro below */ - - LockDisplay(dpy); - GetReqExtra(ConfigureWindow, 4, req); - req->window = w; - req->mask = CWStackMode; - OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/RdBitF.c b/nx-X11/lib/X11/RdBitF.c deleted file mode 100644 index 319a0ee0b..000000000 --- a/nx-X11/lib/X11/RdBitF.c +++ /dev/null @@ -1,258 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * Code to read bitmaps from disk files. Interprets - * data from X10 and X11 bitmap files and creates - * Pixmap representations of files. Returns Pixmap - * ID and specifics about image. - * - * Modified for speedup by Jim Becker, changed image - * data parsing logic (removed some fscanf()s). - * Aug 5, 1988 - * - * Note that this file and ../Xmu/RdBitF.c look very similar.... Keep them - * that way (but don't use common source code so that people can have one - * without the other). - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "Xutil.h" -#include -#include - - -#define MAX_SIZE 255 - -/* shared data for the image read/parse logic */ -static const short hexTable[256] = { - ['0'] = 0, ['1'] = 1, - ['2'] = 2, ['3'] = 3, - ['4'] = 4, ['5'] = 5, - ['6'] = 6, ['7'] = 7, - ['8'] = 8, ['9'] = 9, - ['A'] = 10, ['B'] = 11, - ['C'] = 12, ['D'] = 13, - ['E'] = 14, ['F'] = 15, - ['a'] = 10, ['b'] = 11, - ['c'] = 12, ['d'] = 13, - ['e'] = 14, ['f'] = 15, - - [' '] = -1, [','] = -1, - ['}'] = -1, ['\n'] = -1, - ['\t'] = -1 -}; - -/* - * read next hex value in the input stream, return -1 if EOF - */ -static int -NextInt ( - FILE *fstream) -{ - int ch; - int value = 0; - int gotone = 0; - int done = 0; - - /* loop, accumulate hex value until find delimiter */ - /* skip any initial delimiters found in read stream */ - - while (!done) { - ch = getc(fstream); - if (ch == EOF) { - value = -1; - done++; - } else { - /* trim high bits, check type and accumulate */ - ch &= 0xff; - if (isascii(ch) && isxdigit(ch)) { - value = (value << 4) + hexTable[ch]; - gotone++; - } else if ((hexTable[ch]) < 0 && gotone) - done++; - } - } - return value; -} - -int -XReadBitmapFileData ( - _Xconst char *filename, - unsigned int *width, /* RETURNED */ - unsigned int *height, /* RETURNED */ - unsigned char **data, /* RETURNED */ - int *x_hot, /* RETURNED */ - int *y_hot) /* RETURNED */ -{ - FILE *fstream; /* handle on file */ - unsigned char *bits = NULL; /* working variable */ - char line[MAX_SIZE]; /* input line from file */ - int size; /* number of bytes of data */ - char name_and_type[MAX_SIZE]; /* an input line */ - char *type; /* for parsing */ - int value; /* from an input line */ - int version10p; /* boolean, old format */ - int padding; /* to handle alignment */ - int bytes_per_line; /* per scanline of data */ - unsigned int ww = 0; /* width */ - unsigned int hh = 0; /* height */ - int hx = -1; /* x hotspot */ - int hy = -1; /* y hotspot */ - - if (!(fstream = fopen(filename, "r"))) - return BitmapOpenFailed; - - /* error cleanup and return macro */ -#define RETURN(code) \ -{ Xfree (bits); fclose (fstream); return code; } - - while (fgets(line, MAX_SIZE, fstream)) { - if (strlen(line) == MAX_SIZE-1) - RETURN (BitmapFileInvalid); - if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) { - if (!(type = strrchr(name_and_type, '_'))) - type = name_and_type; - else - type++; - - if (!strcmp("width", type)) - ww = (unsigned int) value; - if (!strcmp("height", type)) - hh = (unsigned int) value; - if (!strcmp("hot", type)) { - if (type-- == name_and_type || type-- == name_and_type) - continue; - if (!strcmp("x_hot", type)) - hx = value; - if (!strcmp("y_hot", type)) - hy = value; - } - continue; - } - - if (sscanf(line, "static short %s = {", name_and_type) == 1) - version10p = 1; - else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1) - version10p = 0; - else if (sscanf(line, "static char %s = {", name_and_type) == 1) - version10p = 0; - else - continue; - - if (!(type = strrchr(name_and_type, '_'))) - type = name_and_type; - else - type++; - - if (strcmp("bits[]", type)) - continue; - - if (!ww || !hh) - RETURN (BitmapFileInvalid); - - if ((ww % 16) && ((ww % 16) < 9) && version10p) - padding = 1; - else - padding = 0; - - bytes_per_line = (ww+7)/8 + padding; - - size = bytes_per_line * hh; - bits = Xmalloc (size); - if (!bits) - RETURN (BitmapNoMemory); - - if (version10p) { - unsigned char *ptr; - int bytes; - - for (bytes=0, ptr=bits; bytes> 8; - } - } else { - unsigned char *ptr; - int bytes; - - for (bytes=0, ptr=bits; bytes -#endif -#include "Xlibint.h" - -int -XRecolorCursor( - register Display *dpy, - Cursor cursor, - XColor *foreground, - XColor *background) -{ - register xRecolorCursorReq *req; - - LockDisplay(dpy); - GetReq(RecolorCursor, req); - req->cursor = cursor; - req->foreRed = foreground->red; - req->foreGreen = foreground->green; - req->foreBlue = foreground->blue; - req->backRed = background->red; - req->backGreen = background->green; - req->backBlue = background->blue; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/ReconfWM.c b/nx-X11/lib/X11/ReconfWM.c deleted file mode 100644 index b3d8624cf..000000000 --- a/nx-X11/lib/X11/ReconfWM.c +++ /dev/null @@ -1,142 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ - CWBorderWidth|CWSibling|CWStackMode) - -Status XReconfigureWMWindow ( - register Display *dpy, - Window w, - int screen, - unsigned int mask, - XWindowChanges *changes) -{ - Window root = RootWindow (dpy, screen); - _XAsyncHandler async; - _XAsyncErrorState async_state; - - /* - * Only need to go through the trouble if we are actually changing the - * stacking mode. - */ - if (!(mask & CWStackMode)) { - XConfigureWindow (dpy, w, mask, changes); - return True; - } - - - /* - * We need to inline XConfigureWindow and XSync so that everything is done - * while the display is locked. - */ - - LockDisplay(dpy); - - /* - * XConfigureWindow (dpy, w, mask, changes); - */ - { - unsigned long values[7]; - register unsigned long *value = values; - long nvalues; - register xConfigureWindowReq *req; - - GetReq(ConfigureWindow, req); - - async_state.min_sequence_number = dpy->request; - async_state.max_sequence_number = dpy->request; - async_state.error_code = BadMatch; - async_state.major_opcode = X_ConfigureWindow; - async_state.minor_opcode = 0; - async_state.error_count = 0; - async.next = dpy->async_handlers; - async.handler = _XAsyncErrorHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - - req->window = w; - mask &= AllMaskBits; - req->mask = mask; - - if (mask & CWX) *value++ = changes->x; - if (mask & CWY) *value++ = changes->y; - if (mask & CWWidth) *value++ = changes->width; - if (mask & CWHeight) *value++ = changes->height; - if (mask & CWBorderWidth) *value++ = changes->border_width; - if (mask & CWSibling) *value++ = changes->sibling; - if (mask & CWStackMode) *value++ = changes->stack_mode; - req->length += (nvalues = value - values); - nvalues <<= 2; /* watch out for macros... */ - Data32 (dpy, (long *) values, nvalues); - } - - /* - * XSync (dpy, 0) - */ - { - xGetInputFocusReply rep; - _X_UNUSED register xReq *req; - - GetEmptyReq(GetInputFocus, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - } - - DeqAsyncHandler(dpy, &async); - UnlockDisplay(dpy); - SyncHandle(); - - - /* - * If the request succeeded, then everything is okay; otherwise, send event - */ - if (!async_state.error_count) - return True; - else { - XConfigureRequestEvent ev = { - .type = ConfigureRequest, - .window = w, - .parent = root, - .value_mask = (mask & AllMaskBits), - .x = changes->x, - .y = changes->y, - .width = changes->width, - .height = changes->height, - .border_width = changes->border_width, - .above = changes->sibling, - .detail = changes->stack_mode, - }; - return (XSendEvent (dpy, root, False, - SubstructureRedirectMask|SubstructureNotifyMask, - (XEvent *)&ev)); - } -} diff --git a/nx-X11/lib/X11/ReconfWin.c b/nx-X11/lib/X11/ReconfWin.c deleted file mode 100644 index bfa99f528..000000000 --- a/nx-X11/lib/X11/ReconfWin.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ - CWBorderWidth|CWSibling|CWStackMode) - -int -XConfigureWindow( - register Display *dpy, - Window w, - unsigned int mask, - XWindowChanges *changes) -{ - unsigned long values[7]; - register unsigned long *value = values; - long nvalues; - register xConfigureWindowReq *req; - - LockDisplay(dpy); - GetReq(ConfigureWindow, req); - req->window = w; - mask &= AllMaskBits; - req->mask = mask; - - if (mask & CWX) - *value++ = changes->x; - - if (mask & CWY) - *value++ = changes->y; - - if (mask & CWWidth) - *value++ = changes->width; - - if (mask & CWHeight) - *value++ = changes->height; - - if (mask & CWBorderWidth) - *value++ = changes->border_width; - - if (mask & CWSibling) - *value++ = changes->sibling; - - if (mask & CWStackMode) - *value++ = changes->stack_mode; - - req->length += (nvalues = value - values); - - nvalues <<= 2; /* watch out for macros... */ - Data32 (dpy, (long *) values, nvalues); - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } diff --git a/nx-X11/lib/X11/Region.c b/nx-X11/lib/X11/Region.c deleted file mode 100644 index 28fa3e416..000000000 --- a/nx-X11/lib/X11/Region.c +++ /dev/null @@ -1,1605 +0,0 @@ -/************************************************************************ - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -************************************************************************/ -/* - * The functions in this file implement the Region abstraction, similar to one - * used in the X11 sample server. A Region is simply an area, as the name - * implies, and is implemented as a "y-x-banded" array of rectangles. To - * explain: Each Region is made up of a certain number of rectangles sorted - * by y coordinate first, and then by x coordinate. - * - * Furthermore, the rectangles are banded such that every rectangle with a - * given upper-left y coordinate (y1) will have the same lower-right y - * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it - * will span the entire vertical distance of the band. This means that some - * areas that could be merged into a taller rectangle will be represented as - * several shorter rectangles to account for shorter rectangles to its left - * or right but within its "vertical scope". - * - * An added constraint on the rectangles is that they must cover as much - * horizontal area as possible. E.g. no two rectangles in a band are allowed - * to touch. - * - * Whenever possible, bands will be merged together to cover a greater vertical - * distance (and thus reduce the number of rectangles). Two bands can be merged - * only if the bottom of one touches the top of the other and they have - * rectangles in the same places (of the same width, of course). This maintains - * the y-x-banding that's so nice to have... - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" -#include -#include "poly.h" - -#ifdef DEBUG -#include -#define assert(expr) {if (!(expr)) fprintf(stderr,\ -"Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); } -#else -#define assert(expr) -#endif - -typedef int (*overlapProcp)( - register Region pReg, - register BoxPtr r1, - BoxPtr r1End, - register BoxPtr r2, - BoxPtr r2End, - short y1, - short y2); - -typedef int (*nonOverlapProcp)( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2); - -static void miRegionOp( - register Region newReg, /* Place to store result */ - Region reg1, /* First region in operation */ - Region reg2, /* 2d region in operation */ - int (*overlapFunc)( - register Region pReg, - register BoxPtr r1, - BoxPtr r1End, - register BoxPtr r2, - BoxPtr r2End, - short y1, - short y2), /* Function to call for over- - * lapping bands */ - int (*nonOverlap1Func)( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2), /* Function to call for non- - * overlapping bands in region - * 1 */ - int (*nonOverlap2Func)( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2)); /* Function to call for non- - * overlapping bands in region - * 2 */ - - -/* Create a new empty region */ -Region -XCreateRegion(void) -{ - Region temp; - - if (! (temp = Xmalloc(sizeof( REGION )))) - return (Region) NULL; - if (! (temp->rects = Xmalloc(sizeof( BOX )))) { - Xfree(temp); - return (Region) NULL; - } - temp->numRects = 0; - temp->extents.x1 = 0; - temp->extents.y1 = 0; - temp->extents.x2 = 0; - temp->extents.y2 = 0; - temp->size = 1; - return( temp ); -} - -int -XClipBox( - Region r, - XRectangle *rect) -{ - rect->x = r->extents.x1; - rect->y = r->extents.y1; - rect->width = r->extents.x2 - r->extents.x1; - rect->height = r->extents.y2 - r->extents.y1; - return 1; -} - -int -XUnionRectWithRegion( - register XRectangle *rect, - Region source, Region dest) -{ - REGION region; - - if (!rect->width || !rect->height) - return 0; - region.rects = ®ion.extents; - region.numRects = 1; - region.extents.x1 = rect->x; - region.extents.y1 = rect->y; - region.extents.x2 = rect->x + rect->width; - region.extents.y2 = rect->y + rect->height; - region.size = 1; - - return XUnionRegion(®ion, source, dest); -} - -/*- - *----------------------------------------------------------------------- - * miSetExtents -- - * Reset the extents of a region to what they should be. Called by - * miSubtract and miIntersect b/c they can't figure it out along the - * way or do so easily, as miUnion can. - * - * Results: - * None. - * - * Side Effects: - * The region's 'extents' structure is overwritten. - * - *----------------------------------------------------------------------- - */ -static void -miSetExtents ( - Region pReg) -{ - register BoxPtr pBox, - pBoxEnd, - pExtents; - - if (pReg->numRects == 0) - { - pReg->extents.x1 = 0; - pReg->extents.y1 = 0; - pReg->extents.x2 = 0; - pReg->extents.y2 = 0; - return; - } - - pExtents = &pReg->extents; - pBox = pReg->rects; - pBoxEnd = &pBox[pReg->numRects - 1]; - - /* - * Since pBox is the first rectangle in the region, it must have the - * smallest y1 and since pBoxEnd is the last rectangle in the region, - * it must have the largest y2, because of banding. Initialize x1 and - * x2 from pBox and pBoxEnd, resp., as good things to initialize them - * to... - */ - pExtents->x1 = pBox->x1; - pExtents->y1 = pBox->y1; - pExtents->x2 = pBoxEnd->x2; - pExtents->y2 = pBoxEnd->y2; - - assert(pExtents->y1 < pExtents->y2); - while (pBox <= pBoxEnd) - { - if (pBox->x1 < pExtents->x1) - { - pExtents->x1 = pBox->x1; - } - if (pBox->x2 > pExtents->x2) - { - pExtents->x2 = pBox->x2; - } - pBox++; - } - assert(pExtents->x1 < pExtents->x2); -} - -int -XSetRegion( - Display *dpy, - GC gc, - register Region r) -{ - register int i; - register XRectangle *xr, *pr; - register BOX *pb; - unsigned long total; - - LockDisplay (dpy); - total = r->numRects * sizeof (XRectangle); - if ((xr = (XRectangle *) _XAllocTemp(dpy, total))) { - for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) { - pr->x = pb->x1; - pr->y = pb->y1; - pr->width = pb->x2 - pb->x1; - pr->height = pb->y2 - pb->y1; - } - } - if (xr || !r->numRects) - _XSetClipRectangles(dpy, gc, 0, 0, xr, r->numRects, YXBanded); - if (xr) - _XFreeTemp(dpy, (char *)xr, total); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - -int -XDestroyRegion( - Region r) -{ - Xfree( (char *) r->rects ); - Xfree( (char *) r ); - return 1; -} - - -/* TranslateRegion(pRegion, x, y) - translates in place - added by raymond -*/ - -int -XOffsetRegion( - register Region pRegion, - register int x, - register int y) -{ - register int nbox; - register BOX *pbox; - - pbox = pRegion->rects; - nbox = pRegion->numRects; - - while(nbox--) - { - pbox->x1 += x; - pbox->x2 += x; - pbox->y1 += y; - pbox->y2 += y; - pbox++; - } - pRegion->extents.x1 += x; - pRegion->extents.x2 += x; - pRegion->extents.y1 += y; - pRegion->extents.y2 += y; - return 1; -} - -/* - Utility procedure Compress: - Replace r by the region r', where - p in r' iff (Quantifer m <= dx) (p + m in r), and - Quantifier is Exists if grow is TRUE, For all if grow is FALSE, and - (x,y) + m = (x+m,y) if xdir is TRUE; (x,y+m) if xdir is FALSE. - - Thus, if xdir is TRUE and grow is FALSE, r is replaced by the region - of all points p such that p and the next dx points on the same - horizontal scan line are all in r. We do this using by noting - that p is the head of a run of length 2^i + k iff p is the head - of a run of length 2^i and p+2^i is the head of a run of length - k. Thus, the loop invariant: s contains the region corresponding - to the runs of length shift. r contains the region corresponding - to the runs of length 1 + dxo & (shift-1), where dxo is the original - value of dx. dx = dxo & ~(shift-1). As parameters, s and t are - scratch regions, so that we don't have to allocate them on every - call. -*/ - -#define ZOpRegion(a,b,c) if (grow) XUnionRegion(a,b,c); \ - else XIntersectRegion(a,b,c) -#define ZShiftRegion(a,b) if (xdir) XOffsetRegion(a,b,0); \ - else XOffsetRegion(a,0,b) -#define ZCopyRegion(a,b) XUnionRegion(a,a,b) - -static void -Compress( - Region r, Region s, Region t, - register unsigned dx, - register int xdir, register int grow) -{ - register unsigned shift = 1; - - ZCopyRegion(r, s); - while (dx) { - if (dx & shift) { - ZShiftRegion(r, -(int)shift); - ZOpRegion(r, s, r); - dx -= shift; - if (!dx) break; - } - ZCopyRegion(s, t); - ZShiftRegion(s, -(int)shift); - ZOpRegion(s, t, s); - shift <<= 1; - } -} - -#undef ZOpRegion -#undef ZShiftRegion -#undef ZCopyRegion - -int -XShrinkRegion( - Region r, - int dx, int dy) -{ - Region s, t; - int grow; - - if (!dx && !dy) return 0; - if (! (s = XCreateRegion()) ) - return 0; - if (! (t = XCreateRegion()) ) { - XDestroyRegion(s); - return 0; - } - if ((grow = (dx < 0))) dx = -dx; - if (dx) Compress(r, s, t, (unsigned) 2*dx, TRUE, grow); - if ((grow = (dy < 0))) dy = -dy; - if (dy) Compress(r, s, t, (unsigned) 2*dy, FALSE, grow); - XOffsetRegion(r, dx, dy); - XDestroyRegion(s); - XDestroyRegion(t); - return 0; -} - - -/*====================================================================== - * Region Intersection - *====================================================================*/ -/*- - *----------------------------------------------------------------------- - * miIntersectO -- - * Handle an overlapping band for miIntersect. - * - * Results: - * None. - * - * Side Effects: - * Rectangles may be added to the region. - * - *----------------------------------------------------------------------- - */ -/* static void*/ -static int -miIntersectO ( - register Region pReg, - register BoxPtr r1, - BoxPtr r1End, - register BoxPtr r2, - BoxPtr r2End, - short y1, - short y2) -{ - register short x1; - register short x2; - register BoxPtr pNextRect; - - pNextRect = &pReg->rects[pReg->numRects]; - - while ((r1 != r1End) && (r2 != r2End)) - { - x1 = max(r1->x1,r2->x1); - x2 = min(r1->x2,r2->x2); - - /* - * If there's any overlap between the two rectangles, add that - * overlap to the new region. - * There's no need to check for subsumption because the only way - * such a need could arise is if some region has two rectangles - * right next to each other. Since that should never happen... - */ - if (x1 < x2) - { - assert(y1rects); - pNextRect->x1 = x1; - pNextRect->y1 = y1; - pNextRect->x2 = x2; - pNextRect->y2 = y2; - pReg->numRects += 1; - pNextRect++; - assert(pReg->numRects <= pReg->size); - } - - /* - * Need to advance the pointers. Shift the one that extends - * to the right the least, since the other still has a chance to - * overlap with that region's next rectangle, if you see what I mean. - */ - if (r1->x2 < r2->x2) - { - r1++; - } - else if (r2->x2 < r1->x2) - { - r2++; - } - else - { - r1++; - r2++; - } - } - return 0; /* lint */ -} - -int -XIntersectRegion( - Region reg1, - Region reg2, /* source regions */ - register Region newReg) /* destination Region */ -{ - /* check for trivial reject */ - if ( (!(reg1->numRects)) || (!(reg2->numRects)) || - (!EXTENTCHECK(®1->extents, ®2->extents))) - newReg->numRects = 0; - else - miRegionOp (newReg, reg1, reg2, - miIntersectO, NULL, NULL); - - /* - * Can't alter newReg's extents before we call miRegionOp because - * it might be one of the source regions and miRegionOp depends - * on the extents of those regions being the same. Besides, this - * way there's no checking against rectangles that will be nuked - * due to coalescing, so we have to examine fewer rectangles. - */ - miSetExtents(newReg); - return 1; -} - -static int -miRegionCopy( - register Region dstrgn, - register Region rgn) - -{ - if (dstrgn != rgn) /* don't want to copy to itself */ - { - if (dstrgn->size < rgn->numRects) - { - if (dstrgn->rects) - { - BOX *prevRects = dstrgn->rects; - - dstrgn->rects = Xrealloc(dstrgn->rects, - rgn->numRects * (sizeof(BOX))); - if (! dstrgn->rects) { - Xfree(prevRects); - dstrgn->size = 0; - return 0; - } - } - dstrgn->size = rgn->numRects; - } - dstrgn->numRects = rgn->numRects; - dstrgn->extents.x1 = rgn->extents.x1; - dstrgn->extents.y1 = rgn->extents.y1; - dstrgn->extents.x2 = rgn->extents.x2; - dstrgn->extents.y2 = rgn->extents.y2; - - memcpy((char *) dstrgn->rects, (char *) rgn->rects, - (int) (rgn->numRects * sizeof(BOX))); - } - return 1; -} - -/*====================================================================== - * Generic Region Operator - *====================================================================*/ - -/*- - *----------------------------------------------------------------------- - * miCoalesce -- - * Attempt to merge the boxes in the current band with those in the - * previous one. Used only by miRegionOp. - * - * Results: - * The new index for the previous band. - * - * Side Effects: - * If coalescing takes place: - * - rectangles in the previous band will have their y2 fields - * altered. - * - pReg->numRects will be decreased. - * - *----------------------------------------------------------------------- - */ -/* static int*/ -static int -miCoalesce( - register Region pReg, /* Region to coalesce */ - int prevStart, /* Index of start of previous band */ - int curStart) /* Index of start of current band */ -{ - register BoxPtr pPrevBox; /* Current box in previous band */ - register BoxPtr pCurBox; /* Current box in current band */ - register BoxPtr pRegEnd; /* End of region */ - int curNumRects; /* Number of rectangles in current - * band */ - int prevNumRects; /* Number of rectangles in previous - * band */ - int bandY1; /* Y1 coordinate for current band */ - - pRegEnd = &pReg->rects[pReg->numRects]; - - pPrevBox = &pReg->rects[prevStart]; - prevNumRects = curStart - prevStart; - - /* - * Figure out how many rectangles are in the current band. Have to do - * this because multiple bands could have been added in miRegionOp - * at the end when one region has been exhausted. - */ - pCurBox = &pReg->rects[curStart]; - bandY1 = pCurBox->y1; - for (curNumRects = 0; - (pCurBox != pRegEnd) && (pCurBox->y1 == bandY1); - curNumRects++) - { - pCurBox++; - } - - if (pCurBox != pRegEnd) - { - /* - * If more than one band was added, we have to find the start - * of the last band added so the next coalescing job can start - * at the right place... (given when multiple bands are added, - * this may be pointless -- see above). - */ - pRegEnd--; - while (pRegEnd[-1].y1 == pRegEnd->y1) - { - pRegEnd--; - } - curStart = pRegEnd - pReg->rects; - pRegEnd = pReg->rects + pReg->numRects; - } - - if ((curNumRects == prevNumRects) && (curNumRects != 0)) { - pCurBox -= curNumRects; - /* - * The bands may only be coalesced if the bottom of the previous - * matches the top scanline of the current. - */ - if (pPrevBox->y2 == pCurBox->y1) - { - /* - * Make sure the bands have boxes in the same places. This - * assumes that boxes have been added in such a way that they - * cover the most area possible. I.e. two boxes in a band must - * have some horizontal space between them. - */ - do - { - if ((pPrevBox->x1 != pCurBox->x1) || - (pPrevBox->x2 != pCurBox->x2)) - { - /* - * The bands don't line up so they can't be coalesced. - */ - return (curStart); - } - pPrevBox++; - pCurBox++; - prevNumRects -= 1; - } while (prevNumRects != 0); - - pReg->numRects -= curNumRects; - pCurBox -= curNumRects; - pPrevBox -= curNumRects; - - /* - * The bands may be merged, so set the bottom y of each box - * in the previous band to that of the corresponding box in - * the current band. - */ - do - { - pPrevBox->y2 = pCurBox->y2; - pPrevBox++; - pCurBox++; - curNumRects -= 1; - } while (curNumRects != 0); - - /* - * If only one band was added to the region, we have to backup - * curStart to the start of the previous band. - * - * If more than one band was added to the region, copy the - * other bands down. The assumption here is that the other bands - * came from the same region as the current one and no further - * coalescing can be done on them since it's all been done - * already... curStart is already in the right place. - */ - if (pCurBox == pRegEnd) - { - curStart = prevStart; - } - else - { - do - { - *pPrevBox++ = *pCurBox++; - } while (pCurBox != pRegEnd); - } - - } - } - return (curStart); -} - -/*- - *----------------------------------------------------------------------- - * miRegionOp -- - * Apply an operation to two regions. Called by miUnion, miInverse, - * miSubtract, miIntersect... - * - * Results: - * None. - * - * Side Effects: - * The new region is overwritten. - * - * Notes: - * The idea behind this function is to view the two regions as sets. - * Together they cover a rectangle of area that this function divides - * into horizontal bands where points are covered only by one region - * or by both. For the first case, the nonOverlapFunc is called with - * each the band and the band's upper and lower extents. For the - * second, the overlapFunc is called to process the entire band. It - * is responsible for clipping the rectangles in the band, though - * this function provides the boundaries. - * At the end of each band, the new region is coalesced, if possible, - * to reduce the number of rectangles in the region. - * - *----------------------------------------------------------------------- - */ -/* static void*/ -static void -miRegionOp( - register Region newReg, /* Place to store result */ - Region reg1, /* First region in operation */ - Region reg2, /* 2d region in operation */ - int (*overlapFunc)( - register Region pReg, - register BoxPtr r1, - BoxPtr r1End, - register BoxPtr r2, - BoxPtr r2End, - short y1, - short y2), /* Function to call for over- - * lapping bands */ - int (*nonOverlap1Func)( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2), /* Function to call for non- - * overlapping bands in region - * 1 */ - int (*nonOverlap2Func)( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2)) /* Function to call for non- - * overlapping bands in region - * 2 */ -{ - register BoxPtr r1; /* Pointer into first region */ - register BoxPtr r2; /* Pointer into 2d region */ - BoxPtr r1End; /* End of 1st region */ - BoxPtr r2End; /* End of 2d region */ - register short ybot; /* Bottom of intersection */ - register short ytop; /* Top of intersection */ - BoxPtr oldRects; /* Old rects for newReg */ - int prevBand; /* Index of start of - * previous band in newReg */ - int curBand; /* Index of start of current - * band in newReg */ - register BoxPtr r1BandEnd; /* End of current band in r1 */ - register BoxPtr r2BandEnd; /* End of current band in r2 */ - short top; /* Top of non-overlapping - * band */ - short bot; /* Bottom of non-overlapping - * band */ - - /* - * Initialization: - * set r1, r2, r1End and r2End appropriately, preserve the important - * parts of the destination region until the end in case it's one of - * the two source regions, then mark the "new" region empty, allocating - * another array of rectangles for it to use. - */ - r1 = reg1->rects; - r2 = reg2->rects; - r1End = r1 + reg1->numRects; - r2End = r2 + reg2->numRects; - - oldRects = newReg->rects; - - EMPTY_REGION(newReg); - - /* - * Allocate a reasonable number of rectangles for the new region. The idea - * is to allocate enough so the individual functions don't need to - * reallocate and copy the array, which is time consuming, yet we don't - * have to worry about using too much memory. I hope to be able to - * nuke the Xrealloc() at the end of this function eventually. - */ - newReg->size = max(reg1->numRects,reg2->numRects) * 2; - - if (! (newReg->rects = Xmalloc (sizeof(BoxRec) * newReg->size))) { - newReg->size = 0; - return; - } - - /* - * Initialize ybot and ytop. - * In the upcoming loop, ybot and ytop serve different functions depending - * on whether the band being handled is an overlapping or non-overlapping - * band. - * In the case of a non-overlapping band (only one of the regions - * has points in the band), ybot is the bottom of the most recent - * intersection and thus clips the top of the rectangles in that band. - * ytop is the top of the next intersection between the two regions and - * serves to clip the bottom of the rectangles in the current band. - * For an overlapping band (where the two regions intersect), ytop clips - * the top of the rectangles of both regions and ybot clips the bottoms. - */ - if (reg1->extents.y1 < reg2->extents.y1) - ybot = reg1->extents.y1; - else - ybot = reg2->extents.y1; - - /* - * prevBand serves to mark the start of the previous band so rectangles - * can be coalesced into larger rectangles. qv. miCoalesce, above. - * In the beginning, there is no previous band, so prevBand == curBand - * (curBand is set later on, of course, but the first band will always - * start at index 0). prevBand and curBand must be indices because of - * the possible expansion, and resultant moving, of the new region's - * array of rectangles. - */ - prevBand = 0; - - do - { - curBand = newReg->numRects; - - /* - * This algorithm proceeds one source-band (as opposed to a - * destination band, which is determined by where the two regions - * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the - * rectangle after the last one in the current band for their - * respective regions. - */ - r1BandEnd = r1; - while ((r1BandEnd != r1End) && (r1BandEnd->y1 == r1->y1)) - { - r1BandEnd++; - } - - r2BandEnd = r2; - while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1)) - { - r2BandEnd++; - } - - /* - * First handle the band that doesn't intersect, if any. - * - * Note that attention is restricted to one band in the - * non-intersecting region at once, so if a region has n - * bands between the current position and the next place it overlaps - * the other, this entire loop will be passed through n times. - */ - if (r1->y1 < r2->y1) - { - top = max(r1->y1,ybot); - bot = min(r1->y2,r2->y1); - - if ((top != bot) && (nonOverlap1Func != NULL)) - { - (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot); - } - - ytop = r2->y1; - } - else if (r2->y1 < r1->y1) - { - top = max(r2->y1,ybot); - bot = min(r2->y2,r1->y1); - - if ((top != bot) && (nonOverlap2Func != NULL)) - { - (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot); - } - - ytop = r1->y1; - } - else - { - ytop = r1->y1; - } - - /* - * If any rectangles got added to the region, try and coalesce them - * with rectangles from the previous band. Note we could just do - * this test in miCoalesce, but some machines incur a not - * inconsiderable cost for function calls, so... - */ - if (newReg->numRects != curBand) - { - prevBand = miCoalesce (newReg, prevBand, curBand); - } - - /* - * Now see if we've hit an intersecting band. The two bands only - * intersect if ybot > ytop - */ - ybot = min(r1->y2, r2->y2); - curBand = newReg->numRects; - if (ybot > ytop) - { - (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot); - - } - - if (newReg->numRects != curBand) - { - prevBand = miCoalesce (newReg, prevBand, curBand); - } - - /* - * If we've finished with a band (y2 == ybot) we skip forward - * in the region to the next band. - */ - if (r1->y2 == ybot) - { - r1 = r1BandEnd; - } - if (r2->y2 == ybot) - { - r2 = r2BandEnd; - } - } while ((r1 != r1End) && (r2 != r2End)); - - /* - * Deal with whichever region still has rectangles left. - */ - curBand = newReg->numRects; - if (r1 != r1End) - { - if (nonOverlap1Func != NULL) - { - do - { - r1BandEnd = r1; - while ((r1BandEnd < r1End) && (r1BandEnd->y1 == r1->y1)) - { - r1BandEnd++; - } - (* nonOverlap1Func) (newReg, r1, r1BandEnd, - max(r1->y1,ybot), r1->y2); - r1 = r1BandEnd; - } while (r1 != r1End); - } - } - else if ((r2 != r2End) && (nonOverlap2Func != NULL)) - { - do - { - r2BandEnd = r2; - while ((r2BandEnd < r2End) && (r2BandEnd->y1 == r2->y1)) - { - r2BandEnd++; - } - (* nonOverlap2Func) (newReg, r2, r2BandEnd, - max(r2->y1,ybot), r2->y2); - r2 = r2BandEnd; - } while (r2 != r2End); - } - - if (newReg->numRects != curBand) - { - (void) miCoalesce (newReg, prevBand, curBand); - } - - /* - * A bit of cleanup. To keep regions from growing without bound, - * we shrink the array of rectangles to match the new number of - * rectangles in the region. This never goes to 0, however... - * - * Only do this stuff if the number of rectangles allocated is more than - * twice the number of rectangles in the region (a simple optimization...). - */ - if (newReg->numRects < (newReg->size >> 1)) - { - if (REGION_NOT_EMPTY(newReg)) - { - BoxPtr prev_rects = newReg->rects; - newReg->rects = Xrealloc (newReg->rects, - sizeof(BoxRec) * newReg->numRects); - if (! newReg->rects) - newReg->rects = prev_rects; - else - newReg->size = newReg->numRects; - } - else - { - /* - * No point in doing the extra work involved in an Xrealloc if - * the region is empty - */ - newReg->size = 1; - Xfree(newReg->rects); - newReg->rects = Xmalloc(sizeof(BoxRec)); - } - } - Xfree (oldRects); - return; -} - - -/*====================================================================== - * Region Union - *====================================================================*/ - -/*- - *----------------------------------------------------------------------- - * miUnionNonO -- - * Handle a non-overlapping band for the union operation. Just - * Adds the rectangles into the region. Doesn't have to check for - * subsumption or anything. - * - * Results: - * None. - * - * Side Effects: - * pReg->numRects is incremented and the final rectangles overwritten - * with the rectangles we're passed. - * - *----------------------------------------------------------------------- - */ -/* static void*/ -static int -miUnionNonO ( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2) -{ - register BoxPtr pNextRect; - - pNextRect = &pReg->rects[pReg->numRects]; - - assert(y1 < y2); - - while (r != rEnd) - { - assert(r->x1 < r->x2); - MEMCHECK(pReg, pNextRect, pReg->rects); - pNextRect->x1 = r->x1; - pNextRect->y1 = y1; - pNextRect->x2 = r->x2; - pNextRect->y2 = y2; - pReg->numRects += 1; - pNextRect++; - - assert(pReg->numRects<=pReg->size); - r++; - } - return 0; /* lint */ -} - - -/*- - *----------------------------------------------------------------------- - * miUnionO -- - * Handle an overlapping band for the union operation. Picks the - * left-most rectangle each time and merges it into the region. - * - * Results: - * None. - * - * Side Effects: - * Rectangles are overwritten in pReg->rects and pReg->numRects will - * be changed. - * - *----------------------------------------------------------------------- - */ - -/* static void*/ -static int -miUnionO ( - register Region pReg, - register BoxPtr r1, - BoxPtr r1End, - register BoxPtr r2, - BoxPtr r2End, - register short y1, - register short y2) -{ - register BoxPtr pNextRect; - - pNextRect = &pReg->rects[pReg->numRects]; - -#define MERGERECT(r) \ - if ((pReg->numRects != 0) && \ - (pNextRect[-1].y1 == y1) && \ - (pNextRect[-1].y2 == y2) && \ - (pNextRect[-1].x2 >= r->x1)) \ - { \ - if (pNextRect[-1].x2 < r->x2) \ - { \ - pNextRect[-1].x2 = r->x2; \ - assert(pNextRect[-1].x1rects); \ - pNextRect->y1 = y1; \ - pNextRect->y2 = y2; \ - pNextRect->x1 = r->x1; \ - pNextRect->x2 = r->x2; \ - pReg->numRects += 1; \ - pNextRect += 1; \ - } \ - assert(pReg->numRects<=pReg->size);\ - r++; - - assert (y1x1 < r2->x1) - { - MERGERECT(r1); - } - else - { - MERGERECT(r2); - } - } - - if (r1 != r1End) - { - do - { - MERGERECT(r1); - } while (r1 != r1End); - } - else while (r2 != r2End) - { - MERGERECT(r2); - } - return 0; /* lint */ -} - -int -XUnionRegion( - Region reg1, - Region reg2, /* source regions */ - Region newReg) /* destination Region */ -{ - /* checks all the simple cases */ - - /* - * Region 1 and 2 are the same or region 1 is empty - */ - if ( (reg1 == reg2) || (!(reg1->numRects)) ) - { - if (newReg != reg2) - return miRegionCopy(newReg, reg2); - return 1; - } - - /* - * if nothing to union (region 2 empty) - */ - if (!(reg2->numRects)) - { - if (newReg != reg1) - return miRegionCopy(newReg, reg1); - return 1; - } - - /* - * Region 1 completely subsumes region 2 - */ - if ((reg1->numRects == 1) && - (reg1->extents.x1 <= reg2->extents.x1) && - (reg1->extents.y1 <= reg2->extents.y1) && - (reg1->extents.x2 >= reg2->extents.x2) && - (reg1->extents.y2 >= reg2->extents.y2)) - { - if (newReg != reg1) - return miRegionCopy(newReg, reg1); - return 1; - } - - /* - * Region 2 completely subsumes region 1 - */ - if ((reg2->numRects == 1) && - (reg2->extents.x1 <= reg1->extents.x1) && - (reg2->extents.y1 <= reg1->extents.y1) && - (reg2->extents.x2 >= reg1->extents.x2) && - (reg2->extents.y2 >= reg1->extents.y2)) - { - if (newReg != reg2) - return miRegionCopy(newReg, reg2); - return 1; - } - - miRegionOp (newReg, reg1, reg2, miUnionO, - miUnionNonO, miUnionNonO); - - newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1); - newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1); - newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2); - newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2); - - return 1; -} - - -/*====================================================================== - * Region Subtraction - *====================================================================*/ - -/*- - *----------------------------------------------------------------------- - * miSubtractNonO -- - * Deal with non-overlapping band for subtraction. Any parts from - * region 2 we discard. Anything from region 1 we add to the region. - * - * Results: - * None. - * - * Side Effects: - * pReg may be affected. - * - *----------------------------------------------------------------------- - */ -/* static void*/ -static int -miSubtractNonO1 ( - register Region pReg, - register BoxPtr r, - BoxPtr rEnd, - register short y1, - register short y2) -{ - register BoxPtr pNextRect; - - pNextRect = &pReg->rects[pReg->numRects]; - - assert(y1x1x2); - MEMCHECK(pReg, pNextRect, pReg->rects); - pNextRect->x1 = r->x1; - pNextRect->y1 = y1; - pNextRect->x2 = r->x2; - pNextRect->y2 = y2; - pReg->numRects += 1; - pNextRect++; - - assert(pReg->numRects <= pReg->size); - - r++; - } - return 0; /* lint */ -} - -/*- - *----------------------------------------------------------------------- - * miSubtractO -- - * Overlapping band subtraction. x1 is the left-most point not yet - * checked. - * - * Results: - * None. - * - * Side Effects: - * pReg may have rectangles added to it. - * - *----------------------------------------------------------------------- - */ -/* static void*/ -static int -miSubtractO ( - register Region pReg, - register BoxPtr r1, - BoxPtr r1End, - register BoxPtr r2, - BoxPtr r2End, - register short y1, - register short y2) -{ - register BoxPtr pNextRect; - register int x1; - - x1 = r1->x1; - - assert(y1rects[pReg->numRects]; - - while ((r1 != r1End) && (r2 != r2End)) - { - if (r2->x2 <= x1) - { - /* - * Subtrahend missed the boat: go to next subtrahend. - */ - r2++; - } - else if (r2->x1 <= x1) - { - /* - * Subtrahend preceeds minuend: nuke left edge of minuend. - */ - x1 = r2->x2; - if (x1 >= r1->x2) - { - /* - * Minuend completely covered: advance to next minuend and - * reset left fence to edge of new minuend. - */ - r1++; - if (r1 != r1End) - x1 = r1->x1; - } - else - { - /* - * Subtrahend now used up since it doesn't extend beyond - * minuend - */ - r2++; - } - } - else if (r2->x1 < r1->x2) - { - /* - * Left part of subtrahend covers part of minuend: add uncovered - * part of minuend to region and skip to next subtrahend. - */ - assert(x1x1); - MEMCHECK(pReg, pNextRect, pReg->rects); - pNextRect->x1 = x1; - pNextRect->y1 = y1; - pNextRect->x2 = r2->x1; - pNextRect->y2 = y2; - pReg->numRects += 1; - pNextRect++; - - assert(pReg->numRects<=pReg->size); - - x1 = r2->x2; - if (x1 >= r1->x2) - { - /* - * Minuend used up: advance to new... - */ - r1++; - if (r1 != r1End) - x1 = r1->x1; - } - else - { - /* - * Subtrahend used up - */ - r2++; - } - } - else - { - /* - * Minuend used up: add any remaining piece before advancing. - */ - if (r1->x2 > x1) - { - MEMCHECK(pReg, pNextRect, pReg->rects); - pNextRect->x1 = x1; - pNextRect->y1 = y1; - pNextRect->x2 = r1->x2; - pNextRect->y2 = y2; - pReg->numRects += 1; - pNextRect++; - assert(pReg->numRects<=pReg->size); - } - r1++; - if (r1 != r1End) - x1 = r1->x1; - } - } - - /* - * Add remaining minuend rectangles to region. - */ - while (r1 != r1End) - { - assert(x1x2); - MEMCHECK(pReg, pNextRect, pReg->rects); - pNextRect->x1 = x1; - pNextRect->y1 = y1; - pNextRect->x2 = r1->x2; - pNextRect->y2 = y2; - pReg->numRects += 1; - pNextRect++; - - assert(pReg->numRects<=pReg->size); - - r1++; - if (r1 != r1End) - { - x1 = r1->x1; - } - } - return 0; /* lint */ -} - -/*- - *----------------------------------------------------------------------- - * miSubtract -- - * Subtract regS from regM and leave the result in regD. - * S stands for subtrahend, M for minuend and D for difference. - * - * Results: - * TRUE. - * - * Side Effects: - * regD is overwritten. - * - *----------------------------------------------------------------------- - */ - -int -XSubtractRegion( - Region regM, - Region regS, - register Region regD) -{ - /* check for trivial reject */ - if ( (!(regM->numRects)) || (!(regS->numRects)) || - (!EXTENTCHECK(®M->extents, ®S->extents)) ) - { - return miRegionCopy(regD, regM); - } - - miRegionOp (regD, regM, regS, miSubtractO, - miSubtractNonO1, NULL); - - /* - * Can't alter newReg's extents before we call miRegionOp because - * it might be one of the source regions and miRegionOp depends - * on the extents of those regions being the unaltered. Besides, this - * way there's no checking against rectangles that will be nuked - * due to coalescing, so we have to examine fewer rectangles. - */ - miSetExtents (regD); - return 1; -} - -int -XXorRegion(Region sra, Region srb, Region dr) -{ - Region tra, trb; - - if (! (tra = XCreateRegion()) ) - return 0; - if (! (trb = XCreateRegion()) ) { - XDestroyRegion(tra); - return 0; - } - (void) XSubtractRegion(sra,srb,tra); - (void) XSubtractRegion(srb,sra,trb); - (void) XUnionRegion(tra,trb,dr); - XDestroyRegion(tra); - XDestroyRegion(trb); - return 0; -} - -/* - * Check to see if the region is empty. Assumes a region is passed - * as a parameter - */ -int -XEmptyRegion( - Region r) -{ - if( r->numRects == 0 ) return TRUE; - else return FALSE; -} - -/* - * Check to see if two regions are equal - */ -int -XEqualRegion(Region r1, Region r2) -{ - int i; - - if( r1->numRects != r2->numRects ) return FALSE; - else if( r1->numRects == 0 ) return TRUE; - else if ( r1->extents.x1 != r2->extents.x1 ) return FALSE; - else if ( r1->extents.x2 != r2->extents.x2 ) return FALSE; - else if ( r1->extents.y1 != r2->extents.y1 ) return FALSE; - else if ( r1->extents.y2 != r2->extents.y2 ) return FALSE; - else for( i=0; i < r1->numRects; i++ ) { - if ( r1->rects[i].x1 != r2->rects[i].x1 ) return FALSE; - else if ( r1->rects[i].x2 != r2->rects[i].x2 ) return FALSE; - else if ( r1->rects[i].y1 != r2->rects[i].y1 ) return FALSE; - else if ( r1->rects[i].y2 != r2->rects[i].y2 ) return FALSE; - } - return TRUE; -} - -int -XPointInRegion( - Region pRegion, - int x, int y) -{ - int i; - - if (pRegion->numRects == 0) - return FALSE; - if (!INBOX(pRegion->extents, x, y)) - return FALSE; - for (i=0; inumRects; i++) - { - if (INBOX (pRegion->rects[i], x, y)) - return TRUE; - } - return FALSE; -} - -int -XRectInRegion( - register Region region, - int rx, int ry, - unsigned int rwidth, unsigned int rheight) -{ - register BoxPtr pbox; - register BoxPtr pboxEnd; - Box rect; - register BoxPtr prect = ▭ - int partIn, partOut; - - prect->x1 = rx; - prect->y1 = ry; - prect->x2 = rwidth + rx; - prect->y2 = rheight + ry; - - /* this is (just) a useful optimization */ - if ((region->numRects == 0) || !EXTENTCHECK(®ion->extents, prect)) - return(RectangleOut); - - partOut = FALSE; - partIn = FALSE; - - /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */ - for (pbox = region->rects, pboxEnd = pbox + region->numRects; - pbox < pboxEnd; - pbox++) - { - - if (pbox->y2 <= ry) - continue; /* getting up to speed or skipping remainder of band */ - - if (pbox->y1 > ry) - { - partOut = TRUE; /* missed part of rectangle above */ - if (partIn || (pbox->y1 >= prect->y2)) - break; - ry = pbox->y1; /* x guaranteed to be == prect->x1 */ - } - - if (pbox->x2 <= rx) - continue; /* not far enough over yet */ - - if (pbox->x1 > rx) - { - partOut = TRUE; /* missed part of rectangle to left */ - if (partIn) - break; - } - - if (pbox->x1 < prect->x2) - { - partIn = TRUE; /* definitely overlap */ - if (partOut) - break; - } - - if (pbox->x2 >= prect->x2) - { - ry = pbox->y2; /* finished with this band */ - if (ry >= prect->y2) - break; - rx = prect->x1; /* reset x out to left again */ - } else - { - /* - * Because boxes in a band are maximal width, if the first box - * to overlap the rectangle doesn't completely cover it in that - * band, the rectangle must be partially out, since some of it - * will be uncovered in that band. partIn will have been set true - * by now... - */ - break; - } - - } - - return(partIn ? ((ry < prect->y2) ? RectanglePart : RectangleIn) : - RectangleOut); -} diff --git a/nx-X11/lib/X11/RegstFlt.c b/nx-X11/lib/X11/RegstFlt.c deleted file mode 100644 index 077ea424c..000000000 --- a/nx-X11/lib/X11/RegstFlt.c +++ /dev/null @@ -1,155 +0,0 @@ - - /* - * Copyright 1990, 1991 by OMRON Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 OMRON not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. OMRON makes no representations - * about the suitability of this software for any purpose. It is provided - * "as is" without express or implied warranty. - * - * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL OMRON 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 - * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR - * PERFORMANCE OF THIS SOFTWARE. - * - * Author: Seiji Kuwari OMRON Corporation - * kuwa@omron.co.jp - * kuwa%omron.co.jp@uunet.uu.net - */ -/* - -Copyright 1990, 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -static void -_XFreeIMFilters( - Display *display) -{ - register XFilterEventList fl; - - while ((fl = display->im_filters)) { - display->im_filters = fl->next; - Xfree(fl); - } -} - -/* - * Register a filter with the filter machinery by event mask. - */ -void -_XRegisterFilterByMask( - Display *display, - Window window, - unsigned long event_mask, - Bool (*filter)( - Display*, Window, XEvent*, XPointer - ), - XPointer client_data) -{ - XFilterEventRec *rec; - - rec = Xmalloc(sizeof(XFilterEventRec)); - if (!rec) - return; - rec->window = window; - rec->event_mask = event_mask; - rec->start_type = 0; - rec->end_type = 0; - rec->filter = filter; - rec->client_data = client_data; - LockDisplay(display); - rec->next = display->im_filters; - display->im_filters = rec; - display->free_funcs->im_filters = _XFreeIMFilters; - UnlockDisplay(display); -} - -/* - * Register a filter with the filter machinery by type code. - */ -void -_XRegisterFilterByType( - Display *display, - Window window, - int start_type, - int end_type, - Bool (*filter)( - Display*, Window, XEvent*, XPointer - ), - XPointer client_data) -{ - XFilterEventRec *rec; - - rec = Xmalloc(sizeof(XFilterEventRec)); - if (!rec) - return; - rec->window = window; - rec->event_mask = 0; - rec->start_type = start_type; - rec->end_type = end_type; - rec->filter = filter; - rec->client_data = client_data; - LockDisplay(display); - rec->next = display->im_filters; - display->im_filters = rec; - display->free_funcs->im_filters = _XFreeIMFilters; - UnlockDisplay(display); -} - -void -_XUnregisterFilter( - Display *display, - Window window, - Bool (*filter)( - Display*, Window, XEvent*, XPointer - ), - XPointer client_data) -{ - register XFilterEventList *prev, fl; - - for (prev = &display->im_filters; (fl = *prev); ) { - if (fl->window == window && - fl->filter == filter && fl->client_data == client_data) { - *prev = fl->next; - Xfree(fl); - } else - prev = &fl->next; - } -} diff --git a/nx-X11/lib/X11/RepWindow.c b/nx-X11/lib/X11/RepWindow.c deleted file mode 100644 index 1fde8d80f..000000000 --- a/nx-X11/lib/X11/RepWindow.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XReparentWindow( - register Display *dpy, - Window w, - Window p, - int x, - int y) -{ - register xReparentWindowReq *req; - - LockDisplay(dpy); - GetReq(ReparentWindow, req); - req->window = w; - req->parent = p; - req->x = x; - req->y = y; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/RestackWs.c b/nx-X11/lib/X11/RestackWs.c deleted file mode 100644 index 52391ecd2..000000000 --- a/nx-X11/lib/X11/RestackWs.c +++ /dev/null @@ -1,61 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XRestackWindows ( - register Display *dpy, - register Window *windows, - int n) -{ - int i = 0; - - LockDisplay(dpy); - while (windows++, ++i < n) { - register xConfigureWindowReq *req; - - GetReqExtra (ConfigureWindow, 8, req); - req->window = *windows; - req->mask = CWSibling | CWStackMode; - { - register CARD32 *values = (CARD32 *) - NEXTPTR(req,xConfigureWindowReq); - *values++ = *(windows-1); - *values = Below; - } - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } - - - - diff --git a/nx-X11/lib/X11/RotProp.c b/nx-X11/lib/X11/RotProp.c deleted file mode 100644 index 98d7dbd81..000000000 --- a/nx-X11/lib/X11/RotProp.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XRotateWindowProperties( - register Display *dpy, - Window w, - Atom *properties, - register int nprops, - int npositions) -{ - register long nbytes; - register xRotatePropertiesReq *req; - - LockDisplay(dpy); - GetReq (RotateProperties, req); - req->window = w; - req->nAtoms = nprops; - req->nPositions = npositions; - - req->length += nprops; - nbytes = nprops << 2; -/* XXX Cray needs packing here.... */ - Data32 (dpy, (long *) properties, nbytes); - - - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } - - - - - diff --git a/nx-X11/lib/X11/ScrResStr.c b/nx-X11/lib/X11/ScrResStr.c deleted file mode 100644 index 1dd04a383..000000000 --- a/nx-X11/lib/X11/ScrResStr.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -char *XScreenResourceString(Screen *screen) -{ - Atom prop_name; - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long leftover; - char *val = NULL; - - prop_name = XInternAtom(screen->display, "SCREEN_RESOURCES", True); - if (prop_name && - XGetWindowProperty(screen->display, screen->root, prop_name, - 0L, 100000000L, False, - XA_STRING, &actual_type, &actual_format, - &nitems, &leftover, - (unsigned char **) &val) == Success) { - if ((actual_type == XA_STRING) && (actual_format == 8)) - return val; - Xfree(val); - } - return (char *)NULL; -} diff --git a/nx-X11/lib/X11/SelInput.c b/nx-X11/lib/X11/SelInput.c deleted file mode 100644 index a3fa294f4..000000000 --- a/nx-X11/lib/X11/SelInput.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSelectInput ( - register Display *dpy, - Window w, - long mask) -{ - register xChangeWindowAttributesReq *req; - - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWEventMask; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), mask); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/SendEvent.c b/nx-X11/lib/X11/SendEvent.c deleted file mode 100644 index 1de986007..000000000 --- a/nx-X11/lib/X11/SendEvent.c +++ /dev/null @@ -1,76 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* - * In order to avoid all images requiring _XEventToWire, we install the - * event converter here if it has never been installed. - */ -Status -XSendEvent( - register Display *dpy, - Window w, - Bool propagate, - long event_mask, - XEvent *event) -{ - register xSendEventReq *req; - xEvent ev; - register Status (**fp)( - Display * /* dpy */, - XEvent * /* re */, - xEvent * /* event */); - Status status; - - /* initialize all of the event's fields first, before setting - * the meaningful ones later. - */ - memset (&ev, 0, sizeof (ev)); - - LockDisplay (dpy); - - /* call through display to find proper conversion routine */ - - fp = &dpy->wire_vec[event->type & 0177]; - if (*fp == NULL) *fp = _XEventToWire; - status = (**fp)(dpy, event, &ev); - - if (status) { - GetReq(SendEvent, req); - req->destination = w; - req->propagate = propagate; - req->eventMask = event_mask; - req->event = ev; - } - - UnlockDisplay(dpy); - SyncHandle(); - return(status); -} diff --git a/nx-X11/lib/X11/SetBack.c b/nx-X11/lib/X11/SetBack.c deleted file mode 100644 index 269d10cc7..000000000 --- a/nx-X11/lib/X11/SetBack.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetBackground ( - register Display *dpy, - GC gc, - unsigned long background) /* CARD32 */ -{ - LockDisplay(dpy); - if (gc->values.background != background) { - gc->values.background = background; - gc->dirty |= GCBackground; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetCCC.c b/nx-X11/lib/X11/SetCCC.c deleted file mode 100644 index e8171b4ea..000000000 --- a/nx-X11/lib/X11/SetCCC.c +++ /dev/null @@ -1,138 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsSetCCC.c - Color Conversion Context Setting Routines - * - * DESCRIPTION - * Routines to set components of a Color Conversion - * Context structure. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcms.h" - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsSetWhitePoint - * - * SYNOPSIS - */ - -Status -XcmsSetWhitePoint( - XcmsCCC ccc, - XcmsColor *pColor) -/* - * DESCRIPTION - * Sets the Client White Point in the specified CCC. - * - * RETURNS - * Returns XcmsSuccess if succeeded; otherwise XcmsFailure. - * - */ -{ - if (pColor == NULL || pColor->format == XcmsUndefinedFormat) { - ccc->clientWhitePt.format = XcmsUndefinedFormat; - } else if (pColor->format != XcmsCIEXYZFormat && - pColor->format != XcmsCIEuvYFormat && - pColor->format != XcmsCIExyYFormat) { - return(XcmsFailure); - } else { - memcpy((char *)&ccc->clientWhitePt, (char *)pColor, sizeof(XcmsColor)); - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsSetCompressionProc - * - * SYNOPSIS - */ - -XcmsCompressionProc -XcmsSetCompressionProc( - XcmsCCC ccc, - XcmsCompressionProc compression_proc, - XPointer client_data) -/* - * DESCRIPTION - * Set the specified CCC's compression function and client data. - * - * RETURNS - * Returns the old compression function. - * - */ -{ - XcmsCompressionProc old = ccc->gamutCompProc; - - ccc->gamutCompProc = compression_proc; - ccc->gamutCompClientData = client_data; - return(old); -} - - -/* - * NAME - * XcmsSetWhiteAdjustProc - * - * SYNOPSIS - */ - -XcmsWhiteAdjustProc -XcmsSetWhiteAdjustProc( - XcmsCCC ccc, - XcmsWhiteAdjustProc white_adjust_proc, - XPointer client_data ) -/* - * DESCRIPTION - * Set the specified CCC's white_adjust function and client data. - * - * RETURNS - * Returns the old white_adjust function. - * - */ -{ - XcmsWhiteAdjustProc old = ccc->whitePtAdjProc; - - ccc->whitePtAdjProc = white_adjust_proc; - ccc->whitePtAdjClientData = client_data; - return(old); -} diff --git a/nx-X11/lib/X11/SetCRects.c b/nx-X11/lib/X11/SetCRects.c deleted file mode 100644 index c7ad3fcf2..000000000 --- a/nx-X11/lib/X11/SetCRects.c +++ /dev/null @@ -1,81 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* can only call when display is locked. */ -void _XSetClipRectangles ( - register Display *dpy, - GC gc, - int clip_x_origin, int clip_y_origin, - XRectangle *rectangles, - int n, - int ordering) -{ - register xSetClipRectanglesReq *req; - register long len; - unsigned long dirty; - register _XExtension *ext; - - GetReq (SetClipRectangles, req); - req->gc = gc->gid; - req->xOrigin = gc->values.clip_x_origin = clip_x_origin; - req->yOrigin = gc->values.clip_y_origin = clip_y_origin; - req->ordering = ordering; - len = ((long)n) << 1; - SetReqLen(req, len, 1); - len <<= 2; - Data16 (dpy, (short *) rectangles, len); - gc->rects = 1; - dirty = gc->dirty & ~(GCClipMask | GCClipXOrigin | GCClipYOrigin); - gc->dirty = GCClipMask | GCClipXOrigin | GCClipYOrigin; - /* call out to any extensions interested */ - for (ext = dpy->ext_procs; ext; ext = ext->next) - if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); - gc->dirty = dirty; -} - -int -XSetClipRectangles ( - register Display *dpy, - GC gc, - int clip_x_origin, - int clip_y_origin, - XRectangle *rectangles, - int n, - int ordering) -{ - LockDisplay(dpy); - _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, - ordering); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/SetClMask.c b/nx-X11/lib/X11/SetClMask.c deleted file mode 100644 index 82cdb2cce..000000000 --- a/nx-X11/lib/X11/SetClMask.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetClipMask ( - register Display *dpy, - GC gc, - Pixmap mask) -{ - LockDisplay(dpy); - /* always update, since client may have changed pixmap contents */ - gc->values.clip_mask = mask; - gc->dirty |= GCClipMask; - gc->rects = 0; - _XFlushGCCache(dpy, gc); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetClOrig.c b/nx-X11/lib/X11/SetClOrig.c deleted file mode 100644 index 800e1570d..000000000 --- a/nx-X11/lib/X11/SetClOrig.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetClipOrigin ( - register Display *dpy, - GC gc, - int xorig, - int yorig) -{ - XGCValues *gv = &gc->values; - - LockDisplay(dpy); - if (xorig != gv->clip_x_origin) { - gv->clip_x_origin = xorig; - gc->dirty |= GCClipXOrigin; - } - if (yorig != gv->clip_y_origin) { - gv->clip_y_origin = yorig; - gc->dirty |= GCClipYOrigin; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetDashes.c b/nx-X11/lib/X11/SetDashes.c deleted file mode 100644 index ffe4a95ff..000000000 --- a/nx-X11/lib/X11/SetDashes.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetDashes ( - register Display *dpy, - GC gc, - int dash_offset, - _Xconst char *list, - int n) - { - register xSetDashesReq *req; - - LockDisplay(dpy); - GetReq (SetDashes,req); - req->gc = gc->gid; - req->dashOffset = gc->values.dash_offset = dash_offset; - req->nDashes = n; - req->length += (n+3)>>2; - gc->dashes = 1; - gc->dirty &= ~(GCDashList | GCDashOffset); - Data (dpy, list, (long)n); - UnlockDisplay(dpy); - SyncHandle(); - return 1; - } - diff --git a/nx-X11/lib/X11/SetFPath.c b/nx-X11/lib/X11/SetFPath.c deleted file mode 100644 index 60aaef01e..000000000 --- a/nx-X11/lib/X11/SetFPath.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define safestrlen(s) ((s) ? strlen(s) : 0) - -int -XSetFontPath ( - register Display *dpy, - char **directories, - int ndirs) -{ - register int n = 0; - register int i; - register int nbytes; - char *p; - register xSetFontPathReq *req; - int retCode; - - LockDisplay(dpy); - GetReq (SetFontPath, req); - req->nFonts = ndirs; - for (i = 0; i < ndirs; i++) { - n += safestrlen (directories[i]) + 1; - } - nbytes = (n + 3) & ~3; - req->length += nbytes >> 2; - if ((p = Xmalloc (nbytes))) { - /* - * pack into counted strings. - */ - char *tmp = p; - - for (i = 0; i < ndirs; i++) { - register int length = safestrlen (directories[i]); - *p = length; - memcpy (p + 1, directories[i], length); - p += length + 1; - } - Data (dpy, tmp, nbytes); - Xfree (tmp); - retCode = 1; - } - else - retCode = 0; - - UnlockDisplay(dpy); - SyncHandle(); - return (retCode); -} diff --git a/nx-X11/lib/X11/SetFont.c b/nx-X11/lib/X11/SetFont.c deleted file mode 100644 index 33ffca02d..000000000 --- a/nx-X11/lib/X11/SetFont.c +++ /dev/null @@ -1,47 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetFont ( - register Display *dpy, - GC gc, - Font font) -{ - LockDisplay(dpy); - if (gc->values.font != font) { - gc->values.font = font; - gc->dirty |= GCFont; - _XFlushGCCache(dpy, gc); - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetFore.c b/nx-X11/lib/X11/SetFore.c deleted file mode 100644 index 50c9f1228..000000000 --- a/nx-X11/lib/X11/SetFore.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetForeground ( - register Display *dpy, - GC gc, - unsigned long foreground) /* CARD32 */ -{ - LockDisplay(dpy); - if (gc->values.foreground != foreground) { - gc->values.foreground = foreground; - gc->dirty |= GCForeground; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetFunc.c b/nx-X11/lib/X11/SetFunc.c deleted file mode 100644 index ffe4ec0cc..000000000 --- a/nx-X11/lib/X11/SetFunc.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetFunction ( - register Display *dpy, - GC gc, - int function) -{ - LockDisplay(dpy); - if (gc->values.function != function) { - gc->values.function = function; - gc->dirty |= GCFunction; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetGetCols.c b/nx-X11/lib/X11/SetGetCols.c deleted file mode 100644 index 83fa4c200..000000000 --- a/nx-X11/lib/X11/SetGetCols.c +++ /dev/null @@ -1,301 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsSetGet.c - * - * DESCRIPTION - * Source for _XcmsSetGetColors() - * - * - */ - -/* - * EXTERNAL INCLUDES - * Include files that must be exported to any package or - * program using this package. - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsSetColor - - * - * SYNOPSIS - */ -Status -_XcmsSetGetColor( - Status (*xColorProc)( - Display* /* display */, - Colormap /* colormap */, - XColor* /* screen_in_out */), - Display *dpy, - Colormap cmap, - XcmsColor *pColors_in_out, - XcmsColorFormat result_format, - Bool *pCompressed) -/* - * DESCRIPTION - * Routine containing code common to: - * XcmsAllocColor - * XcmsQueryColor - * XcmsStoreColor - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded without gamut compression; - * XcmsSuccessWithCompression if it succeeded with gamut - * compression; - */ -{ - XcmsCCC ccc; - XColor XColors_in_out; - Status retval = XcmsSuccess; - - /* - * Argument Checking - * 1. Assume xColorProc is correct - * 2. Insure ccc not NULL - * 3. Assume cmap correct (should be checked by Server) - * 4. Insure pColors_in_out valid - * 5. Assume method_in is valid (should be checked by Server) - */ - - if (dpy == NULL) { - return(XcmsFailure); - } - - if (result_format == XcmsUndefinedFormat) { - return(XcmsFailure); - } - - if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) - || (*xColorProc == XQueryColor)) ) { - return(XcmsFailure); - } - - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { - return(XcmsFailure); - } - - if (*xColorProc == XQueryColor) { - goto Query; - } - - /* - * Convert to RGB, adjusting for white point differences if necessary. - */ - if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat, - pCompressed)) == XcmsFailure) { - return(XcmsFailure); - } - -Query: - /* - * Convert XcmsColor to XColor structures - */ - _XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1); - - /* - * Now make appropriate X Call - */ - if (*xColorProc == XAllocColor) { - if ((*xColorProc)(ccc->dpy, cmap, &XColors_in_out) == 0) { - return(XcmsFailure); - } - } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { - /* Note: XQueryColor and XStoreColor do not return any Status */ - (*xColorProc)(ccc->dpy, cmap, &XColors_in_out); - } else { - return(XcmsFailure); - } - - if ((*xColorProc == XStoreColor)) { - return(retval); - } - - /* - * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures - */ - _XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1); - - /* - * Then, convert XcmsColor structures to the original specification - * format. Note that we must use NULL instead of passing - * pCompressed. - */ - - if (result_format != XcmsRGBFormat) { - if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - } - return(retval); -} - -/* - * NAME - * XcmsSetColors - - * - * SYNOPSIS - */ -Status -_XcmsSetGetColors( - Status (*xColorProc)( - Display* /* display */, - Colormap /* colormap */, - XColor* /* screen_in_out */, - int /* nColors */), - Display *dpy, - Colormap cmap, - XcmsColor *pColors_in_out, - int nColors, - XcmsColorFormat result_format, - Bool *pCompressed) -/* - * DESCRIPTION - * Routine containing code common to: - * XcmsQueryColors - * XcmsStoreColors - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded without gamut compression; - * XcmsSuccessWithCompression if it succeeded with gamut - * compression; - */ -{ - XcmsCCC ccc; - XColor *pXColors_in_out; - Status retval = XcmsSuccess; - - /* - * Argument Checking - * 1. Assume xColorProc is correct - * 2. Insure ccc not NULL - * 3. Assume cmap correct (should be checked by Server) - * 4. Insure pColors_in_out valid - * 5. Assume method_in is valid (should be checked by Server) - * 6. Insure nColors > 0 - */ - - if (dpy == NULL) { - return(XcmsFailure); - } - - if (nColors == 0) { - return(XcmsSuccess); - } - - if (result_format == XcmsUndefinedFormat) { - return(XcmsFailure); - } - - if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { - return(XcmsFailure); - } - - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { - return(XcmsFailure); - } - - /* - * Allocate space for XColors - */ - if ((pXColors_in_out = Xcalloc(nColors, sizeof(XColor))) == - NULL) { - return(XcmsFailure); - } - - if (*xColorProc == XQueryColors) { - goto Query; - } - - /* - * Convert to RGB, adjusting for white point differences if necessary. - */ - if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat, - pCompressed)) == XcmsFailure) { - Xfree(pXColors_in_out); - return(XcmsFailure); - } - -Query: - /* - * Convert XcmsColor to XColor structures - */ - _XcmsRGB_to_XColor(pColors_in_out, pXColors_in_out, nColors); - - /* - * Now make appropriate X Call - */ - if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ - /* Note: XQueryColors and XStoreColors do not return any Status */ - (*xColorProc)(ccc->dpy, cmap, pXColors_in_out, nColors); - } else { - Xfree(pXColors_in_out); - return(XcmsFailure); - } - - if (*xColorProc == XStoreColors) { - Xfree(pXColors_in_out); - return(retval); - } - - /* - * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures - */ - _XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors); - Xfree(pXColors_in_out); - - /* - * Then, convert XcmsColor structures to the original specification - * format. Note that we must use NULL instead of passing - * pCompressed. - */ - if (result_format != XcmsRGBFormat) { - if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - } - - return(retval); -} - -/* ### EOF ### */ diff --git a/nx-X11/lib/X11/SetHints.c b/nx-X11/lib/X11/SetHints.c deleted file mode 100644 index eed360f46..000000000 --- a/nx-X11/lib/X11/SetHints.c +++ /dev/null @@ -1,319 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include -#include - -#define safestrlen(s) ((s) ? strlen(s) : 0) - -int -XSetSizeHints( /* old routine */ - Display *dpy, - Window w, - XSizeHints *hints, - Atom property) -{ - xPropSizeHints prop; - memset(&prop, 0, sizeof(prop)); - prop.flags = (hints->flags & (USPosition|USSize|PAllHints)); - if (hints->flags & (USPosition|PPosition)) { - prop.x = hints->x; - prop.y = hints->y; - } - if (hints->flags & (USSize|PSize)) { - prop.width = hints->width; - prop.height = hints->height; - } - if (hints->flags & PMinSize) { - prop.minWidth = hints->min_width; - prop.minHeight = hints->min_height; - } - if (hints->flags & PMaxSize) { - prop.maxWidth = hints->max_width; - prop.maxHeight = hints->max_height; - } - if (hints->flags & PResizeInc) { - prop.widthInc = hints->width_inc; - prop.heightInc = hints->height_inc; - } - if (hints->flags & PAspect) { - prop.minAspectX = hints->min_aspect.x; - prop.minAspectY = hints->min_aspect.y; - prop.maxAspectX = hints->max_aspect.x; - prop.maxAspectY = hints->max_aspect.y; - } - return XChangeProperty (dpy, w, property, XA_WM_SIZE_HINTS, 32, - PropModeReplace, (unsigned char *) &prop, - OldNumPropSizeElements); -} - -/* - * XSetWMHints sets the property - * WM_HINTS type: WM_HINTS format:32 - */ - -int -XSetWMHints ( - Display *dpy, - Window w, - XWMHints *wmhints) -{ - xPropWMHints prop; - memset(&prop, 0, sizeof(prop)); - prop.flags = wmhints->flags; - if (wmhints->flags & InputHint) - prop.input = (wmhints->input == True ? 1 : 0); - if (wmhints->flags & StateHint) - prop.initialState = wmhints->initial_state; - if (wmhints->flags & IconPixmapHint) - prop.iconPixmap = wmhints->icon_pixmap; - if (wmhints->flags & IconWindowHint) - prop.iconWindow = wmhints->icon_window; - if (wmhints->flags & IconPositionHint) { - prop.iconX = wmhints->icon_x; - prop.iconY = wmhints->icon_y; - } - if (wmhints->flags & IconMaskHint) - prop.iconMask = wmhints->icon_mask; - if (wmhints->flags & WindowGroupHint) - prop.windowGroup = wmhints->window_group; - return XChangeProperty (dpy, w, XA_WM_HINTS, XA_WM_HINTS, 32, - PropModeReplace, (unsigned char *) &prop, - NumPropWMHintsElements); -} - - - -/* - * XSetZoomHints sets the property - * WM_ZOOM_HINTS type: WM_SIZE_HINTS format: 32 - */ - -int -XSetZoomHints ( - Display *dpy, - Window w, - XSizeHints *zhints) -{ - return XSetSizeHints (dpy, w, zhints, XA_WM_ZOOM_HINTS); -} - - -/* - * XSetNormalHints sets the property - * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 - */ - -int -XSetNormalHints ( /* old routine */ - Display *dpy, - Window w, - XSizeHints *hints) -{ - return XSetSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); -} - - - -/* - * Note, the following is one of the few cases were we really do want sizeof - * when examining a protocol structure. This is because the XChangeProperty - * routine will take care of converting to host to network data structures. - */ - -int -XSetIconSizes ( - Display *dpy, - Window w, /* typically, root */ - XIconSize *list, - int count) /* number of items on the list */ -{ - register int i; - xPropIconSize *pp, *prop; -#define size_of_the_real_thing sizeof /* avoid grepping screwups */ - unsigned nbytes = count * size_of_the_real_thing(xPropIconSize); -#undef size_of_the_real_thing - if ((prop = pp = Xmalloc (nbytes))) { - for (i = 0; i < count; i++) { - pp->minWidth = list->min_width; - pp->minHeight = list->min_height; - pp->maxWidth = list->max_width; - pp->maxHeight = list->max_height; - pp->widthInc = list->width_inc; - pp->heightInc = list->height_inc; - pp += 1; - list += 1; - } - XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, - PropModeReplace, (unsigned char *) prop, - count * NumPropIconSizeElements); - Xfree (prop); - } - return 1; -} - -int -XSetCommand ( - Display *dpy, - Window w, - char **argv, - int argc) -{ - register int i; - register int nbytes; - register char *buf, *bp; - for (i = 0, nbytes = 0; i < argc; i++) { - nbytes += safestrlen(argv[i]) + 1; - } - if ((bp = buf = Xmalloc(nbytes))) { - /* copy arguments into single buffer */ - for (i = 0; i < argc; i++) { - if (argv[i]) { - (void) strcpy(bp, argv[i]); - bp += strlen(argv[i]) + 1; - } - else - *bp++ = '\0'; - } - XChangeProperty (dpy, w, XA_WM_COMMAND, XA_STRING, 8, - PropModeReplace, (unsigned char *)buf, nbytes); - Xfree(buf); - } - return 1; -} -/* - * XSetStandardProperties sets the following properties: - * WM_NAME type: STRING format: 8 - * WM_ICON_NAME type: STRING format: 8 - * WM_HINTS type: WM_HINTS format: 32 - * WM_COMMAND type: STRING - * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 - */ - -int -XSetStandardProperties ( - Display *dpy, - Window w, /* window to decorate */ - _Xconst char *name, /* name of application */ - _Xconst char *icon_string,/* name string for icon */ - Pixmap icon_pixmap, /* pixmap to use as icon, or None */ - char **argv, /* command to be used to restart application */ - int argc, /* count of arguments */ - XSizeHints *hints) /* size hints for window in its normal state */ -{ - XWMHints phints; - phints.flags = 0; - - if (name != NULL) XStoreName (dpy, w, name); - - if (icon_string != NULL) { - XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, - PropModeReplace, - (_Xconst unsigned char *)icon_string, - safestrlen(icon_string)); - } - - if (icon_pixmap != None) { - phints.icon_pixmap = icon_pixmap; - phints.flags |= IconPixmapHint; - } - if (argv != NULL) XSetCommand(dpy, w, argv, argc); - - if (hints != NULL) XSetNormalHints(dpy, w, hints); - - if (phints.flags != 0) XSetWMHints(dpy, w, &phints); - - return 1; -} - -int -XSetTransientForHint( - Display *dpy, - Window w, - Window propWindow) -{ - return XChangeProperty(dpy, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, - PropModeReplace, (unsigned char *) &propWindow, 1); -} - -int -XSetClassHint( - Display *dpy, - Window w, - XClassHint *classhint) -{ - char *class_string; - char *s; - int len_nm, len_cl; - - len_nm = safestrlen(classhint->res_name); - len_cl = safestrlen(classhint->res_class); - if ((class_string = s = Xmalloc(len_nm + len_cl + 2))) { - if (len_nm) { - strcpy(s, classhint->res_name); - s += len_nm + 1; - } - else - *s++ = '\0'; - if (len_cl) - strcpy(s, classhint->res_class); - else - *s = '\0'; - XChangeProperty(dpy, w, XA_WM_CLASS, XA_STRING, 8, - PropModeReplace, (unsigned char *) class_string, - len_nm+len_cl+2); - Xfree(class_string); - } - return 1; -} diff --git a/nx-X11/lib/X11/SetIFocus.c b/nx-X11/lib/X11/SetIFocus.c deleted file mode 100644 index bee96ca82..000000000 --- a/nx-X11/lib/X11/SetIFocus.c +++ /dev/null @@ -1,50 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetInputFocus( - register Display *dpy, - Window focus, - int revert_to, - Time time) -{ - register xSetInputFocusReq *req; - - LockDisplay(dpy); - GetReq(SetInputFocus, req); - req->focus = focus; - req->revertTo = revert_to; - req->time = time; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/SetLStyle.c b/nx-X11/lib/X11/SetLStyle.c deleted file mode 100644 index 8b00fae9c..000000000 --- a/nx-X11/lib/X11/SetLStyle.c +++ /dev/null @@ -1,63 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetLineAttributes( - register Display *dpy, - GC gc, - unsigned int linewidth, /* CARD16 */ - int linestyle, - int capstyle, - int joinstyle) -{ - XGCValues *gv = &gc->values; - - LockDisplay(dpy); - if (linewidth != gv->line_width) { - gv->line_width = linewidth; - gc->dirty |= GCLineWidth; - } - if (linestyle != gv->line_style) { - gv->line_style = linestyle; - gc->dirty |= GCLineStyle; - } - if (capstyle != gv->cap_style) { - gv->cap_style = capstyle; - gc->dirty |= GCCapStyle; - } - if (joinstyle != gv->join_style) { - gv->join_style = joinstyle; - gc->dirty |= GCJoinStyle; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetLocale.c b/nx-X11/lib/X11/SetLocale.c deleted file mode 100644 index 3bbfd3ee6..000000000 --- a/nx-X11/lib/X11/SetLocale.c +++ /dev/null @@ -1,188 +0,0 @@ - -/* - * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, - * and Nippon Telegraph and Telephone Corporation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 names of OMRON, NTT Software, and NTT - * not be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. OMRON, NTT Software, - * and NTT 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, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD - * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY - * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT, 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. - * - * Authors: Li Yuhong OMRON Corporation - * Tetsuya Kato NTT Software Corporation - * Hiroshi Kuribayashi OMRON Corporation - * - */ -/* - -Copyright 1987,1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include -#include -#include "XlcPubI.h" - -#define MAXLOCALE 64 /* buffer size of locale name */ - - -#if defined(__DARWIN__) || defined(__APPLE__) || defined(__CYGWIN__) -char * -_Xsetlocale( - int category, - _Xconst char *name -) -{ - return setlocale(category, name); -} -#endif /* __DARWIN__ || __APPLE__ || __CYGWIN__ */ - -/* - * _XlcMapOSLocaleName is an implementation dependent routine that derives - * the LC_CTYPE locale name as used in the sample implementation from that - * returned by setlocale. - * - * Should match the code in Xt ExtractLocaleName. - * - * This function name is a bit of a misnomer. Even the siname parameter - * name is a misnomer. On most modern operating systems this function is - * a no-op, simply returning the osname; but on older operating systems - * like Ultrix, or HPUX 9.x and earlier, when you set LANG=german.88591 - * then the string returned by setlocale(LC_ALL, "") will look something - * like: "german.88591 german.88591 ... german.88591". Then this function - * will pick out the LC_CTYPE component and return a pointer to that. - */ - -char * -_XlcMapOSLocaleName( - char *osname, - char *siname) -{ - -/* FIXME: correct indentation levels after ancient platform clean-up */ - -#if defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(ultrix) || defined(WIN32) || defined(linux) -# ifdef ultrix -# define SKIPCOUNT 2 -# define STARTCHAR '\001' -# define ENDCHAR '\001' -# else -# if defined(WIN32) -# define SKIPCOUNT 1 -# define STARTCHAR '=' -# define ENDCHAR ';' -# define WHITEFILL -# else -# if defined(linux) -# define STARTSTR "LC_CTYPE=" -# define ENDCHAR ';' -# else -# if !defined(sun) || defined(SVR4) -# define STARTCHAR '/' -# define ENDCHAR '/' -# endif -# endif -# endif -# endif - - char *start; - char *end; - int len; -# ifdef SKIPCOUNT - int n; -# endif - - start = osname; -# ifdef SKIPCOUNT - for (n = SKIPCOUNT; - --n >= 0 && start && (start = strchr (start, STARTCHAR)); - start++) - ; - if (!start) - start = osname; -# endif -# ifdef STARTCHAR - if (start && (start = strchr (start, STARTCHAR))) -# elif defined (STARTSTR) - if (start && (start = strstr (start,STARTSTR))) -# endif - { -# ifdef STARTCHAR - start++; -# elif defined (STARTSTR) - start += strlen(STARTSTR); -# endif - if ((end = strchr (start, ENDCHAR))) { - len = end - start; - if (len >= MAXLOCALE) - len = MAXLOCALE - 1; - strncpy(siname, start, len); - *(siname + len) = '\0'; -# ifdef WHITEFILL - for (start = siname; start = strchr(start, ' '); ) - *start++ = '-'; -# endif - return siname; - } else /* if no ENDCHAR is found we are at the end of the line */ - return start; - } -# ifdef WHITEFILL - if (strchr(osname, ' ')) { - len = strlen(osname); - if (len >= MAXLOCALE - 1) - len = MAXLOCALE - 1; - strncpy(siname, osname, len); - *(siname + len) = '\0'; - for (start = siname; start = strchr(start, ' '); ) - *start++ = '-'; - return siname; - } -# endif -# undef STARTCHAR -# undef ENDCHAR -# undef WHITEFILL -#endif - return osname; -} - diff --git a/nx-X11/lib/X11/SetNrmHint.c b/nx-X11/lib/X11/SetNrmHint.c deleted file mode 100644 index 937f4eb6b..000000000 --- a/nx-X11/lib/X11/SetNrmHint.c +++ /dev/null @@ -1,127 +0,0 @@ - -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL DIGITAL OR WYSE 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. - -******************************************************************/ -/* - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include -#include - -void XSetWMSizeHints ( - Display *dpy, - Window w, - XSizeHints *hints, - Atom prop) -{ - xPropSizeHints data; - - memset(&data, 0, sizeof(data)); - data.flags = (hints->flags & - (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize| - PResizeInc|PAspect|PBaseSize|PWinGravity)); - - /* - * The x, y, width, and height fields are obsolete; but, applications - * that want to work with old window managers might set them. - */ - if (hints->flags & (USPosition|PPosition)) { - data.x = hints->x; - data.y = hints->y; - } - if (hints->flags & (USSize|PSize)) { - data.width = hints->width; - data.height = hints->height; - } - - if (hints->flags & PMinSize) { - data.minWidth = hints->min_width; - data.minHeight = hints->min_height; - } - if (hints->flags & PMaxSize) { - data.maxWidth = hints->max_width; - data.maxHeight = hints->max_height; - } - if (hints->flags & PResizeInc) { - data.widthInc = hints->width_inc; - data.heightInc = hints->height_inc; - } - if (hints->flags & PAspect) { - data.minAspectX = hints->min_aspect.x; - data.minAspectY = hints->min_aspect.y; - data.maxAspectX = hints->max_aspect.x; - data.maxAspectY = hints->max_aspect.y; - } - if (hints->flags & PBaseSize) { - data.baseWidth = hints->base_width; - data.baseHeight = hints->base_height; - } - if (hints->flags & PWinGravity) { - data.winGravity = hints->win_gravity; - } - - XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, - PropModeReplace, (unsigned char *) &data, - NumPropSizeElements); -} - - -void XSetWMNormalHints ( - Display *dpy, - Window w, - XSizeHints *hints) -{ - XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); -} - diff --git a/nx-X11/lib/X11/SetPMask.c b/nx-X11/lib/X11/SetPMask.c deleted file mode 100644 index 9f236b00b..000000000 --- a/nx-X11/lib/X11/SetPMask.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetPlaneMask ( - register Display *dpy, - GC gc, - unsigned long planemask) /* CARD32 */ -{ - LockDisplay(dpy); - if (gc->values.plane_mask != planemask) { - gc->values.plane_mask = planemask; - gc->dirty |= GCPlaneMask; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetPntMap.c b/nx-X11/lib/X11/SetPntMap.c deleted file mode 100644 index 14e104d6d..000000000 --- a/nx-X11/lib/X11/SetPntMap.c +++ /dev/null @@ -1,77 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -/* returns either DeviceMappingSuccess or DeviceMappingBusy */ - -int -XSetPointerMapping ( - register Display *dpy, - _Xconst unsigned char *map, - int nmaps) - { - register xSetPointerMappingReq *req; - xSetPointerMappingReply rep; - - LockDisplay(dpy); - GetReq (SetPointerMapping, req); - req->nElts = nmaps; - req->length += (nmaps + 3)>>2; - Data (dpy, (_Xconst char *)map, (long) nmaps); - if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) - rep.success = MappingSuccess; - UnlockDisplay(dpy); - SyncHandle(); - return ((int) rep.success); - } - -int -XChangeKeyboardMapping ( - register Display *dpy, - int first_keycode, - int keysyms_per_keycode, - KeySym *keysyms, - int nkeycodes) -{ - register long nbytes; - register xChangeKeyboardMappingReq *req; - - LockDisplay(dpy); - GetReq (ChangeKeyboardMapping, req); - req->firstKeyCode = first_keycode; - req->keyCodes = nkeycodes; - req->keySymsPerKeyCode = keysyms_per_keycode; - req->length += nkeycodes * keysyms_per_keycode; - nbytes = keysyms_per_keycode * nkeycodes * 4; - Data32 (dpy, (long *)keysyms, nbytes); - UnlockDisplay(dpy); - SyncHandle(); - return 0; - } - diff --git a/nx-X11/lib/X11/SetRGBCMap.c b/nx-X11/lib/X11/SetRGBCMap.c deleted file mode 100644 index f413c0d69..000000000 --- a/nx-X11/lib/X11/SetRGBCMap.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include - -void XSetRGBColormaps ( - Display *dpy, - Window w, - XStandardColormap *cmaps, - int count, - Atom property) /* XA_RGB_BEST_MAP, etc. */ -{ - register int i; /* iterator variable */ - register xPropStandardColormap *map; /* tmp variable, data in prop */ - register XStandardColormap *cmap; /* tmp variable, user data */ - xPropStandardColormap *data, tmpdata; /* scratch data */ - int mode = PropModeReplace; /* for partial writes */ - Bool alloced_scratch_space; /* do we need to free? */ - - - if (count < 1) return; - - /* - * if doing more than one, allocate scratch space for it - */ - if ((count > 1) && ((data = ((xPropStandardColormap *) - Xmalloc(count*sizeof(xPropStandardColormap)))) - != NULL)) { - alloced_scratch_space = True; - } else { - data = &tmpdata; - alloced_scratch_space = False; - } - - - /* - * Do the iteration. If using temp space put out each part of the prop; - * otherwise, wait until the end and blast it all at once. - */ - for (i = count, map = data, cmap = cmaps; i > 0; i--, cmap++) { - map->colormap = cmap->colormap; - map->red_max = cmap->red_max; - map->red_mult = cmap->red_mult; - map->green_max = cmap->green_max; - map->green_mult = cmap->green_mult; - map->blue_max = cmap->blue_max; - map->blue_mult = cmap->blue_mult; - map->base_pixel = cmap->base_pixel; - map->visualid = cmap->visualid; - map->killid = cmap->killid; - - if (alloced_scratch_space) { - map++; - } else { - XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, mode, - (unsigned char *) data, - NumPropStandardColormapElements); - mode = PropModeAppend; - } - } - - if (alloced_scratch_space) { - XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, - PropModeReplace, (unsigned char *) data, - (int) (count * NumPropStandardColormapElements)); - Xfree (data); - } -} diff --git a/nx-X11/lib/X11/SetSOwner.c b/nx-X11/lib/X11/SetSOwner.c deleted file mode 100644 index bc8f56403..000000000 --- a/nx-X11/lib/X11/SetSOwner.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetSelectionOwner( - register Display *dpy, - Atom selection, - Window owner, - Time time) -{ - register xSetSelectionOwnerReq *req; - - LockDisplay(dpy); - GetReq(SetSelectionOwner,req); - req->selection = selection; - req->window = owner; - req->time = time; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetSSaver.c b/nx-X11/lib/X11/SetSSaver.c deleted file mode 100644 index adce749e1..000000000 --- a/nx-X11/lib/X11/SetSSaver.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetScreenSaver( - register Display *dpy, - int timeout, - int interval, - int prefer_blank, - int allow_exp) - -{ - register xSetScreenSaverReq *req; - - LockDisplay(dpy); - GetReq(SetScreenSaver, req); - req->timeout = timeout; - req->interval = interval; - req->preferBlank = prefer_blank; - req->allowExpose = allow_exp; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/SetStCmap.c b/nx-X11/lib/X11/SetStCmap.c deleted file mode 100644 index 7b8aa862d..000000000 --- a/nx-X11/lib/X11/SetStCmap.c +++ /dev/null @@ -1,95 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xatomtype.h" -#include - -/* - * WARNING - * - * This is a pre-ICCCM routine. It must not reference any of the new fields - * in the XStandardColormap structure. - */ - -void XSetStandardColormap( - Display *dpy, - Window w, - XStandardColormap *cmap, - Atom property) /* XA_RGB_BEST_MAP, etc. */ -{ - Screen *sp; - XStandardColormap stdcmap; - - sp = _XScreenOfWindow (dpy, w); - if (!sp) { - /* already caught the XGetGeometry error in _XScreenOfWindow */ - return; - } - - stdcmap.colormap = cmap->colormap; - stdcmap.red_max = cmap->red_max; - stdcmap.red_mult = cmap->red_mult; - stdcmap.green_max = cmap->green_max; - stdcmap.green_mult = cmap->green_mult; - stdcmap.blue_max = cmap->blue_max; - stdcmap.blue_mult = cmap->blue_mult; - stdcmap.base_pixel = cmap->base_pixel; - stdcmap.visualid = sp->root_visual->visualid; - stdcmap.killid = None; /* don't know how to kill this one */ - -#ifdef XCMS - XSetRGBColormaps (dpy, w, &stdcmap, 1, property); -#endif - - return; -} diff --git a/nx-X11/lib/X11/SetState.c b/nx-X11/lib/X11/SetState.c deleted file mode 100644 index e5aa21c05..000000000 --- a/nx-X11/lib/X11/SetState.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetState( - register Display *dpy, - GC gc, - unsigned long foreground, - unsigned long background, - int function, - unsigned long planemask) -{ - XGCValues *gv = &gc->values; - - LockDisplay(dpy); - - if (function != gv->function) { - gv->function = function; - gc->dirty |= GCFunction; - } - if (planemask != gv->plane_mask) { - gv->plane_mask = planemask; - gc->dirty |= GCPlaneMask; - } - if (foreground != gv->foreground) { - gv->foreground = foreground; - gc->dirty |= GCForeground; - } - if (background != gv->background) { - gv->background = background; - gc->dirty |= GCBackground; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetStip.c b/nx-X11/lib/X11/SetStip.c deleted file mode 100644 index e95882786..000000000 --- a/nx-X11/lib/X11/SetStip.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetStipple ( - register Display *dpy, - GC gc, - Pixmap stipple) -{ - LockDisplay(dpy); - /* always update, since client may have changed pixmap contents */ - gc->values.stipple = stipple; - gc->dirty |= GCStipple; - _XFlushGCCache(dpy, gc); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetTSOrig.c b/nx-X11/lib/X11/SetTSOrig.c deleted file mode 100644 index 0117c818b..000000000 --- a/nx-X11/lib/X11/SetTSOrig.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetTSOrigin ( - register Display *dpy, - GC gc, - int x, - int y) -{ - XGCValues *gv = &gc->values; - - LockDisplay(dpy); - if (x != gv->ts_x_origin) { - gv->ts_x_origin = x; - gc->dirty |= GCTileStipXOrigin; - } - if (y != gv->ts_y_origin) { - gv->ts_y_origin = y; - gc->dirty |= GCTileStipYOrigin; - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetTile.c b/nx-X11/lib/X11/SetTile.c deleted file mode 100644 index d32edff06..000000000 --- a/nx-X11/lib/X11/SetTile.c +++ /dev/null @@ -1,46 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XSetTile ( - register Display *dpy, - GC gc, - Pixmap tile) -{ - LockDisplay(dpy); - /* always update, since client may have changed pixmap contents */ - gc->values.tile = tile; - gc->dirty |= GCTile; - _XFlushGCCache(dpy, gc); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/SetTxtProp.c b/nx-X11/lib/X11/SetTxtProp.c deleted file mode 100644 index c3f272712..000000000 --- a/nx-X11/lib/X11/SetTxtProp.c +++ /dev/null @@ -1,93 +0,0 @@ -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. - - All Rights Reserved - -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 -supporting documentation, and that the name of Wyse not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -void XSetTextProperty ( - Display *dpy, - Window w, - XTextProperty *tp, - Atom property) -{ - XChangeProperty (dpy, w, property, tp->encoding, tp->format, - PropModeReplace, tp->value, tp->nitems); -} - -void XSetWMName ( - Display *dpy, - Window w, - XTextProperty *tp) -{ - XSetTextProperty (dpy, w, tp, XA_WM_NAME); -} - -void XSetWMIconName ( - Display *dpy, - Window w, - XTextProperty *tp) -{ - XSetTextProperty (dpy, w, tp, XA_WM_ICON_NAME); -} - -void XSetWMClientMachine ( - Display *dpy, - Window w, - XTextProperty *tp) -{ - XSetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE); -} - diff --git a/nx-X11/lib/X11/SetWMCMapW.c b/nx-X11/lib/X11/SetWMCMapW.c deleted file mode 100644 index 98d6c80b3..000000000 --- a/nx-X11/lib/X11/SetWMCMapW.c +++ /dev/null @@ -1,74 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -/* - * XSetWMProtocols sets the property - * WM_COLORMAP_WINDOWS type: WINDOW format:32 - */ - -Status XSetWMColormapWindows ( - Display *dpy, - Window w, - Window *windows, - int count) -{ - Atom prop; - - prop = XInternAtom (dpy, "WM_COLORMAP_WINDOWS", False); - if (prop == None) return False; - - XChangeProperty (dpy, w, prop, XA_WINDOW, 32, - PropModeReplace, (unsigned char *) windows, count); - return True; -} diff --git a/nx-X11/lib/X11/SetWMProto.c b/nx-X11/lib/X11/SetWMProto.c deleted file mode 100644 index 14067b870..000000000 --- a/nx-X11/lib/X11/SetWMProto.c +++ /dev/null @@ -1,74 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include - -/* - * XSetWMProtocols sets the property - * WM_PROTOCOLS type: ATOM format: 32 - */ - -Status XSetWMProtocols ( - Display *dpy, - Window w, - Atom *protocols, - int count) -{ - Atom prop; - - prop = XInternAtom (dpy, "WM_PROTOCOLS", False); - if (prop == None) return False; - - XChangeProperty (dpy, w, prop, XA_ATOM, 32, - PropModeReplace, (unsigned char *) protocols, count); - return True; -} diff --git a/nx-X11/lib/X11/StBytes.c b/nx-X11/lib/X11/StBytes.c deleted file mode 100644 index f058d354b..000000000 --- a/nx-X11/lib/X11/StBytes.c +++ /dev/null @@ -1,107 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -/* insulate predefined atom numbers from cut routines */ -static const Atom n_to_atom[8] = { - XA_CUT_BUFFER0, - XA_CUT_BUFFER1, - XA_CUT_BUFFER2, - XA_CUT_BUFFER3, - XA_CUT_BUFFER4, - XA_CUT_BUFFER5, - XA_CUT_BUFFER6, - XA_CUT_BUFFER7}; - -int -XRotateBuffers ( - register Display *dpy, - int rotate) -{ - /* XRotateWindowProperties wants a non-const Atom*, but it doesn't - * modify it, so this is safe. - */ - return XRotateWindowProperties(dpy, RootWindow(dpy, 0), (Atom *)n_to_atom, 8, rotate); -} - -char *XFetchBuffer ( - register Display *dpy, - int *nbytes, - register int buffer) -{ - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long leftover; - unsigned char *data; - *nbytes = 0; - if ((buffer < 0) || (buffer > 7)) return (NULL); -/* XXX should be (sizeof (maxint) - 1)/4 */ - if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], - 0L, 10000000L, False, XA_STRING, - &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { - return (NULL); - } - if ( (actual_type == XA_STRING) && (actual_format != 32) ) { - *nbytes = nitems; - return((char *)data); - } - Xfree (data); - return(NULL); -} - -char *XFetchBytes ( - register Display *dpy, - int *nbytes) -{ - return (XFetchBuffer (dpy, nbytes, 0)); -} - -int -XStoreBuffer ( - register Display *dpy, - _Xconst char *bytes, - int nbytes, - register int buffer) -{ - if ((buffer < 0) || (buffer > 7)) return 0; - return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], - XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *) bytes, nbytes); -} - -int -XStoreBytes ( - register Display *dpy, - _Xconst char *bytes, - int nbytes) -{ - return XStoreBuffer (dpy, bytes, nbytes, 0); -} diff --git a/nx-X11/lib/X11/StCol.c b/nx-X11/lib/X11/StCol.c deleted file mode 100644 index 941ad0743..000000000 --- a/nx-X11/lib/X11/StCol.c +++ /dev/null @@ -1,82 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsStCol.c - * - * DESCRIPTION - * Source for XcmsStoreColor - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsStoreColor - Store Color - * - * SYNOPSIS - */ -Status -XcmsStoreColor( - Display *dpy, - Colormap colormap, - XcmsColor *pColor_in) -/* - * DESCRIPTION - * Given a device-dependent or device-independent color - * specification, this routine will convert it to X RGB - * values then use it in a call to XStoreColor. - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded without gamut compression; - * XcmsSuccessWithCompression if it succeeded with gamut - * compression; - * - * Since XStoreColor has no return value this routine - * does not return the color specification of the color actually - * stored. - */ -{ - XcmsColor tmpColor; - - tmpColor = *pColor_in; - return(_XcmsSetGetColor(XStoreColor, dpy, colormap, - &tmpColor, XcmsRGBFormat, (Bool *) NULL)); -} diff --git a/nx-X11/lib/X11/StColor.c b/nx-X11/lib/X11/StColor.c deleted file mode 100644 index d5a217fb0..000000000 --- a/nx-X11/lib/X11/StColor.c +++ /dev/null @@ -1,58 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XStoreColor( - register Display *dpy, - Colormap cmap, - XColor *def) -{ - xColorItem *citem; - register xStoreColorsReq *req; - - LockDisplay(dpy); - GetReqExtra(StoreColors, SIZEOF(xColorItem), req); /* assume size is 4*n */ - - req->cmap = cmap; - - citem = (xColorItem *) NEXTPTR(req,xStoreColorsReq); - - citem->pixel = def->pixel; - citem->red = def->red; - citem->green = def->green; - citem->blue = def->blue; - citem->flags = def->flags; /* do_red, do_green, do_blue */ - - - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/StColors.c b/nx-X11/lib/X11/StColors.c deleted file mode 100644 index 17a215cc0..000000000 --- a/nx-X11/lib/X11/StColors.c +++ /dev/null @@ -1,65 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XStoreColors( - register Display *dpy, - Colormap cmap, - XColor *defs, - int ncolors) -{ - register int i; - xColorItem citem; - register xStoreColorsReq *req; - - LockDisplay(dpy); - GetReq(StoreColors, req); - - req->cmap = cmap; - - req->length += (ncolors * SIZEOF(xColorItem)) >> 2; /* assume size is 4*n */ - - for (i = 0; i < ncolors; i++) { - citem.pixel = defs[i].pixel; - citem.red = defs[i].red; - citem.green = defs[i].green; - citem.blue = defs[i].blue; - citem.flags = defs[i].flags; - - /* note that xColorItem doesn't contain all 16-bit quantities, so - we can't use Data16 */ - Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); - /* assume size is 4*n */ - } - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/StCols.c b/nx-X11/lib/X11/StCols.c deleted file mode 100644 index 42a29cd7f..000000000 --- a/nx-X11/lib/X11/StCols.c +++ /dev/null @@ -1,112 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsStCols.c - * - * DESCRIPTION - * Source for XcmsStoreColors - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsStoreColors - Store Colors - * - * SYNOPSIS - */ -Status -XcmsStoreColors( - Display *dpy, - Colormap colormap, - XcmsColor *pColors_in, - unsigned int nColors, - Bool *pCompressed) -/* - * DESCRIPTION - * Given device-dependent or device-independent color - * specifications, this routine will convert them to X RGB - * values then use it in a call to XStoreColors. - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded without gamut compression; - * XcmsSuccessWithCompression if it succeeded with gamut - * compression; - * - * Since XStoreColors has no return value, this routine - * does not return color specifications of the colors actually - * stored. - */ -{ - XcmsColor Color1; - XcmsColor *pColors_tmp; - Status retval; - - /* - * Make copy of array of color specifications so we don't - * overwrite the contents. - */ - if (nColors > 1) { - pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); - } else { - pColors_tmp = &Color1; - } - memcpy((char *)pColors_tmp, (char *)pColors_in, - nColors * sizeof(XcmsColor)); - - /* - * Call routine to store colors using the copied color structures - */ - retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, - pColors_tmp, nColors, XcmsRGBFormat, pCompressed); - - /* - * Free copies as needed. - */ - if (nColors > 1) { - Xfree(pColors_tmp); - } - - /* - * Ah, finally return. - */ - return(retval); -} diff --git a/nx-X11/lib/X11/StNColor.c b/nx-X11/lib/X11/StNColor.c deleted file mode 100644 index 8b821c3ef..000000000 --- a/nx-X11/lib/X11/StNColor.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" - - -int -XStoreNamedColor( -register Display *dpy, -Colormap cmap, -_Xconst char *name, /* STRING8 */ -unsigned long pixel, /* CARD32 */ -int flags) /* DoRed, DoGreen, DoBlue */ -{ - unsigned int nbytes; - register xStoreNamedColorReq *req; - XcmsCCC ccc; - XcmsColor cmsColor_exact; - XColor scr_def; - -#ifdef XCMS - /* - * Let's Attempt to use Xcms approach to Parse Color - */ - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { - if (_XcmsResolveColorString(ccc, &name, &cmsColor_exact, - XcmsRGBFormat) >= XcmsSuccess) { - _XcmsRGB_to_XColor(&cmsColor_exact, &scr_def, 1); - scr_def.pixel = pixel; - scr_def.flags = flags; - return XStoreColor(dpy, cmap, &scr_def); - } - /* - * Otherwise we failed; or name was changed with yet another - * name. Thus pass name to the X Server. - */ - } -#endif - - /* - * The Xcms and i18n methods failed, so lets pass it to the server - * for parsing. - */ - - LockDisplay(dpy); - GetReq(StoreNamedColor, req); - - req->cmap = cmap; - req->flags = flags; - req->pixel = pixel; - req->nbytes = nbytes = strlen(name); - req->length += (nbytes + 3) >> 2; /* round up to multiple of 4 */ - Data(dpy, name, (long)nbytes); - UnlockDisplay(dpy); - SyncHandle(); - return 0; -} - - diff --git a/nx-X11/lib/X11/StName.c b/nx-X11/lib/X11/StName.c deleted file mode 100644 index a003a109e..000000000 --- a/nx-X11/lib/X11/StName.c +++ /dev/null @@ -1,53 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -int -XStoreName ( - register Display *dpy, - Window w, - _Xconst char *name) -{ - return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, - 8, PropModeReplace, (_Xconst unsigned char *)name, - name ? strlen(name) : 0); -} - -int -XSetIconName ( - register Display *dpy, - Window w, - _Xconst char *icon_name) -{ - return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, - PropModeReplace, (_Xconst unsigned char *)icon_name, - icon_name ? strlen(icon_name) : 0); -} diff --git a/nx-X11/lib/X11/StrKeysym.c b/nx-X11/lib/X11/StrKeysym.c deleted file mode 100644 index 125aceca3..000000000 --- a/nx-X11/lib/X11/StrKeysym.c +++ /dev/null @@ -1,181 +0,0 @@ -/* - -Copyright 1985, 1987, 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include -#include -#include "Xresinternal.h" - -#define NEEDKTABLE -#include "ks_tables.h" -#include "Key.h" - -#ifndef KEYSYMDB -#ifndef XKEYSYMDB -#define KEYSYMDB "/usr/lib/X11/XKeysymDB" -#else -#define KEYSYMDB XKEYSYMDB -#endif -#endif - -static Bool initialized; -static XrmDatabase keysymdb; -static XrmQuark Qkeysym[2]; - -XrmDatabase -_XInitKeysymDB(void) -{ - if (!initialized) - { - const char *dbname; - - XrmInitialize(); - /* use and name of this env var is not part of the standard */ - /* implementation-dependent feature */ - dbname = getenv("XKEYSYMDB"); - if (!dbname) - dbname = KEYSYMDB; - keysymdb = XrmGetFileDatabase(dbname); - if (keysymdb) - Qkeysym[0] = XrmStringToQuark("Keysym"); - initialized = True; - } - return keysymdb; -} - -KeySym -XStringToKeysym(_Xconst char *s) -{ - register int i, n; - int h; - register Signature sig = 0; - register const char *p = s; - register int c; - register int idx; - const unsigned char *entry; - unsigned char sig1, sig2; - KeySym val; - - while ((c = *p++)) - sig = (sig << 1) + c; - i = sig % KTABLESIZE; - h = i + 1; - sig1 = (sig >> 8) & 0xff; - sig2 = sig & 0xff; - n = KMAXHASH; - while ((idx = hashString[i])) - { - entry = &_XkeyTable[idx]; - if ((entry[0] == sig1) && (entry[1] == sig2) && - !strcmp(s, (const char *)entry + 6)) - { - val = (entry[2] << 24) | (entry[3] << 16) | - (entry[4] << 8) | entry[5]; - if (!val) - val = XK_VoidSymbol; - return val; - } - if (!--n) - break; - i += h; - if (i >= KTABLESIZE) - i -= KTABLESIZE; - } - - if (!initialized) - (void)_XInitKeysymDB(); - if (keysymdb) - { - XrmValue result; - XrmRepresentation from_type; - char c; - XrmQuark names[2]; - - names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False); - names[1] = NULLQUARK; - (void)XrmQGetResource(keysymdb, names, Qkeysym, &from_type, &result); - if (result.addr && (result.size > 1)) - { - val = 0; - for (i = 0; i < result.size - 1; i++) - { - c = ((char *)result.addr)[i]; - if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; - else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; - else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; - else return NoSymbol; - } - return val; - } - } - - if (*s == 'U') { - val = 0; - for (p = &s[1]; *p; p++) { - c = *p; - if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; - else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; - else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; - else return NoSymbol; - if (val > 0x10ffff) - return NoSymbol; - } - if (val < 0x20 || (val > 0x7e && val < 0xa0)) - return NoSymbol; - if (val < 0x100) - return val; - return val | 0x01000000; - } - - if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') { - char *tmp = NULL; - val = strtoul(s, &tmp, 16); - if (val == ULONG_MAX || (tmp && *tmp != '\0')) - return NoSymbol; - else - return val; - } - - /* Stupid inconsistency between the headers and XKeysymDB: the former has - * no separating underscore, while some XF86* syms in the latter did. - * As a last ditch effort, try without. */ - if (strncmp(s, "XF86_", 5) == 0) { - KeySym ret; - char *tmp = strdup(s); - if (!tmp) - return NoSymbol; - memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1); - ret = XStringToKeysym(tmp); - free(tmp); - return ret; - } - - return NoSymbol; -} diff --git a/nx-X11/lib/X11/StrToText.c b/nx-X11/lib/X11/StrToText.c deleted file mode 100644 index ff33492f2..000000000 --- a/nx-X11/lib/X11/StrToText.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -/* - * XStringListToTextProperty - fill in TextProperty structure with - * concatenated list of null-separated strings. Return True if successful - * else False. Allocate room on end for trailing NULL, but don't include in - * count. - */ - -Status XStringListToTextProperty ( - char **argv, - int argc, - XTextProperty *textprop) -{ - register int i; - register unsigned int nbytes; - XTextProperty proto; - - /* figure out how much space we'll need for this list */ - for (i = 0, nbytes = 0; i < argc; i++) { - nbytes += (unsigned) ((argv[i] ? strlen (argv[i]) : 0) + 1); - } - - /* fill in a prototype containing results so far */ - proto.encoding = XA_STRING; - proto.format = 8; - if (nbytes) - proto.nitems = nbytes - 1; /* subtract one for trailing */ - else - proto.nitems = 0; - proto.value = NULL; - - /* build concatenated list of strings */ - if (nbytes > 0) { - register char *buf = Xmalloc (nbytes); - if (!buf) return False; - - proto.value = (unsigned char *) buf; - for (i = 0; i < argc; i++) { - char *arg = argv[i]; - - if (arg) { - (void) strcpy (buf, arg); - buf += (strlen (arg) + 1); - } else { - *buf++ = '\0'; - } - } - } else { - proto.value = Xmalloc (1); /* easier for client */ - if (!proto.value) return False; - - proto.value[0] = '\0'; - } - - /* we were successful, so set return value */ - *textprop = proto; - return True; -} diff --git a/nx-X11/lib/X11/Sync.c b/nx-X11/lib/X11/Sync.c deleted file mode 100644 index bc768d4f6..000000000 --- a/nx-X11/lib/X11/Sync.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -/* Synchronize with errors and events, optionally discarding pending events */ - -int -XSync ( - register Display *dpy, - Bool discard) -{ - xGetInputFocusReply rep; - _X_UNUSED register xReq *req; - - LockDisplay(dpy); - GetEmptyReq(GetInputFocus, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - - if (discard && dpy->head) { - _XQEvent *qelt; - - for (qelt=dpy->head; qelt; qelt=qelt->next) - qelt->qserial_num = 0; - - ((_XQEvent *)dpy->tail)->next = dpy->qfree; - dpy->qfree = (_XQEvent *)dpy->head; - dpy->head = dpy->tail = NULL; - dpy->qlen = 0; - } - UnlockDisplay(dpy); - return 1; -} - diff --git a/nx-X11/lib/X11/Synchro.c b/nx-X11/lib/X11/Synchro.c deleted file mode 100644 index 930448ee9..000000000 --- a/nx-X11/lib/X11/Synchro.c +++ /dev/null @@ -1,79 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - - -static int _XSyncFunction(register Display *dpy) -{ - XSync(dpy,0); - return 0; -} - -int (*XSynchronize(Display *dpy, int onoff))(Display *) -{ - int (*temp)(Display *); - int (*func)(Display *) = NULL; - - if (onoff) - func = _XSyncFunction; - - LockDisplay(dpy); - if (dpy->flags & XlibDisplayPrivSync) { - temp = dpy->savedsynchandler; - dpy->savedsynchandler = func; - } else { - temp = dpy->synchandler; - dpy->synchandler = func; - } - UnlockDisplay(dpy); - return (temp); -} - -int (*XSetAfterFunction( - Display *dpy, - int (*func)( - Display* - ) - ))(Display *) -{ - int (*temp)(Display *); - - LockDisplay(dpy); - if (dpy->flags & XlibDisplayPrivSync) { - temp = dpy->savedsynchandler; - dpy->savedsynchandler = func; - } else { - temp = dpy->synchandler; - dpy->synchandler = func; - } - UnlockDisplay(dpy); - return (temp); -} - diff --git a/nx-X11/lib/X11/Text.c b/nx-X11/lib/X11/Text.c deleted file mode 100644 index 223b1cf8b..000000000 --- a/nx-X11/lib/X11/Text.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawString( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, - _Xconst char *string, - int length) -{ - int Datalength = 0; - register xPolyText8Req *req; - - if (length <= 0) - return 0; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq (PolyText8, req); - req->drawable = d; - req->gc = gc->gid; - req->x = x; - req->y = y; - - - Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + length; - - - req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ - - - /* - * If the entire request does not fit into the remaining space in the - * buffer, flush the buffer first. If the request does fit into the - * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. - */ - - if (dpy->bufptr + Datalength > dpy->bufmax) - _XFlush (dpy); - - { - int nbytes; - int PartialNChars = length; - /* register xTextElt *elt; */ - char *CharacterOffset = (char *)string; - unsigned char *tbuf; - - while(PartialNChars > 254) - { - nbytes = 254 + SIZEOF(xTextElt); - BufAlloc (unsigned char *, tbuf, nbytes); -/* elt->delta = 0; - * elt->len = 254; - */ - *(unsigned char *)tbuf = 254; - *(tbuf+1) = 0; -/* memcpy ((char *) (elt + 1), CharacterOffset, 254); - */ - memcpy ((char *)tbuf+2, CharacterOffset, 254); - PartialNChars = PartialNChars - 254; - CharacterOffset += 254; - } - - if (PartialNChars) - { - nbytes = PartialNChars + SIZEOF(xTextElt); - BufAlloc (unsigned char *, tbuf, nbytes); -/* elt->delta = 0; - * elt->len = PartialNChars; - */ - *(unsigned char *)tbuf = PartialNChars; - *(tbuf+1) = 0; -/* memcpy ((char *) (elt + 1), CharacterOffset, PartialNChars); - */ - memcpy ((char *)tbuf+2, CharacterOffset, PartialNChars); - } - } - - /* Pad request out to a 32-bit boundary */ - - if (Datalength &= 3) { - char *pad; - /* - * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" - */ - length = 4 - Datalength; - BufAlloc (char *, pad, length); - /* - * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt - */ - *pad = 0; - } - - /* - * If the buffer pointer is not now pointing to a 32-bit boundary, - * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. - */ - - if ((dpy->bufptr - dpy->buffer) & 3) - _XFlush (dpy); - UnlockDisplay(dpy); - SyncHandle(); - return 0; -} diff --git a/nx-X11/lib/X11/Text16.c b/nx-X11/lib/X11/Text16.c deleted file mode 100644 index 008a3f7a5..000000000 --- a/nx-X11/lib/X11/Text16.c +++ /dev/null @@ -1,129 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XDrawString16( - register Display *dpy, - Drawable d, - GC gc, - int x, - int y, - _Xconst XChar2b *string, - int length) -{ - int Datalength = 0; - register xPolyText16Req *req; - - if (length <= 0) - return 0; - - LockDisplay(dpy); - FlushGC(dpy, gc); - GetReq (PolyText16, req); - req->drawable = d; - req->gc = gc->gid; - req->x = x; - req->y = y; - - - Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + (length << 1); - - - req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ - - - /* - * If the entire request does not fit into the remaining space in the - * buffer, flush the buffer first. If the request does fit into the - * empty buffer, then we won't have to flush it at the end to keep - * the buffer 32-bit aligned. - */ - - if (dpy->bufptr + Datalength > dpy->bufmax) - _XFlush (dpy); - - { - int nbytes; - int PartialNChars = length; - register xTextElt *elt; - XChar2b *CharacterOffset = (XChar2b *)string; - - while(PartialNChars > 254) - { - nbytes = 254 * 2 + SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); - elt->delta = 0; - elt->len = 254; - memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2); - PartialNChars = PartialNChars - 254; - CharacterOffset += 254; - } - - if (PartialNChars) - { - nbytes = PartialNChars * 2 + SIZEOF(xTextElt); - BufAlloc (xTextElt *, elt, nbytes); - elt->delta = 0; - elt->len = PartialNChars; - memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2); - } - } - - /* Pad request out to a 32-bit boundary */ - - if (Datalength &= 3) { - char *pad; - /* - * BufAlloc is a macro that uses its last argument more than - * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" - */ - length = 4 - Datalength; - BufAlloc (char *, pad, length); - /* - * if there are 3 bytes of padding, the first byte MUST be 0 - * so the pad bytes aren't mistaken for a final xTextElt - */ - *pad = 0; - } - - /* - * If the buffer pointer is not now pointing to a 32-bit boundary, - * we must flush the buffer so that it does point to a 32-bit boundary - * at the end of this routine. - */ - - if ((dpy->bufptr - dpy->buffer) & 3) - _XFlush (dpy); - UnlockDisplay(dpy); - SyncHandle(); - return 0; -} - diff --git a/nx-X11/lib/X11/TextExt.c b/nx-X11/lib/X11/TextExt.c deleted file mode 100644 index b883b01b4..000000000 --- a/nx-X11/lib/X11/TextExt.c +++ /dev/null @@ -1,234 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define min_byte2 min_char_or_byte2 -#define max_byte2 max_char_or_byte2 - - -/* - * CI_GET_ROWZERO_CHAR_INFO_2D - do the same thing as CI_GET_CHAR_INFO_1D, - * except that the font has more than one row. This is special case of more - * general version used in XTextExt16.c since row == 0. This is used when - * max_byte2 is not zero. A further optimization would do the check for - * min_byte1 being zero ahead of time. - */ - -#define CI_GET_ROWZERO_CHAR_INFO_2D(fs,col,def,cs) \ -{ \ - cs = def; \ - if (fs->min_byte1 == 0 && \ - col >= fs->min_byte2 && col <= fs->max_byte2) { \ - if (fs->per_char == NULL) { \ - cs = &fs->min_bounds; \ - } else { \ - cs = &fs->per_char[(col - fs->min_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ - } \ - } \ -} - - -/* - * XTextExtents - compute the extents of string given as a sequences of eight - * bit bytes. Since we know that the input characters will always be from the - * first row of the font (i.e. byte1 == 0), we can do some optimizations beyond - * what is done in XTextExtents16. - */ -int -XTextExtents ( - XFontStruct *fs, - _Xconst char *string, - int nchars, - int *dir, /* RETURN font information */ - int *font_ascent, /* RETURN font information */ - int *font_descent, /* RETURN font information */ - register XCharStruct *overall) /* RETURN character information */ -{ - int i; /* iterator */ - Bool singlerow = (fs->max_byte1 == 0); /* optimization */ - int nfound = 0; /* number of characters found */ - XCharStruct *def; /* info about default char */ - unsigned char *us; /* be 8bit clean */ - - if (singlerow) { /* optimization */ - CI_GET_DEFAULT_INFO_1D (fs, def); - } else { - CI_GET_DEFAULT_INFO_2D (fs, def); - } - - *dir = fs->direction; - *font_ascent = fs->ascent; - *font_descent = fs->descent; - - /* - * Iterate over the input string getting the appropriate * char struct. - * The default (which may be null if there is no def_char) will be returned - * if the character doesn't exist. On the first time * through the loop, - * assign the values to overall; otherwise, compute * the new values. - */ - - for (i = 0, us = (unsigned char *) string; i < nchars; i++, us++) { - register unsigned uc = (unsigned) *us; /* since about to do macro */ - register XCharStruct *cs; - - if (singlerow) { /* optimization */ - CI_GET_CHAR_INFO_1D (fs, uc, def, cs); - } else { - CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); - } - - if (cs) { - if (nfound++ == 0) { - *overall = *cs; - } else { - overall->ascent = max (overall->ascent, cs->ascent); - overall->descent = max (overall->descent, cs->descent); - overall->lbearing = min (overall->lbearing, - overall->width + cs->lbearing); - overall->rbearing = max (overall->rbearing, - overall->width + cs->rbearing); - overall->width += cs->width; - } - } - } - - /* - * if there were no characters, then set everything to 0 - */ - if (nfound == 0) { - overall->width = overall->ascent = overall->descent = - overall->lbearing = overall->rbearing = 0; - } - - return 0; -} - - -/* - * XTextWidth - compute the width of a string of eightbit bytes. This is a - * subset of XTextExtents. - */ -int -XTextWidth ( - XFontStruct *fs, - _Xconst char *string, - int count) -{ - int i; /* iterator */ - Bool singlerow = (fs->max_byte1 == 0); /* optimization */ - XCharStruct *def; /* info about default char */ - unsigned char *us; /* be 8bit clean */ - int width = 0; /* RETURN value */ - - if (singlerow) { /* optimization */ - CI_GET_DEFAULT_INFO_1D (fs, def); - } else { - CI_GET_DEFAULT_INFO_2D (fs, def); - } - - if (def && fs->min_bounds.width == fs->max_bounds.width) - return (fs->min_bounds.width * count); - - /* - * Iterate over all character in the input string; only consider characters - * that exist. - */ - for (i = 0, us = (unsigned char *) string; i < count; i++, us++) { - register unsigned uc = (unsigned) *us; /* since about to do macro */ - register XCharStruct *cs; - - if (singlerow) { /* optimization */ - CI_GET_CHAR_INFO_1D (fs, uc, def, cs); - } else { - CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); - } - - if (cs) width += cs->width; - } - - return width; -} - - - -/* - * _XTextHeight - compute the height of a string of eightbit bytes. - */ -int -_XTextHeight ( - XFontStruct *fs, - _Xconst char *string, - int count) -{ - int i; /* iterator */ - Bool singlerow = (fs->max_byte1 == 0); /* optimization */ - XCharStruct *def; /* info about default char */ - unsigned char *us; /* be 8bit clean */ - int height = 0; /* RETURN value */ - - if (singlerow) { /* optimization */ - CI_GET_DEFAULT_INFO_1D (fs, def); - } else { - CI_GET_DEFAULT_INFO_2D (fs, def); - } - - if (def && (fs->min_bounds.ascent == fs->max_bounds.ascent) - && (fs->min_bounds.descent == fs->max_bounds.descent)) - return ((fs->min_bounds.ascent + fs->min_bounds.descent) * count); - - /* - * Iterate over all character in the input string; only consider characters - * that exist. - */ - for (i = 0, us = (unsigned char *) string; i < count; i++, us++) { - register unsigned uc = (unsigned) *us; /* since about to do macro */ - register XCharStruct *cs; - - if (singlerow) { /* optimization */ - CI_GET_CHAR_INFO_1D (fs, uc, def, cs); - } else { - CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); - } - - if (cs) height += (cs->ascent + cs->descent); - } - - return height; -} - diff --git a/nx-X11/lib/X11/TextExt16.c b/nx-X11/lib/X11/TextExt16.c deleted file mode 100644 index 01a0f32e4..000000000 --- a/nx-X11/lib/X11/TextExt16.c +++ /dev/null @@ -1,210 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -#define min_byte2 min_char_or_byte2 -#define max_byte2 max_char_or_byte2 - -/* - * XTextExtents16 - compute the extents of string given as a sequence of - * XChar2bs. - */ -int -XTextExtents16 ( - XFontStruct *fs, - _Xconst XChar2b *string, - int nchars, - int *dir, /* RETURN font information */ - int *font_ascent, /* RETURN font information */ - int *font_descent, /* RETURN font information */ - register XCharStruct *overall) /* RETURN character information */ -{ - int i; /* iterator */ - Bool singlerow = (fs->max_byte1 == 0); /* optimization */ - int nfound = 0; /* number of characters found */ - XCharStruct *def; /* info about default char */ - - if (singlerow) { - CI_GET_DEFAULT_INFO_1D (fs, def); - } else { - CI_GET_DEFAULT_INFO_2D (fs, def); - } - - *dir = fs->direction; - *font_ascent = fs->ascent; - *font_descent = fs->descent; - - /* - * Iterate over the input string getting the appropriate * char struct. - * The default (which may be null if there is no def_char) will be returned - * if the character doesn't exist. On the first time * through the loop, - * assign the values to overall; otherwise, compute * the new values. - */ - - for (i = 0; i < nchars; i++, string++) { - register XCharStruct *cs; - unsigned int r = (unsigned int) string->byte1; /* watch for macros */ - unsigned int c = (unsigned int) string->byte2; /* watch for macros */ - - if (singlerow) { - unsigned int ind = ((r << 8) | c); /* watch for macros */ - CI_GET_CHAR_INFO_1D (fs, ind, def, cs); - } else { - CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); - } - - if (cs) { - if (nfound++ == 0) { - *overall = *cs; - } else { - overall->ascent = max (overall->ascent, cs->ascent); - overall->descent = max (overall->descent, cs->descent); - overall->lbearing = min (overall->lbearing, - overall->width + cs->lbearing); - overall->rbearing = max (overall->rbearing, - overall->width + cs->rbearing); - overall->width += cs->width; - } - } - } - - /* - * if there were no characters, then set everything to 0 - */ - if (nfound == 0) { - overall->width = overall->ascent = overall->descent = - overall->lbearing = overall->rbearing = 0; - } - - return 0; -} - - -/* - * XTextWidth16 - compute the width of sequence of XChar2bs. This is a - * subset of XTextExtents16. - */ -int -XTextWidth16 ( - XFontStruct *fs, - _Xconst XChar2b *string, - int count) -{ - int i; /* iterator */ - Bool singlerow = (fs->max_byte1 == 0); /* optimization */ - XCharStruct *def; /* info about default char */ - int width = 0; /* RETURN value */ - - if (singlerow) { - CI_GET_DEFAULT_INFO_1D (fs, def); - } else { - CI_GET_DEFAULT_INFO_2D (fs, def); - } - - if (def && fs->min_bounds.width == fs->max_bounds.width) - return (fs->min_bounds.width * count); - - /* - * Iterate over all character in the input string; only consider characters - * that exist. - */ - for (i = 0; i < count; i++, string++) { - register XCharStruct *cs; - unsigned int r = (unsigned int) string->byte1; /* watch for macros */ - unsigned int c = (unsigned int) string->byte2; /* watch for macros */ - - if (singlerow) { - unsigned int ind = ((r << 8) | c); /* watch for macros */ - CI_GET_CHAR_INFO_1D (fs, ind, def, cs); - } else { - CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); - } - - if (cs) width += cs->width; - } - - return width; -} - - -/* - * _XTextHeight16 - compute the height of sequence of XChar2bs. - */ -int -_XTextHeight16 ( - XFontStruct *fs, - _Xconst XChar2b *string, - int count) -{ - int i; /* iterator */ - Bool singlerow = (fs->max_byte1 == 0); /* optimization */ - XCharStruct *def; /* info about default char */ - int height = 0; /* RETURN value */ - - if (singlerow) { - CI_GET_DEFAULT_INFO_1D (fs, def); - } else { - CI_GET_DEFAULT_INFO_2D (fs, def); - } - - if (def && (fs->min_bounds.ascent == fs->max_bounds.ascent) - && (fs->min_bounds.descent == fs->max_bounds.descent)) - return ((fs->min_bounds.ascent + fs->min_bounds.descent) * count); - - /* - * Iterate over all character in the input string; only consider characters - * that exist. - */ - for (i = 0; i < count; i++, string++) { - register XCharStruct *cs; - unsigned int r = (unsigned int) string->byte1; /* watch for macros */ - unsigned int c = (unsigned int) string->byte2; /* watch for macros */ - - if (singlerow) { - unsigned int ind = ((r << 8) | c); /* watch for macros */ - CI_GET_CHAR_INFO_1D (fs, ind, def, cs); - } else { - CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); - } - - if (cs) height += (cs->ascent + cs->descent); - } - - return height; -} - diff --git a/nx-X11/lib/X11/TextToStr.c b/nx-X11/lib/X11/TextToStr.c deleted file mode 100644 index 03f71558b..000000000 --- a/nx-X11/lib/X11/TextToStr.c +++ /dev/null @@ -1,118 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - - -/* - * XTextPropertyToStringList - set list and count to contain data stored in - * null-separated STRING property. - */ - -Status XTextPropertyToStringList ( - XTextProperty *tp, - char ***list_return, - int *count_return) -{ - char **list; /* return value */ - int nelements; /* return value */ - register char *cp; /* temp variable */ - char *start; /* start of thing to copy */ - int i, j; /* iterator variables */ - int datalen = (int) tp->nitems; /* for convenience */ - - /* - * make sure we understand how to do it - */ - if (tp->encoding != XA_STRING || tp->format != 8) return False; - - if (datalen == 0) { - *list_return = NULL; - *count_return = 0; - return True; - } - - /* - * walk the list to figure out how many elements there are - */ - nelements = 1; /* since null-separated */ - for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { - if (*cp == '\0') nelements++; - } - - /* - * allocate list and duplicate - */ - list = Xmalloc (nelements * sizeof (char *)); - if (!list) return False; - - start = Xmalloc ((datalen + 1) * sizeof (char)); /* for */ - if (!start) { - Xfree (list); - return False; - } - - /* - * copy data - */ - memcpy (start, (char *) tp->value, tp->nitems); - start[datalen] = '\0'; - - /* - * walk down list setting value - */ - for (cp = start, i = datalen + 1, j = 0; i > 0; cp++, i--) { - if (*cp == '\0') { - list[j] = start; - start = (cp + 1); - j++; - } - } - - /* - * append final null pointer and then return data - */ - *list_return = list; - *count_return = nelements; - return True; -} - - -void XFreeStringList (char **list) -{ - if (list) { - if (list[0]) Xfree (list[0]); - Xfree (list); - list = NULL; - } -} - diff --git a/nx-X11/lib/X11/TrCoords.c b/nx-X11/lib/X11/TrCoords.c deleted file mode 100644 index 77c1f0672..000000000 --- a/nx-X11/lib/X11/TrCoords.c +++ /dev/null @@ -1,64 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -Bool XTranslateCoordinates( - register Display *dpy, - Window src_win, - Window dest_win, - int src_x, - int src_y, - int *dst_x, - int *dst_y, - Window *child) -{ - register xTranslateCoordsReq *req; - xTranslateCoordsReply rep; - - LockDisplay(dpy); - GetReq(TranslateCoords, req); - req->srcWid = src_win; - req->dstWid = dest_win; - req->srcX = src_x; - req->srcY = src_y; - if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { - UnlockDisplay(dpy); - SyncHandle(); - return(False); - } - - *child = rep.child; - *dst_x = cvtINT16toInt (rep.dstX); - *dst_y = cvtINT16toInt (rep.dstY); - UnlockDisplay(dpy); - SyncHandle(); - return ((int)rep.sameScreen); -} - diff --git a/nx-X11/lib/X11/UIThrStubs.c b/nx-X11/lib/X11/UIThrStubs.c deleted file mode 100644 index 0c913d41f..000000000 --- a/nx-X11/lib/X11/UIThrStubs.c +++ /dev/null @@ -1,157 +0,0 @@ -/* - * - * Copyright (c) 1995 David E. Wexelblat. All rights reserved - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL DAVID E. WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR - * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, - * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR - * OTHER DEALINGS IN THE SOFTWARE. - * - * Except as contained in this notice, the name of David E. Wexelblat shall - * not be used in advertising or otherwise to promote the sale, use or - * other dealings in this Software without prior written authorization - * from David E. Wexelblat. - * - */ - -/* - * Stubs for thread functions needed by the X library. Supports - * UnixWare 2.x threads; may support Solaris 2 threads as well, but not - * tested. Defining things this way removes the dependency of the X - * library on the threads library, but still supports threads if the user - * specificies the thread library on the link line. - */ - -/* - * Modifications by Carlos A M dos Santos, XFree86 Project, November 1999. - * - * Explanation from : - * The structure below is complicated, mostly because P1003.1c (the - * IEEE POSIX Threads spec) went through lots of drafts, and some - * vendors shipped systems based on draft API that were changed later. - * Unfortunately POSIX did not provide a feature-test macro for - * distinguishing each of the drafts. - */ - -#ifdef CTHREADS -#ifdef HAVE_CONFIG_H -#include -#endif -#include -typedef cthread_t xthread_t; -#define xthread_self cthread_self -#pragma weak cthread_self = _Xthr_self_stub_ -#define xmutex_init mutex_init -#pragma weak mutex_init = _Xthr_zero_stub_ -#pragma weak mutex_clear = _Xthr_zero_stub_ -#pragma weak mutex_lock = _Xthr_zero_stub_ -#pragma weak mutex_unlock = _Xthr_zero_stub_ -#pragma weak condition_init = _Xthr_zero_stub_ -#pragma weak condition_clear = _Xthr_zero_stub_ -#pragma weak condition_wait = _Xthr_zero_stub_ -#pragma weak condition_signal = _Xthr_zero_stub_ -#pragma weak condition_broadcast = _Xthr_zero_stub_ -#else /* !CTHREADS */ -#if defined(SVR4) -#include -typedef thread_t xthread_t; -#pragma weak thr_self = _Xthr_self_stub_ -#pragma weak mutex_init = _Xthr_zero_stub_ -#pragma weak mutex_destroy = _Xthr_zero_stub_ -#pragma weak mutex_lock = _Xthr_zero_stub_ -#pragma weak mutex_unlock = _Xthr_zero_stub_ -#pragma weak cond_init = _Xthr_zero_stub_ -#pragma weak cond_destroy = _Xthr_zero_stub_ -#pragma weak cond_wait = _Xthr_zero_stub_ -#pragma weak cond_signal = _Xthr_zero_stub_ -#pragma weak cond_broadcast = _Xthr_zero_stub_ -#else /* !SVR4 */ -#ifdef WIN32 -#include -#else /* !WIN32 */ -#ifdef USE_TIS_SUPPORT -#include -typedef pthread_t xthread_t; -#pragma weak tis_self = _Xthr_self_stub_ -#pragma weak tis_mutex_init = _Xthr_zero_stub_ -#pragma weak tis_mutex_destroy = _Xthr_zero_stub_ -#pragma weak tis_mutex_lock = _Xthr_zero_stub_ -#pragma weak tis_mutex_unlock = _Xthr_zero_stub_ -#pragma weak tis_cond_init = _Xthr_zero_stub_ -#pragma weak tis_cond_destroy = _Xthr_zero_stub_ -#pragma weak tis_cond_wait = _Xthr_zero_stub_ -#pragma weak tis_cond_signal = _Xthr_zero_stub_ -#pragma weak tis_cond_broadcast = _Xthr_zero_stub_ -#else -#include -typedef pthread_t xthread_t; -#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) -xthread_t pthread_self() __attribute__ ((weak, alias ("_Xthr_self_stub_"))); -int pthread_mutex_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_mutex_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_mutex_lock() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_mutex_unlock() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_cond_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_cond_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_cond_wait() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_cond_signal() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); -#else /* __GNUC__ */ -#pragma weak pthread_self = _Xthr_self_stub_ -#pragma weak pthread_mutex_init = _Xthr_zero_stub_ -#pragma weak pthread_mutex_destroy = _Xthr_zero_stub_ -#pragma weak pthread_mutex_lock = _Xthr_zero_stub_ -#pragma weak pthread_mutex_unlock = _Xthr_zero_stub_ -#pragma weak pthread_cond_init = _Xthr_zero_stub_ -#pragma weak pthread_cond_destroy = _Xthr_zero_stub_ -#pragma weak pthread_cond_wait = _Xthr_zero_stub_ -#pragma weak pthread_cond_signal = _Xthr_zero_stub_ -#pragma weak pthread_cond_broadcast = _Xthr_zero_stub_ -/* These are added for libGL */ -#pragma weak pthread_key_create = _Xthr_zero_stub_ -#pragma weak pthread_getspecific = _Xthr_zero_stub_ -#pragma weak pthread_setspecific = _Xthr_zero_stub_ -#endif /* __GNUC__ */ -#if defined(_DECTHREADS_) || defined(linux) -#pragma weak pthread_equal = _Xthr_equal_stub_ /* See Xthreads.h! */ -int -_Xthr_equal_stub_() -{ - return(1); -} -#endif /* _DECTHREADS_ || linux */ -#endif /* USE_TIS_SUPPORT */ -#endif /* WIN32 */ -#endif /* SVR4 */ -#endif /* CTHREADS */ - -static xthread_t -_Xthr_self_stub_() -{ - static xthread_t _X_no_thread_id; - - return(_X_no_thread_id); /* defined by */ -} - -static int -_Xthr_zero_stub_() -{ - return(0); -} diff --git a/nx-X11/lib/X11/UNDEFINED.c b/nx-X11/lib/X11/UNDEFINED.c deleted file mode 100644 index 7b1bdb68c..000000000 --- a/nx-X11/lib/X11/UNDEFINED.c +++ /dev/null @@ -1,131 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * UNDEFINED.c - * - * DESCRIPTION - * UNDEFINED Color Space - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" - -/* - * FORWARD DECLARATIONS - */ -static int DummyParseStringProc( - char* /* color_string */, - XcmsColor* /* color_return */ - ); -static Status ReturnZero( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ - ); - - -/* - * LOCALS VARIABLES - */ - -static Status (*(Fl_ReturnZero[]))( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ - ) = { - ReturnZero, - NULL -}; - - -/* - * GLOBALS - * Variables declared in this package that are allowed - * to be used globally. - */ - /* - * UNDEFINED Color Space - */ -XcmsColorSpace XcmsUNDEFINEDColorSpace = - { - "undefined", /* prefix */ - XcmsUndefinedFormat, /* id */ - &DummyParseStringProc, /* parseString */ - Fl_ReturnZero, /* to_CIEXYZ */ - Fl_ReturnZero /* from_CIEXYZ */ - }; - - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * ReturnZero - * - * SYNOPSIS - */ -/* ARGSUSED */ -static Status -ReturnZero( - XcmsCCC ccc /* ccc */, - XcmsColor* white /* white_point */, - XcmsColor* colors /* colors */, - unsigned int ncolors /* ncolors */ - ) -/* - * DESCRIPTION - * Does nothing. - * - * RETURNS - * 0 - * - */ -{ - return(0); -} - -static int DummyParseStringProc( - char* color_string /* color_string */, - XcmsColor* color_return /* color_return */ - ) -{ - return(0); -} - -/* ### EOF ### */ diff --git a/nx-X11/lib/X11/UndefCurs.c b/nx-X11/lib/X11/UndefCurs.c deleted file mode 100644 index 1d46ff946..000000000 --- a/nx-X11/lib/X11/UndefCurs.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUndefineCursor ( - register Display *dpy, - Window w) -{ - register xChangeWindowAttributesReq *req; - unsigned long defcurs = None; - - LockDisplay(dpy); - GetReqExtra (ChangeWindowAttributes, 4, req); - req->window = w; - req->valueMask = CWCursor; - OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), defcurs); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/UngrabBut.c b/nx-X11/lib/X11/UngrabBut.c deleted file mode 100644 index 13545ed98..000000000 --- a/nx-X11/lib/X11/UngrabBut.c +++ /dev/null @@ -1,49 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUngrabButton( - register Display *dpy, - unsigned int button, /* CARD8 */ - unsigned int modifiers, /* CARD16 */ - Window grab_window) -{ - register xUngrabButtonReq *req; - - LockDisplay(dpy); - GetReq(UngrabButton, req); - req->button = button; - req->modifiers = modifiers; - req->grabWindow = grab_window; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/UngrabKbd.c b/nx-X11/lib/X11/UngrabKbd.c deleted file mode 100644 index 974e8a324..000000000 --- a/nx-X11/lib/X11/UngrabKbd.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUngrabKeyboard ( - register Display *dpy, - Time time) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(UngrabKeyboard, time, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/UngrabKey.c b/nx-X11/lib/X11/UngrabKey.c deleted file mode 100644 index 919c4e76c..000000000 --- a/nx-X11/lib/X11/UngrabKey.c +++ /dev/null @@ -1,52 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUngrabKey( - register Display *dpy, - int key, - unsigned int modifiers, - Window grab_window) -{ - register xUngrabKeyReq *req; - - LockDisplay(dpy); - GetReq(UngrabKey, req); - req->grabWindow = grab_window; - req->modifiers = modifiers; - req->key = key; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - - - diff --git a/nx-X11/lib/X11/UngrabPtr.c b/nx-X11/lib/X11/UngrabPtr.c deleted file mode 100644 index 16417921c..000000000 --- a/nx-X11/lib/X11/UngrabPtr.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUngrabPointer( - register Display *dpy, - Time time) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(UngrabPointer, time, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/UngrabSvr.c b/nx-X11/lib/X11/UngrabSvr.c deleted file mode 100644 index 20ad9aa35..000000000 --- a/nx-X11/lib/X11/UngrabSvr.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUngrabServer ( - register Display *dpy) -{ - _X_UNUSED register xReq *req; - - LockDisplay(dpy); - GetEmptyReq(UngrabServer, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/UninsCmap.c b/nx-X11/lib/X11/UninsCmap.c deleted file mode 100644 index db574ef7c..000000000 --- a/nx-X11/lib/X11/UninsCmap.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUninstallColormap( - register Display *dpy, - Colormap cmap) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(UninstallColormap, cmap, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/UnldFont.c b/nx-X11/lib/X11/UnldFont.c deleted file mode 100644 index a4f69fee4..000000000 --- a/nx-X11/lib/X11/UnldFont.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUnloadFont( - register Display *dpy, - Font font) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(CloseFont, font, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/UnmapSubs.c b/nx-X11/lib/X11/UnmapSubs.c deleted file mode 100644 index 7490a70e9..000000000 --- a/nx-X11/lib/X11/UnmapSubs.c +++ /dev/null @@ -1,44 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUnmapSubwindows( - register Display *dpy, - Window win) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(UnmapSubwindows,win, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} diff --git a/nx-X11/lib/X11/UnmapWin.c b/nx-X11/lib/X11/UnmapWin.c deleted file mode 100644 index 51ae16319..000000000 --- a/nx-X11/lib/X11/UnmapWin.c +++ /dev/null @@ -1,45 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XUnmapWindow ( - register Display *dpy, - Window w) -{ - register xResourceReq *req; - - LockDisplay(dpy); - GetResReq(UnmapWindow, w, req); - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/VisUtil.c b/nx-X11/lib/X11/VisUtil.c deleted file mode 100644 index 17ca3631f..000000000 --- a/nx-X11/lib/X11/VisUtil.c +++ /dev/null @@ -1,252 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" -#include -/* - * This procedure returns a list of visual information structures - * that match the specified attributes given in the visual information - * template. - * - * If no visuals exist that match the specified attributes, a NULL is - * returned. - * - * The choices for visual_info_mask are: - * - * VisualNoMask - * VisualIDMask - * VisualScreenMask - * VisualDepthMask - * VisualClassMask - * VisualRedMaskMask - * VisualGreenMaskMask - * VisualBlueMaskMask - * VisualColormapSizeMask - * VisualBitsPerRGBMask - * VisualAllMask - */ - -XVisualInfo *XGetVisualInfo( - Display *dpy, - register long visual_info_mask, - register XVisualInfo *visual_info_template, - int *nitems) /* RETURN */ -{ - - register Visual *vp; - register Depth *dp; - Screen *sp; - int ii,screen_s,screen_e,total,count; - register XVisualInfo *vip,*vip_base; - - /* NOTE: NO HIGH PERFORMING CODE TO BE FOUND HERE */ - - LockDisplay(dpy); - - /* ALLOCATE THE ORIGINAL BUFFER; REALLOCED LATER IF OVERFLOW OCCURS; - FREED AT END IF NO VISUALS ARE FOUND */ - - count = 0; - total = 10; - if (! (vip_base = vip = Xmalloc(sizeof(XVisualInfo) * total))) { - UnlockDisplay(dpy); - return (XVisualInfo *) NULL; - } - - /* DETERMINE IF WE DO ALL SCREENS OR ONLY ONE */ - - screen_s = 0; - screen_e = dpy->nscreens; - if (visual_info_mask & VisualScreenMask) - { - screen_s = visual_info_template->screen; - if (screen_s < 0 || screen_s >= screen_e) - screen_e = screen_s; - else - screen_e = screen_s + 1; - } - - /* LOOP THROUGH SCREENS */ - - for (ii=screen_s; iiscreens[ii]); - - /* LOOP THROUGH DEPTHS */ - - for (dp=sp->depths; dp < (sp->depths + sp->ndepths); dp++) - { - if ((visual_info_mask & VisualDepthMask) && - (dp->depth != visual_info_template->depth)) continue; - - /* LOOP THROUGH VISUALS */ - - if (dp->visuals) { - for (vp=dp->visuals; vp<(dp->visuals + dp->nvisuals); vp++) { - if ((visual_info_mask & VisualIDMask) && - (vp->visualid != visual_info_template->visualid)) continue; - if ((visual_info_mask & VisualClassMask) && - (vp->class != visual_info_template->class)) continue; - if ((visual_info_mask & VisualRedMaskMask) && - (vp->red_mask != visual_info_template->red_mask)) continue; - if ((visual_info_mask & VisualGreenMaskMask) && - (vp->green_mask != visual_info_template->green_mask)) continue; - if ((visual_info_mask & VisualBlueMaskMask) && - (vp->blue_mask != visual_info_template->blue_mask)) continue; - if ((visual_info_mask & VisualColormapSizeMask) && - (vp->map_entries != visual_info_template->colormap_size)) continue; - if ((visual_info_mask & VisualBitsPerRGBMask) && - (vp->bits_per_rgb != visual_info_template->bits_per_rgb)) continue; - - /* YEA!!! WE FOUND A GOOD ONE */ - - if (count+1 > total) - { - XVisualInfo *old_vip_base = vip_base; - total += 10; - if (! (vip_base = Xrealloc(vip_base, - sizeof(XVisualInfo) * total))) { - Xfree(old_vip_base); - UnlockDisplay(dpy); - return (XVisualInfo *) NULL; - } - vip = &vip_base[count]; - } - - count++; - - vip->visual = _XVIDtoVisual(dpy, vp->visualid); - vip->visualid = vp->visualid; - vip->screen = ii; - vip->depth = dp->depth; - vip->class = vp->class; - vip->red_mask = vp->red_mask; - vip->green_mask = vp->green_mask; - vip->blue_mask = vp->blue_mask; - vip->colormap_size = vp->map_entries; - vip->bits_per_rgb = vp->bits_per_rgb; - - vip++; - - } /* END OF LOOP ON VISUALS */ - } /* END OF IF THERE ARE ANY VISUALS AT THIS DEPTH */ - - } /* END OF LOOP ON DEPTHS */ - - } /* END OF LOOP ON SCREENS */ - - UnlockDisplay(dpy); - - if (count) - { - *nitems = count; - return vip_base; - } - - Xfree(vip_base); - *nitems = 0; - return NULL; -} - - -/* - * This procedure will return the visual information for a visual - * that matches the specified depth and class for a screen. Since - * multiple visuals may exist that match the specified depth and - * class, which visual chosen is undefined. - * - * If a visual is found, True is returned as the function value, - * otherwise False is returned. - */ - -Status XMatchVisualInfo( - Display *dpy, - int screen, - int depth, - int class, - XVisualInfo *visual_info) /* RETURNED */ -{ - - Visual *vp; - Depth *dp; - Screen *sp; - int ii,jj; - - if (screen < 0 || screen >= dpy->nscreens) - return False; - - LockDisplay(dpy); - - sp = (Screen *)(&dpy->screens[screen]); - - dp = sp->depths; - - for (ii=0; ii < sp->ndepths; ii++) - { - - /* LOOK THROUGH DEPTHS FOR THE WANTED DEPTH */ - - if (dp->depth == depth) - { - vp = dp->visuals; - - /* LOOK THROUGH VISUALS FOR THE WANTED CLASS */ - - /* if nvisuals == 0 then vp will be NULL */ - for (jj=0; jjnvisuals; jj++) - { - if (vp->class == class) - { - visual_info->visual = _XVIDtoVisual(dpy, vp->visualid); - visual_info->visualid = vp->visualid; - visual_info->screen = screen; - visual_info->depth = depth; - visual_info->class = vp->class; - visual_info->red_mask = vp->red_mask; - visual_info->green_mask = vp->green_mask; - visual_info->blue_mask = vp->blue_mask; - visual_info->colormap_size = vp->map_entries; - visual_info->bits_per_rgb = vp->bits_per_rgb; - UnlockDisplay(dpy); - return True; - } - vp++; - } - } - - dp++; - - } - - UnlockDisplay(dpy); - - return False; - -} diff --git a/nx-X11/lib/X11/WMGeom.c b/nx-X11/lib/X11/WMGeom.c deleted file mode 100644 index 7947536f5..000000000 --- a/nx-X11/lib/X11/WMGeom.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xutil.h" - -static int _GeometryMaskToGravity( - int mask); - -/* - * This routine given a user supplied positional argument and a default - * argument (fully qualified) will return the position the window should take - * as well as the gravity to be set in the WM_NORMAL_HINTS size hints. - * Always sets all return values and returns a mask describing which fields - * were set by the user or'ed with whether or not the x and y values should - * be considered "negative". - */ - -int -XWMGeometry ( - Display *dpy, /* user's display connection */ - int screen, /* screen on which to do computation */ - _Xconst char *user_geom, /* user provided geometry spec */ - _Xconst char *def_geom, /* default geometry spec for window */ - unsigned int bwidth, /* border width */ - XSizeHints *hints, /* usually WM_NORMAL_HINTS */ - int *x_return, /* location of window */ - int *y_return, /* location of window */ - int *width_return, /* size of window */ - int *height_return, /* size of window */ - int *gravity_return) /* gravity of window */ -{ - int ux, uy; /* returned values from parse */ - unsigned int uwidth, uheight; /* returned values from parse */ - int umask; /* parse mask of returned values */ - int dx, dy; /* default values from parse */ - unsigned int dwidth, dheight; /* default values from parse */ - int dmask; /* parse mask of returned values */ - int base_width, base_height; /* valid amounts */ - int min_width, min_height; /* valid amounts */ - int width_inc, height_inc; /* valid amounts */ - int rx, ry, rwidth, rheight; /* return values */ - int rmask; /* return mask */ - - /* - * Get the base sizes and increments. Section 4.1.2.3 of the ICCCM - * states that the base and minimum sizes are defaults for each other. - * If neither is given, then the base sizes should be 0. These parameters - * control the sets of sizes that window managers should allow for the - * window according to the following formulae: - * - * width = base_width + (i * width_inc) - * height = base_height + (j * height_inc) - */ - base_width = ((hints->flags & PBaseSize) ? hints->base_width : - ((hints->flags & PMinSize) ? hints->min_width : 0)); - base_height = ((hints->flags & PBaseSize) ? hints->base_height : - ((hints->flags & PMinSize) ? hints->min_height : 0)); - min_width = ((hints->flags & PMinSize) ? hints->min_width : base_width); - min_height = ((hints->flags & PMinSize) ? hints->min_height : base_height); - width_inc = (hints->flags & PResizeInc) ? hints->width_inc : 1; - height_inc = (hints->flags & PResizeInc) ? hints->height_inc : 1; - - - /* - * parse the two geometry masks - */ - rmask = umask = XParseGeometry (user_geom, &ux, &uy, &uwidth, &uheight); - dmask = XParseGeometry (def_geom, &dx, &dy, &dwidth, &dheight); - - - /* - * get the width and height: - * 1. if user-specified, then take that value - * 2. else, if program-specified, then take that value - * 3. else, take 1 - * 4. multiply by the size increment - * 5. and add to the base size - */ - rwidth = ((((umask & WidthValue) ? uwidth : - ((dmask & WidthValue) ? dwidth : 1)) * width_inc) + - base_width); - rheight = ((((umask & HeightValue) ? uheight : - ((dmask & HeightValue) ? dheight : 1)) * height_inc) + - base_height); - - /* - * Make sure computed size is within limits. Note that we always do the - * lower bounds check since the base size (which defaults to 0) should - * be used if a minimum size isn't specified. - */ - if (rwidth < min_width) rwidth = min_width; - if (rheight < min_height) rheight = min_height; - - if (hints->flags & PMaxSize) { - if (rwidth > hints->max_width) rwidth = hints->max_width; - if (rheight > hints->max_height) rheight = hints->max_height; - } - - - /* - * Compute the location. Set the negative flags in the return mask - * (and watch out for borders), if necessary. - */ - if (umask & XValue) { - rx = ((umask & XNegative) ? - (DisplayWidth (dpy, screen) + ux - rwidth - 2 * bwidth) : ux); - } else if (dmask & XValue) { - if (dmask & XNegative) { - rx = (DisplayWidth (dpy, screen) + dx - rwidth - 2 * bwidth); - rmask |= XNegative; - } else - rx = dx; - } else { - rx = 0; /* gotta choose something... */ - } - - if (umask & YValue) { - ry = ((umask & YNegative) ? - (DisplayHeight(dpy, screen) + uy - rheight - 2 * bwidth) : uy); - } else if (dmask & YValue) { - if (dmask & YNegative) { - ry = (DisplayHeight(dpy, screen) + dy - rheight - 2 * bwidth); - rmask |= YNegative; - } else - ry = dy; - } else { - ry = 0; /* gotta choose something... */ - } - - - /* - * All finished, so set the return variables. - */ - *x_return = rx; - *y_return = ry; - *width_return = rwidth; - *height_return = rheight; - *gravity_return = _GeometryMaskToGravity (rmask); - return rmask; -} - - -static int _GeometryMaskToGravity( - int mask) -{ - switch (mask & (XNegative|YNegative)) { - case 0: - return NorthWestGravity; - case XNegative: - return NorthEastGravity; - case YNegative: - return SouthWestGravity; - default: - return SouthEastGravity; - } -} diff --git a/nx-X11/lib/X11/WMProps.c b/nx-X11/lib/X11/WMProps.c deleted file mode 100644 index e77f7ba56..000000000 --- a/nx-X11/lib/X11/WMProps.c +++ /dev/null @@ -1,139 +0,0 @@ -/* - -Copyright 1987, 1988, 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., -Copyright 1987 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, -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 Wyse not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - - -/* - * XSetWMProperties sets the following properties: - * WM_NAME type: TEXT format: varies? - * WM_ICON_NAME type: TEXT format: varies? - * WM_HINTS type: WM_HINTS format: 32 - * WM_COMMAND type: TEXT format: varies? - * WM_CLIENT_MACHINE type: TEXT format: varies? - * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 - * WM_CLASS type: STRING/STRING format: 8 - * WM_LOCALE_NAME type: STRING format: 8 - */ - -void XSetWMProperties ( - Display *dpy, - Window w, /* window to decorate */ - XTextProperty *windowName, /* name of application */ - XTextProperty *iconName, /* name string for icon */ - char **argv, /* command line */ - int argc, /* size of command line */ - XSizeHints *sizeHints, /* size hints for window in its normal state */ - XWMHints *wmHints, /* miscelaneous window manager hints */ - XClassHint *classHints) /* resource name and class */ -{ - XTextProperty textprop; - char hostName[256]; - int len = _XGetHostname (hostName, sizeof hostName); - char *locale; - - /* set names of window and icon */ - if (windowName) XSetWMName (dpy, w, windowName); - if (iconName) XSetWMIconName (dpy, w, iconName); - - /* set the command if given */ - if (argv) { - /* - * for UNIX and other operating systems which use nul-terminated - * arrays of STRINGs. - */ - XSetCommand (dpy, w, argv, argc); - } - - /* set the name of the machine on which this application is running */ - textprop.value = (unsigned char *) hostName; - textprop.encoding = XA_STRING; - textprop.format = 8; - textprop.nitems = len; - XSetWMClientMachine (dpy, w, &textprop); - - /* set hints about how geometry and window manager interaction */ - if (sizeHints) XSetWMNormalHints (dpy, w, sizeHints); - if (wmHints) XSetWMHints (dpy, w, wmHints); - if (classHints) { - XClassHint tmp; - - if (!classHints->res_name) { - tmp.res_name = getenv ("RESOURCE_NAME"); - if (!tmp.res_name && argv && argv[0]) { - /* - * UNIX uses /dir/subdir/.../basename; other operating - * systems will have to change this. - */ - char *cp = strrchr (argv[0], '/'); - tmp.res_name = (cp ? cp + 1 : argv[0]); - } - tmp.res_class = classHints->res_class; - classHints = &tmp; - } - XSetClassHint (dpy, w, classHints); - } - - locale = setlocale(LC_CTYPE, (char *)NULL); - if (locale) - XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False), - XA_STRING, 8, PropModeReplace, - (unsigned char *)locale, strlen(locale)); -} - diff --git a/nx-X11/lib/X11/WarpPtr.c b/nx-X11/lib/X11/WarpPtr.c deleted file mode 100644 index c88ca4704..000000000 --- a/nx-X11/lib/X11/WarpPtr.c +++ /dev/null @@ -1,60 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -int -XWarpPointer( - register Display *dpy, - Window src_win, - Window dest_win, - int src_x, - int src_y, - unsigned int src_width, - unsigned int src_height, - int dest_x, - int dest_y) -{ - register xWarpPointerReq *req; - - LockDisplay(dpy); - GetReq(WarpPointer, req); - req->srcWid = src_win; - req->dstWid = dest_win; - req->srcX = src_x; - req->srcY = src_y; - req->srcWidth = src_width; - req->srcHeight = src_height; - req->dstX = dest_x; - req->dstY = dest_y; - UnlockDisplay(dpy); - SyncHandle(); - return 1; -} - diff --git a/nx-X11/lib/X11/WinEvent.c b/nx-X11/lib/X11/WinEvent.c deleted file mode 100644 index 48801b739..000000000 --- a/nx-X11/lib/X11/WinEvent.c +++ /dev/null @@ -1,90 +0,0 @@ -/* - -Copyright 1985, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -extern long const _Xevent_to_mask[]; -#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) -#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ - Button4MotionMask|Button5MotionMask) - -/* - * Return the next event in the queue - * for the given window matching one of the events in the mask. - * Events earlier in the queue are not discarded. - * If none found, flush, and then wait until an event arrives which - * matches. - */ - -int -XWindowEvent ( - register Display *dpy, - Window w, /* Selected window. */ - long mask, /* Selected event mask. */ - register XEvent *event) /* XEvent to be filled in. */ -{ - register _XQEvent *prev, *qelt; - unsigned long qe_serial = 0; - - LockDisplay(dpy); - - /* Delete unclaimed cookies */ - _XFreeEventCookies(dpy); - - prev = NULL; - while (1) { - for (qelt = prev ? prev->next : dpy->head; - qelt; - prev = qelt, qelt = qelt->next) { - if ((qelt->event.xany.window == w) && - (qelt->event.type < GenericEvent) && - (_Xevent_to_mask[qelt->event.type] & mask) && - ((qelt->event.type != MotionNotify) || - (mask & AllPointers) || - (mask & AllButtons & qelt->event.xmotion.state))) { - *event = qelt->event; - _XDeq(dpy, prev, qelt); - UnlockDisplay(dpy); - return 0; - } - } - if (prev) - qe_serial = prev->qserial_num; - _XReadEvents(dpy); - if (prev && prev->qserial_num != qe_serial) - /* another thread has snatched this event */ - prev = NULL; -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockDisplay(dpy); - return 0; - } -#endif - } -} diff --git a/nx-X11/lib/X11/Window.c b/nx-X11/lib/X11/Window.c deleted file mode 100644 index 85a28f372..000000000 --- a/nx-X11/lib/X11/Window.c +++ /dev/null @@ -1,140 +0,0 @@ -/* - -Copyright 1986, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" - -void _XProcessWindowAttributes ( - register Display *dpy, - xChangeWindowAttributesReq *req, - register unsigned long valuemask, - register XSetWindowAttributes *attributes) -{ - unsigned long values[32]; - register unsigned long *value = values; - unsigned int nvalues; - - if (valuemask & CWBackPixmap) - *value++ = attributes->background_pixmap; - - if (valuemask & CWBackPixel) - *value++ = attributes->background_pixel; - - if (valuemask & CWBorderPixmap) - *value++ = attributes->border_pixmap; - - if (valuemask & CWBorderPixel) - *value++ = attributes->border_pixel; - - if (valuemask & CWBitGravity) - *value++ = attributes->bit_gravity; - - if (valuemask & CWWinGravity) - *value++ = attributes->win_gravity; - - if (valuemask & CWBackingStore) - *value++ = attributes->backing_store; - - if (valuemask & CWBackingPlanes) - *value++ = attributes->backing_planes; - - if (valuemask & CWBackingPixel) - *value++ = attributes->backing_pixel; - - if (valuemask & CWOverrideRedirect) - *value++ = attributes->override_redirect; - - if (valuemask & CWSaveUnder) - *value++ = attributes->save_under; - - if (valuemask & CWEventMask) - *value++ = attributes->event_mask; - - if (valuemask & CWDontPropagate) - *value++ = attributes->do_not_propagate_mask; - - if (valuemask & CWColormap) - *value++ = attributes->colormap; - - if (valuemask & CWCursor) - *value++ = attributes->cursor; - - req->length += (nvalues = value - values); - - nvalues <<= 2; /* watch out for macros... */ - Data32 (dpy, (long *) values, (long)nvalues); - -} - -#define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\ - CWBorderPixel|CWBitGravity|CWWinGravity|\ - CWBackingStore|CWBackingPlanes|CWBackingPixel|\ - CWOverrideRedirect|CWSaveUnder|CWEventMask|\ - CWDontPropagate|CWColormap|CWCursor) - -Window XCreateWindow( - register Display *dpy, - Window parent, - int x, - int y, - unsigned int width, - unsigned int height, - unsigned int borderWidth, - int depth, - unsigned int class, - Visual *visual, - unsigned long valuemask, - XSetWindowAttributes *attributes) -{ - Window wid; - register xCreateWindowReq *req; - - LockDisplay(dpy); - GetReq(CreateWindow, req); - req->parent = parent; - req->x = x; - req->y = y; - req->width = width; - req->height = height; - req->borderWidth = borderWidth; - req->depth = depth; - req->class = class; - if (visual == CopyFromParent) - req->visual = CopyFromParent; - else - req->visual = visual->visualid; - wid = req->wid = XAllocID(dpy); - valuemask &= AllMaskBits; - if ((req->mask = valuemask)) - _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req, - valuemask, attributes); - UnlockDisplay(dpy); - SyncHandle(); - return (wid); - } - diff --git a/nx-X11/lib/X11/Withdraw.c b/nx-X11/lib/X11/Withdraw.c deleted file mode 100644 index 9c2280234..000000000 --- a/nx-X11/lib/X11/Withdraw.c +++ /dev/null @@ -1,84 +0,0 @@ - -/*********************************************************** -Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., - - All Rights Reserved - -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 -supporting documentation, and that the name Wyse not be -used in advertising or publicity pertaining to distribution of the -software without specific, written prior permission. - -WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING -ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL -DIGITAL 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. - -******************************************************************/ -/* - -Copyright 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include - -/* - * This function instructs the window manager to change this window from - * NormalState or IconicState to Withdrawn. - */ -Status XWithdrawWindow ( - Display *dpy, - Window w, - int screen) -{ - XUnmapWindow (dpy, w); - - { - Window root = RootWindow (dpy, screen); - XUnmapEvent ev = { - .type = UnmapNotify, - .event = root, - .window = w, - .from_configure = False - }; - return (XSendEvent (dpy, root, False, - SubstructureRedirectMask|SubstructureNotifyMask, - (XEvent *)&ev)); - } -} diff --git a/nx-X11/lib/X11/WrBitF.c b/nx-X11/lib/X11/WrBitF.c deleted file mode 100644 index 47b47208f..000000000 --- a/nx-X11/lib/X11/WrBitF.c +++ /dev/null @@ -1,153 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "Xutil.h" -#include - -#define ERR_RETURN NULL - -static char *Format_Image( - XImage *image, - int *resultsize) -{ - register int x, c, b; - register char *ptr; - int y; - char *data; - int width, height; - int bytes_per_line; - - width = image->width; - height = image->height; - - bytes_per_line = (width+7)/8; - *resultsize = bytes_per_line * height; /* Calculate size of data */ - - data = Xmalloc( *resultsize ); /* Get space for data */ - if (!data) - return(ERR_RETURN); - - /* - * The slow but robust brute force method of converting the image: - */ - ptr = data; - c = 0; b=1; - for (y=0; y -#endif -#include -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -XkbInternAtomFunc _XkbInternAtomFunc = XInternAtom; -XkbGetAtomNameFunc _XkbGetAtomNameFunc = XGetAtomName; - -Bool -XkbQueryExtension(Display *dpy, - int *opcodeReturn, - int *eventBaseReturn, - int *errorBaseReturn, - int *majorReturn, - int *minorReturn) -{ - if (!XkbUseExtension(dpy, majorReturn, minorReturn)) - return False; - if (opcodeReturn) - *opcodeReturn = dpy->xkb_info->codes->major_opcode; - if (eventBaseReturn) - *eventBaseReturn = dpy->xkb_info->codes->first_event; - if (errorBaseReturn) - *errorBaseReturn = dpy->xkb_info->codes->first_error; - if (majorReturn) - *majorReturn = dpy->xkb_info->srv_major; - if (minorReturn) - *minorReturn = dpy->xkb_info->srv_minor; - return True; -} - -Bool -XkbLibraryVersion(int *libMajorRtrn, int *libMinorRtrn) -{ - int supported; - - if (*libMajorRtrn != XkbMajorVersion) { - /* version 0.65 is (almost) compatible with 1.00 */ - if ((XkbMajorVersion == 1) && - (((*libMajorRtrn) == 0) && ((*libMinorRtrn) == 65))) - supported = True; - else - supported = False; - } - else { - supported = True; - } - - *libMajorRtrn = XkbMajorVersion; - *libMinorRtrn = XkbMinorVersion; - return supported; -} - -Bool -XkbSelectEvents(Display *dpy, - unsigned int deviceSpec, - unsigned int affect, - unsigned int selectAll) -{ - register xkbSelectEventsReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - xkbi->selected_events &= ~affect; - xkbi->selected_events |= (affect & selectAll); - GetReq(kbSelectEvents, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSelectEvents; - req->deviceSpec = deviceSpec; - req->affectWhich = (CARD16) affect; - req->clear = affect & (~selectAll); - req->selectAll = affect & selectAll; - if (affect & XkbMapNotifyMask) { - req->affectMap = XkbAllMapComponentsMask; - /* the implicit support needs the client info */ - /* even if the client itself doesn't want it */ - if (selectAll & XkbMapNotifyMask) - req->map = XkbAllMapEventsMask; - else - req->map = XkbAllClientInfoMask; - if (selectAll & XkbMapNotifyMask) - xkbi->selected_map_details = XkbAllMapEventsMask; - else - xkbi->selected_map_details = 0; - } - if (affect & XkbNewKeyboardNotifyMask) { - if (selectAll & XkbNewKeyboardNotifyMask) - xkbi->selected_nkn_details = XkbAllNewKeyboardEventsMask; - else - xkbi->selected_nkn_details = 0; - if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) { - /* we want it, even if the client doesn't. Don't mess */ - /* around with details -- ask for all of them and throw */ - /* away the ones we don't need */ - req->selectAll |= XkbNewKeyboardNotifyMask; - } - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbSelectEventDetails(Display *dpy, - unsigned deviceSpec, - unsigned eventType, - unsigned long int affect, - unsigned long int details) -{ - register xkbSelectEventsReq *req; - XkbInfoPtr xkbi; - int size = 0; - char *out; - union { - CARD8 *c8; - CARD16 *c16; - CARD32 *c32; - } u; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - if (affect & details) - xkbi->selected_events |= (1 << eventType); - else - xkbi->selected_events &= ~(1 << eventType); - GetReq(kbSelectEvents, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSelectEvents; - req->deviceSpec = deviceSpec; - req->clear = req->selectAll = 0; - if (eventType == XkbMapNotify) { - /* we need all of the client info, even if the application */ - /* doesn't. Make sure that we always request the stuff */ - /* that the implicit support needs, and just filter out anything */ - /* the client doesn't want later */ - req->affectMap = (CARD16) affect; - req->map = (CARD16) details | (XkbAllClientInfoMask & affect); - req->affectWhich = XkbMapNotifyMask; - xkbi->selected_map_details &= ~affect; - xkbi->selected_map_details |= (details & affect); - } - else { - req->affectMap = req->map = 0; - req->affectWhich = (1 << eventType); - switch (eventType) { - case XkbNewKeyboardNotify: - xkbi->selected_nkn_details &= ~affect; - xkbi->selected_nkn_details |= (details & affect); - if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) - details = (affect & XkbAllNewKeyboardEventsMask); - case XkbStateNotify: - case XkbNamesNotify: - case XkbAccessXNotify: - case XkbExtensionDeviceNotify: - size = 2; - req->length += 1; - break; - case XkbControlsNotify: - case XkbIndicatorStateNotify: - case XkbIndicatorMapNotify: - size = 4; - req->length += 2; - break; - case XkbBellNotify: - case XkbActionMessage: - case XkbCompatMapNotify: - size = 1; - req->length += 1; - break; - } - BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4); - - u.c8 = (CARD8 *) out; - if (size == 2) { - u.c16[0] = (CARD16) affect; - u.c16[1] = (CARD16) details; - } - else if (size == 4) { - u.c32[0] = (CARD32) affect; - u.c32[1] = (CARD32) details; - } - else { - u.c8[0] = (CARD8) affect; - u.c8[1] = (CARD8) details; - } - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbLockModifiers(Display *dpy, - unsigned int deviceSpec, - unsigned int affect, - unsigned int values) -{ - register xkbLatchLockStateReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbLatchLockState, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbLatchLockState; - req->deviceSpec = deviceSpec; - req->affectModLocks = affect; - req->modLocks = values; - req->lockGroup = False; - req->groupLock = 0; - - req->affectModLatches = req->modLatches = 0; - req->latchGroup = False; - req->groupLatch = 0; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbLatchModifiers(Display *dpy, - unsigned int deviceSpec, - unsigned int affect, - unsigned int values) -{ - register xkbLatchLockStateReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbLatchLockState, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbLatchLockState; - req->deviceSpec = deviceSpec; - - req->affectModLatches = affect; - req->modLatches = values; - req->latchGroup = False; - req->groupLatch = 0; - - req->affectModLocks = req->modLocks = 0; - req->lockGroup = False; - req->groupLock = 0; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbLockGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) -{ - register xkbLatchLockStateReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbLatchLockState, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbLatchLockState; - req->deviceSpec = deviceSpec; - req->affectModLocks = 0; - req->modLocks = 0; - req->lockGroup = True; - req->groupLock = group; - - req->affectModLatches = req->modLatches = 0; - req->latchGroup = False; - req->groupLatch = 0; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbLatchGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) -{ - register xkbLatchLockStateReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbLatchLockState, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbLatchLockState; - req->deviceSpec = deviceSpec; - - req->affectModLatches = 0; - req->modLatches = 0; - req->latchGroup = True; - req->groupLatch = group; - - req->affectModLocks = req->modLocks = 0; - req->lockGroup = False; - req->groupLock = 0; - - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -unsigned -XkbSetXlibControls(Display *dpy, unsigned affect, unsigned values) -{ - if (!dpy->xkb_info) - XkbUseExtension(dpy, NULL, NULL); - if (!dpy->xkb_info) - return 0; - affect &= XkbLC_AllControls; - dpy->xkb_info->xlib_ctrls &= ~affect; - dpy->xkb_info->xlib_ctrls |= (affect & values); - return dpy->xkb_info->xlib_ctrls; -} - -unsigned -XkbGetXlibControls(Display *dpy) -{ - if (!dpy->xkb_info) - XkbUseExtension(dpy, NULL, NULL); - if (!dpy->xkb_info) - return 0; - return dpy->xkb_info->xlib_ctrls; -} - -unsigned int -XkbXlibControlsImplemented(void) -{ - return XkbLC_AllControls & ~XkbLC_AllComposeControls; -} - -Bool -XkbSetDebuggingFlags(Display *dpy, - unsigned int mask, - unsigned int flags, - char *msg, - unsigned int ctrls_mask, - unsigned int ctrls, - unsigned int *rtrn_flags, - unsigned int *rtrn_ctrls) -{ - register xkbSetDebuggingFlagsReq *req; - xkbSetDebuggingFlagsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetDebuggingFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetDebuggingFlags; - req->affectFlags = mask; - req->flags = flags; - req->affectCtrls = ctrls_mask; - req->ctrls = ctrls; - - if (msg) { - char *out; - - req->msgLength = (unsigned short) strlen(msg) + 1; - req->length += (req->msgLength + (unsigned) 3) >> 2; - BufAlloc(char *, out, ((req->msgLength + (unsigned) 3) / 4) * 4); - memcpy(out, msg, req->msgLength); - } - else - req->msgLength = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - if (rtrn_flags) - *rtrn_flags = rep.currentFlags; - if (rtrn_ctrls) - *rtrn_ctrls = rep.currentCtrls; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbComputeEffectiveMap(XkbDescPtr xkb, - XkbKeyTypePtr type, - unsigned char *map_rtrn) -{ - register int i; - unsigned tmp; - XkbKTMapEntryPtr entry = NULL; - - if ((!xkb) || (!type) || (!xkb->server)) - return False; - - if (type->mods.vmods != 0) { - if (!XkbVirtualModsToReal(xkb, type->mods.vmods, &tmp)) - return False; - - type->mods.mask = tmp | type->mods.real_mods; - entry = type->map; - for (i = 0; i < type->map_count; i++, entry++) { - tmp = 0; - if (entry->mods.vmods != 0) { - if (!XkbVirtualModsToReal(xkb, entry->mods.vmods, &tmp)) - return False; - if (tmp == 0) { - entry->active = False; - continue; - } - } - entry->active = True; - entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask; - } - } - else { - type->mods.mask = type->mods.real_mods; - } - if (map_rtrn != NULL) { - bzero(map_rtrn, type->mods.mask + 1); - for (i = 0; i < type->map_count; i++) { - if (entry && entry->active) { - map_rtrn[type->map[i].mods.mask] = type->map[i].level; - } - } - } - return True; -} - -Status -XkbGetState(Display *dpy, unsigned deviceSpec, XkbStatePtr rtrn) -{ - register xkbGetStateReq *req; - xkbGetStateReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbGetState, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetState; - req->deviceSpec = deviceSpec; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadImplementation; - } - rtrn->mods = rep.mods; - rtrn->base_mods = rep.baseMods; - rtrn->latched_mods = rep.latchedMods; - rtrn->locked_mods = rep.lockedMods; - rtrn->group = rep.group; - rtrn->base_group = rep.baseGroup; - rtrn->latched_group = rep.latchedGroup; - rtrn->locked_group = rep.lockedGroup; - rtrn->compat_state = rep.compatState; - rtrn->grab_mods = rep.grabMods; - rtrn->compat_grab_mods = rep.compatGrabMods; - rtrn->lookup_mods = rep.lookupMods; - rtrn->compat_lookup_mods = rep.compatLookupMods; - rtrn->ptr_buttons = rep.ptrBtnState; - UnlockDisplay(dpy); - SyncHandle(); - return Success; -} - -Bool -XkbSetDetectableAutoRepeat(Display *dpy, Bool detectable, Bool *supported) -{ - register xkbPerClientFlagsReq *req; - xkbPerClientFlagsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbPerClientFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbPerClientFlags; - req->deviceSpec = XkbUseCoreKbd; - req->change = XkbPCF_DetectableAutoRepeatMask; - if (detectable) - req->value = XkbPCF_DetectableAutoRepeatMask; - else - req->value = 0; - req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - if (supported != NULL) - *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0); - return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0); -} - -Bool -XkbGetDetectableAutoRepeat(Display *dpy, Bool *supported) -{ - register xkbPerClientFlagsReq *req; - xkbPerClientFlagsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbPerClientFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbPerClientFlags; - req->deviceSpec = XkbUseCoreKbd; - req->change = 0; - req->value = 0; - req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - if (supported != NULL) - *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0); - return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0); -} - -Bool -XkbSetAutoResetControls(Display *dpy, - unsigned changes, - unsigned *auto_ctrls, - unsigned *auto_values) -{ - register xkbPerClientFlagsReq *req; - xkbPerClientFlagsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbPerClientFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbPerClientFlags; - req->change = XkbPCF_AutoResetControlsMask; - req->deviceSpec = XkbUseCoreKbd; - req->value = XkbPCF_AutoResetControlsMask; - req->ctrlsToChange = changes; - req->autoCtrls = *auto_ctrls; - req->autoCtrlValues = *auto_values; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - *auto_ctrls = rep.autoCtrls; - *auto_values = rep.autoCtrlValues; - return ((rep.value & XkbPCF_AutoResetControlsMask) != 0); -} - -Bool -XkbGetAutoResetControls(Display *dpy, - unsigned *auto_ctrls, - unsigned *auto_ctrl_values) -{ - register xkbPerClientFlagsReq *req; - xkbPerClientFlagsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbPerClientFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbPerClientFlags; - req->deviceSpec = XkbUseCoreKbd; - req->change = 0; - req->value = 0; - req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - if (auto_ctrls) - *auto_ctrls = rep.autoCtrls; - if (auto_ctrl_values) - *auto_ctrl_values = rep.autoCtrlValues; - return ((rep.value & XkbPCF_AutoResetControlsMask) != 0); -} - -Bool -XkbSetPerClientControls(Display *dpy, unsigned change, unsigned *values) -{ - register xkbPerClientFlagsReq *req; - xkbPerClientFlagsReply rep; - XkbInfoPtr xkbi; - unsigned value_hold = *values; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || - (change & ~(XkbPCF_GrabsUseXKBStateMask | - XkbPCF_LookupStateWhenGrabbed | - XkbPCF_SendEventUsesXKBState))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbPerClientFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbPerClientFlags; - req->change = change; - req->deviceSpec = XkbUseCoreKbd; - req->value = *values; - req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - *values = rep.value; - return ((rep.value & value_hold) != 0); -} - -Bool -XkbGetPerClientControls(Display *dpy, unsigned *ctrls) -{ - register xkbPerClientFlagsReq *req; - xkbPerClientFlagsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || - (ctrls == NULL)) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbPerClientFlags, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbPerClientFlags; - req->deviceSpec = XkbUseCoreKbd; - req->change = 0; - req->value = 0; - req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - *ctrls = (rep.value & (XkbPCF_GrabsUseXKBStateMask | - XkbPCF_LookupStateWhenGrabbed | - XkbPCF_SendEventUsesXKBState)); - return (True); -} - -Display * -XkbOpenDisplay(char *name, - int *ev_rtrn, - int *err_rtrn, - int *major_rtrn, - int *minor_rtrn, - int *reason) -{ - Display *dpy; - int major_num, minor_num; - - if ((major_rtrn != NULL) && (minor_rtrn != NULL)) { - if (!XkbLibraryVersion(major_rtrn, minor_rtrn)) { - if (reason != NULL) - *reason = XkbOD_BadLibraryVersion; - return NULL; - } - } - else { - major_num = XkbMajorVersion; - minor_num = XkbMinorVersion; - major_rtrn = &major_num; - minor_rtrn = &minor_num; - } - dpy = XOpenDisplay(name); - if (dpy == NULL) { - if (reason != NULL) - *reason = XkbOD_ConnectionRefused; - return NULL; - } - if (!XkbQueryExtension(dpy, NULL, ev_rtrn, err_rtrn, - major_rtrn, minor_rtrn)) { - if (reason != NULL) { - if ((*major_rtrn != 0) || (*minor_rtrn != 0)) - *reason = XkbOD_BadServerVersion; - else - *reason = XkbOD_NonXkbServer; - } - XCloseDisplay(dpy); - return NULL; - } - if (reason != NULL) - *reason = XkbOD_Success; - return dpy; -} - -void -XkbSetAtomFuncs(XkbInternAtomFunc getAtom, XkbGetAtomNameFunc getName) -{ - _XkbInternAtomFunc = (getAtom ? getAtom : XInternAtom); - _XkbGetAtomNameFunc = (getName ? getName : XGetAtomName); - return; -} diff --git a/nx-X11/lib/X11/XKBAlloc.c b/nx-X11/lib/X11/XKBAlloc.c deleted file mode 100644 index 9c3430c1a..000000000 --- a/nx-X11/lib/X11/XKBAlloc.c +++ /dev/null @@ -1,495 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include -#include "Xlibint.h" -#include "XKBlibint.h" -#include -#include -#include "XKBlibint.h" - - -/***===================================================================***/ - -/*ARGSUSED*/ -Status -XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI) -{ - XkbCompatMapPtr compat; - XkbSymInterpretRec *prev_interpret; - - if (!xkb) - return BadMatch; - if (xkb->compat) { - if (xkb->compat->size_si >= nSI) - return Success; - compat = xkb->compat; - compat->size_si = nSI; - if (compat->sym_interpret == NULL) - compat->num_si = 0; - prev_interpret = compat->sym_interpret; - compat->sym_interpret = _XkbTypedRealloc(compat->sym_interpret, - nSI, XkbSymInterpretRec); - if (compat->sym_interpret == NULL) { - _XkbFree(prev_interpret); - compat->size_si = compat->num_si = 0; - return BadAlloc; - } - if (compat->num_si != 0) { - _XkbClearElems(compat->sym_interpret, compat->num_si, - compat->size_si - 1, XkbSymInterpretRec); - } - return Success; - } - compat = _XkbTypedCalloc(1, XkbCompatMapRec); - if (compat == NULL) - return BadAlloc; - if (nSI > 0) { - compat->sym_interpret = _XkbTypedCalloc(nSI, XkbSymInterpretRec); - if (!compat->sym_interpret) { - _XkbFree(compat); - return BadAlloc; - } - } - compat->size_si = nSI; - compat->num_si = 0; - bzero((char *) &compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec)); - xkb->compat = compat; - return Success; -} - - -void -XkbFreeCompatMap(XkbDescPtr xkb, unsigned which, Bool freeMap) -{ - register XkbCompatMapPtr compat; - - if ((xkb == NULL) || (xkb->compat == NULL)) - return; - compat = xkb->compat; - if (freeMap) - which = XkbAllCompatMask; - if (which & XkbGroupCompatMask) - bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec)); - if (which & XkbSymInterpMask) { - if ((compat->sym_interpret) && (compat->size_si > 0)) - _XkbFree(compat->sym_interpret); - compat->size_si = compat->num_si = 0; - compat->sym_interpret = NULL; - } - if (freeMap) { - _XkbFree(compat); - xkb->compat = NULL; - } - return; -} - -/***===================================================================***/ - -Status -XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) -{ - XkbNamesPtr names; - - if (xkb == NULL) - return BadMatch; - if (xkb->names == NULL) { - xkb->names = _XkbTypedCalloc(1, XkbNamesRec); - if (xkb->names == NULL) - return BadAlloc; - } - names = xkb->names; - if ((which & XkbKTLevelNamesMask) && (xkb->map != NULL) && - (xkb->map->types != NULL)) { - register int i; - XkbKeyTypePtr type = xkb->map->types; - - for (i = 0; i < xkb->map->num_types; i++, type++) { - if (type->level_names == NULL) { - type->level_names = _XkbTypedCalloc(type->num_levels, Atom); - if (type->level_names == NULL) - return BadAlloc; - } - } - } - if ((which & XkbKeyNamesMask) && (names->keys == NULL)) { - if ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code)) - return BadValue; - names->keys = _XkbTypedCalloc((xkb->max_key_code + 1), XkbKeyNameRec); - if (names->keys == NULL) - return BadAlloc; - } - if ((which & XkbKeyAliasesMask) && (nTotalAliases > 0)) { - if (names->key_aliases == NULL) { - names->key_aliases = _XkbTypedCalloc(nTotalAliases, XkbKeyAliasRec); - } - else if (nTotalAliases > names->num_key_aliases) { - XkbKeyAliasRec *prev_aliases = names->key_aliases; - - names->key_aliases = _XkbTypedRealloc(names->key_aliases, - nTotalAliases, - XkbKeyAliasRec); - if (names->key_aliases != NULL) { - _XkbClearElems(names->key_aliases, names->num_key_aliases, - nTotalAliases - 1, XkbKeyAliasRec); - } - else { - _XkbFree(prev_aliases); - } - } - if (names->key_aliases == NULL) { - names->num_key_aliases = 0; - return BadAlloc; - } - names->num_key_aliases = nTotalAliases; - } - if ((which & XkbRGNamesMask) && (nTotalRG > 0)) { - if (names->radio_groups == NULL) { - names->radio_groups = _XkbTypedCalloc(nTotalRG, Atom); - } - else if (nTotalRG > names->num_rg) { - Atom *prev_radio_groups = names->radio_groups; - - names->radio_groups = - _XkbTypedRealloc(names->radio_groups, nTotalRG, Atom); - if (names->radio_groups != NULL) { - _XkbClearElems(names->radio_groups, names->num_rg, nTotalRG - 1, - Atom); - } - else { - _XkbFree(prev_radio_groups); - } - } - if (names->radio_groups == NULL) - return BadAlloc; - names->num_rg = nTotalRG; - } - return Success; -} - -void -XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap) -{ - XkbNamesPtr names; - - if ((xkb == NULL) || (xkb->names == NULL)) - return; - names = xkb->names; - if (freeMap) - which = XkbAllNamesMask; - if (which & XkbKTLevelNamesMask) { - XkbClientMapPtr map = xkb->map; - - if ((map != NULL) && (map->types != NULL)) { - register int i; - register XkbKeyTypePtr type; - - type = map->types; - for (i = 0; i < map->num_types; i++, type++) { - if (type->level_names != NULL) { - _XkbFree(type->level_names); - type->level_names = NULL; - } - } - } - } - if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { - _XkbFree(names->keys); - names->keys = NULL; - names->num_keys = 0; - } - if ((which & XkbKeyAliasesMask) && (names->key_aliases)) { - _XkbFree(names->key_aliases); - names->key_aliases = NULL; - names->num_key_aliases = 0; - } - if ((which & XkbRGNamesMask) && (names->radio_groups)) { - _XkbFree(names->radio_groups); - names->radio_groups = NULL; - names->num_rg = 0; - } - if (freeMap) { - _XkbFree(names); - xkb->names = NULL; - } - return; -} - -/***===================================================================***/ - -/*ARGSUSED*/ -Status -XkbAllocControls(XkbDescPtr xkb, unsigned which) -{ - if (xkb == NULL) - return BadMatch; - - if (xkb->ctrls == NULL) { - xkb->ctrls = _XkbTypedCalloc(1, XkbControlsRec); - if (!xkb->ctrls) - return BadAlloc; - } - return Success; -} - -/*ARGSUSED*/ -void -XkbFreeControls(XkbDescPtr xkb, unsigned which, Bool freeMap) -{ - if (freeMap && (xkb != NULL) && (xkb->ctrls != NULL)) { - _XkbFree(xkb->ctrls); - xkb->ctrls = NULL; - } - return; -} - -/***===================================================================***/ - -Status -XkbAllocIndicatorMaps(XkbDescPtr xkb) -{ - if (xkb == NULL) - return BadMatch; - if (xkb->indicators == NULL) { - xkb->indicators = _XkbTypedCalloc(1, XkbIndicatorRec); - if (!xkb->indicators) - return BadAlloc; - } - return Success; -} - -void -XkbFreeIndicatorMaps(XkbDescPtr xkb) -{ - if ((xkb != NULL) && (xkb->indicators != NULL)) { - _XkbFree(xkb->indicators); - xkb->indicators = NULL; - } - return; -} - -/***====================================================================***/ - -XkbDescRec * -XkbAllocKeyboard(void) -{ - XkbDescRec *xkb; - - xkb = _XkbTypedCalloc(1, XkbDescRec); - if (xkb) - xkb->device_spec = XkbUseCoreKbd; - return xkb; -} - -void -XkbFreeKeyboard(XkbDescPtr xkb, unsigned which, Bool freeAll) -{ - if (xkb == NULL) - return; - if (freeAll) - which = XkbAllComponentsMask; - if (which & XkbClientMapMask) - XkbFreeClientMap(xkb, XkbAllClientInfoMask, True); - if (which & XkbServerMapMask) - XkbFreeServerMap(xkb, XkbAllServerInfoMask, True); - if (which & XkbCompatMapMask) - XkbFreeCompatMap(xkb, XkbAllCompatMask, True); - if (which & XkbIndicatorMapMask) - XkbFreeIndicatorMaps(xkb); - if (which & XkbNamesMask) - XkbFreeNames(xkb, XkbAllNamesMask, True); - if ((which & XkbGeometryMask) && (xkb->geom != NULL)) - XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); - if (which & XkbControlsMask) - XkbFreeControls(xkb, XkbAllControlsMask, True); - if (freeAll) - _XkbFree(xkb); - return; -} - -/***====================================================================***/ - -XkbDeviceLedInfoPtr -XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi, unsigned ledClass, unsigned ledId) -{ - XkbDeviceLedInfoPtr devli; - register int i; - - if ((!devi) || (!XkbSingleXIClass(ledClass)) || (!XkbSingleXIId(ledId))) - return NULL; - for (i = 0, devli = devi->leds; i < devi->num_leds; i++, devli++) { - if ((devli->led_class == ledClass) && (devli->led_id == ledId)) - return devli; - } - if (devi->num_leds >= devi->sz_leds) { - XkbDeviceLedInfoRec *prev_leds = devi->leds; - - if (devi->sz_leds > 0) - devi->sz_leds *= 2; - else - devi->sz_leds = 1; - devi->leds = _XkbTypedRealloc(devi->leds, devi->sz_leds, - XkbDeviceLedInfoRec); - if (!devi->leds) { - _XkbFree(prev_leds); - devi->sz_leds = devi->num_leds = 0; - return NULL; - } - i = devi->num_leds; - for (devli = &devi->leds[i]; i < devi->sz_leds; i++, devli++) { - bzero(devli, sizeof(XkbDeviceLedInfoRec)); - devli->led_class = XkbXINone; - devli->led_id = XkbXINone; - } - } - devli = &devi->leds[devi->num_leds++]; - bzero(devli, sizeof(XkbDeviceLedInfoRec)); - devli->led_class = ledClass; - devli->led_id = ledId; - return devli; -} - -Status -XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi, unsigned newTotal) -{ - XkbAction *prev_btn_acts; - - if ((!devi) || (newTotal > 255)) - return BadValue; - if ((devi->btn_acts != NULL) && (newTotal == devi->num_btns)) - return Success; - if (newTotal == 0) { - if (devi->btn_acts != NULL) { - _XkbFree(devi->btn_acts); - devi->btn_acts = NULL; - } - devi->num_btns = 0; - return Success; - } - prev_btn_acts = devi->btn_acts; - devi->btn_acts = _XkbTypedRealloc(devi->btn_acts, newTotal, XkbAction); - if (devi->btn_acts == NULL) { - _XkbFree(prev_btn_acts); - devi->num_btns = 0; - return BadAlloc; - } - if (newTotal > devi->num_btns) { - XkbAction *act; - - act = &devi->btn_acts[devi->num_btns]; - bzero((char *) act, (newTotal - devi->num_btns) * sizeof(XkbAction)); - } - devi->num_btns = newTotal; - return Success; -} - -/*ARGSUSED*/ -XkbDeviceInfoPtr -XkbAllocDeviceInfo(unsigned deviceSpec, unsigned nButtons, unsigned szLeds) -{ - XkbDeviceInfoPtr devi; - - devi = _XkbTypedCalloc(1, XkbDeviceInfoRec); - if (devi != NULL) { - devi->device_spec = deviceSpec; - devi->has_own_state = False; - devi->num_btns = 0; - devi->btn_acts = NULL; - if (nButtons > 0) { - devi->num_btns = nButtons; - devi->btn_acts = _XkbTypedCalloc(nButtons, XkbAction); - if (!devi->btn_acts) { - _XkbFree(devi); - return NULL; - } - } - devi->dflt_kbd_fb = XkbXINone; - devi->dflt_led_fb = XkbXINone; - devi->num_leds = 0; - devi->sz_leds = 0; - devi->leds = NULL; - if (szLeds > 0) { - devi->sz_leds = szLeds; - devi->leds = _XkbTypedCalloc(szLeds, XkbDeviceLedInfoRec); - if (!devi->leds) { - _XkbFree(devi->btn_acts); - _XkbFree(devi); - return NULL; - } - } - } - return devi; -} - - -void -XkbFreeDeviceInfo(XkbDeviceInfoPtr devi, unsigned which, Bool freeDevI) -{ - if (devi) { - if (freeDevI) { - which = XkbXI_AllDeviceFeaturesMask; - if (devi->name) { - _XkbFree(devi->name); - devi->name = NULL; - } - } - if ((which & XkbXI_ButtonActionsMask) && (devi->btn_acts)) { - _XkbFree(devi->btn_acts); - devi->num_btns = 0; - devi->btn_acts = NULL; - } - if ((which & XkbXI_IndicatorsMask) && (devi->leds)) { - register int i; - - if ((which & XkbXI_IndicatorsMask) == XkbXI_IndicatorsMask) { - _XkbFree(devi->leds); - devi->sz_leds = devi->num_leds = 0; - devi->leds = NULL; - } - else { - XkbDeviceLedInfoPtr devli; - - for (i = 0, devli = devi->leds; i < devi->num_leds; - i++, devli++) { - if (which & XkbXI_IndicatorMapsMask) - bzero((char *) &devli->maps[0], sizeof(devli->maps)); - else - bzero((char *) &devli->names[0], sizeof(devli->names)); - } - } - } - if (freeDevI) - _XkbFree(devi); - } - return; -} diff --git a/nx-X11/lib/X11/XKBBell.c b/nx-X11/lib/X11/XKBBell.c deleted file mode 100644 index d3e3a57ff..000000000 --- a/nx-X11/lib/X11/XKBBell.c +++ /dev/null @@ -1,179 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include -#include "XKBlibint.h" - - -Bool -XkbDeviceBell(Display *dpy, - Window window, - int deviceID, - int bellClass, - int bellID, - int percent, - Atom name) -{ - register xkbBellReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbBell, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbBell; - req->deviceSpec = deviceID; - req->window = (CARD32) window; - req->bellClass = (CARD16) bellClass; - req->bellID = (CARD16) bellID; - req->percent = percent; - req->forceSound = False; - req->eventOnly = False; - req->pitch = 0; - req->duration = 0; - req->name = (CARD32) name; - req->pad1 = 0; - req->pad2 = 0; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbForceDeviceBell(Display *dpy, - int deviceID, - int bellClass, - int bellID, - int percent) -{ - register xkbBellReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbBell, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbBell; - req->deviceSpec = deviceID; - req->window = (CARD32) None; - req->bellClass = (CARD16) bellClass; - req->bellID = (CARD16) bellID; - req->percent = percent; - req->forceSound = True; - req->eventOnly = False; - req->pitch = 0; - req->duration = 0; - req->name = None; - req->pad1 = 0; - req->pad2 = 0; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbDeviceBellEvent(Display *dpy, - Window window, - int deviceID, - int bellClass, - int bellID, - int percent, - Atom name) -{ - register xkbBellReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbBell, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbBell; - req->deviceSpec = deviceID; - req->window = (CARD32) window; - req->bellClass = (CARD16) bellClass; - req->bellID = (CARD16) bellID; - req->percent = percent; - req->forceSound = False; - req->eventOnly = True; - req->pitch = 0; - req->duration = 0; - req->name = (CARD32) name; - req->pad1 = 0; - req->pad2 = 0; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbBell(Display *dpy, Window window, int percent, Atom name) -{ - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { - XBell(dpy, percent); - return False; - } - return XkbDeviceBell(dpy, window, XkbUseCoreKbd, - XkbDfltXIClass, XkbDfltXIId, percent, name); -} - -Bool -XkbForceBell(Display *dpy, int percent) -{ - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { - XBell(dpy, percent); - return False; - } - return XkbForceDeviceBell(dpy, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, - percent); -} - -Bool -XkbBellEvent(Display *dpy, Window window, int percent, Atom name) -{ - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { - return False; - } - /* class 0 = KbdFeedbackClass (X Input Extension) */ - return XkbDeviceBellEvent(dpy, window, XkbUseCoreKbd, - XkbDfltXIClass, XkbDfltXIId, percent, name); -} diff --git a/nx-X11/lib/X11/XKBBind.c b/nx-X11/lib/X11/XKBBind.c deleted file mode 100644 index c679dc552..000000000 --- a/nx-X11/lib/X11/XKBBind.c +++ /dev/null @@ -1,784 +0,0 @@ -/* - -Copyright 1985, 1987, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - - /* the new monsters ate the old ones */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "XKBlib.h" -#include -#include -#include -#include -#include - -#include -#include "XKBlibint.h" - -#define AllMods (ShiftMask|LockMask|ControlMask| \ - Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) - -static int _XkbLoadDpy(Display *dpy); - -struct _XKeytrans { - struct _XKeytrans *next; /* next on list */ - char *string; /* string to return when the time comes */ - int len; /* length of string (since NULL is legit) */ - KeySym key; /* keysym rebound */ - unsigned int state; /* modifier state */ - KeySym *modifiers; /* modifier keysyms you want */ - int mlen; /* length of modifier list */ -}; - -KeySym -XkbKeycodeToKeysym(Display *dpy, -#if NeedWidePrototypes - unsigned int kc, -#else - KeyCode kc, -#endif - int group, - int level) -{ - XkbDescRec *xkb; - - if (_XkbUnavailable(dpy)) - return NoSymbol; - - _XkbCheckPendingRefresh(dpy, dpy->xkb_info); - - xkb = dpy->xkb_info->desc; - if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) - return NoSymbol; - - if ((group < 0) || (level < 0) || (group >= XkbKeyNumGroups(xkb, kc))) - return NoSymbol; - if (level >= XkbKeyGroupWidth(xkb, kc, group)) { - /* for compatibility with the core protocol, _always_ allow */ - /* two symbols in the first two groups. If either of the */ - /* two is of type ONE_LEVEL, just replicate the first symbol */ - if ((group > XkbGroup2Index) || (XkbKeyGroupWidth(xkb, kc, group) != 1) - || (level != 1)) { - return NoSymbol; - } - level = 0; - } - return XkbKeySymEntry(xkb, kc, level, group); -} - -KeySym -XKeycodeToKeysym(Display *dpy, -#if NeedWidePrototypes - unsigned int kc, -#else - KeyCode kc, -#endif - int col) -{ - XkbDescRec *xkb; - - if (_XkbUnavailable(dpy)) - return _XKeycodeToKeysym(dpy, kc, col); - - _XkbCheckPendingRefresh(dpy, dpy->xkb_info); - - xkb = dpy->xkb_info->desc; - if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) - return NoSymbol; - - if (col > 3) { - int lastSym, tmp, nGrp; - - lastSym = 3; - nGrp = XkbKeyNumGroups(xkb, kc); - if ((nGrp > 0) && - ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup1Index)) > 2)) { - if (col <= (lastSym + tmp - 2)) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index, - col - lastSym + 2); - lastSym += tmp - 2; - } - if ((nGrp > 1) && - ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup2Index)) > 2)) { - if (col <= (lastSym + tmp - 2)) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup2Index, - col - lastSym + 2); - lastSym += tmp - 2; - } - if (nGrp > 2) { - tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup3Index); - if (col <= lastSym + tmp) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup3Index, - col - lastSym); - lastSym += tmp; - } - if (nGrp > 3) { - tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup4Index); - if (col <= lastSym + tmp) - return XkbKeycodeToKeysym(dpy, kc, XkbGroup4Index, - col - lastSym); - } - return NoSymbol; - } - return XkbKeycodeToKeysym(dpy, kc, (col >> 1), (col & 1)); -} - -KeyCode -XKeysymToKeycode(Display *dpy, KeySym ks) -{ - register int i, j, gotOne; - - if (_XkbUnavailable(dpy)) - return _XKeysymToKeycode(dpy, ks); - _XkbCheckPendingRefresh(dpy, dpy->xkb_info); - - j = 0; - do { - register XkbDescRec *xkb = dpy->xkb_info->desc; - gotOne = 0; - for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) { - if (j < (int) XkbKeyNumSyms(xkb, i)) { - gotOne = 1; - if ((XkbKeySym(xkb, i, j) == ks)) - return i; - } - } - j++; - } while (gotOne); - return 0; -} - -static int -_XkbComputeModmap(Display *dpy) -{ - register XkbDescPtr xkb; - - xkb = dpy->xkb_info->desc; - if (XkbGetUpdatedMap(dpy, XkbModifierMapMask, xkb) == Success) - return 1; - return 0; -} - -unsigned -XkbKeysymToModifiers(Display *dpy, KeySym ks) -{ - XkbDescRec *xkb; - register int i, j; - register KeySym *pSyms; - CARD8 mods; - - if (_XkbUnavailable(dpy)) - return _XKeysymToModifiers(dpy, ks); - _XkbCheckPendingRefresh(dpy, dpy->xkb_info); - - if (_XkbNeedModmap(dpy->xkb_info) && (!_XkbComputeModmap(dpy))) - return _XKeysymToModifiers(dpy, ks); - - xkb = dpy->xkb_info->desc; - mods = 0; - for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { - pSyms = XkbKeySymsPtr(xkb, i); - for (j = XkbKeyNumSyms(xkb, i) - 1; j >= 0; j--) { - if (pSyms[j] == ks) { - mods |= xkb->map->modmap[i]; - break; - } - } - } - return mods; -} - -KeySym -XLookupKeysym(register XKeyEvent * event, int col) -{ - Display *dpy = event->display; - - if (_XkbUnavailable(dpy)) - return _XLookupKeysym(event, col); - _XkbCheckPendingRefresh(dpy, dpy->xkb_info); - return XKeycodeToKeysym(dpy, event->keycode, col); -} - - /* - * Not a public entry point -- XkbTranslateKey is an obsolete name - * that is preserved here so that functions linked against the old - * version will continue to work in a shared library environment. - */ -int -XkbTranslateKey(register Display *dpy, - KeyCode key, - register unsigned int mods, - unsigned int *mods_rtrn, - KeySym *keysym_rtrn); - -int -XkbTranslateKey(register Display *dpy, - KeyCode key, - register unsigned int mods, - unsigned int *mods_rtrn, - KeySym *keysym_rtrn) -{ - return XkbLookupKeySym(dpy, key, mods, mods_rtrn, keysym_rtrn); -} - -Bool -XkbLookupKeySym(register Display *dpy, - KeyCode key, - register unsigned int mods, - unsigned int *mods_rtrn, - KeySym *keysym_rtrn) -{ - if (_XkbUnavailable(dpy)) - return _XTranslateKey(dpy, key, mods, mods_rtrn, keysym_rtrn); - _XkbCheckPendingRefresh(dpy, dpy->xkb_info); - return XkbTranslateKeyCode(dpy->xkb_info->desc, key, mods, mods_rtrn, - keysym_rtrn); -} - -Bool -XkbTranslateKeyCode(register XkbDescPtr xkb, - KeyCode key, - register unsigned int mods, - unsigned int *mods_rtrn, - KeySym *keysym_rtrn) -{ - XkbKeyTypeRec *type; - int col, nKeyGroups; - unsigned preserve, effectiveGroup; - KeySym *syms; - - if (mods_rtrn != NULL) - *mods_rtrn = 0; - - nKeyGroups = XkbKeyNumGroups(xkb, key); - if ((!XkbKeycodeInRange(xkb, key)) || (nKeyGroups == 0)) { - if (keysym_rtrn != NULL) - *keysym_rtrn = NoSymbol; - return False; - } - - syms = XkbKeySymsPtr(xkb, key); - - /* find the offset of the effective group */ - col = 0; - effectiveGroup = XkbGroupForCoreState(mods); - if (effectiveGroup >= nKeyGroups) { - unsigned groupInfo = XkbKeyGroupInfo(xkb, key); - - switch (XkbOutOfRangeGroupAction(groupInfo)) { - default: - effectiveGroup %= nKeyGroups; - break; - case XkbClampIntoRange: - effectiveGroup = nKeyGroups - 1; - break; - case XkbRedirectIntoRange: - effectiveGroup = XkbOutOfRangeGroupNumber(groupInfo); - if (effectiveGroup >= nKeyGroups) - effectiveGroup = 0; - break; - } - } - col = effectiveGroup * XkbKeyGroupsWidth(xkb, key); - type = XkbKeyKeyType(xkb, key, effectiveGroup); - - preserve = 0; - if (type->map) { /* find the column (shift level) within the group */ - register int i; - register XkbKTMapEntryPtr entry; - - for (i = 0, entry = type->map; i < type->map_count; i++, entry++) { - if ((entry->active) && - ((mods & type->mods.mask) == entry->mods.mask)) { - col += entry->level; - if (type->preserve) - preserve = type->preserve[i].mask; - break; - } - } - } - - if (keysym_rtrn != NULL) - *keysym_rtrn = syms[col]; - if (mods_rtrn) { - *mods_rtrn = type->mods.mask & (~preserve); - /* The Motif VTS doesn't get the help callback called if help - * is bound to Shift+, and it appears as though it - * is XkbTranslateKeyCode that is causing the problem. The - * core X version of XTranslateKey always OR's in ShiftMask - * and LockMask for mods_rtrn, so this "fix" keeps this behavior - * and solves the VTS problem. - */ - if ((xkb->dpy) && (xkb->dpy->xkb_info) && - (xkb->dpy->xkb_info-> - xlib_ctrls & XkbLC_AlwaysConsumeShiftAndLock)) { - *mods_rtrn |= (ShiftMask | LockMask); - } - } - return (syms[col] != NoSymbol); -} - -Status -XkbRefreshKeyboardMapping(register XkbMapNotifyEvent * event) -{ - Display *dpy = event->display; - XkbInfoPtr xkbi; - - if (_XkbUnavailable(dpy)) { - _XRefreshKeyboardMapping((XMappingEvent *) event); - return Success; - } - xkbi = dpy->xkb_info; - - if (((event->type & 0x7f) - xkbi->codes->first_event) != XkbEventCode) - return BadMatch; - if (event->xkb_type == XkbNewKeyboardNotify) { - _XkbReloadDpy(dpy); - return Success; - } - if (event->xkb_type == XkbMapNotify) { - XkbMapChangesRec changes; - Status rtrn; - - if (xkbi->flags & XkbMapPending) - changes = xkbi->changes; - else - bzero(&changes, sizeof(changes)); - XkbNoteMapChanges(&changes, event, XKB_XLIB_MAP_MASK); - if ((rtrn = XkbGetMapChanges(dpy, xkbi->desc, &changes)) != Success) { -#ifdef DEBUG - fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); -#endif - xkbi->changes = changes; - } - else if (xkbi->flags & XkbMapPending) { - xkbi->flags &= ~XkbMapPending; - bzero(&xkbi->changes, sizeof(XkbMapChangesRec)); - } - return rtrn; - } - return BadMatch; -} - -int -XRefreshKeyboardMapping(register XMappingEvent * event) -{ - XkbEvent *xkbevent = (XkbEvent *) event; - Display *dpy = event->display; - XkbMapChangesRec changes; - XkbInfoPtr xkbi; - - /* always do this for input methods, which still use the old keymap */ - (void) _XRefreshKeyboardMapping(event); - - if (_XkbUnavailable(dpy)) - return 1; - - xkbi = dpy->xkb_info; - - if (((event->type & 0x7f) - xkbi->codes->first_event) == XkbEventCode) - return XkbRefreshKeyboardMapping(&xkbevent->map); - - if (xkbi->flags & XkbXlibNewKeyboard) { - _XkbReloadDpy(dpy); - return 1; - } - - if ((xkbi->flags & XkbMapPending) || (event->request == MappingKeyboard)) { - if (xkbi->flags & XkbMapPending) { - changes = xkbi->changes; - _XkbNoteCoreMapChanges(&changes, event, XKB_XLIB_MAP_MASK); - } - else { - bzero(&changes, sizeof(changes)); - changes.changed = XkbKeySymsMask; - if (xkbi->desc->min_key_code < xkbi->desc->max_key_code) { - changes.first_key_sym = xkbi->desc->min_key_code; - changes.num_key_syms = xkbi->desc->max_key_code - - xkbi->desc->min_key_code + 1; - } - else { - changes.first_key_sym = event->first_keycode; - changes.num_key_syms = event->count; - } - } - - if (XkbGetMapChanges(dpy, xkbi->desc, &changes) != Success) { -#ifdef DEBUG - fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); - if (changes.changed & XkbKeyTypesMask) { - int first = changes.first_type; - int last = changes.first_type + changes.num_types - 1; - - fprintf(stderr, " types: %d..%d\n", first, last); - } - if (changes.changed & XkbKeySymsMask) { - int first = changes.first_key_sym; - int last = changes.first_key_sym + changes.num_key_syms - 1; - - fprintf(stderr, " symbols: %d..%d\n", first, last); - } - if (changes.changed & XkbKeyActionsMask) { - int first = changes.first_key_act; - int last = changes.first_key_act + changes.num_key_acts - 1; - - fprintf(stderr, " acts: %d..%d\n", first, last); - } - if (changes.changed & XkbKeyBehaviorsMask) { - int first = changes.first_key_behavior; - int last = first + changes.num_key_behaviors - 1; - - fprintf(stderr, " behaviors: %d..%d\n", first, last); - } - if (changes.changed & XkbVirtualModsMask) { - fprintf(stderr, "virtual mods: 0x%04x\n", changes.vmods); - } - if (changes.changed & XkbExplicitComponentsMask) { - int first = changes.first_key_explicit; - int last = first + changes.num_key_explicit - 1; - - fprintf(stderr, " explicit: %d..%d\n", first, last); - } -#endif - } - LockDisplay(dpy); - if (xkbi->flags & XkbMapPending) { - xkbi->flags &= ~XkbMapPending; - bzero(&xkbi->changes, sizeof(XkbMapChangesRec)); - } - UnlockDisplay(dpy); - } - if (event->request == MappingModifier) { - LockDisplay(dpy); - if (xkbi->desc->map->modmap) { - _XkbFree(xkbi->desc->map->modmap); - xkbi->desc->map->modmap = NULL; - } - if (dpy->key_bindings) { - register struct _XKeytrans *p; - - for (p = dpy->key_bindings; p; p = p->next) { - register int i; - - p->state = 0; - if (p->mlen > 0) { - for (i = 0; i < p->mlen; i++) { - p->state |= XkbKeysymToModifiers(dpy, p->modifiers[i]); - } - if (p->state) - p->state &= AllMods; - else - p->state = AnyModifier; - } - } - } - UnlockDisplay(dpy); - } - return 1; -} - -static int -_XkbLoadDpy(Display *dpy) -{ - XkbInfoPtr xkbi; - unsigned query, oldEvents; - XkbDescRec *desc; - - if (!XkbUseExtension(dpy, NULL, NULL)) - return 0; - - xkbi = dpy->xkb_info; - query = XkbAllClientInfoMask; - desc = XkbGetMap(dpy, query, XkbUseCoreKbd); - if (!desc) { -#ifdef DEBUG - fprintf(stderr, "Warning! XkbGetMap failed!\n"); -#endif - return 0; - } - LockDisplay(dpy); - xkbi->desc = desc; - - UnlockDisplay(dpy); - oldEvents = xkbi->selected_events; - if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) { - XkbSelectEventDetails(dpy, xkbi->desc->device_spec, - XkbNewKeyboardNotify, - XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask, - XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask); - } - XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, - XkbAllClientInfoMask, XkbAllClientInfoMask); - LockDisplay(dpy); - xkbi->selected_events = oldEvents; - UnlockDisplay(dpy); - return 1; -} - -void -_XkbReloadDpy(Display *dpy) -{ - XkbInfoPtr xkbi; - XkbDescRec *desc; - unsigned oldDeviceID; - - if (_XkbUnavailable(dpy)) - return; - - xkbi = dpy->xkb_info; - LockDisplay(dpy); - if (xkbi->desc) { - oldDeviceID = xkbi->desc->device_spec; - XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); - xkbi->desc = NULL; - xkbi->flags &= ~(XkbMapPending | XkbXlibNewKeyboard); - xkbi->changes.changed = 0; - } - else - oldDeviceID = XkbUseCoreKbd; - UnlockDisplay(dpy); - desc = XkbGetMap(dpy, XkbAllClientInfoMask, XkbUseCoreKbd); - if (!desc) - return; - LockDisplay(dpy); - xkbi->desc = desc; - UnlockDisplay(dpy); - - if (desc->device_spec != oldDeviceID) { - /* transfer(?) event masks here */ -#ifdef NOTYET - unsigned oldEvents; - - oldEvents = xkbi->selected_events; - XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, - XkbAllMapComponentsMask, XkbAllClientInfoMask); - LockDisplay(dpy); - xkbi->selected_events = oldEvents; - UnlockDisplay(dpy); -#endif - } - return; -} - -int -XkbTranslateKeySym(register Display *dpy, - register KeySym *sym_rtrn, - unsigned int mods, - char *buffer, - int nbytes, - int *extra_rtrn) -{ - register XkbInfoPtr xkb; - XkbKSToMBFunc cvtr; - XPointer priv; - char tmp[4]; - int n; - - xkb = dpy->xkb_info; - if (!xkb->cvt.KSToMB) { - _XkbGetConverters(_XkbGetCharset(), &xkb->cvt); - _XkbGetConverters("ISO8859-1", &xkb->latin1cvt); - } - - if (extra_rtrn) - *extra_rtrn = 0; - - if ((buffer == NULL) || (nbytes == 0)) { - buffer = tmp; - nbytes = 4; - } - - /* see if symbol rebound, if so, return that string. */ - n = XkbLookupKeyBinding(dpy, *sym_rtrn, mods, buffer, nbytes, extra_rtrn); - if (n) - return n; - - if (nbytes > 0) - buffer[0] = '\0'; - - if (xkb->cvt.KSToUpper && (mods & LockMask)) { - *sym_rtrn = (*xkb->cvt.KSToUpper) (*sym_rtrn); - } - if (xkb->xlib_ctrls & XkbLC_ForceLatin1Lookup) { - cvtr = xkb->latin1cvt.KSToMB; - priv = xkb->latin1cvt.KSToMBPriv; - } - else { - cvtr = xkb->cvt.KSToMB; - priv = xkb->cvt.KSToMBPriv; - } - - n = (*cvtr) (priv, *sym_rtrn, buffer, nbytes, extra_rtrn); - - if ((!xkb->cvt.KSToUpper) && (mods & LockMask)) { - register int i; - int change; - - for (i = change = 0; i < n; i++) { - char ch = toupper(buffer[i]); - change = (change || (buffer[i] != ch)); - buffer[i] = ch; - } - if (change) { - if (n == 1) - *sym_rtrn = - (*xkb->cvt.MBToKS) (xkb->cvt.MBToKSPriv, buffer, n, NULL); - else - *sym_rtrn = NoSymbol; - } - } - - if (mods & ControlMask) { - if (n == 1) { - buffer[0] = XkbToControl(buffer[0]); - if (nbytes > 1) - buffer[1] = '\0'; - return 1; - } - if (nbytes > 0) - buffer[0] = '\0'; - return 0; - } - return n; -} - -int -XLookupString(register XKeyEvent *event, - char *buffer, - int nbytes, - KeySym *keysym, - XComposeStatus *status) -{ - KeySym dummy; - int rtrnLen; - unsigned int new_mods; - Display *dpy = event->display; - - if (keysym == NULL) - keysym = &dummy; - if (!XkbLookupKeySym(dpy, event->keycode, event->state, &new_mods, keysym)) - return 0; - new_mods = (event->state & (~new_mods)); - - /* find the group where a symbol can be converted to control one */ - if (new_mods & ControlMask && *keysym > 0x7F && - (dpy->xkb_info->xlib_ctrls & XkbLC_ControlFallback)) { - XKeyEvent tmp_ev = *event; - KeySym tmp_keysym; - unsigned int tmp_new_mods; - - if (_XkbUnavailable(dpy)) { - tmp_ev.state = event->state ^ dpy->mode_switch; - if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, - &tmp_new_mods, &tmp_keysym) && - tmp_keysym != NoSymbol && tmp_keysym < 0x80) { - *keysym = tmp_keysym; - } - } - else { - int n = XkbKeyNumGroups(dpy->xkb_info->desc, tmp_ev.keycode); - int i; - - for (i = 0; i < n; i++) { - if (XkbGroupForCoreState(event->state) == i) - continue; - tmp_ev.state = XkbBuildCoreState(tmp_ev.state, i); - if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, - &tmp_new_mods, &tmp_keysym) && - tmp_keysym != NoSymbol && tmp_keysym < 0x80) { - *keysym = tmp_keysym; - new_mods = (event->state & (~tmp_new_mods)); - break; - } - } - } - } - - /* We *should* use the new_mods (which does not contain any modifiers */ - /* that were used to compute the symbol here, but pre-XKB XLookupString */ - /* did not and we have to remain compatible. Sigh. */ - if (_XkbUnavailable(dpy) || - (dpy->xkb_info->xlib_ctrls & XkbLC_ConsumeLookupMods) == 0) - new_mods = event->state; - - rtrnLen = XkbLookupKeyBinding(dpy, *keysym, new_mods, buffer, nbytes, NULL); - if (rtrnLen > 0) - return rtrnLen; - - return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL); -} - - -int -XkbLookupKeyBinding(Display *dpy, - register KeySym sym, - unsigned int mods, - char *buffer, - int nbytes, - int *extra_rtrn) -{ - register struct _XKeytrans *p; - - if (extra_rtrn) - *extra_rtrn = 0; - for (p = dpy->key_bindings; p; p = p->next) { - if (((mods & AllMods) == p->state) && (sym == p->key)) { - int tmp = p->len; - - if (tmp > nbytes) { - if (extra_rtrn) - *extra_rtrn = (tmp - nbytes); - tmp = nbytes; - } - memcpy(buffer, p->string, tmp); - if (tmp < nbytes) - buffer[tmp] = '\0'; - return tmp; - } - } - return 0; -} - -char -XkbToControl(char ch) -{ - register char c = ch; - - if ((c >= '@' && c < '\177') || c == ' ') - c &= 0x1F; - else if (c == '2') - c = '\000'; - else if (c >= '3' && c <= '7') - c -= ('3' - '\033'); - else if (c == '8') - c = '\177'; - else if (c == '/') - c = '_' & 0x1F; - return c; -} diff --git a/nx-X11/lib/X11/XKBCompat.c b/nx-X11/lib/X11/XKBCompat.c deleted file mode 100644 index a5222b56e..000000000 --- a/nx-X11/lib/X11/XKBCompat.c +++ /dev/null @@ -1,252 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#define NEED_MAP_READERS -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -Status -_XkbReadGetCompatMapReply(Display *dpy, - xkbGetCompatMapReply *rep, - XkbDescPtr xkb, - int *nread_rtrn) -{ - register int i; - XkbReadBufferRec buf; - - if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) - return BadAlloc; - - if (nread_rtrn) - *nread_rtrn = (int) rep->length * 4; - - i = rep->firstSI + rep->nSI; - if ((!xkb->compat) && - (XkbAllocCompatMap(xkb, XkbAllCompatMask, i) != Success)) - return BadAlloc; - - if (rep->nSI != 0) { - XkbSymInterpretRec *syms; - xkbSymInterpretWireDesc *wire; - - wire = (xkbSymInterpretWireDesc *) _XkbGetReadBufferPtr(&buf, - rep->nSI * SIZEOF (xkbSymInterpretWireDesc)); - if (wire == NULL) - goto BAILOUT; - syms = &xkb->compat->sym_interpret[rep->firstSI]; - - for (i = 0; i < rep->nSI; i++, syms++, wire++) { - syms->sym = wire->sym; - syms->mods = wire->mods; - syms->match = wire->match; - syms->virtual_mod = wire->virtualMod; - syms->flags = wire->flags; - syms->act = *((XkbAnyAction *) &wire->act); - } - xkb->compat->num_si += rep->nSI; - } - - if (rep->groups & XkbAllGroupsMask) { - register unsigned bit, nGroups; - xkbModsWireDesc *wire; - - for (i = 0, nGroups = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { - if (rep->groups & bit) - nGroups++; - } - wire = (xkbModsWireDesc *) - _XkbGetReadBufferPtr(&buf, nGroups * SIZEOF(xkbModsWireDesc)); - if (wire == NULL) - goto BAILOUT; - for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { - if ((rep->groups & bit) == 0) - continue; - xkb->compat->groups[i].mask = wire->mask; - xkb->compat->groups[i].real_mods = wire->realMods; - xkb->compat->groups[i].vmods = wire->virtualMods; - wire++; - } - } - i = _XkbFreeReadBuffer(&buf); - if (i) - fprintf(stderr, "CompatMapReply! Bad length (%d extra bytes)\n", i); - if (i || buf.error) - return BadLength; - return Success; - BAILOUT: - _XkbFreeReadBuffer(&buf); - return BadLength; -} - -Status -XkbGetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb) -{ - register xkbGetCompatMapReq *req; - xkbGetCompatMapReply rep; - Status status; - XkbInfoPtr xkbi; - - if ((!dpy) || (!xkb) || (dpy->flags & XlibDisplayNoXkb) || - ((xkb->dpy != NULL) && (xkb->dpy != dpy)) || - (!dpy->xkb_info && (!XkbUseExtension(dpy, NULL, NULL)))) - return BadAccess; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbGetCompatMap, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetCompatMap; - req->deviceSpec = xkb->device_spec; - if (which & XkbSymInterpMask) - req->getAllSI = True; - else - req->getAllSI = False; - req->firstSI = req->nSI = 0; - - if (which & XkbGroupCompatMask) - req->groups = XkbAllGroupsMask; - else - req->groups = 0; - - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadLength; - } - if (xkb->dpy == NULL) - xkb->dpy = dpy; - if (xkb->device_spec == XkbUseCoreKbd) - xkb->device_spec = rep.deviceID; - - status = _XkbReadGetCompatMapReply(dpy, &rep, xkb, NULL); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -static Bool -_XkbWriteSetCompatMap(Display *dpy, xkbSetCompatMapReq *req, XkbDescPtr xkb) -{ - CARD16 firstSI; - CARD16 nSI; - int size; - register int i, nGroups; - register unsigned bit; - unsigned groups; - char *buf; - - firstSI = req->firstSI; - nSI = req->nSI; - size = nSI * SIZEOF(xkbSymInterpretWireDesc); - nGroups = 0; - groups = req->groups; - if (groups & XkbAllGroupsMask) { - for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { - if (groups & bit) - nGroups++; - } - size += SIZEOF(xkbModsWireDesc) * nGroups; - } - req->length += size / 4; - BufAlloc(char *, buf, size); - - if (!buf) - return False; - - if (nSI) { - XkbSymInterpretPtr sym = &xkb->compat->sym_interpret[firstSI]; - xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) buf; - - for (i = 0; i < nSI; i++, wire++, sym++) { - wire->sym = (CARD32) sym->sym; - wire->mods = sym->mods; - wire->match = sym->match; - wire->flags = sym->flags; - wire->virtualMod = sym->virtual_mod; - memcpy(&wire->act, &sym->act, sz_xkbActionWireDesc); - } - buf += nSI * SIZEOF(xkbSymInterpretWireDesc); - } - if (groups & XkbAllGroupsMask) { - xkbModsWireDesc *out = (xkbModsWireDesc *) buf; - - for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { - if ((groups & bit) != 0) { - out->mask = xkb->compat->groups[i].mask; - out->realMods = xkb->compat->groups[i].real_mods; - out->virtualMods = xkb->compat->groups[i].vmods; - out++; - } - } - buf += nGroups * SIZEOF(xkbModsWireDesc); - } - return True; -} - -Bool -XkbSetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb, - Bool updateActions) -{ - register xkbSetCompatMapReq *req; - Status ok; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || (dpy != xkb->dpy) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!xkb->compat) || - ((which & XkbSymInterpMask) && (!xkb->compat->sym_interpret))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetCompatMap, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetCompatMap; - req->deviceSpec = xkb->device_spec; - req->recomputeActions = updateActions; - if (which & XkbSymInterpMask) { - req->truncateSI = True; - req->firstSI = 0; - req->nSI = xkb->compat->num_si; - } - else { - req->truncateSI = False; - req->firstSI = 0; - req->nSI = 0; - } - if (which & XkbGroupCompatMask) - req->groups = XkbAllGroupsMask; - else - req->groups = 0; - ok = _XkbWriteSetCompatMap(dpy, req, xkb); - UnlockDisplay(dpy); - SyncHandle(); - return ok; -} diff --git a/nx-X11/lib/X11/XKBCtrls.c b/nx-X11/lib/X11/XKBCtrls.c deleted file mode 100644 index 2e8546d92..000000000 --- a/nx-X11/lib/X11/XKBCtrls.c +++ /dev/null @@ -1,351 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include -#include "XKBlibint.h" - - -static xkbSetControlsReq * -_XkbGetSetControlsReq(Display *dpy, XkbInfoPtr xkbi, unsigned int deviceSpec) -{ - xkbSetControlsReq *req; - - GetReq(kbSetControls, req); - bzero(req, SIZEOF(xkbSetControlsReq)); - req->reqType = xkbi->codes->major_opcode; - req->length = (SIZEOF(xkbSetControlsReq) >> 2); - req->xkbReqType = X_kbSetControls; - req->deviceSpec = deviceSpec; - return req; -} - -Bool -XkbSetAutoRepeatRate(Display *dpy, - unsigned int deviceSpec, - unsigned int timeout, - unsigned int interval) -{ - register xkbSetControlsReq *req; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); - req->changeCtrls = XkbRepeatKeysMask; - req->repeatDelay = timeout; - req->repeatInterval = interval; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbGetAutoRepeatRate(Display *dpy, - unsigned int deviceSpec, - unsigned int *timeoutp, - unsigned int *intervalp) -{ - register xkbGetControlsReq *req; - xkbGetControlsReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbGetControls, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetControls; - req->deviceSpec = deviceSpec; - if (!_XReply(dpy, (xReply *) &rep, - (SIZEOF(xkbGetControlsReply) - SIZEOF(xReply)) >> 2, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - *timeoutp = rep.repeatDelay; - *intervalp = rep.repeatInterval; - return True; -} - -Bool -XkbSetServerInternalMods(Display *dpy, - unsigned deviceSpec, - unsigned affectReal, - unsigned realValues, - unsigned affectVirtual, - unsigned virtualValues) -{ - register xkbSetControlsReq *req; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); - req->affectInternalMods = affectReal; - req->internalMods = realValues; - req->affectInternalVMods = affectVirtual; - req->internalVMods = virtualValues; - req->changeCtrls = XkbInternalModsMask; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbSetIgnoreLockMods(Display *dpy, - unsigned int deviceSpec, - unsigned affectReal, - unsigned realValues, - unsigned affectVirtual, - unsigned virtualValues) -{ - register xkbSetControlsReq *req; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); - req->affectIgnoreLockMods = affectReal; - req->ignoreLockMods = realValues; - req->affectIgnoreLockVMods = affectVirtual; - req->ignoreLockVMods = virtualValues; - req->changeCtrls = XkbIgnoreLockModsMask; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbChangeEnabledControls(Display *dpy, - unsigned deviceSpec, - unsigned affect, - unsigned values) -{ - register xkbSetControlsReq *req; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); - req->affectEnabledCtrls = affect; - req->enabledCtrls = (affect & values); - req->changeCtrls = XkbControlsEnabledMask; - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Status -XkbGetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) -{ - register xkbGetControlsReq *req; - xkbGetControlsReply rep; - XkbControlsPtr ctrls; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - if ((!xkb) || (!which)) - return BadMatch; - - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbGetControls, req); - if (!xkb->ctrls) { - xkb->ctrls = _XkbTypedCalloc(1, XkbControlsRec); - if (!xkb->ctrls) { - UnlockDisplay(dpy); - SyncHandle(); - return BadAlloc; - } - } - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetControls; - req->deviceSpec = xkb->device_spec; - if (!_XReply(dpy, (xReply *) &rep, - (SIZEOF(xkbGetControlsReply) - SIZEOF(xReply)) >> 2, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadImplementation; - } - if (xkb->device_spec == XkbUseCoreKbd) - xkb->device_spec = rep.deviceID; - ctrls = xkb->ctrls; - if (which & XkbControlsEnabledMask) - ctrls->enabled_ctrls = rep.enabledCtrls; - ctrls->num_groups = rep.numGroups; - if (which & XkbGroupsWrapMask) - ctrls->groups_wrap = rep.groupsWrap; - if (which & XkbInternalModsMask) { - ctrls->internal.mask = rep.internalMods; - ctrls->internal.real_mods = rep.internalRealMods; - ctrls->internal.vmods = rep.internalVMods; - } - if (which & XkbIgnoreLockModsMask) { - ctrls->ignore_lock.mask = rep.ignoreLockMods; - ctrls->ignore_lock.real_mods = rep.ignoreLockRealMods; - ctrls->ignore_lock.vmods = rep.ignoreLockVMods; - } - if (which & XkbRepeatKeysMask) { - ctrls->repeat_delay = rep.repeatDelay; - ctrls->repeat_interval = rep.repeatInterval; - } - if (which & XkbSlowKeysMask) - ctrls->slow_keys_delay = rep.slowKeysDelay; - if (which & XkbBounceKeysMask) - ctrls->debounce_delay = rep.debounceDelay; - if (which & XkbMouseKeysMask) { - ctrls->mk_dflt_btn = rep.mkDfltBtn; - } - if (which & XkbMouseKeysAccelMask) { - ctrls->mk_delay = rep.mkDelay; - ctrls->mk_interval = rep.mkInterval; - ctrls->mk_time_to_max = rep.mkTimeToMax; - ctrls->mk_max_speed = rep.mkMaxSpeed; - ctrls->mk_curve = rep.mkCurve; - } - if (which & XkbAccessXKeysMask) - ctrls->ax_options = rep.axOptions; - if (which & XkbStickyKeysMask) { - ctrls->ax_options &= ~XkbAX_SKOptionsMask; - ctrls->ax_options |= rep.axOptions & XkbAX_SKOptionsMask; - } - if (which & XkbAccessXFeedbackMask) { - ctrls->ax_options &= ~XkbAX_FBOptionsMask; - ctrls->ax_options |= rep.axOptions & XkbAX_FBOptionsMask; - } - if (which & XkbAccessXTimeoutMask) { - ctrls->ax_timeout = rep.axTimeout; - ctrls->axt_ctrls_mask = rep.axtCtrlsMask; - ctrls->axt_ctrls_values = rep.axtCtrlsValues; - ctrls->axt_opts_mask = rep.axtOptsMask; - ctrls->axt_opts_values = rep.axtOptsValues; - } - if (which & XkbPerKeyRepeatMask) { - memcpy(ctrls->per_key_repeat, rep.perKeyRepeat, XkbPerKeyBitArraySize); - } - UnlockDisplay(dpy); - SyncHandle(); - return Success; -} - -Bool -XkbSetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) -{ - register xkbSetControlsReq *req; - XkbControlsPtr ctrls; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!xkb) || (!xkb->ctrls)) - return False; - - ctrls = xkb->ctrls; - LockDisplay(dpy); - req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, xkb->device_spec); - req->changeCtrls = (CARD32) which; - if (which & XkbInternalModsMask) { - req->affectInternalMods = ~0; - req->internalMods = ctrls->internal.real_mods; - req->affectInternalVMods = ~0; - req->internalVMods = ctrls->internal.vmods; - } - if (which & XkbIgnoreLockModsMask) { - req->affectIgnoreLockMods = ~0; - req->ignoreLockMods = ctrls->ignore_lock.real_mods; - req->affectIgnoreLockVMods = ~0; - req->ignoreLockVMods = ctrls->ignore_lock.vmods; - } - if (which & XkbControlsEnabledMask) { - req->affectEnabledCtrls = XkbAllBooleanCtrlsMask; - req->enabledCtrls = ctrls->enabled_ctrls; - } - if (which & XkbRepeatKeysMask) { - req->repeatDelay = ctrls->repeat_delay; - req->repeatInterval = ctrls->repeat_interval; - } - if (which & XkbSlowKeysMask) - req->slowKeysDelay = ctrls->slow_keys_delay; - if (which & XkbBounceKeysMask) - req->debounceDelay = ctrls->debounce_delay; - if (which & XkbMouseKeysMask) { - req->mkDfltBtn = ctrls->mk_dflt_btn; - } - if (which & XkbGroupsWrapMask) - req->groupsWrap = ctrls->groups_wrap; - if (which & - (XkbAccessXKeysMask | XkbStickyKeysMask | XkbAccessXFeedbackMask)) - req->axOptions = ctrls->ax_options; - if (which & XkbMouseKeysAccelMask) { - req->mkDelay = ctrls->mk_delay; - req->mkInterval = ctrls->mk_interval; - req->mkTimeToMax = ctrls->mk_time_to_max; - req->mkMaxSpeed = ctrls->mk_max_speed; - req->mkCurve = ctrls->mk_curve; - } - if (which & XkbAccessXTimeoutMask) { - req->axTimeout = ctrls->ax_timeout; - req->axtCtrlsMask = ctrls->axt_ctrls_mask; - req->axtCtrlsValues = ctrls->axt_ctrls_values; - req->axtOptsMask = ctrls->axt_opts_mask; - req->axtOptsValues = ctrls->axt_opts_values; - } - if (which & XkbPerKeyRepeatMask) { - memcpy(req->perKeyRepeat, ctrls->per_key_repeat, XkbPerKeyBitArraySize); - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -/***====================================================================***/ - -void -XkbNoteControlsChanges(XkbControlsChangesPtr old, - XkbControlsNotifyEvent *new, - unsigned int wanted) -{ - old->changed_ctrls |= (new->changed_ctrls & wanted); - if (new->changed_ctrls & XkbControlsEnabledMask & wanted) - old->enabled_ctrls_changes ^= new->enabled_ctrl_changes; - /* num_groups_changed?? */ - return; -} diff --git a/nx-X11/lib/X11/XKBCvt.c b/nx-X11/lib/X11/XKBCvt.c deleted file mode 100644 index c42c3af1c..000000000 --- a/nx-X11/lib/X11/XKBCvt.c +++ /dev/null @@ -1,341 +0,0 @@ -/* - -Copyright 1988, 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include - -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "XlcPubI.h" -#include "Ximint.h" -#include -#include -#define XK_LATIN1 -#define XK_PUBLISHING -#include -#include -#include "XKBlibint.h" -#include -#include -#include - -static int -_XkbHandleSpecialSym(KeySym keysym, char *buffer, int nbytes, int *extra_rtrn) -{ - - /* try to convert to Latin-1, handling ctrl */ - if (!(((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) || - (keysym == XK_Return) || (keysym == XK_Escape) || - (keysym == XK_KP_Space) || (keysym == XK_KP_Tab) || - (keysym == XK_KP_Enter) || - ((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) || - (keysym == XK_KP_Equal) || (keysym == XK_Delete))) - return 0; - - if (nbytes < 1) { - if (extra_rtrn) - *extra_rtrn = 1; - return 0; - } - /* if X keysym, convert to ascii by grabbing low 7 bits */ - if (keysym == XK_KP_Space) - buffer[0] = XK_space & 0x7F; /* patch encoding botch */ - else if (keysym == XK_hyphen) - buffer[0] = (char) (XK_minus & 0xFF); /* map to equiv character */ - else - buffer[0] = (char) (keysym & 0x7F); - return 1; -} - -/*ARGSUSED*/ -static int -_XkbKSToKnownSet(XPointer priv, - KeySym keysym, - char *buffer, - int nbytes, - int *extra_rtrn) -{ - char tbuf[8], *buf; - - if (extra_rtrn) - *extra_rtrn = 0; - - /* convert "dead" diacriticals for dumb applications */ - if ((keysym & 0xffffff00) == 0xfe00) { - switch (keysym) { - case XK_dead_grave: keysym = XK_grave; break; - case XK_dead_acute: keysym = XK_acute; break; - case XK_dead_circumflex: keysym = XK_asciicircum; break; - case XK_dead_tilde: keysym = XK_asciitilde; break; - case XK_dead_macron: keysym = XK_macron; break; - case XK_dead_breve: keysym = XK_breve; break; - case XK_dead_abovedot: keysym = XK_abovedot; break; - case XK_dead_diaeresis: keysym = XK_diaeresis; break; - case XK_dead_abovering: keysym = XK_degree; break; - case XK_dead_doubleacute: keysym = XK_doubleacute; break; - case XK_dead_caron: keysym = XK_caron; break; - case XK_dead_cedilla: keysym = XK_cedilla; break; - case XK_dead_ogonek: keysym = XK_ogonek; break; - case XK_dead_iota: keysym = XK_Greek_iota; break; -#ifdef XK_KATAKANA - case XK_dead_voiced_sound: keysym = XK_voicedsound; break; - case XK_dead_semivoiced_sound: keysym = XK_semivoicedsound; break; -#endif - } - } - - if (nbytes < 1) - buf = tbuf; - else - buf = buffer; - - if ((keysym & 0xffffff00) == 0xff00) { - return _XkbHandleSpecialSym(keysym, buf, nbytes, extra_rtrn); - } - return _XimGetCharCode(priv, keysym, (unsigned char *) buf, nbytes); -} - -typedef struct _XkbToKS { - unsigned prefix; - char *map; -} XkbToKS; - -/*ARGSUSED*/ -static KeySym -_XkbKnownSetToKS(XPointer priv, char *buffer, int nbytes, Status *status) -{ - if (nbytes != 1) - return NoSymbol; - if (((buffer[0] & 0x80) == 0) && (buffer[0] >= 32)) - return buffer[0]; - else if ((buffer[0] & 0x7f) >= 32) { - XkbToKS *map = (XkbToKS *) priv; - - if (map) { - if (map->map) - return map->prefix | map->map[buffer[0] & 0x7f]; - else - return map->prefix | buffer[0]; - } - return buffer[0]; - } - return NoSymbol; -} - -static KeySym -__XkbDefaultToUpper(KeySym sym) -{ - KeySym lower, upper; - - XConvertCase(sym, &lower, &upper); - return upper; -} - -#ifdef XKB_EXTEND_LOOKUP_STRING -static int -Strcmp(char *str1, char *str2) -{ - char str[256]; - char c, *s; - - /* - * unchecked strings from the environment can end up here, so check - * the length before copying. - */ - if (strlen(str1) >= sizeof(str)) /* almost certain it's a mismatch */ - return 1; - - for (s = str; (c = *str1++);) { - if (isupper(c)) - c = tolower(c); - *s++ = c; - } - *s = '\0'; - return (strcmp(str, str2)); -} -#endif - -int -_XkbGetConverters(const char *encoding_name, XkbConverters * cvt_rtrn) -{ - if (!cvt_rtrn) - return 0; - - cvt_rtrn->KSToMB = _XkbKSToKnownSet; - cvt_rtrn->KSToMBPriv = _XimGetLocaleCode(encoding_name); - cvt_rtrn->MBToKS = _XkbKnownSetToKS; - cvt_rtrn->MBToKSPriv = NULL; - cvt_rtrn->KSToUpper = __XkbDefaultToUpper; - return 1; -} - -/***====================================================================***/ - -/* - * The function _XkbGetCharset seems to be missnamed as what it seems to - * be used for is to determine the encoding-name for the locale. ??? - */ - -#ifdef XKB_EXTEND_LOOKUP_STRING - -/* - * XKB_EXTEND_LOOKUP_STRING is not used by the SI. It is used by various - * X Consortium/X Project Team members, so we leave it in the source as - * an simplify integration by these companies. - */ - -#define CHARSET_FILE "/usr/lib/X11/input/charsets" -static char *_XkbKnownLanguages = - "c=ascii:da,de,en,es,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:" - "eo=iso8859-3:sp=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:he=iso8859-8:" - "tr=iso8859-9:lt,lv=iso8859-13:et,fi=iso8859-15:ru=koi8-r:uk=koi8-u:" - "th,th_TH,th_TH.iso8859-11=iso8859-11:th_TH.TIS620=tis620:hy=armscii-8:" - "vi=tcvn-5712:ka=georgian-academy:be,bg=microsoft-cp1251"; - -char * -_XkbGetCharset(void) -{ - /* - * PAGE USAGE TUNING: explicitly initialize to move these to data - * instead of bss - */ - static char buf[100] = { 0 }; - char lang[256]; - char *start, *tmp, *end, *next, *set; - char *country, *charset; - char *locale; - - tmp = getenv("_XKB_CHARSET"); - if (tmp) - return tmp; - locale = setlocale(LC_CTYPE, NULL); - - if (locale == NULL) - return NULL; - - if (strlen(locale) >= sizeof(lang)) - return NULL; - - for (tmp = lang; *tmp = *locale++; tmp++) { - if (isupper(*tmp)) - *tmp = tolower(*tmp); - } - country = strchr(lang, '_'); - if (country) { - *country++ = '\0'; - charset = strchr(country, '.'); - if (charset) - *charset++ = '\0'; - if (charset) { - strncpy(buf, charset, 99); - buf[99] = '\0'; - return buf; - } - } - else { - charset = NULL; - } - - if ((tmp = getenv("_XKB_LOCALE_CHARSETS")) != NULL) { - start = _XkbAlloc(strlen(tmp) + 1); - strcpy(start, tmp); - tmp = start; - } - else { - struct stat sbuf; - FILE *file; - char *cf = CHARSET_FILE; - -#ifndef S_ISREG -# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) -#endif - - if ((stat(cf, &sbuf) == 0) && S_ISREG(sbuf.st_mode) && - (file = fopen(cf, "r"))) { - tmp = _XkbAlloc(sbuf.st_size + 1); - if (tmp != NULL) { - sbuf.st_size = (long) fread(tmp, 1, sbuf.st_size, file); - tmp[sbuf.st_size] = '\0'; - } - fclose(file); - } - } - - if (tmp == NULL) { - tmp = _XkbAlloc(strlen(_XkbKnownLanguages) + 1); - if (!tmp) - return NULL; - strcpy(tmp, _XkbKnownLanguages); - } - start = tmp; - do { - if ((set = strchr(tmp, '=')) == NULL) - break; - *set++ = '\0'; - if ((next = strchr(set, ':')) != NULL) - *next++ = '\0'; - while (tmp && *tmp) { - if ((end = strchr(tmp, ',')) != NULL) - *end++ = '\0'; - if (Strcmp(tmp, lang) == 0) { - strncpy(buf, set, 100); - buf[99] = '\0'; - Xfree(start); - return buf; - } - tmp = end; - } - tmp = next; - } while (tmp && *tmp); - Xfree(start); - return NULL; -} -#else -char * -_XkbGetCharset(void) -{ - char *tmp; - XLCd lcd; - - tmp = getenv("_XKB_CHARSET"); - if (tmp) - return tmp; - - lcd = _XlcCurrentLC(); - if (lcd) - return XLC_PUBLIC(lcd, encoding_name); - - return NULL; -} -#endif diff --git a/nx-X11/lib/X11/XKBExtDev.c b/nx-X11/lib/X11/XKBExtDev.c deleted file mode 100644 index cb40ecd04..000000000 --- a/nx-X11/lib/X11/XKBExtDev.c +++ /dev/null @@ -1,843 +0,0 @@ -/************************************************************ -Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#define NEED_MAP_READERS -#include "Xlibint.h" -#include -#include "XKBlibint.h" -#include - -/***====================================================================***/ - -void -XkbNoteDeviceChanges(XkbDeviceChangesPtr old, - XkbExtensionDeviceNotifyEvent *new, - unsigned int wanted) -{ - if ((!old) || (!new) || (!wanted) || ((new->reason & wanted) == 0)) - return; - if ((wanted & new->reason) & XkbXI_ButtonActionsMask) { - if (old->changed & XkbXI_ButtonActionsMask) { - int first, last, newLast; - - if (new->first_btn < old->first_btn) - first = new->first_btn; - else - first = old->first_btn; - last = old->first_btn + old->num_btns - 1; - newLast = new->first_btn + new->num_btns - 1; - if (newLast > last) - last = newLast; - old->first_btn = first; - old->num_btns = (last - first) + 1; - } - else { - old->changed |= XkbXI_ButtonActionsMask; - old->first_btn = new->first_btn; - old->num_btns = new->num_btns; - } - } - if ((wanted & new->reason) & XkbXI_IndicatorsMask) { - XkbDeviceLedChangesPtr this; - - if (old->changed & XkbXI_IndicatorsMask) { - XkbDeviceLedChangesPtr found = NULL; - - for (this = &old->leds; this && (!found); this = this->next) { - if ((this->led_class == new->led_class) && - (this->led_id == new->led_id)) { - found = this; - } - } - if (!found) { - found = _XkbTypedCalloc(1, XkbDeviceLedChangesRec); - if (!found) - return; - found->next = old->leds.next; - found->led_class = new->led_class; - found->led_id = new->led_id; - old->leds.next = found; - } - if ((wanted & new->reason) & XkbXI_IndicatorNamesMask) - found->defined = new->leds_defined; - } - else { - old->changed |= ((wanted & new->reason) & XkbXI_IndicatorsMask); - old->leds.led_class = new->led_class; - old->leds.led_id = new->led_id; - old->leds.defined = new->leds_defined; - if (old->leds.next) { - XkbDeviceLedChangesPtr next; - - for (this = old->leds.next; this; this = next) { - next = this->next; - _XkbFree(this); - } - old->leds.next = NULL; - } - } - } - return; -} - -/***====================================================================***/ - -static Status -_XkbReadDeviceLedInfo(XkbReadBufferPtr buf, - unsigned present, - XkbDeviceInfoPtr devi) -{ - register unsigned i, bit; - XkbDeviceLedInfoPtr devli; - xkbDeviceLedsWireDesc *wireli; - - wireli = _XkbGetTypedRdBufPtr(buf, 1, xkbDeviceLedsWireDesc); - if (!wireli) - return BadLength; - devli = XkbAddDeviceLedInfo(devi, wireli->ledClass, wireli->ledID); - if (!devli) - return BadAlloc; - devli->phys_indicators = wireli->physIndicators; - - if (present & XkbXI_IndicatorStateMask) - devli->state = wireli->state; - - if (present & XkbXI_IndicatorNamesMask) { - devli->names_present = wireli->namesPresent; - if (devli->names_present) { - for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { - if (wireli->namesPresent & bit) { - if (!_XkbCopyFromReadBuffer(buf, - (char *) &devli->names[i], 4)) - return BadLength; - } - } - } - } - - if (present & XkbXI_IndicatorMapsMask) { - devli->maps_present = wireli->mapsPresent; - if (devli->maps_present) { - XkbIndicatorMapPtr im; - xkbIndicatorMapWireDesc *wireim; - - for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { - if (wireli->mapsPresent & bit) { - wireim = - _XkbGetTypedRdBufPtr(buf, 1, xkbIndicatorMapWireDesc); - if (!wireim) - return BadAlloc; - im = &devli->maps[i]; - im->flags = wireim->flags; - im->which_groups = wireim->whichGroups; - im->groups = wireim->groups; - im->which_mods = wireim->whichMods; - im->mods.mask = wireim->mods; - im->mods.real_mods = wireim->realMods; - im->mods.vmods = wireim->virtualMods; - im->ctrls = wireim->ctrls; - } - } - } - } - return Success; -} - -static Status -_XkbReadGetDeviceInfoReply(Display *dpy, - xkbGetDeviceInfoReply *rep, - XkbDeviceInfoPtr devi) -{ - XkbReadBufferRec buf; - XkbAction *act; - int tmp; - - if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) - return BadAlloc; - - if ((rep->totalBtns > 0) && (rep->totalBtns != devi->num_btns)) { - tmp = XkbResizeDeviceButtonActions(devi, rep->totalBtns); - if (tmp != Success) - return tmp; - } - if (rep->nBtnsWanted > 0) { - if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted) - >= devi->num_btns) - goto BAILOUT; - act = &devi->btn_acts[rep->firstBtnWanted]; - bzero((char *) act, (rep->nBtnsWanted * sizeof(XkbAction))); - } - - _XkbFree(devi->name); - if (!_XkbGetReadBufferCountedString(&buf, &devi->name)) - goto BAILOUT; - if (rep->nBtnsRtrn > 0) { - int size; - - if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn) - >= devi->num_btns) - goto BAILOUT; - act = &devi->btn_acts[rep->firstBtnRtrn]; - size = rep->nBtnsRtrn * SIZEOF(xkbActionWireDesc); - if (!_XkbCopyFromReadBuffer(&buf, (char *) act, size)) - goto BAILOUT; - } - if (rep->nDeviceLedFBs > 0) { - register int i; - - for (i = 0; i < rep->nDeviceLedFBs; i++) { - if ((tmp = _XkbReadDeviceLedInfo(&buf, rep->present, devi)) - != Success) - return tmp; - } - } - tmp = _XkbFreeReadBuffer(&buf); - if (tmp) - fprintf(stderr, "GetDeviceInfo! Bad length (%d extra bytes)\n", tmp); - if (tmp || buf.error) - return BadLength; - return Success; - BAILOUT: - _XkbFreeReadBuffer(&buf); - return BadLength; -} - -XkbDeviceInfoPtr -XkbGetDeviceInfo(Display *dpy, - unsigned which, - unsigned deviceSpec, - unsigned class, - unsigned id) -{ - register xkbGetDeviceInfoReq *req; - xkbGetDeviceInfoReply rep; - Status status; - XkbDeviceInfoPtr devi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return NULL; - LockDisplay(dpy); - GetReq(kbGetDeviceInfo, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetDeviceInfo; - req->deviceSpec = deviceSpec; - req->wanted = which; - req->allBtns = ((which & XkbXI_ButtonActionsMask) != 0); - req->firstBtn = req->nBtns = 0; - req->ledClass = class; - req->ledID = id; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return NULL; - } - devi = XkbAllocDeviceInfo(rep.deviceID, rep.totalBtns, rep.nDeviceLedFBs); - if (devi) { - devi->supported = rep.supported; - devi->unsupported = rep.unsupported; - devi->type = rep.devType; - devi->has_own_state = rep.hasOwnState; - devi->dflt_kbd_fb = rep.dfltKbdFB; - devi->dflt_led_fb = rep.dfltLedFB; - status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); - if (status != Success) { - XkbFreeDeviceInfo(devi, XkbXI_AllDeviceFeaturesMask, True); - devi = NULL; - } - } - UnlockDisplay(dpy); - SyncHandle(); - return devi; -} - -Status -XkbGetDeviceInfoChanges(Display *dpy, - XkbDeviceInfoPtr devi, - XkbDeviceChangesPtr changes) -{ - register xkbGetDeviceInfoReq *req; - xkbGetDeviceInfoReply rep; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadMatch; - if ((changes->changed & XkbXI_AllDeviceFeaturesMask) == 0) - return Success; - changes->changed &= ~XkbXI_AllDeviceFeaturesMask; - status = Success; - LockDisplay(dpy); - while ((changes->changed) && (status == Success)) { - GetReq(kbGetDeviceInfo, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetDeviceInfo; - req->deviceSpec = devi->device_spec; - req->wanted = changes->changed; - req->allBtns = False; - if (changes->changed & XkbXI_ButtonActionsMask) { - req->firstBtn = changes->first_btn; - req->nBtns = changes->num_btns; - changes->changed &= ~XkbXI_ButtonActionsMask; - } - else - req->firstBtn = req->nBtns = 0; - if (changes->changed & XkbXI_IndicatorsMask) { - req->ledClass = changes->leds.led_class; - req->ledID = changes->leds.led_id; - if (changes->leds.next == NULL) - changes->changed &= ~XkbXI_IndicatorsMask; - else { - XkbDeviceLedChangesPtr next; - - next = changes->leds.next; - changes->leds = *next; - _XkbFree(next); - } - } - else { - req->ledClass = XkbDfltXIClass; - req->ledID = XkbDfltXIId; - } - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - status = BadLength; - break; - } - devi->supported |= rep.supported; - devi->unsupported |= rep.unsupported; - devi->type = rep.devType; - status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); - } - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetDeviceButtonActions(Display *dpy, - XkbDeviceInfoPtr devi, - Bool all, - unsigned int first, - unsigned int num) -{ - register xkbGetDeviceInfoReq *req; - xkbGetDeviceInfoReply rep; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadMatch; - if (!devi) - return BadValue; - LockDisplay(dpy); - GetReq(kbGetDeviceInfo, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetDeviceInfo; - req->deviceSpec = devi->device_spec; - req->wanted = XkbXI_ButtonActionsMask; - req->allBtns = all; - req->firstBtn = first; - req->nBtns = num; - req->ledClass = XkbDfltXIClass; - req->ledID = XkbDfltXIId; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadLength; - } - devi->type = rep.devType; - devi->supported = rep.supported; - devi->unsupported = rep.unsupported; - status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetDeviceLedInfo(Display *dpy, - XkbDeviceInfoPtr devi, - unsigned int ledClass, - unsigned int ledId, - unsigned int which) -{ - register xkbGetDeviceInfoReq *req; - xkbGetDeviceInfoReply rep; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadMatch; - if (((which & XkbXI_IndicatorsMask) == 0) || - (which & (~XkbXI_IndicatorsMask))) - return BadMatch; - if (!devi) - return BadValue; - LockDisplay(dpy); - GetReq(kbGetDeviceInfo, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetDeviceInfo; - req->deviceSpec = devi->device_spec; - req->wanted = which; - req->allBtns = False; - req->firstBtn = req->nBtns = 0; - req->ledClass = ledClass; - req->ledID = ledId; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadLength; - } - devi->type = rep.devType; - devi->supported = rep.supported; - devi->unsupported = rep.unsupported; - status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -/***====================================================================***/ - -typedef struct _LedInfoStuff { - Bool used; - XkbDeviceLedInfoPtr devli; -} LedInfoStuff; - -typedef struct _SetLedStuff { - unsigned wanted; - int num_info; - int dflt_class; - LedInfoStuff *dflt_kbd_fb; - LedInfoStuff *dflt_led_fb; - LedInfoStuff *info; -} SetLedStuff; - -static void -_InitLedStuff(SetLedStuff *stuff, unsigned wanted, XkbDeviceInfoPtr devi) -{ - int i; - register XkbDeviceLedInfoPtr devli; - - bzero(stuff, sizeof(SetLedStuff)); - stuff->wanted = wanted; - stuff->dflt_class = XkbXINone; - if ((devi->num_leds < 1) || ((wanted & XkbXI_IndicatorsMask) == 0)) - return; - stuff->info = _XkbTypedCalloc(devi->num_leds, LedInfoStuff); - if (!stuff->info) - return; - stuff->num_info = devi->num_leds; - for (devli = &devi->leds[0], i = 0; i < devi->num_leds; i++, devli++) { - stuff->info[i].devli = devli; - if (devli->led_class == KbdFeedbackClass) { - stuff->dflt_class = KbdFeedbackClass; - if (stuff->dflt_kbd_fb == NULL) - stuff->dflt_kbd_fb = &stuff->info[i]; - } - else if (devli->led_class == LedFeedbackClass) { - if (stuff->dflt_class == XkbXINone) - stuff->dflt_class = LedFeedbackClass; - if (stuff->dflt_led_fb == NULL) - stuff->dflt_led_fb = &stuff->info[i]; - } - } - return; -} - -static void -_FreeLedStuff(SetLedStuff * stuff) -{ - if (stuff->num_info > 0) - _XkbFree(stuff->info); - bzero(stuff, sizeof(SetLedStuff)); - return; -} - -static int -_XkbSizeLedInfo(unsigned changed, XkbDeviceLedInfoPtr devli) -{ - register int i, size; - register unsigned bit, namesNeeded, mapsNeeded; - - size = SIZEOF(xkbDeviceLedsWireDesc); - namesNeeded = mapsNeeded = 0; - if (changed & XkbXI_IndicatorNamesMask) - namesNeeded = devli->names_present; - if (changed & XkbXI_IndicatorMapsMask) - mapsNeeded = devli->maps_present; - if ((namesNeeded) || (mapsNeeded)) { - for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { - if (namesNeeded & bit) - size += 4; /* atoms are 4 bytes on the wire */ - if (mapsNeeded & bit) - size += SIZEOF(xkbIndicatorMapWireDesc); - } - } - return size; -} - -static Bool -_SizeMatches(SetLedStuff *stuff, - XkbDeviceLedChangesPtr changes, - int *sz_rtrn, - int *nleds_rtrn) -{ - int i, nMatch, class, id; - LedInfoStuff *linfo; - Bool match; - - nMatch = 0; - class = changes->led_class; - id = changes->led_id; - if (class == XkbDfltXIClass) - class = stuff->dflt_class; - for (i = 0, linfo = &stuff->info[0]; i < stuff->num_info; i++, linfo++) { - XkbDeviceLedInfoPtr devli; - LedInfoStuff *dflt; - - devli = linfo->devli; - match = ((class == devli->led_class) || (class == XkbAllXIClasses)); - if (devli->led_class == KbdFeedbackClass) - dflt = stuff->dflt_kbd_fb; - else - dflt = stuff->dflt_led_fb; - match = (match && (id == devli->led_id)) || - (id == XkbAllXIIds) || - ((id == XkbDfltXIId) && (linfo == dflt)); - if (match) { - if (!linfo->used) { - *sz_rtrn += _XkbSizeLedInfo(stuff->wanted, devli); - *nleds_rtrn += 1; - linfo->used = True; - if ((class != XkbAllXIClasses) && (id != XkbAllXIIds)) - return True; - } - nMatch++; - linfo->used = True; - } - } - return (nMatch > 0); -} - -/***====================================================================***/ - - -static Status -_XkbSetDeviceInfoSize(XkbDeviceInfoPtr devi, - XkbDeviceChangesPtr changes, - SetLedStuff *stuff, - int *sz_rtrn, - int *num_leds_rtrn) -{ - *sz_rtrn = 0; - if ((changes->changed & XkbXI_ButtonActionsMask) && (changes->num_btns > 0)) { - if (!XkbXI_LegalDevBtn - (devi, (changes->first_btn + changes->num_btns - 1))) - return BadMatch; - *sz_rtrn += changes->num_btns * SIZEOF(xkbActionWireDesc); - } - else { - changes->changed &= ~XkbXI_ButtonActionsMask; - changes->first_btn = changes->num_btns = 0; - } - if ((changes->changed & XkbXI_IndicatorsMask) && - XkbLegalXILedClass(changes->leds.led_class)) { - XkbDeviceLedChangesPtr leds; - - for (leds = &changes->leds; leds != NULL; leds = leds->next) { - if (!_SizeMatches(stuff, leds, sz_rtrn, num_leds_rtrn)) - return BadMatch; - } - } - else { - changes->changed &= ~XkbXI_IndicatorsMask; - *num_leds_rtrn = 0; - } - return Success; -} - -static char * -_XkbWriteLedInfo(char *wire, unsigned changed, XkbDeviceLedInfoPtr devli) -{ - register int i; - register unsigned bit, namesNeeded, mapsNeeded; - xkbDeviceLedsWireDesc *lwire; - - namesNeeded = mapsNeeded = 0; - if (changed & XkbXI_IndicatorNamesMask) - namesNeeded = devli->names_present; - if (changed & XkbXI_IndicatorMapsMask) - mapsNeeded = devli->maps_present; - - lwire = (xkbDeviceLedsWireDesc *) wire; - lwire->ledClass = devli->led_class; - lwire->ledID = devli->led_id; - lwire->namesPresent = namesNeeded; - lwire->mapsPresent = mapsNeeded; - lwire->physIndicators = devli->phys_indicators; - lwire->state = devli->state; - wire = (char *) &lwire[1]; - if (namesNeeded) { - CARD32 *awire = (CARD32 *) wire; - - for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { - if (namesNeeded & bit) { - *awire = (CARD32) devli->names[i]; - awire++; - } - } - wire = (char *) awire; - } - if (mapsNeeded) { - xkbIndicatorMapWireDesc *mwire = (xkbIndicatorMapWireDesc *) wire; - - for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { - if (mapsNeeded & bit) { - XkbIndicatorMapPtr map = &devli->maps[i]; - - mwire->flags = map->flags; - mwire->whichGroups = map->which_groups; - mwire->groups = map->groups; - mwire->whichMods = map->which_mods; - mwire->mods = map->mods.mask; - mwire->realMods = map->mods.real_mods; - mwire->virtualMods = map->mods.vmods; - mwire->ctrls = map->ctrls; - mwire++; - } - } - wire = (char *) mwire; - } - return wire; -} - - -static int -_XkbWriteSetDeviceInfo(char *wire, - XkbDeviceChangesPtr changes, - SetLedStuff *stuff, - XkbDeviceInfoPtr devi) -{ - char *start = wire; - - if (changes->changed & XkbXI_ButtonActionsMask) { - int size = changes->num_btns * SIZEOF(xkbActionWireDesc); - - memcpy(wire, (char *) &devi->btn_acts[changes->first_btn], size); - wire += size; - } - if (changes->changed & XkbXI_IndicatorsMask) { - register int i; - register LedInfoStuff *linfo; - - for (i = 0, linfo = &stuff->info[0]; i < stuff->num_info; i++, linfo++) { - if (linfo->used) { - register char *new_wire; - - new_wire = _XkbWriteLedInfo(wire, stuff->wanted, linfo->devli); - if (!new_wire) - return wire - start; - wire = new_wire; - } - } - } - return wire - start; -} - -Bool -XkbSetDeviceInfo(Display *dpy, unsigned which, XkbDeviceInfoPtr devi) -{ - register xkbSetDeviceInfoReq *req; - Status ok = 0; - int size, nLeds; - XkbInfoPtr xkbi; - XkbDeviceChangesRec changes; - SetLedStuff lstuff; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!devi) || (which & (~XkbXI_AllDeviceFeaturesMask)) || - ((which & XkbXI_ButtonActionsMask) && (!XkbXI_DevHasBtnActs(devi))) || - ((which & XkbXI_IndicatorsMask) && (!XkbXI_DevHasLeds(devi)))) - return False; - - bzero((char *) &changes, sizeof(XkbDeviceChangesRec)); - changes.changed = which; - changes.first_btn = 0; - changes.num_btns = devi->num_btns; - changes.leds.led_class = XkbAllXIClasses; - changes.leds.led_id = XkbAllXIIds; - changes.leds.defined = 0; - size = nLeds = 0; - _InitLedStuff(&lstuff, changes.changed, devi); - if (_XkbSetDeviceInfoSize(devi, &changes, &lstuff, &size, &nLeds) != - Success) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetDeviceInfo, req); - req->length += size / 4; - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetDeviceInfo; - req->deviceSpec = devi->device_spec; - req->firstBtn = changes.first_btn; - req->nBtns = changes.num_btns; - req->change = changes.changed; - req->nDeviceLedFBs = nLeds; - if (size > 0) { - char *wire; - - BufAlloc(char *, wire, size); - ok = (wire != NULL) && - (_XkbWriteSetDeviceInfo(wire, &changes, &lstuff, devi) == size); - } - UnlockDisplay(dpy); - SyncHandle(); - _FreeLedStuff(&lstuff); - /* 12/11/95 (ef) -- XXX!! should clear changes here */ - return ok; -} - -Bool -XkbChangeDeviceInfo(Display *dpy, - XkbDeviceInfoPtr devi, - XkbDeviceChangesPtr changes) -{ - register xkbSetDeviceInfoReq *req; - Status ok = 0; - int size, nLeds; - XkbInfoPtr xkbi; - SetLedStuff lstuff; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!devi) || (changes->changed & (~XkbXI_AllDeviceFeaturesMask)) || - ((changes->changed & XkbXI_ButtonActionsMask) && - (!XkbXI_DevHasBtnActs(devi))) || - ((changes->changed & XkbXI_IndicatorsMask) && - (!XkbXI_DevHasLeds(devi)))) - return False; - - size = nLeds = 0; - _InitLedStuff(&lstuff, changes->changed, devi); - if (_XkbSetDeviceInfoSize(devi, changes, &lstuff, &size, &nLeds) != Success) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetDeviceInfo, req); - req->length += size / 4; - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetDeviceInfo; - req->deviceSpec = devi->device_spec; - req->firstBtn = changes->first_btn; - req->nBtns = changes->num_btns; - req->change = changes->changed; - req->nDeviceLedFBs = nLeds; - if (size > 0) { - char *wire; - - BufAlloc(char *, wire, size); - ok = (wire != NULL) && - (_XkbWriteSetDeviceInfo(wire, changes, &lstuff, devi) == size); - } - UnlockDisplay(dpy); - SyncHandle(); - _FreeLedStuff(&lstuff); - /* 12/11/95 (ef) -- XXX!! should clear changes here */ - return ok; -} - -Bool -XkbSetDeviceLedInfo(Display *dpy, - XkbDeviceInfoPtr devi, - unsigned ledClass, - unsigned ledID, - unsigned which) -{ - return False; -} - -Bool -XkbSetDeviceButtonActions(Display *dpy, - XkbDeviceInfoPtr devi, - unsigned int first, - unsigned int nBtns) -{ - register xkbSetDeviceInfoReq *req; - Status ok = 0; - int size, nLeds; - XkbInfoPtr xkbi; - XkbDeviceChangesRec changes; - SetLedStuff lstuff; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!devi) || (!XkbXI_DevHasBtnActs(devi)) || - (first + nBtns > devi->num_btns)) - return False; - if (nBtns == 0) - return True; - - bzero((char *) &changes, sizeof(XkbDeviceChangesRec)); - changes.changed = XkbXI_ButtonActionsMask; - changes.first_btn = first; - changes.num_btns = nBtns; - changes.leds.led_class = XkbXINone; - changes.leds.led_id = XkbXINone; - changes.leds.defined = 0; - size = nLeds = 0; - if (_XkbSetDeviceInfoSize(devi, &changes, NULL, &size, &nLeds) != Success) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetDeviceInfo, req); - req->length += size / 4; - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetDeviceInfo; - req->deviceSpec = devi->device_spec; - req->firstBtn = changes.first_btn; - req->nBtns = changes.num_btns; - req->change = changes.changed; - req->nDeviceLedFBs = nLeds; - if (size > 0) { - char *wire; - - BufAlloc(char *, wire, size); - ok = (wire != NULL) && - (_XkbWriteSetDeviceInfo(wire, &changes, &lstuff, devi) == size); - } - UnlockDisplay(dpy); - SyncHandle(); - return ok; -} diff --git a/nx-X11/lib/X11/XKBGAlloc.c b/nx-X11/lib/X11/XKBGAlloc.c deleted file mode 100644 index ab05f8d88..000000000 --- a/nx-X11/lib/X11/XKBGAlloc.c +++ /dev/null @@ -1,994 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include -#include "Xlibint.h" -#include "XKBlibint.h" -#include -#include - -/***====================================================================***/ - -static void -_XkbFreeGeomLeafElems(Bool freeAll, - int first, - int count, - unsigned short *num_inout, - unsigned short *sz_inout, - char **elems, - unsigned int elem_sz) -{ - if ((freeAll) || (*elems == NULL)) { - *num_inout = *sz_inout = 0; - if (*elems != NULL) { - _XkbFree(*elems); - *elems = NULL; - } - return; - } - - if ((first >= (*num_inout)) || (first < 0) || (count < 1)) - return; - - if (first + count >= (*num_inout)) { - /* truncating the array is easy */ - (*num_inout) = first; - } - else { - char *ptr; - int extra; - - ptr = *elems; - extra = ((*num_inout) - (first + count)) * elem_sz; - if (extra > 0) - memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], - extra); - (*num_inout) -= count; - } - return; -} - -typedef void (*ContentsClearFunc) ( - char * /* priv */ -); - -static void -_XkbFreeGeomNonLeafElems(Bool freeAll, - int first, - int count, - unsigned short *num_inout, - unsigned short *sz_inout, - char **elems, - unsigned int elem_sz, - ContentsClearFunc freeFunc) -{ - register int i; - register char *ptr; - - if (freeAll) { - first = 0; - count = (*num_inout); - } - else if ((first >= (*num_inout)) || (first < 0) || (count < 1)) - return; - else if (first + count > (*num_inout)) - count = (*num_inout) - first; - if (*elems == NULL) - return; - - if (freeFunc) { - ptr = *elems; - ptr += first * elem_sz; - for (i = 0; i < count; i++) { - (*freeFunc) (ptr); - ptr += elem_sz; - } - } - if (freeAll) { - (*num_inout) = (*sz_inout) = 0; - if (*elems) { - _XkbFree(*elems); - *elems = NULL; - } - } - else if (first + count >= (*num_inout)) - *num_inout = first; - else { - i = ((*num_inout) - (first + count)) * elem_sz; - ptr = *elems; - memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], i); - (*num_inout) -= count; - } - return; -} - -/***====================================================================***/ - -static void -_XkbClearProperty(char *prop_in) -{ - XkbPropertyPtr prop = (XkbPropertyPtr) prop_in; - - if (prop->name) { - _XkbFree(prop->name); - prop->name = NULL; - } - if (prop->value) { - _XkbFree(prop->value); - prop->value = NULL; - } - return; -} - -void -XkbFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - &geom->num_properties, &geom->sz_properties, - (char **) &geom->properties, - sizeof(XkbPropertyRec), _XkbClearProperty); - return; -} - -/***====================================================================***/ - -void -XkbFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll) -{ - _XkbFreeGeomLeafElems(freeAll, first, count, - &geom->num_key_aliases, &geom->sz_key_aliases, - (char **) &geom->key_aliases, - sizeof(XkbKeyAliasRec)); - return; -} - -/***====================================================================***/ - -static void -_XkbClearColor(char *color_in) -{ - XkbColorPtr color = (XkbColorPtr) color_in; - - _XkbFree(color->spec); - return; -} - -void -XkbFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - &geom->num_colors, &geom->sz_colors, - (char **) &geom->colors, - sizeof(XkbColorRec), _XkbClearColor); - return; -} - -/***====================================================================***/ - -void -XkbFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll) -{ - _XkbFreeGeomLeafElems(freeAll, first, count, - &outline->num_points, &outline->sz_points, - (char **) &outline->points, - sizeof(XkbPointRec)); - return; -} - -/***====================================================================***/ - -static void -_XkbClearOutline(char *outline_in) -{ - XkbOutlinePtr outline = (XkbOutlinePtr) outline_in; - - if (outline->points != NULL) - XkbFreeGeomPoints(outline, 0, outline->num_points, True); - return; -} - -void -XkbFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - &shape->num_outlines, &shape->sz_outlines, - (char **) &shape->outlines, - sizeof(XkbOutlineRec), _XkbClearOutline); - - return; -} - -/***====================================================================***/ - -static void -_XkbClearShape(char *shape_in) -{ - XkbShapePtr shape = (XkbShapePtr) shape_in; - - if (shape->outlines) - XkbFreeGeomOutlines(shape, 0, shape->num_outlines, True); - return; -} - -void -XkbFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - &geom->num_shapes, &geom->sz_shapes, - (char **) &geom->shapes, - sizeof(XkbShapeRec), _XkbClearShape); - return; -} - -/***====================================================================***/ - -void -XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count, Bool freeAll) -{ - _XkbFreeGeomLeafElems(freeAll, first, count, - &row->num_keys, &row->sz_keys, - (char **) &row->keys, - sizeof(XkbOverlayKeyRec)); - return; -} - -/***====================================================================***/ - -static void -_XkbClearOverlayRow(char *row_in) -{ - XkbOverlayRowPtr row = (XkbOverlayRowPtr) row_in; - - if (row->keys != NULL) - XkbFreeGeomOverlayKeys(row, 0, row->num_keys, True); - return; -} - -void -XkbFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count, - Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - &overlay->num_rows, &overlay->sz_rows, - (char **) &overlay->rows, - sizeof(XkbOverlayRowRec), _XkbClearOverlayRow); - return; -} - -/***====================================================================***/ - -static void -_XkbClearOverlay(char *overlay_in) -{ - XkbOverlayPtr overlay = (XkbOverlayPtr) overlay_in; - - if (overlay->rows != NULL) - XkbFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True); - return; -} - -void -XkbFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - §ion->num_overlays, §ion->sz_overlays, - (char **) §ion->overlays, - sizeof(XkbOverlayRec), _XkbClearOverlay); - return; -} - -/***====================================================================***/ - -void -XkbFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll) -{ - _XkbFreeGeomLeafElems(freeAll, first, count, - &row->num_keys, &row->sz_keys, - (char **) &row->keys, - sizeof(XkbKeyRec)); - return; -} - -/***====================================================================***/ - -static void -_XkbClearRow(char *row_in) -{ - XkbRowPtr row = (XkbRowPtr) row_in; - - if (row->keys != NULL) - XkbFreeGeomKeys(row, 0, row->num_keys, True); - return; -} - -void -XkbFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - §ion->num_rows, §ion->sz_rows, - (char **) §ion->rows, - sizeof(XkbRowRec), _XkbClearRow); -} - -/***====================================================================***/ - -static void -_XkbClearSection(char *section_in) -{ - XkbSectionPtr section = (XkbSectionPtr) section_in; - - if (section->rows != NULL) - XkbFreeGeomRows(section, 0, section->num_rows, True); - if (section->doodads != NULL) { - XkbFreeGeomDoodads(section->doodads, section->num_doodads, True); - section->doodads = NULL; - } - return; -} - -void -XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll) -{ - _XkbFreeGeomNonLeafElems(freeAll, first, count, - &geom->num_sections, &geom->sz_sections, - (char **) &geom->sections, - sizeof(XkbSectionRec), _XkbClearSection); - return; -} - -/***====================================================================***/ - -static void -_XkbClearDoodad(char *doodad_in) -{ - XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in; - - switch (doodad->any.type) { - case XkbTextDoodad: - { - if (doodad->text.text != NULL) { - _XkbFree(doodad->text.text); - doodad->text.text = NULL; - } - if (doodad->text.font != NULL) { - _XkbFree(doodad->text.font); - doodad->text.font = NULL; - } - } - break; - case XkbLogoDoodad: - { - if (doodad->logo.logo_name != NULL) { - _XkbFree(doodad->logo.logo_name); - doodad->logo.logo_name = NULL; - } - } - break; - } - return; -} - -void -XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll) -{ - register int i; - register XkbDoodadPtr doodad; - - if (doodads) { - for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++) { - _XkbClearDoodad((char *) doodad); - } - if (freeAll) - _XkbFree(doodads); - } - return; -} - -void -XkbFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap) -{ - if (geom == NULL) - return; - if (freeMap) - which = XkbGeomAllMask; - if ((which & XkbGeomPropertiesMask) && (geom->properties != NULL)) - XkbFreeGeomProperties(geom, 0, geom->num_properties, True); - if ((which & XkbGeomColorsMask) && (geom->colors != NULL)) - XkbFreeGeomColors(geom, 0, geom->num_colors, True); - if ((which & XkbGeomShapesMask) && (geom->shapes != NULL)) - XkbFreeGeomShapes(geom, 0, geom->num_shapes, True); - if ((which & XkbGeomSectionsMask) && (geom->sections != NULL)) - XkbFreeGeomSections(geom, 0, geom->num_sections, True); - if ((which & XkbGeomDoodadsMask) && (geom->doodads != NULL)) { - XkbFreeGeomDoodads(geom->doodads, geom->num_doodads, True); - geom->doodads = NULL; - geom->num_doodads = geom->sz_doodads = 0; - } - if ((which & XkbGeomKeyAliasesMask) && (geom->key_aliases != NULL)) - XkbFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, True); - if (freeMap) { - if (geom->label_font != NULL) { - _XkbFree(geom->label_font); - geom->label_font = NULL; - } - _XkbFree(geom); - } - return; -} - -/***====================================================================***/ - -static Status -_XkbGeomAlloc(XPointer *old, - unsigned short *num, - unsigned short *total, - int num_new, - size_t sz_elem) -{ - if (num_new < 1) - return Success; - if ((*old) == NULL) - *num = *total = 0; - - if ((*num) + num_new <= (*total)) - return Success; - - *total = (*num) + num_new; - if ((*old) != NULL) - (*old) = (XPointer) _XkbRealloc((*old), (*total) * sz_elem); - else - (*old) = (XPointer) _XkbCalloc((*total), sz_elem); - if ((*old) == NULL) { - *total = *num = 0; - return BadAlloc; - } - - if (*num > 0) { - char *tmp = (char *) (*old); - bzero(&tmp[sz_elem * (*num)], (num_new * sz_elem)); - } - return Success; -} - -#define _XkbAllocProps(g, n) _XkbGeomAlloc((XPointer *)&(g)->properties, \ - &(g)->num_properties, &(g)->sz_properties, \ - (n), sizeof(XkbPropertyRec)) -#define _XkbAllocColors(g, n) _XkbGeomAlloc((XPointer *)&(g)->colors, \ - &(g)->num_colors, &(g)->sz_colors, \ - (n), sizeof(XkbColorRec)) -#define _XkbAllocShapes(g, n) _XkbGeomAlloc((XPointer *)&(g)->shapes, \ - &(g)->num_shapes, &(g)->sz_shapes, \ - (n), sizeof(XkbShapeRec)) -#define _XkbAllocSections(g, n) _XkbGeomAlloc((XPointer *)&(g)->sections, \ - &(g)->num_sections, &(g)->sz_sections, \ - (n), sizeof(XkbSectionRec)) -#define _XkbAllocDoodads(g, n) _XkbGeomAlloc((XPointer *)&(g)->doodads, \ - &(g)->num_doodads, &(g)->sz_doodads, \ - (n), sizeof(XkbDoodadRec)) -#define _XkbAllocKeyAliases(g, n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases, \ - &(g)->num_key_aliases, &(g)->sz_key_aliases, \ - (n), sizeof(XkbKeyAliasRec)) - -#define _XkbAllocOutlines(s, n) _XkbGeomAlloc((XPointer *)&(s)->outlines, \ - &(s)->num_outlines, &(s)->sz_outlines, \ - (n), sizeof(XkbOutlineRec)) -#define _XkbAllocRows(s, n) _XkbGeomAlloc((XPointer *)&(s)->rows, \ - &(s)->num_rows, &(s)->sz_rows, \ - (n), sizeof(XkbRowRec)) -#define _XkbAllocPoints(o, n) _XkbGeomAlloc((XPointer *)&(o)->points, \ - &(o)->num_points, &(o)->sz_points, \ - (n), sizeof(XkbPointRec)) -#define _XkbAllocKeys(r, n) _XkbGeomAlloc((XPointer *)&(r)->keys, \ - &(r)->num_keys, &(r)->sz_keys, \ - (n), sizeof(XkbKeyRec)) -#define _XkbAllocOverlays(s, n) _XkbGeomAlloc((XPointer *)&(s)->overlays, \ - &(s)->num_overlays, &(s)->sz_overlays, \ - (n), sizeof(XkbOverlayRec)) -#define _XkbAllocOverlayRows(o, n) _XkbGeomAlloc((XPointer *)&(o)->rows, \ - &(o)->num_rows, &(o)->sz_rows, \ - (n), sizeof(XkbOverlayRowRec)) -#define _XkbAllocOverlayKeys(r, n) _XkbGeomAlloc((XPointer *)&(r)->keys, \ - &(r)->num_keys, &(r)->sz_keys, \ - (n), sizeof(XkbOverlayKeyRec)) - -Status -XkbAllocGeomProps(XkbGeometryPtr geom, int nProps) -{ - return _XkbAllocProps(geom, nProps); -} - -Status -XkbAllocGeomColors(XkbGeometryPtr geom, int nColors) -{ - return _XkbAllocColors(geom, nColors); -} - -Status -XkbAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases) -{ - return _XkbAllocKeyAliases(geom, nKeyAliases); -} - -Status -XkbAllocGeomShapes(XkbGeometryPtr geom, int nShapes) -{ - return _XkbAllocShapes(geom, nShapes); -} - -Status -XkbAllocGeomSections(XkbGeometryPtr geom, int nSections) -{ - return _XkbAllocSections(geom, nSections); -} - -Status -XkbAllocGeomOverlays(XkbSectionPtr section, int nOverlays) -{ - return _XkbAllocOverlays(section, nOverlays); -} - -Status -XkbAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows) -{ - return _XkbAllocOverlayRows(overlay, nRows); -} - -Status -XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys) -{ - return _XkbAllocOverlayKeys(row, nKeys); -} - -Status -XkbAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads) -{ - return _XkbAllocDoodads(geom, nDoodads); -} - -Status -XkbAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads) -{ - return _XkbAllocDoodads(section, nDoodads); -} - -Status -XkbAllocGeomOutlines(XkbShapePtr shape, int nOL) -{ - return _XkbAllocOutlines(shape, nOL); -} - -Status -XkbAllocGeomRows(XkbSectionPtr section, int nRows) -{ - return _XkbAllocRows(section, nRows); -} - -Status -XkbAllocGeomPoints(XkbOutlinePtr ol, int nPts) -{ - return _XkbAllocPoints(ol, nPts); -} - -Status -XkbAllocGeomKeys(XkbRowPtr row, int nKeys) -{ - return _XkbAllocKeys(row, nKeys); -} - -Status -XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes) -{ - XkbGeometryPtr geom; - Status rtrn; - - if (xkb->geom == NULL) { - xkb->geom = _XkbTypedCalloc(1, XkbGeometryRec); - if (!xkb->geom) - return BadAlloc; - } - geom = xkb->geom; - if ((sizes->which & XkbGeomPropertiesMask) && - ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success)) { - goto BAIL; - } - if ((sizes->which & XkbGeomColorsMask) && - ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success)) { - goto BAIL; - } - if ((sizes->which & XkbGeomShapesMask) && - ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success)) { - goto BAIL; - } - if ((sizes->which & XkbGeomSectionsMask) && - ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success)) { - goto BAIL; - } - if ((sizes->which & XkbGeomDoodadsMask) && - ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success)) { - goto BAIL; - } - if ((sizes->which & XkbGeomKeyAliasesMask) && - ((rtrn = _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) - != Success)) { - goto BAIL; - } - return Success; - BAIL: - XkbFreeGeometry(geom, XkbGeomAllMask, True); - xkb->geom = NULL; - return rtrn; -} - -/***====================================================================***/ - -XkbPropertyPtr -XkbAddGeomProperty(XkbGeometryPtr geom, char *name, char *value) -{ - register int i; - register XkbPropertyPtr prop; - - if ((!geom) || (!name) || (!value)) - return NULL; - for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { - if ((prop->name) && (strcmp(name, prop->name) == 0)) { - _XkbFree(prop->value); - prop->value = strdup(value); - return prop; - } - } - if ((geom->num_properties >= geom->sz_properties) && - (_XkbAllocProps(geom, 1) != Success)) { - return NULL; - } - prop = &geom->properties[geom->num_properties]; - prop->name = strdup(name); - if (!prop->name) - return NULL; - prop->value = strdup(value); - if (!prop->value) { - _XkbFree(prop->name); - prop->name = NULL; - return NULL; - } - geom->num_properties++; - return prop; -} - -XkbKeyAliasPtr -XkbAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr) -{ - register int i; - register XkbKeyAliasPtr alias; - - if ((!geom) || (!aliasStr) || (!realStr) || (!aliasStr[0]) || (!realStr[0])) - return NULL; - for (i = 0, alias = geom->key_aliases; i < geom->num_key_aliases; - i++, alias++) { - if (strncmp(alias->alias, aliasStr, XkbKeyNameLength) == 0) { - bzero(alias->real, XkbKeyNameLength); - strncpy(alias->real, realStr, XkbKeyNameLength); - return alias; - } - } - if ((geom->num_key_aliases >= geom->sz_key_aliases) && - (_XkbAllocKeyAliases(geom, 1) != Success)) { - return NULL; - } - alias = &geom->key_aliases[geom->num_key_aliases]; - bzero(alias, sizeof(XkbKeyAliasRec)); - strncpy(alias->alias, aliasStr, XkbKeyNameLength); - strncpy(alias->real, realStr, XkbKeyNameLength); - geom->num_key_aliases++; - return alias; -} - -XkbColorPtr -XkbAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel) -{ - register int i; - register XkbColorPtr color; - - if ((!geom) || (!spec)) - return NULL; - for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { - if ((color->spec) && (strcmp(color->spec, spec) == 0)) { - color->pixel = pixel; - return color; - } - } - if ((geom->num_colors >= geom->sz_colors) && - (_XkbAllocColors(geom, 1) != Success)) { - return NULL; - } - color = &geom->colors[geom->num_colors]; - color->pixel = pixel; - color->spec = strdup(spec); - if (!color->spec) - return NULL; - geom->num_colors++; - return color; -} - -XkbOutlinePtr -XkbAddGeomOutline(XkbShapePtr shape, int sz_points) -{ - XkbOutlinePtr outline; - - if ((!shape) || (sz_points < 0)) - return NULL; - if ((shape->num_outlines >= shape->sz_outlines) && - (_XkbAllocOutlines(shape, 1) != Success)) { - return NULL; - } - outline = &shape->outlines[shape->num_outlines]; - bzero(outline, sizeof(XkbOutlineRec)); - if ((sz_points > 0) && (_XkbAllocPoints(outline, sz_points) != Success)) - return NULL; - shape->num_outlines++; - return outline; -} - -XkbShapePtr -XkbAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines) -{ - XkbShapePtr shape; - register int i; - - if ((!geom) || (!name) || (sz_outlines < 0)) - return NULL; - if (geom->num_shapes > 0) { - for (shape = geom->shapes, i = 0; i < geom->num_shapes; i++, shape++) { - if (name == shape->name) - return shape; - } - } - if ((geom->num_shapes >= geom->sz_shapes) && - (_XkbAllocShapes(geom, 1) != Success)) - return NULL; - shape = &geom->shapes[geom->num_shapes]; - bzero(shape, sizeof(XkbShapeRec)); - if ((sz_outlines > 0) && (_XkbAllocOutlines(shape, sz_outlines) != Success)) - return NULL; - shape->name = name; - shape->primary = shape->approx = NULL; - geom->num_shapes++; - return shape; -} - -XkbKeyPtr -XkbAddGeomKey(XkbRowPtr row) -{ - XkbKeyPtr key; - - if (!row) - return NULL; - if ((row->num_keys >= row->sz_keys) && (_XkbAllocKeys(row, 1) != Success)) - return NULL; - key = &row->keys[row->num_keys++]; - bzero(key, sizeof(XkbKeyRec)); - return key; -} - -XkbRowPtr -XkbAddGeomRow(XkbSectionPtr section, int sz_keys) -{ - XkbRowPtr row; - - if ((!section) || (sz_keys < 0)) - return NULL; - if ((section->num_rows >= section->sz_rows) && - (_XkbAllocRows(section, 1) != Success)) - return NULL; - row = §ion->rows[section->num_rows]; - bzero(row, sizeof(XkbRowRec)); - if ((sz_keys > 0) && (_XkbAllocKeys(row, sz_keys) != Success)) - return NULL; - section->num_rows++; - return row; -} - -XkbSectionPtr -XkbAddGeomSection(XkbGeometryPtr geom, - Atom name, - int sz_rows, - int sz_doodads, - int sz_over) -{ - register int i; - XkbSectionPtr section; - - if ((!geom) || (name == None) || (sz_rows < 0)) - return NULL; - for (i = 0, section = geom->sections; i < geom->num_sections; - i++, section++) { - if (section->name != name) - continue; - if (((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) || - ((sz_doodads > 0) && - (_XkbAllocDoodads(section, sz_doodads) != Success)) || - ((sz_over > 0) && (_XkbAllocOverlays(section, sz_over) != Success))) - return NULL; - return section; - } - if ((geom->num_sections >= geom->sz_sections) && - (_XkbAllocSections(geom, 1) != Success)) - return NULL; - section = &geom->sections[geom->num_sections]; - if ((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) - return NULL; - if ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) { - if (section->rows) { - _XkbFree(section->rows); - section->rows = NULL; - section->sz_rows = section->num_rows = 0; - } - return NULL; - } - section->name = name; - geom->num_sections++; - return section; -} - -XkbDoodadPtr -XkbAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name) -{ - XkbDoodadPtr old, doodad; - register int i, nDoodads; - - if ((!geom) || (name == None)) - return NULL; - if ((section != NULL) && (section->num_doodads > 0)) { - old = section->doodads; - nDoodads = section->num_doodads; - } - else { - old = geom->doodads; - nDoodads = geom->num_doodads; - } - for (i = 0, doodad = old; i < nDoodads; i++, doodad++) { - if (doodad->any.name == name) - return doodad; - } - if (section) { - if ((section->num_doodads >= geom->sz_doodads) && - (_XkbAllocDoodads(section, 1) != Success)) { - return NULL; - } - doodad = §ion->doodads[section->num_doodads++]; - } - else { - if ((geom->num_doodads >= geom->sz_doodads) && - (_XkbAllocDoodads(geom, 1) != Success)) - return NULL; - doodad = &geom->doodads[geom->num_doodads++]; - } - bzero(doodad, sizeof(XkbDoodadRec)); - doodad->any.name = name; - return doodad; -} - -XkbOverlayKeyPtr -XkbAddGeomOverlayKey(XkbOverlayPtr overlay, - XkbOverlayRowPtr row, - char *over, - char *under) -{ - register int i; - XkbOverlayKeyPtr key; - XkbSectionPtr section; - XkbRowPtr row_under; - Bool found; - - if ((!overlay) || (!row) || (!over) || (!under)) - return NULL; - section = overlay->section_under; - if (row->row_under >= section->num_rows) - return NULL; - row_under = §ion->rows[row->row_under]; - for (i = 0, found = False; i < row_under->num_keys; i++) { - if (strncmp(under, row_under->keys[i].name.name, XkbKeyNameLength) == 0) { - found = True; - break; - } - } - if (!found) - return NULL; - if ((row->num_keys >= row->sz_keys) && - (_XkbAllocOverlayKeys(row, 1) != Success)) - return NULL; - key = &row->keys[row->num_keys]; - strncpy(key->under.name, under, XkbKeyNameLength); - strncpy(key->over.name, over, XkbKeyNameLength); - row->num_keys++; - return key; -} - -XkbOverlayRowPtr -XkbAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys) -{ - register int i; - XkbOverlayRowPtr row; - - if ((!overlay) || (sz_keys < 0)) - return NULL; - if (row_under >= overlay->section_under->num_rows) - return NULL; - for (i = 0; i < overlay->num_rows; i++) { - if (overlay->rows[i].row_under == row_under) { - row = &overlay->rows[i]; - if ((row->sz_keys < sz_keys) && - (_XkbAllocOverlayKeys(row, sz_keys) != Success)) { - return NULL; - } - return &overlay->rows[i]; - } - } - if ((overlay->num_rows >= overlay->sz_rows) && - (_XkbAllocOverlayRows(overlay, 1) != Success)) - return NULL; - row = &overlay->rows[overlay->num_rows]; - bzero(row, sizeof(XkbOverlayRowRec)); - if ((sz_keys > 0) && (_XkbAllocOverlayKeys(row, sz_keys) != Success)) - return NULL; - row->row_under = row_under; - overlay->num_rows++; - return row; -} - -XkbOverlayPtr -XkbAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows) -{ - register int i; - XkbOverlayPtr overlay; - - if ((!section) || (name == None) || (sz_rows == 0)) - return NULL; - - for (i = 0, overlay = section->overlays; i < section->num_overlays; - i++, overlay++) { - if (overlay->name == name) { - if ((sz_rows > 0) && - (_XkbAllocOverlayRows(overlay, sz_rows) != Success)) - return NULL; - return overlay; - } - } - if ((section->num_overlays >= section->sz_overlays) && - (_XkbAllocOverlays(section, 1) != Success)) - return NULL; - overlay = §ion->overlays[section->num_overlays]; - if ((sz_rows > 0) && (_XkbAllocOverlayRows(overlay, sz_rows) != Success)) - return NULL; - overlay->name = name; - overlay->section_under = section; - section->num_overlays++; - return overlay; -} diff --git a/nx-X11/lib/X11/XKBGeom.c b/nx-X11/lib/X11/XKBGeom.c deleted file mode 100644 index f57fe7cf6..000000000 --- a/nx-X11/lib/X11/XKBGeom.c +++ /dev/null @@ -1,724 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef DEBUG -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#endif - -#define NEED_MAP_READERS -#include "Xlibint.h" -#include -#include -#include "XKBlibint.h" - -#ifndef MINSHORT -#define MINSHORT -32768 -#endif -#ifndef MAXSHORT -#define MAXSHORT 32767 -#endif - -/***====================================================================***/ - -static void -_XkbCheckBounds(XkbBoundsPtr bounds, int x, int y) -{ - if (x < bounds->x1) - bounds->x1 = x; - if (x > bounds->x2) - bounds->x2 = x; - if (y < bounds->y1) - bounds->y1 = y; - if (y > bounds->y2) - bounds->y2 = y; - return; -} - -Bool -XkbComputeShapeBounds(XkbShapePtr shape) -{ - register int o, p; - XkbOutlinePtr outline; - XkbPointPtr pt; - - if ((!shape) || (shape->num_outlines < 1)) - return False; - shape->bounds.x1 = shape->bounds.y1 = MAXSHORT; - shape->bounds.x2 = shape->bounds.y2 = MINSHORT; - for (outline = shape->outlines, o = 0; o < shape->num_outlines; - o++, outline++) { - for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++) { - _XkbCheckBounds(&shape->bounds, pt->x, pt->y); - } - if (outline->num_points < 2) { - _XkbCheckBounds(&shape->bounds, 0, 0); - } - } - return True; -} - -Bool -XkbComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds) -{ - register int p; - XkbOutlinePtr outline; - XkbPointPtr pt; - - if ((!shape) || (shape->num_outlines < 1)) - return False; - if (shape->approx) - outline = shape->approx; - else - outline = &shape->outlines[shape->num_outlines - 1]; - if (outline->num_points < 2) { - bounds->x1 = bounds->y1 = 0; - bounds->x2 = bounds->y2 = 0; - } - else { - bounds->x1 = bounds->y1 = MAXSHORT; - bounds->x2 = bounds->y2 = MINSHORT; - } - for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++) { - _XkbCheckBounds(bounds, pt->x, pt->y); - } - return True; -} - -Bool -XkbComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row) -{ - register int k, pos; - XkbKeyPtr key; - XkbBoundsPtr bounds, sbounds; - - if ((!geom) || (!section) || (!row)) - return False; - bounds = &row->bounds; - bzero(bounds, sizeof(XkbBoundsRec)); - for (key = row->keys, pos = k = 0; k < row->num_keys; k++, key++) { - sbounds = &XkbKeyShape(geom, key)->bounds; - _XkbCheckBounds(bounds, pos, 0); - if (!row->vertical) { - if (key->gap != 0) { - pos += key->gap; - _XkbCheckBounds(bounds, pos, 0); - } - _XkbCheckBounds(bounds, pos + sbounds->x1, sbounds->y1); - _XkbCheckBounds(bounds, pos + sbounds->x2, sbounds->y2); - pos += sbounds->x2; - } - else { - if (key->gap != 0) { - pos += key->gap; - _XkbCheckBounds(bounds, 0, pos); - } - _XkbCheckBounds(bounds, pos + sbounds->x1, sbounds->y1); - _XkbCheckBounds(bounds, pos + sbounds->x2, sbounds->y2); - pos += sbounds->y2; - } - } - return True; -} - -Bool -XkbComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section) -{ - register int i; - XkbShapePtr shape; - XkbRowPtr row; - XkbDoodadPtr doodad; - XkbBoundsPtr bounds, rbounds; - - if ((!geom) || (!section)) - return False; - bounds = §ion->bounds; - bzero(bounds, sizeof(XkbBoundsRec)); - for (i = 0, row = section->rows; i < section->num_rows; i++, row++) { - if (!XkbComputeRowBounds(geom, section, row)) - return False; - rbounds = &row->bounds; - _XkbCheckBounds(bounds, row->left + rbounds->x1, - row->top + rbounds->y1); - _XkbCheckBounds(bounds, row->left + rbounds->x2, - row->top + rbounds->y2); - } - for (i = 0, doodad = section->doodads; i < section->num_doodads; - i++, doodad++) { - static XkbBoundsRec tbounds; - - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: - shape = XkbShapeDoodadShape(geom, &doodad->shape); - rbounds = &shape->bounds; - break; - case XkbTextDoodad: - tbounds.x1 = doodad->text.left; - tbounds.y1 = doodad->text.top; - tbounds.x2 = tbounds.x1 + doodad->text.width; - tbounds.y2 = tbounds.y1 + doodad->text.height; - rbounds = &tbounds; - break; - case XkbIndicatorDoodad: - shape = XkbIndicatorDoodadShape(geom, &doodad->indicator); - rbounds = &shape->bounds; - break; - case XkbLogoDoodad: - shape = XkbLogoDoodadShape(geom, &doodad->logo); - rbounds = &shape->bounds; - break; - default: - tbounds.x1 = tbounds.x2 = doodad->any.left; - tbounds.y1 = tbounds.y2 = doodad->any.top; - rbounds = &tbounds; - break; - } - _XkbCheckBounds(bounds, rbounds->x1, rbounds->y1); - _XkbCheckBounds(bounds, rbounds->x2, rbounds->y2); - } - return True; -} - -/***====================================================================***/ - -char * -XkbFindOverlayForKey(XkbGeometryPtr geom, XkbSectionPtr wanted, char *under) -{ - int s; - XkbSectionPtr section; - - if ((geom == NULL) || (under == NULL) || (geom->num_sections < 1)) - return NULL; - - if (wanted) - section = wanted; - else - section = geom->sections; - - for (s = 0; s < geom->num_sections; s++, section++) { - XkbOverlayPtr ol; - int o; - - if (section->num_overlays < 1) - continue; - for (o = 0, ol = section->overlays; o < section->num_overlays; - o++, ol++) { - XkbOverlayRowPtr row; - int r; - - for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { - XkbOverlayKeyPtr key; - int k; - - for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { - if (strncmp(under, key->under.name, XkbKeyNameLength) == 0) - return key->over.name; - } - } - } - if (wanted != NULL) - break; - } - return NULL; -} - -/***====================================================================***/ - -static Status -_XkbReadGeomProperties(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - xkbGetGeometryReply *rep) -{ - Status rtrn; - - if (rep->nProperties < 1) - return Success; - if ((rtrn = XkbAllocGeomProps(geom, rep->nProperties)) == Success) { - register int i; - register Bool ok = True; - - for (i = 0; (i < rep->nProperties) && ok; i++) { - char *name = NULL; - char *value = NULL; - ok = _XkbGetReadBufferCountedString(buf, &name) && ok; - ok = _XkbGetReadBufferCountedString(buf, &value) && ok; - ok = ok && (XkbAddGeomProperty(geom, name, value) != NULL); - - _XkbFree(name); - _XkbFree(value); - } - if (ok) - rtrn = Success; - else - rtrn = BadLength; - } - return rtrn; -} - -static Status -_XkbReadGeomKeyAliases(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - xkbGetGeometryReply *rep) -{ - Status rtrn; - - if (rep->nKeyAliases < 1) - return Success; - if ((rtrn = XkbAllocGeomKeyAliases(geom, rep->nKeyAliases)) == Success) { - if (!_XkbCopyFromReadBuffer(buf, (char *) geom->key_aliases, - (rep->nKeyAliases * XkbKeyNameLength * 2))) - return BadLength; - geom->num_key_aliases = rep->nKeyAliases; - return Success; - } - else { /* alloc failed, just skip the aliases */ - _XkbSkipReadBufferData(buf, (rep->nKeyAliases * XkbKeyNameLength * 2)); - } - return rtrn; -} - -static Status -_XkbReadGeomColors(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - xkbGetGeometryReply *rep) -{ - Status rtrn; - - if (rep->nColors < 1) - return Success; - if ((rtrn = XkbAllocGeomColors(geom, rep->nColors)) == Success) { - register int i; - - for (i = 0; i < rep->nColors; i++) { - char *spec = NULL; - if (!_XkbGetReadBufferCountedString(buf, &spec)) - rtrn = BadLength; - else if (XkbAddGeomColor(geom, spec, geom->num_colors) == NULL) - rtrn = BadAlloc; - - _XkbFree(spec); - if (rtrn != Success) - return rtrn; - } - return Success; - } - return rtrn; -} - -static Status -_XkbReadGeomShapes(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - xkbGetGeometryReply *rep) -{ - register int i; - Status rtrn; - - if (rep->nShapes < 1) - return Success; - if ((rtrn = XkbAllocGeomShapes(geom, rep->nShapes)) != Success) - return rtrn; - for (i = 0; i < rep->nShapes; i++) { - xkbShapeWireDesc *shapeWire; - XkbShapePtr shape; - register int o; - - shapeWire = (xkbShapeWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbShapeWireDesc)); - if (!shapeWire) - return BadLength; - shape = XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); - if (!shape) - return BadAlloc; - for (o = 0; o < shapeWire->nOutlines; o++) { - xkbOutlineWireDesc *olWire; - XkbOutlinePtr ol; - register int p; - XkbPointPtr pt; - - olWire = (xkbOutlineWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbOutlineWireDesc)); - if (!olWire) - return BadLength; - ol = XkbAddGeomOutline(shape, olWire->nPoints); - if (!ol) - return BadAlloc; - ol->corner_radius = olWire->cornerRadius; - for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) { - xkbPointWireDesc *ptWire; - - ptWire = (xkbPointWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbPointWireDesc)); - if (!ptWire) - return BadLength; - pt->x = ptWire->x; - pt->y = ptWire->y; - } - ol->num_points = olWire->nPoints; - } - if ((shapeWire->primaryNdx != XkbNoShape) && - (shapeWire->primaryNdx < shapeWire->nOutlines)) - shape->primary = &shape->outlines[shapeWire->primaryNdx]; - else - shape->primary = NULL; - if ((shapeWire->approxNdx != XkbNoShape) && - (shapeWire->approxNdx < shapeWire->nOutlines)) - shape->approx = &shape->outlines[shapeWire->approxNdx]; - else - shape->approx = NULL; - XkbComputeShapeBounds(shape); - } - return Success; -} - -static Status -_XkbReadGeomDoodad(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - XkbSectionPtr section) -{ - XkbDoodadPtr doodad; - xkbDoodadWireDesc *doodadWire; - - doodadWire = (xkbDoodadWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbDoodadWireDesc)); - if (!doodadWire) - return BadLength; - doodad = XkbAddGeomDoodad(geom, section, doodadWire->any.name); - if (!doodad) - return BadAlloc; - doodad->any.type = doodadWire->any.type; - doodad->any.priority = doodadWire->any.priority; - doodad->any.top = doodadWire->any.top; - doodad->any.left = doodadWire->any.left; - doodad->any.angle = doodadWire->any.angle; - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: - doodad->shape.color_ndx = doodadWire->shape.colorNdx; - doodad->shape.shape_ndx = doodadWire->shape.shapeNdx; - break; - case XkbTextDoodad: - doodad->text.width = doodadWire->text.width; - doodad->text.height = doodadWire->text.height; - doodad->text.color_ndx = doodadWire->text.colorNdx; - if (!_XkbGetReadBufferCountedString(buf, &doodad->text.text)) - return BadLength; - if (!_XkbGetReadBufferCountedString(buf, &doodad->text.font)) - return BadLength; - break; - case XkbIndicatorDoodad: - doodad->indicator.shape_ndx = doodadWire->indicator.shapeNdx; - doodad->indicator.on_color_ndx = doodadWire->indicator.onColorNdx; - doodad->indicator.off_color_ndx = doodadWire->indicator.offColorNdx; - break; - case XkbLogoDoodad: - doodad->logo.color_ndx = doodadWire->logo.colorNdx; - doodad->logo.shape_ndx = doodadWire->logo.shapeNdx; - if (!_XkbGetReadBufferCountedString(buf, &doodad->logo.logo_name)) - return BadLength; - break; - default: - return BadValue; - } - return Success; -} - -static Status -_XkbReadGeomOverlay(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - XkbSectionPtr section) -{ - XkbOverlayPtr ol; - xkbOverlayWireDesc *olWire; - register int r; - - olWire = (xkbOverlayWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayWireDesc)); - if (olWire == NULL) - return BadLength; - ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows); - if (ol == NULL) - return BadLength; - for (r = 0; r < olWire->nRows; r++) { - register int k; - XkbOverlayRowPtr row; - xkbOverlayRowWireDesc *rowWire; - xkbOverlayKeyWireDesc *keyWire; - - rowWire = (xkbOverlayRowWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayRowWireDesc)); - if (rowWire == NULL) - return BadLength; - row = XkbAddGeomOverlayRow(ol, rowWire->rowUnder, rowWire->nKeys); - if (!row) - return BadAlloc; - row->row_under = rowWire->rowUnder; - if (rowWire->nKeys < 1) - continue; - keyWire = (xkbOverlayKeyWireDesc *) - _XkbGetReadBufferPtr(buf, - SIZEOF(xkbOverlayKeyWireDesc) * rowWire->nKeys); - if (keyWire == NULL) - return BadLength; - for (k = 0; k < rowWire->nKeys; k++, keyWire++, row->num_keys++) { - memcpy(row->keys[row->num_keys].over.name, keyWire->over, - XkbKeyNameLength); - memcpy(row->keys[row->num_keys].under.name, keyWire->under, - XkbKeyNameLength); - } - } - return Success; -} - -static Status -_XkbReadGeomSections(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - xkbGetGeometryReply *rep) -{ - register int s; - XkbSectionPtr section; - xkbSectionWireDesc *sectionWire; - Status rtrn; - - if (rep->nSections < 1) - return Success; - if ((rtrn = XkbAllocGeomSections(geom, rep->nSections)) != Success) - return rtrn; - for (s = 0; s < rep->nSections; s++) { - sectionWire = (xkbSectionWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbSectionWireDesc)); - if (!sectionWire) - return BadLength; - section = XkbAddGeomSection(geom, sectionWire->name, sectionWire->nRows, - sectionWire->nDoodads, - sectionWire->nOverlays); - if (!section) - return BadAlloc; - section->top = sectionWire->top; - section->left = sectionWire->left; - section->width = sectionWire->width; - section->height = sectionWire->height; - section->angle = sectionWire->angle; - section->priority = sectionWire->priority; - if (sectionWire->nRows > 0) { - register int r; - - for (r = 0; r < sectionWire->nRows; r++) { - XkbRowPtr row; - xkbRowWireDesc *rowWire; - - rowWire = (xkbRowWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbRowWireDesc)); - if (!rowWire) - return BadLength; - row = XkbAddGeomRow(section, rowWire->nKeys); - if (!row) - return BadAlloc; - row->top = rowWire->top; - row->left = rowWire->left; - row->vertical = rowWire->vertical; - if (rowWire->nKeys > 0) { - register int k; - - for (k = 0; k < rowWire->nKeys; k++) { - XkbKeyPtr key; - xkbKeyWireDesc *keyWire; - - keyWire = (xkbKeyWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyWireDesc)); - if (!keyWire) - return BadLength; - key = XkbAddGeomKey(row); - if (!key) - return BadAlloc; - memcpy(key->name.name, keyWire->name, XkbKeyNameLength); - key->gap = keyWire->gap; - key->shape_ndx = keyWire->shapeNdx; - key->color_ndx = keyWire->colorNdx; - } - } - } - } - if (sectionWire->nDoodads > 0) { - register int d; - - for (d = 0; d < sectionWire->nDoodads; d++) { - if ((rtrn = _XkbReadGeomDoodad(buf, geom, section)) != Success) - return rtrn; - } - } - if (sectionWire->nOverlays > 0) { - register int o; - - for (o = 0; o < sectionWire->nOverlays; o++) { - if ((rtrn = _XkbReadGeomOverlay(buf, geom, section)) != Success) - return rtrn; - } - } - } - return Success; -} - -static Status -_XkbReadGeomDoodads(XkbReadBufferPtr buf, - XkbGeometryPtr geom, - xkbGetGeometryReply *rep) -{ - register int d; - Status rtrn; - - if (rep->nDoodads < 1) - return Success; - if ((rtrn = XkbAllocGeomDoodads(geom, rep->nDoodads)) != Success) - return rtrn; - for (d = 0; d < rep->nDoodads; d++) { - if ((rtrn = _XkbReadGeomDoodad(buf, geom, NULL)) != Success) - return rtrn; - } - return Success; -} - -Status -_XkbReadGetGeometryReply(Display *dpy, - xkbGetGeometryReply *rep, - XkbDescPtr xkb, - int *nread_rtrn) -{ - XkbGeometryPtr geom; - - geom = _XkbTypedCalloc(1, XkbGeometryRec); - if (!geom) - return BadAlloc; - if (xkb->geom) - XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); - xkb->geom = geom; - - geom->name = rep->name; - geom->width_mm = rep->widthMM; - geom->height_mm = rep->heightMM; - if (rep->length) { - XkbReadBufferRec buf; - int left; - - if (_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) { - Status status = Success; - - if (nread_rtrn) - *nread_rtrn = (int) rep->length * 4; - if (!_XkbGetReadBufferCountedString(&buf, &geom->label_font)) - status = BadLength; - if (status == Success) - status = _XkbReadGeomProperties(&buf, geom, rep); - if (status == Success) - status = _XkbReadGeomColors(&buf, geom, rep); - if (status == Success) - status = _XkbReadGeomShapes(&buf, geom, rep); - if (status == Success) - status = _XkbReadGeomSections(&buf, geom, rep); - if (status == Success) - status = _XkbReadGeomDoodads(&buf, geom, rep); - if (status == Success) - status = _XkbReadGeomKeyAliases(&buf, geom, rep); - left = _XkbFreeReadBuffer(&buf); - if ((rep->baseColorNdx > geom->num_colors) || - (rep->labelColorNdx > geom->num_colors)) - status = BadLength; - if ((status != Success) || left || buf.error) { - if (status == Success) - status = BadLength; - XkbFreeGeometry(geom, XkbGeomAllMask, True); - xkb->geom = NULL; - return status; - } - geom->base_color = &geom->colors[rep->baseColorNdx]; - geom->label_color = &geom->colors[rep->labelColorNdx]; - } - else { - XkbFreeGeometry(geom, XkbGeomAllMask, True); - xkb->geom = NULL; - return BadAlloc; - } - } - return Success; -} - -Status -XkbGetGeometry(Display *dpy, XkbDescPtr xkb) -{ - xkbGetGeometryReq *req; - xkbGetGeometryReply rep; - Status status; - - if ((!xkb) || (dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - LockDisplay(dpy); - GetReq(kbGetGeometry, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetGeometry; - req->deviceSpec = xkb->device_spec; - req->name = None; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) - status = BadImplementation; - else if (!rep.found) - status = BadName; - else - status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetNamedGeometry(Display *dpy, XkbDescPtr xkb, Atom name) -{ - xkbGetGeometryReq *req; - xkbGetGeometryReply rep; - Status status; - - if ((name == None) || (dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - LockDisplay(dpy); - GetReq(kbGetGeometry, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetGeometry; - req->deviceSpec = xkb->device_spec; - req->name = (CARD32) name; - if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.found)) - status = BadImplementation; - else if (!rep.found) - status = BadName; - else - status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} diff --git a/nx-X11/lib/X11/XKBGetByName.c b/nx-X11/lib/X11/XKBGetByName.c deleted file mode 100644 index c673781ed..000000000 --- a/nx-X11/lib/X11/XKBGetByName.c +++ /dev/null @@ -1,226 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#define NEED_MAP_READERS -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -/***====================================================================***/ - -XkbDescPtr -XkbGetKeyboardByName(Display *dpy, - unsigned deviceSpec, - XkbComponentNamesPtr names, - unsigned want, - unsigned need, - Bool load) -{ - register xkbGetKbdByNameReq *req; - xkbGetKbdByNameReply rep; - int len, extraLen = 0; - char *str; - XkbDescPtr xkb; - int mapLen, codesLen, typesLen, compatLen; - int symsLen, geomLen; - XkbInfoPtr xkbi; - - if ((dpy == NULL) || (dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return NULL; - - xkbi = dpy->xkb_info; - xkb = (XkbDescRec *) _XkbCalloc(1, sizeof(XkbDescRec)); - if (!xkb) - return NULL; - xkb->device_spec = deviceSpec; - xkb->map = (XkbClientMapRec *) _XkbCalloc(1, sizeof(XkbClientMapRec)); - xkb->dpy = dpy; - - LockDisplay(dpy); - GetReq(kbGetKbdByName, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetKbdByName; - req->deviceSpec = xkb->device_spec; - req->want = want; - req->need = need; - req->load = load; - - mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; - if (names) { - if (names->keymap) - mapLen = (int) strlen(names->keymap); - if (names->keycodes) - codesLen = (int) strlen(names->keycodes); - if (names->types) - typesLen = (int) strlen(names->types); - if (names->compat) - compatLen = (int) strlen(names->compat); - if (names->symbols) - symsLen = (int) strlen(names->symbols); - if (names->geometry) - geomLen = (int) strlen(names->geometry); - if (mapLen > 255) - mapLen = 255; - if (codesLen > 255) - codesLen = 255; - if (typesLen > 255) - typesLen = 255; - if (compatLen > 255) - compatLen = 255; - if (symsLen > 255) - symsLen = 255; - if (geomLen > 255) - geomLen = 255; - } - else - mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; - - len = mapLen + codesLen + typesLen + compatLen + symsLen + geomLen + 6; - len = XkbPaddedSize(len); - req->length += len / 4; - BufAlloc(char *, str, len); - - *str++ = mapLen; - if (mapLen > 0) { - memcpy(str, names->keymap, mapLen); - str += mapLen; - } - *str++ = codesLen; - if (codesLen > 0) { - memcpy(str, names->keycodes, codesLen); - str += codesLen; - } - *str++ = typesLen; - if (typesLen > 0) { - memcpy(str, names->types, typesLen); - str += typesLen; - } - *str++ = compatLen; - if (compatLen > 0) { - memcpy(str, names->compat, compatLen); - str += compatLen; - } - *str++ = symsLen; - if (symsLen > 0) { - memcpy(str, names->symbols, symsLen); - str += symsLen; - } - *str++ = geomLen; - if (geomLen > 0) { - memcpy(str, names->geometry, geomLen); - str += geomLen; - } - if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.reported)) - goto BAILOUT; - extraLen = (int) rep.length * 4; - - xkb->device_spec = rep.deviceID; - xkb->min_key_code = rep.minKeyCode; - xkb->max_key_code = rep.maxKeyCode; - if (rep.reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) { - xkbGetMapReply mrep; - Status status; - int nread = 0; - - _XRead(dpy, (char *) &mrep, SIZEOF(xkbGetMapReply)); - extraLen -= SIZEOF(xkbGetMapReply); - status = _XkbReadGetMapReply(dpy, &mrep, xkb, &nread); - extraLen -= nread; - if (status != Success) - goto BAILOUT; - } - if (rep.reported & XkbGBN_CompatMapMask) { - xkbGetCompatMapReply crep; - Status status; - int nread = 0; - - _XRead(dpy, (char *) &crep, SIZEOF(xkbGetCompatMapReply)); - extraLen -= SIZEOF(xkbGetCompatMapReply); - status = _XkbReadGetCompatMapReply(dpy, &crep, xkb, &nread); - extraLen -= nread; - if (status != Success) - goto BAILOUT; - } - if (rep.reported & XkbGBN_IndicatorMapMask) { - xkbGetIndicatorMapReply irep; - Status status; - int nread = 0; - - _XRead(dpy, (char *) &irep, SIZEOF(xkbGetIndicatorMapReply)); - extraLen -= SIZEOF(xkbGetIndicatorMapReply); - status = _XkbReadGetIndicatorMapReply(dpy, &irep, xkb, &nread); - extraLen -= nread; - if (status != Success) - goto BAILOUT; - } - if (rep.reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask)) { - xkbGetNamesReply nrep; - Status status; - int nread = 0; - - _XRead(dpy, (char *) &nrep, SIZEOF(xkbGetNamesReply)); - extraLen -= SIZEOF(xkbGetNamesReply); - status = _XkbReadGetNamesReply(dpy, &nrep, xkb, &nread); - extraLen -= nread; - if (status != Success) - goto BAILOUT; - } - if (rep.reported & XkbGBN_GeometryMask) { - xkbGetGeometryReply grep; - Status status; - int nread = 0; - - _XRead(dpy, (char *) &grep, SIZEOF(xkbGetGeometryReply)); - extraLen -= SIZEOF(xkbGetGeometryReply); - status = _XkbReadGetGeometryReply(dpy, &grep, xkb, &nread); - extraLen -= nread; - if (status != Success) - goto BAILOUT; - } - if (extraLen > 0) - goto BAILOUT; - UnlockDisplay(dpy); - SyncHandle(); - return xkb; - BAILOUT: - if (xkb != NULL) - XkbFreeKeyboard(xkb, XkbAllComponentsMask, xTrue); - if (extraLen > 0) - _XEatData(dpy, extraLen); - UnlockDisplay(dpy); - SyncHandle(); - return NULL; -} - -XkbDescPtr -XkbGetKeyboard(Display *dpy, unsigned which, unsigned deviceSpec) -{ - return XkbGetKeyboardByName(dpy, deviceSpec, NULL, which, which, False); -} diff --git a/nx-X11/lib/X11/XKBGetMap.c b/nx-X11/lib/X11/XKBGetMap.c deleted file mode 100644 index 6e3c74343..000000000 --- a/nx-X11/lib/X11/XKBGetMap.c +++ /dev/null @@ -1,882 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#define NEED_MAP_READERS -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -static Status -_XkbReadKeyTypes(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) -{ - int i, n, lastMapCount; - XkbKeyTypePtr type; - - if (rep->nTypes > 0) { - n = rep->firstType + rep->nTypes; - if (xkb->map->num_types >= n) - n = xkb->map->num_types; - else if (XkbAllocClientMap(xkb, XkbKeyTypesMask, n) != Success) - return BadAlloc; - - type = &xkb->map->types[rep->firstType]; - for (i = 0; i < (int) rep->nTypes; i++, type++) { - xkbKeyTypeWireDesc *desc; - register int ndx; - - ndx = i + rep->firstType; - if (ndx >= xkb->map->num_types) - xkb->map->num_types = ndx + 1; - - desc = (xkbKeyTypeWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyTypeWireDesc)); - if (desc == NULL) - return BadLength; - - lastMapCount = type->map_count; - if (desc->nMapEntries > 0) { - if ((type->map == NULL) || - (desc->nMapEntries > type->map_count)) { - XkbKTMapEntryRec *prev_map = type->map; - - type->map = _XkbTypedRealloc(type->map, desc->nMapEntries, - XkbKTMapEntryRec); - if (type->map == NULL) { - _XkbFree(prev_map); - return BadAlloc; - } - } - } - else if (type->map != NULL) { - Xfree(type->map); - type->map_count = 0; - type->map = NULL; - } - - if (desc->preserve && (desc->nMapEntries > 0)) { - if ((!type->preserve) || (desc->nMapEntries > lastMapCount)) { - XkbModsRec *prev_preserve = type->preserve; - - type->preserve = _XkbTypedRealloc(type->preserve, - desc->nMapEntries, - XkbModsRec); - if (type->preserve == NULL) { - _XkbFree(prev_preserve); - return BadAlloc; - } - } - } - else if (type->preserve != NULL) { - Xfree(type->preserve); - type->preserve = NULL; - } - - type->mods.mask = desc->mask; - type->mods.real_mods = desc->realMods; - type->mods.vmods = desc->virtualMods; - type->num_levels = desc->numLevels; - type->map_count = desc->nMapEntries; - if (desc->nMapEntries > 0) { - register xkbKTMapEntryWireDesc *wire; - register XkbKTMapEntryPtr entry; - register int size; - - size = type->map_count * SIZEOF(xkbKTMapEntryWireDesc); - wire = - (xkbKTMapEntryWireDesc *) _XkbGetReadBufferPtr(buf, size); - if (wire == NULL) - return BadLength; - entry = type->map; - for (n = 0; n < type->map_count; n++, wire++, entry++) { - entry->active = wire->active; - entry->level = wire->level; - entry->mods.mask = wire->mask; - entry->mods.real_mods = wire->realMods; - entry->mods.vmods = wire->virtualMods; - } - - if (desc->preserve) { - register xkbModsWireDesc *pwire; - register XkbModsPtr preserve; - register int sz; - - sz = desc->nMapEntries * SIZEOF(xkbModsWireDesc); - pwire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(buf, sz); - if (pwire == NULL) - return BadLength; - preserve = type->preserve; - for (n = 0; n < desc->nMapEntries; n++, pwire++, preserve++) { - preserve->mask = pwire->mask; - preserve->vmods = pwire->virtualMods; - preserve->real_mods = pwire->realMods; - } - } - } - } - } - return Success; -} - -static Status -_XkbReadKeySyms(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) -{ - register int i; - XkbClientMapPtr map; - int size = xkb->max_key_code + 1; - - if (((unsigned short) rep->firstKeySym + rep->nKeySyms) > size) - return BadLength; - - map = xkb->map; - if (map->key_sym_map == NULL) { - register int offset; - XkbSymMapPtr oldMap; - xkbSymMapWireDesc *newMap; - - map->key_sym_map = _XkbTypedCalloc(size, XkbSymMapRec); - if (map->key_sym_map == NULL) - return BadAlloc; - if (map->syms == NULL) { - int sz; - - sz = (rep->totalSyms * 12) / 10; - sz = ((sz + (unsigned) 128) / 128) * 128; - map->syms = _XkbTypedCalloc(sz, KeySym); - if (map->syms == NULL) - return BadAlloc; - map->size_syms = sz; - } - offset = 1; - oldMap = &map->key_sym_map[rep->firstKeySym]; - for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { - newMap = (xkbSymMapWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); - if (newMap == NULL) - return BadLength; - oldMap->kt_index[0] = newMap->ktIndex[0]; - oldMap->kt_index[1] = newMap->ktIndex[1]; - oldMap->kt_index[2] = newMap->ktIndex[2]; - oldMap->kt_index[3] = newMap->ktIndex[3]; - oldMap->group_info = newMap->groupInfo; - oldMap->width = newMap->width; - oldMap->offset = offset; - if (offset + newMap->nSyms >= map->size_syms) { - register int sz; - KeySym *prev_syms = map->syms; - - sz = map->size_syms + 128; - map->syms = _XkbTypedRealloc(map->syms, sz, KeySym); - if (map->syms == NULL) { - _XkbFree(prev_syms); - map->size_syms = 0; - return BadAlloc; - } - map->size_syms = sz; - } - if (newMap->nSyms > 0) { - _XkbReadBufferCopyKeySyms(buf, (KeySym *) &map->syms[offset], - newMap->nSyms); - offset += newMap->nSyms; - } - else { - map->syms[offset] = 0; - } - } - map->num_syms = offset; - } - else { - XkbSymMapPtr oldMap = &map->key_sym_map[rep->firstKeySym]; - - for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { - xkbSymMapWireDesc *newMap; - KeySym *newSyms; - int tmp; - - newMap = (xkbSymMapWireDesc *) - _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); - if (newMap == NULL) - return BadLength; - - if (newMap->nSyms > 0) - tmp = newMap->nSyms; - else - tmp = 0; - - newSyms = XkbResizeKeySyms(xkb, i + rep->firstKeySym, tmp); - if (newSyms == NULL) - return BadAlloc; - if (newMap->nSyms > 0) - _XkbReadBufferCopyKeySyms(buf, newSyms, newMap->nSyms); - else - newSyms[0] = NoSymbol; - oldMap->kt_index[0] = newMap->ktIndex[0]; - oldMap->kt_index[1] = newMap->ktIndex[1]; - oldMap->kt_index[2] = newMap->ktIndex[2]; - oldMap->kt_index[3] = newMap->ktIndex[3]; - oldMap->group_info = newMap->groupInfo; - oldMap->width = newMap->width; - } - } - return Success; -} - -static Status -_XkbReadKeyActions(XkbReadBufferPtr buf, XkbDescPtr info, xkbGetMapReply *rep) -{ - int i; - CARD8 numDescBuf[248]; - CARD8 *numDesc = NULL; - register int nKeyActs; - Status ret = Success; - - if ((nKeyActs = rep->nKeyActs) > 0) { - XkbSymMapPtr symMap; - - if (nKeyActs < sizeof numDescBuf) - numDesc = numDescBuf; - else - numDesc = Xmalloc(nKeyActs * sizeof(CARD8)); - - if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) { - ret = BadLength; - goto done; - } - i = XkbPaddedSize(nKeyActs) - nKeyActs; - if ((i > 0) && (!_XkbSkipReadBufferData(buf, i))) { - ret = BadLength; - goto done; - } - symMap = &info->map->key_sym_map[rep->firstKeyAct]; - for (i = 0; i < (int) rep->nKeyActs; i++, symMap++) { - if (numDesc[i] == 0) { - if ((i + rep->firstKeyAct) > (info->max_key_code + 1)) { - ret = BadLength; - goto done; - } - info->server->key_acts[i + rep->firstKeyAct] = 0; - } - else { - XkbAction *newActs; - - /* 8/16/93 (ef) -- XXX! Verify size here (numdesc must be */ - /* either zero or XkbKeyNumSyms(info,key) */ - newActs = XkbResizeKeyActions(info, i + rep->firstKeyAct, - numDesc[i]); - if (newActs == NULL) { - ret = BadAlloc; - goto done; - } - if (!_XkbCopyFromReadBuffer(buf, (char *) newActs, - (int) (numDesc[i] * sizeof(XkbAction)))) { - ret = BadLength; - goto done; - } - } - } - } - done: - if (numDesc != NULL && numDesc != numDescBuf) - Xfree(numDesc); - return ret; -} - -static Status -_XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) -{ - register int i; - - if (rep->totalKeyBehaviors > 0) { - int size = xkb->max_key_code + 1; - - if (((int) rep->firstKeyBehavior + rep->nKeyBehaviors) > size) - return BadLength; - if (xkb->server->behaviors == NULL) { - xkb->server->behaviors = _XkbTypedCalloc(size, XkbBehavior); - if (xkb->server->behaviors == NULL) - return BadAlloc; - } - else { - bzero(&xkb->server->behaviors[rep->firstKeyBehavior], - (rep->nKeyBehaviors * sizeof(XkbBehavior))); - } - for (i = 0; i < rep->totalKeyBehaviors; i++) { - xkbBehaviorWireDesc *wire; - - wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf, - SIZEOF(xkbBehaviorWireDesc)); - if (wire == NULL || wire->key >= size) - return BadLength; - xkb->server->behaviors[wire->key].type = wire->type; - xkb->server->behaviors[wire->key].data = wire->data; - } - } - return Success; -} - -static Status -_XkbReadVirtualMods(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) -{ - if (rep->virtualMods) { - register int i, bit, nVMods; - register char *data; - - for (i = nVMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if (rep->virtualMods & bit) - nVMods++; - } - data = _XkbGetReadBufferPtr(buf, XkbPaddedSize(nVMods)); - if (data == NULL) - return BadLength; - for (i = 0, bit = 1; (i < XkbNumVirtualMods) && (nVMods > 0); - i++, bit <<= 1) { - if (rep->virtualMods & bit) { - xkb->server->vmods[i] = *data++; - nVMods--; - } - } - } - return Success; -} - -static Status -_XkbReadExplicitComponents(XkbReadBufferPtr buf, - XkbDescPtr xkb, - xkbGetMapReply *rep) -{ - register int i; - unsigned char *wire; - - if (rep->totalKeyExplicit > 0) { - int size = xkb->max_key_code + 1; - - if (((int) rep->firstKeyExplicit + rep->nKeyExplicit) > size) - return BadLength; - if (xkb->server->explicit == NULL) { - xkb->server->explicit = _XkbTypedCalloc(size, unsigned char); - - if (xkb->server->explicit == NULL) - return BadAlloc; - } - else { - bzero(&xkb->server->explicit[rep->firstKeyExplicit], - rep->nKeyExplicit); - } - i = XkbPaddedSize(2 * rep->totalKeyExplicit); - wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); - if (!wire) - return BadLength; - for (i = 0; i < rep->totalKeyExplicit; i++, wire += 2) { - if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) - return BadLength; - xkb->server->explicit[wire[0]] = wire[1]; - } - } - return Success; -} - -static Status -_XkbReadModifierMap(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) -{ - register int i; - unsigned char *wire; - - if (rep->totalModMapKeys > 0) { - if (((int) rep->firstModMapKey + rep->nModMapKeys) > - (xkb->max_key_code + 1)) - return BadLength; - if ((xkb->map->modmap == NULL) && - (XkbAllocClientMap(xkb, XkbModifierMapMask, 0) != Success)) { - return BadAlloc; - } - else { - bzero(&xkb->map->modmap[rep->firstModMapKey], rep->nModMapKeys); - } - i = XkbPaddedSize(2 * rep->totalModMapKeys); - wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); - if (!wire) - return BadLength; - for (i = 0; i < rep->totalModMapKeys; i++, wire += 2) { - if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) - return BadLength; - xkb->map->modmap[wire[0]] = wire[1]; - } - } - return Success; -} - -static Status -_XkbReadVirtualModMap(XkbReadBufferPtr buf, - XkbDescPtr xkb, - xkbGetMapReply *rep) -{ - register int i; - xkbVModMapWireDesc *wire; - XkbServerMapPtr srv; - - if (rep->totalVModMapKeys > 0) { - if (((int) rep->firstVModMapKey + rep->nVModMapKeys) - > xkb->max_key_code + 1) - return BadLength; - if (((xkb->server == NULL) || (xkb->server->vmodmap == NULL)) && - (XkbAllocServerMap(xkb, XkbVirtualModMapMask, 0) != Success)) { - return BadAlloc; - } - else { - srv = xkb->server; - if (rep->nVModMapKeys > rep->firstVModMapKey) - bzero((char *) &srv->vmodmap[rep->firstVModMapKey], - (rep->nVModMapKeys - rep->firstVModMapKey) * - sizeof(unsigned short)); - } - srv = xkb->server; - i = rep->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); - wire = (xkbVModMapWireDesc *) _XkbGetReadBufferPtr(buf, i); - if (!wire) - return BadLength; - for (i = 0; i < rep->totalVModMapKeys; i++, wire++) { - if ((wire->key >= xkb->min_key_code) && - (wire->key <= xkb->max_key_code)) - srv->vmodmap[wire->key] = wire->vmods; - } - } - return Success; -} - -static xkbGetMapReq * -_XkbGetGetMapReq(Display *dpy, XkbDescPtr xkb) -{ - xkbGetMapReq *req; - - GetReq(kbGetMap, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbGetMap; - req->deviceSpec = xkb->device_spec; - req->full = req->partial = 0; - req->firstType = req->nTypes = 0; - req->firstKeySym = req->nKeySyms = 0; - req->firstKeyAct = req->nKeyActs = 0; - req->firstKeyBehavior = req->nKeyBehaviors = 0; - req->virtualMods = 0; - req->firstKeyExplicit = req->nKeyExplicit = 0; - req->firstModMapKey = req->nModMapKeys = 0; - req->firstVModMapKey = req->nVModMapKeys = 0; - return req; -} - -Status -_XkbReadGetMapReply(Display *dpy, - xkbGetMapReply *rep, - XkbDescPtr xkb, - int *nread_rtrn) -{ - int extraData; - unsigned mask; - - if (xkb->device_spec == XkbUseCoreKbd) - xkb->device_spec = rep->deviceID; - if (rep->maxKeyCode < rep->minKeyCode) - return BadImplementation; - xkb->min_key_code = rep->minKeyCode; - xkb->max_key_code = rep->maxKeyCode; - - if (!xkb->map) { - mask = rep->present & XkbAllClientInfoMask; - if (mask && (XkbAllocClientMap(xkb, mask, rep->nTypes) != Success)) - return BadAlloc; - } - if (!xkb->server) { - mask = rep->present & XkbAllServerInfoMask; - if (mask && (XkbAllocServerMap(xkb, mask, rep->totalActs) != Success)) - return BadAlloc; - } - extraData = (int) (rep->length * 4); - extraData -= (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)); - if (rep->length) { - XkbReadBufferRec buf; - int left; - - if (_XkbInitReadBuffer(dpy, &buf, extraData)) { - Status status = Success; - - if (nread_rtrn != NULL) - *nread_rtrn = extraData; - if (status == Success) - status = _XkbReadKeyTypes(&buf, xkb, rep); - if (status == Success) - status = _XkbReadKeySyms(&buf, xkb, rep); - if (status == Success) - status = _XkbReadKeyActions(&buf, xkb, rep); - if (status == Success) - status = _XkbReadKeyBehaviors(&buf, xkb, rep); - if (status == Success) - status = _XkbReadVirtualMods(&buf, xkb, rep); - if (status == Success) - status = _XkbReadExplicitComponents(&buf, xkb, rep); - if (status == Success) - status = _XkbReadModifierMap(&buf, xkb, rep); - if (status == Success) - status = _XkbReadVirtualModMap(&buf, xkb, rep); - left = _XkbFreeReadBuffer(&buf); - if (status != Success) - return status; - else if (left || buf.error) - return BadLength; - } - else - return BadAlloc; - } - return Success; -} - -static Status -_XkbHandleGetMapReply(Display *dpy, XkbDescPtr xkb) -{ - xkbGetMapReply rep; - - if (!_XReply(dpy, (xReply *) &rep, - ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2), - xFalse)) { - return BadImplementation; - } - return _XkbReadGetMapReply(dpy, &rep, xkb, NULL); -} - -Status -XkbGetUpdatedMap(Display *dpy, unsigned which, XkbDescPtr xkb) -{ - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - if (which) { - register xkbGetMapReq *req; - Status status; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->full = which; - status = _XkbHandleGetMapReply(dpy, xkb); - - UnlockDisplay(dpy); - SyncHandle(); - return status; - } - return Success; -} - -XkbDescPtr -XkbGetMap(Display *dpy, unsigned which, unsigned deviceSpec) -{ - XkbDescPtr xkb; - - xkb = _XkbTypedCalloc(1, XkbDescRec); - if (xkb) { - xkb->device_spec = deviceSpec; - xkb->map = _XkbTypedCalloc(1, XkbClientMapRec); - if ((xkb->map == NULL) || - ((which) && (XkbGetUpdatedMap(dpy, which, xkb) != Success))) { - if (xkb->map) { - Xfree(xkb->map); - xkb->map = NULL; - } - Xfree(xkb); - return NULL; - } - xkb->dpy = dpy; - } - return xkb; -} - -Status -XkbGetKeyTypes(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - if ((num < 1) || (num > XkbMaxKeyTypes)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstType = first; - req->nTypes = num; - status = _XkbHandleGetMapReply(dpy, xkb); - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetKeyActions(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - if ((num < 1) || (num > XkbMaxKeyCount)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstKeyAct = first; - req->nKeyActs = num; - status = _XkbHandleGetMapReply(dpy, xkb); - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetKeySyms(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - if ((num < 1) || (num > XkbMaxKeyCount)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstKeySym = first; - req->nKeySyms = num; - status = _XkbHandleGetMapReply(dpy, xkb); - - UnlockDisplay(dpy); - SyncHandle(); - - return status; -} - -Status -XkbGetKeyBehaviors(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - if ((num < 1) || (num > XkbMaxKeyCount)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstKeyBehavior = first; - req->nKeyBehaviors = num; - status = _XkbHandleGetMapReply(dpy, xkb); - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetVirtualMods(Display *dpy, unsigned which, XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->virtualMods = which; - status = _XkbHandleGetMapReply(dpy, xkb); - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetKeyExplicitComponents(Display *dpy, - unsigned first, - unsigned num, - XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - if ((num < 1) || (num > XkbMaxKeyCount)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstKeyExplicit = first; - req->nKeyExplicit = num; - if ((xkb != NULL) && (xkb->server != NULL) && - (xkb->server->explicit != NULL)) { - if ((num > 0) && (first >= xkb->min_key_code) && - (first + num <= xkb->max_key_code)) - bzero(&xkb->server->explicit[first], num); - } - if (xkb) - status = _XkbHandleGetMapReply(dpy, xkb); - else - status = BadMatch; - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetKeyModifierMap(Display *dpy, - unsigned first, - unsigned num, - XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - if ((num < 1) || (num > XkbMaxKeyCount)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstModMapKey = first; - req->nModMapKeys = num; - if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { - if ((num > 0) && (first >= xkb->min_key_code) && - (first + num <= xkb->max_key_code)) - bzero(&xkb->map->modmap[first], num); - } - if (xkb) - status = _XkbHandleGetMapReply(dpy, xkb); - else - status = BadMatch; - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetKeyVirtualModMap(Display *dpy, unsigned first, unsigned num, - XkbDescPtr xkb) -{ - register xkbGetMapReq *req; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - if ((num < 1) || (num > XkbMaxKeyCount)) - return BadValue; - - LockDisplay(dpy); - - req = _XkbGetGetMapReq(dpy, xkb); - req->firstVModMapKey = first; - req->nVModMapKeys = num; - if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { - if ((num > 0) && (first >= xkb->min_key_code) && - (first + num <= xkb->max_key_code)) - bzero(&xkb->server->vmodmap[first], num * sizeof(unsigned short)); - } - - if (xkb) - status = _XkbHandleGetMapReply(dpy, xkb); - else - status = BadMatch; - - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Status -XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) -{ - xkbGetMapReq *req; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - LockDisplay(dpy); - if (changes->changed) { - Status status = Success; - - req = _XkbGetGetMapReq(dpy, xkb); - req->full = 0; - req->partial = changes->changed; - req->firstType = changes->first_type; - req->nTypes = changes->num_types; - req->firstKeySym = changes->first_key_sym; - req->nKeySyms = changes->num_key_syms; - req->firstKeyAct = changes->first_key_act; - req->nKeyActs = changes->num_key_acts; - req->firstKeyBehavior = changes->first_key_behavior; - req->nKeyBehaviors = changes->num_key_behaviors; - req->virtualMods = changes->vmods; - req->firstKeyExplicit = changes->first_key_explicit; - req->nKeyExplicit = changes->num_key_explicit; - req->firstModMapKey = changes->first_modmap_key; - req->nModMapKeys = changes->num_modmap_keys; - req->firstVModMapKey = changes->first_vmodmap_key; - req->nVModMapKeys = changes->num_vmodmap_keys; - status = _XkbHandleGetMapReply(dpy, xkb); - UnlockDisplay(dpy); - SyncHandle(); - return status; - } - UnlockDisplay(dpy); - return Success; -} diff --git a/nx-X11/lib/X11/XKBList.c b/nx-X11/lib/X11/XKBList.c deleted file mode 100644 index d3d29e2a6..000000000 --- a/nx-X11/lib/X11/XKBList.c +++ /dev/null @@ -1,256 +0,0 @@ -/************************************************************ -Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#define NEED_MAP_READERS -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -/***====================================================================***/ - -static void -_FreeComponentNames(int num, XkbComponentNamePtr names) -{ - int i; - XkbComponentNamePtr tmp; - - if ((num < 1) || (names == NULL)) - return; - for (i = 0, tmp = names; i < num; i++, tmp++) { - if (tmp->name) { - _XkbFree(tmp->name); - tmp->name = NULL; - } - } - _XkbFree(names); - return; -} - -/***====================================================================***/ - -static XkbComponentNamePtr -_ReadListing(XkbReadBufferPtr buf, int count, Status * status_rtrn) -{ - XkbComponentNamePtr first, this; - register int i; - CARD16 *flags; - int slen, wlen; - char *str; - - if (count < 1) - return NULL; - first = _XkbTypedCalloc(count, XkbComponentNameRec); - if (!first) - return NULL; - for (this = first, i = 0; i < count; i++, this++) { - flags = (CARD16 *) _XkbGetReadBufferPtr(buf, 2 * sizeof(CARD16)); - if (!flags) - goto BAILOUT; - this->flags = flags[0]; - slen = flags[1]; - wlen = ((slen + 1) / 2) * 2; /* pad to 2 byte boundary */ - this->name = _XkbTypedCalloc(slen + 1, char); - - if (!this->name) - goto BAILOUT; - str = (char *) _XkbGetReadBufferPtr(buf, wlen); - if (!str) - goto BAILOUT; - memcpy(this->name, str, slen); - } - return first; - BAILOUT: - *status_rtrn = BadAlloc; - _FreeComponentNames(i, first); - return NULL; -} - -/***====================================================================***/ - -XkbComponentListPtr -XkbListComponents(Display *dpy, - unsigned deviceSpec, - XkbComponentNamesPtr ptrns, - int *max_inout) -{ - register xkbListComponentsReq *req; - xkbListComponentsReply rep; - XkbInfoPtr xkbi; - XkbComponentListPtr list; - XkbReadBufferRec buf; - int left; - char *str; - int extraLen, len, mapLen, codesLen, typesLen, compatLen, symsLen, geomLen; - - if ((dpy == NULL) || (dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || - (ptrns == NULL) || (max_inout == NULL)) - return NULL; - - xkbi = dpy->xkb_info; - LockDisplay(dpy); - GetReq(kbListComponents, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbListComponents; - req->deviceSpec = deviceSpec; - req->maxNames = *max_inout; - - mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; - if (ptrns->keymap) - mapLen = (int) strlen(ptrns->keymap); - if (ptrns->keycodes) - codesLen = (int) strlen(ptrns->keycodes); - if (ptrns->types) - typesLen = (int) strlen(ptrns->types); - if (ptrns->compat) - compatLen = (int) strlen(ptrns->compat); - if (ptrns->symbols) - symsLen = (int) strlen(ptrns->symbols); - if (ptrns->geometry) - geomLen = (int) strlen(ptrns->geometry); - if (mapLen > 255) - mapLen = 255; - if (codesLen > 255) - codesLen = 255; - if (typesLen > 255) - typesLen = 255; - if (compatLen > 255) - compatLen = 255; - if (symsLen > 255) - symsLen = 255; - if (geomLen > 255) - geomLen = 255; - - len = mapLen + codesLen + typesLen + compatLen + symsLen + geomLen + 6; - len = XkbPaddedSize(len); - req->length += len / 4; - BufAlloc(char *, str, len); - - *str++ = mapLen; - if (mapLen > 0) { - memcpy(str, ptrns->keymap, mapLen); - str += mapLen; - } - *str++ = codesLen; - if (codesLen > 0) { - memcpy(str, ptrns->keycodes, codesLen); - str += codesLen; - } - *str++ = typesLen; - if (typesLen > 0) { - memcpy(str, ptrns->types, typesLen); - str += typesLen; - } - *str++ = compatLen; - if (compatLen > 0) { - memcpy(str, ptrns->compat, compatLen); - str += compatLen; - } - *str++ = symsLen; - if (symsLen > 0) { - memcpy(str, ptrns->symbols, symsLen); - str += symsLen; - } - *str++ = geomLen; - if (geomLen > 0) { - memcpy(str, ptrns->geometry, geomLen); - str += geomLen; - } - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) - goto BAILOUT; - extraLen = (int) rep.length * 4; - *max_inout = rep.extra; - if (extraLen == 0) { /* no matches, but we don't want to report a failure */ - list = _XkbTypedCalloc(1, XkbComponentListRec); - UnlockDisplay(dpy); - SyncHandle(); - return list; - } - if (_XkbInitReadBuffer(dpy, &buf, extraLen)) { - Status status = Success; - - list = _XkbTypedCalloc(1, XkbComponentListRec); - if (!list) { - _XkbFreeReadBuffer(&buf); - goto BAILOUT; - } - list->num_keymaps = rep.nKeymaps; - list->num_keycodes = rep.nKeycodes; - list->num_types = rep.nTypes; - list->num_compat = rep.nCompatMaps; - list->num_symbols = rep.nSymbols; - list->num_geometry = rep.nGeometries; - if ((status == Success) && (list->num_keymaps > 0)) - list->keymaps = _ReadListing(&buf, list->num_keymaps, &status); - if ((status == Success) && (list->num_keycodes > 0)) - list->keycodes = _ReadListing(&buf, list->num_keycodes, &status); - if ((status == Success) && (list->num_types > 0)) - list->types = _ReadListing(&buf, list->num_types, &status); - if ((status == Success) && (list->num_compat > 0)) - list->compat = _ReadListing(&buf, list->num_compat, &status); - if ((status == Success) && (list->num_symbols > 0)) - list->symbols = _ReadListing(&buf, list->num_symbols, &status); - if ((status == Success) && (list->num_geometry > 0)) - list->geometry = _ReadListing(&buf, list->num_geometry, &status); - left = _XkbFreeReadBuffer(&buf); - if ((status != Success) || (buf.error) || (left > 2)) { - XkbFreeComponentList(list); - goto BAILOUT; - } - UnlockDisplay(dpy); - SyncHandle(); - return list; - } - BAILOUT: - UnlockDisplay(dpy); - SyncHandle(); - return NULL; -} - -void -XkbFreeComponentList(XkbComponentListPtr list) -{ - if (list) { - if (list->keymaps) - _FreeComponentNames(list->num_keymaps, list->keymaps); - if (list->keycodes) - _FreeComponentNames(list->num_keycodes, list->keycodes); - if (list->types) - _FreeComponentNames(list->num_types, list->types); - if (list->compat) - _FreeComponentNames(list->num_compat, list->compat); - if (list->symbols) - _FreeComponentNames(list->num_symbols, list->symbols); - if (list->geometry) - _FreeComponentNames(list->num_geometry, list->geometry); - bzero((char *) list, sizeof(XkbComponentListRec)); - _XkbFree(list); - } - return; -} diff --git a/nx-X11/lib/X11/XKBMAlloc.c b/nx-X11/lib/X11/XKBMAlloc.c deleted file mode 100644 index 2467a2024..000000000 --- a/nx-X11/lib/X11/XKBMAlloc.c +++ /dev/null @@ -1,1016 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include -#include "Xlibint.h" -#include -#include -#include "XKBlibint.h" - - -/***====================================================================***/ - -Status -XkbAllocClientMap(XkbDescPtr xkb, unsigned which, unsigned nTotalTypes) -{ - register int i; - XkbClientMapPtr map; - - if ((xkb == NULL) || - ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes))) - return BadValue; - if ((which & XkbKeySymsMask) && - ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code))) { -#ifdef DEBUG - fprintf(stderr, "bad keycode (%d,%d) in XkbAllocClientMap\n", - xkb->min_key_code, xkb->max_key_code); -#endif - return BadValue; - } - - if (xkb->map == NULL) { - map = _XkbTypedCalloc(1, XkbClientMapRec); - if (map == NULL) - return BadAlloc; - xkb->map = map; - } - else - map = xkb->map; - - if ((which & XkbKeyTypesMask) && (nTotalTypes > 0)) { - if (map->types == NULL) { - map->types = _XkbTypedCalloc(nTotalTypes, XkbKeyTypeRec); - if (map->types == NULL) - return BadAlloc; - map->num_types = 0; - map->size_types = nTotalTypes; - } - else if (map->size_types < nTotalTypes) { - XkbKeyTypeRec *prev_types = map->types; - - map->types = - _XkbTypedRealloc(map->types, nTotalTypes, XkbKeyTypeRec); - if (map->types == NULL) { - _XkbFree(prev_types); - map->num_types = map->size_types = 0; - return BadAlloc; - } - map->size_types = nTotalTypes; - bzero(&map->types[map->num_types], - ((map->size_types - map->num_types) * sizeof(XkbKeyTypeRec))); - } - } - if (which & XkbKeySymsMask) { - int nKeys = XkbNumKeys(xkb); - - if (map->syms == NULL) { - map->size_syms = (nKeys * 15) / 10; - map->syms = _XkbTypedCalloc(map->size_syms, KeySym); - if (!map->syms) { - map->size_syms = 0; - return BadAlloc; - } - map->num_syms = 1; - map->syms[0] = NoSymbol; - } - if (map->key_sym_map == NULL) { - i = xkb->max_key_code + 1; - map->key_sym_map = _XkbTypedCalloc(i, XkbSymMapRec); - if (map->key_sym_map == NULL) - return BadAlloc; - } - } - if (which & XkbModifierMapMask) { - if ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code)) - return BadMatch; - if (map->modmap == NULL) { - i = xkb->max_key_code + 1; - map->modmap = _XkbTypedCalloc(i, unsigned char); - if (map->modmap == NULL) - return BadAlloc; - } - } - return Success; -} - -Status -XkbAllocServerMap(XkbDescPtr xkb, unsigned which, unsigned nNewActions) -{ - register int i; - XkbServerMapPtr map; - - if (xkb == NULL) - return BadMatch; - if (xkb->server == NULL) { - map = _XkbTypedCalloc(1, XkbServerMapRec); - if (map == NULL) - return BadAlloc; - for (i = 0; i < XkbNumVirtualMods; i++) { - map->vmods[i] = XkbNoModifierMask; - } - xkb->server = map; - } - else - map = xkb->server; - if (which & XkbExplicitComponentsMask) { - if ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code)) - return BadMatch; - if (map->explicit == NULL) { - i = xkb->max_key_code + 1; - map->explicit = _XkbTypedCalloc(i, unsigned char); - if (map->explicit == NULL) - return BadAlloc; - } - } - if (which & XkbKeyActionsMask) { - if ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code)) - return BadMatch; - if (nNewActions < 1) - nNewActions = 1; - if (map->acts == NULL) { - map->acts = _XkbTypedCalloc((nNewActions + 1), XkbAction); - if (map->acts == NULL) - return BadAlloc; - map->num_acts = 1; - map->size_acts = nNewActions + 1; - } - else if ((map->size_acts - map->num_acts) < nNewActions) { - unsigned need; - XkbAction *prev_acts = map->acts; - - need = map->num_acts + nNewActions; - map->acts = _XkbTypedRealloc(map->acts, need, XkbAction); - if (map->acts == NULL) { - _XkbFree(prev_acts); - map->num_acts = map->size_acts = 0; - return BadAlloc; - } - map->size_acts = need; - bzero(&map->acts[map->num_acts], - ((map->size_acts - map->num_acts) * sizeof(XkbAction))); - } - if (map->key_acts == NULL) { - i = xkb->max_key_code + 1; - map->key_acts = _XkbTypedCalloc(i, unsigned short); - if (map->key_acts == NULL) - return BadAlloc; - } - } - if (which & XkbKeyBehaviorsMask) { - if ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code)) - return BadMatch; - if (map->behaviors == NULL) { - i = xkb->max_key_code + 1; - map->behaviors = _XkbTypedCalloc(i, XkbBehavior); - if (map->behaviors == NULL) - return BadAlloc; - } - } - if (which & XkbVirtualModMapMask) { - if ((!XkbIsLegalKeycode(xkb->min_key_code)) || - (!XkbIsLegalKeycode(xkb->max_key_code)) || - (xkb->max_key_code < xkb->min_key_code)) - return BadMatch; - if (map->vmodmap == NULL) { - i = xkb->max_key_code + 1; - map->vmodmap = _XkbTypedCalloc(i, unsigned short); - if (map->vmodmap == NULL) - return BadAlloc; - } - } - return Success; -} - -/***====================================================================***/ - -Status -XkbCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into) -{ - if ((!from) || (!into)) - return BadMatch; - - _XkbFree(into->map); - into->map = NULL; - - _XkbFree(into->preserve); - into->preserve = NULL; - - _XkbFree(into->level_names); - into->level_names = NULL; - - *into = *from; - if ((from->map) && (into->map_count > 0)) { - into->map = _XkbTypedCalloc(into->map_count, XkbKTMapEntryRec); - if (!into->map) - return BadAlloc; - memcpy(into->map, from->map, - into->map_count * sizeof(XkbKTMapEntryRec)); - } - if ((from->preserve) && (into->map_count > 0)) { - into->preserve = _XkbTypedCalloc(into->map_count, XkbModsRec); - if (!into->preserve) - return BadAlloc; - memcpy(into->preserve, from->preserve, - into->map_count * sizeof(XkbModsRec)); - } - if ((from->level_names) && (into->num_levels > 0)) { - into->level_names = _XkbTypedCalloc(into->num_levels, Atom); - if (!into->level_names) - return BadAlloc; - memcpy(into->level_names, from->level_names, - into->num_levels * sizeof(Atom)); - } - return Success; -} - -Status -XkbCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types) -{ - register int i, rtrn; - - if ((!from) || (!into) || (num_types < 0)) - return BadMatch; - for (i = 0; i < num_types; i++) { - if ((rtrn = XkbCopyKeyType(from++, into++)) != Success) - return rtrn; - } - return Success; -} - -XkbKeyTypePtr -XkbAddKeyType(XkbDescPtr xkb, - Atom name, - int map_count, - Bool want_preserve, - int num_lvls) -{ - register int i; - unsigned tmp; - XkbKeyTypePtr type; - XkbClientMapPtr map; - - if ((!xkb) || (num_lvls < 1)) - return NULL; - map = xkb->map; - if ((map) && (map->types)) { - for (i = 0; i < map->num_types; i++) { - if (map->types[i].name == name) { - Status status = - XkbResizeKeyType(xkb, i, map_count, want_preserve, - num_lvls); - return (status == Success ? &map->types[i] : NULL); - } - } - } - if ((!map) || (!map->types) || (map->num_types < XkbNumRequiredTypes)) { - tmp = XkbNumRequiredTypes + 1; - if (XkbAllocClientMap(xkb, XkbKeyTypesMask, tmp) != Success) - return NULL; - if (!map) - map = xkb->map; - tmp = 0; - if (map->num_types <= XkbKeypadIndex) - tmp |= XkbKeypadMask; - if (map->num_types <= XkbAlphabeticIndex) - tmp |= XkbAlphabeticMask; - if (map->num_types <= XkbTwoLevelIndex) - tmp |= XkbTwoLevelMask; - if (map->num_types <= XkbOneLevelIndex) - tmp |= XkbOneLevelMask; - if (XkbInitCanonicalKeyTypes(xkb, tmp, XkbNoModifier) == Success) { - for (i = 0; i < map->num_types; i++) { - Status status; - - if (map->types[i].name != name) - continue; - status = XkbResizeKeyType(xkb, i, map_count, want_preserve, - num_lvls); - return (status == Success ? &map->types[i] : NULL); - } - } - } - if ((map->num_types <= map->size_types) && - (XkbAllocClientMap(xkb, XkbKeyTypesMask, map->num_types + 1) != - Success)) { - return NULL; - } - type = &map->types[map->num_types]; - map->num_types++; - bzero((char *) type, sizeof(XkbKeyTypeRec)); - type->num_levels = num_lvls; - type->map_count = map_count; - type->name = name; - if (map_count > 0) { - type->map = _XkbTypedCalloc(map_count, XkbKTMapEntryRec); - if (!type->map) { - map->num_types--; - return NULL; - } - if (want_preserve) { - type->preserve = _XkbTypedCalloc(map_count, XkbModsRec); - if (!type->preserve) { - _XkbFree(type->map); - map->num_types--; - return NULL; - } - } - } - return type; -} - -Status -XkbResizeKeyType(XkbDescPtr xkb, - int type_ndx, - int map_count, - Bool want_preserve, - int new_num_lvls) -{ - XkbKeyTypePtr type; - KeyCode matchingKeys[XkbMaxKeyCount], nMatchingKeys; - - if ((type_ndx < 0) || (type_ndx >= xkb->map->num_types) || (map_count < 0) - || (new_num_lvls < 1)) - return BadValue; - switch (type_ndx) { - case XkbOneLevelIndex: - if (new_num_lvls != 1) - return BadMatch; - break; - case XkbTwoLevelIndex: - case XkbAlphabeticIndex: - case XkbKeypadIndex: - if (new_num_lvls != 2) - return BadMatch; - break; - } - type = &xkb->map->types[type_ndx]; - if (map_count == 0) { - _XkbFree(type->map); - type->map = NULL; - _XkbFree(type->preserve); - type->preserve = NULL; - type->map_count = 0; - } - else { - XkbKTMapEntryRec *prev_map = type->map; - - if ((map_count > type->map_count) || (type->map == NULL)) - type->map = - _XkbTypedRealloc(type->map, map_count, XkbKTMapEntryRec); - if (!type->map) { - _XkbFree(prev_map); - return BadAlloc; - } - if (want_preserve) { - XkbModsRec *prev_preserve = type->preserve; - - if ((map_count > type->map_count) || (type->preserve == NULL)) { - type->preserve = _XkbTypedRealloc(type->preserve, map_count, - XkbModsRec); - } - if (!type->preserve) { - _XkbFree(prev_preserve); - return BadAlloc; - } - } - else { - _XkbFree(type->preserve); - type->preserve = NULL; - } - type->map_count = map_count; - } - - if ((new_num_lvls > type->num_levels) || (type->level_names == NULL)) { - Atom *prev_level_names = type->level_names; - - type->level_names = - _XkbTypedRealloc(type->level_names, new_num_lvls, Atom); - if (!type->level_names) { - _XkbFree(prev_level_names); - return BadAlloc; - } - } - /* - * Here's the theory: - * If the width of the type changed, we might have to resize the symbol - * maps for any keys that use the type for one or more groups. This is - * expensive, so we'll try to cull out any keys that are obviously okay: - * In any case: - * - keys that have a group width <= the old width are okay (because - * they could not possibly have been associated with the old type) - * If the key type increased in size: - * - keys that already have a group width >= to the new width are okay - * + keys that have a group width >= the old width but < the new width - * might have to be enlarged. - * If the key type decreased in size: - * - keys that have a group width > the old width don't have to be - * resized (because they must have some other wider type associated - * with some group). - * + keys that have a group width == the old width might have to be - * shrunk. - * The possibilities marked with '+' require us to examine the key types - * associated with each group for the key. - */ - bzero(matchingKeys, XkbMaxKeyCount * sizeof(KeyCode)); - nMatchingKeys = 0; - if (new_num_lvls > type->num_levels) { - int nTotal; - KeySym *newSyms; - int width, match, nResize; - register int i, g, nSyms; - - nResize = 0; - for (nTotal = 1, i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - width = XkbKeyGroupsWidth(xkb, i); - if (width < type->num_levels) - continue; - for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1; - (g >= 0) && (!match); g--) { - if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) { - matchingKeys[nMatchingKeys++] = i; - match = 1; - } - } - if ((!match) || (width >= new_num_lvls)) - nTotal += XkbKeyNumSyms(xkb, i); - else { - nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls; - nResize++; - } - } - if (nResize > 0) { - int nextMatch; - - xkb->map->size_syms = (nTotal * 12) / 10; - newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); - if (newSyms == NULL) - return BadAlloc; - nextMatch = 0; - nSyms = 1; - for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - if (matchingKeys[nextMatch] == i) { - KeySym *pOld; - - nextMatch++; - width = XkbKeyGroupsWidth(xkb, i); - pOld = XkbKeySymsPtr(xkb, i); - for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--) { - memcpy(&newSyms[nSyms + (new_num_lvls * g)], - &pOld[width * g], width * sizeof(KeySym)); - } - xkb->map->key_sym_map[i].offset = nSyms; - nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls; - } - else { - memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), - XkbKeyNumSyms(xkb, i) * sizeof(KeySym)); - xkb->map->key_sym_map[i].offset = nSyms; - nSyms += XkbKeyNumSyms(xkb, i); - } - } - type->num_levels = new_num_lvls; - _XkbFree(xkb->map->syms); - xkb->map->syms = newSyms; - xkb->map->num_syms = nSyms; - return Success; - } - } - else if (new_num_lvls < type->num_levels) { - int width, match; - register int g, i; - - for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - width = XkbKeyGroupsWidth(xkb, i); - if (width < type->num_levels) - continue; - for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1; - (g >= 0) && (!match); g--) { - if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) { - matchingKeys[nMatchingKeys++] = i; - match = 1; - } - } - } - } - if (nMatchingKeys > 0) { - int key, firstClear; - register int i, g; - - if (new_num_lvls > type->num_levels) - firstClear = type->num_levels; - else - firstClear = new_num_lvls; - for (i = 0; i < nMatchingKeys; i++) { - KeySym *pSyms; - int width, nClear; - - key = matchingKeys[i]; - width = XkbKeyGroupsWidth(xkb, key); - nClear = width - firstClear; - pSyms = XkbKeySymsPtr(xkb, key); - for (g = XkbKeyNumGroups(xkb, key) - 1; g >= 0; g--) { - if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) { - if (nClear > 0) - bzero(&pSyms[g * width + firstClear], - nClear * sizeof(KeySym)); - } - } - } - } - type->num_levels = new_num_lvls; - return Success; -} - -KeySym * -XkbResizeKeySyms(XkbDescPtr xkb, int key, int needed) -{ - register int i, nSyms, nKeySyms; - unsigned nOldSyms; - KeySym *newSyms; - - if (needed == 0) { - xkb->map->key_sym_map[key].offset = 0; - return xkb->map->syms; - } - nOldSyms = XkbKeyNumSyms(xkb, key); - if (nOldSyms >= (unsigned) needed) { - return XkbKeySymsPtr(xkb, key); - } - if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned) needed) { - if (nOldSyms > 0) { - memcpy(&xkb->map->syms[xkb->map->num_syms], XkbKeySymsPtr(xkb, key), - nOldSyms * sizeof(KeySym)); - } - if ((needed - nOldSyms) > 0) { - bzero(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], - (needed - nOldSyms) * sizeof(KeySym)); - } - xkb->map->key_sym_map[key].offset = xkb->map->num_syms; - xkb->map->num_syms += needed; - return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; - } - xkb->map->size_syms += (needed > 32 ? needed : 32); - newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); - if (newSyms == NULL) - return NULL; - newSyms[0] = NoSymbol; - nSyms = 1; - for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { - int nCopy; - - nCopy = nKeySyms = XkbKeyNumSyms(xkb, i); - if ((nKeySyms == 0) && (i != key)) - continue; - if (i == key) - nKeySyms = needed; - if (nCopy != 0) - memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), - nCopy * sizeof(KeySym)); - if (nKeySyms > nCopy) - bzero(&newSyms[nSyms + nCopy], (nKeySyms - nCopy) * sizeof(KeySym)); - xkb->map->key_sym_map[i].offset = nSyms; - nSyms += nKeySyms; - } - _XkbFree(xkb->map->syms); - xkb->map->syms = newSyms; - xkb->map->num_syms = nSyms; - return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; -} - -static unsigned -_ExtendRange(unsigned int old_flags, - unsigned int flag, - KeyCode newKC, - KeyCode *old_min, - unsigned char *old_num) -{ - if ((old_flags & flag) == 0) { - old_flags |= flag; - *old_min = newKC; - *old_num = 1; - } - else { - int last = (*old_min) + (*old_num) - 1; - - if (newKC < *old_min) { - *old_min = newKC; - *old_num = (last - newKC) + 1; - } - else if (newKC > last) { - *old_num = (newKC - (*old_min)) + 1; - } - } - return old_flags; -} - -Status -XkbChangeKeycodeRange(XkbDescPtr xkb, - int minKC, - int maxKC, - XkbChangesPtr changes) -{ - int tmp; - - if ((!xkb) || (minKC < XkbMinLegalKeyCode) || (maxKC > XkbMaxLegalKeyCode)) - return BadValue; - if (minKC > maxKC) - return BadMatch; - if (minKC < xkb->min_key_code) { - if (changes) - changes->map.min_key_code = minKC; - tmp = xkb->min_key_code - minKC; - if (xkb->map) { - if (xkb->map->key_sym_map) { - bzero((char *) &xkb->map->key_sym_map[minKC], - tmp * sizeof(XkbSymMapRec)); - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbKeySymsMask, minKC, - &changes->map.first_key_sym, - &changes->map.num_key_syms); - } - } - if (xkb->map->modmap) { - bzero((char *) &xkb->map->modmap[minKC], tmp); - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbModifierMapMask, minKC, - &changes->map.first_modmap_key, - &changes->map.num_modmap_keys); - } - } - } - if (xkb->server) { - if (xkb->server->behaviors) { - bzero((char *) &xkb->server->behaviors[minKC], - tmp * sizeof(XkbBehavior)); - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbKeyBehaviorsMask, minKC, - &changes->map.first_key_behavior, - &changes->map.num_key_behaviors); - } - } - if (xkb->server->key_acts) { - bzero((char *) &xkb->server->key_acts[minKC], - tmp * sizeof(unsigned short)); - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbKeyActionsMask, minKC, - &changes->map.first_key_act, - &changes->map.num_key_acts); - } - } - if (xkb->server->vmodmap) { - bzero((char *) &xkb->server->vmodmap[minKC], - tmp * sizeof(unsigned short)); - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbVirtualModMapMask, minKC, - &changes->map.first_modmap_key, - &changes->map.num_vmodmap_keys); - } - } - } - if ((xkb->names) && (xkb->names->keys)) { - bzero((char *) &xkb->names->keys[minKC], - tmp * sizeof(XkbKeyNameRec)); - if (changes) { - changes->names.changed = _ExtendRange(changes->names.changed, - XkbKeyNamesMask, minKC, - &changes->names.first_key, - &changes->names.num_keys); - } - } - xkb->min_key_code = minKC; - } - if (maxKC > xkb->max_key_code) { - if (changes) - changes->map.max_key_code = maxKC; - tmp = maxKC - xkb->max_key_code; - if (xkb->map) { - if (xkb->map->key_sym_map) { - XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; - - xkb->map->key_sym_map = _XkbTypedRealloc(xkb->map->key_sym_map, - (maxKC + 1), XkbSymMapRec); - if (!xkb->map->key_sym_map) { - _XkbFree(prev_key_sym_map); - return BadAlloc; - } -#ifdef NXAGENT_SERVER - bzero((char *) &xkb->map->key_sym_map[xkb->max_key_code + 1], - tmp * sizeof(XkbSymMapRec)); -#else - bzero((char *) &xkb->map->key_sym_map[xkb->max_key_code], - tmp * sizeof(XkbSymMapRec)); -#endif - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbKeySymsMask, maxKC, - &changes->map.first_key_sym, - &changes->map.num_key_syms); - } - } - if (xkb->map->modmap) { - unsigned char *prev_modmap = xkb->map->modmap; - - xkb->map->modmap = _XkbTypedRealloc(xkb->map->modmap, - (maxKC + 1), unsigned char); - if (!xkb->map->modmap) { - _XkbFree(prev_modmap); - return BadAlloc; - } -#ifdef NXAGENT_SERVER - bzero((char *) &xkb->map->modmap[xkb->max_key_code + 1], tmp); -#else - bzero((char *) &xkb->map->modmap[xkb->max_key_code], tmp); -#endif - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbModifierMapMask, maxKC, - &changes->map.first_modmap_key, - &changes->map.num_modmap_keys); - } - } - } - if (xkb->server) { - if (xkb->server->behaviors) { - XkbBehavior *prev_behaviors = xkb->server->behaviors; - - xkb->server->behaviors = - _XkbTypedRealloc(xkb->server->behaviors, (maxKC + 1), - XkbBehavior); - if (!xkb->server->behaviors) { - _XkbFree(prev_behaviors); - return BadAlloc; - } -#ifdef NXAGENT_SERVER - bzero((char *) &xkb->server->behaviors[xkb->max_key_code + 1], - tmp * sizeof(XkbBehavior)); -#else - bzero((char *) &xkb->server->behaviors[xkb->max_key_code], - tmp * sizeof(XkbBehavior)); -#endif - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbKeyBehaviorsMask, maxKC, - &changes->map.first_key_behavior, - &changes->map.num_key_behaviors); - } - } - if (xkb->server->key_acts) { - unsigned short *prev_key_acts = xkb->server->key_acts; - - xkb->server->key_acts = _XkbTypedRealloc(xkb->server->key_acts, - (maxKC + 1), unsigned short); - if (!xkb->server->key_acts) { - _XkbFree(prev_key_acts); - return BadAlloc; - } -#ifdef NXAGENT_SERVER - bzero((char *) &xkb->server->key_acts[xkb->max_key_code + 1], - tmp * sizeof(unsigned short)); -#else - bzero((char *) &xkb->server->key_acts[xkb->max_key_code], - tmp * sizeof(unsigned short)); -#endif - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbKeyActionsMask, maxKC, - &changes->map.first_key_act, - &changes->map.num_key_acts); - } - } - if (xkb->server->vmodmap) { - unsigned short *prev_vmodmap = xkb->server->vmodmap; - - xkb->server->vmodmap = _XkbTypedRealloc(xkb->server->vmodmap, - (maxKC + 1), unsigned short); - if (!xkb->server->vmodmap) { - _XkbFree(prev_vmodmap); - return BadAlloc; - } -#ifdef NXAGENT_SERVER - bzero((char *) &xkb->server->vmodmap[xkb->max_key_code + 1], - tmp * sizeof(unsigned short)); -#else - bzero((char *) &xkb->server->vmodmap[xkb->max_key_code], - tmp * sizeof(unsigned short)); -#endif - if (changes) { - changes->map.changed = _ExtendRange(changes->map.changed, - XkbVirtualModMapMask, maxKC, - &changes->map.first_modmap_key, - &changes->map.num_vmodmap_keys); - } - } - } - if ((xkb->names) && (xkb->names->keys)) { - XkbKeyNameRec *prev_keys = xkb->names->keys; - - xkb->names->keys = _XkbTypedRealloc(xkb->names->keys, - (maxKC + 1), XkbKeyNameRec); - if (!xkb->names->keys) { - _XkbFree(prev_keys); - return BadAlloc; - } -#ifdef NXAGENT_SERVER - bzero((char *) &xkb->names->keys[xkb->max_key_code + 1], - tmp * sizeof(XkbKeyNameRec)); -#else - bzero((char *) &xkb->names->keys[xkb->max_key_code], - tmp * sizeof(XkbKeyNameRec)); -#endif - if (changes) { - changes->names.changed = _ExtendRange(changes->names.changed, - XkbKeyNamesMask, maxKC, - &changes->names.first_key, - &changes->names.num_keys); - } - } - xkb->max_key_code = maxKC; - } - return Success; -} - -XkbAction * -XkbResizeKeyActions(XkbDescPtr xkb, int key, int needed) -{ - register int i, nActs; - XkbAction *newActs; - - if (needed == 0) { - xkb->server->key_acts[key] = 0; - return NULL; - } - if (XkbKeyHasActions(xkb, key) && - (XkbKeyNumSyms(xkb, key) >= (unsigned) needed)) - return XkbKeyActionsPtr(xkb, key); - if (xkb->server->size_acts - xkb->server->num_acts >= (unsigned) needed) { - xkb->server->key_acts[key] = xkb->server->num_acts; - xkb->server->num_acts += needed; - return &xkb->server->acts[xkb->server->key_acts[key]]; - } - xkb->server->size_acts = xkb->server->num_acts + needed + 8; - newActs = _XkbTypedCalloc(xkb->server->size_acts, XkbAction); - if (newActs == NULL) - return NULL; - newActs[0].type = XkbSA_NoAction; - nActs = 1; - for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { - int nKeyActs, nCopy; - - if ((xkb->server->key_acts[i] == 0) && (i != key)) - continue; - - nCopy = nKeyActs = XkbKeyNumActions(xkb, i); - if (i == key) { - nKeyActs = needed; - if (needed < nCopy) - nCopy = needed; - } - - if (nCopy > 0) - memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i), - nCopy * sizeof(XkbAction)); - if (nCopy < nKeyActs) - bzero(&newActs[nActs + nCopy], - (nKeyActs - nCopy) * sizeof(XkbAction)); - xkb->server->key_acts[i] = nActs; - nActs += nKeyActs; - } - _XkbFree(xkb->server->acts); - xkb->server->acts = newActs; - xkb->server->num_acts = nActs; - return &xkb->server->acts[xkb->server->key_acts[key]]; -} - -void -XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap) -{ - XkbClientMapPtr map; - - if ((xkb == NULL) || (xkb->map == NULL)) - return; - if (freeMap) - what = XkbAllClientInfoMask; - map = xkb->map; - if (what & XkbKeyTypesMask) { - if (map->types != NULL) { - if (map->num_types > 0) { - register int i; - XkbKeyTypePtr type; - - for (i = 0, type = map->types; i < map->num_types; i++, type++) { - _XkbFree(type->map); - type->map = NULL; - - _XkbFree(type->preserve); - type->preserve = NULL; - - type->map_count = 0; - - _XkbFree(type->level_names); - type->level_names = NULL; - } - } - _XkbFree(map->types); - map->num_types = map->size_types = 0; - map->types = NULL; - } - } - if (what & XkbKeySymsMask) { - _XkbFree(map->key_sym_map); - map->key_sym_map = NULL; - - _XkbFree(map->syms); - map->size_syms = map->num_syms = 0; - map->syms = NULL; - } - if (what & XkbModifierMapMask) { - _XkbFree(map->modmap); - map->modmap = NULL; - } - if (freeMap) { - _XkbFree(xkb->map); - xkb->map = NULL; - } - return; -} - -void -XkbFreeServerMap(XkbDescPtr xkb, unsigned what, Bool freeMap) -{ - XkbServerMapPtr map; - - if ((xkb == NULL) || (xkb->server == NULL)) - return; - if (freeMap) - what = XkbAllServerInfoMask; - map = xkb->server; - if (what & XkbExplicitComponentsMask) { - _XkbFree(map->explicit); - map->explicit = NULL; - } - if (what & XkbKeyActionsMask) { - _XkbFree(map->key_acts); - map->key_acts = NULL; - - _XkbFree(map->acts); - map->num_acts = map->size_acts = 0; - map->acts = NULL; - } - if (what & XkbKeyBehaviorsMask) { - _XkbFree(map->behaviors); - map->behaviors = NULL; - } - if (what & XkbVirtualModMapMask) { - _XkbFree(map->vmodmap); - map->vmodmap = NULL; - } - - if (freeMap) { - _XkbFree(xkb->server); - xkb->server = NULL; - } - return; -} diff --git a/nx-X11/lib/X11/XKBMisc.c b/nx-X11/lib/X11/XKBMisc.c deleted file mode 100644 index ab48b6124..000000000 --- a/nx-X11/lib/X11/XKBMisc.c +++ /dev/null @@ -1,1021 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif - - -#include -#include "Xlibint.h" -#include -#include -#include "XKBlibint.h" - - -/***====================================================================***/ - -#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) -static XkbKTMapEntryRec map2Level[] = { - { True, ShiftMask, {1, ShiftMask, 0} } -}; - -static XkbKTMapEntryRec mapAlpha[] = { - { True, ShiftMask, {1, ShiftMask, 0} }, - { True, LockMask, {0, LockMask, 0} } -}; - -static XkbModsRec preAlpha[] = { - { 0, 0, 0 }, - { LockMask, LockMask, 0 } -}; - -#define NL_VMOD_MASK 0 -static XkbKTMapEntryRec mapKeypad[] = { - { True, ShiftMask, { 1, ShiftMask, 0 } }, - { False, 0, { 1, 0, NL_VMOD_MASK } } -}; - -static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { - { { 0, 0, 0 }, - 1, /* num_levels */ - 0, /* map_count */ - NULL, NULL, - None, NULL - }, - { { ShiftMask, ShiftMask, 0 }, - 2, /* num_levels */ - mapSize(map2Level), /* map_count */ - map2Level, NULL, - None, NULL - }, - { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, - 2, /* num_levels */ - mapSize(mapAlpha), /* map_count */ - mapAlpha, preAlpha, - None, NULL - }, - { { ShiftMask, ShiftMask, NL_VMOD_MASK }, - 2, /* num_levels */ - mapSize(mapKeypad), /* map_count */ - mapKeypad, NULL, - None, NULL - } -}; - -Status -XkbInitCanonicalKeyTypes(XkbDescPtr xkb, unsigned which, int keypadVMod) -{ - XkbClientMapPtr map; - XkbKeyTypePtr from, to; - Status rtrn; - - if (!xkb) - return BadMatch; - rtrn = XkbAllocClientMap(xkb, XkbKeyTypesMask, XkbNumRequiredTypes); - if (rtrn != Success) - return rtrn; - map = xkb->map; - if ((which & XkbAllRequiredTypes) == 0) - return Success; - rtrn = Success; - from = canonicalTypes; - to = map->types; - if (which & XkbOneLevelMask) - rtrn = XkbCopyKeyType(&from[XkbOneLevelIndex], &to[XkbOneLevelIndex]); - if ((which & XkbTwoLevelMask) && (rtrn == Success)) - rtrn = XkbCopyKeyType(&from[XkbTwoLevelIndex], &to[XkbTwoLevelIndex]); - if ((which & XkbAlphabeticMask) && (rtrn == Success)) - rtrn = - XkbCopyKeyType(&from[XkbAlphabeticIndex], &to[XkbAlphabeticIndex]); - if ((which & XkbKeypadMask) && (rtrn == Success)) { - XkbKeyTypePtr type; - - rtrn = XkbCopyKeyType(&from[XkbKeypadIndex], &to[XkbKeypadIndex]); - type = &to[XkbKeypadIndex]; - if ((keypadVMod >= 0) && (keypadVMod < XkbNumVirtualMods) && - (rtrn == Success)) { - type->mods.vmods = (1 << keypadVMod); - type->map[0].active = True; - type->map[0].mods.mask = ShiftMask; - type->map[0].mods.real_mods = ShiftMask; - type->map[0].mods.vmods = 0; - type->map[0].level = 1; - type->map[1].active = False; - type->map[1].mods.mask = 0; - type->map[1].mods.real_mods = 0; - type->map[1].mods.vmods = (1 << keypadVMod); - type->map[1].level = 1; - } - } - return Success; -} - -/***====================================================================***/ - -#define CORE_SYM(i) (imap->num_types)) { - nSyms[i] = xkb->map->types[types_inout[i]].num_levels; - if (nSyms[i] > groupsWidth) - groupsWidth = nSyms[i]; - } - else { - types_inout[i] = XkbTwoLevelIndex; /* don't really know, yet */ - nSyms[i] = 2; - } - } - if (nSyms[XkbGroup1Index] < 2) - nSyms[XkbGroup1Index] = 2; - if (nSyms[XkbGroup2Index] < 2) - nSyms[XkbGroup2Index] = 2; - /* Step 2: Copy the symbols from the core ordering to XKB ordering */ - /* symbols in the core are in the order: */ - /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */ - xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 0)] = CORE_SYM(0); - xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 1)] = CORE_SYM(1); - for (i = 2; i < nSyms[XkbGroup1Index]; i++) { - xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, i)] = CORE_SYM(2 + i); - } - xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 0)] = CORE_SYM(2); - xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 1)] = CORE_SYM(3); - tmp = 2 + (nSyms[XkbGroup1Index] - 2); /* offset to extra group2 syms */ - for (i = 2; i < nSyms[XkbGroup2Index]; i++) { - xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, i)] = CORE_SYM(tmp + i); - } - tmp = nSyms[XkbGroup1Index] + nSyms[XkbGroup2Index]; - if ((tmp >= map_width) && - ((protected & (XkbExplicitKeyType3Mask | XkbExplicitKeyType4Mask)) == - 0)) { - nSyms[XkbGroup3Index] = 0; - nSyms[XkbGroup4Index] = 0; - nGroups = 2; - } - else { - nGroups = 3; - for (i = 0; i < nSyms[XkbGroup3Index]; i++, tmp++) { - xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index, i)] = CORE_SYM(tmp); - } - if ((tmp < map_width) || (protected & XkbExplicitKeyType4Mask)) { - nGroups = 4; - for (i = 0; i < nSyms[XkbGroup4Index]; i++, tmp++) { - xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index, i)] = CORE_SYM(tmp); - } - } - else { - nSyms[XkbGroup4Index] = 0; - } - } - /* steps 3&4: alphanumeric expansion, assign canonical types */ - empty = 0; - for (i = 0; i < nGroups; i++) { - KeySym *syms; - - syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)]; - if ((nSyms[i] > 1) && (syms[1] == NoSymbol) && (syms[0] != NoSymbol)) { - KeySym upper, lower; - - XConvertCase(syms[0], &lower, &upper); - if (upper != lower) { - xkb_syms_rtrn[XKB_OFFSET(i, 0)] = lower; - xkb_syms_rtrn[XKB_OFFSET(i, 1)] = upper; - if ((protected & (1 << i)) == 0) - types_inout[i] = XkbAlphabeticIndex; - } - else if ((protected & (1 << i)) == 0) { - types_inout[i] = XkbOneLevelIndex; - /* nSyms[i]= 1; */ - } - } - if (((protected & (1 << i)) == 0) && - (types_inout[i] == XkbTwoLevelIndex)) { - if (IsKeypadKey(syms[0]) || IsKeypadKey(syms[1])) - types_inout[i] = XkbKeypadIndex; - else { - KeySym upper, lower; - - XConvertCase(syms[0], &lower, &upper); - if ((syms[0] == lower) && (syms[1] == upper)) - types_inout[i] = XkbAlphabeticIndex; - } - } - if (syms[0] == NoSymbol) { - register int n; - Bool found; - - for (n = 1, found = False; (!found) && (n < nSyms[i]); n++) { - found = (syms[n] != NoSymbol); - } - if (!found) - empty |= (1 << i); - } - } - /* step 5: squoosh out empty groups */ - if (empty) { - for (i = nGroups - 1; i >= 0; i--) { - if (((empty & (1 << i)) == 0) || (protected & (1 << i))) - break; - nGroups--; - } - } - if (nGroups < 1) - return 0; - - /* step 6: replicate group 1 into group two, if necessary */ - if ((nGroups > 1) && - ((empty & (XkbGroup1Mask | XkbGroup2Mask)) == XkbGroup2Mask)) { - if ((protected & (XkbExplicitKeyType1Mask | XkbExplicitKeyType2Mask)) == - 0) { - nSyms[XkbGroup2Index] = nSyms[XkbGroup1Index]; - types_inout[XkbGroup2Index] = types_inout[XkbGroup1Index]; - memcpy((char *) &xkb_syms_rtrn[2], (char *) xkb_syms_rtrn, - 2 * sizeof(KeySym)); - } - else if (types_inout[XkbGroup1Index] == types_inout[XkbGroup2Index]) { - memcpy((char *) &xkb_syms_rtrn[nSyms[XkbGroup1Index]], - (char *) xkb_syms_rtrn, - nSyms[XkbGroup1Index] * sizeof(KeySym)); - } - } - - /* step 7: check for all groups identical or all width 1 */ - if (nGroups > 1) { - Bool sameType, allOneLevel; - - allOneLevel = (xkb->map->types[types_inout[0]].num_levels == 1); - for (i = 1, sameType = True; (allOneLevel || sameType) && (i < nGroups); - i++) { - sameType = (sameType && - (types_inout[i] == types_inout[XkbGroup1Index])); - if (allOneLevel) - allOneLevel = (xkb->map->types[types_inout[i]].num_levels == 1); - } - if ((sameType) && - (!(protected & - (XkbExplicitKeyTypesMask & ~XkbExplicitKeyType1Mask)))) { - register int s; - Bool identical; - - for (i = 1, identical = True; identical && (i < nGroups); i++) { - KeySym *syms; - - syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)]; - for (s = 0; identical && (s < nSyms[i]); s++) { - if (syms[s] != xkb_syms_rtrn[s]) - identical = False; - } - } - if (identical) - nGroups = 1; - } - if (allOneLevel && (nGroups > 1)) { - KeySym *syms; - - syms = &xkb_syms_rtrn[nSyms[XkbGroup1Index]]; - nSyms[XkbGroup1Index] = 1; - for (i = 1; i < nGroups; i++) { - xkb_syms_rtrn[i] = syms[0]; - syms += nSyms[i]; - nSyms[i] = 1; - } - } - } - return nGroups; -} - -static XkbSymInterpretPtr -_XkbFindMatchingInterp(XkbDescPtr xkb, - KeySym sym, - unsigned int real_mods, - unsigned int level) -{ - register unsigned i; - XkbSymInterpretPtr interp, rtrn; - CARD8 mods; - - rtrn = NULL; - interp = xkb->compat->sym_interpret; - for (i = 0; i < xkb->compat->num_si; i++, interp++) { - if ((interp->sym == NoSymbol) || (sym == interp->sym)) { - int match; - - if ((level == 0) || ((interp->match & XkbSI_LevelOneOnly) == 0)) - mods = real_mods; - else - mods = 0; - switch (interp->match & XkbSI_OpMask) { - case XkbSI_NoneOf: - match = ((interp->mods & mods) == 0); - break; - case XkbSI_AnyOfOrNone: - match = ((mods == 0) || ((interp->mods & mods) != 0)); - break; - case XkbSI_AnyOf: - match = ((interp->mods & mods) != 0); - break; - case XkbSI_AllOf: - match = ((interp->mods & mods) == interp->mods); - break; - case XkbSI_Exactly: - match = (interp->mods == mods); - break; - default: - match = 0; - break; - } - if (match) { - if (interp->sym != NoSymbol) { - return interp; - } - else if (rtrn == NULL) { - rtrn = interp; - } - } - } - } - return rtrn; -} - -static void -_XkbAddKeyChange(KeyCode *pFirst, unsigned char *pNum, KeyCode newKey) -{ - KeyCode last; - - last = (*pFirst) + (*pNum); - if (newKey < *pFirst) { - *pFirst = newKey; - *pNum = (last - newKey) + 1; - } - else if (newKey > last) { - *pNum = (last - *pFirst) + 1; - } - return; -} - -static void -_XkbSetActionKeyMods(XkbDescPtr xkb, XkbAction *act, unsigned mods) -{ - unsigned tmp; - - switch (act->type) { - case XkbSA_SetMods: - case XkbSA_LatchMods: - case XkbSA_LockMods: - if (act->mods.flags & XkbSA_UseModMapMods) - act->mods.real_mods = act->mods.mask = mods; - if ((tmp = XkbModActionVMods(&act->mods)) != 0) { - XkbVirtualModsToReal(xkb, tmp, &tmp); - act->mods.mask |= tmp; - } - break; - case XkbSA_ISOLock: - if (act->iso.flags & XkbSA_UseModMapMods) - act->iso.real_mods = act->iso.mask = mods; - if ((tmp = XkbModActionVMods(&act->iso)) != 0) { - XkbVirtualModsToReal(xkb, tmp, &tmp); - act->iso.mask |= tmp; - } - break; - } - return; -} - -#define IBUF_SIZE 8 - -Bool -XkbApplyCompatMapToKey(XkbDescPtr xkb, KeyCode key, XkbChangesPtr changes) -{ - KeySym *syms; - unsigned char explicit, mods; - XkbSymInterpretPtr *interps, ibuf[IBUF_SIZE]; - int n, nSyms, found; - unsigned changed, tmp; - - if ((!xkb) || (!xkb->map) || (!xkb->map->key_sym_map) || - (!xkb->compat) || (!xkb->compat->sym_interpret) || - (key < xkb->min_key_code) || (key > xkb->max_key_code)) { - return False; - } - if (((!xkb->server) || (!xkb->server->key_acts)) && - (XkbAllocServerMap(xkb, XkbAllServerInfoMask, 0) != Success)) { - return False; - } - changed = 0; /* keeps track of what has changed in _this_ call */ - explicit = xkb->server->explicit[key]; - if (explicit & XkbExplicitInterpretMask) /* nothing to do */ - return True; - mods = (xkb->map->modmap ? xkb->map->modmap[key] : 0); - nSyms = XkbKeyNumSyms(xkb, key); - syms = XkbKeySymsPtr(xkb, key); - if (nSyms > IBUF_SIZE) { - interps = _XkbTypedCalloc(nSyms, XkbSymInterpretPtr); - if (interps == NULL) { - interps = ibuf; - nSyms = IBUF_SIZE; - } - } - else { - interps = ibuf; - } - found = 0; - for (n = 0; n < nSyms; n++) { - unsigned level = (n % XkbKeyGroupsWidth(xkb, key)); - - interps[n] = NULL; - if (syms[n] != NoSymbol) { - interps[n] = _XkbFindMatchingInterp(xkb, syms[n], mods, level); - if (interps[n] && interps[n]->act.type != XkbSA_NoAction) - found++; - else - interps[n] = NULL; - } - } - /* 1/28/96 (ef) -- XXX! WORKING HERE */ - if (!found) { - if (xkb->server->key_acts[key] != 0) { - xkb->server->key_acts[key] = 0; - changed |= XkbKeyActionsMask; - } - } - else { - XkbAction *pActs; - unsigned int new_vmodmask; - - changed |= XkbKeyActionsMask; - pActs = XkbResizeKeyActions(xkb, key, nSyms); - if (!pActs) { - if (nSyms > IBUF_SIZE) - Xfree(interps); - return False; - } - new_vmodmask = 0; - for (n = 0; n < nSyms; n++) { - if (interps[n]) { - unsigned effMods; - - pActs[n] = *((XkbAction *) &interps[n]->act); - if ((n == 0) || ((interps[n]->match & XkbSI_LevelOneOnly) == 0)) { - effMods = mods; - if (interps[n]->virtual_mod != XkbNoModifier) - new_vmodmask |= (1 << interps[n]->virtual_mod); - } - else - effMods = 0; - _XkbSetActionKeyMods(xkb, &pActs[n], effMods); - } - else - pActs[n].type = XkbSA_NoAction; - } - if (((explicit & XkbExplicitVModMapMask) == 0) && - (xkb->server->vmodmap[key] != new_vmodmask)) { - changed |= XkbVirtualModMapMask; - xkb->server->vmodmap[key] = new_vmodmask; - } - if (interps[0]) { - if ((interps[0]->flags & XkbSI_LockingKey) && - ((explicit & XkbExplicitBehaviorMask) == 0)) { - xkb->server->behaviors[key].type = XkbKB_Lock; - changed |= XkbKeyBehaviorsMask; - } - if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) { - CARD8 old; - - old = xkb->ctrls->per_key_repeat[key / 8]; - if (interps[0]->flags & XkbSI_AutoRepeat) - xkb->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8)); - else - xkb->ctrls->per_key_repeat[key / 8] &= ~(1 << (key % 8)); - if (changes && (old != xkb->ctrls->per_key_repeat[key / 8])) - changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask; - } - } - } - if ((!found) || (interps[0] == NULL)) { - if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) { - CARD8 old; - - old = xkb->ctrls->per_key_repeat[key / 8]; -#ifdef RETURN_SHOULD_REPEAT - if (*XkbKeySymsPtr(xkb, key) != XK_Return) -#endif - xkb->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8)); - if (changes && (old != xkb->ctrls->per_key_repeat[key / 8])) - changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask; - } - if (((explicit & XkbExplicitBehaviorMask) == 0) && - (xkb->server->behaviors[key].type == XkbKB_Lock)) { - xkb->server->behaviors[key].type = XkbKB_Default; - changed |= XkbKeyBehaviorsMask; - } - } - if (changes) { - XkbMapChangesPtr mc; - - mc = &changes->map; - tmp = (changed & mc->changed); - if (tmp & XkbKeyActionsMask) - _XkbAddKeyChange(&mc->first_key_act, &mc->num_key_acts, key); - else if (changed & XkbKeyActionsMask) { - mc->changed |= XkbKeyActionsMask; - mc->first_key_act = key; - mc->num_key_acts = 1; - } - if (tmp & XkbKeyBehaviorsMask) { - _XkbAddKeyChange(&mc->first_key_behavior, &mc->num_key_behaviors, - key); - } - else if (changed & XkbKeyBehaviorsMask) { - mc->changed |= XkbKeyBehaviorsMask; - mc->first_key_behavior = key; - mc->num_key_behaviors = 1; - } - if (tmp & XkbVirtualModMapMask) - _XkbAddKeyChange(&mc->first_vmodmap_key, &mc->num_vmodmap_keys, - key); - else if (changed & XkbVirtualModMapMask) { - mc->changed |= XkbVirtualModMapMask; - mc->first_vmodmap_key = key; - mc->num_vmodmap_keys = 1; - } - mc->changed |= changed; - } - if (interps != ibuf) - _XkbFree(interps); - return True; -} - -Bool -XkbUpdateMapFromCore(XkbDescPtr xkb, - KeyCode first_key, - int num_keys, - int map_width, - KeySym *core_keysyms, - XkbChangesPtr changes) -{ - register int key, last_key; - KeySym *syms; - - syms = &core_keysyms[(first_key - xkb->min_key_code) * map_width]; - if (changes) { - if (changes->map.changed & XkbKeySymsMask) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms, first_key); - if (num_keys > 1) { - _XkbAddKeyChange(&changes->map.first_key_sym, - &changes->map.num_key_syms, - first_key + num_keys - 1); - } - } - else { - changes->map.changed |= XkbKeySymsMask; - changes->map.first_key_sym = first_key; - changes->map.num_key_syms = num_keys; - } - } - last_key = first_key + num_keys - 1; - for (key = first_key; key <= last_key; key++, syms += map_width) { - XkbMapChangesPtr mc; - unsigned explicit; - KeySym tsyms[XkbMaxSymsPerKey]; - int types[XkbNumKbdGroups]; - int nG; - - explicit = xkb->server->explicit[key] & XkbExplicitKeyTypesMask; - types[XkbGroup1Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index); - types[XkbGroup2Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup2Index); - types[XkbGroup3Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup3Index); - types[XkbGroup4Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup4Index); - nG = XkbKeyTypesForCoreSymbols(xkb, map_width, syms, explicit, types, - tsyms); - if (changes) - mc = &changes->map; - else - mc = NULL; - XkbChangeTypesOfKey(xkb, key, nG, XkbAllGroupsMask, types, mc); - memcpy((char *) XkbKeySymsPtr(xkb, key), (char *) tsyms, - XkbKeyNumSyms(xkb, key) * sizeof(KeySym)); - XkbApplyCompatMapToKey(xkb, key, changes); - } - - if ((xkb->map->modmap != NULL) && (changes) && - (changes->map.changed & (XkbVirtualModMapMask | XkbModifierMapMask))) { - unsigned char newVMods[XkbNumVirtualMods]; - register unsigned bit, i; - unsigned present; - - bzero(newVMods, XkbNumVirtualMods); - present = 0; - for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) { - if (xkb->server->vmodmap[key] == 0) - continue; - for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if (bit & xkb->server->vmodmap[key]) { - present |= bit; - newVMods[i] |= xkb->map->modmap[key]; - } - } - } - for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if ((bit & present) && (newVMods[i] != xkb->server->vmods[i])) { - changes->map.changed |= XkbVirtualModsMask; - changes->map.vmods |= bit; - xkb->server->vmods[i] = newVMods[i]; - } - } - } - if (changes && (changes->map.changed & XkbVirtualModsMask)) - XkbApplyVirtualModChanges(xkb, changes->map.vmods, changes); - return True; -} - -Status -XkbChangeTypesOfKey(XkbDescPtr xkb, - int key, - int nGroups, - unsigned groups, - int *newTypesIn, - XkbMapChangesPtr changes) -{ - XkbKeyTypePtr pOldType, pNewType; - register int i; - int width, nOldGroups, oldWidth, newTypes[XkbNumKbdGroups]; - - if ((!xkb) || (!XkbKeycodeInRange(xkb, key)) || (!xkb->map) || - (!xkb->map->types) || ((groups & XkbAllGroupsMask) == 0) || - (nGroups > XkbNumKbdGroups)) { - return BadMatch; - } - if (nGroups == 0) { - for (i = 0; i < XkbNumKbdGroups; i++) { - xkb->map->key_sym_map[key].kt_index[i] = XkbOneLevelIndex; - } - i = xkb->map->key_sym_map[key].group_info; - i = XkbSetNumGroups(i, 0); - xkb->map->key_sym_map[key].group_info = i; - XkbResizeKeySyms(xkb, key, 0); - return Success; - } - - nOldGroups = XkbKeyNumGroups(xkb, key); - oldWidth = XkbKeyGroupsWidth(xkb, key); - for (width = i = 0; i < nGroups; i++) { - if (groups & (1 << i)) - newTypes[i] = newTypesIn[i]; - else if (i < nOldGroups) - newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, i); - else if (nOldGroups > 0) - newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index); - else - newTypes[i] = XkbTwoLevelIndex; - if (newTypes[i] > xkb->map->num_types) - return BadMatch; - pNewType = &xkb->map->types[newTypes[i]]; - if (pNewType->num_levels > width) - width = pNewType->num_levels; - } - if ((xkb->ctrls) && (nGroups > xkb->ctrls->num_groups)) - xkb->ctrls->num_groups = nGroups; - if ((width != oldWidth) || (nGroups != nOldGroups)) { - KeySym oldSyms[XkbMaxSymsPerKey], *pSyms; - int nCopy; - - if (nOldGroups == 0) { - pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); - if (pSyms != NULL) { - i = xkb->map->key_sym_map[key].group_info; - i = XkbSetNumGroups(i, nGroups); - xkb->map->key_sym_map[key].group_info = i; - xkb->map->key_sym_map[key].width = width; - for (i = 0; i < nGroups; i++) { - xkb->map->key_sym_map[key].kt_index[i] = newTypes[i]; - } - return Success; - } - return BadAlloc; - } - pSyms = XkbKeySymsPtr(xkb, key); - memcpy(oldSyms, pSyms, XkbKeyNumSyms(xkb, key) * sizeof(KeySym)); - pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); - if (pSyms == NULL) - return BadAlloc; - bzero(pSyms, width * nGroups * sizeof(KeySym)); - for (i = 0; (i < nGroups) && (i < nOldGroups); i++) { - pOldType = XkbKeyKeyType(xkb, key, i); - pNewType = &xkb->map->types[newTypes[i]]; - if (pNewType->num_levels > pOldType->num_levels) - nCopy = pOldType->num_levels; - else - nCopy = pNewType->num_levels; - memcpy(&pSyms[i * width], &oldSyms[i * oldWidth], - nCopy * sizeof(KeySym)); - } - if (XkbKeyHasActions(xkb, key)) { - XkbAction oldActs[XkbMaxSymsPerKey], *pActs; - - pActs = XkbKeyActionsPtr(xkb, key); - memcpy(oldActs, pActs, XkbKeyNumSyms(xkb, key) * sizeof(XkbAction)); - pActs = XkbResizeKeyActions(xkb, key, width * nGroups); - if (pActs == NULL) - return BadAlloc; - bzero(pActs, width * nGroups * sizeof(XkbAction)); - for (i = 0; (i < nGroups) && (i < nOldGroups); i++) { - pOldType = XkbKeyKeyType(xkb, key, i); - pNewType = &xkb->map->types[newTypes[i]]; - if (pNewType->num_levels > pOldType->num_levels) - nCopy = pOldType->num_levels; - else - nCopy = pNewType->num_levels; - memcpy(&pActs[i * width], &oldActs[i * oldWidth], - nCopy * sizeof(XkbAction)); - } - } - i = xkb->map->key_sym_map[key].group_info; - i = XkbSetNumGroups(i, nGroups); - xkb->map->key_sym_map[key].group_info = i; - xkb->map->key_sym_map[key].width = width; - } - width = 0; - for (i = 0; i < nGroups; i++) { - xkb->map->key_sym_map[key].kt_index[i] = newTypes[i]; - if (xkb->map->types[newTypes[i]].num_levels > width) - width = xkb->map->types[newTypes[i]].num_levels; - } - xkb->map->key_sym_map[key].width = width; - if (changes != NULL) { - if (changes->changed & XkbKeySymsMask) { - _XkbAddKeyChange(&changes->first_key_sym, &changes->num_key_syms, - key); - } - else { - changes->changed |= XkbKeySymsMask; - changes->first_key_sym = key; - changes->num_key_syms = 1; - } - } - return Success; -} - -/***====================================================================***/ - -Bool -XkbVirtualModsToReal(XkbDescPtr xkb, unsigned virtual_mask, unsigned *mask_rtrn) -{ - register int i, bit; - register unsigned mask; - - if (xkb == NULL) - return False; - if (virtual_mask == 0) { - *mask_rtrn = 0; - return True; - } - if (xkb->server == NULL) - return False; - for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if (virtual_mask & bit) - mask |= xkb->server->vmods[i]; - } - *mask_rtrn = mask; - return True; -} - -/***====================================================================***/ - -Bool -XkbUpdateActionVirtualMods(XkbDescPtr xkb, XkbAction *act, unsigned changed) -{ - unsigned int tmp; - - switch (act->type) { - case XkbSA_SetMods: - case XkbSA_LatchMods: - case XkbSA_LockMods: - if (((tmp = XkbModActionVMods(&act->mods)) & changed) != 0) { - XkbVirtualModsToReal(xkb, tmp, &tmp); - act->mods.mask = act->mods.real_mods; - act->mods.mask |= tmp; - return True; - } - break; - case XkbSA_ISOLock: - if ((((tmp = XkbModActionVMods(&act->iso)) != 0) & changed) != 0) { - XkbVirtualModsToReal(xkb, tmp, &tmp); - act->iso.mask = act->iso.real_mods; - act->iso.mask |= tmp; - return True; - } - break; - } - return False; -} - -void -XkbUpdateKeyTypeVirtualMods(XkbDescPtr xkb, - XkbKeyTypePtr type, - unsigned int changed, - XkbChangesPtr changes) -{ - register unsigned int i; - unsigned int mask = 0; - - XkbVirtualModsToReal(xkb, type->mods.vmods, &mask); - type->mods.mask = type->mods.real_mods | mask; - if ((type->map_count > 0) && (type->mods.vmods != 0)) { - XkbKTMapEntryPtr entry; - - for (i = 0, entry = type->map; i < type->map_count; i++, entry++) { - if (entry->mods.vmods != 0) { - XkbVirtualModsToReal(xkb, entry->mods.vmods, &mask); - entry->mods.mask = entry->mods.real_mods | mask; - /* entry is active if vmods are bound */ - entry->active = (mask != 0); - } - else - entry->active = 1; - } - } - if (changes) { - int type_ndx; - - type_ndx = type - xkb->map->types; - if ((type_ndx < 0) || (type_ndx > xkb->map->num_types)) - return; - if (changes->map.changed & XkbKeyTypesMask) { - int last; - - last = changes->map.first_type + changes->map.num_types - 1; - if (type_ndx < changes->map.first_type) { - changes->map.first_type = type_ndx; - changes->map.num_types = (last - type_ndx) + 1; - } - else if (type_ndx > last) { - changes->map.num_types = - (type_ndx - changes->map.first_type) + 1; - } - } - else { - changes->map.changed |= XkbKeyTypesMask; - changes->map.first_type = type_ndx; - changes->map.num_types = 1; - } - } - return; -} - -Bool -XkbApplyVirtualModChanges(XkbDescPtr xkb, - unsigned changed, - XkbChangesPtr changes) -{ - register int i; - unsigned int checkState = 0; - - if ((!xkb) || (!xkb->map) || (changed == 0)) - return False; - for (i = 0; i < xkb->map->num_types; i++) { - if (xkb->map->types[i].mods.vmods & changed) - XkbUpdateKeyTypeVirtualMods(xkb, &xkb->map->types[i], changed, - changes); - } - if (changed & xkb->ctrls->internal.vmods) { - unsigned int newMask = 0; - - XkbVirtualModsToReal(xkb, xkb->ctrls->internal.vmods, &newMask); - newMask |= xkb->ctrls->internal.real_mods; - if (xkb->ctrls->internal.mask != newMask) { - xkb->ctrls->internal.mask = newMask; - if (changes) { - changes->ctrls.changed_ctrls |= XkbInternalModsMask; - checkState = True; - } - } - } - if (changed & xkb->ctrls->ignore_lock.vmods) { - unsigned int newMask = 0; - - XkbVirtualModsToReal(xkb, xkb->ctrls->ignore_lock.vmods, &newMask); - newMask |= xkb->ctrls->ignore_lock.real_mods; - if (xkb->ctrls->ignore_lock.mask != newMask) { - xkb->ctrls->ignore_lock.mask = newMask; - if (changes) { - changes->ctrls.changed_ctrls |= XkbIgnoreLockModsMask; - checkState = True; - } - } - } - if (xkb->indicators != NULL) { - XkbIndicatorMapPtr map; - - map = &xkb->indicators->maps[0]; - for (i = 0; i < XkbNumIndicators; i++, map++) { - if (map->mods.vmods & changed) { - unsigned int newMask = 0; - - XkbVirtualModsToReal(xkb, map->mods.vmods, &newMask); - newMask |= map->mods.real_mods; - if (newMask != map->mods.mask) { - map->mods.mask = newMask; - if (changes) { - changes->indicators.map_changes |= (1 << i); - checkState = True; - } - } - } - } - } - if (xkb->compat != NULL) { - XkbCompatMapPtr compat; - - compat = xkb->compat; - for (i = 0; i < XkbNumKbdGroups; i++) { - unsigned int newMask = 0; - - XkbVirtualModsToReal(xkb, compat->groups[i].vmods, &newMask); - newMask |= compat->groups[i].real_mods; - if (compat->groups[i].mask != newMask) { - compat->groups[i].mask = newMask; - if (changes) { - changes->compat.changed_groups |= (1 << i); - checkState = True; - } - } - } - } - if (xkb->map && xkb->server) { - int highChange = 0, lowChange = -1; - - for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { - if (XkbKeyHasActions(xkb, i)) { - register XkbAction *pAct; - register int n; - - pAct = XkbKeyActionsPtr(xkb, i); - for (n = XkbKeyNumActions(xkb, i); n > 0; n--, pAct++) { - if ((pAct->type != XkbSA_NoAction) && - XkbUpdateActionVirtualMods(xkb, pAct, changed)) { - if (lowChange < 0) - lowChange = i; - highChange = i; - } - } - } - } - if (changes && (lowChange > 0)) { /* something changed */ - if (changes->map.changed & XkbKeyActionsMask) { - int last; - - if (changes->map.first_key_act < lowChange) - lowChange = changes->map.first_key_act; - last = - changes->map.first_key_act + changes->map.num_key_acts - 1; - if (last > highChange) - highChange = last; - } - changes->map.changed |= XkbKeyActionsMask; - changes->map.first_key_act = lowChange; - changes->map.num_key_acts = (highChange - lowChange) + 1; - } - } - return checkState; -} diff --git a/nx-X11/lib/X11/XKBNames.c b/nx-X11/lib/X11/XKBNames.c deleted file mode 100644 index 951fd1da8..000000000 --- a/nx-X11/lib/X11/XKBNames.c +++ /dev/null @@ -1,879 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#define NEED_MAP_READERS -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "XKBlibint.h" - - -static Status -_XkbReadAtoms(XkbReadBufferPtr buf, - Atom *atoms, - int maxAtoms, - CARD32 present) -{ - register int i, bit; - - for (i = 0, bit = 1; (i < maxAtoms) && (present); i++, bit <<= 1) { - if (present & bit) { - if (!_XkbReadBufferCopy32(buf, (long *) &atoms[i], 1)) - return BadLength; - present &= ~bit; - } - } - return Success; -} - -Status -_XkbReadGetNamesReply(Display *dpy, - xkbGetNamesReply *rep, - XkbDescPtr xkb, - int *nread_rtrn) -{ - int i, len; - XkbReadBufferRec buf; - register XkbNamesPtr names; - - if (xkb->device_spec == XkbUseCoreKbd) - xkb->device_spec = rep->deviceID; - - if ((xkb->names == NULL) && - (XkbAllocNames(xkb, rep->which, - rep->nRadioGroups, rep->nKeyAliases) != Success)) { - return BadAlloc; - } - names = xkb->names; - if (rep->length == 0) - return Success; - - if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) - return BadAlloc; - if (nread_rtrn) - *nread_rtrn = (int) rep->length * 4; - - if ((rep->which & XkbKeycodesNameMask) && - (!_XkbReadBufferCopy32(&buf, (long *) &names->keycodes, 1))) - goto BAILOUT; - if ((rep->which & XkbGeometryNameMask) && - (!_XkbReadBufferCopy32(&buf, (long *) &names->geometry, 1))) - goto BAILOUT; - if ((rep->which & XkbSymbolsNameMask) && - (!_XkbReadBufferCopy32(&buf, (long *) &names->symbols, 1))) - goto BAILOUT; - if ((rep->which & XkbPhysSymbolsNameMask) && - (!_XkbReadBufferCopy32(&buf, (long *) &names->phys_symbols, 1))) - goto BAILOUT; - if ((rep->which & XkbTypesNameMask) && - (!_XkbReadBufferCopy32(&buf, (long *) &names->types, 1))) - goto BAILOUT; - if ((rep->which & XkbCompatNameMask) && - (!_XkbReadBufferCopy32(&buf, (long *) &names->compat, 1))) - goto BAILOUT; - - if (rep->which & XkbKeyTypeNamesMask) { - XkbClientMapPtr map = xkb->map; - XkbKeyTypePtr type; - - len = rep->nTypes * 4; - if (map != NULL) { - type = map->types; - for (i = 0; (i < map->num_types) && (i < rep->nTypes); i++, type++) { - if (!_XkbReadBufferCopy32(&buf, (long *) &type->name, 1)) - goto BAILOUT; - len -= 4; - } - } - if ((len > 0) && (!_XkbSkipReadBufferData(&buf, len))) - goto BAILOUT; - } - if (rep->which & XkbKTLevelNamesMask) { - CARD8 *nLevels; - XkbClientMapPtr map = xkb->map; - - nLevels = - (CARD8 *) _XkbGetReadBufferPtr(&buf, XkbPaddedSize(rep->nTypes)); - if (nLevels == NULL) - goto BAILOUT; - if (map != NULL) { - XkbKeyTypePtr type = map->types; - - for (i = 0; i < (int) rep->nTypes; i++, type++) { - if (i >= map->num_types) { - if (!_XkbSkipReadBufferData(&buf, nLevels[i] * 4)) - goto BAILOUT; - continue; - } - if ((nLevels[i] > 0) && (nLevels[i] != type->num_levels)) { - goto BAILOUT; - } - - Xfree(type->level_names); - if (nLevels[i] == 0) { - type->level_names = NULL; - continue; - } - type->level_names = _XkbTypedCalloc(nLevels[i], Atom); - if (type->level_names != NULL) { - if (!_XkbReadBufferCopy32(&buf, (long *) type->level_names, - nLevels[i])) - goto BAILOUT; - } - else { - _XkbSkipReadBufferData(&buf, nLevels[i] * 4); - } - } - } - else { - for (i = 0; i < (int) rep->nTypes; i++) { - _XkbSkipReadBufferData(&buf, nLevels[i] * 4); - } - } - } - if (rep->which & XkbIndicatorNamesMask) { - if (_XkbReadAtoms(&buf, names->indicators, XkbNumIndicators, - rep->indicators) != Success) - goto BAILOUT; - } - if (rep->which & XkbVirtualModNamesMask) { - if (_XkbReadAtoms(&buf, names->vmods, XkbNumVirtualMods, - (CARD32) rep->virtualMods) != Success) - goto BAILOUT; - } - if (rep->which & XkbGroupNamesMask) { - if (_XkbReadAtoms(&buf, names->groups, XkbNumKbdGroups, - (CARD32) rep->groupNames) != Success) - goto BAILOUT; - } - if (rep->which & XkbKeyNamesMask) { - if (names->keys == NULL) { - int nKeys; - - if (xkb->max_key_code == 0) { - xkb->min_key_code = rep->minKeyCode; - xkb->max_key_code = rep->maxKeyCode; - } - nKeys = xkb->max_key_code + 1; - names->keys = _XkbTypedCalloc(nKeys, XkbKeyNameRec); - } - if (((int) rep->firstKey + rep->nKeys) > xkb->max_key_code + 1) - goto BAILOUT; - if (names->keys != NULL) { - if (!_XkbCopyFromReadBuffer(&buf, - (char *) &names->keys[rep->firstKey], - rep->nKeys * XkbKeyNameLength)) - goto BAILOUT; - } - else - _XkbSkipReadBufferData(&buf, rep->nKeys * XkbKeyNameLength); - } - if (rep->which & XkbKeyAliasesMask && (rep->nKeyAliases > 0)) { - if (XkbAllocNames(xkb, XkbKeyAliasesMask, 0, rep->nKeyAliases) != - Success) - goto BAILOUT; - if (!_XkbCopyFromReadBuffer(&buf, (char *) names->key_aliases, - rep->nKeyAliases * XkbKeyNameLength * 2)) - goto BAILOUT; - } - if (rep->which & XkbRGNamesMask) { - if (rep->nRadioGroups > 0) { - Atom *rgNames; - - if (names->radio_groups == NULL) - names->radio_groups = _XkbTypedCalloc(rep->nRadioGroups, Atom); - else if (names->num_rg < rep->nRadioGroups) { - names->radio_groups = _XkbTypedRealloc(names->radio_groups, - rep->nRadioGroups, Atom); - } - rgNames = names->radio_groups; - if (!rgNames) { - goto BAILOUT; - } - if (!_XkbReadBufferCopy32 - (&buf, (long *) rgNames, rep->nRadioGroups)) - goto BAILOUT; - names->num_rg = rep->nRadioGroups; - } - else if (names->num_rg > 0) { - names->num_rg = 0; - Xfree(names->radio_groups); - } - } - len = _XkbFreeReadBuffer(&buf); - if (len != 0) - return BadLength; - else - return Success; - BAILOUT: - _XkbFreeReadBuffer(&buf); - return BadLength; -} - -Status -XkbGetNames(Display *dpy, unsigned which, XkbDescPtr xkb) -{ - register xkbGetNamesReq *req; - xkbGetNamesReply rep; - Status status; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - if (!xkb->names) { - xkb->names = _XkbTypedCalloc(1, XkbNamesRec); - if (!xkb->names) { - UnlockDisplay(dpy); - SyncHandle(); - return BadAlloc; - } - } - GetReq(kbGetNames, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetNames; - req->deviceSpec = xkb->device_spec; - req->which = which; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadImplementation; - } - - status = _XkbReadGetNamesReply(dpy, &rep, xkb, NULL); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -/***====================================================================***/ - -static int -_XkbCountBits(int nBitsMax, unsigned long mask) -{ - register unsigned long y, nBits; - - y = (mask >> 1) & 033333333333; - y = mask - y - ((y >> 1) & 033333333333); - nBits = ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); - - /* nBitsMax really means max+1 */ - return (nBits < nBitsMax) ? nBits : (nBitsMax - 1); -} - -static CARD32 -_XkbCountAtoms(Atom *atoms, int maxAtoms, int *count) -{ - register unsigned int i, bit, nAtoms; - register CARD32 atomsPresent; - - for (i = nAtoms = atomsPresent = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) { - if (atoms[i] != None) { - atomsPresent |= bit; - nAtoms++; - } - } - if (count) - *count = nAtoms; - return atomsPresent; -} - -static void -_XkbCopyAtoms(Display *dpy, Atom *atoms, CARD32 mask, int maxAtoms) -{ - register unsigned int i, bit; - - for (i = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) { - if (mask & bit) - Data32(dpy, &atoms[i], 4); - } - return; -} - -Bool -XkbSetNames(Display *dpy, - unsigned int which, - unsigned int firstType, - unsigned int nTypes, - XkbDescPtr xkb) -{ - register xkbSetNamesReq *req; - int nLvlNames = 0; - XkbInfoPtr xkbi; - XkbNamesPtr names; - unsigned firstLvlType, nLvlTypes; - int nVMods, nLEDs, nRG, nKA, nGroups; - int nKeys = 0, firstKey = 0, nAtoms; - CARD32 leds, vmods, groups; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!xkb) || (!xkb->names)) - return False; - firstLvlType = firstType; - nLvlTypes = nTypes; - if (nTypes < 1) - which &= ~(XkbKTLevelNamesMask | XkbKeyTypeNamesMask); - else if (firstType <= XkbLastRequiredType) { - int adjust; - - adjust = XkbLastRequiredType - firstType + 1; - firstType += adjust; - nTypes -= adjust; - if (nTypes < 1) - which &= ~XkbKeyTypeNamesMask; - } - names = xkb->names; - if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) { - register int i; - XkbKeyTypePtr type; - - if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) || - (firstType + nTypes > xkb->map->num_types) || - (firstLvlType + nLvlTypes > xkb->map->num_types)) - return False; - if (which & XkbKTLevelNamesMask) { - type = &xkb->map->types[firstLvlType]; - for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) { - if (type->level_names != NULL) - nLvlNames += type->num_levels; - } - } - } - - nVMods = nLEDs = nRG = nKA = nAtoms = nGroups = 0; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetNames, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetNames; - req->deviceSpec = xkb->device_spec; - req->firstType = firstType; - req->nTypes = nTypes; - req->firstKey = xkb->min_key_code; - req->nKeys = xkb->max_key_code - xkb->min_key_code + 1; - - if (which & XkbKeycodesNameMask) - nAtoms++; - if (which & XkbGeometryNameMask) - nAtoms++; - if (which & XkbSymbolsNameMask) - nAtoms++; - if (which & XkbPhysSymbolsNameMask) - nAtoms++; - if (which & XkbTypesNameMask) - nAtoms++; - if (which & XkbCompatNameMask) - nAtoms++; - if (which & XkbKeyTypeNamesMask) - nAtoms += nTypes; - if (which & XkbKTLevelNamesMask) { - req->firstKTLevel = firstLvlType; - req->nKTLevels = nLvlTypes; - req->length += XkbPaddedSize(nLvlTypes) / 4; /* room for group widths */ - nAtoms += nLvlNames; - } - else - req->firstKTLevel = req->nKTLevels = 0; - - if (which & XkbIndicatorNamesMask) { - req->indicators = leds = - _XkbCountAtoms(names->indicators, XkbNumIndicators, &nLEDs); - if (nLEDs > 0) - nAtoms += nLEDs; - else - which &= ~XkbIndicatorNamesMask; - } - else - req->indicators = leds = 0; - - if (which & XkbVirtualModNamesMask) { - vmods = req->virtualMods = (CARD16) - _XkbCountAtoms(names->vmods, XkbNumVirtualMods, &nVMods); - if (nVMods > 0) - nAtoms += nVMods; - else - which &= ~XkbVirtualModNamesMask; - } - else - vmods = req->virtualMods = 0; - - if (which & XkbGroupNamesMask) { - groups = req->groupNames = (CARD8) - _XkbCountAtoms(names->groups, XkbNumKbdGroups, &nGroups); - if (nGroups > 0) - nAtoms += nGroups; - else - which &= ~XkbGroupNamesMask; - } - else - groups = req->groupNames = 0; - - if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { - firstKey = req->firstKey; - nKeys = req->nKeys; - nAtoms += nKeys; /* technically not atoms, but 4 bytes wide */ - } - else - which &= ~XkbKeyNamesMask; - - if (which & XkbKeyAliasesMask) { - nKA = ((names->key_aliases != NULL) ? names->num_key_aliases : 0); - if (nKA > 0) { - req->nKeyAliases = nKA; - nAtoms += nKA * 2; /* not atoms, but 8 bytes on the wire */ - } - else { - which &= ~XkbKeyAliasesMask; - req->nKeyAliases = 0; - } - } - else - req->nKeyAliases = 0; - - if (which & XkbRGNamesMask) { - nRG = names->num_rg; - if (nRG > 0) - nAtoms += nRG; - else - which &= ~XkbRGNamesMask; - } - - req->which = which; - req->nRadioGroups = nRG; - req->length += (nAtoms * 4) / 4; - - if (which & XkbKeycodesNameMask) - Data32(dpy, (long *) &names->keycodes, 4); - if (which & XkbGeometryNameMask) - Data32(dpy, (long *) &names->geometry, 4); - if (which & XkbSymbolsNameMask) - Data32(dpy, (long *) &names->symbols, 4); - if (which & XkbPhysSymbolsNameMask) - Data32(dpy, (long *) &names->phys_symbols, 4); - if (which & XkbTypesNameMask) - Data32(dpy, (long *) &names->types, 4); - if (which & XkbCompatNameMask) - Data32(dpy, (long *) &names->compat, 4); - if (which & XkbKeyTypeNamesMask) { - register int i; - register XkbKeyTypePtr type; - - type = &xkb->map->types[firstType]; - for (i = 0; i < nTypes; i++, type++) { - Data32(dpy, (long *) &type->name, 4); - } - } - if (which & XkbKTLevelNamesMask) { - XkbKeyTypePtr type; - int i; - char *tmp; - - BufAlloc(char *, tmp, XkbPaddedSize(nLvlTypes)); - type = &xkb->map->types[firstLvlType]; - for (i = 0; i < nLvlTypes; i++, type++) { - *tmp++ = type->num_levels; - } - type = &xkb->map->types[firstLvlType]; - for (i = 0; i < nLvlTypes; i++, type++) { - if (type->level_names != NULL) - Data32(dpy, (long *) type->level_names, type->num_levels * 4); - } - } - if (which & XkbIndicatorNamesMask) - _XkbCopyAtoms(dpy, names->indicators, leds, XkbNumIndicators); - if (which & XkbVirtualModNamesMask) - _XkbCopyAtoms(dpy, names->vmods, vmods, XkbNumVirtualMods); - if (which & XkbGroupNamesMask) - _XkbCopyAtoms(dpy, names->groups, groups, XkbNumKbdGroups); - if (which & XkbKeyNamesMask) { - Data(dpy, (char *) &names->keys[firstKey], nKeys * XkbKeyNameLength); - } - if (which & XkbKeyAliasesMask) { - Data(dpy, (char *) names->key_aliases, nKA * XkbKeyNameLength * 2); - } - if (which & XkbRGNamesMask) { - Data32(dpy, (long *) names->radio_groups, nRG * 4); - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbChangeNames(Display *dpy, XkbDescPtr xkb, XkbNameChangesPtr changes) -{ - register xkbSetNamesReq *req; - int nLvlNames = 0; - XkbInfoPtr xkbi; - XkbNamesPtr names; - unsigned which, firstType, nTypes; - unsigned firstLvlType, nLvlTypes; - int nVMods, nLEDs, nRG, nKA, nGroups; - int nKeys = 0, firstKey = 0, nAtoms; - CARD32 leds = 0, vmods = 0, groups = 0; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!xkb) || (!xkb->names) || (!changes)) - return False; - which = changes->changed; - firstType = changes->first_type; - nTypes = changes->num_types; - firstLvlType = changes->first_lvl; - nLvlTypes = changes->num_lvls; - if (which & XkbKeyTypeNamesMask) { - if (nTypes < 1) - which &= ~XkbKeyTypeNamesMask; - else if (firstType <= XkbLastRequiredType) { - int adjust; - - adjust = XkbLastRequiredType - firstType + 1; - firstType += adjust; - nTypes -= adjust; - if (nTypes < 1) - which &= ~XkbKeyTypeNamesMask; - } - } - else - firstType = nTypes = 0; - - if (which & XkbKTLevelNamesMask) { - if (nLvlTypes < 1) - which &= ~XkbKTLevelNamesMask; - } - else - firstLvlType = nLvlTypes = 0; - - names = xkb->names; - if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) { - register int i; - - if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) || - (firstType + nTypes > xkb->map->num_types) || - (firstLvlType + nLvlTypes > xkb->map->num_types)) - return False; - if (which & XkbKTLevelNamesMask) { - XkbKeyTypePtr type = &xkb->map->types[firstLvlType]; - - for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) { - if (type->level_names != NULL) - nLvlNames += type->num_levels; - } - } - } - - if (changes->num_keys < 1) - which &= ~XkbKeyNamesMask; - if ((which & XkbKeyNamesMask) == 0) - changes->first_key = changes->num_keys = 0; - else if ((changes->first_key < xkb->min_key_code) || - (changes->first_key + changes->num_keys > xkb->max_key_code)) { - return False; - } - - if ((which & XkbVirtualModNamesMask) == 0) - changes->changed_vmods = 0; - else if (changes->changed_vmods == 0) - which &= ~XkbVirtualModNamesMask; - - if ((which & XkbIndicatorNamesMask) == 0) - changes->changed_indicators = 0; - else if (changes->changed_indicators == 0) - which &= ~XkbIndicatorNamesMask; - - if ((which & XkbGroupNamesMask) == 0) - changes->changed_groups = 0; - else if (changes->changed_groups == 0) - which &= ~XkbGroupNamesMask; - - nVMods = nLEDs = nRG = nKA = nAtoms = nGroups = 0; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetNames, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetNames; - req->deviceSpec = xkb->device_spec; - req->firstType = firstType; - req->nTypes = nTypes; - req->firstKey = changes->first_key; - req->nKeys = changes->num_keys; - - if (which & XkbKeycodesNameMask) - nAtoms++; - if (which & XkbGeometryNameMask) - nAtoms++; - if (which & XkbSymbolsNameMask) - nAtoms++; - if (which & XkbPhysSymbolsNameMask) - nAtoms++; - if (which & XkbTypesNameMask) - nAtoms++; - if (which & XkbCompatNameMask) - nAtoms++; - if (which & XkbKeyTypeNamesMask) - nAtoms += nTypes; - if (which & XkbKTLevelNamesMask) { - req->firstKTLevel = firstLvlType; - req->nKTLevels = nLvlTypes; - req->length += XkbPaddedSize(nLvlTypes) / 4; /* room for group widths */ - nAtoms += nLvlNames; - } - else - req->firstKTLevel = req->nKTLevels = 0; - - if (which & XkbIndicatorNamesMask) { - leds = req->indicators = (CARD32) changes->changed_indicators; - nLEDs = _XkbCountBits(XkbNumIndicators, changes->changed_indicators); - if (nLEDs > 0) - nAtoms += nLEDs; - else - which &= ~XkbIndicatorNamesMask; - } - else - req->indicators = 0; - - if (which & XkbVirtualModNamesMask) { - vmods = req->virtualMods = changes->changed_vmods; - nVMods = _XkbCountBits(XkbNumVirtualMods, - (unsigned long) changes->changed_vmods); - if (nVMods > 0) - nAtoms += nVMods; - else - which &= ~XkbVirtualModNamesMask; - } - else - req->virtualMods = 0; - - if (which & XkbGroupNamesMask) { - groups = req->groupNames = changes->changed_groups; - nGroups = _XkbCountBits(XkbNumKbdGroups, - (unsigned long) changes->changed_groups); - if (nGroups > 0) - nAtoms += nGroups; - else - which &= ~XkbGroupNamesMask; - } - else - req->groupNames = 0; - - if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { - firstKey = req->firstKey; - nKeys = req->nKeys; - nAtoms += nKeys; /* technically not atoms, but 4 bytes wide */ - } - else - which &= ~XkbKeyNamesMask; - - if (which & XkbKeyAliasesMask) { - nKA = ((names->key_aliases != NULL) ? names->num_key_aliases : 0); - if (nKA > 0) - nAtoms += nKA * 2; /* not atoms, but 8 bytes on the wire */ - else - which &= ~XkbKeyAliasesMask; - } - - if (which & XkbRGNamesMask) { - nRG = names->num_rg; - if (nRG > 0) - nAtoms += nRG; - else - which &= ~XkbRGNamesMask; - } - - req->which = which; - req->nRadioGroups = nRG; - req->length += (nAtoms * 4) / 4; - - if (which & XkbKeycodesNameMask) - Data32(dpy, (long *) &names->keycodes, 4); - if (which & XkbGeometryNameMask) - Data32(dpy, (long *) &names->geometry, 4); - if (which & XkbSymbolsNameMask) - Data32(dpy, (long *) &names->symbols, 4); - if (which & XkbPhysSymbolsNameMask) - Data32(dpy, (long *) &names->phys_symbols, 4); - if (which & XkbTypesNameMask) - Data32(dpy, (long *) &names->types, 4); - if (which & XkbCompatNameMask) - Data32(dpy, (long *) &names->compat, 4); - if (which & XkbKeyTypeNamesMask) { - register int i; - register XkbKeyTypePtr type; - - type = &xkb->map->types[firstType]; - for (i = 0; i < nTypes; i++, type++) { - Data32(dpy, (long *) &type->name, 4); - } - } - if (which & XkbKTLevelNamesMask) { - XkbKeyTypePtr type; - int i; - char *tmp; - - BufAlloc(char *, tmp, XkbPaddedSize(nLvlTypes)); - type = &xkb->map->types[firstLvlType]; - for (i = 0; i < nLvlTypes; i++, type++) { - *tmp++ = type->num_levels; - } - type = &xkb->map->types[firstLvlType]; - for (i = 0; i < nLvlTypes; i++, type++) { - if (type->level_names != NULL) - Data32(dpy, (long *) type->level_names, type->num_levels * 4); - } - } - if (which & XkbIndicatorNamesMask) - _XkbCopyAtoms(dpy, names->indicators, leds, XkbNumIndicators); - if (which & XkbVirtualModNamesMask) - _XkbCopyAtoms(dpy, names->vmods, vmods, XkbNumVirtualMods); - if (which & XkbGroupNamesMask) - _XkbCopyAtoms(dpy, names->groups, groups, XkbNumKbdGroups); - if (which & XkbKeyNamesMask) { - Data(dpy, (char *) &names->keys[firstKey], nKeys * XkbKeyNameLength); - } - if (which & XkbKeyAliasesMask) { - Data(dpy, (char *) names->key_aliases, nKA * XkbKeyNameLength * 2); - } - if (which & XkbRGNamesMask) { - Data32(dpy, (long *) names->radio_groups, nRG * 4); - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -void -XkbNoteNameChanges(XkbNameChangesPtr old, - XkbNamesNotifyEvent *new, - unsigned int wanted) -{ - int first, last, old_last, new_last; - - if ((old == NULL) || (new == NULL)) - return; - - wanted &= new->changed; - - if (wanted == 0) - return; - - if (wanted & XkbKeyTypeNamesMask) { - if (old->changed & XkbKeyTypeNamesMask) { - new_last = (new->first_type + new->num_types - 1); - old_last = (old->first_type + old->num_types - 1); - - if (new->first_type < old->first_type) - first = new->first_type; - else - first = old->first_type; - - if (old_last > new_last) - last = old_last; - else - last = new_last; - - old->first_type = first; - old->num_types = (last - first) + 1; - } - else { - old->first_type = new->first_type; - old->num_types = new->num_types; - } - } - if (wanted & XkbKTLevelNamesMask) { - if (old->changed & XkbKTLevelNamesMask) { - new_last = (new->first_lvl + new->num_lvls - 1); - old_last = (old->first_lvl + old->num_lvls - 1); - - if (new->first_lvl < old->first_lvl) - first = new->first_lvl; - else - first = old->first_lvl; - - if (old_last > new_last) - last = old_last; - else - last = new_last; - - old->first_lvl = first; - old->num_lvls = (last - first) + 1; - } - else { - old->first_lvl = new->first_lvl; - old->num_lvls = new->num_lvls; - } - } - if (wanted & XkbIndicatorNamesMask) { - if (old->changed & XkbIndicatorNamesMask) - old->changed_indicators |= new->changed_indicators; - else - old->changed_indicators = new->changed_indicators; - } - if (wanted & XkbKeyNamesMask) { - if (old->changed & XkbKeyNamesMask) { - new_last = (new->first_key + new->num_keys - 1); - old_last = (old->first_key + old->num_keys - 1); - - first = old->first_key; - - if (new->first_key < old->first_key) - first = new->first_key; - if (old_last > new_last) - new_last = old_last; - - old->first_key = first; - old->num_keys = (new_last - first) + 1; - } - else { - old->first_key = new->first_key; - old->num_keys = new->num_keys; - } - } - if (wanted & XkbVirtualModNamesMask) { - if (old->changed & XkbVirtualModNamesMask) - old->changed_vmods |= new->changed_vmods; - else - old->changed_vmods = new->changed_vmods; - } - if (wanted & XkbGroupNamesMask) { - if (old->changed & XkbGroupNamesMask) - old->changed_groups |= new->changed_groups; - else - old->changed_groups = new->changed_groups; - } - if (wanted & XkbRGNamesMask) - old->num_rg = new->num_radio_groups; - if (wanted & XkbKeyAliasesMask) - old->num_aliases = new->num_aliases; - old->changed |= wanted; - return; -} diff --git a/nx-X11/lib/X11/XKBRdBuf.c b/nx-X11/lib/X11/XKBRdBuf.c deleted file mode 100644 index 381f4c900..000000000 --- a/nx-X11/lib/X11/XKBRdBuf.c +++ /dev/null @@ -1,203 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "XKBlibint.h" -#include - -/***====================================================================***/ - -int -_XkbInitReadBuffer(Display *dpy, XkbReadBufferPtr buf, int size) -{ - if ((dpy != NULL) && (buf != NULL) && (size > 0)) { - buf->error = 0; - buf->size = size; - buf->start = buf->data = _XkbAlloc(size); - if (buf->start) { - _XRead(dpy, buf->start, size); - return 1; - } - } - return 0; -} - -#define _XkbReadBufferDataLeft(b) (((b)->size)-((b)->data-(b)->start)) - -int -_XkbSkipReadBufferData(XkbReadBufferPtr from, int size) -{ - if (size == 0) - return 1; - if ((from == NULL) || (from->error) || (size < 1) || - (_XkbReadBufferDataLeft(from) < size)) - return 0; - from->data += size; - return 1; -} - -int -_XkbCopyFromReadBuffer(XkbReadBufferPtr from, char *to, int size) -{ - if (size == 0) - return 1; - if ((from == NULL) || (from->error) || (to == NULL) || (size < 1) || - (_XkbReadBufferDataLeft(from) < size)) - return 0; - memcpy(to, from->data, size); - from->data += size; - return 1; -} - -#ifdef XKB_FORCE_INT_KEYSYM -int -_XkbReadCopyKeySyms(int *wire, KeySym * to, int num_words) -{ - while (num_words-- > 0) { - *to++ = *wire++; - } - return 1; -} - -int -_XkbReadBufferCopyKeySyms(XkbReadBufferPtr from, KeySym * to, int num_words) -{ - if ((unsigned) (num_words * 4) > _XkbReadBufferDataLeft(from)) - return 0; - _XkbReadCopyKeySyms((int *) from->data, to, num_words); - from->data += (4 * num_words); - return True; -} - -int -_XkbWriteCopyKeySyms(register KeySym * from, CARD32 *to, int len) -{ - while (len-- > 0) { - *to++ = (CARD32) *from++; - } - return True; -} -#endif - -#ifdef LONG64 -int -_XkbReadCopyData32(int *wire, long *to, int num_words) -{ - while (num_words-- > 0) { - *to++ = *wire++; - } - return 1; -} - -int -_XkbReadBufferCopy32(XkbReadBufferPtr from, long *to, int num_words) -{ - if ((unsigned) (num_words * 4) > _XkbReadBufferDataLeft(from)) - return 0; - _XkbReadCopyData32((int *) from->data, to, num_words); - from->data += (4 * num_words); - return True; -} - -int -_XkbWriteCopyData32(register unsigned long *from, CARD32 *to, int len) -{ - while (len-- > 0) { - *to++ = (CARD32) *from++; - } - return True; -} -#endif /* LONG64 */ - - -char * -_XkbPeekAtReadBuffer(XkbReadBufferPtr from, int size) -{ - if ((from == NULL) || (from->error) || (size < 1) || - (_XkbReadBufferDataLeft(from) < size)) - return NULL; - return from->data; -} - -char * -_XkbGetReadBufferPtr(XkbReadBufferPtr from, int size) -{ - char *ptr; - - if ((from == NULL) || (from->error) || (size < 1) || - (_XkbReadBufferDataLeft(from) < size)) - return NULL; - ptr = from->data; - from->data += size; - return ptr; -} - - -int -_XkbFreeReadBuffer(XkbReadBufferPtr buf) -{ - if ((buf != NULL) && (buf->start != NULL)) { - int left; - - left = (int) _XkbReadBufferDataLeft(buf); - - Xfree(buf->start); - buf->size = 0; - buf->start = buf->data = NULL; - return left; - } - return 0; -} - -Bool -_XkbGetReadBufferCountedString(XkbReadBufferPtr buf, char **rtrn) -{ - CARD16 len, *pLen; - int left; - char *str = NULL; - - if ((buf == NULL) || (buf->error) || - ((left = (int) _XkbReadBufferDataLeft(buf)) < 4)) - return False; - pLen = (CARD16 *) buf->data; - len = *pLen; - if (len > 0) { - if (XkbPaddedSize(len + 2) > left) - return False; - str = _XkbAlloc(len + 1); - if (str) { - memcpy(str, &buf->data[2], len); - str[len] = '\0'; - } - } - buf->data += XkbPaddedSize(len + 2); - *rtrn = str; - return True; -} diff --git a/nx-X11/lib/X11/XKBSetGeom.c b/nx-X11/lib/X11/XKBSetGeom.c deleted file mode 100644 index ee254e0dc..000000000 --- a/nx-X11/lib/X11/XKBSetGeom.c +++ /dev/null @@ -1,478 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef DEBUG -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#endif - -#include "Xlibint.h" -#include "XKBlibint.h" -#include -#include - -#ifndef MINSHORT -#define MINSHORT -32768 -#endif -#ifndef MAXSHORT -#define MAXSHORT 32767 -#endif - -/***====================================================================***/ - -#define _SizeCountedString(s) ((s)?XkbPaddedSize(2+strlen(s)):4) - -static char * -_WriteCountedString(char *wire, char *str) -{ - CARD16 len, *pLen; - - len = (str ? strlen(str) : 0); - pLen = (CARD16 *) wire; - *pLen = len; - if (len && str) - memcpy(&wire[2], str, len); - wire += XkbPaddedSize(len + 2); - return wire; -} - -static int -_SizeGeomProperties(XkbGeometryPtr geom) -{ - register int i, size; - XkbPropertyPtr prop; - - for (size = i = 0, prop = geom->properties; i < geom->num_properties; - i++, prop++) { - size += _SizeCountedString(prop->name); - size += _SizeCountedString(prop->value); - } - return size; -} - -static int -_SizeGeomColors(XkbGeometryPtr geom) -{ - register int i, size; - register XkbColorPtr color; - - for (i = size = 0, color = geom->colors; i < geom->num_colors; i++, color++) { - size += _SizeCountedString(color->spec); - } - return size; -} - -static int -_SizeGeomShapes(XkbGeometryPtr geom) -{ - register int i, size; - register XkbShapePtr shape; - - for (i = size = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { - register int n; - register XkbOutlinePtr ol; - - size += SIZEOF(xkbShapeWireDesc); - for (n = 0, ol = shape->outlines; n < shape->num_outlines; n++, ol++) { - size += SIZEOF(xkbOutlineWireDesc); - size += ol->num_points * SIZEOF(xkbPointWireDesc); - } - } - return size; -} - -static int -_SizeGeomDoodads(int num_doodads, XkbDoodadPtr doodad) -{ - register int i, size; - - for (i = size = 0; i < num_doodads; i++, doodad++) { - size += SIZEOF(xkbAnyDoodadWireDesc); - if (doodad->any.type == XkbTextDoodad) { - size += _SizeCountedString(doodad->text.text); - size += _SizeCountedString(doodad->text.font); - } - else if (doodad->any.type == XkbLogoDoodad) { - size += _SizeCountedString(doodad->logo.logo_name); - } - } - return size; -} - -static int -_SizeGeomSections(XkbGeometryPtr geom) -{ - register int i, size; - XkbSectionPtr section; - - for (i = size = 0, section = geom->sections; i < geom->num_sections; - i++, section++) { - size += SIZEOF(xkbSectionWireDesc); - if (section->rows) { - int r; - XkbRowPtr row; - - for (r = 0, row = section->rows; r < section->num_rows; row++, r++) { - size += SIZEOF(xkbRowWireDesc); - size += row->num_keys * SIZEOF(xkbKeyWireDesc); - } - } - if (section->doodads) - size += _SizeGeomDoodads(section->num_doodads, section->doodads); - if (section->overlays) { - int o; - XkbOverlayPtr ol; - - for (o = 0, ol = section->overlays; o < section->num_overlays; - o++, ol++) { - int r; - XkbOverlayRowPtr row; - - size += SIZEOF(xkbOverlayWireDesc); - for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { - size += SIZEOF(xkbOverlayRowWireDesc); - size += row->num_keys * SIZEOF(xkbOverlayKeyWireDesc); - } - } - } - } - return size; -} - -static int -_SizeGeomKeyAliases(XkbGeometryPtr geom) -{ - return geom->num_key_aliases * (2 * XkbKeyNameLength); -} - -/***====================================================================***/ - -static char * -_WriteGeomProperties(char *wire, XkbGeometryPtr geom) -{ - register int i; - register XkbPropertyPtr prop; - - for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { - wire = _WriteCountedString(wire, prop->name); - wire = _WriteCountedString(wire, prop->value); - } - return wire; -} - -static char * -_WriteGeomColors(char *wire, XkbGeometryPtr geom) -{ - register int i; - register XkbColorPtr color; - - for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { - wire = _WriteCountedString(wire, color->spec); - } - return wire; -} - -static char * -_WriteGeomShapes(char *wire, XkbGeometryPtr geom) -{ - int i; - XkbShapePtr shape; - xkbShapeWireDesc *shapeWire; - - for (i = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { - register int o; - XkbOutlinePtr ol; - xkbOutlineWireDesc *olWire; - - shapeWire = (xkbShapeWireDesc *) wire; - shapeWire->name = shape->name; - shapeWire->nOutlines = shape->num_outlines; - if (shape->primary != NULL) - shapeWire->primaryNdx = XkbOutlineIndex(shape, shape->primary); - else - shapeWire->primaryNdx = XkbNoShape; - if (shape->approx != NULL) - shapeWire->approxNdx = XkbOutlineIndex(shape, shape->approx); - else - shapeWire->approxNdx = XkbNoShape; - wire = (char *) &shapeWire[1]; - for (o = 0, ol = shape->outlines; o < shape->num_outlines; o++, ol++) { - register int p; - XkbPointPtr pt; - xkbPointWireDesc *ptWire; - - olWire = (xkbOutlineWireDesc *) wire; - olWire->nPoints = ol->num_points; - olWire->cornerRadius = ol->corner_radius; - wire = (char *) &olWire[1]; - ptWire = (xkbPointWireDesc *) wire; - for (p = 0, pt = ol->points; p < ol->num_points; p++, pt++) { - ptWire[p].x = pt->x; - ptWire[p].y = pt->y; - } - wire = (char *) &ptWire[ol->num_points]; - } - } - return wire; -} - -static char * -_WriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad) -{ - register int i; - - for (i = 0; i < num_doodads; i++, doodad++) { - xkbDoodadWireDesc *doodadWire = (xkbDoodadWireDesc *) wire; - - wire = (char *) &doodadWire[1]; - bzero(doodadWire, SIZEOF(xkbDoodadWireDesc)); - doodadWire->any.name = doodad->any.name; - doodadWire->any.type = doodad->any.type; - doodadWire->any.priority = doodad->any.priority; - doodadWire->any.top = doodad->any.top; - doodadWire->any.left = doodad->any.left; - doodadWire->any.angle = doodad->any.angle; - switch (doodad->any.type) { - case XkbOutlineDoodad: - case XkbSolidDoodad: - doodadWire->shape.colorNdx = doodad->shape.color_ndx; - doodadWire->shape.shapeNdx = doodad->shape.shape_ndx; - break; - case XkbTextDoodad: - doodadWire->text.width = doodad->text.width; - doodadWire->text.height = doodad->text.height; - doodadWire->text.colorNdx = doodad->text.color_ndx; - wire = _WriteCountedString(wire, doodad->text.text); - wire = _WriteCountedString(wire, doodad->text.font); - break; - case XkbIndicatorDoodad: - doodadWire->indicator.shapeNdx = doodad->indicator.shape_ndx; - doodadWire->indicator.onColorNdx = doodad->indicator.on_color_ndx; - doodadWire->indicator.offColorNdx = doodad->indicator.off_color_ndx; - break; - case XkbLogoDoodad: - doodadWire->logo.colorNdx = doodad->logo.color_ndx; - doodadWire->logo.shapeNdx = doodad->logo.shape_ndx; - wire = _WriteCountedString(wire, doodad->logo.logo_name); - break; - default: - break; - } - } - return wire; -} - -static char * -_WriteGeomOverlay(char *wire, XkbOverlayPtr ol) -{ - register int r; - XkbOverlayRowPtr row; - xkbOverlayWireDesc *olWire = (xkbOverlayWireDesc *) wire; - - olWire->name = ol->name; - olWire->nRows = ol->num_rows; - wire = (char *) &olWire[1]; - for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { - unsigned int k; - XkbOverlayKeyPtr key; - xkbOverlayRowWireDesc *rowWire = (xkbOverlayRowWireDesc *) wire; - - rowWire->rowUnder = row->row_under; - rowWire->nKeys = row->num_keys; - wire = (char *) &rowWire[1]; - for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { - xkbOverlayKeyWireDesc *keyWire = (xkbOverlayKeyWireDesc *) wire; - - memcpy(keyWire->over, key->over.name, XkbKeyNameLength); - memcpy(keyWire->under, key->under.name, XkbKeyNameLength); - wire = (char *) &keyWire[1]; - } - } - return wire; -} - -static char * -_WriteGeomSections(char *wire, XkbGeometryPtr geom) -{ - register int i; - XkbSectionPtr section; - - for (i = 0, section = geom->sections; i < geom->num_sections; - i++, section++) { - xkbSectionWireDesc *sectionWire = (xkbSectionWireDesc *) wire; - - sectionWire->name = section->name; - sectionWire->top = section->top; - sectionWire->left = section->left; - sectionWire->width = section->width; - sectionWire->height = section->height; - sectionWire->angle = section->angle; - sectionWire->priority = section->priority; - sectionWire->nRows = section->num_rows; - sectionWire->nDoodads = section->num_doodads; - sectionWire->nOverlays = section->num_overlays; - sectionWire->pad = 0; - wire = (char *) §ionWire[1]; - if (section->rows) { - int r; - XkbRowPtr row; - - for (r = 0, row = section->rows; r < section->num_rows; r++, row++) { - xkbRowWireDesc *rowWire = (xkbRowWireDesc *) wire; - - rowWire->top = row->top; - rowWire->left = row->left; - rowWire->nKeys = row->num_keys; - rowWire->vertical = row->vertical; - rowWire->pad = 0; - wire = (char *) &rowWire[1]; - if (row->keys) { - int k; - XkbKeyPtr key; - xkbKeyWireDesc *keyWire = (xkbKeyWireDesc *) wire; - - for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { - memcpy(keyWire[k].name, key->name.name, - XkbKeyNameLength); - keyWire[k].gap = key->gap; - keyWire[k].shapeNdx = key->shape_ndx; - keyWire[k].colorNdx = key->color_ndx; - } - wire = (char *) &keyWire[row->num_keys]; - } - } - } - if (section->doodads) { - wire = _WriteGeomDoodads(wire, - section->num_doodads, section->doodads); - } - if (section->overlays) { - register int o; - - for (o = 0; o < section->num_overlays; o++) { - wire = _WriteGeomOverlay(wire, §ion->overlays[o]); - } - } - } - return wire; -} - -static char * -_WriteGeomKeyAliases(char *wire, XkbGeometryPtr geom) -{ - register int sz; - - sz = geom->num_key_aliases * (XkbKeyNameLength * 2); - if (sz > 0) { - memcpy(wire, (char *) geom->key_aliases, sz); - wire += sz; - } - return wire; -} - -/***====================================================================***/ - -static Status -_SendSetGeometry(Display *dpy, XkbGeometryPtr geom, xkbSetGeometryReq *req) -{ - int sz; - char *wire, *tbuf; - - sz = 0; - sz += _SizeCountedString(geom->label_font); - sz += _SizeGeomProperties(geom); - sz += _SizeGeomColors(geom); - sz += _SizeGeomShapes(geom); - sz += _SizeGeomSections(geom); - sz += _SizeGeomDoodads(geom->num_doodads, geom->doodads); - sz += _SizeGeomKeyAliases(geom); - req->length += (sz / 4); - if (sz < (dpy->bufmax - dpy->buffer)) { - BufAlloc(char *, wire, sz); - tbuf = NULL; - } - else { - tbuf = _XAllocTemp(dpy, sz); - if (!tbuf) - return BadAlloc; - wire = tbuf; - } - wire = _WriteCountedString(wire, geom->label_font); - if (geom->num_properties > 0) - wire = _WriteGeomProperties(wire, geom); - if (geom->num_colors > 0) - wire = _WriteGeomColors(wire, geom); - if (geom->num_shapes > 0) - wire = _WriteGeomShapes(wire, geom); - if (geom->num_sections > 0) - wire = _WriteGeomSections(wire, geom); - if (geom->num_doodads > 0) - wire = _WriteGeomDoodads(wire, geom->num_doodads, geom->doodads); - if (geom->num_key_aliases > 0) - wire = _WriteGeomKeyAliases(wire, geom); - if (tbuf != NULL) { - Data(dpy, tbuf, sz); - _XFreeTemp(dpy, tbuf, sz); - } - return Success; -} - -/***====================================================================***/ - -Status -XkbSetGeometry(Display *dpy, unsigned deviceSpec, XkbGeometryPtr geom) -{ - xkbSetGeometryReq *req; - Status ret; - - if ((!geom) || (dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - - LockDisplay(dpy); - GetReq(kbSetGeometry, req); - req->reqType = dpy->xkb_info->codes->major_opcode; - req->xkbReqType = X_kbSetGeometry; - req->deviceSpec = deviceSpec; - req->nShapes = geom->num_shapes; - req->nSections = geom->num_sections; - req->name = geom->name; - req->widthMM = geom->width_mm; - req->heightMM = geom->height_mm; - req->nProperties = geom->num_properties; - req->nColors = geom->num_colors; - req->nDoodads = geom->num_doodads; - req->nKeyAliases = geom->num_key_aliases; - req->baseColorNdx = (geom->base_color - geom->colors); - req->labelColorNdx = (geom->label_color - geom->colors); - - ret = _SendSetGeometry(dpy, geom, req); - UnlockDisplay(dpy); - SyncHandle(); - return ret; -} diff --git a/nx-X11/lib/X11/XKBSetMap.c b/nx-X11/lib/X11/XKBSetMap.c deleted file mode 100644 index cb696105c..000000000 --- a/nx-X11/lib/X11/XKBSetMap.c +++ /dev/null @@ -1,598 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -static int -_XkbSizeKeyTypes(XkbDescPtr xkb, xkbSetMapReq *req) -{ - XkbKeyTypePtr map; - int i, len; - - if (((req->present & XkbKeyTypesMask) == 0) || (req->nTypes == 0)) { - req->present &= ~XkbKeyTypesMask; - req->firstType = req->nTypes = 0; - return 0; - } - len = 0; - map = &xkb->map->types[req->firstType]; - for (i = 0; i < req->nTypes; i++, map++) { - len += SIZEOF(xkbKeyTypeWireDesc); - len += map->map_count * SIZEOF(xkbKTSetMapEntryWireDesc); - if (map->preserve) - len += map->map_count * SIZEOF(xkbModsWireDesc); - } - return len; -} - -static void -_XkbWriteKeyTypes(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - char *buf; - XkbKeyTypePtr type; - int i, n; - xkbKeyTypeWireDesc *desc; - - if ((req->present & XkbKeyTypesMask) == 0) - return; - type = &xkb->map->types[req->firstType]; - for (i = 0; i < req->nTypes; i++, type++) { - int sz = SIZEOF(xkbKeyTypeWireDesc); - sz += type->map_count * SIZEOF(xkbKTSetMapEntryWireDesc); - if (type->preserve) - sz += type->map_count * SIZEOF(xkbModsWireDesc); - BufAlloc(xkbKeyTypeWireDesc *, desc, sz); - desc->mask = type->mods.mask; - desc->realMods = type->mods.real_mods; - desc->virtualMods = type->mods.vmods; - desc->numLevels = type->num_levels; - desc->nMapEntries = type->map_count; - desc->preserve = (type->preserve != NULL); - buf = (char *) &desc[1]; - if (desc->nMapEntries > 0) { - xkbKTSetMapEntryWireDesc *wire = (xkbKTSetMapEntryWireDesc *) buf; - - for (n = 0; n < type->map_count; n++, wire++) { - wire->level = type->map[n].level; - wire->realMods = type->map[n].mods.real_mods; - wire->virtualMods = type->map[n].mods.vmods; - } - buf = (char *) wire; - if (type->preserve) { - xkbModsWireDesc *pwire = (xkbModsWireDesc *) buf; - - for (n = 0; n < type->map_count; n++, pwire++) { - pwire->realMods = type->preserve[n].real_mods; - pwire->virtualMods = type->preserve[n].vmods; - } - } - } - } - return; -} - -static int -_XkbSizeKeySyms(XkbDescPtr xkb, xkbSetMapReq *req) -{ - int i, len; - unsigned nSyms; - - if (((req->present & XkbKeySymsMask) == 0) || (req->nKeySyms == 0)) { - req->present &= ~XkbKeySymsMask; - req->firstKeySym = req->nKeySyms = 0; - req->totalSyms = 0; - return 0; - } - len = (int) (req->nKeySyms * sizeof(XkbSymMapRec)); - for (i = nSyms = 0; i < req->nKeySyms; i++) { - nSyms += XkbKeyNumSyms(xkb, i + req->firstKeySym); - } - len += nSyms * sizeof(CARD32); - req->totalSyms = nSyms; - return len; -} - -static void -_XkbWriteKeySyms(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - register KeySym *pSym; - CARD32 *outSym; - XkbSymMapPtr symMap; - xkbSymMapWireDesc *desc; - register int i; - - if ((req->present & XkbKeySymsMask) == 0) - return; - symMap = &xkb->map->key_sym_map[req->firstKeySym]; - for (i = 0; i < req->nKeySyms; i++, symMap++) { - BufAlloc(xkbSymMapWireDesc *, desc, - SIZEOF(xkbSymMapWireDesc) + - (XkbKeyNumSyms(xkb, i + req->firstKeySym) * sizeof(CARD32))); - desc->ktIndex[0] = symMap->kt_index[0]; - desc->ktIndex[1] = symMap->kt_index[1]; - desc->ktIndex[2] = symMap->kt_index[2]; - desc->ktIndex[3] = symMap->kt_index[3]; - desc->groupInfo = symMap->group_info; - desc->width = symMap->width; - desc->nSyms = XkbKeyNumSyms(xkb, i + req->firstKeySym); - outSym = (CARD32 *) &desc[1]; - if (desc->nSyms > 0) { - pSym = XkbKeySymsPtr(xkb, i + req->firstKeySym); - _XkbWriteCopyKeySyms(pSym, outSym, desc->nSyms); - } - } - return; -} - -static int -_XkbSizeKeyActions(XkbDescPtr xkb, xkbSetMapReq *req) -{ - int i, len, nActs; - - if (((req->present & XkbKeyActionsMask) == 0) || (req->nKeyActs == 0)) { - req->present &= ~XkbKeyActionsMask; - req->firstKeyAct = req->nKeyActs = 0; - req->totalActs = 0; - return 0; - } - for (nActs = i = 0; i < req->nKeyActs; i++) { - if (xkb->server->key_acts[i + req->firstKeyAct] != 0) - nActs += XkbKeyNumActions(xkb, i + req->firstKeyAct); - } - len = XkbPaddedSize(req->nKeyActs) + (nActs * SIZEOF(xkbActionWireDesc)); - req->totalActs = nActs; - return len; -} - -static void -_XkbWriteKeyActions(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i; - int n; - CARD8 *numDesc; - XkbAction *actDesc; - - if ((req->present & XkbKeyActionsMask) == 0) - return; - n = XkbPaddedSize(req->nKeyActs); - n += (req->totalActs * SIZEOF(xkbActionWireDesc)); - - BufAlloc(CARD8 *, numDesc, n); - for (i = 0; i < req->nKeyActs; i++) { - if (xkb->server->key_acts[i + req->firstKeyAct] == 0) - numDesc[i] = 0; - else - numDesc[i] = XkbKeyNumActions(xkb, (i + req->firstKeyAct)); - } - actDesc = (XkbAction *) &numDesc[XkbPaddedSize(req->nKeyActs)]; - for (i = 0; i < req->nKeyActs; i++) { - if (xkb->server->key_acts[i + req->firstKeyAct] != 0) { - n = XkbKeyNumActions(xkb, (i + req->firstKeyAct)); - memcpy(actDesc, XkbKeyActionsPtr(xkb, (i + req->firstKeyAct)), - n * SIZEOF(xkbActionWireDesc)); - actDesc += n; - } - } - return; -} - -static int -_XkbSizeKeyBehaviors(XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last, nFound; - - if (((req->present & XkbKeyBehaviorsMask) == 0) || (req->nKeyBehaviors < 1)) { - req->present &= ~XkbKeyBehaviorsMask; - req->firstKeyBehavior = req->nKeyBehaviors = 0; - req->totalKeyBehaviors = 0; - return 0; - } - first = req->firstKeyBehavior; - last = first + req->nKeyBehaviors - 1; - for (i = first, nFound = 0; i <= last; i++) { - if (xkb->server->behaviors[i].type != XkbKB_Default) - nFound++; - } - req->totalKeyBehaviors = nFound; - return (nFound * SIZEOF(xkbBehaviorWireDesc)); -} - -static void -_XkbWriteKeyBehaviors(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last; - xkbBehaviorWireDesc *wire; - char *buf; - - if ((req->present & XkbKeyBehaviorsMask) == 0) - return; - first = req->firstKeyBehavior; - last = first + req->nKeyBehaviors - 1; - - i = req->totalKeyBehaviors * SIZEOF(xkbBehaviorWireDesc); - BufAlloc(char *, buf, i); - wire = (xkbBehaviorWireDesc *) buf; - for (i = first; i <= last; i++) { - if (xkb->server->behaviors[i].type != XkbKB_Default) { - wire->key = i; - wire->type = xkb->server->behaviors[i].type; - wire->data = xkb->server->behaviors[i].data; - buf += SIZEOF(xkbBehaviorWireDesc); - wire = (xkbBehaviorWireDesc *) buf; - } - } - return; -} - -static unsigned -_XkbSizeVirtualMods(xkbSetMapReq *req) -{ - register int i, bit, nMods; - - if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0)) { - req->present &= ~XkbVirtualModsMask; - req->virtualMods = 0; - return 0; - } - for (i = nMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if (req->virtualMods & bit) - nMods++; - } - return XkbPaddedSize(nMods); -} - -static void -_XkbWriteVirtualMods(Display *dpy, - XkbDescPtr xkb, - xkbSetMapReq *req, - unsigned size) -{ - register int i, bit; - CARD8 *vmods; - - /* This was req->present&XkbVirtualModsMask==0, and '==' beats '&' */ - if (((req->present & XkbVirtualModsMask) == 0) || (size < 1)) - return; - BufAlloc(CARD8 *, vmods, size); - for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { - if (req->virtualMods & bit) - *vmods++ = xkb->server->vmods[i]; - } - return; -} - -static int -_XkbSizeKeyExplicit(XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last, nFound; - - if (((req->present & XkbExplicitComponentsMask) == 0) || - (req->nKeyExplicit == 0)) { - req->present &= ~XkbExplicitComponentsMask; - req->firstKeyExplicit = req->nKeyExplicit = 0; - req->totalKeyExplicit = 0; - return 0; - } - first = req->firstKeyExplicit; - last = first + req->nKeyExplicit - 1; - - for (i = first, nFound = 0; i <= last; i++) { - if (xkb->server->explicit[i] != 0) - nFound++; - } - req->totalKeyExplicit = nFound; - return XkbPaddedSize((nFound * 2)); -} - -static void -_XkbWriteKeyExplicit(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last; - CARD8 *wire; - - if ((req->present & XkbExplicitComponentsMask) == 0) - return; - first = req->firstKeyExplicit; - last = first + req->nKeyExplicit - 1; - i = XkbPaddedSize((req->totalKeyExplicit * 2)); - BufAlloc(CARD8 *, wire, i); - for (i = first; i <= last; i++) { - if (xkb->server->explicit[i] != 0) { - wire[0] = i; - wire[1] = xkb->server->explicit[i]; - wire += 2; - } - } - return; -} - -static int -_XkbSizeModifierMap(XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last, nFound; - - if (((req->present & XkbModifierMapMask) == 0) || (req->nModMapKeys == 0)) { - req->present &= ~XkbModifierMapMask; - req->firstModMapKey = req->nModMapKeys = 0; - req->totalModMapKeys = 0; - return 0; - } - first = req->firstModMapKey; - last = first + req->nModMapKeys - 1; - - for (i = first, nFound = 0; i <= last; i++) { - if (xkb->map->modmap[i] != 0) - nFound++; - } - req->totalModMapKeys = nFound; - return XkbPaddedSize((nFound * 2)); -} - -static void -_XkbWriteModifierMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last; - CARD8 *wire; - - if ((req->present & XkbModifierMapMask) == 0) - return; - first = req->firstModMapKey; - last = first + req->nModMapKeys - 1; - if (req->totalModMapKeys > 0) { - i = XkbPaddedSize((req->totalModMapKeys * 2)); - BufAlloc(CARD8 *, wire, i); - - for (i = first; i <= last; i++) { - if (xkb->map->modmap[i] != 0) { - wire[0] = i; - wire[1] = xkb->map->modmap[i]; - wire += 2; - } - } - } - return; -} - -static int -_XkbSizeVirtualModMap(XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last, nFound; - - if (((req->present & XkbVirtualModMapMask) == 0) || - (req->nVModMapKeys == 0)) { - req->present &= ~XkbVirtualModMapMask; - req->firstVModMapKey = req->nVModMapKeys = 0; - req->totalVModMapKeys = 0; - return 0; - } - first = req->firstVModMapKey; - last = first + req->nVModMapKeys - 1; - - for (i = first, nFound = 0; i <= last; i++) { - if (xkb->server->vmodmap[i] != 0) - nFound++; - } - req->totalVModMapKeys = nFound; - return nFound * SIZEOF(xkbVModMapWireDesc); -} - -static void -_XkbWriteVirtualModMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - register int i, first, last; - xkbVModMapWireDesc *wire; - - if ((req->present & XkbVirtualModMapMask) == 0) - return; - first = req->firstVModMapKey; - last = first + req->nVModMapKeys - 1; - if (req->totalVModMapKeys > 0) { - i = req->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); - BufAlloc(xkbVModMapWireDesc *, wire, i); - for (i = first; i <= last; i++) { - if (xkb->server->vmodmap[i] != 0) { - wire->key = i; - wire->vmods = xkb->server->vmodmap[i]; - wire++; - } - } - } - return; -} - -static void -SendSetMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) -{ - xkbSetMapReq tmp; - unsigned szMods; - - req->length += _XkbSizeKeyTypes(xkb, req) / 4; - req->length += _XkbSizeKeySyms(xkb, req) / 4; - req->length += _XkbSizeKeyActions(xkb, req) / 4; - req->length += _XkbSizeKeyBehaviors(xkb, req) / 4; - szMods = _XkbSizeVirtualMods(req); - req->length += szMods / 4; - req->length += _XkbSizeKeyExplicit(xkb, req) / 4; - req->length += _XkbSizeModifierMap(xkb, req) / 4; - req->length += _XkbSizeVirtualModMap(xkb, req) / 4; - - tmp = *req; - if (tmp.nTypes > 0) - _XkbWriteKeyTypes(dpy, xkb, &tmp); - if (tmp.nKeySyms > 0) - _XkbWriteKeySyms(dpy, xkb, &tmp); - if (tmp.nKeyActs) - _XkbWriteKeyActions(dpy, xkb, &tmp); - if (tmp.totalKeyBehaviors > 0) - _XkbWriteKeyBehaviors(dpy, xkb, &tmp); - if (tmp.virtualMods) - _XkbWriteVirtualMods(dpy, xkb, &tmp, szMods); - if (tmp.totalKeyExplicit > 0) - _XkbWriteKeyExplicit(dpy, xkb, &tmp); - if (tmp.totalModMapKeys > 0) - _XkbWriteModifierMap(dpy, xkb, &tmp); - if (tmp.totalVModMapKeys > 0) - _XkbWriteVirtualModMap(dpy, xkb, &tmp); - return; -} - -Bool -XkbSetMap(Display *dpy, unsigned which, XkbDescPtr xkb) -{ - register xkbSetMapReq *req; - XkbInfoPtr xkbi; - XkbServerMapPtr srv; - XkbClientMapPtr map; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (!xkb)) - return False; - map = xkb->map; - srv = xkb->server; - - if (((which & XkbKeyTypesMask) && ((!map) || (!map->types))) || - ((which & XkbKeySymsMask) && - ((!map) || (!map->syms) || (!map->key_sym_map))) || - ((which & XkbKeyActionsMask) && ((!srv) || (!srv->key_acts))) || - ((which & XkbKeyBehaviorsMask) && ((!srv) || (!srv->behaviors))) || - ((which & XkbVirtualModsMask) && (!srv)) || - ((which & XkbExplicitComponentsMask) && ((!srv) || (!srv->explicit))) || - ((which & XkbModifierMapMask) && ((!map) || (!map->modmap))) || - ((which & XkbVirtualModMapMask) && ((!srv) || (!srv->vmodmap)))) - return False; - - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetMap, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetMap; - req->deviceSpec = xkb->device_spec; - req->present = which; - req->flags = XkbSetMapAllFlags; - req->minKeyCode = xkb->min_key_code; - req->maxKeyCode = xkb->max_key_code; - req->firstType = 0; - if (which & XkbKeyTypesMask) - req->nTypes = map->num_types; - else - req->nTypes = 0; - if (which & XkbKeySymsMask) { - req->firstKeySym = xkb->min_key_code; - req->nKeySyms = XkbNumKeys(xkb); - } - if (which & XkbKeyActionsMask) { - req->firstKeyAct = xkb->min_key_code; - req->nKeyActs = XkbNumKeys(xkb); - } - if (which & XkbKeyBehaviorsMask) { - req->firstKeyBehavior = xkb->min_key_code; - req->nKeyBehaviors = XkbNumKeys(xkb); - } - if (which & XkbVirtualModsMask) - req->virtualMods = ~0; - if (which & XkbExplicitComponentsMask) { - req->firstKeyExplicit = xkb->min_key_code; - req->nKeyExplicit = XkbNumKeys(xkb); - } - if (which & XkbModifierMapMask) { - req->firstModMapKey = xkb->min_key_code; - req->nModMapKeys = XkbNumKeys(xkb); - } - if (which & XkbVirtualModMapMask) { - req->firstVModMapKey = xkb->min_key_code; - req->nVModMapKeys = XkbNumKeys(xkb); - } - SendSetMap(dpy, xkb, req); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbChangeMap(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) -{ - register xkbSetMapReq *req; - XkbInfoPtr xkbi; - XkbServerMapPtr srv; - XkbClientMapPtr map; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || - (!xkb) || (!changes)) - return False; - srv = xkb->server; - map = xkb->map; - - if (((changes->changed & XkbKeyTypesMask) && ((!map) || (!map->types))) || - ((changes->changed & XkbKeySymsMask) && ((!map) || (!map->syms) || - (!map->key_sym_map))) || - ((changes->changed & XkbKeyActionsMask) && ((!srv) || (!srv->key_acts))) - || ((changes->changed & XkbKeyBehaviorsMask) && - ((!srv) || (!srv->behaviors))) || - ((changes->changed & XkbVirtualModsMask) && (!srv)) || - ((changes->changed & XkbExplicitComponentsMask) && - ((!srv) || (!srv->explicit))) || - ((changes->changed & XkbModifierMapMask) && ((!map) || (!map->modmap))) - || ((changes->changed & XkbVirtualModMapMask) && - ((!srv) || (!srv->vmodmap)))) - return False; - - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetMap, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetMap; - req->deviceSpec = xkb->device_spec; - req->present = changes->changed; - req->flags = XkbSetMapRecomputeActions; - req->minKeyCode = xkb->min_key_code; - req->maxKeyCode = xkb->max_key_code; - req->firstType = changes->first_type; - req->nTypes = changes->num_types; - req->firstKeySym = changes->first_key_sym; - req->nKeySyms = changes->num_key_syms; - req->firstKeyAct = changes->first_key_act; - req->nKeyActs = changes->num_key_acts; - req->firstKeyBehavior = changes->first_key_behavior; - req->nKeyBehaviors = changes->num_key_behaviors; - req->virtualMods = changes->vmods; - req->firstKeyExplicit = changes->first_key_explicit; - req->nKeyExplicit = changes->num_key_explicit; - req->firstModMapKey = changes->first_modmap_key; - req->nModMapKeys = changes->num_modmap_keys; - req->firstVModMapKey = changes->first_vmodmap_key; - req->nVModMapKeys = changes->num_vmodmap_keys; - SendSetMap(dpy, xkb, req); - UnlockDisplay(dpy); - SyncHandle(); - return True; -} diff --git a/nx-X11/lib/X11/XKBUse.c b/nx-X11/lib/X11/XKBUse.c deleted file mode 100644 index cf6497551..000000000 --- a/nx-X11/lib/X11/XKBUse.c +++ /dev/null @@ -1,814 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -static Bool _XkbIgnoreExtension = False; - -void -XkbNoteMapChanges(XkbMapChangesPtr old, - XkbMapNotifyEvent *new, - unsigned wanted) -{ - int first, oldLast, newLast; - - wanted &= new->changed; - - if (wanted & XkbKeyTypesMask) { - if (old->changed & XkbKeyTypesMask) { - first = old->first_type; - oldLast = old->first_type + old->num_types - 1; - newLast = new->first_type + new->num_types - 1; - - if (new->first_type < first) - first = new->first_type; - if (oldLast > newLast) - newLast = oldLast; - old->first_type = first; - old->num_types = newLast - first + 1; - } - else { - old->first_type = new->first_type; - old->num_types = new->num_types; - } - } - if (wanted & XkbKeySymsMask) { - if (old->changed & XkbKeySymsMask) { - first = old->first_key_sym; - oldLast = old->first_key_sym + old->num_key_syms - 1; - newLast = new->first_key_sym + new->num_key_syms - 1; - - if (new->first_key_sym < first) - first = new->first_key_sym; - if (oldLast > newLast) - newLast = oldLast; - old->first_key_sym = first; - old->num_key_syms = newLast - first + 1; - } - else { - old->first_key_sym = new->first_key_sym; - old->num_key_syms = new->num_key_syms; - } - } - if (wanted & XkbKeyActionsMask) { - if (old->changed & XkbKeyActionsMask) { - first = old->first_key_act; - oldLast = old->first_key_act + old->num_key_acts - 1; - newLast = new->first_key_act + new->num_key_acts - 1; - - if (new->first_key_act < first) - first = new->first_key_act; - if (oldLast > newLast) - newLast = oldLast; - old->first_key_act = first; - old->num_key_acts = newLast - first + 1; - } - else { - old->first_key_act = new->first_key_act; - old->num_key_acts = new->num_key_acts; - } - } - if (wanted & XkbKeyBehaviorsMask) { - if (old->changed & XkbKeyBehaviorsMask) { - first = old->first_key_behavior; - oldLast = old->first_key_behavior + old->num_key_behaviors - 1; - newLast = new->first_key_behavior + new->num_key_behaviors - 1; - - if (new->first_key_behavior < first) - first = new->first_key_behavior; - if (oldLast > newLast) - newLast = oldLast; - old->first_key_behavior = first; - old->num_key_behaviors = newLast - first + 1; - } - else { - old->first_key_behavior = new->first_key_behavior; - old->num_key_behaviors = new->num_key_behaviors; - } - } - if (wanted & XkbVirtualModsMask) { - old->vmods |= new->vmods; - } - if (wanted & XkbExplicitComponentsMask) { - if (old->changed & XkbExplicitComponentsMask) { - first = old->first_key_explicit; - oldLast = old->first_key_explicit + old->num_key_explicit - 1; - newLast = new->first_key_explicit + new->num_key_explicit - 1; - - if (new->first_key_explicit < first) - first = new->first_key_explicit; - if (oldLast > newLast) - newLast = oldLast; - old->first_key_explicit = first; - old->num_key_explicit = newLast - first + 1; - } - else { - old->first_key_explicit = new->first_key_explicit; - old->num_key_explicit = new->num_key_explicit; - } - } - if (wanted & XkbModifierMapMask) { - if (old->changed & XkbModifierMapMask) { - first = old->first_modmap_key; - oldLast = old->first_modmap_key + old->num_modmap_keys - 1; - newLast = new->first_modmap_key + new->num_modmap_keys - 1; - - if (new->first_modmap_key < first) - first = new->first_modmap_key; - if (oldLast > newLast) - newLast = oldLast; - old->first_modmap_key = first; - old->num_modmap_keys = newLast - first + 1; - } - else { - old->first_modmap_key = new->first_modmap_key; - old->num_modmap_keys = new->num_modmap_keys; - } - } - if (wanted & XkbVirtualModMapMask) { - if (old->changed & XkbVirtualModMapMask) { - first = old->first_vmodmap_key; - oldLast = old->first_vmodmap_key + old->num_vmodmap_keys - 1; - newLast = new->first_vmodmap_key + new->num_vmodmap_keys - 1; - - if (new->first_vmodmap_key < first) - first = new->first_vmodmap_key; - if (oldLast > newLast) - newLast = oldLast; - old->first_vmodmap_key = first; - old->num_vmodmap_keys = newLast - first + 1; - } - else { - old->first_vmodmap_key = new->first_vmodmap_key; - old->num_vmodmap_keys = new->num_vmodmap_keys; - } - } - old->changed |= wanted; - return; -} - -void -_XkbNoteCoreMapChanges(XkbMapChangesPtr old, - XMappingEvent *new, - unsigned int wanted) -{ - int first, oldLast, newLast; - - if ((new->request == MappingKeyboard) && (wanted & XkbKeySymsMask)) { - if (old->changed & XkbKeySymsMask) { - first = old->first_key_sym; - oldLast = old->first_key_sym + old->num_key_syms - 1; - newLast = new->first_keycode + new->count - 1; - - if (new->first_keycode < first) - first = new->first_keycode; - if (oldLast > newLast) - newLast = oldLast; - old->first_key_sym = first; - old->num_key_syms = newLast - first + 1; - } - else { - old->changed |= XkbKeySymsMask; - old->first_key_sym = new->first_keycode; - old->num_key_syms = new->count; - } - } - return; -} - -static Bool -wire_to_event(Display *dpy, XEvent *re, xEvent *event) -{ - xkbEvent *xkbevent = (xkbEvent *) event; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - xkbi = dpy->xkb_info; - if (((event->u.u.type & 0x7f) - xkbi->codes->first_event) != XkbEventCode) - return False; - - switch (xkbevent->u.any.xkbType) { - case XkbStateNotify: - { - xkbStateNotify *sn = (xkbStateNotify *) event; - - if (xkbi->selected_events & XkbStateNotifyMask) { - XkbStateNotifyEvent *sev = (XkbStateNotifyEvent *) re; - - sev->type = XkbEventCode + xkbi->codes->first_event; - sev->xkb_type = XkbStateNotify; - sev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - sev->send_event = ((event->u.u.type & 0x80) != 0); - sev->display = dpy; - sev->time = sn->time; - sev->device = sn->deviceID; - sev->keycode = sn->keycode; - sev->event_type = sn->eventType; - sev->req_major = sn->requestMajor; - sev->req_minor = sn->requestMinor; - sev->changed = sn->changed; - sev->group = sn->group; - sev->base_group = sn->baseGroup; - sev->latched_group = sn->latchedGroup; - sev->locked_group = sn->lockedGroup; - sev->mods = sn->mods; - sev->base_mods = sn->baseMods; - sev->latched_mods = sn->latchedMods; - sev->locked_mods = sn->lockedMods; - sev->compat_state = sn->compatState; - sev->grab_mods = sn->grabMods; - sev->compat_grab_mods = sn->compatGrabMods; - sev->lookup_mods = sn->lookupMods; - sev->compat_lookup_mods = sn->compatLookupMods; - sev->ptr_buttons = sn->ptrBtnState; - return True; - } - } - break; - case XkbMapNotify: - { - xkbMapNotify *mn = (xkbMapNotify *) event; - - if ((xkbi->selected_events & XkbMapNotifyMask) && - (xkbi->selected_map_details & mn->changed)) { - XkbMapNotifyEvent *mev = (XkbMapNotifyEvent *) re; - - mev->type = XkbEventCode + xkbi->codes->first_event; - mev->xkb_type = XkbMapNotify; - mev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - mev->send_event = ((event->u.u.type & 0x80) != 0); - mev->display = dpy; - mev->time = mn->time; - mev->device = mn->deviceID; - mev->changed = mn->changed; - mev->min_key_code = mn->minKeyCode; - mev->max_key_code = mn->maxKeyCode; - mev->first_type = mn->firstType; - mev->num_types = mn->nTypes; - mev->first_key_sym = mn->firstKeySym; - mev->num_key_syms = mn->nKeySyms; - mev->first_key_act = mn->firstKeyAct; - mev->num_key_acts = mn->nKeyActs; - mev->first_key_behavior = mn->firstKeyBehavior; - mev->num_key_behaviors = mn->nKeyBehaviors; - mev->vmods = mn->virtualMods; - mev->first_key_explicit = mn->firstKeyExplicit; - mev->num_key_explicit = mn->nKeyExplicit; - mev->first_modmap_key = mn->firstModMapKey; - mev->num_modmap_keys = mn->nModMapKeys; - mev->first_vmodmap_key = mn->firstVModMapKey; - mev->num_vmodmap_keys = mn->nVModMapKeys; - XkbNoteMapChanges(&xkbi->changes, mev, XKB_XLIB_MAP_MASK); - if (xkbi->changes.changed) - xkbi->flags |= XkbMapPending; - return True; - } - else if (mn->nKeySyms > 0) { - register XMappingEvent *ev = (XMappingEvent *) re; - - ev->type = MappingNotify; - ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - ev->send_event = ((event->u.u.type & 0x80) != 0); - ev->display = dpy; - ev->window = 0; - ev->first_keycode = mn->firstKeySym; - ev->request = MappingKeyboard; - ev->count = mn->nKeySyms; - _XkbNoteCoreMapChanges(&xkbi->changes, ev, XKB_XLIB_MAP_MASK); - if (xkbi->changes.changed) - xkbi->flags |= XkbMapPending; - return True; - } - } - break; - case XkbControlsNotify: - { - if (xkbi->selected_events & XkbControlsNotifyMask) { - xkbControlsNotify *cn = (xkbControlsNotify *) event; - XkbControlsNotifyEvent *cev = (XkbControlsNotifyEvent *) re; - - cev->type = XkbEventCode + xkbi->codes->first_event; - cev->xkb_type = XkbControlsNotify; - cev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - cev->send_event = ((event->u.u.type & 0x80) != 0); - cev->display = dpy; - cev->time = cn->time; - cev->device = cn->deviceID; - cev->changed_ctrls = cn->changedControls; - cev->enabled_ctrls = cn->enabledControls; - cev->enabled_ctrl_changes = cn->enabledControlChanges; - cev->keycode = cn->keycode; - cev->num_groups = cn->numGroups; - cev->event_type = cn->eventType; - cev->req_major = cn->requestMajor; - cev->req_minor = cn->requestMinor; - return True; - } - } - break; - case XkbIndicatorMapNotify: - { - if (xkbi->selected_events & XkbIndicatorMapNotifyMask) { - xkbIndicatorNotify *in = (xkbIndicatorNotify *) event; - XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re; - - iev->type = XkbEventCode + xkbi->codes->first_event; - iev->xkb_type = XkbIndicatorMapNotify; - iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - iev->send_event = ((event->u.u.type & 0x80) != 0); - iev->display = dpy; - iev->time = in->time; - iev->device = in->deviceID; - iev->changed = in->changed; - iev->state = in->state; - return True; - } - } - break; - case XkbIndicatorStateNotify: - { - if (xkbi->selected_events & XkbIndicatorStateNotifyMask) { - xkbIndicatorNotify *in = (xkbIndicatorNotify *) event; - XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re; - - iev->type = XkbEventCode + xkbi->codes->first_event; - iev->xkb_type = XkbIndicatorStateNotify; - iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - iev->send_event = ((event->u.u.type & 0x80) != 0); - iev->display = dpy; - iev->time = in->time; - iev->device = in->deviceID; - iev->changed = in->changed; - iev->state = in->state; - return True; - } - } - break; - case XkbBellNotify: - { - if (xkbi->selected_events & XkbBellNotifyMask) { - xkbBellNotify *bn = (xkbBellNotify *) event; - XkbBellNotifyEvent *bev = (XkbBellNotifyEvent *) re; - - bev->type = XkbEventCode + xkbi->codes->first_event; - bev->xkb_type = XkbBellNotify; - bev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - bev->send_event = ((event->u.u.type & 0x80) != 0); - bev->display = dpy; - bev->time = bn->time; - bev->device = bn->deviceID; - bev->percent = bn->percent; - bev->pitch = bn->pitch; - bev->duration = bn->duration; - bev->bell_class = bn->bellClass; - bev->bell_id = bn->bellID; - bev->name = bn->name; - bev->window = bn->window; - bev->event_only = bn->eventOnly; - return True; - } - } - break; - case XkbAccessXNotify: - { - if (xkbi->selected_events & XkbAccessXNotifyMask) { - xkbAccessXNotify *axn = (xkbAccessXNotify *) event; - XkbAccessXNotifyEvent *axev = (XkbAccessXNotifyEvent *) re; - - axev->type = XkbEventCode + xkbi->codes->first_event; - axev->xkb_type = XkbAccessXNotify; - axev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - axev->send_event = ((event->u.u.type & 0x80) != 0); - axev->display = dpy; - axev->time = axn->time; - axev->device = axn->deviceID; - axev->detail = axn->detail; - axev->keycode = axn->keycode; - axev->sk_delay = axn->slowKeysDelay; - axev->debounce_delay = axn->debounceDelay; - return True; - } - } - break; - case XkbNamesNotify: - { - if (xkbi->selected_events & XkbNamesNotifyMask) { - xkbNamesNotify *nn = (xkbNamesNotify *) event; - XkbNamesNotifyEvent *nev = (XkbNamesNotifyEvent *) re; - - nev->type = XkbEventCode + xkbi->codes->first_event; - nev->xkb_type = XkbNamesNotify; - nev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - nev->send_event = ((event->u.u.type & 0x80) != 0); - nev->display = dpy; - nev->time = nn->time; - nev->device = nn->deviceID; - nev->changed = nn->changed; - nev->first_type = nn->firstType; - nev->num_types = nn->nTypes; - nev->first_lvl = nn->firstLevelName; - nev->num_lvls = nn->nLevelNames; - nev->num_aliases = nn->nAliases; - nev->num_radio_groups = nn->nRadioGroups; - nev->changed_vmods = nn->changedVirtualMods; - nev->changed_groups = nn->changedGroupNames; - nev->changed_indicators = nn->changedIndicators; - nev->first_key = nn->firstKey; - nev->num_keys = nn->nKeys; - return True; - } - } - break; - case XkbCompatMapNotify: - { - if (xkbi->selected_events & XkbCompatMapNotifyMask) { - xkbCompatMapNotify *cmn = (xkbCompatMapNotify *) event; - XkbCompatMapNotifyEvent *cmev = (XkbCompatMapNotifyEvent *) re; - - cmev->type = XkbEventCode + xkbi->codes->first_event; - cmev->xkb_type = XkbCompatMapNotify; - cmev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - cmev->send_event = ((event->u.u.type & 0x80) != 0); - cmev->display = dpy; - cmev->time = cmn->time; - cmev->device = cmn->deviceID; - cmev->changed_groups = cmn->changedGroups; - cmev->first_si = cmn->firstSI; - cmev->num_si = cmn->nSI; - cmev->num_total_si = cmn->nTotalSI; - return True; - } - } - break; - case XkbActionMessage: - { - if (xkbi->selected_events & XkbActionMessageMask) { - xkbActionMessage *am = (xkbActionMessage *) event; - XkbActionMessageEvent *amev = (XkbActionMessageEvent *) re; - - amev->type = XkbEventCode + xkbi->codes->first_event; - amev->xkb_type = XkbActionMessage; - amev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - amev->send_event = ((event->u.u.type & 0x80) != 0); - amev->display = dpy; - amev->time = am->time; - amev->device = am->deviceID; - amev->keycode = am->keycode; - amev->press = am->press; - amev->key_event_follows = am->keyEventFollows; - amev->group = am->group; - amev->mods = am->mods; - memcpy(amev->message, am->message, XkbActionMessageLength); - amev->message[XkbActionMessageLength] = '\0'; - return True; - } - } - break; - case XkbExtensionDeviceNotify: - { - if (xkbi->selected_events & XkbExtensionDeviceNotifyMask) { - xkbExtensionDeviceNotify *ed = (xkbExtensionDeviceNotify *) event; - XkbExtensionDeviceNotifyEvent *edev - = (XkbExtensionDeviceNotifyEvent *) re; - - edev->type = XkbEventCode + xkbi->codes->first_event; - edev->xkb_type = XkbExtensionDeviceNotify; - edev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - edev->send_event = ((event->u.u.type & 0x80) != 0); - edev->display = dpy; - edev->time = ed->time; - edev->device = ed->deviceID; - edev->led_class = ed->ledClass; - edev->led_id = ed->ledID; - edev->reason = ed->reason; - edev->supported = ed->supported; - edev->leds_defined = ed->ledsDefined; - edev->led_state = ed->ledState; - edev->first_btn = ed->firstBtn; - edev->num_btns = ed->nBtns; - edev->unsupported = ed->unsupported; - return True; - } - } - break; - case XkbNewKeyboardNotify: - { - xkbNewKeyboardNotify *nkn = (xkbNewKeyboardNotify *) event; - - if ((xkbi->selected_events & XkbNewKeyboardNotifyMask) && - (xkbi->selected_nkn_details & nkn->changed)) { - XkbNewKeyboardNotifyEvent *nkev = (XkbNewKeyboardNotifyEvent *) re; - - nkev->type = XkbEventCode + xkbi->codes->first_event; - nkev->xkb_type = XkbNewKeyboardNotify; - nkev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - nkev->send_event = ((event->u.u.type & 0x80) != 0); - nkev->display = dpy; - nkev->time = nkn->time; - nkev->device = nkn->deviceID; - nkev->old_device = nkn->oldDeviceID; - nkev->min_key_code = nkn->minKeyCode; - nkev->max_key_code = nkn->maxKeyCode; - nkev->old_min_key_code = nkn->oldMinKeyCode; - nkev->old_max_key_code = nkn->oldMaxKeyCode; - nkev->req_major = nkn->requestMajor; - nkev->req_minor = nkn->requestMinor; - nkev->changed = nkn->changed; - if ((xkbi->desc) && (nkev->send_event == 0) && - ((xkbi->desc->device_spec == nkev->old_device) || - (nkev->device != nkev->old_device))) { - xkbi->flags = XkbMapPending | XkbXlibNewKeyboard; - } - return True; - } - else if (nkn->changed & (XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask)) { - register XMappingEvent *ev = (XMappingEvent *) re; - - ev->type = MappingNotify; - ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); - ev->send_event = ((event->u.u.type & 0x80) != 0); - ev->display = dpy; - ev->window = 0; - ev->first_keycode = dpy->min_keycode; - ev->request = MappingKeyboard; - ev->count = (dpy->max_keycode - dpy->min_keycode) + 1; - if ((xkbi->desc) && (ev->send_event == 0) && - ((xkbi->desc->device_spec == nkn->oldDeviceID) || - (nkn->deviceID != nkn->oldDeviceID))) { - xkbi->flags |= XkbMapPending | XkbXlibNewKeyboard; - } - return True; - } - } - break; - default: -#ifdef DEBUG - fprintf(stderr, "Got unknown XKEYBOARD event (%d, base=%d)\n", - re->type, xkbi->codes->first_event); -#endif - break; - } - return False; -} - -Bool -XkbIgnoreExtension(Bool ignore) -{ - if (getenv("XKB_FORCE") != NULL) { -#ifdef DEBUG - fprintf(stderr, - "Forcing use of XKEYBOARD (overriding an IgnoreExtensions)\n"); -#endif - return False; - } -#ifdef DEBUG - else if (getenv("XKB_DEBUG") != NULL) { - fprintf(stderr, "Explicitly %signoring XKEYBOARD\n", - ignore ? "" : "not "); - } -#endif - _XkbIgnoreExtension = ignore; - return True; -} - -static void -_XkbFreeInfo(Display *dpy) -{ - XkbInfoPtr xkbi = dpy->xkb_info; - - if (xkbi) { - if (xkbi->desc) - XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); - Xfree(xkbi); - } -} - -Bool -XkbUseExtension(Display *dpy, int *major_rtrn, int *minor_rtrn) -{ - xkbUseExtensionReply rep; - register xkbUseExtensionReq *req; - XExtCodes *codes; - int ev_base, forceIgnore; - XkbInfoPtr xkbi; - char *str; - static int debugMsg; - static int been_here = 0; - - if (dpy->xkb_info && !(dpy->flags & XlibDisplayNoXkb)) { - if (major_rtrn) - *major_rtrn = dpy->xkb_info->srv_major; - if (minor_rtrn) - *minor_rtrn = dpy->xkb_info->srv_minor; - return True; - } - if (!been_here) { - debugMsg = (getenv("XKB_DEBUG") != NULL); - been_here = 1; - } - - if (major_rtrn) - *major_rtrn = 0; - if (minor_rtrn) - *minor_rtrn = 0; - - if (!dpy->xkb_info) { - xkbi = _XkbTypedCalloc(1, XkbInfoRec); - if (!xkbi) - return False; - dpy->xkb_info = xkbi; - dpy->free_funcs->xkb = _XkbFreeInfo; - - xkbi->xlib_ctrls |= (XkbLC_ControlFallback | XkbLC_ConsumeLookupMods); - if ((str = getenv("_XKB_OPTIONS_ENABLE")) != NULL) { - if ((str = getenv("_XKB_LATIN1_LOOKUP")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_ForceLatin1Lookup; - else - xkbi->xlib_ctrls |= XkbLC_ForceLatin1Lookup; - } - if ((str = getenv("_XKB_CONSUME_LOOKUP_MODS")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_ConsumeLookupMods; - else - xkbi->xlib_ctrls |= XkbLC_ConsumeLookupMods; - } - if ((str = getenv("_XKB_CONSUME_SHIFT_AND_LOCK")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_AlwaysConsumeShiftAndLock; - else - xkbi->xlib_ctrls |= XkbLC_AlwaysConsumeShiftAndLock; - } - if ((str = getenv("_XKB_IGNORE_NEW_KEYBOARDS")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_IgnoreNewKeyboards; - else - xkbi->xlib_ctrls |= XkbLC_IgnoreNewKeyboards; - } - if ((str = getenv("_XKB_CONTROL_FALLBACK")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_ControlFallback; - else - xkbi->xlib_ctrls |= XkbLC_ControlFallback; - } - if ((str = getenv("_XKB_COMP_LED")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_ComposeLED; - else { - xkbi->xlib_ctrls |= XkbLC_ComposeLED; - if (strlen(str) > 0) - xkbi->composeLED = XInternAtom(dpy, str, False); - } - } - if ((str = getenv("_XKB_COMP_FAIL_BEEP")) != NULL) { - if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) - xkbi->xlib_ctrls &= ~XkbLC_BeepOnComposeFail; - else - xkbi->xlib_ctrls |= XkbLC_BeepOnComposeFail; - } - } - if ((xkbi->composeLED == None) && - ((xkbi->xlib_ctrls & XkbLC_ComposeLED) != 0)) - xkbi->composeLED = XInternAtom(dpy, "Compose", False); -#ifdef DEBUG - if (debugMsg) { - register unsigned c = xkbi->xlib_ctrls; - - fprintf(stderr, - "XKEYBOARD compose: beep on failure is %s, LED is %s\n", - ((c & XkbLC_BeepOnComposeFail) ? "on" : "off"), - ((c & XkbLC_ComposeLED) ? "on" : "off")); - fprintf(stderr, - "XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n", - ((c & XkbLC_ForceLatin1Lookup) ? "allow non-" : "force "), - ((c & XkbLC_ConsumeLookupMods) ? "consume" : "re-use")); - fprintf(stderr, - "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n", - ((c & XkbLC_AlwaysConsumeShiftAndLock) ? "always " : - "don't "), ((c & XkbLC_ControlFallback) ? "" : "no ")); - - } -#endif - } - else - xkbi = dpy->xkb_info; - - forceIgnore = (dpy->flags & XlibDisplayNoXkb) || dpy->keysyms; - forceIgnore = forceIgnore && (major_rtrn == NULL) && (minor_rtrn == NULL); - if (forceIgnore || _XkbIgnoreExtension || getenv("XKB_DISABLE")) { - LockDisplay(dpy); - dpy->flags |= XlibDisplayNoXkb; - UnlockDisplay(dpy); - if (debugMsg) - fprintf(stderr, "XKEYBOARD extension disabled or missing\n"); - return False; - } - - if ((codes = XInitExtension(dpy, XkbName)) == NULL) { - LockDisplay(dpy); - dpy->flags |= XlibDisplayNoXkb; - UnlockDisplay(dpy); - if (debugMsg) - fprintf(stderr, "XKEYBOARD extension not present\n"); - return False; - } - xkbi->codes = codes; - LockDisplay(dpy); - - GetReq(kbUseExtension, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbUseExtension; - req->wantedMajor = XkbMajorVersion; - req->wantedMinor = XkbMinorVersion; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.supported) { - Bool fail = True; - - if (debugMsg) - fprintf(stderr, - "XKEYBOARD version mismatch (want %d.%02d, got %d.%02d)\n", - XkbMajorVersion, XkbMinorVersion, - rep.serverMajor, rep.serverMinor); - - /* pre-release 0.65 is very close to 1.00 */ - if ((rep.serverMajor == 0) && (rep.serverMinor == 65)) { - if (debugMsg) - fprintf(stderr, "Trying to fall back to version 0.65..."); - GetReq(kbUseExtension, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbUseExtension; - req->wantedMajor = 0; - req->wantedMinor = 65; - if (_XReply(dpy, (xReply *) &rep, 0, xFalse) && rep.supported) { - if (debugMsg) - fprintf(stderr, "succeeded\n"); - fail = False; - } - else if (debugMsg) - fprintf(stderr, "failed\n"); - } - if (fail) { - dpy->flags |= XlibDisplayNoXkb; - UnlockDisplay(dpy); - SyncHandle(); - if (major_rtrn) - *major_rtrn = rep.serverMajor; - if (minor_rtrn) - *minor_rtrn = rep.serverMinor; - return False; - } - } -#ifdef DEBUG - else if (forceIgnore) { - fprintf(stderr, - "Internal Error! XkbUseExtension succeeded with forceIgnore set\n"); - } -#endif - UnlockDisplay(dpy); - xkbi->srv_major = rep.serverMajor; - xkbi->srv_minor = rep.serverMinor; - if (major_rtrn) - *major_rtrn = rep.serverMajor; - if (minor_rtrn) - *minor_rtrn = rep.serverMinor; - if (debugMsg) - fprintf(stderr, "XKEYBOARD (version %d.%02d/%d.%02d) OK!\n", - XkbMajorVersion, XkbMinorVersion, - rep.serverMajor, rep.serverMinor); - - ev_base = codes->first_event; - XESetWireToEvent(dpy, ev_base + XkbEventCode, wire_to_event); - SyncHandle(); - return True; -} diff --git a/nx-X11/lib/X11/XKBleds.c b/nx-X11/lib/X11/XKBleds.c deleted file mode 100644 index c098ee948..000000000 --- a/nx-X11/lib/X11/XKBleds.c +++ /dev/null @@ -1,338 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#define NEED_MAP_READERS -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "XKBlibint.h" - -Status -XkbGetIndicatorState(Display *dpy, unsigned deviceSpec, unsigned *pStateRtrn) -{ - register xkbGetIndicatorStateReq *req; - xkbGetIndicatorStateReply rep; - XkbInfoPtr xkbi; - Bool ok; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbGetIndicatorState, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetIndicatorState; - req->deviceSpec = deviceSpec; - ok = _XReply(dpy, (xReply *) &rep, 0, xFalse); - if (ok && (pStateRtrn != NULL)) - *pStateRtrn = rep.state; - UnlockDisplay(dpy); - SyncHandle(); - return (ok ? Success : BadImplementation); -} - -Status -_XkbReadGetIndicatorMapReply(Display *dpy, - xkbGetIndicatorMapReply *rep, - XkbDescPtr xkb, - int *nread_rtrn) -{ - XkbIndicatorPtr leds; - XkbReadBufferRec buf; - - if ((!xkb->indicators) && (XkbAllocIndicatorMaps(xkb) != Success)) - return BadAlloc; - leds = xkb->indicators; - - leds->phys_indicators = rep->realIndicators; - if (rep->length > 0) { - register int left; - - if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) - return BadAlloc; - if (nread_rtrn) - *nread_rtrn = (int) rep->length * 4; - if (rep->which) { - register int i, bit; - - left = (int) rep->which; - for (i = 0, bit = 1; (i < XkbNumIndicators) && (left); - i++, bit <<= 1) { - if (left & bit) { - xkbIndicatorMapWireDesc *wire; - - wire = (xkbIndicatorMapWireDesc *) - _XkbGetReadBufferPtr(&buf, - SIZEOF(xkbIndicatorMapWireDesc)); - if (wire == NULL) { - _XkbFreeReadBuffer(&buf); - return BadAlloc; - } - leds->maps[i].flags = wire->flags; - leds->maps[i].which_groups = wire->whichGroups; - leds->maps[i].groups = wire->groups; - leds->maps[i].which_mods = wire->whichMods; - leds->maps[i].mods.mask = wire->mods; - leds->maps[i].mods.real_mods = wire->realMods; - leds->maps[i].mods.vmods = wire->virtualMods; - leds->maps[i].ctrls = wire->ctrls; - left &= ~bit; - } - } - } - left = _XkbFreeReadBuffer(&buf); - } - return Success; -} - -Bool -XkbGetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) -{ - register xkbGetIndicatorMapReq *req; - xkbGetIndicatorMapReply rep; - XkbInfoPtr xkbi; - Status status; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return BadAccess; - if ((!which) || (!xkb)) - return BadValue; - - LockDisplay(dpy); - xkbi = dpy->xkb_info; - if (!xkb->indicators) { - xkb->indicators = _XkbTypedCalloc(1, XkbIndicatorRec); - if (!xkb->indicators) { - UnlockDisplay(dpy); - SyncHandle(); - return BadAlloc; - } - } - GetReq(kbGetIndicatorMap, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetIndicatorMap; - req->deviceSpec = xkb->device_spec; - req->which = (CARD32) which; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return BadValue; - } - status = _XkbReadGetIndicatorMapReply(dpy, &rep, xkb, NULL); - UnlockDisplay(dpy); - SyncHandle(); - return status; -} - -Bool -XkbSetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) -{ - register xkbSetIndicatorMapReq *req; - register int i, bit; - int nMaps; - xkbIndicatorMapWireDesc *wire; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - if ((!xkb) || (!which) || (!xkb->indicators)) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetIndicatorMap, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetIndicatorMap; - req->deviceSpec = xkb->device_spec; - req->which = (CARD32) which; - for (i = nMaps = 0, bit = 1; i < 32; i++, bit <<= 1) { - if (which & bit) - nMaps++; - } - req->length += (nMaps * sizeof(XkbIndicatorMapRec)) / 4; - BufAlloc(xkbIndicatorMapWireDesc *, wire, - (nMaps * SIZEOF(xkbIndicatorMapWireDesc))); - for (i = 0, bit = 1; i < 32; i++, bit <<= 1) { - if (which & bit) { - wire->flags = xkb->indicators->maps[i].flags; - wire->whichGroups = xkb->indicators->maps[i].which_groups; - wire->groups = xkb->indicators->maps[i].groups; - wire->whichMods = xkb->indicators->maps[i].which_mods; - wire->mods = xkb->indicators->maps[i].mods.real_mods; - wire->virtualMods = xkb->indicators->maps[i].mods.vmods; - wire->ctrls = xkb->indicators->maps[i].ctrls; - wire++; - } - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbGetNamedDeviceIndicator(Display *dpy, - unsigned device, - unsigned class, - unsigned id, - Atom name, - int *pNdxRtrn, - Bool *pStateRtrn, - XkbIndicatorMapPtr pMapRtrn, - Bool *pRealRtrn) -{ - register xkbGetNamedIndicatorReq *req; - xkbGetNamedIndicatorReply rep; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || (name == None) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbGetNamedIndicator, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbGetNamedIndicator; - req->deviceSpec = device; - req->ledClass = class; - req->ledID = id; - req->indicator = (CARD32) name; - if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { - UnlockDisplay(dpy); - SyncHandle(); - return False; - } - UnlockDisplay(dpy); - SyncHandle(); - if ((!rep.found) || (!rep.supported)) - return False; - if (pNdxRtrn != NULL) - *pNdxRtrn = rep.ndx; - if (pStateRtrn != NULL) - *pStateRtrn = rep.on; - if (pMapRtrn != NULL) { - pMapRtrn->flags = rep.flags; - pMapRtrn->which_groups = rep.whichGroups; - pMapRtrn->groups = rep.groups; - pMapRtrn->which_mods = rep.whichMods; - pMapRtrn->mods.mask = rep.mods; - pMapRtrn->mods.real_mods = rep.realMods; - pMapRtrn->mods.vmods = rep.virtualMods; - pMapRtrn->ctrls = rep.ctrls; - } - if (pRealRtrn != NULL) - *pRealRtrn = rep.realIndicator; - return True; -} - -Bool -XkbGetNamedIndicator(Display *dpy, - Atom name, - int *pNdxRtrn, - Bool *pStateRtrn, - XkbIndicatorMapPtr pMapRtrn, - Bool *pRealRtrn) -{ - return XkbGetNamedDeviceIndicator(dpy, XkbUseCoreKbd, - XkbDfltXIClass, XkbDfltXIId, - name, pNdxRtrn, pStateRtrn, - pMapRtrn, pRealRtrn); -} - -Bool -XkbSetNamedDeviceIndicator(Display *dpy, - unsigned device, - unsigned class, - unsigned id, - Atom name, - Bool changeState, - Bool state, - Bool createNewMap, - XkbIndicatorMapPtr pMap) -{ - register xkbSetNamedIndicatorReq *req; - XkbInfoPtr xkbi; - - if ((dpy->flags & XlibDisplayNoXkb) || (name == None) || - (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) - return False; - LockDisplay(dpy); - xkbi = dpy->xkb_info; - GetReq(kbSetNamedIndicator, req); - req->reqType = xkbi->codes->major_opcode; - req->xkbReqType = X_kbSetNamedIndicator; - req->deviceSpec = device; - req->ledClass = class; - req->ledID = id; - req->indicator = (CARD32) name; - req->setState = changeState; - if (req->setState) - req->on = state; - else - req->on = False; - if (pMap != NULL) { - req->setMap = True; - req->createMap = createNewMap; - req->flags = pMap->flags; - req->whichGroups = pMap->which_groups; - req->groups = pMap->groups; - req->whichMods = pMap->which_mods; - req->realMods = pMap->mods.real_mods; - req->virtualMods = pMap->mods.vmods; - req->ctrls = pMap->ctrls; - } - else { - req->setMap = False; - req->createMap = False; - req->flags = 0; - req->whichGroups = 0; - req->groups = 0; - req->whichMods = 0; - req->realMods = 0; - req->virtualMods = 0; - req->ctrls = 0; - } - UnlockDisplay(dpy); - SyncHandle(); - return True; -} - -Bool -XkbSetNamedIndicator(Display *dpy, - Atom name, - Bool changeState, - Bool state, - Bool createNewMap, - XkbIndicatorMapPtr pMap) -{ - return XkbSetNamedDeviceIndicator(dpy, XkbUseCoreKbd, - XkbDfltXIClass, XkbDfltXIId, - name, changeState, state, - createNewMap, pMap); -} diff --git a/nx-X11/lib/X11/XKBlib.h b/nx-X11/lib/X11/XKBlib.h deleted file mode 100644 index dd2841e9a..000000000 --- a/nx-X11/lib/X11/XKBlib.h +++ /dev/null @@ -1,1150 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#if !defined(_X11_XKBLIB_H_) && !defined(_XKBLIB_H_) -#define _X11_XKBLIB_H_ -#define _XKBLIB_H_ - -#include -#include - -typedef struct _XkbAnyEvent { - int type; /* XkbAnyEvent */ - unsigned long serial; /* # of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XKB event minor code */ - unsigned int device; /* device ID */ -} XkbAnyEvent; - -typedef struct _XkbNewKeyboardNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbNewKeyboardNotify */ - int device; /* device ID */ - int old_device; /* device ID of previous keyboard */ - int min_key_code; /* minimum key code */ - int max_key_code; /* maximum key code */ - int old_min_key_code;/* min key code of previous kbd */ - int old_max_key_code;/* max key code of previous kbd */ - unsigned int changed; /* changed aspects of the keyboard */ - char req_major; /* major and minor opcode of req */ - char req_minor; /* that caused change, if applicable */ -} XkbNewKeyboardNotifyEvent; - -typedef struct _XkbMapNotifyEvent { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbMapNotify */ - int device; /* device ID */ - unsigned int changed; /* fields which have been changed */ - unsigned int flags; /* reserved */ - int first_type; /* first changed key type */ - int num_types; /* number of changed key types */ - KeyCode min_key_code; - KeyCode max_key_code; - KeyCode first_key_sym; - KeyCode first_key_act; - KeyCode first_key_behavior; - KeyCode first_key_explicit; - KeyCode first_modmap_key; - KeyCode first_vmodmap_key; - int num_key_syms; - int num_key_acts; - int num_key_behaviors; - int num_key_explicit; - int num_modmap_keys; - int num_vmodmap_keys; - unsigned int vmods; /* mask of changed virtual mods */ -} XkbMapNotifyEvent; - -typedef struct _XkbStateNotifyEvent { - int type; /* XkbAnyEvent */ - unsigned long serial; /* # of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbStateNotify */ - int device; /* device ID */ - unsigned int changed; /* mask of changed state components */ - int group; /* keyboard group */ - int base_group; /* base keyboard group */ - int latched_group; /* latched keyboard group */ - int locked_group; /* locked keyboard group */ - unsigned int mods; /* modifier state */ - unsigned int base_mods; /* base modifier state */ - unsigned int latched_mods; /* latched modifiers */ - unsigned int locked_mods; /* locked modifiers */ - int compat_state; /* compatibility state */ - unsigned char grab_mods; /* mods used for grabs */ - unsigned char compat_grab_mods;/* grab mods for non-XKB clients */ - unsigned char lookup_mods; /* mods sent to clients */ - unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */ - int ptr_buttons; /* pointer button state */ - KeyCode keycode; /* keycode that caused the change */ - char event_type; /* KeyPress or KeyRelease */ - char req_major; /* Major opcode of request */ - char req_minor; /* Minor opcode of request */ -} XkbStateNotifyEvent; - -typedef struct _XkbControlsNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbControlsNotify */ - int device; /* device ID */ - unsigned int changed_ctrls; /* controls with changed sub-values */ - unsigned int enabled_ctrls; /* controls currently enabled */ - unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */ - int num_groups; /* total groups on keyboard */ - KeyCode keycode; /* key that caused change or 0 */ - char event_type; /* type of event that caused change */ - char req_major; /* if keycode==0, major and minor */ - char req_minor; /* opcode of req that caused change */ -} XkbControlsNotifyEvent; - -typedef struct _XkbIndicatorNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbIndicatorNotify */ - int device; /* device ID */ - unsigned int changed; /* indicators with new state or map */ - unsigned int state; /* current state of all indicators */ -} XkbIndicatorNotifyEvent; - -typedef struct _XkbNamesNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbNamesNotify */ - int device; /* device ID */ - unsigned int changed; /* names that have changed */ - int first_type; /* first key type with new name */ - int num_types; /* number of key types with new names */ - int first_lvl; /* first key type new new level names */ - int num_lvls; /* # of key types w/new level names */ - int num_aliases; /* total number of key aliases*/ - int num_radio_groups;/* total number of radio groups */ - unsigned int changed_vmods; /* virtual modifiers with new names */ - unsigned int changed_groups; /* groups with new names */ - unsigned int changed_indicators;/* indicators with new names */ - int first_key; /* first key with new name */ - int num_keys; /* number of keys with new names */ -} XkbNamesNotifyEvent; - -typedef struct _XkbCompatMapNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbCompatMapNotify */ - int device; /* device ID */ - unsigned int changed_groups; /* groups with new compat maps */ - int first_si; /* first new symbol interp */ - int num_si; /* number of new symbol interps */ - int num_total_si; /* total # of symbol interps */ -} XkbCompatMapNotifyEvent; - -typedef struct _XkbBellNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbBellNotify */ - int device; /* device ID */ - int percent; /* requested volume as a % of maximum */ - int pitch; /* requested pitch in Hz */ - int duration; /* requested duration in useconds */ - int bell_class; /* (input extension) feedback class */ - int bell_id; /* (input extension) ID of feedback */ - Atom name; /* "name" of requested bell */ - Window window; /* window associated with event */ - Bool event_only; /* "event only" requested */ -} XkbBellNotifyEvent; - -typedef struct _XkbActionMessage { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbActionMessage */ - int device; /* device ID */ - KeyCode keycode; /* key that generated the event */ - Bool press; /* true if act caused by key press */ - Bool key_event_follows;/* true if key event also generated */ - int group; /* effective group */ - unsigned int mods; /* effective mods */ - char message[XkbActionMessageLength+1]; - /* message -- leave space for NUL */ -} XkbActionMessageEvent; - -typedef struct _XkbAccessXNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbAccessXNotify */ - int device; /* device ID */ - int detail; /* XkbAXN_* */ - int keycode; /* key of event */ - int sk_delay; /* current slow keys delay */ - int debounce_delay; /* current debounce delay */ -} XkbAccessXNotifyEvent; - -typedef struct _XkbExtensionDeviceNotify { - int type; /* XkbAnyEvent */ - unsigned long serial; /* of last req processed by server */ - Bool send_event; /* is this from a SendEvent request? */ - Display * display; /* Display the event was read from */ - Time time; /* milliseconds */ - int xkb_type; /* XkbExtensionDeviceNotify */ - int device; /* device ID */ - unsigned int reason; /* reason for the event */ - unsigned int supported; /* mask of supported features */ - unsigned int unsupported; /* mask of unsupported features */ - /* that some app tried to use */ - int first_btn; /* first button that changed */ - int num_btns; /* range of buttons changed */ - unsigned int leds_defined; /* indicators with names or maps */ - unsigned int led_state; /* current state of the indicators */ - int led_class; /* feedback class for led changes */ - int led_id; /* feedback id for led changes */ -} XkbExtensionDeviceNotifyEvent; - -typedef union _XkbEvent { - int type; - XkbAnyEvent any; - XkbNewKeyboardNotifyEvent new_kbd; - XkbMapNotifyEvent map; - XkbStateNotifyEvent state; - XkbControlsNotifyEvent ctrls; - XkbIndicatorNotifyEvent indicators; - XkbNamesNotifyEvent names; - XkbCompatMapNotifyEvent compat; - XkbBellNotifyEvent bell; - XkbActionMessageEvent message; - XkbAccessXNotifyEvent accessx; - XkbExtensionDeviceNotifyEvent device; - XEvent core; -} XkbEvent; - -typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr; - - /* XkbOpenDisplay error codes */ -#define XkbOD_Success 0 -#define XkbOD_BadLibraryVersion 1 -#define XkbOD_ConnectionRefused 2 -#define XkbOD_NonXkbServer 3 -#define XkbOD_BadServerVersion 4 - - /* Values for XlibFlags */ -#define XkbLC_ForceLatin1Lookup (1<<0) -#define XkbLC_ConsumeLookupMods (1<<1) -#define XkbLC_AlwaysConsumeShiftAndLock (1<<2) -#define XkbLC_IgnoreNewKeyboards (1<<3) -#define XkbLC_ControlFallback (1<<4) -#define XkbLC_ConsumeKeysOnComposeFail (1<<29) -#define XkbLC_ComposeLED (1<<30) -#define XkbLC_BeepOnComposeFail (1<<31) - -#define XkbLC_AllComposeControls (0xc0000000) -#define XkbLC_AllControls (0xc000001f) - -_XFUNCPROTOBEGIN - -extern Bool XkbIgnoreExtension( - Bool /* ignore */ -); - -extern Display *XkbOpenDisplay( - char * /* name */, - int * /* ev_rtrn */, - int * /* err_rtrn */, - int * /* major_rtrn */, - int * /* minor_rtrn */, - int * /* reason */ -); - -extern Bool XkbQueryExtension( - Display * /* dpy */, - int * /* opcodeReturn */, - int * /* eventBaseReturn */, - int * /* errorBaseReturn */, - int * /* majorRtrn */, - int * /* minorRtrn */ -); - -extern Bool XkbUseExtension( - Display * /* dpy */, - int * /* major_rtrn */, - int * /* minor_rtrn */ -); - -extern Bool XkbLibraryVersion( - int * /* libMajorRtrn */, - int * /* libMinorRtrn */ -); - -extern unsigned int XkbSetXlibControls( - Display* /* dpy */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern unsigned int XkbGetXlibControls( - Display* /* dpy */ -); - -extern unsigned int XkbXlibControlsImplemented(void); - -typedef Atom (*XkbInternAtomFunc)( - Display * /* dpy */, - _Xconst char * /* name */, - Bool /* only_if_exists */ -); - -typedef char * (*XkbGetAtomNameFunc)( - Display * /* dpy */, - Atom /* atom */ -); - -extern void XkbSetAtomFuncs( - XkbInternAtomFunc /* getAtom */, - XkbGetAtomNameFunc /* getName */ -); - -extern KeySym XkbKeycodeToKeysym( - Display * /* dpy */, -#if NeedWidePrototypes - unsigned int /* kc */, -#else - KeyCode /* kc */, -#endif - int /* group */, - int /* level */ -); - -extern unsigned int XkbKeysymToModifiers( - Display * /* dpy */, - KeySym /* ks */ -); - -extern Bool XkbLookupKeySym( - Display * /* dpy */, - KeyCode /* keycode */, - unsigned int /* modifiers */, - unsigned int * /* modifiers_return */, - KeySym * /* keysym_return */ -); - -extern int XkbLookupKeyBinding( - Display * /* dpy */, - KeySym /* sym_rtrn */, - unsigned int /* mods */, - char * /* buffer */, - int /* nbytes */, - int * /* extra_rtrn */ -); - -extern Bool XkbTranslateKeyCode( - XkbDescPtr /* xkb */, - KeyCode /* keycode */, - unsigned int /* modifiers */, - unsigned int * /* modifiers_return */, - KeySym * /* keysym_return */ -); - -extern int XkbTranslateKeySym( - Display * /* dpy */, - register KeySym * /* sym_return */, - unsigned int /* modifiers */, - char * /* buffer */, - int /* nbytes */, - int * /* extra_rtrn */ -); - -extern Bool XkbSetAutoRepeatRate( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* delay */, - unsigned int /* interval */ -); - -extern Bool XkbGetAutoRepeatRate( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int * /* delayRtrn */, - unsigned int * /* intervalRtrn */ -); - -extern Bool XkbChangeEnabledControls( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbDeviceBell( - Display * /* dpy */, - Window /* win */, - int /* deviceSpec */, - int /* bellClass */, - int /* bellID */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbForceDeviceBell( - Display * /* dpy */, - int /* deviceSpec */, - int /* bellClass */, - int /* bellID */, - int /* percent */ -); - -extern Bool XkbDeviceBellEvent( - Display * /* dpy */, - Window /* win */, - int /* deviceSpec */, - int /* bellClass */, - int /* bellID */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbBell( - Display * /* dpy */, - Window /* win */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbForceBell( - Display * /* dpy */, - int /* percent */ -); - -extern Bool XkbBellEvent( - Display * /* dpy */, - Window /* win */, - int /* percent */, - Atom /* name */ -); - -extern Bool XkbSelectEvents( - Display * /* dpy */, - unsigned int /* deviceID */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbSelectEventDetails( - Display * /* dpy */, - unsigned int /* deviceID */, - unsigned int /* eventType */, - unsigned long /* affect */, - unsigned long /* details */ -); - -extern void XkbNoteMapChanges( - XkbMapChangesPtr /* old */, - XkbMapNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -extern void XkbNoteNameChanges( - XkbNameChangesPtr /* old */, - XkbNamesNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -extern Status XkbGetIndicatorState( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int * /* pStateRtrn */ -); - -extern Status XkbGetDeviceIndicatorState( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - unsigned int * /* pStateRtrn */ -); - -extern Status XkbGetIndicatorMap( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbSetIndicatorMap( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -#define XkbNoteIndicatorMapChanges(o,n,w) \ - ((o)->map_changes|=((n)->map_changes&(w))) -#define XkbNoteIndicatorStateChanges(o,n,w)\ - ((o)->state_changes|=((n)->state_changes&(w))) -#define XkbGetIndicatorMapChanges(d,x,c) \ - (XkbGetIndicatorMap((d),(c)->map_changes,x)) -#define XkbChangeIndicatorMaps(d,x,c) \ - (XkbSetIndicatorMap((d),(c)->map_changes,x)) - -extern Bool XkbGetNamedIndicator( - Display * /* dpy */, - Atom /* name */, - int * /* pNdxRtrn */, - Bool * /* pStateRtrn */, - XkbIndicatorMapPtr /* pMapRtrn */, - Bool * /* pRealRtrn */ -); - -extern Bool XkbGetNamedDeviceIndicator( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - Atom /* name */, - int * /* pNdxRtrn */, - Bool * /* pStateRtrn */, - XkbIndicatorMapPtr /* pMapRtrn */, - Bool * /* pRealRtrn */ -); - -extern Bool XkbSetNamedIndicator( - Display * /* dpy */, - Atom /* name */, - Bool /* changeState */, - Bool /* state */, - Bool /* createNewMap */, - XkbIndicatorMapPtr /* pMap */ -); - -extern Bool XkbSetNamedDeviceIndicator( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - Atom /* name */, - Bool /* changeState */, - Bool /* state */, - Bool /* createNewMap */, - XkbIndicatorMapPtr /* pMap */ -); - -extern Bool XkbLockModifiers( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbLatchModifiers( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affect */, - unsigned int /* values */ -); - -extern Bool XkbLockGroup( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* group */ -); - -extern Bool XkbLatchGroup( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* group */ -); - -extern Bool XkbSetServerInternalMods( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affectReal */, - unsigned int /* realValues */, - unsigned int /* affectVirtual */, - unsigned int /* virtualValues */ -); - -extern Bool XkbSetIgnoreLockMods( - Display * /* dpy */, - unsigned int /* deviceSpec */, - unsigned int /* affectReal */, - unsigned int /* realValues */, - unsigned int /* affectVirtual */, - unsigned int /* virtualValues */ -); - - -extern Bool XkbVirtualModsToReal( - XkbDescPtr /* xkb */, - unsigned int /* virtual_mask */, - unsigned int * /* mask_rtrn */ -); - -extern Bool XkbComputeEffectiveMap( - XkbDescPtr /* xkb */, - XkbKeyTypePtr /* type */, - unsigned char * /* map_rtrn */ -); - -extern Status XkbInitCanonicalKeyTypes( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* keypadVMod */ -); - -extern XkbDescPtr XkbAllocKeyboard( - void -); - -extern void XkbFreeKeyboard( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeDesc */ -); - -extern Status XkbAllocClientMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nTypes */ -); - -extern Status XkbAllocServerMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nActions */ -); - -extern void XkbFreeClientMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern void XkbFreeServerMap( - XkbDescPtr /* xkb */, - unsigned int /* what */, - Bool /* freeMap */ -); - -extern XkbKeyTypePtr XkbAddKeyType( - XkbDescPtr /* xkb */, - Atom /* name */, - int /* map_count */, - Bool /* want_preserve */, - int /* num_lvls */ -); - -extern Status XkbAllocIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern void XkbFreeIndicatorMaps( - XkbDescPtr /* xkb */ -); - -extern XkbDescPtr XkbGetMap( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* deviceSpec */ -); - -extern Status XkbGetUpdatedMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetMapChanges( - Display * /* dpy */, - XkbDescPtr /* xkb */, - XkbMapChangesPtr /* changes */ -); - - -extern Status XkbRefreshKeyboardMapping( - XkbMapNotifyEvent * /* event */ -); - -extern Status XkbGetKeyTypes( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbGetKeySyms( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbGetKeyActions( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbGetKeyBehaviors( - Display * /* dpy */, - unsigned int /* firstKey */, - unsigned int /* nKeys */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetVirtualMods( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetKeyExplicitComponents( - Display * /* dpy */, - unsigned int /* firstKey */, - unsigned int /* nKeys */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetKeyModifierMap( - Display * /* dpy */, - unsigned int /* firstKey */, - unsigned int /* nKeys */, - XkbDescPtr /* desc */ -); - -extern Status XkbGetKeyVirtualModMap( - Display * /* dpy */, - unsigned int /* first */, - unsigned int /* num */, - XkbDescPtr /* xkb */ -); - -extern Status XkbAllocControls( - XkbDescPtr /* xkb */, - unsigned int /* which*/ -); - -extern void XkbFreeControls( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern Status XkbGetControls( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbSetControls( - Display * /* dpy */, - unsigned long /* which */, - XkbDescPtr /* desc */ -); - -extern void XkbNoteControlsChanges( - XkbControlsChangesPtr /* old */, - XkbControlsNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) -#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) - -extern Status XkbAllocCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - unsigned int /* nInterpret */ -); - -extern void XkbFreeCompatMap( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - -extern Status XkbGetCompatMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* xkb */ -); - -extern Bool XkbSetCompatMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* xkb */, - Bool /* updateActions */ -); - -extern XkbSymInterpretPtr XkbAddSymInterpret( - XkbDescPtr /* xkb */, - XkbSymInterpretPtr /* si */, - Bool /* updateMap */, - XkbChangesPtr /* changes */ -); - -extern Status XkbAllocNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - int /* nTotalRG */, - int /* nTotalAliases */ -); - -extern Status XkbGetNames( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbSetNames( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* firstType */, - unsigned int /* nTypes */, - XkbDescPtr /* desc */ -); - -extern Bool XkbChangeNames( - Display * /* dpy */, - XkbDescPtr /* xkb */, - XkbNameChangesPtr /* changes */ -); - -extern void XkbFreeNames( - XkbDescPtr /* xkb */, - unsigned int /* which */, - Bool /* freeMap */ -); - - -extern Status XkbGetState( - Display * /* dpy */, - unsigned int /* deviceSpec */, - XkbStatePtr /* rtrnState */ -); - -extern Bool XkbSetMap( - Display * /* dpy */, - unsigned int /* which */, - XkbDescPtr /* desc */ -); - -extern Bool XkbChangeMap( - Display* /* dpy */, - XkbDescPtr /* desc */, - XkbMapChangesPtr /* changes */ -); - -extern Bool XkbSetDetectableAutoRepeat( - Display * /* dpy */, - Bool /* detectable */, - Bool * /* supported */ -); - -extern Bool XkbGetDetectableAutoRepeat( - Display * /* dpy */, - Bool * /* supported */ -); - -extern Bool XkbSetAutoResetControls( - Display * /* dpy */, - unsigned int /* changes */, - unsigned int * /* auto_ctrls */, - unsigned int * /* auto_values */ -); - -extern Bool XkbGetAutoResetControls( - Display * /* dpy */, - unsigned int * /* auto_ctrls */, - unsigned int * /* auto_ctrl_values */ -); - -extern Bool XkbSetPerClientControls( - Display * /* dpy */, - unsigned int /* change */, - unsigned int * /* values */ -); - -extern Bool XkbGetPerClientControls( - Display * /* dpy */, - unsigned int * /* ctrls */ -); - -extern Status XkbCopyKeyType( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */ -); - -extern Status XkbCopyKeyTypes( - XkbKeyTypePtr /* from */, - XkbKeyTypePtr /* into */, - int /* num_types */ -); - -extern Status XkbResizeKeyType( - XkbDescPtr /* xkb */, - int /* type_ndx */, - int /* map_count */, - Bool /* want_preserve */, - int /* new_num_lvls */ -); - -extern KeySym *XkbResizeKeySyms( - XkbDescPtr /* desc */, - int /* forKey */, - int /* symsNeeded */ -); - -extern XkbAction *XkbResizeKeyActions( - XkbDescPtr /* desc */, - int /* forKey */, - int /* actsNeeded */ -); - -extern Status XkbChangeTypesOfKey( - XkbDescPtr /* xkb */, - int /* key */, - int /* num_groups */, - unsigned int /* groups */, - int * /* newTypes */, - XkbMapChangesPtr /* pChanges */ -); - -extern Status XkbChangeKeycodeRange( - XkbDescPtr /* xkb */, - int /* minKC */, - int /* maxKC */, - XkbChangesPtr /* changes */ -); - -/***====================================================================***/ - -extern XkbComponentListPtr XkbListComponents( - Display * /* dpy */, - unsigned int /* deviceSpec */, - XkbComponentNamesPtr /* ptrns */, - int * /* max_inout */ -); - -extern void XkbFreeComponentList( - XkbComponentListPtr /* list */ -); - -extern XkbDescPtr XkbGetKeyboard( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* deviceSpec */ -); - -extern XkbDescPtr XkbGetKeyboardByName( - Display * /* dpy */, - unsigned int /* deviceSpec */, - XkbComponentNamesPtr /* names */, - unsigned int /* want */, - unsigned int /* need */, - Bool /* load */ -); - -/***====================================================================***/ - -extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ - XkbDescPtr /* xkb */, /* keyboard device */ - int /* map_width */, /* width of core KeySym array */ - KeySym * /* core_syms */, /* always mapWidth symbols */ - unsigned int /* protected */, /* explicit key types */ - int * /* types_inout */, /* always four type indices */ - KeySym * /* xkb_syms_rtrn */ /* must have enough space */ -); - -extern Bool XkbApplyCompatMapToKey( /* False only on error */ - XkbDescPtr /* xkb */, /* keymap to be edited */ - KeyCode /* key */, /* key to be updated */ - XkbChangesPtr /* changes */ /* resulting changes to map */ -); - -extern Bool XkbUpdateMapFromCore( /* False only on error */ - XkbDescPtr /* xkb */, /* XKB keyboard to be edited */ - KeyCode /* first_key */, /* first changed key */ - int /* num_keys */, /* number of changed keys */ - int /* map_width */, /* width of core keymap */ - KeySym * /* core_keysyms */, /* symbols from core keymap */ - XkbChangesPtr /* changes */ /* resulting changes */ -); - -/***====================================================================***/ - -extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass */, - unsigned int /* ledId */ -); - -extern Status XkbResizeDeviceButtonActions( - XkbDeviceInfoPtr /* devi */, - unsigned int /* newTotal */ -); - -extern XkbDeviceInfoPtr XkbAllocDeviceInfo( - unsigned int /* deviceSpec */, - unsigned int /* nButtons */, - unsigned int /* szLeds */ -); - -extern void XkbFreeDeviceInfo( - XkbDeviceInfoPtr /* devi */, - unsigned int /* which */, - Bool /* freeDevI */ -); - -extern void XkbNoteDeviceChanges( - XkbDeviceChangesPtr /* old */, - XkbExtensionDeviceNotifyEvent * /* new */, - unsigned int /* wanted */ -); - -extern XkbDeviceInfoPtr XkbGetDeviceInfo( - Display * /* dpy */, - unsigned int /* which */, - unsigned int /* deviceSpec */, - unsigned int /* ledClass */, - unsigned int /* ledID */ -); - -extern Status XkbGetDeviceInfoChanges( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - XkbDeviceChangesPtr /* changes */ -); - -extern Status XkbGetDeviceButtonActions( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - Bool /* all */, - unsigned int /* first */, - unsigned int /* nBtns */ -); - -extern Status XkbGetDeviceLedInfo( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass (class, XIDflt, XIAll) */, - unsigned int /* ledId (id, XIDflt, XIAll) */, - unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */ -); - -extern Bool XkbSetDeviceInfo( - Display * /* dpy */, - unsigned int /* which */, - XkbDeviceInfoPtr /* devi */ -); - -extern Bool XkbChangeDeviceInfo( - Display* /* dpy */, - XkbDeviceInfoPtr /* desc */, - XkbDeviceChangesPtr /* changes */ -); - -extern Bool XkbSetDeviceLedInfo( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - unsigned int /* ledClass */, - unsigned int /* ledID */, - unsigned int /* which */ -); - -extern Bool XkbSetDeviceButtonActions( - Display * /* dpy */, - XkbDeviceInfoPtr /* devi */, - unsigned int /* first */, - unsigned int /* nBtns */ -); - -/***====================================================================***/ - -extern char XkbToControl( - char /* c */ -); - -/***====================================================================***/ - -extern Bool XkbSetDebuggingFlags( - Display * /* dpy */, - unsigned int /* mask */, - unsigned int /* flags */, - char * /* msg */, - unsigned int /* ctrls_mask */, - unsigned int /* ctrls */, - unsigned int * /* rtrn_flags */, - unsigned int * /* rtrn_ctrls */ -); - -extern Bool XkbApplyVirtualModChanges( - XkbDescPtr /* xkb */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -extern Bool XkbUpdateActionVirtualMods( - XkbDescPtr /* xkb */, - XkbAction * /* act */, - unsigned int /* changed */ -); - -extern void XkbUpdateKeyTypeVirtualMods( - XkbDescPtr /* xkb */, - XkbKeyTypePtr /* type */, - unsigned int /* changed */, - XkbChangesPtr /* changes */ -); - -_XFUNCPROTOEND - -#endif /* !defined(_X11_XKBLIB_H_) && !defined(_XKBLIB_H_) */ diff --git a/nx-X11/lib/X11/XKBlibint.h b/nx-X11/lib/X11/XKBlibint.h deleted file mode 100644 index dad48b703..000000000 --- a/nx-X11/lib/X11/XKBlibint.h +++ /dev/null @@ -1,337 +0,0 @@ -/************************************************************ -Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. - -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 supporting -documentation, and that the name of Silicon Graphics not be -used in advertising or publicity pertaining to distribution -of the software without specific prior written permission. -Silicon Graphics makes no representation about the suitability -of this software for any purpose. It is provided "as is" -without any express or implied warranty. - -SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS -SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON -GRAPHICS 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. - -********************************************************/ - -#ifndef _XKBLIBINT_H_ -#define _XKBLIBINT_H_ - -#include -#include - -#define XkbMapPending (1<<0) -#define XkbXlibNewKeyboard (1<<1) - -typedef int (*XkbKSToMBFunc)( - XPointer /* priv */, - KeySym /* sym */, - char * /* buf */, - int /* len */, - int * /* extra_rtrn */ -); - -typedef KeySym (*XkbMBToKSFunc)( - XPointer /* priv */, - char * /* buf */, - int /* len */, - Status * /* status */ -); - -typedef KeySym (*XkbToUpperFunc)( - KeySym /* sym */ -); - -typedef struct _XkbConverters { - XkbKSToMBFunc KSToMB; - XPointer KSToMBPriv; - XkbMBToKSFunc MBToKS; - XPointer MBToKSPriv; - XkbToUpperFunc KSToUpper; -} XkbConverters; - -extern XkbInternAtomFunc _XkbInternAtomFunc; -extern XkbGetAtomNameFunc _XkbGetAtomNameFunc; - -typedef struct _XkbInfoRec { - unsigned flags; - unsigned xlib_ctrls; - XExtCodes *codes; - int srv_major; - int srv_minor; - unsigned selected_events; - unsigned short selected_nkn_details; - unsigned short selected_map_details; - XkbDescRec *desc; - XkbMapChangesRec changes; - Atom composeLED; - XkbConverters cvt; - XkbConverters latin1cvt; -} XkbInfoRec, *XkbInfoPtr; - - -#define _XkbUnavailable(d) \ - (((d)->flags&XlibDisplayNoXkb) || \ - ((!(d)->xkb_info || (!(d)->xkb_info->desc)) && !_XkbLoadDpy(d))) - -#define _XkbCheckPendingRefresh(d,xi) { \ - if ((xi)->flags&XkbXlibNewKeyboard) \ - _XkbReloadDpy((d)); \ - else if ((xi)->flags&XkbMapPending) { \ - if (XkbGetMapChanges((d),(xi)->desc, &(xi)->changes)==Success) { \ - LockDisplay((d)); \ - (xi)->changes.changed= 0; \ - UnlockDisplay((d)); \ - } \ - } \ -} - -#define _XkbNeedModmap(i) ((!(i)->desc->map)||(!(i)->desc->map->modmap)) - - /* - * mask of the events that the "invisible" XKB support in Xlib needs - */ -#define XKB_XLIB_MAP_MASK (XkbAllClientInfoMask) - - /* - * Handy helper macros - */ - -typedef struct _XkbReadBuffer { - int error; - int size; - char *start; - char *data; -} XkbReadBufferRec, *XkbReadBufferPtr; - -#define _XkbAlloc(s) Xmalloc((s)) -#define _XkbCalloc(n,s) Xcalloc((n),(s)) -#define _XkbRealloc(o,s) Xrealloc((o),(s)) -#define _XkbTypedAlloc(t) ((t *)Xmalloc(sizeof(t))) -#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n),sizeof(t))) -#define _XkbTypedRealloc(o,n,t) \ - ((o) ? (t *)Xrealloc((o), (n)*sizeof(t)) : _XkbTypedCalloc(n,t)) -#define _XkbClearElems(a,f,l,t) bzero(&(a)[f], ((l)-(f)+1) * sizeof(t)) -#define _XkbFree(p) Xfree(p) - -_XFUNCPROTOBEGIN - -extern void _XkbReloadDpy( - Display * /* dpy */ -); - -extern KeySym _XKeycodeToKeysym( - Display * /* display */, -#if NeedWidePrototypes - unsigned int /* keycode */, -#else - KeyCode /* keycode */, -#endif - int /* index */ -); - -extern KeyCode _XKeysymToKeycode( - Display * /* display */, - KeySym /* keysym */ -); - -extern KeySym _XLookupKeysym( - XKeyEvent * /* key_event */, - int /* index */ -); - -extern int _XRefreshKeyboardMapping( - XMappingEvent * /* event_map */ -); - -extern unsigned _XKeysymToModifiers( - Display * /* dpy */, - KeySym /* ks */ -); - -extern int _XTranslateKey( - register Display * /* dpy */, - KeyCode /* keycode */, - register unsigned int /* modifiers */, - unsigned int * /* modifiers_return */, - KeySym * /* keysym_return */ -); - -extern int _XTranslateKeySym( - Display * /* dpy */, - register KeySym /* symbol */, - unsigned int /* modifiers */, - char * /* buffer */, - int /* nbytes */ -); - -extern int _XLookupString( - register XKeyEvent * /* event */, - char * /* buffer */, - int /* nbytes */, - KeySym * /* keysym */, - XComposeStatus * /* status */ -); - -extern void _XkbNoteCoreMapChanges( - XkbMapChangesRec * /* old */, - XMappingEvent * /* new */, - unsigned int /* wanted */ -); - -extern int _XkbInitReadBuffer( - Display * /* dpy */, - XkbReadBufferPtr /* buf */, - int /* size */ -); - -extern int _XkbSkipReadBufferData( - XkbReadBufferPtr /* from */, - int /* size */ -); - -extern int _XkbCopyFromReadBuffer( - XkbReadBufferPtr /* from */, - char * /* to */, - int /* size */ -); - - -#ifdef LONG64 -extern int _XkbReadCopyData32( - int * /* from */, - long * /* to */, - int /* num_words */ -); - -extern int _XkbWriteCopyData32( - unsigned long * /* from */, - CARD32 * /* to */, - int /* num_words */ -); - -extern int _XkbReadBufferCopy32( - XkbReadBufferPtr /* from */, - long * /* to */, - int /* size */ -); -#else -#define _XkbReadCopyData32(f,t,s) memcpy((char *)(t), (char *)(f), (s)*4) -#define _XkbWriteCopyData32(f,t,s) memcpy((char *)(t), (char *)(f), (s)*4) -#define _XkbReadBufferCopy32(f,t,s) _XkbCopyFromReadBuffer(f, (char *)t, (s)*4) -#endif - -#ifndef NO_DEC_BINARY_COMPATIBILITY -#define XKB_FORCE_INT_KEYSYM 1 -#endif - -#ifdef XKB_FORCE_INT_KEYSYM -extern int _XkbReadCopyKeySyms( - int * /* from */, - KeySym * /* to */, - int /* num_words */ -); - -extern int _XkbWriteCopyKeySyms( - KeySym * /* from */, - CARD32 * /* to */, - int /* num_words */ -); - -extern int _XkbReadBufferCopyKeySyms( - XkbReadBufferPtr /* from */, -#ifndef NO_DEC_BUG_FIX - KeySym * /* to */, -#else - long * /* to */, -#endif - int /* size */ -); -#else -#define _XkbReadCopyKeySyms(f,t,n) _XkbReadCopyData32(f,t,n) -#define _XkbWriteCopyKeySyms(f,t,n) _XkbWriteCopyData32(f,t,n) -#define _XkbReadBufferCopyKeySyms(f,t,s) _XkbReadBufferCopy32(f,t,s) -#endif - -extern char *_XkbPeekAtReadBuffer( - XkbReadBufferPtr /* from */, - int /* size */ -); - -extern char *_XkbGetReadBufferPtr( - XkbReadBufferPtr /* from */, - int /* size */ -); -#define _XkbGetTypedRdBufPtr(b,n,t) ((t *)_XkbGetReadBufferPtr(b,(n)*SIZEOF(t))) - -extern int _XkbFreeReadBuffer( - XkbReadBufferPtr /* buf */ -); - -extern Bool -_XkbGetReadBufferCountedString( - XkbReadBufferPtr /* buf */, - char ** /* rtrn */ -); - -extern char *_XkbGetCharset( - void -); - -extern int _XkbGetConverters( - const char * /* encoding_name */, - XkbConverters * /* cvt_rtrn */ -); - -#ifdef NEED_MAP_READERS - -extern Status _XkbReadGetMapReply( - Display * /* dpy */, - xkbGetMapReply * /* rep */, - XkbDescRec * /* xkb */, - int * /* nread_rtrn */ -); - -extern Status _XkbReadGetCompatMapReply( - Display * /* dpy */, - xkbGetCompatMapReply * /* rep */, - XkbDescPtr /* xkb */, - int * /* nread_rtrn */ -); - -extern Status _XkbReadGetIndicatorMapReply( - Display * /* dpy */, - xkbGetIndicatorMapReply * /* rep */, - XkbDescPtr /* xkb */, - int * /* nread_rtrn */ -); - -extern Status _XkbReadGetNamesReply( - Display * /* dpy */, - xkbGetNamesReply * /* rep */, - XkbDescPtr /* xkb */, - int * /* nread_rtrn */ -); - -extern Status _XkbReadGetGeometryReply( - Display * /* dpy */, - xkbGetGeometryReply * /* rep */, - XkbDescPtr /* xkb */, - int * /* nread_rtrn */ -); - -#endif - -_XFUNCPROTOEND - -#endif /* _XKBLIBINT_H_ */ diff --git a/nx-X11/lib/X11/XRGB.c b/nx-X11/lib/X11/XRGB.c deleted file mode 100644 index 03f980e99..000000000 --- a/nx-X11/lib/X11/XRGB.c +++ /dev/null @@ -1,242 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsRtoX.c - * - * DESCRIPTION - * Convert color specifications in XcmsRGB format in one array of - * XcmsColor structures to RGB in an array of XColor structures. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * LOCAL VARIABLES - */ - -static unsigned short const MASK[17] = { - 0x0000, /* 0 bitsPerRGB */ - 0x8000, /* 1 bitsPerRGB */ - 0xc000, /* 2 bitsPerRGB */ - 0xe000, /* 3 bitsPerRGB */ - 0xf000, /* 4 bitsPerRGB */ - 0xf800, /* 5 bitsPerRGB */ - 0xfc00, /* 6 bitsPerRGB */ - 0xfe00, /* 7 bitsPerRGB */ - 0xff00, /* 8 bitsPerRGB */ - 0xff80, /* 9 bitsPerRGB */ - 0xffc0, /* 10 bitsPerRGB */ - 0xffe0, /* 11 bitsPerRGB */ - 0xfff0, /* 12 bitsPerRGB */ - 0xfff8, /* 13 bitsPerRGB */ - 0xfffc, /* 14 bitsPerRGB */ - 0xfffe, /* 15 bitsPerRGB */ - 0xffff /* 16 bitsPerRGB */ -}; - - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsRGB_to_XColor - - * - * SYNOPSIS - */ -void -_XcmsRGB_to_XColor( - XcmsColor *pColors, - XColor *pXColors, - unsigned int nColors) -/* - * DESCRIPTION - * Translates a color specification in XcmsRGBFormat in a XcmsColor - * structure to an XColor structure. - * - * RETURNS - * void. - */ -{ - for (; nColors--; pXColors++, pColors++) { - pXColors->pixel = pColors->pixel; - pXColors->red = pColors->spec.RGB.red; - pXColors->green = pColors->spec.RGB.green; - pXColors->blue = pColors->spec.RGB.blue; - pXColors->flags = (DoRed | DoGreen | DoBlue); - } -} - - -/* - * NAME - * _XColor_to_XcmsRGB - * - * SYNOPSIS - */ -void -_XColor_to_XcmsRGB( - XcmsCCC ccc, - XColor *pXColors, - XcmsColor *pColors, - unsigned int nColors) -/* - * DESCRIPTION - * Translates an RGB color specification in an XColor - * structure to an XcmsRGB structure. - * - * IMPORTANT NOTE: Bit replication that may have been caused - * with ResolveColor() routine in the X Server is undone - * here if requested! For example, if red = 0xcaca and the - * bits_per_rgb is 8, then spec.RGB.red will be 0xca00. - * - * RETURNS - * void - */ -{ - int bits_per_rgb = ccc->visual->bits_per_rgb; - - for (; nColors--; pXColors++, pColors++) { - pColors->spec.RGB.red = (pXColors->red & MASK[bits_per_rgb]); - pColors->spec.RGB.green = (pXColors->green & MASK[bits_per_rgb]); - pColors->spec.RGB.blue = (pXColors->blue & MASK[bits_per_rgb]); - pColors->format = XcmsRGBFormat; - pColors->pixel = pXColors->pixel; - } -} - - -/* - * NAME - * _XcmsResolveColor - * - * SYNOPSIS - */ -void -_XcmsResolveColor( - XcmsCCC ccc, - XcmsColor *pXcmsColor) -/* - * DESCRIPTION - * Uses the X Server ResolveColor() algorithm to - * modify values to closest values supported by hardware. - * Old algorithm simply masked low-order bits. The new algorithm - * has the effect of replicating significant bits into lower order - * bits in order to stretch the hardware value into all 16 bits. - * - * On a display with N-bit DACs, the "hardware" color is computed as: - * - * ((unsignedlong)(ClientValue >> (16-N)) * 0xFFFF) / ((1 << N) - 1) - * - * - * RETURNS - * void. - */ -{ - int shift; - int max_color; - - shift = 16 - ccc->visual->bits_per_rgb; - max_color = (1 << ccc->visual->bits_per_rgb) - 1; - - - pXcmsColor->spec.RGB.red = - ((unsigned long)(pXcmsColor->spec.RGB.red >> shift) * 0xFFFF) - / max_color; - pXcmsColor->spec.RGB.green = - ((unsigned long)(pXcmsColor->spec.RGB.green >> shift) * 0xFFFF) - / max_color; - pXcmsColor->spec.RGB.blue = - ((unsigned long)(pXcmsColor->spec.RGB.blue >> shift) * 0xFFFF) - / max_color; -} - - -/* - * NAME - * _XcmsUnresolveColor - * - * SYNOPSIS - */ -void -_XcmsUnresolveColor( - XcmsCCC ccc, - XcmsColor *pColor) -/* - * DESCRIPTION - * Masks out insignificant bits. - * - * RETURNS - * void. - * - * ASSUMPTIONS - * format == XcmsRGBFormat - */ -{ - int bits_per_rgb = ccc->visual->bits_per_rgb; - - pColor->spec.RGB.red &= MASK[bits_per_rgb]; - pColor->spec.RGB.green &= MASK[bits_per_rgb]; - pColor->spec.RGB.blue &= MASK[bits_per_rgb]; -} - - -/* - * NAME - * _XUnresolveColor - * - * SYNOPSIS - */ -void -_XUnresolveColor( - XcmsCCC ccc, - XColor *pXColor) -/* - * DESCRIPTION - * Masks out insignificant bits. - * - * RETURNS - * void. - */ -{ - int bits_per_rgb = ccc->visual->bits_per_rgb; - - pXColor->red &= MASK[bits_per_rgb]; - pXColor->green &= MASK[bits_per_rgb]; - pXColor->blue &= MASK[bits_per_rgb]; -} - diff --git a/nx-X11/lib/X11/XYZ.c b/nx-X11/lib/X11/XYZ.c deleted file mode 100644 index 826565773..000000000 --- a/nx-X11/lib/X11/XYZ.c +++ /dev/null @@ -1,203 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * - * NAME - * CIEXYZ.c - * - * DESCRIPTION - * CIE XYZ Color Space - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -#include /* sscanf */ - -/* - * DEFINES - * Internal definitions that need NOT be exported to any package - * or program using this package. - */ -#ifdef DBL_EPSILON -# define XMY_DBL_EPSILON DBL_EPSILON -#else -# define XMY_DBL_EPSILON 0.00001 -#endif - -/* - * FORWARD DECLARATIONS - */ -static int CIEXYZ_ParseString(register char *spec, XcmsColor *pColor); - -/* - * LOCALS VARIABLES - */ - -static XcmsConversionProc Fl_CIEXYZ_to_CIEXYZ[] = { - NULL -}; - - - -/* - * GLOBALS - * Variables declared in this package that are allowed - * to be used globally. - */ - /* - * CIE XYZ Color Space - */ -XcmsColorSpace XcmsCIEXYZColorSpace = - { - _XcmsCIEXYZ_prefix, /* prefix */ - XcmsCIEXYZFormat, /* id */ - CIEXYZ_ParseString, /* parseString */ - Fl_CIEXYZ_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_CIEXYZ, /* from_CIEXYZ */ - 1 - }; - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * CIEXYZ_ParseString - * - * SYNOPSIS - */ -static int -CIEXYZ_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsCIEXYZFormat. - * The assumed CIEXYZ string syntax is: - * CIEXYZ:// - * Where X, Y, and Z are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - */ -{ - size_t n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (size_t)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsCIEXYZ_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIEXYZ.X, - &pColor->spec.CIEXYZ.Y, - &pColor->spec.CIEXYZ.Z) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIEXYZ.X, - &pColor->spec.CIEXYZ.Y, - &pColor->spec.CIEXYZ.Z) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - pColor->format = XcmsCIEXYZFormat; - pColor->pixel = 0; - return(_XcmsCIEXYZ_ValidSpec(pColor)); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIELab_ValidSpec - * - * SYNOPSIS - */ -Status -_XcmsCIEXYZ_ValidSpec( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks if color specification valid for CIE XYZ - * - * RETURNS - * XcmsFailure if invalid, - * XcmsSuccess if valid. - * - */ -{ - if (pColor->format != XcmsCIEXYZFormat - || - (pColor->spec.CIEXYZ.Y < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIEXYZ.Y > 1.0 + XMY_DBL_EPSILON)) { - return(XcmsFailure); - } - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/Xatomtype.h b/nx-X11/lib/X11/Xatomtype.h deleted file mode 100644 index 1b2b47766..000000000 --- a/nx-X11/lib/X11/Xatomtype.h +++ /dev/null @@ -1,133 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifndef _XATOMTYPE_H_ -#define _XATOMTYPE_H_ - -/* - * This files defines crock C structures for calling XGetWindowProperty and - * XChangeProperty. All fields must be longs as the semantics of property - * routines will handle conversion to and from actual 32 bit objects. If your - * compiler doesn't treat &structoflongs the same as &arrayoflongs[0], you - * will have some work to do. - */ - -#define BOOL long -#define SIGNEDINT long -#define UNSIGNEDINT unsigned long -#define RESOURCEID unsigned long - - -/* this structure may be extended, but do not change the order */ -typedef struct { - UNSIGNEDINT flags; - SIGNEDINT x, y, width, height; /* need to cvt; only for pre-ICCCM */ - SIGNEDINT minWidth, minHeight; /* need to cvt */ - SIGNEDINT maxWidth, maxHeight; /* need to cvt */ - SIGNEDINT widthInc, heightInc; /* need to cvt */ - SIGNEDINT minAspectX, minAspectY; /* need to cvt */ - SIGNEDINT maxAspectX, maxAspectY; /* need to cvt */ - SIGNEDINT baseWidth,baseHeight; /* need to cvt; ICCCM version 1 */ - SIGNEDINT winGravity; /* need to cvt; ICCCM version 1 */ -} xPropSizeHints; -#define OldNumPropSizeElements 15 /* pre-ICCCM */ -#define NumPropSizeElements 18 /* ICCCM version 1 */ - -/* this structure may be extended, but do not change the order */ -/* RGB properties */ -typedef struct { - RESOURCEID colormap; - UNSIGNEDINT red_max; - UNSIGNEDINT red_mult; - UNSIGNEDINT green_max; - UNSIGNEDINT green_mult; - UNSIGNEDINT blue_max; - UNSIGNEDINT blue_mult; - UNSIGNEDINT base_pixel; - RESOURCEID visualid; /* ICCCM version 1 */ - RESOURCEID killid; /* ICCCM version 1 */ -} xPropStandardColormap; -#define OldNumPropStandardColormapElements 8 /* pre-ICCCM */ -#define NumPropStandardColormapElements 10 /* ICCCM version 1 */ - - -/* this structure may be extended, but do not change the order */ -typedef struct { - UNSIGNEDINT flags; - BOOL input; /* need to convert */ - SIGNEDINT initialState; /* need to cvt */ - RESOURCEID iconPixmap; - RESOURCEID iconWindow; - SIGNEDINT iconX; /* need to cvt */ - SIGNEDINT iconY; /* need to cvt */ - RESOURCEID iconMask; - UNSIGNEDINT windowGroup; - } xPropWMHints; -#define NumPropWMHintsElements 9 /* number of elements in this structure */ - -/* this structure defines the icon size hints information */ -typedef struct { - SIGNEDINT minWidth, minHeight; /* need to cvt */ - SIGNEDINT maxWidth, maxHeight; /* need to cvt */ - SIGNEDINT widthInc, heightInc; /* need to cvt */ - } xPropIconSize; -#define NumPropIconSizeElements 6 /* number of elements in this structure */ - -/* this structure defines the window manager state information */ -typedef struct { - SIGNEDINT state; /* need to cvt */ - RESOURCEID iconWindow; -} xPropWMState; -#define NumPropWMStateElements 2 /* number of elements in struct */ - -#undef BOOL -#undef SIGNEDINT -#undef UNSIGNEDINT -#undef RESOURCEID - -#endif /* _XATOMTYPE_H_ */ diff --git a/nx-X11/lib/X11/Xcms.h b/nx-X11/lib/X11/Xcms.h deleted file mode 100644 index 3b0410533..000000000 --- a/nx-X11/lib/X11/Xcms.h +++ /dev/null @@ -1,816 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * DESCRIPTION - * Public include file for X Color Management System - */ -#if !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) -#define _X11_XCMS_H_ -#define _XCMS_H_ - -#include - -/* The Xcms structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - - /* - * XCMS Status Values - */ -#define XcmsFailure 0 -#define XcmsSuccess 1 -#define XcmsSuccessWithCompression 2 - - /* - * Color Space Format ID's - * Color Space ID's are of XcmsColorFormat type. - * - * bit 31 - * 0 == Device-Independent - * 1 == Device-Dependent - * - * bit 30: - * 0 == Registered with X Consortium - * 1 == Unregistered - */ -#define XcmsUndefinedFormat (XcmsColorFormat)0x00000000 -#define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001 -#define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002 -#define XcmsCIExyYFormat (XcmsColorFormat)0x00000003 -#define XcmsCIELabFormat (XcmsColorFormat)0x00000004 -#define XcmsCIELuvFormat (XcmsColorFormat)0x00000005 -#define XcmsTekHVCFormat (XcmsColorFormat)0x00000006 -#define XcmsRGBFormat (XcmsColorFormat)0x80000000 -#define XcmsRGBiFormat (XcmsColorFormat)0x80000001 - - /* - * State of XcmsPerScrnInfo - */ -#define XcmsInitNone 0x00 /* no initialization attempted */ -#define XcmsInitSuccess 0x01 /* initialization successful */ -#define XcmsInitFailure 0xff /* failure, use defaults */ - -#define DisplayOfCCC(ccc) ((ccc)->dpy) -#define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber) -#define VisualOfCCC(ccc) ((ccc)->visual) -#define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt) -#define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt) -#define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet) - -typedef unsigned long XcmsColorFormat; /* Color Space Format ID */ - -typedef double XcmsFloat; - - /* - * Device RGB - */ -typedef struct { - unsigned short red; /* scaled from 0x0000 to 0xffff */ - unsigned short green; /* scaled from 0x0000 to 0xffff */ - unsigned short blue; /* scaled from 0x0000 to 0xffff */ -} XcmsRGB; - - /* - * RGB Intensity - */ -typedef struct { - XcmsFloat red; /* 0.0 - 1.0 */ - XcmsFloat green; /* 0.0 - 1.0 */ - XcmsFloat blue; /* 0.0 - 1.0 */ -} XcmsRGBi; - - /* - * CIE XYZ - */ -typedef struct { - XcmsFloat X; - XcmsFloat Y; - XcmsFloat Z; -} XcmsCIEXYZ; - - /* - * CIE u'v'Y - */ -typedef struct { - XcmsFloat u_prime; /* 0.0 - 1.0 */ - XcmsFloat v_prime; /* 0.0 - 1.0 */ - XcmsFloat Y; /* 0.0 - 1.0 */ -} XcmsCIEuvY; - - /* - * CIE xyY - */ -typedef struct { - XcmsFloat x; /* 0.0 - 1.0 */ - XcmsFloat y; /* 0.0 - 1.0 */ - XcmsFloat Y; /* 0.0 - 1.0 */ -} XcmsCIExyY; - - /* - * CIE L*a*b* - */ -typedef struct { - XcmsFloat L_star; /* 0.0 - 100.0 */ - XcmsFloat a_star; - XcmsFloat b_star; -} XcmsCIELab; - - /* - * CIE L*u*v* - */ -typedef struct { - XcmsFloat L_star; /* 0.0 - 100.0 */ - XcmsFloat u_star; - XcmsFloat v_star; -} XcmsCIELuv; - - /* - * TekHVC - */ -typedef struct { - XcmsFloat H; /* 0.0 - 360.0 */ - XcmsFloat V; /* 0.0 - 100.0 */ - XcmsFloat C; /* 0.0 - 100.0 */ -} XcmsTekHVC; - - /* - * PAD - */ -typedef struct { - XcmsFloat pad0; - XcmsFloat pad1; - XcmsFloat pad2; - XcmsFloat pad3; -} XcmsPad; - - - /* - * XCMS Color Structure - */ -typedef struct { - union { - XcmsRGB RGB; - XcmsRGBi RGBi; - XcmsCIEXYZ CIEXYZ; - XcmsCIEuvY CIEuvY; - XcmsCIExyY CIExyY; - XcmsCIELab CIELab; - XcmsCIELuv CIELuv; - XcmsTekHVC TekHVC; - XcmsPad Pad; - } spec; /* the color specification */ - unsigned long pixel; /* pixel value (as needed) */ - XcmsColorFormat format; /* the specification format */ -} XcmsColor; - - - /* - * XCMS Per Screen related data - */ - -typedef struct _XcmsPerScrnInfo { - XcmsColor screenWhitePt; /* Screen White point */ - XPointer functionSet; /* pointer to Screen Color Characterization */ - /* Function Set structure */ - XPointer screenData; /* pointer to corresponding Screen Color*/ - /* Characterization Data */ - unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */ - char pad[3]; -} XcmsPerScrnInfo; - -typedef struct _XcmsCCC *XcmsCCC; - -typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */ - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */ - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - - /* - * XCMS Color Conversion Context - */ -typedef struct _XcmsCCC { - Display *dpy; /* X Display */ - int screenNumber; /* X screen number */ - Visual *visual; /* X Visual */ - XcmsColor clientWhitePt; /* Client White Point */ - XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */ - XPointer gamutCompClientData; /* Gamut Comp Func Client Data */ - XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */ - XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */ - XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */ - /* associated with the above display */ - /* screenNumber */ -} XcmsCCCRec; - -typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */ - Display* /* dpy */, - int /* screen_number */, - XcmsPerScrnInfo* /* screen_info */ -); - -typedef void (*XcmsScreenFreeProc)( - XPointer /* screenData */ -); - - /* - * Function List Pointer -- pointer to an array of function pointers. - * The end of list is indicated by a NULL pointer. - */ -/* - * XXX: The use of the XcmsConversionProc type is broken. The - * device-independent colour conversion code uses it as: - -typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *, - unsigned int); - - * while the device-dependent code uses it as: - -typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int, - Bool *); - - * Until this is reworked, it's probably best to leave it unprotoized. - * The code works regardless. - */ -typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */ - XcmsCCC /* ccc */, - XcmsColor* /* pcolors_in_out */, - unsigned int /* ncolors */, - Bool* /* pCompressed */ - ); - -typedef Status (*XcmsDIConversionProc)( /* using device-independent version */ - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* pcolors_in_out */, - unsigned int /* ncolors */ - ); - -typedef XcmsDIConversionProc XcmsConversionProc; -typedef XcmsConversionProc *XcmsFuncListPtr; - -typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */ - char* /* color_string */, - XcmsColor* /* color_return */ -); - - /* - * Color Space -- per Color Space related data (Device-Independent - * or Device-Dependent) - */ -typedef struct _XcmsColorSpace { - const char *prefix; /* Prefix of string format. */ - XcmsColorFormat id; /* Format ID number. */ - XcmsParseStringProc parseString; - /* String format parsing function */ - XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */ - /* pointers such that when the */ - /* functions are executed in sequence */ - /* will convert a XcmsColor structure */ - /* from this color space to CIEXYZ */ - /* space. */ - XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */ - /* pointers such that when the */ - /* functions are executed in sequence */ - /* will convert a XcmsColor structure */ - /* from CIEXYZ space to this color */ - /* space. */ - int inverse_flag; /* If 1, indicates that for 0 <= i < n */ - /* where n is the number of function */ - /* pointers in the lists to_CIEXYZ */ - /* and from_CIEXYZ; for each function */ - /* to_CIEXYZ[i] its inverse function */ - /* is from_CIEXYZ[n - i]. */ - -} XcmsColorSpace; - - /* - * Screen Color Characterization Function Set -- per device class - * color space conversion functions. - */ -typedef struct _XcmsFunctionSet { - XcmsColorSpace **DDColorSpaces; - /* Pointer to an array of pointers to */ - /* Device-DEPENDENT color spaces */ - /* understood by this SCCFuncSet. */ - XcmsScreenInitProc screenInitProc; - /* Screen initialization function that */ - /* reads Screen Color Characterization*/ - /* Data off properties on the screen's*/ - /* root window. */ - XcmsScreenFreeProc screenFreeProc; - /* Function that frees the SCCData */ - /* structures. */ -} XcmsFunctionSet; - -_XFUNCPROTOBEGIN - -extern Status XcmsAddColorSpace ( - XcmsColorSpace* /* pColorSpace */ -); - -extern Status XcmsAddFunctionSet ( - XcmsFunctionSet* /* functionSet */ -); - -extern Status XcmsAllocColor ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* color_in_out */, - XcmsColorFormat /* result_format */ -); - -extern Status XcmsAllocNamedColor ( - Display* /* dpy */, - Colormap /* colormap */, - _Xconst char* /* color_string */, - XcmsColor* /* color_scrn_return */, - XcmsColor* /* color_exact_return */, - XcmsColorFormat /* result_format */ -); - -extern XcmsCCC XcmsCCCOfColormap ( - Display* /* dpy */, - Colormap /* colormap */ -); - -extern Status XcmsCIELabClipab( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELabClipL( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELabClipLab( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELabQueryMaxC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* L_star */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabQueryMaxL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabQueryMaxLC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabQueryMinL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELabToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIELabWhiteShiftColors( - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvClipL( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvClipLuv( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvClipuv( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIELuvQueryMaxC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* L_star */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvQueryMaxL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvQueryMaxLC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvQueryMinL ( - XcmsCCC /* ccc */, - XcmsFloat /* hue_angle */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsCIELuvToCIEuvY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIELuvWhiteShiftColors( - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIEXYZToCIELab ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEXYZToCIEuvY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEXYZToCIExyY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEXYZToRGBi ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsCIEuvYToCIELuv ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEuvYToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIEuvYToTekHVC ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsCIExyYToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern XcmsColor *XcmsClientWhitePointOfCCC ( - XcmsCCC /* ccc */ -); - -extern Status XcmsConvertColors ( - XcmsCCC /* ccc */, - XcmsColor* /* colorArry_in_out */, - unsigned int /* nColors */, - XcmsColorFormat /* targetFormat */, - Bool* /* compArry_return */ -); - -extern XcmsCCC XcmsCreateCCC ( - Display* /* dpy */, - int /* screenNumber */, - Visual* /* visual */, - XcmsColor* /* clientWhitePt */, - XcmsCompressionProc /* gamutCompProc */, - XPointer /* gamutCompClientData */, - XcmsWhiteAdjustProc /* whitePtAdjProc */, - XPointer /* whitePtAdjClientData */ -); - -extern XcmsCCC XcmsDefaultCCC ( - Display* /* dpy */, - int /* screenNumber */ -); - -extern Display *XcmsDisplayOfCCC ( - XcmsCCC /* ccc */ -); - -extern XcmsColorFormat XcmsFormatOfPrefix ( - char* /* prefix */ -); - -extern void XcmsFreeCCC ( - XcmsCCC /* ccc */ -); - -extern Status XcmsLookupColor ( - Display* /* dpy */, - Colormap /* colormap */, - _Xconst char* /* color_string */, - XcmsColor* /* pColor_exact_in_out */, - XcmsColor* /* pColor_scrn_in_out */, - XcmsColorFormat /* result_format */ -); - -extern char *XcmsPrefixOfFormat ( - XcmsColorFormat /* id */ -); - -extern Status XcmsQueryBlack ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryBlue ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryColor ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* pColor_in_out */, - XcmsColorFormat /* result_format */ -); - -extern Status XcmsQueryColors ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* colorArry_in_out */, - unsigned int /* nColors */, - XcmsColorFormat /* result_format */ -); - -extern Status XcmsQueryGreen ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryRed ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsQueryWhite ( - XcmsCCC /* ccc */, - XcmsColorFormat /* target_format */, - XcmsColor* /* color_return */ -); - -extern Status XcmsRGBiToCIEXYZ ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsRGBiToRGB ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsRGBToRGBi ( - XcmsCCC /* ccc */, - XcmsColor* /* colors */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern int XcmsScreenNumberOfCCC ( - XcmsCCC /* ccc */ -); - -extern XcmsColor *XcmsScreenWhitePointOfCCC ( - XcmsCCC /* ccc */ -); - -extern XcmsCCC XcmsSetCCCOfColormap( - Display* /* dpy */, - Colormap /* colormap */, - XcmsCCC /* ccc */ -); - -extern XcmsCompressionProc XcmsSetCompressionProc ( - XcmsCCC /* ccc */, - XcmsCompressionProc /* compression_proc */, - XPointer /* client_data */ -); - -extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( - XcmsCCC /* ccc */, - XcmsWhiteAdjustProc /* white_adjust_proc */, - XPointer /* client_data */ -); - -extern Status XcmsSetWhitePoint ( - XcmsCCC /* ccc */, - XcmsColor* /* color */ -); - -extern Status XcmsStoreColor ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* pColor_in */ -); - -extern Status XcmsStoreColors ( - Display* /* dpy */, - Colormap /* colormap */, - XcmsColor* /* colorArry_in */, - unsigned int /* nColors */, - Bool* /* compArry_return */ -); - -extern Status XcmsTekHVCClipC( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsTekHVCClipV( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsTekHVCClipVC( - XcmsCCC /* ccc */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - unsigned int /* index */, - Bool* /* compression_flags_return */ -); - -extern Status XcmsTekHVCQueryMaxC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsFloat /* value */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCQueryMaxV ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCQueryMaxVC ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCQueryMaxVSamples ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsColor* /* colors_return */, - unsigned int /* nsamples */ -); - -extern Status XcmsTekHVCQueryMinV ( - XcmsCCC /* ccc */, - XcmsFloat /* hue */, - XcmsFloat /* chroma */, - XcmsColor* /* color_return */ -); - -extern Status XcmsTekHVCToCIEuvY ( - XcmsCCC /* ccc */, - XcmsColor* /* white_point */, - XcmsColor* /* colors */, - unsigned int /* ncolors */ -); - -extern Status XcmsTekHVCWhiteShiftColors( - XcmsCCC /* ccc */, - XcmsColor* /* initial_white_point*/, - XcmsColor* /* target_white_point*/, - XcmsColorFormat /* target_format */, - XcmsColor* /* colors_in_out */, - unsigned int /* ncolors */, - Bool* /* compression_flags_return */ -); - -extern Visual *XcmsVisualOfCCC ( - XcmsCCC /* ccc */ -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) */ diff --git a/nx-X11/lib/X11/Xcms.txt b/nx-X11/lib/X11/Xcms.txt deleted file mode 100644 index 1c5b1adec..000000000 --- a/nx-X11/lib/X11/Xcms.txt +++ /dev/null @@ -1,44 +0,0 @@ -/* - * (c) Copyright 1990 1991 Tektronix Inc. - * All Rights Reserved - * - * 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 - * supporting documentation, and that the name of Tektronix not be used - * in advertising or publicity pertaining to distribution of the software - * without specific, written prior permission. - * - * Tektronix disclaims all warranties with regard to this software, including - * all implied warranties of merchantability and fitness, in no event shall - * Tektronix 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. - * - * - * NAME - * Xcms.txt - * - * DESCRIPTION - * Sample Color Name Database - * - */ - - -This device-independent color name database is provided just as an example. -There are no claims that these color specifications are or should be bound -to the corresponding color name. - -As you can see, the start of the database is indicated by "XCMS_COLORDB_START". -Anything before this is assumed to be comments. The "0.1" indicates the -version number of the format/syntax used in this file. The color name is -delimited from the color specification by one or more tabs. - -XCMS_COLORDB_START 0.1 -cms red CIEXYZ:0.3811/0.2073/0.0213 -cms green CIEXYZ:0.3203/0.6805/0.1430 -cms blue CIEXYZ:0.2483/0.1122/1.2417 -XCMS_COLORDB_END diff --git a/nx-X11/lib/X11/Xcmsint.h b/nx-X11/lib/X11/Xcmsint.h deleted file mode 100644 index 8a2decb11..000000000 --- a/nx-X11/lib/X11/Xcmsint.h +++ /dev/null @@ -1,260 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * DESCRIPTION - * Private include file for Color Management System. - * (i.e., for API internal use only) - * - */ - -#ifndef _XCMSINT_H_ -#define _XCMSINT_H_ - -#include - -/* - * DEFINES - */ - - /* - * Private Status Value - */ -#define _XCMS_NEWNAME -1 - - /* - * Color Space ID's are of XcmsColorFormat type. - * - * bit 31 - * 0 == Device-Independent - * 1 == Device-Dependent - * - * bit 30: - * 0 == Registered with X Consortium - * 1 == Unregistered - */ -#define XCMS_DD_ID(id) ((id) & (XcmsColorFormat)0x80000000) -#define XCMS_DI_ID(id) (!((id) & (XcmsColorFormat)0x80000000)) -#define XCMS_UNREG_ID(id) ((id) & (XcmsColorFormat)0x40000000) -#define XCMS_REG_ID(id) (!((id) & (XcmsColorFormat)0x40000000)) -#define XCMS_FIRST_REG_DI_ID (XcmsColorFormat)0x00000001 -#define XCMS_FIRST_UNREG_DI_ID (XcmsColorFormat)0x40000000 -#define XCMS_FIRST_REG_DD_ID (XcmsColorFormat)0x80000000 -#define XCMS_FIRST_UNREG_DD_ID (XcmsColorFormat)0xc0000000 - -/* - * TYPEDEFS - */ - - /* - * Structure for caching Colormap info. - * This is provided for the Xlib modifications to: - * XAllocNamedColor() - * XLookupColor() - * XParseColor() - * XStoreNamedColor() - */ -typedef struct _XcmsCmapRec { - Colormap cmapID; - Display *dpy; - Window windowID; - Visual *visual; - struct _XcmsCCC *ccc; - struct _XcmsCmapRec *pNext; -} XcmsCmapRec; - - /* - * Intensity Record (i.e., value / intensity tuple) - */ -typedef struct _IntensityRec { - unsigned short value; - XcmsFloat intensity; -} IntensityRec; - - /* - * Intensity Table - */ -typedef struct _IntensityTbl { - IntensityRec *pBase; - unsigned int nEntries; -} IntensityTbl; - - /* - * Structure for storing per-Visual Intensity Tables (aka gamma maps). - */ -typedef struct _XcmsIntensityMap { - VisualID visualID; - XPointer screenData; /* pointer to corresponding Screen Color*/ - /* Characterization Data */ - void (*pFreeScreenData)(XPointer pScreenDataTemp); /* Function that frees a Screen */ - /* structure. */ - struct _XcmsIntensityMap *pNext; -} XcmsIntensityMap; - - - /* - * Structure for storing "registered" color space prefix/ID - */ -typedef struct _XcmsRegColorSpaceEntry { - const char *prefix; /* Color Space prefix (e.g., "CIEXYZ:") */ - XcmsColorFormat id; /* Color Space ID (e.g., XcmsCIEXYZFormat) */ -} XcmsRegColorSpaceEntry; - - - /* - * Xcms Per Display (i.e. connection) related data - */ -typedef struct _XcmsPerDpyInfo { - - XcmsCCC paDefaultCCC; /* based on default visual of screen */ - /* - * Pointer to an array of XcmsCCC structures, one for - * each screen. - */ - XcmsCmapRec *pClientCmaps; /* Pointer to linked list of XcmsCmapRec's */ - -} XcmsPerDpyInfo, *XcmsPerDpyInfoPtr; - -/* - * DEFINES - */ - -#define XDCCC_NUMBER 0x8000000L /* 2**27 per XDCCC */ - -#ifdef GRAY -#define XDCCC_SCREENWHITEPT_ATOM_NAME "XDCCC_GRAY_SCREENWHITEPOINT" -#define XDCCC_GRAY_CORRECT_ATOM_NAME "XDCCC_GRAY_CORRECTION" -#endif /* GRAY */ - -#ifndef _ConversionValues -typedef struct _ConversionValues { - IntensityTbl IntensityTbl; -} ConversionValues; -#endif - -#ifdef GRAY -typedef struct { - IntensityTbl *IntensityTbl; -} GRAY_SCCData; -#endif /* GRAY */ - -/* - * DEFINES - */ - -#define XDCCC_MATRIX_ATOM_NAME "XDCCC_LINEAR_RGB_MATRICES" -#define XDCCC_CORRECT_ATOM_NAME "XDCCC_LINEAR_RGB_CORRECTION" - -typedef struct { - XcmsFloat XYZtoRGBmatrix[3][3]; - XcmsFloat RGBtoXYZmatrix[3][3]; - IntensityTbl *pRedTbl; - IntensityTbl *pGreenTbl; - IntensityTbl *pBlueTbl; -} LINEAR_RGB_SCCData; - -/* function prototypes */ -extern XcmsCmapRec * -_XcmsAddCmapRec( - Display *dpy, - Colormap cmap, - Window windowID, - Visual *visual); -extern void -_XcmsRGB_to_XColor( - XcmsColor *pColors, - XColor *pXColors, - unsigned int nColors); -extern Status -_XcmsResolveColorString ( - XcmsCCC ccc, - const char **color_string, - XcmsColor *pColor_exact_return, - XcmsColorFormat result_format); -extern void -_XUnresolveColor( - XcmsCCC ccc, - XColor *pXColor); -/* - * DESCRIPTION - * Include file for defining the math macros used in the - * XCMS source. Instead of using math library routines - * directly, XCMS uses macros so that based on the - * definitions here, vendors and sites can specify exactly - * what routine will be called (those from libm.a or their - * custom routines). If not defined to math library routines - * (e.g., sqrt in libm.a), then the client is not forced to - * be linked with -lm. - */ - -#define XCMS_ATAN(x) _XcmsArcTangent(x) -#define XCMS_COS(x) _XcmsCosine(x) -#define XCMS_CUBEROOT(x) _XcmsCubeRoot(x) -#define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) -#define XCMS_SIN(x) _XcmsSine(x) -#define XCMS_SQRT(x) _XcmsSquareRoot(x) -#define XCMS_TAN(x) (XCMS_SIN(x) / XCMS_COS(x)) - -double _XcmsArcTangent(double a); -double _XcmsCosine(double a); -double _XcmsCubeRoot(double a); -double _XcmsSine(double a); -double _XcmsSquareRoot(double a); - -/* - * DEFINES FOR GAMUT COMPRESSION AND QUERY ROUTINES - */ -#ifndef PI -# ifdef M_PI -# define PI M_PI -# else -# define PI 3.14159265358979323846264338327950 -# endif /* M_PI */ -#endif /* PI */ -#ifndef degrees -# define degrees(r) ((XcmsFloat)(r) * 180.0 / PI) -#endif /* degrees */ -#ifndef radians -# define radians(d) ((XcmsFloat)(d) * PI / 180.0) -#endif /* radians */ - -#define XCMS_CIEUSTAROFHUE(h,c) \ -((XCMS_COS((h)) == 0.0) ? (XcmsFloat)0.0 : (XcmsFloat) \ -((XcmsFloat)(c) / (XcmsFloat)XCMS_SQRT((XCMS_TAN(h) * XCMS_TAN(h)) + \ -(XcmsFloat)1.0))) -#define XCMS_CIEVSTAROFHUE(h,c) \ -((XCMS_COS((h)) == 0.0) ? (XcmsFloat)0.0 : (XcmsFloat) \ -((XcmsFloat)(c) / (XcmsFloat)XCMS_SQRT(((XcmsFloat)1.0 / \ -(XcmsFloat)(XCMS_TAN(h) * XCMS_TAN(h))) + (XcmsFloat)1.0))) -/* this hue is returned in radians */ -#define XCMS_CIELUV_PMETRIC_HUE(u,v) \ -(((u) != 0.0) ? XCMS_ATAN( (v) / (u)) : ((v >= 0.0) ? PI / 2 : -(PI / 2))) -#define XCMS_CIELUV_PMETRIC_CHROMA(u,v) XCMS_SQRT(((u)*(u)) + ((v)*(v))) - -#define XCMS_CIEASTAROFHUE(h,c) XCMS_CIEUSTAROFHUE((h), (c)) -#define XCMS_CIEBSTAROFHUE(h,c) XCMS_CIEVSTAROFHUE((h), (c)) -#define XCMS_CIELAB_PMETRIC_HUE(a,b) XCMS_CIELUV_PMETRIC_HUE((a), (b)) -#define XCMS_CIELAB_PMETRIC_CHROMA(a,b) XCMS_CIELUV_PMETRIC_CHROMA((a), (b)) - -#endif /* _XCMSINT_H_ */ diff --git a/nx-X11/lib/X11/XimImSw.h b/nx-X11/lib/X11/XimImSw.h deleted file mode 100644 index e3a962552..000000000 --- a/nx-X11/lib/X11/XimImSw.h +++ /dev/null @@ -1,46 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifndef _XIMIMSW_H -#define _XIMIMSW_H - -typedef struct { - Bool (*checkprocessing)( - Xim im - ); - Bool (*im_open)( - Xim im - ); - void (*im_free)( - Xim im - ); -} XimImsportSW; - -extern XimImsportSW _XimImSportRec[]; - -#endif /* _XIMIMSW_H */ diff --git a/nx-X11/lib/X11/XimProto.h b/nx-X11/lib/X11/XimProto.h deleted file mode 100644 index 6b0096dd6..000000000 --- a/nx-X11/lib/X11/XimProto.h +++ /dev/null @@ -1,226 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifndef _XIMPROTO_H -#define _XIMPROTO_H - -/* - * Default Preconnection selection target - */ -#define XIM_SERVERS "XIM_SERVERS" -#define XIM_LOCALES "LOCALES" -#define XIM_TRANSPORT "TRANSPORT" - -/* - * categories in XIM_SERVERS - */ -#define XIM_SERVER_CATEGORY "@server=" -#define XIM_LOCAL_CATEGORY "@locale=" -#define XIM_TRANSPORT_CATEGORY "@transport=" - -/* - * Xim implementation revision - */ -#define PROTOCOLMAJORVERSION 1 -#define PROTOCOLMINORVERSION 0 - -/* - * Major Protocol number - */ -#define XIM_CONNECT 1 -#define XIM_CONNECT_REPLY 2 -#define XIM_DISCONNECT 3 -#define XIM_DISCONNECT_REPLY 4 - -#define XIM_AUTH_REQUIRED 10 -#define XIM_AUTH_REPLY 11 -#define XIM_AUTH_NEXT 12 -#define XIM_AUTH_SETUP 13 -#define XIM_AUTH_NG 14 - -#define XIM_ERROR 20 - -#define XIM_OPEN 30 -#define XIM_OPEN_REPLY 31 -#define XIM_CLOSE 32 -#define XIM_CLOSE_REPLY 33 -#define XIM_REGISTER_TRIGGERKEYS 34 -#define XIM_TRIGGER_NOTIFY 35 -#define XIM_TRIGGER_NOTIFY_REPLY 36 -#define XIM_SET_EVENT_MASK 37 -#define XIM_ENCODING_NEGOTIATION 38 -#define XIM_ENCODING_NEGOTIATION_REPLY 39 -#define XIM_QUERY_EXTENSION 40 -#define XIM_QUERY_EXTENSION_REPLY 41 -#define XIM_SET_IM_VALUES 42 -#define XIM_SET_IM_VALUES_REPLY 43 -#define XIM_GET_IM_VALUES 44 -#define XIM_GET_IM_VALUES_REPLY 45 - -#define XIM_CREATE_IC 50 -#define XIM_CREATE_IC_REPLY 51 -#define XIM_DESTROY_IC 52 -#define XIM_DESTROY_IC_REPLY 53 -#define XIM_SET_IC_VALUES 54 -#define XIM_SET_IC_VALUES_REPLY 55 -#define XIM_GET_IC_VALUES 56 -#define XIM_GET_IC_VALUES_REPLY 57 -#define XIM_SET_IC_FOCUS 58 -#define XIM_UNSET_IC_FOCUS 59 -#define XIM_FORWARD_EVENT 60 -#define XIM_SYNC 61 -#define XIM_SYNC_REPLY 62 -#define XIM_COMMIT 63 -#define XIM_RESET_IC 64 -#define XIM_RESET_IC_REPLY 65 - -#define XIM_GEOMETRY 70 -#define XIM_STR_CONVERSION 71 -#define XIM_STR_CONVERSION_REPLY 72 -#define XIM_PREEDIT_START 73 -#define XIM_PREEDIT_START_REPLY 74 -#define XIM_PREEDIT_DRAW 75 -#define XIM_PREEDIT_CARET 76 -#define XIM_PREEDIT_CARET_REPLY 77 -#define XIM_PREEDIT_DONE 78 -#define XIM_STATUS_START 79 -#define XIM_STATUS_DRAW 80 -#define XIM_STATUS_DONE 81 -#define XIM_PREEDITSTATE 82 - -/* - * values for the flag of XIM_ERROR - */ -#define XIM_IMID_VALID 0x0001 -#define XIM_ICID_VALID 0x0002 - -/* - * XIM Error Code - */ -#define XIM_BadAlloc 1 -#define XIM_BadStyle 2 -#define XIM_BadClientWindow 3 -#define XIM_BadFocusWindow 4 -#define XIM_BadArea 5 -#define XIM_BadSpotLocation 6 -#define XIM_BadColormap 7 -#define XIM_BadAtom 8 -#define XIM_BadPixel 9 -#define XIM_BadPixmap 10 -#define XIM_BadName 11 -#define XIM_BadCursor 12 -#define XIM_BadProtocol 13 -#define XIM_BadForeground 14 -#define XIM_BadBackground 15 -#define XIM_LocaleNotSupported 16 -#define XIM_BadSomething 999 - -/* - * byte order - */ -#define BIGENDIAN (CARD8)0x42 /* MSB first */ -#define LITTLEENDIAN (CARD8)0x6c /* LSB first */ - -/* - * values for the type of XIMATTR & XICATTR - */ -#define XimType_SeparatorOfNestedList 0 -#define XimType_CARD8 1 -#define XimType_CARD16 2 -#define XimType_CARD32 3 -#define XimType_STRING8 4 -#define XimType_Window 5 -#define XimType_XIMStyles 10 -#define XimType_XRectangle 11 -#define XimType_XPoint 12 -#define XimType_XFontSet 13 -#define XimType_XIMOptions 14 -#define XimType_XIMHotKeyTriggers 15 -#define XimType_XIMHotKeyState 16 -#define XimType_XIMStringConversion 17 -#define XimType_NEST 0x7fff - -/* - * values for the category of XIM_ENCODING_NEGITIATON_REPLY - */ -#define XIM_Encoding_NameCategory 0 -#define XIM_Encoding_DetailCategory 1 - -/* - * value for the index of XIM_ENCODING_NEGITIATON_REPLY - */ -#define XIM_Default_Encoding_IDX -1 - -/* - * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT - */ -#define XimSYNCHRONUS 0x0001 -#define XimLookupChars 0x0002 -#define XimLookupKeySym 0x0004 -#define XimLookupBoth 0x0006 - -/* - * request packet header size - */ -#define XIM_HEADER_SIZE \ - sizeof(CARD8) /* sizeof mejor-opcode */ \ - + sizeof(CARD8) /* sizeof minor-opcode */ \ - + sizeof(INT16) /* sizeof length */ - -/* - * Client Message data size - */ -#define XIM_CM_DATA_SIZE 20 - -/* - * XIM data structure - */ -typedef CARD16 BITMASK16; -typedef CARD32 BITMASK32; -typedef CARD32 EVENTMASK; - -typedef CARD16 XIMID; /* Input Method ID */ -typedef CARD16 XICID; /* Input Context ID */ - -/* - * Padding macro - */ -#define XIM_PAD(length) ((4 - ((length) % 4)) % 4) - -#define XIM_SET_PAD(ptr, length) \ - { \ - register int Counter = XIM_PAD((int)length); \ - if (Counter) { \ - register char *Ptr = (char *)(ptr) + (length); \ - length += Counter; \ - for (; Counter; --Counter, ++Ptr) \ - *Ptr = '\0'; \ - } \ - } - -#endif /* _XIMPROTO_H */ diff --git a/nx-X11/lib/X11/XimThai.h b/nx-X11/lib/X11/XimThai.h deleted file mode 100644 index 7cc238311..000000000 --- a/nx-X11/lib/X11/XimThai.h +++ /dev/null @@ -1,110 +0,0 @@ -/*********************************************************** - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -/* -**++ -** FACILITY: -** -** Xlib -** -** ABSTRACT: -** -** Definition file for Thai specific functions. -** -** MODIFICATION HISTORY: -** -**/ - -#ifndef _XIMTHAI_H_ -#define _XIMTHAI_H_ - -#include - -/* Classification of characters in TIS620 according to WTT */ - -#define CTRL 0 /* control chars */ -#define NON 1 /* non composibles */ -#define CONS 2 /* consonants */ -#define LV 3 /* leading vowels */ -#define FV1 4 /* following vowels */ -#define FV2 5 -#define FV3 6 -#define BV1 7 /* below vowels */ -#define BV2 8 -#define BD 9 /* below diacritics */ -#define TONE 10 /* tonemarks */ -#define AD1 11 /* above diacritics */ -#define AD2 12 -#define AD3 13 -#define AV1 14 /* above vowels */ -#define AV2 15 -#define AV3 16 - - -/* extended classification */ - -#define DEAD 17 /* group of non-spacing characters */ - - -/* display levels in display cell */ - -#define NONDISP 0 /* non displayable */ -#define TOP 1 -#define ABOVE 2 -#define BASE 3 -#define BELOW 4 - - -/* Input Sequence Check modes */ - -#define WTT_ISC1 1 /* WTT default ISC mode */ -#define WTT_ISC2 2 /* WTT strict ISC mode */ -#define THAICAT_ISC 3 /* THAICAT ISC mode */ -#define NOISC 255 /* No ISC */ - - -#endif /* _XIMTHAI_H_ */ diff --git a/nx-X11/lib/X11/XimTrInt.h b/nx-X11/lib/X11/XimTrInt.h deleted file mode 100644 index bceab9886..000000000 --- a/nx-X11/lib/X11/XimTrInt.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifndef _XIMTRINT_H -#define _XIMTRINT_H - -#include "Ximint.h" - -typedef struct { - const char *transportname; - Bool (*config)( - Xim, - char * - ); -} TransportSW; - -extern TransportSW _XimTransportRec[]; - -/* - * Global symbols - */ - -extern Bool _XimXConf( - Xim im, - char *address -); - -#if defined(TCPCONN) || defined(UNIXCONN) - -extern Bool _XimTransConf( - Xim im, - char *address -); - -#endif - -#endif /* _XIMTRINT_H */ diff --git a/nx-X11/lib/X11/XimTrX.h b/nx-X11/lib/X11/XimTrX.h deleted file mode 100644 index 198d5fa5f..000000000 --- a/nx-X11/lib/X11/XimTrX.h +++ /dev/null @@ -1,85 +0,0 @@ -/* - * Copyright 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifndef _XIMTRX_H -#define _XIMTRX_H - -typedef struct _XIntrCallbackRec *XIntrCallbackPtr; - -typedef struct _XIntrCallbackRec { - Bool (*func)( - Xim, INT16, XPointer, XPointer -); - XPointer call_data; - XIntrCallbackPtr next; -} XIntrCallbackRec ; - -typedef struct _XSpecRec { - XIntrCallbackPtr intr_cb; - Atom imconnectid; - Atom improtocolid; - Atom immoredataid; - Window lib_connect_wid; - Window ims_connect_wid; - XPointer ev; - CARD32 major_code; - CARD32 minor_code; - CARD32 BoundarySize; -} XSpecRec; - -#define _XIM_PROTOCOL "_XIM_PROTOCOL" -#define _XIM_XCONNECT "_XIM_XCONNECT" -#define _XIM_MOREDATA "_XIM_MOREDATA" - -#define MAJOR_TRANSPORT_VERSION 0 -#define MINOR_TRANSPORT_VERSION 0 - -#endif /* _XIMTRX_H */ diff --git a/nx-X11/lib/X11/XimTrans.h b/nx-X11/lib/X11/XimTrans.h deleted file mode 100644 index 8c3aa829a..000000000 --- a/nx-X11/lib/X11/XimTrans.h +++ /dev/null @@ -1,136 +0,0 @@ -/* - * Copyright 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifndef _XIMTRANS_H -#define _XIMTRANS_H - -typedef struct _TransIntrCallbackRec *TransIntrCallbackPtr; - -typedef struct _TransIntrCallbackRec { - Bool (*func)( - Xim, INT16, XPointer, XPointer - ); - XPointer call_data; - TransIntrCallbackPtr next; -} TransIntrCallbackRec ; - -typedef struct { - TransIntrCallbackPtr intr_cb; - struct _XtransConnInfo *trans_conn; /* transport connection object */ - int fd; - char *address; - Window window; - Bool is_putback; -} TransSpecRec; - - -/* - * Prototypes - */ - -extern Bool _XimTransRegisterDispatcher( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data -); - - -extern Bool _XimTransIntrCallback( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data -); - -extern Bool _XimTransCallDispatcher( - Xim im, - INT16 len, - XPointer data -); - -extern void _XimFreeTransIntrCallback( - Xim im -); - -extern Bool _XimTransFilterWaitEvent( - Display *d, - Window w, - XEvent *ev, - XPointer arg -); - -extern void _XimTransInternalConnection( - Display *d, - int fd, - XPointer arg -); - -extern Bool _XimTransWrite( - Xim im, - INT16 len, - XPointer data -); - -extern Bool _XimTransRead( - Xim im, - XPointer recv_buf, - int buf_len, - int *ret_len -); - -extern void _XimTransFlush( - Xim im -); - -#endif /* _XIMTRANS__H */ diff --git a/nx-X11/lib/X11/Ximint.h b/nx-X11/lib/X11/Ximint.h deleted file mode 100644 index 9550c6851..000000000 --- a/nx-X11/lib/X11/Ximint.h +++ /dev/null @@ -1,995 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993, 1994 by Sony Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED and -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. - -FUJITSU LIMITED AND SONY CORPORATION DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND -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. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Motifier: Makoto Wakamatsu Sony Corporation - makoto@sm.sony.co.jp - -******************************************************************/ - -#ifndef _XIMINT_H -#define _XIMINT_H - -#include -#include - -typedef struct _Xim *Xim; -typedef struct _Xic *Xic; - -/* - * Input Method data - */ -#include "XimintP.h" -#include "XimintL.h" - -/* - * XIM dependent data - */ - -typedef struct _XimCommonPrivateRec { - /* This struct is also inlined in XimLocalPrivateRec, XimProtoPrivateRec. */ - XlcConv ctom_conv; - XlcConv ctow_conv; - XlcConv ctoutf8_conv; - XlcConv cstomb_conv; - XlcConv cstowc_conv; - XlcConv cstoutf8_conv; - XlcConv ucstoc_conv; - XlcConv ucstoutf8_conv; -} XimCommonPrivateRec; - -typedef union _XIMPrivateRec { - XimCommonPrivateRec common; - XimLocalPrivateRec local; - XimProtoPrivateRec proto; -} XIMPrivateRec; - -/* - * IM struct - */ -typedef struct _Xim { - XIMMethods methods; - XIMCoreRec core; - XIMPrivateRec private; -} XimRec; - -/* - * IC deprndent data - */ -typedef union _XICPrivateRec { - XicLocalPrivateRec local; - XicProtoPrivateRec proto; -} XICPrivateRec; - -/* - * IC struct - */ -typedef struct _Xic { - XICMethods methods; - XICCoreRec core; - XICPrivateRec private; -} XicRec; - -typedef struct _XimDefIMValues { - XIMValuesList *im_values_list; - XIMValuesList *ic_values_list; - XIMStyles *styles; - XIMCallback destroy_callback; - char *res_name; - char *res_class; - Bool visible_position; -} XimDefIMValues; - -typedef struct _XimDefICValues { - XIMStyle input_style; - Window client_window; - Window focus_window; - unsigned long filter_events; - XICCallback geometry_callback; - char *res_name; - char *res_class; - XICCallback destroy_callback; - XICCallback preedit_state_notify_callback; - XICCallback string_conversion_callback; - XIMStringConversionText string_conversion; - XIMResetState reset_state; - XIMHotKeyTriggers *hotkey; - XIMHotKeyState hotkey_state; - ICPreeditAttributes preedit_attr; - ICStatusAttributes status_attr; -} XimDefICValues; - -#define XIM_MODE_IM_GET (1 << 0) -#define XIM_MODE_IM_SET (1 << 1) -#define XIM_MODE_IM_DEFAULT (1 << 2) - -#define XIM_MODE_PRE_GET (1 << 0) -#define XIM_MODE_PRE_SET (1 << 1) -#define XIM_MODE_PRE_CREATE (1 << 2) -#define XIM_MODE_PRE_ONCE (1 << 3) -#define XIM_MODE_PRE_DEFAULT (1 << 4) - -#define XIM_MODE_STS_GET (1 << 5) -#define XIM_MODE_STS_SET (1 << 6) -#define XIM_MODE_STS_CREATE (1 << 7) -#define XIM_MODE_STS_ONCE (1 << 8) -#define XIM_MODE_STS_DEFAULT (1 << 9) - -#define XIM_MODE_IC_GET (XIM_MODE_PRE_GET | XIM_MODE_STS_GET) -#define XIM_MODE_IC_SET (XIM_MODE_PRE_SET | XIM_MODE_STS_SET) -#define XIM_MODE_IC_CREATE (XIM_MODE_PRE_CREATE | XIM_MODE_STS_CREATE) -#define XIM_MODE_IC_ONCE (XIM_MODE_PRE_ONCE | XIM_MODE_STS_ONCE) -#define XIM_MODE_IC_DEFAULT (XIM_MODE_PRE_DEFAULT | XIM_MODE_STS_DEFAULT) - -#define XIM_MODE_PRE_MASK (XIM_MODE_PRE_GET | XIM_MODE_PRE_SET | \ - XIM_MODE_PRE_CREATE | XIM_MODE_PRE_ONCE | \ - XIM_MODE_PRE_DEFAULT) -#define XIM_MODE_STS_MASK (XIM_MODE_STS_GET | XIM_MODE_STS_SET | \ - XIM_MODE_STS_CREATE | XIM_MODE_STS_ONCE | \ - XIM_MODE_STS_DEFAULT) - -#define XIM_SETIMDEFAULTS (1L << 0) -#define XIM_SETIMVALUES (1L << 1) -#define XIM_GETIMVALUES (1L << 2) - -#define XIM_SETICDEFAULTS (1L << 0) -#define XIM_CREATEIC (1L << 1) -#define XIM_SETICVALUES (1L << 2) -#define XIM_GETICVALUES (1L << 3) -#define XIM_PREEDIT_ATTR (1L << 4) -#define XIM_STATUS_ATTR (1L << 5) - -#define XIM_CHECK_VALID 0 -#define XIM_CHECK_INVALID 1 -#define XIM_CHECK_ERROR 2 - -#define FILTERD True -#define NOTFILTERD False - -#define XIMMODIFIER "@im=" - -#define XIM_TRUE True -#define XIM_FALSE False -#define XIM_OVERFLOW (-1) - -#define BRL_UC_ROW 0x2800 - -/* - * Global symbols - */ - -XPointer _XimGetLocaleCode ( - const char *encoding_name -); - -int _XimGetCharCode ( - XPointer conv, - KeySym keysym, - unsigned char *buf, - int nbytes -); - -unsigned int KeySymToUcs4 ( - KeySym keysym -); - -extern Bool _XimSetIMResourceList( - XIMResourceList *res_list, - unsigned int *list_num -); - -extern Bool _XimSetICResourceList( - XIMResourceList *res_list, - unsigned int *list_num -); - -extern Bool _XimSetInnerIMResourceList( - XIMResourceList *res_list, - unsigned int *list_num -); - -extern Bool _XimSetInnerICResourceList( - XIMResourceList *res_list, - unsigned int *list_num -); - -extern Bool _XimCheckCreateICValues( - XIMResourceList res_list, - unsigned int list_num -); - -extern XIMResourceList _XimGetResourceListRec( - XIMResourceList res_list, - unsigned int list_num, - const char *name -); - -extern void _XimSetIMMode( - XIMResourceList res_list, - unsigned int list_num -); - -extern void _XimSetICMode( - XIMResourceList res_list, - unsigned int list_num, - XIMStyle style -); - -extern int _XimCheckIMMode( - XIMResourceList res_list, - unsigned long mode -); - -extern int _XimCheckICMode( - XIMResourceList res_list, - unsigned long mode -); - -extern Bool _XimSetLocalIMDefaults( - Xim im, - XPointer top, - XIMResourceList res_list, - unsigned int list_num -); - -extern Bool _XimSetICDefaults( - Xic ic, - XPointer top, - unsigned long mode, - XIMResourceList res_list, - unsigned int list_num -); - -extern Bool _XimEncodeLocalIMAttr( - XIMResourceList res, - XPointer top, - XPointer val -); - -extern Bool _XimEncodeLocalICAttr( - Xic ic, - XIMResourceList res, - XPointer top, - XIMArg *arg, - unsigned long mode -); - -extern Bool _XimCheckLocalInputStyle( - Xic ic, - XPointer top, - XIMArg *values, - XIMStyles *styles, - XIMResourceList res_list, - unsigned int list_num -); - -extern Bool _XimDecodeLocalIMAttr( - XIMResourceList res, - XPointer top, - XPointer val -); - -extern Bool _XimDecodeLocalICAttr( - XIMResourceList res, - XPointer top, - XPointer val, - unsigned long mode -); - -extern void _XimGetCurrentIMValues( - Xim im, - XimDefIMValues *im_values -); - -extern void _XimSetCurrentIMValues( - Xim im, - XimDefIMValues *im_values -); - -extern void _XimGetCurrentICValues( - Xic ic, - XimDefICValues *ic_values -); - -extern void _XimSetCurrentICValues( - Xic ic, - XimDefICValues *ic_values -); - -extern void _XimInitialResourceInfo( - void -); - -extern void _XimParseStringFile( - FILE *fp, - Xim im -); - -extern Bool _XimCheckIfLocalProcessing( - Xim im -); - -extern Bool _XimCheckIfThaiProcessing( - Xim im -); - -extern Bool _XimLocalOpenIM( - Xim im -); - -extern Bool _XimThaiOpenIM( - Xim im -); - -extern Bool _XimProtoOpenIM( - Xim im -); - -extern void _XimLocalIMFree( - Xim im -); - -extern void _XimThaiIMFree( - Xim im -); - -extern void _XimProtoIMFree( - Xim im -); - -extern char * _XimSetIMValueData( - Xim im, - XPointer top, - XIMArg *arg, - XIMResourceList res_list, - unsigned int list_num -); - -extern char * _XimGetIMValueData( - Xim im, - XPointer top, - XIMArg *arg, - XIMResourceList res_list, - unsigned int list_num -); - -extern char * _XimSetICValueData( - Xic ic, - XPointer top, - XIMResourceList res_list, - unsigned int list_num, - XIMArg *arg, - unsigned long mode, - Bool flag -); - -extern char * _XimGetICValueData( - Xic ic, - XPointer top, - XIMResourceList res_list, - unsigned int list_num, - XIMArg *arg, - unsigned long mode -); - -extern char * _XimLocalSetIMValues( - XIM im, - XIMArg *arg -); - -extern char * _XimLocalGetIMValues( - XIM im, - XIMArg *arg -); - -extern XIC _XimLocalCreateIC( - XIM im, - XIMArg *arg -); - -extern Bool _XimDispatchInit( - Xim im -); - -extern Bool _XimGetAttributeID( - Xim im, - CARD16 *buf -); - -extern Bool _XimExtension( - Xim im -); - -extern void _XimDestroyIMStructureList( - Xim im -); - -extern char * _XimMakeIMAttrIDList( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - CARD16 *buf, - INT16 *len, - unsigned long mode -); - -extern char * _XimMakeICAttrIDList( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - CARD16 *idList, - INT16 *num, - unsigned long mode -); - -extern char * _XimDecodeIMATTRIBUTE( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - CARD16 *buf, - INT16 buf_len, - XIMArg *arg, - BITMASK32 mode -); - -extern char * _XimDecodeICATTRIBUTE( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - CARD16 *buf, - INT16 buf_len, - XIMArg *arg, - BITMASK32 mode -); - -extern Bool _XimRegProtoIntrCallback( - Xim im, - CARD16 major_code, - CARD16 minor_code, - Bool (*proc)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data -); - -extern Bool _XimErrorCallback( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern Bool _XimError( - Xim im, - Xic ic, - CARD16 error_code, - INT16 detail_length, - CARD16 type, - char *detail -); - -extern Bool _XimRegisterTriggerKeysCallback( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern Bool _XimSetEventMaskCallback( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern Bool _XimForwardEventCallback( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern Bool _XimCommitCallback( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern Bool _XimSyncCallback( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern void _XimFreeProtoIntrCallback( - Xim im -); - -extern XIC _XimProtoCreateIC( - XIM im, - XIMArg *arg -); - -extern void _XimRegisterServerFilter( - Xim im -); - -extern void _XimUnregisterServerFilter( - Xim im -); - -extern Bool _XimTriggerNotify( - Xim im, - Xic ic, - int mode, - CARD32 idx -); - -extern Bool _XimProcSyncReply( - Xim im, - Xic ic -); - -extern void _XimSendSetFocus( - Xim im, - Xic ic -); - -extern Bool _XimForwardEvent( - Xic ic, - XEvent *ev, - Bool sync -); - -extern void _XimFreeRemakeArg( - XIMArg *arg -); - -extern void _XimServerDestroy( - Xim im -); - -extern char * _XimEncodeIMATTRIBUTE( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - XIMArg **arg_ret, - char *buf, - int size, - int *ret_len, - XPointer top, - unsigned long mode -); - -extern char * _XimEncodeICATTRIBUTE( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - XIMArg **arg_ret, - char *buf, - int size, - int *ret_len, - XPointer top, - BITMASK32 *flag, - unsigned long mode -); - -#ifdef EXT_MOVE -extern Bool _XimExtenMove( - Xim im, - Xic ic, - CARD32 flag, - CARD16 *buf, - INT16 length -); -#endif - -extern int _Ximctstombs( - XIM im, - char *from, - int from_len, - char *to, - int to_len, - Status *state -); - -extern int _Ximctstowcs( - XIM im, - char *from, - int from_len, - wchar_t *to, - int to_len, - Status *state -); - -extern int _Ximctstoutf8( - XIM im, - char *from, - int from_len, - char *to, - int to_len, - Status *state -); - -extern int _XimLcctstombs( - XIM im, - char *from, - int from_len, - char *to, - int to_len, - Status *state -); - -extern int _XimLcctstowcs( - XIM im, - char *from, - int from_len, - wchar_t *to, - int to_len, - Status *state -); - -extern int _XimLcctstoutf8( - XIM im, - char *from, - int from_len, - char *to, - int to_len, - Status *state -); - -extern char _XimGetMyEndian( - void -); - -extern int _XimCheckDataSize( - XPointer buf, - int len -); - -extern void _XimSetHeader( - XPointer buf, - CARD8 major_opcode, - CARD8 minor_opcode, - INT16 *len -); - -extern Bool _XimSync( - Xim im, - Xic ic -); - -extern int _XimProtoMbLookupString( - XIC xic, - XKeyEvent *ev, - char *buffer, - int bytes, - KeySym *keysym, - Status *state -); - -extern int _XimProtoWcLookupString( - XIC xic, - XKeyEvent *ev, - wchar_t *buffer, - int bytes, - KeySym *keysym, - Status *state -); - -extern int _XimProtoUtf8LookupString( - XIC xic, - XKeyEvent *ev, - char *buffer, - int bytes, - KeySym *keysym, - Status *state -); - -extern void _XimRegisterFilter( - Xic ic -); - -extern void _XimUnregisterFilter( - Xic ic -); - -extern void _XimReregisterFilter( - Xic ic -); - -extern Status _XimProtoEventToWire( - XEvent *re, - xEvent *event, - Bool sw -); - -extern Bool _XimProtoWireToEvent( - XEvent *re, - xEvent *event, - Bool sw -); - -#ifdef EXT_FORWARD -extern Bool _XimExtForwardKeyEvent( - Xic ic, - XKeyEvent *ev, - Bool sync -); -#endif - -extern int _XimLookupMBText( - Xic ic, - XKeyEvent *event, - char *buffer, - int nbytes, - KeySym *keysym, - XComposeStatus *status -); - -extern int _XimLookupWCText( - Xic ic, - XKeyEvent *event, - wchar_t *buffer, - int nbytes, - KeySym *keysym, - XComposeStatus *status -); - -extern int _XimLookupUTF8Text( - Xic ic, - XKeyEvent *event, - char *buffer, - int nbytes, - KeySym *keysym, - XComposeStatus *status -); - -extern EVENTMASK _XimGetWindowEventmask( - Xic ic -); - -extern Xic _XimICOfXICID( - Xim im, - XICID icid -); - -extern void _XimResetIMInstantiateCallback( - Xim xim -); - -extern Bool _XimRegisterIMInstantiateCallback( - XLCd lcd, - Display *display, - XrmDatabase rdb, - char *res_name, - char *res_class, - XIDProc callback, - XPointer client_data -); - -extern Bool _XimUnRegisterIMInstantiateCallback( - XLCd lcd, - Display *display, - XrmDatabase rdb, - char *res_name, - char *res_class, - XIDProc callback, - XPointer client_data -); - -extern void _XimFreeCommitInfo( - Xic ic -); - -extern Bool _XimConnect( - Xim im -); - -extern Bool _XimShutdown( - Xim im -); - -extern Bool _XimWrite( - Xim im, - INT16 len, - XPointer data -); - -extern Bool _XimRead( - Xim im, - INT16 *len, - XPointer data, - int data_len, - Bool (*predicate)( - Xim, INT16, XPointer, XPointer - ), - XPointer arg -); - -extern void _XimFlush( - Xim im -); - -extern Bool _XimFilterWaitEvent( - Xim im -); - -extern void _XimProcError( - Xim im, - Xic ic, - XPointer data -); - -#ifdef EXT_MOVE -extern CARD32 _XimExtenArgCheck( - XIMArg *arg -); -#endif - -extern Bool _XimCbDispatch( - Xim im, - INT16 len, - XPointer data, - XPointer call_data -); - -extern Bool _XimLocalFilter( - Display *d, - Window w, - XEvent *ev, - XPointer client_data -); - -extern XIMResourceList _XimGetResourceListRecByQuark( - XIMResourceList res_list, - unsigned int list_num, - XrmQuark quark -); - -extern Bool _XimReconnectModeCreateIC( - Xic ic -); - -extern char *_XimLocalSetICValues( - XIC ic, - XIMArg *values -); - -extern char * _XimLocalGetICValues( - XIC ic, - XIMArg *values -); - -extern int _XimLocalMbLookupString( - XIC ic, - XKeyEvent *ev, - char *buffer, - int bytes, - KeySym *keysym, - Status *status -); - -extern int _XimLocalWcLookupString( - XIC ic, - XKeyEvent *ev, - wchar_t *buffer, - int bytes, - KeySym *keysym, - Status *status -); - -extern int _XimLocalUtf8LookupString( - XIC ic, - XKeyEvent *ev, - char *buffer, - int bytes, - KeySym *keysym, - Status *status -); - -extern Bool _XimThaiFilter( - Display *d, - Window w, - XEvent *ev, - XPointer client_data -); - -extern XIC _XimThaiCreateIC( - XIM im, - XIMArg *values -); - -extern Status _XimThaiCloseIM( - XIM xim -); - -#ifdef XIM_CONNECTABLE -extern void _XimSetProtoResource( - Xim im -); - -extern Bool _XimConnectServer( - Xim im -); - -extern Bool _XimDelayModeSetAttr( - Xim im -); - -extern void _XimServerReconectableDestroy( - void -); - -extern Bool _XimReCreateIC( - Xic ic -); - -extern Bool _XimEncodeSavedIMATTRIBUTE( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - int *idx, - char *buf, - int size, - int *ret_len, - XPointer top, - unsigned long mode -); - -extern Bool _XimEncodeSavedICATTRIBUTE( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - int *idx, - char *buf, - int size, - int *ret_len, - XPointer top, - unsigned long mode -); -#endif - -extern Bool -_XimRegisterDispatcher( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data); - -extern Bool -_XimRespSyncReply( - Xic ic, - BITMASK16 mode); - -#endif /* _XIMINT_H */ diff --git a/nx-X11/lib/X11/XimintL.h b/nx-X11/lib/X11/XimintL.h deleted file mode 100644 index d2d92387f..000000000 --- a/nx-X11/lib/X11/XimintL.h +++ /dev/null @@ -1,106 +0,0 @@ -/****************************************************************** - - Copyright 1991, 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993 by Digital Equipment Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED and -Digital Equipment Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. FUJITSU LIMITED and Digital Equipment Corporation -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 -THIS SOFTWARE. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Modifier: Franky Ling Digital Equipment Corporation - frankyling@hgrd01.enet.dec.com - -******************************************************************/ - -#ifndef _XIMINTL_H -#define _XIMINTL_H - -#define COMPOSE_FILE "Compose" - -/* - * Data Structures for Local Processing - */ -typedef INT32 DTIndex; -typedef INT32 DTCharIndex; -typedef BITS32 DTModifier; - -typedef struct _DefTree { - DTIndex next; - DTIndex succession; /* successive Key Sequence */ - /* Key definitions */ - DTModifier modifier_mask; - DTModifier modifier; - KeySym keysym; /* leaf only */ - DTCharIndex mb; - DTCharIndex wc; /* make from mb */ - DTCharIndex utf8; /* make from mb */ - KeySym ks; -} DefTree; - -typedef struct _DefTreeBase { - DefTree *tree; - char *mb; - wchar_t *wc; - char *utf8; - DTIndex treeused, treesize; - DTCharIndex mbused, mbsize; - DTCharIndex wcused, wcsize; - DTCharIndex utf8used, utf8size; -} DefTreeBase; - -typedef struct _XimLocalPrivateRec { - /* The first fields are identical with XimCommonPrivateRec. */ - XlcConv ctom_conv; - XlcConv ctow_conv; - XlcConv ctoutf8_conv; - XlcConv cstomb_conv; - XlcConv cstowc_conv; - XlcConv cstoutf8_conv; - XlcConv ucstoc_conv; - XlcConv ucstoutf8_conv; - - XIC current_ic; - DefTreeBase base; - DTIndex top; -} XimLocalPrivateRec; - -typedef struct _XicThaiPart { - int comp_state; - KeySym keysym; - int input_mode; -} XicThaiPart; - -typedef struct _XicLocalPrivateRec { - long value_mask; - DefTreeBase base; - DTIndex context; - DTIndex composed; - XicThaiPart thai; - - XIMResourceList ic_resources; - unsigned int ic_num_resources; - - unsigned char brl_pressed, brl_committing, brl_committed; - Time brl_release_start; -} XicLocalPrivateRec; -#endif /* _XIMINTL_H */ diff --git a/nx-X11/lib/X11/XimintP.h b/nx-X11/lib/X11/XimintP.h deleted file mode 100644 index 14a7e6d5a..000000000 --- a/nx-X11/lib/X11/XimintP.h +++ /dev/null @@ -1,310 +0,0 @@ -/* - * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993, 1994 by Sony Corporation - -Permission to use, copy, modify, distribute, and sell this software and -its 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 FUJITSU LIMITED and 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. - -FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND -FITNESS, IN NO EVENT SHALL FUJITSU LIMITED 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 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - Makoto Wakamatsu Sony Corporation - makoto@sm.sony.co.jp - Hiroyuki Miyamoto Digital Equipment Corporation - miyamoto@jrd.dec.com - -******************************************************************/ - -#ifndef _XIMINTP_H -#define _XIMINTP_H - -#include "XimProto.h" -#include "XlcPublic.h" - -/* - * for protocol layer callback function - */ -typedef Bool (*XimProtoIntrProc)( - Xim, INT16, XPointer, XPointer -); -typedef struct _XimProtoIntrRec { - XimProtoIntrProc func; - CARD16 major_code; - CARD16 minor_code; - XPointer call_data; - struct _XimProtoIntrRec *next; -} XimProtoIntrRec; - -/* - * for transport layer methods - */ -typedef Bool (*XimTransConnectProc)( - Xim -); -typedef Bool (*XimTransShutdownProc)( - Xim -); -typedef Bool (*XimTransWriteProc)( - Xim, INT16, XPointer -); -typedef Bool (*XimTransReadProc)( - Xim, XPointer, int, int * -); -typedef void (*XimTransFlushProc)( - Xim -); -typedef Bool (*XimTransRegDispatcher)( - Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer -); -typedef Bool (*XimTransCallDispatcher)( - Xim, INT16, XPointer -); - -/* - * private part of IM - */ -typedef struct _XimProtoPrivateRec { - /* The first fields are identical with XimCommonPrivateRec. */ - XlcConv ctom_conv; - XlcConv ctow_conv; - XlcConv ctoutf8_conv; - XlcConv cstomb_conv; - XlcConv cstowc_conv; - XlcConv cstoutf8_conv; - XlcConv ucstoc_conv; - XlcConv ucstoutf8_conv; - - Window im_window; - XIMID imid; - CARD16 unused; - XIMStyles *default_styles; - CARD32 *im_onkeylist; - CARD32 *im_offkeylist; - BITMASK32 flag; - - BITMASK32 registed_filter_event; - EVENTMASK forward_event_mask; - EVENTMASK synchronous_event_mask; - - XimProtoIntrRec *intrproto; - XIMResourceList im_inner_resources; - unsigned int im_num_inner_resources; - XIMResourceList ic_inner_resources; - unsigned int ic_num_inner_resources; - char *hold_data; - int hold_data_len; - char *locale_name; - CARD16 protocol_major_version; - CARD16 protocol_minor_version; - XrmQuark *saved_imvalues; - int num_saved_imvalues; - - /* - * transport specific - */ - XimTransConnectProc connect; - XimTransShutdownProc shutdown; - XimTransWriteProc write; - XimTransReadProc read; - XimTransFlushProc flush; - XimTransRegDispatcher register_dispatcher; - XimTransCallDispatcher call_dispatcher; - XPointer spec; -} XimProtoPrivateRec; - -/* - * bit mask for the flag of XIMPrivateRec - */ -#define SERVER_CONNECTED (1L) -#define DYNAMIC_EVENT_FLOW (1L << 1) -#define USE_AUTHORIZATION_FUNC (1L << 2) -#ifdef XIM_CONNECTABLE -#define DELAYBINDABLE (1L << 3) -#define RECONNECTABLE (1L << 4) -#endif /* XIM_CONNECTABLE */ -#define FABRICATED (1L << 5) -#define NEED_SYNC_REPLY (1L << 6) - -/* - * macro for the flag of XIMPrivateRec - */ -#define IS_SERVER_CONNECTED(im) \ - ((((Xim)im))->private.proto.flag & SERVER_CONNECTED) -#define MARK_SERVER_CONNECTED(im) \ - ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED) -#define UNMARK_SERVER_CONNECTED(im) \ - ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED) - -#define IS_DYNAMIC_EVENT_FLOW(im) \ - (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW) -#define MARK_DYNAMIC_EVENT_FLOW(im) \ - (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW) - -#define IS_USE_AUTHORIZATION_FUNC(im) \ - (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC) -#define MARK_USE_AUTHORIZATION_FUNC(im) \ - (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC) - -#ifdef XIM_CONNECTABLE -#define IS_DELAYBINDABLE(im) \ - (((Xim)im)->private.proto.flag & DELAYBINDABLE) -#define MARK_DELAYBINDABLE(im) \ - (((Xim)im)->private.proto.flag |= DELAYBINDABLE) - -#define IS_RECONNECTABLE(im) \ - (((Xim)im)->private.proto.flag & RECONNECTABLE) -#define MARK_RECONNECTABLE(im) \ - (((Xim)im)->private.proto.flag |= RECONNECTABLE) - -#define IS_CONNECTABLE(im) \ - (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE)) -#define UNMAKE_CONNECTABLE(im) \ - (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) -#endif /* XIM_CONNECTABLE */ - -#define IS_FABRICATED(im) \ - (((Xim)im)->private.proto.flag & FABRICATED) -#define MARK_FABRICATED(im) \ - (((Xim)im)->private.proto.flag |= FABRICATED) -#define UNMARK_FABRICATED(im) \ - (((Xim)im)->private.proto.flag &= ~FABRICATED) - -#define IS_NEED_SYNC_REPLY(im) \ - (((Xim)im)->private.proto.flag & NEED_SYNC_REPLY) -#define MARK_NEED_SYNC_REPLY(im) \ - (((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY) -#define UNMARK_NEED_SYNC_REPLY(im) \ - (((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY) - -/* - * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec - */ -#define KEYPRESS_MASK (1L) -#define KEYRELEASE_MASK (1L << 1) -#define DESTROYNOTIFY_MASK (1L << 2) - -typedef struct _XimCommitInfoRec { - struct _XimCommitInfoRec *next; - char *string; - int string_len; - KeySym *keysym; - int keysym_len; -} XimCommitInfoRec, *XimCommitInfo; - -typedef struct _XimPendingCallback { - int major_opcode; - Xim im; - Xic ic; - char *proto; - int proto_len; - struct _XimPendingCallback *next; -} XimPendingCallbackRec, *XimPendingCallback; - - -/* - * private part of IC - */ -typedef struct _XicProtoPrivateRec { - XICID icid; /* ICID */ - CARD16 dmy; - BITMASK32 flag; /* Input Mode */ - - BITMASK32 registed_filter_event; /* registed filter mask */ - EVENTMASK forward_event_mask; /* forward event mask */ - EVENTMASK synchronous_event_mask;/* sync event mask */ - EVENTMASK filter_event_mask; /* negrect event mask */ - EVENTMASK intercept_event_mask; /* deselect event mask */ - EVENTMASK select_event_mask; /* select event mask */ - - char *preedit_font; /* Base font name list */ - int preedit_font_length; /* length of base font name */ - char *status_font; /* Base font name list */ - int status_font_length; /* length of base font name */ - - XimCommitInfo commit_info; - XIMResourceList ic_resources; - unsigned int ic_num_resources; - XIMResourceList ic_inner_resources; - unsigned int ic_num_inner_resources; - XrmQuark *saved_icvalues; - int num_saved_icvalues; - XimPendingCallback pend_cb_que; - Bool waitCallback; -} XicProtoPrivateRec ; - -/* - * bit mask for the flag of XICPrivateRec - */ -#define IC_CONNECTED (1L) - -/* - * macro for the flag of XICPrivateRec - */ -#define IS_IC_CONNECTED(ic) \ - (((Xic)ic)->private.proto.flag & IC_CONNECTED) -#define MARK_IC_CONNECTED(ic) \ - (((Xic)ic)->private.proto.flag |= IC_CONNECTED) -#define UNMARK_IC_CONNECTED(ic) \ - (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) - -/* - * macro for the filter_event_mask of XICPrivateRec - */ -#define IS_NEGLECT_EVENT(ic, mask) \ - (((Xic)ic)->private.proto.filter_event_mask & (mask)) - -/* - * macro for the forward_event_mask of XICPrivateRec - */ -#define IS_FORWARD_EVENT(ic, mask) \ - (((Xic)ic)->private.proto.forward_event_mask & (mask)) - -/* - * macro for the synchronous_event_mask of XICPrivateRec - */ -#define IS_SYNCHRONOUS_EVENT(ic, mask) \ - ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False) - -#define XIM_MAXIMNAMELEN 64 -#define XIM_MAXLCNAMELEN 64 - -#endif /* _XIMINTP_H */ diff --git a/nx-X11/lib/X11/Xintatom.h b/nx-X11/lib/X11/Xintatom.h deleted file mode 100644 index b2d307bab..000000000 --- a/nx-X11/lib/X11/Xintatom.h +++ /dev/null @@ -1,33 +0,0 @@ - -#ifndef _XINTATOM_H_ -#define _XINTATOM_H_ 1 - -#include -#include - -/* IntAtom.c */ - -#define TABLESIZE 64 - -typedef struct _Entry { - unsigned long sig; - Atom atom; -} EntryRec, *Entry; - -#define RESERVED ((Entry) 1) - -#define EntryName(e) ((char *)(e+1)) - -typedef struct _XDisplayAtoms { - Entry table[TABLESIZE]; -} AtomTable; - -_XFUNCPROTOBEGIN - -extern void _XUpdateAtomCache(Display *dpy, const char *name, Atom atom, - unsigned long sig, int idx, int n); -extern void _XFreeAtomTable(Display *dpy); - -_XFUNCPROTOEND - -#endif /* _XINTATOM_H_ */ diff --git a/nx-X11/lib/X11/Xintconn.h b/nx-X11/lib/X11/Xintconn.h deleted file mode 100644 index 675f684ac..000000000 --- a/nx-X11/lib/X11/Xintconn.h +++ /dev/null @@ -1,38 +0,0 @@ - -#ifndef _XINTCONN_H_ -#define _XINTCONN_H_ 1 - -#include -#include - -_XFUNCPROTOBEGIN - -#if !USE_XCB -/* ConnDis.c */ - -int _XConnectDisplay ( - char *display_name, - char **fullnamep, /* RETURN */ - int *dpynump, /* RETURN */ - int *screenp, /* RETURN */ - char **auth_namep, /* RETURN */ - int *auth_namelenp, /* RETURN */ - char **auth_datap, /* RETURN */ - int *auth_datalenp); /* RETURN */ -extern int _XDisconnectDisplay(XtransConnInfo trans_conn); -extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client, - char *auth_proto, char *auth_string, - xConnSetupPrefix *prefix); -extern XtransConnInfo _X11TransConnectDisplay(char *display_name, - char **fullnamep, int *dpynump, - int *screenp, char **auth_namep, - int *auth_namelenp, char **auth_datap, - int *auth_datalenp); -#endif /* !USE_XCB */ - -/* OpenDis.c */ -extern void _XFreeDisplayStructure(Display *dpy); - -_XFUNCPROTOEND - -#endif /* _XINTCONN_H_ */ diff --git a/nx-X11/lib/X11/XlcGeneric.h b/nx-X11/lib/X11/XlcGeneric.h deleted file mode 100644 index 0c008fdaa..000000000 --- a/nx-X11/lib/X11/XlcGeneric.h +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Takanori Tateno FUJITSU LIMITED - * - */ - -#ifndef _XLCGENERIC_H_ -#define _XLCGENERIC_H_ - -#include "XlcPubI.h" - -typedef struct _ByteInfo { - unsigned char start,end; -} ByteInfoRec, *ByteInfo; - -typedef struct _ByteInfoList { - int M; /* 1 <= M <= length */ - int byteinfo_num; - ByteInfo byteinfo; -} ByteInfoListRec, *ByteInfoList; - -/* conversion_type values */ -#define LOCALCONV 1 -#define FILECONV 2 -#define FUNCTIONCONV 4 - -typedef struct _Conversion { - unsigned long conversion_type; - int conv_num; - FontScope convlist; - char *cnv_file; - XlcConv cnvfunc; -} ConversionRec, *Conversion; - -typedef struct _ExtdSegment { - char *name; - XlcSide side; - FontScope area; - int area_num; - XlcCharSet charset; -} ExtdSegmentRec, *ExtdSegment; - -typedef struct _SegConvRec { - int length; - char *source_encoding; - XlcCharSet source; - char *destination_encoding; - XlcCharSet dest; - FontScopeRec range; - int conv_num; - FontScope conv; -} SegConvRec, *SegConv; - -typedef struct _ParseInfoRec *ParseInfo; - -typedef struct _CodeSetRec { - XlcCharSet *charset_list; - int num_charsets; - int cs_num; - XlcSide side; - int length; - ByteInfoList byteM; - Conversion mbconv; - Conversion ctconv; - ExtdSegment ctextseg; - ParseInfo parse_info; - unsigned long wc_encoding; - Bool string_encoding; -} CodeSetRec, *CodeSet; - -typedef enum { - E_GL, /* GL encoding */ - E_GR, /* GR encoding */ - E_SS, /* single shift */ - E_LSL, /* locking shift left */ - E_LSR, /* locking shift right */ - E_LAST -} EncodingType; - -typedef struct _ParseInfoRec { - EncodingType type; - char *encoding; - CodeSet codeset; -} ParseInfoRec; - -/* - * XLCd private data - */ - -#define XLC_GENERIC(lcd, x) (((XLCdGeneric) lcd->core)->gen.x) -#define XLC_GENERIC_PART(lcd) (&(((XLCdGeneric) lcd->core)->gen)) - -typedef struct _XLCdGenericPart { - int codeset_num; - CodeSet *codeset_list; - unsigned char *mb_parse_table; - int mb_parse_list_num; - ParseInfo *mb_parse_list; - unsigned long wc_encode_mask; - unsigned long wc_shift_bits; - CodeSet initial_state_GL; - CodeSet initial_state_GR; - int segment_conv_num; /* UDC */ - SegConv segment_conv; /* UDC */ - Bool use_stdc_env; - Bool force_convert_to_mb; -} XLCdGenericPart; - -typedef struct _XLCdGenericRec { - XLCdCoreRec core; - XLCdPublicPart pub; - XLCdGenericPart gen; -} XLCdGenericRec, *XLCdGeneric; - -extern XLCdMethods _XlcGenericMethods; - -extern FontScope -_XlcParse_scopemaps( - const char *str, - int *size); -extern void -_XlcDbg_printValue( - const char *str, - char **value, - int num); - -extern XIM -_XDefaultOpenIM( - XLCd lcd, - Display *dpy, - XrmDatabase rdb, - char *res_name, - char *res_class); - -#endif /* _XLCGENERIC_H_ */ diff --git a/nx-X11/lib/X11/XlcPubI.h b/nx-X11/lib/X11/XlcPubI.h deleted file mode 100644 index c454c7ddd..000000000 --- a/nx-X11/lib/X11/XlcPubI.h +++ /dev/null @@ -1,298 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifndef _XLCPUBLICI_H_ -#define _XLCPUBLICI_H_ - -#include "XlcPublic.h" - -#define XLC_PUBLIC(lcd, x) (((XLCdPublic) lcd->core)->pub.x) -#define XLC_PUBLIC_PART(lcd) (&(((XLCdPublic) lcd->core)->pub)) -#define XLC_PUBLIC_METHODS(lcd) (&(((XLCdPublicMethods) lcd->methods)->pub)) - -/* - * XLCd public methods - */ - -typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods; - -typedef XLCd (*XlcPubCreateProc)( - const char* name, - XLCdMethods methods -); - -typedef Bool (*XlcPubInitializeProc)( - XLCd lcd -); - -typedef void (*XlcPubDestroyProc)( - XLCd lcd -); - -typedef char* (*XlcPubGetValuesProc)( - XLCd lcd, - XlcArgList args, - int num_args -); - -typedef void (*XlcPubGetResourceProc)( - XLCd lcd, - const char* category, - const char* _class, - char*** value, - int* count -); - -typedef struct _XLCdPublicMethodsPart { - XLCdPublicMethods superclass; - XlcPubCreateProc create; - XlcPubInitializeProc initialize; - XlcPubDestroyProc destroy; - XlcPubGetValuesProc get_values; - XlcPubGetResourceProc get_resource; -} XLCdPublicMethodsPart; - -typedef struct _XLCdPublicMethodsRec { - XLCdMethodsRec core; - XLCdPublicMethodsPart pub; -} XLCdPublicMethodsRec; - -/* - * XLCd public data - */ - -typedef struct _XLCdPublicPart { - char *siname; /* for _XlcMapOSLocaleName() */ - char *language; /* language part of locale name */ - char *territory; /* territory part of locale name */ - char *codeset; /* codeset part of locale name */ - char *encoding_name; /* encoding name */ - int mb_cur_max; /* ANSI C MB_CUR_MAX */ - Bool is_state_depend; /* state-depend encoding */ - const char *default_string; /* for XDefaultString() */ - XPointer xlocale_db; -} XLCdPublicPart; - -typedef struct _XLCdPublicRec { - XLCdCoreRec core; - XLCdPublicPart pub; -} XLCdPublicRec, *XLCdPublic; - -extern XLCdMethods _XlcPublicMethods; - -_XFUNCPROTOBEGIN - -extern XLCd _XlcCreateLC( - const char* name, - XLCdMethods methods -); - -extern void _XlcDestroyLC( - XLCd lcd -); - -/* Fills into a freshly created XlcCharSet the fields that can be inferred - from the ESC sequence. These are side, char_size, set_size. */ -extern Bool _XlcParseCharSet( - XlcCharSet charset -); - -/* Creates a new XlcCharSet, given its name (including side suffix) and - Compound Text ESC sequence (normally at most 4 bytes). */ -extern XlcCharSet _XlcCreateDefaultCharSet( - const char* name, - const char* ct_sequence -); - -extern XlcCharSet _XlcAddCT( - const char* name, - const char* ct_sequence -); - -extern Bool _XlcInitCTInfo (void); - -extern XrmMethods _XrmDefaultInitParseInfo( - XLCd lcd, - XPointer* state -); - -extern int _XmbTextPropertyToTextList( - XLCd lcd, - Display* dpy, - const XTextProperty* text_prop, - char*** list_ret, - int* count_ret -); - -extern int _XwcTextPropertyToTextList( - XLCd lcd, - Display* dpy, - const XTextProperty* text_prop, - wchar_t*** list_ret, - int* count_ret -); - -extern int _Xutf8TextPropertyToTextList( - XLCd lcd, - Display* dpy, - const XTextProperty* text_prop, - char*** list_ret, - int* count_ret -); - -extern int _XmbTextListToTextProperty( - XLCd /* lcd */, - Display* /* dpy */, - char** /* list */, - int /* count */, - XICCEncodingStyle /* style */, - XTextProperty* /* text_prop */ -); - -extern int _XwcTextListToTextProperty( - XLCd /* lcd */, - Display* /* dpy */, - wchar_t** /* list */, - int /* count */, - XICCEncodingStyle /* style */, - XTextProperty* /* text_prop */ -); - -extern int _Xutf8TextListToTextProperty( - XLCd /* lcd */, - Display* /* dpy */, - char** /* list */, - int /* count */, - XICCEncodingStyle /* style */, - XTextProperty* /* text_prop */ -); - -extern void _XwcFreeStringList( - XLCd /* lcd */, - wchar_t** /* list */ -); - -extern int _XlcResolveLocaleName( - const char* lc_name, - XLCdPublicPart* pub -); - -extern int _XlcResolveI18NPath( - char* buf, - int buf_len -); - -extern char *_XlcLocaleLibDirName( - char* /* dir_name */, - size_t, /* dir_len */ - const char* /* lc_name */ -); - -extern char *_XlcLocaleDirName( - char* /* dir_name */, - size_t, /* dir_len */ - const char* /* lc_name */ -); - -extern XPointer _XlcCreateLocaleDataBase( - XLCd lcd -); - -extern void _XlcDestroyLocaleDataBase( - XLCd lcd -); - -extern void _XlcGetLocaleDataBase( - XLCd /* lcd */, - const char* /* category */, - const char* /* name */, - char*** /* value */, - int* /* count */ -); - -#if defined(__APPLE__) || defined(__DARWIN__) -extern char * -_Xsetlocale( - int category, - _Xconst char *name); -#endif -extern char *_XlcMapOSLocaleName( - char *osname, - char *siname); - -extern int -_Xmbstoutf8( - char *ustr, - const char *str, - int len); -extern int -_Xlcmbstoutf8( - XLCd lcd, - char *ustr, - const char *str, - int len); -extern int -_Xmbstowcs( - wchar_t *wstr, - char *str, - int len); -extern int -_Xlcwcstombs( - XLCd lcd, - char *str, - wchar_t *wstr, - int len); -extern int -_Xlcmbstowcs( - XLCd lcd, - wchar_t *wstr, - char *str, - int len); -extern int -_Xwcstombs( - char *str, - wchar_t *wstr, - int len); -extern int -_Xlcmbtowc( - XLCd lcd, - wchar_t *wstr, - char *str, - int len); -extern int -_Xlcwctomb( - XLCd lcd, - char *str, - wchar_t wc); - - - -extern XPointer -_Utf8GetConvByName( - const char *name); - -_XFUNCPROTOEND - -#endif /* _XLCPUBLICI_H_ */ diff --git a/nx-X11/lib/X11/XlcPublic.h b/nx-X11/lib/X11/XlcPublic.h deleted file mode 100644 index 3d94ef37d..000000000 --- a/nx-X11/lib/X11/XlcPublic.h +++ /dev/null @@ -1,324 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Takanori Tateno FUJITSU LIMITED - * - */ -/* - * Most of this API is documented in i18n/Framework.PS - */ - -#ifndef _XLCPUBLIC_H_ -#define _XLCPUBLIC_H_ - -#include "Xlcint.h" - - -/* - * Character sets. - */ - -/* Every character set has a "side". It denotes the range of byte values for - which the character set is responsible. This means that the character - set's encoded characters will only assumes bytes within the range, and - that the character set can be used simultaneously with another character - set responsible for a disjoint range. */ -typedef enum { - XlcUnknown, - XlcC0, /* responsible for values 0x00..0x1F */ - XlcGL, /* responsible for values 0x00..0x7F or 0x20..0x7F */ - XlcC1, /* responsible for values 0x80..0x9F */ - XlcGR, /* responsible for values 0x80..0xFF or 0xA0..0xFF */ - XlcGLGR, /* responsible for values 0x00..0xFF */ - XlcOther, /* unused */ - XlcNONE -} XlcSide; - -/* Data read from XLC_LOCALE files. - XXX Apparently superseded by _XUDCGlyphRegion. */ -typedef struct _UDCArea { - unsigned long start; - unsigned long end; -} UDCAreaRec, *UDCArea; - -/* Where the character set comes from. */ -typedef enum { - CSsrcUndef, /* unused */ - CSsrcStd, /* defined in libX11 */ - CSsrcXLC /* defined in an XLC_LOCALE file */ -} CSSrc; - -/* These are the supported properties of XlcCharSet. */ -#define XlcNCharSize "charSize" -#define XlcNControlSequence "controlSequence" -#define XlcNEncodingName "encodingName" -#define XlcNName "name" -#define XlcNSetSize "setSize" -#define XlcNSide "side" - -/* This is the structure of an XlcCharSet. - Once allocated, they are never freed. */ -typedef struct _XlcCharSetRec { - /* Character set name, including side suffix */ - const char *name; - XrmQuark xrm_name; - - /* XLFD encoding name, no side suffix */ - const char *encoding_name; - XrmQuark xrm_encoding_name; - - /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */ - XlcSide side; - - /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */ - int char_size; - /* Classification of the character set according to ISO-2022 */ - int set_size; /* e.g. 94 or 96 */ - const char *ct_sequence; /* control sequence of CT */ - /* (normally at most 4 bytes) */ - - /* for UDC */ - Bool string_encoding; - UDCArea udc_area; - int udc_area_num; - - /* Description source */ - CSSrc source; -} XlcCharSetRec, *XlcCharSet; - -_XFUNCPROTOBEGIN - -/* Returns the charset with the given name (including side suffix). - Returns NULL if not found. */ -extern XlcCharSet _XlcGetCharSet( - const char* name -); - -/* Returns the charset with the given encoding (no side suffix) and - responsible for at least the given side (XlcGL or XlcGR). - Returns NULL if not found. */ -extern XlcCharSet _XlcGetCharSetWithSide( - const char* encoding_name, - XlcSide side -); - -/* Registers an XlcCharSet in the list of character sets. - Returns True if successful. */ -extern Bool _XlcAddCharSet( - XlcCharSet charset -); - -/* Retrieves a number of attributes of an XlcCharSet. - Return NULL if successful, otherwise the name of the first argument - specifiying a nonexistent attribute. */ -extern char *_XlcGetCSValues( - XlcCharSet charset, - ... -); - -_XFUNCPROTOEND - - -#define XlcNCodeset "codeset" -#define XlcNDefaultString "defaultString" -#define XlcNLanguage "language" -#define XlcNMbCurMax "mbCurMax" -#define XlcNStateDependentEncoding "stateDependentEncoding" -#define XlcNTerritory "territory" - -typedef struct _FontScope { - unsigned long start; - unsigned long end; - unsigned long shift; - unsigned long shift_direction; -} FontScopeRec, *FontScope; - -/* - * conversion methods - */ - -typedef struct _XlcConvRec *XlcConv; - -typedef XlcConv (*XlcOpenConverterProc)( - XLCd from_lcd, - const char* from_type, - XLCd to_lcd, - const char* to_type -); - -typedef void (*XlcCloseConverterProc)( - XlcConv /* conv */ -); - -typedef int (*XlcConvertProc)( - XlcConv /* conv */, - XPointer* /* from */, - int* /* from_left */, - XPointer* /* to */, - int* /* to_left */, - XPointer* /* args */, - int /* num_args */ -); - -typedef void (*XlcResetConverterProc)( - XlcConv /* conv */ -); - -typedef struct _XlcConvMethodsRec{ - XlcCloseConverterProc close; - XlcConvertProc convert; - XlcResetConverterProc reset; -} XlcConvMethodsRec, *XlcConvMethods; - -/* - * conversion data - */ - -#define XlcNMultiByte "multiByte" -#define XlcNWideChar "wideChar" -#define XlcNCompoundText "compoundText" -#define XlcNString "string" -#define XlcNUtf8String "utf8String" -#define XlcNCharSet "charSet" -#define XlcNCTCharSet "CTcharSet" -#define XlcNFontCharSet "FontCharSet" -#define XlcNChar "char" -#define XlcNUcsChar "UCSchar" - -typedef struct _XlcConvRec { - XlcConvMethods methods; - XPointer state; -} XlcConvRec; - - -_XFUNCPROTOBEGIN - -extern Bool _XInitOM( - XLCd /* lcd */ -); - -extern Bool _XInitIM( - XLCd /* lcd */ -); - -extern XIM _XimOpenIM( - XLCd /* lcd */, - Display * /* dpy */, - XrmDatabase /* rdb */, - char * /* res_name */, - char * /* res_class */ -); - -extern char *_XGetLCValues( - XLCd /* lcd */, - ... -); - -extern XlcConv _XlcOpenConverter( - XLCd from_lcd, - const char* from_type, - XLCd to_lcd, - const char* to_type -); - -extern void _XlcCloseConverter( - XlcConv conv -); - -extern int _XlcConvert( - XlcConv conv, - XPointer* from, - int* from_left, - XPointer* to, - int* to_left, - XPointer* args, - int num_args -); - -extern void _XlcResetConverter( - XlcConv conv -); - -extern Bool _XlcSetConverter( - XLCd from_lcd, - const char* from_type, - XLCd to_lcd, - const char* to_type, - XlcOpenConverterProc open_converter -); - -extern void _XlcGetResource( - XLCd lcd, - const char* category, - const char* _class, - char*** value, - int* count -); - -extern char *_XlcFileName( - XLCd lcd, - const char* category -); - -extern int _Xwcslen( - wchar_t* /* wstr */ -); - -extern wchar_t *_Xwcscpy( - wchar_t* /* wstr1 */, - wchar_t* /* wstr2 */ -); - -extern wchar_t *_Xwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len); -extern int _Xwcscmp(wchar_t *wstr1, wchar_t *wstr2); -extern int _Xwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len); - -/* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. - Like strcasecmp in an ASCII locale. */ -extern int _XlcCompareISOLatin1( - const char* str1, - const char* str2 -); - -/* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring - case of ASCII letters. Like strncasecmp in an ASCII locale. */ -extern int _XlcNCompareISOLatin1( - const char* str1, - const char* str2, - int len -); - -extern XOM -_XDefaultOpenOM( - XLCd lcd, Display *dpy, XrmDatabase rdb, - _Xconst char *res_name, _Xconst char *res_class); - -_XFUNCPROTOEND - -#endif /* _XLCPUBLIC_H_ */ diff --git a/nx-X11/lib/X11/Xlcint.h b/nx-X11/lib/X11/Xlcint.h deleted file mode 100644 index 5a6205a1f..000000000 --- a/nx-X11/lib/X11/Xlcint.h +++ /dev/null @@ -1,964 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, - * and Nippon Telegraph and Telephone Corporation - * Copyright 1991 by the Open Software Foundation - * Copyright 1993 by the TOSHIBA Corp. - * Copyright 1993, 1994 by Sony Corporation - * Copyright 1993, 1994 by the FUJITSU LIMITED - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 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, - * 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" - * 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 - * 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. - * - * Authors: Li Yuhong OMRON Corporation - * Tatsuya Kato NTT Software Corporation - * Hiroshi Kuribayashi OMRON Coproration - * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. - * - * M. Collins OSF - * Katsuhisa Yano TOSHIBA Corp. - * Makoto Wakamatsu Sony Corporation - * Takashi Fujiwara FUJITSU LIMITED - */ - - -#ifndef _XLCINT_H_ -#define _XLCINT_H_ - -#ifndef _XP_PRINT_SERVER_ - -#include -#include -#include - -typedef Bool (*XFilterEventProc)( - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ -); - -typedef struct _XIMFilter { - struct _XIMFilter *next; - Window window; - unsigned long event_mask; - int start_type, end_type; - XFilterEventProc filter; - XPointer client_data; -} XFilterEventRec, *XFilterEventList; - -typedef struct { - char *name; - XPointer value; -} XIMArg; - -#ifdef offsetof -#define XOffsetOf(s_type,field) offsetof(s_type,field) -#else -#define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field)) -#endif - -#define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0]))) - -/* - * define secondary data structs which are part of Input Methods - * and Input Context - */ -typedef struct { - const char *resource_name; /* Resource string */ - XrmQuark xrm_name; /* Resource name quark */ - int resource_size; /* Size in bytes of data */ - long resource_offset; /* Offset from base */ - unsigned short mode; /* Read Write Permission */ - unsigned short id; /* Input Method Protocol */ -} XIMResource, *XIMResourceList; - -/* - * data block describing the visual attributes associated with - * an input context - */ -typedef struct { - XRectangle area; - XRectangle area_needed; - XPoint spot_location; - Colormap colormap; - Atom std_colormap; - unsigned long foreground; - unsigned long background; - Pixmap background_pixmap; - XFontSet fontset; - int line_spacing; - Cursor cursor; - XICCallback start_callback; - XICCallback done_callback; - XICCallback draw_callback; - XICCallback caret_callback; - XIMPreeditState preedit_state; - XICCallback state_notify_callback; -} ICPreeditAttributes, *ICPreeditAttributesPtr; - -typedef struct { - XRectangle area; - XRectangle area_needed; - Colormap colormap; - Atom std_colormap; - unsigned long foreground; - unsigned long background; - Pixmap background_pixmap; - XFontSet fontset; - int line_spacing; - Cursor cursor; - XICCallback start_callback; - XICCallback done_callback; - XICCallback draw_callback; -} ICStatusAttributes, *ICStatusAttributesPtr; - -#endif /* !_XP_PRINT_SERVER_ */ - -/* - * Methods for Xrm parsing - */ - -/* The state is a pointer to an object created by the locale's - init_parse_info function (default: _XrmDefaultInitParseInfo). */ - -/* Sets the state to the initial state. - Initiates a sequence of calls to the XmbCharProc. */ -typedef void (*XmbInitProc)( - XPointer state -); - -/* Transforms one multibyte character, starting at str, and return a 'char' - in the same parsing class (not a wide character!). Returns the number of - consumed bytes in *lenp. */ -typedef char (*XmbCharProc)( - XPointer state, - const char * str, - int* lenp -); - -/* Terminates a sequence of calls to the XmbCharProc. */ -typedef void (*XmbFinishProc)( - XPointer state -); - -/* Returns the name of the state's locale, as a static string. */ -typedef const char* (*XlcNameProc)( - XPointer state -); - -/* Frees the state, which was allocated by the locale's init_parse_info - function. */ -typedef void (*XrmDestroyProc)( - XPointer state -); - -/* Set of methods for Xrm parsing. */ -typedef struct { - XmbInitProc mbinit; - XmbCharProc mbchar; - XmbFinishProc mbfinish; - XlcNameProc lcname; - XrmDestroyProc destroy; -} XrmMethodsRec; -typedef const XrmMethodsRec *XrmMethods; - -#ifndef _XP_PRINT_SERVER_ - -typedef struct _XLCd *XLCd; /* need forward reference */ - -/* - * define an LC, it's methods, and data. - */ - -typedef void (*XCloseLCProc)( - XLCd /* lcd */ -); - -typedef char* (*XlcMapModifiersProc)( - XLCd /* lcd */, - _Xconst char* /* user_mods */, - _Xconst char* /* prog_mods */ -); - -typedef XOM (*XOpenOMProc)( - XLCd /* lcd */, - Display* /* display */, - XrmDatabase /* rdb */, - _Xconst char* /* res_name */, - _Xconst char* /* res_class */ -); - -typedef XIM (*XOpenIMProc)( - XLCd /* lcd */, - Display* /* display */, - XrmDatabase /* rdb */, - char* /* res_name */, - char* /* res_class */ -); - -typedef Bool (*XRegisterIMInstantiateCBProc)( - XLCd /* lcd */, - Display* /* display */, - XrmDatabase /* rdb */, - char* /* res_name */, - char* /* res_class */, - XIDProc /* callback */, - XPointer /* client_data */ -); - -typedef Bool (*XUnregisterIMInstantiateCBProc)( - XLCd /* lcd */, - Display* /* display */, - XrmDatabase /* rdb */, - char* /* res_name */, - char* /* res_class */, - XIDProc /* callback */, - XPointer /* client_data */ -); - -typedef XrmMethods (*XrmInitParseInfoProc)( - XLCd /* lcd */, - XPointer* /* state */ -); - -typedef int (*XmbTextPropertyToTextListProc)( - XLCd lcd, - Display* display, - const XTextProperty* text_prop, - char*** list_return, - int* count_return -); - -typedef int (*XwcTextPropertyToTextListProc)( - XLCd lcd, - Display* display, - const XTextProperty* text_prop, - wchar_t*** list_return, - int* count_return -); - -typedef int (*XmbTextListToTextPropertyProc)( - XLCd lcd, - Display* display, - char** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -typedef int (*XwcTextListToTextPropertyProc)( - XLCd lcd, - Display* display, - wchar_t** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -typedef void (*XwcFreeStringListProc)( - XLCd lcd, - wchar_t** list -); - -typedef const char* (*XDefaultStringProc)( - XLCd lcd -); - -typedef struct { - XCloseLCProc close; - XlcMapModifiersProc map_modifiers; - XOpenOMProc open_om; - XOpenIMProc open_im; - XrmInitParseInfoProc init_parse_info; - XmbTextPropertyToTextListProc mb_text_prop_to_list; - XwcTextPropertyToTextListProc wc_text_prop_to_list; - XmbTextPropertyToTextListProc utf8_text_prop_to_list; - XmbTextListToTextPropertyProc mb_text_list_to_prop; - XwcTextListToTextPropertyProc wc_text_list_to_prop; - XmbTextListToTextPropertyProc utf8_text_list_to_prop; - XwcFreeStringListProc wc_free_string_list; - XDefaultStringProc default_string; - XRegisterIMInstantiateCBProc register_callback; - XUnregisterIMInstantiateCBProc unregister_callback; -} XLCdMethodsRec, *XLCdMethods; - - -typedef struct { - char* name; /* name of this LC */ - char* modifiers; /* modifiers of locale */ -} XLCdCoreRec, *XLCdCore; - - -typedef struct _XLCd { - XLCdMethods methods; /* methods of this LC */ - XLCdCore core; /* data of this LC */ - XPointer opaque; /* LDX specific data */ -} XLCdRec; - -typedef int XlcPosition; - -#define XlcHead 0 -#define XlcTail -1 - -typedef struct { - char *name; - XPointer value; -} XlcArg, *XlcArgList; - -typedef struct _XlcResource { - const char *name; - XrmQuark xrm_name; - int size; - int offset; - unsigned long mask; -} XlcResource, *XlcResourceList; - -#define XlcCreateMask (1L<<0) -#define XlcDefaultMask (1L<<1) -#define XlcGetMask (1L<<2) -#define XlcSetMask (1L<<3) -#define XlcIgnoreMask (1L<<4) - -#define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0])) - -typedef Status (*XCloseOMProc)( - XOM /* om */ -); - -typedef char* (*XSetOMValuesProc)( - XOM /* om */, - XlcArgList /* args */, - int /* num_args */ -); - -typedef char* (*XGetOMValuesProc)( - XOM /* om */, - XlcArgList /* args */, - int /* num_args */ -); - -typedef XOC (*XCreateOCProc)( - XOM /* om */, - XlcArgList /* args */, - int /* num_args */ -); - -typedef struct _XOMMethodsRec { - XCloseOMProc close; - XSetOMValuesProc set_values; - XGetOMValuesProc get_values; - XCreateOCProc create_oc; -} XOMMethodsRec, *XOMMethods; - -typedef struct _XOMCoreRec { - XLCd lcd; /* lcd */ - Display *display; /* display */ - XrmDatabase rdb; /* database */ - char *res_name; /* resource name */ - char *res_class; /* resource class */ - XOC oc_list; /* xoc list */ - XlcResourceList resources; /* xom resources */ - int num_resources; /* number of xom resources */ - XOMCharSetList required_charset; /* required charset list */ - XOMOrientation orientation_list; /* orientation list */ - Bool directional_dependent; /* directional-dependent */ - Bool contextual_drawing; /* contextual drawing */ - Bool context_dependent; /* context-dependent drawing */ -} XOMCoreRec, *XOMCore; - -typedef struct _XOM { - XOMMethods methods; - XOMCoreRec core; -} XOMRec; - -typedef void (*XDestroyOCProc)( - XOC /* oc */ -); - -typedef char* (*XSetOCValuesProc)( - XOC /* oc */, - XlcArgList /* args */, - int /* num_args */ -); - -typedef char* (*XGetOCValuesProc)( - XOC /* oc */, - XlcArgList /* args */, - int /* num_args */ -); - -/* - * X Font Sets are an instantiable object, so we define it, the - * object itself, a method list and data - */ - -/* - * XFontSet object method list - */ - -typedef int (*XmbTextEscapementProc)( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* text_len */ -); - -typedef int (*XmbTextExtentsProc)( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* text_len */, - XRectangle* /* overall_ink_extents */, - XRectangle* /* overall_logical_extents */ -); - -typedef Status (*XmbTextPerCharExtentsProc)( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* text_len */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* max_ink_extents */, - XRectangle* /* max_logical_extents */ -); - -typedef int (*XmbDrawStringProc)( - Display* /* display */, - Drawable /* drawable */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* text_len */ -); - -typedef void (*XmbDrawImageStringProc)( - Display* /* display */, - Drawable /* drawable */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* text_len */ -); - -typedef int (*XwcTextEscapementProc)( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* text_len */ -); - -typedef int (*XwcTextExtentsProc)( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* text_len */, - XRectangle* /* overall_ink_extents */, - XRectangle* /* overall_logical_extents */ -); - -typedef Status (*XwcTextPerCharExtentsProc)( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* text_len */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* max_ink_extents */, - XRectangle* /* max_logical_extents */ -); - -typedef int (*XwcDrawStringProc)( - Display* /* display */, - Drawable /* drawable */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst wchar_t* /* text */, - int /* text_len */ -); - -typedef void (*XwcDrawImageStringProc)( - Display* /* display */, - Drawable /* drawable */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst wchar_t* /* text */, - int /* text_len */ -); - -typedef struct { - XDestroyOCProc destroy; - XSetOCValuesProc set_values; - XGetOCValuesProc get_values; - - /* multi-byte text drawing methods */ - - XmbTextEscapementProc mb_escapement; - XmbTextExtentsProc mb_extents; - XmbTextPerCharExtentsProc mb_extents_per_char; - XmbDrawStringProc mb_draw_string; - XmbDrawImageStringProc mb_draw_image_string; - - /* wide character text drawing methods */ - - XwcTextEscapementProc wc_escapement; - XwcTextExtentsProc wc_extents; - XwcTextPerCharExtentsProc wc_extents_per_char; - XwcDrawStringProc wc_draw_string; - XwcDrawImageStringProc wc_draw_image_string; - - /* UTF-8 text drawing methods */ - - XmbTextEscapementProc utf8_escapement; - XmbTextExtentsProc utf8_extents; - XmbTextPerCharExtentsProc utf8_extents_per_char; - XmbDrawStringProc utf8_draw_string; - XmbDrawImageStringProc utf8_draw_image_string; -} XOCMethodsRec, *XOCMethods; - - -/* - * XOC independent data - */ - -typedef struct { - XOM om; /* XOM */ - XOC next; /* next XOC */ - XlcResourceList resources; /* xoc resources */ - int num_resources; /* number of xoc resources */ - char *base_name_list; /* base font name list */ - Bool om_automatic; /* OM Automatic */ - XOMFontInfo font_info; /* font info */ - XFontSetExtents font_set_extents; /* font set extents */ - char *default_string; /* default string */ - XOMCharSetList missing_list; /* missing charset list */ - XOrientation orientation; /* orientation */ - char *res_name; /* resource name */ - char *res_class; /* resource class */ -} XOCCoreRec, *XOCCore; - -typedef struct _XOC { - XOCMethods methods; - XOCCoreRec core; -} XOCRec; - - -/* - * X Input Managers are an instantiable object, so we define it, the - * object itself, a method list and data. - */ - -/* - * an Input Manager object method list - */ -typedef struct { - Status (*close)( - XIM - ); - char* (*set_values)( - XIM, XIMArg* - ); - char* (*get_values)( - XIM, XIMArg* - ); - XIC (*create_ic)( - XIM, XIMArg* - ); - int (*ctstombs)( - XIM, char*, int, char*, int, Status * - ); - int (*ctstowcs)( - XIM, char*, int, wchar_t*, int, Status * - ); - int (*ctstoutf8)( - XIM, char*, int, char*, int, Status * - ); -} XIMMethodsRec, *XIMMethods; - -/* - * Input Manager LC independent data - */ -typedef struct { - XLCd lcd; /* LC of this input method */ - XIC ic_chain; /* list of ICs for this IM */ - - Display * display; /* display */ - XrmDatabase rdb; - char * res_name; - char * res_class; - - XIMValuesList *im_values_list; - XIMValuesList *ic_values_list; - XIMStyles *styles; - XIMCallback destroy_callback; - char * im_name; /* XIMMODIFIER name */ - XIMResourceList im_resources; /* compiled IM resource list */ - unsigned int im_num_resources; - XIMResourceList ic_resources; /* compiled IC resource list */ - unsigned int ic_num_resources; - Bool visible_position; -} XIMCoreRec, *XIMCore; - - - -/* - * An X Input Manager (IM). Implementations may need to extend this data - * structure to accomodate additional data, state information etc. - */ -typedef struct _XIM { - XIMMethods methods; /* method list of this IM */ - XIMCoreRec core; /* data of this IM */ -} XIMRec; - - - -/* - * 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 - ); - void (*set_focus)( - XIC - ); - void (*unset_focus)( - XIC - ); - char* (*set_values)( - XIC, XIMArg* - ); - char* (*get_values)( - XIC, XIMArg* - ); - char* (*mb_reset)( - XIC - ); - wchar_t* (*wc_reset)( - XIC - ); - char* (*utf8_reset)( - XIC - ); - int (*mb_lookup_string)( - XIC, XKeyEvent*, char*, int, KeySym*, Status* - ); - int (*wc_lookup_string)( - XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status* - ); - int (*utf8_lookup_string)( - XIC, XKeyEvent*, char*, int, KeySym*, Status* - ); -} XICMethodsRec, *XICMethods; - - -/* - * Input Context LC independent data - */ -typedef struct { - XIM im; /* XIM this IC belongs too */ - XIC next; /* linked list of ICs for IM */ - - Window client_window; /* window IM can use for */ - /* display or subwindows */ - XIMStyle input_style; /* IM's input style */ - Window focus_window; /* where key events go */ - unsigned long filter_events; /* event mask from IM */ - XICCallback geometry_callback; /* client callback */ - char * res_name; - char * res_class; - - XICCallback destroy_callback; - XICCallback string_conversion_callback; - XIMStringConversionText string_conversion; - XIMResetState reset_state; - XIMHotKeyTriggers *hotkey; - XIMHotKeyState hotkey_state; - - ICPreeditAttributes preedit_attr; /* visuals of preedit area */ - ICStatusAttributes status_attr; /* visuals of status area */ -} XICCoreRec, *XICCore; - - -/* - * an Input Context. Implementations may need to extend this data - * structure to accomodate additional data, state information etc. - */ -typedef struct _XIC { - XICMethods methods; /* method list of this IC */ - XICCoreRec core; /* data of this IC */ -} XICRec; - - -/* If the argument 'name' is appropriate for this loader, it instantiates an - XLCd object with appropriate locale methods and returns it. May return - NULL; in this case, the remaining loaders are tried. */ -typedef XLCd (*XLCdLoadProc)( - const char* name -); - -_XFUNCPROTOBEGIN - -extern XLCd _XOpenLC( - char* name -); - -extern void _XCloseLC( - XLCd lcd -); - -extern XLCd _XlcCurrentLC (void); - -extern Bool _XlcValidModSyntax( - const char* mods, - const char* const * valid -); - -extern char *_XlcDefaultMapModifiers( - XLCd lcd, - _Xconst char* user_mods, - _Xconst char* prog_mods -); - -extern void _XIMCompileResourceList( - XIMResourceList /* res */, - unsigned int /* num_res */ -); - -extern void _XCopyToArg( - XPointer /* src */, - XPointer* /* dst */, - unsigned int /* size */ -); - -extern char ** _XParseBaseFontNameList( - char* /* str */, - int* /* num */ -); - -extern XrmMethods _XrmInitParseInfo( - XPointer* statep -); - -extern void _XRegisterFilterByMask( - Display* /* dpy */, - Window /* window */, - unsigned long /* event_mask */, - Bool (*)( - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ - ) /* filter */, - XPointer /* client_data */ -); - -extern void _XRegisterFilterByType( - Display* /* dpy */, - Window /* window */, - int /* start_type */, - int /* end_type */, - Bool (*)( - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ - ) /* filter */, - XPointer /* client_data */ -); - -extern void _XUnregisterFilter( - Display* /* dpy */, - Window /* window */, - Bool (*)( - Display* /* display */, - Window /* window */, - XEvent* /* event */, - XPointer /* client_data */ - ) /* filter */, - XPointer /* client_data */ -); - -extern void _XlcCountVaList( - va_list var, - int* count_return -); - -extern void _XlcVaToArgList( - va_list var, - int count, - XlcArgList* args_return -); - - -extern void _XlcCopyFromArg( - char * src, - char * dst, - int size -); - -extern void _XlcCopyToArg( - char * src, - char ** dst, - int size -); - -extern void _XlcCompileResourceList( - XlcResourceList resources, - int num_resources -); - -extern char *_XlcGetValues( - XPointer base, - XlcResourceList resources, - int num_resources, - XlcArgList args, - int num_args, - unsigned long mask -); - -extern char *_XlcSetValues( - XPointer base, - XlcResourceList resources, - int num_resources, - XlcArgList args, - int num_args, - unsigned long mask -); - -/* documented in i18n/Framework.PS */ -extern void _XlcInitLoader (void); - -extern void _XlcDeInitLoader (void); - -/* documented in i18n/Framework.PS */ -/* Returns True on success, False on failure. */ -extern Bool _XlcAddLoader( - XLCdLoadProc proc, - XlcPosition position -); - -/* documented in i18n/Framework.PS */ -extern void _XlcRemoveLoader( - XLCdLoadProc proc -); - -/* Registers UTF-8 converters for a non-UTF-8 locale. */ -extern void _XlcAddUtf8Converters( - XLCd lcd -); - -/* Registers UTF-8 converters for a UTF-8 locale. */ -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 -); - -/* The generic locale loader. Suitable for all encodings except UTF-8. - Uses an XLC_LOCALE configuration file. */ -extern XLCd _XlcGenericLoader( - const char* name -); - -/* The UTF-8 locale loader. Suitable for UTF-8 encoding. - Uses an XLC_LOCALE configuration file. */ -extern XLCd _XlcUtf8Loader( - const char* name -); - -extern XLCd _XlcDynamicLoad( - const char* name -); - -/* The old dynamic loader. */ -extern XLCd _XlcDynamicLoader( - const char* name -); - -extern Bool _XInitDefaultIM( - XLCd lcd -); - -extern Bool _XInitDefaultOM( - XLCd lcd -); - -extern Bool _XInitDynamicIM( - XLCd lcd -); - -extern Bool _XInitDynamicOM( - XLCd lcd -); - -_XFUNCPROTOEND - -#endif /* !_XP_PRINT_SERVER_ */ - -#endif /* _XLCINT_H_ */ diff --git a/nx-X11/lib/X11/Xlib.h b/nx-X11/lib/X11/Xlib.h deleted file mode 100644 index 362fdb69e..000000000 --- a/nx-X11/lib/X11/Xlib.h +++ /dev/null @@ -1,4036 +0,0 @@ -/* - -Copyright 1985, 1986, 1987, 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - - -/* - * Xlib.h - Header definition and support file for the C subroutine - * interface library (Xlib) to the X Window System Protocol (V11). - * Structures and symbols starting with "_" are private to the library. - */ -#if !defined(_X11_XLIB_H_) && !defined(_XLIB_H_) -#define _X11_XLIB_H_ -#define _XLIB_H_ - -#define XlibSpecificationRelease 6 - -#include - -#if defined(__SCO__) || defined(__UNIXWARE__) -#include -#endif - -#include - -/* applications should not depend on these two headers being included! */ -#include -#include - -#ifndef X_WCHAR -#include -#else -/* replace this with #include or typedef appropriate for your system */ -typedef unsigned long wchar_t; -#endif - - -extern int -_Xmblen( - char *str, - int len - ); - -/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in - November 2000. Its presence is indicated through the following macro. */ -#define X_HAVE_UTF8_STRING 1 - -/* The Xlib structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -typedef char *XPointer; - -#define Bool int -#define Status int -#define True 1 -#define False 0 - -#define QueuedAlready 0 -#define QueuedAfterReading 1 -#define QueuedAfterFlush 2 - -#define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd) -#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) -#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) -#define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root) -#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual) -#define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc) -#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) -#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) -#define AllPlanes ((unsigned long)~0L) -#define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen) -#define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width) -#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height) -#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth) -#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight) -#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) -#define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries) -#define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens) -#define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor) -#define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version) -#define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version) -#define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release) -#define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name) -#define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) -#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap) -#define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit) -#define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order) -#define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad) -#define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order) -#define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1) -#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read) - -/* macros for screen oriented applications (toolkit) */ -#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr]) -#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy)) -#define DisplayOfScreen(s) ((s)->display) -#define RootWindowOfScreen(s) ((s)->root) -#define BlackPixelOfScreen(s) ((s)->black_pixel) -#define WhitePixelOfScreen(s) ((s)->white_pixel) -#define DefaultColormapOfScreen(s)((s)->cmap) -#define DefaultDepthOfScreen(s) ((s)->root_depth) -#define DefaultGCOfScreen(s) ((s)->default_gc) -#define DefaultVisualOfScreen(s)((s)->root_visual) -#define WidthOfScreen(s) ((s)->width) -#define HeightOfScreen(s) ((s)->height) -#define WidthMMOfScreen(s) ((s)->mwidth) -#define HeightMMOfScreen(s) ((s)->mheight) -#define PlanesOfScreen(s) ((s)->root_depth) -#define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries) -#define MinCmapsOfScreen(s) ((s)->min_maps) -#define MaxCmapsOfScreen(s) ((s)->max_maps) -#define DoesSaveUnders(s) ((s)->save_unders) -#define DoesBackingStore(s) ((s)->backing_store) -#define EventMaskOfScreen(s) ((s)->root_input_mask) - -/* - * Extensions need a way to hang private data on some structures. - */ -typedef struct _XExtData { - int number; /* number returned by XRegisterExtension */ - struct _XExtData *next; /* next item on list of data for structure */ - int (*free_private)( /* called to free private storage */ - struct _XExtData *extension - ); - XPointer private_data; /* data private to this extension. */ -} XExtData; - -/* - * This file contains structures used by the extension mechanism. - */ -typedef struct { /* public to extension, cannot be changed */ - int extension; /* extension number */ - int major_opcode; /* major op-code assigned by server */ - int first_event; /* first event number for the extension */ - int first_error; /* first error number for the extension */ -} XExtCodes; - -/* - * Data structure for retrieving info about pixmap formats. - */ - -typedef struct { - int depth; - int bits_per_pixel; - int scanline_pad; -} XPixmapFormatValues; - - -/* - * Data structure for setting graphics context. - */ -typedef struct { - int function; /* logical operation */ - unsigned long plane_mask;/* plane mask */ - unsigned long foreground;/* foreground pixel */ - unsigned long background;/* background pixel */ - int line_width; /* line width */ - int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ - int cap_style; /* CapNotLast, CapButt, - CapRound, CapProjecting */ - int join_style; /* JoinMiter, JoinRound, JoinBevel */ - int fill_style; /* FillSolid, FillTiled, - FillStippled, FillOpaeueStippled */ - int fill_rule; /* EvenOddRule, WindingRule */ - int arc_mode; /* ArcChord, ArcPieSlice */ - Pixmap tile; /* tile pixmap for tiling operations */ - Pixmap stipple; /* stipple 1 plane pixmap for stipping */ - int ts_x_origin; /* offset for tile or stipple operations */ - int ts_y_origin; - Font font; /* default text font for text operations */ - int subwindow_mode; /* ClipByChildren, IncludeInferiors */ - Bool graphics_exposures;/* boolean, should exposures be generated */ - int clip_x_origin; /* origin for clipping */ - int clip_y_origin; - Pixmap clip_mask; /* bitmap clipping; other calls for rects */ - int dash_offset; /* patterned/dashed line information */ - char dashes; -} XGCValues; - -/* - * Graphics context. The contents of this structure are implementation - * dependent. A GC should be treated as opaque by application code. - */ - -typedef struct _XGC -#ifdef XLIB_ILLEGAL_ACCESS -{ - XExtData *ext_data; /* hook for extension to hang data */ - GContext gid; /* protocol ID for graphics context */ - /* there is more to this structure, but it is private to Xlib */ -} -#endif -*GC; - -/* - * Visual structure; contains information about colormapping possible. - */ -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - VisualID visualid; /* visual id of this visual */ -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /* C++ class of screen (monochrome, etc.) */ -#else - int class; /* class of screen (monochrome, etc.) */ -#endif - unsigned long red_mask, green_mask, blue_mask; /* mask values */ - int bits_per_rgb; /* log base 2 of distinct color values */ - int map_entries; /* color map entries */ -} Visual; - -/* - * Depth structure; contains information for each possible depth. - */ -typedef struct { - int depth; /* this depth (Z) of the depth */ - int nvisuals; /* number of Visual types at this depth */ - Visual *visuals; /* list of visuals possible at this depth */ -} Depth; - -/* - * Information about the screen. The contents of this structure are - * implementation dependent. A Screen should be treated as opaque - * by application code. - */ - -struct _XDisplay; /* Forward declare before use for C++ */ - -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - struct _XDisplay *display;/* back pointer to display structure */ - Window root; /* Root window id. */ - int width, height; /* width and height of screen */ - int mwidth, mheight; /* width and height of in millimeters */ - int ndepths; /* number of depths possible */ - Depth *depths; /* list of allowable depths on the screen */ - int root_depth; /* bits per pixel */ - Visual *root_visual; /* root visual */ - GC default_gc; /* GC for the root root visual */ - Colormap cmap; /* default color map */ - unsigned long white_pixel; - unsigned long black_pixel; /* White and Black pixel values */ - int max_maps, min_maps; /* max and min color maps */ - int backing_store; /* Never, WhenMapped, Always */ - Bool save_unders; - long root_input_mask; /* initial root input mask */ -} Screen; - -/* - * Format structure; describes ZFormat data the screen will understand. - */ -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - int depth; /* depth of this image format */ - int bits_per_pixel; /* bits/pixel at this depth */ - int scanline_pad; /* scanline must padded to this multiple */ -} ScreenFormat; - -/* - * Data structure for setting window attributes. - */ -typedef struct { - Pixmap background_pixmap; /* background or None or ParentRelative */ - unsigned long background_pixel; /* background pixel */ - Pixmap border_pixmap; /* border of the window */ - unsigned long border_pixel; /* border pixel value */ - int bit_gravity; /* one of bit gravity values */ - int win_gravity; /* one of the window gravity values */ - int backing_store; /* NotUseful, WhenMapped, Always */ - unsigned long backing_planes;/* planes to be preseved if possible */ - unsigned long backing_pixel;/* value to use in restoring planes */ - Bool save_under; /* should bits under be saved? (popups) */ - long event_mask; /* set of events that should be saved */ - long do_not_propagate_mask; /* set of events that should not propagate */ - Bool override_redirect; /* boolean value for override-redirect */ - Colormap colormap; /* color map to be associated with window */ - Cursor cursor; /* cursor to be displayed (or None) */ -} XSetWindowAttributes; - -typedef struct { - int x, y; /* location of window */ - int width, height; /* width and height of window */ - int border_width; /* border width of window */ - int depth; /* depth of window */ - Visual *visual; /* the associated visual structure */ - Window root; /* root of screen containing window */ -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /* C++ InputOutput, InputOnly*/ -#else - int class; /* InputOutput, InputOnly*/ -#endif - int bit_gravity; /* one of bit gravity values */ - int win_gravity; /* one of the window gravity values */ - int backing_store; /* NotUseful, WhenMapped, Always */ - unsigned long backing_planes;/* planes to be preserved if possible */ - unsigned long backing_pixel;/* value to be used when restoring planes */ - Bool save_under; /* boolean, should bits under be saved? */ - Colormap colormap; /* color map to be associated with window */ - Bool map_installed; /* boolean, is color map currently installed*/ - int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ - long all_event_masks; /* set of events all people have interest in*/ - long your_event_mask; /* my event mask */ - long do_not_propagate_mask; /* set of events that should not propagate */ - Bool override_redirect; /* boolean value for override-redirect */ - Screen *screen; /* back pointer to correct screen */ -} XWindowAttributes; - -/* - * Data structure for host setting; getting routines. - * - */ - -typedef struct { - int family; /* for example FamilyInternet */ - int length; /* length of address, in bytes */ - char *address; /* pointer to where to find the bytes */ -} XHostAddress; - -/* - * Data structure for ServerFamilyInterpreted addresses in host routines - */ -typedef struct { - int typelength; /* length of type string, in bytes */ - int valuelength; /* length of value string, in bytes */ - char *type; /* pointer to where to find the type string */ - char *value; /* pointer to where to find the address */ -} XServerInterpretedAddress; - -/* - * Data structure for "image" data, used by image manipulation routines. - */ -typedef struct _XImage { - int width, height; /* size of image */ - int xoffset; /* number of pixels offset in X direction */ - int format; /* XYBitmap, XYPixmap, ZPixmap */ - char *data; /* pointer to image data */ - int byte_order; /* data byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* quant. of scanline 8, 16, 32 */ - int bitmap_bit_order; /* LSBFirst, MSBFirst */ - int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ - int depth; /* depth of image */ - int bytes_per_line; /* accelarator to next line */ - int bits_per_pixel; /* bits per pixel (ZPixmap) */ - unsigned long red_mask; /* bits in z arrangment */ - unsigned long green_mask; - unsigned long blue_mask; - XPointer obdata; /* hook for the object routines to hang on */ - struct funcs { /* image manipulation routines */ - struct _XImage *(*create_image)( - struct _XDisplay* /* display */, - Visual* /* visual */, - unsigned int /* depth */, - int /* format */, - int /* offset */, - char* /* data */, - unsigned int /* width */, - unsigned int /* height */, - int /* bitmap_pad */, - int /* bytes_per_line */); - int (*destroy_image) (struct _XImage *); - unsigned long (*get_pixel) (struct _XImage *, int, int); - int (*put_pixel) (struct _XImage *, int, int, unsigned long); - struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); - int (*add_pixel) (struct _XImage *, long); - } f; -} XImage; - -/* - * Data structure for XReconfigureWindow - */ -typedef struct { - int x, y; - int width, height; - int border_width; - Window sibling; - int stack_mode; -} XWindowChanges; - -/* - * Data structure used by color operations - */ -typedef struct { - unsigned long pixel; - unsigned short red, green, blue; - char flags; /* do_red, do_green, do_blue */ - char pad; -} XColor; - -/* - * Data structures for graphics operations. On most machines, these are - * congruent with the wire protocol structures, so reformatting the data - * can be avoided on these architectures. - */ -typedef struct { - short x1, y1, x2, y2; -} XSegment; - -typedef struct { - short x, y; -} XPoint; - -typedef struct { - short x, y; - unsigned short width, height; -} XRectangle; - -typedef struct { - short x, y; - unsigned short width, height; - short angle1, angle2; -} XArc; - - -/* Data structure for XChangeKeyboardControl */ - -typedef struct { - int key_click_percent; - int bell_percent; - int bell_pitch; - int bell_duration; - int led; - int led_mode; - int key; - int auto_repeat_mode; /* On, Off, Default */ -} XKeyboardControl; - -/* Data structure for XGetKeyboardControl */ - -typedef struct { - int key_click_percent; - int bell_percent; - unsigned int bell_pitch, bell_duration; - unsigned long led_mask; - int global_auto_repeat; - char auto_repeats[32]; -} XKeyboardState; - -/* Data structure for XGetMotionEvents. */ - -typedef struct { - Time time; - short x, y; -} XTimeCoord; - -/* Data structure for X{Set,Get}ModifierMapping */ - -typedef struct { - int max_keypermod; /* The server's max # of keys per modifier */ - KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */ -} XModifierKeymap; - - -/* - * Display datatype maintaining display specific data. - * The contents of this structure are implementation dependent. - * A Display should be treated as opaque by application code. - */ -#ifndef XLIB_ILLEGAL_ACCESS -typedef struct _XDisplay Display; -#endif - -struct _XPrivate; /* Forward declare before use for C++ */ -struct _XrmHashBucketRec; - -typedef struct -#ifdef XLIB_ILLEGAL_ACCESS -_XDisplay -#endif -{ - XExtData *ext_data; /* hook for extension to hang data */ - struct _XPrivate *private1; - int fd; /* Network socket. */ - int private2; - int proto_major_version;/* major version of server's X protocol */ - int proto_minor_version;/* minor version of servers X protocol */ - char *vendor; /* vendor of the server hardware */ - XID private3; - XID private4; - XID private5; - int private6; - XID (*resource_alloc)( /* allocator function */ - struct _XDisplay* - ); - int byte_order; /* screen byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* padding and data requirements */ - int bitmap_pad; /* padding requirements on bitmaps */ - int bitmap_bit_order; /* LeastSignificant or MostSignificant */ - int nformats; /* number of pixmap formats in list */ - ScreenFormat *pixmap_format; /* pixmap format list */ - int private8; - int release; /* release of the server */ - struct _XPrivate *private9, *private10; - int qlen; /* Length of input event queue */ - unsigned long last_request_read; /* seq number of last event read */ - unsigned long request; /* sequence number of last request. */ - XPointer private11; - XPointer private12; - XPointer private13; - XPointer private14; - unsigned max_request_size; /* maximum number 32 bit words in request*/ - struct _XrmHashBucketRec *db; - int (*private15)( - struct _XDisplay* - ); - char *display_name; /* "host:display" string used on this connect*/ - int default_screen; /* default screen for operations */ - int nscreens; /* number of screens on this server*/ - Screen *screens; /* pointer to list of screens */ - unsigned long motion_buffer; /* size of motion buffer */ - unsigned long private16; - int min_keycode; /* minimum defined keycode */ - int max_keycode; /* maximum defined keycode */ - XPointer private17; - XPointer private18; - int private19; - char *xdefaults; /* contents of defaults from server */ - /* there is more to this structure, but it is private to Xlib */ -} -#ifdef XLIB_ILLEGAL_ACCESS -Display, -#endif -*_XPrivDisplay; - -#undef _XEVENT_ -#ifndef _XEVENT_ -/* - * Definitions of specific events. - */ -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window it is reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - unsigned int state; /* key or button mask */ - unsigned int keycode; /* detail */ - Bool same_screen; /* same screen flag */ -} XKeyEvent; -typedef XKeyEvent XKeyPressedEvent; -typedef XKeyEvent XKeyReleasedEvent; - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window it is reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - unsigned int state; /* key or button mask */ - unsigned int button; /* detail */ - Bool same_screen; /* same screen flag */ -} XButtonEvent; -typedef XButtonEvent XButtonPressedEvent; -typedef XButtonEvent XButtonReleasedEvent; - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - unsigned int state; /* key or button mask */ - char is_hint; /* detail */ - Bool same_screen; /* same screen flag */ -} XMotionEvent; -typedef XMotionEvent XPointerMovedEvent; - -typedef struct { - int type; /* of event */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* "event" window reported relative to */ - Window root; /* root window that the event occurred on */ - Window subwindow; /* child window */ - Time time; /* milliseconds */ - int x, y; /* pointer x, y coordinates in event window */ - int x_root, y_root; /* coordinates relative to root */ - int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ - int detail; - /* - * NotifyAncestor, NotifyVirtual, NotifyInferior, - * NotifyNonlinear,NotifyNonlinearVirtual - */ - Bool same_screen; /* same screen flag */ - Bool focus; /* boolean focus */ - unsigned int state; /* key or button mask */ -} XCrossingEvent; -typedef XCrossingEvent XEnterWindowEvent; -typedef XCrossingEvent XLeaveWindowEvent; - -typedef struct { - int type; /* FocusIn or FocusOut */ - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* window of event */ - int mode; /* NotifyNormal, NotifyWhileGrabbed, - NotifyGrab, NotifyUngrab */ - int detail; - /* - * NotifyAncestor, NotifyVirtual, NotifyInferior, - * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, - * NotifyPointerRoot, NotifyDetailNone - */ -} XFocusChangeEvent; -typedef XFocusChangeEvent XFocusInEvent; -typedef XFocusChangeEvent XFocusOutEvent; - -/* generated on EnterWindow and FocusIn when KeyMapState selected */ -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - char key_vector[32]; -} XKeymapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - int x, y; - int width, height; - int count; /* if non-zero, at least this many more */ -} XExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Drawable drawable; - int x, y; - int width, height; - int count; /* if non-zero, at least this many more */ - int major_code; /* core is CopyArea or CopyPlane */ - int minor_code; /* not defined in the core */ -} XGraphicsExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Drawable drawable; - int major_code; /* core is CopyArea or CopyPlane */ - int minor_code; /* not defined in the core */ -} XNoExposeEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - int state; /* Visibility state */ -} XVisibilityEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; /* parent of the window */ - Window window; /* window id of window created */ - int x, y; /* window location */ - int width, height; /* size of window */ - int border_width; /* border width */ - Bool override_redirect; /* creation should be overridden */ -} XCreateWindowEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; -} XDestroyWindowEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - Bool from_configure; -} XUnmapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - Bool override_redirect; /* boolean, is override set... */ -} XMapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; - Window window; -} XMapRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - Window parent; - int x, y; - Bool override_redirect; -} XReparentEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - int x, y; - int width, height; - int border_width; - Window above; - Bool override_redirect; -} XConfigureEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - int x, y; -} XGravityEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - int width, height; -} XResizeRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; - Window window; - int x, y; - int width, height; - int border_width; - Window above; - int detail; /* Above, Below, TopIf, BottomIf, Opposite */ - unsigned long value_mask; -} XConfigureRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window event; - Window window; - int place; /* PlaceOnTop, PlaceOnBottom */ -} XCirculateEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window parent; - Window window; - int place; /* PlaceOnTop, PlaceOnBottom */ -} XCirculateRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Atom atom; - Time time; - int state; /* NewValue, Deleted */ -} XPropertyEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Atom selection; - Time time; -} XSelectionClearEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window owner; - Window requestor; - Atom selection; - Atom target; - Atom property; - Time time; -} XSelectionRequestEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window requestor; - Atom selection; - Atom target; - Atom property; /* ATOM or None */ - Time time; -} XSelectionEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Colormap colormap; /* COLORMAP or None */ -#if defined(__cplusplus) || defined(c_plusplus) - Bool c_new; /* C++ */ -#else - Bool new; -#endif - int state; /* ColormapInstalled, ColormapUninstalled */ -} XColormapEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; - Atom message_type; - int format; - union { - char b[20]; - short s[10]; - long l[5]; - } data; -} XClientMessageEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display; /* Display the event was read from */ - Window window; /* unused */ - int request; /* one of MappingModifier, MappingKeyboard, - MappingPointer */ - int first_keycode; /* first keycode */ - int count; /* defines range of change w. first_keycode*/ -} XMappingEvent; - -typedef struct { - int type; - Display *display; /* Display the event was read from */ - XID resourceid; /* resource id */ - unsigned long serial; /* serial number of failed request */ - unsigned char error_code; /* error code of failed request */ - unsigned char request_code; /* Major op-code of failed request */ - unsigned char minor_code; /* Minor op-code of failed request */ -} XErrorEvent; - -typedef struct { - int type; - unsigned long serial; /* # of last request processed by server */ - Bool send_event; /* true if this came from a SendEvent request */ - Display *display;/* Display the event was read from */ - Window window; /* window on which event was requested in event mask */ -} XAnyEvent; - - -/*************************************************************** - * - * GenericEvent. This event is the standard event for all newer extensions. - */ - -typedef struct - { - int type; /* of event. Always GenericEvent */ - unsigned long serial; /* # of last request processed */ - Bool send_event; /* true if from SendEvent request */ - Display *display; /* Display the event was read from */ - int extension; /* major opcode of extension that caused the event */ - int evtype; /* actual event type. */ - } XGenericEvent; - -typedef struct { - int type; /* of event. Always GenericEvent */ - unsigned long serial; /* # of last request processed */ - Bool send_event; /* true if from SendEvent request */ - Display *display; /* Display the event was read from */ - int extension; /* major opcode of extension that caused the event */ - int evtype; /* actual event type. */ - unsigned int cookie; - void *data; -} XGenericEventCookie; - -/* - * this union is defined so Xlib can always use the same sized - * event structure internally, to avoid memory fragmentation. - */ -typedef union _XEvent { - int type; /* must not be changed; first element */ - XAnyEvent xany; - XKeyEvent xkey; - XButtonEvent xbutton; - XMotionEvent xmotion; - XCrossingEvent xcrossing; - XFocusChangeEvent xfocus; - XExposeEvent xexpose; - XGraphicsExposeEvent xgraphicsexpose; - XNoExposeEvent xnoexpose; - XVisibilityEvent xvisibility; - XCreateWindowEvent xcreatewindow; - XDestroyWindowEvent xdestroywindow; - XUnmapEvent xunmap; - XMapEvent xmap; - XMapRequestEvent xmaprequest; - XReparentEvent xreparent; - XConfigureEvent xconfigure; - XGravityEvent xgravity; - XResizeRequestEvent xresizerequest; - XConfigureRequestEvent xconfigurerequest; - XCirculateEvent xcirculate; - XCirculateRequestEvent xcirculaterequest; - XPropertyEvent xproperty; - XSelectionClearEvent xselectionclear; - XSelectionRequestEvent xselectionrequest; - XSelectionEvent xselection; - XColormapEvent xcolormap; - XClientMessageEvent xclient; - XMappingEvent xmapping; - XErrorEvent xerror; - XKeymapEvent xkeymap; - XGenericEvent xgeneric; - XGenericEventCookie xcookie; - long pad[24]; -} XEvent; -#endif - -#define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy))) - -/* - * per character font metric information. - */ -typedef struct { - short lbearing; /* origin to left edge of raster */ - short rbearing; /* origin to right edge of raster */ - short width; /* advance to next char's origin */ - short ascent; /* baseline to top edge of raster */ - short descent; /* baseline to bottom edge of raster */ - unsigned short attributes; /* per char flags (not predefined) */ -} XCharStruct; - -/* - * To allow arbitrary information with fonts, there are additional properties - * returned. - */ -typedef struct { - Atom name; - unsigned long card32; -} XFontProp; - -typedef struct { - XExtData *ext_data; /* hook for extension to hang data */ - Font fid; /* Font id for this font */ - unsigned direction; /* hint about direction the font is painted */ - unsigned min_char_or_byte2;/* first character */ - unsigned max_char_or_byte2;/* last character */ - unsigned min_byte1; /* first row that exists */ - unsigned max_byte1; /* last row that exists */ - Bool all_chars_exist;/* flag if all characters have non-zero size*/ - unsigned default_char; /* char to print for undefined character */ - int n_properties; /* how many properties there are */ - XFontProp *properties; /* pointer to array of additional properties*/ - XCharStruct min_bounds; /* minimum bounds over all existing char*/ - XCharStruct max_bounds; /* maximum bounds over all existing char*/ - XCharStruct *per_char; /* first_char to last_char information */ - int ascent; /* log. extent above baseline for spacing */ - int descent; /* log. descent below baseline for spacing */ -} XFontStruct; - -/* - * PolyText routines take these as arguments. - */ -typedef struct { - char *chars; /* pointer to string */ - int nchars; /* number of characters */ - int delta; /* delta between strings */ - Font font; /* font to print it in, None don't change */ -} XTextItem; - -typedef struct { /* normal 16 bit characters are two bytes */ - unsigned char byte1; - unsigned char byte2; -} XChar2b; - -typedef struct { - XChar2b *chars; /* two byte characters */ - int nchars; /* number of characters */ - int delta; /* delta between strings */ - Font font; /* font to print it in, None don't change */ -} XTextItem16; - - -typedef union { Display *display; - GC gc; - Visual *visual; - Screen *screen; - ScreenFormat *pixmap_format; - XFontStruct *font; } XEDataObject; - -typedef struct { - XRectangle max_ink_extent; - XRectangle max_logical_extent; -} XFontSetExtents; - -/* unused: -typedef void (*XOMProc)(); - */ - -typedef struct _XOM *XOM; -typedef struct _XOC *XOC, *XFontSet; - -typedef struct { - char *chars; - int nchars; - int delta; - XFontSet font_set; -} XmbTextItem; - -typedef struct { - wchar_t *chars; - int nchars; - int delta; - XFontSet font_set; -} XwcTextItem; - -#define XNRequiredCharSet "requiredCharSet" -#define XNQueryOrientation "queryOrientation" -#define XNBaseFontName "baseFontName" -#define XNOMAutomatic "omAutomatic" -#define XNMissingCharSet "missingCharSet" -#define XNDefaultString "defaultString" -#define XNOrientation "orientation" -#define XNDirectionalDependentDrawing "directionalDependentDrawing" -#define XNContextualDrawing "contextualDrawing" -#define XNFontInfo "fontInfo" - -typedef struct { - int charset_count; - char **charset_list; -} XOMCharSetList; - -typedef enum { - XOMOrientation_LTR_TTB, - XOMOrientation_RTL_TTB, - XOMOrientation_TTB_LTR, - XOMOrientation_TTB_RTL, - XOMOrientation_Context -} XOrientation; - -typedef struct { - int num_orientation; - XOrientation *orientation; /* Input Text description */ -} XOMOrientation; - -typedef struct { - int num_font; - XFontStruct **font_struct_list; - char **font_name_list; -} XOMFontInfo; - -typedef struct _XIM *XIM; -typedef struct _XIC *XIC; - -typedef void (*XIMProc)( - XIM, - XPointer, - XPointer -); - -typedef Bool (*XICProc)( - XIC, - XPointer, - XPointer -); - -typedef void (*XIDProc)( - Display*, - XPointer, - XPointer -); - -typedef unsigned long XIMStyle; - -typedef struct { - unsigned short count_styles; - XIMStyle *supported_styles; -} XIMStyles; - -#define XIMPreeditArea 0x0001L -#define XIMPreeditCallbacks 0x0002L -#define XIMPreeditPosition 0x0004L -#define XIMPreeditNothing 0x0008L -#define XIMPreeditNone 0x0010L -#define XIMStatusArea 0x0100L -#define XIMStatusCallbacks 0x0200L -#define XIMStatusNothing 0x0400L -#define XIMStatusNone 0x0800L - -#define XNVaNestedList "XNVaNestedList" -#define XNQueryInputStyle "queryInputStyle" -#define XNClientWindow "clientWindow" -#define XNInputStyle "inputStyle" -#define XNFocusWindow "focusWindow" -#define XNResourceName "resourceName" -#define XNResourceClass "resourceClass" -#define XNGeometryCallback "geometryCallback" -#define XNDestroyCallback "destroyCallback" -#define XNFilterEvents "filterEvents" -#define XNPreeditStartCallback "preeditStartCallback" -#define XNPreeditDoneCallback "preeditDoneCallback" -#define XNPreeditDrawCallback "preeditDrawCallback" -#define XNPreeditCaretCallback "preeditCaretCallback" -#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback" -#define XNPreeditAttributes "preeditAttributes" -#define XNStatusStartCallback "statusStartCallback" -#define XNStatusDoneCallback "statusDoneCallback" -#define XNStatusDrawCallback "statusDrawCallback" -#define XNStatusAttributes "statusAttributes" -#define XNArea "area" -#define XNAreaNeeded "areaNeeded" -#define XNSpotLocation "spotLocation" -#define XNColormap "colorMap" -#define XNStdColormap "stdColorMap" -#define XNForeground "foreground" -#define XNBackground "background" -#define XNBackgroundPixmap "backgroundPixmap" -#define XNFontSet "fontSet" -#define XNLineSpace "lineSpace" -#define XNCursor "cursor" - -#define XNQueryIMValuesList "queryIMValuesList" -#define XNQueryICValuesList "queryICValuesList" -#define XNVisiblePosition "visiblePosition" -#define XNR6PreeditCallback "r6PreeditCallback" -#define XNStringConversionCallback "stringConversionCallback" -#define XNStringConversion "stringConversion" -#define XNResetState "resetState" -#define XNHotKey "hotKey" -#define XNHotKeyState "hotKeyState" -#define XNPreeditState "preeditState" -#define XNSeparatorofNestedList "separatorofNestedList" - -#define XBufferOverflow -1 -#define XLookupNone 1 -#define XLookupChars 2 -#define XLookupKeySym 3 -#define XLookupBoth 4 - -typedef void *XVaNestedList; - -typedef struct { - XPointer client_data; - XIMProc callback; -} XIMCallback; - -typedef struct { - XPointer client_data; - XICProc callback; -} XICCallback; - -typedef unsigned long XIMFeedback; - -#define XIMReverse 1L -#define XIMUnderline (1L<<1) -#define XIMHighlight (1L<<2) -#define XIMPrimary (1L<<5) -#define XIMSecondary (1L<<6) -#define XIMTertiary (1L<<7) -#define XIMVisibleToForward (1L<<8) -#define XIMVisibleToBackword (1L<<9) -#define XIMVisibleToCenter (1L<<10) - -typedef struct _XIMText { - unsigned short length; - XIMFeedback *feedback; - Bool encoding_is_wchar; - union { - char *multi_byte; - wchar_t *wide_char; - } string; -} XIMText; - -typedef unsigned long XIMPreeditState; - -#define XIMPreeditUnKnown 0L -#define XIMPreeditEnable 1L -#define XIMPreeditDisable (1L<<1) - -typedef struct _XIMPreeditStateNotifyCallbackStruct { - XIMPreeditState state; -} XIMPreeditStateNotifyCallbackStruct; - -typedef unsigned long XIMResetState; - -#define XIMInitialState 1L -#define XIMPreserveState (1L<<1) - -typedef unsigned long XIMStringConversionFeedback; - -#define XIMStringConversionLeftEdge (0x00000001) -#define XIMStringConversionRightEdge (0x00000002) -#define XIMStringConversionTopEdge (0x00000004) -#define XIMStringConversionBottomEdge (0x00000008) -#define XIMStringConversionConcealed (0x00000010) -#define XIMStringConversionWrapped (0x00000020) - -typedef struct _XIMStringConversionText { - unsigned short length; - XIMStringConversionFeedback *feedback; - Bool encoding_is_wchar; - union { - char *mbs; - wchar_t *wcs; - } string; -} XIMStringConversionText; - -typedef unsigned short XIMStringConversionPosition; - -typedef unsigned short XIMStringConversionType; - -#define XIMStringConversionBuffer (0x0001) -#define XIMStringConversionLine (0x0002) -#define XIMStringConversionWord (0x0003) -#define XIMStringConversionChar (0x0004) - -typedef unsigned short XIMStringConversionOperation; - -#define XIMStringConversionSubstitution (0x0001) -#define XIMStringConversionRetrieval (0x0002) - -typedef enum { - XIMForwardChar, XIMBackwardChar, - XIMForwardWord, XIMBackwardWord, - XIMCaretUp, XIMCaretDown, - XIMNextLine, XIMPreviousLine, - XIMLineStart, XIMLineEnd, - XIMAbsolutePosition, - XIMDontChange -} XIMCaretDirection; - -typedef struct _XIMStringConversionCallbackStruct { - XIMStringConversionPosition position; - XIMCaretDirection direction; - XIMStringConversionOperation operation; - unsigned short factor; - XIMStringConversionText *text; -} XIMStringConversionCallbackStruct; - -typedef struct _XIMPreeditDrawCallbackStruct { - int caret; /* Cursor offset within pre-edit string */ - int chg_first; /* Starting change position */ - int chg_length; /* Length of the change in character count */ - XIMText *text; -} XIMPreeditDrawCallbackStruct; - -typedef enum { - XIMIsInvisible, /* Disable caret feedback */ - XIMIsPrimary, /* UI defined caret feedback */ - XIMIsSecondary /* UI defined caret feedback */ -} XIMCaretStyle; - -typedef struct _XIMPreeditCaretCallbackStruct { - int position; /* Caret offset within pre-edit string */ - XIMCaretDirection direction; /* Caret moves direction */ - XIMCaretStyle style; /* Feedback of the caret */ -} XIMPreeditCaretCallbackStruct; - -typedef enum { - XIMTextType, - XIMBitmapType -} XIMStatusDataType; - -typedef struct _XIMStatusDrawCallbackStruct { - XIMStatusDataType type; - union { - XIMText *text; - Pixmap bitmap; - } data; -} XIMStatusDrawCallbackStruct; - -typedef struct _XIMHotKeyTrigger { - KeySym keysym; - int modifier; - int modifier_mask; -} XIMHotKeyTrigger; - -typedef struct _XIMHotKeyTriggers { - int num_hot_key; - XIMHotKeyTrigger *key; -} XIMHotKeyTriggers; - -typedef unsigned long XIMHotKeyState; - -#define XIMHotKeyStateON (0x0001L) -#define XIMHotKeyStateOFF (0x0002L) - -typedef struct { - unsigned short count_values; - char **supported_values; -} XIMValuesList; - -_XFUNCPROTOBEGIN - -#if defined(WIN32) && !defined(_XLIBINT_) -#define _Xdebug (*_Xdebug_p) -#endif - -extern int _Xdebug; - -extern XFontStruct *XLoadQueryFont( - Display* /* display */, - _Xconst char* /* name */ -); - -extern XFontStruct *XQueryFont( - Display* /* display */, - XID /* font_ID */ -); - - -extern XTimeCoord *XGetMotionEvents( - Display* /* display */, - Window /* w */, - Time /* start */, - Time /* stop */, - int* /* nevents_return */ -); - -extern XModifierKeymap *XDeleteModifiermapEntry( - XModifierKeymap* /* modmap */, -#if NeedWidePrototypes - unsigned int /* keycode_entry */, -#else - KeyCode /* keycode_entry */, -#endif - int /* modifier */ -); - -extern XModifierKeymap *XGetModifierMapping( - Display* /* display */ -); - -extern XModifierKeymap *XInsertModifiermapEntry( - XModifierKeymap* /* modmap */, -#if NeedWidePrototypes - unsigned int /* keycode_entry */, -#else - KeyCode /* keycode_entry */, -#endif - int /* modifier */ -); - -extern XModifierKeymap *XNewModifiermap( - int /* max_keys_per_mod */ -); - -extern XImage *XCreateImage( - Display* /* display */, - Visual* /* visual */, - unsigned int /* depth */, - int /* format */, - int /* offset */, - char* /* data */, - unsigned int /* width */, - unsigned int /* height */, - int /* bitmap_pad */, - int /* bytes_per_line */ -); -extern Status XInitImage( - XImage* /* image */ -); -extern XImage *XGetImage( - Display* /* display */, - Drawable /* d */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* plane_mask */, - int /* format */ -); -extern XImage *XGetSubImage( - Display* /* display */, - Drawable /* d */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* plane_mask */, - int /* format */, - XImage* /* dest_image */, - int /* dest_x */, - int /* dest_y */ -); - -/* - * X function declarations. - */ -extern Display *XOpenDisplay( - _Xconst char* /* display_name */ -); - -extern void XrmInitialize( - void -); - -extern char *XFetchBytes( - Display* /* display */, - int* /* nbytes_return */ -); -extern char *XFetchBuffer( - Display* /* display */, - int* /* nbytes_return */, - int /* buffer */ -); -extern char *XGetAtomName( - Display* /* display */, - Atom /* atom */ -); -extern Status XGetAtomNames( - Display* /* dpy */, - Atom* /* atoms */, - int /* count */, - char** /* names_return */ -); -extern char *XGetDefault( - Display* /* display */, - _Xconst char* /* program */, - _Xconst char* /* option */ -); -extern char *XDisplayName( - _Xconst char* /* string */ -); -extern char *XKeysymToString( - KeySym /* keysym */ -); - -extern int (*XSynchronize( - Display* /* display */, - Bool /* onoff */ -))( - Display* /* display */ -); -extern int (*XSetAfterFunction( - Display* /* display */, - int (*) ( - Display* /* display */ - ) /* procedure */ -))( - Display* /* display */ -); -extern Atom XInternAtom( - Display* /* display */, - _Xconst char* /* atom_name */, - Bool /* only_if_exists */ -); -extern Status XInternAtoms( - Display* /* dpy */, - char** /* names */, - int /* count */, - Bool /* onlyIfExists */, - Atom* /* atoms_return */ -); -extern Colormap XCopyColormapAndFree( - Display* /* display */, - Colormap /* colormap */ -); -extern Colormap XCreateColormap( - Display* /* display */, - Window /* w */, - Visual* /* visual */, - int /* alloc */ -); -extern Cursor XCreatePixmapCursor( - Display* /* display */, - Pixmap /* source */, - Pixmap /* mask */, - XColor* /* foreground_color */, - XColor* /* background_color */, - unsigned int /* x */, - unsigned int /* y */ -); -extern Cursor XCreateGlyphCursor( - Display* /* display */, - Font /* source_font */, - Font /* mask_font */, - unsigned int /* source_char */, - unsigned int /* mask_char */, - XColor _Xconst * /* foreground_color */, - XColor _Xconst * /* background_color */ -); -extern Cursor XCreateFontCursor( - Display* /* display */, - unsigned int /* shape */ -); -extern Font XLoadFont( - Display* /* display */, - _Xconst char* /* name */ -); -extern GC XCreateGC( - Display* /* display */, - Drawable /* d */, - unsigned long /* valuemask */, - XGCValues* /* values */ -); -extern GContext XGContextFromGC( - GC /* gc */ -); -extern void XFlushGC( - Display* /* display */, - GC /* gc */ -); -extern Pixmap XCreatePixmap( - Display* /* display */, - Drawable /* d */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* depth */ -); -extern Pixmap XCreateBitmapFromData( - Display* /* display */, - Drawable /* d */, - _Xconst char* /* data */, - unsigned int /* width */, - unsigned int /* height */ -); -extern Pixmap XCreatePixmapFromBitmapData( - Display* /* display */, - Drawable /* d */, - char* /* data */, - unsigned int /* width */, - unsigned int /* height */, - unsigned long /* fg */, - unsigned long /* bg */, - unsigned int /* depth */ -); -extern Window XCreateSimpleWindow( - Display* /* display */, - Window /* parent */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* border_width */, - unsigned long /* border */, - unsigned long /* background */ -); -extern Window XGetSelectionOwner( - Display* /* display */, - Atom /* selection */ -); -extern Window XCreateWindow( - Display* /* display */, - Window /* parent */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int /* border_width */, - int /* depth */, - unsigned int /* class */, - Visual* /* visual */, - unsigned long /* valuemask */, - XSetWindowAttributes* /* attributes */ -); -extern Colormap *XListInstalledColormaps( - Display* /* display */, - Window /* w */, - int* /* num_return */ -); -extern char **XListFonts( - Display* /* display */, - _Xconst char* /* pattern */, - int /* maxnames */, - int* /* actual_count_return */ -); -extern char **XListFontsWithInfo( - Display* /* display */, - _Xconst char* /* pattern */, - int /* maxnames */, - int* /* count_return */, - XFontStruct** /* info_return */ -); -extern char **XGetFontPath( - Display* /* display */, - int* /* npaths_return */ -); -extern char **XListExtensions( - Display* /* display */, - int* /* nextensions_return */ -); -extern Atom *XListProperties( - Display* /* display */, - Window /* w */, - int* /* num_prop_return */ -); -extern XHostAddress *XListHosts( - Display* /* display */, - int* /* nhosts_return */, - Bool* /* state_return */ -); - -/* this is marked as_X_DEPRECATED in Xorg's upstream libX11 but NX - needs it for performance reasons. Should be moved into the - server. */ -extern KeySym XKeycodeToKeysym( - Display* /* display */, -#if NeedWidePrototypes - unsigned int /* keycode */, -#else - KeyCode /* keycode */, -#endif - int /* index */ -); -extern KeySym XLookupKeysym( - XKeyEvent* /* key_event */, - int /* index */ -); -extern KeySym *XGetKeyboardMapping( - Display* /* display */, -#if NeedWidePrototypes - unsigned int /* first_keycode */, -#else - KeyCode /* first_keycode */, -#endif - int /* keycode_count */, - int* /* keysyms_per_keycode_return */ -); -extern KeySym XStringToKeysym( - _Xconst char* /* string */ -); -extern long XMaxRequestSize( - Display* /* display */ -); -extern long XExtendedMaxRequestSize( - Display* /* display */ -); -extern char *XResourceManagerString( - Display* /* display */ -); -extern char *XScreenResourceString( - Screen* /* screen */ -); -extern unsigned long XDisplayMotionBufferSize( - Display* /* display */ -); -extern VisualID XVisualIDFromVisual( - Visual* /* visual */ -); - -/* multithread routines */ - -extern Status XInitThreads( - void -); - -extern void XLockDisplay( - Display* /* display */ -); - -extern void XUnlockDisplay( - Display* /* display */ -); - -/* routines for dealing with extensions */ - -extern XExtCodes *XInitExtension( - Display* /* display */, - _Xconst char* /* name */ -); - -extern XExtCodes *XAddExtension( - Display* /* display */ -); -extern XExtData *XFindOnExtensionList( - XExtData** /* structure */, - int /* number */ -); -extern XExtData **XEHeadOfExtensionList( - XEDataObject /* object */ -); - -/* these are routines for which there are also macros */ -extern Window XRootWindow( - Display* /* display */, - int /* screen_number */ -); -extern Window XDefaultRootWindow( - Display* /* display */ -); -extern Window XRootWindowOfScreen( - Screen* /* screen */ -); -extern Visual *XDefaultVisual( - Display* /* display */, - int /* screen_number */ -); -extern Visual *XDefaultVisualOfScreen( - Screen* /* screen */ -); -extern GC XDefaultGC( - Display* /* display */, - int /* screen_number */ -); -extern GC XDefaultGCOfScreen( - Screen* /* screen */ -); -extern unsigned long XBlackPixel( - Display* /* display */, - int /* screen_number */ -); -extern unsigned long XWhitePixel( - Display* /* display */, - int /* screen_number */ -); -extern unsigned long XAllPlanes( - void -); -extern unsigned long XBlackPixelOfScreen( - Screen* /* screen */ -); -extern unsigned long XWhitePixelOfScreen( - Screen* /* screen */ -); -extern unsigned long XNextRequest( - Display* /* display */ -); -extern unsigned long XLastKnownRequestProcessed( - Display* /* display */ -); -extern char *XServerVendor( - Display* /* display */ -); -extern char *XDisplayString( - Display* /* display */ -); -extern Colormap XDefaultColormap( - Display* /* display */, - int /* screen_number */ -); -extern Colormap XDefaultColormapOfScreen( - Screen* /* screen */ -); -extern Display *XDisplayOfScreen( - Screen* /* screen */ -); -extern Screen *XScreenOfDisplay( - Display* /* display */, - int /* screen_number */ -); -extern Screen *XDefaultScreenOfDisplay( - Display* /* display */ -); -extern long XEventMaskOfScreen( - Screen* /* screen */ -); - -extern int XScreenNumberOfScreen( - Screen* /* screen */ -); - -typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ - Display* /* display */, - XErrorEvent* /* error_event */ -); - -extern XErrorHandler XSetErrorHandler ( - XErrorHandler /* handler */ -); - - -typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */ - Display* /* display */ -); - -extern XIOErrorHandler XSetIOErrorHandler ( - XIOErrorHandler /* handler */ -); - - -extern XPixmapFormatValues *XListPixmapFormats( - Display* /* display */, - int* /* count_return */ -); -extern int *XListDepths( - Display* /* display */, - int /* screen_number */, - int* /* count_return */ -); - -/* ICCCM routines for things that don't require special include files; */ -/* other declarations are given in Xutil.h */ -extern Status XReconfigureWMWindow( - Display* /* display */, - Window /* w */, - int /* screen_number */, - unsigned int /* mask */, - XWindowChanges* /* changes */ -); - -extern Status XGetWMProtocols( - Display* /* display */, - Window /* w */, - Atom** /* protocols_return */, - int* /* count_return */ -); -extern Status XSetWMProtocols( - Display* /* display */, - Window /* w */, - Atom* /* protocols */, - int /* count */ -); -extern Status XIconifyWindow( - Display* /* display */, - Window /* w */, - int /* screen_number */ -); -extern Status XWithdrawWindow( - Display* /* display */, - Window /* w */, - int /* screen_number */ -); -extern Status XGetCommand( - Display* /* display */, - Window /* w */, - char*** /* argv_return */, - int* /* argc_return */ -); -extern Status XGetWMColormapWindows( - Display* /* display */, - Window /* w */, - Window** /* windows_return */, - int* /* count_return */ -); -extern Status XSetWMColormapWindows( - Display* /* display */, - Window /* w */, - Window* /* colormap_windows */, - int /* count */ -); -extern void XFreeStringList( - char** /* list */ -); -extern int XSetTransientForHint( - Display* /* display */, - Window /* w */, - Window /* prop_window */ -); - -/* The following are given in alphabetical order */ - -extern int XActivateScreenSaver( - Display* /* display */ -); - -extern int XAddHost( - Display* /* display */, - XHostAddress* /* host */ -); - -extern int XAddHosts( - Display* /* display */, - XHostAddress* /* hosts */, - int /* num_hosts */ -); - -extern int XAddToExtensionList( - struct _XExtData** /* structure */, - XExtData* /* ext_data */ -); - -extern int XAddToSaveSet( - Display* /* display */, - Window /* w */ -); - -extern Status XAllocColor( - Display* /* display */, - Colormap /* colormap */, - XColor* /* screen_in_out */ -); - -extern Status XAllocColorCells( - Display* /* display */, - Colormap /* colormap */, - Bool /* contig */, - unsigned long* /* plane_masks_return */, - unsigned int /* nplanes */, - unsigned long* /* pixels_return */, - unsigned int /* npixels */ -); - -extern Status XAllocColorPlanes( - Display* /* display */, - Colormap /* colormap */, - Bool /* contig */, - unsigned long* /* pixels_return */, - int /* ncolors */, - int /* nreds */, - int /* ngreens */, - int /* nblues */, - unsigned long* /* rmask_return */, - unsigned long* /* gmask_return */, - unsigned long* /* bmask_return */ -); - -extern Status XAllocNamedColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* color_name */, - XColor* /* screen_def_return */, - XColor* /* exact_def_return */ -); - -extern int XAllowEvents( - Display* /* display */, - int /* event_mode */, - Time /* time */ -); - -extern int XAutoRepeatOff( - Display* /* display */ -); - -extern int XAutoRepeatOn( - Display* /* display */ -); - -extern int XBell( - Display* /* display */, - int /* percent */ -); - -extern int XBitmapBitOrder( - Display* /* display */ -); - -extern int XBitmapPad( - Display* /* display */ -); - -extern int XBitmapUnit( - Display* /* display */ -); - -extern int XCellsOfScreen( - Screen* /* screen */ -); - -extern int XChangeActivePointerGrab( - Display* /* display */, - unsigned int /* event_mask */, - Cursor /* cursor */, - Time /* time */ -); - -extern int XChangeGC( - Display* /* display */, - GC /* gc */, - unsigned long /* valuemask */, - XGCValues* /* values */ -); - -extern int XChangeKeyboardControl( - Display* /* display */, - unsigned long /* value_mask */, - XKeyboardControl* /* values */ -); - -extern int XChangeKeyboardMapping( - Display* /* display */, - int /* first_keycode */, - int /* keysyms_per_keycode */, - KeySym* /* keysyms */, - int /* num_codes */ -); - -extern int XChangePointerControl( - Display* /* display */, - Bool /* do_accel */, - Bool /* do_threshold */, - int /* accel_numerator */, - int /* accel_denominator */, - int /* threshold */ -); - -extern int XChangeProperty( - Display* /* display */, - Window /* w */, - Atom /* property */, - Atom /* type */, - int /* format */, - int /* mode */, - _Xconst unsigned char* /* data */, - int /* nelements */ -); - -extern int XChangeSaveSet( - Display* /* display */, - Window /* w */, - int /* change_mode */ -); - -extern int XChangeWindowAttributes( - Display* /* display */, - Window /* w */, - unsigned long /* valuemask */, - XSetWindowAttributes* /* attributes */ -); - -extern Bool XCheckIfEvent( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -#ifdef NX_TRANS_SOCKET - -/* - * This is just like XCheckIfEvent() but doesn't - * flush the output buffer if it can't read new - * events. - */ - -extern Bool XCheckIfEventNoFlush( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -#endif - -extern Bool XCheckMaskEvent( - Display* /* display */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern Bool XCheckTypedEvent( - Display* /* display */, - int /* event_type */, - XEvent* /* event_return */ -); - -extern Bool XCheckTypedWindowEvent( - Display* /* display */, - Window /* w */, - int /* event_type */, - XEvent* /* event_return */ -); - -extern Bool XCheckWindowEvent( - Display* /* display */, - Window /* w */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern int XCirculateSubwindows( - Display* /* display */, - Window /* w */, - int /* direction */ -); - -extern int XCirculateSubwindowsDown( - Display* /* display */, - Window /* w */ -); - -extern int XCirculateSubwindowsUp( - Display* /* display */, - Window /* w */ -); - -extern int XClearArea( - Display* /* display */, - Window /* w */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - Bool /* exposures */ -); - -extern int XClearWindow( - Display* /* display */, - Window /* w */ -); - -extern int XCloseDisplay( - Display* /* display */ -); - -extern int XConfigureWindow( - Display* /* display */, - Window /* w */, - unsigned int /* value_mask */, - XWindowChanges* /* values */ -); - -extern int XConnectionNumber( - Display* /* display */ -); - -extern int XConvertSelection( - Display* /* display */, - Atom /* selection */, - Atom /* target */, - Atom /* property */, - Window /* requestor */, - Time /* time */ -); - -extern int XCopyArea( - Display* /* display */, - Drawable /* src */, - Drawable /* dest */, - GC /* gc */, - int /* src_x */, - int /* src_y */, - unsigned int /* width */, - unsigned int /* height */, - int /* dest_x */, - int /* dest_y */ -); - -extern int XCopyGC( - Display* /* display */, - GC /* src */, - unsigned long /* valuemask */, - GC /* dest */ -); - -extern int XCopyPlane( - Display* /* display */, - Drawable /* src */, - Drawable /* dest */, - GC /* gc */, - int /* src_x */, - int /* src_y */, - unsigned int /* width */, - unsigned int /* height */, - int /* dest_x */, - int /* dest_y */, - unsigned long /* plane */ -); - -extern int XDefaultDepth( - Display* /* display */, - int /* screen_number */ -); - -extern int XDefaultDepthOfScreen( - Screen* /* screen */ -); - -extern int XDefaultScreen( - Display* /* display */ -); - -extern int XDefineCursor( - Display* /* display */, - Window /* w */, - Cursor /* cursor */ -); - -extern int XDeleteProperty( - Display* /* display */, - Window /* w */, - Atom /* property */ -); - -extern int XDestroyWindow( - Display* /* display */, - Window /* w */ -); - -extern int XDestroySubwindows( - Display* /* display */, - Window /* w */ -); - -extern int XDoesBackingStore( - Screen* /* screen */ -); - -extern Bool XDoesSaveUnders( - Screen* /* screen */ -); - -extern int XDisableAccessControl( - Display* /* display */ -); - - -extern int XDisplayCells( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayHeight( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayHeightMM( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayKeycodes( - Display* /* display */, - int* /* min_keycodes_return */, - int* /* max_keycodes_return */ -); - -extern int XDisplayPlanes( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayWidth( - Display* /* display */, - int /* screen_number */ -); - -extern int XDisplayWidthMM( - Display* /* display */, - int /* screen_number */ -); - -extern int XDrawArc( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - int /* angle1 */, - int /* angle2 */ -); - -extern int XDrawArcs( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XArc* /* arcs */, - int /* narcs */ -); - -extern int XDrawImageString( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* string */, - int /* length */ -); - -extern int XDrawImageString16( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst XChar2b* /* string */, - int /* length */ -); - -extern int XDrawLine( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x1 */, - int /* y1 */, - int /* x2 */, - int /* y2 */ -); - -extern int XDrawLines( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XPoint* /* points */, - int /* npoints */, - int /* mode */ -); - -extern int XDrawPoint( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */ -); - -extern int XDrawPoints( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XPoint* /* points */, - int /* npoints */, - int /* mode */ -); - -extern int XDrawRectangle( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XDrawRectangles( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XRectangle* /* rectangles */, - int /* nrectangles */ -); - -extern int XDrawSegments( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XSegment* /* segments */, - int /* nsegments */ -); - -extern int XDrawString( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* string */, - int /* length */ -); - -extern int XDrawString16( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst XChar2b* /* string */, - int /* length */ -); - -extern int XDrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XTextItem* /* items */, - int /* nitems */ -); - -extern int XDrawText16( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XTextItem16* /* items */, - int /* nitems */ -); - -extern int XEnableAccessControl( - Display* /* display */ -); - -extern int XEventsQueued( - Display* /* display */, - int /* mode */ -); - -extern Status XFetchName( - Display* /* display */, - Window /* w */, - char** /* window_name_return */ -); - -extern int XFillArc( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */, - int /* angle1 */, - int /* angle2 */ -); - -extern int XFillArcs( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XArc* /* arcs */, - int /* narcs */ -); - -extern int XFillPolygon( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XPoint* /* points */, - int /* npoints */, - int /* shape */, - int /* mode */ -); - -extern int XFillRectangle( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XFillRectangles( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XRectangle* /* rectangles */, - int /* nrectangles */ -); - -extern int XFlush( - Display* /* display */ -); - -extern int XForceScreenSaver( - Display* /* display */, - int /* mode */ -); - -extern int XFree( - void* /* data */ -); - -extern int XFreeColormap( - Display* /* display */, - Colormap /* colormap */ -); - -extern int XFreeColors( - Display* /* display */, - Colormap /* colormap */, - unsigned long* /* pixels */, - int /* npixels */, - unsigned long /* planes */ -); - -extern int XFreeCursor( - Display* /* display */, - Cursor /* cursor */ -); - -extern int XFreeExtensionList( - char** /* list */ -); - -extern int XFreeFont( - Display* /* display */, - XFontStruct* /* font_struct */ -); - -extern int XFreeFontInfo( - char** /* names */, - XFontStruct* /* free_info */, - int /* actual_count */ -); - -extern int XFreeFontNames( - char** /* list */ -); - -extern int XFreeFontPath( - char** /* list */ -); - -extern int XFreeGC( - Display* /* display */, - GC /* gc */ -); - -extern int XFreeModifiermap( - XModifierKeymap* /* modmap */ -); - -extern int XFreePixmap( - Display* /* display */, - Pixmap /* pixmap */ -); - -extern int XGeometry( - Display* /* display */, - int /* screen */, - _Xconst char* /* position */, - _Xconst char* /* default_position */, - unsigned int /* bwidth */, - unsigned int /* fwidth */, - unsigned int /* fheight */, - int /* xadder */, - int /* yadder */, - int* /* x_return */, - int* /* y_return */, - int* /* width_return */, - int* /* height_return */ -); - -extern int XGetErrorDatabaseText( - Display* /* display */, - _Xconst char* /* name */, - _Xconst char* /* message */, - _Xconst char* /* default_string */, - char* /* buffer_return */, - int /* length */ -); - -extern int XGetErrorText( - Display* /* display */, - int /* code */, - char* /* buffer_return */, - int /* length */ -); - -extern Bool XGetFontProperty( - XFontStruct* /* font_struct */, - Atom /* atom */, - unsigned long* /* value_return */ -); - -extern Status XGetGCValues( - Display* /* display */, - GC /* gc */, - unsigned long /* valuemask */, - XGCValues* /* values_return */ -); - -extern Status XGetGeometry( - Display* /* display */, - Drawable /* d */, - Window* /* root_return */, - int* /* x_return */, - int* /* y_return */, - unsigned int* /* width_return */, - unsigned int* /* height_return */, - unsigned int* /* border_width_return */, - unsigned int* /* depth_return */ -); - -extern Status XGetIconName( - Display* /* display */, - Window /* w */, - char** /* icon_name_return */ -); - -extern int XGetInputFocus( - Display* /* display */, - Window* /* focus_return */, - int* /* revert_to_return */ -); - -extern int XGetKeyboardControl( - Display* /* display */, - XKeyboardState* /* values_return */ -); - -extern int XGetPointerControl( - Display* /* display */, - int* /* accel_numerator_return */, - int* /* accel_denominator_return */, - int* /* threshold_return */ -); - -extern int XGetPointerMapping( - Display* /* display */, - unsigned char* /* map_return */, - int /* nmap */ -); - -extern int XGetScreenSaver( - Display* /* display */, - int* /* timeout_return */, - int* /* interval_return */, - int* /* prefer_blanking_return */, - int* /* allow_exposures_return */ -); - -extern Status XGetTransientForHint( - Display* /* display */, - Window /* w */, - Window* /* prop_window_return */ -); - -extern int XGetWindowProperty( - Display* /* display */, - Window /* w */, - Atom /* property */, - long /* long_offset */, - long /* long_length */, - Bool /* delete */, - Atom /* req_type */, - Atom* /* actual_type_return */, - int* /* actual_format_return */, - unsigned long* /* nitems_return */, - unsigned long* /* bytes_after_return */, - unsigned char** /* prop_return */ -); - -extern Status XGetWindowAttributes( - Display* /* display */, - Window /* w */, - XWindowAttributes* /* window_attributes_return */ -); - -extern int XGrabButton( - Display* /* display */, - unsigned int /* button */, - unsigned int /* modifiers */, - Window /* grab_window */, - Bool /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */ -); - -extern int XGrabKey( - Display* /* display */, - int /* keycode */, - unsigned int /* modifiers */, - Window /* grab_window */, - Bool /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */ -); - -extern int XGrabKeyboard( - Display* /* display */, - Window /* grab_window */, - Bool /* owner_events */, - int /* pointer_mode */, - int /* keyboard_mode */, - Time /* time */ -); - -extern int XGrabPointer( - Display* /* display */, - Window /* grab_window */, - Bool /* owner_events */, - unsigned int /* event_mask */, - int /* pointer_mode */, - int /* keyboard_mode */, - Window /* confine_to */, - Cursor /* cursor */, - Time /* time */ -); - -extern int XGrabServer( - Display* /* display */ -); - -extern int XHeightMMOfScreen( - Screen* /* screen */ -); - -extern int XHeightOfScreen( - Screen* /* screen */ -); - -extern int XIfEvent( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -extern int XImageByteOrder( - Display* /* display */ -); - -extern int XInstallColormap( - Display* /* display */, - Colormap /* colormap */ -); - -extern KeyCode XKeysymToKeycode( - Display* /* display */, - KeySym /* keysym */ -); - -extern int XKillClient( - Display* /* display */, - XID /* resource */ -); - -extern Status XLookupColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* color_name */, - XColor* /* exact_def_return */, - XColor* /* screen_def_return */ -); - -extern int XLowerWindow( - Display* /* display */, - Window /* w */ -); - -extern int XMapRaised( - Display* /* display */, - Window /* w */ -); - -extern int XMapSubwindows( - Display* /* display */, - Window /* w */ -); - -extern int XMapWindow( - Display* /* display */, - Window /* w */ -); - -extern int XMaskEvent( - Display* /* display */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern int XMaxCmapsOfScreen( - Screen* /* screen */ -); - -extern int XMinCmapsOfScreen( - Screen* /* screen */ -); - -extern int XMoveResizeWindow( - Display* /* display */, - Window /* w */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XMoveWindow( - Display* /* display */, - Window /* w */, - int /* x */, - int /* y */ -); - -extern int XNextEvent( - Display* /* display */, - XEvent* /* event_return */ -); - -extern int XNoOp( - Display* /* display */ -); - -extern Status XParseColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* spec */, - XColor* /* exact_def_return */ -); - -extern int XParseGeometry( - _Xconst char* /* parsestring */, - int* /* x_return */, - int* /* y_return */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern int XPeekEvent( - Display* /* display */, - XEvent* /* event_return */ -); - -extern int XPeekIfEvent( - Display* /* display */, - XEvent* /* event_return */, - Bool (*) ( - Display* /* display */, - XEvent* /* event */, - XPointer /* arg */ - ) /* predicate */, - XPointer /* arg */ -); - -extern int XPending( - Display* /* display */ -); - -extern int XPlanesOfScreen( - Screen* /* screen */ -); - -extern int XProtocolRevision( - Display* /* display */ -); - -extern int XProtocolVersion( - Display* /* display */ -); - - -extern int XPutBackEvent( - Display* /* display */, - XEvent* /* event */ -); - -extern int XPutImage( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - XImage* /* image */, - int /* src_x */, - int /* src_y */, - int /* dest_x */, - int /* dest_y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XQLength( - Display* /* display */ -); - -extern Status XQueryBestCursor( - Display* /* display */, - Drawable /* d */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern Status XQueryBestSize( - Display* /* display */, - int /* class */, - Drawable /* which_screen */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern Status XQueryBestStipple( - Display* /* display */, - Drawable /* which_screen */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern Status XQueryBestTile( - Display* /* display */, - Drawable /* which_screen */, - unsigned int /* width */, - unsigned int /* height */, - unsigned int* /* width_return */, - unsigned int* /* height_return */ -); - -extern int XQueryColor( - Display* /* display */, - Colormap /* colormap */, - XColor* /* def_in_out */ -); - -extern int XQueryColors( - Display* /* display */, - Colormap /* colormap */, - XColor* /* defs_in_out */, - int /* ncolors */ -); - -extern Bool XQueryExtension( - Display* /* display */, - _Xconst char* /* name */, - int* /* major_opcode_return */, - int* /* first_event_return */, - int* /* first_error_return */ -); - -extern int XQueryKeymap( - Display* /* display */, - char [32] /* keys_return */ -); - -extern Bool XQueryPointer( - Display* /* display */, - Window /* w */, - Window* /* root_return */, - Window* /* child_return */, - int* /* root_x_return */, - int* /* root_y_return */, - int* /* win_x_return */, - int* /* win_y_return */, - unsigned int* /* mask_return */ -); - -extern int XQueryTextExtents( - Display* /* display */, - XID /* font_ID */, - _Xconst char* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern int XQueryTextExtents16( - Display* /* display */, - XID /* font_ID */, - _Xconst XChar2b* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern Status XQueryTree( - Display* /* display */, - Window /* w */, - Window* /* root_return */, - Window* /* parent_return */, - Window** /* children_return */, - unsigned int* /* nchildren_return */ -); - -extern int XRaiseWindow( - Display* /* display */, - Window /* w */ -); - -extern int XReadBitmapFile( - Display* /* display */, - Drawable /* d */, - _Xconst char* /* filename */, - unsigned int* /* width_return */, - unsigned int* /* height_return */, - Pixmap* /* bitmap_return */, - int* /* x_hot_return */, - int* /* y_hot_return */ -); - -extern int XReadBitmapFileData( - _Xconst char* /* filename */, - unsigned int* /* width_return */, - unsigned int* /* height_return */, - unsigned char** /* data_return */, - int* /* x_hot_return */, - int* /* y_hot_return */ -); - -extern int XRebindKeysym( - Display* /* display */, - KeySym /* keysym */, - KeySym* /* list */, - int /* mod_count */, - _Xconst unsigned char* /* string */, - int /* bytes_string */ -); - -extern int XRecolorCursor( - Display* /* display */, - Cursor /* cursor */, - XColor* /* foreground_color */, - XColor* /* background_color */ -); - -extern int XRefreshKeyboardMapping( - XMappingEvent* /* event_map */ -); - -extern int XRemoveFromSaveSet( - Display* /* display */, - Window /* w */ -); - -extern int XRemoveHost( - Display* /* display */, - XHostAddress* /* host */ -); - -extern int XRemoveHosts( - Display* /* display */, - XHostAddress* /* hosts */, - int /* num_hosts */ -); - -extern int XReparentWindow( - Display* /* display */, - Window /* w */, - Window /* parent */, - int /* x */, - int /* y */ -); - -extern int XResetScreenSaver( - Display* /* display */ -); - -extern int XResizeWindow( - Display* /* display */, - Window /* w */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XRestackWindows( - Display* /* display */, - Window* /* windows */, - int /* nwindows */ -); - -extern int XRotateBuffers( - Display* /* display */, - int /* rotate */ -); - -extern int XRotateWindowProperties( - Display* /* display */, - Window /* w */, - Atom* /* properties */, - int /* num_prop */, - int /* npositions */ -); - -extern int XScreenCount( - Display* /* display */ -); - -extern int XSelectInput( - Display* /* display */, - Window /* w */, - long /* event_mask */ -); - -extern Status XSendEvent( - Display* /* display */, - Window /* w */, - Bool /* propagate */, - long /* event_mask */, - XEvent* /* event_send */ -); - -extern int XSetAccessControl( - Display* /* display */, - int /* mode */ -); - -extern int XSetArcMode( - Display* /* display */, - GC /* gc */, - int /* arc_mode */ -); - -extern int XSetBackground( - Display* /* display */, - GC /* gc */, - unsigned long /* background */ -); - -extern int XSetClipMask( - Display* /* display */, - GC /* gc */, - Pixmap /* pixmap */ -); - -extern int XSetClipOrigin( - Display* /* display */, - GC /* gc */, - int /* clip_x_origin */, - int /* clip_y_origin */ -); - -extern int XSetClipRectangles( - Display* /* display */, - GC /* gc */, - int /* clip_x_origin */, - int /* clip_y_origin */, - XRectangle* /* rectangles */, - int /* n */, - int /* ordering */ -); - -extern int XSetCloseDownMode( - Display* /* display */, - int /* close_mode */ -); - -extern int XSetCommand( - Display* /* display */, - Window /* w */, - char** /* argv */, - int /* argc */ -); - -extern int XSetDashes( - Display* /* display */, - GC /* gc */, - int /* dash_offset */, - _Xconst char* /* dash_list */, - int /* n */ -); - -extern int XSetFillRule( - Display* /* display */, - GC /* gc */, - int /* fill_rule */ -); - -extern int XSetFillStyle( - Display* /* display */, - GC /* gc */, - int /* fill_style */ -); - -extern int XSetFont( - Display* /* display */, - GC /* gc */, - Font /* font */ -); - -extern int XSetFontPath( - Display* /* display */, - char** /* directories */, - int /* ndirs */ -); - -extern int XSetForeground( - Display* /* display */, - GC /* gc */, - unsigned long /* foreground */ -); - -extern int XSetFunction( - Display* /* display */, - GC /* gc */, - int /* function */ -); - -extern int XSetGraphicsExposures( - Display* /* display */, - GC /* gc */, - Bool /* graphics_exposures */ -); - -extern int XSetIconName( - Display* /* display */, - Window /* w */, - _Xconst char* /* icon_name */ -); - -extern int XSetInputFocus( - Display* /* display */, - Window /* focus */, - int /* revert_to */, - Time /* time */ -); - -extern int XSetLineAttributes( - Display* /* display */, - GC /* gc */, - unsigned int /* line_width */, - int /* line_style */, - int /* cap_style */, - int /* join_style */ -); - -extern int XSetModifierMapping( - Display* /* display */, - XModifierKeymap* /* modmap */ -); - -extern int XSetPlaneMask( - Display* /* display */, - GC /* gc */, - unsigned long /* plane_mask */ -); - -extern int XSetPointerMapping( - Display* /* display */, - _Xconst unsigned char* /* map */, - int /* nmap */ -); - -extern int XSetScreenSaver( - Display* /* display */, - int /* timeout */, - int /* interval */, - int /* prefer_blanking */, - int /* allow_exposures */ -); - -extern int XSetSelectionOwner( - Display* /* display */, - Atom /* selection */, - Window /* owner */, - Time /* time */ -); - -extern int XSetState( - Display* /* display */, - GC /* gc */, - unsigned long /* foreground */, - unsigned long /* background */, - int /* function */, - unsigned long /* plane_mask */ -); - -extern int XSetStipple( - Display* /* display */, - GC /* gc */, - Pixmap /* stipple */ -); - -extern int XSetSubwindowMode( - Display* /* display */, - GC /* gc */, - int /* subwindow_mode */ -); - -extern int XSetTSOrigin( - Display* /* display */, - GC /* gc */, - int /* ts_x_origin */, - int /* ts_y_origin */ -); - -extern int XSetTile( - Display* /* display */, - GC /* gc */, - Pixmap /* tile */ -); - -extern int XSetWindowBackground( - Display* /* display */, - Window /* w */, - unsigned long /* background_pixel */ -); - -extern int XSetWindowBackgroundPixmap( - Display* /* display */, - Window /* w */, - Pixmap /* background_pixmap */ -); - -extern int XSetWindowBorder( - Display* /* display */, - Window /* w */, - unsigned long /* border_pixel */ -); - -extern int XSetWindowBorderPixmap( - Display* /* display */, - Window /* w */, - Pixmap /* border_pixmap */ -); - -extern int XSetWindowBorderWidth( - Display* /* display */, - Window /* w */, - unsigned int /* width */ -); - -extern int XSetWindowColormap( - Display* /* display */, - Window /* w */, - Colormap /* colormap */ -); - -extern int XStoreBuffer( - Display* /* display */, - _Xconst char* /* bytes */, - int /* nbytes */, - int /* buffer */ -); - -extern int XStoreBytes( - Display* /* display */, - _Xconst char* /* bytes */, - int /* nbytes */ -); - -extern int XStoreColor( - Display* /* display */, - Colormap /* colormap */, - XColor* /* color */ -); - -extern int XStoreColors( - Display* /* display */, - Colormap /* colormap */, - XColor* /* color */, - int /* ncolors */ -); - -extern int XStoreName( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */ -); - -extern int XStoreNamedColor( - Display* /* display */, - Colormap /* colormap */, - _Xconst char* /* color */, - unsigned long /* pixel */, - int /* flags */ -); - -extern int XSync( - Display* /* display */, - Bool /* discard */ -); - -extern int XTextExtents( - XFontStruct* /* font_struct */, - _Xconst char* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern int XTextExtents16( - XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, - int /* nchars */, - int* /* direction_return */, - int* /* font_ascent_return */, - int* /* font_descent_return */, - XCharStruct* /* overall_return */ -); - -extern int XTextWidth( - XFontStruct* /* font_struct */, - _Xconst char* /* string */, - int /* count */ -); - -extern int XTextWidth16( - XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, - int /* count */ -); - -extern Bool XTranslateCoordinates( - Display* /* display */, - Window /* src_w */, - Window /* dest_w */, - int /* src_x */, - int /* src_y */, - int* /* dest_x_return */, - int* /* dest_y_return */, - Window* /* child_return */ -); - -extern int XUndefineCursor( - Display* /* display */, - Window /* w */ -); - -extern int XUngrabButton( - Display* /* display */, - unsigned int /* button */, - unsigned int /* modifiers */, - Window /* grab_window */ -); - -extern int XUngrabKey( - Display* /* display */, - int /* keycode */, - unsigned int /* modifiers */, - Window /* grab_window */ -); - -extern int XUngrabKeyboard( - Display* /* display */, - Time /* time */ -); - -extern int XUngrabPointer( - Display* /* display */, - Time /* time */ -); - -extern int XUngrabServer( - Display* /* display */ -); - -extern int XUninstallColormap( - Display* /* display */, - Colormap /* colormap */ -); - -extern int XUnloadFont( - Display* /* display */, - Font /* font */ -); - -extern int XUnmapSubwindows( - Display* /* display */, - Window /* w */ -); - -extern int XUnmapWindow( - Display* /* display */, - Window /* w */ -); - -extern int XVendorRelease( - Display* /* display */ -); - -extern int XWarpPointer( - Display* /* display */, - Window /* src_w */, - Window /* dest_w */, - int /* src_x */, - int /* src_y */, - unsigned int /* src_width */, - unsigned int /* src_height */, - int /* dest_x */, - int /* dest_y */ -); - -extern int XWidthMMOfScreen( - Screen* /* screen */ -); - -extern int XWidthOfScreen( - Screen* /* screen */ -); - -extern int XWindowEvent( - Display* /* display */, - Window /* w */, - long /* event_mask */, - XEvent* /* event_return */ -); - -extern int XWriteBitmapFile( - Display* /* display */, - _Xconst char* /* filename */, - Pixmap /* bitmap */, - unsigned int /* width */, - unsigned int /* height */, - int /* x_hot */, - int /* y_hot */ -); - -extern Bool XSupportsLocale (void); - -extern char *XSetLocaleModifiers( - const char* /* modifier_list */ -); - -extern XOM XOpenOM( - Display* /* display */, - struct _XrmHashBucketRec* /* rdb */, - _Xconst char* /* res_name */, - _Xconst char* /* res_class */ -); - -extern Status XCloseOM( - XOM /* om */ -); - -extern char *XSetOMValues( - XOM /* om */, - ... -) _X_SENTINEL(0); - -extern char *XGetOMValues( - XOM /* om */, - ... -) _X_SENTINEL(0); - -extern Display *XDisplayOfOM( - XOM /* om */ -); - -extern char *XLocaleOfOM( - XOM /* om */ -); - -extern XOC XCreateOC( - XOM /* om */, - ... -) _X_SENTINEL(0); - -extern void XDestroyOC( - XOC /* oc */ -); - -extern XOM XOMOfOC( - XOC /* oc */ -); - -extern char *XSetOCValues( - XOC /* oc */, - ... -) _X_SENTINEL(0); - -extern char *XGetOCValues( - XOC /* oc */, - ... -) _X_SENTINEL(0); - -extern XFontSet XCreateFontSet( - Display* /* display */, - _Xconst char* /* base_font_name_list */, - char*** /* missing_charset_list */, - int* /* missing_charset_count */, - char** /* def_string */ -); - -extern void XFreeFontSet( - Display* /* display */, - XFontSet /* font_set */ -); - -extern int XFontsOfFontSet( - XFontSet /* font_set */, - XFontStruct*** /* font_struct_list */, - char*** /* font_name_list */ -); - -extern char *XBaseFontNameListOfFontSet( - XFontSet /* font_set */ -); - -extern char *XLocaleOfFontSet( - XFontSet /* font_set */ -); - -extern Bool XContextDependentDrawing( - XFontSet /* font_set */ -); - -extern Bool XDirectionalDependentDrawing( - XFontSet /* font_set */ -); - -extern Bool XContextualDrawing( - XFontSet /* font_set */ -); - -extern XFontSetExtents *XExtentsOfFontSet( - XFontSet /* font_set */ -); - -extern int XmbTextEscapement( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern int XwcTextEscapement( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* num_wchars */ -); - -extern int Xutf8TextEscapement( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern int XmbTextExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern int XwcTextExtents( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* num_wchars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern int Xutf8TextExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern Status XmbTextPerCharExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern Status XwcTextPerCharExtents( - XFontSet /* font_set */, - _Xconst wchar_t* /* text */, - int /* num_wchars */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern Status Xutf8TextPerCharExtents( - XFontSet /* font_set */, - _Xconst char* /* text */, - int /* bytes_text */, - XRectangle* /* ink_extents_buffer */, - XRectangle* /* logical_extents_buffer */, - int /* buffer_size */, - int* /* num_chars */, - XRectangle* /* overall_ink_return */, - XRectangle* /* overall_logical_return */ -); - -extern void XmbDrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XmbTextItem* /* text_items */, - int /* nitems */ -); - -extern void XwcDrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XwcTextItem* /* text_items */, - int /* nitems */ -); - -extern void Xutf8DrawText( - Display* /* display */, - Drawable /* d */, - GC /* gc */, - int /* x */, - int /* y */, - XmbTextItem* /* text_items */, - int /* nitems */ -); - -extern void XmbDrawString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern void XwcDrawString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst wchar_t* /* text */, - int /* num_wchars */ -); - -extern void Xutf8DrawString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern void XmbDrawImageString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern void XwcDrawImageString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst wchar_t* /* text */, - int /* num_wchars */ -); - -extern void Xutf8DrawImageString( - Display* /* display */, - Drawable /* d */, - XFontSet /* font_set */, - GC /* gc */, - int /* x */, - int /* y */, - _Xconst char* /* text */, - int /* bytes_text */ -); - -extern XIM XOpenIM( - Display* /* dpy */, - struct _XrmHashBucketRec* /* rdb */, - char* /* res_name */, - char* /* res_class */ -); - -extern Status XCloseIM( - XIM /* im */ -); - -extern char *XGetIMValues( - XIM /* im */, ... -) _X_SENTINEL(0); - -extern char *XSetIMValues( - XIM /* im */, ... -) _X_SENTINEL(0); - -extern Display *XDisplayOfIM( - XIM /* im */ -); - -extern char *XLocaleOfIM( - XIM /* im*/ -); - -extern XIC XCreateIC( - XIM /* im */, ... -) _X_SENTINEL(0); - -extern void XDestroyIC( - XIC /* ic */ -); - -extern void XSetICFocus( - XIC /* ic */ -); - -extern void XUnsetICFocus( - XIC /* ic */ -); - -extern wchar_t *XwcResetIC( - XIC /* ic */ -); - -extern char *XmbResetIC( - XIC /* ic */ -); - -extern char *Xutf8ResetIC( - XIC /* ic */ -); - -extern char *XSetICValues( - XIC /* ic */, ... -) _X_SENTINEL(0); - -extern char *XGetICValues( - XIC /* ic */, ... -) _X_SENTINEL(0); - -extern XIM XIMOfIC( - XIC /* ic */ -); - -extern Bool XFilterEvent( - XEvent* /* event */, - Window /* window */ -); - -extern int XmbLookupString( - XIC /* ic */, - XKeyPressedEvent* /* event */, - char* /* buffer_return */, - int /* bytes_buffer */, - KeySym* /* keysym_return */, - Status* /* status_return */ -); - -extern int XwcLookupString( - XIC /* ic */, - XKeyPressedEvent* /* event */, - wchar_t* /* buffer_return */, - int /* wchars_buffer */, - KeySym* /* keysym_return */, - Status* /* status_return */ -); - -extern int Xutf8LookupString( - XIC /* ic */, - XKeyPressedEvent* /* event */, - char* /* buffer_return */, - int /* bytes_buffer */, - KeySym* /* keysym_return */, - Status* /* status_return */ -); - -extern XVaNestedList XVaCreateNestedList( - int /*unused*/, ... -) _X_SENTINEL(0); - -/* internal connections for IMs */ - -extern Bool XRegisterIMInstantiateCallback( - Display* /* dpy */, - struct _XrmHashBucketRec* /* rdb */, - char* /* res_name */, - char* /* res_class */, - XIDProc /* callback */, - XPointer /* client_data */ -); - -extern Bool XUnregisterIMInstantiateCallback( - Display* /* dpy */, - struct _XrmHashBucketRec* /* rdb */, - char* /* res_name */, - char* /* res_class */, - XIDProc /* callback */, - XPointer /* client_data */ -); - -typedef void (*XConnectionWatchProc)( - Display* /* dpy */, - XPointer /* client_data */, - int /* fd */, - Bool /* opening */, /* open or close flag */ - XPointer* /* watch_data */ /* open sets, close uses */ -); - - -extern Status XInternalConnectionNumbers( - Display* /* dpy */, - int** /* fd_return */, - int* /* count_return */ -); - -extern void XProcessInternalConnection( - Display* /* dpy */, - int /* fd */ -); - -extern Status XAddConnectionWatch( - Display* /* dpy */, - XConnectionWatchProc /* callback */, - XPointer /* client_data */ -); - -extern void XRemoveConnectionWatch( - Display* /* dpy */, - XConnectionWatchProc /* callback */, - XPointer /* client_data */ -); - -extern void XSetAuthorization( - char * /* name */, - int /* namelen */, - char * /* data */, - int /* datalen */ -); - -extern int _Xmbtowc( - wchar_t * /* wstr */, - char * /* str */, - int /* len */ -); - -extern int _Xwctomb( - char * /* str */, - wchar_t /* wc */ -); - -extern Bool XGetEventData( - Display* /* dpy */, - XGenericEventCookie* /* cookie*/ -); - -extern void XFreeEventData( - Display* /* dpy */, - XGenericEventCookie* /* cookie*/ -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* #if !defined(_X11_XLIB_H_) && !defined(_XLIB_H_) */ diff --git a/nx-X11/lib/X11/XlibAsync.c b/nx-X11/lib/X11/XlibAsync.c deleted file mode 100644 index 2e528d8b1..000000000 --- a/nx-X11/lib/X11/XlibAsync.c +++ /dev/null @@ -1,182 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - -Copyright 1992, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include - -/*ARGSUSED*/ -Bool -_XAsyncErrorHandler( - register Display *dpy, - register xReply *rep, - char *buf, - int len, - XPointer data) -{ - register _XAsyncErrorState *state; - - state = (_XAsyncErrorState *)data; - if (rep->generic.type == X_Error && - (!state->error_code || - rep->error.errorCode == state->error_code) && - (!state->major_opcode || - rep->error.majorCode == state->major_opcode) && - (!state->minor_opcode || - rep->error.minorCode == state->minor_opcode) && - (!state->min_sequence_number || - (state->min_sequence_number <= dpy->last_request_read)) && - (!state->max_sequence_number || - (state->max_sequence_number >= dpy->last_request_read))) { - state->last_error_received = rep->error.errorCode; - state->error_count++; - return True; - } - return False; -} - -void _XDeqAsyncHandler( - Display *dpy, - register _XAsyncHandler *handler) -{ - register _XAsyncHandler **prev; - register _XAsyncHandler *async; - - for (prev = &dpy->async_handlers; - (async = *prev) && (async != handler); - prev = &async->next) - ; - if (async) - *prev = async->next; -} - -char * -_XGetAsyncReply( - register Display *dpy, - register char *replbuf, /* data is read into this buffer */ - register xReply *rep, /* value passed to calling handler */ - char *buf, /* value passed to calling handler */ - int len, /* value passed to calling handler */ - int extra, /* extra words to read, ala _XReply */ - Bool discard) /* discard after extra?, ala _XReply */ -{ - if (extra == 0) { - if (discard && (rep->generic.length << 2) > len) - _XEatData (dpy, (rep->generic.length << 2) - len); - return (char *)rep; - } - - if (extra <= rep->generic.length) { - int size = SIZEOF(xReply) + (extra << 2); - if (size > len) { - memcpy(replbuf, buf, len); - _XRead(dpy, replbuf + len, size - len); - buf = replbuf; - len = size; - } - - if (discard && rep->generic.length > extra && - (rep->generic.length << 2) > len) - _XEatData (dpy, (rep->generic.length << 2) - len); - - return buf; - } - /* - *if we get here, then extra > rep->generic.length--meaning we - * read a reply that's shorter than we expected. This is an - * error, but we still need to figure out how to handle it... - */ - if ((rep->generic.length << 2) > len) - _XEatData (dpy, (rep->generic.length << 2) - len); -#ifdef NX_TRANS_SOCKET - - /* - * The original code has provision - * for returning already. - */ - -#endif - _XIOError (dpy); - return (char *)rep; -} - -void -_XGetAsyncData( - Display *dpy, - char *data, /* data is read into this buffer */ - char *buf, /* value passed to calling handler */ - int len, /* value passed to calling handler */ - int skip, /* number of bytes already read in previous - _XGetAsyncReply or _XGetAsyncData calls */ - int datalen, /* size of data buffer in bytes */ - int discardtotal) /* min. bytes to consume (after skip) */ -{ - buf += skip; - len -= skip; - if (!data) { - if (datalen > len) - _XEatData(dpy, datalen - len); - } else if (datalen <= len) { - memcpy(data, buf, datalen); - } else { - memcpy(data, buf, len); - _XRead(dpy, data + len, datalen - len); - } - if (discardtotal > len) { - if (datalen > len) - len = datalen; - _XEatData(dpy, discardtotal - len); - } -} diff --git a/nx-X11/lib/X11/XlibConf.h b/nx-X11/lib/X11/XlibConf.h deleted file mode 100644 index 32fc91b2e..000000000 --- a/nx-X11/lib/X11/XlibConf.h +++ /dev/null @@ -1,7 +0,0 @@ -/* Defines needed to use Xlib from non-imake projects */ -#ifndef XTHREADS -#define XTHREADS -#endif -#ifndef XUSE_MTSAFE_API -#define XUSE_MTSAFE_API -#endif diff --git a/nx-X11/lib/X11/XlibInt.c b/nx-X11/lib/X11/XlibInt.c deleted file mode 100644 index 5afc65149..000000000 --- a/nx-X11/lib/X11/XlibInt.c +++ /dev/null @@ -1,4199 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - -Copyright 1985, 1986, 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * XlibInt.c - Internal support routines for the C subroutine - * interface library (Xlib) to the X Window System Protocol V11.0. - */ - -#ifdef WIN32 -#define _XLIBINT_ -#endif -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xprivate.h" -#include -#if !USE_XCB -#include -#include -#endif /* !USE_XCB */ -#include -#include -#ifdef WIN32 -#include -#endif - -#ifdef XTHREADS -#include "locking.h" - -/* these pointers get initialized by XInitThreads */ -LockInfoPtr _Xglobal_lock = NULL; -void (*_XCreateMutex_fn)(LockInfoPtr) = NULL; -/* struct _XCVList *(*_XCreateCVL_fn)() = NULL; */ -void (*_XFreeMutex_fn)(LockInfoPtr) = NULL; -void (*_XLockMutex_fn)( - LockInfoPtr /* lock */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif - ) = NULL; -void (*_XUnlockMutex_fn)( - LockInfoPtr /* lock */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif - ) = NULL; -xthread_t (*_Xthread_self_fn)(void) = NULL; - -#define XThread_Self() ((*_Xthread_self_fn)()) - -#if !USE_XCB -#define UnlockNextReplyReader(d) if ((d)->lock) \ - (*(d)->lock->pop_reader)((d),&(d)->lock->reply_awaiters,&(d)->lock->reply_awaiters_tail) - -#define QueueReplyReaderLock(d) ((d)->lock ? \ - (*(d)->lock->push_reader)(d,&(d)->lock->reply_awaiters_tail) : NULL) -#define QueueEventReaderLock(d) ((d)->lock ? \ - (*(d)->lock->push_reader)(d,&(d)->lock->event_awaiters_tail) : NULL) -#endif /* !USE_XCB */ - -#else /* XTHREADS else */ - -#if !USE_XCB -#define UnlockNextReplyReader(d) -#define UnlockNextEventReader(d) -#endif /* !USE_XCB */ - -#endif /* XTHREADS else */ - -#ifdef NX_TRANS_SOCKET - -#include -#include - -static struct timeval retry; - -/* - * From Xtranssock.c. Presently the congestion state - * is reported by the proxy to the application, by - * invoking the callback directly. The function will - * be possibly used in the future, to be able to track - * the bandwidth usage even when the NX transport is - * not running. Note that in this sample implementation - * the congestion state is checked very often and can - * be surely optimized. - */ - -#ifdef NX_TRANS_CHANGE -extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); -#endif - -#endif /* #ifdef NX_TRANS_SOCKET */ - -/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX - * systems are broken and return EWOULDBLOCK when they should return EAGAIN - */ -#ifdef WIN32 -#define ETEST() (WSAGetLastError() == WSAEWOULDBLOCK) -#else -#ifdef __CYGWIN__ /* Cygwin uses ENOBUFS to signal socket is full */ -#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) -#else -#if defined(EAGAIN) && defined(EWOULDBLOCK) -#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK) -#else -#ifdef EAGAIN -#define ETEST() (errno == EAGAIN) -#else -#define ETEST() (errno == EWOULDBLOCK) -#endif /* EAGAIN */ -#endif /* EAGAIN && EWOULDBLOCK */ -#endif /* __CYGWIN__ */ -#endif /* WIN32 */ - -#ifdef WIN32 -#define ECHECK(err) (WSAGetLastError() == err) -#define ESET(val) WSASetLastError(val) -#else -#define ECHECK(err) (errno == err) -#define ESET(val) errno = val -#endif - -#if defined(LOCALCONN) || defined(LACHMAN) -#ifdef EMSGSIZE -#define ESZTEST() (ECHECK(EMSGSIZE) || ECHECK(ERANGE)) -#else -#define ESZTEST() ECHECK(ERANGE) -#endif -#else -#ifdef EMSGSIZE -#define ESZTEST() ECHECK(EMSGSIZE) -#endif -#endif - -#if !USE_XCB - -#define STARTITERATE(tpvar,type,start,endcond) \ - for (tpvar = (type *) (start); endcond; ) -#define ITERPTR(tpvar) (char *)tpvar -#define RESETITERPTR(tpvar,type,start) tpvar = (type *) (start) -#define INCITERPTR(tpvar,type) tpvar++ -#define ENDITERATE - - -typedef union { - xReply rep; - char buf[BUFSIZE]; -} _XAlignedBuffer; - -static char *_XAsyncReply( - Display *dpy, - register xReply *rep, - char *buf, - register int *lenp, - Bool discard); -#endif /* !USE_XCB */ - -/* - * The following routines are internal routines used by Xlib for protocol - * packet transmission and reception. - * - * _XIOError(Display *) will be called if any sort of system call error occurs. - * This is assumed to be a fatal condition, i.e., XIOError should not return. - * - * _XError(Display *, xError *) will be called whenever an X_Error event is - * received. This is not assumed to be a fatal condition, i.e., it is - * acceptable for this procedure to return. However, XError should NOT - * perform any operations (directly or indirectly) on the DISPLAY. - * - * Routines declared with a return type of 'Status' return 0 on failure, - * and non 0 on success. Routines with no declared return type don't - * return anything. Whenever possible routines that create objects return - * the object they have created. - */ - -#if !USE_XCB -static xReq _dummy_request = { - 0, 0, 0 -}; - -#ifdef NX_TRANS_SOCKET - -/* - * Replace the standard Select with a version giving NX a - * chance to check its own descriptors. This doesn't cover - * the cases where the system is using poll or when system- - * specific defines override the Select definition (OS/2). - */ - -int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout) -{ -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XSelect: Called with [%d][%p][%p][%p][%p].\n", - maxfds, (void *) readfds, (void *) writefds, (void *) exceptfds, - (void *) timeout); -#endif - - if (NXTransRunning(NX_FD_ANY)) - { - fd_set t_readfds, t_writefds; - struct timeval t_timeout; - - int n, r, e; - -#ifdef NX_TRANS_TEST - - if (exceptfds != NULL) - { - fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n"); - } - -#endif - - if (readfds == NULL) - { - FD_ZERO(&t_readfds); - - readfds = &t_readfds; - } - - if (writefds == NULL) - { - FD_ZERO(&t_writefds); - - writefds = &t_writefds; - } - - if (timeout == NULL) - { - t_timeout.tv_sec = 10; - t_timeout.tv_usec = 0; - - timeout = &t_timeout; - } - - n = maxfds; - - /* - * If the transport is gone avoid - * sleeping until the timeout. - */ - - if (NXTransPrepare(&n, readfds, writefds, timeout) != 0) - { - NXTransSelect(&r, &e, &n, readfds, writefds, timeout); - - NXTransExecute(&r, &e, &n, readfds, writefds, timeout); - - errno = e; - - return r; - } - else - { - return 0; - } - } - else - { - return select(maxfds, readfds, writefds, exceptfds, timeout); - } -} - -#else /* #ifdef NX_TRANS_SOCKET */ - -int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, - fd_set *exceptfds, struct timeval *timeout) -{ - return select(maxfds, readfds, writefds, exceptfds, timeout); -} - -#endif /* #ifdef NX_TRANS_SOCKET */ - -/* - * This is an OS dependent routine which: - * 1) returns as soon as the connection can be written on.... - * 2) if the connection can be read, must enqueue events and handle errors, - * until the connection is writable. - */ -static void -_XWaitForWritable( - Display *dpy -#ifdef XTHREADS - , - xcondition_t cv /* our reading condition variable */ -#endif - ) -{ -#ifdef USE_POLL - struct pollfd filedes; -#else - fd_set r_mask; - fd_set w_mask; -#endif - int nfound; - -#ifdef NX_TRANS_SOCKET -#if defined(NX_TRANS_CHANGE) - int congestion; -#endif - if (_XGetIOError(dpy)) { - return; - } -#endif - -#ifdef USE_POLL - filedes.fd = dpy->fd; - filedes.events = 0; -#else - FD_ZERO(&r_mask); - FD_ZERO(&w_mask); -#endif - - for (;;) { -#ifdef XTHREADS - /* We allow only one thread at a time to read, to minimize - passing of read data between threads. - Now, who is it? If there is a non-NULL reply_awaiters and - we (i.e., our cv) are not at the head of it, then whoever - is at the head is the reader, and we don't read. - Otherwise there is no reply_awaiters or we are at the - head, having just appended ourselves. - In this case, if there is a event_awaiters, then whoever - is at the head of it got there before we did, and they are the - reader. - - Last cases: no event_awaiters and we are at the head of - reply_awaiters or reply_awaiters is NULL: we are the reader, - since there is obviously no one else involved. - - XXX - what if cv is NULL and someone else comes along after - us while we are waiting? - */ - - if (!dpy->lock || - (!dpy->lock->event_awaiters && - (!dpy->lock->reply_awaiters || - dpy->lock->reply_awaiters->cv == cv))) -#endif - -#ifndef NX_TRANS_SOCKET -#ifdef USE_POLL - filedes.events = POLLIN; - filedes.events |= POLLOUT; -#else - FD_SET(dpy->fd, &r_mask); - FD_SET(dpy->fd, &w_mask); -#endif -#endif /* #ifndef NX_TRANS_SOCKET */ - - do { -#ifdef NX_TRANS_SOCKET - /* - * Give a chance to the registered client to perform - * any needed operation before entering the select. - */ - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XWaitForWritable: WAIT! Waiting for the display to become writable.\n"); -#endif - NXTransFlush(dpy->fd); - - if (_NXDisplayBlockFunction != NULL) { - (*_NXDisplayBlockFunction)(dpy, NXBlockWrite); - } - - /* - * Need to set again the descriptors as we could have - * run multiple selects before having the possibility - * to read or write to the X connection. - */ - -#ifdef USE_POLL - filedes.events = POLLIN; - filedes.events |= POLLOUT; -#else - FD_SET(dpy->fd, &r_mask); - FD_SET(dpy->fd, &w_mask); -#endif -#endif /* #ifdef NX_TRANS_SOCKET */ - UnlockDisplay(dpy); -#ifdef USE_POLL -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XWaitForWritable: Calling poll().\n"); -#endif - nfound = poll (&filedes, 1, -1); -#else /* USE_POLL */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n", - NXTransTime()); -#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ -#ifdef NX_TRANS_SOCKET - /* - * Give a chance to the callback to detect - * the failure of the display even if we - * miss the interrupt inside the select. - */ - - if (_NXDisplayErrorFunction != NULL) { - retry.tv_sec = 5; - retry.tv_usec = 0; - nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, &retry); - } else { - nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); - } -#else /* NX_TRANS_SOCKET */ - nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); -#endif /* NX_TRANS_SOCKET */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n", - nfound, NXTransTime()); - - if (FD_ISSET(dpy->fd, &r_mask)) - { - BytesReadable_t pend; - - _X11TransBytesReadable(dpy->trans_conn, &pend); - - fprintf(stderr, "_XWaitForWritable: Descriptor [%d] is ready with [%ld] bytes to read.\n", - dpy->fd, pend); - } - - if (FD_ISSET(dpy->fd, &w_mask)) - { - fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n", - dpy->fd); - } -#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ -#endif /* USE_POLL */ - InternalLockDisplay(dpy, cv != NULL); -#ifdef NX_TRANS_SOCKET -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } -#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) */ - if (nfound <= 0) { - if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return; - } - } -#else /* NX_TRANS_SOCKET */ - if (nfound < 0 && !(ECHECK(EINTR) || ETEST())) - _XIOError(dpy); -#endif /* NX_TRANS_SOCKET */ - } while (nfound <= 0); - - if ( -#ifdef USE_POLL - filedes.revents & POLLIN -#else /* USE_POLL */ - FD_ISSET(dpy->fd, &r_mask) -#endif /* USE_POLL */ - ) - { - _XAlignedBuffer buf; - BytesReadable_t pend; - register int len; - register xReply *rep; - - /* find out how much data can be read */ - if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) -#ifdef NX_TRANS_SOCKET - { - _XIOError(dpy); - - return; - } -#else /* NX_TRANS_SOCKET */ - _XIOError(dpy); -#endif /* NX_TRANS_SOCKET */ - len = pend; - - /* must read at least one xEvent; if none is pending, then - we'll just block waiting for it */ - if (len < SIZEOF(xReply) -#ifdef XTHREADS - || dpy->async_handlers -#endif - ) - len = SIZEOF(xReply); - - /* but we won't read more than the max buffer size */ - if (len > BUFSIZE) len = BUFSIZE; - - /* round down to an integral number of XReps */ - len = (len / SIZEOF(xReply)) * SIZEOF(xReply); - - (void) _XRead (dpy, buf.buf, (long) len); - - STARTITERATE(rep,xReply,buf.buf,len > 0) { - if (rep->generic.type == X_Reply) { - int tmp = len; - RESETITERPTR(rep,xReply, - _XAsyncReply (dpy, rep, - ITERPTR(rep), &tmp, True)); - len = tmp; - pend = len; - } else { - if (rep->generic.type == X_Error) - _XError (dpy, (xError *)rep); - else /* must be an event packet */ - _XEnq (dpy, (xEvent *)rep); - INCITERPTR(rep,xReply); - len -= SIZEOF(xReply); - } - } ENDITERATE -#ifdef XTHREADS - if (dpy->lock && dpy->lock->event_awaiters) - ConditionSignal(dpy, dpy->lock->event_awaiters->cv); -#endif - } -#ifdef USE_POLL - if (filedes.revents & (POLLOUT|POLLHUP|POLLERR)) -#else - if (FD_ISSET(dpy->fd, &w_mask)) -#endif - { -#ifdef XTHREADS - if (dpy->lock) { - ConditionBroadcast(dpy, dpy->lock->writers); - } -#endif - return; - } - } -} -#endif /* !USE_XCB */ - - -#define POLLFD_CACHE_SIZE 5 - -/* initialize the struct array passed to poll() below */ -Bool _XPollfdCacheInit( - Display *dpy) -{ -#ifdef USE_POLL - struct pollfd *pfp; - - pfp = Xmalloc(POLLFD_CACHE_SIZE * sizeof(struct pollfd)); - if (!pfp) - return False; - pfp[0].fd = dpy->fd; - pfp[0].events = POLLIN; - - dpy->filedes = (XPointer)pfp; -#endif - return True; -} - -void _XPollfdCacheAdd( - Display *dpy, - int fd) -{ -#ifdef USE_POLL - struct pollfd *pfp = (struct pollfd *)dpy->filedes; - - if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) { - pfp[dpy->im_fd_length].fd = fd; - pfp[dpy->im_fd_length].events = POLLIN; - } -#endif -} - -/* ARGSUSED */ -void _XPollfdCacheDel( - Display *dpy, - int fd) /* not used */ -{ -#ifdef USE_POLL - struct pollfd *pfp = (struct pollfd *)dpy->filedes; - struct _XConnectionInfo *conni; - - /* just recalculate whole list */ - if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) { - int loc = 1; - for (conni = dpy->im_fd_info; conni; conni=conni->next) { - pfp[loc].fd = conni->fd; - pfp[loc].events = POLLIN; - loc++; - } - } -#endif -} - -#if !USE_XCB -/* returns True iff there is an event in the queue newer than serial_num */ - -static Bool -_XNewerQueuedEvent( - Display *dpy, - int serial_num) -{ - _XQEvent *qev; - - if (dpy->next_event_serial_num == serial_num) - return False; - - qev = dpy->head; - while (qev) { - if (qev->qserial_num >= serial_num) { - return True; - } - qev = qev->next; - } - return False; -} - -static int -_XWaitForReadable( - Display *dpy) -{ - int result; - int fd = dpy->fd; - struct _XConnectionInfo *ilist; - register int saved_event_serial = 0; - int in_read_events = 0; - register Bool did_proc_conni = False; -#ifdef USE_POLL - struct pollfd *filedes; -#else - fd_set r_mask; - int highest_fd = fd; -#endif - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - int congestion; -#endif -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - return -1; - } -#endif - -#ifdef USE_POLL - if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE - && !(dpy->flags & XlibDisplayProcConni)) { - /* XXX - this fallback is gross */ - int i; - - filedes = (struct pollfd *)Xmalloc(dpy->im_fd_length * sizeof(struct pollfd)); - filedes[0].fd = fd; - filedes[0].events = POLLIN; - for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) { - filedes[i].fd = ilist->fd; - filedes[i].events = POLLIN; - } - } else { - filedes = (struct pollfd *)dpy->filedes; - } -#else /* USE_POLL */ - FD_ZERO(&r_mask); -#endif /* USE_POLL */ - for (;;) { -#ifndef USE_POLL - FD_SET(fd, &r_mask); - if (!(dpy->flags & XlibDisplayProcConni)) - for (ilist=dpy->im_fd_info; ilist; ilist=ilist->next) { - FD_SET(ilist->fd, &r_mask); - if (ilist->fd > highest_fd) - highest_fd = ilist->fd; - } -#endif /* USE_POLL */ - UnlockDisplay(dpy); -#ifdef USE_POLL -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XWaitForReadable: Calling poll().\n"); -#endif - result = poll(filedes, - (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, - -1); -#else /* USE_POLL */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XWaitForReadable: Calling select().\n"); -#endif -#ifdef NX_TRANS_SOCKET - /* - * Give a chance to the registered application - * to perform any needed operation. - */ - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XWaitForReadable: WAIT! Waiting for the display to become readable.\n"); -#endif - NXTransFlush(dpy->fd); - - if (_NXDisplayBlockFunction != NULL) { - (*_NXDisplayBlockFunction)(dpy, NXBlockRead); - } - - if (_NXDisplayErrorFunction != NULL) { - retry.tv_sec = 5; - retry.tv_usec = 0; - result = Select(highest_fd + 1, &r_mask, NULL, NULL, &retry); - } else { - result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); - } -#else /* NX_TRANS_SOCKET */ - result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); -#endif /* NX_TRANS_SOCKET */ -#endif /* USE_POLL */ -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XWaitForReadable: Out of select with result [%d] and errno [%d].\n", - result, (result < 0 ? errno : 0)); -#endif - InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } -#endif -#ifdef NX_TRANS_SOCKET - if (result <= 0) { - if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return -1; - } - continue; - } -#else - if (result == -1 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy); - if (result <= 0) - continue; -#endif -#ifdef USE_POLL - if (filedes[0].revents & (POLLIN|POLLHUP|POLLERR)) -#else - if (FD_ISSET(fd, &r_mask)) -#endif - break; - if (!(dpy->flags & XlibDisplayProcConni)) { - int i; - - saved_event_serial = dpy->next_event_serial_num; - /* dpy flags can be clobbered by internal connection callback */ - in_read_events = dpy->flags & XlibDisplayReadEvents; - for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) { -#ifdef USE_POLL - if (filedes[i].revents & POLLIN) -#else - if (FD_ISSET(ilist->fd, &r_mask)) -#endif - { - _XProcessInternalConnection(dpy, ilist); - did_proc_conni = True; - } - } -#ifdef USE_POLL - if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE) - Xfree(filedes); -#endif - } - if (did_proc_conni) { - /* some internal connection callback might have done an - XPutBackEvent. We notice it here and if we needed an event, - we can return all the way. */ - if (_XNewerQueuedEvent(dpy, saved_event_serial) - && (in_read_events -#ifdef XTHREADS - || (dpy->lock && dpy->lock->event_awaiters) -#endif - )) - return -2; - did_proc_conni = False; - } - } -#ifdef XTHREADS -#ifdef XTHREADS_DEBUG - printf("thread %x _XWaitForReadable returning\n", XThread_Self()); -#endif -#endif - return 0; -} -#endif /* !USE_XCB */ - -static int sync_hazard(Display *dpy) -{ - unsigned long span = dpy->request - dpy->last_request_read; - unsigned long hazard = min((dpy->bufmax - dpy->buffer) / SIZEOF(xReq), 65535 - 10); - return span >= 65535 - hazard - 10; -} - -static -void sync_while_locked(Display *dpy) -{ -#ifdef XTHREADS - if (dpy->lock) - (*dpy->lock->user_lock_display)(dpy); -#endif - UnlockDisplay(dpy); - SyncHandle(); - InternalLockDisplay(dpy, /* don't skip user locks */ 0); -#ifdef XTHREADS - if (dpy->lock) - (*dpy->lock->user_unlock_display)(dpy); -#endif -} - -void _XSeqSyncFunction( - register Display *dpy) -{ - xGetInputFocusReply rep; - _X_UNUSED register xReq *req; - -#ifdef NX_TRANS_SOCKET -#ifdef NX_TRANS_DEBUG - fprintf(stderr, "_XSeqSyncFunction: Going to synchronize the display.\n"); -#endif - - if (dpy->flags & XlibDisplayIOError) - { -#ifdef NX_TRANS_DEBUG - fprintf(stderr, "_XSeqSyncFunction: Returning 0 with I/O error detected.\n"); -#endif - return; - } -#endif /* NX_TRANS_SOCKET */ - if ((dpy->request - dpy->last_request_read) >= (65535 - BUFSIZE/SIZEOF(xReq))) { - GetEmptyReq(GetInputFocus, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - sync_while_locked(dpy); - } else if (sync_hazard(dpy)) - _XSetPrivSyncFunction(dpy); -} - -/* NOTE: only called if !XTHREADS, or when XInitThreads wasn't called. */ -static int -_XPrivSyncFunction (Display *dpy) -{ -#ifdef XTHREADS - assert(!dpy->lock_fns); -#endif - assert(dpy->synchandler == _XPrivSyncFunction); - assert((dpy->flags & XlibDisplayPrivSync) != 0); - dpy->synchandler = dpy->savedsynchandler; - dpy->savedsynchandler = NULL; - dpy->flags &= ~XlibDisplayPrivSync; - if(dpy->synchandler) - dpy->synchandler(dpy); - _XIDHandler(dpy); - _XSeqSyncFunction(dpy); - return 0; -} - -void _XSetPrivSyncFunction(Display *dpy) -{ -#ifdef XTHREADS - if (dpy->lock_fns) - return; -#endif - if (!(dpy->flags & XlibDisplayPrivSync)) { - dpy->savedsynchandler = dpy->synchandler; - dpy->synchandler = _XPrivSyncFunction; - dpy->flags |= XlibDisplayPrivSync; - } -} - -void _XSetSeqSyncFunction(Display *dpy) -{ - if (sync_hazard(dpy)) - _XSetPrivSyncFunction (dpy); -} - -#if !USE_XCB -#ifdef XTHREADS -static void _XFlushInt( - register Display *dpy, - register xcondition_t cv); -#endif - -/* - * _XFlush - Flush the X request buffer. If the buffer is empty, no - * action is taken. This routine correctly handles incremental writes. - * This routine may have to be reworked if int < long. - */ -void _XFlush( - register Display *dpy) -{ -#ifdef XTHREADS - /* With multi-threading we introduce an internal routine to which - we can pass a condition variable to do locking correctly. */ - - _XFlushInt(dpy, NULL); -} - -/* _XFlushInt - Internal version of _XFlush used to do multi-threaded - * locking correctly. - */ - -static void _XFlushInt( - register Display *dpy, - register xcondition_t cv) -{ -#endif /* XTHREADS*/ - register long size, todo; - register int write_stat; - register char *bufindex; - _XExtension *ext; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - int congestion; -#endif - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", - (dpy->bufptr - dpy->buffer)); -#endif - /* This fix resets the bufptr to the front of the buffer so - * additional appends to the bufptr will not corrupt memory. Since - * the server is down, these appends are no-op's anyway but - * callers of _XFlush() are not verifying this before they call it. - */ - if (dpy->flags & XlibDisplayIOError) - { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); -#endif - dpy->bufptr = dpy->buffer; - dpy->last_req = (char *)&_dummy_request; - return; - } - -#ifdef XTHREADS -#ifdef NX_TRANS_SOCKET - while (dpy->flags & XlibDisplayWriting) { - if (_XGetIOError(dpy)) { - return; - } -#else - while (dpy->flags & XlibDisplayWriting) { -#endif - if (dpy->lock) { - ConditionWait(dpy, dpy->lock->writers); - } else { - _XWaitForWritable (dpy, cv); - } - } -#endif - size = todo = dpy->bufptr - dpy->buffer; - if (!size) return; -#ifdef XTHREADS - dpy->flags |= XlibDisplayWriting; - /* make sure no one else can put in data */ - dpy->bufptr = dpy->bufmax; -#endif - for (ext = dpy->flushes; ext; ext = ext->next_flush) - (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, size); - bufindex = dpy->buffer; - /* - * While write has not written the entire buffer, keep looping - * until the entire buffer is written. bufindex will be - * incremented and size decremented as buffer is written out. - */ - while (size) { - ESET(0); - write_stat = _X11TransWrite(dpy->trans_conn, - bufindex, (int) todo); - if (write_stat >= 0) { -#ifdef NX_TRANS_SOCKET - if (_NXDisplayWriteFunction != NULL) { - (*_NXDisplayWriteFunction)(dpy, write_stat); - } -#ifdef NX_TRANS_CHANGE - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } -#endif -#endif - size -= write_stat; - todo = size; - bufindex += write_stat; - } else if (ETEST()) { - _XWaitForWritable(dpy -#ifdef XTHREADS - , cv -#endif - ); -#ifdef SUNSYSV - } else if (ECHECK(0)) { - _XWaitForWritable(dpy -#ifdef XTHREADS - , cv -#endif - ); -#endif -#ifdef ESZTEST - } else if (ESZTEST()) { - if (todo > 1) - todo >>= 1; - else { - _XWaitForWritable(dpy -#ifdef XTHREADS - , cv -#endif - ); - } -#endif -#ifdef NX_TRANS_SOCKET - } else if (!ECHECK(EINTR) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return; - } -#else - } else if (!ECHECK(EINTR)) { - /* Write failed! */ - /* errno set by write system call. */ - _XIOError(dpy); - } -#endif -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - return; - } -#endif - } - dpy->last_req = (char *)&_dummy_request; - _XSetSeqSyncFunction(dpy); - dpy->bufptr = dpy->buffer; -#ifdef XTHREADS - dpy->flags &= ~XlibDisplayWriting; -#endif -} - -int -_XEventsQueued( - register Display *dpy, - int mode) -{ - register int len; - BytesReadable_t pend; - _XAlignedBuffer buf; - register xReply *rep; - char *read_buf; -#ifdef XTHREADS - int entry_event_serial_num; - struct _XCVList *cvl = NULL; - xthread_t self; - -#ifdef XTHREADS_DEBUG - printf("_XEventsQueued called in thread %x\n", XThread_Self()); -#endif -#endif /* XTHREADS*/ - - if (mode == QueuedAfterFlush) - { - _XFlush(dpy); - if (dpy->qlen) - return(dpy->qlen); - } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - if (dpy->flags & XlibDisplayIOError) { - fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", - dpy->qlen); - } -#endif - if (dpy->flags & XlibDisplayIOError) return(dpy->qlen); - -#ifdef XTHREADS - /* create our condition variable and append to list, - * unless we were called from within XProcessInternalConnection - * or XLockDisplay - */ - xthread_clear_id(self); - if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) - || xthread_have_id (dpy->lock->locking_thread))) - /* some thread is in XProcessInternalConnection or XLockDisplay - so we have to see if we are it */ - self = XThread_Self(); - if (!xthread_have_id(self) - || (!xthread_equal(self, dpy->lock->conni_thread) - && !xthread_equal(self, dpy->lock->locking_thread))) { - /* In the multi-threaded case, if there is someone else - reading events, then there aren't any available, so - we just return. If we waited we would block. - */ - if (dpy->lock && dpy->lock->event_awaiters) - return dpy->qlen; - /* nobody here but us, so lock out any newcomers */ - cvl = QueueEventReaderLock(dpy); - } - - while (dpy->lock && cvl && dpy->lock->reply_first) { - /* note which events we have already seen so we'll know - if _XReply (in another thread) reads one */ - entry_event_serial_num = dpy->next_event_serial_num; - ConditionWait(dpy, cvl->cv); - /* did _XReply read an event we can return? */ - if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) - { - UnlockNextEventReader(dpy); - return 0; - } - } -#endif /* XTHREADS*/ - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); -#endif - if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) -#ifdef NX_TRANS_SOCKET - { - _XIOError(dpy); - - return (dpy->qlen); - } -#else - _XIOError(dpy); -#endif -#ifdef XCONN_CHECK_FREQ - /* This is a crock, required because FIONREAD or equivalent is - * not guaranteed to detect a broken connection. - */ - if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ) - { - int result; -#ifdef USE_POLL - struct pollfd filedes; -#else - fd_set r_mask; - static struct timeval zero_time; -#endif - - dpy->conn_checker = 0; -#ifdef USE_POLL -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XEventsQueued: Calling poll().\n"); -#endif - filedes.fd = dpy->fd; - filedes.events = POLLIN; - if ((result = poll(&filedes, 1, 0))) -#else -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XEventsQueued: Calling select().\n"); -#endif - FD_ZERO(&r_mask); - FD_SET(dpy->fd, &r_mask); - if ((result = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time))) -#endif - { - if (result > 0) - { - if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) -#ifdef NX_TRANS_SOCKET - { - _XIOError(dpy); - - return (dpy->qlen); - } -#else - _XIOError(dpy); -#endif - /* we should not get zero, if we do, force a read */ - if (!pend) - pend = SIZEOF(xReply); - } -#ifdef NX_TRANS_SOCKET - if (result <= 0) { - if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return (dpy->qlen); - } - } -#else - else if (result < 0 && !(ECHECK(EINTR) || ETEST())) -#endif - _XIOError(dpy); - } - } -#endif /* XCONN_CHECK_FREQ */ - if (!(len = pend)) { - /* _XFlush can enqueue events */ -#ifdef XTHREADS - if (cvl) -#endif - { - UnlockNextEventReader(dpy); - } -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); -#endif - return(dpy->qlen); - } - /* Force a read if there is not enough data. Otherwise, - * a select() loop at a higher-level will spin undesirably, - * and we've seen at least one OS that appears to not update - * the result from FIONREAD once it has returned nonzero. - */ -#ifdef XTHREADS - if (dpy->lock && dpy->lock->reply_awaiters) { - read_buf = (char *)dpy->lock->reply_awaiters->buf; - len = SIZEOF(xReply); - } else -#endif /* XTHREADS*/ - { - read_buf = buf.buf; - - if (len < SIZEOF(xReply) -#ifdef XTHREADS - || dpy->async_handlers -#endif - ) - len = SIZEOF(xReply); - else if (len > BUFSIZE) - len = BUFSIZE; - len = (len / SIZEOF(xReply)) * SIZEOF(xReply); - } -#ifdef XCONN_CHECK_FREQ - dpy->conn_checker = 0; -#endif - - (void) _XRead (dpy, read_buf, (long) len); - -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - return(dpy->qlen); - } -#endif -#ifdef XTHREADS - /* what did we actually read: reply or event? */ - if (dpy->lock && dpy->lock->reply_awaiters) { - if (((xReply *)read_buf)->generic.type == X_Reply || - ((xReply *)read_buf)->generic.type == X_Error) - { - dpy->lock->reply_was_read = True; - dpy->lock->reply_first = True; - if (read_buf != (char *)dpy->lock->reply_awaiters->buf) - memcpy(dpy->lock->reply_awaiters->buf, read_buf, - len); - if (cvl) { - UnlockNextEventReader(dpy); - } - return(dpy->qlen); /* we read, so we can return */ - } else if (read_buf != buf.buf) - memcpy(buf.buf, read_buf, len); - } -#endif /* XTHREADS*/ - - STARTITERATE(rep,xReply,buf.buf,len > 0) { - if (rep->generic.type == X_Reply) { - int tmp = len; - RESETITERPTR(rep,xReply, - _XAsyncReply (dpy, rep, - ITERPTR(rep), &tmp, True)); - len = tmp; - pend = len; - } else { - if (rep->generic.type == X_Error) - _XError (dpy, (xError *)rep); - else /* must be an event packet */ - _XEnq (dpy, (xEvent *)rep); - INCITERPTR(rep,xReply); - len -= SIZEOF(xReply); - } - } ENDITERATE - -#ifdef XTHREADS - if (cvl) -#endif - { - UnlockNextEventReader(dpy); - } - return(dpy->qlen); -} - -/* _XReadEvents - Flush the output queue, - * then read as many events as possible (but at least 1) and enqueue them - */ -void _XReadEvents( - register Display *dpy) -{ - _XAlignedBuffer buf; - BytesReadable_t pend; - int len; - register xReply *rep; - Bool not_yet_flushed = True; - char *read_buf; - int i; - int entry_event_serial_num = dpy->next_event_serial_num; -#ifdef XTHREADS - struct _XCVList *cvl = NULL; - xthread_t self; - -#ifdef XTHREADS_DEBUG - printf("_XReadEvents called in thread %x\n", - XThread_Self()); -#endif - /* create our condition variable and append to list, - * unless we were called from within XProcessInternalConnection - * or XLockDisplay - */ - xthread_clear_id(self); - if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) - || xthread_have_id (dpy->lock->locking_thread))) - /* some thread is in XProcessInternalConnection or XLockDisplay - so we have to see if we are it */ - self = XThread_Self(); - if (!xthread_have_id(self) - || (!xthread_equal(self, dpy->lock->conni_thread) - && !xthread_equal(self, dpy->lock->locking_thread))) - cvl = QueueEventReaderLock(dpy); -#endif /* XTHREADS */ - - do { -#ifdef XTHREADS - /* if it is not our turn to read an event off the wire, - wait til we're at head of list */ - if (dpy->lock && cvl && - (dpy->lock->event_awaiters != cvl || - dpy->lock->reply_first)) { - ConditionWait(dpy, cvl->cv); - continue; - } -#endif /* XTHREADS */ - /* find out how much data can be read */ - if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) - { - _XIOError(dpy); -#ifdef NX_TRANS_SOCKET - return; -#endif - } - len = pend; - - /* must read at least one xEvent; if none is pending, then - we'll just flush and block waiting for it */ - if (len < SIZEOF(xEvent) -#ifdef XTHREADS - || dpy->async_handlers -#endif - ) { - len = SIZEOF(xEvent); - /* don't flush until the first time we would block */ - if (not_yet_flushed) { - _XFlush (dpy); - if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) { - /* _XReply has read an event for us */ - goto got_event; - } - not_yet_flushed = False; - } - } - -#ifdef XTHREADS - /* If someone is waiting for a reply, gamble that - the reply will be the next thing on the wire - and read it into their buffer. */ - if (dpy->lock && dpy->lock->reply_awaiters) { - read_buf = (char *)dpy->lock->reply_awaiters->buf; - len = SIZEOF(xReply); - } else -#endif /* XTHREADS*/ - { - read_buf = buf.buf; - - /* but we won't read more than the max buffer size */ - if (len > BUFSIZE) - len = BUFSIZE; - - /* round down to an integral number of XReps */ - len = (len / SIZEOF(xEvent)) * SIZEOF(xEvent); - } - -#ifdef XTHREADS - if (xthread_have_id(self)) - /* save value we may have to stick in conni_thread */ - dpy->lock->reading_thread = self; -#endif /* XTHREADS */ - dpy->flags |= XlibDisplayReadEvents; - i = _XRead (dpy, read_buf, (long) len); - dpy->flags &= ~XlibDisplayReadEvents; -#ifdef NX_TRANS_SOCKET - if (dpy->flags & XlibDisplayIOError) - { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); -#endif - return; - } -#endif - if (i == -2) { - /* special flag from _XRead to say that internal connection has - done XPutBackEvent. Which we can use so we're done. */ - got_event: -#ifdef XTHREADS - if (dpy->lock && dpy->lock->lock_wait) { - if (dpy->lock->event_awaiters != cvl) - /* since it is not us, must be user lock thread */ - ConditionSignal(dpy, - dpy->lock->event_awaiters->cv); - (*dpy->lock->lock_wait)(dpy); - continue; - } -#endif - break; - } -#ifdef XTHREADS - if (xthread_have_id(self)) - xthread_clear_id(dpy->lock->reading_thread); - - /* what did we actually read: reply or event? */ - if (dpy->lock && dpy->lock->reply_awaiters) { - if (((xReply *)read_buf)->generic.type == X_Reply || - ((xReply *)read_buf)->generic.type == X_Error) - { - dpy->lock->reply_was_read = True; - dpy->lock->reply_first = True; - if (read_buf != (char *)dpy->lock->reply_awaiters->buf) - memcpy(dpy->lock->reply_awaiters->buf, - read_buf, len); - ConditionSignal(dpy, dpy->lock->reply_awaiters->cv); - continue; - } else if (read_buf != buf.buf) - memcpy(buf.buf, read_buf, len); - } -#endif /* XTHREADS */ - - STARTITERATE(rep,xReply,buf.buf,len > 0) { - if (rep->generic.type == X_Reply) { - RESETITERPTR(rep,xReply, - _XAsyncReply (dpy, rep, - ITERPTR(rep), &len, True)); - pend = len; - } else { - if (rep->generic.type == X_Error) - _XError (dpy, (xError *) rep); - else /* must be an event packet */ - { - if (rep->generic.type == GenericEvent) - { - int evlen; - evlen = (rep->generic.length << 2); - if (_XRead(dpy, &read_buf[len], evlen) == -2) - goto got_event; /* XXX: aargh! */ - } - - _XEnq (dpy, (xEvent *)rep); - } - INCITERPTR(rep,xReply); - len -= SIZEOF(xReply); - } - } ENDITERATE; - } while (!_XNewerQueuedEvent(dpy, entry_event_serial_num)); - - UnlockNextEventReader(dpy); -} - -/* - * _XRead - Read bytes from the socket taking into account incomplete - * reads. This routine may have to be reworked if int < long. - */ -int _XRead( - register Display *dpy, - register char *data, - register long size) -{ - register long bytes_read; -#ifdef XTHREADS - int original_size = size; -#endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - int congestion; -#endif - - if ((dpy->flags & XlibDisplayIOError) || size == 0) - return 0; - ESET(0); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - while (1) { - /* - * Need to check the congestion state - * after the read so split the statement - * in multiple blocks. - */ - - bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size); - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } - if (bytes_read == size) { - break; - } -#else - while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size)) - != size) { -#endif - - if (bytes_read > 0) { - size -= bytes_read; - data += bytes_read; - } - else if (ETEST()) { - if (_XWaitForReadable(dpy) == -2) - return -2; /* internal connection did XPutBackEvent */ - ESET(0); - } -#ifdef SUNSYSV - else if (ECHECK(0)) { - if (_XWaitForReadable(dpy) == -2) - return -2; /* internal connection did XPutBackEvent */ - } -#endif - else if (bytes_read == 0) { - /* Read failed because of end of file! */ - ESET(EPIPE); -#ifdef NX_TRANS_SOCKET - _XIOError(dpy); - - return -1; -#else - _XIOError(dpy); -#endif - } - - else /* bytes_read is less than 0; presumably -1 */ { - /* If it's a system call interrupt, it's not an error. */ -#ifdef NX_TRANS_SOCKET - if (!ECHECK(EINTR) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return -1; - } -#else - if (!ECHECK(EINTR)) - _XIOError(dpy); -#endif - } -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - return -1; - } -#endif - } -#ifdef XTHREADS - if (dpy->lock && dpy->lock->reply_bytes_left > 0) - { - dpy->lock->reply_bytes_left -= original_size; - if (dpy->lock->reply_bytes_left == 0) { - dpy->flags &= ~XlibDisplayReply; - UnlockNextReplyReader(dpy); - } - } -#endif /* XTHREADS*/ - return 0; -} -#endif /* !USE_XCB */ - -#ifdef LONG64 -void _XRead32( - Display *dpy, - register long *data, - long len) -{ - register int *buf; - register long i; - - if (len) { - (void) _XRead(dpy, (char *)data, len); - i = len >> 2; - buf = (int *)data + i; - data += i; - while (--i >= 0) - *--data = *--buf; - } -} -#endif /* LONG64 */ - - - -#if !USE_XCB -/* - * _XReadPad - Read bytes from the socket taking into account incomplete - * reads. If the number of bytes is not 0 mod 4, read additional pad - * bytes. This routine may have to be reworked if int < long. - */ -void _XReadPad( - register Display *dpy, - register char *data, - register long size) -{ - register long bytes_read; - struct iovec iov[2]; - char pad[3]; -#ifdef XTHREADS - int original_size; -#endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - int congestion; -#endif - - if ((dpy->flags & XlibDisplayIOError) || size == 0) return; - iov[0].iov_len = (int)size; - iov[0].iov_base = data; - /* - * The following hack is used to provide 32 bit long-word - * aligned padding. The [1] vector is of length 0, 1, 2, or 3, - * whatever is needed. - */ - - iov[1].iov_len = -size & 3; - iov[1].iov_base = pad; - size += iov[1].iov_len; -#ifdef XTHREADS - original_size = size; -#endif - ESET(0); -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - while (1) { - bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } - if (bytes_read == size) { - break; - } -#else - while ((bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2)) != size) { -#endif - - if (bytes_read > 0) { - size -= bytes_read; - if (iov[0].iov_len < bytes_read) { - int pad_bytes_read = bytes_read - iov[0].iov_len; - iov[1].iov_len -= pad_bytes_read; - iov[1].iov_base = - (char *)iov[1].iov_base + pad_bytes_read; - iov[0].iov_len = 0; - } - else { - iov[0].iov_len -= bytes_read; - iov[0].iov_base = (char *)iov[0].iov_base + bytes_read; - } - } - else if (ETEST()) { - _XWaitForReadable(dpy); - ESET(0); - } -#ifdef SUNSYSV - else if (ECHECK(0)) { - _XWaitForReadable(dpy); - } -#endif - else if (bytes_read == 0) { - /* Read failed because of end of file! */ - ESET(EPIPE); -#ifdef NX_TRANS_SOCKET - _XIOError(dpy); - - return; -#else - _XIOError(dpy); -#endif - } - - else /* bytes_read is less than 0; presumably -1 */ { - /* If it's a system call interrupt, it's not an error. */ -#ifdef NX_TRANS_SOCKET - if (!ECHECK(EINTR) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return; - } -#else - if (!ECHECK(EINTR)) - _XIOError(dpy); -#endif - } -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - return; - } -#endif - } -#ifdef XTHREADS - if (dpy->lock && dpy->lock->reply_bytes_left > 0) - { - dpy->lock->reply_bytes_left -= original_size; - if (dpy->lock->reply_bytes_left == 0) { - dpy->flags &= ~XlibDisplayReply; - UnlockNextReplyReader(dpy); - } - } -#endif /* XTHREADS*/ -} - -/* - * _XSend - Flush the buffer and send the client data. 32 bit word aligned - * transmission is used, if size is not 0 mod 4, extra bytes are transmitted. - * This routine may have to be reworked if int < long; - */ -void -_XSend ( - register Display *dpy, - _Xconst char *data, - register long size) -{ - struct iovec iov[3]; - static char const pad[3] = {0, 0, 0}; - /* XText8 and XText16 require that the padding bytes be zero! */ - - long skip, dbufsize, padsize, total, todo; - _XExtension *ext; -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) - int congestion; -#endif - -#ifdef NX_TRANS_SOCKET -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", - (dpy->bufptr - dpy->buffer)); -#endif - if (!size || (dpy->flags & XlibDisplayIOError)) - { - if (dpy->flags & XlibDisplayIOError) - { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XSend: Returning with I/O error detected.\n"); -#endif - dpy->bufptr = dpy->buffer; - dpy->last_req = (char *)&_dummy_request; - } - - return; - } -#else - if (!size || (dpy->flags & XlibDisplayIOError)) return; -#endif - dbufsize = dpy->bufptr - dpy->buffer; -#ifdef XTHREADS - dpy->flags |= XlibDisplayWriting; - /* make sure no one else can put in data */ - dpy->bufptr = dpy->bufmax; -#endif - padsize = -size & 3; - for (ext = dpy->flushes; ext; ext = ext->next_flush) { - (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, dbufsize); - (*ext->before_flush)(dpy, &ext->codes, (char *)data, size); - if (padsize) - (*ext->before_flush)(dpy, &ext->codes, pad, padsize); - } - skip = 0; - todo = total = dbufsize + size + padsize; - - /* - * There are 3 pieces that may need to be written out: - * - * o whatever is in the display buffer - * o the data passed in by the user - * o any padding needed to 32bit align the whole mess - * - * This loop looks at all 3 pieces each time through. It uses skip - * to figure out whether or not a given piece is needed. - */ - while (total) { - long before = skip; /* amount of whole thing written */ - long remain = todo; /* amount to try this time, <= total */ - int i = 0; - long len; - - /* You could be very general here and have "in" and "out" iovecs - * and write a loop without using a macro, but what the heck. This - * translates to: - * - * how much of this piece is new? - * if more new then we are trying this time, clamp - * if nothing new - * then bump down amount already written, for next piece - * else put new stuff in iovec, will need all of next piece - * - * Note that todo had better be at least 1 or else we'll end up - * writing 0 iovecs. - */ -#define InsertIOV(pointer, length) \ - len = (length) - before; \ - if (len > remain) \ - len = remain; \ - if (len <= 0) { \ - before = (-len); \ - } else { \ - iov[i].iov_len = len; \ - iov[i].iov_base = (pointer) + before; \ - i++; \ - remain -= len; \ - before = 0; \ - } - - InsertIOV (dpy->buffer, dbufsize) - InsertIOV ((char *)data, size) - InsertIOV ((char *)pad, padsize) - - ESET(0); - if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) { -#ifdef NX_TRANS_SOCKET - if (_NXDisplayWriteFunction != NULL) { - (*_NXDisplayWriteFunction)(dpy, len); - } -#ifdef NX_TRANS_CHANGE - if (_NXDisplayCongestionFunction != NULL && - _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { - (*_NXDisplayCongestionFunction)(dpy, congestion); - } -#endif -#endif - skip += len; - total -= len; - todo = total; - } else if (ETEST()) { - _XWaitForWritable(dpy -#ifdef XTHREADS - , NULL -#endif - ); -#ifdef SUNSYSV - } else if (ECHECK(0)) { - _XWaitForWritable(dpy -#ifdef XTHREADS - , NULL -#endif - ); -#endif -#ifdef ESZTEST - } else if (ESZTEST()) { - if (todo > 1) - todo >>= 1; - else { - _XWaitForWritable(dpy -#ifdef XTHREADS - , NULL -#endif - ); - } -#endif -#ifdef NX_TRANS_SOCKET - } else if (!ECHECK(EINTR) || - (_NXDisplayErrorFunction != NULL && - (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { - _XIOError(dpy); - return; - } -#else - } else if (!ECHECK(EINTR)) { - _XIOError(dpy); - } -#endif -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - return; - } -#endif - } - dpy->last_req = (char *) & _dummy_request; - _XSetSeqSyncFunction(dpy); - dpy->bufptr = dpy->buffer; -#ifdef XTHREADS - dpy->flags &= ~XlibDisplayWriting; -#endif - return; -} - -static void -_XGetMiscCode( - register Display *dpy) -{ - xQueryExtensionReply qrep; - register xQueryExtensionReq *qreq; - xXCMiscGetVersionReply vrep; - register xXCMiscGetVersionReq *vreq; - - if (dpy->xcmisc_opcode) - return; - GetReq(QueryExtension, qreq); - qreq->nbytes = sizeof(XCMiscExtensionName) - 1; - qreq->length += (qreq->nbytes+(unsigned)3)>>2; - _XSend(dpy, XCMiscExtensionName, (long)qreq->nbytes); - if (!_XReply (dpy, (xReply *)&qrep, 0, xTrue)) - dpy->xcmisc_opcode = -1; - else { - GetReq(XCMiscGetVersion, vreq); - vreq->reqType = qrep.major_opcode; - vreq->miscReqType = X_XCMiscGetVersion; - vreq->majorVersion = XCMiscMajorVersion; - vreq->minorVersion = XCMiscMinorVersion; - if (!_XReply (dpy, (xReply *)&vrep, 0, xTrue)) - dpy->xcmisc_opcode = -1; - else - dpy->xcmisc_opcode = qrep.major_opcode; - } -} - -void -_XIDHandler( - register Display *dpy) -{ - xXCMiscGetXIDRangeReply grep; - register xXCMiscGetXIDRangeReq *greq; - - if (dpy->resource_max == dpy->resource_mask + 1) { - _XGetMiscCode(dpy); - if (dpy->xcmisc_opcode > 0) { - GetReq(XCMiscGetXIDRange, greq); - greq->reqType = dpy->xcmisc_opcode; - greq->miscReqType = X_XCMiscGetXIDRange; - if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) { - dpy->resource_id = ((grep.start_id - dpy->resource_base) >> - dpy->resource_shift); - dpy->resource_max = dpy->resource_id; - if (grep.count > 5) - dpy->resource_max += grep.count - 6; - dpy->resource_max <<= dpy->resource_shift; - } - sync_while_locked(dpy); - } - } -} - -/* - * _XAllocID - resource ID allocation routine. - */ -XID _XAllocID( - register Display *dpy) -{ - XID id; - - id = dpy->resource_id << dpy->resource_shift; - if (id >= dpy->resource_max) { - _XSetPrivSyncFunction(dpy); - dpy->resource_max = dpy->resource_mask + 1; - } - if (id <= dpy->resource_mask) { - dpy->resource_id++; - return (dpy->resource_base + id); - } - if (id != 0x10000000) { - (void) fprintf(stderr, - "Xlib: resource ID allocation space exhausted!\n"); - id = 0x10000000; - dpy->resource_id = id >> dpy->resource_shift; - } - return id; -} - -/* - * _XAllocIDs - multiple resource ID allocation routine. - */ -void _XAllocIDs( - register Display *dpy, - XID *ids, - int count) -{ - XID id; - int i; - xXCMiscGetXIDListReply grep; - register xXCMiscGetXIDListReq *greq; - - id = dpy->resource_id << dpy->resource_shift; - if (dpy->resource_max <= dpy->resource_mask && - id <= dpy->resource_mask && - (dpy->resource_max - id) > ((count - 1) << dpy->resource_shift)) { - id += dpy->resource_base; - for (i = 0; i < count; i++) { - ids[i] = id; - id += (1 << dpy->resource_shift); - dpy->resource_id++; - } - return; - } - grep.count = 0; - _XGetMiscCode(dpy); - if (dpy->xcmisc_opcode > 0) { - GetReq(XCMiscGetXIDList, greq); - greq->reqType = dpy->xcmisc_opcode; - greq->miscReqType = X_XCMiscGetXIDList; - greq->count = count; - if (_XReply(dpy, (xReply *)&grep, 0, xFalse) && grep.count) { - _XRead32(dpy, (long *) ids, 4L * (long) (grep.count)); - for (i = 0; i < grep.count; i++) { - id = (ids[i] - dpy->resource_base) >> dpy->resource_shift; - if (id >= dpy->resource_id) - dpy->resource_id = id; - } - if (id >= dpy->resource_max) { - _XSetPrivSyncFunction(dpy); - dpy->resource_max = dpy->resource_mask + 1; - } - } - } - for (i = grep.count; i < count; i++) - ids[i] = XAllocID(dpy); -} -#endif /* !USE_XCB */ - -/* - * The hard part about this is that we only get 16 bits from a reply. - * We have three values that will march along, with the following invariant: - * dpy->last_request_read <= rep->sequenceNumber <= dpy->request - * We have to keep - * dpy->request - dpy->last_request_read < 2^16 - * or else we won't know for sure what value to use in events. We do this - * by forcing syncs when we get close. - */ - -unsigned long -_XSetLastRequestRead( - register Display *dpy, - register xGenericReply *rep) -{ - register unsigned long newseq, lastseq; - - lastseq = dpy->last_request_read; - /* - * KeymapNotify has no sequence number, but is always guaranteed - * to immediately follow another event, except when generated via - * SendEvent (hmmm). - */ - if ((rep->type & 0x7f) == KeymapNotify) - return(lastseq); - - newseq = (lastseq & ~((unsigned long)0xffff)) | rep->sequenceNumber; - - if (newseq < lastseq) { - newseq += 0x10000; - if (newseq > dpy->request) { -#ifdef NX_TRANS_SOCKET - if (_NXLostSequenceFunction != NULL) - { - (*_NXLostSequenceFunction)(dpy, newseq, dpy->request, - (unsigned int) rep->type); - } - else -#endif /* #ifdef NX_TRANS_SOCKET */ - { - (void) fprintf (stderr, - "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", - newseq, dpy->request, - (unsigned int) rep->type); - } - newseq -= 0x10000; - } - } - - dpy->last_request_read = newseq; - return(newseq); -} - -#if !USE_XCB -/* - * _XReply - Wait for a reply packet and copy its contents into the - * specified rep. Meanwhile we must handle error and event packets that - * we may encounter. - */ -Status -_XReply ( - register Display *dpy, - register xReply *rep, - int extra, /* number of 32-bit words expected after the reply */ - Bool discard) /* should I discard data following "extra" words? */ -{ - /* Pull out the serial number now, so that (currently illegal) requests - * generated by an error handler don't confuse us. - */ - unsigned long cur_request = dpy->request; -#ifdef XTHREADS - struct _XCVList *cvl; -#endif -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XReply: Going to wait for an X reply.\n"); -#endif - -#ifdef NX_TRANS_SOCKET - if (dpy->flags & XlibDisplayIOError) - { -#ifdef NX_TRANS_DEBUG - fprintf(stderr, "_XReply: Returning 0 with I/O error detected.\n"); -#endif - return 0; - } -#else - if (dpy->flags & XlibDisplayIOError) - return 0; -#endif - -#ifdef XTHREADS - /* create our condition variable and append to list */ - cvl = QueueReplyReaderLock(dpy); - if (cvl) { - cvl->buf = rep; - if (dpy->lock->reply_awaiters == cvl && !dpy->lock->event_awaiters) - dpy->lock->reply_first = True; - } - -#ifdef XTHREADS_DEBUG - printf("_XReply called in thread %x, adding %x to cvl\n", - XThread_Self(), cvl); -#endif - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XReply: Going to flush the display buffer.\n"); -#endif - _XFlushInt(dpy, cvl ? cvl->cv : NULL); - /* if it is not our turn to read a reply off the wire, - * wait til we're at head of list. if there is an event waiter, - * and our reply hasn't been read, they'll be in select and will - * hand control back to us next. - */ - if(dpy->lock && - (dpy->lock->reply_awaiters != cvl || !dpy->lock->reply_first)) { - ConditionWait(dpy, cvl->cv); - } - dpy->flags |= XlibDisplayReply; -#else /* XTHREADS else */ - _XFlush(dpy); -#endif - -#ifdef NX_TRANS_SOCKET - /* - * We are going to block waiting for the remote - * X server. Be sure that the proxy has flushed - * all the data. - */ - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XReply: Requesting a flush of the NX transport.\n"); -#endif - NXTransFlush(dpy->fd); -#endif - - for (;;) { -#ifdef XTHREADS - /* Did another thread's _XReadEvents get our reply by accident? */ - if (!dpy->lock || !dpy->lock->reply_was_read) -#endif - (void) _XRead(dpy, (char *)rep, (long)SIZEOF(xReply)); -#ifdef XTHREADS - if (dpy->lock) - dpy->lock->reply_was_read = False; -#endif - - switch ((int)rep->generic.type) { - - case X_Reply: - /* Reply received. Fast update for synchronous replies, - * but deal with multiple outstanding replies. - */ - if (rep->generic.sequenceNumber == (cur_request & 0xffff)) - dpy->last_request_read = cur_request; - else { - int pend = SIZEOF(xReply); - if (_XAsyncReply(dpy, rep, (char *)rep, &pend, False) - != (char *)rep) - continue; - } - if (extra <= rep->generic.length) { - if (extra > 0) - /* - * Read the extra data into storage immediately - * following the GenericReply structure. - */ - (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), - ((long)extra) << 2); - if (discard) { - if (extra < rep->generic.length) - _XEatData(dpy, (rep->generic.length - extra) << 2); - } -#ifdef XTHREADS - if (dpy->lock) { - if (discard) { - dpy->lock->reply_bytes_left = 0; - } else { - dpy->lock->reply_bytes_left = - (rep->generic.length - extra) << 2; - } - if (dpy->lock->reply_bytes_left == 0) { - dpy->flags &= ~XlibDisplayReply; - UnlockNextReplyReader(dpy); - } - } else - dpy->flags &= ~XlibDisplayReply; -#endif - return 1; - } - /* - *if we get here, then extra > rep->generic.length--meaning we - * read a reply that's shorter than we expected. This is an - * error, but we still need to figure out how to handle it... - */ - (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), - ((long) rep->generic.length) << 2); - dpy->flags &= ~XlibDisplayReply; - UnlockNextReplyReader(dpy); -#ifdef NX_TRANS_SOCKET - /* - * The original code has provision - * for returning already. - */ -#endif - _XIOError (dpy); - return (0); - - case X_Error: - { - register _XExtension *ext; - register Bool ret = False; - int ret_code; - xError *err = (xError *) rep; - unsigned long serial; - - dpy->flags &= ~XlibDisplayReply; - serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); - if (serial == cur_request) - /* do not die on "no such font", "can't allocate", - "can't grab" failures */ - switch ((int)err->errorCode) { - case BadName: - switch (err->majorCode) { - case X_LookupColor: - case X_AllocNamedColor: - UnlockNextReplyReader(dpy); - return(0); - } - break; - case BadFont: - if (err->majorCode == X_QueryFont) { - UnlockNextReplyReader(dpy); - return (0); - } - break; - case BadAlloc: - case BadAccess: - UnlockNextReplyReader(dpy); - return (0); - } - /* - * we better see if there is an extension who may - * want to suppress the error. - */ - for (ext = dpy->ext_procs; !ret && ext; ext = ext->next) { - if (ext->error) - ret = (*ext->error)(dpy, err, &ext->codes, &ret_code); - } - if (!ret) { - _XError(dpy, err); - ret_code = 0; - } - if (serial == cur_request) { - UnlockNextReplyReader(dpy); - return(ret_code); - } - - } /* case X_Error */ - break; - default: - _XEnq(dpy, (xEvent *) rep); -#ifdef XTHREADS - if (dpy->lock && dpy->lock->event_awaiters) - ConditionSignal(dpy, dpy->lock->event_awaiters->cv); -#endif - break; - } -#ifdef NX_TRANS_SOCKET - if (_XGetIOError(dpy)) { - UnlockNextReplyReader(dpy); - return 0; - } -#endif - } -} - -static char * -_XAsyncReply( - Display *dpy, - register xReply *rep, - char *buf, - register int *lenp, - Bool discard) -{ - register _XAsyncHandler *async, *next; - register int len; - register Bool consumed = False; - char *nbuf; - - (void) _XSetLastRequestRead(dpy, &rep->generic); - len = SIZEOF(xReply) + (rep->generic.length << 2); - if (len < SIZEOF(xReply)) { -#ifdef NX_TRANS_SOCKET - - /* - * The original code has provision - * for returning already. - */ - -#endif - _XIOError (dpy); - buf += *lenp; - *lenp = 0; - return buf; - } - - for (async = dpy->async_handlers; async; async = next) { - next = async->next; - if ((consumed = (*async->handler)(dpy, rep, buf, *lenp, async->data))) - break; - } - if (!consumed) { - if (!discard) - return buf; - (void) fprintf(stderr, - "Xlib: unexpected async reply (sequence 0x%lx)!\n", - dpy->last_request_read); -#ifdef XTHREADS -#ifdef XTHREADS_DEBUG - printf("thread %x, unexpected async reply\n", XThread_Self()); -#endif -#endif - if (len > *lenp) - _XEatData(dpy, len - *lenp); - } - if (len < SIZEOF(xReply)) - { -#ifdef NX_TRANS_SOCKET - - /* - * The original code has provision - * for returning already. - */ - -#endif - _XIOError (dpy); - buf += *lenp; - *lenp = 0; - return buf; - } - if (len >= *lenp) { - buf += *lenp; - *lenp = 0; - return buf; - } - *lenp -= len; - buf += len; - len = *lenp; - nbuf = buf; - while (len > SIZEOF(xReply)) { - if (*buf == X_Reply) - return nbuf; - buf += SIZEOF(xReply); - len -= SIZEOF(xReply); - } - if (len > 0 && len < SIZEOF(xReply)) { - buf = nbuf; - len = SIZEOF(xReply) - len; - nbuf -= len; - memmove(nbuf, buf, *lenp); - (void) _XRead(dpy, nbuf + *lenp, (long)len); - *lenp += len; - } - return nbuf; -} -#endif /* !USE_XCB */ - -/* - * Support for internal connections, such as an IM might use. - * By Stephen Gildea, X Consortium, September 1993 - */ - -/* _XRegisterInternalConnection - * Each IM (or Xlib extension) that opens a file descriptor that Xlib should - * include in its select/poll mask must call this function to register the - * fd with Xlib. Any XConnectionWatchProc registered by XAddConnectionWatch - * will also be called. - * - * Whenever Xlib detects input available on fd, it will call callback - * with call_data to process it. If non-Xlib code calls select/poll - * and detects input available, it must call XProcessInternalConnection, - * which will call the associated callback. - * - * Non-Xlib code can learn about these additional fds by calling - * XInternalConnectionNumbers or, more typically, by registering - * a XConnectionWatchProc with XAddConnectionWatch - * to be called when fds are registered or unregistered. - * - * Returns True if registration succeeded, False if not, typically - * because could not allocate memory. - * Assumes Display locked when called. - */ -Status -_XRegisterInternalConnection( - Display* dpy, - int fd, - _XInternalConnectionProc callback, - XPointer call_data -) -{ - struct _XConnectionInfo *new_conni, **iptr; - struct _XConnWatchInfo *watchers; - XPointer *wd; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); -#endif - new_conni = Xmalloc(sizeof(struct _XConnectionInfo)); - if (!new_conni) - return 0; - new_conni->watch_data = Xmalloc(dpy->watcher_count * sizeof(XPointer)); - if (!new_conni->watch_data) { - Xfree(new_conni); - return 0; - } - new_conni->fd = fd; - new_conni->read_callback = callback; - new_conni->call_data = call_data; - new_conni->next = NULL; - /* link new structure onto end of list */ - for (iptr = &dpy->im_fd_info; *iptr; iptr = &(*iptr)->next) - ; - *iptr = new_conni; - dpy->im_fd_length++; - _XPollfdCacheAdd(dpy, fd); - - for (watchers=dpy->conn_watchers, wd=new_conni->watch_data; - watchers; - watchers=watchers->next, wd++) { - *wd = NULL; /* for cleanliness */ - (*watchers->fn) (dpy, watchers->client_data, fd, True, wd); - } - - return 1; -} - -/* _XUnregisterInternalConnection - * Each IM (or Xlib extension) that closes a file descriptor previously - * registered with _XRegisterInternalConnection must call this function. - * Any XConnectionWatchProc registered by XAddConnectionWatch - * will also be called. - * - * Assumes Display locked when called. - */ -void -_XUnregisterInternalConnection( - Display* dpy, - int fd -) -{ - struct _XConnectionInfo *info_list, **prev; - struct _XConnWatchInfo *watch; - XPointer *wd; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); -#endif - for (prev = &dpy->im_fd_info; (info_list = *prev); - prev = &info_list->next) { - if (info_list->fd == fd) { - *prev = info_list->next; - dpy->im_fd_length--; - for (watch=dpy->conn_watchers, wd=info_list->watch_data; - watch; - watch=watch->next, wd++) { - (*watch->fn) (dpy, watch->client_data, fd, False, wd); - } - Xfree (info_list->watch_data); - Xfree (info_list); - break; - } - } - _XPollfdCacheDel(dpy, fd); -} - -/* XInternalConnectionNumbers - * Returns an array of fds and an array of corresponding call data. - * Typically a XConnectionWatchProc registered with XAddConnectionWatch - * will be used instead of this function to discover - * additional fds to include in the select/poll mask. - * - * The list is allocated with Xmalloc and should be freed by the caller - * with Xfree; - */ -Status -XInternalConnectionNumbers( - Display *dpy, - int **fd_return, - int *count_return -) -{ - int count; - struct _XConnectionInfo *info_list; - int *fd_list; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); -#endif - LockDisplay(dpy); - count = 0; - for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) - count++; - fd_list = Xmalloc (count * sizeof(int)); - if (!fd_list) { - UnlockDisplay(dpy); - return 0; - } - count = 0; - for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { - fd_list[count] = info_list->fd; - count++; - } - UnlockDisplay(dpy); - - *fd_return = fd_list; - *count_return = count; - return 1; -} - -void _XProcessInternalConnection( - Display *dpy, - struct _XConnectionInfo *conn_info) -{ - dpy->flags |= XlibDisplayProcConni; -#if defined(XTHREADS) && !USE_XCB - if (dpy->lock) { - /* check cache to avoid call to thread_self */ - if (xthread_have_id(dpy->lock->reading_thread)) - dpy->lock->conni_thread = dpy->lock->reading_thread; - else - dpy->lock->conni_thread = XThread_Self(); - } -#endif /* XTHREADS && !USE_XCB */ - UnlockDisplay(dpy); - (*conn_info->read_callback) (dpy, conn_info->fd, conn_info->call_data); - LockDisplay(dpy); -#if defined(XTHREADS) && !USE_XCB - if (dpy->lock) - xthread_clear_id(dpy->lock->conni_thread); -#endif /* XTHREADS && !USE_XCB */ - dpy->flags &= ~XlibDisplayProcConni; -} - -/* XProcessInternalConnection - * Call the _XInternalConnectionProc registered by _XRegisterInternalConnection - * for this fd. - * The Display is NOT locked during the call. - */ -void -XProcessInternalConnection( - Display* dpy, - int fd -) -{ - struct _XConnectionInfo *info_list; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "XProcessInternalConnection: Got called.\n"); -#endif - - LockDisplay(dpy); - for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { - if (info_list->fd == fd) { - _XProcessInternalConnection(dpy, info_list); - break; - } - } - UnlockDisplay(dpy); -} - -/* XAddConnectionWatch - * Register a callback to be called whenever _XRegisterInternalConnection - * or _XUnregisterInternalConnection is called. - * Callbacks are called with the Display locked. - * If any connections are already registered, the callback is immediately - * called for each of them. - */ -Status -XAddConnectionWatch( - Display* dpy, - XConnectionWatchProc callback, - XPointer client_data -) -{ - struct _XConnWatchInfo *new_watcher, **wptr; - struct _XConnectionInfo *info_list; - XPointer *wd_array; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "XAddConnectionWatch: Got called.\n"); -#endif - LockDisplay(dpy); - - /* allocate new watch data */ - for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { - wd_array = Xrealloc(info_list->watch_data, - (dpy->watcher_count + 1) * sizeof(XPointer)); - if (!wd_array) { - UnlockDisplay(dpy); - return 0; - } - info_list->watch_data = wd_array; - wd_array[dpy->watcher_count] = NULL; /* for cleanliness */ - } - - new_watcher = Xmalloc(sizeof(struct _XConnWatchInfo)); - if (!new_watcher) { - UnlockDisplay(dpy); - return 0; - } - new_watcher->fn = callback; - new_watcher->client_data = client_data; - new_watcher->next = NULL; - - /* link new structure onto end of list */ - for (wptr = &dpy->conn_watchers; *wptr; wptr = &(*wptr)->next) - ; - *wptr = new_watcher; - dpy->watcher_count++; - - /* call new watcher on all currently registered fds */ - for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { - (*callback) (dpy, client_data, info_list->fd, True, - info_list->watch_data + dpy->watcher_count - 1); - } - - UnlockDisplay(dpy); - return 1; -} - -/* XRemoveConnectionWatch - * Unregister a callback registered by XAddConnectionWatch. - * Both callback and client_data must match what was passed to - * XAddConnectionWatch. - */ -void -XRemoveConnectionWatch( - Display* dpy, - XConnectionWatchProc callback, - XPointer client_data -) -{ - struct _XConnWatchInfo *watch; - struct _XConnWatchInfo *previous = NULL; - struct _XConnectionInfo *conni; - int counter = 0; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); -#endif - LockDisplay(dpy); - for (watch=dpy->conn_watchers; watch; watch=watch->next) { - if (watch->fn == callback && watch->client_data == client_data) { - if (previous) - previous->next = watch->next; - else - dpy->conn_watchers = watch->next; - Xfree (watch); - dpy->watcher_count--; - /* remove our watch_data for each connection */ - for (conni=dpy->im_fd_info; conni; conni=conni->next) { - /* don't bother realloc'ing; these arrays are small anyway */ - /* overlapping */ - memmove(conni->watch_data+counter, - conni->watch_data+counter+1, - dpy->watcher_count - counter); - } - break; - } - previous = watch; - counter++; - } - UnlockDisplay(dpy); -} - -/* end of internal connections support */ - - -#if !USE_XCB -/* Read and discard "n" 8-bit bytes of data */ - -void _XEatData( - Display *dpy, - register unsigned long n) -{ -#define SCRATCHSIZE 2048 - char buf[SCRATCHSIZE]; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) - fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n", - n, dpy->fd); -#endif - while (n > 0) { - register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n; - (void) _XRead (dpy, buf, bytes_read); - n -= bytes_read; - } -#undef SCRATCHSIZE -} - -/* - Port from libXfixes commit - b031e3b60fa1af9e49449f23d4a84395868be3ab We need this here to - enable linking of current libXrender against libNX_X11 instead of - the system's libX11 - - The original implementation of this function (libX11 commit - 9f5d83706543696fc944c1835a403938c06f2cc5) uses xcb stuff which we - do not have in libNX_X11. So we take a workaround from another - lib. This workaround had been implemented temporarily in a couple - of X libs, see e.g. https://lists.x.org/archives/xorg-devel/2013-July/036763.html. -*/ -#include /* for LONG64 on 64-bit platforms */ -#include - -void _XEatDataWords(Display *dpy, unsigned long n) -{ -#ifndef LONG64 - if (n >= (ULONG_MAX >> 2)) - _XIOError(dpy); -#endif - _XEatData (dpy, n << 2); -} -#endif /* !USE_XCB */ - -/* Cookie jar implementation - dpy->cookiejar is a linked list. _XEnq receives the events but leaves - them in the normal EQ. _XStoreEvent returns the cookie event (minus - data pointer) and adds it to the cookiejar. _XDeq just removes - the entry like any other event but resets the data pointer for - cookie events (to avoid double-free, the memory is re-used by Xlib). - - _XFetchEventCookie (called from XGetEventData) removes a cookie from the - jar. _XFreeEventCookies removes all unclaimed cookies from the jar - (called by XNextEvent). - - _XFreeDisplayStructure calls _XFreeEventCookies for each cookie in the - normal EQ. - */ - -#include "utlist.h" -struct stored_event { - XGenericEventCookie ev; - struct stored_event *prev; - struct stored_event *next; -}; - -Bool -_XIsEventCookie(Display *dpy, XEvent *ev) -{ - return (ev->xcookie.type == GenericEvent && - dpy->generic_event_vec[ev->xcookie.extension & 0x7F] != NULL); -} - -/** - * Free all events in the event list. - */ -void -_XFreeEventCookies(Display *dpy) -{ - struct stored_event **head, *e, *tmp; - - if (!dpy->cookiejar) - return; - - head = (struct stored_event**)&dpy->cookiejar; - - DL_FOREACH_SAFE(*head, e, tmp) { - if (dpy->cookiejar == e) - dpy->cookiejar = NULL; - XFree(e->ev.data); - XFree(e); - } -} - -/** - * Add an event to the display's event list. This event must be freed on the - * next call to XNextEvent(). - */ -void -_XStoreEventCookie(Display *dpy, XEvent *event) -{ - XGenericEventCookie* cookie = &event->xcookie; - struct stored_event **head, *add; - - if (!_XIsEventCookie(dpy, event)) - return; - - head = (struct stored_event**)(&dpy->cookiejar); - - add = Xmalloc(sizeof(struct stored_event)); - if (!add) { - ESET(ENOMEM); - _XIOError(dpy); - } - add->ev = *cookie; - DL_APPEND(*head, add); - cookie->data = NULL; /* don't return data yet, must be claimed */ -} - -/** - * Return the event with the given cookie and remove it from the list. - */ -Bool -_XFetchEventCookie(Display *dpy, XGenericEventCookie* ev) -{ - Bool ret = False; - struct stored_event **head, *event; - head = (struct stored_event**)&dpy->cookiejar; - - if (!_XIsEventCookie(dpy, (XEvent*)ev)) - return ret; - - DL_FOREACH(*head, event) { - if (event->ev.cookie == ev->cookie && - event->ev.extension == ev->extension && - event->ev.evtype == ev->evtype) { - *ev = event->ev; - DL_DELETE(*head, event); - Xfree(event); - ret = True; - break; - } - } - - return ret; -} - -Bool -_XCopyEventCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out) -{ - Bool ret = False; - int extension; - - if (!_XIsEventCookie(dpy, (XEvent*)in) || !out) - return ret; - - extension = in->extension & 0x7F; - - if (!dpy->generic_event_copy_vec[extension]) - return ret; - - ret = ((*dpy->generic_event_copy_vec[extension])(dpy, in, out)); - out->cookie = ret ? ++dpy->next_cookie : 0; - return ret; -} - - -/* - * _XEnq - Place event packets on the display's queue. - * note that no squishing of move events in V11, since there - * is pointer motion hints.... - */ -void _XEnq( - register Display *dpy, - register xEvent *event) -{ - register _XQEvent *qelt; - int type, extension; - - if ((qelt = dpy->qfree)) { - /* If dpy->qfree is non-NULL do this, else malloc a new one. */ - dpy->qfree = qelt->next; - } - else if ((qelt = Xmalloc(sizeof(_XQEvent))) == NULL) { - /* Malloc call failed! */ - ESET(ENOMEM); -#ifdef NX_TRANS_SOCKET - _XIOError(dpy); - - return; -#else - _XIOError(dpy); -#endif - } - qelt->next = NULL; - - type = event->u.u.type & 0177; - extension = ((xGenericEvent*)event)->extension; - - qelt->event.type = type; - /* If an extension has registered a generic_event_vec handler, then - * it can handle event cookies. Otherwise, proceed with the normal - * event handlers. - * - * If the generic_event_vec is called, qelt->event is a event cookie - * with the data pointer and the "free" pointer set. Data pointer is - * some memory allocated by the extension. - */ - if (type == GenericEvent && dpy->generic_event_vec[extension & 0x7F]) { - XGenericEventCookie *cookie = &qelt->event.xcookie; - (*dpy->generic_event_vec[extension & 0x7F])(dpy, cookie, event); - cookie->cookie = ++dpy->next_cookie; - - qelt->qserial_num = dpy->next_event_serial_num++; - if (dpy->tail) dpy->tail->next = qelt; - else dpy->head = qelt; - - dpy->tail = qelt; - dpy->qlen++; - } else if ((*dpy->event_vec[type])(dpy, &qelt->event, event)) { - qelt->qserial_num = dpy->next_event_serial_num++; - if (dpy->tail) dpy->tail->next = qelt; - else dpy->head = qelt; - - dpy->tail = qelt; - dpy->qlen++; - } else { - /* ignored, or stashed away for many-to-one compression */ - qelt->next = dpy->qfree; - dpy->qfree = qelt; - } -} - -/* - * _XDeq - Remove event packet from the display's queue. - */ -void _XDeq( - register Display *dpy, - register _XQEvent *prev, /* element before qelt */ - register _XQEvent *qelt) /* element to be unlinked */ -{ - if (prev) { - if ((prev->next = qelt->next) == NULL) - dpy->tail = prev; - } else { - /* no prev, so removing first elt */ - if ((dpy->head = qelt->next) == NULL) - dpy->tail = NULL; - } - qelt->qserial_num = 0; - qelt->next = dpy->qfree; - dpy->qfree = qelt; - dpy->qlen--; - - if (_XIsEventCookie(dpy, &qelt->event)) { - XGenericEventCookie* cookie = &qelt->event.xcookie; - /* dpy->qfree is re-used, reset memory to avoid double free on - * _XFreeDisplayStructure */ - cookie->data = NULL; - } -} - -/* - * EventToWire in separate file in that often not needed. - */ - -/*ARGSUSED*/ -Bool -_XUnknownWireEvent( - register Display *dpy, /* pointer to display structure */ - register XEvent *re, /* pointer to where event should be reformatted */ - register xEvent *event) /* wire protocol event */ -{ -#ifdef notdef - (void) fprintf(stderr, - "Xlib: unhandled wire event! event number = %d, display = %x\n.", - event->u.u.type, dpy); -#endif - return(False); -} - -Bool -_XUnknownWireEventCookie( - Display *dpy, /* pointer to display structure */ - XGenericEventCookie *re, /* pointer to where event should be reformatted */ - xEvent *event) /* wire protocol event */ -{ -#ifdef notdef - fprintf(stderr, - "Xlib: unhandled wire cookie event! extension number = %d, display = %x\n.", - ((xGenericEvent*)event)->extension, dpy); -#endif - return(False); -} - -Bool -_XUnknownCopyEventCookie( - Display *dpy, /* pointer to display structure */ - XGenericEventCookie *in, /* source */ - XGenericEventCookie *out) /* destination */ -{ -#ifdef notdef - fprintf(stderr, - "Xlib: unhandled cookie event copy! extension number = %d, display = %x\n.", - in->extension, dpy); -#endif - return(False); -} - -/*ARGSUSED*/ -Status -_XUnknownNativeEvent( - register Display *dpy, /* pointer to display structure */ - register XEvent *re, /* pointer to where event should be reformatted */ - register xEvent *event) /* wire protocol event */ -{ -#ifdef notdef - (void) fprintf(stderr, - "Xlib: unhandled native event! event number = %d, display = %x\n.", - re->type, dpy); -#endif - return(0); -} -/* - * reformat a wire event into an XEvent structure of the right type. - */ -Bool -_XWireToEvent( - register Display *dpy, /* pointer to display structure */ - register XEvent *re, /* pointer to where event should be reformatted */ - register xEvent *event) /* wire protocol event */ -{ - - re->type = event->u.u.type & 0x7f; - ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy, - (xGenericReply *)event); - ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); - ((XAnyEvent *)re)->display = dpy; - - /* Ignore the leading bit of the event type since it is set when a - client sends an event rather than the server. */ - - switch (event-> u.u.type & 0177) { - case KeyPress: - case KeyRelease: - { - register XKeyEvent *ev = (XKeyEvent*) re; - ev->root = event->u.keyButtonPointer.root; - ev->window = event->u.keyButtonPointer.event; - ev->subwindow = event->u.keyButtonPointer.child; - ev->time = event->u.keyButtonPointer.time; - ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); - ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); - ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); - ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); - ev->state = event->u.keyButtonPointer.state; - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->keycode = event->u.u.detail; - } - break; - case ButtonPress: - case ButtonRelease: - { - register XButtonEvent *ev = (XButtonEvent *) re; - ev->root = event->u.keyButtonPointer.root; - ev->window = event->u.keyButtonPointer.event; - ev->subwindow = event->u.keyButtonPointer.child; - ev->time = event->u.keyButtonPointer.time; - ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); - ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); - ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); - ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); - ev->state = event->u.keyButtonPointer.state; - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->button = event->u.u.detail; - } - break; - case MotionNotify: - { - register XMotionEvent *ev = (XMotionEvent *)re; - ev->root = event->u.keyButtonPointer.root; - ev->window = event->u.keyButtonPointer.event; - ev->subwindow = event->u.keyButtonPointer.child; - ev->time = event->u.keyButtonPointer.time; - ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); - ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); - ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); - ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); - ev->state = event->u.keyButtonPointer.state; - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->is_hint = event->u.u.detail; - } - break; - case EnterNotify: - case LeaveNotify: - { - register XCrossingEvent *ev = (XCrossingEvent *) re; - ev->root = event->u.enterLeave.root; - ev->window = event->u.enterLeave.event; - ev->subwindow = event->u.enterLeave.child; - ev->time = event->u.enterLeave.time; - ev->x = cvtINT16toInt(event->u.enterLeave.eventX); - ev->y = cvtINT16toInt(event->u.enterLeave.eventY); - ev->x_root = cvtINT16toInt(event->u.enterLeave.rootX); - ev->y_root = cvtINT16toInt(event->u.enterLeave.rootY); - ev->state = event->u.enterLeave.state; - ev->mode = event->u.enterLeave.mode; - ev->same_screen = (event->u.enterLeave.flags & - ELFlagSameScreen) && True; - ev->focus = (event->u.enterLeave.flags & - ELFlagFocus) && True; - ev->detail = event->u.u.detail; - } - break; - case FocusIn: - case FocusOut: - { - register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; - ev->window = event->u.focus.window; - ev->mode = event->u.focus.mode; - ev->detail = event->u.u.detail; - } - break; - case KeymapNotify: - { - register XKeymapEvent *ev = (XKeymapEvent *) re; - ev->window = None; - memcpy(&ev->key_vector[1], - (char *)((xKeymapEvent *) event)->map, - sizeof (((xKeymapEvent *) event)->map)); - } - break; - case Expose: - { - register XExposeEvent *ev = (XExposeEvent *) re; - ev->window = event->u.expose.window; - ev->x = event->u.expose.x; - ev->y = event->u.expose.y; - ev->width = event->u.expose.width; - ev->height = event->u.expose.height; - ev->count = event->u.expose.count; - } - break; - case GraphicsExpose: - { - register XGraphicsExposeEvent *ev = - (XGraphicsExposeEvent *) re; - ev->drawable = event->u.graphicsExposure.drawable; - ev->x = event->u.graphicsExposure.x; - ev->y = event->u.graphicsExposure.y; - ev->width = event->u.graphicsExposure.width; - ev->height = event->u.graphicsExposure.height; - ev->count = event->u.graphicsExposure.count; - ev->major_code = event->u.graphicsExposure.majorEvent; - ev->minor_code = event->u.graphicsExposure.minorEvent; - } - break; - case NoExpose: - { - register XNoExposeEvent *ev = (XNoExposeEvent *) re; - ev->drawable = event->u.noExposure.drawable; - ev->major_code = event->u.noExposure.majorEvent; - ev->minor_code = event->u.noExposure.minorEvent; - } - break; - case VisibilityNotify: - { - register XVisibilityEvent *ev = (XVisibilityEvent *) re; - ev->window = event->u.visibility.window; - ev->state = event->u.visibility.state; - } - break; - case CreateNotify: - { - register XCreateWindowEvent *ev = - (XCreateWindowEvent *) re; - ev->window = event->u.createNotify.window; - ev->parent = event->u.createNotify.parent; - ev->x = cvtINT16toInt(event->u.createNotify.x); - ev->y = cvtINT16toInt(event->u.createNotify.y); - ev->width = event->u.createNotify.width; - ev->height = event->u.createNotify.height; - ev->border_width = event->u.createNotify.borderWidth; - ev->override_redirect = event->u.createNotify.override; - } - break; - case DestroyNotify: - { - register XDestroyWindowEvent *ev = - (XDestroyWindowEvent *) re; - ev->window = event->u.destroyNotify.window; - ev->event = event->u.destroyNotify.event; - } - break; - case UnmapNotify: - { - register XUnmapEvent *ev = (XUnmapEvent *) re; - ev->window = event->u.unmapNotify.window; - ev->event = event->u.unmapNotify.event; - ev->from_configure = event->u.unmapNotify.fromConfigure; - } - break; - case MapNotify: - { - register XMapEvent *ev = (XMapEvent *) re; - ev->window = event->u.mapNotify.window; - ev->event = event->u.mapNotify.event; - ev->override_redirect = event->u.mapNotify.override; - } - break; - case MapRequest: - { - register XMapRequestEvent *ev = (XMapRequestEvent *) re; - ev->window = event->u.mapRequest.window; - ev->parent = event->u.mapRequest.parent; - } - break; - case ReparentNotify: - { - register XReparentEvent *ev = (XReparentEvent *) re; - ev->event = event->u.reparent.event; - ev->window = event->u.reparent.window; - ev->parent = event->u.reparent.parent; - ev->x = cvtINT16toInt(event->u.reparent.x); - ev->y = cvtINT16toInt(event->u.reparent.y); - ev->override_redirect = event->u.reparent.override; - } - break; - case ConfigureNotify: - { - register XConfigureEvent *ev = (XConfigureEvent *) re; - ev->event = event->u.configureNotify.event; - ev->window = event->u.configureNotify.window; - ev->above = event->u.configureNotify.aboveSibling; - ev->x = cvtINT16toInt(event->u.configureNotify.x); - ev->y = cvtINT16toInt(event->u.configureNotify.y); - ev->width = event->u.configureNotify.width; - ev->height = event->u.configureNotify.height; - ev->border_width = event->u.configureNotify.borderWidth; - ev->override_redirect = event->u.configureNotify.override; - } - break; - case ConfigureRequest: - { - register XConfigureRequestEvent *ev = - (XConfigureRequestEvent *) re; - ev->window = event->u.configureRequest.window; - ev->parent = event->u.configureRequest.parent; - ev->above = event->u.configureRequest.sibling; - ev->x = cvtINT16toInt(event->u.configureRequest.x); - ev->y = cvtINT16toInt(event->u.configureRequest.y); - ev->width = event->u.configureRequest.width; - ev->height = event->u.configureRequest.height; - ev->border_width = event->u.configureRequest.borderWidth; - ev->value_mask = event->u.configureRequest.valueMask; - ev->detail = event->u.u.detail; - } - break; - case GravityNotify: - { - register XGravityEvent *ev = (XGravityEvent *) re; - ev->window = event->u.gravity.window; - ev->event = event->u.gravity.event; - ev->x = cvtINT16toInt(event->u.gravity.x); - ev->y = cvtINT16toInt(event->u.gravity.y); - } - break; - case ResizeRequest: - { - register XResizeRequestEvent *ev = - (XResizeRequestEvent *) re; - ev->window = event->u.resizeRequest.window; - ev->width = event->u.resizeRequest.width; - ev->height = event->u.resizeRequest.height; - } - break; - case CirculateNotify: - { - register XCirculateEvent *ev = (XCirculateEvent *) re; - ev->window = event->u.circulate.window; - ev->event = event->u.circulate.event; - ev->place = event->u.circulate.place; - } - break; - case CirculateRequest: - { - register XCirculateRequestEvent *ev = - (XCirculateRequestEvent *) re; - ev->window = event->u.circulate.window; - ev->parent = event->u.circulate.event; - ev->place = event->u.circulate.place; - } - break; - case PropertyNotify: - { - register XPropertyEvent *ev = (XPropertyEvent *) re; - ev->window = event->u.property.window; - ev->atom = event->u.property.atom; - ev->time = event->u.property.time; - ev->state = event->u.property.state; - } - break; - case SelectionClear: - { - register XSelectionClearEvent *ev = - (XSelectionClearEvent *) re; - ev->window = event->u.selectionClear.window; - ev->selection = event->u.selectionClear.atom; - ev->time = event->u.selectionClear.time; - } - break; - case SelectionRequest: - { - register XSelectionRequestEvent *ev = - (XSelectionRequestEvent *) re; - ev->owner = event->u.selectionRequest.owner; - ev->requestor = event->u.selectionRequest.requestor; - ev->selection = event->u.selectionRequest.selection; - ev->target = event->u.selectionRequest.target; - ev->property = event->u.selectionRequest.property; - ev->time = event->u.selectionRequest.time; - } - break; - case SelectionNotify: - { - register XSelectionEvent *ev = (XSelectionEvent *) re; - ev->requestor = event->u.selectionNotify.requestor; - ev->selection = event->u.selectionNotify.selection; - ev->target = event->u.selectionNotify.target; - ev->property = event->u.selectionNotify.property; - ev->time = event->u.selectionNotify.time; - } - break; - case ColormapNotify: - { - register XColormapEvent *ev = (XColormapEvent *) re; - ev->window = event->u.colormap.window; - ev->colormap = event->u.colormap.colormap; - ev->new = event->u.colormap.new; - ev->state = event->u.colormap.state; - } - break; - case ClientMessage: - { - register int i; - register XClientMessageEvent *ev - = (XClientMessageEvent *) re; - ev->window = event->u.clientMessage.window; - ev->format = event->u.u.detail; - switch (ev->format) { - case 8: - ev->message_type = event->u.clientMessage.u.b.type; - for (i = 0; i < 20; i++) - ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; - break; - case 16: - ev->message_type = event->u.clientMessage.u.s.type; - ev->data.s[0] = cvtINT16toShort(event->u.clientMessage.u.s.shorts0); - ev->data.s[1] = cvtINT16toShort(event->u.clientMessage.u.s.shorts1); - ev->data.s[2] = cvtINT16toShort(event->u.clientMessage.u.s.shorts2); - ev->data.s[3] = cvtINT16toShort(event->u.clientMessage.u.s.shorts3); - ev->data.s[4] = cvtINT16toShort(event->u.clientMessage.u.s.shorts4); - ev->data.s[5] = cvtINT16toShort(event->u.clientMessage.u.s.shorts5); - ev->data.s[6] = cvtINT16toShort(event->u.clientMessage.u.s.shorts6); - ev->data.s[7] = cvtINT16toShort(event->u.clientMessage.u.s.shorts7); - ev->data.s[8] = cvtINT16toShort(event->u.clientMessage.u.s.shorts8); - ev->data.s[9] = cvtINT16toShort(event->u.clientMessage.u.s.shorts9); - break; - case 32: - ev->message_type = event->u.clientMessage.u.l.type; - ev->data.l[0] = cvtINT32toLong(event->u.clientMessage.u.l.longs0); - ev->data.l[1] = cvtINT32toLong(event->u.clientMessage.u.l.longs1); - ev->data.l[2] = cvtINT32toLong(event->u.clientMessage.u.l.longs2); - ev->data.l[3] = cvtINT32toLong(event->u.clientMessage.u.l.longs3); - ev->data.l[4] = cvtINT32toLong(event->u.clientMessage.u.l.longs4); - break; - default: /* XXX should never occur */ - break; - } - } - break; - case MappingNotify: - { - register XMappingEvent *ev = (XMappingEvent *)re; - ev->window = 0; - ev->first_keycode = event->u.mappingNotify.firstKeyCode; - ev->request = event->u.mappingNotify.request; - ev->count = event->u.mappingNotify.count; - } - break; - default: - return(_XUnknownWireEvent(dpy, re, event)); - } - return(True); -} - - -/* - * _XDefaultIOError - Default fatal system error reporting routine. Called - * when an X internal system error is encountered. - */ -int _XDefaultIOError( - Display *dpy) -{ - if (ECHECK(EPIPE)) { - (void) fprintf (stderr, - "X connection to %s broken (explicit kill or server shutdown).\r\n", - DisplayString (dpy)); - } else { - (void) fprintf (stderr, - "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", -#ifdef WIN32 - WSAGetLastError(), strerror(WSAGetLastError()), -#else - errno, strerror (errno), -#endif - DisplayString (dpy)); - (void) fprintf (stderr, - " after %lu requests (%lu known processed) with %d events remaining.\r\n", - NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), - QLength(dpy)); - - } -#ifdef NX_TRANS_SOCKET - if (_NXHandleDisplayError == 1) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XDefaultIOError: Going to return from the error handler.\n"); -#endif - return 0; - } - else - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XDefaultIOError: Going to exit from the program.\n"); -#endif -#ifdef NX_TRANS_EXIT - NXTransExit(1); -#else - exit(1); -#endif - } -#else - exit(1); -#endif /* #ifdef NX_TRANS_SOCKET */ - /*NOTREACHED*/ -} - - -static int _XPrintDefaultError( - Display *dpy, - XErrorEvent *event, - FILE *fp) -{ - char buffer[BUFSIZ]; - char mesg[BUFSIZ]; - char number[32]; - const char *mtype = "XlibMessage"; - register _XExtension *ext = (_XExtension *)NULL; - _XExtension *bext = (_XExtension *)NULL; - XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); - XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); - (void) fprintf(fp, "%s: %s\n ", mesg, buffer); - XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", - mesg, BUFSIZ); - (void) fprintf(fp, mesg, event->request_code); - if (event->request_code < 128) { - snprintf(number, sizeof(number), "%d", event->request_code); - XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); - } else { - for (ext = dpy->ext_procs; - ext && (ext->codes.major_opcode != event->request_code); - ext = ext->next) - ; - if (ext) { - strncpy(buffer, ext->name, BUFSIZ); - buffer[BUFSIZ - 1] = '\0'; - } else - buffer[0] = '\0'; - } - (void) fprintf(fp, " (%s)\n", buffer); - if (event->request_code >= 128) { - XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->minor_code); - if (ext) { - snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); - XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); - (void) fprintf(fp, " (%s)", buffer); - } - fputs("\n", fp); - } - if (event->error_code >= 128) { - /* kludge, try to find the extension that caused it */ - buffer[0] = '\0'; - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_string) - (*ext->error_string)(dpy, event->error_code, &ext->codes, - buffer, BUFSIZ); - if (buffer[0]) { - bext = ext; - break; - } - if (ext->codes.first_error && - ext->codes.first_error < (int)event->error_code && - (!bext || ext->codes.first_error > bext->codes.first_error)) - bext = ext; - } - if (bext) - snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, - event->error_code - bext->codes.first_error); - else - strcpy(buffer, "Value"); - XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); - if (mesg[0]) { - fputs(" ", fp); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n", fp); - } - /* let extensions try to print the values */ - for (ext = dpy->ext_procs; ext; ext = ext->next) { - if (ext->error_values) - (*ext->error_values)(dpy, event, fp); - } - } else if ((event->error_code == BadWindow) || - (event->error_code == BadPixmap) || - (event->error_code == BadCursor) || - (event->error_code == BadFont) || - (event->error_code == BadDrawable) || - (event->error_code == BadColor) || - (event->error_code == BadGC) || - (event->error_code == BadIDChoice) || - (event->error_code == BadValue) || - (event->error_code == BadAtom)) { - if (event->error_code == BadValue) - XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", - mesg, BUFSIZ); - else if (event->error_code == BadAtom) - XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", - mesg, BUFSIZ); - else - XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->resourceid); - fputs("\n", fp); - } - XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", - mesg, BUFSIZ); - fputs(" ", fp); - (void) fprintf(fp, mesg, event->serial); - XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", - mesg, BUFSIZ); - fputs("\n ", fp); - (void) fprintf(fp, mesg, dpy->request); - fputs("\n", fp); - if (event->error_code == BadImplementation) return 0; - return 1; -} - -int _XDefaultError( - Display *dpy, - XErrorEvent *event) -{ - if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0; - - /* - * Store in dpy flags that the client is exiting on an unhandled XError - * (pretend it is an IOError, since the application is dying anyway it - * does not make a difference). - * This is useful for _XReply not to hang if the application makes Xlib - * calls in _fini as part of process termination. - */ - dpy->flags |= XlibDisplayIOError; - - exit(1); - /*NOTREACHED*/ -} - -/*ARGSUSED*/ -Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we) -{ - return True; -} - -/* - * _XError - upcall internal or user protocol error handler - */ -int _XError ( - Display *dpy, - register xError *rep) -{ - /* - * X_Error packet encountered! We need to unpack the error before - * giving it to the user. - */ - XEvent event; /* make it a large event */ - register _XAsyncHandler *async, *next; - - event.xerror.serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); - - for (async = dpy->async_handlers; async; async = next) { - next = async->next; - if ((*async->handler)(dpy, (xReply *)rep, - (char *)rep, SIZEOF(xError), async->data)) - return 0; - } - - event.xerror.display = dpy; - event.xerror.type = X_Error; - event.xerror.resourceid = rep->resourceID; - event.xerror.error_code = rep->errorCode; - event.xerror.request_code = rep->majorCode; - event.xerror.minor_code = rep->minorCode; - if (dpy->error_vec && - !(*dpy->error_vec[rep->errorCode])(dpy, &event.xerror, rep)) - return 0; - if (_XErrorFunction != NULL) { - int rtn_val; -#if defined(XTHREADS) && !USE_XCB - if (dpy->lock) - (*dpy->lock->user_lock_display)(dpy); - UnlockDisplay(dpy); -#endif /* XTHREADS && !USE_XCB */ - rtn_val = (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */ -#if defined(XTHREADS) && !USE_XCB - LockDisplay(dpy); - if (dpy->lock) - (*dpy->lock->user_unlock_display)(dpy); -#endif /* XTHREADS && !USE_XCB */ - return rtn_val; - } else { - return _XDefaultError(dpy, (XErrorEvent *)&event); - } -} - -/* - * _XIOError - call user connection error handler and exit - */ -int -_XIOError ( - Display *dpy) -{ - dpy->flags |= XlibDisplayIOError; -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - - /* This assumes that the thread calling exit will call any atexit handlers. - * If this does not hold, then an alternate solution would involve - * registering an atexit handler to take over the lock, which would only - * assume that the same thread calls all the atexit handlers. */ -#ifdef XTHREADS - if (dpy->lock) - (*dpy->lock->user_lock_display)(dpy); -#endif - UnlockDisplay(dpy); - - if (_XIOErrorFunction != NULL) - (*_XIOErrorFunction)(dpy); - else - _XDefaultIOError(dpy); -#ifdef NX_TRANS_SOCKET - /* - * Check if we are supposed to return in the case - * of a display failure. The client which originated - * the X operation will have to check the value of - * the XlibDisplayIOError flag and handle appropria- - * tely the display disconnection. - */ - - if (_NXHandleDisplayError == 0) - { -#ifdef NX_TRANS_EXIT - NXTransExit(1); -#else - exit(1); -#endif - } - - /* - * We are going to return. Reset the display - * buffers. Further writes will be discarded. - */ - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XIOError: Resetting the display buffer.\n"); -#endif - - dpy->bufptr = dpy->buffer; - dpy->last_req = (char *) &_dummy_request; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_XIOError: Resetting the display flags.\n"); -#endif - - dpy->flags &= ~XlibDisplayProcConni; - dpy->flags &= ~XlibDisplayPrivSync; - dpy->flags &= ~XlibDisplayReadEvents; - dpy->flags &= ~XlibDisplayWriting; - dpy->flags &= ~XlibDisplayReply; - /* shut up the compiler by returning something */ - return 0; -#else - exit (1); -#endif - /*NOTREACHED*/ -} - - -/* - * This routine can be used to (cheaply) get some memory within a single - * Xlib routine for scratch space. A single buffer is reused each time - * if possible. To be MT safe, you can only call this between a call to - * GetReq* and a call to Data* or _XSend*, or in a context when the thread - * is guaranteed to not unlock the display. - */ -char *_XAllocScratch( - register Display *dpy, - unsigned long nbytes) -{ - if (nbytes > dpy->scratch_length) { - Xfree (dpy->scratch_buffer); - dpy->scratch_buffer = Xmalloc(nbytes); - if (dpy->scratch_buffer) - dpy->scratch_length = nbytes; - else dpy->scratch_length = 0; - } - return (dpy->scratch_buffer); -} - -/* - * Scratch space allocator you can call any time, multiple times, and be - * MT safe, but you must hand the buffer back with _XFreeTemp. - */ -char *_XAllocTemp( - register Display *dpy, - unsigned long nbytes) -{ - char *buf; - - buf = _XAllocScratch(dpy, nbytes); - dpy->scratch_buffer = NULL; - dpy->scratch_length = 0; - return buf; -} - -void _XFreeTemp( - register Display *dpy, - char *buf, - unsigned long nbytes) -{ - - Xfree(dpy->scratch_buffer); - dpy->scratch_buffer = buf; - dpy->scratch_length = nbytes; -} - -/* - * Given a visual id, find the visual structure for this id on this display. - */ -Visual *_XVIDtoVisual( - Display *dpy, - VisualID id) -{ - register int i, j, k; - register Screen *sp; - register Depth *dp; - register Visual *vp; - for (i = 0; i < dpy->nscreens; i++) { - sp = &dpy->screens[i]; - for (j = 0; j < sp->ndepths; j++) { - dp = &sp->depths[j]; - /* if nvisuals == 0 then visuals will be NULL */ - for (k = 0; k < dp->nvisuals; k++) { - vp = &dp->visuals[k]; - if (vp->visualid == id) return (vp); - } - } - } - return (NULL); -} - -int -XFree (void *data) -{ - Xfree (data); - return 1; -} - -#ifdef _XNEEDBCOPYFUNC -void _Xbcopy(b1, b2, length) - register char *b1, *b2; - register length; -{ - if (b1 < b2) { - b2 += length; - b1 += length; - while (length--) - *--b2 = *--b1; - } else { - while (length--) - *b2++ = *b1++; - } -} -#endif - -#ifdef DataRoutineIsProcedure -void Data( - Display *dpy, - _Xconst char *data, - long len) -{ - if (dpy->bufptr + (len) <= dpy->bufmax) { - memcpy(dpy->bufptr, data, (int)len); - dpy->bufptr += ((len) + 3) & ~3; - } else { - _XSend(dpy, data, len); - } -} -#endif /* DataRoutineIsProcedure */ - - -#ifdef LONG64 -int -_XData32( - Display *dpy, - register _Xconst long *data, - unsigned len) -{ - register int *buf; - register long i; - - while (len) { - buf = (int *)dpy->bufptr; - i = dpy->bufmax - (char *)buf; - if (!i) { - _XFlush(dpy); - continue; - } - if (len < i) - i = len; - dpy->bufptr = (char *)buf + i; - len -= i; - i >>= 2; - while (--i >= 0) - *buf++ = *data++; - } - return 0; -} -#endif /* LONG64 */ - - - -/* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. - * Otherwise, Xau will not be able to find your cookies in the Xauthority file. - * - * Note: POSIX says that the ``nodename'' member of utsname does _not_ have - * to have sufficient information for interfacing to the network, - * and so, you may be better off using gethostname (if it exists). - */ - -#if defined(_POSIX_SOURCE) || defined(SVR4) -#define NEED_UTSNAME -#include -#else -#ifdef HAVE_UNISTD_H -#include -#endif -#endif - -/* - * _XGetHostname - similar to gethostname but allows special processing. - */ -int _XGetHostname ( - char *buf, - int maxlen) -{ - int len; - -#ifdef NEED_UTSNAME - struct utsname name; - - if (maxlen <= 0 || buf == NULL) - return 0; - - uname (&name); - len = strlen (name.nodename); - if (len >= maxlen) len = maxlen - 1; - strncpy (buf, name.nodename, len); - buf[len] = '\0'; -#else - if (maxlen <= 0 || buf == NULL) - return 0; - - buf[0] = '\0'; - (void) gethostname (buf, maxlen); - buf [maxlen - 1] = '\0'; - len = strlen(buf); -#endif /* NEED_UTSNAME */ - return len; -} - - -/* - * _XScreenOfWindow - get the Screen of a given window - */ - -Screen *_XScreenOfWindow(Display *dpy, Window w) -{ - register int i; - Window root; - int x, y; /* dummy variables */ - unsigned int width, height, bw, depth; /* dummy variables */ - - if (XGetGeometry (dpy, w, &root, &x, &y, &width, &height, - &bw, &depth) == False) { - return NULL; - } - for (i = 0; i < ScreenCount (dpy); i++) { /* find root from list */ - if (root == RootWindow (dpy, i)) { - return ScreenOfDisplay (dpy, i); - } - } - return NULL; -} - -/* - * WARNING: This implementation's pre-conditions and post-conditions - * must remain compatible with the old macro-based implementations of - * GetReq, GetReqExtra, GetResReq, and GetEmptyReq. The portions of the - * Display structure affected by those macros are part of libX11's - * ABI. - */ -void *_XGetRequest(Display *dpy, CARD8 type, size_t len) -{ - xReq *req; - - if (dpy->bufptr + len > dpy->bufmax) - _XFlush(dpy); - /* Request still too large, so do not allow it to overflow. */ - if (dpy->bufptr + len > dpy->bufmax) { - fprintf(stderr, - "Xlib: request %d length %zd would exceed buffer size.\n", - type, len); - /* Changes failure condition from overflow to NULL dereference. */ - return NULL; - } - - if (len % 4) - fprintf(stderr, - "Xlib: request %d length %zd not a multiple of 4.\n", - type, len); - - dpy->last_req = dpy->bufptr; - - req = (xReq*)dpy->bufptr; - req->reqType = type; - req->length = len / 4; - dpy->bufptr += len; - dpy->request++; - return req; -} - -#if defined(WIN32) - -/* - * These functions are intended to be used internally to Xlib only. - * These functions will always prefix the path with a DOS drive in the - * form ":". As such, these functions are only suitable - * for use by Xlib function that supply a root-based path to some - * particular file, e.g. /lib/X11/locale/locale.dir will - * be converted to "C:/usr/X11R6.3/lib/X11/locale/locale.dir". - */ - -static int access_file (path, pathbuf, len_pathbuf, pathret) - char* path; - char* pathbuf; - int len_pathbuf; - char** pathret; -{ - if (access (path, F_OK) == 0) { - if (strlen (path) < len_pathbuf) - *pathret = pathbuf; - else - *pathret = Xmalloc (strlen (path) + 1); - if (*pathret) { - strcpy (*pathret, path); - return 1; - } - } - return 0; -} - -static int AccessFile (path, pathbuf, len_pathbuf, pathret) - char* path; - char* pathbuf; - int len_pathbuf; - char** pathret; -{ - unsigned long drives; - int i, len; - char* drive; - char buf[MAX_PATH]; - char* bufp; - - /* just try the "raw" name first and see if it works */ - if (access_file (path, pathbuf, len_pathbuf, pathret)) - return 1; - - /* try the places set in the environment */ - drive = getenv ("_XBASEDRIVE"); - if (!drive) - drive = "C:"; - len = strlen (drive) + strlen (path); - if (len < MAX_PATH) bufp = buf; - else bufp = Xmalloc (len + 1); - strcpy (bufp, drive); - strcat (bufp, path); - if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { - if (bufp != buf) Xfree (bufp); - return 1; - } - - /* one last place to look */ - drive = getenv ("HOMEDRIVE"); - if (drive) { - len = strlen (drive) + strlen (path); - if (len < MAX_PATH) bufp = buf; - else bufp = Xmalloc (len + 1); - strcpy (bufp, drive); - strcat (bufp, path); - if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { - if (bufp != buf) Xfree (bufp); - return 1; - } - } - - /* tried everywhere else, go fishing */ -#define C_DRIVE ('C' - 'A') -#define Z_DRIVE ('Z' - 'A') - /* does OS/2 (with or with gcc-emx) have getdrives? */ - drives = _getdrives (); - for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */ - if ((1 << i) & drives) { - len = 2 + strlen (path); - if (len < MAX_PATH) bufp = buf; - else bufp = Xmalloc (len + 1); - *bufp = 'A' + i; - *(bufp + 1) = ':'; - *(bufp + 2) = '\0'; - strcat (bufp, path); - if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { - if (bufp != buf) Xfree (bufp); - return 1; - } - } - } - return 0; -} - -int _XOpenFile(path, flags) - _Xconst char* path; - int flags; -{ - char buf[MAX_PATH]; - char* bufp = NULL; - int ret = -1; - UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); - - if (AccessFile (path, buf, MAX_PATH, &bufp)) - ret = open (bufp, flags); - - (void) SetErrorMode (olderror); - - if (bufp != buf) Xfree (bufp); - - return ret; -} - -int _XOpenFileMode(path, flags, mode) - _Xconst char* path; - int flags; - mode_t mode; -{ - char buf[MAX_PATH]; - char* bufp = NULL; - int ret = -1; - UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); - - if (AccessFile (path, buf, MAX_PATH, &bufp)) - ret = open (bufp, flags, mode); - - (void) SetErrorMode (olderror); - - if (bufp != buf) Xfree (bufp); - - return ret; -} - -void* _XFopenFile(path, mode) - _Xconst char* path; - _Xconst char* mode; -{ - char buf[MAX_PATH]; - char* bufp = NULL; - void* ret = NULL; - UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); - - if (AccessFile (path, buf, MAX_PATH, &bufp)) - ret = fopen (bufp, mode); - - (void) SetErrorMode (olderror); - - if (bufp != buf) Xfree (bufp); - - return ret; -} - -int _XAccessFile(path) - _Xconst char* path; -{ - char buf[MAX_PATH]; - char* bufp; - int ret = -1; - UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); - - ret = AccessFile (path, buf, MAX_PATH, &bufp); - - (void) SetErrorMode (olderror); - - if (bufp != buf) Xfree (bufp); - - return ret; -} - -#endif - -#ifdef WIN32 -#undef _Xdebug -int _Xdebug = 0; -int *_Xdebug_p = &_Xdebug; -void (**_XCreateMutex_fn_p)(LockInfoPtr) = &_XCreateMutex_fn; -void (**_XFreeMutex_fn_p)(LockInfoPtr) = &_XFreeMutex_fn; -void (**_XLockMutex_fn_p)(LockInfoPtr -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif - ) = &_XLockMutex_fn; -void (**_XUnlockMutex_fn_p)(LockInfoPtr -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif - ) = &_XUnlockMutex_fn; -LockInfoPtr *_Xglobal_lock_p = &_Xglobal_lock; -#endif diff --git a/nx-X11/lib/X11/Xlibint.h b/nx-X11/lib/X11/Xlibint.h deleted file mode 100644 index b325182e3..000000000 --- a/nx-X11/lib/X11/Xlibint.h +++ /dev/null @@ -1,1361 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - -Copyright 1984, 1985, 1987, 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#if !defined(_X11_XLIBINT_H_) && !defined(_XLIBINT_H_) -#define _X11_XLIBINT_H_ -#define _XLIBINT_H_ - -/* - * Xlibint.h - Header definition and support file for the internal - * support routines used by the C subroutine interface - * library (Xlib) to the X Window System. - * - * Warning, there be dragons here.... - */ - -#include -#include /* to declare xEvent */ -#include /* for configured options like XTHREADS */ - -/* The Xlib structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -#ifdef NX_TRANS_SOCKET - -#include - -#define _XGetIOError(dpy) \ - (dpy -> flags & XlibDisplayIOError) - -#endif - -#ifdef WIN32 -#define _XFlush _XFlushIt -#endif - -struct _XGC -{ - XExtData *ext_data; /* hook for extension to hang data */ - GContext gid; /* protocol ID for graphics context */ - Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ - Bool dashes; /* boolean: TRUE if dash-list is really a list */ - unsigned long dirty;/* cache dirty bits */ - XGCValues values; /* shadow structure of values */ -}; - -struct _XDisplay -{ - XExtData *ext_data; /* hook for extension to hang data */ - struct _XFreeFuncs *free_funcs; /* internal free functions */ - int fd; /* Network socket. */ - int conn_checker; /* ugly thing used by _XEventsQueued */ - int proto_major_version;/* maj. version of server's X protocol */ - int proto_minor_version;/* minor version of server's X protocol */ - char *vendor; /* vendor of the server hardware */ - XID resource_base; /* resource ID base */ - XID resource_mask; /* resource ID mask bits */ - XID resource_id; /* allocator current ID */ - int resource_shift; /* allocator shift to correct bits */ - XID (*resource_alloc)( /* allocator function */ - struct _XDisplay* - ); - int byte_order; /* screen byte order, LSBFirst, MSBFirst */ - int bitmap_unit; /* padding and data requirements */ - int bitmap_pad; /* padding requirements on bitmaps */ - int bitmap_bit_order; /* LeastSignificant or MostSignificant */ - int nformats; /* number of pixmap formats in list */ - ScreenFormat *pixmap_format; /* pixmap format list */ - int vnumber; /* Xlib's X protocol version number. */ - int release; /* release of the server */ - struct _XSQEvent *head, *tail; /* Input event queue. */ - int qlen; /* Length of input event queue */ - unsigned long last_request_read; /* seq number of last event read */ - unsigned long request; /* sequence number of last request. */ - char *last_req; /* beginning of last request, or dummy */ - char *buffer; /* Output buffer starting address. */ - char *bufptr; /* Output buffer index pointer. */ - char *bufmax; /* Output buffer maximum+1 address. */ - unsigned max_request_size; /* maximum number 32 bit words in request*/ - struct _XrmHashBucketRec *db; - int (*synchandler)( /* Synchronization handler */ - struct _XDisplay* - ); - char *display_name; /* "host:display" string used on this connect*/ - int default_screen; /* default screen for operations */ - int nscreens; /* number of screens on this server*/ - Screen *screens; /* pointer to list of screens */ - unsigned long motion_buffer; /* size of motion buffer */ - volatile unsigned long flags; /* internal connection flags */ - int min_keycode; /* minimum defined keycode */ - int max_keycode; /* maximum defined keycode */ - KeySym *keysyms; /* This server's keysyms */ - XModifierKeymap *modifiermap; /* This server's modifier keymap */ - int keysyms_per_keycode;/* number of rows */ - char *xdefaults; /* contents of defaults from server */ - char *scratch_buffer; /* place to hang scratch buffer */ - unsigned long scratch_length; /* length of scratch buffer */ - int ext_number; /* extension number on this display */ - struct _XExten *ext_procs; /* extensions initialized on this display */ - /* - * the following can be fixed size, as the protocol defines how - * much address space is available. - * While this could be done using the extension vector, there - * may be MANY events processed, so a search through the extension - * list to find the right procedure for each event might be - * expensive if many extensions are being used. - */ - Bool (*event_vec[128])( /* vector for wire to event */ - Display * /* dpy */, - XEvent * /* re */, - xEvent * /* event */ - ); - Status (*wire_vec[128])( /* vector for event to wire */ - Display * /* dpy */, - XEvent * /* re */, - xEvent * /* event */ - ); - KeySym lock_meaning; /* for XLookupString */ - struct _XLockInfo *lock; /* multi-thread state, display lock */ - struct _XInternalAsync *async_handlers; /* for internal async */ - unsigned long bigreq_size; /* max size of big requests */ - struct _XLockPtrs *lock_fns; /* pointers to threads functions */ - void (*idlist_alloc)( /* XID list allocator function */ - Display * /* dpy */, - XID * /* ids */, - int /* count */ - ); - /* things above this line should not move, for binary compatibility */ - struct _XKeytrans *key_bindings; /* for XLookupString */ - Font cursor_font; /* for XCreateFontCursor */ - struct _XDisplayAtoms *atoms; /* for XInternAtom */ - unsigned int mode_switch; /* keyboard group modifiers */ - unsigned int num_lock; /* keyboard numlock modifiers */ - struct _XContextDB *context_db; /* context database */ - Bool (**error_vec)( /* vector for wire to error */ - Display * /* display */, - XErrorEvent * /* he */, - xError * /* we */ - ); - /* - * Xcms information - */ - struct { - XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */ - XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */ - XPointer perVisualIntensityMaps; - /* linked list of XcmsIntensityMap */ - } cms; - struct _XIMFilter *im_filters; - struct _XSQEvent *qfree; /* unallocated event queue elements */ - unsigned long next_event_serial_num; /* inserted into next queue elt */ - struct _XExten *flushes; /* Flush hooks */ - struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */ - int im_fd_length; /* number of im_fd_info */ - struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */ - int watcher_count; /* number of conn_watchers */ - XPointer filedes; /* struct pollfd cache for _XWaitForReadable */ - int (*savedsynchandler)( /* user synchandler when Xlib usurps */ - Display * /* dpy */ - ); - XID resource_max; /* allocator max ID */ - int xcmisc_opcode; /* major opcode for XC-MISC */ - struct _XkbInfoRec *xkb_info; /* XKB info */ - struct _XtransConnInfo *trans_conn; /* transport connection object */ - struct _X11XCBPrivate *xcb; /* XCB glue private data */ - - /* Generic event cookie handling */ - unsigned int next_cookie; /* next event cookie */ - /* vector for wire to generic event, index is (extension - 128) */ - Bool (*generic_event_vec[128])( - Display * /* dpy */, - XGenericEventCookie * /* Xlib event */, - xEvent * /* wire event */); - /* vector for event copy, index is (extension - 128) */ - Bool (*generic_event_copy_vec[128])( - Display * /* dpy */, - XGenericEventCookie * /* in */, - XGenericEventCookie * /* out*/); - void *cookiejar; /* cookie events returned but not claimed */ -}; - -#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) - -#ifndef _XEVENT_ -/* - * _QEvent datatype for use in input queueing. - */ -typedef struct _XSQEvent -{ - struct _XSQEvent *next; - XEvent event; - unsigned long qserial_num; /* so multi-threaded code can find new ones */ -} _XQEvent; -#endif - -#include -#include -#define _XBCOPYFUNC _Xbcopy -#include -#include - -/* Utek leaves kernel macros around in include files (bleah) */ -#ifdef dirty -#undef dirty -#endif - -#include -#include - -#include - -_XFUNCPROTOBEGIN - -/* - * The following definitions can be used for locking requests in multi-threaded - * address spaces. - */ -#ifdef XTHREADS -/* Author: Stephen Gildea, MIT X Consortium - * - * declarations for C Threads locking - */ - -typedef struct _LockInfoRec *LockInfoPtr; - -/* interfaces for locking.c */ -struct _XLockPtrs { - /* used by all, including extensions; do not move */ - void (*lock_display)( - Display *dpy -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char *file - , int line -#endif - ); - void (*unlock_display)( - Display *dpy -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char *file - , int line -#endif - ); -}; - -#if defined(WIN32) && !defined(_XLIBINT_) -#define _XCreateMutex_fn (*_XCreateMutex_fn_p) -#define _XFreeMutex_fn (*_XFreeMutex_fn_p) -#define _XLockMutex_fn (*_XLockMutex_fn_p) -#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) -#define _Xglobal_lock (*_Xglobal_lock_p) -#endif - -/* in XlibInt.c */ -extern void (*_XCreateMutex_fn)( - LockInfoPtr /* lock */ -); -extern void (*_XFreeMutex_fn)( - LockInfoPtr /* lock */ -); -extern void (*_XLockMutex_fn)( - LockInfoPtr /* lock */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif -); -extern void (*_XUnlockMutex_fn)( - LockInfoPtr /* lock */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char * /* file */ - , int /* line */ -#endif -); - -extern LockInfoPtr _Xglobal_lock; - -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__) -#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__) -#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) -#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) -#else -/* used everywhere, so must be fast if not using threads */ -#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d) -#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d) -#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) -#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) -#endif -#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock); -#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); - -#else /* XTHREADS */ -#define LockDisplay(dis) -#define _XLockMutex(lock) -#define _XUnlockMutex(lock) -#define UnlockDisplay(dis) -#define _XCreateMutex(lock) -#define _XFreeMutex(lock) -#endif - -#define Xfree(ptr) free((ptr)) - -/* - * Note that some machines do not return a valid pointer for malloc(0), in - * which case we provide an alternate under the control of the - * define MALLOC_0_RETURNS_NULL. This is necessary because some - * Xlib code expects malloc(0) to return a valid pointer to storage. - */ -#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__) - -# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size))) -# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) -# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize)) - -#else - -# define Xmalloc(size) malloc((size)) -# define Xrealloc(ptr, size) realloc((ptr), (size)) -# define Xcalloc(nelem, elsize) calloc((nelem), (elsize)) - -#endif - -#include - -#define LOCKED 1 -#define UNLOCKED 0 - -#ifdef NX_TRANS_SOCKET -#ifndef BUFSIZE /* Output buffer size is configurable */ -#define BUFSIZE 8192 /* but this is still used for reading. */ -#endif -#else -#ifndef BUFSIZE -#define BUFSIZE 2048 /* X output buffer size. */ -#endif -#endif -#ifndef PTSPERBATCH -#define PTSPERBATCH 1024 /* point batching */ -#endif -#ifndef WLNSPERBATCH -#define WLNSPERBATCH 50 /* wide line batching */ -#endif -#ifndef ZLNSPERBATCH -#define ZLNSPERBATCH 1024 /* thin line batching */ -#endif -#ifndef WRCTSPERBATCH -#define WRCTSPERBATCH 10 /* wide line rectangle batching */ -#endif -#ifndef ZRCTSPERBATCH -#define ZRCTSPERBATCH 256 /* thin line rectangle batching */ -#endif -#ifndef FRCTSPERBATCH -#define FRCTSPERBATCH 256 /* filled rectangle batching */ -#endif -#ifndef FARCSPERBATCH -#define FARCSPERBATCH 256 /* filled arc batching */ -#endif -#ifndef CURSORFONT -#define CURSORFONT "cursor" /* standard cursor fonts */ -#endif - -/* - * Display flags - */ -#define XlibDisplayIOError (1L << 0) -#define XlibDisplayClosing (1L << 1) -#define XlibDisplayNoXkb (1L << 2) -#define XlibDisplayPrivSync (1L << 3) -#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ -#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ -#define XlibDisplayReply (1L << 5) /* in _XReply */ -#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ -#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ - -/* - * X Protocol packetizing macros. - */ - -/* Leftover from CRAY support - was defined empty on all non-Cray systems */ -#define WORD64ALIGN - -/** - * Return a len-sized request buffer for the request type. This function may - * flush the output queue. - * - * @param dpy The display connection - * @param type The request type - * @param len Length of the request in bytes - * - * @returns A pointer to the request buffer with a few default values - * initialized. - */ -extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); - -/* GetReqSized is the same as GetReq but allows the caller to specify the - * size in bytes. 'sz' must be a multiple of 4! */ - -#define GetReqSized(name, sz, req) \ - req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) - -/* - * GetReq - Get the next available X request packet in the buffer and - * return it. - * - * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. - * "req" is the name of the request pointer. - * - */ - -#define GetReq(name, req) \ - GetReqSized(name, SIZEOF(x##name##Req), req) - -/* GetReqExtra is the same as GetReq, but allocates "n" additional - bytes after the request. "n" must be a multiple of 4! */ - -#define GetReqExtra(name, n, req) \ - GetReqSized(name, SIZEOF(x##name##Req) + n, req) - -/* - * GetResReq is for those requests that have a resource ID - * (Window, Pixmap, GContext, etc.) as their single argument. - * "rid" is the name of the resource. - */ - -#define GetResReq(name, rid, req) \ - req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ - req->id = (rid) - -/* - * GetEmptyReq is for those requests that have no arguments - * at all. - */ -#define GetEmptyReq(name, req) \ - req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) - -/* - * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 - * length, after req->length, before the data in the request. The new length - * includes the "n" extra 32-bit words. - * - * Do not use MakeBigReq if there is no data already in the request. - * req->length must already be >= 2. - */ -#ifdef LONG64 -#define MakeBigReq(req,n) \ - { \ - CARD64 _BRdat; \ - CARD32 _BRlen = req->length - 1; \ - req->length = 0; \ - _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ - ((CARD32 *)req)[1] = _BRlen + n + 2; \ - Data32(dpy, &_BRdat, 4); \ - } -#else -#define MakeBigReq(req,n) \ - { \ - CARD32 _BRdat; \ - CARD32 _BRlen = req->length - 1; \ - req->length = 0; \ - _BRdat = ((CARD32 *)req)[_BRlen]; \ - memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ - ((CARD32 *)req)[1] = _BRlen + n + 2; \ - Data32(dpy, &_BRdat, 4); \ - } -#endif - -/* - * SetReqLen increases the count of 32-bit words in the request by "n", - * or by "badlen" if "n" is too large. - * - * Do not use SetReqLen if "req" does not already have data after the - * xReq header. req->length must already be >= 2. - */ -#ifndef __clang_analyzer__ -#define SetReqLen(req,n,badlen) \ - if ((req->length + n) > (unsigned)65535) { \ - if (dpy->bigreq_size) { \ - MakeBigReq(req,n) \ - } else { \ - n = badlen; \ - req->length += n; \ - } \ - } else \ - req->length += n -#else -#define SetReqLen(req,n,badlen) \ - req->length += n -#endif - -#define SyncHandle() \ - if (dpy->synchandler) (*dpy->synchandler)(dpy) - -extern void _XFlushGCCache(Display *dpy, GC gc); -#define FlushGC(dpy, gc) \ - if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) -/* - * Data - Place data in the buffer and pad the end to provide - * 32 bit word alignment. Transmit if the buffer fills. - * - * "dpy" is a pointer to a Display. - * "data" is a pointer to a data buffer. - * "len" is the length of the data buffer. - */ -#ifndef DataRoutineIsProcedure -#define Data(dpy, data, len) {\ - if (dpy->bufptr + (len) <= dpy->bufmax) {\ - memcpy(dpy->bufptr, data, (int)len);\ - dpy->bufptr += ((len) + 3) & ~3;\ - } else\ - _XSend(dpy, data, len);\ - } -#endif /* DataRoutineIsProcedure */ - - -/* Allocate bytes from the buffer. No padding is done, so if - * the length is not a multiple of 4, the caller must be - * careful to leave the buffer aligned after sending the - * current request. - * - * "type" is the type of the pointer being assigned to. - * "ptr" is the pointer being assigned to. - * "n" is the number of bytes to allocate. - * - * Example: - * xTextElt *elt; - * BufAlloc (xTextElt *, elt, nbytes) - */ - -#define BufAlloc(type, ptr, n) \ - if (dpy->bufptr + (n) > dpy->bufmax) \ - _XFlush (dpy); \ - ptr = (type) dpy->bufptr; \ - memset(ptr, '\0', n); \ - dpy->bufptr += (n); - -#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) -#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) -#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) -#ifdef LONG64 -#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) -extern int _XData32( - Display *dpy, - register _Xconst long *data, - unsigned len -); -extern void _XRead32( - Display *dpy, - register long *data, - long len -); -#else -#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) -#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) -#endif - -#define PackData16(dpy,data,len) Data16 (dpy, data, len) -#define PackData32(dpy,data,len) Data32 (dpy, data, len) - -/* Xlib manual is bogus */ -#define PackData(dpy,data,len) PackData16 (dpy, data, len) - -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#define max(a,b) (((a) > (b)) ? (a) : (b)) - -#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ - (((cs)->rbearing|(cs)->lbearing| \ - (cs)->ascent|(cs)->descent) == 0)) - -/* - * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit - * character. If the character is in the column and exists, then return the - * appropriate metrics (note that fonts with common per-character metrics will - * return min_bounds). If none of these hold true, try again with the default - * char. - */ -#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ -{ \ - cs = def; \ - if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ - if (fs->per_char == NULL) { \ - cs = &fs->min_bounds; \ - } else { \ - cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ - } \ - } \ -} - -#define CI_GET_DEFAULT_INFO_1D(fs,cs) \ - CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs) - - - -/* - * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and - * column. This is used for fonts that have more than row zero. - */ -#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ -{ \ - cs = def; \ - if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ - col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ - if (fs->per_char == NULL) { \ - cs = &fs->min_bounds; \ - } else { \ - cs = &fs->per_char[((row - fs->min_byte1) * \ - (fs->max_char_or_byte2 - \ - fs->min_char_or_byte2 + 1)) + \ - (col - fs->min_char_or_byte2)]; \ - if (CI_NONEXISTCHAR(cs)) cs = def; \ - } \ - } \ -} - -#define CI_GET_DEFAULT_INFO_2D(fs,cs) \ -{ \ - unsigned int r = (fs->default_char >> 8); \ - unsigned int c = (fs->default_char & 0xff); \ - CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \ -} - - -/* srcvar must be a variable for large architecture version */ -#define OneDataCard32(dpy,dstaddr,srcvar) \ - { *(CARD32 *)(dstaddr) = (srcvar); } - - -typedef struct _XInternalAsync { - struct _XInternalAsync *next; - /* - * handler arguments: - * rep is the generic reply that caused this handler - * to be invoked. It must also be passed to _XGetAsyncReply. - * buf and len are opaque values that must be passed to - * _XGetAsyncReply or _XGetAsyncData. - * data is the closure stored in this struct. - * The handler returns True iff it handled this reply. - */ - Bool (*handler)( - Display* /* dpy */, - xReply* /* rep */, - char* /* buf */, - int /* len */, - XPointer /* data */ - ); - XPointer data; -} _XAsyncHandler; - -typedef struct _XAsyncEState { - unsigned long min_sequence_number; - unsigned long max_sequence_number; - unsigned char error_code; - unsigned char major_opcode; - unsigned short minor_opcode; - unsigned char last_error_received; - int error_count; -} _XAsyncErrorState; - -extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); -#define DeqAsyncHandler(dpy,handler) { \ - if (dpy->async_handlers == (handler)) \ - dpy->async_handlers = (handler)->next; \ - else \ - _XDeqAsyncHandler(dpy, handler); \ - } - -typedef void (*FreeFuncType) ( - Display* /* display */ -); - -typedef int (*FreeModmapType) ( - XModifierKeymap* /* modmap */ -); - -/* - * This structure is private to the library. - */ -typedef struct _XFreeFuncs { - FreeFuncType atoms; /* _XFreeAtomTable */ - FreeModmapType modifiermap; /* XFreeModifiermap */ - FreeFuncType key_bindings; /* _XFreeKeyBindings */ - FreeFuncType context_db; /* _XFreeContextDB */ - FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */ - FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */ - FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ - FreeFuncType im_filters; /* _XFreeIMFilters */ - FreeFuncType xkb; /* _XkbFreeInfo */ -} _XFreeFuncRec; - -/* types for InitExt.c */ -typedef int (*CreateGCType) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*CopyGCType)( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*FlushGCType) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*FreeGCType) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ -); - -typedef int (*CreateFontType) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -); - -typedef int (*FreeFontType) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ -); - -typedef int (*CloseDisplayType) ( - Display* /* display */, - XExtCodes* /* codes */ -); - -typedef int (*ErrorType) ( - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ -); - -typedef char* (*ErrorStringType) ( - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ -); - -typedef void (*PrintErrorType)( - Display* /* display */, - XErrorEvent* /* ev */, - void* /* fp */ -); - -typedef void (*BeforeFlushType)( - Display* /* display */, - XExtCodes* /* codes */, - _Xconst char* /* data */, - long /* len */ -); - -/* - * This structure is private to the library. - */ -typedef struct _XExten { /* private to extension mechanism */ - struct _XExten *next; /* next in list */ - XExtCodes codes; /* public information, all extension told */ - CreateGCType create_GC; /* routine to call when GC created */ - CopyGCType copy_GC; /* routine to call when GC copied */ - FlushGCType flush_GC; /* routine to call when GC flushed */ - FreeGCType free_GC; /* routine to call when GC freed */ - CreateFontType create_Font; /* routine to call when Font created */ - FreeFontType free_Font; /* routine to call when Font freed */ - CloseDisplayType close_display; /* routine to call when connection closed */ - ErrorType error; /* who to call when an error occurs */ - ErrorStringType error_string; /* routine to supply error string */ - char *name; /* name of this extension */ - PrintErrorType error_values; /* routine to supply error values */ - BeforeFlushType before_flush; /* routine to call when sending data */ - struct _XExten *next_flush; /* next in list of those with flushes */ -} _XExtension; - -/* Temporary definition until we can depend on an xproto release with it */ -#ifdef _X_COLD -# define _XLIB_COLD _X_COLD -#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */ -# define _XLIB_COLD __attribute__((__cold__)) -#else -# define _XLIB_COLD /* nothing */ -#endif - -/* extension hooks */ - -#ifdef DataRoutineIsProcedure -extern void Data(Display *dpy, char *data, long len); -#endif -extern int _XError( - Display* /* dpy */, - xError* /* rep */ -); -extern int _XIOError( - Display* /* dpy */ -#ifdef NX_TRANS_SOCKET -); -#else -) _X_NORETURN; -#endif /* NX_TRANS_SOCKET */ - -extern int (*_XIOErrorFunction)( - Display* /* dpy */ -); -extern int (*_XErrorFunction)( - Display* /* dpy */, - XErrorEvent* /* error_event */ -); -extern void _XEatData( - Display* /* dpy */, - unsigned long /* n */ -) _XLIB_COLD; -extern void _XEatDataWords( - Display* /* dpy */, - unsigned long /* n */ -) _XLIB_COLD; -#if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */ -# pragma rarely_called(_XEatData, _XEatDataWords) -#endif -extern char *_XAllocScratch( - Display* /* dpy */, - unsigned long /* nbytes */ -); -extern char *_XAllocTemp( - Display* /* dpy */, - unsigned long /* nbytes */ -); -extern void _XFreeTemp( - Display* /* dpy */, - char* /* buf */, - unsigned long /* nbytes */ -); -extern Visual *_XVIDtoVisual( - Display* /* dpy */, - VisualID /* id */ -); -extern unsigned long _XSetLastRequestRead( - Display* /* dpy */, - xGenericReply* /* rep */ -); -extern int _XGetHostname( - char* /* buf */, - int /* maxlen */ -); -extern Screen *_XScreenOfWindow( - Display* /* dpy */, - Window /* w */ -); -extern Bool _XAsyncErrorHandler( - Display* /* dpy */, - xReply* /* rep */, - char* /* buf */, - int /* len */, - XPointer /* data */ -); -extern char *_XGetAsyncReply( - Display* /* dpy */, - char* /* replbuf */, - xReply* /* rep */, - char* /* buf */, - int /* len */, - int /* extra */, - Bool /* discard */ -); -extern void _XGetAsyncData( - Display* /* dpy */, - char * /* data */, - char * /* buf */, - int /* len */, - int /* skip */, - int /* datalen */, - int /* discardtotal */ -); -extern void _XFlush( - Display* /* dpy */ -); -extern int _XEventsQueued( - Display* /* dpy */, - int /* mode */ -); -extern void _XReadEvents( - Display* /* dpy */ -); -extern int _XRead( - Display* /* dpy */, - char* /* data */, - long /* size */ -); -extern void _XReadPad( - Display* /* dpy */, - char* /* data */, - long /* size */ -); -extern void _XSend( - Display* /* dpy */, - _Xconst char* /* data */, - long /* size */ -); -extern Status _XReply( - Display* /* dpy */, - xReply* /* rep */, - int /* extra */, - Bool /* discard */ -); -extern void _XEnq( - Display* /* dpy */, - xEvent* /* event */ -); -extern void _XDeq( - Display* /* dpy */, - _XQEvent* /* prev */, - _XQEvent* /* qelt */ -); - -extern Bool _XUnknownWireEvent( - Display* /* dpy */, - XEvent* /* re */, - xEvent* /* event */ -); - -extern Bool _XUnknownWireEventCookie( - Display* /* dpy */, - XGenericEventCookie* /* re */, - xEvent* /* event */ -); - -extern Bool _XUnknownCopyEventCookie( - Display* /* dpy */, - XGenericEventCookie* /* in */, - XGenericEventCookie* /* out */ -); - -extern Status _XUnknownNativeEvent( - Display* /* dpy */, - XEvent* /* re */, - xEvent* /* event */ -); - -extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); -extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); -extern Bool _XPollfdCacheInit(Display *dpy); -extern void _XPollfdCacheAdd(Display *dpy, int fd); -extern void _XPollfdCacheDel(Display *dpy, int fd); -extern XID _XAllocID(Display *dpy); -extern void _XAllocIDs(Display *dpy, XID *ids, int count); - -extern int _XFreeExtData( - XExtData* /* extension */ -); - -extern int (*XESetCreateGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetCopyGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetFlushGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetFreeGC( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - GC /* gc */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, GC, XExtCodes* -); - -extern int (*XESetCreateFont( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, XFontStruct*, XExtCodes* -); - -extern int (*XESetFreeFont( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - XFontStruct* /* fs */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, XFontStruct*, XExtCodes* -); - -extern int (*XESetCloseDisplay( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - XExtCodes* /* codes */ - ) /* proc */ -))( - Display*, XExtCodes* -); - -extern int (*XESetError( - Display* /* display */, - int /* extension */, - int (*) ( - Display* /* display */, - xError* /* err */, - XExtCodes* /* codes */, - int* /* ret_code */ - ) /* proc */ -))( - Display*, xError*, XExtCodes*, int* -); - -extern char* (*XESetErrorString( - Display* /* display */, - int /* extension */, - char* (*) ( - Display* /* display */, - int /* code */, - XExtCodes* /* codes */, - char* /* buffer */, - int /* nbytes */ - ) /* proc */ -))( - Display*, int, XExtCodes*, char*, int -); - -extern void (*XESetPrintErrorValues ( - Display* /* display */, - int /* extension */, - void (*)( - Display* /* display */, - XErrorEvent* /* ev */, - void* /* fp */ - ) /* proc */ -))( - Display*, XErrorEvent*, void* -); - -extern Bool (*XESetWireToEvent( - Display* /* display */, - int /* event_number */, - Bool (*) ( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ - ) /* proc */ -))( - Display*, XEvent*, xEvent* -); - -extern Bool (*XESetWireToEventCookie( - Display* /* display */, - int /* extension */, - Bool (*) ( - Display* /* display */, - XGenericEventCookie* /* re */, - xEvent* /* event */ - ) /* proc */ -))( - Display*, XGenericEventCookie*, xEvent* -); - -extern Bool (*XESetCopyEventCookie( - Display* /* display */, - int /* extension */, - Bool (*) ( - Display* /* display */, - XGenericEventCookie* /* in */, - XGenericEventCookie* /* out */ - ) /* proc */ -))( - Display*, XGenericEventCookie*, XGenericEventCookie* -); - - -extern Status (*XESetEventToWire( - Display* /* display */, - int /* event_number */, - Status (*) ( - Display* /* display */, - XEvent* /* re */, - xEvent* /* event */ - ) /* proc */ -))( - Display*, XEvent*, xEvent* -); - -extern Bool (*XESetWireToError( - Display* /* display */, - int /* error_number */, - Bool (*) ( - Display* /* display */, - XErrorEvent* /* he */, - xError* /* we */ - ) /* proc */ -))( - Display*, XErrorEvent*, xError* -); - -extern void (*XESetBeforeFlush( - Display* /* display */, - int /* error_number */, - void (*) ( - Display* /* display */, - XExtCodes* /* codes */, - _Xconst char* /* data */, - long /* len */ - ) /* proc */ -))( - Display*, XExtCodes*, _Xconst char*, long -); - -/* internal connections for IMs */ - -typedef void (*_XInternalConnectionProc)( - Display* /* dpy */, - int /* fd */, - XPointer /* call_data */ -); - - -extern Status _XRegisterInternalConnection( - Display* /* dpy */, - int /* fd */, - _XInternalConnectionProc /* callback */, - XPointer /* call_data */ -); - -extern void _XUnregisterInternalConnection( - Display* /* dpy */, - int /* fd */ -); - -extern void _XProcessInternalConnection( - Display* /* dpy */, - struct _XConnectionInfo* /* conn_info */ -); - -/* Display structure has pointers to these */ - -struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ - int fd; - _XInternalConnectionProc read_callback; - XPointer call_data; - XPointer *watch_data; /* set/used by XConnectionWatchProc */ - struct _XConnectionInfo *next; -}; - -struct _XConnWatchInfo { /* info from XAddConnectionWatch */ - XConnectionWatchProc fn; - XPointer client_data; - struct _XConnWatchInfo *next; -}; - -extern int _XTextHeight( - XFontStruct* /* font_struct */, - _Xconst char* /* string */, - int /* count */ -); - -extern int _XTextHeight16( - XFontStruct* /* font_struct */, - _Xconst XChar2b* /* string */, - int /* count */ -); - -#if defined(WIN32) - -extern int _XOpenFile( - _Xconst char* /* path */, - int /* flags */ -); - -extern int _XOpenFileMode( - _Xconst char* /* path */, - int /* flags */, - mode_t /* mode */ -); - -extern void* _XFopenFile( - _Xconst char* /* path */, - _Xconst char* /* mode */ -); - -extern int _XAccessFile( - _Xconst char* /* path */ -); -#else -#define _XOpenFile(path,flags) open(path,flags) -#define _XOpenFileMode(path,flags,mode) open(path,flags,mode) -#define _XFopenFile(path,mode) fopen(path,mode) -#endif - -/* EvToWire.c */ -extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); - -extern int _XF86LoadQueryLocaleFont( - Display* /* dpy */, - _Xconst char* /* name*/, - XFontStruct** /* xfp*/, - Font* /* fidp */ -); - -extern void _XProcessWindowAttributes ( - register Display *dpy, - xChangeWindowAttributesReq *req, - register unsigned long valuemask, - register XSetWindowAttributes *attributes); - -extern int _XDefaultError( - Display *dpy, - XErrorEvent *event); - -extern int _XDefaultIOError( - Display *dpy); - -extern void _XSetClipRectangles ( - register Display *dpy, - GC gc, - int clip_x_origin, int clip_y_origin, - XRectangle *rectangles, - int n, - int ordering); - -Status _XGetWindowAttributes( - register Display *dpy, - Window w, - XWindowAttributes *attr); - -int _XPutBackEvent ( - register Display *dpy, - register XEvent *event); - -extern Bool _XIsEventCookie( - Display *dpy, - XEvent *ev); - -extern void _XFreeEventCookies( - Display *dpy); - -extern void _XStoreEventCookie( - Display *dpy, - XEvent *ev); - -extern Bool _XFetchEventCookie( - Display *dpy, - XGenericEventCookie *ev); - -extern Bool _XCopyEventCookie( - Display *dpy, - XGenericEventCookie *in, - XGenericEventCookie *out); - -/* lcFile.c */ - -extern void xlocaledir( - char *buf, - int buf_len -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* !defined(_X11_XLIBINT_H_) && !defined(_XLIBINT_H_) */ diff --git a/nx-X11/lib/X11/Xlocale.h b/nx-X11/lib/X11/Xlocale.h deleted file mode 100644 index 4ac9bac30..000000000 --- a/nx-X11/lib/X11/Xlocale.h +++ /dev/null @@ -1,38 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#if !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) -#define _X11_XLOCALE_H_ -#define _XLOCALE_H_ - -#include -#include - -#include - -#endif /* !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) */ diff --git a/nx-X11/lib/X11/XomGeneric.h b/nx-X11/lib/X11/XomGeneric.h deleted file mode 100644 index d6f182d19..000000000 --- a/nx-X11/lib/X11/XomGeneric.h +++ /dev/null @@ -1,316 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Takanori Tateno FUJITSU LIMITED - * - */ - -#ifndef _XOMGENERIC_H_ -#define _XOMGENERIC_H_ - -#include "XlcPublic.h" - -#define XOM_GENERIC(om) (&((XOMGeneric) om)->gen) -#define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen) - -/* For VW/UDC */ -typedef struct _CodeRangeRec { - unsigned long start; - unsigned long end; - unsigned long dmy1; - unsigned long dmy2; -} CodeRangeRec, *CodeRange; - -typedef struct _VRotateRec { - char *charset_name; /* Charset name */ - XlcSide side; /* Encoding side */ - int num_cr; - CodeRange code_range; - char *xlfd_name; - XFontStruct *font; -} VRotateRec, *VRotate; - -typedef enum { - XOMMultiByte, - XOMWideChar, - XOMUtf8String -} XOMTextType; - -typedef struct _FontDataRec { - char *name; - XlcSide side; - /* For VW/UDC */ - int scopes_num; - FontScope scopes; - char *xlfd_name; - XFontStruct *font; -} FontDataRec, *FontData; - -#define VROTATE_NONE 0 -#define VROTATE_PART 1 -#define VROTATE_ALL 2 - -typedef struct _OMDataRec { - int charset_count; - XlcCharSet *charset_list; - int font_data_count; - FontData font_data; - /* For VW/UDC */ - int substitute_num; - FontData substitute; - /* Vertical Writing */ - int vmap_num; - FontData vmap; - int vrotate_type; - int vrotate_num; - CodeRange vrotate; -} OMDataRec, *OMData; - -typedef struct _XOMGenericPart { - int data_num; - OMData data; - Bool on_demand_loading; - char *object_name; -} XOMGenericPart; - -typedef struct _XOMGenericRec { - XOMMethods methods; - XOMCoreRec core; - XOMGenericPart gen; -} XOMGenericRec, *XOMGeneric; - -/* - * XOC dependent data - */ - -typedef struct _FontSetRec { - int id; - int charset_count; - XlcCharSet *charset_list; - int font_data_count; - FontData font_data; - char *font_name; - XFontStruct *info; - XFontStruct *font; - XlcSide side; - Bool is_xchar2b; - /* For VW/UDC */ - int substitute_num; - FontData substitute; - /* Vertical Writing */ - int vpart_initialize; - int vmap_num; - FontData vmap; - int vrotate_num; - VRotate vrotate; -} FontSetRec, *FontSet; - -typedef struct _XOCGenericPart { - XlcConv mbs_to_cs; - XlcConv wcs_to_cs; - XlcConv utf8_to_cs; - int font_set_num; - FontSet font_set; -} XOCGenericPart; - -typedef struct _XOCGenericRec { - XOCMethods methods; - XOCCoreRec core; - XOCGenericPart gen; -} XOCGenericRec, *XOCGeneric; - -_XFUNCPROTOBEGIN - -extern XOM _XomGenericOpenOM( - XLCd /* lcd */, - Display* /* dpy */, - XrmDatabase /* rdb */, - _Xconst char* /* res_name */, - _Xconst char* /* res_class */ -); - -extern XlcConv _XomInitConverter( - XOC /* oc */, - XOMTextType /* type */ -); - -extern int _XomConvert( - XOC /* oc */, - XlcConv /* conv */, - XPointer* /* from */, - int* /* from_left */, - XPointer* /* to */, - int* /* to_left */, - XPointer* /* args */, - int /* num_args */ -); - -extern int -_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length); -extern int -_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length); -extern int -_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length); -extern int -_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical); -extern int -_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical); -extern int -_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical); -extern Status -_XmbDefaultTextPerCharExtents( - XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical); -extern Status -_XwcDefaultTextPerCharExtents( - XOC oc, _Xconst wchar_t *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical); -extern Status -_Xutf8DefaultTextPerCharExtents( - XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical); -extern int -_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length); -extern int -_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst wchar_t *text, int length); -extern int -_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length); -extern void -_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length); -extern void -_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst wchar_t *text, int length); -extern void -_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length); - -extern int -_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length); -extern int -_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical); -extern int -_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length); -extern void -_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length); -extern Status -_Xutf8GenericTextPerCharExtents( - XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical); -extern int -_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical); -extern int -_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length); -extern void -_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst wchar_t *text, int length); -extern int -_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst wchar_t *text, int length); -extern Status -_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical); -extern int -_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical); -extern int -_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length); -extern void -_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length); -extern int -_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length); -extern Status -_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical); - -extern FontData -read_EncodingInfo( - int count, - char **value); - -extern int -_XomGenericDrawString( - Display *dpy, - Drawable d, - XOC oc, - GC gc, - int x, int y, - XOMTextType type, - XPointer text, - int length); -extern int -_XomGenericTextExtents( - XOC oc, - XOMTextType type, - XPointer text, - int length, - XRectangle *overall_ink, - XRectangle *overall_logical); -extern FontData -_XomGetFontDataFromFontSet( - FontSet fs, - unsigned char *str, - int len, - int *len_ret, - int is2b, - int type); - -_XFUNCPROTOEND - -#endif /* _XOMGENERIC_H_ */ diff --git a/nx-X11/lib/X11/Xprivate.h b/nx-X11/lib/X11/Xprivate.h deleted file mode 100644 index 2dd62ce7d..000000000 --- a/nx-X11/lib/X11/Xprivate.h +++ /dev/null @@ -1,30 +0,0 @@ -/* Copyright (C) 2008 Jamey Sharp, Josh Triplett - * This file is licensed under the MIT license. See the file COPYING. - * - * As Xlibint.h has long become effectively public API, this header exists - * for new private functions that nothing outside of libX11 should call. - */ - -#ifndef XPRIVATE_H -#define XPRIVATE_H - -#include - -extern _X_HIDDEN void _XIDHandler(Display *dpy); -extern _X_HIDDEN void _XSeqSyncFunction(Display *dpy); -extern _X_HIDDEN void _XSetPrivSyncFunction(Display *dpy); -extern _X_HIDDEN void _XSetSeqSyncFunction(Display *dpy); - -#ifdef XTHREADS -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -#define InternalLockDisplay(d,wskip) if ((d)->lock) \ - (*(d)->lock->internal_lock_display)(d,wskip,__FILE__,__LINE__) -#else -#define InternalLockDisplay(d,wskip) if ((d)->lock) \ - (*(d)->lock->internal_lock_display)(d,wskip) -#endif -#else /* XTHREADS else */ -#define InternalLockDisplay(d,wskip) -#endif /* XTHREADS else */ - -#endif /* XPRIVATE_H */ diff --git a/nx-X11/lib/X11/Xregion.h b/nx-X11/lib/X11/Xregion.h deleted file mode 100644 index 4f55af82f..000000000 --- a/nx-X11/lib/X11/Xregion.h +++ /dev/null @@ -1,191 +0,0 @@ -/************************************************************************ - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -************************************************************************/ - -#if !defined(_X11_XREGION_H_) && !defined(_XREGION_H) -#define _X11_XREGION_H_ -#define _XREGION_H - -typedef struct { - short x1, x2, y1, y2; -} Box, BOX, BoxRec, *BoxPtr; - -typedef struct { - short x, y, width, height; -}RECTANGLE, RectangleRec, *RectanglePtr; - -#define TRUE 1 -#define FALSE 0 -#define MAXSHORT 32767 -#define MINSHORT -MAXSHORT -#ifndef MAX -#define MAX(a,b) (((a) > (b)) ? (a) : (b)) -#endif -#ifndef MIN -#define MIN(a,b) (((a) < (b)) ? (a) : (b)) -#endif - - -/* - * clip region - */ - -typedef struct _XRegion { - long size; - long numRects; - BOX *rects; - BOX extents; -} REGION; - -/* Xutil.h contains the declaration: - * typedef struct _XRegion *Region; - */ - -/* 1 if two BOXs overlap. - * 0 if two BOXs do not overlap. - * Remember, x2 and y2 are not in the region - */ -#define EXTENTCHECK(r1, r2) \ - ((r1)->x2 > (r2)->x1 && \ - (r1)->x1 < (r2)->x2 && \ - (r1)->y2 > (r2)->y1 && \ - (r1)->y1 < (r2)->y2) - -/* - * update region extents - */ -#define EXTENTS(r,idRect){\ - if((r)->x1 < (idRect)->extents.x1)\ - (idRect)->extents.x1 = (r)->x1;\ - if((r)->y1 < (idRect)->extents.y1)\ - (idRect)->extents.y1 = (r)->y1;\ - if((r)->x2 > (idRect)->extents.x2)\ - (idRect)->extents.x2 = (r)->x2;\ - if((r)->y2 > (idRect)->extents.y2)\ - (idRect)->extents.y2 = (r)->y2;\ - } - -/* - * Check to see if there is enough memory in the present region. - */ -#define MEMCHECK(reg, rect, firstrect){\ - if ((reg)->numRects >= ((reg)->size - 1)){\ - BoxPtr tmpRect = Xrealloc ((firstrect), \ - (2 * (sizeof(BOX)) * ((reg)->size))); \ - if (tmpRect == NULL) \ - return(0);\ - (firstrect) = tmpRect; \ - (reg)->size *= 2;\ - (rect) = &(firstrect)[(reg)->numRects];\ - }\ - } - -/* this routine checks to see if the previous rectangle is the same - * or subsumes the new rectangle to add. - */ - -#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ - (!(((Reg)->numRects > 0)&&\ - ((R-1)->y1 == (Ry1)) &&\ - ((R-1)->y2 == (Ry2)) &&\ - ((R-1)->x1 <= (Rx1)) &&\ - ((R-1)->x2 >= (Rx2)))) - -/* add a rectangle to the given Region */ -#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ - if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ - CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ - (r)->x1 = (rx1);\ - (r)->y1 = (ry1);\ - (r)->x2 = (rx2);\ - (r)->y2 = (ry2);\ - EXTENTS((r), (reg));\ - (reg)->numRects++;\ - (r)++;\ - }\ - } - - - -/* add a rectangle to the given Region */ -#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ - if ((rx1 < rx2) && (ry1 < ry2) &&\ - CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ - (r)->x1 = (rx1);\ - (r)->y1 = (ry1);\ - (r)->x2 = (rx2);\ - (r)->y2 = (ry2);\ - (reg)->numRects++;\ - (r)++;\ - }\ - } - -#define EMPTY_REGION(pReg) pReg->numRects = 0 - -#define REGION_NOT_EMPTY(pReg) pReg->numRects - -#define INBOX(r, x, y) \ - ( ( ((r).x2 > x)) && \ - ( ((r).x1 <= x)) && \ - ( ((r).y2 > y)) && \ - ( ((r).y1 <= y)) ) - -/* - * number of points to buffer before sending them off - * to scanlines() : Must be an even number - */ -#define NUMPTSTOBUFFER 200 - -/* - * used to allocate buffers for points and link - * the buffers together - */ -typedef struct _POINTBLOCK { - XPoint pts[NUMPTSTOBUFFER]; - struct _POINTBLOCK *next; -} POINTBLOCK; - -#endif /* !defined(_X11_XREGION_H_) && !defined(_XREGION_H) */ diff --git a/nx-X11/lib/X11/Xresinternal.h b/nx-X11/lib/X11/Xresinternal.h deleted file mode 100644 index c740102b6..000000000 --- a/nx-X11/lib/X11/Xresinternal.h +++ /dev/null @@ -1,18 +0,0 @@ - -#ifndef _XRESINTERNAL_H_ -#define _XRESINTERNAL_H_ - -#include -#include -#include - -/* type defines */ -typedef uint32_t Signature; - -/* prototypes */ -extern XrmQuark _XrmInternalStringToQuark( - register _Xconst char *name, register int len, register Signature sig, - Bool permstring); - -#endif /* _XRESOURCEINTERNAL_H_ */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/X11/Xresource.h b/nx-X11/lib/X11/Xresource.h deleted file mode 100644 index f3977a209..000000000 --- a/nx-X11/lib/X11/Xresource.h +++ /dev/null @@ -1,359 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#if !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) -#define _X11_XRESOURCE_H_ -#define _XRESOURCE_H_ - -#ifndef _XP_PRINT_SERVER_ -#include -#endif - -/**************************************************************** - **************************************************************** - *** *** - *** *** - *** X Resource Manager Intrinsics *** - *** *** - *** *** - **************************************************************** - ****************************************************************/ - -_XFUNCPROTOBEGIN - -/**************************************************************** - * - * Memory Management - * - ****************************************************************/ - -extern char *Xpermalloc( - unsigned int /* size */ -); - -/**************************************************************** - * - * Quark Management - * - ****************************************************************/ - -typedef int XrmQuark, *XrmQuarkList; -#define NULLQUARK ((XrmQuark) 0) - -typedef char *XrmString; -#define NULLSTRING ((XrmString) 0) - -/* find quark for string, create new quark if none already exists */ -extern XrmQuark XrmStringToQuark( - _Xconst char* /* string */ -); - -extern XrmQuark XrmPermStringToQuark( - _Xconst char* /* string */ -); - -/* find string for quark */ -extern XrmString XrmQuarkToString( - XrmQuark /* quark */ -); - -extern XrmQuark XrmUniqueQuark( - void -); - -#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) - - -/**************************************************************** - * - * Conversion of Strings to Lists - * - ****************************************************************/ - -typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; - -extern void XrmStringToQuarkList( - _Xconst char* /* string */, - XrmQuarkList /* quarks_return */ -); - -extern void XrmStringToBindingQuarkList( - _Xconst char* /* string */, - XrmBindingList /* bindings_return */, - XrmQuarkList /* quarks_return */ -); - -/**************************************************************** - * - * Name and Class lists. - * - ****************************************************************/ - -typedef XrmQuark XrmName; -typedef XrmQuarkList XrmNameList; -#define XrmNameToString(name) XrmQuarkToString(name) -#define XrmStringToName(string) XrmStringToQuark(string) -#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) - -typedef XrmQuark XrmClass; -typedef XrmQuarkList XrmClassList; -#define XrmClassToString(c_class) XrmQuarkToString(c_class) -#define XrmStringToClass(c_class) XrmStringToQuark(c_class) -#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) - - - -/**************************************************************** - * - * Resource Representation Types and Values - * - ****************************************************************/ - -typedef XrmQuark XrmRepresentation; -#define XrmStringToRepresentation(string) XrmStringToQuark(string) -#define XrmRepresentationToString(type) XrmQuarkToString(type) - -typedef struct { - unsigned int size; - XPointer addr; -} XrmValue, *XrmValuePtr; - - -/**************************************************************** - * - * Resource Manager Functions - * - ****************************************************************/ - -typedef struct _XrmHashBucketRec *XrmHashBucket; -typedef XrmHashBucket *XrmHashTable; -typedef XrmHashTable XrmSearchList[]; -typedef struct _XrmHashBucketRec *XrmDatabase; - - -extern void XrmDestroyDatabase( - XrmDatabase /* database */ -); - -extern void XrmQPutResource( - XrmDatabase* /* database */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation /* type */, - XrmValue* /* value */ -); - -extern void XrmPutResource( - XrmDatabase* /* database */, - _Xconst char* /* specifier */, - _Xconst char* /* type */, - XrmValue* /* value */ -); - -extern void XrmQPutStringResource( - XrmDatabase* /* database */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - _Xconst char* /* value */ -); - -extern void XrmPutStringResource( - XrmDatabase* /* database */, - _Xconst char* /* specifier */, - _Xconst char* /* value */ -); - -extern void XrmPutLineResource( - XrmDatabase* /* database */, - _Xconst char* /* line */ -); - -extern Bool XrmQGetResource( - XrmDatabase /* database */, - XrmNameList /* quark_name */, - XrmClassList /* quark_class */, - XrmRepresentation* /* quark_type_return */, - XrmValue* /* value_return */ -); - -extern Bool XrmGetResource( - XrmDatabase /* database */, - _Xconst char* /* str_name */, - _Xconst char* /* str_class */, - char** /* str_type_return */, - XrmValue* /* value_return */ -); - -extern Bool XrmQGetSearchList( - XrmDatabase /* database */, - XrmNameList /* names */, - XrmClassList /* classes */, - XrmSearchList /* list_return */, - int /* list_length */ -); - -extern Bool XrmQGetSearchResource( - XrmSearchList /* list */, - XrmName /* name */, - XrmClass /* class */, - XrmRepresentation* /* type_return */, - XrmValue* /* value_return */ -); - -/**************************************************************** - * - * Resource Database Management - * - ****************************************************************/ - -#ifndef _XP_PRINT_SERVER_ - -extern void XrmSetDatabase( - Display* /* display */, - XrmDatabase /* database */ -); - -extern XrmDatabase XrmGetDatabase( - Display* /* display */ -); - -#endif /* !_XP_PRINT_SERVER_ */ - -extern XrmDatabase XrmGetFileDatabase( - _Xconst char* /* filename */ -); - -extern Status XrmCombineFileDatabase( - _Xconst char* /* filename */, - XrmDatabase* /* target */, - Bool /* override */ -); - -extern XrmDatabase XrmGetStringDatabase( - _Xconst char* /* data */ /* null terminated string */ -); - -extern void XrmPutFileDatabase( - XrmDatabase /* database */, - _Xconst char* /* filename */ -); - -extern void XrmMergeDatabases( - XrmDatabase /* source_db */, - XrmDatabase* /* target_db */ -); - -extern void XrmCombineDatabase( - XrmDatabase /* source_db */, - XrmDatabase* /* target_db */, - Bool /* override */ -); - -#define XrmEnumAllLevels 0 -#define XrmEnumOneLevel 1 - -extern Bool XrmEnumerateDatabase( - XrmDatabase /* db */, - XrmNameList /* name_prefix */, - XrmClassList /* class_prefix */, - int /* mode */, - Bool (*)( - XrmDatabase* /* db */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation* /* type */, - XrmValue* /* value */, - XPointer /* closure */ - ) /* proc */, - XPointer /* closure */ -); - -extern const char *XrmLocaleOfDatabase( - XrmDatabase /* database */ -); - - -/**************************************************************** - * - * Command line option mapping to resource entries - * - ****************************************************************/ - -typedef enum { - XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ - XrmoptionIsArg, /* Value is the option string itself */ - XrmoptionStickyArg, /* Value is characters immediately following option */ - XrmoptionSepArg, /* Value is next argument in argv */ - XrmoptionResArg, /* Resource and value in next argument in argv */ - XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ - XrmoptionSkipLine, /* Ignore this option and the rest of argv */ - XrmoptionSkipNArgs /* Ignore this option and the next - OptionDescRes.value arguments in argv */ -} XrmOptionKind; - -typedef struct { - char *option; /* Option abbreviation in argv */ - char *specifier; /* Resource specifier */ - XrmOptionKind argKind; /* Which style of option it is */ - XPointer value; /* Value to provide if XrmoptionNoArg */ -} XrmOptionDescRec, *XrmOptionDescList; - - -extern void XrmParseCommand( - XrmDatabase* /* database */, - XrmOptionDescList /* table */, - int /* table_count */, - _Xconst char* /* name */, - int* /* argc_in_out */, - char** /* argv_in_out */ -); - -_XFUNCPROTOEND - -#endif /* !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) */ -/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/X11/Xrm.c b/nx-X11/lib/X11/Xrm.c deleted file mode 100644 index e3587d021..000000000 --- a/nx-X11/lib/X11/Xrm.c +++ /dev/null @@ -1,2651 +0,0 @@ - -/*********************************************************** -Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard - - All Rights Reserved - -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 -supporting documentation, and that the name Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ -/* - -Copyright 1987, 1988, 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlibint.h" -#include -#include "Xlcint.h" -#ifdef XTHREADS -#include "locking.h" -#endif -#include -#include -#include -#include "Xresinternal.h" -#include "Xresource.h" - -/* - -These Xrm routines allow very fast lookup of resources in the resource -database. Several usage patterns are exploited: - -(1) Widgets get a lot of resources at one time. Rather than look up each from -scratch, we can precompute the prioritized list of database levels once, then -search for each resource starting at the beginning of the list. - -(2) Many database levels don't contain any leaf resource nodes. There is no -point in looking for resources on a level that doesn't contain any. This -information is kept on a per-level basis. - -(3) Sometimes the widget instance tree is structured such that you get the same -class name repeated on the fully qualified widget name. This can result in the -same database level occuring multiple times on the search list. The code below -only checks to see if you get two identical search lists in a row, rather than -look back through all database levels, but in practice this removes all -duplicates I've ever observed. - -Joel McCormack - -*/ - -/* - -The Xrm representation has been completely redesigned to substantially reduce -memory and hopefully improve performance. - -The database is structured into two kinds of tables: LTables that contain -only values, and NTables that contain only other tables. - -Some invariants: - -The next pointer of the top-level node table points to the top-level leaf -table, if any. - -Within an LTable, for a given name, the tight value always precedes the -loose value, and if both are present the loose value is always right after -the tight value. - -Within an NTable, all of the entries for a given name are contiguous, -in the order tight NTable, loose NTable, tight LTable, loose LTable. - -Bob Scheifler - -*/ - -static XrmQuark XrmQString, XrmQANY; - -typedef Bool (*DBEnumProc)( - XrmDatabase* /* db */, - XrmBindingList /* bindings */, - XrmQuarkList /* quarks */, - XrmRepresentation* /* type */, - XrmValue* /* value */, - XPointer /* closure */ -); - -typedef struct _VEntry { - struct _VEntry *next; /* next in chain */ - XrmQuark name; /* name of this entry */ - unsigned int tight:1; /* 1 if it is a tight binding */ - unsigned int string:1; /* 1 if type is String */ - unsigned int size:30; /* size of value */ -} VEntryRec, *VEntry; - - -typedef struct _DEntry { - VEntryRec entry; /* entry */ - XrmRepresentation type; /* representation type */ -} DEntryRec, *DEntry; - -/* the value is right after the structure */ -#define StringValue(ve) (XPointer)((ve) + 1) -#define RepType(ve) ((DEntry)(ve))->type -/* the value is right after the structure */ -#define DataValue(ve) (XPointer)(((DEntry)(ve)) + 1) -#define RawValue(ve) (char *)((ve)->string ? StringValue(ve) : DataValue(ve)) - -typedef struct _NTable { - struct _NTable *next; /* next in chain */ - XrmQuark name; /* name of this entry */ - unsigned int tight:1; /* 1 if it is a tight binding */ - unsigned int leaf:1; /* 1 if children are values */ - unsigned int hasloose:1; /* 1 if has loose children */ - unsigned int hasany:1; /* 1 if has ANY entry */ - unsigned int pad:4; /* unused */ - unsigned int mask:8; /* hash size - 1 */ - unsigned int entries:16; /* number of children */ -} NTableRec, *NTable; - -/* the buckets are right after the structure */ -#define NodeBuckets(ne) ((NTable *)((ne) + 1)) -#define NodeHash(ne,q) NodeBuckets(ne)[(q) & (ne)->mask] - -/* leaf tables have an extra level of indirection for the buckets, - * so that resizing can be done without invalidating a search list. - * This is completely ugly, and wastes some memory, but the Xlib - * spec doesn't really specify whether invalidation is OK, and the - * old implementation did not invalidate. - */ -typedef struct _LTable { - NTableRec table; - VEntry *buckets; -} LTableRec, *LTable; - -#define LeafHash(le,q) (le)->buckets[(q) & (le)->table.mask] - -/* An XrmDatabase just holds a pointer to the first top-level table. - * The type name is no longer descriptive, but better to not change - * the Xresource.h header file. This type also gets used to define - * XrmSearchList, which is a complete crock, but we'll just leave it - * and caste types as required. - */ -typedef struct _XrmHashBucketRec { - NTable table; - XPointer mbstate; - XrmMethods methods; -#ifdef XTHREADS - LockInfoRec linfo; -#endif -} XrmHashBucketRec; - -/* closure used in get/put resource */ -typedef struct _VClosure { - XrmRepresentation *type; /* type of value */ - XrmValuePtr value; /* value itself */ -} VClosureRec, *VClosure; - -/* closure used in get search list */ -typedef struct _SClosure { - LTable *list; /* search list */ - int idx; /* index of last filled element */ - int limit; /* maximum index */ -} SClosureRec, *SClosure; - -/* placed in XrmSearchList to indicate next table is loose only */ -#define LOOSESEARCH ((LTable)1) - -/* closure used in enumerate database */ -typedef struct _EClosure { - XrmDatabase db; /* the database */ - DBEnumProc proc; /* the user proc */ - XPointer closure; /* the user closure */ - XrmBindingList bindings; /* binding list */ - XrmQuarkList quarks; /* quark list */ - int mode; /* XrmEnum */ -} EClosureRec, *EClosure; - -/* types for typecasting ETable based functions to NTable based functions */ -typedef Bool (*getNTableSProcp)( - NTable table, - XrmNameList names, - XrmClassList classes, - SClosure closure); -typedef Bool (*getNTableVProcp)( - NTable table, - XrmNameList names, - XrmClassList classes, - VClosure closure); -typedef Bool (*getNTableEProcp)( - NTable table, - XrmNameList names, - XrmClassList classes, - register int level, - EClosure closure); - -/* predicate to determine when to resize a hash table */ -#define GrowthPred(n,m) ((unsigned)(n) > (((m) + 1) << 2)) - -#define GROW(prev) \ - if (GrowthPred((*prev)->entries, (*prev)->mask)) \ - GrowTable(prev) - -/* pick a reasonable value for maximum depth of resource database */ -#define MAXDBDEPTH 100 - -/* macro used in get/search functions */ - -/* find an entry named ename, with leafness given by leaf */ -#define NFIND(ename) \ - q = ename; \ - entry = NodeHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (leaf && entry && !entry->leaf) { \ - entry = entry->next; \ - if (entry && !entry->leaf) \ - entry = entry->next; \ - if (entry && entry->name != q) \ - entry = (NTable)NULL; \ - } - -/* resourceQuarks keeps track of what quarks have been associated with values - * in all LTables. If a quark has never been used in an LTable, we don't need - * to bother looking for it. - */ - -static unsigned char *resourceQuarks = (unsigned char *)NULL; -static XrmQuark maxResourceQuark = -1; - -/* determines if a quark has been used for a value in any database */ -#define IsResourceQuark(q) ((q) > 0 && (q) <= maxResourceQuark && \ - resourceQuarks[(q) >> 3] & (1 << ((q) & 7))) - -typedef unsigned char XrmBits; - -#define BSLASH ((XrmBits) (1 << 5)) -#define NORMAL ((XrmBits) (1 << 4)) -#define EOQ ((XrmBits) (1 << 3)) -#define SEP ((XrmBits) (1 << 2)) -#define ENDOF ((XrmBits) (1 << 1)) -#define SPACE (NORMAL|EOQ|SEP|(XrmBits)0) -#define RSEP (NORMAL|EOQ|SEP|(XrmBits)1) -#define EOS (EOQ|SEP|ENDOF|(XrmBits)0) -#define EOL (EOQ|SEP|ENDOF|(XrmBits)1) -#define BINDING (NORMAL|EOQ) -#define ODIGIT (NORMAL|(XrmBits)1) - -#define next_char(ch,str) xrmtypes[(unsigned char)((ch) = *(++(str)))] -#define next_mbchar(ch,len,str) xrmtypes[(unsigned char)(ch = (*db->methods->mbchar)(db->mbstate, str, &len), str += len, ch)] - -#define is_space(bits) ((bits) == SPACE) -#define is_EOQ(bits) ((bits) & EOQ) -#define is_EOF(bits) ((bits) == EOS) -#define is_EOL(bits) ((bits) & ENDOF) -#define is_binding(bits) ((bits) == BINDING) -#define is_odigit(bits) ((bits) == ODIGIT) -#define is_separator(bits) ((bits) & SEP) -#define is_nonpcs(bits) (!(bits)) -#define is_normal(bits) ((bits) & NORMAL) -#define is_simple(bits) ((bits) & (NORMAL|BSLASH)) -#define is_special(bits) ((bits) & (ENDOF|BSLASH)) - -/* parsing types */ -static XrmBits const xrmtypes[256] = { - EOS,0,0,0,0,0,0,0, - 0,SPACE,EOL,0,0, -#if defined(WIN32) - EOL, /* treat CR the same as LF, just in case */ -#else - 0, -#endif - 0,0, - 0,0,0,0,0,0,0,0, - 0,0,0,0,0,0,0,0, - SPACE,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,BINDING,NORMAL,NORMAL,NORMAL,BINDING,NORMAL, - ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT, - NORMAL,NORMAL,RSEP,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,BSLASH,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, - NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,0 - /* The rest will be automatically initialized to zero. */ -}; - -void XrmInitialize(void) -{ - XrmQString = XrmPermStringToQuark("String"); - XrmQANY = XrmPermStringToQuark("?"); -} - -XrmDatabase XrmGetDatabase( - Display *display) -{ - XrmDatabase retval; - LockDisplay(display); - retval = display->db; - UnlockDisplay(display); - return retval; -} - -void XrmSetDatabase( - Display *display, - XrmDatabase database) -{ - LockDisplay(display); - /* destroy database if set up implicitly by XGetDefault() */ - if (display->db && (display->flags & XlibDisplayDfltRMDB)) { - XrmDestroyDatabase(display->db); - display->flags &= ~XlibDisplayDfltRMDB; - } - display->db = database; - UnlockDisplay(display); -} - -void -XrmStringToQuarkList( - register _Xconst char *name, - register XrmQuarkList quarks) /* RETURN */ -{ - register XrmBits bits; - register Signature sig = 0; - register char ch, *tname; - register int i = 0; - - if ((tname = (char *)name)) { - tname--; - while (!is_EOF(bits = next_char(ch, tname))) { - if (is_binding (bits)) { - if (i) { - /* Found a complete name */ - *quarks++ = _XrmInternalStringToQuark(name,tname - name, - sig, False); - i = 0; - sig = 0; - } - name = tname+1; - } - else { - sig = (sig << 1) + ch; /* Compute the signature. */ - i++; - } - } - *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); - } - *quarks = NULLQUARK; -} - -void -XrmStringToBindingQuarkList( - register _Xconst char *name, - register XrmBindingList bindings, /* RETURN */ - register XrmQuarkList quarks) /* RETURN */ -{ - register XrmBits bits; - register Signature sig = 0; - register char ch, *tname; - register XrmBinding binding; - register int i = 0; - - if ((tname = (char *)name)) { - tname--; - binding = XrmBindTightly; - while (!is_EOF(bits = next_char(ch, tname))) { - if (is_binding (bits)) { - if (i) { - /* Found a complete name */ - *bindings++ = binding; - *quarks++ = _XrmInternalStringToQuark(name, tname - name, - sig, False); - - i = 0; - sig = 0; - binding = XrmBindTightly; - } - name = tname+1; - - if (ch == '*') - binding = XrmBindLoosely; - } - else { - sig = (sig << 1) + ch; /* Compute the signature. */ - i++; - } - } - *bindings = binding; - *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); - } - *quarks = NULLQUARK; -} - -#ifdef DEBUG - -static void PrintQuarkList( - XrmQuarkList quarks, - FILE *stream) -{ - Bool firstNameSeen; - - for (firstNameSeen = False; *quarks; quarks++) { - if (firstNameSeen) { - (void) fprintf(stream, "."); - } - firstNameSeen = True; - (void) fputs(XrmQuarkToString(*quarks), stream); - } -} /* PrintQuarkList */ - -#endif /* DEBUG */ - - -/* - * Fallback methods for Xrm parsing. - * Simulate a C locale. No state needed here. - */ - -static void -c_mbnoop( - XPointer state) -{ -} - -static char -c_mbchar( - XPointer state, - const char *str, - int *lenp) -{ - *lenp = 1; - return *str; -} - -static const char * -c_lcname( - XPointer state) -{ - return "C"; -} - -static const XrmMethodsRec mb_methods = { - c_mbnoop, /* mbinit */ - c_mbchar, /* mbchar */ - c_mbnoop, /* mbfinish */ - c_lcname, /* lcname */ - c_mbnoop /* destroy */ -}; - - -static XrmDatabase NewDatabase(void) -{ - register XrmDatabase db; - - db = Xmalloc(sizeof(XrmHashBucketRec)); - if (db) { - _XCreateMutex(&db->linfo); - db->table = (NTable)NULL; - db->mbstate = (XPointer)NULL; - db->methods = _XrmInitParseInfo(&db->mbstate); - if (!db->methods) - db->methods = &mb_methods; - } - return db; -} - -/* move all values from ftable to ttable, and free ftable's buckets. - * ttable is guaranteed empty to start with. - */ -static void MoveValues( - LTable ftable, - register LTable ttable) -{ - register VEntry fentry, nfentry; - register VEntry *prev; - register VEntry *bucket; - register VEntry tentry; - register int i; - - for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) { - for (fentry = *bucket++; fentry; fentry = nfentry) { - prev = &LeafHash(ttable, fentry->name); - tentry = *prev; - *prev = fentry; - /* chain on all with same name, to preserve invariant order */ - while ((nfentry = fentry->next) && nfentry->name == fentry->name) - fentry = nfentry; - fentry->next = tentry; - } - } - Xfree(ftable->buckets); -} - -/* move all tables from ftable to ttable, and free ftable. - * ttable is quaranteed empty to start with. - */ -static void MoveTables( - NTable ftable, - register NTable ttable) -{ - register NTable fentry, nfentry; - register NTable *prev; - register NTable *bucket; - register NTable tentry; - register int i; - - for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) { - for (fentry = *bucket++; fentry; fentry = nfentry) { - prev = &NodeHash(ttable, fentry->name); - tentry = *prev; - *prev = fentry; - /* chain on all with same name, to preserve invariant order */ - while ((nfentry = fentry->next) && nfentry->name == fentry->name) - fentry = nfentry; - fentry->next = tentry; - } - } - Xfree(ftable); -} - -/* grow the table, based on current number of entries */ -static void GrowTable( - NTable *prev) -{ - register NTable table; - register int i; - - table = *prev; - i = table->mask; - if (i == 255) /* biggest it gets */ - return; - while (i < 255 && GrowthPred(table->entries, i)) - i = (i << 1) + 1; - i++; /* i is now the new size */ - if (table->leaf) { - register LTable ltable; - LTableRec otable; - - ltable = (LTable)table; - /* cons up a copy to make MoveValues look symmetric */ - otable = *ltable; - ltable->buckets = Xcalloc(i, sizeof(VEntry)); - if (!ltable->buckets) { - ltable->buckets = otable.buckets; - return; - } - ltable->table.mask = i - 1; - MoveValues(&otable, ltable); - } else { - register NTable ntable; - - ntable = Xcalloc(1, sizeof(NTableRec) + (i * sizeof(NTable))); - if (!ntable) - return; - *ntable = *table; - ntable->mask = i - 1; - *prev = ntable; - MoveTables(table, ntable); - } -} - -/* merge values from ftable into *pprev, destroy ftable in the process */ -static void MergeValues( - LTable ftable, - NTable *pprev, - Bool override) -{ - register VEntry fentry, tentry; - register VEntry *prev; - register LTable ttable; - VEntry *bucket; - int i; - register XrmQuark q; - - ttable = (LTable)*pprev; - if (ftable->table.hasloose) - ttable->table.hasloose = 1; - for (i = ftable->table.mask, bucket = ftable->buckets; - i >= 0; - i--, bucket++) { - for (fentry = *bucket; fentry; ) { - q = fentry->name; - prev = &LeafHash(ttable, q); - tentry = *prev; - while (tentry && tentry->name != q) - tentry = *(prev = &tentry->next); - /* note: test intentionally uses fentry->name instead of q */ - /* permits serendipitous inserts */ - while (tentry && tentry->name == fentry->name) { - /* if tentry is earlier, skip it */ - if (!fentry->tight && tentry->tight) { - tentry = *(prev = &tentry->next); - continue; - } - if (fentry->tight != tentry->tight) { - /* no match, chain in fentry */ - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry; - ttable->table.entries++; - } else if (override) { - /* match, chain in fentry, splice out and free tentry */ - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry->next; - /* free the overridden entry */ - Xfree(tentry); - /* get next tentry */ - tentry = *prev; - } else { - /* match, discard fentry */ - prev = &tentry->next; - tentry = fentry; /* use as a temp var */ - fentry = fentry->next; - /* free the overpowered entry */ - Xfree(tentry); - /* get next tentry */ - tentry = *prev; - } - if (!fentry) - break; - } - /* at this point, tentry cannot match any fentry named q */ - /* chain in all bindings together, preserve invariant order */ - while (fentry && fentry->name == q) { - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry; - ttable->table.entries++; - } - } - } - Xfree(ftable->buckets); - Xfree(ftable); - /* resize if necessary, now that we're all done */ - GROW(pprev); -} - -/* merge tables from ftable into *pprev, destroy ftable in the process */ -static void MergeTables( - NTable ftable, - NTable *pprev, - Bool override) -{ - register NTable fentry, tentry; - NTable nfentry; - register NTable *prev; - register NTable ttable; - NTable *bucket; - int i; - register XrmQuark q; - - ttable = *pprev; - if (ftable->hasloose) - ttable->hasloose = 1; - if (ftable->hasany) - ttable->hasany = 1; - for (i = ftable->mask, bucket = NodeBuckets(ftable); - i >= 0; - i--, bucket++) { - for (fentry = *bucket; fentry; ) { - q = fentry->name; - prev = &NodeHash(ttable, q); - tentry = *prev; - while (tentry && tentry->name != q) - tentry = *(prev = &tentry->next); - /* note: test intentionally uses fentry->name instead of q */ - /* permits serendipitous inserts */ - while (tentry && tentry->name == fentry->name) { - /* if tentry is earlier, skip it */ - if ((fentry->leaf && !tentry->leaf) || - (!fentry->tight && tentry->tight && - (fentry->leaf || !tentry->leaf))) { - tentry = *(prev = &tentry->next); - continue; - } - nfentry = fentry->next; - if (fentry->leaf != tentry->leaf || - fentry->tight != tentry->tight) { - /* no match, just chain in */ - *prev = fentry; - *(prev = &fentry->next) = tentry; - ttable->entries++; - } else { - if (fentry->leaf) - MergeValues((LTable)fentry, prev, override); - else - MergeTables(fentry, prev, override); - /* bump to next tentry */ - tentry = *(prev = &(*prev)->next); - } - /* bump to next fentry */ - fentry = nfentry; - if (!fentry) - break; - } - /* at this point, tentry cannot match any fentry named q */ - /* chain in all bindings together, preserve invariant order */ - while (fentry && fentry->name == q) { - *prev = fentry; - prev = &fentry->next; - fentry = *prev; - *prev = tentry; - ttable->entries++; - } - } - } - Xfree(ftable); - /* resize if necessary, now that we're all done */ - GROW(pprev); -} - -void XrmCombineDatabase( - XrmDatabase from, XrmDatabase *into, - Bool override) -{ - register NTable *prev; - register NTable ftable, ttable, nftable; - - if (!*into) { - *into = from; - } else if (from) { - _XLockMutex(&from->linfo); - _XLockMutex(&(*into)->linfo); - if ((ftable = from->table)) { - prev = &(*into)->table; - ttable = *prev; - if (!ftable->leaf) { - nftable = ftable->next; - if (ttable && !ttable->leaf) { - /* both have node tables, merge them */ - MergeTables(ftable, prev, override); - /* bump to into's leaf table, if any */ - ttable = *(prev = &(*prev)->next); - } else { - /* into has no node table, link from's in */ - *prev = ftable; - *(prev = &ftable->next) = ttable; - } - /* bump to from's leaf table, if any */ - ftable = nftable; - } else { - /* bump to into's leaf table, if any */ - if (ttable && !ttable->leaf) - ttable = *(prev = &ttable->next); - } - if (ftable) { - /* if into has a leaf, merge, else insert */ - if (ttable) - MergeValues((LTable)ftable, prev, override); - else - *prev = ftable; - } - } - (from->methods->destroy)(from->mbstate); - _XUnlockMutex(&from->linfo); - _XFreeMutex(&from->linfo); - Xfree(from); - _XUnlockMutex(&(*into)->linfo); - } -} - -void XrmMergeDatabases( - XrmDatabase from, XrmDatabase *into) -{ - XrmCombineDatabase(from, into, True); -} - -/* store a value in the database, overriding any existing entry */ -static void PutEntry( - XrmDatabase db, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation type, - XrmValuePtr value) -{ - register NTable *pprev, *prev; - register NTable table; - register XrmQuark q; - register VEntry *vprev; - register VEntry entry; - NTable *nprev, *firstpprev; - -#define NEWTABLE(q,i) \ - table = Xmalloc(sizeof(LTableRec)); \ - if (!table) \ - return; \ - table->name = q; \ - table->hasloose = 0; \ - table->hasany = 0; \ - table->mask = 0; \ - table->entries = 0; \ - if (quarks[i]) { \ - table->leaf = 0; \ - nprev = NodeBuckets(table); \ - } else { \ - table->leaf = 1; \ - if (!(nprev = Xmalloc(sizeof(VEntry *)))) {\ - Xfree(table); \ - return; \ - } \ - ((LTable)table)->buckets = (VEntry *)nprev; \ - } \ - *nprev = (NTable)NULL; \ - table->next = *prev; \ - *prev = table - - if (!db || !*quarks) - return; - table = *(prev = &db->table); - /* if already at leaf, bump to the leaf table */ - if (!quarks[1] && table && !table->leaf) - table = *(prev = &table->next); - pprev = prev; - if (!table || (quarks[1] && table->leaf)) { - /* no top-level node table, create one and chain it in */ - NEWTABLE(NULLQUARK,1); - table->tight = 1; /* arbitrary */ - prev = nprev; - } else { - /* search along until we need a value */ - while (quarks[1]) { - q = *quarks; - table = *(prev = &NodeHash(table, q)); - while (table && table->name != q) - table = *(prev = &table->next); - if (!table) - break; /* not found */ - if (quarks[2]) { - if (table->leaf) - break; /* not found */ - } else { - if (!table->leaf) { - /* bump to leaf table, if any */ - table = *(prev = &table->next); - if (!table || table->name != q) - break; /* not found */ - if (!table->leaf) { - /* bump to leaf table, if any */ - table = *(prev = &table->next); - if (!table || table->name != q) - break; /* not found */ - } - } - } - if (*bindings == XrmBindTightly) { - if (!table->tight) - break; /* not found */ - } else { - if (table->tight) { - /* bump to loose table, if any */ - table = *(prev = &table->next); - if (!table || table->name != q || - !quarks[2] != table->leaf) - break; /* not found */ - } - } - /* found that one, bump to next quark */ - pprev = prev; - quarks++; - bindings++; - } - if (!quarks[1]) { - /* found all the way to a leaf */ - q = *quarks; - entry = *(vprev = &LeafHash((LTable)table, q)); - while (entry && entry->name != q) - entry = *(vprev = &entry->next); - /* if want loose and have tight, bump to next entry */ - if (entry && *bindings == XrmBindLoosely && entry->tight) - entry = *(vprev = &entry->next); - if (entry && entry->name == q && - (*bindings == XrmBindTightly) == entry->tight) { - /* match, need to override */ - if ((type == XrmQString) == entry->string && - entry->size == value->size) { - /* update type if not String, can be different */ - if (!entry->string) - RepType(entry) = type; - /* identical size, just overwrite value */ - memcpy(RawValue(entry), (char *)value->addr, value->size); - return; - } - /* splice out and free old entry */ - *vprev = entry->next; - Xfree(entry); - (*pprev)->entries--; - } - /* this is where to insert */ - prev = (NTable *)vprev; - } - } - /* keep the top table, because we may have to grow it */ - firstpprev = pprev; - /* iterate until we get to the leaf */ - while (quarks[1]) { - /* build a new table and chain it in */ - NEWTABLE(*quarks,2); - if (*quarks++ == XrmQANY) - (*pprev)->hasany = 1; - if (*bindings++ == XrmBindTightly) { - table->tight = 1; - } else { - table->tight = 0; - (*pprev)->hasloose = 1; - } - (*pprev)->entries++; - pprev = prev; - prev = nprev; - } - /* now allocate the value entry */ - entry = Xmalloc(((type == XrmQString) ? - sizeof(VEntryRec) : sizeof(DEntryRec)) + value->size); - if (!entry) - return; - entry->name = q = *quarks; - if (*bindings == XrmBindTightly) { - entry->tight = 1; - } else { - entry->tight = 0; - (*pprev)->hasloose = 1; - } - /* chain it in, with a bit of type cast ugliness */ - entry->next = *((VEntry *)prev); - *((VEntry *)prev) = entry; - entry->size = value->size; - if (type == XrmQString) { - entry->string = 1; - } else { - entry->string = 0; - RepType(entry) = type; - } - /* save a copy of the value */ - memcpy(RawValue(entry), (char *)value->addr, value->size); - (*pprev)->entries++; - /* this is a new leaf, need to remember it for search lists */ - if (q > maxResourceQuark) { - unsigned oldsize = (maxResourceQuark + 1) >> 3; - unsigned size = ((q | 0x7f) + 1) >> 3; /* reallocate in chunks */ - if (resourceQuarks) { - unsigned char *prevQuarks = resourceQuarks; - - resourceQuarks = Xrealloc(resourceQuarks, size); - if (!resourceQuarks) { - Xfree(prevQuarks); - } - } else - resourceQuarks = Xmalloc(size); - if (resourceQuarks) { - bzero((char *)&resourceQuarks[oldsize], size - oldsize); - maxResourceQuark = (size << 3) - 1; - } else { - maxResourceQuark = -1; - } - } - if (q > 0 && resourceQuarks) - resourceQuarks[q >> 3] |= 1 << (q & 0x7); - GROW(firstpprev); - -#undef NEWTABLE -} - -void XrmQPutResource( - XrmDatabase *pdb, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation type, - XrmValuePtr value) -{ - if (!*pdb) *pdb = NewDatabase(); - _XLockMutex(&(*pdb)->linfo); - PutEntry(*pdb, bindings, quarks, type, value); - _XUnlockMutex(&(*pdb)->linfo); -} - -void -XrmPutResource( - XrmDatabase *pdb, - _Xconst char *specifier, - _Xconst char *type, - XrmValuePtr value) -{ - XrmBinding bindings[MAXDBDEPTH+1]; - XrmQuark quarks[MAXDBDEPTH+1]; - - if (!*pdb) *pdb = NewDatabase(); - _XLockMutex(&(*pdb)->linfo); - XrmStringToBindingQuarkList(specifier, bindings, quarks); - PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value); - _XUnlockMutex(&(*pdb)->linfo); -} - -void -XrmQPutStringResource( - XrmDatabase *pdb, - XrmBindingList bindings, - XrmQuarkList quarks, - _Xconst char *str) -{ - XrmValue value; - - if (!*pdb) *pdb = NewDatabase(); - value.addr = (XPointer) str; - value.size = strlen(str)+1; - _XLockMutex(&(*pdb)->linfo); - PutEntry(*pdb, bindings, quarks, XrmQString, &value); - _XUnlockMutex(&(*pdb)->linfo); -} - -/* Function Name: GetDatabase - * Description: Parses a string and stores it as a database. - * Arguments: db - the database. - * str - a pointer to the string containing the database. - * filename - source filename, if any. - * doall - whether to do all lines or just one - */ - -/* - * This function is highly optimized to inline as much as possible. - * Be very careful with modifications, or simplifications, as they - * may adversely affect the performance. - * - * Chris Peterson, MIT X Consortium 5/17/90. - */ - -/* - * Xlib spec says max 100 quarks in a lookup, will stop and return if - * return if any single production's lhs has more than 100 components. - */ -#define QLIST_SIZE 100 - -/* - * This should be big enough to handle things like the XKeysymDB or biggish - * ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on - * the heap. - */ -#define DEF_BUFF_SIZE 8192 - -static void GetIncludeFile( - XrmDatabase db, - _Xconst char *base, - _Xconst char *fname, - int fnamelen, - int depth); - -static void GetDatabase( - XrmDatabase db, - _Xconst char *str, - _Xconst char *filename, - Bool doall, - int depth) -{ - char *rhs; - char *lhs, lhs_s[DEF_BUFF_SIZE]; - XrmQuark quarks[QLIST_SIZE + 1]; /* allow for a terminal NullQuark */ - XrmBinding bindings[QLIST_SIZE + 1]; - - register char *ptr; - register XrmBits bits = 0; - register char c; - register Signature sig; - register char *ptr_max; - register int num_quarks; - register XrmBindingList t_bindings; - - int len, alloc_chars; - unsigned long str_len; - XrmValue value; - Bool only_pcs; - Bool dolines; - - if (!db) - return; - - /* - * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for - * speed otherwise malloc the buffer. From a buffer overflow standpoint - * we can be sure that neither: a) a component on the lhs, or b) a - * value on the rhs, will be longer than the overall length of str, - * i.e. strlen(str). - * - * This should give good performance when parsing "*foo: bar" type - * databases as might be passed with -xrm command line options; but - * with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB - * files, the size of the buffers will be overly large. One way - * around this would be to double-parse each production with a resulting - * performance hit. In any event we can be assured that a lhs component - * name or a rhs value won't be longer than str itself. - */ - - str_len = strlen (str); - if (DEF_BUFF_SIZE > str_len) lhs = lhs_s; - else if ((lhs = Xmalloc (str_len)) == NULL) - return; - - alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE; - if ((rhs = Xmalloc (alloc_chars)) == NULL) { - if (lhs != lhs_s) Xfree (lhs); - return; - } - - (*db->methods->mbinit)(db->mbstate); - str--; - dolines = True; - while (!is_EOF(bits) && dolines) { - dolines = doall; - - /* - * First: Remove extra whitespace. - */ - - do { - bits = next_char(c, str); - } while is_space(bits); - - /* - * Ignore empty lines. - */ - - if (is_EOL(bits)) - continue; /* start a new line. */ - - /* - * Second: check the first character in a line to see if it is - * "!" signifying a comment, or "#" signifying a directive. - */ - - if (c == '!') { /* Comment, spin to next newline */ - while (is_simple(bits = next_char(c, str))) {} - if (is_EOL(bits)) - continue; - while (!is_EOL(bits = next_mbchar(c, len, str))) {} - str--; - continue; /* start a new line. */ - } - - if (c == '#') { /* Directive */ - /* remove extra whitespace */ - only_pcs = True; - while (is_space(bits = next_char(c, str))) {}; - /* only "include" directive is currently defined */ - if (!strncmp(str, "include", 7)) { - str += (7-1); - /* remove extra whitespace */ - while (is_space(bits = next_char(c, str))) {}; - /* must have a starting " */ - if (c == '"') { - _Xconst char *fname = str+1; - len = 0; - do { - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - } while (c != '"' && !is_EOL(bits)); - /* must have an ending " */ - if (c == '"') - GetIncludeFile(db, filename, fname, str - len - fname, - depth); - } - } - /* spin to next newline */ - if (only_pcs) { - while (is_simple(bits)) - bits = next_char(c, str); - if (is_EOL(bits)) - continue; - } - while (!is_EOL(bits)) - bits = next_mbchar(c, len, str); - str--; - continue; /* start a new line. */ - } - - /* - * Third: loop through the LHS of the resource specification - * storing characters and converting this to a Quark. - */ - - num_quarks = 0; - t_bindings = bindings; - - sig = 0; - ptr = lhs; - *t_bindings = XrmBindTightly; - for(;;) { - if (!is_binding(bits)) { - while (!is_EOQ(bits)) { - *ptr++ = c; - sig = (sig << 1) + c; /* Compute the signature. */ - bits = next_char(c, str); - } - - quarks[num_quarks++] = - _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False); - - if (num_quarks > QLIST_SIZE) { - Xfree(rhs); - if (lhs != lhs_s) Xfree (lhs); - (*db->methods->mbfinish)(db->mbstate); - return; - } - - if (is_separator(bits)) { - if (!is_space(bits)) - break; - - /* Remove white space */ - do { - *ptr++ = c; - sig = (sig << 1) + c; /* Compute the signature. */ - } while (is_space(bits = next_char(c, str))); - - /* - * The spec doesn't permit it, but support spaces - * internal to resource name/class - */ - - if (is_separator(bits)) - break; - num_quarks--; - continue; - } - - if (c == '.') - *(++t_bindings) = XrmBindTightly; - else - *(++t_bindings) = XrmBindLoosely; - - sig = 0; - ptr = lhs; - } - else { - /* - * Magic unspecified feature #254. - * - * If two separators appear with no Text between them then - * ignore them. - * - * If anyone of those separators is a '*' then the binding - * will be loose, otherwise it will be tight. - */ - - if (c == '*') - *t_bindings = XrmBindLoosely; - } - - bits = next_char(c, str); - } - - quarks[num_quarks] = NULLQUARK; - - /* - * Make sure that there is a ':' in this line. - */ - - if (c != ':') { - char oldc; - - /* - * A parsing error has occured, toss everything on the line - * a new_line can still be escaped with a '\'. - */ - - while (is_normal(bits)) - bits = next_char(c, str); - if (is_EOL(bits)) - continue; - bits = next_mbchar(c, len, str); - do { - oldc = c; - bits = next_mbchar(c, len, str); - } while (c && (c != '\n' || oldc == '\\')); - str--; - continue; - } - - /* - * I now have a quark and binding list for the entire left hand - * side. "c" currently points to the ":" separating the left hand - * side for the right hand side. It is time to begin processing - * the right hand side. - */ - - /* - * Fourth: Remove more whitespace - */ - - for(;;) { - if (is_space(bits = next_char(c, str))) - continue; - if (c != '\\') - break; - bits = next_char(c, str); - if (c == '\n') - continue; - str--; - bits = BSLASH; - c = '\\'; - break; - } - - /* - * Fifth: Process the right hand side. - */ - - ptr = rhs; - ptr_max = ptr + alloc_chars - 4; - only_pcs = True; - len = 1; - - for(;;) { - - /* - * Tight loop for the normal case: Non backslash, non-end of value - * character that will fit into the allocated buffer. - */ - - if (only_pcs) { - while (is_normal(bits) && ptr < ptr_max) { - *ptr++ = c; - bits = next_char(c, str); - } - if (is_EOL(bits)) - break; - if (is_nonpcs(bits)) { - only_pcs = False; - bits = next_mbchar(c, len, str); - } - } - while (!is_special(bits) && ptr + len <= ptr_max) { - len = -len; - while (len) - *ptr++ = str[len++]; - if (*str == '\0') { - bits = EOS; - break; - } - bits = next_mbchar(c, len, str); - } - - if (is_EOL(bits)) { - str--; - break; - } - - if (c == '\\') { - /* - * We need to do some magic after a backslash. - */ - Bool read_next = True; - - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - - if (is_EOL(bits)) { - if (is_EOF(bits)) - continue; - } else if (c == 'n') { - /* - * "\n" means insert a newline. - */ - *ptr++ = '\n'; - } else if (c == '\\') { - /* - * "\\" completes to just one backslash. - */ - *ptr++ = '\\'; - } else { - /* - * pick up to three octal digits after the '\'. - */ - char temp[3]; - int count = 0; - while (is_odigit(bits) && count < 3) { - temp[count++] = c; - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - } - - /* - * If we found three digits then insert that octal code - * into the value string as a character. - */ - - if (count == 3) { - *ptr++ = (unsigned char) ((temp[0] - '0') * 0100 + - (temp[1] - '0') * 010 + - (temp[2] - '0')); - } - else { - int tcount; - - /* - * Otherwise just insert those characters into the - * string, since no special processing is needed on - * numerics we can skip the special processing. - */ - - for (tcount = 0; tcount < count; tcount++) { - *ptr++ = temp[tcount]; /* print them in - the correct order */ - } - } - read_next = False; - } - if (read_next) { - if (only_pcs) { - bits = next_char(c, str); - if (is_nonpcs(bits)) - only_pcs = False; - } - if (!only_pcs) - bits = next_mbchar(c, len, str); - } - } - - /* - * It is important to make sure that there is room for at least - * four more characters in the buffer, since I can add that - * many characters into the buffer after a backslash has occured. - */ - - if (ptr + len > ptr_max) { - char * temp_str; - - alloc_chars += BUFSIZ/10; - temp_str = Xrealloc(rhs, sizeof(char) * alloc_chars); - - if (!temp_str) { - Xfree(rhs); - if (lhs != lhs_s) Xfree (lhs); - (*db->methods->mbfinish)(db->mbstate); - return; - } - - ptr = temp_str + (ptr - rhs); /* reset pointer. */ - rhs = temp_str; - ptr_max = rhs + alloc_chars - 4; - } - } - - /* - * Lastly: Terminate the value string, and store this entry - * into the database. - */ - - *ptr++ = '\0'; - - /* Store it in database */ - value.size = ptr - rhs; - value.addr = (XPointer) rhs; - - PutEntry(db, bindings, quarks, XrmQString, &value); - } - - if (lhs != lhs_s) Xfree (lhs); - Xfree (rhs); - - (*db->methods->mbfinish)(db->mbstate); -} - -void -XrmPutStringResource( - XrmDatabase *pdb, - _Xconst char*specifier, - _Xconst char*str) -{ - XrmValue value; - XrmBinding bindings[MAXDBDEPTH+1]; - XrmQuark quarks[MAXDBDEPTH+1]; - - if (!*pdb) *pdb = NewDatabase(); - XrmStringToBindingQuarkList(specifier, bindings, quarks); - value.addr = (XPointer) str; - value.size = strlen(str)+1; - _XLockMutex(&(*pdb)->linfo); - PutEntry(*pdb, bindings, quarks, XrmQString, &value); - _XUnlockMutex(&(*pdb)->linfo); -} - - -void -XrmPutLineResource( - XrmDatabase *pdb, - _Xconst char*line) -{ - if (!*pdb) *pdb = NewDatabase(); - _XLockMutex(&(*pdb)->linfo); - GetDatabase(*pdb, line, (char *)NULL, False, 0); - _XUnlockMutex(&(*pdb)->linfo); -} - -XrmDatabase -XrmGetStringDatabase( - _Xconst char *data) -{ - XrmDatabase db; - - db = NewDatabase(); - _XLockMutex(&db->linfo); - GetDatabase(db, data, (char *)NULL, True, 0); - _XUnlockMutex(&db->linfo); - return db; -} - -/* Function Name: ReadInFile - * Description: Reads the file into a buffer. - * Arguments: filename - the name of the file. - * Returns: An allocated string containing the contents of the file. - */ - -static char * -ReadInFile(_Xconst char *filename) -{ - register int fd, size; - char * filebuf; - - /* - * MS-Windows and OS/2 note: Default open mode includes O_TEXT - */ - if ( (fd = _XOpenFile (filename, O_RDONLY)) == -1 ) - return (char *)NULL; - - /* - * MS-Windows and OS/2 note: depending on how the sources are - * untarred, the newlines in resource files may or may not have - * been expanded to CRLF. Either way the size returned by fstat - * is sufficient to read the file into because in text-mode any - * CRLFs in a file will be converted to newlines (LF) with the - * result that the number of bytes actually read with be <= - * to the size returned by fstat. - */ - { - struct stat status_buffer; - if ( ((fstat(fd, &status_buffer)) == -1 ) || - (status_buffer.st_size >= INT_MAX) ) { - close (fd); - return (char *)NULL; - } else - size = (int) status_buffer.st_size; - } - - if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */ - close(fd); - return (char *)NULL; - } - size = read (fd, filebuf, size); - - if (size < 0) { - close (fd); - Xfree(filebuf); - return (char *)NULL; - } - close (fd); - - filebuf[size] = '\0'; /* NULL terminate it. */ - return filebuf; -} - -static void -GetIncludeFile( - XrmDatabase db, - _Xconst char *base, - _Xconst char *fname, - int fnamelen, - int depth) -{ - int len; - char *str; - char realfname[BUFSIZ]; - - if (fnamelen <= 0 || fnamelen >= BUFSIZ) - return; - if (depth >= MAXDBDEPTH) - return; - if (*fname != '/' && base && (str = strrchr(base, '/'))) { - len = str - base + 1; - if (len + fnamelen >= BUFSIZ) - return; - strncpy(realfname, base, len); - strncpy(realfname + len, fname, fnamelen); - realfname[len + fnamelen] = '\0'; - } else { - strncpy(realfname, fname, fnamelen); - realfname[fnamelen] = '\0'; - } - if (!(str = ReadInFile(realfname))) - return; - GetDatabase(db, str, realfname, True, depth + 1); - Xfree(str); -} - -XrmDatabase -XrmGetFileDatabase( - _Xconst char *filename) -{ - XrmDatabase db; - char *str; - - if (!(str = ReadInFile(filename))) - return (XrmDatabase)NULL; - - db = NewDatabase(); - _XLockMutex(&db->linfo); - GetDatabase(db, str, filename, True, 0); - _XUnlockMutex(&db->linfo); - Xfree(str); - return db; -} - -Status -XrmCombineFileDatabase( - _Xconst char *filename, - XrmDatabase *target, - Bool override) -{ - XrmDatabase db; - char *str; - - if (!(str = ReadInFile(filename))) - return 0; - if (override) { - db = *target; - if (!db) - *target = db = NewDatabase(); - } else - db = NewDatabase(); - _XLockMutex(&db->linfo); - GetDatabase(db, str, filename, True, 0); - _XUnlockMutex(&db->linfo); - Xfree(str); - if (!override) - XrmCombineDatabase(db, target, False); - return 1; -} - -/* call the user proc for every value in the table, arbitrary order. - * stop if user proc returns True. level is current depth in database. - */ -/*ARGSUSED*/ -static Bool EnumLTable( - LTable table, - XrmNameList names, - XrmClassList classes, - register int level, - register EClosure closure) -{ - register VEntry *bucket; - register int i; - register VEntry entry; - XrmValue value; - XrmRepresentation type; - Bool tightOk; - - closure->bindings[level] = (table->table.tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = table->table.name; - level++; - tightOk = !*names; - closure->quarks[level + 1] = NULLQUARK; - for (i = table->table.mask, bucket = table->buckets; - i >= 0; - i--, bucket++) { - for (entry = *bucket; entry; entry = entry->next) { - if (entry->tight && !tightOk) - continue; - closure->bindings[level] = (entry->tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = entry->name; - value.size = entry->size; - if (entry->string) { - type = XrmQString; - value.addr = StringValue(entry); - } else { - type = RepType(entry); - value.addr = DataValue(entry); - } - if ((*closure->proc)(&closure->db, closure->bindings+1, - closure->quarks+1, &type, &value, - closure->closure)) - return True; - } - } - return False; -} - -static Bool EnumAllNTable( - NTable table, - register int level, - register EClosure closure) -{ - register NTable *bucket; - register int i; - register NTable entry; - XrmQuark empty = NULLQUARK; - - if (level >= MAXDBDEPTH) - return False; - for (i = table->mask, bucket = NodeBuckets(table); - i >= 0; - i--, bucket++) { - for (entry = *bucket; entry; entry = entry->next) { - if (entry->leaf) { - if (EnumLTable((LTable)entry, &empty, &empty, level, closure)) - return True; - } else { - closure->bindings[level] = (entry->tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = entry->name; - if (EnumAllNTable(entry, level+1, closure)) - return True; - } - } - } - return False; -} - -/* recurse on every table in the table, arbitrary order. - * stop if user proc returns True. level is current depth in database. - */ -static Bool EnumNTable( - NTable table, - XrmNameList names, - XrmClassList classes, - register int level, - register EClosure closure) -{ - register NTable entry; - register XrmQuark q; - register unsigned int leaf; - Bool (*get)( - NTable table, - XrmNameList names, - XrmClassList classes, - register int level, - EClosure closure); - Bool bilevel; - -/* find entries named ename, leafness leaf, tight or loose, and call get */ -#define ITIGHTLOOSE(ename) \ - NFIND(ename); \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if (!leaf && !entry->tight && entry->next && \ - entry->next->name == q && entry->next->tight && \ - (bilevel || entry->next->hasloose) && \ - EnumLTable((LTable)entry->next, names+1, classes+1, \ - level, closure)) \ - return True; \ - if ((*get)(entry, names+1, classes+1, level, closure)) \ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && leaf == entry->leaf && \ - (*get)(entry, names+1, classes+1, level, closure)) \ - return True; \ - } else if (entry->leaf) { \ - if ((bilevel || entry->hasloose) && \ - EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && (bilevel || entry->hasloose) && \ - EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ - return True; \ - } \ - } - -/* find entries named ename, leafness leaf, loose only, and call get */ -#define ILOOSE(ename) \ - NFIND(ename); \ - if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ - entry = (NTable)NULL; \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if ((*get)(entry, names+1, classes+1, level, closure)) \ - return True; \ - } else if (entry->leaf && (bilevel || entry->hasloose)) { \ - if (EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ - return True; \ - } \ - } - - if (level >= MAXDBDEPTH) - return False; - closure->bindings[level] = (table->tight ? - XrmBindTightly : XrmBindLoosely); - closure->quarks[level] = table->name; - level++; - if (!*names) { - if (EnumAllNTable(table, level, closure)) - return True; - } else { - if (names[1] || closure->mode == XrmEnumAllLevels) { - get = EnumNTable; /* recurse */ - leaf = 0; - bilevel = !names[1]; - } else { - get = (getNTableEProcp)EnumLTable; /* bottom of recursion */ - leaf = 1; - bilevel = False; - } - if (table->hasloose && closure->mode == XrmEnumAllLevels) { - NTable *bucket; - int i; - XrmQuark empty = NULLQUARK; - - for (i = table->mask, bucket = NodeBuckets(table); - i >= 0; - i--, bucket++) { - q = NULLQUARK; - for (entry = *bucket; entry; entry = entry->next) { - if (!entry->tight && entry->name != q && - entry->name != *names && entry->name != *classes) { - q = entry->name; - if (entry->leaf) { - if (EnumLTable((LTable)entry, &empty, &empty, - level, closure)) - return True; - } else { - if (EnumNTable(entry, &empty, &empty, - level, closure)) - return True; - } - } - } - } - } - - ITIGHTLOOSE(*names); /* do name, tight and loose */ - ITIGHTLOOSE(*classes); /* do class, tight and loose */ - if (table->hasany) { - ITIGHTLOOSE(XrmQANY); /* do ANY, tight and loose */ - } - if (table->hasloose) { - while (1) { - names++; - classes++; - if (!*names) - break; - if (!names[1] && closure->mode != XrmEnumAllLevels) { - get = (getNTableEProcp)EnumLTable; /* bottom of recursion */ - leaf = 1; - } - ILOOSE(*names); /* loose names */ - ILOOSE(*classes); /* loose classes */ - if (table->hasany) { - ILOOSE(XrmQANY); /* loose ANY */ - } - } - names--; - classes--; - } - } - /* now look for matching leaf nodes */ - entry = table->next; - if (!entry) - return False; - if (entry->leaf) { - if (entry->tight && !table->tight) - entry = entry->next; - } else { - entry = entry->next; - if (!entry || !entry->tight) - return False; - } - if (!entry || entry->name != table->name) - return False; - /* found one */ - level--; - if ((!*names || entry->hasloose) && - EnumLTable((LTable)entry, names, classes, level, closure)) - return True; - if (entry->tight && entry == table->next && (entry = entry->next) && - entry->name == table->name && (!*names || entry->hasloose)) - return EnumLTable((LTable)entry, names, classes, level, closure); - return False; - -#undef ITIGHTLOOSE -#undef ILOOSE -} - -/* call the proc for every value in the database, arbitrary order. - * stop if the proc returns True. - */ -Bool XrmEnumerateDatabase( - XrmDatabase db, - XrmNameList names, - XrmClassList classes, - int mode, - DBEnumProc proc, - XPointer closure) -{ - XrmBinding bindings[MAXDBDEPTH+2]; - XrmQuark quarks[MAXDBDEPTH+2]; - register NTable table; - EClosureRec eclosure; - Bool retval = False; - - if (!db) - return False; - _XLockMutex(&db->linfo); - eclosure.db = db; - eclosure.proc = proc; - eclosure.closure = closure; - eclosure.bindings = bindings; - eclosure.quarks = quarks; - eclosure.mode = mode; - table = db->table; - if (table && !table->leaf && !*names && mode == XrmEnumOneLevel) - table = table->next; - if (table) { - if (!table->leaf) - retval = EnumNTable(table, names, classes, 0, &eclosure); - else - retval = EnumLTable((LTable)table, names, classes, 0, &eclosure); - } - _XUnlockMutex(&db->linfo); - return retval; -} - -static void PrintBindingQuarkList( - XrmBindingList bindings, - XrmQuarkList quarks, - FILE *stream) -{ - Bool firstNameSeen; - - for (firstNameSeen = False; *quarks; bindings++, quarks++) { - if (*bindings == XrmBindLoosely) { - (void) fprintf(stream, "*"); - } else if (firstNameSeen) { - (void) fprintf(stream, "."); - } - firstNameSeen = True; - (void) fputs(XrmQuarkToString(*quarks), stream); - } -} - -/* output out the entry in correct file syntax */ -/*ARGSUSED*/ -static Bool DumpEntry( - XrmDatabase *db, - XrmBindingList bindings, - XrmQuarkList quarks, - XrmRepresentation *type, - XrmValuePtr value, - XPointer data) -{ - FILE *stream = (FILE *)data; - register unsigned int i; - register char *s; - register char c; - - if (*type != XrmQString) - (void) putc('!', stream); - PrintBindingQuarkList(bindings, quarks, stream); - s = value->addr; - i = value->size; - if (*type == XrmQString) { - (void) fputs(":\t", stream); - if (i) - i--; - } - else - (void) fprintf(stream, "=%s:\t", XrmRepresentationToString(*type)); - if (i && (*s == ' ' || *s == '\t')) - (void) putc('\\', stream); /* preserve leading whitespace */ - while (i--) { - c = *s++; - if (c == '\n') { - if (i) - (void) fputs("\\n\\\n", stream); - else - (void) fputs("\\n", stream); - } else if (c == '\\') - (void) fputs("\\\\", stream); - else if ((c < ' ' && c != '\t') || - ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0)) - (void) fprintf(stream, "\\%03o", (unsigned char)c); - else - (void) putc(c, stream); - } - (void) putc('\n', stream); - return ferror(stream) != 0; -} - -#ifdef DEBUG - -void PrintTable( - NTable table, - FILE *file) -{ - XrmBinding bindings[MAXDBDEPTH+1]; - XrmQuark quarks[MAXDBDEPTH+1]; - EClosureRec closure; - XrmQuark empty = NULLQUARK; - - closure.db = (XrmDatabase)NULL; - closure.proc = DumpEntry; - closure.closure = (XPointer)file; - closure.bindings = bindings; - closure.quarks = quarks; - closure.mode = XrmEnumAllLevels; - if (table->leaf) - EnumLTable((LTable)table, &empty, &empty, 0, &closure); - else - EnumNTable(table, &empty, &empty, 0, &closure); -} - -#endif /* DEBUG */ - -void -XrmPutFileDatabase( - XrmDatabase db, - _Xconst char *fileName) -{ - FILE *file; - XrmQuark empty = NULLQUARK; - - if (!db) return; - if (!(file = fopen(fileName, "w"))) return; - if (XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, - DumpEntry, (XPointer) file)) - unlink((char *)fileName); - fclose(file); -} - -/* macros used in get/search functions */ - -/* find entries named ename, leafness leaf, tight or loose, and call get */ -#define GTIGHTLOOSE(ename,looseleaf) \ - NFIND(ename); \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if (!leaf && !entry->tight && entry->next && \ - entry->next->name == q && entry->next->tight && \ - entry->next->hasloose && \ - looseleaf((LTable)entry->next, names+1, classes+1, closure)) \ - return True; \ - if ((*get)(entry, names+1, classes+1, closure)) \ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && leaf == entry->leaf && \ - (*get)(entry, names+1, classes+1, closure)) \ - return True; \ - } else if (entry->leaf) { \ - if (entry->hasloose && \ - looseleaf((LTable)entry, names+1, classes+1, closure)) \ - return True; \ - if (entry->tight && (entry = entry->next) && \ - entry->name == q && entry->hasloose && \ - looseleaf((LTable)entry, names+1, classes+1, closure)) \ - return True; \ - } \ - } - -/* find entries named ename, leafness leaf, loose only, and call get */ -#define GLOOSE(ename,looseleaf) \ - NFIND(ename); \ - if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ - entry = (NTable)NULL; \ - if (entry) { \ - if (leaf == entry->leaf) { \ - if ((*get)(entry, names+1, classes+1, closure)) \ - return True; \ - } else if (entry->leaf && entry->hasloose) { \ - if (looseleaf((LTable)entry, names+1, classes+1, closure)) \ - return True; \ - } \ - } - -/* add tight/loose entry to the search list, return True if list is full */ -/*ARGSUSED*/ -static Bool AppendLEntry( - LTable table, - XrmNameList names, - XrmClassList classes, - register SClosure closure) -{ - /* check for duplicate */ - if (closure->idx >= 0 && closure->list[closure->idx] == table) - return False; - if (closure->idx == closure->limit) - return True; - /* append it */ - closure->idx++; - closure->list[closure->idx] = table; - return False; -} - -/* add loose entry to the search list, return True if list is full */ -/*ARGSUSED*/ -static Bool AppendLooseLEntry( - LTable table, - XrmNameList names, - XrmClassList classes, - register SClosure closure) -{ - /* check for duplicate */ - if (closure->idx >= 0 && closure->list[closure->idx] == table) - return False; - if (closure->idx >= closure->limit - 1) - return True; - /* append it */ - closure->idx++; - closure->list[closure->idx] = LOOSESEARCH; - closure->idx++; - closure->list[closure->idx] = table; - return False; -} - -/* search for a leaf table */ -static Bool SearchNEntry( - NTable table, - XrmNameList names, - XrmClassList classes, - SClosure closure) -{ - register NTable entry; - register XrmQuark q; - register unsigned int leaf; - Bool (*get)( - NTable table, - XrmNameList names, - XrmClassList classes, - SClosure closure); - - if (names[1]) { - get = SearchNEntry; /* recurse */ - leaf = 0; - } else { - get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */ - leaf = 1; - } - GTIGHTLOOSE(*names, AppendLooseLEntry); /* do name, tight and loose */ - GTIGHTLOOSE(*classes, AppendLooseLEntry); /* do class, tight and loose */ - if (table->hasany) { - GTIGHTLOOSE(XrmQANY, AppendLooseLEntry); /* do ANY, tight and loose */ - } - if (table->hasloose) { - while (1) { - names++; - classes++; - if (!*names) - break; - if (!names[1]) { - get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */ - leaf = 1; - } - GLOOSE(*names, AppendLooseLEntry); /* loose names */ - GLOOSE(*classes, AppendLooseLEntry); /* loose classes */ - if (table->hasany) { - GLOOSE(XrmQANY, AppendLooseLEntry); /* loose ANY */ - } - } - } - /* now look for matching leaf nodes */ - entry = table->next; - if (!entry) - return False; - if (entry->leaf) { - if (entry->tight && !table->tight) - entry = entry->next; - } else { - entry = entry->next; - if (!entry || !entry->tight) - return False; - } - if (!entry || entry->name != table->name) - return False; - /* found one */ - if (entry->hasloose && - AppendLooseLEntry((LTable)entry, names, classes, closure)) - return True; - if (entry->tight && entry == table->next && (entry = entry->next) && - entry->name == table->name && entry->hasloose) - return AppendLooseLEntry((LTable)entry, names, classes, closure); - return False; -} - -Bool XrmQGetSearchList( - XrmDatabase db, - XrmNameList names, - XrmClassList classes, - XrmSearchList searchList, /* RETURN */ - int listLength) -{ - register NTable table; - SClosureRec closure; - - if (listLength <= 0) - return False; - closure.list = (LTable *)searchList; - closure.idx = -1; - closure.limit = listLength - 2; - if (db) { - _XLockMutex(&db->linfo); - table = db->table; - if (*names) { - if (table && !table->leaf) { - if (SearchNEntry(table, names, classes, &closure)) { - _XUnlockMutex(&db->linfo); - return False; - } - } else if (table && table->hasloose && - AppendLooseLEntry((LTable)table, names, classes, - &closure)) { - _XUnlockMutex(&db->linfo); - return False; - } - } else { - if (table && !table->leaf) - table = table->next; - if (table && - AppendLEntry((LTable)table, names, classes, &closure)) { - _XUnlockMutex(&db->linfo); - return False; - } - } - _XUnlockMutex(&db->linfo); - } - closure.list[closure.idx + 1] = (LTable)NULL; - return True; -} - -Bool XrmQGetSearchResource( - XrmSearchList searchList, - register XrmName name, - register XrmClass class, - XrmRepresentation *pType, /* RETURN */ - XrmValue *pValue) /* RETURN */ -{ - register LTable *list; - register LTable table; - register VEntry entry = NULL; - int flags; - -/* find tight or loose entry */ -#define VTIGHTLOOSE(q) \ - entry = LeafHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (entry) \ - break - -/* find loose entry */ -#define VLOOSE(q) \ - entry = LeafHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (entry) { \ - if (!entry->tight) \ - break; \ - if ((entry = entry->next) && entry->name == q) \ - break; \ - } - - list = (LTable *)searchList; - /* figure out which combination of name and class we need to search for */ - flags = 0; - if (IsResourceQuark(name)) - flags = 2; - if (IsResourceQuark(class)) - flags |= 1; - if (!flags) { - /* neither name nor class has ever been used to name a resource */ - table = (LTable)NULL; - } else if (flags == 3) { - /* both name and class */ - while ((table = *list++)) { - if (table != LOOSESEARCH) { - VTIGHTLOOSE(name); /* do name, tight and loose */ - VTIGHTLOOSE(class); /* do class, tight and loose */ - } else { - table = *list++; - VLOOSE(name); /* do name, loose only */ - VLOOSE(class); /* do class, loose only */ - } - } - } else { - /* just one of name or class */ - if (flags == 1) - name = class; - while ((table = *list++)) { - if (table != LOOSESEARCH) { - VTIGHTLOOSE(name); /* tight and loose */ - } else { - table = *list++; - VLOOSE(name); /* loose only */ - } - } - } - if (table) { - /* found a match */ - if (entry->string) { - *pType = XrmQString; - pValue->addr = StringValue(entry); - } else { - *pType = RepType(entry); - pValue->addr = DataValue(entry); - } - pValue->size = entry->size; - return True; - } - *pType = NULLQUARK; - pValue->addr = (XPointer)NULL; - pValue->size = 0; - return False; - -#undef VTIGHTLOOSE -#undef VLOOSE -} - -/* look for a tight/loose value */ -static Bool GetVEntry( - LTable table, - XrmNameList names, - XrmClassList classes, - VClosure closure) -{ - register VEntry entry; - register XrmQuark q; - - /* try name first */ - q = *names; - entry = LeafHash(table, q); - while (entry && entry->name != q) - entry = entry->next; - if (!entry) { - /* not found, try class */ - q = *classes; - entry = LeafHash(table, q); - while (entry && entry->name != q) - entry = entry->next; - if (!entry) - return False; - } - if (entry->string) { - *closure->type = XrmQString; - closure->value->addr = StringValue(entry); - } else { - *closure->type = RepType(entry); - closure->value->addr = DataValue(entry); - } - closure->value->size = entry->size; - return True; -} - -/* look for a loose value */ -static Bool GetLooseVEntry( - LTable table, - XrmNameList names, - XrmClassList classes, - VClosure closure) -{ - register VEntry entry; - register XrmQuark q; - -#define VLOOSE(ename) \ - q = ename; \ - entry = LeafHash(table, q); \ - while (entry && entry->name != q) \ - entry = entry->next; \ - if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ - entry = (VEntry)NULL; - - /* bump to last component */ - while (names[1]) { - names++; - classes++; - } - VLOOSE(*names); /* do name, loose only */ - if (!entry) { - VLOOSE(*classes); /* do class, loose only */ - if (!entry) - return False; - } - if (entry->string) { - *closure->type = XrmQString; - closure->value->addr = StringValue(entry); - } else { - *closure->type = RepType(entry); - closure->value->addr = DataValue(entry); - } - closure->value->size = entry->size; - return True; - -#undef VLOOSE -} - -/* recursive search for a value */ -static Bool GetNEntry( - NTable table, - XrmNameList names, - XrmClassList classes, - VClosure closure) -{ - register NTable entry; - register XrmQuark q; - register unsigned int leaf; - Bool (*get)( - NTable table, - XrmNameList names, - XrmClassList classes, - VClosure closure); - NTable otable; - - if (names[2]) { - get = GetNEntry; /* recurse */ - leaf = 0; - } else { - get = (getNTableVProcp)GetVEntry; /* bottom of recursion */ - leaf = 1; - } - GTIGHTLOOSE(*names, GetLooseVEntry); /* do name, tight and loose */ - GTIGHTLOOSE(*classes, GetLooseVEntry); /* do class, tight and loose */ - if (table->hasany) { - GTIGHTLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, tight and loose */ - } - if (table->hasloose) { - while (1) { - names++; - classes++; - if (!names[1]) - break; - if (!names[2]) { - get = (getNTableVProcp)GetVEntry; /* bottom of recursion */ - leaf = 1; - } - GLOOSE(*names, GetLooseVEntry); /* do name, loose only */ - GLOOSE(*classes, GetLooseVEntry); /* do class, loose only */ - if (table->hasany) { - GLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, loose only */ - } - } - } - /* look for matching leaf tables */ - otable = table; - table = table->next; - if (!table) - return False; - if (table->leaf) { - if (table->tight && !otable->tight) - table = table->next; - } else { - table = table->next; - if (!table || !table->tight) - return False; - } - if (!table || table->name != otable->name) - return False; - /* found one */ - if (table->hasloose && - GetLooseVEntry((LTable)table, names, classes, closure)) - return True; - if (table->tight && table == otable->next) { - table = table->next; - if (table && table->name == otable->name && table->hasloose) - return GetLooseVEntry((LTable)table, names, classes, closure); - } - return False; -} - -Bool XrmQGetResource( - XrmDatabase db, - XrmNameList names, - XrmClassList classes, - XrmRepresentation *pType, /* RETURN */ - XrmValuePtr pValue) /* RETURN */ -{ - register NTable table; - VClosureRec closure; - - if (db && *names) { - _XLockMutex(&db->linfo); - closure.type = pType; - closure.value = pValue; - table = db->table; - if (names[1]) { - if (table && !table->leaf) { - if (GetNEntry(table, names, classes, &closure)) { - _XUnlockMutex(&db->linfo); - return True; - } - } else if (table && table->hasloose && - GetLooseVEntry((LTable)table, names, classes, &closure)) { - _XUnlockMutex (&db->linfo); - return True; - } - } else { - if (table && !table->leaf) - table = table->next; - if (table && GetVEntry((LTable)table, names, classes, &closure)) { - _XUnlockMutex(&db->linfo); - return True; - } - } - _XUnlockMutex(&db->linfo); - } - *pType = NULLQUARK; - pValue->addr = (XPointer)NULL; - pValue->size = 0; - return False; -} - -Bool -XrmGetResource(XrmDatabase db, _Xconst char *name_str, _Xconst char *class_str, - XrmString *pType_str, XrmValuePtr pValue) -{ - XrmName names[MAXDBDEPTH+1]; - XrmClass classes[MAXDBDEPTH+1]; - XrmRepresentation fromType; - Bool result; - - XrmStringToNameList(name_str, names); - XrmStringToClassList(class_str, classes); - result = XrmQGetResource(db, names, classes, &fromType, pValue); - (*pType_str) = XrmQuarkToString(fromType); - return result; -} - -/* destroy all values, plus table itself */ -static void DestroyLTable( - LTable table) -{ - register int i; - register VEntry *buckets; - register VEntry entry, next; - - buckets = table->buckets; - for (i = table->table.mask; i >= 0; i--, buckets++) { - for (next = *buckets; (entry = next); ) { - next = entry->next; - Xfree(entry); - } - } - Xfree(table->buckets); - Xfree(table); -} - -/* destroy all contained tables, plus table itself */ -static void DestroyNTable( - NTable table) -{ - register int i; - register NTable *buckets; - register NTable entry, next; - - buckets = NodeBuckets(table); - for (i = table->mask; i >= 0; i--, buckets++) { - for (next = *buckets; (entry = next); ) { - next = entry->next; - if (entry->leaf) - DestroyLTable((LTable)entry); - else - DestroyNTable(entry); - } - } - Xfree(table); -} - -const char * -XrmLocaleOfDatabase( - XrmDatabase db) -{ - const char* retval; - _XLockMutex(&db->linfo); - retval = (*db->methods->lcname)(db->mbstate); - _XUnlockMutex(&db->linfo); - return retval; -} - -void XrmDestroyDatabase( - XrmDatabase db) -{ - register NTable table, next; - - if (db) { - _XLockMutex(&db->linfo); - for (next = db->table; (table = next); ) { - next = table->next; - if (table->leaf) - DestroyLTable((LTable)table); - else - DestroyNTable(table); - } - _XUnlockMutex(&db->linfo); - _XFreeMutex(&db->linfo); - (*db->methods->destroy)(db->mbstate); - Xfree(db); - } -} diff --git a/nx-X11/lib/X11/Xutil.h b/nx-X11/lib/X11/Xutil.h deleted file mode 100644 index 48fa23cf5..000000000 --- a/nx-X11/lib/X11/Xutil.h +++ /dev/null @@ -1,839 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#if !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) -#define _X11_XUTIL_H_ -#define _XUTIL_H_ - -/* You must include before including this file */ -#include -#include - -/* The Xlib structs are full of implicit padding to properly align members. - We can't clean that up without breaking ABI, so tell clang not to bother - complaining about it. */ -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wpadded" -#endif - -/* - * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding - * value (x, y, width, height) was found in the parsed string. - */ -#define NoValue 0x0000 -#define XValue 0x0001 -#define YValue 0x0002 -#define WidthValue 0x0004 -#define HeightValue 0x0008 -#define AllValues 0x000F -#define XNegative 0x0010 -#define YNegative 0x0020 - -/* - * new version containing base_width, base_height, and win_gravity fields; - * used with WM_NORMAL_HINTS. - */ -typedef struct { - long flags; /* marks which fields in this structure are defined */ - int x, y; /* obsolete for new window mgrs, but clients */ - int width, height; /* should set so old wm's don't mess up */ - int min_width, min_height; - int max_width, max_height; - int width_inc, height_inc; - struct { - int x; /* numerator */ - int y; /* denominator */ - } min_aspect, max_aspect; - int base_width, base_height; /* added by ICCCM version 1 */ - int win_gravity; /* added by ICCCM version 1 */ -} XSizeHints; - -/* - * The next block of definitions are for window manager properties that - * clients and applications use for communication. - */ - -/* flags argument in size hints */ -#define USPosition (1L << 0) /* user specified x, y */ -#define USSize (1L << 1) /* user specified width, height */ - -#define PPosition (1L << 2) /* program specified position */ -#define PSize (1L << 3) /* program specified size */ -#define PMinSize (1L << 4) /* program specified minimum size */ -#define PMaxSize (1L << 5) /* program specified maximum size */ -#define PResizeInc (1L << 6) /* program specified resize increments */ -#define PAspect (1L << 7) /* program specified min and max aspect ratios */ -#define PBaseSize (1L << 8) /* program specified base for incrementing */ -#define PWinGravity (1L << 9) /* program specified window gravity */ - -/* obsolete */ -#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) - - - -typedef struct { - long flags; /* marks which fields in this structure are defined */ - Bool input; /* does this application rely on the window manager to - get keyboard input? */ - int initial_state; /* see below */ - Pixmap icon_pixmap; /* pixmap to be used as icon */ - Window icon_window; /* window to be used as icon */ - int icon_x, icon_y; /* initial position of icon */ - Pixmap icon_mask; /* icon mask bitmap */ - XID window_group; /* id of related window group */ - /* this structure may be extended in the future */ -} XWMHints; - -/* definition for flags of XWMHints */ - -#define InputHint (1L << 0) -#define StateHint (1L << 1) -#define IconPixmapHint (1L << 2) -#define IconWindowHint (1L << 3) -#define IconPositionHint (1L << 4) -#define IconMaskHint (1L << 5) -#define WindowGroupHint (1L << 6) -#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ -IconPositionHint|IconMaskHint|WindowGroupHint) -#define XUrgencyHint (1L << 8) - -/* definitions for initial window state */ -#define WithdrawnState 0 /* for windows that are not mapped */ -#define NormalState 1 /* most applications want to start this way */ -#define IconicState 3 /* application wants to start as an icon */ - -/* - * Obsolete states no longer defined by ICCCM - */ -#define DontCareState 0 /* don't know or care */ -#define ZoomState 2 /* application wants to start zoomed */ -#define InactiveState 4 /* application believes it is seldom used; */ - /* some wm's may put it on inactive menu */ - - -/* - * new structure for manipulating TEXT properties; used with WM_NAME, - * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. - */ -typedef struct { - unsigned char *value; /* same as Property routines */ - Atom encoding; /* prop type */ - int format; /* prop data format: 8, 16, or 32 */ - unsigned long nitems; /* number of data items in value */ -} XTextProperty; - -#define XNoMemory -1 -#define XLocaleNotSupported -2 -#define XConverterNotFound -3 - -typedef enum { - XStringStyle, /* STRING */ - XCompoundTextStyle, /* COMPOUND_TEXT */ - XTextStyle, /* text in owner's encoding (current locale)*/ - XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ - /* The following is an XFree86 extension, introduced in November 2000 */ - XUTF8StringStyle /* UTF8_STRING */ -} XICCEncodingStyle; - -typedef struct { - int min_width, min_height; - int max_width, max_height; - int width_inc, height_inc; -} XIconSize; - -typedef struct { - char *res_name; - char *res_class; -} XClassHint; - -#ifdef XUTIL_DEFINE_FUNCTIONS -extern int XDestroyImage( - XImage *ximage); -extern unsigned long XGetPixel( - XImage *ximage, - int x, int y); -extern int XPutPixel( - XImage *ximage, - int x, int y, - unsigned long pixel); -extern XImage *XSubImage( - XImage *ximage, - int x, int y, - unsigned int width, unsigned int height); -extern int XAddPixel( - XImage *ximage, - long value); -#else -/* - * These macros are used to give some sugar to the image routines so that - * naive people are more comfortable with them. - */ -#define XDestroyImage(ximage) \ - ((*((ximage)->f.destroy_image))((ximage))) -#define XGetPixel(ximage, x, y) \ - ((*((ximage)->f.get_pixel))((ximage), (x), (y))) -#define XPutPixel(ximage, x, y, pixel) \ - ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) -#define XSubImage(ximage, x, y, width, height) \ - ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) -#define XAddPixel(ximage, value) \ - ((*((ximage)->f.add_pixel))((ximage), (value))) -#endif - -/* - * Compose sequence status structure, used in calling XLookupString. - */ -typedef struct _XComposeStatus { - XPointer compose_ptr; /* state table pointer */ - int chars_matched; /* match state */ -} XComposeStatus; - -/* - * Keysym macros, used on Keysyms to test for classes of symbols - */ -#define IsKeypadKey(keysym) \ - (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) - -#define IsPrivateKeypadKey(keysym) \ - (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) - -#define IsCursorKey(keysym) \ - (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) - -#define IsPFKey(keysym) \ - (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) - -#define IsFunctionKey(keysym) \ - (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) - -#define IsMiscFunctionKey(keysym) \ - (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) - -#ifdef XK_XKB_KEYS -#define IsModifierKey(keysym) \ - ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ - || (((KeySym)(keysym) >= XK_ISO_Lock) && \ - ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \ - || ((KeySym)(keysym) == XK_Mode_switch) \ - || ((KeySym)(keysym) == XK_Num_Lock)) -#else -#define IsModifierKey(keysym) \ - ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ - || ((KeySym)(keysym) == XK_Mode_switch) \ - || ((KeySym)(keysym) == XK_Num_Lock)) -#endif -/* - * opaque reference to Region data type - */ -typedef struct _XRegion *Region; - -/* Return values from XRectInRegion() */ - -#define RectangleOut 0 -#define RectangleIn 1 -#define RectanglePart 2 - - -/* - * Information used by the visual utility routines to find desired visual - * type from the many visuals a display may support. - */ - -typedef struct { - Visual *visual; - VisualID visualid; - int screen; - int depth; -#if defined(__cplusplus) || defined(c_plusplus) - int c_class; /* C++ */ -#else - int class; -#endif - unsigned long red_mask; - unsigned long green_mask; - unsigned long blue_mask; - int colormap_size; - int bits_per_rgb; -} XVisualInfo; - -#define VisualNoMask 0x0 -#define VisualIDMask 0x1 -#define VisualScreenMask 0x2 -#define VisualDepthMask 0x4 -#define VisualClassMask 0x8 -#define VisualRedMaskMask 0x10 -#define VisualGreenMaskMask 0x20 -#define VisualBlueMaskMask 0x40 -#define VisualColormapSizeMask 0x80 -#define VisualBitsPerRGBMask 0x100 -#define VisualAllMask 0x1FF - -/* - * This defines a window manager property that clients may use to - * share standard color maps of type RGB_COLOR_MAP: - */ -typedef struct { - Colormap colormap; - unsigned long red_max; - unsigned long red_mult; - unsigned long green_max; - unsigned long green_mult; - unsigned long blue_max; - unsigned long blue_mult; - unsigned long base_pixel; - VisualID visualid; /* added by ICCCM version 1 */ - XID killid; /* added by ICCCM version 1 */ -} XStandardColormap; - -#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ - - -/* - * return codes for XReadBitmapFile and XWriteBitmapFile - */ -#define BitmapSuccess 0 -#define BitmapOpenFailed 1 -#define BitmapFileInvalid 2 -#define BitmapNoMemory 3 - -/**************************************************************** - * - * Context Management - * - ****************************************************************/ - - -/* Associative lookup table return codes */ - -#define XCSUCCESS 0 /* No error. */ -#define XCNOMEM 1 /* Out of memory */ -#define XCNOENT 2 /* No entry in table */ - -typedef int XContext; - -#define XUniqueContext() ((XContext) XrmUniqueQuark()) -#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) - -_XFUNCPROTOBEGIN - -/* The following declarations are alphabetized. */ - -extern XClassHint *XAllocClassHint ( - void -); - -extern XIconSize *XAllocIconSize ( - void -); - -extern XSizeHints *XAllocSizeHints ( - void -); - -extern XStandardColormap *XAllocStandardColormap ( - void -); - -extern XWMHints *XAllocWMHints ( - void -); - -extern int XClipBox( - Region /* r */, - XRectangle* /* rect_return */ -); - -extern Region XCreateRegion( - void -); - -extern const char *XDefaultString (void); - -extern int XDeleteContext( - Display* /* display */, - XID /* rid */, - XContext /* context */ -); - -extern int XDestroyRegion( - Region /* r */ -); - -extern int XEmptyRegion( - Region /* r */ -); - -extern int XEqualRegion( - Region /* r1 */, - Region /* r2 */ -); - -extern int XFindContext( - Display* /* display */, - XID /* rid */, - XContext /* context */, - XPointer* /* data_return */ -); - -extern Status XGetClassHint( - Display* /* display */, - Window /* w */, - XClassHint* /* class_hints_return */ -); - -extern Status XGetIconSizes( - Display* /* display */, - Window /* w */, - XIconSize** /* size_list_return */, - int* /* count_return */ -); - -extern Status XGetNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */ -); - -extern Status XGetRGBColormaps( - Display* /* display */, - Window /* w */, - XStandardColormap** /* stdcmap_return */, - int* /* count_return */, - Atom /* property */ -); - -extern Status XGetSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */, - Atom /* property */ -); - -extern Status XGetStandardColormap( - Display* /* display */, - Window /* w */, - XStandardColormap* /* colormap_return */, - Atom /* property */ -); - -extern Status XGetTextProperty( - Display* /* display */, - Window /* window */, - XTextProperty* /* text_prop_return */, - Atom /* property */ -); - -extern XVisualInfo *XGetVisualInfo( - Display* /* display */, - long /* vinfo_mask */, - XVisualInfo* /* vinfo_template */, - int* /* nitems_return */ -); - -extern Status XGetWMClientMachine( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop_return */ -); - -extern XWMHints *XGetWMHints( - Display* /* display */, - Window /* w */ -); - -extern Status XGetWMIconName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop_return */ -); - -extern Status XGetWMName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop_return */ -); - -extern Status XGetWMNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */, - long* /* supplied_return */ -); - -extern Status XGetWMSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints_return */, - long* /* supplied_return */, - Atom /* property */ -); - -extern Status XGetZoomHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* zhints_return */ -); - -extern int XIntersectRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -extern void XConvertCase( - KeySym /* sym */, - KeySym* /* lower */, - KeySym* /* upper */ -); - -extern int XLookupString( - XKeyEvent* /* event_struct */, - char* /* buffer_return */, - int /* bytes_buffer */, - KeySym* /* keysym_return */, - XComposeStatus* /* status_in_out */ -); - -extern Status XMatchVisualInfo( - Display* /* display */, - int /* screen */, - int /* depth */, - int /* class */, - XVisualInfo* /* vinfo_return */ -); - -extern int XOffsetRegion( - Region /* r */, - int /* dx */, - int /* dy */ -); - -extern Bool XPointInRegion( - Region /* r */, - int /* x */, - int /* y */ -); - -extern Region XPolygonRegion( - XPoint* /* points */, - int /* n */, - int /* fill_rule */ -); - -extern int XRectInRegion( - Region /* r */, - int /* x */, - int /* y */, - unsigned int /* width */, - unsigned int /* height */ -); - -extern int XSaveContext( - Display* /* display */, - XID /* rid */, - XContext /* context */, - _Xconst char* /* data */ -); - -extern int XSetClassHint( - Display* /* display */, - Window /* w */, - XClassHint* /* class_hints */ -); - -extern int XSetIconSizes( - Display* /* display */, - Window /* w */, - XIconSize* /* size_list */, - int /* count */ -); - -extern int XSetNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */ -); - -extern void XSetRGBColormaps( - Display* /* display */, - Window /* w */, - XStandardColormap* /* stdcmaps */, - int /* count */, - Atom /* property */ -); - -extern int XSetSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */, - Atom /* property */ -); - -extern int XSetStandardProperties( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, - Pixmap /* icon_pixmap */, - char** /* argv */, - int /* argc */, - XSizeHints* /* hints */ -); - -extern void XSetTextProperty( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */, - Atom /* property */ -); - -extern void XSetWMClientMachine( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */ -); - -extern int XSetWMHints( - Display* /* display */, - Window /* w */, - XWMHints* /* wm_hints */ -); - -extern void XSetWMIconName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */ -); - -extern void XSetWMName( - Display* /* display */, - Window /* w */, - XTextProperty* /* text_prop */ -); - -extern void XSetWMNormalHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */ -); - -extern void XSetWMProperties( - Display* /* display */, - Window /* w */, - XTextProperty* /* window_name */, - XTextProperty* /* icon_name */, - char** /* argv */, - int /* argc */, - XSizeHints* /* normal_hints */, - XWMHints* /* wm_hints */, - XClassHint* /* class_hints */ -); - -extern void XmbSetWMProperties( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, - char** /* argv */, - int /* argc */, - XSizeHints* /* normal_hints */, - XWMHints* /* wm_hints */, - XClassHint* /* class_hints */ -); - -extern void Xutf8SetWMProperties( - Display* /* display */, - Window /* w */, - _Xconst char* /* window_name */, - _Xconst char* /* icon_name */, - char** /* argv */, - int /* argc */, - XSizeHints* /* normal_hints */, - XWMHints* /* wm_hints */, - XClassHint* /* class_hints */ -); - -extern void XSetWMSizeHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* hints */, - Atom /* property */ -); - -extern int XSetRegion( - Display* /* display */, - GC /* gc */, - Region /* r */ -); - -extern void XSetStandardColormap( - Display* /* display */, - Window /* w */, - XStandardColormap* /* colormap */, - Atom /* property */ -); - -extern int XSetZoomHints( - Display* /* display */, - Window /* w */, - XSizeHints* /* zhints */ -); - -extern int XShrinkRegion( - Region /* r */, - int /* dx */, - int /* dy */ -); - -extern Status XStringListToTextProperty( - char** /* list */, - int /* count */, - XTextProperty* /* text_prop_return */ -); - -extern int XSubtractRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -extern int XmbTextListToTextProperty( - Display* display, - char** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -extern int XwcTextListToTextProperty( - Display* display, - wchar_t** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -extern int Xutf8TextListToTextProperty( - Display* display, - char** list, - int count, - XICCEncodingStyle style, - XTextProperty* text_prop_return -); - -extern void XwcFreeStringList( - wchar_t** list -); - -extern Status XTextPropertyToStringList( - XTextProperty* /* text_prop */, - char*** /* list_return */, - int* /* count_return */ -); - -extern int XmbTextPropertyToTextList( - Display* display, - const XTextProperty* text_prop, - char*** list_return, - int* count_return -); - -extern int XwcTextPropertyToTextList( - Display* display, - const XTextProperty* text_prop, - wchar_t*** list_return, - int* count_return -); - -extern int Xutf8TextPropertyToTextList( - Display* display, - const XTextProperty* text_prop, - char*** list_return, - int* count_return -); - -extern int XUnionRectWithRegion( - XRectangle* /* rectangle */, - Region /* src_region */, - Region /* dest_region_return */ -); - -extern int XUnionRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -extern int XWMGeometry( - Display* /* display */, - int /* screen_number */, - _Xconst char* /* user_geometry */, - _Xconst char* /* default_geometry */, - unsigned int /* border_width */, - XSizeHints* /* hints */, - int* /* x_return */, - int* /* y_return */, - int* /* width_return */, - int* /* height_return */, - int* /* gravity_return */ -); - -extern int XXorRegion( - Region /* sra */, - Region /* srb */, - Region /* dr_return */ -); - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -_XFUNCPROTOEND - -#endif /* !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) */ diff --git a/nx-X11/lib/X11/cmsAllCol.c b/nx-X11/lib/X11/cmsAllCol.c deleted file mode 100644 index aeea46461..000000000 --- a/nx-X11/lib/X11/cmsAllCol.c +++ /dev/null @@ -1,74 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsAllCol.c - * - * DESCRIPTION - * Source for XcmsAllocColor - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/* - * NAME - * XcmsAllocColor - Allocate Color - * - * SYNOPSIS - */ -Status -XcmsAllocColor( - Display *dpy, - Colormap colormap, - XcmsColor *pXcmsColor_in_out, - XcmsColorFormat result_format) -/* - * DESCRIPTION - * Given a device-dependent or device-independent color - * specification, XcmsAllocColor will convert it to X RGB - * values then use it in a call to XAllocColor. - * - * RETURNS - * XcmsFailure if failed; - * XcmsSuccess if it succeeded without gamut compression; - * XcmsSuccessWithCompression if it succeeded with gamut - * compression; - * - * Also returns the pixel value of the color cell and a color - * specification of the color actually stored. - * - */ -{ - return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out, - result_format, (Bool *)NULL)); -} diff --git a/nx-X11/lib/X11/cmsAllNCol.c b/nx-X11/lib/X11/cmsAllNCol.c deleted file mode 100644 index d39de6cbd..000000000 --- a/nx-X11/lib/X11/cmsAllNCol.c +++ /dev/null @@ -1,198 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsAlNCol.c - * - * DESCRIPTION - * Source for XcmsAllocNamedColor - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/* - * NAME - * XcmsAllocNamedColor - - * - * SYNOPSIS - */ -Status -XcmsAllocNamedColor ( - Display *dpy, - Colormap cmap, - _Xconst char *colorname, - XcmsColor *pColor_scrn_return, - XcmsColor *pColor_exact_return, - XcmsColorFormat result_format) -/* - * DESCRIPTION - * Finds the color specification associated with the color - * name in the Device-Independent Color Name Database, then - * converts that color specification to an RGB format. This - * RGB value is then used in a call to XAllocColor to allocate - * a read-only color cell. - * - * RETURNS - * 0 if failed to parse string or find any entry in the database. - * 1 if succeeded in converting color name to XcmsColor. - * 2 if succeeded in converting color name to another color name. - * - */ -{ - long nbytes; - xAllocNamedColorReply rep; - xAllocNamedColorReq *req; - XColor hard_def; - XColor exact_def; - Status retval1 = 1; - Status retval2 = XcmsSuccess; - XcmsColor tmpColor; - XColor XColor_in_out; - XcmsCCC ccc; - - /* - * 0. Check for invalid arguments. - */ - if (dpy == NULL || colorname[0] == '\0' || pColor_scrn_return == 0 - || pColor_exact_return == NULL) { - return(XcmsFailure); - } - - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { - return(XcmsFailure); - } - - /* - * 1. Convert string to a XcmsColor using Xcms and i18n mechanism - */ - if ((retval1 = _XcmsResolveColorString(ccc, &colorname, - &tmpColor, result_format)) == XcmsFailure) { - return(XcmsFailure); - } - if (retval1 == _XCMS_NEWNAME) { - goto PassToServer; - } - memcpy((char *)pColor_exact_return, (char *)&tmpColor, sizeof(XcmsColor)); - - /* - * 2. Convert tmpColor to RGB - * Assume pColor_exact_return is now adjusted to Client White Point - */ - if ((retval2 = XcmsConvertColors(ccc, &tmpColor, - 1, XcmsRGBFormat, (Bool *) NULL)) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * 3. Convert to XColor and call XAllocColor - */ - _XcmsRGB_to_XColor(&tmpColor, &XColor_in_out, 1); - if (XAllocColor(ccc->dpy, cmap, &XColor_in_out) == 0) { - return(XcmsFailure); - } - - /* - * 4. pColor_scrn_return - * - * Now convert to the target format. - * We can ignore the return value because we're already in a - * device-dependent format. - */ - _XColor_to_XcmsRGB(ccc, &XColor_in_out, pColor_scrn_return, 1); - if (result_format != XcmsRGBFormat) { - if (result_format == XcmsUndefinedFormat) { - result_format = pColor_exact_return->format; - } - if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - } - - return(retval1 > retval2 ? retval1 : retval2); - -PassToServer: - /* - * All previous methods failed, so lets pass it to the server - * for parsing. - */ - dpy = ccc->dpy; - LockDisplay(dpy); - GetReq(AllocNamedColor, req); - - req->cmap = cmap; - nbytes = req->nbytes = strlen(colorname); - req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */ - - _XSend(dpy, colorname, nbytes); - /* _XSend is more efficient that Data, since _XReply follows */ - - if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (0); - } - - exact_def.red = rep.exactRed; - exact_def.green = rep.exactGreen; - exact_def.blue = rep.exactBlue; - - hard_def.red = rep.screenRed; - hard_def.green = rep.screenGreen; - hard_def.blue = rep.screenBlue; - - exact_def.pixel = hard_def.pixel = rep.pixel; - - UnlockDisplay(dpy); - SyncHandle(); - - /* - * Now convert to the target format. - */ - _XColor_to_XcmsRGB(ccc, &exact_def, pColor_exact_return, 1); - _XColor_to_XcmsRGB(ccc, &hard_def, pColor_scrn_return, 1); - if (result_format != XcmsRGBFormat - && result_format != XcmsUndefinedFormat) { - if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - } - - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/cmsCmap.c b/nx-X11/lib/X11/cmsCmap.c deleted file mode 100644 index c7087ecb1..000000000 --- a/nx-X11/lib/X11/cmsCmap.c +++ /dev/null @@ -1,492 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsCmap.c - Client Colormap Management Routines - * - * DESCRIPTION - * Routines that store additional information about - * colormaps being used by the X Client. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Xutil.h" -#include "Cmap.h" -#include "Cv.h" - -/* - * FORWARD DECLARATIONS - */ -static void _XcmsFreeClientCmaps(Display *dpy); - - -/************************************************************************ - * * - * PRIVATE INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * CmapRecForColormap - * - * SYNOPSIS - */ -static XcmsCmapRec * -CmapRecForColormap( - Display *dpy, - Colormap cmap) -/* - * DESCRIPTION - * Find the corresponding XcmsCmapRec for cmap. In not found - * this routines attempts to create one. - * - * RETURNS - * Returns NULL if failed; otherwise the address to - * the corresponding XcmsCmapRec. - * - */ -{ - XcmsCmapRec *pRec; - int nScrn; - int i, j; - XVisualInfo visualTemplate; /* Template of the visual we want */ - XVisualInfo *visualList; /* List for visuals that match */ - int nVisualsMatched; /* Number of visuals that match */ - Window tmpWindow; - Visual *vp; - unsigned long border = 0; - _XAsyncHandler async; - _XAsyncErrorState async_state; - - for (pRec = (XcmsCmapRec *)dpy->cms.clientCmaps; pRec != NULL; - pRec = pRec->pNext) { - if (pRec->cmapID == cmap) { - return(pRec); - } - } - - /* - * Can't find an XcmsCmapRec associated with cmap in our records. - * Let's try to see if its a default colormap - */ - nScrn = ScreenCount(dpy); - for (i = 0; i < nScrn; i++) { - if (cmap == DefaultColormap(dpy, i)) { - /* It is ... lets go ahead and store that info */ - if ((pRec = _XcmsAddCmapRec(dpy, cmap, RootWindow(dpy, i), - DefaultVisual(dpy, i))) == NULL) { - return((XcmsCmapRec *)NULL); - } - pRec->ccc = XcmsCreateCCC( - dpy, - i, /* screenNumber */ - DefaultVisual(dpy, i), - (XcmsColor *)NULL, /* clientWhitePt */ - (XcmsCompressionProc)NULL, /* gamutCompProc */ - (XPointer)NULL, /* gamutCompClientData */ - (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ - (XPointer)NULL /* whitePtAdjClientData */ - ); - return(pRec); - } - } - - /* - * Nope, its not a default colormap, so it's probably a foreign color map - * of which we have no specific details. Let's go through the - * rigorous process of finding this colormap: - * for each screen - * for each screen's visual types - * create a window with cmap specified as the colormap - * if successful - * Add a CmapRec - * Create an XcmsCCC - * return the CmapRec - * else - * continue - */ - - async_state.error_code = 0; /* don't care */ - async_state.major_opcode = X_CreateWindow; - async_state.minor_opcode = 0; - for (i = 0; i < nScrn; i++) { - visualTemplate.screen = i; - visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate, - &nVisualsMatched); - if (visualList == NULL) { - continue; - } - - /* - * Attempt to create a window with cmap - */ - j = 0; - do { - vp = (visualList+j)->visual; - LockDisplay(dpy); - { - register xCreateWindowReq *req; - - GetReq(CreateWindow, req); - async_state.min_sequence_number = dpy->request; - async_state.max_sequence_number = dpy->request; - async_state.error_count = 0; - async.next = dpy->async_handlers; - async.handler = _XAsyncErrorHandler; - async.data = (XPointer)&async_state; - dpy->async_handlers = &async; - req->parent = RootWindow(dpy, i); - req->x = 0; - req->y = 0; - req->width = 1; - req->height = 1; - req->borderWidth = 0; - req->depth = (visualList+j)->depth; - req->class = CopyFromParent; - req->visual = vp->visualid; - tmpWindow = req->wid = XAllocID(dpy); - req->mask = CWBorderPixel | CWColormap; - req->length += 2; - Data32 (dpy, (long *) &border, 4); - Data32 (dpy, (long *) &cmap, 4); - } - { - xGetInputFocusReply rep; - _X_UNUSED register xReq *req; - - GetEmptyReq(GetInputFocus, req); - (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); - } - DeqAsyncHandler(dpy, &async); - UnlockDisplay(dpy); - SyncHandle(); - } while (async_state.error_count > 0 && ++j < nVisualsMatched); - - Xfree(visualList); - - /* - * if successful - */ - if (j < nVisualsMatched) { - if ((pRec = _XcmsAddCmapRec(dpy, cmap, tmpWindow, vp)) == NULL) - return((XcmsCmapRec *)NULL); - pRec->ccc = XcmsCreateCCC( - dpy, - i, /* screenNumber */ - vp, - (XcmsColor *)NULL, /* clientWhitePt */ - (XcmsCompressionProc)NULL, /* gamutCompProc */ - (XPointer)NULL, /* gamutCompClientData */ - (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ - (XPointer)NULL /* whitePtAdjClientData */ - ); - XDestroyWindow(dpy, tmpWindow); - return(pRec); - } - } - - return(NULL); -} - - - -/************************************************************************ - * * - * API PRIVATE INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsAddCmapRec - * - * SYNOPSIS - */ -XcmsCmapRec * -_XcmsAddCmapRec( - Display *dpy, - Colormap cmap, - Window windowID, - Visual *visual) -/* - * DESCRIPTION - * Create an XcmsCmapRec for the specified cmap, windowID, - * and visual, then adds it to its list of CmapRec's. - * - * RETURNS - * Returns NULL if failed; otherwise the address to - * the added XcmsCmapRec. - * - */ -{ - XcmsCmapRec *pNew; - - if ((pNew = Xcalloc(1, sizeof(XcmsCmapRec))) == NULL) { - return((XcmsCmapRec *)NULL); - } - - pNew->cmapID = cmap; - pNew->dpy = dpy; - pNew->windowID = windowID; - pNew->visual = visual; - pNew->pNext = (XcmsCmapRec *)dpy->cms.clientCmaps; - dpy->cms.clientCmaps = (XPointer)pNew; - dpy->free_funcs->clientCmaps = _XcmsFreeClientCmaps; - - /* - * Note, we don't create the XcmsCCC for pNew->ccc here because - * it may require the use of XGetWindowAttributes (a round trip request) - * to determine the screen. - */ - return(pNew); -} - - -/* - * NAME - * _XcmsCopyCmapRecAndFree - * - * SYNOPSIS - */ -XcmsCmapRec * -_XcmsCopyCmapRecAndFree( - Display *dpy, - Colormap src_cmap, - Colormap copy_cmap) -/* - * DESCRIPTION - * Augments Xlib's XCopyColormapAndFree() to copy - * XcmsCmapRecs. - * - * RETURNS - * Returns NULL if failed; otherwise the address to - * the copy XcmsCmapRec. - * - */ -{ - XcmsCmapRec *pRec_src; - XcmsCmapRec *pRec_copy; - - if ((pRec_src = CmapRecForColormap(dpy, src_cmap)) != NULL) { - pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID, - pRec_src->visual); - if (pRec_copy != NULL && pRec_src->ccc) { - pRec_copy->ccc = Xcalloc(1, sizeof(XcmsCCCRec)); - memcpy((char *)pRec_copy->ccc, (char *)pRec_src->ccc, - sizeof(XcmsCCCRec)); - } - return(pRec_copy); - } - return((XcmsCmapRec *)NULL); -} - - -/* - * NAME - * _XcmsDeleteCmapRec - * - * SYNOPSIS - */ -void -_XcmsDeleteCmapRec( - Display *dpy, - Colormap cmap) -/* - * DESCRIPTION - * Removes and frees the specified XcmsCmapRec structure - * from the linked list of structures. - * - * RETURNS - * void - * - */ -{ - XcmsCmapRec **pPrevPtr; - XcmsCmapRec *pRec; - int scr; - - /* If it is the default cmap for a screen, do not delete it, - * because the server will not actually free it */ - for (scr = ScreenCount(dpy); --scr >= 0; ) { - if (cmap == DefaultColormap(dpy, scr)) - return; - } - - /* search for it in the list */ - pPrevPtr = (XcmsCmapRec **)&dpy->cms.clientCmaps; - while ((pRec = *pPrevPtr) && (pRec->cmapID != cmap)) { - pPrevPtr = &pRec->pNext; - } - - if (pRec) { - if (pRec->ccc) { - XcmsFreeCCC(pRec->ccc); - } - *pPrevPtr = pRec->pNext; - Xfree(pRec); - } -} - - -/* - * NAME - * _XcmsFreeClientCmaps - * - * SYNOPSIS - */ -static void -_XcmsFreeClientCmaps( - Display *dpy) -/* - * DESCRIPTION - * Frees all XcmsCmapRec structures in the linked list - * and sets dpy->cms.clientCmaps to NULL. - * - * RETURNS - * void - * - */ -{ - XcmsCmapRec *pRecNext, *pRecFree; - - pRecNext = (XcmsCmapRec *)dpy->cms.clientCmaps; - while (pRecNext != NULL) { - pRecFree = pRecNext; - pRecNext = pRecNext->pNext; - if (pRecFree->ccc) { - /* Free the XcmsCCC structure */ - XcmsFreeCCC(pRecFree->ccc); - } - /* Now free the XcmsCmapRec structure */ - Xfree(pRecFree); - } - dpy->cms.clientCmaps = (XPointer)NULL; -} - - - -/************************************************************************ - * * - * PUBLIC INTERFACES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCCCOfColormap - * - * SYNOPSIS - */ -XcmsCCC -XcmsCCCOfColormap( - Display *dpy, - Colormap cmap) -/* - * DESCRIPTION - * Finds the XcmsCCC associated with the specified colormap. - * - * RETURNS - * Returns NULL if failed; otherwise the address to - * the associated XcmsCCC structure. - * - */ -{ - XWindowAttributes windowAttr; - XcmsCmapRec *pRec; - int nScrn = ScreenCount(dpy); - int i; - - if ((pRec = CmapRecForColormap(dpy, cmap)) != NULL) { - if (pRec->ccc) { - /* XcmsCmapRec already has a XcmsCCC */ - return(pRec->ccc); - } - - /* - * The XcmsCmapRec does not have a XcmsCCC yet, so let's create - * one. But first, we need to know the screen associated with - * cmap, so use XGetWindowAttributes() to extract that - * information. Unless, of course there is only one screen!! - */ - if (nScrn == 1) { - /* Assume screenNumber == 0 */ - return(pRec->ccc = XcmsCreateCCC( - dpy, - 0, /* screenNumber */ - pRec->visual, - (XcmsColor *)NULL, /* clientWhitePt */ - (XcmsCompressionProc)NULL, /* gamutCompProc */ - (XPointer)NULL, /* gamutCompClientData */ - (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ - (XPointer)NULL /* whitePtAdjClientData */ - )); - } else { - if (XGetWindowAttributes(dpy, pRec->windowID, &windowAttr)) { - for (i = 0; i < nScrn; i++) { - if (ScreenOfDisplay(dpy, i) == windowAttr.screen) { - return(pRec->ccc = XcmsCreateCCC( - dpy, - i, /* screenNumber */ - pRec->visual, - (XcmsColor *)NULL, /* clientWhitePt */ - (XcmsCompressionProc)NULL, /* gamutCompProc */ - (XPointer)NULL, /* gamutCompClientData */ - (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ - (XPointer)NULL /* whitePtAdjClientData */ - )); - } - } - } - } - } - - /* - * No such cmap - */ - return(NULL); -} - -XcmsCCC XcmsSetCCCOfColormap( - Display *dpy, - Colormap cmap, - XcmsCCC ccc) -{ - XcmsCCC prev_ccc = NULL; - XcmsCmapRec *pRec; - - pRec = CmapRecForColormap(dpy, cmap); - if (pRec) { - prev_ccc = pRec->ccc; - pRec->ccc = ccc; - } - return prev_ccc; -} diff --git a/nx-X11/lib/X11/cmsColNm.c b/nx-X11/lib/X11/cmsColNm.c deleted file mode 100644 index c6f1e0f31..000000000 --- a/nx-X11/lib/X11/cmsColNm.c +++ /dev/null @@ -1,1050 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * XcmsColNm.c - * - * DESCRIPTION - * Source for _XcmsLookupColorName(). - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include -#include -#include -#include -#include -#define XK_LATIN1 -#include -#include "Cv.h" - -/* forwards/locals */ -static Status LoadColornameDB(void); - - -/* - * LOCAL DEFINES - * #define declarations local to this package. - */ -#ifndef XCMSDB -#define XCMSDB XCMSDIR "/Xcms.txt" -#endif - -#ifndef isgraph -# define isgraph(c) (isprint((c)) && !isspace((c))) -#endif - -#ifndef XCMSDB_MAXLINELEN -# define XCMSDB_MAXLINELEN 256 -#endif - -#define FORMAT_VERSION "0.1" -#define START_TOKEN "XCMS_COLORDB_START" -#define END_TOKEN "XCMS_COLORDB_END" -#define DELIM_CHAR '\t' - -#define NOT_VISITED 0x0 -#define VISITED 0x1 -#define CYCLE 0xFFFF -#define XcmsDbInitNone -1 -#define XcmsDbInitFailure 0 -#define XcmsDbInitSuccess 1 - -/* - * LOCAL TYPEDEFS - */ -typedef struct _XcmsPair { - const char *first; - const char *second; - int flag; -} XcmsPair; - -/* - * LOCAL VARIABLES - */ -static int XcmsColorDbState = XcmsDbInitNone; -static int nEntries; -static char *strings; -static XcmsPair *pairs; -static const char whitePtStr[] = "WhitePoint"; - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsColorSpaceOfString - * - * SYNOPSIS - */ -static XcmsColorSpace * -_XcmsColorSpaceOfString( - XcmsCCC ccc, - const char *color_string) -/* - * DESCRIPTION - * Returns a pointer to the color space structure - * (XcmsColorSpace) associated with the specified color string. - * - * RETURNS - * Pointer to matching XcmsColorSpace structure if found; - * otherwise NULL. - * - * CAVEATS - * - */ -{ - XcmsColorSpace **papColorSpaces; - size_t n; - char *pchar; - - if ((pchar = strchr(color_string, ':')) == NULL) { - return(XcmsFailure); - } - n = (size_t)(pchar - color_string); - - if (ccc == NULL) { - return(NULL); - } - - /* - * First try Device-Independent color spaces - */ - papColorSpaces = _XcmsDIColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if (strncmp((*papColorSpaces)->prefix, color_string, n) == 0 && - !((*papColorSpaces)->prefix)[n]) { - return(*papColorSpaces); - } - papColorSpaces++; - } - } - - /* - * Next try Device-Dependent color spaces - */ - papColorSpaces = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; - if (papColorSpaces != NULL) { - while (*papColorSpaces != NULL) { - if (strncmp((*papColorSpaces)->prefix, color_string, n) == 0 && - !((*papColorSpaces)->prefix)[n]) { - return(*papColorSpaces); - } - papColorSpaces++; - } - } - - return(NULL); -} - - -/* - * NAME - * _XcmsParseColorString - * - * SYNOPSIS - */ -static int -_XcmsParseColorString( - XcmsCCC ccc, - const char *color_string, - XcmsColor *pColor) -/* - * DESCRIPTION - * Assuming color_string contains a numerical string color - * specification, attempts to parse a string into an - * XcmsColor structure. - * - * RETURNS - * 0 if failed; otherwise non-zero. - * - * CAVEATS - * A color string containing a numerical color specification - * must be in ISO Latin-1 encoding! - */ -{ - XcmsColorSpace *pColorSpace; - char string_buf[64]; - char *string_lowered; - size_t len; - int res; - - if (ccc == NULL) { - return(0); - } - - /* - * While copying color_string to string_lowered, convert to lowercase - */ - if ((len = strlen(color_string)) >= sizeof(string_buf)) { - string_lowered = Xmalloc(len+1); - } else { - string_lowered = string_buf; - } - - _XcmsCopyISOLatin1Lowered(string_lowered, color_string); - - if (*string_lowered == '#') { - if ((pColorSpace = _XcmsColorSpaceOfString(ccc, "rgb:")) != NULL) { - res = (*pColorSpace->parseString)(string_lowered, pColor); - if (len >= sizeof(string_buf)) Xfree(string_lowered); - return res; - } - } - - if ((pColorSpace = _XcmsColorSpaceOfString(ccc, string_lowered)) != NULL) { - res = (*pColorSpace->parseString)(string_lowered, pColor); - if (len >= sizeof(string_buf)) Xfree(string_lowered); - return res; - } - - if (len >= sizeof(string_buf)) Xfree(string_lowered); - return(0); -} - - -/* - * NAME - * FirstCmp - Compare color names of pair recs - * - * SYNOPSIS - */ -static int -FirstCmp(const void *p1, const void *p2) -/* - * DESCRIPTION - * Compares the color names of XcmsColorTuples. - * This routine is public to allow access from qsort???. - * - * RETURNS - * 0 if equal; - * < 0 if first precedes second, - * > 0 if first succeeds second. - * - */ -{ - return(strcmp(((const XcmsPair *)p1)->first, ((const XcmsPair *)p2)->first)); -} - - - -/* - * NAME - * stringSectionSize - determine memory needed for strings - * - * SYNOPSIS - */ -static void -SetNoVisit(void) -/* - * DESCRIPTION - * - * RETURNS - * void - * - */ -{ - int i; - XcmsPair *pair = pairs; - - for (i = 0; i < nEntries; i++, pair++) { - if (pair->flag != CYCLE) { - pair->flag = NOT_VISITED; - } - } -} - - - - -/* - * NAME - * field2 - extract two fields - * - * SYNOPSIS - */ -static int -field2( - char *pBuf, - char delim, /* in: field delimiter */ - char **p1, /* in/out: pointer to pointer to field 1 */ - char **p2) /* in/out: pointer to pointer to field 2 */ -/* - * DESCRIPTION - * Extracts two fields from a "record". - * - * RETURNS - * XcmsSuccess if succeeded, otherwise XcmsFailure. - * - */ -{ - *p1 = *p2 = NULL; - - /* Find Field 1 */ - while (!isgraph(*pBuf)) { - if ((*pBuf != '\n') || (*pBuf != '\0')) { - return(XcmsFailure); - } - if (isspace(*pBuf) || (*pBuf == delim)) { - pBuf++; - } - } - *p1 = pBuf; - - /* Find end of Field 2 */ - while (isprint(*pBuf) && (*pBuf != delim)) { - pBuf++; - } - if ((*pBuf == '\n') || (*pBuf == '\0')) { - return(XcmsFailure); - } - if ((*pBuf == ' ') || (*pBuf == delim)) { - *pBuf++ = '\0'; /* stuff end of string character */ - } else { - return(XcmsFailure); - } - - /* Find Field 2 */ - while (!isgraph(*pBuf)) { - if ((*pBuf == '\n') || (*pBuf == '\0')) { - return(XcmsFailure); - } - if (isspace(*pBuf) || (*pBuf == delim)) { - pBuf++; - } - } - *p2 = pBuf; - - /* Find end of Field 2 */ - while (isprint(*pBuf) && (*pBuf != delim)) { - pBuf++; - } - if (*pBuf != '\0') { - *pBuf = '\0'; /* stuff end of string character */ - } - - return(XcmsSuccess); -} - - -/* - * NAME - * _XcmsLookupColorName - Lookup DB entry for a color name - * - * SYNOPSIS - */ -static Status -_XcmsLookupColorName( - XcmsCCC ccc, - const char **name, - XcmsColor *pColor) -/* - * DESCRIPTION - * Searches for an entry in the Device-Independent Color Name - * Database for the specified string. - * - * RETURNS - * XcmsFailure if failed to find a matching entry in - * the database. - * XcmsSuccess if succeeded in converting color name to - * XcmsColor. - * _XCMS_NEWNAME if succeeded in converting color string (which - * is a color name to yet another color name. Note - * that the new name is passed back via 'name'. - */ - { - Status retval = 0; - char name_lowered_64[64]; - char *name_lowered; - register int i, j, left, right; - int len; - const char *tmpName; - XcmsPair *pair = NULL; - - /* - * Check state of Database: - * XcmsDbInitNone - * XcmsDbInitSuccess - * XcmsDbInitFailure - */ - if (XcmsColorDbState == XcmsDbInitFailure) { - return(XcmsFailure); - } - if (XcmsColorDbState == XcmsDbInitNone) { - if (!LoadColornameDB()) { - return(XcmsFailure); - } - } - - SetNoVisit(); - - /* - * While copying name to name_lowered, convert to lowercase - */ - - tmpName = *name; - -Retry: - if ((len = strlen(tmpName)) > 63) { - name_lowered = Xmalloc(len+1); - } else { - name_lowered = name_lowered_64; - } - - _XcmsCopyISOLatin1Lowered(name_lowered, tmpName); - - /* - * Now, remove spaces. - */ - for (i = 0, j = 0; j < len; j++) { - if (!isspace(name_lowered[j])) { - name_lowered[i++] = name_lowered[j]; - } - } - name_lowered[i] = '\0'; - - left = 0; - right = nEntries - 1; - while (left <= right) { - i = (left + right) >> 1; - pair = &pairs[i]; - j = strcmp(name_lowered, pair->first); - if (j < 0) - right = i - 1; - else if (j > 0) - left = i + 1; - else { - break; - } - } - if (len > 63) Xfree(name_lowered); - - if (left > right) { - if (retval == 2) { - if (*name != tmpName) { - *name = tmpName; - } - return(_XCMS_NEWNAME); - } - return(XcmsFailure); - } - - if (pair->flag == CYCLE) { - return(XcmsFailure); - } - if (pair->flag == VISITED) { - pair->flag = CYCLE; - return(XcmsFailure); - } - - if (_XcmsParseColorString(ccc, pair->second, pColor) == XcmsSuccess) { - /* f2 contains a numerical string specification */ - return(XcmsSuccess); - } else { - /* f2 does not contain a numerical string specification */ - tmpName = pair->second; - pair->flag = VISITED; - retval = 2; - goto Retry; - } -} - - -/* - * NAME - * RemoveSpaces - * - * SYNOPSIS - */ -static int -RemoveSpaces( - char *pString) -/* - * DESCRIPTION - * Removes spaces from string. - * - * RETURNS - * Void - * - */ -{ - int i, count = 0; - char *cptr; - - /* REMOVE SPACES */ - cptr = pString; - for (i = strlen(pString); i; i--, cptr++) { - if (!isspace(*cptr)) { - *pString++ = *cptr; - count++; - } - } - *pString = '\0'; - return(count); -} - - -/* - * NAME - * stringSectionSize - determine memory needed for strings - * - * SYNOPSIS - */ -static int -stringSectionSize( - FILE *stream, - int *pNumEntries, - int *pSectionSize) -/* - * DESCRIPTION - * Determines the amount of memory required to store the - * color name strings and also the number of strings. - * - * RETURNS - * XcmsSuccess if succeeded, otherwise XcmsFailure. - * - */ -{ - char buf[XCMSDB_MAXLINELEN]; - char token[XCMSDB_MAXLINELEN]; - char token2[XCMSDB_MAXLINELEN]; - char *pBuf; - char *f1; - char *f2; - size_t i; - - unsigned int numEntries = 0; - unsigned int sectionSize = 0; - - *pNumEntries = 0; - *pSectionSize = 0; - - /* - * Advance to START_TOKEN - * Anything before is just considered as comments. - */ - - while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { - if ((sscanf(buf, "%s %s", token, token2)) - && (strcmp(token, START_TOKEN) == 0)) { - if (strcmp(token2, FORMAT_VERSION) != 0) { - /* text file not in the right format */ - return(XcmsFailure); - } - break; - } /* else it was just a blank line or comment */ - } - - if (pBuf == NULL) { - return(XcmsFailure); - } - - while((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { - if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) { - break; - } - - if (field2(buf, DELIM_CHAR, &f1, &f2) != XcmsSuccess) { - return(XcmsFailure); - } - - numEntries++; - if (numEntries >= INT_MAX) - return(XcmsFailure); - - i = strlen(f1); - if (i >= INT_MAX - sectionSize) - return(XcmsFailure); - sectionSize += i + 1; - for (; i; i--, f1++) { - /* REMOVE SPACES FROM COUNT */ - if (isspace(*f1)) { - sectionSize--; - } - } - - i = strlen(f2); - if (i >= INT_MAX - sectionSize) - return(XcmsFailure); - sectionSize += i + 1; - for (; i; i--, f2++) { - /* REMOVE SPACES FROM COUNT */ - if (isspace(*f2)) { - sectionSize--; - } - } - - } - - *pNumEntries = (int) numEntries; - *pSectionSize = (int) sectionSize; - - return(XcmsSuccess); -} - - -/* - * NAME - * ReadColornameDB - Read the Color Name Database - * - * SYNOPSIS - */ -static Status -ReadColornameDB( - FILE *stream, - XcmsPair *pRec, - char *pString) -/* - * DESCRIPTION - * Loads the Color Name Database from a text file. - * - * RETURNS - * XcmsSuccess if succeeded, otherwise XcmsFailure. - * - */ -{ - char buf[XCMSDB_MAXLINELEN]; - char token[XCMSDB_MAXLINELEN]; - char token2[XCMSDB_MAXLINELEN]; - char *f1; - char *f2; - char *pBuf; - - /* - * Advance to START_TOKEN - * Anything before is just considered as comments. - */ - - while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { - if ((sscanf(buf, "%s %s", token, token2)) - && (strcmp(token, START_TOKEN) == 0)) { - if (strcmp(token2, FORMAT_VERSION) != 0) { - /* text file not in the right format */ - return(XcmsFailure); - } - break; - } /* else it was just a blank line or comment */ - } - - if (pBuf == NULL) { - return(XcmsFailure); - } - - /* - * Process lines between START_TOKEN to END_TOKEN - */ - - while ((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { - if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) { - /* - * Found END_TOKEN so break out of for loop - */ - break; - } - - /* - * Get pairs - */ - if (field2(buf, DELIM_CHAR, &f1, &f2) != XcmsSuccess) { - /* Invalid line */ - continue; - } - - /* - * Add strings - */ - - /* Left String */ - pRec->first = pString; - _XcmsCopyISOLatin1Lowered(pString, f1); - pString += (1 + RemoveSpaces(pString)); - pRec->second = pString; - /* Right String */ - _XcmsCopyISOLatin1Lowered(pString, f2); - pString += RemoveSpaces(pString) + 1; - pRec++; - - } - - return(XcmsSuccess); -} - - -/* - * NAME - * LoadColornameDB - Load the Color Name Database - * - * SYNOPSIS - */ -static Status -LoadColornameDB(void) -/* - * DESCRIPTION - * Loads the Color Name Database from a text file. - * - * RETURNS - * XcmsSuccess if succeeded, otherwise XcmsFailure. - * - */ -{ - int size; - FILE *stream; - const char *pathname; - struct stat txt; - int length; - - /* use and name of this env var is not part of the standard */ - /* implementation-dependent feature */ - if ((pathname = getenv("XCMSDB")) == NULL) { - pathname = XCMSDB; - } - - length = strlen(pathname); - if ((length == 0) || (length >= (BUFSIZ - 5))){ - XcmsColorDbState = XcmsDbInitFailure; - return(XcmsFailure); - } - - if (stat(pathname, &txt)) { - /* can't stat file */ - XcmsColorDbState = XcmsDbInitFailure; - return(XcmsFailure); - } - - if ((stream = _XFopenFile (pathname, "r")) == NULL) { - /* can't open file */ - XcmsColorDbState = XcmsDbInitFailure; - return(XcmsFailure); - } - - if (stringSectionSize(stream, &nEntries, &size) != XcmsSuccess || - nEntries == 0) { - (void) fclose(stream); - XcmsColorDbState = XcmsDbInitFailure; - return(XcmsFailure); - } - rewind(stream); - - strings = Xmalloc(size); - pairs = Xcalloc(nEntries, sizeof(XcmsPair)); - - ReadColornameDB(stream, pairs, strings); - (void) fclose(stream); - - /* - * sort the pair recs - */ - qsort((char *)pairs, nEntries, sizeof(XcmsPair), FirstCmp); - - XcmsColorDbState = XcmsDbInitSuccess; - return(XcmsSuccess); -} - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsCopyISOLatin1Lowered - * - * SYNOPSIS - */ -void -_XcmsCopyISOLatin1Lowered( - char *dst, - const char *src) -/* - * DESCRIPTION - * ISO Latin-1 case conversion routine - * Identical to XmuCopyISOLatin1Lowered() but provided here - * to eliminate need to link with libXmu.a. - * - * IMPLEMENTORS NOTE: - * This routine is also used in XcmsFormatOfPrefix. - * - * RETURNS - * Void - * - */ -{ - register unsigned char *dest; - register const unsigned char *source; - - for (dest = (unsigned char *)dst, source = (const unsigned char *)src; - *source; - source++, dest++) - { - if ((*source >= XK_A) && (*source <= XK_Z)) - *dest = *source + (XK_a - XK_A); - else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis)) - *dest = *source + (XK_agrave - XK_Agrave); - else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn)) - *dest = *source + (XK_oslash - XK_Ooblique); - else - *dest = *source; - } - *dest = '\0'; -} - - -/* - * NAME - * _XcmsResolveColorString - - * - * SYNOPSIS - */ -Status -_XcmsResolveColorString ( - XcmsCCC ccc, - const char **color_string, - XcmsColor *pColor_exact_return, - XcmsColorFormat result_format) -/* - * DESCRIPTION - * The XcmsLookupColor function finds the color specification - * associated with a color name in the Device-Independent Color - * Name Database. - * RETURNS - * XcmsFailure if failed to convert valid color string. - * XcmsSuccess if succeeded in converting color string to - * XcmsColor. - * _XCMS_NEWNAME if failed to parse the string or find it in - * the database, or if succeeded in looking it up and - * found another name which is not in the database. - * Note that the new name is returned in color_string. - * - * This function returns both the color specification found in the - * database (db specification) and the color specification for the - * color displayable by the specified screen (screen - * specification). The calling routine sets the format for these - * returned specifications in the XcmsColor format component. - * If XcmsUndefinedFormat, the specification is returned in the - * format used to store the color in the database. - */ -{ - XcmsColor dbWhitePt; /* whitePt associated with pColor_exact_return*/ - /* the screen's white point */ - XcmsColor *pClientWhitePt; - int retval; - const char *strptr = whitePtStr; - -/* - * 0. Check for invalid arguments. - */ - if (ccc == NULL || (*color_string)[0] == '\0' || pColor_exact_return == NULL) { - return(XcmsFailure); - } - -/* - * 1. First attempt to parse the string - * If successful, then convert the specification to the target format - * and return. - */ - if (_XcmsParseColorString(ccc, *color_string, pColor_exact_return) - == 1) { - if (result_format != XcmsUndefinedFormat - && pColor_exact_return->format != result_format) { - /* need to be converted to the target format */ - return(XcmsConvertColors(ccc, pColor_exact_return, 1, - result_format, (Bool *)NULL)); - } else { - return(XcmsSuccess); - } - } - -/* - * 2. Attempt to find it in the DI Color Name Database - */ - - /* - * a. Convert String into a XcmsColor structure - * Attempt to extract the specification for color_string from the - * DI Database (pColor_exact_return). If the DI Database does not - * have this entry, then return failure. - */ - retval = _XcmsLookupColorName(ccc, color_string, pColor_exact_return); - - if (retval != XcmsSuccess) { - /* color_string replaced with a color name, or not found */ - return(_XCMS_NEWNAME); - } - - if (pColor_exact_return->format == XcmsUndefinedFormat) { - return(XcmsFailure); - } - - /* - * b. If result_format not defined, then assume target format - * is the exact format. - */ - if (result_format == XcmsUndefinedFormat) { - result_format = pColor_exact_return->format; - } - - if ((ClientWhitePointOfCCC(ccc))->format == XcmsUndefinedFormat) { - pClientWhitePt = ScreenWhitePointOfCCC(ccc); - } else { - pClientWhitePt = ClientWhitePointOfCCC(ccc); - } - - /* - * c. Convert to the target format, making adjustments for white - * point differences as necessary. - */ - if (XCMS_DD_ID(pColor_exact_return->format)) { - /* - * The spec format is Device-Dependent, therefore assume the - * its white point is the Screen White Point. - */ - if (XCMS_DD_ID(result_format)) { - /* - * Target format is Device-Dependent - * Therefore, DD --> DD conversion - */ - return(_XcmsDDConvertColors(ccc, pColor_exact_return, - 1, result_format, (Bool *) NULL)); - } else { - /* - * Target format is Device-Independent - * Therefore, DD --> DI conversion - */ - if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, - pClientWhitePt, ScreenWhitePointOfCCC(ccc))) { - return((*ccc->whitePtAdjProc)(ccc, ScreenWhitePointOfCCC(ccc), - pClientWhitePt, result_format, - pColor_exact_return, 1, (Bool *) NULL)); - } else { - if (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, - XcmsCIEXYZFormat, (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - return(_XcmsDIConvertColors(ccc, pColor_exact_return, - pClientWhitePt, 1, result_format)); - } - } - } else { - /* - * The spec format is Device-Independent, therefore attempt - * to find a database white point. - * - * If the Database does not have a white point, then assume the - * database white point is the same as the Screen White Point. - */ - - if (_XcmsLookupColorName(ccc, &strptr, &dbWhitePt) != 1) { - memcpy((char *)&dbWhitePt, - (char *)&ccc->pPerScrnInfo->screenWhitePt, - sizeof(XcmsColor)); - } - if (XCMS_DD_ID(result_format)) { - /* - * Target format is Device-Dependent - * Therefore, DI --> DD conversion - */ - if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, - &dbWhitePt, ScreenWhitePointOfCCC(ccc))) { - return((*ccc->whitePtAdjProc)(ccc, &dbWhitePt, - ScreenWhitePointOfCCC(ccc), result_format, - pColor_exact_return, 1, (Bool *)NULL)); - } else { - if (pColor_exact_return->format != XcmsCIEXYZFormat) { - if (_XcmsDIConvertColors(ccc, pColor_exact_return, - &dbWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { - return(XcmsFailure); - } - } - return (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, - result_format, (Bool *)NULL)); - } - } else { - /* - * Target format is Device-Independent - * Therefore, DI --> DI conversion - */ - if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, - &dbWhitePt, pClientWhitePt)) { - /* - * The calling routine wants to resolve this color - * in terms if it's white point (i.e. Client White Point). - * Therefore, apply white adjustment for the displacement - * between dbWhitePt to clientWhitePt. - */ - return((*ccc->whitePtAdjProc)(ccc, &dbWhitePt, - pClientWhitePt, result_format, - pColor_exact_return, 1, (Bool *)NULL)); - } else if (_XcmsEqualWhitePts(ccc, - &dbWhitePt, pClientWhitePt)) { - /* - * Can use either dbWhitePt or pClientWhitePt to - * convert to the result_format. - */ - if (pColor_exact_return->format == result_format) { - return(XcmsSuccess); - } else { - return (_XcmsDIConvertColors(ccc, pColor_exact_return, - &dbWhitePt, 1, result_format)); - } - } else { - /* - * Need to convert to a white point independent color - * space (let's choose CIEXYZ) then convert to the - * target color space. Why? Lets assume that - * pColor_exact_return->format and result format - * are white point dependent format (e.g., CIELUV, CIELAB, - * TekHVC ... same or any combination). If so, we'll - * need to convert the color with dbWhitePt to an absolute - * spec (i.e. non-white point dependent) then convert that - * absolute value with clientWhitePt to the result_format. - */ - if (pColor_exact_return->format != XcmsCIEXYZFormat) { - if (_XcmsDIConvertColors(ccc, pColor_exact_return, - &dbWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { - return(XcmsFailure); - } - } - if (result_format == XcmsCIEXYZFormat) { - return(XcmsSuccess); - } else { - return(_XcmsDIConvertColors(ccc, pColor_exact_return, - pClientWhitePt, 1, result_format)); - } - } - } - } -} diff --git a/nx-X11/lib/X11/cmsGlobls.c b/nx-X11/lib/X11/cmsGlobls.c deleted file mode 100644 index c9e82f242..000000000 --- a/nx-X11/lib/X11/cmsGlobls.c +++ /dev/null @@ -1,126 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsGlobls.c - * - * DESCRIPTION - * Source file containing Xcms globals - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * GLOBALS - * Variables declared in this package that are allowed - * to be used globally. - */ - - /* - * Initial array of Device Independent Color Spaces - */ -XcmsColorSpace *_XcmsDIColorSpacesInit[] = { - &XcmsCIEXYZColorSpace, - &XcmsCIEuvYColorSpace, - &XcmsCIExyYColorSpace, - &XcmsCIELabColorSpace, - &XcmsCIELuvColorSpace, - &XcmsTekHVCColorSpace, - &XcmsUNDEFINEDColorSpace, - NULL -}; - /* - * Pointer to the array of pointers to XcmsColorSpace structures for - * Device-Independent Color Spaces that are currently accessible by - * the color management system. End of list is indicated by a NULL pointer. - */ -XcmsColorSpace **_XcmsDIColorSpaces = _XcmsDIColorSpacesInit; - - /* - * Initial array of Device Dependent Color Spaces - */ -XcmsColorSpace *_XcmsDDColorSpacesInit[] = { - &XcmsRGBColorSpace, - &XcmsRGBiColorSpace, - NULL -}; - /* - * Pointer to the array of pointers to XcmsColorSpace structures for - * Device-Dependent Color Spaces that are currently accessible by - * the color management system. End of list is indicated by a NULL pointer. - */ -XcmsColorSpace **_XcmsDDColorSpaces = &_XcmsDDColorSpacesInit[0]; - - /* - * Initial array of Screen Color Characterization Function Sets - */ -XcmsFunctionSet *_XcmsSCCFuncSetsInit[] = { - &XcmsLinearRGBFunctionSet, -#ifdef GRAY - &XcmsGrayFunctionSet, -#endif /* GRAY */ - NULL}; - /* - * Pointer to the array of pointers to XcmsSCCFuncSet structures - * (Screen Color Characterization Function Sets) that are currently - * accessible by the color management system. End of list is - * indicated by a NULL pointer. - */ -XcmsFunctionSet **_XcmsSCCFuncSets = _XcmsSCCFuncSetsInit; - - /* - * X Consortium Registered Device-Independent Color Spaces - * Note that prefix must be in lowercase. - */ -const char _XcmsCIEXYZ_prefix[] = "ciexyz"; -const char _XcmsCIEuvY_prefix[] = "cieuvy"; -const char _XcmsCIExyY_prefix[] = "ciexyy"; -const char _XcmsCIELab_prefix[] = "cielab"; -const char _XcmsCIELuv_prefix[] = "cieluv"; -const char _XcmsTekHVC_prefix[] = "tekhvc"; - /* - * Registered Device-Dependent Color Spaces - */ -const char _XcmsRGBi_prefix[] = "rgbi"; -const char _XcmsRGB_prefix[] = "rgb"; - -XcmsRegColorSpaceEntry _XcmsRegColorSpaces[] = { - { _XcmsCIEXYZ_prefix, XcmsCIEXYZFormat }, - { _XcmsCIEuvY_prefix, XcmsCIEuvYFormat }, - { _XcmsCIExyY_prefix, XcmsCIExyYFormat }, - { _XcmsCIELab_prefix, XcmsCIELabFormat }, - { _XcmsCIELuv_prefix, XcmsCIELuvFormat }, - { _XcmsTekHVC_prefix, XcmsTekHVCFormat }, - { _XcmsRGB_prefix, XcmsRGBFormat }, - { _XcmsRGBi_prefix, XcmsRGBiFormat }, - { NULL, 0 } -}; diff --git a/nx-X11/lib/X11/cmsInt.c b/nx-X11/lib/X11/cmsInt.c deleted file mode 100644 index f4aef04ff..000000000 --- a/nx-X11/lib/X11/cmsInt.c +++ /dev/null @@ -1,411 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsInt.c - Xcms API utility routines - * - * DESCRIPTION - * Xcms Application Program Interface (API) utility - * routines for hanging information directly onto - * the Display structure. - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -#ifndef XCMSCOMPPROC -# define XCMSCOMPPROC XcmsTekHVCClipC -#endif - -/* forward/static */ -static void _XcmsFreeDefaultCCCs(Display *dpy); - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * _XcmsCopyPointerArray - * - * SYNOPSIS - */ -XPointer * -_XcmsCopyPointerArray( - XPointer *pap) -/* - * DESCRIPTION - * Copies an array of NULL terminated pointers. - * - * RETURNS - * Returns NULL if failed; otherwise the address to - * the copy. - * - */ -{ - XPointer *newArray; - char **tmp; - int n; - - for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); - n++; /* add 1 to include the NULL pointer */ - - if ((newArray = Xmalloc(n * sizeof(XPointer)))) { - memcpy((char *)newArray, (char *)pap, - (unsigned)(n * sizeof(XPointer))); - } - return((XPointer *)newArray); -} - -/* - * NAME - * _XcmsFreePointerArray - * - * SYNOPSIS - */ -void -_XcmsFreePointerArray( - XPointer *pap) -/* - * DESCRIPTION - * Frees an array of NULL terminated pointers. - * - * RETURNS - * void - * - */ -{ - Xfree(pap); -} - -/* - * NAME - * _XcmsPushPointerArray - * - * SYNOPSIS - */ -XPointer * -_XcmsPushPointerArray( - XPointer *pap, - XPointer p, - XPointer *papNoFree) -/* - * DESCRIPTION - * Places the specified pointer at the head of an array of NULL - * terminated pointers. - * - * RETURNS - * Returns NULL if failed; otherwise the address to - * the head of the array. - * - */ -{ - XPointer *newArray; - char **tmp; - int n; - - for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); - - /* add 2: 1 for the new pointer and another for the NULL pointer */ - n += 2; - - if ((newArray = Xmalloc(n * sizeof(XPointer)))) { - memcpy((char *)(newArray+1),(char *)pap, - (unsigned)((n-1) * sizeof(XPointer))); - *newArray = p; - } - if (pap != papNoFree) { - _XcmsFreePointerArray(pap); - } - return((XPointer *)newArray); -} - -/* - * NAME - * _XcmsInitDefaultCCCs - * - * SYNOPSIS - */ -int -_XcmsInitDefaultCCCs( - Display *dpy) -/* - * DESCRIPTION - * Initializes the Xcms per Display Info structure - * (XcmsPerDpyInfo). - * - * RETURNS - * Returns 0 if failed; otherwise non-zero. - * - */ -{ - int nScrn = ScreenCount(dpy); - int i; - XcmsCCC ccc; - - if (nScrn <= 0) { - return(0); - } - - /* - * Create an array of XcmsCCC structures, one for each screen. - * They serve as the screen's default CCC. - */ - if (!(ccc = Xcalloc((unsigned)nScrn, sizeof(XcmsCCCRec)))) { - return(0); - } - dpy->cms.defaultCCCs = (XPointer)ccc; - dpy->free_funcs->defaultCCCs = _XcmsFreeDefaultCCCs; - - for (i = 0; i < nScrn; i++, ccc++) { - ccc->dpy = dpy; - ccc->screenNumber = i; - ccc->visual = DefaultVisual(dpy, i); - /* - * Used calloc to allocate memory so: - * ccc->clientWhitePt->format == XcmsUndefinedFormat - * ccc->gamutCompProc == NULL - * ccc->whitePtAdjProc == NULL - * ccc->pPerScrnInfo = NULL - * - * Don't need to create XcmsPerScrnInfo and its functionSet and - * pScreenData components until the default CCC is accessed. - * Note that the XcmsDefaultCCC routine calls _XcmsInitScrnInto - * to do this. - */ - ccc->gamutCompProc = XCMSCOMPPROC; - } - - return(1); -} - - -/* - * NAME - * _XcmsFreeDefaultCCCs - Free Default CCCs and its PerScrnInfo - * - * SYNOPSIS - */ -static void -_XcmsFreeDefaultCCCs( - Display *dpy) -/* - * DESCRIPTION - * This routine frees the default XcmsCCC's associated with - * each screen and its associated substructures as neccessary. - * - * RETURNS - * void - * - * - */ -{ - int nScrn = ScreenCount(dpy); - XcmsCCC ccc; - int i; - - /* - * Free Screen data in each DefaultCCC - * Do not use XcmsFreeCCC here because it will not free - * DefaultCCC's. - */ - ccc = (XcmsCCC)dpy->cms.defaultCCCs; - for (i = nScrn; i--; ccc++) { - /* - * Check if XcmsPerScrnInfo exists. - * - * This is the only place where XcmsPerScrnInfo structures - * are freed since there is only one allocated per Screen. - * It just so happens that we place its reference in the - * default CCC. - */ - if (ccc->pPerScrnInfo) { - /* Check if SCCData exists */ - if (ccc->pPerScrnInfo->state != XcmsInitNone - && ccc->pPerScrnInfo->screenData) { - (*((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->screenFreeProc) - (ccc->pPerScrnInfo->screenData); - } - Xfree(ccc->pPerScrnInfo); - } - } - - /* - * Free the array of XcmsCCC structures - */ - Xfree(dpy->cms.defaultCCCs); - dpy->cms.defaultCCCs = (XPointer)NULL; -} - - - -/* - * NAME - * _XcmsInitScrnInfo - * - * SYNOPSIS - */ -int -_XcmsInitScrnInfo( - register Display *dpy, - int screenNumber) -/* - * DESCRIPTION - * Given a display and screen number, this routine attempts - * to initialize the Xcms per Screen Info structure - * (XcmsPerScrnInfo). - * - * RETURNS - * Returns zero if initialization failed; non-zero otherwise. - */ -{ - XcmsFunctionSet **papSCCFuncSet = _XcmsSCCFuncSets; - XcmsCCC defaultccc; - - /* - * Check if the XcmsCCC's for each screen has been created. - * Really dont need to be created until some routine uses the Xcms - * API routines. - */ - if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) { - if (!_XcmsInitDefaultCCCs(dpy)) { - return(0); - } - } - - defaultccc = (XcmsCCC)dpy->cms.defaultCCCs + screenNumber; - - /* - * For each SCCFuncSet, try its pInitScrnFunc. - * If the function succeeds, then we got it! - */ - - if (!defaultccc->pPerScrnInfo) { - /* - * This is one of two places where XcmsPerScrnInfo structures - * are allocated. There is one allocated per Screen that is - * shared among visuals that do not have specific intensity - * tables. Other XcmsPerScrnInfo structures are created - * for the latter (see XcmsCreateCCC). The ones created - * here are referenced by the default CCC. - */ - if (!(defaultccc->pPerScrnInfo = - Xcalloc(1, sizeof(XcmsPerScrnInfo)))) { - return(0); - } - defaultccc->pPerScrnInfo->state = XcmsInitNone; - } - - while (*papSCCFuncSet != NULL) { - if ((*(*papSCCFuncSet)->screenInitProc)(dpy, screenNumber, - defaultccc->pPerScrnInfo)) { - defaultccc->pPerScrnInfo->state = XcmsInitSuccess; - return(1); - } - papSCCFuncSet++; - } - - /* - * Use Default SCCData - */ - return(_XcmsLRGB_InitScrnDefault(dpy, screenNumber, defaultccc->pPerScrnInfo)); -} - - -/* - * NAME - * _XcmsFreeIntensityMaps - * - * SYNOPSIS - */ -void -_XcmsFreeIntensityMaps( - Display *dpy) -/* - * DESCRIPTION - * Frees all XcmsIntensityMap structures in the linked list - * and sets dpy->cms.perVisualIntensityMaps to NULL. - * - * RETURNS - * void - * - */ -{ - XcmsIntensityMap *pNext, *pFree; - - pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; - while (pNext != NULL) { - pFree = pNext; - pNext = pNext->pNext; - (*pFree->pFreeScreenData)(pFree->screenData); - /* Now free the XcmsIntensityMap structure */ - Xfree(pFree); - } - dpy->cms.perVisualIntensityMaps = (XPointer)NULL; -} - - -/* - * NAME - * _XcmsGetIntensityMap - * - * SYNOPSIS - */ -XcmsIntensityMap * -_XcmsGetIntensityMap( - Display *dpy, - Visual *visual) -/* - * DESCRIPTION - * Attempts to return a per-Visual intensity map. - * - * RETURNS - * Pointer to the XcmsIntensityMap structure if found; - * otherwise NULL - * - */ -{ - VisualID targetID = visual->visualid; - XcmsIntensityMap *pNext; - - pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; - while (pNext != NULL) { - if (targetID == pNext->visualID) { - return(pNext); - } - pNext = pNext->pNext; - } - return((XcmsIntensityMap *)NULL); -} diff --git a/nx-X11/lib/X11/cmsLkCol.c b/nx-X11/lib/X11/cmsLkCol.c deleted file mode 100644 index 15e987424..000000000 --- a/nx-X11/lib/X11/cmsLkCol.c +++ /dev/null @@ -1,193 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * XcmsLkCol.c - * - * DESCRIPTION - * Source for XcmsLookupColor - * - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/* - * NAME - * XcmsLookupColor - - * - * SYNOPSIS - */ -Status -XcmsLookupColor ( - Display *dpy, - Colormap cmap, - _Xconst char *colorname, - XcmsColor *pColor_exact_return, - XcmsColor *pColor_scrn_return, - XcmsColorFormat result_format) -/* - * DESCRIPTION - * The XcmsLookupColor function finds the color specification - * associated with a color name in the Device-Independent Color - * Name Database. - * RETURNS - * This function returns both the color specification found in the - * database (db specification) and the color specification for the - * color displayable by the specified screen (screen - * specification). The calling routine sets the format for these - * returned specifications in the XcmsColor format component. - * If XcmsUndefinedFormat, the specification is returned in the - * format used to store the color in the database. - */ -{ - Status retval1 = XcmsSuccess; - Status retval2 = XcmsSuccess; - XcmsCCC ccc; - register int n; - xLookupColorReply reply; - register xLookupColorReq *req; - XColor def, scr; - -/* - * 0. Check for invalid arguments. - */ - if (dpy == NULL || colorname[0] == '\0' || pColor_scrn_return == 0 - || pColor_exact_return == NULL) { - return(XcmsFailure); - } - - if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { - return(XcmsFailure); - } - -/* - * 1. Convert string to a XcmsColor - */ - if ((retval1 = _XcmsResolveColorString(ccc, &colorname, - pColor_exact_return, result_format)) == XcmsFailure) { - return(XcmsFailure); - } - if (retval1 == _XCMS_NEWNAME) { - goto PassToServer; - } - -/* - * 2. pColor_scrn_return - * Assume the pColor_exact_return has already been adjusted to - * the Client White Point. - * - */ - /* - * Convert to RGB, adjusting for white point differences if necessary. - */ - memcpy((char *)pColor_scrn_return, (char *)pColor_exact_return, - sizeof(XcmsColor)); - if (pColor_scrn_return->format == XcmsRGBFormat) { - retval2 = XcmsSuccess; - } else if ((retval2 = XcmsConvertColors(ccc, pColor_scrn_return, 1, - XcmsRGBFormat, (Bool *)NULL)) == XcmsFailure) { - return(XcmsFailure); - } - - /* - * Then, convert XcmsColor structure to the target specification - * format. Note that we must use NULL instead of passing - * pCompressed. - */ - - if (result_format == XcmsUndefinedFormat) { - result_format = pColor_exact_return->format; - } - if (result_format == XcmsRGBFormat) { - _XcmsUnresolveColor(ccc, pColor_scrn_return); - } else { - _XcmsResolveColor(ccc, pColor_scrn_return); - if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - } - - return(retval1 > retval2 ? retval1 : retval2); - -PassToServer: - /* - * Xcms and i18n methods failed, so lets pass it to the server - * for parsing. - */ - - LockDisplay(dpy); - GetReq (LookupColor, req); - req->cmap = cmap; - req->nbytes = n = strlen(colorname); - req->length += (n + 3) >> 2; - Data (dpy, colorname, (long)n); - if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { - UnlockDisplay(dpy); - SyncHandle(); - return (XcmsFailure); - } - def.red = reply.exactRed; - def.green = reply.exactGreen; - def.blue = reply.exactBlue; - - scr.red = reply.screenRed; - scr.green = reply.screenGreen; - scr.blue = reply.screenBlue; - - UnlockDisplay(dpy); - SyncHandle(); - - _XColor_to_XcmsRGB(ccc, &def, pColor_exact_return, 1); - _XColor_to_XcmsRGB(ccc, &scr, pColor_scrn_return, 1); - - /* - * Then, convert XcmsColor structure to the target specification - * format. Note that we must use NULL instead of passing - * pCompressed. - */ - - if (result_format != XcmsRGBFormat - && result_format != XcmsUndefinedFormat) { - if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, - (Bool *) NULL) == XcmsFailure) { - return(XcmsFailure); - } - } - - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/cmsMath.c b/nx-X11/lib/X11/cmsMath.c deleted file mode 100644 index 487eb3f9c..000000000 --- a/nx-X11/lib/X11/cmsMath.c +++ /dev/null @@ -1,140 +0,0 @@ - -/* - -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Stephen Gildea, MIT X Consortium, January 1991 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xcmsint.h" - -#ifdef DEBUG -#include -#endif - -#include -#ifndef DBL_EPSILON -#define DBL_EPSILON 1e-6 -#endif - -#ifdef _X_ROOT_STATS -int cbrt_loopcount; -int sqrt_loopcount; -#endif - -/* Newton's Method: x_n+1 = x_n - ( f(x_n) / f'(x_n) ) */ - - -/* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */ - -double -_XcmsCubeRoot(double a) -{ - register double abs_a, cur_guess, delta; - -#ifdef DEBUG - printf("_XcmsCubeRoot passed in %g\n", a); -#endif -#ifdef _X_ROOT_STATS - cbrt_loopcount = 0; -#endif - if (a == 0.) - return 0.; - - abs_a = a<0. ? -a : a; /* convert to positive to speed loop tests */ - - /* arbitrary first guess */ - if (abs_a > 1.) - cur_guess = abs_a/8.; - else - cur_guess = abs_a*8.; - - do { -#ifdef _X_ROOT_STATS - cbrt_loopcount++; -#endif - delta = (cur_guess - abs_a/(cur_guess*cur_guess))/3.; - cur_guess -= delta; - if (delta < 0.) delta = -delta; - } while (delta >= cur_guess*DBL_EPSILON); - - if (a < 0.) - cur_guess = -cur_guess; - -#ifdef DEBUG - printf("_XcmsCubeRoot returning %g\n", cur_guess); -#endif - return cur_guess; -} - - - -/* for square roots, x^2 - a = 0, x_new = x - 1/2 (x - a/x) */ - -double -_XcmsSquareRoot(double a) -{ - register double cur_guess, delta; - -#ifdef DEBUG - printf("_XcmsSquareRoot passed in %g\n", a); -#endif -#ifdef _X_ROOT_STATS - sqrt_loopcount = 0; -#endif - if (a == 0.) - return 0.; - - if (a < 0.) { - /* errno = EDOM; */ - return 0.; - } - - /* arbitrary first guess */ - if (a > 1.) - cur_guess = a/4.; - else - cur_guess = a*4.; - - do { -#ifdef _X_ROOT_STATS - sqrt_loopcount++; -#endif - delta = (cur_guess - a/cur_guess)/2.; - cur_guess -= delta; - if (delta < 0.) delta = -delta; - } while (delta >= cur_guess*DBL_EPSILON); - -#ifdef DEBUG - printf("_XcmsSquareRoot returning %g\n", cur_guess); -#endif - return cur_guess; -} - diff --git a/nx-X11/lib/X11/cmsProp.c b/nx-X11/lib/X11/cmsProp.c deleted file mode 100644 index a7aa5b5c5..000000000 --- a/nx-X11/lib/X11/cmsProp.c +++ /dev/null @@ -1,153 +0,0 @@ - -/* - * - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * XcmsProp.c - * - * DESCRIPTION - * This utility routines for manipulating properties. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - - -/************************************************************************ - * * - * API PRIVATE ROUTINES * - * * - ************************************************************************/ - - -/* - * NAME - * _XcmsGetElement -- get an element value from the property passed - * - * SYNOPSIS - */ -unsigned long -_XcmsGetElement( - int format, - char **pValue, - unsigned long *pCount) -/* - * DESCRIPTION - * Get the next element from the property and return it. - * Also increment the pointer the amount needed. - * - * Returns - * unsigned long - */ -{ - unsigned long value; - - switch (format) { - case 32: - value = *((unsigned long *)(*pValue)) & 0xFFFFFFFF; - *pValue += sizeof(unsigned long); - *pCount -= 1; - break; - case 16: - value = *((unsigned short *)(*pValue)); - *pValue += sizeof(unsigned short); - *pCount -= 1; - break; - case 8: - value = *((unsigned char *) (*pValue)); - *pValue += 1; - *pCount -= 1; - break; - default: - value = 0; - break; - } - return(value); -} - - -/* - * NAME - * _XcmsGetProperty -- Determine the existance of a property - * - * SYNOPSIS - */ -int -_XcmsGetProperty( - Display *pDpy, - Window w, - Atom property, - int *pFormat, - unsigned long *pNItems, - unsigned long *pNBytes, - char **pValue) -/* - * DESCRIPTION - * - * Returns - * 0 if property does not exist. - * 1 if property exists. - */ -{ - char *prop_ret; - int format_ret; - long len = 6516; - #ifdef NXAGENT_SERVER - unsigned long nitems_ret, after_ret = 0; - #else - unsigned long nitems_ret, after_ret; - #endif - Atom atom_ret; - int xgwp_ret; - - while (True) { - xgwp_ret = XGetWindowProperty (pDpy, w, property, 0, len, False, - XA_INTEGER, &atom_ret, &format_ret, - &nitems_ret, &after_ret, - (unsigned char **)&prop_ret); - if (xgwp_ret == Success && after_ret > 0) { - len += nitems_ret * (format_ret >> 3); - XFree (prop_ret); - } else { - break; - } - } - if (xgwp_ret != Success || format_ret == 0 || nitems_ret == 0) { - /* the property does not exist or is of an unexpected type or - getting window property failed */ - return(XcmsFailure); - } - - *pFormat = format_ret; - *pNItems = nitems_ret; - *pNBytes = nitems_ret * (format_ret >> 3); - *pValue = prop_ret; - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/cmsTrig.c b/nx-X11/lib/X11/cmsTrig.c deleted file mode 100644 index b23033aa8..000000000 --- a/nx-X11/lib/X11/cmsTrig.c +++ /dev/null @@ -1,578 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - */ - -/* - * It should be pointed out that for simplicity's sake, the - * environment parameters are defined as floating point constants, - * rather than octal or hexadecimal initializations of allocated - * storage areas. This means that the range of allowed numbers - * may not exactly match the hardware's capabilities. For example, - * if the maximum positive double precision floating point number - * is EXACTLY 1.11...E100 and the constant "MAXDOUBLE is - * defined to be 1.11E100 then the numbers between 1.11E100 and - * 1.11...E100 are considered to be undefined. For most - * applications, this will cause no problems. - * - * An alternate method is to allocate a global static "double" variable, - * say "maxdouble", and use a union declaration and initialization - * to initialize it with the proper bits for the EXACT maximum value. - * This was not done because the only compilers available to the - * author did not fully support union initialization features. - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xcmsint.h" - -/* forward/static */ -static double _XcmsModulo(double value, double base); -static double _XcmsPolynomial( - register int order, - double const *coeffs, - double x); -static double -_XcmsModuloF( - double val, - register double *dp); - -/* - * DEFINES - */ -#define XCMS_MAXERROR 0.000001 -#define XCMS_MAXITER 10000 -#define XCMS_PI 3.14159265358979323846264338327950 -#define XCMS_TWOPI 6.28318530717958620 -#define XCMS_HALFPI 1.57079632679489660 -#define XCMS_FOURTHPI 0.785398163397448280 -#define XCMS_SIXTHPI 0.523598775598298820 -#define XCMS_RADIANS(d) ((d) * XCMS_PI / 180.0) -#define XCMS_DEGREES(r) ((r) * 180.0 / XCMS_PI) -#define XCMS_X6_UNDERFLOWS (4.209340e-52) /* X**6 almost underflows */ -#define XCMS_X16_UNDERFLOWS (5.421010e-20) /* X**16 almost underflows*/ -#define XCMS_CHAR_BIT 8 -#define XCMS_LONG_MAX 0x7FFFFFFF -#define XCMS_DEXPLEN 11 -#define XCMS_NBITS(type) (XCMS_CHAR_BIT * (int)sizeof(type)) -#define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) - -/* XCMS_DMAXPOWTWO - largest power of two exactly representable as a double */ -#define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \ - (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1))) - -/* - * LOCAL VARIABLES - */ - -static double const cos_pcoeffs[] = { - 0.12905394659037374438e7, - -0.37456703915723204710e6, - 0.13432300986539084285e5, - -0.11231450823340933092e3 -}; - -static double const cos_qcoeffs[] = { - 0.12905394659037373590e7, - 0.23467773107245835052e5, - 0.20969518196726306286e3, - 1.0 -}; - -static double const sin_pcoeffs[] = { - 0.20664343336995858240e7, - -0.18160398797407332550e6, - 0.35999306949636188317e4, - -0.20107483294588615719e2 -}; - -static double const sin_qcoeffs[] = { - 0.26310659102647698963e7, - 0.39270242774649000308e5, - 0.27811919481083844087e3, - 1.0 -}; - -/* - * - * FUNCTION - * - * _XcmsCosine double precision cosine - * - * KEY WORDS - * - * cos - * machine independent routines - * trigonometric functions - * math libraries - * - * DESCRIPTION - * - * Returns double precision cosine of double precision - * floating point argument. - * - * USAGE - * - * double _XcmsCosine (x) - * double x; - * - * REFERENCES - * - * Computer Approximations, J.F. Hart et al, John Wiley & Sons, - * 1968, pp. 112-120. - * - * RESTRICTIONS - * - * The sin and cos routines are interactive in the sense that - * in the process of reducing the argument to the range -PI/4 - * to PI/4, each may call the other. Ultimately one or the - * other uses a polynomial approximation on the reduced - * argument. The sin approximation has a maximum relative error - * of 10**(-17.59) and the cos approximation has a maximum - * relative error of 10**(-16.18). - * - * These error bounds assume exact arithmetic - * in the polynomial evaluation. Additional rounding and - * truncation errors may occur as the argument is reduced - * to the range over which the polynomial approximation - * is valid, and as the polynomial is evaluated using - * finite-precision arithmetic. - * - * PROGRAMMER - * - * Fred Fish - * - * INTERNALS - * - * Computes cos(x) from: - * - * (1) Reduce argument x to range -PI to PI. - * - * (2) If x > PI/2 then call cos recursively - * using relation cos(x) = -cos(x - PI). - * - * (3) If x < -PI/2 then call cos recursively - * using relation cos(x) = -cos(x + PI). - * - * (4) If x > PI/4 then call sin using - * relation cos(x) = sin(PI/2 - x). - * - * (5) If x < -PI/4 then call cos using - * relation cos(x) = sin(PI/2 + x). - * - * (6) If x would cause underflow in approx - * evaluation arithmetic then return - * sqrt(1.0 - x**2). - * - * (7) By now x has been reduced to range - * -PI/4 to PI/4 and the approximation - * from HART pg. 119 can be used: - * - * cos(x) = ( p(y) / q(y) ) - * Where: - * - * y = x * (4/PI) - * - * p(y) = SUM [ Pj * (y**(2*j)) ] - * over j = {0,1,2,3} - * - * q(y) = SUM [ Qj * (y**(2*j)) ] - * over j = {0,1,2,3} - * - * P0 = 0.12905394659037374438571854e+7 - * P1 = -0.3745670391572320471032359e+6 - * P2 = 0.134323009865390842853673e+5 - * P3 = -0.112314508233409330923e+3 - * Q0 = 0.12905394659037373590295914e+7 - * Q1 = 0.234677731072458350524124e+5 - * Q2 = 0.2096951819672630628621e+3 - * Q3 = 1.0000... - * (coefficients from HART table #3843 pg 244) - * - * - * **** NOTE **** The range reduction relations used in - * this routine depend on the final approximation being valid - * over the negative argument range in addition to the positive - * argument range. The particular approximation chosen from - * HART satisfies this requirement, although not explicitly - * stated in the text. This may not be true of other - * approximations given in the reference. - * - */ - -double _XcmsCosine(double x) -{ - auto double y; - auto double yt2; - double retval; - - if (x < -XCMS_PI || x > XCMS_PI) { - x = _XcmsModulo (x, XCMS_TWOPI); - if (x > XCMS_PI) { - x = x - XCMS_TWOPI; - } else if (x < -XCMS_PI) { - x = x + XCMS_TWOPI; - } - } - if (x > XCMS_HALFPI) { - retval = -(_XcmsCosine (x - XCMS_PI)); - } else if (x < -XCMS_HALFPI) { - retval = -(_XcmsCosine (x + XCMS_PI)); - } else if (x > XCMS_FOURTHPI) { - retval = _XcmsSine (XCMS_HALFPI - x); - } else if (x < -XCMS_FOURTHPI) { - retval = _XcmsSine (XCMS_HALFPI + x); - } else if (x < XCMS_X6_UNDERFLOWS && x > -XCMS_X6_UNDERFLOWS) { - retval = _XcmsSquareRoot (1.0 - (x * x)); - } else { - y = x / XCMS_FOURTHPI; - yt2 = y * y; - retval = _XcmsPolynomial (3, cos_pcoeffs, yt2) / _XcmsPolynomial (3, cos_qcoeffs, yt2); - } - return (retval); -} - - -/* - * FUNCTION - * - * _XcmsModulo double precision modulo - * - * KEY WORDS - * - * _XcmsModulo - * machine independent routines - * math libraries - * - * DESCRIPTION - * - * Returns double precision modulo of two double - * precision arguments. - * - * USAGE - * - * double _XcmsModulo (value, base) - * double value; - * double base; - * - * PROGRAMMER - * - * Fred Fish - * - */ -static double _XcmsModulo(double value, double base) -{ - auto double intpart; - - value /= base; - value = _XcmsModuloF (value, &intpart); - value *= base; - return(value); -} - - -/* - * frac = (double) _XcmsModuloF(double val, double *dp) - * return fractional part of 'val' - * set *dp to integer part of 'val' - * - * Note -> only compiled for the CA or KA. For the KB/MC, - * "math.c" instantiates a copy of the inline function - * defined in "math.h". - */ -static double -_XcmsModuloF( - double val, - register double *dp) -{ - register double abs; - /* - * Don't use a register for this. The extra precision this results - * in on some systems causes problems. - */ - double ip; - - /* should check for illegal values here - nan, inf, etc */ - abs = XCMS_FABS(val); - if (abs >= XCMS_DMAXPOWTWO) { - ip = val; - } else { - ip = abs + XCMS_DMAXPOWTWO; /* dump fraction */ - ip -= XCMS_DMAXPOWTWO; /* restore w/o frac */ - if (ip > abs) /* if it rounds up */ - ip -= 1.0; /* fix it */ - ip = XCMS_FABS(ip); - } - *dp = ip; - return (val - ip); /* signed fractional part */ -} - - -/* - * FUNCTION - * - * _XcmsPolynomial double precision polynomial evaluation - * - * KEY WORDS - * - * poly - * machine independent routines - * math libraries - * - * DESCRIPTION - * - * Evaluates a polynomial and returns double precision - * result. Is passed a the order of the polynomial, - * a pointer to an array of double precision polynomial - * coefficients (in ascending order), and the independent - * variable. - * - * USAGE - * - * double _XcmsPolynomial (order, coeffs, x) - * int order; - * double *coeffs; - * double x; - * - * PROGRAMMER - * - * Fred Fish - * - * INTERNALS - * - * Evalates the polynomial using recursion and the form: - * - * P(x) = P0 + x(P1 + x(P2 +...x(Pn))) - * - */ - -static double _XcmsPolynomial( - register int order, - double const *coeffs, - double x) -{ - auto double rtn_value; - - coeffs += order; - rtn_value = *coeffs--; - while(order-- > 0) - rtn_value = *coeffs-- + (x * rtn_value); - - return(rtn_value); -} - - -/* - * FUNCTION - * - * _XcmsSine double precision sine - * - * KEY WORDS - * - * sin - * machine independent routines - * trigonometric functions - * math libraries - * - * DESCRIPTION - * - * Returns double precision sine of double precision - * floating point argument. - * - * USAGE - * - * double _XcmsSine (x) - * double x; - * - * REFERENCES - * - * Computer Approximations, J.F. Hart et al, John Wiley & Sons, - * 1968, pp. 112-120. - * - * RESTRICTIONS - * - * The sin and cos routines are interactive in the sense that - * in the process of reducing the argument to the range -PI/4 - * to PI/4, each may call the other. Ultimately one or the - * other uses a polynomial approximation on the reduced - * argument. The sin approximation has a maximum relative error - * of 10**(-17.59) and the cos approximation has a maximum - * relative error of 10**(-16.18). - * - * These error bounds assume exact arithmetic - * in the polynomial evaluation. Additional rounding and - * truncation errors may occur as the argument is reduced - * to the range over which the polynomial approximation - * is valid, and as the polynomial is evaluated using - * finite-precision arithmetic. - * - * PROGRAMMER - * - * Fred Fish - * - * INTERNALS - * - * Computes sin(x) from: - * - * (1) Reduce argument x to range -PI to PI. - * - * (2) If x > PI/2 then call sin recursively - * using relation sin(x) = -sin(x - PI). - * - * (3) If x < -PI/2 then call sin recursively - * using relation sin(x) = -sin(x + PI). - * - * (4) If x > PI/4 then call cos using - * relation sin(x) = cos(PI/2 - x). - * - * (5) If x < -PI/4 then call cos using - * relation sin(x) = -cos(PI/2 + x). - * - * (6) If x is small enough that polynomial - * evaluation would cause underflow - * then return x, since sin(x) - * approaches x as x approaches zero. - * - * (7) By now x has been reduced to range - * -PI/4 to PI/4 and the approximation - * from HART pg. 118 can be used: - * - * sin(x) = y * ( p(y) / q(y) ) - * Where: - * - * y = x * (4/PI) - * - * p(y) = SUM [ Pj * (y**(2*j)) ] - * over j = {0,1,2,3} - * - * q(y) = SUM [ Qj * (y**(2*j)) ] - * over j = {0,1,2,3} - * - * P0 = 0.206643433369958582409167054e+7 - * P1 = -0.18160398797407332550219213e+6 - * P2 = 0.359993069496361883172836e+4 - * P3 = -0.2010748329458861571949e+2 - * Q0 = 0.263106591026476989637710307e+7 - * Q1 = 0.3927024277464900030883986e+5 - * Q2 = 0.27811919481083844087953e+3 - * Q3 = 1.0000... - * (coefficients from HART table #3063 pg 234) - * - * - * **** NOTE **** The range reduction relations used in - * this routine depend on the final approximation being valid - * over the negative argument range in addition to the positive - * argument range. The particular approximation chosen from - * HART satisfies this requirement, although not explicitly - * stated in the text. This may not be true of other - * approximations given in the reference. - * - */ - -double -_XcmsSine (double x) -{ - double y; - double yt2; - double retval; - - if (x < -XCMS_PI || x > XCMS_PI) { - x = _XcmsModulo (x, XCMS_TWOPI); - if (x > XCMS_PI) { - x = x - XCMS_TWOPI; - } else if (x < -XCMS_PI) { - x = x + XCMS_TWOPI; - } - } - if (x > XCMS_HALFPI) { - retval = -(_XcmsSine (x - XCMS_PI)); - } else if (x < -XCMS_HALFPI) { - retval = -(_XcmsSine (x + XCMS_PI)); - } else if (x > XCMS_FOURTHPI) { - retval = _XcmsCosine (XCMS_HALFPI - x); - } else if (x < -XCMS_FOURTHPI) { - retval = -(_XcmsCosine (XCMS_HALFPI + x)); - } else if (x < XCMS_X6_UNDERFLOWS && x > -XCMS_X6_UNDERFLOWS) { - retval = x; - } else { - y = x / XCMS_FOURTHPI; - yt2 = y * y; - retval = y * (_XcmsPolynomial (3, sin_pcoeffs, yt2) / _XcmsPolynomial(3, sin_qcoeffs, yt2)); - } - return(retval); -} - - -/* - * NAME - * _XcmsArcTangent - * - * SYNOPSIS - */ -double -_XcmsArcTangent(double x) -/* - * DESCRIPTION - * Computes the arctangent. - * This is an implementation of the Gauss algorithm as - * described in: - * Forman S. Acton, Numerical Methods That Work, - * New York, NY, Harper & Row, 1970. - * - * RETURNS - * Returns the arctangent - */ -{ - double ai, a1 = 0.0, bi, b1 = 0.0, l, d; - double maxerror; - int i; - - if (x == 0.0) { - return (0.0); - } - if (x < 1.0) { - maxerror = x * XCMS_MAXERROR; - } else { - maxerror = XCMS_MAXERROR; - } - ai = _XcmsSquareRoot( 1.0 / (1.0 + (x * x)) ); - bi = 1.0; - for (i = 0; i < XCMS_MAXITER; i++) { - a1 = (ai + bi) / 2.0; - b1 = _XcmsSquareRoot((a1 * bi)); - if (a1 == b1) - break; - d = XCMS_FABS(a1 - b1); - if (d < maxerror) - break; - ai = a1; - bi = b1; - } - - l = ((a1 > b1) ? b1 : a1); - - a1 = _XcmsSquareRoot(1 + (x * x)); - return (x / (a1 * l)); -} diff --git a/nx-X11/lib/X11/cursorfont.h b/nx-X11/lib/X11/cursorfont.h deleted file mode 100644 index a0fbf3c6b..000000000 --- a/nx-X11/lib/X11/cursorfont.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#if !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) -#define _X11_CURSORFONT_H_ -#define _cursorfont_h_ - -#define XC_num_glyphs 154 -#define XC_X_cursor 0 -#define XC_arrow 2 -#define XC_based_arrow_down 4 -#define XC_based_arrow_up 6 -#define XC_boat 8 -#define XC_bogosity 10 -#define XC_bottom_left_corner 12 -#define XC_bottom_right_corner 14 -#define XC_bottom_side 16 -#define XC_bottom_tee 18 -#define XC_box_spiral 20 -#define XC_center_ptr 22 -#define XC_circle 24 -#define XC_clock 26 -#define XC_coffee_mug 28 -#define XC_cross 30 -#define XC_cross_reverse 32 -#define XC_crosshair 34 -#define XC_diamond_cross 36 -#define XC_dot 38 -#define XC_dotbox 40 -#define XC_double_arrow 42 -#define XC_draft_large 44 -#define XC_draft_small 46 -#define XC_draped_box 48 -#define XC_exchange 50 -#define XC_fleur 52 -#define XC_gobbler 54 -#define XC_gumby 56 -#define XC_hand1 58 -#define XC_hand2 60 -#define XC_heart 62 -#define XC_icon 64 -#define XC_iron_cross 66 -#define XC_left_ptr 68 -#define XC_left_side 70 -#define XC_left_tee 72 -#define XC_leftbutton 74 -#define XC_ll_angle 76 -#define XC_lr_angle 78 -#define XC_man 80 -#define XC_middlebutton 82 -#define XC_mouse 84 -#define XC_pencil 86 -#define XC_pirate 88 -#define XC_plus 90 -#define XC_question_arrow 92 -#define XC_right_ptr 94 -#define XC_right_side 96 -#define XC_right_tee 98 -#define XC_rightbutton 100 -#define XC_rtl_logo 102 -#define XC_sailboat 104 -#define XC_sb_down_arrow 106 -#define XC_sb_h_double_arrow 108 -#define XC_sb_left_arrow 110 -#define XC_sb_right_arrow 112 -#define XC_sb_up_arrow 114 -#define XC_sb_v_double_arrow 116 -#define XC_shuttle 118 -#define XC_sizing 120 -#define XC_spider 122 -#define XC_spraycan 124 -#define XC_star 126 -#define XC_target 128 -#define XC_tcross 130 -#define XC_top_left_arrow 132 -#define XC_top_left_corner 134 -#define XC_top_right_corner 136 -#define XC_top_side 138 -#define XC_top_tee 140 -#define XC_trek 142 -#define XC_ul_angle 144 -#define XC_umbrella 146 -#define XC_ur_angle 148 -#define XC_watch 150 -#define XC_xterm 152 - -#endif /* !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) */ diff --git a/nx-X11/lib/X11/evtomask.c b/nx-X11/lib/X11/evtomask.c deleted file mode 100644 index c5dbad262..000000000 --- a/nx-X11/lib/X11/evtomask.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -/* - * This array can be used given an event type to determine the mask bits - * that could have generated it. - */ -long const _Xevent_to_mask [LASTEvent] = { - 0, /* no event 0 */ - 0, /* no event 1 */ - KeyPressMask, /* KeyPress */ - KeyReleaseMask, /* KeyRelease */ - ButtonPressMask, /* ButtonPress */ - ButtonReleaseMask, /* ButtonRelease */ - PointerMotionMask|PointerMotionHintMask|Button1MotionMask| - Button2MotionMask|Button3MotionMask|Button4MotionMask| - Button5MotionMask|ButtonMotionMask, /* MotionNotify */ - EnterWindowMask, /* EnterNotify */ - LeaveWindowMask, /* LeaveNotify */ - FocusChangeMask, /* FocusIn */ - FocusChangeMask, /* FocusOut */ - KeymapStateMask, /* KeymapNotify */ - ExposureMask, /* Expose */ - ExposureMask, /* GraphicsExpose */ - ExposureMask, /* NoExpose */ - VisibilityChangeMask, /* VisibilityNotify */ - SubstructureNotifyMask, /* CreateNotify */ - StructureNotifyMask|SubstructureNotifyMask, /* DestroyNotify */ - StructureNotifyMask|SubstructureNotifyMask, /* UnmapNotify */ - StructureNotifyMask|SubstructureNotifyMask, /* MapNotify */ - SubstructureRedirectMask, /* MapRequest */ - SubstructureNotifyMask|StructureNotifyMask, /* ReparentNotify */ - StructureNotifyMask|SubstructureNotifyMask, /* ConfigureNotify */ - SubstructureRedirectMask, /* ConfigureRequest */ - SubstructureNotifyMask|StructureNotifyMask, /* GravityNotify */ - ResizeRedirectMask, /* ResizeRequest */ - SubstructureNotifyMask|StructureNotifyMask, /* CirculateNotify */ - SubstructureRedirectMask, /* CirculateRequest */ - PropertyChangeMask, /* PropertyNotify */ - 0, /* SelectionClear */ - 0, /* SelectionRequest */ - 0, /* SelectionNotify */ - ColormapChangeMask, /* ColormapNotify */ - 0, /* ClientMessage */ - 0, /* MappingNotify */ -}; diff --git a/nx-X11/lib/X11/globals.c b/nx-X11/lib/X11/globals.c deleted file mode 100644 index efae2f8bb..000000000 --- a/nx-X11/lib/X11/globals.c +++ /dev/null @@ -1,108 +0,0 @@ -/* - -Copyright 1989, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * - * Global data - * - * This file should contain only those objects which must be predefined. - */ -#ifdef HAVE_CONFIG_H -#include -#endif -#include - - -/* - * If possible, it is useful to have the global data default to a null value. - * Some shared library implementations are *much* happier if there isn't any - * global initialized data. - */ -#ifdef NULL_NOT_ZERO /* then need to initialize */ -#define SetZero(t,var,z) t var = z -#else -#define SetZero(t,var,z) t var -#endif - -#ifdef USL_SHAREDLIB /* then need extra variables */ -/* - * If we need to define extra variables for each global - */ -#define ZEROINIT(t,var,val) SetZero(t,var,val); \ - SetZero (long, _libX_##var##Flag, 0); \ - SetZero (void *, _libX_##var##Ptr, NULL) - -#else /* else not USL_SHAREDLIB */ -/* - * no extra crud - */ -#define ZEROINIT(t,var,val) SetZero (t, var, val) - -#endif /* USL_SHAREDLIB */ - - -/* - * Error handlers; used to be in XlibInt.c - */ -ZEROINIT (XErrorHandler, _XErrorFunction, NULL); -ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL); -ZEROINIT (_XQEvent *, _qfree, NULL); - - -/* - * Debugging information and display list; used to be in XOpenDis.c - */ -ZEROINIT (int, _Xdebug, 0); -ZEROINIT (Display *, _XHeadOfDisplayList, NULL); - - -#ifdef XTEST1 -/* - * Stuff for input synthesis extension: - */ -/* - * Holds the two event type codes for this extension. The event type codes - * for this extension may vary depending on how many extensions are installed - * already, so the initial values given below will be added to the base event - * code that is aquired when this extension is installed. - * - * These two variables must be available to programs that use this extension. - */ -int XTestInputActionType = 0; -int XTestFakeAckType = 1; -#endif - -/* - * NOTE: any additional external definition NEED - * to be inserted BELOW this point!!! - */ - -/* - * NOTE: any additional external definition NEED - * to be inserted ABOVE this point!!! - */ diff --git a/nx-X11/lib/X11/imCallbk.c b/nx-X11/lib/X11/imCallbk.c deleted file mode 100644 index 4e091d8ef..000000000 --- a/nx-X11/lib/X11/imCallbk.c +++ /dev/null @@ -1,747 +0,0 @@ -/*********************************************************************** -Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts, -Copyright 1994 by FUJITSU LIMITED -Copyright 1994 by Sony Corporation - - All Rights Reserved - -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 -supporting documentation, and that the names of Digital, FUJITSU -LIMITED and Sony Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. - -DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED -AND 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. - - Author: Hiroyuki Miyamoto Digital Equipment Corporation - miyamoto@jrd.dec.com - Modifier: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Makoto Wakamatsu Sony Corporation - makoto@sm.sony.co.jp - -***********************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "XlcPubI.h" - -#define sz_CARD8 1 -#define sz_INT8 1 -#define sz_CARD16 2 -#define sz_INT16 2 -#define sz_BITMASK16 sz_CARD16 -#define sz_CARD32 4 -#define sz_INT32 4 -#define sz_BITMASK32 sz_CARD32 -#define sz_XIMID sizeof(XIMID) -#define sz_XICID sizeof(XICID) -#define sz_XIMATTRID sizeof(XIMATTRID) -#define sz_XICATTRID sizeof(XICATTRID) -#define sz_ximPacketHeader (XIM_HEADER_SIZE + sz_XIMID + sz_XICID) -#define sz_ximGeometry 0 -#define sz_ximStrConversion (sz_CARD32 + sz_CARD32 + sz_CARD32 + sz_CARD32) -#define sz_ximPreeditStart 0 -#define sz_ximPreeditStartReply sz_INT32 -#define sz_ximPreeditCaret (sz_INT32 + sz_CARD32 + sz_CARD32) -#define sz_ximPreeditCaretReply sz_CARD32 -#define sz_ximPreeditDone 0 -#define sz_ximStatusStart 0 -#define sz_ximStatusDone 0 - -typedef enum { - XimCbSuccess, - XimCbNoCallback, - XimCbError, - XimCbQueued, - XimCbBadContextID, - XimCbBadOpcode -} XimCbStatus; - -typedef XimCbStatus (*XimCb)( - Xim, Xic, char*, int - ); - -#define PACKET_TO_MAJOROPCODE(p) (*(CARD8*)((CARD8*)(p))) -#define PACKET_TO_MINOROPCODE(p) (*(CARD8*)((CARD8*)(p) + sz_CARD8)) -#define PACKET_TO_LENGTH(p) (*(CARD16*)((CARD8*)(p) + sz_CARD8 + sz_CARD8)) -#define PACKET_TO_IMID(p) (*(XIMID*)((CARD8*)(p) + XIM_HEADER_SIZE)) -#define PACKET_TO_ICID(p) (*(XICID*)((CARD8*)(p) + XIM_HEADER_SIZE + sz_XIMID)) - -#define _XimWriteData(im,len,data) \ - (im->private.proto.write((im),(len),(XPointer)(data))) -#define _XimReadData(im,buf,buf_len,len) \ - (im->private.proto.read((im),(XPointer)(buf),(buf_len),&(len))) -#define _XimFlushData(im) im->private.proto.flush((im)) - -static XimCbStatus _XimGeometryCallback(Xim, Xic, char*, int); -static XimCbStatus _XimStrConversionCallback(Xim, Xic, char*, int); -static XimCbStatus _XimPreeditStartCallback(Xim, Xic, char*, int); -static XimCbStatus _XimPreeditDoneCallback(Xim, Xic, char*, int); -static void _free_memory_for_text(XIMText*); -static XimCbStatus _XimPreeditDrawCallback(Xim, Xic, char*, int); -static XimCbStatus _XimPreeditCaretCallback(Xim, Xic, char*, int); -static XimCbStatus _XimStatusStartCallback(Xim, Xic, char*, int); -static XimCbStatus _XimStatusDoneCallback(Xim, Xic, char*, int); -static XimCbStatus _XimStatusDrawCallback(Xim, Xic, char*, int); -static XimCbStatus _XimPreeditStateNotifyCallback(Xim, Xic, char *, int); - -#if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) -#define RConst /**/ -#else -#define RConst const -#endif - -/* NOTE: - * the table below depends on the protocol number - * defined in the IM Protocol document. - */ -static RConst XimCb callback_table[] = { - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #000-009 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #010-019 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #020-029 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #030-039 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #040-049 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #050-059 */ - NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #060-069 */ - _XimGeometryCallback, /* #070 */ - _XimStrConversionCallback, /* #071 */ - NULL, /* #072 */ - _XimPreeditStartCallback, /* #073 */ - NULL, /* #074 */ - _XimPreeditDrawCallback, /* #075 */ - _XimPreeditCaretCallback, /* #076 */ - NULL, /* #077 */ - _XimPreeditDoneCallback, /* #078 */ - _XimStatusStartCallback, /* #079 */ - _XimStatusDrawCallback, /* #080 */ - _XimStatusDoneCallback, /* #081 */ - _XimPreeditStateNotifyCallback /* #082 */ - }; - - -static Bool -_XimIsReadyForProcess(Xic ic) -{ - return(!ic->private.proto.waitCallback); /* check HM */ -} - -static void -_XimProcessPendingCallbacks(Xic ic) -{ - XimPendingCallback pcbq; - - while (((pcbq = ic->private.proto.pend_cb_que) != (XimPendingCallback)NULL) - && _XimIsReadyForProcess(ic)) { - (void) (*callback_table[pcbq->major_opcode])(pcbq->im, - pcbq->ic, - pcbq->proto, - pcbq->proto_len); - ic->private.proto.pend_cb_que = pcbq->next; - Xfree(pcbq->proto); /* free memory of XimPendingCallback */ - Xfree(pcbq); - } -} - -static void -_XimPutCbIntoQueue(Xic ic, XimPendingCallback call_data) -{ - XimPendingCallback pcbq = ic->private.proto.pend_cb_que; - - /* Queuing is FIFO - */ - while (pcbq != (XimPendingCallback)NULL) { - if (pcbq->next == (XimPendingCallback)NULL) { - break; - } - pcbq = pcbq->next; - } - if (pcbq == (XimPendingCallback)NULL) { - ic->private.proto.pend_cb_que = call_data; - } - else { - pcbq->next = call_data; - } -} - -Bool -_XimCbDispatch(Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - /* `data' points to the beginning of the packet defined in IM Protocol doc. - */ - int major_opcode = PACKET_TO_MAJOROPCODE(data); - XIMID imid = PACKET_TO_IMID(data); - XICID icid = PACKET_TO_ICID(data); - Xim im = (Xim)call_data; /* check HM */ - Xic ic = _XimICOfXICID(im, icid); - char* proto; - int proto_len; - - /* check validity of im/ic - */ - if ((imid != im->private.proto.imid) || !ic) { - return False; /* status = XimCbBadContextID; */ - } - - /* process pending callbacks - */ - _XimProcessPendingCallbacks(ic); - - /* check if the protocol should be processed here - */ - if (major_opcode > 82) { - return False; /* status = XimCbBadOpcode; */ - } - if (!callback_table[major_opcode]) { - return False; /* status = XimCbBadOpcode; */ - } - - /* move the pointer ahead by the IM Protocol packet header size - */ - proto = (char*)data + sz_ximPacketHeader; - proto_len = (int)len - sz_ximPacketHeader; - - /* check if it can be processed right away - * and if no, queue the protocol, otherwise invoke a callback - */ - if (!_XimIsReadyForProcess(ic)) { - - /* queue the protocol - */ - XimPendingCallback pcb; - char *proto_buf = (proto_len > 0) ? Xmalloc(proto_len) : NULL; - - pcb = Xmalloc(sizeof(XimPendingCallbackRec)); - if (pcb && (proto_len <= 0 || proto_buf)) { - if (proto_len > 0) - memcpy(proto_buf, proto, proto_len); - - pcb->major_opcode = major_opcode; - pcb->im = im; - pcb->ic = ic; - pcb->proto = proto_buf; - pcb->proto_len = proto_len; - pcb->next = (XimPendingCallback)NULL; /* queue is FIFO */ - _XimPutCbIntoQueue(ic, pcb); - /* status = XimCbQueued; */ - } else { - /* status = XimCbError; */ - Xfree(pcb); - Xfree(proto_buf); - } - } - else { - /* invoke each callback according to the major opcode. - * `proto' points to the next address of IM-ID and IC-ID. - * `proto_len' specifies the packet length. - */ - (void) (*callback_table[major_opcode])(im, ic, proto, proto_len); - } - return True; -} - -static XimCbStatus -_XimGeometryCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.geometry_callback; - - /* invoke the callack - */ - if (cb && cb->callback) { - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); - } - else { - - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimStrConversionCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.string_conversion_callback; /* check HM */ - XIMStringConversionCallbackStruct cbrec; - - /* invoke the callback - */ - if (cb && cb->callback) { - int p = XIM_HEADER_SIZE; - cbrec.position = (XIMStringConversionPosition) - *(CARD32*)&proto[p]; p += sz_CARD32; - cbrec.direction = (XIMCaretDirection) - *(CARD32*)&proto[p]; p += sz_CARD32; - cbrec.operation = (XIMStringConversionOperation) - *(CARD32*)&proto[p]; p += sz_CARD32; - cbrec.factor = (unsigned short) - *(CARD32*)&proto[p]; - - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbrec); - } - else { - - /* no callback registered - */ - _XimError(im, ic, - (CARD16)XIM_BadSomething, - (INT16)len, - (CARD16)XIM_STR_CONVERSION, - (char*)proto); /* send XIM_ERROR */ - return XimCbNoCallback; - } - - /* send a reply - */ - { - CARD8 *buf; - INT16 buf_len; - int p, length_in_bytes, i; - - /* Assumption: - * `cbrec.text->length' means the string length in characters - */ - { - length_in_bytes = (cbrec.text->encoding_is_wchar)? - sizeof(wchar_t) * cbrec.text->length: /* wchar */ - strlen(cbrec.text->string.mbs); /* mb */ - buf_len = XIM_HEADER_SIZE + - sz_CARD16 + - 2 + length_in_bytes + - XIM_PAD(2 + length_in_bytes) + - 2 + 2 + sz_CARD32 * cbrec.text->length; - buf = Xmalloc(buf_len); - } - _XimSetHeader((XPointer)buf, XIM_STR_CONVERSION_REPLY, 0, &buf_len); - buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */ - p = XIM_HEADER_SIZE; - *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; - *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; - *(CARD16*)&buf[p] = (CARD16)cbrec.text->length; p += sz_CARD16; - memcpy(&buf[p],&cbrec.text->string.mbs,length_in_bytes); - p += length_in_bytes; - *(CARD16*)&buf[p] = (CARD16)(sz_CARD32*cbrec.text->length); - p += XIM_PAD(2); - for (i = 0; i < (int)cbrec.text->length; i++) { - *(CARD32*)&buf[p] = (CARD32)cbrec.text->feedback[i]; - p += sz_CARD32; - } - - if (!(_XimWriteData(im, buf_len, buf))) { - return XimCbError; - } - _XimFlushData(im); - - Xfree(buf); - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimPreeditStartCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.preedit_attr.start_callback; - int ret; - - /* invoke the callback - */ - if (cb && cb->callback){ - ret = (*(cb->callback))((XIC)ic, cb->client_data, (XPointer)NULL); - } - else { - - /* no callback registered - */ - _XimError(im, ic, - (CARD16)XIM_BadSomething, - (INT16)len, - (CARD16)XIM_PREEDIT_START, - (char*)proto); /* send XIM_ERROR */ - return XimCbNoCallback; - } - - /* send a reply - */ - { - CARD32 buf32[(sz_ximPacketHeader + sz_ximPreeditStartReply) / 4]; - CARD8 *buf = (CARD8 *)buf32; - INT16 buf_len = sz_XIMID + sz_XICID + sz_ximPreeditStartReply; - int p; - - _XimSetHeader((XPointer)buf, XIM_PREEDIT_START_REPLY, 0, &buf_len); - p = XIM_HEADER_SIZE; - *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; - *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; - *(INT32*)&buf[p] = (INT32)ret; - - if (!(_XimWriteData(im, buf_len, buf))) { - return XimCbError; - } - _XimFlushData(im); - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimPreeditDoneCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.preedit_attr.done_callback; - - /* invoke the callback - */ - if (cb && cb->callback) { - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); - } - else { - - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - -static void -_read_text_from_packet(Xim im, - char* buf, - XIMText** text_ptr) -{ - int status; - XIMText* text; - int tmp_len; - char* tmp_buf; - Status s = 0; - - status = (int)*(BITMASK32*)buf; buf += sz_BITMASK32; - - /* string part - */ - if (status & 0x00000001) /* "no string" bit on */ { - buf += sz_CARD16; /* skip "length of preedit string" */ - buf += 2; /* pad */ - *text_ptr = (XIMText*)NULL; - return; - } - - *text_ptr = text = Xmalloc(sizeof(XIMText)); - if (text == (XIMText*)NULL) return; - - tmp_len = (int)*(CARD16*)buf; - buf += sz_CARD16; - if ((tmp_buf = Xmalloc(tmp_len + 1))) { - memcpy(tmp_buf, buf, tmp_len); - tmp_buf[tmp_len] = '\0'; - - text->encoding_is_wchar = False; - text->length = im->methods->ctstombs((XIM)im, - tmp_buf, tmp_len, - NULL, 0, &s); /* CT? HM */ - if (s != XLookupNone) { -#ifndef NO_DEC_I18N_FIX - /* Allow for NULL-terminated */ - if ((text->string.multi_byte = Xmalloc(text->length * - XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1))) { -#else - if (text->string.multi_byte = Xmalloc(text->length+1)) { -#endif - int tmp; -#ifndef NO_DEC_I18N_FIX - char *char_tmp; - int char_len; -#endif - tmp = im->methods->ctstombs((XIM)im, - tmp_buf, tmp_len, -#ifndef NO_DEC_I18N_FIX - text->string.multi_byte, - text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1, -#else - text->string.multi_byte, text->length, -#endif - &s); - text->string.multi_byte[tmp] = '\0'; -#ifndef NO_DEC_I18N_FIX - text->length = 0; - char_tmp = text->string.multi_byte; - while (*char_tmp != '\0') { - char_len = mblen(char_tmp, strlen(char_tmp)); - char_tmp = char_tmp + char_len; - (text->length)++; - } -#endif - } - } - else { - text->length = 0; - text->string.multi_byte = NULL; - } - - Xfree(tmp_buf); - } - buf += tmp_len; - - buf += XIM_PAD(sz_CARD16 + tmp_len); /* pad */ - - /* feedback part - */ - if (status & 0x00000002) /* "no feedback" bit on */ { - text->feedback = (XIMFeedback*)NULL; - } - else { - int i, j; - - i = (int)*(CARD16*)buf; buf += sz_CARD16; - buf += sz_CARD16; /* skip `unused' */ - text->feedback = Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32))); - j = 0; - while (i > 0) { - text->feedback[j] = (XIMFeedback)*(CARD32*)buf; - buf += sz_CARD32; - i -= sz_CARD32; - j++; - } - /* - * text->length tells how long both the status string and - * the feedback array are. If there's "no string" the - * text->length was set to zero previously. See above. - * But if there is feedback (i.e. not "no feedback") then - * we need to convey the length of the feedback array. - * It might have been better if the protocol sent two - * different values, one for the length of the status - * string and one for the length of the feedback array. - */ - if (status & 0x00000001) /* "no string" bit on */ { - text->length = j; - } - } -} - -static void -_free_memory_for_text(XIMText* text) -{ - if (text) { - Xfree(text->string.multi_byte); - Xfree(text->feedback); - Xfree(text); - } -} - -static XimCbStatus -_XimPreeditDrawCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.preedit_attr.draw_callback; - XIMPreeditDrawCallbackStruct cbs; - - /* invoke the callback - */ - if (cb && cb->callback) { - cbs.caret = (int)*(INT32*)proto; proto += sz_INT32; - cbs.chg_first = (int)*(INT32*)proto; proto += sz_INT32; - cbs.chg_length = (int)*(INT32*)proto; proto += sz_INT32; - _read_text_from_packet(im, proto, &cbs.text); - - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); - - _free_memory_for_text((XIMText*)cbs.text); - } - else { - - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimPreeditCaretCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.preedit_attr.caret_callback; - XIMPreeditCaretCallbackStruct cbs; - - /* invoke the callback - */ - if (cb && cb->callback) { - cbs.position = (int)*(INT32*)proto; proto += sz_INT32; - cbs.direction = (XIMCaretDirection)*(CARD32*)proto; proto += sz_CARD32; - cbs.style = (XIMCaretStyle)*(CARD32*)proto; proto += sz_CARD32; - - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); - } - else { - - /* no callback registered - */ - _XimError(im, ic, - (CARD16)XIM_BadSomething, - (INT16)len, - (CARD16)XIM_PREEDIT_CARET, - (char*)proto); /* send XIM_ERROR */ - return XimCbNoCallback; - } - - /* Send a reply - */ - { - CARD8 buf[sz_ximPacketHeader + sz_ximPreeditCaretReply]; - INT16 len = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply; - int p; - - _XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &len); - p = XIM_HEADER_SIZE; - *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; - *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; - *(CARD32*)&buf[p] = (CARD32)cbs.position; - - if (!(_XimWriteData(im, len, buf))) { - return XimCbError; - } - _XimFlushData(im); - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimStatusStartCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.status_attr.start_callback; - - /* invoke the callback - */ - if (cb && cb->callback) { - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); - } - else { - - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimStatusDoneCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.status_attr.done_callback; - - /* invoke the callback - */ - if (cb && cb->callback) { - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); - } - else { - - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimStatusDrawCallback(Xim im, - Xic ic, - char* proto, - int len) -{ - XICCallback* cb = &ic->core.status_attr.draw_callback; - XIMStatusDrawCallbackStruct cbs; - - /* invoke the callback - */ - if (cb && cb->callback) { - cbs.type = (XIMStatusDataType)*(CARD32*)proto; proto += sz_CARD32; - if (cbs.type == XIMTextType) { - _read_text_from_packet(im, proto, &cbs.data.text); - } - else if (cbs.type == XIMBitmapType) { - cbs.data.bitmap = (Pixmap)*(CARD32*)proto; - } - - (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); - - if (cbs.type == XIMTextType) - _free_memory_for_text((XIMText *)cbs.data.text); - } - else { - - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - -static XimCbStatus -_XimPreeditStateNotifyCallback( Xim im, Xic ic, char* proto, int len ) -{ - XICCallback *cb = &ic->core.preedit_attr.state_notify_callback; - - /* invoke the callack - */ - if( cb && cb->callback ) { - XIMPreeditStateNotifyCallbackStruct cbrec; - - cbrec.state = *(BITMASK32 *)proto; - (*cb->callback)( (XIC)ic, cb->client_data, (XPointer)&cbrec ); - } - else { - /* no callback registered - */ - return XimCbNoCallback; - } - - return XimCbSuccess; -} - diff --git a/nx-X11/lib/X11/imConv.c b/nx-X11/lib/X11/imConv.c deleted file mode 100644 index c3c1974de..000000000 --- a/nx-X11/lib/X11/imConv.c +++ /dev/null @@ -1,356 +0,0 @@ -/****************************************************************** - - Copyright 1991, 1992 by Fuji Xerox Co.,Ltd. - Copyright 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 Fuji Xerox Co.,Ltd. -, 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. -Fuji Xerox Co.,Ltd. , and FUJITSU LIMITED makes no representations about -the suitability of this software for any purpose. -It is provided "as is" without express or implied warranty. - -FUJI XEROX CO.,LTD. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX CO.,LTD. -AND FUJITSU LIMITED 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. - - Auther: Kazunori Nishihara, Fuji Xerox Co.,Ltd. - kaz@ssdev.ksp.fujixerox.co.jp - Modifier: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ -/* 2000 Modifier: Ivan Pascal The XFree86 Project. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "XlcPubI.h" - -#ifdef XKB -/* - * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) - * do this because with XKB the event may have some funky modifiers that - * _XLookupString doesn't grok. - */ -#include "XKBlib.h" -#define XLOOKUPSTRING lookup_string -#else -#define XLOOKUPSTRING XLookupString -#endif - -typedef unsigned int ucs4_t; - -typedef int (*ucstocsConvProc)( - XPointer, - unsigned char *, - ucs4_t, - int -); - -struct SubstRec { - const char encoding_name[8]; - const char charset_name[12]; -}; - -static const struct SubstRec SubstTable[] = { - {"STRING", "ISO8859-1"}, - {"TIS620", "TIS620-0"}, - {"UTF-8", "ISO10646-1"} -}; -#define num_substitute (sizeof SubstTable / sizeof SubstTable[0]) - -/* - * Given the name of a charset, returns the pointer to convertors - * from UCS char to specified charset char. - * This converter is needed for _XimGetCharCode subroutine. - */ -XPointer -_XimGetLocaleCode ( - _Xconst char* encoding_name) -{ - XPointer cvt = _Utf8GetConvByName(encoding_name); - if (!cvt && encoding_name) { - int i; - for (i = 0; i < num_substitute; i++) - if (!strcmp(encoding_name, SubstTable[i].encoding_name)) - return _Utf8GetConvByName(SubstTable[i].charset_name); - } - return cvt; -} - -/* - * Returns the locale dependent representation of a keysym. - * The locale's encoding is passed in form of pointer to UCS convertor. - * The resulting multi-byte sequence is placed starting at buf (a buffer - * with nbytes bytes, nbytes should be >= 8) and is NUL terminated. - * Returns the length of the resulting multi-byte sequence, excluding the - * terminating NUL byte. Return 0 if the keysym is not representable in the - * locale - */ -/*ARGSUSED*/ -int -_XimGetCharCode ( - XPointer ucs_conv, - KeySym keysym, - unsigned char* buf, - int nbytes) -{ - int count = 0; - ucstocsConvProc cvt = (ucstocsConvProc) ucs_conv; - ucs4_t ucs4; - - if (keysym < 0x80) { - buf[0] = (char) keysym; - count = 1; - } else if (cvt) { - ucs4 = KeySymToUcs4(keysym); - if (ucs4) - count = (*cvt)((XPointer)NULL, buf, ucs4, nbytes); - } - - if (count < 0) - count = 0; - if (count>nbytes) - return nbytes; - if (countdisplay); - XkbSetXlibControls (event->display, - XkbLC_ForceLatin1Lookup, XkbLC_ForceLatin1Lookup); - ret = XLookupString(event, (char *)buffer, nbytes, keysym, status); - XkbSetXlibControls (event->display, - XkbLC_ForceLatin1Lookup, ctrls); - return ret; -} -#endif - -#define BUF_SIZE (20) - -int -_XimLookupMBText( - Xic ic, - XKeyEvent* event, - char* buffer, - int nbytes, - KeySym* keysym, - XComposeStatus* status) -{ - int count; - KeySym symbol; - Status dummy; - Xim im = (Xim)ic->core.im; - XimCommonPrivateRec* private = &im->private.common; - unsigned char look[BUF_SIZE]; - ucs4_t ucs4; - - /* force a latin-1 lookup for compatibility */ - count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status); - if (keysym != NULL) *keysym = symbol; - if ((nbytes == 0) || (symbol == NoSymbol)) return count; - - if (count > 1) { - memcpy(look, (char *)buffer,count); - look[count] = '\0'; - if ((count = im->methods->ctstombs(ic->core.im, - (char*) look, count, - buffer, nbytes, &dummy)) < 0) { - count = 0; - } - } else if ((count == 0) || - (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { - - XPointer from = (XPointer) &ucs4; - XPointer to = (XPointer) look; - int from_len = 1; - int to_len = BUF_SIZE; - XPointer args[1]; - XlcCharSet charset; - args[0] = (XPointer) &charset; - ucs4 = (ucs4_t) KeySymToUcs4(symbol); - if (!ucs4) - return 0; - - if (_XlcConvert(private->ucstoc_conv, - &from, &from_len, &to, &to_len, - args, 1 ) != 0) { - count = 0; - } else { - from = (XPointer) look; - to = (XPointer) buffer; - from_len = BUF_SIZE - to_len; - to_len = nbytes; - args[0] = (XPointer) charset; - if (_XlcConvert(private->cstomb_conv, - &from, &from_len, &to, &to_len, - args, 1 ) != 0) { - count = 0; - } else { - count = nbytes - to_len; - } - } - } - /* FIXME: - * we should make sure that if the character is a Latin1 character - * and it's on the right side, and we're in a non-Latin1 locale - * that this is a valid Latin1 character for this locale. - */ - return count; -} - -int -_XimLookupWCText( - Xic ic, - XKeyEvent* event, - wchar_t* buffer, - int nbytes, - KeySym* keysym, - XComposeStatus* status) -{ - int count; - KeySym symbol; - Status dummy; - Xim im = (Xim)ic->core.im; - XimCommonPrivateRec* private = &im->private.common; - unsigned char look[BUF_SIZE]; - ucs4_t ucs4; - - /* force a latin-1 lookup for compatibility */ - count = XLOOKUPSTRING(event, (char *)look, nbytes, &symbol, status); - if (keysym != NULL) *keysym = symbol; - if ((nbytes == 0) || (symbol == NoSymbol)) return count; - - if (count > 1) { - if ((count = im->methods->ctstowcs(ic->core.im, - (char*) look, count, - buffer, nbytes, &dummy)) < 0) { - count = 0; - } - } else if ((count == 0) || - (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { - - XPointer from = (XPointer) &ucs4; - XPointer to = (XPointer) look; - int from_len = 1; - int to_len = BUF_SIZE; - XPointer args[1]; - XlcCharSet charset; - args[0] = (XPointer) &charset; - ucs4 = (ucs4_t) KeySymToUcs4(symbol); - if (!ucs4) - return 0; - - if (_XlcConvert(private->ucstoc_conv, - &from, &from_len, &to, &to_len, - args, 1 ) != 0) { - count = 0; - } else { - from = (XPointer) look; - to = (XPointer) buffer; - from_len = BUF_SIZE - to_len; - to_len = nbytes; - args[0] = (XPointer) charset; - - if (_XlcConvert(private->cstowc_conv, - &from, &from_len, &to, &to_len, - args, 1 ) != 0) { - count = 0; - } else { - count = nbytes - to_len; - } - } - } else - /* FIXME: - * we should make sure that if the character is a Latin1 character - * and it's on the right side, and we're in a non-Latin1 locale - * that this is a valid Latin1 character for this locale. - */ - buffer[0] = look[0]; - - return count; -} - -int -_XimLookupUTF8Text( - Xic ic, - XKeyEvent* event, - char* buffer, - int nbytes, - KeySym* keysym, - XComposeStatus* status) -{ - int count; - KeySym symbol; - Status dummy; - Xim im = (Xim)ic->core.im; - XimCommonPrivateRec* private = &im->private.common; - unsigned char look[BUF_SIZE]; - ucs4_t ucs4; - - /* force a latin-1 lookup for compatibility */ - count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status); - if (keysym != NULL) *keysym = symbol; - if ((nbytes == 0) || (symbol == NoSymbol)) return count; - - if (count > 1) { - memcpy(look, (char *)buffer,count); - look[count] = '\0'; - if ((count = im->methods->ctstoutf8(ic->core.im, - (char*) look, count, - buffer, nbytes, &dummy)) < 0) { - count = 0; - } - } else if ((count == 0) || - (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { - - XPointer from = (XPointer) &ucs4; - int from_len = 1; - XPointer to = (XPointer) buffer; - int to_len = nbytes; - - ucs4 = (ucs4_t) KeySymToUcs4(symbol); - if (!ucs4) - return 0; - - if (_XlcConvert(private->ucstoutf8_conv, - &from, &from_len, &to, &to_len, - NULL, 0) != 0) { - count = 0; - } else { - count = nbytes - to_len; - } - } - /* FIXME: - * we should make sure that if the character is a Latin1 character - * and it's on the right side, and we're in a non-Latin1 locale - * that this is a valid Latin1 character for this locale. - */ - return count; -} diff --git a/nx-X11/lib/X11/imDefFlt.c b/nx-X11/lib/X11/imDefFlt.c deleted file mode 100644 index b6473e176..000000000 --- a/nx-X11/lib/X11/imDefFlt.c +++ /dev/null @@ -1,413 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xutil.h" -#include "Xlcint.h" -#include "Ximint.h" - -static long -_XimTriggerCheck( - Xim im, - XKeyEvent *ev, - INT32 len, - CARD32 *keylist) -{ - register long i; - KeySym keysym; - CARD32 buf32[BUFSIZE/4]; - char *buf = (char *)buf32; - int modifier; - int modifier_mask; - CARD32 min_len = sizeof(CARD32) /* sizeof keysym */ - + sizeof(CARD32) /* sizeof modifier */ - + sizeof(CARD32); /* sizeof modifier mask */ - - XLookupString(ev, buf, BUFSIZE, &keysym, NULL); - if (!keysym) - return -1; - - for (i = 0; len >= min_len; i += 3, len -= min_len) { - modifier = keylist[i + 1]; - modifier_mask = keylist[i + 2]; - if (((KeySym)keylist[i] == keysym) - && ((ev->state & modifier_mask) == modifier)) - return i; - } - return -1; -} - -static long -_XimTriggerOnCheck( - Xim im, - XKeyEvent *ev) -{ - return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_onkeylist[0], - &im->private.proto.im_onkeylist[1]); -} - -static long -_XimTriggerOffCheck( - Xim im, - XKeyEvent *ev) -{ - return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_offkeylist[0], - &im->private.proto.im_offkeylist[1]); -} - -static Bool -_XimOnKeysCheck( - Xic ic, - XKeyEvent *ev) -{ - Xim im = (Xim)ic->core.im; - long idx; - - if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && - im->private.proto.im_onkeylist && - im->private.proto.im_onkeylist[0]) { - if ((idx = _XimTriggerOnCheck(im, ev)) >= 0) { - (void)_XimTriggerNotify(im, ic, 0, (CARD32)idx); /* Trigger on */ - return True; - } - } - return False; -} - -static Bool -_XimOffKeysCheck( - Xic ic, - XKeyEvent *ev) -{ - Xim im = (Xim)ic->core.im; - long idx; - - if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && - im->private.proto.im_offkeylist && - im->private.proto.im_offkeylist[0]) { - if ((idx = _XimTriggerOffCheck(im, ev)) >= 0) { - _XimTriggerNotify(im, ic, 1, (CARD32)idx); /* Trigger off */ - return True; - } - } - return False; -} - -static void -_XimPendingFilter( - Xic ic) -{ - Xim im = (Xim)ic->core.im; - - if (IS_NEED_SYNC_REPLY(im)) { - (void)_XimProcSyncReply(im, ic); - UNMARK_NEED_SYNC_REPLY(im); - } - return; -} - -static Bool -_XimProtoKeypressFilter( - Xic ic, - XKeyEvent *ev) -{ - Xim im = (Xim)ic->core.im; - - if (IS_FABRICATED(im)) { - _XimPendingFilter(ic); - UNMARK_FABRICATED(im); - return NOTFILTERD; - } - - if (IS_NEGLECT_EVENT(ic, KeyPressMask)) - return FILTERD; - -#ifdef XIM_CONNECTABLE - if (!IS_IC_CONNECTED(ic)) { - if (IS_CONNECTABLE(im)) { - if (_XimConnectServer(im)) { - if (!_XimReCreateIC(ic)) { - _XimDelayModeSetAttr(im); - return NOTFILTERD; - } - } else { - return NOTFILTERD; - } - } else { - return NOTFILTERD; - } - } -#else - if (!IS_IC_CONNECTED(ic)) - return NOTFILTERD; -#endif /* XIM_CONNECTABLE */ - - if (!IS_FORWARD_EVENT(ic, KeyPressMask)) { - if (_XimOnKeysCheck(ic, ev)) - return FILTERD; - return NOTFILTERD; - } - if (_XimOffKeysCheck(ic, ev)) - return FILTERD; - - if (_XimForwardEvent(ic, (XEvent *)ev, - IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) - return FILTERD; - - return NOTFILTERD; -} - -static Bool -_XimFilterKeypress( - Display *d, - Window w, - XEvent *ev, - XPointer client_data) -{ - return _XimProtoKeypressFilter((Xic)client_data, (XKeyEvent *)ev ); -} - -static Bool -_XimProtoKeyreleaseFilter( - Xic ic, - XKeyEvent *ev) -{ - Xim im = (Xim)ic->core.im; - - if (IS_FABRICATED(im)) { - _XimPendingFilter(ic); - UNMARK_FABRICATED(im); - return NOTFILTERD; - } - - if (IS_NEGLECT_EVENT(ic, KeyReleaseMask)) - return FILTERD; - -#ifdef XIM_CONNECTABLE - if (!IS_IC_CONNECTED(ic)) { - if (IS_CONNECTABLE(im)) { - if (_XimConnectServer(im)) { - if (!_XimReCreateIC(ic)) { - _XimDelayModeSetAttr(im); - return NOTFILTERD; - } - } else { - return NOTFILTERD; - } - } else { - return NOTFILTERD; - } - } -#else - if (!IS_IC_CONNECTED(ic)) - return NOTFILTERD; -#endif /* XIM_CONNECTABLE */ - - if (!IS_FORWARD_EVENT(ic, KeyReleaseMask)) { - if (_XimOnKeysCheck(ic, ev)) - return FILTERD; - return NOTFILTERD; - } - if (_XimOffKeysCheck(ic, ev)) - return FILTERD; - - if (_XimForwardEvent(ic, (XEvent *)ev, - IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) - return FILTERD; - - return NOTFILTERD; -} - -static Bool -_XimFilterKeyrelease( - Display *d, - Window w, - XEvent *ev, - XPointer client_data) -{ - return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev); -} - -static void -_XimRegisterKeyPressFilter( - Xic ic) -{ - if (ic->core.focus_window) { - if (!(ic->private.proto.registed_filter_event & KEYPRESS_MASK)) { - _XRegisterFilterByType (ic->core.im->core.display, - ic->core.focus_window, - KeyPress, KeyPress, - _XimFilterKeypress, - (XPointer)ic); - ic->private.proto.registed_filter_event |= KEYPRESS_MASK; - } - } - return; -} - -static void -_XimRegisterKeyReleaseFilter( - Xic ic) -{ - if (ic->core.focus_window) { - if (!(ic->private.proto.registed_filter_event & KEYRELEASE_MASK)) { - _XRegisterFilterByType (ic->core.im->core.display, - ic->core.focus_window, - KeyRelease, KeyRelease, - _XimFilterKeyrelease, - (XPointer)ic); - ic->private.proto.registed_filter_event |= KEYRELEASE_MASK; - } - } - return; -} - -static void -_XimUnregisterKeyPressFilter( - Xic ic) -{ - if (ic->core.focus_window) { - if (ic->private.proto.registed_filter_event & KEYPRESS_MASK) { - _XUnregisterFilter (ic->core.im->core.display, - ic->core.focus_window, - _XimFilterKeypress, - (XPointer)ic); - ic->private.proto.registed_filter_event &= ~KEYPRESS_MASK; - } - } - return; -} - -static void -_XimUnregisterKeyReleaseFilter( - Xic ic) -{ - if (ic->core.focus_window) { - if (ic->private.proto.registed_filter_event & KEYRELEASE_MASK) { - _XUnregisterFilter (ic->core.im->core.display, - ic->core.focus_window, - _XimFilterKeyrelease, - (XPointer)ic); - ic->private.proto.registed_filter_event &= ~KEYRELEASE_MASK; - } - } - return; -} - -void -_XimRegisterFilter( - Xic ic) -{ - _XimRegisterKeyPressFilter(ic); - if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) - _XimRegisterKeyReleaseFilter(ic); - return; -} - -void -_XimUnregisterFilter( - Xic ic) -{ - _XimUnregisterKeyPressFilter(ic); - _XimUnregisterKeyReleaseFilter(ic); - return; -} - -void -_XimReregisterFilter( - Xic ic) -{ - if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) - _XimRegisterKeyReleaseFilter(ic); - else - _XimUnregisterKeyReleaseFilter(ic); - - return; -} - -static Bool -_XimFilterServerDestroy( - Display *d, - Window w, - XEvent *ev, - XPointer client_data) -{ - Xim im = (Xim)client_data; - - if (ev->type == DestroyNotify) { - UNMARK_SERVER_CONNECTED(im); -#ifdef XIM_CONNECTABLE - if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { - _XimServerReconectableDestroy(); - return True; - } -#endif /* XIM_CONNECTABLE */ - _XimServerDestroy(im); - } - return True; -} - -void -_XimRegisterServerFilter( - Xim im) -{ - if (im->private.proto.im_window) { - if (!(im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK)) { - _XRegisterFilterByMask(im->core.display, - im->private.proto.im_window, - StructureNotifyMask, - _XimFilterServerDestroy, - (XPointer)im); - XSelectInput(im->core.display, im->private.proto.im_window, - StructureNotifyMask); - im->private.proto.registed_filter_event |= DESTROYNOTIFY_MASK; - } - } - return; -} - -void -_XimUnregisterServerFilter( - Xim im) -{ - if (im->private.proto.im_window) { - if (im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK) { - _XUnregisterFilter(im->core.display, - im->private.proto.im_window, - _XimFilterServerDestroy, - (XPointer)im); - im->private.proto.registed_filter_event &= ~DESTROYNOTIFY_MASK; - } - } - return; -} - diff --git a/nx-X11/lib/X11/imDefIc.c b/nx-X11/lib/X11/imDefIc.c deleted file mode 100644 index 3cf46827a..000000000 --- a/nx-X11/lib/X11/imDefIc.c +++ /dev/null @@ -1,1576 +0,0 @@ -/* - * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -static Bool -_XimCreateICCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - - if ((major_opcode == XIM_CREATE_IC_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid)) - return True; - return False; -} - -#ifdef XIM_CONNECTABLE -Bool -_XimReCreateIC(ic) - Xic ic; -{ - Xim im = (Xim)ic->core.im; - Xic save_ic; - XIMResourceList res; - unsigned int num; - XIMStyle input_style = ic->core.input_style; - XimDefICValues ic_values; - INT16 len; - CARD16 *buf_s; - char *tmp; - CARD32 tmp_buf32[BUFSIZE/4]; - char *tmp_buf = (char *)tmp_buf32; - char *buf; - int buf_size; - char *data; - int data_len; - int ret_len; - int total; - int idx; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int ret_code; - - if (!(save_ic = Xmalloc(sizeof(XicRec)))) - return False; - memcpy((char *)save_ic, (char *)ic, sizeof(XicRec)); - - ic->core.filter_events = im->private.proto.forward_event_mask; - ic->private.proto.forward_event_mask = - im->private.proto.forward_event_mask; - ic->private.proto.synchronous_event_mask = - im->private.proto.synchronous_event_mask; - - num = im->core.ic_num_resources; - buf_size = sizeof(XIMResource) * num; - if (!(res = Xmalloc(buf_size))) - goto ErrorOnReCreateIC; - (void)memcpy((char *)res, (char *)im->core.ic_resources, buf_size); - ic->private.proto.ic_resources = res; - ic->private.proto.ic_num_resources = num; - - num = im->private.proto.ic_num_inner_resources; - buf_size = sizeof(XIMResource) * num; - if (!(res = Xmalloc(buf_size))) - goto ErrorOnReCreateIC; - (void)memcpy((char *)res, - (char *)im->private.proto.ic_inner_resources, buf_size); - ic->private.proto.ic_inner_resources = res; - ic->private.proto.ic_num_inner_resources = num; - - _XimSetICMode(ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, input_style); - - _XimSetICMode(ic->private.proto.ic_inner_resources, - ic->private.proto.ic_num_inner_resources, input_style); - - _XimGetCurrentICValues(ic, &ic_values); - buf = tmp_buf; - buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); - data_len = BUFSIZE - buf_size; - total = 0; - idx = 0; - for (;;) { - data = &buf[buf_size]; - if (!_XimEncodeSavedICATTRIBUTE(ic, ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, &idx, data, data_len, - &ret_len, (XPointer)&ic_values, XIM_CREATEIC)) { - if (buf != tmp_buf) - Xfree(buf); - goto ErrorOnReCreateIC; - } - - total += ret_len; - if (idx == -1) { - break; - } - - buf_size += ret_len; - if (buf == tmp_buf) { - if (!(tmp = Xmalloc(buf_size + data_len))) { - goto ErrorOnReCreateIC; - } - memcpy(tmp, buf, buf_size); - buf = tmp; - } else { - if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { - Xfree(buf); - goto ErrorOnReCreateIC; - } - buf = tmp; - } - } - - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - buf_s[0] = im->private.proto.imid; - buf_s[1] = (INT16)total; - - len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); - _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - if (buf != tmp_buf) - Xfree(buf); - goto ErrorOnReCreateIC; - } - _XimFlush(im); - if (buf != tmp_buf) - Xfree(buf); - ic->private.proto.waitCallback = True; - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimCreateICCheck, 0); - if (ret_code == XIM_TRUE) { - preply = reply; - } else if (ret_code == XIM_OVERFLOW) { - if (len <= 0) { - preply = reply; - } else { - buf_size = (int)len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimCreateICCheck, 0); - if (ret_code != XIM_TRUE) { - Xfree(preply); - ic->private.proto.waitCallback = False; - goto ErrorOnReCreateIC; - } - } - } else { - ic->private.proto.waitCallback = False; - goto ErrorOnReCreateIC; - } - ic->private.proto.waitCallback = False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if (reply != preply) - Xfree(preply); - goto ErrorOnReCreateIC; - } - - ic->private.proto.icid = buf_s[1]; /* icid */ - if (reply != preply) - Xfree(preply); - - _XimRegisterFilter(ic); - MARK_IC_CONNECTED(ic); - if (save_ic->private.proto.ic_resources) - Xfree(save_ic->private.proto.ic_resources); - if (save_ic->private.proto.ic_inner_resources) - Xfree(save_ic->private.proto.ic_inner_resources); - Xfree(save_ic); - return True; - -ErrorOnReCreateIC: - memcpy((char *)ic, (char *)save_ic, sizeof(XicRec)); - Xfree(save_ic); - return False; -} - -static char * -_XimDelayModeGetICValues(ic, arg) - Xic ic; - XIMArg *arg; -{ - XimDefICValues ic_values; - - _XimGetCurrentICValues(ic, &ic_values); - return _XimGetICValueData(ic, (XPointer)&ic_values, - ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, - arg, XIM_GETICVALUES); -} -#endif /* XIM_CONNECTABLE */ - -static Bool -_XimGetICValuesCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - - if ((major_opcode == XIM_GET_IC_VALUES_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - return True; - return False; -} - -static char * -_XimProtoGetICValues( - XIC xic, - XIMArg *arg) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - register XIMArg *p; - register XIMArg *pp; - register int n; - CARD8 *buf; - CARD16 *buf_s; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply = NULL; - int buf_size; - int ret_code; - char *makeid_name; - char *decode_name; - CARD16 *data = NULL; - INT16 data_len = 0; - -#ifndef XIM_CONNECTABLE - if (!IS_IC_CONNECTED(ic)) - return arg->name; -#else - if (!IS_IC_CONNECTED(ic)) { - if (IS_CONNECTABLE(im)) { - if (_XimConnectServer(im)) { - if (!_XimReCreateIC(ic)) { - _XimDelayModeSetAttr(im); - return _XimDelayModeGetICValues(ic, arg); - } - } else { - return _XimDelayModeGetICValues(ic, arg); - } - } else { - return arg->name; - } - } -#endif /* XIM_CONNECTABLE */ - - for (n = 0, p = arg; p && p->name; p++) { - n++; - if ((strcmp(p->name, XNPreeditAttributes) == 0) - || (strcmp(p->name, XNStatusAttributes) == 0)) { - n++; - for (pp = (XIMArg *)p->value; pp && pp->name; pp++) - n++; - } - } - - if (!n) - return (char *)NULL; - - buf_size = sizeof(CARD16) * n; - buf_size += XIM_HEADER_SIZE - + sizeof(CARD16) - + sizeof(CARD16) - + sizeof(INT16) - + XIM_PAD(2 + buf_size); - - if (!(buf = Xmalloc(buf_size))) - return arg->name; - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - - makeid_name = _XimMakeICAttrIDList(ic, ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, arg, - &buf_s[3], &len, XIM_GETICVALUES); - - if (len > 0) { - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - buf_s[2] = len; /* length of ic-attr-id */ - len += sizeof(INT16); /* sizeof length of attr */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_GET_IC_VALUES, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - Xfree(buf); - return arg->name; - } - _XimFlush(im); - Xfree(buf); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimGetICValuesCheck, (XPointer)ic); - if (ret_code == XIM_TRUE) { - preply = reply; - } else if (ret_code == XIM_OVERFLOW) { - if (len <= 0) { - preply = reply; - } else { - buf_size = (int)len; - preply = Xmalloc(len); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimGetICValuesCheck, (XPointer)ic); - if (ret_code != XIM_TRUE) { - if (preply != reply) - Xfree(preply); - return arg->name; - } - } - } else { - return arg->name; - } - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if (reply != preply) - Xfree(preply); - return arg->name; - } - data = &buf_s[4]; - data_len = buf_s[2]; - } - else if (len < 0) { - return arg->name; - } - - decode_name = _XimDecodeICATTRIBUTE(ic, ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, data, data_len, - arg, XIM_GETICVALUES); - if (reply != preply) - Xfree(preply); - - if (decode_name) - return decode_name; - else - return makeid_name; -} - -#ifdef XIM_CONNECTABLE -static Bool -_XimCheckNestQuarkList(quark_list, num_quark, quark, separator) - XrmQuark *quark_list; - int num_quark; - XrmQuark quark; - XrmQuark separator; -{ - register int i; - - for (i = 0; i < num_quark; i++) { - if (quark_list[i] == separator) { - break; - } - if (quark_list[i] == quark) { - return True; - } - } - return False; -} - -static Bool -_XimCheckNestedQuarkList(quark_list, idx, num_quark, arg, separator) - XrmQuark **quark_list; - int idx; - int *num_quark; - XIMArg *arg; - XrmQuark separator; -{ - XrmQuark *q_list = *quark_list; - int n_quark = *num_quark; - register XIMArg *p; - XrmQuark quark; - XrmQuark *tmp; - register int i; - - for (p = arg; p && p->name; p++) { - quark = XrmStringToQuark(p->name); - if (_XimCheckNestQuarkList(&q_list[idx], n_quark - idx, - quark, separator)) { - continue; - } - if (!(tmp = Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) { - *quark_list = q_list; - *num_quark = n_quark; - return False; - } - n_quark++; - for (i = 0; i < idx; i++) { - tmp[i] = q_list[i]; - } - tmp[i] = quark; - for (i = idx + 1; i < n_quark; i++) { - tmp[i] = q_list[i - 1]; - } - q_list = tmp; - } - *quark_list = q_list; - *num_quark = n_quark; - return True; -} - -static Bool -_XimCheckICQuarkList(quark_list, num_quark, quark, idx) - XrmQuark *quark_list; - int num_quark; - XrmQuark quark; - int *idx; -{ - register int i; - - for (i = 0; i < num_quark; i++) { - if (quark_list[i] == quark) { - *idx = i; - return True; - } - } - return False; -} - -static Bool -_XimSaveICValues(ic, arg) - Xic ic; - XIMArg *arg; -{ - register XIMArg *p; - register int n; - XrmQuark *quark_list; - XrmQuark *tmp; - XrmQuark quark; - int num_quark; - XrmQuark pre_quark; - XrmQuark sts_quark; - XrmQuark separator; - int idx; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - separator = XrmStringToQuark(XNSeparatorofNestedList); - - if (quark_list = ic->private.proto.saved_icvalues) { - num_quark = ic->private.proto.num_saved_icvalues; - for (p = arg; p && p->name; p++) { - quark = XrmStringToQuark(p->name); - if ((quark == pre_quark) || (quark == sts_quark)) { - if (!_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { - register XIMArg *pp; - int nn; - XrmQuark *q_list; - - for (pp = (XIMArg *)p->value, nn = 0; - pp && pp->name; pp++, nn++); - if (!(tmp = Xrealloc(quark_list, - (sizeof(XrmQuark) * (num_quark + nn + 2))))) { - ic->private.proto.saved_icvalues = quark_list; - ic->private.proto.num_saved_icvalues = num_quark; - return False; - } - quark_list = tmp; - q_list = &quark_list[num_quark]; - num_quark += nn + 2; - *q_list++ = quark; - for (pp = (XIMArg *)p->value; - pp && pp->name; pp++, quark_list++) { - *q_list = XrmStringToQuark(pp->name); - } - *q_list = separator; - } else { - if (!_XimCheckNestedQuarkList(&quark_list, idx + 1, - &num_quark, (XIMArg *)p->value, separator)) { - ic->private.proto.saved_icvalues = quark_list; - ic->private.proto.num_saved_icvalues = num_quark; - return False; - } - } - } else { - if (_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { - continue; - } - if (!(tmp = Xrealloc(quark_list, - (sizeof(XrmQuark) * (num_quark + 1))))) { - ic->private.proto.saved_icvalues = quark_list; - ic->private.proto.num_saved_icvalues = num_quark; - return False; - } - quark_list = tmp; - quark_list[num_quark] = quark; - num_quark++; - } - } - ic->private.proto.saved_icvalues = quark_list; - ic->private.proto.num_saved_icvalues = num_quark; - return True; - } - - for (p = arg, n = 0; p && p->name; p++, n++) { - if ((!strcmp(p->name, XNPreeditAttributes)) - || (!strcmp(p->name, XNStatusAttributes))) { - register XIMArg *pp; - int nn; - - for (pp = (XIMArg *)p->value, nn = 0; pp && pp->name; pp++, nn++); - n += nn + 1; - } - } - - if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { - return False; - } - - ic->private.proto.saved_icvalues = quark_list; - ic->private.proto.num_saved_icvalues = n; - for (p = arg; p && p->name; p++, quark_list++) { - *quark_list = XrmStringToQuark(p->name); - if ((*quark_list == pre_quark) || (*quark_list == sts_quark)) { - register XIMArg *pp; - - quark_list++; - for (pp = (XIMArg *)p->value; pp && pp->name; pp++, quark_list++) { - *quark_list = XrmStringToQuark(pp->name); - } - *quark_list = separator; - } - } - return True; -} - -static char * -_XimDelayModeSetICValues(ic, arg) - Xic ic; - XIMArg *arg; -{ - XimDefICValues ic_values; - char *name; - - _XimGetCurrentICValues(ic, &ic_values); - name = _XimSetICValueData(ic, (XPointer)&ic_values, - ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, - arg, XIM_SETICVALUES, False); - _XimSetCurrentICValues(ic, &ic_values); - return name; -} -#endif /* XIM_CONNECTABLE */ - -static Bool -_XimSetICValuesCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - - if ((major_opcode == XIM_SET_IC_VALUES_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - return True; - return False; -} - -static char * -_XimProtoSetICValues( - XIC xic, - XIMArg *arg) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - XimDefICValues ic_values; - INT16 len; - CARD16 *buf_s; - char *tmp; - CARD32 tmp_buf32[BUFSIZE/4]; - char *tmp_buf = (char *)tmp_buf32; - char *buf; - int buf_size; - char *data; - int data_len; - int ret_len; - int total; - XIMArg *arg_ret; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply = NULL; - int ret_code; - BITMASK32 flag = 0L; - char *name; - char *tmp_name = (arg) ? arg->name : NULL; - -#ifndef XIM_CONNECTABLE - if (!IS_IC_CONNECTED(ic)) - return tmp_name; -#else - if (!_XimSaveICValues(ic, arg)) - return NULL; - - if (!IS_IC_CONNECTED(ic)) { - if (IS_CONNECTABLE(im)) { - if (_XimConnectServer(im)) { - if (!_XimReCreateIC(ic)) { - _XimDelayModeSetAttr(im); - return _XimDelayModeSetICValues(ic, arg); - } - } else { - return _XimDelayModeSetICValues(ic, arg); - } - } else { - return tmp_name; - } - } -#endif /* XIM_CONNECTABLE */ - - _XimGetCurrentICValues(ic, &ic_values); - buf = tmp_buf; - buf_size = XIM_HEADER_SIZE - + sizeof(CARD16) + sizeof(CARD16) + sizeof(INT16) + sizeof(CARD16); - data_len = BUFSIZE - buf_size; - total = 0; - arg_ret = arg; - for (;;) { - data = &buf[buf_size]; - if ((name = _XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, arg, &arg_ret, - data, data_len, &ret_len, (XPointer)&ic_values, - &flag, XIM_SETICVALUES))) { - break; - } - - total += ret_len; - if (!(arg = arg_ret)) { - break; - } - - buf_size += ret_len; - if (buf == tmp_buf) { - if (!(tmp = Xmalloc(buf_size + data_len))) { - return tmp_name; - } - memcpy(tmp, buf, buf_size); - buf = tmp; - } else { - if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { - Xfree(buf); - return tmp_name; - } - buf = tmp; - } - } - _XimSetCurrentICValues(ic, &ic_values); - - if (!total) { - return tmp_name; - } - - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - -#ifdef EXT_MOVE - if (_XimExtenMove(im, ic, flag, &buf_s[4], (INT16)total)) - return name; -#endif - - buf_s[0] = im->private.proto.imid; - buf_s[1] = ic->private.proto.icid; - buf_s[2] = (INT16)total; - buf_s[3] = 0; - len = (INT16)(sizeof(CARD16) + sizeof(CARD16) - + sizeof(INT16) + sizeof(CARD16) + total); - - _XimSetHeader((XPointer)buf, XIM_SET_IC_VALUES, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - if (buf != tmp_buf) - Xfree(buf); - return tmp_name; - } - _XimFlush(im); - if (buf != tmp_buf) - Xfree(buf); - ic->private.proto.waitCallback = True; - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimSetICValuesCheck, (XPointer)ic); - if (ret_code == XIM_TRUE) { - preply = reply; - } else if (ret_code == XIM_OVERFLOW) { - buf_size = (int)len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimSetICValuesCheck, (XPointer)ic); - if (ret_code != XIM_TRUE) { - Xfree(preply); - ic->private.proto.waitCallback = False; - return tmp_name; - } - } else { - ic->private.proto.waitCallback = False; - return tmp_name; - } - ic->private.proto.waitCallback = False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if (reply != preply) - Xfree(preply); - return tmp_name; - } - if (reply != preply) - Xfree(preply); - - return name; -} - -static Bool -_XimDestroyICCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Bool ret = False; - - if ((major_opcode == XIM_DESTROY_IC_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - ret = True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - ret = False; - return ret; -} - -static void -_XimProtoICFree( - Xic ic) -{ -#ifdef XIM_CONNECTABLE - Xim im = (Xim)ic->core.im; -#endif - - if (ic->private.proto.preedit_font) { - Xfree(ic->private.proto.preedit_font); - ic->private.proto.preedit_font = NULL; - } - if (ic->private.proto.status_font) { - Xfree(ic->private.proto.status_font); - ic->private.proto.status_font = NULL; - } - if (ic->private.proto.commit_info) { - _XimFreeCommitInfo(ic); - ic->private.proto.commit_info = NULL; - } - if (ic->private.proto.ic_inner_resources) { - Xfree(ic->private.proto.ic_inner_resources); - ic->private.proto.ic_inner_resources = NULL; - } - -#ifdef XIM_CONNECTABLE - if (IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { - return; - } -#endif /* XIM_CONNECTABLE */ - - if (ic->private.proto.saved_icvalues) { - Xfree(ic->private.proto.saved_icvalues); - ic->private.proto.saved_icvalues = NULL; - } - if (ic->private.proto.ic_resources) { - Xfree(ic->private.proto.ic_resources); - ic->private.proto.ic_resources = NULL; - } - if (ic->core.hotkey) { - Xfree(ic->core.hotkey); - ic->core.hotkey = NULL; - } - - return; -} - -static void -_XimProtoDestroyIC( - XIC xic) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - - if (IS_SERVER_CONNECTED(im)) { - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_DESTROY_IC, 0, &len); - (void)_XimWrite(im, len, (XPointer)buf); - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimDestroyICCheck, (XPointer)ic); - if (ret_code == XIM_OVERFLOW) { - buf_size = len; - preply = Xmalloc(buf_size); - (void)_XimRead(im, &len, preply, buf_size, - _XimDestroyICCheck, (XPointer)ic); - Xfree(preply); - } - } - UNMARK_IC_CONNECTED(ic); - _XimUnregisterFilter(ic); - _XimProtoICFree(ic); - return; -} - -static void -_XimProtoSetFocus( - XIC xic) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - -#ifndef XIM_CONNECTABLE - if (!IS_IC_CONNECTED(ic)) - return; -#else - if (!IS_IC_CONNECTED(ic)) { - if (IS_CONNECTABLE(im)) { - if (_XimConnectServer(im)) { - if (!_XimReCreateIC(ic)) { - _XimDelayModeSetAttr(im); - return; - } - } else { - return; - } - } else { - return; - } - } -#endif /* XIM_CONNECTABLE */ - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_SET_IC_FOCUS, 0, &len); - (void)_XimWrite(im, len, (XPointer)buf); - _XimFlush(im); - - _XimRegisterFilter(ic); - return; -} - -static void -_XimProtoUnsetFocus( - XIC xic) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - -#ifndef XIM_CONNECTABLE - if (!IS_IC_CONNECTED(ic)) - return; -#else - if (!IS_IC_CONNECTED(ic)) { - if (IS_CONNECTABLE(im)) { - if (_XimConnectServer(im)) { - if (!_XimReCreateIC(ic)) { - _XimDelayModeSetAttr(im); - return; - } - } else { - return; - } - } else { - return; - } - } -#endif /* XIM_CONNECTABLE */ - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_UNSET_IC_FOCUS, 0, &len); - (void)_XimWrite(im, len, (XPointer)buf); - _XimFlush(im); - - _XimUnregisterFilter(ic); - return; -} - -static Bool -_XimResetICCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - - if ((major_opcode == XIM_RESET_IC_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - return True; - return False; -} - -static char * -_XimProtoReset( - XIC xic, - char * (*retfunc) (Xim im, Xic ic, XPointer buf) ) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - char *commit; - - if (!IS_IC_CONNECTED(ic)) - return (char *)NULL; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_RESET_IC, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return NULL; - _XimFlush(im); - ic->private.proto.waitCallback = True; - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimResetICCheck, (XPointer)ic); - if (ret_code == XIM_TRUE) { - preply = reply; - } else if (ret_code == XIM_OVERFLOW) { - if (len < 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimResetICCheck, (XPointer)ic); - if (ret_code != XIM_TRUE) { - Xfree(preply); - ic->private.proto.waitCallback = False; - return NULL; - } - } - } else { - ic->private.proto.waitCallback = False; - return NULL; - } - ic->private.proto.waitCallback = False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if (reply != preply) - free(preply); - return NULL; - } - - commit = retfunc(im, ic, (XPointer)&buf_s[2]); - - if (reply != preply) - Xfree(preply); - return commit; -} - -static char * -_XimCommitedMbString( - Xim im, - Xic ic, - XPointer buf) -{ - CARD16 *buf_s = (CARD16 *)buf; - XimCommitInfo info; - int len; - int new_len; - char *commit; - char *new_commit = NULL; - char *str; - Status status; - - len = 0; - for (info = ic->private.proto.commit_info; info; info = info->next) - len += info->string_len; - len += buf_s[0]; - if ( len == 0 ) - return( NULL ); - - if (!(commit = Xmalloc(len + 1))) - goto Error_On_Reset; - - str = commit; - for (info = ic->private.proto.commit_info; info; info = info->next) { - (void)memcpy(str, info->string, info->string_len); - str += info->string_len; - } - (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); - commit[len] = '\0'; - - new_len = im->methods->ctstombs((XIM)im, commit, len, NULL, 0, &status); - if (status != XLookupNone) { - if (!(new_commit = Xmalloc(new_len + 1))) { - Xfree(commit); - goto Error_On_Reset; - } - (void)im->methods->ctstombs((XIM)im, commit, len, - new_commit, new_len, NULL); - new_commit[new_len] = '\0'; - } - Xfree(commit); - -Error_On_Reset: - _XimFreeCommitInfo( ic ); - return new_commit; -} - -static char * -_XimProtoMbReset( - XIC xic) -{ - return _XimProtoReset(xic, _XimCommitedMbString); -} - -static wchar_t * -_XimCommitedWcString( - Xim im, - Xic ic, - XPointer buf) -{ - CARD16 *buf_s = (CARD16 *)buf; - XimCommitInfo info; - int len; - int new_len; - char *commit; - wchar_t *new_commit = (wchar_t *)NULL; - char *str; - Status status; - - len = 0; - for (info = ic->private.proto.commit_info; info; info = info->next) - len += info->string_len; - len += buf_s[0]; - if ( len == 0 ) - return( (wchar_t *)NULL ); - - if (!(commit = Xmalloc(len + 1))) - goto Error_On_Reset; - - str = commit; - for (info = ic->private.proto.commit_info; info; info = info->next) { - (void)memcpy(str, info->string, info->string_len); - str += info->string_len; - } - (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); - commit[len] = '\0'; - - new_len = im->methods->ctstowcs((XIM)im, commit, len, NULL, 0, &status); - if (status != XLookupNone) { - if (!(new_commit = - (wchar_t *)Xmalloc(sizeof(wchar_t) * (new_len + 1)))) { - Xfree(commit); - goto Error_On_Reset; - } - (void)im->methods->ctstowcs((XIM)im, commit, len, - new_commit, new_len, NULL); - new_commit[new_len] = (wchar_t)'\0'; - } - Xfree(commit); - -Error_On_Reset: - _XimFreeCommitInfo( ic ); - return new_commit; -} - -static wchar_t * -_XimProtoWcReset( - XIC xic) -{ - return (wchar_t *) _XimProtoReset(xic, - (char * (*) (Xim, Xic, XPointer)) _XimCommitedWcString); -} - -static char * -_XimCommitedUtf8String( - Xim im, - Xic ic, - XPointer buf) -{ - CARD16 *buf_s = (CARD16 *)buf; - XimCommitInfo info; - int len; - int new_len; - char *commit; - char *new_commit = NULL; - char *str; - Status status; - - len = 0; - for (info = ic->private.proto.commit_info; info; info = info->next) - len += info->string_len; - len += buf_s[0]; - if ( len == 0 ) - return( NULL ); - - if (!(commit = Xmalloc(len + 1))) - goto Error_On_Reset; - - str = commit; - for (info = ic->private.proto.commit_info; info; info = info->next) { - (void)memcpy(str, info->string, info->string_len); - str += info->string_len; - } - (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); - commit[len] = '\0'; - - new_len = im->methods->ctstoutf8((XIM)im, commit, len, NULL, 0, &status); - if (status != XLookupNone) { - if (!(new_commit = Xmalloc(new_len + 1))) { - Xfree(commit); - goto Error_On_Reset; - } - (void)im->methods->ctstoutf8((XIM)im, commit, len, - new_commit, new_len, NULL); - new_commit[new_len] = '\0'; - } - Xfree(commit); - -Error_On_Reset: - _XimFreeCommitInfo( ic ); - return new_commit; -} - -static char * -_XimProtoUtf8Reset( - XIC xic) -{ - return _XimProtoReset(xic, _XimCommitedUtf8String); -} - -static XICMethodsRec ic_methods = { - _XimProtoDestroyIC, /* destroy */ - _XimProtoSetFocus, /* set_focus */ - _XimProtoUnsetFocus, /* unset_focus */ - _XimProtoSetICValues, /* set_values */ - _XimProtoGetICValues, /* get_values */ - _XimProtoMbReset, /* mb_reset */ - _XimProtoWcReset, /* wc_reset */ - _XimProtoUtf8Reset, /* utf8_reset */ - _XimProtoMbLookupString, /* mb_lookup_string */ - _XimProtoWcLookupString, /* wc_lookup_string */ - _XimProtoUtf8LookupString /* utf8_lookup_string */ -}; - -static Bool -_XimGetInputStyle( - XIMArg *arg, - XIMStyle *input_style) -{ - register XIMArg *p; - - for (p = arg; p && p->name; p++) { - if (!(strcmp(p->name, XNInputStyle))) { - *input_style = (XIMStyle)p->value; - return True; - } - } - return False; -} - -#ifdef XIM_CONNECTABLE -static Bool -_XimDelayModeCreateIC( - Xic ic, - XIMArg *values, - XIMResourceList res, - unsigned int num) -{ - Xim im = (Xim)ic->core.im; - XimDefICValues ic_values; - int len; - XIMStyle input_style; - - bzero((char *)&ic_values, sizeof(XimDefICValues)); - _XimGetCurrentICValues(ic, &ic_values); - if (!(_XimGetInputStyle(values, &input_style))) - return False; - - _XimSetICMode(res, num, input_style); - - if (_XimSetICValueData(ic, (XPointer)&ic_values, res, num, - values, XIM_CREATEIC, False)) { - return False; - } - _XimSetCurrentICValues(ic, &ic_values); - if (!_XimSetICDefaults(ic, (XPointer)&ic_values, - XIM_SETICDEFAULTS, res, num)) { - return False; - } - ic_values.filter_events = KeyPressMask; - _XimSetCurrentICValues(ic, &ic_values); - _XimRegisterFilter(ic); - - return True; -} - -Bool -_XimReconnectModeCreateIC(ic) - Xic ic; -{ - Xim im = (Xim)ic->core.im; - int len; - XIMStyle input_style = ic->core.input_style; - XIMResourceList res; - unsigned int num; - - num = im->core.ic_num_resources; - len = sizeof(XIMResource) * num; - if (!(res = Xmalloc(len))) - return False; - (void)memcpy((char *)res, (char *)im->core.ic_resources, len); - ic->private.proto.ic_resources = res; - ic->private.proto.ic_num_resources = num; - - _XimSetICMode(res, num, input_style); - - ic->core.filter_events = KeyPressMask; - - return True; -} -#endif /* XIM_CONNECTABLE */ - -XIC -_XimProtoCreateIC( - XIM xim, - XIMArg *arg) -{ - Xim im = (Xim)xim; - Xic ic; - XimDefICValues ic_values; - XIMResourceList res; - unsigned int num; - XIMStyle input_style; - INT16 len; - CARD16 *buf_s; - char *tmp; - CARD32 tmp_buf32[BUFSIZE/4]; - char *tmp_buf = (char *)tmp_buf32; - char *buf; - int buf_size; - char *data; - int data_len; - int ret_len; - int total; - XIMArg *arg_ret; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int ret_code; - -#ifdef XIM_CONNECTABLE - if (!IS_SERVER_CONNECTED(im) && !IS_CONNECTABLE(im)) - return (XIC)NULL; -#else - if (!IS_SERVER_CONNECTED(im)) - return (XIC)NULL; -#endif /* XIM_CONNECTABLE */ - - if (!(_XimGetInputStyle(arg, &input_style))) - return (XIC)NULL; - - if ((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) - return (XIC)NULL; - - ic->methods = &ic_methods; - ic->core.im = (XIM)im; - ic->core.input_style = input_style; - - num = im->core.ic_num_resources; - len = sizeof(XIMResource) * num; - if (!(res = Xmalloc(len))) - goto ErrorOnCreatingIC; - (void)memcpy((char *)res, (char *)im->core.ic_resources, len); - ic->private.proto.ic_resources = res; - ic->private.proto.ic_num_resources = num; - -#ifdef XIM_CONNECTABLE - if (!_XimSaveICValues(ic, arg)) - return False; - - if (!IS_SERVER_CONNECTED(im)) { - if (!_XimConnectServer(im)) { - if (_XimDelayModeCreateIC(ic, arg, res, num)) { - return (XIC)ic; - } - goto ErrorOnCreatingIC; - } - } -#endif /* XIM_CONNECTABLE */ - - ic->core.filter_events = im->private.proto.forward_event_mask; - ic->private.proto.forward_event_mask = - im->private.proto.forward_event_mask; - ic->private.proto.synchronous_event_mask = - im->private.proto.synchronous_event_mask; - - num = im->private.proto.ic_num_inner_resources; - len = sizeof(XIMResource) * num; - if (!(res = Xmalloc(len))) - goto ErrorOnCreatingIC; - (void)memcpy((char *)res, - (char *)im->private.proto.ic_inner_resources, len); - ic->private.proto.ic_inner_resources = res; - ic->private.proto.ic_num_inner_resources = num; - - _XimSetICMode(ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, input_style); - - _XimSetICMode(ic->private.proto.ic_inner_resources, - ic->private.proto.ic_num_inner_resources, input_style); - - _XimGetCurrentICValues(ic, &ic_values); - buf = tmp_buf; - buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); - data_len = BUFSIZE - buf_size; - total = 0; - arg_ret = arg; - for (;;) { - data = &buf[buf_size]; - if (_XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources, arg, &arg_ret, data, - data_len, &ret_len, (XPointer)&ic_values, 0, XIM_CREATEIC)) { - goto ErrorOnCreatingIC; - } - - total += ret_len; - if (!(arg = arg_ret)) { - break; - } - - buf_size += ret_len; - if (buf == tmp_buf) { - if (!(tmp = Xmalloc(buf_size + data_len))) { - goto ErrorOnCreatingIC; - } - memcpy(tmp, buf, buf_size); - buf = tmp; - } else { - if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { - Xfree(buf); - goto ErrorOnCreatingIC; - } - buf = tmp; - } - } - _XimSetCurrentICValues(ic, &ic_values); - - if (!(_XimCheckCreateICValues(ic->private.proto.ic_resources, - ic->private.proto.ic_num_resources))) - goto ErrorOnCreatingIC; - - _XimRegisterFilter(ic); - - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - buf_s[0] = im->private.proto.imid; - buf_s[1] = (INT16)total; - - len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); - _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - if (buf != tmp_buf) - Xfree(buf); - goto ErrorOnCreatingIC; - } - _XimFlush(im); - if (buf != tmp_buf) - Xfree(buf); - ic->private.proto.waitCallback = True; - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimCreateICCheck, 0); - if (ret_code == XIM_TRUE) { - preply = reply; - } else if (ret_code == XIM_OVERFLOW) { - if (len <= 0) { - preply = reply; - } else { - buf_size = (int)len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimCreateICCheck, 0); - if (ret_code != XIM_TRUE) { - Xfree(preply); - ic->private.proto.waitCallback = False; - goto ErrorOnCreatingIC; - } - } - } else { - ic->private.proto.waitCallback = False; - goto ErrorOnCreatingIC; - } - ic->private.proto.waitCallback = False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if (reply != preply) - Xfree(preply); - goto ErrorOnCreatingIC; - } - - ic->private.proto.icid = buf_s[1]; /* icid */ - if (reply != preply) - Xfree(preply); - MARK_IC_CONNECTED(ic); - return (XIC)ic; - -ErrorOnCreatingIC: - _XimUnregisterFilter(ic); - - Xfree(ic->private.proto.ic_resources); - Xfree(ic->private.proto.ic_inner_resources); - Xfree(ic); - return (XIC)NULL; -} diff --git a/nx-X11/lib/X11/imDefIm.c b/nx-X11/lib/X11/imDefIm.c deleted file mode 100644 index 2a1ccb4ec..000000000 --- a/nx-X11/lib/X11/imDefIm.c +++ /dev/null @@ -1,2042 +0,0 @@ -/* - * Copyright 1990, 1991, 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/****************************************************************** - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993, 1994 by Sony Corporation - -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 -supporting documentation, and that the names of Digital, FUJITSU -LIMITED and Sony Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. - -DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED -AND 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. - - Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Makoto Wakamatsu Sony Corporation - makoto@sm.sony.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "XlcPublic.h" -#include "XlcPubI.h" -#include "XimTrInt.h" -#include "Ximint.h" - - -int -_XimCheckDataSize( - XPointer buf, - int len) -{ - CARD16 *buf_s = (CARD16 *)buf; - - if(len < XIM_HEADER_SIZE) - return -1; - return buf_s[1]; -} - -void -_XimSetHeader( - XPointer buf, - CARD8 major_opcode, - CARD8 minor_opcode, - INT16 *len -) -{ - CARD8 *buf_b = (CARD8 *)buf; - CARD16 *buf_s = (CARD16 *)buf; - - buf_b[0] = major_opcode; - buf_b[1] = minor_opcode; - buf_s[1] = ((*len) / 4); - *len += XIM_HEADER_SIZE; - return; -} - -char -_XimGetMyEndian(void) -{ - CARD16 test_card = 1; - - if(*((char *)&test_card)) - return LITTLEENDIAN; - else - return BIGENDIAN; -} - -static Bool -_XimCheckServerName( - Xim im, - char *str) -{ - char *server_name = im->core.im_name; - int len; - int str_len; - int category_len = strlen(XIM_SERVER_CATEGORY); - char *pp; - register char *p; - - if(server_name && *server_name) - len = strlen(server_name); - else - return True; - - if((int)strlen(str) < category_len) - return False; - - if(strncmp(str, XIM_SERVER_CATEGORY, category_len)) - return False; - - pp = &str[category_len]; - - for(;;) { - for(p = pp; (*p != ',') && (*p); p++); - str_len = (int)(p - pp); - - if((len == str_len) && (!strncmp(pp, server_name, len))) - break; - if(!(*p)) - return False; - pp = p + 1; - } - return True; -} - -static char * -_XimCheckLocaleName( - Xim im, - char *address, - int address_len, - char *locale_name[], - int len) -{ - int category_len; - char *pp; - register char *p; - register int n; - Bool finish = False; - - category_len = strlen(XIM_LOCAL_CATEGORY); - if(address_len < category_len) - return (char*)NULL; - - if(strncmp(address, XIM_LOCAL_CATEGORY, category_len)) - return (char*)NULL; - - pp = &address[category_len]; - - for(;;) { - for( p = pp; *p && *p != ','; p++); - if (!*p) - finish = True; - address_len = (int)(p - pp); - *p = '\0'; - - for( n = 0; n < len; n++ ) - if( locale_name[n] && !_XlcCompareISOLatin1( pp, locale_name[n] ) ) - return locale_name[n]; - if (finish) - break; - pp = p + 1; - } - return (char *)NULL; -} - -static Bool -_XimCheckTransport( - char *address, - int address_len, - const char *transport, - int len, - char **trans_addr) -{ - int category_len = strlen(XIM_TRANSPORT_CATEGORY); - char *pp; - register char *p; - - if(address_len < category_len) - return False; - - if(strncmp(address, XIM_TRANSPORT_CATEGORY, category_len)) - return False; - - pp = &address[category_len]; - - for(;;) { - *trans_addr = pp; - - for(p = pp; (*p != '/') && (*p != ',') && (*p); p++); - if(*p == ',') { - pp = p + 1; - continue; - } - if(!(*p)) - return False; - - address_len = (int)(p - pp); - - if((len == address_len) && (!strncmp(pp, transport, len))) - break; - pp = p + 1; - } - pp = p + 1; - for(p = pp; (*p != ',') && (*p); p++); - if (*p) - *p = '\0'; - return True; -} - -static Bool -_CheckSNEvent( - Display *display, - XEvent *xevent, - XPointer arg) -{ - XSelectionEvent *event = (XSelectionEvent *)xevent; - Window window = *(Window*)arg; - - if((event->type == SelectionNotify) && (window == event->requestor)) - return True; - return False; -} - -static Bool -_XimGetSelectionNotify( - Display *display, - Window window, - Atom target, - char **ret_address) -{ - XEvent event; - XSelectionEvent *ev = (XSelectionEvent *)&event; - Atom actual_type; - int actual_format; - unsigned long nitems, bytes_after; - - for(;;) { - XIfEvent(display, &event, _CheckSNEvent, (XPointer)&window); - if((ev->type == SelectionNotify) && (window == ev->requestor)) - break; - } - - if(ev->property == (Atom)None) - return False; - if( XGetWindowProperty( display, window, target, 0L, 1000000L, - True, target, &actual_type, &actual_format, - &nitems, &bytes_after, - (unsigned char **)&*ret_address ) != Success ) - return False; - return True; -} - -static Bool -_XimPreConnectionIM( - Xim im, - Atom selection) -{ - Display *display = im->core.display; - Atom locales, transport; - char *address; - XLCd lcd; - char *language; - char *territory; - char *codeset; - char *trans_addr; - char *locale_name[4], *locale; - int llen, tlen, clen; - register int i; - Window window; - char *str; - - if(!(lcd = im->core.lcd)) - return False; - - for( i = 0; i < 4; i++ ) - locale_name[i] = NULL; - /* requestor window */ - if(!(window = XCreateSimpleWindow(display, DefaultRootWindow(display), - 0, 0, 1, 1, 1, 0, 0))) - return False; - - /* server name check */ - if( !(str = XGetAtomName( display, selection )) ) - return False; - if(!_XimCheckServerName(im, str)) { - XFree( (XPointer)str ); - goto Error; - } - XFree( (XPointer)str ); - - /* locale name check */ - _XGetLCValues(lcd, XlcNLanguage, &language, XlcNTerritory, &territory, - XlcNCodeset, &codeset, NULL); - llen = strlen( language ); - tlen = territory ? strlen( territory ): 0; - clen = codeset ? strlen( codeset ): 0; - - if( tlen != 0 && clen != 0 ) { - if( (locale_name[0] = Xmalloc(llen+tlen+clen+3)) != NULL ) - sprintf( locale_name[0], "%s_%s.%s", language, territory, codeset ); - } - if( clen != 0 ) { - if( (locale_name[1] = Xmalloc(llen+clen+2)) != NULL ) - sprintf( locale_name[1], "%s.%s", language, codeset ); - else - goto Error; - } - if( tlen != 0 ) { - if( (locale_name[2] = Xmalloc(llen+tlen+2)) != NULL ) - sprintf( locale_name[2], "%s_%s", language, territory ); - else - goto Error; - } - if( (locale_name[3] = Xmalloc(llen+1)) != NULL ) - strcpy( locale_name[3], language ); - else - goto Error; - if((locales = XInternAtom(display, XIM_LOCALES, True)) == (Atom)None) - goto Error; - - XConvertSelection(display, selection, locales, locales, window, - CurrentTime); - if(!(_XimGetSelectionNotify(display, window, locales, &address))) - goto Error; - - if((locale = _XimCheckLocaleName(im, address, strlen(address), locale_name, - 4)) == NULL) { - XFree((XPointer)address); - goto Error; - } - im->private.proto.locale_name = locale; - for( i = 0; i < 4; i++ ) { - if( locale_name[i] != NULL && locale_name[i] != locale ) { - XFree( locale_name[i] ); - locale_name[i] = NULL; - } - } - XFree((XPointer)address); - - /* transport check */ - if((transport = XInternAtom(display, XIM_TRANSPORT, True)) == (Atom)None) - goto Error; - - XConvertSelection(display, selection, transport, transport, window, - CurrentTime); - if(!_XimGetSelectionNotify(display, window, transport, &address)) - goto Error; - - for(i = 0; _XimTransportRec[i].transportname ; i++) { - if( _XimCheckTransport(address, strlen(address), - _XimTransportRec[i].transportname, - strlen(_XimTransportRec[i].transportname), - &trans_addr)) { - if( _XimTransportRec[i].config(im, trans_addr) ) { - XFree((XPointer)address); - XDestroyWindow(display, window); - return True; - } - } - } - - XFree((XPointer)address); -Error: - for( i = 0; i < 4; i++ ) - if( locale_name[i] != NULL ) - XFree( locale_name[i] ); - XDestroyWindow(display, window); - return False; -} - -static Bool -_XimPreConnect( - Xim im) -{ - Display *display = im->core.display; - Atom imserver; - Atom actual_type; - int actual_format; - unsigned long nitems; - unsigned long bytes_after; - unsigned char *prop_return; - Atom *atoms; - Window im_window = 0; - register int i; - - if((imserver = XInternAtom(display, XIM_SERVERS, True)) == (Atom)None) - return False; - - if(XGetWindowProperty(display, RootWindow(display, 0), - imserver, 0L, 1000000L, False, XA_ATOM, &actual_type, - &actual_format, &nitems, &bytes_after, - &prop_return) != Success) - return False; - - if( (actual_type != XA_ATOM) || (actual_format != 32) ) { - if( nitems ) - XFree((XPointer)prop_return); - return False; - } - - atoms = (Atom *)prop_return; - for(i = 0; i < nitems; i++) { - if((im_window = XGetSelectionOwner(display, atoms[i])) == (Window)None) - continue; - - if(_XimPreConnectionIM(im, atoms[i])) - break; - } - - XFree((XPointer)prop_return); - if(i >= nitems) - return False; - - im->private.proto.im_window = im_window; - return True; -} - -static Bool -_XimGetAuthProtocolNames( - Xim im, - CARD16 *buf, - CARD8 *num, - INT16 *len) -{ - if (!IS_USE_AUTHORIZATION_FUNC(im)) { - *num = 0; - *len = 0; - return True; - } - /* - * Not yet - */ - return True; -} - -static Bool -_XimSetAuthReplyData( - Xim im, - XPointer buf, - INT16 *len) -{ - /* - * Not yet - */ - *len = 0; - return True; -} - -static Bool -_XimSetAuthNextData( - Xim im, - XPointer buf, - INT16 *len) -{ - /* - * Not yet - */ - *len = 0; - return True; -} - -static Bool -_XimSetAuthRequiredData( - Xim im, - XPointer buf, - INT16 *len) -{ - /* - * Not yet - */ - *len = 0; - return True; -} - -static Bool -_XimCheckAuthSetupData( - Xim im, - XPointer buf) -{ - /* - * Not yet - */ - return True; -} - -static Bool -_XimCheckAuthNextData( - Xim im, - XPointer buf) -{ - /* - * Not yet - */ - return True; -} - -#define NO_MORE_AUTH 2 -#define GOOD_AUTH 1 -#define BAD_AUTH 0 - -static int -_XimClientAuthCheck( - Xim im, - XPointer buf) -{ - /* - * Not yet - */ - return NO_MORE_AUTH; -} - -static void -_XimAuthNG( - Xim im) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - INT16 len = 0; - - _XimSetHeader((XPointer)buf, XIM_AUTH_NG, 0, &len); - (void)_XimWrite(im, len, (XPointer)buf); - _XimFlush(im); - return; -} - -static Bool -_XimAllRecv( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - return True; -} - -#define CLIENT_WAIT1 1 -#define CLIENT_WAIT2 2 - -static Bool -_XimConnection( - Xim im) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; - CARD16 *buf_s = (CARD16 *)((XPointer)buf_b); - INT16 len; - CARD8 num; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - CARD8 major_opcode; - int wait_mode; - int ret; - - if(!(_XimConnect(im))) /* Transport Connect */ - return False; - - if(!_XimDispatchInit(im)) - return False; - - _XimRegProtoIntrCallback(im, XIM_ERROR, 0, _XimErrorCallback, (XPointer)im); - - if(!_XimGetAuthProtocolNames(im, &buf_s[4], &num, &len)) - return False; - - im->private.proto.protocol_major_version = PROTOCOLMAJORVERSION; - im->private.proto.protocol_minor_version = PROTOCOLMINORVERSION; - - buf_b[0] = _XimGetMyEndian(); - buf_b[1] = 0; - buf_s[1] = PROTOCOLMAJORVERSION; - buf_s[2] = PROTOCOLMINORVERSION; - buf_s[3] = num; - len += sizeof(CARD8) - + sizeof(CARD8) - + sizeof(CARD16) - + sizeof(CARD16) - + sizeof(CARD16); - - major_opcode = XIM_CONNECT; - wait_mode = (IS_USE_AUTHORIZATION_FUNC(im)) ? CLIENT_WAIT1 : CLIENT_WAIT2; - - for(;;) { - _XimSetHeader((XPointer)buf, major_opcode, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, reply, buf_size, _XimAllRecv, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else - return False; - - major_opcode = *((CARD8 *)preply); - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - - if (wait_mode == CLIENT_WAIT1) { - if (major_opcode == XIM_AUTH_REQUIRED) { - ret = _XimClientAuthCheck(im, (XPointer)buf_s); - if(reply != preply) - Xfree(preply); - if (ret == NO_MORE_AUTH) { - if (!(_XimSetAuthReplyData(im, - (XPointer)&buf[XIM_HEADER_SIZE], &len))) { - _XimAuthNG(im); - return False; - } - major_opcode = XIM_AUTH_REPLY; - wait_mode = CLIENT_WAIT2; - } else if (ret == GOOD_AUTH) { - if (!(_XimSetAuthNextData(im, - (XPointer)&buf[XIM_HEADER_SIZE], &len))) { - _XimAuthNG(im); - return False; - } - major_opcode = XIM_AUTH_NEXT; - } else { /* BAD_AUTH */ - _XimAuthNG(im); - return False; - } - } else { - if(reply != preply) - Xfree(preply); - _XimAuthNG(im); - return False; - } - } else { /* CLIENT_WAIT2 */ - if (major_opcode == XIM_CONNECT_REPLY) { - break; - } else if (major_opcode == XIM_AUTH_SETUP) { - if (!(_XimCheckAuthSetupData(im, (XPointer)buf_s))) { - _XimAuthNG(im); - return False; - } - if(reply != preply) - Xfree(preply); - if (!(_XimSetAuthRequiredData(im, - (XPointer)&buf[XIM_HEADER_SIZE], &len))) { - _XimAuthNG(im); - return False; - } - major_opcode = XIM_AUTH_REQUIRED; - } else if (major_opcode == XIM_AUTH_NEXT) { - if (!(_XimCheckAuthNextData(im, (XPointer)buf_s))) { - _XimAuthNG(im); - return False; - } - if(reply != preply) - Xfree(preply); - if (!(_XimSetAuthRequiredData(im, - (XPointer)&buf[XIM_HEADER_SIZE], &len))) { - _XimAuthNG(im); - return False; - } - major_opcode = XIM_AUTH_REQUIRED; - } else if (major_opcode == XIM_AUTH_NG) { - if(reply != preply) - Xfree(preply); - return False; - } else { - _XimAuthNG(im); - if(reply != preply) - Xfree(preply); - return False; - } - } - } - - if (!( buf_s[0] == im->private.proto.protocol_major_version - && buf_s[1] == im->private.proto.protocol_minor_version)) { - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - MARK_SERVER_CONNECTED(im); - - _XimRegProtoIntrCallback(im, XIM_REGISTER_TRIGGERKEYS, 0, - _XimRegisterTriggerKeysCallback, (XPointer)im); - return True; -} - -static Bool -_XimDisconnectCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - - if ((major_opcode == XIM_DISCONNECT_REPLY) - && (minor_opcode == 0)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0)) - return True; - return False; -} - -static Bool -_XimDisconnect( - Xim im) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - INT16 len = 0; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - - if (IS_SERVER_CONNECTED(im)) { - _XimSetHeader((XPointer)buf, XIM_DISCONNECT, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimDisconnectCheck, 0); - if(ret_code == XIM_OVERFLOW) { - if(len > 0) { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimDisconnectCheck, 0); - Xfree(preply); - if(ret_code != XIM_TRUE) - return False; - } - } else if(ret_code == XIM_FALSE) - return False; - - } - if (!(_XimShutdown(im))) /* Transport shutdown */ - return False; - return True; -} - -static Bool -_XimOpenCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - - if ((major_opcode == XIM_OPEN_REPLY) - && (minor_opcode == 0)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0)) - return True; - return False; -} - -static Bool -_XimOpen( - Xim im) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; - CARD16 *buf_s; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - char *locale_name; - - locale_name = im->private.proto.locale_name; - len = strlen(locale_name); - buf_b[0] = (BYTE)len; /* length of locale name */ - (void)strcpy((char *)&buf_b[1], locale_name); /* locale name */ - len += sizeof(BYTE); /* sizeof length */ - XIM_SET_PAD(buf_b, len); /* pad */ - - _XimSetHeader((XPointer)buf, XIM_OPEN, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, reply, buf_size, - _XimOpenCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimOpenCheck, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else - return False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - - im->private.proto.imid = buf_s[0]; /* imid */ - - if (!(_XimGetAttributeID(im, &buf_s[1]))) { - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - - if (!(_XimSetInnerIMResourceList(&(im->private.proto.im_inner_resources), - &(im->private.proto.im_num_inner_resources)))) - return False; - - if (!(_XimSetInnerICResourceList(&(im->private.proto.ic_inner_resources), - &(im->private.proto.ic_num_inner_resources)))) - return False; - - _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); - _XimSetIMMode(im->private.proto.im_inner_resources, - im->private.proto.im_num_inner_resources); - - /* Transport Callbak */ - _XimRegProtoIntrCallback(im, XIM_SET_EVENT_MASK, 0, - _XimSetEventMaskCallback, (XPointer)im); - _XimRegProtoIntrCallback(im, XIM_FORWARD_EVENT, 0, - _XimForwardEventCallback, (XPointer)im); - _XimRegProtoIntrCallback(im, XIM_COMMIT, 0, - _XimCommitCallback, (XPointer)im); - _XimRegProtoIntrCallback(im, XIM_SYNC, 0, - _XimSyncCallback, (XPointer)im); - - if(!_XimExtension(im)) - return False; - - /* register a hook for callback protocols */ - _XimRegisterDispatcher(im, _XimCbDispatch, (XPointer)im); - - return True; -} - -static Bool -_XimCloseCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - - if ((major_opcode == XIM_CLOSE_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid)) - return True; - return False; -} - -static Bool -_XimClose( - Xim im) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - - if (!IS_SERVER_CONNECTED(im)) - return True; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = 0; /* unused */ - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof unused */ - - _XimSetHeader((XPointer)buf, XIM_CLOSE, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimCloseCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else - return False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - - if(reply != preply) - Xfree(preply); - return True; -} - -void -_XimProtoIMFree( - Xim im) -{ - /* XIMPrivateRec */ - if (im->private.proto.im_onkeylist) { - Xfree(im->private.proto.im_onkeylist); - im->private.proto.im_onkeylist = NULL; - } - if (im->private.proto.im_offkeylist) { - Xfree(im->private.proto.im_offkeylist); - im->private.proto.im_offkeylist = NULL; - } - if (im->private.proto.intrproto) { - _XimFreeProtoIntrCallback(im); - im->private.proto.intrproto = NULL; - } - if (im->private.proto.im_inner_resources) { - Xfree(im->private.proto.im_inner_resources); - im->private.proto.im_inner_resources = NULL; - } - if (im->private.proto.ic_inner_resources) { - Xfree(im->private.proto.ic_inner_resources); - im->private.proto.ic_inner_resources = NULL; - } - if (im->private.proto.hold_data) { - Xfree(im->private.proto.hold_data); - im->private.proto.hold_data = NULL; - } - if (im->private.proto.locale_name) { - Xfree(im->private.proto.locale_name); - im->private.proto.locale_name = NULL; - } - if (im->private.proto.ctom_conv) { - _XlcCloseConverter(im->private.proto.ctom_conv); - im->private.proto.ctom_conv = NULL; - } - if (im->private.proto.ctow_conv) { - _XlcCloseConverter(im->private.proto.ctow_conv); - im->private.proto.ctow_conv = NULL; - } - if (im->private.proto.ctoutf8_conv) { - _XlcCloseConverter(im->private.proto.ctoutf8_conv); - im->private.proto.ctoutf8_conv = NULL; - } - if (im->private.proto.cstomb_conv) { - _XlcCloseConverter(im->private.proto.cstomb_conv); - im->private.proto.cstomb_conv = NULL; - } - if (im->private.proto.cstowc_conv) { - _XlcCloseConverter(im->private.proto.cstowc_conv); - im->private.proto.cstowc_conv = NULL; - } - if (im->private.proto.cstoutf8_conv) { - _XlcCloseConverter(im->private.proto.cstoutf8_conv); - im->private.proto.cstoutf8_conv = NULL; - } - if (im->private.proto.ucstoc_conv) { - _XlcCloseConverter(im->private.proto.ucstoc_conv); - im->private.proto.ucstoc_conv = NULL; - } - if (im->private.proto.ucstoutf8_conv) { - _XlcCloseConverter(im->private.proto.ucstoutf8_conv); - im->private.proto.ucstoutf8_conv = NULL; - } - -#ifdef XIM_CONNECTABLE - if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { - return; - } -#endif /* XIM_CONNECTABLE */ - - if (im->private.proto.saved_imvalues) { - Xfree(im->private.proto.saved_imvalues); - im->private.proto.saved_imvalues = NULL; - } - if (im->private.proto.default_styles) { - Xfree(im->private.proto.default_styles); - im->private.proto.default_styles = NULL; - } - - /* core */ - if (im->core.res_name) { - Xfree(im->core.res_name); - im->core.res_name = NULL; - } - if (im->core.res_class) { - Xfree(im->core.res_class); - im->core.res_class = NULL; - } - if (im->core.im_values_list) { - Xfree(im->core.im_values_list); - im->core.im_values_list = NULL; - } - if (im->core.ic_values_list) { - Xfree(im->core.ic_values_list); - im->core.ic_values_list = NULL; - } - if (im->core.im_name) { - Xfree(im->core.im_name); - im->core.im_name = NULL; - } - if (im->core.styles) { - Xfree(im->core.styles); - im->core.styles = NULL; - } - if (im->core.im_resources) { - Xfree(im->core.im_resources); - im->core.im_resources = NULL; - } - if (im->core.ic_resources) { - Xfree(im->core.ic_resources); - im->core.ic_resources = NULL; - } - - return; -} - -static Status -_XimProtoCloseIM( - XIM xim) -{ - Xim im = (Xim)xim; - XIC ic; - XIC next; - Status status; - - ic = im->core.ic_chain; - while (ic) { - (*ic->methods->destroy) (ic); - next = ic->core.next; -#ifdef XIM_CONNECTABLE - if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) { - Xfree (ic); - } -#else - Xfree (ic); -#endif /* XIM_CONNECTABLE */ - ic = next; - } -#ifdef XIM_CONNECTABLE - if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) - im->core.ic_chain = NULL; -#else - im->core.ic_chain = NULL; -#endif - - _XimUnregisterServerFilter(im); - _XimResetIMInstantiateCallback(im); - status = (Status)_XimClose(im); - status = (Status)_XimDisconnect(im) && status; - _XimProtoIMFree(im); -#ifdef XIM_CONNECTABLE - if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { - _XimReconnectModeSetAttr(im); - for (ic = im->core.ic_chain; ic; ic = ic->core.next) { - _XimReconnectModeCreateIC(ic); - } - return 0; - } -#endif /* XIM_CONNECTABLE */ - _XimDestroyIMStructureList(im); - return status; -} - -#ifdef XIM_CONNECTABLE -static Bool -_XimCheckIMQuarkList( - XrmQuark *quark_list, - int num_quark, - XrmQuark quark) -{ - register int i; - - for (i = 0; i < num_quark; i++) { - if (quark_list[i] == quark) { - return True; - } - } - return False; -} - -static Bool -_XimSaveIMValues( - Xim im, - XIMArg *arg) -{ - register XIMArg *p; - register int n; - XrmQuark *quark_list; - XrmQuark *tmp; - XrmQuark quark; - int num_quark; - - if (quark_list = im->private.proto.saved_imvalues) { - num_quark = im->private.proto.num_saved_imvalues; - for (p = arg; p && p->name; p++) { - quark = XrmStringToQuark(p->name); - if (_XimCheckIMQuarkList(quark_list, num_quark, quark)) { - continue; - } - if (!(tmp = Xrealloc(quark_list, - (sizeof(XrmQuark) * (num_quark + 1))))) { - im->private.proto.saved_imvalues = quark_list; - im->private.proto.num_saved_imvalues = num_quark; - return False; - } - num_quark++; - quark_list = tmp; - quark_list[num_quark] = quark; - } - im->private.proto.saved_imvalues = quark_list; - im->private.proto.num_saved_imvalues = num_quark; - return True; - } - - for (p = arg, n = 0; p && p->name; p++, n++); - - if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { - return False; - } - - im->private.proto.saved_imvalues = quark_list; - im->private.proto.num_saved_imvalues = n; - for (p = arg; p && p->name; p++, quark_list++) { - *quark_list = XrmStringToQuark(p->name); - } - - return True; -} - -static char * -_XimDelayModeSetIMValues( - Xim im, - XIMArg *arg) -{ - XimDefIMValues im_values; - char *name; - XIMArg *values; - - _XimGetCurrentIMValues(im, &im_values); - name = _XimSetIMValueData(im, (XPointer)&im_values, values, - im->core.im_resources, im->core.im_num_resources); - _XimSetCurrentIMValues(im, &im_values); - - return name; -} -#endif /* XIM_CONNECTABLE */ - -static Bool -_XimSetIMValuesCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - - if ((major_opcode == XIM_SET_IM_VALUES_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid)) - return True; - return False; -} - -static char * -_XimProtoSetIMValues( - XIM xim, - XIMArg *arg) -{ - Xim im = (Xim)xim; - XimDefIMValues im_values; - INT16 len; - CARD16 *buf_s; - char *tmp; - CARD32 tmp_buf32[BUFSIZE/4]; - char *tmp_buf = (char *)tmp_buf32; - char *buf; - int buf_size; - char *data; - int data_len; - int ret_len; - int total; - XIMArg *arg_ret; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int ret_code; - char *name; - -#ifndef XIM_CONNECTABLE - if (!IS_SERVER_CONNECTED(im)) - return arg->name; -#else - if (!_XimSaveIMValues(im, arg)) - return arg->name; - - if (!IS_SERVER_CONNECTED(im)) { - if (IS_CONNECTABLE(im)) { - if (!_XimConnectServer(im)) { - return _XimDelayModeSetIMValues(im, arg); - } - } else { - return arg->name; - } - } -#endif /* XIM_CONNECTABLE */ - - _XimGetCurrentIMValues(im, &im_values); - buf = tmp_buf; - buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); - data_len = BUFSIZE - buf_size; - total = 0; - arg_ret = arg; - for (;;) { - data = &buf[buf_size]; - if ((name = _XimEncodeIMATTRIBUTE(im, im->core.im_resources, - im->core.im_num_resources, arg, &arg_ret, data, data_len, - &ret_len, (XPointer)&im_values, XIM_SETIMVALUES))) { - if (buf != tmp_buf) - Xfree(buf); - break; - } - - total += ret_len; - if (!(arg = arg_ret)) { - break; - } - - buf_size += ret_len; - if (buf == tmp_buf) { - if (!(tmp = Xmalloc(buf_size + data_len))) { - return arg->name; - } - memcpy(tmp, buf, buf_size); - buf = tmp; - } else { - if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { - Xfree(buf); - return arg->name; - } - buf = tmp; - } - } - _XimSetCurrentIMValues(im, &im_values); - - if (!total) - return (char *)NULL; - - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - buf_s[0] = im->private.proto.imid; - buf_s[1] = (INT16)total; - - len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); - _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - if (buf != tmp_buf) - Xfree(buf); - return arg->name; - } - _XimFlush(im); - if (buf != tmp_buf) - Xfree(buf); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimSetIMValuesCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = (int)len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, reply, buf_size, - _XimSetIMValuesCheck, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return arg->name; - } - } - } else - return arg->name; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return arg->name; - } - if(reply != preply) - Xfree(preply); - - return name; -} - -#ifdef XIM_CONNECTABLE -static char * -_XimDelayModeGetIMValues( - Xim im, - XIMArg *arg) -{ - XimDefIMValues im_values; - - _XimGetCurrentIMValues(im, &im_values); - return(_XimGetIMValueData(im, (XPointer)&im_values, arg, - im->core.im_resources, im->core.im_num_resources)); -} -#endif /* XIM_CONNECTABLE */ - -static Bool -_XimGetIMValuesCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - - if ((major_opcode == XIM_GET_IM_VALUES_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid)) - return True; - return False; -} - -static char * -_XimProtoGetIMValues( - XIM xim, - XIMArg *arg) -{ - Xim im = (Xim)xim; - register XIMArg *p; - register int n; - CARD8 *buf; - CARD16 *buf_s; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply = NULL; - int buf_size; - int ret_code; - char *makeid_name; - char *decode_name; - CARD16 *data = NULL; - INT16 data_len = 0; - -#ifndef XIM_CONNECTABLE - if (!IS_SERVER_CONNECTED(im)) - return arg->name; -#else - if (!IS_SERVER_CONNECTED(im)) { - if (IS_CONNECTABLE(im)) { - if (!_XimConnectServer(im)) { - return _XimDelayModeGetIMValues(im, arg); - } - } else { - return arg->name; - } - } -#endif /* XIM_CONNECTABLE */ - - for (n = 0, p = arg; p->name; p++) - n++; - - if (!n) - return (char *)NULL; - - buf_size = sizeof(CARD16) * n; - buf_size += XIM_HEADER_SIZE - + sizeof(CARD16) - + sizeof(INT16) - + XIM_PAD(buf_size); - - if (!(buf = Xmalloc(buf_size))) - return arg->name; - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - - makeid_name = _XimMakeIMAttrIDList(im, im->core.im_resources, - im->core.im_num_resources, arg, - &buf_s[2], &len, XIM_GETIMVALUES); - - if (len) { - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = len; /* length of im-attr-id */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += sizeof(CARD16) /* sizeof imid */ - + sizeof(INT16); /* sizeof length of attr */ - - _XimSetHeader((XPointer)buf, XIM_GET_IM_VALUES, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - Xfree(buf); - return arg->name; - } - _XimFlush(im); - Xfree(buf); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimGetIMValuesCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimGetIMValuesCheck, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return arg->name; - } - } - } else - return arg->name; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return arg->name; - } - data = &buf_s[2]; - data_len = buf_s[1]; - } - decode_name = _XimDecodeIMATTRIBUTE(im, im->core.im_resources, - im->core.im_num_resources, data, data_len, - arg, XIM_GETIMVALUES); - if (reply != preply) - Xfree(preply); - - if (decode_name) - return decode_name; - else - return makeid_name; -} - -static XIMMethodsRec im_methods = { - _XimProtoCloseIM, /* close */ - _XimProtoSetIMValues, /* set_values */ - _XimProtoGetIMValues, /* get_values */ - _XimProtoCreateIC, /* create_ic */ - _Ximctstombs, /* ctstombs */ - _Ximctstowcs, /* ctstowcs */ - _Ximctstoutf8 /* ctstoutf8 */ -}; - -static Bool -_XimSetEncodingByName( - Xim im, - char **buf, - int *len) -{ - char *encoding = (char *)NULL; - int encoding_len; - int compound_len; - BYTE *ret; - - _XGetLCValues(im->core.lcd, XlcNCodeset, &encoding, NULL); - if (!encoding) { - *buf = (char *)NULL; - *len = 0; - return True; - } - encoding_len = strlen(encoding); - compound_len = strlen("COMPOUND_TEXT"); - *len = encoding_len + sizeof(BYTE) + compound_len + sizeof(BYTE); - if (!(ret = Xmalloc(*len))) { - return False; - } - *buf = (char *)ret; - - ret[0] = (BYTE)encoding_len; - (void)strncpy((char *)&ret[1], encoding, encoding_len); - ret += (encoding_len + sizeof(BYTE)); - ret[0] = (BYTE)compound_len; - (void)strncpy((char *)&ret[1], "COMPOUND_TEXT", compound_len); - return True; -} - -static Bool -_XimSetEncodingByDetail( - Xim im, - char **buf, - int *len) -{ - *len = 0; - *buf = NULL; - return True; -} - -static Bool -_XimGetEncoding( - Xim im, - CARD16 *buf, - char *name, - int name_len, - char *detail, - int detail_len) -{ - XLCd lcd = im->core.lcd; - CARD16 category = buf[0]; - CARD16 idx = buf[1]; - int len; - XlcConv ctom_conv = NULL; - XlcConv ctow_conv = NULL; - XlcConv ctoutf8_conv = NULL; - XlcConv conv; - XimProtoPrivateRec *private = &im->private.proto; - - if (idx == (CARD16)XIM_Default_Encoding_IDX) { /* XXX */ - if (!(ctom_conv = _XlcOpenConverter(lcd, - XlcNCompoundText, lcd, XlcNMultiByte))) - return False; - if (!(ctow_conv = _XlcOpenConverter(lcd, - XlcNCompoundText, lcd, XlcNWideChar))) - return False; - if (!(ctoutf8_conv = _XlcOpenConverter(lcd, - XlcNCompoundText, lcd, XlcNUtf8String))) - return False; - } - - if (category == XIM_Encoding_NameCategory) { - while (name_len > 0) { - len = (int)name[0]; - if (!strncmp(&name[1], "COMPOUND_TEXT", len)) { - if (!(ctom_conv = _XlcOpenConverter(lcd, - XlcNCompoundText, lcd, XlcNMultiByte))) - return False; - if (!(ctow_conv = _XlcOpenConverter(lcd, - XlcNCompoundText, lcd, XlcNWideChar))) - return False; - if (!(ctoutf8_conv = _XlcOpenConverter(lcd, - XlcNCompoundText, lcd, XlcNUtf8String))) - return False; - break; - } else { - /* - * Not yet - */ - } - len += sizeof(BYTE); - name_len -= len; - name += len; - } - } else if (category == XIM_Encoding_DetailCategory) { - /* - * Not yet - */ - } else { - return False; - } - - private->ctom_conv = ctom_conv; - private->ctow_conv = ctow_conv; - private->ctoutf8_conv = ctoutf8_conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) - return False; - private->cstomb_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) - return False; - private->cstowc_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) - return False; - private->cstoutf8_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) - return False; - private->ucstoc_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) - return False; - private->ucstoutf8_conv = conv; - - return True; -} - -static Bool -_XimEncodingNegoCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - - if ((major_opcode == XIM_ENCODING_NEGOTIATION_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid)) - return True; - return False; -} - -static Bool -_XimEncodingNegotiation( - Xim im) -{ - char *name_ptr = 0; - int name_len = 0; - char *detail_ptr = 0; - int detail_len = 0; - CARD8 *buf; - CARD16 *buf_s; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - - if (!(_XimSetEncodingByName(im, &name_ptr, &name_len))) - return False; - - if (!(_XimSetEncodingByDetail(im, &detail_ptr, &detail_len))) - goto free_name_ptr; - - len = sizeof(CARD16) - + sizeof(INT16) - + name_len - + XIM_PAD(name_len) - + sizeof(INT16) - + sizeof(CARD16) - + detail_len; - - if (!(buf = Xmalloc(XIM_HEADER_SIZE + len))) - goto free_detail_ptr; - - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - - buf_s[0] = im->private.proto.imid; - buf_s[1] = (INT16)name_len; - if (name_ptr) - (void)memcpy((char *)&buf_s[2], name_ptr, name_len); - XIM_SET_PAD(&buf_s[2], name_len); - buf_s = (CARD16 *)((char *)&buf_s[2] + name_len); - buf_s[0] = detail_len; - buf_s[1] = 0; - if (detail_ptr) - (void)memcpy((char *)&buf_s[2], detail_ptr, detail_len); - - _XimSetHeader((XPointer)buf, XIM_ENCODING_NEGOTIATION, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - Xfree(buf); - goto free_detail_ptr; - } - _XimFlush(im); - Xfree(buf); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimEncodingNegoCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimEncodingNegoCheck, 0); - if(ret_code != XIM_TRUE) - goto free_preply; - } - } else - goto free_detail_ptr; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - goto free_preply; - } - - if (!(_XimGetEncoding(im, &buf_s[1], name_ptr, name_len, - detail_ptr, detail_len))) - goto free_preply; - - Xfree(name_ptr); - Xfree(detail_ptr); - - if(reply != preply) - Xfree(preply); - - return True; - -free_preply: - if (reply != preply) - Xfree(preply); - -free_detail_ptr: - Xfree(detail_ptr); - -free_name_ptr: - Xfree(name_ptr); - - return False; -} - -#ifdef XIM_CONNECTABLE -static Bool -_XimSendSavedIMValues( - Xim im) -{ - XimDefIMValues im_values; - INT16 len; - CARD16 *buf_s; - char *tmp; - CARD32 tmp_buf32[BUFSIZE/4]; - char *tmp_buf = (char *)tmp_buf32; - char *buf; - int buf_size; - char *data; - int data_len; - int ret_len; - int total; - int idx; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int ret_code; - - _XimGetCurrentIMValues(im, &im_values); - buf = tmp_buf; - buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); - data_len = BUFSIZE - buf_size; - total = 0; - idx = 0; - for (;;) { - data = &buf[buf_size]; - if (!_XimEncodeSavedIMATTRIBUTE(im, im->core.im_resources, - im->core.im_num_resources, &idx, data, data_len, - &ret_len, (XPointer)&im_values, XIM_SETIMVALUES)) { - if (buf != tmp_buf) - Xfree(buf); - return False; - } - - total += ret_len; - if (idx == -1) { - break; - } - - buf_size += ret_len; - if (buf == tmp_buf) { - if (!(tmp = Xmalloc(buf_size + data_len))) { - return False; - } - memcpy(tmp, buf, buf_size); - buf = tmp; - } else { - if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { - Xfree(buf); - return False; - } - buf = tmp; - } - } - - if (!total) - return True; - - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - buf_s[0] = im->private.proto.imid; - buf_s[1] = (INT16)total; - - len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); - _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - if (buf != tmp_buf) - Xfree(buf); - return False; - } - _XimFlush(im); - if (buf != tmp_buf) - Xfree(buf); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimSetIMValuesCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = (int)len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, reply, buf_size, - _XimSetIMValuesCheck, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else - return False; - - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - - return True; -} - -static void -_XimDelayModeIMFree( - Xim im) -{ - if (im->core.im_resources) { - Xfree(im->core.im_resources); - im->core.im_resources = NULL; - } - if (im->core.ic_resources) { - Xfree(im->core.ic_resources); - im->core.ic_resources = NULL; - } - if (im->core.im_values_list) { - Xfree(im->core.im_values_list); - im->core.im_values_list = NULL; - } - if (im->core.ic_values_list) { - Xfree(im->core.ic_values_list); - im->core.ic_values_list = NULL; - } - return; -} - -Bool -_XimConnectServer( - Xim im) -{ - Xim save_im; - - if (!(save_im = Xmalloc(sizeof(XimRec)))) - return False; - memcpy((char *)save_im, (char *)im, sizeof(XimRec)); - - if (_XimPreConnect(im) && _XimConnection(im) - && _XimOpen(im) && _XimEncodingNegotiation(im)) { - if (_XimSendSavedIMValues(im)) { - _XimDelayModeIMFree(save_im); - _XimRegisterServerFilter(im); - Xfree(save_im); - return True; - } - } - memcpy((char *)im, (char *)save_im, sizeof(XimRec)); - Xfree(save_im); - return False; -} - -Bool -_XimDelayModeSetAttr( - Xim im) -{ - XimDefIMValues im_values; - - if(!_XimSetIMResourceList(&im->core.im_resources, - &im->core.im_num_resources)) { - return False; - } - if(!_XimSetICResourceList(&im->core.ic_resources, - &im->core.ic_num_resources)) { - return False; - } - - _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); - - _XimGetCurrentIMValues(im, &im_values); - if(!_XimSetLocalIMDefaults(im, (XPointer)&im_values, - im->core.im_resources, im->core.im_num_resources)) { - return False; - } - _XimSetCurrentIMValues(im, &im_values); - if (im->private.proto.default_styles) { - if (im->core.styles) - Xfree(im->core.styles); - im->core.styles = im->private.proto.default_styles; - } - - return True; -} - -static Bool -_XimReconnectModeSetAttr( - Xim im) -{ - XimDefIMValues im_values; - - if(!_XimSetIMResourceList(&im->core.im_resources, - &im->core.im_num_resources)) { - return False; - } - if(!_XimSetICResourceList(&im->core.ic_resources, - &im->core.ic_num_resources)) { - return False; - } - - _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); - - if (im->private.proto.default_styles) { - if (im->core.styles) - Xfree(im->core.styles); - im->core.styles = im->private.proto.default_styles; - } - - return True; -} -#endif /* XIM_CONNECTABLE */ - -Bool -_XimProtoOpenIM( - Xim im) -{ - _XimInitialResourceInfo(); - - im->methods = &im_methods; - -#ifdef XIM_CONNECTABLE - _XimSetProtoResource(im); -#endif /* XIM_CONNECTABLE */ - - if (_XimPreConnect(im)) { - if (_XimConnection(im) && _XimOpen(im) && _XimEncodingNegotiation(im)) { - _XimRegisterServerFilter(im); - return True; - } - _XimShutdown(im); -#ifdef XIM_CONNECTABLE - } else if (IS_DELAYBINDABLE(im)) { - if (_XimDelayModeSetAttr(im)) - return True; -#endif /* XIM_CONNECTABLE */ - } - _XimProtoIMFree(im); - return False; -} diff --git a/nx-X11/lib/X11/imDefLkup.c b/nx-X11/lib/X11/imDefLkup.c deleted file mode 100644 index af39008bc..000000000 --- a/nx-X11/lib/X11/imDefLkup.c +++ /dev/null @@ -1,1178 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -Xic -_XimICOfXICID( - Xim im, - XICID icid) -{ - Xic pic; - - for (pic = (Xic)im->core.ic_chain; pic; pic = (Xic)pic->core.next) { - if (pic->private.proto.icid == icid) - return pic; - } - return (Xic)0; -} - -static void -_XimProcIMSetEventMask( - Xim im, - XPointer buf) -{ - EVENTMASK *buf_l = (EVENTMASK *)buf; - - im->private.proto.forward_event_mask = buf_l[0]; - im->private.proto.synchronous_event_mask = buf_l[1]; - return; -} - -static void -_XimProcICSetEventMask( - Xic ic, - XPointer buf) -{ - EVENTMASK *buf_l = (EVENTMASK *)buf; - - ic->private.proto.forward_event_mask = buf_l[0]; - ic->private.proto.synchronous_event_mask = buf_l[1]; - _XimReregisterFilter(ic); - return; -} - -Bool -_XimSetEventMaskCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Xim im = (Xim)call_data; - Xic ic; - - if (imid == im->private.proto.imid) { - if (icid) { - ic = _XimICOfXICID(im, icid); - _XimProcICSetEventMask(ic, (XPointer)&buf_s[2]); - } else { - _XimProcIMSetEventMask(im, (XPointer)&buf_s[2]); - } - return True; - } - return False; -} - -static Bool -_XimSyncCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - - if ((major_opcode == XIM_SYNC_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - return True; - return False; -} - -Bool -_XimSync( - Xim im, - Xic ic) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_SYNC, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimSyncCheck, (XPointer)ic); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(len); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimSyncCheck, (XPointer)ic); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else { - return False; - } - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - return True; -} - -Bool -_XimProcSyncReply( - Xim im, - Xic ic) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16); /* sizeof icid */ - - _XimSetHeader((XPointer)buf, XIM_SYNC_REPLY, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - return True; -} - -Bool -_XimRespSyncReply( - Xic ic, - BITMASK16 mode) -{ - if (mode & XimSYNCHRONUS) /* SYNC Request */ - MARK_NEED_SYNC_REPLY(ic->core.im); - - return True; -} - -Bool -_XimSyncCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Xim im = (Xim)call_data; - Xic ic; - - if ((imid == im->private.proto.imid) - && (ic = _XimICOfXICID(im, icid))) { - (void)_XimProcSyncReply(im, ic); - return True; - } - return False; -} - -static INT16 -_XimSetEventToWire( - XEvent *ev, - xEvent *event) -{ - if (!(_XimProtoEventToWire(ev, event, False))) - return 0; - event->u.u.sequenceNumber = - ((XAnyEvent *)ev)->serial & (unsigned long)0xffff; - return sz_xEvent; -} - -static Bool -_XimForwardEventCore( - Xic ic, - XEvent *ev, - Bool sync) -{ - Xim im = (Xim)ic->core.im; - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - INT16 len; - - bzero(buf32, sizeof(buf32)); /* valgrind noticed uninitialized memory use! */ - - if (!(len = _XimSetEventToWire(ev, (xEvent *)&buf_s[4]))) - return False; /* X event */ - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ - buf_s[3] = - (CARD16)((((XAnyEvent *)ev)->serial & ~((unsigned long)0xffff)) >> 16); - /* serial number */ - - len += sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16) /* sizeof icid */ - + sizeof(BITMASK16) /* sizeof flag */ - + sizeof(CARD16); /* sizeof serila number */ - - _XimSetHeader((XPointer)buf, XIM_FORWARD_EVENT, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - - if (sync) { - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimSyncCheck, (XPointer)ic); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(len); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimSyncCheck, (XPointer)ic); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else { - return False; - } - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - } - return True; -} - -Bool -_XimForwardEvent( - Xic ic, - XEvent *ev, - Bool sync) -{ -#ifdef EXT_FORWARD - if (((ev->type == KeyPress) || (ev->type == KeyRelease))) - if (_XimExtForwardKeyEvent(ic, (XKeyEvent *)ev, sync)) - return True; -#endif - return _XimForwardEventCore(ic, ev, sync); -} - -static void -_XimProcEvent( - Display *d, - Xic ic, - XEvent *ev, - CARD16 *buf) -{ - INT16 serial = buf[0]; - xEvent *xev = (xEvent *)&buf[1]; - - _XimProtoWireToEvent(ev, xev, False); - ev->xany.serial |= serial << 16; - ev->xany.send_event = False; - ev->xany.display = d; - MARK_FABRICATED(ic->core.im); - return; -} - -static Bool -_XimForwardEventRecv( - Xim im, - Xic ic, - XPointer buf) -{ - CARD16 *buf_s = (CARD16 *)buf; - Display *d = im->core.display; - XEvent ev; - - _XimProcEvent(d, ic, &ev, &buf_s[1]); - - (void)_XimRespSyncReply(ic, buf_s[0]); - - XPutBackEvent(d, &ev); - - return True; -} - -Bool -_XimForwardEventCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Xim im = (Xim)call_data; - Xic ic; - - if ((imid == im->private.proto.imid) - && (ic = _XimICOfXICID(im, icid))) { - (void)_XimForwardEventRecv(im, ic, (XPointer)&buf_s[2]); - return True; - } - return False; -} - -static Bool -_XimRegisterTriggerkey( - Xim im, - XPointer buf) -{ - CARD32 *buf_l = (CARD32 *)buf; - CARD32 len; - CARD32 *key; - - if (IS_DYNAMIC_EVENT_FLOW(im)) /* already Dynamic event flow mode */ - return True; - - /* - * register onkeylist - */ - - len = buf_l[0]; /* length of on-keys */ - len += sizeof(INT32); /* sizeof length of on-keys */ - - if (!(key = Xmalloc(len))) { - _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); - return False; - } - memcpy((char *)key, (char *)buf_l, len); - im->private.proto.im_onkeylist = key; - - MARK_DYNAMIC_EVENT_FLOW(im); - - /* - * register offkeylist - */ - - buf_l = (CARD32 *)((char *)buf + len); - len = buf_l[0]; /* length of off-keys */ - len += sizeof(INT32); /* sizeof length of off-keys */ - - if (!(key = Xmalloc(len))) { - _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); - return False; - } - - memcpy((char *)key, (char *)buf_l, len); - im->private.proto.im_offkeylist = key; - - return True; -} - -Bool -_XimRegisterTriggerKeysCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - Xim im = (Xim)call_data; - - (void )_XimRegisterTriggerkey(im, (XPointer)&buf_s[2]); - return True; -} - -EVENTMASK -_XimGetWindowEventmask( - Xic ic) -{ - Xim im = (Xim )ic->core.im; - XWindowAttributes atr; - - if (!XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr)) - return 0; - return (EVENTMASK)atr.your_event_mask; -} - - -static Bool -_XimTriggerNotifyCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - - if ((major_opcode == XIM_TRIGGER_NOTIFY_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - return True; - return False; -} - -Bool -_XimTriggerNotify( - Xim im, - Xic ic, - int mode, - CARD32 idx) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - CARD32 *buf_l = (CARD32 *)&buf[XIM_HEADER_SIZE]; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - INT16 len; - EVENTMASK mask = _XimGetWindowEventmask(ic); - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - buf_l[1] = mode; /* flag */ - buf_l[2] = idx; /* index of keys list */ - buf_l[3] = mask; /* select-event-mask */ - - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16) /* sizeof icid */ - + sizeof(CARD32) /* sizeof flag */ - + sizeof(CARD32) /* sizeof index of key list */ - + sizeof(EVENTMASK); /* sizeof select-event-mask */ - - _XimSetHeader((XPointer)buf, XIM_TRIGGER_NOTIFY, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimTriggerNotifyCheck, (XPointer)ic); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(len); - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimTriggerNotifyCheck, (XPointer)ic); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else { - return False; - } - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - return True; -} - -static Bool -_XimRegCommitInfo( - Xic ic, - char *string, - int string_len, - KeySym *keysym, - int keysym_len) -{ - XimCommitInfo info; - - if (!(info = Xmalloc(sizeof(XimCommitInfoRec)))) - return False; - info->string = string; - info->string_len = string_len; - info->keysym = keysym; - info->keysym_len = keysym_len; - info->next = ic->private.proto.commit_info; - ic->private.proto.commit_info = info; - return True; -} - -static void -_XimUnregCommitInfo( - Xic ic) -{ - XimCommitInfo info; - - if (!(info = ic->private.proto.commit_info)) - return; - - - Xfree(info->string); - Xfree(info->keysym); - ic->private.proto.commit_info = info->next; - Xfree(info); - return; -} - -void -_XimFreeCommitInfo( - Xic ic) -{ - while (ic->private.proto.commit_info) - _XimUnregCommitInfo(ic); - return; -} - -static Bool -_XimProcKeySym( - Xic ic, - CARD32 sym, - KeySym **xim_keysym, - int *xim_keysym_len) -{ - Xim im = (Xim)ic->core.im; - - if (!(*xim_keysym = Xmalloc(sizeof(KeySym)))) { - _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); - return False; - } - - **xim_keysym = (KeySym)sym; - *xim_keysym_len = 1; - - return True; -} - -static Bool -_XimProcCommit( - Xic ic, - BYTE *buf, - int len, - char **xim_string, - int *xim_string_len) -{ - Xim im = (Xim)ic->core.im; - char *string; - - if (!(string = Xmalloc(len + 1))) { - _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); - return False; - } - - (void)memcpy(string, (char *)buf, len); - string[len] = '\0'; - - *xim_string = string; - *xim_string_len = len; - return True; -} - -static Bool -_XimCommitRecv( - Xim im, - Xic ic, - XPointer buf) -{ - CARD16 *buf_s = (CARD16 *)buf; - BITMASK16 flag = buf_s[0]; - XKeyEvent ev; - char *string = NULL; - int string_len = 0; - KeySym *keysym = NULL; - int keysym_len = 0; - - if ((flag & XimLookupBoth) == XimLookupChars) { - if (!(_XimProcCommit(ic, (BYTE *)&buf_s[2], - (int)buf_s[1], &string, &string_len))) - return False; - - } else if ((flag & XimLookupBoth) == XimLookupKeySym) { - if (!(_XimProcKeySym(ic, *(CARD32 *)&buf_s[2], &keysym, &keysym_len))) - return False; - - } else if ((flag & XimLookupBoth) == XimLookupBoth) { - if (!(_XimProcKeySym(ic, *(CARD32 *)&buf_s[2], &keysym, &keysym_len))) - return False; - - if (!(_XimProcCommit(ic, (BYTE *)&buf_s[5], - (int)buf_s[4], &string, &string_len))) { - Xfree(keysym); - return False; - } - } - - if (!(_XimRegCommitInfo(ic, string, string_len, keysym, keysym_len))) { - Xfree(string); - Xfree(keysym); - _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); - return False; - } - - (void)_XimRespSyncReply(ic, flag); - - if (ic->private.proto.registed_filter_event - & (KEYPRESS_MASK | KEYRELEASE_MASK)) - MARK_FABRICATED(im); - - bzero(&ev, sizeof(ev)); /* uninitialized : found when running kterm under valgrind */ - - ev.type = KeyPress; - ev.send_event = False; - ev.display = im->core.display; - ev.window = ic->core.focus_window; - ev.keycode = 0; - ev.state = 0; - - ev.time = 0L; - ev.serial = LastKnownRequestProcessed(im->core.display); - /* FIXME : - I wish there were COMMENTs (!) about the data passed around. - */ -#if 0 - fprintf(stderr,"%s,%d: putback k press FIXED ev.time=0 ev.serial=%lu\n", __FILE__, __LINE__, ev.serial); -#endif - - XPutBackEvent(im->core.display, (XEvent *)&ev); - - return True; -} - -Bool -_XimCommitCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Xim im = (Xim)call_data; - Xic ic; - - if ((imid == im->private.proto.imid) - && (ic = _XimICOfXICID(im, icid))) { - (void)_XimCommitRecv(im, ic, (XPointer)&buf_s[2]); - return True; - } - return False; -} - -void -_XimProcError( - Xim im, - Xic ic, - XPointer data) -{ - return; -} - -Bool -_XimErrorCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - BITMASK16 flag = buf_s[2]; - XIMID imid; - XICID icid; - Xim im = (Xim)call_data; - Xic ic = NULL; - - if (flag & XIM_IMID_VALID) { - imid = buf_s[0]; - if (imid != im->private.proto.imid) - return False; - } - if (flag & XIM_ICID_VALID) { - icid = buf_s[1]; - if (!(ic = _XimICOfXICID(im, icid))) - return False; - } - _XimProcError(im, ic, (XPointer)&buf_s[3]); - - return True; -} - -Bool -_XimError( - Xim im, - Xic ic, - CARD16 error_code, - INT16 detail_length, - CARD16 type, - char *detail) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len = 0; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[2] = XIM_IMID_VALID; /* flag */ - if (ic) { - buf_s[1] = ic->private.proto.icid; /* icid */ - buf_s[2] |= XIM_ICID_VALID; /* flag */ - } - buf_s[3] = error_code; /* Error Code */ - buf_s[4] = detail_length; /* length of error detail */ - buf_s[5] = type; /* type of error detail */ - - if (detail_length && detail) { - len = detail_length; - memcpy((char *)&buf_s[6], detail, len); - XIM_SET_PAD(&buf_s[6], len); - } - - len += sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16) /* sizeof icid */ - + sizeof(BITMASK16) /* sizeof flag */ - + sizeof(CARD16) /* sizeof error_code */ - + sizeof(INT16) /* sizeof length of detail */ - + sizeof(CARD16); /* sizeof type */ - - _XimSetHeader((XPointer)buf, XIM_ERROR, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - return True; -} - -static int -_Ximctsconvert( - XlcConv conv, - char *from, - int from_len, - char *to, - int to_len, - Status *state) -{ - int from_left; - int to_left; - int from_savelen; - int to_savelen; - int from_cnvlen; - int to_cnvlen; - char *from_buf; - char *to_buf; - char scratchbuf[BUFSIZ]; - Status tmp_state; - - if (!state) - state = &tmp_state; - - if (!conv || !from || !from_len) { - *state = XLookupNone; - return 0; - } - - /* Reset the converter. The CompoundText at 'from' starts in - initial state. */ - _XlcResetConverter(conv); - - from_left = from_len; - to_left = BUFSIZ; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_buf = &from[from_cnvlen]; - from_savelen = from_left; - to_buf = &scratchbuf[to_cnvlen]; - to_savelen = to_left; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (!to_cnvlen) { - *state = XLookupNone; - return 0; - } - break; - } - } - - if (!to || !to_len || (to_len < to_cnvlen)) { - *state = XBufferOverflow; - } else { - memcpy(to, scratchbuf, to_cnvlen); - *state = XLookupChars; - } - return to_cnvlen; -} - -int -_Ximctstombs(XIM xim, char *from, int from_len, - char *to, int to_len, Status *state) -{ - return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv, - from, from_len, to, to_len, state); -} - -int -_Ximctstowcs( - XIM xim, - char *from, - int from_len, - wchar_t *to, - int to_len, - Status *state) -{ - Xim im = (Xim)xim; - XlcConv conv = im->private.proto.ctow_conv; - int from_left; - int to_left; - int from_savelen; - int to_savelen; - int from_cnvlen; - int to_cnvlen; - char *from_buf; - wchar_t *to_buf; - wchar_t scratchbuf[BUFSIZ]; - Status tmp_state; - - if (!state) - state = &tmp_state; - - if (!conv || !from || !from_len) { - *state = XLookupNone; - return 0; - } - - /* Reset the converter. The CompoundText at 'from' starts in - initial state. */ - _XlcResetConverter(conv); - - from_left = from_len; - to_left = BUFSIZ; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_buf = &from[from_cnvlen]; - from_savelen = from_left; - to_buf = &scratchbuf[to_cnvlen]; - to_savelen = to_left; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (!to_cnvlen){ - *state = XLookupNone; - return 0; - } - break; - } - } - - if (!to || !to_len || (to_len < to_cnvlen)) { - *state = XBufferOverflow; - } else { - memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); - *state = XLookupChars; - } - return to_cnvlen; -} - -int -_Ximctstoutf8( - XIM xim, - char *from, - int from_len, - char *to, - int to_len, - Status *state) -{ - return _Ximctsconvert(((Xim)xim)->private.proto.ctoutf8_conv, - from, from_len, to, to_len, state); -} - -int -_XimProtoMbLookupString( - XIC xic, - XKeyEvent *ev, - char *buffer, - int bytes, - KeySym *keysym, - Status *state) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - int ret; - Status tmp_state; - XimCommitInfo info; - - if (!IS_SERVER_CONNECTED(im)) - return 0; - - if (!state) - state = &tmp_state; - - if ((ev->type == KeyPress) && (ev->keycode == 0)) { /* Filter function */ - if (!(info = ic->private.proto.commit_info)) { - *state = XLookupNone; - return 0; - } - - ret = im->methods->ctstombs((XIM)im, info->string, - info->string_len, buffer, bytes, state); - if (*state == XBufferOverflow) - return ret; - if (keysym && (info->keysym && *(info->keysym))) { - *keysym = *(info->keysym); - if (*state == XLookupChars) - *state = XLookupBoth; - else - *state = XLookupKeySym; - } - _XimUnregCommitInfo(ic); - - } else if (ev->type == KeyPress) { - ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); - if (ret > 0) { - if (ret > bytes) - *state = XBufferOverflow; - else if (keysym && *keysym != NoSymbol) - *state = XLookupBoth; - else - *state = XLookupChars; - } else { - if (keysym && *keysym != NoSymbol) - *state = XLookupKeySym; - else - *state = XLookupNone; - } - } else { - *state = XLookupNone; - ret = 0; - } - - return ret; -} - -int -_XimProtoWcLookupString( - XIC xic, - XKeyEvent *ev, - wchar_t *buffer, - int bytes, - KeySym *keysym, - Status *state) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - int ret; - Status tmp_state; - XimCommitInfo info; - - if (!IS_SERVER_CONNECTED(im)) - return 0; - - if (!state) - state = &tmp_state; - - if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ - if (!(info = ic->private.proto.commit_info)) { - *state = XLookupNone; - return 0; - } - - ret = im->methods->ctstowcs((XIM)im, info->string, - info->string_len, buffer, bytes, state); - if (*state == XBufferOverflow) - return ret; - if (keysym && (info->keysym && *(info->keysym))) { - *keysym = *(info->keysym); - if (*state == XLookupChars) - *state = XLookupBoth; - else - *state = XLookupKeySym; - } - _XimUnregCommitInfo(ic); - - } else if (ev->type == KeyPress) { - ret = _XimLookupWCText(ic, ev, buffer, bytes, keysym, NULL); - if (ret > 0) { - if (ret > bytes) - *state = XBufferOverflow; - else if (keysym && *keysym != NoSymbol) - *state = XLookupBoth; - else - *state = XLookupChars; - } else { - if (keysym && *keysym != NoSymbol) - *state = XLookupKeySym; - else - *state = XLookupNone; - } - } else { - *state = XLookupNone; - ret = 0; - } - - return ret; -} - -int -_XimProtoUtf8LookupString( - XIC xic, - XKeyEvent *ev, - char *buffer, - int bytes, - KeySym *keysym, - Status *state) -{ - Xic ic = (Xic)xic; - Xim im = (Xim)ic->core.im; - int ret; - Status tmp_state; - XimCommitInfo info; - - if (!IS_SERVER_CONNECTED(im)) - return 0; - - if (!state) - state = &tmp_state; - - if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ - if (!(info = ic->private.proto.commit_info)) { - *state = XLookupNone; - return 0; - } - - ret = im->methods->ctstoutf8((XIM)im, info->string, - info->string_len, buffer, bytes, state); - if (*state == XBufferOverflow) - return ret; - if (keysym && (info->keysym && *(info->keysym))) { - *keysym = *(info->keysym); - if (*state == XLookupChars) - *state = XLookupBoth; - else - *state = XLookupKeySym; - } - _XimUnregCommitInfo(ic); - - } else if (ev->type == KeyPress) { - ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); - if (ret > 0) { - if (ret > bytes) - *state = XBufferOverflow; - else if (keysym && *keysym != NoSymbol) - *state = XLookupBoth; - else - *state = XLookupChars; - } else { - if (keysym && *keysym != NoSymbol) - *state = XLookupKeySym; - else - *state = XLookupNone; - } - } else { - *state = XLookupNone; - ret = 0; - } - - return ret; -} diff --git a/nx-X11/lib/X11/imDispch.c b/nx-X11/lib/X11/imDispch.c deleted file mode 100644 index 862a9b651..000000000 --- a/nx-X11/lib/X11/imDispch.c +++ /dev/null @@ -1,104 +0,0 @@ -/****************************************************************** - - Copyright 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xutil.h" -#include "Xlcint.h" -#include "Ximint.h" - - -Bool -_XimRegProtoIntrCallback( - Xim im, - CARD16 major_code, - CARD16 minor_code, - Bool (*proc)( - Xim, INT16, XPointer, XPointer - ), - - XPointer call_data) -{ - XimProtoIntrRec *rec; - - if (!(rec = Xmalloc(sizeof(XimProtoIntrRec)))) - return False; - rec->func = proc; - rec->major_code = major_code; - rec->minor_code = minor_code; - rec->call_data = call_data; - rec->next = im->private.proto.intrproto; - im->private.proto.intrproto = rec; - return True; -} - -void -_XimFreeProtoIntrCallback(Xim im) -{ - register XimProtoIntrRec *rec, *next; - - for (rec = im->private.proto.intrproto; rec;) { - next = rec->next; - Xfree(rec); - rec = next; - } - im->private.proto.intrproto = NULL; - return; -} - -static Bool -_XimTransportIntr( - Xim im, - INT16 len, - XPointer data, - XPointer call_data) -{ - Xim call_im = (Xim)call_data; - XimProtoIntrRec *rec = call_im->private.proto.intrproto; - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - - for (; rec; rec = rec->next) { - if ((major_opcode == (CARD8)rec->major_code) - && (minor_opcode == (CARD8)rec->minor_code)) - if ((*rec->func)(call_im, len, data, rec->call_data)) - return True; - } - return False; -} - -Bool -_XimDispatchInit(Xim im) -{ - if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im)) - return True; - return False; -} diff --git a/nx-X11/lib/X11/imEvToWire.c b/nx-X11/lib/X11/imEvToWire.c deleted file mode 100644 index 45677c461..000000000 --- a/nx-X11/lib/X11/imEvToWire.c +++ /dev/null @@ -1,788 +0,0 @@ -/*********************************************************** -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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Ximint.h" - - -#define sw16(n, s) ((s) ? \ - (((n) << 8 & 0xff00) | \ - ((n) >> 8 & 0xff) \ - ) : n) - -#define sw32(n, s) ((s) ? \ - (((n) << 24 & 0xff000000) | \ - ((n) << 8 & 0xff0000) | \ - ((n) >> 8 & 0xff00) | \ - ((n) >> 24 & 0xff) \ - ) : n) - -Status -_XimProtoEventToWire( - register XEvent *re, /* pointer to where event should be reformatted */ - register xEvent *event, /* wire protocol event */ - Bool sw) /* swap byte? */ -{ - switch (event->u.u.type = re->type) { - case KeyPress: - case KeyRelease: - { - register XKeyEvent *ev = (XKeyEvent*) re; - event->u.keyButtonPointer.root = sw32(ev->root, sw); - event->u.keyButtonPointer.event = - sw32(ev->window, sw); - event->u.keyButtonPointer.child = - sw32(ev->subwindow, sw); - event->u.keyButtonPointer.time = sw32(ev->time, sw); - event->u.keyButtonPointer.eventX = sw16(ev->x, sw) ; - event->u.keyButtonPointer.eventY = sw16(ev->y, sw) ; - event->u.keyButtonPointer.rootX = - sw16(ev->x_root, sw); - event->u.keyButtonPointer.rootY = - sw16(ev->y_root, sw); - event->u.keyButtonPointer.state = sw16(ev->state, sw); - event->u.keyButtonPointer.sameScreen = ev->same_screen; - event->u.u.detail = ev->keycode; - } - break; - case ButtonPress: - case ButtonRelease: - { - register XButtonEvent *ev = (XButtonEvent *) re; - event->u.keyButtonPointer.root = sw32(ev->root, sw); - event->u.keyButtonPointer.event = sw32(ev->window, sw); - event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); - event->u.keyButtonPointer.time = sw32(ev->time, sw); - event->u.keyButtonPointer.eventX = sw16(ev->x, sw); - event->u.keyButtonPointer.eventY = sw16(ev->y, sw); - event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); - event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); - event->u.keyButtonPointer.state = sw16(ev->state, sw); - event->u.keyButtonPointer.sameScreen = ev->same_screen; - event->u.u.detail = ev->button; - } - break; - case MotionNotify: - { - register XMotionEvent *ev = (XMotionEvent *)re; - event->u.keyButtonPointer.root = sw32(ev->root, sw); - event->u.keyButtonPointer.event = sw32(ev->window, sw); - event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); - event->u.keyButtonPointer.time = sw32(ev->time, sw); - event->u.keyButtonPointer.eventX= sw16(ev->x, sw); - event->u.keyButtonPointer.eventY= sw16(ev->y, sw); - event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); - event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); - event->u.keyButtonPointer.state = sw16(ev->state, sw); - event->u.keyButtonPointer.sameScreen= ev->same_screen; - event->u.u.detail = ev->is_hint; - } - break; - case EnterNotify: - case LeaveNotify: - { - register XCrossingEvent *ev = (XCrossingEvent *) re; - event->u.enterLeave.root = sw32(ev->root, sw); - event->u.enterLeave.event = sw32(ev->window, sw); - event->u.enterLeave.child = sw32(ev->subwindow, sw); - event->u.enterLeave.time = sw32(ev->time, sw); - event->u.enterLeave.eventX = sw16(ev->x, sw); - event->u.enterLeave.eventY = sw16(ev->y, sw); - event->u.enterLeave.rootX = sw16(ev->x_root, sw); - event->u.enterLeave.rootY = sw16(ev->y_root, sw); - event->u.enterLeave.state = sw16(ev->state, sw); - event->u.enterLeave.mode = ev->mode; - event->u.enterLeave.flags = 0; - if (ev->same_screen) { - event->u.enterLeave.flags |= ELFlagSameScreen; - } - if (ev->focus) { - event->u.enterLeave.flags |= ELFlagFocus; - } - event->u.u.detail = ev->detail; - } - break; - case FocusIn: - case FocusOut: - { - register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; - event->u.focus.window = sw32(ev->window, sw); - event->u.focus.mode = ev->mode; - event->u.u.detail = ev->detail; - } - break; - case KeymapNotify: - { - register XKeymapEvent *ev = (XKeymapEvent *) re; - memcpy((char *)(((xKeymapEvent *) event)->map), - &ev->key_vector[1], - sizeof (((xKeymapEvent *) event)->map)); - } - break; - case Expose: - { - register XExposeEvent *ev = (XExposeEvent *) re; - event->u.expose.window = sw32(ev->window, sw); - event->u.expose.x = sw16(ev->x, sw); - event->u.expose.y = sw16(ev->y, sw); - event->u.expose.width = sw16(ev->width, sw); - event->u.expose.height = sw16(ev->height, sw); - event->u.expose.count = sw16(ev->count, sw); - } - break; - case GraphicsExpose: - { - register XGraphicsExposeEvent *ev = - (XGraphicsExposeEvent *) re; - event->u.graphicsExposure.drawable = sw32(ev->drawable, sw); - event->u.graphicsExposure.x = sw16(ev->x, sw); - event->u.graphicsExposure.y = sw16(ev->y, sw); - event->u.graphicsExposure.width = sw16(ev->width, sw); - event->u.graphicsExposure.height = sw16(ev->height, sw); - event->u.graphicsExposure.count = sw16(ev->count, sw); - event->u.graphicsExposure.majorEvent= ev->major_code; - event->u.graphicsExposure.minorEvent= sw16(ev->minor_code, sw); - } - break; - case NoExpose: - { - register XNoExposeEvent *ev = (XNoExposeEvent *) re; - event->u.noExposure.drawable = sw32(ev->drawable, sw); - event->u.noExposure.majorEvent = ev->major_code; - event->u.noExposure.minorEvent = sw16(ev->minor_code, sw); - } - break; - case VisibilityNotify: - { - register XVisibilityEvent *ev = (XVisibilityEvent *) re; - event->u.visibility.window = sw32(ev->window, sw); - event->u.visibility.state = ev->state; - } - break; - case CreateNotify: - { - register XCreateWindowEvent *ev = - (XCreateWindowEvent *) re; - event->u.createNotify.window = sw32(ev->window, sw); - event->u.createNotify.parent = sw32(ev->parent, sw); - event->u.createNotify.x = sw16(ev->x, sw); - event->u.createNotify.y = sw16(ev->y, sw); - event->u.createNotify.width = sw16(ev->width, sw); - event->u.createNotify.height = sw16(ev->height, sw); - event->u.createNotify.borderWidth = sw16(ev->border_width, sw); - event->u.createNotify.override = ev->override_redirect; - } - break; - case DestroyNotify: - { - register XDestroyWindowEvent *ev = - (XDestroyWindowEvent *) re; - event->u.destroyNotify.window = sw32(ev->window, sw); - event->u.destroyNotify.event = sw32(ev->event, sw); - } - break; - case UnmapNotify: - { - register XUnmapEvent *ev = (XUnmapEvent *) re; - event->u.unmapNotify.window = sw32(ev->window, sw); - event->u.unmapNotify.event = sw32(ev->event, sw); - event->u.unmapNotify.fromConfigure = ev->from_configure; - } - break; - case MapNotify: - { - register XMapEvent *ev = (XMapEvent *) re; - event->u.mapNotify.window = sw32(ev->window, sw); - event->u.mapNotify.event = sw32(ev->event, sw); - event->u.mapNotify.override = ev->override_redirect; - } - break; - case MapRequest: - { - register XMapRequestEvent *ev = (XMapRequestEvent *) re; - event->u.mapRequest.window = sw32(ev->window, sw); - event->u.mapRequest.parent = sw32(ev->parent, sw); - } - break; - case ReparentNotify: - { - register XReparentEvent *ev = (XReparentEvent *) re; - event->u.reparent.window = sw32(ev->window, sw); - event->u.reparent.event = sw32(ev->event, sw); - event->u.reparent.parent = sw32(ev->parent, sw); - event->u.reparent.x = sw16(ev->x, sw); - event->u.reparent.y = sw16(ev->y, sw); - event->u.reparent.override = ev->override_redirect; - } - break; - case ConfigureNotify: - { - register XConfigureEvent *ev = (XConfigureEvent *) re; - event->u.configureNotify.window = sw32(ev->window, sw); - event->u.configureNotify.event = sw32(ev->event, sw); - event->u.configureNotify.aboveSibling = sw32(ev->above, sw); - event->u.configureNotify.x = sw16(ev->x, sw); - event->u.configureNotify.y = sw16(ev->y, sw); - event->u.configureNotify.width = sw16(ev->width, sw); - event->u.configureNotify.height = sw16(ev->height, sw); - event->u.configureNotify.borderWidth= sw16(ev->border_width, sw); - event->u.configureNotify.override = ev->override_redirect; - } - break; - case ConfigureRequest: - { - register XConfigureRequestEvent *ev = - (XConfigureRequestEvent *) re; - event->u.configureRequest.window = sw32(ev->window, sw); - event->u.configureRequest.parent = sw32(ev->parent, sw); - event->u.configureRequest.sibling = sw32(ev->above, sw); - event->u.configureRequest.x = sw16(ev->x, sw); - event->u.configureRequest.y = sw16(ev->y, sw); - event->u.configureRequest.width = sw16(ev->width, sw); - event->u.configureRequest.height = sw16(ev->height, sw); - event->u.configureRequest.borderWidth= sw16(ev->border_width, sw); - event->u.configureRequest.valueMask= sw16(ev->value_mask, sw); - event->u.u.detail = ev->detail; - } - break; - case GravityNotify: - { - register XGravityEvent *ev = (XGravityEvent *) re; - event->u.gravity.window = sw32(ev->window, sw); - event->u.gravity.event = sw32(ev->event, sw); - event->u.gravity.x = sw16(ev->x, sw); - event->u.gravity.y = sw16(ev->y, sw); - } - break; - case ResizeRequest: - { - register XResizeRequestEvent *ev = - (XResizeRequestEvent *) re; - event->u.resizeRequest.window = sw32(ev->window, sw); - event->u.resizeRequest.width = sw16(ev->width, sw); - event->u.resizeRequest.height = sw16(ev->height, sw); - } - break; - case CirculateNotify: - { - register XCirculateEvent *ev = (XCirculateEvent *) re; - event->u.circulate.window = sw32(ev->window, sw); - event->u.circulate.event = sw32(ev->event, sw); - event->u.circulate.place = ev->place; - } - break; - case CirculateRequest: - { - register XCirculateRequestEvent *ev = - (XCirculateRequestEvent *) re; - event->u.circulate.window = sw32(ev->window, sw); - event->u.circulate.event = sw32(ev->parent, sw); - event->u.circulate.place = ev->place; - } - break; - case PropertyNotify: - { - register XPropertyEvent *ev = (XPropertyEvent *) re; - event->u.property.window = sw32(ev->window, sw); - event->u.property.atom = sw32(ev->atom, sw); - event->u.property.time = sw32(ev->time, sw); - event->u.property.state = ev->state; - } - break; - case SelectionClear: - { - register XSelectionClearEvent *ev = - (XSelectionClearEvent *) re; - event->u.selectionClear.window = sw32(ev->window, sw); - event->u.selectionClear.atom = sw32(ev->selection, sw); - event->u.selectionClear.time = sw32(ev->time, sw); - } - break; - case SelectionRequest: - { - register XSelectionRequestEvent *ev = - (XSelectionRequestEvent *) re; - event->u.selectionRequest.owner = sw32(ev->owner, sw); - event->u.selectionRequest.requestor = sw32(ev->requestor, sw); - event->u.selectionRequest.selection = sw32(ev->selection, sw); - event->u.selectionRequest.target = sw32(ev->target, sw); - event->u.selectionRequest.property = sw32(ev->property, sw); - event->u.selectionRequest.time = sw32(ev->time, sw); - } - break; - case SelectionNotify: - { - register XSelectionEvent *ev = (XSelectionEvent *) re; - event->u.selectionNotify.requestor = sw32(ev->requestor, sw); - event->u.selectionNotify.selection = sw32(ev->selection, sw); - event->u.selectionNotify.target = sw32(ev->target, sw); - event->u.selectionNotify.property = sw32(ev->property, sw); - event->u.selectionNotify.time = sw32(ev->time, sw); - } - break; - case ColormapNotify: - { - register XColormapEvent *ev = (XColormapEvent *) re; - event->u.colormap.window = sw32(ev->window, sw); - event->u.colormap.colormap = sw32(ev->colormap, sw); - event->u.colormap.new = ev->new; - event->u.colormap.state = ev->state; - } - break; - case ClientMessage: - { - register int i; - register XClientMessageEvent *ev - = (XClientMessageEvent *) re; - event->u.clientMessage.window = sw32(ev->window, sw); - event->u.u.detail = ev->format; - switch (ev->format) { - case 8: - event->u.clientMessage.u.b.type = sw32(ev->message_type, sw); - for (i = 0; i < 20; i++) - event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; - break; - case 16: - event->u.clientMessage.u.s.type = sw32(ev->message_type, sw); - event->u.clientMessage.u.s.shorts0 = sw16(ev->data.s[0], sw); - event->u.clientMessage.u.s.shorts1 = sw16(ev->data.s[1], sw); - event->u.clientMessage.u.s.shorts2 = sw16(ev->data.s[2], sw); - event->u.clientMessage.u.s.shorts3 = sw16(ev->data.s[3], sw); - event->u.clientMessage.u.s.shorts4 = sw16(ev->data.s[4], sw); - event->u.clientMessage.u.s.shorts5 = sw16(ev->data.s[5], sw); - event->u.clientMessage.u.s.shorts6 = sw16(ev->data.s[6], sw); - event->u.clientMessage.u.s.shorts7 = sw16(ev->data.s[7], sw); - event->u.clientMessage.u.s.shorts8 = sw16(ev->data.s[8], sw); - event->u.clientMessage.u.s.shorts9 = sw16(ev->data.s[9], sw); - break; - case 32: - event->u.clientMessage.u.l.type = sw32(ev->message_type, sw); - event->u.clientMessage.u.l.longs0 = sw32(ev->data.l[0], sw); - event->u.clientMessage.u.l.longs1 = sw32(ev->data.l[1], sw); - event->u.clientMessage.u.l.longs2 = sw32(ev->data.l[2], sw); - event->u.clientMessage.u.l.longs3 = sw32(ev->data.l[3], sw); - event->u.clientMessage.u.l.longs4 = sw32(ev->data.l[4], sw); - break; - default: - /* client passing bogus data, let server complain */ - break; - } - } - break; - case MappingNotify: - { - register XMappingEvent *ev = (XMappingEvent *) re; - event->u.mappingNotify.firstKeyCode = ev->first_keycode; - event->u.mappingNotify.request = ev->request; - event->u.mappingNotify.count = ev->count; - } - break; - - default: - return(0); - } - /* Common process */ - if (((XAnyEvent *)re)->send_event) - event->u.u.type |= 0x80; - event->u.u.sequenceNumber = - ((XAnyEvent *)re)->serial & ~((unsigned long)0xffff); - event->u.u.sequenceNumber = sw16(event->u.u.sequenceNumber, sw); - return(1); -} - - -/* - * reformat a wire event into an XEvent structure of the right type. - */ -Bool -_XimProtoWireToEvent( - register XEvent *re, /* pointer to where event should be reformatted */ - register xEvent *event, /* wire protocol event */ - Bool sw) /* swap byte? */ -{ - - re->type = event->u.u.type & 0x7f; - ((XAnyEvent *)re)->serial = sw16(event->u.u.sequenceNumber, sw); - ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); - ((XAnyEvent *)re)->display = NULL; - - /* Ignore the leading bit of the event type since it is set when a - client sends an event rather than the server. */ - - switch (event-> u.u.type & 0177) { - case KeyPress: - case KeyRelease: - { - register XKeyEvent *ev = (XKeyEvent*) re; - ev->root = sw32(event->u.keyButtonPointer.root, sw); - ev->window = sw32(event->u.keyButtonPointer.event, sw); - ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); - ev->time = sw32(event->u.keyButtonPointer.time, sw); - ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); - ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); - ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); - ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); - ev->state = sw16(event->u.keyButtonPointer.state, sw); - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->keycode = event->u.u.detail; - } - break; - case ButtonPress: - case ButtonRelease: - { - register XButtonEvent *ev = (XButtonEvent *) re; - ev->root = sw32(event->u.keyButtonPointer.root, sw); - ev->window = sw32(event->u.keyButtonPointer.event, sw); - ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); - ev->time = sw32(event->u.keyButtonPointer.time, sw); - ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); - ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); - ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); - ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); - ev->state = sw16(event->u.keyButtonPointer.state, sw); - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->button = event->u.u.detail; - } - break; - case MotionNotify: - { - register XMotionEvent *ev = (XMotionEvent *)re; - ev->root = sw32(event->u.keyButtonPointer.root, sw); - ev->window = sw32(event->u.keyButtonPointer.event, sw); - ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); - ev->time = sw32(event->u.keyButtonPointer.time, sw); - ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); - ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); - ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); - ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); - ev->state = sw16(event->u.keyButtonPointer.state, sw); - ev->same_screen = event->u.keyButtonPointer.sameScreen; - ev->is_hint = event->u.u.detail; - } - break; - case EnterNotify: - case LeaveNotify: - { - register XCrossingEvent *ev = (XCrossingEvent *) re; - ev->root = sw32(event->u.enterLeave.root, sw); - ev->window = sw32(event->u.enterLeave.event, sw); - ev->subwindow = sw32(event->u.enterLeave.child, sw); - ev->time = sw32(event->u.enterLeave.time, sw); - ev->x = cvtINT16toInt(sw16(event->u.enterLeave.eventX, sw)); - ev->y = cvtINT16toInt(sw16(event->u.enterLeave.eventY, sw)); - ev->x_root = cvtINT16toInt(sw16(event->u.enterLeave.rootX, sw)); - ev->y_root = cvtINT16toInt(sw16(event->u.enterLeave.rootY, sw)); - ev->state = sw16(event->u.enterLeave.state, sw); - ev->mode = event->u.enterLeave.mode; - ev->same_screen = (event->u.enterLeave.flags & - ELFlagSameScreen) && True; - ev->focus = (event->u.enterLeave.flags & - ELFlagFocus) && True; - ev->detail = event->u.u.detail; - } - break; - case FocusIn: - case FocusOut: - { - register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; - ev->window = sw32(event->u.focus.window, sw); - ev->mode = event->u.focus.mode; - ev->detail = event->u.u.detail; - } - break; - case KeymapNotify: - { - register XKeymapEvent *ev = (XKeymapEvent *) re; - ev->window = None; - memcpy(&ev->key_vector[1], - (char *)((xKeymapEvent *) event)->map, - sizeof (((xKeymapEvent *) event)->map)); - } - break; - case Expose: - { - register XExposeEvent *ev = (XExposeEvent *) re; - ev->window = sw32(event->u.expose.window, sw); - ev->x = sw16(event->u.expose.x, sw); - ev->y = sw16(event->u.expose.y, sw); - ev->width = sw16(event->u.expose.width, sw); - ev->height = sw16(event->u.expose.height, sw); - ev->count = sw16(event->u.expose.count, sw); - } - break; - case GraphicsExpose: - { - register XGraphicsExposeEvent *ev = - (XGraphicsExposeEvent *) re; - ev->drawable = sw32(event->u.graphicsExposure.drawable, sw); - ev->x = sw16(event->u.graphicsExposure.x, sw); - ev->y = sw16(event->u.graphicsExposure.y, sw); - ev->width = sw16(event->u.graphicsExposure.width, sw); - ev->height = sw16(event->u.graphicsExposure.height, sw); - ev->count = sw16(event->u.graphicsExposure.count, sw); - ev->major_code = event->u.graphicsExposure.majorEvent; - ev->minor_code = sw16(event->u.graphicsExposure.minorEvent, sw); - } - break; - case NoExpose: - { - register XNoExposeEvent *ev = (XNoExposeEvent *) re; - ev->drawable = sw32(event->u.noExposure.drawable, sw); - ev->major_code = event->u.noExposure.majorEvent; - ev->minor_code = sw16(event->u.noExposure.minorEvent, sw); - } - break; - case VisibilityNotify: - { - register XVisibilityEvent *ev = (XVisibilityEvent *) re; - ev->window = sw32(event->u.visibility.window, sw); - ev->state = event->u.visibility.state; - } - break; - case CreateNotify: - { - register XCreateWindowEvent *ev = - (XCreateWindowEvent *) re; - ev->window = sw32(event->u.createNotify.window, sw); - ev->parent = sw32(event->u.createNotify.parent, sw); - ev->x = cvtINT16toInt(sw16(event->u.createNotify.x, sw)); - ev->y = cvtINT16toInt(sw16(event->u.createNotify.y, sw)); - ev->width = sw16(event->u.createNotify.width, sw); - ev->height = sw16(event->u.createNotify.height, sw); - ev->border_width = sw16(event->u.createNotify.borderWidth, sw); - ev->override_redirect = event->u.createNotify.override; - } - break; - case DestroyNotify: - { - register XDestroyWindowEvent *ev = - (XDestroyWindowEvent *) re; - ev->window = sw32(event->u.destroyNotify.window, sw); - ev->event = sw32(event->u.destroyNotify.event, sw); - } - break; - case UnmapNotify: - { - register XUnmapEvent *ev = (XUnmapEvent *) re; - ev->window = sw32(event->u.unmapNotify.window, sw); - ev->event = sw32(event->u.unmapNotify.event, sw); - ev->from_configure = event->u.unmapNotify.fromConfigure; - } - break; - case MapNotify: - { - register XMapEvent *ev = (XMapEvent *) re; - ev->window = sw32(event->u.mapNotify.window, sw); - ev->event = sw32(event->u.mapNotify.event, sw); - ev->override_redirect = event->u.mapNotify.override; - } - break; - case MapRequest: - { - register XMapRequestEvent *ev = (XMapRequestEvent *) re; - ev->window = sw32(event->u.mapRequest.window, sw); - ev->parent = sw32(event->u.mapRequest.parent, sw); - } - break; - case ReparentNotify: - { - register XReparentEvent *ev = (XReparentEvent *) re; - ev->event = sw32(event->u.reparent.event, sw); - ev->window = sw32(event->u.reparent.window, sw); - ev->parent = sw32(event->u.reparent.parent, sw); - ev->x = cvtINT16toInt(sw16(event->u.reparent.x, sw)); - ev->y = cvtINT16toInt(sw16(event->u.reparent.y, sw)); - ev->override_redirect = event->u.reparent.override; - } - break; - case ConfigureNotify: - { - register XConfigureEvent *ev = (XConfigureEvent *) re; - ev->event = sw32(event->u.configureNotify.event, sw); - ev->window = sw32(event->u.configureNotify.window, sw); - ev->above = sw32(event->u.configureNotify.aboveSibling, sw); - ev->x = cvtINT16toInt(sw16(event->u.configureNotify.x, sw)); - ev->y = cvtINT16toInt(sw16(event->u.configureNotify.y, sw)); - ev->width = sw16(event->u.configureNotify.width, sw); - ev->height = sw16(event->u.configureNotify.height, sw); - ev->border_width = sw16(event->u.configureNotify.borderWidth, sw); - ev->override_redirect = event->u.configureNotify.override; - } - break; - case ConfigureRequest: - { - register XConfigureRequestEvent *ev = - (XConfigureRequestEvent *) re; - ev->window = sw32(event->u.configureRequest.window, sw); - ev->parent = sw32(event->u.configureRequest.parent, sw); - ev->above = sw32(event->u.configureRequest.sibling, sw); - ev->x = cvtINT16toInt(sw16(event->u.configureRequest.x, sw)); - ev->y = cvtINT16toInt(sw16(event->u.configureRequest.y, sw)); - ev->width = sw16(event->u.configureRequest.width, sw); - ev->height = sw16(event->u.configureRequest.height, sw); - ev->border_width = sw16(event->u.configureRequest.borderWidth, sw); - ev->value_mask = sw16(event->u.configureRequest.valueMask, sw); - ev->detail = event->u.u.detail; - } - break; - case GravityNotify: - { - register XGravityEvent *ev = (XGravityEvent *) re; - ev->window = sw32(event->u.gravity.window, sw); - ev->event = sw32(event->u.gravity.event, sw); - ev->x = cvtINT16toInt(sw16(event->u.gravity.x, sw)); - ev->y = cvtINT16toInt(sw16(event->u.gravity.y, sw)); - } - break; - case ResizeRequest: - { - register XResizeRequestEvent *ev = - (XResizeRequestEvent *) re; - ev->window = sw32(event->u.resizeRequest.window, sw); - ev->width = sw16(event->u.resizeRequest.width, sw); - ev->height = sw16(event->u.resizeRequest.height, sw); - } - break; - case CirculateNotify: - { - register XCirculateEvent *ev = (XCirculateEvent *) re; - ev->window = sw32(event->u.circulate.window, sw); - ev->event = sw32(event->u.circulate.event, sw); - ev->place = event->u.circulate.place; - } - break; - case CirculateRequest: - { - register XCirculateRequestEvent *ev = - (XCirculateRequestEvent *) re; - ev->window = sw32(event->u.circulate.window, sw); - ev->parent = sw32(event->u.circulate.event, sw); - ev->place = event->u.circulate.place; - } - break; - case PropertyNotify: - { - register XPropertyEvent *ev = (XPropertyEvent *) re; - ev->window = sw32(event->u.property.window, sw); - ev->atom = sw32(event->u.property.atom, sw); - ev->time = sw32(event->u.property.time, sw); - ev->state = event->u.property.state; - } - break; - case SelectionClear: - { - register XSelectionClearEvent *ev = - (XSelectionClearEvent *) re; - ev->window = sw32(event->u.selectionClear.window, sw); - ev->selection = sw32(event->u.selectionClear.atom, sw); - ev->time = sw32(event->u.selectionClear.time, sw); - } - break; - case SelectionRequest: - { - register XSelectionRequestEvent *ev = - (XSelectionRequestEvent *) re; - ev->owner = sw32(event->u.selectionRequest.owner, sw); - ev->requestor = sw32(event->u.selectionRequest.requestor, sw); - ev->selection = sw32(event->u.selectionRequest.selection, sw); - ev->target = sw32(event->u.selectionRequest.target, sw); - ev->property = sw32(event->u.selectionRequest.property, sw); - ev->time = sw32(event->u.selectionRequest.time, sw); - } - break; - case SelectionNotify: - { - register XSelectionEvent *ev = (XSelectionEvent *) re; - ev->requestor = sw32(event->u.selectionNotify.requestor, sw); - ev->selection = sw32(event->u.selectionNotify.selection, sw); - ev->target = sw32(event->u.selectionNotify.target, sw); - ev->property = sw32(event->u.selectionNotify.property, sw); - ev->time = sw32(event->u.selectionNotify.time, sw); - } - break; - case ColormapNotify: - { - register XColormapEvent *ev = (XColormapEvent *) re; - ev->window = sw32(event->u.colormap.window, sw); - ev->colormap = sw32(event->u.colormap.colormap, sw); - ev->new = event->u.colormap.new; - ev->state = event->u.colormap.state; - } - break; - case ClientMessage: - { - register int i; - register XClientMessageEvent *ev - = (XClientMessageEvent *) re; - ev->window = sw32(event->u.clientMessage.window, sw); - ev->format = event->u.u.detail; - switch (ev->format) { - case 8: - ev->message_type = sw32(event->u.clientMessage.u.b.type, sw); - for (i = 0; i < 20; i++) - ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; - break; - case 16: - ev->message_type = sw32(event->u.clientMessage.u.s.type, sw); - ev->data.s[0] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts0, sw)); - ev->data.s[1] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts1, sw)); - ev->data.s[2] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts2, sw)); - ev->data.s[3] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts3, sw)); - ev->data.s[4] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts4, sw)); - ev->data.s[5] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts5, sw)); - ev->data.s[6] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts6, sw)); - ev->data.s[7] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts7, sw)); - ev->data.s[8] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts8, sw)); - ev->data.s[9] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts9, sw)); - break; - case 32: - ev->message_type = sw32(event->u.clientMessage.u.l.type, sw); - ev->data.l[0] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs0, sw)); - ev->data.l[1] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs1, sw)); - ev->data.l[2] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs2, sw)); - ev->data.l[3] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs3, sw)); - ev->data.l[4] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs4, sw)); - break; - default: /* XXX should never occur */ - break; - } - } - break; - case MappingNotify: - { - register XMappingEvent *ev = (XMappingEvent *)re; - ev->window = 0; - ev->first_keycode = event->u.mappingNotify.firstKeyCode; - ev->request = event->u.mappingNotify.request; - ev->count = event->u.mappingNotify.count; - } - break; - default: - return(False); - } - return(True); -} diff --git a/nx-X11/lib/X11/imExten.c b/nx-X11/lib/X11/imExten.c deleted file mode 100644 index 532b18d3b..000000000 --- a/nx-X11/lib/X11/imExten.c +++ /dev/null @@ -1,576 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -/* - * index of extensions - */ - -#define XIM_EXT_SET_EVENT_MASK_IDX 0 -#ifdef EXT_FORWARD -#define XIM_EXT_FORWARD_KEYEVENT_IDX 1 -#endif -#ifdef EXT_MOVE -#define XIM_EXT_MOVE_IDX 2 -#endif - -typedef struct _XIM_QueryExtRec { - Bool is_support; - const char *name; - int name_len; - CARD16 major_opcode; - CARD16 minor_opcode; - int idx; -} XIM_QueryExtRec; - -static XIM_QueryExtRec extensions[] = { - {False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0, - XIM_EXT_SET_EVENT_MASK_IDX}, -#ifdef EXT_FORWARD - {False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0, - XIM_EXT_FORWARD_KEYEVENT_IDX}, -#endif -#ifdef EXT_MOVE - {False, "XIM_EXT_MOVE", 0, 0, 0, XIM_EXT_MOVE_IDX}, -#endif - {False, NULL, 0, 0, 0, 0} /* dummy */ -}; - -static int -_XimIsSupportExt( - int idx) -{ - register int i; - int n = XIMNumber(extensions) - 1; - - for (i = 0; i < n; i++) { - if (extensions[i].idx == idx) { - if (extensions[i].is_support) - return i; - else - break; - } - } - return -1; -} - -static Bool -_XimProcExtSetEventMask( - Xim im, - Xic ic, - XPointer buf) -{ - EVENTMASK *buf_l = (EVENTMASK *)buf; - EVENTMASK select_mask = _XimGetWindowEventmask(ic); - - ic->private.proto.filter_event_mask = buf_l[0]; - ic->private.proto.intercept_event_mask = buf_l[1]; - ic->private.proto.select_event_mask = buf_l[2]; - ic->private.proto.forward_event_mask = buf_l[3]; - ic->private.proto.synchronous_event_mask = buf_l[4]; - - select_mask &= ~ic->private.proto.intercept_event_mask; - /* deselected event mask */ - select_mask |= ic->private.proto.select_event_mask; - /* selected event mask */ - XSelectInput(im->core.display, ic->core.focus_window, select_mask); - _XimReregisterFilter(ic); - - if (!(_XimProcSyncReply(im, ic))) - return False; - return True; -} - -static Bool -_XimExtSetEventMaskCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Xim im = (Xim)call_data; - Xic ic; - - if ((imid == im->private.proto.imid) - && (ic = _XimICOfXICID(im, icid))) { - (void)_XimProcExtSetEventMask(im, ic, (XPointer)&buf_s[2]); - return True; - } - return False; -} - -#ifdef EXT_FORWARD -static Bool -_XimProcExtForwardKeyEvent( - Xim im, - Xic ic, - XPointer buf) -{ - CARD8 *buf_b = (CARD8 *)buf; - CARD16 *buf_s = (CARD16 *)buf; - CARD32 *buf_l = (CARD32 *)buf; - XEvent ev; - XKeyEvent *kev = (XKeyEvent *)&ev; - - bzero(&ev, sizeof(XEvent)); - kev->send_event = False; - kev->display = im->core.display; - kev->serial = buf_s[1]; /* sequence number */ - kev->type = buf_b[4] & 0x7f; /* xEvent.u.u.type */ - kev->keycode = buf_b[5]; /* Keycode */ - kev->state = buf_s[3]; /* state */ - kev->time = buf_l[2]; /* time */ - - XPutBackEvent(im->core.display, &ev); - - _XimRespSyncReply(ic, buf_s[0]); - MARK_FABRICATED(im); - - return True; -} - -static Bool -_XimExtForwardKeyEventCallback( - Xim xim, - INT16 len, - XPointer data, - XPointer call_data) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - Xim im = (Xim)call_data; - Xic ic; - - if ((imid == im->private.proto.imid) - && (ic = _XimICOfXICID(im, icid))) { - (void)_XimProcExtForwardKeyEvent(im, ic, (XPointer)&buf_s[2]); - return True; - } - return False; -} - -static Bool -_XimExtForwardKeyEventCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - Xic ic = (Xic)arg; - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - XICID icid = buf_s[1]; - - if ((major_opcode == XIM_SYNC_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid) - && (icid == ic->private.proto.icid)) - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid) - && (buf_s[2] & XIM_ICID_VALID) - && (icid == ic->private.proto.icid)) - return True; - return False; -} - -Bool -_XimExtForwardKeyEvent( - Xic ic, - XKeyEvent *ev, - Bool sync) -{ - Xim im = (Xim) ic->core.im; - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; - CARD16 *buf_s = (CARD16 *)buf_b; - CARD32 *buf_l = (CARD32 *)buf_b; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - INT16 len; - int idx; - - if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) < 0) - return False; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ - buf_s[3] = (CARD16)(((XAnyEvent *)ev)->serial & ((unsigned long) 0xffff)); - /* sequence number */ - buf_b[8] = ev->type; /* xEvent.u.u.type */ - buf_b[9] = ev->keycode; /* keycode */ - buf_s[5] = ev->state; /* state */ - buf_l[3] = ev->time; /* time */ - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16) /* sizeof icid */ - + sizeof(BITMASK16) /* sizeof flag */ - + sizeof(CARD16) /* sizeof sequence number */ - + sizeof(BYTE) /* sizeof xEvent.u.u.type */ - + sizeof(BYTE) /* sizeof keycode */ - + sizeof(CARD16) /* sizeof state */ - + sizeof(CARD32); /* sizeof time */ - - _XimSetHeader((XPointer)buf, - extensions[idx].major_opcode, - extensions[idx].minor_opcode, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - if (sync) { - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimExtForwardKeyEventCheck, (XPointer)ic); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_sizex = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, preply, buf_size, - _XimExtForwardKeyEventCheck, (XPointer)ic); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else - return False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - } - return True; -} -#endif /* EXT_FORWARD */ - -static int -_XimCheckExtensionListSize(void) -{ - register int i; - int len; - int total = 0; - int n = XIMNumber(extensions) - 1; - - for (i = 0; i < n; i++) { - len = strlen(extensions[i].name); - extensions[i].name_len = len; - len += sizeof(BYTE); - total += len; - } - return total; -} - -static void -_XimSetExtensionList( - CARD8 *buf) -{ - register int i; - int len; - int n = XIMNumber(extensions) - 1; - - for (i = 0; i < n; i++) { - len = extensions[i].name_len; - buf[0] = (BYTE)len; - (void)strcpy((char *)&buf[1], extensions[i].name); - len += sizeof(BYTE); - buf += len; - } - return; -} - -static unsigned int -_XimCountNumberOfExtension( - INT16 total, - CARD8 *ext) -{ - unsigned int n; - INT16 len; - INT16 min_len = sizeof(CARD8) - + sizeof(CARD8) - + sizeof(INT16); - - n = 0; - while (total > min_len) { - len = *((INT16 *)(&ext[2])); - len += (min_len + XIM_PAD(len)); - total -= len; - ext += len; - n++; - } - return n; -} - -static Bool -_XimParseExtensionList( - Xim im, - CARD16 *data) -{ - int num = XIMNumber(extensions) - 1; - unsigned int n; - CARD8 *buf; - register int i; - register int j; - INT16 len; - - if (!(n = _XimCountNumberOfExtension(data[0], (CARD8 *)&data[1]))) - return True; - - buf = (CARD8 *)&data[1]; - for (i = 0; i < n; i++) { - len = *((INT16 *)(&buf[2])); - for (j = 0; j < num; j++) { - if (!(strncmp(extensions[j].name, (char *)&buf[4], len))) { - extensions[j].major_opcode = buf[0]; - extensions[j].minor_opcode = buf[1]; - extensions[j].is_support = True; - break; - } - } - len += sizeof(CARD8) /* sizeof major_opcode */ - + sizeof(CARD8) /* sizeof minor_opcode */ - + sizeof(INT16) /* sizeof length */ - + XIM_PAD(len); /* sizeof pad */ - buf += len; - } - - return True; -} - -static Bool -_XimQueryExtensionCheck( - Xim im, - INT16 len, - XPointer data, - XPointer arg) -{ - CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); - CARD8 major_opcode = *((CARD8 *)data); - CARD8 minor_opcode = *((CARD8 *)data + 1); - XIMID imid = buf_s[0]; - - if ((major_opcode == XIM_QUERY_EXTENSION_REPLY) - && (minor_opcode == 0) - && (imid == im->private.proto.imid)) - return True; - if ((major_opcode == XIM_ERROR) - && (minor_opcode == 0) - && (buf_s[2] & XIM_IMID_VALID) - && (imid == im->private.proto.imid)) - return True; - return False; -} - -Bool -_XimExtension( - Xim im) -{ - CARD8 *buf; - CARD16 *buf_s; - int buf_len; - INT16 len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - int idx; - - if (!(len = _XimCheckExtensionListSize())) - return True; - - buf_len = XIM_HEADER_SIZE - + sizeof(CARD16) - + sizeof(INT16) - + len - + XIM_PAD(len); - - if (!(buf = Xmalloc(buf_len))) - return False; - buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = len; /* length of Extensions */ - _XimSetExtensionList((CARD8 *)&buf_s[2]); - /* extensions supported */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += sizeof(CARD16) /* sizeof imid */ - + sizeof(INT16); /* sizeof length of extensions */ - - _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) { - XFree(buf); - return False; - } - XFree(buf); - _XimFlush(im); - buf_size = BUFSIZE; - ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, - _XimQueryExtensionCheck, 0); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(len <= 0) { - preply = reply; - } else { - buf_size = len; - preply = Xmalloc(buf_size); - ret_code = _XimRead(im, &len, reply, buf_size, - _XimQueryExtensionCheck, 0); - if(ret_code != XIM_TRUE) { - Xfree(preply); - return False; - } - } - } else - return False; - buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); - if (*((CARD8 *)preply) == XIM_ERROR) { - _XimProcError(im, 0, (XPointer)&buf_s[3]); - if(reply != preply) - Xfree(preply); - return False; - } - - if (!(_XimParseExtensionList(im, &buf_s[1]))) { - if(reply != preply) - Xfree(preply); - return False; - } - if(reply != preply) - Xfree(preply); - - if ((idx = _XimIsSupportExt(XIM_EXT_SET_EVENT_MASK_IDX)) >= 0) - _XimRegProtoIntrCallback(im, - extensions[idx].major_opcode, - extensions[idx].minor_opcode, - _XimExtSetEventMaskCallback, (XPointer)im); -#ifdef EXT_FORWARD - if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) >= 0) - _XimRegProtoIntrCallback(im, - extensions[idx].major_opcode, - extensions[idx].minor_opcode, - _XimExtForwardKeyEventCallback, (XPointer)im); -#endif - - return True; -} - -#ifdef EXT_MOVE -/* flag of ExtenArgCheck */ -#define EXT_XNSPOTLOCATION (1L<<0) - -/* macro for ExtenArgCheck */ -#define SET_EXT_XNSPOTLOCATION(flag) (flag |= EXT_XNSPOTLOCATION) -#define IS_EXT_XNSPOTLOCATION(flag) (flag & EXT_XNSPOTLOCATION) - -/* length of XPoint attribute */ -#define XIM_Xpoint_length 12 - -static Bool -_XimExtMove( - Xim im, - Xic ic, - CARD16 x, - CARD16 y) -{ - CARD32 buf32[BUFSIZE/4]; - CARD8 *buf = (CARD8 *)buf32; - CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; - INT16 len; - int idx; - - if ((idx = _XimIsSupportExt(XIM_EXT_MOVE_IDX)) < 0) - return False; - - buf_s[0] = im->private.proto.imid; /* imid */ - buf_s[1] = ic->private.proto.icid; /* icid */ - buf_s[2] = x; /* X */ - buf_s[3] = y; /* Y */ - len = sizeof(CARD16) /* sizeof imid */ - + sizeof(CARD16) /* sizeof icid */ - + sizeof(INT16) /* sizeof X */ - + sizeof(INT16); /* sizeof Y */ - - _XimSetHeader((XPointer)buf, extensions[idx].major_opcode, - extensions[idx].minor_opcode, &len); - if (!(_XimWrite(im, len, (XPointer)buf))) - return False; - _XimFlush(im); - return True; -} - -BITMASK32 -_XimExtenArgCheck( - XIMArg *arg) -{ - CARD32 flag = 0L; - if (!strcmp(arg->name, XNSpotLocation)) - SET_EXT_XNSPOTLOCATION(flag); - return flag; -} - -Bool -_XimExtenMove( - Xim im, - Xic ic, - CARD32 flag, - CARD16 *buf, - INT16 length) -{ - if ((IS_EXT_XNSPOTLOCATION(flag)) && (length == XIM_Xpoint_length)) - return _XimExtMove(im, ic, buf[4], buf[5]); - return False; -} -#endif /* EXT_MOVE */ diff --git a/nx-X11/lib/X11/imImSw.c b/nx-X11/lib/X11/imImSw.c deleted file mode 100644 index 28b1725a6..000000000 --- a/nx-X11/lib/X11/imImSw.c +++ /dev/null @@ -1,55 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993 by FUJITSU LIMITED - Copyright 1993 by Digital Equipment Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED and -Digital Equipment Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. FUJITSU LIMITED and Digital Equipment Corporation -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 -THIS SOFTWARE. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Modifier: Franky Ling Digital Equipment Corporation - frankyling@hgrd01.enet.dec.com - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "XimImSw.h" - -static Bool -_XimCheckIfDefault( - Xim im) -{ - return(True); -} - -XimImsportSW _XimImSportRec[] = { - { _XimCheckIfLocalProcessing, _XimLocalOpenIM, _XimLocalIMFree }, - { _XimCheckIfThaiProcessing, _XimThaiOpenIM, _XimThaiIMFree }, - { _XimCheckIfDefault, _XimProtoOpenIM, _XimProtoIMFree }, - { NULL, NULL, NULL }, -}; diff --git a/nx-X11/lib/X11/imInsClbk.c b/nx-X11/lib/X11/imInsClbk.c deleted file mode 100644 index 3ae6b1bd7..000000000 --- a/nx-X11/lib/X11/imInsClbk.c +++ /dev/null @@ -1,288 +0,0 @@ -/****************************************************************** - - Copyright 1993, 1994 by Sony Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 Sony Corporation - not be used in advertising or publicity pertaining to distribution - of the software without specific, written prior permission. -Sony Corporation makes no representations about the suitability of - this software for any purpose. It is provided "as is" without - express or implied warranty. - -SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL 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. - - Author: Makoto Wakamatsu Sony Corporation - makoto@sm.sony.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "XlcPublic.h" -#include "Ximint.h" - - -typedef struct _XimInstCallback { - Bool call; - Bool destroy; - Display *display; - XLCd lcd; - char name[XIM_MAXLCNAMELEN]; - char *modifiers; - XrmDatabase rdb; - char *res_name; - char *res_class; - XIDProc callback; - XPointer client_data; - struct _XimInstCallback *next; -} XimInstCallbackRec, *XimInstCallback; - - -static XimInstCallback callback_list = NULL; -static Bool lock = False; - - -static void -MakeLocale( XLCd lcd, char locale[] ) -{ - char *language, *territory, *codeset; - - _XGetLCValues( lcd, XlcNLanguage, &language, XlcNTerritory, &territory, - XlcNCodeset, &codeset, NULL ); - - strcpy( locale, language ); - if( territory && *territory ) { - strcat( locale, "_" ); - strcat( locale, territory ); - } - if( codeset && *codeset ) { - strcat( locale, "." ); - strcat( locale, codeset ); - } -} - - -static Bool -_XimFilterPropertyNotify( - Display *display, - Window window, - XEvent *event, - XPointer client_data) -{ - Atom ims, actual_type, *atoms; - int actual_format; - unsigned long nitems, bytes_after; - int ii; - XIM xim; - Bool flag = False; - XimInstCallback icb, picb, tmp; - - if( (ims = XInternAtom( display, XIM_SERVERS, True )) == None || - event->xproperty.atom != ims || - event->xproperty.state == PropertyDelete ) - return( False ); - - if( XGetWindowProperty( display, RootWindow(display, 0), ims, 0L, 1000000L, - False, XA_ATOM, &actual_type, &actual_format, - &nitems, &bytes_after, (unsigned char **)&atoms ) - != Success ) { - return( False ); - } - if( actual_type != XA_ATOM || actual_format != 32 ) { - XFree( atoms ); - return( False ); - } - - lock = True; - for( ii = 0; ii < nitems; ii++, atoms ) { - if(XGetSelectionOwner (display, atoms[ii])) { - for( icb = callback_list; icb; icb = icb->next ) { - if( !icb->call && !icb->destroy ) { - xim = (*icb->lcd->methods->open_im)( icb->lcd, display, - icb->rdb, - icb->res_name, - icb->res_class ); - if( xim ) { - xim->methods->close( (XIM)xim ); - flag = True; - icb->call = True; - icb->callback( icb->display, icb->client_data, NULL ); - } - } - } - break; - } - } - XFree( atoms ); - - for( icb = callback_list, picb = NULL; icb; ) { - if( icb->destroy ) { - if( picb ) - picb->next = icb->next; - else - callback_list = icb->next; - tmp = icb; - icb = icb->next; - XFree( tmp ); - } - else { - picb = icb; - icb = icb->next; - } - } - lock = False; - - return( flag ); -} - - -Bool -_XimRegisterIMInstantiateCallback( - XLCd lcd, - Display *display, - XrmDatabase rdb, - char *res_name, - char *res_class, - XIDProc callback, - XPointer client_data) -{ - XimInstCallback icb, tmp; - XIM xim; - Window root; - XWindowAttributes attr; - - if( lock ) - return( False ); - - icb = Xmalloc(sizeof(XimInstCallbackRec)); - if( !icb ) - return( False ); - icb->call = icb->destroy = False; - icb->display = display; - icb->lcd = lcd; - MakeLocale( lcd, icb->name ); - icb->modifiers = lcd->core->modifiers; /* XXXXX */ - icb->rdb = rdb; - icb->res_name = res_name; - icb->res_class = res_class; - icb->callback = callback; - icb->client_data = client_data; - icb->next = NULL; - - if( !callback_list ) - callback_list = icb; - else { - for( tmp = callback_list; tmp->next; tmp = tmp->next ); - tmp->next = icb; - } - - xim = (*lcd->methods->open_im)( lcd, display, rdb, res_name, res_class ); - - if( icb == callback_list ) { - root = RootWindow( display, 0 ); - XGetWindowAttributes( display, root, &attr ); - _XRegisterFilterByType( display, root, PropertyNotify, PropertyNotify, - _XimFilterPropertyNotify, (XPointer)NULL ); - XSelectInput( display, root, - attr.your_event_mask | PropertyChangeMask ); - } - - if( xim ) { - lock = True; - xim->methods->close( (XIM)xim ); - lock = False; - icb->call = True; - callback( display, client_data, NULL ); - } - - return( True ); -} - - -Bool -_XimUnRegisterIMInstantiateCallback( - XLCd lcd, - Display *display, - XrmDatabase rdb, - char *res_name, - char *res_class, - XIDProc callback, - XPointer client_data) -{ - char locale[XIM_MAXLCNAMELEN]; - XimInstCallback icb, picb; - - if( !callback_list ) - return( False ); - - MakeLocale( lcd, locale ); - - for( icb = callback_list, picb = NULL; icb; picb = icb, icb = icb->next ) { - if( !strcmp( locale, icb->name ) && - (lcd->core->modifiers == icb->modifiers || /* XXXXX */ - (lcd->core->modifiers && icb->modifiers && - !strcmp( lcd->core->modifiers, icb->modifiers ))) && - rdb == icb->rdb && /* XXXXX */ - ((res_name == NULL && icb->res_name == NULL) || - (res_name != NULL && icb->res_name != NULL && - !strcmp( res_name, icb->res_name ))) && - ((res_class == NULL && icb->res_class == NULL) || - (res_class != NULL && icb->res_class != NULL && - !strcmp( res_class, icb->res_class ))) && - (callback == icb->callback) && - (client_data == icb->client_data) && /* XXXXX */ - !icb->destroy ) { - if( lock ) - icb->destroy = True; - else { - if( !picb ) { - callback_list = icb->next; - _XUnregisterFilter( display, RootWindow(display, 0), - _XimFilterPropertyNotify, - (XPointer)NULL ); - } - else - picb->next = icb->next; - _XCloseLC( icb->lcd ); - XFree( icb ); - } - return( True ); - } - } - return( False ); -} - - -void -_XimResetIMInstantiateCallback(Xim xim) -{ - char locale[XIM_MAXLCNAMELEN]; - XimInstCallback icb; - XLCd lcd = xim->core.lcd; - - if( !callback_list && lock ) - return; - - MakeLocale( lcd, locale ); - - for( icb = callback_list; icb; icb = icb->next ) - if( !strcmp( locale, icb->name ) && - (lcd->core->modifiers == icb->modifiers || - (lcd->core->modifiers && icb->modifiers && - !strcmp( lcd->core->modifiers, icb->modifiers ))) ) - icb->call = False; -} diff --git a/nx-X11/lib/X11/imInt.c b/nx-X11/lib/X11/imInt.c deleted file mode 100644 index 05e04dac8..000000000 --- a/nx-X11/lib/X11/imInt.c +++ /dev/null @@ -1,260 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "XimImSw.h" - -static Xim *_XimCurrentIMlist = (Xim *)NULL; -static int _XimCurrentIMcount = 0; - -static Bool -_XimSetIMStructureList( - Xim im) -{ - register int i; - Xim *xim; - - if(!(_XimCurrentIMlist)) { - if(!(_XimCurrentIMlist = Xmalloc(sizeof(Xim)))) - return False; - _XimCurrentIMlist[0] = im; - _XimCurrentIMcount = 1; - } - else { - for(i = 0; i < _XimCurrentIMcount; i++) { - if(!( _XimCurrentIMlist[i])) { - _XimCurrentIMlist[i] = im; - break; - } - } - if(i >= _XimCurrentIMcount) { - if(!(xim = Xrealloc(_XimCurrentIMlist, - ((i + 1) * sizeof(Xim))))) - return False; - _XimCurrentIMlist = xim; - _XimCurrentIMlist[_XimCurrentIMcount] = im; - _XimCurrentIMcount++; - } - } - return True; -} - -void -_XimDestroyIMStructureList(Xim im) -{ - register int i; - - for(i = 0; i < _XimCurrentIMcount; i++) { - if(_XimCurrentIMlist[i] == im) { - _XimCurrentIMlist[i] = NULL; - break; - } - } - return; -} - -void -_XimServerDestroy(Xim im_2_destroy) -{ - register int i; - Xim im; - XIC ic; - - for(i = 0; i < _XimCurrentIMcount; i++) { - if(!(im = _XimCurrentIMlist[i])) - continue; - /* - * Only continue if this im is the one to be destroyed. - */ - if (im != im_2_destroy) - continue; - - if (im->core.destroy_callback.callback) - (*im->core.destroy_callback.callback)((XIM)im, - im->core.destroy_callback.client_data, NULL); - for (ic = im->core.ic_chain; ic; ic = ic->core.next) { - if (ic->core.destroy_callback.callback) { - (*ic->core.destroy_callback.callback)(ic, - ic->core.destroy_callback.client_data, NULL); - } - } - _XimResetIMInstantiateCallback( im ); - (void)im->methods->close((XIM)im); - Xfree(im); - _XimCurrentIMlist[i] = NULL; - return; - } -} - -#ifdef XIM_CONNECTABLE -void -_XimServerReconectableDestroy(void) -{ - register int i; - Xim im; - XIC ic; - - for(i = 0; i < _XimCurrentIMcount; i++) { - if(!(im = _XimCurrentIMlist[i])) - continue; - - if (im->core.destroy_callback.callback) - (*im->core.destroy_callback.callback)(im, - im->core.destroy_callback.client_data, NULL); - for (ic = im->core.ic_chain; ic; ic = ic->core.next) { - if (ic->core.destroy_callback.callback) { - (*ic->core.destroy_callback.callback)(ic, - ic->core.destroy_callback.client_data, NULL); - } - } - _XimResetIMInstantiateCallback( im ); - (void)im->methods->close((XIM)im); - } - return; -} -#endif /* XIM_CONNECTABLE */ - -static const char * -_XimStrstr( - register const char *src, - register const char *dest) -{ - int len; - - len = strlen(dest); - while((src = strchr(src, *dest))) { - if(!strncmp(src, dest, len)) - return src; - src++; - } - return NULL; -} - -static char * -_XimMakeImName( - XLCd lcd) -{ - const char* begin = NULL; - const char* end = NULL; - char* ret = NULL; - const char* ximmodifier = XIMMODIFIER; - - if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') { - begin = _XimStrstr(lcd->core->modifiers, ximmodifier); - if (begin != NULL) { - end = begin += strlen(ximmodifier); - while (*end && *end != '@') - end++; - } - } - ret = Xmalloc(end - begin + 1); - if (ret != NULL) { - if (begin != NULL && end != NULL) { - (void)strncpy(ret, begin, end - begin); - ret[end - begin] = '\0'; - } else { - ret[0] = '\0'; - } - } - - return ret; -} - -XIM -_XimOpenIM( - XLCd lcd, - Display *dpy, - XrmDatabase rdb, - char *res_name, - char *res_class) -{ - Xim im; - register int i; - - if (!(im = Xcalloc(1, sizeof(XimRec)))) - return (XIM)NULL; - - im->core.lcd = lcd; - im->core.ic_chain = (XIC)NULL; - im->core.display = dpy; - im->core.rdb = rdb; - im->core.res_name = NULL; - im->core.res_class = NULL; - if((res_name != NULL) && (*res_name != '\0')){ - if(!(im->core.res_name = strdup(res_name))) - goto Error1; - } - if((res_class != NULL) && (*res_class != '\0')){ - if(!(im->core.res_class = strdup(res_class))) - goto Error2; - } - if(!(im->core.im_name = _XimMakeImName(lcd))) - goto Error3; - - for(i= 0; ; i++) { - if(_XimImSportRec[i].checkprocessing(im)) { - if(!(_XimImSportRec[i].im_open(im))) - goto Error4; - if(!_XimSetIMStructureList(im)) - goto Error4; - return (XIM)im; - } - } - -Error4 : - _XimImSportRec[i].im_free(im); - Xfree(im); - return NULL; -Error3 : - Xfree(im->core.im_name); -Error2: - Xfree(im->core.res_class); -Error1: - Xfree(im->core.res_name); - Xfree(im); - return NULL; -} - -Bool -_XInitIM(XLCd lcd) -{ - if(lcd == (XLCd)NULL) - return False; - lcd->methods->open_im = _XimOpenIM; - lcd->methods->register_callback = _XimRegisterIMInstantiateCallback; - lcd->methods->unregister_callback = _XimUnRegisterIMInstantiateCallback; - return True; -} diff --git a/nx-X11/lib/X11/imKStoUCS.c b/nx-X11/lib/X11/imKStoUCS.c deleted file mode 100644 index 640b3516a..000000000 --- a/nx-X11/lib/X11/imKStoUCS.c +++ /dev/null @@ -1,322 +0,0 @@ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Ximint.h" - -static unsigned short const keysym_to_unicode_1a1_1ff[] = { - 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ - 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ - 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ - 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ - 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ - 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ - 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ - 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ - 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ - 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ - 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ - 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ -}; - -static unsigned short const keysym_to_unicode_2a1_2fe[] = { - 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ - 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ - 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ - 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ - 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ - 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ -}; - -static unsigned short const keysym_to_unicode_3a2_3fe[] = { - 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ - 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ - 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ - 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ - 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ - 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ - 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ - 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ - 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ - 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ -}; - -static unsigned short const keysym_to_unicode_4a1_4df[] = { - 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ - 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ - 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ - 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ - 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ - 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ - 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ - 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ -}; - -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 */ - 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ - 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ - 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ - 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ - 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ -}; - -static unsigned short keysym_to_unicode_680_6ff[] = { - 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ - 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ - 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ - 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ - 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ -}; - -static unsigned short const keysym_to_unicode_7a1_7f9[] = { - 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ - 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ - 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ - 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ - 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ - 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ - 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ - 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ - 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ -}; - -static unsigned short const keysym_to_unicode_8a4_8fe[] = { - 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ - 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ - 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, 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, 0x2202, /* 0x08e8-0x08ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ - 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ -}; - -static unsigned short const keysym_to_unicode_9df_9f8[] = { - 0x2422, /* 0x09d8-0x09df */ - 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ - 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ - 0x2502 /* 0x09f8-0x09ff */ -}; - -static unsigned short const keysym_to_unicode_aa1_afe[] = { - 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ - 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ - 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ - 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ - 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ - 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ - 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ - 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ - 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ - 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ - 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ - 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ -}; - -/* none of the APL keysyms match the Unicode characters */ - -static unsigned short const keysym_to_unicode_cdf_cfa[] = { - 0x2017, /* 0x0cd8-0x0cdf */ - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ - 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ -}; - -static unsigned short const keysym_to_unicode_da1_df9[] = { - 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ - 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ - 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ -}; - -static unsigned short const keysym_to_unicode_ea0_eff[] = { - 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ - 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ - 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ - 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ - 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ - 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ - 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ - 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ - 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ - 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ - 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ - 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ -}; - -static unsigned short keysym_to_unicode_12a1_12fe[] = { - 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ - 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ - 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ - 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ - 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ - 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 */ -}; - -static unsigned short keysym_to_unicode_14a1_14ff[] = { - 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ - 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ - 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ - 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ - 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ - 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ - 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ - 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ - 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ - 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ - 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ - 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ -}; - -static unsigned short keysym_to_unicode_15d0_15f6[] = { - 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ - 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ - 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ - 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ - 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ -}; - -static unsigned short keysym_to_unicode_16a0_16f6[] = { - 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ - 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ - 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ - 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ - 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ - 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ -}; - -static unsigned short const keysym_to_unicode_1e9f_1eff[] = { - 0x0303, - 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ - 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ - 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ - 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ - 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ - 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ - 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ - 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ - 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ - 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ - 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ - 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ -}; - -static unsigned short const keysym_to_unicode_20a0_20ac[] = { - 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ - 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ -}; - -unsigned int -KeySymToUcs4(KeySym keysym) -{ - /* 'Unicode keysym' */ - if ((keysym & 0xff000000) == 0x01000000) - return (keysym & 0x00ffffff); - - if (keysym > 0 && keysym < 0x100) - return keysym; - else if (keysym > 0x1a0 && keysym < 0x200) - return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; - else if (keysym > 0x2a0 && keysym < 0x2ff) - return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; - else if (keysym > 0x3a1 && keysym < 0x3ff) - return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; - else if (keysym > 0x4a0 && keysym < 0x4e0) - return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; - else if (keysym > 0x589 && keysym < 0x5ff) - return keysym_to_unicode_590_5fe[keysym - 0x590]; - else if (keysym > 0x67f && keysym < 0x700) - return keysym_to_unicode_680_6ff[keysym - 0x680]; - else if (keysym > 0x7a0 && keysym < 0x7fa) - return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; - else if (keysym > 0x8a3 && keysym < 0x8ff) - return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; - else if (keysym > 0x9de && keysym < 0x9f9) - return keysym_to_unicode_9df_9f8[keysym - 0x9df]; - else if (keysym > 0xaa0 && keysym < 0xaff) - return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; - else if (keysym > 0xcde && keysym < 0xcfb) - return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; - else if (keysym > 0xda0 && keysym < 0xdfa) - return keysym_to_unicode_da1_df9[keysym - 0xda1]; - else if (keysym > 0xe9f && keysym < 0xf00) - return keysym_to_unicode_ea0_eff[keysym - 0xea0]; - else if (keysym > 0x12a0 && keysym < 0x12ff) - return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; - else if (keysym > 0x13bb && keysym < 0x13bf) - return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; - else if (keysym > 0x14a0 && keysym < 0x1500) - return keysym_to_unicode_14a1_14ff[keysym - 0x14a1]; - else if (keysym > 0x15cf && keysym < 0x15f7) - return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; - else if (keysym > 0x169f && keysym < 0x16f7) - return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; - else if (keysym > 0x1e9e && keysym < 0x1f00) - return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; - else if (keysym > 0x209f && keysym < 0x20ad) - return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; - else - return 0; -} diff --git a/nx-X11/lib/X11/imLcFlt.c b/nx-X11/lib/X11/imLcFlt.c deleted file mode 100644 index 50f4c252a..000000000 --- a/nx-X11/lib/X11/imLcFlt.c +++ /dev/null @@ -1,157 +0,0 @@ -/****************************************************************** - - Copyright 1992 by Fuji Xerox Co., Ltd. - Copyright 1992, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 Fuji Xerox, -FUJITSU LIMITED not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. Fuji Xerox, FUJITSU LIMITED make no representations -about the suitability of this software for any purpose. -It is provided "as is" without express or implied warranty. - -FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, -FUJITSU LIMITED 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 : Kazunori Nishihara Fuji Xerox - Modifier : Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include -#include "Xlcint.h" -#include "Ximint.h" - -Bool -_XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) -{ - Xic ic = (Xic)client_data; - KeySym keysym; - static char buf[256]; - static unsigned prevcode = 0, prevstate = 0; - unsigned currstate; - DefTree *b = ic->private.local.base.tree; - DTIndex t; - Bool braille = False, anymodifier = False; - - if(ev->xkey.keycode == 0) - return (False); - - XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); - - if(keysym >= XK_braille_dot_1 && keysym <= XK_braille_dot_8) { - if(ev->type == KeyPress) { - ic->private.local.brl_pressed |= - 1<<(keysym-XK_braille_dot_1); - return(True); - } else { - if(!ic->private.local.brl_committing - || ev->xkey.time - ic->private.local.brl_release_start > 300) { - ic->private.local.brl_committing = ic->private.local.brl_pressed; - ic->private.local.brl_release_start = ev->xkey.time; - } - ic->private.local.brl_pressed &= ~(1<<(keysym-XK_braille_dot_1)); - if(!ic->private.local.brl_pressed && ic->private.local.brl_committing) { - /* Commited a braille pattern, let it go through compose tree */ - keysym = XK_braille_blank | ic->private.local.brl_committing; - ev->type = KeyPress; - braille = True; - } else { - return(True); - } - } - } - - if(((Xim)ic->core.im)->private.local.top == 0 ) - goto emit_braille; - - currstate = ev->xkey.state; - if(ev->type == KeyPress) { - prevcode = ev->xkey.keycode; - prevstate = currstate; - - if(IsModifierKey(keysym)) - return(False); - prevcode = 0; - } else { - if(prevcode != ev->xkey.keycode) - return False; - - /* For lookup, we use the state at the time when the key was pressed, */ - /* because this state was not affected by the modifier that is mapped */ - /* to the key. */ - ev->xkey.state = prevstate; - XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); - } - - for(t = ic->private.local.context; t; t = b[t].next) { - if(IsModifierKey(b[t].keysym)) - anymodifier = True; - if(((ev->xkey.state & b[t].modifier_mask) == b[t].modifier) && - (keysym == b[t].keysym)) - break; - } - - /* Restore the state */ - ev->xkey.state = currstate; - - if(t) { /* Matched */ - if(b[t].succession) { /* Intermediate */ - ic->private.local.context = b[t].succession; - return (ev->type == KeyPress); - } else { /* Terminate (reached to leaf) */ - ic->private.local.composed = t; - ic->private.local.brl_committed = 0; - /* return back to client KeyPressEvent keycode == 0 */ - ev->xkey.keycode = 0; - ev->xkey.type = KeyPress; - XPutBackEvent(d, ev); - if(prevcode){ - /* For modifier key releases, restore the event, as we do not */ - /* filter it. */ - ev->xkey.type = KeyRelease; - ev->xkey.keycode = prevcode; - } - /* initialize internal state for next key sequence */ - ic->private.local.context = ((Xim)ic->core.im)->private.local.top; - return (ev->type == KeyPress); - } - } else { /* Unmatched */ - /* Unmatched modifier key releases abort matching only in the case that */ - /* there was any modifier that would have matched */ - if((ic->private.local.context == ((Xim)ic->core.im)->private.local.top) || - (ev->type == KeyRelease && !anymodifier)) { - goto emit_braille; - } - /* Error (Sequence Unmatch occured) */ - /* initialize internal state for next key sequence */ - ic->private.local.context = ((Xim)ic->core.im)->private.local.top; - return (ev->type == KeyPress); - } - -emit_braille: - if(braille) { - /* Braille pattern is not in compose tree, emit alone */ - ic->private.local.brl_committed = ic->private.local.brl_committing; - ic->private.local.composed = 0; - ev->xkey.keycode = 0; - _XPutBackEvent(d, ev); - return(True); - } - return(False); -} diff --git a/nx-X11/lib/X11/imLcGIc.c b/nx-X11/lib/X11/imLcGIc.c deleted file mode 100644 index 003b3897a..000000000 --- a/nx-X11/lib/X11/imLcGIc.c +++ /dev/null @@ -1,47 +0,0 @@ -/****************************************************************** - - Copyright 1992,1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -char * -_XimLocalGetICValues(XIC xic, XIMArg *values) -{ - Xic ic = (Xic)xic; - XimDefICValues ic_values; - - _XimGetCurrentICValues(ic, &ic_values); - return(_XimGetICValueData(ic, (XPointer)&ic_values, - ic->private.local.ic_resources, - ic->private.local.ic_num_resources, - values, XIM_GETICVALUES)); -} diff --git a/nx-X11/lib/X11/imLcIc.c b/nx-X11/lib/X11/imLcIc.c deleted file mode 100644 index 7ab9050c1..000000000 --- a/nx-X11/lib/X11/imLcIc.c +++ /dev/null @@ -1,199 +0,0 @@ -/****************************************************************** - - Copyright 1992,1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -static void -_XimLocalUnSetFocus( - XIC xic) -{ - Xic ic = (Xic)xic; - ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; - - if (ic->core.focus_window) - _XUnregisterFilter(ic->core.im->core.display, - ic->core.focus_window, _XimLocalFilter, (XPointer)ic); - return; -} - -static void -_XimLocalDestroyIC( - XIC xic) -{ - Xic ic = (Xic)xic; - - if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { - ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; - } - if (ic->core.focus_window) - _XUnregisterFilter(ic->core.im->core.display, - ic->core.focus_window, _XimLocalFilter, (XPointer)ic); - if(ic->private.local.ic_resources) { - Xfree(ic->private.local.ic_resources); - ic->private.local.ic_resources = NULL; - } - return; -} - -static void -_XimLocalSetFocus( - XIC xic) -{ - Xic ic = (Xic)xic; - XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; - - if (current_ic == (XIC)ic) - return; - - if (current_ic != (XIC)NULL) { - _XimLocalUnSetFocus(current_ic); - } - ((Xim)ic->core.im)->private.local.current_ic = (XIC)ic; - - if (ic->core.focus_window) - _XRegisterFilterByType(ic->core.im->core.display, - ic->core.focus_window, KeyPress, KeyRelease, - _XimLocalFilter, (XPointer)ic); - return; -} - -static void -_XimLocalReset( - XIC xic) -{ - Xic ic = (Xic)xic; - ic->private.local.composed = 0; - ic->private.local.context = ((Xim)ic->core.im)->private.local.top; - ic->private.local.brl_pressed = 0; - ic->private.local.brl_committing = 0; - ic->private.local.brl_committed = 0; -} - -static char * -_XimLocalMbReset( - XIC xic) -{ - _XimLocalReset(xic); - return (char *)NULL; -} - -static wchar_t * -_XimLocalWcReset( - XIC xic) -{ - _XimLocalReset(xic); - return (wchar_t *)NULL; -} - -static XICMethodsRec Local_ic_methods = { - _XimLocalDestroyIC, /* destroy */ - _XimLocalSetFocus, /* set_focus */ - _XimLocalUnSetFocus, /* unset_focus */ - _XimLocalSetICValues, /* set_values */ - _XimLocalGetICValues, /* get_values */ - _XimLocalMbReset, /* mb_reset */ - _XimLocalWcReset, /* wc_reset */ - _XimLocalMbReset, /* utf8_reset */ - _XimLocalMbLookupString, /* mb_lookup_string */ - _XimLocalWcLookupString, /* wc_lookup_string */ - _XimLocalUtf8LookupString /* utf8_lookup_string */ -}; - -XIC -_XimLocalCreateIC( - XIM im, - XIMArg *values) -{ - Xic ic; - XimDefICValues ic_values; - XIMResourceList res; - unsigned int num; - int len; - - if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) { - return ((XIC)NULL); - } - - ic->methods = &Local_ic_methods; - ic->core.im = im; - ic->private.local.base = ((Xim)im)->private.local.base; - ic->private.local.context = ((Xim)im)->private.local.top; - ic->private.local.composed = 0; - ic->private.local.brl_pressed = 0; - ic->private.local.brl_committing = 0; - ic->private.local.brl_committed = 0; - - num = im->core.ic_num_resources; - len = sizeof(XIMResource) * num; - if((res = Xmalloc(len)) == (XIMResourceList)NULL) { - goto Set_Error; - } - (void)memcpy((char *)res, (char *)im->core.ic_resources, len); - ic->private.local.ic_resources = res; - ic->private.local.ic_num_resources = num; - - bzero((char *)&ic_values, sizeof(XimDefICValues)); - if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, - im->core.styles, res, num) == False) { - goto Set_Error; - } - - _XimSetICMode(res, num, ic_values.input_style); - - if(_XimSetICValueData(ic, (XPointer)&ic_values, - ic->private.local.ic_resources, - ic->private.local.ic_num_resources, - values, XIM_CREATEIC, True)) { - goto Set_Error; - } - ic_values.filter_events = KeyPressMask | KeyReleaseMask; - _XimSetCurrentICValues(ic, &ic_values); - if(_XimSetICDefaults(ic, (XPointer)&ic_values, - XIM_SETICDEFAULTS, res, num) == False) { - goto Set_Error; - } - _XimSetCurrentICValues(ic, &ic_values); - - return((XIC)ic); - -Set_Error : - if (ic->private.local.ic_resources) { - Xfree(ic->private.local.ic_resources); - ic->private.local.ic_resources = NULL; - } - Xfree(ic); - return((XIC)NULL); -} diff --git a/nx-X11/lib/X11/imLcIm.c b/nx-X11/lib/X11/imLcIm.c deleted file mode 100644 index b3662bc96..000000000 --- a/nx-X11/lib/X11/imLcIm.c +++ /dev/null @@ -1,711 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993 by Digital Equipment Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED and -Digital Equipment Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. FUJITSU LIMITED and Digital Equipment Corporation -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 -THIS SOFTWARE. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Modifier: Franky Ling Digital Equipment Corporation - frankyling@hgrd01.enet.dec.com - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "XlcPublic.h" -#include "XlcPubI.h" -#include "Ximint.h" -#include -#include - -#ifdef COMPOSECACHE -# include -# include -# include -# include -#endif - - -#ifdef COMPOSECACHE - -/* include trailing '/' for cache directory, file prefix otherwise */ -#define XIM_GLOBAL_CACHE_DIR "/var/cache/libx11/compose/" -#define XIM_HOME_CACHE_DIR "/.compose-cache/" -#define XIM_CACHE_MAGIC ('X' | 'i'<<8 | 'm'<<16 | 'C'<<24) -#define XIM_CACHE_VERSION 4 -#define XIM_CACHE_TREE_ALIGNMENT 4 - -#define XIM_HASH_PRIME_1 13 -#define XIM_HASH_PRIME_2 1234096939 - -typedef INT32 DTStructIndex; -struct _XimCacheStruct { - INT32 id; - INT32 version; - DTStructIndex tree; - DTStructIndex mb; - DTStructIndex wc; - DTStructIndex utf8; - DTStructIndex size; - DTIndex top; - DTIndex treeused; - DTCharIndex mbused; - DTCharIndex wcused; - DTCharIndex utf8used; - char fname[1]; - /* char encoding[1] */ -}; - -static struct _XimCacheStruct* _XimCache_mmap = NULL; -static DefTreeBase _XimCachedDefaultTreeBase; -static int _XimCachedDefaultTreeRefcount = 0; - -#endif - - -Bool -_XimCheckIfLocalProcessing(Xim im) -{ - FILE *fp; - char *name; - - if(strcmp(im->core.im_name, "") == 0) { - name = _XlcFileName(im->core.lcd, COMPOSE_FILE); - if (name != (char *)NULL) { - fp = _XFopenFile (name, "r"); - Xfree(name); - if (fp != (FILE *)NULL) { - fclose(fp); - return(True); - } - } - return(False); - } else if(strcmp(im->core.im_name, "local") == 0 || - strcmp(im->core.im_name, "none" ) == 0 ) { - return(True); - } - return(False); -} - -static void -XimFreeDefaultTree( - DefTreeBase *b) -{ - if (!b) return; - if (b->tree == NULL) return; -#ifdef COMPOSECACHE - if (b->tree == _XimCachedDefaultTreeBase.tree) { - _XimCachedDefaultTreeRefcount--; - /* No deleting, it's a cache after all. */ - return; - } -#endif - Xfree (b->tree); - b->tree = NULL; - Xfree (b->mb); - b->mb = NULL; - Xfree (b->wc); - b->wc = NULL; - Xfree (b->utf8); - b->utf8 = NULL; - - b->treeused = b->treesize = 0; - b->mbused = b->mbsize = 0; - b->wcused = b->wcsize = 0; - b->utf8used = b->utf8size = 0; -} - -void -_XimLocalIMFree( - Xim im) -{ - XimFreeDefaultTree(&im->private.local.base); - im->private.local.top = 0; - - Xfree(im->core.im_resources); - im->core.im_resources = NULL; - - Xfree(im->core.ic_resources); - im->core.ic_resources = NULL; - - Xfree(im->core.im_values_list); - im->core.im_values_list = NULL; - - Xfree(im->core.ic_values_list); - im->core.ic_values_list = NULL; - - Xfree(im->core.styles); - im->core.styles = NULL; - - Xfree(im->core.res_name); - im->core.res_name = NULL; - - Xfree(im->core.res_class); - im->core.res_class = NULL; - - Xfree(im->core.im_name); - im->core.im_name = NULL; - - if (im->private.local.ctom_conv) { - _XlcCloseConverter(im->private.local.ctom_conv); - im->private.local.ctom_conv = NULL; - } - if (im->private.local.ctow_conv) { - _XlcCloseConverter(im->private.local.ctow_conv); - im->private.local.ctow_conv = NULL; - } - if (im->private.local.ctoutf8_conv) { - _XlcCloseConverter(im->private.local.ctoutf8_conv); - im->private.local.ctoutf8_conv = NULL; - } - if (im->private.local.cstomb_conv) { - _XlcCloseConverter(im->private.local.cstomb_conv); - im->private.local.cstomb_conv = NULL; - } - if (im->private.local.cstowc_conv) { - _XlcCloseConverter(im->private.local.cstowc_conv); - im->private.local.cstowc_conv = NULL; - } - if (im->private.local.cstoutf8_conv) { - _XlcCloseConverter(im->private.local.cstoutf8_conv); - im->private.local.cstoutf8_conv = NULL; - } - if (im->private.local.ucstoc_conv) { - _XlcCloseConverter(im->private.local.ucstoc_conv); - im->private.local.ucstoc_conv = NULL; - } - if (im->private.local.ucstoutf8_conv) { - _XlcCloseConverter(im->private.local.ucstoutf8_conv); - im->private.local.ucstoutf8_conv = NULL; - } - return; -} - -static Status -_XimLocalCloseIM( - XIM xim) -{ - Xim im = (Xim)xim; - XIC ic; - XIC next; - - ic = im->core.ic_chain; - im->core.ic_chain = NULL; - while (ic) { - (*ic->methods->destroy) (ic); - next = ic->core.next; - Xfree (ic); - ic = next; - } - _XimLocalIMFree(im); - _XimDestroyIMStructureList(im); - return(True); -} - -char * -_XimLocalGetIMValues( - XIM xim, - XIMArg *values) -{ - Xim im = (Xim)xim; - XimDefIMValues im_values; - - _XimGetCurrentIMValues(im, &im_values); - return(_XimGetIMValueData(im, (XPointer)&im_values, values, - im->core.im_resources, im->core.im_num_resources)); -} - -char * -_XimLocalSetIMValues( - XIM xim, - XIMArg *values) -{ - Xim im = (Xim)xim; - XimDefIMValues im_values; - char *name = (char *)NULL; - - _XimGetCurrentIMValues(im, &im_values); - name = _XimSetIMValueData(im, (XPointer)&im_values, values, - im->core.im_resources, im->core.im_num_resources); - _XimSetCurrentIMValues(im, &im_values); - return(name); -} - - -#ifdef COMPOSECACHE - -static Bool -_XimReadCachedDefaultTree( - int fd_cache, - const char *name, - const char *encoding, - DTStructIndex size) -{ - struct _XimCacheStruct* m; - int namelen = strlen (name) + 1; - int encodinglen = strlen (encoding) + 1; - - m = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd_cache, 0); - if (m == NULL || m == MAP_FAILED) - return False; - assert (m->id == XIM_CACHE_MAGIC); - assert (m->version == XIM_CACHE_VERSION); - if (size != m->size || - size < XOffsetOf (struct _XimCacheStruct, fname) + namelen + encodinglen) { - fprintf (stderr, "Ignoring broken XimCache %s [%s]\n", name, encoding); - munmap (m, size); - return False; - } - if (strncmp (name, m->fname, namelen) != 0) { - /* m->fname may *not* be terminated - but who cares here */ - fprintf (stderr, "Filename hash clash - expected %s, got %s\n", - name, m->fname); - munmap (m, size); - return False; - } - if (strncmp (encoding, m->fname + namelen, encodinglen) != 0) { - /* m->fname+namelen may *not* be terminated - but who cares here */ - fprintf (stderr, "Enoding hash clash - expected %s, got %s\n", - encoding, m->fname + namelen); - munmap (m, size); - return False; - } - _XimCache_mmap = m; - _XimCachedDefaultTreeBase.tree = (DefTree *) (((char *) m) + m->tree); - _XimCachedDefaultTreeBase.mb = (((char *) m) + m->mb); - _XimCachedDefaultTreeBase.wc = (wchar_t *) (((char *) m) + m->wc); - _XimCachedDefaultTreeBase.utf8 = (((char *) m) + m->utf8); - _XimCachedDefaultTreeBase.treeused = m->treeused; - _XimCachedDefaultTreeBase.mbused = m->mbused; - _XimCachedDefaultTreeBase.wcused = m->wcused; - _XimCachedDefaultTreeBase.utf8used = m->utf8used; - /* treesize etc. is ignored because only used during parsing */ - _XimCachedDefaultTreeRefcount = 0; -/* fprintf (stderr, "read cached tree at %p: %s\n", (void *) m, name); */ - return True; -} - -static unsigned int strToHash ( - const char *name) -{ - unsigned int hash = 0; - while (*name) - hash = hash * XIM_HASH_PRIME_1 + *(unsigned const char *)name++; - return hash % XIM_HASH_PRIME_2; -} - - -/* Returns read-only fd of cache file, -1 if none. - * Sets *res to cache filename if safe. Sets *size to file size of cache. */ -static int _XimCachedFileName ( - const char *dir, const char *name, - const char *intname, const char *encoding, - uid_t uid, int isglobal, char **res, off_t *size) -{ - struct stat st_name, st; - int fd; - unsigned int len, hash, hash2; - struct _XimCacheStruct *m; - /* There are some races here with 'dir', but we are either in our own home - * or the global cache dir, and not inside some public writable dir */ -/* fprintf (stderr, "XimCachedFileName for dir %s name %s intname %s encoding %s uid %d\n", dir, name, intname, encoding, uid); */ - if (stat (name, &st_name) == -1 || ! S_ISREG (st_name.st_mode) - || stat (dir, &st) == -1 || ! S_ISDIR (st.st_mode) || st.st_uid != uid - || (st.st_mode & 0022) != 0000) { - *res = NULL; - return -1; - } - len = strlen (dir); - hash = strToHash (intname); - hash2 = strToHash (encoding); - *res = Xmalloc (len + 1 + 27 + 1); /* Max VERSION 9999 */ - - if (len == 0 || dir [len-1] != '/') - sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), - XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); - else - sprintf (*res, "%s%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), - XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); - -/* fprintf (stderr, "-> %s\n", *res); */ - if ( (fd = _XOpenFile (*res, O_RDONLY)) == -1) - return -1; - - if (fstat (fd, &st) == -1) { - Xfree (*res); - *res = NULL; - close (fd); - return -1; - } - *size = st.st_size; - - if (! S_ISREG (st.st_mode) || st.st_uid != uid - || (st.st_mode & 0022) != 0000 || st.st_mtime <= st_name.st_mtime - || (st.st_mtime < time (NULL) - 24*60*60 && ! isglobal)) { - - close (fd); - if (unlink (*res) != 0) { - Xfree (*res); - *res = NULL; /* cache is not safe */ - } - return -1; - } - - m = mmap (NULL, sizeof (struct _XimCacheStruct), PROT_READ, MAP_PRIVATE, - fd, 0); - if (m == NULL || m == MAP_FAILED) { - close (fd); - Xfree (*res); - *res = NULL; - return -1; - } - if (*size < sizeof (struct _XimCacheStruct) || m->id != XIM_CACHE_MAGIC) { - munmap (m, sizeof (struct _XimCacheStruct)); - close (fd); - fprintf (stderr, "Ignoring broken XimCache %s\n", *res); - Xfree (*res); - *res = NULL; - return -1; - } - if (m->version != XIM_CACHE_VERSION) { - munmap (m, sizeof (struct _XimCacheStruct)); - close (fd); - if (unlink (*res) != 0) { - Xfree (*res); - *res = NULL; /* cache is not safe */ - } - return -1; - } - munmap (m, sizeof (struct _XimCacheStruct)); - - return fd; -} - - -static Bool _XimLoadCache ( - int fd, - const char *name, - const char *encoding, - off_t size, - Xim im) -{ - if (_XimCache_mmap || - _XimReadCachedDefaultTree (fd, name, encoding, size)) { - _XimCachedDefaultTreeRefcount++; - memcpy (&im->private.local.base, &_XimCachedDefaultTreeBase, - sizeof (_XimCachedDefaultTreeBase)); - im->private.local.top = _XimCache_mmap->top; - return True; - } - - return False; -} - - -static void -_XimWriteCachedDefaultTree( - const char *name, - const char *encoding, - const char *cachename, - Xim im) -{ - int fd; - FILE *fp; - struct _XimCacheStruct *m; - int msize = (XOffsetOf(struct _XimCacheStruct, fname) - + strlen(name) + strlen(encoding) + 2 - + XIM_CACHE_TREE_ALIGNMENT-1) & -XIM_CACHE_TREE_ALIGNMENT; - DefTreeBase *b = &im->private.local.base; - - if (! b->tree && ! (b->tree = Xcalloc (1, sizeof(DefTree))) ) - return; - if (! b->mb && ! (b->mb = Xmalloc (1)) ) - return; - if (! b->wc && ! (b->wc = Xmalloc (sizeof(wchar_t))) ) - return; - if (! b->utf8 && ! (b->utf8 = Xmalloc (1)) ) - return; - - /* First entry is always unused */ - b->mb[0] = 0; - b->wc[0] = 0; - b->utf8[0] = 0; - - m = Xcalloc (1, msize); - m->id = XIM_CACHE_MAGIC; - m->version = XIM_CACHE_VERSION; - m->top = im->private.local.top; - m->treeused = b->treeused; - m->mbused = b->mbused; - m->wcused = b->wcused; - m->utf8used = b->utf8used; - /* Tree first, then wide chars, then the rest due to alignment */ - m->tree = msize; - m->wc = msize + sizeof (DefTree) * m->treeused; - m->mb = m->wc + sizeof (wchar_t) * m->wcused; - m->utf8 = m->mb + m->mbused; - m->size = m->utf8 + m->utf8used; - strcpy (m->fname, name); - strcpy (m->fname+strlen(name)+1, encoding); - - /* This STILL might be racy on NFS */ - if ( (fd = _XOpenFileMode (cachename, O_WRONLY | O_CREAT | O_EXCL, - 0600)) < 0) { - Xfree(m); - return; - } - if (! (fp = fdopen (fd, "wb")) ) { - close (fd); - Xfree(m); - return; - } - fwrite (m, msize, 1, fp); - fwrite (im->private.local.base.tree, sizeof(DefTree), m->treeused, fp); - fwrite (im->private.local.base.wc, sizeof(wchar_t), m->wcused, fp); - fwrite (im->private.local.base.mb, 1, m->mbused, fp); - fwrite (im->private.local.base.utf8, 1, m->utf8used, fp); - if (fclose (fp) != 0) - unlink (cachename); - _XimCache_mmap = m; - memcpy (&_XimCachedDefaultTreeBase, &im->private.local.base, - sizeof (_XimCachedDefaultTreeBase)); -/* fprintf (stderr, "wrote tree %s size %ld to %s\n", name, m->size, cachename); */ -} - -#endif - - -static void -_XimCreateDefaultTree( - Xim im) -{ - FILE *fp = NULL; - char *name, *tmpname = NULL; - char *cachename = NULL; - /* Should use getpwent() instead of $HOME (cross-platform?) */ - char *home = getenv("HOME"); - char *tmpcachedir = NULL; - int hl = home ? strlen (home) : 0; -#ifdef COMPOSECACHE - char *intname; - char *cachedir = NULL; - const char *encoding = nl_langinfo (CODESET); - uid_t euid = geteuid (); - gid_t egid = getegid (); - int cachefd = -1; - off_t size; -#endif - - name = getenv("XCOMPOSEFILE"); - if (name == (char *) NULL) { - if (home != (char *) NULL) { - tmpname = name = Xmalloc(hl + 10 + 1); - if (name != (char *) NULL) { - int fd; - strcpy(name, home); - strcpy(name + hl, "/.XCompose"); - if ( (fd = _XOpenFile (name, O_RDONLY)) < 0) { - Xfree (name); - name = tmpname = NULL; - } else - close (fd); - } - } - } - - if (name == (char *) NULL) { - tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE); - } -#ifdef COMPOSECACHE - intname = name; - - if (getuid () == euid && getgid () == egid && euid != 0) { - char *c; - /* Usage: XCOMPOSECACHE=[=] - * cachedir: directory of cache files - * filename: internally used name for cache file */ - cachedir = getenv("XCOMPOSECACHE"); - if (cachedir && (c = strchr (cachedir, '='))) { - tmpcachedir = strdup (cachedir); - intname = tmpcachedir + (c-cachedir) + 1; - tmpcachedir[c-cachedir] = '\0'; - cachedir = tmpcachedir; - } - } - - if (! cachedir) { - cachefd = _XimCachedFileName (XIM_GLOBAL_CACHE_DIR, name, intname, - encoding, 0, 1, &cachename, &size); - if (cachefd != -1) { - if (_XimLoadCache (cachefd, intname, encoding, size, im)) { - Xfree (tmpcachedir); - Xfree (tmpname); - Xfree (cachename); - close (cachefd); - return; - } - close (cachefd); - } - Xfree (cachename); - cachename = NULL; - } - - if (getuid () == euid && getgid () == egid && euid != 0 && home) { - - if (! cachedir) { - tmpcachedir = cachedir = Xmalloc (hl+strlen(XIM_HOME_CACHE_DIR)+1); - strcpy (cachedir, home); - strcat (cachedir, XIM_HOME_CACHE_DIR); - } - cachefd = _XimCachedFileName (cachedir, name, intname, encoding, - euid, 0, &cachename, &size); - if (cachefd != -1) { - if (_XimLoadCache (cachefd, intname, encoding, size, im)) { - Xfree (tmpcachedir); - Xfree (tmpname); - Xfree (cachename); - close (cachefd); - return; - } - close (cachefd); - } - } -#endif - - if (! (fp = _XFopenFile (name, "r"))) { - Xfree (tmpcachedir); - Xfree (tmpname); - Xfree (cachename); - return; - } - _XimParseStringFile(fp, im); - fclose(fp); - -#ifdef COMPOSECACHE - if (cachename) { - assert (euid != 0); - _XimWriteCachedDefaultTree (intname, encoding, cachename, im); - } -#endif - - Xfree (tmpcachedir); - Xfree (tmpname); - Xfree (cachename); -} - -static XIMMethodsRec Xim_im_local_methods = { - _XimLocalCloseIM, /* close */ - _XimLocalSetIMValues, /* set_values */ - _XimLocalGetIMValues, /* get_values */ - _XimLocalCreateIC, /* create_ic */ - _XimLcctstombs, /* ctstombs */ - _XimLcctstowcs, /* ctstowcs */ - _XimLcctstoutf8 /* ctstoutf8 */ -}; - -Bool -_XimLocalOpenIM( - Xim im) -{ - XLCd lcd = im->core.lcd; - XlcConv conv; - XimDefIMValues im_values; - XimLocalPrivateRec* private = &im->private.local; - - _XimInitialResourceInfo(); - if(_XimSetIMResourceList(&im->core.im_resources, - &im->core.im_num_resources) == False) { - goto Open_Error; - } - if(_XimSetICResourceList(&im->core.ic_resources, - &im->core.ic_num_resources) == False) { - goto Open_Error; - } - - _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); - - _XimGetCurrentIMValues(im, &im_values); - if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, - im->core.im_resources, im->core.im_num_resources) == False) { - goto Open_Error; - } - _XimSetCurrentIMValues(im, &im_values); - - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) - goto Open_Error; - private->ctom_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) - goto Open_Error; - private->ctow_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) - goto Open_Error; - private->ctoutf8_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) - goto Open_Error; - private->cstomb_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) - goto Open_Error; - private->cstowc_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) - goto Open_Error; - private->cstoutf8_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) - goto Open_Error; - private->ucstoc_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) - goto Open_Error; - private->ucstoutf8_conv = conv; - - private->base.treeused = 1; - private->base.mbused = 1; - private->base.wcused = 1; - private->base.utf8used = 1; - - _XimCreateDefaultTree(im); - - im->methods = &Xim_im_local_methods; - private->current_ic = (XIC)NULL; - - return(True); - -Open_Error : - _XimLocalIMFree(im); - return(False); -} diff --git a/nx-X11/lib/X11/imLcLkup.c b/nx-X11/lib/X11/imLcLkup.c deleted file mode 100644 index 878b8e350..000000000 --- a/nx-X11/lib/X11/imLcLkup.c +++ /dev/null @@ -1,417 +0,0 @@ -/****************************************************************** - - Copyright 1992 by Fuji Xerox Co., Ltd. - Copyright 1992, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 Fuji Xerox, -FUJITSU LIMITED not be used in advertising or publicity pertaining -to distribution of the software without specific, written prior -permission. Fuji Xerox, FUJITSU LIMITED make no representations -about the suitability of this software for any purpose. -It is provided "as is" without express or implied warranty. - -FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH -REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, -FUJITSU LIMITED 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: Kazunori Nishihara Fuji Xerox - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "XlcPubI.h" -#include "Ximint.h" - -int -_XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, - KeySym *keysym, Status *status) -{ - Xic ic = (Xic)xic; - int ret; - DefTree *b = ic->private.local.base.tree; - char *mb = ic->private.local.base.mb; - - if(ev->type != KeyPress) { - if(status) *status = XLookupNone; - return(0); - } - if(ev->keycode == 0 && - ( (ic->private.local.composed != 0) - ||(ic->private.local.brl_committed != 0))) { - if (ic->private.local.brl_committed != 0) { /* Braille Event */ - unsigned char pattern = ic->private.local.brl_committed; - char mb[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)]; - ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern); - if(ret > bytes) { - if(status) *status = XBufferOverflow; - return(ret); - } - if(keysym) *keysym = XK_braille_blank | pattern; - if(ret > 0) { - if (keysym) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - memcpy(buffer, mb, ret); - } else { - if(keysym) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } else { /* Composed Event */ - ret = strlen(&mb[b[ic->private.local.composed].mb]); - if(ret > bytes) { - if(status) *status = XBufferOverflow; - return(ret); - } - memcpy(buffer, &mb[b[ic->private.local.composed].mb], ret); - if(keysym) *keysym = b[ic->private.local.composed].ks; - if (ret > 0) { - if (keysym && *keysym != NoSymbol) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - } else { - if(keysym && *keysym != NoSymbol) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } - return (ret); - } else { /* Throughed Event */ - ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); - if(ret > 0) { - if (ret > bytes) { - if (status) *status = XBufferOverflow; - } else if (keysym && *keysym != NoSymbol) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - } else { - if(keysym && *keysym != NoSymbol) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } - return (ret); -} - -int -_XimLocalWcLookupString(XIC xic, XKeyEvent *ev, wchar_t *buffer, int wlen, - KeySym *keysym, Status *status) -{ - Xic ic = (Xic)xic; - int ret; - DefTree *b = ic->private.local.base.tree; - wchar_t *wc = ic->private.local.base.wc; - - if(ev->type != KeyPress) { - if(status) *status = XLookupNone; - return(0); - } - if(ev->keycode == 0) { - if (ic->private.local.brl_committed != 0) { /* Braille Event */ - unsigned char pattern = ic->private.local.brl_committed; - ret = 1; - if (ret > wlen) { - if(status) *status = XBufferOverflow; - return (ret); - } - *buffer = BRL_UC_ROW | pattern; - if(keysym) { - *keysym = XK_braille_blank | pattern; - if(status) *status = XLookupBoth; - } else - if(status) *status = XLookupChars; - } else { /* Composed Event */ - ret = _Xwcslen(&wc[b[ic->private.local.composed].wc]); - if(ret > wlen) { - if(status) *status = XBufferOverflow; - return (ret); - } - memcpy((char *)buffer, (char *)&wc[b[ic->private.local.composed].wc], - ret * sizeof(wchar_t)); - if(keysym) *keysym = b[ic->private.local.composed].ks; - if (ret > 0) { - if (keysym && *keysym != NoSymbol) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - } else { - if(keysym && *keysym != NoSymbol) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } - return (ret); - } else { /* Throughed Event */ - ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL); - if(ret > 0) { - if (ret > wlen) { - if (status) *status = XBufferOverflow; - } else if (keysym && *keysym != NoSymbol) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - } else { - if(keysym && *keysym != NoSymbol) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } - return (ret); -} - -int -_XimLocalUtf8LookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, - KeySym *keysym, Status *status) -{ - Xic ic = (Xic)xic; - int ret; - DefTree *b = ic->private.local.base.tree; - char *utf8 = ic->private.local.base.utf8; - - if(ev->type != KeyPress) { - if(status) *status = XLookupNone; - return(0); - } - if(ev->keycode == 0) { - if (ic->private.local.brl_committed != 0) { /* Braille Event */ - unsigned char pattern = ic->private.local.brl_committed; - ret = 3; - if (ret > bytes) { - if(status) *status = XBufferOverflow; - return (ret); - } - buffer[0] = 0xe0 | ((BRL_UC_ROW >> 12) & 0x0f); - buffer[1] = 0x80 | ((BRL_UC_ROW >> 8) & 0x30) | (pattern >> 6); - buffer[2] = 0x80 | (pattern & 0x3f); - if(keysym) { - *keysym = XK_braille_blank | pattern; - if(status) *status = XLookupBoth; - } else - if(status) *status = XLookupChars; - } else { /* Composed Event */ - ret = strlen(&utf8[b[ic->private.local.composed].utf8]); - if(ret > bytes) { - if(status) *status = XBufferOverflow; - return (ret); - } - memcpy(buffer, &utf8[b[ic->private.local.composed].utf8], ret); - if(keysym) *keysym = b[ic->private.local.composed].ks; - if (ret > 0) { - if (keysym && *keysym != NoSymbol) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - } else { - if(keysym && *keysym != NoSymbol) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } - return (ret); - } else { /* Throughed Event */ - ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); - if(ret > 0) { - if (ret > bytes) { - if (status) *status = XBufferOverflow; - } else if (keysym && *keysym != NoSymbol) { - if(status) *status = XLookupBoth; - } else { - if(status) *status = XLookupChars; - } - } else { - if(keysym && *keysym != NoSymbol) { - if(status) *status = XLookupKeySym; - } else { - if(status) *status = XLookupNone; - } - } - } - return (ret); -} - -static int -_XimLcctsconvert( - XlcConv conv, - char *from, - int from_len, - char *to, - int to_len, - Status *state) -{ - int from_left; - int to_left; - int from_savelen; - int to_savelen; - int from_cnvlen; - int to_cnvlen; - char *from_buf; - char *to_buf; - char scratchbuf[BUFSIZ]; - Status tmp_state; - - if (!state) - state = &tmp_state; - - if (!conv || !from || !from_len) { - *state = XLookupNone; - return 0; - } - - /* Reset the converter. The CompoundText at 'from' starts in - initial state. */ - _XlcResetConverter(conv); - - from_left = from_len; - to_left = BUFSIZ; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_buf = &from[from_cnvlen]; - from_savelen = from_left; - to_buf = &scratchbuf[to_cnvlen]; - to_savelen = to_left; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (!to_cnvlen) { - *state = XLookupNone; - return 0; - } - break; - } - } - - if (!to || !to_len || (to_len < to_cnvlen)) { - *state = XBufferOverflow; - } else { - memcpy(to, scratchbuf, to_cnvlen); - *state = XLookupChars; - } - return to_cnvlen; -} - -int -_XimLcctstombs(XIM xim, char *from, int from_len, - char *to, int to_len, Status *state) -{ - return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv, - from, from_len, to, to_len, state); -} - -int -_XimLcctstowcs(XIM xim, char *from, int from_len, - wchar_t *to, int to_len, Status *state) -{ - Xim im = (Xim)xim; - XlcConv conv = im->private.local.ctow_conv; - int from_left; - int to_left; - int from_savelen; - int to_savelen; - int from_cnvlen; - int to_cnvlen; - char *from_buf; - wchar_t *to_buf; - wchar_t scratchbuf[BUFSIZ]; - Status tmp_state; - - if (!state) - state = &tmp_state; - - if (!conv || !from || !from_len) { - *state = XLookupNone; - return 0; - } - - /* Reset the converter. The CompoundText at 'from' starts in - initial state. */ - _XlcResetConverter(conv); - - from_left = from_len; - to_left = BUFSIZ; - from_cnvlen = 0; - to_cnvlen = 0; - for (;;) { - from_buf = &from[from_cnvlen]; - from_savelen = from_left; - to_buf = &scratchbuf[to_cnvlen]; - to_savelen = to_left; - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { - *state = XLookupNone; - return 0; - } - from_cnvlen += (from_savelen - from_left); - to_cnvlen += (to_savelen - to_left); - if (from_left == 0) { - if (!to_cnvlen){ - *state = XLookupNone; - return 0; - } - break; - } - } - - if (!to || !to_len || (to_len < to_cnvlen)) { - *state = XBufferOverflow; - } else { - memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); - *state = XLookupChars; - } - return to_cnvlen; -} - -int -_XimLcctstoutf8(XIM xim, char *from, int from_len, - char *to, int to_len, Status *state) -{ - return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv, - from, from_len, to, to_len, state); -} diff --git a/nx-X11/lib/X11/imLcPrs.c b/nx-X11/lib/X11/imLcPrs.c deleted file mode 100644 index fa992e5d3..000000000 --- a/nx-X11/lib/X11/imLcPrs.c +++ /dev/null @@ -1,741 +0,0 @@ -/****************************************************************** - - Copyright 1992 by Oki Technosystems Laboratory, Inc. - Copyright 1992 by Fuji Xerox Co., Ltd. - -Permission to use, copy, modify, distribute, and sell this software -and its 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 Oki Technosystems -Laboratory and Fuji Xerox not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. -Oki Technosystems Laboratory and Fuji Xerox make no representations -about the suitability of this software for any purpose. It is provided -"as is" without express or implied warranty. - -OKI TECHNOSYSTEMS LABORATORY AND FUJI XEROX DISCLAIM ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OKI TECHNOSYSTEMS -LABORATORY AND FUJI XEROX 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: Yasuhiro Kawai Oki Technosystems Laboratory - Author: Kazunori Nishihara Fuji Xerox - -******************************************************************/ - - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include -#include -#include -#include "pathmax.h" - -#define XLC_BUFSIZE 256 - -extern int _Xmbstowcs( - wchar_t *wstr, - char *str, - int len -); - -extern int _Xmbstoutf8( - char *ustr, - const char *str, - int len -); - -static void parsestringfile(FILE *fp, Xim im, int depth); - -/* - * Parsing File Format: - * - * FILE ::= { [PRODUCTION] [COMMENT] "\n"} - * PRODUCTION ::= LHS ":" RHS [ COMMENT ] - * COMMENT ::= "#" {} - * LHS ::= EVENT { EVENT } - * EVENT ::= [MODIFIER_LIST] "<" keysym ">" - * MODIFIER_LIST ::= (["!"] {MODIFIER} ) | "None" - * MODIFIER ::= ["~"] MODIFIER_NAME - * MODIFIER_NAME ::= ("Ctrl"|"Lock"|"Caps"|"Shift"|"Alt"|"Meta") - * RHS ::= ( STRING | keysym | STRING keysym ) - * STRING ::= '"' { CHAR } '"' - * CHAR ::= GRAPHIC_CHAR | ESCAPED_CHAR - * GRAPHIC_CHAR ::= locale (codeset) dependent code - * ESCAPED_CHAR ::= ('\\' | '\"' | OCTAL | HEX ) - * OCTAL ::= '\' OCTAL_CHAR [OCTAL_CHAR [OCTAL_CHAR]] - * OCTAL_CHAR ::= (0|1|2|3|4|5|6|7) - * HEX ::= '\' (x|X) HEX_CHAR [HEX_CHAR]] - * HEX_CHAR ::= (0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|a|b|c|d|e|f) - * - */ - -static int -nextch( - FILE *fp, - int *lastch) -{ - int c; - - if (*lastch != 0) { - c = *lastch; - *lastch = 0; - } else { - c = getc(fp); - if (c == '\\') { - c = getc(fp); - if (c == '\n') { - c = getc(fp); - } else { - ungetc(c, fp); - c = '\\'; - } - } - } - return(c); -} - -static void -putbackch( - int c, - int *lastch) -{ - *lastch = c; -} - -#define ENDOFFILE 0 -#define ENDOFLINE 1 -#define COLON 2 -#define LESS 3 -#define GREATER 4 -#define EXCLAM 5 -#define TILDE 6 -#define STRING 7 -#define KEY 8 -#define ERROR 9 - -#ifndef isalnum -#define isalnum(c) \ - (('0' <= (c) && (c) <= '9') || \ - ('A' <= (c) && (c) <= 'Z') || \ - ('a' <= (c) && (c) <= 'z')) -#endif - -static int -nexttoken( - FILE *fp, - char *tokenbuf, - int *lastch) -{ - int c; - int token; - char *p; - int i, j; - - while ((c = nextch(fp, lastch)) == ' ' || c == '\t') { - } - switch (c) { - case EOF: - token = ENDOFFILE; - break; - case '\n': - token = ENDOFLINE; - break; - case '<': - token = LESS; - break; - case '>': - token = GREATER; - break; - case ':': - token = COLON; - break; - case '!': - token = EXCLAM; - break; - case '~': - token = TILDE; - break; - case '"': - p = tokenbuf; - while ((c = nextch(fp, lastch)) != '"') { - if (c == '\n' || c == EOF) { - putbackch(c, lastch); - token = ERROR; - goto string_error; - } else if (c == '\\') { - c = nextch(fp, lastch); - switch (c) { - case '\\': - case '"': - *p++ = c; - break; - case 'n': - *p++ = '\n'; - break; - case 'r': - *p++ = '\r'; - break; - case 't': - *p++ = '\t'; - break; - case '0': - case '1': - case '2': - case '3': - case '4': - case '5': - case '6': - case '7': - i = c - '0'; - c = nextch(fp, lastch); - for (j = 0; j < 2 && c >= '0' && c <= '7'; j++) { - i <<= 3; - i += c - '0'; - c = nextch(fp, lastch); - } - putbackch(c, lastch); - *p++ = (char)i; - break; - case 'X': - case 'x': - i = 0; - for (j = 0; j < 2; j++) { - c = nextch(fp, lastch); - i <<= 4; - if (c >= '0' && c <= '9') { - i += c - '0'; - } else if (c >= 'A' && c <= 'F') { - i += c - 'A' + 10; - } else if (c >= 'a' && c <= 'f') { - i += c - 'a' + 10; - } else { - putbackch(c, lastch); - i >>= 4; - break; - } - } - if (j == 0) { - token = ERROR; - goto string_error; - } - *p++ = (char)i; - break; - case EOF: - putbackch(c, lastch); - token = ERROR; - goto string_error; - default: - *p++ = c; - break; - } - } else { - *p++ = c; - } - } - *p = '\0'; - token = STRING; - break; - case '#': - while ((c = nextch(fp, lastch)) != '\n' && c != EOF) { - } - if (c == '\n') { - token = ENDOFLINE; - } else { - token = ENDOFFILE; - } - break; - default: - if (isalnum(c) || c == '_' || c == '-') { - p = tokenbuf; - *p++ = c; - c = nextch(fp, lastch); - while (isalnum(c) || c == '_' || c == '-') { - *p++ = c; - c = nextch(fp, lastch); - } - *p = '\0'; - putbackch(c, lastch); - token = KEY; - } else { - token = ERROR; - } - break; - } -string_error: - return(token); -} - -static long -modmask( - char *name) -{ - struct _modtbl { - const char name[6]; - long mask; - }; - - static const struct _modtbl tbl[] = { - { "Ctrl", ControlMask }, - { "Lock", LockMask }, - { "Caps", LockMask }, - { "Shift", ShiftMask }, - { "Alt", Mod1Mask }, - { "Meta", Mod1Mask }}; - - int i, num_entries = sizeof (tbl) / sizeof (tbl[0]); - - for (i = 0; i < num_entries; i++) - if (!strcmp (name, tbl[i].name)) - return tbl[i].mask; - - return 0; -} - -static char* -TransFileName(Xim im, char *name) -{ - char *home = NULL, *lcCompose = NULL; - char dir[XLC_BUFSIZE] = ""; - char *i = name, *ret = NULL, *j; - size_t l = 0; - - while (*i) { - if (*i == '%') { - i++; - switch (*i) { - case '%': - l++; - break; - case 'H': - if (home == NULL) - home = getenv("HOME"); - if (home) { - size_t Hsize = strlen(home); - if (Hsize > PATH_MAX) - /* your home directory length is ridiculous */ - goto end; - l += Hsize; - } - break; - case 'L': - if (lcCompose == NULL) - lcCompose = _XlcFileName(im->core.lcd, COMPOSE_FILE); - if (lcCompose) { - size_t Lsize = strlen(lcCompose); - if (Lsize > PATH_MAX) - /* your compose pathname length is ridiculous */ - goto end; - l += Lsize; - } - break; - case 'S': - if (dir[0] == '\0') - xlocaledir(dir, XLC_BUFSIZE); - if (dir[0]) { - size_t Ssize = strlen(dir); - if (Ssize > PATH_MAX) - /* your locale directory path length is ridiculous */ - goto end; - l += Ssize; - } - break; - } - } else { - l++; - } - i++; - if (l > PATH_MAX) - /* your expanded path length is ridiculous */ - goto end; - } - - j = ret = Xmalloc(l+1); - if (ret == NULL) - goto end; - i = name; - while (*i) { - if (*i == '%') { - i++; - switch (*i) { - case '%': - *j++ = '%'; - break; - case 'H': - if (home) { - strcpy(j, home); - j += strlen(home); - } - break; - case 'L': - if (lcCompose) { - strcpy(j, lcCompose); - j += strlen(lcCompose); - } - break; - case 'S': - strcpy(j, dir); - j += strlen(dir); - break; - } - i++; - } else { - *j++ = *i++; - } - } - *j = '\0'; -end: - Xfree(lcCompose); - return ret; -} - -#ifndef MB_LEN_MAX -#define MB_LEN_MAX 6 -#endif - -static int -get_mb_string (Xim im, char *buf, KeySym ks) -{ - XPointer from, to; - int from_len, to_len, len; - XPointer args[1]; - XlcCharSet charset; - char local_buf[MB_LEN_MAX]; - unsigned int ucs; - ucs = KeySymToUcs4(ks); - - from = (XPointer) &ucs; - to = (XPointer) local_buf; - from_len = 1; - to_len = MB_LEN_MAX; - args[0] = (XPointer) &charset; - if (_XlcConvert(im->private.local.ucstoc_conv, - &from, &from_len, &to, &to_len, args, 1 ) != 0) { - return 0; - } - - from = (XPointer) local_buf; - to = (XPointer) buf; - from_len = MB_LEN_MAX - to_len; - to_len = MB_LEN_MAX + 1; - args[0] = (XPointer) charset; - if (_XlcConvert(im->private.local.cstomb_conv, - &from, &from_len, &to, &to_len, args, 1 ) != 0) { - return 0; - } - len = MB_LEN_MAX + 1 - to_len; - buf[len] = '\0'; - return len; -} - -#define AllMask (ShiftMask | LockMask | ControlMask | Mod1Mask) -#define LOCAL_WC_BUFSIZE 128 -#define LOCAL_UTF8_BUFSIZE 256 -#define SEQUENCE_MAX 10 - -static int -parseline( - FILE *fp, - Xim im, - char* tokenbuf, - int depth) -{ - int token; - DTModifier modifier_mask; - DTModifier modifier; - DTModifier tmp; - KeySym keysym = NoSymbol; - DTIndex *top = &im->private.local.top; - DefTreeBase *b = &im->private.local.base; - DTIndex t; - DefTree *p = NULL; - Bool exclam, tilde; - KeySym rhs_keysym = 0; - char *rhs_string_mb; - int l; - int lastch = 0; - char local_mb_buf[MB_LEN_MAX+1]; - wchar_t local_wc_buf[LOCAL_WC_BUFSIZE], *rhs_string_wc; - char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8; - - struct DefBuffer { - DTModifier modifier_mask; - DTModifier modifier; - KeySym keysym; - }; - - struct DefBuffer buf[SEQUENCE_MAX]; - int i, n; - - do { - token = nexttoken(fp, tokenbuf, &lastch); - } while (token == ENDOFLINE); - - if (token == ENDOFFILE) { - return(-1); - } - - n = 0; - do { - if ((token == KEY) && (strcmp("include", tokenbuf) == 0)) { - char *filename; - FILE *infp; - token = nexttoken(fp, tokenbuf, &lastch); - if (token != KEY && token != STRING) - goto error; - if (++depth > 100) - goto error; - if ((filename = TransFileName(im, tokenbuf)) == NULL) - goto error; - infp = _XFopenFile(filename, "r"); - Xfree(filename); - if (infp == NULL) - goto error; - parsestringfile(infp, im, depth); - fclose(infp); - return (0); - } else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { - modifier = 0; - modifier_mask = AllMask; - token = nexttoken(fp, tokenbuf, &lastch); - } else { - modifier_mask = modifier = 0; - exclam = False; - if (token == EXCLAM) { - exclam = True; - token = nexttoken(fp, tokenbuf, &lastch); - } - while (token == TILDE || token == KEY) { - tilde = False; - if (token == TILDE) { - tilde = True; - token = nexttoken(fp, tokenbuf, &lastch); - if (token != KEY) - goto error; - } - tmp = modmask(tokenbuf); - if (!tmp) { - goto error; - } - modifier_mask |= tmp; - if (tilde) { - modifier &= ~tmp; - } else { - modifier |= tmp; - } - token = nexttoken(fp, tokenbuf, &lastch); - } - if (exclam) { - modifier_mask = AllMask; - } - } - - if (token != LESS) { - goto error; - } - - token = nexttoken(fp, tokenbuf, &lastch); - if (token != KEY) { - goto error; - } - - token = nexttoken(fp, tokenbuf, &lastch); - if (token != GREATER) { - goto error; - } - - keysym = XStringToKeysym(tokenbuf); - if (keysym == NoSymbol) { - goto error; - } - - buf[n].keysym = keysym; - buf[n].modifier = modifier; - buf[n].modifier_mask = modifier_mask; - n++; - if( n >= SEQUENCE_MAX ) - goto error; - token = nexttoken(fp, tokenbuf, &lastch); - } while (token != COLON); - - token = nexttoken(fp, tokenbuf, &lastch); - if (token == STRING) { - l = strlen(tokenbuf) + 1; - while (b->mbused + l > b->mbsize) { - DTCharIndex newsize = b->mbsize ? b->mbsize * 1.5 : 1024; - char *newmb = Xrealloc (b->mb, newsize); - if (newmb == NULL) - goto error; - b->mb = newmb; - b->mbsize = newsize; - } - rhs_string_mb = &b->mb[b->mbused]; - b->mbused += l; - strcpy(rhs_string_mb, tokenbuf); - token = nexttoken(fp, tokenbuf, &lastch); - if (token == KEY) { - rhs_keysym = XStringToKeysym(tokenbuf); - if (rhs_keysym == NoSymbol) { - goto error; - } - token = nexttoken(fp, tokenbuf, &lastch); - } - if (token != ENDOFLINE && token != ENDOFFILE) { - goto error; - } - } else if (token == KEY) { - rhs_keysym = XStringToKeysym(tokenbuf); - if (rhs_keysym == NoSymbol) { - goto error; - } - token = nexttoken(fp, tokenbuf, &lastch); - if (token != ENDOFLINE && token != ENDOFFILE) { - goto error; - } - - l = get_mb_string(im, local_mb_buf, rhs_keysym); - while (b->mbused + l + 1 > b->mbsize) { - DTCharIndex newsize = b->mbsize ? b->mbsize * 1.5 : 1024; - char *newmb = Xrealloc (b->mb, newsize); - if (newmb == NULL) - goto error; - b->mb = newmb; - b->mbsize = newsize; - } - rhs_string_mb = &b->mb[b->mbused]; - b->mbused += l + 1; - memcpy(rhs_string_mb, local_mb_buf, l); - rhs_string_mb[l] = '\0'; - } else { - goto error; - } - - l = _Xmbstowcs(local_wc_buf, rhs_string_mb, LOCAL_WC_BUFSIZE - 1); - if (l == LOCAL_WC_BUFSIZE - 1) { - local_wc_buf[l] = (wchar_t)'\0'; - } - while (b->wcused + l + 1 > b->wcsize) { - DTCharIndex newsize = b->wcsize ? b->wcsize * 1.5 : 512; - wchar_t *newwc = Xrealloc (b->wc, sizeof(wchar_t) * newsize); - if (newwc == NULL) - goto error; - b->wc = newwc; - b->wcsize = newsize; - } - rhs_string_wc = &b->wc[b->wcused]; - b->wcused += l + 1; - memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) ); - - l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1); - if (l == LOCAL_UTF8_BUFSIZE - 1) { - local_utf8_buf[l] = '\0'; - } - while (b->utf8used + l + 1 > b->utf8size) { - DTCharIndex newsize = b->utf8size ? b->utf8size * 1.5 : 1024; - char *newutf8 = Xrealloc (b->utf8, newsize); - if (newutf8 == NULL) - goto error; - b->utf8 = newutf8; - b->utf8size = newsize; - } - rhs_string_utf8 = &b->utf8[b->utf8used]; - b->utf8used += l + 1; - memcpy(rhs_string_utf8, local_utf8_buf, l + 1); - - for (i = 0; i < n; i++) { - for (t = *top; t; t = b->tree[t].next) { - if (buf[i].keysym == b->tree[t].keysym && - buf[i].modifier == b->tree[t].modifier && - buf[i].modifier_mask == b->tree[t].modifier_mask) { - break; - } - } - if (t) { - p = &b->tree[t]; - top = &p->succession; - } else { - while (b->treeused >= b->treesize) { - DefTree *old = b->tree; - int oldsize = b->treesize; - int newsize = b->treesize ? b->treesize * 1.5 : 256; - DefTree *new = Xrealloc (b->tree, sizeof(DefTree) * newsize); - if (new == NULL) - goto error; - b->tree = new; - b->treesize = newsize; - if (top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize]) - top = (DTIndex *) (((char *) top) + (((char *)b->tree)-(char *)old)); - } - p = &b->tree[b->treeused]; - p->keysym = buf[i].keysym; - p->modifier = buf[i].modifier; - p->modifier_mask = buf[i].modifier_mask; - p->succession = 0; - p->next = *top; - p->mb = 0; - p->wc = 0; - p->utf8 = 0; - p->ks = NoSymbol; - *top = b->treeused; - top = &p->succession; - b->treeused++; - } - } - - /* old entries no longer freed... */ - p->mb = rhs_string_mb - b->mb; - p->wc = rhs_string_wc - b->wc; - p->utf8 = rhs_string_utf8 - b->utf8; - p->ks = rhs_keysym; - return(n); -error: - while (token != ENDOFLINE && token != ENDOFFILE) { - token = nexttoken(fp, tokenbuf, &lastch); - } - return(0); -} - -void -_XimParseStringFile( - FILE *fp, - Xim im) -{ - parsestringfile(fp, im, 0); -} - -static void -parsestringfile( - FILE *fp, - Xim im, - int depth) -{ - char tb[8192]; - char* tbp; - struct stat st; - - if (fstat (fileno (fp), &st) != -1) { - unsigned long size = (unsigned long) st.st_size; - if (st.st_size >= INT_MAX) - return; - if (size <= sizeof tb) tbp = tb; - else tbp = malloc (size); - - if (tbp != NULL) { - while (parseline(fp, im, tbp, depth) >= 0) {} - if (tbp != tb) free (tbp); - } - } -} diff --git a/nx-X11/lib/X11/imLcSIc.c b/nx-X11/lib/X11/imLcSIc.c deleted file mode 100644 index 944bd8abd..000000000 --- a/nx-X11/lib/X11/imLcSIc.c +++ /dev/null @@ -1,54 +0,0 @@ -/****************************************************************** - - Copyright 1990, 1991, 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -char * -_XimLocalSetICValues(XIC xic, XIMArg *values) -{ - XimDefICValues ic_values; - Xic ic = (Xic)xic; - char *name; - - _XimGetCurrentICValues(ic, &ic_values); - name = _XimSetICValueData(ic, (XPointer)&ic_values, - ic->private.local.ic_resources, - ic->private.local.ic_num_resources, - values, XIM_SETICVALUES, True); - _XimSetCurrentICValues(ic, &ic_values); - return(name); -} diff --git a/nx-X11/lib/X11/imRm.c b/nx-X11/lib/X11/imRm.c deleted file mode 100644 index 373217173..000000000 --- a/nx-X11/lib/X11/imRm.c +++ /dev/null @@ -1,3212 +0,0 @@ -/****************************************************************** - - Copyright 1990, 1991, 1992,1993, 1994 by FUJITSU LIMITED - Copyright 1994 by Sony Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED -and 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 make -no representations about the suitability of this software for any -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 -MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND -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. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Modifier: Makoto Wakamatsu Sony Corporation - makoto@sm.sony.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "Xresource.h" - -#define GET_NAME(x) name_table + x.name_offset - -typedef struct _XimValueOffsetInfo { - unsigned short name_offset; - XrmQuark quark; - unsigned int offset; - Bool (*defaults)( - struct _XimValueOffsetInfo *, XPointer, XPointer, unsigned long - ); - Bool (*encode)( - struct _XimValueOffsetInfo *, XPointer, XPointer - ); - Bool (*decode)( - struct _XimValueOffsetInfo *, XPointer, XPointer - ); -} XimValueOffsetInfoRec, *XimValueOffsetInfo; - -#ifdef XIM_CONNECTABLE -static Bool -_XimCheckBool(str) - char *str; -{ - if(!strcmp(str, "True") || !strcmp(str, "true") || - !strcmp(str, "Yes") || !strcmp(str, "yes") || - !strcmp(str, "ON") || !strcmp(str, "on")) - return True; - return False; -} - -void -_XimSetProtoResource(im) - Xim im; -{ - char res_name_buf[256]; - char* res_name; - size_t res_name_len; - char res_class_buf[256]; - char* res_class; - size_t res_class_len; - char* str_type; - XrmValue value; - XIMStyle preedit_style = 0; - XIMStyle status_style = 0; - XIMStyles* imstyles; - char* dotximdot = ".xim."; - char* ximdot = "xim."; - char* dotXimdot = ".Xim."; - char* Ximdot = "Xim."; - - if (!im->core.rdb) - return; - - res_name_len = strlen (im->core.res_name); - if (res_name_len < 200) { - res_name = res_name_buf; - res_name_len = sizeof(res_name_buf); - } - else { - res_name_len += 50; - res_name = Xmalloc (res_name_len); - } - res_class_len = strlen (im->core.res_class); - if (res_class_len < 200) { - res_class = res_class_buf; - res_class_len = sizeof(res_class_buf); - } - else { - res_class_len += 50; - res_class = Xmalloc (res_class_len); - } - /* pretend malloc always works */ - - (void) snprintf (res_name, res_name_len, "%s%s%s", - im->core.res_name != NULL ? im->core.res_name : "*", - im->core.res_name != NULL ? dotximdot : ximdot, - "useAuth"); - (void) snprintf (res_class, res_class_len, "%s%s%s", - im->core.res_class != NULL ? im->core.res_class : "*", - im->core.res_class != NULL ? dotXimdot : Ximdot, - "UseAuth"); - bzero(&value, sizeof(XrmValue)); - if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { - if(_XimCheckBool(value.addr)) { - MARK_USE_AUTHORIZATION_FUNC(im); - } - } - - (void) snprintf (res_name, res_name_len, "%s%s%s", - im->core.res_name != NULL ? im->core.res_name : "*", - im->core.res_name != NULL ? dotximdot : ximdot, - "delaybinding"); - (void) snprintf (res_class, res_class_len, "%s%s%s", - im->core.res_class != NULL ? im->core.res_class : "*", - im->core.res_class != NULL ? dotXimdot : Ximdot, - "Delaybinding"); - bzero(&value, sizeof(XrmValue)); - if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { - if(_XimCheckBool(value.addr)) { - MARK_DELAYBINDABLE(im); - } - } - - (void) snprintf (res_name, res_name_len, "%s%s%s", - im->core.res_name != NULL ? im->core.res_name : "*", - im->core.res_name != NULL ? dotximdot : ximdot, - "reconnect"); - (void) snprintf (res_class, res_class_len, "%s%s%s", - im->core.res_class != NULL ? im->core.res_class : "*", - im->core.res_class != NULL ? dotXimdot : Ximdot, - "Reconnect"); - bzero(&value, sizeof(XrmValue)); - if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { - if(_XimCheckBool(value.addr)) { - MARK_RECONNECTABLE(im); - } - } - - if(!IS_CONNECTABLE(im)) { - if (res_name != res_name_buf) Xfree (res_name); - if (res_class != res_class_buf) Xfree (res_class); - return; - } - - (void) snprintf (res_name, res_name_len, "%s%s%s", - im->core.res_name != NULL ? im->core.res_name : "*", - im->core.res_name != NULL ? dotximdot : ximdot, - "preeditDefaultStyle"); - (void) snprintf (res_class, res_class_len, "%s%s%s", - im->core.res_class != NULL ? im->core.res_class : "*", - im->core.res_class != NULL ? dotXimdot : Ximdot, - "PreeditDefaultStyle"); - if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { - if(!strcmp(value.addr, "XIMPreeditArea")) - preedit_style = XIMPreeditArea; - else if(!strcmp(value.addr, "XIMPreeditCallbacks")) - preedit_style = XIMPreeditCallbacks; - else if(!strcmp(value.addr, "XIMPreeditPosition")) - preedit_style = XIMPreeditPosition; - else if(!strcmp(value.addr, "XIMPreeditNothing")) - preedit_style = XIMPreeditNothing; - else if(!strcmp(value.addr, "XIMPreeditNone")) - preedit_style = XIMPreeditNone; - } - if(!preedit_style) - preedit_style = XIMPreeditNothing; - - (void) snprintf (res_name, res_name_len, "%s%s%s", - im->core.res_name != NULL ? im->core.res_name : "*", - im->core.res_name != NULL ? dotximdot : ximdot, - "statusDefaultStyle"); - (void) snprintf (res_class, res_class_len, "%s%s%s", - im->core.res_class != NULL ? im->core.res_class : "*", - im->core.res_class != NULL ? dotXimdot : Ximdot, - "StatusDefaultStyle"); - if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { - if(!strcmp(value.addr, "XIMStatusArea")) - status_style = XIMStatusArea; - else if(!strcmp(value.addr, "XIMStatusCallbacks")) - status_style = XIMStatusCallbacks; - else if(!strcmp(value.addr, "XIMStatusNothing")) - status_style = XIMStatusNothing; - else if(!strcmp(value.addr, "XIMStatusNone")) - status_style = XIMStatusNone; - } - if(!status_style) - status_style = XIMStatusNothing; - - if(!(imstyles = Xmalloc(sizeof(XIMStyles) + sizeof(XIMStyle)))){ - if (res_name != res_name_buf) Xfree (res_name); - if (res_class != res_class_buf) Xfree (res_class); - return; - } - imstyles->count_styles = 1; - imstyles->supported_styles = - (XIMStyle *)((char *)imstyles + sizeof(XIMStyles)); - imstyles->supported_styles[0] = preedit_style | status_style; - im->private.proto.default_styles = imstyles; - if (res_name != res_name_buf) Xfree (res_name); - if (res_class != res_class_buf) Xfree (res_class); -} -#endif /* XIM_CONNECTABLE */ - -static const char name_table[] = - /* 0 */ XNQueryInputStyle"\0" - /* 16 */ XNClientWindow"\0" - /* 29 */ XNInputStyle"\0" - /* 40 */ XNFocusWindow"\0" - /* 52 */ XNResourceName"\0" - /* 65 */ XNResourceClass"\0" - /* 79 */ XNGeometryCallback"\0" - /* 96 */ XNDestroyCallback"\0" - /* 112 */ XNFilterEvents"\0" - /* 125 */ XNPreeditStartCallback"\0" - /* 146 */ XNPreeditDoneCallback"\0" - /* 166 */ XNPreeditDrawCallback"\0" - /* 186 */ XNPreeditCaretCallback"\0" - /* 207 */ XNPreeditStateNotifyCallback"\0" - /* 234 */ XNPreeditAttributes"\0" - /* 252 */ XNStatusStartCallback"\0" - /* 272 */ XNStatusDoneCallback"\0" - /* 291 */ XNStatusDrawCallback"\0" - /* 310 */ XNStatusAttributes"\0" - /* 327 */ XNArea"\0" - /* 332 */ XNAreaNeeded"\0" - /* 343 */ XNSpotLocation"\0" - /* 356 */ XNColormap"\0" - /* 365 */ XNStdColormap"\0" - /* 377 */ XNForeground"\0" - /* 388 */ XNBackground"\0" - /* 399 */ XNBackgroundPixmap"\0" - /* 416 */ XNFontSet"\0" - /* 424 */ XNLineSpace"\0" - /* 434 */ XNCursor"\0" - /* 441 */ XNQueryIMValuesList"\0" - /* 459 */ XNQueryICValuesList"\0" - /* 477 */ XNVisiblePosition"\0" - /* 493 */ XNStringConversionCallback"\0" - /* 518 */ XNStringConversion"\0" - /* 535 */ XNResetState"\0" - /* 546 */ XNHotKey"\0" - /* 553 */ XNHotKeyState"\0" - /* 565 */ XNPreeditState -; - -#define OFFSET_XNQUERYINPUTSTYLE 0 -#define OFFSET_XNCLIENTWINDOW 16 -#define OFFSET_XNINPUTSTYLE 29 -#define OFFSET_XNFOCUSWINDOW 40 -#define OFFSET_XNRESOURCENAME 52 -#define OFFSET_XNRESOURCECLASS 65 -#define OFFSET_XNGEOMETRYCALLBACK 79 -#define OFFSET_XNDESTROYCALLBACK 96 -#define OFFSET_XNFILTEREVENTS 112 -#define OFFSET_XNPREEDITSTARTCALLBACK 125 -#define OFFSET_XNPREEDITDONECALLBACK 146 -#define OFFSET_XNPREEDITDRAWCALLBACK 166 -#define OFFSET_XNPREEDITCARETCALLBACK 186 -#define OFFSET_XNPREEDITSTATENOTIFYCALLBACK 207 -#define OFFSET_XNPREEDITATTRIBUTES 234 -#define OFFSET_XNSTATUSSTARTCALLBACK 252 -#define OFFSET_XNSTATUSDONECALLBACK 272 -#define OFFSET_XNSTATUSDRAWCALLBACK 291 -#define OFFSET_XNSTATUSATTRIBUTES 310 -#define OFFSET_XNAREA 327 -#define OFFSET_XNAREANEEDED 332 -#define OFFSET_XNSPOTLOCATION 343 -#define OFFSET_XNCOLORMAP 356 -#define OFFSET_XNSTDCOLORMAP 365 -#define OFFSET_XNFOREGROUND 377 -#define OFFSET_XNBACKGROUND 388 -#define OFFSET_XNBACKGROUNDPIXMAP 399 -#define OFFSET_XNFONTSET 416 -#define OFFSET_XNLINESPACE 424 -#define OFFSET_XNCURSOR 434 -#define OFFSET_XNQUERYIMVALUESLIST 441 -#define OFFSET_XNQUERYICVALUESLIST 459 -#define OFFSET_XNVISIBLEPOSITION 477 -#define OFFSET_XNSTRINGCONVERSIONCALLBACK 493 -#define OFFSET_XNSTRINGCONVERSION 518 -#define OFFSET_XNRESETSTATE 535 -#define OFFSET_XNHOTKEY 546 -#define OFFSET_XNHOTKEYSTATE 553 -#define OFFSET_XNPREEDITSTATE 565 - -/* offsets into name_table */ -static const unsigned short supported_local_im_values_list[] = { - OFFSET_XNQUERYINPUTSTYLE, - OFFSET_XNRESOURCENAME, - OFFSET_XNRESOURCECLASS, - OFFSET_XNDESTROYCALLBACK, - OFFSET_XNQUERYIMVALUESLIST, - OFFSET_XNQUERYICVALUESLIST, - OFFSET_XNVISIBLEPOSITION -}; - -/* offsets into name_table */ -static const unsigned short supported_local_ic_values_list[] = { - OFFSET_XNINPUTSTYLE, - OFFSET_XNCLIENTWINDOW, - OFFSET_XNFOCUSWINDOW, - OFFSET_XNRESOURCENAME, - OFFSET_XNRESOURCECLASS, - OFFSET_XNGEOMETRYCALLBACK, - OFFSET_XNFILTEREVENTS, - OFFSET_XNDESTROYCALLBACK, - OFFSET_XNSTRINGCONVERSIONCALLBACK, - OFFSET_XNSTRINGCONVERSIONCALLBACK, - OFFSET_XNRESETSTATE, - OFFSET_XNHOTKEY, - OFFSET_XNHOTKEYSTATE, - OFFSET_XNPREEDITATTRIBUTES, - OFFSET_XNSTATUSATTRIBUTES, - OFFSET_XNAREA, - OFFSET_XNAREANEEDED, - OFFSET_XNSPOTLOCATION, - OFFSET_XNCOLORMAP, - OFFSET_XNSTDCOLORMAP, - OFFSET_XNFOREGROUND, - OFFSET_XNBACKGROUND, - OFFSET_XNBACKGROUNDPIXMAP, - OFFSET_XNFONTSET, - OFFSET_XNLINESPACE, - OFFSET_XNCURSOR, - OFFSET_XNPREEDITSTARTCALLBACK, - OFFSET_XNPREEDITDONECALLBACK, - OFFSET_XNPREEDITDRAWCALLBACK, - OFFSET_XNPREEDITCARETCALLBACK, - OFFSET_XNSTATUSSTARTCALLBACK, - OFFSET_XNSTATUSDONECALLBACK, - OFFSET_XNSTATUSDRAWCALLBACK, - OFFSET_XNPREEDITSTATE, - OFFSET_XNPREEDITSTATENOTIFYCALLBACK -}; - -static XIMStyle const supported_local_styles[] = { - XIMPreeditNone | XIMStatusNone, - XIMPreeditNothing | XIMStatusNothing, - 0 /* dummy */ -}; - -static Bool -_XimDefaultStyles( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, /* unused */ - unsigned long mode) /* unused */ -{ - XIMStyles *styles; - XIMStyles **out; - register int i; - unsigned int n; - int len; - XPointer tmp; - - n = XIMNumber(supported_local_styles) - 1; - len = sizeof(XIMStyles) + sizeof(XIMStyle) * n; - if(!(tmp = Xcalloc(1, len))) { - return False; - } - - styles = (XIMStyles *)tmp; - if (n > 0) { - styles->count_styles = (unsigned short)n; - styles->supported_styles = - (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); - for(i = 0; i < n; i++) { - styles->supported_styles[i] = supported_local_styles[i]; - } - } - - out = (XIMStyles **)((char *)top + info->offset); - *out = styles; - return True; -} - -static Bool -_XimDefaultIMValues( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, /* unused */ - unsigned long mode) /* unused */ -{ - XIMValuesList *values_list; - XIMValuesList **out; - register int i; - unsigned int n; - int len; - XPointer tmp; - - n = XIMNumber(supported_local_im_values_list); - len = sizeof(XIMValuesList) + sizeof(char **) * n; - if(!(tmp = Xcalloc(1, len))) { - return False; - } - - values_list = (XIMValuesList *)tmp; - if (n > 0) { - values_list->count_values = (unsigned short)n; - values_list->supported_values - = (char **)((char *)tmp + sizeof(XIMValuesList)); - for(i = 0; i < n; i++) { - values_list->supported_values[i] = - (char *)name_table + supported_local_im_values_list[i]; - } - } - - out = (XIMValuesList **)((char *)top + info->offset); - *out = values_list; - return True; -} - -static Bool -_XimDefaultICValues( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, /* unused */ - unsigned long mode) /* unused */ -{ - XIMValuesList *values_list; - XIMValuesList **out; - register int i; - unsigned int n; - int len; - XPointer tmp; - - n = XIMNumber(supported_local_ic_values_list); - len = sizeof(XIMValuesList) + sizeof(char **) * n; - if(!(tmp = Xcalloc(1, len))) { - return False; - } - - values_list = (XIMValuesList *)tmp; - if (n > 0) { - values_list->count_values = (unsigned short)n; - values_list->supported_values - = (char **)((char *)tmp + sizeof(XIMValuesList)); - for(i = 0; i < n; i++) { - values_list->supported_values[i] = - (char *)name_table + supported_local_ic_values_list[i]; - } - } - - out = (XIMValuesList **)((char *)top + info->offset); - *out = values_list; - return True; -} - -static Bool -_XimDefaultVisiblePos( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, /* unused */ - unsigned long mode) /* unused */ -{ - Bool *out; - - out = (Bool *)((char *)top + info->offset); - *out = False; - return True; -} - -static Bool -_XimDefaultFocusWindow( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Window *out; - - if(ic->core.client_window == (Window)NULL) { - return True; - } - - out = (Window *)((char *)top + info->offset); - *out = ic->core.client_window; - return True; -} - -static Bool -_XimDefaultResName( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - char **out; - - if(im->core.res_name == (char *)NULL) { - return True; - } - - out = (char **)((char *)top + info->offset); - *out = im->core.res_name; - return True; -} - -static Bool -_XimDefaultResClass( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - char **out; - - if(im->core.res_class == (char *)NULL) { - return True; - } - - out = (char **)((char *)top + info->offset); - *out = im->core.res_class; - return True; -} - -static Bool -_XimDefaultDestroyCB( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - XIMCallback *out; - - out = (XIMCallback *)((char *)top + info->offset); - *out = im->core.destroy_callback; - return True; -} - -static Bool -_XimDefaultResetState( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - XIMResetState *out; - - out = (XIMResetState *)((char *)top + info->offset); - *out = XIMInitialState; - return True; -} - -static Bool -_XimDefaultHotKeyState( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - XIMHotKeyState *out; - - out = (XIMHotKeyState *)((char *)top + info->offset); - *out = XIMHotKeyStateOFF; - return True; -} - -static Bool -_XimDefaultArea( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - Window root_return; - int x_return, y_return; - unsigned int width_return, height_return; - unsigned int border_width_return; - unsigned int depth_return; - XRectangle area; - XRectangle *out; - - if(ic->core.focus_window == (Window)NULL) { - return True; - } - if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window, - &root_return, &x_return, &y_return, &width_return, - &height_return, &border_width_return, &depth_return) - == (Status)Success) { - return True; - } - area.x = 0; - area.y = 0; - area.width = width_return; - area.height = height_return; - - out = (XRectangle *)((char *)top + info->offset); - *out = area; - return True; -} - -static Bool -_XimDefaultColormap( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - XWindowAttributes win_attr; - Colormap *out; - - if(ic->core.client_window == (Window)NULL) { - return True; - } - if(XGetWindowAttributes(im->core.display, ic->core.client_window, - &win_attr) == (Status)Success) { - return True; - } - - out = (Colormap *)((char *)top + info->offset); - *out = win_attr.colormap; - return True; -} - -static Bool -_XimDefaultStdColormap( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Atom *out; - - out = (Atom *)((char *)top + info->offset); - *out = (Atom)0; - return True; -} - -static Bool -_XimDefaultFg( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - unsigned long fg; - unsigned long *out; - - fg = WhitePixel(im->core.display, DefaultScreen(im->core.display)); - out = (unsigned long *)((char *)top + info->offset); - *out = fg; - return True; -} - -static Bool -_XimDefaultBg( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - Xim im = (Xim)ic->core.im; - unsigned long bg; - unsigned long *out; - - bg = BlackPixel(im->core.display, DefaultScreen(im->core.display)); - out = (unsigned long *)((char *)top + info->offset); - *out = bg; - return True; -} - -static Bool -_XimDefaultBgPixmap( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Pixmap *out; - - out = (Pixmap *)((char *)top + info->offset); - *out = (Pixmap)0; - return True; -} - -static Bool -_XimDefaultFontSet( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - XFontSet *out; - - out = (XFontSet *)((char *)top + info->offset); - *out = 0; - return True; -} - -static Bool -_XimDefaultLineSpace( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Xic ic = (Xic)parm; - XFontSet fontset; - XFontSetExtents *fset_extents; - int line_space = 0; - int *out; - - if(mode & XIM_PREEDIT_ATTR) { - fontset = ic->core.preedit_attr.fontset; - } else if(mode & XIM_STATUS_ATTR) { - fontset = ic->core.status_attr.fontset; - } else { - return True; - } - if (fontset) { - fset_extents = XExtentsOfFontSet(fontset); - line_space = fset_extents->max_logical_extent.height; - } - out = (int *)((char *)top + info->offset); - *out = line_space; - return True; -} - -static Bool -_XimDefaultCursor( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - Cursor *out; - - out = (Cursor *)((char *)top + info->offset); - *out = (Cursor)0; - return True; -} - -static Bool -_XimDefaultPreeditState( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - XIMPreeditState *out; - - out = (XIMPreeditState *)((char *)top + info->offset); - *out = XIMPreeditDisable; - return True; -} - -static Bool -_XimDefaultNest( - XimValueOffsetInfo info, - XPointer top, - XPointer parm, - unsigned long mode) -{ - return True; -} - -static Bool -_XimEncodeCallback( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMCallback *out; - - out = (XIMCallback *)((char *)top + info->offset); - *out = *((XIMCallback *)val); - return True; -} - -static Bool -_XimEncodeString( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - char *string; - char **out; - - if(val == (XPointer)NULL) { - return False; - } - if (!(string = strdup((char *)val))) { - return False; - } - - out = (char **)((char *)top + info->offset); - if(*out) { - Xfree(*out); - } - *out = string; - return True; -} - -static Bool -_XimEncodeStyle( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMStyle *out; - - out = (XIMStyle *)((char *)top + info->offset); - *out = (XIMStyle)val; - return True; -} - -static Bool -_XimEncodeWindow( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Window *out; - - out = (Window *)((char *)top + info->offset); - *out = (Window)val; - return True; -} - -static Bool -_XimEncodeStringConv( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - /* - * Not yet - */ - return True; -} - -static Bool -_XimEncodeResetState( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMResetState *out; - - out = (XIMResetState *)((char *)top + info->offset); - *out = (XIMResetState)val; - return True; -} - -static Bool -_XimEncodeHotKey( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)val; - XIMHotKeyTriggers **out; - XIMHotKeyTriggers *key_list; - XIMHotKeyTrigger *key; - XPointer tmp; - int num; - int len; - register int i; - - if(hotkey == (XIMHotKeyTriggers *)NULL) { - return True; - } - - if((num = hotkey->num_hot_key) == 0) { - return True; - } - - len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; - if(!(tmp = Xmalloc(len))) { - return False; - } - - key_list = (XIMHotKeyTriggers *)tmp; - key = (XIMHotKeyTrigger *)((char *)tmp + sizeof(XIMHotKeyTriggers)); - - for(i = 0; i < num; i++) { - key[i] = hotkey->key[i]; - } - - key_list->num_hot_key = num; - key_list->key = key; - - out = (XIMHotKeyTriggers **)((char *)top + info->offset); - *out = key_list; - return True; -} - -static Bool -_XimEncodeHotKetState( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMHotKeyState *out; - - out = (XIMHotKeyState *)((char *)top + info->offset); - *out = (XIMHotKeyState)val; - return True; -} - -static Bool -_XimEncodeRectangle( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XRectangle *out; - - out = (XRectangle *)((char *)top + info->offset); - *out = *((XRectangle *)val); - return True; -} - -static Bool -_XimEncodeSpot( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XPoint *out; - - out = (XPoint *)((char *)top + info->offset); - *out = *((XPoint *)val); - return True; -} - -static Bool -_XimEncodeColormap( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Colormap *out; - - out = (Colormap *)((char *)top + info->offset); - *out = (Colormap)val; - return True; -} - -static Bool -_XimEncodeStdColormap( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Atom *out; - - out = (Atom *)((char *)top + info->offset); - *out = (Atom)val; - return True; -} - -static Bool -_XimEncodeLong( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - unsigned long *out; - - out = (unsigned long *)((char *)top + info->offset); - *out = (unsigned long)val; - return True; -} - -static Bool -_XimEncodeBgPixmap( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Pixmap *out; - - out = (Pixmap *)((char *)top + info->offset); - *out = (Pixmap)val; - return True; -} - -static Bool -_XimEncodeFontSet( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XFontSet *out; - - out = (XFontSet *)((char *)top + info->offset); - *out = (XFontSet)val; - return True; -} - -static Bool -_XimEncodeLineSpace( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - int *out; - - out = (int *)((char *)top + info->offset); - *out = (long)val; - return True; -} - -static Bool -_XimEncodeCursor( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Cursor *out; - - out = (Cursor *)((char *)top + info->offset); - *out = (Cursor)val; - return True; -} - -static Bool -_XimEncodePreeditState( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMPreeditState *out; - - out = (XIMPreeditState *)((char *)top + info->offset); - *out = (XIMPreeditState)val; - return True; -} - -static Bool -_XimEncodeNest( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - return True; -} - -static Bool -_XimDecodeStyles( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMStyles *styles; - XIMStyles *out; - register int i; - unsigned int num; - int len; - XPointer tmp; - - if(val == (XPointer)NULL) { - return False; - } - - styles = *((XIMStyles **)((char *)top + info->offset)); - num = styles->count_styles; - - len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; - if(!(tmp = Xcalloc(1, len))) { - return False; - } - - out = (XIMStyles *)tmp; - if(num >0) { - out->count_styles = (unsigned short)num; - out->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); - - for(i = 0; i < num; i++) { - out->supported_styles[i] = styles->supported_styles[i]; - } - } - *((XIMStyles **)val) = out; - return True; -} - -static Bool -_XimDecodeValues( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMValuesList *values_list; - XIMValuesList *out; - register int i; - unsigned int num; - int len; - XPointer tmp; - - if(val == (XPointer)NULL) { - return False; - } - - values_list = *((XIMValuesList **)((char *)top + info->offset)); - num = values_list->count_values; - - len = sizeof(XIMValuesList) + sizeof(char **) * num; - if(!(tmp = Xcalloc(1, len))) { - return False; - } - - out = (XIMValuesList *)tmp; - if(num) { - out->count_values = (unsigned short)num; - out->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); - - for(i = 0; i < num; i++) { - out->supported_values[i] = values_list->supported_values[i]; - } - } - *((XIMValuesList **)val) = out; - return True; -} - -static Bool -_XimDecodeCallback( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMCallback *in; - XIMCallback *callback; - - in = (XIMCallback *)((char *)top + info->offset); - if(!(callback = Xmalloc(sizeof(XIMCallback)))) { - return False; - } - callback->client_data = in->client_data; - callback->callback = in->callback; - - *((XIMCallback **)val) = callback; - return True; -} - -static Bool -_XimDecodeString( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - char *in; - char *string; - - in = *((char **)((char *)top + info->offset)); - if (in != NULL) { - string = strdup(in); - } else { - string = Xcalloc(1, 1); /* strdup("") */ - } - if (string == NULL) { - return False; - } - *((char **)val) = string; - return True; -} - -static Bool -_XimDecodeBool( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Bool *in; - - in = (Bool *)((char *)top + info->offset); - *((Bool *)val) = *in; - return True; -} - -static Bool -_XimDecodeStyle( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMStyle *in; - - in = (XIMStyle *)((char *)top + info->offset); - *((XIMStyle *)val) = *in; - return True; -} - -static Bool -_XimDecodeWindow( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Window *in; - - in = (Window *)((char *)top + info->offset); - *((Window *)val) = *in; - return True; -} - -static Bool -_XimDecodeStringConv( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - /* - * Not yet - */ - return True; -} - -static Bool -_XimDecodeResetState( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMResetState *in; - - in = (XIMResetState *)((char *)top + info->offset); - *((XIMResetState *)val) = *in; - return True; -} - -static Bool -_XimDecodeHotKey( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMHotKeyTriggers *in; - XIMHotKeyTriggers *hotkey; - XIMHotKeyTrigger *key; - XPointer tmp; - int num; - int len; - register int i; - - in = *((XIMHotKeyTriggers **)((char *)top + info->offset)); - num = in->num_hot_key; - len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; - if(!(tmp = Xmalloc(len))) { - return False; - } - - hotkey = (XIMHotKeyTriggers *)tmp; - key = (XIMHotKeyTrigger *)((char *)tmp + sizeof(XIMHotKeyTriggers)); - - for(i = 0; i < num; i++) { - key[i] = in->key[i]; - } - hotkey->num_hot_key = num; - hotkey->key = key; - - *((XIMHotKeyTriggers **)val) = hotkey; - return True; -} - -static Bool -_XimDecodeHotKetState( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMHotKeyState *in; - - in = (XIMHotKeyState *)((char *)top + info->offset); - *((XIMHotKeyState *)val) = *in; - return True; -} - -static Bool -_XimDecodeRectangle( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XRectangle *in; - XRectangle *rect; - - in = (XRectangle *)((char *)top + info->offset); - if(!(rect = Xmalloc(sizeof(XRectangle)))) { - return False; - } - *rect = *in; - *((XRectangle **)val) = rect; - return True; -} - -static Bool -_XimDecodeSpot( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XPoint *in; - XPoint *spot; - - in = (XPoint *)((char *)top + info->offset); - if(!(spot = Xmalloc(sizeof(XPoint)))) { - return False; - } - *spot = *in; - *((XPoint **)val) = spot; - return True; -} - -static Bool -_XimDecodeColormap( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Colormap *in; - - in = (Colormap *)((char *)top + info->offset); - *((Colormap *)val) = *in; - return True; -} - -static Bool -_XimDecodeStdColormap( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Atom *in; - - in = (Atom *)((char *)top + info->offset); - *((Atom *)val) = *in; - return True; -} - -static Bool -_XimDecodeLong( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - unsigned long *in; - - in = (unsigned long *)((char *)top + info->offset); - *((unsigned long *)val) = *in; - return True; -} - -static Bool -_XimDecodeBgPixmap( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Pixmap *in; - - in = (Pixmap *)((char *)top + info->offset); - *((Pixmap *)val) = *in; - return True; -} - -static Bool -_XimDecodeFontSet( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XFontSet *in; - - in = (XFontSet *)((char *)top + info->offset); - *((XFontSet *)val) = *in; - return True; -} - -static Bool -_XimDecodeLineSpace( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - int *in; - - in = (int *)((char *)top + info->offset); - *((int *)val) = *in; - return True; -} - -static Bool -_XimDecodeCursor( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - Cursor *in; - - in = (Cursor *)((char *)top + info->offset); - *((Cursor *)val) = *in; - return True; -} - -static Bool -_XimDecodePreeditState( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - XIMPreeditState *in; - - in = (XIMPreeditState *)((char *)top + info->offset); - *((XIMPreeditState *)val) = *in; - return True; -} - -static Bool -_XimDecodeNest( - XimValueOffsetInfo info, - XPointer top, - XPointer val) -{ - return True; -} - -static XIMResource im_resources[] = { - {XNQueryInputStyle, 0, XimType_XIMStyles, 0, 0, 0}, - {XNDestroyCallback, 0, 0, 0, 0, 0}, - {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, - {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, - {XNQueryIMValuesList, 0, 0, 0, 0, 0}, - {XNQueryICValuesList, 0, 0, 0, 0, 0}, - {XNVisiblePosition, 0, 0, 0, 0, 0} -}; - -static XIMResource im_inner_resources[] = { - {XNDestroyCallback, 0, 0, 0, 0, 0}, - {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, - {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, - {XNQueryIMValuesList, 0, 0, 0, 0, 0}, - {XNQueryICValuesList, 0, 0, 0, 0, 0}, - {XNVisiblePosition, 0, 0, 0, 0, 0} -}; - -static XIMResource ic_resources[] = { - {XNInputStyle, 0, XimType_CARD32, 0, 0, 0}, - {XNClientWindow, 0, XimType_Window, 0, 0, 0}, - {XNFocusWindow, 0, XimType_Window, 0, 0, 0}, - {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, - {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, - {XNGeometryCallback, 0, 0, 0, 0, 0}, - {XNFilterEvents, 0, XimType_CARD32, 0, 0, 0}, - {XNDestroyCallback, 0, 0, 0, 0, 0}, - {XNStringConversionCallback, 0, 0, 0, 0, 0}, - {XNStringConversion, 0, XimType_XIMStringConversion,0, 0, 0}, - {XNResetState, 0, 0, 0, 0, 0}, - {XNHotKey, 0, XimType_XIMHotKeyTriggers,0, 0, 0}, - {XNHotKeyState, 0, XimType_XIMHotKeyState, 0, 0, 0}, - {XNPreeditAttributes, 0, XimType_NEST, 0, 0, 0}, - {XNStatusAttributes, 0, XimType_NEST, 0, 0, 0}, - {XNArea, 0, XimType_XRectangle, 0, 0, 0}, - {XNAreaNeeded, 0, XimType_XRectangle, 0, 0, 0}, - {XNSpotLocation, 0, XimType_XPoint, 0, 0, 0}, - {XNColormap, 0, XimType_CARD32, 0, 0, 0}, - {XNStdColormap, 0, XimType_CARD32, 0, 0, 0}, - {XNForeground, 0, XimType_CARD32, 0, 0, 0}, - {XNBackground, 0, XimType_CARD32, 0, 0, 0}, - {XNBackgroundPixmap, 0, XimType_CARD32, 0, 0, 0}, - {XNFontSet, 0, XimType_XFontSet, 0, 0, 0}, - {XNLineSpace, 0, XimType_CARD32, 0, 0, 0}, - {XNCursor, 0, XimType_CARD32, 0, 0, 0}, - {XNPreeditStartCallback, 0, 0, 0, 0, 0}, - {XNPreeditDoneCallback, 0, 0, 0, 0, 0}, - {XNPreeditDrawCallback, 0, 0, 0, 0, 0}, - {XNPreeditCaretCallback, 0, 0, 0, 0, 0}, - {XNStatusStartCallback, 0, 0, 0, 0, 0}, - {XNStatusDoneCallback, 0, 0, 0, 0, 0}, - {XNStatusDrawCallback, 0, 0, 0, 0, 0}, - {XNPreeditState, 0, 0, 0, 0, 0}, - {XNPreeditStateNotifyCallback, 0, 0, 0, 0, 0}, -}; - -static XIMResource ic_inner_resources[] = { - {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, - {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, - {XNGeometryCallback, 0, 0, 0, 0, 0}, - {XNDestroyCallback, 0, 0, 0, 0, 0}, - {XNStringConversionCallback, 0, 0, 0, 0, 0}, - {XNPreeditStartCallback, 0, 0, 0, 0, 0}, - {XNPreeditDoneCallback, 0, 0, 0, 0, 0}, - {XNPreeditDrawCallback, 0, 0, 0, 0, 0}, - {XNPreeditCaretCallback, 0, 0, 0, 0, 0}, - {XNStatusStartCallback, 0, 0, 0, 0, 0}, - {XNStatusDoneCallback, 0, 0, 0, 0, 0}, - {XNStatusDrawCallback, 0, 0, 0, 0, 0}, - {XNPreeditStateNotifyCallback, 0, 0, 0, 0, 0}, -}; - -static XimValueOffsetInfoRec im_attr_info[] = { - {OFFSET_XNQUERYINPUTSTYLE, 0, - XOffsetOf(XimDefIMValues, styles), - _XimDefaultStyles, NULL, _XimDecodeStyles}, - - {OFFSET_XNDESTROYCALLBACK, 0, - XOffsetOf(XimDefIMValues, destroy_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNRESOURCENAME, 0, - XOffsetOf(XimDefIMValues, res_name), - NULL, _XimEncodeString, _XimDecodeString}, - - {OFFSET_XNRESOURCECLASS, 0, - XOffsetOf(XimDefIMValues, res_class), - NULL, _XimEncodeString, _XimDecodeString}, - - {OFFSET_XNQUERYIMVALUESLIST, 0, - XOffsetOf(XimDefIMValues, im_values_list), - _XimDefaultIMValues, NULL, _XimDecodeValues}, - - {OFFSET_XNQUERYICVALUESLIST, 0, - XOffsetOf(XimDefIMValues, ic_values_list), - _XimDefaultICValues, NULL, _XimDecodeValues}, - - {OFFSET_XNVISIBLEPOSITION, 0, - XOffsetOf(XimDefIMValues, visible_position), - _XimDefaultVisiblePos, NULL, _XimDecodeBool} -}; - -static XimValueOffsetInfoRec ic_attr_info[] = { - {OFFSET_XNINPUTSTYLE, 0, - XOffsetOf(XimDefICValues, input_style), - NULL, _XimEncodeStyle, _XimDecodeStyle}, - - {OFFSET_XNCLIENTWINDOW, 0, - XOffsetOf(XimDefICValues, client_window), - NULL, _XimEncodeWindow, _XimDecodeWindow}, - - {OFFSET_XNFOCUSWINDOW, 0, - XOffsetOf(XimDefICValues, focus_window), - _XimDefaultFocusWindow, _XimEncodeWindow, _XimDecodeWindow}, - - {OFFSET_XNRESOURCENAME, 0, - XOffsetOf(XimDefICValues, res_name), - _XimDefaultResName, _XimEncodeString, _XimDecodeString}, - - {OFFSET_XNRESOURCECLASS, 0, - XOffsetOf(XimDefICValues, res_class), - _XimDefaultResClass, _XimEncodeString, _XimDecodeString}, - - {OFFSET_XNGEOMETRYCALLBACK, 0, - XOffsetOf(XimDefICValues, geometry_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNFILTEREVENTS, 0, - XOffsetOf(XimDefICValues, filter_events), - NULL, NULL, _XimDecodeLong}, - - {OFFSET_XNDESTROYCALLBACK, 0, - XOffsetOf(XimDefICValues, destroy_callback), - _XimDefaultDestroyCB, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNSTRINGCONVERSIONCALLBACK, 0, - XOffsetOf(XimDefICValues, string_conversion_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNSTRINGCONVERSION, 0, - XOffsetOf(XimDefICValues, string_conversion), - NULL, _XimEncodeStringConv, _XimDecodeStringConv}, - - {OFFSET_XNRESETSTATE, 0, - XOffsetOf(XimDefICValues, reset_state), - _XimDefaultResetState, _XimEncodeResetState, _XimDecodeResetState}, - - {OFFSET_XNHOTKEY, 0, - XOffsetOf(XimDefICValues, hotkey), - NULL, _XimEncodeHotKey, _XimDecodeHotKey}, - - {OFFSET_XNHOTKEYSTATE, 0, - XOffsetOf(XimDefICValues, hotkey_state), - _XimDefaultHotKeyState, _XimEncodeHotKetState, _XimDecodeHotKetState}, - - {OFFSET_XNPREEDITATTRIBUTES, 0, - XOffsetOf(XimDefICValues, preedit_attr), - _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, - - {OFFSET_XNSTATUSATTRIBUTES, 0, - XOffsetOf(XimDefICValues, status_attr), - _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, -}; - -static XimValueOffsetInfoRec ic_pre_attr_info[] = { - {OFFSET_XNAREA, 0, - XOffsetOf(ICPreeditAttributes, area), - _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, - - {OFFSET_XNAREANEEDED, 0, - XOffsetOf(ICPreeditAttributes, area_needed), - NULL, _XimEncodeRectangle, _XimDecodeRectangle}, - - {OFFSET_XNSPOTLOCATION, 0, - XOffsetOf(ICPreeditAttributes, spot_location), - NULL, _XimEncodeSpot, _XimDecodeSpot}, - - {OFFSET_XNCOLORMAP, 0, - XOffsetOf(ICPreeditAttributes, colormap), - _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, - - {OFFSET_XNSTDCOLORMAP, 0, - XOffsetOf(ICPreeditAttributes, std_colormap), - _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, - - {OFFSET_XNFOREGROUND, 0, - XOffsetOf(ICPreeditAttributes, foreground), - _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, - - {OFFSET_XNBACKGROUND, 0, - XOffsetOf(ICPreeditAttributes, background), - _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, - - {OFFSET_XNBACKGROUNDPIXMAP, 0, - XOffsetOf(ICPreeditAttributes, background_pixmap), - _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, - - {OFFSET_XNFONTSET, 0, - XOffsetOf(ICPreeditAttributes, fontset), - _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, - - {OFFSET_XNLINESPACE, 0, - XOffsetOf(ICPreeditAttributes, line_spacing), - _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, - - {OFFSET_XNCURSOR, 0, - XOffsetOf(ICPreeditAttributes, cursor), - _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, - - {OFFSET_XNPREEDITSTARTCALLBACK, 0, - XOffsetOf(ICPreeditAttributes, start_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNPREEDITDONECALLBACK, 0, - XOffsetOf(ICPreeditAttributes, done_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNPREEDITDRAWCALLBACK, 0, - XOffsetOf(ICPreeditAttributes, draw_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNPREEDITCARETCALLBACK, 0, - XOffsetOf(ICPreeditAttributes, caret_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNPREEDITSTATE, 0, - XOffsetOf(ICPreeditAttributes, preedit_state), - _XimDefaultPreeditState, _XimEncodePreeditState,_XimDecodePreeditState}, - - {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, 0, - XOffsetOf(ICPreeditAttributes, state_notify_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, -}; - -static XimValueOffsetInfoRec ic_sts_attr_info[] = { - {OFFSET_XNAREA, 0, - XOffsetOf(ICStatusAttributes, area), - _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, - - {OFFSET_XNAREANEEDED, 0, - XOffsetOf(ICStatusAttributes, area_needed), - NULL, _XimEncodeRectangle, _XimDecodeRectangle}, - - {OFFSET_XNCOLORMAP, 0, - XOffsetOf(ICStatusAttributes, colormap), - _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, - - {OFFSET_XNSTDCOLORMAP, 0, - XOffsetOf(ICStatusAttributes, std_colormap), - _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, - - {OFFSET_XNFOREGROUND, 0, - XOffsetOf(ICStatusAttributes, foreground), - _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, - - {OFFSET_XNBACKGROUND, 0, - XOffsetOf(ICStatusAttributes, background), - _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, - - {OFFSET_XNBACKGROUNDPIXMAP, 0, - XOffsetOf(ICStatusAttributes, background_pixmap), - _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, - - {OFFSET_XNFONTSET, 0, - XOffsetOf(ICStatusAttributes, fontset), - _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, - - {OFFSET_XNLINESPACE, 0, - XOffsetOf(ICStatusAttributes, line_spacing), - _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, - - {OFFSET_XNCURSOR, 0, - XOffsetOf(ICStatusAttributes, cursor), - _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, - - {OFFSET_XNSTATUSSTARTCALLBACK, 0, - XOffsetOf(ICStatusAttributes, start_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNSTATUSDONECALLBACK, 0, - XOffsetOf(ICStatusAttributes, done_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback}, - - {OFFSET_XNSTATUSDRAWCALLBACK, 0, - XOffsetOf(ICStatusAttributes, draw_callback), - NULL, _XimEncodeCallback, _XimDecodeCallback} -}; - -typedef struct _XimIMMode { - unsigned short name_offset; - unsigned short mode; -} XimIMMode; - -static const XimIMMode im_mode[] = { - {OFFSET_XNQUERYINPUTSTYLE, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, - {OFFSET_XNDESTROYCALLBACK, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, - {OFFSET_XNRESOURCENAME, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, - {OFFSET_XNRESOURCECLASS, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, - {OFFSET_XNQUERYIMVALUESLIST, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, - {OFFSET_XNQUERYICVALUESLIST, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, - {OFFSET_XNVISIBLEPOSITION, - (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)} -}; - -typedef struct _XimICMode { - unsigned short name_offset; - unsigned short preedit_callback_mode; - unsigned short preedit_position_mode; - unsigned short preedit_area_mode; - unsigned short preedit_nothing_mode; - unsigned short preedit_none_mode; - unsigned short status_callback_mode; - unsigned short status_area_mode; - unsigned short status_nothing_mode; - unsigned short status_none_mode; -} XimICMode; - -static const XimICMode ic_mode[] = { - {OFFSET_XNINPUTSTYLE, - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), - (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), - (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), - (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), - (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET)}, - {OFFSET_XNCLIENTWINDOW, - (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), - 0, - (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), - (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), - (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNFOCUSWINDOW, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNRESOURCENAME, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNRESOURCECLASS, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNGEOMETRYCALLBACK, - 0, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0, - 0}, - {OFFSET_XNFILTEREVENTS, - XIM_MODE_PRE_GET, - XIM_MODE_PRE_GET, - XIM_MODE_PRE_GET, - XIM_MODE_PRE_GET, - 0, - XIM_MODE_STS_GET, - XIM_MODE_STS_GET, - XIM_MODE_STS_GET, - XIM_MODE_STS_GET}, - {OFFSET_XNDESTROYCALLBACK, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0}, - {OFFSET_XNSTRINGCONVERSIONCALLBACK, - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0}, - {OFFSET_XNSTRINGCONVERSION, - XIM_MODE_PRE_SET, - XIM_MODE_PRE_SET, - XIM_MODE_PRE_SET, - XIM_MODE_PRE_SET, - XIM_MODE_PRE_SET, - 0, - 0, - 0, - 0}, - {OFFSET_XNRESETSTATE, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNHOTKEY, - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNHOTKEYSTATE, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNPREEDITATTRIBUTES, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNSTATUSATTRIBUTES, - 0, - 0, - 0, - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNAREA, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0, - 0}, - {OFFSET_XNAREANEEDED, - 0, - 0, - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - (XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0, - 0}, - {OFFSET_XNSPOTLOCATION, - 0, /*(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),*/ - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0}, - {OFFSET_XNCOLORMAP, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNSTDCOLORMAP, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNFOREGROUND, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNBACKGROUND, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNBACKGROUNDPIXMAP, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNFONTSET, - 0, - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNLINESPACE, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNCURSOR, - 0, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0}, - {OFFSET_XNPREEDITSTARTCALLBACK, - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNPREEDITDONECALLBACK, - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNPREEDITDRAWCALLBACK, - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNPREEDITCARETCALLBACK, - (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNPREEDITSTATE, - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), - 0, - 0, - 0, - 0, - 0}, - {OFFSET_XNSTATUSSTARTCALLBACK, - 0, - 0, - 0, - 0, - 0, - (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0, - 0, - 0}, - {OFFSET_XNSTATUSDONECALLBACK, - 0, - 0, - 0, - 0, - 0, - (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0, - 0, - 0}, - {OFFSET_XNSTATUSDRAWCALLBACK, - 0, - 0, - 0, - 0, - 0, - (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), - 0, - 0, - 0} -}; - -/* the quarks are separated from im_mode/ic_mode so those arrays - * can be const. - */ -static XrmQuark im_mode_quark[sizeof(im_mode) / sizeof(im_mode[0])]; -static XrmQuark ic_mode_quark[sizeof(ic_mode) / sizeof(ic_mode[0])]; - -static Bool -_XimSetResourceList( - XIMResourceList *res_list, - unsigned int *list_num, - XIMResourceList resource, - unsigned int num_resource, - unsigned short id) -{ - register int i; - int len; - XIMResourceList res; - - len = sizeof(XIMResource) * num_resource; - if(!(res = Xcalloc(1, len))) { - return False; - } - - for(i = 0; i < num_resource; i++, id++) { - res[i] = resource[i]; - res[i].id = id; - } - - _XIMCompileResourceList(res, num_resource); - *res_list = res; - *list_num = num_resource; - return True; -} - -Bool -_XimSetIMResourceList( - XIMResourceList *res_list, - unsigned int *list_num) -{ - return _XimSetResourceList(res_list, list_num, - im_resources, XIMNumber(im_resources), 100); -} - -Bool -_XimSetICResourceList( - XIMResourceList *res_list, - unsigned int *list_num) -{ - return _XimSetResourceList(res_list, list_num, - ic_resources, XIMNumber(ic_resources), 200); -} - -Bool -_XimSetInnerIMResourceList( - XIMResourceList *res_list, - unsigned int *list_num) -{ - return _XimSetResourceList(res_list, list_num, - im_inner_resources, XIMNumber(im_inner_resources), 100); -} - -Bool -_XimSetInnerICResourceList( - XIMResourceList *res_list, - unsigned int *list_num) -{ - return _XimSetResourceList(res_list, list_num, - ic_inner_resources, XIMNumber(ic_inner_resources), 200); -} - -static XIMResourceList -_XimGetResourceListRecByMode( - XIMResourceList res_list, - unsigned int list_num, - unsigned short mode) -{ - register int i; - - for(i = 0; i < list_num; i++) { - if (res_list[i].mode & mode) { - return (XIMResourceList)&res_list[i]; - } - } - return (XIMResourceList)NULL; -} - -Bool -_XimCheckCreateICValues( - XIMResourceList res_list, - unsigned int list_num) -{ - if (!_XimGetResourceListRecByMode(res_list, list_num, XIM_MODE_IC_CREATE)) { - return True; - } - return False; -} - -XIMResourceList -_XimGetResourceListRecByQuark( - XIMResourceList res_list, - unsigned int list_num, - XrmQuark quark) -{ - register int i; - - for(i = 0; i < list_num; i++) { - if (res_list[i].xrm_name == quark) { - return (XIMResourceList)&res_list[i]; - } - } - return (XIMResourceList)NULL; -} - -XIMResourceList -_XimGetResourceListRec( - XIMResourceList res_list, - unsigned int list_num, - const char *name) -{ - XrmQuark quark = XrmStringToQuark(name); - - return _XimGetResourceListRecByQuark(res_list, list_num, quark); -} - -char * -_XimSetIMValueData( - Xim im, - XPointer top, - XIMArg *values, - XIMResourceList res_list, - unsigned int list_num) -{ - register XIMArg *p; - XIMResourceList res; - int check; - - for(p = values; p->name != NULL; p++) { - if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { - return p->name; - } - check = _XimCheckIMMode(res, XIM_SETIMVALUES); - if(check == XIM_CHECK_INVALID) { - continue; - } else if (check == XIM_CHECK_ERROR) { - return p->name; - } - - if(!_XimEncodeLocalIMAttr(res, top, p->value)) { - return p->name; - } - } - return NULL; -} - -char * -_XimGetIMValueData( - Xim im, - XPointer top, - XIMArg *values, - XIMResourceList res_list, - unsigned int list_num) -{ - register XIMArg *p; - XIMResourceList res; - int check; - - for(p = values; p->name != NULL; p++) { - if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { - return p->name; - } - check = _XimCheckIMMode(res, XIM_GETIMVALUES); - if(check == XIM_CHECK_INVALID) { - continue; - } else if (check == XIM_CHECK_ERROR) { - return p->name; - } - - if(!_XimDecodeLocalIMAttr(res, top, p->value)) { - return p->name; - } - } - return NULL; -} - -void -_XimSetIMMode( - XIMResourceList res_list, - unsigned int list_num) -{ - XIMResourceList res; - unsigned int n = XIMNumber(im_mode); - register int i; - - for(i = 0; i < n; i++) { - if(!(res = _XimGetResourceListRecByQuark(res_list, - list_num, im_mode_quark[i]))) { - continue; - } - res->mode = im_mode[i].mode; - } - return; -} - -static int -_XimCheckSetIMDefaultsMode( - XIMResourceList res) -{ - if(res->mode & XIM_MODE_IM_DEFAULT) { - return XIM_CHECK_VALID; - } - return XIM_CHECK_INVALID; -} - -static int -_XimCheckSetIMValuesMode( - XIMResourceList res) -{ - if(res->mode & XIM_MODE_IM_SET) { - return XIM_CHECK_VALID; - } - return XIM_CHECK_INVALID; -} - -static int - _XimCheckGetIMValuesMode( - XIMResourceList res) -{ - if(res->mode & XIM_MODE_IM_GET) { - return XIM_CHECK_VALID; - } - return XIM_CHECK_INVALID; -} - -int - _XimCheckIMMode( - XIMResourceList res, - unsigned long mode) -{ - if(res->mode == 0) { - return XIM_CHECK_INVALID; - } - if(mode & XIM_SETIMDEFAULTS) { - return _XimCheckSetIMDefaultsMode(res); - } else if (mode & XIM_SETIMVALUES) { - return _XimCheckSetIMValuesMode(res); - } else if (mode & XIM_GETIMVALUES) { - return _XimCheckGetIMValuesMode(res); - } else { - return XIM_CHECK_ERROR; - } -} - -void -_XimSetICMode(XIMResourceList res_list, unsigned int list_num, XIMStyle style) -{ - XIMResourceList res; - unsigned int n = XIMNumber(ic_mode); - register int i; - unsigned int pre_offset; - unsigned int sts_offset; - - if(style & XIMPreeditArea) { - pre_offset = XOffsetOf(XimICMode, preedit_area_mode); - } else if(style & XIMPreeditCallbacks) { - pre_offset = XOffsetOf(XimICMode, preedit_callback_mode); - } else if(style & XIMPreeditPosition) { - pre_offset = XOffsetOf(XimICMode, preedit_position_mode); - } else if(style & XIMPreeditNothing) { - pre_offset = XOffsetOf(XimICMode, preedit_nothing_mode); - } else { - pre_offset = XOffsetOf(XimICMode, preedit_none_mode); - } - - if(style & XIMStatusArea) { - sts_offset = XOffsetOf(XimICMode, status_area_mode); - } else if(style & XIMStatusCallbacks) { - sts_offset = XOffsetOf(XimICMode, status_callback_mode); - } else if(style & XIMStatusNothing) { - sts_offset = XOffsetOf(XimICMode, status_nothing_mode); - } else { - sts_offset = XOffsetOf(XimICMode, status_none_mode); - } - - for(i = 0; i < n; i++) { - if(!(res = _XimGetResourceListRecByQuark(res_list, - list_num, ic_mode_quark[i]))) { - continue; - } - res->mode = ( (*(const unsigned short *)((const char *)&ic_mode[i] + pre_offset)) - | (*(const unsigned short *)((const char *)&ic_mode[i] + sts_offset))); - } - return; -} - -static int -_XimCheckSetICDefaultsMode( - XIMResourceList res, - unsigned long mode) -{ - if(mode & XIM_PREEDIT_ATTR) { - if(!(res->mode & XIM_MODE_PRE_MASK)) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_PRE_CREATE) { - return XIM_CHECK_ERROR; - } else if (!(res->mode & XIM_MODE_PRE_DEFAULT)) { - return XIM_CHECK_INVALID; - } - - } else if(mode & XIM_STATUS_ATTR) { - if(!(res->mode & XIM_MODE_STS_MASK)) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_STS_CREATE) { - return XIM_CHECK_ERROR; - } - if(!(res->mode & XIM_MODE_STS_DEFAULT)) { - return XIM_CHECK_INVALID; - } - - } else { - if(!res->mode) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_IC_CREATE) { - return XIM_CHECK_ERROR; - } - if(!(res->mode & XIM_MODE_IC_DEFAULT)) { - return XIM_CHECK_INVALID; - } - } - return XIM_CHECK_VALID; -} - -static int -_XimCheckCreateICMode( - XIMResourceList res, - unsigned long mode) -{ - if(mode & XIM_PREEDIT_ATTR) { - if(!(res->mode & XIM_MODE_PRE_MASK)) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_PRE_CREATE) { - res->mode &= ~XIM_MODE_PRE_CREATE; - } else if(res->mode & XIM_MODE_PRE_ONCE) { - res->mode &= ~XIM_MODE_PRE_ONCE; - } else if(res->mode & XIM_MODE_PRE_DEFAULT) { - res->mode &= ~XIM_MODE_PRE_DEFAULT; - } else if (!(res->mode & XIM_MODE_PRE_SET)) { - return XIM_CHECK_ERROR; - } - - } else if(mode & XIM_STATUS_ATTR) { - if(!(res->mode & XIM_MODE_STS_MASK)) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_STS_CREATE) { - res->mode &= ~XIM_MODE_STS_CREATE; - } else if(res->mode & XIM_MODE_STS_ONCE) { - res->mode &= ~XIM_MODE_STS_ONCE; - } else if(res->mode & XIM_MODE_STS_DEFAULT) { - res->mode &= ~XIM_MODE_STS_DEFAULT; - } else if (!(res->mode & XIM_MODE_STS_SET)) { - return XIM_CHECK_ERROR; - } - - } else { - if(!res->mode) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_IC_CREATE) { - res->mode &= ~XIM_MODE_IC_CREATE; - } else if(res->mode & XIM_MODE_IC_ONCE) { - res->mode &= ~XIM_MODE_IC_ONCE; - } else if(res->mode & XIM_MODE_IC_DEFAULT) { - res->mode &= ~XIM_MODE_IC_DEFAULT; - } else if (!(res->mode & XIM_MODE_IC_SET)) { - return XIM_CHECK_ERROR; - } - } - return XIM_CHECK_VALID; -} - -static int -_XimCheckSetICValuesMode( - XIMResourceList res, - unsigned long mode) -{ - if(mode & XIM_PREEDIT_ATTR) { - if(!(res->mode & XIM_MODE_PRE_MASK)) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_PRE_ONCE) { - res->mode &= ~XIM_MODE_PRE_ONCE; - } else if(!(res->mode & XIM_MODE_PRE_SET)) { - return XIM_CHECK_ERROR; - } - - } else if(mode & XIM_STATUS_ATTR) { - if(!(res->mode & XIM_MODE_STS_MASK)) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_STS_ONCE) { - res->mode &= ~XIM_MODE_STS_ONCE; - } else if(!(res->mode & XIM_MODE_STS_SET)) { - return XIM_CHECK_ERROR; - } - - } else { - if(!res->mode) { - return XIM_CHECK_INVALID; - } - - if(res->mode & XIM_MODE_IC_ONCE) { - res->mode &= ~XIM_MODE_IC_ONCE; - } else if(!(res->mode & XIM_MODE_IC_SET)) { - return XIM_CHECK_ERROR; - } - } - return XIM_CHECK_VALID; -} - -static int -_XimCheckGetICValuesMode( - XIMResourceList res, - unsigned long mode) -{ - if(mode & XIM_PREEDIT_ATTR) { - if(!(res->mode & XIM_MODE_PRE_MASK)) { - return XIM_CHECK_INVALID; - } - - if(!(res->mode & XIM_MODE_PRE_GET)) { - return XIM_CHECK_ERROR; - } - - } else if(mode & XIM_STATUS_ATTR) { - if(!(res->mode & XIM_MODE_STS_MASK)) { - return XIM_CHECK_INVALID; - } - - if(!(res->mode & XIM_MODE_STS_GET)) { - return XIM_CHECK_ERROR; - } - - } else { - if(!res->mode) { - return XIM_CHECK_INVALID; - } - - if(!(res->mode & XIM_MODE_IC_GET)) { - return XIM_CHECK_ERROR; - } - } - return XIM_CHECK_VALID; -} - -int - _XimCheckICMode( - XIMResourceList res, - unsigned long mode) -{ - if(mode &XIM_SETICDEFAULTS) { - return _XimCheckSetICDefaultsMode(res, mode); - } else if (mode & XIM_CREATEIC) { - return _XimCheckCreateICMode(res, mode); - } else if (mode & XIM_SETICVALUES) { - return _XimCheckSetICValuesMode(res, mode); - } else if (mode & XIM_GETICVALUES) { - return _XimCheckGetICValuesMode(res, mode); - } else { - return XIM_CHECK_ERROR; - } -} - -Bool -_XimSetLocalIMDefaults( - Xim im, - XPointer top, - XIMResourceList res_list, - unsigned int list_num) -{ - XimValueOffsetInfo info; - unsigned int num; - register int i; - XIMResourceList res; - int check; - - info = im_attr_info; - num = XIMNumber(im_attr_info); - - for(i = 0; i < num; i++) { - if((res = _XimGetResourceListRecByQuark( res_list, list_num, - info[i].quark)) == (XIMResourceList)NULL) { - return False; - } - - check = _XimCheckIMMode(res, XIM_SETIMDEFAULTS); - if(check == XIM_CHECK_INVALID) { - continue; - } else if (check == XIM_CHECK_ERROR) { - return False; - } - - if(!info[i].defaults) { - continue; - } - if(!(info[i].defaults(&info[i], top, (XPointer)NULL, 0))) { - return False; - } - } - return True; -} - -Bool -_XimSetICDefaults( - Xic ic, - XPointer top, - unsigned long mode, - XIMResourceList res_list, - unsigned int list_num) -{ - unsigned int num; - XimValueOffsetInfo info; - register int i; - XIMResourceList res; - int check; - XrmQuark pre_quark; - XrmQuark sts_quark; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - - if(mode & XIM_PREEDIT_ATTR) { - info = ic_pre_attr_info; - num = XIMNumber(ic_pre_attr_info); - } else if(mode & XIM_STATUS_ATTR) { - info = ic_sts_attr_info; - num = XIMNumber(ic_sts_attr_info); - } else { - info = ic_attr_info; - num = XIMNumber(ic_attr_info); - } - - for(i = 0; i < num; i++) { - if(info[i].quark == pre_quark) { - if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), - (mode | XIM_PREEDIT_ATTR), res_list, list_num)) { - return False; - } - } else if (info[i].quark == sts_quark) { - if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), - (mode | XIM_STATUS_ATTR), res_list, list_num)) { - return False; - } - } else { - if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, - info[i].quark))) { - return False; - } - - check = _XimCheckICMode(res, mode); - if (check == XIM_CHECK_INVALID) { - continue; - } else if (check == XIM_CHECK_ERROR) { - return False; - } - - if (!info[i].defaults) { - continue; - } - if (!(info[i].defaults(&info[i], top, (XPointer)ic, mode))) { - return False; - } - } - } - return True; -} - -static Bool -_XimEncodeAttr( - XimValueOffsetInfo info, - unsigned int num, - XIMResourceList res, - XPointer top, - XPointer val) -{ - register int i; - - for(i = 0; i < num; i++ ) { - if(info[i].quark == res->xrm_name) { - if(!info[i].encode) { - return False; - } - return (*info[i].encode)(&info[i], top, val); - } - } - return False; -} - -Bool -_XimEncodeLocalIMAttr( - XIMResourceList res, - XPointer top, - XPointer val) -{ - return _XimEncodeAttr(im_attr_info, XIMNumber(im_attr_info), - res, top, val); -} - -Bool -_XimEncodeLocalICAttr( - Xic ic, - XIMResourceList res, - XPointer top, - XIMArg *arg, - unsigned long mode) -{ - unsigned int num; - XimValueOffsetInfo info; - - if(mode & XIM_PREEDIT_ATTR) { - info = ic_pre_attr_info; - num = XIMNumber(ic_pre_attr_info); - } else if(mode & XIM_STATUS_ATTR) { - info = ic_sts_attr_info; - num = XIMNumber(ic_sts_attr_info); - } else { - info = ic_attr_info; - num = XIMNumber(ic_attr_info); - } - - return _XimEncodeAttr(info, num, res, top, arg->value); -} - -static Bool -_XimEncodeLocalTopValue( - Xic ic, - XIMResourceList res, - XPointer val, - Bool flag) -{ - XIMArg *p = (XIMArg *)val; - - if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { - ic->core.client_window = (Window)p->value; - if (ic->core.focus_window == (Window)0) - ic->core.focus_window = ic->core.client_window; - if (flag) { - _XRegisterFilterByType(ic->core.im->core.display, - ic->core.focus_window, - KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); - } - } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { - if (ic->core.client_window) { - if (flag) { - _XUnregisterFilter(ic->core.im->core.display, - ic->core.focus_window, _XimLocalFilter, (XPointer)ic); - } - ic->core.focus_window = (Window)p->value; - if (flag) { - _XRegisterFilterByType(ic->core.im->core.display, - ic->core.focus_window, KeyPress, KeyRelease, - _XimLocalFilter, (XPointer)ic); - } - } else - ic->core.focus_window = (Window)p->value; - } - return True; -} - -static Bool -_XimEncodeLocalPreeditValue( - Xic ic, - XIMResourceList res, - XPointer val) -{ - XIMArg *p = (XIMArg *)val; - - if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { - XStandardColormap *colormap_ret; - int count; - - if (!(XGetRGBColormaps(ic->core.im->core.display, - ic->core.focus_window, &colormap_ret, - &count, (Atom)p->value))) - return False; - - Xfree(colormap_ret); - } - return True; -} - -static Bool -_XimEncodeLocalStatusValue( - Xic ic, - XIMResourceList res, - XPointer val) -{ - XIMArg *p = (XIMArg *)val; - - if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { - XStandardColormap *colormap_ret; - int count; - - if (!(XGetRGBColormaps(ic->core.im->core.display, - ic->core.focus_window, &colormap_ret, - &count, (Atom)p->value))) - return False; - - Xfree(colormap_ret); - } - return True; -} - -char * -_XimSetICValueData( - Xic ic, - XPointer top, - XIMResourceList res_list, - unsigned int list_num, - XIMArg *values, - unsigned long mode, - Bool flag) -{ - register XIMArg *p; - XIMResourceList res; - char *name; - int check; - XrmQuark pre_quark; - XrmQuark sts_quark; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - - for(p = values; p->name != NULL; p++) { - if((res = _XimGetResourceListRec(res_list, list_num, - p->name)) == (XIMResourceList)NULL) { - return p->name; - } - if(res->xrm_name == pre_quark) { - if(((name = _XimSetICValueData(ic, - (XPointer)(&((XimDefICValues *)top)->preedit_attr), - res_list, list_num, (XIMArg *)p->value, - (mode | XIM_PREEDIT_ATTR), flag)))) { - return name; - } - } else if(res->xrm_name == sts_quark) { - if(((name = _XimSetICValueData(ic, - (XPointer)(&((XimDefICValues *)top)->status_attr), - res_list, list_num, (XIMArg *)p->value, - (mode | XIM_STATUS_ATTR), flag)))) { - return name; - } - } else { - check = _XimCheckICMode(res, mode); - if(check == XIM_CHECK_INVALID) { - continue; - } else if(check == XIM_CHECK_ERROR) { - return p->name; - } - - if(mode & XIM_PREEDIT_ATTR) { - if (!_XimEncodeLocalPreeditValue(ic, res, (XPointer)p)) - return p->name; - } else if(mode & XIM_STATUS_ATTR) { - if (!_XimEncodeLocalStatusValue(ic, res, (XPointer)p)) - return p->name; - } else { - if (!_XimEncodeLocalTopValue(ic, res, (XPointer)p, flag)) - return p->name; - } - if(_XimEncodeLocalICAttr(ic, res, top, p, mode) == False) { - return p->name; - } - } - } - return NULL; -} - -static Bool -_XimCheckInputStyle( - XIMStyles *styles, - XIMStyle style) -{ - int num = styles->count_styles; - register int i; - - for(i = 0; i < num; i++) { - if(styles->supported_styles[i] == style) { - return True; - } - } - return False; -} - -Bool -_XimCheckLocalInputStyle( - Xic ic, - XPointer top, - XIMArg *values, - XIMStyles *styles, - XIMResourceList res_list, - unsigned int list_num) -{ - XrmQuark quark = XrmStringToQuark(XNInputStyle); - register XIMArg *p; - XIMResourceList res; - - for(p = values; p && p->name != NULL; p++) { - if(quark == XrmStringToQuark(p->name)) { - if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { - return False; - } - if(!_XimEncodeLocalICAttr(ic, res, top, p, 0)) { - return False; - } - if (_XimCheckInputStyle(styles, - ((XimDefICValues *)top)->input_style)) { - return True; - } - return False; - } - } - return False; -} - -static Bool -_XimDecodeAttr( - XimValueOffsetInfo info, - unsigned int num, - XIMResourceList res, - XPointer top, - XPointer val) -{ - register int i; - - for(i = 0; i < num; i++ ) { - if(info[i].quark == res->xrm_name) { - if(!info[i].decode) { - return False; - } - return (*info[i].decode)(&info[i], top, val); - } - } - return False; -} - -Bool -_XimDecodeLocalIMAttr( - XIMResourceList res, - XPointer top, - XPointer val) -{ - return _XimDecodeAttr(im_attr_info, XIMNumber(im_attr_info), - res, top, val); -} - -Bool -_XimDecodeLocalICAttr( - XIMResourceList res, - XPointer top, - XPointer val, - unsigned long mode) -{ - unsigned int num; - XimValueOffsetInfo info; - - if(mode & XIM_PREEDIT_ATTR) { - info = ic_pre_attr_info; - num = XIMNumber(ic_pre_attr_info); - } else if(mode & XIM_STATUS_ATTR) { - info = ic_sts_attr_info; - num = XIMNumber(ic_sts_attr_info); - } else { - info = ic_attr_info; - num = XIMNumber(ic_attr_info); - } - - return _XimDecodeAttr(info, num, res, top, val); -} - -char * -_XimGetICValueData(Xic ic, XPointer top, XIMResourceList res_list, - unsigned int list_num, XIMArg *values, unsigned long mode) -{ - register XIMArg *p; - XIMResourceList res; - char *name; - int check; - XrmQuark pre_quark; - XrmQuark sts_quark; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - - for(p = values; p->name != NULL; p++) { - if((res = _XimGetResourceListRec(res_list, list_num, - p->name)) == (XIMResourceList)NULL) { - return p->name; - } - if(res->xrm_name == pre_quark) { - if((name = _XimGetICValueData(ic, - (XPointer)(&((XimDefICValues *)top)->preedit_attr), - res_list, list_num, (XIMArg *)p->value, - (mode | XIM_PREEDIT_ATTR)))) { - return name; - } - } else if(res->xrm_name == sts_quark) { - if((name = _XimGetICValueData(ic, - (XPointer)(&((XimDefICValues *)top)->status_attr), - res_list, list_num, (XIMArg *)p->value, - (mode | XIM_STATUS_ATTR)))) { - return name; - } - } else { - check = _XimCheckICMode(res, mode); - if(check == XIM_CHECK_INVALID) { - continue; - } else if(check == XIM_CHECK_ERROR) { - return p->name; - } - - if(_XimDecodeLocalICAttr(res, top, p->value, mode) == False) { - return p->name; - } - } - } - return NULL; -} - -void -_XimGetCurrentIMValues(Xim im, XimDefIMValues *im_values) -{ - bzero((char *)im_values, sizeof(XimDefIMValues)); - - im_values->styles = im->core.styles; - im_values->im_values_list = im->core.im_values_list; - im_values->ic_values_list = im->core.ic_values_list; - im_values->destroy_callback = im->core.destroy_callback; - im_values->res_name = im->core.res_name; - im_values->res_class = im->core.res_class; - im_values->visible_position = im->core.visible_position; -} - -void -_XimSetCurrentIMValues(Xim im, XimDefIMValues *im_values) -{ - im->core.styles = im_values->styles; - im->core.im_values_list = im_values->im_values_list; - im->core.ic_values_list = im_values->ic_values_list; - im->core.destroy_callback = im_values->destroy_callback; - im->core.res_name = im_values->res_name; - im->core.res_class = im_values->res_class; - im->core.visible_position = im_values->visible_position; -} - -void -_XimGetCurrentICValues(Xic ic, XimDefICValues *ic_values) -{ - bzero((char *)ic_values, sizeof(XimDefICValues)); - - ic_values->input_style = ic->core.input_style; - ic_values->client_window = ic->core.client_window; - ic_values->focus_window = ic->core.focus_window; - ic_values->filter_events = ic->core.filter_events; - ic_values->geometry_callback = ic->core.geometry_callback; - ic_values->res_name = ic->core.res_name; - ic_values->res_class = ic->core.res_class; - ic_values->destroy_callback = ic->core.destroy_callback; - ic_values->string_conversion_callback - = ic->core.string_conversion_callback; - ic_values->string_conversion = ic->core.string_conversion; - ic_values->reset_state = ic->core.reset_state; - ic_values->hotkey = ic->core.hotkey; - ic_values->hotkey_state = ic->core.hotkey_state; - ic_values->preedit_attr = ic->core.preedit_attr; - ic_values->status_attr = ic->core.status_attr; -} - -void -_XimSetCurrentICValues( - Xic ic, - XimDefICValues *ic_values) -{ - ic->core.input_style = ic_values->input_style; - ic->core.client_window = ic_values->client_window; - if (ic_values->focus_window) - ic->core.focus_window = ic_values->focus_window; - ic->core.filter_events = ic_values->filter_events; - ic->core.geometry_callback = ic_values->geometry_callback; - ic->core.res_name = ic_values->res_name; - ic->core.res_class = ic_values->res_class; - ic->core.destroy_callback = ic_values->destroy_callback; - ic->core.string_conversion_callback - = ic_values->string_conversion_callback; - ic->core.string_conversion = ic_values->string_conversion; - ic->core.reset_state = ic_values->reset_state; - ic->core.hotkey = ic_values->hotkey; - ic->core.hotkey_state = ic_values->hotkey_state; - ic->core.preedit_attr = ic_values->preedit_attr; - ic->core.status_attr = ic_values->status_attr; -} - -static void -_XimInitialIMOffsetInfo(void) -{ - unsigned int n = XIMNumber(im_attr_info); - register int i; - - for(i = 0; i < n; i++) { - im_attr_info[i].quark = XrmStringToQuark(GET_NAME(im_attr_info[i])); - } -} - -static void -_XimInitialICOffsetInfo(void) -{ - unsigned int n; - register int i; - - n = XIMNumber(ic_attr_info); - for(i = 0; i < n; i++) { - ic_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_attr_info[i])); - } - - n = XIMNumber(ic_pre_attr_info); - for(i = 0; i < n; i++) { - ic_pre_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_pre_attr_info[i])); - } - - n = XIMNumber(ic_sts_attr_info); - for(i = 0; i < n; i++) { - ic_sts_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_sts_attr_info[i])); - } -} - -static void -_XimInitialIMMode(void) -{ - unsigned int n = XIMNumber(im_mode); - register int i; - - for(i = 0; i < n; i++) { - im_mode_quark[i] = XrmStringToQuark(GET_NAME(im_mode[i])); - } -} - -static void -_XimInitialICMode(void) -{ - unsigned int n = XIMNumber(ic_mode); - register int i; - - for(i = 0; i < n; i++) { - ic_mode_quark[i] = XrmStringToQuark(GET_NAME(ic_mode[i])); - } -} - -void -_XimInitialResourceInfo(void) -{ - static Bool init_flag = False; - - if(init_flag == True) { - return; - } - _XimInitialIMOffsetInfo(); - _XimInitialICOffsetInfo(); - _XimInitialIMMode(); - _XimInitialICMode(); - init_flag = True; -} diff --git a/nx-X11/lib/X11/imRmAttr.c b/nx-X11/lib/X11/imRmAttr.c deleted file mode 100644 index 9d4e46258..000000000 --- a/nx-X11/lib/X11/imRmAttr.c +++ /dev/null @@ -1,1514 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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 - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - - -static XIMResourceList -_XimGetNestedListSeparator( - XIMResourceList res_list, /* LISTofIMATTR or IMATTR */ - unsigned int res_num) -{ - return _XimGetResourceListRec(res_list, res_num, XNSeparatorofNestedList); -} - -static Bool -_XimCheckInnerIMAttributes( - Xim im, - XIMArg *arg, - unsigned long mode) -{ - XIMResourceList res; - int check; - - if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, - im->private.proto.im_num_inner_resources, arg->name))) - return False; - - check = _XimCheckIMMode(res, mode); - if(check == XIM_CHECK_INVALID) - return True; - else if(check == XIM_CHECK_ERROR) - return False; - - return True; -} - -char * -_XimMakeIMAttrIDList( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - CARD16 *buf, - INT16 *len, - unsigned long mode) -{ - register XIMArg *p; - XIMResourceList res; - int check; - - *len = 0; - if (!arg) - return (char *)NULL; - - for (p = arg; p->name; p++) { - if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { - if (_XimCheckInnerIMAttributes(im, p, mode)) - continue; - return p->name; - } - - check = _XimCheckIMMode(res, mode); - if (check == XIM_CHECK_INVALID) - continue; - else if (check == XIM_CHECK_ERROR) - return p->name; - - *buf = res->id; - *len += sizeof(CARD16); - buf++; - } - return (char *)NULL; -} - -static Bool -_XimCheckInnerICAttributes( - Xic ic, - XIMArg *arg, - unsigned long mode) -{ - XIMResourceList res; - int check; - - if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, - ic->private.proto.ic_num_inner_resources, arg->name))) - return False; - - check = _XimCheckICMode(res, mode); - if(check == XIM_CHECK_INVALID) - return True; - else if(check == XIM_CHECK_ERROR) - return False; - - return True; -} - -char * -_XimMakeICAttrIDList( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - CARD16 *buf, - INT16 *len, - unsigned long mode) -{ - register XIMArg *p; - XIMResourceList res; - int check; - XrmQuark pre_quark; - XrmQuark sts_quark; - char *name; - INT16 new_len; - - *len = 0; - if (!arg) - return (char *)NULL; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - - for (p = arg; p && p->name; p++) { - if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { - if (_XimCheckInnerICAttributes(ic, p, mode)) - continue; - *len = -1; - return p->name; - } - - check = _XimCheckICMode(res, mode); - if(check == XIM_CHECK_INVALID) - continue; - else if(check == XIM_CHECK_ERROR) { - *len = -1; - return p->name; - } - - *buf = res->id; - *len += sizeof(CARD16); - buf++; - if (res->resource_size == XimType_NEST) { - if (res->xrm_name == pre_quark) { - if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, - (XIMArg *)p->value, buf, &new_len, - (mode | XIM_PREEDIT_ATTR)))) { - if (new_len < 0) *len = -1; - else *len += new_len; - return name; - } - *len += new_len; - buf = (CARD16 *)((char *)buf + new_len); - } else if (res->xrm_name == sts_quark) { - if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, - (XIMArg *)p->value, buf, &new_len, - (mode | XIM_STATUS_ATTR)))) { - if (new_len < 0) *len = -1; - else *len += new_len; - return name; - } - *len += new_len; - buf = (CARD16 *)((char *)buf + new_len); - } - - if (!(res = _XimGetNestedListSeparator(res_list, res_num))) { - p++; - if (p) { - *len = -1; - return p->name; - } - else { - return (char *)NULL; - } - } - *buf = res->id; - *len += sizeof(CARD16); - buf++; - } - } - return (char *)NULL; -} - -static Bool -_XimAttributeToValue( - Xic ic, - XIMResourceList res, - CARD16 *data, - INT16 data_len, - XPointer value, - BITMASK32 mode) -{ - switch (res->resource_size) { - case XimType_SeparatorOfNestedList: - case XimType_NEST: - break; - - case XimType_CARD8: - case XimType_CARD16: - case XimType_CARD32: - case XimType_Window: - case XimType_XIMHotKeyState: - _XCopyToArg((XPointer)data, (XPointer *)&value, data_len); - break; - - case XimType_STRING8: - { - char *str; - - if (!(value)) - return False; - - if (!(str = Xmalloc(data_len + 1))) - return False; - - (void)memcpy(str, (char *)data, data_len); - str[data_len] = '\0'; - - *((char **)value) = str; - break; - } - - case XimType_XIMStyles: - { - INT16 num = data[0]; - register CARD32 *style_list = (CARD32 *)&data[2]; - XIMStyle *style; - XIMStyles *rep; - register int i; - char *p; - int alloc_len; - - if (!(value)) - return False; - - alloc_len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; - if (!(p = Xmalloc(alloc_len))) - return False; - - rep = (XIMStyles *)p; - style = (XIMStyle *)(p + sizeof(XIMStyles)); - - for (i = 0; i < num; i++) - style[i] = (XIMStyle)style_list[i]; - - rep->count_styles = (unsigned short)num; - rep->supported_styles = style; - *((XIMStyles **)value) = rep; - break; - } - - case XimType_XRectangle: - { - XRectangle *rep; - - if (!(value)) - return False; - - if (!(rep = Xmalloc(sizeof(XRectangle)))) - return False; - - rep->x = data[0]; - rep->y = data[1]; - rep->width = data[2]; - rep->height = data[3]; - *((XRectangle **)value) = rep; - break; - } - - case XimType_XPoint: - { - XPoint *rep; - - if (!(value)) - return False; - - if (!(rep = Xmalloc(sizeof(XPoint)))) - return False; - - rep->x = data[0]; - rep->y = data[1]; - *((XPoint **)value) = rep; - break; - } - - case XimType_XFontSet: - { - INT16 len = data[0]; - char *base_name; - XFontSet rep = (XFontSet)NULL; - char **missing_list = NULL; - int missing_count; - char *def_string; - - if (!(value)) - return False; - if (!ic) - return False; - - if (!(base_name = Xmalloc(len + 1))) - return False; - - (void)strncpy(base_name, (char *)&data[1], (int)len); - base_name[len] = '\0'; - - if (mode & XIM_PREEDIT_ATTR) { - if (!strcmp(base_name, ic->private.proto.preedit_font)) { - rep = ic->core.preedit_attr.fontset; - } else if (!ic->private.proto.preedit_font_length) { - rep = XCreateFontSet(ic->core.im->core.display, - base_name, &missing_list, - &missing_count, &def_string); - } - } else if (mode & XIM_STATUS_ATTR) { - if (!strcmp(base_name, ic->private.proto.status_font)) { - rep = ic->core.status_attr.fontset; - } else if (!ic->private.proto.status_font_length) { - rep = XCreateFontSet(ic->core.im->core.display, - base_name, &missing_list, - &missing_count, &def_string); - } - } - - Xfree(base_name); - Xfree(missing_list); - *((XFontSet *)value) = rep; - break; - } - - case XimType_XIMHotKeyTriggers: - { - INT32 num = *((CARD32 *)data); - register CARD32 *key_list = (CARD32 *)&data[2]; - XIMHotKeyTrigger *key; - XIMHotKeyTriggers *rep; - register int i; - char *p; - int alloc_len; - - if (!(value)) - return False; - - alloc_len = sizeof(XIMHotKeyTriggers) - + sizeof(XIMHotKeyTrigger) * num; - if (!(p = Xmalloc(alloc_len))) - return False; - - rep = (XIMHotKeyTriggers *)p; - key = (XIMHotKeyTrigger *)(p + sizeof(XIMHotKeyTriggers)); - - for (i = 0; i < num; i++, key_list += 3) { - key[i].keysym = (KeySym)key_list[0]; /* keysym */ - key[i].modifier = (int)key_list[1]; /* modifier */ - key[i].modifier_mask = (int)key_list[2]; /* modifier_mask */ - } - - rep->num_hot_key = (int)num; - rep->key = key; - *((XIMHotKeyTriggers **)value) = rep; - break; - } - - case XimType_XIMStringConversion: - { - break; - } - - default: - return False; - } - return True; -} - -static Bool -_XimDecodeInnerIMATTRIBUTE( - Xim im, - XIMArg *arg) -{ - XIMResourceList res; - XimDefIMValues im_values; - - if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, - im->private.proto.im_num_inner_resources, arg->name))) - return False; - - _XimGetCurrentIMValues(im, &im_values); - return _XimDecodeLocalIMAttr(res, (XPointer)&im_values, arg->value); -} - -char * -_XimDecodeIMATTRIBUTE( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - CARD16 *data, - INT16 data_len, - XIMArg *arg, - BITMASK32 mode) -{ - register XIMArg *p; - XIMResourceList res; - int check; - INT16 len; - CARD16 *buf; - INT16 total; - INT16 min_len = sizeof(CARD16) /* sizeof attributeID */ - + sizeof(INT16); /* sizeof length */ - - for (p = arg; p->name; p++) { - if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { - if (_XimDecodeInnerIMATTRIBUTE(im, p)) - continue; - return p->name; - } - - check = _XimCheckIMMode(res, mode); - if(check == XIM_CHECK_INVALID) - continue; - else if(check == XIM_CHECK_ERROR) - return p->name; - - total = data_len; - buf = data; - while (total >= min_len) { - if (res->id == buf[0]) - break; - - len = buf[1]; - len += XIM_PAD(len) + min_len; - buf = (CARD16 *)((char *)buf + len); - total -= len; - } - if (total < min_len) - return p->name; - - if (!(_XimAttributeToValue((Xic) im->private.local.current_ic, - res, &buf[2], buf[1], p->value, mode))) - return p->name; - } - return (char *)NULL; -} - -static Bool -_XimDecodeInnerICATTRIBUTE( - Xic ic, - XIMArg *arg, - unsigned long mode) -{ - XIMResourceList res; - XimDefICValues ic_values; - - if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, - ic->private.proto.ic_num_inner_resources, arg->name))) - return False; - - _XimGetCurrentICValues(ic, &ic_values); - if (!_XimDecodeLocalICAttr(res, (XPointer)&ic_values, arg->value, mode)) - return False; - _XimSetCurrentICValues(ic, &ic_values); - return True; -} - -char * -_XimDecodeICATTRIBUTE( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - CARD16 *data, - INT16 data_len, - XIMArg *arg, - BITMASK32 mode) -{ - register XIMArg *p; - XIMResourceList res; - int check; - INT16 len; - CARD16 *buf; - INT16 total; - char *name; - INT16 min_len = sizeof(CARD16) /* sizeof attributeID */ - + sizeof(INT16); /* sizeof length */ - XrmQuark pre_quark; - XrmQuark sts_quark; - - if (!arg) - return (char *)NULL; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - - for (p = arg; p->name; p++) { - if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { - if (_XimDecodeInnerICATTRIBUTE(ic, p, mode)) - continue; - return p->name; - } - - check = _XimCheckICMode(res, mode); - if (check == XIM_CHECK_INVALID) - continue; - else if (check == XIM_CHECK_ERROR) - return p->name; - - total = data_len; - buf = data; - while (total >= min_len) { - if (res->id == buf[0]) - break; - - len = buf[1]; - len += XIM_PAD(len) + min_len; - buf = (CARD16 *)((char *)buf + len); - total -= len; - } - if (total < min_len) - return p->name; - - if (res->resource_size == XimType_NEST) { - if (res->xrm_name == pre_quark) { - if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, - &buf[2], buf[1], (XIMArg *)p->value, - (mode | XIM_PREEDIT_ATTR)))) - return name; - } else if (res->xrm_name == sts_quark) { - if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, - &buf[2], buf[1], (XIMArg *)p->value, - (mode | XIM_STATUS_ATTR)))) - return name; - } - } else { - if (!(_XimAttributeToValue(ic, res, &buf[2], buf[1], - p->value, mode))) - return p->name; - } - } - return (char *)NULL; -} - -static Bool -_XimValueToAttribute( - XIMResourceList res, - XPointer buf, - int buf_size, - XPointer value, - int *len, - unsigned long mode, - XPointer param) -{ - int ret_len; - - switch (res->resource_size) { - case XimType_SeparatorOfNestedList: - case XimType_NEST: - *len = 0; - break; - - case XimType_CARD8: - ret_len = sizeof(CARD8); - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - *((CARD8 *)buf) = (CARD8)(long)value; - *len = ret_len; - break; - - case XimType_CARD16: - ret_len = sizeof(CARD16); - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - *((CARD16 *)buf) = (CARD16)(long)value; - *len = ret_len; - break; - - case XimType_CARD32: - case XimType_Window: - case XimType_XIMHotKeyState: - ret_len = sizeof(CARD32); - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - *((CARD32 *)buf) = (CARD32)(long)value; - *len = ret_len; - break; - - case XimType_STRING8: - if (!value) { - *len = 0; - return False; - } - - ret_len = strlen((char *)value); - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - (void)memcpy((char *)buf, (char *)value, ret_len); - *len = ret_len; - break; - - case XimType_XRectangle: - { - XRectangle *rect = (XRectangle *)value; - CARD16 *buf_s = (CARD16 *)buf; - - if (!rect) { - *len = 0; - return False; - } - - ret_len = sizeof(INT16) /* sizeof X */ - + sizeof(INT16) /* sizeof Y */ - + sizeof(CARD16) /* sizeof width */ - + sizeof(CARD16); /* sizeof height */ - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - buf_s[0] = (CARD16)rect->x; /* X */ - buf_s[1] = (CARD16)rect->y; /* Y */ - buf_s[2] = (CARD16)rect->width; /* width */ - buf_s[3] = (CARD16)rect->height; /* heght */ - *len = ret_len; - break; - } - - case XimType_XPoint: - { - XPoint *point = (XPoint *)value; - CARD16 *buf_s = (CARD16 *)buf; - - if (!point) { - *len = 0; - return False; - } - - ret_len = sizeof(INT16) /* sizeof X */ - + sizeof(INT16); /* sizeof Y */ - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - buf_s[0] = (CARD16)point->x; /* X */ - buf_s[1] = (CARD16)point->y; /* Y */ - *len = ret_len; - break; - } - - case XimType_XFontSet: - { - XFontSet font = (XFontSet)value; - Xic ic = (Xic)param; - char *base_name = NULL; - int length = 0; - CARD16 *buf_s = (CARD16 *)buf; - - if (!font) { - *len = 0; - return False; - } - - if (mode & XIM_PREEDIT_ATTR) { - base_name = ic->private.proto.preedit_font; - length = ic->private.proto.preedit_font_length; - } else if (mode & XIM_STATUS_ATTR) { - base_name = ic->private.proto.status_font; - length = ic->private.proto.status_font_length; - } - - if (!base_name) { - *len = 0; - return False; - } - - ret_len = sizeof(CARD16) /* sizeof length of Base name */ - + length; /* sizeof Base font name list */ - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - buf_s[0] = (INT16)length; /* length of Base font name */ - (void)memcpy((char *)&buf_s[1], base_name, length); - /* Base font name list */ - *len = ret_len; - break; - } - - case XimType_XIMHotKeyTriggers: - { - XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)value; - INT32 num; - CARD32 *buf_l = (CARD32 *)buf; - register CARD32 *key = (CARD32 *)&buf_l[1]; - register int i; - - if (!hotkey) { - *len = 0; - return False; - } - num = (INT32)hotkey->num_hot_key; - - ret_len = sizeof(INT32) /* sizeof number of key list */ - + (sizeof(CARD32) /* sizeof keysyn */ - + sizeof(CARD32) /* sizeof modifier */ - + sizeof(CARD32)) /* sizeof modifier_mask */ - * num; /* number of key list */ - if (buf_size < ret_len + XIM_PAD(ret_len)) { - *len = -1; - return False; - } - - buf_l[0] = num; /* number of key list */ - for (i = 0; i < num; i++, key += 3) { - key[0] = (CARD32)(hotkey->key[i].keysym); - /* keysym */ - key[1] = (CARD32)(hotkey->key[i].modifier); - /* modifier */ - key[2] = (CARD32)(hotkey->key[i].modifier_mask); - /* modifier_mask */ - } - *len = ret_len; - break; - } - - case XimType_XIMStringConversion: - { - *len = 0; - break; - } - - default: - return False; - } - return True; -} - -static Bool -_XimSetInnerIMAttributes( - Xim im, - XPointer top, - XIMArg *arg, - unsigned long mode) -{ - XIMResourceList res; - int check; - - if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, - im->private.proto.im_num_inner_resources, arg->name))) - return False; - - check = _XimCheckIMMode(res, mode); - if(check == XIM_CHECK_INVALID) - return True; - else if(check == XIM_CHECK_ERROR) - return False; - - return _XimEncodeLocalIMAttr(res, top, arg->value); -} - -char * -_XimEncodeIMATTRIBUTE( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - XIMArg **arg_ret, - char *buf, - int size, - int *ret_len, - XPointer top, - unsigned long mode) -{ - register XIMArg *p; - XIMResourceList res; - int check; - CARD16 *buf_s; - int len; - int min_len = sizeof(CARD16) /* sizeof attribute ID */ - + sizeof(INT16); /* sizeof value length */ - - *ret_len = 0; - for (p = arg; p->name; p++) { - if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { - if (_XimSetInnerIMAttributes(im, top, p, mode)) - continue; - return p->name; - } - - check = _XimCheckIMMode(res, mode); - if (check == XIM_CHECK_INVALID) - continue; - else if (check == XIM_CHECK_ERROR) - return p->name; - - if (!(_XimEncodeLocalIMAttr(res, top, p->value))) - return p->name; - - buf_s = (CARD16 *)buf; - if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], (size - min_len), - p->value, &len, mode, (XPointer)NULL))) - return p->name; - - if (len == 0) { - continue; - } else if (len < 0) { - *arg_ret = p; - return (char *)NULL; - } - - buf_s[0] = res->id; /* attribute ID */ - buf_s[1] = len; /* value length */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += min_len; - - buf += len; - *ret_len += len; - size -= len; - } - *arg_ret = (XIMArg *)NULL; - return (char *)NULL; -} - -#ifdef XIM_CONNECTABLE -Bool -_XimEncodeSavedIMATTRIBUTE( - Xim im, - XIMResourceList res_list, - unsigned int res_num, - int *idx, - char *buf, - int size, - int *ret_len, - XPointer top, - unsigned long mode) -{ - register int i; - int num = im->private.proto.num_saved_imvalues; - XrmQuark *quark_list = im->private.proto.saved_imvalues; - XIMResourceList res; - XPointer value; - CARD16 *buf_s; - int len; - int min_len = sizeof(CARD16) /* sizeof attribute ID */ - + sizeof(INT16); /* sizeof value length */ - - if (!im->private.proto.saved_imvalues) { - *idx = -1; - *ret_len = 0; - return True; - } - - *ret_len = 0; - for (i = *idx; i < num; i++) { - if (!(res = _XimGetResourceListRecByQuark(res_list, - res_num, quark_list[i]))) - continue; - - if (!_XimDecodeLocalIMAttr(res, top, value)) - return False; - - buf_s = (CARD16 *)buf; - if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], - (size - min_len), value, &len, mode, (XPointer)NULL))) - return False; - - if (len == 0) { - continue; - } else if (len < 0) { - *idx = i; - return True; - } - - buf_s[0] = res->id; /* attribute ID */ - buf_s[1] = len; /* value length */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += min_len; - - buf += len; - *ret_len += len; - size -= len; - } - *idx = -1; - return True; -} -#endif /* XIM_CONNECTABLE */ - -static Bool -_XimEncodeTopValue( - Xic ic, - XIMResourceList res, - XIMArg *p) -{ - if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { - ic->core.client_window = (Window)p->value; - if (ic->core.focus_window == (Window)0) - ic->core.focus_window = ic->core.client_window; - _XimRegisterFilter(ic); - - } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { - if (ic->core.client_window) { - _XimUnregisterFilter(ic); - ic->core.focus_window = (Window)p->value; - _XimRegisterFilter(ic); - } else /* client_window not yet */ - ic->core.focus_window = (Window)p->value; - } - return True; -} - -static Bool -_XimEncodePreeditValue( - Xic ic, - XIMResourceList res, - XIMArg *p) -{ - if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { - XStandardColormap *colormap_ret; - int count; - - if (!(XGetRGBColormaps(ic->core.im->core.display, - ic->core.focus_window, &colormap_ret, - &count, (Atom)p->value))) - return False; - - XFree(colormap_ret); - } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { - int list_ret; - XFontStruct **struct_list; - char **name_list; - char *tmp; - int len; - register int i; - - if (!p->value) - return False; - - Xfree(ic->private.proto.preedit_font); - - list_ret = XFontsOfFontSet((XFontSet)p->value, - &struct_list, &name_list); - for (i = 0, len = 0; i < list_ret; i++) { - len += (strlen(name_list[i]) + sizeof(char)); - } - if (!(tmp = Xmalloc(len + 1))) { - ic->private.proto.preedit_font = NULL; - return False; - } - - tmp[0] = '\0'; - for (i = 0; i < list_ret; i++) { - strcat(tmp, name_list[i]); - strcat(tmp, ","); - } - tmp[len - 1] = 0; - ic->private.proto.preedit_font = tmp; - ic->private.proto.preedit_font_length = len - 1; - } - return True; -} - -static Bool -_XimEncodeStatusValue( - Xic ic, - XIMResourceList res, - XIMArg *p) -{ - if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { - XStandardColormap *colormap_ret = NULL; - int count; - - if (!(XGetRGBColormaps(ic->core.im->core.display, - ic->core.focus_window, &colormap_ret, - &count, (Atom)p->value))) - return False; - - XFree(colormap_ret); - } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { - int list_ret; - XFontStruct **struct_list; - char **name_list; - char *tmp; - int len; - register int i; - - if (!p->value) - return False; - - Xfree(ic->private.proto.status_font); - - list_ret = XFontsOfFontSet((XFontSet)p->value, - &struct_list, &name_list); - for (i = 0, len = 0; i < list_ret; i++) { - len += (strlen(name_list[i]) + sizeof(char)); - } - if (!(tmp = Xmalloc(len+1))) { - ic->private.proto.status_font = NULL; - return False; - } - - tmp[0] = '\0'; - for(i = 0; i < list_ret; i++) { - strcat(tmp, name_list[i]); - strcat(tmp, ","); - } - tmp[len - 1] = 0; - ic->private.proto.status_font = tmp; - ic->private.proto.status_font_length = len - 1; - } - return True; -} - -static Bool -_XimSetInnerICAttributes( - Xic ic, - XPointer top, - XIMArg *arg, - unsigned long mode) -{ - XIMResourceList res; - int check; - - if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, - ic->private.proto.ic_num_inner_resources, arg->name))) - return False; - - check = _XimCheckICMode(res, mode); - if(check == XIM_CHECK_INVALID) - return True; - else if(check == XIM_CHECK_ERROR) - return False; - - return _XimEncodeLocalICAttr(ic, res, top, arg, mode); -} - -char * -_XimEncodeICATTRIBUTE( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - XIMArg *arg, - XIMArg **arg_ret, - char *buf, - int size, - int *ret_len, - XPointer top, - BITMASK32 *flag, - unsigned long mode) -{ - register XIMArg *p; - XIMResourceList res; - int check; - CARD16 *buf_s; - int len; - int min_len = sizeof(CARD16) /* sizeof attribute ID */ - + sizeof(INT16); /* sizeof value length */ - XrmQuark pre_quark; - XrmQuark sts_quark; - char *name; - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - - *ret_len = 0; - for (p = arg; p && p->name; p++) { - buf_s = (CARD16 *)buf; - if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { - if (_XimSetInnerICAttributes(ic, top, p, mode)) - continue; - return p->name; - } - - check = _XimCheckICMode(res, mode); - if (check == XIM_CHECK_INVALID) - continue; - else if (check == XIM_CHECK_ERROR) - return p->name; - - if (mode & XIM_PREEDIT_ATTR) { - if (!(_XimEncodePreeditValue(ic, res, p))) - return p->name; - } else if (mode & XIM_STATUS_ATTR) { - if (!(_XimEncodeStatusValue(ic, res, p))) - return p->name; - } else { - if (!(_XimEncodeTopValue(ic, res, p))) - return p->name; - } - - if (res->resource_size == XimType_NEST) { - XimDefICValues *ic_attr = (XimDefICValues *)top; - - if (res->xrm_name == pre_quark) { - XIMArg *arg_rt; - if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, - (XIMArg *)p->value, &arg_rt, - (char *)&buf_s[2], (size - min_len), - &len, (XPointer)&ic_attr->preedit_attr, flag, - (mode | XIM_PREEDIT_ATTR)))) { - return name; - } - - } else if (res->xrm_name == sts_quark) { - XIMArg *arg_rt; - if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, - (XIMArg *)p->value, &arg_rt, - (char *)&buf_s[2], (size - min_len), - &len, (XPointer)&ic_attr->status_attr, flag, - (mode | XIM_STATUS_ATTR)))) { - return name; - } - } - } else { -#ifdef EXT_MOVE - if (flag) - *flag |= _XimExtenArgCheck(p); -#endif - if (!(_XimEncodeLocalICAttr(ic, res, top, p, mode))) - return p->name; - - if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], - (size - min_len), p->value, - &len, mode, (XPointer)ic))) - return p->name; - } - - if (len == 0) { - continue; - } else if (len < 0) { - *arg_ret = p; - return (char *)NULL; - } - - buf_s[0] = res->id; /* attribute ID */ - buf_s[1] = len; /* value length */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += min_len; - - buf += len; - *ret_len += len; - size -= len; - } - *arg_ret = (XIMArg *)NULL; - return (char *)NULL; -} - -#ifdef XIM_CONNECTABLE -static Bool -_XimEncodeSavedPreeditValue( - Xic ic, - XIMResourceList res, - XPointer value) -{ - int list_ret; - XFontStruct **struct_list; - char **name_list; - char *tmp; - int len; - register int i; - - if (res->xrm_name == XrmStringToQuark(XNFontSet)) { - if (!value) - return False; - - if (ic->private.proto.preedit_font) - Xfree(ic->private.proto.preedit_font); - - list_ret = XFontsOfFontSet((XFontSet)value, - &struct_list, &name_list); - for(i = 0, len = 0; i < list_ret; i++) { - len += (strlen(name_list[i]) + sizeof(char)); - } - if(!(tmp = Xmalloc(len + 1))) { - ic->private.proto.preedit_font = NULL; - return False; - } - - tmp[0] = '\0'; - for(i = 0; i < list_ret; i++) { - strcat(tmp, name_list[i]); - strcat(tmp, ","); - } - tmp[len - 1] = 0; - ic->private.proto.preedit_font = tmp; - ic->private.proto.preedit_font_length = len - 1; - } - return True; -} - -static Bool -_XimEncodeSavedStatusValue( - Xic ic, - XIMResourceList res, - XPointer value) -{ - int list_ret; - XFontStruct **struct_list; - char **name_list; - char *tmp; - int len; - register int i; - - if (res->xrm_name == XrmStringToQuark(XNFontSet)) { - if (!value) - return False; - - Xfree(ic->private.proto.status_font); - - list_ret = XFontsOfFontSet((XFontSet)value, - &struct_list, &name_list); - for(i = 0, len = 0; i < list_ret; i++) { - len += (strlen(name_list[i]) + sizeof(char)); - } - if(!(tmp = Xmalloc(len + 1))) { - ic->private.proto.status_font = NULL; - return False; - } - - tmp[0] = '\0'; - for(i = 0; i < list_ret; i++) { - strcat(tmp, name_list[i]); - strcat(tmp, ","); - } - tmp[len - 1] = 0; - ic->private.proto.status_font = tmp; - ic->private.proto.status_font_length = len - 1; - } - return True; -} - -Bool -_XimEncodeSavedICATTRIBUTE( - Xic ic, - XIMResourceList res_list, - unsigned int res_num, - int *idx, - char *buf, - int size, - int *ret_len, - XPointer top, - unsigned long mode) -{ - int i; - int num = ic->private.proto.num_saved_icvalues; - XrmQuark *quark_list = ic->private.proto.saved_icvalues; - XIMResourceList res; - XPointer value; - CARD16 *buf_s; - int len; - int min_len = sizeof(CARD16) /* sizeof attribute ID */ - + sizeof(INT16); /* sizeof value length */ - XrmQuark pre_quark; - XrmQuark sts_quark; - XrmQuark separator; - - if (!ic->private.proto.saved_icvalues) { - *idx = -1; - *ret_len = 0; - return True; - } - - pre_quark = XrmStringToQuark(XNPreeditAttributes); - sts_quark = XrmStringToQuark(XNStatusAttributes); - separator = XrmStringToQuark(XNSeparatorofNestedList); - - *ret_len = 0; - for (i = *idx; i < num; i++) { - if (quark_list[i] == separator) { - *idx = i; - return True; - } - - if (!(res = _XimGetResourceListRecByQuark(res_list, - res_num, quark_list[i]))) - continue; - - if (!_XimDecodeLocalICAttr(res, top,(XPointer)&value, mode)) - return False; - - if (mode & XIM_PREEDIT_ATTR) { - if (!(_XimEncodeSavedPreeditValue(ic, res, value))) { - return False; - } - } else if (mode & XIM_STATUS_ATTR) { - if (!(_XimEncodeSavedStatusValue(ic, res, value))) { - return False; - } - } - - buf_s = (CARD16 *)buf; - if (res->resource_size == XimType_NEST) { - XimDefICValues *ic_attr = (XimDefICValues *)top; - - i++; - if (res->xrm_name == pre_quark) { - if (!_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, - &i, (char *)&buf_s[2], (size - min_len), - &len, (XPointer)&ic_attr->preedit_attr, - (mode | XIM_PREEDIT_ATTR))) { - return False; - } - - } else if (res->xrm_name == sts_quark) { - if (!_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, - &i, (char *)&buf_s[2], (size - min_len), - &len, (XPointer)&ic_attr->status_attr, - (mode | XIM_STATUS_ATTR))) { - return False; - } - } - } else { - if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], - (size - min_len), value, - &len, mode, (XPointer)ic))) { - return False; - } - } - - if (len == 0) { - continue; - } else if (len < 0) { - if (quark_list[i] == separator) - i++; - *idx = i; - return True; - } - - buf_s[0] = res->id; /* attribute ID */ - buf_s[1] = len; /* value length */ - XIM_SET_PAD(&buf_s[2], len); /* pad */ - len += min_len; - - buf += len; - *ret_len += len; - size -= len; - } - *idx = -1; - return True; -} -#endif /* XIM_CONNECTABLE */ - -static unsigned int -_XimCountNumberOfAttr( - INT16 total, - CARD16 *attr, - int *names_len) -{ - unsigned int n; - INT16 len; - INT16 min_len = sizeof(CARD16) /* sizeof attribute ID */ - + sizeof(CARD16) /* sizeof type of value */ - + sizeof(INT16); /* sizeof length of attribute */ - - n = 0; - *names_len = 0; - while (total > min_len) { - len = attr[2]; - *names_len += (len + 1); - len += (min_len + XIM_PAD(len + 2)); - total -= len; - attr = (CARD16 *)((char *)attr + len); - n++; - } - return n; -} - -Bool -_XimGetAttributeID( - Xim im, - CARD16 *buf) -{ - unsigned int n; - XIMResourceList res; - char *names; - int names_len; - XPointer tmp; - XIMValuesList *values_list; - char **values; - int values_len; - register int i; - INT16 len; - INT16 min_len = sizeof(CARD16) /* sizeof attribute ID */ - + sizeof(CARD16) /* sizeof type of value */ - + sizeof(INT16); /* sizeof length of attr */ - /* - * IM attribute ID - */ - - if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len))) - return False; - - if (!(res = Xcalloc(n, sizeof(XIMResource)))) - return False; - - values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; - if (!(tmp = Xcalloc(1, values_len))) { - Xfree(res); - return False; - } - - values_list = (XIMValuesList *)tmp; - values = (char **)((char *)tmp + sizeof(XIMValuesList)); - names = (char *)((char *)values + (sizeof(char **) * n)); - - values_list->count_values = n; - values_list->supported_values = values; - - buf++; - for (i = 0; i < n; i++) { - len = buf[2]; - (void)memcpy(names, (char *)&buf[3], len); - values[i] = names; - names[len] = '\0'; - res[i].resource_name = names; - res[i].resource_size = buf[1]; - res[i].id = buf[0]; - names += (len + 1); - len += (min_len + XIM_PAD(len + 2)); - buf = (CARD16 *)((char *)buf + len); - } - _XIMCompileResourceList(res, n); - - Xfree(im->core.im_resources); - Xfree(im->core.im_values_list); - - im->core.im_resources = res; - im->core.im_num_resources = n; - im->core.im_values_list = values_list; - - /* - * IC attribute ID - */ - - if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len))) - return False; - - if (!(res = Xcalloc(n, sizeof(XIMResource)))) - return False; - - values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; - if (!(tmp = Xcalloc(1, values_len))) { - Xfree(res); - return False; - } - - values_list = (XIMValuesList *)tmp; - values = (char **)((char *)tmp + sizeof(XIMValuesList)); - names = (char *)((char *)values + (sizeof(char **) * n)); - - values_list->count_values = n; - values_list->supported_values = values; - - buf += 2; - for (i = 0; i < n; i++) { - len = buf[2]; - (void)memcpy(names, (char *)&buf[3], len); - values[i] = names; - names[len] = '\0'; - res[i].resource_name = names; - res[i].resource_size = buf[1]; - res[i].id = buf[0]; - names += (len + 1); - len += (min_len + XIM_PAD(len + 2)); - buf = (CARD16 *)((char *)buf + len); - } - _XIMCompileResourceList(res, n); - - - Xfree(im->core.ic_resources); - Xfree(im->core.ic_values_list); - - im->core.ic_resources = res; - im->core.ic_num_resources = n; - im->core.ic_values_list = values_list; - - return True; -} diff --git a/nx-X11/lib/X11/imThaiFlt.c b/nx-X11/lib/X11/imThaiFlt.c deleted file mode 100644 index 401bd9a08..000000000 --- a/nx-X11/lib/X11/imThaiFlt.c +++ /dev/null @@ -1,1421 +0,0 @@ -/*********************************************************** - -Copyright 1993, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -/* -**++ -** FACILITY: -** -** Xlib -** -** ABSTRACT: -** -** Thai specific functions. -** Handles character classifications, composibility checking, -** Input sequence check and other Thai specific requirements -** according to WTT specification and DEC extensions. -** -** MODIFICATION HISTORY: -** -**/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "XimThai.h" -#include "XlcPubI.h" - - -#define SPACE 32 - -/* character classification table */ -#define TACTIS_CHARS 256 -static -char const tactis_chtype[TACTIS_CHARS] = { - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 0 - 7 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 8 - 15 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 16 - 23 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 24 - 31 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 32 - 39 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 40 - 47 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 48 - 55 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 56 - 63 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 64 - 71 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 72 - 79 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 80 - 87 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 88 - 95 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 96 - 103 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 104 - 111 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 112 - 119 */ - NON, NON, NON, NON, NON, NON, NON, CTRL, /* 120 - 127 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 128 - 135 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 136 - 143 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 144 - 151 */ - CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 152 - 159 */ - NON, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 160 - 167 */ - CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 168 - 175 */ - CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 176 - 183 */ - CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 184 - 191 */ - CONS, CONS, CONS, CONS, FV3, CONS, FV3, CONS, /* 192 - 199 */ - CONS, CONS, CONS, CONS, CONS, CONS, CONS, NON, /* 200 - 207 */ - FV1, AV2, FV1, FV1, AV1, AV3, AV2, AV3, /* 208 - 215 */ - BV1, BV2, BD, NON, NON, NON, NON, NON, /* 216 - 223 */ - LV, LV, LV, LV, LV, FV2, NON, AD2, /* 224 - 231 */ - TONE, TONE, TONE, TONE, AD1, AD1, AD3, NON, /* 232 - 239 */ - NON, NON, NON, NON, NON, NON, NON, NON, /* 240 - 247 */ - NON, NON, NON, NON, NON, NON, NON, CTRL /* 248 - 255 */ -}; - -/* Composibility checking tables */ -#define NC 0 /* NOT COMPOSIBLE - following char displays in next cell */ -#define CP 1 /* COMPOSIBLE - following char is displayed in the same cell - as leading char, also implies ACCEPT */ -#define XC 3 /* Non-display */ -#define AC 4 /* ACCEPT - display the following char in the next cell */ -#define RJ 5 /* REJECT - discard that following char, ignore it */ - -#define CH_CLASSES 17 /* 17 classes of chars */ - -static -char const write_rules_lookup[CH_CLASSES][CH_CLASSES] = { - /* Table 0: writing/outputing rules */ - /* row: leading char, column: following char */ -/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ - {XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*CTRL*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*NON*/ - ,{XC, NC, NC, NC, NC, NC, NC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*LV*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV1*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV2*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV3*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, CP, NC, NC, NC, NC, NC}/*BV1*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, NC, NC, NC, NC, NC}/*BV2*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*BD*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*TONE*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD1*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD2*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD3*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, CP, NC, NC, NC, NC, NC}/*AV1*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, NC, NC, NC, NC, NC}/*AV2*/ - ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, CP, NC, NC, NC, NC}/*AV3*/ -}; - -static -char const wtt_isc1_lookup[CH_CLASSES][CH_CLASSES] = { - /* Table 1: WTT default input sequence check rules */ - /* row: leading char, column: following char */ -/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ - {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ - ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ -}; - -static -char const wtt_isc2_lookup[CH_CLASSES][CH_CLASSES] = { - /* Table 2: WTT strict input sequence check rules */ - /* row: leading char, column: following char */ -/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ - {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ - ,{XC, AC, AC, AC, AC, RJ, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ - ,{XC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ - ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ - ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ - ,{XC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/ - ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ - ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ -}; - -static -char const thaicat_isc_lookup[CH_CLASSES][CH_CLASSES] = { - /* Table 3: Thaicat input sequence check rules */ - /* row: leading char, column: following char */ -/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ - {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ - ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ} /*FV3*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ - ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, RJ, RJ, RJ, RJ, RJ, CP, CP, CP}/*TONE*/ - ,{XC, AC, AC, AC, AC, AC, AC, CP, RJ, RJ, RJ, RJ, RJ, RJ, CP, RJ, RJ}/*AD1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, CP}/*AD2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ - ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ -}; - - -/* returns classification of a char */ -static int -THAI_chtype (unsigned char ch) -{ - return tactis_chtype[ch]; -} - -#ifdef UNUSED -/* returns the display level */ -static int -THAI_chlevel (unsigned char ch) -{ - int chlevel; - - switch (tactis_chtype[ch]) - { - case CTRL: - chlevel = NON; - break; - case BV1: - case BV2: - case BD: - chlevel = BELOW; - break; - case TONE: - case AD1: - case AD2: - chlevel = TOP; - break; - case AV1: - case AV2: - case AV3: - case AD3: - chlevel = ABOVE; - break; - case NON: - case CONS: - case LV: - case FV1: - case FV2: - case FV3: - default: /* if tactis_chtype is invalid */ - chlevel = BASE; - break; - } - return chlevel; -} - - -/* return True if char is non-spacing */ -static Bool -THAI_isdead (unsigned char ch) -{ - return ((tactis_chtype[ch] == CTRL) || (tactis_chtype[ch] == BV1) || - (tactis_chtype[ch] == BV2) || (tactis_chtype[ch] == BD) || - (tactis_chtype[ch] == TONE) || (tactis_chtype[ch] == AD1) || - (tactis_chtype[ch] == AD2) || (tactis_chtype[ch] == AD3) || - (tactis_chtype[ch] == AV1) || (tactis_chtype[ch] == AV2) || - (tactis_chtype[ch] == AV3)); -} - - -/* return True if char is consonant */ -static Bool -THAI_iscons (unsigned char ch) -{ - return (tactis_chtype[ch] == CONS); -} - - -/* return True if char is vowel */ -static Bool -THAI_isvowel (unsigned char ch) -{ - return ((tactis_chtype[ch] == LV) || (tactis_chtype[ch] == FV1) || - (tactis_chtype[ch] == FV2) || (tactis_chtype[ch] == FV3) || - (tactis_chtype[ch] == BV1) || (tactis_chtype[ch] == BV2) || - (tactis_chtype[ch] == AV1) || (tactis_chtype[ch] == AV2) || - (tactis_chtype[ch] == AV3)); -} - - -/* return True if char is tonemark */ -static Bool -THAI_istone (unsigned char ch) -{ - return (tactis_chtype[ch] == TONE); -} -#endif - -static Bool -THAI_iscomposible ( - unsigned char follow_ch, - unsigned char lead_ch) -{/* "Can follow_ch be put in the same display cell as lead_ch?" */ - - return (write_rules_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] - == CP); -} - -static Bool -THAI_isaccepted ( - unsigned char follow_ch, - unsigned char lead_ch, - unsigned char mode) -{ - Bool iskeyvalid; /* means "Can follow_ch be keyed in after lead_ch?" */ - - switch (mode) - { - case WTT_ISC1: - iskeyvalid = - (wtt_isc1_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); - break; - case WTT_ISC2: - iskeyvalid = - (wtt_isc2_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); - break; - case THAICAT_ISC: - iskeyvalid = - (thaicat_isc_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); - break; - default: - iskeyvalid = True; - break; - } - - return iskeyvalid; -} - -#ifdef UNUSED -static void -THAI_apply_write_rules( - unsigned char *instr, - unsigned char *outstr, - unsigned char insert_ch, - int *num_insert_ch) -{ -/* -Input parameters: - instr - input string - insert_ch specify what char to be added when invalid composition is found -Output parameters: - outstr - output string after input string has been applied the rules - num_insert_ch - number of insert_ch added to outstr. -*/ - unsigned char *lead_ch = NULL, *follow_ch = NULL, *out_ch = NULL; - - *num_insert_ch = 0; - lead_ch = follow_ch = instr; - out_ch = outstr; - if ((*lead_ch == '\0') || !(THAI_find_chtype(instr,DEAD))) - { /* Empty string or can't find any non-spacing char*/ - strcpy((char *)outstr, (char *)instr); - } else { /* String of length >= 1, keep looking */ - follow_ch++; - if (THAI_isdead(*lead_ch)) { /* is first char non-spacing? */ - *out_ch++ = SPACE; - (*num_insert_ch)++; - } - *out_ch++ = *lead_ch; - while (*follow_ch != '\0') /* more char in string to check */ - { - if (THAI_isdead(*follow_ch) && - !THAI_iscomposible(*follow_ch,*lead_ch)) - { - *out_ch++ = SPACE; - (*num_insert_ch)++; - } - *out_ch++ = *follow_ch; - lead_ch = follow_ch; - follow_ch++; - } - *out_ch = '\0'; - } -} - -static int -THAI_find_chtype ( - unsigned char *instr, - int chtype) -{ -/* -Input parameters: - instr - input string - chtype - type of character to look for -Output parameters: - function returns first position of character with matched chtype - function returns -1 if it does not find. -*/ - int i = 0, position = -1; - - switch (chtype) - { - case DEAD: - for (i = 0; *instr != '\0' && THAI_isdead(*instr); i++, instr++) - ; - if (*instr != '\0') position = i; - break; - default: - break; - } - return position; -} - - -static int -THAI_apply_scm( - unsigned char *instr, - unsigned char *outstr, - unsigned char spec_ch, - int num_sp, - unsigned char insert_ch) -{ - unsigned char *scan, *outch; - int i, dead_count, found_count; - Bool isconsecutive; - - scan = instr; - outch = outstr; - dead_count = found_count = 0; - isconsecutive = False; - while (*scan != '\0') { - if (THAI_isdead(*scan)) - dead_count++; /* count number of non-spacing char */ - if (*scan == spec_ch) - if (!isconsecutive) - found_count++; /* count number consecutive spec char found */ - *outch++ = *scan++; - if (found_count == num_sp) { - for (i = 0; i < dead_count; i++) - *outch++ = insert_ch; - dead_count = found_count = 0; - } - } - /* what to return? */ - return 0; /* probably not right but better than returning garbage */ -} - - -/* The following functions are copied from XKeyBind.c */ - -static void ComputeMaskFromKeytrans(); -static int IsCancelComposeKey(KeySym *symbol, XKeyEvent *event); -static void SetLed(Display *dpy, int num, int state); -static CARD8 FindKeyCode(); - - -/* The following functions are specific to this module */ - -static int XThaiTranslateKey(); -static int XThaiTranslateKeySym(); - - -static KeySym HexIMNormalKey( - XicThaiPart *thai_part, - KeySym symbol, - XKeyEvent *event); -static KeySym HexIMFirstComposeKey( - XicThaiPart *thai_part, - KeySym symbol, - XKeyEvent *event); -static KeySym HexIMSecondComposeKey( - XicThaiPart *thai_part, - KeySym symbol - XKeyEvent *event); -static KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2); -static void InitIscMode(Xic ic); -static Bool ThaiComposeConvert( - Display *dpy, - KeySym insym, - KeySym *outsym, KeySym *lower, KeySym *upper); -#endif - -/* - * Definitions - */ - -#define BellVolume 0 - -#define ucs2tis(wc) \ - (unsigned char) ( \ - (0<=(wc)&&(wc)<=0x7F) ? \ - (wc) : \ - ((0x0E01<=(wc)&&(wc)<=0x0E5F) ? ((wc)-0x0E00+0xA0) : 0)) -/* "c" is an unsigned char */ -#define tis2ucs(c) \ - ( \ - ((c)<=0x7F) ? \ - (wchar_t)(c) : \ - ((0x0A1<=(c)) ? ((wchar_t)(c)-0xA0+0x0E00) : 0)) - -/* - * Macros to save and recall last input character in XIC - */ -#define IC_SavePreviousChar(ic,ch) \ - ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = (char) (ch)) -#define IC_ClearPreviousChar(ic) \ - ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = 0) -#define IC_GetPreviousChar(ic) \ - (IC_RealGetPreviousChar(ic,1)) -#define IC_GetContextChar(ic) \ - (IC_RealGetPreviousChar(ic,2)) -#define IC_DeletePreviousChar(ic) \ - (IC_RealDeletePreviousChar(ic)) - -static unsigned char -IC_RealGetPreviousChar(Xic ic, unsigned short pos) -{ - XICCallback* cb = &ic->core.string_conversion_callback; - DefTreeBase *b = &ic->private.local.base; - - if (cb && cb->callback) { - XIMStringConversionCallbackStruct screc; - unsigned char c; - - /* Use a safe value of position = 0 and stretch the range to desired - * place, as XIM protocol is unclear here whether it could be negative - */ - screc.position = 0; - screc.direction = XIMBackwardChar; - screc.operation = XIMStringConversionRetrieval; - screc.factor = pos; - screc.text = 0; - - (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); - if (!screc.text) - return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; - if ((screc.text->feedback && - *screc.text->feedback == XIMStringConversionLeftEdge) || - screc.text->length < 1) - { - c = 0; - } else { - Xim im; - XlcConv conv; - int from_left; - int to_left; - char *from_buf; - char *to_buf; - - im = (Xim) XIMOfIC((XIC)ic); - if (screc.text->encoding_is_wchar) { - conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar, - im->core.lcd, XlcNCharSet); - from_buf = (char *) screc.text->string.wcs; - from_left = screc.text->length * sizeof(wchar_t); - } else { - conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte, - im->core.lcd, XlcNCharSet); - from_buf = screc.text->string.mbs; - from_left = screc.text->length; - } - to_buf = (char *)&c; - to_left = 1; - - _XlcResetConverter(conv); - if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, - (XPointer *)&to_buf, &to_left, NULL, 0) < 0) - { - c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; - } - _XlcCloseConverter(conv); - - XFree(screc.text->string.mbs); - } - XFree(screc.text); - return c; - } else { - return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; - } -} - -static unsigned char -IC_RealDeletePreviousChar(Xic ic) -{ - XICCallback* cb = &ic->core.string_conversion_callback; - - if (cb && cb->callback) { - XIMStringConversionCallbackStruct screc; - unsigned char c; - - screc.position = 0; - screc.direction = XIMBackwardChar; - screc.operation = XIMStringConversionSubstitution; - screc.factor = 1; - screc.text = 0; - - (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); - if (!screc.text) { return 0; } - if ((screc.text->feedback && - *screc.text->feedback == XIMStringConversionLeftEdge) || - screc.text->length < 1) - { - c = 0; - } else { - if (screc.text->encoding_is_wchar) { - c = ucs2tis(screc.text->string.wcs[0]); - XFree(screc.text->string.wcs); - } else { - c = screc.text->string.mbs[0]; - XFree(screc.text->string.mbs); - } - } - XFree(screc.text); - return c; - } else { - return 0; - } -} -/* - * Input sequence check mode in XIC - */ -#define IC_IscMode(ic) ((ic)->private.local.thai.input_mode) - -/* - * Max. size of string handled by the two String Lookup functions. - */ -#define STR_LKUP_BUF_SIZE 256 - -/* - * Size of buffer to contain previous locale name. - */ -#define SAV_LOCALE_NAME_SIZE 256 - -/* - * Size of buffer to contain the IM modifier. - */ -#define MAXTHAIIMMODLEN 20 - -#define AllMods (ShiftMask|LockMask|ControlMask| \ - Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) - - -#define IsISOControlKey(ks) ((ks) >= XK_2 && (ks) <= XK_8) - -#define IsValidControlKey(ks) (((((ks)>=XK_A && (ks)<=XK_asciitilde) || \ - (ks)==XK_space || (ks)==XK_Delete) && \ - ((ks)!=0))) - -#define COMPOSE_LED 2 - -#ifdef UNUSED -typedef KeySym (*StateProc)( - XicThaiPart *thai_part, - KeySym symbol, - XKeyEvent *event); - - -/* - * macros to classify XKeyEvent state field - */ - -#define IsShift(state) (((state) & ShiftMask) != 0) -#define IsLock(state) (((state) & LockMask) != 0) -#define IsControl(state) (((state) & ControlMask) != 0) -#define IsMod1(state) (((state) & Mod1Mask) != 0) -#define IsMod2(state) (((state) & Mod2Mask) != 0) -#define IsMod3(state) (((state) & Mod3Mask) != 0) -#define IsMod4(state) (((state) & Mod4Mask) != 0) -#define IsMod5(state) (((state) & Mod5Mask) != 0) - -/* - * key starts Thai compose sequence (Hex input method) if : - */ - -#define IsComposeKey(ks, event) \ - (( ks==XK_Alt_L && \ - IsControl((event)->state) && \ - !IsShift((event)->state)) \ - ? True : False) - - -/* - * State handler to implement the Thai hex input method. - */ - -static int const nstate_handlers = 3; -static StateProc state_handler[] = { - HexIMNormalKey, - HexIMFirstComposeKey, - HexIMSecondComposeKey -}; - - -/* - * Table for 'Thai Compose' character input. - * The current implementation uses latin-1 keysyms. - */ -struct _XMapThaiKey { - KeySym from; - KeySym to; -}; - -static struct _XMapThaiKey const ThaiComposeTable[] = { - { /* 0xa4 */ XK_currency, /* 0xa5 */ XK_yen }, - { /* 0xa2 */ XK_cent, /* 0xa3 */ XK_sterling }, - { /* 0xe6 */ XK_ae, /* 0xef */ XK_idiaeresis }, - { /* 0xd3 */ XK_Oacute, /* 0xee */ XK_icircumflex }, - { /* 0xb9 */ XK_onesuperior, /* 0xfa */ XK_uacute }, - { /* 0xd2 */ XK_Ograve, /* 0xe5 */ XK_aring }, - { /* 0xbc */ XK_onequarter, /* 0xfb */ XK_ucircumflex }, - { XK_VoidSymbol, XK_VoidSymbol } -}; - -struct _XKeytrans { - struct _XKeytrans *next;/* next on list */ - char *string; /* string to return when the time comes */ - int len; /* length of string (since NULL is legit)*/ - KeySym key; /* keysym rebound */ - unsigned int state; /* modifier state */ - KeySym *modifiers; /* modifier keysyms you want */ - int mlen; /* length of modifier list */ -}; - - -/* Convert keysym to 'Thai Compose' keysym */ -/* The current implementation use latin-1 keysyms */ -static Bool -ThaiComposeConvert( - Display *dpy, - KeySym insym, - KeySym *outsym, KeySym *lower, KeySym *upper) -{ - struct _XMapThaiKey const *table_entry = ThaiComposeTable; - - while (table_entry->from != XK_VoidSymbol) { - if (table_entry->from == insym) { - *outsym = table_entry->to; - *lower = *outsym; - *upper = *outsym; - return True; - } - table_entry++; - } - return False; -} - -static int -XThaiTranslateKey( - register Display *dpy, - KeyCode keycode, - register unsigned int modifiers, - unsigned int *modifiers_return, - KeySym *keysym_return, - KeySym *lsym_return, - KeySym *usym_return) -{ - int per; - register KeySym *syms; - KeySym sym = 0, lsym = 0, usym = 0; - - if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) - return 0; - *modifiers_return = (ShiftMask|LockMask) | dpy->mode_switch; - if (((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) - { - *keysym_return = NoSymbol; - return 1; - } - per = dpy->keysyms_per_keycode; - syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; - while ((per > 2) && (syms[per - 1] == NoSymbol)) - per--; - if ((per > 2) && (modifiers & dpy->mode_switch)) { - syms += 2; - per -= 2; - } - if (!(modifiers & ShiftMask) && - (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) { - if ((per == 1) || (syms[1] == NoSymbol)) - XConvertCase(syms[0], keysym_return, &usym); - else { - XConvertCase(syms[0], &lsym, &usym); - *keysym_return = syms[0]; - } - } else if (!(modifiers & LockMask) || - (dpy->lock_meaning != XK_Caps_Lock)) { - if ((per == 1) || ((usym = syms[1]) == NoSymbol)) - XConvertCase(syms[0], &lsym, &usym); - *keysym_return = usym; - } else { - if ((per == 1) || ((sym = syms[1]) == NoSymbol)) - sym = syms[0]; - XConvertCase(sym, &lsym, &usym); - if (!(modifiers & ShiftMask) && (sym != syms[0]) && - ((sym != usym) || (lsym == usym))) - XConvertCase(syms[0], &lsym, &usym); - *keysym_return = usym; - } - /* - * ThaiCat keyboard support : - * When the Shift and Thai keys are hold for some keys a 'Thai Compose' - * character code is generated which is different from column 3 and - * 4 of the keymap. - * Since we don't know whether ThaiCat keyboard or WTT keyboard is - * in use, the same mapping is done for all Thai input. - * We just arbitary choose to use column 3 keysyms as the indices of - * this mapping. - * When the control key is also hold, this mapping has no effect. - */ - if ((modifiers & Mod1Mask) && - (modifiers & ShiftMask) && - !(modifiers & ControlMask)) { - if (ThaiComposeConvert(dpy, syms[0], &sym, &lsym, &usym)) - *keysym_return = sym; - } - - if (*keysym_return == XK_VoidSymbol) - *keysym_return = NoSymbol; - *lsym_return = lsym; - *usym_return = usym; - return 1; -} - -/* - * XThaiTranslateKeySym - * - * Translate KeySym to TACTIS code output. - * The current implementation uses ISO latin-1 keysym. - * Should be changed to TACTIS keysyms when they are defined by the - * standard. - */ -static int -XThaiTranslateKeySym( - Display *dpy, - register KeySym symbol, - register KeySym lsym, - register KeySym usym, - unsigned int modifiers, - unsigned char *buffer, - int nbytes) -{ - KeySym ckey = 0; - register struct _XKeytrans *p; - int length; - unsigned long hiBytes; - register unsigned char c; - - /* - * initialize length = 1 ; - */ - length = 1; - - if (!symbol) - return 0; - /* see if symbol rebound, if so, return that string. */ - for (p = dpy->key_bindings; p; p = p->next) { - if (((modifiers & AllMods) == p->state) && (symbol == p->key)) { - length = p->len; - if (length > nbytes) length = nbytes; - memcpy (buffer, p->string, length); - return length; - } - } - /* try to convert to TACTIS, handling control */ - hiBytes = symbol >> 8; - if (!(nbytes && - ((hiBytes == 0) || - ((hiBytes == 0xFF) && - (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) || - (symbol == XK_Return) || - (symbol == XK_Escape) || - (symbol == XK_KP_Space) || - (symbol == XK_KP_Tab) || - (symbol == XK_KP_Enter) || - ((symbol >= XK_KP_Multiply) && (symbol <= XK_KP_9)) || - (symbol == XK_KP_Equal) || - (symbol == XK_Scroll_Lock) || -#ifdef DXK_PRIVATE /* DEC private keysyms */ - (symbol == DXK_Remove) || -#endif - (symbol == NoSymbol) || - (symbol == XK_Delete)))))) - return 0; - - /* if X keysym, convert to ascii by grabbing low 7 bits */ - if (symbol == XK_KP_Space) - c = XK_space & 0x7F; /* patch encoding botch */ -/* not for Thai - else if (symbol == XK_hyphen) - c = XK_minus & 0xFF; */ /* map to equiv character */ - else if (hiBytes == 0xFF) - c = symbol & 0x7F; - else - c = symbol & 0xFF; - /* only apply Control key if it makes sense, else ignore it */ - if (modifiers & ControlMask) { - if (!(IsKeypadKey(lsym) || lsym==XK_Return || lsym==XK_Tab)) { - if (IsISOControlKey(lsym)) ckey = lsym; - else if (IsISOControlKey(usym)) ckey = usym; - else if (lsym == XK_question) ckey = lsym; - else if (usym == XK_question) ckey = usym; - else if (IsValidControlKey(lsym)) ckey = lsym; - else if (IsValidControlKey(usym)) ckey = usym; - else length = 0; - - if (length != 0) { - if (ckey == XK_2) c = '\000'; - else if (ckey >= XK_3 && ckey <= XK_7) - c = (char)(ckey-('3'-'\033')); - else if (ckey == XK_8) c = '\177'; - else if (ckey == XK_Delete) c = '\030'; - else if (ckey == XK_question) c = '\037'; - else if (ckey == XK_quoteleft) c = '\036'; /* KLee 1/24/91 */ - else c = (char)(ckey & 0x1f); - } - } - } - /* - * ThaiCat has a key that generates two TACTIS codes D1 & E9. - * It is represented by the latin-1 keysym XK_thorn (0xfe). - * If c is XK_thorn, this key is pressed and it is converted to - * 0xd1 0xe9. - */ - if (c == XK_thorn) { - buffer[0] = 0xd1; - buffer[1] = 0xe9; - buffer[2] = '\0'; - return 2; - } - else { - /* Normal case */ - buffer[0] = c; - buffer[1] = '\0'; - return 1; - } -} - -/* - * given a KeySym, returns the first keycode containing it, if any. - */ -static CARD8 -FindKeyCode( - register Display *dpy, - register KeySym code) -{ - - register KeySym *kmax = dpy->keysyms + - (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; - register KeySym *k = dpy->keysyms; - while (k < kmax) { - if (*k == code) - return (((k - dpy->keysyms) / dpy->keysyms_per_keycode) + - dpy->min_keycode); - k += 1; - } - return 0; -} - -/* - * given a list of modifiers, computes the mask necessary for later matching. - * This routine must lookup the key in the Keymap and then search to see - * what modifier it is bound to, if any. Sets the AnyModifier bit if it - * can't map some keysym to a modifier. - */ -static void -ComputeMaskFromKeytrans( - Display *dpy, - register struct _XKeytrans *p) -{ - register int i; - register CARD8 code; - register XModifierKeymap *m = dpy->modifiermap; - - p->state = AnyModifier; - for (i = 0; i < p->mlen; i++) { - /* if not found, then not on current keyboard */ - if ((code = FindKeyCode(dpy, p->modifiers[i])) == 0) - return; - /* code is now the keycode for the modifier you want */ - { - register int j = m->max_keypermod<<3; - - while ((--j >= 0) && (code != m->modifiermap[j])) - ; - if (j < 0) - return; - p->state |= (1<<(j/m->max_keypermod)); - } - } - p->state &= AllMods; -} - -/************************************************************************ - * - * - * Compose handling routines - compose handlers 0,1,2 - * - * - ************************************************************************/ - -#define NORMAL_KEY_STATE 0 -#define FIRST_COMPOSE_KEY_STATE 1 -#define SECOND_COMPOSE_KEY_STATE 2 - -static -KeySym HexIMNormalKey( - XicThaiPart *thai_part, - KeySym symbol, - XKeyEvent *event) -{ - if (IsComposeKey (symbol, event)) /* start compose sequence */ - { - SetLed (event->display,COMPOSE_LED, LedModeOn); - thai_part->comp_state = FIRST_COMPOSE_KEY_STATE; - return NoSymbol; - } - return symbol; -} - - -static -KeySym HexIMFirstComposeKey( - XicThaiPart *thai_part, - KeySym symbol, - XKeyEvent *event) -{ - if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ - if (IsCancelComposeKey (&symbol, event)) /* cancel sequence */ - { - SetLed (event->display,COMPOSE_LED, LedModeOff); - thai_part->comp_state = NORMAL_KEY_STATE; - return symbol; - } - if (IsComposeKey (symbol, event)) /* restart sequence ?? */ - { - return NoSymbol; /* no state change necessary */ - } - - thai_part->keysym = symbol; /* save key pressed */ - thai_part->comp_state = SECOND_COMPOSE_KEY_STATE; - return NoSymbol; -} - -static -KeySym HexIMSecondComposeKey( - XicThaiPart *thai_part, - KeySym symbol, - XKeyEvent *event) -{ - if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ - if (IsComposeKey (symbol, event)) /* restart sequence ? */ - { - thai_part->comp_state =FIRST_COMPOSE_KEY_STATE; - return NoSymbol; - } - SetLed (event->display,COMPOSE_LED, LedModeOff); - if (IsCancelComposeKey (&symbol, event)) /* cancel sequence ? */ - { - thai_part->comp_state = NORMAL_KEY_STATE; - return symbol; - } - - if ((symbol = HexIMComposeSequence (thai_part->keysym, symbol)) - ==NoSymbol) - { /* invalid compose sequence */ - XBell(event->display, BellVolume); - } - thai_part->comp_state = NORMAL_KEY_STATE; /* reset to normal state */ - return symbol; -} - - -/* - * Interprets two keysyms entered as hex digits and return the Thai keysym - * correspond to the TACTIS code formed. - * The current implementation of this routine returns ISO Latin Keysyms. - */ - -static -KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2) -{ -int hi_digit; -int lo_digit; -int tactis_code; - - if ((ks1 >= XK_0) && (ks1 <= XK_9)) - hi_digit = ks1 - XK_0; - else if ((ks1 >= XK_A) && (ks1 <= XK_F)) - hi_digit = ks1 - XK_A + 10; - else if ((ks1 >= XK_a) && (ks1 <= XK_f)) - hi_digit = ks1 - XK_a + 10; - else /* out of range */ - return NoSymbol; - - if ((ks2 >= XK_0) && (ks2 <= XK_9)) - lo_digit = ks2 - XK_0; - else if ((ks2 >= XK_A) && (ks2 <= XK_F)) - lo_digit = ks2 - XK_A + 10; - else if ((ks2 >= XK_a) && (ks2 <= XK_f)) - lo_digit = ks2 - XK_a + 10; - else /* out of range */ - return NoSymbol; - - tactis_code = hi_digit * 0x10 + lo_digit ; - - return (KeySym)tactis_code; - -} - -/* - * routine determines - * 1) whether key event should cancel a compose sequence - * 2) whether cancelling key event should be processed or ignored - */ - -static -int IsCancelComposeKey( - KeySym *symbol, - XKeyEvent *event) -{ - if (*symbol==XK_Delete && !IsControl(event->state) && - !IsMod1(event->state)) { - *symbol=NoSymbol; /* cancel compose sequence, and ignore key */ - return True; - } - if (IsComposeKey(*symbol, event)) return False; - return ( - IsControl (event->state) || - IsMod1(event->state) || - IsKeypadKey (*symbol) || - IsFunctionKey (*symbol) || - IsMiscFunctionKey (*symbol) || -#ifdef DXK_PRIVATE /* DEC private keysyms */ - *symbol == DXK_Remove || -#endif - IsPFKey (*symbol) || - IsCursorKey (*symbol) || - (*symbol >= XK_Tab && *symbol < XK_Multi_key) - ? True : False); /* cancel compose sequence and pass */ - /* cancelling key through */ -} - - -/* - * set specified keyboard LED on or off - */ - -static -void SetLed( - Display *dpy, - int num, - int state) -{ - XKeyboardControl led_control; - - led_control.led_mode = state; - led_control.led = num; - XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control); -} -#endif - -/* - * Initialize ISC mode from im modifier - */ -static void InitIscMode(Xic ic) -{ - Xim im; - char *im_modifier_name; - - /* If already defined, just return */ - - if (IC_IscMode(ic)) return; - - /* Get IM modifier */ - - im = (Xim) XIMOfIC((XIC)ic); - im_modifier_name = im->core.im_name; - - /* Match with predefined value, default is Basic Check */ - - if (!strncmp(im_modifier_name,"BasicCheck",MAXTHAIIMMODLEN+1)) - IC_IscMode(ic) = WTT_ISC1; - else if (!strncmp(im_modifier_name,"Strict",MAXTHAIIMMODLEN+1)) - IC_IscMode(ic) = WTT_ISC2; - else if (!strncmp(im_modifier_name,"Thaicat",MAXTHAIIMMODLEN+1)) - IC_IscMode(ic) = THAICAT_ISC; - else if (!strncmp(im_modifier_name,"Passthrough",MAXTHAIIMMODLEN+1)) - IC_IscMode(ic) = NOISC; - else - IC_IscMode(ic) = WTT_ISC1; - - return; -} - -/* - * Helper functions for _XimThaiFilter() - */ -static Bool -ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) -{ - DefTreeBase *b = &ic->private.local.base; - b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); - b->wc[b->tree[ic->private.local.composed].wc+1] = '\0'; - - if ((new_char <= 0x1f) || (new_char == 0x7f)) - b->tree[ic->private.local.composed].keysym = symbol; - else - b->tree[ic->private.local.composed].keysym = NoSymbol; - - return True; -} - -static Bool -ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) -{ - DefTreeBase *b = &ic->private.local.base; - if (!IC_DeletePreviousChar(ic)) return False; - b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); - b->wc[b->tree[ic->private.local.composed].wc+1] = tis2ucs(previous_char); - b->wc[b->tree[ic->private.local.composed].wc+2] = '\0'; - - b->tree[ic->private.local.composed].keysym = NoSymbol; - - return True; -} - -static Bool -ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol) -{ - DefTreeBase *b = &ic->private.local.base; - if (!IC_DeletePreviousChar(ic)) return False; - b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); - b->wc[b->tree[ic->private.local.composed].wc+1] = '\0'; - - if ((new_char <= 0x1f) || (new_char == 0x7f)) - b->tree[ic->private.local.composed].keysym = symbol; - else - b->tree[ic->private.local.composed].keysym = NoSymbol; - - return True; -} - -static unsigned -NumLockMask(Display *d) -{ - int i; - XModifierKeymap *map; - KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock); - if (numlock_keycode == NoSymbol) - return 0; - - map = XGetModifierMapping (d); - if (!map) - return 0; - - for (i = 0; i < 8; i++) { - if (map->modifiermap[map->max_keypermod * i] == numlock_keycode) { - XFreeModifiermap(map); - return 1 << i; - } - } - XFreeModifiermap(map); - return 0; -} - -/* - * Filter function for TACTIS - */ -Bool -_XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data) -{ - Xic ic = (Xic)client_data; - KeySym symbol; - int isc_mode; /* Thai Input Sequence Check mode */ - unsigned char previous_char; /* Last inputted Thai char */ - unsigned char new_char; -#ifdef UNUSED - unsigned int modifiers; - KeySym lsym,usym; - int state; - XicThaiPart *thai_part; - char buf[10]; -#endif - wchar_t wbuf[10]; - Bool isReject; - DefTreeBase *b = &ic->private.local.base; - - if ((ev->type != KeyPress) - || (ev->xkey.keycode == 0)) - return False; - - if (!IC_IscMode(ic)) InitIscMode(ic); - - XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), - &symbol, NULL); - - if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) || - ((symbol >> 8 == 0xFF) && - ((XK_BackSpace <= symbol && symbol <= XK_Clear) || - (symbol == XK_Return) || - (symbol == XK_Pause) || - (symbol == XK_Scroll_Lock) || - (symbol == XK_Sys_Req) || - (symbol == XK_Escape) || - (symbol == XK_Delete) || - IsCursorKey(symbol) || - IsKeypadKey(symbol) || - IsMiscFunctionKey(symbol) || - IsFunctionKey(symbol)))) - { - IC_ClearPreviousChar(ic); - return False; - } - if (((symbol >> 8 == 0xFF) && - IsModifierKey(symbol)) || -#ifdef XK_XKB_KEYS - ((symbol >> 8 == 0xFE) && - (XK_ISO_Lock <= symbol && symbol <= XK_ISO_Last_Group_Lock)) || -#endif - (symbol == NoSymbol)) - { - return False; - } -#ifdef UNUSED - if (! XThaiTranslateKey(ev->xkey.display, ev->xkey.keycode, ev->xkey.state, - &modifiers, &symbol, &lsym, &usym)) - return False; - - /* - * Hex input method processing - */ - - thai_part = &ic->private.local.thai; - state = thai_part->comp_state; - if (state >= 0 && state < nstate_handlers) /* call handler for state */ - { - symbol = (* state_handler[state])(thai_part, symbol, (XKeyEvent *)ev); - } - - /* - * Translate KeySym into mb. - */ - count = XThaiTranslateKeySym(ev->xkey.display, symbol, lsym, - usym, ev->xkey.state, buf, 10); - - if (!symbol && !count) - return True; - - /* Return symbol if cannot convert to character */ - if (!count) - return False; -#endif - - /* - * Thai Input sequence check - */ - isc_mode = IC_IscMode(ic); - if (!(previous_char = IC_GetPreviousChar(ic))) previous_char = ' '; - new_char = ucs2tis(wbuf[0]); - isReject = True; - if (THAI_isaccepted(new_char, previous_char, isc_mode)) { - ThaiFltAcceptInput(ic, new_char, symbol); - isReject = False; - } else { - unsigned char context_char; - - context_char = IC_GetContextChar(ic); - if (context_char) { - if (THAI_iscomposible(new_char, context_char)) { - if (THAI_iscomposible(previous_char, new_char)) { - isReject = !ThaiFltReorderInput(ic, previous_char, new_char); - } else if (THAI_iscomposible(previous_char, context_char)) { - isReject = !ThaiFltReplaceInput(ic, new_char, symbol); - } else if (THAI_chtype(previous_char) == FV1 - && THAI_chtype(new_char) == TONE) { - isReject = !ThaiFltReorderInput(ic, previous_char, new_char); - } - } else if (THAI_isaccepted(new_char, context_char, isc_mode)) { - isReject = !ThaiFltReplaceInput(ic, new_char, symbol); - } - } - } - if (isReject) { - /* reject character */ - XBell(ev->xkey.display, BellVolume); - return True; - } - - _Xlcwcstombs(ic->core.im->core.lcd, &b->mb[b->tree[ic->private.local.composed].mb], - &b->wc[b->tree[ic->private.local.composed].wc], 10); - - _Xlcmbstoutf8(ic->core.im->core.lcd, &b->utf8[b->tree[ic->private.local.composed].utf8], - &b->mb[b->tree[ic->private.local.composed].mb], 10); - - /* Remember the last character inputted - * (as fallback in case StringConversionCallback is not provided) - */ - IC_SavePreviousChar(ic, new_char); - - ev->xkey.keycode = 0; - XPutBackEvent(d, ev); - return True; -} diff --git a/nx-X11/lib/X11/imThaiIc.c b/nx-X11/lib/X11/imThaiIc.c deleted file mode 100644 index b559145d0..000000000 --- a/nx-X11/lib/X11/imThaiIc.c +++ /dev/null @@ -1,229 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993 by Digital Equipment Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED and -Digital Equipment Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. FUJITSU LIMITED and Digital Equipment Corporation -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 -THIS SOFTWARE. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Modifier: Franky Ling Digital Equipment Corporation - frankyling@hgrd01.enet.dec.com - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" - -static void -_XimThaiUnSetFocus( - XIC xic) -{ - Xic ic = (Xic)xic; - ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; - - if (ic->core.focus_window) - _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, - _XimThaiFilter, (XPointer)ic); - return; -} - -static void -_XimThaiDestroyIC( - XIC xic) -{ - Xic ic = (Xic)xic; - DefTreeBase *b = &ic->private.local.base; - - if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { - _XimThaiUnSetFocus(xic); - } - - Xfree(ic->private.local.ic_resources); - ic->private.local.ic_resources = NULL; - - Xfree (b->tree); - b->tree = NULL; - - Xfree (b->mb); - b->mb = NULL; - - Xfree (b->wc); - b->wc = NULL; - - Xfree (b->utf8); - b->utf8 = NULL; - return; -} - -static void -_XimThaiSetFocus( - XIC xic) -{ - Xic ic = (Xic)xic; - XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; - - if (current_ic == (XIC)ic) - return; - - if (current_ic != (XIC)NULL) { - _XimThaiUnSetFocus(current_ic); - } - ((Xim)ic->core.im)->private.local.current_ic = (XIC)ic; - - if (ic->core.focus_window) - _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, - KeyPress, KeyPress, _XimThaiFilter, (XPointer)ic); - return; -} - -static void -_XimThaiReset( - XIC xic) -{ - Xic ic = (Xic)xic; - DefTreeBase *b = &ic->private.local.base; - ic->private.local.thai.comp_state = 0; - ic->private.local.thai.keysym = 0; - b->mb[b->tree[ic->private.local.composed].mb] = '\0'; - b->wc[b->tree[ic->private.local.composed].wc] = '\0'; - b->utf8[b->tree[ic->private.local.composed].utf8] = '\0'; -} - -static char * -_XimThaiMbReset( - XIC xic) -{ - _XimThaiReset(xic); - return (char *)NULL; -} - -static wchar_t * -_XimThaiWcReset( - XIC xic) -{ - _XimThaiReset(xic); - return (wchar_t *)NULL; -} - -static XICMethodsRec Thai_ic_methods = { - _XimThaiDestroyIC, /* destroy */ - _XimThaiSetFocus, /* set_focus */ - _XimThaiUnSetFocus, /* unset_focus */ - _XimLocalSetICValues, /* set_values */ - _XimLocalGetICValues, /* get_values */ - _XimThaiMbReset, /* mb_reset */ - _XimThaiWcReset, /* wc_reset */ - _XimThaiMbReset, /* utf8_reset */ - _XimLocalMbLookupString, /* mb_lookup_string */ - _XimLocalWcLookupString, /* wc_lookup_string */ - _XimLocalUtf8LookupString /* utf8_lookup_string */ -}; - -XIC -_XimThaiCreateIC( - XIM im, - XIMArg *values) -{ - Xic ic; - XimDefICValues ic_values; - XIMResourceList res; - unsigned int num; - int len; - DefTree *tree; - - if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) { - return ((XIC)NULL); - } - - ic->methods = &Thai_ic_methods; - ic->core.im = im; - ic->core.filter_events = KeyPressMask; - - if (! (ic->private.local.base.tree = tree = Xmalloc(sizeof(DefTree)*3)) ) - goto Set_Error; - if (! (ic->private.local.base.mb = Xmalloc(21)) ) - goto Set_Error; - if (! (ic->private.local.base.wc = Xmalloc(sizeof(wchar_t)*21)) ) - goto Set_Error; - if (! (ic->private.local.base.utf8 = Xmalloc(21)) ) - goto Set_Error; - ic->private.local.context = 1; - tree[1].mb = 1; - tree[1].wc = 1; - tree[1].utf8 = 1; - ic->private.local.composed = 2; - tree[2].mb = 11; - tree[2].wc = 11; - tree[2].utf8 = 11; - - ic->private.local.thai.comp_state = 0; - ic->private.local.thai.keysym = 0; - ic->private.local.thai.input_mode = 0; - - num = im->core.ic_num_resources; - len = sizeof(XIMResource) * num; - if((res = Xmalloc(len)) == (XIMResourceList)NULL) { - goto Set_Error; - } - (void)memcpy((char *)res, (char *)im->core.ic_resources, len); - ic->private.local.ic_resources = res; - ic->private.local.ic_num_resources = num; - - bzero((char *)&ic_values, sizeof(XimDefICValues)); - if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, - im->core.styles, res, num) == False) { - goto Set_Error; - } - - _XimSetICMode(res, num, ic_values.input_style); - - if(_XimSetICValueData(ic, (XPointer)&ic_values, - ic->private.local.ic_resources, - ic->private.local.ic_num_resources, - values, XIM_CREATEIC, True)) { - goto Set_Error; - } - if(_XimSetICDefaults(ic, (XPointer)&ic_values, - XIM_SETICDEFAULTS, res, num) == False) { - goto Set_Error; - } - ic_values.filter_events = KeyPressMask; - _XimSetCurrentICValues(ic, &ic_values); - - return ((XIC)ic); - -Set_Error : - if (ic->private.local.ic_resources) { - Xfree(ic->private.local.ic_resources); - } - Xfree(ic); - return((XIC)NULL); -} diff --git a/nx-X11/lib/X11/imThaiIm.c b/nx-X11/lib/X11/imThaiIm.c deleted file mode 100644 index c17723aca..000000000 --- a/nx-X11/lib/X11/imThaiIm.c +++ /dev/null @@ -1,235 +0,0 @@ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - Copyright 1993 by Digital Equipment Corporation - -Permission to use, copy, modify, distribute, and sell this software -and its 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 FUJITSU LIMITED and -Digital Equipment Corporation not be used in advertising or publicity -pertaining to distribution of the software without specific, written -prior permission. FUJITSU LIMITED and Digital Equipment Corporation -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 -THIS SOFTWARE. - - Author: Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - Modifier: Franky Ling Digital Equipment Corporation - frankyling@hgrd01.enet.dec.com - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "XlcPublic.h" -#include "XlcPubI.h" -#include "Ximint.h" - -static XIMMethodsRec Xim_im_thai_methods = { - _XimThaiCloseIM, /* close */ - _XimLocalSetIMValues, /* set_values */ - _XimLocalGetIMValues, /* get_values */ - _XimThaiCreateIC, /* create_ic */ - _XimLcctstombs, /* ctstombs */ - _XimLcctstowcs, /* ctstowcs */ - _XimLcctstoutf8 /* ctstoutf8 */ -}; - -#define THAI_LANGUAGE_NAME "th" - -Bool -_XimCheckIfThaiProcessing(Xim im) -{ - char *language; - - _XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL); - if(strcmp(language, THAI_LANGUAGE_NAME) == 0 && - (strcmp(im->core.im_name, "") == 0 || - strcmp(im->core.im_name, "BasicCheck") == 0 || - strcmp(im->core.im_name, "Strict") == 0 || - strcmp(im->core.im_name, "Thaicat") == 0 || - strcmp(im->core.im_name, "Passthrough") == 0)) - { - return(True); - } - return(False); -} - -Bool -_XimThaiOpenIM(Xim im) -{ - XLCd lcd = im->core.lcd; - XlcConv conv; - XimDefIMValues im_values; - XimLocalPrivateRec* private = &im->private.local; - - _XimInitialResourceInfo(); - if(_XimSetIMResourceList(&im->core.im_resources, - &im->core.im_num_resources) == False) { - goto Open_Error; - } - if(_XimSetICResourceList(&im->core.ic_resources, - &im->core.ic_num_resources) == False) { - goto Open_Error; - } - - _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); - - _XimGetCurrentIMValues(im, &im_values); - if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, - im->core.im_resources, im->core.im_num_resources) == False) { - goto Open_Error; - } - _XimSetCurrentIMValues(im, &im_values); - - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) - goto Open_Error; - private->ctom_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) - goto Open_Error; - private->ctow_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) - goto Open_Error; - private->ctoutf8_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) - goto Open_Error; - private->cstomb_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) - goto Open_Error; - private->cstowc_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) - goto Open_Error; - private->cstoutf8_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) - goto Open_Error; - private->ucstoc_conv = conv; - - if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) - goto Open_Error; - private->ucstoutf8_conv = conv; - - im->methods = &Xim_im_thai_methods; - private->current_ic = (XIC)NULL; - - return(True); - -Open_Error : - _XimThaiIMFree(im); - return(False); -} - -void -_XimThaiIMFree(Xim im) -{ - if(im->core.im_resources) { - Xfree(im->core.im_resources); - im->core.im_resources = NULL; - } - if(im->core.ic_resources) { - Xfree(im->core.ic_resources); - im->core.ic_resources = NULL; - } - if(im->core.im_values_list) { - Xfree(im->core.im_values_list); - im->core.im_values_list = NULL; - } - if(im->core.ic_values_list) { - Xfree(im->core.ic_values_list); - im->core.ic_values_list = NULL; - } - if(im->core.styles) { - Xfree(im->core.styles); - im->core.styles = NULL; - } - if(im->core.res_name) { - Xfree(im->core.res_name); - im->core.res_name = NULL; - } - if(im->core.res_class) { - Xfree(im->core.res_class); - im->core.res_class = NULL; - } - if(im->core.im_name) { - Xfree(im->core.im_name); - im->core.im_name = NULL; - } - if (im->private.local.ctom_conv) { - _XlcCloseConverter(im->private.local.ctom_conv); - im->private.local.ctom_conv = NULL; - } - if (im->private.local.ctow_conv) { - _XlcCloseConverter(im->private.local.ctow_conv); - im->private.local.ctow_conv = NULL; - } - if (im->private.local.ctoutf8_conv) { - _XlcCloseConverter(im->private.local.ctoutf8_conv); - im->private.local.ctoutf8_conv = NULL; - } - if (im->private.local.cstomb_conv) { - _XlcCloseConverter(im->private.local.cstomb_conv); - im->private.local.cstomb_conv = NULL; - } - if (im->private.local.cstowc_conv) { - _XlcCloseConverter(im->private.local.cstowc_conv); - im->private.local.cstowc_conv = NULL; - } - if (im->private.local.cstoutf8_conv) { - _XlcCloseConverter(im->private.local.cstoutf8_conv); - im->private.local.cstoutf8_conv = NULL; - } - if (im->private.local.ucstoc_conv) { - _XlcCloseConverter(im->private.local.ucstoc_conv); - im->private.local.ucstoc_conv = NULL; - } - if (im->private.local.ucstoutf8_conv) { - _XlcCloseConverter(im->private.local.ucstoutf8_conv); - im->private.local.ucstoutf8_conv = NULL; - } - return; -} - -Status -_XimThaiCloseIM(XIM xim) -{ - Xim im = (Xim)xim; - XIC ic; - XIC next; - - ic = im->core.ic_chain; - im->core.ic_chain = NULL; - while (ic) { - (*ic->methods->destroy) (ic); - next = ic->core.next; - Xfree (ic); - ic = next; - } - _XimThaiIMFree(im); - return(True); -} diff --git a/nx-X11/lib/X11/imTrX.c b/nx-X11/lib/X11/imTrX.c deleted file mode 100644 index 148b7fc90..000000000 --- a/nx-X11/lib/X11/imTrX.c +++ /dev/null @@ -1,518 +0,0 @@ -/* - * Copyright 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include "Ximint.h" -#include "XimTrInt.h" -#include "XimTrX.h" - -static Bool -_XimXRegisterDispatcher( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data) -{ - XIntrCallbackPtr rec; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - - if (!(rec = Xmalloc(sizeof(XIntrCallbackRec)))) - return False; - - rec->func = callback; - rec->call_data = call_data; - rec->next = spec->intr_cb; - spec->intr_cb = rec; - return True; -} - -static void -_XimXFreeIntrCallback( - Xim im) -{ - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - register XIntrCallbackPtr rec, next; - - for (rec = spec->intr_cb; rec;) { - next = rec->next; - Xfree(rec); - rec = next; - } - return; -} - -static Bool -_XimXCallDispatcher(Xim im, INT16 len, XPointer data) -{ - register XIntrCallbackRec *rec; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - - for (rec = spec->intr_cb; rec; rec = rec->next) { - if ((*rec->func)(im, len, data, rec->call_data)) - return True; - } - return False; -} - -static Bool -_XimXFilterWaitEvent( - Display *d, - Window w, - XEvent *ev, - XPointer arg) -{ - Xim im = (Xim)arg; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - Bool ret; - - spec->ev = (XPointer)ev; - ret = _XimFilterWaitEvent(im); - - /* - * If ev is a pointer to a stack variable, there could be - * a coredump later on if the pointer is dereferenced. - * Therefore, reset to NULL to force reinitialization in - * _XimXRead(). - * - * Keep in mind _XimXRead may be called again when the stack - * is very different. - */ - spec->ev = (XPointer)NULL; - - return ret; -} - -static Bool -_CheckConnect( - Display *display, - XEvent *event, - XPointer xim) -{ - Xim im = (Xim)xim; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - - if ((event->type == ClientMessage) - && (event->xclient.message_type == spec->imconnectid)) { - return True; - } - return False; -} - -static Bool -_XimXConnect(Xim im) -{ - XEvent event; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - CARD32 major_code; - CARD32 minor_code; - - if (!(spec->lib_connect_wid = XCreateSimpleWindow(im->core.display, - DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0))) { - return False; - } - - event.xclient.type = ClientMessage; - event.xclient.display = im->core.display; - event.xclient.window = im->private.proto.im_window; - event.xclient.message_type = spec->imconnectid; - event.xclient.format = 32; - event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid; - event.xclient.data.l[1] = spec->major_code; - event.xclient.data.l[2] = spec->minor_code; - event.xclient.data.l[3] = 0; - event.xclient.data.l[4] = 0; - - if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) { - XWindowAttributes atr; - long event_mask; - - XGetWindowAttributes(im->core.display, spec->lib_connect_wid, &atr); - event_mask = atr.your_event_mask | PropertyChangeMask; - XSelectInput(im->core.display, spec->lib_connect_wid, event_mask); - _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, - PropertyNotify, PropertyNotify, - _XimXFilterWaitEvent, (XPointer)im); - } - - XSendEvent(im->core.display, im->private.proto.im_window, - False, NoEventMask, &event); - XFlush(im->core.display); - - for (;;) { - XIfEvent(im->core.display, &event, _CheckConnect, (XPointer)im); - if (event.xclient.type != ClientMessage) { - return False; - } - if (event.xclient.message_type == spec->imconnectid) - break; - } - - spec->ims_connect_wid = (Window)event.xclient.data.l[0]; - major_code = (CARD32)event.xclient.data.l[1]; - minor_code = (CARD32)event.xclient.data.l[2]; - - if (((major_code == 0) && (minor_code <= 2)) || - ((major_code == 1) && (minor_code == 0)) || - ((major_code == 2) && (minor_code <= 1))) { - spec->major_code = major_code; - spec->minor_code = minor_code; - } - if (((major_code == 0) && (minor_code == 2)) || - ((major_code == 2) && (minor_code == 1))) { - spec->BoundarySize = (CARD32)event.xclient.data.l[3]; - } - - /* ClientMessage Event Filter */ - _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, - ClientMessage, ClientMessage, - _XimXFilterWaitEvent, (XPointer)im); - return True; -} - -static Bool -_XimXShutdown(Xim im) -{ - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - - if (!spec) - return True; - - /* ClientMessage Event Filter */ - _XUnregisterFilter(im->core.display, - ((XSpecRec *)im->private.proto.spec)->lib_connect_wid, - _XimXFilterWaitEvent, (XPointer)im); - XDestroyWindow(im->core.display, - ((XSpecRec *)im->private.proto.spec)->lib_connect_wid); - _XimXFreeIntrCallback(im); - Xfree(spec); - im->private.proto.spec = 0; - return True; -} - -static char * -_NewAtom( - char *atomName) -{ - static int sequence = 0; - - (void)sprintf(atomName, "_client%d", sequence); - sequence = ((sequence < 20) ? sequence + 1 : 0); - return atomName; -} - -static Bool -_XimXWrite(Xim im, INT16 len, XPointer data) -{ - Atom atom; - char atomName[16]; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - XEvent event; - CARD8 *p; - CARD32 major_code = spec->major_code; - CARD32 minor_code = spec->minor_code; - int BoundSize; - - bzero(&event,sizeof(XEvent)); - event.xclient.type = ClientMessage; - event.xclient.display = im->core.display; - event.xclient.window = spec->ims_connect_wid; - if(major_code == 1 && minor_code == 0) { - BoundSize = 0; - } else if((major_code == 0 && minor_code == 2) || - (major_code == 2 && minor_code == 1)) { - BoundSize = spec->BoundarySize; - } else if(major_code == 0 && minor_code == 1) { - BoundSize = len; - } else { - BoundSize = XIM_CM_DATA_SIZE; - } - if (len > BoundSize) { - event.xclient.message_type = spec->improtocolid; - atom = XInternAtom(im->core.display, _NewAtom(atomName), False); - XChangeProperty(im->core.display, spec->ims_connect_wid, - atom, XA_STRING, 8, PropModeAppend, - (unsigned char *)data, len); - if(major_code == 0) { - event.xclient.format = 32; - event.xclient.data.l[0] = (long)len; - event.xclient.data.l[1] = (long)atom; - XSendEvent(im->core.display, spec->ims_connect_wid, - False, NoEventMask, &event); - } - } else { - int length; - - event.xclient.format = 8; - for(length = 0 ; length < len ; length += XIM_CM_DATA_SIZE) { - p = (CARD8 *)&event.xclient.data.b[0]; - if((length + XIM_CM_DATA_SIZE) >= len) { - event.xclient.message_type = spec->improtocolid; - bzero(p, XIM_CM_DATA_SIZE); - memcpy((char *)p, (data + length), (len - length)); - } else { - event.xclient.message_type = spec->immoredataid; - memcpy((char *)p, (data + length), XIM_CM_DATA_SIZE); - } - XSendEvent(im->core.display, spec->ims_connect_wid, - False, NoEventMask, &event); - } - } - - return True; -} - -static Bool -_XimXGetReadData( - Xim im, - char *buf, - int buf_len, - int *ret_len, - XEvent *event) -{ - char *data; - int len; - - char tmp_buf[XIM_CM_DATA_SIZE]; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - unsigned long length; - Atom prop; - int return_code; - Atom type_ret; - int format_ret; - unsigned long nitems; - unsigned long bytes_after_ret; - unsigned char *prop_ret; - - if ((event->type == ClientMessage) && - !((event->xclient.message_type == spec->improtocolid) || - (event->xclient.message_type == spec->immoredataid))) { - /* This event has nothing to do with us, - * FIXME should not have gotten here then... - */ - return False; - } else if ((event->type == ClientMessage) && (event->xclient.format == 8)) { - data = event->xclient.data.b; - if (buf_len >= XIM_CM_DATA_SIZE) { - (void)memcpy(buf, data, XIM_CM_DATA_SIZE); - *ret_len = XIM_CM_DATA_SIZE; - } else { - (void)memcpy(buf, data, buf_len); - len = XIM_CM_DATA_SIZE - buf_len; - (void)memcpy(tmp_buf, &data[buf_len], len); - bzero(data, XIM_CM_DATA_SIZE); - (void)memcpy(data, tmp_buf, len); - XPutBackEvent(im->core.display, event); - *ret_len = buf_len; - } - } else if ((event->type == ClientMessage) - && (event->xclient.format == 32)) { - length = (unsigned long)event->xclient.data.l[0]; - prop = (Atom)event->xclient.data.l[1]; - return_code = XGetWindowProperty(im->core.display, - spec->lib_connect_wid, prop, 0L, - (long)((length + 3)/ 4), True, AnyPropertyType, - &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); - if (return_code != Success || format_ret == 0 || nitems == 0) { - if (return_code == Success) - XFree(prop_ret); - return False; - } - if (buf_len >= (int)nitems) { - (void)memcpy(buf, prop_ret, (int)nitems); - *ret_len = (int)nitems; - if (bytes_after_ret > 0) { - XFree(prop_ret); - if (XGetWindowProperty(im->core.display, - spec->lib_connect_wid, prop, 0L, - ((length + bytes_after_ret + 3)/ 4), - True, AnyPropertyType, - &type_ret, &format_ret, &nitems, - &bytes_after_ret, - &prop_ret) == Success) { - XChangeProperty(im->core.display, spec->lib_connect_wid, prop, - XA_STRING, 8, PropModePrepend, &prop_ret[length], - (nitems - length)); - } else { - return False; - } - } - } else { - (void)memcpy(buf, prop_ret, buf_len); - *ret_len = buf_len; - len = nitems - buf_len; - - if (bytes_after_ret > 0) { - XFree(prop_ret); - if (XGetWindowProperty(im->core.display, - spec->lib_connect_wid, prop, 0L, - ((length + bytes_after_ret + 3)/ 4), - True, AnyPropertyType, - &type_ret, &format_ret, &nitems, - &bytes_after_ret, &prop_ret) != Success) { - return False; - } - } - XChangeProperty(im->core.display, spec->lib_connect_wid, prop, - XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); - event->xclient.data.l[0] = (long)len; - event->xclient.data.l[1] = (long)prop; - XPutBackEvent(im->core.display, event); - } - XFree(prop_ret); - } else if (event->type == PropertyNotify) { - prop = event->xproperty.atom; - return_code = XGetWindowProperty(im->core.display, - spec->lib_connect_wid, prop, 0L, - 1000000L, True, AnyPropertyType, - &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); - if (return_code != Success || format_ret == 0 || nitems == 0) { - if (return_code == Success) - XFree(prop_ret); - return False; - } - if (buf_len >= nitems) { - (void)memcpy(buf, prop_ret, (int)nitems); - *ret_len = (int)nitems; - } else { - (void)memcpy(buf, prop_ret, buf_len); - *ret_len = buf_len; - len = nitems - buf_len; - XChangeProperty(im->core.display, spec->lib_connect_wid, prop, - XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); - } - XFree(prop_ret); - } - return True; -} - -static Bool -_CheckCMEvent( - Display *display, - XEvent *event, - XPointer xim) -{ - Xim im = (Xim)xim; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - CARD32 major_code = spec->major_code; - - if ((event->type == ClientMessage) - &&((event->xclient.message_type == spec->improtocolid) || - (event->xclient.message_type == spec->immoredataid))) - return True; - if((major_code == 1 || major_code == 2) && - (event->type == PropertyNotify) && - (event->xproperty.state == PropertyNewValue)) - return True; - return False; -} - -static Bool -_XimXRead(Xim im, XPointer recv_buf, int buf_len, int *ret_len) -{ - XEvent *ev; - XEvent event; - int len = 0; - XSpecRec *spec = (XSpecRec *)im->private.proto.spec; - XPointer arg = spec->ev; - - if (!arg) { - bzero(&event, sizeof(XEvent)); - ev = &event; - XIfEvent(im->core.display, ev, _CheckCMEvent, (XPointer)im); - } else { - ev = (XEvent *)arg; - spec->ev = (XPointer)NULL; - } - if (!(_XimXGetReadData(im, recv_buf, buf_len, &len, ev))) - return False; - *ret_len = len; - return True; -} - -static void -_XimXFlush(Xim im) -{ - XFlush(im->core.display); - return; -} - -Bool -_XimXConf(Xim im, char *address) -{ - XSpecRec *spec; - - if (!(spec = Xcalloc(1, sizeof(XSpecRec)))) - return False; - - spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False); - spec->imconnectid = XInternAtom(im->core.display, _XIM_XCONNECT, False); - spec->immoredataid = XInternAtom(im->core.display, _XIM_MOREDATA, False); - spec->major_code = MAJOR_TRANSPORT_VERSION; - spec->minor_code = MINOR_TRANSPORT_VERSION; - - im->private.proto.spec = (XPointer)spec; - im->private.proto.connect = _XimXConnect; - im->private.proto.shutdown = _XimXShutdown; - im->private.proto.write = _XimXWrite; - im->private.proto.read = _XimXRead; - im->private.proto.flush = _XimXFlush; - im->private.proto.register_dispatcher = _XimXRegisterDispatcher; - im->private.proto.call_dispatcher = _XimXCallDispatcher; - - return True; -} diff --git a/nx-X11/lib/X11/imTrans.c b/nx-X11/lib/X11/imTrans.c deleted file mode 100644 index 7f936cff6..000000000 --- a/nx-X11/lib/X11/imTrans.c +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include -#include "Xlcint.h" -#include "Ximint.h" -#include "XimTrans.h" -#include "XimTrInt.h" - -#ifdef WIN32 -#include -#endif - - -#ifndef XIM_CONNECTION_RETRIES -#define XIM_CONNECTION_RETRIES 5 -#endif - - -static Bool -_XimTransConnect( - Xim im) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - int connect_stat, retry; - Window window; - - for (retry = XIM_CONNECTION_RETRIES; retry >= 0; retry--) - { - if ((spec->trans_conn = _XimXTransOpenCOTSClient ( - spec->address)) == NULL) - { - break; - } - - if ((connect_stat = _XimXTransConnect ( - spec->trans_conn, spec->address)) < 0) - { - _XimXTransClose (spec->trans_conn); - spec->trans_conn = NULL; - - if (connect_stat == TRANS_TRY_CONNECT_AGAIN) - continue; - else - break; - } - else - break; - } - - if (spec->trans_conn == NULL) - return False; - - spec->fd = _XimXTransGetConnectionNumber (spec->trans_conn); - - if (!(window = XCreateSimpleWindow(im->core.display, - DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0))) - return False; - spec->window = window; - - _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress, - _XimTransFilterWaitEvent, (XPointer)im); - - return _XRegisterInternalConnection(im->core.display, spec->fd, - (_XInternalConnectionProc)_XimTransInternalConnection, - (XPointer)im); -} - - -static Bool -_XimTransShutdown( - Xim im) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - - _XimXTransDisconnect(spec->trans_conn); - (void)_XimXTransClose(spec->trans_conn); - _XimFreeTransIntrCallback(im); - _XUnregisterInternalConnection(im->core.display, spec->fd); - _XUnregisterFilter(im->core.display, spec->window, - _XimTransFilterWaitEvent, (XPointer)im); - XDestroyWindow(im->core.display, spec->window); - Xfree(spec->address); - Xfree(spec); - return True; -} - - - -Bool -_XimTransRegisterDispatcher( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - TransIntrCallbackPtr rec; - - if (!(rec = Xmalloc(sizeof(TransIntrCallbackRec)))) - return False; - - rec->func = callback; - rec->call_data = call_data; - rec->next = spec->intr_cb; - spec->intr_cb = rec; - return True; -} - - -void -_XimFreeTransIntrCallback( - Xim im) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - register TransIntrCallbackPtr rec, next; - - for (rec = spec->intr_cb; rec;) { - next = rec->next; - Xfree(rec); - rec = next; - } - return; -} - - -Bool -_XimTransCallDispatcher(Xim im, INT16 len, XPointer data) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - TransIntrCallbackRec *rec; - - for (rec = spec->intr_cb; rec; rec = rec->next) { - if ((*rec->func)(im, len, data, rec->call_data)) - return True; - } - return False; -} - - -Bool -_XimTransFilterWaitEvent( - Display *d, - Window w, - XEvent *ev, - XPointer arg) -{ - Xim im = (Xim)arg; - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - - spec->is_putback = False; - return _XimFilterWaitEvent(im); -} - - -void -_XimTransInternalConnection( - Display *d, - int fd, - XPointer arg) -{ - Xim im = (Xim)arg; - XEvent ev; - XKeyEvent *kev; - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - - if (spec->is_putback) - return; - - bzero(&ev, sizeof(ev)); /* FIXME: other fields may be accessed, too. */ - kev = (XKeyEvent *)&ev; - kev->type = KeyPress; - kev->send_event = False; - kev->display = im->core.display; - kev->window = spec->window; - kev->keycode = 0; - kev->time = 0L; - kev->serial = LastKnownRequestProcessed(im->core.display); -#if 0 - fprintf(stderr,"%s,%d: putback FIXED kev->time=0 kev->serial=%lu\n", __FILE__, __LINE__, kev->serial); -#endif - - XPutBackEvent(im->core.display, &ev); - XFlush(im->core.display); - spec->is_putback = True; - return; -} - - -Bool -_XimTransWrite(Xim im, INT16 len, XPointer data) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - char *buf = (char *)data; - register int nbyte; - - while (len > 0) { - if ((nbyte = _XimXTransWrite(spec->trans_conn, buf, len)) <= 0) - return False; - len -= nbyte; - buf += nbyte; - } - return True; -} - - -Bool -_XimTransRead( - Xim im, - XPointer recv_buf, - int buf_len, - int *ret_len) -{ - TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; - int len; - - if (buf_len == 0) { - *ret_len = 0; - return True; - } - if ((len = _XimXTransRead(spec->trans_conn, recv_buf, buf_len)) <= 0) - return False; - *ret_len = len; - return True; -} - - -void -_XimTransFlush( - Xim im) -{ - return; -} - - - -Bool -_XimTransConf( - Xim im, - char *address) -{ - char *paddr; - TransSpecRec *spec; - - if (!(paddr = strdup(address))) - return False; - - if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) { - Xfree(paddr); - return False; - } - - spec->address = paddr; - - im->private.proto.spec = (XPointer)spec; - im->private.proto.connect = _XimTransConnect; - im->private.proto.shutdown = _XimTransShutdown; - im->private.proto.write = _XimTransWrite; - im->private.proto.read = _XimTransRead; - im->private.proto.flush = _XimTransFlush; - im->private.proto.register_dispatcher = _XimTransRegisterDispatcher; - im->private.proto.call_dispatcher = _XimTransCallDispatcher; - - return True; -} diff --git a/nx-X11/lib/X11/imTransR.c b/nx-X11/lib/X11/imTransR.c deleted file mode 100644 index 50b549e71..000000000 --- a/nx-X11/lib/X11/imTransR.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - * Copyright 1992 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/****************************************************************** - - Copyright 1992, 1993, 1994 by FUJITSU LIMITED - -Permission to use, copy, modify, distribute, and sell this software -and its 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 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. -It is provided "as is" without express or implied warranty. - -FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, -INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO -EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. - Takashi Fujiwara FUJITSU LIMITED - fujiwara@a80.tech.yk.fujitsu.co.jp - -******************************************************************/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" -#include "XimTrInt.h" -#include "Ximint.h" - -TransportSW _XimTransportRec[] = { - { "X", _XimXConf }, /* 1st entry must be X. - This will be a fallback */ -#ifdef TCPCONN - { "tcp", _XimTransConf }, /* use X transport lib */ -#endif /* TCPCONN */ -#if defined(UNIXCONN) || defined(LOCALCONN) - { "local", _XimTransConf }, /* use X transport lib */ -#endif /* UNIXCONN */ - { (char *)NULL, (Bool (*)(Xim, char *))NULL }, -}; - -Bool -_XimConnect(Xim im) -{ - return im->private.proto.connect(im); -} - -Bool -_XimShutdown(Xim im) -{ - return im->private.proto.shutdown(im); -} - -Bool -_XimWrite(Xim im, INT16 len, XPointer data) -{ - return im->private.proto.write(im, len, data); -} - -static int -_CheckProtocolData( - Xim im, - char *recv_buf) -{ - int data_len; - - data_len = (int)(((*((CARD16 *)recv_buf + 1)) * 4) + XIM_HEADER_SIZE); - return data_len; -} - -static int -_XimReadData( - Xim im, - INT16 *len, - XPointer buf, - int buf_size) -{ - char *hold_buf; - char *tmp; - int data_len; - int packet_size; - int ret_len; - register int i; - - if (buf_size < XIM_HEADER_SIZE) { - *len = (INT16)XIM_HEADER_SIZE; - return XIM_OVERFLOW; - } - - bzero(buf, buf_size); - packet_size = 0; - data_len = 0; - - if ((hold_buf = im->private.proto.hold_data)) { - data_len = im->private.proto.hold_data_len; - if (data_len >= XIM_HEADER_SIZE) { - packet_size = _CheckProtocolData(im, hold_buf); - if (packet_size > buf_size) { - *len = (INT16)packet_size; - return XIM_OVERFLOW; - } - if (packet_size <= data_len) { - memcpy(buf, hold_buf, packet_size); - for (i = packet_size; i < data_len; i++) { - if (hold_buf[i]) - break; - } - data_len -= i; - - if (data_len) { - if (!(tmp = Xmalloc(data_len))) { - return XIM_FALSE; - } - memcpy(tmp, &hold_buf[i], data_len); - im->private.proto.hold_data = tmp; - im->private.proto.hold_data_len = data_len; - } else { - im->private.proto.hold_data = 0; - im->private.proto.hold_data_len = 0; - } - Xfree(hold_buf); - *len = (INT16)packet_size; - return XIM_TRUE; - } - } - memcpy(buf, hold_buf, data_len); - buf_size -= data_len; - Xfree(hold_buf); - im->private.proto.hold_data = 0; - im->private.proto.hold_data_len = 0; - } - - if (!packet_size) { - while (data_len < XIM_HEADER_SIZE) { - if (!(im->private.proto.read(im, - (XPointer)&buf[data_len], buf_size, &ret_len))) { - return XIM_FALSE; - } - data_len += ret_len; - buf_size -= ret_len; - } - packet_size = _CheckProtocolData(im, buf); - } - - if (packet_size > buf_size) { - if (!(tmp = Xmalloc(data_len))) { - return XIM_FALSE; - } - memcpy(tmp, buf, data_len); - bzero(buf, data_len); - im->private.proto.hold_data = tmp; - im->private.proto.hold_data_len = data_len; - *len = (INT16)packet_size; - return XIM_OVERFLOW; - } - - while (data_len < packet_size) { - if (!(im->private.proto.read(im, - (XPointer)&buf[data_len], buf_size, &ret_len))) { - return XIM_FALSE; - } - data_len += ret_len; - buf_size -= ret_len; - } - - for (i = packet_size; i < data_len; i++) { - if (buf[i]) - break; - } - data_len -= i; - - if (data_len) { - if (!(tmp = Xmalloc(data_len))) { - return XIM_FALSE; - } - memcpy(tmp, &buf[i], data_len); - bzero(&buf[i], data_len); - im->private.proto.hold_data = tmp; - im->private.proto.hold_data_len = data_len; - } else { - im->private.proto.hold_data = 0; - im->private.proto.hold_data_len = 0; - } - *len = (INT16)packet_size; - return XIM_TRUE; -} - -static Bool -_XimCallDispatcher( - Xim im, - INT16 len, - XPointer data) -{ - return im->private.proto.call_dispatcher(im, len, data); -} - -int -_XimRead(Xim im, INT16 *len, XPointer buf, int buf_size, - Bool (*predicate)(Xim, INT16, XPointer, XPointer), XPointer arg) -{ - INT16 read_len; - int ret_code; - - for (;;) { - ret_code = _XimReadData(im, &read_len, buf, buf_size); - if(ret_code != XIM_TRUE) { - return ret_code; - } - if ((*predicate)(im, read_len, buf, arg)) - break; - if (_XimCallDispatcher(im, read_len, buf)) - continue; - _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); - } - *len = read_len; - return True; -} - -Bool -_XimRegisterDispatcher( - Xim im, - Bool (*callback)( - Xim, INT16, XPointer, XPointer - ), - XPointer call_data) -{ - return im->private.proto.register_dispatcher(im, callback, call_data); -} - -void -_XimFlush(Xim im) -{ - im->private.proto.flush(im); - return; -} - -Bool -_XimFilterWaitEvent(Xim im) -{ - INT16 read_len; - CARD32 reply32[BUFSIZE/4]; - char *reply = (char *)reply32; - XPointer preply; - int buf_size; - int ret_code; - - buf_size = BUFSIZE; - ret_code = _XimReadData(im, &read_len, (XPointer)reply, buf_size); - if(ret_code == XIM_TRUE) { - preply = reply; - } else if(ret_code == XIM_OVERFLOW) { - if(read_len <= 0) { - preply = reply; - } else { - buf_size = (int)read_len; - preply = Xmalloc(buf_size); - ret_code = _XimReadData(im, &read_len, preply, buf_size); - if(ret_code != XIM_TRUE) { - if (preply != reply) - Xfree(preply); - return False; - } - } - } else { - return False; - } - if (_XimCallDispatcher(im, read_len, preply)) { - if(reply != preply) - Xfree(preply); - return True; - } - _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); - if(reply != preply) - Xfree(preply); - return True; -} diff --git a/nx-X11/lib/X11/lcCT.c b/nx-X11/lib/X11/lcCT.c deleted file mode 100644 index 6e3f21e92..000000000 --- a/nx-X11/lib/X11/lcCT.c +++ /dev/null @@ -1,1303 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Takanori Tateno FUJITSU LIMITED - * - */ -/* - * 2000 - * Modifier: Ivan Pascal The XFree86 Project - * Modifier: Bruno Haible The XFree86 Project - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" -#include -#include - - -/* ====================== Built-in Character Sets ====================== */ - -/* - * Static representation of a character set that can be used in Compound Text. - */ -typedef struct _CTDataRec { - const char name[19]; - const char ct_sequence[5]; /* Compound Text encoding, ESC sequence */ -} CTDataRec, *CTData; - -static const CTDataRec default_ct_data[] = -{ - /* */ - /* X11 registry name MIME name ISO-IR ESC sequence */ - /* */ - - /* Registered character sets with one byte per character */ - { "ISO8859-1:GL", /* US-ASCII 6 */ "\033(B" }, - { "ISO8859-1:GR", /* ISO-8859-1 100 */ "\033-A" }, - { "ISO8859-2:GR", /* ISO-8859-2 101 */ "\033-B" }, - { "ISO8859-3:GR", /* ISO-8859-3 109 */ "\033-C" }, - { "ISO8859-4:GR", /* ISO-8859-4 110 */ "\033-D" }, - { "ISO8859-5:GR", /* ISO-8859-5 144 */ "\033-L" }, - { "ISO8859-6:GR", /* ISO-8859-6 127 */ "\033-G" }, - { "ISO8859-7:GR", /* ISO-8859-7 126 */ "\033-F" }, - { "ISO8859-8:GR", /* ISO-8859-8 138 */ "\033-H" }, - { "ISO8859-9:GR", /* ISO-8859-9 148 */ "\033-M" }, - { "ISO8859-10:GR", /* ISO-8859-10 157 */ "\033-V" }, - { "ISO8859-11:GR", /* ISO-8859-11 166 */ "\033-T" }, - { "ISO8859-13:GR", /* ISO-8859-13 179 */ "\033-Y" }, - { "ISO8859-14:GR", /* ISO-8859-14 199 */ "\033-_" }, - { "ISO8859-15:GR", /* ISO-8859-15 203 */ "\033-b" }, - { "ISO8859-16:GR", /* ISO-8859-16 226 */ "\033-f" }, - { "JISX0201.1976-0:GL", /* ISO-646-JP 14 */ "\033(J" }, - { "JISX0201.1976-0:GR", "\033)I" }, -#if 0 - { "TIS620-0:GR", /* TIS-620 166 */ "\033-T" }, -#endif - - /* Registered character sets with two byte per character */ - { "GB2312.1980-0:GL", /* GB_2312-80 58 */ "\033$(A" }, - { "GB2312.1980-0:GR", /* GB_2312-80 58 */ "\033$)A" }, - { "JISX0208.1983-0:GL", /* JIS_X0208-1983 87 */ "\033$(B" }, - { "JISX0208.1983-0:GR", /* JIS_X0208-1983 87 */ "\033$)B" }, - { "JISX0208.1990-0:GL", /* JIS_X0208-1990 168 */ "\033$(B" }, - { "JISX0208.1990-0:GR", /* JIS_X0208-1990 168 */ "\033$)B" }, - { "JISX0212.1990-0:GL", /* JIS_X0212-1990 159 */ "\033$(D" }, - { "JISX0212.1990-0:GR", /* JIS_X0212-1990 159 */ "\033$)D" }, - { "KSC5601.1987-0:GL", /* KS_C_5601-1987 149 */ "\033$(C" }, - { "KSC5601.1987-0:GR", /* KS_C_5601-1987 149 */ "\033$)C" }, - { "CNS11643.1986-1:GL", /* CNS 11643-1992 pl.1 171 */ "\033$(G" }, - { "CNS11643.1986-1:GR", /* CNS 11643-1992 pl.1 171 */ "\033$)G" }, - { "CNS11643.1986-2:GL", /* CNS 11643-1992 pl.2 172 */ "\033$(H" }, - { "CNS11643.1986-2:GR", /* CNS 11643-1992 pl.2 172 */ "\033$)H" }, - { "CNS11643.1992-3:GL", /* CNS 11643-1992 pl.3 183 */ "\033$(I" }, - { "CNS11643.1992-3:GR", /* CNS 11643-1992 pl.3 183 */ "\033$)I" }, - { "CNS11643.1992-4:GL", /* CNS 11643-1992 pl.4 184 */ "\033$(J" }, - { "CNS11643.1992-4:GR", /* CNS 11643-1992 pl.4 184 */ "\033$)J" }, - { "CNS11643.1992-5:GL", /* CNS 11643-1992 pl.5 185 */ "\033$(K" }, - { "CNS11643.1992-5:GR", /* CNS 11643-1992 pl.5 185 */ "\033$)K" }, - { "CNS11643.1992-6:GL", /* CNS 11643-1992 pl.6 186 */ "\033$(L" }, - { "CNS11643.1992-6:GR", /* CNS 11643-1992 pl.6 186 */ "\033$)L" }, - { "CNS11643.1992-7:GL", /* CNS 11643-1992 pl.7 187 */ "\033$(M" }, - { "CNS11643.1992-7:GR", /* CNS 11643-1992 pl.7 187 */ "\033$)M" }, - - /* Registered encodings with a varying number of bytes per character */ - { "ISO10646-1", /* UTF-8 196 */ "\033%G" }, - - /* Encodings without ISO-IR assigned escape sequence must be - defined in XLC_LOCALE files, using "\033%/1" or "\033%/2". */ - - /* Backward compatibility with XFree86 3.x */ -#if 1 - { "ISO8859-14:GR", "\033%/1" }, - { "ISO8859-15:GR", "\033%/1" }, -#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" }, - { "BIG5-E1:GL", "\033$(1" }, - { "BIG5-E1:GR", "\033$)1" }, - -}; - -/* We represent UTF-8 as an XlcGLGR charset, not in extended segments. */ -#define UTF8_IN_EXTSEQ 0 - -/* ======================= Parsing ESC Sequences ======================= */ - -#define XctC0 0x0000 -#define XctHT 0x0009 -#define XctNL 0x000a -#define XctESC 0x001b -#define XctGL 0x0020 -#define XctC1 0x0080 -#define XctCSI 0x009b -#define XctGR 0x00a0 -#define XctSTX 0x0002 - -#define XctCntrlFunc 0x0023 -#define XctMB 0x0024 -#define XctOtherCoding 0x0025 -#define XctGL94 0x0028 -#define XctGR94 0x0029 -#define XctGR96 0x002d -#define XctNonStandard 0x002f -#define XctIgnoreExt 0x0030 -#define XctNotIgnoreExt 0x0031 -#define XctLeftToRight 0x0031 -#define XctRightToLeft 0x0032 -#define XctDirection 0x005d -#define XctDirectionEnd 0x005d - -#define XctGL94MB 0x2428 -#define XctGR94MB 0x2429 -#define XctExtSeg 0x252f -#define XctReturn 0x2540 - -/* - * Parses the header of a Compound Text segment, i.e. the charset designator. - * The string starts at *text and has *length bytes. - * Return value is one of: - * 0 (no valid charset designator), - * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, - * XctLeftToRight, XctRightToLeft, XctDirectionEnd, - * XctExtSeg, XctOtherCoding, XctReturn, XctIgnoreExt, XctNotIgnoreExt. - * If the return value is not 0, *text is incremented and *length decremented, - * to point past the charset designator. If the return value is one of - * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, - * XctExtSeg, XctOtherCoding, XctIgnoreExt, XctNotIgnoreExt, - * *final_byte is set to the "final byte" of the charset designator. - */ -static unsigned int -_XlcParseCT( - const char **text, - int *length, - unsigned char *final_byte) -{ - unsigned int ret = 0; - unsigned char ch; - const unsigned char *str = (const unsigned char *) *text; - - *final_byte = 0; - - if (*length < 1) - return 0; - switch (ch = *str++) { - case XctESC: - if (*length < 2) - return 0; - switch (ch = *str++) { - case XctOtherCoding: /* % */ - if (*length < 3) - return 0; - ch = *str++; - if (ch == XctNonStandard) { /* / */ - if (*length < 4) - return 0; - ret = XctExtSeg; - ch = *str++; - } else if (ch == '@') { - ret = XctReturn; - } else { - ret = XctOtherCoding; - } - *final_byte = ch; - break; - - case XctCntrlFunc: /* # */ - if (*length < 4) - return 0; - *final_byte = *str++; - switch (*str++) { - case XctIgnoreExt: /* 0 */ - ret = XctIgnoreExt; - break; - case XctNotIgnoreExt: /* 1 */ - ret = XctNotIgnoreExt; - break; - default: - ret = 0; - break; - } - break; - - case XctMB: /* $ */ - if (*length < 4) - return 0; - ch = *str++; - switch (ch) { - case XctGL94: /* ( */ - ret = XctGL94MB; - break; - case XctGR94: /* ) */ - ret = XctGR94MB; - break; - default: - ret = 0; - break; - } - *final_byte = *str++; - break; - - case XctGL94: /* ( */ - if (*length < 3) - return 0; - ret = XctGL94; - *final_byte = *str++; - break; - case XctGR94: /* ) */ - if (*length < 3) - return 0; - ret = XctGR94; - *final_byte = *str++; - break; - case XctGR96: /* - */ - if (*length < 3) - return 0; - ret = XctGR96; - *final_byte = *str++; - break; - } - break; - case XctCSI: - /* direction */ - if (*length < 2) - return 0; - switch (*str++) { - case XctLeftToRight: - if (*length < 3) - return 0; - if (*str++ == XctDirection) - ret = XctLeftToRight; - break; - case XctRightToLeft: - if (*length < 3) - return 0; - if (*str++ == XctDirection) - ret = XctRightToLeft; - break; - case XctDirectionEnd: - ret = XctDirectionEnd; - break; - } - break; - } - - if (ret) { - *length -= (const char *) str - *text; - *text = (const char *) str; - } - return ret; -} - -/* - * Fills into a freshly created XlcCharSet the fields that can be inferred - * from the ESC sequence. These are side, char_size, set_size. - * Returns True if the charset can be used with Compound Text. - * - * Used by _XlcCreateDefaultCharSet. - */ -Bool -_XlcParseCharSet( - XlcCharSet charset) -{ - unsigned int type; - unsigned char final_byte; - const char *ptr = charset->ct_sequence; - int length; - int char_size; - - if (*ptr == '\0') - return False; - - length = strlen(ptr); - - type = _XlcParseCT(&ptr, &length, &final_byte); - - /* Check for validity and determine char_size. - char_size = 0 means varying number of bytes per character. */ - switch (type) { - case XctGL94: - case XctGR94: - case XctGR96: - char_size = 1; - break; - case XctGL94MB: - case XctGR94MB: - char_size = (final_byte < 0x60 ? 2 : final_byte < 0x70 ? 3 : 4); - break; - case XctExtSeg: - char_size = final_byte - '0'; - if (!(char_size >= 0 && char_size <= 4)) - return False; - break; - case XctOtherCoding: - char_size = 0; - break; - default: - return False; - } - - charset->char_size = char_size; - - /* Fill in other values. */ - switch (type) { - case XctGL94: - case XctGL94MB: - charset->side = XlcGL; - charset->set_size = 94; - break; - case XctGR94: - case XctGR94MB: - charset->side = XlcGR; - charset->set_size = 94; - break; - case XctGR96: - charset->side = XlcGR; - charset->set_size = 96; - break; - case XctExtSeg: - case XctOtherCoding: - charset->side = XlcGLGR; - charset->set_size = 0; - break; - } - return True; -} - - -/* =============== Management of the List of Character Sets =============== */ - -/* - * Representation of a character set that can be used for Compound Text, - * at run time. - * Note: This information is not contained in the XlcCharSet, because - * multiple ESC sequences may be used for the same XlcCharSet. - */ -typedef struct _CTInfoRec { - XlcCharSet charset; - const char *ct_sequence; /* Compound Text ESC sequence */ - unsigned int type; - unsigned char final_byte; - /* If type == XctExtSeg: */ - const char *ext_segment; /* extended segment name, then '\002' */ - int ext_segment_len; /* length of above, including final '\002' */ - - struct _CTInfoRec *next; -} CTInfoRec, *CTInfo; - -/* - * List of character sets that can be used for Compound Text, - * Includes all that are listed in default_ct_data, but more can be added - * at runtime through _XlcAddCT. - */ -static CTInfo ct_list = NULL; -static CTInfo ct_list_end = NULL; - -/* - * Returns a Compound Text info record for an ESC sequence. - * The first part of the ESC sequence has already been parsed into 'type' - * and 'final_byte'. The remainder starts at 'text', at least 'text_len' - * bytes (only used if type == XctExtSeg). - */ -static CTInfo -_XlcGetCTInfo( - unsigned int type, - unsigned char final_byte, - const char *text, - int text_len) -{ - CTInfo ct_info; - - for (ct_info = ct_list; ct_info; ct_info = ct_info->next) - if (ct_info->type == type - && ct_info->final_byte == final_byte - && (type != XctExtSeg - || (text_len >= ct_info->ext_segment_len - && memcmp(text, ct_info->ext_segment, - ct_info->ext_segment_len) == 0))) - return ct_info; - - return (CTInfo) NULL; -} - -/* Returns the Compound Text info for a given XlcCharSet. - Returns NULL if none is found. */ -static CTInfo -_XlcGetCTInfoFromCharSet( - XlcCharSet charset) -{ - CTInfo ct_info; - - for (ct_info = ct_list; ct_info; ct_info = ct_info->next) - if (ct_info->charset == charset) - return ct_info; - - return (CTInfo) NULL; -} - -/* Creates a new XlcCharSet, given its name (including side suffix) and - Compound Text ESC sequence (normally at most 4 bytes), and makes it - eligible for Compound Text processing. */ -XlcCharSet -_XlcAddCT( - const char *name, - const char *ct_sequence) -{ - CTInfo ct_info, existing_info; - XlcCharSet charset; - const char *ct_ptr; - int length; - unsigned int type; - unsigned char final_byte; - - charset = _XlcGetCharSet(name); - if (charset != NULL) { - /* Even if the charset already exists, it is OK to register a second - Compound Text sequence for it. */ - } else { - /* Attempt to create the charset. */ - charset = _XlcCreateDefaultCharSet(name, ct_sequence); - if (charset == NULL) - return (XlcCharSet) NULL; - _XlcAddCharSet(charset); - } - - /* Allocate a CTinfo record. */ - length = strlen(ct_sequence); - ct_info = Xmalloc(sizeof(CTInfoRec) + length+1); - if (ct_info == NULL) - return charset; - - ct_info->charset = charset; - ct_info->ct_sequence = strcpy((char *) (ct_info + 1), ct_sequence); - - /* Parse the Compound Text sequence. */ - ct_ptr = ct_sequence; - type = _XlcParseCT(&ct_ptr, &length, &final_byte); - - ct_info->type = type; - ct_info->final_byte = final_byte; - - switch (type) { - case XctGL94: - case XctGR94: - case XctGR96: - case XctGL94MB: - case XctGR94MB: - case XctOtherCoding: - ct_info->ext_segment = NULL; - ct_info->ext_segment_len = 0; - break; - case XctExtSeg: { - /* By convention, the extended segment name is the encoding_name - in lowercase. */ - const char *q = charset->encoding_name; - int n = strlen(q); - char *p; - - /* Ensure ct_info->ext_segment_len <= 0x3fff - 6. */ - if (n > 0x3fff - 6 - 1) { - Xfree(ct_info); - return charset; - } - p = Xmalloc(n+1); - if (p == NULL) { - Xfree(ct_info); - return charset; - } - ct_info->ext_segment = p; - ct_info->ext_segment_len = n+1; - for ( ; n > 0; p++, q++, n--) - *p = (*q >= 'A' && *q <= 'Z' ? *q - 'A' + 'a' : *q); - *p = XctSTX; - break; - } - default: - Xfree(ct_info); - return (XlcCharSet) NULL; - } - - /* Insert it into the list, if not already present. */ - existing_info = - _XlcGetCTInfo(type, ct_info->final_byte, - ct_info->ext_segment, ct_info->ext_segment_len); - if (existing_info == NULL) { - /* Insert it at the end. If there are duplicates CTinfo entries - for the same XlcCharSet, we want the first (standard) one to - override the second (user defined) one. */ - ct_info->next = NULL; - if (ct_list_end) - ct_list_end->next = ct_info; - else - ct_list = ct_info; - ct_list_end = ct_info; - } else { - if (existing_info->charset != charset - /* We have a conflict, with one exception: JISX0208.1983-0 and - JISX0208.1990-0 are the same for all practical purposes. */ - && !(strncmp(existing_info->charset->name, "JISX0208", 8) == 0 - && strncmp(charset->name, "JISX0208", 8) == 0)) { - fprintf(stderr, - "Xlib: charsets %s and %s have the same CT sequence\n", - charset->name, existing_info->charset->name); - if (strcmp(charset->ct_sequence, ct_sequence) == 0) - charset->ct_sequence = ""; - } - Xfree(ct_info); - } - - return charset; -} - - -/* ========== Converters String <--> CharSet <--> Compound Text ========== */ - -/* - * Structure representing the parse state of a Compound Text string. - */ -typedef struct _StateRec { - XlcCharSet charset; /* The charset of the current segment */ - XlcCharSet GL_charset; /* The charset responsible for 0x00..0x7F */ - XlcCharSet GR_charset; /* The charset responsible for 0x80..0xFF */ - XlcCharSet Other_charset; /* != NULL if currently in an other segment */ - int ext_seg_left; /* > 0 if currently in an extended segment */ -} StateRec, *State; - - -/* Subroutine for parsing an ESC sequence. */ - -typedef enum { - resOK, /* Charset saved in 'state', sequence skipped */ - resNotInList, /* Charset not found, sequence skipped */ - resNotCTSeq /* EscSeq not recognized, pointers not changed */ -} CheckResult; - -static CheckResult -_XlcCheckCTSequence( - State state, - const char **ctext, - int *ctext_len) -{ - XlcCharSet charset; - CTInfo ct_info; - const char *tmp_ctext = *ctext; - int tmp_ctext_len = *ctext_len; - unsigned int type; - unsigned char final_byte; - int ext_seg_left = 0; - - /* Check for validity. */ - type = _XlcParseCT(&tmp_ctext, &tmp_ctext_len, &final_byte); - - switch (type) { - case XctGL94: - case XctGR94: - case XctGR96: - case XctGL94MB: - case XctGR94MB: - case XctOtherCoding: - *ctext = tmp_ctext; - *ctext_len = tmp_ctext_len; - break; - case XctReturn: - *ctext = tmp_ctext; - *ctext_len = tmp_ctext_len; - state->Other_charset = NULL; - return resOK; - case XctExtSeg: - if (tmp_ctext_len > 2 - && (tmp_ctext[0] & 0x80) && (tmp_ctext[0] & 0x80)) { - unsigned int msb = tmp_ctext[0] & 0x7f; - unsigned int lsb = tmp_ctext[1] & 0x7f; - ext_seg_left = (msb << 7) + lsb; - if (ext_seg_left <= tmp_ctext_len - 2) { - *ctext = tmp_ctext + 2; - *ctext_len = tmp_ctext_len - 2; - break; - } - } - return resNotCTSeq; - default: - return resNotCTSeq; - } - - ct_info = _XlcGetCTInfo(type, final_byte, *ctext, ext_seg_left); - - if (ct_info) { - charset = ct_info->charset; - state->ext_seg_left = ext_seg_left; - if (type == XctExtSeg) { - state->charset = charset; - /* Skip past the extended segment name and the separator. */ - *ctext += ct_info->ext_segment_len; - *ctext_len -= ct_info->ext_segment_len; - state->ext_seg_left -= ct_info->ext_segment_len; - } else if (type == XctOtherCoding) { - state->Other_charset = charset; - } else { - if (charset->side == XlcGL) { - state->GL_charset = charset; - } else if (charset->side == XlcGR) { - state->GR_charset = charset; - } else { - state->GL_charset = charset; - state->GR_charset = charset; - } - } - return resOK; - } else { - state->ext_seg_left = 0; - if (type == XctExtSeg) { - /* Skip the entire extended segment. */ - *ctext += ext_seg_left; - *ctext_len -= ext_seg_left; - } - return resNotInList; - } -} - -static void -init_state( - XlcConv conv) -{ - State state = (State) conv->state; - static XlcCharSet default_GL_charset = NULL; - static XlcCharSet default_GR_charset = NULL; - - if (default_GL_charset == NULL) { - default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); - default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); - } - - /* The initial state is ISO-8859-1 on both sides. */ - state->GL_charset = state->charset = default_GL_charset; - state->GR_charset = default_GR_charset; - - state->Other_charset = NULL; - - state->ext_seg_left = 0; -} - -/* from XlcNCompoundText to XlcNCharSet */ - -static int -cttocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XlcCharSet charset = NULL; - const char *ctptr; - char *bufptr; - int ctext_len, buf_len; - int unconv_num = 0; - - ctptr = (const char *) *from; - bufptr = (char *) *to; - ctext_len = *from_left; - buf_len = *to_left; - - while (ctext_len > 0 && buf_len > 0) { - if (state->ext_seg_left == 0) { - /* Not in the middle of an extended segment; look at next byte. */ - unsigned char ch = *ctptr; - XlcCharSet ch_charset; - - if (ch == XctESC) { - CheckResult ret = - _XlcCheckCTSequence(state, &ctptr, &ctext_len); - if (ret == resOK) - /* state has been modified. */ - continue; - if (ret == resNotInList) { - /* XXX Just continue with previous charset. */ - unconv_num++; - continue; - } - } else if (ch == XctCSI) { - /* XXX Simply ignore the XctLeftToRight, XctRightToLeft, - XctDirectionEnd sequences for the moment. */ - unsigned char dummy; - if (_XlcParseCT(&ctptr, &ctext_len, &dummy)) { - unconv_num++; - continue; - } - } - - /* Find the charset which is responsible for this byte. */ - ch_charset = (state->Other_charset != NULL ? state->Other_charset : - (ch & 0x80 ? state->GR_charset : state->GL_charset)); - - /* Set the charset of this run, or continue the current run, - or stop the current run. */ - if (charset) { - if (charset != ch_charset) - break; - } else { - state->charset = charset = ch_charset; - } - - /* We don't want to split a character into multiple pieces. */ - if (buf_len < 6) { - if (charset->char_size > 0) { - if (buf_len < charset->char_size) - break; - } else { - /* char_size == 0 is tricky. The code here is good only - for valid UTF-8 input. */ - if (charset->ct_sequence[0] == XctESC - && charset->ct_sequence[1] == XctOtherCoding - && charset->ct_sequence[2] == 'G') { - int char_size = (ch < 0xc0 ? 1 : - ch < 0xe0 ? 2 : - ch < 0xf0 ? 3 : - ch < 0xf8 ? 4 : - ch < 0xfc ? 5 : - 6); - if (buf_len < char_size) - break; - } - } - } - - *bufptr++ = *ctptr++; - ctext_len--; - buf_len--; - } else { - /* Copy as much as possible from the current extended segment - to the buffer. */ - int char_size; - - /* Set the charset of this run, or continue the current run, - or stop the current run. */ - if (charset) { - if (charset != state->charset) - break; - } else { - charset = state->charset; - } - - char_size = charset->char_size; - - if (state->ext_seg_left <= buf_len || char_size > 0) { - int n = (state->ext_seg_left <= buf_len - ? state->ext_seg_left - : (buf_len / char_size) * char_size); - memcpy(bufptr, ctptr, n); - ctptr += n; ctext_len -= n; - bufptr += n; buf_len -= n; - state->ext_seg_left -= n; - } else { -#if UTF8_IN_EXTSEQ - /* char_size == 0 is tricky. The code here is good only - for valid UTF-8 input. */ - if (strcmp(charset->name, "ISO10646-1") == 0) { - unsigned char ch = *ctptr; - int char_size = (ch < 0xc0 ? 1 : - ch < 0xe0 ? 2 : - ch < 0xf0 ? 3 : - ch < 0xf8 ? 4 : - ch < 0xfc ? 5 : - 6); - int i; - if (buf_len < char_size) - break; - /* A small loop is faster than calling memcpy. */ - for (i = char_size; i > 0; i--) - *bufptr++ = *ctptr++; - ctext_len -= char_size; - buf_len -= char_size; - state->ext_seg_left -= char_size; - } else -#endif - { - /* Here ctext_len >= state->ext_seg_left > buf_len. - We may be splitting a character into multiple pieces. - Oh well. */ - int n = buf_len; - memcpy(bufptr, ctptr, n); - ctptr += n; ctext_len -= n; - bufptr += n; buf_len -= n; - state->ext_seg_left -= n; - } - } - } - } - - /* 'charset' is the charset for the current run. In some cases, - 'state->charset' contains the charset for the next run. Therefore, - return 'charset'. - 'charset' may still be NULL only if no output was produced. */ - if (num_args > 0) - *((XlcCharSet *) args[0]) = charset; - - *from_left -= ctptr - *((const char **) from); - *from = (XPointer) ctptr; - - *to_left -= bufptr - *((char **) to); - *to = (XPointer) bufptr; - - return unconv_num; -} - -/* from XlcNCharSet to XlcNCompoundText */ - -static int -cstoct( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XlcSide side; - unsigned char min_ch = 0, max_ch = 0; - int length, unconv_num; - CTInfo ct_info; - XlcCharSet charset; - const char *csptr; - char *ctptr; - int csstr_len, ct_len; - char *ext_segment_start; - int char_size; - - /* One argument is required, of type XlcCharSet. */ - if (num_args < 1) - return -1; - - csptr = *((const char **) from); - ctptr = *((char **) to); - csstr_len = *from_left; - ct_len = *to_left; - - charset = (XlcCharSet) args[0]; - - ct_info = _XlcGetCTInfoFromCharSet(charset); - if (ct_info == NULL) - return -1; - - side = charset->side; - length = strlen(ct_info->ct_sequence); - - ext_segment_start = NULL; - - if (ct_info->type == XctOtherCoding) { - /* Output the Escape sequence for switching to the charset, and - reserve room now for the XctReturn sequence at the end. */ - if (ct_len < length + 3) - return -1; - - memcpy(ctptr, ct_info->ct_sequence, length); - ctptr += length; - ct_len -= length + 3; - } else - /* Test whether the charset is already active. */ - if (((side == XlcGR || side == XlcGLGR) - && charset != state->GR_charset) - || ((side == XlcGL || side == XlcGLGR) - && charset != state->GL_charset)) { - - /* Output the Escape sequence for switching to the charset. */ - if (ct_info->type == XctExtSeg) { - if (ct_len < length + 2 + ct_info->ext_segment_len) - return -1; - - memcpy(ctptr, ct_info->ct_sequence, length); - ctptr += length; - ct_len -= length; - - ctptr += 2; - ct_len -= 2; - ext_segment_start = ctptr; - - /* The size of an extended segment must fit in 14 bits. */ - if (ct_len > 0x3fff) - ct_len = 0x3fff; - - memcpy(ctptr, ct_info->ext_segment, ct_info->ext_segment_len); - ctptr += ct_info->ext_segment_len; - ct_len -= ct_info->ext_segment_len; - } else { - if (ct_len < length) - return -1; - - memcpy(ctptr, ct_info->ct_sequence, length); - ctptr += length; - ct_len -= length; - } - } - - /* If the charset has side GL or GR, prepare remapping the characters - to the correct side. */ - if (charset->set_size) { - min_ch = 0x20; - max_ch = 0x7f; - if (charset->set_size == 94) { - max_ch--; - if (charset->char_size > 1 || side == XlcGR) - min_ch++; - } - } - - /* Actually copy the contents. */ - unconv_num = 0; - char_size = charset->char_size; - if (char_size == 1) { - while (csstr_len > 0 && ct_len > 0) { - if (charset->set_size) { - /* The CompoundText specification says that the only - control characters allowed are 0x09, 0x0a, 0x1b, 0x9b. - Therefore here we eliminate other control characters. */ - unsigned char ch = *((const unsigned char *) csptr) & 0x7f; - if (!((ch >= min_ch && ch <= max_ch) - || (side == XlcGL - && (ch == 0x00 || ch == 0x09 || ch == 0x0a)) - || ((side == XlcGL || side == XlcGR) - && (ch == 0x1b)))) { - csptr++; - csstr_len--; - unconv_num++; - continue; - } - } - - if (side == XlcGL) - *ctptr++ = *csptr++ & 0x7f; - else if (side == XlcGR) - *ctptr++ = *csptr++ | 0x80; - else - *ctptr++ = *csptr++; - csstr_len--; - ct_len--; - } - } else if (char_size > 1) { - while (csstr_len >= char_size && ct_len >= char_size) { - if (side == XlcGL) { - int i; - for (i = char_size; i > 0; i--) - *ctptr++ = *csptr++ & 0x7f; - } else if (side == XlcGR) { - int i; - for (i = char_size; i > 0; i--) - *ctptr++ = *csptr++ | 0x80; - } else { - int i; - for (i = char_size; i > 0; i--) - *ctptr++ = *csptr++; - } - csstr_len -= char_size; - ct_len -= char_size; - } - } else { - /* char_size = 0. The code here is good only for valid UTF-8 input. */ - if ((charset->ct_sequence[0] == XctESC - && charset->ct_sequence[1] == XctOtherCoding - && charset->ct_sequence[2] == 'G') -#if UTF8_IN_EXTSEQ - || strcmp(charset->name, "ISO10646-1") == 0 -#endif - ) { - while (csstr_len > 0 && ct_len > 0) { - unsigned char ch = * (const unsigned char *) csptr; - int char_size = (ch < 0xc0 ? 1 : - ch < 0xe0 ? 2 : - ch < 0xf0 ? 3 : - ch < 0xf8 ? 4 : - ch < 0xfc ? 5 : - 6); - int i; - if (!(csstr_len >= char_size && ct_len >= char_size)) - break; - for (i = char_size; i > 0; i--) - *ctptr++ = *csptr++; - csstr_len -= char_size; - ct_len -= char_size; - } - } else { - while (csstr_len > 0 && ct_len > 0) { - *ctptr++ = *csptr++; - csstr_len--; - ct_len--; - } - } - } - - if (ct_info->type == XctOtherCoding) { - /* Terminate with an XctReturn sequence. */ - ctptr[0] = XctESC; - ctptr[1] = XctOtherCoding; - ctptr[2] = '@'; - ctptr += 3; - } else if (ext_segment_start != NULL) { - /* Backpatch the extended segment's length. */ - int ext_segment_length = ctptr - ext_segment_start; - *(ext_segment_start - 2) = (ext_segment_length >> 7) | 0x80; - *(ext_segment_start - 1) = (ext_segment_length & 0x7f) | 0x80; - } else { - if (side == XlcGR || side == XlcGLGR) - state->GR_charset = charset; - if (side == XlcGL || side == XlcGLGR) - state->GL_charset = charset; - } - - *from_left -= csptr - *((const char **) from); - *from = (XPointer) csptr; - - *to_left -= ctptr - *((char **) to); - *to = (XPointer) ctptr; - - return 0; -} - -/* from XlcNString to XlcNCharSet */ - -static int -strtocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - const char *src; - char *dst; - unsigned char side; - int length; - - src = (const char *) *from; - dst = (char *) *to; - - length = min(*from_left, *to_left); - side = *((const unsigned char *) src) & 0x80; - - while (side == (*((const unsigned char *) src) & 0x80) && length-- > 0) - *dst++ = *src++; - - *from_left -= src - (const char *) *from; - *from = (XPointer) src; - *to_left -= dst - (char *) *to; - *to = (XPointer) dst; - - if (num_args > 0) - *((XlcCharSet *)args[0]) = (side ? state->GR_charset : state->GL_charset); - - return 0; -} - -/* from XlcNCharSet to XlcNString */ - -static int -cstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - const char *csptr; - char *string_ptr; - int csstr_len, str_len; - unsigned char ch; - int unconv_num = 0; - - /* This converter can only convert from ISO8859-1:GL and ISO8859-1:GR. */ - if (num_args < 1 - || !((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; - str_len = *to_left; - - while (csstr_len > 0 && str_len > 0) { - ch = *((const unsigned char *) csptr++); - csstr_len--; - /* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character - set plus the control characters TAB and NEWLINE." */ - if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) - || (ch >= 0x7f && ch < 0xa0)) { - unconv_num++; - continue; - } - *((unsigned char *) string_ptr++) = ch; - str_len--; - } - - *from_left -= csptr - *((const char **) from); - *from = (XPointer) csptr; - - *to_left -= string_ptr - *((char **) to); - *to = (XPointer) string_ptr; - - return unconv_num; -} - - -static XlcConv -create_conv( - XlcConvMethods methods) -{ - XlcConv conv; - - conv = Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec)); - if (conv == NULL) - return (XlcConv) NULL; - - conv->state = (XPointer) &conv[1]; - - conv->methods = methods; - - init_state(conv); - - return conv; -} - -static void -close_converter( - XlcConv conv) -{ - /* conv->state is allocated together with conv, free both at once. */ - Xfree(conv); -} - - -static XlcConvMethodsRec cttocs_methods = { - close_converter, - cttocs, - init_state -}; - -static XlcConv -open_cttocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(&cttocs_methods); -} - - -static XlcConvMethodsRec cstoct_methods = { - close_converter, - cstoct, - init_state -}; - -static XlcConv -open_cstoct( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(&cstoct_methods); -} - - -static XlcConvMethodsRec strtocs_methods = { - close_converter, - strtocs, - init_state -}; - -static XlcConv -open_strtocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(&strtocs_methods); -} - - -static XlcConvMethodsRec cstostr_methods = { - close_converter, - cstostr, - init_state -}; - -static XlcConv -open_cstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(&cstostr_methods); -} - - -/* =========================== Initialization =========================== */ - -Bool -_XlcInitCTInfo(void) -{ - if (ct_list == NULL) { - const CTDataRec *ct_data; - int num; - XlcCharSet charset; - - /* Initialize ct_list. */ - - num = sizeof(default_ct_data) / sizeof(CTDataRec); - for (ct_data = default_ct_data; num > 0; ct_data++, num--) { - charset = _XlcAddCT(ct_data->name, ct_data->ct_sequence); - if (charset == NULL) - continue; - if (strncmp(charset->ct_sequence, "\x1b\x25\x2f", 3) != 0) - charset->source = CSsrcStd; - else - charset->source = CSsrcXLC; - } - - /* Register CompoundText and CharSet converters. */ - - _XlcSetConverter((XLCd) NULL, XlcNCompoundText, - (XLCd) NULL, XlcNCharSet, - open_cttocs); - _XlcSetConverter((XLCd) NULL, XlcNString, - (XLCd) NULL, XlcNCharSet, - open_strtocs); - - _XlcSetConverter((XLCd) NULL, XlcNCharSet, - (XLCd) NULL, XlcNCompoundText, - open_cstoct); - _XlcSetConverter((XLCd) NULL, XlcNCharSet, - (XLCd) NULL, XlcNString, - open_cstostr); - } - - return True; -} diff --git a/nx-X11/lib/X11/lcCharSet.c b/nx-X11/lib/X11/lcCharSet.c deleted file mode 100644 index 0adf0adfc..000000000 --- a/nx-X11/lib/X11/lcCharSet.c +++ /dev/null @@ -1,225 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "XlcPublic.h" -#include "XlcPubI.h" - -/* The list of all known XlcCharSets. They are identified by their name. */ - -typedef struct _XlcCharSetListRec { - XlcCharSet charset; - struct _XlcCharSetListRec *next; -} XlcCharSetListRec, *XlcCharSetList; - -static XlcCharSetList charset_list = NULL; - -/* Returns the charset with the given name (including side suffix). - Returns NULL if not found. */ -XlcCharSet -_XlcGetCharSet( - const char *name) -{ - XlcCharSetList list; - XrmQuark xrm_name; - - xrm_name = XrmStringToQuark(name); - - for (list = charset_list; list; list = list->next) { - if (xrm_name == list->charset->xrm_name) - return (XlcCharSet) list->charset; - } - - return (XlcCharSet) NULL; -} - -/* Returns the charset with the given encoding (no side suffix) and - responsible for at least the given side (XlcGL or XlcGR). - Returns NULL if not found. */ -XlcCharSet -_XlcGetCharSetWithSide( - const char *encoding_name, - XlcSide side) -{ - XlcCharSetList list; - XrmQuark xrm_encoding_name; - - xrm_encoding_name = XrmStringToQuark(encoding_name); - - for (list = charset_list; list; list = list->next) { - if (list->charset->xrm_encoding_name == xrm_encoding_name - && (list->charset->side == XlcGLGR || list->charset->side == side)) - return (XlcCharSet) list->charset; - } - - return (XlcCharSet) NULL; -} - -/* Registers an XlcCharSet in the list of character sets. - Returns True if successful. */ -Bool -_XlcAddCharSet( - XlcCharSet charset) -{ - XlcCharSetList list; - - if (_XlcGetCharSet(charset->name)) - return False; - - list = Xmalloc(sizeof(XlcCharSetListRec)); - if (list == NULL) - return False; - - list->charset = charset; - list->next = charset_list; - charset_list = list; - - return True; -} - -/* List of resources for XlcCharSet. */ -static XlcResource resources[] = { - { XlcNName, NULLQUARK, sizeof(char *), - XOffsetOf(XlcCharSetRec, name), XlcGetMask }, - { XlcNEncodingName, NULLQUARK, sizeof(char *), - XOffsetOf(XlcCharSetRec, encoding_name), XlcGetMask }, - { XlcNSide, NULLQUARK, sizeof(XlcSide), - XOffsetOf(XlcCharSetRec, side), XlcGetMask }, - { XlcNCharSize, NULLQUARK, sizeof(int), - XOffsetOf(XlcCharSetRec, char_size), XlcGetMask }, - { XlcNSetSize, NULLQUARK, sizeof(int), - XOffsetOf(XlcCharSetRec, set_size), XlcGetMask }, - { XlcNControlSequence, NULLQUARK, sizeof(char *), - XOffsetOf(XlcCharSetRec, ct_sequence), XlcGetMask } -}; - -/* Retrieves a number of attributes of an XlcCharSet. - Return NULL if successful, otherwise the name of the first argument - specifiying a nonexistent attribute. */ -static char * -get_values( - XlcCharSet charset, - XlcArgList args, - int num_args) -{ - if (resources[0].xrm_name == NULLQUARK) - _XlcCompileResourceList(resources, XlcNumber(resources)); - - return _XlcGetValues((XPointer) charset, resources, XlcNumber(resources), - args, num_args, XlcGetMask); -} - -/* Retrieves a number of attributes of an XlcCharSet. - Return NULL if successful, otherwise the name of the first argument - specifiying a nonexistent attribute. */ -char * -_XlcGetCSValues(XlcCharSet charset, ...) -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - - va_start(var, charset); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, charset); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - ret = get_values(charset, args, num_args); - - Xfree(args); - - return ret; -} - -/* Creates a new XlcCharSet, given its name (including side suffix) and - Compound Text ESC sequence (normally at most 4 bytes). */ -XlcCharSet -_XlcCreateDefaultCharSet( - const char *name, - const char *ct_sequence) -{ - XlcCharSet charset; - int name_len, ct_sequence_len; - const char *colon; - char *tmp; - - charset = Xcalloc(1, sizeof(XlcCharSetRec)); - if (charset == NULL) - return (XlcCharSet) NULL; - - name_len = strlen(name); - ct_sequence_len = strlen(ct_sequence); - - /* Fill in name and xrm_name. */ - tmp = Xmalloc(name_len + 1 + ct_sequence_len + 1); - if (tmp == NULL) { - Xfree(charset); - return (XlcCharSet) NULL; - } - memcpy(tmp, name, name_len+1); - charset->name = tmp; - charset->xrm_name = XrmStringToQuark(charset->name); - - /* Fill in encoding_name and xrm_encoding_name. */ - if ((colon = strchr(charset->name, ':')) != NULL) { - unsigned int length = colon - charset->name; - char *encoding_tmp = Xmalloc(length + 1); - if (encoding_tmp == NULL) { - Xfree((char *) charset->name); - Xfree(charset); - return (XlcCharSet) NULL; - } - memcpy(encoding_tmp, charset->name, length); - encoding_tmp[length] = '\0'; - charset->encoding_name = encoding_tmp; - charset->xrm_encoding_name = XrmStringToQuark(charset->encoding_name); - } else { - charset->encoding_name = charset->name; - charset->xrm_encoding_name = charset->xrm_name; - } - - /* Fill in ct_sequence. */ - tmp += name_len + 1; - memcpy(tmp, ct_sequence, ct_sequence_len+1); - charset->ct_sequence = tmp; - - /* Fill in side, char_size, set_size. */ - if (!_XlcParseCharSet(charset)) - /* If ct_sequence is not usable in Compound Text, remove it. */ - charset->ct_sequence = ""; - - return (XlcCharSet) charset; -} diff --git a/nx-X11/lib/X11/lcConv.c b/nx-X11/lib/X11/lcConv.c deleted file mode 100644 index 7d9a4738c..000000000 --- a/nx-X11/lib/X11/lcConv.c +++ /dev/null @@ -1,339 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" -#include - -typedef struct _XlcConverterListRec { - XLCd from_lcd; - const char *from; - XrmQuark from_type; - XLCd to_lcd; - const char *to; - XrmQuark to_type; - XlcOpenConverterProc converter; - struct _XlcConverterListRec *next; -} XlcConverterListRec, *XlcConverterList; - -static XlcConverterList conv_list = NULL; - -static void -close_converter( - XlcConv conv) -{ - (*conv->methods->close)(conv); -} - -static XlcConv -get_converter( - XLCd from_lcd, - XrmQuark from_type, - XLCd to_lcd, - XrmQuark to_type) -{ - XlcConverterList list, prev = NULL; - - for (list = conv_list; list; list = list->next) { - 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 */ - prev->next = list->next; - list->next = conv_list; - conv_list = list; - } - - return (*list->converter)(from_lcd, list->from, to_lcd, list->to); - } - - prev = list; - } - - return (XlcConv) NULL; -} - -Bool -_XlcSetConverter( - XLCd from_lcd, - const char *from, - XLCd to_lcd, - const char *to, - XlcOpenConverterProc converter) -{ - XlcConverterList list; - XrmQuark from_type, to_type; - - from_type = XrmStringToQuark(from); - to_type = XrmStringToQuark(to); - - for (list = conv_list; list; list = list->next) { - if (list->from_lcd == from_lcd && list->to_lcd == to_lcd - && list->from_type == from_type && list->to_type == to_type) { - - list->converter = converter; - return True; - } - } - - list = Xmalloc(sizeof(XlcConverterListRec)); - if (list == NULL) - return False; - - list->from_lcd = from_lcd; - list->from = from; - list->from_type = from_type; - list->to_lcd = to_lcd; - list->to = to; - list->to_type = to_type; - list->converter = converter; - list->next = conv_list; - conv_list = list; - - return True; -} - -typedef struct _ConvRec { - XlcConv from_conv; - XlcConv to_conv; -} ConvRec, *Conv; - -static int -indirect_convert( - XlcConv lc_conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - Conv conv = (Conv) lc_conv->state; - XlcConv from_conv = conv->from_conv; - XlcConv to_conv = conv->to_conv; - XlcCharSet charset; - char buf[BUFSIZ], *cs; - XPointer tmp_args[1]; - int cs_left, ret, length, unconv_num = 0; - - if (from == NULL || *from == NULL) { - if (from_conv->methods->reset) - (*from_conv->methods->reset)(from_conv); - - if (to_conv->methods->reset) - (*to_conv->methods->reset)(to_conv); - - return 0; - } - - while (*from_left > 0) { - cs = buf; - cs_left = BUFSIZ; - tmp_args[0] = (XPointer) &charset; - - ret = (*from_conv->methods->convert)(from_conv, from, from_left, &cs, - &cs_left, tmp_args, 1); - if (ret < 0) - break; - - unconv_num += ret; - - length = cs - buf; - if (length > 0) { - cs_left = length; - cs = buf; - - tmp_args[0] = (XPointer) charset; - - ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left, - tmp_args, 1); - if (ret < 0) { - unconv_num += length / (charset->char_size > 0 ? charset->char_size : 1); - continue; - } - - unconv_num += ret; - - if (*to_left < 1) - break; - } - } - - return unconv_num; -} - -static void -close_indirect_converter( - XlcConv lc_conv) -{ - Conv conv = (Conv) lc_conv->state; - - if (conv) { - if (conv->from_conv) - close_converter(conv->from_conv); - if (conv->to_conv) - close_converter(conv->to_conv); - - Xfree(conv); - } - - Xfree(lc_conv); -} - -static void -reset_indirect_converter( - XlcConv lc_conv) -{ - Conv conv = (Conv) lc_conv->state; - - if (conv) { - if (conv->from_conv && conv->from_conv->methods->reset) - (*conv->from_conv->methods->reset)(conv->from_conv); - if (conv->to_conv && conv->to_conv->methods->reset) - (*conv->to_conv->methods->reset)(conv->to_conv); - } -} - -static XlcConvMethodsRec conv_methods = { - close_indirect_converter, - indirect_convert, - reset_indirect_converter -} ; - -static XlcConv -open_indirect_converter( - XLCd from_lcd, - const char *from, - XLCd to_lcd, - const char *to) -{ - XlcConv lc_conv, from_conv, to_conv; - Conv conv; - XrmQuark from_type, to_type; - static XrmQuark QChar, QCharSet, QCTCharSet = (XrmQuark) 0; - - if (QCTCharSet == (XrmQuark) 0) { - QCTCharSet = XrmStringToQuark(XlcNCTCharSet); - QCharSet = XrmStringToQuark(XlcNCharSet); - QChar = XrmStringToQuark(XlcNChar); - } - - from_type = XrmStringToQuark(from); - to_type = XrmStringToQuark(to); - - if (from_type == QCharSet || from_type == QChar || to_type == QCharSet || - to_type == QChar) - return (XlcConv) NULL; - - lc_conv = Xmalloc(sizeof(XlcConvRec)); - if (lc_conv == NULL) - return (XlcConv) NULL; - - lc_conv->methods = &conv_methods; - - lc_conv->state = Xcalloc(1, sizeof(ConvRec)); - if (lc_conv->state == NULL) - goto err; - - conv = (Conv) lc_conv->state; - - from_conv = get_converter(from_lcd, from_type, from_lcd, QCTCharSet); - if (from_conv == NULL) - from_conv = get_converter(from_lcd, from_type, from_lcd, QCharSet); - if (from_conv == NULL) - from_conv = get_converter((XLCd)NULL, from_type, (XLCd)NULL, QCharSet); - if (from_conv == NULL) - from_conv = get_converter(from_lcd, from_type, from_lcd, QChar); - if (from_conv == NULL) - goto err; - conv->from_conv = from_conv; - - to_conv = get_converter(to_lcd, QCTCharSet, to_lcd, to_type); - if (to_conv == NULL) - to_conv = get_converter(to_lcd, QCharSet, to_lcd, to_type); - if (to_conv == NULL) - to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type); - if (to_conv == NULL) - goto err; - conv->to_conv = to_conv; - - return lc_conv; - -err: - close_indirect_converter(lc_conv); - - return (XlcConv) NULL; -} - -XlcConv -_XlcOpenConverter( - XLCd from_lcd, - const char *from, - XLCd to_lcd, - const char *to) -{ - XlcConv conv; - XrmQuark from_type, to_type; - - from_type = XrmStringToQuark(from); - to_type = XrmStringToQuark(to); - - if ((conv = get_converter(from_lcd, from_type, to_lcd, to_type))) - return conv; - - return open_indirect_converter(from_lcd, from, to_lcd, to); -} - -void -_XlcCloseConverter( - XlcConv conv) -{ - close_converter(conv); -} - -int -_XlcConvert( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - return (*conv->methods->convert)(conv, from, from_left, to, to_left, args, - num_args); -} - -void -_XlcResetConverter( - XlcConv conv) -{ - if (conv->methods->reset) - (*conv->methods->reset)(conv); -} diff --git a/nx-X11/lib/X11/lcDB.c b/nx-X11/lib/X11/lcDB.c deleted file mode 100644 index cc14bed72..000000000 --- a/nx-X11/lib/X11/lcDB.c +++ /dev/null @@ -1,1327 +0,0 @@ -/* - * - * Copyright IBM Corporation 1993 - * - * All Rights Reserved - * - * License 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 - * supporting documentation, and that the name of IBM not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * 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, - * 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. - * -*/ -/* - * (c) Copyright 1995 FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ - - - -#ifndef NOT_X_ENV - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlibint.h" -#include "XlcPubI.h" - -#else /* NOT_X_ENV */ - -#define Xmalloc malloc -#define Xrealloc realloc -#define Xfree free - -#endif /* NOT_X_ENV */ - -/* specifying NOT_X_ENV allows users to just use - the database parsing routine. */ -/* For UDC/VW */ -#ifndef BUFSIZE -#define BUFSIZE 2048 -#endif - -#ifdef COMMENT -#ifdef BUFSIZE -#undef BUFSIZE -#endif -#define BUFSIZE 6144 /* 2048*3 */ -#endif - -#include - -typedef struct _DatabaseRec { - char *category; - char *name; - char **value; - int value_num; - struct _DatabaseRec *next; -} DatabaseRec, *Database; - -typedef enum { - S_NULL, /* outside category */ - S_CATEGORY, /* inside category */ - S_NAME, /* has name, expecting values */ - S_VALUE -} ParseState; - -typedef enum { - T_NEWLINE, - T_COMMENT, - T_SEMICOLON, - T_DOUBLE_QUOTE, - T_LEFT_BRACE, - T_RIGHT_BRACE, - T_SPACE, - T_TAB, - T_BACKSLASH, - T_NUMERIC_HEX, - T_NUMERIC_DEC, - T_NUMERIC_OCT, - T_DEFAULT -} Token; - -typedef struct { - Token token; /* token id */ - int len; /* length of token sequence */ -} TokenTable; - -static int f_newline (const char *str, Token token, Database *db); -static int f_comment (const char *str, Token token, Database *db); -static int f_semicolon (const char *str, Token token, Database *db); -static int f_double_quote (const char *str, Token token, Database *db); -static int f_left_brace (const char *str, Token token, Database *db); -static int f_right_brace (const char *str, Token token, Database *db); -static int f_white (const char *str, Token token, Database *db); -static int f_backslash (const char *str, Token token, Database *db); -static int f_numeric (const char *str, Token token, Database *db); -static int f_default (const char *str, Token token, Database *db); - -static const TokenTable token_tbl[] = { - { T_NEWLINE, 1 }, - { T_COMMENT, 1 }, - { T_SEMICOLON, 1 }, - { T_DOUBLE_QUOTE, 1 }, - { T_LEFT_BRACE, 1 }, - { T_RIGHT_BRACE, 1 }, - { T_SPACE, 1 }, - { T_TAB, 1 }, - { T_BACKSLASH, 1 }, - { T_NUMERIC_HEX, 2 }, - { T_NUMERIC_DEC, 2 }, - { T_NUMERIC_OCT, 2 }, - { T_DEFAULT, 1 } /* any character */ -}; - -#define SYM_CR '\r' -#define SYM_NEWLINE '\n' -#define SYM_COMMENT '#' -#define SYM_SEMICOLON ';' -#define SYM_DOUBLE_QUOTE '"' -#define SYM_LEFT_BRACE '{' -#define SYM_RIGHT_BRACE '}' -#define SYM_SPACE ' ' -#define SYM_TAB '\t' -#define SYM_BACKSLASH '\\' - -/************************************************************************/ - -#define MAX_NAME_NEST 64 - -typedef struct { - ParseState pre_state; - char *category; - char *name[MAX_NAME_NEST]; - int nest_depth; - char **value; - int value_len; - int value_num; - int bufsize; /* bufMaxSize >= bufsize >= 0 */ - int bufMaxSize; /* default : BUFSIZE */ - char *buf; -} DBParseInfo; - -static DBParseInfo parse_info; - -static void -init_parse_info (void) -{ - static int allocated /* = 0 */; - char *ptr; - int size; - if (!allocated) { - bzero(&parse_info, sizeof(DBParseInfo)); - parse_info.buf = Xmalloc(BUFSIZE); - parse_info.bufMaxSize = BUFSIZE; - allocated = 1; - return; - } - ptr = parse_info.buf; - size = parse_info.bufMaxSize; - bzero(&parse_info, sizeof(DBParseInfo)); - parse_info.buf = ptr; - parse_info.bufMaxSize = size; -} - -static void -clear_parse_info (void) -{ - int i; - char *ptr; - int size; - parse_info.pre_state = S_NULL; - if (parse_info.category != NULL) { - Xfree(parse_info.category); - } - for (i = 0; i <= parse_info.nest_depth; ++i) { - if (parse_info.name[i]) { - Xfree(parse_info.name[i]); - } - } - if (parse_info.value) { - if (*parse_info.value) { - Xfree(*parse_info.value); - } - Xfree(parse_info.value); - } - ptr = parse_info.buf; - size = parse_info.bufMaxSize; - bzero(&parse_info, sizeof(DBParseInfo)); - parse_info.buf = ptr; - parse_info.bufMaxSize = size; -} - -static Bool -realloc_parse_info( - int len) -{ - char *p; - int newsize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1); - - p = Xrealloc(parse_info.buf, newsize); - if (p == NULL) - return False; - parse_info.bufMaxSize = newsize; - parse_info.buf = p; - - return True; -} - -/************************************************************************/ - -typedef struct _Line { - char *str; - int cursize; - int maxsize; - int seq; -} Line; - -static void -free_line( - Line *line) -{ - if (line->str != NULL) { - Xfree(line->str); - } - bzero(line, sizeof(Line)); -} - -static int -realloc_line( - Line *line, - int size) -{ - char *str = line->str; - - if (str != NULL) { - str = Xrealloc(str, size); - } else { - str = Xmalloc(size); - } - if (str == NULL) { - /* malloc error */ - if (line->str != NULL) { - Xfree(line->str); - } - bzero(line, sizeof(Line)); - return 0; - } - line->str = str; - line->maxsize = size; - return 1; -} - -#define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB) - -static void -zap_comment( - char *str, - int *quoted) -{ - char *p = str; -#ifdef never - *quoted = 0; - if (*p == SYM_COMMENT) { - int len = strlen(str); - if (p[len - 1] == SYM_NEWLINE || p[len - 1] == SYM_CR) { - *p++ = SYM_NEWLINE; - } - *p = '\0'; - } -#else - while (*p) { - if (*p == SYM_DOUBLE_QUOTE) { - if (p == str || p[-1] != SYM_BACKSLASH) { - /* unescaped double quote changes quoted state. */ - *quoted = *quoted ? 0 : 1; - } - } - if (*p == SYM_COMMENT && !*quoted) { - int pos = p - str; - if (pos == 0 || - (iswhite(p[-1]) && (pos == 1 || p[-2] != SYM_BACKSLASH))) { - int len = strlen(p); - if (len > 0 && (p[len - 1] == SYM_NEWLINE || p[len-1] == SYM_CR)) { - /* newline is the identifier for finding end of value. - therefore, it should not be removed. */ - *p++ = SYM_NEWLINE; - } - *p = '\0'; - break; - } - } - ++p; - } -#endif -} - -static int -read_line( - FILE *fd, - Line *line) -{ - char buf[BUFSIZE], *p; - int len; - int quoted = 0; /* quoted by double quote? */ - char *str; - int cur; - - str = line->str; - cur = line->cursize = 0; - - while ((p = fgets(buf, BUFSIZE, fd)) != NULL) { - ++line->seq; - zap_comment(p, "ed); /* remove comment line */ - len = strlen(p); - if (len == 0) { - if (cur > 0) { - break; - } - continue; - } - if (cur + len + 1 > line->maxsize) { - /* need to reallocate buffer. */ - if (! realloc_line(line, line->maxsize + BUFSIZE)) { - return -1; /* realloc error. */ - } - str = line->str; - } - strncpy(str + cur, p, len); - - cur += len; - str[cur] = '\0'; - if (!quoted && cur > 1 && str[cur - 2] == SYM_BACKSLASH && - (str[cur - 1] == SYM_NEWLINE || str[cur-1] == SYM_CR)) { - /* the line is ended backslash followed by newline. - need to concatinate the next line. */ - cur -= 2; - str[cur] = '\0'; - } else if (len < BUFSIZE - 1 || buf[len - 1] == SYM_NEWLINE || - buf[len - 1] == SYM_CR) { - /* the line is shorter than BUFSIZE. */ - break; - } - } - if (quoted) { - /* error. still in quoted state. */ - return -1; - } - return line->cursize = cur; -} - -/************************************************************************/ - -static Token -get_token( - const char *str) -{ - switch (*str) { - case SYM_NEWLINE: - case SYM_CR: return T_NEWLINE; - case SYM_COMMENT: return T_COMMENT; - case SYM_SEMICOLON: return T_SEMICOLON; - case SYM_DOUBLE_QUOTE: return T_DOUBLE_QUOTE; - case SYM_LEFT_BRACE: return T_LEFT_BRACE; - case SYM_RIGHT_BRACE: return T_RIGHT_BRACE; - case SYM_SPACE: return T_SPACE; - case SYM_TAB: return T_TAB; - case SYM_BACKSLASH: - switch (str[1]) { - case 'x': return T_NUMERIC_HEX; - case 'd': return T_NUMERIC_DEC; - case 'o': return T_NUMERIC_OCT; - } - return T_BACKSLASH; - default: - return T_DEFAULT; - } -} - -static int -get_word( - const char *str, - char *word) -{ - const char *p = str; - char *w = word; - Token token; - int token_len; - - while (*p != '\0') { - token = get_token(p); - token_len = token_tbl[token].len; - if (token == T_BACKSLASH) { - p += token_len; - if (*p == '\0') - break; - token = get_token(p); - token_len = token_tbl[token].len; - } else if (token != T_COMMENT && token != T_DEFAULT) { - break; - } - strncpy(w, p, token_len); - p += token_len; w += token_len; - } - *w = '\0'; - return p - str; /* return number of scanned chars */ -} - -static int -get_quoted_word( - const char *str, - char *word) -{ - const char *p = str; - char *w = word; - Token token; - int token_len; - - if (*p == SYM_DOUBLE_QUOTE) { - ++p; - } - while (*p != '\0') { - token = get_token(p); - token_len = token_tbl[token].len; - if (token == T_DOUBLE_QUOTE) { - p += token_len; - goto found; - } - if (token == T_BACKSLASH) { - p += token_len; - if (*p == '\0') { - break; - } - token = get_token(p); - token_len = token_tbl[token].len; - } - strncpy(w, p, token_len); - p += token_len; w += token_len; - } - /* error. cannot detect next double quote */ - return 0; - - found:; - *w = '\0'; - return p - str; -} - -/************************************************************************/ - -static int -append_value_list (void) -{ - char **value_list = parse_info.value; - char *value; - int value_num = parse_info.value_num; - int value_len = parse_info.value_len; - char *str = parse_info.buf; - int len = parse_info.bufsize; - char *p; - - if (len < 1) { - return 1; /* return with no error */ - } - - if (value_list == (char **)NULL) { - value_list = Xmalloc(sizeof(char *) * 2); - *value_list = NULL; - } else { - char **prev_list = value_list; - - value_list = (char **) - Xrealloc(value_list, sizeof(char *) * (value_num + 2)); - if (value_list == NULL) { - Xfree(prev_list); - } - } - if (value_list == (char **)NULL) - goto err2; - - value = *value_list; - if (value == NULL) { - value = Xmalloc(value_len + len + 1); - } else { - char *prev_value = value; - - value = Xrealloc(value, value_len + len + 1); - if (value == NULL) { - Xfree(prev_value); - } - } - if (value == NULL) { - goto err1; - } - if (value != *value_list) { - int i; - ssize_t delta; - delta = value - *value_list; - *value_list = value; - for (i = 1; i < value_num; ++i) { - value_list[i] += delta; - } - } - - value_list[value_num] = p = &value[value_len]; - value_list[value_num + 1] = NULL; - strncpy(p, str, len); - p[len] = 0; - - parse_info.value = value_list; - parse_info.value_num = value_num + 1; - parse_info.value_len = value_len + len + 1; - parse_info.bufsize = 0; - return 1; - - err1: - if (value_list) { - Xfree((char **)value_list); - } - if (value) { - Xfree(value); - } - err2: - parse_info.value = (char **)NULL; - parse_info.value_num = 0; - parse_info.value_len = 0; - parse_info.bufsize = 0; - return 0; -} - -static int -construct_name( - char *name, - int size) -{ - int i; - int len = 0; - char *p = name; - - for (i = 0; i <= parse_info.nest_depth; ++i) { - len += strlen(parse_info.name[i]) + 1; - } - if (len >= size) - return 0; - - strcpy(p, parse_info.name[0]); - p += strlen(parse_info.name[0]); - for (i = 1; i <= parse_info.nest_depth; ++i) { - *p++ = '.'; - strcpy(p, parse_info.name[i]); - p += strlen(parse_info.name[i]); - } - return *name != '\0'; -} - -static int -store_to_database( - Database *db) -{ - Database new = (Database)NULL; - char name[BUFSIZE]; - - if (parse_info.pre_state == S_VALUE) { - if (! append_value_list()) { - goto err; - } - } - - if (parse_info.name[parse_info.nest_depth] == NULL) { - goto err; - } - - new = Xcalloc(1, sizeof(DatabaseRec)); - if (new == (Database)NULL) { - goto err; - } - - new->category = strdup(parse_info.category); - if (new->category == NULL) { - goto err; - } - - if (! construct_name(name, sizeof(name))) { - goto err; - } - new->name = strdup(name); - if (new->name == NULL) { - goto err; - } - new->next = *db; - new->value = parse_info.value; - new->value_num = parse_info.value_num; - *db = new; - - Xfree(parse_info.name[parse_info.nest_depth]); - parse_info.name[parse_info.nest_depth] = NULL; - - parse_info.value = (char **)NULL; - parse_info.value_num = 0; - parse_info.value_len = 0; - - return 1; - - err: - if (new) { - if (new->category) { - Xfree(new->category); - } - if (new->name) { - Xfree(new->name); - } - Xfree(new); - } - if (parse_info.value) { - if (*parse_info.value) { - Xfree(*parse_info.value); - } - Xfree((char **)parse_info.value); - parse_info.value = (char **)NULL; - parse_info.value_num = 0; - parse_info.value_len = 0; - } - return 0; -} - -#define END_MARK "END" -#define END_MARK_LEN 3 /*strlen(END_MARK)*/ - -static int -check_category_end( - const char *str) -{ - const char *p; - int len; - - p = str; - if (strncmp(p, END_MARK, END_MARK_LEN)) { - return 0; - } - p += END_MARK_LEN; - - while (iswhite(*p)) { - ++p; - } - len = strlen(parse_info.category); - if (strncmp(p, parse_info.category, len)) { - return 0; - } - p += len; - return p - str; -} - -/************************************************************************/ - -static int -f_newline( - const char *str, - Token token, - Database *db) -{ - switch (parse_info.pre_state) { - case S_NULL: - case S_CATEGORY: - break; - case S_NAME: - return 0; /* no value */ - case S_VALUE: - if (!store_to_database(db)) - return 0; - parse_info.pre_state = S_CATEGORY; - break; - default: - return 0; - } - return token_tbl[token].len; -} - -static int -f_comment( - const char *str, - Token token, - Database *db) -{ - /* NOTE: comment is already handled in read_line(), - so this function is not necessary. */ - - const char *p = str; - - while (*p != SYM_NEWLINE && *p != SYM_CR && *p != '\0') { - ++p; /* zap to the end of line */ - } - return p - str; -} - -static int -f_white( - const char *str, - Token token, - Database *db) -{ - const char *p = str; - - while (iswhite(*p)) { - ++p; - } - return p - str; -} - -static int -f_semicolon( - const char *str, - Token token, - Database *db) -{ - switch (parse_info.pre_state) { - case S_NULL: - case S_CATEGORY: - case S_NAME: - return 0; - case S_VALUE: - if (! append_value_list()) - return 0; - parse_info.pre_state = S_VALUE; - break; - default: - return 0; - } - return token_tbl[token].len; -} - -static int -f_left_brace( - const char *str, - Token token, - Database *db) -{ - switch (parse_info.pre_state) { - case S_NULL: - case S_CATEGORY: - case S_VALUE: - return 0; - case S_NAME: - if (parse_info.name[parse_info.nest_depth] == NULL - || parse_info.nest_depth + 1 > MAX_NAME_NEST) - return 0; - ++parse_info.nest_depth; - parse_info.pre_state = S_CATEGORY; - break; - default: - return 0; - } - return token_tbl[token].len; -} - -static int -f_right_brace( - const char *str, - Token token, - Database *db) -{ - if (parse_info.nest_depth < 1) - return 0; - - switch (parse_info.pre_state) { - case S_NULL: - case S_NAME: - return 0; - case S_VALUE: - if (! store_to_database(db)) - return 0; - /* fall into next case */ - case S_CATEGORY: - if (parse_info.name[parse_info.nest_depth] != NULL) { - Xfree(parse_info.name[parse_info.nest_depth]); - parse_info.name[parse_info.nest_depth] = NULL; - } - --parse_info.nest_depth; - parse_info.pre_state = S_CATEGORY; - break; - default: - return 0; - } - return token_tbl[token].len; -} - -static int -f_double_quote( - const char *str, - Token token, - Database *db) -{ - char word[BUFSIZE]; - char* wordp; - int len; - - if ((len = strlen (str)) < sizeof word) - wordp = word; - else - wordp = Xmalloc (len + 1); - if (wordp == NULL) - return 0; - - len = 0; - switch (parse_info.pre_state) { - case S_NULL: - case S_CATEGORY: - goto err; - case S_NAME: - case S_VALUE: - len = get_quoted_word(str, wordp); - if (len < 1) - goto err; - if ((parse_info.bufsize + (int)strlen(wordp) + 1) - >= parse_info.bufMaxSize) { - if (realloc_parse_info(strlen(wordp)+1) == False) { - goto err; - } - } - strcpy(&parse_info.buf[parse_info.bufsize], wordp); - parse_info.bufsize += strlen(wordp); - parse_info.pre_state = S_VALUE; - break; - default: - goto err; - } - if (wordp != word) - Xfree (wordp); - return len; /* including length of token */ - -err: - if (wordp != word) - Xfree (wordp); - return 0; -} - -static int -f_backslash( - const char *str, - Token token, - Database *db) -{ - return f_default(str, token, db); -} - -static int -f_numeric( - const char *str, - Token token, - Database *db) -{ - char word[BUFSIZE]; - const char *p; - char* wordp; - int len; - int token_len; - - if ((len = strlen (str)) < sizeof word) - wordp = word; - else - wordp = Xmalloc (len + 1); - if (wordp == NULL) - return 0; - - switch (parse_info.pre_state) { - case S_NULL: - case S_CATEGORY: - goto err; - case S_NAME: - case S_VALUE: - token_len = token_tbl[token].len; - p = str + token_len; - len = get_word(p, wordp); - if (len < 1) - goto err; - 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; - } - strncpy(&parse_info.buf[parse_info.bufsize], str, token_len); - strcpy(&parse_info.buf[parse_info.bufsize + token_len], wordp); - parse_info.bufsize += token_len + strlen(wordp); - parse_info.pre_state = S_VALUE; - break; - default: - goto err; - } - if (wordp != word) - Xfree (wordp); - return len + token_len; - -err: - if (wordp != word) - Xfree (wordp); - return 0; -} - -static int -f_default( - const char *str, - Token token, - Database *db) -{ - char word[BUFSIZE], *p; - char* wordp; - int len; - - if ((len = strlen (str)) < sizeof word) - wordp = word; - else - wordp = Xmalloc (len + 1); - if (wordp == NULL) - return 0; - - len = get_word(str, wordp); - if (len < 1) - goto err; - - switch (parse_info.pre_state) { - case S_NULL: - if (parse_info.category != NULL) - goto err; - p = strdup(wordp); - if (p == NULL) - goto err; - parse_info.category = p; - parse_info.pre_state = S_CATEGORY; - break; - case S_CATEGORY: - if (parse_info.nest_depth == 0) { - if (check_category_end(str)) { - /* end of category is detected. - clear context and zap to end of this line */ - clear_parse_info(); - len = strlen(str); - break; - } - } - p = strdup(wordp); - if (p == NULL) - goto err; - if (parse_info.name[parse_info.nest_depth] != NULL) { - Xfree(parse_info.name[parse_info.nest_depth]); - } - parse_info.name[parse_info.nest_depth] = p; - parse_info.pre_state = S_NAME; - break; - case S_NAME: - case S_VALUE: - if ((parse_info.bufsize + (int)strlen(wordp) + 1) - >= parse_info.bufMaxSize) { - if (realloc_parse_info(strlen(wordp) + 1) == False) - goto err; - } - strcpy(&parse_info.buf[parse_info.bufsize], wordp); - parse_info.bufsize += strlen(wordp); - parse_info.pre_state = S_VALUE; - break; - default: - goto err; - } - if (wordp != word) - Xfree (wordp); - return len; - -err: - if (wordp != word) - Xfree (wordp); - return 0; -} - -/************************************************************************/ - -#ifdef DEBUG -static void -PrintDatabase( - Database db) -{ - Database p = db; - int i = 0, j; - - printf("***\n*** BEGIN Database\n***\n"); - while (p) { - printf("%3d: ", i++); - printf("%s, %s, ", p->category, p->name); - printf("\t[%d: ", p->value_num); - for (j = 0; j < p->value_num; ++j) { - printf("%s, ", p->value[j]); - } - printf("]\n"); - p = p->next; - } - printf("***\n*** END Database\n***\n"); -} -#endif - -static void -DestroyDatabase( - Database db) -{ - Database p = db; - - while (p) { - if (p->category != NULL) { - Xfree(p->category); - } - if (p->name != NULL) { - Xfree(p->name); - } - if (p->value != (char **)NULL) { - if (*p->value != NULL) { - Xfree(*p->value); - } - Xfree(p->value); - } - db = p->next; - Xfree(p); - p = db; - } -} - -static int -CountDatabase( - Database db) -{ - Database p = db; - int cnt = 0; - - while (p) { - ++cnt; - p = p->next; - } - return cnt; -} - -static Database -CreateDatabase( - char *dbfile) -{ - Database db = (Database)NULL; - FILE *fd; - Line line; - char *p; - Token token; - int len; - int error = 0; - - fd = _XFopenFile(dbfile, "r"); - if (fd == (FILE *)NULL) - return NULL; - - bzero(&line, sizeof(Line)); - init_parse_info(); - - do { - int rc = read_line(fd, &line); - if (rc < 0) { - error = 1; - break; - } else if (rc == 0) { - break; - } - p = line.str; - while (*p) { - int (*parse_proc)(const char *str, Token token, Database *db) = NULL; - - token = get_token(p); - - switch (token_tbl[token].token) { - case T_NEWLINE: - parse_proc = f_newline; - break; - case T_COMMENT: - parse_proc = f_comment; - break; - case T_SEMICOLON: - parse_proc = f_semicolon; - break; - case T_DOUBLE_QUOTE: - parse_proc = f_double_quote; - break; - case T_LEFT_BRACE: - parse_proc = f_left_brace; - break; - case T_RIGHT_BRACE: - parse_proc = f_right_brace; - break; - case T_SPACE: - case T_TAB: - parse_proc = f_white; - break; - case T_BACKSLASH: - parse_proc = f_backslash; - break; - case T_NUMERIC_HEX: - case T_NUMERIC_DEC: - case T_NUMERIC_OCT: - parse_proc = f_numeric; - break; - case T_DEFAULT: - parse_proc = f_default; - break; - } - - len = parse_proc(p, token, &db); - - if (len < 1) { - error = 1; - break; - } - p += len; - } - } while (!error); - - if (parse_info.pre_state != S_NULL) { - clear_parse_info(); - error = 1; - } - if (error) { -#ifdef DEBUG - fprintf(stderr, "database format error at line %d.\n", line.seq); -#endif - DestroyDatabase(db); - db = (Database)NULL; - } - - fclose(fd); - free_line(&line); - -#ifdef DEBUG - PrintDatabase(db); -#endif - - return db; -} - -/************************************************************************/ - -#ifndef NOT_X_ENV - -/* locale framework functions */ - -typedef struct _XlcDatabaseRec { - XrmQuark category_q; - XrmQuark name_q; - Database db; - struct _XlcDatabaseRec *next; -} XlcDatabaseRec, *XlcDatabase; - -typedef struct _XlcDatabaseListRec { - XrmQuark name_q; - XlcDatabase lc_db; - Database database; - int ref_count; - struct _XlcDatabaseListRec *next; -} XlcDatabaseListRec, *XlcDatabaseList; - -/* database cache list (per file) */ -static XlcDatabaseList _db_list = (XlcDatabaseList)NULL; - -/************************************************************************/ -/* _XlcGetResource(lcd, category, class, value, count) */ -/*----------------------------------------------------------------------*/ -/* This function retrieves XLocale database information. */ -/************************************************************************/ -void -_XlcGetResource( - XLCd lcd, - const char *category, - const char *class, - char ***value, - int *count) -{ - XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); - - (*methods->get_resource)(lcd, category, class, value, count); - return; -} - -/************************************************************************/ -/* _XlcGetLocaleDataBase(lcd, category, class, value, count) */ -/*----------------------------------------------------------------------*/ -/* This function retrieves XLocale database information. */ -/************************************************************************/ -void -_XlcGetLocaleDataBase( - XLCd lcd, - const char *category, - const char *name, - char ***value, - int *count) -{ - XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); - XrmQuark category_q, name_q; - - category_q = XrmStringToQuark(category); - name_q = XrmStringToQuark(name); - for (; lc_db->db; ++lc_db) { - if (category_q == lc_db->category_q && name_q == lc_db->name_q) { - *value = lc_db->db->value; - *count = lc_db->db->value_num; - return; - } - } - *value = (char **)NULL; - *count = 0; -} - -/************************************************************************/ -/* _XlcDestroyLocaleDataBase(lcd) */ -/*----------------------------------------------------------------------*/ -/* This function destroy the XLocale Database that bound to the */ -/* specified lcd. If the XLocale Database is refered from some */ -/* other lcd, this function just decreases reference count of */ -/* the database. If no locale refers the database, this function */ -/* remove it from the cache list and free work area. */ -/************************************************************************/ -void -_XlcDestroyLocaleDataBase( - XLCd lcd) -{ - XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); - XlcDatabaseList p, prev; - - for (p = _db_list, prev = (XlcDatabaseList)NULL; p; - prev = p, p = p->next) { - if (p->lc_db == lc_db) { - if ((-- p->ref_count) < 1) { - if (p->lc_db != (XlcDatabase)NULL) { - Xfree(p->lc_db); - } - DestroyDatabase(p->database); - if (prev == (XlcDatabaseList)NULL) { - _db_list = p->next; - } else { - prev->next = p->next; - } - Xfree((char*)p); - } - break; - } - } - XLC_PUBLIC(lcd, xlocale_db) = (XPointer)NULL; -} - -/************************************************************************/ -/* _XlcCreateLocaleDataBase(lcd) */ -/*----------------------------------------------------------------------*/ -/* This function create an XLocale database which correspond to */ -/* the specified XLCd. */ -/************************************************************************/ -XPointer -_XlcCreateLocaleDataBase( - XLCd lcd) -{ - XlcDatabaseList list, new; - Database p, database = (Database)NULL; - XlcDatabase lc_db = (XlcDatabase)NULL; - XrmQuark name_q; - char *name; - int i, n; - - name = _XlcFileName(lcd, "locale"); - if (name == NULL) - return (XPointer)NULL; - - name_q = XrmStringToQuark(name); - for (list = _db_list; list; list = list->next) { - if (name_q == list->name_q) { - list->ref_count++; - Xfree (name); - return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)list->lc_db; - } - } - - database = CreateDatabase(name); - if (database == (Database)NULL) { - Xfree (name); - return (XPointer)NULL; - } - n = CountDatabase(database); - lc_db = Xcalloc(n + 1, sizeof(XlcDatabaseRec)); - if (lc_db == (XlcDatabase)NULL) - goto err; - for (p = database, i = 0; p && i < n; p = p->next, ++i) { - lc_db[i].category_q = XrmStringToQuark(p->category); - lc_db[i].name_q = XrmStringToQuark(p->name); - lc_db[i].db = p; - } - - new = Xmalloc(sizeof(XlcDatabaseListRec)); - if (new == (XlcDatabaseList)NULL) { - goto err; - } - new->name_q = name_q; - new->lc_db = lc_db; - new->database = database; - new->ref_count = 1; - new->next = _db_list; - _db_list = new; - - Xfree (name); - return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)lc_db; - - err: - DestroyDatabase(database); - if (lc_db != (XlcDatabase)NULL) { - Xfree(lc_db); - } - Xfree (name); - return (XPointer)NULL; -} - -#endif /* NOT_X_ENV */ diff --git a/nx-X11/lib/X11/lcDefConv.c b/nx-X11/lib/X11/lcDefConv.c deleted file mode 100644 index 2096d871b..000000000 --- a/nx-X11/lib/X11/lcDefConv.c +++ /dev/null @@ -1,806 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * 2000 - * Modifier: Ivan Pascal The XFree86 Project - */ - -/* - * The default locale loader. - * Supports: one byte per char (iso8859 like) locales. - * How: converts bytes to wide characters in a 1:1 manner. - * Platforms: all systems. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcGeneric.h" - -#ifndef MB_LEN_MAX -#define MB_LEN_MAX 6 -#endif - -#if !defined(X_LOCALE) -#define STDCVT -#endif - -#define GR 0x80 -#define GL 0x7f - -typedef struct _StateRec *State; -typedef struct _StateRec { - CodeSet GL_codeset; - CodeSet GR_codeset; - wchar_t wc_mask; - wchar_t wc_encode_mask; - Bool (*MBtoWC) (State state, const char *ch, wchar_t *wc); - Bool (*WCtoMB) (State state, wchar_t wc, char *ch); -} StateRec; - -static -Bool MBtoWCdef( - State state, - const char *ch, - wchar_t *wc) -{ - wchar_t wc_encoding; - CodeSet codeset = (*ch & GR) ? state->GR_codeset : state->GL_codeset; - if (!codeset) - return False; - wc_encoding = codeset->wc_encoding; - *wc = ((wchar_t) *ch & state->wc_mask) | wc_encoding; - return True; -} - -#ifdef STDCVT -static -Bool MBtoWCstd( - State state, - const char *ch, - wchar_t *wc) -{ - return (mbtowc(wc, ch, 1) == 1); -} -#endif - -static -Bool WCtoMBdef( - State state, - wchar_t wc, - char *ch) -{ - wchar_t wc_encoding = wc & state->wc_encode_mask; - CodeSet codeset; - - codeset = state->GL_codeset; - if (codeset && (wc_encoding == codeset->wc_encoding)) { - *ch = wc & state->wc_mask; - return True; - } - codeset = state->GR_codeset; - if (codeset && (wc_encoding == codeset->wc_encoding)) { - *ch = (wc & state->wc_mask) | GR; - return True; - } - return False; -} - -#ifdef STDCVT -static -Bool WCtoMBstd( - State state, - wchar_t wc, - char *ch) -{ - return (wctomb(ch, wc) == 1); -} -#endif - -static -XlcCharSet get_charset( - State state, - char side) -{ - CodeSet codeset = side ? state->GR_codeset : state->GL_codeset; - if (codeset) { - int i; - XlcCharSet charset; - for (i = 0; i < codeset->num_charsets; i++) { - charset = codeset->charset_list[i]; - if (*charset->ct_sequence != '\0') - return charset; - } - return *(codeset->charset_list); - } - return (XlcCharSet) NULL; -} - -static int -def_mbstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src; - wchar_t *dst = (wchar_t *) *to; - State state = (State) conv->state; - int unconv = 0; - - if (from == NULL || *from == NULL) - return 0; - - src = (const char *) *from; - - while (*from_left && *to_left) { - (*from_left)--; - if (state->MBtoWC (state, src++, dst)) { - dst++; - (*to_left)--; - } else { - unconv++; - } - } - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -def_wcstombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const wchar_t *src; - char *dst = (char *) *to; - State state = (State) conv->state; - char ch[MB_LEN_MAX]; - int unconv = 0; - - if (from == NULL || *from == NULL) - return 0; - - src = (const wchar_t *) *from; - - while (*from_left && *to_left) { - (*from_left)--; - if (state->WCtoMB (state, *src++, ch)) { - *dst++ = *ch; - (*to_left)--; - } else { - unconv++; - } - } - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -mbstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src; - char *dst = (char *) *to; - CodeSet codeset; - State state = (State) conv->state; - char ch; - int unconv = 0; - - if (from == NULL || *from == NULL) - return 0; - - src = (const char *) *from; - - while (*from_left && *to_left) { - ch = *src++; - (*from_left)--; - - codeset = (ch & GR) ? state->GR_codeset : state->GL_codeset; - if (codeset && codeset->string_encoding) { - *dst++ = ch; - (*to_left)--; - } else { - unconv++; - } - } - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -wcstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const wchar_t *src; - char *dst = (char *) *to; - CodeSet codeset; - State state = (State) conv->state; - char ch[MB_LEN_MAX]; - int unconv = 0; - - if (from == NULL || *from == NULL) - return 0; - - src = (const wchar_t *) *from; - - while (*from_left && *to_left) { - (*from_left)--; - if (state->WCtoMB (state, *src++, ch)) { - codeset = (*ch & GR) ? state->GR_codeset : state->GL_codeset; - if (codeset && codeset->string_encoding) { - *dst++ = *ch; - (*to_left)--; - } else { - unconv++; - } - } else { - unconv++; - } - } - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -mbstocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src; - char *dst = (char *) *to; - int length; - State state = (State) conv->state; - char cur_side; - int unconv = 0; - - if (from == NULL || *from == NULL) - return 0; - - src = (const char *) *from; - length = min(*from_left, *to_left); - - cur_side = *src & GR; - while (length) { - if ((char) (*src & GR) != cur_side) - break; - *dst++ = *src++; - length--; - } - - if (num_args > 0) { - XlcCharSet charset = get_charset(state, cur_side); - if (charset) { - *((XlcCharSet *) args[0]) = charset; - } else { - dst = *to; - unconv = -1; - } - } - *from_left -= src - (char *) *from; - *to_left -= dst - (char *) *to; - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -wcstocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const wchar_t *src; - char *dst = (char *) *to; - State state = (State) conv->state; - char cur_side = 0, ch[MB_LEN_MAX]; - int unconv = 0; - Bool found = False; - - if (from == NULL || *from == NULL) - return 0; - - src = (const wchar_t *) *from; - - while (*from_left) { - if ((found = state->WCtoMB (state, *src, ch))) - break; - unconv++; - src++; - (*from_left)--; - } - - if (found) { - cur_side = *ch & GR; - while (*from_left && *to_left) { - (*from_left)--; - if (state->WCtoMB (state, *src++, ch)) { - if ((char) (*ch & GR) != cur_side) { - src--; - (*from_left)++; - break; - } else { - *dst++ = *ch; - (*to_left)--; - } - } else { - unconv++; - } - } - } else { - unconv++; - } - - if (num_args > 0) { - XlcCharSet charset = get_charset(state, cur_side); - if (charset) { - *((XlcCharSet *) args[0]) = charset; - } else { - unconv = -1; - } - } - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -cstombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src; - char *dst = (char *) *to; - CodeSet codeset; - XlcCharSet charset; - State state = (State) conv->state; - unsigned char cur_side = 0; - int i; - Bool found = False; - - if (from == NULL || *from == NULL) - return 0; - - src = (const char *) *from; - - if (num_args > 0) { - charset = (XlcCharSet) args[0]; - if (charset == NULL) - return -1; - } else { - return -1; - } - - if ((charset->side == XlcGL) || (charset->side == XlcGLGR)) { - codeset = state->GL_codeset; - if (codeset) { - for (i = 0; i < codeset->num_charsets; i++) - if (charset == codeset->charset_list[i]) { - found = True; - cur_side = 0; - break; - } - } - } - if (!found && ((charset->side == XlcGR) || (charset->side == XlcGLGR))) { - codeset = state->GR_codeset; - if (codeset) { - for (i = 0; i < codeset->num_charsets; i++) - if (charset == codeset->charset_list[i]) { - found = True; - cur_side = GR; - break; - } - } - } - if (found) { - int length = min(*from_left, *to_left); - while (length) { - *dst++ = *src++ | cur_side; - length--; - } - } else { - return -1; - } - - *from_left -= src - (char *) *from; - *to_left -= dst - (char *) *to; - *from = (XPointer) src; - *to = (XPointer) dst; - return 0; -} - -static int -cstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src; - wchar_t *dst = (wchar_t *) *to; - CodeSet codeset; - XlcCharSet charset; - State state = (State) conv->state; - Bool found = False; - int i, unconv = 0; - unsigned char cur_side = 0; - - if (from == NULL || *from == NULL) - return 0; - - src = (const char *) *from; - - if (num_args > 0) { - charset = (XlcCharSet) args[0]; - if (charset == NULL) - return -1; - } else { - return -1; - } - - if ((charset->side == XlcGL) || (charset->side == XlcGLGR)) { - codeset = state->GL_codeset; - if (codeset) { - for (i = 0; i < codeset->num_charsets; i++) - if (charset == codeset->charset_list[i]) { - found = True; - cur_side = 0; - break; - } - } - } - if (!found && ((charset->side == XlcGR) || (charset->side == XlcGLGR))) { - codeset = state->GR_codeset; - if (codeset) { - for (i = 0; i < codeset->num_charsets; i++) - if (charset == codeset->charset_list[i]) { - found = True; - cur_side = GR; - break; - } - } - } - if (found) { - char ch; - while (*from_left && *to_left) { - ch = *src++ | cur_side; - (*from_left)--; - if (state->MBtoWC (state, &ch, dst)) { - dst++; - (*to_left)--; - } else { - unconv++; - } - } - } else { - return -1; - } - *from = (XPointer) src; - *to = (XPointer) dst; - return unconv; -} - -static int -strtombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src; - char *dst = (char *) *to; - int length; - - if (from == NULL || *from == NULL) - return 0; - - src = (const char *) *from; - length = min(*from_left, *to_left); - while (length) { - *dst++ = *src++; - length--; - } - - *from_left -= src - (char *) *from; - *to_left -= dst - (char *) *to; - *from = (XPointer) src; - *to = (XPointer) dst; - return 0; -} - -static void -close_converter( - XlcConv conv) -{ - - Xfree(conv->state); - Xfree(conv); -} - -static XlcConv -create_conv( - XLCd lcd, - XlcConvMethods methods) -{ - XlcConv conv; - State state; - - conv = Xcalloc(1, sizeof(XlcConvRec)); - if (conv == NULL) - return (XlcConv) NULL; - - state = Xmalloc(sizeof(StateRec)); - if (state == NULL) { - close_converter(conv); - return (XlcConv) NULL; - } - state->GL_codeset = XLC_GENERIC(lcd, initial_state_GL); - state->GR_codeset = XLC_GENERIC(lcd, initial_state_GR); - state->wc_mask = (1 << XLC_GENERIC(lcd, wc_shift_bits)) - 1; - state->wc_encode_mask = XLC_GENERIC(lcd, wc_encode_mask); - -#ifdef STDCVT - if (XLC_GENERIC(lcd, use_stdc_env) == True) - state->MBtoWC = &MBtoWCstd; - else -#endif - state->MBtoWC = &MBtoWCdef; - -#ifdef STDCVT - if (XLC_GENERIC(lcd, use_stdc_env) == True) - state->WCtoMB = &WCtoMBstd; - else -#endif - state->WCtoMB = &WCtoMBdef; - - conv->methods = methods; - conv->state = (XPointer) state; - - return conv; -} - -static XlcConvMethodsRec mbstowcs_methods = { - close_converter, - def_mbstowcs, - NULL -}; - -static XlcConv -open_mbstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstowcs_methods); -} - -static XlcConvMethodsRec mbstostr_methods = { - close_converter, - mbstostr, - NULL -}; - -static XlcConv -open_mbstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstostr_methods); -} - -static XlcConvMethodsRec mbstocs_methods = { - close_converter, - mbstocs, - NULL -}; - -static XlcConv -open_mbstocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstocs_methods); -} - -static XlcConvMethodsRec wcstombs_methods = { - close_converter, - def_wcstombs, - NULL -}; - -static XlcConv -open_wcstombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstombs_methods); -} - -static XlcConvMethodsRec wcstostr_methods = { - close_converter, - wcstostr, - NULL -}; - -static XlcConv -open_wcstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstostr_methods); -} - -static XlcConvMethodsRec wcstocs_methods = { - close_converter, - wcstocs, - NULL -}; - -static XlcConv -open_wcstocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstocs_methods); -} - -static XlcConvMethodsRec strtombs_methods = { - close_converter, - strtombs, - NULL -}; - -static XlcConv -open_strtombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &strtombs_methods); -} - -static XlcConvMethodsRec cstombs_methods = { - close_converter, - cstombs, - NULL -}; - -static XlcConv -open_cstombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &cstombs_methods); -} - -static XlcConvMethodsRec cstowcs_methods = { - close_converter, - cstowcs, - NULL -}; - -static XlcConv -open_cstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &cstowcs_methods); -} - -XLCd -_XlcDefaultLoader( - const char *name) -{ - XLCd lcd; - - lcd = _XlcCreateLC(name, _XlcGenericMethods); - if (lcd == NULL) - return lcd; - - if (XLC_PUBLIC(lcd, mb_cur_max) != 1){ - _XlcDestroyLC(lcd); - return (XLCd) NULL; - } - - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbstocs); - - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); - - _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); - _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_mbstowcs); - - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); - - _XlcAddUtf8Converters(lcd); - - return lcd; -} diff --git a/nx-X11/lib/X11/lcFile.c b/nx-X11/lib/X11/lcFile.c deleted file mode 100644 index cf03a90a7..000000000 --- a/nx-X11/lib/X11/lcFile.c +++ /dev/null @@ -1,711 +0,0 @@ -/* - * - * Copyright IBM Corporation 1993 - * - * All Rights Reserved - * - * License 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 - * supporting documentation, and that the name of IBM not be - * used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. - * - * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * 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, - * 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. - * -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include "Xlibint.h" -#include "XlcPubI.h" -#include -#include - -/************************************************************************/ - -#define iscomment(ch) ((ch) == '#' || (ch) == '\0') -#if defined(WIN32) -#define isreadable(f) (_XAccessFile(f)) -#else -#define isreadable(f) ((access((f), R_OK) != -1) ? 1 : 0) -#endif - -#define LC_PATHDELIM ':' - -#define XLC_BUFSIZE 256 - -#include "pathmax.h" - -#define NUM_LOCALEDIR 64 - -/* Splits a NUL terminated line into constituents, at colons and newline - characters. Leading whitespace is removed from constituents. The - constituents are stored at argv[0..argsize-1]. The number of stored - constituents (<= argsize) is returned. The line is destructively - modified. */ -static int -parse_line( - char *line, - char **argv, - int argsize) -{ - int argc = 0; - char *p = line; - - while (argc < argsize) { - while (isspace(*p)) { - ++p; - } - if (*p == '\0') { - break; - } - argv[argc++] = p; - while (*p != ':' && *p != '\n' && *p != '\0') { - ++p; - } - if (*p == '\0') { - break; - } - *p++ = '\0'; - } - - return argc; -} - -#if defined(WIN32) - -/* this is parse_line but skips drive letters at the beginning of the entry */ -static int -parse_line1( - char *line, - char **argv, - int argsize) -{ - int argc = 0; - char *p = line; - - while (argc < argsize) { - while (isspace(*p)) { - ++p; - } - if (*p == '\0') { - break; - } - argv[argc++] = p; - if (isalpha(*p) && p[1] == ':') { - p+= 2; /* skip drive letters */ - } - while (*p != ':' && *p != '\n' && *p != '\0') { - ++p; - } - if (*p == '\0') { - break; - } - *p++ = '\0'; - } - - return argc; -} - -#endif /* WIN32 */ - -/* Splits a colon separated list of directories, and returns the constituent - paths (without trailing slash). At most argsize constituents are stored - at argv[0..argsize-1]. The number of stored constituents is returned. */ -static int -_XlcParsePath( - char *path, - char **argv, - int argsize) -{ - char *p = path; - int n, i; - -#if !defined(WIN32) - n = parse_line(path, argv, argsize); -#else - n = parse_line1(path, argv, argsize); -#endif - for (i = 0; i < n; ++i) { - int len; - p = argv[i]; - len = strlen(p); - if (len > 0 && p[len - 1] == '/') { - /* eliminate trailing slash */ - p[len - 1] = '\0'; - } - } - return n; -} - -#ifndef XLOCALEDIR -#define XLOCALEDIR "/usr/lib/X11/locale" -#endif - -void -xlocaledir( - char *buf, - int buf_len) -{ - char *p = buf; - int len = 0; - -#ifndef NO_XLOCALEDIR - char *dir; - int priv = 1; - - dir = getenv("XLOCALEDIR"); - - if (dir) { -#ifndef WIN32 - /* - * Only use the user-supplied path if the process isn't priviledged. - */ - if (getuid() == geteuid() && getgid() == getegid()) { -#if defined(HASSETUGID) - priv = issetugid(); -#elif defined(HASGETRESUID) - { - uid_t ruid, euid, suid; - gid_t rgid, egid, sgid; - if ((getresuid(&ruid, &euid, &suid) == 0) && - (getresgid(&rgid, &egid, &sgid) == 0)) - priv = (euid != suid) || (egid != sgid); - } -#else - /* - * If there are saved ID's the process might still be priviledged - * even though the above test succeeded. If issetugid() and - * getresgid() aren't available, test this by trying to set - * euid to 0. - * - * Note: this only protects setuid-root clients. It doesn't - * protect other setuid or any setgid clients. If this tradeoff - * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def. - */ - unsigned int oldeuid; - oldeuid = geteuid(); - if (seteuid(0) != 0) { - priv = 0; - } else { - if (seteuid(oldeuid) == -1) { - /* XXX ouch, coudn't get back to original uid - what can we do ??? */ - _exit(127); - } - priv = 1; - } -#endif - } -#else - priv = 0; -#endif - if (!priv) { - len = strlen(dir); - strncpy(p, dir, buf_len); - if (len < buf_len) { - p[len++] = LC_PATHDELIM; - p += len; - } - } - } -#endif /* NO_XLOCALEDIR */ - - if (len < buf_len) - strncpy(p, XLOCALEDIR, buf_len - len); - buf[buf_len-1] = '\0'; -} - -static void -xlocalelibdir( - char *buf, - int buf_len) -{ - char *p = buf; - int len = 0; - -#ifndef NO_XLOCALEDIR - char *dir; - int priv = 1; - - dir = getenv("XLOCALELIBDIR"); - - if (dir) { -#ifndef WIN32 - /* - * Only use the user-supplied path if the process isn't priviledged. - */ - if (getuid() == geteuid() && getgid() == getegid()) { -#if defined(HASSETUGID) - priv = issetugid(); -#elif defined(HASGETRESUID) - { - uid_t ruid, euid, suid; - gid_t rgid, egid, sgid; - if ((getresuid(&ruid, &euid, &suid) == 0) && - (getresgid(&rgid, &egid, &sgid) == 0)) - priv = (euid != suid) || (egid != sgid); - } -#else - /* - * If there are saved ID's the process might still be priviledged - * even though the above test succeeded. If issetugid() and - * getresgid() aren't available, test this by trying to set - * euid to 0. - * - * Note: this only protects setuid-root clients. It doesn't - * protect other setuid or any setgid clients. If this tradeoff - * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def. - */ - unsigned int oldeuid; - oldeuid = geteuid(); - if (seteuid(0) != 0) { - priv = 0; - } else { - if (seteuid(oldeuid) == -1) { - /* XXX ouch, coudn't get back to original uid - what can we do ??? */ - _exit(127); - } - priv = 1; - } -#endif - } -#else - priv = 0; -#endif - if (!priv) { - len = strlen(dir); - strncpy(p, dir, buf_len); - if (len < buf_len) { - p[len++] = LC_PATHDELIM; - p += len; - } - } - } -#endif /* NO_XLOCALEDIR */ - - if (len < buf_len) - strncpy(p, XLOCALELIBDIR, buf_len - len); - buf[buf_len-1] = '\0'; -} - -/* Mapping direction */ -typedef enum { - LtoR, /* Map first field to second field */ - RtoL /* Map second field to first field */ -} MapDirection; - -static char * -resolve_name( - const char *lc_name, - char *file_name, - MapDirection direction) -{ - FILE *fp; - char buf[XLC_BUFSIZE], *name = NULL; - - fp = _XFopenFile (file_name, "r"); - if (fp == NULL) - return NULL; - - while (fgets(buf, XLC_BUFSIZE, fp) != NULL) { - char *p = buf; - int n; - char *args[2], *from, *to; - while (isspace(*p)) { - ++p; - } - if (iscomment(*p)) { - continue; - } - n = parse_line(p, args, 2); /* get first 2 fields */ - if (n != 2) { - continue; - } - if (direction == LtoR) { - from = args[0], to = args[1]; /* left to right */ - } else { - from = args[1], to = args[0]; /* right to left */ - } - if (! strcmp(from, lc_name)) { - name = strdup(to); - break; - } - } - fclose(fp); - return name; -} - -#define c_tolower(ch) ((ch) >= 'A' && (ch) <= 'Z' ? (ch) - 'A' + 'a' : (ch)) - -static char * -lowercase( - char *dst, - const char *src) -{ - const char *s; - char *t; - - for (s = src, t = dst; *s; ++s, ++t) - *t = c_tolower(*s); - *t = '\0'; - return dst; -} - -/* - * normalize_lcname(): remove any '_' and '-' and convert any character - * to lower case after the _ part. If result is identical - * to argument, free result and - * return NULL. - */ -static char * -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++; - while (*tmp) { - if (*tmp != '-') - *p++ = c_tolower(*tmp); - tmp++; - } - } - *p = '\0'; - - if (strcmp(ret, name) == 0) { - Xfree(ret); - return NULL; - } - - return ret; -} - -/************************************************************************/ -char * -_XlcFileName( - XLCd lcd, - const char *category) -{ - char *siname; - char cat[XLC_BUFSIZE], dir[XLC_BUFSIZE]; - int i, n; - char *args[NUM_LOCALEDIR]; - char *file_name = NULL; - - if (lcd == (XLCd)NULL) - return NULL; - - siname = XLC_PUBLIC(lcd, siname); - - 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; - - if (args[i] == NULL) - continue; - - name = NULL; - if (snprintf(buf, PATH_MAX, "%s/%s.dir", args[i], cat) < PATH_MAX) { - name = resolve_name(siname, buf, RtoL); - } - if (name == NULL) { - continue; - } - if (*name == '/') { - /* supposed to be absolute path name */ - file_name = name; - } else { - if (snprintf(buf, PATH_MAX, "%s/%s", args[i], name) < PATH_MAX) - file_name = strdup(buf); - else - file_name = NULL; - Xfree(name); - } - if (file_name && isreadable(file_name)) { - break; - } - Xfree(file_name); - file_name = NULL; - /* Then, try with next dir */ - } - return file_name; -} - -/************************************************************************/ -#ifndef LOCALE_ALIAS -#define LOCALE_ALIAS "locale.alias" -#endif - -int -_XlcResolveLocaleName( - const char* lc_name, - XLCdPublicPart* pub) -{ - char dir[PATH_MAX], buf[PATH_MAX], *name = NULL; - char *dst; - int i, n, sinamelen; - char *args[NUM_LOCALEDIR]; - static const char locale_alias[] = LOCALE_ALIAS; - char *tmp_siname; - char *nlc_name = NULL; - - xlocaledir (dir, PATH_MAX); - n = _XlcParsePath(dir, args, NUM_LOCALEDIR); - for (i = 0; i < n; ++i) { - if (args[i] == NULL) - continue; - - if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) - < PATH_MAX) { - name = resolve_name (lc_name, buf, LtoR); - if (!name) { - if (!nlc_name) - nlc_name = normalize_lcname(lc_name); - if (nlc_name) - name = resolve_name (nlc_name, buf, LtoR); - } - } - if (name != NULL) { - break; - } - } - Xfree(nlc_name); - - if (name == NULL) { - /* vendor locale name == Xlocale name, no expansion of alias */ - pub->siname = strdup (lc_name); - } else { - pub->siname = name; - } - - sinamelen = strlen (pub->siname); - if (sinamelen == 1 && pub->siname[0] == 'C') { - pub->language = pub->siname; - pub->territory = pub->codeset = NULL; - return 1; - } - - /* - * pub->siname is in the format _., 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. - */ - tmp_siname = Xrealloc (pub->siname, 2 * (sinamelen + 1)); - if (tmp_siname == NULL) { - return 0; - } - pub->siname = tmp_siname; - - /* language */ - dst = &pub->siname[sinamelen + 1]; - strcpy (dst, pub->siname); - pub->language = dst; - - /* territory */ - dst = strchr (dst, '_'); - if (dst) { - *dst = '\0'; - pub->territory = ++dst; - } else - dst = &pub->siname[sinamelen + 1]; - - /* codeset */ - dst = strchr (dst, '.'); - if (dst) { - *dst = '\0'; - pub->codeset = ++dst; - } - - return (pub->siname[0] != '\0') ? 1 : 0; -} - -/************************************************************************/ -int -_XlcResolveI18NPath(char *buf, int buf_len) -{ - if (buf != NULL) { - xlocaledir(buf, buf_len); - } - return 1; -} - -char * -_XlcLocaleDirName(char *dir_name, size_t dir_len, const char *lc_name) -{ - char dir[PATH_MAX], buf[PATH_MAX]; - int i, n; - char *args[NUM_LOCALEDIR]; - static char locale_alias[] = LOCALE_ALIAS; - char *target_name = NULL; - char *target_dir = NULL; - char *nlc_name = NULL; - static char* last_dir_name = 0; - static size_t last_dir_len = 0; - static char* last_lc_name = 0; - - if (last_lc_name != 0 && strcmp (last_lc_name, lc_name) == 0 - && dir_len >= last_dir_len) { - strcpy (dir_name, last_dir_name); - return dir_name; - } - - xlocaledir (dir, PATH_MAX); - n = _XlcParsePath(dir, args, NUM_LOCALEDIR); - for (i = 0; i < n; ++i) { - char *name = NULL; - - if (args[i] == NULL) - continue; - - if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) - < PATH_MAX) { - name = resolve_name(lc_name, buf, LtoR); - if (!name) { - if (!nlc_name) - nlc_name = normalize_lcname(lc_name); - if (nlc_name) - name = resolve_name (nlc_name, buf, LtoR); - } - } - - /* look at locale.dir */ - - target_dir = args[i]; - if (snprintf(buf, PATH_MAX, "%s/locale.dir", target_dir) < PATH_MAX) { - /* If name is not an alias, use lc_name for locale.dir search */ - target_name = resolve_name(name ? name : lc_name, buf, RtoL); - } - Xfree(name); - name = NULL; - if (target_name != NULL) { - char *p = 0; - if ((p = strstr(target_name, "/XLC_LOCALE"))) { - *p = '\0'; - break; - } - Xfree(target_name); - target_name = NULL; - } - } - Xfree(nlc_name); - - if (target_name == NULL) - /* vendor locale name == Xlocale name, no expansion of alias */ - snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name); - else - snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name); - - Xfree(target_name); - Xfree (last_dir_name); - Xfree (last_lc_name); - - last_dir_len = strlen (dir_name) + 1; - last_dir_name = Xmalloc (last_dir_len); - strcpy (last_dir_name, dir_name); - last_lc_name = strdup (lc_name); - - return dir_name; -} - -char * -_XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name) -{ - char dir[PATH_MAX], buf[PATH_MAX]; - int i, n; - char *args[NUM_LOCALEDIR]; - static char locale_alias[] = LOCALE_ALIAS; - char *target_name = NULL; - char *target_dir = NULL; - char *nlc_name = NULL; - static char* last_dir_name = 0; - static size_t last_dir_len = 0; - static char* last_lc_name = 0; - - if (last_lc_name != 0 && strcmp (last_lc_name, lc_name) == 0 - && dir_len >= last_dir_len) { - strcpy (dir_name, last_dir_name); - return dir_name; - } - - xlocalelibdir (dir, PATH_MAX); - n = _XlcParsePath(dir, args, NUM_LOCALEDIR); - for (i = 0; i < n; ++i) { - char *name = NULL; - - if (args[i] == NULL) - continue; - - if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) - < PATH_MAX) { - name = resolve_name(lc_name, buf, LtoR); - if (!name) { - if (!nlc_name) - nlc_name = normalize_lcname(lc_name); - if (nlc_name) - name = resolve_name (nlc_name, buf, LtoR); - } - } - - /* look at locale.dir */ - - target_dir = args[i]; - if (snprintf(buf, PATH_MAX, "%s/locale.dir", target_dir) < PATH_MAX) { - /* If name is not an alias, use lc_name for locale.dir search */ - target_name = resolve_name(name ? name : lc_name, buf, RtoL); - } - Xfree(name); - name = NULL; - if (target_name != NULL) { - char *p = 0; - if ((p = strstr(target_name, "/XLC_LOCALE"))) { - *p = '\0'; - break; - } - Xfree(target_name); - target_name = NULL; - } - } - Xfree(nlc_name); - - if (target_name == NULL) - /* vendor locale name == Xlocale name, no expansion of alias */ - snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name); - else - snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name); - Xfree(target_name); - Xfree (last_dir_name); - Xfree (last_lc_name); - - last_dir_len = strlen (dir_name) + 1; - last_dir_name = Xmalloc (last_dir_len); - strcpy (last_dir_name, dir_name); - last_lc_name = strdup (lc_name); - - return dir_name; -} diff --git a/nx-X11/lib/X11/lcGenConv.c b/nx-X11/lib/X11/lcGenConv.c deleted file mode 100644 index 799f49a30..000000000 --- a/nx-X11/lib/X11/lcGenConv.c +++ /dev/null @@ -1,3112 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * (c) Copyright 1995 FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Masayoshi Shimamura FUJITSU LIMITED - * - */ -/* - * 2000 - * Modifier: Ivan Pascal The XFree86 Project - */ - -/* - * A generic locale loader for all kinds of ISO-2022 based codesets. - * Supports: all locales. - * How: Provides generic converters for ISO-2022 based codesets. Extensible as - * far as ISO-2022 is extensible: codesets can be given by name in the - * stream. Overall distinction between GL (0x00..0x7f) and GR (0x80..0xff). - * In every chunk between escape sequences, the number of bytes per - * character (char_size) is constant. - * Platforms: all systems. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcGeneric.h" -#include - -#if !defined(X_LOCALE) -#define STDCVT -#endif - -typedef struct _CTDataRec { - const char *name; - const char *encoding; /* Compound Text encoding */ -} CTDataRec, *CTData; - -static CTDataRec directionality_data[] = -{ - { "BEGIN_LEFT-TO-RIGHT_TEXT", "\2331]" }, - { "BEGIN_RIGHT-TO-LEFT_TEXT", "\2332]" }, - { "END_OF_STRING", "\233]" }, -}; - -typedef struct _StateRec { - XLCd lcd; - /* CT state */ - XlcCharSet charset; /* charset of current state */ - XlcCharSet GL_charset; /* charset of initial state in GL */ - XlcCharSet GR_charset; /* charset of initial state in GR */ - /* MB shift state */ - CodeSet GL_codeset; - CodeSet GR_codeset; -} StateRec, *State; - -#define GR 0x80 /* begins right-side (non-ascii) region */ -#define GL 0x7f /* ends left-side (ascii) region */ -#define ESC 0x1b -#define CSI 0x9b -#define STX 0x02 - -#define isrightside(c) ((c) & GR) -#define isleftside(c) (!isrightside(c)) - -/* Forward declarations for local routines. */ -static int mbstocts (XlcConv conv, XPointer *from, int *from_left, - XPointer *to, int *to_left, XPointer *args, int num_args); -static int ctstombs (XlcConv conv, XPointer *from, int *from_left, - XPointer *to, int *to_left, XPointer *args, int num_args); -static int cstombs (XlcConv conv, XPointer *from, int *from_left, - XPointer *to, int *to_left, XPointer *args, int num_args); - -/* ------------------------------------------------------------------------- */ -/* Misc */ -/* ------------------------------------------------------------------------- */ - -static int -compare( - const char *src, - const char *encoding, - int length) -{ - const char *start = src; - - while (length-- > 0) { - if (*src++ != *encoding++) - return 0; - if (*encoding == '\0') - return src - start; - } - - return 0; -} - -static unsigned long -conv_to_dest( - Conversion conv, - unsigned long code) -{ - int i; - int conv_num = conv->conv_num; - FontScope convlist = conv->convlist; - - for (i = 0; i < conv_num; i++) { - if (convlist[i].start <= code && code <= convlist[i].end) { - switch (convlist[i].shift_direction) { - case '+': - return(code + convlist[i].shift); - case '-': - return(code - convlist[i].shift); - default: - return(code); - } - } - } - - return(code); -} - -static unsigned long -conv_to_source( - Conversion conv, - unsigned long code) -{ - int i; - int conv_num; - FontScope convlist; - unsigned long start_p; - unsigned long start_m; - unsigned long end_p; - unsigned long end_m; - - if (!conv) - return(code); - - conv_num = conv->conv_num; - convlist = conv->convlist; - - for (i = 0; i < conv_num; i++) { - switch (convlist[i].shift_direction) { - case '+': - start_p = convlist[i].start + convlist[i].shift; - end_p = convlist[i].end + convlist[i].shift; - if (start_p <= code && code <= end_p) - return(code - convlist[i].shift); - break; - case '-': - start_m = convlist[i].start - convlist[i].shift; - end_m = convlist[i].end - convlist[i].shift; - if (start_m <= code && code <= end_m) - return(code + convlist[i].shift); - break; - default: - continue; - } - } - - return(code); -} - -static unsigned long -mb_to_gi( - unsigned long mb, - CodeSet codeset) -{ - int i; - unsigned long mb_tmp, mask = 0; - - if (codeset->mbconv) { - mb_tmp = conv_to_dest(codeset->mbconv, mb); - if (mb_tmp != mb) - return(mb_tmp); - } - - if (codeset->side == XlcC0 || codeset->side == XlcGL || - codeset->side == XlcC1 || codeset->side == XlcGR) { - - for (i = 0; i < codeset->length; i++) - mask = (mask << 8) | GL; - mb = mb & mask; - } - - return(mb); -} - -static unsigned long -gi_to_mb( - unsigned long glyph_index, - CodeSet codeset) -{ - int i; - unsigned long mask = 0; - - if (codeset->side == XlcC1 || codeset->side == XlcGR) { - for (i = 0; i < codeset->length; i++) - mask = (mask << 8) | GR; - glyph_index = glyph_index | mask; - } - - if (codeset->mbconv) - return( conv_to_source(codeset->mbconv, glyph_index) ); - - return(glyph_index); -} - -static Bool -gi_to_wc( - XLCd lcd, - unsigned long glyph_index, - CodeSet codeset, - wchar_t *wc) -{ - unsigned char mask = 0; - unsigned long wc_encoding = codeset->wc_encoding; - int length = codeset->length; - unsigned long wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); - - mask = (1 << wc_shift_bits) - 1 ; - - for (*wc = 0, length--; length >= 0; length--) - *wc = (*wc << wc_shift_bits) | ((glyph_index >> (length * 8 )) & mask); - - *wc = *wc | wc_encoding; - - return(True); -} - -static Bool -wc_to_gi( - XLCd lcd, - wchar_t wc, - unsigned long *glyph_index, - CodeSet *codeset) -{ - int i; - unsigned char mask = 0; - unsigned long wc_encoding; - unsigned long wc_encode_mask = XLC_GENERIC(lcd, wc_encode_mask); - unsigned long wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); - int codeset_num = XLC_GENERIC(lcd, codeset_num); - CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); - - wc_encoding = wc & wc_encode_mask; - for (*codeset = NULL, i = 0; i < codeset_num; i++) { - if (wc_encoding == codeset_list[i]->wc_encoding) { - *codeset = codeset_list[i]; - break; - } - } - if (*codeset == NULL) - return(False); - - mask = (1 << wc_shift_bits) - 1 ; - - wc = wc & ~wc_encode_mask; - for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--) - *glyph_index = (*glyph_index << 8) | - ( ((unsigned long)wc >> (i * wc_shift_bits)) & mask ); - - return(True); -} - -static CodeSet -mb_parse_codeset( - State state, - int num, - const char **inbufptr, - int *from_left) -{ - int len; - int from_len = (*from_left) + 1; - const char *src = (*inbufptr) - 1; - ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list); - ParseInfo parse_info; - CodeSet codeset; - - for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) { - len = compare(src, parse_info->encoding, from_len); - if (len > 0) { - codeset = parse_info->codeset; - if (parse_info->type == E_LSL) - state->GL_codeset = codeset; - else if (parse_info->type == E_LSR) - state->GR_codeset = codeset; - --len; - *inbufptr += len; - *from_left -= len; - return codeset; - } - } - return (CodeSet) NULL; -} - -static CodeSet -byteM_parse_codeset( - XLCd lcd, - const char *inbufptr) -{ - unsigned char ch; - CodeSet codeset; - ByteInfoList byteM; - ByteInfoListRec byteM_rec; - ByteInfo byteinfo; - ByteInfoRec byteinfo_rec; - Bool hit = False; - int i, j, k; - - int codeset_num = XLC_GENERIC(lcd, codeset_num); - CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); - - for (i = 0; i < codeset_num; i++) { - codeset = codeset_list[i]; - byteM = codeset->byteM; - if (codeset->side != XlcNONE || byteM == NULL) - continue; - - for (j = 0; j < codeset->length; j++) { - ch = *((const unsigned char *)(inbufptr + j)); - byteM_rec = byteM[j]; - byteinfo = byteM_rec.byteinfo; - - for (hit = False, k = 0; k < byteM_rec.byteinfo_num; k++) { - byteinfo_rec = byteinfo[k]; - if (byteinfo_rec.start <= ch && ch <= byteinfo_rec.end) { - hit = True; - break; - } - } - - if (!hit) - break; - } - - if (hit) - return(codeset); - } - - return(NULL); -} - -#define GLGR_parse_codeset(ch) \ - (isrightside(ch) ? (state->GR_codeset) : \ - (state->GL_codeset) ) - -static XlcCharSet -gi_parse_charset( - unsigned long glyph_index, - CodeSet codeset) -{ - int i; - XlcCharSet *charset_list = codeset->charset_list; - int num_charsets = codeset->num_charsets; - ExtdSegment ctextseg = codeset->ctextseg; - XlcCharSet charset = NULL; - int area_num; - FontScope area; - - /* lockup ct sequence */ - for (i = 0; i < num_charsets; i++) { - charset = charset_list[i]; - if (*charset->ct_sequence != '\0') - break; - } - if (i >= num_charsets) - return(NULL); - - if (charset->source != CSsrcStd) - return (charset); - - if (!ctextseg) - return(charset); - - area = ctextseg->area; - area_num = ctextseg->area_num; - - for (i = 0; i < area_num; i++) { - - if (area[i].start <= glyph_index && glyph_index <= area[i].end) { - - charset = ctextseg->charset; - - if (*charset->ct_sequence == '\0') - return(NULL); - - break; - } - } - - return(charset); -} - -static Bool -ct_parse_csi( - const char *inbufptr, - int *ctr_seq_len) -{ - int i; - int num = sizeof(directionality_data) / sizeof(directionality_data[0]); - - for (i = 0; i < num; i++) { - if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) ) - continue; - - if ( strncmp(inbufptr, directionality_data[i].encoding, - *ctr_seq_len) == 0) - return(True); - } - - return(False); -} - -static int -cmp_esc_sequence( - const char *inbufptr, - XlcCharSet charset) -{ - int seq_len, name_len, total_len; - unsigned char byte_m, byte_l; - const char *ct_sequence = charset->ct_sequence; - const char *encoding_name = charset->encoding_name; - - /* check esc sequence */ - if ( !(seq_len = strlen(ct_sequence) ) ) - return(0); - if ( strncmp(inbufptr, ct_sequence, seq_len) != 0) - return(0); - - /* Standard Character Set Encoding ? */ - if (charset->source == CSsrcStd) - return(seq_len); - - /* - * Non-Standard Character Set Encoding - * - * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ - * | ctseq | M | L | encoding name | STX | contents | - * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ - * 4bytes 1byte 1byte variable length 1byte variable length - * | | - * +----------------------------------------------+ - * rest length = ((M - 128) * 128) + (L - 128) - */ - - /* get length of encoding name */ - inbufptr += seq_len; - byte_m = *inbufptr++; - byte_l = *inbufptr++; - name_len = strlen(encoding_name); - - if (((byte_m - 128) * 128 + (byte_l - 128) - 1) < name_len) - return(0); - - if ( _XlcNCompareISOLatin1(inbufptr, encoding_name, name_len) != 0 ) - return(0); - - /* check STX (Start of Text) */ - inbufptr = inbufptr + name_len; - if ( *inbufptr != STX ) - return(0); - - total_len = seq_len + name_len + 3; - return(total_len); -} - -static Bool -ct_parse_charset( - XLCd lcd, - const char *inbufptr, - XlcCharSet *charset, - int *ctr_seq_len) -{ - int i, j; - ExtdSegment ctextseg; - int num_charsets; - XlcCharSet *charset_list; - CodeSet codeset; - int codeset_num = XLC_GENERIC(lcd, codeset_num); - CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); - int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); - SegConv segment_conv = XLC_GENERIC(lcd, segment_conv); - - /* get charset from XLC_XLOCALE by escape sequence */ - - for (i = 0; i < codeset_num; i++) { - codeset = codeset_list[i]; - - num_charsets = codeset->num_charsets; - charset_list = codeset->charset_list; - ctextseg = codeset->ctextseg; - - for (j = 0; j < num_charsets; j++) { - *charset = charset_list[j]; - if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) - return(True); - } - - if (ctextseg) { - *charset = ctextseg->charset; - if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) - return(True); - } - } - - /* get charset from XLC_SEGMENTCONVERSION by escape sequence */ - - if (!segment_conv) - return(False); - - for (i = 0; i < segment_conv_num; i++) { - *charset = segment_conv[i].source; - if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) - return(True); - *charset = segment_conv[i].dest; - if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) - return(True); - } - - return(False); -} - -static Bool -segment_conversion( - XLCd lcd, - XlcCharSet *charset, - unsigned long *glyph_index) -{ - int i; - int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); - SegConv segment_conv = XLC_GENERIC(lcd, segment_conv); - FontScopeRec range; - ConversionRec conv_rec; - - if (!segment_conv) - return(True); - - for (i = 0; i < segment_conv_num; i++) { - if (segment_conv[i].source == *charset) - break; - } - - if (i >= segment_conv_num) - return(True); - - range = segment_conv[i].range; - if (*glyph_index < range.start || range.end < *glyph_index) - return(True); - - *charset = segment_conv[i].dest; - conv_rec.conv_num = segment_conv[i].conv_num; - conv_rec.convlist = segment_conv[i].conv; - *glyph_index = conv_to_dest(&conv_rec, *glyph_index); - - return(True); -} - -static CodeSet -_XlcGetCodeSetFromName( - XLCd lcd, - const char *name) -{ - int i, j; - XlcCharSet charset; - int num_charsets; - XlcCharSet *charset_list; - CodeSet codeset; - - int codeset_num = XLC_GENERIC(lcd, codeset_num); - CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); - - for (i = 0; i < codeset_num; i++) { - codeset = codeset_list[i]; - - num_charsets = codeset->num_charsets; - charset_list = codeset->charset_list; - - for (j = 0; j < num_charsets; j++) { - charset = charset_list[j]; - - if (!strlen(charset->name)) - continue; - if ( strcmp(charset->name, name) == 0) - return(codeset); - } - } - - return(NULL); -} - -static Bool -_XlcGetCodeSetFromCharSet( - XLCd lcd, - XlcCharSet charset, - CodeSet *codeset, - unsigned long *glyph_index) -{ - int j, num; - CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); - XlcCharSet *charset_list; - int codeset_num, num_charsets; - Conversion ctconv; - unsigned long glyph_index_tmp = 0; - ExtdSegment ctextseg; - - codeset_num = XLC_GENERIC(lcd, codeset_num); - - for (num = 0 ; num < codeset_num; num++) { - *codeset = codeset_list[num]; - ctconv = (*codeset)->ctconv; - ctextseg = (*codeset)->ctextseg; - - num_charsets = (*codeset)->num_charsets; - charset_list = (*codeset)->charset_list; - - glyph_index_tmp = conv_to_source(ctconv, *glyph_index); - - if (charset->source == CSsrcStd) { - - /* Standard Character Set Encoding */ - if (glyph_index_tmp == *glyph_index) { - for (j = 0; j < num_charsets; j++) { - if (charset_list[j] == charset) { - goto end_loop; - } - } - } - - } else { - - /* Non-Standard Character Set Encoding */ - for (j = 0; j < num_charsets; j++) { - if (charset_list[j] == charset) { - goto end_loop; - } - } - - if (glyph_index_tmp != *glyph_index) { - if (ctextseg && ctextseg->charset == charset) { - goto end_loop; - } - } - - } - - } - -end_loop: - if (num < codeset_num) { - *glyph_index = glyph_index_tmp; - return(True); - } - - return(False); -} - -#define check_string_encoding(codeset) (codeset->string_encoding) - -static void -output_ulong_value( - char *outbufptr, - unsigned long code, - int length, - XlcSide side) -{ - int i; - - for (i = (length - 1) * 8; i >= 0; i -= 8) { - *outbufptr = ( code >> i) & 0xff; - - if (side == XlcC0 || side == XlcGL) { - *outbufptr = *outbufptr & GL; - } else if (side == XlcC1 || side == XlcGR) { - *outbufptr = *outbufptr | GR; - } - - outbufptr++; - } -} - -/* -------------------------------------------------------------------------- */ -/* Init */ -/* -------------------------------------------------------------------------- */ - -static XlcCharSet default_GL_charset = 0; -static XlcCharSet default_GR_charset = 0; - -static void -init_state( - XlcConv conv) -{ - State state = (State) conv->state; - - /* for CT */ - state->charset = NULL; - state->GL_charset = default_GL_charset; - state->GR_charset = default_GR_charset; - - /* for MB shift state */ - state->GL_codeset = XLC_GENERIC(state->lcd, initial_state_GL); - state->GR_codeset = XLC_GENERIC(state->lcd, initial_state_GR); -} - -/* -------------------------------------------------------------------------- */ -/* Convert */ -/* -------------------------------------------------------------------------- */ - -static int -mbstowcs_org( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned char ch; - unsigned long mb = 0; - wchar_t wc; - - int length = 0, len_left = 0; - int unconv_num = 0; - int num; - - CodeSet codeset = NULL; - - const char *inbufptr; - wchar_t *outbufptr = (wchar_t *) *to; - int from_size = *from_left; - - unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); - - if (from == NULL || *from == NULL) { - _XlcResetConverter(conv); - return( 0 ); - } - - inbufptr = *from; - - while (*from_left && *to_left) { - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - if (outbufptr) {*outbufptr++ = L'\0';} - (*to_left)--; - - /* error check */ - if (len_left) { - unconv_num += (length - len_left); - len_left = 0; - } - - continue; - } - - /* same mb char data */ - if (len_left) - goto output_one_wc; - - /* next mb char data for single shift ? */ - if (mb_parse_table && (num = mb_parse_table[ch]) ) { - codeset = mb_parse_codeset(state, num, &inbufptr, from_left); - if (codeset != NULL) { - length = len_left = codeset->length; - mb = 0; - continue; - } - } - - /* next mb char data for byteM ? */ - if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) - goto next_mb_char; - - /* next mb char data for GL or GR side ? */ - if ((codeset = GLGR_parse_codeset(ch))) - goto next_mb_char; - - /* can't find codeset for the ch */ - unconv_num++; - continue; - -next_mb_char: - length = len_left = codeset->length; - mb = 0; - -output_one_wc: - mb = (mb << 8) | ch; /* 1 byte left shift */ - len_left--; - - /* last of one mb char data */ - if (!len_left) { - gi_to_wc(lcd, mb_to_gi(mb, codeset), codeset, &wc); - if (outbufptr) {*outbufptr++ = wc;} - (*to_left)--; - } - - } /* end of while */ - - /* error check on last char */ - if (len_left) { - inbufptr -= (length - len_left); - (*from_left) += (length - len_left); - unconv_num += (length - len_left); - } - - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -stdc_mbstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const char *src = *((const 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 int -wcstombs_org( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - char *encoding; - unsigned long mb, glyph_index; - wchar_t wc; - - int length; - int unconv_num = 0; - - CodeSet codeset; - - const wchar_t *inbufptr = (const wchar_t *) *from; - char *outbufptr = *to; - int from_size = *from_left; - - const char *default_string = XLC_PUBLIC(lcd, default_string); - int defstr_len = strlen(default_string); - - - while (*from_left && *to_left) { - - wc = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!wc) { - if (outbufptr) {*outbufptr++ = '\0';} - (*to_left)--; - - continue; - } - - /* convert */ - if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { - - /* output default_string of XDefaultString() */ - if (*to_left < defstr_len) - break; - if (outbufptr) { - strncpy((char *)outbufptr, default_string, defstr_len); - outbufptr += defstr_len; - } - (*to_left) -= defstr_len; - - unconv_num++; - - } else { - mb = gi_to_mb(glyph_index, codeset); - if (codeset->parse_info) { - Bool need_shift = False; - switch (codeset->parse_info->type) { - case E_LSL : - if (codeset != state->GL_codeset) { - need_shift = True; - state->GL_codeset = codeset; - } - break; - case E_LSR : - if (codeset != state->GR_codeset) { - need_shift = True; - state->GR_codeset = codeset; - } - break; - /* case E_SS */ - default: - need_shift = True; - } - - /* output shift sequence */ - if (need_shift) { - encoding = codeset->parse_info->encoding; - length = strlen(encoding); - if (*to_left < length) - break; - if (outbufptr) { - strncpy((char *)outbufptr, encoding, length); - outbufptr += length; - } - (*to_left) -= length; - } - } - - /* output characters */ - length = codeset->length; - if (*to_left < length) - break; - - if (outbufptr) { - output_ulong_value(outbufptr, mb, length, XlcNONE); - outbufptr += length; - } - - (*to_left) -= length; - } - - } /* end of while */ - - *from = (XPointer) ((const wchar_t *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -stdc_wcstombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const wchar_t *src = *((const 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 int -wcstocts( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned long glyph_index; - wchar_t wc; - - int total_len, seq_len, name_len; - int unconv_num = 0; - Bool first_flag = True, standard_flag; - XlcSide side; - - CodeSet codeset; - XlcCharSet charset, old_charset = NULL; - const char *ct_sequence; - - const wchar_t *inbufptr = (const wchar_t *) *from; - char *outbufptr = *to; - int from_size = *from_left; - char *ext_seg_len = NULL; - - while (*from_left && *to_left) { - - wc = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!wc) { - if (outbufptr) {*outbufptr++ = '\0';} - (*to_left)--; - - continue; - } - - /* convert */ - if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { - unconv_num++; - continue; - } - - /* parse charset */ - if ( !(charset = gi_parse_charset(glyph_index, codeset)) ) { - unconv_num++; - continue; - } - - /* Standard Character Set Encoding ? */ - standard_flag = charset->source == CSsrcStd ? True : False; - - /* - * Non-Standard Character Set Encoding - * - * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ - * | esc sequence | M | L | encoding name | STX | - * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ - * 4bytes 1byte 1byte variable length 1byte - * | | - * +-----------------------------------------+ - * name length = ((M - 128) * 128) + (L - 128) - */ - - /* make encoding data */ - ct_sequence = charset->ct_sequence; - side = charset->side; - seq_len = strlen(ct_sequence); - if (standard_flag) { - name_len = 0; - total_len = seq_len; - } else { - name_len = strlen(charset->encoding_name) + 1; - total_len = seq_len + name_len + 2; - } - - /* output escape sequence of CT */ - if ( (charset != old_charset) && - !(first_flag && charset->string_encoding) ){ - - if ( (ext_seg_len != NULL) && outbufptr) { - int i = (outbufptr - ext_seg_len) - 2; - *ext_seg_len++ = i / 128 + 128; - *ext_seg_len = i % 128 + 128; - ext_seg_len = NULL; - } - - if (*to_left < total_len + 1) { - unconv_num++; - break; - } - - if (outbufptr) { - strcpy((char *)outbufptr, ct_sequence); - outbufptr += seq_len; - - if (!standard_flag) { - const char *i = charset->encoding_name; - ext_seg_len = outbufptr; - outbufptr += 2; - for (; *i ; i++) - *outbufptr++ = ((*i >= 'A') && (*i <= 'Z')) ? - *i - 'A' + 'a' : *i; - *outbufptr++ = STX; - } - } - - (*to_left) -= total_len; - - first_flag = False; - old_charset = charset; - } - - /* output glyph index */ - if (codeset->ctconv) - glyph_index = conv_to_dest(codeset->ctconv, glyph_index); - if (*to_left < charset->char_size) { - unconv_num++; - break; - } - - if (outbufptr) { - output_ulong_value(outbufptr, glyph_index, charset->char_size, side); - outbufptr += charset->char_size; - } - - (*to_left) -= charset->char_size; - - } /* end of while */ - - if ( (ext_seg_len != NULL) && outbufptr) { - int i = (outbufptr - ext_seg_len) - 2; - *ext_seg_len++ = i / 128 + 128; - *ext_seg_len = i % 128 + 128; - } - - *from = (XPointer) ((const wchar_t *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -stdc_wcstocts( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left) * MB_CUR_MAX; - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = stdc_wcstombs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = buf_ptr1 - buf_ptr2; - - unconv_num2 = mbstocts(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -ctstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned char ch; - unsigned long glyph_index = 0; - wchar_t wc; - - int ctr_seq_len = 0, gi_len_left = 0, gi_len = 0; - int unconv_num = 0; - - CodeSet codeset = NULL; - XlcCharSet charset_tmp; - - const char *inbufptr; - wchar_t *outbufptr = (wchar_t *) *to; - int from_size = *from_left; - - _XlcResetConverter(conv); /* ??? */ - - if (from == NULL || *from == NULL) { - _XlcResetConverter(conv); - return( 0 ); - } - inbufptr = *from; - - while (*from_left && *to_left) { - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - if (outbufptr) {*outbufptr++ = L'\0';} - (*to_left)--; - - /* error check */ - if (gi_len_left) { - unconv_num += (gi_len - gi_len_left); - gi_len_left = 0; - } - - continue; - } - - /* same glyph_index data */ - if (gi_len_left) - goto output_one_wc; - - /* control sequence ? */ - if (ch == CSI) { - if ( !ct_parse_csi(inbufptr - 1, &ctr_seq_len) ) - goto skip_the_seg; - - if (*from_left + 1 < ctr_seq_len) { - inbufptr--; - (*from_left)++; - unconv_num += *from_left; - break; - } - - /* skip the control sequence */ - inbufptr += (ctr_seq_len - 1); - *from_left -= (ctr_seq_len - 1); - - continue; - } - - /* escape sequence ? */ - if (ch == ESC) { - if ( !ct_parse_charset(lcd, - inbufptr - 1, &state->charset, &ctr_seq_len) ) - goto skip_the_seg; - - if (state->charset->side == XlcC0 || - state->charset->side == XlcGL) - { - state->GL_charset = state->charset; - } - else if (state->charset->side == XlcC1 || - state->charset->side == XlcGR) - { - state->GR_charset = state->charset; - } - else if (state->charset->side == XlcGLGR) - { - state->GL_charset = state->charset; - state->GR_charset = state->charset; - } - - if (*from_left + 1 < ctr_seq_len) { - inbufptr--; - (*from_left)++; - unconv_num += *from_left; - break; - } - - /* skip the escape sequence */ - inbufptr += (ctr_seq_len - 1); - *from_left -= (ctr_seq_len - 1); - - continue; - } - - /* check current state */ - if (isleftside(ch)) - state->charset = state->GL_charset; - else - state->charset = state->GR_charset; - - gi_len = gi_len_left = state->charset->char_size; - glyph_index = 0; - -output_one_wc: - if (state->charset->side == XlcC1 || state->charset->side == XlcGR) - glyph_index = (glyph_index << 8) | (ch & GL); - else - glyph_index = (glyph_index << 8) | ch; - - gi_len_left--; - - /* last of one glyph_index data */ - if (!gi_len_left) { - - /* segment conversion */ - charset_tmp = state->charset; - segment_conversion(lcd, &charset_tmp, &glyph_index); - - /* get codeset */ - if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, - &codeset, &glyph_index) ) { - unconv_num += gi_len; - continue; - } - - /* convert glyph index to wicd char */ - gi_to_wc(lcd, glyph_index, codeset, &wc); - if (outbufptr) {*outbufptr++ = wc;} - (*to_left)--; - } - - continue; - -skip_the_seg: - /* skip until next escape or control sequence */ - while ( *from_left ) { - ch = *inbufptr++; - (*from_left)--; - unconv_num++; - - if (ch == ESC || ch == CSI) { - inbufptr--; - (*from_left)++; - unconv_num--; - break; - } - } - - if ( !(*from_left) ) - break; - - } /* end of while */ - - /* error check on last char */ - if (gi_len_left) { - inbufptr -= (gi_len - gi_len_left); - (*from_left) += (gi_len - gi_len_left); - unconv_num += (gi_len - gi_len_left); - } - - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -cstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned char ch; - unsigned long glyph_index = 0; - wchar_t wc; - int gi_len_left = 0, gi_len = 0; - - int unconv_num = 0; - - CodeSet codeset = NULL; - XlcCharSet charset, charset_tmp; - - const char *inbufptr; - wchar_t *outbufptr = (wchar_t *) *to; - int from_size = *from_left; - - if (from == NULL || *from == NULL) { - return( 0 ); - } - - inbufptr = *from; - - charset = (XlcCharSet) args[0]; - - while (*from_left && *to_left) { - - if (!gi_len_left) { - gi_len_left = gi_len = charset->char_size; - glyph_index = 0; - } - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - if (outbufptr) {*outbufptr++ = L'\0';} - (*to_left)--; - - /* error check */ - if (gi_len_left) { - unconv_num += (gi_len - gi_len_left); - gi_len_left = 0; - } - continue; - } - - if (charset->side == XlcC1 || charset->side == XlcGR) - glyph_index = (glyph_index << 8) | (ch & GL); - else - glyph_index = (glyph_index << 8) | ch; - - gi_len_left--; - - /* last of one glyph_index data */ - if (!gi_len_left) { - - /* segment conversion */ - charset_tmp = charset; - segment_conversion(lcd, &charset_tmp, &glyph_index); - - /* get codeset */ - if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, - &codeset, &glyph_index) ) { - unconv_num += gi_len; - continue; - } - - /* convert glyph index to wicd char */ - gi_to_wc(lcd, glyph_index, codeset, &wc); - if (outbufptr) {*outbufptr++ = wc;} - (*to_left)--; - } - - } /* end of while */ - - /* error check on last char */ - if (gi_len_left) { - inbufptr -= (gi_len - gi_len_left); - (*from_left) += (gi_len - gi_len_left); - unconv_num += (gi_len - gi_len_left); - } - - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -stdc_ctstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left) * MB_CUR_MAX; - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = ctstombs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = buf_ptr1 - buf_ptr2; - - unconv_num2 = stdc_mbstowcs(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -stdc_cstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left) * MB_CUR_MAX; - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = cstombs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = buf_ptr1 - buf_ptr2; - - unconv_num2 = stdc_mbstowcs(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -mbstocts( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left); - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = mbstowcs_org(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); - - unconv_num2 += wcstocts(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -mbstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned char ch; - unsigned long mb = 0; - - int length = 0, len_left = 0; - int unconv_num = 0; - int num; - - CodeSet codeset = NULL; - - const char *inbufptr; - char *outbufptr = *to; - int from_size = *from_left; - - unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); - - if (from == NULL || *from == NULL) { - _XlcResetConverter(conv); - return( 0 ); - } - - inbufptr = *from; - - while (*from_left && *to_left) { - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - if (outbufptr) {*outbufptr++ = '\0';} - (*to_left)--; - - /* error check */ - if (len_left) { - unconv_num += (length - len_left); - len_left = 0; - } - - continue; - } - - /* same mb char data */ - if (len_left) - goto output_one_mb; - - /* next mb char data for single shift ? */ - if (mb_parse_table && (num = mb_parse_table[ch]) ) { - codeset = mb_parse_codeset(state, num, &inbufptr, from_left); - if (codeset != NULL) { - length = len_left = codeset->length; - mb = 0; - continue; - } - } - - /* next char data : byteM ? */ - if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) - goto next_mb_char; - - /* next char data : GL or GR side ? */ - if ((codeset = GLGR_parse_codeset(ch))) - goto next_mb_char; - - /* can't find codeset for the ch */ - unconv_num++; - continue; - -next_mb_char: - length = len_left = codeset->length; - mb = 0; - -output_one_mb: - mb = (mb << 8) | ch; /* 1 byte left shift */ - len_left--; - - /* last of one mb char data */ - if (!len_left) { - if (check_string_encoding(codeset)) { - if (outbufptr) {*outbufptr++ = mb & 0xff;} - (*to_left)--; - } else { - unconv_num++; - } - } - - } /* end of while */ - - /* error check on last char */ - if (len_left) { - inbufptr -= (length - len_left); - (*from_left) += (length - len_left); - unconv_num += (length - len_left); - } - - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -mbtocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned char ch; - unsigned long mb = 0; - unsigned long glyph_index; - - int length = 0, len_left = 0, char_len; - int unconv_num = 0; - int num; - XlcSide side; - - CodeSet codeset = NULL; - XlcCharSet charset = NULL; - - const char *inbufptr; - char *outbufptr = *to; - int from_size = *from_left; - - unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); - - if (from == NULL || *from == NULL) { - _XlcResetConverter(conv); - return( 0 ); - } - - inbufptr = *from; - - while (*from_left && *to_left) { - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - unconv_num = 1; - if (len_left) - unconv_num += (length - len_left); - break; - } - - /* same mb char data */ - if (len_left) - goto output; - - /* next mb char data for single shift ? */ - if (mb_parse_table && (num = mb_parse_table[ch]) ) { - codeset = mb_parse_codeset(state, num, &inbufptr, from_left); - if (codeset != NULL) { - length = len_left = codeset->length; - mb = 0; - continue; - } - } - - /* next mb char data for byteM ? */ - if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) - goto next_mb_char; - - /* next mb char data for GL or GR side ? */ - if ((codeset = GLGR_parse_codeset(ch))) - goto next_mb_char; - - /* can't find codeset for the ch */ - unconv_num = 1; - break; - -next_mb_char: - length = len_left = codeset->length; - mb = 0; - -output: - mb = (mb << 8) | ch; /* 1 byte left shift */ - len_left--; - - /* last of one mb char data */ - if (!len_left) { - glyph_index = mb_to_gi(mb, codeset); - if (!(charset = gi_parse_charset(glyph_index, codeset))) { - unconv_num = length; - break; - } - char_len = charset->char_size; - side = charset->side; - - /* output glyph index */ - if (codeset->ctconv) - glyph_index = conv_to_dest(codeset->ctconv, glyph_index); - if (*to_left < char_len) { - unconv_num = length; - break; - } - - if (outbufptr) { - output_ulong_value(outbufptr, glyph_index, char_len, side); - outbufptr += char_len; - } - - (*to_left) -= char_len; - - break; - } - - } /* end of while */ - - /* error end */ - if (unconv_num) { - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - return -1; - } - - /* normal end */ - *from = (XPointer) inbufptr; - *to = (XPointer) outbufptr; - - if (num_args > 0) - *((XlcCharSet *) args[0]) = charset; - - return 0; -} - -static int -mbstocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - int ret; - XlcCharSet charset_old, charset = NULL; - XPointer tmp_args[1]; - - const char *inbufptr; - int in_left; - char *outbufptr; - int out_left; - tmp_args[0] = (XPointer) &charset; - - ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); - charset_old = charset; - - while ( ret == 0 && *from_left && *to_left) { - inbufptr = *from; - in_left = *from_left; - outbufptr = *to; - out_left = *to_left; - ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); - if (charset_old != charset) { - *from = (XPointer) inbufptr; - *from_left = in_left; - *to = (XPointer) outbufptr; - *to_left = out_left; - break; - } - } - - if (num_args > 0) - *((XlcCharSet *) args[0]) = charset_old; - - /* error end */ - if (ret != 0) - return( -1 ); - - return(0); -} - -static int -wcstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - char *encoding; - unsigned long mb, glyph_index; - wchar_t wc; - - int length; - int unconv_num = 0; - - CodeSet codeset; - - const wchar_t *inbufptr = (const wchar_t *) *from; - char *outbufptr = *to; - int from_size = *from_left; - - const char *default_string = XLC_PUBLIC(lcd, default_string); - int defstr_len = strlen(default_string); - - while (*from_left && *to_left) { - - wc = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!wc) { - if (outbufptr) {*outbufptr++ = '\0';} - (*to_left)--; - - continue; - } - - /* convert */ - if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { - - /* output default_string of XDefaultString() */ - if (*to_left < defstr_len) - break; - if (outbufptr) { - strncpy((char *)outbufptr, default_string, defstr_len); - outbufptr += defstr_len; - } - (*to_left) -= defstr_len; - - unconv_num++; - - } else { - mb = gi_to_mb(glyph_index, codeset); - - if (check_string_encoding(codeset)) { - if (codeset->parse_info) { - Bool need_shift = False; - switch (codeset->parse_info->type) { - case E_LSL : - if (codeset != state->GL_codeset) { - need_shift = True; - state->GL_codeset = codeset; - } - break; - case E_LSR : - if (codeset != state->GR_codeset) { - need_shift = True; - state->GR_codeset = codeset; - } - break; - /* case E_SS */ - default: - need_shift = True; - } - - /* output shift sequence */ - if (need_shift) { - encoding = codeset->parse_info->encoding; - length = strlen(encoding); - if (*to_left < length) - break; - - if (outbufptr) { - strncpy((char *)outbufptr, encoding, length); - outbufptr += length; - } - (*to_left) -= length; - } - } - - /* output characters */ - length = codeset->length; - if (*to_left < length) - break; - - if (outbufptr) { - output_ulong_value(outbufptr, mb, length, XlcNONE); - outbufptr += length; - } - - (*to_left) -= length; - } else { - unconv_num++; - } - } - - } /* end of while */ - - *from = (XPointer) ((const wchar_t *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -stdc_wcstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left) * MB_CUR_MAX; - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = stdc_wcstombs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = buf_ptr1 - buf_ptr2; - - unconv_num2 = mbstostr(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -wctocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - wchar_t wc; - unsigned long glyph_index; - - int char_len; - int unconv_num = 0; - XlcSide side; - - CodeSet codeset; - XlcCharSet charset = NULL; - - const wchar_t *inbufptr = (const wchar_t *) *from; - char *outbufptr = *to; - int from_size = *from_left; - - if (*from_left && *to_left) { - - wc = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!wc) { - unconv_num = 1; - goto end; - } - - /* convert */ - if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { - unconv_num = 1; - goto end; - } - - if ( !(charset = gi_parse_charset(glyph_index, codeset)) ) { - unconv_num = 1; - goto end; - } - char_len = charset->char_size; - side = charset->side; - - /* output glyph index */ - if (codeset->ctconv) - glyph_index = conv_to_dest(codeset->ctconv, glyph_index); - if (*to_left < char_len) { - unconv_num++; - goto end; - } - - if (outbufptr) { - output_ulong_value(outbufptr, glyph_index, char_len, side); - outbufptr += char_len; - } - - (*to_left) -= char_len; - - } - -end: - - /* error end */ - if (unconv_num) { - *from = (XPointer) ((const wchar_t *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - return -1; - } - - /* normal end */ - *from = (XPointer) inbufptr; - *to = (XPointer) outbufptr; - - if (num_args > 0) - *((XlcCharSet *) args[0]) = charset; - - return 0; -} - -static int -stdc_wctocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const wchar_t *src = *((const wchar_t **) from); - wchar_t wch; - XPointer tmp_from, save_from = *from; - char tmp[32]; - int length, ret, src_left = *from_left; - int from_size = *from_left; - - if (src_left > 0 && *to_left > 0) { - if ((wch = *src)) { - length = wctomb(tmp, wch); - } else { - goto end; - } - - if (length < 0) - goto end; - - tmp_from = (XPointer) tmp; - ret = mbtocs(conv, &tmp_from, &length, to, to_left, args, num_args); - if (ret < 0) - goto end; - - src++; - src_left--; - } - -end: - /* error end */ - if (save_from == (XPointer) src) { - *from = (XPointer) ((const wchar_t *) *from + from_size); - *from_left = 0; - return -1; - } - - /* normal end */ - *from = (XPointer) src; - *from_left = src_left; - - return 0; -} - -static int -wcstocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - int ret; - XlcCharSet charset_old, charset = NULL; - XPointer tmp_args[1]; - - const wchar_t *inbufptr; - int in_left; - XPointer outbufptr; - int out_left; - tmp_args[0] = (XPointer) &charset; - - ret = wctocs(conv, from, from_left, to, to_left, tmp_args, 1); - charset_old = charset; - - while ( ret == 0 && *from_left && *to_left) { - inbufptr = (const wchar_t *) *from; - in_left = *from_left; - outbufptr = *to; - out_left = *to_left; - ret = wctocs(conv, from, from_left, to, to_left, tmp_args, 1); - if (charset_old != charset) { - *from = (XPointer) inbufptr; - *from_left = in_left; - *to = (XPointer) outbufptr; - *to_left = out_left; - break; - } - } - - if (num_args > 0) - *((XlcCharSet *) args[0]) = charset_old; - - /* error end */ - if (ret != 0) - return( -1 ); - - return(0); -} - -#ifdef STDCVT - -static int -stdc_wcstocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - int ret; - XlcCharSet charset_old, charset = NULL; - XPointer tmp_args[1]; - - const wchar_t *inbufptr; - int in_left; - XPointer outbufptr; - int out_left; - tmp_args[0] = (XPointer) &charset; - - ret = stdc_wctocs(conv, from, from_left, to, to_left, tmp_args, 1); - charset_old = charset; - - while ( ret == 0 && *from_left && *to_left ) { - inbufptr = (const wchar_t *) *from; - in_left = *from_left; - outbufptr = *to; - out_left = *to_left; - ret = stdc_wctocs(conv, from, from_left, to, to_left, tmp_args, 1); - if (charset_old != charset) { - *from = (XPointer) inbufptr; - *from_left = in_left; - *to = (XPointer) outbufptr; - *to_left = out_left; - break; - } - } - - if (num_args > 0) - *((XlcCharSet *) args[0]) = charset_old; - - /* error end */ - if (ret != 0) - return( -1 ); - - return(0); -} - -#endif - -static int -ctstombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left); - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = ctstowcs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); - - unconv_num2 += wcstombs_org(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -cstombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left); - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = cstowcs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); - - unconv_num2 += wcstombs_org(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -static int -strtombs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - char *encoding; - unsigned long mb, glyph_index; - unsigned char ch; - - int length; - int unconv_num = 0; - - CodeSet codeset; - - const char *inbufptr = *from; - char *outbufptr = *to; - int from_size = *from_left; - - while (*from_left && *to_left) { - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - if (outbufptr) {*outbufptr++ = '\0';} - (*to_left)--; - - continue; - } - - /* convert */ - if (isleftside(ch)) { - glyph_index = ch; - codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GL"); - } else { - glyph_index = ch & GL; - codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GR"); - } - - if (!codeset) { - unconv_num++; - continue; - } - - mb = gi_to_mb(glyph_index, codeset); - if (codeset->parse_info) { - Bool need_shift = False; - switch (codeset->parse_info->type) { - case E_LSL : - if (codeset != state->GL_codeset) { - need_shift = True; - state->GL_codeset = codeset; - } - break; - case E_LSR : - if (codeset != state->GR_codeset) { - need_shift = True; - state->GR_codeset = codeset; - } - break; - /* case E_SS */ - default: - need_shift = True; - } - - /* output shift sequence */ - if (need_shift) { - encoding = codeset->parse_info->encoding; - length = strlen(encoding); - if (*to_left < length) - break; - if (outbufptr) { - strncpy((char *)outbufptr, encoding, length); - outbufptr += length; - } - (*to_left) -= length; - } - } - - /* output characters */ - length = codeset->length; - if (*to_left < length) - break; - - if (outbufptr) { - output_ulong_value(outbufptr, mb, length, XlcNONE); - outbufptr += length; - } - - (*to_left) -= length; - - } /* end of while */ - - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -strtowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - State state = (State) conv->state; - XLCd lcd = state->lcd; - - unsigned char ch; - unsigned long glyph_index; - wchar_t wc; - - int unconv_num = 0; - CodeSet codeset; - - const char *inbufptr = *from; - wchar_t *outbufptr = (wchar_t *)*to; - int from_size = *from_left; - - while (*from_left && *to_left) { - - ch = *inbufptr++; - (*from_left)--; - - /* null ? */ - if (!ch) { - if (outbufptr) {*outbufptr++ = L'\0';} - (*to_left)--; - - continue; - } - - /* convert */ - if (isleftside(ch)) { - glyph_index = ch; - codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GL"); - } else { - glyph_index = ch & GL; - codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GR"); - } - - if (!codeset) { - unconv_num++; - continue; - } - - gi_to_wc(lcd, glyph_index, codeset, &wc); - if (outbufptr) {*outbufptr++ = wc;} - (*to_left)--; - - } /* end of while */ - - *from = (XPointer) ((const char *) *from + from_size); - *from_left = 0; - *to = (XPointer) outbufptr; - - return unconv_num; -} - -static int -stdc_strtowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); - char *buf_ptr1 = buf; - int buf_left1 = (*from_left) * MB_CUR_MAX; - char *buf_ptr2 = buf_ptr1; - int buf_left2; - int unconv_num1 = 0, unconv_num2 = 0; - - unconv_num1 = strtombs(conv, - from, from_left, &buf_ptr1, &buf_left1, args, num_args); - if (unconv_num1 < 0) - goto ret; - - buf_left2 = buf_ptr1 - buf_ptr2; - - unconv_num2 = stdc_mbstowcs(conv, - &buf_ptr2, &buf_left2, to, to_left, args, num_args); - if (unconv_num2 < 0) - goto ret; - -ret: - Xfree(buf); - - return (unconv_num1 + unconv_num2); -} - -/* -------------------------------------------------------------------------- */ -/* Close */ -/* -------------------------------------------------------------------------- */ - -static void -close_converter( - XlcConv conv) -{ - Xfree(conv->state); - Xfree(conv->methods); - Xfree(conv); -} - -/* -------------------------------------------------------------------------- */ -/* Open */ -/* -------------------------------------------------------------------------- */ - -static XlcConv -create_conv( - XLCd lcd, - XlcConvMethods methods) -{ - XlcConv conv; - State state; - - conv = Xcalloc(1, sizeof(XlcConvRec)); - if (conv == NULL) - return (XlcConv) NULL; - - conv->methods = Xmalloc(sizeof(XlcConvMethodsRec)); - if (conv->methods == NULL) - goto err; - *conv->methods = *methods; - conv->methods->reset = init_state; - - conv->state = Xcalloc(1, sizeof(StateRec)); - if (conv->state == NULL) - goto err; - - state = (State) conv->state; - state->lcd = lcd; - - _XlcResetConverter(conv); - - return conv; - -err: - close_converter(conv); - - return (XlcConv) NULL; -} - -static XlcConvMethodsRec mbstocts_methods = { - close_converter, - mbstocts, - NULL -}; - -static XlcConv -open_mbstocts( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstocts_methods); -} - -static XlcConvMethodsRec mbstostr_methods = { - close_converter, - mbstostr, - NULL -}; - -static XlcConv -open_mbstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstostr_methods); -} - -static XlcConvMethodsRec mbstocs_methods = { - close_converter, - mbstocs, - NULL -}; - -static XlcConv -open_mbstocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstocs_methods); -} - -static XlcConvMethodsRec mbtocs_methods = { - close_converter, - mbtocs, - NULL -}; - -static XlcConv -open_mbtocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbtocs_methods); -} - -static XlcConvMethodsRec ctstombs_methods = { - close_converter, - ctstombs, - NULL -}; - -static XlcConv -open_ctstombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &ctstombs_methods); -} - -static XlcConvMethodsRec cstombs_methods = { - close_converter, - cstombs, - NULL -}; - -static XlcConv -open_cstombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &cstombs_methods); -} - -static XlcConvMethodsRec strtombs_methods = { - close_converter, - strtombs, - NULL -}; - -static XlcConv -open_strtombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &strtombs_methods); -} - -#ifdef STDCVT - -static XlcConvMethodsRec stdc_mbstowcs_methods = { - close_converter, - stdc_mbstowcs, - NULL -}; - -static XlcConv -open_stdc_mbstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_mbstowcs_methods); -} - -static XlcConvMethodsRec stdc_wcstombs_methods = { - close_converter, - stdc_wcstombs, - NULL -}; - -static XlcConv -open_stdc_wcstombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_wcstombs_methods); -} - -static XlcConvMethodsRec stdc_wcstocts_methods = { - close_converter, - stdc_wcstocts, - NULL -}; - -static XlcConv -open_stdc_wcstocts( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_wcstocts_methods); -} - -static XlcConvMethodsRec stdc_wcstostr_methods = { - close_converter, - stdc_wcstostr, - NULL -}; - -static XlcConv -open_stdc_wcstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_wcstostr_methods); -} - -static XlcConvMethodsRec stdc_wcstocs_methods = { - close_converter, - stdc_wcstocs, - NULL -}; - -static XlcConv -open_stdc_wcstocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_wcstocs_methods); -} - -static XlcConvMethodsRec stdc_wctocs_methods = { - close_converter, - stdc_wctocs, - NULL -}; - -static XlcConv -open_stdc_wctocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_wctocs_methods); -} - -static XlcConvMethodsRec stdc_ctstowcs_methods = { - close_converter, - stdc_ctstowcs, - NULL -}; - -static XlcConv -open_stdc_ctstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_ctstowcs_methods); -} - -static XlcConvMethodsRec stdc_cstowcs_methods = { - close_converter, - stdc_cstowcs, - NULL -}; - -static XlcConv -open_stdc_cstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_cstowcs_methods); -} - -static XlcConvMethodsRec stdc_strtowcs_methods = { - close_converter, - stdc_strtowcs, - NULL -}; - -static XlcConv -open_stdc_strtowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &stdc_strtowcs_methods); -} - -#endif /* STDCVT */ - -static XlcConvMethodsRec mbstowcs_methods = { - close_converter, - mbstowcs_org, - NULL -}; - -static XlcConv -open_mbstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &mbstowcs_methods); -} - -static XlcConvMethodsRec wcstombs_methods = { - close_converter, - wcstombs_org, - NULL -}; - -static XlcConv -open_wcstombs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstombs_methods); -} - -static XlcConvMethodsRec wcstocts_methods = { - close_converter, - wcstocts, - NULL -}; - -static XlcConv -open_wcstocts( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstocts_methods); -} - -static XlcConvMethodsRec wcstostr_methods = { - close_converter, - wcstostr, - NULL -}; - -static XlcConv -open_wcstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstostr_methods); -} - -static XlcConvMethodsRec wcstocs_methods = { - close_converter, - wcstocs, - NULL -}; - -static XlcConv -open_wcstocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wcstocs_methods); -} - -static XlcConvMethodsRec wctocs_methods = { - close_converter, - wctocs, - NULL -}; - -static XlcConv -open_wctocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &wctocs_methods); -} - -static XlcConvMethodsRec ctstowcs_methods = { - close_converter, - ctstowcs, - NULL -}; - -static XlcConv -open_ctstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &ctstowcs_methods); -} - -static XlcConvMethodsRec cstowcs_methods = { - close_converter, - cstowcs, - NULL -}; - -static XlcConv -open_cstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &cstowcs_methods); -} - -static XlcConvMethodsRec strtowcs_methods = { - close_converter, - strtowcs, - NULL -}; - -static XlcConv -open_strtowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &strtowcs_methods); -} - -/* -------------------------------------------------------------------------- */ -/* Loader */ -/* -------------------------------------------------------------------------- */ - -XLCd -_XlcGenericLoader( - const char *name) -{ - XLCd lcd; -#ifdef STDCVT - XLCdGenericPart *gen; -#endif - - lcd = _XlcCreateLC(name, _XlcGenericMethods); - - if (lcd == NULL) - return lcd; - - default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); - default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); - - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCompoundText, open_mbstocts); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbtocs); - _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs); - _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); - -#ifdef STDCVT - gen = XLC_GENERIC_PART(lcd); - - if (gen->use_stdc_env != True) { -#endif - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_wcstocts); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wctocs); - _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_ctstowcs); - _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); -#ifdef STDCVT - } -#endif - -#ifdef STDCVT - if (gen->use_stdc_env == True) { - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_stdc_mbstowcs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_stdc_wcstombs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_stdc_wcstocts); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_stdc_wcstostr); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_stdc_wcstocs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_stdc_wctocs); - _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_stdc_ctstowcs); - _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_stdc_strtowcs); - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_stdc_cstowcs); - } -#endif - - _XlcAddUtf8Converters(lcd); - - return lcd; -} diff --git a/nx-X11/lib/X11/lcGeneric.c b/nx-X11/lib/X11/lcGeneric.c deleted file mode 100644 index 58ee5d27c..000000000 --- a/nx-X11/lib/X11/lcGeneric.c +++ /dev/null @@ -1,1171 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * (c) Copyright 1995 FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "XlcGeneric.h" - -static XLCd create (const char *name, XLCdMethods methods); -static Bool initialize (XLCd lcd); -static void destroy (XLCd lcd); - -static XLCdPublicMethodsRec genericMethods = { - { NULL }, /* use default methods */ - { - NULL, - create, - initialize, - destroy, - NULL - } -}; - -XLCdMethods _XlcGenericMethods = (XLCdMethods) &genericMethods; - -static XLCd -create( - const char *name, - XLCdMethods methods) -{ - XLCd lcd; - XLCdPublicMethods new; - - lcd = Xcalloc(1, sizeof(XLCdRec)); - if (lcd == NULL) - return (XLCd) NULL; - - lcd->core = Xcalloc(1, sizeof(XLCdGenericRec)); - if (lcd->core == NULL) - goto err; - - new = Xmalloc(sizeof(XLCdPublicMethodsRec)); - if (new == NULL) - goto err; - memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); - lcd->methods = (XLCdMethods) new; - - return lcd; - -err: - Xfree(lcd); - return (XLCd) NULL; -} - -static Bool -string_to_encoding( - const char *str, - char *encoding) -{ - char *next; - long value; - int base; - - while (*str) { - if (*str == '\\') { - switch (*(str + 1)) { - case 'x': - case 'X': - base = 16; - break; - default: - base = 8; - break; - } - value = strtol(str + 2, &next, base); - if (str + 2 != next) { - *((unsigned char *) encoding++) = (unsigned char) value; - str = next; - continue; - } - } - *encoding++ = *str++; - } - - *encoding = '\0'; - - return True; -} - -static Bool -string_to_ulong( - const char *str, - unsigned long *value) -{ - const char *tmp1 = str; - int base; - - if (*tmp1++ != '\\') { - tmp1--; - base = 10; - } else { - switch (*tmp1++) { - case 'x': - base = 16; - break; - case 'o': - base = 8; - break; - case 'd': - base = 10; - break; - default: - return(False); - } - } - *value = (unsigned long) strtol(tmp1, NULL, base); - return(True); -} - - -static Bool -add_charset( - CodeSet codeset, - XlcCharSet charset) -{ - XlcCharSet *new_list; - int num; - - if ((num = codeset->num_charsets)) - new_list = Xrealloc(codeset->charset_list, - (num + 1) * sizeof(XlcCharSet)); - else - new_list = Xmalloc(sizeof(XlcCharSet)); - - if (new_list == NULL) - return False; - - new_list[num] = charset; - codeset->charset_list = new_list; - codeset->num_charsets = num + 1; - - return True; -} - -static CodeSet -add_codeset( - XLCdGenericPart *gen) -{ - CodeSet new, *new_list; - int num; - - new = Xcalloc(1, sizeof(CodeSetRec)); - if (new == NULL) - return NULL; - - if ((num = gen->codeset_num)) - new_list = Xrealloc(gen->codeset_list, - (num + 1) * sizeof(CodeSet)); - else - new_list = Xmalloc(sizeof(CodeSet)); - - if (new_list == NULL) - goto err; - - new_list[num] = new; - gen->codeset_list = new_list; - gen->codeset_num = num + 1; - - return new; - -err: - Xfree(new); - - return NULL; -} - -static Bool -add_parse_list( - XLCdGenericPart *gen, - EncodingType type, - const char *encoding, - CodeSet codeset) -{ - ParseInfo new, *new_list; - char *str; - unsigned char ch; - int num; - - str = strdup(encoding); - if (str == NULL) - return False; - - new = Xcalloc(1, sizeof(ParseInfoRec)); - if (new == NULL) - goto err; - - if (gen->mb_parse_table == NULL) { - gen->mb_parse_table = Xcalloc(1, 256); /* 2^8 */ - if (gen->mb_parse_table == NULL) - goto err; - } - - if ((num = gen->mb_parse_list_num)) - new_list = Xrealloc(gen->mb_parse_list, - (num + 2) * sizeof(ParseInfo)); - else { - new_list = Xmalloc(2 * sizeof(ParseInfo)); - } - - if (new_list == NULL) - goto err; - - new_list[num] = new; - new_list[num + 1] = NULL; - gen->mb_parse_list = new_list; - gen->mb_parse_list_num = num + 1; - - ch = (unsigned char) *str; - if (gen->mb_parse_table[ch] == 0) - gen->mb_parse_table[ch] = num + 1; - - new->type = type; - new->encoding = str; - new->codeset = codeset; - - if (codeset->parse_info == NULL) - codeset->parse_info = new; - - return True; - -err: - Xfree(str); - - Xfree(new); - - return False; -} - -static void -free_charset( - XLCd lcd) -{ - XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); - ParseInfo *parse_info; - int num; - - Xfree(gen->mb_parse_table); - if ((num = gen->mb_parse_list_num) > 0) { - for (parse_info = gen->mb_parse_list; num-- > 0; parse_info++) { - Xfree((*parse_info)->encoding); - Xfree(*parse_info); - } - Xfree(gen->mb_parse_list); - } - - if ((num = gen->codeset_num) > 0) - Xfree(gen->codeset_list); -} - -/* For VW/UDC */ - -#define FORWARD (unsigned long)'+' -#define BACKWARD (unsigned long)'-' - -static const char * -getscope( - const char *str, - FontScope scp) -{ - unsigned long start = 0; - unsigned long end = 0; - unsigned long dest = 0; - unsigned long shift = 0; - unsigned long direction = 0; - sscanf(str,"[\\x%lx,\\x%lx]->\\x%lx", &start, &end, &dest); - if (dest) { - if (dest >= start) { - shift = dest - start; - direction = FORWARD ; - } else { - shift = start - dest; - direction = BACKWARD; - } - } - scp->start = start ; - scp->end = end ; - scp->shift = shift ; - scp->shift_direction - = direction ; - /* .......... */ - while (*str) { - if (*str == ',' && *(str+1) == '[') - break; - str++; - } - return str+1; -} - -static int -count_scopemap( - const char *str) -{ - const char *ptr; - int num=0; - for (ptr=str; *ptr; ptr++) { - if (*ptr == ']') { - num++; - } - } - return num; -} - -FontScope -_XlcParse_scopemaps( - const char *str, - int *size) -{ - int num=0,i; - FontScope scope,sc_ptr; - const char *str_sc; - - num = count_scopemap(str); - scope = Xmalloc(num * sizeof(FontScopeRec)); - if (scope == NULL) - return NULL; - - for (i=0, str_sc=str, sc_ptr=scope; i < num; i++, sc_ptr++) { - str_sc = getscope(str_sc, sc_ptr); - } - *size = num; - return scope; -} - -void -_XlcDbg_printValue( - const char *str, - char **value, - int num) -{ -/* - int i; - for (i = 0; i < num; i++) - fprintf(stderr, "%s value[%d] = %s\n", str, i, value[i]); -*/ -} - -static void -dmpscope( - const char* name, - FontScope sc, - int num) -{ -/* - int i; - fprintf(stderr, "dmpscope %s\n", name); - for (i=0; isource = CSsrcXLC; - } - return charset; -} - -static void -read_charset_define( - XLCd lcd, - XLCdGenericPart *gen) -{ - int i; - char csd[16], cset_name[256]; - char name[BUFSIZ]; - XlcCharSet charsetd; - char **value; - int num, new = 0; - XlcSide side = XlcUnknown; - char *tmp; - - for (i=0; ; i++) { /* loop start */ - charsetd = 0; - snprintf(csd, sizeof(csd), "csd%d", i); - - /* charset_name */ - snprintf(name, sizeof(name), "%s.%s", csd, "charset_name"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - _XlcDbg_printValue(name,value,num); - if (num > 0) { - /* hackers will get truncated -- C'est la vie */ - strncpy(cset_name,value[0], sizeof cset_name - 1); - cset_name[(sizeof cset_name) - 1] = '\0'; - snprintf(name, sizeof(name), "%s.%s", csd , "side"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { - side = XlcGLGR; - } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { - side = XlcGL; - strcat(cset_name,":GL"); - } else { - side = XlcGR; - strcat(cset_name,":GR"); - } - if (charsetd == NULL && - (charsetd = srch_charset_define(cset_name,&new)) == NULL) - return; - } - } else { - if (i == 0) - continue; - else - break; - } - if (new) { - tmp = strdup(cset_name); - if (tmp == NULL) - return; - charsetd->name = tmp; - } - /* side */ - charsetd->side = side ; - /* length */ - snprintf(name, sizeof(name), "%s.%s", csd, "length"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - charsetd->char_size = atoi(value[0]); - } - /* gc_number */ - snprintf(name, sizeof(name), "%s.%s", csd, "gc_number"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - charsetd->set_size = atoi(value[0]); - } - /* string_encoding */ - snprintf(name, sizeof(name), "%s.%s", csd, "string_encoding"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - if (!strcmp("False",value[0])) { - charsetd->string_encoding = False; - } else { - charsetd->string_encoding = True; - } - } - /* sequence */ - snprintf(name, sizeof(name), "%s.%s", csd, "sequence"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); -/* - if (charsetd->ct_sequence) { - Xfree(charsetd->ct_sequence); - } -*/ - tmp = Xmalloc(strlen(value[0])+1); - if (tmp == NULL) - return; - charsetd->ct_sequence = tmp; - string_to_encoding(value[0],tmp); - } - /* encoding_name */ - snprintf(name, sizeof(name), "%s.%s", csd, "encoding_name"); - _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); -/* - if (charsetd->encoding_name) { - Xfree(charsetd->encoding_name); - } -*/ - tmp = strdup(value[0]); - charsetd->encoding_name = tmp; - charsetd->xrm_encoding_name = XrmStringToQuark(tmp); - } - _XlcAddCT(charsetd->name, charsetd->ct_sequence); - } -} - -static SegConv -add_conversion( - XLCdGenericPart *gen) -{ - SegConv new_list; - int num; - - if ((num = gen->segment_conv_num) > 0) { - new_list = Xrealloc(gen->segment_conv, - (num + 1) * sizeof(SegConvRec)); - } else { - new_list = Xmalloc(sizeof(SegConvRec)); - } - - if (new_list == NULL) - return NULL; - - gen->segment_conv = new_list; - gen->segment_conv_num = num + 1; - - return &new_list[num]; - -} - -static void -read_segmentconversion( - XLCd lcd, - XLCdGenericPart *gen) -{ - int i; - char conv[16]; - char name[BUFSIZ]; - char **value; - int num,new; - SegConv conversion; - for (i=0 ; ; i++) { /* loop start */ - conversion = 0; - snprintf(conv, sizeof(conv), "conv%d", i); - - /* length */ - snprintf(name, sizeof(name), "%s.%s", conv, "length"); - _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); - if (num > 0) { - if (conversion == NULL && - (conversion = add_conversion(gen)) == NULL) { - return; - } - _XlcDbg_printValue(name,value,num); - } else { - if (i == 0) - continue; - else - break; - } - conversion->length = atoi(value[0]); - - /* source_encoding */ - snprintf(name, sizeof(name), "%s.%s", conv, "source_encoding"); - _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); - if (num > 0) { - char *tmp; - _XlcDbg_printValue(name,value,num); - tmp = strdup(value[0]); - if (tmp == NULL) - return; - conversion->source_encoding = tmp; - conversion->source = srch_charset_define(tmp,&new); - } - /* destination_encoding */ - snprintf(name, sizeof(name), "%s.%s", conv, "destination_encoding"); - _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); - if (num > 0) { - char *tmp; - _XlcDbg_printValue(name,value,num); - tmp = strdup(value[0]); - if (tmp == NULL) - return; - conversion->destination_encoding = tmp; - conversion->dest = srch_charset_define(tmp,&new); - } - /* range */ - snprintf(name, sizeof(name), "%s.%s", conv, "range"); - _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - sscanf(value[0],"\\x%lx,\\x%lx", - &(conversion->range.start), &(conversion->range.end)); - } - /* conversion */ - snprintf(name, sizeof(name), "%s.%s", conv, "conversion"); - _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - conversion->conv = - _XlcParse_scopemaps(value[0],&conversion->conv_num); - } - } /* loop end */ -} - -static ExtdSegment -create_ctextseg( - char **value, - int num) -{ - ExtdSegment ret; - char* ptr; - char* cset_name = NULL; - size_t cset_len; - int i,new; - FontScope scope; - ret = Xmalloc(sizeof(ExtdSegmentRec)); - if (ret == NULL) - return NULL; - ret->name = strdup(value[0]); - if (ret->name == NULL) { - Xfree (ret); - return NULL; - } - cset_len = strlen(ret->name) + 1; - cset_name = Xmalloc (cset_len); - if (cset_name == NULL) { - Xfree (ret->name); - Xfree (ret); - return NULL; - } - if (strchr(value[0],':')) { - ptr = strchr(ret->name,':'); - *ptr = '\0'; - ptr++; - if (!_XlcNCompareISOLatin1(ptr, "GL", 2)) { - ret->side = XlcGL; - snprintf(cset_name, cset_len, "%s:%s", ret->name, "GL"); - } else { - ret->side = XlcGR; - snprintf(cset_name, cset_len, "%s:%s", ret->name, "GR"); - } - } else { - ret->side = XlcGLGR; - strcpy(cset_name,ret->name); - } - ret->area = Xmalloc((num - 1)*sizeof(FontScopeRec)); - if (ret->area == NULL) { - Xfree (cset_name); - Xfree (ret->name); - Xfree (ret); - return NULL; - } - ret->area_num = num - 1; - scope = ret->area ; - for (i = 1; i < num; i++) { - sscanf(value[i],"\\x%lx,\\x%lx", - &scope[i-1].start, &scope[i-1].end); - } - ret->charset = srch_charset_define(cset_name,&new); - Xfree (cset_name); - - return ret; -} -/* For VW/UDC end */ - -static Bool -load_generic( - XLCd lcd) -{ - XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); - char **value; - int num; - unsigned long l; - int i; - int M,ii; - XlcCharSet charset; - - gen->codeset_num = 0; - - /***** wc_encoding_mask *****/ - _XlcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num); - if (num > 0) { - if (string_to_ulong(value[0], &l) == False) - goto err; - gen->wc_encode_mask = l; - } - /***** wc_shift_bits *****/ - _XlcGetResource(lcd, "XLC_XLOCALE", "wc_shift_bits", &value, &num); - if (num > 0) - gen->wc_shift_bits = atoi(value[0]); - if (gen->wc_shift_bits < 1) - gen->wc_shift_bits = 8; - /***** use_stdc_env *****/ - _XlcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num); - if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) - gen->use_stdc_env = True; - else - gen->use_stdc_env = False; - /***** force_convert_to_mb *****/ - _XlcGetResource(lcd, "XLC_XLOCALE", "force_convert_to_mb", &value, &num); - if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) - gen->force_convert_to_mb = True; - else - gen->force_convert_to_mb = False; - - for (i = 0; ; i++) { - CodeSetRec *codeset = NULL; - char cs[16]; - char name[BUFSIZ]; - - snprintf(cs, sizeof(cs), "cs%d", i); - - /***** codeset.side *****/ - snprintf(name, sizeof(name), "%s.%s", cs , "side"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - char *tmp; - - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; - - /* 3.4.1 side */ - if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { - codeset->side = XlcNONE; - } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { - codeset->side = XlcGL; - } else { - codeset->side = XlcGR; - } - - tmp = strrchr(value[0], ':'); - if (tmp != NULL && !_XlcCompareISOLatin1(tmp + 1, "Default")) { - if (codeset->side == XlcGR) - gen->initial_state_GR = codeset; - else - gen->initial_state_GL = codeset; - } - } - - /***** codeset.length *****/ - snprintf(name, sizeof(name), "%s.%s", cs , "length"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; - codeset->length = atoi(value[0]); - if (codeset->length < 1) - codeset->length = 1; - } - - /***** codeset.mb_encoding *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "mb_encoding"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - static struct { - const char *str; - EncodingType type; - } shifts[] = { - {"", E_SS}, - {"", E_LSL}, - {"", E_LSR}, - {0} - }; - int j; - - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; - for ( ; num-- > 0; value++) { - char encoding[256]; - char *tmp = *value; - EncodingType type = E_SS; /* for BC */ - for (j = 0; shifts[j].str; j++) { - if (!_XlcNCompareISOLatin1(tmp, shifts[j].str, - strlen(shifts[j].str))) { - type = shifts[j].type; - tmp += strlen(shifts[j].str); - break; - } - } - if (strlen (tmp) > sizeof encoding || - string_to_encoding(tmp, encoding) == False) - goto err; - add_parse_list(gen, type, encoding, codeset); - } - } - - /***** codeset.wc_encoding *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "wc_encoding"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; - if (string_to_ulong(value[0], &l) == False) - goto err; - codeset->wc_encoding = l; - } - - /***** codeset.ct_encoding *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "ct_encoding"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - char *encoding; - - if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) - goto err; - for ( ; num-- > 0; value++) { - if (strlen (*value) > sizeof name) - goto err; - string_to_encoding(*value, name); - charset = NULL; - if ((encoding = strchr(name, ':')) && - (encoding = strchr(encoding + 1, ':'))) { - *encoding++ = '\0'; - charset = _XlcAddCT(name, encoding); - } - if (charset == NULL) { - charset = _XlcGetCharSet(name); - if (charset == NULL && - (charset = _XlcCreateDefaultCharSet(name, ""))) { - charset->side = codeset->side; - charset->char_size = codeset->length; - _XlcAddCharSet(charset); - } - } - if (charset) { - if (add_charset(codeset, charset) == False) - goto err; - } - } - } - - if (codeset == NULL) - break; - codeset->cs_num = i; - /* For VW/UDC */ - /***** 3.4.2 byteM (1 <= M <= length)*****/ - for (M=1; M-1 < codeset->length; M++) { - unsigned long start,end; - ByteInfo tmpb; - - snprintf(name, sizeof(name),"%s.%s%d",cs,"byte",M); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - - if (M == 1) { - if (num < 1) { - codeset->byteM = NULL; - break ; - } - codeset->byteM = Xmalloc( - (codeset->length)*sizeof(ByteInfoListRec)); - if (codeset->byteM == NULL) { - goto err; - } - } - - if (num > 0) { - _XlcDbg_printValue(name,value,num); - (codeset->byteM)[M-1].M = M; - (codeset->byteM)[M-1].byteinfo_num = num; - (codeset->byteM)[M-1].byteinfo = - Xmalloc(num * sizeof(ByteInfoRec)); - for (ii = 0 ; ii < num ; ii++) { - tmpb = (codeset->byteM)[M-1].byteinfo ; - /* default 0x00 - 0xff */ - sscanf(value[ii],"\\x%lx,\\x%lx",&start,&end); - tmpb[ii].start = (unsigned char)start; - tmpb[ii].end = (unsigned char)end; - } - } - /* .... */ - } - - - /***** codeset.mb_conversion *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "mb_conversion"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - codeset->mbconv = Xmalloc(sizeof(ConversionRec)); - codeset->mbconv->convlist = - _XlcParse_scopemaps(value[0],&(codeset->mbconv->conv_num)); - dmpscope("mb_conv",codeset->mbconv->convlist, - codeset->mbconv->conv_num); - /* [\x%x,\x%x]->\x%x,... */ - } - /***** codeset.ct_conversion *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - codeset->ctconv = Xmalloc(sizeof(ConversionRec)); - codeset->ctconv->convlist = - _XlcParse_scopemaps(value[0],&(codeset->ctconv->conv_num)); - dmpscope("ctconv",codeset->ctconv->convlist, - codeset->ctconv->conv_num); - /* [\x%x,\x%x]->\x%x,... */ - } - /***** codeset.ct_conversion_file *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion_file"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - /* [\x%x,\x%x]->\x%x,... */ - } - /***** codeset.ct_extended_segment *****/ - snprintf(name, sizeof(name), "%s.%s", cs, "ct_extended_segment"); - _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); - if (num > 0) { - _XlcDbg_printValue(name,value,num); - codeset->ctextseg = create_ctextseg(value,num); - /* [\x%x,\x%x]->\x%x,... */ - } - /* For VW/UDC end */ - - } - - read_charset_define(lcd,gen); /* For VW/UDC */ - read_segmentconversion(lcd,gen); /* For VW/UDC */ - - if (gen->initial_state_GL == NULL) { - CodeSetRec *codeset; - for (i = 0; i < gen->codeset_num; i++) { - codeset = gen->codeset_list[i]; - if (codeset->side == XlcGL) - gen->initial_state_GL = codeset; - } - } - - if (gen->initial_state_GR == NULL) { - CodeSetRec *codeset; - for (i = 0; i < gen->codeset_num; i++) { - codeset = gen->codeset_list[i]; - if (codeset->side == XlcGR) - gen->initial_state_GR = codeset; - } - } - - for (i = 0; i < gen->codeset_num; i++) { - CodeSetRec *codeset = gen->codeset_list[i]; - for (ii = 0; ii < codeset->num_charsets; ii++) { - charset = codeset->charset_list[ii]; - if (! strcmp(charset->encoding_name, "ISO8859-1")) - charset->string_encoding = True; - if ( charset->string_encoding ) - codeset->string_encoding = True; - } - } - return True; - -err: - free_charset(lcd); - - return False; -} - -#ifdef USE_DYNAMIC_LC -/* override the open_om and open_im methods which were set by - super_class's initialize method() */ - -static Bool -initialize_core( - XLCd lcd) -{ - _XInitDynamicOM(lcd); - - _XInitDynamicIM(lcd); - - return True; -} -#endif - -static Bool -initialize(XLCd lcd) -{ - XLCdPublicMethods superclass = (XLCdPublicMethods) _XlcPublicMethods; - - XLC_PUBLIC_METHODS(lcd)->superclass = superclass; - - if (superclass->pub.initialize) { - if ((*superclass->pub.initialize)(lcd) == False) - return False; - } - -#ifdef USE_DYNAMIC_LC - if (initialize_core(lcd) == False) - return False; -#endif - - if (load_generic(lcd) == False) - return False; - - return True; -} - -/* VW/UDC start 95.01.08 */ -static void -freeByteM( - CodeSet codeset) -{ - int i; - ByteInfoList blst; - if (codeset->byteM == NULL) { - return ; - } - blst = codeset->byteM; - for (i = 0; i < codeset->length; i++) { - Xfree(blst[i].byteinfo); - blst[i].byteinfo = NULL; - } - Xfree(codeset->byteM); - codeset->byteM = NULL; -} - -static void -freeConversion( - CodeSet codeset) -{ - Conversion mbconv,ctconv; - if (codeset->mbconv) { - mbconv = codeset->mbconv; - /* ... */ - Xfree(mbconv->convlist); - mbconv->convlist = NULL; - - Xfree(mbconv); - codeset->mbconv = NULL; - } - if (codeset->ctconv) { - ctconv = codeset->ctconv; - /* ... */ - Xfree(ctconv->convlist); - ctconv->convlist = NULL; - - Xfree(ctconv); - codeset->ctconv = NULL; - } -} - -static void -freeExtdSegment( - CodeSet codeset) -{ - ExtdSegment ctextseg; - if (codeset->ctextseg == NULL) { - return; - } - ctextseg = codeset->ctextseg; - Xfree(ctextseg->name); - ctextseg->name = NULL; - - Xfree(ctextseg->area); - ctextseg->area = NULL; - - Xfree(codeset->ctextseg); - codeset->ctextseg = NULL; -} - -static void -freeParseInfo( - CodeSet codeset) -{ - ParseInfo parse_info; - if (codeset->parse_info == NULL) { - return; - } - parse_info = codeset->parse_info; - - Xfree(parse_info->encoding); - parse_info->encoding = NULL; - - Xfree(codeset->parse_info); - codeset->parse_info = NULL; -} - -static void -destroy_CodeSetList( - XLCdGenericPart *gen) -{ - CodeSet *codeset = gen->codeset_list; - int i; - if (gen->codeset_num == 0) { - return; - } - for (i=0;icodeset_num;i++) { - freeByteM(codeset[i]); - freeConversion(codeset[i]); - freeExtdSegment(codeset[i]); - freeParseInfo(codeset[i]); - - Xfree(codeset[i]->charset_list); - codeset[i]->charset_list = NULL; - - Xfree(codeset[i]); codeset[i]=NULL; - } - Xfree(codeset); gen->codeset_list = NULL; -} - -static void -destroy_SegConv( - XLCdGenericPart *gen) -{ - SegConv seg = gen->segment_conv; - int i; - - if (gen->segment_conv_num == 0) { - return; - } - for (i=0;isegment_conv_num;i++) { - - Xfree(seg[i].source_encoding); - seg[i].source_encoding = NULL; - - Xfree(seg[i].destination_encoding); - seg[i].destination_encoding = NULL; - - Xfree(seg[i].conv); - seg[i].conv = NULL; - } - Xfree(seg); gen->segment_conv = NULL; -} - -static void -destroy_gen( - XLCd lcd) -{ - XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); - destroy_SegConv(gen); - destroy_CodeSetList(gen); - - Xfree(gen->mb_parse_table); - gen->mb_parse_table = NULL; - - Xfree(gen->mb_parse_list); - gen->mb_parse_list = NULL; - -} -/* VW/UDC end 95.01.08 */ - -static void -destroy( - XLCd lcd) -{ - XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass; - - destroy_gen(lcd); /* ADD 1996.01.08 */ - if (superclass && superclass->pub.destroy) - (*superclass->pub.destroy)(lcd); -} diff --git a/nx-X11/lib/X11/lcInit.c b/nx-X11/lib/X11/lcInit.c deleted file mode 100644 index e3092f77d..000000000 --- a/nx-X11/lib/X11/lcInit.c +++ /dev/null @@ -1,168 +0,0 @@ -/* -Copyright 1985, 1986, 1987, 1991, 1998 The Open Group - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the -"Software"), to deal in the Software without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Software, and to -permit persons to whom the Software is furnished to do so, subject to -the following conditions: The above copyright notice and this -permission notice shall be included in all copies or substantial -portions of the Software. - - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE -EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES. - - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -X Window System is a trademark of The Open Group - -OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF -logo, LBX, X Window System, and Xinerama are trademarks of the Open -Group. All other trademarks and registered trademarks mentioned herein -are the property of their respective owners. No right, title or -interest in or to any trademark, service mark, logo or trade name of -Sun Microsystems, Inc. or its licensors is granted. - -*/ -/* - * Copyright 2000 Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * (c) Copyright 1995 FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Masayoshi Shimamura FUJITSU LIMITED - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -#ifdef USE_DYNAMIC_LC -#undef USE_DEFAULT_LOADER -#undef USE_GENERIC_LOADER -#undef USE_UTF8_LOADER -#else -#define USE_GENERIC_LOADER -#define USE_DEFAULT_LOADER -#define USE_UTF8_LOADER -#endif - -/* - * The _XlcInitLoader function initializes the locale object loader list - * with vendor specific manner. - */ - -void -_XlcInitLoader(void) -{ - -#ifdef USE_DYNAMIC_LC - _XlcAddLoader(_XlcDynamicLoad, XlcHead); -#else /* USE_DYNAMIC_LC */ - -#ifdef USE_GENERIC_LOADER - _XlcAddLoader(_XlcGenericLoader, XlcHead); -#endif - -#ifdef USE_DEFAULT_LOADER - _XlcAddLoader(_XlcDefaultLoader, XlcHead); -#endif - -#ifdef USE_UTF8_LOADER - _XlcAddLoader(_XlcUtf8Loader, XlcHead); -#endif - -#ifdef USE_DYNAMIC_LOADER - _XlcAddLoader(_XlcDynamicLoader, XlcHead); -#endif - -#endif /* USE_DYNAMIC_LC */ -} - -void -_XlcDeInitLoader(void) -{ - -#ifdef USE_DYNAMIC_LC - _XlcRemoveLoader(_XlcDynamicLoad); -#else /* USE_DYNAMIC_LC */ - -#ifdef USE_GENERIC_LOADER - _XlcRemoveLoader(_XlcGenericLoader); -#endif - -#ifdef USE_DEFAULT_LOADER - _XlcRemoveLoader(_XlcDefaultLoader); -#endif - -#ifdef USE_UTF8_LOADER - _XlcRemoveLoader(_XlcUtf8Loader); -#endif - -#ifdef USE_DYNAMIC_LOADER - _XlcRemoveLoader(_XlcDynamicLoader); -#endif - -#endif /* USE_DYNAMIC_LC */ -} diff --git a/nx-X11/lib/X11/lcPrTxt.c b/nx-X11/lib/X11/lcPrTxt.c deleted file mode 100644 index e62e94e80..000000000 --- a/nx-X11/lib/X11/lcPrTxt.c +++ /dev/null @@ -1,289 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" -#include -#include - -static XPointer * -alloc_list( - Bool is_wide_char, - int count, - int nitems) -{ - if (is_wide_char) { - wchar_t **wstr_list; - - wstr_list = Xmalloc(count * sizeof(wchar_t *)); - if (wstr_list == NULL) - return (XPointer *) NULL; - - *wstr_list = Xmalloc(nitems * sizeof(wchar_t)); - if (*wstr_list == NULL) { - Xfree(wstr_list); - return (XPointer *) NULL; - } - - return (XPointer *) wstr_list; - } else { - char **str_list; - - str_list = Xmalloc(count * sizeof(char *)); - if (str_list == NULL) - return (XPointer *) NULL; - - *str_list = Xmalloc(nitems); - if (*str_list == NULL) { - Xfree(str_list); - return (XPointer *) NULL; - } - - return (XPointer *) str_list; - } -} - -static void -copy_list( - Bool is_wide_char, - XPointer text, - XPointer *list, - int count) -{ - int length; - - if (is_wide_char) { - wchar_t *wc_text, *wstr, **wstr_list; - - wc_text = (wchar_t *) text; - wstr_list = (wchar_t **) list; - - for (wstr = *wstr_list; count > 0; count--, wstr_list++) { - _Xwcscpy(wstr, wc_text); - *wstr_list = wstr; - length = _Xwcslen(wstr) + 1; - wstr += length; - wc_text += length; - } - } else { - char *mb_text, *str, **str_list; - - mb_text = (char *) text; - str_list = (char **) list; - - for (str = *str_list; count > 0; count--, str_list++) { - strcpy(str, mb_text); - *str_list = str; - length = strlen(str) + 1; - str += length; - mb_text += length; - } - } -} - -static int -_XTextPropertyToTextList( - XLCd lcd, - Display *dpy, - const XTextProperty *text_prop, - const char *to_type, - XPointer **list_ret, - int *count_ret) -{ - XlcConv conv = NULL; - const char *from_type; - XPointer from, to, buf; - char *str_ptr, *last_ptr; - Atom encoding; - int from_left, to_left, buf_len, ret, len; - int unconv_num, nitems = text_prop->nitems; - Bool is_wide_char = False, do_strcpy = False; - - if (strcmp(XlcNWideChar, to_type) == 0) - is_wide_char = True; - - if (nitems <= 0) { - *list_ret = NULL; - *count_ret = 0; - return Success; - } - - if (text_prop->format != 8) - return XConverterNotFound; - - encoding = text_prop->encoding; - if (encoding == XA_STRING) - from_type = XlcNString; - else if (encoding == XInternAtom(dpy, "UTF8_STRING", False)) - from_type = XlcNUtf8String; - else if (encoding == XInternAtom(dpy, "COMPOUND_TEXT", False)) - from_type = XlcNCompoundText; - else if (encoding == XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False)) - from_type = XlcNMultiByte; - else - return XConverterNotFound; - - if (is_wide_char) { - buf_len = (text_prop->nitems + 1) * sizeof(wchar_t); - } else { - if (strcmp(to_type, XlcNUtf8String) == 0) - buf_len = text_prop->nitems * 6 + 1; - else - buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1; - } - buf = Xmalloc(buf_len); - if (buf == NULL) - return XNoMemory; - to = buf; - to_left = buf_len; - - /* can be XlcNMultiByte to XlcNMultiByte, - or XlcNUtf8String to XlcNUtf8String */ - if (!strcmp(from_type, to_type)) { - do_strcpy = True; - } else { - conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); - if (conv == NULL) { - Xfree(buf); - return XConverterNotFound; - } - } - - last_ptr = str_ptr = (char *) text_prop->value; - unconv_num = *count_ret = 0; - - while (1) { - if (nitems == 0 || *str_ptr == 0) { - from = (XPointer) last_ptr; - from_left = str_ptr - last_ptr; - last_ptr = str_ptr; - - if (do_strcpy) { - len = min(from_left, to_left); - strncpy(to, from, len); - from += len; - to += len; - from_left -= len; - to_left -= len; - ret = 0; - } else { - ret = _XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0); - } - - if (ret < 0) - continue; - - unconv_num += ret; - (*count_ret)++; - - if (nitems == 0) - break; - last_ptr = ++str_ptr; - if (is_wide_char) { - *((wchar_t *)to) = (wchar_t) 0; - to += sizeof(wchar_t); - to_left -= sizeof(wchar_t); - } else { - *((char *)to) = '\0'; - to++; - to_left--; - } - if (! do_strcpy) - _XlcResetConverter(conv); - } else - str_ptr++; - - nitems--; - } - - if (! do_strcpy) - _XlcCloseConverter(conv); - - if (is_wide_char) { - *((wchar_t *) to) = (wchar_t) 0; - to_left -= sizeof(wchar_t); - } else { - *((char *) to) = '\0'; - to_left--; - } - - *list_ret = alloc_list(is_wide_char, *count_ret, buf_len - to_left); - if (*list_ret) - copy_list(is_wide_char, buf, *list_ret, *count_ret); - - Xfree(buf); - - return unconv_num; -} - -int -_XmbTextPropertyToTextList( - XLCd lcd, - Display *dpy, - const XTextProperty *text_prop, - char ***list_ret, - int *count_ret) -{ - return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte, - (XPointer **) list_ret, count_ret); -} - -int -_XwcTextPropertyToTextList( - XLCd lcd, - Display *dpy, - const XTextProperty *text_prop, - wchar_t ***list_ret, - int *count_ret) -{ - return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar, - (XPointer **) list_ret, count_ret); -} - -int -_Xutf8TextPropertyToTextList( - XLCd lcd, - Display *dpy, - const XTextProperty *text_prop, - char ***list_ret, - int *count_ret) -{ - return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNUtf8String, - (XPointer **) list_ret, count_ret); -} - -void -_XwcFreeStringList( - XLCd lcd, - wchar_t **list) -{ - if (list) { - Xfree(*list); - Xfree(list); - } -} diff --git a/nx-X11/lib/X11/lcPubWrap.c b/nx-X11/lib/X11/lcPubWrap.c deleted file mode 100644 index 3119918c6..000000000 --- a/nx-X11/lib/X11/lcPubWrap.c +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" - -char * -_XGetLCValues(XLCd lcd, ...) -{ - va_list var; - XlcArgList args; - char *ret; - int num_args; - XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); - - va_start(var, lcd); - _XlcCountVaList(var, &num_args); - va_end(var); - - va_start(var, lcd); - _XlcVaToArgList(var, num_args, &args); - va_end(var); - - if (args == (XlcArgList) NULL) - return (char *) NULL; - - ret = (*methods->get_values)(lcd, args, num_args); - - Xfree(args); - - return ret; -} - -void -_XlcDestroyLC( - XLCd lcd) -{ - XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods; - - (*methods->pub.destroy)(lcd); -} - -XLCd -_XlcCreateLC( - const char *name, - XLCdMethods methods) -{ - XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods; - XLCd lcd; - - lcd = (*pub_methods->pub.create)(name, methods); - if (lcd == NULL) - return (XLCd) NULL; - - if (lcd->core->name == NULL) { - lcd->core->name = strdup(name); - if (lcd->core->name == NULL) - goto err; - } - - if (lcd->methods == NULL) - lcd->methods = methods; - - if ((*pub_methods->pub.initialize)(lcd) == False) - goto err; - - return lcd; - -err: - _XlcDestroyLC(lcd); - - return (XLCd) NULL; -} diff --git a/nx-X11/lib/X11/lcPublic.c b/nx-X11/lib/X11/lcPublic.c deleted file mode 100644 index 98a7435fd..000000000 --- a/nx-X11/lib/X11/lcPublic.c +++ /dev/null @@ -1,311 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "XlcPubI.h" - -static const char * -default_string( - XLCd lcd) -{ - return XLC_PUBLIC(lcd, default_string); -} - -static XLCd create (const char *name, XLCdMethods methods); -static Bool initialize (XLCd lcd); -static void destroy (XLCd lcd); -static char *get_values (XLCd lcd, XlcArgList args, int num_args); - -static XLCdPublicMethodsRec publicMethods = { - { - destroy, - _XlcDefaultMapModifiers, - NULL, - NULL, - _XrmDefaultInitParseInfo, - _XmbTextPropertyToTextList, - _XwcTextPropertyToTextList, - _Xutf8TextPropertyToTextList, - _XmbTextListToTextProperty, - _XwcTextListToTextProperty, - _Xutf8TextListToTextProperty, - _XwcFreeStringList, - default_string, - NULL, - NULL - }, - { - NULL, - create, - initialize, - destroy, - get_values, - _XlcGetLocaleDataBase - } -}; - -XLCdMethods _XlcPublicMethods = (XLCdMethods) &publicMethods; - -static XLCd -create( - const char *name, - XLCdMethods methods) -{ - XLCd lcd; - XLCdPublicMethods new; - - lcd = Xcalloc(1, sizeof(XLCdRec)); - if (lcd == NULL) - return (XLCd) NULL; - - lcd->core = Xcalloc(1, sizeof(XLCdPublicRec)); - if (lcd->core == NULL) - goto err; - - new = Xmalloc(sizeof(XLCdPublicMethodsRec)); - if (new == NULL) - goto err; - memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); - lcd->methods = (XLCdMethods) new; - - return lcd; - -err: - Xfree(lcd); - return (XLCd) NULL; -} - -static Bool -load_public( - XLCd lcd) -{ - XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); - char **values; - const char *str; - int num; - - if(_XlcCreateLocaleDataBase(lcd) == NULL) - return False; - - _XlcGetResource(lcd, "XLC_XLOCALE", "mb_cur_max", &values, &num); - if (num > 0) { - pub->mb_cur_max = atoi(values[0]); - if (pub->mb_cur_max < 1) - pub->mb_cur_max = 1; - } else - pub->mb_cur_max = 1; - - _XlcGetResource(lcd, "XLC_XLOCALE", "state_depend_encoding", &values, &num); - if (num > 0 && !_XlcCompareISOLatin1(values[0], "True")) - pub->is_state_depend = True; - else - pub->is_state_depend = False; - - _XlcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num); - str = (num > 0) ? values[0] : "STRING"; - pub->encoding_name = strdup(str); - if (pub->encoding_name == NULL) - return False; - - return True; -} - -static Bool -initialize_core( - XLCd lcd) -{ - XLCdMethods methods = lcd->methods; - XLCdMethods core = &publicMethods.core; - - if (methods->close == NULL) - methods->close = core->close; - - if (methods->map_modifiers == NULL) - methods->map_modifiers = core->map_modifiers; - - if (methods->open_om == NULL) -#ifdef USE_DYNAMIC_LC - _XInitDefaultOM(lcd); -#else - _XInitOM(lcd); -#endif - - if (methods->open_im == NULL) -#ifdef USE_DYNAMIC_LC - _XInitDefaultIM(lcd); -#else - _XInitIM(lcd); -#endif - - if (methods->init_parse_info == NULL) - methods->init_parse_info = core->init_parse_info; - - if (methods->mb_text_prop_to_list == NULL) - methods->mb_text_prop_to_list = core->mb_text_prop_to_list; - - if (methods->wc_text_prop_to_list == NULL) - methods->wc_text_prop_to_list = core->wc_text_prop_to_list; - - if (methods->utf8_text_prop_to_list == NULL) - methods->utf8_text_prop_to_list = core->utf8_text_prop_to_list; - - if (methods->mb_text_list_to_prop == NULL) - methods->mb_text_list_to_prop = core->mb_text_list_to_prop; - - if (methods->wc_text_list_to_prop == NULL) - methods->wc_text_list_to_prop = core->wc_text_list_to_prop; - - if (methods->utf8_text_list_to_prop == NULL) - methods->utf8_text_list_to_prop = core->utf8_text_list_to_prop; - - if (methods->wc_free_string_list == NULL) - methods->wc_free_string_list = core->wc_free_string_list; - - if (methods->default_string == NULL) - methods->default_string = core->default_string; - - return True; -} - -static Bool -initialize( - XLCd lcd) -{ - XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); - XLCdPublicMethodsPart *pub_methods = &publicMethods.pub; - XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); - char *name; -#if !defined(X_LOCALE) - int len; - char sinamebuf[256]; - char* siname; -#endif - - _XlcInitCTInfo(); - - if (initialize_core(lcd) == False) - return False; - - name = lcd->core->name; -#if !defined(X_LOCALE) - /* - * _XlMapOSLocaleName will return the same string or a substring - * of name, so strlen(name) is okay - */ - if ((len = strlen(name)) < sizeof sinamebuf) - siname = sinamebuf; - else - siname = Xmalloc (len + 1); - if (siname == NULL) - return False; - name = _XlcMapOSLocaleName(name, siname); -#endif - /* _XlcResolveLocaleName will lookup the SI's name for the locale */ - if (_XlcResolveLocaleName(name, pub) == 0) { -#if !defined(X_LOCALE) - if (siname != sinamebuf) Xfree (siname); -#endif - return False; - } -#if !defined(X_LOCALE) - if (siname != sinamebuf) - Xfree (siname); -#endif - - if (pub->default_string == NULL) - pub->default_string = ""; - - if (methods->get_values == NULL) - methods->get_values = pub_methods->get_values; - - if (methods->get_resource == NULL) - methods->get_resource = pub_methods->get_resource; - - return load_public(lcd); -} - -static void -destroy_core( - XLCd lcd) -{ - if (lcd) { - if (lcd->core) { - Xfree(lcd->core->name); - Xfree(lcd->core); - } - Xfree(lcd->methods); - Xfree(lcd); - } -} - -static void -destroy( - XLCd lcd) -{ - XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); - - _XlcDestroyLocaleDataBase(lcd); - - Xfree(pub->siname); - Xfree(pub->encoding_name); - - destroy_core(lcd); -} - -static XlcResource resources[] = { - { XlcNCodeset, NULLQUARK, sizeof(char *), - XOffsetOf(XLCdPublicRec, pub.codeset), XlcGetMask }, - { XlcNDefaultString, NULLQUARK, sizeof(char *), - XOffsetOf(XLCdPublicRec, pub.default_string), XlcGetMask }, - { XlcNEncodingName, NULLQUARK, sizeof(char *), - XOffsetOf(XLCdPublicRec, pub.encoding_name), XlcGetMask }, - { XlcNLanguage, NULLQUARK, sizeof(char *), - XOffsetOf(XLCdPublicRec, pub.language), XlcGetMask }, - { XlcNMbCurMax, NULLQUARK, sizeof(int), - XOffsetOf(XLCdPublicRec, pub.mb_cur_max), XlcGetMask }, - { XlcNStateDependentEncoding, NULLQUARK, sizeof(Bool), - XOffsetOf(XLCdPublicRec, pub.is_state_depend), XlcGetMask }, - { XlcNTerritory, NULLQUARK, sizeof(char *), - XOffsetOf(XLCdPublicRec, pub.territory), XlcGetMask } -}; - -static char * -get_values( - XLCd lcd, - XlcArgList args, - int num_args) -{ - XLCdPublic pub = (XLCdPublic) lcd->core; - - if (resources[0].xrm_name == NULLQUARK) - _XlcCompileResourceList(resources, XlcNumber(resources)); - - return _XlcGetValues((XPointer) pub, resources, XlcNumber(resources), args, - num_args, XlcGetMask); -} diff --git a/nx-X11/lib/X11/lcRM.c b/nx-X11/lib/X11/lcRM.c deleted file mode 100644 index bdc20f21d..000000000 --- a/nx-X11/lib/X11/lcRM.c +++ /dev/null @@ -1,224 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - * Bug fixes: Bruno Haible XFree86 Inc. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" -#include - -/* - * Default implementation of methods for Xrm parsing. - */ - -/* ======================= Unibyte implementation ======================= */ - -/* Only for efficiency, to speed up things. */ - -/* This implementation must keep the locale, for lcname. */ -typedef struct _UbStateRec { - XLCd lcd; -} UbStateRec, *UbState; - -/* Sets the state to the initial state. - Initiates a sequence of calls to mbchar. */ -static void -ub_mbinit( - XPointer state) -{ -} - -/* Transforms one multibyte character, and return a 'char' in the same - parsing class. Returns the number of consumed bytes in *lenp. */ -static char -ub_mbchar( - XPointer state, - const char *str, - int *lenp) -{ - *lenp = 1; - return *str; -} - -/* Terminates a sequence of calls to mbchar. */ -static void -ub_mbfinish( - XPointer state) -{ -} - -/* Returns the name of the state's locale, as a static string. */ -static const char * -ub_lcname( - XPointer state) -{ - return ((UbState) state)->lcd->core->name; -} - -/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ -static void -ub_destroy( - XPointer state) -{ - _XCloseLC(((UbState) state)->lcd); - Xfree(state); -} - -static const XrmMethodsRec ub_methods = { - ub_mbinit, - ub_mbchar, - ub_mbfinish, - ub_lcname, - ub_destroy -}; - -/* ======================= Multibyte implementation ======================= */ - -/* This implementation uses an XlcConv from XlcNMultiByte to XlcNWideChar. */ -typedef struct _MbStateRec { - XLCd lcd; - XlcConv conv; -} MbStateRec, *MbState; - -/* Sets the state to the initial state. - Initiates a sequence of calls to mbchar. */ -static void -mb_mbinit( - XPointer state) -{ - _XlcResetConverter(((MbState) state)->conv); -} - -/* Transforms one multibyte character, and return a 'char' in the same - parsing class. Returns the number of consumed bytes in *lenp. */ -static char -mb_mbchar( - XPointer state, - const char *str, - int *lenp) -{ - XlcConv conv = ((MbState) state)->conv; - const char *from; - wchar_t *to, wc; - int cur_max, i, from_left, to_left, ret; - - cur_max = XLC_PUBLIC(((MbState) state)->lcd, mb_cur_max); - - from = str; - /* Determine from_left. Avoid overrun error which could occur if - from_left > strlen(str). */ - from_left = cur_max; - for (i = 0; i < cur_max; i++) - if (str[i] == '\0') { - from_left = i; - break; - } - *lenp = from_left; - - to = &wc; - to_left = 1; - - ret = _XlcConvert(conv, (XPointer *) &from, &from_left, - (XPointer *) &to, &to_left, NULL, 0); - *lenp -= from_left; - - if (ret < 0 || to_left > 0) { - /* Invalid or incomplete multibyte character seen. */ - *lenp = 1; - return 0x7f; - } - /* Return a 'char' equivalent to wc. */ - return (wc >= 0 && wc <= 0x7f ? wc : 0x7f); -} - -/* Terminates a sequence of calls to mbchar. */ -static void -mb_mbfinish( - XPointer state) -{ -} - -/* Returns the name of the state's locale, as a static string. */ -static const char * -mb_lcname( - XPointer state) -{ - return ((MbState) state)->lcd->core->name; -} - -/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ -static void -mb_destroy( - XPointer state) -{ - _XlcCloseConverter(((MbState) state)->conv); - _XCloseLC(((MbState) state)->lcd); - Xfree(state); -} - -static const XrmMethodsRec mb_methods = { - mb_mbinit, - mb_mbchar, - mb_mbfinish, - mb_lcname, - mb_destroy -}; - -/* ======================= Exported function ======================= */ - -XrmMethods -_XrmDefaultInitParseInfo( - XLCd lcd, - XPointer *rm_state) -{ - if (XLC_PUBLIC(lcd, mb_cur_max) == 1) { - /* Unibyte case. */ - UbState state = Xmalloc(sizeof(UbStateRec)); - if (state == NULL) - return (XrmMethods) NULL; - - state->lcd = lcd; - - *rm_state = (XPointer) state; - return &ub_methods; - } else { - /* Multibyte case. */ - MbState state = Xmalloc(sizeof(MbStateRec)); - if (state == NULL) - return (XrmMethods) NULL; - - state->lcd = lcd; - state->conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); - if (state->conv == NULL) { - Xfree(state); - return (XrmMethods) NULL; - } - - *rm_state = (XPointer) state; - return &mb_methods; - } -} diff --git a/nx-X11/lib/X11/lcStd.c b/nx-X11/lib/X11/lcStd.c deleted file mode 100644 index 9d452bcae..000000000 --- a/nx-X11/lib/X11/lcStd.c +++ /dev/null @@ -1,358 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" - -int -_Xlcmbtowc( - XLCd lcd, - wchar_t *wstr, - char *str, - int len) -{ - static XLCd last_lcd = NULL; - static XlcConv conv = NULL; - XPointer from, to; - int from_left, to_left; - wchar_t tmp_wc; - - if (lcd == NULL) { - lcd = _XlcCurrentLC(); - if (lcd == NULL) - return -1; - } - if (str == NULL) - return XLC_PUBLIC(lcd, is_state_depend); - - if (conv && lcd != last_lcd) { - _XlcCloseConverter(conv); - conv = NULL; - } - - last_lcd = lcd; - - if (conv == NULL) { - conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); - if (conv == NULL) - return -1; - } - - from = (XPointer) str; - from_left = len; - to = (XPointer) (wstr ? wstr : &tmp_wc); - to_left = 1; - - if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) - return -1; - - return (len - from_left); -} - -int -_Xlcwctomb( - XLCd lcd, - char *str, - wchar_t wc) -{ - static XLCd last_lcd = NULL; - static XlcConv conv = NULL; - XPointer from, to; - int from_left, to_left, length; - - if (lcd == NULL) { - lcd = _XlcCurrentLC(); - if (lcd == NULL) - return -1; - } - if (str == NULL) - return XLC_PUBLIC(lcd, is_state_depend); - - if (conv && lcd != last_lcd) { - _XlcCloseConverter(conv); - conv = NULL; - } - - last_lcd = lcd; - - if (conv == NULL) { - conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); - if (conv == NULL) - return -1; - } - - from = (XPointer) &wc; - from_left = 1; - to = (XPointer) str; - length = to_left = XLC_PUBLIC(lcd, mb_cur_max); - - if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) - return -1; - - return (length - to_left); -} - -int -_Xlcmbstowcs( - XLCd lcd, - wchar_t *wstr, - char *str, - int len) -{ - XlcConv conv; - XPointer from, to; - int from_left, to_left, ret; - - if (lcd == NULL) { - lcd = _XlcCurrentLC(); - if (lcd == NULL) - return -1; - } - - conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); - if (conv == NULL) - return -1; - - from = (XPointer) str; - from_left = strlen(str); - to = (XPointer) wstr; - to_left = len; - - if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) - ret = -1; - else { - ret = len - to_left; - if (wstr && to_left > 0) - wstr[ret] = (wchar_t) 0; - } - - _XlcCloseConverter(conv); - - return ret; -} - -int -_Xlcwcstombs( - XLCd lcd, - char *str, - wchar_t *wstr, - int len) -{ - XlcConv conv; - XPointer from, to; - int from_left, to_left, ret; - - if (lcd == NULL) { - lcd = _XlcCurrentLC(); - if (lcd == NULL) - return -1; - } - - conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); - if (conv == NULL) - return -1; - - from = (XPointer) wstr; - from_left = _Xwcslen(wstr); - to = (XPointer) str; - to_left = len; - - if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) - ret = -1; - else { - ret = len - to_left; - if (str && to_left > 0) - str[ret] = '\0'; - } - - _XlcCloseConverter(conv); - - return ret; -} - - -int -_Xmbtowc( - wchar_t *wstr, - char *str, - int len - ) -{ - return _Xlcmbtowc((XLCd) NULL, wstr, str, len); -} - -int -_Xmblen( - char *str, - int len - ) -{ - return _Xmbtowc((wchar_t *) NULL, str, len); -} - -int -_Xwctomb( - char *str, - wchar_t wc) -{ - return _Xlcwctomb((XLCd) NULL, str, wc); -} - -int -_Xmbstowcs( - wchar_t *wstr, - char *str, - int len) -{ - return _Xlcmbstowcs((XLCd) NULL, wstr, str, len); -} - -int -_Xwcstombs( - char *str, - wchar_t *wstr, - int len) -{ - return _Xlcwcstombs((XLCd) NULL, str, wstr, len); -} - -wchar_t * -_Xwcscpy( - register wchar_t *wstr1, register wchar_t *wstr2) -{ - wchar_t *wstr_tmp = wstr1; - - while ((*wstr1++ = *wstr2++)) - ; - - return wstr_tmp; -} - -wchar_t * -_Xwcsncpy( - register wchar_t *wstr1, register wchar_t *wstr2, - register int len) -{ - wchar_t *wstr_tmp = wstr1; - - while (len-- > 0) - if (!(*wstr1++ = *wstr2++)) - break; - - while (len-- > 0) - *wstr1++ = (wchar_t) 0; - - return wstr_tmp; -} - -int -_Xwcslen( - register wchar_t *wstr) -{ - register wchar_t *wstr_ptr = wstr; - - while (*wstr_ptr) - wstr_ptr++; - - return wstr_ptr - wstr; -} - -int -_Xwcscmp( - register wchar_t *wstr1, register wchar_t *wstr2) -{ - for ( ; *wstr1 && *wstr2; wstr1++, wstr2++) - if (*wstr1 != *wstr2) - break; - - return *wstr1 - *wstr2; -} - -int -_Xwcsncmp( - register wchar_t *wstr1, register wchar_t *wstr2, - register int len) -{ - for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--) - if (*wstr1 != *wstr2) - break; - - if (len <= 0) - return 0; - - return *wstr1 - *wstr2; -} - - -int -_Xlcmbstoutf8( - XLCd lcd, - char *ustr, - const char *str, - int len) -{ - XlcConv conv; - XPointer from, to; - int from_left, to_left, ret; - - if (lcd == NULL) { - lcd = _XlcCurrentLC(); - if (lcd == NULL) - return -1; - } - - conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String); - if (conv == NULL) - return -1; - - from = (XPointer) str; - from_left = strlen(str); - to = (XPointer) ustr; - to_left = len; - - if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) - ret = -1; - else { - ret = len - to_left; - if (ustr && to_left > 0) - ustr[ret] = '\0'; - } - - _XlcCloseConverter(conv); - - return ret; -} - -int -_Xmbstoutf8( - char *ustr, - const char *str, - int len) -{ - return _Xlcmbstoutf8((XLCd) NULL, ustr, str, len); -} diff --git a/nx-X11/lib/X11/lcTxtPr.c b/nx-X11/lib/X11/lcTxtPr.c deleted file mode 100644 index cf25e3d0e..000000000 --- a/nx-X11/lib/X11/lcTxtPr.c +++ /dev/null @@ -1,254 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPubI.h" -#include -#include -#include - -static int -get_buf_size( - Bool is_wide_char, - XPointer list, - int count) -{ - int length = 0; - char **mb_list; - wchar_t **wc_list; - - if (list == NULL) - return 0; - - if (is_wide_char) { - wc_list = (wchar_t **) list; - for ( ; count-- > 0; wc_list++) { - if (*wc_list) - length += _Xwcslen(*wc_list) + 1; - } - length *= 5; /* XXX */ - } else { - mb_list = (char **) list; - for ( ; count-- > 0; mb_list++) { - if (*mb_list) - length += strlen(*mb_list) + 1; - } - length *= 3; /* XXX */ - } - length = (length / BUFSIZ + 1) * BUFSIZ; /* XXX */ - - return length; -} - -static int -_XTextListToTextProperty( - XLCd lcd, - Display *dpy, - const char *from_type, - XPointer list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - Atom encoding; - XlcConv conv; - const char *to_type; - char **mb_list = NULL; - wchar_t **wc_list = NULL; - XPointer from; - char *to, *buf, *value; - int from_left, to_left, buf_len, nitems, unconv_num = 0, ret, i; - Bool is_wide_char = False; - - if (strcmp(XlcNWideChar, from_type) == 0) - is_wide_char = True; - - buf_len = get_buf_size(is_wide_char, list, count); - if ((buf = Xmalloc(buf_len)) == NULL) - return XNoMemory; - - switch (style) { - case XStringStyle: - case XStdICCTextStyle: - encoding = XA_STRING; - to_type = XlcNString; - break; - case XUTF8StringStyle: - encoding = XInternAtom(dpy, "UTF8_STRING", False); - to_type = XlcNUtf8String; - break; - case XCompoundTextStyle: - encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); - to_type = XlcNCompoundText; - break; - case XTextStyle: - encoding = XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False); - to_type = XlcNMultiByte; - if (is_wide_char == False) { - nitems = 0; - mb_list = (char **) list; - to = buf; - for (i = 0; i < count && buf_len > 0; i++) { - if (*mb_list) - strcpy(to, *mb_list); - else - *to = '\0'; - from_left = (*mb_list ? strlen(*mb_list) : 0) + 1; - nitems += from_left; - to += from_left; - mb_list++; - } - unconv_num = 0; - goto done; - } - break; - default: - Xfree(buf); - return XConverterNotFound; - } - - if (count < 1) { - nitems = 0; - goto done; - } - -retry: - conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); - if (conv == NULL) { - Xfree(buf); - return XConverterNotFound; - } - - if (is_wide_char) - wc_list = (wchar_t **) list; - else - mb_list = (char **) list; - - to = buf; - to_left = buf_len; - - unconv_num = 0; - - for (i = 1; to_left > 0; i++) { - if (is_wide_char) { - from = (XPointer) *wc_list; - from_left = _Xwcslen(*wc_list); - wc_list++; - } else { - from = (XPointer) *mb_list; - from_left = (*mb_list ? strlen(*mb_list) : 0); - mb_list++; - } - - ret = _XlcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left, - NULL, 0); - - if (ret < 0) - continue; - - if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) { - _XlcCloseConverter(conv); - encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); - to_type = XlcNCompoundText; - goto retry; - } - - unconv_num += ret; - *to++ = '\0'; - to_left--; - - if (i >= count) - break; - - _XlcResetConverter(conv); - } - - _XlcCloseConverter(conv); - - nitems = to - buf; -done: - if (nitems <= 0) - nitems = 1; - value = Xmalloc(nitems); - if (value == NULL) { - Xfree(buf); - return XNoMemory; - } - if (nitems == 1) - *value = 0; - else - memcpy(value, buf, nitems); - nitems--; - Xfree(buf); - - text_prop->value = (unsigned char *) value; - text_prop->encoding = encoding; - text_prop->format = 8; - text_prop->nitems = nitems; - - return unconv_num; -} - -int -_XmbTextListToTextProperty( - XLCd lcd, - Display *dpy, - char **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list, - count, style, text_prop); -} - -int -_XwcTextListToTextProperty( - XLCd lcd, - Display *dpy, - wchar_t **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list, - count, style, text_prop); -} - -int -_Xutf8TextListToTextProperty( - XLCd lcd, - Display *dpy, - char **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - return _XTextListToTextProperty(lcd, dpy, XlcNUtf8String, (XPointer) list, - count, style, text_prop); -} diff --git a/nx-X11/lib/X11/lcUTF8.c b/nx-X11/lib/X11/lcUTF8.c deleted file mode 100644 index 5899338f1..000000000 --- a/nx-X11/lib/X11/lcUTF8.c +++ /dev/null @@ -1,2389 +0,0 @@ -/****************************************************************** - - Copyright 1993 by SunSoft, Inc. - Copyright 1999-2000 by Bruno Haible - -Permission to use, copy, modify, distribute, and sell this software -and its 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 names of SunSoft, Inc. and -Bruno Haible not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. SunSoft, Inc. and Bruno Haible make no representations -about the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible 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. - -******************************************************************/ - -/* - * This file contains: - * - * I. Conversion routines CompoundText/CharSet <--> Unicode/UTF-8. - * - * Used for three purposes: - * 1. The UTF-8 locales, see below. - * 2. Unicode aware applications for which the use of 8-bit character - * sets is an anachronism. - * 3. For conversion from keysym to locale encoding. - * - * II. Conversion files for an UTF-8 locale loader. - * Supports: all locales with codeset UTF-8. - * How: Provides converters for UTF-8. - * Platforms: all systems. - * - * The loader itself is located in lcUTF8.c. - */ - -/* - * The conversion from UTF-8 to CompoundText is realized in a very - * conservative way. Recall that CompoundText data is used for inter-client - * communication purposes. We distinguish three classes of clients: - * - Clients which accept only those pieces of CompoundText which belong to - * the character set understood by the current locale. - * (Example: clients which are linked to an older X11 library.) - * - Clients which accept CompoundText with multiple character sets and parse - * it themselves. - * (Example: emacs, xemacs.) - * - Clients which rely entirely on the X{mb,wc}TextPropertyToTextList - * functions for the conversion of CompoundText to their current locale's - * multi-byte/wide-character format. - * For best interoperation, the UTF-8 to CompoundText conversion proceeds as - * follows. For every character, it first tests whether the character is - * representable in the current locale's original (non-UTF-8) character set. - * If not, it goes through the list of predefined character sets for - * CompoundText and tests if the character is representable in that character - * set. If so, it encodes the character using its code within that character - * set. If not, it uses an UTF-8-in-CompoundText encapsulation. Since - * clients of the first and second kind ignore such encapsulated text, - * this encapsulation is kept to a minimum and terminated as early as possible. - * - * In a distant future, when clients of the first and second kind will have - * disappeared, we will be able to stuff UTF-8 data directly in CompoundText - * without first going through the list of predefined character sets. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "XlcPubI.h" -#include "XlcGeneric.h" - -static XlcConv -create_conv( - XLCd lcd, - XlcConvMethods methods) -{ - XlcConv conv; - - conv = Xmalloc(sizeof(XlcConvRec)); - if (conv == (XlcConv) NULL) - return (XlcConv) NULL; - - conv->methods = methods; - conv->state = NULL; - - return conv; -} - -static void -close_converter( - XlcConv conv) -{ - Xfree(conv); -} - -/* Replacement character for invalid multibyte sequence or wide character. */ -#define BAD_WCHAR ((ucs4_t) 0xfffd) -#define BAD_CHAR '?' - -/***************************************************************************/ -/* Part I: Conversion routines CompoundText/CharSet <--> Unicode/UTF-8. - * - * Note that this code works in any locale. We store Unicode values in - * `ucs4_t' variables, but don't pass them to the user. - * - * This code has to support all character sets that are used for CompoundText, - * nothing more, nothing less. See the table in lcCT.c. - * Since the conversion _to_ CompoundText is likely to need the tables for all - * character sets at once, we don't use dynamic loading (of tables or shared - * libraries through iconv()). Use a fixed set of tables instead. - * - * We use statically computed tables, not dynamically allocated arrays, - * because it's more memory efficient: Different processes using the same - * libX11 shared library share the "text" and read-only "data" sections. - */ - -typedef unsigned int ucs4_t; -#define conv_t XlcConv - -typedef struct _Utf8ConvRec { - const char *name; - XrmQuark xrm_name; - int (* cstowc) (XlcConv, ucs4_t *, unsigned char const *, int); - int (* wctocs) (XlcConv, unsigned char *, ucs4_t, int); -} Utf8ConvRec, *Utf8Conv; - -/* - * int xxx_cstowc (XlcConv conv, ucs4_t *pwc, unsigned char const *s, int n) - * converts the byte sequence starting at s to a wide character. Up to n bytes - * are available at s. n is >= 1. - * Result is number of bytes consumed (if a wide character was read), - * or 0 if invalid, or -1 if n too small. - * - * int xxx_wctocs (XlcConv conv, unsigned char *r, ucs4_t wc, int n) - * converts the wide character wc to the character set xxx, and stores the - * result beginning at r. Up to n bytes may be written at r. n is >= 1. - * Result is number of bytes written, or 0 if invalid, or -1 if n too small. - */ - -/* Return code if invalid. (xxx_mbtowc, xxx_wctomb) */ -#define RET_ILSEQ 0 -/* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */ -#define RET_TOOFEW(n) (-1-(n)) -/* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */ -#define RET_TOOSMALL -1 - -/* - * The tables below are bijective. It would be possible to extend the - * xxx_wctocs tables to do some transliteration (e.g. U+201C,U+201D -> 0x22) - * but *only* with characters not contained in any other table, and *only* - * when the current locale is not an UTF-8 locale. - */ - -#include "lcUniConv/utf8.h" -#include "lcUniConv/ucs2be.h" -#include "lcUniConv/iso8859_1.h" -#include "lcUniConv/iso8859_2.h" -#include "lcUniConv/iso8859_3.h" -#include "lcUniConv/iso8859_4.h" -#include "lcUniConv/iso8859_5.h" -#include "lcUniConv/iso8859_6.h" -#include "lcUniConv/iso8859_7.h" -#include "lcUniConv/iso8859_8.h" -#include "lcUniConv/iso8859_9.h" -#include "lcUniConv/iso8859_10.h" -#include "lcUniConv/iso8859_11.h" -#include "lcUniConv/iso8859_13.h" -#include "lcUniConv/iso8859_14.h" -#include "lcUniConv/iso8859_15.h" -#include "lcUniConv/iso8859_16.h" -#include "lcUniConv/iso8859_9e.h" -#include "lcUniConv/jisx0201.h" -#include "lcUniConv/tis620.h" -#include "lcUniConv/koi8_r.h" -#include "lcUniConv/koi8_u.h" -#include "lcUniConv/koi8_c.h" -#include "lcUniConv/armscii_8.h" -#include "lcUniConv/cp1133.h" -#include "lcUniConv/mulelao.h" -#include "lcUniConv/viscii.h" -#include "lcUniConv/tcvn.h" -#include "lcUniConv/georgian_academy.h" -#include "lcUniConv/georgian_ps.h" -#include "lcUniConv/cp1251.h" -#include "lcUniConv/cp1255.h" -#include "lcUniConv/cp1256.h" -#include "lcUniConv/tatar_cyr.h" - -typedef struct { - unsigned short indx; /* index into big table */ - unsigned short used; /* bitmask of used entries */ -} Summary16; - -#include "lcUniConv/gb2312.h" -#include "lcUniConv/jisx0208.h" -#include "lcUniConv/jisx0212.h" -#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 - (for lookup speed), once at the end (as a fallback). */ - { "ISO10646-1", NULLQUARK, - utf8_mbtowc, utf8_wctomb - }, - - { "ISO8859-1", NULLQUARK, - iso8859_1_mbtowc, iso8859_1_wctomb - }, - { "ISO8859-2", NULLQUARK, - iso8859_2_mbtowc, iso8859_2_wctomb - }, - { "ISO8859-3", NULLQUARK, - iso8859_3_mbtowc, iso8859_3_wctomb - }, - { "ISO8859-4", NULLQUARK, - iso8859_4_mbtowc, iso8859_4_wctomb - }, - { "ISO8859-5", NULLQUARK, - iso8859_5_mbtowc, iso8859_5_wctomb - }, - { "ISO8859-6", NULLQUARK, - iso8859_6_mbtowc, iso8859_6_wctomb - }, - { "ISO8859-7", NULLQUARK, - iso8859_7_mbtowc, iso8859_7_wctomb - }, - { "ISO8859-8", NULLQUARK, - iso8859_8_mbtowc, iso8859_8_wctomb - }, - { "ISO8859-9", NULLQUARK, - iso8859_9_mbtowc, iso8859_9_wctomb - }, - { "ISO8859-10", NULLQUARK, - iso8859_10_mbtowc, iso8859_10_wctomb - }, - { "ISO8859-11", NULLQUARK, - iso8859_11_mbtowc, iso8859_11_wctomb - }, - { "ISO8859-13", NULLQUARK, - iso8859_13_mbtowc, iso8859_13_wctomb - }, - { "ISO8859-14", NULLQUARK, - iso8859_14_mbtowc, iso8859_14_wctomb - }, - { "ISO8859-15", NULLQUARK, - iso8859_15_mbtowc, iso8859_15_wctomb - }, - { "ISO8859-16", NULLQUARK, - iso8859_16_mbtowc, iso8859_16_wctomb - }, - { "JISX0201.1976-0", NULLQUARK, - jisx0201_mbtowc, jisx0201_wctomb - }, - { "TIS620-0", NULLQUARK, - tis620_mbtowc, tis620_wctomb - }, - { "GB2312.1980-0", NULLQUARK, - gb2312_mbtowc, gb2312_wctomb - }, - { "JISX0208.1983-0", NULLQUARK, - jisx0208_mbtowc, jisx0208_wctomb - }, - { "JISX0208.1990-0", NULLQUARK, - jisx0208_mbtowc, jisx0208_wctomb - }, - { "JISX0212.1990-0", NULLQUARK, - jisx0212_mbtowc, jisx0212_wctomb - }, - { "KSC5601.1987-0", NULLQUARK, - ksc5601_mbtowc, ksc5601_wctomb - }, - { "KOI8-R", NULLQUARK, - koi8_r_mbtowc, koi8_r_wctomb - }, - { "KOI8-U", NULLQUARK, - koi8_u_mbtowc, koi8_u_wctomb - }, - { "KOI8-C", NULLQUARK, - koi8_c_mbtowc, koi8_c_wctomb - }, - { "TATAR-CYR", NULLQUARK, - tatar_cyr_mbtowc, tatar_cyr_wctomb - }, - { "ARMSCII-8", NULLQUARK, - armscii_8_mbtowc, armscii_8_wctomb - }, - { "IBM-CP1133", NULLQUARK, - cp1133_mbtowc, cp1133_wctomb - }, - { "MULELAO-1", NULLQUARK, - mulelao_mbtowc, mulelao_wctomb - }, - { "VISCII1.1-1", NULLQUARK, - viscii_mbtowc, viscii_wctomb - }, - { "TCVN-5712", NULLQUARK, - tcvn_mbtowc, tcvn_wctomb - }, - { "GEORGIAN-ACADEMY", NULLQUARK, - georgian_academy_mbtowc, georgian_academy_wctomb - }, - { "GEORGIAN-PS", NULLQUARK, - georgian_ps_mbtowc, georgian_ps_wctomb - }, - { "ISO8859-9E", NULLQUARK, - iso8859_9e_mbtowc, iso8859_9e_wctomb - }, - { "MICROSOFT-CP1251", NULLQUARK, - cp1251_mbtowc, cp1251_wctomb - }, - { "MICROSOFT-CP1255", NULLQUARK, - cp1255_mbtowc, cp1255_wctomb - }, - { "MICROSOFT-CP1256", NULLQUARK, - cp1256_mbtowc, cp1256_wctomb - }, - { "BIG5-0", NULLQUARK, - 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). */ - { "ISO10646-1", NULLQUARK, - utf8_mbtowc, utf8_wctomb - }, - - /* Encoding ISO10646-1 for fonts means UCS2-like encoding - so for conversion to FontCharSet we need this record */ - { "ISO10646-1", NULLQUARK, - ucs2be_mbtowc, ucs2be_wctomb - } -}; - -#define charsets_table_size (sizeof(all_charsets)/sizeof(all_charsets[0])) -#define all_charsets_count (charsets_table_size - 1) -#define ucs2_conv_index (charsets_table_size - 1) - -static void -init_all_charsets (void) -{ - Utf8Conv convptr; - int i; - - for (convptr = all_charsets, i = charsets_table_size; i > 0; convptr++, i--) - convptr->xrm_name = XrmStringToQuark(convptr->name); -} - -#define lazy_init_all_charsets() \ - do { \ - if (all_charsets[0].xrm_name == NULLQUARK) \ - init_all_charsets(); \ - } while (0) - -/* from XlcNCharSet to XlcNUtf8String */ - -static int -cstoutf8( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XlcCharSet charset; - const 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; - - count = utf8_wctomb(NULL, dst, wc, dstend-dst); - if (count == RET_TOOSMALL) - break; - if (count == RET_ILSEQ) { - count = utf8_wctomb(NULL, dst, BAD_WCHAR, dstend-dst); - if (count == RET_TOOSMALL) - 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 methods_cstoutf8 = { - close_converter, - cstoutf8, - NULL -}; - -static XlcConv -open_cstoutf8( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - lazy_init_all_charsets(); - return create_conv(from_lcd, &methods_cstoutf8); -} - -/* from XlcNUtf8String to XlcNCharSet */ - -static XlcConv -create_tocs_conv( - XLCd lcd, - XlcConvMethods methods) -{ - XlcConv conv; - CodeSet *codeset_list; - int codeset_num; - int charset_num; - int i, j, k; - Utf8Conv *preferred; - - lazy_init_all_charsets(); - - codeset_list = XLC_GENERIC(lcd, codeset_list); - codeset_num = XLC_GENERIC(lcd, codeset_num); - - charset_num = 0; - for (i = 0; i < codeset_num; i++) - charset_num += codeset_list[i]->num_charsets; - if (charset_num > all_charsets_count-1) - charset_num = all_charsets_count-1; - - conv = Xmalloc(sizeof(XlcConvRec) - + (charset_num + 1) * sizeof(Utf8Conv)); - if (conv == (XlcConv) NULL) - return (XlcConv) NULL; - preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); - - /* Loop through all codesets mentioned in the locale. */ - charset_num = 0; - for (i = 0; i < codeset_num; i++) { - XlcCharSet *charsets = codeset_list[i]->charset_list; - int num_charsets = codeset_list[i]->num_charsets; - for (j = 0; j < num_charsets; j++) { - const char *name = charsets[j]->encoding_name; - /* If it wasn't already encountered... */ - for (k = charset_num-1; k >= 0; k--) - if (!strcmp(preferred[k]->name, name)) - break; - if (k < 0) { - /* Look it up in all_charsets[]. */ - for (k = 0; k < all_charsets_count-1; k++) - if (!strcmp(all_charsets[k].name, name)) { - /* Add it to the preferred set. */ - preferred[charset_num++] = &all_charsets[k]; - break; - } - } - } - } - preferred[charset_num] = (Utf8Conv) NULL; - - conv->methods = methods; - conv->state = (XPointer) preferred; - - return conv; -} - -static void -close_tocs_converter( - XlcConv conv) -{ - /* conv->state is allocated together with conv, free both at once. */ - Xfree(conv); -} - -/* - * Converts a Unicode character to an appropriate character set. The NULL - * terminated array of preferred character sets is passed as first argument. - * If successful, *charsetp is set to the character set that was used, and - * *sidep is set to the character set side (XlcGL or XlcGR). - */ -static int -charset_wctocs( - Utf8Conv *preferred, - Utf8Conv *charsetp, - XlcSide *sidep, - XlcConv conv, - unsigned char *r, - ucs4_t wc, - int n) -{ - int count; - Utf8Conv convptr; - int i; - - for (; *preferred != (Utf8Conv) NULL; preferred++) { - convptr = *preferred; - count = convptr->wctocs(conv, r, wc, n); - if (count == RET_TOOSMALL) - return RET_TOOSMALL; - if (count != RET_ILSEQ) { - *charsetp = convptr; - *sidep = (*r < 0x80 ? XlcGL : XlcGR); - return count; - } - } - for (convptr = all_charsets+1, i = all_charsets_count-1; i > 0; convptr++, i--) { - count = convptr->wctocs(conv, r, wc, n); - if (count == RET_TOOSMALL) - return RET_TOOSMALL; - if (count != RET_ILSEQ) { - *charsetp = convptr; - *sidep = (*r < 0x80 ? XlcGL : XlcGR); - return count; - } - } - return RET_ILSEQ; -} - -static int -utf8tocs( - 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; - ucs4_t wc; - int consumed; - int count; - - consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); - if (consumed == RET_TOOFEW(0)) - break; - if (consumed == RET_ILSEQ) { - 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 methods_utf8tocs = { - close_tocs_converter, - utf8tocs, - NULL -}; - -static XlcConv -open_utf8tocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_tocs_conv(from_lcd, &methods_utf8tocs); -} - -/* from XlcNUtf8String to XlcNChar */ - -static int -utf8tocs1( - 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; - ucs4_t wc; - int consumed; - int count; - - consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); - if (consumed == RET_TOOFEW(0)) - break; - if (consumed == RET_ILSEQ) { - 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; - break; - } - - 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 methods_utf8tocs1 = { - close_tocs_converter, - utf8tocs1, - NULL -}; - -static XlcConv -open_utf8tocs1( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_tocs_conv(from_lcd, &methods_utf8tocs1); -} - -/* from XlcNUtf8String to XlcNString */ - -static int -utf8tostr( - 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; - ucs4_t wc; - int consumed; - - consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); - if (consumed == RET_TOOFEW(0)) - break; - if (dst == dstend) - break; - if (consumed == RET_ILSEQ) { - consumed = 1; - c = BAD_CHAR; - unconv_num++; - } else { - if ((wc & ~(ucs4_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 methods_utf8tostr = { - close_converter, - utf8tostr, - NULL -}; - -static XlcConv -open_utf8tostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_utf8tostr); -} - -/* from XlcNString to XlcNUtf8String */ - -static int -strtoutf8( - 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 = utf8_wctomb(NULL, dst, *src, dstend-dst); - if (count == RET_TOOSMALL) - break; - dst += count; - src++; - } - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return 0; -} - -static XlcConvMethodsRec methods_strtoutf8 = { - close_converter, - strtoutf8, - NULL -}; - -static XlcConv -open_strtoutf8( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_strtoutf8); -} - -/* Support for the input methods. */ - -XPointer -_Utf8GetConvByName( - const char *name) -{ - XrmQuark xrm_name; - Utf8Conv convptr; - int i; - - if (name == NULL) - return (XPointer) NULL; - - lazy_init_all_charsets(); - xrm_name = XrmStringToQuark(name); - - for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) - if (convptr->xrm_name == xrm_name) - return (XPointer) convptr->wctocs; - return (XPointer) NULL; -} - -/* from XlcNUcsChar to XlcNChar, needed for input methods */ - -static XlcConv -create_ucstocs_conv( - XLCd lcd, - XlcConvMethods methods) -{ - - if (XLC_PUBLIC_PART(lcd)->codeset - && _XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8") == 0) { - XlcConv conv; - Utf8Conv *preferred; - - lazy_init_all_charsets(); - - conv = Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv)); - if (conv == (XlcConv) NULL) - return (XlcConv) NULL; - preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); - - preferred[0] = &all_charsets[0]; /* ISO10646 */ - preferred[1] = (Utf8Conv) NULL; - - conv->methods = methods; - conv->state = (XPointer) preferred; - - return conv; - } else { - return create_tocs_conv(lcd, methods); - } -} - -static int -charset_wctocs_exactly( - Utf8Conv *preferred, - Utf8Conv *charsetp, - XlcSide *sidep, - XlcConv conv, - unsigned char *r, - ucs4_t wc, - int n) -{ - int count; - Utf8Conv convptr; - - for (; *preferred != (Utf8Conv) NULL; preferred++) { - convptr = *preferred; - count = convptr->wctocs(conv, r, wc, n); - if (count == RET_TOOSMALL) - return RET_TOOSMALL; - if (count != RET_ILSEQ) { - *charsetp = convptr; - *sidep = (*r < 0x80 ? XlcGL : XlcGR); - return count; - } - } - return RET_ILSEQ; -} - -static int -ucstocs1( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - ucs4_t const *src; - unsigned char *dst = (unsigned char *) *to; - int unconv_num = 0; - Utf8Conv *preferred_charsets = (Utf8Conv *) conv->state; - Utf8Conv chosen_charset = NULL; - XlcSide chosen_side = XlcNONE; - XlcCharSet charset = NULL; - int count; - - if (from == NULL || *from == NULL) - return 0; - - src = (ucs4_t const *) *from; - - count = charset_wctocs_exactly(preferred_charsets, &chosen_charset, - &chosen_side, conv, dst, *src, *to_left); - if (count < 1) { - unconv_num++; - count = 0; - } else { - charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); - } - if (charset == NULL) - return -1; - - *from = (XPointer) ++src; - (*from_left)--; - *to = (XPointer) dst; - *to_left -= count; - - if (num_args >= 1) - *((XlcCharSet *)args[0]) = charset; - - return unconv_num; -} - -static XlcConvMethodsRec methods_ucstocs1 = { - close_tocs_converter, - ucstocs1, - NULL -}; - -static XlcConv -open_ucstocs1( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_ucstocs_conv(from_lcd, &methods_ucstocs1); -} - -/* from XlcNUcsChar to XlcNUtf8String, needed for input methods */ - -static int -ucstoutf8( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - const ucs4_t *src; - const ucs4_t *srcend; - unsigned char *dst; - unsigned char *dstend; - int unconv_num; - - if (from == NULL || *from == NULL) - return 0; - - src = (const ucs4_t *) *from; - srcend = src + *from_left; - dst = (unsigned char *) *to; - dstend = dst + *to_left; - unconv_num = 0; - - while (src < srcend) { - int count = utf8_wctomb(NULL, dst, *src, dstend-dst); - if (count == RET_TOOSMALL) - break; - if (count == RET_ILSEQ) - unconv_num++; - src++; - dst += count; - } - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return unconv_num; -} - -static XlcConvMethodsRec methods_ucstoutf8 = { - close_converter, - ucstoutf8, - NULL -}; - -static XlcConv -open_ucstoutf8( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_ucstoutf8); -} - -/* Registers UTF-8 converters for a non-UTF-8 locale. */ -void -_XlcAddUtf8Converters( - XLCd lcd) -{ - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String, open_cstoutf8); - _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNCharSet, open_utf8tocs); - _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNChar, open_utf8tocs1); - _XlcSetConverter(lcd, XlcNString, lcd, XlcNUtf8String, open_strtoutf8); - _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNString, open_utf8tostr); - _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNChar, open_ucstocs1); - _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String, open_ucstoutf8); -} - -/***************************************************************************/ -/* Part II: UTF-8 locale loader conversion files - * - * Here we can assume that "multi-byte" is UTF-8 and that `wchar_t' is Unicode. - */ - -/* from XlcNMultiByte to XlcNWideChar */ - -static int -utf8towcs( - 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; - wchar_t *dst; - wchar_t *dstend; - int unconv_num; - - if (from == NULL || *from == NULL) - return 0; - - src = (unsigned char const *) *from; - srcend = src + *from_left; - dst = (wchar_t *) *to; - dstend = dst + *to_left; - unconv_num = 0; - - while (src < srcend && dst < dstend) { - ucs4_t wc; - int consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); - if (consumed == RET_TOOFEW(0)) - break; - if (consumed == RET_ILSEQ) { - src++; - *dst = BAD_WCHAR; - unconv_num++; - } else { - src += consumed; - *dst = wc; - } - dst++; - } - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return unconv_num; -} - -static XlcConvMethodsRec methods_utf8towcs = { - close_converter, - utf8towcs, - NULL -}; - -static XlcConv -open_utf8towcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_utf8towcs); -} - -/* from XlcNWideChar to XlcNMultiByte */ - -static int -wcstoutf8( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - wchar_t const *src; - wchar_t const *srcend; - unsigned char *dst; - unsigned char *dstend; - int unconv_num; - - if (from == NULL || *from == NULL) - return 0; - - src = (wchar_t const *) *from; - srcend = src + *from_left; - dst = (unsigned char *) *to; - dstend = dst + *to_left; - unconv_num = 0; - - while (src < srcend) { - int count = utf8_wctomb(NULL, dst, *src, dstend-dst); - if (count == RET_TOOSMALL) - break; - if (count == RET_ILSEQ) { - count = utf8_wctomb(NULL, dst, BAD_WCHAR, dstend-dst); - if (count == RET_TOOSMALL) - break; - unconv_num++; - } - dst += count; - src++; - } - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return unconv_num; -} - -static XlcConvMethodsRec methods_wcstoutf8 = { - close_converter, - wcstoutf8, - NULL -}; - -static XlcConv -open_wcstoutf8( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_wcstoutf8); -} - -/* from XlcNString to XlcNWideChar */ - -static int -our_strtowcs( - 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; - wchar_t *dst; - wchar_t *dstend; - - if (from == NULL || *from == NULL) - return 0; - - src = (unsigned char const *) *from; - srcend = src + *from_left; - dst = (wchar_t *) *to; - dstend = dst + *to_left; - - while (src < srcend && dst < dstend) - *dst++ = (wchar_t) *src++; - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return 0; -} - -static XlcConvMethodsRec methods_strtowcs = { - close_converter, - our_strtowcs, - NULL -}; - -static XlcConv -open_strtowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_strtowcs); -} - -/* from XlcNWideChar to XlcNString */ - -static int -our_wcstostr( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - wchar_t const *src; - wchar_t const *srcend; - unsigned char *dst; - unsigned char *dstend; - int unconv_num; - - if (from == NULL || *from == NULL) - return 0; - - src = (wchar_t const *) *from; - srcend = src + *from_left; - dst = (unsigned char *) *to; - dstend = dst + *to_left; - unconv_num = 0; - - while (src < srcend && dst < dstend) { - unsigned int wc = *src++; - if (wc < 0x80) - *dst = wc; - else { - *dst = BAD_CHAR; - unconv_num++; - } - dst++; - } - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return unconv_num; -} - -static XlcConvMethodsRec methods_wcstostr = { - close_converter, - our_wcstostr, - NULL -}; - -static XlcConv -open_wcstostr( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_wcstostr); -} - -/* from XlcNCharSet to XlcNWideChar */ - -static int -cstowcs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XlcCharSet charset; - const char *name; - Utf8Conv convptr; - int i; - unsigned char const *src; - unsigned char const *srcend; - wchar_t *dst; - wchar_t *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 = (wchar_t *) *to; - dstend = dst + *to_left; - unconv_num = 0; - - while (src < srcend && dst < dstend) { - unsigned int wc; - int consumed; - - consumed = convptr->cstowc(conv, &wc, src, srcend-src); - if (consumed == RET_ILSEQ) - return -1; - if (consumed == RET_TOOFEW(0)) - break; - - *dst++ = wc; - src += consumed; - } - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return unconv_num; -} - -static XlcConvMethodsRec methods_cstowcs = { - close_converter, - cstowcs, - NULL -}; - -static XlcConv -open_cstowcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - lazy_init_all_charsets(); - return create_conv(from_lcd, &methods_cstowcs); -} - -/* from XlcNWideChar to XlcNCharSet */ - -static int -wcstocs( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - Utf8Conv *preferred_charsets; - XlcCharSet last_charset = NULL; - wchar_t const *src; - wchar_t const *srcend; - unsigned char *dst; - unsigned char *dstend; - int unconv_num; - - if (from == NULL || *from == NULL) - return 0; - - preferred_charsets = (Utf8Conv *) conv->state; - src = (wchar_t 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 = *src; - int count; - - count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); - if (count == RET_TOOSMALL) - break; - if (count == RET_ILSEQ) { - src++; - unconv_num++; - continue; - } - - if (last_charset == NULL) { - last_charset = - _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); - if (last_charset == NULL) { - src++; - 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++; - 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 methods_wcstocs = { - close_tocs_converter, - wcstocs, - NULL -}; - -static XlcConv -open_wcstocs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_tocs_conv(from_lcd, &methods_wcstocs); -} - -/* from XlcNWideChar to XlcNChar */ - -static int -wcstocs1( - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - Utf8Conv *preferred_charsets; - XlcCharSet last_charset = NULL; - wchar_t const *src; - wchar_t const *srcend; - unsigned char *dst; - unsigned char *dstend; - int unconv_num; - - if (from == NULL || *from == NULL) - return 0; - - preferred_charsets = (Utf8Conv *) conv->state; - src = (wchar_t 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 = *src; - int count; - - count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); - if (count == RET_TOOSMALL) - break; - if (count == RET_ILSEQ) { - src++; - unconv_num++; - continue; - } - - if (last_charset == NULL) { - last_charset = - _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); - if (last_charset == NULL) { - src++; - 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++; - dst += count; - break; - } - - 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 methods_wcstocs1 = { - close_tocs_converter, - wcstocs1, - NULL -}; - -static XlcConv -open_wcstocs1( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_tocs_conv(from_lcd, &methods_wcstocs1); -} - -/* trivial, no conversion */ - -static int -identity( - 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 && dst < dstend) - *dst++ = *src++; - - *from = (XPointer) src; - *from_left = srcend - src; - *to = (XPointer) dst; - *to_left = dstend - dst; - - return 0; -} - -static XlcConvMethodsRec methods_identity = { - close_converter, - identity, - NULL -}; - -static XlcConv -open_identity( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_conv(from_lcd, &methods_identity); -} - -/* from MultiByte/WideChar to FontCharSet. */ -/* They really use converters to CharSet - * but with different create_conv procedure. */ - -static XlcConv -create_tofontcs_conv( - XLCd lcd, - XlcConvMethods methods) -{ - XlcConv conv; - int i, num, k, count; - char **value, buf[20]; - Utf8Conv *preferred; - - lazy_init_all_charsets(); - - for (i = 0, num = 0;; i++) { - snprintf(buf, sizeof(buf), "fs%d.charset.name", i); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) { - snprintf(buf, sizeof(buf), "fs%d.charset", i); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) - break; - } - num += count; - } - - conv = Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv)); - if (conv == (XlcConv) NULL) - return (XlcConv) NULL; - preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); - - /* Loop through all fontsets mentioned in the locale. */ - for (i = 0, num = 0;; i++) { - snprintf(buf, sizeof(buf), "fs%d.charset.name", i); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) { - snprintf(buf, sizeof(buf), "fs%d.charset", i); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) - break; - } - while (count-- > 0) { - XlcCharSet charset = _XlcGetCharSet(*value++); - const char *name; - - if (charset == (XlcCharSet) NULL) - continue; - - name = charset->encoding_name; - /* If it wasn't already encountered... */ - for (k = num - 1; k >= 0; k--) - if (!strcmp(preferred[k]->name, name)) - break; - if (k < 0) { - /* For fonts "ISO10646-1" means ucs2, not utf8.*/ - if (!strcmp("ISO10646-1", name)) { - preferred[num++] = &all_charsets[ucs2_conv_index]; - continue; - } - /* Look it up in all_charsets[]. */ - for (k = 0; k < all_charsets_count-1; k++) - if (!strcmp(all_charsets[k].name, name)) { - /* Add it to the preferred set. */ - preferred[num++] = &all_charsets[k]; - break; - } - } - } - } - preferred[num] = (Utf8Conv) NULL; - - conv->methods = methods; - conv->state = (XPointer) preferred; - - return conv; -} - -static XlcConv -open_wcstofcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - return create_tofontcs_conv(from_lcd, &methods_wcstocs); -} - -static XlcConv -open_utf8tofcs( - XLCd from_lcd, - const char *from_type, - XLCd to_lcd, - const char *to_type) -{ - 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 const *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((char *)dst, wc); - if (count == 0) - break; - if (count == -1) { - count = wctomb((char *)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, const char *from_type, XLCd to_lcd, const 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, (const char *)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, const char *from_type, XLCd to_lcd, const 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, (const char *)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, const char *from_type, XLCd to_lcd, const 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, (const char *)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, const char *from_type, XLCd to_lcd, const 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((char *)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, const char *from_type, XLCd to_lcd, const 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, const char *from_type, XLCd to_lcd, const 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, const char *from_type, XLCd to_lcd, const 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 -_XlcAddUtf8LocaleConverters( - XLCd lcd) -{ - /* Register elementary converters. */ - - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_utf8towcs); - - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstoutf8); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); - - _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); - - /* Register converters for XlcNCharSet. This implicitly provides - * converters from and to XlcNCompoundText. */ - - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstoutf8); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_utf8tocs); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_utf8tocs1); - - _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); - _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); - - _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtoutf8); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_utf8tostr); - _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNMultiByte, open_identity); - _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String, open_identity); - - /* Register converters for XlcNFontCharSet */ - _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/nx-X11/lib/X11/lcUTF8Load.c b/nx-X11/lib/X11/lcUTF8Load.c deleted file mode 100644 index 82ea3b54d..000000000 --- a/nx-X11/lib/X11/lcUTF8Load.c +++ /dev/null @@ -1,70 +0,0 @@ -/****************************************************************** - - Copyright 1993 by SunSoft, Inc. - Copyright 1999-2000 by Bruno Haible - -Permission to use, copy, modify, distribute, and sell this software -and its 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 names of SunSoft, Inc. and -Bruno Haible not be used in advertising or publicity pertaining to -distribution of the software without specific, written prior -permission. SunSoft, Inc. and Bruno Haible make no representations -about the suitability of this software for any purpose. It is -provided "as is" without express or implied warranty. - -SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD -TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY -AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible 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. - -******************************************************************/ - -/* - * This file contains the UTF-8 locale loader. - * Supports: all locales with codeset UTF-8. - * Platforms: all systems. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "XlcPubI.h" -#include "XlcGeneric.h" - -XLCd -_XlcUtf8Loader( - const char *name) -{ - XLCd lcd; - - lcd = _XlcCreateLC(name, _XlcGenericMethods); - if (lcd == (XLCd) NULL) - return lcd; - - /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ - if (!XLC_PUBLIC_PART(lcd)->codeset) { - _XlcDestroyLC(lcd); - return (XLCd) NULL; - } - else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) { - _XlcAddUtf8LocaleConverters(lcd); - } - else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) { - _XlcAddGB18030LocaleConverters(lcd); - } - else { - _XlcDestroyLC(lcd); - return (XLCd) NULL; - } - - _XlcAddUtf8Converters(lcd); - - return lcd; -} diff --git a/nx-X11/lib/X11/lcUniConv/armscii_8.h b/nx-X11/lib/X11/lcUniConv/armscii_8.h deleted file mode 100644 index 567bfeac2..000000000 --- a/nx-X11/lib/X11/lcUniConv/armscii_8.h +++ /dev/null @@ -1,97 +0,0 @@ - -/* - * ARMSCII-8 - */ - -static const unsigned short armscii_8_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, - 0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c, - /* 0xb0 */ - 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, - 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, - /* 0xc0 */ - 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, - 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, - /* 0xd0 */ - 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, - 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, - /* 0xe0 */ - 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, - 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, - /* 0xf0 */ - 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, - 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd, -}; - -static int -armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = armscii_8_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char armscii_8_page00[8] = { - 0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */ -}; -static const unsigned char armscii_8_page00_1[32] = { - 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ -}; -static const unsigned char armscii_8_page05[96] = { - 0x00, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 0x30-0x37 */ - 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, /* 0x38-0x3f */ - 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */ - 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */ - 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */ - 0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */ - 0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */ - 0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */ - 0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */ - 0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */ - 0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ -}; -static const unsigned char armscii_8_page20[24] = { - 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */ -}; - -static int -armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0028) { - *r = wc; - return 1; - } - else if (wc >= 0x0028 && wc < 0x0030) - c = armscii_8_page00[wc-0x0028]; - else if (wc >= 0x0030 && wc < 0x00a0) - c = wc; - else if (wc >= 0x00a0 && wc < 0x00c0) - c = armscii_8_page00_1[wc-0x00a0]; - else if (wc >= 0x0530 && wc < 0x0590) - c = armscii_8_page05[wc-0x0530]; - else if (wc >= 0x2010 && wc < 0x2028) - c = armscii_8_page20[wc-0x2010]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/big5.h b/nx-X11/lib/X11/lcUniConv/big5.h deleted file mode 100644 index db439088b..000000000 --- a/nx-X11/lib/X11/lcUniConv/big5.h +++ /dev/null @@ -1,4141 +0,0 @@ - -/* - * BIG5 - */ - -static const unsigned short big5_2uni_pagea1[6121] = { - /* 0xa1 */ - 0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2022, 0xff1b, 0xff1a, - 0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xff64, 0xfe52, - 0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2013, 0xfe31, - 0x2014, 0xfe33, 0xfffd, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35, - 0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39, - 0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d, - 0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41, - 0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b, - 0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d, - 0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7, - 0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605, - 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105, - 0x203e, 0xfffd, 0xff3f, 0xfffd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e, - 0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7, - 0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267, - 0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65, - 0xfe66, 0x223c, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf, - 0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642, - 0x2641, 0x2609, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197, - 0x2199, 0x2198, 0x2225, 0x2223, 0xfffd, - /* 0xa2 */ - 0xfffd, 0xff0f, 0xff3c, 0xff04, 0x00a5, 0x3012, 0x00a2, 0x00a3, - 0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5, - 0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4, - 0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7, - 0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, - 0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a, - 0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500, - 0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e, - 0x2570, 0x256f, 0x2550, 0x255e, 0x256a, 0x2561, 0x25e2, 0x25e3, - 0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12, - 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160, - 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, - 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, - 0x3028, 0x3029, 0xfffd, 0x5344, 0xfffd, 0xff21, 0xff22, 0xff23, - 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, - 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, - 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41, - 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, - 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, - 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, - /* 0xa3 */ - 0xff57, 0xff58, 0xff59, 0xff5a, 0x0391, 0x0392, 0x0393, 0x0394, - 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, - 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, - 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, - 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, - 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, - 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x3105, 0x3106, 0x3107, 0x3108, - 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, - 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, - 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, - 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, - 0x3129, 0x02d9, 0x02c9, 0x02ca, 0x02c7, 0x02cb, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa4 */ - 0x4e00, 0x4e59, 0x4e01, 0x4e03, 0x4e43, 0x4e5d, 0x4e86, 0x4e8c, - 0x4eba, 0x513f, 0x5165, 0x516b, 0x51e0, 0x5200, 0x5201, 0x529b, - 0x5315, 0x5341, 0x535c, 0x53c8, 0x4e09, 0x4e0b, 0x4e08, 0x4e0a, - 0x4e2b, 0x4e38, 0x51e1, 0x4e45, 0x4e48, 0x4e5f, 0x4e5e, 0x4e8e, - 0x4ea1, 0x5140, 0x5203, 0x52fa, 0x5343, 0x53c9, 0x53e3, 0x571f, - 0x58eb, 0x5915, 0x5927, 0x5973, 0x5b50, 0x5b51, 0x5b53, 0x5bf8, - 0x5c0f, 0x5c22, 0x5c38, 0x5c71, 0x5ddd, 0x5de5, 0x5df1, 0x5df2, - 0x5df3, 0x5dfe, 0x5e72, 0x5efe, 0x5f0b, 0x5f13, 0x624d, 0x4e11, - 0x4e10, 0x4e0d, 0x4e2d, 0x4e30, 0x4e39, 0x4e4b, 0x5c39, 0x4e88, - 0x4e91, 0x4e95, 0x4e92, 0x4e94, 0x4ea2, 0x4ec1, 0x4ec0, 0x4ec3, - 0x4ec6, 0x4ec7, 0x4ecd, 0x4eca, 0x4ecb, 0x4ec4, 0x5143, 0x5141, - 0x5167, 0x516d, 0x516e, 0x516c, 0x5197, 0x51f6, 0x5206, 0x5207, - 0x5208, 0x52fb, 0x52fe, 0x52ff, 0x5316, 0x5339, 0x5348, 0x5347, - 0x5345, 0x535e, 0x5384, 0x53cb, 0x53ca, 0x53cd, 0x58ec, 0x5929, - 0x592b, 0x592a, 0x592d, 0x5b54, 0x5c11, 0x5c24, 0x5c3a, 0x5c6f, - 0x5df4, 0x5e7b, 0x5eff, 0x5f14, 0x5f15, 0x5fc3, 0x6208, 0x6236, - 0x624b, 0x624e, 0x652f, 0x6587, 0x6597, 0x65a4, 0x65b9, 0x65e5, - 0x66f0, 0x6708, 0x6728, 0x6b20, 0x6b62, 0x6b79, 0x6bcb, 0x6bd4, - 0x6bdb, 0x6c0f, 0x6c34, 0x706b, 0x722a, 0x7236, 0x723b, 0x7247, - 0x7259, 0x725b, 0x72ac, 0x738b, 0x4e19, - /* 0xa5 */ - 0x4e16, 0x4e15, 0x4e14, 0x4e18, 0x4e3b, 0x4e4d, 0x4e4f, 0x4e4e, - 0x4ee5, 0x4ed8, 0x4ed4, 0x4ed5, 0x4ed6, 0x4ed7, 0x4ee3, 0x4ee4, - 0x4ed9, 0x4ede, 0x5145, 0x5144, 0x5189, 0x518a, 0x51ac, 0x51f9, - 0x51fa, 0x51f8, 0x520a, 0x52a0, 0x529f, 0x5305, 0x5306, 0x5317, - 0x531d, 0x4edf, 0x534a, 0x5349, 0x5361, 0x5360, 0x536f, 0x536e, - 0x53bb, 0x53ef, 0x53e4, 0x53f3, 0x53ec, 0x53ee, 0x53e9, 0x53e8, - 0x53fc, 0x53f8, 0x53f5, 0x53eb, 0x53e6, 0x53ea, 0x53f2, 0x53f1, - 0x53f0, 0x53e5, 0x53ed, 0x53fb, 0x56db, 0x56da, 0x5916, 0x592e, - 0x5931, 0x5974, 0x5976, 0x5b55, 0x5b83, 0x5c3c, 0x5de8, 0x5de7, - 0x5de6, 0x5e02, 0x5e03, 0x5e73, 0x5e7c, 0x5f01, 0x5f18, 0x5f17, - 0x5fc5, 0x620a, 0x6253, 0x6254, 0x6252, 0x6251, 0x65a5, 0x65e6, - 0x672e, 0x672c, 0x672a, 0x672b, 0x672d, 0x6b63, 0x6bcd, 0x6c11, - 0x6c10, 0x6c38, 0x6c41, 0x6c40, 0x6c3e, 0x72af, 0x7384, 0x7389, - 0x74dc, 0x74e6, 0x7518, 0x751f, 0x7528, 0x7529, 0x7530, 0x7531, - 0x7532, 0x7533, 0x758b, 0x767d, 0x76ae, 0x76bf, 0x76ee, 0x77db, - 0x77e2, 0x77f3, 0x793a, 0x79be, 0x7a74, 0x7acb, 0x4e1e, 0x4e1f, - 0x4e52, 0x4e53, 0x4e69, 0x4e99, 0x4ea4, 0x4ea6, 0x4ea5, 0x4eff, - 0x4f09, 0x4f19, 0x4f0a, 0x4f15, 0x4f0d, 0x4f10, 0x4f11, 0x4f0f, - 0x4ef2, 0x4ef6, 0x4efb, 0x4ef0, 0x4ef3, 0x4efd, 0x4f01, 0x4f0b, - 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, - /* 0xa6 */ - 0x5171, 0x518d, 0x51b0, 0x5217, 0x5211, 0x5212, 0x520e, 0x5216, - 0x52a3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540f, - 0x540c, 0x540a, 0x5410, 0x5401, 0x540b, 0x5404, 0x5411, 0x540d, - 0x5408, 0x5403, 0x540e, 0x5406, 0x5412, 0x56e0, 0x56de, 0x56dd, - 0x5733, 0x5730, 0x5728, 0x572d, 0x572c, 0x572f, 0x5729, 0x5919, - 0x591a, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597d, 0x5979, - 0x5982, 0x5981, 0x5b57, 0x5b58, 0x5b87, 0x5b88, 0x5b85, 0x5b89, - 0x5bfa, 0x5c16, 0x5c79, 0x5dde, 0x5e06, 0x5e76, 0x5e74, 0x5f0f, - 0x5f1b, 0x5fd9, 0x5fd6, 0x620e, 0x620c, 0x620d, 0x6210, 0x6263, - 0x625b, 0x6258, 0x6536, 0x65e9, 0x65e8, 0x65ec, 0x65ed, 0x66f2, - 0x66f3, 0x6709, 0x673d, 0x6734, 0x6731, 0x6735, 0x6b21, 0x6b64, - 0x6b7b, 0x6c16, 0x6c5d, 0x6c57, 0x6c59, 0x6c5f, 0x6c60, 0x6c50, - 0x6c55, 0x6c61, 0x6c5b, 0x6c4d, 0x6c4e, 0x7070, 0x725f, 0x725d, - 0x767e, 0x7af9, 0x7c73, 0x7cf8, 0x7f36, 0x7f8a, 0x7fbd, 0x8001, - 0x8003, 0x800c, 0x8012, 0x8033, 0x807f, 0x8089, 0x808b, 0x808c, - 0x81e3, 0x81ea, 0x81f3, 0x81fc, 0x820c, 0x821b, 0x821f, 0x826e, - 0x8272, 0x827e, 0x866b, 0x8840, 0x884c, 0x8863, 0x897f, 0x9621, - 0x4e32, 0x4ea8, 0x4f4d, 0x4f4f, 0x4f47, 0x4f57, 0x4f5e, 0x4f34, - 0x4f5b, 0x4f55, 0x4f30, 0x4f50, 0x4f51, 0x4f3d, 0x4f3a, 0x4f38, - 0x4f43, 0x4f54, 0x4f3c, 0x4f46, 0x4f63, - /* 0xa7 */ - 0x4f5c, 0x4f60, 0x4f2f, 0x4f4e, 0x4f36, 0x4f59, 0x4f5d, 0x4f48, - 0x4f5a, 0x514c, 0x514b, 0x514d, 0x5175, 0x51b6, 0x51b7, 0x5225, - 0x5224, 0x5229, 0x522a, 0x5228, 0x52ab, 0x52a9, 0x52aa, 0x52ac, - 0x5323, 0x5373, 0x5375, 0x541d, 0x542d, 0x541e, 0x543e, 0x5426, - 0x544e, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541b, - 0x5429, 0x544a, 0x5439, 0x543b, 0x5438, 0x542e, 0x5435, 0x5436, - 0x5420, 0x543c, 0x5440, 0x5431, 0x542b, 0x541f, 0x542c, 0x56ea, - 0x56f0, 0x56e4, 0x56eb, 0x574a, 0x5751, 0x5740, 0x574d, 0x5747, - 0x574e, 0x573e, 0x5750, 0x574f, 0x573b, 0x58ef, 0x593e, 0x599d, - 0x5992, 0x59a8, 0x599e, 0x59a3, 0x5999, 0x5996, 0x598d, 0x59a4, - 0x5993, 0x598a, 0x59a5, 0x5b5d, 0x5b5c, 0x5b5a, 0x5b5b, 0x5b8c, - 0x5b8b, 0x5b8f, 0x5c2c, 0x5c40, 0x5c41, 0x5c3f, 0x5c3e, 0x5c90, - 0x5c91, 0x5c94, 0x5c8c, 0x5deb, 0x5e0c, 0x5e8f, 0x5e87, 0x5e8a, - 0x5ef7, 0x5f04, 0x5f1f, 0x5f64, 0x5f62, 0x5f77, 0x5f79, 0x5fd8, - 0x5fcc, 0x5fd7, 0x5fcd, 0x5ff1, 0x5feb, 0x5ff8, 0x5fea, 0x6212, - 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, 0x6289, 0x626d, - 0x628a, 0x627c, 0x627e, 0x6279, 0x6273, 0x6292, 0x626f, 0x6298, - 0x626e, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, 0x653b, 0x6538, - 0x65f1, 0x66f4, 0x675f, 0x674e, 0x674f, 0x6750, 0x6751, 0x675c, - 0x6756, 0x675e, 0x6749, 0x6746, 0x6760, - /* 0xa8 */ - 0x6753, 0x6757, 0x6b65, 0x6bcf, 0x6c42, 0x6c5e, 0x6c99, 0x6c81, - 0x6c88, 0x6c89, 0x6c85, 0x6c9b, 0x6c6a, 0x6c7a, 0x6c90, 0x6c70, - 0x6c8c, 0x6c68, 0x6c96, 0x6c92, 0x6c7d, 0x6c83, 0x6c72, 0x6c7e, - 0x6c74, 0x6c86, 0x6c76, 0x6c8d, 0x6c94, 0x6c98, 0x6c82, 0x7076, - 0x707c, 0x707d, 0x7078, 0x7262, 0x7261, 0x7260, 0x72c4, 0x72c2, - 0x7396, 0x752c, 0x752b, 0x7537, 0x7538, 0x7682, 0x76ef, 0x77e3, - 0x79c1, 0x79c0, 0x79bf, 0x7a76, 0x7cfb, 0x7f55, 0x8096, 0x8093, - 0x809d, 0x8098, 0x809b, 0x809a, 0x80b2, 0x826f, 0x8292, 0x828b, - 0x828d, 0x898b, 0x89d2, 0x8a00, 0x8c37, 0x8c46, 0x8c55, 0x8c9d, - 0x8d64, 0x8d70, 0x8db3, 0x8eab, 0x8eca, 0x8f9b, 0x8fb0, 0x8fc2, - 0x8fc6, 0x8fc5, 0x8fc4, 0x5de1, 0x9091, 0x90a2, 0x90aa, 0x90a6, - 0x90a3, 0x9149, 0x91c6, 0x91cc, 0x9632, 0x962e, 0x9631, 0x962a, - 0x962c, 0x4e26, 0x4e56, 0x4e73, 0x4e8b, 0x4e9b, 0x4e9e, 0x4eab, - 0x4eac, 0x4f6f, 0x4f9d, 0x4f8d, 0x4f73, 0x4f7f, 0x4f6c, 0x4f9b, - 0x4f8b, 0x4f86, 0x4f83, 0x4f70, 0x4f75, 0x4f88, 0x4f69, 0x4f7b, - 0x4f96, 0x4f7e, 0x4f8f, 0x4f91, 0x4f7a, 0x5154, 0x5152, 0x5155, - 0x5169, 0x5177, 0x5176, 0x5178, 0x51bd, 0x51fd, 0x523b, 0x5238, - 0x5237, 0x523a, 0x5230, 0x522e, 0x5236, 0x5241, 0x52be, 0x52bb, - 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, 0x5378, 0x5379, - 0x53d6, 0x53d4, 0x53d7, 0x5473, 0x5475, - /* 0xa9 */ - 0x5496, 0x5478, 0x5495, 0x5480, 0x547b, 0x5477, 0x5484, 0x5492, - 0x5486, 0x547c, 0x5490, 0x5471, 0x5476, 0x548c, 0x549a, 0x5462, - 0x5468, 0x548b, 0x547d, 0x548e, 0x56fa, 0x5783, 0x5777, 0x576a, - 0x5769, 0x5761, 0x5766, 0x5764, 0x577c, 0x591c, 0x5949, 0x5947, - 0x5948, 0x5944, 0x5954, 0x59be, 0x59bb, 0x59d4, 0x59b9, 0x59ae, - 0x59d1, 0x59c6, 0x59d0, 0x59cd, 0x59cb, 0x59d3, 0x59ca, 0x59af, - 0x59b3, 0x59d2, 0x59c5, 0x5b5f, 0x5b64, 0x5b63, 0x5b97, 0x5b9a, - 0x5b98, 0x5b9c, 0x5b99, 0x5b9b, 0x5c1a, 0x5c48, 0x5c45, 0x5c46, - 0x5cb7, 0x5ca1, 0x5cb8, 0x5ca9, 0x5cab, 0x5cb1, 0x5cb3, 0x5e18, - 0x5e1a, 0x5e16, 0x5e15, 0x5e1b, 0x5e11, 0x5e78, 0x5e9a, 0x5e97, - 0x5e9c, 0x5e95, 0x5e96, 0x5ef6, 0x5f26, 0x5f27, 0x5f29, 0x5f80, - 0x5f81, 0x5f7f, 0x5f7c, 0x5fdd, 0x5fe0, 0x5ffd, 0x5ff5, 0x5fff, - 0x600f, 0x6014, 0x602f, 0x6035, 0x6016, 0x602a, 0x6015, 0x6021, - 0x6027, 0x6029, 0x602b, 0x601b, 0x6216, 0x6215, 0x623f, 0x623e, - 0x6240, 0x627f, 0x62c9, 0x62cc, 0x62c4, 0x62bf, 0x62c2, 0x62b9, - 0x62d2, 0x62db, 0x62ab, 0x62d3, 0x62d4, 0x62cb, 0x62c8, 0x62a8, - 0x62bd, 0x62bc, 0x62d0, 0x62d9, 0x62c7, 0x62cd, 0x62b5, 0x62da, - 0x62b1, 0x62d8, 0x62d6, 0x62d7, 0x62c6, 0x62ac, 0x62ce, 0x653e, - 0x65a7, 0x65bc, 0x65fa, 0x6614, 0x6613, 0x660c, 0x6606, 0x6602, - 0x660e, 0x6600, 0x660f, 0x6615, 0x660a, - /* 0xaa */ - 0x6607, 0x670d, 0x670b, 0x676d, 0x678b, 0x6795, 0x6771, 0x679c, - 0x6773, 0x6777, 0x6787, 0x679d, 0x6797, 0x676f, 0x6770, 0x677f, - 0x6789, 0x677e, 0x6790, 0x6775, 0x679a, 0x6793, 0x677c, 0x676a, - 0x6772, 0x6b23, 0x6b66, 0x6b67, 0x6b7f, 0x6c13, 0x6c1b, 0x6ce3, - 0x6ce8, 0x6cf3, 0x6cb1, 0x6ccc, 0x6ce5, 0x6cb3, 0x6cbd, 0x6cbe, - 0x6cbc, 0x6ce2, 0x6cab, 0x6cd5, 0x6cd3, 0x6cb8, 0x6cc4, 0x6cb9, - 0x6cc1, 0x6cae, 0x6cd7, 0x6cc5, 0x6cf1, 0x6cbf, 0x6cbb, 0x6ce1, - 0x6cdb, 0x6cca, 0x6cac, 0x6cef, 0x6cdc, 0x6cd6, 0x6ce0, 0x7095, - 0x708e, 0x7092, 0x708a, 0x7099, 0x722c, 0x722d, 0x7238, 0x7248, - 0x7267, 0x7269, 0x72c0, 0x72ce, 0x72d9, 0x72d7, 0x72d0, 0x73a9, - 0x73a8, 0x739f, 0x73ab, 0x73a5, 0x753d, 0x759d, 0x7599, 0x759a, - 0x7684, 0x76c2, 0x76f2, 0x76f4, 0x77e5, 0x77fd, 0x793e, 0x7940, - 0x7941, 0x79c9, 0x79c8, 0x7a7a, 0x7a79, 0x7afa, 0x7cfe, 0x7f54, - 0x7f8c, 0x7f8b, 0x8005, 0x80ba, 0x80a5, 0x80a2, 0x80b1, 0x80a1, - 0x80ab, 0x80a9, 0x80b4, 0x80aa, 0x80af, 0x81e5, 0x81fe, 0x820d, - 0x82b3, 0x829d, 0x8299, 0x82ad, 0x82bd, 0x829f, 0x82b9, 0x82b1, - 0x82ac, 0x82a5, 0x82af, 0x82b8, 0x82a3, 0x82b0, 0x82be, 0x82b7, - 0x864e, 0x8671, 0x521d, 0x8868, 0x8ecb, 0x8fce, 0x8fd4, 0x8fd1, - 0x90b5, 0x90b8, 0x90b1, 0x90b6, 0x91c7, 0x91d1, 0x9577, 0x9580, - 0x961c, 0x9640, 0x963f, 0x963b, 0x9644, - /* 0xab */ - 0x9642, 0x96b9, 0x96e8, 0x9752, 0x975e, 0x4e9f, 0x4ead, 0x4eae, - 0x4fe1, 0x4fb5, 0x4faf, 0x4fbf, 0x4fe0, 0x4fd1, 0x4fcf, 0x4fdd, - 0x4fc3, 0x4fb6, 0x4fd8, 0x4fdf, 0x4fca, 0x4fd7, 0x4fae, 0x4fd0, - 0x4fc4, 0x4fc2, 0x4fda, 0x4fce, 0x4fde, 0x4fb7, 0x5157, 0x5192, - 0x5191, 0x51a0, 0x524e, 0x5243, 0x524a, 0x524d, 0x524c, 0x524b, - 0x5247, 0x52c7, 0x52c9, 0x52c3, 0x52c1, 0x530d, 0x5357, 0x537b, - 0x539a, 0x53db, 0x54ac, 0x54c0, 0x54a8, 0x54ce, 0x54c9, 0x54b8, - 0x54a6, 0x54b3, 0x54c7, 0x54c2, 0x54bd, 0x54aa, 0x54c1, 0x54c4, - 0x54c8, 0x54af, 0x54ab, 0x54b1, 0x54bb, 0x54a9, 0x54a7, 0x54bf, - 0x56ff, 0x5782, 0x578b, 0x57a0, 0x57a3, 0x57a2, 0x57ce, 0x57ae, - 0x5793, 0x5955, 0x5951, 0x594f, 0x594e, 0x5950, 0x59dc, 0x59d8, - 0x59ff, 0x59e3, 0x59e8, 0x5a03, 0x59e5, 0x59ea, 0x59da, 0x59e6, - 0x5a01, 0x59fb, 0x5b69, 0x5ba3, 0x5ba6, 0x5ba4, 0x5ba2, 0x5ba5, - 0x5c01, 0x5c4e, 0x5c4f, 0x5c4d, 0x5c4b, 0x5cd9, 0x5cd2, 0x5df7, - 0x5e1d, 0x5e25, 0x5e1f, 0x5e7d, 0x5ea0, 0x5ea6, 0x5efa, 0x5f08, - 0x5f2d, 0x5f65, 0x5f88, 0x5f85, 0x5f8a, 0x5f8b, 0x5f87, 0x5f8c, - 0x5f89, 0x6012, 0x601d, 0x6020, 0x6025, 0x600e, 0x6028, 0x604d, - 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606c, 0x606b, 0x606a, - 0x6064, 0x6241, 0x62dc, 0x6316, 0x6309, 0x62fc, 0x62ed, 0x6301, - 0x62ee, 0x62fd, 0x6307, 0x62f1, 0x62f7, - /* 0xac */ - 0x62ef, 0x62ec, 0x62fe, 0x62f4, 0x6311, 0x6302, 0x653f, 0x6545, - 0x65ab, 0x65bd, 0x65e2, 0x6625, 0x662d, 0x6620, 0x6627, 0x662f, - 0x661f, 0x6628, 0x6631, 0x6624, 0x66f7, 0x67ff, 0x67d3, 0x67f1, - 0x67d4, 0x67d0, 0x67ec, 0x67b6, 0x67af, 0x67f5, 0x67e9, 0x67ef, - 0x67c4, 0x67d1, 0x67b4, 0x67da, 0x67e5, 0x67b8, 0x67cf, 0x67de, - 0x67f3, 0x67b0, 0x67d9, 0x67e2, 0x67dd, 0x67d2, 0x6b6a, 0x6b83, - 0x6b86, 0x6bb5, 0x6bd2, 0x6bd7, 0x6c1f, 0x6cc9, 0x6d0b, 0x6d32, - 0x6d2a, 0x6d41, 0x6d25, 0x6d0c, 0x6d31, 0x6d1e, 0x6d17, 0x6d3b, - 0x6d3d, 0x6d3e, 0x6d36, 0x6d1b, 0x6cf5, 0x6d39, 0x6d27, 0x6d38, - 0x6d29, 0x6d2e, 0x6d35, 0x6d0e, 0x6d2b, 0x70ab, 0x70ba, 0x70b3, - 0x70ac, 0x70af, 0x70ad, 0x70b8, 0x70ae, 0x70a4, 0x7230, 0x7272, - 0x726f, 0x7274, 0x72e9, 0x72e0, 0x72e1, 0x73b7, 0x73ca, 0x73bb, - 0x73b2, 0x73cd, 0x73c0, 0x73b3, 0x751a, 0x752d, 0x754f, 0x754c, - 0x754e, 0x754b, 0x75ab, 0x75a4, 0x75a5, 0x75a2, 0x75a3, 0x7678, - 0x7686, 0x7687, 0x7688, 0x76c8, 0x76c6, 0x76c3, 0x76c5, 0x7701, - 0x76f9, 0x76f8, 0x7709, 0x770b, 0x76fe, 0x76fc, 0x7707, 0x77dc, - 0x7802, 0x7814, 0x780c, 0x780d, 0x7946, 0x7949, 0x7948, 0x7947, - 0x79b9, 0x79ba, 0x79d1, 0x79d2, 0x79cb, 0x7a7f, 0x7a81, 0x7aff, - 0x7afd, 0x7c7d, 0x7d02, 0x7d05, 0x7d00, 0x7d09, 0x7d07, 0x7d04, - 0x7d06, 0x7f38, 0x7f8e, 0x7fbf, 0x8004, - /* 0xad */ - 0x8010, 0x800d, 0x8011, 0x8036, 0x80d6, 0x80e5, 0x80da, 0x80c3, - 0x80c4, 0x80cc, 0x80e1, 0x80db, 0x80ce, 0x80de, 0x80e4, 0x80dd, - 0x81f4, 0x8222, 0x82e7, 0x8303, 0x8305, 0x82e3, 0x82db, 0x82e6, - 0x8304, 0x82e5, 0x8302, 0x8309, 0x82d2, 0x82d7, 0x82f1, 0x8301, - 0x82dc, 0x82d4, 0x82d1, 0x82de, 0x82d3, 0x82df, 0x82ef, 0x8306, - 0x8650, 0x8679, 0x867b, 0x867a, 0x884d, 0x886b, 0x8981, 0x89d4, - 0x8a08, 0x8a02, 0x8a03, 0x8c9e, 0x8ca0, 0x8d74, 0x8d73, 0x8db4, - 0x8ecd, 0x8ecc, 0x8ff0, 0x8fe6, 0x8fe2, 0x8fea, 0x8fe5, 0x8fed, - 0x8feb, 0x8fe4, 0x8fe8, 0x90ca, 0x90ce, 0x90c1, 0x90c3, 0x914b, - 0x914a, 0x91cd, 0x9582, 0x9650, 0x964b, 0x964c, 0x964d, 0x9762, - 0x9769, 0x97cb, 0x97ed, 0x97f3, 0x9801, 0x98a8, 0x98db, 0x98df, - 0x9996, 0x9999, 0x4e58, 0x4eb3, 0x500c, 0x500d, 0x5023, 0x4fef, - 0x5026, 0x5025, 0x4ff8, 0x5029, 0x5016, 0x5006, 0x503c, 0x501f, - 0x501a, 0x5012, 0x5011, 0x4ffa, 0x5000, 0x5014, 0x5028, 0x4ff1, - 0x5021, 0x500b, 0x5019, 0x5018, 0x4ff3, 0x4fee, 0x502d, 0x502a, - 0x4ffe, 0x502b, 0x5009, 0x517c, 0x51a4, 0x51a5, 0x51a2, 0x51cd, - 0x51cc, 0x51c6, 0x51cb, 0x5256, 0x525c, 0x5254, 0x525b, 0x525d, - 0x532a, 0x537f, 0x539f, 0x539d, 0x53df, 0x54e8, 0x5510, 0x5501, - 0x5537, 0x54fc, 0x54e5, 0x54f2, 0x5506, 0x54fa, 0x5514, 0x54e9, - 0x54ed, 0x54e1, 0x5509, 0x54ee, 0x54ea, - /* 0xae */ - 0x54e6, 0x5527, 0x5507, 0x54fd, 0x550f, 0x5703, 0x5704, 0x57c2, - 0x57d4, 0x57cb, 0x57c3, 0x5809, 0x590f, 0x5957, 0x5958, 0x595a, - 0x5a11, 0x5a18, 0x5a1c, 0x5a1f, 0x5a1b, 0x5a13, 0x59ec, 0x5a20, - 0x5a23, 0x5a29, 0x5a25, 0x5a0c, 0x5a09, 0x5b6b, 0x5c58, 0x5bb0, - 0x5bb3, 0x5bb6, 0x5bb4, 0x5bae, 0x5bb5, 0x5bb9, 0x5bb8, 0x5c04, - 0x5c51, 0x5c55, 0x5c50, 0x5ced, 0x5cfd, 0x5cfb, 0x5cea, 0x5ce8, - 0x5cf0, 0x5cf6, 0x5d01, 0x5cf4, 0x5dee, 0x5e2d, 0x5e2b, 0x5eab, - 0x5ead, 0x5ea7, 0x5f31, 0x5f92, 0x5f91, 0x5f90, 0x6059, 0x6063, - 0x6065, 0x6050, 0x6055, 0x606d, 0x6069, 0x606f, 0x6084, 0x609f, - 0x609a, 0x608d, 0x6094, 0x608c, 0x6085, 0x6096, 0x6247, 0x62f3, - 0x6308, 0x62ff, 0x634e, 0x633e, 0x632f, 0x6355, 0x6342, 0x6346, - 0x634f, 0x6349, 0x633a, 0x6350, 0x633d, 0x632a, 0x632b, 0x6328, - 0x634d, 0x634c, 0x6548, 0x6549, 0x6599, 0x65c1, 0x65c5, 0x6642, - 0x6649, 0x664f, 0x6643, 0x6652, 0x664c, 0x6645, 0x6641, 0x66f8, - 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, 0x6846, 0x6853, - 0x6839, 0x6842, 0x6854, 0x6829, 0x68b3, 0x6817, 0x684c, 0x6851, - 0x683d, 0x67f4, 0x6850, 0x6840, 0x683c, 0x6843, 0x682a, 0x6845, - 0x6813, 0x6818, 0x6841, 0x6b8a, 0x6b89, 0x6bb7, 0x6c23, 0x6c27, - 0x6c28, 0x6c26, 0x6c24, 0x6cf0, 0x6d6a, 0x6d95, 0x6d88, 0x6d87, - 0x6d66, 0x6d78, 0x6d77, 0x6d59, 0x6d93, - /* 0xaf */ - 0x6d6c, 0x6d89, 0x6d6e, 0x6d5a, 0x6d74, 0x6d69, 0x6d8c, 0x6d8a, - 0x6d79, 0x6d85, 0x6d65, 0x6d94, 0x70ca, 0x70d8, 0x70e4, 0x70d9, - 0x70c8, 0x70cf, 0x7239, 0x7279, 0x72fc, 0x72f9, 0x72fd, 0x72f8, - 0x72f7, 0x7386, 0x73ed, 0x7409, 0x73ee, 0x73e0, 0x73ea, 0x73de, - 0x7554, 0x755d, 0x755c, 0x755a, 0x7559, 0x75be, 0x75c5, 0x75c7, - 0x75b2, 0x75b3, 0x75bd, 0x75bc, 0x75b9, 0x75c2, 0x75b8, 0x768b, - 0x76b0, 0x76ca, 0x76cd, 0x76ce, 0x7729, 0x771f, 0x7720, 0x7728, - 0x77e9, 0x7830, 0x7827, 0x7838, 0x781d, 0x7834, 0x7837, 0x7825, - 0x782d, 0x7820, 0x781f, 0x7832, 0x7955, 0x7950, 0x7960, 0x795f, - 0x7956, 0x795e, 0x795d, 0x7957, 0x795a, 0x79e4, 0x79e3, 0x79e7, - 0x79df, 0x79e6, 0x79e9, 0x79d8, 0x7a84, 0x7a88, 0x7ad9, 0x7b06, - 0x7b11, 0x7c89, 0x7d21, 0x7d17, 0x7d0b, 0x7d0a, 0x7d20, 0x7d22, - 0x7d14, 0x7d10, 0x7d15, 0x7d1a, 0x7d1c, 0x7d0d, 0x7d19, 0x7d1b, - 0x7f3a, 0x7f5f, 0x7f94, 0x7fc5, 0x7fc1, 0x8006, 0x8018, 0x8015, - 0x8019, 0x8017, 0x803d, 0x803f, 0x80f1, 0x8102, 0x80f0, 0x8105, - 0x80ed, 0x80f4, 0x8106, 0x80f8, 0x80f3, 0x8108, 0x80fd, 0x810a, - 0x80fc, 0x80ef, 0x81ed, 0x81ec, 0x8200, 0x8210, 0x822a, 0x822b, - 0x8228, 0x822c, 0x82bb, 0x832b, 0x8352, 0x8354, 0x834a, 0x8338, - 0x8350, 0x8349, 0x8335, 0x8334, 0x834f, 0x8332, 0x8339, 0x8336, - 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, - /* 0xb0 */ - 0x8654, 0x868a, 0x86aa, 0x8693, 0x86a4, 0x86a9, 0x868c, 0x86a3, - 0x869c, 0x8870, 0x8877, 0x8881, 0x8882, 0x887d, 0x8879, 0x8a18, - 0x8a10, 0x8a0e, 0x8a0c, 0x8a15, 0x8a0a, 0x8a17, 0x8a13, 0x8a16, - 0x8a0f, 0x8a11, 0x8c48, 0x8c7a, 0x8c79, 0x8ca1, 0x8ca2, 0x8d77, - 0x8eac, 0x8ed2, 0x8ed4, 0x8ecf, 0x8fb1, 0x9001, 0x9006, 0x8ff7, - 0x9000, 0x8ffa, 0x8ff4, 0x9003, 0x8ffd, 0x9005, 0x8ff8, 0x9095, - 0x90e1, 0x90dd, 0x90e2, 0x9152, 0x914d, 0x914c, 0x91d8, 0x91dd, - 0x91d7, 0x91dc, 0x91d9, 0x9583, 0x9662, 0x9663, 0x9661, 0x965b, - 0x965d, 0x9664, 0x9658, 0x965e, 0x96bb, 0x98e2, 0x99ac, 0x9aa8, - 0x9ad8, 0x9b25, 0x9b32, 0x9b3c, 0x4e7e, 0x507a, 0x507d, 0x505c, - 0x5047, 0x5043, 0x504c, 0x505a, 0x5049, 0x5065, 0x5076, 0x504e, - 0x5055, 0x5075, 0x5074, 0x5077, 0x504f, 0x500f, 0x506f, 0x506d, - 0x515c, 0x5195, 0x51f0, 0x526a, 0x526f, 0x52d2, 0x52d9, 0x52d8, - 0x52d5, 0x5310, 0x530f, 0x5319, 0x533f, 0x5340, 0x533e, 0x53c3, - 0x66fc, 0x5546, 0x556a, 0x5566, 0x5544, 0x555e, 0x5561, 0x5543, - 0x554a, 0x5531, 0x5556, 0x554f, 0x5555, 0x552f, 0x5564, 0x5538, - 0x552e, 0x555c, 0x552c, 0x5563, 0x5533, 0x5541, 0x5557, 0x5708, - 0x570b, 0x5709, 0x57df, 0x5805, 0x580a, 0x5806, 0x57e0, 0x57e4, - 0x57fa, 0x5802, 0x5835, 0x57f7, 0x57f9, 0x5920, 0x5962, 0x5a36, - 0x5a41, 0x5a49, 0x5a66, 0x5a6a, 0x5a40, - /* 0xb1 */ - 0x5a3c, 0x5a62, 0x5a5a, 0x5a46, 0x5a4a, 0x5b70, 0x5bc7, 0x5bc5, - 0x5bc4, 0x5bc2, 0x5bbf, 0x5bc6, 0x5c09, 0x5c08, 0x5c07, 0x5c60, - 0x5c5c, 0x5c5d, 0x5d07, 0x5d06, 0x5d0e, 0x5d1b, 0x5d16, 0x5d22, - 0x5d11, 0x5d29, 0x5d14, 0x5d19, 0x5d24, 0x5d27, 0x5d17, 0x5de2, - 0x5e38, 0x5e36, 0x5e33, 0x5e37, 0x5eb7, 0x5eb8, 0x5eb6, 0x5eb5, - 0x5ebe, 0x5f35, 0x5f37, 0x5f57, 0x5f6c, 0x5f69, 0x5f6b, 0x5f97, - 0x5f99, 0x5f9e, 0x5f98, 0x5fa1, 0x5fa0, 0x5f9c, 0x607f, 0x60a3, - 0x6089, 0x60a0, 0x60a8, 0x60cb, 0x60b4, 0x60e6, 0x60bd, 0x60c5, - 0x60bb, 0x60b5, 0x60dc, 0x60bc, 0x60d8, 0x60d5, 0x60c6, 0x60df, - 0x60b8, 0x60da, 0x60c7, 0x621a, 0x621b, 0x6248, 0x63a0, 0x63a7, - 0x6372, 0x6396, 0x63a2, 0x63a5, 0x6377, 0x6367, 0x6398, 0x63aa, - 0x6371, 0x63a9, 0x6389, 0x6383, 0x639b, 0x636b, 0x63a8, 0x6384, - 0x6388, 0x6399, 0x63a1, 0x63ac, 0x6392, 0x638f, 0x6380, 0x637b, - 0x6369, 0x6368, 0x637a, 0x655d, 0x6556, 0x6551, 0x6559, 0x6557, - 0x555f, 0x654f, 0x6558, 0x6555, 0x6554, 0x659c, 0x659b, 0x65ac, - 0x65cf, 0x65cb, 0x65cc, 0x65ce, 0x665d, 0x665a, 0x6664, 0x6668, - 0x6666, 0x665e, 0x66f9, 0x52d7, 0x671b, 0x6881, 0x68af, 0x68a2, - 0x6893, 0x68b5, 0x687f, 0x6876, 0x68b1, 0x68a7, 0x6897, 0x68b0, - 0x6883, 0x68c4, 0x68ad, 0x6886, 0x6885, 0x6894, 0x689d, 0x68a8, - 0x689f, 0x68a1, 0x6882, 0x6b32, 0x6bba, - /* 0xb2 */ - 0x6beb, 0x6bec, 0x6c2b, 0x6d8e, 0x6dbc, 0x6df3, 0x6dd9, 0x6db2, - 0x6de1, 0x6dcc, 0x6de4, 0x6dfb, 0x6dfa, 0x6e05, 0x6dc7, 0x6dcb, - 0x6daf, 0x6dd1, 0x6dae, 0x6dde, 0x6df9, 0x6db8, 0x6df7, 0x6df5, - 0x6dc5, 0x6dd2, 0x6e1a, 0x6db5, 0x6dda, 0x6deb, 0x6dd8, 0x6dea, - 0x6df1, 0x6dee, 0x6de8, 0x6dc6, 0x6dc4, 0x6daa, 0x6dec, 0x6dbf, - 0x6de6, 0x70f9, 0x7109, 0x710a, 0x70fd, 0x70ef, 0x723d, 0x727d, - 0x7281, 0x731c, 0x731b, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, - 0x740a, 0x7403, 0x7406, 0x73fe, 0x740d, 0x74e0, 0x74f6, 0x74f7, - 0x751c, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, 0x758f, 0x75d4, - 0x75d5, 0x75b5, 0x75ca, 0x75cd, 0x768e, 0x76d4, 0x76d2, 0x76db, - 0x7737, 0x773e, 0x773c, 0x7736, 0x7738, 0x773a, 0x786b, 0x7843, - 0x784e, 0x7965, 0x7968, 0x796d, 0x79fb, 0x7a92, 0x7a95, 0x7b20, - 0x7b28, 0x7b1b, 0x7b2c, 0x7b26, 0x7b19, 0x7b1e, 0x7b2e, 0x7c92, - 0x7c97, 0x7c95, 0x7d46, 0x7d43, 0x7d71, 0x7d2e, 0x7d39, 0x7d3c, - 0x7d40, 0x7d30, 0x7d33, 0x7d44, 0x7d2f, 0x7d42, 0x7d32, 0x7d31, - 0x7f3d, 0x7f9e, 0x7f9a, 0x7fcc, 0x7fce, 0x7fd2, 0x801c, 0x804a, - 0x8046, 0x812f, 0x8116, 0x8123, 0x812b, 0x8129, 0x8130, 0x8124, - 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838e, 0x839e, 0x8398, - 0x8378, 0x83a2, 0x8396, 0x83bd, 0x83ab, 0x8392, 0x838a, 0x8393, - 0x8389, 0x83a0, 0x8377, 0x837b, 0x837c, - /* 0xb3 */ - 0x8386, 0x83a7, 0x8655, 0x5f6a, 0x86c7, 0x86c0, 0x86b6, 0x86c4, - 0x86b5, 0x86c6, 0x86cb, 0x86b1, 0x86af, 0x86c9, 0x8853, 0x889e, - 0x8888, 0x88ab, 0x8892, 0x8896, 0x888d, 0x888b, 0x8993, 0x898f, - 0x8a2a, 0x8a1d, 0x8a23, 0x8a25, 0x8a31, 0x8a2d, 0x8a1f, 0x8a1b, - 0x8a22, 0x8c49, 0x8c5a, 0x8ca9, 0x8cac, 0x8cab, 0x8ca8, 0x8caa, - 0x8ca7, 0x8d67, 0x8d66, 0x8dbe, 0x8dba, 0x8edb, 0x8edf, 0x9019, - 0x900d, 0x901a, 0x9017, 0x9023, 0x901f, 0x901d, 0x9010, 0x9015, - 0x901e, 0x9020, 0x900f, 0x9022, 0x9016, 0x901b, 0x9014, 0x90e8, - 0x90ed, 0x90fd, 0x9157, 0x91ce, 0x91f5, 0x91e6, 0x91e3, 0x91e7, - 0x91ed, 0x91e9, 0x9589, 0x966a, 0x9675, 0x9673, 0x9678, 0x9670, - 0x9674, 0x9676, 0x9677, 0x966c, 0x96c0, 0x96ea, 0x96e9, 0x7ae0, - 0x7adf, 0x9802, 0x9803, 0x9b5a, 0x9ce5, 0x9e75, 0x9e7f, 0x9ea5, - 0x9ebb, 0x50a2, 0x508d, 0x5085, 0x5099, 0x5091, 0x5080, 0x5096, - 0x5098, 0x509a, 0x6700, 0x51f1, 0x5272, 0x5274, 0x5275, 0x5269, - 0x52de, 0x52dd, 0x52db, 0x535a, 0x53a5, 0x557b, 0x5580, 0x55a7, - 0x557c, 0x558a, 0x559d, 0x5598, 0x5582, 0x559c, 0x55aa, 0x5594, - 0x5587, 0x558b, 0x5583, 0x55b3, 0x55ae, 0x559f, 0x553e, 0x55b2, - 0x559a, 0x55bb, 0x55ac, 0x55b1, 0x557e, 0x5589, 0x55ab, 0x5599, - 0x570d, 0x582f, 0x582a, 0x5834, 0x5824, 0x5830, 0x5831, 0x5821, - 0x581d, 0x5820, 0x58f9, 0x58fa, 0x5960, - /* 0xb4 */ - 0x5a77, 0x5a9a, 0x5a7f, 0x5a92, 0x5a9b, 0x5aa7, 0x5b73, 0x5b71, - 0x5bd2, 0x5bcc, 0x5bd3, 0x5bd0, 0x5c0a, 0x5c0b, 0x5c31, 0x5d4c, - 0x5d50, 0x5d34, 0x5d47, 0x5dfd, 0x5e45, 0x5e3d, 0x5e40, 0x5e43, - 0x5e7e, 0x5eca, 0x5ec1, 0x5ec2, 0x5ec4, 0x5f3c, 0x5f6d, 0x5fa9, - 0x5faa, 0x5fa8, 0x60d1, 0x60e1, 0x60b2, 0x60b6, 0x60e0, 0x611c, - 0x6123, 0x60fa, 0x6115, 0x60f0, 0x60fb, 0x60f4, 0x6168, 0x60f1, - 0x610e, 0x60f6, 0x6109, 0x6100, 0x6112, 0x621f, 0x6249, 0x63a3, - 0x638c, 0x63cf, 0x63c0, 0x63e9, 0x63c9, 0x63c6, 0x63cd, 0x63d2, - 0x63e3, 0x63d0, 0x63e1, 0x63d6, 0x63ed, 0x63ee, 0x6376, 0x63f4, - 0x63ea, 0x63db, 0x6452, 0x63da, 0x63f9, 0x655e, 0x6566, 0x6562, - 0x6563, 0x6591, 0x6590, 0x65af, 0x666e, 0x6670, 0x6674, 0x6676, - 0x666f, 0x6691, 0x667a, 0x667e, 0x6677, 0x66fe, 0x66ff, 0x671f, - 0x671d, 0x68fa, 0x68d5, 0x68e0, 0x68d8, 0x68d7, 0x6905, 0x68df, - 0x68f5, 0x68ee, 0x68e7, 0x68f9, 0x68d2, 0x68f2, 0x68e3, 0x68cb, - 0x68cd, 0x690d, 0x6912, 0x690e, 0x68c9, 0x68da, 0x696e, 0x68fb, - 0x6b3e, 0x6b3a, 0x6b3d, 0x6b98, 0x6b96, 0x6bbc, 0x6bef, 0x6c2e, - 0x6c2f, 0x6c2c, 0x6e2f, 0x6e38, 0x6e54, 0x6e21, 0x6e32, 0x6e67, - 0x6e4a, 0x6e20, 0x6e25, 0x6e23, 0x6e1b, 0x6e5b, 0x6e58, 0x6e24, - 0x6e56, 0x6e6e, 0x6e2d, 0x6e26, 0x6e6f, 0x6e34, 0x6e4d, 0x6e3a, - 0x6e2c, 0x6e43, 0x6e1d, 0x6e3e, 0x6ecb, - /* 0xb5 */ - 0x6e89, 0x6e19, 0x6e4e, 0x6e63, 0x6e44, 0x6e72, 0x6e69, 0x6e5f, - 0x7119, 0x711a, 0x7126, 0x7130, 0x7121, 0x7136, 0x716e, 0x711c, - 0x724c, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743a, - 0x742a, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742f, - 0x741b, 0x7426, 0x7428, 0x7525, 0x7526, 0x756b, 0x756a, 0x75e2, - 0x75db, 0x75e3, 0x75d9, 0x75d8, 0x75de, 0x75e0, 0x767b, 0x767c, - 0x7696, 0x7693, 0x76b4, 0x76dc, 0x774f, 0x77ed, 0x785d, 0x786c, - 0x786f, 0x7a0d, 0x7a08, 0x7a0b, 0x7a05, 0x7a00, 0x7a98, 0x7a97, - 0x7a96, 0x7ae5, 0x7ae3, 0x7b49, 0x7b56, 0x7b46, 0x7b50, 0x7b52, - 0x7b54, 0x7b4d, 0x7b4b, 0x7b4f, 0x7b51, 0x7c9f, 0x7ca5, 0x7d5e, - 0x7d50, 0x7d68, 0x7d55, 0x7d2b, 0x7d6e, 0x7d72, 0x7d61, 0x7d66, - 0x7d62, 0x7d70, 0x7d73, 0x5584, 0x7fd4, 0x7fd5, 0x800b, 0x8052, - 0x8085, 0x8155, 0x8154, 0x814b, 0x8151, 0x814e, 0x8139, 0x8146, - 0x813e, 0x814c, 0x8153, 0x8174, 0x8212, 0x821c, 0x83e9, 0x8403, - 0x83f8, 0x840d, 0x83e0, 0x83c5, 0x840b, 0x83c1, 0x83ef, 0x83f1, - 0x83f4, 0x8457, 0x840a, 0x83f0, 0x840c, 0x83cc, 0x83fd, 0x83f2, - 0x83ca, 0x8438, 0x840e, 0x8404, 0x83dc, 0x8407, 0x83d4, 0x83df, - 0x865b, 0x86df, 0x86d9, 0x86ed, 0x86d4, 0x86db, 0x86e4, 0x86d0, - 0x86de, 0x8857, 0x88c1, 0x88c2, 0x88b1, 0x8983, 0x8996, 0x8a3b, - 0x8a60, 0x8a55, 0x8a5e, 0x8a3c, 0x8a41, - /* 0xb6 */ - 0x8a54, 0x8a5b, 0x8a50, 0x8a46, 0x8a34, 0x8a3a, 0x8a36, 0x8a56, - 0x8c61, 0x8c82, 0x8caf, 0x8cbc, 0x8cb3, 0x8cbd, 0x8cc1, 0x8cbb, - 0x8cc0, 0x8cb4, 0x8cb7, 0x8cb6, 0x8cbf, 0x8cb8, 0x8d8a, 0x8d85, - 0x8d81, 0x8dce, 0x8ddd, 0x8dcb, 0x8dda, 0x8dd1, 0x8dcc, 0x8ddb, - 0x8dc6, 0x8efb, 0x8ef8, 0x8efc, 0x8f9c, 0x902e, 0x9035, 0x9031, - 0x9038, 0x9032, 0x9036, 0x9102, 0x90f5, 0x9109, 0x90fe, 0x9163, - 0x9165, 0x91cf, 0x9214, 0x9215, 0x9223, 0x9209, 0x921e, 0x920d, - 0x9210, 0x9207, 0x9211, 0x9594, 0x958f, 0x958b, 0x9591, 0x9593, - 0x9592, 0x958e, 0x968a, 0x968e, 0x968b, 0x967d, 0x9685, 0x9686, - 0x968d, 0x9672, 0x9684, 0x96c1, 0x96c5, 0x96c4, 0x96c6, 0x96c7, - 0x96ef, 0x96f2, 0x97cc, 0x9805, 0x9806, 0x9808, 0x98e7, 0x98ea, - 0x98ef, 0x98e9, 0x98f2, 0x98ed, 0x99ae, 0x99ad, 0x9ec3, 0x9ecd, - 0x9ed1, 0x4e82, 0x50ad, 0x50b5, 0x50b2, 0x50b3, 0x50c5, 0x50be, - 0x50ac, 0x50b7, 0x50bb, 0x50af, 0x50c7, 0x527f, 0x5277, 0x527d, - 0x52df, 0x52e6, 0x52e4, 0x52e2, 0x52e3, 0x532f, 0x55df, 0x55e8, - 0x55d3, 0x55e6, 0x55ce, 0x55dc, 0x55c7, 0x55d1, 0x55e3, 0x55e4, - 0x55ef, 0x55da, 0x55e1, 0x55c5, 0x55c6, 0x55e5, 0x55c9, 0x5712, - 0x5713, 0x585e, 0x5851, 0x5858, 0x5857, 0x585a, 0x5854, 0x586b, - 0x584c, 0x586d, 0x584a, 0x5862, 0x5852, 0x584b, 0x5967, 0x5ac1, - 0x5ac9, 0x5acc, 0x5abe, 0x5abd, 0x5abc, - /* 0xb7 */ - 0x5ab3, 0x5ac2, 0x5ab2, 0x5d69, 0x5d6f, 0x5e4c, 0x5e79, 0x5ec9, - 0x5ec8, 0x5f12, 0x5f59, 0x5fac, 0x5fae, 0x611a, 0x610f, 0x6148, - 0x611f, 0x60f3, 0x611b, 0x60f9, 0x6101, 0x6108, 0x614e, 0x614c, - 0x6144, 0x614d, 0x613e, 0x6134, 0x6127, 0x610d, 0x6106, 0x6137, - 0x6221, 0x6222, 0x6413, 0x643e, 0x641e, 0x642a, 0x642d, 0x643d, - 0x642c, 0x640f, 0x641c, 0x6414, 0x640d, 0x6436, 0x6416, 0x6417, - 0x6406, 0x656c, 0x659f, 0x65b0, 0x6697, 0x6689, 0x6687, 0x6688, - 0x6696, 0x6684, 0x6698, 0x668d, 0x6703, 0x6994, 0x696d, 0x695a, - 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, 0x694a, 0x6968, - 0x696b, 0x695e, 0x6953, 0x6979, 0x6986, 0x695d, 0x6963, 0x695b, - 0x6b47, 0x6b72, 0x6bc0, 0x6bbf, 0x6bd3, 0x6bfd, 0x6ea2, 0x6eaf, - 0x6ed3, 0x6eb6, 0x6ec2, 0x6e90, 0x6e9d, 0x6ec7, 0x6ec5, 0x6ea5, - 0x6e98, 0x6ebc, 0x6eba, 0x6eab, 0x6ed1, 0x6e96, 0x6e9c, 0x6ec4, - 0x6ed4, 0x6eaa, 0x6ea7, 0x6eb4, 0x714e, 0x7159, 0x7169, 0x7164, - 0x7149, 0x7167, 0x715c, 0x716c, 0x7166, 0x714c, 0x7165, 0x715e, - 0x7146, 0x7168, 0x7156, 0x723a, 0x7252, 0x7337, 0x7345, 0x733f, - 0x733e, 0x746f, 0x745a, 0x7455, 0x745f, 0x745e, 0x7441, 0x743f, - 0x7459, 0x745b, 0x745c, 0x7576, 0x7578, 0x7600, 0x75f0, 0x7601, - 0x75f2, 0x75f1, 0x75fa, 0x75ff, 0x75f4, 0x75f3, 0x76de, 0x76df, - 0x775b, 0x776b, 0x7766, 0x775e, 0x7763, - /* 0xb8 */ - 0x7779, 0x776a, 0x776c, 0x775c, 0x7765, 0x7768, 0x7762, 0x77ee, - 0x788e, 0x78b0, 0x7897, 0x7898, 0x788c, 0x7889, 0x787c, 0x7891, - 0x7893, 0x787f, 0x797a, 0x797f, 0x7981, 0x842c, 0x79bd, 0x7a1c, - 0x7a1a, 0x7a20, 0x7a14, 0x7a1f, 0x7a1e, 0x7a9f, 0x7aa0, 0x7b77, - 0x7bc0, 0x7b60, 0x7b6e, 0x7b67, 0x7cb1, 0x7cb3, 0x7cb5, 0x7d93, - 0x7d79, 0x7d91, 0x7d81, 0x7d8f, 0x7d5b, 0x7f6e, 0x7f69, 0x7f6a, - 0x7f72, 0x7fa9, 0x7fa8, 0x7fa4, 0x8056, 0x8058, 0x8086, 0x8084, - 0x8171, 0x8170, 0x8178, 0x8165, 0x816e, 0x8173, 0x816b, 0x8179, - 0x817a, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, 0x843d, 0x8431, - 0x8475, 0x8466, 0x846b, 0x8449, 0x846c, 0x845b, 0x843c, 0x8435, - 0x8461, 0x8463, 0x8469, 0x846d, 0x8446, 0x865e, 0x865c, 0x865f, - 0x86f9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86fe, 0x86fb, 0x8702, - 0x8703, 0x8706, 0x870a, 0x8859, 0x88df, 0x88d4, 0x88d9, 0x88dc, - 0x88d8, 0x88dd, 0x88e1, 0x88ca, 0x88d5, 0x88d2, 0x899c, 0x89e3, - 0x8a6b, 0x8a72, 0x8a73, 0x8a66, 0x8a69, 0x8a70, 0x8a87, 0x8a7c, - 0x8a63, 0x8aa0, 0x8a71, 0x8a85, 0x8a6d, 0x8a62, 0x8a6e, 0x8a6c, - 0x8a79, 0x8a7b, 0x8a3e, 0x8a68, 0x8c62, 0x8c8a, 0x8c89, 0x8cca, - 0x8cc7, 0x8cc8, 0x8cc4, 0x8cb2, 0x8cc3, 0x8cc2, 0x8cc5, 0x8de1, - 0x8ddf, 0x8de8, 0x8def, 0x8df3, 0x8dfa, 0x8dea, 0x8de4, 0x8de6, - 0x8eb2, 0x8f03, 0x8f09, 0x8efe, 0x8f0a, - /* 0xb9 */ - 0x8f9f, 0x8fb2, 0x904b, 0x904a, 0x9053, 0x9042, 0x9054, 0x903c, - 0x9055, 0x9050, 0x9047, 0x904f, 0x904e, 0x904d, 0x9051, 0x903e, - 0x9041, 0x9112, 0x9117, 0x916c, 0x916a, 0x9169, 0x91c9, 0x9237, - 0x9257, 0x9238, 0x923d, 0x9240, 0x923e, 0x925b, 0x924b, 0x9264, - 0x9251, 0x9234, 0x9249, 0x924d, 0x9245, 0x9239, 0x923f, 0x925a, - 0x9598, 0x9698, 0x9694, 0x9695, 0x96cd, 0x96cb, 0x96c9, 0x96ca, - 0x96f7, 0x96fb, 0x96f9, 0x96f6, 0x9756, 0x9774, 0x9776, 0x9810, - 0x9811, 0x9813, 0x980a, 0x9812, 0x980c, 0x98fc, 0x98f4, 0x98fd, - 0x98fe, 0x99b3, 0x99b1, 0x99b4, 0x9ae1, 0x9ce9, 0x9e82, 0x9f0e, - 0x9f13, 0x9f20, 0x50e7, 0x50ee, 0x50e5, 0x50d6, 0x50ed, 0x50da, - 0x50d5, 0x50cf, 0x50d1, 0x50f1, 0x50ce, 0x50e9, 0x5162, 0x51f3, - 0x5283, 0x5282, 0x5331, 0x53ad, 0x55fe, 0x5600, 0x561b, 0x5617, - 0x55fd, 0x5614, 0x5606, 0x5609, 0x560d, 0x560e, 0x55f7, 0x5616, - 0x561f, 0x5608, 0x5610, 0x55f6, 0x5718, 0x5716, 0x5875, 0x587e, - 0x5883, 0x5893, 0x588a, 0x5879, 0x5885, 0x587d, 0x58fd, 0x5925, - 0x5922, 0x5924, 0x596a, 0x5969, 0x5ae1, 0x5ae6, 0x5ae9, 0x5ad7, - 0x5ad6, 0x5ad8, 0x5ae3, 0x5b75, 0x5bde, 0x5be7, 0x5be1, 0x5be5, - 0x5be6, 0x5be8, 0x5be2, 0x5be4, 0x5bdf, 0x5c0d, 0x5c62, 0x5d84, - 0x5d87, 0x5e5b, 0x5e63, 0x5e55, 0x5e57, 0x5e54, 0x5ed3, 0x5ed6, - 0x5f0a, 0x5f46, 0x5f70, 0x5fb9, 0x6147, - /* 0xba */ - 0x613f, 0x614b, 0x6177, 0x6162, 0x6163, 0x615f, 0x615a, 0x6158, - 0x6175, 0x622a, 0x6487, 0x6458, 0x6454, 0x64a4, 0x6478, 0x645f, - 0x647a, 0x6451, 0x6467, 0x6434, 0x646d, 0x647b, 0x6572, 0x65a1, - 0x65d7, 0x65d6, 0x66a2, 0x66a8, 0x669d, 0x699c, 0x69a8, 0x6995, - 0x69c1, 0x69ae, 0x69d3, 0x69cb, 0x699b, 0x69b7, 0x69bb, 0x69ab, - 0x69b4, 0x69d0, 0x69cd, 0x69ad, 0x69cc, 0x69a6, 0x69c3, 0x69a3, - 0x6b49, 0x6b4c, 0x6c33, 0x6f33, 0x6f14, 0x6efe, 0x6f13, 0x6ef4, - 0x6f29, 0x6f3e, 0x6f20, 0x6f2c, 0x6f0f, 0x6f02, 0x6f22, 0x6eff, - 0x6eef, 0x6f06, 0x6f31, 0x6f38, 0x6f32, 0x6f23, 0x6f15, 0x6f2b, - 0x6f2f, 0x6f88, 0x6f2a, 0x6eec, 0x6f01, 0x6ef2, 0x6ecc, 0x6ef7, - 0x7194, 0x7199, 0x717d, 0x718a, 0x7184, 0x7192, 0x723e, 0x7292, - 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746a, 0x7470, 0x746d, - 0x7504, 0x7591, 0x7627, 0x760d, 0x760b, 0x7609, 0x7613, 0x76e1, - 0x76e3, 0x7784, 0x777d, 0x777f, 0x7761, 0x78c1, 0x789f, 0x78a7, - 0x78b3, 0x78a9, 0x78a3, 0x798e, 0x798f, 0x798d, 0x7a2e, 0x7a31, - 0x7aaa, 0x7aa9, 0x7aed, 0x7aef, 0x7ba1, 0x7b95, 0x7b8b, 0x7b75, - 0x7b97, 0x7b9d, 0x7b94, 0x7b8f, 0x7bb8, 0x7b87, 0x7b84, 0x7cb9, - 0x7cbd, 0x7cbe, 0x7dbb, 0x7db0, 0x7d9c, 0x7dbd, 0x7dbe, 0x7da0, - 0x7dca, 0x7db4, 0x7db2, 0x7db1, 0x7dba, 0x7da2, 0x7dbf, 0x7db5, - 0x7db8, 0x7dad, 0x7dd2, 0x7dc7, 0x7dac, - /* 0xbb */ - 0x7f70, 0x7fe0, 0x7fe1, 0x7fdf, 0x805e, 0x805a, 0x8087, 0x8150, - 0x8180, 0x818f, 0x8188, 0x818a, 0x817f, 0x8182, 0x81e7, 0x81fa, - 0x8207, 0x8214, 0x821e, 0x824b, 0x84c9, 0x84bf, 0x84c6, 0x84c4, - 0x8499, 0x849e, 0x84b2, 0x849c, 0x84cb, 0x84b8, 0x84c0, 0x84d3, - 0x8490, 0x84bc, 0x84d1, 0x84ca, 0x873f, 0x871c, 0x873b, 0x8722, - 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88f3, 0x8902, - 0x88f4, 0x88f9, 0x88f8, 0x88fd, 0x88e8, 0x891a, 0x88ef, 0x8aa6, - 0x8a8c, 0x8a9e, 0x8aa3, 0x8a8d, 0x8aa1, 0x8a93, 0x8aa4, 0x8aaa, - 0x8aa5, 0x8aa8, 0x8a98, 0x8a91, 0x8a9a, 0x8aa7, 0x8c6a, 0x8c8d, - 0x8c8c, 0x8cd3, 0x8cd1, 0x8cd2, 0x8d6b, 0x8d99, 0x8d95, 0x8dfc, - 0x8f14, 0x8f12, 0x8f15, 0x8f13, 0x8fa3, 0x9060, 0x9058, 0x905c, - 0x9063, 0x9059, 0x905e, 0x9062, 0x905d, 0x905b, 0x9119, 0x9118, - 0x911e, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, 0x9280, 0x9285, - 0x9298, 0x9296, 0x927b, 0x9293, 0x929c, 0x92a8, 0x927c, 0x9291, - 0x95a1, 0x95a8, 0x95a9, 0x95a3, 0x95a5, 0x95a4, 0x9699, 0x969c, - 0x969b, 0x96cc, 0x96d2, 0x9700, 0x977c, 0x9785, 0x97f6, 0x9817, - 0x9818, 0x98af, 0x98b1, 0x9903, 0x9905, 0x990c, 0x9909, 0x99c1, - 0x9aaf, 0x9ab0, 0x9ae6, 0x9b41, 0x9b42, 0x9cf4, 0x9cf6, 0x9cf3, - 0x9ebc, 0x9f3b, 0x9f4a, 0x5104, 0x5100, 0x50fb, 0x50f5, 0x50f9, - 0x5102, 0x5108, 0x5109, 0x5105, 0x51dc, - /* 0xbc */ - 0x5287, 0x5288, 0x5289, 0x528d, 0x528a, 0x52f0, 0x53b2, 0x562e, - 0x563b, 0x5639, 0x5632, 0x563f, 0x5634, 0x5629, 0x5653, 0x564e, - 0x5657, 0x5674, 0x5636, 0x562f, 0x5630, 0x5880, 0x589f, 0x589e, - 0x58b3, 0x589c, 0x58ae, 0x58a9, 0x58a6, 0x596d, 0x5b09, 0x5afb, - 0x5b0b, 0x5af5, 0x5b0c, 0x5b08, 0x5bee, 0x5bec, 0x5be9, 0x5beb, - 0x5c64, 0x5c65, 0x5d9d, 0x5d94, 0x5e62, 0x5e5f, 0x5e61, 0x5ee2, - 0x5eda, 0x5edf, 0x5edd, 0x5ee3, 0x5ee0, 0x5f48, 0x5f71, 0x5fb7, - 0x5fb5, 0x6176, 0x6167, 0x616e, 0x615d, 0x6155, 0x6182, 0x617c, - 0x6170, 0x616b, 0x617e, 0x61a7, 0x6190, 0x61ab, 0x618e, 0x61ac, - 0x619a, 0x61a4, 0x6194, 0x61ae, 0x622e, 0x6469, 0x646f, 0x6479, - 0x649e, 0x64b2, 0x6488, 0x6490, 0x64b0, 0x64a5, 0x6493, 0x6495, - 0x64a9, 0x6492, 0x64ae, 0x64ad, 0x64ab, 0x649a, 0x64ac, 0x6499, - 0x64a2, 0x64b3, 0x6575, 0x6577, 0x6578, 0x66ae, 0x66ab, 0x66b4, - 0x66b1, 0x6a23, 0x6a1f, 0x69e8, 0x6a01, 0x6a1e, 0x6a19, 0x69fd, - 0x6a21, 0x6a13, 0x6a0a, 0x69f3, 0x6a02, 0x6a05, 0x69ed, 0x6a11, - 0x6b50, 0x6b4e, 0x6ba4, 0x6bc5, 0x6bc6, 0x6f3f, 0x6f7c, 0x6f84, - 0x6f51, 0x6f66, 0x6f54, 0x6f86, 0x6f6d, 0x6f5b, 0x6f78, 0x6f6e, - 0x6f8e, 0x6f7a, 0x6f70, 0x6f64, 0x6f97, 0x6f58, 0x6ed5, 0x6f6f, - 0x6f60, 0x6f5f, 0x719f, 0x71ac, 0x71b1, 0x71a8, 0x7256, 0x729b, - 0x734e, 0x7357, 0x7469, 0x748b, 0x7483, - /* 0xbd */ - 0x747e, 0x7480, 0x757f, 0x7620, 0x7629, 0x761f, 0x7624, 0x7626, - 0x7621, 0x7622, 0x769a, 0x76ba, 0x76e4, 0x778e, 0x7787, 0x778c, - 0x7791, 0x778b, 0x78cb, 0x78c5, 0x78ba, 0x78ca, 0x78be, 0x78d5, - 0x78bc, 0x78d0, 0x7a3f, 0x7a3c, 0x7a40, 0x7a3d, 0x7a37, 0x7a3b, - 0x7aaf, 0x7aae, 0x7bad, 0x7bb1, 0x7bc4, 0x7bb4, 0x7bc6, 0x7bc7, - 0x7bc1, 0x7ba0, 0x7bcc, 0x7cca, 0x7de0, 0x7df4, 0x7def, 0x7dfb, - 0x7dd8, 0x7dec, 0x7ddd, 0x7de8, 0x7de3, 0x7dda, 0x7dde, 0x7de9, - 0x7d9e, 0x7dd9, 0x7df2, 0x7df9, 0x7f75, 0x7f77, 0x7faf, 0x7fe9, - 0x8026, 0x819b, 0x819c, 0x819d, 0x81a0, 0x819a, 0x8198, 0x8517, - 0x853d, 0x851a, 0x84ee, 0x852c, 0x852d, 0x8513, 0x8511, 0x8523, - 0x8521, 0x8514, 0x84ec, 0x8525, 0x84ff, 0x8506, 0x8782, 0x8774, - 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, 0x8757, 0x874c, - 0x8753, 0x885b, 0x885d, 0x8910, 0x8907, 0x8912, 0x8913, 0x8915, - 0x890a, 0x8abc, 0x8ad2, 0x8ac7, 0x8ac4, 0x8a95, 0x8acb, 0x8af8, - 0x8ab2, 0x8ac9, 0x8ac2, 0x8abf, 0x8ab0, 0x8ad6, 0x8acd, 0x8ab6, - 0x8ab9, 0x8adb, 0x8c4c, 0x8c4e, 0x8c6c, 0x8ce0, 0x8cde, 0x8ce6, - 0x8ce4, 0x8cec, 0x8ced, 0x8ce2, 0x8ce3, 0x8cdc, 0x8cea, 0x8ce1, - 0x8d6d, 0x8d9f, 0x8da3, 0x8e2b, 0x8e10, 0x8e1d, 0x8e22, 0x8e0f, - 0x8e29, 0x8e1f, 0x8e21, 0x8e1e, 0x8eba, 0x8f1d, 0x8f1b, 0x8f1f, - 0x8f29, 0x8f26, 0x8f2a, 0x8f1c, 0x8f1e, - /* 0xbe */ - 0x8f25, 0x9069, 0x906e, 0x9068, 0x906d, 0x9077, 0x9130, 0x912d, - 0x9127, 0x9131, 0x9187, 0x9189, 0x918b, 0x9183, 0x92c5, 0x92bb, - 0x92b7, 0x92ea, 0x92ac, 0x92e4, 0x92c1, 0x92b3, 0x92bc, 0x92d2, - 0x92c7, 0x92f0, 0x92b2, 0x95ad, 0x95b1, 0x9704, 0x9706, 0x9707, - 0x9709, 0x9760, 0x978d, 0x978b, 0x978f, 0x9821, 0x982b, 0x981c, - 0x98b3, 0x990a, 0x9913, 0x9912, 0x9918, 0x99dd, 0x99d0, 0x99df, - 0x99db, 0x99d1, 0x99d5, 0x99d2, 0x99d9, 0x9ab7, 0x9aee, 0x9aef, - 0x9b27, 0x9b45, 0x9b44, 0x9b77, 0x9b6f, 0x9d06, 0x9d09, 0x9d03, - 0x9ea9, 0x9ebe, 0x9ece, 0x58a8, 0x9f52, 0x5112, 0x5118, 0x5114, - 0x5110, 0x5115, 0x5180, 0x51aa, 0x51dd, 0x5291, 0x5293, 0x52f3, - 0x5659, 0x566b, 0x5679, 0x5669, 0x5664, 0x5678, 0x566a, 0x5668, - 0x5665, 0x5671, 0x566f, 0x566c, 0x5662, 0x5676, 0x58c1, 0x58be, - 0x58c7, 0x58c5, 0x596e, 0x5b1d, 0x5b34, 0x5b78, 0x5bf0, 0x5c0e, - 0x5f4a, 0x61b2, 0x6191, 0x61a9, 0x618a, 0x61cd, 0x61b6, 0x61be, - 0x61ca, 0x61c8, 0x6230, 0x64c5, 0x64c1, 0x64cb, 0x64bb, 0x64bc, - 0x64da, 0x64c4, 0x64c7, 0x64c2, 0x64cd, 0x64bf, 0x64d2, 0x64d4, - 0x64be, 0x6574, 0x66c6, 0x66c9, 0x66b9, 0x66c4, 0x66c7, 0x66b8, - 0x6a3d, 0x6a38, 0x6a3a, 0x6a59, 0x6a6b, 0x6a58, 0x6a39, 0x6a44, - 0x6a62, 0x6a61, 0x6a4b, 0x6a47, 0x6a35, 0x6a5f, 0x6a48, 0x6b59, - 0x6b77, 0x6c05, 0x6fc2, 0x6fb1, 0x6fa1, - /* 0xbf */ - 0x6fc3, 0x6fa4, 0x6fc1, 0x6fa7, 0x6fb3, 0x6fc0, 0x6fb9, 0x6fb6, - 0x6fa6, 0x6fa0, 0x6fb4, 0x71be, 0x71c9, 0x71d0, 0x71d2, 0x71c8, - 0x71d5, 0x71b9, 0x71ce, 0x71d9, 0x71dc, 0x71c3, 0x71c4, 0x7368, - 0x749c, 0x74a3, 0x7498, 0x749f, 0x749e, 0x74e2, 0x750c, 0x750d, - 0x7634, 0x7638, 0x763a, 0x76e7, 0x76e5, 0x77a0, 0x779e, 0x779f, - 0x77a5, 0x78e8, 0x78da, 0x78ec, 0x78e7, 0x79a6, 0x7a4d, 0x7a4e, - 0x7a46, 0x7a4c, 0x7a4b, 0x7aba, 0x7bd9, 0x7c11, 0x7bc9, 0x7be4, - 0x7bdb, 0x7be1, 0x7be9, 0x7be6, 0x7cd5, 0x7cd6, 0x7e0a, 0x7e11, - 0x7e08, 0x7e1b, 0x7e23, 0x7e1e, 0x7e1d, 0x7e09, 0x7e10, 0x7f79, - 0x7fb2, 0x7ff0, 0x7ff1, 0x7fee, 0x8028, 0x81b3, 0x81a9, 0x81a8, - 0x81fb, 0x8208, 0x8258, 0x8259, 0x854a, 0x8559, 0x8548, 0x8568, - 0x8569, 0x8543, 0x8549, 0x856d, 0x856a, 0x855e, 0x8783, 0x879f, - 0x879e, 0x87a2, 0x878d, 0x8861, 0x892a, 0x8932, 0x8925, 0x892b, - 0x8921, 0x89aa, 0x89a6, 0x8ae6, 0x8afa, 0x8aeb, 0x8af1, 0x8b00, - 0x8adc, 0x8ae7, 0x8aee, 0x8afe, 0x8b01, 0x8b02, 0x8af7, 0x8aed, - 0x8af3, 0x8af6, 0x8afc, 0x8c6b, 0x8c6d, 0x8c93, 0x8cf4, 0x8e44, - 0x8e31, 0x8e34, 0x8e42, 0x8e39, 0x8e35, 0x8f3b, 0x8f2f, 0x8f38, - 0x8f33, 0x8fa8, 0x8fa6, 0x9075, 0x9074, 0x9078, 0x9072, 0x907c, - 0x907a, 0x9134, 0x9192, 0x9320, 0x9336, 0x92f8, 0x9333, 0x932f, - 0x9322, 0x92fc, 0x932b, 0x9304, 0x931a, - /* 0xc0 */ - 0x9310, 0x9326, 0x9321, 0x9315, 0x932e, 0x9319, 0x95bb, 0x96a7, - 0x96a8, 0x96aa, 0x96d5, 0x970e, 0x9711, 0x9716, 0x970d, 0x9713, - 0x970f, 0x975b, 0x975c, 0x9766, 0x9798, 0x9830, 0x9838, 0x983b, - 0x9837, 0x982d, 0x9839, 0x9824, 0x9910, 0x9928, 0x991e, 0x991b, - 0x9921, 0x991a, 0x99ed, 0x99e2, 0x99f1, 0x9ab8, 0x9abc, 0x9afb, - 0x9aed, 0x9b28, 0x9b91, 0x9d15, 0x9d23, 0x9d26, 0x9d28, 0x9d12, - 0x9d1b, 0x9ed8, 0x9ed4, 0x9f8d, 0x9f9c, 0x512a, 0x511f, 0x5121, - 0x5132, 0x52f5, 0x568e, 0x5680, 0x5690, 0x5685, 0x5687, 0x568f, - 0x58d5, 0x58d3, 0x58d1, 0x58ce, 0x5b30, 0x5b2a, 0x5b24, 0x5b7a, - 0x5c37, 0x5c68, 0x5dbc, 0x5dba, 0x5dbd, 0x5db8, 0x5e6b, 0x5f4c, - 0x5fbd, 0x61c9, 0x61c2, 0x61c7, 0x61e6, 0x61cb, 0x6232, 0x6234, - 0x64ce, 0x64ca, 0x64d8, 0x64e0, 0x64f0, 0x64e6, 0x64ec, 0x64f1, - 0x64e2, 0x64ed, 0x6582, 0x6583, 0x66d9, 0x66d6, 0x6a80, 0x6a94, - 0x6a84, 0x6aa2, 0x6a9c, 0x6adb, 0x6aa3, 0x6a7e, 0x6a97, 0x6a90, - 0x6aa0, 0x6b5c, 0x6bae, 0x6bda, 0x6c08, 0x6fd8, 0x6ff1, 0x6fdf, - 0x6fe0, 0x6fdb, 0x6fe4, 0x6feb, 0x6fef, 0x6f80, 0x6fec, 0x6fe1, - 0x6fe9, 0x6fd5, 0x6fee, 0x6ff0, 0x71e7, 0x71df, 0x71ee, 0x71e6, - 0x71e5, 0x71ed, 0x71ec, 0x71f4, 0x71e0, 0x7235, 0x7246, 0x7370, - 0x7372, 0x74a9, 0x74b0, 0x74a6, 0x74a8, 0x7646, 0x7642, 0x764c, - 0x76ea, 0x77b3, 0x77aa, 0x77b0, 0x77ac, - /* 0xc1 */ - 0x77a7, 0x77ad, 0x77ef, 0x78f7, 0x78fa, 0x78f4, 0x78ef, 0x7901, - 0x79a7, 0x79aa, 0x7a57, 0x7abf, 0x7c07, 0x7c0d, 0x7bfe, 0x7bf7, - 0x7c0c, 0x7be0, 0x7ce0, 0x7cdc, 0x7cde, 0x7ce2, 0x7cdf, 0x7cd9, - 0x7cdd, 0x7e2e, 0x7e3e, 0x7e46, 0x7e37, 0x7e32, 0x7e43, 0x7e2b, - 0x7e3d, 0x7e31, 0x7e45, 0x7e41, 0x7e34, 0x7e39, 0x7e48, 0x7e35, - 0x7e3f, 0x7e2f, 0x7f44, 0x7ff3, 0x7ffc, 0x8071, 0x8072, 0x8070, - 0x806f, 0x8073, 0x81c6, 0x81c3, 0x81ba, 0x81c2, 0x81c0, 0x81bf, - 0x81bd, 0x81c9, 0x81be, 0x81e8, 0x8209, 0x8271, 0x85aa, 0x8584, - 0x857e, 0x859c, 0x8591, 0x8594, 0x85af, 0x859b, 0x8587, 0x85a8, - 0x858a, 0x8667, 0x87c0, 0x87d1, 0x87b3, 0x87d2, 0x87c6, 0x87ab, - 0x87bb, 0x87ba, 0x87c8, 0x87cb, 0x893b, 0x8936, 0x8944, 0x8938, - 0x893d, 0x89ac, 0x8b0e, 0x8b17, 0x8b19, 0x8b1b, 0x8b0a, 0x8b20, - 0x8b1d, 0x8b04, 0x8b10, 0x8c41, 0x8c3f, 0x8c73, 0x8cfa, 0x8cfd, - 0x8cfc, 0x8cf8, 0x8cfb, 0x8da8, 0x8e49, 0x8e4b, 0x8e48, 0x8e4a, - 0x8f44, 0x8f3e, 0x8f42, 0x8f45, 0x8f3f, 0x907f, 0x907d, 0x9084, - 0x9081, 0x9082, 0x9080, 0x9139, 0x91a3, 0x919e, 0x919c, 0x934d, - 0x9382, 0x9328, 0x9375, 0x934a, 0x9365, 0x934b, 0x9318, 0x937e, - 0x936c, 0x935b, 0x9370, 0x935a, 0x9354, 0x95ca, 0x95cb, 0x95cc, - 0x95c8, 0x95c6, 0x96b1, 0x96b8, 0x96d6, 0x971c, 0x971e, 0x97a0, - 0x97d3, 0x9846, 0x98b6, 0x9935, 0x9a01, - /* 0xc2 */ - 0x99ff, 0x9bae, 0x9bab, 0x9baa, 0x9bad, 0x9d3b, 0x9d3f, 0x9e8b, - 0x9ecf, 0x9ede, 0x9edc, 0x9edd, 0x9edb, 0x9f3e, 0x9f4b, 0x53e2, - 0x5695, 0x56ae, 0x58d9, 0x58d8, 0x5b38, 0x5f5d, 0x61e3, 0x6233, - 0x64f4, 0x64f2, 0x64fe, 0x6506, 0x64fa, 0x64fb, 0x64f7, 0x65b7, - 0x66dc, 0x6726, 0x6ab3, 0x6aac, 0x6ac3, 0x6abb, 0x6ab8, 0x6ac2, - 0x6aae, 0x6aaf, 0x6b5f, 0x6b78, 0x6baf, 0x7009, 0x700b, 0x6ffe, - 0x7006, 0x6ffa, 0x7011, 0x700f, 0x71fb, 0x71fc, 0x71fe, 0x71f8, - 0x7377, 0x7375, 0x74a7, 0x74bf, 0x7515, 0x7656, 0x7658, 0x7652, - 0x77bd, 0x77bf, 0x77bb, 0x77bc, 0x790e, 0x79ae, 0x7a61, 0x7a62, - 0x7a60, 0x7ac4, 0x7ac5, 0x7c2b, 0x7c27, 0x7c2a, 0x7c1e, 0x7c23, - 0x7c21, 0x7ce7, 0x7e54, 0x7e55, 0x7e5e, 0x7e5a, 0x7e61, 0x7e52, - 0x7e59, 0x7f48, 0x7ff9, 0x7ffb, 0x8077, 0x8076, 0x81cd, 0x81cf, - 0x820a, 0x85cf, 0x85a9, 0x85cd, 0x85d0, 0x85c9, 0x85b0, 0x85ba, - 0x85b9, 0x85a6, 0x87ef, 0x87ec, 0x87f2, 0x87e0, 0x8986, 0x89b2, - 0x89f4, 0x8b28, 0x8b39, 0x8b2c, 0x8b2b, 0x8c50, 0x8d05, 0x8e59, - 0x8e63, 0x8e66, 0x8e64, 0x8e5f, 0x8e55, 0x8ec0, 0x8f49, 0x8f4d, - 0x9087, 0x9083, 0x9088, 0x91ab, 0x91ac, 0x91d0, 0x9394, 0x938a, - 0x9396, 0x93a2, 0x93b3, 0x93ae, 0x93ac, 0x93b0, 0x9398, 0x939a, - 0x9397, 0x95d4, 0x95d6, 0x95d0, 0x95d5, 0x96e2, 0x96dc, 0x96d9, - 0x96db, 0x96de, 0x9724, 0x97a3, 0x97a6, - /* 0xc3 */ - 0x97ad, 0x97f9, 0x984d, 0x984f, 0x984c, 0x984e, 0x9853, 0x98ba, - 0x993e, 0x993f, 0x993d, 0x992e, 0x99a5, 0x9a0e, 0x9ac1, 0x9b03, - 0x9b06, 0x9b4f, 0x9b4e, 0x9b4d, 0x9bca, 0x9bc9, 0x9bfd, 0x9bc8, - 0x9bc0, 0x9d51, 0x9d5d, 0x9d60, 0x9ee0, 0x9f15, 0x9f2c, 0x5133, - 0x56a5, 0x58de, 0x58df, 0x58e2, 0x5bf5, 0x9f90, 0x5eec, 0x61f2, - 0x61f7, 0x61f6, 0x61f5, 0x6500, 0x650f, 0x66e0, 0x66dd, 0x6ae5, - 0x6add, 0x6ada, 0x6ad3, 0x701b, 0x701f, 0x7028, 0x701a, 0x701d, - 0x7015, 0x7018, 0x7206, 0x720d, 0x7258, 0x72a2, 0x7378, 0x737a, - 0x74bd, 0x74ca, 0x74e3, 0x7587, 0x7586, 0x765f, 0x7661, 0x77c7, - 0x7919, 0x79b1, 0x7a6b, 0x7a69, 0x7c3e, 0x7c3f, 0x7c38, 0x7c3d, - 0x7c37, 0x7c40, 0x7e6b, 0x7e6d, 0x7e79, 0x7e69, 0x7e6a, 0x7f85, - 0x7e73, 0x7fb6, 0x7fb9, 0x7fb8, 0x81d8, 0x85e9, 0x85dd, 0x85ea, - 0x85d5, 0x85e4, 0x85e5, 0x85f7, 0x87fb, 0x8805, 0x880d, 0x87f9, - 0x87fe, 0x8960, 0x895f, 0x8956, 0x895e, 0x8b41, 0x8b5c, 0x8b58, - 0x8b49, 0x8b5a, 0x8b4e, 0x8b4f, 0x8b46, 0x8b59, 0x8d08, 0x8d0a, - 0x8e7c, 0x8e72, 0x8e87, 0x8e76, 0x8e6c, 0x8e7a, 0x8e74, 0x8f54, - 0x8f4e, 0x8fad, 0x908a, 0x908b, 0x91b1, 0x91ae, 0x93e1, 0x93d1, - 0x93df, 0x93c3, 0x93c8, 0x93dc, 0x93dd, 0x93d6, 0x93e2, 0x93cd, - 0x93d8, 0x93e4, 0x93d7, 0x93e8, 0x95dc, 0x96b4, 0x96e3, 0x972a, - 0x9727, 0x9761, 0x97dc, 0x97fb, 0x985e, - /* 0xc4 */ - 0x9858, 0x985b, 0x98bc, 0x9945, 0x9949, 0x9a16, 0x9a19, 0x9b0d, - 0x9be8, 0x9be7, 0x9bd6, 0x9bdb, 0x9d89, 0x9d61, 0x9d72, 0x9d6a, - 0x9d6c, 0x9e92, 0x9e97, 0x9e93, 0x9eb4, 0x52f8, 0x56a8, 0x56b7, - 0x56b6, 0x56b4, 0x56bc, 0x58e4, 0x5b40, 0x5b43, 0x5b7d, 0x5bf6, - 0x5dc9, 0x61f8, 0x61fa, 0x6518, 0x6514, 0x6519, 0x66e6, 0x6727, - 0x6aec, 0x703e, 0x7030, 0x7032, 0x7210, 0x737b, 0x74cf, 0x7662, - 0x7665, 0x7926, 0x792a, 0x792c, 0x792b, 0x7ac7, 0x7af6, 0x7c4c, - 0x7c43, 0x7c4d, 0x7cef, 0x7cf0, 0x8fae, 0x7e7d, 0x7e7c, 0x7e82, - 0x7f4c, 0x8000, 0x81da, 0x8266, 0x85fb, 0x85f9, 0x8611, 0x85fa, - 0x8606, 0x860b, 0x8607, 0x860a, 0x8814, 0x8815, 0x8964, 0x89ba, - 0x89f8, 0x8b70, 0x8b6c, 0x8b66, 0x8b6f, 0x8b5f, 0x8b6b, 0x8d0f, - 0x8d0d, 0x8e89, 0x8e81, 0x8e85, 0x8e82, 0x91b4, 0x91cb, 0x9418, - 0x9403, 0x93fd, 0x95e1, 0x9730, 0x98c4, 0x9952, 0x9951, 0x99a8, - 0x9a2b, 0x9a30, 0x9a37, 0x9a35, 0x9c13, 0x9c0d, 0x9e79, 0x9eb5, - 0x9ee8, 0x9f2f, 0x9f5f, 0x9f63, 0x9f61, 0x5137, 0x5138, 0x56c1, - 0x56c0, 0x56c2, 0x5914, 0x5c6c, 0x5dcd, 0x61fc, 0x61fe, 0x651d, - 0x651c, 0x6595, 0x66e9, 0x6afb, 0x6b04, 0x6afa, 0x6bb2, 0x704c, - 0x721b, 0x72a7, 0x74d6, 0x74d4, 0x7669, 0x77d3, 0x7c50, 0x7e8f, - 0x7e8c, 0x7fbc, 0x8617, 0x862d, 0x861a, 0x8823, 0x8822, 0x8821, - 0x881f, 0x896a, 0x896c, 0x89bd, 0x8b74, - /* 0xc5 */ - 0x8b77, 0x8b7d, 0x8d13, 0x8e8a, 0x8e8d, 0x8e8b, 0x8f5f, 0x8faf, - 0x91ba, 0x942e, 0x9433, 0x9435, 0x943a, 0x9438, 0x9432, 0x942b, - 0x95e2, 0x9738, 0x9739, 0x9732, 0x97ff, 0x9867, 0x9865, 0x9957, - 0x9a45, 0x9a43, 0x9a40, 0x9a3e, 0x9acf, 0x9b54, 0x9b51, 0x9c2d, - 0x9c25, 0x9daf, 0x9db4, 0x9dc2, 0x9db8, 0x9e9d, 0x9eef, 0x9f19, - 0x9f5c, 0x9f66, 0x9f67, 0x513c, 0x513b, 0x56c8, 0x56ca, 0x56c9, - 0x5b7f, 0x5dd4, 0x5dd2, 0x5f4e, 0x61ff, 0x6524, 0x6b0a, 0x6b61, - 0x7051, 0x7058, 0x7380, 0x74e4, 0x758a, 0x766e, 0x766c, 0x79b3, - 0x7c60, 0x7c5f, 0x807e, 0x807d, 0x81df, 0x8972, 0x896f, 0x89fc, - 0x8b80, 0x8d16, 0x8d17, 0x8e91, 0x8e93, 0x8f61, 0x9148, 0x9444, - 0x9451, 0x9452, 0x973d, 0x973e, 0x97c3, 0x97c1, 0x986b, 0x9955, - 0x9a55, 0x9a4d, 0x9ad2, 0x9b1a, 0x9c49, 0x9c31, 0x9c3e, 0x9c3b, - 0x9dd3, 0x9dd7, 0x9f34, 0x9f6c, 0x9f6a, 0x9f94, 0x56cc, 0x5dd6, - 0x6200, 0x6523, 0x652b, 0x652a, 0x66ec, 0x6b10, 0x74da, 0x7aca, - 0x7c64, 0x7c63, 0x7c65, 0x7e93, 0x7e96, 0x7e94, 0x81e2, 0x8638, - 0x863f, 0x8831, 0x8b8a, 0x9090, 0x908f, 0x9463, 0x9460, 0x9464, - 0x9768, 0x986f, 0x995c, 0x9a5a, 0x9a5b, 0x9a57, 0x9ad3, 0x9ad4, - 0x9ad1, 0x9c54, 0x9c57, 0x9c56, 0x9de5, 0x9e9f, 0x9ef4, 0x56d1, - 0x58e9, 0x652c, 0x705e, 0x7671, 0x7672, 0x77d7, 0x7f50, 0x7f88, - 0x8836, 0x8839, 0x8862, 0x8b93, 0x8b92, - /* 0xc6 */ - 0x8b96, 0x8277, 0x8d1b, 0x91c0, 0x946a, 0x9742, 0x9748, 0x9744, - 0x97c6, 0x9870, 0x9a5f, 0x9b22, 0x9b58, 0x9c5f, 0x9df9, 0x9dfa, - 0x9e7c, 0x9e7d, 0x9f07, 0x9f77, 0x9f72, 0x5ef3, 0x6b16, 0x7063, - 0x7c6c, 0x7c6e, 0x883b, 0x89c0, 0x8ea1, 0x91c1, 0x9472, 0x9470, - 0x9871, 0x995e, 0x9ad6, 0x9b23, 0x9ecc, 0x7064, 0x77da, 0x8b9a, - 0x9477, 0x97c9, 0x9a62, 0x9a65, 0x7e9c, 0x8b9c, 0x8eaa, 0x91c5, - 0x947d, 0x947e, 0x947c, 0x9c77, 0x9c78, 0x9ef7, 0x8c54, 0x947f, - 0x9e1a, 0x7228, 0x9a6a, 0x9b31, 0x9e1b, 0x9e1e, 0x7c72, 0x30fe, - 0x309d, 0x309e, 0x3005, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, - 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, - 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, - 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, - 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, - 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, - 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, - 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, - 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, - 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, - 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0x30a1, 0x30a2, - 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, - /* 0xc7 */ - 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, - 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, - 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, - 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, - 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, - 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, - 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, - 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, - 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, - 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0x0414, - 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, - 0x041c, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, - 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, - 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, - 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, - 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, - 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x2460, - 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, - 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, - 0x247b, 0x247c, 0x247d, -}; -static const unsigned short big5_2uni_pagec9[7652] = { - /* 0xc9 */ - 0x4e42, 0x4e5c, 0x51f5, 0x531a, 0x5382, 0x4e07, 0x4e0c, 0x4e47, - 0x4e8d, 0x56d7, 0xfa0c, 0x5c6e, 0x5f73, 0x4e0f, 0x5187, 0x4e0e, - 0x4e2e, 0x4e93, 0x4ec2, 0x4ec9, 0x4ec8, 0x5198, 0x52fc, 0x536c, - 0x53b9, 0x5720, 0x5903, 0x592c, 0x5c10, 0x5dff, 0x65e1, 0x6bb3, - 0x6bcc, 0x6c14, 0x723f, 0x4e31, 0x4e3c, 0x4ee8, 0x4edc, 0x4ee9, - 0x4ee1, 0x4edd, 0x4eda, 0x520c, 0x531c, 0x534c, 0x5722, 0x5723, - 0x5917, 0x592f, 0x5b81, 0x5b84, 0x5c12, 0x5c3b, 0x5c74, 0x5c73, - 0x5e04, 0x5e80, 0x5e82, 0x5fc9, 0x6209, 0x6250, 0x6c15, 0x6c36, - 0x6c43, 0x6c3f, 0x6c3b, 0x72ae, 0x72b0, 0x738a, 0x79b8, 0x808a, - 0x961e, 0x4f0e, 0x4f18, 0x4f2c, 0x4ef5, 0x4f14, 0x4ef1, 0x4f00, - 0x4ef7, 0x4f08, 0x4f1d, 0x4f02, 0x4f05, 0x4f22, 0x4f13, 0x4f04, - 0x4ef4, 0x4f12, 0x51b1, 0x5213, 0x5209, 0x5210, 0x52a6, 0x5322, - 0x531f, 0x534d, 0x538a, 0x5407, 0x56e1, 0x56df, 0x572e, 0x572a, - 0x5734, 0x593c, 0x5980, 0x597c, 0x5985, 0x597b, 0x597e, 0x5977, - 0x597f, 0x5b56, 0x5c15, 0x5c25, 0x5c7c, 0x5c7a, 0x5c7b, 0x5c7e, - 0x5ddf, 0x5e75, 0x5e84, 0x5f02, 0x5f1a, 0x5f74, 0x5fd5, 0x5fd4, - 0x5fcf, 0x625c, 0x625e, 0x6264, 0x6261, 0x6266, 0x6262, 0x6259, - 0x6260, 0x625a, 0x6265, 0x65ef, 0x65ee, 0x673e, 0x6739, 0x6738, - 0x673b, 0x673a, 0x673f, 0x673c, 0x6733, 0x6c18, 0x6c46, 0x6c52, - 0x6c5c, 0x6c4f, 0x6c4a, 0x6c54, 0x6c4b, - /* 0xca */ - 0x6c4c, 0x7071, 0x725e, 0x72b4, 0x72b5, 0x738e, 0x752a, 0x767f, - 0x7a75, 0x7f51, 0x8278, 0x827c, 0x8280, 0x827d, 0x827f, 0x864d, - 0x897e, 0x9099, 0x9097, 0x9098, 0x909b, 0x9094, 0x9622, 0x9624, - 0x9620, 0x9623, 0x4f56, 0x4f3b, 0x4f62, 0x4f49, 0x4f53, 0x4f64, - 0x4f3e, 0x4f67, 0x4f52, 0x4f5f, 0x4f41, 0x4f58, 0x4f2d, 0x4f33, - 0x4f3f, 0x4f61, 0x518f, 0x51b9, 0x521c, 0x521e, 0x5221, 0x52ad, - 0x52ae, 0x5309, 0x5363, 0x5372, 0x538e, 0x538f, 0x5430, 0x5437, - 0x542a, 0x5454, 0x5445, 0x5419, 0x541c, 0x5425, 0x5418, 0x543d, - 0x544f, 0x5441, 0x5428, 0x5424, 0x5447, 0x56ee, 0x56e7, 0x56e5, - 0x5741, 0x5745, 0x574c, 0x5749, 0x574b, 0x5752, 0x5906, 0x5940, - 0x59a6, 0x5998, 0x59a0, 0x5997, 0x598e, 0x59a2, 0x5990, 0x598f, - 0x59a7, 0x59a1, 0x5b8e, 0x5b92, 0x5c28, 0x5c2a, 0x5c8d, 0x5c8f, - 0x5c88, 0x5c8b, 0x5c89, 0x5c92, 0x5c8a, 0x5c86, 0x5c93, 0x5c95, - 0x5de0, 0x5e0a, 0x5e0e, 0x5e8b, 0x5e89, 0x5e8c, 0x5e88, 0x5e8d, - 0x5f05, 0x5f1d, 0x5f78, 0x5f76, 0x5fd2, 0x5fd1, 0x5fd0, 0x5fed, - 0x5fe8, 0x5fee, 0x5ff3, 0x5fe1, 0x5fe4, 0x5fe3, 0x5ffa, 0x5fef, - 0x5ff7, 0x5ffb, 0x6000, 0x5ff4, 0x623a, 0x6283, 0x628c, 0x628e, - 0x628f, 0x6294, 0x6287, 0x6271, 0x627b, 0x627a, 0x6270, 0x6281, - 0x6288, 0x6277, 0x627d, 0x6272, 0x6274, 0x6537, 0x65f0, 0x65f4, - 0x65f3, 0x65f2, 0x65f5, 0x6745, 0x6747, - /* 0xcb */ - 0x6759, 0x6755, 0x674c, 0x6748, 0x675d, 0x674d, 0x675a, 0x674b, - 0x6bd0, 0x6c19, 0x6c1a, 0x6c78, 0x6c67, 0x6c6b, 0x6c84, 0x6c8b, - 0x6c8f, 0x6c71, 0x6c6f, 0x6c69, 0x6c9a, 0x6c6d, 0x6c87, 0x6c95, - 0x6c9c, 0x6c66, 0x6c73, 0x6c65, 0x6c7b, 0x6c8e, 0x7074, 0x707a, - 0x7263, 0x72bf, 0x72bd, 0x72c3, 0x72c6, 0x72c1, 0x72ba, 0x72c5, - 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753a, 0x7539, 0x7594, - 0x7595, 0x7681, 0x793d, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, - 0x809c, 0x8290, 0x828f, 0x8285, 0x828e, 0x8291, 0x8293, 0x828a, - 0x8283, 0x8284, 0x8c78, 0x8fc9, 0x8fbf, 0x909f, 0x90a1, 0x90a5, - 0x909e, 0x90a7, 0x90a0, 0x9630, 0x9628, 0x962f, 0x962d, 0x4e33, - 0x4f98, 0x4f7c, 0x4f85, 0x4f7d, 0x4f80, 0x4f87, 0x4f76, 0x4f74, - 0x4f89, 0x4f84, 0x4f77, 0x4f4c, 0x4f97, 0x4f6a, 0x4f9a, 0x4f79, - 0x4f81, 0x4f78, 0x4f90, 0x4f9c, 0x4f94, 0x4f9e, 0x4f92, 0x4f82, - 0x4f95, 0x4f6b, 0x4f6e, 0x519e, 0x51bc, 0x51be, 0x5235, 0x5232, - 0x5233, 0x5246, 0x5231, 0x52bc, 0x530a, 0x530b, 0x533c, 0x5392, - 0x5394, 0x5487, 0x547f, 0x5481, 0x5491, 0x5482, 0x5488, 0x546b, - 0x547a, 0x547e, 0x5465, 0x546c, 0x5474, 0x5466, 0x548d, 0x546f, - 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, 0x56f7, 0x56f9, - 0x576f, 0x5772, 0x576d, 0x576b, 0x5771, 0x5770, 0x5776, 0x5780, - 0x5775, 0x577b, 0x5773, 0x5774, 0x5762, - /* 0xcc */ - 0x5768, 0x577d, 0x590c, 0x5945, 0x59b5, 0x59ba, 0x59cf, 0x59ce, - 0x59b2, 0x59cc, 0x59c1, 0x59b6, 0x59bc, 0x59c3, 0x59d6, 0x59b1, - 0x59bd, 0x59c0, 0x59c8, 0x59b4, 0x59c7, 0x5b62, 0x5b65, 0x5b93, - 0x5b95, 0x5c44, 0x5c47, 0x5cae, 0x5ca4, 0x5ca0, 0x5cb5, 0x5caf, - 0x5ca8, 0x5cac, 0x5c9f, 0x5ca3, 0x5cad, 0x5ca2, 0x5caa, 0x5ca7, - 0x5c9d, 0x5ca5, 0x5cb6, 0x5cb0, 0x5ca6, 0x5e17, 0x5e14, 0x5e19, - 0x5f28, 0x5f22, 0x5f23, 0x5f24, 0x5f54, 0x5f82, 0x5f7e, 0x5f7d, - 0x5fde, 0x5fe5, 0x602d, 0x6026, 0x6019, 0x6032, 0x600b, 0x6034, - 0x600a, 0x6017, 0x6033, 0x601a, 0x601e, 0x602c, 0x6022, 0x600d, - 0x6010, 0x602e, 0x6013, 0x6011, 0x600c, 0x6009, 0x601c, 0x6214, - 0x623d, 0x62ad, 0x62b4, 0x62d1, 0x62be, 0x62aa, 0x62b6, 0x62ca, - 0x62ae, 0x62b3, 0x62af, 0x62bb, 0x62a9, 0x62b0, 0x62b8, 0x653d, - 0x65a8, 0x65bb, 0x6609, 0x65fc, 0x6604, 0x6612, 0x6608, 0x65fb, - 0x6603, 0x660b, 0x660d, 0x6605, 0x65fd, 0x6611, 0x6610, 0x66f6, - 0x670a, 0x6785, 0x676c, 0x678e, 0x6792, 0x6776, 0x677b, 0x6798, - 0x6786, 0x6784, 0x6774, 0x678d, 0x678c, 0x677a, 0x679f, 0x6791, - 0x6799, 0x6783, 0x677d, 0x6781, 0x6778, 0x6779, 0x6794, 0x6b25, - 0x6b80, 0x6b7e, 0x6bde, 0x6c1d, 0x6c93, 0x6cec, 0x6ceb, 0x6cee, - 0x6cd9, 0x6cb6, 0x6cd4, 0x6cad, 0x6ce7, 0x6cb7, 0x6cd0, 0x6cc2, - 0x6cba, 0x6cc3, 0x6cc6, 0x6ced, 0x6cf2, - /* 0xcd */ - 0x6cd2, 0x6cdd, 0x6cb4, 0x6c8a, 0x6c9d, 0x6c80, 0x6cde, 0x6cc0, - 0x6d30, 0x6ccd, 0x6cc7, 0x6cb0, 0x6cf9, 0x6ccf, 0x6ce9, 0x6cd1, - 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, - 0x7082, 0x709a, 0x7083, 0x726a, 0x72d6, 0x72cb, 0x72d8, 0x72c9, - 0x72dc, 0x72d2, 0x72d4, 0x72da, 0x72cc, 0x72d1, 0x73a4, 0x73a1, - 0x73ad, 0x73a6, 0x73a2, 0x73a0, 0x73ac, 0x739d, 0x74dd, 0x74e8, - 0x753f, 0x7540, 0x753e, 0x758c, 0x7598, 0x76af, 0x76f3, 0x76f1, - 0x76f0, 0x76f5, 0x77f8, 0x77fc, 0x77f9, 0x77fb, 0x77fa, 0x77f7, - 0x7942, 0x793f, 0x79c5, 0x7a78, 0x7a7b, 0x7afb, 0x7c75, 0x7cfd, - 0x8035, 0x808f, 0x80ae, 0x80a3, 0x80b8, 0x80b5, 0x80ad, 0x8220, - 0x82a0, 0x82c0, 0x82ab, 0x829a, 0x8298, 0x829b, 0x82b5, 0x82a7, - 0x82ae, 0x82bc, 0x829e, 0x82ba, 0x82b4, 0x82a8, 0x82a1, 0x82a9, - 0x82c2, 0x82a4, 0x82c3, 0x82b6, 0x82a2, 0x8670, 0x866f, 0x866d, - 0x866e, 0x8c56, 0x8fd2, 0x8fcb, 0x8fd3, 0x8fcd, 0x8fd6, 0x8fd5, - 0x8fd7, 0x90b2, 0x90b4, 0x90af, 0x90b3, 0x90b0, 0x9639, 0x963d, - 0x963c, 0x963a, 0x9643, 0x4fcd, 0x4fc5, 0x4fd3, 0x4fb2, 0x4fc9, - 0x4fcb, 0x4fc1, 0x4fd4, 0x4fdc, 0x4fd9, 0x4fbb, 0x4fb3, 0x4fdb, - 0x4fc7, 0x4fd6, 0x4fba, 0x4fc0, 0x4fb9, 0x4fec, 0x5244, 0x5249, - 0x52c0, 0x52c2, 0x533d, 0x537c, 0x5397, 0x5396, 0x5399, 0x5398, - 0x54ba, 0x54a1, 0x54ad, 0x54a5, 0x54cf, - /* 0xce */ - 0x54c3, 0x830d, 0x54b7, 0x54ae, 0x54d6, 0x54b6, 0x54c5, 0x54c6, - 0x54a0, 0x5470, 0x54bc, 0x54a2, 0x54be, 0x5472, 0x54de, 0x54b0, - 0x57b5, 0x579e, 0x579f, 0x57a4, 0x578c, 0x5797, 0x579d, 0x579b, - 0x5794, 0x5798, 0x578f, 0x5799, 0x57a5, 0x579a, 0x5795, 0x58f4, - 0x590d, 0x5953, 0x59e1, 0x59de, 0x59ee, 0x5a00, 0x59f1, 0x59dd, - 0x59fa, 0x59fd, 0x59fc, 0x59f6, 0x59e4, 0x59f2, 0x59f7, 0x59db, - 0x59e9, 0x59f3, 0x59f5, 0x59e0, 0x59fe, 0x59f4, 0x59ed, 0x5ba8, - 0x5c4c, 0x5cd0, 0x5cd8, 0x5ccc, 0x5cd7, 0x5ccb, 0x5cdb, 0x5cde, - 0x5cda, 0x5cc9, 0x5cc7, 0x5cca, 0x5cd6, 0x5cd3, 0x5cd4, 0x5ccf, - 0x5cc8, 0x5cc6, 0x5cce, 0x5cdf, 0x5cf8, 0x5df9, 0x5e21, 0x5e22, - 0x5e23, 0x5e20, 0x5e24, 0x5eb0, 0x5ea4, 0x5ea2, 0x5e9b, 0x5ea3, - 0x5ea5, 0x5f07, 0x5f2e, 0x5f56, 0x5f86, 0x6037, 0x6039, 0x6054, - 0x6072, 0x605e, 0x6045, 0x6053, 0x6047, 0x6049, 0x605b, 0x604c, - 0x6040, 0x6042, 0x605f, 0x6024, 0x6044, 0x6058, 0x6066, 0x606e, - 0x6242, 0x6243, 0x62cf, 0x630d, 0x630b, 0x62f5, 0x630e, 0x6303, - 0x62eb, 0x62f9, 0x630f, 0x630c, 0x62f8, 0x62f6, 0x6300, 0x6313, - 0x6314, 0x62fa, 0x6315, 0x62fb, 0x62f0, 0x6541, 0x6543, 0x65aa, - 0x65bf, 0x6636, 0x6621, 0x6632, 0x6635, 0x661c, 0x6626, 0x6622, - 0x6633, 0x662b, 0x663a, 0x661d, 0x6634, 0x6639, 0x662e, 0x670f, - 0x6710, 0x67c1, 0x67f2, 0x67c8, 0x67ba, - /* 0xcf */ - 0x67dc, 0x67bb, 0x67f8, 0x67d8, 0x67c0, 0x67b7, 0x67c5, 0x67eb, - 0x67e4, 0x67df, 0x67b5, 0x67cd, 0x67b3, 0x67f7, 0x67f6, 0x67ee, - 0x67e3, 0x67c2, 0x67b9, 0x67ce, 0x67e7, 0x67f0, 0x67b2, 0x67fc, - 0x67c6, 0x67ed, 0x67cc, 0x67ae, 0x67e6, 0x67db, 0x67fa, 0x67c9, - 0x67ca, 0x67c3, 0x67ea, 0x67cb, 0x6b28, 0x6b82, 0x6b84, 0x6bb6, - 0x6bd6, 0x6bd8, 0x6be0, 0x6c20, 0x6c21, 0x6d28, 0x6d34, 0x6d2d, - 0x6d1f, 0x6d3c, 0x6d3f, 0x6d12, 0x6d0a, 0x6cda, 0x6d33, 0x6d04, - 0x6d19, 0x6d3a, 0x6d1a, 0x6d11, 0x6d00, 0x6d1d, 0x6d42, 0x6d01, - 0x6d18, 0x6d37, 0x6d03, 0x6d0f, 0x6d40, 0x6d07, 0x6d20, 0x6d2c, - 0x6d08, 0x6d22, 0x6d09, 0x6d10, 0x70b7, 0x709f, 0x70be, 0x70b1, - 0x70b0, 0x70a1, 0x70b4, 0x70b5, 0x70a9, 0x7241, 0x7249, 0x724a, - 0x726c, 0x7270, 0x7273, 0x726e, 0x72ca, 0x72e4, 0x72e8, 0x72eb, - 0x72df, 0x72ea, 0x72e6, 0x72e3, 0x7385, 0x73cc, 0x73c2, 0x73c8, - 0x73c5, 0x73b9, 0x73b6, 0x73b5, 0x73b4, 0x73eb, 0x73bf, 0x73c7, - 0x73be, 0x73c3, 0x73c6, 0x73b8, 0x73cb, 0x74ec, 0x74ee, 0x752e, - 0x7547, 0x7548, 0x75a7, 0x75aa, 0x7679, 0x76c4, 0x7708, 0x7703, - 0x7704, 0x7705, 0x770a, 0x76f7, 0x76fb, 0x76fa, 0x77e7, 0x77e8, - 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780f, 0x780e, 0x7809, - 0x7803, 0x7813, 0x794a, 0x794c, 0x794b, 0x7945, 0x7944, 0x79d5, - 0x79cd, 0x79cf, 0x79d6, 0x79ce, 0x7a80, - /* 0xd0 */ - 0x7a7e, 0x7ad1, 0x7b00, 0x7b01, 0x7c7a, 0x7c78, 0x7c79, 0x7c7f, - 0x7c80, 0x7c81, 0x7d03, 0x7d08, 0x7d01, 0x7f58, 0x7f91, 0x7f8d, - 0x7fbe, 0x8007, 0x800e, 0x800f, 0x8014, 0x8037, 0x80d8, 0x80c7, - 0x80e0, 0x80d1, 0x80c8, 0x80c2, 0x80d0, 0x80c5, 0x80e3, 0x80d9, - 0x80dc, 0x80ca, 0x80d5, 0x80c9, 0x80cf, 0x80d7, 0x80e6, 0x80cd, - 0x81ff, 0x8221, 0x8294, 0x82d9, 0x82fe, 0x82f9, 0x8307, 0x82e8, - 0x8300, 0x82d5, 0x833a, 0x82eb, 0x82d6, 0x82f4, 0x82ec, 0x82e1, - 0x82f2, 0x82f5, 0x830c, 0x82fb, 0x82f6, 0x82f0, 0x82ea, 0x82e4, - 0x82e0, 0x82fa, 0x82f3, 0x82ed, 0x8677, 0x8674, 0x867c, 0x8673, - 0x8841, 0x884e, 0x8867, 0x886a, 0x8869, 0x89d3, 0x8a04, 0x8a07, - 0x8d72, 0x8fe3, 0x8fe1, 0x8fee, 0x8fe0, 0x90f1, 0x90bd, 0x90bf, - 0x90d5, 0x90c5, 0x90be, 0x90c7, 0x90cb, 0x90c8, 0x91d4, 0x91d3, - 0x9654, 0x964f, 0x9651, 0x9653, 0x964a, 0x964e, 0x501e, 0x5005, - 0x5007, 0x5013, 0x5022, 0x5030, 0x501b, 0x4ff5, 0x4ff4, 0x5033, - 0x5037, 0x502c, 0x4ff6, 0x4ff7, 0x5017, 0x501c, 0x5020, 0x5027, - 0x5035, 0x502f, 0x5031, 0x500e, 0x515a, 0x5194, 0x5193, 0x51ca, - 0x51c4, 0x51c5, 0x51c8, 0x51ce, 0x5261, 0x525a, 0x5252, 0x525e, - 0x525f, 0x5255, 0x5262, 0x52cd, 0x530e, 0x539e, 0x5526, 0x54e2, - 0x5517, 0x5512, 0x54e7, 0x54f3, 0x54e4, 0x551a, 0x54ff, 0x5504, - 0x5508, 0x54eb, 0x5511, 0x5505, 0x54f1, - /* 0xd1 */ - 0x550a, 0x54fb, 0x54f7, 0x54f8, 0x54e0, 0x550e, 0x5503, 0x550b, - 0x5701, 0x5702, 0x57cc, 0x5832, 0x57d5, 0x57d2, 0x57ba, 0x57c6, - 0x57bd, 0x57bc, 0x57b8, 0x57b6, 0x57bf, 0x57c7, 0x57d0, 0x57b9, - 0x57c1, 0x590e, 0x594a, 0x5a19, 0x5a16, 0x5a2d, 0x5a2e, 0x5a15, - 0x5a0f, 0x5a17, 0x5a0a, 0x5a1e, 0x5a33, 0x5b6c, 0x5ba7, 0x5bad, - 0x5bac, 0x5c03, 0x5c56, 0x5c54, 0x5cec, 0x5cff, 0x5cee, 0x5cf1, - 0x5cf7, 0x5d00, 0x5cf9, 0x5e29, 0x5e28, 0x5ea8, 0x5eae, 0x5eaa, - 0x5eac, 0x5f33, 0x5f30, 0x5f67, 0x605d, 0x605a, 0x6067, 0x6041, - 0x60a2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609d, 0x6083, 0x6095, - 0x609b, 0x6097, 0x6087, 0x609c, 0x608e, 0x6219, 0x6246, 0x62f2, - 0x6310, 0x6356, 0x632c, 0x6344, 0x6345, 0x6336, 0x6343, 0x63e4, - 0x6339, 0x634b, 0x634a, 0x633c, 0x6329, 0x6341, 0x6334, 0x6358, - 0x6354, 0x6359, 0x632d, 0x6347, 0x6333, 0x635a, 0x6351, 0x6338, - 0x6357, 0x6340, 0x6348, 0x654a, 0x6546, 0x65c6, 0x65c3, 0x65c4, - 0x65c2, 0x664a, 0x665f, 0x6647, 0x6651, 0x6712, 0x6713, 0x681f, - 0x681a, 0x6849, 0x6832, 0x6833, 0x683b, 0x684b, 0x684f, 0x6816, - 0x6831, 0x681c, 0x6835, 0x682b, 0x682d, 0x682f, 0x684e, 0x6844, - 0x6834, 0x681d, 0x6812, 0x6814, 0x6826, 0x6828, 0x682e, 0x684d, - 0x683a, 0x6825, 0x6820, 0x6b2c, 0x6b2f, 0x6b2d, 0x6b31, 0x6b34, - 0x6b6d, 0x8082, 0x6b88, 0x6be6, 0x6be4, - /* 0xd2 */ - 0x6be8, 0x6be3, 0x6be2, 0x6be7, 0x6c25, 0x6d7a, 0x6d63, 0x6d64, - 0x6d76, 0x6d0d, 0x6d61, 0x6d92, 0x6d58, 0x6d62, 0x6d6d, 0x6d6f, - 0x6d91, 0x6d8d, 0x6def, 0x6d7f, 0x6d86, 0x6d5e, 0x6d67, 0x6d60, - 0x6d97, 0x6d70, 0x6d7c, 0x6d5f, 0x6d82, 0x6d98, 0x6d2f, 0x6d68, - 0x6d8b, 0x6d7e, 0x6d80, 0x6d84, 0x6d16, 0x6d83, 0x6d7b, 0x6d7d, - 0x6d75, 0x6d90, 0x70dc, 0x70d3, 0x70d1, 0x70dd, 0x70cb, 0x7f39, - 0x70e2, 0x70d7, 0x70d2, 0x70de, 0x70e0, 0x70d4, 0x70cd, 0x70c5, - 0x70c6, 0x70c7, 0x70da, 0x70ce, 0x70e1, 0x7242, 0x7278, 0x7277, - 0x7276, 0x7300, 0x72fa, 0x72f4, 0x72fe, 0x72f6, 0x72f3, 0x72fb, - 0x7301, 0x73d3, 0x73d9, 0x73e5, 0x73d6, 0x73bc, 0x73e7, 0x73e3, - 0x73e9, 0x73dc, 0x73d2, 0x73db, 0x73d4, 0x73dd, 0x73da, 0x73d7, - 0x73d8, 0x73e8, 0x74de, 0x74df, 0x74f4, 0x74f5, 0x7521, 0x755b, - 0x755f, 0x75b0, 0x75c1, 0x75bb, 0x75c4, 0x75c0, 0x75bf, 0x75b6, - 0x75ba, 0x768a, 0x76c9, 0x771d, 0x771b, 0x7710, 0x7713, 0x7712, - 0x7723, 0x7711, 0x7715, 0x7719, 0x771a, 0x7722, 0x7727, 0x7823, - 0x782c, 0x7822, 0x7835, 0x782f, 0x7828, 0x782e, 0x782b, 0x7821, - 0x7829, 0x7833, 0x782a, 0x7831, 0x7954, 0x795b, 0x794f, 0x795c, - 0x7953, 0x7952, 0x7951, 0x79eb, 0x79ec, 0x79e0, 0x79ee, 0x79ed, - 0x79ea, 0x79dc, 0x79de, 0x79dd, 0x7a86, 0x7a89, 0x7a85, 0x7a8b, - 0x7a8c, 0x7a8a, 0x7a87, 0x7ad8, 0x7b10, - /* 0xd3 */ - 0x7b04, 0x7b13, 0x7b05, 0x7b0f, 0x7b08, 0x7b0a, 0x7b0e, 0x7b09, - 0x7b12, 0x7c84, 0x7c91, 0x7c8a, 0x7c8c, 0x7c88, 0x7c8d, 0x7c85, - 0x7d1e, 0x7d1d, 0x7d11, 0x7d0e, 0x7d18, 0x7d16, 0x7d13, 0x7d1f, - 0x7d12, 0x7d0f, 0x7d0c, 0x7f5c, 0x7f61, 0x7f5e, 0x7f60, 0x7f5d, - 0x7f5b, 0x7f96, 0x7f92, 0x7fc3, 0x7fc2, 0x7fc0, 0x8016, 0x803e, - 0x8039, 0x80fa, 0x80f2, 0x80f9, 0x80f5, 0x8101, 0x80fb, 0x8100, - 0x8201, 0x822f, 0x8225, 0x8333, 0x832d, 0x8344, 0x8319, 0x8351, - 0x8325, 0x8356, 0x833f, 0x8341, 0x8326, 0x831c, 0x8322, 0x8342, - 0x834e, 0x831b, 0x832a, 0x8308, 0x833c, 0x834d, 0x8316, 0x8324, - 0x8320, 0x8337, 0x832f, 0x8329, 0x8347, 0x8345, 0x834c, 0x8353, - 0x831e, 0x832c, 0x834b, 0x8327, 0x8348, 0x8653, 0x8652, 0x86a2, - 0x86a8, 0x8696, 0x868d, 0x8691, 0x869e, 0x8687, 0x8697, 0x8686, - 0x868b, 0x869a, 0x8685, 0x86a5, 0x8699, 0x86a1, 0x86a7, 0x8695, - 0x8698, 0x868e, 0x869d, 0x8690, 0x8694, 0x8843, 0x8844, 0x886d, - 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887f, 0x886f, 0x8883, - 0x887e, 0x8874, 0x887c, 0x8a12, 0x8c47, 0x8c57, 0x8c7b, 0x8ca4, - 0x8ca3, 0x8d76, 0x8d78, 0x8db5, 0x8db7, 0x8db6, 0x8ed1, 0x8ed3, - 0x8ffe, 0x8ff5, 0x9002, 0x8fff, 0x8ffb, 0x9004, 0x8ffc, 0x8ff6, - 0x90d6, 0x90e0, 0x90d9, 0x90da, 0x90e3, 0x90df, 0x90e5, 0x90d8, - 0x90db, 0x90d7, 0x90dc, 0x90e4, 0x9150, - /* 0xd4 */ - 0x914e, 0x914f, 0x91d5, 0x91e2, 0x91da, 0x965c, 0x965f, 0x96bc, - 0x98e3, 0x9adf, 0x9b2f, 0x4e7f, 0x5070, 0x506a, 0x5061, 0x505e, - 0x5060, 0x5053, 0x504b, 0x505d, 0x5072, 0x5048, 0x504d, 0x5041, - 0x505b, 0x504a, 0x5062, 0x5015, 0x5045, 0x505f, 0x5069, 0x506b, - 0x5063, 0x5064, 0x5046, 0x5040, 0x506e, 0x5073, 0x5057, 0x5051, - 0x51d0, 0x526b, 0x526d, 0x526c, 0x526e, 0x52d6, 0x52d3, 0x532d, - 0x539c, 0x5575, 0x5576, 0x553c, 0x554d, 0x5550, 0x5534, 0x552a, - 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, 0x550c, - 0x5532, 0x5565, 0x554e, 0x5539, 0x5548, 0x552d, 0x553b, 0x5540, - 0x554b, 0x570a, 0x5707, 0x57fb, 0x5814, 0x57e2, 0x57f6, 0x57dc, - 0x57f4, 0x5800, 0x57ed, 0x57fd, 0x5808, 0x57f8, 0x580b, 0x57f3, - 0x57cf, 0x5807, 0x57ee, 0x57e3, 0x57f2, 0x57e5, 0x57ec, 0x57e1, - 0x580e, 0x57fc, 0x5810, 0x57e7, 0x5801, 0x580c, 0x57f1, 0x57e9, - 0x57f0, 0x580d, 0x5804, 0x595c, 0x5a60, 0x5a58, 0x5a55, 0x5a67, - 0x5a5e, 0x5a38, 0x5a35, 0x5a6d, 0x5a50, 0x5a5f, 0x5a65, 0x5a6c, - 0x5a53, 0x5a64, 0x5a57, 0x5a43, 0x5a5d, 0x5a52, 0x5a44, 0x5a5b, - 0x5a48, 0x5a8e, 0x5a3e, 0x5a4d, 0x5a39, 0x5a4c, 0x5a70, 0x5a69, - 0x5a47, 0x5a51, 0x5a56, 0x5a42, 0x5a5c, 0x5b72, 0x5b6e, 0x5bc1, - 0x5bc0, 0x5c59, 0x5d1e, 0x5d0b, 0x5d1d, 0x5d1a, 0x5d20, 0x5d0c, - 0x5d28, 0x5d0d, 0x5d26, 0x5d25, 0x5d0f, - /* 0xd5 */ - 0x5d30, 0x5d12, 0x5d23, 0x5d1f, 0x5d2e, 0x5e3e, 0x5e34, 0x5eb1, - 0x5eb4, 0x5eb9, 0x5eb2, 0x5eb3, 0x5f36, 0x5f38, 0x5f9b, 0x5f96, - 0x5f9f, 0x608a, 0x6090, 0x6086, 0x60be, 0x60b0, 0x60ba, 0x60d3, - 0x60d4, 0x60cf, 0x60e4, 0x60d9, 0x60dd, 0x60c8, 0x60b1, 0x60db, - 0x60b7, 0x60ca, 0x60bf, 0x60c3, 0x60cd, 0x60c0, 0x6332, 0x6365, - 0x638a, 0x6382, 0x637d, 0x63bd, 0x639e, 0x63ad, 0x639d, 0x6397, - 0x63ab, 0x638e, 0x636f, 0x6387, 0x6390, 0x636e, 0x63af, 0x6375, - 0x639c, 0x636d, 0x63ae, 0x637c, 0x63a4, 0x633b, 0x639f, 0x6378, - 0x6385, 0x6381, 0x6391, 0x638d, 0x6370, 0x6553, 0x65cd, 0x6665, - 0x6661, 0x665b, 0x6659, 0x665c, 0x6662, 0x6718, 0x6879, 0x6887, - 0x6890, 0x689c, 0x686d, 0x686e, 0x68ae, 0x68ab, 0x6956, 0x686f, - 0x68a3, 0x68ac, 0x68a9, 0x6875, 0x6874, 0x68b2, 0x688f, 0x6877, - 0x6892, 0x687c, 0x686b, 0x6872, 0x68aa, 0x6880, 0x6871, 0x687e, - 0x689b, 0x6896, 0x688b, 0x68a0, 0x6889, 0x68a4, 0x6878, 0x687b, - 0x6891, 0x688c, 0x688a, 0x687d, 0x6b36, 0x6b33, 0x6b37, 0x6b38, - 0x6b91, 0x6b8f, 0x6b8d, 0x6b8e, 0x6b8c, 0x6c2a, 0x6dc0, 0x6dab, - 0x6db4, 0x6db3, 0x6e74, 0x6dac, 0x6de9, 0x6de2, 0x6db7, 0x6df6, - 0x6dd4, 0x6e00, 0x6dc8, 0x6de0, 0x6ddf, 0x6dd6, 0x6dbe, 0x6de5, - 0x6ddc, 0x6ddd, 0x6ddb, 0x6df4, 0x6dca, 0x6dbd, 0x6ded, 0x6df0, - 0x6dba, 0x6dd5, 0x6dc2, 0x6dcf, 0x6dc9, - /* 0xd6 */ - 0x6dd0, 0x6df2, 0x6dd3, 0x6dfd, 0x6dd7, 0x6dcd, 0x6de3, 0x6dbb, - 0x70fa, 0x710d, 0x70f7, 0x7117, 0x70f4, 0x710c, 0x70f0, 0x7104, - 0x70f3, 0x7110, 0x70fc, 0x70ff, 0x7106, 0x7113, 0x7100, 0x70f8, - 0x70f6, 0x710b, 0x7102, 0x710e, 0x727e, 0x727b, 0x727c, 0x727f, - 0x731d, 0x7317, 0x7307, 0x7311, 0x7318, 0x730a, 0x7308, 0x72ff, - 0x730f, 0x731e, 0x7388, 0x73f6, 0x73f8, 0x73f5, 0x7404, 0x7401, - 0x73fd, 0x7407, 0x7400, 0x73fa, 0x73fc, 0x73ff, 0x740c, 0x740b, - 0x73f4, 0x7408, 0x7564, 0x7563, 0x75ce, 0x75d2, 0x75cf, 0x75cb, - 0x75cc, 0x75d1, 0x75d0, 0x768f, 0x7689, 0x76d3, 0x7739, 0x772f, - 0x772d, 0x7731, 0x7732, 0x7734, 0x7733, 0x773d, 0x7725, 0x773b, - 0x7735, 0x7848, 0x7852, 0x7849, 0x784d, 0x784a, 0x784c, 0x7826, - 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796a, 0x7963, 0x796b, - 0x7961, 0x79bb, 0x79fa, 0x79f8, 0x79f6, 0x79f7, 0x7a8f, 0x7a94, - 0x7a90, 0x7b35, 0x7b47, 0x7b34, 0x7b25, 0x7b30, 0x7b22, 0x7b24, - 0x7b33, 0x7b18, 0x7b2a, 0x7b1d, 0x7b31, 0x7b2b, 0x7b2d, 0x7b2f, - 0x7b32, 0x7b38, 0x7b1a, 0x7b23, 0x7c94, 0x7c98, 0x7c96, 0x7ca3, - 0x7d35, 0x7d3d, 0x7d38, 0x7d36, 0x7d3a, 0x7d45, 0x7d2c, 0x7d29, - 0x7d41, 0x7d47, 0x7d3e, 0x7d3f, 0x7d4a, 0x7d3b, 0x7d28, 0x7f63, - 0x7f95, 0x7f9c, 0x7f9d, 0x7f9b, 0x7fca, 0x7fcb, 0x7fcd, 0x7fd0, - 0x7fd1, 0x7fc7, 0x7fcf, 0x7fc9, 0x801f, - /* 0xd7 */ - 0x801e, 0x801b, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, - 0x811b, 0x812d, 0x811f, 0x812c, 0x811e, 0x8121, 0x8115, 0x8127, - 0x811d, 0x8122, 0x8211, 0x8238, 0x8233, 0x823a, 0x8234, 0x8232, - 0x8274, 0x8390, 0x83a3, 0x83a8, 0x838d, 0x837a, 0x8373, 0x83a4, - 0x8374, 0x838f, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83a9, - 0x837d, 0x8383, 0x838c, 0x839d, 0x839b, 0x83aa, 0x838b, 0x837e, - 0x83a5, 0x83af, 0x8388, 0x8397, 0x83b0, 0x837f, 0x83a6, 0x8387, - 0x83ae, 0x8376, 0x839a, 0x8659, 0x8656, 0x86bf, 0x86b7, 0x86c2, - 0x86c1, 0x86c5, 0x86ba, 0x86b0, 0x86c8, 0x86b9, 0x86b3, 0x86b8, - 0x86cc, 0x86b4, 0x86bb, 0x86bc, 0x86c3, 0x86bd, 0x86be, 0x8852, - 0x8889, 0x8895, 0x88a8, 0x88a2, 0x88aa, 0x889a, 0x8891, 0x88a1, - 0x889f, 0x8898, 0x88a7, 0x8899, 0x889b, 0x8897, 0x88a4, 0x88ac, - 0x888c, 0x8893, 0x888e, 0x8982, 0x89d6, 0x89d9, 0x89d5, 0x8a30, - 0x8a27, 0x8a2c, 0x8a1e, 0x8c39, 0x8c3b, 0x8c5c, 0x8c5d, 0x8c7d, - 0x8ca5, 0x8d7d, 0x8d7b, 0x8d79, 0x8dbc, 0x8dc2, 0x8db9, 0x8dbf, - 0x8dc1, 0x8ed8, 0x8ede, 0x8edd, 0x8edc, 0x8ed7, 0x8ee0, 0x8ee1, - 0x9024, 0x900b, 0x9011, 0x901c, 0x900c, 0x9021, 0x90ef, 0x90ea, - 0x90f0, 0x90f4, 0x90f2, 0x90f3, 0x90d4, 0x90eb, 0x90ec, 0x90e9, - 0x9156, 0x9158, 0x915a, 0x9153, 0x9155, 0x91ec, 0x91f4, 0x91f1, - 0x91f3, 0x91f8, 0x91e4, 0x91f9, 0x91ea, - /* 0xd8 */ - 0x91eb, 0x91f7, 0x91e8, 0x91ee, 0x957a, 0x9586, 0x9588, 0x967c, - 0x966d, 0x966b, 0x9671, 0x966f, 0x96bf, 0x976a, 0x9804, 0x98e5, - 0x9997, 0x509b, 0x5095, 0x5094, 0x509e, 0x508b, 0x50a3, 0x5083, - 0x508c, 0x508e, 0x509d, 0x5068, 0x509c, 0x5092, 0x5082, 0x5087, - 0x515f, 0x51d4, 0x5312, 0x5311, 0x53a4, 0x53a7, 0x5591, 0x55a8, - 0x55a5, 0x55ad, 0x5577, 0x5645, 0x55a2, 0x5593, 0x5588, 0x558f, - 0x55b5, 0x5581, 0x55a3, 0x5592, 0x55a4, 0x557d, 0x558c, 0x55a6, - 0x557f, 0x5595, 0x55a1, 0x558e, 0x570c, 0x5829, 0x5837, 0x5819, - 0x581e, 0x5827, 0x5823, 0x5828, 0x57f5, 0x5848, 0x5825, 0x581c, - 0x581b, 0x5833, 0x583f, 0x5836, 0x582e, 0x5839, 0x5838, 0x582d, - 0x582c, 0x583b, 0x5961, 0x5aaf, 0x5a94, 0x5a9f, 0x5a7a, 0x5aa2, - 0x5a9e, 0x5a78, 0x5aa6, 0x5a7c, 0x5aa5, 0x5aac, 0x5a95, 0x5aae, - 0x5a37, 0x5a84, 0x5a8a, 0x5a97, 0x5a83, 0x5a8b, 0x5aa9, 0x5a7b, - 0x5a7d, 0x5a8c, 0x5a9c, 0x5a8f, 0x5a93, 0x5a9d, 0x5bea, 0x5bcd, - 0x5bcb, 0x5bd4, 0x5bd1, 0x5bca, 0x5bce, 0x5c0c, 0x5c30, 0x5d37, - 0x5d43, 0x5d6b, 0x5d41, 0x5d4b, 0x5d3f, 0x5d35, 0x5d51, 0x5d4e, - 0x5d55, 0x5d33, 0x5d3a, 0x5d52, 0x5d3d, 0x5d31, 0x5d59, 0x5d42, - 0x5d39, 0x5d49, 0x5d38, 0x5d3c, 0x5d32, 0x5d36, 0x5d40, 0x5d45, - 0x5e44, 0x5e41, 0x5f58, 0x5fa6, 0x5fa5, 0x5fab, 0x60c9, 0x60b9, - 0x60cc, 0x60e2, 0x60ce, 0x60c4, 0x6114, - /* 0xd9 */ - 0x60f2, 0x610a, 0x6116, 0x6105, 0x60f5, 0x6113, 0x60f8, 0x60fc, - 0x60fe, 0x60c1, 0x6103, 0x6118, 0x611d, 0x6110, 0x60ff, 0x6104, - 0x610b, 0x624a, 0x6394, 0x63b1, 0x63b0, 0x63ce, 0x63e5, 0x63e8, - 0x63ef, 0x63c3, 0x649d, 0x63f3, 0x63ca, 0x63e0, 0x63f6, 0x63d5, - 0x63f2, 0x63f5, 0x6461, 0x63df, 0x63be, 0x63dd, 0x63dc, 0x63c4, - 0x63d8, 0x63d3, 0x63c2, 0x63c7, 0x63cc, 0x63cb, 0x63c8, 0x63f0, - 0x63d7, 0x63d9, 0x6532, 0x6567, 0x656a, 0x6564, 0x655c, 0x6568, - 0x6565, 0x658c, 0x659d, 0x659e, 0x65ae, 0x65d0, 0x65d2, 0x667c, - 0x666c, 0x667b, 0x6680, 0x6671, 0x6679, 0x666a, 0x6672, 0x6701, - 0x690c, 0x68d3, 0x6904, 0x68dc, 0x692a, 0x68ec, 0x68ea, 0x68f1, - 0x690f, 0x68d6, 0x68f7, 0x68eb, 0x68e4, 0x68f6, 0x6913, 0x6910, - 0x68f3, 0x68e1, 0x6907, 0x68cc, 0x6908, 0x6970, 0x68b4, 0x6911, - 0x68ef, 0x68c6, 0x6914, 0x68f8, 0x68d0, 0x68fd, 0x68fc, 0x68e8, - 0x690b, 0x690a, 0x6917, 0x68ce, 0x68c8, 0x68dd, 0x68de, 0x68e6, - 0x68f4, 0x68d1, 0x6906, 0x68d4, 0x68e9, 0x6915, 0x6925, 0x68c7, - 0x6b39, 0x6b3b, 0x6b3f, 0x6b3c, 0x6b94, 0x6b97, 0x6b99, 0x6b95, - 0x6bbd, 0x6bf0, 0x6bf2, 0x6bf3, 0x6c30, 0x6dfc, 0x6e46, 0x6e47, - 0x6e1f, 0x6e49, 0x6e88, 0x6e3c, 0x6e3d, 0x6e45, 0x6e62, 0x6e2b, - 0x6e3f, 0x6e41, 0x6e5d, 0x6e73, 0x6e1c, 0x6e33, 0x6e4b, 0x6e40, - 0x6e51, 0x6e3b, 0x6e03, 0x6e2e, 0x6e5e, - /* 0xda */ - 0x6e68, 0x6e5c, 0x6e61, 0x6e31, 0x6e28, 0x6e60, 0x6e71, 0x6e6b, - 0x6e39, 0x6e22, 0x6e30, 0x6e53, 0x6e65, 0x6e27, 0x6e78, 0x6e64, - 0x6e77, 0x6e55, 0x6e79, 0x6e52, 0x6e66, 0x6e35, 0x6e36, 0x6e5a, - 0x7120, 0x711e, 0x712f, 0x70fb, 0x712e, 0x7131, 0x7123, 0x7125, - 0x7122, 0x7132, 0x711f, 0x7128, 0x713a, 0x711b, 0x724b, 0x725a, - 0x7288, 0x7289, 0x7286, 0x7285, 0x728b, 0x7312, 0x730b, 0x7330, - 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732d, 0x7326, 0x7323, - 0x7335, 0x730c, 0x742e, 0x742c, 0x7430, 0x742b, 0x7416, 0x741a, - 0x7421, 0x742d, 0x7431, 0x7424, 0x7423, 0x741d, 0x7429, 0x7420, - 0x7432, 0x74fb, 0x752f, 0x756f, 0x756c, 0x75e7, 0x75da, 0x75e1, - 0x75e6, 0x75dd, 0x75df, 0x75e4, 0x75d7, 0x7695, 0x7692, 0x76da, - 0x7746, 0x7747, 0x7744, 0x774d, 0x7745, 0x774a, 0x774e, 0x774b, - 0x774c, 0x77de, 0x77ec, 0x7860, 0x7864, 0x7865, 0x785c, 0x786d, - 0x7871, 0x786a, 0x786e, 0x7870, 0x7869, 0x7868, 0x785e, 0x7862, - 0x7974, 0x7973, 0x7972, 0x7970, 0x7a02, 0x7a0a, 0x7a03, 0x7a0c, - 0x7a04, 0x7a99, 0x7ae6, 0x7ae4, 0x7b4a, 0x7b3b, 0x7b44, 0x7b48, - 0x7b4c, 0x7b4e, 0x7b40, 0x7b58, 0x7b45, 0x7ca2, 0x7c9e, 0x7ca8, - 0x7ca1, 0x7d58, 0x7d6f, 0x7d63, 0x7d53, 0x7d56, 0x7d67, 0x7d6a, - 0x7d4f, 0x7d6d, 0x7d5c, 0x7d6b, 0x7d52, 0x7d54, 0x7d69, 0x7d51, - 0x7d5f, 0x7d4e, 0x7f3e, 0x7f3f, 0x7f65, - /* 0xdb */ - 0x7f66, 0x7fa2, 0x7fa0, 0x7fa1, 0x7fd7, 0x8051, 0x804f, 0x8050, - 0x80fe, 0x80d4, 0x8143, 0x814a, 0x8152, 0x814f, 0x8147, 0x813d, - 0x814d, 0x813a, 0x81e6, 0x81ee, 0x81f7, 0x81f8, 0x81f9, 0x8204, - 0x823c, 0x823d, 0x823f, 0x8275, 0x833b, 0x83cf, 0x83f9, 0x8423, - 0x83c0, 0x83e8, 0x8412, 0x83e7, 0x83e4, 0x83fc, 0x83f6, 0x8410, - 0x83c6, 0x83c8, 0x83eb, 0x83e3, 0x83bf, 0x8401, 0x83dd, 0x83e5, - 0x83d8, 0x83ff, 0x83e1, 0x83cb, 0x83ce, 0x83d6, 0x83f5, 0x83c9, - 0x8409, 0x840f, 0x83de, 0x8411, 0x8406, 0x83c2, 0x83f3, 0x83d5, - 0x83fa, 0x83c7, 0x83d1, 0x83ea, 0x8413, 0x83c3, 0x83ec, 0x83ee, - 0x83c4, 0x83fb, 0x83d7, 0x83e2, 0x841b, 0x83db, 0x83fe, 0x86d8, - 0x86e2, 0x86e6, 0x86d3, 0x86e3, 0x86da, 0x86ea, 0x86dd, 0x86eb, - 0x86dc, 0x86ec, 0x86e9, 0x86d7, 0x86e8, 0x86d1, 0x8848, 0x8856, - 0x8855, 0x88ba, 0x88d7, 0x88b9, 0x88b8, 0x88c0, 0x88be, 0x88b6, - 0x88bc, 0x88b7, 0x88bd, 0x88b2, 0x8901, 0x88c9, 0x8995, 0x8998, - 0x8997, 0x89dd, 0x89da, 0x89db, 0x8a4e, 0x8a4d, 0x8a39, 0x8a59, - 0x8a40, 0x8a57, 0x8a58, 0x8a44, 0x8a45, 0x8a52, 0x8a48, 0x8a51, - 0x8a4a, 0x8a4c, 0x8a4f, 0x8c5f, 0x8c81, 0x8c80, 0x8cba, 0x8cbe, - 0x8cb0, 0x8cb9, 0x8cb5, 0x8d84, 0x8d80, 0x8d89, 0x8dd8, 0x8dd3, - 0x8dcd, 0x8dc7, 0x8dd6, 0x8ddc, 0x8dcf, 0x8dd5, 0x8dd9, 0x8dc8, - 0x8dd7, 0x8dc5, 0x8eef, 0x8ef7, 0x8efa, - /* 0xdc */ - 0x8ef9, 0x8ee6, 0x8eee, 0x8ee5, 0x8ef5, 0x8ee7, 0x8ee8, 0x8ef6, - 0x8eeb, 0x8ef1, 0x8eec, 0x8ef4, 0x8ee9, 0x902d, 0x9034, 0x902f, - 0x9106, 0x912c, 0x9104, 0x90ff, 0x90fc, 0x9108, 0x90f9, 0x90fb, - 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915f, - 0x9162, 0x9160, 0x9201, 0x920a, 0x9225, 0x9203, 0x921a, 0x9226, - 0x920f, 0x920c, 0x9200, 0x9212, 0x91ff, 0x91fd, 0x9206, 0x9204, - 0x9227, 0x9202, 0x921c, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, - 0x957b, 0x958d, 0x958c, 0x9590, 0x9687, 0x967e, 0x9688, 0x9689, - 0x9683, 0x9680, 0x96c2, 0x96c8, 0x96c3, 0x96f1, 0x96f0, 0x976c, - 0x9770, 0x976e, 0x9807, 0x98a9, 0x98eb, 0x9ce6, 0x9ef9, 0x4e83, - 0x4e84, 0x4eb6, 0x50bd, 0x50bf, 0x50c6, 0x50ae, 0x50c4, 0x50ca, - 0x50b4, 0x50c8, 0x50c2, 0x50b0, 0x50c1, 0x50ba, 0x50b1, 0x50cb, - 0x50c9, 0x50b6, 0x50b8, 0x51d7, 0x527a, 0x5278, 0x527b, 0x527c, - 0x55c3, 0x55db, 0x55cc, 0x55d0, 0x55cb, 0x55ca, 0x55dd, 0x55c0, - 0x55d4, 0x55c4, 0x55e9, 0x55bf, 0x55d2, 0x558d, 0x55cf, 0x55d5, - 0x55e2, 0x55d6, 0x55c8, 0x55f2, 0x55cd, 0x55d9, 0x55c2, 0x5714, - 0x5853, 0x5868, 0x5864, 0x584f, 0x584d, 0x5849, 0x586f, 0x5855, - 0x584e, 0x585d, 0x5859, 0x5865, 0x585b, 0x583d, 0x5863, 0x5871, - 0x58fc, 0x5ac7, 0x5ac4, 0x5acb, 0x5aba, 0x5ab8, 0x5ab1, 0x5ab5, - 0x5ab0, 0x5abf, 0x5ac8, 0x5abb, 0x5ac6, - /* 0xdd */ - 0x5ab7, 0x5ac0, 0x5aca, 0x5ab4, 0x5ab6, 0x5acd, 0x5ab9, 0x5a90, - 0x5bd6, 0x5bd8, 0x5bd9, 0x5c1f, 0x5c33, 0x5d71, 0x5d63, 0x5d4a, - 0x5d65, 0x5d72, 0x5d6c, 0x5d5e, 0x5d68, 0x5d67, 0x5d62, 0x5df0, - 0x5e4f, 0x5e4e, 0x5e4a, 0x5e4d, 0x5e4b, 0x5ec5, 0x5ecc, 0x5ec6, - 0x5ecb, 0x5ec7, 0x5f40, 0x5faf, 0x5fad, 0x60f7, 0x6149, 0x614a, - 0x612b, 0x6145, 0x6136, 0x6132, 0x612e, 0x6146, 0x612f, 0x614f, - 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63c5, - 0x63f1, 0x63eb, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, 0x6433, - 0x6443, 0x641f, 0x6415, 0x6418, 0x6439, 0x6437, 0x6422, 0x6423, - 0x640c, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, 0x642f, 0x640a, - 0x641a, 0x6440, 0x6425, 0x6427, 0x640b, 0x63e7, 0x641b, 0x642e, - 0x6421, 0x640e, 0x656f, 0x6592, 0x65d3, 0x6686, 0x668c, 0x6695, - 0x6690, 0x668b, 0x668a, 0x6699, 0x6694, 0x6678, 0x6720, 0x6966, - 0x695f, 0x6938, 0x694e, 0x6962, 0x6971, 0x693f, 0x6945, 0x696a, - 0x6939, 0x6942, 0x6957, 0x6959, 0x697a, 0x6948, 0x6949, 0x6935, - 0x696c, 0x6933, 0x693d, 0x6965, 0x68f0, 0x6978, 0x6934, 0x6969, - 0x6940, 0x696f, 0x6944, 0x6976, 0x6958, 0x6941, 0x6974, 0x694c, - 0x693b, 0x694b, 0x6937, 0x695c, 0x694f, 0x6951, 0x6932, 0x6952, - 0x692f, 0x697b, 0x693c, 0x6b46, 0x6b45, 0x6b43, 0x6b42, 0x6b48, - 0x6b41, 0x6b9b, 0xfa0d, 0x6bfb, 0x6bfc, - /* 0xde */ - 0x6bf9, 0x6bf7, 0x6bf8, 0x6e9b, 0x6ed6, 0x6ec8, 0x6e8f, 0x6ec0, - 0x6e9f, 0x6e93, 0x6e94, 0x6ea0, 0x6eb1, 0x6eb9, 0x6ec6, 0x6ed2, - 0x6ebd, 0x6ec1, 0x6e9e, 0x6ec9, 0x6eb7, 0x6eb0, 0x6ecd, 0x6ea6, - 0x6ecf, 0x6eb2, 0x6ebe, 0x6ec3, 0x6edc, 0x6ed8, 0x6e99, 0x6e92, - 0x6e8e, 0x6e8d, 0x6ea4, 0x6ea1, 0x6ebf, 0x6eb3, 0x6ed0, 0x6eca, - 0x6e97, 0x6eae, 0x6ea3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, - 0x7141, 0x715d, 0x7162, 0x7172, 0x7178, 0x716a, 0x7161, 0x7142, - 0x7158, 0x7143, 0x714b, 0x7170, 0x715f, 0x7150, 0x7153, 0x7144, - 0x714d, 0x715a, 0x724f, 0x728d, 0x728c, 0x7291, 0x7290, 0x728e, - 0x733c, 0x7342, 0x733b, 0x733a, 0x7340, 0x734a, 0x7349, 0x7444, - 0x744a, 0x744b, 0x7452, 0x7451, 0x7457, 0x7440, 0x744f, 0x7450, - 0x744e, 0x7442, 0x7446, 0x744d, 0x7454, 0x74e1, 0x74ff, 0x74fe, - 0x74fd, 0x751d, 0x7579, 0x7577, 0x6983, 0x75ef, 0x760f, 0x7603, - 0x75f7, 0x75fe, 0x75fc, 0x75f9, 0x75f8, 0x7610, 0x75fb, 0x75f6, - 0x75ed, 0x75f5, 0x75fd, 0x7699, 0x76b5, 0x76dd, 0x7755, 0x775f, - 0x7760, 0x7752, 0x7756, 0x775a, 0x7769, 0x7767, 0x7754, 0x7759, - 0x776d, 0x77e0, 0x7887, 0x789a, 0x7894, 0x788f, 0x7884, 0x7895, - 0x7885, 0x7886, 0x78a1, 0x7883, 0x7879, 0x7899, 0x7880, 0x7896, - 0x787b, 0x797c, 0x7982, 0x797d, 0x7979, 0x7a11, 0x7a18, 0x7a19, - 0x7a12, 0x7a17, 0x7a15, 0x7a22, 0x7a13, - /* 0xdf */ - 0x7a1b, 0x7a10, 0x7aa3, 0x7aa2, 0x7a9e, 0x7aeb, 0x7b66, 0x7b64, - 0x7b6d, 0x7b74, 0x7b69, 0x7b72, 0x7b65, 0x7b73, 0x7b71, 0x7b70, - 0x7b61, 0x7b78, 0x7b76, 0x7b63, 0x7cb2, 0x7cb4, 0x7caf, 0x7d88, - 0x7d86, 0x7d80, 0x7d8d, 0x7d7f, 0x7d85, 0x7d7a, 0x7d8e, 0x7d7b, - 0x7d83, 0x7d7c, 0x7d8c, 0x7d94, 0x7d84, 0x7d7d, 0x7d92, 0x7f6d, - 0x7f6b, 0x7f67, 0x7f68, 0x7f6c, 0x7fa6, 0x7fa5, 0x7fa7, 0x7fdb, - 0x7fdc, 0x8021, 0x8164, 0x8160, 0x8177, 0x815c, 0x8169, 0x815b, - 0x8162, 0x8172, 0x6721, 0x815e, 0x8176, 0x8167, 0x816f, 0x8144, - 0x8161, 0x821d, 0x8249, 0x8244, 0x8240, 0x8242, 0x8245, 0x84f1, - 0x843f, 0x8456, 0x8476, 0x8479, 0x848f, 0x848d, 0x8465, 0x8451, - 0x8440, 0x8486, 0x8467, 0x8430, 0x844d, 0x847d, 0x845a, 0x8459, - 0x8474, 0x8473, 0x845d, 0x8507, 0x845e, 0x8437, 0x843a, 0x8434, - 0x847a, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, 0x83d9, 0x844b, - 0x842f, 0x8442, 0x842d, 0x845f, 0x8470, 0x8439, 0x844e, 0x844c, - 0x8452, 0x846f, 0x84c5, 0x848e, 0x843b, 0x8447, 0x8436, 0x8433, - 0x8468, 0x847e, 0x8444, 0x842b, 0x8460, 0x8454, 0x846e, 0x8450, - 0x870b, 0x8704, 0x86f7, 0x870c, 0x86fa, 0x86d6, 0x86f5, 0x874d, - 0x86f8, 0x870e, 0x8709, 0x8701, 0x86f6, 0x870d, 0x8705, 0x88d6, - 0x88cb, 0x88cd, 0x88ce, 0x88de, 0x88db, 0x88da, 0x88cc, 0x88d0, - 0x8985, 0x899b, 0x89df, 0x89e5, 0x89e4, - /* 0xe0 */ - 0x89e1, 0x89e0, 0x89e2, 0x89dc, 0x89e6, 0x8a76, 0x8a86, 0x8a7f, - 0x8a61, 0x8a3f, 0x8a77, 0x8a82, 0x8a84, 0x8a75, 0x8a83, 0x8a81, - 0x8a74, 0x8a7a, 0x8c3c, 0x8c4b, 0x8c4a, 0x8c65, 0x8c64, 0x8c66, - 0x8c86, 0x8c84, 0x8c85, 0x8ccc, 0x8d68, 0x8d69, 0x8d91, 0x8d8c, - 0x8d8e, 0x8d8f, 0x8d8d, 0x8d93, 0x8d94, 0x8d90, 0x8d92, 0x8df0, - 0x8de0, 0x8dec, 0x8df1, 0x8dee, 0x8dd0, 0x8de9, 0x8de3, 0x8de2, - 0x8de7, 0x8df2, 0x8deb, 0x8df4, 0x8f06, 0x8eff, 0x8f01, 0x8f00, - 0x8f05, 0x8f07, 0x8f08, 0x8f02, 0x8f0b, 0x9052, 0x903f, 0x9044, - 0x9049, 0x903d, 0x9110, 0x910d, 0x910f, 0x9111, 0x9116, 0x9114, - 0x910b, 0x910e, 0x916e, 0x916f, 0x9248, 0x9252, 0x9230, 0x923a, - 0x9266, 0x9233, 0x9265, 0x925e, 0x9283, 0x922e, 0x924a, 0x9246, - 0x926d, 0x926c, 0x924f, 0x9260, 0x9267, 0x926f, 0x9236, 0x9261, - 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, 0x924e, 0x9253, - 0x924c, 0x9256, 0x9232, 0x959f, 0x959c, 0x959e, 0x959b, 0x9692, - 0x9693, 0x9691, 0x9697, 0x96ce, 0x96fa, 0x96fd, 0x96f8, 0x96f5, - 0x9773, 0x9777, 0x9778, 0x9772, 0x980f, 0x980d, 0x980e, 0x98ac, - 0x98f6, 0x98f9, 0x99af, 0x99b2, 0x99b0, 0x99b5, 0x9aad, 0x9aab, - 0x9b5b, 0x9cea, 0x9ced, 0x9ce7, 0x9e80, 0x9efd, 0x50e6, 0x50d4, - 0x50d7, 0x50e8, 0x50f3, 0x50db, 0x50ea, 0x50dd, 0x50e4, 0x50d3, - 0x50ec, 0x50f0, 0x50ef, 0x50e3, 0x50e0, - /* 0xe1 */ - 0x51d8, 0x5280, 0x5281, 0x52e9, 0x52eb, 0x5330, 0x53ac, 0x5627, - 0x5615, 0x560c, 0x5612, 0x55fc, 0x560f, 0x561c, 0x5601, 0x5613, - 0x5602, 0x55fa, 0x561d, 0x5604, 0x55ff, 0x55f9, 0x5889, 0x587c, - 0x5890, 0x5898, 0x5886, 0x5881, 0x587f, 0x5874, 0x588b, 0x587a, - 0x5887, 0x5891, 0x588e, 0x5876, 0x5882, 0x5888, 0x587b, 0x5894, - 0x588f, 0x58fe, 0x596b, 0x5adc, 0x5aee, 0x5ae5, 0x5ad5, 0x5aea, - 0x5ada, 0x5aed, 0x5aeb, 0x5af3, 0x5ae2, 0x5ae0, 0x5adb, 0x5aec, - 0x5ade, 0x5add, 0x5ad9, 0x5ae8, 0x5adf, 0x5b77, 0x5be0, 0x5be3, - 0x5c63, 0x5d82, 0x5d80, 0x5d7d, 0x5d86, 0x5d7a, 0x5d81, 0x5d77, - 0x5d8a, 0x5d89, 0x5d88, 0x5d7e, 0x5d7c, 0x5d8d, 0x5d79, 0x5d7f, - 0x5e58, 0x5e59, 0x5e53, 0x5ed8, 0x5ed1, 0x5ed7, 0x5ece, 0x5edc, - 0x5ed5, 0x5ed9, 0x5ed2, 0x5ed4, 0x5f44, 0x5f43, 0x5f6f, 0x5fb6, - 0x612c, 0x6128, 0x6141, 0x615e, 0x6171, 0x6173, 0x6152, 0x6153, - 0x6172, 0x616c, 0x6180, 0x6174, 0x6154, 0x617a, 0x615b, 0x6165, - 0x613b, 0x616a, 0x6161, 0x6156, 0x6229, 0x6227, 0x622b, 0x642b, - 0x644d, 0x645b, 0x645d, 0x6474, 0x6476, 0x6472, 0x6473, 0x647d, - 0x6475, 0x6466, 0x64a6, 0x644e, 0x6482, 0x645e, 0x645c, 0x644b, - 0x6453, 0x6460, 0x6450, 0x647f, 0x643f, 0x646c, 0x646b, 0x6459, - 0x6465, 0x6477, 0x6573, 0x65a0, 0x66a1, 0x66a0, 0x669f, 0x6705, - 0x6704, 0x6722, 0x69b1, 0x69b6, 0x69c9, - /* 0xe2 */ - 0x69a0, 0x69ce, 0x6996, 0x69b0, 0x69ac, 0x69bc, 0x6991, 0x6999, - 0x698e, 0x69a7, 0x698d, 0x69a9, 0x69be, 0x69af, 0x69bf, 0x69c4, - 0x69bd, 0x69a4, 0x69d4, 0x69b9, 0x69ca, 0x699a, 0x69cf, 0x69b3, - 0x6993, 0x69aa, 0x69a1, 0x699e, 0x69d9, 0x6997, 0x6990, 0x69c2, - 0x69b5, 0x69a5, 0x69c6, 0x6b4a, 0x6b4d, 0x6b4b, 0x6b9e, 0x6b9f, - 0x6ba0, 0x6bc3, 0x6bc4, 0x6bfe, 0x6ece, 0x6ef5, 0x6ef1, 0x6f03, - 0x6f25, 0x6ef8, 0x6f37, 0x6efb, 0x6f2e, 0x6f09, 0x6f4e, 0x6f19, - 0x6f1a, 0x6f27, 0x6f18, 0x6f3b, 0x6f12, 0x6eed, 0x6f0a, 0x6f36, - 0x6f73, 0x6ef9, 0x6eee, 0x6f2d, 0x6f40, 0x6f30, 0x6f3c, 0x6f35, - 0x6eeb, 0x6f07, 0x6f0e, 0x6f43, 0x6f05, 0x6efd, 0x6ef6, 0x6f39, - 0x6f1c, 0x6efc, 0x6f3a, 0x6f1f, 0x6f0d, 0x6f1e, 0x6f08, 0x6f21, - 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, 0x718f, 0x717b, - 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, 0x7295, 0x7293, - 0x7343, 0x734d, 0x7351, 0x734c, 0x7462, 0x7473, 0x7471, 0x7475, - 0x7472, 0x7467, 0x746e, 0x7500, 0x7502, 0x7503, 0x757d, 0x7590, - 0x7616, 0x7608, 0x760c, 0x7615, 0x7611, 0x760a, 0x7614, 0x76b8, - 0x7781, 0x777c, 0x7785, 0x7782, 0x776e, 0x7780, 0x776f, 0x777e, - 0x7783, 0x78b2, 0x78aa, 0x78b4, 0x78ad, 0x78a8, 0x787e, 0x78ab, - 0x789e, 0x78a5, 0x78a0, 0x78ac, 0x78a2, 0x78a4, 0x7998, 0x798a, - 0x798b, 0x7996, 0x7995, 0x7994, 0x7993, - /* 0xe3 */ - 0x7997, 0x7988, 0x7992, 0x7990, 0x7a2b, 0x7a4a, 0x7a30, 0x7a2f, - 0x7a28, 0x7a26, 0x7aa8, 0x7aab, 0x7aac, 0x7aee, 0x7b88, 0x7b9c, - 0x7b8a, 0x7b91, 0x7b90, 0x7b96, 0x7b8d, 0x7b8c, 0x7b9b, 0x7b8e, - 0x7b85, 0x7b98, 0x5284, 0x7b99, 0x7ba4, 0x7b82, 0x7cbb, 0x7cbf, - 0x7cbc, 0x7cba, 0x7da7, 0x7db7, 0x7dc2, 0x7da3, 0x7daa, 0x7dc1, - 0x7dc0, 0x7dc5, 0x7d9d, 0x7dce, 0x7dc4, 0x7dc6, 0x7dcb, 0x7dcc, - 0x7daf, 0x7db9, 0x7d96, 0x7dbc, 0x7d9f, 0x7da6, 0x7dae, 0x7da9, - 0x7da1, 0x7dc9, 0x7f73, 0x7fe2, 0x7fe3, 0x7fe5, 0x7fde, 0x8024, - 0x805d, 0x805c, 0x8189, 0x8186, 0x8183, 0x8187, 0x818d, 0x818c, - 0x818b, 0x8215, 0x8497, 0x84a4, 0x84a1, 0x849f, 0x84ba, 0x84ce, - 0x84c2, 0x84ac, 0x84ae, 0x84ab, 0x84b9, 0x84b4, 0x84c1, 0x84cd, - 0x84aa, 0x849a, 0x84b1, 0x84d0, 0x849d, 0x84a7, 0x84bb, 0x84a2, - 0x8494, 0x84c7, 0x84cc, 0x849b, 0x84a9, 0x84af, 0x84a8, 0x84d6, - 0x8498, 0x84b6, 0x84cf, 0x84a0, 0x84d7, 0x84d4, 0x84d2, 0x84db, - 0x84b0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, 0x876b, 0x8740, - 0x872e, 0x871e, 0x8721, 0x8719, 0x871b, 0x8743, 0x872c, 0x8741, - 0x873e, 0x8746, 0x8720, 0x8732, 0x872a, 0x872d, 0x873c, 0x8712, - 0x873a, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, 0x8738, 0x8724, - 0x871a, 0x8730, 0x8711, 0x88f7, 0x88e7, 0x88f1, 0x88f2, 0x88fa, - 0x88fe, 0x88ee, 0x88fc, 0x88f6, 0x88fb, - /* 0xe4 */ - 0x88f0, 0x88ec, 0x88eb, 0x899d, 0x89a1, 0x899f, 0x899e, 0x89e9, - 0x89eb, 0x89e8, 0x8aab, 0x8a99, 0x8a8b, 0x8a92, 0x8a8f, 0x8a96, - 0x8c3d, 0x8c68, 0x8c69, 0x8cd5, 0x8ccf, 0x8cd7, 0x8d96, 0x8e09, - 0x8e02, 0x8dff, 0x8e0d, 0x8dfd, 0x8e0a, 0x8e03, 0x8e07, 0x8e06, - 0x8e05, 0x8dfe, 0x8e00, 0x8e04, 0x8f10, 0x8f11, 0x8f0e, 0x8f0d, - 0x9123, 0x911c, 0x9120, 0x9122, 0x911f, 0x911d, 0x911a, 0x9124, - 0x9121, 0x911b, 0x917a, 0x9172, 0x9179, 0x9173, 0x92a5, 0x92a4, - 0x9276, 0x929b, 0x927a, 0x92a0, 0x9294, 0x92aa, 0x928d, 0x92a6, - 0x929a, 0x92ab, 0x9279, 0x9297, 0x927f, 0x92a3, 0x92ee, 0x928e, - 0x9282, 0x9295, 0x92a2, 0x927d, 0x9288, 0x92a1, 0x928a, 0x9286, - 0x928c, 0x9299, 0x92a7, 0x927e, 0x9287, 0x92a9, 0x929d, 0x928b, - 0x922d, 0x969e, 0x96a1, 0x96ff, 0x9758, 0x977d, 0x977a, 0x977e, - 0x9783, 0x9780, 0x9782, 0x977b, 0x9784, 0x9781, 0x977f, 0x97ce, - 0x97cd, 0x9816, 0x98ad, 0x98ae, 0x9902, 0x9900, 0x9907, 0x999d, - 0x999c, 0x99c3, 0x99b9, 0x99bb, 0x99ba, 0x99c2, 0x99bd, 0x99c7, - 0x9ab1, 0x9ae3, 0x9ae7, 0x9b3e, 0x9b3f, 0x9b60, 0x9b61, 0x9b5f, - 0x9cf1, 0x9cf2, 0x9cf5, 0x9ea7, 0x50ff, 0x5103, 0x5130, 0x50f8, - 0x5106, 0x5107, 0x50f6, 0x50fe, 0x510b, 0x510c, 0x50fd, 0x510a, - 0x528b, 0x528c, 0x52f1, 0x52ef, 0x5648, 0x5642, 0x564c, 0x5635, - 0x5641, 0x564a, 0x5649, 0x5646, 0x5658, - /* 0xe5 */ - 0x565a, 0x5640, 0x5633, 0x563d, 0x562c, 0x563e, 0x5638, 0x562a, - 0x563a, 0x571a, 0x58ab, 0x589d, 0x58b1, 0x58a0, 0x58a3, 0x58af, - 0x58ac, 0x58a5, 0x58a1, 0x58ff, 0x5aff, 0x5af4, 0x5afd, 0x5af7, - 0x5af6, 0x5b03, 0x5af8, 0x5b02, 0x5af9, 0x5b01, 0x5b07, 0x5b05, - 0x5b0f, 0x5c67, 0x5d99, 0x5d97, 0x5d9f, 0x5d92, 0x5da2, 0x5d93, - 0x5d95, 0x5da0, 0x5d9c, 0x5da1, 0x5d9a, 0x5d9e, 0x5e69, 0x5e5d, - 0x5e60, 0x5e5c, 0x7df3, 0x5edb, 0x5ede, 0x5ee1, 0x5f49, 0x5fb2, - 0x618b, 0x6183, 0x6179, 0x61b1, 0x61b0, 0x61a2, 0x6189, 0x619b, - 0x6193, 0x61af, 0x61ad, 0x619f, 0x6192, 0x61aa, 0x61a1, 0x618d, - 0x6166, 0x61b3, 0x622d, 0x646e, 0x6470, 0x6496, 0x64a0, 0x6485, - 0x6497, 0x649c, 0x648f, 0x648b, 0x648a, 0x648c, 0x64a3, 0x649f, - 0x6468, 0x64b1, 0x6498, 0x6576, 0x657a, 0x6579, 0x657b, 0x65b2, - 0x65b3, 0x66b5, 0x66b0, 0x66a9, 0x66b2, 0x66b7, 0x66aa, 0x66af, - 0x6a00, 0x6a06, 0x6a17, 0x69e5, 0x69f8, 0x6a15, 0x69f1, 0x69e4, - 0x6a20, 0x69ff, 0x69ec, 0x69e2, 0x6a1b, 0x6a1d, 0x69fe, 0x6a27, - 0x69f2, 0x69ee, 0x6a14, 0x69f7, 0x69e7, 0x6a40, 0x6a08, 0x69e6, - 0x69fb, 0x6a0d, 0x69fc, 0x69eb, 0x6a09, 0x6a04, 0x6a18, 0x6a25, - 0x6a0f, 0x69f6, 0x6a26, 0x6a07, 0x69f4, 0x6a16, 0x6b51, 0x6ba5, - 0x6ba3, 0x6ba2, 0x6ba6, 0x6c01, 0x6c00, 0x6bff, 0x6c02, 0x6f41, - 0x6f26, 0x6f7e, 0x6f87, 0x6fc6, 0x6f92, - /* 0xe6 */ - 0x6f8d, 0x6f89, 0x6f8c, 0x6f62, 0x6f4f, 0x6f85, 0x6f5a, 0x6f96, - 0x6f76, 0x6f6c, 0x6f82, 0x6f55, 0x6f72, 0x6f52, 0x6f50, 0x6f57, - 0x6f94, 0x6f93, 0x6f5d, 0x6f00, 0x6f61, 0x6f6b, 0x6f7d, 0x6f67, - 0x6f90, 0x6f53, 0x6f8b, 0x6f69, 0x6f7f, 0x6f95, 0x6f63, 0x6f77, - 0x6f6a, 0x6f7b, 0x71b2, 0x71af, 0x719b, 0x71b0, 0x71a0, 0x719a, - 0x71a9, 0x71b5, 0x719d, 0x71a5, 0x719e, 0x71a4, 0x71a1, 0x71aa, - 0x719c, 0x71a7, 0x71b3, 0x7298, 0x729a, 0x7358, 0x7352, 0x735e, - 0x735f, 0x7360, 0x735d, 0x735b, 0x7361, 0x735a, 0x7359, 0x7362, - 0x7487, 0x7489, 0x748a, 0x7486, 0x7481, 0x747d, 0x7485, 0x7488, - 0x747c, 0x7479, 0x7508, 0x7507, 0x757e, 0x7625, 0x761e, 0x7619, - 0x761d, 0x761c, 0x7623, 0x761a, 0x7628, 0x761b, 0x769c, 0x769d, - 0x769e, 0x769b, 0x778d, 0x778f, 0x7789, 0x7788, 0x78cd, 0x78bb, - 0x78cf, 0x78cc, 0x78d1, 0x78ce, 0x78d4, 0x78c8, 0x78c3, 0x78c4, - 0x78c9, 0x799a, 0x79a1, 0x79a0, 0x799c, 0x79a2, 0x799b, 0x6b76, - 0x7a39, 0x7ab2, 0x7ab4, 0x7ab3, 0x7bb7, 0x7bcb, 0x7bbe, 0x7bac, - 0x7bce, 0x7baf, 0x7bb9, 0x7bca, 0x7bb5, 0x7cc5, 0x7cc8, 0x7ccc, - 0x7ccb, 0x7df7, 0x7ddb, 0x7dea, 0x7de7, 0x7dd7, 0x7de1, 0x7e03, - 0x7dfa, 0x7de6, 0x7df6, 0x7df1, 0x7df0, 0x7dee, 0x7ddf, 0x7f76, - 0x7fac, 0x7fb0, 0x7fad, 0x7fed, 0x7feb, 0x7fea, 0x7fec, 0x7fe6, - 0x7fe8, 0x8064, 0x8067, 0x81a3, 0x819f, - /* 0xe7 */ - 0x819e, 0x8195, 0x81a2, 0x8199, 0x8197, 0x8216, 0x824f, 0x8253, - 0x8252, 0x8250, 0x824e, 0x8251, 0x8524, 0x853b, 0x850f, 0x8500, - 0x8529, 0x850e, 0x8509, 0x850d, 0x851f, 0x850a, 0x8527, 0x851c, - 0x84fb, 0x852b, 0x84fa, 0x8508, 0x850c, 0x84f4, 0x852a, 0x84f2, - 0x8515, 0x84f7, 0x84eb, 0x84f3, 0x84fc, 0x8512, 0x84ea, 0x84e9, - 0x8516, 0x84fe, 0x8528, 0x851d, 0x852e, 0x8502, 0x84fd, 0x851e, - 0x84f6, 0x8531, 0x8526, 0x84e7, 0x84e8, 0x84f0, 0x84ef, 0x84f9, - 0x8518, 0x8520, 0x8530, 0x850b, 0x8519, 0x852f, 0x8662, 0x8756, - 0x8763, 0x8764, 0x8777, 0x87e1, 0x8773, 0x8758, 0x8754, 0x875b, - 0x8752, 0x8761, 0x875a, 0x8751, 0x875e, 0x876d, 0x876a, 0x8750, - 0x874e, 0x875f, 0x875d, 0x876f, 0x876c, 0x877a, 0x876e, 0x875c, - 0x8765, 0x874f, 0x877b, 0x8775, 0x8762, 0x8767, 0x8769, 0x885a, - 0x8905, 0x890c, 0x8914, 0x890b, 0x8917, 0x8918, 0x8919, 0x8906, - 0x8916, 0x8911, 0x890e, 0x8909, 0x89a2, 0x89a4, 0x89a3, 0x89ed, - 0x89f0, 0x89ec, 0x8acf, 0x8ac6, 0x8ab8, 0x8ad3, 0x8ad1, 0x8ad4, - 0x8ad5, 0x8abb, 0x8ad7, 0x8abe, 0x8ac0, 0x8ac5, 0x8ad8, 0x8ac3, - 0x8aba, 0x8abd, 0x8ad9, 0x8c3e, 0x8c4d, 0x8c8f, 0x8ce5, 0x8cdf, - 0x8cd9, 0x8ce8, 0x8cda, 0x8cdd, 0x8ce7, 0x8da0, 0x8d9c, 0x8da1, - 0x8d9b, 0x8e20, 0x8e23, 0x8e25, 0x8e24, 0x8e2e, 0x8e15, 0x8e1b, - 0x8e16, 0x8e11, 0x8e19, 0x8e26, 0x8e27, - /* 0xe8 */ - 0x8e14, 0x8e12, 0x8e18, 0x8e13, 0x8e1c, 0x8e17, 0x8e1a, 0x8f2c, - 0x8f24, 0x8f18, 0x8f1a, 0x8f20, 0x8f23, 0x8f16, 0x8f17, 0x9073, - 0x9070, 0x906f, 0x9067, 0x906b, 0x912f, 0x912b, 0x9129, 0x912a, - 0x9132, 0x9126, 0x912e, 0x9185, 0x9186, 0x918a, 0x9181, 0x9182, - 0x9184, 0x9180, 0x92d0, 0x92c3, 0x92c4, 0x92c0, 0x92d9, 0x92b6, - 0x92cf, 0x92f1, 0x92df, 0x92d8, 0x92e9, 0x92d7, 0x92dd, 0x92cc, - 0x92ef, 0x92c2, 0x92e8, 0x92ca, 0x92c8, 0x92ce, 0x92e6, 0x92cd, - 0x92d5, 0x92c9, 0x92e0, 0x92de, 0x92e7, 0x92d1, 0x92d3, 0x92b5, - 0x92e1, 0x92c6, 0x92b4, 0x957c, 0x95ac, 0x95ab, 0x95ae, 0x95b0, - 0x96a4, 0x96a2, 0x96d3, 0x9705, 0x9708, 0x9702, 0x975a, 0x978a, - 0x978e, 0x9788, 0x97d0, 0x97cf, 0x981e, 0x981d, 0x9826, 0x9829, - 0x9828, 0x9820, 0x981b, 0x9827, 0x98b2, 0x9908, 0x98fa, 0x9911, - 0x9914, 0x9916, 0x9917, 0x9915, 0x99dc, 0x99cd, 0x99cf, 0x99d3, - 0x99d4, 0x99ce, 0x99c9, 0x99d6, 0x99d8, 0x99cb, 0x99d7, 0x99cc, - 0x9ab3, 0x9aec, 0x9aeb, 0x9af3, 0x9af2, 0x9af1, 0x9b46, 0x9b43, - 0x9b67, 0x9b74, 0x9b71, 0x9b66, 0x9b76, 0x9b75, 0x9b70, 0x9b68, - 0x9b64, 0x9b6c, 0x9cfc, 0x9cfa, 0x9cfd, 0x9cff, 0x9cf7, 0x9d07, - 0x9d00, 0x9cf9, 0x9cfb, 0x9d08, 0x9d05, 0x9d04, 0x9e83, 0x9ed3, - 0x9f0f, 0x9f10, 0x511c, 0x5113, 0x5117, 0x511a, 0x5111, 0x51de, - 0x5334, 0x53e1, 0x5670, 0x5660, 0x566e, - /* 0xe9 */ - 0x5673, 0x5666, 0x5663, 0x566d, 0x5672, 0x565e, 0x5677, 0x571c, - 0x571b, 0x58c8, 0x58bd, 0x58c9, 0x58bf, 0x58ba, 0x58c2, 0x58bc, - 0x58c6, 0x5b17, 0x5b19, 0x5b1b, 0x5b21, 0x5b14, 0x5b13, 0x5b10, - 0x5b16, 0x5b28, 0x5b1a, 0x5b20, 0x5b1e, 0x5bef, 0x5dac, 0x5db1, - 0x5da9, 0x5da7, 0x5db5, 0x5db0, 0x5dae, 0x5daa, 0x5da8, 0x5db2, - 0x5dad, 0x5daf, 0x5db4, 0x5e67, 0x5e68, 0x5e66, 0x5e6f, 0x5ee9, - 0x5ee7, 0x5ee6, 0x5ee8, 0x5ee5, 0x5f4b, 0x5fbc, 0x619d, 0x61a8, - 0x6196, 0x61c5, 0x61b4, 0x61c6, 0x61c1, 0x61cc, 0x61ba, 0x61bf, - 0x61b8, 0x618c, 0x64d7, 0x64d6, 0x64d0, 0x64cf, 0x64c9, 0x64bd, - 0x6489, 0x64c3, 0x64db, 0x64f3, 0x64d9, 0x6533, 0x657f, 0x657c, - 0x65a2, 0x66c8, 0x66be, 0x66c0, 0x66ca, 0x66cb, 0x66cf, 0x66bd, - 0x66bb, 0x66ba, 0x66cc, 0x6723, 0x6a34, 0x6a66, 0x6a49, 0x6a67, - 0x6a32, 0x6a68, 0x6a3e, 0x6a5d, 0x6a6d, 0x6a76, 0x6a5b, 0x6a51, - 0x6a28, 0x6a5a, 0x6a3b, 0x6a3f, 0x6a41, 0x6a6a, 0x6a64, 0x6a50, - 0x6a4f, 0x6a54, 0x6a6f, 0x6a69, 0x6a60, 0x6a3c, 0x6a5e, 0x6a56, - 0x6a55, 0x6a4d, 0x6a4e, 0x6a46, 0x6b55, 0x6b54, 0x6b56, 0x6ba7, - 0x6baa, 0x6bab, 0x6bc8, 0x6bc7, 0x6c04, 0x6c03, 0x6c06, 0x6fad, - 0x6fcb, 0x6fa3, 0x6fc7, 0x6fbc, 0x6fce, 0x6fc8, 0x6f5e, 0x6fc4, - 0x6fbd, 0x6f9e, 0x6fca, 0x6fa8, 0x7004, 0x6fa5, 0x6fae, 0x6fba, - 0x6fac, 0x6faa, 0x6fcf, 0x6fbf, 0x6fb8, - /* 0xea */ - 0x6fa2, 0x6fc9, 0x6fab, 0x6fcd, 0x6faf, 0x6fb2, 0x6fb0, 0x71c5, - 0x71c2, 0x71bf, 0x71b8, 0x71d6, 0x71c0, 0x71c1, 0x71cb, 0x71d4, - 0x71ca, 0x71c7, 0x71cf, 0x71bd, 0x71d8, 0x71bc, 0x71c6, 0x71da, - 0x71db, 0x729d, 0x729e, 0x7369, 0x7366, 0x7367, 0x736c, 0x7365, - 0x736b, 0x736a, 0x747f, 0x749a, 0x74a0, 0x7494, 0x7492, 0x7495, - 0x74a1, 0x750b, 0x7580, 0x762f, 0x762d, 0x7631, 0x763d, 0x7633, - 0x763c, 0x7635, 0x7632, 0x7630, 0x76bb, 0x76e6, 0x779a, 0x779d, - 0x77a1, 0x779c, 0x779b, 0x77a2, 0x77a3, 0x7795, 0x7799, 0x7797, - 0x78dd, 0x78e9, 0x78e5, 0x78ea, 0x78de, 0x78e3, 0x78db, 0x78e1, - 0x78e2, 0x78ed, 0x78df, 0x78e0, 0x79a4, 0x7a44, 0x7a48, 0x7a47, - 0x7ab6, 0x7ab8, 0x7ab5, 0x7ab1, 0x7ab7, 0x7bde, 0x7be3, 0x7be7, - 0x7bdd, 0x7bd5, 0x7be5, 0x7bda, 0x7be8, 0x7bf9, 0x7bd4, 0x7bea, - 0x7be2, 0x7bdc, 0x7beb, 0x7bd8, 0x7bdf, 0x7cd2, 0x7cd4, 0x7cd7, - 0x7cd0, 0x7cd1, 0x7e12, 0x7e21, 0x7e17, 0x7e0c, 0x7e1f, 0x7e20, - 0x7e13, 0x7e0e, 0x7e1c, 0x7e15, 0x7e1a, 0x7e22, 0x7e0b, 0x7e0f, - 0x7e16, 0x7e0d, 0x7e14, 0x7e25, 0x7e24, 0x7f43, 0x7f7b, 0x7f7c, - 0x7f7a, 0x7fb1, 0x7fef, 0x802a, 0x8029, 0x806c, 0x81b1, 0x81a6, - 0x81ae, 0x81b9, 0x81b5, 0x81ab, 0x81b0, 0x81ac, 0x81b4, 0x81b2, - 0x81b7, 0x81a7, 0x81f2, 0x8255, 0x8256, 0x8257, 0x8556, 0x8545, - 0x856b, 0x854d, 0x8553, 0x8561, 0x8558, - /* 0xeb */ - 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, - 0x8563, 0x853e, 0x855b, 0x8571, 0x854e, 0x856e, 0x8575, 0x8555, - 0x8567, 0x8560, 0x858c, 0x8566, 0x855d, 0x8554, 0x8565, 0x856c, - 0x8663, 0x8665, 0x8664, 0x879b, 0x878f, 0x8797, 0x8793, 0x8792, - 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87a3, 0x8785, - 0x8790, 0x8791, 0x879d, 0x8784, 0x8794, 0x879c, 0x879a, 0x8789, - 0x891e, 0x8926, 0x8930, 0x892d, 0x892e, 0x8927, 0x8931, 0x8922, - 0x8929, 0x8923, 0x892f, 0x892c, 0x891f, 0x89f1, 0x8ae0, 0x8ae2, - 0x8af2, 0x8af4, 0x8af5, 0x8add, 0x8b14, 0x8ae4, 0x8adf, 0x8af0, - 0x8ac8, 0x8ade, 0x8ae1, 0x8ae8, 0x8aff, 0x8aef, 0x8afb, 0x8c91, - 0x8c92, 0x8c90, 0x8cf5, 0x8cee, 0x8cf1, 0x8cf0, 0x8cf3, 0x8d6c, - 0x8d6e, 0x8da5, 0x8da7, 0x8e33, 0x8e3e, 0x8e38, 0x8e40, 0x8e45, - 0x8e36, 0x8e3c, 0x8e3d, 0x8e41, 0x8e30, 0x8e3f, 0x8ebd, 0x8f36, - 0x8f2e, 0x8f35, 0x8f32, 0x8f39, 0x8f37, 0x8f34, 0x9076, 0x9079, - 0x907b, 0x9086, 0x90fa, 0x9133, 0x9135, 0x9136, 0x9193, 0x9190, - 0x9191, 0x918d, 0x918f, 0x9327, 0x931e, 0x9308, 0x931f, 0x9306, - 0x930f, 0x937a, 0x9338, 0x933c, 0x931b, 0x9323, 0x9312, 0x9301, - 0x9346, 0x932d, 0x930e, 0x930d, 0x92cb, 0x931d, 0x92fa, 0x9325, - 0x9313, 0x92f9, 0x92f7, 0x9334, 0x9302, 0x9324, 0x92ff, 0x9329, - 0x9339, 0x9335, 0x932a, 0x9314, 0x930c, - /* 0xec */ - 0x930b, 0x92fe, 0x9309, 0x9300, 0x92fb, 0x9316, 0x95bc, 0x95cd, - 0x95be, 0x95b9, 0x95ba, 0x95b6, 0x95bf, 0x95b5, 0x95bd, 0x96a9, - 0x96d4, 0x970b, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97f0, - 0x97f8, 0x9835, 0x982f, 0x9832, 0x9924, 0x991f, 0x9927, 0x9929, - 0x999e, 0x99ee, 0x99ec, 0x99e5, 0x99e4, 0x99f0, 0x99e3, 0x99ea, - 0x99e9, 0x99e7, 0x9ab9, 0x9abf, 0x9ab4, 0x9abb, 0x9af6, 0x9afa, - 0x9af9, 0x9af7, 0x9b33, 0x9b80, 0x9b85, 0x9b87, 0x9b7c, 0x9b7e, - 0x9b7b, 0x9b82, 0x9b93, 0x9b92, 0x9b90, 0x9b7a, 0x9b95, 0x9b7d, - 0x9b88, 0x9d25, 0x9d17, 0x9d20, 0x9d1e, 0x9d14, 0x9d29, 0x9d1d, - 0x9d18, 0x9d22, 0x9d10, 0x9d19, 0x9d1f, 0x9e88, 0x9e86, 0x9e87, - 0x9eae, 0x9ead, 0x9ed5, 0x9ed6, 0x9efa, 0x9f12, 0x9f3d, 0x5126, - 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52f4, 0x5693, 0x568c, - 0x568d, 0x5686, 0x5684, 0x5683, 0x567e, 0x5682, 0x567f, 0x5681, - 0x58d6, 0x58d4, 0x58cf, 0x58d2, 0x5b2d, 0x5b25, 0x5b32, 0x5b23, - 0x5b2c, 0x5b27, 0x5b26, 0x5b2f, 0x5b2e, 0x5b7b, 0x5bf1, 0x5bf2, - 0x5db7, 0x5e6c, 0x5e6a, 0x5fbe, 0x5fbb, 0x61c3, 0x61b5, 0x61bc, - 0x61e7, 0x61e0, 0x61e5, 0x61e4, 0x61e8, 0x61de, 0x64ef, 0x64e9, - 0x64e3, 0x64eb, 0x64e4, 0x64e8, 0x6581, 0x6580, 0x65b6, 0x65da, - 0x66d2, 0x6a8d, 0x6a96, 0x6a81, 0x6aa5, 0x6a89, 0x6a9f, 0x6a9b, - 0x6aa1, 0x6a9e, 0x6a87, 0x6a93, 0x6a8e, - /* 0xed */ - 0x6a95, 0x6a83, 0x6aa8, 0x6aa4, 0x6a91, 0x6a7f, 0x6aa6, 0x6a9a, - 0x6a85, 0x6a8c, 0x6a92, 0x6b5b, 0x6bad, 0x6c09, 0x6fcc, 0x6fa9, - 0x6ff4, 0x6fd4, 0x6fe3, 0x6fdc, 0x6fed, 0x6fe7, 0x6fe6, 0x6fde, - 0x6ff2, 0x6fdd, 0x6fe2, 0x6fe8, 0x71e1, 0x71f1, 0x71e8, 0x71f2, - 0x71e4, 0x71f0, 0x71e2, 0x7373, 0x736e, 0x736f, 0x7497, 0x74b2, - 0x74ab, 0x7490, 0x74aa, 0x74ad, 0x74b1, 0x74a5, 0x74af, 0x7510, - 0x7511, 0x7512, 0x750f, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, - 0x76a4, 0x76e9, 0x77b5, 0x77ab, 0x77b2, 0x77b7, 0x77b6, 0x77b4, - 0x77b1, 0x77a8, 0x77f0, 0x78f3, 0x78fd, 0x7902, 0x78fb, 0x78fc, - 0x78f2, 0x7905, 0x78f9, 0x78fe, 0x7904, 0x79ab, 0x79a8, 0x7a5c, - 0x7a5b, 0x7a56, 0x7a58, 0x7a54, 0x7a5a, 0x7abe, 0x7ac0, 0x7ac1, - 0x7c05, 0x7c0f, 0x7bf2, 0x7c00, 0x7bff, 0x7bfb, 0x7c0e, 0x7bf4, - 0x7c0b, 0x7bf3, 0x7c02, 0x7c09, 0x7c03, 0x7c01, 0x7bf8, 0x7bfd, - 0x7c06, 0x7bf0, 0x7bf1, 0x7c10, 0x7c0a, 0x7ce8, 0x7e2d, 0x7e3c, - 0x7e42, 0x7e33, 0x9848, 0x7e38, 0x7e2a, 0x7e49, 0x7e40, 0x7e47, - 0x7e29, 0x7e4c, 0x7e30, 0x7e3b, 0x7e36, 0x7e44, 0x7e3a, 0x7f45, - 0x7f7f, 0x7f7e, 0x7f7d, 0x7ff4, 0x7ff2, 0x802c, 0x81bb, 0x81c4, - 0x81cc, 0x81ca, 0x81c5, 0x81c7, 0x81bc, 0x81e9, 0x825b, 0x825a, - 0x825c, 0x8583, 0x8580, 0x858f, 0x85a7, 0x8595, 0x85a0, 0x858b, - 0x85a3, 0x857b, 0x85a4, 0x859a, 0x859e, - /* 0xee */ - 0x8577, 0x857c, 0x8589, 0x85a1, 0x857a, 0x8578, 0x8557, 0x858e, - 0x8596, 0x8586, 0x858d, 0x8599, 0x859d, 0x8581, 0x85a2, 0x8582, - 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859f, 0x8668, - 0x87be, 0x87aa, 0x87ad, 0x87c5, 0x87b0, 0x87ac, 0x87b9, 0x87b5, - 0x87bc, 0x87ae, 0x87c9, 0x87c3, 0x87c2, 0x87cc, 0x87b7, 0x87af, - 0x87c4, 0x87ca, 0x87b4, 0x87b6, 0x87bf, 0x87b8, 0x87bd, 0x87de, - 0x87b2, 0x8935, 0x8933, 0x893c, 0x893e, 0x8941, 0x8952, 0x8937, - 0x8942, 0x89ad, 0x89af, 0x89ae, 0x89f2, 0x89f3, 0x8b1e, 0x8b18, - 0x8b16, 0x8b11, 0x8b05, 0x8b0b, 0x8b22, 0x8b0f, 0x8b12, 0x8b15, - 0x8b07, 0x8b0d, 0x8b08, 0x8b06, 0x8b1c, 0x8b13, 0x8b1a, 0x8c4f, - 0x8c70, 0x8c72, 0x8c71, 0x8c6f, 0x8c95, 0x8c94, 0x8cf9, 0x8d6f, - 0x8e4e, 0x8e4d, 0x8e53, 0x8e50, 0x8e4c, 0x8e47, 0x8f43, 0x8f40, - 0x9085, 0x907e, 0x9138, 0x919a, 0x91a2, 0x919b, 0x9199, 0x919f, - 0x91a1, 0x919d, 0x91a0, 0x93a1, 0x9383, 0x93af, 0x9364, 0x9356, - 0x9347, 0x937c, 0x9358, 0x935c, 0x9376, 0x9349, 0x9350, 0x9351, - 0x9360, 0x936d, 0x938f, 0x934c, 0x936a, 0x9379, 0x9357, 0x9355, - 0x9352, 0x934f, 0x9371, 0x9377, 0x937b, 0x9361, 0x935e, 0x9363, - 0x9367, 0x9380, 0x934e, 0x9359, 0x95c7, 0x95c0, 0x95c9, 0x95c3, - 0x95c5, 0x95b7, 0x96ae, 0x96b0, 0x96ac, 0x9720, 0x971f, 0x9718, - 0x971d, 0x9719, 0x979a, 0x97a1, 0x979c, - /* 0xef */ - 0x979e, 0x979d, 0x97d5, 0x97d4, 0x97f1, 0x9841, 0x9844, 0x984a, - 0x9849, 0x9845, 0x9843, 0x9925, 0x992b, 0x992c, 0x992a, 0x9933, - 0x9932, 0x992f, 0x992d, 0x9931, 0x9930, 0x9998, 0x99a3, 0x99a1, - 0x9a02, 0x99fa, 0x99f4, 0x99f7, 0x99f9, 0x99f8, 0x99f6, 0x99fb, - 0x99fd, 0x99fe, 0x99fc, 0x9a03, 0x9abe, 0x9afe, 0x9afd, 0x9b01, - 0x9afc, 0x9b48, 0x9b9a, 0x9ba8, 0x9b9e, 0x9b9b, 0x9ba6, 0x9ba1, - 0x9ba5, 0x9ba4, 0x9b86, 0x9ba2, 0x9ba0, 0x9baf, 0x9d33, 0x9d41, - 0x9d67, 0x9d36, 0x9d2e, 0x9d2f, 0x9d31, 0x9d38, 0x9d30, 0x9d45, - 0x9d42, 0x9d43, 0x9d3e, 0x9d37, 0x9d40, 0x9d3d, 0x7ff5, 0x9d2d, - 0x9e8a, 0x9e89, 0x9e8d, 0x9eb0, 0x9ec8, 0x9eda, 0x9efb, 0x9eff, - 0x9f24, 0x9f23, 0x9f22, 0x9f54, 0x9fa0, 0x5131, 0x512d, 0x512e, - 0x5698, 0x569c, 0x5697, 0x569a, 0x569d, 0x5699, 0x5970, 0x5b3c, - 0x5c69, 0x5c6a, 0x5dc0, 0x5e6d, 0x5e6e, 0x61d8, 0x61df, 0x61ed, - 0x61ee, 0x61f1, 0x61ea, 0x61f0, 0x61eb, 0x61d6, 0x61e9, 0x64ff, - 0x6504, 0x64fd, 0x64f8, 0x6501, 0x6503, 0x64fc, 0x6594, 0x65db, - 0x66da, 0x66db, 0x66d8, 0x6ac5, 0x6ab9, 0x6abd, 0x6ae1, 0x6ac6, - 0x6aba, 0x6ab6, 0x6ab7, 0x6ac7, 0x6ab4, 0x6aad, 0x6b5e, 0x6bc9, - 0x6c0b, 0x7007, 0x700c, 0x700d, 0x7001, 0x7005, 0x7014, 0x700e, - 0x6fff, 0x7000, 0x6ffb, 0x7026, 0x6ffc, 0x6ff7, 0x700a, 0x7201, - 0x71ff, 0x71f9, 0x7203, 0x71fd, 0x7376, - /* 0xf0 */ - 0x74b8, 0x74c0, 0x74b5, 0x74c1, 0x74be, 0x74b6, 0x74bb, 0x74c2, - 0x7514, 0x7513, 0x765c, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, - 0x765a, 0x76a6, 0x76bd, 0x76ec, 0x77c2, 0x77ba, 0x78ff, 0x790c, - 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79ad, 0x79ac, - 0x7a5f, 0x7c1c, 0x7c29, 0x7c19, 0x7c20, 0x7c1f, 0x7c2d, 0x7c1d, - 0x7c26, 0x7c28, 0x7c22, 0x7c25, 0x7c30, 0x7e5c, 0x7e50, 0x7e56, - 0x7e63, 0x7e58, 0x7e62, 0x7e5f, 0x7e51, 0x7e60, 0x7e57, 0x7e53, - 0x7fb5, 0x7fb3, 0x7ff7, 0x7ff8, 0x8075, 0x81d1, 0x81d2, 0x81d0, - 0x825f, 0x825e, 0x85b4, 0x85c6, 0x85c0, 0x85c3, 0x85c2, 0x85b3, - 0x85b5, 0x85bd, 0x85c7, 0x85c4, 0x85bf, 0x85cb, 0x85ce, 0x85c8, - 0x85c5, 0x85b1, 0x85b6, 0x85d2, 0x8624, 0x85b8, 0x85b7, 0x85be, - 0x8669, 0x87e7, 0x87e6, 0x87e2, 0x87db, 0x87eb, 0x87ea, 0x87e5, - 0x87df, 0x87f3, 0x87e4, 0x87d4, 0x87dc, 0x87d3, 0x87ed, 0x87d8, - 0x87e3, 0x87a4, 0x87d7, 0x87d9, 0x8801, 0x87f4, 0x87e8, 0x87dd, - 0x8953, 0x894b, 0x894f, 0x894c, 0x8946, 0x8950, 0x8951, 0x8949, - 0x8b2a, 0x8b27, 0x8b23, 0x8b33, 0x8b30, 0x8b35, 0x8b47, 0x8b2f, - 0x8b3c, 0x8b3e, 0x8b31, 0x8b25, 0x8b37, 0x8b26, 0x8b36, 0x8b2e, - 0x8b24, 0x8b3b, 0x8b3d, 0x8b3a, 0x8c42, 0x8c75, 0x8c99, 0x8c98, - 0x8c97, 0x8cfe, 0x8d04, 0x8d02, 0x8d00, 0x8e5c, 0x8e62, 0x8e60, - 0x8e57, 0x8e56, 0x8e5e, 0x8e65, 0x8e67, - /* 0xf1 */ - 0x8e5b, 0x8e5a, 0x8e61, 0x8e5d, 0x8e69, 0x8e54, 0x8f46, 0x8f47, - 0x8f48, 0x8f4b, 0x9128, 0x913a, 0x913b, 0x913e, 0x91a8, 0x91a5, - 0x91a7, 0x91af, 0x91aa, 0x93b5, 0x938c, 0x9392, 0x93b7, 0x939b, - 0x939d, 0x9389, 0x93a7, 0x938e, 0x93aa, 0x939e, 0x93a6, 0x9395, - 0x9388, 0x9399, 0x939f, 0x938d, 0x93b1, 0x9391, 0x93b2, 0x93a4, - 0x93a8, 0x93b4, 0x93a3, 0x93a5, 0x95d2, 0x95d3, 0x95d1, 0x96b3, - 0x96d7, 0x96da, 0x5dc2, 0x96df, 0x96d8, 0x96dd, 0x9723, 0x9722, - 0x9725, 0x97ac, 0x97ae, 0x97a8, 0x97ab, 0x97a4, 0x97aa, 0x97a2, - 0x97a5, 0x97d7, 0x97d9, 0x97d6, 0x97d8, 0x97fa, 0x9850, 0x9851, - 0x9852, 0x98b8, 0x9941, 0x993c, 0x993a, 0x9a0f, 0x9a0b, 0x9a09, - 0x9a0d, 0x9a04, 0x9a11, 0x9a0a, 0x9a05, 0x9a07, 0x9a06, 0x9ac0, - 0x9adc, 0x9b08, 0x9b04, 0x9b05, 0x9b29, 0x9b35, 0x9b4a, 0x9b4c, - 0x9b4b, 0x9bc7, 0x9bc6, 0x9bc3, 0x9bbf, 0x9bc1, 0x9bb5, 0x9bb8, - 0x9bd3, 0x9bb6, 0x9bc4, 0x9bb9, 0x9bbd, 0x9d5c, 0x9d53, 0x9d4f, - 0x9d4a, 0x9d5b, 0x9d4b, 0x9d59, 0x9d56, 0x9d4c, 0x9d57, 0x9d52, - 0x9d54, 0x9d5f, 0x9d58, 0x9d5a, 0x9e8e, 0x9e8c, 0x9edf, 0x9f01, - 0x9f00, 0x9f16, 0x9f25, 0x9f2b, 0x9f2a, 0x9f29, 0x9f28, 0x9f4c, - 0x9f55, 0x5134, 0x5135, 0x5296, 0x52f7, 0x53b4, 0x56ab, 0x56ad, - 0x56a6, 0x56a7, 0x56aa, 0x56ac, 0x58da, 0x58dd, 0x58db, 0x5912, - 0x5b3d, 0x5b3e, 0x5b3f, 0x5dc3, 0x5e70, - /* 0xf2 */ - 0x5fbf, 0x61fb, 0x6507, 0x6510, 0x650d, 0x6509, 0x650c, 0x650e, - 0x6584, 0x65de, 0x65dd, 0x66de, 0x6ae7, 0x6ae0, 0x6acc, 0x6ad1, - 0x6ad9, 0x6acb, 0x6adf, 0x6adc, 0x6ad0, 0x6aeb, 0x6acf, 0x6acd, - 0x6ade, 0x6b60, 0x6bb0, 0x6c0c, 0x7019, 0x7027, 0x7020, 0x7016, - 0x702b, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701c, - 0x702a, 0x720c, 0x720a, 0x7207, 0x7202, 0x7205, 0x72a5, 0x72a6, - 0x72a4, 0x72a3, 0x72a1, 0x74cb, 0x74c5, 0x74b7, 0x74c3, 0x7516, - 0x7660, 0x77c9, 0x77ca, 0x77c4, 0x77f1, 0x791d, 0x791b, 0x7921, - 0x791c, 0x7917, 0x791e, 0x79b0, 0x7a67, 0x7a68, 0x7c33, 0x7c3c, - 0x7c39, 0x7c2c, 0x7c3b, 0x7cec, 0x7cea, 0x7e76, 0x7e75, 0x7e78, - 0x7e70, 0x7e77, 0x7e6f, 0x7e7a, 0x7e72, 0x7e74, 0x7e68, 0x7f4b, - 0x7f4a, 0x7f83, 0x7f86, 0x7fb7, 0x7ffd, 0x7ffe, 0x8078, 0x81d7, - 0x81d5, 0x8264, 0x8261, 0x8263, 0x85eb, 0x85f1, 0x85ed, 0x85d9, - 0x85e1, 0x85e8, 0x85da, 0x85d7, 0x85ec, 0x85f2, 0x85f8, 0x85d8, - 0x85df, 0x85e3, 0x85dc, 0x85d1, 0x85f0, 0x85e6, 0x85ef, 0x85de, - 0x85e2, 0x8800, 0x87fa, 0x8803, 0x87f6, 0x87f7, 0x8809, 0x880c, - 0x880b, 0x8806, 0x87fc, 0x8808, 0x87ff, 0x880a, 0x8802, 0x8962, - 0x895a, 0x895b, 0x8957, 0x8961, 0x895c, 0x8958, 0x895d, 0x8959, - 0x8988, 0x89b7, 0x89b6, 0x89f6, 0x8b50, 0x8b48, 0x8b4a, 0x8b40, - 0x8b53, 0x8b56, 0x8b54, 0x8b4b, 0x8b55, - /* 0xf3 */ - 0x8b51, 0x8b42, 0x8b52, 0x8b57, 0x8c43, 0x8c77, 0x8c76, 0x8c9a, - 0x8d06, 0x8d07, 0x8d09, 0x8dac, 0x8daa, 0x8dad, 0x8dab, 0x8e6d, - 0x8e78, 0x8e73, 0x8e6a, 0x8e6f, 0x8e7b, 0x8ec2, 0x8f52, 0x8f51, - 0x8f4f, 0x8f50, 0x8f53, 0x8fb4, 0x9140, 0x913f, 0x91b0, 0x91ad, - 0x93de, 0x93c7, 0x93cf, 0x93c2, 0x93da, 0x93d0, 0x93f9, 0x93ec, - 0x93cc, 0x93d9, 0x93a9, 0x93e6, 0x93ca, 0x93d4, 0x93ee, 0x93e3, - 0x93d5, 0x93c4, 0x93ce, 0x93c0, 0x93d2, 0x93e7, 0x957d, 0x95da, - 0x95db, 0x96e1, 0x9729, 0x972b, 0x972c, 0x9728, 0x9726, 0x97b3, - 0x97b7, 0x97b6, 0x97dd, 0x97de, 0x97df, 0x985c, 0x9859, 0x985d, - 0x9857, 0x98bf, 0x98bd, 0x98bb, 0x98be, 0x9948, 0x9947, 0x9943, - 0x99a6, 0x99a7, 0x9a1a, 0x9a15, 0x9a25, 0x9a1d, 0x9a24, 0x9a1b, - 0x9a22, 0x9a20, 0x9a27, 0x9a23, 0x9a1e, 0x9a1c, 0x9a14, 0x9ac2, - 0x9b0b, 0x9b0a, 0x9b0e, 0x9b0c, 0x9b37, 0x9bea, 0x9beb, 0x9be0, - 0x9bde, 0x9be4, 0x9be6, 0x9be2, 0x9bf0, 0x9bd4, 0x9bd7, 0x9bec, - 0x9bdc, 0x9bd9, 0x9be5, 0x9bd5, 0x9be1, 0x9bda, 0x9d77, 0x9d81, - 0x9d8a, 0x9d84, 0x9d88, 0x9d71, 0x9d80, 0x9d78, 0x9d86, 0x9d8b, - 0x9d8c, 0x9d7d, 0x9d6b, 0x9d74, 0x9d75, 0x9d70, 0x9d69, 0x9d85, - 0x9d73, 0x9d7b, 0x9d82, 0x9d6f, 0x9d79, 0x9d7f, 0x9d87, 0x9d68, - 0x9e94, 0x9e91, 0x9ec0, 0x9efc, 0x9f2d, 0x9f40, 0x9f41, 0x9f4d, - 0x9f56, 0x9f57, 0x9f58, 0x5337, 0x56b2, - /* 0xf4 */ - 0x56b5, 0x56b3, 0x58e3, 0x5b45, 0x5dc6, 0x5dc7, 0x5eee, 0x5eef, - 0x5fc0, 0x5fc1, 0x61f9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65df, - 0x66e8, 0x66e3, 0x66e4, 0x6af3, 0x6af0, 0x6aea, 0x6ae8, 0x6af9, - 0x6af1, 0x6aee, 0x6aef, 0x703c, 0x7035, 0x702f, 0x7037, 0x7034, - 0x7031, 0x7042, 0x7038, 0x703f, 0x703a, 0x7039, 0x7040, 0x703b, - 0x7033, 0x7041, 0x7213, 0x7214, 0x72a8, 0x737d, 0x737c, 0x74ba, - 0x76ab, 0x76aa, 0x76be, 0x76ed, 0x77cc, 0x77ce, 0x77cf, 0x77cd, - 0x77f2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, 0x79b2, - 0x7a6e, 0x7a6c, 0x7a6d, 0x7af7, 0x7c49, 0x7c48, 0x7c4a, 0x7c47, - 0x7c45, 0x7cee, 0x7e7b, 0x7e7e, 0x7e81, 0x7e80, 0x7fba, 0x7fff, - 0x8079, 0x81db, 0x81d9, 0x820b, 0x8268, 0x8269, 0x8622, 0x85ff, - 0x8601, 0x85fe, 0x861b, 0x8600, 0x85f6, 0x8604, 0x8609, 0x8605, - 0x860c, 0x85fd, 0x8819, 0x8810, 0x8811, 0x8817, 0x8813, 0x8816, - 0x8963, 0x8966, 0x89b9, 0x89f7, 0x8b60, 0x8b6a, 0x8b5d, 0x8b68, - 0x8b63, 0x8b65, 0x8b67, 0x8b6d, 0x8dae, 0x8e86, 0x8e88, 0x8e84, - 0x8f59, 0x8f56, 0x8f57, 0x8f55, 0x8f58, 0x8f5a, 0x908d, 0x9143, - 0x9141, 0x91b7, 0x91b5, 0x91b2, 0x91b3, 0x940b, 0x9413, 0x93fb, - 0x9420, 0x940f, 0x9414, 0x93fe, 0x9415, 0x9410, 0x9428, 0x9419, - 0x940d, 0x93f5, 0x9400, 0x93f7, 0x9407, 0x940e, 0x9416, 0x9412, - 0x93fa, 0x9409, 0x93f8, 0x940a, 0x93ff, - /* 0xf5 */ - 0x93fc, 0x940c, 0x93f6, 0x9411, 0x9406, 0x95de, 0x95e0, 0x95df, - 0x972e, 0x972f, 0x97b9, 0x97bb, 0x97fd, 0x97fe, 0x9860, 0x9862, - 0x9863, 0x985f, 0x98c1, 0x98c2, 0x9950, 0x994e, 0x9959, 0x994c, - 0x994b, 0x9953, 0x9a32, 0x9a34, 0x9a31, 0x9a2c, 0x9a2a, 0x9a36, - 0x9a29, 0x9a2e, 0x9a38, 0x9a2d, 0x9ac7, 0x9aca, 0x9ac6, 0x9b10, - 0x9b12, 0x9b11, 0x9c0b, 0x9c08, 0x9bf7, 0x9c05, 0x9c12, 0x9bf8, - 0x9c40, 0x9c07, 0x9c0e, 0x9c06, 0x9c17, 0x9c14, 0x9c09, 0x9d9f, - 0x9d99, 0x9da4, 0x9d9d, 0x9d92, 0x9d98, 0x9d90, 0x9d9b, 0x9da0, - 0x9d94, 0x9d9c, 0x9daa, 0x9d97, 0x9da1, 0x9d9a, 0x9da2, 0x9da8, - 0x9d9e, 0x9da3, 0x9dbf, 0x9da9, 0x9d96, 0x9da6, 0x9da7, 0x9e99, - 0x9e9b, 0x9e9a, 0x9ee5, 0x9ee4, 0x9ee7, 0x9ee6, 0x9f30, 0x9f2e, - 0x9f5b, 0x9f60, 0x9f5e, 0x9f5d, 0x9f59, 0x9f91, 0x513a, 0x5139, - 0x5298, 0x5297, 0x56c3, 0x56bd, 0x56be, 0x5b48, 0x5b47, 0x5dcb, - 0x5dcf, 0x5ef1, 0x61fd, 0x651b, 0x6b02, 0x6afc, 0x6b03, 0x6af8, - 0x6b00, 0x7043, 0x7044, 0x704a, 0x7048, 0x7049, 0x7045, 0x7046, - 0x721d, 0x721a, 0x7219, 0x737e, 0x7517, 0x766a, 0x77d0, 0x792d, - 0x7931, 0x792f, 0x7c54, 0x7c53, 0x7cf2, 0x7e8a, 0x7e87, 0x7e88, - 0x7e8b, 0x7e86, 0x7e8d, 0x7f4d, 0x7fbb, 0x8030, 0x81dd, 0x8618, - 0x862a, 0x8626, 0x861f, 0x8623, 0x861c, 0x8619, 0x8627, 0x862e, - 0x8621, 0x8620, 0x8629, 0x861e, 0x8625, - /* 0xf6 */ - 0x8829, 0x881d, 0x881b, 0x8820, 0x8824, 0x881c, 0x882b, 0x884a, - 0x896d, 0x8969, 0x896e, 0x896b, 0x89fa, 0x8b79, 0x8b78, 0x8b45, - 0x8b7a, 0x8b7b, 0x8d10, 0x8d14, 0x8daf, 0x8e8e, 0x8e8c, 0x8f5e, - 0x8f5b, 0x8f5d, 0x9146, 0x9144, 0x9145, 0x91b9, 0x943f, 0x943b, - 0x9436, 0x9429, 0x943d, 0x943c, 0x9430, 0x9439, 0x942a, 0x9437, - 0x942c, 0x9440, 0x9431, 0x95e5, 0x95e4, 0x95e3, 0x9735, 0x973a, - 0x97bf, 0x97e1, 0x9864, 0x98c9, 0x98c6, 0x98c0, 0x9958, 0x9956, - 0x9a39, 0x9a3d, 0x9a46, 0x9a44, 0x9a42, 0x9a41, 0x9a3a, 0x9a3f, - 0x9acd, 0x9b15, 0x9b17, 0x9b18, 0x9b16, 0x9b3a, 0x9b52, 0x9c2b, - 0x9c1d, 0x9c1c, 0x9c2c, 0x9c23, 0x9c28, 0x9c29, 0x9c24, 0x9c21, - 0x9db7, 0x9db6, 0x9dbc, 0x9dc1, 0x9dc7, 0x9dca, 0x9dcf, 0x9dbe, - 0x9dc5, 0x9dc3, 0x9dbb, 0x9db5, 0x9dce, 0x9db9, 0x9dba, 0x9dac, - 0x9dc8, 0x9db1, 0x9dad, 0x9dcc, 0x9db3, 0x9dcd, 0x9db2, 0x9e7a, - 0x9e9c, 0x9eeb, 0x9eee, 0x9eed, 0x9f1b, 0x9f18, 0x9f1a, 0x9f31, - 0x9f4e, 0x9f65, 0x9f64, 0x9f92, 0x4eb9, 0x56c6, 0x56c5, 0x56cb, - 0x5971, 0x5b4b, 0x5b4c, 0x5dd5, 0x5dd1, 0x5ef2, 0x6521, 0x6520, - 0x6526, 0x6522, 0x6b0b, 0x6b08, 0x6b09, 0x6c0d, 0x7055, 0x7056, - 0x7057, 0x7052, 0x721e, 0x721f, 0x72a9, 0x737f, 0x74d8, 0x74d5, - 0x74d9, 0x74d7, 0x766d, 0x76ad, 0x7935, 0x79b4, 0x7a70, 0x7a71, - 0x7c57, 0x7c5c, 0x7c59, 0x7c5b, 0x7c5a, - /* 0xf7 */ - 0x7cf4, 0x7cf1, 0x7e91, 0x7f4f, 0x7f87, 0x81de, 0x826b, 0x8634, - 0x8635, 0x8633, 0x862c, 0x8632, 0x8636, 0x882c, 0x8828, 0x8826, - 0x882a, 0x8825, 0x8971, 0x89bf, 0x89be, 0x89fb, 0x8b7e, 0x8b84, - 0x8b82, 0x8b86, 0x8b85, 0x8b7f, 0x8d15, 0x8e95, 0x8e94, 0x8e9a, - 0x8e92, 0x8e90, 0x8e96, 0x8e97, 0x8f60, 0x8f62, 0x9147, 0x944c, - 0x9450, 0x944a, 0x944b, 0x944f, 0x9447, 0x9445, 0x9448, 0x9449, - 0x9446, 0x973f, 0x97e3, 0x986a, 0x9869, 0x98cb, 0x9954, 0x995b, - 0x9a4e, 0x9a53, 0x9a54, 0x9a4c, 0x9a4f, 0x9a48, 0x9a4a, 0x9a49, - 0x9a52, 0x9a50, 0x9ad0, 0x9b19, 0x9b2b, 0x9b3b, 0x9b56, 0x9b55, - 0x9c46, 0x9c48, 0x9c3f, 0x9c44, 0x9c39, 0x9c33, 0x9c41, 0x9c3c, - 0x9c37, 0x9c34, 0x9c32, 0x9c3d, 0x9c36, 0x9ddb, 0x9dd2, 0x9dde, - 0x9dda, 0x9dcb, 0x9dd0, 0x9ddc, 0x9dd1, 0x9ddf, 0x9de9, 0x9dd9, - 0x9dd8, 0x9dd6, 0x9df5, 0x9dd5, 0x9ddd, 0x9eb6, 0x9ef0, 0x9f35, - 0x9f33, 0x9f32, 0x9f42, 0x9f6b, 0x9f95, 0x9fa2, 0x513d, 0x5299, - 0x58e8, 0x58e7, 0x5972, 0x5b4d, 0x5dd8, 0x882f, 0x5f4f, 0x6201, - 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66eb, 0x6b11, 0x6b12, - 0x6b0f, 0x6bca, 0x705b, 0x705a, 0x7222, 0x7382, 0x7381, 0x7383, - 0x7670, 0x77d4, 0x7c67, 0x7c66, 0x7e95, 0x826c, 0x863a, 0x8640, - 0x8639, 0x863c, 0x8631, 0x863b, 0x863e, 0x8830, 0x8832, 0x882e, - 0x8833, 0x8976, 0x8974, 0x8973, 0x89fe, - /* 0xf8 */ - 0x8b8c, 0x8b8e, 0x8b8b, 0x8b88, 0x8c45, 0x8d19, 0x8e98, 0x8f64, - 0x8f63, 0x91bc, 0x9462, 0x9455, 0x945d, 0x9457, 0x945e, 0x97c4, - 0x97c5, 0x9800, 0x9a56, 0x9a59, 0x9b1e, 0x9b1f, 0x9b20, 0x9c52, - 0x9c58, 0x9c50, 0x9c4a, 0x9c4d, 0x9c4b, 0x9c55, 0x9c59, 0x9c4c, - 0x9c4e, 0x9dfb, 0x9df7, 0x9def, 0x9de3, 0x9deb, 0x9df8, 0x9de4, - 0x9df6, 0x9de1, 0x9dee, 0x9de6, 0x9df2, 0x9df0, 0x9de2, 0x9dec, - 0x9df4, 0x9df3, 0x9de8, 0x9ded, 0x9ec2, 0x9ed0, 0x9ef2, 0x9ef3, - 0x9f06, 0x9f1c, 0x9f38, 0x9f37, 0x9f36, 0x9f43, 0x9f4f, 0x9f71, - 0x9f70, 0x9f6e, 0x9f6f, 0x56d3, 0x56cd, 0x5b4e, 0x5c6d, 0x652d, - 0x66ed, 0x66ee, 0x6b13, 0x705f, 0x7061, 0x705d, 0x7060, 0x7223, - 0x74db, 0x74e5, 0x77d5, 0x7938, 0x79b7, 0x79b6, 0x7c6a, 0x7e97, - 0x7f89, 0x826d, 0x8643, 0x8838, 0x8837, 0x8835, 0x884b, 0x8b94, - 0x8b95, 0x8e9e, 0x8e9f, 0x8ea0, 0x8e9d, 0x91be, 0x91bd, 0x91c2, - 0x946b, 0x9468, 0x9469, 0x96e5, 0x9746, 0x9743, 0x9747, 0x97c7, - 0x97e5, 0x9a5e, 0x9ad5, 0x9b59, 0x9c63, 0x9c67, 0x9c66, 0x9c62, - 0x9c5e, 0x9c60, 0x9e02, 0x9dfe, 0x9e07, 0x9e03, 0x9e06, 0x9e05, - 0x9e00, 0x9e01, 0x9e09, 0x9dff, 0x9dfd, 0x9e04, 0x9ea0, 0x9f1e, - 0x9f46, 0x9f74, 0x9f75, 0x9f76, 0x56d4, 0x652e, 0x65b8, 0x6b18, - 0x6b19, 0x6b17, 0x6b1a, 0x7062, 0x7226, 0x72aa, 0x77d8, 0x77d9, - 0x7939, 0x7c69, 0x7c6b, 0x7cf6, 0x7e9a, - /* 0xf9 */ - 0x7e98, 0x7e9b, 0x7e99, 0x81e0, 0x81e1, 0x8646, 0x8647, 0x8648, - 0x8979, 0x897a, 0x897c, 0x897b, 0x89ff, 0x8b98, 0x8b99, 0x8ea5, - 0x8ea4, 0x8ea3, 0x946e, 0x946d, 0x946f, 0x9471, 0x9473, 0x9749, - 0x9872, 0x995f, 0x9c68, 0x9c6e, 0x9c6d, 0x9e0b, 0x9e0d, 0x9e10, - 0x9e0f, 0x9e12, 0x9e11, 0x9ea1, 0x9ef5, 0x9f09, 0x9f47, 0x9f78, - 0x9f7b, 0x9f7a, 0x9f79, 0x571e, 0x7066, 0x7c6f, 0x883c, 0x8db2, - 0x8ea6, 0x91c3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9a60, 0x9c74, - 0x9c73, 0x9c71, 0x9c75, 0x9e14, 0x9e13, 0x9ef6, 0x9f0a, 0x9fa4, - 0x7068, 0x7065, 0x7cf7, 0x866a, 0x883e, 0x883d, 0x883f, 0x8b9e, - 0x8c9c, 0x8ea9, 0x8ec9, 0x974b, 0x9873, 0x9874, 0x98cc, 0x9961, - 0x99ab, 0x9a64, 0x9a66, 0x9a67, 0x9b24, 0x9e15, 0x9e17, 0x9f48, - 0x6207, 0x6b1e, 0x7227, 0x864c, 0x8ea8, 0x9482, 0x9480, 0x9481, - 0x9a69, 0x9a68, 0x9b2e, 0x9e19, 0x7229, 0x864b, 0x8b9f, 0x9483, - 0x9c79, 0x9eb7, 0x7675, 0x9a6b, 0x9c7a, 0x9e1d, 0x7069, 0x706a, - 0x9ea4, 0x9f7e, 0x9f49, 0x9f98, -}; - -static int -big5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = s[0]; - if ((c1 >= 0xa1 && c1 <= 0xc7) || (c1 >= 0xc9 && c1 <= 0xf9)) { - if (n >= 2) { - unsigned char c2 = s[1]; - if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { - unsigned int i = 157 * (c1 - 0xa1) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); - unsigned short wc = 0xfffd; - if (i < 6280) { - if (i < 6121) - wc = big5_2uni_pagea1[i]; - } else { - if (i < 13932) - wc = big5_2uni_pagec9[i-6280]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short big5_2charset[13703] = { - 0xa246, 0xa247, 0xa244, 0xa1b1, 0xa258, 0xa1d3, 0xa150, 0xa1d1, - 0xa1d2, 0xa3be, 0xa3bc, 0xa3bd, 0xa3bf, 0xa3bb, 0xa344, 0xa345, - 0xa346, 0xa347, 0xa348, 0xa349, 0xa34a, 0xa34b, 0xa34c, 0xa34d, - 0xa34e, 0xa34f, 0xa350, 0xa351, 0xa352, 0xa353, 0xa354, 0xa355, - 0xa356, 0xa357, 0xa358, 0xa359, 0xa35a, 0xa35b, 0xa35c, 0xa35d, - 0xa35e, 0xa35f, 0xa360, 0xa361, 0xa362, 0xa363, 0xa364, 0xa365, - 0xa366, 0xa367, 0xa368, 0xa369, 0xa36a, 0xa36b, 0xa36c, 0xa36d, - 0xa36e, 0xa36f, 0xa370, 0xa371, 0xa372, 0xa373, 0xc7b3, 0xc7b1, - 0xc7b2, 0xc7b4, 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, - 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, - 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, - 0xc7cb, 0xc7cc, 0xc7cd, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, - 0xc7d4, 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, - 0xc7dc, 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, - 0xc7e4, 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7ce, 0xa156, 0xa158, - 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, 0xa145, 0xa14c, 0xa14b, 0xa1ac, - 0xa1ab, 0xa1b0, 0xa1c2, 0xa24a, 0xa1c1, 0xa24b, 0xa2b9, 0xa2ba, - 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, 0xa2c1, 0xa2c2, - 0xa1f6, 0xa1f4, 0xa1f7, 0xa1f5, 0xa1f8, 0xa1f9, 0xa1fb, 0xa1fa, - 0xa1d4, 0xa1db, 0xa1e8, 0xa1e7, 0xa1fd, 0xa1fc, 0xa1e4, 0xa1e5, - 0xa1ec, 0xa1ed, 0xa1ef, 0xa1ee, 0xa1e3, 0xa1dc, 0xa1da, 0xa1dd, - 0xa1d8, 0xa1d9, 0xa1e6, 0xa1e9, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, - 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc7f3, 0xc7f4, - 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, 0xc7f9, 0xc7fa, 0xc7fb, 0xc7fc, - 0xa277, 0xa278, 0xa27a, 0xa27b, 0xa27c, 0xa27d, 0xa275, 0xa274, - 0xa273, 0xa272, 0xa271, 0xa2a4, 0xa2a5, 0xa2a7, 0xa2a6, 0xa27e, - 0xa2a1, 0xa2a3, 0xa2a2, 0xa2ac, 0xa2ad, 0xa2ae, 0xa262, 0xa263, - 0xa264, 0xa265, 0xa266, 0xa267, 0xa268, 0xa269, 0xa270, 0xa26f, - 0xa26e, 0xa26d, 0xa26c, 0xa26b, 0xa26a, 0xa276, 0xa279, 0xa1bd, - 0xa1bc, 0xa1b6, 0xa1b5, 0xa1bf, 0xa1be, 0xa1bb, 0xa1ba, 0xa1b3, - 0xa1b7, 0xa1b4, 0xa2a8, 0xa2a9, 0xa2ab, 0xa2aa, 0xa1b9, 0xa1b8, - 0xa1f3, 0xa1f0, 0xa1f2, 0xa1f1, 0xa140, 0xa142, 0xa143, 0xa1b2, - 0xc6a4, 0xa171, 0xa172, 0xa16d, 0xa16e, 0xa175, 0xa176, 0xa179, - 0xa17a, 0xa169, 0xa16a, 0xa245, 0xa165, 0xa166, 0xa1a9, 0xa1aa, - 0xa2c3, 0xa2c4, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, 0xa2c9, 0xa2ca, - 0xa2cb, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, - 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, - 0xc6b4, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, - 0xc6bc, 0xc6bd, 0xc6be, 0xc6bf, 0xc6c0, 0xc6c1, 0xc6c2, 0xc6c3, - 0xc6c4, 0xc6c5, 0xc6c6, 0xc6c7, 0xc6c8, 0xc6c9, 0xc6ca, 0xc6cb, - 0xc6cc, 0xc6cd, 0xc6ce, 0xc6cf, 0xc6d0, 0xc6d1, 0xc6d2, 0xc6d3, - 0xc6d4, 0xc6d5, 0xc6d6, 0xc6d7, 0xc6d8, 0xc6d9, 0xc6da, 0xc6db, - 0xc6dc, 0xc6dd, 0xc6de, 0xc6df, 0xc6e0, 0xc6e1, 0xc6e2, 0xc6e3, - 0xc6e4, 0xc6e5, 0xc6e6, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, - 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, - 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6a2, 0xc6a3, 0xc6f8, 0xc6f9, - 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, - 0xc743, 0xc744, 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, - 0xc74b, 0xc74c, 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, - 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, - 0xc75b, 0xc75c, 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, - 0xc763, 0xc764, 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, - 0xc76b, 0xc76c, 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, - 0xc773, 0xc774, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, - 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, - 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, - 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc6a1, 0xa374, 0xa375, 0xa376, - 0xa377, 0xa378, 0xa379, 0xa37a, 0xa37b, 0xa37c, 0xa37d, 0xa37e, - 0xa3a1, 0xa3a2, 0xa3a3, 0xa3a4, 0xa3a5, 0xa3a6, 0xa3a7, 0xa3a8, - 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, 0xa3b0, - 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, 0xa3b8, - 0xa3b9, 0xa3ba, 0xa1c0, 0xa255, 0xa256, 0xa250, 0xa251, 0xa252, - 0xa254, 0xa257, 0xa253, 0xa1eb, 0xa1ea, 0xa24f, 0xa440, 0xa442, - 0xa443, 0xc945, 0xa456, 0xa454, 0xa457, 0xa455, 0xc946, 0xa4a3, - 0xc94f, 0xc94d, 0xa4a2, 0xa4a1, 0xa542, 0xa541, 0xa540, 0xa543, - 0xa4fe, 0xa5e0, 0xa5e1, 0xa8c3, 0xa458, 0xa4a4, 0xc950, 0xa4a5, - 0xc963, 0xa6ea, 0xcbb1, 0xa459, 0xa4a6, 0xa544, 0xc964, 0xc940, - 0xa444, 0xa45b, 0xc947, 0xa45c, 0xa4a7, 0xa545, 0xa547, 0xa546, - 0xa5e2, 0xa5e3, 0xa8c4, 0xadbc, 0xa441, 0xc941, 0xa445, 0xa45e, - 0xa45d, 0xa5e4, 0xa8c5, 0xb0ae, 0xd44b, 0xb6c3, 0xdcb1, 0xdcb2, - 0xa446, 0xa4a9, 0xa8c6, 0xa447, 0xc948, 0xa45f, 0xa4aa, 0xa4ac, - 0xc951, 0xa4ad, 0xa4ab, 0xa5e5, 0xa8c7, 0xa8c8, 0xab45, 0xa460, - 0xa4ae, 0xa5e6, 0xa5e8, 0xa5e7, 0xa6eb, 0xa8c9, 0xa8ca, 0xab46, - 0xab47, 0xadbd, 0xdcb3, 0xf6d6, 0xa448, 0xa4b0, 0xa4af, 0xc952, - 0xa4b1, 0xa4b7, 0xa4b2, 0xa4b3, 0xc954, 0xc953, 0xa4b5, 0xa4b6, - 0xa4b4, 0xa54a, 0xa54b, 0xa54c, 0xa54d, 0xa549, 0xa550, 0xc96a, - 0xc966, 0xc969, 0xa551, 0xa561, 0xc968, 0xa54e, 0xa54f, 0xa548, - 0xc965, 0xc967, 0xa5f5, 0xc9b0, 0xa5f2, 0xa5f6, 0xc9ba, 0xc9ae, - 0xa5f3, 0xc9b2, 0xa5f4, 0xa5f7, 0xa5e9, 0xc9b1, 0xa5f8, 0xc9b5, - 0xc9b9, 0xc9b6, 0xc9b3, 0xa5ea, 0xa5ec, 0xa5f9, 0xa5ee, 0xc9ab, - 0xa5f1, 0xa5ef, 0xa5f0, 0xc9bb, 0xc9b8, 0xc9af, 0xa5ed, 0xc9ac, - 0xa5eb, 0xc9b4, 0xc9b7, 0xc9ad, 0xca66, 0xa742, 0xa6f4, 0xca67, - 0xa6f1, 0xa744, 0xa6f9, 0xa6f8, 0xca5b, 0xa6fc, 0xa6f7, 0xca60, - 0xca68, 0xca64, 0xa6fa, 0xa6fd, 0xa6ee, 0xa747, 0xca5d, 0xcbbd, - 0xa6ec, 0xa743, 0xa6ed, 0xa6f5, 0xa6f6, 0xca62, 0xca5e, 0xa6fb, - 0xa6f3, 0xca5a, 0xa6ef, 0xca65, 0xa745, 0xa748, 0xa6f2, 0xa740, - 0xa746, 0xa6f0, 0xca63, 0xa741, 0xca69, 0xca5c, 0xa6fe, 0xca5f, - 0xca61, 0xa8d8, 0xcbbf, 0xcbcb, 0xa8d0, 0xcbcc, 0xa8cb, 0xa8d5, - 0xa8ce, 0xcbb9, 0xa8d6, 0xcbb8, 0xcbbc, 0xcbc3, 0xcbc1, 0xa8de, - 0xa8d9, 0xcbb3, 0xcbb5, 0xa8db, 0xa8cf, 0xcbb6, 0xcbc2, 0xcbc9, - 0xa8d4, 0xcbbb, 0xcbb4, 0xa8d3, 0xcbb7, 0xa8d7, 0xcbba, 0xa8d2, - 0xa8cd, 0xa8dc, 0xcbc4, 0xa8dd, 0xcbc8, 0xcbc6, 0xcbca, 0xa8da, - 0xcbbe, 0xcbb2, 0xcbc0, 0xa8d1, 0xcbc5, 0xa8cc, 0xcbc7, 0xab56, - 0xab4a, 0xcde0, 0xcde8, 0xab49, 0xab51, 0xab5d, 0xcdee, 0xcdec, - 0xcde7, 0xab4b, 0xcded, 0xcde3, 0xab59, 0xab50, 0xab58, 0xcdde, - 0xcdea, 0xcde1, 0xab54, 0xcde2, 0xcddd, 0xab5b, 0xab4e, 0xab57, - 0xab4d, 0xcddf, 0xcde4, 0xcdeb, 0xab55, 0xab52, 0xcde6, 0xab5a, - 0xcde9, 0xcde5, 0xab4f, 0xab5c, 0xab53, 0xab4c, 0xab48, 0xcdef, - 0xadd7, 0xadc1, 0xadd1, 0xadd6, 0xd0d0, 0xd0cf, 0xd0d4, 0xd0d5, - 0xadc4, 0xadcd, 0xadda, 0xadce, 0xd0c9, 0xadc7, 0xd0ca, 0xaddc, - 0xadd3, 0xadbe, 0xadbf, 0xd0dd, 0xb0bf, 0xadcc, 0xadcb, 0xd0cb, - 0xadcf, 0xd45b, 0xadc6, 0xd0d6, 0xadd5, 0xadd4, 0xadca, 0xd0ce, - 0xd0d7, 0xd0c8, 0xadc9, 0xd0d8, 0xadd2, 0xd0cc, 0xadc0, 0xadc3, - 0xadc2, 0xd0d9, 0xadd0, 0xadc5, 0xadd9, 0xaddb, 0xd0d3, 0xadd8, - 0xd0db, 0xd0cd, 0xd0dc, 0xd0d1, 0xd0da, 0xd0d2, 0xadc8, 0xd463, - 0xd457, 0xb0b3, 0xd45c, 0xd462, 0xb0b2, 0xd455, 0xb0b6, 0xd459, - 0xd452, 0xb0b4, 0xd456, 0xb0b9, 0xb0be, 0xd467, 0xd451, 0xb0ba, - 0xd466, 0xb0b5, 0xd458, 0xb0b1, 0xd453, 0xd44f, 0xd45d, 0xd450, - 0xd44e, 0xd45a, 0xd460, 0xd461, 0xb0b7, 0xd85b, 0xd45e, 0xd44d, - 0xd45f, 0xb0c1, 0xd464, 0xb0c0, 0xd44c, 0xd454, 0xd465, 0xb0bc, - 0xb0bb, 0xb0b8, 0xb0bd, 0xb0af, 0xb0b0, 0xb3c8, 0xd85e, 0xd857, - 0xb3c5, 0xd85f, 0xd855, 0xd858, 0xb3c4, 0xd859, 0xb3c7, 0xd85d, - 0xd853, 0xd852, 0xb3c9, 0xb3ca, 0xb3c6, 0xb3cb, 0xd851, 0xd85c, - 0xd85a, 0xd854, 0xb3c3, 0xd856, 0xb6ca, 0xb6c4, 0xdcb7, 0xb6cd, - 0xdcbd, 0xdcc0, 0xb6c6, 0xb6c7, 0xdcba, 0xb6c5, 0xdcc3, 0xb6cb, - 0xdcc4, 0xdcbf, 0xb6cc, 0xdcb4, 0xb6c9, 0xdcb5, 0xdcbe, 0xdcbc, - 0xdcb8, 0xb6c8, 0xdcb6, 0xb6ce, 0xdcbb, 0xdcc2, 0xdcb9, 0xdcc1, - 0xb9b6, 0xb9b3, 0xb9b4, 0xe0f9, 0xe0f1, 0xb9b2, 0xb9af, 0xe0f2, - 0xb9b1, 0xe0f5, 0xe0f7, 0xe0fe, 0xe0fd, 0xe0f8, 0xb9ae, 0xe0f0, - 0xb9ac, 0xe0f3, 0xb9b7, 0xe0f6, 0xe0fa, 0xb9b0, 0xb9ad, 0xe0fc, - 0xe0fb, 0xb9b5, 0xe0f4, 0xbbf8, 0xe4ec, 0xe4e9, 0xbbf9, 0xbbf7, - 0xe4f0, 0xe4ed, 0xe4e6, 0xbbf6, 0xbbfa, 0xe4e7, 0xbbf5, 0xbbfd, - 0xe4ea, 0xe4eb, 0xbbfb, 0xbbfc, 0xe4f1, 0xe4ee, 0xe4ef, 0xbeaa, - 0xe8f8, 0xbea7, 0xe8f5, 0xbea9, 0xbeab, 0xe8f6, 0xbea8, 0xe8f7, - 0xe8f4, 0xc076, 0xecbd, 0xc077, 0xecbb, 0xecbc, 0xecba, 0xecb9, - 0xecbe, 0xc075, 0xefb8, 0xefb9, 0xe4e8, 0xefb7, 0xc078, 0xc35f, - 0xf1eb, 0xf1ec, 0xc4d7, 0xc4d8, 0xf5c1, 0xf5c0, 0xc56c, 0xc56b, - 0xf7d0, 0xa449, 0xa461, 0xa4b9, 0xa4b8, 0xa553, 0xa552, 0xa5fc, - 0xa5fb, 0xa5fd, 0xa5fa, 0xa74a, 0xa749, 0xa74b, 0xa8e0, 0xa8df, - 0xa8e1, 0xab5e, 0xa259, 0xd0de, 0xa25a, 0xb0c2, 0xa25c, 0xa25b, - 0xd860, 0xa25d, 0xb9b8, 0xa25e, 0xa44a, 0xa4ba, 0xa5fe, 0xa8e2, - 0xa44b, 0xa4bd, 0xa4bb, 0xa4bc, 0xa640, 0xa74c, 0xa8e4, 0xa8e3, - 0xa8e5, 0xaddd, 0xbeac, 0xc94e, 0xa554, 0xa555, 0xa641, 0xca6a, - 0xab60, 0xab5f, 0xd0e0, 0xd0df, 0xb0c3, 0xa4be, 0xc955, 0xcbcd, - 0xab61, 0xade0, 0xadde, 0xaddf, 0xbead, 0xa556, 0xa642, 0xc9bc, - 0xa74d, 0xa74e, 0xca6b, 0xcbce, 0xa8e6, 0xcbcf, 0xd0e2, 0xd0e3, - 0xade3, 0xd0e4, 0xd0e1, 0xade4, 0xade2, 0xade1, 0xd0e5, 0xd468, - 0xd861, 0xdcc5, 0xe140, 0xbbfe, 0xbeae, 0xe8f9, 0xa44c, 0xa45a, - 0xb0c4, 0xb3cd, 0xb9b9, 0xc942, 0xa4bf, 0xa559, 0xa557, 0xa558, - 0xa8e7, 0xa44d, 0xa44e, 0xa462, 0xa4c0, 0xa4c1, 0xa4c2, 0xc9be, - 0xa55a, 0xc96b, 0xa646, 0xc9bf, 0xa644, 0xa645, 0xc9bd, 0xa647, - 0xa643, 0xca6c, 0xaaec, 0xca6d, 0xca6e, 0xa750, 0xa74f, 0xa753, - 0xa751, 0xa752, 0xa8ed, 0xa8ec, 0xcbd4, 0xcbd1, 0xcbd2, 0xcbd0, - 0xa8ee, 0xa8ea, 0xa8e9, 0xa8eb, 0xa8e8, 0xa8ef, 0xab63, 0xcdf0, - 0xcbd3, 0xab68, 0xcdf1, 0xab64, 0xab67, 0xab66, 0xab65, 0xab62, - 0xd0e8, 0xade7, 0xd0eb, 0xade5, 0xd0e7, 0xade8, 0xade6, 0xade9, - 0xd0e9, 0xd0ea, 0xd0e6, 0xd0ec, 0xb3d1, 0xb0c5, 0xd469, 0xd46b, - 0xd46a, 0xd46c, 0xb0c6, 0xb3ce, 0xb3cf, 0xb3d0, 0xb6d0, 0xdcc7, - 0xdcc6, 0xdcc8, 0xdcc9, 0xb6d1, 0xb6cf, 0xe141, 0xe142, 0xb9bb, - 0xb9ba, 0xe35a, 0xbc40, 0xbc41, 0xbc42, 0xbc44, 0xe4f2, 0xe4f3, - 0xbc43, 0xbeaf, 0xbeb0, 0xf1ed, 0xf5c3, 0xf5c2, 0xf7d1, 0xa44f, - 0xa55c, 0xa55b, 0xa648, 0xc9c0, 0xa755, 0xa756, 0xa754, 0xa757, - 0xca6f, 0xca70, 0xa8f1, 0xcbd5, 0xa8f0, 0xcdf2, 0xab6c, 0xcdf3, - 0xab6b, 0xab69, 0xab6a, 0xd0ed, 0xb0c7, 0xd46e, 0xb0ca, 0xd46d, - 0xb1e5, 0xb0c9, 0xb0c8, 0xb3d4, 0xb3d3, 0xb3d2, 0xb6d2, 0xb6d5, - 0xb6d6, 0xb6d4, 0xb6d3, 0xe143, 0xe144, 0xe4f5, 0xbc45, 0xe4f4, - 0xbeb1, 0xecbf, 0xc079, 0xf1ee, 0xc455, 0xa463, 0xa4c3, 0xc956, - 0xa4c4, 0xa4c5, 0xa55d, 0xa55e, 0xa649, 0xca71, 0xcbd6, 0xcbd7, - 0xab6d, 0xd0ee, 0xb0cc, 0xb0cb, 0xd863, 0xd862, 0xa450, 0xa4c6, - 0xa55f, 0xb0cd, 0xc943, 0xc96c, 0xa560, 0xc9c2, 0xa64b, 0xa64a, - 0xc9c1, 0xa758, 0xadea, 0xd46f, 0xb6d7, 0xe145, 0xb9bc, 0xe8fa, - 0xf3fd, 0xa4c7, 0xcbd8, 0xcdf4, 0xb0d0, 0xb0ce, 0xb0cf, 0xa451, - 0xa464, 0xa2cd, 0xa4ca, 0xa4c9, 0xa4c8, 0xa563, 0xa562, 0xc96d, - 0xc9c3, 0xa8f5, 0xa8f2, 0xa8f4, 0xa8f3, 0xab6e, 0xb3d5, 0xa452, - 0xa4cb, 0xa565, 0xa564, 0xca72, 0xa8f6, 0xc957, 0xa567, 0xa566, - 0xa64c, 0xa64d, 0xca73, 0xa759, 0xa75a, 0xa8f7, 0xa8f8, 0xa8f9, - 0xab6f, 0xcdf5, 0xadeb, 0xc944, 0xa4cc, 0xc9c4, 0xca74, 0xca75, - 0xcbd9, 0xcbda, 0xcdf7, 0xcdf6, 0xcdf9, 0xcdf8, 0xab70, 0xd470, - 0xaded, 0xd0ef, 0xadec, 0xd864, 0xb3d6, 0xd865, 0xe146, 0xb9bd, - 0xbc46, 0xf1ef, 0xc958, 0xa568, 0xb0d1, 0xa453, 0xa465, 0xa4ce, - 0xa4cd, 0xa4cf, 0xa8fb, 0xa8fa, 0xa8fc, 0xab71, 0xadee, 0xe8fb, - 0xc24f, 0xa466, 0xa56a, 0xa579, 0xa574, 0xa56f, 0xa56e, 0xa575, - 0xa573, 0xa56c, 0xa57a, 0xa56d, 0xa569, 0xa578, 0xa577, 0xa576, - 0xa56b, 0xa572, 0xa571, 0xa57b, 0xa570, 0xa653, 0xa659, 0xa655, - 0xa65b, 0xc9c5, 0xa658, 0xa64e, 0xa651, 0xa654, 0xa650, 0xa657, - 0xa65a, 0xa64f, 0xa652, 0xa656, 0xa65c, 0xca7e, 0xca7b, 0xa767, - 0xca7c, 0xa75b, 0xa75d, 0xa775, 0xa770, 0xcaa5, 0xca7d, 0xa75f, - 0xa761, 0xcaa4, 0xa768, 0xca78, 0xa774, 0xa776, 0xa75c, 0xa76d, - 0xca76, 0xa773, 0xa764, 0xa76e, 0xa76f, 0xca77, 0xa76c, 0xa76a, - 0xa76b, 0xa771, 0xcaa1, 0xa75e, 0xa772, 0xcaa3, 0xa766, 0xa763, - 0xca7a, 0xa762, 0xcaa6, 0xa765, 0xa769, 0xa760, 0xcaa2, 0xca79, - 0xcbeb, 0xcbea, 0xa94f, 0xcbed, 0xcbef, 0xcbe4, 0xcbe7, 0xcbee, - 0xa950, 0xcbe1, 0xcbe5, 0xcbe9, 0xce49, 0xa94b, 0xce4d, 0xa8fd, - 0xcbe6, 0xa8fe, 0xa94c, 0xa945, 0xa941, 0xcbe2, 0xa944, 0xa949, - 0xa952, 0xcbe3, 0xcbdc, 0xa943, 0xcbdd, 0xcbdf, 0xa946, 0xa948, - 0xcbdb, 0xcbe0, 0xa951, 0xa94d, 0xcbe8, 0xa953, 0xa94a, 0xcbde, - 0xa947, 0xa942, 0xa940, 0xcbec, 0xa94e, 0xce48, 0xcdfb, 0xce4b, - 0xcdfd, 0xab78, 0xaba8, 0xab74, 0xaba7, 0xab7d, 0xaba4, 0xab72, - 0xcdfc, 0xce43, 0xaba3, 0xce4f, 0xaba5, 0xab79, 0xce45, 0xce42, - 0xab77, 0xcdfa, 0xaba6, 0xce4a, 0xab7c, 0xce4c, 0xaba9, 0xab73, - 0xab7e, 0xab7b, 0xce40, 0xaba1, 0xce46, 0xce47, 0xab7a, 0xaba2, - 0xab76, 0xab75, 0xcdfe, 0xce44, 0xce4e, 0xd144, 0xadfb, 0xd0f1, - 0xd0f6, 0xadf4, 0xae40, 0xd0f4, 0xadef, 0xadf9, 0xadfe, 0xd0fb, - 0xadfa, 0xadfd, 0xd0fe, 0xadf5, 0xd0f5, 0xd142, 0xd143, 0xadf7, - 0xd141, 0xadf3, 0xae43, 0xd0f8, 0xadf1, 0xd146, 0xd0f9, 0xd0fd, - 0xadf6, 0xae42, 0xd0fa, 0xadfc, 0xd140, 0xd147, 0xd4a1, 0xd145, - 0xae44, 0xadf0, 0xd0fc, 0xd0f3, 0xadf8, 0xd0f2, 0xd0f7, 0xd0f0, - 0xae41, 0xd477, 0xb0e4, 0xd4a7, 0xb0e2, 0xb0df, 0xd47c, 0xb0db, - 0xd4a2, 0xb0e6, 0xd476, 0xd47b, 0xd47a, 0xadf2, 0xb0e1, 0xd4a5, - 0xd4a8, 0xd473, 0xb3e8, 0xd4a9, 0xb0e7, 0xb0d9, 0xb0d6, 0xd47e, - 0xb0d3, 0xd4a6, 0xb0da, 0xd4aa, 0xd474, 0xd4a4, 0xb0dd, 0xd475, - 0xd478, 0xd47d, 0xb0de, 0xb0dc, 0xb0e8, 0xb0e3, 0xb0d7, 0xb1d2, - 0xb0d8, 0xd479, 0xb0e5, 0xb0e0, 0xd4a3, 0xb0d5, 0xb0d4, 0xd471, - 0xd472, 0xd86a, 0xb3d7, 0xb3da, 0xd875, 0xb3ee, 0xd878, 0xb3d8, - 0xd871, 0xb3de, 0xb3e4, 0xb5bd, 0xb3e2, 0xd86e, 0xb3ef, 0xb3db, - 0xb3e3, 0xd876, 0xdcd7, 0xd87b, 0xd86f, 0xd866, 0xd873, 0xd86d, - 0xb3e1, 0xd879, 0xb3dd, 0xb3f1, 0xb3ea, 0xb3df, 0xb3dc, 0xb3e7, - 0xd87a, 0xd86c, 0xd872, 0xd874, 0xd868, 0xd877, 0xb3d9, 0xd867, - 0xb3e0, 0xb3f0, 0xb3ec, 0xd869, 0xb3e6, 0xb3ed, 0xb3e9, 0xb3e5, - 0xd870, 0xb3eb, 0xdcd5, 0xdcd1, 0xdce0, 0xdcca, 0xdcd3, 0xb6e5, - 0xb6e6, 0xb6de, 0xdcdc, 0xb6e8, 0xdccf, 0xdcce, 0xdccc, 0xdcde, - 0xb6dc, 0xdcd8, 0xdccd, 0xb6df, 0xdcd6, 0xb6da, 0xdcd2, 0xdcd9, - 0xdcdb, 0xdcdf, 0xb6e3, 0xdccb, 0xb6dd, 0xdcd0, 0xb6d8, 0xb6e4, - 0xdcda, 0xb6e0, 0xb6e1, 0xb6e7, 0xb6db, 0xa25f, 0xb6d9, 0xdcd4, - 0xb6e2, 0xdcdd, 0xb9cd, 0xb9c8, 0xe155, 0xe151, 0xe14b, 0xb9c2, - 0xb9be, 0xe154, 0xb9bf, 0xe14e, 0xe150, 0xe153, 0xb9c4, 0xb9cb, - 0xb9c5, 0xe149, 0xb9c6, 0xb9c7, 0xe14c, 0xb9cc, 0xe14a, 0xe14f, - 0xb9c3, 0xe148, 0xb9c9, 0xb9c1, 0xb9c0, 0xe14d, 0xe152, 0xb9ca, - 0xe147, 0xbc4d, 0xe547, 0xe544, 0xbc47, 0xbc53, 0xbc54, 0xbc4a, - 0xe542, 0xbc4c, 0xe4f9, 0xbc52, 0xe546, 0xbc49, 0xe548, 0xbc48, - 0xe543, 0xe545, 0xbc4b, 0xe541, 0xe4fa, 0xe4f7, 0xd86b, 0xe4fd, - 0xe4f6, 0xe4fc, 0xe4fb, 0xe4f8, 0xbc4f, 0xbc4e, 0xbc50, 0xe4fe, - 0xbeb2, 0xe540, 0xe945, 0xe8fd, 0xbebe, 0xe942, 0xbeb6, 0xbeba, - 0xe941, 0xbeb9, 0xbeb5, 0xbeb8, 0xbeb3, 0xbebd, 0xe943, 0xe8fe, - 0xbebc, 0xe8fc, 0xbebb, 0xe944, 0xe940, 0xbc51, 0xbebf, 0xe946, - 0xbeb7, 0xbeb4, 0xecc6, 0xecc8, 0xc07b, 0xecc9, 0xecc7, 0xecc5, - 0xecc4, 0xc07d, 0xecc3, 0xc07e, 0xecc1, 0xecc2, 0xc07a, 0xc0a1, - 0xc07c, 0xecc0, 0xc250, 0xefbc, 0xefba, 0xefbf, 0xefbd, 0xefbb, - 0xefbe, 0xc360, 0xf1f2, 0xf1f3, 0xc456, 0xf1f4, 0xf1f0, 0xf1f5, - 0xf1f1, 0xc251, 0xf3fe, 0xf441, 0xc459, 0xf440, 0xc458, 0xc457, - 0xc45a, 0xf5c5, 0xf5c6, 0xc4da, 0xc4d9, 0xc4db, 0xf5c4, 0xf6d8, - 0xf6d7, 0xc56d, 0xc56f, 0xc56e, 0xf6d9, 0xc5c8, 0xf8a6, 0xc5f1, - 0xf8a5, 0xf8ee, 0xc949, 0xa57d, 0xa57c, 0xa65f, 0xa65e, 0xc9c7, - 0xa65d, 0xc9c6, 0xa779, 0xcaa9, 0xcaa8, 0xa777, 0xa77a, 0xcaa7, - 0xa778, 0xcbf0, 0xcbf1, 0xa954, 0xabaa, 0xd148, 0xd149, 0xae45, - 0xae46, 0xd4ac, 0xb0e9, 0xb0eb, 0xd4ab, 0xb0ea, 0xd87c, 0xb3f2, - 0xb6e9, 0xb6ea, 0xdce1, 0xb9cf, 0xb9ce, 0xe549, 0xe948, 0xe947, - 0xf96b, 0xa467, 0xc959, 0xc96e, 0xc96f, 0xa662, 0xa666, 0xc9c9, - 0xa664, 0xa663, 0xc9c8, 0xa665, 0xa661, 0xa660, 0xc9ca, 0xa7a6, - 0xa7a3, 0xa77d, 0xcaaa, 0xcaab, 0xa7a1, 0xcaad, 0xa77b, 0xcaae, - 0xcaac, 0xa77e, 0xa7a2, 0xa7a5, 0xa7a4, 0xa77c, 0xcaaf, 0xa959, - 0xcbfe, 0xa95b, 0xa95a, 0xcc40, 0xa958, 0xa957, 0xcbf5, 0xcbf4, - 0xcbf2, 0xcbf7, 0xcbf6, 0xcbf3, 0xcbfc, 0xcbfd, 0xcbfa, 0xcbf8, - 0xa956, 0xcbfb, 0xa95c, 0xcc41, 0xcbf9, 0xabab, 0xa955, 0xabac, - 0xce54, 0xce5a, 0xabb2, 0xce58, 0xce5e, 0xce55, 0xce59, 0xce5b, - 0xce5d, 0xce57, 0xce56, 0xce51, 0xce52, 0xabad, 0xabaf, 0xabae, - 0xce53, 0xce5c, 0xabb1, 0xce50, 0xd153, 0xd152, 0xd157, 0xd14e, - 0xd151, 0xd150, 0xd154, 0xd158, 0xae47, 0xae4a, 0xd14f, 0xd155, - 0xae49, 0xd14a, 0xabb0, 0xd4ba, 0xd156, 0xd14d, 0xae48, 0xd14c, - 0xd4b1, 0xb0ec, 0xb0f0, 0xd4c1, 0xd4af, 0xd4bd, 0xb0f1, 0xd4bf, - 0xd4c5, 0xd4c9, 0xd4c0, 0xd4b4, 0xd4bc, 0xd4ca, 0xd4c8, 0xd4be, - 0xd4b9, 0xd4b2, 0xd8a6, 0xd4b0, 0xb0f5, 0xd4b7, 0xb0f6, 0xb0f2, - 0xd4ad, 0xd4c3, 0xd4b5, 0xd4b3, 0xd4c6, 0xb0f3, 0xd4cc, 0xb0ed, - 0xb0ef, 0xd4bb, 0xd4b6, 0xae4b, 0xb0ee, 0xd4b8, 0xd4c7, 0xd4cb, - 0xd4c2, 0xd4c4, 0xd4ae, 0xd8a1, 0xd8aa, 0xd8a9, 0xb3fa, 0xd8a2, - 0xb3fb, 0xb3f9, 0xd8a4, 0xb3f6, 0xd8a8, 0xd8a3, 0xd8a5, 0xd87d, - 0xb3f4, 0xd8b2, 0xd8b1, 0xd8ae, 0xb3f3, 0xb3f7, 0xb3f8, 0xd14b, - 0xd8ab, 0xb3f5, 0xb0f4, 0xd8ad, 0xd87e, 0xd8b0, 0xd8af, 0xd8b3, - 0xdcef, 0xd8ac, 0xd8a7, 0xdce7, 0xb6f4, 0xb6f7, 0xb6f2, 0xdce6, - 0xdcea, 0xdce5, 0xb6ec, 0xb6f6, 0xdce2, 0xb6f0, 0xdce9, 0xb6ee, - 0xb6ed, 0xdcec, 0xb6ef, 0xdcee, 0xdceb, 0xb6eb, 0xb6f5, 0xdcf0, - 0xdce4, 0xdced, 0xdce3, 0xb6f1, 0xb6f3, 0xdce8, 0xdcf1, 0xe15d, - 0xb9d0, 0xe163, 0xb9d5, 0xe15f, 0xe166, 0xe157, 0xb9d7, 0xb9d1, - 0xe15c, 0xbc55, 0xe15b, 0xe164, 0xb9d2, 0xb9d6, 0xe15a, 0xe160, - 0xe165, 0xe156, 0xb9d4, 0xe15e, 0xe162, 0xe168, 0xe158, 0xe161, - 0xb9d3, 0xe167, 0xe159, 0xbc59, 0xe54b, 0xbc57, 0xbc56, 0xe54d, - 0xe552, 0xe54e, 0xe551, 0xbc5c, 0xbea5, 0xbc5b, 0xe54a, 0xe550, - 0xbc5a, 0xe54f, 0xe54c, 0xbc58, 0xe94d, 0xe94f, 0xe94a, 0xbec1, - 0xe94c, 0xbec0, 0xe94e, 0xbec3, 0xe950, 0xbec2, 0xe949, 0xe94b, - 0xc0a5, 0xeccc, 0xc0a4, 0xeccd, 0xc0a3, 0xeccb, 0xc0a2, 0xecca, - 0xc253, 0xc252, 0xf1f6, 0xf1f8, 0xf1f7, 0xc361, 0xc362, 0xc363, - 0xf442, 0xc45b, 0xf7d3, 0xf7d2, 0xc5f2, 0xa468, 0xa4d0, 0xa7a7, - 0xce5f, 0xb3fc, 0xb3fd, 0xdcf2, 0xb9d8, 0xe169, 0xe553, 0xc95a, - 0xcab0, 0xcc42, 0xce60, 0xd159, 0xae4c, 0xf1f9, 0xc4dc, 0xa469, - 0xa57e, 0xc970, 0xa667, 0xa668, 0xa95d, 0xb0f7, 0xb9da, 0xb9db, - 0xb9d9, 0xa46a, 0xa4d1, 0xa4d3, 0xa4d2, 0xc95b, 0xa4d4, 0xa5a1, - 0xc971, 0xa5a2, 0xa669, 0xa66a, 0xc9cb, 0xa7a8, 0xcab1, 0xa961, - 0xcc43, 0xa95f, 0xa960, 0xa95e, 0xd15a, 0xabb6, 0xabb5, 0xabb7, - 0xabb4, 0xce61, 0xa962, 0xabb3, 0xae4d, 0xae4e, 0xae4f, 0xd4cd, - 0xb3fe, 0xd8b4, 0xb0f8, 0xb6f8, 0xb9dd, 0xb9dc, 0xe16a, 0xbc5d, - 0xbec4, 0xefc0, 0xf6da, 0xf7d4, 0xa46b, 0xa5a3, 0xa5a4, 0xc9d1, - 0xa66c, 0xa66f, 0xc9cf, 0xc9cd, 0xa66e, 0xc9d0, 0xc9d2, 0xc9cc, - 0xa671, 0xa670, 0xa66d, 0xa66b, 0xc9ce, 0xa7b3, 0xa7b0, 0xcab6, - 0xcab9, 0xcab8, 0xa7aa, 0xa7b2, 0xa7af, 0xcab5, 0xcab3, 0xa7ae, - 0xa7a9, 0xa7ac, 0xcab4, 0xcabb, 0xcab7, 0xa7ad, 0xa7b1, 0xa7b4, - 0xcab2, 0xcaba, 0xa7ab, 0xa967, 0xa96f, 0xcc4f, 0xcc48, 0xa970, - 0xcc53, 0xcc44, 0xcc4b, 0xa966, 0xcc45, 0xa964, 0xcc4c, 0xcc50, - 0xa963, 0xcc51, 0xcc4a, 0xcc4d, 0xa972, 0xa969, 0xcc54, 0xcc52, - 0xa96e, 0xa96c, 0xcc49, 0xa96b, 0xcc47, 0xcc46, 0xa96a, 0xa968, - 0xa971, 0xa96d, 0xa965, 0xcc4e, 0xabb9, 0xabc0, 0xce6f, 0xabb8, - 0xce67, 0xce63, 0xce73, 0xce62, 0xabbb, 0xce6c, 0xabbe, 0xabc1, - 0xabbc, 0xce70, 0xabbf, 0xae56, 0xce76, 0xce64, 0xce66, 0xce6d, - 0xce71, 0xce75, 0xce72, 0xce6b, 0xce6e, 0xce68, 0xabc3, 0xce6a, - 0xce69, 0xce74, 0xabba, 0xce65, 0xabc2, 0xabbd, 0xae5c, 0xd162, - 0xae5b, 0xd160, 0xae50, 0xae55, 0xd15f, 0xd15c, 0xd161, 0xae51, - 0xd15b, 0xae54, 0xae52, 0xd163, 0xae53, 0xae57, 0xae58, 0xae5a, - 0xae59, 0xd15d, 0xd15e, 0xd164, 0xd4d4, 0xb0f9, 0xd8c2, 0xd4d3, - 0xd4e6, 0xb140, 0xd4e4, 0xb0fe, 0xb0fa, 0xd4ed, 0xd4dd, 0xd4e0, - 0xb143, 0xd4ea, 0xd4e2, 0xb0fb, 0xb144, 0xd4e7, 0xd4e5, 0xd4d6, - 0xd4eb, 0xd4df, 0xd4da, 0xd4d0, 0xd4ec, 0xd4dc, 0xd4cf, 0xb142, - 0xd4e1, 0xd4ee, 0xd4de, 0xd4d2, 0xd4d7, 0xd4ce, 0xb141, 0xd4db, - 0xd4d8, 0xb0fc, 0xd4d1, 0xd4e9, 0xb0fd, 0xd4d9, 0xd4d5, 0xd4e8, - 0xb440, 0xd8bb, 0xd8b8, 0xd8c9, 0xd8bd, 0xd8ca, 0xb442, 0xd8c6, - 0xd8c3, 0xd8c4, 0xd8c7, 0xd8cb, 0xd4e3, 0xd8cd, 0xdd47, 0xb443, - 0xd8ce, 0xd8b6, 0xd8c0, 0xd8c5, 0xb441, 0xb444, 0xd8cc, 0xd8cf, - 0xd8ba, 0xd8b7, 0xd8b9, 0xd8be, 0xd8bc, 0xb445, 0xd8c8, 0xd8bf, - 0xd8c1, 0xd8b5, 0xdcfa, 0xdcf8, 0xb742, 0xb740, 0xdd43, 0xdcf9, - 0xdd44, 0xdd40, 0xdcf7, 0xdd46, 0xdcf6, 0xdcfd, 0xb6fe, 0xb6fd, - 0xb6fc, 0xdcfb, 0xdd41, 0xb6f9, 0xb741, 0xdcf4, 0xdcfe, 0xdcf3, - 0xdcfc, 0xb6fa, 0xdd42, 0xdcf5, 0xb6fb, 0xdd45, 0xe16e, 0xb9e2, - 0xb9e1, 0xb9e3, 0xe17a, 0xe170, 0xe176, 0xe16b, 0xe179, 0xe178, - 0xe17c, 0xe175, 0xb9de, 0xe174, 0xb9e4, 0xe16d, 0xb9df, 0xe17b, - 0xb9e0, 0xe16f, 0xe172, 0xe177, 0xe171, 0xe16c, 0xe173, 0xe555, - 0xbc61, 0xe558, 0xe557, 0xe55a, 0xe55c, 0xbc5f, 0xe556, 0xe554, - 0xe55d, 0xe55b, 0xe559, 0xe55f, 0xe55e, 0xbc63, 0xbc5e, 0xbc60, - 0xbc62, 0xe560, 0xe957, 0xe956, 0xe955, 0xe958, 0xe951, 0xe952, - 0xe95a, 0xe953, 0xbec5, 0xe95c, 0xe95b, 0xe954, 0xecd1, 0xc0a8, - 0xeccf, 0xecd4, 0xecd3, 0xe959, 0xc0a7, 0xecd2, 0xecce, 0xecd6, - 0xecd5, 0xc0a6, 0xecd0, 0xbec6, 0xc254, 0xefc1, 0xf1fa, 0xf1fb, - 0xf1fc, 0xc45c, 0xc45d, 0xf443, 0xf5c8, 0xf5c7, 0xf6db, 0xf6dc, - 0xf7d5, 0xf8a7, 0xa46c, 0xa46d, 0xa46e, 0xa4d5, 0xa5a5, 0xc9d3, - 0xa672, 0xa673, 0xa7b7, 0xa7b8, 0xa7b6, 0xa7b5, 0xa973, 0xcc55, - 0xa975, 0xa974, 0xcc56, 0xabc4, 0xae5d, 0xd165, 0xd4f0, 0xb145, - 0xb447, 0xd4ef, 0xb446, 0xb9e5, 0xe17d, 0xbec7, 0xc0a9, 0xecd7, - 0xc45e, 0xc570, 0xc972, 0xa5a6, 0xc973, 0xa676, 0xa674, 0xa675, - 0xa677, 0xa7ba, 0xa7b9, 0xcabc, 0xa7bb, 0xcabd, 0xcc57, 0xcc58, - 0xa976, 0xa978, 0xa97a, 0xa977, 0xa97b, 0xa979, 0xabc8, 0xabc5, - 0xabc7, 0xabc9, 0xabc6, 0xd166, 0xce77, 0xd168, 0xd167, 0xae63, - 0xae5f, 0xae60, 0xae62, 0xae64, 0xae61, 0xae66, 0xae65, 0xb14a, - 0xd4f2, 0xd4f1, 0xb149, 0xb148, 0xb147, 0xb14b, 0xb146, 0xd8d5, - 0xd8d2, 0xb449, 0xd8d1, 0xd8d6, 0xb44b, 0xd8d4, 0xb448, 0xb44a, - 0xd8d3, 0xdd48, 0xdd49, 0xdd4a, 0xb9e6, 0xb9ee, 0xe17e, 0xb9e8, - 0xb9ec, 0xe1a1, 0xb9ed, 0xb9e9, 0xb9ea, 0xb9e7, 0xb9eb, 0xbc66, - 0xd8d0, 0xbc67, 0xbc65, 0xbc64, 0xe95d, 0xbec8, 0xecd8, 0xecd9, - 0xc364, 0xc45f, 0xa46f, 0xa678, 0xabca, 0xd169, 0xae67, 0xb14e, - 0xb14d, 0xb14c, 0xb44c, 0xb44d, 0xd8d7, 0xb9ef, 0xbec9, 0xa470, - 0xc95c, 0xa4d6, 0xc974, 0xc9d4, 0xa679, 0xa97c, 0xdd4b, 0xa471, - 0xa4d7, 0xc9d5, 0xcabe, 0xcabf, 0xa7bc, 0xd8d8, 0xb44e, 0xdd4c, - 0xc0aa, 0xa472, 0xa4a8, 0xa4d8, 0xc975, 0xa5a7, 0xa7c0, 0xa7bf, - 0xa7bd, 0xa7be, 0xcc59, 0xa97e, 0xa9a1, 0xcc5a, 0xa97d, 0xabce, - 0xce78, 0xabcd, 0xabcb, 0xabcc, 0xae6a, 0xae68, 0xd16b, 0xae69, - 0xd16a, 0xae5e, 0xd4f3, 0xb150, 0xb151, 0xb14f, 0xb9f0, 0xe1a2, - 0xbc68, 0xbc69, 0xe561, 0xc0ab, 0xefc2, 0xefc3, 0xc4dd, 0xf8a8, - 0xc94b, 0xa4d9, 0xa473, 0xc977, 0xc976, 0xa67a, 0xc9d7, 0xc9d8, - 0xc9d6, 0xc9d9, 0xcac7, 0xcac2, 0xcac4, 0xcac6, 0xcac3, 0xa7c4, - 0xcac0, 0xcac1, 0xa7c1, 0xa7c2, 0xcac5, 0xcac8, 0xa7c3, 0xcac9, - 0xcc68, 0xcc62, 0xcc5d, 0xa9a3, 0xcc65, 0xcc63, 0xcc5c, 0xcc69, - 0xcc6c, 0xcc67, 0xcc60, 0xa9a5, 0xcc66, 0xa9a6, 0xcc61, 0xcc64, - 0xcc5b, 0xcc5f, 0xcc6b, 0xa9a7, 0xa9a8, 0xcc5e, 0xcc6a, 0xa9a2, - 0xa9a4, 0xceab, 0xcea4, 0xceaa, 0xcea3, 0xcea5, 0xce7d, 0xce7b, - 0xceac, 0xcea9, 0xce79, 0xabd0, 0xcea7, 0xcea8, 0xcea6, 0xce7c, - 0xce7a, 0xabcf, 0xcea2, 0xce7e, 0xcea1, 0xcead, 0xae6f, 0xae6e, - 0xd16c, 0xae6b, 0xd16e, 0xae70, 0xd16f, 0xae73, 0xae71, 0xd170, - 0xceae, 0xd172, 0xae6d, 0xae6c, 0xd16d, 0xd171, 0xae72, 0xb153, - 0xb152, 0xd4f5, 0xd4f9, 0xd4fb, 0xb154, 0xd4fe, 0xb158, 0xd541, - 0xb15a, 0xb156, 0xb15e, 0xb15b, 0xd4f7, 0xb155, 0xd4f6, 0xd4f4, - 0xd543, 0xd4f8, 0xb157, 0xd542, 0xb15c, 0xd4fd, 0xd4fc, 0xb15d, - 0xd4fa, 0xb159, 0xd544, 0xd540, 0xd8e7, 0xd8ee, 0xd8e3, 0xb451, - 0xd8df, 0xd8ef, 0xd8d9, 0xd8ec, 0xd8ea, 0xd8e4, 0xd8ed, 0xd8e6, - 0xd8de, 0xd8f0, 0xd8dc, 0xd8e9, 0xd8da, 0xd8f1, 0xb452, 0xd8eb, - 0xdd4f, 0xd8dd, 0xb44f, 0xd8e1, 0xb450, 0xd8e0, 0xd8e5, 0xd8e2, - 0xd8e8, 0xdd53, 0xdd56, 0xdd4e, 0xdd50, 0xdd55, 0xdd54, 0xb743, - 0xd8db, 0xdd52, 0xb744, 0xdd4d, 0xdd51, 0xe1a9, 0xe1b0, 0xe1a7, - 0xe1ae, 0xe1a5, 0xe1ad, 0xe1b1, 0xe1a4, 0xe1a8, 0xe1a3, 0xb9f1, - 0xe1a6, 0xb9f2, 0xe1ac, 0xe1ab, 0xe1aa, 0xe1af, 0xe565, 0xe567, - 0xbc6b, 0xe568, 0xe563, 0xe562, 0xe56c, 0xe56a, 0xbc6a, 0xe56d, - 0xe564, 0xe569, 0xe56b, 0xe566, 0xe961, 0xe966, 0xe960, 0xe965, - 0xe95e, 0xe968, 0xe964, 0xe969, 0xe963, 0xe95f, 0xe967, 0xe96a, - 0xe962, 0xecda, 0xc0af, 0xc0ad, 0xc0ac, 0xc0ae, 0xefc4, 0xf172, - 0xf1fd, 0xf444, 0xf445, 0xc460, 0xf5c9, 0xc4de, 0xf5ca, 0xf6de, - 0xc572, 0xc571, 0xf6dd, 0xc5c9, 0xf7d6, 0xa474, 0xa67b, 0xc9da, - 0xcaca, 0xa8b5, 0xb15f, 0xa475, 0xa5aa, 0xa5a9, 0xa5a8, 0xa7c5, - 0xae74, 0xdd57, 0xa476, 0xa477, 0xa478, 0xa4da, 0xabd1, 0xceaf, - 0xb453, 0xa479, 0xc95d, 0xa5ab, 0xa5ac, 0xc978, 0xa67c, 0xcacb, - 0xa7c6, 0xcacc, 0xa9ae, 0xcc6e, 0xa9ac, 0xa9ab, 0xcc6d, 0xa9a9, - 0xcc6f, 0xa9aa, 0xa9ad, 0xabd2, 0xabd4, 0xceb3, 0xceb0, 0xceb1, - 0xceb2, 0xceb4, 0xabd3, 0xd174, 0xd173, 0xae76, 0xae75, 0xb162, - 0xd546, 0xb161, 0xb163, 0xb160, 0xb455, 0xd545, 0xb456, 0xd8f3, - 0xb457, 0xd8f2, 0xb454, 0xdd5a, 0xdd5c, 0xb745, 0xdd5b, 0xdd59, - 0xdd58, 0xe1b4, 0xb9f7, 0xb9f5, 0xb9f6, 0xe1b2, 0xe1b3, 0xb9f3, - 0xe571, 0xe56f, 0xbc6d, 0xe570, 0xbc6e, 0xbc6c, 0xb9f4, 0xe96d, - 0xe96b, 0xe96c, 0xe56e, 0xecdc, 0xc0b0, 0xecdb, 0xefc5, 0xefc6, - 0xe96e, 0xf1fe, 0xa47a, 0xa5ad, 0xa67e, 0xc9db, 0xa67d, 0xa9af, - 0xb746, 0xa4db, 0xa5ae, 0xabd5, 0xb458, 0xc979, 0xc97a, 0xc9dc, - 0xa7c8, 0xcad0, 0xcace, 0xa7c9, 0xcacd, 0xcacf, 0xcad1, 0xa7c7, - 0xa9b3, 0xa9b4, 0xa9b1, 0xa9b0, 0xceb8, 0xa9b2, 0xabd6, 0xceb7, - 0xceb9, 0xceb6, 0xceba, 0xabd7, 0xae79, 0xd175, 0xd177, 0xae77, - 0xd178, 0xae78, 0xd176, 0xceb5, 0xd547, 0xd54a, 0xd54b, 0xd548, - 0xb167, 0xb166, 0xb164, 0xb165, 0xd549, 0xb168, 0xb45a, 0xb45b, - 0xb45c, 0xdd5d, 0xdd5f, 0xdd61, 0xb748, 0xb747, 0xb459, 0xdd60, - 0xdd5e, 0xe1b8, 0xe1b6, 0xe1bc, 0xb9f8, 0xe1bd, 0xe1ba, 0xb9f9, - 0xe1b7, 0xe1b5, 0xe1bb, 0xbc70, 0xe573, 0xe1b9, 0xbc72, 0xe574, - 0xbc71, 0xbc74, 0xe575, 0xbc6f, 0xbc73, 0xe973, 0xe971, 0xe970, - 0xe972, 0xe96f, 0xc366, 0xf446, 0xf447, 0xf5cb, 0xf6df, 0xc655, - 0xa9b5, 0xa7ca, 0xabd8, 0xa47b, 0xa4dc, 0xa5af, 0xc9dd, 0xa7cb, - 0xcad2, 0xcebb, 0xabd9, 0xb9fa, 0xa47c, 0xa6a1, 0xb749, 0xa47d, - 0xa4dd, 0xa4de, 0xa5b1, 0xa5b0, 0xc9de, 0xa6a2, 0xcad3, 0xa7cc, - 0xcc71, 0xcc72, 0xcc73, 0xa9b6, 0xa9b7, 0xcc70, 0xa9b8, 0xabda, - 0xcebc, 0xd17a, 0xae7a, 0xd179, 0xb169, 0xd54c, 0xb16a, 0xd54d, - 0xb45d, 0xdd62, 0xe1bf, 0xe1be, 0xb9fb, 0xbc75, 0xe576, 0xbeca, - 0xe974, 0xc0b1, 0xc573, 0xf7d8, 0xcc74, 0xcebd, 0xb16b, 0xd8f4, - 0xb74a, 0xc255, 0xa7ce, 0xa7cd, 0xabdb, 0xd17b, 0xb16d, 0xb343, - 0xb16e, 0xb16c, 0xb45e, 0xe1c0, 0xb9fc, 0xbc76, 0xc94c, 0xc9df, - 0xcad5, 0xa7cf, 0xcad4, 0xa7d0, 0xa9bc, 0xcc77, 0xcc76, 0xa9bb, - 0xa9b9, 0xa9ba, 0xcc75, 0xabdd, 0xcebe, 0xabe0, 0xabdc, 0xabe2, - 0xabde, 0xabdf, 0xabe1, 0xae7d, 0xae7c, 0xae7b, 0xd54f, 0xb16f, - 0xb172, 0xb170, 0xd54e, 0xb175, 0xb171, 0xd550, 0xb174, 0xb173, - 0xd8f6, 0xd8f5, 0xb461, 0xb45f, 0xb460, 0xd8f7, 0xb74b, 0xdd64, - 0xb74c, 0xdd63, 0xe577, 0xbc78, 0xe1c1, 0xbc77, 0xb9fd, 0xecde, - 0xe975, 0xc0b2, 0xecdd, 0xf240, 0xf448, 0xf449, 0xa4df, 0xa5b2, - 0xc97b, 0xa7d2, 0xa7d4, 0xc9e2, 0xcad8, 0xcad7, 0xcad6, 0xc9e1, - 0xc9e0, 0xa6a4, 0xa7d3, 0xa7d1, 0xa6a3, 0xa9bd, 0xcc78, 0xa9be, - 0xcadd, 0xcadf, 0xcade, 0xcc79, 0xcada, 0xa7d8, 0xa7d6, 0xcad9, - 0xcadb, 0xcae1, 0xa7d5, 0xcadc, 0xcae5, 0xa9c0, 0xcae2, 0xa7d7, - 0xcae0, 0xcae3, 0xa9bf, 0xa9c1, 0xcae4, 0xccaf, 0xcca2, 0xcc7e, - 0xccae, 0xcca9, 0xabe7, 0xa9c2, 0xccaa, 0xccad, 0xabe3, 0xccac, - 0xa9c3, 0xa9c8, 0xa9c6, 0xcca3, 0xcc7c, 0xcca5, 0xa9cd, 0xccb0, - 0xabe4, 0xcca6, 0xabe5, 0xa9c9, 0xcca8, 0xcecd, 0xabe6, 0xcc7b, - 0xa9ca, 0xabe8, 0xa9cb, 0xa9c7, 0xa9cc, 0xcca7, 0xcc7a, 0xccab, - 0xa9c4, 0xcc7d, 0xcca4, 0xcca1, 0xa9c5, 0xcebf, 0xcec0, 0xceca, - 0xd1a1, 0xcecb, 0xabee, 0xcece, 0xcec4, 0xabed, 0xcec6, 0xcec7, - 0xcec9, 0xabe9, 0xaea3, 0xcec5, 0xcec1, 0xaea4, 0xcecf, 0xae7e, - 0xd17d, 0xcec8, 0xd17c, 0xcec3, 0xcecc, 0xabec, 0xaea1, 0xabf2, - 0xaea2, 0xced0, 0xd17e, 0xabeb, 0xaea6, 0xabf1, 0xabf0, 0xabef, - 0xaea5, 0xced1, 0xaea7, 0xabea, 0xcec2, 0xb176, 0xd1a4, 0xd1a6, - 0xd1a8, 0xaea8, 0xaeae, 0xd553, 0xd1ac, 0xd1a3, 0xb178, 0xd551, - 0xaead, 0xaeab, 0xd1ae, 0xd552, 0xd1a5, 0xaeac, 0xd1a9, 0xaeaf, - 0xd1ab, 0xaeaa, 0xd1aa, 0xd1ad, 0xd1a7, 0xaea9, 0xb179, 0xd1a2, - 0xb177, 0xb17a, 0xd555, 0xd55e, 0xb464, 0xb17c, 0xb1a3, 0xb465, - 0xd560, 0xb1aa, 0xd8f9, 0xd556, 0xb1a2, 0xb1a5, 0xb17e, 0xd554, - 0xd562, 0xd565, 0xd949, 0xd563, 0xd8fd, 0xb1a1, 0xb1a8, 0xb1ac, - 0xd55d, 0xd8f8, 0xd561, 0xb17b, 0xd8fa, 0xd564, 0xd8fc, 0xd559, - 0xb462, 0xd557, 0xd558, 0xb1a7, 0xb1a6, 0xd55b, 0xb1ab, 0xd55f, - 0xb1a4, 0xd55c, 0xb1a9, 0xb466, 0xb463, 0xd8fb, 0xd55a, 0xb17d, - 0xb46b, 0xb46f, 0xd940, 0xb751, 0xb46d, 0xd944, 0xb471, 0xdd65, - 0xd946, 0xb753, 0xb469, 0xb46c, 0xd947, 0xd948, 0xd94e, 0xb473, - 0xb754, 0xd94a, 0xd94f, 0xd943, 0xb75e, 0xb755, 0xb472, 0xd941, - 0xd950, 0xb75d, 0xb470, 0xb74e, 0xd94d, 0xb474, 0xd945, 0xd8fe, - 0xb46a, 0xd942, 0xd94b, 0xb74d, 0xb752, 0xb467, 0xd94c, 0xb750, - 0xb468, 0xb75c, 0xe1c3, 0xdd70, 0xdd68, 0xe1c2, 0xdd6c, 0xdd6e, - 0xdd6b, 0xb75b, 0xdd6a, 0xb75f, 0xe1d2, 0xb75a, 0xba40, 0xdd71, - 0xe1c4, 0xb758, 0xdd69, 0xdd6d, 0xb9fe, 0xb74f, 0xdd66, 0xdd67, - 0xba41, 0xb757, 0xb759, 0xb756, 0xdd6f, 0xe1c8, 0xe1c9, 0xe1ce, - 0xbc7d, 0xe1d5, 0xba47, 0xba46, 0xe1d0, 0xbc7c, 0xe1c5, 0xba45, - 0xe1d4, 0xba43, 0xba44, 0xe1d1, 0xe5aa, 0xbc7a, 0xb46e, 0xe1d3, - 0xbca3, 0xe1cb, 0xbc7b, 0xbca2, 0xe1c6, 0xe1ca, 0xe1c7, 0xe1cd, - 0xba48, 0xbc79, 0xba42, 0xe57a, 0xe1cf, 0xbca1, 0xbca4, 0xe1cc, - 0xbc7e, 0xe579, 0xe57e, 0xbece, 0xe578, 0xe9a3, 0xe5a9, 0xbca8, - 0xbca6, 0xbecc, 0xe5a6, 0xe5a2, 0xbcac, 0xe978, 0xbcaa, 0xe5a1, - 0xe976, 0xe5a5, 0xe5a8, 0xe57d, 0xbcab, 0xbca5, 0xe977, 0xbecd, - 0xe5a7, 0xbca7, 0xbca9, 0xe5a4, 0xbcad, 0xe5a3, 0xe57c, 0xe57b, - 0xbecb, 0xe5ab, 0xe97a, 0xece0, 0xbed0, 0xe9a2, 0xe97e, 0xece1, - 0xbed1, 0xe9a1, 0xe97c, 0xc0b4, 0xecdf, 0xe979, 0xe97b, 0xc0b5, - 0xbed3, 0xc0b3, 0xbed2, 0xc0b7, 0xe97d, 0xbecf, 0xefcf, 0xefc7, - 0xece7, 0xefc8, 0xece3, 0xc256, 0xece5, 0xece4, 0xc0b6, 0xece2, - 0xece6, 0xefd0, 0xefcc, 0xefce, 0xefc9, 0xefca, 0xefcd, 0xefcb, - 0xc367, 0xc36a, 0xc369, 0xc368, 0xc461, 0xf44a, 0xc462, 0xf241, - 0xc4df, 0xf5cc, 0xc4e0, 0xc574, 0xc5ca, 0xf7d9, 0xf7da, 0xf7db, - 0xf9ba, 0xa4e0, 0xc97c, 0xa5b3, 0xa6a6, 0xa6a7, 0xa6a5, 0xa6a8, - 0xa7da, 0xa7d9, 0xccb1, 0xa9cf, 0xa9ce, 0xd1af, 0xb1ad, 0xb1ae, - 0xb475, 0xdd72, 0xb760, 0xb761, 0xdd74, 0xdd76, 0xdd75, 0xe1d7, - 0xe1d6, 0xba49, 0xe1d8, 0xe5ac, 0xbcae, 0xbed4, 0xc0b8, 0xc257, - 0xc0b9, 0xa4e1, 0xcae6, 0xccb2, 0xa9d1, 0xa9d0, 0xa9d2, 0xabf3, - 0xced2, 0xced3, 0xd1b0, 0xaeb0, 0xb1af, 0xb476, 0xd951, 0xa4e2, - 0xa47e, 0xa4e3, 0xc97d, 0xa5b7, 0xa5b6, 0xa5b4, 0xa5b5, 0xa6ab, - 0xc9e9, 0xc9eb, 0xa6aa, 0xc9e3, 0xc9e4, 0xc9ea, 0xc9e6, 0xc9e8, - 0xa6a9, 0xc9e5, 0xc9ec, 0xc9e7, 0xa7e1, 0xa7ea, 0xa7e8, 0xcaf0, - 0xcaed, 0xcaf5, 0xa7e6, 0xcaf6, 0xa7df, 0xcaf3, 0xa7e5, 0xcaef, - 0xcaee, 0xa7e3, 0xcaf4, 0xa7e4, 0xa9d3, 0xa7de, 0xcaf1, 0xcae7, - 0xa7db, 0xa7ee, 0xcaec, 0xcaf2, 0xa7e0, 0xa7e2, 0xcae8, 0xcae9, - 0xcaea, 0xa7ed, 0xa7e7, 0xa7ec, 0xcaeb, 0xa7eb, 0xa7dd, 0xa7dc, - 0xa7e9, 0xa9e1, 0xccbe, 0xccb7, 0xa9dc, 0xa9ef, 0xccb3, 0xccba, - 0xccbc, 0xccbf, 0xa9ea, 0xccbb, 0xccb4, 0xa9e8, 0xccb8, 0xccc0, - 0xa9d9, 0xccbd, 0xa9e3, 0xa9e2, 0xccb6, 0xa9d7, 0xa9d8, 0xa9d6, - 0xa9ee, 0xa9e6, 0xa9e0, 0xa9d4, 0xccb9, 0xa9df, 0xa9d5, 0xa9e7, - 0xa9f0, 0xced4, 0xa9e4, 0xccb5, 0xa9da, 0xa9dd, 0xa9de, 0xa9ec, - 0xa9ed, 0xa9eb, 0xa9e5, 0xa9e9, 0xa9db, 0xabf4, 0xceda, 0xac41, - 0xabf8, 0xabfa, 0xac40, 0xcee6, 0xabfd, 0xd1b1, 0xaeb1, 0xac43, - 0xced7, 0xcedf, 0xabfe, 0xcede, 0xcedb, 0xcee3, 0xcee5, 0xabf7, - 0xabfb, 0xac42, 0xaeb3, 0xcee0, 0xabf9, 0xac45, 0xced9, 0xabfc, - 0xaeb2, 0xabf6, 0xced6, 0xcedd, 0xced5, 0xced8, 0xcedc, 0xd1b2, - 0xac44, 0xcee1, 0xcee2, 0xcee4, 0xabf5, 0xaec1, 0xd1be, 0xaebf, - 0xaec0, 0xd1b4, 0xd1c4, 0xaeb6, 0xd566, 0xd1c6, 0xd1c0, 0xd1b7, - 0xd1c9, 0xd1ba, 0xaebc, 0xd57d, 0xd1bd, 0xaebe, 0xaeb5, 0xd1cb, - 0xd1bf, 0xaeb8, 0xd1b8, 0xd1b5, 0xd1b6, 0xaeb9, 0xd1c5, 0xd1cc, - 0xaebb, 0xd1bc, 0xd1bb, 0xaec3, 0xaec2, 0xaeb4, 0xaeba, 0xaebd, - 0xd1c8, 0xd1c2, 0xaeb7, 0xd1b3, 0xd1ca, 0xd1c1, 0xd1c3, 0xd1c7, - 0xd567, 0xb1b7, 0xb1cb, 0xb1ca, 0xb1bf, 0xd579, 0xd575, 0xd572, - 0xd5a6, 0xb1ba, 0xb1b2, 0xd577, 0xb4a8, 0xb1b6, 0xd5a1, 0xb1cc, - 0xb1c9, 0xd57b, 0xd56a, 0xb1c8, 0xd5a3, 0xd569, 0xb1bd, 0xb1c1, - 0xd5a2, 0xd573, 0xb1c2, 0xb1bc, 0xd568, 0xb478, 0xd5a5, 0xd571, - 0xb1c7, 0xd574, 0xd5a4, 0xb1c6, 0xd952, 0xb1b3, 0xd56f, 0xb1b8, - 0xb1c3, 0xb1be, 0xd578, 0xd56e, 0xd56c, 0xd57e, 0xb1b0, 0xb1c4, - 0xb1b4, 0xb477, 0xd57c, 0xb1b5, 0xb1b1, 0xb1c0, 0xb1bb, 0xb1b9, - 0xd570, 0xb1c5, 0xd56d, 0xd57a, 0xd576, 0xd954, 0xd953, 0xd56b, - 0xd964, 0xb47a, 0xd96a, 0xd959, 0xd967, 0xdd77, 0xb47d, 0xd96b, - 0xd96e, 0xb47c, 0xd95c, 0xd96d, 0xd96c, 0xb47e, 0xd955, 0xb479, - 0xb4a3, 0xb4a1, 0xd969, 0xd95f, 0xb4a5, 0xd970, 0xd968, 0xd971, - 0xb4ad, 0xb4ab, 0xd966, 0xd965, 0xd963, 0xd95d, 0xb4a4, 0xb4a2, - 0xd1b9, 0xd956, 0xddb7, 0xd957, 0xb47b, 0xb4aa, 0xdd79, 0xb4a6, - 0xb4a7, 0xd958, 0xd96f, 0xdd78, 0xd960, 0xd95b, 0xb4a9, 0xd961, - 0xd95e, 0xb4ae, 0xb770, 0xdd7c, 0xddb1, 0xddb6, 0xddaa, 0xb76c, - 0xddbb, 0xb769, 0xdd7a, 0xdd7b, 0xb762, 0xb76b, 0xdda4, 0xb76e, - 0xb76f, 0xdda5, 0xddb2, 0xddb8, 0xb76a, 0xb764, 0xdda3, 0xdd7d, - 0xddba, 0xdda8, 0xdda9, 0xdd7e, 0xddb4, 0xddab, 0xddb5, 0xddad, - 0xb765, 0xe1d9, 0xb768, 0xb766, 0xddb9, 0xddb0, 0xddac, 0xdda1, - 0xba53, 0xddaf, 0xb76d, 0xdda7, 0xdda6, 0xb767, 0xb763, 0xe1ee, - 0xddb3, 0xddae, 0xdda2, 0xe1e9, 0xe1da, 0xe1e5, 0xe1ec, 0xba51, - 0xb4ac, 0xe1ea, 0xba4c, 0xba4b, 0xe1f1, 0xe1db, 0xe1e8, 0xe1dc, - 0xe1e7, 0xba4f, 0xe1eb, 0xd962, 0xe1f2, 0xe1e3, 0xba52, 0xe5ba, - 0xbcaf, 0xe1f0, 0xe1ef, 0xba54, 0xe5ad, 0xbcb0, 0xe5ae, 0xe1df, - 0xe1e0, 0xe1dd, 0xe1e2, 0xe1de, 0xe1f3, 0xba4e, 0xbcb1, 0xba50, - 0xba55, 0xe1e1, 0xe1ed, 0xe1e6, 0xe5b1, 0xba4a, 0xbcb4, 0xe9aa, - 0xe5b6, 0xe5b5, 0xe5b7, 0xe5b4, 0xbcb5, 0xbcbb, 0xbcb8, 0xbcb9, - 0xe5af, 0xe5b2, 0xe5bc, 0xbcc1, 0xbcbf, 0xe5b3, 0xd95a, 0xbcb2, - 0xe5b9, 0xe5b0, 0xbcc2, 0xe5b8, 0xba4d, 0xbcb7, 0xe1e4, 0xbcba, - 0xbcbe, 0xbcc0, 0xbcbd, 0xbcbc, 0xbcb6, 0xe5bb, 0xbcb3, 0xbcc3, - 0xbed8, 0xbed9, 0xe9a9, 0xbee2, 0xbedf, 0xbed6, 0xbedd, 0xe9ab, - 0xbedb, 0xbed5, 0xbedc, 0xe9a8, 0xc0bb, 0xbed7, 0xbede, 0xc0ba, - 0xe9a7, 0xe9a6, 0xbee0, 0xbee1, 0xe9a5, 0xe9a4, 0xc0bc, 0xe9ae, - 0xbeda, 0xe9ac, 0xc0bd, 0xc0c2, 0xecea, 0xecec, 0xc0bf, 0xeced, - 0xece9, 0xeceb, 0xc0c0, 0xc0c3, 0xece8, 0xc0be, 0xc0c1, 0xc259, - 0xe9ad, 0xc258, 0xc25e, 0xefd4, 0xc25c, 0xc25d, 0xefd7, 0xefd3, - 0xc25a, 0xefd1, 0xc36b, 0xefd5, 0xefd6, 0xefd2, 0xc25b, 0xf242, - 0xf245, 0xf246, 0xf244, 0xf247, 0xc36c, 0xf243, 0xf44e, 0xc464, - 0xf44d, 0xf44c, 0xf44b, 0xc463, 0xc465, 0xf5cd, 0xc4e2, 0xc4e1, - 0xf6e1, 0xf6e0, 0xf6e3, 0xc5cb, 0xc575, 0xf7dd, 0xf6e2, 0xf7dc, - 0xc5cd, 0xc5cc, 0xc5f3, 0xf8a9, 0xf8ef, 0xa4e4, 0xd972, 0xe9af, - 0xa6ac, 0xcaf7, 0xa7f1, 0xa7ef, 0xa7f0, 0xccc1, 0xa9f1, 0xac46, - 0xcee7, 0xcee8, 0xac47, 0xd1ce, 0xaec4, 0xaec5, 0xd1cd, 0xb1d3, - 0xb1cf, 0xd5a7, 0xb1d6, 0xb1d5, 0xb1ce, 0xb1d1, 0xb1d4, 0xb1d0, - 0xd976, 0xb1cd, 0xb4af, 0xb4b1, 0xb4b2, 0xd975, 0xd978, 0xb4b0, - 0xd973, 0xd977, 0xd974, 0xb771, 0xddbc, 0xba56, 0xe1f4, 0xbee3, - 0xbcc4, 0xe5bd, 0xbcc5, 0xbcc6, 0xe5bf, 0xe5be, 0xe5c0, 0xe9b1, - 0xe9b0, 0xecef, 0xecee, 0xc0c4, 0xc0c5, 0xf248, 0xa4e5, 0xd979, - 0xb4b4, 0xb4b3, 0xddbd, 0xefd8, 0xc4e3, 0xf7de, 0xa4e6, 0xaec6, - 0xb1d8, 0xb1d7, 0xd97a, 0xd97b, 0xb772, 0xe1f5, 0xba57, 0xe9b2, - 0xa4e7, 0xa5b8, 0xa9f2, 0xccc2, 0xcee9, 0xac48, 0xb1d9, 0xd97c, - 0xb4b5, 0xb773, 0xe5c1, 0xe5c2, 0xecf0, 0xc25f, 0xf8f0, 0xa4e8, - 0xccc3, 0xa9f3, 0xac49, 0xceea, 0xaec7, 0xd1d2, 0xd1d0, 0xd1d1, - 0xaec8, 0xd1cf, 0xb1db, 0xb1dc, 0xd5a8, 0xb1dd, 0xb1da, 0xd97d, - 0xd97e, 0xddbe, 0xba59, 0xba58, 0xecf1, 0xefd9, 0xf24a, 0xf249, - 0xf44f, 0xc95e, 0xac4a, 0xa4e9, 0xa5b9, 0xa6ae, 0xa6ad, 0xa6af, - 0xa6b0, 0xc9ee, 0xc9ed, 0xcaf8, 0xa7f2, 0xcafb, 0xcafa, 0xcaf9, - 0xcafc, 0xa9f4, 0xccc9, 0xccc5, 0xccce, 0xa9fb, 0xa9f9, 0xccca, - 0xccc6, 0xcccd, 0xa9f8, 0xaa40, 0xccc8, 0xccc4, 0xa9fe, 0xcccb, - 0xa9f7, 0xcccc, 0xa9fa, 0xa9fc, 0xccd0, 0xcccf, 0xccc7, 0xa9f6, - 0xa9f5, 0xa9fd, 0xceef, 0xcef5, 0xac50, 0xac4d, 0xceec, 0xcef1, - 0xac53, 0xac4b, 0xcef0, 0xac4e, 0xac51, 0xcef3, 0xac4c, 0xcef8, - 0xac4f, 0xac52, 0xceed, 0xcef2, 0xcef6, 0xceee, 0xceeb, 0xcef7, - 0xcef4, 0xaed0, 0xaec9, 0xaecc, 0xaecf, 0xd1d5, 0xaeca, 0xd1d3, - 0xaece, 0xaecb, 0xd1d6, 0xaecd, 0xd5ac, 0xb1df, 0xd5ab, 0xd5ad, - 0xb1de, 0xb1e3, 0xd1d4, 0xd5aa, 0xd5ae, 0xb1e0, 0xd5a9, 0xb1e2, - 0xb1e1, 0xd9a7, 0xd9a2, 0xb4b6, 0xb4ba, 0xb4b7, 0xd9a5, 0xd9a8, - 0xb4b8, 0xb4b9, 0xb4be, 0xddc7, 0xd9a6, 0xb4bc, 0xd9a3, 0xd9a1, - 0xb4bd, 0xd9a4, 0xb779, 0xddbf, 0xb776, 0xb777, 0xb775, 0xddc4, - 0xddc3, 0xddc0, 0xb77b, 0xddc2, 0xb4bb, 0xddc6, 0xddc1, 0xb778, - 0xb774, 0xb77a, 0xddc5, 0xba5c, 0xe1f8, 0xe1f7, 0xe1f6, 0xba5a, - 0xba5b, 0xe5c5, 0xe5c8, 0xbcc8, 0xbcc7, 0xe5c9, 0xe5c4, 0xbcca, - 0xe5c6, 0xbcc9, 0xe5c3, 0xe5c7, 0xbee9, 0xbee6, 0xe9bb, 0xe9ba, - 0xe9b9, 0xe9b4, 0xe9b5, 0xbee7, 0xbee4, 0xbee8, 0xe9b3, 0xbee5, - 0xe9b6, 0xe9b7, 0xe9bc, 0xe9b8, 0xecf2, 0xc0c7, 0xefdc, 0xc0c6, - 0xefda, 0xefdb, 0xc260, 0xc36e, 0xf24b, 0xc36d, 0xf451, 0xf452, - 0xc466, 0xf450, 0xc4e4, 0xf7df, 0xc5ce, 0xf8aa, 0xf8ab, 0xa4ea, - 0xa6b1, 0xa6b2, 0xa7f3, 0xccd1, 0xac54, 0xaed1, 0xb1e4, 0xb0d2, - 0xb4bf, 0xb4c0, 0xb3cc, 0xd9a9, 0xb77c, 0xe1fa, 0xe1f9, 0xa4eb, - 0xa6b3, 0xccd2, 0xaa42, 0xaa41, 0xcef9, 0xcefa, 0xd1d7, 0xd1d8, - 0xaed2, 0xaed3, 0xaed4, 0xd5af, 0xb1e6, 0xb4c2, 0xb4c1, 0xddc8, - 0xdf7a, 0xe1fb, 0xe9bd, 0xc261, 0xc467, 0xa4ec, 0xa5bc, 0xa5bd, - 0xa5bb, 0xa5be, 0xa5ba, 0xa6b6, 0xc9f6, 0xa6b5, 0xa6b7, 0xc9f1, - 0xc9f0, 0xc9f3, 0xc9f2, 0xc9f5, 0xa6b4, 0xc9ef, 0xc9f4, 0xcafd, - 0xa7fd, 0xcafe, 0xcb43, 0xa7fc, 0xcb47, 0xcb42, 0xcb45, 0xa7f5, - 0xa7f6, 0xa7f7, 0xa7f8, 0xa840, 0xcb41, 0xa7fa, 0xa841, 0xcb40, - 0xcb46, 0xa7f9, 0xcb44, 0xa7fb, 0xa7f4, 0xa7fe, 0xaa57, 0xccd4, - 0xaa43, 0xaa4d, 0xaa4e, 0xaa46, 0xaa58, 0xaa48, 0xccdc, 0xaa53, - 0xccd7, 0xaa49, 0xcce6, 0xcce7, 0xccdf, 0xccd8, 0xaa56, 0xcce4, - 0xaa51, 0xaa4f, 0xcce5, 0xcce3, 0xccdb, 0xccd3, 0xccda, 0xaa4a, - 0xaa50, 0xaa44, 0xccde, 0xccdd, 0xccd5, 0xaa52, 0xcce1, 0xccd6, - 0xaa55, 0xcce8, 0xaa45, 0xaa4c, 0xccd9, 0xcce2, 0xaa54, 0xaa47, - 0xaa4b, 0xcce0, 0xcf5b, 0xac5c, 0xac69, 0xcf56, 0xcf4c, 0xac62, - 0xcf4a, 0xac5b, 0xcf45, 0xac65, 0xcf52, 0xcefe, 0xcf41, 0xcf44, - 0xcefb, 0xcf51, 0xcf61, 0xac60, 0xcf46, 0xcf58, 0xcefd, 0xcf5f, - 0xcf60, 0xcf63, 0xcf5a, 0xcf4b, 0xcf53, 0xac66, 0xac59, 0xac61, - 0xac6d, 0xac56, 0xac58, 0xcf43, 0xac6a, 0xac63, 0xcf5d, 0xcf40, - 0xac6c, 0xac67, 0xcf49, 0xac6b, 0xcf50, 0xcf48, 0xac64, 0xcf5c, - 0xcf54, 0xac5e, 0xcf62, 0xcf47, 0xac5a, 0xcf59, 0xcf4f, 0xac5f, - 0xcf55, 0xac57, 0xcefc, 0xac68, 0xaee3, 0xac5d, 0xcf4e, 0xcf4d, - 0xcf42, 0xcf5e, 0xcf57, 0xac55, 0xd1ec, 0xaeea, 0xd1ed, 0xd1e1, - 0xaedf, 0xaeeb, 0xd1da, 0xd1e3, 0xd1eb, 0xd1d9, 0xd1f4, 0xaed5, - 0xd1f3, 0xd1ee, 0xd1ef, 0xaedd, 0xaee8, 0xd1e5, 0xd1e6, 0xd1f0, - 0xd1e7, 0xd1e2, 0xd1dc, 0xd1dd, 0xd1ea, 0xd1e4, 0xaed6, 0xaeda, - 0xd1f2, 0xd1de, 0xaee6, 0xaee2, 0xaee5, 0xaeec, 0xaedb, 0xaee7, - 0xd1e9, 0xaee9, 0xaed8, 0xaed7, 0xd1db, 0xd1df, 0xaee0, 0xd1f1, - 0xd1e8, 0xd1e0, 0xaee4, 0xaee1, 0xaed9, 0xaedc, 0xd5c4, 0xd5b4, - 0xd5b5, 0xd5b9, 0xd5c8, 0xd5c5, 0xd5be, 0xd5bd, 0xb1ed, 0xd5c1, - 0xd5d0, 0xd5b0, 0xd5d1, 0xd5c3, 0xd5d5, 0xd5c9, 0xb1ec, 0xd5c7, - 0xb1e7, 0xb1fc, 0xb1f2, 0xb1f6, 0xb1f5, 0xd5b1, 0xd5ce, 0xd5d4, - 0xd5cc, 0xd5d3, 0xd5c0, 0xd5b2, 0xd5d2, 0xd5c2, 0xb1ea, 0xb1f7, - 0xd5cb, 0xb1f0, 0xd5ca, 0xd5b3, 0xb1f8, 0xb1fa, 0xd5cd, 0xb1fb, - 0xb1e9, 0xd5ba, 0xd5cf, 0xb1ef, 0xb1f9, 0xd5bc, 0xd5c6, 0xd5b7, - 0xd5bb, 0xb1f4, 0xd5b6, 0xb1e8, 0xb1f1, 0xb1ee, 0xd5bf, 0xaede, - 0xd9c0, 0xb1eb, 0xb1f3, 0xd9c3, 0xd9d9, 0xd9ce, 0xb4d6, 0xb4d1, - 0xd9bd, 0xb4d2, 0xd9cd, 0xd9c6, 0xd9d3, 0xb4ce, 0xd9ab, 0xd9d5, - 0xb4c4, 0xd9b3, 0xb4c7, 0xb4c6, 0xb4d7, 0xd9ad, 0xd9cf, 0xd9d0, - 0xb4c9, 0xb4c5, 0xd9bb, 0xb4d0, 0xd9b6, 0xd9d1, 0xb4cc, 0xd9c9, - 0xd9d6, 0xd9b0, 0xd9b5, 0xd9af, 0xb4cb, 0xd9c2, 0xddde, 0xd9b1, - 0xb4cf, 0xd9ba, 0xd9d2, 0xb4ca, 0xd9b7, 0xd9b4, 0xd9c5, 0xb4cd, - 0xb4c3, 0xb4d9, 0xd9c8, 0xd9c7, 0xd9ac, 0xb4c8, 0xd9d4, 0xd9bc, - 0xd9be, 0xd9cb, 0xd9ca, 0xd9aa, 0xb4d3, 0xb4d5, 0xd9b2, 0xd9b9, - 0xd9c1, 0xb4d4, 0xd9b8, 0xd9c4, 0xd9d7, 0xd9cc, 0xd9d8, 0xd9ae, - 0xddf2, 0xb7a6, 0xddf0, 0xdddb, 0xdde0, 0xddd9, 0xddec, 0xddcb, - 0xddd2, 0xddea, 0xddf4, 0xdddc, 0xddcf, 0xdde2, 0xdde7, 0xddd3, - 0xdde4, 0xddd0, 0xddd7, 0xddd8, 0xb7a8, 0xddeb, 0xdde9, 0xddcc, - 0xddee, 0xddef, 0xddf1, 0xb7ac, 0xb7a4, 0xd5b8, 0xddd4, 0xdde6, - 0xddd5, 0xb7a1, 0xb7b1, 0xdded, 0xb7af, 0xb7ab, 0xddca, 0xb7a3, - 0xddcd, 0xb7b0, 0xdddd, 0xddc9, 0xb7a9, 0xdde1, 0xddd1, 0xb7aa, - 0xddda, 0xb77e, 0xb4d8, 0xdde3, 0xd9bf, 0xddce, 0xdde8, 0xb7a5, - 0xdde5, 0xb7a2, 0xdddf, 0xb7ad, 0xddd6, 0xddf3, 0xb7a7, 0xdec6, - 0xb7ae, 0xe24a, 0xe248, 0xe25e, 0xe246, 0xe258, 0xb77d, 0xba5f, - 0xe242, 0xe25d, 0xe247, 0xe255, 0xba64, 0xba5d, 0xe25b, 0xe240, - 0xe25a, 0xba6f, 0xe251, 0xe261, 0xba6d, 0xe249, 0xba5e, 0xe24b, - 0xe259, 0xba67, 0xe244, 0xba6b, 0xba61, 0xe24d, 0xe243, 0xe1fc, - 0xe257, 0xba68, 0xe260, 0xe1fd, 0xba65, 0xe253, 0xba66, 0xe245, - 0xe250, 0xe24c, 0xe24e, 0xba60, 0xe25f, 0xba6e, 0xe24f, 0xe262, - 0xe1fe, 0xe254, 0xba63, 0xba6c, 0xba6a, 0xe241, 0xe256, 0xba69, - 0xba62, 0xe252, 0xe25c, 0xe5d5, 0xe5d1, 0xe5cd, 0xe5e1, 0xe5de, - 0xbccd, 0xe5e5, 0xe5d4, 0xbcd8, 0xe5db, 0xe5d0, 0xe5da, 0xbcd5, - 0xe5ee, 0xe5eb, 0xe5dd, 0xe5ce, 0xe5e2, 0xe5e4, 0xbcd1, 0xe5d8, - 0xe5d3, 0xe5ca, 0xbcce, 0xbcd6, 0xe5e7, 0xbcd7, 0xe5cb, 0xe5ed, - 0xe5e0, 0xe5e6, 0xbcd4, 0xe5e3, 0xe5ea, 0xbcd9, 0xbcd3, 0xe5dc, - 0xe5cf, 0xe5ef, 0xe5cc, 0xe5e8, 0xbcd0, 0xe5d6, 0xe5d7, 0xbccf, - 0xbccc, 0xe5d2, 0xbcd2, 0xbccb, 0xe5e9, 0xe5ec, 0xe5d9, 0xe9ca, - 0xe9c2, 0xe9be, 0xbef6, 0xbeeb, 0xbef0, 0xbeec, 0xe9cc, 0xe9d7, - 0xbeea, 0xe9c4, 0xe9cd, 0xe5df, 0xe9ce, 0xbef1, 0xe9dd, 0xbef5, - 0xbef8, 0xe9c0, 0xbef4, 0xe9db, 0xe9dc, 0xe9d2, 0xe9d1, 0xe9c9, - 0xe9d3, 0xe9da, 0xe9d9, 0xbeef, 0xbeed, 0xe9cb, 0xe9c8, 0xe9c5, - 0xe9d8, 0xbef7, 0xe9d6, 0xbef3, 0xbef2, 0xe9d0, 0xe9bf, 0xe9c1, - 0xe9c3, 0xe9d5, 0xe9cf, 0xbeee, 0xe9c6, 0xe9d4, 0xe9c7, 0xc0cf, - 0xed45, 0xc0c8, 0xecf5, 0xed41, 0xc0ca, 0xed48, 0xecfc, 0xecf7, - 0xed49, 0xecf3, 0xecfe, 0xc0d1, 0xed44, 0xed4a, 0xecfd, 0xc0c9, - 0xed40, 0xecf4, 0xc0d0, 0xed47, 0xecf9, 0xc0cc, 0xecfb, 0xecf8, - 0xc0d2, 0xecfa, 0xc0cb, 0xc0ce, 0xed43, 0xecf6, 0xed46, 0xed42, - 0xc263, 0xefe7, 0xc268, 0xc269, 0xc262, 0xefe6, 0xefe3, 0xefe4, - 0xc266, 0xefde, 0xefe2, 0xc265, 0xefdf, 0xc267, 0xc264, 0xefdd, - 0xefe1, 0xefe5, 0xf251, 0xf24e, 0xf257, 0xf256, 0xf254, 0xf24f, - 0xc372, 0xf250, 0xc371, 0xc0cd, 0xf253, 0xc370, 0xf258, 0xf252, - 0xf24d, 0xefe0, 0xc36f, 0xf24c, 0xf456, 0xf455, 0xf255, 0xc468, - 0xf459, 0xf45a, 0xf454, 0xf458, 0xf453, 0xf5d1, 0xf457, 0xc4e7, - 0xc4e5, 0xf5cf, 0xf5d2, 0xf5ce, 0xf5d0, 0xc4e6, 0xf6e5, 0xf6e6, - 0xc576, 0xf6e4, 0xf7e2, 0xc5cf, 0xf7e0, 0xf7e1, 0xf8ac, 0xc656, - 0xf8f3, 0xf8f1, 0xf8f2, 0xf8f4, 0xf9bb, 0xa4ed, 0xa6b8, 0xaa59, - 0xcce9, 0xcf64, 0xd1f5, 0xd1f7, 0xd1f6, 0xd1f8, 0xb1fd, 0xd5d7, - 0xd1f9, 0xd5d6, 0xd5d8, 0xd5d9, 0xd9da, 0xb4db, 0xd9db, 0xd9dd, - 0xb4dc, 0xb4da, 0xd9dc, 0xddfa, 0xddf8, 0xddf7, 0xddf6, 0xddf5, - 0xb7b2, 0xddf9, 0xba70, 0xe263, 0xe265, 0xba71, 0xe264, 0xbcdb, - 0xbcda, 0xe5f0, 0xe9df, 0xe9de, 0xe9e0, 0xbef9, 0xed4b, 0xc0d3, - 0xefe8, 0xc26a, 0xf259, 0xc577, 0xa4ee, 0xa5bf, 0xa6b9, 0xa842, - 0xaa5a, 0xaa5b, 0xac6e, 0xd1fa, 0xb7b3, 0xe6d1, 0xbefa, 0xc26b, - 0xa4ef, 0xa6ba, 0xcceb, 0xaa5c, 0xccea, 0xcf65, 0xac6f, 0xcf66, - 0xac70, 0xd1fc, 0xaeee, 0xaeed, 0xd5de, 0xd5dc, 0xd5dd, 0xd5db, - 0xd5da, 0xd9de, 0xd9e1, 0xb4de, 0xd9df, 0xb4dd, 0xd9e0, 0xddfb, - 0xe266, 0xe267, 0xe268, 0xe5f3, 0xe5f2, 0xbcdc, 0xe5f1, 0xe5f4, - 0xe9e1, 0xe9e2, 0xe9e3, 0xed4c, 0xc0d4, 0xc26c, 0xf25a, 0xc4e8, - 0xc95f, 0xac71, 0xcf67, 0xaeef, 0xb1fe, 0xb4df, 0xd9e2, 0xb7b5, - 0xb7b4, 0xe269, 0xe26a, 0xbcdd, 0xbcde, 0xe9e5, 0xe9e4, 0xefe9, - 0xf7e3, 0xa4f0, 0xc960, 0xa5c0, 0xa843, 0xcb48, 0xac72, 0xb7b6, - 0xa4f1, 0xcf68, 0xac73, 0xcf69, 0xc0d5, 0xa4f2, 0xccec, 0xcf6a, - 0xd242, 0xd241, 0xd1fe, 0xd1fd, 0xd243, 0xd240, 0xb240, 0xb241, - 0xb4e0, 0xd9e3, 0xd9e4, 0xd9e5, 0xde41, 0xde42, 0xde40, 0xddfd, - 0xddfe, 0xb7b7, 0xe26b, 0xe5f7, 0xe5f6, 0xe5f5, 0xe5f8, 0xe9e7, - 0xe9e6, 0xbefb, 0xe9e8, 0xc0d6, 0xed4d, 0xefea, 0xf25b, 0xf6e7, - 0xa4f3, 0xa5c2, 0xa5c1, 0xaa5d, 0xc961, 0xc97e, 0xa6bb, 0xc9f7, - 0xcb49, 0xcb4a, 0xaa5e, 0xcced, 0xac74, 0xcf6b, 0xcf6c, 0xaef0, - 0xaef4, 0xd244, 0xaef3, 0xaef1, 0xaef2, 0xd5df, 0xb242, 0xb4e3, - 0xb4e1, 0xb4e2, 0xd9e6, 0xba72, 0xa4f4, 0xc9a1, 0xa5c3, 0xc9a4, - 0xa5c6, 0xc9a3, 0xa5c5, 0xa5c4, 0xa844, 0xc9a2, 0xc9f8, 0xc9fc, - 0xc9fe, 0xca40, 0xa6c5, 0xa6c6, 0xc9fb, 0xa6c1, 0xc9f9, 0xc9fd, - 0xa6c2, 0xa6bd, 0xa6be, 0xa6c4, 0xc9fa, 0xa6bc, 0xa845, 0xa6bf, - 0xa6c0, 0xa6c3, 0xcb5b, 0xcb59, 0xcb4c, 0xa851, 0xcb53, 0xa84c, - 0xcb4d, 0xcb55, 0xcb52, 0xa84f, 0xcb51, 0xa856, 0xcb5a, 0xa858, - 0xa85a, 0xcb4b, 0xa84d, 0xcb5c, 0xa854, 0xa857, 0xcd45, 0xa847, - 0xa85e, 0xa855, 0xcb4e, 0xa84a, 0xa859, 0xcb56, 0xa848, 0xa849, - 0xcd43, 0xcb4f, 0xa850, 0xa85b, 0xcb5d, 0xcb50, 0xa84e, 0xa853, - 0xccee, 0xa85c, 0xcb57, 0xa852, 0xa85d, 0xa846, 0xcb54, 0xa84b, - 0xcb58, 0xcd44, 0xaa6a, 0xaa7a, 0xccf5, 0xaa71, 0xcd4b, 0xaa62, - 0xaa65, 0xcd42, 0xccf3, 0xccf7, 0xaa6d, 0xaa6f, 0xccfa, 0xaa76, - 0xaa68, 0xaa66, 0xaa67, 0xaa75, 0xcd47, 0xaa70, 0xccf9, 0xccfb, - 0xaa6e, 0xaa73, 0xccfc, 0xcd4a, 0xac75, 0xaa79, 0xaa63, 0xcd49, - 0xcd4d, 0xccf8, 0xcd4f, 0xcd40, 0xaa6c, 0xccf4, 0xaa6b, 0xaa7d, - 0xaa72, 0xccf2, 0xcf75, 0xaa78, 0xaa7c, 0xcd41, 0xcd46, 0xaa7e, - 0xaa77, 0xaa69, 0xaa5f, 0xaa64, 0xccf6, 0xaa60, 0xcd4e, 0xccf0, - 0xccef, 0xccfd, 0xccf1, 0xaa7b, 0xaef5, 0xaa74, 0xccfe, 0xaa61, - 0xaca6, 0xcd4c, 0xcf7c, 0xcfa1, 0xcfa4, 0xcf77, 0xcfa7, 0xcfaa, - 0xcfac, 0xcf74, 0xac76, 0xac7b, 0xd249, 0xacad, 0xcfa5, 0xcfad, - 0xcf7b, 0xcf73, 0xd264, 0xac7e, 0xcfa2, 0xcf78, 0xcf7a, 0xaca5, - 0xcf7d, 0xac7d, 0xcf70, 0xcfa8, 0xcfab, 0xac7a, 0xaca8, 0xcf6d, - 0xacaa, 0xac78, 0xacae, 0xcfa9, 0xcf6f, 0xacab, 0xd25e, 0xcd48, - 0xac7c, 0xac77, 0xcf76, 0xcf6e, 0xacac, 0xaca4, 0xcfa3, 0xaca9, - 0xaca7, 0xcf79, 0xaca1, 0xcf71, 0xaca2, 0xaca3, 0xcf72, 0xcfa6, - 0xac79, 0xcf7e, 0xd24c, 0xaefd, 0xaf43, 0xd255, 0xd25b, 0xd257, - 0xd24a, 0xd24d, 0xd246, 0xd247, 0xaf4a, 0xaefa, 0xd256, 0xd25f, - 0xaf45, 0xaef6, 0xaf40, 0xd24e, 0xaf42, 0xd24f, 0xd259, 0xaf44, - 0xd268, 0xd248, 0xaefc, 0xaefb, 0xaf48, 0xd245, 0xd266, 0xd25a, - 0xd267, 0xd261, 0xd253, 0xd262, 0xd25c, 0xd265, 0xd263, 0xaf49, - 0xd254, 0xaef9, 0xaef8, 0xaf41, 0xaf47, 0xd260, 0xaf46, 0xd251, - 0xb243, 0xd269, 0xd250, 0xd24b, 0xaefe, 0xaf4b, 0xaef7, 0xd258, - 0xd25d, 0xb265, 0xd5e1, 0xd5e5, 0xb252, 0xb250, 0xb247, 0xd5e3, - 0xd5e2, 0xb25b, 0xd5e8, 0xb255, 0xd5fa, 0xd647, 0xb244, 0xd5f7, - 0xd5f0, 0xb267, 0xd5e0, 0xd5fc, 0xb264, 0xb258, 0xb263, 0xb24e, - 0xd5ec, 0xd5fe, 0xd5f6, 0xb24f, 0xb249, 0xd645, 0xd5fd, 0xd640, - 0xb251, 0xb259, 0xd642, 0xd5ea, 0xd5fb, 0xd5ef, 0xd644, 0xb25e, - 0xb246, 0xb25c, 0xd5f4, 0xd5f2, 0xd5f3, 0xb253, 0xd5ee, 0xd5ed, - 0xb248, 0xd5e7, 0xd646, 0xb24a, 0xd5f1, 0xb268, 0xb262, 0xd5e6, - 0xb25f, 0xb25d, 0xb266, 0xd5f8, 0xb261, 0xd252, 0xd5f9, 0xb260, - 0xd641, 0xb245, 0xd5f5, 0xb257, 0xd5e9, 0xb256, 0xb254, 0xb24c, - 0xb24b, 0xd9e7, 0xd643, 0xd5eb, 0xd9fc, 0xb24d, 0xb541, 0xb25a, - 0xb4ee, 0xd9f6, 0xb4fc, 0xd9ea, 0xb4eb, 0xb4e7, 0xda49, 0xb4ed, - 0xb4f1, 0xb4ec, 0xb4f5, 0xda4d, 0xda44, 0xd9f1, 0xb4fa, 0xb4f4, - 0xd9fd, 0xb4e4, 0xda4a, 0xda43, 0xb4e8, 0xd9f7, 0xb4f7, 0xda55, - 0xda56, 0xb4e5, 0xda48, 0xb4f9, 0xd9fb, 0xd9ed, 0xd9ee, 0xb4fd, - 0xd9f2, 0xd9f9, 0xd9f3, 0xb4fb, 0xb544, 0xd9ef, 0xd9e8, 0xd9e9, - 0xd9eb, 0xb4ea, 0xd9f8, 0xb4f8, 0xb542, 0xd9fa, 0xda53, 0xda4b, - 0xb4e6, 0xda51, 0xb4f2, 0xb4f0, 0xda57, 0xb4ef, 0xda41, 0xd9f4, - 0xd9fe, 0xb547, 0xda45, 0xda42, 0xd9f0, 0xb543, 0xda4f, 0xda4c, - 0xda54, 0xb4e9, 0xda40, 0xb546, 0xda47, 0xb4f3, 0xb4f6, 0xda46, - 0xb545, 0xd9f5, 0xd5e4, 0xda50, 0xda4e, 0xda52, 0xd9ec, 0xb540, - 0xde61, 0xde60, 0xde46, 0xb7bd, 0xde5f, 0xde49, 0xde4a, 0xb7c7, - 0xde68, 0xb7c2, 0xde5e, 0xde43, 0xb7c8, 0xb7be, 0xde52, 0xde48, - 0xde4b, 0xde63, 0xb7b8, 0xde6a, 0xde62, 0xb7c1, 0xde57, 0xb7cc, - 0xb7cb, 0xb7c5, 0xde69, 0xb7b9, 0xde55, 0xde4c, 0xde59, 0xde65, - 0xb7cd, 0xb7bb, 0xde54, 0xde4d, 0xb7c4, 0xb7c3, 0xde50, 0xde5a, - 0xde64, 0xde47, 0xde51, 0xb7bc, 0xde5b, 0xb7c9, 0xb7c0, 0xde4e, - 0xb7bf, 0xde45, 0xde53, 0xde67, 0xb4fe, 0xbab0, 0xde56, 0xe26c, - 0xde58, 0xde66, 0xb7c6, 0xde4f, 0xb7ba, 0xb7ca, 0xbcf0, 0xde44, - 0xde5d, 0xde5c, 0xe2aa, 0xbaad, 0xe27d, 0xe2a4, 0xbaa2, 0xe26e, - 0xbaaf, 0xba77, 0xe26d, 0xe2b0, 0xbab1, 0xe271, 0xe2a3, 0xe273, - 0xe2b3, 0xe2af, 0xba75, 0xbaa1, 0xe653, 0xbaae, 0xba7d, 0xe26f, - 0xe2ae, 0xbaa3, 0xe2ab, 0xe2b8, 0xe275, 0xe27e, 0xe2b6, 0xe2ac, - 0xba7c, 0xe27c, 0xba76, 0xba74, 0xbaa8, 0xe27a, 0xe277, 0xe278, - 0xe2b2, 0xe2b7, 0xe2b5, 0xba7a, 0xe2b9, 0xba7e, 0xbaa7, 0xe270, - 0xe5fa, 0xe279, 0xba78, 0xbaac, 0xbaa9, 0xba7b, 0xe2a5, 0xe274, - 0xbaaa, 0xe2a7, 0xbaa4, 0xbaa6, 0xba73, 0xe2a9, 0xe2a1, 0xe272, - 0xbaa5, 0xe2b1, 0xe2b4, 0xe27b, 0xe2a8, 0xba79, 0xbcdf, 0xe2a6, - 0xe5f9, 0xe2ad, 0xe276, 0xe644, 0xe64e, 0xbce2, 0xe64d, 0xe659, - 0xbce4, 0xe64b, 0xe64f, 0xbcef, 0xe646, 0xbce7, 0xe652, 0xe9f0, - 0xbcf3, 0xbcf2, 0xe654, 0xe643, 0xe65e, 0xbced, 0xbce3, 0xe657, - 0xe65b, 0xe660, 0xe655, 0xe649, 0xbce6, 0xbce9, 0xbcf1, 0xbcec, - 0xe64c, 0xe2a2, 0xe648, 0xe65f, 0xbce8, 0xbceb, 0xe661, 0xbce0, - 0xe656, 0xe5fb, 0xe65c, 0xc0df, 0xe64a, 0xbce1, 0xe645, 0xbce5, - 0xe5fc, 0xbaab, 0xe641, 0xe65a, 0xe642, 0xe640, 0xbcea, 0xe658, - 0xe5fe, 0xe651, 0xe650, 0xe65d, 0xe647, 0xbcee, 0xe9f3, 0xbf49, - 0xbefe, 0xea40, 0xe9eb, 0xbf41, 0xe9f7, 0xbf48, 0xbf43, 0xe9f5, - 0xed4f, 0xe9fb, 0xea42, 0xe9fa, 0xe9e9, 0xe9f8, 0xea44, 0xea46, - 0xbefd, 0xea45, 0xbf44, 0xbf4a, 0xbf47, 0xe9fe, 0xbf46, 0xe9f9, - 0xe9ed, 0xe9f2, 0xe9fd, 0xbf45, 0xbf42, 0xbefc, 0xbf40, 0xe9f1, - 0xe5fd, 0xe9ec, 0xe9ef, 0xea41, 0xe9f4, 0xe9ea, 0xed4e, 0xea43, - 0xe9ee, 0xe9fc, 0xed51, 0xc0e3, 0xc0d7, 0xc0db, 0xed53, 0xed59, - 0xed57, 0xc0d9, 0xc0da, 0xc0e1, 0xed5a, 0xed52, 0xc0dc, 0xed56, - 0xed55, 0xed5b, 0xc0e2, 0xc0dd, 0xc0e0, 0xed54, 0xc0e4, 0xc0de, - 0xc0e5, 0xc0d8, 0xed58, 0xed50, 0xeff7, 0xc271, 0xeff4, 0xeff6, - 0xc26f, 0xeff2, 0xeff3, 0xefee, 0xe9f6, 0xefef, 0xc270, 0xefeb, - 0xc26d, 0xeff8, 0xc26e, 0xefec, 0xefed, 0xeff1, 0xc273, 0xc272, - 0xeff0, 0xc378, 0xf25f, 0xf265, 0xc379, 0xf25c, 0xc376, 0xc373, - 0xf267, 0xc377, 0xc374, 0xf25e, 0xf261, 0xf262, 0xf263, 0xf266, - 0xeff5, 0xf25d, 0xc375, 0xf264, 0xf268, 0xf260, 0xf45d, 0xc46a, - 0xf460, 0xc46b, 0xf468, 0xf45f, 0xf45c, 0xf45e, 0xf462, 0xf465, - 0xf464, 0xf467, 0xf45b, 0xc469, 0xf463, 0xf466, 0xf469, 0xf461, - 0xf5d3, 0xf5d4, 0xf5d8, 0xf5d9, 0xf5d6, 0xf5d7, 0xf5d5, 0xc4e9, - 0xc578, 0xf6eb, 0xf6e8, 0xf6e9, 0xf6ea, 0xc579, 0xf7e5, 0xf7e4, - 0xf8af, 0xc5f4, 0xf8ad, 0xf8b0, 0xf8ae, 0xf8f5, 0xc657, 0xc665, - 0xf9a3, 0xf96c, 0xf9a2, 0xf9d0, 0xf9d1, 0xa4f5, 0xa6c7, 0xca41, - 0xcb5e, 0xa85f, 0xa862, 0xcb5f, 0xa860, 0xa861, 0xcd58, 0xcd5a, - 0xcd55, 0xcd52, 0xcd54, 0xaaa4, 0xaaa2, 0xcd56, 0xaaa3, 0xcd53, - 0xcd50, 0xaaa1, 0xcd57, 0xcd51, 0xaaa5, 0xcd59, 0xcfaf, 0xcfb3, - 0xacb7, 0xcfb6, 0xacaf, 0xacb2, 0xacb4, 0xacb6, 0xacb3, 0xcfb2, - 0xcfb1, 0xacb1, 0xcfb4, 0xcfb5, 0xcfae, 0xacb5, 0xacb0, 0xcfb0, - 0xd277, 0xd278, 0xd279, 0xaf50, 0xaf4c, 0xd26e, 0xd276, 0xd27b, - 0xaf51, 0xd26c, 0xd272, 0xd26b, 0xd275, 0xd271, 0xaf4d, 0xaf4f, - 0xd27a, 0xd26a, 0xd26d, 0xd273, 0xd274, 0xd27c, 0xd270, 0xaf4e, - 0xb26d, 0xd64e, 0xd650, 0xd64c, 0xd658, 0xd64a, 0xd657, 0xb269, - 0xd648, 0xda5b, 0xd652, 0xb26c, 0xd653, 0xd656, 0xd65a, 0xd64f, - 0xd654, 0xb26a, 0xb26b, 0xd659, 0xd64d, 0xd649, 0xd65b, 0xd651, - 0xd655, 0xd64b, 0xb548, 0xb549, 0xda65, 0xb54f, 0xda59, 0xda62, - 0xda58, 0xb54c, 0xda60, 0xda5e, 0xda5f, 0xb54a, 0xda63, 0xda5c, - 0xda5a, 0xb54b, 0xda5d, 0xda61, 0xb54d, 0xda64, 0xde70, 0xde77, - 0xde79, 0xdea1, 0xb7da, 0xde6b, 0xb7d2, 0xde7a, 0xb7d7, 0xdea2, - 0xb7ce, 0xde7d, 0xde6d, 0xde7e, 0xde6c, 0xb7dc, 0xde78, 0xb7cf, - 0xdea3, 0xb7d4, 0xde71, 0xb7d9, 0xde7c, 0xde6f, 0xde76, 0xde72, - 0xde6e, 0xb7d1, 0xb7d8, 0xb7d6, 0xb7d3, 0xb7db, 0xb7d0, 0xde75, - 0xb7d5, 0xb54e, 0xde7b, 0xde73, 0xde74, 0xe2c1, 0xbab4, 0xe2bd, - 0xe2c3, 0xe2bf, 0xbab6, 0xe2be, 0xe2c2, 0xe2ba, 0xe2bc, 0xbab5, - 0xe2c0, 0xe2bb, 0xbab7, 0xbab2, 0xe2c4, 0xbab3, 0xe667, 0xe664, - 0xe670, 0xe66a, 0xe66c, 0xbcf4, 0xe666, 0xe66e, 0xe66d, 0xe66b, - 0xe671, 0xbcf7, 0xe668, 0xe66f, 0xbcf5, 0xe663, 0xe665, 0xbcf6, - 0xe662, 0xe672, 0xe669, 0xea4a, 0xbf51, 0xea55, 0xea53, 0xbf4b, - 0xea49, 0xea4c, 0xea4d, 0xea48, 0xbf55, 0xbf56, 0xea47, 0xea56, - 0xea51, 0xbf4f, 0xbf4c, 0xea50, 0xea4e, 0xbf52, 0xea52, 0xbf4d, - 0xbf4e, 0xea4f, 0xbf50, 0xea4b, 0xea54, 0xbf53, 0xea57, 0xea58, - 0xbf54, 0xc0e7, 0xc0ee, 0xed5c, 0xed62, 0xed60, 0xc0ea, 0xc0e9, - 0xc0e6, 0xed5e, 0xc0ec, 0xc0eb, 0xc0e8, 0xed61, 0xed5d, 0xed5f, - 0xc0ed, 0xc277, 0xeffb, 0xc274, 0xc275, 0xeffd, 0xc276, 0xeffa, - 0xeff9, 0xf26c, 0xeffc, 0xf26d, 0xc37a, 0xf26b, 0xf26a, 0xf269, - 0xc37b, 0xc46c, 0xf46a, 0xf46b, 0xf5dc, 0xf5db, 0xc4ea, 0xf5da, - 0xf6ec, 0xf6ed, 0xf7e6, 0xf8b1, 0xf8f6, 0xf9bc, 0xc679, 0xf9c6, - 0xa4f6, 0xaaa6, 0xaaa7, 0xacb8, 0xc0ef, 0xa4f7, 0xaaa8, 0xaf52, - 0xb7dd, 0xa4f8, 0xb26e, 0xbab8, 0xc962, 0xcfb7, 0xd27d, 0xe2c5, - 0xc0f0, 0xa4f9, 0xaaa9, 0xcfb8, 0xcfb9, 0xda66, 0xb550, 0xdea4, - 0xb7de, 0xe2c6, 0xbcf8, 0xc37c, 0xa4fa, 0xda67, 0xa4fb, 0xa6c9, - 0xca42, 0xa6c8, 0xa865, 0xa864, 0xa863, 0xcb60, 0xaaaa, 0xaaab, - 0xcd5b, 0xcfba, 0xcfbd, 0xacba, 0xcfbb, 0xacb9, 0xcfbc, 0xacbb, - 0xd2a2, 0xd2a1, 0xd27e, 0xaf53, 0xd65d, 0xd65e, 0xb26f, 0xd65c, - 0xd65f, 0xb552, 0xb270, 0xb551, 0xda6b, 0xda6a, 0xda68, 0xda69, - 0xda6c, 0xdea6, 0xdea5, 0xdea9, 0xdea8, 0xdea7, 0xbab9, 0xe2c9, - 0xe2c8, 0xbaba, 0xe2c7, 0xe673, 0xe674, 0xbcf9, 0xea59, 0xea5a, - 0xf272, 0xc37d, 0xf271, 0xf270, 0xf26e, 0xf26f, 0xc4eb, 0xf46c, - 0xf6ee, 0xf8f7, 0xa4fc, 0xc9a5, 0xa5c7, 0xc9a6, 0xca43, 0xca44, - 0xcb66, 0xcb62, 0xcb61, 0xaaac, 0xcb65, 0xa867, 0xcb63, 0xa866, - 0xcb67, 0xcb64, 0xcd5f, 0xcfbe, 0xcd5d, 0xcd64, 0xaaad, 0xaab0, - 0xcd65, 0xcd61, 0xcd62, 0xcd5c, 0xaaaf, 0xcd5e, 0xaaae, 0xcd63, - 0xcd60, 0xcfc2, 0xacbd, 0xacbe, 0xcfc5, 0xcfbf, 0xcfc4, 0xcfc0, - 0xacbc, 0xcfc3, 0xcfc1, 0xd2a8, 0xd2a5, 0xd2a7, 0xaf58, 0xaf57, - 0xaf55, 0xd2a4, 0xd2a9, 0xaf54, 0xaf56, 0xd2a6, 0xd667, 0xd2a3, - 0xd2aa, 0xd662, 0xd666, 0xd665, 0xda6e, 0xda79, 0xd668, 0xd663, - 0xda6d, 0xb274, 0xb273, 0xd661, 0xd664, 0xb275, 0xb272, 0xb271, - 0xd660, 0xd669, 0xda70, 0xda77, 0xb554, 0xda76, 0xda73, 0xb556, - 0xda75, 0xda6f, 0xda71, 0xda74, 0xda72, 0xb555, 0xda78, 0xb553, - 0xb7df, 0xdead, 0xdeac, 0xdeaa, 0xb7e2, 0xb7e1, 0xdeae, 0xdeab, - 0xe2ca, 0xbabb, 0xb7e0, 0xdeb0, 0xdeaf, 0xe2cd, 0xe2cb, 0xbcfa, - 0xbabc, 0xe2cc, 0xe676, 0xbcfb, 0xe675, 0xe67e, 0xe67d, 0xe67b, - 0xe67a, 0xe677, 0xe678, 0xe679, 0xe67c, 0xe6a1, 0xea5f, 0xea5c, - 0xea5d, 0xbf57, 0xea5b, 0xea61, 0xea60, 0xea5e, 0xed64, 0xed65, - 0xc0f1, 0xc0f2, 0xed63, 0xc279, 0xeffe, 0xc278, 0xc37e, 0xc3a1, - 0xc46d, 0xf46e, 0xf46d, 0xf5dd, 0xf6ef, 0xc57a, 0xf7e8, 0xf7e7, - 0xf7e9, 0xa5c8, 0xcfc6, 0xaf59, 0xb276, 0xd66a, 0xa5c9, 0xc9a7, - 0xa4fd, 0xca45, 0xcb6c, 0xcb6a, 0xcb6b, 0xcb68, 0xa868, 0xcb69, - 0xcd6d, 0xaab3, 0xcd6b, 0xcd67, 0xcd6a, 0xcd66, 0xaab5, 0xcd69, - 0xaab2, 0xaab1, 0xaab4, 0xcd6c, 0xcd68, 0xacc2, 0xacc5, 0xcfce, - 0xcfcd, 0xcfcc, 0xacbf, 0xcfd5, 0xcfcb, 0xacc1, 0xd2af, 0xcfd2, - 0xcfd0, 0xacc4, 0xcfc8, 0xcfd3, 0xcfca, 0xcfd4, 0xcfd1, 0xcfc9, - 0xacc0, 0xcfd6, 0xcfc7, 0xacc3, 0xd2b4, 0xd2ab, 0xd2b6, 0xd2ae, - 0xd2b9, 0xd2ba, 0xd2ac, 0xd2b8, 0xd2b5, 0xd2b3, 0xd2b7, 0xaf5f, - 0xaf5d, 0xd2b1, 0xd2ad, 0xd2b0, 0xd2bb, 0xd2b2, 0xaf5e, 0xcfcf, - 0xaf5a, 0xaf5c, 0xd678, 0xd66d, 0xd66b, 0xd66c, 0xd673, 0xd674, - 0xd670, 0xb27b, 0xd675, 0xd672, 0xd66f, 0xb279, 0xd66e, 0xb277, - 0xb27a, 0xd671, 0xd679, 0xaf5b, 0xb278, 0xd677, 0xd676, 0xb27c, - 0xda7e, 0xdaa1, 0xb560, 0xdaa7, 0xdaa9, 0xdaa2, 0xb55a, 0xdaa6, - 0xdaa5, 0xb55b, 0xb561, 0xb562, 0xdaa8, 0xb558, 0xda7d, 0xda7b, - 0xdaa3, 0xda7a, 0xb55f, 0xda7c, 0xdaa4, 0xdaaa, 0xb559, 0xb55e, - 0xb55c, 0xb55d, 0xb557, 0xb7e9, 0xdeb7, 0xb7e8, 0xdebb, 0xdeb1, - 0xdebc, 0xdeb2, 0xdeb3, 0xdebd, 0xdeba, 0xdeb8, 0xdeb9, 0xdeb5, - 0xdeb4, 0xdebe, 0xb7e5, 0xdeb6, 0xb7ea, 0xb7e4, 0xb7eb, 0xb7ec, - 0xb7e7, 0xb7e6, 0xe2ce, 0xbabe, 0xbabd, 0xe2d3, 0xbcfc, 0xbabf, - 0xbac1, 0xe2d4, 0xb7e3, 0xbac0, 0xe2d0, 0xe2d2, 0xe2cf, 0xe2d1, - 0xe6ab, 0xe6aa, 0xe6a7, 0xbd40, 0xea62, 0xbd41, 0xe6a6, 0xbcfe, - 0xe6a8, 0xe6a5, 0xe6a2, 0xe6a9, 0xe6a3, 0xe6a4, 0xbcfd, 0xed69, - 0xea66, 0xea65, 0xea67, 0xed66, 0xbf5a, 0xea63, 0xbf58, 0xbf5c, - 0xbf5b, 0xea64, 0xea68, 0xbf59, 0xed6d, 0xc0f5, 0xc27a, 0xc0f6, - 0xc0f3, 0xed6a, 0xed68, 0xed6b, 0xed6e, 0xc0f4, 0xed6c, 0xed67, - 0xf042, 0xf045, 0xf275, 0xf040, 0xf46f, 0xf046, 0xc3a2, 0xf044, - 0xc27b, 0xf041, 0xf043, 0xf047, 0xf276, 0xf274, 0xc3a3, 0xf273, - 0xc46e, 0xc4ed, 0xf6f1, 0xc4ec, 0xf6f3, 0xf6f0, 0xf6f2, 0xc5d0, - 0xf8b2, 0xa5ca, 0xcd6e, 0xd2bc, 0xd2bd, 0xb27d, 0xdebf, 0xbf5d, - 0xc3a4, 0xc57b, 0xf8b3, 0xa5cb, 0xcd6f, 0xa260, 0xcfd7, 0xcfd8, - 0xd2be, 0xd2bf, 0xb27e, 0xb2a1, 0xdaab, 0xdec2, 0xdec1, 0xdec0, - 0xe2d5, 0xe2d6, 0xe2d7, 0xbac2, 0xe6ad, 0xe6ac, 0xea69, 0xbf5e, - 0xbf5f, 0xed72, 0xed6f, 0xed70, 0xed71, 0xf049, 0xf048, 0xc27c, - 0xf277, 0xf5de, 0xa5cc, 0xacc6, 0xb2a2, 0xdec3, 0xa5cd, 0xd2c0, - 0xb2a3, 0xb563, 0xb564, 0xa5ce, 0xa5cf, 0xca46, 0xa86a, 0xa869, - 0xacc7, 0xcfd9, 0xdaac, 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0xa86b, - 0xa86c, 0xcb6e, 0xcb6d, 0xaab6, 0xcd72, 0xcd70, 0xcd71, 0xcfda, - 0xcfdb, 0xaccb, 0xacc9, 0xacca, 0xacc8, 0xaf60, 0xaf64, 0xaf63, - 0xd2c1, 0xaf62, 0xaf61, 0xd2c2, 0xb2a6, 0xd67b, 0xd67a, 0xb2a4, - 0xb2a5, 0xb566, 0xb565, 0xdaae, 0xdaad, 0xb2a7, 0xb7ed, 0xdec5, - 0xb7ee, 0xdec4, 0xe2d8, 0xe6ae, 0xbd42, 0xea6a, 0xed73, 0xc3a6, - 0xc3a5, 0xc57c, 0xa5d4, 0xcd73, 0xb2a8, 0xe2d9, 0xbac3, 0xcb6f, - 0xcb70, 0xcd74, 0xaab8, 0xaab9, 0xaab7, 0xaccf, 0xacd0, 0xaccd, - 0xacce, 0xcfdc, 0xcfdd, 0xaccc, 0xd2c3, 0xaf68, 0xaf69, 0xb2ab, - 0xd2c9, 0xaf6e, 0xaf6c, 0xd2ca, 0xd2c5, 0xaf6b, 0xaf6a, 0xaf65, - 0xd2c8, 0xd2c7, 0xd2c4, 0xaf6d, 0xd2c6, 0xaf66, 0xaf67, 0xb2ac, - 0xd6a1, 0xd6a2, 0xb2ad, 0xd67c, 0xd67e, 0xd6a4, 0xd6a3, 0xd67d, - 0xb2a9, 0xb2aa, 0xdab6, 0xb56b, 0xb56a, 0xdab0, 0xb568, 0xdab3, - 0xb56c, 0xdab4, 0xb56d, 0xdab1, 0xb567, 0xb569, 0xdab5, 0xdab2, - 0xdaaf, 0xded2, 0xdec7, 0xb7f0, 0xb7f3, 0xb7f2, 0xb7f7, 0xb7f6, - 0xded3, 0xded1, 0xdeca, 0xdece, 0xdecd, 0xb7f4, 0xded0, 0xdecc, - 0xded4, 0xdecb, 0xb7f5, 0xb7ef, 0xb7f1, 0xdec9, 0xe2db, 0xbac7, - 0xe2df, 0xbac6, 0xe2dc, 0xbac5, 0xdec8, 0xdecf, 0xe2de, 0xbac8, - 0xe2e0, 0xe2dd, 0xe2da, 0xe6b1, 0xe6b5, 0xe6b7, 0xe6b3, 0xe6b2, - 0xe6b0, 0xbd45, 0xbd43, 0xbd48, 0xbd49, 0xe6b4, 0xbd46, 0xe6af, - 0xbd47, 0xbac4, 0xe6b6, 0xbd44, 0xea6c, 0xea6b, 0xea73, 0xea6d, - 0xea72, 0xea6f, 0xbf60, 0xea71, 0xbf61, 0xbf62, 0xea70, 0xea6e, - 0xc0f8, 0xed74, 0xc0f7, 0xed77, 0xed75, 0xed76, 0xc0f9, 0xf04d, - 0xc2a1, 0xf04e, 0xc27d, 0xf04f, 0xc27e, 0xf04c, 0xf050, 0xf04a, - 0xc3a7, 0xf278, 0xc3a8, 0xc46f, 0xf04b, 0xc470, 0xc4ee, 0xf5df, - 0xc57e, 0xf6f4, 0xc57d, 0xf7ea, 0xc5f5, 0xc5f6, 0xf9cc, 0xacd1, - 0xcfde, 0xb56e, 0xb56f, 0xa5d5, 0xa6ca, 0xca47, 0xcb71, 0xa86d, - 0xaaba, 0xacd2, 0xacd3, 0xacd4, 0xd6a6, 0xd2cb, 0xaf6f, 0xb2ae, - 0xd6a5, 0xdab8, 0xb571, 0xdab7, 0xb570, 0xded5, 0xbd4a, 0xe6bb, - 0xe6b8, 0xe6b9, 0xe6ba, 0xed78, 0xf051, 0xf471, 0xf470, 0xf6f5, - 0xa5d6, 0xcd75, 0xaf70, 0xb572, 0xded6, 0xe2e1, 0xbd4b, 0xea74, - 0xf052, 0xf472, 0xa5d7, 0xaabb, 0xacd7, 0xcfdf, 0xacd8, 0xacd6, - 0xacd5, 0xd2cc, 0xaf71, 0xaf72, 0xaf73, 0xb2b0, 0xd6a7, 0xb2af, - 0xdab9, 0xb2b1, 0xb573, 0xded7, 0xb7f8, 0xb7f9, 0xbac9, 0xbaca, - 0xbd4c, 0xbf64, 0xea75, 0xbf63, 0xed79, 0xc0fa, 0xf053, 0xf473, - 0xa5d8, 0xa86e, 0xcd78, 0xcd77, 0xaabc, 0xcd76, 0xaabd, 0xcd79, - 0xcfe5, 0xacdb, 0xacda, 0xcfe7, 0xcfe6, 0xacdf, 0xacde, 0xacd9, - 0xcfe1, 0xcfe2, 0xcfe3, 0xace0, 0xcfe0, 0xacdc, 0xcfe4, 0xacdd, - 0xd2cf, 0xd2d3, 0xd2d1, 0xd2d0, 0xd2d4, 0xd2d5, 0xd2d6, 0xd2ce, - 0xd2cd, 0xaf75, 0xaf76, 0xd2d7, 0xd2d2, 0xd6b0, 0xd2d8, 0xaf77, - 0xaf74, 0xd6aa, 0xd6a9, 0xd6ab, 0xd6ac, 0xd6ae, 0xd6ad, 0xd6b2, - 0xb2b5, 0xb2b2, 0xb2b6, 0xd6a8, 0xb2b7, 0xd6b1, 0xb2b4, 0xd6af, - 0xb2b3, 0xdabc, 0xdabe, 0xdaba, 0xdabb, 0xdabf, 0xdac1, 0xdac2, - 0xdabd, 0xdac0, 0xb574, 0xdedb, 0xdee0, 0xded8, 0xdedc, 0xdee1, - 0xdedd, 0xb7fa, 0xb843, 0xb7fd, 0xded9, 0xdeda, 0xbace, 0xb846, - 0xb7fe, 0xb844, 0xb7fc, 0xdedf, 0xb845, 0xdede, 0xb841, 0xb7fb, - 0xb842, 0xdee2, 0xe2e6, 0xe2e8, 0xb840, 0xe2e3, 0xbacc, 0xe2e9, - 0xbacd, 0xe2e7, 0xe2e2, 0xe2e5, 0xe2ea, 0xbacb, 0xe2e4, 0xbd4e, - 0xe6bf, 0xe6be, 0xbd51, 0xbd4f, 0xe6bc, 0xbd4d, 0xe6bd, 0xbd50, - 0xea7d, 0xeaa1, 0xea7e, 0xea76, 0xea7a, 0xea79, 0xea77, 0xbf66, - 0xbf67, 0xbf65, 0xea78, 0xea7b, 0xea7c, 0xbf68, 0xc140, 0xeda3, - 0xc0fc, 0xed7b, 0xc0fe, 0xc141, 0xc0fd, 0xeda2, 0xed7c, 0xc0fb, - 0xeda1, 0xed7a, 0xed7e, 0xed7d, 0xf055, 0xc2a4, 0xc2a5, 0xc2a2, - 0xc2a3, 0xf054, 0xf27b, 0xc3a9, 0xf279, 0xf27a, 0xf474, 0xf477, - 0xf475, 0xf476, 0xf5e0, 0xc4ef, 0xf7eb, 0xf8b4, 0xc5f7, 0xf8f8, - 0xf8f9, 0xc666, 0xa5d9, 0xace1, 0xdac3, 0xdee3, 0xa5da, 0xa86f, - 0xaabe, 0xcfe8, 0xcfe9, 0xaf78, 0xdac4, 0xb575, 0xb847, 0xc142, - 0xeda4, 0xf27c, 0xf478, 0xa5db, 0xcda1, 0xcd7a, 0xcd7c, 0xcd7e, - 0xcd7d, 0xcd7b, 0xaabf, 0xace2, 0xcff2, 0xcfed, 0xcfea, 0xcff1, - 0xace4, 0xace5, 0xcff0, 0xcfef, 0xcfee, 0xcfeb, 0xcfec, 0xcff3, - 0xace3, 0xaf7c, 0xafa4, 0xafa3, 0xd2e1, 0xd2db, 0xd2d9, 0xafa1, - 0xd6b9, 0xaf7a, 0xd2de, 0xd2e2, 0xd2e4, 0xd2e0, 0xd2da, 0xafa2, - 0xd2df, 0xd2dd, 0xaf79, 0xd2e5, 0xafa5, 0xd2e3, 0xaf7d, 0xd2dc, - 0xaf7e, 0xaf7b, 0xb2b9, 0xd6ba, 0xd6b3, 0xd6b5, 0xd6b7, 0xd6b8, - 0xd6b6, 0xb2ba, 0xd6bb, 0xd6b4, 0xdac8, 0xb576, 0xdad0, 0xdac5, - 0xdad1, 0xdac6, 0xdac7, 0xdacf, 0xdace, 0xdacb, 0xb2b8, 0xb577, - 0xdac9, 0xdacc, 0xb578, 0xdacd, 0xdaca, 0xdeee, 0xdef2, 0xb84e, - 0xe2f0, 0xb851, 0xdef0, 0xdeed, 0xdee8, 0xdeea, 0xdeeb, 0xdee4, - 0xb84d, 0xb84c, 0xb848, 0xdee7, 0xb84f, 0xb850, 0xdee6, 0xdee9, - 0xdef1, 0xb84a, 0xb84b, 0xdeef, 0xdee5, 0xe2f2, 0xbad0, 0xe2f4, - 0xdeec, 0xe2f6, 0xbad4, 0xe2f7, 0xe2f3, 0xbad1, 0xe2ef, 0xbad3, - 0xe2ec, 0xe2f1, 0xe2f5, 0xe2ee, 0xb849, 0xe2eb, 0xbad2, 0xe2ed, - 0xbd54, 0xe6c1, 0xbd58, 0xbd56, 0xbacf, 0xe6c8, 0xe6c9, 0xbd53, - 0xe6c7, 0xe6ca, 0xbd55, 0xbd52, 0xe6c3, 0xe6c0, 0xe6c5, 0xe6c2, - 0xbd59, 0xe6c4, 0xe6c6, 0xbd57, 0xbf6a, 0xeaa8, 0xeaa2, 0xeaa6, - 0xeaac, 0xeaad, 0xeaa9, 0xeaaa, 0xeaa7, 0xeaa4, 0xbf6c, 0xbf69, - 0xeaa3, 0xeaa5, 0xbf6b, 0xeaab, 0xc146, 0xedaa, 0xeda5, 0xc145, - 0xc143, 0xedac, 0xc144, 0xeda8, 0xeda9, 0xeda6, 0xedad, 0xf056, - 0xc147, 0xeda7, 0xedae, 0xedab, 0xf05a, 0xf057, 0xc2a6, 0xf05b, - 0xf05d, 0xf05c, 0xf058, 0xf059, 0xf2a3, 0xc3aa, 0xf27e, 0xf2a2, - 0xf27d, 0xf2a4, 0xf2a1, 0xf47a, 0xf47d, 0xf479, 0xc471, 0xf47b, - 0xf47c, 0xf47e, 0xc472, 0xc474, 0xc473, 0xf5e1, 0xf5e3, 0xf5e2, - 0xf6f6, 0xf8b5, 0xf8fa, 0xa5dc, 0xcb72, 0xaac0, 0xcda3, 0xaac1, - 0xaac2, 0xcda2, 0xcff8, 0xcff7, 0xace6, 0xace9, 0xace8, 0xace7, - 0xcff4, 0xcff6, 0xcff5, 0xd2e8, 0xafa7, 0xd2ec, 0xd2eb, 0xd2ea, - 0xd2e6, 0xafa6, 0xafaa, 0xafad, 0xafae, 0xd2e7, 0xd2e9, 0xafac, - 0xafab, 0xafa9, 0xafa8, 0xd6c2, 0xd6c0, 0xd6bc, 0xb2bb, 0xd6bd, - 0xb2bc, 0xd6be, 0xd6bf, 0xd6c1, 0xb2bd, 0xdad5, 0xdad4, 0xdad3, - 0xdad2, 0xdef6, 0xb852, 0xdef3, 0xdef5, 0xb853, 0xb854, 0xdef4, - 0xe341, 0xe2f9, 0xe2fa, 0xbad7, 0xbad5, 0xbad6, 0xe343, 0xe342, - 0xe2fe, 0xe2fd, 0xe2fc, 0xe2fb, 0xe340, 0xe2f8, 0xe6cb, 0xe6d0, - 0xe6ce, 0xe6cd, 0xe6cc, 0xe6cf, 0xeaae, 0xbf6d, 0xc148, 0xedb0, - 0xc149, 0xedaf, 0xf05f, 0xf05e, 0xc2a7, 0xf2a5, 0xc3ab, 0xf4a1, - 0xc5a1, 0xf6f7, 0xf8b7, 0xf8b6, 0xc9a8, 0xacea, 0xaceb, 0xd6c3, - 0xb856, 0xa5dd, 0xa872, 0xa871, 0xa870, 0xcda4, 0xaac4, 0xaac3, - 0xacee, 0xcffa, 0xcffd, 0xcffb, 0xacec, 0xaced, 0xcff9, 0xcffc, - 0xafb5, 0xd2f3, 0xd2f5, 0xd2f4, 0xafb2, 0xd2ef, 0xafb0, 0xafaf, - 0xafb3, 0xafb1, 0xafb4, 0xd2f2, 0xd2ed, 0xd2ee, 0xd2f1, 0xd2f0, - 0xd6c6, 0xd6c7, 0xd6c5, 0xd6c4, 0xb2be, 0xb57d, 0xdad6, 0xdad8, - 0xdada, 0xb57c, 0xb57a, 0xdad7, 0xb57b, 0xdad9, 0xb579, 0xdf41, - 0xdef7, 0xdefa, 0xdefe, 0xb85a, 0xdefc, 0xdefb, 0xdef8, 0xdef9, - 0xb858, 0xdf40, 0xb857, 0xb85c, 0xb85b, 0xb859, 0xdefd, 0xe349, - 0xe348, 0xe344, 0xbad8, 0xe347, 0xe346, 0xbad9, 0xbd5e, 0xe6d2, - 0xbd5f, 0xbd5b, 0xbd5d, 0xbd5a, 0xbd5c, 0xeaaf, 0xbf70, 0xeab1, - 0xeab0, 0xe345, 0xbf72, 0xbf71, 0xbf6e, 0xbf6f, 0xedb5, 0xedb3, - 0xc14a, 0xedb4, 0xedb6, 0xedb2, 0xedb1, 0xf060, 0xc2aa, 0xc2a8, - 0xc2a9, 0xf2a6, 0xf2a7, 0xc3ad, 0xc3ac, 0xf4a3, 0xf4a4, 0xf4a2, - 0xf6f8, 0xf6f9, 0xa5de, 0xca48, 0xa873, 0xcda5, 0xaac6, 0xaac5, - 0xcda6, 0xd040, 0xacef, 0xcffe, 0xacf0, 0xafb6, 0xd2f8, 0xd2f6, - 0xd2fc, 0xafb7, 0xd2f7, 0xd2fb, 0xd2f9, 0xd2fa, 0xd6c8, 0xd6ca, - 0xb2bf, 0xd6c9, 0xb2c0, 0xb5a2, 0xb5a1, 0xb57e, 0xdadb, 0xdf44, - 0xb85d, 0xb85e, 0xdf43, 0xdf42, 0xe34a, 0xbadb, 0xbada, 0xe34b, - 0xe34c, 0xbd61, 0xbd60, 0xeab5, 0xe6d3, 0xe6d5, 0xe6d4, 0xeab4, - 0xeab2, 0xeab6, 0xeab3, 0xbf73, 0xedb7, 0xc14b, 0xedb8, 0xedb9, - 0xc2ab, 0xc2ac, 0xc475, 0xc5d1, 0xa5df, 0xd041, 0xd2fd, 0xafb8, - 0xb3ba, 0xb3b9, 0xb5a4, 0xdadd, 0xb5a3, 0xdadc, 0xdf45, 0xbadc, - 0xe34d, 0xbadd, 0xc476, 0xf4a5, 0xa6cb, 0xaac7, 0xcda7, 0xacf2, - 0xacf1, 0xd042, 0xd043, 0xd340, 0xd342, 0xafb9, 0xd344, 0xd347, - 0xd345, 0xd346, 0xd343, 0xd2fe, 0xafba, 0xd348, 0xd341, 0xd6d3, - 0xb2c6, 0xd6dc, 0xb2c3, 0xd6d5, 0xb2c7, 0xb2c1, 0xd6d0, 0xd6dd, - 0xd6d1, 0xd6ce, 0xb2c5, 0xb2c2, 0xd6d4, 0xd6d7, 0xb2c4, 0xd6d8, - 0xb2c8, 0xd6d9, 0xd6cf, 0xd6d6, 0xd6da, 0xd6d2, 0xd6cd, 0xd6cb, - 0xd6db, 0xdadf, 0xdae4, 0xdae0, 0xdae6, 0xb5a7, 0xd6cc, 0xdae1, - 0xb5a5, 0xdade, 0xb5ac, 0xdae2, 0xb5ab, 0xdae3, 0xb5ad, 0xb5a8, - 0xb5ae, 0xb5a9, 0xb5aa, 0xb5a6, 0xdae5, 0xb861, 0xdf50, 0xdf53, - 0xdf47, 0xdf4c, 0xdf46, 0xb863, 0xdf4a, 0xdf48, 0xb862, 0xdf4f, - 0xdf4e, 0xdf4b, 0xdf4d, 0xdf49, 0xbae1, 0xdf52, 0xb85f, 0xdf51, - 0xe35d, 0xbae8, 0xe358, 0xbae7, 0xe34e, 0xe350, 0xbae0, 0xe355, - 0xe354, 0xe357, 0xbae5, 0xe352, 0xe351, 0xbae4, 0xbadf, 0xe353, - 0xbae2, 0xe359, 0xe35b, 0xe356, 0xe34f, 0xbae3, 0xbd69, 0xbade, - 0xe35c, 0xe6d9, 0xbd62, 0xe6db, 0xbd63, 0xbd65, 0xe6de, 0xe6d6, - 0xbae6, 0xe6dc, 0xe6d8, 0xb860, 0xbd68, 0xbd64, 0xbd66, 0xbd67, - 0xbf76, 0xe6dd, 0xe6d7, 0xbd6a, 0xe6da, 0xeac0, 0xeabb, 0xeac5, - 0xbf74, 0xeabd, 0xbf78, 0xeac3, 0xeaba, 0xeab7, 0xeac6, 0xc151, - 0xbf79, 0xeac2, 0xeab8, 0xbf77, 0xeabc, 0xbf7b, 0xeab9, 0xeabe, - 0xbf7a, 0xeac1, 0xeac4, 0xedcb, 0xedcc, 0xedbc, 0xedc3, 0xedc1, - 0xc14f, 0xedc8, 0xeabf, 0xedbf, 0xedc9, 0xc14e, 0xedbe, 0xedbd, - 0xedc7, 0xedc4, 0xedc6, 0xedba, 0xedca, 0xc14c, 0xedc5, 0xedce, - 0xedc2, 0xc150, 0xc14d, 0xedc0, 0xedbb, 0xedcd, 0xbf75, 0xf063, - 0xf061, 0xf067, 0xc2b0, 0xf065, 0xf064, 0xc2b2, 0xf06a, 0xc2b1, - 0xf06b, 0xf068, 0xc2ae, 0xf069, 0xf062, 0xc2af, 0xc2ad, 0xf2ab, - 0xf066, 0xf06c, 0xf2a8, 0xc3b2, 0xc3b0, 0xf2aa, 0xf2ac, 0xf2a9, - 0xc3b1, 0xc3ae, 0xc3af, 0xc3b3, 0xc478, 0xf4aa, 0xf4a9, 0xf4a7, - 0xf4a6, 0xf4a8, 0xc477, 0xc479, 0xc4f0, 0xf5e5, 0xf5e4, 0xf6fa, - 0xf6fc, 0xf6fe, 0xf6fd, 0xf6fb, 0xc5a3, 0xc5a2, 0xc5d3, 0xc5d2, - 0xc5d4, 0xf7ed, 0xf7ec, 0xf8fb, 0xf8b8, 0xf8fc, 0xc658, 0xc659, - 0xf96d, 0xc67e, 0xa6cc, 0xcda8, 0xd045, 0xd046, 0xd044, 0xacf3, - 0xd047, 0xd048, 0xd049, 0xd349, 0xd34f, 0xd34d, 0xafbb, 0xd34b, - 0xd34c, 0xd34e, 0xd34a, 0xb2c9, 0xd6de, 0xb2cb, 0xd6e0, 0xb2ca, - 0xd6df, 0xdae8, 0xb5af, 0xdaea, 0xdae7, 0xd6e1, 0xb5b0, 0xdae9, - 0xdf56, 0xb864, 0xdf54, 0xb865, 0xdf55, 0xb866, 0xbae9, 0xe361, - 0xe35e, 0xe360, 0xbaea, 0xbaeb, 0xe35f, 0xe6df, 0xe6e0, 0xbd6b, - 0xe6e2, 0xe6e1, 0xa261, 0xeaca, 0xeacb, 0xeac7, 0xeac8, 0xbf7c, - 0xbf7d, 0xeac9, 0xc157, 0xc153, 0xc158, 0xc154, 0xc156, 0xc152, - 0xc155, 0xc2b3, 0xedcf, 0xf2ae, 0xf2ad, 0xf4ab, 0xc47a, 0xc47b, - 0xf741, 0xf5e6, 0xf740, 0xf8fd, 0xf9a4, 0xa6cd, 0xa874, 0xcda9, - 0xaac8, 0xacf6, 0xd04c, 0xacf4, 0xd04a, 0xacf9, 0xacf5, 0xacfa, - 0xacf8, 0xd04b, 0xacf7, 0xafbf, 0xafbe, 0xd35a, 0xafc7, 0xd353, - 0xd359, 0xafc3, 0xd352, 0xd358, 0xd356, 0xafc2, 0xafc4, 0xd355, - 0xafbd, 0xd354, 0xafc8, 0xafc5, 0xafc9, 0xafc6, 0xd351, 0xd350, - 0xd357, 0xafc0, 0xafbc, 0xafc1, 0xd6f0, 0xd6e9, 0xb5b5, 0xd6e8, - 0xb2cf, 0xb2d6, 0xb2d3, 0xb2d9, 0xb2d8, 0xb2d4, 0xd6e2, 0xd6e5, - 0xd6e4, 0xb2d0, 0xd6e6, 0xd6ef, 0xb2d1, 0xd6e3, 0xd6ec, 0xd6ed, - 0xb2d2, 0xd6ea, 0xb2d7, 0xb2cd, 0xb2d5, 0xd6e7, 0xb2cc, 0xd6eb, - 0xd6ee, 0xdafb, 0xdaf2, 0xb5b2, 0xdaf9, 0xdaf6, 0xdaee, 0xdaf7, - 0xb5b4, 0xdaef, 0xdaeb, 0xb86c, 0xdaf4, 0xb5b1, 0xdafa, 0xb5b8, - 0xb5ba, 0xdaed, 0xb5b9, 0xdaf0, 0xb5b3, 0xdaf8, 0xdaf1, 0xdaf5, - 0xdaf3, 0xb5b6, 0xdaec, 0xb5bb, 0xb2ce, 0xb5b7, 0xb5bc, 0xb868, - 0xdf5d, 0xdf5f, 0xdf61, 0xdf65, 0xdf5b, 0xdf59, 0xb86a, 0xdf60, - 0xdf64, 0xdf5c, 0xdf58, 0xdf57, 0xdf62, 0xdf5a, 0xdf5e, 0xb86b, - 0xb869, 0xdf66, 0xb867, 0xdf63, 0xe372, 0xbaee, 0xe36a, 0xbd78, - 0xe374, 0xbaf1, 0xe378, 0xbaf7, 0xe365, 0xe375, 0xe362, 0xe377, - 0xe366, 0xbafe, 0xbafb, 0xe376, 0xe370, 0xbaed, 0xbaf5, 0xbaf4, - 0xbaf3, 0xbaf9, 0xe363, 0xbafa, 0xe371, 0xbaf6, 0xbaec, 0xe373, - 0xbaef, 0xbaf0, 0xbaf8, 0xe368, 0xe367, 0xe364, 0xe36c, 0xe369, - 0xe36d, 0xbafd, 0xe379, 0xbaf2, 0xe36e, 0xe36f, 0xe36b, 0xbafc, - 0xe6e7, 0xbd70, 0xbd79, 0xbd75, 0xe6e4, 0xbd72, 0xbd76, 0xe6f0, - 0xbd6c, 0xe6e8, 0xbd74, 0xe6eb, 0xe6e6, 0xbd73, 0xbd77, 0xe6e5, - 0xbd71, 0xe6ef, 0xbd6e, 0xe6ee, 0xe6ed, 0xbd7a, 0xe572, 0xbd6d, - 0xe6ec, 0xe6e3, 0xbd7b, 0xe6ea, 0xbd6f, 0xe6e9, 0xbfa2, 0xbfa7, - 0xbf7e, 0xead8, 0xeacf, 0xeadb, 0xead3, 0xead9, 0xbfa8, 0xbfa1, - 0xeacc, 0xead2, 0xeadc, 0xead5, 0xeada, 0xeace, 0xead6, 0xbfa3, - 0xead4, 0xbfa6, 0xbfa5, 0xead0, 0xead1, 0xeacd, 0xead7, 0xbfa4, - 0xeade, 0xeadd, 0xedda, 0xedd6, 0xc15f, 0xedd0, 0xc159, 0xc169, - 0xeddc, 0xc161, 0xc15d, 0xedd3, 0xc164, 0xc167, 0xedde, 0xc15c, - 0xedd5, 0xc165, 0xede0, 0xeddd, 0xedd1, 0xc160, 0xc15a, 0xc168, - 0xedd8, 0xc163, 0xedd2, 0xc15e, 0xeddf, 0xc162, 0xc15b, 0xedd9, - 0xc166, 0xedd7, 0xeddb, 0xf06e, 0xf074, 0xc2b9, 0xf077, 0xc2b4, - 0xc2b5, 0xf06f, 0xf076, 0xf071, 0xc2ba, 0xc2b7, 0xf06d, 0xc2b6, - 0xf073, 0xf075, 0xc2b8, 0xf072, 0xf070, 0xf2b8, 0xc3b7, 0xc3b8, - 0xc3b4, 0xc3b5, 0xf2b4, 0xf2b2, 0xf2b6, 0xc3ba, 0xf2b7, 0xf2b0, - 0xf2af, 0xf2b3, 0xf2b1, 0xc3b6, 0xf2b5, 0xf4ac, 0xc47e, 0xc47d, - 0xf4ad, 0xf4af, 0xf4ae, 0xc4a1, 0xf5eb, 0xf5e8, 0xf5e9, 0xf5e7, - 0xf5ea, 0xc4f2, 0xf5ec, 0xc4f1, 0xf742, 0xc5d5, 0xc5d7, 0xf7ee, - 0xc5d6, 0xf8b9, 0xf940, 0xf942, 0xf8fe, 0xf941, 0xc66c, 0xa6ce, - 0xacfb, 0xd26f, 0xafca, 0xb2da, 0xdafc, 0xdafd, 0xeadf, 0xc16a, - 0xede1, 0xc2bb, 0xf2ba, 0xf2b9, 0xc4a2, 0xf5ed, 0xf743, 0xc5f8, - 0xca49, 0xaac9, 0xa875, 0xd04d, 0xd360, 0xd35b, 0xd35f, 0xd35d, - 0xafcb, 0xd35e, 0xd35c, 0xd6f1, 0xdafe, 0xdb40, 0xdf69, 0xdf6a, - 0xb86e, 0xb86f, 0xdf68, 0xdf6b, 0xdf67, 0xb86d, 0xbb40, 0xb870, - 0xe37a, 0xbd7c, 0xe6f1, 0xbd7d, 0xbfa9, 0xeae2, 0xeae0, 0xeae1, - 0xede4, 0xede3, 0xede2, 0xf2bb, 0xc3b9, 0xf2bc, 0xf744, 0xc5f9, - 0xf8ba, 0xa6cf, 0xaacb, 0xaaca, 0xd04f, 0xacfc, 0xd04e, 0xd362, - 0xafcc, 0xd6f2, 0xd361, 0xb2dc, 0xd6f5, 0xd6f3, 0xd6f4, 0xb2db, - 0xdb42, 0xdb43, 0xdb41, 0xb873, 0xdf6d, 0xdf6c, 0xdf6e, 0xb872, - 0xb871, 0xe6f2, 0xe6f4, 0xbd7e, 0xe6f3, 0xeae3, 0xbfaa, 0xf079, - 0xf078, 0xc3bb, 0xf2bd, 0xc3bd, 0xc3bc, 0xf4b0, 0xf5ee, 0xc4f3, - 0xa6d0, 0xd050, 0xacfd, 0xd365, 0xafce, 0xd364, 0xd363, 0xafcd, - 0xd6fb, 0xd6fd, 0xd6f6, 0xd6f7, 0xb2dd, 0xd6f8, 0xb2de, 0xd6fc, - 0xd6f9, 0xd6fa, 0xb2df, 0xb5be, 0xb5bf, 0xdb44, 0xdf6f, 0xdf70, - 0xe37e, 0xbb43, 0xbb41, 0xbb42, 0xe37b, 0xe37c, 0xe37d, 0xe6f9, - 0xe6fa, 0xbda1, 0xe6f7, 0xe6f6, 0xe6f8, 0xe6f5, 0xbfad, 0xeae4, - 0xbfab, 0xbfac, 0xede6, 0xc16b, 0xede5, 0xefa8, 0xf07a, 0xf07b, - 0xc2bc, 0xc2bd, 0xc16c, 0xf2be, 0xf2bf, 0xf4b1, 0xc4a3, 0xa6d1, - 0xa6d2, 0xacfe, 0xaacc, 0xafcf, 0xd051, 0xb5c0, 0xa6d3, 0xad41, - 0xd052, 0xd053, 0xad40, 0xad42, 0xa6d4, 0xd054, 0xafd1, 0xd366, - 0xafd3, 0xafd0, 0xafd2, 0xd741, 0xb2e0, 0xd740, 0xd6fe, 0xdf71, - 0xe3a1, 0xbda2, 0xbfae, 0xeae6, 0xeae5, 0xede7, 0xf5ef, 0xa6d5, - 0xcb73, 0xcdaa, 0xad43, 0xd055, 0xd368, 0xafd4, 0xd367, 0xafd5, - 0xd743, 0xb2e2, 0xd742, 0xd744, 0xb2e1, 0xdb46, 0xdb47, 0xdb45, - 0xb5c1, 0xb874, 0xb875, 0xbb45, 0xe3a3, 0xe3a2, 0xbb44, 0xe6fb, - 0xe6fc, 0xeae7, 0xc170, 0xc16f, 0xc16d, 0xc16e, 0xc171, 0xf07c, - 0xc2bf, 0xc2be, 0xf2c0, 0xf4b2, 0xc5a5, 0xc5a4, 0xa6d6, 0xd1fb, - 0xb877, 0xb5c2, 0xb876, 0xbb46, 0xa6d7, 0xc9a9, 0xa6d8, 0xa6d9, - 0xcdab, 0xcb76, 0xcb77, 0xa877, 0xcb74, 0xa876, 0xa879, 0xcb75, - 0xa87b, 0xa87a, 0xcb78, 0xa878, 0xaad1, 0xaacf, 0xcdad, 0xaace, - 0xaad3, 0xaad5, 0xaad2, 0xcdb0, 0xcdac, 0xaad6, 0xaad0, 0xa87c, - 0xaad4, 0xcdaf, 0xcdae, 0xaacd, 0xd05b, 0xad47, 0xad48, 0xd05d, - 0xd057, 0xd05a, 0xd063, 0xd061, 0xad49, 0xd067, 0xad4c, 0xd064, - 0xd05c, 0xd059, 0xdb49, 0xd062, 0xad44, 0xd065, 0xd056, 0xd05f, - 0xad46, 0xad4b, 0xd060, 0xad4f, 0xad4d, 0xd058, 0xad4a, 0xd05e, - 0xad4e, 0xad45, 0xd066, 0xafda, 0xafe3, 0xafd8, 0xafd6, 0xd36a, - 0xafde, 0xafdb, 0xd36c, 0xafdd, 0xd36b, 0xd369, 0xd36e, 0xafe2, - 0xafe0, 0xdb48, 0xd36f, 0xd36d, 0xafd7, 0xafd9, 0xafdc, 0xafdf, - 0xafe1, 0xd74e, 0xb2e4, 0xd745, 0xd747, 0xd748, 0xd750, 0xd74c, - 0xd74a, 0xd74d, 0xd751, 0xb2e5, 0xb2e9, 0xd746, 0xd74f, 0xb2e7, - 0xb2e6, 0xd74b, 0xd749, 0xb2e3, 0xb2e8, 0xb5c8, 0xdb51, 0xdb4f, - 0xb5ca, 0xdb4a, 0xdfa1, 0xb5c9, 0xdb4e, 0xdb4b, 0xb5c5, 0xb5cb, - 0xdb50, 0xb5c7, 0xdb4d, 0xbb47, 0xb5c6, 0xdb4c, 0xb5cc, 0xb5c4, - 0xb5c3, 0xdf77, 0xdf75, 0xdf7b, 0xdf73, 0xdfa2, 0xdf78, 0xdf72, - 0xb87b, 0xb8a3, 0xdf7d, 0xdf76, 0xb87e, 0xb87c, 0xdf7e, 0xb879, - 0xb878, 0xdf79, 0xb87d, 0xb5cd, 0xdf7c, 0xdf74, 0xb87a, 0xb8a1, - 0xb8a2, 0xbb4c, 0xbb48, 0xbb4d, 0xe3a6, 0xe3a5, 0xe3a7, 0xbb4a, - 0xe3a4, 0xbb4b, 0xe3aa, 0xe3a9, 0xe3a8, 0xbb49, 0xe741, 0xe744, - 0xbda8, 0xe743, 0xbda7, 0xbda3, 0xbda4, 0xbda5, 0xe740, 0xe6fe, - 0xbda6, 0xe742, 0xe6fd, 0xeae9, 0xeaf3, 0xbfb1, 0xbfb0, 0xeaed, - 0xeaef, 0xeaea, 0xeaee, 0xeae8, 0xeaf1, 0xbfaf, 0xeaf0, 0xeaec, - 0xeaf2, 0xeaeb, 0xc174, 0xede8, 0xedee, 0xc178, 0xc17a, 0xc177, - 0xc176, 0xc175, 0xc173, 0xede9, 0xedec, 0xc172, 0xeded, 0xc179, - 0xedeb, 0xedea, 0xc2c0, 0xc2c1, 0xf0a1, 0xf07d, 0xf07e, 0xf2c2, - 0xf2c1, 0xc3be, 0xf4b4, 0xc4a4, 0xf4b3, 0xf5f0, 0xf745, 0xc5a6, - 0xf943, 0xf944, 0xc5d8, 0xa6da, 0xaad7, 0xdb52, 0xbb4e, 0xc17b, - 0xedef, 0xa6db, 0xafe5, 0xafe4, 0xdb53, 0xeaf4, 0xa6dc, 0xad50, - 0xdb54, 0xdb55, 0xdb56, 0xbb4f, 0xbfb2, 0xa6dd, 0xaad8, 0xd068, - 0xafe6, 0xd370, 0xb2ea, 0xdb57, 0xb8a4, 0xbb50, 0xbfb3, 0xc17c, - 0xc2c2, 0xf4b5, 0xa6de, 0xaad9, 0xafe7, 0xd752, 0xb5ce, 0xbb51, - 0xe3ab, 0xe745, 0xa6df, 0xb5cf, 0xdfa3, 0xbb52, 0xa6e0, 0xcdb1, - 0xd069, 0xad51, 0xd372, 0xafea, 0xafe8, 0xafe9, 0xafeb, 0xd371, - 0xd757, 0xd754, 0xd756, 0xb2eb, 0xb2ed, 0xb2ec, 0xd753, 0xb2ee, - 0xd755, 0xdb58, 0xdb59, 0xdb5a, 0xdfa6, 0xdfa7, 0xdfa5, 0xdfa8, - 0xb8a5, 0xdfa4, 0xbb53, 0xe74a, 0xe746, 0xe749, 0xe74b, 0xe748, - 0xe747, 0xeaf5, 0xeaf6, 0xeaf7, 0xbfb4, 0xbfb5, 0xedf1, 0xedf0, - 0xedf2, 0xf0a3, 0xf0a2, 0xf2c4, 0xf2c5, 0xf2c3, 0xc4a5, 0xf4b6, - 0xf4b7, 0xf746, 0xf7ef, 0xf8bb, 0xa6e1, 0xa87d, 0xc17d, 0xa6e2, - 0xd758, 0xdb5b, 0xc641, 0xca4a, 0xca4b, 0xca4d, 0xa6e3, 0xca4e, - 0xca4c, 0xcba2, 0xcba3, 0xcb7b, 0xcba1, 0xa8a1, 0xa8a2, 0xcb7c, - 0xcb7a, 0xcb79, 0xcb7d, 0xa87e, 0xcb7e, 0xd06a, 0xcdb6, 0xaadc, - 0xcdb5, 0xcdb7, 0xaadb, 0xcdbc, 0xaadf, 0xcdb2, 0xcdc0, 0xcdc6, - 0xaae6, 0xcdc3, 0xaae3, 0xcdb9, 0xcdbf, 0xcdc1, 0xcdb4, 0xaae2, - 0xaadd, 0xcdba, 0xaae4, 0xaae7, 0xaae1, 0xaada, 0xcdbe, 0xcdb8, - 0xcdc5, 0xaae9, 0xaae5, 0xaae0, 0xcdbd, 0xafec, 0xcdbb, 0xaade, - 0xaae8, 0xcdb3, 0xcdc2, 0xcdc4, 0xad62, 0xad5c, 0xad64, 0xad61, - 0xd071, 0xd074, 0xad5d, 0xd06b, 0xad56, 0xad60, 0xad63, 0xad65, - 0xd0a2, 0xd077, 0xad55, 0xd0a1, 0xad59, 0xad57, 0xad52, 0xd06f, - 0xd07e, 0xd073, 0xd076, 0xd0a5, 0xad66, 0xd07d, 0xad5e, 0xd078, - 0xd0a4, 0xd075, 0xd079, 0xd07c, 0xd06d, 0xd0a3, 0xd07b, 0xd06c, - 0xd070, 0xad5f, 0xad5a, 0xad53, 0xad58, 0xad54, 0xad67, 0xd06e, - 0xd3a5, 0xad5b, 0xd07a, 0xce41, 0xd3a8, 0xaffa, 0xd376, 0xd3a3, - 0xd37d, 0xd3b2, 0xd3aa, 0xd37e, 0xd3a9, 0xd378, 0xd37c, 0xd3b5, - 0xaffd, 0xd3ad, 0xd3a4, 0xafed, 0xd3b3, 0xd374, 0xd3ac, 0xaffc, - 0xaff7, 0xd373, 0xaff5, 0xaff4, 0xaff9, 0xd3ab, 0xaff1, 0xaff8, - 0xd072, 0xdb5c, 0xd3a6, 0xd37a, 0xaffb, 0xd37b, 0xd3a1, 0xaffe, - 0xd375, 0xd3af, 0xd3ae, 0xd3b6, 0xaff3, 0xaff0, 0xd3b4, 0xd3b0, - 0xd3a7, 0xd3a2, 0xaff6, 0xaff2, 0xd377, 0xafee, 0xd3b1, 0xafef, - 0xd379, 0xd75e, 0xd760, 0xd765, 0xd779, 0xb2fc, 0xb2f2, 0xd75d, - 0xb2fd, 0xb2fe, 0xd768, 0xd76f, 0xd775, 0xd762, 0xd769, 0xb340, - 0xd777, 0xd772, 0xb2fa, 0xb2f8, 0xd76e, 0xd76a, 0xd75c, 0xb2ef, - 0xd761, 0xd759, 0xb2f7, 0xb2f9, 0xd766, 0xd763, 0xb2f4, 0xd773, - 0xb2f1, 0xd764, 0xd77a, 0xd76c, 0xd76b, 0xb2f0, 0xb2fb, 0xb2f3, - 0xd75a, 0xd75f, 0xd770, 0xd776, 0xb341, 0xd75b, 0xd767, 0xd76d, - 0xb2f6, 0xd778, 0xd771, 0xd774, 0xb2f5, 0xdb6c, 0xdb60, 0xb5d7, - 0xdb7d, 0xdba7, 0xdbaa, 0xb5d5, 0xdb68, 0xdba3, 0xdb69, 0xdb77, - 0xb5e2, 0xdb73, 0xb5df, 0xdb74, 0xdb5d, 0xdba4, 0xb5e8, 0xdba1, - 0xdb75, 0xdbac, 0xdb70, 0xdfc8, 0xdbaf, 0xb5e6, 0xdb6e, 0xdb7a, - 0xb5e9, 0xb5d4, 0xdb72, 0xdbad, 0xdb6b, 0xdb64, 0xdb6f, 0xdb63, - 0xdb61, 0xb5d0, 0xdba5, 0xdb6a, 0xdba8, 0xdba9, 0xb5d8, 0xb5dd, - 0xb5d9, 0xb5e1, 0xdb7e, 0xb5da, 0xdb76, 0xdb66, 0xb5d2, 0xdb5e, - 0xdba2, 0xdbab, 0xdb65, 0xb5e0, 0xdbb0, 0xdb71, 0xdb6d, 0xb5d1, - 0xb5e5, 0xdb7c, 0xb5e7, 0xdb78, 0xb5dc, 0xb5d6, 0xb5de, 0xb5d3, - 0xb5e4, 0xdb79, 0xdb67, 0xdb7b, 0xdb62, 0xdba6, 0xdbae, 0xdb5f, - 0xdfc7, 0xdfdd, 0xb855, 0xdfcc, 0xdfca, 0xdfb5, 0xb8a9, 0xdfc5, - 0xdfd9, 0xdfc1, 0xb8b1, 0xdfd8, 0xdfbf, 0xb5e3, 0xdfcf, 0xdfc0, - 0xdfd6, 0xb8b0, 0xb8a8, 0xdfaa, 0xdfb2, 0xdfcb, 0xdfc3, 0xdfdc, - 0xdfc6, 0xb8b6, 0xdfd7, 0xb8ad, 0xdfc9, 0xdfd1, 0xdfb6, 0xdfd0, - 0xdfe1, 0xdfb1, 0xdfd2, 0xdfdf, 0xdfab, 0xb5db, 0xdfb9, 0xdfb8, - 0xb8af, 0xdfbc, 0xdfbe, 0xdfcd, 0xdfde, 0xb8b2, 0xb8b3, 0xdfb0, - 0xb8ab, 0xdfb4, 0xdfda, 0xb8b4, 0xb8ac, 0xb8ae, 0xb8b5, 0xdfe0, - 0xdfd3, 0xdfce, 0xdfbb, 0xdfba, 0xb8aa, 0xdfac, 0xb8a7, 0xdfc4, - 0xdfad, 0xdfc2, 0xdfb7, 0xdfdb, 0xb8a6, 0xdfb3, 0xdfaf, 0xdfd5, - 0xdfae, 0xbb60, 0xe3d3, 0xe3c2, 0xe3ac, 0xe3ca, 0xbb58, 0xe3bb, - 0xe3c5, 0xbb5b, 0xe3be, 0xbb59, 0xe3af, 0xe3cd, 0xe3ae, 0xe3c1, - 0xe3ad, 0xe3bf, 0xe3c8, 0xe3c6, 0xe3ba, 0xe3b5, 0xe3b3, 0xe3b4, - 0xe3c7, 0xe3d2, 0xe3bc, 0xbb5a, 0xe3b7, 0xe3cb, 0xbb5d, 0xe3b6, - 0xe3b0, 0xe3c0, 0xbb61, 0xbb55, 0xbb5e, 0xe3b8, 0xe3b2, 0xbb57, - 0xdfd4, 0xbb56, 0xe3c3, 0xbb54, 0xbb63, 0xbb5c, 0xe3c4, 0xe3b9, - 0xe3b1, 0xe3cc, 0xe3bd, 0xbb62, 0xe3d0, 0xbb5f, 0xe3cf, 0xe3c9, - 0xe3ce, 0xe3d1, 0xe773, 0xe774, 0xe767, 0xe766, 0xe762, 0xbdb4, - 0xbdac, 0xe776, 0xe775, 0xdfa9, 0xe75f, 0xe763, 0xe75d, 0xe770, - 0xe761, 0xe777, 0xe75a, 0xe758, 0xe764, 0xe76e, 0xe769, 0xbdb6, - 0xe74f, 0xe76d, 0xbdb7, 0xdfbd, 0xe75b, 0xe752, 0xe755, 0xe77b, - 0xe75c, 0xe753, 0xe751, 0xe74e, 0xbdb0, 0xe765, 0xbdaf, 0xbdb3, - 0xe760, 0xe768, 0xbda9, 0xe778, 0xe77c, 0xbdab, 0xe757, 0xe76b, - 0xe76f, 0xe754, 0xe779, 0xbdb2, 0xbdb1, 0xe74c, 0xbdb5, 0xe772, - 0xe756, 0xe76a, 0xe750, 0xe75e, 0xe759, 0xbdad, 0xbdae, 0xe76c, - 0xe77d, 0xe77a, 0xe771, 0xe74d, 0xbdaa, 0xeb49, 0xeb40, 0xeb43, - 0xbfbb, 0xeb45, 0xeaf9, 0xeb41, 0xeb47, 0xbfb8, 0xbfbc, 0xbfb6, - 0xeafb, 0xeb4c, 0xeb46, 0xeafc, 0xeb55, 0xeb4f, 0xeaf8, 0xee46, - 0xeafe, 0xbfb7, 0xeb4a, 0xeb54, 0xbfbf, 0xeb51, 0xeafd, 0xeb44, - 0xeb48, 0xeb42, 0xeb56, 0xeb53, 0xeb50, 0xbfb9, 0xbfba, 0xbfbe, - 0xeafa, 0xeb57, 0xbfbd, 0xeb4d, 0xeb4b, 0xeb4e, 0xee53, 0xee40, - 0xee45, 0xee52, 0xee44, 0xedfb, 0xee41, 0xc1a2, 0xedf4, 0xee4d, - 0xee4f, 0xedf3, 0xc1a1, 0xee51, 0xee49, 0xc1a8, 0xee50, 0xee42, - 0xc1aa, 0xedf9, 0xeb52, 0xee4a, 0xee47, 0xedf5, 0xee55, 0xc1a4, - 0xc1a5, 0xedf7, 0xee48, 0xee54, 0xee4b, 0xedfd, 0xc1a7, 0xc1a3, - 0xee4c, 0xedfe, 0xee56, 0xedf8, 0xee43, 0xee4e, 0xedfa, 0xedfc, - 0xc2cb, 0xedf6, 0xc1a9, 0xc2c4, 0xc17e, 0xc1a6, 0xc2c8, 0xf0b3, - 0xf0a9, 0xf0a4, 0xf0aa, 0xf0b4, 0xf0b8, 0xf0b7, 0xc2ca, 0xc2c9, - 0xf0ab, 0xf0b9, 0xf0ae, 0xf0a6, 0xf0a8, 0xf0a7, 0xf0ad, 0xf0b2, - 0xf0a5, 0xf0ac, 0xf0b1, 0xc2c7, 0xf0af, 0xc2c5, 0xf0b0, 0xc2c3, - 0xc2c6, 0xf2d5, 0xf0b5, 0xc3c2, 0xf2cd, 0xf2d1, 0xf2c9, 0xf2cc, - 0xf2d4, 0xc3c0, 0xf2d9, 0xf2d2, 0xf2ca, 0xf2da, 0xf2d3, 0xc3c3, - 0xc3c4, 0xf2d7, 0xf2cb, 0xc3bf, 0xc3c1, 0xf2c6, 0xf2ce, 0xf2c8, - 0xf2d8, 0xf2d6, 0xf2c7, 0xf2cf, 0xf4be, 0xc3c5, 0xf2d0, 0xc4a7, - 0xc4a9, 0xc4a6, 0xf4c3, 0xf4bb, 0xf4b9, 0xf4bd, 0xf4ba, 0xf4bf, - 0xf4c1, 0xc4aa, 0xc4ac, 0xf4c0, 0xc4ad, 0xc4ab, 0xf4c2, 0xc4a8, - 0xc4f4, 0xf5f1, 0xf5f7, 0xc4f6, 0xf4bc, 0xf5f6, 0xf5fd, 0xf5f4, - 0xf5fb, 0xf5fa, 0xf4b8, 0xf5f5, 0xf0b6, 0xf5fe, 0xf5f3, 0xf5f8, - 0xf5fc, 0xf5f2, 0xf74a, 0xc4f5, 0xf5f9, 0xf7f4, 0xf74b, 0xf749, - 0xf747, 0xf748, 0xf74c, 0xc5d9, 0xf7f2, 0xf7f0, 0xf7f5, 0xf7f3, - 0xf7f6, 0xc5da, 0xf7f1, 0xf8bc, 0xf945, 0xf946, 0xf947, 0xf9c7, - 0xf9bd, 0xca4f, 0xaaea, 0xad68, 0xd3b8, 0xd3b7, 0xb040, 0xb342, - 0xd77c, 0xd77b, 0xb5ea, 0xb8b8, 0xb8b7, 0xb8b9, 0xe3d4, 0xe77e, - 0xeb58, 0xeb5a, 0xeb59, 0xc1ab, 0xee57, 0xf0ba, 0xf9a5, 0xa6e4, - 0xcdc9, 0xcdca, 0xcdc8, 0xcdc7, 0xaaeb, 0xd0a9, 0xd0a7, 0xd0a6, - 0xad69, 0xad6b, 0xad6a, 0xd0a8, 0xd3c4, 0xd3c1, 0xd3bf, 0xb041, - 0xd3c2, 0xb046, 0xd3bc, 0xd3cb, 0xd3cd, 0xd3bd, 0xb043, 0xd3ce, - 0xd3c9, 0xd3bb, 0xd3c0, 0xd3ca, 0xd3c6, 0xd3c3, 0xb048, 0xd3cc, - 0xd3be, 0xd3c7, 0xd3b9, 0xb047, 0xb044, 0xd3c5, 0xd3c8, 0xd3ba, - 0xb045, 0xb042, 0xb34c, 0xd7a5, 0xb34b, 0xd7a8, 0xd7ab, 0xb348, - 0xb346, 0xd77e, 0xd7a9, 0xd7a7, 0xd7a4, 0xd7ac, 0xd7ad, 0xd7af, - 0xd7b0, 0xd77d, 0xb345, 0xd7a2, 0xd7a1, 0xd7ae, 0xb347, 0xd7a3, - 0xb349, 0xb344, 0xd7a6, 0xb34d, 0xb34a, 0xd7aa, 0xb5f1, 0xdbbf, - 0xdbb4, 0xb5ee, 0xdfe7, 0xdbbd, 0xdbb1, 0xb5ec, 0xdbb6, 0xb5ef, - 0xdbba, 0xdbb8, 0xb5f2, 0xb5eb, 0xdbb2, 0xdbb5, 0xb5f0, 0xdbb3, - 0xdbbe, 0xdbbc, 0xdbb7, 0xdbb9, 0xdbbb, 0xb5ed, 0xdfe8, 0xdfee, - 0xdfe4, 0xdfea, 0xb8ba, 0xdfe6, 0xb8c0, 0xb8bf, 0xb8be, 0xdfed, - 0xb8c1, 0xb8c2, 0xdfe3, 0xdff0, 0xb8c3, 0xb8bd, 0xb8bc, 0xdfec, - 0xb8c4, 0xdfe2, 0xdfe5, 0xdfef, 0xdfeb, 0xe3f4, 0xe3e9, 0xb8bb, - 0xbb6a, 0xe3dd, 0xe3f2, 0xe3de, 0xbb65, 0xe3db, 0xe3e4, 0xe3dc, - 0xbb67, 0xe3d6, 0xe3f1, 0xbb68, 0xe3ee, 0xe3ef, 0xe3d7, 0xbb6d, - 0xe3e6, 0xe3e0, 0xe3e7, 0xe3da, 0xe3f3, 0xe3eb, 0xe3e5, 0xe3d5, - 0xbb69, 0xe3ec, 0xbb6c, 0xe3f0, 0xe3ea, 0xbb66, 0xe3e8, 0xe3e2, - 0xbb64, 0xe3d9, 0xe3e1, 0xe3ed, 0xe3df, 0xe3e3, 0xbdc1, 0xdfe9, - 0xe7b2, 0xe7bb, 0xe7b1, 0xe7ad, 0xe7aa, 0xbdc2, 0xe7a8, 0xbb6b, - 0xe7a1, 0xbdc0, 0xe7a7, 0xbdbf, 0xe7ac, 0xe7a9, 0xe7b9, 0xe7b4, - 0xe7ae, 0xe7b3, 0xbdbb, 0xe7ab, 0xe7be, 0xe7a2, 0xe7a3, 0xe7ba, - 0xbdbc, 0xe7bf, 0xbdbe, 0xe7c0, 0xe7b0, 0xe3d8, 0xe7b6, 0xe7af, - 0xe7b8, 0xe7b5, 0xe7a6, 0xbdb9, 0xe7bd, 0xbdba, 0xe7a4, 0xbdbd, - 0xeb64, 0xe7b7, 0xe7bc, 0xeb61, 0xbdb8, 0xbfc0, 0xeb6b, 0xeb67, - 0xeb65, 0xeb60, 0xeb6f, 0xbfc4, 0xeb5c, 0xeb68, 0xeb69, 0xeb5f, - 0xeb5e, 0xeb6c, 0xeb62, 0xeb5d, 0xeb63, 0xeb6e, 0xeb5b, 0xeb6d, - 0xeb6a, 0xbfc2, 0xbfc1, 0xbfc3, 0xeb66, 0xf0cb, 0xee59, 0xc1b1, - 0xee5d, 0xee5a, 0xee61, 0xee67, 0xee5c, 0xee70, 0xc1ae, 0xee6a, - 0xee5f, 0xee6b, 0xee66, 0xee6d, 0xee5e, 0xc1b3, 0xc1b2, 0xee60, - 0xee6e, 0xee58, 0xee6c, 0xc1ac, 0xee64, 0xee63, 0xee68, 0xee5b, - 0xc1b0, 0xc1b4, 0xee62, 0xee69, 0xc1b5, 0xee65, 0xc1ad, 0xc1af, - 0xf0c7, 0xf0c5, 0xf0cc, 0xf0c9, 0xf0cd, 0xf0be, 0xf0c6, 0xf0d1, - 0xee6f, 0xf0c2, 0xc2cf, 0xe7a5, 0xf0bd, 0xf0ca, 0xf0c4, 0xf0c1, - 0xf0bc, 0xf0bb, 0xf0d0, 0xf0c0, 0xf0bf, 0xc2cd, 0xf0c8, 0xc2cc, - 0xc2ce, 0xf0c3, 0xf0cf, 0xf2de, 0xf2df, 0xc3c9, 0xf2dc, 0xc3c6, - 0xf2e4, 0xc3ca, 0xf2e6, 0xf2db, 0xf0ce, 0xf2e8, 0xf2dd, 0xc3c7, - 0xf2e3, 0xf2e5, 0xf2e0, 0xf2e7, 0xf2e2, 0xf2e1, 0xc3c8, 0xf4c5, - 0xf4c6, 0xf4c8, 0xc4ae, 0xc4af, 0xf4c9, 0xf4c7, 0xf4c4, 0xf642, - 0xf645, 0xf641, 0xc4fa, 0xf643, 0xc4f9, 0xc4f8, 0xc4f7, 0xf644, - 0xf751, 0xf74f, 0xf74e, 0xf640, 0xf750, 0xf646, 0xf74d, 0xf7f9, - 0xf7d7, 0xf7f7, 0xc5db, 0xf7f8, 0xf7fa, 0xf8bf, 0xc5fa, 0xf8be, - 0xf8bd, 0xc5fb, 0xc65a, 0xf96e, 0xf9a7, 0xf9a6, 0xf9a8, 0xa6e5, - 0xd0aa, 0xd3cf, 0xd3d0, 0xdbc0, 0xf647, 0xf8c0, 0xa6e6, 0xad6c, - 0xd0ab, 0xd7b1, 0xb34e, 0xdbc2, 0xdbc1, 0xb5f3, 0xb8c5, 0xe7c1, - 0xbdc3, 0xbdc4, 0xbfc5, 0xc5fc, 0xa6e7, 0xd0ac, 0xaaed, 0xd0ae, - 0xd0ad, 0xad6d, 0xd3d1, 0xd3d8, 0xb049, 0xd3d6, 0xd3d4, 0xd3db, - 0xd3d2, 0xd3d3, 0xb04a, 0xb04e, 0xd3dc, 0xb04d, 0xd3da, 0xd3d7, - 0xd3d5, 0xb04b, 0xb04c, 0xd3d9, 0xb350, 0xd7b2, 0xb355, 0xd7c2, - 0xb354, 0xd7c4, 0xd7b8, 0xb352, 0xd7c3, 0xd7b3, 0xb353, 0xd7bf, - 0xd7bb, 0xd7bd, 0xd7b7, 0xd7be, 0xb34f, 0xd7ba, 0xd7b9, 0xd7b5, - 0xd7c0, 0xd7bc, 0xd7b4, 0xd7b6, 0xb351, 0xd7c1, 0xb5f6, 0xdbcd, - 0xdbc9, 0xdbcb, 0xdbc6, 0xdbc5, 0xdbc3, 0xdbca, 0xdbcc, 0xdbc8, - 0xdbc7, 0xb5f4, 0xb5f5, 0xdbcf, 0xb8cd, 0xdff2, 0xdff8, 0xdff3, - 0xdff4, 0xdff9, 0xb8cf, 0xb8c7, 0xb8ce, 0xdff1, 0xdbc4, 0xb8ca, - 0xb8c8, 0xdff7, 0xdff6, 0xb8c9, 0xb8cb, 0xdff5, 0xb8c6, 0xb8cc, - 0xe3f6, 0xbb74, 0xe442, 0xe441, 0xe3fb, 0xbb76, 0xe440, 0xe3f7, - 0xe3f8, 0xbb6e, 0xbb70, 0xe3fd, 0xe3f5, 0xbb72, 0xbb71, 0xe3f9, - 0xe3fe, 0xe3fc, 0xbb73, 0xe3fa, 0xdbce, 0xbb6f, 0xe7c2, 0xe7c9, - 0xbdc6, 0xe7cd, 0xbdca, 0xe7c5, 0xe7c3, 0xe7cc, 0xbdc5, 0xe7cb, - 0xbdc7, 0xbdc8, 0xe7c4, 0xbdc9, 0xe7ca, 0xe7c6, 0xe7c7, 0xe7c8, - 0xbb75, 0xeb70, 0xeb7c, 0xbfca, 0xeb77, 0xeb79, 0xbfc8, 0xeb71, - 0xeb75, 0xeb78, 0xbfc6, 0xbfc9, 0xeb7b, 0xeb73, 0xeb74, 0xeb7a, - 0xeb72, 0xeb76, 0xbfc7, 0xee72, 0xee71, 0xc1b7, 0xee77, 0xc1b9, - 0xc1b6, 0xee73, 0xc1ba, 0xee74, 0xee75, 0xee78, 0xc1b8, 0xf0d6, - 0xf0d9, 0xf0d3, 0xf0d5, 0xf0d4, 0xf0d7, 0xf0d8, 0xee76, 0xf0d2, - 0xc3cd, 0xf2ec, 0xf2ef, 0xf2f1, 0xf2ea, 0xf2eb, 0xf2ee, 0xf2f0, - 0xc3ce, 0xc3cc, 0xc3cb, 0xf2ed, 0xf2e9, 0xf4ca, 0xc4b0, 0xf4cb, - 0xf649, 0xc4fb, 0xf64b, 0xc4fc, 0xf648, 0xf64a, 0xc5a8, 0xf752, - 0xc5a7, 0xf7fd, 0xf7fc, 0xf7fb, 0xf948, 0xf949, 0xf94b, 0xf94a, - 0xca50, 0xa6e8, 0xad6e, 0xd7c5, 0xb5f7, 0xdffa, 0xc2d0, 0xf2f2, - 0xa8a3, 0xb357, 0xb356, 0xdbd0, 0xb5f8, 0xdbd2, 0xdbd1, 0xdffb, - 0xb8d0, 0xe443, 0xe446, 0xe445, 0xe444, 0xe7ce, 0xe7d0, 0xe7cf, - 0xbfcc, 0xbfcb, 0xc1bb, 0xee79, 0xee7b, 0xee7a, 0xc2d1, 0xf2f4, - 0xf2f3, 0xf4cc, 0xc4b1, 0xc4fd, 0xf754, 0xf753, 0xc65b, 0xa8a4, - 0xd0af, 0xad6f, 0xd7c8, 0xd7c6, 0xd7c7, 0xdbd4, 0xdbd5, 0xe043, - 0xdbd3, 0xdffc, 0xe041, 0xe040, 0xe042, 0xb8d1, 0xdffe, 0xdffd, - 0xe044, 0xe449, 0xe447, 0xe448, 0xe7d3, 0xe7d1, 0xe7d2, 0xeb7d, - 0xee7c, 0xee7d, 0xc2d2, 0xf2f5, 0xf4cd, 0xc4b2, 0xf64c, 0xf755, - 0xc5a9, 0xf7fe, 0xf94c, 0xa8a5, 0xad71, 0xad72, 0xd0b0, 0xd0b1, - 0xad70, 0xb054, 0xb052, 0xb051, 0xb058, 0xb050, 0xb059, 0xd3dd, - 0xb056, 0xb053, 0xb057, 0xb055, 0xb04f, 0xb35f, 0xb359, 0xd7cc, - 0xb35e, 0xb360, 0xb35a, 0xb35b, 0xd7ca, 0xb358, 0xd7cb, 0xb35d, - 0xd7c9, 0xb35c, 0xb644, 0xb646, 0xdbd8, 0xb645, 0xb5f9, 0xb5fd, - 0xb8e4, 0xe049, 0xdbda, 0xb5fe, 0xdbdd, 0xdbde, 0xb643, 0xdbe0, - 0xdbe2, 0xdbe3, 0xdbd7, 0xdbd6, 0xdbe4, 0xb642, 0xdbe1, 0xdbdf, - 0xb640, 0xb5fb, 0xb647, 0xdbdb, 0xdbdc, 0xdbd9, 0xb641, 0xb5fc, - 0xb5fa, 0xe048, 0xb8df, 0xb8da, 0xb8d5, 0xb8e5, 0xb8d6, 0xb8d2, - 0xb8e1, 0xb8de, 0xb8e0, 0xb8d7, 0xb8dc, 0xb8d3, 0xb8d4, 0xe050, - 0xe04d, 0xe045, 0xe04a, 0xb8e2, 0xe051, 0xb8e3, 0xb8d9, 0xe047, - 0xe04f, 0xe04b, 0xe04e, 0xe04c, 0xb8dd, 0xe046, 0xb8d8, 0xe44c, - 0xbb78, 0xbb7b, 0xe44e, 0xbba5, 0xe44d, 0xbb7d, 0xbdcf, 0xe44f, - 0xbba4, 0xe44b, 0xbba6, 0xbb79, 0xb8db, 0xbb7c, 0xbb7a, 0xbb7e, - 0xbba2, 0xbb77, 0xbba7, 0xbba3, 0xbba1, 0xe44a, 0xbdd6, 0xbdd2, - 0xbdd9, 0xe7d6, 0xbdda, 0xe7e2, 0xe7db, 0xbdcb, 0xe7e3, 0xe7dd, - 0xbdd5, 0xe7de, 0xbdd4, 0xe7e1, 0xbdce, 0xe7df, 0xe7d5, 0xbdcd, - 0xebaa, 0xbdd3, 0xbdd0, 0xbdd8, 0xe7d4, 0xe7d8, 0xbdcc, 0xe7d7, - 0xe7d9, 0xe7da, 0xbdd7, 0xe7dc, 0xe7e0, 0xe7e4, 0xbddb, 0xbfd2, - 0xeba5, 0xebab, 0xeba8, 0xeb7e, 0xebac, 0xeba1, 0xeba7, 0xbfcd, - 0xbfd3, 0xebad, 0xbfcf, 0xbfd9, 0xbfd4, 0xebaf, 0xeba9, 0xbfd0, - 0xeba2, 0xbfda, 0xeba3, 0xeba4, 0xbfdb, 0xbfd8, 0xbdd1, 0xbfce, - 0xebb0, 0xbfdc, 0xbfd5, 0xebae, 0xbfd1, 0xbfd6, 0xbfd7, 0xc1c3, - 0xeea4, 0xeead, 0xeeaa, 0xeeac, 0xc1c0, 0xeea5, 0xeeab, 0xc1bc, - 0xeea7, 0xc1c4, 0xeea3, 0xeea8, 0xeeaf, 0xeba6, 0xeea9, 0xeea2, - 0xc1bd, 0xeea1, 0xc1be, 0xeeb0, 0xc1bf, 0xeeae, 0xc1c2, 0xee7e, - 0xc1c1, 0xeea6, 0xf0dc, 0xf0ea, 0xf0e5, 0xf0e7, 0xf0db, 0xc2d3, - 0xf0da, 0xc2d6, 0xc2d5, 0xf0e9, 0xf0e1, 0xf0de, 0xf0e4, 0xf0dd, - 0xf0df, 0xf0e8, 0xf0e6, 0xc2d4, 0xf0ed, 0xf0eb, 0xf0e2, 0xf0ec, - 0xf0e3, 0xf2f9, 0xc3cf, 0xf341, 0xf64f, 0xc3d6, 0xf0e0, 0xf2f7, - 0xc3d2, 0xf2f8, 0xf2fd, 0xc3d4, 0xc3d5, 0xf2f6, 0xf340, 0xf342, - 0xf2fa, 0xf2fc, 0xf2fe, 0xf2fb, 0xf343, 0xc3d1, 0xc3d7, 0xc3d3, - 0xc3d0, 0xf4d0, 0xc4b7, 0xf4ce, 0xf4d2, 0xf4d3, 0xc4b5, 0xf4d4, - 0xf4d1, 0xf4cf, 0xc4b8, 0xc4b4, 0xf4d5, 0xc4b6, 0xc4b3, 0xc4fe, - 0xc540, 0xf64e, 0xf64d, 0xf650, 0xf651, 0xc541, 0xf756, 0xf75b, - 0xc5aa, 0xf758, 0xf757, 0xf75a, 0xf759, 0xf843, 0xc5dc, 0xf842, - 0xf840, 0xf841, 0xc5fe, 0xc5fd, 0xf8c1, 0xf8c2, 0xc640, 0xf94d, - 0xf94e, 0xc667, 0xc66d, 0xf9a9, 0xf9c8, 0xa8a6, 0xd7cd, 0xd7ce, - 0xe052, 0xe450, 0xe7e5, 0xc1c6, 0xc1c5, 0xf0ee, 0xf344, 0xf844, - 0xa8a7, 0xd3de, 0xb05a, 0xb361, 0xe054, 0xe053, 0xbddc, 0xe7e6, - 0xbddd, 0xeeb1, 0xc2d7, 0xc676, 0xa8a8, 0xcdcb, 0xd3df, 0xb362, - 0xd7cf, 0xd7d0, 0xdbe5, 0xb648, 0xb8e6, 0xe056, 0xe055, 0xe057, - 0xe451, 0xe452, 0xbba8, 0xbfdd, 0xbdde, 0xbfde, 0xeeb5, 0xeeb2, - 0xeeb4, 0xeeb3, 0xc1c7, 0xf0ef, 0xf346, 0xf345, 0xcba4, 0xb05c, - 0xb05b, 0xd3e0, 0xd7d1, 0xdbe7, 0xdbe6, 0xb649, 0xe059, 0xe05a, - 0xe058, 0xb8e8, 0xb8e7, 0xbbaa, 0xbba9, 0xe7e7, 0xebb3, 0xebb1, - 0xebb2, 0xbfdf, 0xeeb7, 0xeeb6, 0xf0f2, 0xf0f1, 0xf0f0, 0xf347, - 0xf9aa, 0xa8a9, 0xad73, 0xad74, 0xb05d, 0xb05e, 0xd3e2, 0xd3e1, - 0xd7d2, 0xb368, 0xb366, 0xb363, 0xb367, 0xb365, 0xb364, 0xb64a, - 0xdbea, 0xb8ed, 0xb64c, 0xb651, 0xdbec, 0xb653, 0xb652, 0xb655, - 0xdbeb, 0xdbe8, 0xb64f, 0xb64b, 0xb64d, 0xdbe9, 0xb654, 0xb650, - 0xb64e, 0xb8ef, 0xb8ee, 0xb8ec, 0xb8f0, 0xb8ea, 0xb8eb, 0xb8e9, - 0xe05b, 0xe454, 0xbbac, 0xbbad, 0xbbab, 0xe453, 0xe455, 0xe7ea, - 0xe7ec, 0xbde7, 0xe7ed, 0xbde0, 0xe7e9, 0xbddf, 0xbde9, 0xbde5, - 0xbde6, 0xbde2, 0xe7e8, 0xbde1, 0xe7ee, 0xe7eb, 0xbde8, 0xbde3, - 0xbde4, 0xebb5, 0xebb7, 0xebb6, 0xebb8, 0xbfe0, 0xebb4, 0xc1cb, - 0xeeb8, 0xc1c8, 0xc1cc, 0xc1ca, 0xc1c9, 0xf0f3, 0xf0f6, 0xf0f5, - 0xf0f4, 0xc2d8, 0xf348, 0xf349, 0xc3d8, 0xf34a, 0xc3d9, 0xc4ba, - 0xc4b9, 0xf652, 0xc542, 0xf653, 0xf75c, 0xc5ab, 0xc5ac, 0xf845, - 0xc642, 0xa8aa, 0xb36a, 0xb369, 0xe05c, 0xe05d, 0xbbae, 0xebb9, - 0xbdea, 0xebba, 0xeeb9, 0xa8ab, 0xd0b2, 0xad76, 0xad75, 0xd3e3, - 0xb05f, 0xd3e4, 0xd7d5, 0xd7d4, 0xd7d3, 0xdbee, 0xb658, 0xdbed, - 0xb657, 0xdbef, 0xb656, 0xe05f, 0xe062, 0xe060, 0xe061, 0xe065, - 0xe05e, 0xe066, 0xe063, 0xe064, 0xbbb0, 0xe456, 0xbbaf, 0xe7f2, - 0xe7f0, 0xbdeb, 0xe7ef, 0xe7f1, 0xbdec, 0xebbb, 0xebbc, 0xc1cd, - 0xf34c, 0xf34e, 0xf34b, 0xf34d, 0xf4d6, 0xf654, 0xf96f, 0xa8ac, - 0xad77, 0xd3e5, 0xd3e7, 0xd3e6, 0xd7d8, 0xb36c, 0xd7d6, 0xb36b, - 0xd7d9, 0xd7da, 0xd7d7, 0xdbfb, 0xb660, 0xdbf3, 0xdbf9, 0xb65b, - 0xb65e, 0xdbf2, 0xb659, 0xdbf6, 0xe06c, 0xb65d, 0xdbf1, 0xdbf7, - 0xdbf4, 0xdbfa, 0xdbf0, 0xdbf8, 0xb65c, 0xb65f, 0xdbf5, 0xb65a, - 0xb8f2, 0xe068, 0xb8f1, 0xe06f, 0xe06e, 0xb8f8, 0xb8f9, 0xe070, - 0xb8f3, 0xe06d, 0xb8f7, 0xe072, 0xe069, 0xe06b, 0xb8f4, 0xe067, - 0xe06a, 0xe071, 0xb8f5, 0xe073, 0xb8f6, 0xbbb1, 0xe45b, 0xe461, - 0xe459, 0xe462, 0xe458, 0xe45d, 0xe463, 0xe460, 0xe45f, 0xe45e, - 0xe457, 0xe45c, 0xe45a, 0xbdf1, 0xbdee, 0xe7fb, 0xe841, 0xe843, - 0xe840, 0xe7f8, 0xe7fa, 0xe845, 0xe842, 0xe7fc, 0xe846, 0xe7f9, - 0xe844, 0xbdef, 0xbdf5, 0xbdf3, 0xe7f3, 0xbdf4, 0xbdf0, 0xe7f4, - 0xe7f6, 0xe7f5, 0xe7fd, 0xe7fe, 0xbdf2, 0xbded, 0xe7f7, 0xebc6, - 0xbfe2, 0xebbd, 0xbfe3, 0xbfe6, 0xebc2, 0xebbf, 0xbfe5, 0xebc3, - 0xebc4, 0xebbe, 0xebc7, 0xebc0, 0xebc5, 0xbfe4, 0xbfe1, 0xebc1, - 0xeebf, 0xc1d0, 0xc1ce, 0xc1d1, 0xc1cf, 0xeebe, 0xeebb, 0xeeba, - 0xeebd, 0xeebc, 0xf145, 0xc2de, 0xf0fb, 0xf0fa, 0xc2d9, 0xf141, - 0xf140, 0xf0f7, 0xf143, 0xf0fc, 0xc2dd, 0xf0f9, 0xf142, 0xf0f8, - 0xc2da, 0xc2dc, 0xf0fd, 0xc2db, 0xf0fe, 0xf144, 0xf352, 0xc3de, - 0xf34f, 0xf353, 0xc3db, 0xf351, 0xc3e0, 0xc3dd, 0xf350, 0xc3df, - 0xf354, 0xc3da, 0xc4bc, 0xc4be, 0xf4d9, 0xc4bd, 0xf4d7, 0xc3dc, - 0xf4d8, 0xc4bb, 0xc543, 0xc545, 0xf656, 0xc544, 0xf655, 0xf761, - 0xc5ad, 0xf760, 0xc5ae, 0xf75e, 0xf75d, 0xf762, 0xf763, 0xf846, - 0xf75f, 0xf8c6, 0xf8c3, 0xf8c4, 0xf8c5, 0xc65c, 0xf951, 0xf950, - 0xf94f, 0xf970, 0xf9be, 0xf9ab, 0xc66e, 0xa8ad, 0xb060, 0xb8fa, - 0xbdf6, 0xebc8, 0xc2df, 0xf355, 0xf9ac, 0xa8ae, 0xaaee, 0xad79, - 0xad78, 0xb063, 0xd3e8, 0xb061, 0xd3e9, 0xb062, 0xd7df, 0xd7db, - 0xb36d, 0xd7de, 0xd7dd, 0xd7dc, 0xb36e, 0xd7e0, 0xd7e1, 0xdc43, - 0xdc41, 0xdc45, 0xdc46, 0xdc4c, 0xdc48, 0xdc4a, 0xdc42, 0xdbfc, - 0xdc49, 0xdc4b, 0xdc44, 0xdc47, 0xdbfd, 0xb662, 0xdc40, 0xdbfe, - 0xb661, 0xb663, 0xb8fd, 0xe075, 0xe077, 0xe076, 0xe07b, 0xb8fb, - 0xe078, 0xe074, 0xe079, 0xe07a, 0xb8fc, 0xb8fe, 0xe07c, 0xe467, - 0xe466, 0xe464, 0xe465, 0xbbb3, 0xbbb5, 0xbbb2, 0xbbb4, 0xe84d, - 0xe84e, 0xe849, 0xe84a, 0xbdf8, 0xbdfd, 0xbdf7, 0xbdfe, 0xbdf9, - 0xe84b, 0xe84c, 0xe848, 0xbe40, 0xbdfb, 0xbdfa, 0xbdfc, 0xe847, - 0xebca, 0xbfe8, 0xebcc, 0xbfea, 0xebcf, 0xebcb, 0xebc9, 0xebce, - 0xbfe9, 0xebcd, 0xbfe7, 0xc1d3, 0xc1d6, 0xeec1, 0xc1d4, 0xeec0, - 0xc1d2, 0xc1d5, 0xf146, 0xf147, 0xf148, 0xc2e0, 0xf149, 0xc2e1, - 0xc3e2, 0xf358, 0xf359, 0xf357, 0xf356, 0xf35a, 0xc3e1, 0xf4dd, - 0xf4db, 0xf4dc, 0xf4de, 0xf4da, 0xf4df, 0xf658, 0xf659, 0xf657, - 0xc546, 0xf764, 0xc5af, 0xf765, 0xf848, 0xf847, 0xa8af, 0xb664, - 0xb940, 0xbbb6, 0xbfec, 0xbfeb, 0xc3e3, 0xc47c, 0xc547, 0xa8b0, - 0xb064, 0xb941, 0xf35b, 0xcba6, 0xa8b1, 0xa8b4, 0xa8b3, 0xa8b2, - 0xcba5, 0xcdcd, 0xcdcf, 0xaaef, 0xaaf1, 0xcdcc, 0xcdce, 0xaaf0, - 0xcdd1, 0xcdd0, 0xcdd2, 0xd0b6, 0xd0b4, 0xad7c, 0xd0b3, 0xada3, - 0xad7e, 0xad7b, 0xada4, 0xad7d, 0xada2, 0xada1, 0xd0b5, 0xad7a, - 0xb06a, 0xd3eb, 0xd3f1, 0xb067, 0xb06e, 0xb069, 0xd3ee, 0xd3f0, - 0xb06c, 0xd3ea, 0xd3ed, 0xb068, 0xb065, 0xd3ec, 0xb06b, 0xd3ef, - 0xb06d, 0xb066, 0xd7e3, 0xd7e6, 0xb370, 0xb37a, 0xb376, 0xd7e4, - 0xb37e, 0xb377, 0xb37c, 0xb372, 0xb36f, 0xb371, 0xb37d, 0xd7e5, - 0xb375, 0xb378, 0xb374, 0xb379, 0xd7e7, 0xb37b, 0xb373, 0xd7e2, - 0xdc4d, 0xb665, 0xdc4f, 0xb667, 0xb669, 0xdc4e, 0xb666, 0xb66a, - 0xb668, 0xb947, 0xe0a3, 0xb94f, 0xe07e, 0xb950, 0xb945, 0xe0a1, - 0xb94a, 0xe0a2, 0xb943, 0xb942, 0xb94d, 0xb94c, 0xb94b, 0xb949, - 0xb94e, 0xe07d, 0xb944, 0xb946, 0xb948, 0xbbb8, 0xbbbb, 0xbbbf, - 0xbbb9, 0xbbbe, 0xbbbc, 0xbbb7, 0xbbbd, 0xbbba, 0xe852, 0xbe43, - 0xbe41, 0xe853, 0xbe44, 0xbe42, 0xe851, 0xe850, 0xbff0, 0xe84f, - 0xbfee, 0xbfed, 0xebd0, 0xbe45, 0xbfef, 0xebd1, 0xbff2, 0xebd2, - 0xbff1, 0xc1d8, 0xeec3, 0xc1d7, 0xc1dc, 0xc1da, 0xc1db, 0xc2e3, - 0xc1d9, 0xeec2, 0xebd3, 0xc2e2, 0xc2e4, 0xc3e4, 0xc3e5, 0xf4e0, - 0xc5de, 0xc5dd, 0xa8b6, 0xca55, 0xb06f, 0xca52, 0xca53, 0xca51, - 0xca54, 0xcbaa, 0xcba7, 0xcbac, 0xcba8, 0xa8b7, 0xa8ba, 0xcba9, - 0xa8b9, 0xcbab, 0xa8b8, 0xcdd5, 0xcdd7, 0xaaf4, 0xcdd3, 0xcdd6, - 0xcdd4, 0xaaf2, 0xaaf5, 0xaaf3, 0xd0b8, 0xd0bc, 0xd0b9, 0xada7, - 0xada8, 0xd0bb, 0xd0bd, 0xd0bf, 0xada5, 0xd0be, 0xada6, 0xd7ee, - 0xd0ba, 0xd3f2, 0xd3fb, 0xd3f9, 0xd3f4, 0xd3f5, 0xd3fa, 0xd3fc, - 0xb071, 0xd3f7, 0xd3f3, 0xb070, 0xb072, 0xd3f6, 0xd3fd, 0xd3f8, - 0xb3a1, 0xd7f1, 0xd7e9, 0xd7ef, 0xd7f0, 0xb3a2, 0xd7e8, 0xd7ea, - 0xd0b7, 0xd7ec, 0xd7ed, 0xd7eb, 0xb66c, 0xdc56, 0xebd4, 0xdc57, - 0xdc54, 0xb3a3, 0xb66e, 0xdc53, 0xdc59, 0xdc58, 0xb66b, 0xdc5c, - 0xdc52, 0xdc5b, 0xdc50, 0xdc5a, 0xdc55, 0xb66d, 0xe0aa, 0xe0a5, - 0xe0ab, 0xe0a6, 0xe0a4, 0xe0a7, 0xb951, 0xe0a9, 0xe0a8, 0xb952, - 0xbbc1, 0xbbc0, 0xe46e, 0xe471, 0xe469, 0xe46d, 0xbbc2, 0xe46c, - 0xe46a, 0xe470, 0xe46b, 0xe468, 0xe46f, 0xe859, 0xbe48, 0xf14a, - 0xe856, 0xe857, 0xe855, 0xdc51, 0xbe47, 0xe85a, 0xe854, 0xbe46, - 0xbe49, 0xe858, 0xebd5, 0xbff3, 0xebd6, 0xebd7, 0xeec4, 0xc1dd, - 0xf14b, 0xf14c, 0xf14d, 0xf35d, 0xf35c, 0xf4e2, 0xf4e1, 0xf65b, - 0xf65c, 0xf65a, 0xf766, 0xc5b0, 0xa8bb, 0xadaa, 0xada9, 0xb075, - 0xb074, 0xd440, 0xd441, 0xd3fe, 0xb073, 0xd7f5, 0xd7f6, 0xd7f2, - 0xb3a4, 0xd7f3, 0xd7f4, 0xdc5f, 0xdc61, 0xdc5d, 0xdc60, 0xb66f, - 0xdc5e, 0xb670, 0xdd73, 0xb955, 0xb954, 0xb953, 0xe0ac, 0xe0ad, - 0xe473, 0xe475, 0xbbc6, 0xbbc3, 0xbbc5, 0xbbc4, 0xe474, 0xe472, - 0xe861, 0xe85e, 0xe85f, 0xbe4d, 0xe860, 0xe85b, 0xe85c, 0xbe4a, - 0xbe4b, 0xe85d, 0xbe4c, 0xebdb, 0xebdc, 0xebd9, 0xebda, 0xbff4, - 0xebd8, 0xeec8, 0xeec5, 0xeec7, 0xc1e0, 0xeecb, 0xc1df, 0xeec9, - 0xeecc, 0xeeca, 0xeec6, 0xc1de, 0xf14f, 0xf150, 0xf14e, 0xf152, - 0xc2e5, 0xc2e6, 0xf35f, 0xc3e7, 0xf151, 0xf35e, 0xc3e6, 0xf4e5, - 0xf4e6, 0xc4bf, 0xf4e4, 0xf4e3, 0xf65d, 0xc548, 0xf849, 0xf8c8, - 0xf8c7, 0xc643, 0xc65d, 0xf8c9, 0xf971, 0xc66f, 0xa8bc, 0xaaf6, - 0xb956, 0xc4c0, 0xa8bd, 0xadab, 0xb3a5, 0xb671, 0xc2e7, 0xaaf7, - 0xd0c1, 0xd0c0, 0xd442, 0xb078, 0xb076, 0xb07a, 0xd444, 0xb079, - 0xb077, 0xd443, 0xb3a8, 0xd7fc, 0xb3a7, 0xb3a9, 0xd842, 0xb3ab, - 0xd7fe, 0xd840, 0xd7f7, 0xb3aa, 0xd843, 0xd7f9, 0xd7fa, 0xd7f8, - 0xb3a6, 0xd841, 0xd7fb, 0xd7fd, 0xdc6d, 0xdc6c, 0xdc6a, 0xdc62, - 0xdc71, 0xdc65, 0xdc6f, 0xdc76, 0xdc6e, 0xb679, 0xb675, 0xdc63, - 0xdc69, 0xb677, 0xdc68, 0xb678, 0xb67a, 0xdc6b, 0xb672, 0xb673, - 0xdc77, 0xdc75, 0xdc74, 0xdc66, 0xdc72, 0xb676, 0xb674, 0xdc73, - 0xdc64, 0xdc67, 0xdc70, 0xe4ba, 0xe0b7, 0xe0b0, 0xe0c3, 0xe0cc, - 0xe0b3, 0xb961, 0xe0c0, 0xb957, 0xb959, 0xb965, 0xe0b1, 0xb95a, - 0xb95c, 0xb966, 0xb95b, 0xb964, 0xe0b9, 0xe0ae, 0xb962, 0xe0b8, - 0xb95e, 0xe0ca, 0xb963, 0xe0c8, 0xe0bc, 0xe0c6, 0xb960, 0xe0af, - 0xe0c9, 0xe0c4, 0xe0cb, 0xb958, 0xb967, 0xb95d, 0xe0b5, 0xe0bd, - 0xe0c1, 0xe0c5, 0xb95f, 0xe0b4, 0xe0b2, 0xe0be, 0xe0bb, 0xe0ba, - 0xe0bf, 0xe0c2, 0xe0c7, 0xe478, 0xbbc7, 0xe4a4, 0xe47a, 0xbbcc, - 0xbbd0, 0xe4ad, 0xe4b5, 0xe4a6, 0xbbc8, 0xe4aa, 0xe0b6, 0xbbc9, - 0xe4b1, 0xe4b6, 0xe4ae, 0xe4b0, 0xe4b9, 0xe4b2, 0xe47e, 0xe4a9, - 0xbbd1, 0xbbcd, 0xe47c, 0xe4ab, 0xbbcb, 0xe4a5, 0xbbca, 0xe4b3, - 0xe4a2, 0xe479, 0xbbce, 0xe4b8, 0xe47b, 0xe4af, 0xe4ac, 0xe4a7, - 0xe477, 0xe476, 0xe4a1, 0xe4b4, 0xbbcf, 0xe4b7, 0xe47d, 0xe4a3, - 0xbe52, 0xbe5a, 0xbe55, 0xe8a4, 0xe8a1, 0xe867, 0xbe50, 0xbe4f, - 0xbe56, 0xe865, 0xbe54, 0xe871, 0xe863, 0xe864, 0xbe4e, 0xe8a3, - 0xbe58, 0xe874, 0xe879, 0xe873, 0xebee, 0xe86f, 0xe877, 0xe875, - 0xe868, 0xe862, 0xe87d, 0xbe57, 0xe87e, 0xe878, 0xe86d, 0xe86b, - 0xe866, 0xe86e, 0xe87b, 0xe86a, 0xe87a, 0xe8a2, 0xbe53, 0xe876, - 0xe87c, 0xe872, 0xe86c, 0xbe51, 0xe4a8, 0xe870, 0xbe59, 0xe869, - 0xebf4, 0xbff7, 0xebf3, 0xebf0, 0xec44, 0xbffb, 0xec41, 0xebf8, - 0xec43, 0xebe9, 0xebf6, 0xbffd, 0xebe1, 0xebdf, 0xec42, 0xec40, - 0xebfe, 0xebed, 0xebec, 0xebe2, 0xc040, 0xebe8, 0xebf2, 0xebfd, - 0xc043, 0xec45, 0xc1e8, 0xc045, 0xbffe, 0xebe6, 0xebef, 0xebde, - 0xebe0, 0xbff5, 0xc042, 0xbffa, 0xebe7, 0xebf7, 0xebf1, 0xc041, - 0xebdd, 0xc1e3, 0xebf9, 0xebfc, 0xbffc, 0xebeb, 0xc044, 0xbff9, - 0xbff8, 0xebf5, 0xebfb, 0xbff6, 0xebe4, 0xebfa, 0xebe5, 0xebea, - 0xeed2, 0xeed7, 0xc1e5, 0xc1e7, 0xeedd, 0xc1e1, 0xeeec, 0xeee3, - 0xeed8, 0xeed9, 0xeee2, 0xc1ee, 0xeee1, 0xeed1, 0xeee0, 0xeed4, - 0xeeed, 0xc1ed, 0xc1eb, 0xeed5, 0xeee8, 0xeeda, 0xeee7, 0xeee9, - 0xeed0, 0xc1e6, 0xeeea, 0xeede, 0xc1ea, 0xeedb, 0xc1ec, 0xeee4, - 0xc1e4, 0xeed6, 0xeee5, 0xeedf, 0xebe3, 0xeee6, 0xeed3, 0xc1e9, - 0xeeeb, 0xc1e2, 0xeece, 0xf160, 0xf159, 0xc2e9, 0xf154, 0xf163, - 0xf15b, 0xeedc, 0xf165, 0xf155, 0xc2e8, 0xf15f, 0xc2ea, 0xc2f2, - 0xc2f0, 0xf161, 0xc2f1, 0xf157, 0xf158, 0xf15d, 0xf162, 0xeecd, - 0xc2eb, 0xf16a, 0xf167, 0xf16b, 0xf15e, 0xf15a, 0xf168, 0xf36a, - 0xf15c, 0xc2ee, 0xc2ed, 0xeecf, 0xc2ef, 0xf164, 0xf166, 0xc2ec, - 0xf169, 0xf153, 0xf156, 0xf373, 0xf363, 0xc3eb, 0xf371, 0xf361, - 0xc3ec, 0xf36c, 0xf368, 0xc3f1, 0xf372, 0xf362, 0xf365, 0xc3e9, - 0xf374, 0xf36d, 0xf370, 0xc3ef, 0xc3f4, 0xc3f2, 0xf369, 0xf364, - 0xc3ed, 0xc3ee, 0xf360, 0xc3ea, 0xc3e8, 0xc3f0, 0xf36f, 0xc3f3, - 0xf36b, 0xf375, 0xc3f5, 0xf367, 0xf36e, 0xf4f3, 0xf542, 0xf4f5, - 0xf4fc, 0xf366, 0xf4fa, 0xf4e9, 0xf540, 0xc4c3, 0xf4ed, 0xf4fe, - 0xf4f4, 0xc4c2, 0xf544, 0xf4f6, 0xf4fb, 0xf4fd, 0xf4e7, 0xf541, - 0xf4f2, 0xf4f7, 0xf4eb, 0xf4ef, 0xf543, 0xf4f9, 0xf4e8, 0xf4ec, - 0xf4ee, 0xf4f8, 0xc4c1, 0xf4f1, 0xf4ea, 0xf4f0, 0xf661, 0xf666, - 0xc54f, 0xf668, 0xc549, 0xf664, 0xf66a, 0xc54e, 0xc54a, 0xc54b, - 0xf660, 0xf667, 0xc54d, 0xf665, 0xc54c, 0xf65f, 0xf663, 0xf662, - 0xf65e, 0xf669, 0xc5b1, 0xf76d, 0xf770, 0xf76c, 0xf76e, 0xf76f, - 0xf769, 0xf76a, 0xf767, 0xf76b, 0xf768, 0xc5b2, 0xc5b3, 0xf84b, - 0xf84d, 0xf84c, 0xf84e, 0xc5e0, 0xf84a, 0xc5df, 0xc5e1, 0xf8cb, - 0xf8cc, 0xc644, 0xf8ca, 0xf953, 0xf952, 0xf954, 0xc65f, 0xf955, - 0xc65e, 0xf956, 0xf972, 0xf975, 0xf974, 0xc668, 0xf973, 0xc672, - 0xc670, 0xc671, 0xc677, 0xf9c0, 0xf9c1, 0xf9bf, 0xf9c9, 0xaaf8, - 0xd844, 0xdc78, 0xe8a5, 0xf376, 0xaaf9, 0xadac, 0xb07b, 0xd845, - 0xd846, 0xb3ac, 0xb67d, 0xdc7a, 0xdc79, 0xb6a3, 0xb67c, 0xdc7b, - 0xb67e, 0xb6a2, 0xb6a1, 0xb67b, 0xb968, 0xe0d0, 0xe0ce, 0xe0cf, - 0xe0cd, 0xbbd2, 0xbbd5, 0xbbd7, 0xbbd6, 0xbbd3, 0xbbd4, 0xe8a7, - 0xe8a6, 0xbe5b, 0xe8a8, 0xe8a9, 0xbe5c, 0xec4d, 0xec4b, 0xeef3, - 0xec49, 0xec4a, 0xc046, 0xec46, 0xec4e, 0xec48, 0xec4c, 0xeeef, - 0xeef1, 0xeef2, 0xc1f3, 0xeeee, 0xc1f2, 0xeef0, 0xc1ef, 0xc1f0, - 0xc1f1, 0xec47, 0xc2f5, 0xf16e, 0xf16c, 0xf16d, 0xc2f3, 0xc2f6, - 0xc2f4, 0xf377, 0xf378, 0xc3f6, 0xf545, 0xf547, 0xf546, 0xc4c4, - 0xc550, 0xf66d, 0xf66c, 0xf66b, 0xaafa, 0xc9aa, 0xca58, 0xa6e9, - 0xca56, 0xca59, 0xca57, 0xcbae, 0xa8c1, 0xa8c2, 0xcbb0, 0xa8bf, - 0xcbaf, 0xcbad, 0xa8c0, 0xa8be, 0xcdd8, 0xcddb, 0xaafd, 0xcdda, - 0xcdd9, 0xaafc, 0xaafb, 0xab40, 0xcddc, 0xaafe, 0xd0c6, 0xadae, - 0xadaf, 0xadb0, 0xd0c7, 0xd0c3, 0xadad, 0xd0c4, 0xd0c5, 0xd0c2, - 0xb0a4, 0xb0a1, 0xd445, 0xb0a2, 0xb0a5, 0xd446, 0xb07e, 0xb07c, - 0xb07d, 0xb0a3, 0xb3ad, 0xd849, 0xb3b5, 0xd848, 0xd84b, 0xb3b1, - 0xd84a, 0xb6ab, 0xb3af, 0xb3b2, 0xb3ae, 0xb3b3, 0xb3b4, 0xb3b0, - 0xd847, 0xb6a7, 0xdc7d, 0xdca3, 0xdca2, 0xb6ac, 0xb6a8, 0xb6a9, - 0xdc7c, 0xdc7e, 0xdca1, 0xb6a4, 0xb6a6, 0xb6aa, 0xb6a5, 0xe0d3, - 0xe0d1, 0xe0d2, 0xb96a, 0xb96b, 0xe0d4, 0xb969, 0xbbd8, 0xbbda, - 0xbbd9, 0xe4bb, 0xe4bc, 0xe8ab, 0xe8aa, 0xc047, 0xc048, 0xec4f, - 0xc049, 0xeef6, 0xeef4, 0xeef5, 0xc1f4, 0xf16f, 0xc3f7, 0xc1f5, - 0xab41, 0xb0a6, 0xd447, 0xd84c, 0xb3b6, 0xb6ad, 0xdca4, 0xdca6, - 0xb6af, 0xb6ae, 0xb6b0, 0xb6b1, 0xdca5, 0xb96e, 0xb96f, 0xb96d, - 0xbbdb, 0xb96c, 0xe0d5, 0xbbdc, 0xe8ac, 0xec50, 0xc04a, 0xc1f6, - 0xf170, 0xf174, 0xc2f9, 0xf171, 0xc2fa, 0xc2f8, 0xf175, 0xc2fb, - 0xf173, 0xf379, 0xc2f7, 0xc3f8, 0xf8cd, 0xab42, 0xb3b8, 0xb3b7, - 0xb6b2, 0xdca8, 0xdca7, 0xb6b3, 0xe0d9, 0xb973, 0xb970, 0xe0d8, - 0xb972, 0xe0d6, 0xb971, 0xe0d7, 0xe4bd, 0xbbdd, 0xe8af, 0xbe5d, - 0xe8ad, 0xbe5e, 0xbe5f, 0xe8ae, 0xbe60, 0xec51, 0xc04e, 0xc04b, - 0xc050, 0xec53, 0xc04c, 0xec52, 0xc04f, 0xc04d, 0xeef9, 0xeefb, - 0xc1f7, 0xeefa, 0xc1f8, 0xeef8, 0xeef7, 0xf177, 0xf176, 0xc2fc, - 0xf178, 0xf37e, 0xc3fa, 0xf37d, 0xf37a, 0xc3f9, 0xf37b, 0xf37c, - 0xf548, 0xf549, 0xc4c5, 0xc553, 0xf66e, 0xc551, 0xc552, 0xf66f, - 0xc5b4, 0xc5b5, 0xf771, 0xc645, 0xf8cf, 0xc647, 0xf8ce, 0xf8d0, - 0xc646, 0xf957, 0xf9ad, 0xab43, 0xb974, 0xe4be, 0xe8b0, 0xc051, - 0xc052, 0xab44, 0xbe61, 0xc3fb, 0xadb1, 0xc053, 0xc5e2, 0xadb2, - 0xd84d, 0xdca9, 0xdcab, 0xdcaa, 0xe0dd, 0xe0da, 0xb975, 0xb976, - 0xe0db, 0xe0dc, 0xe4c0, 0xe4c5, 0xbbde, 0xe4bf, 0xe4c1, 0xe4c8, - 0xe4c3, 0xe4c7, 0xe4c4, 0xe4c2, 0xe4c6, 0xbbdf, 0xe8b3, 0xe8b1, - 0xbe63, 0xbe62, 0xe8b2, 0xbe64, 0xec56, 0xec55, 0xc054, 0xec54, - 0xeefc, 0xeefe, 0xef41, 0xef40, 0xc1f9, 0xeefd, 0xf1a1, 0xc2fd, - 0xf17d, 0xf1a2, 0xc2fe, 0xf17b, 0xf17e, 0xf17c, 0xf179, 0xc340, - 0xf17a, 0xf3a1, 0xf3a3, 0xf3a2, 0xf54a, 0xf54b, 0xf670, 0xc5b7, - 0xc5b6, 0xf84f, 0xf850, 0xc648, 0xf8d1, 0xc669, 0xadb3, 0xb6b4, - 0xe4ca, 0xe4c9, 0xe8b5, 0xe8b4, 0xc1fa, 0xef43, 0xef42, 0xf1a5, - 0xf1a3, 0xf1a6, 0xf1a4, 0xc3fc, 0xf3a4, 0xf3a5, 0xf3a6, 0xf671, - 0xf772, 0xf8d2, 0xadb4, 0xec57, 0xef44, 0xadb5, 0xbbe0, 0xec58, - 0xc341, 0xf1a7, 0xc3fd, 0xf54c, 0xf54d, 0xc554, 0xf851, 0xadb6, - 0xb3bb, 0xb3bc, 0xd84e, 0xb6b5, 0xb6b6, 0xdcac, 0xb6b7, 0xb97a, - 0xb97c, 0xe0df, 0xe0e0, 0xe0de, 0xb977, 0xb978, 0xb97b, 0xb979, - 0xe4cb, 0xbbe1, 0xbbe2, 0xe8bc, 0xbe67, 0xe8b7, 0xe8b6, 0xe8bb, - 0xbe65, 0xc05b, 0xe8b8, 0xe8bd, 0xe8ba, 0xe8b9, 0xbe66, 0xc059, - 0xec5a, 0xc055, 0xec5b, 0xec59, 0xc058, 0xc056, 0xc05a, 0xc057, - 0xef45, 0xef4a, 0xef46, 0xef49, 0xc1fb, 0xedd4, 0xef48, 0xef47, - 0xc344, 0xc342, 0xc345, 0xc343, 0xf1a8, 0xf1a9, 0xf1aa, 0xc346, - 0xf3aa, 0xc440, 0xf3a8, 0xc441, 0xf3a7, 0xf3a9, 0xc3fe, 0xf551, - 0xf54e, 0xf54f, 0xf550, 0xf672, 0xc556, 0xc555, 0xf774, 0xf773, - 0xc5b8, 0xc5e3, 0xc649, 0xc660, 0xf958, 0xf9ae, 0xf9af, 0xadb7, - 0xdcad, 0xe0e1, 0xe4cc, 0xe4cd, 0xbbe3, 0xbbe4, 0xe8be, 0xbe68, - 0xc1fc, 0xf1ab, 0xc347, 0xf3ad, 0xc442, 0xf3ac, 0xf3ae, 0xf3ab, - 0xf675, 0xf552, 0xf553, 0xc4c6, 0xf674, 0xf673, 0xf775, 0xf9b0, - 0xadb8, 0xadb9, 0xb0a7, 0xd448, 0xd84f, 0xb6b8, 0xb6bb, 0xb6b9, - 0xdcae, 0xb6bd, 0xb6ba, 0xb6bc, 0xb97e, 0xe0e2, 0xe0e3, 0xe8c0, - 0xb97d, 0xb9a1, 0xb9a2, 0xe4cf, 0xe4ce, 0xbbe5, 0xbbe6, 0xe4d0, - 0xe8bf, 0xbbe8, 0xbe69, 0xbbe7, 0xc05c, 0xe8c1, 0xbe6b, 0xbe6a, - 0xe8c2, 0xe8c5, 0xe8c3, 0xe8c4, 0xbe6c, 0xc061, 0xc05f, 0xc05e, - 0xec5d, 0xc060, 0xec5c, 0xef4b, 0xec5e, 0xc05d, 0xec5f, 0xef4e, - 0xef4c, 0xef4d, 0xef52, 0xc34b, 0xef51, 0xef54, 0xef53, 0xef50, - 0xef4f, 0xc1fd, 0xf1ae, 0xf1ad, 0xc34a, 0xc348, 0xc349, 0xf1ac, - 0xf3b1, 0xc443, 0xf3b0, 0xf3af, 0xc444, 0xf558, 0xf557, 0xf555, - 0xf554, 0xc4c8, 0xc4c7, 0xf559, 0xf776, 0xc5b9, 0xf677, 0xc557, - 0xf676, 0xf556, 0xf777, 0xc5e4, 0xc661, 0xf959, 0xf9b1, 0xadba, - 0xd850, 0xef55, 0xadbb, 0xe4d2, 0xe4d1, 0xec60, 0xef57, 0xef56, - 0xc34c, 0xf3b2, 0xf3b3, 0xc4c9, 0xf9b2, 0xb0a8, 0xb6bf, 0xb6be, - 0xe0e4, 0xe0e6, 0xb9a4, 0xe0e5, 0xb9a3, 0xb9a5, 0xe0e7, 0xe4d4, - 0xe4d6, 0xe4d5, 0xe4d8, 0xbbe9, 0xe4d7, 0xe4d3, 0xe4d9, 0xe8cc, - 0xe8cf, 0xe8d1, 0xe8c7, 0xe8cb, 0xe8c8, 0xbe6e, 0xbe71, 0xbe73, - 0xe8c9, 0xe8ca, 0xbe72, 0xe8cd, 0xe8d0, 0xe8ce, 0xbe74, 0xbe70, - 0xe8c6, 0xbe6d, 0xbe6f, 0xc063, 0xec66, 0xec64, 0xec63, 0xec69, - 0xec68, 0xec67, 0xec62, 0xc062, 0xec61, 0xec65, 0xc064, 0xef5a, - 0xef5e, 0xef5b, 0xef5d, 0xef5c, 0xef59, 0xef5f, 0xef62, 0xef60, - 0xef61, 0xc240, 0xc1fe, 0xef58, 0xef63, 0xf1b3, 0xf1b6, 0xf1b8, - 0xf1b7, 0xf1b1, 0xf1b5, 0xf1b0, 0xf1b2, 0xc34d, 0xf1af, 0xf1b4, - 0xf3c0, 0xf3b5, 0xc445, 0xc446, 0xf3b4, 0xf3b9, 0xf3bf, 0xf3b7, - 0xf3be, 0xf3bb, 0xf3ba, 0xf3bd, 0xf3b8, 0xf3b6, 0xf3bc, 0xf560, - 0xf55e, 0xc4ca, 0xf55d, 0xf563, 0xf561, 0xc4cb, 0xf55c, 0xf55a, - 0xf55b, 0xc4cd, 0xf55f, 0xc4cc, 0xf562, 0xf678, 0xf67e, 0xf679, - 0xc55b, 0xf6a1, 0xc55a, 0xf67d, 0xf67c, 0xc559, 0xf67b, 0xc558, - 0xf67a, 0xf77d, 0xf7a1, 0xf77e, 0xf77b, 0xc5bb, 0xf778, 0xf77c, - 0xf7a3, 0xf7a2, 0xf779, 0xf77a, 0xc5ba, 0xf852, 0xc5e7, 0xf853, - 0xc5e5, 0xc5e6, 0xf8d3, 0xc64a, 0xf976, 0xc66a, 0xf9b3, 0xc66b, - 0xf9b4, 0xf9b5, 0xf9c3, 0xf9c2, 0xc67a, 0xf9cd, 0xb0a9, 0xe0e9, - 0xe0e8, 0xbbea, 0xbbeb, 0xe4da, 0xe8d2, 0xec6c, 0xbe75, 0xc065, - 0xec6a, 0xec6d, 0xc066, 0xef64, 0xec6b, 0xf1b9, 0xc34e, 0xf3c1, - 0xf566, 0xf564, 0xf565, 0xf6a2, 0xc55c, 0xf7a4, 0xc5ea, 0xc5bc, - 0xc5e8, 0xc5e9, 0xf8d4, 0xc662, 0xb0aa, 0xf1ba, 0xd449, 0xb9a6, - 0xe4db, 0xbbec, 0xe4dc, 0xe8d4, 0xe8d3, 0xc068, 0xbe76, 0xbe77, - 0xe8d7, 0xe8d6, 0xe8d5, 0xec6e, 0xec71, 0xec70, 0xec6f, 0xc067, - 0xef68, 0xef66, 0xef65, 0xef67, 0xc34f, 0xf1bc, 0xf1bd, 0xc350, - 0xf1bb, 0xf3c3, 0xf3c2, 0xf3c5, 0xc447, 0xf3c4, 0xf567, 0xf569, - 0xf568, 0xf6a3, 0xf6a6, 0xf6a4, 0xf6a5, 0xf7a5, 0xc5bd, 0xf854, - 0xf855, 0xf856, 0xc64b, 0xc663, 0xf9b6, 0xb0ab, 0xbe78, 0xc069, - 0xf1be, 0xf7a6, 0xf9c4, 0xd44a, 0xc67b, 0xb0ac, 0xec72, 0xf1bf, - 0xf3c6, 0xf6a7, 0xf7a7, 0xb0ad, 0xe4dd, 0xe4de, 0xbbed, 0xbbee, - 0xe8d9, 0xbe7a, 0xbe79, 0xe8d8, 0xef69, 0xf1c0, 0xf1c2, 0xf1c1, - 0xc353, 0xc352, 0xc351, 0xc55e, 0xf6a8, 0xc55d, 0xf7a9, 0xf7a8, - 0xc64c, 0xf8d5, 0xb3bd, 0xe0ea, 0xe4e1, 0xe4df, 0xe4e0, 0xe8e2, - 0xe8dd, 0xe8da, 0xe8e1, 0xe8e3, 0xbe7c, 0xe8e0, 0xe8dc, 0xe8db, - 0xe8df, 0xe8de, 0xbe7b, 0xec7d, 0xec78, 0xec76, 0xeca1, 0xec77, - 0xec73, 0xec79, 0xec74, 0xef72, 0xec75, 0xeca2, 0xec7c, 0xc06a, - 0xec7b, 0xec7a, 0xec7e, 0xef6a, 0xef6d, 0xef6c, 0xef74, 0xef6f, - 0xef73, 0xef71, 0xef70, 0xef6e, 0xef6b, 0xc243, 0xc242, 0xc244, - 0xc241, 0xef75, 0xf1c8, 0xf1cb, 0xf1c9, 0xf1cd, 0xf1ce, 0xf1c6, - 0xc358, 0xf1c7, 0xf1c5, 0xf1cc, 0xf1c4, 0xf1c3, 0xc357, 0xc355, - 0xc354, 0xf1ca, 0xf3cf, 0xf3d5, 0xc44a, 0xf3d0, 0xf3d3, 0xf3d7, - 0xc44b, 0xf3d2, 0xf3ca, 0xf3c9, 0xf3d6, 0xf3cd, 0xf3cb, 0xf3d4, - 0xf3cc, 0xc449, 0xc448, 0xf3c7, 0xf3c8, 0xf3d1, 0xf3ce, 0xf56c, - 0xf56f, 0xc356, 0xf56d, 0xf573, 0xf571, 0xf56b, 0xf576, 0xf56a, - 0xc4cf, 0xf572, 0xf56e, 0xc4ce, 0xf575, 0xf574, 0xf6ab, 0xf6aa, - 0xf6b1, 0xf6ad, 0xf6b0, 0xc560, 0xf6ae, 0xf6af, 0xf6a9, 0xf6ac, - 0xc55f, 0xc5bf, 0xf7b4, 0xf7af, 0xf7b3, 0xf7b6, 0xf7b2, 0xf7ae, - 0xc5c1, 0xf7b1, 0xf7b5, 0xc5c0, 0xf7ac, 0xf570, 0xf7b0, 0xf7ad, - 0xf7aa, 0xf7ab, 0xc5be, 0xf85a, 0xf85c, 0xf85f, 0xf85b, 0xf860, - 0xf859, 0xf857, 0xc5eb, 0xf85d, 0xc5ed, 0xc5ec, 0xf858, 0xf85e, - 0xf8da, 0xc64d, 0xf8db, 0xf8d9, 0xf8d6, 0xf8d8, 0xf8d7, 0xf95a, - 0xf95c, 0xf95b, 0xf979, 0xf978, 0xf977, 0xf97a, 0xc673, 0xc674, - 0xf9ca, 0xf9ce, 0xb3be, 0xdcaf, 0xe0ed, 0xb9a7, 0xe0eb, 0xe0ec, - 0xe4e2, 0xe4e3, 0xbbf1, 0xbbef, 0xe4e4, 0xbbf0, 0xe8e8, 0xe8eb, - 0xe8e5, 0xe8ec, 0xe8e4, 0xe8e6, 0xe8e7, 0xe8ea, 0xbea1, 0xe8ef, - 0xe8ee, 0xbe7d, 0xe8e9, 0xe8ed, 0xbe7e, 0xecac, 0xc06f, 0xeca7, - 0xc06b, 0xeca4, 0xecaa, 0xecad, 0xc070, 0xeca9, 0xeca6, 0xecae, - 0xeca5, 0xecab, 0xc06c, 0xeca3, 0xc06d, 0xc06e, 0xeca8, 0xefa9, - 0xef7a, 0xef7b, 0xef7e, 0xef7c, 0xef76, 0xef79, 0xefa5, 0xef7d, - 0xc245, 0xefa7, 0xefa4, 0xc246, 0xefa6, 0xef77, 0xefa2, 0xefa3, - 0xefa1, 0xf1d2, 0xf1d4, 0xf1d7, 0xf1d1, 0xc359, 0xf1d9, 0xf1d0, - 0xf1da, 0xf1d6, 0xf1d8, 0xf1dc, 0xf1d5, 0xf1dd, 0xf1d3, 0xf1cf, - 0xc35a, 0xf1db, 0xc35b, 0xc44d, 0xef78, 0xf3f1, 0xf3e8, 0xc44f, - 0xf3e4, 0xc450, 0xf3ed, 0xf3e7, 0xf3dd, 0xc44e, 0xf3ea, 0xf3e5, - 0xf3e6, 0xf3d8, 0xf3df, 0xf3ee, 0xf3eb, 0xf3e3, 0xf3ef, 0xf3de, - 0xf3d9, 0xf3ec, 0xf3db, 0xf3e9, 0xf3e0, 0xf3f0, 0xf3dc, 0xc44c, - 0xf3da, 0xf3e1, 0xf3e2, 0xf57d, 0xf57b, 0xf5a2, 0xf5ae, 0xf5a5, - 0xf57c, 0xf578, 0xf5a7, 0xf57e, 0xf5a3, 0xf57a, 0xf5aa, 0xf577, - 0xf5a1, 0xf5a6, 0xf5a8, 0xf5ab, 0xf579, 0xf5af, 0xf5b0, 0xf5a9, - 0xf5ad, 0xf5a4, 0xf6c1, 0xf6c4, 0xc561, 0xf6c3, 0xf6c8, 0xf6c6, - 0xc562, 0xf6bd, 0xf6b3, 0xf6b2, 0xc564, 0xf6bf, 0xf6c0, 0xf6bc, - 0xf6b4, 0xf6b9, 0xf5ac, 0xf6b5, 0xc563, 0xf6bb, 0xf6ba, 0xf6b6, - 0xf6c2, 0xf6b7, 0xf7bb, 0xf6c5, 0xf6c7, 0xf6be, 0xf6b8, 0xf7bc, - 0xf7be, 0xf7b8, 0xc5c2, 0xf7c5, 0xf7c3, 0xc5c3, 0xf7c2, 0xf7c1, - 0xf7ba, 0xf7b7, 0xf7bd, 0xf7c6, 0xf7b9, 0xf7bf, 0xf869, 0xf86e, - 0xf864, 0xf867, 0xc5ee, 0xf86b, 0xf872, 0xf7c0, 0xf865, 0xf86f, - 0xf873, 0xf86a, 0xf863, 0xf86d, 0xf86c, 0xf871, 0xf870, 0xf7c4, - 0xf868, 0xf862, 0xf866, 0xc64e, 0xc64f, 0xf861, 0xf8e6, 0xf8dd, - 0xf8e5, 0xf8e2, 0xf8e3, 0xf8dc, 0xf8df, 0xf8e7, 0xf8e1, 0xf8e0, - 0xf8de, 0xf8e4, 0xf95d, 0xf95e, 0xf960, 0xf95f, 0xf962, 0xf961, - 0xf97c, 0xf97b, 0xf9b7, 0xf9b8, 0xf9c5, 0xc678, 0xc67c, 0xf9cf, - 0xc67d, 0xb3bf, 0xc4d0, 0xf6c9, 0xc650, 0xc651, 0xb3c0, 0xe0ee, - 0xb9a8, 0xe8f0, 0xecb0, 0xecb1, 0xecaf, 0xefab, 0xefaa, 0xc247, - 0xf1df, 0xefac, 0xf1de, 0xf3f3, 0xc451, 0xc453, 0xf3f2, 0xc452, - 0xf5b1, 0xf5b3, 0xf5b2, 0xf6ca, 0xc565, 0xc5ef, 0xf8e8, 0xf963, - 0xf9d2, 0xb3c1, 0xe4e5, 0xbea2, 0xecb3, 0xecb2, 0xefad, 0xc454, - 0xc4d1, 0xf7c7, 0xf9cb, 0xb3c2, 0xbbf2, 0xbea3, 0xf3f4, 0xf874, - 0xb6c0, 0xefae, 0xc664, 0xb6c1, 0xbea4, 0xc248, 0xf875, 0xb6c2, - 0xe8f1, 0xc072, 0xecb4, 0xecb5, 0xc071, 0xefaf, 0xc24c, 0xc24a, - 0xc24b, 0xc249, 0xf1e0, 0xc35c, 0xf5b5, 0xf5b4, 0xf5b7, 0xf5b6, - 0xc4d2, 0xf6cb, 0xf6cd, 0xf6cc, 0xc566, 0xf7c8, 0xf876, 0xf877, - 0xc5f0, 0xf964, 0xf97d, 0xc675, 0xdcb0, 0xecb6, 0xefb0, 0xf3f5, - 0xe0ef, 0xefb1, 0xf1e2, 0xf1e1, 0xf878, 0xc652, 0xf965, 0xf97e, - 0xb9a9, 0xe8f2, 0xe8f3, 0xecb7, 0xb9aa, 0xc35d, 0xf1e3, 0xf6cf, - 0xc567, 0xf6d0, 0xf6ce, 0xf879, 0xf8e9, 0xb9ab, 0xefb4, 0xefb3, - 0xefb2, 0xf1e4, 0xf1e8, 0xf1e7, 0xf1e6, 0xf1e5, 0xc35e, 0xf3f6, - 0xf5b9, 0xc4d3, 0xf5b8, 0xf6d1, 0xf7cb, 0xf7ca, 0xc5c4, 0xf7c9, - 0xf87c, 0xf87b, 0xf87a, 0xbbf3, 0xecb8, 0xc24d, 0xf3f7, 0xf3f8, - 0xf7cc, 0xf87d, 0xf8ea, 0xf966, 0xf9b9, 0xf9d4, 0xbbf4, 0xc24e, - 0xf1e9, 0xf3f9, 0xf6d2, 0xf87e, 0xbea6, 0xefb5, 0xf1ea, 0xf3fa, - 0xf3fb, 0xf3fc, 0xf5be, 0xf5ba, 0xc568, 0xf5bd, 0xf5bc, 0xc4d4, - 0xf5bb, 0xc4d6, 0xc4d5, 0xf6d4, 0xf6d3, 0xc569, 0xc56a, 0xc5c6, - 0xf7cd, 0xc5c5, 0xf8a3, 0xf8a4, 0xf8a2, 0xf8a1, 0xc654, 0xf8eb, - 0xf8ec, 0xf8ed, 0xc653, 0xf967, 0xf96a, 0xf969, 0xf968, 0xf9d3, - 0xc073, 0xc365, 0xf5bf, 0xf6d5, 0xc5c7, 0xf7ce, 0xf9d5, 0xc074, - 0xefb6, 0xf7cf, 0xf9a1, 0xc94a, 0xddfc, 0xa14a, 0xa157, 0xa159, - 0xa15b, 0xa15f, 0xa160, 0xa163, 0xa164, 0xa167, 0xa168, 0xa16b, - 0xa16c, 0xa16f, 0xa170, 0xa173, 0xa174, 0xa177, 0xa178, 0xa17b, - 0xa17c, 0xa1c6, 0xa1c7, 0xa1ca, 0xa1cb, 0xa1c8, 0xa1c9, 0xa15c, - 0xa14d, 0xa14f, 0xa151, 0xa152, 0xa153, 0xa154, 0xa17d, 0xa17e, - 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1cc, 0xa1cd, 0xa1ce, 0xa1de, - 0xa1df, 0xa1e0, 0xa1e1, 0xa1e2, 0xa24c, 0xa24d, 0xa24e, 0xa149, - 0xa1ad, 0xa243, 0xa248, 0xa1ae, 0xa15d, 0xa15e, 0xa1af, 0xa1cf, - 0xa141, 0xa1d0, 0xa144, 0xa241, 0xa2af, 0xa2b0, 0xa2b1, 0xa2b2, - 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, 0xa147, 0xa146, - 0xa1d5, 0xa1d7, 0xa1d6, 0xa148, 0xa249, 0xa2cf, 0xa2d0, 0xa2d1, - 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, 0xa2d9, - 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, 0xa2e1, - 0xa2e2, 0xa2e3, 0xa2e4, 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xa242, - 0xa1c4, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, 0xa2ed, 0xa2ee, 0xa2ef, - 0xa2f0, 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, - 0xa2f8, 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0xa2fd, 0xa2fe, 0xa340, - 0xa341, 0xa342, 0xa343, 0xa161, 0xa155, 0xa162, 0xa14e, -}; - -static const Summary16 big5_uni2indx_page00[16] = { - /* 0x0000 */ - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x00ac }, { 4, 0x0083 }, - { 7, 0x0000 }, { 7, 0x0080 }, { 8, 0x0000 }, { 8, 0x0080 }, -}; -static const Summary16 big5_uni2indx_page02[38] = { - /* 0x0200 */ - { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, - { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, - { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, - { 9, 0x0e80 }, { 13, 0x0200 }, { 14, 0x0000 }, { 14, 0x0000 }, - /* 0x0300 */ - { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, - { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, - { 14, 0x0000 }, { 14, 0xfffe }, { 29, 0x03fb }, { 38, 0xfffe }, - { 53, 0x03fb }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, - /* 0x0400 */ - { 62, 0x0002 }, { 63, 0x1ff0 }, { 72, 0xfff8 }, { 85, 0xffff }, - { 101, 0xffff }, { 117, 0x0002 }, -}; -static const Summary16 big5_uni2indx_page20[44] = { - /* 0x2000 */ - { 118, 0x0000 }, { 118, 0x3318 }, { 124, 0x0064 }, { 127, 0x4824 }, - { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, - { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, - { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, - /* 0x2100 */ - { 131, 0x0228 }, { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x0000 }, - { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x03ff }, { 144, 0x0000 }, - { 144, 0x0000 }, { 144, 0x03cf }, { 152, 0x0000 }, { 152, 0x0000 }, - { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, - /* 0x2200 */ - { 152, 0x0000 }, { 152, 0xc400 }, { 155, 0x4e29 }, { 162, 0x1030 }, - { 165, 0x0000 }, { 165, 0x0004 }, { 166, 0x00c3 }, { 170, 0x0000 }, - { 170, 0x0000 }, { 170, 0x0000 }, { 170, 0x0020 }, { 171, 0x8000 }, -}; -static const Summary16 big5_uni2indx_page24[37] = { - /* 0x2400 */ - { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, - { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x03ff }, { 182, 0x3ff0 }, - { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, - { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, - /* 0x2500 */ - { 192, 0x1005 }, { 195, 0x1111 }, { 199, 0x1010 }, { 201, 0x1010 }, - { 203, 0x0000 }, { 203, 0x4001 }, { 205, 0xe402 }, { 210, 0x000f }, - { 214, 0xfffe }, { 229, 0x0030 }, { 231, 0x0003 }, { 233, 0x300c }, - { 237, 0xc8c0 }, { 242, 0x0000 }, { 242, 0x003c }, { 246, 0x0000 }, - /* 0x2600 */ - { 246, 0x0260 }, { 249, 0x0000 }, { 249, 0x0000 }, { 249, 0x0000 }, - { 249, 0x0007 }, -}; -static const Summary16 big5_uni2indx_page30[62] = { - /* 0x3000 */ - { 252, 0xff2f }, { 265, 0x6037 }, { 272, 0x03fe }, { 281, 0x0000 }, - { 281, 0xfffe }, { 296, 0xffff }, { 312, 0xffff }, { 328, 0xffff }, - { 344, 0xffff }, { 360, 0x600f }, { 366, 0xfffe }, { 381, 0xffff }, - { 397, 0xffff }, { 413, 0xffff }, { 429, 0xffff }, { 445, 0x407f }, - /* 0x3100 */ - { 453, 0xffe0 }, { 464, 0xffff }, { 480, 0x03ff }, { 490, 0x0000 }, - { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, - { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, - { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, - /* 0x3200 */ - { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, - { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, - { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0008 }, { 491, 0x0000 }, - { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, - /* 0x3300 */ - { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, - { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, - { 491, 0xc000 }, { 493, 0x7000 }, { 496, 0x0002 }, { 497, 0x0000 }, - { 497, 0x4010 }, { 499, 0x0026 }, -}; -static const Summary16 big5_uni2indx_page4e[1307] = { - /* 0x4e00 */ - { 502, 0xff8b }, { 514, 0xc373 }, { 523, 0x6840 }, { 527, 0x1b0f }, - { 535, 0xe9ac }, { 544, 0xf34c }, { 553, 0x0200 }, { 554, 0xc008 }, - { 557, 0x795c }, { 566, 0xca3e }, { 575, 0x7976 }, { 585, 0x0648 }, - { 589, 0x2fdf }, { 601, 0xf7f0 }, { 612, 0x033a }, { 618, 0xa8ff }, - /* 0x4f00 */ - { 629, 0xef37 }, { 641, 0x233f }, { 650, 0xb004 }, { 654, 0xfd59 }, - { 665, 0xf3ca }, { 675, 0xffff }, { 691, 0xde9f }, { 703, 0xfff9 }, - { 717, 0xabff }, { 730, 0x7df7 }, { 743, 0xc000 }, { 745, 0x8eec }, - { 754, 0xeebf }, { 767, 0xffdb }, { 781, 0xd003 }, { 786, 0x45fa }, - /* 0x5000 */ - { 795, 0xfae1 }, { 805, 0xdffe }, { 819, 0xbfef }, { 833, 0x10ab }, - { 839, 0xffeb }, { 853, 0xfcaa }, { 863, 0xef3f }, { 876, 0x24fd }, - { 885, 0x78ad }, { 894, 0x7f76 }, { 906, 0xf00c }, { 912, 0xedff }, - { 926, 0xcff6 }, { 938, 0x2cfa }, { 947, 0xf7f9 }, { 960, 0xeb6b }, - /* 0x5100 */ - { 971, 0x1ffd }, { 983, 0x95bf }, { 994, 0x6677 }, { 1004, 0xbfbf }, - { 1018, 0x3bfb }, { 1030, 0xfeb4 }, { 1041, 0x7bae }, { 1052, 0x11e2 }, - { 1058, 0xa681 }, { 1064, 0x41be }, { 1072, 0x1435 }, { 1078, 0x72c3 }, - { 1086, 0x7d70 }, { 1095, 0x7191 }, { 1102, 0x0003 }, { 1104, 0x276b }, - /* 0x5200 */ - { 1113, 0x57cb }, { 1123, 0x70cf }, { 1132, 0x4732 }, { 1139, 0x0def }, - { 1149, 0x7eda }, { 1160, 0xfc74 }, { 1170, 0xfe06 }, { 1179, 0xbdb4 }, - { 1189, 0x3f9f }, { 1201, 0x8bca }, { 1209, 0x7e49 }, { 1218, 0x5800 }, - { 1221, 0x228f }, { 1228, 0xebec }, { 1239, 0x8a5c }, { 1246, 0xddbb }, - /* 0x5300 */ - { 1258, 0xef60 }, { 1267, 0xb6e7 }, { 1278, 0xa40f }, { 1285, 0xf293 }, - { 1294, 0x37bb }, { 1305, 0x549e }, { 1313, 0xd04b }, { 1320, 0x9baf }, - { 1331, 0xc414 }, { 1336, 0xf7d4 }, { 1347, 0x30b0 }, { 1352, 0x0a14 }, - { 1356, 0x2f08 }, { 1362, 0x88d0 }, { 1367, 0xff7e }, { 1381, 0x192f }, - /* 0x5400 */ - { 1389, 0xffda }, { 1402, 0xfb07 }, { 1412, 0x7ff1 }, { 1424, 0x7beb }, - { 1436, 0xc5ef }, { 1447, 0x0010 }, { 1448, 0x99ff }, { 1460, 0xfdff }, - { 1475, 0x79d7 }, { 1486, 0x0567 }, { 1493, 0xffe7 }, { 1507, 0xfdcb }, - { 1519, 0xc3ff }, { 1531, 0x4040 }, { 1533, 0x6ff7 }, { 1546, 0xbd8e }, - /* 0x5500 */ - { 1556, 0xdffa }, { 1569, 0x0497 }, { 1575, 0xf4c0 }, { 1582, 0x5bff }, - { 1595, 0xed7b }, { 1607, 0xd0e7 }, { 1616, 0x047e }, { 1623, 0xf8e0 }, - { 1631, 0xff9f }, { 1645, 0xb73e }, { 1656, 0x7dfe }, { 1669, 0x882e }, - { 1675, 0xfffd }, { 1690, 0xbe7f }, { 1703, 0x83fe }, { 1713, 0xf6c4 }, - /* 0x5600 */ - { 1722, 0xf357 }, { 1733, 0xb8fd }, { 1744, 0xd680 }, { 1750, 0xef7d }, - { 1763, 0x5767 }, { 1773, 0x4788 }, { 1779, 0xff7d }, { 1793, 0xc3df }, - { 1804, 0xf0ff }, { 1816, 0x37a9 }, { 1825, 0x7de0 }, { 1834, 0x70fc }, - { 1843, 0x3f6f }, { 1855, 0xec9a }, { 1864, 0x4cb3 }, { 1872, 0x8681 }, - /* 0x5700 */ - { 1877, 0x3f9e }, { 1888, 0xdd5c }, { 1898, 0xf70d }, { 1908, 0x4819 }, - { 1913, 0xfea3 }, { 1924, 0x0007 }, { 1927, 0xaf56 }, { 1937, 0x38ff }, - { 1948, 0x980d }, { 1954, 0xefb8 }, { 1965, 0x403d }, { 1971, 0xb760 }, - { 1979, 0xd8ce }, { 1988, 0x9035 }, { 1994, 0x72bf }, { 2005, 0x3fff }, - /* 0x5800 */ - { 2019, 0x7ff7 }, { 2033, 0x7a11 }, { 2040, 0xf7bb }, { 2053, 0xabff }, - { 2066, 0xff00 }, { 2074, 0x6fbe }, { 2086, 0xa93c }, { 2094, 0xfe72 }, - { 2105, 0xcfef }, { 2118, 0xf11b }, { 2127, 0xdb6b }, { 2138, 0xf40a }, - { 2145, 0xc3e6 }, { 2154, 0xef7e }, { 2167, 0x9b9c }, { 2176, 0xf610 }, - /* 0x5900 */ - { 2183, 0xf048 }, { 2189, 0x16f4 }, { 2197, 0xfeb5 }, { 2209, 0x5182 }, - { 2214, 0xc7b1 }, { 2223, 0x15bb }, { 2232, 0x6e87 }, { 2241, 0xfbdf }, - { 2255, 0xe43f }, { 2265, 0x63cd }, { 2274, 0xc1ff }, { 2285, 0x7e7e }, - { 2297, 0xfdeb }, { 2310, 0x7d5f }, { 2322, 0x777b }, { 2334, 0xfcfe }, - /* 0x5a00 */ - { 2347, 0x960b }, { 2354, 0xdbea }, { 2365, 0x6229 }, { 2371, 0x53e8 }, - { 2379, 0x37df }, { 2391, 0xfdef }, { 2405, 0x36f5 }, { 2415, 0xbd81 }, - { 2423, 0xdc18 }, { 2430, 0xfcbd }, { 2442, 0xd2e4 }, { 2450, 0xffff }, - { 2466, 0x3fd7 }, { 2478, 0xffe0 }, { 2489, 0x7f6f }, { 2502, 0xabf8 }, - /* 0x5b00 */ - { 2512, 0x9bae }, { 2522, 0x6ed9 }, { 2532, 0xf5fb }, { 2545, 0xf115 }, - { 2553, 0x79a9 }, { 2562, 0xbdfb }, { 2575, 0x5a3c }, { 2583, 0xadaf }, - { 2594, 0xdbba }, { 2605, 0x1fac }, { 2614, 0x71fc }, { 2624, 0x8379 }, - { 2632, 0x7cf7 }, { 2644, 0xc35f }, { 2654, 0xdfff }, { 2669, 0x0567 }, - /* 0x5c00 */ - { 2676, 0xff9a }, { 2688, 0x8467 }, { 2695, 0x1534 }, { 2701, 0xdf8b }, - { 2712, 0xf9f3 }, { 2724, 0x3373 }, { 2733, 0xf7bd }, { 2746, 0x5e1a }, - { 2754, 0xbf40 }, { 2762, 0xa03f }, { 2770, 0xffff }, { 2786, 0x01eb }, - { 2793, 0xdfc0 }, { 2802, 0xcfdd }, { 2814, 0x7500 }, { 2819, 0xabd3 }, - /* 0x5d00 */ - { 2829, 0xf8c3 }, { 2838, 0xeed6 }, { 2849, 0x43fd }, { 2859, 0xb7ff }, - { 2873, 0x5eaf }, { 2884, 0x4227 }, { 2890, 0x9bac }, { 2899, 0xf686 }, - { 2908, 0x27d7 }, { 2918, 0xf6bc }, { 2929, 0xf787 }, { 2940, 0x35b7 }, - { 2950, 0xaacd }, { 2959, 0xe176 }, { 2968, 0x49e7 }, { 2977, 0xe29f }, - /* 0x5e00 */ - { 2987, 0x545c }, { 2994, 0xaff2 }, { 3005, 0x2b3f }, { 3015, 0x61d8 }, - { 3022, 0xfc3b }, { 3033, 0xbbb8 }, { 3043, 0xffcf }, { 3057, 0x7b7d }, - { 3069, 0xbf95 }, { 3080, 0x1ce0 }, { 3086, 0x7dfd }, { 3099, 0x43ff }, - { 3110, 0x5ff6 }, { 3122, 0xfffe }, { 3137, 0xd3ef }, { 3149, 0xc4ce }, - /* 0x5f00 */ - { 3157, 0x8db6 }, { 3166, 0xadbc }, { 3176, 0x63dc }, { 3185, 0x11eb }, - { 3193, 0xdf59 }, { 3204, 0x23d0 }, { 3210, 0xbeb4 }, { 3220, 0xf3db }, - { 3232, 0x1fe7 }, { 3243, 0xdbc7 }, { 3254, 0xff63 }, { 3266, 0xfae4 }, - { 3276, 0xb22b }, { 3284, 0x63f7 }, { 3295, 0xed3b }, { 3306, 0xadba }, - /* 0x6000 */ - { 3316, 0xfe01 }, { 3324, 0x7eff }, { 3338, 0xfff7 }, { 3353, 0x02bc }, - { 3359, 0x32ff }, { 3370, 0xef39 }, { 3381, 0xfffc }, { 3395, 0x8005 }, - { 3398, 0x77fb }, { 3411, 0xbcf5 }, { 3422, 0x010d }, { 3426, 0xfff7 }, - { 3441, 0xfffb }, { 3456, 0xbf3a }, { 3467, 0x0057 }, { 3472, 0xdfff }, - /* 0x6100 */ - { 3487, 0xef7b }, { 3500, 0xbd7d }, { 3512, 0xdb88 }, { 3520, 0xc8d4 }, - { 3527, 0xfff3 }, { 3541, 0xed7c }, { 3552, 0x5dee }, { 3563, 0x56ff }, - { 3575, 0x7e0d }, { 3584, 0xac5f }, { 3594, 0xff96 }, { 3606, 0xd57f }, - { 3618, 0x3fee }, { 3630, 0xc140 }, { 3634, 0x6ff9 }, { 3646, 0xffe7 }, - /* 0x6200 */ - { 3660, 0x779b }, { 3671, 0x8e77 }, { 3681, 0x6ebf }, { 3693, 0xe45d }, - { 3702, 0x6fcf }, { 3714, 0x5f1f }, { 3725, 0xe07f }, { 3735, 0xfedf }, - { 3749, 0xd7db }, { 3761, 0x01fe }, { 3769, 0xff00 }, { 3777, 0xfb7b }, - { 3790, 0xffd4 }, { 3802, 0x1fdf }, { 3814, 0xf800 }, { 3819, 0xffff }, - /* 0x6300 */ - { 3835, 0xfb8f }, { 3847, 0x007b }, { 3853, 0xbf00 }, { 3860, 0x7f5c }, - { 3871, 0xffff }, { 3887, 0x07f3 }, { 3896, 0xeba0 }, { 3904, 0x3de7 }, - { 3915, 0xf7bf }, { 3929, 0xfbd7 }, { 3942, 0xffbf }, { 3957, 0x6003 }, - { 3961, 0xfffd }, { 3976, 0xbfed }, { 3989, 0xefbb }, { 4002, 0x027f }, - /* 0x6400 */ - { 4010, 0xfe40 }, { 4018, 0xddfd }, { 4031, 0xfdff }, { 4046, 0xe2f9 }, - { 4056, 0x680b }, { 4062, 0xfb1f }, { 4074, 0xfbe3 }, { 4086, 0xaffd }, - { 4099, 0x9fa4 }, { 4108, 0xf7ed }, { 4121, 0x7a7d }, { 4132, 0xf80f }, - { 4141, 0xeebe }, { 4153, 0x0fd5 }, { 4162, 0xbb5d }, { 4173, 0xfd9f }, - /* 0x6500 */ - { 4186, 0xf2db }, { 4197, 0x3bf9 }, { 4208, 0xfe7f }, { 4222, 0xebcc }, - { 4232, 0x876a }, { 4240, 0x73fa }, { 4251, 0x95fc }, { 4261, 0x9ffc }, - { 4273, 0x109f }, { 4280, 0xfaf7 }, { 4293, 0xddb7 }, { 4305, 0xbbcd }, - { 4316, 0xf87e }, { 4327, 0xeccd }, { 4337, 0xf366 }, { 4347, 0x3c3f }, - /* 0x6600 */ - { 4357, 0xfffd }, { 4372, 0xb03f }, { 4381, 0xe9f7 }, { 4393, 0x067e }, - { 4401, 0x96ae }, { 4410, 0xfe06 }, { 4419, 0xd576 }, { 4429, 0x5fd7 }, - { 4441, 0x3fd1 }, { 4451, 0xa3f3 }, { 4461, 0xcf07 }, { 4470, 0x6fb7 }, - { 4482, 0x9fd1 }, { 4492, 0x7f44 }, { 4501, 0x7b59 }, { 4511, 0xd3dd }, - /* 0x6700 */ - { 4522, 0xaf3b }, { 4533, 0xa9bd }, { 4543, 0x7dcf }, { 4555, 0xff3a }, - { 4567, 0xfbe0 }, { 4577, 0xf6eb }, { 4589, 0xb401 }, { 4594, 0xffff }, - { 4610, 0x7afa }, { 4621, 0xb7bf }, { 4634, 0xc000 }, { 4636, 0x0ffd }, - { 4647, 0xff7f }, { 4662, 0xff1f }, { 4675, 0xfefc }, { 4688, 0x95ff }, - /* 0x6800 */ - { 4700, 0x0000 }, { 4700, 0xb5dc }, { 4710, 0xef63 }, { 4721, 0x3f3e }, - { 4732, 0xfb7f }, { 4746, 0x001b }, { 4750, 0xe800 }, { 4754, 0xfbf6 }, - { 4767, 0x9eef }, { 4779, 0xb8df }, { 4790, 0xff9f }, { 4804, 0x003f }, - { 4810, 0x7bd0 }, { 4819, 0xf5ff }, { 4833, 0xdfdb }, { 4846, 0x3fff }, - /* 0x6900 */ - { 4860, 0xfdf0 }, { 4871, 0x00bf }, { 4878, 0x8420 }, { 4881, 0xbbbd }, - { 4893, 0xdf37 }, { 4905, 0xffde }, { 4919, 0xff6d }, { 4932, 0x0ff3 }, - { 4942, 0x604c }, { 4947, 0x5efb }, { 4959, 0xfffb }, { 4974, 0xfafb }, - { 4987, 0xfe5e }, { 4999, 0x0219 }, { 5003, 0x79f4 }, { 5013, 0xf9de }, - /* 0x6a00 */ - { 5025, 0xa7f7 }, { 5037, 0xebfa }, { 5049, 0x01eb }, { 5056, 0xff34 }, - { 5067, 0xebd3 }, { 5078, 0xef73 }, { 5090, 0xafd7 }, { 5102, 0xc040 }, - { 5105, 0x72bb }, { 5115, 0xdcff }, { 5128, 0xf17f }, { 5140, 0x2fd8 }, - { 5149, 0xb8ec }, { 5158, 0xfe0b }, { 5168, 0xdda3 }, { 5178, 0x1f0b }, - /* 0x6b00 */ - { 5186, 0x8f1d }, { 5195, 0x47cf }, { 5205, 0xb12b }, { 5213, 0xffde }, - { 5227, 0x7fee }, { 5240, 0xda73 }, { 5250, 0x24ff }, { 5260, 0xcbc4 }, - { 5268, 0xf75d }, { 5280, 0xcbf2 }, { 5290, 0xecfd }, { 5302, 0xb4ed }, - { 5312, 0xbff9 }, { 5325, 0x4ddd }, { 5335, 0x99dd }, { 5345, 0xfb8d }, - /* 0x6c00 */ - { 5356, 0xbb7f }, { 5369, 0xaf7b }, { 5381, 0xddfb }, { 5394, 0xc959 }, - { 5402, 0xfc4f }, { 5413, 0xfab5 }, { 5424, 0xafe3 }, { 5435, 0x6d5f }, - { 5446, 0xffff }, { 5462, 0x3f7d }, { 5474, 0x7800 }, { 5478, 0xffdb }, - { 5492, 0xb6ff }, { 5505, 0x7eff }, { 5519, 0xfbaf }, { 5532, 0x022f }, - /* 0x6d00 */ - { 5538, 0xff9b }, { 5551, 0xefc7 }, { 5563, 0xffa5 }, { 5575, 0xffff }, - { 5591, 0x0007 }, { 5594, 0xc700 }, { 5599, 0xf7ff }, { 5614, 0xfff1 }, - { 5627, 0x7ffd }, { 5641, 0x01bf }, { 5649, 0xdc00 }, { 5654, 0xfdbc }, - { 5666, 0xbff5 }, { 5679, 0xffff }, { 5695, 0xff7f }, { 5710, 0x3eff }, - /* 0x6e00 */ - { 5723, 0x0029 }, { 5726, 0xbe00 }, { 5732, 0xf9ff }, { 5746, 0xff7f }, - { 5761, 0x6efb }, { 5773, 0xfd7e }, { 5786, 0xcbff }, { 5799, 0x039e }, - { 5806, 0xe300 }, { 5811, 0xfbdd }, { 5824, 0xccff }, { 5836, 0xf6df }, - { 5849, 0xffff }, { 5865, 0x117f }, { 5874, 0xf800 }, { 5879, 0xfbf6 }, - /* 0x6f00 */ - { 5892, 0xe7ef }, { 5905, 0xd73c }, { 5915, 0xfeef }, { 5929, 0xdfef }, - { 5943, 0xc00b }, { 5948, 0xedbf }, { 5961, 0xfedf }, { 5975, 0xfdcd }, - { 5987, 0x7bf5 }, { 5999, 0x40fd }, { 6007, 0xffff }, { 6023, 0xb75f }, - { 6035, 0xffdf }, { 6050, 0xf930 }, { 6058, 0xfbdf }, { 6072, 0xdc97 }, - /* 0x7000 */ - { 6082, 0xfef3 }, { 6095, 0xbff2 }, { 6107, 0x8fdf }, { 6119, 0xdfbf }, - { 6133, 0x177f }, { 6144, 0xede6 }, { 6155, 0x0f7f }, { 6166, 0x3553 }, - { 6174, 0x447c }, { 6181, 0x877e }, { 6191, 0xfa12 }, { 6199, 0x45bb }, - { 6208, 0xede0 }, { 6217, 0x779e }, { 6228, 0x8017 }, { 6233, 0xbfd9 }, - /* 0x7100 */ - { 6245, 0x7e55 }, { 6255, 0xde89 }, { 6264, 0xc16f }, { 6273, 0x0447 }, - { 6278, 0x7ade }, { 6289, 0xf75d }, { 6301, 0x57ff }, { 6314, 0x2905 }, - { 6319, 0x86f7 }, { 6329, 0xfe95 }, { 6340, 0x97b3 }, { 6350, 0xf32f }, - { 6361, 0xcfff }, { 6375, 0x9f75 }, { 6386, 0x71f7 }, { 6397, 0xfb17 }, - /* 0x7200 */ - { 6408, 0x34ee }, { 6417, 0xee19 }, { 6426, 0x37cc }, { 6435, 0xef61 }, - { 6445, 0x9fd6 }, { 6456, 0xef4c }, { 6466, 0xd68f }, { 6476, 0xfbdd }, - { 6489, 0x7b73 }, { 6500, 0x6def }, { 6512, 0xd7fe }, { 6525, 0xa431 }, - { 6531, 0x5e7f }, { 6543, 0x97d7 }, { 6554, 0x0f5b }, { 6563, 0xffd8 }, - /* 0x7300 */ - { 6575, 0x9d83 }, { 6583, 0x7bce }, { 6594, 0x22ec }, { 6601, 0xdcff }, - { 6614, 0x763d }, { 6624, 0xef87 }, { 6635, 0xdfe7 }, { 6648, 0xfded }, - { 6661, 0x4fff }, { 6674, 0xa0fc }, { 6682, 0x3b77 }, { 6693, 0xdbfc }, - { 6705, 0x3ded }, { 6716, 0x7fdc }, { 6728, 0x6fa9 }, { 6738, 0xf570 }, - /* 0x7400 */ - { 6747, 0x3ffb }, { 6760, 0x2c40 }, { 6764, 0xff7f }, { 6779, 0x847f }, - { 6788, 0xec57 }, { 6798, 0xdeb7 }, { 6810, 0xe69c }, { 6819, 0xf22f }, - { 6829, 0x0feb }, { 6839, 0xd5b5 }, { 6849, 0xafeb }, { 6861, 0xede7 }, - { 6873, 0x8c2f }, { 6881, 0xfff0 }, { 6893, 0x537f }, { 6904, 0xe8f0 }, - /* 0x7500 */ - { 6912, 0xb99d }, { 6922, 0xb5ff }, { 6935, 0xff66 }, { 6947, 0xe78f }, - { 6958, 0xd981 }, { 6965, 0xbe10 }, { 6972, 0x9c7c }, { 6981, 0xe3c1 }, - { 6989, 0x9cd1 }, { 6997, 0x2733 }, { 7005, 0x0cbc }, { 7012, 0xff6d }, - { 7025, 0xfcb7 }, { 7037, 0xefb7 }, { 7050, 0xa0df }, { 7059, 0xffff }, - /* 0x7600 */ - { 7075, 0xbf0b }, { 7085, 0xfe7b }, { 7098, 0xa3ff }, { 7110, 0x353f }, - { 7120, 0x13cc }, { 7127, 0x97cd }, { 7137, 0x7637 }, { 7147, 0xfb27 }, - { 7158, 0xcfd6 }, { 7169, 0x7e6c }, { 7179, 0xec50 }, { 7186, 0xed31 }, - { 7195, 0x677c }, { 7205, 0xfc1c }, { 7214, 0xf6fa }, { 7226, 0x5fbf }, - /* 0x7700 */ - { 7239, 0x0fba }, { 7248, 0xae2f }, { 7258, 0xa3ad }, { 7267, 0x7ffe }, - { 7281, 0xfcf0 }, { 7291, 0xde74 }, { 7301, 0xffef }, { 7316, 0xf200 }, - { 7321, 0xfbbf }, { 7335, 0xfea2 }, { 7345, 0x3daf }, { 7356, 0xbcff }, - { 7369, 0xf694 }, { 7378, 0x5fb9 }, { 7389, 0xf3ad }, { 7400, 0x3f8f }, - /* 0x7800 */ - { 7411, 0xf26c }, { 7420, 0xa01f }, { 7427, 0xffef }, { 7442, 0x01bf }, - { 7450, 0x7728 }, { 7458, 0x7005 }, { 7463, 0xff35 }, { 7475, 0xda03 }, - { 7482, 0xd2f9 }, { 7492, 0xc7fa }, { 7503, 0x3fbf }, { 7516, 0x5c1d }, - { 7524, 0xff3a }, { 7536, 0xec33 }, { 7545, 0xb7af }, { 7557, 0xfe9c }, - /* 0x7900 */ - { 7568, 0x5236 }, { 7575, 0x7a9f }, { 7586, 0xbffa }, { 7599, 0xe722 }, - { 7607, 0x9ff7 }, { 7620, 0xfcff }, { 7634, 0x2fbb }, { 7645, 0xb61d }, - { 7654, 0xed06 }, { 7662, 0x1dfd }, { 7673, 0x7dd7 }, { 7685, 0xefdf }, - { 7699, 0xeb23 }, { 7708, 0xf166 }, { 7717, 0x7ed9 }, { 7728, 0x0dc0 }, - /* 0x7a00 */ - { 7733, 0x3d3d }, { 7743, 0xdfbf }, { 7757, 0xc945 }, { 7764, 0xba83 }, - { 7772, 0x7dd1 }, { 7782, 0x9dd0 }, { 7790, 0x7b87 }, { 7800, 0xcf73 }, - { 7811, 0x9ff3 }, { 7823, 0xc3f5 }, { 7833, 0xdf0d }, { 7843, 0xc5fe }, - { 7854, 0x0cb3 }, { 7861, 0x8302 }, { 7865, 0xe879 }, { 7874, 0xaec0 }, - /* 0x7b00 */ - { 7881, 0xc773 }, { 7891, 0x6f0f }, { 7901, 0xfd7d }, { 7914, 0x093f }, - { 7922, 0xfff1 }, { 7935, 0x0157 }, { 7941, 0x62fb }, { 7951, 0x01ff }, - { 7960, 0xfdb4 }, { 7971, 0x3bf3 }, { 7982, 0xb013 }, { 7988, 0x43b2 }, - { 7995, 0x5ed3 }, { 8005, 0xff30 }, { 8015, 0x0fff }, { 8027, 0xeb9f }, - /* 0x7c00 */ - { 8039, 0xfeef }, { 8053, 0xf203 }, { 8060, 0x3fef }, { 8073, 0xfb89 }, - { 8083, 0x37a9 }, { 8092, 0x9e99 }, { 8101, 0xdef9 }, { 8113, 0xa72c }, - { 8121, 0x3733 }, { 8130, 0xc1f6 }, { 8139, 0x812e }, { 8145, 0xfe3e }, - { 8157, 0x5d20 }, { 8163, 0xf2f7 }, { 8175, 0xd585 }, { 8183, 0x69d7 }, - /* 0x7d00 */ - { 8193, 0xffff }, { 8209, 0xffff }, { 8225, 0xdb07 }, { 8234, 0xff6f }, - { 8248, 0xc4ff }, { 8259, 0xd97f }, { 8271, 0xefce }, { 8283, 0xbe0f }, - { 8293, 0xf17b }, { 8304, 0xf05e }, { 8313, 0xf6cf }, { 8325, 0xffb7 }, - { 8339, 0x5ef7 }, { 8351, 0xef84 }, { 8360, 0xd7cb }, { 8371, 0x0edf }, - /* 0x7e00 */ - { 8381, 0xff08 }, { 8390, 0xfcff }, { 8404, 0xee3f }, { 8416, 0xffff }, - { 8432, 0x13ff }, { 8443, 0xd7ff }, { 8457, 0xaf0f }, { 8467, 0x7ffd }, - { 8481, 0xbdc7 }, { 8492, 0x1ffa }, { 8503, 0x0000 }, { 8503, 0x0000 }, - { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, - /* 0x7f00 */ - { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0xe740 }, - { 8510, 0xbd38 }, { 8519, 0xf933 }, { 8529, 0x7feb }, { 8542, 0xfeed }, - { 8555, 0x7fe8 }, { 8566, 0x7c76 }, { 8576, 0xb3f7 }, { 8588, 0xffef }, - { 8603, 0xfeaf }, { 8616, 0xd8b7 }, { 8626, 0xff6f }, { 8640, 0xfbbf }, - /* 0x8000 */ - { 8654, 0xf8fb }, { 8666, 0xdbf7 }, { 8679, 0x1752 }, { 8686, 0xe2f9 }, - { 8696, 0x85c8 }, { 8702, 0x7547 }, { 8711, 0x9090 }, { 8715, 0xe3ef }, - { 8727, 0x9ef4 }, { 8737, 0x3f6d }, { 8748, 0xee2e }, { 8758, 0x0536 }, - { 8764, 0xf7bc }, { 8776, 0x7ff3 }, { 8789, 0xa07b }, { 8797, 0x7f3f }, - /* 0x8100 */ - { 8810, 0x0567 }, { 8817, 0xeb60 }, { 8825, 0xbabe }, { 8836, 0x6601 }, - { 8841, 0xfcd8 }, { 8851, 0x583f }, { 8860, 0xcaf7 }, { 8871, 0x87df }, - { 8882, 0xbfcd }, { 8894, 0xffa0 }, { 8904, 0x5bcd }, { 8914, 0xfebf }, - { 8928, 0xb6fd }, { 8940, 0xefa7 }, { 8952, 0x77ef }, { 8965, 0xdf9c }, - /* 0x8200 */ - { 8976, 0x3fb7 }, { 8988, 0xf877 }, { 8999, 0x9d27 }, { 9008, 0xb7fc }, - { 9020, 0xcab5 }, { 9029, 0xdfef }, { 9043, 0xfb5a }, { 9054, 0xf1b6 }, - { 9064, 0xec39 }, { 9073, 0xef1f }, { 9085, 0xfbbf }, { 9099, 0x7ffb }, - { 9113, 0x000d }, { 9116, 0xdafe }, { 9128, 0xbdfb }, { 9141, 0x4e7f }, - /* 0x8300 */ - { 9152, 0x33ff }, { 9164, 0x5ac0 }, { 9170, 0xbff5 }, { 9183, 0x9ffe }, - { 9196, 0xffbf }, { 9211, 0x005f }, { 9217, 0x0000 }, { 9217, 0xfdf8 }, - { 9229, 0xffca }, { 9241, 0x6ffd }, { 9254, 0xcffd }, { 9267, 0xa001 }, - { 9270, 0xdfff }, { 9285, 0xfbf2 }, { 9297, 0xdfbf }, { 9311, 0xff7f }, - /* 0x8400 */ - { 9326, 0xfeda }, { 9338, 0x080f }, { 9343, 0xba08 }, { 9349, 0xbfff }, - { 9364, 0x7afd }, { 9376, 0xeed7 }, { 9388, 0xfbeb }, { 9401, 0x67f9 }, - { 9412, 0xe044 }, { 9417, 0xff93 }, { 9429, 0xdf97 }, { 9441, 0x9f57 }, - { 9452, 0xfef7 }, { 9466, 0x08df }, { 9474, 0xdf80 }, { 9482, 0xfedf }, - /* 0x8500 */ - { 9496, 0xffc5 }, { 9508, 0xf7fe }, { 9522, 0xfffb }, { 9537, 0x6803 }, - { 9542, 0x67fb }, { 9554, 0x6bfa }, { 9565, 0x7fff }, { 9580, 0x5fe2 }, - { 9590, 0xffff }, { 9606, 0xff73 }, { 9619, 0x87df }, { 9630, 0xe7fb }, - { 9643, 0xebfd }, { 9656, 0xf7a7 }, { 9668, 0xbf7e }, { 9681, 0xefc7 }, - /* 0x8600 */ - { 9693, 0x1ef3 }, { 9703, 0xdf82 }, { 9712, 0x76ff }, { 9725, 0xdf7e }, - { 9738, 0x79c9 }, { 9747, 0xda7d }, { 9758, 0xefbe }, { 9771, 0x1e9b }, - { 9780, 0x7ce0 }, { 9788, 0x77fb }, { 9801, 0x87be }, { 9811, 0xfffb }, - { 9826, 0x1bff }, { 9838, 0xffdb }, { 9852, 0x3f5c }, { 9862, 0x4fe0 }, - /* 0x8700 */ - { 9870, 0x7fff }, { 9885, 0x5f0e }, { 9894, 0x77ff }, { 9908, 0xddbf }, - { 9921, 0xf04f }, { 9930, 0xffff }, { 9946, 0xffff }, { 9962, 0x0ff8 }, - { 9971, 0xa3be }, { 9981, 0xfddf }, { 9995, 0xfc1c }, { 10004, 0xfffd }, - { 10019, 0x1f7d }, { 10030, 0xfb9e }, { 10042, 0xbdff }, { 10056, 0xdedc }, - /* 0x8800 */ - { 10067, 0x3f6f }, { 10079, 0xbafb }, { 10091, 0xdf7f }, { 10105, 0xfbef }, - { 10119, 0x7d1b }, { 10129, 0x2eec }, { 10138, 0xaf8e }, { 10148, 0xf2f7 }, - { 10160, 0x7b0f }, { 10170, 0xcfee }, { 10182, 0x1d96 }, { 10190, 0x77c6 }, - { 10200, 0x7e07 }, { 10209, 0xfff5 }, { 10223, 0xd982 }, { 10230, 0x7fdf }, - /* 0x8900 */ - { 10244, 0x5ee6 }, { 10254, 0xc7ff }, { 10267, 0xfeee }, { 10280, 0x79ef }, - { 10292, 0x9a56 }, { 10300, 0xffcf }, { 10314, 0xfe5f }, { 10327, 0xde5e }, - { 10338, 0x896e }, { 10346, 0xf9e8 }, { 10356, 0xf45e }, { 10366, 0xe6c4 }, - { 10374, 0x0001 }, { 10375, 0xbe7c }, { 10386, 0x3b7f }, { 10398, 0xdddf }, - /* 0x8a00 */ - { 10411, 0xd59d }, { 10421, 0xe9ef }, { 10433, 0x34ac }, { 10440, 0xde53 }, - { 10450, 0xf573 }, { 10461, 0x4bf7 }, { 10472, 0x7b4f }, { 10483, 0x9eff }, - { 10496, 0xb8fe }, { 10507, 0x476e }, { 10516, 0x0dfb }, { 10526, 0xff45 }, - { 10537, 0xabfd }, { 10549, 0xfbfe }, { 10563, 0xe9d7 }, { 10574, 0xddff }, - /* 0x8b00 */ - { 10588, 0xedf7 }, { 10601, 0x7fff }, { 10616, 0xddfd }, { 10629, 0x7eeb }, - { 10641, 0xcfe7 }, { 10653, 0xb7ff }, { 10667, 0xbde9 }, { 10678, 0xef91 }, - { 10688, 0x5d75 }, { 10698, 0xd77c }, { 10709, 0x0000 }, { 10709, 0x0000 }, - { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, - /* 0x8c00 */ - { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0xfa80 }, - { 10716, 0xffee }, { 10730, 0xb4f1 }, { 10739, 0xbf76 }, { 10751, 0x2fef }, - { 10763, 0xb677 }, { 10774, 0x77bf }, { 10787, 0x9fbf }, { 10800, 0xfffd }, - { 10815, 0x95bf }, { 10826, 0xf6ae }, { 10837, 0x75ff }, { 10850, 0x7f3b }, - /* 0x8d00 */ - { 10862, 0xa7f5 }, { 10873, 0x0af9 }, { 10881, 0x0000 }, { 10881, 0x0000 }, - { 10881, 0x0000 }, { 10881, 0x0000 }, { 10881, 0xfbd0 }, { 10891, 0x2bdd }, - { 10901, 0xf633 }, { 10911, 0x9a7f }, { 10922, 0xfdab }, { 10934, 0xd6fc }, - { 10945, 0xf9e6 }, { 10956, 0xbfeb }, { 10969, 0xdfdf }, { 10983, 0xf41f }, - /* 0x8e00 */ - { 10993, 0xa6fd }, { 11004, 0xffff }, { 11020, 0x4aff }, { 11031, 0xf37b }, - { 11043, 0x7fb7 }, { 11056, 0xfef9 }, { 11069, 0xb6ff }, { 11082, 0x1d5c }, - { 11090, 0x7ff6 }, { 11103, 0xe5ff }, { 11116, 0x1f7b }, { 11127, 0x2404 }, - { 11130, 0xbe05 }, { 11138, 0xf99e }, { 11149, 0xdbe3 }, { 11160, 0xdff2 }, - /* 0x8f00 */ - { 11172, 0x6fef }, { 11185, 0xfdff }, { 11200, 0xd679 }, { 11210, 0xcbfc }, - { 11221, 0xebfd }, { 11234, 0xefff }, { 11249, 0x001f }, { 11254, 0x0000 }, - { 11254, 0x0000 }, { 11254, 0x9800 }, { 11257, 0xe148 }, { 11263, 0x8017 }, - { 11268, 0x6a74 }, { 11276, 0x00fe }, { 11283, 0x6d7f }, { 11295, 0xfdf1 }, - /* 0x9000 */ - { 11307, 0xb87f }, { 11318, 0xfef3 }, { 11331, 0xe01f }, { 11339, 0xf176 }, - { 11349, 0xee96 }, { 11359, 0x7b3f }, { 11371, 0xeb8d }, { 11381, 0xfffd }, - { 11396, 0xadff }, { 11409, 0xcbb3 }, { 11419, 0x84ef }, { 11428, 0xe17f }, - { 11439, 0x4daa }, { 11447, 0xbff0 }, { 11458, 0xbf3f }, { 11471, 0xfe3f }, - /* 0x9100 */ - { 11484, 0xebff }, { 11498, 0xffd7 }, { 11512, 0xffdf }, { 11527, 0xcf7f }, - { 11540, 0xfffb }, { 11555, 0x85ed }, { 11564, 0xd73f }, { 11576, 0x07bc }, - { 11584, 0xaeff }, { 11597, 0xfe0f }, { 11608, 0xfdaf }, { 11621, 0x76bf }, - { 11633, 0xfaef }, { 11646, 0x37bb }, { 11657, 0x7fdc }, { 11669, 0xa3ba }, - /* 0x9200 */ - { 11678, 0xb6ff }, { 11691, 0x56f7 }, { 11702, 0x60f8 }, { 11709, 0xe7df }, - { 11722, 0xff61 }, { 11733, 0x4cdf }, { 11743, 0xb0fb }, { 11753, 0xff45 }, - { 11764, 0x7ded }, { 11776, 0x3ffa }, { 11788, 0x1fff }, { 11801, 0x18fc }, - { 11809, 0xffff }, { 11825, 0xe3af }, { 11836, 0xc7d3 }, { 11846, 0xdf83 }, - /* 0x9300 */ - { 11856, 0xfb57 }, { 11868, 0xef7d }, { 11881, 0xefff }, { 11896, 0x1378 }, - { 11903, 0xfec0 }, { 11912, 0x5ff7 }, { 11925, 0x34bb }, { 11934, 0x5ee3 }, - { 11944, 0xf70d }, { 11954, 0xeff6 }, { 11967, 0xd7fe }, { 11980, 0x00bf }, - { 11987, 0xf59d }, { 11998, 0xf7f7 }, { 12012, 0x51de }, { 12021, 0xffe0 }, - /* 0x9400 */ - { 12032, 0xfec9 }, { 12043, 0x037f }, { 12052, 0x5f01 }, { 12059, 0xbfef }, - { 12073, 0x9ff1 }, { 12084, 0x60a7 }, { 12091, 0xef1d }, { 12102, 0xf1ff }, - { 12115, 0x000f }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, - { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, - /* 0x9500 */ - { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, - { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x3c80 }, - { 12124, 0xfb4d }, { 12135, 0xd91f }, { 12145, 0x7b3a }, { 12155, 0xfee3 }, - { 12167, 0x3fe9 }, { 12178, 0xdc7f }, { 12190, 0x003f }, { 12196, 0x0000 }, - /* 0x9600 */ - { 12196, 0x0000 }, { 12196, 0x5000 }, { 12198, 0xf51f }, { 12209, 0xbe07 }, - { 12218, 0xfc1d }, { 12228, 0xf91b }, { 12238, 0xbc1e }, { 12247, 0x71ff }, - { 12259, 0x6ff9 }, { 12271, 0x5bbe }, { 12282, 0x5796 }, { 12291, 0x9b1b }, - { 12300, 0x7fff }, { 12315, 0xfffc }, { 12329, 0x872e }, { 12337, 0xafe7 }, - /* 0x9700 */ - { 12349, 0xebf5 }, { 12361, 0xf34f }, { 12372, 0xdffd }, { 12386, 0xe725 }, - { 12395, 0x0bdc }, { 12403, 0x5d44 }, { 12410, 0x5747 }, { 12419, 0xfddd }, - { 12432, 0xed3f }, { 12444, 0x7790 }, { 12452, 0x7d7f }, { 12465, 0x8ac8 }, - { 12471, 0xfafa }, { 12483, 0xf3f9 }, { 12495, 0x202a }, { 12499, 0xef4b }, - /* 0x9800 */ - { 12510, 0xf5ff }, { 12524, 0x79cf }, { 12535, 0xabd3 }, { 12545, 0x0ba5 }, - { 12552, 0xf77a }, { 12564, 0xfb8f }, { 12576, 0x8ebd }, { 12586, 0x001f }, - { 12591, 0x0000 }, { 12591, 0x0000 }, { 12591, 0xf300 }, { 12597, 0xfd4e }, - { 12608, 0x1a57 }, { 12616, 0x8800 }, { 12618, 0xaeac }, { 12627, 0x7654 }, - /* 0x9900 */ - { 12635, 0x17ad }, { 12644, 0xcdff }, { 12657, 0xffb2 }, { 12669, 0xf42f }, - { 12679, 0x5baa }, { 12688, 0xdbff }, { 12702, 0x0002 }, { 12703, 0x0000 }, - { 12703, 0x0000 }, { 12703, 0x73c0 }, { 12710, 0xf9ea }, { 12721, 0x2e3f }, - { 12731, 0xfa8e }, { 12741, 0xbbff }, { 12755, 0x76bc }, { 12765, 0xffd3 }, - /* 0x9a00 */ - { 12778, 0xeefe }, { 12791, 0x7e72 }, { 12801, 0x7ebd }, { 12813, 0xe7f7 }, - { 12826, 0xf77f }, { 12840, 0xcefd }, { 12852, 0x0ff5 }, { 12862, 0x0000 }, - { 12862, 0x0000 }, { 12862, 0x0000 }, { 12862, 0xa900 }, { 12866, 0xdb9b }, - { 12877, 0xa4c7 }, { 12885, 0x917f }, { 12895, 0xf8ca }, { 12904, 0x7ece }, - /* 0x9b00 */ - { 12915, 0x7d7a }, { 12926, 0xc7e7 }, { 12937, 0xcbbd }, { 12948, 0xdcae }, - { 12958, 0xfd7e }, { 12971, 0x8f76 }, { 12981, 0x91d3 }, { 12989, 0x7cf3 }, - { 13000, 0x01e5 }, { 13006, 0x4c2f }, { 13014, 0xed77 }, { 13026, 0xa360 }, - { 13032, 0x07db }, { 13041, 0x5ef8 }, { 13051, 0x1df7 }, { 13062, 0x2181 }, - /* 0x9c00 */ - { 13066, 0x6be0 }, { 13074, 0x309c }, { 13080, 0x3b3a }, { 13089, 0xfade }, - { 13101, 0x7f53 }, { 13112, 0xc3f5 }, { 13122, 0x61cd }, { 13130, 0x07ba }, - { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, - { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x26e0 }, { 13144, 0xbefe }, - /* 0x9d00 */ - { 13157, 0x03f9 }, { 13165, 0xebb5 }, { 13176, 0xe36d }, { 13186, 0xe9cb }, - { 13196, 0x9c2f }, { 13205, 0xbfde }, { 13218, 0x9f83 }, { 13227, 0xabbf }, - { 13239, 0x1ff7 }, { 13251, 0xffd5 }, { 13264, 0xb7df }, { 13277, 0xdffe }, - { 13291, 0xfdae }, { 13303, 0xffef }, { 13318, 0xfb7e }, { 13331, 0xeffd }, - /* 0x9e00 */ - { 13345, 0xaaff }, { 13357, 0x6ebf }, { 13369, 0x0000 }, { 13369, 0x0000 }, - { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0xb620 }, - { 13375, 0x7fcd }, { 13387, 0xbe9e }, { 13398, 0x62b3 }, { 13406, 0x58f1 }, - { 13414, 0xf10d }, { 13422, 0xfd7b }, { 13435, 0xe9f1 }, { 13445, 0xbefd }, - /* 0x9f00 */ - { 13458, 0xc6c3 }, { 13466, 0x5f6d }, { 13477, 0xff3d }, { 13490, 0x69ff }, - { 13502, 0xffcf }, { 13516, 0xfbf4 }, { 13528, 0xdcfb }, { 13540, 0x4ff7 }, - { 13552, 0x2000 }, { 13553, 0x1137 }, { 13560, 0x0015 }, -}; -static const Summary16 big5_uni2indx_pagefa[1] = { - /* 0xfa00 */ - { 13563, 0x3000 }, -}; -static const Summary16 big5_uni2indx_pagefe[23] = { - /* 0xfe00 */ - { 13565, 0x0000 }, { 13565, 0x0000 }, { 13565, 0x0000 }, { 13565, 0xfffb }, - { 13580, 0xfe1f }, { 13592, 0xfef5 }, { 13605, 0x0e7f }, { 13615, 0x0000 }, - { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, - { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, - /* 0xff00 */ - { 13615, 0xff7a }, { 13628, 0xffff }, { 13644, 0xffff }, { 13660, 0x97ff }, - { 13673, 0xfffe }, { 13688, 0x3fff }, { 13702, 0x0010 }, -}; - -static int -big5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - const Summary16 *summary = NULL; - if (wc < 0x0100) - summary = &big5_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x0200 && wc < 0x0460) - summary = &big5_uni2indx_page02[(wc>>4)-0x020]; - else if (wc >= 0x2000 && wc < 0x22c0) - summary = &big5_uni2indx_page20[(wc>>4)-0x200]; - else if (wc >= 0x2400 && wc < 0x2650) - summary = &big5_uni2indx_page24[(wc>>4)-0x240]; - else if (wc >= 0x3000 && wc < 0x33e0) - summary = &big5_uni2indx_page30[(wc>>4)-0x300]; - else if (wc >= 0x4e00 && wc < 0x9fb0) - summary = &big5_uni2indx_page4e[(wc>>4)-0x4e0]; - else if (wc >= 0xfa00 && wc < 0xfa10) - summary = &big5_uni2indx_pagefa[(wc>>4)-0xfa0]; - else if (wc >= 0xfe00 && wc < 0xff70) - summary = &big5_uni2indx_pagefe[(wc>>4)-0xfe0]; - if (summary) { - unsigned short used = summary->used; - unsigned int i = wc & 0x0f; - if (used & ((unsigned short) 1 << i)) { - unsigned short c; - /* Keep in `used' only the bits 0..i-1. */ - used &= ((unsigned short) 1 << i) - 1; - /* Add `summary->indx' and the number of bits set in `used'. */ - used = (used & 0x5555) + ((used & 0xaaaa) >> 1); - used = (used & 0x3333) + ((used & 0xcccc) >> 2); - used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); - used = (used & 0x00ff) + (used >> 8); - c = big5_2charset[summary->indx + used]; - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/big5_emacs.h b/nx-X11/lib/X11/lcUniConv/big5_emacs.h deleted file mode 100644 index 246aebeb4..000000000 --- a/nx-X11/lib/X11/lcUniConv/big5_emacs.h +++ /dev/null @@ -1,163 +0,0 @@ - -/* - * BIG5-0 and BIG5-1 - */ - -/* - BIG5 with its 13494 characters doesn't fit in a single 94x94 or 96x96 - block. Therefore Emacs/Mule developers, in a typically Japanese way of - thinking, have developed an alternative encoding of BIG5 in two 94x94 - planes, very similar to the SHIFT_JIS encoding for JISX0208. - - Conversion between BIG5 codes (s1,s2) and BIG5-0 codes (c1,c2): - Example. (s1,s2) = 0xA140, (c1,c2) = 0x2121. - 0xA1 <= s1 <= 0xC7, 0x40 <= s2 <= 0x7E || 0xA1 <= s2 <= 0xFE, - 0x21 <= c1 <= 0x62, 0x21 <= c2 <= 0x7E. - Invariant: - 157*(s1-0xA1) + (s2 < 0x80 ? s2-0x40 : s2-0x62) - = 94*(c1-0x21)+(c2-0x21) - Conversion (s1,s2) -> (c1,c2): - t := 157*(s1-0xA1) + (s2 < 0x80 ? s2-0x40 : s2-0x62) - c1 := (t div 94) + 0x21 - c2 := (t mod 94) + 0x21 - Conversion (c1,c2) -> (s1,s2): - t := 94*(c1-0x21)+(c2-0x21) - t2 := t mod 157 - s1 := (t div 157) + 0xA1 - s2 := (t2 < 0x3F ? t2+0x40 : t2+0x62) - - Conversion between BIG5 codes (s1,s2) and BIG5-1 codes (c1,c2): - Example. (s1,s2) = 0xC940, (c1,c2) = 0x2121. - 0xC9 <= s1 <= 0xF9, 0x40 <= s2 <= 0x7E || 0xA1 <= s2 <= 0xFE, - 0x21 <= c1 <= 0x72, 0x21 <= c2 <= 0x7E. - Invariant: - 157*(s1-0xC9) + (s2 < 0x80 ? s2-0x40 : s2-0x62) - = 94*(c1-0x21)+(c2-0x21) - Conversion (s1,s2) -> (c1,c2): - t := 157*(s1-0xC9) + (s2 < 0x80 ? s2-0x40 : s2-0x62) - c1 := (t div 94) + 0x21 - c2 := (t mod 94) + 0x21 - Conversion (c1,c2) -> (s1,s2): - t := 94*(c1-0x21)+(c2-0x21) - t2 := t mod 157 - s1 := (t div 157) + 0xC9 - s2 := (t2 < 0x3F ? t2+0x40 : t2+0x62) - */ - -static int -big5_0_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = s[0]; - if (c1 >= 0x21 && c1 <= 0x62) { - if (n >= 2) { - unsigned char c2 = s[1]; - if (c2 >= 0x21 && c2 <= 0x7e) { - unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); - if (0) { - /* Unoptimized. */ - unsigned char buf[2]; - buf[0] = (i / 157) + 0xa1; - i = i % 157; - buf[1] = i + (i < 0x3f ? 0x40 : 0x62); - return big5_mbtowc(conv,pwc,buf,2); - } else { - /* Inline the implementation of big5_mbtowc. */ - if (i < 6121) { - unsigned short wc = big5_2uni_pagea1[i]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static int -big5_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = s[0]; - if (c1 >= 0x21 && c1 <= 0x72) { - if (n >= 2) { - unsigned char c2 = s[1]; - if (c2 >= 0x21 && c2 <= 0x7e) { - unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); - if (0) { - /* Unoptimized. */ - unsigned char buf[2]; - buf[0] = (i / 157) + 0xc9; - i = i % 157; - buf[1] = i + (i < 0x3f ? 0x40 : 0x62); - return big5_mbtowc(conv,pwc,buf,2); - } else { - /* Inline the implementation of big5_mbtowc. */ - if (i < 7652) { - unsigned short wc = big5_2uni_pagec9[i]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static int -big5_0_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - unsigned char buf[2]; - int ret = big5_wctomb(conv,buf,wc,2); - if (ret != RET_ILSEQ) { - unsigned char s1, s2; - if (ret != 2) abort(); - s1 = buf[0]; - s2 = buf[1]; - if (!(s1 >= 0xa1)) abort(); - if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort(); - if (s1 < 0xc9) { - unsigned int t = 157 * (s1 - 0xa1) + s2 - (s2 < 0x80 ? 0x40 : 0x62); - r[0] = (t / 94) + 0x21; - r[1] = (t % 94) + 0x21; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} - -static int -big5_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - unsigned char buf[2]; - int ret = big5_wctomb(conv,buf,wc,2); - if (ret != RET_ILSEQ) { - unsigned char s1, s2; - if (ret != 2) abort(); - s1 = buf[0]; - s2 = buf[1]; - if (!(s1 <= 0xf9)) abort(); - if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort(); - if (s1 >= 0xc9) { - unsigned int t = 157 * (s1 - 0xc9) + s2 - (s2 < 0x80 ? 0x40 : 0x62); - r[0] = (t / 94) + 0x21; - r[1] = (t % 94) + 0x21; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/big5hkscs.h b/nx-X11/lib/X11/lcUniConv/big5hkscs.h deleted file mode 100644 index 721d1228e..000000000 --- a/nx-X11/lib/X11/lcUniConv/big5hkscs.h +++ /dev/null @@ -1,6252 +0,0 @@ - -/* - * BIG5-HKSCS - */ - -static const unsigned short big5hkscs_2uni_page81[19782] = { - /* 0x81 */ - 0xeeb8, 0xeeb9, 0xeeba, 0xeebb, 0xeebc, 0xeebd, 0xeebe, 0xeebf, - 0xeec0, 0xeec1, 0xeec2, 0xeec3, 0xeec4, 0xeec5, 0xeec6, 0xeec7, - 0xeec8, 0xeec9, 0xeeca, 0xeecb, 0xeecc, 0xeecd, 0xeece, 0xeecf, - 0xeed0, 0xeed1, 0xeed2, 0xeed3, 0xeed4, 0xeed5, 0xeed6, 0xeed7, - 0xeed8, 0xeed9, 0xeeda, 0xeedb, 0xeedc, 0xeedd, 0xeede, 0xeedf, - 0xeee0, 0xeee1, 0xeee2, 0xeee3, 0xeee4, 0xeee5, 0xeee6, 0xeee7, - 0xeee8, 0xeee9, 0xeeea, 0xeeeb, 0xeeec, 0xeeed, 0xeeee, 0xeeef, - 0xeef0, 0xeef1, 0xeef2, 0xeef3, 0xeef4, 0xeef5, 0xeef6, 0xeef7, - 0xeef8, 0xeef9, 0xeefa, 0xeefb, 0xeefc, 0xeefd, 0xeefe, 0xeeff, - 0xef00, 0xef01, 0xef02, 0xef03, 0xef04, 0xef05, 0xef06, 0xef07, - 0xef08, 0xef09, 0xef0a, 0xef0b, 0xef0c, 0xef0d, 0xef0e, 0xef0f, - 0xef10, 0xef11, 0xef12, 0xef13, 0xef14, 0xef15, 0xef16, 0xef17, - 0xef18, 0xef19, 0xef1a, 0xef1b, 0xef1c, 0xef1d, 0xef1e, 0xef1f, - 0xef20, 0xef21, 0xef22, 0xef23, 0xef24, 0xef25, 0xef26, 0xef27, - 0xef28, 0xef29, 0xef2a, 0xef2b, 0xef2c, 0xef2d, 0xef2e, 0xef2f, - 0xef30, 0xef31, 0xef32, 0xef33, 0xef34, 0xef35, 0xef36, 0xef37, - 0xef38, 0xef39, 0xef3a, 0xef3b, 0xef3c, 0xef3d, 0xef3e, 0xef3f, - 0xef40, 0xef41, 0xef42, 0xef43, 0xef44, 0xef45, 0xef46, 0xef47, - 0xef48, 0xef49, 0xef4a, 0xef4b, 0xef4c, 0xef4d, 0xef4e, 0xef4f, - 0xef50, 0xef51, 0xef52, 0xef53, 0xef54, - /* 0x82 */ - 0xef55, 0xef56, 0xef57, 0xef58, 0xef59, 0xef5a, 0xef5b, 0xef5c, - 0xef5d, 0xef5e, 0xef5f, 0xef60, 0xef61, 0xef62, 0xef63, 0xef64, - 0xef65, 0xef66, 0xef67, 0xef68, 0xef69, 0xef6a, 0xef6b, 0xef6c, - 0xef6d, 0xef6e, 0xef6f, 0xef70, 0xef71, 0xef72, 0xef73, 0xef74, - 0xef75, 0xef76, 0xef77, 0xef78, 0xef79, 0xef7a, 0xef7b, 0xef7c, - 0xef7d, 0xef7e, 0xef7f, 0xef80, 0xef81, 0xef82, 0xef83, 0xef84, - 0xef85, 0xef86, 0xef87, 0xef88, 0xef89, 0xef8a, 0xef8b, 0xef8c, - 0xef8d, 0xef8e, 0xef8f, 0xef90, 0xef91, 0xef92, 0xef93, 0xef94, - 0xef95, 0xef96, 0xef97, 0xef98, 0xef99, 0xef9a, 0xef9b, 0xef9c, - 0xef9d, 0xef9e, 0xef9f, 0xefa0, 0xefa1, 0xefa2, 0xefa3, 0xefa4, - 0xefa5, 0xefa6, 0xefa7, 0xefa8, 0xefa9, 0xefaa, 0xefab, 0xefac, - 0xefad, 0xefae, 0xefaf, 0xefb0, 0xefb1, 0xefb2, 0xefb3, 0xefb4, - 0xefb5, 0xefb6, 0xefb7, 0xefb8, 0xefb9, 0xefba, 0xefbb, 0xefbc, - 0xefbd, 0xefbe, 0xefbf, 0xefc0, 0xefc1, 0xefc2, 0xefc3, 0xefc4, - 0xefc5, 0xefc6, 0xefc7, 0xefc8, 0xefc9, 0xefca, 0xefcb, 0xefcc, - 0xefcd, 0xefce, 0xefcf, 0xefd0, 0xefd1, 0xefd2, 0xefd3, 0xefd4, - 0xefd5, 0xefd6, 0xefd7, 0xefd8, 0xefd9, 0xefda, 0xefdb, 0xefdc, - 0xefdd, 0xefde, 0xefdf, 0xefe0, 0xefe1, 0xefe2, 0xefe3, 0xefe4, - 0xefe5, 0xefe6, 0xefe7, 0xefe8, 0xefe9, 0xefea, 0xefeb, 0xefec, - 0xefed, 0xefee, 0xefef, 0xeff0, 0xeff1, - /* 0x83 */ - 0xeff2, 0xeff3, 0xeff4, 0xeff5, 0xeff6, 0xeff7, 0xeff8, 0xeff9, - 0xeffa, 0xeffb, 0xeffc, 0xeffd, 0xeffe, 0xefff, 0xf000, 0xf001, - 0xf002, 0xf003, 0xf004, 0xf005, 0xf006, 0xf007, 0xf008, 0xf009, - 0xf00a, 0xf00b, 0xf00c, 0xf00d, 0xf00e, 0xf00f, 0xf010, 0xf011, - 0xf012, 0xf013, 0xf014, 0xf015, 0xf016, 0xf017, 0xf018, 0xf019, - 0xf01a, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf020, 0xf021, - 0xf022, 0xf023, 0xf024, 0xf025, 0xf026, 0xf027, 0xf028, 0xf029, - 0xf02a, 0xf02b, 0xf02c, 0xf02d, 0xf02e, 0xf02f, 0xf030, 0xf031, - 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, - 0xf03a, 0xf03b, 0xf03c, 0xf03d, 0xf03e, 0xf03f, 0xf040, 0xf041, - 0xf042, 0xf043, 0xf044, 0xf045, 0xf046, 0xf047, 0xf048, 0xf049, - 0xf04a, 0xf04b, 0xf04c, 0xf04d, 0xf04e, 0xf04f, 0xf050, 0xf051, - 0xf052, 0xf053, 0xf054, 0xf055, 0xf056, 0xf057, 0xf058, 0xf059, - 0xf05a, 0xf05b, 0xf05c, 0xf05d, 0xf05e, 0xf05f, 0xf060, 0xf061, - 0xf062, 0xf063, 0xf064, 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, - 0xf06a, 0xf06b, 0xf06c, 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, - 0xf072, 0xf073, 0xf074, 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, - 0xf07a, 0xf07b, 0xf07c, 0xf07d, 0xf07e, 0xf07f, 0xf080, 0xf081, - 0xf082, 0xf083, 0xf084, 0xf085, 0xf086, 0xf087, 0xf088, 0xf089, - 0xf08a, 0xf08b, 0xf08c, 0xf08d, 0xf08e, - /* 0x84 */ - 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, 0xf094, 0xf095, 0xf096, - 0xf097, 0xf098, 0xf099, 0xf09a, 0xf09b, 0xf09c, 0xf09d, 0xf09e, - 0xf09f, 0xf0a0, 0xf0a1, 0xf0a2, 0xf0a3, 0xf0a4, 0xf0a5, 0xf0a6, - 0xf0a7, 0xf0a8, 0xf0a9, 0xf0aa, 0xf0ab, 0xf0ac, 0xf0ad, 0xf0ae, - 0xf0af, 0xf0b0, 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xf0b6, - 0xf0b7, 0xf0b8, 0xf0b9, 0xf0ba, 0xf0bb, 0xf0bc, 0xf0bd, 0xf0be, - 0xf0bf, 0xf0c0, 0xf0c1, 0xf0c2, 0xf0c3, 0xf0c4, 0xf0c5, 0xf0c6, - 0xf0c7, 0xf0c8, 0xf0c9, 0xf0ca, 0xf0cb, 0xf0cc, 0xf0cd, 0xf0ce, - 0xf0cf, 0xf0d0, 0xf0d1, 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, - 0xf0d7, 0xf0d8, 0xf0d9, 0xf0da, 0xf0db, 0xf0dc, 0xf0dd, 0xf0de, - 0xf0df, 0xf0e0, 0xf0e1, 0xf0e2, 0xf0e3, 0xf0e4, 0xf0e5, 0xf0e6, - 0xf0e7, 0xf0e8, 0xf0e9, 0xf0ea, 0xf0eb, 0xf0ec, 0xf0ed, 0xf0ee, - 0xf0ef, 0xf0f0, 0xf0f1, 0xf0f2, 0xf0f3, 0xf0f4, 0xf0f5, 0xf0f6, - 0xf0f7, 0xf0f8, 0xf0f9, 0xf0fa, 0xf0fb, 0xf0fc, 0xf0fd, 0xf0fe, - 0xf0ff, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, - 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e, - 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf114, 0xf115, 0xf116, - 0xf117, 0xf118, 0xf119, 0xf11a, 0xf11b, 0xf11c, 0xf11d, 0xf11e, - 0xf11f, 0xf120, 0xf121, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, - 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, - /* 0x85 */ - 0xf12c, 0xf12d, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, - 0xf134, 0xf135, 0xf136, 0xf137, 0xf138, 0xf139, 0xf13a, 0xf13b, - 0xf13c, 0xf13d, 0xf13e, 0xf13f, 0xf140, 0xf141, 0xf142, 0xf143, - 0xf144, 0xf145, 0xf146, 0xf147, 0xf148, 0xf149, 0xf14a, 0xf14b, - 0xf14c, 0xf14d, 0xf14e, 0xf14f, 0xf150, 0xf151, 0xf152, 0xf153, - 0xf154, 0xf155, 0xf156, 0xf157, 0xf158, 0xf159, 0xf15a, 0xf15b, - 0xf15c, 0xf15d, 0xf15e, 0xf15f, 0xf160, 0xf161, 0xf162, 0xf163, - 0xf164, 0xf165, 0xf166, 0xf167, 0xf168, 0xf169, 0xf16a, 0xf16b, - 0xf16c, 0xf16d, 0xf16e, 0xf16f, 0xf170, 0xf171, 0xf172, 0xf173, - 0xf174, 0xf175, 0xf176, 0xf177, 0xf178, 0xf179, 0xf17a, 0xf17b, - 0xf17c, 0xf17d, 0xf17e, 0xf17f, 0xf180, 0xf181, 0xf182, 0xf183, - 0xf184, 0xf185, 0xf186, 0xf187, 0xf188, 0xf189, 0xf18a, 0xf18b, - 0xf18c, 0xf18d, 0xf18e, 0xf18f, 0xf190, 0xf191, 0xf192, 0xf193, - 0xf194, 0xf195, 0xf196, 0xf197, 0xf198, 0xf199, 0xf19a, 0xf19b, - 0xf19c, 0xf19d, 0xf19e, 0xf19f, 0xf1a0, 0xf1a1, 0xf1a2, 0xf1a3, - 0xf1a4, 0xf1a5, 0xf1a6, 0xf1a7, 0xf1a8, 0xf1a9, 0xf1aa, 0xf1ab, - 0xf1ac, 0xf1ad, 0xf1ae, 0xf1af, 0xf1b0, 0xf1b1, 0xf1b2, 0xf1b3, - 0xf1b4, 0xf1b5, 0xf1b6, 0xf1b7, 0xf1b8, 0xf1b9, 0xf1ba, 0xf1bb, - 0xf1bc, 0xf1bd, 0xf1be, 0xf1bf, 0xf1c0, 0xf1c1, 0xf1c2, 0xf1c3, - 0xf1c4, 0xf1c5, 0xf1c6, 0xf1c7, 0xf1c8, - /* 0x86 */ - 0xf1c9, 0xf1ca, 0xf1cb, 0xf1cc, 0xf1cd, 0xf1ce, 0xf1cf, 0xf1d0, - 0xf1d1, 0xf1d2, 0xf1d3, 0xf1d4, 0xf1d5, 0xf1d6, 0xf1d7, 0xf1d8, - 0xf1d9, 0xf1da, 0xf1db, 0xf1dc, 0xf1dd, 0xf1de, 0xf1df, 0xf1e0, - 0xf1e1, 0xf1e2, 0xf1e3, 0xf1e4, 0xf1e5, 0xf1e6, 0xf1e7, 0xf1e8, - 0xf1e9, 0xf1ea, 0xf1eb, 0xf1ec, 0xf1ed, 0xf1ee, 0xf1ef, 0xf1f0, - 0xf1f1, 0xf1f2, 0xf1f3, 0xf1f4, 0xf1f5, 0xf1f6, 0xf1f7, 0xf1f8, - 0xf1f9, 0xf1fa, 0xf1fb, 0xf1fc, 0xf1fd, 0xf1fe, 0xf1ff, 0xf200, - 0xf201, 0xf202, 0xf203, 0xf204, 0xf205, 0xf206, 0xf207, 0xf208, - 0xf209, 0xf20a, 0xf20b, 0xf20c, 0xf20d, 0xf20e, 0xf20f, 0xf210, - 0xf211, 0xf212, 0xf213, 0xf214, 0xf215, 0xf216, 0xf217, 0xf218, - 0xf219, 0xf21a, 0xf21b, 0xf21c, 0xf21d, 0xf21e, 0xf21f, 0xf220, - 0xf221, 0xf222, 0xf223, 0xf224, 0xf225, 0xf226, 0xf227, 0xf228, - 0xf229, 0xf22a, 0xf22b, 0xf22c, 0xf22d, 0xf22e, 0xf22f, 0xf230, - 0xf231, 0xf232, 0xf233, 0xf234, 0xf235, 0xf236, 0xf237, 0xf238, - 0xf239, 0xf23a, 0xf23b, 0xf23c, 0xf23d, 0xf23e, 0xf23f, 0xf240, - 0xf241, 0xf242, 0xf243, 0xf244, 0xf245, 0xf246, 0xf247, 0xf248, - 0xf249, 0xf24a, 0xf24b, 0xf24c, 0xf24d, 0xf24e, 0xf24f, 0xf250, - 0xf251, 0xf252, 0xf253, 0xf254, 0xf255, 0xf256, 0xf257, 0xf258, - 0xf259, 0xf25a, 0xf25b, 0xf25c, 0xf25d, 0xf25e, 0xf25f, 0xf260, - 0xf261, 0xf262, 0xf263, 0xf264, 0xf265, - /* 0x87 */ - 0xf266, 0xf267, 0xf268, 0xf269, 0xf26a, 0xf26b, 0xf26c, 0xf26d, - 0xf26e, 0xf26f, 0xf270, 0xf271, 0xf272, 0xf273, 0xf274, 0xf275, - 0xf276, 0xf277, 0xf278, 0xf279, 0xf27a, 0xf27b, 0xf27c, 0xf27d, - 0xf27e, 0xf27f, 0xf280, 0xf281, 0xf282, 0xf283, 0xf284, 0xf285, - 0xf286, 0xf287, 0xf288, 0xf289, 0xf28a, 0xf28b, 0xf28c, 0xf28d, - 0xf28e, 0xf28f, 0xf290, 0xf291, 0xf292, 0xf293, 0xf294, 0xf295, - 0xf296, 0xf297, 0xf298, 0xf299, 0xf29a, 0xf29b, 0xf29c, 0xf29d, - 0xf29e, 0xf29f, 0xf2a0, 0xf2a1, 0xf2a2, 0xf2a3, 0xf2a4, 0xf2a5, - 0xf2a6, 0xf2a7, 0xf2a8, 0xf2a9, 0xf2aa, 0xf2ab, 0xf2ac, 0xf2ad, - 0xf2ae, 0xf2af, 0xf2b0, 0xf2b1, 0xf2b2, 0xf2b3, 0xf2b4, 0xf2b5, - 0xf2b6, 0xf2b7, 0xf2b8, 0xf2b9, 0xf2ba, 0xf2bb, 0xf2bc, 0xf2bd, - 0xf2be, 0xf2bf, 0xf2c0, 0xf2c1, 0xf2c2, 0xf2c3, 0xf2c4, 0xf2c5, - 0xf2c6, 0xf2c7, 0xf2c8, 0xf2c9, 0xf2ca, 0xf2cb, 0xf2cc, 0xf2cd, - 0xf2ce, 0xf2cf, 0xf2d0, 0xf2d1, 0xf2d2, 0xf2d3, 0xf2d4, 0xf2d5, - 0xf2d6, 0xf2d7, 0xf2d8, 0xf2d9, 0xf2da, 0xf2db, 0xf2dc, 0xf2dd, - 0xf2de, 0xf2df, 0xf2e0, 0xf2e1, 0xf2e2, 0xf2e3, 0xf2e4, 0xf2e5, - 0xf2e6, 0xf2e7, 0xf2e8, 0xf2e9, 0xf2ea, 0xf2eb, 0xf2ec, 0xf2ed, - 0xf2ee, 0xf2ef, 0xf2f0, 0xf2f1, 0xf2f2, 0xf2f3, 0xf2f4, 0xf2f5, - 0xf2f6, 0xf2f7, 0xf2f8, 0xf2f9, 0xf2fa, 0xf2fb, 0xf2fc, 0xf2fd, - 0xf2fe, 0xf2ff, 0xf300, 0xf301, 0xf302, - /* 0x88 */ - 0xf303, 0xf304, 0xf305, 0xf306, 0xf307, 0xf308, 0xf309, 0xf30a, - 0xf30b, 0xf30c, 0xf30d, 0xf30e, 0xf30f, 0xf310, 0xf311, 0xf312, - 0xf313, 0xf314, 0xf315, 0xf316, 0xf317, 0xf318, 0x0100, 0x00c1, - 0x01cd, 0x00c0, 0x0112, 0x00c9, 0x011a, 0x00c8, 0x014c, 0x00d3, - 0x01d1, 0x00d2, 0xf325, 0x1ebe, 0xf327, 0x1ec0, 0x00ca, 0x0101, - 0x00e1, 0x01ce, 0x00e0, 0x0251, 0x0113, 0x00e9, 0x011b, 0x00e8, - 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, - 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, - 0x00fc, 0xf344, 0x1ebf, 0xf346, 0x1ec1, 0x00ea, 0x0261, 0xf34a, - 0xf34b, 0xf34c, 0xf34d, 0xf34e, 0xf34f, 0xf350, 0xf351, 0xf352, - 0xf353, 0xf354, 0xf355, 0xf356, 0xf357, 0xf358, 0xf359, 0xf35a, - 0xf35b, 0xf35c, 0xf35d, 0xf35e, 0xf35f, 0xf360, 0xf361, 0xf362, - 0xf363, 0xf364, 0xf365, 0xf366, 0xf367, 0xf368, 0xf369, 0xf36a, - 0xf36b, 0xf36c, 0xf36d, 0xf36e, 0xf36f, 0xf370, 0xf371, 0xf372, - 0xf373, 0xf374, 0xf375, 0xf376, 0xf377, 0xf378, 0xf379, 0xf37a, - 0xf37b, 0xf37c, 0xf37d, 0xf37e, 0xf37f, 0xf380, 0xf381, 0xf382, - 0xf383, 0xf384, 0xf385, 0xf386, 0xf387, 0xf388, 0xf389, 0xf38a, - 0xf38b, 0xf38c, 0xf38d, 0xf38e, 0xf38f, 0xf390, 0xf391, 0xf392, - 0xf393, 0xf394, 0xf395, 0xf396, 0xf397, 0xf398, 0xf399, 0xf39a, - 0xf39b, 0xf39c, 0xf39d, 0xf39e, 0xf39f, - /* 0x89 */ - 0xf3a0, 0xf3a1, 0xf3a2, 0x650a, 0xf3a4, 0xf3a5, 0x4e3d, 0x6edd, - 0x9d4e, 0x91df, 0xf3aa, 0xf3ab, 0xf3ac, 0x6491, 0x4f1a, 0x4f28, - 0x4fa8, 0x5156, 0x5174, 0x519c, 0x51e4, 0x52a1, 0x52a8, 0x533b, - 0x534e, 0x53d1, 0x53d8, 0x56e2, 0x58f0, 0x5904, 0x5907, 0x5932, - 0x5934, 0x5b66, 0x5b9e, 0x5b9f, 0x5c9a, 0x5e86, 0x603b, 0x6589, - 0x67fe, 0x6804, 0x6865, 0x6d4e, 0x70bc, 0x7535, 0x7ea4, 0x7eac, - 0x7eba, 0x7ec7, 0x7ecf, 0x7edf, 0x7f06, 0x7f37, 0x827a, 0x82cf, - 0x836f, 0x89c6, 0x8bbe, 0x8be2, 0x8f66, 0x8f67, 0x8f6e, 0x7411, - 0x7cfc, 0x7dcd, 0x6946, 0x7ac9, 0x5227, 0xf3e5, 0xf3e6, 0xf3e7, - 0xf3e8, 0x918c, 0x78b8, 0x915e, 0x80bc, 0xf3ed, 0x8d0b, 0x80f6, - 0xf3f0, 0xf3f1, 0xf3f2, 0x809f, 0x9ec7, 0x4ccd, 0x9dc9, 0x9e0c, - 0x4c3e, 0xf3f9, 0xf3fa, 0x9e0a, 0xf3fc, 0x35c1, 0xf3fe, 0x6e9a, - 0x823e, 0x7519, 0xf402, 0x4911, 0x9a6c, 0x9a8f, 0x9f99, 0x7987, - 0xf408, 0xf409, 0xf40a, 0xf40b, 0x4e24, 0x4e81, 0x4e80, 0x4e87, - 0x4ebf, 0x4eeb, 0x4f37, 0x344c, 0x4fbd, 0x3e48, 0x5003, 0x5088, - 0x347d, 0x3493, 0x34a5, 0x5186, 0x5905, 0x51db, 0x51fc, 0x5205, - 0x4e89, 0x5279, 0x5290, 0x5327, 0x35c7, 0x53a9, 0x3551, 0x53b0, - 0x3553, 0x53c2, 0x5423, 0x356d, 0x3572, 0x3681, 0x5493, 0x54a3, - 0x54b4, 0x54b9, 0x54d0, 0x54ef, 0x5518, 0x5523, 0x5528, 0x3598, - 0x553f, 0x35a5, 0x35bf, 0x55d7, 0x35c5, - /* 0x8a */ - 0xf43d, 0x5525, 0xf43f, 0xf440, 0xf441, 0xf442, 0x5590, 0xf444, - 0x39ec, 0xf446, 0x8e46, 0xf448, 0xf449, 0x4053, 0xf44b, 0x777a, - 0xf44d, 0x3a34, 0x47d5, 0xf450, 0xf451, 0xf452, 0x64dd, 0xf454, - 0xf455, 0xf456, 0xf457, 0x648d, 0x8e7e, 0xf45a, 0xf45b, 0xf45c, - 0xf45d, 0xf45e, 0xf45f, 0xf460, 0xf461, 0xf462, 0xf463, 0x47f4, - 0xf465, 0xf466, 0x9ab2, 0x3a67, 0xf469, 0x3fed, 0x3506, 0xf46c, - 0xf46d, 0xf46e, 0xf46f, 0x9d6e, 0x9815, 0xf472, 0x43d9, 0xf474, - 0x64b4, 0x54e3, 0xf477, 0xf478, 0xf479, 0x39fb, 0xf47b, 0xf47c, - 0xf47d, 0xf47e, 0x64ea, 0xf480, 0xf481, 0x8e68, 0xf483, 0xf484, - 0xf485, 0xf486, 0x480b, 0xf488, 0x3ffa, 0x5873, 0xf48b, 0xf48c, - 0xf48d, 0xf48e, 0xf48f, 0xf490, 0xf491, 0x5579, 0x40bb, 0x43ba, - 0xf495, 0x4ab4, 0xf497, 0xf498, 0x81aa, 0x98f5, 0xf49b, 0x6379, - 0x39fe, 0xf49e, 0x8dc0, 0x56a1, 0x647c, 0x3e43, 0xf4a3, 0xf4a4, - 0xf4a5, 0xf4a6, 0xf4a7, 0xf4a8, 0xf4a9, 0xf4aa, 0x3992, 0x3a06, - 0xf4ad, 0x3578, 0xf4af, 0xf4b0, 0x5652, 0xf4b2, 0xf4b3, 0xf4b4, - 0x34bc, 0x6c3d, 0xf4b7, 0xf4b8, 0xf4b9, 0xf4ba, 0xf4bb, 0xf4bc, - 0xf4bd, 0xf4be, 0xf4bf, 0xf4c0, 0xf4c1, 0x7f93, 0xf4c3, 0xf4c4, - 0xf4c5, 0x35fb, 0xf4c7, 0xf4c8, 0xf4c9, 0xf4ca, 0x3f93, 0xf4cc, - 0xf4cd, 0xf4ce, 0xf4cf, 0xf4d0, 0xf4d1, 0xf4d2, 0xf4d3, 0xf4d4, - 0xf4d5, 0x3ff9, 0xf4d7, 0x6432, 0xf4d9, - /* 0x8b */ - 0xf4da, 0xf4db, 0xf4dc, 0xf4dd, 0xf4de, 0xf4df, 0xf4e0, 0x3a18, - 0xf4e2, 0xf4e3, 0xf4e4, 0xf4e5, 0xf4e6, 0xf4e7, 0xf4e8, 0xf4e9, - 0x95aa, 0x54cc, 0x82c4, 0x55b9, 0xf4ee, 0xf4ef, 0x9c26, 0x9ab6, - 0xf4f2, 0xf4f3, 0x7140, 0x816d, 0x80ec, 0x5c1c, 0xf4f8, 0x8134, - 0x3797, 0x535f, 0xf4fc, 0x91b6, 0xf4fe, 0xf4ff, 0xf500, 0xf501, - 0x35dd, 0xf503, 0x3609, 0xf505, 0x56af, 0xf507, 0xf508, 0xf509, - 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, - 0x5a54, 0xf513, 0xf514, 0xf515, 0xf516, 0x579c, 0xf518, 0xf519, - 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0x3703, 0xf51f, 0xf520, 0xf521, - 0xf522, 0xf523, 0xf524, 0xf525, 0xf526, 0x5899, 0x5268, 0x361a, - 0xf52a, 0x7bb2, 0x5b68, 0x4800, 0x4b2c, 0x9f27, 0x49e7, 0x9c1f, - 0x9b8d, 0xf533, 0xf534, 0x55fb, 0x35f2, 0x5689, 0x4e28, 0x5902, - 0xf53a, 0xf53b, 0x9751, 0xf53d, 0x4e5b, 0x4ebb, 0x353e, 0x5c23, - 0x5f51, 0x5fc4, 0x38fa, 0x624c, 0x6535, 0x6b7a, 0x6c35, 0x6c3a, - 0x706c, 0x722b, 0x4e2c, 0x72ad, 0xf54e, 0x7f52, 0x793b, 0x7cf9, - 0x7f53, 0xf553, 0x34c1, 0xf555, 0xf556, 0x8002, 0x8080, 0xf559, - 0xf55a, 0x535d, 0x8864, 0x89c1, 0xf55e, 0x8ba0, 0x8d1d, 0x9485, - 0x9578, 0x957f, 0x95e8, 0xf565, 0x97e6, 0x9875, 0x98ce, 0x98de, - 0x9963, 0xf56b, 0x9c7c, 0x9e1f, 0x9ec4, 0x6b6f, 0xf907, 0x4e37, - 0xf572, 0x961d, 0x6237, 0x94a2, 0xf576, - /* 0x8c */ - 0x503b, 0x6dfe, 0xf579, 0xf57a, 0x3dc9, 0x888f, 0xf57d, 0x7077, - 0x5cf5, 0x4b20, 0xf581, 0x3559, 0xf583, 0x6122, 0xf585, 0x8fa7, - 0x91f6, 0x7191, 0x6719, 0x73ba, 0xf58b, 0xf58c, 0x3c8b, 0xf58e, - 0x4b10, 0x78e4, 0x7402, 0x51ae, 0xf593, 0x4009, 0x6a63, 0xf596, - 0x4223, 0x860f, 0xf599, 0x7a2a, 0xf59b, 0xf59c, 0x9755, 0x704d, - 0x5324, 0xf5a0, 0x93f4, 0x76d9, 0xf5a3, 0xf5a4, 0x77dd, 0x4ea3, - 0x4ff0, 0x50bc, 0x4e2f, 0x4f17, 0xf5ab, 0x5434, 0x7d8b, 0x5892, - 0x58d0, 0xf5b0, 0x5e92, 0x5e99, 0x5fc2, 0xf5b4, 0x658b, 0xf5b6, - 0x6919, 0x6a43, 0xf5b9, 0x6cff, 0xf5bb, 0x7200, 0xf5bd, 0x738c, - 0x3edb, 0xf5c0, 0x5b15, 0x74b9, 0x8b83, 0xf5c4, 0xf5c5, 0x7a93, - 0x7bec, 0x7cc3, 0x7e6c, 0x82f8, 0x8597, 0xf5cc, 0x8890, 0xf5ce, - 0x8eb9, 0xf5d0, 0x8fcf, 0x855f, 0x99e0, 0x9221, 0xf5d5, 0xf5d6, - 0xf5d7, 0x4071, 0x42a2, 0x5a1a, 0xf5db, 0xf5dc, 0xf5dd, 0x9868, - 0x676b, 0x4276, 0x573d, 0xf5e2, 0x85d6, 0xf5e4, 0x82bf, 0xf5e6, - 0x4c81, 0xf5e8, 0x5d7b, 0xf5ea, 0xf5eb, 0xf5ec, 0xf5ed, 0x5b96, - 0xf5ef, 0xf5f0, 0x7e5b, 0xf5f2, 0xf5f3, 0xf5f4, 0xf5f5, 0xf5f6, - 0xf5f7, 0xf5f8, 0xf5f9, 0xf5fa, 0xf5fb, 0xf5fc, 0xf5fd, 0xf5fe, - 0xf5ff, 0xf600, 0xf601, 0xf602, 0xf603, 0xf604, 0xf605, 0xf606, - 0xf607, 0xf608, 0xf609, 0xf60a, 0xf60b, 0xf60c, 0xf60d, 0xf60e, - 0xf60f, 0xf610, 0xf611, 0xf612, 0xf613, - /* 0x8d */ - 0xf614, 0xf615, 0xf616, 0xf617, 0xf618, 0xf619, 0xf61a, 0xf61b, - 0xf61c, 0xf61d, 0xf61e, 0xf61f, 0xf620, 0xf621, 0xf622, 0xf623, - 0xf624, 0xf625, 0xf626, 0xf627, 0xf628, 0xf629, 0xf62a, 0xf62b, - 0xf62c, 0xf62d, 0xf62e, 0xf62f, 0xf630, 0xf631, 0xf632, 0xf633, - 0x5d3e, 0x5d48, 0x5d56, 0x3dfc, 0x380f, 0x5da4, 0x5db9, 0x3820, - 0x3838, 0x5e42, 0x5ebd, 0x5f25, 0x5f83, 0x3908, 0x3914, 0x393f, - 0x394d, 0x60d7, 0x613d, 0x5ce5, 0x3989, 0x61b7, 0x61b9, 0x61cf, - 0x39b8, 0x622c, 0x6290, 0x62e5, 0x6318, 0x39f8, 0x56b1, 0x3a03, - 0x63e2, 0x63fb, 0x6407, 0x645a, 0x3a4b, 0x64c0, 0x5d15, 0x5621, - 0x9f9f, 0x3a97, 0x6586, 0x3abd, 0x65ff, 0x6653, 0x3af2, 0x6692, - 0x3b22, 0x6716, 0x3b42, 0x67a4, 0x6800, 0x3b58, 0x684a, 0x6884, - 0x3b72, 0x3b71, 0x3b7b, 0x6909, 0x6943, 0x725c, 0x6964, 0x699f, - 0x6985, 0x3bbc, 0x69d6, 0x3bdd, 0x6a65, 0x6a74, 0x6a71, 0x6a82, - 0x3bec, 0x6a99, 0x3bf2, 0x6aab, 0x6ab5, 0x6ad4, 0x6af6, 0x6b81, - 0x6bc1, 0x6bea, 0x6c75, 0x6caa, 0x3ccb, 0x6d02, 0x6d06, 0x6d26, - 0x6d81, 0x3cef, 0x6da4, 0x6db1, 0x6e15, 0x6e18, 0x6e29, 0x6e86, - 0xf694, 0x6ebb, 0x6ee2, 0x6eda, 0x9f7f, 0x6ee8, 0x6ee9, 0x6f24, - 0x6f34, 0x3d46, 0xf69e, 0x6f81, 0x6fbe, 0x3d6a, 0x3d75, 0x71b7, - 0x5c99, 0x3d8a, 0x702c, 0x3d91, 0x7050, 0x7054, 0x706f, 0x707f, - 0x7089, 0xf6ad, 0x43c1, 0x35f1, 0xf6b0, - /* 0x8e */ - 0xe311, 0x57be, 0xe313, 0x713e, 0xe315, 0x364e, 0x69a2, 0xe318, - 0x5b74, 0x7a49, 0xe31b, 0xe31c, 0x7a65, 0x7a7d, 0xe31f, 0x7abb, - 0x7ab0, 0x7ac2, 0x7ac3, 0x71d1, 0xe325, 0x41ca, 0x7ada, 0x7add, - 0x7aea, 0x41ef, 0x54b2, 0xe32c, 0x7b0b, 0x7b55, 0x7b29, 0xe330, - 0xe331, 0x7ba2, 0x7b6f, 0x839c, 0xe335, 0xe336, 0x7bd0, 0x8421, - 0x7b92, 0x7bb8, 0xe33b, 0x3dad, 0xe33d, 0x8492, 0x7bfa, 0x7c06, - 0x7c35, 0xe342, 0x7c44, 0x7c83, 0xe345, 0x7ca6, 0x667d, 0xe348, - 0x7cc9, 0x7cc7, 0x7ce6, 0x7c74, 0x7cf3, 0x7cf5, 0x7cce, 0x7e67, - 0x451d, 0xe352, 0x7d5d, 0xe354, 0x748d, 0x7d89, 0x7dab, 0x7135, - 0x7db3, 0x7dd2, 0xe35b, 0xe35c, 0x7de4, 0x3d13, 0x7df5, 0xe360, - 0x7de5, 0xe362, 0x7e1d, 0xe364, 0xe365, 0x7e6e, 0x7e92, 0x432b, - 0x946c, 0x7e27, 0x7f40, 0x7f41, 0x7f47, 0x7936, 0xe36f, 0x99e1, - 0x7f97, 0xe372, 0x7fa3, 0xe374, 0xe375, 0x455c, 0xe377, 0x4503, - 0xe379, 0x7ffa, 0xe37b, 0x8005, 0x8008, 0x801d, 0x8028, 0x802f, - 0xe381, 0xe382, 0x803b, 0x803c, 0x8061, 0xe386, 0x4989, 0xe388, - 0xe389, 0xe38a, 0x6725, 0x80a7, 0xe38d, 0x8107, 0x811a, 0x58b0, - 0xe391, 0x6c7f, 0xe393, 0xe394, 0x64e7, 0xe396, 0x8218, 0xe398, - 0x6a53, 0xe39a, 0xe39b, 0x447a, 0x8229, 0xe39e, 0xe39f, 0xe3a0, - 0x4ff9, 0xe3a2, 0x84e2, 0x8362, 0xe3a5, 0xe3a6, 0xe3a7, 0xe3a8, - 0xe3a9, 0x82aa, 0x691b, 0xe3ac, 0x41db, - /* 0x8f */ - 0x854b, 0x82d0, 0x831a, 0xe3b1, 0xe3b2, 0x36c1, 0xe3b4, 0xe3b5, - 0x827b, 0x82e2, 0x8318, 0xe3b9, 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd, - 0x3dbf, 0x831d, 0x55ec, 0x8385, 0x450b, 0xe3c3, 0x83ac, 0x83c1, - 0x83d3, 0x347e, 0xe3c8, 0x6a57, 0x855a, 0x3496, 0xe3cc, 0xe3cd, - 0x8458, 0xe3cf, 0x8471, 0x3dd3, 0x44e4, 0x6aa7, 0x844a, 0xe3d5, - 0x7958, 0x84a8, 0xe3d8, 0xe3d9, 0xe3da, 0x84de, 0x840f, 0x8391, - 0x44a0, 0x8493, 0x84e4, 0xe3e1, 0x4240, 0xe3e3, 0x4543, 0x8534, - 0x5af2, 0xe3e7, 0x4527, 0x8573, 0x4516, 0x67bf, 0x8616, 0xe3ed, - 0xe3ee, 0x85c1, 0xe3f0, 0x8602, 0xe3f2, 0xe3f3, 0xe3f4, 0x456a, - 0x8628, 0x3648, 0xe3f8, 0x53f7, 0xe3fa, 0x867e, 0x8771, 0xe3fd, - 0x87ee, 0xe3ff, 0x87b1, 0x87da, 0x880f, 0x5661, 0x866c, 0x6856, - 0x460f, 0x8845, 0x8846, 0xe409, 0xe40a, 0xe40b, 0x885e, 0x889c, - 0x465b, 0x88b4, 0x88b5, 0x63c1, 0x88c5, 0x7777, 0xe414, 0x8987, - 0x898a, 0x89a6, 0x89a9, 0x89a7, 0x89bc, 0xe41b, 0x89e7, 0xe41d, - 0xe41e, 0x8a9c, 0x7793, 0x91fe, 0x8a90, 0xe423, 0x7ae9, 0xe425, - 0xe426, 0x4713, 0xe428, 0x717c, 0x8b0c, 0x8b1f, 0xe42c, 0xe42d, - 0x8b3f, 0x8b4c, 0x8b4d, 0x8aa9, 0xe432, 0x8b90, 0x8b9b, 0x8aaf, - 0xe436, 0x4615, 0x884f, 0x8c9b, 0xe43a, 0xe43b, 0xe43c, 0x3725, - 0xe43e, 0x8cd6, 0xe440, 0xe441, 0x8d12, 0x8d03, 0xe444, 0x8cdb, - 0x705c, 0x8d11, 0xe448, 0x3ed0, 0x8d77, - /* 0x90 */ - 0x8da9, 0xe44c, 0xe44d, 0xe44e, 0x3b7c, 0xe450, 0xe451, 0x7ae7, - 0x8ead, 0x8eb6, 0x8ec3, 0x92d4, 0x8f19, 0x8f2d, 0xe459, 0xe45a, - 0x8fa5, 0x9303, 0xe45d, 0xe45e, 0x8fb3, 0x492a, 0xe461, 0xe462, - 0xe463, 0x5ef8, 0xe465, 0x8ff9, 0xe467, 0xe468, 0xe469, 0xe46a, - 0x3980, 0xe46c, 0x9037, 0xe46e, 0xe46f, 0x9061, 0xe471, 0xe472, - 0x90a8, 0xe474, 0x90c4, 0xe476, 0x90ae, 0x90fd, 0x9167, 0x3af0, - 0x91a9, 0x91c4, 0x7cac, 0xe47e, 0xe47f, 0x920e, 0x6c9f, 0x9241, - 0x9262, 0xe484, 0x92b9, 0xe486, 0xe487, 0xe488, 0xe489, 0xe48a, - 0x932c, 0x936b, 0xe48d, 0xe48e, 0x708f, 0x5ac3, 0xe491, 0xe492, - 0x4965, 0x9244, 0xe495, 0xe496, 0xe497, 0x9373, 0x945b, 0x8ebc, - 0x9585, 0x95a6, 0x9426, 0x95a0, 0x6ff6, 0x42b9, 0xe4a1, 0xe4a2, - 0xe4a3, 0xe4a4, 0x49df, 0x6c1c, 0x967b, 0x9696, 0x416c, 0x96a3, - 0xe4ab, 0x61da, 0x96b6, 0x78f5, 0xe4af, 0x96bd, 0x53cc, 0x49a1, - 0xe4b3, 0xe4b4, 0xe4b5, 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9, 0xe4ba, - 0x9731, 0x8642, 0x9736, 0x4a0f, 0x453d, 0x4585, 0xe4c1, 0x7075, - 0x5b41, 0x971b, 0x975c, 0xe4c6, 0x9757, 0x5b4a, 0xe4c9, 0x975f, - 0x9425, 0x50d0, 0xe4cd, 0xe4ce, 0x9789, 0x979f, 0x97b1, 0x97be, - 0x97c0, 0x97d2, 0x97e0, 0xe4d6, 0x97ee, 0x741c, 0xe4d9, 0x97ff, - 0x97f5, 0xe4dc, 0xe4dd, 0x4ad1, 0x9834, 0x9833, 0x984b, 0x9866, - 0x3b0e, 0xe4e4, 0x3d51, 0xe4e6, 0xe4e7, - /* 0x91 */ - 0xe4e8, 0x98ca, 0x98b7, 0x98c8, 0x98c7, 0x4aff, 0xe4ee, 0xe4ef, - 0x55b0, 0x98e1, 0x98e6, 0x98ec, 0x9378, 0x9939, 0xe4f6, 0x4b72, - 0xe4f8, 0xe4f9, 0x99f5, 0x9a0c, 0x9a3b, 0x9a10, 0x9a58, 0xe4ff, - 0x36c4, 0xe501, 0xe502, 0x9ae0, 0x9ae2, 0xe505, 0x9af4, 0x4c0e, - 0x9b14, 0x9b2d, 0xe50a, 0x5034, 0x9b34, 0xe50d, 0x38c3, 0xe50f, - 0x9b50, 0x9b40, 0xe512, 0x5a45, 0xe514, 0x9b8e, 0xe516, 0x9c02, - 0x9bff, 0x9c0c, 0xe51a, 0x9dd4, 0xe51c, 0xe51d, 0xe51e, 0xe51f, - 0xe520, 0xe521, 0x9d7e, 0x9d83, 0xe524, 0x9e0e, 0x6888, 0x9dc4, - 0xe528, 0xe529, 0xe52a, 0xe52b, 0xe52c, 0x9d39, 0xe52e, 0xe52f, - 0x9e90, 0x9e95, 0x9e9e, 0x9ea2, 0x4d34, 0x9eaa, 0x9eaf, 0xe537, - 0x9ec1, 0x3b60, 0x39e5, 0x3d1d, 0x4f32, 0x37be, 0xe53e, 0x9f02, - 0x9f08, 0x4b96, 0x9424, 0xe543, 0x9f17, 0x9f16, 0x9f39, 0x569f, - 0x568a, 0x9f45, 0x99b8, 0xe54b, 0x97f2, 0x847f, 0x9f62, 0x9f69, - 0x7adc, 0x9f8e, 0x7216, 0x4bbe, 0xe554, 0xe555, 0x7177, 0xe557, - 0xe558, 0xe559, 0x739e, 0xe55b, 0xe55c, 0x799f, 0xe55e, 0xe55f, - 0x9369, 0x93f3, 0xe562, 0x92ec, 0x9381, 0x93cb, 0xe566, 0xe567, - 0x7217, 0x3eeb, 0x7772, 0x7a43, 0x70d0, 0xe56d, 0xe56e, 0x717e, - 0xe570, 0x70a3, 0xe572, 0xe573, 0x3ec7, 0xe575, 0xe576, 0xe577, - 0x3722, 0xe579, 0xe57a, 0x36e1, 0xe57c, 0xe57d, 0xe57e, 0x3723, - 0xe580, 0x575b, 0xe582, 0xe583, 0xe584, - /* 0x92 */ - 0xe585, 0xe586, 0x8503, 0xe588, 0x8503, 0x8455, 0xe58b, 0xe58c, - 0xe58d, 0xe58e, 0xe58f, 0xe590, 0x44f4, 0xe592, 0xe593, 0xe594, - 0x67f9, 0x3733, 0x3c15, 0x3de7, 0x586c, 0xe59a, 0x6810, 0x4057, - 0xe59d, 0xe59e, 0xe59f, 0xe5a0, 0xe5a1, 0x54cb, 0x569e, 0xe5a4, - 0x5692, 0xe5a6, 0xe5a7, 0xe5a8, 0x93c6, 0xe5aa, 0x939c, 0x4ef8, - 0x512b, 0x3819, 0xe5af, 0x4ebc, 0xe5b1, 0xe5b2, 0x4f4b, 0x4f8a, - 0xe5b5, 0x5a68, 0xe5b7, 0xe5b8, 0x3999, 0xe5ba, 0xe5bb, 0x3435, - 0x4f29, 0xe5be, 0xe5bf, 0xe5c0, 0x8ada, 0xe5c2, 0x4e98, 0x50cd, - 0x510d, 0x4fa2, 0x4f03, 0xe5c8, 0xe5c9, 0x4f42, 0x502e, 0x506c, - 0x5081, 0x4fcc, 0x4fe5, 0x5058, 0x50fc, 0x5159, 0x515b, 0x515d, - 0x515e, 0x6e76, 0xe5d7, 0xe5d8, 0xe5d9, 0x6d72, 0xe5db, 0xe5dc, - 0x51a8, 0x51c3, 0xe5df, 0x44dd, 0xe5e1, 0xe5e2, 0xe5e3, 0x8d7a, - 0xe5e5, 0xe5e6, 0x5259, 0x52a4, 0xe5e9, 0x52e1, 0x936e, 0x467a, - 0x718c, 0xe5ee, 0xe5ef, 0xe5f0, 0xe5f1, 0x69d1, 0xe5f3, 0x7479, - 0x3ede, 0x7499, 0x7414, 0x7456, 0x7398, 0x4b8e, 0xe5fb, 0xe5fc, - 0x53d0, 0x3584, 0x720f, 0xe600, 0x55b4, 0xe602, 0x54cd, 0xe604, - 0x571d, 0x925d, 0x96f4, 0x9366, 0x57dd, 0x578d, 0x577f, 0x363e, - 0x58cb, 0x5a99, 0xe60f, 0xe610, 0xe611, 0xe612, 0x5a2c, 0x59b8, - 0x928f, 0x5a7e, 0x5acf, 0x5a12, 0xe619, 0xe61a, 0xe61b, 0xe61c, - 0x36f5, 0x6d05, 0x7443, 0x5a21, 0xe621, - /* 0x93 */ - 0x5a81, 0xe623, 0xe624, 0x93e0, 0x748c, 0xe627, 0x7105, 0x4972, - 0x9408, 0xe62b, 0x93bd, 0x37a0, 0x5c1e, 0x5c9e, 0x5e5e, 0x5e48, - 0xe632, 0xe633, 0xe634, 0x5ecd, 0x5b4f, 0xe637, 0xe638, 0x3701, - 0xe63a, 0x36dd, 0xe63c, 0x36d3, 0x812a, 0xe63f, 0xe640, 0xe641, - 0xe642, 0x5f0c, 0x5f0e, 0xe645, 0xe646, 0x5a6b, 0xe648, 0x5b44, - 0x8614, 0xe64b, 0x8860, 0x607e, 0xe64e, 0xe64f, 0x5fdb, 0x3eb8, - 0xe652, 0xe653, 0xe654, 0xe655, 0x61c0, 0xe657, 0xe658, 0xe659, - 0x6199, 0x6198, 0x6075, 0xe65d, 0xe65e, 0xe65f, 0xe660, 0x6471, - 0xe662, 0xe663, 0x3a29, 0xe665, 0xe666, 0xe667, 0xe668, 0x6337, - 0xe66a, 0x64b6, 0x6331, 0x63d1, 0xe66e, 0xe66f, 0x62a4, 0xe671, - 0x643b, 0x656b, 0x6972, 0x3bf4, 0xe676, 0xe677, 0xe678, 0xe679, - 0x550d, 0xe67b, 0xe67c, 0xe67d, 0x66ce, 0xe67f, 0xe680, 0x3ae0, - 0x4190, 0xe683, 0xe684, 0xe685, 0xe686, 0xe687, 0xe688, 0x78ee, - 0xe68a, 0xe68b, 0xe68c, 0x3464, 0xe68e, 0xe68f, 0xe690, 0x668e, - 0xe692, 0x666b, 0x4b93, 0x6630, 0xe696, 0xe697, 0x6663, 0xe699, - 0xe69a, 0x661e, 0xe69c, 0x38d1, 0xe69e, 0xe69f, 0x3b99, 0xe6a1, - 0xe6a2, 0x74d0, 0x3b96, 0x678f, 0xe6a6, 0x68b6, 0x681e, 0x3bc4, - 0x6abe, 0x3863, 0xe6ac, 0xe6ad, 0x6a33, 0x6a52, 0x6ac9, 0x6b05, - 0xe6b2, 0x6511, 0x6898, 0x6a4c, 0x3bd7, 0x6a7a, 0x6b57, 0xe6b9, - 0xe6ba, 0x93a0, 0x92f2, 0xe6bd, 0xe6be, - /* 0x94 */ - 0x9289, 0xe6c0, 0xe6c1, 0x9467, 0x6da5, 0x6f0b, 0xe6c5, 0x6d67, - 0xe6c7, 0x3d8f, 0x6e04, 0xe6ca, 0x5a3d, 0x6e0a, 0x5847, 0x6d24, - 0x7842, 0x713b, 0xe6d1, 0xe6d2, 0x70f1, 0x7250, 0x7287, 0x7294, - 0xe6d7, 0xe6d8, 0x5179, 0xe6da, 0xe6db, 0x747a, 0xe6dd, 0xe6de, - 0xe6df, 0xe6e0, 0xe6e1, 0x3f06, 0x3eb1, 0xe6e4, 0xe6e5, 0xe6e6, - 0x60a7, 0x3ef3, 0x74cc, 0x743c, 0x9387, 0x7437, 0x449f, 0xe6ee, - 0x4551, 0x7583, 0x3f63, 0xe6f2, 0xe6f3, 0x3f58, 0x7555, 0x7673, - 0xe6f7, 0x3b19, 0x7468, 0xe6fa, 0xe6fb, 0xe6fc, 0x3afb, 0x3dcd, - 0xe6ff, 0x3eff, 0xe701, 0xe702, 0x91fa, 0x5732, 0x9342, 0xe706, - 0xe707, 0x50df, 0xe709, 0xe70a, 0x7778, 0xe70c, 0x770e, 0x770f, - 0x777b, 0xe710, 0xe711, 0x3a5e, 0xe713, 0x7438, 0x749b, 0x3ebf, - 0xe717, 0xe718, 0x40c8, 0xe71a, 0xe71b, 0x9307, 0xe71d, 0x781e, - 0x788d, 0x7888, 0x78d2, 0x73d0, 0x7959, 0xe724, 0xe725, 0x410e, - 0x799b, 0x8496, 0x79a5, 0x6a2d, 0xe72b, 0x7a3a, 0x79f4, 0x416e, - 0xe72f, 0x4132, 0x9235, 0x79f1, 0xe733, 0xe734, 0xe735, 0xe736, - 0xe737, 0x3597, 0x556b, 0x3570, 0x36aa, 0xe73c, 0xe73d, 0x7ae2, - 0x5a59, 0xe740, 0xe741, 0xe742, 0x5a0d, 0xe744, 0x78f0, 0x5a2a, - 0xe747, 0x7afe, 0x41f9, 0x7c5d, 0x7c6d, 0x4211, 0xe74d, 0xe74e, - 0xe74f, 0x7ccd, 0xe751, 0xe752, 0x7c8e, 0x7c7c, 0x7cae, 0x6ab2, - 0x7ddc, 0x7e07, 0x7dd3, 0x7f4e, 0xe75b, - /* 0x95 */ - 0xe75c, 0xe75d, 0x7d97, 0xe75f, 0x426a, 0xe761, 0xe762, 0x67d6, - 0xe764, 0xe765, 0x57c4, 0xe767, 0xe768, 0xe769, 0x7fdd, 0x7b27, - 0xe76c, 0xe76d, 0xe76e, 0x7b0c, 0xe770, 0x99e6, 0x8645, 0x9a63, - 0x6a1c, 0xe775, 0x39e2, 0xe777, 0xe778, 0x9a1f, 0xe77a, 0x8480, - 0xe77c, 0xe77d, 0x44ea, 0x8137, 0x4402, 0x80c6, 0x8109, 0x8142, - 0xe784, 0x98c3, 0xe786, 0x8262, 0x8265, 0xe789, 0x8453, 0xe78b, - 0x8610, 0xe78d, 0x5a86, 0x417f, 0xe790, 0x5b2b, 0xe792, 0x5ae4, - 0xe794, 0x86a0, 0xe796, 0xe797, 0x882d, 0xe799, 0x5a02, 0x886e, - 0x4f45, 0x8887, 0x88bf, 0x88e6, 0x8965, 0x894d, 0xe7a2, 0x8954, - 0xe7a4, 0xe7a5, 0xe7a6, 0xe7a7, 0xe7a8, 0xe7a9, 0x3ead, 0x84a3, - 0x46f5, 0x46cf, 0x37f2, 0x8a3d, 0x8a1c, 0xe7b1, 0x5f4d, 0x922b, - 0xe7b4, 0x65d4, 0x7129, 0x70c4, 0xe7b8, 0x9d6d, 0x8c9f, 0x8ce9, - 0xe7bc, 0x599a, 0x77c3, 0x59f0, 0x436e, 0x36d4, 0x8e2a, 0x8ea7, - 0xe7c4, 0x8f30, 0x8f4a, 0x42f4, 0x6c58, 0x6fbb, 0xe7ca, 0x489b, - 0x6f79, 0x6e8b, 0xe7ce, 0x9be9, 0x36b5, 0xe7d1, 0x90bb, 0x9097, - 0x5571, 0x4906, 0x91bb, 0x9404, 0xe7d8, 0x4062, 0xe7da, 0x9427, - 0xe7dc, 0xe7dd, 0x84e5, 0x8a2b, 0x9599, 0x95a7, 0x9597, 0x9596, - 0xe7e4, 0x7445, 0x3ec2, 0xe7e7, 0xe7e8, 0xe7e9, 0x3ee7, 0xe7eb, - 0x968f, 0xe7ed, 0xe7ee, 0xe7ef, 0x3ecc, 0xe7f1, 0xe7f2, 0xe7f3, - 0x7412, 0x746b, 0x3efc, 0x9741, 0xe7f8, - /* 0x96 */ - 0x6847, 0x4a1d, 0xe7fb, 0xe7fc, 0x975d, 0x9368, 0xe7ff, 0xe800, - 0xe801, 0xe802, 0x92ba, 0x5b11, 0x8b69, 0x493c, 0x73f9, 0xe808, - 0x979b, 0x9771, 0x9938, 0xe80c, 0x5dc1, 0xe80e, 0xe80f, 0x981f, - 0xe811, 0x92f6, 0xe813, 0x91e5, 0x44c0, 0xe816, 0xe817, 0xe818, - 0x98dc, 0xe81a, 0x3f00, 0x922a, 0x4925, 0x8414, 0x993b, 0x994d, - 0xe821, 0x3dfd, 0x999b, 0x4b6f, 0x99aa, 0x9a5c, 0xe827, 0xe828, - 0x6a8f, 0x9a21, 0x5afe, 0x9a2f, 0xe82d, 0x4b90, 0xe82f, 0x99bc, - 0x4bbd, 0x4b97, 0x937d, 0x5872, 0xe835, 0x5822, 0xe837, 0xe838, - 0x7844, 0xe83a, 0xe83b, 0x68c5, 0x3d7d, 0x9458, 0x3927, 0x6150, - 0xe841, 0xe842, 0x6107, 0x9c4f, 0x9c53, 0x9c7b, 0x9c35, 0x9c10, - 0x9b7f, 0x9bcf, 0xe84b, 0x9b9f, 0xe84d, 0xe84e, 0x9d21, 0x4cae, - 0xe851, 0x9e18, 0x4cb0, 0x9d0c, 0xe855, 0xe856, 0xe857, 0xe858, - 0x9da5, 0x84bd, 0xe85b, 0xe85c, 0xe85d, 0x85fc, 0x4533, 0xe860, - 0xe861, 0xe862, 0x8420, 0x85ee, 0xe865, 0xe866, 0xe867, 0x79e2, - 0xe869, 0xe86a, 0x492d, 0xe86c, 0x3d62, 0x93db, 0x92be, 0x9348, - 0xe871, 0x78b9, 0x9277, 0x944d, 0x4fe4, 0x3440, 0x9064, 0xe878, - 0x783d, 0x7854, 0x78b6, 0x784b, 0xe87d, 0xe87e, 0xe87f, 0x369a, - 0x4f72, 0x6fda, 0x6fd9, 0x701e, 0x701e, 0x5414, 0xe887, 0x57bb, - 0x58f3, 0x578a, 0x9d16, 0x57d7, 0x7134, 0x34af, 0xe88f, 0x71eb, - 0xe891, 0xe892, 0x5b28, 0xe894, 0xe895, - /* 0x97 */ - 0x610c, 0x5ace, 0x5a0b, 0x42bc, 0xe89a, 0x372c, 0x4b7b, 0xe89d, - 0x93bb, 0x93b8, 0xe8a0, 0xe8a1, 0x8472, 0xe8a3, 0xe8a4, 0xe8a5, - 0xe8a6, 0xe8a7, 0x5994, 0xe8a9, 0xe8aa, 0x7da8, 0xe8ac, 0xe8ad, - 0xe8ae, 0xe8af, 0xe8b0, 0x92e5, 0x73e2, 0x3ee9, 0x74b4, 0xe8b5, - 0xe8b6, 0x3ee1, 0xe8b8, 0x6ad8, 0x73f3, 0x73fb, 0x3ed6, 0xe8bd, - 0xe8be, 0xe8bf, 0xe8c0, 0xe8c1, 0xe8c2, 0xe8c3, 0x7448, 0xe8c5, - 0x70a5, 0xe8c7, 0x9284, 0x73e6, 0x935f, 0xe8cb, 0x9331, 0xe8cd, - 0xe8ce, 0x9386, 0xe8d0, 0xe8d1, 0x4935, 0xe8d3, 0x716b, 0xe8d5, - 0xe8d6, 0x56a4, 0xe8d8, 0xe8d9, 0xe8da, 0x5502, 0x79c4, 0xe8dd, - 0x7dfe, 0xe8df, 0xe8e0, 0xe8e1, 0x452e, 0x9401, 0x370a, 0xe8e5, - 0xe8e6, 0x59b0, 0xe8e8, 0xe8e9, 0xe8ea, 0x5aa1, 0x36e2, 0xe8ed, - 0x36b0, 0x925f, 0x5a79, 0xe8f1, 0xe8f2, 0x9374, 0x3ccd, 0xe8f5, - 0x4a96, 0x398a, 0x50f4, 0x3d69, 0x3d4c, 0xe8fb, 0x7175, 0x42fb, - 0xe8fe, 0x6e0f, 0xe900, 0x44eb, 0x6d57, 0xe903, 0x7067, 0x6caf, - 0x3cd6, 0xe907, 0xe908, 0x6e02, 0x6f0c, 0x3d6f, 0xe90c, 0x7551, - 0x36bc, 0x34c8, 0x4680, 0x3eda, 0x4871, 0x59c4, 0x926e, 0x493e, - 0x8f41, 0xe917, 0xe918, 0x5812, 0x57c8, 0x36d6, 0xe91c, 0x70fe, - 0xe91e, 0xe91f, 0xe920, 0xe921, 0xe922, 0x68b9, 0x6967, 0xe925, - 0xe926, 0xe927, 0xe928, 0xe929, 0xe92a, 0xe92b, 0xe92c, 0x6a1a, - 0xe92e, 0xe92f, 0x843e, 0x44df, 0x44ce, - /* 0x98 */ - 0xe933, 0xe934, 0xe935, 0xe936, 0x6f17, 0xe938, 0x833d, 0xe93a, - 0x83ed, 0xe93c, 0xe93d, 0xe93e, 0x5989, 0x5a82, 0xe941, 0x5a61, - 0x5a71, 0xe944, 0xe945, 0x372d, 0x59ef, 0xe948, 0x36c7, 0x718e, - 0x9390, 0x669a, 0xe94d, 0x5a6e, 0x5a2b, 0xe950, 0x6a2b, 0xe952, - 0xe953, 0xe954, 0xe955, 0x711d, 0xe957, 0xe958, 0x4fb0, 0xe95a, - 0x5cc2, 0xe95c, 0xe95d, 0xe95e, 0x6a0c, 0xe960, 0xe961, 0x70a6, - 0x7133, 0xe964, 0x3da5, 0x6cdf, 0xe967, 0xe968, 0x7e65, 0x59eb, - 0x5d2f, 0x3df3, 0x5f5c, 0xe96e, 0xe96f, 0x7da4, 0x8426, 0x5485, - 0xe973, 0xe974, 0xe975, 0x577e, 0xe977, 0xe978, 0x3fe5, 0xe97a, - 0xe97b, 0x7003, 0xe97d, 0x5d70, 0x738f, 0x7cd3, 0xe981, 0xe982, - 0x4fc8, 0x7fe7, 0x72cd, 0x7310, 0xe987, 0x7338, 0x7339, 0xe98a, - 0x7341, 0x7348, 0x3ea9, 0xe98e, 0x906c, 0x71f5, 0xe991, 0x73e1, - 0x81f6, 0x3eca, 0x770c, 0x3ed1, 0x6ca2, 0x56fd, 0x7419, 0x741e, - 0x741f, 0x3ee2, 0x3ef0, 0x3ef4, 0x3efa, 0x74d3, 0x3f0e, 0x3f53, - 0x7542, 0x756d, 0x7572, 0x758d, 0x3f7c, 0x75c8, 0x75dc, 0x3fc0, - 0x764d, 0x3fd7, 0x7674, 0x3fdc, 0x767a, 0xe9b0, 0x7188, 0x5623, - 0x8980, 0x5869, 0x401d, 0x7743, 0x4039, 0x6761, 0x4045, 0x35db, - 0x7798, 0x406a, 0x406f, 0x5c5e, 0x77be, 0x77cb, 0x58f2, 0x7818, - 0x70b9, 0x781c, 0x40a8, 0x7839, 0x7847, 0x7851, 0x7866, 0x8448, - 0xe9cb, 0x7933, 0x6803, 0x7932, 0x4103, - /* 0x99 */ - 0x4109, 0x7991, 0x7999, 0x8fbb, 0x7a06, 0x8fbc, 0x4167, 0x7a91, - 0x41b2, 0x7abc, 0x8279, 0x41c4, 0x7acf, 0x7adb, 0x41cf, 0x4e21, - 0x7b62, 0x7b6c, 0x7b7b, 0x7c12, 0x7c1b, 0x4260, 0x427a, 0x7c7b, - 0x7c9c, 0x428c, 0x7cb8, 0x4294, 0x7ced, 0x8f93, 0x70c0, 0xe9ef, - 0x7dcf, 0x7dd4, 0x7dd0, 0x7dfd, 0x7fae, 0x7fb4, 0x729f, 0x4397, - 0x8020, 0x8025, 0x7b39, 0x802e, 0x8031, 0x8054, 0x3dcc, 0x57b4, - 0x70a0, 0x80b7, 0x80e9, 0x43ed, 0x810c, 0x732a, 0x810e, 0x8112, - 0x7560, 0x8114, 0x4401, 0x3b39, 0x8156, 0x8159, 0x815a, 0x4413, - 0x583a, 0x817c, 0x8184, 0x4425, 0x8193, 0x442d, 0x81a5, 0x57ef, - 0x81c1, 0x81e4, 0x8254, 0x448f, 0x82a6, 0x8276, 0x82ca, 0x82d8, - 0x82ff, 0x44b0, 0x8357, 0x9669, 0x698a, 0x8405, 0x70f5, 0x8464, - 0x60e3, 0x8488, 0x4504, 0x84be, 0x84e1, 0x84f8, 0x8510, 0x8538, - 0x8552, 0x453b, 0x856f, 0x8570, 0x85e0, 0x4577, 0x8672, 0x8692, - 0x86b2, 0x86ef, 0x9645, 0x878b, 0x4606, 0x4617, 0x88ae, 0x88ff, - 0x8924, 0x8947, 0x8991, 0xea43, 0x8a29, 0x8a38, 0x8a94, 0x8ab4, - 0x8c51, 0x8cd4, 0x8cf2, 0x8d1c, 0x4798, 0x585f, 0x8dc3, 0x47ed, - 0x4eee, 0x8e3a, 0x55d8, 0x5754, 0x8e71, 0x55f5, 0x8eb0, 0x4837, - 0x8ece, 0x8ee2, 0x8ee4, 0x8eed, 0x8ef2, 0x8fb7, 0x8fc1, 0x8fca, - 0x8fcc, 0x9033, 0x99c4, 0x48ad, 0x98e0, 0x9213, 0x491e, 0x9228, - 0x9258, 0x926b, 0x92b1, 0x92ae, 0x92bf, - /* 0x9a */ - 0x92e3, 0x92eb, 0x92f3, 0x92f4, 0x92fd, 0x9343, 0x9384, 0x93ad, - 0x4945, 0x4951, 0x9ebf, 0x9417, 0x5301, 0x941d, 0x942d, 0x943e, - 0x496a, 0x9454, 0x9479, 0x952d, 0x95a2, 0x49a7, 0x95f4, 0x9633, - 0x49e5, 0x67a0, 0x4a24, 0x9740, 0x4a35, 0x97b2, 0x97c2, 0x5654, - 0x4ae4, 0x60e8, 0x98b9, 0x4b19, 0x98f1, 0x5844, 0x990e, 0x9919, - 0x51b4, 0x991c, 0x9937, 0x9942, 0x995d, 0x9962, 0x4b70, 0x99c5, - 0x4b9d, 0x9a3c, 0x9b0f, 0x7a83, 0x9b69, 0x9b81, 0x9bdd, 0x9bf1, - 0x9bf4, 0x4c6d, 0x9c20, 0x376f, 0xeaa9, 0x9d49, 0x9c3a, 0x9efe, - 0x5650, 0x9d93, 0x9dbd, 0x9dc0, 0x9dfc, 0x94f6, 0x8fb6, 0x9e7b, - 0x9eac, 0x9eb1, 0x9ebd, 0x9ec6, 0x94dc, 0x9ee2, 0x9ef1, 0x9ef8, - 0x7ac8, 0x9f44, 0xeabf, 0xeac0, 0xeac1, 0x691a, 0x94c3, 0x59ac, - 0xeac5, 0x5840, 0x94c1, 0x37b9, 0xeac9, 0xeaca, 0xeacb, 0xeacc, - 0x5757, 0x7173, 0xeacf, 0xead0, 0xead1, 0x546a, 0xead3, 0xead4, - 0x549e, 0xead6, 0xead7, 0xead8, 0xead9, 0xeada, 0x60e7, 0xeadc, - 0x567a, 0xeade, 0xeadf, 0xeae0, 0xeae1, 0xeae2, 0xeae3, 0x6955, - 0x9c2f, 0x87a5, 0xeae7, 0xeae8, 0xeae9, 0xeaea, 0xeaeb, 0xeaec, - 0x5c20, 0xeaee, 0x5e0b, 0xeaf0, 0xeaf1, 0xeaf2, 0x671e, 0xeaf4, - 0xeaf5, 0xeaf6, 0x3647, 0xeaf8, 0xeaf9, 0xeafa, 0xeafb, 0x5364, - 0x84ad, 0xeafe, 0xeaff, 0xeb00, 0x8b81, 0xeb02, 0xeb03, 0xeb04, - 0xeb05, 0x4e78, 0x70bb, 0xeb08, 0xeb09, - /* 0x9b */ - 0xeb0a, 0xeb0b, 0xeb0c, 0xeb0d, 0xeb0e, 0xeb0f, 0x62c3, 0xeb11, - 0xeb12, 0x7198, 0x6855, 0xeb15, 0x69e9, 0x36c8, 0xeb18, 0xeb19, - 0xeb1a, 0xeb1b, 0xeb1c, 0xeb1d, 0x82fd, 0xeb1f, 0xeb20, 0xeb21, - 0x89a5, 0xeb23, 0x8fa0, 0xeb25, 0x97b8, 0xeb27, 0x9847, 0x9abd, - 0xeb2a, 0xeb2b, 0xeb2c, 0xeb2d, 0xeb2e, 0xeb2f, 0xeb30, 0xeb31, - 0xeb32, 0xeb33, 0xeb34, 0xeb35, 0xeb36, 0xeb37, 0xeb38, 0xeb39, - 0x5fb1, 0x6648, 0x66bf, 0xeb3d, 0xeb3e, 0xeb3f, 0x7201, 0xeb41, - 0x77d7, 0xeb43, 0xeb44, 0x7e87, 0xeb46, 0x58b5, 0x670e, 0x6918, - 0xeb4a, 0xeb4b, 0xeb4c, 0xeb4d, 0xeb4e, 0xeb4f, 0xeb50, 0x48d0, - 0x4ab8, 0xeb53, 0xeb54, 0xeb55, 0xeb56, 0xeb57, 0xeb58, 0xeb59, - 0xeb5a, 0xeb5b, 0x51d2, 0xeb5d, 0x599f, 0xeb5f, 0x3bbe, 0xeb61, - 0xeb62, 0xeb63, 0x5788, 0xeb65, 0x399b, 0xeb67, 0xeb68, 0xeb69, - 0x3762, 0xeb6b, 0x8b5e, 0xeb6d, 0x99d6, 0xeb6f, 0xeb70, 0xeb71, - 0x7209, 0xeb73, 0xeb74, 0x5965, 0xeb76, 0xeb77, 0xeb78, 0x8eda, - 0xeb7a, 0x528f, 0x573f, 0x7171, 0xeb7e, 0xeb7f, 0xeb80, 0xeb81, - 0x55bc, 0xeb83, 0xeb84, 0xeb85, 0x91d4, 0x3473, 0xeb88, 0xeb89, - 0xeb8a, 0x4718, 0xeb8c, 0xeb8d, 0xeb8e, 0xeb8f, 0xeb90, 0x5066, - 0x34fb, 0xeb93, 0x60de, 0xeb95, 0x477c, 0xeb97, 0xeb98, 0xeb99, - 0xeb9a, 0xeb9b, 0x57a1, 0x7151, 0x6fb6, 0xeb9f, 0xeba0, 0x9056, - 0xeba2, 0xeba3, 0x8b62, 0xeba5, 0xeba6, - /* 0x9c */ - 0x5d5b, 0xeba8, 0x8f36, 0xebaa, 0xebab, 0x8aea, 0xebad, 0xebae, - 0xebaf, 0xebb0, 0x4bc0, 0xebb2, 0xebb3, 0xebb4, 0x9465, 0xebb6, - 0x6195, 0x5a27, 0xebb9, 0x4fbb, 0x56b9, 0xebbc, 0xebbd, 0x4e6a, - 0xebbf, 0x9656, 0x6d8f, 0xebc2, 0x3618, 0x8977, 0xebc5, 0xebc6, - 0xebc7, 0xebc8, 0x71df, 0xebca, 0x7b42, 0xebcc, 0xebcd, 0xebce, - 0x9104, 0xebd0, 0x7a45, 0x9df0, 0xebd3, 0x9a26, 0xebd5, 0x365f, - 0xebd7, 0xebd8, 0x7983, 0xebda, 0xebdb, 0x5d2c, 0xebdd, 0x83cf, - 0xebdf, 0x46d0, 0xebe1, 0x753b, 0x8865, 0xebe4, 0x58b6, 0x371c, - 0xebe7, 0xebe8, 0xebe9, 0x3c54, 0xebeb, 0xebec, 0x9281, 0xebee, - 0xebef, 0x9330, 0xebf1, 0xebf2, 0x6c39, 0x949f, 0xebf5, 0xebf6, - 0x8827, 0x88f5, 0xebf9, 0xebfa, 0xebfb, 0x6eb8, 0xebfd, 0xebfe, - 0x39a4, 0x36b9, 0x5c10, 0x79e3, 0x453f, 0x66b6, 0xec05, 0xec06, - 0x8943, 0xec08, 0xec09, 0x56d6, 0x40df, 0xec0c, 0x39a1, 0xec0e, - 0xec0f, 0xec10, 0x71ad, 0x8366, 0xec13, 0xec14, 0x5a67, 0x4cb7, - 0xec17, 0xec18, 0xec19, 0xec1a, 0xec1b, 0xec1c, 0xec1d, 0x7b43, - 0x797e, 0xec20, 0x6fb5, 0xec22, 0x6a03, 0xec24, 0x53a2, 0xec26, - 0x93bf, 0x6836, 0x975d, 0xec2a, 0xec2b, 0xec2c, 0xec2d, 0xec2e, - 0xec2f, 0x5d85, 0xec31, 0xec32, 0x5715, 0x9823, 0xec35, 0x5dab, - 0xec37, 0x65be, 0x69d5, 0x53d2, 0xec3b, 0xec3c, 0x3c11, 0x6736, - 0xec3f, 0xec40, 0xec41, 0xec42, 0xec43, - /* 0x9d */ - 0xec44, 0xec45, 0xec46, 0xec47, 0xec48, 0xec49, 0x35ca, 0xec4b, - 0xec4c, 0x48fa, 0x63e6, 0xec4f, 0x7808, 0x9255, 0xec52, 0x43f2, - 0xec54, 0x43df, 0xec56, 0xec57, 0xec58, 0x59f8, 0xec5a, 0x8f0b, - 0xec5c, 0xec5d, 0x7b51, 0xec5f, 0xec60, 0x3df7, 0xec62, 0xec63, - 0x8fd0, 0x728f, 0x568b, 0xec67, 0xec68, 0xec69, 0xec6a, 0xec6b, - 0xec6c, 0xec6d, 0xec6e, 0xec6f, 0xec70, 0xec71, 0xec72, 0xec73, - 0x7e9f, 0xec75, 0xec76, 0x4ca4, 0x9547, 0xec79, 0x71a2, 0xec7b, - 0x4d91, 0x9012, 0xec7e, 0x4d9c, 0xec80, 0x8fbe, 0x55c1, 0x8fba, - 0xec84, 0x8fb9, 0xec86, 0x4509, 0x7e7f, 0x6f56, 0x6ab1, 0x4eea, - 0x34e4, 0xec8d, 0xec8e, 0x373a, 0x8e80, 0xec91, 0xec92, 0xec93, - 0xec94, 0xec95, 0xec96, 0x3deb, 0xec98, 0xec99, 0xec9a, 0xec9b, - 0x4e9a, 0xec9d, 0xec9e, 0x56bf, 0xeca0, 0x8e0e, 0x5b6d, 0xeca3, - 0xeca4, 0x63de, 0x62d0, 0xeca7, 0xeca8, 0x6530, 0x562d, 0xecab, - 0x541a, 0xecad, 0x3dc6, 0xecaf, 0x4c7d, 0x5622, 0x561e, 0x7f49, - 0xecb4, 0x5975, 0xecb6, 0x8770, 0x4e1c, 0xecb9, 0xecba, 0xecbb, - 0x8117, 0x9d5e, 0x8d18, 0x763b, 0x9c45, 0x764e, 0x77b9, 0x9345, - 0x5432, 0x8148, 0x82f7, 0x5625, 0x8132, 0x8418, 0x80bd, 0x55ea, - 0x7962, 0x5643, 0x5416, 0xeccf, 0x35ce, 0x5605, 0x55f1, 0x66f1, - 0xecd4, 0x362d, 0x7534, 0x55f0, 0x55ba, 0x5497, 0x5572, 0xecdb, - 0xecdc, 0x5ed0, 0xecde, 0xecdf, 0xece0, - /* 0x9e */ - 0xece1, 0x9eab, 0x7d5a, 0x55de, 0xece5, 0x629d, 0x976d, 0x5494, - 0x8ccd, 0x71f6, 0x9176, 0x63fc, 0x63b9, 0x63fe, 0x5569, 0xecf0, - 0x9c72, 0xecf2, 0x519a, 0x34df, 0xecf5, 0x51a7, 0x544d, 0x551e, - 0x5513, 0x7666, 0x8e2d, 0xecfc, 0x75b1, 0x80b6, 0x8804, 0x8786, - 0x88c7, 0x81b6, 0x841c, 0xed04, 0x44ec, 0x7304, 0xed07, 0x5b90, - 0x830b, 0xed0a, 0x567b, 0xed0c, 0xed0d, 0xed0e, 0xed0f, 0xed10, - 0xed11, 0x9170, 0xed13, 0x9208, 0xed15, 0xed16, 0xed17, 0xed18, - 0x7266, 0xed1a, 0x474e, 0xed1c, 0xed1d, 0xed1e, 0x40fa, 0x9c5d, - 0x651f, 0xed22, 0x48f3, 0xed24, 0xed25, 0xed26, 0xed27, 0x6062, - 0xed29, 0xed2a, 0xed2b, 0xed2c, 0xed2d, 0x71a3, 0x7e8e, 0x9d50, - 0x4e1a, 0x4e04, 0x3577, 0x5b0d, 0x6cb2, 0x5367, 0x36ac, 0x39dc, - 0x537d, 0x36a5, 0xed3b, 0x589a, 0xed3d, 0x822d, 0x544b, 0x57aa, - 0xed41, 0xed42, 0xed43, 0x3a52, 0xed45, 0x7374, 0xed47, 0x4d09, - 0x9bed, 0xed4a, 0xed4b, 0x4c5b, 0xed4d, 0xed4e, 0xed4f, 0x845c, - 0xed51, 0xed52, 0xed53, 0xed54, 0x632e, 0x7d25, 0xed57, 0xed58, - 0x3a2a, 0x9008, 0x52cc, 0x3e74, 0x367a, 0x45e9, 0xed5f, 0x7640, - 0x5af0, 0xed62, 0x787a, 0x47b6, 0x58a7, 0x40bf, 0x567c, 0x9b8b, - 0x5d74, 0x7654, 0xed6b, 0x9e85, 0x4ce1, 0x75f9, 0x37fb, 0x6119, - 0xed71, 0xed72, 0xed73, 0x565d, 0xed75, 0x57a7, 0xed77, 0xed78, - 0x5234, 0xed7a, 0x35ad, 0x6c4a, 0x9d7c, - /* 0x9f */ - 0x7c56, 0x9b39, 0x57de, 0xed81, 0x5c53, 0x64d3, 0xed84, 0xed85, - 0xed86, 0x86ad, 0xed88, 0xed89, 0xed8a, 0xed8b, 0xed8c, 0x51fe, - 0xed8e, 0x5d8e, 0x9703, 0xed91, 0x9e81, 0x904c, 0x7b1f, 0x9b02, - 0x5cd1, 0x7ba3, 0x6268, 0x6335, 0x9aff, 0x7bcf, 0x9b2a, 0x7c7e, - 0x9b2e, 0x7c42, 0x7c86, 0x9c15, 0x7bfc, 0x9b09, 0x9f17, 0x9c1b, - 0xeda6, 0x9f5a, 0x5573, 0x5bc3, 0x4ffd, 0x9e98, 0x4ff2, 0x5260, - 0x3e06, 0x52d1, 0x5767, 0x5056, 0x59b7, 0x5e12, 0x97c8, 0x9dab, - 0x8f5c, 0x5469, 0x97b4, 0x9940, 0x97ba, 0x532c, 0x6130, 0x692c, - 0x53da, 0x9c0a, 0x9d02, 0x4c3b, 0x9641, 0x6980, 0x50a6, 0x7546, - 0xedc6, 0x99da, 0x5273, 0xedc9, 0x9159, 0x9681, 0x915c, 0xedcd, - 0x9151, 0xedcf, 0x637f, 0xedd1, 0x6aca, 0x5611, 0x918e, 0x757a, - 0x6285, 0xedd7, 0x734f, 0x7c70, 0xedda, 0xeddb, 0xeddc, 0xeddd, - 0x76d6, 0x9b9d, 0x4e2a, 0xede1, 0x83be, 0x8842, 0xede4, 0x5c4a, - 0x69c0, 0x50ed, 0x577a, 0x521f, 0x5df5, 0x4ece, 0x6c31, 0xeded, - 0x4f39, 0x549c, 0x54da, 0x529a, 0x8d82, 0x35fe, 0x5f0c, 0x35f3, - 0xedf6, 0x6b52, 0x917c, 0x9fa5, 0x9b97, 0x982e, 0x98b4, 0x9aba, - 0x9ea8, 0x9e84, 0x717a, 0x7b14, 0xee02, 0x6bfa, 0x8818, 0x7f78, - 0xee06, 0x5620, 0xee08, 0x8e77, 0x9f53, 0xee0b, 0x8dd4, 0x8e4f, - 0x9e1c, 0x8e01, 0x6282, 0xee11, 0x8e28, 0x8e75, 0x7ad3, 0xee15, - 0x7a3e, 0x78d8, 0x6cea, 0x8a67, 0x7607, - /* 0xa0 */ - 0xee1b, 0x9f26, 0x6cce, 0x87d6, 0x75c3, 0xee20, 0x7853, 0xee22, - 0x8d0c, 0x72e2, 0x7371, 0x8b2d, 0x7302, 0x74f1, 0x8ceb, 0xee2a, - 0x862f, 0x5fba, 0x88a0, 0x44b7, 0xee2f, 0xee30, 0xee31, 0xee32, - 0x8a7e, 0xee34, 0xee35, 0x60fd, 0x7667, 0x9ad7, 0x9d44, 0x936e, - 0x9b8f, 0x87f5, 0xee3d, 0x880f, 0x8cf7, 0x732c, 0x9721, 0x9bb0, - 0x35d6, 0x72b2, 0x4c07, 0x7c51, 0x994a, 0xee48, 0x6159, 0x4c04, - 0x9e96, 0x617d, 0xee4d, 0x575f, 0x616f, 0x62a6, 0x6239, 0x62ce, - 0x3a5c, 0x61e2, 0x53aa, 0xee56, 0x6364, 0x6802, 0x35d2, 0x5d57, - 0xee5b, 0x8fda, 0xee5d, 0xee5e, 0x50d9, 0xee60, 0x7906, 0x5332, - 0x9638, 0xee64, 0x4065, 0xee66, 0x77fe, 0xee68, 0x7cc2, 0xee6a, - 0x7cda, 0x7a2d, 0x8066, 0x8063, 0x7d4d, 0x7505, 0x74f2, 0x8994, - 0x821a, 0x670c, 0x8062, 0xee76, 0x805b, 0x74f0, 0x8103, 0x7724, - 0x8989, 0xee7c, 0x7553, 0xee7e, 0x87a9, 0x87ce, 0x81c8, 0x878c, - 0x8a49, 0x8cad, 0x8b43, 0x772b, 0x74f8, 0x84da, 0x3635, 0x69b2, - 0x8da6, 0xee8c, 0x89a9, 0x7468, 0x6db9, 0x87c1, 0xee91, 0x74e7, - 0x3ddb, 0x7176, 0x60a4, 0x619c, 0x3cd1, 0x7162, 0x6077, 0xee9a, - 0x7f71, 0xee9c, 0x7250, 0x60e9, 0x4b7e, 0x5220, 0x3c18, 0xeea2, - 0xeea3, 0xeea4, 0xeea5, 0xeea6, 0xeea7, 0xeea8, 0xeea9, 0xeeaa, - 0x5cc1, 0xeeac, 0xeead, 0xeeae, 0xeeaf, 0xeeb0, 0xeeb1, 0x4562, - 0x5b1f, 0xeeb4, 0x9f50, 0x9ea6, 0xeeb7, - /* 0xa1 */ - 0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2027, 0xff1b, 0xff1a, - 0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xfe51, 0xfe52, - 0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2013, 0xfe31, - 0x2014, 0xfe33, 0x2574, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35, - 0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39, - 0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d, - 0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41, - 0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b, - 0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d, - 0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7, - 0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605, - 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105, - 0x00af, 0xffe3, 0xff3f, 0x02cd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e, - 0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7, - 0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267, - 0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65, - 0xfe66, 0xff5e, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf, - 0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642, - 0x2295, 0x2299, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197, - 0x2199, 0x2198, 0x2225, 0x2223, 0xff0f, - /* 0xa2 */ - 0xff3c, 0x2215, 0xfe68, 0xff04, 0xffe5, 0x3012, 0xffe0, 0xffe1, - 0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5, - 0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4, - 0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7, - 0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, - 0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a, - 0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500, - 0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e, - 0x2570, 0x256f, 0x2550, 0x255e, 0x256a, 0x2561, 0x25e2, 0x25e3, - 0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12, - 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160, - 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, - 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, - 0x3028, 0x3029, 0x5341, 0x5344, 0x5345, 0xff21, 0xff22, 0xff23, - 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, - 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, - 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41, - 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, - 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, - 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, - /* 0xa3 */ - 0xff57, 0xff58, 0xff59, 0xff5a, 0x0391, 0x0392, 0x0393, 0x0394, - 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, - 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, - 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, - 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, - 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, - 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x3105, 0x3106, 0x3107, 0x3108, - 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, - 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, - 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, - 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, - 0x3129, 0x02d9, 0x02c9, 0x02ca, 0x02c7, 0x02cb, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa4 */ - 0x4e00, 0x4e59, 0x4e01, 0x4e03, 0x4e43, 0x4e5d, 0x4e86, 0x4e8c, - 0x4eba, 0x513f, 0x5165, 0x516b, 0x51e0, 0x5200, 0x5201, 0x529b, - 0x5315, 0x5341, 0x535c, 0x53c8, 0x4e09, 0x4e0b, 0x4e08, 0x4e0a, - 0x4e2b, 0x4e38, 0x51e1, 0x4e45, 0x4e48, 0x4e5f, 0x4e5e, 0x4e8e, - 0x4ea1, 0x5140, 0x5203, 0x52fa, 0x5343, 0x53c9, 0x53e3, 0x571f, - 0x58eb, 0x5915, 0x5927, 0x5973, 0x5b50, 0x5b51, 0x5b53, 0x5bf8, - 0x5c0f, 0x5c22, 0x5c38, 0x5c71, 0x5ddd, 0x5de5, 0x5df1, 0x5df2, - 0x5df3, 0x5dfe, 0x5e72, 0x5efe, 0x5f0b, 0x5f13, 0x624d, 0x4e11, - 0x4e10, 0x4e0d, 0x4e2d, 0x4e30, 0x4e39, 0x4e4b, 0x5c39, 0x4e88, - 0x4e91, 0x4e95, 0x4e92, 0x4e94, 0x4ea2, 0x4ec1, 0x4ec0, 0x4ec3, - 0x4ec6, 0x4ec7, 0x4ecd, 0x4eca, 0x4ecb, 0x4ec4, 0x5143, 0x5141, - 0x5167, 0x516d, 0x516e, 0x516c, 0x5197, 0x51f6, 0x5206, 0x5207, - 0x5208, 0x52fb, 0x52fe, 0x52ff, 0x5316, 0x5339, 0x5348, 0x5347, - 0x5345, 0x535e, 0x5384, 0x53cb, 0x53ca, 0x53cd, 0x58ec, 0x5929, - 0x592b, 0x592a, 0x592d, 0x5b54, 0x5c11, 0x5c24, 0x5c3a, 0x5c6f, - 0x5df4, 0x5e7b, 0x5eff, 0x5f14, 0x5f15, 0x5fc3, 0x6208, 0x6236, - 0x624b, 0x624e, 0x652f, 0x6587, 0x6597, 0x65a4, 0x65b9, 0x65e5, - 0x66f0, 0x6708, 0x6728, 0x6b20, 0x6b62, 0x6b79, 0x6bcb, 0x6bd4, - 0x6bdb, 0x6c0f, 0x6c34, 0x706b, 0x722a, 0x7236, 0x723b, 0x7247, - 0x7259, 0x725b, 0x72ac, 0x738b, 0x4e19, - /* 0xa5 */ - 0x4e16, 0x4e15, 0x4e14, 0x4e18, 0x4e3b, 0x4e4d, 0x4e4f, 0x4e4e, - 0x4ee5, 0x4ed8, 0x4ed4, 0x4ed5, 0x4ed6, 0x4ed7, 0x4ee3, 0x4ee4, - 0x4ed9, 0x4ede, 0x5145, 0x5144, 0x5189, 0x518a, 0x51ac, 0x51f9, - 0x51fa, 0x51f8, 0x520a, 0x52a0, 0x529f, 0x5305, 0x5306, 0x5317, - 0x531d, 0x4edf, 0x534a, 0x5349, 0x5361, 0x5360, 0x536f, 0x536e, - 0x53bb, 0x53ef, 0x53e4, 0x53f3, 0x53ec, 0x53ee, 0x53e9, 0x53e8, - 0x53fc, 0x53f8, 0x53f5, 0x53eb, 0x53e6, 0x53ea, 0x53f2, 0x53f1, - 0x53f0, 0x53e5, 0x53ed, 0x53fb, 0x56db, 0x56da, 0x5916, 0x592e, - 0x5931, 0x5974, 0x5976, 0x5b55, 0x5b83, 0x5c3c, 0x5de8, 0x5de7, - 0x5de6, 0x5e02, 0x5e03, 0x5e73, 0x5e7c, 0x5f01, 0x5f18, 0x5f17, - 0x5fc5, 0x620a, 0x6253, 0x6254, 0x6252, 0x6251, 0x65a5, 0x65e6, - 0x672e, 0x672c, 0x672a, 0x672b, 0x672d, 0x6b63, 0x6bcd, 0x6c11, - 0x6c10, 0x6c38, 0x6c41, 0x6c40, 0x6c3e, 0x72af, 0x7384, 0x7389, - 0x74dc, 0x74e6, 0x7518, 0x751f, 0x7528, 0x7529, 0x7530, 0x7531, - 0x7532, 0x7533, 0x758b, 0x767d, 0x76ae, 0x76bf, 0x76ee, 0x77db, - 0x77e2, 0x77f3, 0x793a, 0x79be, 0x7a74, 0x7acb, 0x4e1e, 0x4e1f, - 0x4e52, 0x4e53, 0x4e69, 0x4e99, 0x4ea4, 0x4ea6, 0x4ea5, 0x4eff, - 0x4f09, 0x4f19, 0x4f0a, 0x4f15, 0x4f0d, 0x4f10, 0x4f11, 0x4f0f, - 0x4ef2, 0x4ef6, 0x4efb, 0x4ef0, 0x4ef3, 0x4efd, 0x4f01, 0x4f0b, - 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, - /* 0xa6 */ - 0x5171, 0x518d, 0x51b0, 0x5217, 0x5211, 0x5212, 0x520e, 0x5216, - 0x52a3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540f, - 0x540c, 0x540a, 0x5410, 0x5401, 0x540b, 0x5404, 0x5411, 0x540d, - 0x5408, 0x5403, 0x540e, 0x5406, 0x5412, 0x56e0, 0x56de, 0x56dd, - 0x5733, 0x5730, 0x5728, 0x572d, 0x572c, 0x572f, 0x5729, 0x5919, - 0x591a, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597d, 0x5979, - 0x5982, 0x5981, 0x5b57, 0x5b58, 0x5b87, 0x5b88, 0x5b85, 0x5b89, - 0x5bfa, 0x5c16, 0x5c79, 0x5dde, 0x5e06, 0x5e76, 0x5e74, 0x5f0f, - 0x5f1b, 0x5fd9, 0x5fd6, 0x620e, 0x620c, 0x620d, 0x6210, 0x6263, - 0x625b, 0x6258, 0x6536, 0x65e9, 0x65e8, 0x65ec, 0x65ed, 0x66f2, - 0x66f3, 0x6709, 0x673d, 0x6734, 0x6731, 0x6735, 0x6b21, 0x6b64, - 0x6b7b, 0x6c16, 0x6c5d, 0x6c57, 0x6c59, 0x6c5f, 0x6c60, 0x6c50, - 0x6c55, 0x6c61, 0x6c5b, 0x6c4d, 0x6c4e, 0x7070, 0x725f, 0x725d, - 0x767e, 0x7af9, 0x7c73, 0x7cf8, 0x7f36, 0x7f8a, 0x7fbd, 0x8001, - 0x8003, 0x800c, 0x8012, 0x8033, 0x807f, 0x8089, 0x808b, 0x808c, - 0x81e3, 0x81ea, 0x81f3, 0x81fc, 0x820c, 0x821b, 0x821f, 0x826e, - 0x8272, 0x827e, 0x866b, 0x8840, 0x884c, 0x8863, 0x897f, 0x9621, - 0x4e32, 0x4ea8, 0x4f4d, 0x4f4f, 0x4f47, 0x4f57, 0x4f5e, 0x4f34, - 0x4f5b, 0x4f55, 0x4f30, 0x4f50, 0x4f51, 0x4f3d, 0x4f3a, 0x4f38, - 0x4f43, 0x4f54, 0x4f3c, 0x4f46, 0x4f63, - /* 0xa7 */ - 0x4f5c, 0x4f60, 0x4f2f, 0x4f4e, 0x4f36, 0x4f59, 0x4f5d, 0x4f48, - 0x4f5a, 0x514c, 0x514b, 0x514d, 0x5175, 0x51b6, 0x51b7, 0x5225, - 0x5224, 0x5229, 0x522a, 0x5228, 0x52ab, 0x52a9, 0x52aa, 0x52ac, - 0x5323, 0x5373, 0x5375, 0x541d, 0x542d, 0x541e, 0x543e, 0x5426, - 0x544e, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541b, - 0x5429, 0x544a, 0x5439, 0x543b, 0x5438, 0x542e, 0x5435, 0x5436, - 0x5420, 0x543c, 0x5440, 0x5431, 0x542b, 0x541f, 0x542c, 0x56ea, - 0x56f0, 0x56e4, 0x56eb, 0x574a, 0x5751, 0x5740, 0x574d, 0x5747, - 0x574e, 0x573e, 0x5750, 0x574f, 0x573b, 0x58ef, 0x593e, 0x599d, - 0x5992, 0x59a8, 0x599e, 0x59a3, 0x5999, 0x5996, 0x598d, 0x59a4, - 0x5993, 0x598a, 0x59a5, 0x5b5d, 0x5b5c, 0x5b5a, 0x5b5b, 0x5b8c, - 0x5b8b, 0x5b8f, 0x5c2c, 0x5c40, 0x5c41, 0x5c3f, 0x5c3e, 0x5c90, - 0x5c91, 0x5c94, 0x5c8c, 0x5deb, 0x5e0c, 0x5e8f, 0x5e87, 0x5e8a, - 0x5ef7, 0x5f04, 0x5f1f, 0x5f64, 0x5f62, 0x5f77, 0x5f79, 0x5fd8, - 0x5fcc, 0x5fd7, 0x5fcd, 0x5ff1, 0x5feb, 0x5ff8, 0x5fea, 0x6212, - 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, 0x6289, 0x626d, - 0x628a, 0x627c, 0x627e, 0x6279, 0x6273, 0x6292, 0x626f, 0x6298, - 0x626e, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, 0x653b, 0x6538, - 0x65f1, 0x66f4, 0x675f, 0x674e, 0x674f, 0x6750, 0x6751, 0x675c, - 0x6756, 0x675e, 0x6749, 0x6746, 0x6760, - /* 0xa8 */ - 0x6753, 0x6757, 0x6b65, 0x6bcf, 0x6c42, 0x6c5e, 0x6c99, 0x6c81, - 0x6c88, 0x6c89, 0x6c85, 0x6c9b, 0x6c6a, 0x6c7a, 0x6c90, 0x6c70, - 0x6c8c, 0x6c68, 0x6c96, 0x6c92, 0x6c7d, 0x6c83, 0x6c72, 0x6c7e, - 0x6c74, 0x6c86, 0x6c76, 0x6c8d, 0x6c94, 0x6c98, 0x6c82, 0x7076, - 0x707c, 0x707d, 0x7078, 0x7262, 0x7261, 0x7260, 0x72c4, 0x72c2, - 0x7396, 0x752c, 0x752b, 0x7537, 0x7538, 0x7682, 0x76ef, 0x77e3, - 0x79c1, 0x79c0, 0x79bf, 0x7a76, 0x7cfb, 0x7f55, 0x8096, 0x8093, - 0x809d, 0x8098, 0x809b, 0x809a, 0x80b2, 0x826f, 0x8292, 0x828b, - 0x828d, 0x898b, 0x89d2, 0x8a00, 0x8c37, 0x8c46, 0x8c55, 0x8c9d, - 0x8d64, 0x8d70, 0x8db3, 0x8eab, 0x8eca, 0x8f9b, 0x8fb0, 0x8fc2, - 0x8fc6, 0x8fc5, 0x8fc4, 0x5de1, 0x9091, 0x90a2, 0x90aa, 0x90a6, - 0x90a3, 0x9149, 0x91c6, 0x91cc, 0x9632, 0x962e, 0x9631, 0x962a, - 0x962c, 0x4e26, 0x4e56, 0x4e73, 0x4e8b, 0x4e9b, 0x4e9e, 0x4eab, - 0x4eac, 0x4f6f, 0x4f9d, 0x4f8d, 0x4f73, 0x4f7f, 0x4f6c, 0x4f9b, - 0x4f8b, 0x4f86, 0x4f83, 0x4f70, 0x4f75, 0x4f88, 0x4f69, 0x4f7b, - 0x4f96, 0x4f7e, 0x4f8f, 0x4f91, 0x4f7a, 0x5154, 0x5152, 0x5155, - 0x5169, 0x5177, 0x5176, 0x5178, 0x51bd, 0x51fd, 0x523b, 0x5238, - 0x5237, 0x523a, 0x5230, 0x522e, 0x5236, 0x5241, 0x52be, 0x52bb, - 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, 0x5378, 0x5379, - 0x53d6, 0x53d4, 0x53d7, 0x5473, 0x5475, - /* 0xa9 */ - 0x5496, 0x5478, 0x5495, 0x5480, 0x547b, 0x5477, 0x5484, 0x5492, - 0x5486, 0x547c, 0x5490, 0x5471, 0x5476, 0x548c, 0x549a, 0x5462, - 0x5468, 0x548b, 0x547d, 0x548e, 0x56fa, 0x5783, 0x5777, 0x576a, - 0x5769, 0x5761, 0x5766, 0x5764, 0x577c, 0x591c, 0x5949, 0x5947, - 0x5948, 0x5944, 0x5954, 0x59be, 0x59bb, 0x59d4, 0x59b9, 0x59ae, - 0x59d1, 0x59c6, 0x59d0, 0x59cd, 0x59cb, 0x59d3, 0x59ca, 0x59af, - 0x59b3, 0x59d2, 0x59c5, 0x5b5f, 0x5b64, 0x5b63, 0x5b97, 0x5b9a, - 0x5b98, 0x5b9c, 0x5b99, 0x5b9b, 0x5c1a, 0x5c48, 0x5c45, 0x5c46, - 0x5cb7, 0x5ca1, 0x5cb8, 0x5ca9, 0x5cab, 0x5cb1, 0x5cb3, 0x5e18, - 0x5e1a, 0x5e16, 0x5e15, 0x5e1b, 0x5e11, 0x5e78, 0x5e9a, 0x5e97, - 0x5e9c, 0x5e95, 0x5e96, 0x5ef6, 0x5f26, 0x5f27, 0x5f29, 0x5f80, - 0x5f81, 0x5f7f, 0x5f7c, 0x5fdd, 0x5fe0, 0x5ffd, 0x5ff5, 0x5fff, - 0x600f, 0x6014, 0x602f, 0x6035, 0x6016, 0x602a, 0x6015, 0x6021, - 0x6027, 0x6029, 0x602b, 0x601b, 0x6216, 0x6215, 0x623f, 0x623e, - 0x6240, 0x627f, 0x62c9, 0x62cc, 0x62c4, 0x62bf, 0x62c2, 0x62b9, - 0x62d2, 0x62db, 0x62ab, 0x62d3, 0x62d4, 0x62cb, 0x62c8, 0x62a8, - 0x62bd, 0x62bc, 0x62d0, 0x62d9, 0x62c7, 0x62cd, 0x62b5, 0x62da, - 0x62b1, 0x62d8, 0x62d6, 0x62d7, 0x62c6, 0x62ac, 0x62ce, 0x653e, - 0x65a7, 0x65bc, 0x65fa, 0x6614, 0x6613, 0x660c, 0x6606, 0x6602, - 0x660e, 0x6600, 0x660f, 0x6615, 0x660a, - /* 0xaa */ - 0x6607, 0x670d, 0x670b, 0x676d, 0x678b, 0x6795, 0x6771, 0x679c, - 0x6773, 0x6777, 0x6787, 0x679d, 0x6797, 0x676f, 0x6770, 0x677f, - 0x6789, 0x677e, 0x6790, 0x6775, 0x679a, 0x6793, 0x677c, 0x676a, - 0x6772, 0x6b23, 0x6b66, 0x6b67, 0x6b7f, 0x6c13, 0x6c1b, 0x6ce3, - 0x6ce8, 0x6cf3, 0x6cb1, 0x6ccc, 0x6ce5, 0x6cb3, 0x6cbd, 0x6cbe, - 0x6cbc, 0x6ce2, 0x6cab, 0x6cd5, 0x6cd3, 0x6cb8, 0x6cc4, 0x6cb9, - 0x6cc1, 0x6cae, 0x6cd7, 0x6cc5, 0x6cf1, 0x6cbf, 0x6cbb, 0x6ce1, - 0x6cdb, 0x6cca, 0x6cac, 0x6cef, 0x6cdc, 0x6cd6, 0x6ce0, 0x7095, - 0x708e, 0x7092, 0x708a, 0x7099, 0x722c, 0x722d, 0x7238, 0x7248, - 0x7267, 0x7269, 0x72c0, 0x72ce, 0x72d9, 0x72d7, 0x72d0, 0x73a9, - 0x73a8, 0x739f, 0x73ab, 0x73a5, 0x753d, 0x759d, 0x7599, 0x759a, - 0x7684, 0x76c2, 0x76f2, 0x76f4, 0x77e5, 0x77fd, 0x793e, 0x7940, - 0x7941, 0x79c9, 0x79c8, 0x7a7a, 0x7a79, 0x7afa, 0x7cfe, 0x7f54, - 0x7f8c, 0x7f8b, 0x8005, 0x80ba, 0x80a5, 0x80a2, 0x80b1, 0x80a1, - 0x80ab, 0x80a9, 0x80b4, 0x80aa, 0x80af, 0x81e5, 0x81fe, 0x820d, - 0x82b3, 0x829d, 0x8299, 0x82ad, 0x82bd, 0x829f, 0x82b9, 0x82b1, - 0x82ac, 0x82a5, 0x82af, 0x82b8, 0x82a3, 0x82b0, 0x82be, 0x82b7, - 0x864e, 0x8671, 0x521d, 0x8868, 0x8ecb, 0x8fce, 0x8fd4, 0x8fd1, - 0x90b5, 0x90b8, 0x90b1, 0x90b6, 0x91c7, 0x91d1, 0x9577, 0x9580, - 0x961c, 0x9640, 0x963f, 0x963b, 0x9644, - /* 0xab */ - 0x9642, 0x96b9, 0x96e8, 0x9752, 0x975e, 0x4e9f, 0x4ead, 0x4eae, - 0x4fe1, 0x4fb5, 0x4faf, 0x4fbf, 0x4fe0, 0x4fd1, 0x4fcf, 0x4fdd, - 0x4fc3, 0x4fb6, 0x4fd8, 0x4fdf, 0x4fca, 0x4fd7, 0x4fae, 0x4fd0, - 0x4fc4, 0x4fc2, 0x4fda, 0x4fce, 0x4fde, 0x4fb7, 0x5157, 0x5192, - 0x5191, 0x51a0, 0x524e, 0x5243, 0x524a, 0x524d, 0x524c, 0x524b, - 0x5247, 0x52c7, 0x52c9, 0x52c3, 0x52c1, 0x530d, 0x5357, 0x537b, - 0x539a, 0x53db, 0x54ac, 0x54c0, 0x54a8, 0x54ce, 0x54c9, 0x54b8, - 0x54a6, 0x54b3, 0x54c7, 0x54c2, 0x54bd, 0x54aa, 0x54c1, 0x54c4, - 0x54c8, 0x54af, 0x54ab, 0x54b1, 0x54bb, 0x54a9, 0x54a7, 0x54bf, - 0x56ff, 0x5782, 0x578b, 0x57a0, 0x57a3, 0x57a2, 0x57ce, 0x57ae, - 0x5793, 0x5955, 0x5951, 0x594f, 0x594e, 0x5950, 0x59dc, 0x59d8, - 0x59ff, 0x59e3, 0x59e8, 0x5a03, 0x59e5, 0x59ea, 0x59da, 0x59e6, - 0x5a01, 0x59fb, 0x5b69, 0x5ba3, 0x5ba6, 0x5ba4, 0x5ba2, 0x5ba5, - 0x5c01, 0x5c4e, 0x5c4f, 0x5c4d, 0x5c4b, 0x5cd9, 0x5cd2, 0x5df7, - 0x5e1d, 0x5e25, 0x5e1f, 0x5e7d, 0x5ea0, 0x5ea6, 0x5efa, 0x5f08, - 0x5f2d, 0x5f65, 0x5f88, 0x5f85, 0x5f8a, 0x5f8b, 0x5f87, 0x5f8c, - 0x5f89, 0x6012, 0x601d, 0x6020, 0x6025, 0x600e, 0x6028, 0x604d, - 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606c, 0x606b, 0x606a, - 0x6064, 0x6241, 0x62dc, 0x6316, 0x6309, 0x62fc, 0x62ed, 0x6301, - 0x62ee, 0x62fd, 0x6307, 0x62f1, 0x62f7, - /* 0xac */ - 0x62ef, 0x62ec, 0x62fe, 0x62f4, 0x6311, 0x6302, 0x653f, 0x6545, - 0x65ab, 0x65bd, 0x65e2, 0x6625, 0x662d, 0x6620, 0x6627, 0x662f, - 0x661f, 0x6628, 0x6631, 0x6624, 0x66f7, 0x67ff, 0x67d3, 0x67f1, - 0x67d4, 0x67d0, 0x67ec, 0x67b6, 0x67af, 0x67f5, 0x67e9, 0x67ef, - 0x67c4, 0x67d1, 0x67b4, 0x67da, 0x67e5, 0x67b8, 0x67cf, 0x67de, - 0x67f3, 0x67b0, 0x67d9, 0x67e2, 0x67dd, 0x67d2, 0x6b6a, 0x6b83, - 0x6b86, 0x6bb5, 0x6bd2, 0x6bd7, 0x6c1f, 0x6cc9, 0x6d0b, 0x6d32, - 0x6d2a, 0x6d41, 0x6d25, 0x6d0c, 0x6d31, 0x6d1e, 0x6d17, 0x6d3b, - 0x6d3d, 0x6d3e, 0x6d36, 0x6d1b, 0x6cf5, 0x6d39, 0x6d27, 0x6d38, - 0x6d29, 0x6d2e, 0x6d35, 0x6d0e, 0x6d2b, 0x70ab, 0x70ba, 0x70b3, - 0x70ac, 0x70af, 0x70ad, 0x70b8, 0x70ae, 0x70a4, 0x7230, 0x7272, - 0x726f, 0x7274, 0x72e9, 0x72e0, 0x72e1, 0x73b7, 0x73ca, 0x73bb, - 0x73b2, 0x73cd, 0x73c0, 0x73b3, 0x751a, 0x752d, 0x754f, 0x754c, - 0x754e, 0x754b, 0x75ab, 0x75a4, 0x75a5, 0x75a2, 0x75a3, 0x7678, - 0x7686, 0x7687, 0x7688, 0x76c8, 0x76c6, 0x76c3, 0x76c5, 0x7701, - 0x76f9, 0x76f8, 0x7709, 0x770b, 0x76fe, 0x76fc, 0x7707, 0x77dc, - 0x7802, 0x7814, 0x780c, 0x780d, 0x7946, 0x7949, 0x7948, 0x7947, - 0x79b9, 0x79ba, 0x79d1, 0x79d2, 0x79cb, 0x7a7f, 0x7a81, 0x7aff, - 0x7afd, 0x7c7d, 0x7d02, 0x7d05, 0x7d00, 0x7d09, 0x7d07, 0x7d04, - 0x7d06, 0x7f38, 0x7f8e, 0x7fbf, 0x8004, - /* 0xad */ - 0x8010, 0x800d, 0x8011, 0x8036, 0x80d6, 0x80e5, 0x80da, 0x80c3, - 0x80c4, 0x80cc, 0x80e1, 0x80db, 0x80ce, 0x80de, 0x80e4, 0x80dd, - 0x81f4, 0x8222, 0x82e7, 0x8303, 0x8305, 0x82e3, 0x82db, 0x82e6, - 0x8304, 0x82e5, 0x8302, 0x8309, 0x82d2, 0x82d7, 0x82f1, 0x8301, - 0x82dc, 0x82d4, 0x82d1, 0x82de, 0x82d3, 0x82df, 0x82ef, 0x8306, - 0x8650, 0x8679, 0x867b, 0x867a, 0x884d, 0x886b, 0x8981, 0x89d4, - 0x8a08, 0x8a02, 0x8a03, 0x8c9e, 0x8ca0, 0x8d74, 0x8d73, 0x8db4, - 0x8ecd, 0x8ecc, 0x8ff0, 0x8fe6, 0x8fe2, 0x8fea, 0x8fe5, 0x8fed, - 0x8feb, 0x8fe4, 0x8fe8, 0x90ca, 0x90ce, 0x90c1, 0x90c3, 0x914b, - 0x914a, 0x91cd, 0x9582, 0x9650, 0x964b, 0x964c, 0x964d, 0x9762, - 0x9769, 0x97cb, 0x97ed, 0x97f3, 0x9801, 0x98a8, 0x98db, 0x98df, - 0x9996, 0x9999, 0x4e58, 0x4eb3, 0x500c, 0x500d, 0x5023, 0x4fef, - 0x5026, 0x5025, 0x4ff8, 0x5029, 0x5016, 0x5006, 0x503c, 0x501f, - 0x501a, 0x5012, 0x5011, 0x4ffa, 0x5000, 0x5014, 0x5028, 0x4ff1, - 0x5021, 0x500b, 0x5019, 0x5018, 0x4ff3, 0x4fee, 0x502d, 0x502a, - 0x4ffe, 0x502b, 0x5009, 0x517c, 0x51a4, 0x51a5, 0x51a2, 0x51cd, - 0x51cc, 0x51c6, 0x51cb, 0x5256, 0x525c, 0x5254, 0x525b, 0x525d, - 0x532a, 0x537f, 0x539f, 0x539d, 0x53df, 0x54e8, 0x5510, 0x5501, - 0x5537, 0x54fc, 0x54e5, 0x54f2, 0x5506, 0x54fa, 0x5514, 0x54e9, - 0x54ed, 0x54e1, 0x5509, 0x54ee, 0x54ea, - /* 0xae */ - 0x54e6, 0x5527, 0x5507, 0x54fd, 0x550f, 0x5703, 0x5704, 0x57c2, - 0x57d4, 0x57cb, 0x57c3, 0x5809, 0x590f, 0x5957, 0x5958, 0x595a, - 0x5a11, 0x5a18, 0x5a1c, 0x5a1f, 0x5a1b, 0x5a13, 0x59ec, 0x5a20, - 0x5a23, 0x5a29, 0x5a25, 0x5a0c, 0x5a09, 0x5b6b, 0x5c58, 0x5bb0, - 0x5bb3, 0x5bb6, 0x5bb4, 0x5bae, 0x5bb5, 0x5bb9, 0x5bb8, 0x5c04, - 0x5c51, 0x5c55, 0x5c50, 0x5ced, 0x5cfd, 0x5cfb, 0x5cea, 0x5ce8, - 0x5cf0, 0x5cf6, 0x5d01, 0x5cf4, 0x5dee, 0x5e2d, 0x5e2b, 0x5eab, - 0x5ead, 0x5ea7, 0x5f31, 0x5f92, 0x5f91, 0x5f90, 0x6059, 0x6063, - 0x6065, 0x6050, 0x6055, 0x606d, 0x6069, 0x606f, 0x6084, 0x609f, - 0x609a, 0x608d, 0x6094, 0x608c, 0x6085, 0x6096, 0x6247, 0x62f3, - 0x6308, 0x62ff, 0x634e, 0x633e, 0x632f, 0x6355, 0x6342, 0x6346, - 0x634f, 0x6349, 0x633a, 0x6350, 0x633d, 0x632a, 0x632b, 0x6328, - 0x634d, 0x634c, 0x6548, 0x6549, 0x6599, 0x65c1, 0x65c5, 0x6642, - 0x6649, 0x664f, 0x6643, 0x6652, 0x664c, 0x6645, 0x6641, 0x66f8, - 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, 0x6846, 0x6853, - 0x6839, 0x6842, 0x6854, 0x6829, 0x68b3, 0x6817, 0x684c, 0x6851, - 0x683d, 0x67f4, 0x6850, 0x6840, 0x683c, 0x6843, 0x682a, 0x6845, - 0x6813, 0x6818, 0x6841, 0x6b8a, 0x6b89, 0x6bb7, 0x6c23, 0x6c27, - 0x6c28, 0x6c26, 0x6c24, 0x6cf0, 0x6d6a, 0x6d95, 0x6d88, 0x6d87, - 0x6d66, 0x6d78, 0x6d77, 0x6d59, 0x6d93, - /* 0xaf */ - 0x6d6c, 0x6d89, 0x6d6e, 0x6d5a, 0x6d74, 0x6d69, 0x6d8c, 0x6d8a, - 0x6d79, 0x6d85, 0x6d65, 0x6d94, 0x70ca, 0x70d8, 0x70e4, 0x70d9, - 0x70c8, 0x70cf, 0x7239, 0x7279, 0x72fc, 0x72f9, 0x72fd, 0x72f8, - 0x72f7, 0x7386, 0x73ed, 0x7409, 0x73ee, 0x73e0, 0x73ea, 0x73de, - 0x7554, 0x755d, 0x755c, 0x755a, 0x7559, 0x75be, 0x75c5, 0x75c7, - 0x75b2, 0x75b3, 0x75bd, 0x75bc, 0x75b9, 0x75c2, 0x75b8, 0x768b, - 0x76b0, 0x76ca, 0x76cd, 0x76ce, 0x7729, 0x771f, 0x7720, 0x7728, - 0x77e9, 0x7830, 0x7827, 0x7838, 0x781d, 0x7834, 0x7837, 0x7825, - 0x782d, 0x7820, 0x781f, 0x7832, 0x7955, 0x7950, 0x7960, 0x795f, - 0x7956, 0x795e, 0x795d, 0x7957, 0x795a, 0x79e4, 0x79e3, 0x79e7, - 0x79df, 0x79e6, 0x79e9, 0x79d8, 0x7a84, 0x7a88, 0x7ad9, 0x7b06, - 0x7b11, 0x7c89, 0x7d21, 0x7d17, 0x7d0b, 0x7d0a, 0x7d20, 0x7d22, - 0x7d14, 0x7d10, 0x7d15, 0x7d1a, 0x7d1c, 0x7d0d, 0x7d19, 0x7d1b, - 0x7f3a, 0x7f5f, 0x7f94, 0x7fc5, 0x7fc1, 0x8006, 0x8018, 0x8015, - 0x8019, 0x8017, 0x803d, 0x803f, 0x80f1, 0x8102, 0x80f0, 0x8105, - 0x80ed, 0x80f4, 0x8106, 0x80f8, 0x80f3, 0x8108, 0x80fd, 0x810a, - 0x80fc, 0x80ef, 0x81ed, 0x81ec, 0x8200, 0x8210, 0x822a, 0x822b, - 0x8228, 0x822c, 0x82bb, 0x832b, 0x8352, 0x8354, 0x834a, 0x8338, - 0x8350, 0x8349, 0x8335, 0x8334, 0x834f, 0x8332, 0x8339, 0x8336, - 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, - /* 0xb0 */ - 0x8654, 0x868a, 0x86aa, 0x8693, 0x86a4, 0x86a9, 0x868c, 0x86a3, - 0x869c, 0x8870, 0x8877, 0x8881, 0x8882, 0x887d, 0x8879, 0x8a18, - 0x8a10, 0x8a0e, 0x8a0c, 0x8a15, 0x8a0a, 0x8a17, 0x8a13, 0x8a16, - 0x8a0f, 0x8a11, 0x8c48, 0x8c7a, 0x8c79, 0x8ca1, 0x8ca2, 0x8d77, - 0x8eac, 0x8ed2, 0x8ed4, 0x8ecf, 0x8fb1, 0x9001, 0x9006, 0x8ff7, - 0x9000, 0x8ffa, 0x8ff4, 0x9003, 0x8ffd, 0x9005, 0x8ff8, 0x9095, - 0x90e1, 0x90dd, 0x90e2, 0x9152, 0x914d, 0x914c, 0x91d8, 0x91dd, - 0x91d7, 0x91dc, 0x91d9, 0x9583, 0x9662, 0x9663, 0x9661, 0x965b, - 0x965d, 0x9664, 0x9658, 0x965e, 0x96bb, 0x98e2, 0x99ac, 0x9aa8, - 0x9ad8, 0x9b25, 0x9b32, 0x9b3c, 0x4e7e, 0x507a, 0x507d, 0x505c, - 0x5047, 0x5043, 0x504c, 0x505a, 0x5049, 0x5065, 0x5076, 0x504e, - 0x5055, 0x5075, 0x5074, 0x5077, 0x504f, 0x500f, 0x506f, 0x506d, - 0x515c, 0x5195, 0x51f0, 0x526a, 0x526f, 0x52d2, 0x52d9, 0x52d8, - 0x52d5, 0x5310, 0x530f, 0x5319, 0x533f, 0x5340, 0x533e, 0x53c3, - 0x66fc, 0x5546, 0x556a, 0x5566, 0x5544, 0x555e, 0x5561, 0x5543, - 0x554a, 0x5531, 0x5556, 0x554f, 0x5555, 0x552f, 0x5564, 0x5538, - 0x552e, 0x555c, 0x552c, 0x5563, 0x5533, 0x5541, 0x5557, 0x5708, - 0x570b, 0x5709, 0x57df, 0x5805, 0x580a, 0x5806, 0x57e0, 0x57e4, - 0x57fa, 0x5802, 0x5835, 0x57f7, 0x57f9, 0x5920, 0x5962, 0x5a36, - 0x5a41, 0x5a49, 0x5a66, 0x5a6a, 0x5a40, - /* 0xb1 */ - 0x5a3c, 0x5a62, 0x5a5a, 0x5a46, 0x5a4a, 0x5b70, 0x5bc7, 0x5bc5, - 0x5bc4, 0x5bc2, 0x5bbf, 0x5bc6, 0x5c09, 0x5c08, 0x5c07, 0x5c60, - 0x5c5c, 0x5c5d, 0x5d07, 0x5d06, 0x5d0e, 0x5d1b, 0x5d16, 0x5d22, - 0x5d11, 0x5d29, 0x5d14, 0x5d19, 0x5d24, 0x5d27, 0x5d17, 0x5de2, - 0x5e38, 0x5e36, 0x5e33, 0x5e37, 0x5eb7, 0x5eb8, 0x5eb6, 0x5eb5, - 0x5ebe, 0x5f35, 0x5f37, 0x5f57, 0x5f6c, 0x5f69, 0x5f6b, 0x5f97, - 0x5f99, 0x5f9e, 0x5f98, 0x5fa1, 0x5fa0, 0x5f9c, 0x607f, 0x60a3, - 0x6089, 0x60a0, 0x60a8, 0x60cb, 0x60b4, 0x60e6, 0x60bd, 0x60c5, - 0x60bb, 0x60b5, 0x60dc, 0x60bc, 0x60d8, 0x60d5, 0x60c6, 0x60df, - 0x60b8, 0x60da, 0x60c7, 0x621a, 0x621b, 0x6248, 0x63a0, 0x63a7, - 0x6372, 0x6396, 0x63a2, 0x63a5, 0x6377, 0x6367, 0x6398, 0x63aa, - 0x6371, 0x63a9, 0x6389, 0x6383, 0x639b, 0x636b, 0x63a8, 0x6384, - 0x6388, 0x6399, 0x63a1, 0x63ac, 0x6392, 0x638f, 0x6380, 0x637b, - 0x6369, 0x6368, 0x637a, 0x655d, 0x6556, 0x6551, 0x6559, 0x6557, - 0x555f, 0x654f, 0x6558, 0x6555, 0x6554, 0x659c, 0x659b, 0x65ac, - 0x65cf, 0x65cb, 0x65cc, 0x65ce, 0x665d, 0x665a, 0x6664, 0x6668, - 0x6666, 0x665e, 0x66f9, 0x52d7, 0x671b, 0x6881, 0x68af, 0x68a2, - 0x6893, 0x68b5, 0x687f, 0x6876, 0x68b1, 0x68a7, 0x6897, 0x68b0, - 0x6883, 0x68c4, 0x68ad, 0x6886, 0x6885, 0x6894, 0x689d, 0x68a8, - 0x689f, 0x68a1, 0x6882, 0x6b32, 0x6bba, - /* 0xb2 */ - 0x6beb, 0x6bec, 0x6c2b, 0x6d8e, 0x6dbc, 0x6df3, 0x6dd9, 0x6db2, - 0x6de1, 0x6dcc, 0x6de4, 0x6dfb, 0x6dfa, 0x6e05, 0x6dc7, 0x6dcb, - 0x6daf, 0x6dd1, 0x6dae, 0x6dde, 0x6df9, 0x6db8, 0x6df7, 0x6df5, - 0x6dc5, 0x6dd2, 0x6e1a, 0x6db5, 0x6dda, 0x6deb, 0x6dd8, 0x6dea, - 0x6df1, 0x6dee, 0x6de8, 0x6dc6, 0x6dc4, 0x6daa, 0x6dec, 0x6dbf, - 0x6de6, 0x70f9, 0x7109, 0x710a, 0x70fd, 0x70ef, 0x723d, 0x727d, - 0x7281, 0x731c, 0x731b, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, - 0x740a, 0x7403, 0x7406, 0x73fe, 0x740d, 0x74e0, 0x74f6, 0x74f7, - 0x751c, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, 0x758f, 0x75d4, - 0x75d5, 0x75b5, 0x75ca, 0x75cd, 0x768e, 0x76d4, 0x76d2, 0x76db, - 0x7737, 0x773e, 0x773c, 0x7736, 0x7738, 0x773a, 0x786b, 0x7843, - 0x784e, 0x7965, 0x7968, 0x796d, 0x79fb, 0x7a92, 0x7a95, 0x7b20, - 0x7b28, 0x7b1b, 0x7b2c, 0x7b26, 0x7b19, 0x7b1e, 0x7b2e, 0x7c92, - 0x7c97, 0x7c95, 0x7d46, 0x7d43, 0x7d71, 0x7d2e, 0x7d39, 0x7d3c, - 0x7d40, 0x7d30, 0x7d33, 0x7d44, 0x7d2f, 0x7d42, 0x7d32, 0x7d31, - 0x7f3d, 0x7f9e, 0x7f9a, 0x7fcc, 0x7fce, 0x7fd2, 0x801c, 0x804a, - 0x8046, 0x812f, 0x8116, 0x8123, 0x812b, 0x8129, 0x8130, 0x8124, - 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838e, 0x839e, 0x8398, - 0x8378, 0x83a2, 0x8396, 0x83bd, 0x83ab, 0x8392, 0x838a, 0x8393, - 0x8389, 0x83a0, 0x8377, 0x837b, 0x837c, - /* 0xb3 */ - 0x8386, 0x83a7, 0x8655, 0x5f6a, 0x86c7, 0x86c0, 0x86b6, 0x86c4, - 0x86b5, 0x86c6, 0x86cb, 0x86b1, 0x86af, 0x86c9, 0x8853, 0x889e, - 0x8888, 0x88ab, 0x8892, 0x8896, 0x888d, 0x888b, 0x8993, 0x898f, - 0x8a2a, 0x8a1d, 0x8a23, 0x8a25, 0x8a31, 0x8a2d, 0x8a1f, 0x8a1b, - 0x8a22, 0x8c49, 0x8c5a, 0x8ca9, 0x8cac, 0x8cab, 0x8ca8, 0x8caa, - 0x8ca7, 0x8d67, 0x8d66, 0x8dbe, 0x8dba, 0x8edb, 0x8edf, 0x9019, - 0x900d, 0x901a, 0x9017, 0x9023, 0x901f, 0x901d, 0x9010, 0x9015, - 0x901e, 0x9020, 0x900f, 0x9022, 0x9016, 0x901b, 0x9014, 0x90e8, - 0x90ed, 0x90fd, 0x9157, 0x91ce, 0x91f5, 0x91e6, 0x91e3, 0x91e7, - 0x91ed, 0x91e9, 0x9589, 0x966a, 0x9675, 0x9673, 0x9678, 0x9670, - 0x9674, 0x9676, 0x9677, 0x966c, 0x96c0, 0x96ea, 0x96e9, 0x7ae0, - 0x7adf, 0x9802, 0x9803, 0x9b5a, 0x9ce5, 0x9e75, 0x9e7f, 0x9ea5, - 0x9ebb, 0x50a2, 0x508d, 0x5085, 0x5099, 0x5091, 0x5080, 0x5096, - 0x5098, 0x509a, 0x6700, 0x51f1, 0x5272, 0x5274, 0x5275, 0x5269, - 0x52de, 0x52dd, 0x52db, 0x535a, 0x53a5, 0x557b, 0x5580, 0x55a7, - 0x557c, 0x558a, 0x559d, 0x5598, 0x5582, 0x559c, 0x55aa, 0x5594, - 0x5587, 0x558b, 0x5583, 0x55b3, 0x55ae, 0x559f, 0x553e, 0x55b2, - 0x559a, 0x55bb, 0x55ac, 0x55b1, 0x557e, 0x5589, 0x55ab, 0x5599, - 0x570d, 0x582f, 0x582a, 0x5834, 0x5824, 0x5830, 0x5831, 0x5821, - 0x581d, 0x5820, 0x58f9, 0x58fa, 0x5960, - /* 0xb4 */ - 0x5a77, 0x5a9a, 0x5a7f, 0x5a92, 0x5a9b, 0x5aa7, 0x5b73, 0x5b71, - 0x5bd2, 0x5bcc, 0x5bd3, 0x5bd0, 0x5c0a, 0x5c0b, 0x5c31, 0x5d4c, - 0x5d50, 0x5d34, 0x5d47, 0x5dfd, 0x5e45, 0x5e3d, 0x5e40, 0x5e43, - 0x5e7e, 0x5eca, 0x5ec1, 0x5ec2, 0x5ec4, 0x5f3c, 0x5f6d, 0x5fa9, - 0x5faa, 0x5fa8, 0x60d1, 0x60e1, 0x60b2, 0x60b6, 0x60e0, 0x611c, - 0x6123, 0x60fa, 0x6115, 0x60f0, 0x60fb, 0x60f4, 0x6168, 0x60f1, - 0x610e, 0x60f6, 0x6109, 0x6100, 0x6112, 0x621f, 0x6249, 0x63a3, - 0x638c, 0x63cf, 0x63c0, 0x63e9, 0x63c9, 0x63c6, 0x63cd, 0x63d2, - 0x63e3, 0x63d0, 0x63e1, 0x63d6, 0x63ed, 0x63ee, 0x6376, 0x63f4, - 0x63ea, 0x63db, 0x6452, 0x63da, 0x63f9, 0x655e, 0x6566, 0x6562, - 0x6563, 0x6591, 0x6590, 0x65af, 0x666e, 0x6670, 0x6674, 0x6676, - 0x666f, 0x6691, 0x667a, 0x667e, 0x6677, 0x66fe, 0x66ff, 0x671f, - 0x671d, 0x68fa, 0x68d5, 0x68e0, 0x68d8, 0x68d7, 0x6905, 0x68df, - 0x68f5, 0x68ee, 0x68e7, 0x68f9, 0x68d2, 0x68f2, 0x68e3, 0x68cb, - 0x68cd, 0x690d, 0x6912, 0x690e, 0x68c9, 0x68da, 0x696e, 0x68fb, - 0x6b3e, 0x6b3a, 0x6b3d, 0x6b98, 0x6b96, 0x6bbc, 0x6bef, 0x6c2e, - 0x6c2f, 0x6c2c, 0x6e2f, 0x6e38, 0x6e54, 0x6e21, 0x6e32, 0x6e67, - 0x6e4a, 0x6e20, 0x6e25, 0x6e23, 0x6e1b, 0x6e5b, 0x6e58, 0x6e24, - 0x6e56, 0x6e6e, 0x6e2d, 0x6e26, 0x6e6f, 0x6e34, 0x6e4d, 0x6e3a, - 0x6e2c, 0x6e43, 0x6e1d, 0x6e3e, 0x6ecb, - /* 0xb5 */ - 0x6e89, 0x6e19, 0x6e4e, 0x6e63, 0x6e44, 0x6e72, 0x6e69, 0x6e5f, - 0x7119, 0x711a, 0x7126, 0x7130, 0x7121, 0x7136, 0x716e, 0x711c, - 0x724c, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743a, - 0x742a, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742f, - 0x741b, 0x7426, 0x7428, 0x7525, 0x7526, 0x756b, 0x756a, 0x75e2, - 0x75db, 0x75e3, 0x75d9, 0x75d8, 0x75de, 0x75e0, 0x767b, 0x767c, - 0x7696, 0x7693, 0x76b4, 0x76dc, 0x774f, 0x77ed, 0x785d, 0x786c, - 0x786f, 0x7a0d, 0x7a08, 0x7a0b, 0x7a05, 0x7a00, 0x7a98, 0x7a97, - 0x7a96, 0x7ae5, 0x7ae3, 0x7b49, 0x7b56, 0x7b46, 0x7b50, 0x7b52, - 0x7b54, 0x7b4d, 0x7b4b, 0x7b4f, 0x7b51, 0x7c9f, 0x7ca5, 0x7d5e, - 0x7d50, 0x7d68, 0x7d55, 0x7d2b, 0x7d6e, 0x7d72, 0x7d61, 0x7d66, - 0x7d62, 0x7d70, 0x7d73, 0x5584, 0x7fd4, 0x7fd5, 0x800b, 0x8052, - 0x8085, 0x8155, 0x8154, 0x814b, 0x8151, 0x814e, 0x8139, 0x8146, - 0x813e, 0x814c, 0x8153, 0x8174, 0x8212, 0x821c, 0x83e9, 0x8403, - 0x83f8, 0x840d, 0x83e0, 0x83c5, 0x840b, 0x83c1, 0x83ef, 0x83f1, - 0x83f4, 0x8457, 0x840a, 0x83f0, 0x840c, 0x83cc, 0x83fd, 0x83f2, - 0x83ca, 0x8438, 0x840e, 0x8404, 0x83dc, 0x8407, 0x83d4, 0x83df, - 0x865b, 0x86df, 0x86d9, 0x86ed, 0x86d4, 0x86db, 0x86e4, 0x86d0, - 0x86de, 0x8857, 0x88c1, 0x88c2, 0x88b1, 0x8983, 0x8996, 0x8a3b, - 0x8a60, 0x8a55, 0x8a5e, 0x8a3c, 0x8a41, - /* 0xb6 */ - 0x8a54, 0x8a5b, 0x8a50, 0x8a46, 0x8a34, 0x8a3a, 0x8a36, 0x8a56, - 0x8c61, 0x8c82, 0x8caf, 0x8cbc, 0x8cb3, 0x8cbd, 0x8cc1, 0x8cbb, - 0x8cc0, 0x8cb4, 0x8cb7, 0x8cb6, 0x8cbf, 0x8cb8, 0x8d8a, 0x8d85, - 0x8d81, 0x8dce, 0x8ddd, 0x8dcb, 0x8dda, 0x8dd1, 0x8dcc, 0x8ddb, - 0x8dc6, 0x8efb, 0x8ef8, 0x8efc, 0x8f9c, 0x902e, 0x9035, 0x9031, - 0x9038, 0x9032, 0x9036, 0x9102, 0x90f5, 0x9109, 0x90fe, 0x9163, - 0x9165, 0x91cf, 0x9214, 0x9215, 0x9223, 0x9209, 0x921e, 0x920d, - 0x9210, 0x9207, 0x9211, 0x9594, 0x958f, 0x958b, 0x9591, 0x9593, - 0x9592, 0x958e, 0x968a, 0x968e, 0x968b, 0x967d, 0x9685, 0x9686, - 0x968d, 0x9672, 0x9684, 0x96c1, 0x96c5, 0x96c4, 0x96c6, 0x96c7, - 0x96ef, 0x96f2, 0x97cc, 0x9805, 0x9806, 0x9808, 0x98e7, 0x98ea, - 0x98ef, 0x98e9, 0x98f2, 0x98ed, 0x99ae, 0x99ad, 0x9ec3, 0x9ecd, - 0x9ed1, 0x4e82, 0x50ad, 0x50b5, 0x50b2, 0x50b3, 0x50c5, 0x50be, - 0x50ac, 0x50b7, 0x50bb, 0x50af, 0x50c7, 0x527f, 0x5277, 0x527d, - 0x52df, 0x52e6, 0x52e4, 0x52e2, 0x52e3, 0x532f, 0x55df, 0x55e8, - 0x55d3, 0x55e6, 0x55ce, 0x55dc, 0x55c7, 0x55d1, 0x55e3, 0x55e4, - 0x55ef, 0x55da, 0x55e1, 0x55c5, 0x55c6, 0x55e5, 0x55c9, 0x5712, - 0x5713, 0x585e, 0x5851, 0x5858, 0x5857, 0x585a, 0x5854, 0x586b, - 0x584c, 0x586d, 0x584a, 0x5862, 0x5852, 0x584b, 0x5967, 0x5ac1, - 0x5ac9, 0x5acc, 0x5abe, 0x5abd, 0x5abc, - /* 0xb7 */ - 0x5ab3, 0x5ac2, 0x5ab2, 0x5d69, 0x5d6f, 0x5e4c, 0x5e79, 0x5ec9, - 0x5ec8, 0x5f12, 0x5f59, 0x5fac, 0x5fae, 0x611a, 0x610f, 0x6148, - 0x611f, 0x60f3, 0x611b, 0x60f9, 0x6101, 0x6108, 0x614e, 0x614c, - 0x6144, 0x614d, 0x613e, 0x6134, 0x6127, 0x610d, 0x6106, 0x6137, - 0x6221, 0x6222, 0x6413, 0x643e, 0x641e, 0x642a, 0x642d, 0x643d, - 0x642c, 0x640f, 0x641c, 0x6414, 0x640d, 0x6436, 0x6416, 0x6417, - 0x6406, 0x656c, 0x659f, 0x65b0, 0x6697, 0x6689, 0x6687, 0x6688, - 0x6696, 0x6684, 0x6698, 0x668d, 0x6703, 0x6994, 0x696d, 0x695a, - 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, 0x694a, 0x6968, - 0x696b, 0x695e, 0x6953, 0x6979, 0x6986, 0x695d, 0x6963, 0x695b, - 0x6b47, 0x6b72, 0x6bc0, 0x6bbf, 0x6bd3, 0x6bfd, 0x6ea2, 0x6eaf, - 0x6ed3, 0x6eb6, 0x6ec2, 0x6e90, 0x6e9d, 0x6ec7, 0x6ec5, 0x6ea5, - 0x6e98, 0x6ebc, 0x6eba, 0x6eab, 0x6ed1, 0x6e96, 0x6e9c, 0x6ec4, - 0x6ed4, 0x6eaa, 0x6ea7, 0x6eb4, 0x714e, 0x7159, 0x7169, 0x7164, - 0x7149, 0x7167, 0x715c, 0x716c, 0x7166, 0x714c, 0x7165, 0x715e, - 0x7146, 0x7168, 0x7156, 0x723a, 0x7252, 0x7337, 0x7345, 0x733f, - 0x733e, 0x746f, 0x745a, 0x7455, 0x745f, 0x745e, 0x7441, 0x743f, - 0x7459, 0x745b, 0x745c, 0x7576, 0x7578, 0x7600, 0x75f0, 0x7601, - 0x75f2, 0x75f1, 0x75fa, 0x75ff, 0x75f4, 0x75f3, 0x76de, 0x76df, - 0x775b, 0x776b, 0x7766, 0x775e, 0x7763, - /* 0xb8 */ - 0x7779, 0x776a, 0x776c, 0x775c, 0x7765, 0x7768, 0x7762, 0x77ee, - 0x788e, 0x78b0, 0x7897, 0x7898, 0x788c, 0x7889, 0x787c, 0x7891, - 0x7893, 0x787f, 0x797a, 0x797f, 0x7981, 0x842c, 0x79bd, 0x7a1c, - 0x7a1a, 0x7a20, 0x7a14, 0x7a1f, 0x7a1e, 0x7a9f, 0x7aa0, 0x7b77, - 0x7bc0, 0x7b60, 0x7b6e, 0x7b67, 0x7cb1, 0x7cb3, 0x7cb5, 0x7d93, - 0x7d79, 0x7d91, 0x7d81, 0x7d8f, 0x7d5b, 0x7f6e, 0x7f69, 0x7f6a, - 0x7f72, 0x7fa9, 0x7fa8, 0x7fa4, 0x8056, 0x8058, 0x8086, 0x8084, - 0x8171, 0x8170, 0x8178, 0x8165, 0x816e, 0x8173, 0x816b, 0x8179, - 0x817a, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, 0x843d, 0x8431, - 0x8475, 0x8466, 0x846b, 0x8449, 0x846c, 0x845b, 0x843c, 0x8435, - 0x8461, 0x8463, 0x8469, 0x846d, 0x8446, 0x865e, 0x865c, 0x865f, - 0x86f9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86fe, 0x86fb, 0x8702, - 0x8703, 0x8706, 0x870a, 0x8859, 0x88df, 0x88d4, 0x88d9, 0x88dc, - 0x88d8, 0x88dd, 0x88e1, 0x88ca, 0x88d5, 0x88d2, 0x899c, 0x89e3, - 0x8a6b, 0x8a72, 0x8a73, 0x8a66, 0x8a69, 0x8a70, 0x8a87, 0x8a7c, - 0x8a63, 0x8aa0, 0x8a71, 0x8a85, 0x8a6d, 0x8a62, 0x8a6e, 0x8a6c, - 0x8a79, 0x8a7b, 0x8a3e, 0x8a68, 0x8c62, 0x8c8a, 0x8c89, 0x8cca, - 0x8cc7, 0x8cc8, 0x8cc4, 0x8cb2, 0x8cc3, 0x8cc2, 0x8cc5, 0x8de1, - 0x8ddf, 0x8de8, 0x8def, 0x8df3, 0x8dfa, 0x8dea, 0x8de4, 0x8de6, - 0x8eb2, 0x8f03, 0x8f09, 0x8efe, 0x8f0a, - /* 0xb9 */ - 0x8f9f, 0x8fb2, 0x904b, 0x904a, 0x9053, 0x9042, 0x9054, 0x903c, - 0x9055, 0x9050, 0x9047, 0x904f, 0x904e, 0x904d, 0x9051, 0x903e, - 0x9041, 0x9112, 0x9117, 0x916c, 0x916a, 0x9169, 0x91c9, 0x9237, - 0x9257, 0x9238, 0x923d, 0x9240, 0x923e, 0x925b, 0x924b, 0x9264, - 0x9251, 0x9234, 0x9249, 0x924d, 0x9245, 0x9239, 0x923f, 0x925a, - 0x9598, 0x9698, 0x9694, 0x9695, 0x96cd, 0x96cb, 0x96c9, 0x96ca, - 0x96f7, 0x96fb, 0x96f9, 0x96f6, 0x9756, 0x9774, 0x9776, 0x9810, - 0x9811, 0x9813, 0x980a, 0x9812, 0x980c, 0x98fc, 0x98f4, 0x98fd, - 0x98fe, 0x99b3, 0x99b1, 0x99b4, 0x9ae1, 0x9ce9, 0x9e82, 0x9f0e, - 0x9f13, 0x9f20, 0x50e7, 0x50ee, 0x50e5, 0x50d6, 0x50ed, 0x50da, - 0x50d5, 0x50cf, 0x50d1, 0x50f1, 0x50ce, 0x50e9, 0x5162, 0x51f3, - 0x5283, 0x5282, 0x5331, 0x53ad, 0x55fe, 0x5600, 0x561b, 0x5617, - 0x55fd, 0x5614, 0x5606, 0x5609, 0x560d, 0x560e, 0x55f7, 0x5616, - 0x561f, 0x5608, 0x5610, 0x55f6, 0x5718, 0x5716, 0x5875, 0x587e, - 0x5883, 0x5893, 0x588a, 0x5879, 0x5885, 0x587d, 0x58fd, 0x5925, - 0x5922, 0x5924, 0x596a, 0x5969, 0x5ae1, 0x5ae6, 0x5ae9, 0x5ad7, - 0x5ad6, 0x5ad8, 0x5ae3, 0x5b75, 0x5bde, 0x5be7, 0x5be1, 0x5be5, - 0x5be6, 0x5be8, 0x5be2, 0x5be4, 0x5bdf, 0x5c0d, 0x5c62, 0x5d84, - 0x5d87, 0x5e5b, 0x5e63, 0x5e55, 0x5e57, 0x5e54, 0x5ed3, 0x5ed6, - 0x5f0a, 0x5f46, 0x5f70, 0x5fb9, 0x6147, - /* 0xba */ - 0x613f, 0x614b, 0x6177, 0x6162, 0x6163, 0x615f, 0x615a, 0x6158, - 0x6175, 0x622a, 0x6487, 0x6458, 0x6454, 0x64a4, 0x6478, 0x645f, - 0x647a, 0x6451, 0x6467, 0x6434, 0x646d, 0x647b, 0x6572, 0x65a1, - 0x65d7, 0x65d6, 0x66a2, 0x66a8, 0x669d, 0x699c, 0x69a8, 0x6995, - 0x69c1, 0x69ae, 0x69d3, 0x69cb, 0x699b, 0x69b7, 0x69bb, 0x69ab, - 0x69b4, 0x69d0, 0x69cd, 0x69ad, 0x69cc, 0x69a6, 0x69c3, 0x69a3, - 0x6b49, 0x6b4c, 0x6c33, 0x6f33, 0x6f14, 0x6efe, 0x6f13, 0x6ef4, - 0x6f29, 0x6f3e, 0x6f20, 0x6f2c, 0x6f0f, 0x6f02, 0x6f22, 0x6eff, - 0x6eef, 0x6f06, 0x6f31, 0x6f38, 0x6f32, 0x6f23, 0x6f15, 0x6f2b, - 0x6f2f, 0x6f88, 0x6f2a, 0x6eec, 0x6f01, 0x6ef2, 0x6ecc, 0x6ef7, - 0x7194, 0x7199, 0x717d, 0x718a, 0x7184, 0x7192, 0x723e, 0x7292, - 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746a, 0x7470, 0x746d, - 0x7504, 0x7591, 0x7627, 0x760d, 0x760b, 0x7609, 0x7613, 0x76e1, - 0x76e3, 0x7784, 0x777d, 0x777f, 0x7761, 0x78c1, 0x789f, 0x78a7, - 0x78b3, 0x78a9, 0x78a3, 0x798e, 0x798f, 0x798d, 0x7a2e, 0x7a31, - 0x7aaa, 0x7aa9, 0x7aed, 0x7aef, 0x7ba1, 0x7b95, 0x7b8b, 0x7b75, - 0x7b97, 0x7b9d, 0x7b94, 0x7b8f, 0x7bb8, 0x7b87, 0x7b84, 0x7cb9, - 0x7cbd, 0x7cbe, 0x7dbb, 0x7db0, 0x7d9c, 0x7dbd, 0x7dbe, 0x7da0, - 0x7dca, 0x7db4, 0x7db2, 0x7db1, 0x7dba, 0x7da2, 0x7dbf, 0x7db5, - 0x7db8, 0x7dad, 0x7dd2, 0x7dc7, 0x7dac, - /* 0xbb */ - 0x7f70, 0x7fe0, 0x7fe1, 0x7fdf, 0x805e, 0x805a, 0x8087, 0x8150, - 0x8180, 0x818f, 0x8188, 0x818a, 0x817f, 0x8182, 0x81e7, 0x81fa, - 0x8207, 0x8214, 0x821e, 0x824b, 0x84c9, 0x84bf, 0x84c6, 0x84c4, - 0x8499, 0x849e, 0x84b2, 0x849c, 0x84cb, 0x84b8, 0x84c0, 0x84d3, - 0x8490, 0x84bc, 0x84d1, 0x84ca, 0x873f, 0x871c, 0x873b, 0x8722, - 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88f3, 0x8902, - 0x88f4, 0x88f9, 0x88f8, 0x88fd, 0x88e8, 0x891a, 0x88ef, 0x8aa6, - 0x8a8c, 0x8a9e, 0x8aa3, 0x8a8d, 0x8aa1, 0x8a93, 0x8aa4, 0x8aaa, - 0x8aa5, 0x8aa8, 0x8a98, 0x8a91, 0x8a9a, 0x8aa7, 0x8c6a, 0x8c8d, - 0x8c8c, 0x8cd3, 0x8cd1, 0x8cd2, 0x8d6b, 0x8d99, 0x8d95, 0x8dfc, - 0x8f14, 0x8f12, 0x8f15, 0x8f13, 0x8fa3, 0x9060, 0x9058, 0x905c, - 0x9063, 0x9059, 0x905e, 0x9062, 0x905d, 0x905b, 0x9119, 0x9118, - 0x911e, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, 0x9280, 0x9285, - 0x9298, 0x9296, 0x927b, 0x9293, 0x929c, 0x92a8, 0x927c, 0x9291, - 0x95a1, 0x95a8, 0x95a9, 0x95a3, 0x95a5, 0x95a4, 0x9699, 0x969c, - 0x969b, 0x96cc, 0x96d2, 0x9700, 0x977c, 0x9785, 0x97f6, 0x9817, - 0x9818, 0x98af, 0x98b1, 0x9903, 0x9905, 0x990c, 0x9909, 0x99c1, - 0x9aaf, 0x9ab0, 0x9ae6, 0x9b41, 0x9b42, 0x9cf4, 0x9cf6, 0x9cf3, - 0x9ebc, 0x9f3b, 0x9f4a, 0x5104, 0x5100, 0x50fb, 0x50f5, 0x50f9, - 0x5102, 0x5108, 0x5109, 0x5105, 0x51dc, - /* 0xbc */ - 0x5287, 0x5288, 0x5289, 0x528d, 0x528a, 0x52f0, 0x53b2, 0x562e, - 0x563b, 0x5639, 0x5632, 0x563f, 0x5634, 0x5629, 0x5653, 0x564e, - 0x5657, 0x5674, 0x5636, 0x562f, 0x5630, 0x5880, 0x589f, 0x589e, - 0x58b3, 0x589c, 0x58ae, 0x58a9, 0x58a6, 0x596d, 0x5b09, 0x5afb, - 0x5b0b, 0x5af5, 0x5b0c, 0x5b08, 0x5bee, 0x5bec, 0x5be9, 0x5beb, - 0x5c64, 0x5c65, 0x5d9d, 0x5d94, 0x5e62, 0x5e5f, 0x5e61, 0x5ee2, - 0x5eda, 0x5edf, 0x5edd, 0x5ee3, 0x5ee0, 0x5f48, 0x5f71, 0x5fb7, - 0x5fb5, 0x6176, 0x6167, 0x616e, 0x615d, 0x6155, 0x6182, 0x617c, - 0x6170, 0x616b, 0x617e, 0x61a7, 0x6190, 0x61ab, 0x618e, 0x61ac, - 0x619a, 0x61a4, 0x6194, 0x61ae, 0x622e, 0x6469, 0x646f, 0x6479, - 0x649e, 0x64b2, 0x6488, 0x6490, 0x64b0, 0x64a5, 0x6493, 0x6495, - 0x64a9, 0x6492, 0x64ae, 0x64ad, 0x64ab, 0x649a, 0x64ac, 0x6499, - 0x64a2, 0x64b3, 0x6575, 0x6577, 0x6578, 0x66ae, 0x66ab, 0x66b4, - 0x66b1, 0x6a23, 0x6a1f, 0x69e8, 0x6a01, 0x6a1e, 0x6a19, 0x69fd, - 0x6a21, 0x6a13, 0x6a0a, 0x69f3, 0x6a02, 0x6a05, 0x69ed, 0x6a11, - 0x6b50, 0x6b4e, 0x6ba4, 0x6bc5, 0x6bc6, 0x6f3f, 0x6f7c, 0x6f84, - 0x6f51, 0x6f66, 0x6f54, 0x6f86, 0x6f6d, 0x6f5b, 0x6f78, 0x6f6e, - 0x6f8e, 0x6f7a, 0x6f70, 0x6f64, 0x6f97, 0x6f58, 0x6ed5, 0x6f6f, - 0x6f60, 0x6f5f, 0x719f, 0x71ac, 0x71b1, 0x71a8, 0x7256, 0x729b, - 0x734e, 0x7357, 0x7469, 0x748b, 0x7483, - /* 0xbd */ - 0x747e, 0x7480, 0x757f, 0x7620, 0x7629, 0x761f, 0x7624, 0x7626, - 0x7621, 0x7622, 0x769a, 0x76ba, 0x76e4, 0x778e, 0x7787, 0x778c, - 0x7791, 0x778b, 0x78cb, 0x78c5, 0x78ba, 0x78ca, 0x78be, 0x78d5, - 0x78bc, 0x78d0, 0x7a3f, 0x7a3c, 0x7a40, 0x7a3d, 0x7a37, 0x7a3b, - 0x7aaf, 0x7aae, 0x7bad, 0x7bb1, 0x7bc4, 0x7bb4, 0x7bc6, 0x7bc7, - 0x7bc1, 0x7ba0, 0x7bcc, 0x7cca, 0x7de0, 0x7df4, 0x7def, 0x7dfb, - 0x7dd8, 0x7dec, 0x7ddd, 0x7de8, 0x7de3, 0x7dda, 0x7dde, 0x7de9, - 0x7d9e, 0x7dd9, 0x7df2, 0x7df9, 0x7f75, 0x7f77, 0x7faf, 0x7fe9, - 0x8026, 0x819b, 0x819c, 0x819d, 0x81a0, 0x819a, 0x8198, 0x8517, - 0x853d, 0x851a, 0x84ee, 0x852c, 0x852d, 0x8513, 0x8511, 0x8523, - 0x8521, 0x8514, 0x84ec, 0x8525, 0x84ff, 0x8506, 0x8782, 0x8774, - 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, 0x8757, 0x874c, - 0x8753, 0x885b, 0x885d, 0x8910, 0x8907, 0x8912, 0x8913, 0x8915, - 0x890a, 0x8abc, 0x8ad2, 0x8ac7, 0x8ac4, 0x8a95, 0x8acb, 0x8af8, - 0x8ab2, 0x8ac9, 0x8ac2, 0x8abf, 0x8ab0, 0x8ad6, 0x8acd, 0x8ab6, - 0x8ab9, 0x8adb, 0x8c4c, 0x8c4e, 0x8c6c, 0x8ce0, 0x8cde, 0x8ce6, - 0x8ce4, 0x8cec, 0x8ced, 0x8ce2, 0x8ce3, 0x8cdc, 0x8cea, 0x8ce1, - 0x8d6d, 0x8d9f, 0x8da3, 0x8e2b, 0x8e10, 0x8e1d, 0x8e22, 0x8e0f, - 0x8e29, 0x8e1f, 0x8e21, 0x8e1e, 0x8eba, 0x8f1d, 0x8f1b, 0x8f1f, - 0x8f29, 0x8f26, 0x8f2a, 0x8f1c, 0x8f1e, - /* 0xbe */ - 0x8f25, 0x9069, 0x906e, 0x9068, 0x906d, 0x9077, 0x9130, 0x912d, - 0x9127, 0x9131, 0x9187, 0x9189, 0x918b, 0x9183, 0x92c5, 0x92bb, - 0x92b7, 0x92ea, 0x92ac, 0x92e4, 0x92c1, 0x92b3, 0x92bc, 0x92d2, - 0x92c7, 0x92f0, 0x92b2, 0x95ad, 0x95b1, 0x9704, 0x9706, 0x9707, - 0x9709, 0x9760, 0x978d, 0x978b, 0x978f, 0x9821, 0x982b, 0x981c, - 0x98b3, 0x990a, 0x9913, 0x9912, 0x9918, 0x99dd, 0x99d0, 0x99df, - 0x99db, 0x99d1, 0x99d5, 0x99d2, 0x99d9, 0x9ab7, 0x9aee, 0x9aef, - 0x9b27, 0x9b45, 0x9b44, 0x9b77, 0x9b6f, 0x9d06, 0x9d09, 0x9d03, - 0x9ea9, 0x9ebe, 0x9ece, 0x58a8, 0x9f52, 0x5112, 0x5118, 0x5114, - 0x5110, 0x5115, 0x5180, 0x51aa, 0x51dd, 0x5291, 0x5293, 0x52f3, - 0x5659, 0x566b, 0x5679, 0x5669, 0x5664, 0x5678, 0x566a, 0x5668, - 0x5665, 0x5671, 0x566f, 0x566c, 0x5662, 0x5676, 0x58c1, 0x58be, - 0x58c7, 0x58c5, 0x596e, 0x5b1d, 0x5b34, 0x5b78, 0x5bf0, 0x5c0e, - 0x5f4a, 0x61b2, 0x6191, 0x61a9, 0x618a, 0x61cd, 0x61b6, 0x61be, - 0x61ca, 0x61c8, 0x6230, 0x64c5, 0x64c1, 0x64cb, 0x64bb, 0x64bc, - 0x64da, 0x64c4, 0x64c7, 0x64c2, 0x64cd, 0x64bf, 0x64d2, 0x64d4, - 0x64be, 0x6574, 0x66c6, 0x66c9, 0x66b9, 0x66c4, 0x66c7, 0x66b8, - 0x6a3d, 0x6a38, 0x6a3a, 0x6a59, 0x6a6b, 0x6a58, 0x6a39, 0x6a44, - 0x6a62, 0x6a61, 0x6a4b, 0x6a47, 0x6a35, 0x6a5f, 0x6a48, 0x6b59, - 0x6b77, 0x6c05, 0x6fc2, 0x6fb1, 0x6fa1, - /* 0xbf */ - 0x6fc3, 0x6fa4, 0x6fc1, 0x6fa7, 0x6fb3, 0x6fc0, 0x6fb9, 0x6fb6, - 0x6fa6, 0x6fa0, 0x6fb4, 0x71be, 0x71c9, 0x71d0, 0x71d2, 0x71c8, - 0x71d5, 0x71b9, 0x71ce, 0x71d9, 0x71dc, 0x71c3, 0x71c4, 0x7368, - 0x749c, 0x74a3, 0x7498, 0x749f, 0x749e, 0x74e2, 0x750c, 0x750d, - 0x7634, 0x7638, 0x763a, 0x76e7, 0x76e5, 0x77a0, 0x779e, 0x779f, - 0x77a5, 0x78e8, 0x78da, 0x78ec, 0x78e7, 0x79a6, 0x7a4d, 0x7a4e, - 0x7a46, 0x7a4c, 0x7a4b, 0x7aba, 0x7bd9, 0x7c11, 0x7bc9, 0x7be4, - 0x7bdb, 0x7be1, 0x7be9, 0x7be6, 0x7cd5, 0x7cd6, 0x7e0a, 0x7e11, - 0x7e08, 0x7e1b, 0x7e23, 0x7e1e, 0x7e1d, 0x7e09, 0x7e10, 0x7f79, - 0x7fb2, 0x7ff0, 0x7ff1, 0x7fee, 0x8028, 0x81b3, 0x81a9, 0x81a8, - 0x81fb, 0x8208, 0x8258, 0x8259, 0x854a, 0x8559, 0x8548, 0x8568, - 0x8569, 0x8543, 0x8549, 0x856d, 0x856a, 0x855e, 0x8783, 0x879f, - 0x879e, 0x87a2, 0x878d, 0x8861, 0x892a, 0x8932, 0x8925, 0x892b, - 0x8921, 0x89aa, 0x89a6, 0x8ae6, 0x8afa, 0x8aeb, 0x8af1, 0x8b00, - 0x8adc, 0x8ae7, 0x8aee, 0x8afe, 0x8b01, 0x8b02, 0x8af7, 0x8aed, - 0x8af3, 0x8af6, 0x8afc, 0x8c6b, 0x8c6d, 0x8c93, 0x8cf4, 0x8e44, - 0x8e31, 0x8e34, 0x8e42, 0x8e39, 0x8e35, 0x8f3b, 0x8f2f, 0x8f38, - 0x8f33, 0x8fa8, 0x8fa6, 0x9075, 0x9074, 0x9078, 0x9072, 0x907c, - 0x907a, 0x9134, 0x9192, 0x9320, 0x9336, 0x92f8, 0x9333, 0x932f, - 0x9322, 0x92fc, 0x932b, 0x9304, 0x931a, - /* 0xc0 */ - 0x9310, 0x9326, 0x9321, 0x9315, 0x932e, 0x9319, 0x95bb, 0x96a7, - 0x96a8, 0x96aa, 0x96d5, 0x970e, 0x9711, 0x9716, 0x970d, 0x9713, - 0x970f, 0x975b, 0x975c, 0x9766, 0x9798, 0x9830, 0x9838, 0x983b, - 0x9837, 0x982d, 0x9839, 0x9824, 0x9910, 0x9928, 0x991e, 0x991b, - 0x9921, 0x991a, 0x99ed, 0x99e2, 0x99f1, 0x9ab8, 0x9abc, 0x9afb, - 0x9aed, 0x9b28, 0x9b91, 0x9d15, 0x9d23, 0x9d26, 0x9d28, 0x9d12, - 0x9d1b, 0x9ed8, 0x9ed4, 0x9f8d, 0x9f9c, 0x512a, 0x511f, 0x5121, - 0x5132, 0x52f5, 0x568e, 0x5680, 0x5690, 0x5685, 0x5687, 0x568f, - 0x58d5, 0x58d3, 0x58d1, 0x58ce, 0x5b30, 0x5b2a, 0x5b24, 0x5b7a, - 0x5c37, 0x5c68, 0x5dbc, 0x5dba, 0x5dbd, 0x5db8, 0x5e6b, 0x5f4c, - 0x5fbd, 0x61c9, 0x61c2, 0x61c7, 0x61e6, 0x61cb, 0x6232, 0x6234, - 0x64ce, 0x64ca, 0x64d8, 0x64e0, 0x64f0, 0x64e6, 0x64ec, 0x64f1, - 0x64e2, 0x64ed, 0x6582, 0x6583, 0x66d9, 0x66d6, 0x6a80, 0x6a94, - 0x6a84, 0x6aa2, 0x6a9c, 0x6adb, 0x6aa3, 0x6a7e, 0x6a97, 0x6a90, - 0x6aa0, 0x6b5c, 0x6bae, 0x6bda, 0x6c08, 0x6fd8, 0x6ff1, 0x6fdf, - 0x6fe0, 0x6fdb, 0x6fe4, 0x6feb, 0x6fef, 0x6f80, 0x6fec, 0x6fe1, - 0x6fe9, 0x6fd5, 0x6fee, 0x6ff0, 0x71e7, 0x71df, 0x71ee, 0x71e6, - 0x71e5, 0x71ed, 0x71ec, 0x71f4, 0x71e0, 0x7235, 0x7246, 0x7370, - 0x7372, 0x74a9, 0x74b0, 0x74a6, 0x74a8, 0x7646, 0x7642, 0x764c, - 0x76ea, 0x77b3, 0x77aa, 0x77b0, 0x77ac, - /* 0xc1 */ - 0x77a7, 0x77ad, 0x77ef, 0x78f7, 0x78fa, 0x78f4, 0x78ef, 0x7901, - 0x79a7, 0x79aa, 0x7a57, 0x7abf, 0x7c07, 0x7c0d, 0x7bfe, 0x7bf7, - 0x7c0c, 0x7be0, 0x7ce0, 0x7cdc, 0x7cde, 0x7ce2, 0x7cdf, 0x7cd9, - 0x7cdd, 0x7e2e, 0x7e3e, 0x7e46, 0x7e37, 0x7e32, 0x7e43, 0x7e2b, - 0x7e3d, 0x7e31, 0x7e45, 0x7e41, 0x7e34, 0x7e39, 0x7e48, 0x7e35, - 0x7e3f, 0x7e2f, 0x7f44, 0x7ff3, 0x7ffc, 0x8071, 0x8072, 0x8070, - 0x806f, 0x8073, 0x81c6, 0x81c3, 0x81ba, 0x81c2, 0x81c0, 0x81bf, - 0x81bd, 0x81c9, 0x81be, 0x81e8, 0x8209, 0x8271, 0x85aa, 0x8584, - 0x857e, 0x859c, 0x8591, 0x8594, 0x85af, 0x859b, 0x8587, 0x85a8, - 0x858a, 0x8667, 0x87c0, 0x87d1, 0x87b3, 0x87d2, 0x87c6, 0x87ab, - 0x87bb, 0x87ba, 0x87c8, 0x87cb, 0x893b, 0x8936, 0x8944, 0x8938, - 0x893d, 0x89ac, 0x8b0e, 0x8b17, 0x8b19, 0x8b1b, 0x8b0a, 0x8b20, - 0x8b1d, 0x8b04, 0x8b10, 0x8c41, 0x8c3f, 0x8c73, 0x8cfa, 0x8cfd, - 0x8cfc, 0x8cf8, 0x8cfb, 0x8da8, 0x8e49, 0x8e4b, 0x8e48, 0x8e4a, - 0x8f44, 0x8f3e, 0x8f42, 0x8f45, 0x8f3f, 0x907f, 0x907d, 0x9084, - 0x9081, 0x9082, 0x9080, 0x9139, 0x91a3, 0x919e, 0x919c, 0x934d, - 0x9382, 0x9328, 0x9375, 0x934a, 0x9365, 0x934b, 0x9318, 0x937e, - 0x936c, 0x935b, 0x9370, 0x935a, 0x9354, 0x95ca, 0x95cb, 0x95cc, - 0x95c8, 0x95c6, 0x96b1, 0x96b8, 0x96d6, 0x971c, 0x971e, 0x97a0, - 0x97d3, 0x9846, 0x98b6, 0x9935, 0x9a01, - /* 0xc2 */ - 0x99ff, 0x9bae, 0x9bab, 0x9baa, 0x9bad, 0x9d3b, 0x9d3f, 0x9e8b, - 0x9ecf, 0x9ede, 0x9edc, 0x9edd, 0x9edb, 0x9f3e, 0x9f4b, 0x53e2, - 0x5695, 0x56ae, 0x58d9, 0x58d8, 0x5b38, 0x5f5d, 0x61e3, 0x6233, - 0x64f4, 0x64f2, 0x64fe, 0x6506, 0x64fa, 0x64fb, 0x64f7, 0x65b7, - 0x66dc, 0x6726, 0x6ab3, 0x6aac, 0x6ac3, 0x6abb, 0x6ab8, 0x6ac2, - 0x6aae, 0x6aaf, 0x6b5f, 0x6b78, 0x6baf, 0x7009, 0x700b, 0x6ffe, - 0x7006, 0x6ffa, 0x7011, 0x700f, 0x71fb, 0x71fc, 0x71fe, 0x71f8, - 0x7377, 0x7375, 0x74a7, 0x74bf, 0x7515, 0x7656, 0x7658, 0x7652, - 0x77bd, 0x77bf, 0x77bb, 0x77bc, 0x790e, 0x79ae, 0x7a61, 0x7a62, - 0x7a60, 0x7ac4, 0x7ac5, 0x7c2b, 0x7c27, 0x7c2a, 0x7c1e, 0x7c23, - 0x7c21, 0x7ce7, 0x7e54, 0x7e55, 0x7e5e, 0x7e5a, 0x7e61, 0x7e52, - 0x7e59, 0x7f48, 0x7ff9, 0x7ffb, 0x8077, 0x8076, 0x81cd, 0x81cf, - 0x820a, 0x85cf, 0x85a9, 0x85cd, 0x85d0, 0x85c9, 0x85b0, 0x85ba, - 0x85b9, 0x85a6, 0x87ef, 0x87ec, 0x87f2, 0x87e0, 0x8986, 0x89b2, - 0x89f4, 0x8b28, 0x8b39, 0x8b2c, 0x8b2b, 0x8c50, 0x8d05, 0x8e59, - 0x8e63, 0x8e66, 0x8e64, 0x8e5f, 0x8e55, 0x8ec0, 0x8f49, 0x8f4d, - 0x9087, 0x9083, 0x9088, 0x91ab, 0x91ac, 0x91d0, 0x9394, 0x938a, - 0x9396, 0x93a2, 0x93b3, 0x93ae, 0x93ac, 0x93b0, 0x9398, 0x939a, - 0x9397, 0x95d4, 0x95d6, 0x95d0, 0x95d5, 0x96e2, 0x96dc, 0x96d9, - 0x96db, 0x96de, 0x9724, 0x97a3, 0x97a6, - /* 0xc3 */ - 0x97ad, 0x97f9, 0x984d, 0x984f, 0x984c, 0x984e, 0x9853, 0x98ba, - 0x993e, 0x993f, 0x993d, 0x992e, 0x99a5, 0x9a0e, 0x9ac1, 0x9b03, - 0x9b06, 0x9b4f, 0x9b4e, 0x9b4d, 0x9bca, 0x9bc9, 0x9bfd, 0x9bc8, - 0x9bc0, 0x9d51, 0x9d5d, 0x9d60, 0x9ee0, 0x9f15, 0x9f2c, 0x5133, - 0x56a5, 0x58de, 0x58df, 0x58e2, 0x5bf5, 0x9f90, 0x5eec, 0x61f2, - 0x61f7, 0x61f6, 0x61f5, 0x6500, 0x650f, 0x66e0, 0x66dd, 0x6ae5, - 0x6add, 0x6ada, 0x6ad3, 0x701b, 0x701f, 0x7028, 0x701a, 0x701d, - 0x7015, 0x7018, 0x7206, 0x720d, 0x7258, 0x72a2, 0x7378, 0x737a, - 0x74bd, 0x74ca, 0x74e3, 0x7587, 0x7586, 0x765f, 0x7661, 0x77c7, - 0x7919, 0x79b1, 0x7a6b, 0x7a69, 0x7c3e, 0x7c3f, 0x7c38, 0x7c3d, - 0x7c37, 0x7c40, 0x7e6b, 0x7e6d, 0x7e79, 0x7e69, 0x7e6a, 0x7f85, - 0x7e73, 0x7fb6, 0x7fb9, 0x7fb8, 0x81d8, 0x85e9, 0x85dd, 0x85ea, - 0x85d5, 0x85e4, 0x85e5, 0x85f7, 0x87fb, 0x8805, 0x880d, 0x87f9, - 0x87fe, 0x8960, 0x895f, 0x8956, 0x895e, 0x8b41, 0x8b5c, 0x8b58, - 0x8b49, 0x8b5a, 0x8b4e, 0x8b4f, 0x8b46, 0x8b59, 0x8d08, 0x8d0a, - 0x8e7c, 0x8e72, 0x8e87, 0x8e76, 0x8e6c, 0x8e7a, 0x8e74, 0x8f54, - 0x8f4e, 0x8fad, 0x908a, 0x908b, 0x91b1, 0x91ae, 0x93e1, 0x93d1, - 0x93df, 0x93c3, 0x93c8, 0x93dc, 0x93dd, 0x93d6, 0x93e2, 0x93cd, - 0x93d8, 0x93e4, 0x93d7, 0x93e8, 0x95dc, 0x96b4, 0x96e3, 0x972a, - 0x9727, 0x9761, 0x97dc, 0x97fb, 0x985e, - /* 0xc4 */ - 0x9858, 0x985b, 0x98bc, 0x9945, 0x9949, 0x9a16, 0x9a19, 0x9b0d, - 0x9be8, 0x9be7, 0x9bd6, 0x9bdb, 0x9d89, 0x9d61, 0x9d72, 0x9d6a, - 0x9d6c, 0x9e92, 0x9e97, 0x9e93, 0x9eb4, 0x52f8, 0x56a8, 0x56b7, - 0x56b6, 0x56b4, 0x56bc, 0x58e4, 0x5b40, 0x5b43, 0x5b7d, 0x5bf6, - 0x5dc9, 0x61f8, 0x61fa, 0x6518, 0x6514, 0x6519, 0x66e6, 0x6727, - 0x6aec, 0x703e, 0x7030, 0x7032, 0x7210, 0x737b, 0x74cf, 0x7662, - 0x7665, 0x7926, 0x792a, 0x792c, 0x792b, 0x7ac7, 0x7af6, 0x7c4c, - 0x7c43, 0x7c4d, 0x7cef, 0x7cf0, 0x8fae, 0x7e7d, 0x7e7c, 0x7e82, - 0x7f4c, 0x8000, 0x81da, 0x8266, 0x85fb, 0x85f9, 0x8611, 0x85fa, - 0x8606, 0x860b, 0x8607, 0x860a, 0x8814, 0x8815, 0x8964, 0x89ba, - 0x89f8, 0x8b70, 0x8b6c, 0x8b66, 0x8b6f, 0x8b5f, 0x8b6b, 0x8d0f, - 0x8d0d, 0x8e89, 0x8e81, 0x8e85, 0x8e82, 0x91b4, 0x91cb, 0x9418, - 0x9403, 0x93fd, 0x95e1, 0x9730, 0x98c4, 0x9952, 0x9951, 0x99a8, - 0x9a2b, 0x9a30, 0x9a37, 0x9a35, 0x9c13, 0x9c0d, 0x9e79, 0x9eb5, - 0x9ee8, 0x9f2f, 0x9f5f, 0x9f63, 0x9f61, 0x5137, 0x5138, 0x56c1, - 0x56c0, 0x56c2, 0x5914, 0x5c6c, 0x5dcd, 0x61fc, 0x61fe, 0x651d, - 0x651c, 0x6595, 0x66e9, 0x6afb, 0x6b04, 0x6afa, 0x6bb2, 0x704c, - 0x721b, 0x72a7, 0x74d6, 0x74d4, 0x7669, 0x77d3, 0x7c50, 0x7e8f, - 0x7e8c, 0x7fbc, 0x8617, 0x862d, 0x861a, 0x8823, 0x8822, 0x8821, - 0x881f, 0x896a, 0x896c, 0x89bd, 0x8b74, - /* 0xc5 */ - 0x8b77, 0x8b7d, 0x8d13, 0x8e8a, 0x8e8d, 0x8e8b, 0x8f5f, 0x8faf, - 0x91ba, 0x942e, 0x9433, 0x9435, 0x943a, 0x9438, 0x9432, 0x942b, - 0x95e2, 0x9738, 0x9739, 0x9732, 0x97ff, 0x9867, 0x9865, 0x9957, - 0x9a45, 0x9a43, 0x9a40, 0x9a3e, 0x9acf, 0x9b54, 0x9b51, 0x9c2d, - 0x9c25, 0x9daf, 0x9db4, 0x9dc2, 0x9db8, 0x9e9d, 0x9eef, 0x9f19, - 0x9f5c, 0x9f66, 0x9f67, 0x513c, 0x513b, 0x56c8, 0x56ca, 0x56c9, - 0x5b7f, 0x5dd4, 0x5dd2, 0x5f4e, 0x61ff, 0x6524, 0x6b0a, 0x6b61, - 0x7051, 0x7058, 0x7380, 0x74e4, 0x758a, 0x766e, 0x766c, 0x79b3, - 0x7c60, 0x7c5f, 0x807e, 0x807d, 0x81df, 0x8972, 0x896f, 0x89fc, - 0x8b80, 0x8d16, 0x8d17, 0x8e91, 0x8e93, 0x8f61, 0x9148, 0x9444, - 0x9451, 0x9452, 0x973d, 0x973e, 0x97c3, 0x97c1, 0x986b, 0x9955, - 0x9a55, 0x9a4d, 0x9ad2, 0x9b1a, 0x9c49, 0x9c31, 0x9c3e, 0x9c3b, - 0x9dd3, 0x9dd7, 0x9f34, 0x9f6c, 0x9f6a, 0x9f94, 0x56cc, 0x5dd6, - 0x6200, 0x6523, 0x652b, 0x652a, 0x66ec, 0x6b10, 0x74da, 0x7aca, - 0x7c64, 0x7c63, 0x7c65, 0x7e93, 0x7e96, 0x7e94, 0x81e2, 0x8638, - 0x863f, 0x8831, 0x8b8a, 0x9090, 0x908f, 0x9463, 0x9460, 0x9464, - 0x9768, 0x986f, 0x995c, 0x9a5a, 0x9a5b, 0x9a57, 0x9ad3, 0x9ad4, - 0x9ad1, 0x9c54, 0x9c57, 0x9c56, 0x9de5, 0x9e9f, 0x9ef4, 0x56d1, - 0x58e9, 0x652c, 0x705e, 0x7671, 0x7672, 0x77d7, 0x7f50, 0x7f88, - 0x8836, 0x8839, 0x8862, 0x8b93, 0x8b92, - /* 0xc6 */ - 0x8b96, 0x8277, 0x8d1b, 0x91c0, 0x946a, 0x9742, 0x9748, 0x9744, - 0x97c6, 0x9870, 0x9a5f, 0x9b22, 0x9b58, 0x9c5f, 0x9df9, 0x9dfa, - 0x9e7c, 0x9e7d, 0x9f07, 0x9f77, 0x9f72, 0x5ef3, 0x6b16, 0x7063, - 0x7c6c, 0x7c6e, 0x883b, 0x89c0, 0x8ea1, 0x91c1, 0x9472, 0x9470, - 0x9871, 0x995e, 0x9ad6, 0x9b23, 0x9ecc, 0x7064, 0x77da, 0x8b9a, - 0x9477, 0x97c9, 0x9a62, 0x9a65, 0x7e9c, 0x8b9c, 0x8eaa, 0x91c5, - 0x947d, 0x947e, 0x947c, 0x9c77, 0x9c78, 0x9ef7, 0x8c54, 0x947f, - 0x9e1a, 0x7228, 0x9a6a, 0x9b31, 0x9e1b, 0x9e1e, 0x7c72, 0x2460, - 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, - 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, - 0x247b, 0x247c, 0x247d, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, - 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x4e36, 0x4e3f, 0x4e85, - 0x4ea0, 0x5182, 0x5196, 0x51ab, 0x52f9, 0x5338, 0x5369, 0x53b6, - 0x590a, 0x5b80, 0x5ddb, 0x2f33, 0x5e7f, 0xf6df, 0x5f50, 0x5f61, - 0x6534, 0xf6e3, 0x7592, 0xf6e5, 0x8fb5, 0xf6e7, 0x00a8, 0x02c6, - 0x30fd, 0x30fe, 0x309d, 0x309e, 0xf6ee, 0xf6ef, 0x3005, 0x3006, - 0x3007, 0x30fc, 0xff3b, 0xff3d, 0x273d, 0x3041, 0x3042, 0x3043, - 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, - 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, - 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, - /* 0xc7 */ - 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, - 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, - 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, - 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, - 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, - 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, - 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, - 0x3091, 0x3092, 0x3093, 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, - 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, - 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, - 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, - 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, - 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, - 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, - 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, - 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, - 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, - 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, - 0x30f6, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, - 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, - /* 0xc8 */ - 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, - 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, - 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, 0x0432, - 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, - 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, - 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, - 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x21e7, 0x21b8, - 0x21b9, 0xf7e5, 0xf7e6, 0x4e5a, 0xf7e8, 0x5202, 0xf7ea, 0xf7eb, - 0x5188, 0xf7ed, 0xf7ee, 0xf7ef, 0xf7f0, 0xf7f1, 0xf7f2, 0xf7f3, - 0xf7f4, 0xf7f5, 0xf7f6, 0xf7f7, 0xf7f8, 0xf7f9, 0xf7fa, 0xf7fb, - 0xf7fc, 0xf7fd, 0xf7fe, 0xf7ff, 0xf800, 0xf801, 0xf802, 0xf803, - 0xf804, 0xf805, 0xf806, 0xf807, 0xf808, 0xf809, 0xf80a, 0xf80b, - 0xf80c, 0xf80d, 0xf80e, 0xf80f, 0xf810, 0xf811, 0xf812, 0xf813, - 0xf814, 0xf815, 0xf816, 0xffe2, 0xffe4, 0xff07, 0xff02, 0x3231, - 0x2116, 0x2121, 0x309b, 0x309c, 0x2e80, 0x2e84, 0x2e86, 0x2e87, - 0x2e88, 0x2e8a, 0x2e8c, 0x2e8d, 0x2e95, 0x2e9c, 0x2e9d, 0x2ea5, - 0x2ea7, 0x2eaa, 0x2eac, 0x2eae, 0x2eb6, 0x2ebc, 0x2ebe, 0x2ec6, - 0x2eca, 0x2ecc, 0x2ecd, 0x2ecf, 0x2ed6, 0x2ed7, 0x2ede, 0x2ee3, - 0xf83c, 0xf83d, 0xf83e, 0x0283, 0x0250, 0x025b, 0x0254, 0x0275, - 0x0153, 0x00f8, 0x014b, 0x028a, 0x026a, - /* 0xc9 */ - 0x4e42, 0x4e5c, 0x51f5, 0x531a, 0x5382, 0x4e07, 0x4e0c, 0x4e47, - 0x4e8d, 0x56d7, 0xfa0c, 0x5c6e, 0x5f73, 0x4e0f, 0x5187, 0x4e0e, - 0x4e2e, 0x4e93, 0x4ec2, 0x4ec9, 0x4ec8, 0x5198, 0x52fc, 0x536c, - 0x53b9, 0x5720, 0x5903, 0x592c, 0x5c10, 0x5dff, 0x65e1, 0x6bb3, - 0x6bcc, 0x6c14, 0x723f, 0x4e31, 0x4e3c, 0x4ee8, 0x4edc, 0x4ee9, - 0x4ee1, 0x4edd, 0x4eda, 0x520c, 0x531c, 0x534c, 0x5722, 0x5723, - 0x5917, 0x592f, 0x5b81, 0x5b84, 0x5c12, 0x5c3b, 0x5c74, 0x5c73, - 0x5e04, 0x5e80, 0x5e82, 0x5fc9, 0x6209, 0x6250, 0x6c15, 0x6c36, - 0x6c43, 0x6c3f, 0x6c3b, 0x72ae, 0x72b0, 0x738a, 0x79b8, 0x808a, - 0x961e, 0x4f0e, 0x4f18, 0x4f2c, 0x4ef5, 0x4f14, 0x4ef1, 0x4f00, - 0x4ef7, 0x4f08, 0x4f1d, 0x4f02, 0x4f05, 0x4f22, 0x4f13, 0x4f04, - 0x4ef4, 0x4f12, 0x51b1, 0x5213, 0x5209, 0x5210, 0x52a6, 0x5322, - 0x531f, 0x534d, 0x538a, 0x5407, 0x56e1, 0x56df, 0x572e, 0x572a, - 0x5734, 0x593c, 0x5980, 0x597c, 0x5985, 0x597b, 0x597e, 0x5977, - 0x597f, 0x5b56, 0x5c15, 0x5c25, 0x5c7c, 0x5c7a, 0x5c7b, 0x5c7e, - 0x5ddf, 0x5e75, 0x5e84, 0x5f02, 0x5f1a, 0x5f74, 0x5fd5, 0x5fd4, - 0x5fcf, 0x625c, 0x625e, 0x6264, 0x6261, 0x6266, 0x6262, 0x6259, - 0x6260, 0x625a, 0x6265, 0x65ef, 0x65ee, 0x673e, 0x6739, 0x6738, - 0x673b, 0x673a, 0x673f, 0x673c, 0x6733, 0x6c18, 0x6c46, 0x6c52, - 0x6c5c, 0x6c4f, 0x6c4a, 0x6c54, 0x6c4b, - /* 0xca */ - 0x6c4c, 0x7071, 0x725e, 0x72b4, 0x72b5, 0x738e, 0x752a, 0x767f, - 0x7a75, 0x7f51, 0x8278, 0x827c, 0x8280, 0x827d, 0x827f, 0x864d, - 0x897e, 0x9099, 0x9097, 0x9098, 0x909b, 0x9094, 0x9622, 0x9624, - 0x9620, 0x9623, 0x4f56, 0x4f3b, 0x4f62, 0x4f49, 0x4f53, 0x4f64, - 0x4f3e, 0x4f67, 0x4f52, 0x4f5f, 0x4f41, 0x4f58, 0x4f2d, 0x4f33, - 0x4f3f, 0x4f61, 0x518f, 0x51b9, 0x521c, 0x521e, 0x5221, 0x52ad, - 0x52ae, 0x5309, 0x5363, 0x5372, 0x538e, 0x538f, 0x5430, 0x5437, - 0x542a, 0x5454, 0x5445, 0x5419, 0x541c, 0x5425, 0x5418, 0x543d, - 0x544f, 0x5441, 0x5428, 0x5424, 0x5447, 0x56ee, 0x56e7, 0x56e5, - 0x5741, 0x5745, 0x574c, 0x5749, 0x574b, 0x5752, 0x5906, 0x5940, - 0x59a6, 0x5998, 0x59a0, 0x5997, 0x598e, 0x59a2, 0x5990, 0x598f, - 0x59a7, 0x59a1, 0x5b8e, 0x5b92, 0x5c28, 0x5c2a, 0x5c8d, 0x5c8f, - 0x5c88, 0x5c8b, 0x5c89, 0x5c92, 0x5c8a, 0x5c86, 0x5c93, 0x5c95, - 0x5de0, 0x5e0a, 0x5e0e, 0x5e8b, 0x5e89, 0x5e8c, 0x5e88, 0x5e8d, - 0x5f05, 0x5f1d, 0x5f78, 0x5f76, 0x5fd2, 0x5fd1, 0x5fd0, 0x5fed, - 0x5fe8, 0x5fee, 0x5ff3, 0x5fe1, 0x5fe4, 0x5fe3, 0x5ffa, 0x5fef, - 0x5ff7, 0x5ffb, 0x6000, 0x5ff4, 0x623a, 0x6283, 0x628c, 0x628e, - 0x628f, 0x6294, 0x6287, 0x6271, 0x627b, 0x627a, 0x6270, 0x6281, - 0x6288, 0x6277, 0x627d, 0x6272, 0x6274, 0x6537, 0x65f0, 0x65f4, - 0x65f3, 0x65f2, 0x65f5, 0x6745, 0x6747, - /* 0xcb */ - 0x6759, 0x6755, 0x674c, 0x6748, 0x675d, 0x674d, 0x675a, 0x674b, - 0x6bd0, 0x6c19, 0x6c1a, 0x6c78, 0x6c67, 0x6c6b, 0x6c84, 0x6c8b, - 0x6c8f, 0x6c71, 0x6c6f, 0x6c69, 0x6c9a, 0x6c6d, 0x6c87, 0x6c95, - 0x6c9c, 0x6c66, 0x6c73, 0x6c65, 0x6c7b, 0x6c8e, 0x7074, 0x707a, - 0x7263, 0x72bf, 0x72bd, 0x72c3, 0x72c6, 0x72c1, 0x72ba, 0x72c5, - 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753a, 0x7539, 0x7594, - 0x7595, 0x7681, 0x793d, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, - 0x809c, 0x8290, 0x828f, 0x8285, 0x828e, 0x8291, 0x8293, 0x828a, - 0x8283, 0x8284, 0x8c78, 0x8fc9, 0x8fbf, 0x909f, 0x90a1, 0x90a5, - 0x909e, 0x90a7, 0x90a0, 0x9630, 0x9628, 0x962f, 0x962d, 0x4e33, - 0x4f98, 0x4f7c, 0x4f85, 0x4f7d, 0x4f80, 0x4f87, 0x4f76, 0x4f74, - 0x4f89, 0x4f84, 0x4f77, 0x4f4c, 0x4f97, 0x4f6a, 0x4f9a, 0x4f79, - 0x4f81, 0x4f78, 0x4f90, 0x4f9c, 0x4f94, 0x4f9e, 0x4f92, 0x4f82, - 0x4f95, 0x4f6b, 0x4f6e, 0x519e, 0x51bc, 0x51be, 0x5235, 0x5232, - 0x5233, 0x5246, 0x5231, 0x52bc, 0x530a, 0x530b, 0x533c, 0x5392, - 0x5394, 0x5487, 0x547f, 0x5481, 0x5491, 0x5482, 0x5488, 0x546b, - 0x547a, 0x547e, 0x5465, 0x546c, 0x5474, 0x5466, 0x548d, 0x546f, - 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, 0x56f7, 0x56f9, - 0x576f, 0x5772, 0x576d, 0x576b, 0x5771, 0x5770, 0x5776, 0x5780, - 0x5775, 0x577b, 0x5773, 0x5774, 0x5762, - /* 0xcc */ - 0x5768, 0x577d, 0x590c, 0x5945, 0x59b5, 0x59ba, 0x59cf, 0x59ce, - 0x59b2, 0x59cc, 0x59c1, 0x59b6, 0x59bc, 0x59c3, 0x59d6, 0x59b1, - 0x59bd, 0x59c0, 0x59c8, 0x59b4, 0x59c7, 0x5b62, 0x5b65, 0x5b93, - 0x5b95, 0x5c44, 0x5c47, 0x5cae, 0x5ca4, 0x5ca0, 0x5cb5, 0x5caf, - 0x5ca8, 0x5cac, 0x5c9f, 0x5ca3, 0x5cad, 0x5ca2, 0x5caa, 0x5ca7, - 0x5c9d, 0x5ca5, 0x5cb6, 0x5cb0, 0x5ca6, 0x5e17, 0x5e14, 0x5e19, - 0x5f28, 0x5f22, 0x5f23, 0x5f24, 0x5f54, 0x5f82, 0x5f7e, 0x5f7d, - 0x5fde, 0x5fe5, 0x602d, 0x6026, 0x6019, 0x6032, 0x600b, 0x6034, - 0x600a, 0x6017, 0x6033, 0x601a, 0x601e, 0x602c, 0x6022, 0x600d, - 0x6010, 0x602e, 0x6013, 0x6011, 0x600c, 0x6009, 0x601c, 0x6214, - 0x623d, 0x62ad, 0x62b4, 0x62d1, 0x62be, 0x62aa, 0x62b6, 0x62ca, - 0x62ae, 0x62b3, 0x62af, 0x62bb, 0x62a9, 0x62b0, 0x62b8, 0x653d, - 0x65a8, 0x65bb, 0x6609, 0x65fc, 0x6604, 0x6612, 0x6608, 0x65fb, - 0x6603, 0x660b, 0x660d, 0x6605, 0x65fd, 0x6611, 0x6610, 0x66f6, - 0x670a, 0x6785, 0x676c, 0x678e, 0x6792, 0x6776, 0x677b, 0x6798, - 0x6786, 0x6784, 0x6774, 0x678d, 0x678c, 0x677a, 0x679f, 0x6791, - 0x6799, 0x6783, 0x677d, 0x6781, 0x6778, 0x6779, 0x6794, 0x6b25, - 0x6b80, 0x6b7e, 0x6bde, 0x6c1d, 0x6c93, 0x6cec, 0x6ceb, 0x6cee, - 0x6cd9, 0x6cb6, 0x6cd4, 0x6cad, 0x6ce7, 0x6cb7, 0x6cd0, 0x6cc2, - 0x6cba, 0x6cc3, 0x6cc6, 0x6ced, 0x6cf2, - /* 0xcd */ - 0x6cd2, 0x6cdd, 0x6cb4, 0x6c8a, 0x6c9d, 0x6c80, 0x6cde, 0x6cc0, - 0x6d30, 0x6ccd, 0x6cc7, 0x6cb0, 0x6cf9, 0x6ccf, 0x6ce9, 0x6cd1, - 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, - 0x7082, 0x709a, 0x7083, 0x726a, 0x72d6, 0x72cb, 0x72d8, 0x72c9, - 0x72dc, 0x72d2, 0x72d4, 0x72da, 0x72cc, 0x72d1, 0x73a4, 0x73a1, - 0x73ad, 0x73a6, 0x73a2, 0x73a0, 0x73ac, 0x739d, 0x74dd, 0x74e8, - 0x753f, 0x7540, 0x753e, 0x758c, 0x7598, 0x76af, 0x76f3, 0x76f1, - 0x76f0, 0x76f5, 0x77f8, 0x77fc, 0x77f9, 0x77fb, 0x77fa, 0x77f7, - 0x7942, 0x793f, 0x79c5, 0x7a78, 0x7a7b, 0x7afb, 0x7c75, 0x7cfd, - 0x8035, 0x808f, 0x80ae, 0x80a3, 0x80b8, 0x80b5, 0x80ad, 0x8220, - 0x82a0, 0x82c0, 0x82ab, 0x829a, 0x8298, 0x829b, 0x82b5, 0x82a7, - 0x82ae, 0x82bc, 0x829e, 0x82ba, 0x82b4, 0x82a8, 0x82a1, 0x82a9, - 0x82c2, 0x82a4, 0x82c3, 0x82b6, 0x82a2, 0x8670, 0x866f, 0x866d, - 0x866e, 0x8c56, 0x8fd2, 0x8fcb, 0x8fd3, 0x8fcd, 0x8fd6, 0x8fd5, - 0x8fd7, 0x90b2, 0x90b4, 0x90af, 0x90b3, 0x90b0, 0x9639, 0x963d, - 0x963c, 0x963a, 0x9643, 0x4fcd, 0x4fc5, 0x4fd3, 0x4fb2, 0x4fc9, - 0x4fcb, 0x4fc1, 0x4fd4, 0x4fdc, 0x4fd9, 0x4fbb, 0x4fb3, 0x4fdb, - 0x4fc7, 0x4fd6, 0x4fba, 0x4fc0, 0x4fb9, 0x4fec, 0x5244, 0x5249, - 0x52c0, 0x52c2, 0x533d, 0x537c, 0x5397, 0x5396, 0x5399, 0x5398, - 0x54ba, 0x54a1, 0x54ad, 0x54a5, 0x54cf, - /* 0xce */ - 0x54c3, 0x830d, 0x54b7, 0x54ae, 0x54d6, 0x54b6, 0x54c5, 0x54c6, - 0x54a0, 0x5470, 0x54bc, 0x54a2, 0x54be, 0x5472, 0x54de, 0x54b0, - 0x57b5, 0x579e, 0x579f, 0x57a4, 0x578c, 0x5797, 0x579d, 0x579b, - 0x5794, 0x5798, 0x578f, 0x5799, 0x57a5, 0x579a, 0x5795, 0x58f4, - 0x590d, 0x5953, 0x59e1, 0x59de, 0x59ee, 0x5a00, 0x59f1, 0x59dd, - 0x59fa, 0x59fd, 0x59fc, 0x59f6, 0x59e4, 0x59f2, 0x59f7, 0x59db, - 0x59e9, 0x59f3, 0x59f5, 0x59e0, 0x59fe, 0x59f4, 0x59ed, 0x5ba8, - 0x5c4c, 0x5cd0, 0x5cd8, 0x5ccc, 0x5cd7, 0x5ccb, 0x5cdb, 0x5cde, - 0x5cda, 0x5cc9, 0x5cc7, 0x5cca, 0x5cd6, 0x5cd3, 0x5cd4, 0x5ccf, - 0x5cc8, 0x5cc6, 0x5cce, 0x5cdf, 0x5cf8, 0x5df9, 0x5e21, 0x5e22, - 0x5e23, 0x5e20, 0x5e24, 0x5eb0, 0x5ea4, 0x5ea2, 0x5e9b, 0x5ea3, - 0x5ea5, 0x5f07, 0x5f2e, 0x5f56, 0x5f86, 0x6037, 0x6039, 0x6054, - 0x6072, 0x605e, 0x6045, 0x6053, 0x6047, 0x6049, 0x605b, 0x604c, - 0x6040, 0x6042, 0x605f, 0x6024, 0x6044, 0x6058, 0x6066, 0x606e, - 0x6242, 0x6243, 0x62cf, 0x630d, 0x630b, 0x62f5, 0x630e, 0x6303, - 0x62eb, 0x62f9, 0x630f, 0x630c, 0x62f8, 0x62f6, 0x6300, 0x6313, - 0x6314, 0x62fa, 0x6315, 0x62fb, 0x62f0, 0x6541, 0x6543, 0x65aa, - 0x65bf, 0x6636, 0x6621, 0x6632, 0x6635, 0x661c, 0x6626, 0x6622, - 0x6633, 0x662b, 0x663a, 0x661d, 0x6634, 0x6639, 0x662e, 0x670f, - 0x6710, 0x67c1, 0x67f2, 0x67c8, 0x67ba, - /* 0xcf */ - 0x67dc, 0x67bb, 0x67f8, 0x67d8, 0x67c0, 0x67b7, 0x67c5, 0x67eb, - 0x67e4, 0x67df, 0x67b5, 0x67cd, 0x67b3, 0x67f7, 0x67f6, 0x67ee, - 0x67e3, 0x67c2, 0x67b9, 0x67ce, 0x67e7, 0x67f0, 0x67b2, 0x67fc, - 0x67c6, 0x67ed, 0x67cc, 0x67ae, 0x67e6, 0x67db, 0x67fa, 0x67c9, - 0x67ca, 0x67c3, 0x67ea, 0x67cb, 0x6b28, 0x6b82, 0x6b84, 0x6bb6, - 0x6bd6, 0x6bd8, 0x6be0, 0x6c20, 0x6c21, 0x6d28, 0x6d34, 0x6d2d, - 0x6d1f, 0x6d3c, 0x6d3f, 0x6d12, 0x6d0a, 0x6cda, 0x6d33, 0x6d04, - 0x6d19, 0x6d3a, 0x6d1a, 0x6d11, 0x6d00, 0x6d1d, 0x6d42, 0x6d01, - 0x6d18, 0x6d37, 0x6d03, 0x6d0f, 0x6d40, 0x6d07, 0x6d20, 0x6d2c, - 0x6d08, 0x6d22, 0x6d09, 0x6d10, 0x70b7, 0x709f, 0x70be, 0x70b1, - 0x70b0, 0x70a1, 0x70b4, 0x70b5, 0x70a9, 0x7241, 0x7249, 0x724a, - 0x726c, 0x7270, 0x7273, 0x726e, 0x72ca, 0x72e4, 0x72e8, 0x72eb, - 0x72df, 0x72ea, 0x72e6, 0x72e3, 0x7385, 0x73cc, 0x73c2, 0x73c8, - 0x73c5, 0x73b9, 0x73b6, 0x73b5, 0x73b4, 0x73eb, 0x73bf, 0x73c7, - 0x73be, 0x73c3, 0x73c6, 0x73b8, 0x73cb, 0x74ec, 0x74ee, 0x752e, - 0x7547, 0x7548, 0x75a7, 0x75aa, 0x7679, 0x76c4, 0x7708, 0x7703, - 0x7704, 0x7705, 0x770a, 0x76f7, 0x76fb, 0x76fa, 0x77e7, 0x77e8, - 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780f, 0x780e, 0x7809, - 0x7803, 0x7813, 0x794a, 0x794c, 0x794b, 0x7945, 0x7944, 0x79d5, - 0x79cd, 0x79cf, 0x79d6, 0x79ce, 0x7a80, - /* 0xd0 */ - 0x7a7e, 0x7ad1, 0x7b00, 0x7b01, 0x7c7a, 0x7c78, 0x7c79, 0x7c7f, - 0x7c80, 0x7c81, 0x7d03, 0x7d08, 0x7d01, 0x7f58, 0x7f91, 0x7f8d, - 0x7fbe, 0x8007, 0x800e, 0x800f, 0x8014, 0x8037, 0x80d8, 0x80c7, - 0x80e0, 0x80d1, 0x80c8, 0x80c2, 0x80d0, 0x80c5, 0x80e3, 0x80d9, - 0x80dc, 0x80ca, 0x80d5, 0x80c9, 0x80cf, 0x80d7, 0x80e6, 0x80cd, - 0x81ff, 0x8221, 0x8294, 0x82d9, 0x82fe, 0x82f9, 0x8307, 0x82e8, - 0x8300, 0x82d5, 0x833a, 0x82eb, 0x82d6, 0x82f4, 0x82ec, 0x82e1, - 0x82f2, 0x82f5, 0x830c, 0x82fb, 0x82f6, 0x82f0, 0x82ea, 0x82e4, - 0x82e0, 0x82fa, 0x82f3, 0x82ed, 0x8677, 0x8674, 0x867c, 0x8673, - 0x8841, 0x884e, 0x8867, 0x886a, 0x8869, 0x89d3, 0x8a04, 0x8a07, - 0x8d72, 0x8fe3, 0x8fe1, 0x8fee, 0x8fe0, 0x90f1, 0x90bd, 0x90bf, - 0x90d5, 0x90c5, 0x90be, 0x90c7, 0x90cb, 0x90c8, 0x91d4, 0x91d3, - 0x9654, 0x964f, 0x9651, 0x9653, 0x964a, 0x964e, 0x501e, 0x5005, - 0x5007, 0x5013, 0x5022, 0x5030, 0x501b, 0x4ff5, 0x4ff4, 0x5033, - 0x5037, 0x502c, 0x4ff6, 0x4ff7, 0x5017, 0x501c, 0x5020, 0x5027, - 0x5035, 0x502f, 0x5031, 0x500e, 0x515a, 0x5194, 0x5193, 0x51ca, - 0x51c4, 0x51c5, 0x51c8, 0x51ce, 0x5261, 0x525a, 0x5252, 0x525e, - 0x525f, 0x5255, 0x5262, 0x52cd, 0x530e, 0x539e, 0x5526, 0x54e2, - 0x5517, 0x5512, 0x54e7, 0x54f3, 0x54e4, 0x551a, 0x54ff, 0x5504, - 0x5508, 0x54eb, 0x5511, 0x5505, 0x54f1, - /* 0xd1 */ - 0x550a, 0x54fb, 0x54f7, 0x54f8, 0x54e0, 0x550e, 0x5503, 0x550b, - 0x5701, 0x5702, 0x57cc, 0x5832, 0x57d5, 0x57d2, 0x57ba, 0x57c6, - 0x57bd, 0x57bc, 0x57b8, 0x57b6, 0x57bf, 0x57c7, 0x57d0, 0x57b9, - 0x57c1, 0x590e, 0x594a, 0x5a19, 0x5a16, 0x5a2d, 0x5a2e, 0x5a15, - 0x5a0f, 0x5a17, 0x5a0a, 0x5a1e, 0x5a33, 0x5b6c, 0x5ba7, 0x5bad, - 0x5bac, 0x5c03, 0x5c56, 0x5c54, 0x5cec, 0x5cff, 0x5cee, 0x5cf1, - 0x5cf7, 0x5d00, 0x5cf9, 0x5e29, 0x5e28, 0x5ea8, 0x5eae, 0x5eaa, - 0x5eac, 0x5f33, 0x5f30, 0x5f67, 0x605d, 0x605a, 0x6067, 0x6041, - 0x60a2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609d, 0x6083, 0x6095, - 0x609b, 0x6097, 0x6087, 0x609c, 0x608e, 0x6219, 0x6246, 0x62f2, - 0x6310, 0x6356, 0x632c, 0x6344, 0x6345, 0x6336, 0x6343, 0x63e4, - 0x6339, 0x634b, 0x634a, 0x633c, 0x6329, 0x6341, 0x6334, 0x6358, - 0x6354, 0x6359, 0x632d, 0x6347, 0x6333, 0x635a, 0x6351, 0x6338, - 0x6357, 0x6340, 0x6348, 0x654a, 0x6546, 0x65c6, 0x65c3, 0x65c4, - 0x65c2, 0x664a, 0x665f, 0x6647, 0x6651, 0x6712, 0x6713, 0x681f, - 0x681a, 0x6849, 0x6832, 0x6833, 0x683b, 0x684b, 0x684f, 0x6816, - 0x6831, 0x681c, 0x6835, 0x682b, 0x682d, 0x682f, 0x684e, 0x6844, - 0x6834, 0x681d, 0x6812, 0x6814, 0x6826, 0x6828, 0x682e, 0x684d, - 0x683a, 0x6825, 0x6820, 0x6b2c, 0x6b2f, 0x6b2d, 0x6b31, 0x6b34, - 0x6b6d, 0x8082, 0x6b88, 0x6be6, 0x6be4, - /* 0xd2 */ - 0x6be8, 0x6be3, 0x6be2, 0x6be7, 0x6c25, 0x6d7a, 0x6d63, 0x6d64, - 0x6d76, 0x6d0d, 0x6d61, 0x6d92, 0x6d58, 0x6d62, 0x6d6d, 0x6d6f, - 0x6d91, 0x6d8d, 0x6def, 0x6d7f, 0x6d86, 0x6d5e, 0x6d67, 0x6d60, - 0x6d97, 0x6d70, 0x6d7c, 0x6d5f, 0x6d82, 0x6d98, 0x6d2f, 0x6d68, - 0x6d8b, 0x6d7e, 0x6d80, 0x6d84, 0x6d16, 0x6d83, 0x6d7b, 0x6d7d, - 0x6d75, 0x6d90, 0x70dc, 0x70d3, 0x70d1, 0x70dd, 0x70cb, 0x7f39, - 0x70e2, 0x70d7, 0x70d2, 0x70de, 0x70e0, 0x70d4, 0x70cd, 0x70c5, - 0x70c6, 0x70c7, 0x70da, 0x70ce, 0x70e1, 0x7242, 0x7278, 0x7277, - 0x7276, 0x7300, 0x72fa, 0x72f4, 0x72fe, 0x72f6, 0x72f3, 0x72fb, - 0x7301, 0x73d3, 0x73d9, 0x73e5, 0x73d6, 0x73bc, 0x73e7, 0x73e3, - 0x73e9, 0x73dc, 0x73d2, 0x73db, 0x73d4, 0x73dd, 0x73da, 0x73d7, - 0x73d8, 0x73e8, 0x74de, 0x74df, 0x74f4, 0x74f5, 0x7521, 0x755b, - 0x755f, 0x75b0, 0x75c1, 0x75bb, 0x75c4, 0x75c0, 0x75bf, 0x75b6, - 0x75ba, 0x768a, 0x76c9, 0x771d, 0x771b, 0x7710, 0x7713, 0x7712, - 0x7723, 0x7711, 0x7715, 0x7719, 0x771a, 0x7722, 0x7727, 0x7823, - 0x782c, 0x7822, 0x7835, 0x782f, 0x7828, 0x782e, 0x782b, 0x7821, - 0x7829, 0x7833, 0x782a, 0x7831, 0x7954, 0x795b, 0x794f, 0x795c, - 0x7953, 0x7952, 0x7951, 0x79eb, 0x79ec, 0x79e0, 0x79ee, 0x79ed, - 0x79ea, 0x79dc, 0x79de, 0x79dd, 0x7a86, 0x7a89, 0x7a85, 0x7a8b, - 0x7a8c, 0x7a8a, 0x7a87, 0x7ad8, 0x7b10, - /* 0xd3 */ - 0x7b04, 0x7b13, 0x7b05, 0x7b0f, 0x7b08, 0x7b0a, 0x7b0e, 0x7b09, - 0x7b12, 0x7c84, 0x7c91, 0x7c8a, 0x7c8c, 0x7c88, 0x7c8d, 0x7c85, - 0x7d1e, 0x7d1d, 0x7d11, 0x7d0e, 0x7d18, 0x7d16, 0x7d13, 0x7d1f, - 0x7d12, 0x7d0f, 0x7d0c, 0x7f5c, 0x7f61, 0x7f5e, 0x7f60, 0x7f5d, - 0x7f5b, 0x7f96, 0x7f92, 0x7fc3, 0x7fc2, 0x7fc0, 0x8016, 0x803e, - 0x8039, 0x80fa, 0x80f2, 0x80f9, 0x80f5, 0x8101, 0x80fb, 0x8100, - 0x8201, 0x822f, 0x8225, 0x8333, 0x832d, 0x8344, 0x8319, 0x8351, - 0x8325, 0x8356, 0x833f, 0x8341, 0x8326, 0x831c, 0x8322, 0x8342, - 0x834e, 0x831b, 0x832a, 0x8308, 0x833c, 0x834d, 0x8316, 0x8324, - 0x8320, 0x8337, 0x832f, 0x8329, 0x8347, 0x8345, 0x834c, 0x8353, - 0x831e, 0x832c, 0x834b, 0x8327, 0x8348, 0x8653, 0x8652, 0x86a2, - 0x86a8, 0x8696, 0x868d, 0x8691, 0x869e, 0x8687, 0x8697, 0x8686, - 0x868b, 0x869a, 0x8685, 0x86a5, 0x8699, 0x86a1, 0x86a7, 0x8695, - 0x8698, 0x868e, 0x869d, 0x8690, 0x8694, 0x8843, 0x8844, 0x886d, - 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887f, 0x886f, 0x8883, - 0x887e, 0x8874, 0x887c, 0x8a12, 0x8c47, 0x8c57, 0x8c7b, 0x8ca4, - 0x8ca3, 0x8d76, 0x8d78, 0x8db5, 0x8db7, 0x8db6, 0x8ed1, 0x8ed3, - 0x8ffe, 0x8ff5, 0x9002, 0x8fff, 0x8ffb, 0x9004, 0x8ffc, 0x8ff6, - 0x90d6, 0x90e0, 0x90d9, 0x90da, 0x90e3, 0x90df, 0x90e5, 0x90d8, - 0x90db, 0x90d7, 0x90dc, 0x90e4, 0x9150, - /* 0xd4 */ - 0x914e, 0x914f, 0x91d5, 0x91e2, 0x91da, 0x965c, 0x965f, 0x96bc, - 0x98e3, 0x9adf, 0x9b2f, 0x4e7f, 0x5070, 0x506a, 0x5061, 0x505e, - 0x5060, 0x5053, 0x504b, 0x505d, 0x5072, 0x5048, 0x504d, 0x5041, - 0x505b, 0x504a, 0x5062, 0x5015, 0x5045, 0x505f, 0x5069, 0x506b, - 0x5063, 0x5064, 0x5046, 0x5040, 0x506e, 0x5073, 0x5057, 0x5051, - 0x51d0, 0x526b, 0x526d, 0x526c, 0x526e, 0x52d6, 0x52d3, 0x532d, - 0x539c, 0x5575, 0x5576, 0x553c, 0x554d, 0x5550, 0x5534, 0x552a, - 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, 0x550c, - 0x5532, 0x5565, 0x554e, 0x5539, 0x5548, 0x552d, 0x553b, 0x5540, - 0x554b, 0x570a, 0x5707, 0x57fb, 0x5814, 0x57e2, 0x57f6, 0x57dc, - 0x57f4, 0x5800, 0x57ed, 0x57fd, 0x5808, 0x57f8, 0x580b, 0x57f3, - 0x57cf, 0x5807, 0x57ee, 0x57e3, 0x57f2, 0x57e5, 0x57ec, 0x57e1, - 0x580e, 0x57fc, 0x5810, 0x57e7, 0x5801, 0x580c, 0x57f1, 0x57e9, - 0x57f0, 0x580d, 0x5804, 0x595c, 0x5a60, 0x5a58, 0x5a55, 0x5a67, - 0x5a5e, 0x5a38, 0x5a35, 0x5a6d, 0x5a50, 0x5a5f, 0x5a65, 0x5a6c, - 0x5a53, 0x5a64, 0x5a57, 0x5a43, 0x5a5d, 0x5a52, 0x5a44, 0x5a5b, - 0x5a48, 0x5a8e, 0x5a3e, 0x5a4d, 0x5a39, 0x5a4c, 0x5a70, 0x5a69, - 0x5a47, 0x5a51, 0x5a56, 0x5a42, 0x5a5c, 0x5b72, 0x5b6e, 0x5bc1, - 0x5bc0, 0x5c59, 0x5d1e, 0x5d0b, 0x5d1d, 0x5d1a, 0x5d20, 0x5d0c, - 0x5d28, 0x5d0d, 0x5d26, 0x5d25, 0x5d0f, - /* 0xd5 */ - 0x5d30, 0x5d12, 0x5d23, 0x5d1f, 0x5d2e, 0x5e3e, 0x5e34, 0x5eb1, - 0x5eb4, 0x5eb9, 0x5eb2, 0x5eb3, 0x5f36, 0x5f38, 0x5f9b, 0x5f96, - 0x5f9f, 0x608a, 0x6090, 0x6086, 0x60be, 0x60b0, 0x60ba, 0x60d3, - 0x60d4, 0x60cf, 0x60e4, 0x60d9, 0x60dd, 0x60c8, 0x60b1, 0x60db, - 0x60b7, 0x60ca, 0x60bf, 0x60c3, 0x60cd, 0x60c0, 0x6332, 0x6365, - 0x638a, 0x6382, 0x637d, 0x63bd, 0x639e, 0x63ad, 0x639d, 0x6397, - 0x63ab, 0x638e, 0x636f, 0x6387, 0x6390, 0x636e, 0x63af, 0x6375, - 0x639c, 0x636d, 0x63ae, 0x637c, 0x63a4, 0x633b, 0x639f, 0x6378, - 0x6385, 0x6381, 0x6391, 0x638d, 0x6370, 0x6553, 0x65cd, 0x6665, - 0x6661, 0x665b, 0x6659, 0x665c, 0x6662, 0x6718, 0x6879, 0x6887, - 0x6890, 0x689c, 0x686d, 0x686e, 0x68ae, 0x68ab, 0x6956, 0x686f, - 0x68a3, 0x68ac, 0x68a9, 0x6875, 0x6874, 0x68b2, 0x688f, 0x6877, - 0x6892, 0x687c, 0x686b, 0x6872, 0x68aa, 0x6880, 0x6871, 0x687e, - 0x689b, 0x6896, 0x688b, 0x68a0, 0x6889, 0x68a4, 0x6878, 0x687b, - 0x6891, 0x688c, 0x688a, 0x687d, 0x6b36, 0x6b33, 0x6b37, 0x6b38, - 0x6b91, 0x6b8f, 0x6b8d, 0x6b8e, 0x6b8c, 0x6c2a, 0x6dc0, 0x6dab, - 0x6db4, 0x6db3, 0x6e74, 0x6dac, 0x6de9, 0x6de2, 0x6db7, 0x6df6, - 0x6dd4, 0x6e00, 0x6dc8, 0x6de0, 0x6ddf, 0x6dd6, 0x6dbe, 0x6de5, - 0x6ddc, 0x6ddd, 0x6ddb, 0x6df4, 0x6dca, 0x6dbd, 0x6ded, 0x6df0, - 0x6dba, 0x6dd5, 0x6dc2, 0x6dcf, 0x6dc9, - /* 0xd6 */ - 0x6dd0, 0x6df2, 0x6dd3, 0x6dfd, 0x6dd7, 0x6dcd, 0x6de3, 0x6dbb, - 0x70fa, 0x710d, 0x70f7, 0x7117, 0x70f4, 0x710c, 0x70f0, 0x7104, - 0x70f3, 0x7110, 0x70fc, 0x70ff, 0x7106, 0x7113, 0x7100, 0x70f8, - 0x70f6, 0x710b, 0x7102, 0x710e, 0x727e, 0x727b, 0x727c, 0x727f, - 0x731d, 0x7317, 0x7307, 0x7311, 0x7318, 0x730a, 0x7308, 0x72ff, - 0x730f, 0x731e, 0x7388, 0x73f6, 0x73f8, 0x73f5, 0x7404, 0x7401, - 0x73fd, 0x7407, 0x7400, 0x73fa, 0x73fc, 0x73ff, 0x740c, 0x740b, - 0x73f4, 0x7408, 0x7564, 0x7563, 0x75ce, 0x75d2, 0x75cf, 0x75cb, - 0x75cc, 0x75d1, 0x75d0, 0x768f, 0x7689, 0x76d3, 0x7739, 0x772f, - 0x772d, 0x7731, 0x7732, 0x7734, 0x7733, 0x773d, 0x7725, 0x773b, - 0x7735, 0x7848, 0x7852, 0x7849, 0x784d, 0x784a, 0x784c, 0x7826, - 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796a, 0x7963, 0x796b, - 0x7961, 0x79bb, 0x79fa, 0x79f8, 0x79f6, 0x79f7, 0x7a8f, 0x7a94, - 0x7a90, 0x7b35, 0x7b47, 0x7b34, 0x7b25, 0x7b30, 0x7b22, 0x7b24, - 0x7b33, 0x7b18, 0x7b2a, 0x7b1d, 0x7b31, 0x7b2b, 0x7b2d, 0x7b2f, - 0x7b32, 0x7b38, 0x7b1a, 0x7b23, 0x7c94, 0x7c98, 0x7c96, 0x7ca3, - 0x7d35, 0x7d3d, 0x7d38, 0x7d36, 0x7d3a, 0x7d45, 0x7d2c, 0x7d29, - 0x7d41, 0x7d47, 0x7d3e, 0x7d3f, 0x7d4a, 0x7d3b, 0x7d28, 0x7f63, - 0x7f95, 0x7f9c, 0x7f9d, 0x7f9b, 0x7fca, 0x7fcb, 0x7fcd, 0x7fd0, - 0x7fd1, 0x7fc7, 0x7fcf, 0x7fc9, 0x801f, - /* 0xd7 */ - 0x801e, 0x801b, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, - 0x811b, 0x812d, 0x811f, 0x812c, 0x811e, 0x8121, 0x8115, 0x8127, - 0x811d, 0x8122, 0x8211, 0x8238, 0x8233, 0x823a, 0x8234, 0x8232, - 0x8274, 0x8390, 0x83a3, 0x83a8, 0x838d, 0x837a, 0x8373, 0x83a4, - 0x8374, 0x838f, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83a9, - 0x837d, 0x8383, 0x838c, 0x839d, 0x839b, 0x83aa, 0x838b, 0x837e, - 0x83a5, 0x83af, 0x8388, 0x8397, 0x83b0, 0x837f, 0x83a6, 0x8387, - 0x83ae, 0x8376, 0x839a, 0x8659, 0x8656, 0x86bf, 0x86b7, 0x86c2, - 0x86c1, 0x86c5, 0x86ba, 0x86b0, 0x86c8, 0x86b9, 0x86b3, 0x86b8, - 0x86cc, 0x86b4, 0x86bb, 0x86bc, 0x86c3, 0x86bd, 0x86be, 0x8852, - 0x8889, 0x8895, 0x88a8, 0x88a2, 0x88aa, 0x889a, 0x8891, 0x88a1, - 0x889f, 0x8898, 0x88a7, 0x8899, 0x889b, 0x8897, 0x88a4, 0x88ac, - 0x888c, 0x8893, 0x888e, 0x8982, 0x89d6, 0x89d9, 0x89d5, 0x8a30, - 0x8a27, 0x8a2c, 0x8a1e, 0x8c39, 0x8c3b, 0x8c5c, 0x8c5d, 0x8c7d, - 0x8ca5, 0x8d7d, 0x8d7b, 0x8d79, 0x8dbc, 0x8dc2, 0x8db9, 0x8dbf, - 0x8dc1, 0x8ed8, 0x8ede, 0x8edd, 0x8edc, 0x8ed7, 0x8ee0, 0x8ee1, - 0x9024, 0x900b, 0x9011, 0x901c, 0x900c, 0x9021, 0x90ef, 0x90ea, - 0x90f0, 0x90f4, 0x90f2, 0x90f3, 0x90d4, 0x90eb, 0x90ec, 0x90e9, - 0x9156, 0x9158, 0x915a, 0x9153, 0x9155, 0x91ec, 0x91f4, 0x91f1, - 0x91f3, 0x91f8, 0x91e4, 0x91f9, 0x91ea, - /* 0xd8 */ - 0x91eb, 0x91f7, 0x91e8, 0x91ee, 0x957a, 0x9586, 0x9588, 0x967c, - 0x966d, 0x966b, 0x9671, 0x966f, 0x96bf, 0x976a, 0x9804, 0x98e5, - 0x9997, 0x509b, 0x5095, 0x5094, 0x509e, 0x508b, 0x50a3, 0x5083, - 0x508c, 0x508e, 0x509d, 0x5068, 0x509c, 0x5092, 0x5082, 0x5087, - 0x515f, 0x51d4, 0x5312, 0x5311, 0x53a4, 0x53a7, 0x5591, 0x55a8, - 0x55a5, 0x55ad, 0x5577, 0x5645, 0x55a2, 0x5593, 0x5588, 0x558f, - 0x55b5, 0x5581, 0x55a3, 0x5592, 0x55a4, 0x557d, 0x558c, 0x55a6, - 0x557f, 0x5595, 0x55a1, 0x558e, 0x570c, 0x5829, 0x5837, 0x5819, - 0x581e, 0x5827, 0x5823, 0x5828, 0x57f5, 0x5848, 0x5825, 0x581c, - 0x581b, 0x5833, 0x583f, 0x5836, 0x582e, 0x5839, 0x5838, 0x582d, - 0x582c, 0x583b, 0x5961, 0x5aaf, 0x5a94, 0x5a9f, 0x5a7a, 0x5aa2, - 0x5a9e, 0x5a78, 0x5aa6, 0x5a7c, 0x5aa5, 0x5aac, 0x5a95, 0x5aae, - 0x5a37, 0x5a84, 0x5a8a, 0x5a97, 0x5a83, 0x5a8b, 0x5aa9, 0x5a7b, - 0x5a7d, 0x5a8c, 0x5a9c, 0x5a8f, 0x5a93, 0x5a9d, 0x5bea, 0x5bcd, - 0x5bcb, 0x5bd4, 0x5bd1, 0x5bca, 0x5bce, 0x5c0c, 0x5c30, 0x5d37, - 0x5d43, 0x5d6b, 0x5d41, 0x5d4b, 0x5d3f, 0x5d35, 0x5d51, 0x5d4e, - 0x5d55, 0x5d33, 0x5d3a, 0x5d52, 0x5d3d, 0x5d31, 0x5d59, 0x5d42, - 0x5d39, 0x5d49, 0x5d38, 0x5d3c, 0x5d32, 0x5d36, 0x5d40, 0x5d45, - 0x5e44, 0x5e41, 0x5f58, 0x5fa6, 0x5fa5, 0x5fab, 0x60c9, 0x60b9, - 0x60cc, 0x60e2, 0x60ce, 0x60c4, 0x6114, - /* 0xd9 */ - 0x60f2, 0x610a, 0x6116, 0x6105, 0x60f5, 0x6113, 0x60f8, 0x60fc, - 0x60fe, 0x60c1, 0x6103, 0x6118, 0x611d, 0x6110, 0x60ff, 0x6104, - 0x610b, 0x624a, 0x6394, 0x63b1, 0x63b0, 0x63ce, 0x63e5, 0x63e8, - 0x63ef, 0x63c3, 0x649d, 0x63f3, 0x63ca, 0x63e0, 0x63f6, 0x63d5, - 0x63f2, 0x63f5, 0x6461, 0x63df, 0x63be, 0x63dd, 0x63dc, 0x63c4, - 0x63d8, 0x63d3, 0x63c2, 0x63c7, 0x63cc, 0x63cb, 0x63c8, 0x63f0, - 0x63d7, 0x63d9, 0x6532, 0x6567, 0x656a, 0x6564, 0x655c, 0x6568, - 0x6565, 0x658c, 0x659d, 0x659e, 0x65ae, 0x65d0, 0x65d2, 0x667c, - 0x666c, 0x667b, 0x6680, 0x6671, 0x6679, 0x666a, 0x6672, 0x6701, - 0x690c, 0x68d3, 0x6904, 0x68dc, 0x692a, 0x68ec, 0x68ea, 0x68f1, - 0x690f, 0x68d6, 0x68f7, 0x68eb, 0x68e4, 0x68f6, 0x6913, 0x6910, - 0x68f3, 0x68e1, 0x6907, 0x68cc, 0x6908, 0x6970, 0x68b4, 0x6911, - 0x68ef, 0x68c6, 0x6914, 0x68f8, 0x68d0, 0x68fd, 0x68fc, 0x68e8, - 0x690b, 0x690a, 0x6917, 0x68ce, 0x68c8, 0x68dd, 0x68de, 0x68e6, - 0x68f4, 0x68d1, 0x6906, 0x68d4, 0x68e9, 0x6915, 0x6925, 0x68c7, - 0x6b39, 0x6b3b, 0x6b3f, 0x6b3c, 0x6b94, 0x6b97, 0x6b99, 0x6b95, - 0x6bbd, 0x6bf0, 0x6bf2, 0x6bf3, 0x6c30, 0x6dfc, 0x6e46, 0x6e47, - 0x6e1f, 0x6e49, 0x6e88, 0x6e3c, 0x6e3d, 0x6e45, 0x6e62, 0x6e2b, - 0x6e3f, 0x6e41, 0x6e5d, 0x6e73, 0x6e1c, 0x6e33, 0x6e4b, 0x6e40, - 0x6e51, 0x6e3b, 0x6e03, 0x6e2e, 0x6e5e, - /* 0xda */ - 0x6e68, 0x6e5c, 0x6e61, 0x6e31, 0x6e28, 0x6e60, 0x6e71, 0x6e6b, - 0x6e39, 0x6e22, 0x6e30, 0x6e53, 0x6e65, 0x6e27, 0x6e78, 0x6e64, - 0x6e77, 0x6e55, 0x6e79, 0x6e52, 0x6e66, 0x6e35, 0x6e36, 0x6e5a, - 0x7120, 0x711e, 0x712f, 0x70fb, 0x712e, 0x7131, 0x7123, 0x7125, - 0x7122, 0x7132, 0x711f, 0x7128, 0x713a, 0x711b, 0x724b, 0x725a, - 0x7288, 0x7289, 0x7286, 0x7285, 0x728b, 0x7312, 0x730b, 0x7330, - 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732d, 0x7326, 0x7323, - 0x7335, 0x730c, 0x742e, 0x742c, 0x7430, 0x742b, 0x7416, 0x741a, - 0x7421, 0x742d, 0x7431, 0x7424, 0x7423, 0x741d, 0x7429, 0x7420, - 0x7432, 0x74fb, 0x752f, 0x756f, 0x756c, 0x75e7, 0x75da, 0x75e1, - 0x75e6, 0x75dd, 0x75df, 0x75e4, 0x75d7, 0x7695, 0x7692, 0x76da, - 0x7746, 0x7747, 0x7744, 0x774d, 0x7745, 0x774a, 0x774e, 0x774b, - 0x774c, 0x77de, 0x77ec, 0x7860, 0x7864, 0x7865, 0x785c, 0x786d, - 0x7871, 0x786a, 0x786e, 0x7870, 0x7869, 0x7868, 0x785e, 0x7862, - 0x7974, 0x7973, 0x7972, 0x7970, 0x7a02, 0x7a0a, 0x7a03, 0x7a0c, - 0x7a04, 0x7a99, 0x7ae6, 0x7ae4, 0x7b4a, 0x7b3b, 0x7b44, 0x7b48, - 0x7b4c, 0x7b4e, 0x7b40, 0x7b58, 0x7b45, 0x7ca2, 0x7c9e, 0x7ca8, - 0x7ca1, 0x7d58, 0x7d6f, 0x7d63, 0x7d53, 0x7d56, 0x7d67, 0x7d6a, - 0x7d4f, 0x7d6d, 0x7d5c, 0x7d6b, 0x7d52, 0x7d54, 0x7d69, 0x7d51, - 0x7d5f, 0x7d4e, 0x7f3e, 0x7f3f, 0x7f65, - /* 0xdb */ - 0x7f66, 0x7fa2, 0x7fa0, 0x7fa1, 0x7fd7, 0x8051, 0x804f, 0x8050, - 0x80fe, 0x80d4, 0x8143, 0x814a, 0x8152, 0x814f, 0x8147, 0x813d, - 0x814d, 0x813a, 0x81e6, 0x81ee, 0x81f7, 0x81f8, 0x81f9, 0x8204, - 0x823c, 0x823d, 0x823f, 0x8275, 0x833b, 0x83cf, 0x83f9, 0x8423, - 0x83c0, 0x83e8, 0x8412, 0x83e7, 0x83e4, 0x83fc, 0x83f6, 0x8410, - 0x83c6, 0x83c8, 0x83eb, 0x83e3, 0x83bf, 0x8401, 0x83dd, 0x83e5, - 0x83d8, 0x83ff, 0x83e1, 0x83cb, 0x83ce, 0x83d6, 0x83f5, 0x83c9, - 0x8409, 0x840f, 0x83de, 0x8411, 0x8406, 0x83c2, 0x83f3, 0x83d5, - 0x83fa, 0x83c7, 0x83d1, 0x83ea, 0x8413, 0x83c3, 0x83ec, 0x83ee, - 0x83c4, 0x83fb, 0x83d7, 0x83e2, 0x841b, 0x83db, 0x83fe, 0x86d8, - 0x86e2, 0x86e6, 0x86d3, 0x86e3, 0x86da, 0x86ea, 0x86dd, 0x86eb, - 0x86dc, 0x86ec, 0x86e9, 0x86d7, 0x86e8, 0x86d1, 0x8848, 0x8856, - 0x8855, 0x88ba, 0x88d7, 0x88b9, 0x88b8, 0x88c0, 0x88be, 0x88b6, - 0x88bc, 0x88b7, 0x88bd, 0x88b2, 0x8901, 0x88c9, 0x8995, 0x8998, - 0x8997, 0x89dd, 0x89da, 0x89db, 0x8a4e, 0x8a4d, 0x8a39, 0x8a59, - 0x8a40, 0x8a57, 0x8a58, 0x8a44, 0x8a45, 0x8a52, 0x8a48, 0x8a51, - 0x8a4a, 0x8a4c, 0x8a4f, 0x8c5f, 0x8c81, 0x8c80, 0x8cba, 0x8cbe, - 0x8cb0, 0x8cb9, 0x8cb5, 0x8d84, 0x8d80, 0x8d89, 0x8dd8, 0x8dd3, - 0x8dcd, 0x8dc7, 0x8dd6, 0x8ddc, 0x8dcf, 0x8dd5, 0x8dd9, 0x8dc8, - 0x8dd7, 0x8dc5, 0x8eef, 0x8ef7, 0x8efa, - /* 0xdc */ - 0x8ef9, 0x8ee6, 0x8eee, 0x8ee5, 0x8ef5, 0x8ee7, 0x8ee8, 0x8ef6, - 0x8eeb, 0x8ef1, 0x8eec, 0x8ef4, 0x8ee9, 0x902d, 0x9034, 0x902f, - 0x9106, 0x912c, 0x9104, 0x90ff, 0x90fc, 0x9108, 0x90f9, 0x90fb, - 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915f, - 0x9162, 0x9160, 0x9201, 0x920a, 0x9225, 0x9203, 0x921a, 0x9226, - 0x920f, 0x920c, 0x9200, 0x9212, 0x91ff, 0x91fd, 0x9206, 0x9204, - 0x9227, 0x9202, 0x921c, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, - 0x957b, 0x958d, 0x958c, 0x9590, 0x9687, 0x967e, 0x9688, 0x9689, - 0x9683, 0x9680, 0x96c2, 0x96c8, 0x96c3, 0x96f1, 0x96f0, 0x976c, - 0x9770, 0x976e, 0x9807, 0x98a9, 0x98eb, 0x9ce6, 0x9ef9, 0x4e83, - 0x4e84, 0x4eb6, 0x50bd, 0x50bf, 0x50c6, 0x50ae, 0x50c4, 0x50ca, - 0x50b4, 0x50c8, 0x50c2, 0x50b0, 0x50c1, 0x50ba, 0x50b1, 0x50cb, - 0x50c9, 0x50b6, 0x50b8, 0x51d7, 0x527a, 0x5278, 0x527b, 0x527c, - 0x55c3, 0x55db, 0x55cc, 0x55d0, 0x55cb, 0x55ca, 0x55dd, 0x55c0, - 0x55d4, 0x55c4, 0x55e9, 0x55bf, 0x55d2, 0x558d, 0x55cf, 0x55d5, - 0x55e2, 0x55d6, 0x55c8, 0x55f2, 0x55cd, 0x55d9, 0x55c2, 0x5714, - 0x5853, 0x5868, 0x5864, 0x584f, 0x584d, 0x5849, 0x586f, 0x5855, - 0x584e, 0x585d, 0x5859, 0x5865, 0x585b, 0x583d, 0x5863, 0x5871, - 0x58fc, 0x5ac7, 0x5ac4, 0x5acb, 0x5aba, 0x5ab8, 0x5ab1, 0x5ab5, - 0x5ab0, 0x5abf, 0x5ac8, 0x5abb, 0x5ac6, - /* 0xdd */ - 0x5ab7, 0x5ac0, 0x5aca, 0x5ab4, 0x5ab6, 0x5acd, 0x5ab9, 0x5a90, - 0x5bd6, 0x5bd8, 0x5bd9, 0x5c1f, 0x5c33, 0x5d71, 0x5d63, 0x5d4a, - 0x5d65, 0x5d72, 0x5d6c, 0x5d5e, 0x5d68, 0x5d67, 0x5d62, 0x5df0, - 0x5e4f, 0x5e4e, 0x5e4a, 0x5e4d, 0x5e4b, 0x5ec5, 0x5ecc, 0x5ec6, - 0x5ecb, 0x5ec7, 0x5f40, 0x5faf, 0x5fad, 0x60f7, 0x6149, 0x614a, - 0x612b, 0x6145, 0x6136, 0x6132, 0x612e, 0x6146, 0x612f, 0x614f, - 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63c5, - 0x63f1, 0x63eb, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, 0x6433, - 0x6443, 0x641f, 0x6415, 0x6418, 0x6439, 0x6437, 0x6422, 0x6423, - 0x640c, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, 0x642f, 0x640a, - 0x641a, 0x6440, 0x6425, 0x6427, 0x640b, 0x63e7, 0x641b, 0x642e, - 0x6421, 0x640e, 0x656f, 0x6592, 0x65d3, 0x6686, 0x668c, 0x6695, - 0x6690, 0x668b, 0x668a, 0x6699, 0x6694, 0x6678, 0x6720, 0x6966, - 0x695f, 0x6938, 0x694e, 0x6962, 0x6971, 0x693f, 0x6945, 0x696a, - 0x6939, 0x6942, 0x6957, 0x6959, 0x697a, 0x6948, 0x6949, 0x6935, - 0x696c, 0x6933, 0x693d, 0x6965, 0x68f0, 0x6978, 0x6934, 0x6969, - 0x6940, 0x696f, 0x6944, 0x6976, 0x6958, 0x6941, 0x6974, 0x694c, - 0x693b, 0x694b, 0x6937, 0x695c, 0x694f, 0x6951, 0x6932, 0x6952, - 0x692f, 0x697b, 0x693c, 0x6b46, 0x6b45, 0x6b43, 0x6b42, 0x6b48, - 0x6b41, 0x6b9b, 0xfa0d, 0x6bfb, 0x6bfc, - /* 0xde */ - 0x6bf9, 0x6bf7, 0x6bf8, 0x6e9b, 0x6ed6, 0x6ec8, 0x6e8f, 0x6ec0, - 0x6e9f, 0x6e93, 0x6e94, 0x6ea0, 0x6eb1, 0x6eb9, 0x6ec6, 0x6ed2, - 0x6ebd, 0x6ec1, 0x6e9e, 0x6ec9, 0x6eb7, 0x6eb0, 0x6ecd, 0x6ea6, - 0x6ecf, 0x6eb2, 0x6ebe, 0x6ec3, 0x6edc, 0x6ed8, 0x6e99, 0x6e92, - 0x6e8e, 0x6e8d, 0x6ea4, 0x6ea1, 0x6ebf, 0x6eb3, 0x6ed0, 0x6eca, - 0x6e97, 0x6eae, 0x6ea3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, - 0x7141, 0x715d, 0x7162, 0x7172, 0x7178, 0x716a, 0x7161, 0x7142, - 0x7158, 0x7143, 0x714b, 0x7170, 0x715f, 0x7150, 0x7153, 0x7144, - 0x714d, 0x715a, 0x724f, 0x728d, 0x728c, 0x7291, 0x7290, 0x728e, - 0x733c, 0x7342, 0x733b, 0x733a, 0x7340, 0x734a, 0x7349, 0x7444, - 0x744a, 0x744b, 0x7452, 0x7451, 0x7457, 0x7440, 0x744f, 0x7450, - 0x744e, 0x7442, 0x7446, 0x744d, 0x7454, 0x74e1, 0x74ff, 0x74fe, - 0x74fd, 0x751d, 0x7579, 0x7577, 0x6983, 0x75ef, 0x760f, 0x7603, - 0x75f7, 0x75fe, 0x75fc, 0x75f9, 0x75f8, 0x7610, 0x75fb, 0x75f6, - 0x75ed, 0x75f5, 0x75fd, 0x7699, 0x76b5, 0x76dd, 0x7755, 0x775f, - 0x7760, 0x7752, 0x7756, 0x775a, 0x7769, 0x7767, 0x7754, 0x7759, - 0x776d, 0x77e0, 0x7887, 0x789a, 0x7894, 0x788f, 0x7884, 0x7895, - 0x7885, 0x7886, 0x78a1, 0x7883, 0x7879, 0x7899, 0x7880, 0x7896, - 0x787b, 0x797c, 0x7982, 0x797d, 0x7979, 0x7a11, 0x7a18, 0x7a19, - 0x7a12, 0x7a17, 0x7a15, 0x7a22, 0x7a13, - /* 0xdf */ - 0x7a1b, 0x7a10, 0x7aa3, 0x7aa2, 0x7a9e, 0x7aeb, 0x7b66, 0x7b64, - 0x7b6d, 0x7b74, 0x7b69, 0x7b72, 0x7b65, 0x7b73, 0x7b71, 0x7b70, - 0x7b61, 0x7b78, 0x7b76, 0x7b63, 0x7cb2, 0x7cb4, 0x7caf, 0x7d88, - 0x7d86, 0x7d80, 0x7d8d, 0x7d7f, 0x7d85, 0x7d7a, 0x7d8e, 0x7d7b, - 0x7d83, 0x7d7c, 0x7d8c, 0x7d94, 0x7d84, 0x7d7d, 0x7d92, 0x7f6d, - 0x7f6b, 0x7f67, 0x7f68, 0x7f6c, 0x7fa6, 0x7fa5, 0x7fa7, 0x7fdb, - 0x7fdc, 0x8021, 0x8164, 0x8160, 0x8177, 0x815c, 0x8169, 0x815b, - 0x8162, 0x8172, 0x6721, 0x815e, 0x8176, 0x8167, 0x816f, 0x8144, - 0x8161, 0x821d, 0x8249, 0x8244, 0x8240, 0x8242, 0x8245, 0x84f1, - 0x843f, 0x8456, 0x8476, 0x8479, 0x848f, 0x848d, 0x8465, 0x8451, - 0x8440, 0x8486, 0x8467, 0x8430, 0x844d, 0x847d, 0x845a, 0x8459, - 0x8474, 0x8473, 0x845d, 0x8507, 0x845e, 0x8437, 0x843a, 0x8434, - 0x847a, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, 0x83d9, 0x844b, - 0x842f, 0x8442, 0x842d, 0x845f, 0x8470, 0x8439, 0x844e, 0x844c, - 0x8452, 0x846f, 0x84c5, 0x848e, 0x843b, 0x8447, 0x8436, 0x8433, - 0x8468, 0x847e, 0x8444, 0x842b, 0x8460, 0x8454, 0x846e, 0x8450, - 0x870b, 0x8704, 0x86f7, 0x870c, 0x86fa, 0x86d6, 0x86f5, 0x874d, - 0x86f8, 0x870e, 0x8709, 0x8701, 0x86f6, 0x870d, 0x8705, 0x88d6, - 0x88cb, 0x88cd, 0x88ce, 0x88de, 0x88db, 0x88da, 0x88cc, 0x88d0, - 0x8985, 0x899b, 0x89df, 0x89e5, 0x89e4, - /* 0xe0 */ - 0x89e1, 0x89e0, 0x89e2, 0x89dc, 0x89e6, 0x8a76, 0x8a86, 0x8a7f, - 0x8a61, 0x8a3f, 0x8a77, 0x8a82, 0x8a84, 0x8a75, 0x8a83, 0x8a81, - 0x8a74, 0x8a7a, 0x8c3c, 0x8c4b, 0x8c4a, 0x8c65, 0x8c64, 0x8c66, - 0x8c86, 0x8c84, 0x8c85, 0x8ccc, 0x8d68, 0x8d69, 0x8d91, 0x8d8c, - 0x8d8e, 0x8d8f, 0x8d8d, 0x8d93, 0x8d94, 0x8d90, 0x8d92, 0x8df0, - 0x8de0, 0x8dec, 0x8df1, 0x8dee, 0x8dd0, 0x8de9, 0x8de3, 0x8de2, - 0x8de7, 0x8df2, 0x8deb, 0x8df4, 0x8f06, 0x8eff, 0x8f01, 0x8f00, - 0x8f05, 0x8f07, 0x8f08, 0x8f02, 0x8f0b, 0x9052, 0x903f, 0x9044, - 0x9049, 0x903d, 0x9110, 0x910d, 0x910f, 0x9111, 0x9116, 0x9114, - 0x910b, 0x910e, 0x916e, 0x916f, 0x9248, 0x9252, 0x9230, 0x923a, - 0x9266, 0x9233, 0x9265, 0x925e, 0x9283, 0x922e, 0x924a, 0x9246, - 0x926d, 0x926c, 0x924f, 0x9260, 0x9267, 0x926f, 0x9236, 0x9261, - 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, 0x924e, 0x9253, - 0x924c, 0x9256, 0x9232, 0x959f, 0x959c, 0x959e, 0x959b, 0x9692, - 0x9693, 0x9691, 0x9697, 0x96ce, 0x96fa, 0x96fd, 0x96f8, 0x96f5, - 0x9773, 0x9777, 0x9778, 0x9772, 0x980f, 0x980d, 0x980e, 0x98ac, - 0x98f6, 0x98f9, 0x99af, 0x99b2, 0x99b0, 0x99b5, 0x9aad, 0x9aab, - 0x9b5b, 0x9cea, 0x9ced, 0x9ce7, 0x9e80, 0x9efd, 0x50e6, 0x50d4, - 0x50d7, 0x50e8, 0x50f3, 0x50db, 0x50ea, 0x50dd, 0x50e4, 0x50d3, - 0x50ec, 0x50f0, 0x50ef, 0x50e3, 0x50e0, - /* 0xe1 */ - 0x51d8, 0x5280, 0x5281, 0x52e9, 0x52eb, 0x5330, 0x53ac, 0x5627, - 0x5615, 0x560c, 0x5612, 0x55fc, 0x560f, 0x561c, 0x5601, 0x5613, - 0x5602, 0x55fa, 0x561d, 0x5604, 0x55ff, 0x55f9, 0x5889, 0x587c, - 0x5890, 0x5898, 0x5886, 0x5881, 0x587f, 0x5874, 0x588b, 0x587a, - 0x5887, 0x5891, 0x588e, 0x5876, 0x5882, 0x5888, 0x587b, 0x5894, - 0x588f, 0x58fe, 0x596b, 0x5adc, 0x5aee, 0x5ae5, 0x5ad5, 0x5aea, - 0x5ada, 0x5aed, 0x5aeb, 0x5af3, 0x5ae2, 0x5ae0, 0x5adb, 0x5aec, - 0x5ade, 0x5add, 0x5ad9, 0x5ae8, 0x5adf, 0x5b77, 0x5be0, 0x5be3, - 0x5c63, 0x5d82, 0x5d80, 0x5d7d, 0x5d86, 0x5d7a, 0x5d81, 0x5d77, - 0x5d8a, 0x5d89, 0x5d88, 0x5d7e, 0x5d7c, 0x5d8d, 0x5d79, 0x5d7f, - 0x5e58, 0x5e59, 0x5e53, 0x5ed8, 0x5ed1, 0x5ed7, 0x5ece, 0x5edc, - 0x5ed5, 0x5ed9, 0x5ed2, 0x5ed4, 0x5f44, 0x5f43, 0x5f6f, 0x5fb6, - 0x612c, 0x6128, 0x6141, 0x615e, 0x6171, 0x6173, 0x6152, 0x6153, - 0x6172, 0x616c, 0x6180, 0x6174, 0x6154, 0x617a, 0x615b, 0x6165, - 0x613b, 0x616a, 0x6161, 0x6156, 0x6229, 0x6227, 0x622b, 0x642b, - 0x644d, 0x645b, 0x645d, 0x6474, 0x6476, 0x6472, 0x6473, 0x647d, - 0x6475, 0x6466, 0x64a6, 0x644e, 0x6482, 0x645e, 0x645c, 0x644b, - 0x6453, 0x6460, 0x6450, 0x647f, 0x643f, 0x646c, 0x646b, 0x6459, - 0x6465, 0x6477, 0x6573, 0x65a0, 0x66a1, 0x66a0, 0x669f, 0x6705, - 0x6704, 0x6722, 0x69b1, 0x69b6, 0x69c9, - /* 0xe2 */ - 0x69a0, 0x69ce, 0x6996, 0x69b0, 0x69ac, 0x69bc, 0x6991, 0x6999, - 0x698e, 0x69a7, 0x698d, 0x69a9, 0x69be, 0x69af, 0x69bf, 0x69c4, - 0x69bd, 0x69a4, 0x69d4, 0x69b9, 0x69ca, 0x699a, 0x69cf, 0x69b3, - 0x6993, 0x69aa, 0x69a1, 0x699e, 0x69d9, 0x6997, 0x6990, 0x69c2, - 0x69b5, 0x69a5, 0x69c6, 0x6b4a, 0x6b4d, 0x6b4b, 0x6b9e, 0x6b9f, - 0x6ba0, 0x6bc3, 0x6bc4, 0x6bfe, 0x6ece, 0x6ef5, 0x6ef1, 0x6f03, - 0x6f25, 0x6ef8, 0x6f37, 0x6efb, 0x6f2e, 0x6f09, 0x6f4e, 0x6f19, - 0x6f1a, 0x6f27, 0x6f18, 0x6f3b, 0x6f12, 0x6eed, 0x6f0a, 0x6f36, - 0x6f73, 0x6ef9, 0x6eee, 0x6f2d, 0x6f40, 0x6f30, 0x6f3c, 0x6f35, - 0x6eeb, 0x6f07, 0x6f0e, 0x6f43, 0x6f05, 0x6efd, 0x6ef6, 0x6f39, - 0x6f1c, 0x6efc, 0x6f3a, 0x6f1f, 0x6f0d, 0x6f1e, 0x6f08, 0x6f21, - 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, 0x718f, 0x717b, - 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, 0x7295, 0x7293, - 0x7343, 0x734d, 0x7351, 0x734c, 0x7462, 0x7473, 0x7471, 0x7475, - 0x7472, 0x7467, 0x746e, 0x7500, 0x7502, 0x7503, 0x757d, 0x7590, - 0x7616, 0x7608, 0x760c, 0x7615, 0x7611, 0x760a, 0x7614, 0x76b8, - 0x7781, 0x777c, 0x7785, 0x7782, 0x776e, 0x7780, 0x776f, 0x777e, - 0x7783, 0x78b2, 0x78aa, 0x78b4, 0x78ad, 0x78a8, 0x787e, 0x78ab, - 0x789e, 0x78a5, 0x78a0, 0x78ac, 0x78a2, 0x78a4, 0x7998, 0x798a, - 0x798b, 0x7996, 0x7995, 0x7994, 0x7993, - /* 0xe3 */ - 0x7997, 0x7988, 0x7992, 0x7990, 0x7a2b, 0x7a4a, 0x7a30, 0x7a2f, - 0x7a28, 0x7a26, 0x7aa8, 0x7aab, 0x7aac, 0x7aee, 0x7b88, 0x7b9c, - 0x7b8a, 0x7b91, 0x7b90, 0x7b96, 0x7b8d, 0x7b8c, 0x7b9b, 0x7b8e, - 0x7b85, 0x7b98, 0x5284, 0x7b99, 0x7ba4, 0x7b82, 0x7cbb, 0x7cbf, - 0x7cbc, 0x7cba, 0x7da7, 0x7db7, 0x7dc2, 0x7da3, 0x7daa, 0x7dc1, - 0x7dc0, 0x7dc5, 0x7d9d, 0x7dce, 0x7dc4, 0x7dc6, 0x7dcb, 0x7dcc, - 0x7daf, 0x7db9, 0x7d96, 0x7dbc, 0x7d9f, 0x7da6, 0x7dae, 0x7da9, - 0x7da1, 0x7dc9, 0x7f73, 0x7fe2, 0x7fe3, 0x7fe5, 0x7fde, 0x8024, - 0x805d, 0x805c, 0x8189, 0x8186, 0x8183, 0x8187, 0x818d, 0x818c, - 0x818b, 0x8215, 0x8497, 0x84a4, 0x84a1, 0x849f, 0x84ba, 0x84ce, - 0x84c2, 0x84ac, 0x84ae, 0x84ab, 0x84b9, 0x84b4, 0x84c1, 0x84cd, - 0x84aa, 0x849a, 0x84b1, 0x84d0, 0x849d, 0x84a7, 0x84bb, 0x84a2, - 0x8494, 0x84c7, 0x84cc, 0x849b, 0x84a9, 0x84af, 0x84a8, 0x84d6, - 0x8498, 0x84b6, 0x84cf, 0x84a0, 0x84d7, 0x84d4, 0x84d2, 0x84db, - 0x84b0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, 0x876b, 0x8740, - 0x872e, 0x871e, 0x8721, 0x8719, 0x871b, 0x8743, 0x872c, 0x8741, - 0x873e, 0x8746, 0x8720, 0x8732, 0x872a, 0x872d, 0x873c, 0x8712, - 0x873a, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, 0x8738, 0x8724, - 0x871a, 0x8730, 0x8711, 0x88f7, 0x88e7, 0x88f1, 0x88f2, 0x88fa, - 0x88fe, 0x88ee, 0x88fc, 0x88f6, 0x88fb, - /* 0xe4 */ - 0x88f0, 0x88ec, 0x88eb, 0x899d, 0x89a1, 0x899f, 0x899e, 0x89e9, - 0x89eb, 0x89e8, 0x8aab, 0x8a99, 0x8a8b, 0x8a92, 0x8a8f, 0x8a96, - 0x8c3d, 0x8c68, 0x8c69, 0x8cd5, 0x8ccf, 0x8cd7, 0x8d96, 0x8e09, - 0x8e02, 0x8dff, 0x8e0d, 0x8dfd, 0x8e0a, 0x8e03, 0x8e07, 0x8e06, - 0x8e05, 0x8dfe, 0x8e00, 0x8e04, 0x8f10, 0x8f11, 0x8f0e, 0x8f0d, - 0x9123, 0x911c, 0x9120, 0x9122, 0x911f, 0x911d, 0x911a, 0x9124, - 0x9121, 0x911b, 0x917a, 0x9172, 0x9179, 0x9173, 0x92a5, 0x92a4, - 0x9276, 0x929b, 0x927a, 0x92a0, 0x9294, 0x92aa, 0x928d, 0x92a6, - 0x929a, 0x92ab, 0x9279, 0x9297, 0x927f, 0x92a3, 0x92ee, 0x928e, - 0x9282, 0x9295, 0x92a2, 0x927d, 0x9288, 0x92a1, 0x928a, 0x9286, - 0x928c, 0x9299, 0x92a7, 0x927e, 0x9287, 0x92a9, 0x929d, 0x928b, - 0x922d, 0x969e, 0x96a1, 0x96ff, 0x9758, 0x977d, 0x977a, 0x977e, - 0x9783, 0x9780, 0x9782, 0x977b, 0x9784, 0x9781, 0x977f, 0x97ce, - 0x97cd, 0x9816, 0x98ad, 0x98ae, 0x9902, 0x9900, 0x9907, 0x999d, - 0x999c, 0x99c3, 0x99b9, 0x99bb, 0x99ba, 0x99c2, 0x99bd, 0x99c7, - 0x9ab1, 0x9ae3, 0x9ae7, 0x9b3e, 0x9b3f, 0x9b60, 0x9b61, 0x9b5f, - 0x9cf1, 0x9cf2, 0x9cf5, 0x9ea7, 0x50ff, 0x5103, 0x5130, 0x50f8, - 0x5106, 0x5107, 0x50f6, 0x50fe, 0x510b, 0x510c, 0x50fd, 0x510a, - 0x528b, 0x528c, 0x52f1, 0x52ef, 0x5648, 0x5642, 0x564c, 0x5635, - 0x5641, 0x564a, 0x5649, 0x5646, 0x5658, - /* 0xe5 */ - 0x565a, 0x5640, 0x5633, 0x563d, 0x562c, 0x563e, 0x5638, 0x562a, - 0x563a, 0x571a, 0x58ab, 0x589d, 0x58b1, 0x58a0, 0x58a3, 0x58af, - 0x58ac, 0x58a5, 0x58a1, 0x58ff, 0x5aff, 0x5af4, 0x5afd, 0x5af7, - 0x5af6, 0x5b03, 0x5af8, 0x5b02, 0x5af9, 0x5b01, 0x5b07, 0x5b05, - 0x5b0f, 0x5c67, 0x5d99, 0x5d97, 0x5d9f, 0x5d92, 0x5da2, 0x5d93, - 0x5d95, 0x5da0, 0x5d9c, 0x5da1, 0x5d9a, 0x5d9e, 0x5e69, 0x5e5d, - 0x5e60, 0x5e5c, 0x7df3, 0x5edb, 0x5ede, 0x5ee1, 0x5f49, 0x5fb2, - 0x618b, 0x6183, 0x6179, 0x61b1, 0x61b0, 0x61a2, 0x6189, 0x619b, - 0x6193, 0x61af, 0x61ad, 0x619f, 0x6192, 0x61aa, 0x61a1, 0x618d, - 0x6166, 0x61b3, 0x622d, 0x646e, 0x6470, 0x6496, 0x64a0, 0x6485, - 0x6497, 0x649c, 0x648f, 0x648b, 0x648a, 0x648c, 0x64a3, 0x649f, - 0x6468, 0x64b1, 0x6498, 0x6576, 0x657a, 0x6579, 0x657b, 0x65b2, - 0x65b3, 0x66b5, 0x66b0, 0x66a9, 0x66b2, 0x66b7, 0x66aa, 0x66af, - 0x6a00, 0x6a06, 0x6a17, 0x69e5, 0x69f8, 0x6a15, 0x69f1, 0x69e4, - 0x6a20, 0x69ff, 0x69ec, 0x69e2, 0x6a1b, 0x6a1d, 0x69fe, 0x6a27, - 0x69f2, 0x69ee, 0x6a14, 0x69f7, 0x69e7, 0x6a40, 0x6a08, 0x69e6, - 0x69fb, 0x6a0d, 0x69fc, 0x69eb, 0x6a09, 0x6a04, 0x6a18, 0x6a25, - 0x6a0f, 0x69f6, 0x6a26, 0x6a07, 0x69f4, 0x6a16, 0x6b51, 0x6ba5, - 0x6ba3, 0x6ba2, 0x6ba6, 0x6c01, 0x6c00, 0x6bff, 0x6c02, 0x6f41, - 0x6f26, 0x6f7e, 0x6f87, 0x6fc6, 0x6f92, - /* 0xe6 */ - 0x6f8d, 0x6f89, 0x6f8c, 0x6f62, 0x6f4f, 0x6f85, 0x6f5a, 0x6f96, - 0x6f76, 0x6f6c, 0x6f82, 0x6f55, 0x6f72, 0x6f52, 0x6f50, 0x6f57, - 0x6f94, 0x6f93, 0x6f5d, 0x6f00, 0x6f61, 0x6f6b, 0x6f7d, 0x6f67, - 0x6f90, 0x6f53, 0x6f8b, 0x6f69, 0x6f7f, 0x6f95, 0x6f63, 0x6f77, - 0x6f6a, 0x6f7b, 0x71b2, 0x71af, 0x719b, 0x71b0, 0x71a0, 0x719a, - 0x71a9, 0x71b5, 0x719d, 0x71a5, 0x719e, 0x71a4, 0x71a1, 0x71aa, - 0x719c, 0x71a7, 0x71b3, 0x7298, 0x729a, 0x7358, 0x7352, 0x735e, - 0x735f, 0x7360, 0x735d, 0x735b, 0x7361, 0x735a, 0x7359, 0x7362, - 0x7487, 0x7489, 0x748a, 0x7486, 0x7481, 0x747d, 0x7485, 0x7488, - 0x747c, 0x7479, 0x7508, 0x7507, 0x757e, 0x7625, 0x761e, 0x7619, - 0x761d, 0x761c, 0x7623, 0x761a, 0x7628, 0x761b, 0x769c, 0x769d, - 0x769e, 0x769b, 0x778d, 0x778f, 0x7789, 0x7788, 0x78cd, 0x78bb, - 0x78cf, 0x78cc, 0x78d1, 0x78ce, 0x78d4, 0x78c8, 0x78c3, 0x78c4, - 0x78c9, 0x799a, 0x79a1, 0x79a0, 0x799c, 0x79a2, 0x799b, 0x6b76, - 0x7a39, 0x7ab2, 0x7ab4, 0x7ab3, 0x7bb7, 0x7bcb, 0x7bbe, 0x7bac, - 0x7bce, 0x7baf, 0x7bb9, 0x7bca, 0x7bb5, 0x7cc5, 0x7cc8, 0x7ccc, - 0x7ccb, 0x7df7, 0x7ddb, 0x7dea, 0x7de7, 0x7dd7, 0x7de1, 0x7e03, - 0x7dfa, 0x7de6, 0x7df6, 0x7df1, 0x7df0, 0x7dee, 0x7ddf, 0x7f76, - 0x7fac, 0x7fb0, 0x7fad, 0x7fed, 0x7feb, 0x7fea, 0x7fec, 0x7fe6, - 0x7fe8, 0x8064, 0x8067, 0x81a3, 0x819f, - /* 0xe7 */ - 0x819e, 0x8195, 0x81a2, 0x8199, 0x8197, 0x8216, 0x824f, 0x8253, - 0x8252, 0x8250, 0x824e, 0x8251, 0x8524, 0x853b, 0x850f, 0x8500, - 0x8529, 0x850e, 0x8509, 0x850d, 0x851f, 0x850a, 0x8527, 0x851c, - 0x84fb, 0x852b, 0x84fa, 0x8508, 0x850c, 0x84f4, 0x852a, 0x84f2, - 0x8515, 0x84f7, 0x84eb, 0x84f3, 0x84fc, 0x8512, 0x84ea, 0x84e9, - 0x8516, 0x84fe, 0x8528, 0x851d, 0x852e, 0x8502, 0x84fd, 0x851e, - 0x84f6, 0x8531, 0x8526, 0x84e7, 0x84e8, 0x84f0, 0x84ef, 0x84f9, - 0x8518, 0x8520, 0x8530, 0x850b, 0x8519, 0x852f, 0x8662, 0x8756, - 0x8763, 0x8764, 0x8777, 0x87e1, 0x8773, 0x8758, 0x8754, 0x875b, - 0x8752, 0x8761, 0x875a, 0x8751, 0x875e, 0x876d, 0x876a, 0x8750, - 0x874e, 0x875f, 0x875d, 0x876f, 0x876c, 0x877a, 0x876e, 0x875c, - 0x8765, 0x874f, 0x877b, 0x8775, 0x8762, 0x8767, 0x8769, 0x885a, - 0x8905, 0x890c, 0x8914, 0x890b, 0x8917, 0x8918, 0x8919, 0x8906, - 0x8916, 0x8911, 0x890e, 0x8909, 0x89a2, 0x89a4, 0x89a3, 0x89ed, - 0x89f0, 0x89ec, 0x8acf, 0x8ac6, 0x8ab8, 0x8ad3, 0x8ad1, 0x8ad4, - 0x8ad5, 0x8abb, 0x8ad7, 0x8abe, 0x8ac0, 0x8ac5, 0x8ad8, 0x8ac3, - 0x8aba, 0x8abd, 0x8ad9, 0x8c3e, 0x8c4d, 0x8c8f, 0x8ce5, 0x8cdf, - 0x8cd9, 0x8ce8, 0x8cda, 0x8cdd, 0x8ce7, 0x8da0, 0x8d9c, 0x8da1, - 0x8d9b, 0x8e20, 0x8e23, 0x8e25, 0x8e24, 0x8e2e, 0x8e15, 0x8e1b, - 0x8e16, 0x8e11, 0x8e19, 0x8e26, 0x8e27, - /* 0xe8 */ - 0x8e14, 0x8e12, 0x8e18, 0x8e13, 0x8e1c, 0x8e17, 0x8e1a, 0x8f2c, - 0x8f24, 0x8f18, 0x8f1a, 0x8f20, 0x8f23, 0x8f16, 0x8f17, 0x9073, - 0x9070, 0x906f, 0x9067, 0x906b, 0x912f, 0x912b, 0x9129, 0x912a, - 0x9132, 0x9126, 0x912e, 0x9185, 0x9186, 0x918a, 0x9181, 0x9182, - 0x9184, 0x9180, 0x92d0, 0x92c3, 0x92c4, 0x92c0, 0x92d9, 0x92b6, - 0x92cf, 0x92f1, 0x92df, 0x92d8, 0x92e9, 0x92d7, 0x92dd, 0x92cc, - 0x92ef, 0x92c2, 0x92e8, 0x92ca, 0x92c8, 0x92ce, 0x92e6, 0x92cd, - 0x92d5, 0x92c9, 0x92e0, 0x92de, 0x92e7, 0x92d1, 0x92d3, 0x92b5, - 0x92e1, 0x92c6, 0x92b4, 0x957c, 0x95ac, 0x95ab, 0x95ae, 0x95b0, - 0x96a4, 0x96a2, 0x96d3, 0x9705, 0x9708, 0x9702, 0x975a, 0x978a, - 0x978e, 0x9788, 0x97d0, 0x97cf, 0x981e, 0x981d, 0x9826, 0x9829, - 0x9828, 0x9820, 0x981b, 0x9827, 0x98b2, 0x9908, 0x98fa, 0x9911, - 0x9914, 0x9916, 0x9917, 0x9915, 0x99dc, 0x99cd, 0x99cf, 0x99d3, - 0x99d4, 0x99ce, 0x99c9, 0x99d6, 0x99d8, 0x99cb, 0x99d7, 0x99cc, - 0x9ab3, 0x9aec, 0x9aeb, 0x9af3, 0x9af2, 0x9af1, 0x9b46, 0x9b43, - 0x9b67, 0x9b74, 0x9b71, 0x9b66, 0x9b76, 0x9b75, 0x9b70, 0x9b68, - 0x9b64, 0x9b6c, 0x9cfc, 0x9cfa, 0x9cfd, 0x9cff, 0x9cf7, 0x9d07, - 0x9d00, 0x9cf9, 0x9cfb, 0x9d08, 0x9d05, 0x9d04, 0x9e83, 0x9ed3, - 0x9f0f, 0x9f10, 0x511c, 0x5113, 0x5117, 0x511a, 0x5111, 0x51de, - 0x5334, 0x53e1, 0x5670, 0x5660, 0x566e, - /* 0xe9 */ - 0x5673, 0x5666, 0x5663, 0x566d, 0x5672, 0x565e, 0x5677, 0x571c, - 0x571b, 0x58c8, 0x58bd, 0x58c9, 0x58bf, 0x58ba, 0x58c2, 0x58bc, - 0x58c6, 0x5b17, 0x5b19, 0x5b1b, 0x5b21, 0x5b14, 0x5b13, 0x5b10, - 0x5b16, 0x5b28, 0x5b1a, 0x5b20, 0x5b1e, 0x5bef, 0x5dac, 0x5db1, - 0x5da9, 0x5da7, 0x5db5, 0x5db0, 0x5dae, 0x5daa, 0x5da8, 0x5db2, - 0x5dad, 0x5daf, 0x5db4, 0x5e67, 0x5e68, 0x5e66, 0x5e6f, 0x5ee9, - 0x5ee7, 0x5ee6, 0x5ee8, 0x5ee5, 0x5f4b, 0x5fbc, 0x619d, 0x61a8, - 0x6196, 0x61c5, 0x61b4, 0x61c6, 0x61c1, 0x61cc, 0x61ba, 0x61bf, - 0x61b8, 0x618c, 0x64d7, 0x64d6, 0x64d0, 0x64cf, 0x64c9, 0x64bd, - 0x6489, 0x64c3, 0x64db, 0x64f3, 0x64d9, 0x6533, 0x657f, 0x657c, - 0x65a2, 0x66c8, 0x66be, 0x66c0, 0x66ca, 0x66cb, 0x66cf, 0x66bd, - 0x66bb, 0x66ba, 0x66cc, 0x6723, 0x6a34, 0x6a66, 0x6a49, 0x6a67, - 0x6a32, 0x6a68, 0x6a3e, 0x6a5d, 0x6a6d, 0x6a76, 0x6a5b, 0x6a51, - 0x6a28, 0x6a5a, 0x6a3b, 0x6a3f, 0x6a41, 0x6a6a, 0x6a64, 0x6a50, - 0x6a4f, 0x6a54, 0x6a6f, 0x6a69, 0x6a60, 0x6a3c, 0x6a5e, 0x6a56, - 0x6a55, 0x6a4d, 0x6a4e, 0x6a46, 0x6b55, 0x6b54, 0x6b56, 0x6ba7, - 0x6baa, 0x6bab, 0x6bc8, 0x6bc7, 0x6c04, 0x6c03, 0x6c06, 0x6fad, - 0x6fcb, 0x6fa3, 0x6fc7, 0x6fbc, 0x6fce, 0x6fc8, 0x6f5e, 0x6fc4, - 0x6fbd, 0x6f9e, 0x6fca, 0x6fa8, 0x7004, 0x6fa5, 0x6fae, 0x6fba, - 0x6fac, 0x6faa, 0x6fcf, 0x6fbf, 0x6fb8, - /* 0xea */ - 0x6fa2, 0x6fc9, 0x6fab, 0x6fcd, 0x6faf, 0x6fb2, 0x6fb0, 0x71c5, - 0x71c2, 0x71bf, 0x71b8, 0x71d6, 0x71c0, 0x71c1, 0x71cb, 0x71d4, - 0x71ca, 0x71c7, 0x71cf, 0x71bd, 0x71d8, 0x71bc, 0x71c6, 0x71da, - 0x71db, 0x729d, 0x729e, 0x7369, 0x7366, 0x7367, 0x736c, 0x7365, - 0x736b, 0x736a, 0x747f, 0x749a, 0x74a0, 0x7494, 0x7492, 0x7495, - 0x74a1, 0x750b, 0x7580, 0x762f, 0x762d, 0x7631, 0x763d, 0x7633, - 0x763c, 0x7635, 0x7632, 0x7630, 0x76bb, 0x76e6, 0x779a, 0x779d, - 0x77a1, 0x779c, 0x779b, 0x77a2, 0x77a3, 0x7795, 0x7799, 0x7797, - 0x78dd, 0x78e9, 0x78e5, 0x78ea, 0x78de, 0x78e3, 0x78db, 0x78e1, - 0x78e2, 0x78ed, 0x78df, 0x78e0, 0x79a4, 0x7a44, 0x7a48, 0x7a47, - 0x7ab6, 0x7ab8, 0x7ab5, 0x7ab1, 0x7ab7, 0x7bde, 0x7be3, 0x7be7, - 0x7bdd, 0x7bd5, 0x7be5, 0x7bda, 0x7be8, 0x7bf9, 0x7bd4, 0x7bea, - 0x7be2, 0x7bdc, 0x7beb, 0x7bd8, 0x7bdf, 0x7cd2, 0x7cd4, 0x7cd7, - 0x7cd0, 0x7cd1, 0x7e12, 0x7e21, 0x7e17, 0x7e0c, 0x7e1f, 0x7e20, - 0x7e13, 0x7e0e, 0x7e1c, 0x7e15, 0x7e1a, 0x7e22, 0x7e0b, 0x7e0f, - 0x7e16, 0x7e0d, 0x7e14, 0x7e25, 0x7e24, 0x7f43, 0x7f7b, 0x7f7c, - 0x7f7a, 0x7fb1, 0x7fef, 0x802a, 0x8029, 0x806c, 0x81b1, 0x81a6, - 0x81ae, 0x81b9, 0x81b5, 0x81ab, 0x81b0, 0x81ac, 0x81b4, 0x81b2, - 0x81b7, 0x81a7, 0x81f2, 0x8255, 0x8256, 0x8257, 0x8556, 0x8545, - 0x856b, 0x854d, 0x8553, 0x8561, 0x8558, - /* 0xeb */ - 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, - 0x8563, 0x853e, 0x855b, 0x8571, 0x854e, 0x856e, 0x8575, 0x8555, - 0x8567, 0x8560, 0x858c, 0x8566, 0x855d, 0x8554, 0x8565, 0x856c, - 0x8663, 0x8665, 0x8664, 0x879b, 0x878f, 0x8797, 0x8793, 0x8792, - 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87a3, 0x8785, - 0x8790, 0x8791, 0x879d, 0x8784, 0x8794, 0x879c, 0x879a, 0x8789, - 0x891e, 0x8926, 0x8930, 0x892d, 0x892e, 0x8927, 0x8931, 0x8922, - 0x8929, 0x8923, 0x892f, 0x892c, 0x891f, 0x89f1, 0x8ae0, 0x8ae2, - 0x8af2, 0x8af4, 0x8af5, 0x8add, 0x8b14, 0x8ae4, 0x8adf, 0x8af0, - 0x8ac8, 0x8ade, 0x8ae1, 0x8ae8, 0x8aff, 0x8aef, 0x8afb, 0x8c91, - 0x8c92, 0x8c90, 0x8cf5, 0x8cee, 0x8cf1, 0x8cf0, 0x8cf3, 0x8d6c, - 0x8d6e, 0x8da5, 0x8da7, 0x8e33, 0x8e3e, 0x8e38, 0x8e40, 0x8e45, - 0x8e36, 0x8e3c, 0x8e3d, 0x8e41, 0x8e30, 0x8e3f, 0x8ebd, 0x8f36, - 0x8f2e, 0x8f35, 0x8f32, 0x8f39, 0x8f37, 0x8f34, 0x9076, 0x9079, - 0x907b, 0x9086, 0x90fa, 0x9133, 0x9135, 0x9136, 0x9193, 0x9190, - 0x9191, 0x918d, 0x918f, 0x9327, 0x931e, 0x9308, 0x931f, 0x9306, - 0x930f, 0x937a, 0x9338, 0x933c, 0x931b, 0x9323, 0x9312, 0x9301, - 0x9346, 0x932d, 0x930e, 0x930d, 0x92cb, 0x931d, 0x92fa, 0x9325, - 0x9313, 0x92f9, 0x92f7, 0x9334, 0x9302, 0x9324, 0x92ff, 0x9329, - 0x9339, 0x9335, 0x932a, 0x9314, 0x930c, - /* 0xec */ - 0x930b, 0x92fe, 0x9309, 0x9300, 0x92fb, 0x9316, 0x95bc, 0x95cd, - 0x95be, 0x95b9, 0x95ba, 0x95b6, 0x95bf, 0x95b5, 0x95bd, 0x96a9, - 0x96d4, 0x970b, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97f0, - 0x97f8, 0x9835, 0x982f, 0x9832, 0x9924, 0x991f, 0x9927, 0x9929, - 0x999e, 0x99ee, 0x99ec, 0x99e5, 0x99e4, 0x99f0, 0x99e3, 0x99ea, - 0x99e9, 0x99e7, 0x9ab9, 0x9abf, 0x9ab4, 0x9abb, 0x9af6, 0x9afa, - 0x9af9, 0x9af7, 0x9b33, 0x9b80, 0x9b85, 0x9b87, 0x9b7c, 0x9b7e, - 0x9b7b, 0x9b82, 0x9b93, 0x9b92, 0x9b90, 0x9b7a, 0x9b95, 0x9b7d, - 0x9b88, 0x9d25, 0x9d17, 0x9d20, 0x9d1e, 0x9d14, 0x9d29, 0x9d1d, - 0x9d18, 0x9d22, 0x9d10, 0x9d19, 0x9d1f, 0x9e88, 0x9e86, 0x9e87, - 0x9eae, 0x9ead, 0x9ed5, 0x9ed6, 0x9efa, 0x9f12, 0x9f3d, 0x5126, - 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52f4, 0x5693, 0x568c, - 0x568d, 0x5686, 0x5684, 0x5683, 0x567e, 0x5682, 0x567f, 0x5681, - 0x58d6, 0x58d4, 0x58cf, 0x58d2, 0x5b2d, 0x5b25, 0x5b32, 0x5b23, - 0x5b2c, 0x5b27, 0x5b26, 0x5b2f, 0x5b2e, 0x5b7b, 0x5bf1, 0x5bf2, - 0x5db7, 0x5e6c, 0x5e6a, 0x5fbe, 0x5fbb, 0x61c3, 0x61b5, 0x61bc, - 0x61e7, 0x61e0, 0x61e5, 0x61e4, 0x61e8, 0x61de, 0x64ef, 0x64e9, - 0x64e3, 0x64eb, 0x64e4, 0x64e8, 0x6581, 0x6580, 0x65b6, 0x65da, - 0x66d2, 0x6a8d, 0x6a96, 0x6a81, 0x6aa5, 0x6a89, 0x6a9f, 0x6a9b, - 0x6aa1, 0x6a9e, 0x6a87, 0x6a93, 0x6a8e, - /* 0xed */ - 0x6a95, 0x6a83, 0x6aa8, 0x6aa4, 0x6a91, 0x6a7f, 0x6aa6, 0x6a9a, - 0x6a85, 0x6a8c, 0x6a92, 0x6b5b, 0x6bad, 0x6c09, 0x6fcc, 0x6fa9, - 0x6ff4, 0x6fd4, 0x6fe3, 0x6fdc, 0x6fed, 0x6fe7, 0x6fe6, 0x6fde, - 0x6ff2, 0x6fdd, 0x6fe2, 0x6fe8, 0x71e1, 0x71f1, 0x71e8, 0x71f2, - 0x71e4, 0x71f0, 0x71e2, 0x7373, 0x736e, 0x736f, 0x7497, 0x74b2, - 0x74ab, 0x7490, 0x74aa, 0x74ad, 0x74b1, 0x74a5, 0x74af, 0x7510, - 0x7511, 0x7512, 0x750f, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, - 0x76a4, 0x76e9, 0x77b5, 0x77ab, 0x77b2, 0x77b7, 0x77b6, 0x77b4, - 0x77b1, 0x77a8, 0x77f0, 0x78f3, 0x78fd, 0x7902, 0x78fb, 0x78fc, - 0x78f2, 0x7905, 0x78f9, 0x78fe, 0x7904, 0x79ab, 0x79a8, 0x7a5c, - 0x7a5b, 0x7a56, 0x7a58, 0x7a54, 0x7a5a, 0x7abe, 0x7ac0, 0x7ac1, - 0x7c05, 0x7c0f, 0x7bf2, 0x7c00, 0x7bff, 0x7bfb, 0x7c0e, 0x7bf4, - 0x7c0b, 0x7bf3, 0x7c02, 0x7c09, 0x7c03, 0x7c01, 0x7bf8, 0x7bfd, - 0x7c06, 0x7bf0, 0x7bf1, 0x7c10, 0x7c0a, 0x7ce8, 0x7e2d, 0x7e3c, - 0x7e42, 0x7e33, 0x9848, 0x7e38, 0x7e2a, 0x7e49, 0x7e40, 0x7e47, - 0x7e29, 0x7e4c, 0x7e30, 0x7e3b, 0x7e36, 0x7e44, 0x7e3a, 0x7f45, - 0x7f7f, 0x7f7e, 0x7f7d, 0x7ff4, 0x7ff2, 0x802c, 0x81bb, 0x81c4, - 0x81cc, 0x81ca, 0x81c5, 0x81c7, 0x81bc, 0x81e9, 0x825b, 0x825a, - 0x825c, 0x8583, 0x8580, 0x858f, 0x85a7, 0x8595, 0x85a0, 0x858b, - 0x85a3, 0x857b, 0x85a4, 0x859a, 0x859e, - /* 0xee */ - 0x8577, 0x857c, 0x8589, 0x85a1, 0x857a, 0x8578, 0x8557, 0x858e, - 0x8596, 0x8586, 0x858d, 0x8599, 0x859d, 0x8581, 0x85a2, 0x8582, - 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859f, 0x8668, - 0x87be, 0x87aa, 0x87ad, 0x87c5, 0x87b0, 0x87ac, 0x87b9, 0x87b5, - 0x87bc, 0x87ae, 0x87c9, 0x87c3, 0x87c2, 0x87cc, 0x87b7, 0x87af, - 0x87c4, 0x87ca, 0x87b4, 0x87b6, 0x87bf, 0x87b8, 0x87bd, 0x87de, - 0x87b2, 0x8935, 0x8933, 0x893c, 0x893e, 0x8941, 0x8952, 0x8937, - 0x8942, 0x89ad, 0x89af, 0x89ae, 0x89f2, 0x89f3, 0x8b1e, 0x8b18, - 0x8b16, 0x8b11, 0x8b05, 0x8b0b, 0x8b22, 0x8b0f, 0x8b12, 0x8b15, - 0x8b07, 0x8b0d, 0x8b08, 0x8b06, 0x8b1c, 0x8b13, 0x8b1a, 0x8c4f, - 0x8c70, 0x8c72, 0x8c71, 0x8c6f, 0x8c95, 0x8c94, 0x8cf9, 0x8d6f, - 0x8e4e, 0x8e4d, 0x8e53, 0x8e50, 0x8e4c, 0x8e47, 0x8f43, 0x8f40, - 0x9085, 0x907e, 0x9138, 0x919a, 0x91a2, 0x919b, 0x9199, 0x919f, - 0x91a1, 0x919d, 0x91a0, 0x93a1, 0x9383, 0x93af, 0x9364, 0x9356, - 0x9347, 0x937c, 0x9358, 0x935c, 0x9376, 0x9349, 0x9350, 0x9351, - 0x9360, 0x936d, 0x938f, 0x934c, 0x936a, 0x9379, 0x9357, 0x9355, - 0x9352, 0x934f, 0x9371, 0x9377, 0x937b, 0x9361, 0x935e, 0x9363, - 0x9367, 0x9380, 0x934e, 0x9359, 0x95c7, 0x95c0, 0x95c9, 0x95c3, - 0x95c5, 0x95b7, 0x96ae, 0x96b0, 0x96ac, 0x9720, 0x971f, 0x9718, - 0x971d, 0x9719, 0x979a, 0x97a1, 0x979c, - /* 0xef */ - 0x979e, 0x979d, 0x97d5, 0x97d4, 0x97f1, 0x9841, 0x9844, 0x984a, - 0x9849, 0x9845, 0x9843, 0x9925, 0x992b, 0x992c, 0x992a, 0x9933, - 0x9932, 0x992f, 0x992d, 0x9931, 0x9930, 0x9998, 0x99a3, 0x99a1, - 0x9a02, 0x99fa, 0x99f4, 0x99f7, 0x99f9, 0x99f8, 0x99f6, 0x99fb, - 0x99fd, 0x99fe, 0x99fc, 0x9a03, 0x9abe, 0x9afe, 0x9afd, 0x9b01, - 0x9afc, 0x9b48, 0x9b9a, 0x9ba8, 0x9b9e, 0x9b9b, 0x9ba6, 0x9ba1, - 0x9ba5, 0x9ba4, 0x9b86, 0x9ba2, 0x9ba0, 0x9baf, 0x9d33, 0x9d41, - 0x9d67, 0x9d36, 0x9d2e, 0x9d2f, 0x9d31, 0x9d38, 0x9d30, 0x9d45, - 0x9d42, 0x9d43, 0x9d3e, 0x9d37, 0x9d40, 0x9d3d, 0x7ff5, 0x9d2d, - 0x9e8a, 0x9e89, 0x9e8d, 0x9eb0, 0x9ec8, 0x9eda, 0x9efb, 0x9eff, - 0x9f24, 0x9f23, 0x9f22, 0x9f54, 0x9fa0, 0x5131, 0x512d, 0x512e, - 0x5698, 0x569c, 0x5697, 0x569a, 0x569d, 0x5699, 0x5970, 0x5b3c, - 0x5c69, 0x5c6a, 0x5dc0, 0x5e6d, 0x5e6e, 0x61d8, 0x61df, 0x61ed, - 0x61ee, 0x61f1, 0x61ea, 0x61f0, 0x61eb, 0x61d6, 0x61e9, 0x64ff, - 0x6504, 0x64fd, 0x64f8, 0x6501, 0x6503, 0x64fc, 0x6594, 0x65db, - 0x66da, 0x66db, 0x66d8, 0x6ac5, 0x6ab9, 0x6abd, 0x6ae1, 0x6ac6, - 0x6aba, 0x6ab6, 0x6ab7, 0x6ac7, 0x6ab4, 0x6aad, 0x6b5e, 0x6bc9, - 0x6c0b, 0x7007, 0x700c, 0x700d, 0x7001, 0x7005, 0x7014, 0x700e, - 0x6fff, 0x7000, 0x6ffb, 0x7026, 0x6ffc, 0x6ff7, 0x700a, 0x7201, - 0x71ff, 0x71f9, 0x7203, 0x71fd, 0x7376, - /* 0xf0 */ - 0x74b8, 0x74c0, 0x74b5, 0x74c1, 0x74be, 0x74b6, 0x74bb, 0x74c2, - 0x7514, 0x7513, 0x765c, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, - 0x765a, 0x76a6, 0x76bd, 0x76ec, 0x77c2, 0x77ba, 0x78ff, 0x790c, - 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79ad, 0x79ac, - 0x7a5f, 0x7c1c, 0x7c29, 0x7c19, 0x7c20, 0x7c1f, 0x7c2d, 0x7c1d, - 0x7c26, 0x7c28, 0x7c22, 0x7c25, 0x7c30, 0x7e5c, 0x7e50, 0x7e56, - 0x7e63, 0x7e58, 0x7e62, 0x7e5f, 0x7e51, 0x7e60, 0x7e57, 0x7e53, - 0x7fb5, 0x7fb3, 0x7ff7, 0x7ff8, 0x8075, 0x81d1, 0x81d2, 0x81d0, - 0x825f, 0x825e, 0x85b4, 0x85c6, 0x85c0, 0x85c3, 0x85c2, 0x85b3, - 0x85b5, 0x85bd, 0x85c7, 0x85c4, 0x85bf, 0x85cb, 0x85ce, 0x85c8, - 0x85c5, 0x85b1, 0x85b6, 0x85d2, 0x8624, 0x85b8, 0x85b7, 0x85be, - 0x8669, 0x87e7, 0x87e6, 0x87e2, 0x87db, 0x87eb, 0x87ea, 0x87e5, - 0x87df, 0x87f3, 0x87e4, 0x87d4, 0x87dc, 0x87d3, 0x87ed, 0x87d8, - 0x87e3, 0x87a4, 0x87d7, 0x87d9, 0x8801, 0x87f4, 0x87e8, 0x87dd, - 0x8953, 0x894b, 0x894f, 0x894c, 0x8946, 0x8950, 0x8951, 0x8949, - 0x8b2a, 0x8b27, 0x8b23, 0x8b33, 0x8b30, 0x8b35, 0x8b47, 0x8b2f, - 0x8b3c, 0x8b3e, 0x8b31, 0x8b25, 0x8b37, 0x8b26, 0x8b36, 0x8b2e, - 0x8b24, 0x8b3b, 0x8b3d, 0x8b3a, 0x8c42, 0x8c75, 0x8c99, 0x8c98, - 0x8c97, 0x8cfe, 0x8d04, 0x8d02, 0x8d00, 0x8e5c, 0x8e62, 0x8e60, - 0x8e57, 0x8e56, 0x8e5e, 0x8e65, 0x8e67, - /* 0xf1 */ - 0x8e5b, 0x8e5a, 0x8e61, 0x8e5d, 0x8e69, 0x8e54, 0x8f46, 0x8f47, - 0x8f48, 0x8f4b, 0x9128, 0x913a, 0x913b, 0x913e, 0x91a8, 0x91a5, - 0x91a7, 0x91af, 0x91aa, 0x93b5, 0x938c, 0x9392, 0x93b7, 0x939b, - 0x939d, 0x9389, 0x93a7, 0x938e, 0x93aa, 0x939e, 0x93a6, 0x9395, - 0x9388, 0x9399, 0x939f, 0x938d, 0x93b1, 0x9391, 0x93b2, 0x93a4, - 0x93a8, 0x93b4, 0x93a3, 0x93a5, 0x95d2, 0x95d3, 0x95d1, 0x96b3, - 0x96d7, 0x96da, 0x5dc2, 0x96df, 0x96d8, 0x96dd, 0x9723, 0x9722, - 0x9725, 0x97ac, 0x97ae, 0x97a8, 0x97ab, 0x97a4, 0x97aa, 0x97a2, - 0x97a5, 0x97d7, 0x97d9, 0x97d6, 0x97d8, 0x97fa, 0x9850, 0x9851, - 0x9852, 0x98b8, 0x9941, 0x993c, 0x993a, 0x9a0f, 0x9a0b, 0x9a09, - 0x9a0d, 0x9a04, 0x9a11, 0x9a0a, 0x9a05, 0x9a07, 0x9a06, 0x9ac0, - 0x9adc, 0x9b08, 0x9b04, 0x9b05, 0x9b29, 0x9b35, 0x9b4a, 0x9b4c, - 0x9b4b, 0x9bc7, 0x9bc6, 0x9bc3, 0x9bbf, 0x9bc1, 0x9bb5, 0x9bb8, - 0x9bd3, 0x9bb6, 0x9bc4, 0x9bb9, 0x9bbd, 0x9d5c, 0x9d53, 0x9d4f, - 0x9d4a, 0x9d5b, 0x9d4b, 0x9d59, 0x9d56, 0x9d4c, 0x9d57, 0x9d52, - 0x9d54, 0x9d5f, 0x9d58, 0x9d5a, 0x9e8e, 0x9e8c, 0x9edf, 0x9f01, - 0x9f00, 0x9f16, 0x9f25, 0x9f2b, 0x9f2a, 0x9f29, 0x9f28, 0x9f4c, - 0x9f55, 0x5134, 0x5135, 0x5296, 0x52f7, 0x53b4, 0x56ab, 0x56ad, - 0x56a6, 0x56a7, 0x56aa, 0x56ac, 0x58da, 0x58dd, 0x58db, 0x5912, - 0x5b3d, 0x5b3e, 0x5b3f, 0x5dc3, 0x5e70, - /* 0xf2 */ - 0x5fbf, 0x61fb, 0x6507, 0x6510, 0x650d, 0x6509, 0x650c, 0x650e, - 0x6584, 0x65de, 0x65dd, 0x66de, 0x6ae7, 0x6ae0, 0x6acc, 0x6ad1, - 0x6ad9, 0x6acb, 0x6adf, 0x6adc, 0x6ad0, 0x6aeb, 0x6acf, 0x6acd, - 0x6ade, 0x6b60, 0x6bb0, 0x6c0c, 0x7019, 0x7027, 0x7020, 0x7016, - 0x702b, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701c, - 0x702a, 0x720c, 0x720a, 0x7207, 0x7202, 0x7205, 0x72a5, 0x72a6, - 0x72a4, 0x72a3, 0x72a1, 0x74cb, 0x74c5, 0x74b7, 0x74c3, 0x7516, - 0x7660, 0x77c9, 0x77ca, 0x77c4, 0x77f1, 0x791d, 0x791b, 0x7921, - 0x791c, 0x7917, 0x791e, 0x79b0, 0x7a67, 0x7a68, 0x7c33, 0x7c3c, - 0x7c39, 0x7c2c, 0x7c3b, 0x7cec, 0x7cea, 0x7e76, 0x7e75, 0x7e78, - 0x7e70, 0x7e77, 0x7e6f, 0x7e7a, 0x7e72, 0x7e74, 0x7e68, 0x7f4b, - 0x7f4a, 0x7f83, 0x7f86, 0x7fb7, 0x7ffd, 0x7ffe, 0x8078, 0x81d7, - 0x81d5, 0x8264, 0x8261, 0x8263, 0x85eb, 0x85f1, 0x85ed, 0x85d9, - 0x85e1, 0x85e8, 0x85da, 0x85d7, 0x85ec, 0x85f2, 0x85f8, 0x85d8, - 0x85df, 0x85e3, 0x85dc, 0x85d1, 0x85f0, 0x85e6, 0x85ef, 0x85de, - 0x85e2, 0x8800, 0x87fa, 0x8803, 0x87f6, 0x87f7, 0x8809, 0x880c, - 0x880b, 0x8806, 0x87fc, 0x8808, 0x87ff, 0x880a, 0x8802, 0x8962, - 0x895a, 0x895b, 0x8957, 0x8961, 0x895c, 0x8958, 0x895d, 0x8959, - 0x8988, 0x89b7, 0x89b6, 0x89f6, 0x8b50, 0x8b48, 0x8b4a, 0x8b40, - 0x8b53, 0x8b56, 0x8b54, 0x8b4b, 0x8b55, - /* 0xf3 */ - 0x8b51, 0x8b42, 0x8b52, 0x8b57, 0x8c43, 0x8c77, 0x8c76, 0x8c9a, - 0x8d06, 0x8d07, 0x8d09, 0x8dac, 0x8daa, 0x8dad, 0x8dab, 0x8e6d, - 0x8e78, 0x8e73, 0x8e6a, 0x8e6f, 0x8e7b, 0x8ec2, 0x8f52, 0x8f51, - 0x8f4f, 0x8f50, 0x8f53, 0x8fb4, 0x9140, 0x913f, 0x91b0, 0x91ad, - 0x93de, 0x93c7, 0x93cf, 0x93c2, 0x93da, 0x93d0, 0x93f9, 0x93ec, - 0x93cc, 0x93d9, 0x93a9, 0x93e6, 0x93ca, 0x93d4, 0x93ee, 0x93e3, - 0x93d5, 0x93c4, 0x93ce, 0x93c0, 0x93d2, 0x93e7, 0x957d, 0x95da, - 0x95db, 0x96e1, 0x9729, 0x972b, 0x972c, 0x9728, 0x9726, 0x97b3, - 0x97b7, 0x97b6, 0x97dd, 0x97de, 0x97df, 0x985c, 0x9859, 0x985d, - 0x9857, 0x98bf, 0x98bd, 0x98bb, 0x98be, 0x9948, 0x9947, 0x9943, - 0x99a6, 0x99a7, 0x9a1a, 0x9a15, 0x9a25, 0x9a1d, 0x9a24, 0x9a1b, - 0x9a22, 0x9a20, 0x9a27, 0x9a23, 0x9a1e, 0x9a1c, 0x9a14, 0x9ac2, - 0x9b0b, 0x9b0a, 0x9b0e, 0x9b0c, 0x9b37, 0x9bea, 0x9beb, 0x9be0, - 0x9bde, 0x9be4, 0x9be6, 0x9be2, 0x9bf0, 0x9bd4, 0x9bd7, 0x9bec, - 0x9bdc, 0x9bd9, 0x9be5, 0x9bd5, 0x9be1, 0x9bda, 0x9d77, 0x9d81, - 0x9d8a, 0x9d84, 0x9d88, 0x9d71, 0x9d80, 0x9d78, 0x9d86, 0x9d8b, - 0x9d8c, 0x9d7d, 0x9d6b, 0x9d74, 0x9d75, 0x9d70, 0x9d69, 0x9d85, - 0x9d73, 0x9d7b, 0x9d82, 0x9d6f, 0x9d79, 0x9d7f, 0x9d87, 0x9d68, - 0x9e94, 0x9e91, 0x9ec0, 0x9efc, 0x9f2d, 0x9f40, 0x9f41, 0x9f4d, - 0x9f56, 0x9f57, 0x9f58, 0x5337, 0x56b2, - /* 0xf4 */ - 0x56b5, 0x56b3, 0x58e3, 0x5b45, 0x5dc6, 0x5dc7, 0x5eee, 0x5eef, - 0x5fc0, 0x5fc1, 0x61f9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65df, - 0x66e8, 0x66e3, 0x66e4, 0x6af3, 0x6af0, 0x6aea, 0x6ae8, 0x6af9, - 0x6af1, 0x6aee, 0x6aef, 0x703c, 0x7035, 0x702f, 0x7037, 0x7034, - 0x7031, 0x7042, 0x7038, 0x703f, 0x703a, 0x7039, 0x7040, 0x703b, - 0x7033, 0x7041, 0x7213, 0x7214, 0x72a8, 0x737d, 0x737c, 0x74ba, - 0x76ab, 0x76aa, 0x76be, 0x76ed, 0x77cc, 0x77ce, 0x77cf, 0x77cd, - 0x77f2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, 0x79b2, - 0x7a6e, 0x7a6c, 0x7a6d, 0x7af7, 0x7c49, 0x7c48, 0x7c4a, 0x7c47, - 0x7c45, 0x7cee, 0x7e7b, 0x7e7e, 0x7e81, 0x7e80, 0x7fba, 0x7fff, - 0x8079, 0x81db, 0x81d9, 0x820b, 0x8268, 0x8269, 0x8622, 0x85ff, - 0x8601, 0x85fe, 0x861b, 0x8600, 0x85f6, 0x8604, 0x8609, 0x8605, - 0x860c, 0x85fd, 0x8819, 0x8810, 0x8811, 0x8817, 0x8813, 0x8816, - 0x8963, 0x8966, 0x89b9, 0x89f7, 0x8b60, 0x8b6a, 0x8b5d, 0x8b68, - 0x8b63, 0x8b65, 0x8b67, 0x8b6d, 0x8dae, 0x8e86, 0x8e88, 0x8e84, - 0x8f59, 0x8f56, 0x8f57, 0x8f55, 0x8f58, 0x8f5a, 0x908d, 0x9143, - 0x9141, 0x91b7, 0x91b5, 0x91b2, 0x91b3, 0x940b, 0x9413, 0x93fb, - 0x9420, 0x940f, 0x9414, 0x93fe, 0x9415, 0x9410, 0x9428, 0x9419, - 0x940d, 0x93f5, 0x9400, 0x93f7, 0x9407, 0x940e, 0x9416, 0x9412, - 0x93fa, 0x9409, 0x93f8, 0x940a, 0x93ff, - /* 0xf5 */ - 0x93fc, 0x940c, 0x93f6, 0x9411, 0x9406, 0x95de, 0x95e0, 0x95df, - 0x972e, 0x972f, 0x97b9, 0x97bb, 0x97fd, 0x97fe, 0x9860, 0x9862, - 0x9863, 0x985f, 0x98c1, 0x98c2, 0x9950, 0x994e, 0x9959, 0x994c, - 0x994b, 0x9953, 0x9a32, 0x9a34, 0x9a31, 0x9a2c, 0x9a2a, 0x9a36, - 0x9a29, 0x9a2e, 0x9a38, 0x9a2d, 0x9ac7, 0x9aca, 0x9ac6, 0x9b10, - 0x9b12, 0x9b11, 0x9c0b, 0x9c08, 0x9bf7, 0x9c05, 0x9c12, 0x9bf8, - 0x9c40, 0x9c07, 0x9c0e, 0x9c06, 0x9c17, 0x9c14, 0x9c09, 0x9d9f, - 0x9d99, 0x9da4, 0x9d9d, 0x9d92, 0x9d98, 0x9d90, 0x9d9b, 0x9da0, - 0x9d94, 0x9d9c, 0x9daa, 0x9d97, 0x9da1, 0x9d9a, 0x9da2, 0x9da8, - 0x9d9e, 0x9da3, 0x9dbf, 0x9da9, 0x9d96, 0x9da6, 0x9da7, 0x9e99, - 0x9e9b, 0x9e9a, 0x9ee5, 0x9ee4, 0x9ee7, 0x9ee6, 0x9f30, 0x9f2e, - 0x9f5b, 0x9f60, 0x9f5e, 0x9f5d, 0x9f59, 0x9f91, 0x513a, 0x5139, - 0x5298, 0x5297, 0x56c3, 0x56bd, 0x56be, 0x5b48, 0x5b47, 0x5dcb, - 0x5dcf, 0x5ef1, 0x61fd, 0x651b, 0x6b02, 0x6afc, 0x6b03, 0x6af8, - 0x6b00, 0x7043, 0x7044, 0x704a, 0x7048, 0x7049, 0x7045, 0x7046, - 0x721d, 0x721a, 0x7219, 0x737e, 0x7517, 0x766a, 0x77d0, 0x792d, - 0x7931, 0x792f, 0x7c54, 0x7c53, 0x7cf2, 0x7e8a, 0x7e87, 0x7e88, - 0x7e8b, 0x7e86, 0x7e8d, 0x7f4d, 0x7fbb, 0x8030, 0x81dd, 0x8618, - 0x862a, 0x8626, 0x861f, 0x8623, 0x861c, 0x8619, 0x8627, 0x862e, - 0x8621, 0x8620, 0x8629, 0x861e, 0x8625, - /* 0xf6 */ - 0x8829, 0x881d, 0x881b, 0x8820, 0x8824, 0x881c, 0x882b, 0x884a, - 0x896d, 0x8969, 0x896e, 0x896b, 0x89fa, 0x8b79, 0x8b78, 0x8b45, - 0x8b7a, 0x8b7b, 0x8d10, 0x8d14, 0x8daf, 0x8e8e, 0x8e8c, 0x8f5e, - 0x8f5b, 0x8f5d, 0x9146, 0x9144, 0x9145, 0x91b9, 0x943f, 0x943b, - 0x9436, 0x9429, 0x943d, 0x943c, 0x9430, 0x9439, 0x942a, 0x9437, - 0x942c, 0x9440, 0x9431, 0x95e5, 0x95e4, 0x95e3, 0x9735, 0x973a, - 0x97bf, 0x97e1, 0x9864, 0x98c9, 0x98c6, 0x98c0, 0x9958, 0x9956, - 0x9a39, 0x9a3d, 0x9a46, 0x9a44, 0x9a42, 0x9a41, 0x9a3a, 0x9a3f, - 0x9acd, 0x9b15, 0x9b17, 0x9b18, 0x9b16, 0x9b3a, 0x9b52, 0x9c2b, - 0x9c1d, 0x9c1c, 0x9c2c, 0x9c23, 0x9c28, 0x9c29, 0x9c24, 0x9c21, - 0x9db7, 0x9db6, 0x9dbc, 0x9dc1, 0x9dc7, 0x9dca, 0x9dcf, 0x9dbe, - 0x9dc5, 0x9dc3, 0x9dbb, 0x9db5, 0x9dce, 0x9db9, 0x9dba, 0x9dac, - 0x9dc8, 0x9db1, 0x9dad, 0x9dcc, 0x9db3, 0x9dcd, 0x9db2, 0x9e7a, - 0x9e9c, 0x9eeb, 0x9eee, 0x9eed, 0x9f1b, 0x9f18, 0x9f1a, 0x9f31, - 0x9f4e, 0x9f65, 0x9f64, 0x9f92, 0x4eb9, 0x56c6, 0x56c5, 0x56cb, - 0x5971, 0x5b4b, 0x5b4c, 0x5dd5, 0x5dd1, 0x5ef2, 0x6521, 0x6520, - 0x6526, 0x6522, 0x6b0b, 0x6b08, 0x6b09, 0x6c0d, 0x7055, 0x7056, - 0x7057, 0x7052, 0x721e, 0x721f, 0x72a9, 0x737f, 0x74d8, 0x74d5, - 0x74d9, 0x74d7, 0x766d, 0x76ad, 0x7935, 0x79b4, 0x7a70, 0x7a71, - 0x7c57, 0x7c5c, 0x7c59, 0x7c5b, 0x7c5a, - /* 0xf7 */ - 0x7cf4, 0x7cf1, 0x7e91, 0x7f4f, 0x7f87, 0x81de, 0x826b, 0x8634, - 0x8635, 0x8633, 0x862c, 0x8632, 0x8636, 0x882c, 0x8828, 0x8826, - 0x882a, 0x8825, 0x8971, 0x89bf, 0x89be, 0x89fb, 0x8b7e, 0x8b84, - 0x8b82, 0x8b86, 0x8b85, 0x8b7f, 0x8d15, 0x8e95, 0x8e94, 0x8e9a, - 0x8e92, 0x8e90, 0x8e96, 0x8e97, 0x8f60, 0x8f62, 0x9147, 0x944c, - 0x9450, 0x944a, 0x944b, 0x944f, 0x9447, 0x9445, 0x9448, 0x9449, - 0x9446, 0x973f, 0x97e3, 0x986a, 0x9869, 0x98cb, 0x9954, 0x995b, - 0x9a4e, 0x9a53, 0x9a54, 0x9a4c, 0x9a4f, 0x9a48, 0x9a4a, 0x9a49, - 0x9a52, 0x9a50, 0x9ad0, 0x9b19, 0x9b2b, 0x9b3b, 0x9b56, 0x9b55, - 0x9c46, 0x9c48, 0x9c3f, 0x9c44, 0x9c39, 0x9c33, 0x9c41, 0x9c3c, - 0x9c37, 0x9c34, 0x9c32, 0x9c3d, 0x9c36, 0x9ddb, 0x9dd2, 0x9dde, - 0x9dda, 0x9dcb, 0x9dd0, 0x9ddc, 0x9dd1, 0x9ddf, 0x9de9, 0x9dd9, - 0x9dd8, 0x9dd6, 0x9df5, 0x9dd5, 0x9ddd, 0x9eb6, 0x9ef0, 0x9f35, - 0x9f33, 0x9f32, 0x9f42, 0x9f6b, 0x9f95, 0x9fa2, 0x513d, 0x5299, - 0x58e8, 0x58e7, 0x5972, 0x5b4d, 0x5dd8, 0x882f, 0x5f4f, 0x6201, - 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66eb, 0x6b11, 0x6b12, - 0x6b0f, 0x6bca, 0x705b, 0x705a, 0x7222, 0x7382, 0x7381, 0x7383, - 0x7670, 0x77d4, 0x7c67, 0x7c66, 0x7e95, 0x826c, 0x863a, 0x8640, - 0x8639, 0x863c, 0x8631, 0x863b, 0x863e, 0x8830, 0x8832, 0x882e, - 0x8833, 0x8976, 0x8974, 0x8973, 0x89fe, - /* 0xf8 */ - 0x8b8c, 0x8b8e, 0x8b8b, 0x8b88, 0x8c45, 0x8d19, 0x8e98, 0x8f64, - 0x8f63, 0x91bc, 0x9462, 0x9455, 0x945d, 0x9457, 0x945e, 0x97c4, - 0x97c5, 0x9800, 0x9a56, 0x9a59, 0x9b1e, 0x9b1f, 0x9b20, 0x9c52, - 0x9c58, 0x9c50, 0x9c4a, 0x9c4d, 0x9c4b, 0x9c55, 0x9c59, 0x9c4c, - 0x9c4e, 0x9dfb, 0x9df7, 0x9def, 0x9de3, 0x9deb, 0x9df8, 0x9de4, - 0x9df6, 0x9de1, 0x9dee, 0x9de6, 0x9df2, 0x9df0, 0x9de2, 0x9dec, - 0x9df4, 0x9df3, 0x9de8, 0x9ded, 0x9ec2, 0x9ed0, 0x9ef2, 0x9ef3, - 0x9f06, 0x9f1c, 0x9f38, 0x9f37, 0x9f36, 0x9f43, 0x9f4f, 0x9f71, - 0x9f70, 0x9f6e, 0x9f6f, 0x56d3, 0x56cd, 0x5b4e, 0x5c6d, 0x652d, - 0x66ed, 0x66ee, 0x6b13, 0x705f, 0x7061, 0x705d, 0x7060, 0x7223, - 0x74db, 0x74e5, 0x77d5, 0x7938, 0x79b7, 0x79b6, 0x7c6a, 0x7e97, - 0x7f89, 0x826d, 0x8643, 0x8838, 0x8837, 0x8835, 0x884b, 0x8b94, - 0x8b95, 0x8e9e, 0x8e9f, 0x8ea0, 0x8e9d, 0x91be, 0x91bd, 0x91c2, - 0x946b, 0x9468, 0x9469, 0x96e5, 0x9746, 0x9743, 0x9747, 0x97c7, - 0x97e5, 0x9a5e, 0x9ad5, 0x9b59, 0x9c63, 0x9c67, 0x9c66, 0x9c62, - 0x9c5e, 0x9c60, 0x9e02, 0x9dfe, 0x9e07, 0x9e03, 0x9e06, 0x9e05, - 0x9e00, 0x9e01, 0x9e09, 0x9dff, 0x9dfd, 0x9e04, 0x9ea0, 0x9f1e, - 0x9f46, 0x9f74, 0x9f75, 0x9f76, 0x56d4, 0x652e, 0x65b8, 0x6b18, - 0x6b19, 0x6b17, 0x6b1a, 0x7062, 0x7226, 0x72aa, 0x77d8, 0x77d9, - 0x7939, 0x7c69, 0x7c6b, 0x7cf6, 0x7e9a, - /* 0xf9 */ - 0x7e98, 0x7e9b, 0x7e99, 0x81e0, 0x81e1, 0x8646, 0x8647, 0x8648, - 0x8979, 0x897a, 0x897c, 0x897b, 0x89ff, 0x8b98, 0x8b99, 0x8ea5, - 0x8ea4, 0x8ea3, 0x946e, 0x946d, 0x946f, 0x9471, 0x9473, 0x9749, - 0x9872, 0x995f, 0x9c68, 0x9c6e, 0x9c6d, 0x9e0b, 0x9e0d, 0x9e10, - 0x9e0f, 0x9e12, 0x9e11, 0x9ea1, 0x9ef5, 0x9f09, 0x9f47, 0x9f78, - 0x9f7b, 0x9f7a, 0x9f79, 0x571e, 0x7066, 0x7c6f, 0x883c, 0x8db2, - 0x8ea6, 0x91c3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9a60, 0x9c74, - 0x9c73, 0x9c71, 0x9c75, 0x9e14, 0x9e13, 0x9ef6, 0x9f0a, 0x9fa4, - 0x7068, 0x7065, 0x7cf7, 0x866a, 0x883e, 0x883d, 0x883f, 0x8b9e, - 0x8c9c, 0x8ea9, 0x8ec9, 0x974b, 0x9873, 0x9874, 0x98cc, 0x9961, - 0x99ab, 0x9a64, 0x9a66, 0x9a67, 0x9b24, 0x9e15, 0x9e17, 0x9f48, - 0x6207, 0x6b1e, 0x7227, 0x864c, 0x8ea8, 0x9482, 0x9480, 0x9481, - 0x9a69, 0x9a68, 0x9b2e, 0x9e19, 0x7229, 0x864b, 0x8b9f, 0x9483, - 0x9c79, 0x9eb7, 0x7675, 0x9a6b, 0x9c7a, 0x9e1d, 0x7069, 0x706a, - 0x9ea4, 0x9f7e, 0x9f49, 0x9f98, 0x7881, 0x92b9, 0x88cf, 0x58bb, - 0x6052, 0x7ca7, 0x5afa, 0x2554, 0x2566, 0x2557, 0x2560, 0x256c, - 0x2563, 0x255a, 0x2569, 0x255d, 0x2552, 0x2564, 0x2555, 0x255e, - 0x256a, 0x2561, 0x2558, 0x2567, 0x255b, 0x2553, 0x2565, 0x2556, - 0x255f, 0x256b, 0x2562, 0x2559, 0x2568, 0x255c, 0x2551, 0x2550, - 0x256d, 0x256e, 0x2570, 0x256f, 0xffed, - /* 0xfa */ - 0xe000, 0x92db, 0xe002, 0xe003, 0x854c, 0x42b5, 0x73ef, 0x51b5, - 0x3649, 0xe009, 0xe00a, 0x9344, 0xe00c, 0x82ee, 0xe00e, 0x783c, - 0x6744, 0x62df, 0xe012, 0xe013, 0xe014, 0xe015, 0xe016, 0x4fab, - 0xe018, 0x5008, 0xe01a, 0xe01b, 0xe01c, 0xe01d, 0xe01e, 0x5029, - 0xe020, 0x5fa4, 0xe022, 0xe023, 0x6edb, 0xe025, 0x507d, 0x5101, - 0x347a, 0x510e, 0x986c, 0x3743, 0x8416, 0xe02d, 0xe02e, 0x5160, - 0xe030, 0x516a, 0xe032, 0xe033, 0xe034, 0xe035, 0xe036, 0xe037, - 0xe038, 0x5b82, 0x877d, 0xe03b, 0xe03c, 0x51b2, 0x51b8, 0x9d34, - 0x51c9, 0x51cf, 0x51d1, 0x3cdc, 0x51d3, 0xe045, 0x51b3, 0x51e2, - 0x5342, 0x51ed, 0x83cd, 0x693e, 0xe04c, 0x5f7b, 0x520b, 0x5226, - 0x523c, 0x52b5, 0x5257, 0x5294, 0x52b9, 0x52c5, 0x7c15, 0x8542, - 0x52e0, 0x860d, 0xe05a, 0x5305, 0xe05c, 0x5549, 0x6ed9, 0xe05f, - 0xe060, 0xe061, 0x5333, 0x5344, 0xe064, 0x6ccb, 0xe066, 0x681b, - 0x73d5, 0x604a, 0x3eaa, 0x38cc, 0xe06c, 0x71dd, 0x44a2, 0x536d, - 0x5374, 0xe071, 0x537e, 0x537f, 0xe074, 0xe075, 0x77e6, 0x5393, - 0xe078, 0x53a0, 0x53ab, 0x53ae, 0x73a7, 0xe07d, 0x3f59, 0x739c, - 0x53c1, 0x53c5, 0x6c49, 0x4e49, 0x57fe, 0x53d9, 0x3aab, 0xe087, - 0x53e0, 0xe089, 0xe08a, 0x53f6, 0xe08c, 0x5413, 0x7079, 0x552b, - 0x6657, 0x6d5b, 0x546d, 0xe093, 0xe094, 0x555d, 0x548f, 0x54a4, - 0x47a6, 0xe099, 0xe09a, 0x3db4, 0xe09c, - /* 0xfb */ - 0xe09d, 0xe09e, 0x5547, 0x4ced, 0x542f, 0x7417, 0x5586, 0x55a9, - 0x5605, 0xe0a6, 0xe0a7, 0x4552, 0xe0a9, 0x66b3, 0xe0ab, 0x5637, - 0x66cd, 0xe0ae, 0x66a4, 0x66ad, 0x564d, 0x564f, 0x78f1, 0x56f1, - 0x9787, 0x53fe, 0x5700, 0x56ef, 0x56ed, 0xe0ba, 0x3623, 0xe0bc, - 0x5746, 0xe0be, 0x6c6e, 0x708b, 0x5742, 0x36b1, 0xe0c3, 0x57e6, - 0xe0c5, 0x5803, 0xe0c7, 0xe0c8, 0x5826, 0xe0ca, 0x585c, 0x58aa, - 0x3561, 0x58e0, 0x58dc, 0xe0d0, 0x58fb, 0x5bff, 0x5743, 0xe0d4, - 0xe0d5, 0x93d3, 0x35a1, 0x591f, 0x68a6, 0x36c3, 0x6e59, 0xe0dc, - 0x5a24, 0x5553, 0xe0df, 0x8505, 0x59c9, 0xe0e2, 0xe0e3, 0xe0e4, - 0xe0e5, 0x59d9, 0xe0e7, 0xe0e8, 0xe0e9, 0x6d71, 0xe0eb, 0xe0ec, - 0x59f9, 0xe0ee, 0x5aab, 0x5a63, 0x36e6, 0xe0f2, 0x5a77, 0x3708, - 0x5a96, 0x7465, 0x5ad3, 0xe0f8, 0xe0f9, 0x3d85, 0xe0fb, 0x3732, - 0xe0fd, 0x5e83, 0x52d0, 0x5b76, 0x6588, 0x5b7c, 0xe103, 0x4004, - 0x485d, 0xe106, 0x5bd5, 0x6160, 0xe109, 0xe10a, 0xe10b, 0x5bf3, - 0x5b9d, 0x4d10, 0x5c05, 0xe110, 0x5c13, 0x73ce, 0x5c14, 0xe114, - 0xe115, 0x5c49, 0x48dd, 0x5c85, 0x5ce9, 0x5cef, 0x5d8b, 0xe11c, - 0xe11d, 0x5d10, 0x5d18, 0x5d46, 0xe121, 0x5cba, 0x5dd7, 0x82fc, - 0x382d, 0xe126, 0xe127, 0xe128, 0x8287, 0x3836, 0x3bc2, 0x5e2e, - 0x6a8a, 0x5e75, 0x5e7a, 0xe130, 0xe131, 0x53a6, 0x4eb7, 0x5ed0, - 0x53a8, 0xe136, 0x5e09, 0x5ef4, 0xe139, - /* 0xfc */ - 0x5ef9, 0x5efb, 0x38a0, 0x5efc, 0x683e, 0x941b, 0x5f0d, 0xe141, - 0xe142, 0x3ade, 0x48ae, 0xe145, 0x5f3a, 0xe147, 0xe148, 0x5f58, - 0xe14a, 0x5f63, 0x97bd, 0xe14d, 0x5f72, 0x9340, 0xe150, 0x5fa7, - 0x5db6, 0x3d5f, 0xe154, 0xe155, 0xe156, 0xe157, 0x91d6, 0xe159, - 0xe15a, 0x6031, 0x6685, 0xe15d, 0x3963, 0x3dc7, 0x3639, 0x5790, - 0xe162, 0x7971, 0x3e40, 0x609e, 0x60a4, 0x60b3, 0xe168, 0xe169, - 0xe16a, 0x74a4, 0x50e1, 0x5aa0, 0x6164, 0x8424, 0x6142, 0xe171, - 0xe172, 0x6181, 0x51f4, 0xe175, 0x6187, 0x5baa, 0xe178, 0xe179, - 0x61d3, 0xe17b, 0xe17c, 0x61d0, 0x3932, 0xe17f, 0xe180, 0x6023, - 0x615c, 0x651e, 0x638b, 0xe185, 0x62c5, 0xe187, 0x62d5, 0xe189, - 0x636c, 0xe18b, 0x3a17, 0x6438, 0x63f8, 0xe18f, 0xe190, 0x6490, - 0x6f8a, 0xe193, 0x9814, 0xe195, 0xe196, 0x64e1, 0x64e5, 0x947b, - 0x3a66, 0x643a, 0x3a57, 0x654d, 0x6f16, 0xe19f, 0xe1a0, 0x6585, - 0x656d, 0x655f, 0xe1a4, 0x65b5, 0xe1a6, 0x4b37, 0x65d1, 0x40d8, - 0xe1aa, 0x65e0, 0x65e3, 0x5fdf, 0xe1ae, 0x6618, 0xe1b0, 0xe1b1, - 0x6644, 0xe1b3, 0xe1b4, 0x664b, 0xe1b6, 0x6667, 0xe1b8, 0x6673, - 0x6674, 0xe1bb, 0xe1bc, 0xe1bd, 0xe1be, 0xe1bf, 0x77c5, 0xe1c1, - 0x99a4, 0x6702, 0xe1c4, 0xe1c5, 0x3b2b, 0x69fa, 0xe1c8, 0x675e, - 0x6767, 0x6762, 0xe1cc, 0xe1cd, 0x67d7, 0x44e9, 0x6822, 0x6e50, - 0x923c, 0x6801, 0xe1d4, 0xe1d5, 0x685d, - /* 0xfd */ - 0xe1d7, 0x69e1, 0x6a0b, 0xe1da, 0x6973, 0x68c3, 0xe1dd, 0x6901, - 0x6900, 0x3d32, 0x3a01, 0xe1e2, 0x3b80, 0x67ac, 0x6961, 0xe1e6, - 0x42fc, 0x6936, 0x6998, 0x3ba1, 0xe1eb, 0x8363, 0x5090, 0x69f9, - 0xe1ef, 0xe1f0, 0x6a45, 0xe1f2, 0x6a9d, 0x3bf3, 0x67b1, 0x6ac8, - 0xe1f7, 0x3c0d, 0x6b1d, 0xe1fa, 0x60de, 0x6b35, 0x6b74, 0xe1fe, - 0x6eb5, 0xe200, 0xe201, 0xe202, 0x3740, 0x5421, 0xe205, 0x6be1, - 0xe207, 0x6bdc, 0x6c37, 0xe20a, 0xe20b, 0xe20c, 0x6c5a, 0x8226, - 0x6c79, 0xe210, 0x44c5, 0xe212, 0xe213, 0xe214, 0xe215, 0xe216, - 0x36e5, 0x3ceb, 0xe219, 0x9b83, 0xe21b, 0xe21c, 0x7f8f, 0x6837, - 0xe21f, 0xe220, 0xe221, 0x6d96, 0x6d5c, 0x6e7c, 0x6f04, 0xe226, - 0xe227, 0xe228, 0x8533, 0xe22a, 0x51c7, 0x6c9c, 0x6e1d, 0x842e, - 0xe22f, 0x6e2f, 0xe231, 0x7453, 0xe233, 0x79cc, 0x6e4f, 0x5a91, - 0xe237, 0x6ff8, 0x370d, 0x6f9d, 0xe23b, 0x6efa, 0xe23d, 0xe23e, - 0x4555, 0x93f0, 0x6f44, 0x6f5c, 0x3d4e, 0x6f74, 0xe245, 0x3d3b, - 0x6f9f, 0xe248, 0x6fd3, 0xe24a, 0xe24b, 0xe24c, 0xe24d, 0xe24e, - 0xe24f, 0x51df, 0xe251, 0xe252, 0xe253, 0xe254, 0x704b, 0x707e, - 0x70a7, 0x7081, 0x70cc, 0x70d5, 0x70d6, 0x70df, 0x4104, 0x3de8, - 0x71b4, 0x7196, 0xe261, 0x712b, 0x7145, 0x5a88, 0x714a, 0x716e, - 0x5c9c, 0xe268, 0x714f, 0x9362, 0xe26b, 0x712c, 0xe26d, 0xe26e, - 0xe26f, 0x71ba, 0xe271, 0x70bd, 0x720e, - /* 0xfe */ - 0x9442, 0x7215, 0x5911, 0x9443, 0x7224, 0x9341, 0xe27a, 0x722e, - 0x7240, 0xe27d, 0x68bd, 0x7255, 0x7257, 0x3e55, 0xe282, 0x680d, - 0x6f3d, 0x7282, 0x732a, 0x732b, 0xe288, 0xe289, 0x48ed, 0xe28b, - 0x7328, 0x732e, 0x73cf, 0x73aa, 0xe290, 0xe291, 0x73c9, 0x7449, - 0xe294, 0xe295, 0xe296, 0x6623, 0x36c5, 0xe299, 0xe29a, 0xe29b, - 0x73f7, 0x7415, 0x6903, 0xe29f, 0x7439, 0xe2a1, 0x3ed7, 0x745c, - 0xe2a4, 0x7460, 0xe2a6, 0x7447, 0x73e4, 0x7476, 0x83b9, 0x746c, - 0x3730, 0x7474, 0x93f1, 0x6a2c, 0x7482, 0x4953, 0xe2b2, 0xe2b3, - 0xe2b4, 0xe2b5, 0x5b46, 0xe2b7, 0xe2b8, 0x74c8, 0xe2ba, 0x750e, - 0x74e9, 0x751e, 0xe2be, 0xe2bf, 0x5bd7, 0xe2c1, 0x9385, 0x754d, - 0x754a, 0x7567, 0x756e, 0xe2c7, 0x3f04, 0xe2c9, 0x758e, 0x745d, - 0x759e, 0x75b4, 0x7602, 0x762c, 0x7651, 0x764f, 0x766f, 0x7676, - 0xe2d4, 0x7690, 0x81ef, 0x37f8, 0xe2d8, 0xe2d9, 0x76a1, 0x76a5, - 0x76b7, 0x76cc, 0xe2de, 0x8462, 0xe2e0, 0xe2e1, 0xe2e2, 0x771e, - 0x7726, 0x7740, 0x64af, 0xe2e7, 0x7758, 0xe2e9, 0x77af, 0xe2eb, - 0xe2ec, 0xe2ed, 0x77f4, 0x7809, 0xe2f0, 0xe2f1, 0x68ca, 0x78af, - 0x78c7, 0x78d3, 0x96a5, 0x792e, 0xe2f8, 0x78d7, 0x7934, 0x78b1, - 0xe2fc, 0x8fb8, 0x8884, 0xe2ff, 0xe300, 0xe301, 0x7986, 0x8900, - 0x6902, 0x7980, 0xe306, 0x799d, 0xe308, 0x793c, 0x79a9, 0x6e2a, - 0xe30c, 0x3ea8, 0x79c6, 0xe30f, 0x79d4, -}; - -static int -big5hkscs_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = s[0]; - if ((c1 >= 0x81 && c1 <= 0xfe)) { - if (n >= 2) { - unsigned char c2 = s[1]; - if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { - unsigned int i = 157 * (c1 - 0x81) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); - unsigned short wc = 0xfffd; - { - if (i < 19782) - wc = big5hkscs_2uni_page81[i]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short big5hkscs_2charset[23202] = { - 0xa246, 0xa247, 0xa244, 0xa1b1, 0xc6d8, 0xa1c2, 0xa258, 0xa1d3, - 0xa1a6, 0xa367, 0xa150, 0xa14d, 0x8859, 0x8857, 0x885d, 0x885b, - 0x8866, 0x8861, 0x885f, 0xa1d1, 0x886a, 0x8868, 0x886f, 0x886d, - 0x88a7, 0x8873, 0x8871, 0x8877, 0x8875, 0xa1d2, 0xc8fb, 0x887b, - 0x8879, 0x88a2, 0x8856, 0x8867, 0x885a, 0x886c, 0x885c, 0x886e, - 0x8870, 0xc8fc, 0x885e, 0x8874, 0xc8fa, 0x8878, 0x8858, 0x8869, - 0x8872, 0x8860, 0x8876, 0x887a, 0x887c, 0x887d, 0x887e, 0x88a1, - 0xc8f6, 0x886b, 0xc8f8, 0xc8f7, 0x88a8, 0xc8fe, 0xc8f9, 0xc8f5, - 0xc8fd, 0xc6d9, 0xa3be, 0xa3bc, 0xa3bd, 0xa3bf, 0xa1c5, 0xa3bb, - 0xa1c2, 0xa344, 0xa345, 0xa346, 0xa347, 0xa348, 0xa349, 0xa34a, - 0xa34b, 0xa34c, 0xa34d, 0xa34e, 0xa34f, 0xa350, 0xa351, 0xa352, - 0xa353, 0xa354, 0xa355, 0xa356, 0xa357, 0xa358, 0xa359, 0xa35a, - 0xa35b, 0xa35c, 0xa35d, 0xa35e, 0xa35f, 0xa360, 0xa361, 0xa362, - 0xa363, 0xa364, 0xa365, 0xa366, 0xa367, 0xa368, 0xa369, 0xa36a, - 0xa36b, 0xa36c, 0xa36d, 0xa36e, 0xa36f, 0xa370, 0xa371, 0xa372, - 0xa373, 0xc7f9, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, - 0xc7fa, 0xc7fb, 0xc7fc, 0xc7fd, 0xc7fe, 0xc840, 0xc841, 0xc842, - 0xc843, 0xc844, 0xc845, 0xc846, 0xc847, 0xc848, 0xc849, 0xc84a, - 0xc84b, 0xc84c, 0xc84d, 0xc84e, 0xc84f, 0xc850, 0xc851, 0xc852, - 0xc853, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, 0xc85a, - 0xc85c, 0xc85d, 0xc85e, 0xc85f, 0xc860, 0xc861, 0xc862, 0xc863, - 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, 0xc86a, 0xc86b, - 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, 0xc871, 0xc872, 0xc873, - 0xc874, 0xc875, 0xc85b, 0x8863, 0x88a4, 0x8865, 0x88a6, 0xa156, - 0xa158, 0xa277, 0xa1fc, 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, 0xa145, - 0xa3bb, 0xa14c, 0xa14b, 0xa145, 0xa1ac, 0xa1b2, 0xa1ab, 0xa1b0, - 0xa1c3, 0xa24a, 0xa1c1, 0xa24b, 0xc8d2, 0xc8d3, 0xa2b9, 0xa2ba, - 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, 0xa2c1, 0xa2c2, - 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, 0xc6bc, - 0xc6bd, 0xc6be, 0xa1f6, 0xa1f4, 0xa1f7, 0xa1f5, 0xa1f8, 0xa1f9, - 0xa1fb, 0xa1fa, 0xc877, 0xc878, 0xc876, 0xa241, 0xa242, 0xa258, - 0xa1d4, 0xa1db, 0xa1e8, 0xa1e7, 0xa1fd, 0xa1fc, 0xa1e4, 0xa1e5, - 0xa1ec, 0xa1ed, 0xa1ef, 0xa1ee, 0xa1dc, 0xa1da, 0xa1dd, 0xa1dd, - 0xa1d8, 0xa1d9, 0xa1f2, 0xa1f3, 0xa1e6, 0xa1e9, 0xa15b, 0xc6a1, - 0xc6a2, 0xc6a3, 0xc6a4, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, - 0xc6aa, 0xc6ab, 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, - 0xc6b2, 0xc6b3, 0xc6b4, 0xa277, 0xa278, 0xa27a, 0xa27b, 0xa27c, - 0xa27d, 0xa275, 0xa274, 0xa273, 0xa272, 0xa271, 0xf9f9, 0xf9f8, - 0xf9e6, 0xf9ef, 0xf9dd, 0xf9e8, 0xf9f1, 0xf9df, 0xf9ec, 0xf9f5, - 0xf9e3, 0xf9ee, 0xf9f7, 0xf9e5, 0xf9e9, 0xf9f2, 0xf9e0, 0xf9eb, - 0xf9f4, 0xf9e2, 0xf9e7, 0xf9f0, 0xf9de, 0xf9ed, 0xf9f6, 0xf9e4, - 0xf9ea, 0xf9f3, 0xf9e1, 0xf9fa, 0xf9fb, 0xf9fd, 0xf9fc, 0xa2ac, - 0xa2ad, 0xa2ae, 0xa15a, 0xa262, 0xa263, 0xa264, 0xa265, 0xa266, - 0xa267, 0xa268, 0xa269, 0xa270, 0xa26f, 0xa26e, 0xa26d, 0xa26c, - 0xa26b, 0xa26a, 0xf9fe, 0xa276, 0xa279, 0xa1bd, 0xa1bc, 0xa1b6, - 0xa1b5, 0xa1bf, 0xa1be, 0xa1bb, 0xa1ba, 0xa1b3, 0xa1b7, 0xa1b4, - 0xa2a8, 0xa2a9, 0xa2ab, 0xa2aa, 0xa1b9, 0xa1b8, 0xa1f3, 0xa1f0, - 0xa1f2, 0xa1f1, 0xc6e6, 0xc8d6, 0xc8d7, 0xc8d8, 0xc8d9, 0xc8da, - 0xc8db, 0xc8dc, 0xc8dd, 0xc8de, 0xc8df, 0xc8e0, 0xc8e1, 0xc8e2, - 0xc8e3, 0xc8e4, 0xc8e5, 0xc8e6, 0xc8e7, 0xc8e8, 0xc8e9, 0xc8ea, - 0xc8eb, 0xc8ec, 0xc8ed, 0xc8ee, 0xc8ef, 0xc8f0, 0xc8f1, 0xc6cd, - 0xa140, 0xa142, 0xa143, 0xa1b2, 0xc6e0, 0xc6e1, 0xc6e2, 0xa171, - 0xa172, 0xa16d, 0xa16e, 0xa175, 0xa176, 0xa179, 0xa17a, 0xa169, - 0xa16a, 0xa245, 0xa165, 0xa166, 0xa1e3, 0xa1a9, 0xa1aa, 0xa2c3, - 0xa2c4, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, 0xa2c9, 0xa2ca, 0xa2cb, - 0xa1ca, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, 0xc6ec, 0xc6ed, - 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, 0xc6f4, 0xc6f5, - 0xc6f6, 0xc6f7, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, - 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, 0xc745, 0xc746, - 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, 0xc74d, 0xc74e, - 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, - 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, 0xc75d, 0xc75e, - 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, 0xc765, 0xc766, - 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, 0xc76d, 0xc76e, - 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, 0xc775, 0xc776, - 0xc777, 0xc778, 0xc779, 0xc77a, 0xc8d4, 0xc8d5, 0xc6dc, 0xc6dd, - 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, - 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, - 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc7b1, 0xc7b2, 0xc7b3, 0xc7b4, - 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, - 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, - 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, - 0xc7cd, 0xc7ce, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, - 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, - 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, - 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, - 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc6e3, 0xc6da, - 0xc6db, 0xa374, 0xa375, 0xa376, 0xa377, 0xa378, 0xa379, 0xa37a, - 0xa37b, 0xa37c, 0xa37d, 0xa37e, 0xa3a1, 0xa3a2, 0xa3a3, 0xa3a4, - 0xa3a5, 0xa3a6, 0xa3a7, 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, - 0xa3ad, 0xa3ae, 0xa3af, 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, - 0xa3b5, 0xa3b6, 0xa3b7, 0xa3b8, 0xa3b9, 0xa3ba, 0xa440, 0xa447, - 0xa454, 0xa57c, 0xa457, 0xa4a4, 0xa455, 0xa5d2, 0xa441, 0xa4fe, - 0xa442, 0xa4d1, 0xa661, 0xa448, 0xa440, 0xa447, 0xa454, 0xa57c, - 0xa4ad, 0xa4bb, 0xa443, 0xa44b, 0xa445, 0xa451, 0xa4eb, 0xa4f5, - 0xa4f4, 0xa4ec, 0xaaf7, 0xa467, 0xa4e9, 0xc8d1, 0xa6b3, 0xaac0, - 0xa657, 0xaf53, 0xb05d, 0xafac, 0xb3d2, 0xa54e, 0xa949, 0xbec7, - 0xbaca, 0xa5f8, 0xb8ea, 0xa8f3, 0xb2bd, 0xa5f0, 0xa6db, 0xa6dc, - 0xa440, 0xa447, 0xa454, 0xa57c, 0xa4ad, 0xa4bb, 0xa443, 0xa44b, - 0xa445, 0xa451, 0xa4eb, 0xa4f5, 0xa4f4, 0xa4ec, 0xaaf7, 0xa467, - 0xa4e9, 0xaee8, 0xa6b3, 0xaac0, 0xa657, 0xaf53, 0xb05d, 0xafac, - 0xb3d2, 0xafb5, 0xa86b, 0xa46b, 0xbe41, 0xc075, 0xa64c, 0xaa60, - 0xb6b5, 0xa5f0, 0xbc67, 0xa1c0, 0xa457, 0xa4a4, 0xa455, 0xa5aa, - 0xa56b, 0xc2e5, 0xa976, 0xbec7, 0xbaca, 0xa5f8, 0xb8ea, 0xa8f3, - 0xa95d, 0xa255, 0xa256, 0xa250, 0xa251, 0xa252, 0xa254, 0xa257, - 0xa253, 0xa1eb, 0xa1ea, 0xa24f, 0x9277, 0x96df, 0x89d5, 0x93cd, - 0x9bdf, 0xfa68, 0x89da, 0x8f59, 0x89db, 0x8f5d, 0x89dc, 0x96f7, - 0x8ada, 0x8bdc, 0x97db, 0x9e53, 0x9daa, 0x9bea, 0x8a6e, 0x8bc8, - 0x89e8, 0x89ea, 0x8c4b, 0xfb70, 0x89ed, 0x94dd, 0x89ee, 0x9eb4, - 0x8ad3, 0x92db, 0x94db, 0x89f9, 0xfb7a, 0x89fb, 0x9efc, 0x89fc, - 0x89bf, 0x89fe, 0x89e6, 0x9d46, 0x9dee, 0xa07e, 0xa068, 0x98e9, - 0x8b68, 0x8dfd, 0x8bbe, 0x9fd9, 0x8aeb, 0x9fd7, 0x8b6a, 0x9c5c, - 0x8bb1, 0xfb5e, 0x9df3, 0xa0d0, 0xfc66, 0x92e9, 0x9aec, 0x8fab, - 0xfa48, 0x8e45, 0x9c6f, 0x9ede, 0x89ef, 0x96e9, 0x9ebb, 0x94de, - 0x9eb8, 0x97ba, 0xfb65, 0x95d6, 0x9cbb, 0x97da, 0x8f45, 0xfb7d, - 0x9158, 0xfe64, 0x9856, 0x9b4d, 0x935b, 0x95c7, 0x97e7, 0x9359, - 0x91f5, 0x97b8, 0xfda2, 0xfbb6, 0x92fa, 0x9357, 0x8ba6, 0xfbb9, - 0x97b0, 0xfdc4, 0x9ca1, 0x91f2, 0x91f9, 0x8ff1, 0x9745, 0x9853, - 0xfe78, 0xfbc1, 0x9251, 0x9dad, 0xfd6c, 0xfa6b, 0x9bc2, 0x9a7b, - 0x8b60, 0x934b, 0x9abd, 0x91b7, 0x95b4, 0xfec5, 0x9ef0, 0x8d64, - 0x9269, 0x8d67, 0xfbea, 0xfbef, 0x8d68, 0x93eb, 0xfc42, 0x9166, - 0xfacd, 0x93dd, 0x8bcc, 0x8d6d, 0x8d6e, 0x96a8, 0xfca6, 0x8d6f, - 0x8d70, 0xfc64, 0x9060, 0x8d74, 0x97c3, 0x8ad0, 0x9274, 0x9bbe, - 0x9cc8, 0x9cba, 0x8d78, 0x9eb9, 0x955a, 0x91b4, 0x8a48, 0x8d7d, - 0x8a7d, 0x8ac2, 0xfd4a, 0x8da1, 0x8ad1, 0xfcb4, 0x8b47, 0x93a4, - 0x9eda, 0x8a51, 0x8da6, 0x9ec5, 0xfcc4, 0xa078, 0x94b5, 0xfcc2, - 0x8a6b, 0x8dab, 0xfae8, 0x8dad, 0xfc49, 0x93c1, 0x906f, 0x8db0, - 0x947e, 0x90fa, 0x9479, 0x8db2, 0xfcee, 0x997b, 0x8db4, 0x8db7, - 0x91b3, 0x8dbb, 0x8dba, 0x8dbc, 0x9044, 0xfd4c, 0x93e4, 0x93e0, - 0xfd53, 0x8dc3, 0x9bb8, 0xfbf0, 0x93e9, 0x93f6, 0x8dc5, 0x8dca, - 0x8dcc, 0xfd5d, 0x93b5, 0xfd61, 0x9cf8, 0x9252, 0xa0e8, 0x9ca5, - 0x8c56, 0x8dd6, 0x97c0, 0xa0de, 0x97d2, 0xfaa5, 0xfda3, 0x8ddb, - 0x8eaf, 0x91b5, 0xfd49, 0xfdd1, 0x8deb, 0x97c6, 0xfdce, 0x90fc, - 0xfc59, 0x96d6, 0x97c5, 0x8def, 0x97d7, 0x8df0, 0x96a6, 0xfbbf, - 0x8df3, 0x9449, 0x8df5, 0x9872, 0x8e6b, 0xfafd, 0x8f50, 0x9dcc, - 0xfc65, 0x8c44, 0x996e, 0x94a1, 0x8f63, 0xa0da, 0x9253, 0xfde9, - 0x9db5, 0x9879, 0x9d5d, 0x8d63, 0x9669, 0x9f70, 0xfc6a, 0x8ac7, - 0x89d7, 0xfe4d, 0x9edd, 0xfefb, 0x98bc, 0xfacc, 0x95b0, 0x9464, - 0x936f, 0x94b9, 0x95ec, 0x91ee, 0x98c3, 0x95f6, 0x8ffd, 0x98c5, - 0x9766, 0xfe6e, 0x97dd, 0x8caa, 0x92d2, 0x9761, 0x98cb, 0x95f0, - 0x975d, 0x91e3, 0x98cc, 0x9469, 0x98cd, 0x98ce, 0x95fc, 0x94a3, - 0x9662, 0xfeb6, 0x9463, 0x98d0, 0x98d1, 0x9475, 0xfae0, 0x9472, - 0x98d6, 0x8af0, 0x98d9, 0x98db, 0x98dd, 0x98a8, 0x8a6d, 0x8afb, - 0x8aae, 0xfbc9, 0x8c5d, 0x98e4, 0x98e6, 0x98e8, 0x8a4d, 0x9257, - 0x95df, 0xa0ac, 0x98eb, 0x98ec, 0x8cc3, 0x98f4, 0x8ab8, 0x9ee7, - 0x94bc, 0xfcd1, 0x9cc6, 0x9e7e, 0x98fe, 0xfde8, 0x9940, 0x94c9, - 0x94d3, 0x9946, 0x90c0, 0x94d1, 0x9573, 0x93c2, 0x9948, 0x994b, - 0x8e55, 0x994e, 0x8efe, 0x8e59, 0x94ec, 0x94ef, 0x8c60, 0x8f74, - 0x9955, 0x9544, 0x8ccb, 0x9956, 0x9959, 0x995b, 0x8cc4, 0xfa45, - 0x90b7, 0x9743, 0x95cd, 0x97c9, 0xfd50, 0x8eb9, 0x95c6, 0x9967, - 0x8ab9, 0x8dfc, 0x8a76, 0x9d51, 0x9973, 0x9d4f, 0x997a, 0x9564, - 0x99a1, 0x99a5, 0x99a7, 0x8eed, 0x99ad, 0x946e, 0x8f70, 0xfad0, - 0x99b3, 0xa053, 0x965c, 0xfd7a, 0x97fe, 0x92bd, 0x97fd, 0x8f64, - 0xfcf7, 0x9562, 0x97cd, 0x9e64, 0x924c, 0x8ec9, 0x99bc, 0x9da5, - 0x8f54, 0x8f7c, 0x8ea2, 0x8f7a, 0x97ae, 0x96c8, 0x99c3, 0x90d6, - 0x9cbe, 0x8f76, 0x9470, 0xfb4b, 0xfdca, 0x8ec7, 0xa0f9, 0x8fa9, - 0x99c7, 0x90d7, 0x9edf, 0x99ce, 0x8fba, 0x8feb, 0x99cf, 0x8fc2, - 0x92c9, 0x97dc, 0x95b3, 0x9c79, 0x95b2, 0x8fdb, 0x9be3, 0x9e7a, - 0x9bee, 0x99de, 0xfafa, 0x9ee5, 0x8a52, 0x99e1, 0x8a67, 0x8bb5, - 0x8aac, 0x99e9, 0xfbca, 0x97de, 0x95d1, 0x99f5, 0xfc4a, 0x9ba9, - 0xfbdc, 0xfe56, 0x9ea4, 0x9d49, 0x95db, 0x89c5, 0x99f8, 0x9664, - 0x9055, 0x96d4, 0x977c, 0x964d, 0x97e1, 0x9a48, 0x9a49, 0xfe7d, - 0x90aa, 0x9a50, 0x9347, 0x8ed8, 0x90c9, 0x9a55, 0x90bc, 0x9a58, - 0x8bb8, 0x90d5, 0x9641, 0x9a5a, 0x9a5c, 0x97c2, 0x8abb, 0x9baa, - 0x90f5, 0x9a60, 0x9145, 0x8c58, 0x9a63, 0x8c49, 0x8bb6, 0xfccf, - 0x966b, 0x9a6e, 0x914f, 0x9746, 0xa0e6, 0x92d7, 0x9675, 0x93d4, - 0x91bb, 0x9679, 0x9a70, 0x9678, 0x91cd, 0x9c4a, 0xa06f, 0xa06a, - 0x915f, 0x9fa5, 0x89ba, 0x9ecd, 0x9a79, 0x9dce, 0x8cd2, 0x9d73, - 0x96b9, 0x96bc, 0x9cd1, 0x89b7, 0x9eee, 0xfb43, 0x9ec9, 0xfbd3, - 0x91ae, 0x9d78, 0x9d7b, 0xa440, 0xa442, 0xa443, 0x9eb3, 0xc945, - 0xa456, 0xa454, 0xa457, 0xa455, 0xc946, 0xa4a3, 0xc94f, 0xc94d, - 0xa4a2, 0xa4a1, 0xa542, 0xa541, 0xa540, 0xa543, 0xa4fe, 0x9eb2, - 0x9dd6, 0xa5e0, 0xa5e1, 0x994f, 0x89ce, 0xa8c3, 0x8bc0, 0x9fc4, - 0xa458, 0x8bd4, 0xa4a4, 0xc950, 0x8c72, 0xa4a5, 0xc963, 0xa6ea, - 0xcbb1, 0xc6bf, 0x8bf9, 0xa459, 0xa4a6, 0xa544, 0xc964, 0x8946, - 0xc6c0, 0xc940, 0xa444, 0xa45b, 0xc947, 0xa45c, 0xfae5, 0xa4a7, - 0xa545, 0xa547, 0xa546, 0xa5e2, 0xa5e3, 0xa8c4, 0xadbc, 0xa441, - 0xc87b, 0x8bc6, 0xc941, 0xa445, 0xa45e, 0xa45d, 0xa5e4, 0x9c57, - 0xa8c5, 0x9afb, 0xb0ae, 0xd44b, 0x89d0, 0x89cf, 0xb6c3, 0xdcb1, - 0xdcb2, 0xc6c1, 0xa446, 0x89d1, 0xa4a9, 0x89e2, 0xa8c6, 0xa447, - 0xc948, 0xa45f, 0xa4aa, 0xa4ac, 0xc951, 0xa4ad, 0xa4ab, 0x927e, - 0xa5e5, 0x9dba, 0xa8c7, 0xa8c8, 0xab45, 0xc6c2, 0xa460, 0xa4ae, - 0x8c6f, 0xa5e6, 0xa5e8, 0xa5e7, 0xa6eb, 0xa8c9, 0xa8ca, 0xab46, - 0xab47, 0xadbd, 0xdcb3, 0xfbf8, 0xf6d6, 0xa448, 0x8bc7, 0x926b, - 0x89d2, 0xa4b0, 0xa4af, 0xc952, 0xa4b1, 0xa4b7, 0xa4b2, 0xa4b3, - 0xc954, 0xc953, 0xa4b5, 0xa4b6, 0xa4b4, 0x9fcf, 0xa54a, 0xa54b, - 0xa54c, 0xa54d, 0xa549, 0xa550, 0xc96a, 0xc966, 0xc969, 0xa551, - 0xa561, 0xc968, 0xa54e, 0xa54f, 0xa548, 0xc965, 0xc967, 0x9da9, - 0x89d3, 0x99e2, 0xa5f5, 0xc9b0, 0xa5f2, 0xa5f6, 0xc9ba, 0xc9ae, - 0xa5f3, 0xc9b2, 0x9267, 0xa5f4, 0xa5f7, 0xa5e9, 0xc9b1, 0xa5f8, - 0xc9b5, 0x92a4, 0xc9b9, 0xc9b6, 0xc9b3, 0xa5ea, 0xa5ec, 0xa5f9, - 0xa5ee, 0xc9ab, 0xa5f1, 0xa5ef, 0xa5f0, 0xc9bb, 0xc9b8, 0xc9af, - 0xa5ed, 0x8c73, 0xc9ac, 0xa5eb, 0x894e, 0xc9b4, 0xc9b7, 0x894f, - 0x9278, 0xc9ad, 0xca66, 0xa742, 0xa6f4, 0x91b6, 0xca67, 0xa6f1, - 0xa744, 0x89d4, 0xa6f9, 0x9fd2, 0xa6f8, 0xca5b, 0xa6fc, 0xa6f7, - 0xca60, 0xca68, 0xca64, 0x92a7, 0xa6fa, 0x95a2, 0xa6fd, 0xa6ee, - 0xa747, 0xca5d, 0x926e, 0xcbbd, 0xa6ec, 0xa743, 0xa6ed, 0xa6f5, - 0xa6f6, 0xca62, 0xca5e, 0xa6fb, 0xa6f3, 0xca5a, 0xa6ef, 0xca65, - 0xa745, 0xa748, 0xa6f2, 0xa740, 0xa746, 0xa6f0, 0xca63, 0xa741, - 0xca69, 0xca5c, 0xa6fe, 0xca5f, 0xca61, 0xa8d8, 0xcbbf, 0xcbcb, - 0xa8d0, 0xcbcc, 0xa8cb, 0xa8d5, 0x96ea, 0xa8ce, 0xcbb9, 0xa8d6, - 0xcbb8, 0xcbbc, 0xcbc3, 0xcbc1, 0xa8de, 0xa8d9, 0xcbb3, 0xcbb5, - 0xa8db, 0xa8cf, 0xcbb6, 0xcbc2, 0xcbc9, 0xa8d4, 0xcbbb, 0xcbb4, - 0xa8d3, 0xcbb7, 0xa8d7, 0xcbba, 0x926f, 0xa8d2, 0xa8cd, 0xa8dc, - 0xcbc4, 0xa8dd, 0xcbc8, 0xcbc6, 0xcbca, 0xa8da, 0xcbbe, 0xcbb2, - 0xcbc0, 0xa8d1, 0xcbc5, 0xa8cc, 0xcbc7, 0x92a3, 0x8950, 0xfa57, - 0xab56, 0xab4a, 0x9866, 0xcde0, 0xcde8, 0xab49, 0xab51, 0xab5d, - 0xcdee, 0xcdec, 0xcde7, 0x89d6, 0xab4b, 0xcded, 0xcde3, 0xab59, - 0xab50, 0xab58, 0xcdde, 0xcdea, 0x98b2, 0xcde1, 0xab54, 0xcde2, - 0x92ab, 0xcddd, 0xab5b, 0xab4e, 0xab57, 0xab4d, 0xcddf, 0xcde4, - 0xcdeb, 0xab55, 0xab52, 0xcde6, 0xab5a, 0xcde9, 0xcde5, 0xab4f, - 0xab5c, 0xab53, 0xab4c, 0xab48, 0x96de, 0x92ac, 0xcdef, 0xadd7, - 0xadc1, 0x8c70, 0xadd1, 0x9f6e, 0xadd6, 0xd0d0, 0xd0cf, 0xd0d4, - 0xd0d5, 0xadc4, 0x8ef2, 0xadcd, 0x9f6c, 0xadda, 0xadce, 0x89d8, - 0xd0c9, 0xadc7, 0xd0ca, 0xfa59, 0xaddc, 0xadd3, 0xadbe, 0xadbf, - 0xd0dd, 0xb0bf, 0xadcc, 0xadcb, 0xd0cb, 0xadcf, 0xd45b, 0xadc6, - 0xd0d6, 0xadd5, 0xadd4, 0xadca, 0xd0ce, 0xd0d7, 0xd0c8, 0xadc9, - 0xd0d8, 0xadd2, 0xd0cc, 0xadc0, 0xadc3, 0xadc2, 0xd0d9, 0xadd0, - 0xadc5, 0xadd9, 0xaddb, 0xd0d3, 0xadd8, 0x92a8, 0xd0db, 0xd0cd, - 0xd0dc, 0xd0d1, 0x9163, 0xd0da, 0xd0d2, 0x8c40, 0xadc8, 0xd463, - 0xd457, 0xb0b3, 0xd45c, 0xd462, 0xb0b2, 0xd455, 0xb0b6, 0xd459, - 0xd452, 0xb0b4, 0xd456, 0xb0b9, 0xb0be, 0xd467, 0xd451, 0xb0ba, - 0x9f73, 0xd466, 0x92ad, 0xb0b5, 0xd458, 0xb0b1, 0xd453, 0xd44f, - 0xd45d, 0xd450, 0xd44e, 0xd45a, 0xd460, 0xd461, 0xb0b7, 0x9be9, - 0xd85b, 0xd45e, 0xd44d, 0xd45f, 0x92a9, 0xb0c1, 0xd464, 0xb0c0, - 0xd44c, 0xd454, 0xd465, 0xb0bc, 0xb0bb, 0xb0b8, 0xb0bd, 0xb0af, - 0xb0b0, 0xb3c8, 0x92aa, 0xd85e, 0xd857, 0xb3c5, 0xd85f, 0x89d9, - 0xd855, 0xd858, 0xb3c4, 0xd859, 0xfd56, 0xb3c7, 0xd85d, 0xd853, - 0xd852, 0xb3c9, 0xb3ca, 0xb3c6, 0xb3cb, 0xd851, 0xd85c, 0xd85a, - 0xd854, 0xb3c3, 0xd856, 0x9fa8, 0xb6ca, 0xb6c4, 0xdcb7, 0xb6cd, - 0xdcbd, 0xdcc0, 0xb6c6, 0xb6c7, 0xdcba, 0xb6c5, 0xdcc3, 0xb6cb, - 0xdcc4, 0xdcbf, 0xb6cc, 0x8c71, 0xdcb4, 0xb6c9, 0xdcb5, 0xdcbe, - 0xdcbc, 0xdcb8, 0xb6c8, 0xdcb6, 0xb6ce, 0xdcbb, 0xdcc2, 0xdcb9, - 0xdcc1, 0x92a1, 0xb9b6, 0xb9b3, 0x90e3, 0xb9b4, 0xe0f9, 0xe0f1, - 0xb9b2, 0xb9af, 0xe0f2, 0xa0a6, 0xb9b1, 0xe0f5, 0xe0f7, 0x94ab, - 0xe0fe, 0xfc72, 0xe0fd, 0xe0f8, 0xb9ae, 0xe0f0, 0xb9ac, 0xe0f3, - 0xb9b7, 0xe0f6, 0xe0fa, 0xb9b0, 0xb9ad, 0xe0fc, 0xe0fb, 0xb9b5, - 0xe0f4, 0x97c4, 0xbbf8, 0xe4ec, 0xe4e9, 0xbbf9, 0xbbf7, 0x92ae, - 0xe4f0, 0xe4ed, 0xe4e6, 0xbbf6, 0xfa67, 0xbbfa, 0xe4e7, 0xbbf5, - 0xbbfd, 0xe4ea, 0xe4eb, 0xbbfb, 0xbbfc, 0xe4f1, 0xe4ee, 0xe4ef, - 0x92a2, 0xfa69, 0xbeaa, 0xe8f8, 0xbea7, 0xe8f5, 0xbea9, 0xbeab, - 0xe8f6, 0xbea8, 0xe8f7, 0xe8f4, 0xc076, 0xecbd, 0xc077, 0xecbb, - 0xecbc, 0xecba, 0xecb9, 0xecbe, 0xc075, 0x9268, 0xefb8, 0xefb9, - 0xe4e8, 0xefb7, 0xc078, 0xc35f, 0xf1eb, 0xf1ec, 0xc4d7, 0xc4d8, - 0xf5c1, 0xf5c0, 0xc56c, 0xc56b, 0xf7d0, 0xa449, 0xa461, 0xa4b9, - 0xa4b8, 0xa553, 0xa552, 0xa5fc, 0xa5fb, 0xa5fd, 0xa5fa, 0xa74a, - 0xa749, 0xa74b, 0xa8e0, 0xa8df, 0xa8e1, 0x8951, 0xab5e, 0xa259, - 0xd0de, 0xa25a, 0xb0c2, 0xa25c, 0xa25b, 0xd860, 0xfa6f, 0xa25d, - 0xb9b8, 0xa25e, 0xa44a, 0xa4ba, 0xa5fe, 0xa8e2, 0xfa71, 0xa44b, - 0xa4bd, 0xa4bb, 0xa4bc, 0xa640, 0x8952, 0xa74c, 0xa8e4, 0xa8e3, - 0xa8e5, 0x945a, 0xaddd, 0xbeac, 0xc6c3, 0x89dd, 0xc94e, 0xc8a2, - 0xa554, 0xa555, 0xa641, 0xca6a, 0xab60, 0xab5f, 0xd0e0, 0xd0df, - 0xb0c3, 0xc6c4, 0xa4be, 0xc955, 0x9e52, 0x8953, 0xcbcd, 0xab61, - 0xade0, 0xadde, 0xaddf, 0x9e55, 0x92ba, 0xbead, 0xc6c5, 0xa556, - 0x8c5b, 0xa642, 0xc9bc, 0xfa7d, 0xfaa8, 0x9a68, 0xfa47, 0xa74d, - 0xa74e, 0xfa7e, 0xca6b, 0xcbce, 0xa8e6, 0xcbcf, 0x92bb, 0xd0e2, - 0xd0e3, 0xade3, 0xfdb6, 0xd0e4, 0xfaa2, 0xd0e1, 0xade4, 0xade2, - 0xade1, 0xd0e5, 0xfaa3, 0xd468, 0xfaa4, 0x9bb4, 0xfaa6, 0xd861, - 0xdcc5, 0xe140, 0x89df, 0xbbfe, 0xbeae, 0xe8f9, 0xfddb, 0xa44c, - 0xa45a, 0xfaa9, 0x8954, 0xfaab, 0xb0c4, 0xb3cd, 0xb9b9, 0xfc7a, - 0xc942, 0xa4bf, 0xa559, 0xa557, 0xa558, 0x89e0, 0xa8e7, 0x9f4f, - 0xa44d, 0xa44e, 0xc87d, 0xa462, 0x89e1, 0xa4c0, 0xa4c1, 0xa4c2, - 0xc9be, 0xa55a, 0xfab0, 0xc96b, 0xa646, 0xc9bf, 0xa644, 0xa645, - 0xc9bd, 0xa647, 0xa643, 0xca6c, 0xaaec, 0xca6d, 0x9fcd, 0xa0e7, - 0xca6e, 0xa750, 0xa74f, 0xfab1, 0x89a6, 0xa753, 0xa751, 0xa752, - 0xa8ed, 0xa8ec, 0xcbd4, 0xcbd1, 0xcbd2, 0x9efa, 0xcbd0, 0xa8ee, - 0xa8ea, 0xa8e9, 0xa8eb, 0xa8e8, 0xfab2, 0xa8ef, 0xab63, 0xcdf0, - 0xcbd3, 0xab68, 0xcdf1, 0xab64, 0xab67, 0xab66, 0xab65, 0xab62, - 0xd0e8, 0xade7, 0xd0eb, 0xade5, 0xfab4, 0x92c4, 0xd0e7, 0xade8, - 0xade6, 0xade9, 0xd0e9, 0xd0ea, 0x9f6f, 0xd0e6, 0xd0ec, 0x8bb0, - 0xb3d1, 0xb0c5, 0xd469, 0xd46b, 0xd46a, 0xd46c, 0xb0c6, 0xb3ce, - 0x9fac, 0xb3cf, 0xb3d0, 0xb6d0, 0xdcc7, 0x89e3, 0xdcc6, 0xdcc8, - 0xdcc9, 0xb6d1, 0xb6cf, 0xe141, 0xe142, 0xb9bb, 0xb9ba, 0xe35a, - 0xbc40, 0xbc41, 0xbc42, 0xbc44, 0xe4f2, 0xe4f3, 0xbc43, 0x9bd3, - 0x89e4, 0xbeaf, 0xbeb0, 0xfab5, 0xf1ed, 0xf5c3, 0xf5c2, 0xf7d1, - 0x9fd5, 0xa44f, 0xa55c, 0xa55b, 0x8955, 0xa648, 0x92c5, 0xc9c0, - 0x8956, 0xa755, 0xa756, 0xa754, 0xa757, 0xca6f, 0xca70, 0xfab3, - 0xfab6, 0xa8f1, 0xcbd5, 0xa8f0, 0xcdf2, 0xab6c, 0xcdf3, 0xab6b, - 0xfab7, 0xab69, 0xab6a, 0x9edc, 0xd0ed, 0xfbc4, 0x9f71, 0xb0c7, - 0xd46e, 0xb0ca, 0xd46d, 0xb1e5, 0xb0c9, 0xb0c8, 0xb3d4, 0xb3d3, - 0xb3d2, 0xb6d2, 0xfaba, 0x92c7, 0xb6d5, 0xb6d6, 0xb6d4, 0xb6d3, - 0xe143, 0xe144, 0xe4f5, 0xbc45, 0xe4f4, 0xbeb1, 0xecbf, 0xc079, - 0xf1ee, 0xc455, 0xc6c6, 0xa463, 0xa4c3, 0xc956, 0xa4c4, 0xa4c5, - 0x9a4c, 0xa55d, 0xa55e, 0xa649, 0xca71, 0xcbd6, 0xcbd7, 0xab6d, - 0xd0ee, 0xb0cc, 0xb0cb, 0xd863, 0xd862, 0xa450, 0xa4c6, 0xa55f, - 0xb0cd, 0xc943, 0xc96c, 0xa560, 0xc9c2, 0xa64b, 0xa64a, 0xc9c1, - 0xa758, 0x8c68, 0x89e5, 0xadea, 0x9f7d, 0xd46f, 0xb6d7, 0xe145, - 0xb9bc, 0xa0a9, 0xfac4, 0xe8fa, 0xf3fd, 0xc6c7, 0xa4c7, 0x8957, - 0xcbd8, 0xcdf4, 0xb0d0, 0xb0ce, 0xb0cf, 0xa451, 0xfaaa, 0xa464, - 0xa2cd, 0xa4ca, 0xa4c9, 0xa4c8, 0xa563, 0xa562, 0xc96d, 0xc9c3, - 0x8958, 0xa8f5, 0xa8f2, 0xa8f4, 0xa8f3, 0xab6e, 0xb3d5, 0xa452, - 0x8be3, 0xa4cb, 0x8b61, 0xa565, 0xa564, 0xca72, 0x9af1, 0xa8f6, - 0x9eb7, 0xc6c8, 0xc957, 0xfad1, 0xa567, 0xa566, 0xa64c, 0xa64d, - 0xca73, 0xa759, 0xfad2, 0xa75a, 0xa8f7, 0xa8f8, 0xa8f9, 0xab6f, - 0xcdf5, 0x9eba, 0xfad4, 0xadeb, 0xc944, 0xa4cc, 0xc9c4, 0xca74, - 0xca75, 0xcbd9, 0xfad9, 0xcbda, 0xcdf7, 0xcdf6, 0xcdf9, 0xcdf8, - 0xab70, 0xd470, 0xaded, 0xd0ef, 0xadec, 0xfadb, 0x9ce0, 0xd864, - 0xb3d6, 0xfbf7, 0xd865, 0xfbfa, 0x89e7, 0xa07a, 0xfadc, 0xe146, - 0xb9bd, 0xfadd, 0x89e9, 0xbc46, 0xf1ef, 0xc6c9, 0xc958, 0xa568, - 0xfae2, 0x89eb, 0xb0d1, 0xfae3, 0xa453, 0xa465, 0xa4ce, 0xa4cd, - 0x90c8, 0xa4cf, 0x92da, 0x8959, 0x9cf5, 0xa8fb, 0xa8fa, 0xa8fc, - 0x895a, 0xfae7, 0x9fa2, 0xab71, 0xadee, 0xfaea, 0xe8fb, 0xc24f, - 0xa466, 0xa56a, 0xa579, 0xa574, 0xa56f, 0xa56e, 0xa575, 0xa573, - 0xa56c, 0xa57a, 0xa56d, 0xa569, 0xa578, 0xa577, 0xa576, 0xa56b, - 0xa572, 0xfaed, 0x8fad, 0xa571, 0xa57b, 0xa570, 0xfb59, 0xa653, - 0xa659, 0xa655, 0xa65b, 0xc9c5, 0xa658, 0xa64e, 0xa651, 0xa654, - 0xa650, 0xa657, 0xa65a, 0xa64f, 0xa652, 0xa656, 0xa65c, 0xfaef, - 0x96ef, 0x9dec, 0xca7e, 0xca7b, 0x9dca, 0xa767, 0xca7c, 0xa75b, - 0xa75d, 0xa775, 0xa770, 0xfd6d, 0x89ec, 0xcaa5, 0xca7d, 0xa75f, - 0xa761, 0xcaa4, 0xa768, 0xca78, 0xa774, 0xa776, 0xa75c, 0xa76d, - 0xfb44, 0xca76, 0xa773, 0x9de2, 0xa764, 0x8c75, 0xa76e, 0xa76f, - 0xca77, 0xa76c, 0xa76a, 0xa76b, 0xa771, 0xcaa1, 0xa75e, 0xa772, - 0xcaa3, 0xa766, 0xa763, 0xca7a, 0xa762, 0xcaa6, 0xa765, 0xa769, - 0x9ec0, 0x9e56, 0xa760, 0xcaa2, 0xca79, 0xcbeb, 0xcbea, 0xa94f, - 0xcbed, 0xcbef, 0xcbe4, 0xcbe7, 0xcbee, 0xa950, 0x9f79, 0x9ac7, - 0xcbe1, 0xcbe5, 0xfaf4, 0xcbe9, 0xce49, 0xa94b, 0xce4d, 0xa8fd, - 0xcbe6, 0xa8fe, 0xa94c, 0xa945, 0xa941, 0xcbe2, 0xa944, 0xa949, - 0xa952, 0xcbe3, 0xcbdc, 0xa943, 0xcbdd, 0xcbdf, 0xa946, 0x98a1, - 0xa948, 0xcbdb, 0xcbe0, 0xa951, 0xa94d, 0xcbe8, 0xa953, 0xfaf8, - 0xa94a, 0xcbde, 0xa947, 0x89f0, 0x9e47, 0xa942, 0xa940, 0x9df7, - 0xcbec, 0xa94e, 0x9fd3, 0x9aca, 0xce48, 0xcdfb, 0xce4b, 0x89f1, - 0xfaf9, 0xcdfd, 0xab78, 0xaba8, 0xab74, 0xaba7, 0xab7d, 0xaba4, - 0xab72, 0xcdfc, 0xce43, 0xaba3, 0xce4f, 0xaba5, 0x8e5a, 0xab79, - 0x89f2, 0xce45, 0xce42, 0xab77, 0x89f3, 0xcdfa, 0xaba6, 0xce4a, - 0xab7c, 0xce4c, 0xaba9, 0xab73, 0xab7e, 0xab7b, 0xce40, 0xaba1, - 0xce46, 0xce47, 0xab7a, 0xaba2, 0xab76, 0x925d, 0x8b51, 0x92e0, - 0xab75, 0xcdfe, 0x89f4, 0xce44, 0x9fd4, 0xce4e, 0xd144, 0xadfb, - 0xd0f1, 0x8a79, 0xd0f6, 0xadf4, 0xae40, 0xd0f4, 0xadef, 0xadf9, - 0xadfe, 0xd0fb, 0xadfa, 0xadfd, 0x89f5, 0xd0fe, 0xadf5, 0xd0f5, - 0xd142, 0xd143, 0xadf7, 0xd141, 0xadf3, 0xae43, 0xd0f8, 0xadf1, - 0x97a7, 0xd146, 0xd0f9, 0xd0fd, 0xadf6, 0xae42, 0xd0fa, 0xadfc, - 0xd140, 0xd147, 0xd4a1, 0x93ba, 0xd145, 0xae44, 0xadf0, 0xd0fc, - 0xd0f3, 0x9e58, 0xadf8, 0xd0f2, 0x89f6, 0xd0f7, 0x9e57, 0x89f7, - 0x8a41, 0xd0f0, 0xae41, 0x89f8, 0xd477, 0xfaf1, 0xb0e4, 0xd4a7, - 0xb0e2, 0xb0df, 0xd47c, 0xb0db, 0xd4a2, 0xb0e6, 0xd476, 0xd47b, - 0xd47a, 0xadf2, 0xb0e1, 0xd4a5, 0xd4a8, 0xd473, 0xb3e8, 0x89fa, - 0xd4a9, 0xb0e7, 0xb0d9, 0xb0d6, 0xd47e, 0xb0d3, 0xfb42, 0xd4a6, - 0xfabf, 0xb0da, 0xd4aa, 0xd474, 0xd4a4, 0xb0dd, 0xd475, 0xd478, - 0xd47d, 0xfba3, 0xb0de, 0xb0dc, 0xb0e8, 0xb0e3, 0xfaf7, 0xb0d7, - 0xb1d2, 0xb0d8, 0xd479, 0xb0e5, 0xb0e0, 0xd4a3, 0xb0d5, 0x9e4e, - 0xb0d4, 0x94dc, 0x95da, 0x9df8, 0x9f6a, 0xd471, 0xd472, 0xd86a, - 0x8ab7, 0xb3d7, 0xb3da, 0xd875, 0xb3ee, 0xd878, 0xb3d8, 0xd871, - 0xb3de, 0xb3e4, 0xb5bd, 0xfb46, 0xb3e2, 0xd86e, 0xb3ef, 0xb3db, - 0xb3e3, 0xd876, 0xdcd7, 0xd87b, 0xd86f, 0x8a46, 0xd866, 0xd873, - 0xd86d, 0xb3e1, 0xd879, 0xb3dd, 0xb3f1, 0xb3ea, 0xb3df, 0xb3dc, - 0xb3e7, 0xd87a, 0xd86c, 0xd872, 0xd874, 0xd868, 0xd877, 0xb3d9, - 0xd867, 0xfb47, 0xb3e0, 0xb3f0, 0xb3ec, 0xd869, 0xb3e6, 0x9148, - 0xb3ed, 0xb3e9, 0xb3e5, 0x92de, 0xd870, 0x8b53, 0x9df6, 0xb3eb, - 0x9bda, 0xdcd5, 0xdcd1, 0x9d7e, 0xdce0, 0xdcca, 0xdcd3, 0xb6e5, - 0xb6e6, 0xb6de, 0xdcdc, 0xb6e8, 0xdccf, 0xdcce, 0xdccc, 0xdcde, - 0xb6dc, 0xdcd8, 0xdccd, 0xb6df, 0xdcd6, 0xb6da, 0xdcd2, 0xdcd9, - 0xdcdb, 0x89fd, 0x99e4, 0xdcdf, 0xb6e3, 0xdccb, 0xb6dd, 0xdcd0, - 0x9e43, 0xb6d8, 0xb6e4, 0xdcda, 0xb6e0, 0xb6e1, 0xb6e7, 0xb6db, - 0xa25f, 0xb6d9, 0xdcd4, 0x9de9, 0x8f52, 0xb6e2, 0x9df5, 0x9df0, - 0xdcdd, 0x99e7, 0xb9cd, 0xb9c8, 0xe155, 0xe151, 0x8bbd, 0xe14b, - 0xb9c2, 0xb9be, 0xe154, 0xb9bf, 0xe14e, 0xe150, 0xe153, 0x9def, - 0xb9c4, 0xb9cb, 0xb9c5, 0xe149, 0xb9c6, 0xb9c7, 0xe14c, 0xb9cc, - 0x9fb7, 0xe14a, 0xe14f, 0xb9c3, 0xe148, 0xb9c9, 0xb9c1, 0xb9c0, - 0xe14d, 0xe152, 0x9dd0, 0xb9ca, 0x9feb, 0x8da9, 0x9dcf, 0x98e1, - 0x9de5, 0xe147, 0xbc4d, 0xe547, 0xe544, 0x9dc8, 0xbc47, 0xbc53, - 0xbc54, 0xbc4a, 0xe542, 0xbc4c, 0xe4f9, 0xbc52, 0xfb4f, 0xe546, - 0xbc49, 0xe548, 0xbc48, 0xe543, 0xe545, 0xbc4b, 0xe541, 0xe4fa, - 0xe4f7, 0x9deb, 0xd86b, 0xe4fd, 0xe4f6, 0xe4fc, 0xe4fb, 0xe4f8, - 0xfb54, 0xbc4f, 0xfb55, 0x9aa2, 0x8ad6, 0xbc4e, 0x9a5f, 0xbc50, - 0xe4fe, 0xbeb2, 0xe540, 0x9ef5, 0xe945, 0xe8fd, 0x8fb7, 0xbebe, - 0xe942, 0xbeb6, 0xbeba, 0xe941, 0xbeb9, 0xbeb5, 0xbeb8, 0xbeb3, - 0xbebd, 0xe943, 0xe8fe, 0xbebc, 0xe8fc, 0xbebb, 0xe944, 0xe940, - 0xbc51, 0xbebf, 0xe946, 0xbeb7, 0xbeb4, 0x9ad2, 0x9e6a, 0x9ee8, - 0xecc6, 0xecc8, 0xc07b, 0xecc9, 0xecc7, 0xecc5, 0xecc4, 0xc07d, - 0xecc3, 0xc07e, 0x8bbf, 0x91c2, 0x9d62, 0xecc1, 0xecc2, 0xc07a, - 0xc0a1, 0xc07c, 0x9260, 0xecc0, 0xc250, 0xefbc, 0xefba, 0xefbf, - 0xefbd, 0xefbb, 0xefbe, 0x925e, 0x91c1, 0x8ac5, 0x97a3, 0xc360, - 0xf1f2, 0xf1f3, 0xc456, 0xf1f4, 0xf1f0, 0xf1f5, 0xf1f1, 0xc251, - 0x8b6c, 0x8d7e, 0xf3fe, 0xf441, 0xc459, 0xf440, 0xc458, 0xc457, - 0x9c54, 0xc45a, 0xf5c5, 0xf5c6, 0x9dbd, 0xc4da, 0xc4d9, 0xc4db, - 0xf5c4, 0xf6d8, 0xf6d7, 0xc56d, 0xc56f, 0xc56e, 0xf6d9, 0xc5c8, - 0xf8a6, 0xc5f1, 0xf8a5, 0xf8ee, 0x9cc5, 0xc949, 0xa57d, 0xa57c, - 0xa65f, 0xa65e, 0xc9c7, 0xa65d, 0xc9c6, 0x895b, 0xa779, 0xcaa9, - 0xcaa8, 0xa777, 0xa77a, 0xfb5c, 0xcaa7, 0xfb5b, 0xa778, 0xfb57, - 0xcbf0, 0xcbf1, 0xa954, 0x98c7, 0xabaa, 0xfb5a, 0xd148, 0xd149, - 0xae45, 0xae46, 0xd4ac, 0xb0e9, 0xb0eb, 0xd4ab, 0xb0ea, 0xd87c, - 0xb3f2, 0xb6e9, 0xb6ea, 0xdce1, 0x9cee, 0xb9cf, 0xb9ce, 0xe549, - 0xe948, 0xe947, 0x92e2, 0xf96b, 0xa467, 0xc959, 0xc96e, 0xc96f, - 0xa662, 0xa666, 0xc9c9, 0xa664, 0xa663, 0xc9c8, 0xa665, 0xa661, - 0x94a7, 0xa660, 0xc9ca, 0xa7a6, 0x8ccc, 0xa7a3, 0x9bd4, 0xa77d, - 0xcaaa, 0xfb64, 0xfb76, 0xcaab, 0xfb60, 0xa7a1, 0xcaad, 0xa77b, - 0xcaae, 0xcaac, 0xa77e, 0xa7a2, 0xa7a5, 0xa7a4, 0xa77c, 0xcaaf, - 0x99e5, 0x9ac2, 0x91fb, 0xa073, 0xa959, 0xcbfe, 0xa95b, 0xa95a, - 0x9f72, 0xcc40, 0xa958, 0xa957, 0xcbf5, 0xcbf4, 0xcbf2, 0xcbf7, - 0xcbf6, 0xcbf3, 0xcbfc, 0xcbfd, 0xcbfa, 0xcbf8, 0xa956, 0x9fcc, - 0xcbfb, 0xa95c, 0xcc41, 0x98a5, 0x92e8, 0xcbf9, 0xabab, 0xa955, - 0x9bbc, 0x96f3, 0xabac, 0xce54, 0x92e7, 0xce5a, 0xfc67, 0xabb2, - 0xce58, 0xce5e, 0xce55, 0xce59, 0xce5b, 0xce5d, 0xce57, 0x8b7d, - 0xce56, 0xce51, 0xce52, 0xabad, 0x9bf4, 0xabaf, 0xabae, 0xce53, - 0xce5c, 0x9ef7, 0x9ec1, 0xabb1, 0x996f, 0xce50, 0xd153, 0xd152, - 0xd157, 0xd14e, 0x96f1, 0xd151, 0xd150, 0x8e41, 0xd154, 0xd158, - 0xae47, 0xae4a, 0x954a, 0xd14f, 0xd155, 0x97e6, 0xae49, 0xd14a, - 0xabb0, 0xd4ba, 0xd156, 0xd14d, 0xae48, 0xd14c, 0x96f5, 0xd4b1, - 0x92e6, 0x9f42, 0xb0ec, 0xb0f0, 0xd4c1, 0xd4af, 0xd4bd, 0xb0f1, - 0xd4bf, 0xfb67, 0xd4c5, 0xd4c9, 0xd4c0, 0xd4b4, 0xd4bc, 0x99a9, - 0xd4ca, 0xd4c8, 0xd4be, 0xd4b9, 0xd4b2, 0xd8a6, 0xd4b0, 0xb0f5, - 0xd4b7, 0xb0f6, 0xb0f2, 0xd4ad, 0xd4c3, 0xd4b5, 0xfae6, 0xd4b3, - 0xd4c6, 0xb0f3, 0xfb69, 0xd4cc, 0xb0ed, 0xb0ef, 0xd4bb, 0xd4b6, - 0xae4b, 0xb0ee, 0xd4b8, 0xd4c7, 0xd4cb, 0xd4c2, 0xd4c4, 0x97e5, - 0xd4ae, 0xd8a1, 0xd8aa, 0xd8a9, 0xb3fa, 0xd8a2, 0xb3fb, 0xb3f9, - 0x967d, 0xd8a4, 0xb3f6, 0xd8a8, 0xfb6c, 0xd8a3, 0xd8a5, 0xd87d, - 0xb3f4, 0xd8b2, 0xd8b1, 0xd8ae, 0xb3f3, 0xb3f7, 0xb3f8, 0xd14b, - 0xd8ab, 0xb3f5, 0xb0f4, 0xd8ad, 0xd87e, 0xd8b0, 0xd8af, 0x99a2, - 0xd8b3, 0xdcef, 0xd8ac, 0x9abb, 0x9a65, 0x944e, 0xd8a7, 0xdce7, - 0xb6f4, 0xb6f7, 0xb6f2, 0xdce6, 0xdcea, 0xdce5, 0xb6ec, 0xb6f6, - 0xdce2, 0xb6f0, 0xdce9, 0xb6ee, 0xb6ed, 0xdcec, 0xb6ef, 0xdcee, - 0xfb6e, 0xdceb, 0xb6eb, 0x99df, 0xb6f5, 0xdcf0, 0xdce4, 0xdced, - 0xdce3, 0x98e3, 0xb6f1, 0x9254, 0xb6f3, 0xdce8, 0xdcf1, 0x967b, - 0x8aaf, 0xe15d, 0xb9d0, 0xe163, 0xb9d5, 0xe15f, 0xe166, 0xe157, - 0xb9d7, 0xb9d1, 0xe15c, 0xbc55, 0xe15b, 0xe164, 0xb9d2, 0xb9d6, - 0xe15a, 0xe160, 0xe165, 0xe156, 0xb9d4, 0xe15e, 0xe162, 0xe168, - 0xe158, 0xe161, 0x8c77, 0xb9d3, 0xe167, 0xe159, 0x8baf, 0x9ebd, - 0xbc59, 0xe54b, 0xbc57, 0xbc56, 0xe54d, 0xe552, 0xe54e, 0xe551, - 0xbc5c, 0x9ee6, 0xbea5, 0xbc5b, 0xfb6f, 0xe54a, 0xe550, 0xbc5a, - 0xe54f, 0x8ee1, 0xe54c, 0xbc58, 0x9b7d, 0x9c7e, 0xe94d, 0xf9d9, - 0xe94f, 0xe94a, 0xbec1, 0xe94c, 0xbec0, 0xe94e, 0xbec3, 0xe950, - 0xbec2, 0xe949, 0xe94b, 0x92ea, 0xc0a5, 0xeccc, 0x8c78, 0xc0a4, - 0xeccd, 0xc0a3, 0xeccb, 0xc0a2, 0xecca, 0xc253, 0xc252, 0xf1f6, - 0xf1f8, 0xfb72, 0xf1f7, 0xc361, 0xc362, 0xfb71, 0xc363, 0xf442, - 0xc45b, 0xf7d3, 0xf7d2, 0xc5f2, 0xa468, 0xa4d0, 0xa7a7, 0x895c, - 0x98f0, 0x96f2, 0xce5f, 0xb3fc, 0xb3fd, 0xfb74, 0xdcf2, 0xb9d8, - 0xe169, 0xe553, 0x8bc1, 0xc95a, 0x895d, 0x89de, 0xcab0, 0x895e, - 0xc6ca, 0xcc42, 0xce60, 0xd159, 0xae4c, 0xfe42, 0xf1f9, 0xc4dc, - 0xa469, 0xa57e, 0xc970, 0xa667, 0xa668, 0xa95d, 0xfb7b, 0xb0f7, - 0xb9da, 0xb9db, 0xb9d9, 0xa46a, 0xa4d1, 0xa4d3, 0xa4d2, 0xc95b, - 0xa4d4, 0xa5a1, 0xc971, 0xa5a2, 0x895f, 0x8960, 0xa669, 0xa66a, - 0xc9cb, 0xa7a8, 0xcab1, 0xa961, 0xcc43, 0xa95f, 0xa960, 0xa95e, - 0xd15a, 0xabb6, 0xabb5, 0xabb7, 0xabb4, 0xce61, 0xa962, 0xabb3, - 0xae4d, 0xae4e, 0xae4f, 0xd4cd, 0xb3fe, 0xd8b4, 0xb0f8, 0x9bcd, - 0xb6f8, 0xb9dd, 0xb9dc, 0xe16a, 0xbc5d, 0xbec4, 0xefc0, 0xf6da, - 0xf7d4, 0xa46b, 0xa5a3, 0x9dd3, 0xa5a4, 0xc9d1, 0xa66c, 0xa66f, - 0xc9cf, 0xc9cd, 0xa66e, 0xc9d0, 0xc9d2, 0xc9cc, 0xa671, 0xa670, - 0xa66d, 0xa66b, 0xc9ce, 0x984c, 0xa7b3, 0xa7b0, 0xcab6, 0xcab9, - 0xcab8, 0xa7aa, 0xa7b2, 0x9752, 0xa7af, 0xcab5, 0xcab3, 0xa7ae, - 0x95c3, 0xa7a9, 0xa7ac, 0x9bb6, 0xcab4, 0xcabb, 0xcab7, 0xa7ad, - 0xa7b1, 0xa7b4, 0xcab2, 0xcaba, 0xa7ab, 0x9ab9, 0xa967, 0xa96f, - 0x97b3, 0xcc4f, 0xcc48, 0xa970, 0xcc53, 0xcc44, 0xcc4b, 0x9f74, - 0x92f1, 0xa966, 0xcc45, 0xa964, 0xcc4c, 0xcc50, 0xa963, 0xcc51, - 0xcc4a, 0xcc4d, 0x97df, 0xa972, 0xa969, 0xcc54, 0xcc52, 0xfba6, - 0xa96e, 0xa96c, 0xcc49, 0xa96b, 0xcc47, 0xcc46, 0xa96a, 0xa968, - 0xa971, 0xa96d, 0xa965, 0xcc4e, 0xabb9, 0xfbab, 0xabc0, 0xce6f, - 0xabb8, 0xce67, 0xce63, 0xce73, 0xce62, 0xabbb, 0xce6c, 0xabbe, - 0xabc1, 0xabbc, 0xce70, 0xabbf, 0x9877, 0xae56, 0xce76, 0xce64, - 0x9854, 0x95c5, 0xce66, 0xce6d, 0xce71, 0xce75, 0xce72, 0xce6b, - 0xce6e, 0x9d55, 0xfbb2, 0xce68, 0xabc3, 0xce6a, 0xce69, 0xce74, - 0xabba, 0xce65, 0xabc2, 0x957e, 0xabbd, 0xae5c, 0xd162, 0x9742, - 0xae5b, 0x94e6, 0xd160, 0xae50, 0x92f5, 0xae55, 0xd15f, 0xd15c, - 0xd161, 0xae51, 0xd15b, 0x8cc5, 0xae54, 0xae52, 0xd163, 0xae53, - 0xae57, 0x92fd, 0xae58, 0xfba2, 0xae5a, 0x9c51, 0xae59, 0x94e9, - 0x985c, 0x92f0, 0xd15d, 0xd15e, 0xd164, 0xd4d4, 0xb0f9, 0xd8c2, - 0xd4d3, 0xd4e6, 0xb140, 0x944c, 0xd4e4, 0xb0fe, 0xb0fa, 0xd4ed, - 0xd4dd, 0xd4e0, 0x916b, 0xb143, 0xd4ea, 0xd4e2, 0xb0fb, 0xb144, - 0xd4e7, 0xd4e5, 0xd4d6, 0xd4eb, 0xd4df, 0xd4da, 0x8b78, 0xd4d0, - 0xd4ec, 0xd4dc, 0xd4cf, 0x94e2, 0xb142, 0xd4e1, 0xd4ee, 0xd4de, - 0xd4d2, 0xd4d7, 0xd4ce, 0x984f, 0xb141, 0xfbb5, 0xd4db, 0xd4d8, - 0xb0fc, 0xd4d1, 0x9271, 0xd4e9, 0xb0fd, 0x9365, 0xd4d9, 0xd4d5, - 0x985b, 0xd4e8, 0x9850, 0xb440, 0xd8bb, 0x97bc, 0xd8b8, 0xd8c9, - 0xd8bd, 0xd8ca, 0x92f3, 0xb442, 0x9340, 0x984d, 0xd8c6, 0xd8c3, - 0x9572, 0xfdef, 0xd8c4, 0xd8c7, 0xd8cb, 0xd4e3, 0xd8cd, 0xdd47, - 0xfdc1, 0xb443, 0xd8ce, 0xd8b6, 0xd8c0, 0xfbba, 0xd8c5, 0x92eb, - 0xb441, 0xb444, 0xd8cc, 0xd8cf, 0xd8ba, 0xd8b7, 0xfc73, 0x97b7, - 0xd8b9, 0xd8be, 0xd8bc, 0xb445, 0xd8c8, 0xfbb4, 0xd8bf, 0xd8c1, - 0xd8b5, 0xdcfa, 0xdcf8, 0xb742, 0xb740, 0xdd43, 0xdcf9, 0xdd44, - 0xdd40, 0xdcf7, 0xdd46, 0xdcf6, 0xdcfd, 0xb6fe, 0xb6fd, 0xb6fc, - 0xdcfb, 0xdd41, 0xb6f9, 0xb741, 0x90a7, 0xdcf4, 0xdcfe, 0xdcf3, - 0xdcfc, 0xb6fa, 0xdd42, 0xdcf5, 0xb6fb, 0xdd45, 0x9741, 0x92f4, - 0xfbbc, 0xe16e, 0xb9e2, 0xb9e1, 0xb9e3, 0xe17a, 0xe170, 0xe176, - 0xe16b, 0xe179, 0xe178, 0xe17c, 0xe175, 0xb9de, 0xe174, 0xb9e4, - 0x9577, 0xe16d, 0xb9df, 0xe17b, 0xb9e0, 0xe16f, 0xe172, 0xe177, - 0xe171, 0xe16c, 0x9ee2, 0x8f78, 0xe173, 0xe555, 0xbc61, 0xe558, - 0xe557, 0xe55a, 0xe55c, 0xf9dc, 0xbc5f, 0xe556, 0x9672, 0xe554, - 0xe55d, 0xe55b, 0xe559, 0xe55f, 0xe55e, 0xbc63, 0xbc5e, 0xbc60, - 0xbc62, 0x9eb5, 0xe560, 0xe957, 0x964b, 0xe956, 0xe955, 0x8cac, - 0xe958, 0xe951, 0xe952, 0xe95a, 0xe953, 0xbec5, 0xe95c, 0xa0fa, - 0xe95b, 0xe954, 0xecd1, 0xc0a8, 0xeccf, 0xecd4, 0xecd3, 0xe959, - 0xc0a7, 0x9575, 0xecd2, 0xecce, 0xecd6, 0xecd5, 0xc0a6, 0xecd0, - 0xbec6, 0xc254, 0xefc1, 0xf1fa, 0xf1fb, 0xf1fc, 0xc45c, 0x90da, - 0xc45d, 0x9367, 0xf443, 0xfea4, 0xf5c8, 0xf5c7, 0x90df, 0xf6db, - 0xf6dc, 0xf7d5, 0xf8a7, 0x9354, 0xa46c, 0xa46d, 0xa46e, 0xa4d5, - 0xa5a5, 0xc9d3, 0xa672, 0xa673, 0xa7b7, 0xa7b8, 0xa7b6, 0xa7b5, - 0xa973, 0xcc55, 0xa975, 0xa974, 0xcc56, 0x8961, 0x8bb4, 0xabc4, - 0xae5d, 0xd165, 0x9dc0, 0xd4f0, 0xb145, 0xb447, 0xd4ef, 0xb446, - 0x8e48, 0xb9e5, 0xfbc5, 0xe17d, 0xbec7, 0xc0a9, 0xecd7, 0xfbc7, - 0xc45e, 0xc570, 0xc6cb, 0xc972, 0xfa79, 0xa5a6, 0xc973, 0xa676, - 0xa674, 0xa675, 0xa677, 0xa7ba, 0xa7b9, 0xcabc, 0xa7bb, 0x9e67, - 0xcabd, 0xcc57, 0xcc58, 0x8cd9, 0xa976, 0xa978, 0xa97a, 0xa977, - 0xa97b, 0xa979, 0xfbd2, 0x8962, 0x8963, 0xabc8, 0xabc5, 0xabc7, - 0xabc9, 0xabc6, 0xd166, 0xce77, 0xfc7d, 0xd168, 0xd167, 0xae63, - 0xae5f, 0xae60, 0xae62, 0xae64, 0xae61, 0xae66, 0xae65, 0xb14a, - 0xd4f2, 0xd4f1, 0xb149, 0x9f6b, 0xb148, 0xb147, 0xb14b, 0xb146, - 0xd8d5, 0xd8d2, 0xb449, 0xd8d1, 0xd8d6, 0xb44b, 0xd8d4, 0xb448, - 0xb44a, 0xd8d3, 0xfbcc, 0xdd48, 0xfeae, 0xdd49, 0xdd4a, 0xb9e6, - 0xb9ee, 0xe17e, 0xb9e8, 0xb9ec, 0xe1a1, 0xb9ed, 0xb9e9, 0xb9ea, - 0xb9e7, 0xb9eb, 0xbc66, 0xd8d0, 0xbc67, 0xbc65, 0xbc64, 0xe95d, - 0xbec8, 0xecd8, 0xecd9, 0xfbd1, 0xc364, 0xc45f, 0xa46f, 0xa678, - 0xfb75, 0xabca, 0xd169, 0xae67, 0xfbd4, 0xb14e, 0xb14d, 0xb14c, - 0xb44c, 0xb44d, 0xd8d7, 0xb9ef, 0xbec9, 0xa470, 0xc95c, 0xa4d6, - 0xc974, 0xfbd6, 0xfbd8, 0xc9d4, 0xa679, 0xa97c, 0x8b5d, 0x934c, - 0xdd4b, 0x9ae2, 0xa471, 0x8bc9, 0xa4d7, 0xc9d5, 0xcabe, 0xcabf, - 0xa7bc, 0xd8d8, 0xb44e, 0xdd4c, 0xc0aa, 0xa472, 0xa4a8, 0xa4d8, - 0xc975, 0xa5a7, 0xa7c0, 0xa7bf, 0xa7bd, 0xa7be, 0xcc59, 0xa97e, - 0xa9a1, 0xcc5a, 0xa97d, 0xfbdb, 0x9fc9, 0xabce, 0xce78, 0xabcd, - 0xabcb, 0xabcc, 0xae6a, 0xae68, 0x9f44, 0xd16b, 0xae69, 0xd16a, - 0xae5e, 0xd4f3, 0xb150, 0xb151, 0x98ed, 0xb14f, 0xb9f0, 0xe1a2, - 0xbc68, 0xbc69, 0xe561, 0xc0ab, 0xefc2, 0xefc3, 0xc4dd, 0xf8a8, - 0xc94b, 0xa4d9, 0xa473, 0xc977, 0xc976, 0xa67a, 0xc9d7, 0xc9d8, - 0xc9d6, 0xc9d9, 0xfbdd, 0xcac7, 0xcac2, 0xcac4, 0xcac6, 0xcac3, - 0xa7c4, 0xcac0, 0xcac1, 0xa7c1, 0xa7c2, 0xcac5, 0xcac8, 0xa7c3, - 0xcac9, 0x8df2, 0x8964, 0xfdf2, 0xcc68, 0x934d, 0xcc62, 0xcc5d, - 0xa9a3, 0xcc65, 0xcc63, 0xcc5c, 0xcc69, 0xcc6c, 0xcc67, 0xcc60, - 0xa9a5, 0xcc66, 0xa9a6, 0xcc61, 0xcc64, 0xcc5b, 0xcc5f, 0xcc6b, - 0xa9a7, 0xa9a8, 0xcc5e, 0xcc6a, 0xa9a2, 0xa9a4, 0xfbe7, 0xa0f2, - 0x9868, 0xceab, 0xcea4, 0xceaa, 0xcea3, 0xcea5, 0xce7d, 0xce7b, - 0xceac, 0xcea9, 0xce79, 0x9f58, 0xabd0, 0xcea7, 0xcea8, 0xcea6, - 0xce7c, 0xce7a, 0xabcf, 0xcea2, 0xce7e, 0xcea1, 0xcead, 0x8d73, - 0xae6f, 0xfbde, 0xae6e, 0xd16c, 0xae6b, 0xd16e, 0xfbdf, 0xae70, - 0xd16f, 0xae73, 0x8c48, 0xae71, 0xd170, 0xceae, 0xd172, 0xae6d, - 0xae6c, 0xd16d, 0xd171, 0xae72, 0xb153, 0xb152, 0xd4f5, 0xd4f9, - 0xd4fb, 0xb154, 0xd4fe, 0xfbe3, 0xb158, 0xd541, 0xb15a, 0x8da8, - 0xb156, 0xb15e, 0xfbe4, 0xb15b, 0xd4f7, 0xb155, 0xd4f6, 0xd4f4, - 0xd543, 0xd4f8, 0xb157, 0xd542, 0xb15c, 0xd4fd, 0xd4fc, 0xb15d, - 0xd4fa, 0xb159, 0x9c75, 0xd544, 0x9878, 0xd540, 0xd8e7, 0xd8ee, - 0xd8e3, 0xb451, 0xd8df, 0xd8ef, 0xd8d9, 0xd8ec, 0xd8ea, 0xd8e4, - 0xd8ed, 0xd8e6, 0x8d60, 0xd8de, 0xd8f0, 0xd8dc, 0xd8e9, 0xd8da, - 0xd8f1, 0xfbe5, 0xb452, 0x8d61, 0xd8eb, 0xdd4f, 0xd8dd, 0xb44f, - 0xd8e1, 0xb450, 0xd8e0, 0xd8e5, 0xd8e2, 0x8d62, 0xa0a1, 0xd8e8, - 0x9c40, 0xdd53, 0xdd56, 0xdd4e, 0xdd50, 0xdd55, 0xdd54, 0xb743, - 0xd8db, 0xdd52, 0xb744, 0x98ad, 0xdd4d, 0xdd51, 0x9eea, 0xe1a9, - 0xe1b0, 0xe1a7, 0x8cd4, 0xe1ae, 0xe1a5, 0xe1ad, 0xe1b1, 0xe1a4, - 0xe1a8, 0xe1a3, 0xb9f1, 0x9ceb, 0xe1a6, 0xb9f2, 0xe1ac, 0xe1ab, - 0xe1aa, 0xfbe0, 0xe1af, 0x9f51, 0xe565, 0xe567, 0xbc6b, 0xe568, - 0xe563, 0xe562, 0xe56c, 0xe56a, 0xbc6a, 0xe56d, 0xe564, 0xe569, - 0xe56b, 0xe566, 0x8d65, 0xe961, 0xe966, 0xe960, 0xe965, 0x9cf1, - 0xe95e, 0xe968, 0xe964, 0xe969, 0xe963, 0xe95f, 0xe967, 0xe96a, - 0xe962, 0xfc58, 0xecda, 0xc0af, 0x8d66, 0xc0ad, 0xc0ac, 0xc0ae, - 0xefc4, 0x9654, 0xf172, 0xf1fd, 0xf444, 0xf445, 0xc460, 0xf5c9, - 0xc4de, 0xf5ca, 0xf6de, 0xc572, 0xc571, 0xf6dd, 0xc5c9, 0xfbe8, - 0xf7d6, 0xc6cc, 0xa474, 0xa67b, 0xc9da, 0xcaca, 0xa8b5, 0xb15f, - 0xa475, 0xa5aa, 0xa5a9, 0xa5a8, 0xa7c5, 0xae74, 0xdd57, 0xa476, - 0xa477, 0xa478, 0xa4da, 0x9fce, 0xabd1, 0xceaf, 0xb453, 0xa479, - 0xc95d, 0xa5ab, 0xa5ac, 0xc978, 0xa67c, 0xfbfc, 0xcacb, 0x9ae4, - 0xa7c6, 0xcacc, 0xa9ae, 0x9f75, 0xcc6e, 0xa9ac, 0xa9ab, 0xcc6d, - 0xa9a9, 0xcc6f, 0xa9aa, 0xa9ad, 0xabd2, 0xabd4, 0xceb3, 0xceb0, - 0xceb1, 0xceb2, 0xceb4, 0xabd3, 0xd174, 0xd173, 0xae76, 0xae75, - 0xfbf1, 0xb162, 0xd546, 0xb161, 0xb163, 0xb160, 0xb455, 0xd545, - 0xb456, 0xd8f3, 0x8d69, 0xb457, 0xd8f2, 0xb454, 0x934f, 0xdd5a, - 0xdd5c, 0xb745, 0xdd5b, 0xdd59, 0xdd58, 0xe1b4, 0xb9f7, 0xb9f5, - 0xb9f6, 0xe1b2, 0xe1b3, 0xb9f3, 0xe571, 0xe56f, 0x934e, 0xbc6d, - 0xe570, 0xbc6e, 0xbc6c, 0xb9f4, 0xe96d, 0xe96b, 0xe96c, 0xe56e, - 0xecdc, 0xc0b0, 0xecdb, 0xefc5, 0xefc6, 0xe96e, 0xf1fe, 0xa47a, - 0xa5ad, 0xa67e, 0xc9db, 0xa67d, 0xa9af, 0xb746, 0xfbf4, 0xa4db, - 0xa5ae, 0xabd5, 0xb458, 0xc6ce, 0xc979, 0xc97a, 0xfbc3, 0xc9dc, - 0x8965, 0xa7c8, 0xcad0, 0xcace, 0xa7c9, 0xcacd, 0xcacf, 0xcad1, - 0xa7c7, 0x8c7a, 0xa9b3, 0xa9b4, 0xa9b1, 0x8c7b, 0xa9b0, 0xceb8, - 0xa9b2, 0xabd6, 0xceb7, 0xceb9, 0xceb6, 0xceba, 0xabd7, 0xae79, - 0xd175, 0xd177, 0xae77, 0xd178, 0xae78, 0xd176, 0xceb5, 0xd547, - 0xd54a, 0xd54b, 0xd548, 0xb167, 0xb166, 0xb164, 0xb165, 0xd549, - 0x8d6a, 0xb168, 0xb45a, 0xb45b, 0xb45c, 0xdd5d, 0xdd5f, 0xdd61, - 0xb748, 0xb747, 0xb459, 0xdd60, 0xdd5e, 0x9353, 0xe1b8, 0x9dfb, - 0xe1b6, 0xe1bc, 0xb9f8, 0xe1bd, 0xe1ba, 0xb9f9, 0xe1b7, 0xe1b5, - 0xe1bb, 0xbc70, 0xe573, 0xe1b9, 0xbc72, 0xe574, 0xbc71, 0xbc74, - 0xe575, 0xbc6f, 0xbc73, 0xe973, 0xe971, 0xe970, 0xe972, 0xe96f, - 0xc366, 0xf446, 0xf447, 0xf5cb, 0xf6df, 0xc655, 0xfbfd, 0xa9b5, - 0xa7ca, 0x9059, 0xfc40, 0xabd8, 0xfc41, 0xfc43, 0xa47b, 0xa4dc, - 0xa5af, 0xc9dd, 0xa7cb, 0xcad2, 0xcebb, 0xabd9, 0xb9fa, 0xa47c, - 0x9361, 0xfc46, 0x9362, 0xa6a1, 0xb749, 0xa47d, 0xa4dd, 0xa4de, - 0xa5b1, 0xa5b0, 0xc9de, 0xa6a2, 0xcad3, 0xa7cc, 0xcc71, 0xcc72, - 0xcc73, 0x8d6b, 0xa9b6, 0xa9b7, 0xcc70, 0xa9b8, 0xabda, 0xcebc, - 0xd17a, 0xae7a, 0xd179, 0xb169, 0xd54c, 0xb16a, 0xd54d, 0xfc4c, - 0xb45d, 0xdd62, 0xe1bf, 0xe1be, 0xb9fb, 0xbc75, 0xe576, 0xbeca, - 0xe974, 0xc0b1, 0x95b8, 0xc573, 0xf7d8, 0xc6d0, 0x8bca, 0xcc74, - 0xcebd, 0xb16b, 0xd8f4, 0xb74a, 0x987a, 0xc255, 0xc6d1, 0xa7ce, - 0xfc51, 0xa7cd, 0xabdb, 0xd17b, 0xb16d, 0xb343, 0xb16e, 0xb16c, - 0xb45e, 0xe1c0, 0xb9fc, 0xbc76, 0xfc54, 0xc94c, 0xc9df, 0xcad5, - 0xa7cf, 0xcad4, 0xa7d0, 0xfaaf, 0xa9bc, 0xcc77, 0xcc76, 0xa9bb, - 0xa9b9, 0xa9ba, 0xcc75, 0x8d6c, 0xabdd, 0xcebe, 0xabe0, 0xabdc, - 0xabe2, 0xabde, 0xabdf, 0xabe1, 0xae7d, 0xae7c, 0xae7b, 0xd54f, - 0xb16f, 0xb172, 0xb170, 0xd54e, 0xb175, 0xb171, 0xd550, 0xb174, - 0xb173, 0xfa61, 0xd8f6, 0xd8f5, 0xfc57, 0xb461, 0xb45f, 0xb460, - 0xd8f7, 0xb74b, 0xdd64, 0xb74c, 0xdd63, 0x9b70, 0xe577, 0xbc78, - 0xe1c1, 0xbc77, 0xb9fd, 0xa051, 0xecde, 0xe975, 0xc0b2, 0xecdd, - 0xf240, 0xf448, 0xf449, 0x8c7c, 0xa4df, 0x8bcb, 0xa5b2, 0xc97b, - 0xa7d2, 0xa7d4, 0xc9e2, 0xcad8, 0xcad7, 0xcad6, 0xc9e1, 0xc9e0, - 0xa6a4, 0xa7d3, 0xa7d1, 0xa6a3, 0x936e, 0xa9bd, 0xcc78, 0xfcd5, - 0xa9be, 0xcadd, 0xcadf, 0xcade, 0xcc79, 0xcada, 0xa7d8, 0xa7d6, - 0xcad9, 0xcadb, 0xcae1, 0xa7d5, 0xcadc, 0xcae5, 0xa9c0, 0xcae2, - 0xa7d7, 0xcae0, 0xcae3, 0xa9bf, 0xa9c1, 0xcae4, 0xccaf, 0xcca2, - 0xcc7e, 0xccae, 0xcca9, 0xabe7, 0xa9c2, 0xccaa, 0xccad, 0xabe3, - 0xccac, 0xa9c3, 0xa9c8, 0xa9c6, 0xcca3, 0xcc7c, 0xcca5, 0xa9cd, - 0xccb0, 0xabe4, 0xcca6, 0xabe5, 0xa9c9, 0xcca8, 0xfca9, 0xcecd, - 0xabe6, 0xcc7b, 0xa9ca, 0xabe8, 0xa9cb, 0xa9c7, 0xa9cc, 0xcca7, - 0xcc7a, 0xccab, 0xa9c4, 0xfc61, 0xcc7d, 0xcca4, 0xcca1, 0xa9c5, - 0xcebf, 0xcec0, 0x8966, 0xceca, 0xd1a1, 0xcecb, 0xabee, 0xcece, - 0xcec4, 0xabed, 0xcec6, 0xcec7, 0xfacb, 0xcec9, 0xabe9, 0xaea3, - 0xf9da, 0xcec5, 0xcec1, 0xaea4, 0xcecf, 0xae7e, 0xd17d, 0xcec8, - 0xd17c, 0xcec3, 0xcecc, 0xabec, 0xaea1, 0xabf2, 0xaea2, 0xced0, - 0xd17e, 0xabeb, 0xaea6, 0xabf1, 0xabf0, 0xabef, 0xaea5, 0xced1, - 0xaea7, 0xabea, 0xcec2, 0x937a, 0xa0e0, 0x936b, 0xb176, 0xd1a4, - 0xd1a6, 0xd1a8, 0xaea8, 0xaeae, 0xd553, 0xd1ac, 0xd1a3, 0xb178, - 0xd551, 0xaead, 0xaeab, 0xd1ae, 0xd552, 0xd1a5, 0xaeac, 0xd1a9, - 0xaeaf, 0xd1ab, 0xaeaa, 0xd1aa, 0xd1ad, 0xd1a7, 0xfc6b, 0xaea9, - 0xb179, 0xd1a2, 0xb177, 0xa0dc, 0x9468, 0xb17a, 0xd555, 0xd55e, - 0xb464, 0xfc6d, 0xb17c, 0xb1a3, 0xb465, 0xd560, 0xb1aa, 0xd8f9, - 0xd556, 0xb1a2, 0xb1a5, 0xb17e, 0xd554, 0xd562, 0xd565, 0xd949, - 0xd563, 0xd8fd, 0xb1a1, 0xb1a8, 0xb1ac, 0xd55d, 0xd8f8, 0xd561, - 0xb17b, 0xd8fa, 0xd564, 0xd8fc, 0xd559, 0xb462, 0xd557, 0xd558, - 0xb1a7, 0x8d71, 0xb1a6, 0xd55b, 0xb1ab, 0xd55f, 0xb1a4, 0xd55c, - 0xfd64, 0xb1a9, 0xb466, 0xb463, 0xd8fb, 0x99ba, 0xd55a, 0xb17d, - 0x9ad0, 0x9a61, 0xa0e5, 0xb46b, 0xb46f, 0xd940, 0xb751, 0xb46d, - 0xd944, 0xb471, 0xdd65, 0xd946, 0xb753, 0xb469, 0xb46c, 0xd947, - 0xa05b, 0xd948, 0xd94e, 0xb473, 0xb754, 0xd94a, 0xd94f, 0xd943, - 0xb75e, 0x96ac, 0xb755, 0xb472, 0xd941, 0xd950, 0x9740, 0xb75d, - 0xb470, 0xb74e, 0xd94d, 0xb474, 0xd945, 0xd8fe, 0xb46a, 0xd942, - 0xd94b, 0x9ef1, 0xb74d, 0xb752, 0xb467, 0xd94c, 0xb750, 0x8c4d, - 0xb468, 0xb75c, 0xe1c3, 0xdd70, 0xdd68, 0xe1c2, 0xdd6c, 0xdd6e, - 0x9f7e, 0xdd6b, 0xb75b, 0xdd6a, 0xb75f, 0xe1d2, 0x8d72, 0xb75a, - 0xba40, 0xdd71, 0xe1c4, 0xfc76, 0xb758, 0xdd69, 0xdd6d, 0xb9fe, - 0xb74f, 0xdd66, 0xdd67, 0xba41, 0xb757, 0xb759, 0xb756, 0xdd6f, - 0x96a9, 0xe1c8, 0xe1c9, 0xe1ce, 0xbc7d, 0xe1d5, 0xba47, 0xa06e, - 0xba46, 0xe1d0, 0xfcaa, 0xbc7c, 0xe1c5, 0xba45, 0xfbcd, 0xe1d4, - 0xba43, 0xba44, 0xfc74, 0xe1d1, 0xe5aa, 0xbc7a, 0xb46e, 0xe1d3, - 0xbca3, 0xe1cb, 0xbc7b, 0xa074, 0xbca2, 0xe1c6, 0xe1ca, 0xe1c7, - 0xe1cd, 0xba48, 0xbc79, 0xba42, 0xe57a, 0xe1cf, 0xbca1, 0xa071, - 0xbca4, 0xe1cc, 0xfc79, 0xbc7e, 0xe579, 0xfc7c, 0xe57e, 0xbece, - 0xe578, 0xe9a3, 0xe5a9, 0xbca8, 0xbca6, 0xbecc, 0xe5a6, 0xe5a2, - 0xbcac, 0x9c50, 0xe978, 0x9379, 0x9378, 0xbcaa, 0xe5a1, 0xa0dd, - 0xe976, 0xe5a5, 0xe5a8, 0xe57d, 0xbcab, 0xbca5, 0xe977, 0xbecd, - 0xe5a7, 0xbca7, 0xbca9, 0xe5a4, 0xbcad, 0xe5a3, 0xe57c, 0xe57b, - 0xbecb, 0xe5ab, 0xe97a, 0xece0, 0xbed0, 0x8d75, 0xe9a2, 0x8d76, - 0xe97e, 0xece1, 0xbed1, 0xe9a1, 0x9374, 0xe97c, 0xc0b4, 0xecdf, - 0xe979, 0xe97b, 0xc0b5, 0xbed3, 0xc0b3, 0xbed2, 0xc0b7, 0xe97d, - 0xbecf, 0x8d77, 0xfca5, 0xfca2, 0xefcf, 0xefc7, 0x90c3, 0xece7, - 0xefc8, 0xece3, 0xa079, 0xc256, 0xece5, 0xece4, 0xc0b6, 0xece2, - 0xece6, 0xefd0, 0xefcc, 0xefce, 0xefc9, 0xefca, 0xefcd, 0xefcb, - 0xc367, 0xc36a, 0xc369, 0xc368, 0xc461, 0xf44a, 0xc462, 0xf241, - 0xc4df, 0xf5cc, 0xc4e0, 0xc574, 0xc5ca, 0xf7d9, 0xf7da, 0xf7db, - 0xf9ba, 0xa4e0, 0xc97c, 0xa5b3, 0xa6a6, 0xa6a7, 0xa6a5, 0xa6a8, - 0xa7da, 0xa7d9, 0xccb1, 0xa9cf, 0xa9ce, 0xd1af, 0xb1ad, 0xb1ae, - 0xb475, 0xdd72, 0xb760, 0xb761, 0xdd74, 0xdd76, 0xdd75, 0xe1d7, - 0xe1d6, 0xba49, 0xe1d8, 0x8d79, 0xe5ac, 0xbcae, 0xbed4, 0xc0b8, - 0xc257, 0xc0b9, 0xa4e1, 0x8bfc, 0xa076, 0xcae6, 0xccb2, 0xa9d1, - 0xa9d0, 0xa9d2, 0xabf3, 0xced2, 0xced3, 0xd1b0, 0xaeb0, 0xb1af, - 0xb476, 0xd951, 0xa4e2, 0x8bcd, 0xa47e, 0xa4e3, 0xc97d, 0xa5b7, - 0xa5b6, 0xa5b4, 0xa5b5, 0xa6ab, 0xc9e9, 0xc9eb, 0xa6aa, 0xc9e3, - 0xc9e4, 0xc9ea, 0xc9e6, 0xc9e8, 0xa6a9, 0xc9e5, 0xc9ec, 0xc9e7, - 0x9f5a, 0xa7e1, 0xa7ea, 0xa7e8, 0xcaf0, 0xcaed, 0xcaf5, 0xa7e6, - 0xcaf6, 0xa7df, 0xcaf3, 0xa7e5, 0xcaef, 0xcaee, 0xa7e3, 0xcaf4, - 0xa7e4, 0xa9d3, 0xa7de, 0xcaf1, 0x9ff4, 0xcae7, 0xa7db, 0x9fba, - 0xa7ee, 0xcaec, 0xcaf2, 0xa7e0, 0xa7e2, 0xcae8, 0xcae9, 0xcaea, - 0x8d7a, 0xa7ed, 0xa7e7, 0xa7ec, 0xcaeb, 0xa7eb, 0xa7dd, 0xa7dc, - 0xa7e9, 0x9e45, 0x93b0, 0xa075, 0xa9e1, 0xccbe, 0xccb7, 0xa9dc, - 0xa9ef, 0xccb3, 0xccba, 0xccbc, 0xccbf, 0xa9ea, 0xccbb, 0xccb4, - 0xa9e8, 0xccb8, 0xccc0, 0xa9d9, 0xccbd, 0xa9e3, 0xa9e2, 0xccb6, - 0xa9d7, 0xa9d8, 0x9b46, 0xa9d6, 0xfcae, 0xa9ee, 0xa9e6, 0xa9e0, - 0xa9d4, 0xccb9, 0xa9df, 0xa9d5, 0xa9e7, 0xa9f0, 0xced4, 0xa9e4, - 0xccb5, 0xa9da, 0xa9dd, 0xa9de, 0xfcb0, 0xa9ec, 0xa9ed, 0xa9eb, - 0xa9e5, 0xa9e9, 0xa9db, 0xabf4, 0xfa51, 0x8d7b, 0xceda, 0xac41, - 0xabf8, 0xabfa, 0xac40, 0xcee6, 0xabfd, 0xd1b1, 0xaeb1, 0xac43, - 0xced7, 0xcedf, 0xabfe, 0xcede, 0xcedb, 0xcee3, 0xcee5, 0xabf7, - 0xabfb, 0xac42, 0xaeb3, 0xcee0, 0xabf9, 0xac45, 0xced9, 0xabfc, - 0xaeb2, 0xabf6, 0xced6, 0xcedd, 0xced5, 0xced8, 0xcedc, 0xd1b2, - 0xac44, 0xcee1, 0xcee2, 0xcee4, 0xabf5, 0x8d7c, 0xaec1, 0xd1be, - 0xaebf, 0xaec0, 0xd1b4, 0xd1c4, 0x9ed6, 0xaeb6, 0x93ac, 0xd566, - 0xd1c6, 0xd1c0, 0x9f5b, 0xd1b7, 0x93a9, 0xd1c9, 0xd1ba, 0xaebc, - 0xd57d, 0xd1bd, 0xaebe, 0xaeb5, 0xd1cb, 0xd1bf, 0xaeb8, 0xd1b8, - 0xd1b5, 0xd1b6, 0xaeb9, 0xd1c5, 0xd1cc, 0xaebb, 0xd1bc, 0xd1bb, - 0xaec3, 0xaec2, 0xaeb4, 0xaeba, 0xaebd, 0xd1c8, 0xd1c2, 0xaeb7, - 0xd1b3, 0xd1ca, 0xd1c1, 0xd1c3, 0xd1c7, 0xa07c, 0xd567, 0xb1b7, - 0xb1cb, 0xb1ca, 0xb1bf, 0xfcb2, 0xd579, 0xd575, 0xd572, 0xd5a6, - 0xb1ba, 0xb1b2, 0xd577, 0xb4a8, 0xb1b6, 0xd5a1, 0x8ac1, 0xb1cc, - 0xb1c9, 0xd57b, 0xd56a, 0x9fb4, 0xb1c8, 0xd5a3, 0xd569, 0xb1bd, - 0xb1c1, 0xd5a2, 0xd573, 0xb1c2, 0xb1bc, 0xd568, 0xfcac, 0xb478, - 0xd5a5, 0xd571, 0xb1c7, 0xd574, 0xd5a4, 0xb1c6, 0xd952, 0xb1b3, - 0xd56f, 0xb1b8, 0xb1c3, 0xb1be, 0xd578, 0xd56e, 0xd56c, 0xd57e, - 0xb1b0, 0xb1c4, 0xb1b4, 0xb477, 0xd57c, 0xb1b5, 0xb1b1, 0xb1c0, - 0xb1bb, 0xb1b9, 0xd570, 0xb1c5, 0xd56d, 0xd57a, 0xd576, 0xd954, - 0xd953, 0x9e4c, 0xd56b, 0xd964, 0xb47a, 0x8fc5, 0xd96a, 0xd959, - 0xd967, 0xdd77, 0xb47d, 0xd96b, 0xd96e, 0xb47c, 0xd95c, 0xd96d, - 0xd96c, 0xb47e, 0xd955, 0xb479, 0xb4a3, 0x93ad, 0xb4a1, 0xd969, - 0xd95f, 0xb4a5, 0xd970, 0xd968, 0xd971, 0xb4ad, 0xb4ab, 0xd966, - 0xd965, 0x9dc3, 0xd963, 0xd95d, 0xb4a4, 0x8da2, 0xb4a2, 0xd1b9, - 0xd956, 0x9d4a, 0xddb7, 0xd957, 0xb47b, 0xb4aa, 0xdd79, 0xb4a6, - 0xb4a7, 0xd958, 0xd96f, 0xdd78, 0xd960, 0xd95b, 0xb4a9, 0xd961, - 0xd95e, 0xfcb6, 0xb4ae, 0x8da3, 0x9e4b, 0x9e4d, 0xb770, 0x8da4, - 0xdd7c, 0xddb1, 0xddb6, 0xddaa, 0xb76c, 0xddbb, 0xb769, 0xdd7a, - 0xdd7b, 0xb762, 0xb76b, 0xdda4, 0xb76e, 0xb76f, 0xdda5, 0xddb2, - 0xddb8, 0xb76a, 0xb764, 0xdda3, 0xdd7d, 0xddba, 0xdda8, 0xdda9, - 0xdd7e, 0xddb4, 0xddab, 0xddb5, 0xddad, 0xb765, 0xe1d9, 0xb768, - 0xb766, 0xddb9, 0xddb0, 0xddac, 0x8afd, 0xdda1, 0xba53, 0xddaf, - 0xb76d, 0xdda7, 0xfcb5, 0xdda6, 0xfcc3, 0x93b2, 0xb767, 0xb763, - 0xe1ee, 0xddb3, 0xddae, 0xdda2, 0xe1e9, 0xe1da, 0xe1e5, 0xe1ec, - 0xba51, 0xb4ac, 0xe1ea, 0xba4c, 0xba4b, 0xe1f1, 0x8da5, 0xe1db, - 0xe1e8, 0xe1dc, 0xe1e7, 0xba4f, 0xe1eb, 0xd962, 0xe1f2, 0xe1e3, - 0xba52, 0xe5ba, 0xbcaf, 0xe1f0, 0xe1ef, 0xba54, 0xe5ad, 0xbcb0, - 0xe5ae, 0x93a1, 0xe1df, 0xe1e0, 0xe1dd, 0xe1e2, 0xe1de, 0xe1f3, - 0xba4e, 0xbcb1, 0xba50, 0xba55, 0x8ac6, 0xe1e1, 0xe1ed, 0xe1e6, - 0xe5b1, 0xba4a, 0xbcb4, 0xe9aa, 0xe5b6, 0xe5b5, 0xe5b7, 0x8a5b, - 0xe5b4, 0xbcb5, 0x894d, 0xbcbb, 0xbcb8, 0xbcb9, 0xe5af, 0xe5b2, - 0xe5bc, 0xbcc1, 0xbcbf, 0xe5b3, 0xd95a, 0xbcb2, 0xe5b9, 0xe5b0, - 0xbcc2, 0xe5b8, 0xba4d, 0xbcb7, 0xe1e4, 0xbcba, 0xbcbe, 0xbcc0, - 0xbcbd, 0xbcbc, 0xfed4, 0xbcb6, 0xe5bb, 0xbcb3, 0xbcc3, 0x8a78, - 0x93ab, 0xbed8, 0xbed9, 0xe9a9, 0xbee2, 0xbedf, 0x8da7, 0xbed6, - 0xbedd, 0xe9ab, 0xbedb, 0xbed5, 0xbedc, 0xe9a8, 0xc0bb, 0xbed7, - 0xbede, 0xc0ba, 0xe9a7, 0xe9a6, 0xbee0, 0x9f45, 0xbee1, 0xe9a5, - 0xe9a4, 0xc0bc, 0xe9ae, 0xbeda, 0xe9ac, 0x8a56, 0xc0bd, 0xfcbf, - 0xc0c2, 0xecea, 0xecec, 0xfcc0, 0xc0bf, 0x8ee6, 0xeced, 0xece9, - 0x8aa4, 0xeceb, 0xc0c0, 0xc0c3, 0xece8, 0xc0be, 0xc0c1, 0xc259, - 0xe9ad, 0xc258, 0xc25e, 0xefd4, 0xc25c, 0xc25d, 0xefd7, 0xefd3, - 0xc25a, 0xefd1, 0xc36b, 0xefd5, 0xefd6, 0xefd2, 0xc25b, 0xf242, - 0xf245, 0x8943, 0xf246, 0xf244, 0xf247, 0xc36c, 0xf243, 0x93f3, - 0xf44e, 0xc464, 0xf44d, 0xf44c, 0xf44b, 0xc463, 0xc465, 0xf5cd, - 0xc4e2, 0xc4e1, 0xfcab, 0x9ea2, 0xf6e1, 0xf6e0, 0xf6e3, 0xc5cb, - 0xc575, 0xf7dd, 0xf6e2, 0xf7dc, 0xc5cd, 0xc5cc, 0xc5f3, 0xf8a9, - 0xf8ef, 0xa4e4, 0x9dc7, 0xd972, 0xe9af, 0xc6d2, 0x8bce, 0xa6ac, - 0xcaf7, 0xa7f1, 0xa7ef, 0xa7f0, 0xccc1, 0xa9f1, 0xac46, 0xcee7, - 0xcee8, 0xac47, 0xd1ce, 0xaec4, 0xaec5, 0xd1cd, 0xfcc5, 0xb1d3, - 0xb1cf, 0xd5a7, 0xb1d6, 0xb1d5, 0xb1ce, 0xb1d1, 0xb1d4, 0xb1d0, - 0xd976, 0xb1cd, 0xb4af, 0xfccb, 0xb4b1, 0xb4b2, 0xd975, 0xd978, - 0xb4b0, 0xd973, 0xd977, 0xd974, 0x93b3, 0xb771, 0xfcca, 0xddbc, - 0xba56, 0xe1f4, 0xbee3, 0xbcc4, 0xe5bd, 0xbcc5, 0xbcc6, 0xe5bf, - 0xe5be, 0xe5c0, 0xe9b1, 0xe9b0, 0xecef, 0xecee, 0xc0c4, 0xc0c5, - 0xf248, 0xfcc9, 0x8dac, 0xa4e5, 0xfbc6, 0x8967, 0x8c7e, 0xd979, - 0xb4b4, 0xb4b3, 0xddbd, 0xefd8, 0xc4e3, 0xf7de, 0xa4e6, 0xaec6, - 0xb1d8, 0xb1d7, 0xd97a, 0xd97b, 0xb772, 0xe1f5, 0xba57, 0xe9b2, - 0xa4e7, 0xa5b8, 0xa9f2, 0xccc2, 0xcee9, 0xac48, 0xb1d9, 0xd97c, - 0xb4b5, 0xb773, 0xe5c1, 0xe5c2, 0xfccd, 0xecf0, 0xc25f, 0xf8f0, - 0xa4e8, 0xccc3, 0xa9f3, 0xac49, 0x9cf3, 0xceea, 0xaec7, 0xd1d2, - 0xd1d0, 0xd1d1, 0xaec8, 0xd1cf, 0xb1db, 0xb1dc, 0xd5a8, 0xb1dd, - 0xb1da, 0xd97d, 0xfcd0, 0xd97e, 0xddbe, 0x95bb, 0xba59, 0xba58, - 0xecf1, 0xefd9, 0xf24a, 0xf249, 0xf44f, 0xfcd3, 0xc95e, 0xac4a, - 0xfcd4, 0xa4e9, 0xa5b9, 0xa6ae, 0xa6ad, 0xa6af, 0xa6b0, 0xc9ee, - 0xc9ed, 0xcaf8, 0xa7f2, 0xcafb, 0xcafa, 0xcaf9, 0xcafc, 0xa9f4, - 0xccc9, 0xccc5, 0xccce, 0x8dae, 0xa9fb, 0xa9f9, 0xccca, 0xccc6, - 0xcccd, 0xa9f8, 0xaa40, 0xccc8, 0xccc4, 0xa9fe, 0xcccb, 0xa9f7, - 0xcccc, 0xa9fa, 0xa9fc, 0xccd0, 0xcccf, 0xccc7, 0xa9f6, 0xa9f5, - 0xa9fd, 0xfcd7, 0xceef, 0xcef5, 0x93db, 0xac50, 0xac4d, 0xceec, - 0xcef1, 0xfe63, 0xac53, 0xac4b, 0xcef0, 0xac4e, 0xac51, 0xcef3, - 0xac4c, 0xcef8, 0xac4f, 0x93d5, 0xac52, 0xceed, 0xcef2, 0xcef6, - 0xceee, 0xceeb, 0xcef7, 0xcef4, 0xaed0, 0xaec9, 0xaecc, 0xfcda, - 0xaecf, 0xd1d5, 0x9b71, 0xaeca, 0xd1d3, 0xfcdd, 0xaece, 0xaecb, - 0xd1d6, 0xaecd, 0x8daf, 0xfaf2, 0xd5ac, 0xb1df, 0xd5ab, 0xd5ad, - 0xb1de, 0xb1e3, 0xd1d4, 0xd5aa, 0xd5ae, 0x93d8, 0xb1e0, 0xd5a9, - 0xb1e2, 0xfcdf, 0xb1e1, 0xd9a7, 0x93d3, 0xd9a2, 0xb4b6, 0xb4ba, - 0xb4b7, 0xd9a5, 0xd9a8, 0xfce1, 0xb4b8, 0xb4b9, 0xb4be, 0xddc7, - 0xd9a6, 0xb4bc, 0xd9a3, 0xd9a1, 0x8e76, 0xb4bd, 0xd9a4, 0xb779, - 0xfc62, 0xddbf, 0xb776, 0xb777, 0xb775, 0xddc4, 0xddc3, 0xddc0, - 0xb77b, 0x93d1, 0xddc2, 0xb4bb, 0x8db1, 0xddc6, 0xddc1, 0xb778, - 0xb774, 0xb77a, 0xddc5, 0x9859, 0xba5c, 0xe1f8, 0xe1f7, 0xe1f6, - 0xba5a, 0xfb52, 0xba5b, 0xe5c5, 0xe5c8, 0xbcc8, 0xfb53, 0xbcc7, - 0xe5c9, 0xe5c4, 0xbcca, 0xe5c6, 0xfb4d, 0xbcc9, 0xe5c3, 0x9cbf, - 0xe5c7, 0xbee9, 0xbee6, 0xe9bb, 0xe9ba, 0xe9b9, 0xe9b4, 0x9b72, - 0xe9b5, 0xbee7, 0xbee4, 0xbee8, 0xe9b3, 0xbee5, 0xe9b6, 0xe9b7, - 0xe9bc, 0xfb50, 0x93be, 0xe9b8, 0xecf2, 0xc0c7, 0xefdc, 0xc0c6, - 0xefda, 0xefdb, 0xc260, 0xc36e, 0xf24b, 0xc36d, 0xf451, 0xf452, - 0xc466, 0xf450, 0xc4e4, 0xf7df, 0xc5ce, 0xf8aa, 0xf8ab, 0xa4ea, - 0x9df1, 0xa6b1, 0xa6b2, 0xa7f3, 0xccd1, 0xac54, 0xaed1, 0xb1e4, - 0xb0d2, 0xb4bf, 0xb4c0, 0xb3cc, 0xd9a9, 0xfceb, 0xb77c, 0xe1fa, - 0xe1f9, 0xa4eb, 0xa6b3, 0xccd2, 0xaa42, 0xa0bb, 0xaa41, 0x9b7e, - 0xcef9, 0xcefa, 0xd1d7, 0xd1d8, 0xaed2, 0xaed3, 0x8db3, 0xaed4, - 0xd5af, 0x8c52, 0xb1e6, 0xb4c2, 0x9ae8, 0xb4c1, 0xddc8, 0xdf7a, - 0xe1fb, 0xe9bd, 0x8edc, 0xc261, 0xc467, 0xa4ec, 0xa5bc, 0xa5bd, - 0xa5bb, 0xa5be, 0xa5ba, 0xa6b6, 0xc9f6, 0xa6b5, 0xa6b7, 0x9cf9, - 0xc9f1, 0xc9f0, 0xc9f3, 0xc9f2, 0xc9f5, 0xa6b4, 0xc9ef, 0xc9f4, - 0xfa50, 0xcafd, 0xa7fd, 0xcafe, 0xcb43, 0xa7fc, 0xcb47, 0xcb42, - 0xcb45, 0xa7f5, 0xa7f6, 0xa7f7, 0xa7f8, 0xa840, 0xcb41, 0xa7fa, - 0xa841, 0xcb40, 0xcb46, 0xa7f9, 0xcb44, 0xa7fb, 0xa7f4, 0xa7fe, - 0x98e7, 0xfcf3, 0xfcf2, 0xaa57, 0x8cca, 0xccd4, 0xaa43, 0xaa4d, - 0xaa4e, 0xaa46, 0xaa58, 0xaa48, 0xccdc, 0xaa53, 0xccd7, 0xaa49, - 0xcce6, 0xcce7, 0xccdf, 0xccd8, 0xaa56, 0xcce4, 0xaa51, 0xaa4f, - 0xcce5, 0xcce3, 0xccdb, 0xccd3, 0xccda, 0xaa4a, 0xaa50, 0xaa44, - 0xccde, 0xccdd, 0xccd5, 0x93e5, 0xaa52, 0xcce1, 0xccd6, 0xaa55, - 0xcce8, 0xaa45, 0xaa4c, 0xccd9, 0xcce2, 0xaa54, 0xaa47, 0xaa4b, - 0xcce0, 0x9a59, 0x8db5, 0xfd4d, 0xcf5b, 0xac5c, 0xac69, 0xfd5e, - 0xcf56, 0xcf4c, 0xac62, 0xcf4a, 0xac5b, 0xcf45, 0xac65, 0xcf52, - 0xcefe, 0xcf41, 0x8f7d, 0xcf44, 0xcefb, 0xcf51, 0xcf61, 0xac60, - 0xcf46, 0xcf58, 0xcefd, 0xcf5f, 0xcf60, 0xcf63, 0xcf5a, 0xcf4b, - 0xcf53, 0xac66, 0xac59, 0xac61, 0xac6d, 0xac56, 0xac58, 0x9547, - 0xfcf6, 0xcf43, 0xac6a, 0xac63, 0xcf5d, 0xcf40, 0xac6c, 0xac67, - 0xcf49, 0xac6b, 0xcf50, 0xcf48, 0xac64, 0xcf5c, 0xcf54, 0xac5e, - 0xcf62, 0xcf47, 0xac5a, 0xcf59, 0xcf4f, 0xac5f, 0xcf55, 0xac57, - 0xcefc, 0xac68, 0xaee3, 0xac5d, 0xcf4e, 0xcf4d, 0xcf42, 0x9250, - 0xcf5e, 0xcf57, 0x8968, 0xac55, 0x8db6, 0xfcfb, 0xa07d, 0x98fc, - 0x8969, 0xfe4f, 0x9256, 0xd1ec, 0xaeea, 0xd1ed, 0xd1e1, 0xaedf, - 0xaeeb, 0xd1da, 0xfac9, 0xd1e3, 0xd1eb, 0x93e8, 0xd1d9, 0xd1f4, - 0xaed5, 0xfcf8, 0xd1f3, 0xd1ee, 0xd1ef, 0xaedd, 0xaee8, 0xd1e5, - 0xd1e6, 0xd1f0, 0xd1e7, 0xd1e2, 0xd1dc, 0xd1dd, 0xd1ea, 0xd1e4, - 0x9ce3, 0xfda9, 0xaed6, 0xaeda, 0xd1f2, 0xd1de, 0xaee6, 0xaee2, - 0xfc44, 0xaee5, 0xaeec, 0xaedb, 0xaee7, 0xd1e9, 0xaee9, 0xaed8, - 0x9640, 0xaed7, 0xd1db, 0x8db8, 0xd1df, 0xaee0, 0xd1f1, 0xd1e8, - 0xd1e0, 0xaee4, 0xaee1, 0xaed9, 0xaedc, 0x9b4a, 0x8fb9, 0xfcfe, - 0x896a, 0xd5c4, 0xd5b4, 0xd5b5, 0xd5b9, 0xd5c8, 0xd5c5, 0xd5be, - 0xd5bd, 0xb1ed, 0xd5c1, 0xd5d0, 0xd5b0, 0xd5d1, 0xd5c3, 0xd5d5, - 0xd5c9, 0xb1ec, 0xd5c7, 0xb1e7, 0xb1fc, 0xb1f2, 0x8db9, 0xb1f6, - 0xb1f5, 0xd5b1, 0x917e, 0xd5ce, 0xd5d4, 0xd5cc, 0xd5d3, 0xd5c0, - 0xd5b2, 0xd5d2, 0xd5c2, 0xb1ea, 0xb1f7, 0xd5cb, 0xb1f0, 0x93f4, - 0xd5ca, 0xd5b3, 0xb1f8, 0xb1fa, 0xd5cd, 0xb1fb, 0xb1e9, 0xd5ba, - 0xd5cf, 0xfb7c, 0xb1ef, 0xb1f9, 0xd5bc, 0xd5c6, 0xd5b7, 0xd5bb, - 0xb1f4, 0xd5b6, 0xb1e8, 0xb1f1, 0xb1ee, 0xd5bf, 0xaede, 0xd9c0, - 0xb1eb, 0x93e7, 0x97ef, 0xfe4a, 0xfd45, 0xb1f3, 0x96a5, 0xd9c3, - 0xd9d9, 0xd9ce, 0xb4d6, 0xfee0, 0xb4d1, 0xd9bd, 0xb4d2, 0xd9cd, - 0xd9c6, 0xd9d3, 0xb4ce, 0xd9ab, 0xd9d5, 0xb4c4, 0xd9b3, 0xb4c7, - 0xb4c6, 0xb4d7, 0xd9ad, 0xd9cf, 0xd9d0, 0xb4c9, 0xb4c5, 0xd9bb, - 0xb4d0, 0xd9b6, 0xd9d1, 0xb4cc, 0xd9c9, 0xd9d6, 0xd9b0, 0xd9b5, - 0xd9af, 0xb4cb, 0xd9c2, 0xddde, 0xd9b1, 0xb4cf, 0xd9ba, 0xd9d2, - 0xb4ca, 0xd9b7, 0xd9b4, 0xd9c5, 0xb4cd, 0xb4c3, 0xb4d9, 0xd9c8, - 0xd9c7, 0xfd48, 0xfd47, 0xfef2, 0xfe6a, 0xd9ac, 0xb4c8, 0xd9d4, - 0xd9bc, 0xd9be, 0x8dbd, 0xd9cb, 0xd9ca, 0xd9aa, 0xb4d3, 0xb4d5, - 0xd9b2, 0xd9b9, 0xd9c1, 0xb4d4, 0xd9b8, 0xd9c4, 0xd9d7, 0xd9cc, - 0x9ba1, 0x8ca2, 0x9ab7, 0x8efc, 0xd9d8, 0xd9ae, 0x9fa1, 0xddf2, - 0xb7a6, 0xddf0, 0xdddb, 0xdde0, 0xddd9, 0xfd51, 0xddec, 0xddcb, - 0xddd2, 0xddea, 0xddf4, 0xdddc, 0xfaad, 0xddcf, 0xdde2, 0xdde7, - 0xddd3, 0x8dbe, 0xdde4, 0xddd0, 0x89a4, 0xddd7, 0xddd8, 0xb7a8, - 0xddeb, 0xdde9, 0xddcc, 0xddee, 0xddef, 0xddf1, 0xb7ac, 0xb7a4, - 0x9ad9, 0xd5b8, 0xddd4, 0xdde6, 0xddd5, 0xb7a1, 0xb7b1, 0xdded, - 0xb7af, 0xb7ab, 0xddca, 0xb7a3, 0xfd4e, 0xddcd, 0xb7b0, 0x8dc0, - 0xdddd, 0xddc9, 0x97f0, 0xb7a9, 0xdde1, 0xddd1, 0xb7aa, 0xddda, - 0xb77e, 0xb4d8, 0xdde3, 0xd9bf, 0xddce, 0x93b4, 0xfd44, 0xdde8, - 0xb7a5, 0xdde5, 0xb7a2, 0xdddf, 0xb7ad, 0xddd6, 0xddf3, 0x9fa7, - 0xb7a7, 0xdec6, 0x8dc2, 0xb7ae, 0x99b6, 0xe24a, 0xe248, 0xe25e, - 0xe246, 0xe258, 0xb77d, 0xba5f, 0xe242, 0xe25d, 0xfd52, 0xe247, - 0xe255, 0xba64, 0xba5d, 0xe25b, 0x8dc1, 0xe240, 0xe25a, 0x8e46, - 0xba6f, 0xe251, 0xe261, 0xba6d, 0xe249, 0xba5e, 0xe24b, 0xe259, - 0xba67, 0xe244, 0xba6b, 0xba61, 0xe24d, 0xe243, 0xe1fc, 0xa0d1, - 0xe257, 0xba68, 0xe260, 0xe1fd, 0xba65, 0xe253, 0xba66, 0xe245, - 0xe250, 0xe24c, 0xe24e, 0x9fca, 0xba60, 0xe25f, 0xba6e, 0xe24f, - 0xe262, 0xe1fe, 0xe254, 0xba63, 0xba6c, 0xba6a, 0xe241, 0xe256, - 0xba69, 0x92cf, 0xba62, 0xe252, 0x9cf4, 0x8dc4, 0xe25c, 0xfd41, - 0xe5d5, 0xe5d1, 0xe5cd, 0xe5e1, 0xe5de, 0xbccd, 0x9b4c, 0xe5e5, - 0xe5d4, 0xbcd8, 0xe5db, 0xe5d0, 0xe5da, 0xbcd5, 0xe5ee, 0xe5eb, - 0xe5dd, 0xe5ce, 0xfd57, 0xfcef, 0xe5e2, 0xe5e4, 0xbcd1, 0xe5d8, - 0xe5d3, 0xe5ca, 0xbcce, 0xbcd6, 0x9cde, 0xe5e7, 0xbcd7, 0xe5cb, - 0xe5ed, 0xe5e0, 0xe5e6, 0xbcd4, 0xfd42, 0x986c, 0xe5e3, 0xe5ea, - 0xbcd9, 0xbcd3, 0xe5dc, 0xe5cf, 0xe5ef, 0xe5cc, 0xe5e8, 0xbcd0, - 0x97f9, 0xe5d6, 0x9558, 0xe5d7, 0xbccf, 0xbccc, 0xe5d2, 0xbcd2, - 0xbccb, 0xe5e9, 0xe5ec, 0xe5d9, 0xe9ca, 0x985e, 0xfe7b, 0x94cd, - 0xe9c2, 0x93ee, 0xe9be, 0xbef6, 0xbeeb, 0xbef0, 0xbeec, 0xe9cc, - 0xe9d7, 0xbeea, 0xe9c4, 0xe9cd, 0xe5df, 0xe9ce, 0x8ca3, 0xbef1, - 0xfd5a, 0xe9dd, 0xbef5, 0xbef8, 0xe9c0, 0xbef4, 0x93f5, 0xe9db, - 0xe9dc, 0xe9d2, 0xe9d1, 0xe9c9, 0x93ef, 0x8eea, 0xe9d3, 0xe9da, - 0xe9d9, 0x8f5b, 0xbeef, 0xbeed, 0xe9cb, 0xe9c8, 0xe9c5, 0xe9d8, - 0xbef7, 0xe9d6, 0xbef3, 0xbef2, 0x8c5e, 0xe9d0, 0x8dc6, 0xe9bf, - 0xe9c1, 0xe9c3, 0xe9d5, 0xe9cf, 0xbeee, 0xe9c6, 0xe9d4, 0x8dc8, - 0x8dc7, 0xe9c7, 0x93f7, 0xc0cf, 0xed45, 0xc0c8, 0xecf5, 0x8dc9, - 0xed41, 0xc0ca, 0xed48, 0xecfc, 0xecf7, 0xfbf2, 0xed49, 0xecf3, - 0xecfe, 0x9670, 0xc0d1, 0xed44, 0xed4a, 0xecfd, 0xc0c9, 0xed40, - 0xecf4, 0xc0d0, 0x8dcb, 0xed47, 0xecf9, 0xc0cc, 0xfd5c, 0xecfb, - 0xecf8, 0xc0d2, 0xecfa, 0xc0cb, 0xc0ce, 0xed43, 0xecf6, 0xed46, - 0x8f65, 0xed42, 0x8dcd, 0xc263, 0xefe7, 0xc268, 0xc269, 0x9da8, - 0x94f9, 0xc262, 0xefe6, 0x8dce, 0xefe3, 0xefe4, 0xc266, 0xefde, - 0xefe2, 0xc265, 0xefdf, 0x93ea, 0xc267, 0xc264, 0xefdd, 0xefe1, - 0xefe5, 0xfd5f, 0x93f0, 0x9fb6, 0xf251, 0xf24e, 0xf257, 0xf256, - 0xf254, 0xf24f, 0xc372, 0x8dcf, 0x9763, 0xf250, 0xc371, 0xc0cd, - 0xf253, 0xc370, 0xf258, 0xf252, 0xf24d, 0xefe0, 0xc36f, 0xf24c, - 0xf456, 0xf455, 0xf255, 0xc468, 0xf459, 0xf45a, 0xf454, 0xf458, - 0xf453, 0x8dd0, 0xf5d1, 0xf457, 0xc4e7, 0xc4e5, 0xf5cf, 0xf5d2, - 0xf5ce, 0xf5d0, 0xc4e6, 0x93f1, 0xf6e5, 0xf6e6, 0xc576, 0xf6e4, - 0xf7e2, 0xc5cf, 0xf7e0, 0xf7e1, 0xf8ac, 0xc656, 0xf8f3, 0xf8f1, - 0xf8f2, 0xf8f4, 0xfd62, 0xf9bb, 0xa4ed, 0xa6b8, 0xaa59, 0xcce9, - 0xcf64, 0xd1f5, 0xd1f7, 0xd1f6, 0xd1f8, 0xb1fd, 0xd5d7, 0xd1f9, - 0xfd65, 0xd5d6, 0xd5d8, 0xd5d9, 0xd9da, 0xb4db, 0xd9db, 0xd9dd, - 0xb4dc, 0xb4da, 0xd9dc, 0xddfa, 0xddf8, 0xddf7, 0xddf6, 0xddf5, - 0xb7b2, 0xddf9, 0xba70, 0xe263, 0xe265, 0xba71, 0xe264, 0xbcdb, - 0xbcda, 0xe5f0, 0x9fdb, 0xe9df, 0xe9de, 0xe9e0, 0x93f8, 0xbef9, - 0xed4b, 0xc0d3, 0xefe8, 0xc26a, 0xf259, 0xc577, 0xa4ee, 0xa5bf, - 0xa6b9, 0xa842, 0xaa5a, 0xaa5b, 0xac6e, 0xd1fa, 0x8bf7, 0xb7b3, - 0xfd66, 0xe6d1, 0xbefa, 0xc26b, 0xa4ef, 0x8bcf, 0xa6ba, 0xcceb, - 0xaa5c, 0xccea, 0x8dd1, 0xcf65, 0xac6f, 0xcf66, 0xac70, 0xd1fc, - 0xaeee, 0xaeed, 0xd5de, 0xd5dc, 0xd5dd, 0xd5db, 0xd5da, 0xd9de, - 0xd9e1, 0xb4de, 0xd9df, 0xb4dd, 0xd9e0, 0xddfb, 0xe266, 0xe267, - 0xe268, 0xe5f3, 0xe5f2, 0xbcdc, 0xe5f1, 0xe5f4, 0xe9e1, 0xe9e2, - 0xe9e3, 0xed4c, 0xc0d4, 0xc26c, 0xf25a, 0xc4e8, 0xc95f, 0xac71, - 0xcf67, 0xaeef, 0xb1fe, 0xb4df, 0xd9e2, 0xb7b5, 0xb7b4, 0x8dd2, - 0xe269, 0xe26a, 0xbcdd, 0xbcde, 0xe9e5, 0xe9e4, 0xefe9, 0xf7e3, - 0xa4f0, 0xc960, 0xa5c0, 0xa843, 0xcb48, 0xac72, 0xb7b6, 0xa4f1, - 0xcf68, 0xac73, 0xcf69, 0xc0d5, 0xa4f2, 0xfd71, 0xccec, 0xcf6a, - 0xfd6f, 0xd242, 0xd241, 0xd1fe, 0xd1fd, 0xd243, 0xd240, 0x8dd3, - 0xb240, 0xb241, 0xb4e0, 0xd9e3, 0xd9e4, 0xd9e5, 0xde41, 0xde42, - 0xde40, 0x9fe7, 0xddfd, 0xddfe, 0xb7b7, 0xe26b, 0xe5f7, 0xe5f6, - 0xe5f5, 0xe5f8, 0xe9e7, 0xe9e6, 0xbefb, 0xe9e8, 0xc0d6, 0xed4d, - 0xefea, 0xf25b, 0xf6e7, 0xa4f3, 0xa5c2, 0xa5c1, 0xaa5d, 0xc961, - 0xc97e, 0xa6bb, 0xc9f7, 0xcb49, 0xcb4a, 0xaa5e, 0x90bd, 0xcced, - 0xac74, 0xcf6b, 0xcf6c, 0xaef0, 0xaef4, 0xd244, 0xaef3, 0xaef1, - 0xaef2, 0xd5df, 0xb242, 0xb4e3, 0xb4e1, 0xb4e2, 0xd9e6, 0x9fd0, - 0xba72, 0xa4f4, 0x8bd0, 0xc9a1, 0xfd72, 0xa5c3, 0x9cae, 0x8bd1, - 0xc9a4, 0x8adb, 0xa5c6, 0xc9a3, 0xa5c5, 0xa5c4, 0xa844, 0xc9a2, - 0xc9f8, 0xfae4, 0xc9fc, 0xc9fe, 0xca40, 0xa6c5, 0xa6c6, 0xc9fb, - 0xa6c1, 0xc9f9, 0xc9fd, 0xa6c2, 0xa6bd, 0x95ce, 0xa6be, 0xfd76, - 0xa6c4, 0xc9fa, 0xa6bc, 0xa845, 0xa6bf, 0xa6c0, 0xa6c3, 0xcb5b, - 0xcb59, 0xcb4c, 0xa851, 0xcb53, 0xa84c, 0xcb4d, 0xcb55, 0xfb62, - 0xcb52, 0xa84f, 0xcb51, 0xa856, 0xcb5a, 0xa858, 0x8dd4, 0xa85a, - 0xcb4b, 0xfd78, 0xa84d, 0xcb5c, 0xa854, 0xa857, 0x8ee3, 0xcd45, - 0xa847, 0xa85e, 0xa855, 0xcb4e, 0xa84a, 0xa859, 0xcb56, 0xa848, - 0xa849, 0xcd43, 0xcb4f, 0xa850, 0xa85b, 0xcb5d, 0xcb50, 0xa84e, - 0xa853, 0xccee, 0xa85c, 0xcb57, 0xa852, 0xa85d, 0xa846, 0xcb54, - 0xa84b, 0xcb58, 0xcd44, 0x9076, 0x98c6, 0x8dd5, 0xaa6a, 0xaa7a, - 0xccf5, 0xaa71, 0x97d1, 0xcd4b, 0xaa62, 0x9eb6, 0xaa65, 0xcd42, - 0xccf3, 0xccf7, 0xaa6d, 0xaa6f, 0xccfa, 0xaa76, 0xaa68, 0xaa66, - 0xaa67, 0xaa75, 0xcd47, 0xaa70, 0xccf9, 0xccfb, 0xaa6e, 0xaa73, - 0xccfc, 0xcd4a, 0xac75, 0xaa79, 0xfac7, 0xaa63, 0xcd49, 0xa042, - 0xcd4d, 0xccf8, 0xcd4f, 0xcd40, 0xaa6c, 0xccf4, 0xaa6b, 0xaa7d, - 0xaa72, 0xccf2, 0xcf75, 0xaa78, 0xaa7c, 0xcd41, 0xcd46, 0x9873, - 0xaa7e, 0xaa77, 0xaa69, 0xaa5f, 0xaa64, 0xccf6, 0xaa60, 0xcd4e, - 0x9ffc, 0xccf0, 0xccef, 0xccfd, 0xccf1, 0xaa7b, 0xaef5, 0xaa74, - 0xccfe, 0xaa61, 0xaca6, 0xcd4c, 0x8ca5, 0xcf7c, 0xcfa1, 0x8dd7, - 0xcfa4, 0xcf77, 0x92fb, 0x8dd8, 0xcfa7, 0xcfaa, 0xcfac, 0xcf74, - 0xac76, 0xac7b, 0xd249, 0xacad, 0xcfa5, 0xcfad, 0xcf7b, 0xcf73, - 0xd264, 0xac7e, 0xcfa2, 0xcf78, 0xcf7a, 0xaca5, 0xcf7d, 0xac7d, - 0xcf70, 0xcfa8, 0xcfab, 0x944f, 0xac7a, 0x8dd9, 0xaca8, 0xcf6d, - 0xacaa, 0xac78, 0xacae, 0xcfa9, 0xcf6f, 0xacab, 0xd25e, 0xcd48, - 0xac7c, 0xac77, 0xcf76, 0xcf6e, 0xacac, 0xaca4, 0xcfa3, 0xaca9, - 0xaca7, 0xcf79, 0xaca1, 0xcf71, 0xaca2, 0xaca3, 0xcf72, 0xcfa6, - 0xac79, 0xcf7e, 0x896b, 0x97ce, 0xd24c, 0xaefd, 0xaf43, 0xfaf3, - 0xfdae, 0xd255, 0xd25b, 0xd257, 0xd24a, 0xd24d, 0xd246, 0xd247, - 0xaf4a, 0xaefa, 0xd256, 0xd25f, 0xaf45, 0xaef6, 0xaf40, 0xd24e, - 0xaf42, 0xd24f, 0xd259, 0xfbaf, 0x92b7, 0xaf44, 0xd268, 0xd248, - 0xaefc, 0xaefb, 0xaf48, 0xd245, 0xd266, 0xd25a, 0xd267, 0xd261, - 0xd253, 0xd262, 0x8dda, 0xd25c, 0xd265, 0xd263, 0xaf49, 0xd254, - 0xaef9, 0xaef8, 0xaf41, 0xaf47, 0xd260, 0xaf46, 0xd251, 0xb243, - 0x9c5a, 0xd269, 0xd250, 0xd24b, 0xaefe, 0xaf4b, 0xaef7, 0xfdad, - 0xd258, 0xd25d, 0x8ddc, 0x9444, 0xb265, 0xd5e1, 0xd5e5, 0xb252, - 0xb250, 0x8ddd, 0xb247, 0xd5e3, 0xd5e2, 0xb25b, 0xd5e8, 0xb255, - 0xa0d6, 0xd5fa, 0xd647, 0xb244, 0xd5f7, 0xd5f0, 0xb267, 0xd5e0, - 0xd5fc, 0xb264, 0xb258, 0xb263, 0xb24e, 0xd5ec, 0xd5fe, 0xd5f6, - 0xb24f, 0xb249, 0xd645, 0xd5fd, 0xd640, 0xb251, 0xb259, 0xd642, - 0xd5ea, 0xd5fb, 0xd5ef, 0xd644, 0xb25e, 0xb246, 0xb25c, 0xd5f4, - 0xd5f2, 0xd5f3, 0xb253, 0xd5ee, 0xd5ed, 0xb248, 0xd5e7, 0xd646, - 0xb24a, 0xd5f1, 0xb268, 0xb262, 0xd5e6, 0xb25f, 0xb25d, 0xb266, - 0xd5f8, 0xb261, 0xd252, 0xd5f9, 0xb260, 0xd641, 0xb245, 0xd5f5, - 0xb257, 0xd5e9, 0xb256, 0xb254, 0xb24c, 0xb24b, 0xd9e7, 0xd643, - 0x8c41, 0xd5eb, 0x97d5, 0xd9fc, 0x944a, 0xb24d, 0x944d, 0x97cb, - 0x8dde, 0x8ddf, 0xb541, 0xb25a, 0xb4ee, 0xd9f6, 0xb4fc, 0xd9ea, - 0xb4eb, 0xb4e7, 0xda49, 0xb4ed, 0xb4f1, 0xb4ec, 0xb4f5, 0xda4d, - 0xda44, 0x8de0, 0xfef9, 0xd9f1, 0xb4fa, 0xb4f4, 0xd9fd, 0xb4e4, - 0xda4a, 0xda43, 0xb4e8, 0xd9f7, 0xb4f7, 0xda55, 0xda56, 0xb4e5, - 0xda48, 0xb4f9, 0xd9fb, 0xd9ed, 0xd9ee, 0xb4fd, 0xd9f2, 0xd9f9, - 0xd9f3, 0xb4fb, 0xb544, 0xd9ef, 0xd9e8, 0xd9e9, 0xd9eb, 0xb4ea, - 0xd9f8, 0xb4f8, 0xb542, 0xfdc0, 0xfcf9, 0xd9fa, 0xda53, 0xda4b, - 0xb4e6, 0xda51, 0xb4f2, 0xb4f0, 0xfb7e, 0xda57, 0xb4ef, 0xda41, - 0xd9f4, 0xd9fe, 0xb547, 0xda45, 0xda42, 0xd9f0, 0xb543, 0xda4f, - 0xda4c, 0xda54, 0xb4e9, 0xda40, 0xb546, 0xda47, 0xb4f3, 0xb4f6, - 0xda46, 0xb545, 0xd9f5, 0xd5e4, 0x92b3, 0xda50, 0xda4e, 0xda52, - 0xfdaf, 0x8de1, 0xd9ec, 0xb540, 0x95d3, 0xde61, 0xde60, 0xde46, - 0xb7bd, 0xde5f, 0xde49, 0xde4a, 0xb7c7, 0xde68, 0xb7c2, 0xde5e, - 0x89c1, 0xde43, 0xb7c8, 0xb7be, 0xde52, 0xde48, 0xde4b, 0xde63, - 0xb7b8, 0xde6a, 0xde62, 0xb7c1, 0xde57, 0xb7cc, 0xb7cb, 0xb7c5, - 0xde69, 0xb7b9, 0xde55, 0xde4c, 0xde59, 0xde65, 0xb7cd, 0xfd68, - 0xb7bb, 0xde54, 0x9cb7, 0xde4d, 0xb7c4, 0x8de3, 0xb7c3, 0xde50, - 0xde5a, 0xde64, 0xde47, 0xde51, 0xb7bc, 0xde5b, 0xb7c9, 0xb7c0, - 0xde4e, 0xb7bf, 0xde45, 0xde53, 0xde67, 0xb4fe, 0xbab0, 0xde56, - 0xe26c, 0xde58, 0xde66, 0xb7c6, 0xde4f, 0xb7ba, 0xb7ca, 0xbcf0, - 0xde44, 0xde5d, 0xfac0, 0x8de5, 0xfa64, 0xde5c, 0x8947, 0x8de4, - 0x8de7, 0x8de8, 0xe2aa, 0xbaad, 0xe27d, 0xe2a4, 0xbaa2, 0xe26e, - 0xbaaf, 0xba77, 0xe26d, 0xe2b0, 0xbab1, 0xe271, 0xe2a3, 0xfdc7, - 0xe273, 0xe2b3, 0xe2af, 0xba75, 0xbaa1, 0xe653, 0xbaae, 0xba7d, - 0xe26f, 0xfdb0, 0xe2ae, 0xbaa3, 0xe2ab, 0xe2b8, 0xe275, 0xe27e, - 0x9445, 0x97d6, 0xe2b6, 0xe2ac, 0xba7c, 0xe27c, 0xba76, 0xba74, - 0xbaa8, 0xfcc6, 0x9844, 0xe27a, 0xe277, 0xe278, 0xe2b2, 0xe2b7, - 0xe2b5, 0xba7a, 0xe2b9, 0xba7e, 0xbaa7, 0x8de9, 0xe270, 0xe5fa, - 0xe279, 0xba78, 0xbaac, 0xbaa9, 0xba7b, 0xe2a5, 0xe274, 0xbaaa, - 0xe2a7, 0xbaa4, 0xbaa6, 0xba73, 0x8dea, 0xe2a9, 0xe2a1, 0xe272, - 0xbaa5, 0xe2b1, 0xe2b4, 0xe27b, 0xe2a8, 0xfe50, 0xba79, 0xbcdf, - 0xe2a6, 0xe5f9, 0xe2ad, 0xfdcc, 0xe276, 0xe644, 0xe64e, 0xbce2, - 0xe64d, 0xe659, 0xbce4, 0xe64b, 0x9da7, 0xe64f, 0xbcef, 0xe646, - 0xbce7, 0xfdcd, 0xe652, 0xe9f0, 0xbcf3, 0xbcf2, 0xe654, 0xe643, - 0xe65e, 0xbced, 0xbce3, 0xe657, 0xe65b, 0xe660, 0xe655, 0xe649, - 0xbce6, 0xbce9, 0xbcf1, 0xbcec, 0xe64c, 0xe2a2, 0xfdcf, 0xe648, - 0xe65f, 0xbce8, 0x95d2, 0xbceb, 0xe661, 0xbce0, 0xe656, 0xe5fb, - 0xe65c, 0xc0df, 0x8ded, 0xe64a, 0xbce1, 0xe645, 0xbce5, 0xe5fc, - 0xbaab, 0xe641, 0xfcba, 0xe65a, 0xe642, 0xe640, 0xbcea, 0xe658, - 0xe5fe, 0xe651, 0xe650, 0xe65d, 0xe647, 0xbcee, 0xfdc5, 0xe9f3, - 0xfdd2, 0xbf49, 0xbefe, 0xea40, 0xe9eb, 0xbf41, 0xe9f7, 0xbf48, - 0xbf43, 0xe9f5, 0xed4f, 0xe9fb, 0xea42, 0xe9fa, 0xe9e9, 0xe9f8, - 0xea44, 0xea46, 0xbefd, 0xea45, 0xbf44, 0xbf4a, 0x9cdc, 0xbf47, - 0xe9fe, 0xbf46, 0xe9f9, 0x95cf, 0xe9ed, 0xe9f2, 0x8dee, 0xe9fd, - 0xbf45, 0xbf42, 0xbefc, 0xbf40, 0xe9f1, 0xe5fd, 0xe9ec, 0xe9ef, - 0xea41, 0xe9f4, 0xe9ea, 0xed4e, 0xea43, 0xe9ee, 0xe9fc, 0xfdd4, - 0xed51, 0xc0e3, 0xc0d7, 0x96ec, 0x96eb, 0xc0db, 0xed53, 0xed59, - 0xed57, 0xc0d9, 0xc0da, 0xc0e1, 0xed5a, 0xed52, 0xc0dc, 0xed56, - 0xed55, 0xed5b, 0xc0e2, 0xc0dd, 0xc0e0, 0xed54, 0xc0e4, 0xc0de, - 0xc0e5, 0xc0d8, 0xed58, 0xed50, 0x90b6, 0xeff7, 0xfdc3, 0xc271, - 0xeff4, 0xeff6, 0xc26f, 0xeff2, 0xeff3, 0xefee, 0x98ab, 0xe9f6, - 0xefef, 0xc270, 0xefeb, 0xc26d, 0xeff8, 0xc26e, 0xefec, 0xefed, - 0xeff1, 0xc273, 0xc272, 0xeff0, 0xc378, 0xf25f, 0xf265, 0xc379, - 0xf25c, 0xc376, 0xc373, 0xf267, 0xc377, 0x96ee, 0xc374, 0xf25e, - 0xf261, 0xf262, 0xf263, 0xf266, 0xeff5, 0xf25d, 0xc375, 0xf264, - 0xf268, 0xf260, 0x8df4, 0xf45d, 0xc46a, 0xf460, 0xc46b, 0xf468, - 0xf45f, 0xf45c, 0xf45e, 0xf462, 0xf465, 0xf464, 0xf467, 0xf45b, - 0xc469, 0xf463, 0xf466, 0xf469, 0xf461, 0xf5d3, 0xf5d4, 0xf5d8, - 0xf5d9, 0xf5d6, 0xf5d7, 0xf5d5, 0xfde0, 0xc4e9, 0x8c67, 0x8df6, - 0xc578, 0xf6eb, 0x8df7, 0xf6e8, 0xf6e9, 0xf6ea, 0xc579, 0xf7e5, - 0xf7e4, 0x8ffa, 0xf8af, 0xc5f4, 0xf8ad, 0xf8b0, 0xf8ae, 0xf8f5, - 0xc657, 0xc665, 0xf9a3, 0xf96c, 0x97d0, 0xf9a2, 0xf9d0, 0xf9d1, - 0xa4f5, 0x8bd2, 0x8df8, 0xa6c7, 0xca41, 0xcb5e, 0x90d9, 0xa85f, - 0x8c47, 0xa862, 0xfaf0, 0xcb5f, 0xa860, 0xa861, 0xfde1, 0x8df9, - 0xfde3, 0xcd58, 0xcd5a, 0xcd55, 0xcd52, 0xcd54, 0x8dfa, 0xaaa4, - 0xfb63, 0xaaa2, 0x90a6, 0xcd56, 0xaaa3, 0xcd53, 0xcd50, 0xaaa1, - 0xcd57, 0xcd51, 0xaaa5, 0xcd59, 0xcfaf, 0x9970, 0xcfb3, 0x91eb, - 0xacb7, 0x9770, 0x986f, 0xfde2, 0xcfb6, 0xacaf, 0xacb2, 0xacb4, - 0xacb6, 0xacb3, 0xcfb2, 0xcfb1, 0xacb1, 0xcfb4, 0xcfb5, 0xcfae, - 0xacb5, 0x98f2, 0xacb0, 0x9afc, 0x896c, 0xfdfd, 0xcfb0, 0x995e, - 0x95bd, 0xd277, 0xd278, 0xd279, 0xaf50, 0xaf4c, 0xd26e, 0xfde4, - 0xd276, 0xd27b, 0xaf51, 0x91e6, 0xd26c, 0xd272, 0xd26b, 0xd275, - 0xfde5, 0xfde6, 0xd271, 0xaf4d, 0xaf4f, 0xd27a, 0xd26a, 0xd26d, - 0xd273, 0xfde7, 0xd274, 0xd27c, 0xd270, 0xaf4e, 0xb26d, 0xd64e, - 0x9454, 0xd650, 0xd64c, 0x99b8, 0xd658, 0xd64a, 0xd657, 0xb269, - 0xd648, 0xda5b, 0xd652, 0xb26c, 0x97e9, 0xd653, 0xd656, 0xd65a, - 0xd64f, 0x9346, 0xd654, 0xb26a, 0xb26b, 0xd659, 0xd64d, 0xd649, - 0xd65b, 0xd651, 0xd655, 0xd64b, 0xb548, 0xb549, 0xda65, 0xb54f, - 0x9863, 0xda59, 0xda62, 0xda58, 0xb54c, 0xda60, 0xda5e, 0xda5f, - 0xb54a, 0xda63, 0x95bc, 0xfded, 0xfdf7, 0xda5c, 0xda5a, 0xb54b, - 0xda5d, 0xda61, 0x9870, 0x96f6, 0x8ea9, 0xb54d, 0xda64, 0x9451, - 0x8e43, 0x8b5a, 0xde70, 0xde77, 0xde79, 0xdea1, 0xfdee, 0xb7da, - 0xde6b, 0xb7d2, 0xfdf0, 0xde7a, 0xb7d7, 0xdea2, 0xb7ce, 0xfdf4, - 0xde7d, 0x9bf5, 0xde6d, 0xde7e, 0xde6c, 0xb7dc, 0xde78, 0xb7cf, - 0xdea3, 0xb7d4, 0xde71, 0xb7d9, 0xde7c, 0xde6f, 0xde76, 0xde72, - 0xde6e, 0xb7d1, 0xb7d8, 0xb7d6, 0xb7d3, 0xb7db, 0xb7d0, 0xde75, - 0x977e, 0xb7d5, 0xb54e, 0xde7b, 0x9bd5, 0xde73, 0x9ac3, 0x97c8, - 0xa0db, 0x91d0, 0xde74, 0x9fe4, 0xe2c1, 0x8fdd, 0xbab4, 0x91e9, - 0xe2bd, 0xe2c3, 0xe2bf, 0xbab6, 0xe2be, 0xe2c2, 0xe2ba, 0x98e0, - 0xe2bc, 0xbab5, 0x92ca, 0x9857, 0xe2c0, 0xe2bb, 0x8c51, 0xbab7, - 0xbab2, 0xfdeb, 0xe2c4, 0x9b49, 0xbab3, 0xe667, 0xe664, 0xe670, - 0xe66a, 0xe66c, 0xbcf4, 0xe666, 0xe66e, 0x9d76, 0x9eaf, 0xe66d, - 0xe66b, 0xe671, 0xbcf7, 0xe668, 0xe66f, 0xbcf5, 0x9ccc, 0xe663, - 0xe665, 0xbcf6, 0xe662, 0xe672, 0xfdea, 0xe669, 0x8df1, 0xea4a, - 0xbf51, 0xfdfb, 0xea55, 0xea53, 0xbf4b, 0xea49, 0xea4c, 0xea4d, - 0xea48, 0xbf55, 0xbf56, 0xea47, 0xea56, 0xea51, 0xbf4f, 0xbf4c, - 0xea50, 0xea4e, 0xbf52, 0xea52, 0xbf4d, 0x8e53, 0xbf4e, 0xea4f, - 0xbf50, 0xea4b, 0xea54, 0xbf53, 0xea57, 0xea58, 0xbf54, 0xfacf, - 0xc0e7, 0xc0ee, 0xed5c, 0xed62, 0xed60, 0xc0ea, 0xc0e9, 0xc0e6, - 0xed5e, 0x96f9, 0xc0ec, 0xc0eb, 0xc0e8, 0xed61, 0xed5d, 0xed5f, - 0xc0ed, 0x98bf, 0x9e49, 0xc277, 0xeffb, 0xc274, 0xc275, 0xeffd, - 0xc276, 0xeffa, 0x8ca7, 0xeff9, 0xf26c, 0xeffc, 0xf26d, 0xc37a, - 0xf26b, 0x9bca, 0xf26a, 0xf269, 0xc37b, 0xfdfe, 0x92dc, 0xc46c, - 0xf46a, 0xf46b, 0xfe41, 0x91cc, 0x91e2, 0xf5dc, 0xf5db, 0xc4ea, - 0xf5da, 0xf6ec, 0xf6ed, 0xf7e6, 0xf8b1, 0xfe44, 0xf8f6, 0xf9bc, - 0xc679, 0xf9c6, 0xa4f6, 0x8bd3, 0xaaa6, 0xaaa7, 0xfe47, 0xacb8, - 0xc0ef, 0xa4f7, 0xaaa8, 0xaf52, 0xb7dd, 0xa4f8, 0xb26e, 0xbab8, - 0xc962, 0xfe48, 0xcfb7, 0xd27d, 0xe2c5, 0xc0f0, 0xa4f9, 0xaaa9, - 0xcfb8, 0xcfb9, 0xda66, 0xb550, 0xdea4, 0x9455, 0xb7de, 0xe2c6, - 0xfe4b, 0xbcf8, 0xfe4c, 0xc37c, 0xa4fa, 0xda67, 0xa4fb, 0x8dbf, - 0xa6c9, 0xca42, 0xa6c8, 0xa865, 0xa864, 0xa863, 0xcb60, 0x9e78, - 0xaaaa, 0xaaab, 0xcd5b, 0xcfba, 0xcfbd, 0xacba, 0xcfbb, 0xacb9, - 0xcfbc, 0xacbb, 0xd2a2, 0xd2a1, 0xd27e, 0xaf53, 0xd65d, 0xd65e, - 0xb26f, 0xd65c, 0xd65f, 0xb552, 0xb270, 0xfe51, 0xb551, 0xda6b, - 0xda6a, 0x9456, 0xda68, 0xda69, 0xda6c, 0xdea6, 0xdea5, 0xdea9, - 0x9d61, 0xdea8, 0xdea7, 0xbab9, 0xe2c9, 0x9457, 0xe2c8, 0xbaba, - 0xe2c7, 0xe673, 0xe674, 0xbcf9, 0xea59, 0xea5a, 0x9966, 0xf272, - 0xc37d, 0xf271, 0xf270, 0xf26e, 0xf26f, 0xc4eb, 0xf46c, 0xf6ee, - 0xf8f7, 0xa4fc, 0x8bd5, 0xc9a5, 0xa5c7, 0xc9a6, 0xa069, 0xca43, - 0xca44, 0xcb66, 0xcb62, 0xcb61, 0xaaac, 0xcb65, 0xa867, 0xcb63, - 0xa866, 0xcb67, 0xcb64, 0xcd5f, 0xcfbe, 0xcd5d, 0xcd64, 0x98b4, - 0xaaad, 0xaab0, 0xcd65, 0xcd61, 0xcd62, 0xcd5c, 0xaaaf, 0xcd5e, - 0xaaae, 0xcd63, 0xcd60, 0xcfc2, 0xacbd, 0xacbe, 0xa049, 0xcfc5, - 0xcfbf, 0xcfc4, 0xcfc0, 0xacbc, 0xcfc3, 0xcfc1, 0xd2a8, 0xd2a5, - 0xd2a7, 0xaf58, 0xaf57, 0xaf55, 0xd2a4, 0xd2a9, 0xaf54, 0xaf56, - 0xd2a6, 0xd667, 0xd2a3, 0xd2aa, 0xa04c, 0x9e65, 0xd662, 0xd666, - 0xd665, 0xda6e, 0xda79, 0xd668, 0x98b5, 0xd663, 0xda6d, 0xb274, - 0xb273, 0xd661, 0xd664, 0xb275, 0xb272, 0xb271, 0xd660, 0xd669, - 0xda70, 0xda77, 0xb554, 0xda76, 0xda73, 0xfe58, 0xb556, 0x9975, - 0xfe53, 0xa065, 0xda75, 0xfe59, 0xda6f, 0xda71, 0xda74, 0xda72, - 0xb555, 0xda78, 0xb553, 0xb7df, 0x98b7, 0x98b8, 0xdead, 0xdeac, - 0xdeaa, 0xb7e2, 0xb7e1, 0xdeae, 0x98ba, 0xdeab, 0xe2ca, 0xbabb, - 0xb7e0, 0x98bb, 0xdeb0, 0xdeaf, 0xe2cd, 0xe2cb, 0xbcfa, 0x9fbc, - 0xbabc, 0xe2cc, 0xe676, 0xbcfb, 0xe675, 0xe67e, 0xe67d, 0xe67b, - 0xe67a, 0xe677, 0xe678, 0xe679, 0xe67c, 0xe6a1, 0xea5f, 0xea5c, - 0xea5d, 0xbf57, 0xea5b, 0xea61, 0xea60, 0xea5e, 0xed64, 0xed65, - 0xc0f1, 0xa04a, 0xc0f2, 0xed63, 0x9ec7, 0xc279, 0xeffe, 0xc278, - 0xc37e, 0xc3a1, 0xc46d, 0xf46e, 0xf46d, 0xf5dd, 0xf6ef, 0xc57a, - 0xf7e8, 0xf7e7, 0xf7e9, 0xa5c8, 0xcfc6, 0xaf59, 0xb276, 0xd66a, - 0xa5c9, 0xc9a7, 0xa4fd, 0x8ca9, 0xca45, 0x98ae, 0xcb6c, 0xcb6a, - 0xcb6b, 0xcb68, 0xa868, 0xcb69, 0x92d6, 0xfae1, 0xcd6d, 0x91d4, - 0xaab3, 0xcd6b, 0xcd67, 0xcd6a, 0xcd66, 0xaab5, 0xcd69, 0xfade, - 0xaab2, 0xaab1, 0xfe5b, 0xaab4, 0xcd6c, 0xcd68, 0xacc2, 0xacc5, - 0xcfce, 0xcfcd, 0xcfcc, 0xacbf, 0xcfd5, 0xcfcb, 0x8c53, 0xacc1, - 0xd2af, 0xcfd2, 0xcfd0, 0xacc4, 0xcfc8, 0xcfd3, 0xcfca, 0xcfd4, - 0xcfd1, 0xcfc9, 0xfe5e, 0xacc0, 0xcfd6, 0xcfc7, 0xacc3, 0xfbd7, - 0xfe5a, 0x94c5, 0xd2b4, 0xd2ab, 0xd2b6, 0xfaca, 0xd2ae, 0xd2b9, - 0xd2ba, 0xd2ac, 0xd2b8, 0xd2b5, 0xd2b3, 0xd2b7, 0xaf5f, 0xaf5d, - 0x98c1, 0x975c, 0xd2b1, 0xfe74, 0xd2ad, 0x9773, 0xd2b0, 0xd2bb, - 0xd2b2, 0xaf5e, 0xcfcf, 0xaf5a, 0xaf5c, 0xfa46, 0x9764, 0xd678, - 0xd66d, 0xd66b, 0xfe68, 0xd66c, 0x964e, 0xd673, 0x9765, 0xd674, - 0xd670, 0xb27b, 0xd675, 0xd672, 0xd66f, 0x8c5a, 0xb279, 0xd66e, - 0xb277, 0xb27a, 0xd671, 0xd679, 0xaf5b, 0xb278, 0xd677, 0xd676, - 0xb27c, 0x89a1, 0x95fa, 0x92d4, 0xfe69, 0xda7e, 0xfb45, 0x98c8, - 0xdaa1, 0xb560, 0x90ef, 0xdaa7, 0x98c9, 0x98ca, 0xdaa9, 0xdaa2, - 0xb55a, 0xdaa6, 0xdaa5, 0xb55b, 0xb561, 0xb562, 0xdaa8, 0xb558, - 0xda7d, 0xda7b, 0xdaa3, 0xda7a, 0xb55f, 0xda7c, 0xdaa4, 0xdaaa, - 0xb559, 0xb55e, 0xb55c, 0xb55d, 0x946d, 0x94b7, 0xfe6c, 0xb557, - 0x946b, 0xb7e9, 0xdeb7, 0xb7e8, 0xdebb, 0x92fc, 0xdeb1, 0x95eb, - 0xdebc, 0xfe73, 0x976e, 0xfe5f, 0xdeb2, 0xdeb3, 0xdebd, 0xdeba, - 0xdeb8, 0xdeb9, 0xdeb5, 0xdeb4, 0xfdbd, 0xdebe, 0xb7e5, 0x92d5, - 0xdeb6, 0xb7ea, 0xb7e4, 0xb7eb, 0xb7ec, 0xfeb9, 0xb7e7, 0xb7e6, - 0xfe71, 0xe2ce, 0xbabe, 0xbabd, 0xfbbb, 0xe2d3, 0x947a, 0xbcfc, - 0xbabf, 0x95fb, 0xfe77, 0xbac1, 0xe2d4, 0xb7e3, 0xbac0, 0xe2d0, - 0xe2d2, 0xe2cf, 0xfe79, 0xe2d1, 0xfe75, 0xe6ab, 0x945d, 0xe6aa, - 0xe6a7, 0xbd40, 0xea62, 0xbd41, 0xe6a6, 0xfe7c, 0xbcfe, 0xe6a8, - 0xe6a5, 0xe6a2, 0xe6a9, 0xe6a3, 0xe6a4, 0xbcfd, 0x9344, 0x8ea6, - 0xed69, 0xea66, 0xea65, 0xea67, 0xed66, 0xbf5a, 0x92d3, 0xea63, - 0x94b8, 0xbf58, 0xbf5c, 0xbf5b, 0xea64, 0xea68, 0xbf59, 0xfc71, - 0xed6d, 0xc0f5, 0xc27a, 0xc0f6, 0xc0f3, 0xed6a, 0xed68, 0xed6b, - 0xed6e, 0xc0f4, 0xed6c, 0xed67, 0x975e, 0xf042, 0xf045, 0xf275, - 0xf040, 0x8cad, 0xf46f, 0xf046, 0xc3a2, 0xf044, 0xc27b, 0xf041, - 0xf043, 0xf047, 0xf276, 0xf274, 0xfea7, 0xc3a3, 0xf273, 0x946a, - 0xc46e, 0x93e3, 0x98cf, 0xc4ed, 0xf6f1, 0xc4ec, 0xf6f3, 0xf6f0, - 0xf6f2, 0xc5d0, 0xf8b2, 0xa5ca, 0xcd6e, 0xd2bc, 0xd2bd, 0xb27d, - 0xdebf, 0xbf5d, 0xc3a4, 0xc57b, 0xf8b3, 0xa5cb, 0xa0d9, 0xcd6f, - 0xa260, 0xcfd7, 0xcfd8, 0xa0bf, 0xa04d, 0xa0b8, 0xd2be, 0xd2bf, - 0xb27e, 0xb2a1, 0xa0ce, 0xdaab, 0xdec2, 0xdec1, 0xdec0, 0xe2d5, - 0xe2d6, 0xe2d7, 0xbac2, 0xa0b7, 0xe6ad, 0xe6ac, 0xea69, 0xbf5e, - 0xbf5f, 0xfea9, 0xed72, 0xed6f, 0xed70, 0xed71, 0xf049, 0xf048, - 0xc27c, 0xf277, 0xf5de, 0xa5cc, 0x89c3, 0xacc6, 0xb2a2, 0xdec3, - 0xfeab, 0xa5cd, 0xd2c0, 0xb2a3, 0xb563, 0xb564, 0xa5ce, 0xa5cf, - 0xca46, 0xa86a, 0xa869, 0xacc7, 0xcfd9, 0xdaac, 0xa5d0, 0xa5d1, - 0xa5d2, 0xa5d3, 0x9df4, 0x896d, 0xa86b, 0xa86c, 0xcb6e, 0xcb6d, - 0x9c7b, 0xaab6, 0xcd72, 0xcd70, 0xcd71, 0x98d2, 0x9fa9, 0xcfda, - 0xcfdb, 0xfeb2, 0xaccb, 0xacc9, 0xfeb1, 0xacca, 0xacc8, 0x97d9, - 0xa0c4, 0xaf60, 0x9476, 0xaf64, 0xaf63, 0xd2c1, 0xaf62, 0xaf61, - 0xd2c2, 0x9978, 0xb2a6, 0xd67b, 0xd67a, 0xb2a4, 0xb2a5, 0xfeb3, - 0xb566, 0xb565, 0xdaae, 0x98d3, 0xfeb4, 0xdaad, 0xb2a7, 0x98d4, - 0xb7ed, 0xdec5, 0xb7ee, 0xdec4, 0x9fb9, 0xe2d8, 0xe6ae, 0xbd42, - 0xea6a, 0x9471, 0xed73, 0xc3a6, 0xc3a5, 0xc57c, 0xa5d4, 0xcd73, - 0x98d5, 0xfeb8, 0xb2a8, 0xe2d9, 0xbac3, 0xc6d4, 0xcb6f, 0xcb70, - 0xcd74, 0xaab8, 0xaab9, 0xaab7, 0xfeba, 0xaccf, 0xacd0, 0xaccd, - 0xacce, 0xcfdc, 0xcfdd, 0xaccc, 0xd2c3, 0x9e5c, 0xaf68, 0xaf69, - 0xfebb, 0xb2ab, 0xd2c9, 0xaf6e, 0xaf6c, 0xd2ca, 0xd2c5, 0xaf6b, - 0xaf6a, 0xaf65, 0xd2c8, 0xd2c7, 0xd2c4, 0xaf6d, 0xa044, 0xd2c6, - 0xaf66, 0xaf67, 0x98d7, 0xb2ac, 0xd6a1, 0xd6a2, 0xb2ad, 0xd67c, - 0xd67e, 0xd6a4, 0xd6a3, 0xd67d, 0xb2a9, 0xb2aa, 0xdab6, 0xb56b, - 0xb56a, 0xdab0, 0xb568, 0x98d8, 0xdab3, 0xb56c, 0xdab4, 0xb56d, - 0xdab1, 0xb567, 0xb569, 0xdab5, 0xdab2, 0xdaaf, 0xded2, 0xdec7, - 0xb7f0, 0xb7f3, 0xb7f2, 0xb7f7, 0xb7f6, 0xded3, 0xded1, 0xdeca, - 0xdece, 0xdecd, 0xb7f4, 0xded0, 0xdecc, 0xded4, 0xdecb, 0xb7f5, - 0xb7ef, 0xb7f1, 0xfebc, 0xdec9, 0x9ffe, 0xe2db, 0xbac7, 0xe2df, - 0xbac6, 0xe2dc, 0xbac5, 0xdec8, 0xdecf, 0xe2de, 0xbac8, 0xe2e0, - 0xe2dd, 0xe2da, 0xe6b1, 0xe6b5, 0xe6b7, 0xe6b3, 0xe6b2, 0xe6b0, - 0xbd45, 0xbd43, 0xbd48, 0xbd49, 0xe6b4, 0xbd46, 0xe6af, 0xbd47, - 0xbac4, 0xe6b6, 0xbd44, 0xfebd, 0xea6c, 0xea6b, 0xea73, 0xea6d, - 0xea72, 0xea6f, 0xbf60, 0xea71, 0xbf61, 0xbf62, 0x9ddd, 0xea70, - 0xea6e, 0x9ee1, 0xc0f8, 0xed74, 0xc0f7, 0xed77, 0xed75, 0xed76, - 0xc0f9, 0x98da, 0x9ddf, 0xfebf, 0xf04d, 0xfebe, 0xc2a1, 0xf04e, - 0x9eeb, 0xc27d, 0xf04f, 0xc27e, 0xf04c, 0xf050, 0xf04a, 0xc3a7, - 0xf278, 0xc3a8, 0xc46f, 0xf04b, 0xc470, 0x9e59, 0xa05c, 0xc4ee, - 0xf5df, 0xc57e, 0xf6f4, 0xc57d, 0xfec0, 0xf7ea, 0xc5f5, 0xc5f6, - 0x9477, 0x98dc, 0xf9cc, 0xfec1, 0xacd1, 0xcfde, 0x98de, 0xb56e, - 0xb56f, 0xa5d5, 0xa6ca, 0xca47, 0xcb71, 0xa86d, 0xaaba, 0xacd2, - 0xacd3, 0xacd4, 0xd6a6, 0xd2cb, 0xaf6f, 0xb2ae, 0xd6a5, 0xfec3, - 0xdab8, 0xb571, 0xdab7, 0xb570, 0xded5, 0xbd4a, 0xe6bb, 0xe6b8, - 0xe6b9, 0xe6ba, 0xfec8, 0xed78, 0xfec9, 0xf051, 0xf471, 0xf470, - 0xf6f5, 0xa5d6, 0xcd75, 0xaf70, 0xb572, 0xded6, 0xfeca, 0xe2e1, - 0xbd4b, 0xea74, 0xf052, 0xf472, 0xa5d7, 0xaabb, 0xacd7, 0xcfdf, - 0xacd8, 0xacd6, 0xacd5, 0xd2cc, 0xaf71, 0xfecb, 0xaf72, 0xaf73, - 0xb2b0, 0xd6a7, 0xb2af, 0x9fc2, 0x8c6b, 0xdab9, 0xb2b1, 0xb573, - 0xded7, 0xb7f8, 0xb7f9, 0xbac9, 0xbaca, 0xbd4c, 0xbf64, 0xea75, - 0xbf63, 0xed79, 0xc0fa, 0xf053, 0xf473, 0xa5d8, 0xa86e, 0xcd78, - 0xcd77, 0xaabc, 0xcd76, 0xaabd, 0xcd79, 0xcfe5, 0xacdb, 0xacda, - 0xcfe7, 0xcfe6, 0xacdf, 0xacde, 0xacd9, 0xcfe1, 0xcfe2, 0xcfe3, - 0xace0, 0xcfe0, 0xacdc, 0xcfe4, 0xacdd, 0x98c4, 0x94b0, 0x94b1, - 0xd2cf, 0xd2d3, 0xd2d1, 0xd2d0, 0xd2d4, 0xd2d5, 0xd2d6, 0xd2ce, - 0xd2cd, 0xfed1, 0xaf75, 0xaf76, 0xd2d7, 0xd2d2, 0xa0c1, 0xd6b0, - 0xfed2, 0xd2d8, 0xaf77, 0xaf74, 0xa0cd, 0xd6aa, 0xd6a9, 0xd6ab, - 0xd6ac, 0xd6ae, 0xd6ad, 0xd6b2, 0xb2b5, 0xb2b2, 0xb2b6, 0xd6a8, - 0xb2b7, 0xd6b1, 0xb2b4, 0xd6af, 0xb2b3, 0xfed3, 0x98e5, 0xdabc, - 0xdabe, 0xdaba, 0xdabb, 0xdabf, 0xdac1, 0xdac2, 0xdabd, 0xdac0, - 0xb574, 0xdedb, 0xdee0, 0xded8, 0xdedc, 0xfed6, 0xdee1, 0xdedd, - 0xb7fa, 0xb843, 0xb7fd, 0xded9, 0xdeda, 0xbace, 0xb846, 0xb7fe, - 0xb844, 0xb7fc, 0xdedf, 0xb845, 0xdede, 0xb841, 0xb7fb, 0xb842, - 0xdee2, 0xe2e6, 0xe2e8, 0x91e4, 0x8fc7, 0x94ae, 0xb840, 0x8a4f, - 0x94b2, 0xe2e3, 0xbacc, 0xe2e9, 0xbacd, 0xe2e7, 0xe2e2, 0xe2e5, - 0xe2ea, 0xbacb, 0xe2e4, 0xbd4e, 0xe6bf, 0xe6be, 0xbd51, 0xbd4f, - 0xe6bc, 0xbd4d, 0xe6bd, 0xbd50, 0x8fd4, 0xea7d, 0xeaa1, 0x98ea, - 0xea7e, 0xea76, 0xea7a, 0xea79, 0xea77, 0xbf66, 0xbf67, 0xbf65, - 0xea78, 0xea7b, 0xea7c, 0xbf68, 0xc140, 0xeda3, 0xc0fc, 0xed7b, - 0xc0fe, 0xc141, 0xfed8, 0xc0fd, 0xeda2, 0xed7c, 0xc0fb, 0xeda1, - 0xed7a, 0xed7e, 0xed7d, 0x9de0, 0xf055, 0xc2a4, 0xc2a5, 0xc2a2, - 0x98ee, 0xc2a3, 0xf054, 0x95c4, 0xf27b, 0xfce8, 0xc3a9, 0xf279, - 0xf27a, 0x98ef, 0xf474, 0xf477, 0xf475, 0xf476, 0xf5e0, 0xc4ef, - 0xf7eb, 0xf8b4, 0xc5f7, 0xf8f8, 0xf8f9, 0xc666, 0xa5d9, 0xace1, - 0x8c6e, 0xdac3, 0xdee3, 0xa5da, 0xa86f, 0xaabe, 0xfad8, 0xcfe8, - 0xcfe9, 0xaf78, 0xdac4, 0xb575, 0xb847, 0xc142, 0xeda4, 0xf27c, - 0xf478, 0xa5db, 0xfedc, 0xcda1, 0xcd7a, 0xcd7c, 0xcd7e, 0xcd7d, - 0xcd7b, 0xaabf, 0xa0ae, 0xace2, 0xcff2, 0xcfed, 0xcfea, 0x9d4c, - 0xcff1, 0xace4, 0xace5, 0xcff0, 0xcfef, 0xcfee, 0xcfeb, 0xcfec, - 0xcff3, 0xace3, 0x98f1, 0x98f3, 0xaf7c, 0x94c1, 0xafa4, 0xafa3, - 0xd2e1, 0xd2db, 0xd2d9, 0xafa1, 0xd6b9, 0xaf7a, 0xd2de, 0xd2e2, - 0xd2e4, 0xd2e0, 0xd2da, 0xafa2, 0xd2df, 0xd2dd, 0xaf79, 0xd2e5, - 0xafa5, 0xd2e3, 0xaf7d, 0xd2dc, 0xaf7e, 0xaf7b, 0x98f5, 0xfa4f, - 0x96e2, 0x9450, 0xb2b9, 0x96a2, 0xd6ba, 0x98f6, 0xd6b3, 0xd6b5, - 0xd6b7, 0x96e5, 0xd6b8, 0xd6b6, 0xb2ba, 0xd6bb, 0x98f7, 0xd6b4, - 0xa046, 0x96e3, 0xdac8, 0xb576, 0xdad0, 0xdac5, 0xdad1, 0xdac6, - 0xdac7, 0x98f8, 0xdacf, 0xdace, 0xdacb, 0xb2b8, 0xb577, 0xdac9, - 0xdacc, 0xb578, 0xdacd, 0xdaca, 0xdeee, 0x9ee4, 0xdef2, 0xb84e, - 0xe2f0, 0xb851, 0xdef0, 0xf9d6, 0xdeed, 0xdee8, 0xdeea, 0xdeeb, - 0xdee4, 0x94c3, 0xb84d, 0xb84c, 0x94c2, 0xb848, 0xdee7, 0xb84f, - 0xb850, 0xdee6, 0xdee9, 0xdef1, 0xb84a, 0xb84b, 0xdeef, 0xdee5, - 0xe2f2, 0xbad0, 0xe2f4, 0xdeec, 0xe2f6, 0xbad4, 0xe2f7, 0xe2f3, - 0xbad1, 0xe2ef, 0xbad3, 0xe2ec, 0xe2f1, 0xe2f5, 0xe2ee, 0xfee1, - 0xb849, 0xfee9, 0xe2eb, 0xbad2, 0xe2ed, 0x96e4, 0x89ac, 0x96db, - 0xbd54, 0xe6c1, 0xbd58, 0xbd56, 0xbacf, 0xe6c8, 0xe6c9, 0xbd53, - 0xfee2, 0xe6c7, 0xe6ca, 0xbd55, 0xbd52, 0xe6c3, 0xe6c0, 0xe6c5, - 0xe6c2, 0xbd59, 0xe6c4, 0x94c4, 0xfee3, 0xe6c6, 0xbd57, 0xfee7, - 0x9ffb, 0xbf6a, 0xeaa8, 0xeaa2, 0xeaa6, 0xeaac, 0xeaad, 0xeaa9, - 0xeaaa, 0xeaa7, 0x8c59, 0xeaa4, 0xbf6c, 0xbf69, 0xeaa3, 0xeaa5, - 0xbf6b, 0xeaab, 0x93c9, 0xc146, 0x94e8, 0xfb56, 0xedaa, 0xeda5, - 0xc145, 0x90c5, 0xc143, 0xedac, 0xc144, 0xeda8, 0xeda9, 0xeda6, - 0xedad, 0xf056, 0xc147, 0xeda7, 0xedae, 0xedab, 0xa0a8, 0xf05a, - 0xf057, 0xc2a6, 0xf05b, 0xf05d, 0xf05c, 0xf058, 0xf059, 0xf2a3, - 0xc3aa, 0xf27e, 0xf2a2, 0xf27d, 0xf2a4, 0xf2a1, 0xf47a, 0xf47d, - 0xf479, 0xc471, 0xf47b, 0xf47c, 0xf47e, 0xc472, 0xc474, 0xc473, - 0xf5e1, 0xfee5, 0xf5e3, 0xf5e2, 0x98fd, 0x98fb, 0xfee8, 0xf6f6, - 0x8ebf, 0xf8b5, 0xf8fa, 0xa5dc, 0x8bd8, 0xfef7, 0xcb72, 0xaac0, - 0xcda3, 0xaac1, 0xaac2, 0xcda2, 0xcff8, 0xcff7, 0xace6, 0xace9, - 0xace8, 0xace7, 0xcff4, 0xcff6, 0xcff5, 0xd2e8, 0xafa7, 0xd2ec, - 0xd2eb, 0xd2ea, 0xd2e6, 0xafa6, 0xafaa, 0xafad, 0x8f68, 0x94c6, - 0xafae, 0xd2e7, 0xd2e9, 0xafac, 0xafab, 0xafa9, 0xafa8, 0xd6c2, - 0x9dea, 0xd6c0, 0xd6bc, 0xb2bb, 0xd6bd, 0xb2bc, 0xd6be, 0xd6bf, - 0xd6c1, 0xb2bd, 0xdad5, 0xfc69, 0xdad4, 0xdad3, 0xdad2, 0xdef6, - 0xb852, 0xdef3, 0xdef5, 0x9cda, 0xb853, 0xfef3, 0xb854, 0xdef4, - 0x9c72, 0xfef0, 0x89c9, 0xe341, 0xe2f9, 0xe2fa, 0xbad7, 0xbad5, - 0xbad6, 0xe343, 0x9941, 0xe342, 0xe2fe, 0xe2fd, 0xe2fc, 0xe2fb, - 0xe340, 0xe2f8, 0x9942, 0xe6cb, 0xe6d0, 0xe6ce, 0xfef5, 0x91d7, - 0xe6cd, 0xe6cc, 0xe6cf, 0xeaae, 0x94cc, 0xbf6d, 0xc148, 0xedb0, - 0xfef8, 0xc149, 0xedaf, 0xf05f, 0xf05e, 0xc2a7, 0xf2a5, 0xc3ab, - 0xf4a1, 0xc5a1, 0xf6f7, 0xf8b7, 0xf8b6, 0xc9a8, 0xacea, 0xaceb, - 0xd6c3, 0xb856, 0xa5dd, 0xa872, 0xa871, 0xa870, 0x97a8, 0xcda4, - 0xfefc, 0xaac4, 0xaac3, 0xacee, 0xfdbf, 0xcffa, 0xcffd, 0xcffb, - 0xacec, 0xaced, 0xfefe, 0xcff9, 0xcffc, 0xafb5, 0xd2f3, 0xd2f5, - 0xd2f4, 0xafb2, 0xd2ef, 0x96d1, 0xafb0, 0xafaf, 0xafb3, 0xafb1, - 0xafb4, 0xd2f2, 0xd2ed, 0xd2ee, 0xd2f1, 0xd2f0, 0x94d5, 0x94d0, - 0xd6c6, 0xd6c7, 0xd6c5, 0xd6c4, 0xb2be, 0xb57d, 0xdad6, 0xdad8, - 0xdada, 0xb57c, 0x9944, 0xb57a, 0xdad7, 0xb57b, 0xdad9, 0xb579, - 0xdf41, 0xdef7, 0xdefa, 0xdefe, 0xb85a, 0xdefc, 0xdefb, 0xdef8, - 0xdef9, 0xb858, 0xdf40, 0xb857, 0xb85c, 0xb85b, 0xb859, 0xdefd, - 0xe349, 0xe348, 0x8c63, 0xe344, 0xa0b3, 0xbad8, 0xe347, 0xe346, - 0xbad9, 0xbd5e, 0xe6d2, 0x94cf, 0xbd5f, 0xbd5b, 0xbd5d, 0x9ffa, - 0xbd5a, 0xbd5c, 0x91e5, 0xeaaf, 0x9c6a, 0xbf70, 0xeab1, 0xeab0, - 0x8e49, 0xe345, 0xbf72, 0xbf71, 0xbf6e, 0xbf6f, 0xedb5, 0xedb3, - 0xc14a, 0xedb4, 0xedb6, 0xedb2, 0xedb1, 0xf060, 0xc2aa, 0xc2a8, - 0xc2a9, 0x8e4c, 0xf2a6, 0xf2a7, 0xc3ad, 0xc3ac, 0xf4a3, 0xf4a4, - 0xf4a2, 0xf6f8, 0xf6f9, 0xa5de, 0xca48, 0xa873, 0xcda5, 0xaac6, - 0xaac5, 0xcda6, 0x8e4d, 0xd040, 0xacef, 0xcffe, 0xacf0, 0x9a73, - 0xafb6, 0xd2f8, 0xd2f6, 0xd2fc, 0xafb7, 0xd2f7, 0xd2fb, 0xd2f9, - 0xd2fa, 0xd6c8, 0xd6ca, 0x9947, 0xb2bf, 0x8cb1, 0xd6c9, 0xb2c0, - 0xb5a2, 0xb5a1, 0xb57e, 0xdadb, 0xdf44, 0xb85d, 0xb85e, 0xdf43, - 0xdf42, 0xe34a, 0xbadb, 0xbada, 0xe34b, 0xe34c, 0xbd61, 0xbd60, - 0x8e50, 0xeab5, 0xe6d3, 0xe6d5, 0xe6d4, 0xeab4, 0xeab2, 0xeab6, - 0xeab3, 0xbf73, 0x8e4f, 0x9949, 0xedb7, 0xc14b, 0xedb8, 0xedb9, - 0x8e51, 0x8e52, 0xc2ab, 0xc2ac, 0xc475, 0x9ab2, 0x89a5, 0xc5d1, - 0xa5df, 0x994c, 0xd041, 0x9ff8, 0xd2fd, 0xafb8, 0x8e56, 0x994d, - 0x91ca, 0x8e57, 0xb3ba, 0xb3b9, 0x94e1, 0xb5a4, 0xdadd, 0xb5a3, - 0xdadc, 0x9047, 0x8fd8, 0x8e58, 0xdf45, 0xbadc, 0xe34d, 0xbadd, - 0xc476, 0xf4a5, 0xa6cb, 0xaac7, 0xcda7, 0xacf2, 0x94eb, 0xacf1, - 0xd042, 0xd043, 0xd340, 0xd342, 0xafb9, 0xd344, 0xd347, 0xd345, - 0x8e5c, 0x9553, 0xd346, 0xd343, 0xd2fe, 0xafba, 0xd348, 0xd341, - 0x9fe5, 0xd6d3, 0xb2c6, 0xd6dc, 0xb2c3, 0xd6d5, 0xb2c7, 0x9f56, - 0xb2c1, 0xd6d0, 0xd6dd, 0xd6d1, 0xd6ce, 0xb2c5, 0x954f, 0xb2c2, - 0x8e5e, 0xd6d4, 0xd6d7, 0xb2c4, 0xd6d8, 0xb2c8, 0xd6d9, 0xd6cf, - 0xd6d6, 0xd6da, 0xd6d2, 0xd6cd, 0xd6cb, 0xd6db, 0x996a, 0xdadf, - 0xdae4, 0x9c64, 0x9cd9, 0xdae0, 0xdae6, 0xb5a7, 0xd6cc, 0xdae1, - 0xb5a5, 0xdade, 0xb5ac, 0xdae2, 0xb5ab, 0xdae3, 0xb5ad, 0xb5a8, - 0xb5ae, 0xb5a9, 0xb5aa, 0x8e5d, 0xb5a6, 0xdae5, 0xb861, 0xdf50, - 0x9950, 0xdf53, 0xdf47, 0xdf4c, 0xdf46, 0xb863, 0xdf4a, 0x9951, - 0xdf48, 0xb862, 0x8e62, 0xdf4f, 0xdf4e, 0xdf4b, 0xdf4d, 0xdf49, - 0xbae1, 0xdf52, 0xb85f, 0xdf51, 0x9952, 0xe35d, 0xbae8, 0xe358, - 0xbae7, 0xe34e, 0xe350, 0xbae0, 0xe355, 0xe354, 0xe357, 0xbae5, - 0xe352, 0xe351, 0x8e68, 0xbae4, 0xbadf, 0xe353, 0xbae2, 0xe359, - 0xe35b, 0xe356, 0xe34f, 0xbae3, 0xbd69, 0xbade, 0x8e61, 0x9f59, - 0xe35c, 0xe6d9, 0xbd62, 0xe6db, 0xbd63, 0x8bb3, 0xbd65, 0xe6de, - 0xe6d6, 0xbae6, 0xe6dc, 0xe6d8, 0xb860, 0xbd68, 0xbd64, 0xbd66, - 0xbd67, 0xbf76, 0xe6dd, 0xe6d7, 0xbd6a, 0xe6da, 0x9f5d, 0x8e66, - 0xeac0, 0xeabb, 0xeac5, 0xbf74, 0xeabd, 0xbf78, 0xeac3, 0xeaba, - 0xeab7, 0xeac6, 0xc151, 0xbf79, 0xeac2, 0xeab8, 0xbf77, 0xeabc, - 0xbf7b, 0xeab9, 0xeabe, 0xbf7a, 0xeac1, 0xeac4, 0x8cb2, 0xedcb, - 0xedcc, 0xedbc, 0xedc3, 0xedc1, 0xc14f, 0xedc8, 0xeabf, 0x8e6e, - 0xedbf, 0x9f64, 0xedc9, 0xc14e, 0xedbe, 0xedbd, 0xedc7, 0xedc4, - 0xedc6, 0xedba, 0xedca, 0xc14c, 0xedc5, 0xedce, 0xedc2, 0xc150, - 0xc14d, 0xedc0, 0xedbb, 0xedcd, 0xbf75, 0x9953, 0xfab8, 0xf063, - 0x9954, 0xf061, 0xf067, 0xc2b0, 0xf065, 0xf064, 0xc2b2, 0xf06a, - 0xc2b1, 0xf06b, 0xf068, 0xc2ae, 0xf069, 0xf062, 0xc2af, 0xc2ad, - 0xf2ab, 0xf066, 0xf06c, 0xf2a8, 0x8e70, 0xc3b2, 0xc3b0, 0xf2aa, - 0xf2ac, 0xf2a9, 0xc3b1, 0xc3ae, 0xc3af, 0xc3b3, 0x9f61, 0xc478, - 0x8e72, 0xf4aa, 0xf4a9, 0xf4a7, 0xf4a6, 0xf4a8, 0xc477, 0xc479, - 0xc4f0, 0xa06b, 0xf5e5, 0xf5e4, 0x9f40, 0xf6fa, 0xf6fc, 0xf6fe, - 0xf6fd, 0xf6fb, 0x94ed, 0xc5a3, 0xc5a2, 0xc5d3, 0xc5d2, 0xc5d4, - 0xf7ed, 0xf7ec, 0xf8fb, 0xf8b8, 0xf8fc, 0xc658, 0x94ee, 0xc659, - 0xf96d, 0x9fbd, 0xc67e, 0xa6cc, 0x8e7b, 0xcda8, 0xd045, 0xd046, - 0xd044, 0x9957, 0x94f7, 0xacf3, 0x9f5f, 0xd047, 0xd048, 0xd049, - 0x8e73, 0xd349, 0xd34f, 0x9f62, 0xd34d, 0xafbb, 0xd34b, 0xd34c, - 0xd34e, 0x94f6, 0xd34a, 0xb2c9, 0xd6de, 0xb2cb, 0xd6e0, 0xb2ca, - 0xd6df, 0x9958, 0xdae8, 0xb5af, 0xdaea, 0xdae7, 0xd6e1, 0xb5b0, - 0x8e75, 0xf9db, 0xdae9, 0x9072, 0x94f8, 0xdf56, 0xb864, 0xdf54, - 0xb865, 0xdf55, 0xb866, 0x995a, 0xbae9, 0xe361, 0xe35e, 0xe360, - 0xbaea, 0xbaeb, 0xe35f, 0xa0b0, 0x8cb3, 0xe6df, 0x8e79, 0xe6e0, - 0x8e78, 0xbd6b, 0xe6e2, 0xe6e1, 0x94f3, 0xa261, 0xeaca, 0xeacb, - 0xeac7, 0x98af, 0xeac8, 0xbf7c, 0xbf7d, 0xeac9, 0xc157, 0xa0b2, - 0xc153, 0xc158, 0xc154, 0xc156, 0xc152, 0xc155, 0x8e7a, 0xc2b3, - 0xedcf, 0xf2ae, 0xf2ad, 0x995c, 0xf4ab, 0xc47a, 0xc47b, 0xf741, - 0xf5e6, 0x8e7c, 0xf740, 0x8e7d, 0xf8fd, 0xf9a4, 0xa6cd, 0x8bd9, - 0xa874, 0x89a2, 0xcda9, 0xaac8, 0xacf6, 0xd04c, 0xacf4, 0xd04a, - 0xacf9, 0xacf5, 0xacfa, 0xacf8, 0xd04b, 0xacf7, 0xafbf, 0xafbe, - 0xd35a, 0xafc7, 0xd353, 0xd359, 0xafc3, 0xd352, 0xd358, 0xd356, - 0xafc2, 0xafc4, 0xd355, 0xafbd, 0xd354, 0xafc8, 0xafc5, 0xafc9, - 0xafc6, 0xd351, 0xd350, 0xd357, 0xafc0, 0xafbc, 0xafc1, 0x9ed7, - 0xd6f0, 0xd6e9, 0xb5b5, 0xd6e8, 0xb2cf, 0xb2d6, 0xb2d3, 0xb2d9, - 0xb2d8, 0xb2d4, 0xd6e2, 0xd6e5, 0xd6e4, 0xb2d0, 0xd6e6, 0xd6ef, - 0xb2d1, 0xd6e3, 0xd6ec, 0xd6ed, 0xb2d2, 0xd6ea, 0xb2d7, 0xb2cd, - 0xb2d5, 0xd6e7, 0xb2cc, 0xd6eb, 0xd6ee, 0xa0b6, 0xdafb, 0xdaf2, - 0xb5b2, 0xdaf9, 0xdaf6, 0xdaee, 0xdaf7, 0xb5b4, 0xdaef, 0xdaeb, - 0x9e42, 0xb86c, 0xdaf4, 0x8ea4, 0xb5b1, 0xdafa, 0xb5b8, 0xb5ba, - 0xdaed, 0xb5b9, 0xdaf0, 0xb5b3, 0xdaf8, 0xdaf1, 0xdaf5, 0xdaf3, - 0xb5b6, 0xdaec, 0xb5bb, 0xb2ce, 0xb5b7, 0xb5bc, 0xb868, 0xdf5d, - 0xdf5f, 0xdf61, 0xdf65, 0xdf5b, 0xdf59, 0xb86a, 0xdf60, 0xdf64, - 0xdf5c, 0xdf58, 0xdf57, 0x8ea7, 0x8c76, 0xdf62, 0xdf5a, 0xdf5e, - 0xb86b, 0xb869, 0xdf66, 0xb867, 0xdf63, 0xe372, 0x9542, 0xbaee, - 0xe36a, 0xbd78, 0xe374, 0xbaf1, 0xe378, 0xbaf7, 0xe365, 0x987d, - 0xe375, 0xe362, 0x9755, 0xe377, 0xe366, 0x8ea8, 0xbafe, 0xbafb, - 0xe376, 0xe370, 0xbaed, 0xbaf5, 0xbaf4, 0x8eaa, 0xbaf3, 0xbaf9, - 0xe363, 0xbafa, 0xe371, 0xbaf6, 0xbaec, 0xe373, 0xbaef, 0xbaf0, - 0xbaf8, 0xe368, 0xe367, 0xe364, 0xe36c, 0xe369, 0xe36d, 0xbafd, - 0xe379, 0xbaf2, 0xe36e, 0xe36f, 0x89a3, 0xe36b, 0x9960, 0x9962, - 0xbafc, 0x94fc, 0x9961, 0xe6e7, 0xbd70, 0xbd79, 0xbd75, 0xe6e4, - 0x94fa, 0xbd72, 0xbd76, 0xe6f0, 0xbd6c, 0xe6e8, 0xbd74, 0x8eae, - 0x8eb2, 0xe6eb, 0xe6e6, 0xbd73, 0xbd77, 0xe6e5, 0xbd71, 0xe6ef, - 0xbd6e, 0xe6ee, 0xe6ed, 0xbd7a, 0xe572, 0xbd6d, 0x8eb0, 0xe6ec, - 0xe6e3, 0xbd7b, 0xe6ea, 0xbd6f, 0x9963, 0x97aa, 0xe6e9, 0x94fb, - 0xbfa2, 0xbfa7, 0xbf7e, 0xead8, 0xeacf, 0xeadb, 0xead3, 0xead9, - 0xbfa8, 0xbfa1, 0xeacc, 0xead2, 0xeadc, 0xead5, 0xeada, 0xeace, - 0xead6, 0xbfa3, 0xead4, 0xbfa6, 0xbfa5, 0xead0, 0xead1, 0xeacd, - 0xead7, 0xbfa4, 0xeade, 0xeadd, 0x8ebb, 0xedda, 0xedd6, 0xc15f, - 0xedd0, 0xc159, 0xc169, 0xeddc, 0xc161, 0xc15d, 0xedd3, 0xc164, - 0xc167, 0xedde, 0xc15c, 0xedd5, 0xc165, 0xede0, 0xeddd, 0xedd1, - 0xc160, 0xc15a, 0xc168, 0xedd8, 0xc163, 0xedd2, 0xc15e, 0xeddf, - 0xc162, 0xc15b, 0xedd9, 0xc166, 0xedd7, 0xeddb, 0xf06e, 0xf074, - 0xc2b9, 0xf077, 0xc2b4, 0xc2b5, 0xf06f, 0xf076, 0xf071, 0xc2ba, - 0xc2b7, 0x8cdc, 0xf06d, 0xc2b6, 0xf073, 0xf075, 0xc2b8, 0xf072, - 0xf070, 0x9876, 0x8ea1, 0xf2b8, 0xc3b7, 0xc3b8, 0xc3b4, 0x8cb4, - 0xc3b5, 0x8eb7, 0xf2b4, 0xf2b2, 0xf2b6, 0xc3ba, 0xf2b7, 0xf2b0, - 0xf2af, 0xf2b3, 0xf2b1, 0xc3b6, 0xf2b5, 0xf4ac, 0xc47e, 0xc47d, - 0xf4ad, 0x9da6, 0xf4af, 0xf4ae, 0xc4a1, 0xf5eb, 0xf5e8, 0xf5e9, - 0xf5e7, 0xf5ea, 0xc4f2, 0xf5ec, 0x9eb0, 0xc4f1, 0xf742, 0x8eb8, - 0xc5d5, 0xc5d7, 0xf7ee, 0xc5d6, 0xf8b9, 0xf940, 0xf942, 0xf8fe, - 0xf941, 0xc66c, 0x9d70, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, - 0x8973, 0x8974, 0xa6ce, 0x8975, 0xacfb, 0xd26f, 0xafca, 0xb2da, - 0xdafc, 0xdafd, 0x8ebc, 0x8ebd, 0xeadf, 0xc16a, 0xede1, 0x8ebe, - 0xc2bb, 0x9dd1, 0xf2ba, 0xf2b9, 0xc4a2, 0xf5ed, 0x94fd, 0xf743, - 0xc5f8, 0xca49, 0x8bd7, 0x8bda, 0xaac9, 0xa875, 0xd04d, 0xd360, - 0xd35b, 0xd35f, 0xd35d, 0xafcb, 0xd35e, 0xd35c, 0xd6f1, 0xdafe, - 0xdb40, 0xdf69, 0xdf6a, 0xb86e, 0xb86f, 0xdf68, 0xdf6b, 0xdf67, - 0xb86d, 0xbb40, 0xa0e2, 0xb870, 0xe37a, 0xbd7c, 0xe6f1, 0xbd7d, - 0x9fe9, 0xbfa9, 0xeae2, 0xeae0, 0xeae1, 0xede4, 0xede3, 0xede2, - 0xf2bb, 0xc3b9, 0xf2bc, 0xf744, 0xc5f9, 0xf8ba, 0xa6cf, 0xaacb, - 0xaaca, 0xd04f, 0xacfc, 0xfda8, 0xd04e, 0xd362, 0x8ae7, 0xafcc, - 0xd6f2, 0xd361, 0x8ec2, 0xb2dc, 0xd6f5, 0xd6f3, 0xd6f4, 0xb2db, - 0xdb42, 0xdb43, 0xdb41, 0x8ec4, 0xb873, 0xdf6d, 0xdf6c, 0xdf6e, - 0xb872, 0xb871, 0xe6f2, 0xe6f4, 0x9964, 0xbd7e, 0xe6f3, 0xeae3, - 0xbfaa, 0xf079, 0x9965, 0xf078, 0xc3bb, 0xf2bd, 0xc3bd, 0xc3bc, - 0xf4b0, 0xf5ee, 0xc4f3, 0xa6d0, 0xd050, 0xacfd, 0xd365, 0xafce, - 0xd364, 0xd363, 0xafcd, 0xd6fb, 0xd6fd, 0xd6f6, 0xd6f7, 0xb2dd, - 0xd6f8, 0xb2de, 0xd6fc, 0xd6f9, 0xd6fa, 0xb2df, 0xb5be, 0xb5bf, - 0xdb44, 0xdf6f, 0xdf70, 0x954e, 0xe37e, 0xbb43, 0xbb41, 0xbb42, - 0xe37b, 0xe37c, 0xe37d, 0xe6f9, 0x98b3, 0xe6fa, 0xbda1, 0xe6f7, - 0xe6f6, 0xe6f8, 0xe6f5, 0xbfad, 0xeae4, 0xbfab, 0xbfac, 0xede6, - 0xc16b, 0xede5, 0xefa8, 0xf07a, 0xf07b, 0xc2bc, 0x8ecb, 0xc2bd, - 0xc16c, 0xf2be, 0xf2bf, 0xf4b1, 0xc4a3, 0xa6d1, 0x8bdf, 0xa6d2, - 0xacfe, 0xaacc, 0xafcf, 0xd051, 0x8ece, 0xb5c0, 0xa6d3, 0xad41, - 0xd052, 0xd053, 0xad40, 0xad42, 0xa6d4, 0xd054, 0xafd1, 0xd366, - 0xafd3, 0xafd0, 0xafd2, 0xd741, 0xb2e0, 0x8ecf, 0xd740, 0xd6fe, - 0x9968, 0xdf71, 0xe3a1, 0x9969, 0xbda2, 0xbfae, 0xeae6, 0xeae5, - 0xede7, 0x996b, 0x8ed1, 0xf5ef, 0x996c, 0xa6d5, 0xcb73, 0xcdaa, - 0xad43, 0xd055, 0xd368, 0x8ed4, 0x8ed5, 0xafd4, 0xd367, 0xafd5, - 0xd743, 0xb2e2, 0xd742, 0xd744, 0xb2e1, 0xdb46, 0xdb47, 0xdb45, - 0xb5c1, 0x996d, 0xb874, 0xb875, 0xbb45, 0xa0be, 0xe3a3, 0xe3a2, - 0xbb44, 0x8ed6, 0xa0bc, 0xa0b5, 0xe6fb, 0xa0b4, 0xe6fc, 0xeae7, - 0xc170, 0xc16f, 0xc16d, 0xc16e, 0xc171, 0xf07c, 0xc2bf, 0xc2be, - 0xf2c0, 0xf4b2, 0xc5a5, 0xc5a4, 0xa6d6, 0x8be0, 0xd1fb, 0xb877, - 0xb5c2, 0xb876, 0xbb46, 0xa6d7, 0xc9a9, 0xa6d8, 0xa6d9, 0xcdab, - 0xcb76, 0xcb77, 0xa877, 0xcb74, 0xa876, 0xa879, 0xcb75, 0xa87b, - 0xa87a, 0xcb78, 0xa878, 0x89b5, 0xaad1, 0xaacf, 0xcdad, 0xaace, - 0x8edd, 0xaad3, 0xaad5, 0xaad2, 0xcdb0, 0xcdac, 0xaad6, 0xaad0, - 0xa87c, 0xaad4, 0xcdaf, 0x9e5d, 0x9971, 0xcdae, 0xaacd, 0x89ae, - 0x9de8, 0xd05b, 0xad47, 0xad48, 0xd05d, 0x9565, 0xd057, 0xd05a, - 0xd063, 0xd061, 0xad49, 0xd067, 0xad4c, 0xd064, 0xd05c, 0xd059, - 0xdb49, 0xd062, 0xad44, 0xd065, 0xd056, 0xd05f, 0xad46, 0xad4b, - 0xd060, 0xad4f, 0xad4d, 0xd058, 0xad4a, 0xd05e, 0xad4e, 0xad45, - 0xd066, 0x9972, 0x8b5c, 0xafda, 0xafe3, 0xafd8, 0xafd6, 0xd36a, - 0xafde, 0xafdb, 0xd36c, 0x89b1, 0xafdd, 0xd36b, 0xd369, 0xd36e, - 0xafe2, 0xafe0, 0xdb48, 0xd36f, 0xd36d, 0xafd7, 0xa0c0, 0xafd9, - 0xafdc, 0x8edf, 0xafdf, 0x9566, 0xafe1, 0x9974, 0x9976, 0x9977, - 0x9979, 0xd74e, 0xb2e4, 0x9dda, 0xd745, 0xd747, 0x8ee0, 0xd748, - 0xd750, 0xd74c, 0xd74a, 0xd74d, 0xd751, 0xb2e5, 0xb2e9, 0xd746, - 0xd74f, 0xb2e7, 0x935c, 0xb2e6, 0xd74b, 0xd749, 0xb2e3, 0xb2e8, - 0x9de6, 0x8b5f, 0x9563, 0xb5c8, 0xdb51, 0xdb4f, 0xb5ca, 0x9567, - 0xdb4a, 0xdfa1, 0xb5c9, 0xdb4e, 0x9de3, 0xdb4b, 0xb5c5, 0xb5cb, - 0xdb50, 0xb5c7, 0xdb4d, 0xbb47, 0xb5c6, 0xdb4c, 0xb5cc, 0xb5c4, - 0xb5c3, 0x997c, 0x997d, 0x997e, 0xdf77, 0xdf75, 0xdf7b, 0xdf73, - 0xdfa2, 0xdf78, 0xdf72, 0xb87b, 0xb8a3, 0xdf7d, 0xdf76, 0xb87e, - 0x8b5b, 0xb87c, 0xdf7e, 0xb879, 0xb878, 0xdf79, 0xb87d, 0xb5cd, - 0xdf7c, 0xdf74, 0xb87a, 0xb8a1, 0xb8a2, 0x99a3, 0xbb4c, 0xbb48, - 0xbb4d, 0xe3a6, 0x99a4, 0xe3a5, 0xe3a7, 0xbb4a, 0xe3a4, 0xbb4b, - 0xe3aa, 0xe3a9, 0xe3a8, 0xbb49, 0x99a6, 0xe741, 0xe744, 0xbda8, - 0xe743, 0xbda7, 0xbda3, 0xbda4, 0xbda5, 0xe740, 0xe6fe, 0xbda6, - 0xe742, 0xe6fd, 0x99a8, 0xeae9, 0xeaf3, 0xbfb1, 0xbfb0, 0x8abe, - 0xeaed, 0xeaef, 0xeaea, 0xeaee, 0xeae8, 0xeaf1, 0xbfaf, 0xeaf0, - 0xeaec, 0x9e61, 0xeaf2, 0xeaeb, 0xc174, 0xede8, 0xedee, 0xc178, - 0xc17a, 0xc177, 0xc176, 0x99aa, 0xc175, 0xc173, 0xede9, 0xedec, - 0xc172, 0xeded, 0xa0c8, 0xc179, 0xedeb, 0xedea, 0xc2c0, 0xc2c1, - 0xf0a1, 0xf07d, 0xf07e, 0xf2c2, 0xf2c1, 0xc3be, 0xf4b4, 0xc4a4, - 0xf4b3, 0xf5f0, 0xf745, 0xc5a6, 0xf943, 0xf944, 0xc5d8, 0xa6da, - 0x99ab, 0xaad7, 0xdb52, 0xbb4e, 0xc17b, 0xedef, 0xa6db, 0xafe5, - 0xafe4, 0xdb53, 0xfec4, 0xeaf4, 0xa6dc, 0xad50, 0x98c2, 0xdb54, - 0xdb55, 0xdb56, 0xbb4f, 0xbfb2, 0xa6dd, 0xaad8, 0xd068, 0xafe6, - 0xd370, 0xb2ea, 0xdb57, 0xb8a4, 0xbb50, 0xbfb3, 0xc17c, 0xc2c2, - 0xf4b5, 0xa6de, 0xaad9, 0xafe7, 0xd752, 0xb5ce, 0xbb51, 0xe3ab, - 0xe745, 0x8ee8, 0xa0ba, 0xa6df, 0xb5cf, 0xdfa3, 0xbb52, 0xa6e0, - 0xcdb1, 0xd069, 0xad51, 0xd372, 0xfd77, 0xafea, 0x8eee, 0xafe8, - 0xafe9, 0xafeb, 0x9ebf, 0xd371, 0xd757, 0xd754, 0xd756, 0xb2eb, - 0xb2ed, 0xb2ec, 0xd753, 0xb2ee, 0xd755, 0xdb58, 0xdb59, 0x89c2, - 0xdb5a, 0xdfa6, 0xdfa7, 0xdfa5, 0xdfa8, 0xb8a5, 0xdfa4, 0xbb53, - 0xe74a, 0xe746, 0xe749, 0xe74b, 0xe748, 0xe747, 0x99ac, 0xeaf5, - 0xeaf6, 0xeaf7, 0xbfb4, 0xbfb5, 0xedf1, 0xedf0, 0xedf2, 0xf0a3, - 0xf0a2, 0xf2c4, 0x956b, 0xf2c5, 0xf2c3, 0x956c, 0xc4a5, 0xf4b6, - 0xf4b7, 0xf746, 0xf7ef, 0xf8bb, 0xa6e1, 0xa87d, 0xc17d, 0xa6e2, - 0xd758, 0xdb5b, 0x99af, 0xc641, 0xca4a, 0x994a, 0x8976, 0x8f48, - 0xca4b, 0xca4d, 0xa6e3, 0xca4e, 0xca4c, 0xcba2, 0xcba3, 0xcb7b, - 0xfbee, 0xcba1, 0xa8a1, 0xa8a2, 0xcb7c, 0xcb7a, 0xcb79, 0xcb7d, - 0xa87e, 0xcb7e, 0xd06a, 0xcdb6, 0xaadc, 0xcdb5, 0xcdb7, 0xaadb, - 0xcdbc, 0xaadf, 0xcdb2, 0xcdc0, 0xcdc6, 0xaae6, 0xcdc3, 0xaae3, - 0x99ae, 0xcdb9, 0xcdbf, 0xcdc1, 0x8efb, 0xcdb4, 0xaae2, 0xaadd, - 0xcdba, 0xaae4, 0xaae7, 0xaae1, 0xaada, 0xcdbe, 0xcdb8, 0xcdc5, - 0xaae9, 0xaae5, 0xaae0, 0xcdbd, 0xafec, 0xcdbb, 0xaade, 0xaae8, - 0x8cd0, 0xcdb3, 0xcdc2, 0xcdc4, 0x8b52, 0x99b0, 0x8977, 0x8f41, - 0xad62, 0xad5c, 0xad64, 0xad61, 0xd071, 0xd074, 0xad5d, 0x99b1, - 0xd06b, 0xad56, 0xad60, 0xad63, 0xad65, 0xd0a2, 0xd077, 0x8f49, - 0xad55, 0xd0a1, 0xad59, 0xad57, 0xad52, 0xd06f, 0xd07e, 0xd073, - 0xd076, 0xd0a5, 0xfa4d, 0xad66, 0xd07d, 0xad5e, 0xd078, 0xd0a4, - 0xd075, 0xd079, 0xd07c, 0x9de4, 0x8cb5, 0xd06d, 0xd0a3, 0xd07b, - 0xfbe9, 0x9b54, 0xd06c, 0x99b2, 0xd070, 0xad5f, 0xad5a, 0xad53, - 0xad58, 0xad54, 0xad67, 0xd06e, 0xd3a5, 0xad5b, 0x9e68, 0xd07a, - 0xce41, 0xd3a8, 0xaffa, 0x8f4a, 0xd376, 0x8f42, 0xd3a3, 0xd37d, - 0x8f51, 0xd3b2, 0xd3aa, 0xd37e, 0xd3a9, 0xd378, 0xd37c, 0xd3b5, - 0xaffd, 0xd3ad, 0xd3a4, 0xafed, 0xd3b3, 0xd374, 0xd3ac, 0xaffc, - 0xaff7, 0xd373, 0xaff5, 0xaff4, 0xaff9, 0xd3ab, 0xaff1, 0xaff8, - 0xd072, 0xdb5c, 0xd3a6, 0x9846, 0xd37a, 0xaffb, 0xd37b, 0xd3a1, - 0xaffe, 0xd375, 0xd3af, 0xd3ae, 0xd3b6, 0xaff3, 0xaff0, 0xd3b4, - 0xd3b0, 0xd3a7, 0xd3a2, 0xaff6, 0xaff2, 0xd377, 0xafee, 0xd3b1, - 0xafef, 0xd379, 0x99b4, 0x8ef5, 0xfd55, 0x9ccd, 0x8978, 0xd75e, - 0xd760, 0xd765, 0xd779, 0xb2fc, 0xb2f2, 0xd75d, 0xb2fd, 0xb2fe, - 0xd768, 0xd76f, 0xd775, 0xd762, 0xd769, 0x8f53, 0xb340, 0xd777, - 0xd772, 0xb2fa, 0xb2f8, 0xd76e, 0xd76a, 0xd75c, 0xb2ef, 0xd761, - 0xd759, 0x8f6f, 0xb2f7, 0xb2f9, 0xd766, 0xd763, 0xb2f4, 0xd773, - 0xb2f1, 0xd764, 0xd77a, 0xd76c, 0x8e63, 0xd76b, 0xb2f0, 0xb2fb, - 0xb2f3, 0xd75a, 0xd75f, 0xd770, 0xd776, 0xb341, 0xd75b, 0xd767, - 0xd76d, 0xb2f6, 0x8f56, 0xd778, 0xd771, 0xd774, 0xfe76, 0xb2f5, - 0x9fc6, 0xdb6c, 0xdb60, 0xb5d7, 0xdb7d, 0xdba7, 0xdbaa, 0xb5d5, - 0xdb68, 0xdba3, 0xdb69, 0xdb77, 0xb5e2, 0xdb73, 0xb5df, 0xfaac, - 0xdb74, 0xdb5d, 0xdba4, 0x8f58, 0xb5e8, 0xdba1, 0xdb75, 0xdbac, - 0xdb70, 0xdfc8, 0xdbaf, 0xb5e6, 0xdb6e, 0xdb7a, 0xb5e9, 0xb5d4, - 0xdb72, 0xdbad, 0xdb6b, 0xdb64, 0xdb6f, 0xdb63, 0xdb61, 0xb5d0, - 0xdba5, 0xdb6a, 0xdba8, 0x9848, 0xdba9, 0xb5d8, 0xb5dd, 0xb5d9, - 0xb5e1, 0xdb7e, 0xb5da, 0xdb76, 0xdb66, 0xb5d2, 0xdb5e, 0xdba2, - 0xdbab, 0xdb65, 0xb5e0, 0xdbb0, 0xdb71, 0xdb6d, 0xb5d1, 0xb5e5, - 0x99b7, 0xdb7c, 0xb5e7, 0xdb78, 0xb5dc, 0xb5d6, 0xb5de, 0xb5d3, - 0xb5e4, 0xdb79, 0xdb67, 0xdb7b, 0xdb62, 0xdba6, 0x9665, 0xfa6c, - 0x9de7, 0xdbae, 0x9e62, 0x96cc, 0x8e67, 0xdb5f, 0xfc75, 0x987e, - 0xdfc7, 0xdfdd, 0xb855, 0xdfcc, 0xfdb9, 0xdfca, 0xdfb5, 0xb8a9, - 0xdfc5, 0xdfd9, 0xdfc1, 0xb8b1, 0xdfd8, 0xdfbf, 0xb5e3, 0xdfcf, - 0xdfc0, 0xdfd6, 0xb8b0, 0xb8a8, 0x97fc, 0xdfaa, 0xdfb2, 0xdfcb, - 0xdfc3, 0xdfdc, 0xdfc6, 0xb8b6, 0xdfd7, 0x98f9, 0xb8ad, 0x8f66, - 0xdfc9, 0xdfd1, 0xdfb6, 0xdfd0, 0xdfe1, 0xdfb1, 0xdfd2, 0x956e, - 0xdfdf, 0x9245, 0xdfab, 0xb5db, 0x8f60, 0xdfb9, 0xdfb8, 0xb8af, - 0x9ed1, 0xdfbc, 0xdfbe, 0xdfcd, 0xdfde, 0xb8b2, 0xfecd, 0xb8b3, - 0x99b9, 0xdfb0, 0xb8ab, 0xdfb4, 0xdfda, 0xb8b4, 0xb8ac, 0xb8ae, - 0xb8b5, 0xdfe0, 0xdfd3, 0xdfce, 0x8f62, 0x974c, 0xdfbb, 0xdfba, - 0xb8aa, 0xdfac, 0xb8a7, 0xdfc4, 0xdfad, 0xdfc2, 0xdfb7, 0xdfdb, - 0x91c7, 0x955f, 0xb8a6, 0xdfb3, 0x99bb, 0xdfaf, 0xdfd5, 0xdfae, - 0xbb60, 0xe3d3, 0x8e6d, 0x8f71, 0xe3c2, 0x94cb, 0xe3ac, 0xe3ca, - 0xbb58, 0xe3bb, 0xe3c5, 0xbb5b, 0xe3be, 0xbb59, 0xe3af, 0xe3cd, - 0xe3ae, 0xe3c1, 0x95b1, 0xe3ad, 0xe3bf, 0xe3c8, 0xe3c6, 0xe3ba, - 0xe3b5, 0xe3b3, 0x9af2, 0xe3b4, 0xe3c7, 0xe3d2, 0xe3bc, 0xbb5a, - 0xe3b7, 0xe3cb, 0xbb5d, 0xe3b6, 0xe3b0, 0xe3c0, 0xbb61, 0x96c3, - 0x99bd, 0xbb55, 0xbb5e, 0xe3b8, 0xe3b2, 0xbb57, 0xdfd4, 0xbb56, - 0xe3c3, 0xbb54, 0xbb63, 0xbb5c, 0xe3c4, 0xe3b9, 0xe3b1, 0xe3cc, - 0xe3bd, 0xbb62, 0xe3d0, 0xbb5f, 0xe3cf, 0xe3c9, 0xe3ce, 0xa0cf, - 0xe3d1, 0x8f6d, 0x99be, 0x8ef4, 0x8f72, 0x95e4, 0xe773, 0xe774, - 0xe767, 0xe766, 0xe762, 0xbdb4, 0xbdac, 0xe776, 0xe775, 0xdfa9, - 0xe75f, 0xe763, 0xe75d, 0xe770, 0xe761, 0x99bf, 0xe777, 0xe75a, - 0xe758, 0xe764, 0xe76e, 0xe769, 0xbdb6, 0xe74f, 0xe76d, 0x9242, - 0xfba5, 0xbdb7, 0xdfbd, 0xe75b, 0xe752, 0xe755, 0xe77b, 0xe75c, - 0xe753, 0xe751, 0xe74e, 0x99c0, 0xbdb0, 0xe765, 0xbdaf, 0xbdb3, - 0xe760, 0xe768, 0xbda9, 0xe778, 0xe77c, 0xbdab, 0xe757, 0xe76b, - 0xe76f, 0xe754, 0xe779, 0xbdb2, 0xbdb1, 0xe74c, 0xbdb5, 0xe772, - 0xe756, 0xe76a, 0xe750, 0xe75e, 0xe759, 0xbdad, 0xbdae, 0xe76c, - 0xe77d, 0xe77a, 0xe771, 0xfdb4, 0x8f77, 0x99c1, 0xe74d, 0xbdaa, - 0xeb49, 0xeb40, 0xeb43, 0xfab9, 0xbfbb, 0xeb45, 0xeaf9, 0xeb41, - 0xeb47, 0xbfb8, 0xbfbc, 0xbfb6, 0x8f40, 0xfa44, 0xeafb, 0xeb4c, - 0xeb46, 0x99c2, 0xeafc, 0xeb55, 0xeb4f, 0xeaf8, 0xee46, 0xeafe, - 0xbfb7, 0x8f5c, 0xeb4a, 0xeb54, 0xbfbf, 0x8cbd, 0xeb51, 0xeafd, - 0xeb44, 0xeb48, 0xeb42, 0xeb56, 0xeb53, 0xeb50, 0xbfb9, 0xbfba, - 0xbfbe, 0xeafa, 0xeb57, 0xbfbd, 0xeb4d, 0x99c4, 0x99c5, 0xeb4b, - 0x8f7b, 0xeb4e, 0xee53, 0xee40, 0xee45, 0xee52, 0xee44, 0xedfb, - 0xee41, 0xc1a2, 0xedf4, 0xee4d, 0xee4f, 0xedf3, 0xc1a1, 0xee51, - 0xee49, 0xc1a8, 0xee50, 0xee42, 0xc1aa, 0xedf9, 0xeb52, 0xee4a, - 0xee47, 0xedf5, 0xee55, 0xc1a4, 0xc1a5, 0xedf7, 0xee48, 0x8cb6, - 0xee54, 0xee4b, 0xedfd, 0xc1a7, 0xc1a3, 0xee4c, 0xedfe, 0xee56, - 0xedf8, 0xee43, 0xee4e, 0xedfa, 0xedfc, 0xc2cb, 0xedf6, 0xc1a9, - 0xc2c4, 0xc17e, 0xc1a6, 0xc2c8, 0xf0b3, 0xf0a9, 0xf0a4, 0xf0aa, - 0xf0b4, 0xf0b8, 0xf0b7, 0xc2ca, 0xc2c9, 0xf0ab, 0xf0b9, 0xf0ae, - 0xf0a6, 0x8fa3, 0xf0a8, 0xf0a7, 0xf0ad, 0xf0b2, 0xf0a5, 0xf0ac, - 0xf0b1, 0xc2c7, 0xf0af, 0xc2c5, 0xf0b0, 0xc2c3, 0xc2c6, 0xf2d5, - 0xf0b5, 0xc3c2, 0x8cce, 0xf2cd, 0xf2d1, 0xf2c9, 0xf2cc, 0xf2d4, - 0xc3c0, 0xf2d9, 0xf2d2, 0x99c6, 0xf2ca, 0xf2da, 0xf2d3, 0xc3c3, - 0xc3c4, 0xf2d7, 0xf2cb, 0xc3bf, 0xc3c1, 0xf2c6, 0xf2ce, 0xf2c8, - 0x96cd, 0xf2d8, 0xf2d6, 0xf2c7, 0xf2cf, 0xf4be, 0xc3c5, 0xf2d0, - 0xc4a7, 0xc4a9, 0xc4a6, 0x96c7, 0xf4c3, 0xf4bb, 0xf4b9, 0xf4bd, - 0xf4ba, 0x8fa5, 0xf4bf, 0xf4c1, 0xc4aa, 0xc4ac, 0xf4c0, 0xc4ad, - 0xc4ab, 0xf4c2, 0xfabb, 0x8c61, 0x9570, 0xc4a8, 0x9368, 0x8f7e, - 0xc4f4, 0xf5f1, 0xf5f7, 0xc4f6, 0xf4bc, 0xf5f6, 0xf5fd, 0xf5f4, - 0xf5fb, 0xf5fa, 0xf4b8, 0xf5f5, 0xf0b6, 0xf5fe, 0xf5f3, 0xf5f8, - 0x8faa, 0xf5fc, 0xf5f2, 0xf74a, 0xc4f5, 0xf5f9, 0xa050, 0xf7f4, - 0xf74b, 0xf749, 0xf747, 0xf748, 0xf74c, 0xc5d9, 0xf7f2, 0xf7f0, - 0xf7f5, 0xf7f3, 0xf7f6, 0xc5da, 0xf7f1, 0x90d3, 0xf8bc, 0x9556, - 0xf945, 0xf946, 0xf947, 0xf9c7, 0xf9bd, 0xca4f, 0xaaea, 0xad68, - 0xd3b8, 0xd3b7, 0xb040, 0xb342, 0xd77c, 0xd77b, 0xb5ea, 0xb8b8, - 0xb8b7, 0xb8b9, 0xe3d4, 0xe77e, 0xeb58, 0xeb5a, 0xeb59, 0xc1ab, - 0xee57, 0xf0ba, 0xf9a5, 0xa6e4, 0x8fb8, 0xcdc9, 0xcdca, 0xcdc8, - 0xcdc7, 0xaaeb, 0x99c8, 0xd0a9, 0xd0a7, 0xd0a6, 0xad69, 0xad6b, - 0xad6a, 0xd0a8, 0x8faf, 0xd3c4, 0xd3c1, 0xd3bf, 0xb041, 0xd3c2, - 0xb046, 0xd3bc, 0xd3cb, 0xd3cd, 0xd3bd, 0x99c9, 0xb043, 0xd3ce, - 0xd3c9, 0xd3bb, 0xd3c0, 0xd3ca, 0xd3c6, 0xd3c3, 0xb048, 0xd3cc, - 0xd3be, 0x9579, 0xd3c7, 0xd3b9, 0xb047, 0xb044, 0xd3c5, 0xd3c8, - 0xd3ba, 0xb045, 0xb042, 0x9f49, 0xb34c, 0xd7a5, 0xb34b, 0x99ca, - 0xd7a8, 0xd7ab, 0xb348, 0xb346, 0xd77e, 0xd7a9, 0xd7a7, 0xd7a4, - 0xd7ac, 0xd7ad, 0xd7af, 0xd7b0, 0xd77d, 0xb345, 0xd7a2, 0xd7a1, - 0xd7ae, 0xb347, 0xd7a3, 0xb349, 0xb344, 0xd7a6, 0xb34d, 0xb34a, - 0xd7aa, 0xb5f1, 0xdbbf, 0xdbb4, 0xb5ee, 0xdfe7, 0xdbbd, 0xdbb1, - 0xb5ec, 0xdbb6, 0xb5ef, 0xdbba, 0xdbb8, 0xb5f2, 0xb5eb, 0xdbb2, - 0xdbb5, 0xb5f0, 0xdbb3, 0xdbbe, 0xdbbc, 0xdbb7, 0xdbb9, 0xdbbb, - 0xb5ed, 0x99cb, 0xdfe8, 0xdfee, 0xdfe4, 0xdfea, 0xb8ba, 0xdfe6, - 0xb8c0, 0xb8bf, 0xb8be, 0xdfed, 0xb8c1, 0xb8c2, 0xdfe3, 0xdff0, - 0xb8c3, 0xb8bd, 0xb8bc, 0xdfec, 0xb8c4, 0xdfe2, 0xdfe5, 0xdfef, - 0xdfeb, 0xe3f4, 0xe3e9, 0xb8bb, 0xbb6a, 0xe3dd, 0xe3f2, 0xe3de, - 0xbb65, 0xe3db, 0xe3e4, 0xe3dc, 0xbb67, 0xe3d6, 0xe3f1, 0xbb68, - 0xe3ee, 0xe3ef, 0xe3d7, 0xbb6d, 0xe3e6, 0xe3e0, 0xe3e7, 0xe3da, - 0xe3f3, 0xe3eb, 0xe3e5, 0xe3d5, 0xbb69, 0xe3ec, 0xbb6c, 0xe3f0, - 0xe3ea, 0xbb66, 0xe3e8, 0xe3e2, 0xbb64, 0xe3d9, 0xe3e1, 0xe3ed, - 0xe3df, 0xe3e3, 0xbdc1, 0xdfe9, 0xe7b2, 0xe7bb, 0xe7b1, 0xe7ad, - 0xe7aa, 0xbdc2, 0xe7a8, 0xbb6b, 0xe7a1, 0xbdc0, 0xe7a7, 0xbdbf, - 0xe7ac, 0xe7a9, 0xe7b9, 0xe7b4, 0xe7ae, 0xe7b3, 0xbdbb, 0xe7ab, - 0xe7be, 0xe7a2, 0xe7a3, 0xe7ba, 0xbdbc, 0xe7bf, 0xbdbe, 0xe7c0, - 0xe7b0, 0xe3d8, 0xe7b6, 0xe7af, 0xe7b8, 0xe7b5, 0x9dd5, 0x8fb0, - 0xe7a6, 0xbdb9, 0xe7bd, 0xbdba, 0xe7a4, 0xbdbd, 0xeb64, 0xe7b7, - 0xe7bc, 0xfa7a, 0xeb61, 0xbdb8, 0xbfc0, 0xeb6b, 0xeb67, 0x9e5f, - 0xeb65, 0xeb60, 0xeb6f, 0x99cd, 0xa0c9, 0xbfc4, 0xeb5c, 0xeb68, - 0xeb69, 0xeb5f, 0xeb5e, 0xeb6c, 0xeb62, 0xeb5d, 0xeb63, 0xeb6e, - 0xeb5b, 0xeb6d, 0xeb6a, 0xbfc2, 0xbfc1, 0xbfc3, 0xeb66, 0xf0cb, - 0x9adb, 0xa0c6, 0xee59, 0xc1b1, 0xee5d, 0xee5a, 0xee61, 0xee67, - 0xee5c, 0x8fb4, 0xee70, 0xc1ae, 0xee6a, 0xee5f, 0xee6b, 0xee66, - 0xee6d, 0xee5e, 0xc1b3, 0xc1b2, 0xee60, 0xee6e, 0xee58, 0xee6c, - 0xc1ac, 0xa0d7, 0xee64, 0xee63, 0xee68, 0xee5b, 0xc1b0, 0xc1b4, - 0xee62, 0xee69, 0xc1b5, 0xee65, 0xa0c7, 0xc1ad, 0xc1af, 0xf0c7, - 0xf0c5, 0xa043, 0xf0cc, 0xf0c9, 0xf0cd, 0x8fb5, 0xf0be, 0xf0c6, - 0xf0d1, 0xee6f, 0xf0c2, 0xc2cf, 0xe7a5, 0xf0bd, 0xf0ca, 0xf0c4, - 0xf0c1, 0xf0bc, 0xf0bb, 0xf0d0, 0xf0c0, 0xf0bf, 0xc2cd, 0xf0c8, - 0x8fb2, 0xc2cc, 0xc2ce, 0xf0c3, 0xf0cf, 0xa061, 0xf2de, 0xf2df, - 0xc3c9, 0xf2dc, 0xc3c6, 0xf2e4, 0xc3ca, 0xf2e6, 0xf2db, 0xf0ce, - 0xf2e8, 0xf2dd, 0x9e5e, 0xc3c7, 0xf2e3, 0xf2e5, 0xf2e0, 0xf2e7, - 0xf2e2, 0xf2e1, 0xc3c8, 0x8fb6, 0xf4c5, 0xf4c6, 0xf4c8, 0xc4ae, - 0xc4af, 0xf4c9, 0xf4c7, 0x9fe8, 0xf4c4, 0xf642, 0xf645, 0xf641, - 0xc4fa, 0xf643, 0xc4f9, 0xc4f8, 0xc4f7, 0xf644, 0xf751, 0xf74f, - 0x9cb2, 0xf74e, 0xf640, 0xf750, 0xf646, 0xf74d, 0x957c, 0xf7f9, - 0xf7d7, 0xf7f7, 0xc5db, 0xf7f8, 0xf7fa, 0xf8bf, 0xc5fa, 0xf8be, - 0xf8bd, 0xc5fb, 0xc65a, 0xf96e, 0xf9a7, 0xf9a6, 0xf9a8, 0xa6e5, - 0xd0aa, 0x9fc7, 0xd3cf, 0xd3d0, 0x8fbb, 0x8fbc, 0xdbc0, 0xf647, - 0xf8c0, 0xa6e6, 0xad6c, 0xd0ab, 0x8fec, 0xd7b1, 0xb34e, 0xdbc2, - 0xdbc1, 0xb5f3, 0xb8c5, 0xe7c1, 0xbdc3, 0xbdc4, 0x8fc0, 0x936a, - 0xbfc5, 0xc5fc, 0xa6e7, 0x8be4, 0x9c7c, 0xd0ac, 0xaaed, 0xd0ae, - 0xd0ad, 0xad6d, 0xd3d1, 0x95a1, 0xd3d8, 0xb049, 0xd3d6, 0xd3d4, - 0xd3db, 0xd3d2, 0xd3d3, 0xb04a, 0xb04e, 0xd3dc, 0xb04d, 0xd3da, - 0xd3d7, 0xd3d5, 0xb04b, 0xb04c, 0xd3d9, 0xfeec, 0x95a3, 0xb350, - 0xd7b2, 0xb355, 0xd7c2, 0xb354, 0xd7c4, 0x8c45, 0x8cb8, 0xd7b8, - 0xb352, 0xd7c3, 0xd7b3, 0xb353, 0xd7bf, 0xd7bb, 0xd7bd, 0xd7b7, - 0xd7be, 0x8fc1, 0xb34f, 0xd7ba, 0xa052, 0xd7b9, 0xd7b5, 0xd7c0, - 0xd7bc, 0xd7b4, 0xd7b6, 0xb351, 0xd7c1, 0x99d0, 0xb5f6, 0xdbcd, - 0x8fc3, 0x8fc4, 0xdbc9, 0xdbcb, 0xdbc6, 0xdbc5, 0xdbc3, 0xdbca, - 0xdbcc, 0xdbc8, 0x95a4, 0xdbc7, 0xb5f4, 0xb5f5, 0x8fc6, 0x9e60, - 0xdbcf, 0xb8cd, 0xdff2, 0xdff8, 0xdff3, 0xdff4, 0xf9d8, 0xdff9, - 0xb8cf, 0xb8c7, 0xb8ce, 0xdff1, 0xdbc4, 0xb8ca, 0xb8c8, 0xdff7, - 0xdff6, 0xb8c9, 0xb8cb, 0xdff5, 0xb8c6, 0xb8cc, 0x95a5, 0xe3f6, - 0xbb74, 0xe442, 0xe441, 0xe3fb, 0xbb76, 0xe440, 0xe3f7, 0xe3f8, - 0xbb6e, 0xbb70, 0x9cb3, 0xe3fd, 0xe3f5, 0xbb72, 0xbb71, 0xe3f9, - 0xe3fe, 0xe3fc, 0xbb73, 0xe3fa, 0x99d1, 0xfef1, 0xdbce, 0xbb6f, - 0xe7c2, 0xe7c9, 0xbdc6, 0xe7cd, 0xbdca, 0xe7c5, 0xe7c3, 0xe7cc, - 0xbdc5, 0xe7cb, 0xbdc7, 0xbdc8, 0xe7c4, 0xbdc9, 0xe7ca, 0xe7c6, - 0xe7c7, 0xe7c8, 0xbb75, 0xeb70, 0xeb7c, 0xbfca, 0xeb77, 0xeb79, - 0x99d2, 0xbfc8, 0xeb71, 0xeb75, 0xeb78, 0xbfc6, 0xbfc9, 0xeb7b, - 0xeb73, 0xeb74, 0xeb7a, 0xeb72, 0xeb76, 0xbfc7, 0xee72, 0xee71, - 0xc1b7, 0xee77, 0xc1b9, 0xc1b6, 0xee73, 0xc1ba, 0xee74, 0xee75, - 0xee78, 0x9cc2, 0xc1b8, 0xf0d6, 0x99d3, 0xf0d9, 0xf0d3, 0xf0d5, - 0x95a7, 0xf0d4, 0xf0d7, 0xf0d8, 0xee76, 0xf0d2, 0x95a9, 0xc3cd, - 0xf2ec, 0xf2ef, 0xf2f1, 0xf2ea, 0xf2eb, 0xf2ee, 0xf2f0, 0xc3ce, - 0xc3cc, 0xc3cb, 0xf2ed, 0xf2e9, 0xf4ca, 0xc4b0, 0x95a6, 0xf4cb, - 0xf649, 0xc4fb, 0xf64b, 0xc4fc, 0xf648, 0xf64a, 0xc5a8, 0xf752, - 0xc5a7, 0xf7fd, 0xf7fc, 0xf7fb, 0x9c5d, 0xf948, 0xf949, 0xf94b, - 0xf94a, 0xca50, 0xa6e8, 0x98e2, 0xad6e, 0xd7c5, 0xb5f7, 0xdffa, - 0xc2d0, 0x8fc9, 0xf2f2, 0xa0c2, 0x8fca, 0xa8a3, 0xb357, 0x99d4, - 0xb356, 0xa0b9, 0xdbd0, 0xb5f8, 0xdbd2, 0xdbd1, 0xdffb, 0xb8d0, - 0xe443, 0xe446, 0xe445, 0xe444, 0xe7ce, 0xe7d0, 0xe7cf, 0x9b58, - 0xbfcc, 0x8fcd, 0xa0d4, 0xbfcb, 0xc1bb, 0xee79, 0xee7b, 0xee7a, - 0xc2d1, 0xf2f4, 0xf2f3, 0xf4cc, 0xc4b1, 0x8fce, 0xc4fd, 0xf754, - 0xf753, 0xc65b, 0x8be5, 0x8979, 0xa8a4, 0xd0af, 0xad6f, 0xd7c8, - 0xd7c6, 0xd7c7, 0xdbd4, 0xdbd5, 0xe043, 0xdbd3, 0xdffc, 0xe041, - 0xe040, 0xe042, 0xb8d1, 0xdffe, 0xdffd, 0xe044, 0x8fd0, 0xe449, - 0xe447, 0xe448, 0xe7d3, 0xe7d1, 0xe7d2, 0xeb7d, 0xee7c, 0xee7d, - 0xc2d2, 0xf2f5, 0xf4cd, 0xc4b2, 0xf64c, 0xf755, 0xc5a9, 0xf7fe, - 0xf94c, 0xa8a5, 0xad71, 0xad72, 0xd0b0, 0xd0b1, 0xad70, 0xb054, - 0xb052, 0xb051, 0xb058, 0xb050, 0xb059, 0xd3dd, 0xb056, 0xb053, - 0xb057, 0xb055, 0xb04f, 0xb35f, 0x95b6, 0xb359, 0xd7cc, 0xb35e, - 0xb360, 0xb35a, 0xb35b, 0xd7ca, 0x99d6, 0xb358, 0x95e5, 0xd7cb, - 0xb35d, 0xd7c9, 0xb35c, 0xb644, 0xb646, 0x99d7, 0xdbd8, 0xb645, - 0xb5f9, 0xb5fd, 0x95b5, 0xb8e4, 0xe049, 0xdbda, 0xb5fe, 0xdbdd, - 0xdbde, 0xb643, 0xdbe0, 0xa0ca, 0xdbe2, 0xdbe3, 0xdbd7, 0xdbd6, - 0xdbe4, 0xb642, 0xdbe1, 0xdbdf, 0xb640, 0xb5fb, 0xb647, 0xdbdb, - 0xdbdc, 0xdbd9, 0xb641, 0xb5fc, 0xb5fa, 0xe048, 0xb8df, 0xb8da, - 0xb8d5, 0x9ffd, 0xb8e5, 0xb8d6, 0xb8d2, 0xb8e1, 0xb8de, 0xb8e0, - 0xb8d7, 0xb8dc, 0xb8d3, 0xb8d4, 0xe050, 0xe04d, 0xe045, 0xe04a, - 0xb8e2, 0xe051, 0xb8e3, 0xb8d9, 0xa058, 0xe047, 0xe04f, 0xe04b, - 0xe04e, 0xe04c, 0xb8dd, 0xe046, 0xb8d8, 0xe44c, 0xbb78, 0xbb7b, - 0xe44e, 0x8fd6, 0xbba5, 0xe44d, 0xbb7d, 0x99d8, 0xbdcf, 0xe44f, - 0xbba4, 0xe44b, 0xbba6, 0x8fd3, 0xbb79, 0xb8db, 0xbb7c, 0xbb7a, - 0xbb7e, 0xbba2, 0xbb77, 0xbba7, 0xbba3, 0x8fe5, 0xbba1, 0xe44a, - 0x8fe9, 0xbdd6, 0xbdd2, 0x99d9, 0xbdd9, 0xe7d6, 0xbdda, 0xe7e2, - 0xe7db, 0xbdcb, 0xe7e3, 0xe7dd, 0xbdd5, 0xe7de, 0xbdd4, 0xe7e1, - 0xbdce, 0xe7df, 0xe7d5, 0xbdcd, 0xebaa, 0xbdd3, 0xbdd0, 0xbdd8, - 0xe7d4, 0xe7d8, 0xbdcc, 0xe7d7, 0xe7d9, 0xe7da, 0xbdd7, 0xe7dc, - 0xe7e0, 0xe7e4, 0x927c, 0xbddb, 0xbfd2, 0xeba5, 0xebab, 0xeba8, - 0xeb7e, 0xebac, 0xeba1, 0xeba7, 0xbfcd, 0xbfd3, 0xebad, 0x9c45, - 0xbfcf, 0xbfd9, 0xbfd4, 0xebaf, 0xeba9, 0xbfd0, 0xeba2, 0xbfda, - 0xeba3, 0xeba4, 0xbfdb, 0xbfd8, 0xbdd1, 0xbfce, 0xebb0, 0xbfdc, - 0xbfd5, 0xebae, 0xbfd1, 0xbfd6, 0xbfd7, 0xc1c3, 0xeea4, 0xeead, - 0xeeaa, 0xeeac, 0xc1c0, 0xeea5, 0x8fde, 0xeeab, 0xc1bc, 0xeea7, - 0xc1c4, 0xeea3, 0xeea8, 0xeeaf, 0xeba6, 0xeea9, 0xeea2, 0xc1bd, - 0xeea1, 0xc1be, 0xeeb0, 0xc1bf, 0xeeae, 0xc1c2, 0xee7e, 0x8fdf, - 0xc1c1, 0xeea6, 0xf0dc, 0xf0ea, 0xf0e5, 0xf0e7, 0xf0db, 0xc2d3, - 0xf0da, 0xc2d6, 0xc2d5, 0xa04b, 0xf0e9, 0xf0e1, 0xf0de, 0xf0e4, - 0xf0dd, 0xf0df, 0xf0e8, 0xf0e6, 0xc2d4, 0xf0ed, 0xf0eb, 0xf0e2, - 0xf0ec, 0xf0e3, 0x8fe2, 0xf2f9, 0xc3cf, 0xf341, 0xa0cc, 0xf64f, - 0xc3d6, 0xf0e0, 0xf2f7, 0xc3d2, 0xf2f8, 0xf2fd, 0x8fe3, 0x8fe4, - 0xc3d4, 0xc3d5, 0xf2f6, 0xf340, 0xf342, 0xf2fa, 0xf2fc, 0xf2fe, - 0xf2fb, 0xf343, 0xc3d1, 0xc3d7, 0xc3d3, 0xc3d0, 0xf4d0, 0x9bc4, - 0xc4b7, 0xf4ce, 0x9bfc, 0xf4d2, 0xf4d3, 0xc4b5, 0xf4d4, 0xf4d1, - 0x964c, 0xf4cf, 0xc4b8, 0xc4b4, 0xf4d5, 0xc4b6, 0xc4b3, 0xc4fe, - 0xc540, 0xf64e, 0xf64d, 0xf650, 0xf651, 0xc541, 0xf756, 0xf75b, - 0xc5aa, 0x9af6, 0xf758, 0x8cae, 0xf757, 0xf75a, 0xf759, 0xf843, - 0xc5dc, 0xf842, 0xf840, 0xf841, 0x8fe7, 0xc5fe, 0xc5fd, 0xf8c1, - 0xf8c2, 0xc640, 0xf94d, 0xf94e, 0xc667, 0x8fe8, 0xc66d, 0xf9a9, - 0xf9c8, 0x8be7, 0x897a, 0x897b, 0xa8a6, 0xd7cd, 0xd7ce, 0xe052, - 0xe450, 0xe7e5, 0xc1c6, 0xc1c5, 0xf0ee, 0xf344, 0xf844, 0xa8a7, - 0xd3de, 0xb05a, 0xb361, 0xe054, 0xe053, 0xbddc, 0xe7e6, 0xbddd, - 0xeeb1, 0xc2d7, 0x99da, 0xc676, 0xa8a8, 0xcdcb, 0xd3df, 0xb362, - 0xd7cf, 0xd7d0, 0xdbe5, 0xb648, 0xb8e6, 0xe056, 0xe055, 0xe057, - 0xe451, 0xe452, 0xbba8, 0xbfdd, 0xbdde, 0xbfde, 0xeeb5, 0xeeb2, - 0xeeb4, 0xeeb3, 0xc1c7, 0xf0ef, 0xf346, 0xf345, 0xcba4, 0xb05c, - 0xb05b, 0xd3e0, 0xd7d1, 0xdbe7, 0xdbe6, 0xb649, 0xe059, 0xe05a, - 0xe058, 0xb8e8, 0xb8e7, 0xbbaa, 0xbba9, 0xe7e7, 0xebb3, 0xebb1, - 0xebb2, 0xbfdf, 0xeeb7, 0xeeb6, 0xf0f2, 0xf0f1, 0xf0f0, 0xf347, - 0x8fed, 0xf9aa, 0xa8a9, 0xad73, 0x95c0, 0xad74, 0xb05d, 0xb05e, - 0xd3e2, 0xd3e1, 0xd7d2, 0xb368, 0xb366, 0xb363, 0xb367, 0xb365, - 0xb364, 0xa0cb, 0xb64a, 0xdbea, 0xb8ed, 0xb64c, 0xb651, 0xdbec, - 0xb653, 0xb652, 0xb655, 0xdbeb, 0xdbe8, 0xb64f, 0xb64b, 0xb64d, - 0xdbe9, 0xb654, 0xb650, 0xb64e, 0xb8ef, 0xb8ee, 0xb8ec, 0xb8f0, - 0xb8ea, 0xb8eb, 0xb8e9, 0xe05b, 0x9e48, 0xe454, 0xbbac, 0xbbad, - 0xbbab, 0x99db, 0xe453, 0x8ff3, 0xe455, 0xe7ea, 0xe7ec, 0x8ff9, - 0xbde7, 0xe7ed, 0xbde0, 0xe7e9, 0xbddf, 0xbde9, 0xbde5, 0xbde6, - 0xbde2, 0xe7e8, 0xbde1, 0xe7ee, 0xe7eb, 0x95c1, 0xbde8, 0xa04e, - 0xbde3, 0xbde4, 0xebb5, 0xebb7, 0xebb6, 0x99dc, 0xebb8, 0xbfe0, - 0xebb4, 0xa064, 0xc1cb, 0xeeb8, 0xc1c8, 0xc1cc, 0xc1ca, 0xc1c9, - 0xf0f3, 0xf0f6, 0xf0f5, 0x8ff7, 0xf0f4, 0xc2d8, 0xf348, 0xf349, - 0xc3d8, 0xf34a, 0xc3d9, 0x89b0, 0xa048, 0xc4ba, 0xc4b9, 0xf652, - 0x8ffb, 0x8ff6, 0xc542, 0xf653, 0xf75c, 0xc5ab, 0xc5ac, 0x9ddc, - 0xf845, 0xc642, 0x99dd, 0x8be8, 0xa8aa, 0xb36a, 0xb369, 0xe05c, - 0xe05d, 0xbbae, 0xebb9, 0xbdea, 0xebba, 0xeeb9, 0xa8ab, 0xd0b2, - 0xad76, 0xad75, 0xd3e3, 0xb05f, 0xd3e4, 0xd7d5, 0x92c1, 0xd7d4, - 0xd7d3, 0xdbee, 0xb658, 0x9fd6, 0xdbed, 0xb657, 0xdbef, 0xb656, - 0xe05f, 0xe062, 0xe060, 0xe061, 0xe065, 0xe05e, 0xe066, 0xe063, - 0xe064, 0xbbb0, 0xe456, 0xbbaf, 0xe7f2, 0xe7f0, 0xbdeb, 0xe7ef, - 0xe7f1, 0xbdec, 0xebbb, 0xa0d2, 0xebbc, 0xc1cd, 0x9040, 0xf34c, - 0xf34e, 0xf34b, 0xf34d, 0xf4d6, 0xf654, 0xf96f, 0xa8ac, 0xad77, - 0xd3e5, 0xd3e7, 0xd3e6, 0xd7d8, 0xb36c, 0xd7d6, 0xb36b, 0xd7d9, - 0x8ac4, 0xd7da, 0xd7d7, 0x99e0, 0xdbfb, 0xb660, 0xdbf3, 0xdbf9, - 0xb65b, 0xb65e, 0xdbf2, 0xb659, 0xdbf6, 0xe06c, 0xb65d, 0xdbf1, - 0x9ff0, 0xdbf7, 0xdbf4, 0xdbfa, 0xdbf0, 0xdbf8, 0xb65c, 0xb65f, - 0xdbf5, 0xb65a, 0xb8f2, 0xe068, 0xb8f1, 0xe06f, 0xe06e, 0xb8f8, - 0xb8f9, 0xe070, 0xb8f3, 0xe06d, 0xb8f7, 0xe072, 0xe069, 0xe06b, - 0xb8f4, 0xe067, 0xe06a, 0xe071, 0xb8f5, 0xe073, 0xb8f6, 0xbbb1, - 0xe45b, 0xe461, 0xe459, 0xe462, 0x9ff3, 0xe458, 0xe45d, 0xe463, - 0xe460, 0xe45f, 0xe45e, 0xe457, 0xe45c, 0xe45a, 0x9dbf, 0xbdf1, - 0xbdee, 0xe7fb, 0xe841, 0xe843, 0xe840, 0xe7f8, 0xe7fa, 0xe845, - 0xe842, 0xe7fc, 0xe846, 0xe7f9, 0xe844, 0xbdef, 0xbdf5, 0xbdf3, - 0xe7f3, 0xbdf4, 0xbdf0, 0xe7f4, 0xe7f6, 0xe7f5, 0xe7fd, 0xe7fe, - 0x9ff6, 0xbdf2, 0x95c8, 0xbded, 0x9e5a, 0xe7f7, 0xebc6, 0xbfe2, - 0xebbd, 0xbfe3, 0xbfe6, 0xebc2, 0xebbf, 0xbfe5, 0x99e3, 0xebc3, - 0xebc4, 0xebbe, 0xebc7, 0xebc0, 0xebc5, 0xbfe4, 0xbfe1, 0xebc1, - 0x8a4a, 0xeebf, 0xc1d0, 0xc1ce, 0xc1d1, 0xc1cf, 0xeebe, 0xeebb, - 0xeeba, 0x9ff1, 0xeebd, 0xeebc, 0xf145, 0xc2de, 0xf0fb, 0xf0fa, - 0xc2d9, 0xf141, 0xf140, 0xf0f7, 0xf143, 0xf0fc, 0xc2dd, 0xf0f9, - 0xf142, 0xf0f8, 0xc2da, 0xc2dc, 0xf0fd, 0xc2db, 0xf0fe, 0x8aa7, - 0xf144, 0xf352, 0xc3de, 0xf34f, 0xf353, 0x99e6, 0xc3db, 0xf351, - 0xc3e0, 0x9ff7, 0xc3dd, 0x9fed, 0xf350, 0xc3df, 0xf354, 0xc3da, - 0x8a5c, 0x9dae, 0xc4bc, 0xc4be, 0xf4d9, 0xc4bd, 0xf4d7, 0xc3dc, - 0xf4d8, 0xc4bb, 0xc543, 0xc545, 0xf656, 0xc544, 0xf655, 0xf761, - 0xc5ad, 0xf760, 0xc5ae, 0xf75e, 0xf75d, 0xf762, 0xf763, 0xf846, - 0xf75f, 0xf8c6, 0xf8c3, 0xf8c4, 0xf8c5, 0xc65c, 0xf951, 0xf950, - 0xf94f, 0xf970, 0x95c9, 0xf9be, 0xf9ab, 0xc66e, 0xa8ad, 0xb060, - 0x9048, 0x99e8, 0xb8fa, 0x9049, 0x8cba, 0xbdf6, 0x90b1, 0xebc8, - 0xc2df, 0xf355, 0x904a, 0xf9ac, 0xa8ae, 0xaaee, 0xad79, 0xad78, - 0x99ea, 0xb063, 0xd3e8, 0xb061, 0xd3e9, 0xb062, 0xd7df, 0xd7db, - 0x9bd1, 0xb36d, 0xd7de, 0xd7dd, 0xd7dc, 0xb36e, 0xd7e0, 0xd7e1, - 0x99eb, 0x99ec, 0xdc43, 0xdc41, 0xdc45, 0xdc46, 0xdc4c, 0xdc48, - 0xdc4a, 0x99ed, 0xdc42, 0xdbfc, 0xdc49, 0x99ee, 0xdc4b, 0xdc44, - 0xdc47, 0xdbfd, 0xb662, 0xdc40, 0xdbfe, 0xb661, 0xb663, 0xb8fd, - 0xe075, 0xe077, 0xe076, 0xe07b, 0xb8fb, 0xe078, 0xe074, 0xe079, - 0xe07a, 0xb8fc, 0xb8fe, 0xe07c, 0xe467, 0xe466, 0xe464, 0xe465, - 0xbbb3, 0xbbb5, 0xbbb2, 0xbbb4, 0xe84d, 0xe84e, 0xe849, 0x904c, - 0xe84a, 0xbdf8, 0xbdfd, 0xbdf7, 0xbdfe, 0xbdf9, 0xe84b, 0xe84c, - 0xe848, 0xbe40, 0xbdfb, 0xbdfa, 0xbdfc, 0xe847, 0x904d, 0xebca, - 0xbfe8, 0x95cb, 0xebcc, 0xbfea, 0xebcf, 0xebcb, 0xebc9, 0xebce, - 0xbfe9, 0xebcd, 0xbfe7, 0xc1d3, 0xc1d6, 0xeec1, 0x97e2, 0xc1d4, - 0xeec0, 0xc1d2, 0xc1d5, 0xf146, 0xf147, 0xf148, 0xc2e0, 0x95cc, - 0xf149, 0xc2e1, 0xc3e2, 0xf358, 0xf359, 0xf357, 0xf356, 0xf35a, - 0xc3e1, 0xf4dd, 0xf4db, 0xf4dc, 0xf4de, 0xf4da, 0xf4df, 0xf658, - 0x9f78, 0xf659, 0xf657, 0xc546, 0xf764, 0xc5af, 0xf765, 0xf848, - 0xf847, 0x897c, 0x897d, 0x897e, 0x995d, 0xa8af, 0xb664, 0xb940, - 0x9b5a, 0xbbb6, 0x9050, 0xbfec, 0x8c4f, 0xbfeb, 0xc3e3, 0xc47c, - 0xc547, 0xa8b0, 0xb064, 0xb941, 0x9054, 0xf35b, 0xc6d6, 0x9aa8, - 0x99ef, 0xfeeb, 0x9da3, 0x9da1, 0x9943, 0x9945, 0x9d7d, 0xcba6, - 0x99f0, 0xa8b1, 0xa8b4, 0xa8b3, 0xa8b2, 0xcba5, 0x99f1, 0xcdcd, - 0x99f2, 0xcdcf, 0xaaef, 0x8cbc, 0x9d60, 0xaaf1, 0xcdcc, 0xcdce, - 0xaaf0, 0xcdd1, 0xcdd0, 0xcdd2, 0xa0a3, 0xd0b6, 0xd0b4, 0xad7c, - 0xd0b3, 0xada3, 0xad7e, 0xad7b, 0xada4, 0xad7d, 0xada2, 0xada1, - 0xd0b5, 0xad7a, 0xb06a, 0xd3eb, 0xd3f1, 0xb067, 0xb06e, 0x905b, - 0xb069, 0xd3ee, 0xd3f0, 0xb06c, 0xd3ea, 0xd3ed, 0xb068, 0xb065, - 0xd3ec, 0xb06b, 0xd3ef, 0xb06d, 0xb066, 0x9edb, 0xd7e3, 0xd7e6, - 0xb370, 0xb37a, 0xb376, 0xd7e4, 0x9d79, 0xb37e, 0xb377, 0xb37c, - 0xb372, 0xb36f, 0xb371, 0xb37d, 0xd7e5, 0xb375, 0xb378, 0xb374, - 0xb379, 0xd7e7, 0xb37b, 0xb373, 0xd7e2, 0xdc4d, 0xb665, 0xdc4f, - 0xb667, 0xb669, 0x99f3, 0xdc4e, 0xb666, 0xb66a, 0x9062, 0xb668, - 0xb947, 0xe0a3, 0xb94f, 0xe07e, 0xb950, 0xb945, 0xe0a1, 0xb94a, - 0xe0a2, 0xb943, 0xb942, 0x9f55, 0xb94d, 0xb94c, 0xb94b, 0xb949, - 0xb94e, 0xe07d, 0xb944, 0xb946, 0xb948, 0x9bf9, 0xbbb8, 0xbbbb, - 0xbbbf, 0xbbb9, 0xbbbe, 0xbbbc, 0xbbb7, 0x9065, 0xbbbd, 0xbbba, - 0x96e0, 0xe852, 0xbe43, 0xbe41, 0xe853, 0x98be, 0xbe44, 0xbe42, - 0xe851, 0xe850, 0xbff0, 0xe84f, 0xbfee, 0xbfed, 0xebd0, 0xbe45, - 0xbfef, 0xebd1, 0xbff2, 0xebd2, 0xbff1, 0xc1d8, 0xeec3, 0xc1d7, - 0xc1dc, 0xc1da, 0xc1db, 0xc2e3, 0xc1d9, 0xeec2, 0xebd3, 0xc2e2, - 0xc2e4, 0xc3e4, 0xc3e5, 0xf4e0, 0xc5de, 0xc5dd, 0xa8b6, 0xca55, - 0xb06f, 0xca52, 0xca53, 0xca51, 0xca54, 0xcbaa, 0xcba7, 0xcbac, - 0xcba8, 0xa8b7, 0xa8ba, 0xcba9, 0xa8b9, 0xcbab, 0x9068, 0xa8b8, - 0x906c, 0xcdd5, 0xcdd7, 0xaaf4, 0xcdd3, 0xcdd6, 0xcdd4, 0xaaf2, - 0xaaf5, 0xaaf3, 0x95d8, 0xd0b8, 0xd0bc, 0xd0b9, 0xada7, 0xada8, - 0x906a, 0xd0bb, 0xd0bd, 0xd0bf, 0xada5, 0xd0be, 0xada6, 0xd7ee, - 0xd0ba, 0xd3f2, 0xd3fb, 0xd3f9, 0xd3f4, 0xd3f5, 0xd3fa, 0xd3fc, - 0xb071, 0xd3f7, 0xd3f3, 0xb070, 0xb072, 0xd3f6, 0xd3fd, 0xd3f8, - 0xb3a1, 0xd7f1, 0xd7e9, 0xd7ef, 0xd7f0, 0xb3a2, 0xd7e8, 0xd7ea, - 0xd0b7, 0xd7ec, 0xd7ed, 0xd7eb, 0xb66c, 0xdc56, 0xebd4, 0xdc57, - 0xdc54, 0xb3a3, 0xb66e, 0xdc53, 0xdc59, 0xdc58, 0xb66b, 0xdc5c, - 0xdc52, 0xdc5b, 0xdc50, 0xdc5a, 0xdc55, 0xb66d, 0xe0aa, 0xe0a5, - 0xe0ab, 0xe0a6, 0xe0a4, 0xe0a7, 0xb951, 0xe0a9, 0xe0a8, 0xb952, - 0xbbc1, 0xbbc0, 0xe46e, 0xe471, 0xe469, 0xe46d, 0xbbc2, 0xe46c, - 0xe46a, 0xe470, 0xe46b, 0xe468, 0xe46f, 0xe859, 0xbe48, 0xf14a, - 0xe856, 0xe857, 0xe855, 0xdc51, 0xbe47, 0xe85a, 0xe854, 0xbe46, - 0xbe49, 0xe858, 0xebd5, 0xbff3, 0xebd6, 0xebd7, 0xeec4, 0xc1dd, - 0xf14b, 0xf14c, 0xf14d, 0xf35d, 0xf35c, 0xf4e2, 0xf4e1, 0xf65b, - 0xf65c, 0xf65a, 0xf766, 0xc5b0, 0xa8bb, 0xadaa, 0xada9, 0xb075, - 0xb074, 0xd440, 0xd441, 0xd3fe, 0x9fb2, 0xb073, 0xd7f5, 0xd7f6, - 0xd7f2, 0xb3a4, 0xd7f3, 0x9fae, 0xd7f4, 0x9fb0, 0x89ad, 0xdc5f, - 0xdc61, 0xdc5d, 0xdc60, 0xb66f, 0xdc5e, 0xb670, 0x906e, 0xdd73, - 0xb955, 0xb954, 0xb953, 0xe0ac, 0xe0ad, 0x9e71, 0xe473, 0xe475, - 0xbbc6, 0xbbc3, 0x9e4a, 0xbbc5, 0xbbc4, 0xe474, 0xe472, 0x9fdc, - 0xe861, 0xe85e, 0xe85f, 0xbe4d, 0xe860, 0xe85b, 0xe85c, 0xbe4a, - 0xbe4b, 0xe85d, 0xbe4c, 0x89ab, 0xebdb, 0x9fb8, 0xebdc, 0xebd9, - 0xebda, 0xbff4, 0xebd8, 0xeec8, 0xeec5, 0xeec7, 0xc1e0, 0xeecb, - 0xc1df, 0xeec9, 0xeecc, 0xeeca, 0xeec6, 0xc1de, 0xf14f, 0xf150, - 0xf14e, 0x9070, 0xf152, 0xc2e5, 0xc2e6, 0xf35f, 0xc3e7, 0xf151, - 0xf35e, 0xc3e6, 0xf4e5, 0xf4e6, 0xc4bf, 0xf4e4, 0x8b63, 0xf4e3, - 0xf65d, 0xc548, 0x95dc, 0xf849, 0xf8c8, 0xf8c7, 0xc643, 0xc65d, - 0xf8c9, 0xf971, 0x9071, 0xc66f, 0xa8bc, 0xaaf6, 0xb956, 0xc4c0, - 0xa8bd, 0xadab, 0xb3a5, 0xb671, 0xc2e7, 0xaaf7, 0xd0c1, 0xd0c0, - 0xd442, 0xfc5e, 0xb078, 0xb076, 0xb07a, 0xd444, 0xb079, 0xb077, - 0x8949, 0xd443, 0xb3a8, 0xd7fc, 0x965b, 0xb3a7, 0xb3a9, 0xd842, - 0xb3ab, 0xd7fe, 0xd840, 0xd7f7, 0xb3aa, 0xd843, 0xd7f9, 0xd7fa, - 0xd7f8, 0xb3a6, 0x8c50, 0xd841, 0xd7fb, 0xd7fd, 0x94a6, 0xdc6d, - 0x8fd5, 0xdc6c, 0xdc6a, 0xdc62, 0xdc71, 0xdc65, 0xdc6f, 0xdc76, - 0xdc6e, 0xb679, 0x9e73, 0xb675, 0xdc63, 0xdc69, 0xb677, 0x9075, - 0xdc68, 0xb678, 0xb67a, 0xdc6b, 0x99f7, 0xb672, 0xb673, 0xdc77, - 0xdc75, 0xdc74, 0xdc66, 0xdc72, 0xb676, 0x8cbf, 0xb674, 0xdc73, - 0xdc64, 0xdc67, 0xdc70, 0x99f9, 0x9663, 0x95b9, 0xe4ba, 0xe0b7, - 0xe0b0, 0xe0c3, 0xe0cc, 0xe0b3, 0xb961, 0x94d4, 0xe0c0, 0xb957, - 0xb959, 0xb965, 0xe0b1, 0xfcfa, 0xb95a, 0xb95c, 0xb966, 0xb95b, - 0x9077, 0x90ab, 0xb964, 0xe0b9, 0xe0ae, 0xb962, 0xe0b8, 0xb95e, - 0xe0ca, 0xb963, 0xe0c8, 0xe0bc, 0xe0c6, 0xb960, 0xe0af, 0xe0c9, - 0xe0c4, 0x9d4d, 0xe0cb, 0xb958, 0x99fa, 0xb967, 0xb95d, 0x92e3, - 0xe0b5, 0x97bb, 0xe0bd, 0xe0c1, 0x9078, 0xe0c5, 0xb95f, 0xe0b4, - 0xe0b2, 0xe0be, 0x99fb, 0xe0bb, 0xe0ba, 0x97e0, 0xe0bf, 0xe0c2, - 0xe0c7, 0xe478, 0x96dc, 0xbbc7, 0xe4a4, 0xe47a, 0xbbcc, 0xbbd0, - 0xe4ad, 0xe4b5, 0xe4a6, 0xbbc8, 0x9ca8, 0xe4aa, 0xe0b6, 0x9772, - 0xbbc9, 0xe4b1, 0xe4b6, 0xe4ae, 0x9440, 0xe4b0, 0xe4b9, 0xe4b2, - 0xe47e, 0xe4a9, 0x92f2, 0xbbd1, 0xbbcd, 0xe47c, 0xe4ab, 0xbbcb, - 0xe4a5, 0xbbca, 0xe4b3, 0xe4a2, 0xe479, 0xbbce, 0xe4b8, 0xe47b, - 0xe4af, 0xe4ac, 0xe4a7, 0xe477, 0xe476, 0xe4a1, 0xe4b4, 0xbbcf, - 0xe4b7, 0xe47d, 0xe4a3, 0xbe52, 0x99fd, 0x99fc, 0xbe5a, 0xbe55, - 0xe8a4, 0xe8a1, 0xe867, 0xbe50, 0xf9d7, 0x964a, 0xbe4f, 0xbe56, - 0x96d8, 0x99fe, 0xe865, 0xbe54, 0xe871, 0xe863, 0xe864, 0xbe4e, - 0xe8a3, 0xbe58, 0xe874, 0xe879, 0xe873, 0xebee, 0xe86f, 0xe877, - 0xe875, 0xe868, 0xe862, 0xe87d, 0xbe57, 0xe87e, 0x904b, 0xe878, - 0xe86d, 0xe86b, 0xe866, 0xfa41, 0xe86e, 0xe87b, 0xe86a, 0xe87a, - 0xe8a2, 0x9a40, 0xbe53, 0x975b, 0xe876, 0xe87c, 0xe872, 0xe86c, - 0xbe51, 0x9a41, 0x91dd, 0xe4a8, 0xe870, 0xbe59, 0xe869, 0x93fc, - 0x9a42, 0x9a43, 0x9659, 0xebf4, 0xbff7, 0xebf3, 0xebf0, 0xec44, - 0xbffb, 0x9a44, 0xec41, 0xebf8, 0xec43, 0xebe9, 0xebf6, 0x9051, - 0xbffd, 0xebe1, 0x94bf, 0xebdf, 0xec42, 0xec40, 0xebfe, 0xebed, - 0xebec, 0xebe2, 0xc040, 0xebe8, 0xebf2, 0xebfd, 0xc043, 0xec45, - 0xc1e8, 0xc045, 0xbffe, 0xebe6, 0xebef, 0xebde, 0xebe0, 0xbff5, - 0xc042, 0xbffa, 0xebe7, 0xebf7, 0xebf1, 0xc041, 0xebdd, 0xc1e3, - 0xebf9, 0xebfc, 0xbffc, 0x90a2, 0xebeb, 0xc044, 0xbff9, 0x9cab, - 0x9776, 0xbff8, 0xebf5, 0xebfb, 0xbff6, 0xebe4, 0xebfa, 0xebe5, - 0xfc55, 0xfe45, 0x94a8, 0x9a45, 0xfa4b, 0x9de1, 0xebea, 0xeed2, - 0x96d9, 0xeed7, 0xc1e5, 0xc1e7, 0xeedd, 0xc1e1, 0xeeec, 0xeee3, - 0xeed8, 0xeed9, 0xeee2, 0xc1ee, 0xeee1, 0xeed1, 0xeee0, 0xeed4, - 0xeeed, 0xc1ed, 0xc1eb, 0xeed5, 0xeee8, 0x9774, 0xeeda, 0xeee7, - 0xfdf5, 0xeee9, 0xeed0, 0xc1e6, 0x92e5, 0xeeea, 0x9645, 0x91da, - 0xeede, 0x90a3, 0xc1ea, 0xeedb, 0xa05f, 0xc1ec, 0xeee4, 0x90af, - 0x97bf, 0xc1e4, 0xeed6, 0xeee5, 0x914c, 0xeedf, 0xebe3, 0xeee6, - 0xeed3, 0x967a, 0xc1e9, 0xeeeb, 0x91de, 0xc1e2, 0xeece, 0x9a46, - 0xfeb0, 0x9779, 0x946c, 0xf160, 0xf159, 0xc2e9, 0xf154, 0xf163, - 0xf15b, 0xeedc, 0x9858, 0xf165, 0xf155, 0xc2e8, 0xf15f, 0xc2ea, - 0xc2f2, 0xc2f0, 0xf161, 0xc2f1, 0xf157, 0x9266, 0xf158, 0xf15d, - 0xf162, 0x93fb, 0xeecd, 0xc2eb, 0xf16a, 0xf167, 0xf16b, 0xf15e, - 0xf15a, 0xf168, 0xf36a, 0xf15c, 0xc2ee, 0x9a47, 0xc2ed, 0xeecf, - 0xc2ef, 0xf164, 0xf166, 0xc2ec, 0xf169, 0xf153, 0xf156, 0x9749, - 0x9748, 0x934a, 0x9ce2, 0xf373, 0xf363, 0xc3eb, 0xf371, 0x9264, - 0xf361, 0xc3ec, 0xf36c, 0x91df, 0xf368, 0xc3f1, 0xf372, 0xf362, - 0xf365, 0xc3e9, 0xf374, 0xfb79, 0xf36d, 0xf370, 0xc3ef, 0xc3f4, - 0xc3f2, 0xf369, 0xf364, 0x96d7, 0xc3ed, 0xc3ee, 0xf360, 0xc3ea, - 0x9343, 0xc3e8, 0xc3f0, 0xf36f, 0xc3f3, 0xf36b, 0xf375, 0xc3f5, - 0xf367, 0xf36e, 0xfdcb, 0xfe7a, 0x91db, 0x8c6a, 0xf4f3, 0xf542, - 0xf4f5, 0xf4fc, 0xf366, 0xf4fa, 0xf4e9, 0xf540, 0xc4c3, 0xf4ed, - 0xf4fe, 0xf4f4, 0x97af, 0xc4c2, 0x95dd, 0xf544, 0xf4f6, 0x9348, - 0xf4fb, 0xf4fd, 0xf4e7, 0xf541, 0xf4f2, 0xf4f7, 0xf4eb, 0xf4ef, - 0xf543, 0xf4f9, 0xf4e8, 0xf4ec, 0xf4ee, 0xf4f8, 0x9a4b, 0xc4c1, - 0xf4f1, 0xfc45, 0x9a4d, 0xf4ea, 0x91bc, 0x90e2, 0x90b4, 0x95e1, - 0xf4f0, 0xf661, 0xf666, 0xc54f, 0xf668, 0x9a4e, 0xc549, 0xf664, - 0xf66a, 0xc54e, 0xc54a, 0xc54b, 0xf660, 0xf667, 0xc54d, 0xf665, - 0xc54c, 0xf65f, 0xf663, 0xf662, 0x9a4f, 0xf65e, 0xf669, 0xfe40, - 0xfe43, 0xc5b1, 0xf76d, 0xf770, 0xf76c, 0xf76e, 0xf76f, 0xf769, - 0xf76a, 0xf767, 0x96dd, 0xf76b, 0xf768, 0xc5b2, 0xc5b3, 0x9a51, - 0xf84b, 0xf84d, 0x96a7, 0x90b0, 0xf84c, 0xf84e, 0xc5e0, 0xf84a, - 0xc5df, 0xc5e1, 0x9c4e, 0x9443, 0xf8cb, 0xf8cc, 0xc644, 0xf8ca, - 0x8eba, 0xf953, 0xf952, 0xf954, 0xc65f, 0xf955, 0xc65e, 0xf956, - 0xf972, 0xf975, 0xf974, 0xc668, 0xf973, 0x9a52, 0xfcc1, 0xc672, - 0xc670, 0xc671, 0xc677, 0xf9c0, 0xf9c1, 0xf9bf, 0xf9c9, 0x8be9, - 0x9caf, 0x8bfd, 0x9abc, 0x9ab8, 0x9aae, 0x9aa7, 0x9a53, 0x9d74, - 0xaaf8, 0x8bea, 0xd844, 0xdc78, 0xe8a5, 0xf376, 0x8beb, 0xaaf9, - 0xadac, 0xb07b, 0x90b2, 0xd845, 0xd846, 0xb3ac, 0xb67d, 0xdc7a, - 0xdc79, 0xb6a3, 0xb67c, 0xdc7b, 0xb67e, 0xb6a2, 0xb6a1, 0xb67b, - 0x95e9, 0x95e8, 0xb968, 0x95e6, 0xe0d0, 0xe0ce, 0xe0cf, 0xe0cd, - 0x90b5, 0xbbd2, 0x9a54, 0xbbd5, 0xbbd7, 0xbbd6, 0x90b3, 0x95e7, - 0xbbd3, 0xbbd4, 0x8b50, 0xe8a7, 0xe8a6, 0xbe5b, 0xe8a8, 0xe8a9, - 0xbe5c, 0xec4d, 0xec4b, 0xeef3, 0xec49, 0xec4a, 0xc046, 0xec46, - 0xec4e, 0xec48, 0xec4c, 0xeeef, 0xeef1, 0xeef2, 0xc1f3, 0xeeee, - 0xc1f2, 0xeef0, 0xc1ef, 0xc1f0, 0xc1f1, 0xec47, 0xc2f5, 0xf16e, - 0xf16c, 0xf16d, 0xc2f3, 0xc2f6, 0xc2f4, 0xf377, 0xf378, 0xc3f6, - 0xf545, 0xf547, 0xf546, 0xc4c4, 0xc550, 0xf66d, 0xf66c, 0xf66b, - 0x8bec, 0x9a56, 0xaafa, 0x8bfb, 0xc9aa, 0xca58, 0xa6e9, 0xca56, - 0xca59, 0xca57, 0xcbae, 0xa8c1, 0xa8c2, 0xcbb0, 0xa8bf, 0xcbaf, - 0xcbad, 0xa8c0, 0xa8be, 0x9a57, 0xa0aa, 0xcdd8, 0xcddb, 0xaafd, - 0xcdda, 0xcdd9, 0xaafc, 0xaafb, 0x9fa6, 0xab40, 0xcddc, 0xaafe, - 0x99cc, 0xd0c6, 0xadae, 0xadaf, 0xadb0, 0xd0c7, 0xd0c3, 0xadad, - 0xd0c4, 0xd0c5, 0xd0c2, 0x9c59, 0xb0a4, 0xb0a1, 0xd445, 0xb0a2, - 0xb0a5, 0xd446, 0xb07e, 0xb07c, 0xb07d, 0xb0a3, 0x99b5, 0xb3ad, - 0xd849, 0xb3b5, 0xd848, 0xd84b, 0xb3b1, 0xd84a, 0xb6ab, 0xb3af, - 0xb3b2, 0xb3ae, 0xb3b3, 0xb3b4, 0xb3b0, 0x90be, 0xd847, 0xb6a7, - 0xdc7d, 0xdca3, 0x9faf, 0xdca2, 0xb6ac, 0xb6a8, 0xb6a9, 0xdc7c, - 0xdc7e, 0xdca1, 0xb6a4, 0xb6a6, 0xb6aa, 0xb6a5, 0x95f2, 0xe0d3, - 0xe0d1, 0xe0d2, 0xb96a, 0xb96b, 0x90bf, 0xe0d4, 0xb969, 0xbbd8, - 0xbbda, 0xbbd9, 0xe4bb, 0xe4bc, 0xe8ab, 0x90c1, 0xe8aa, 0xfee4, - 0xc047, 0xc048, 0xec4f, 0xc049, 0xeef6, 0xeef4, 0xeef5, 0xc1f4, - 0xf16f, 0xc3f7, 0x90c4, 0xc1f5, 0xab41, 0xb0a6, 0xd447, 0x90c7, - 0xd84c, 0xb3b6, 0xb6ad, 0xdca4, 0xdca6, 0xb6af, 0xb6ae, 0xb6b0, - 0xb6b1, 0xdca5, 0xb96e, 0xb96f, 0xb96d, 0xbbdb, 0xb96c, 0xe0d5, - 0xbbdc, 0xe8ac, 0xec50, 0xc04a, 0xc1f6, 0xf170, 0xf174, 0xc2f9, - 0xf171, 0xc2fa, 0xc2f8, 0xf175, 0xc2fb, 0xf173, 0xf379, 0xc2f7, - 0xc3f8, 0xf8cd, 0xab42, 0xb3b8, 0xb3b7, 0xb6b2, 0xdca8, 0xdca7, - 0xb6b3, 0x92e4, 0xe0d9, 0xb973, 0xb970, 0xe0d8, 0xb972, 0xe0d6, - 0xb971, 0xe0d7, 0xe4bd, 0xbbdd, 0xe8af, 0x9f52, 0xbe5d, 0xe8ad, - 0xbe5e, 0xbe5f, 0xe8ae, 0xbe60, 0xec51, 0xc04e, 0xc04b, 0xc050, - 0xec53, 0xc04c, 0xec52, 0xc04f, 0xc04d, 0xeef9, 0xeefb, 0x90db, - 0xc1f7, 0xeefa, 0xc1f8, 0xeef8, 0xeef7, 0xa066, 0xf177, 0xf176, - 0xc2fc, 0xf178, 0xf37e, 0xc3fa, 0xf37d, 0xf37a, 0xc3f9, 0xf37b, - 0xf37c, 0xf548, 0xf549, 0xc4c5, 0x90d2, 0xc553, 0xf66e, 0x90d4, - 0xc551, 0xc552, 0xf66f, 0xc5b4, 0xc5b5, 0xf771, 0x9a5b, 0x95fd, - 0xc645, 0xf8cf, 0xc647, 0xf8ce, 0xf8d0, 0xc646, 0xf957, 0xf9ad, - 0x8bc4, 0xab43, 0x8c66, 0xb974, 0x90de, 0xe4be, 0xe8b0, 0xc051, - 0xc052, 0x9ce4, 0xab44, 0x90e1, 0xbe61, 0xc3fb, 0xadb1, 0xc053, - 0xc5e2, 0xadb2, 0xd84d, 0xdca9, 0x9e46, 0xdcab, 0xdcaa, 0x9651, - 0xe0dd, 0xe0da, 0xb975, 0xb976, 0xe0db, 0xe0dc, 0xe4c0, 0xe4c5, - 0xbbde, 0xe4bf, 0xe4c1, 0xe4c8, 0xe4c3, 0xe4c7, 0xe4c4, 0xe4c2, - 0xe4c6, 0xbbdf, 0xfb58, 0xe8b3, 0x90e6, 0xe8b1, 0xbe63, 0xbe62, - 0xe8b2, 0xbe64, 0xec56, 0xec55, 0xc054, 0xec54, 0xeefc, 0x9650, - 0xeefe, 0xef41, 0xef40, 0x90e7, 0xc1f9, 0xeefd, 0xf1a1, 0xc2fd, - 0xf17d, 0xf1a2, 0xc2fe, 0xf17b, 0xf17e, 0xf17c, 0xf179, 0xc340, - 0xf17a, 0x90e8, 0x9a5d, 0xf3a1, 0x9f7a, 0xf3a3, 0xf3a2, 0x9b5c, - 0xf54a, 0x9f7c, 0xf54b, 0xfc52, 0x90e9, 0xf670, 0x90ea, 0xc5b7, - 0x9a5e, 0xc5b6, 0xf84f, 0xf850, 0xc648, 0xf8d1, 0x9f76, 0xc669, - 0xadb3, 0xb6b4, 0xe4ca, 0xe4c9, 0xe8b5, 0xe8b4, 0x90eb, 0xc1fa, - 0xef43, 0xef42, 0xf1a5, 0xf1a3, 0xf1a6, 0xf1a4, 0xc3fc, 0xf3a4, - 0xf3a5, 0xf3a6, 0x90ec, 0xf671, 0xf772, 0xf8d2, 0x8bee, 0xadb4, - 0x90ee, 0xec57, 0xef44, 0x91c6, 0xadb5, 0x90f2, 0xbbe0, 0xec58, - 0xc341, 0xf1a7, 0xc3fd, 0xf54c, 0xf54d, 0xc554, 0xf851, 0xadb6, - 0xb3bb, 0xb3bc, 0xd84e, 0xb6b5, 0xb6b6, 0xdcac, 0xb6b7, 0xb97a, - 0xb97c, 0xe0df, 0xe0e0, 0xe0de, 0xb977, 0xb978, 0xb97b, 0xb979, - 0xfcbc, 0x8a74, 0xe4cb, 0xbbe1, 0xbbe2, 0xe8bc, 0xbe67, 0xe8b7, - 0xe8b6, 0x9657, 0xe8bb, 0xbe65, 0x9cef, 0xc05b, 0xe8b8, 0xe8bd, - 0xe8ba, 0xe8b9, 0xbe66, 0xc059, 0x9fdf, 0xec5a, 0xc055, 0xec5b, - 0x90f7, 0x90f6, 0xec59, 0xc058, 0xc056, 0xc05a, 0xc057, 0xef45, - 0xef4a, 0xef46, 0xef49, 0xc1fb, 0x9b5e, 0xedd4, 0xef48, 0xef47, - 0x90f8, 0xc344, 0xc342, 0xc345, 0xc343, 0xf1a8, 0xf1a9, 0xf1aa, - 0xc346, 0xf3aa, 0xc440, 0xf3a8, 0xc441, 0xf3a7, 0xf3a9, 0xc3fe, - 0xf551, 0xf54e, 0xf54f, 0xf550, 0xf672, 0xc556, 0x90f9, 0xc555, - 0x8cc9, 0xf774, 0xf773, 0xc5b8, 0xfa6a, 0xc5e3, 0xc649, 0xc660, - 0xf958, 0xf9ae, 0xf9af, 0x8bef, 0xadb7, 0xdcad, 0xe0e1, 0xe4cc, - 0xe4cd, 0xbbe3, 0xbbe4, 0xe8be, 0xbe68, 0x9fe0, 0xc1fc, 0x9142, - 0xf1ab, 0x9a62, 0xc347, 0xf3ad, 0xc442, 0xf3ac, 0xf3ae, 0xf3ab, - 0xf675, 0xf552, 0xf553, 0x9569, 0xc4c6, 0xf674, 0x9144, 0x9143, - 0xf673, 0x9141, 0xf775, 0xf9b0, 0x8bf0, 0xadb8, 0x9660, 0x8bf1, - 0xadb9, 0x99f6, 0x9149, 0xb0a7, 0xd448, 0xd84f, 0x914a, 0xb6b8, - 0xb6bb, 0xb6b9, 0xdcae, 0x914b, 0xb6bd, 0xb6ba, 0x9a64, 0xb6bc, - 0xb97e, 0x8abf, 0xe0e2, 0xe0e3, 0xe8c0, 0xb97d, 0xb9a1, 0xb9a2, - 0xe4cf, 0xe4ce, 0xbbe5, 0xbbe6, 0xe4d0, 0xe8bf, 0xbbe8, 0xbe69, - 0xbbe7, 0x9a66, 0xc05c, 0xe8c1, 0xbe6b, 0xbe6a, 0xe8c2, 0xe8c5, - 0xe8c3, 0xe8c4, 0xbe6c, 0x9a67, 0xc061, 0xc05f, 0x9a69, 0xc05e, - 0xec5d, 0xc060, 0xec5c, 0xef4b, 0xec5e, 0xc05d, 0xec5f, 0xef4e, - 0xef4c, 0xef4d, 0xef52, 0xc34b, 0xef51, 0xef54, 0xef53, 0xef50, - 0xef4f, 0xc1fd, 0x9a6a, 0x9652, 0x914d, 0xf1ae, 0x9666, 0xf1ad, - 0xc34a, 0xc348, 0xc349, 0x9f7b, 0xf1ac, 0x9a6b, 0xf3b1, 0xc443, - 0xf3b0, 0xf3af, 0xc444, 0xa06c, 0xf558, 0xf557, 0x9667, 0xf555, - 0xf554, 0xc4c8, 0xc4c7, 0xf559, 0xf776, 0xc5b9, 0xf677, 0xc557, - 0xf676, 0xf556, 0xf777, 0xc5e4, 0x9a6c, 0xc661, 0xf959, 0xf9b1, - 0x9a6d, 0x8bf2, 0xadba, 0xd850, 0xef55, 0xadbb, 0x966a, 0xe4d2, - 0xe4d1, 0xec60, 0xef57, 0xef56, 0xfcea, 0xc34c, 0xf3b2, 0xf3b3, - 0xc4c9, 0x966c, 0xf9b2, 0xb0a8, 0xb6bf, 0xb6be, 0xe0e4, 0xe0e6, - 0xb9a4, 0xe0e5, 0xb9a3, 0xb9a5, 0xe0e7, 0x91c4, 0xe4d4, 0xe4d6, - 0xe4d5, 0x9677, 0xe4d8, 0xbbe9, 0xe4d7, 0xe4d3, 0x99f4, 0x9a6f, - 0xe4d9, 0xe8cc, 0xe8cf, 0xe8d1, 0xe8c7, 0xe8cb, 0xe8c8, 0xbe6e, - 0xbe71, 0xbe73, 0xe8c9, 0xe8ca, 0xbe72, 0xe8cd, 0xe8d0, 0xe8ce, - 0xbe74, 0x9fab, 0xbe70, 0xe8c6, 0xbe6d, 0xbe6f, 0x8cbe, 0x8ec1, - 0xc063, 0xec66, 0xec64, 0xec63, 0x9555, 0xec69, 0xec68, 0xec67, - 0xec62, 0xc062, 0xec61, 0xec65, 0xc064, 0xef5a, 0x9152, 0xef5e, - 0xef5b, 0xef5d, 0xef5c, 0xef59, 0xef5f, 0xef62, 0xef60, 0xef61, - 0xc240, 0xc1fe, 0xef58, 0xef63, 0xf1b3, 0xf1b6, 0xf1b8, 0xf1b7, - 0xf1b1, 0xf1b5, 0xf1b0, 0x9153, 0xf1b2, 0xc34d, 0xf1af, 0x9155, - 0xf1b4, 0xf3c0, 0xf3b5, 0xc445, 0xc446, 0xf3b4, 0xf3b9, 0xf3bf, - 0xf3b7, 0xf3be, 0x955d, 0xf3bb, 0x9671, 0xf3ba, 0xf3bd, 0xf3b8, - 0xf3b6, 0x9c6d, 0xf3bc, 0xf560, 0xf55e, 0xc4ca, 0xf55d, 0xf563, - 0xf561, 0x9673, 0xc4cb, 0xf55c, 0xf55a, 0xf55b, 0xc4cd, 0xf55f, - 0xc4cc, 0xf562, 0xf678, 0xf67e, 0x9154, 0x9a71, 0xf679, 0xc55b, - 0xf6a1, 0xc55a, 0xf67d, 0xf67c, 0xc559, 0xf67b, 0xc558, 0xf67a, - 0xf77d, 0xf7a1, 0xf77e, 0xf77b, 0xc5bb, 0xf778, 0xf77c, 0xf7a3, - 0xf7a2, 0xf779, 0xf77a, 0xc5ba, 0xf852, 0xc5e7, 0x9156, 0xf853, - 0xc5e5, 0xc5e6, 0x966d, 0xf8d3, 0xc64a, 0xf976, 0xc66a, 0x9557, - 0xf9b3, 0xc66b, 0xf9b4, 0xf9b5, 0xf9c3, 0xf9c2, 0xc67a, 0xf9cd, - 0x89c6, 0x89c7, 0xb0a9, 0xe0e9, 0xe0e8, 0xbbea, 0xbbeb, 0xe4da, - 0x8a6a, 0xe8d2, 0xec6c, 0x8b57, 0xbe75, 0xc065, 0xec6a, 0x9fe1, - 0xec6d, 0xc066, 0x9b5f, 0xef64, 0xec6b, 0xf1b9, 0xc34e, 0xf3c1, - 0xf566, 0xf564, 0xf565, 0xf6a2, 0xc55c, 0xf7a4, 0xc5ea, 0xc5bc, - 0xc5e8, 0xc5e9, 0xf8d4, 0xc662, 0xa05d, 0xb0aa, 0xf1ba, 0xd449, - 0x915b, 0xb9a6, 0x915c, 0xe4db, 0xbbec, 0xe4dc, 0xe8d4, 0xe8d3, - 0xc068, 0xbe76, 0xbe77, 0xe8d7, 0xe8d6, 0xe8d5, 0x915e, 0xec6e, - 0xec71, 0xec70, 0xec6f, 0xc067, 0xef68, 0xef66, 0xef65, 0x9f5c, - 0xef67, 0x9f57, 0xc34f, 0xf1bc, 0xf1bd, 0xc350, 0xf1bb, 0x9f65, - 0xf3c3, 0xf3c2, 0xf3c5, 0xc447, 0xf3c4, 0x9a72, 0xf567, 0xf569, - 0xf568, 0x9160, 0xf6a3, 0xf6a6, 0xf6a4, 0xf6a5, 0xf7a5, 0xc5bd, - 0xf854, 0xf855, 0xf856, 0xc64b, 0xc663, 0xf9b6, 0xb0ab, 0xbe78, - 0xc069, 0xf1be, 0x9f5e, 0xf7a6, 0x9161, 0xf9c4, 0xd44a, 0xc67b, - 0xb0ac, 0xec72, 0x9164, 0xf1bf, 0xf3c6, 0x9f41, 0xf6a7, 0xf7a7, - 0xb0ad, 0xe4dd, 0xe4de, 0x9169, 0xbbed, 0xbbee, 0xe8d9, 0xbe7a, - 0xbe79, 0xe8d8, 0xef69, 0xf1c0, 0xf1c2, 0xf1c1, 0xc353, 0xc352, - 0xc351, 0x9168, 0xc55e, 0xf6a8, 0xc55d, 0xf7a9, 0xf7a8, 0xc64c, - 0xf8d5, 0xb3bd, 0xe0ea, 0xe4e1, 0xe4df, 0xe4e0, 0xe8e2, 0xe8dd, - 0xe8da, 0xe8e1, 0x9a74, 0xe8e3, 0xbe7c, 0xe8e0, 0xe8dc, 0xe8db, - 0xe8df, 0xe8de, 0xbe7b, 0xec7d, 0xec78, 0xec76, 0xeca1, 0xec77, - 0x96b2, 0xec73, 0x9a75, 0xec79, 0xfda5, 0xec74, 0xef72, 0xec75, - 0xeca2, 0x9ee9, 0x8bba, 0x916d, 0xa060, 0xec7c, 0xc06a, 0xec7b, - 0xec7a, 0xec7e, 0x9fde, 0xef6a, 0xef6d, 0x9fc3, 0xef6c, 0x96b5, - 0xef74, 0xef6f, 0xef73, 0xef71, 0xef70, 0xef6e, 0xef6b, 0xc243, - 0xc242, 0xc244, 0xc241, 0xef75, 0xa067, 0xf1c8, 0xf1cb, 0xf1c9, - 0xf1cd, 0xf1ce, 0xf1c6, 0xc358, 0xf1c7, 0xf1c5, 0xf1cc, 0xf1c4, - 0xf1c3, 0xc357, 0xc355, 0xc354, 0x96b3, 0xf1ca, 0xf3cf, 0xf3d5, - 0xc44a, 0xf3d0, 0xf3d3, 0xf3d7, 0xc44b, 0xf3d2, 0x9a76, 0xf3ca, - 0xf3c9, 0xf3d6, 0xf3cd, 0xf3cb, 0xf3d4, 0xf3cc, 0xc449, 0xc448, - 0x95d5, 0xf3c7, 0xf3c8, 0xf3d1, 0x9eca, 0xf3ce, 0x9a77, 0x9a78, - 0xf56c, 0xf56f, 0xc356, 0x9170, 0x916f, 0xf56d, 0xf573, 0xf571, - 0xf56b, 0xf576, 0x9fa3, 0xf56a, 0x9171, 0xc4cf, 0xf572, 0x96b1, - 0xf56e, 0xc4ce, 0xf575, 0x9f63, 0xf574, 0x9f67, 0xf6ab, 0xf6aa, - 0x8bb9, 0x9a7a, 0xf6b1, 0xf6ad, 0xf6b0, 0xc560, 0x8b56, 0xf6ae, - 0xf6af, 0xf6a9, 0xf6ac, 0xc55f, 0x9ada, 0xc5bf, 0xf7b4, 0xf7af, - 0xf7b3, 0x96b0, 0xf7b6, 0xf7b2, 0xf7ae, 0x9a7e, 0xc5c1, 0xf7b1, - 0xf7b5, 0xc5c0, 0xf7ac, 0xf570, 0xf7b0, 0xf7ad, 0x9dde, 0xf7aa, - 0xf7ab, 0xc5be, 0xf85a, 0xf85c, 0xf85f, 0xf85b, 0xf860, 0x96ad, - 0xf859, 0xf857, 0x96ae, 0xc5eb, 0xf85d, 0xc5ed, 0xc5ec, 0xf858, - 0xf85e, 0x9ea1, 0xf8da, 0xc64d, 0xf8db, 0xf8d9, 0xf8d6, 0xf8d8, - 0xf8d7, 0xf95a, 0xf95c, 0xf95b, 0xf979, 0x9e50, 0xf978, 0xf977, - 0xf97a, 0xc673, 0xc674, 0xf9ca, 0xf9ce, 0x96af, 0x8bf4, 0xb3be, - 0xdcaf, 0xe0ed, 0xb9a7, 0xe0eb, 0xe0ec, 0xe4e2, 0xe4e3, 0xbbf1, - 0xbbef, 0xe4e4, 0xbbf0, 0xe8e8, 0xe8eb, 0xe8e5, 0xe8ec, 0xe8e4, - 0xe8e6, 0xe8e7, 0xe8ea, 0x9fa4, 0xbea1, 0xe8ef, 0xe8ee, 0xbe7d, - 0xe8e9, 0xe8ed, 0xbe7e, 0x96bd, 0xecac, 0xc06f, 0xeca7, 0xc06b, - 0x96f4, 0xeca4, 0xecaa, 0xecad, 0xc070, 0xeca9, 0xeca6, 0xecae, - 0xeca5, 0x96b8, 0xecab, 0xc06c, 0xeca3, 0xc06d, 0xc06e, 0xeca8, - 0xefa9, 0xef7a, 0xef7b, 0xef7e, 0xef7c, 0xef76, 0xfaa1, 0xef79, - 0xefa5, 0xef7d, 0x91a7, 0xc245, 0xefa7, 0xefa4, 0xc246, 0xefa6, - 0xef77, 0xefa2, 0xefa3, 0xa05e, 0xefa1, 0x9a7d, 0xf1d2, 0xf1d4, - 0xf1d7, 0x8948, 0xf1d1, 0x9eb1, 0xc359, 0xf1d9, 0xf1d0, 0xf1da, - 0xf1d6, 0xf1d8, 0xf1dc, 0xf1d5, 0xf1dd, 0xf1d3, 0xf1cf, 0xc35a, - 0x9ddb, 0xf1db, 0xc35b, 0xc44d, 0xef78, 0xf3f1, 0xf3e8, 0xc44f, - 0xf3e4, 0xc450, 0x95bf, 0x8a73, 0xf3ed, 0xf3e7, 0xf3dd, 0xc44e, - 0xf3ea, 0xf3e5, 0xf3e6, 0xf3d8, 0xf3df, 0xf3ee, 0xf3eb, 0x9efe, - 0xf3e3, 0x917a, 0xf3ef, 0xf3de, 0xf3d9, 0xf3ec, 0x917b, 0xf3db, - 0xf3e9, 0xf3e0, 0xf3f0, 0xf3dc, 0xc44c, 0xf3da, 0xf3e1, 0xf3e2, - 0xf57d, 0xf57b, 0x9aa3, 0xf5a2, 0xf5ae, 0xf5a5, 0xf57c, 0xf578, - 0xf5a7, 0xf57e, 0xf5a3, 0xf57a, 0xf5aa, 0xf577, 0xf5a1, 0xf5a6, - 0xf5a8, 0xf5ab, 0xf579, 0x96c2, 0xf5af, 0xf5b0, 0xf5a9, 0xf5ad, - 0xf5a4, 0x9f77, 0xf6c1, 0xf6c4, 0xc561, 0xf6c3, 0xf6c8, 0xf6c6, - 0xc562, 0xf6bd, 0xf6b3, 0xf6b2, 0xc564, 0xf6bf, 0xf6c0, 0xf6bc, - 0xf6b4, 0x9aa4, 0xf6b9, 0xf5ac, 0x9aa5, 0xf6b5, 0xc563, 0xf6bb, - 0x91a1, 0xf6ba, 0xf6b6, 0xf6c2, 0x89b8, 0xf6b7, 0xf7bb, 0xf6c5, - 0xf6c7, 0xf6be, 0xf6b8, 0xf7bc, 0xf7be, 0xf7b8, 0xc5c2, 0x9173, - 0xf7c5, 0xf7c3, 0xc5c3, 0xf7c2, 0xf7c1, 0xf7ba, 0xf7b7, 0xf7bd, - 0xf7c6, 0xf7b9, 0xf7bf, 0xf869, 0xf86e, 0xf864, 0xf867, 0xc5ee, - 0xf86b, 0xf872, 0xf7c0, 0xf865, 0xf86f, 0xf873, 0xf86a, 0xf863, - 0xf86d, 0xf86c, 0xf871, 0xf870, 0xf7c4, 0xf868, 0xf862, 0xf866, - 0xc64e, 0xc64f, 0xf861, 0x9aa6, 0xf8e6, 0xf8dd, 0xf8e5, 0xf8e2, - 0xf8e3, 0xf8dc, 0xf8df, 0xf8e7, 0xf8e1, 0xf8e0, 0xf8de, 0xf8e4, - 0x89bd, 0xf95d, 0x89b9, 0xf95e, 0x917d, 0xf960, 0xf95f, 0xf962, - 0xf961, 0xf97c, 0xf97b, 0xf9b7, 0xf9b8, 0x96bb, 0xf9c5, 0xc678, - 0xc67c, 0x9ff2, 0xf9cf, 0xc67d, 0x8bf5, 0xb3bf, 0xc4d0, 0xf6c9, - 0x9aa9, 0xc650, 0xc651, 0xb3c0, 0xe0ee, 0x9f54, 0xb9a8, 0xe8f0, - 0x9fe3, 0x9eed, 0xecb0, 0xecb1, 0xecaf, 0xefab, 0xefaa, 0xc247, - 0xf1df, 0xefac, 0xf1de, 0x91aa, 0xf3f3, 0xc451, 0xc453, 0xf3f2, - 0x91ab, 0xa070, 0xc452, 0x9f6d, 0xf5b1, 0xf5b3, 0xf5b2, 0xf6ca, - 0xc565, 0x91ac, 0xc5ef, 0xf8e8, 0xf963, 0x91ad, 0xf9d2, 0xb3c1, - 0xa0fd, 0xe4e5, 0x9fe2, 0xbea2, 0x91af, 0x9e41, 0x9aaa, 0xecb3, - 0xecb2, 0x91b0, 0xefad, 0x9aab, 0xc454, 0xc4d1, 0xf7c7, 0xf9cb, - 0xb3c2, 0xbbf2, 0x9aac, 0xbea3, 0x9a4a, 0xf3f4, 0x91b2, 0xf874, - 0xb6c0, 0x8bf6, 0x9aad, 0x89b6, 0xefae, 0xc664, 0xb6c1, 0xbea4, - 0xc248, 0xf875, 0xb6c2, 0xe8f1, 0xc072, 0xecb4, 0xecb5, 0xc071, - 0xefaf, 0xc24c, 0xc24a, 0xc24b, 0xc249, 0xf1e0, 0xc35c, 0x9aaf, - 0xf5b5, 0xf5b4, 0xf5b7, 0xf5b6, 0xc4d2, 0xf6cb, 0xf6cd, 0xf6cc, - 0xc566, 0xf7c8, 0x9ab0, 0xf876, 0xf877, 0xc5f0, 0xf964, 0xf97d, - 0xc675, 0x9ab1, 0xdcb0, 0xecb6, 0xefb0, 0xf3f5, 0xe0ef, 0x9aa1, - 0xefb1, 0xf1e2, 0xf1e1, 0x91b9, 0xf878, 0xc652, 0x91ba, 0xf965, - 0xf97e, 0xb9a9, 0xe8f2, 0xe8f3, 0xecb7, 0xb9aa, 0xc35d, 0xf1e3, - 0x91be, 0xf6cf, 0xc567, 0xf6d0, 0xf6ce, 0xf879, 0xf8e9, 0xb9ab, - 0xefb4, 0xefb3, 0xefb2, 0xf1e4, 0xa041, 0x8bb7, 0xf1e8, 0xf1e7, - 0xf1e6, 0xf1e5, 0xc35e, 0xf3f6, 0xf5b9, 0xc4d3, 0xf5b8, 0xf6d1, - 0xf7cb, 0xf7ca, 0xc5c4, 0xf7c9, 0xf87c, 0xf87b, 0xf87a, 0x91c0, - 0xbbf3, 0xecb8, 0xc24d, 0xf3f7, 0xf3f8, 0xf7cc, 0xf87d, 0x9ab3, - 0x91c3, 0xf8ea, 0xf966, 0xf9b9, 0xf9d4, 0xbbf4, 0xc24e, 0xf1e9, - 0xf3f9, 0xf6d2, 0xf87e, 0xa0fc, 0xbea6, 0x9fee, 0xefb5, 0xf1ea, - 0xf3fa, 0xf3fb, 0xf3fc, 0xf5be, 0x9f69, 0xf5ba, 0xc568, 0xf5bd, - 0xf5bc, 0xc4d4, 0xf5bb, 0xc4d6, 0x91c8, 0xc4d5, 0xf6d4, 0xf6d3, - 0xc569, 0xc56a, 0x91c9, 0xc5c6, 0xf7cd, 0xc5c5, 0xf8a3, 0xf8a4, - 0xf8a2, 0xf8a1, 0xc654, 0xf8eb, 0xf8ec, 0xf8ed, 0xc653, 0xf967, - 0xf96a, 0xf969, 0xf968, 0xf9d3, 0x8de6, 0xc073, 0x91cb, 0xc365, - 0xf5bf, 0xf6d5, 0xc5c7, 0xf7ce, 0xf9d5, 0x89c8, 0xc074, 0x8daa, - 0xefb6, 0xf7cf, 0xf9a1, 0x9fdd, 0xfa40, 0xfa41, 0xfa42, 0xfa43, - 0xfa44, 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0xfa4a, 0xfa4b, - 0xfa4c, 0xfa4d, 0xfa4e, 0xfa4f, 0xfa50, 0xfa51, 0xfa52, 0xfa53, - 0xfa54, 0xfa55, 0xfa56, 0xfa57, 0xfa58, 0xfa59, 0xfa5a, 0xfa5b, - 0xfa5c, 0xfa5d, 0xfa5e, 0xadc5, 0xfa60, 0xfa61, 0xfa62, 0xfa63, - 0xfa64, 0xfa65, 0xb0b0, 0xfa67, 0xfa68, 0xfa69, 0xfa6a, 0xfa6b, - 0xfa6c, 0xfa6d, 0xfa6e, 0xfa6f, 0xfa70, 0xfa71, 0xfa72, 0xfa73, - 0xfa74, 0xfa75, 0xfa76, 0xfa77, 0xfa78, 0xfa79, 0xfa7a, 0xfa7b, - 0xfa7c, 0xfa7d, 0xfa7e, 0xfaa1, 0xfaa2, 0xfaa3, 0xfaa4, 0xfaa5, - 0xfaa6, 0xfaa7, 0xfaa8, 0xfaa9, 0xfaaa, 0xfaab, 0xfaac, 0xfaad, - 0xfaae, 0xfaaf, 0xfab0, 0xfab1, 0xfab2, 0xfab3, 0xfab4, 0xfab5, - 0xfab6, 0xfab7, 0xfab8, 0xfab9, 0xfaba, 0xfabb, 0xfabc, 0xa55d, - 0xfabe, 0xfabf, 0xfac0, 0xfac1, 0xfac2, 0xfac3, 0xfac4, 0xa2cd, - 0xfac6, 0xfac7, 0xfac8, 0xfac9, 0xfaca, 0xfacb, 0xfacc, 0xfacd, - 0xface, 0xfacf, 0xfad0, 0xfad1, 0xfad2, 0xfad3, 0xfad4, 0xadeb, - 0xfad6, 0xfad7, 0xfad8, 0xfad9, 0xfada, 0xfadb, 0xfadc, 0xfadd, - 0xfade, 0xfadf, 0xfae0, 0xfae1, 0xfae2, 0xfae3, 0xfae4, 0xfae5, - 0xfae6, 0xfae7, 0xfae8, 0xfae9, 0xfaea, 0xfaeb, 0xfaec, 0xfaed, - 0xfaee, 0xfaef, 0xfaf0, 0xfaf1, 0xfaf2, 0xfaf3, 0xfaf4, 0xfaf5, - 0xfaf6, 0xfaf7, 0xfaf8, 0xfaf9, 0xfafa, 0xfafb, 0xfafc, 0xfafd, - 0xfafe, 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, 0xfb45, 0xfb46, - 0xfb47, 0x9def, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, 0xfb4d, 0xfb4e, - 0xfb4f, 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, 0xfb55, 0xfb56, - 0xfb57, 0xfb58, 0xfb59, 0xfb5a, 0xfb5b, 0xfb5c, 0xfb5d, 0xfb5e, - 0xfb5f, 0xfb60, 0xfb61, 0xfb62, 0xfb63, 0xfb64, 0xfb65, 0xfb66, - 0xfb67, 0xfb68, 0xfb69, 0xfb6a, 0xfb6b, 0xfb6c, 0xfb6d, 0xfb6e, - 0xfb6f, 0xfb70, 0xfb71, 0xfb72, 0xfb73, 0xfb74, 0xfb75, 0xfb76, - 0xfb77, 0xfb78, 0xfb79, 0xfb7a, 0xfb7b, 0xfb7c, 0xfb7d, 0xfb7e, - 0xfba1, 0xfba2, 0xfba3, 0xfba4, 0xfba5, 0xfba6, 0xfba7, 0xfba8, - 0xfba9, 0xfbaa, 0xfbab, 0xfbac, 0xfbad, 0xfbae, 0xfbaf, 0xfbb0, - 0xfbb1, 0xfbb2, 0xfbb3, 0xfbb4, 0xfbb5, 0xfbb6, 0xfbb7, 0xb440, - 0xfbb9, 0xfbba, 0xfbbb, 0xfbbc, 0xfbbd, 0xfbbe, 0xfbbf, 0xfbc0, - 0xfbc1, 0xfbc2, 0xfbc3, 0xfbc4, 0xfbc5, 0xfbc6, 0xfbc7, 0xfbc8, - 0xfbc9, 0xfbca, 0xfbcb, 0xfbcc, 0xfbcd, 0xfbce, 0xfbcf, 0xfbd0, - 0xfbd1, 0xfbd2, 0xfbd3, 0xfbd4, 0xfbd5, 0xfbd6, 0xfbd7, 0xfbd8, - 0xfbd9, 0xfbda, 0xfbdb, 0xfbdc, 0xfbdd, 0xfbde, 0xfbdf, 0xfbe0, - 0xfbe1, 0xfbe2, 0xfbe3, 0xfbe4, 0xfbe5, 0xfbe6, 0xfbe7, 0xfbe8, - 0xfbe9, 0xfbea, 0xfbeb, 0xfbec, 0xfbed, 0xfbee, 0xfbef, 0xfbf0, - 0xfbf1, 0xfbf2, 0xc9db, 0xfbf4, 0xfbf5, 0xfbf6, 0xfbf7, 0xfbf8, - 0x9dfb, 0xfbfa, 0xfbfb, 0xfbfc, 0xfbfd, 0xfbfe, 0xfc40, 0xfc41, - 0xfc42, 0xfc43, 0xfc44, 0xfc45, 0xfc46, 0xfc47, 0xfc48, 0xfc49, - 0xfc4a, 0xfc4b, 0xfc4c, 0xfc4d, 0xfc4e, 0xd8f4, 0xfc50, 0xfc51, - 0xfc52, 0xfc53, 0xfc54, 0xfc55, 0xfc56, 0xfc57, 0xfc58, 0xfc59, - 0xfc5a, 0xfc5b, 0xfc5c, 0xfc5d, 0xfc5e, 0xfc5f, 0xfc60, 0xfc61, - 0xfc62, 0xfc63, 0xfc64, 0xfc65, 0xfc66, 0xfc67, 0xfc68, 0xfc69, - 0xfc6a, 0xfc6b, 0xa0dc, 0xfc6d, 0xfc6e, 0xfc6f, 0xfc70, 0xfc71, - 0xfc72, 0xfc73, 0xfc74, 0xfc75, 0xfc76, 0xfc77, 0xfc78, 0xfc79, - 0xfc7a, 0xfc7b, 0xfc7c, 0xfc7d, 0xfc7e, 0xfca1, 0xfca2, 0xfca3, - 0xfca4, 0xfca5, 0xfca6, 0xfca7, 0xfca8, 0xfca9, 0xfcaa, 0xfcab, - 0xfcac, 0xfcad, 0xfcae, 0xfcaf, 0xfcb0, 0xfcb1, 0xfcb2, 0xfcb3, - 0xfcb4, 0xfcb5, 0xfcb6, 0xfcb7, 0xfcb8, 0xbcb5, 0xfcba, 0xfcbb, - 0xfcbc, 0xfcbd, 0xfcbe, 0xfcbf, 0xfcc0, 0xfcc1, 0xfcc2, 0xfcc3, - 0xfcc4, 0xfcc5, 0xfcc6, 0xfcc7, 0xfcc8, 0xfcc9, 0xfcca, 0xfccb, - 0xfccc, 0xfccd, 0xfcce, 0xfccf, 0xfcd0, 0xfcd1, 0xfcd2, 0xfcd3, - 0xfcd4, 0xfcd5, 0xfcd6, 0xfcd7, 0xfcd8, 0xfcd9, 0xfcda, 0xfcdb, - 0xfcdc, 0xfcdd, 0xfcde, 0xfcdf, 0xfce0, 0xfce1, 0xb4b8, 0xfce3, - 0xfce4, 0xfce5, 0xfce6, 0xfce7, 0xfce8, 0xfce9, 0xfcea, 0xfceb, - 0xfcec, 0xfced, 0xfcee, 0xfcef, 0xfcf0, 0xa7fb, 0xfcf2, 0xfcf3, - 0xfcf4, 0xfcf5, 0xfcf6, 0xfcf7, 0xfcf8, 0xfcf9, 0xfcfa, 0xfcfb, - 0xfcfc, 0xfcfd, 0xfcfe, 0xfd40, 0xfd41, 0xfd42, 0xfd43, 0xfd44, - 0xfd45, 0xfd46, 0xfd47, 0xfd48, 0xfd49, 0xfd4a, 0xfd4b, 0xfd4c, - 0xfd4d, 0xfd4e, 0xfd4f, 0xfd50, 0xfd51, 0xfd52, 0xfd53, 0xfd54, - 0xfd55, 0xfd56, 0xfd57, 0xfd58, 0xfd59, 0xfd5a, 0xfd5b, 0xfd5c, - 0xfd5d, 0xfd5e, 0xfd5f, 0xfd60, 0xfd61, 0xfd62, 0xfd63, 0xfd64, - 0xfd65, 0xfd66, 0xfd67, 0xfd68, 0xfd69, 0xfd6a, 0xfd6b, 0xfd6c, - 0xfd6d, 0xfd6e, 0xfd6f, 0xfd70, 0xfd71, 0xfd72, 0xfd73, 0xfd74, - 0xfd75, 0xfd76, 0xfd77, 0xfd78, 0xfd79, 0xfd7a, 0xfd7b, 0xfd7c, - 0xfd7d, 0xfd7e, 0xfda1, 0xfda2, 0xfda3, 0xfda4, 0xfda5, 0xfda6, - 0xfda7, 0xfda8, 0xfda9, 0xfdaa, 0xfdab, 0xfdac, 0xfdad, 0xfdae, - 0xfdaf, 0xfdb0, 0xfdb1, 0xfdb2, 0xfdb3, 0xfdb4, 0xfdb5, 0xfdb6, - 0xcb58, 0xb4fc, 0xfdb9, 0xfdba, 0xb4e4, 0xfdbc, 0xfdbd, 0xfdbe, - 0xfdbf, 0xfdc0, 0xfdc1, 0xfdc2, 0xfdc3, 0xfdc4, 0xfdc5, 0xfdc6, - 0xfdc7, 0xfdc8, 0xfdc9, 0xfdca, 0xfdcb, 0xfdcc, 0xfdcd, 0xfdce, - 0xfdcf, 0xfdd0, 0xfdd1, 0xfdd2, 0xfdd3, 0xfdd4, 0xfdd5, 0xfdd6, - 0xfdd7, 0xfdd8, 0xfdd9, 0xfdda, 0xfddb, 0xfddc, 0xfddd, 0xfdde, - 0xfddf, 0xfde0, 0xfde1, 0xfde2, 0xfde3, 0xfde4, 0xfde5, 0xfde6, - 0xfde7, 0xfde8, 0xfde9, 0xfdea, 0xfdeb, 0xfdec, 0xfded, 0xfdee, - 0xfdef, 0xfdf0, 0xb54e, 0xfdf2, 0xfdf3, 0xfdf4, 0xfdf5, 0xfdf6, - 0xfdf7, 0xfdf8, 0xfdf9, 0xfdfa, 0xfdfb, 0xfdfc, 0xfdfd, 0xfdfe, - 0xfe40, 0xfe41, 0xfe42, 0xfe43, 0xfe44, 0xfe45, 0xfe46, 0xfe47, - 0xfe48, 0xfe49, 0xfe4a, 0xfe4b, 0xfe4c, 0xfe4d, 0xfe4e, 0xfe4f, - 0xfe50, 0xfe51, 0x9975, 0xfe53, 0xfe54, 0xfe55, 0xfe56, 0xfe57, - 0xfe58, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xfe5f, - 0xfe60, 0xfe61, 0xfe62, 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xfe67, - 0xfe68, 0xfe69, 0xfe6a, 0xfe6b, 0xfe6c, 0xfe6d, 0xfe6e, 0xb7ec, - 0xfe70, 0xfe71, 0xfe72, 0xfe73, 0xfe74, 0xfe75, 0xfe76, 0xfe77, - 0xfe78, 0xfe79, 0xfe7a, 0xfe7b, 0xfe7c, 0xfe7d, 0xfe7e, 0xfea1, - 0xfea2, 0xfea3, 0xfea4, 0xfea5, 0xfea6, 0xfea7, 0xfea8, 0xfea9, - 0xa260, 0xfeab, 0xfeac, 0xfead, 0xfeae, 0xfeaf, 0xfeb0, 0xfeb1, - 0xfeb2, 0xfeb3, 0xfeb4, 0xfeb5, 0xfeb6, 0xfeb7, 0xfeb8, 0xfeb9, - 0xfeba, 0xfebb, 0xfebc, 0xfebd, 0xfebe, 0xfebf, 0xfec0, 0xfec1, - 0xfec2, 0xfec3, 0xfec4, 0xfec5, 0xfec6, 0xfec7, 0xfec8, 0xfec9, - 0xfeca, 0xfecb, 0xfecc, 0xfecd, 0xfece, 0xfecf, 0xfed0, 0xfed1, - 0xfed2, 0xfed3, 0xfed4, 0xfed5, 0xfed6, 0xfed7, 0xfed8, 0xfed9, - 0xfeda, 0xfedb, 0xfedc, 0xcff1, 0xfede, 0xfedf, 0xfee0, 0xfee1, - 0xfee2, 0xfee3, 0xfee4, 0xfee5, 0xfee6, 0xfee7, 0xfee8, 0xfee9, - 0xfeea, 0xfeeb, 0xfeec, 0xfeed, 0xfeee, 0xfeef, 0xfef0, 0xfef1, - 0xfef2, 0xfef3, 0xfef4, 0xfef5, 0xfef6, 0xfef7, 0xfef8, 0xfef9, - 0xfefa, 0xfefb, 0xfefc, 0xfefd, 0xfefe, 0x8e40, 0x8e41, 0x8e42, - 0x8e43, 0x8e44, 0x8e45, 0x8e46, 0x8e47, 0x8e48, 0x8e49, 0x8e4a, - 0x8e4b, 0x8e4c, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e50, 0x8e51, 0x8e52, - 0x8e53, 0x8e54, 0x8e55, 0x8e56, 0x8e57, 0x8e58, 0x8e59, 0x8e5a, - 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, - 0x8e63, 0x8e64, 0x8e65, 0x8e66, 0x8e67, 0x8e68, 0xbae6, 0x8e6a, - 0x8e6b, 0x8e6c, 0x8e6d, 0x8e6e, 0xedca, 0x8e70, 0x8e71, 0x8e72, - 0x8e73, 0x8e74, 0x8e75, 0x8e76, 0x8e77, 0x8e78, 0x8e79, 0x8e7a, - 0x8e7b, 0x8e7c, 0x8e7d, 0xa261, 0x8ea1, 0x8ea2, 0x8ea3, 0x8ea4, - 0x8ea5, 0x8ea6, 0x8ea7, 0x8ea8, 0x8ea9, 0x8eaa, 0xbafc, 0x8eac, - 0x8ead, 0x8eae, 0x8eaf, 0x8eb0, 0x8eb1, 0x8eb2, 0x8eb3, 0xbfa6, - 0x8eb5, 0x8eb6, 0x8eb7, 0x8eb8, 0x8eb9, 0x8eba, 0x8ebb, 0x8ebc, - 0x8ebd, 0x8ebe, 0x8ebf, 0x8ec0, 0x8ec1, 0x8ec2, 0x8ec3, 0x8ec4, - 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, 0x8eca, 0x8ecb, 0x8ecc, - 0xaacc, 0x8ece, 0x8ecf, 0xbfae, 0x8ed1, 0x8ed2, 0x8ed3, 0x8ed4, - 0x8ed5, 0x8ed6, 0x8ed7, 0x8ed8, 0x8ed9, 0x8eda, 0x8edb, 0x8edc, - 0x8edd, 0x8ede, 0x8edf, 0x8ee0, 0x8ee1, 0x8ee2, 0x8ee3, 0x8ee4, - 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, - 0x8eed, 0x8eee, 0x8eef, 0x8ef0, 0x8ef1, 0x8ef2, 0x8ef3, 0x8ef4, - 0x8ef5, 0x8ef6, 0x8ef7, 0x8ef8, 0x8ef9, 0x8efa, 0x8efb, 0x8efc, - 0x8efd, 0x8efe, 0x8f40, 0x8f41, 0x8f42, 0x8f43, 0x8f44, 0x8f45, - 0x8f46, 0x8f47, 0x8f48, 0x8f49, 0x8f4a, 0x8f4b, 0x8f4c, 0x8f4d, - 0x8f4e, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, - 0x8f56, 0xb5d7, 0x8f58, 0x8f59, 0x8f5a, 0x8f5b, 0x8f5c, 0x8f5d, - 0x8f5e, 0x8f5f, 0x8f60, 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0x8f65, - 0x8f66, 0x8f67, 0x8f68, 0xe3c8, 0x8f6a, 0x8f6b, 0x8f6c, 0x8f6d, - 0xdb79, 0x8f6f, 0x8f70, 0x8f71, 0x8f72, 0x8f73, 0x8f74, 0x8f75, - 0x8f76, 0x8f77, 0x8f78, 0x8f79, 0x8f7a, 0x8f7b, 0x8f7c, 0x8f7d, - 0x8f7e, 0x8fa1, 0x8fa2, 0x8fa3, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fa7, - 0x8fa8, 0x8fa9, 0x8faa, 0x8fab, 0x8fac, 0x8fad, 0x8fae, 0x8faf, - 0x8fb0, 0x8fb1, 0x8fb2, 0x8fb3, 0x8fb4, 0x8fb5, 0x8fb6, 0x8fb7, - 0x8fb8, 0x8fb9, 0x8fba, 0x8fbb, 0x8fbc, 0x8fbd, 0x8fbe, 0x8fbf, - 0x8fc0, 0x8fc1, 0x8fc2, 0x8fc3, 0x8fc4, 0x8fc5, 0x8fc6, 0x8fc7, - 0x8fc8, 0x8fc9, 0x8fca, 0xbfcc, 0xa0d4, 0x8fcd, 0x8fce, 0x8fcf, - 0x8fd0, 0x8fd1, 0x8fd2, 0x8fd3, 0x8fd4, 0x8fd5, 0x8fd6, 0x8fd7, - 0x8fd8, 0x8fd9, 0x8fda, 0x8fdb, 0x8fdc, 0x8fdd, 0x8fde, 0x8fdf, - 0x8fe0, 0x8fe1, 0x8fe2, 0x8fe3, 0x8fe4, 0x8fe5, 0x8fe6, 0x8fe7, - 0x8fe8, 0x8fe9, 0x8fea, 0x8feb, 0x8fec, 0x8fed, 0x8fee, 0x8fef, - 0x8ff0, 0x8ff1, 0x8ff2, 0x8ff3, 0x8ff4, 0x8ff5, 0x8ff6, 0x8ff7, - 0x8ff8, 0x8ff9, 0x8ffa, 0x8ffb, 0x8ffc, 0x8ffd, 0xb05f, 0x9040, - 0x9041, 0x9042, 0x9043, 0x9044, 0x9045, 0x9046, 0x9047, 0x9048, - 0x9049, 0x904a, 0x904b, 0x904c, 0x904d, 0x904e, 0x904f, 0x9050, - 0x9051, 0x9052, 0x9053, 0x9054, 0x9055, 0x9056, 0x9057, 0x9058, - 0x9059, 0x905a, 0x905b, 0x905c, 0x905d, 0x905e, 0x905f, 0x9060, - 0x9061, 0x9062, 0x9063, 0x9064, 0x9065, 0x9066, 0x9067, 0x9068, - 0x9069, 0x906a, 0x906b, 0x906c, 0xb3a3, 0x906e, 0x906f, 0x9070, - 0x9071, 0x9072, 0x9073, 0x9074, 0x9075, 0x9076, 0x9077, 0x9078, - 0x9079, 0xf9d7, 0x907b, 0x907c, 0x907d, 0x907e, 0x90a1, 0x90a2, - 0x90a3, 0x90a4, 0x90a5, 0x90a6, 0x90a7, 0x90a8, 0x90a9, 0x90aa, - 0x90ab, 0x90ac, 0x90ad, 0x90ae, 0x90af, 0x90b0, 0x90b1, 0x90b2, - 0x90b3, 0x90b4, 0x90b5, 0x90b6, 0x90b7, 0x90b8, 0x90b9, 0x90ba, - 0x90bb, 0x90bc, 0x90bd, 0x90be, 0x90bf, 0x90c0, 0x90c1, 0x90c2, - 0x90c3, 0x90c4, 0x90c5, 0x90c6, 0x90c7, 0x90c8, 0x90c9, 0x90ca, - 0x90cb, 0x90cc, 0x90cd, 0x90ce, 0x90cf, 0x90d0, 0x90d1, 0x90d2, - 0x90d3, 0x90d4, 0x90d5, 0x90d6, 0x90d7, 0x90d8, 0x90d9, 0x90da, - 0x90db, 0xc052, 0x90dd, 0x90de, 0x90df, 0x90e0, 0x90e1, 0x90e2, - 0x90e3, 0x90e4, 0x90e5, 0x90e6, 0x90e7, 0x90e8, 0x90e9, 0x90ea, - 0x90eb, 0x90ec, 0x90ed, 0x90ee, 0x90ef, 0x90f0, 0xc554, 0x90f2, - 0x90f3, 0x90f4, 0x90f5, 0x90f6, 0x90f7, 0x90f8, 0x90f9, 0x90fa, - 0x90fb, 0x90fc, 0x90fd, 0x90fe, 0x9140, 0x9141, 0x9142, 0x9143, - 0x9144, 0x9145, 0x9146, 0x9147, 0x9148, 0x9149, 0x914a, 0x914b, - 0x914c, 0x914d, 0x914e, 0x914f, 0x9150, 0x9151, 0x9152, 0x9153, - 0x9154, 0x9155, 0x9156, 0x9157, 0x9158, 0x9159, 0x915a, 0x915b, - 0x915c, 0x915d, 0x915e, 0x915f, 0x9160, 0x9161, 0x9162, 0x9163, - 0x9164, 0x9165, 0x9166, 0x9167, 0x9168, 0x9169, 0x916a, 0x916b, - 0x916c, 0x916d, 0x916e, 0x916f, 0x9170, 0x9171, 0x9172, 0x9173, - 0x9174, 0x9175, 0x9176, 0x9177, 0x9178, 0x9179, 0x917a, 0x917b, - 0x917c, 0x917d, 0x917e, 0x91a1, 0x91a2, 0x91a3, 0x91a4, 0x91a5, - 0x91a6, 0x91a7, 0x91a8, 0x91a9, 0x91aa, 0x91ab, 0x91ac, 0x91ad, - 0x91ae, 0x91af, 0x91b0, 0x91b1, 0x91b2, 0x91b3, 0x91b4, 0x91b5, - 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91ba, 0x91bb, 0x91bc, 0x91bd, - 0x91be, 0xf1e3, 0x91c0, 0x91c1, 0x91c2, 0x91c3, 0x91c4, 0x91c5, - 0x91c6, 0x91c7, 0x91c8, 0x91c9, 0x91ca, 0x91cb, 0x91cc, 0x91cd, - 0x91ce, 0x91cf, 0x91d0, 0x91d1, 0x91d2, 0x91d3, 0x91d4, 0x91d5, - 0x91d6, 0x91d7, 0x91d8, 0x91d9, 0x91da, 0x91db, 0x91dc, 0x91dd, - 0x91de, 0x91df, 0x91e0, 0x91e1, 0x91e2, 0x91e3, 0x91e4, 0x91e5, - 0x91e6, 0x91e7, 0x91e8, 0x91e9, 0x91ea, 0x91eb, 0x91ec, 0x91ed, - 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f2, 0x91f3, 0x91f4, 0x91f5, - 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0x91fa, 0x91fb, 0x91fc, 0x91fd, - 0x91fe, 0x9240, 0x9241, 0x9242, 0x9243, 0x9242, 0x9245, 0x9246, - 0x9247, 0x9248, 0x9249, 0x924a, 0x924b, 0x924c, 0x924d, 0x924e, - 0x924f, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, 0x9256, - 0x9257, 0x9258, 0x9259, 0x925a, 0x925b, 0x925c, 0x925d, 0x925e, - 0x925f, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, 0x9266, - 0x9267, 0x9268, 0x9269, 0x926a, 0x926b, 0x926c, 0x926d, 0x926e, - 0x926f, 0x9270, 0x9271, 0x9272, 0x9273, 0x9274, 0x9275, 0x9276, - 0x9277, 0x9278, 0x9279, 0x927a, 0x927b, 0x927c, 0x927d, 0x927e, - 0x92a1, 0x92a2, 0x92a3, 0x92a4, 0x92a5, 0x92a6, 0x92a7, 0x92a8, - 0x92a9, 0x92aa, 0x92ab, 0x92ac, 0x92ad, 0x92ae, 0xa259, 0xa25a, - 0xa25c, 0xa25b, 0x92b3, 0x92b4, 0x92b5, 0x92b6, 0x92b7, 0x92b8, - 0x92b9, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92be, 0x92bf, 0x92c0, - 0x92c1, 0x92c2, 0x92c3, 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0xa05f, - 0x92c9, 0x92ca, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92cf, 0x92d0, - 0xe6ab, 0x92d2, 0x92d3, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0x92d8, - 0x92d9, 0x92da, 0x92db, 0x92dc, 0x92dd, 0x92de, 0x92df, 0x92e0, - 0x92e1, 0x92e2, 0x92e3, 0x92e4, 0x92e5, 0x92e6, 0x92e7, 0x92e8, - 0x92e9, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, - 0x92f1, 0x92f2, 0x92f3, 0x92f4, 0x92f5, 0x92f6, 0x92f7, 0x92f8, - 0x92f9, 0x92fa, 0x92fb, 0x92fc, 0x92fd, 0x92fe, 0x9340, 0x9341, - 0x9342, 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, - 0x934a, 0x934b, 0x934c, 0x934d, 0x934e, 0x934f, 0x9350, 0x9351, - 0x9352, 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, - 0x935a, 0x935b, 0x935c, 0x935d, 0x935e, 0x935f, 0x9360, 0x9361, - 0x9362, 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, - 0x936a, 0x936b, 0x936c, 0x936d, 0x936e, 0x936f, 0x9370, 0x9371, - 0x9372, 0x9373, 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, - 0x937a, 0x937b, 0x937c, 0x937d, 0x937e, 0x93a1, 0x93a2, 0x93a3, - 0x93a4, 0x93a5, 0x93a6, 0x93a7, 0x93a8, 0x93a9, 0x93aa, 0x93ab, - 0x93ac, 0x93ad, 0x93ae, 0x93af, 0x93b0, 0x93b1, 0x93b2, 0x93b3, - 0x93b4, 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, - 0x93bc, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, 0x93c2, 0x93c3, - 0x93c4, 0x93c5, 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93ca, 0x93cb, - 0x93cc, 0x93cd, 0x93ce, 0x93cf, 0x93d0, 0x93d1, 0x93d2, 0x93d3, - 0x93d4, 0x93d5, 0x93d6, 0x93d7, 0x93d8, 0x93d9, 0x93da, 0x93db, - 0x93dc, 0x93dd, 0x93de, 0x93df, 0x93e0, 0x93e1, 0x93e2, 0x93e3, - 0x93e4, 0x93e5, 0x93e6, 0x93e7, 0x93e8, 0x93e9, 0x93ea, 0x93eb, - 0x93ec, 0x93ed, 0x93ee, 0x93ef, 0x93f0, 0x93f1, 0x93f2, 0x93f3, - 0x93f4, 0x93f5, 0x93f6, 0x93f7, 0x93f8, 0x93f9, 0x93fa, 0x93fb, - 0x93fc, 0x93fd, 0x93fe, 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, - 0x9445, 0x9446, 0xd256, 0x9448, 0x9449, 0x944a, 0x944b, 0x944c, - 0x944d, 0x944e, 0x944f, 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, - 0x9455, 0x9456, 0x9457, 0x9458, 0x9459, 0x945a, 0x945b, 0x945c, - 0x945d, 0x945e, 0x945f, 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, - 0x9465, 0x9466, 0x9467, 0x9468, 0x9469, 0x946a, 0x946b, 0x946c, - 0x946d, 0x946e, 0x946f, 0x9470, 0x9471, 0x9472, 0x9473, 0x9474, - 0x9475, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, - 0x947d, 0x947e, 0x94a1, 0x94a2, 0x94a3, 0x94a4, 0x94a5, 0x94a6, - 0x94a7, 0x94a8, 0x94a9, 0x94aa, 0x94ab, 0x94ac, 0x94ad, 0x94ae, - 0x94af, 0x94b0, 0x94b1, 0x94b2, 0x94b3, 0x94b4, 0x94b5, 0x94b6, - 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bb, 0x94bc, 0x94bd, 0x94be, - 0x94bf, 0x94c0, 0x94c1, 0x94c2, 0x94c3, 0x94c4, 0x94c5, 0x94c6, - 0x94c7, 0x94c8, 0x94c9, 0xe6d0, 0x94cb, 0x94cc, 0x94cd, 0x94ce, - 0x94cf, 0x94d0, 0x94d1, 0x94d2, 0x94d3, 0x94d4, 0x94d5, 0x94d6, - 0x94d7, 0x94d8, 0x94d9, 0x94da, 0x94db, 0x94dc, 0x94dd, 0x94de, - 0x94df, 0x94e0, 0x94e1, 0x94e2, 0x94e3, 0x94e4, 0x94e5, 0x94e6, - 0x94e7, 0x94e8, 0x94e9, 0x94ea, 0x94eb, 0x94ec, 0x94ed, 0x94ee, - 0x94ef, 0x94f0, 0x94f1, 0x94f2, 0x94f3, 0x94f4, 0x94f5, 0x94f6, - 0x94f7, 0x94f8, 0x94f9, 0x94fa, 0x94fb, 0x94fc, 0x94fd, 0x94fe, - 0x9540, 0x9541, 0x9542, 0x9543, 0x9544, 0x9545, 0x9546, 0x9547, - 0x9548, 0x9549, 0x954a, 0x954b, 0x954c, 0x954d, 0x954e, 0x954f, - 0x9550, 0x9551, 0x9552, 0x9553, 0x9554, 0x9555, 0x9556, 0x9557, - 0x9558, 0x9559, 0x955a, 0x955b, 0x955c, 0x955d, 0x955e, 0x955f, - 0x9560, 0x9561, 0x9562, 0x9563, 0x9564, 0x9565, 0x9566, 0x9567, - 0x9568, 0x9569, 0x956a, 0x956b, 0x956c, 0x956d, 0x956e, 0x956f, - 0x9570, 0x9571, 0x9572, 0x9573, 0x9574, 0x9575, 0x9576, 0x9577, - 0x9578, 0x9579, 0x957a, 0x957b, 0x957c, 0x957d, 0x957e, 0x95a1, - 0x95a2, 0x95a3, 0x95a4, 0x95a5, 0x95a6, 0x95a7, 0x95a8, 0x95a9, - 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0x95af, 0x95b0, 0x95b1, - 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0x95b8, 0x95b9, - 0x95ba, 0x95bb, 0x95bc, 0x95bd, 0x95be, 0x95bf, 0x95c0, 0x95c1, - 0x95c2, 0x95c3, 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c8, 0x95c9, - 0x95ca, 0x95cb, 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, - 0x95d2, 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0xca52, - 0x95da, 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, - 0x95e2, 0x95e3, 0x95e4, 0x95e5, 0x95e6, 0x95e7, 0x95e8, 0x95e9, - 0x95ea, 0x95eb, 0x95ec, 0x95ed, 0x95ee, 0x95ef, 0x95f0, 0x95f1, - 0x95f2, 0x95f3, 0x95f4, 0x95f5, 0x95f6, 0x95f7, 0x95f8, 0x95f9, - 0x95fa, 0x95fb, 0x95fc, 0x95fd, 0x95fe, 0x9640, 0x9641, 0x9642, - 0x9643, 0x9ce4, 0x9645, 0x9646, 0x9647, 0x9648, 0x9649, 0x964a, - 0x964b, 0x964c, 0x964d, 0x964e, 0x964f, 0x9650, 0x9651, 0x9652, - 0x9653, 0x9654, 0x9655, 0x9656, 0x9657, 0x9658, 0x9659, 0x965a, - 0x965b, 0x965c, 0x965d, 0x965e, 0x965f, 0x9660, 0x9661, 0x9662, - 0x9663, 0x9664, 0x9665, 0x9666, 0x9667, 0x9668, 0x9669, 0x966a, - 0x966b, 0x966c, 0x966d, 0x966e, 0x966f, 0x9670, 0x9671, 0x9672, - 0x9673, 0x9674, 0x9675, 0x9676, 0x9677, 0x9678, 0x9679, 0x967a, - 0x967b, 0x967c, 0x967d, 0x967e, 0x96a1, 0x96a2, 0x96a3, 0x96a4, - 0x96a5, 0x96a6, 0x96a7, 0x96a8, 0x96a9, 0x96aa, 0x96ab, 0x96ac, - 0x96ad, 0x96ae, 0x96af, 0x96b0, 0x96b1, 0x96b2, 0x96b3, 0x96b4, - 0x96b5, 0x96b6, 0x96b7, 0x96b8, 0x96b9, 0x96ba, 0x96bb, 0x96bc, - 0x96bd, 0x96be, 0x96bf, 0x96c0, 0x96c1, 0x96c2, 0x96c3, 0x96c4, - 0x96c5, 0x96c6, 0x96c7, 0x96c8, 0x96c9, 0x96ca, 0x96cb, 0x96cc, - 0x96cd, 0x96ce, 0x96cf, 0x96d0, 0x96d1, 0x96d2, 0x96d3, 0x96d4, - 0x96d5, 0x96d6, 0x96d7, 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, - 0x96dd, 0x96de, 0x96df, 0x96e0, 0x96e1, 0x96e2, 0x96e3, 0x96e4, - 0x96e5, 0x96e6, 0x96e7, 0x96e8, 0x96e9, 0x96ea, 0x96eb, 0x96ec, - 0x96ee, 0x96ee, 0x96ef, 0x96f0, 0x96f1, 0x96f2, 0x96f3, 0x96f4, - 0x96f5, 0x96f6, 0x96f7, 0x96f8, 0x96f9, 0x96fa, 0x96fb, 0xe959, - 0x96fd, 0x96fe, 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, - 0x9746, 0x9747, 0x9748, 0x9749, 0x974a, 0x974b, 0x974c, 0x974d, - 0x974e, 0x974f, 0x9750, 0x9751, 0x9752, 0x9753, 0x9754, 0x9755, - 0x9756, 0x9757, 0x9758, 0x9759, 0x975a, 0x975b, 0x975c, 0x975d, - 0x975e, 0x975f, 0x9760, 0x9761, 0x9762, 0x9763, 0x9764, 0x9765, - 0x9766, 0x9767, 0x9768, 0x9769, 0x976a, 0x976b, 0x976c, 0x976d, - 0x976e, 0x976f, 0x9770, 0x9771, 0x9772, 0x9773, 0x9774, 0x9775, - 0x9776, 0x9777, 0x9778, 0x9779, 0x977a, 0x977b, 0x977c, 0x977d, - 0x977e, 0x97a1, 0x97a2, 0x97a3, 0x97a4, 0x97a5, 0x97a6, 0x97a7, - 0x97a8, 0x97a9, 0x97aa, 0x97ab, 0x97ac, 0x97ad, 0x97ae, 0x97af, - 0x97b0, 0x97b1, 0x97b2, 0x97b3, 0x97b4, 0x97b5, 0x97b6, 0x97b7, - 0x97b8, 0x97b9, 0x97ba, 0x97bb, 0x97bc, 0x97bd, 0x97be, 0x97bf, - 0x97c0, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, 0x97c6, 0x97c7, - 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0x97cd, 0x97ce, 0x97cf, - 0x97d0, 0x97d1, 0x97d2, 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, - 0x97d8, 0x97d9, 0x97da, 0x97db, 0x97dc, 0x97dd, 0x97de, 0x97df, - 0x97e0, 0x97e1, 0x97e2, 0x97e3, 0x97e4, 0x97e5, 0x97e6, 0x97e7, - 0x97e8, 0x97e9, 0x97ea, 0x97eb, 0x97ec, 0x97ed, 0x97ee, 0x97ef, - 0x97f0, 0x97f1, 0x97f2, 0x97f3, 0x97f4, 0x97f5, 0x97f6, 0x97f7, - 0x97f8, 0x97f9, 0x97fa, 0x97fb, 0x97fc, 0x97fd, 0x97fe, 0x9840, - 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, 0x9847, 0x9848, - 0x9849, 0x984a, 0x984b, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, - 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, 0x9856, 0x9857, 0x9858, - 0x9859, 0x985a, 0x985b, 0x985c, 0x985d, 0x985e, 0x985f, 0x9860, - 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, 0x9866, 0x9867, 0x9868, - 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x986f, 0x9870, - 0x9871, 0x9872, 0x9873, 0x9874, 0x9875, 0x9876, 0x9877, 0x9878, - 0x9879, 0x987a, 0x987b, 0x987c, 0x987d, 0x987e, 0x98a1, 0x98a2, - 0x98a3, 0x98a4, 0x98a5, 0x98a6, 0x98a7, 0x98a8, 0x98a9, 0x98aa, - 0x98ab, 0x98ac, 0x98ad, 0x98ae, 0x98af, 0x98b0, 0x98b1, 0x98b2, - 0x98b3, 0x98b4, 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, - 0x98bb, 0x98bc, 0x98bd, 0x98be, 0x98bf, 0x98c0, 0x98c1, 0x98c2, - 0x98c3, 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, - 0x98cb, 0x98cc, 0x98cd, 0x98ce, 0x98cf, 0x98d0, 0x98d1, 0x98d2, - 0x98d3, 0x98d4, 0x98d5, 0x98d6, 0x98d7, 0x98d8, 0x98d9, 0x98da, - 0x98db, 0x98dc, 0x98dd, 0x98de, 0x98df, 0x98e0, 0x98e1, 0x98e2, - 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e7, 0x98e8, 0x98e9, 0x98ea, - 0x98eb, 0x98ec, 0x98ed, 0x98ee, 0x98ef, 0x98f0, 0x98f1, 0x98f2, - 0x98f3, 0x98f4, 0x98f5, 0x98f6, 0x98f7, 0x98f8, 0x98f9, 0x98fa, - 0x98fb, 0x98fc, 0x98fd, 0x98fe, 0x9940, 0x9941, 0x9942, 0x9943, - 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, 0x994a, 0x994b, - 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, 0x9952, 0x9953, - 0x9954, 0x9955, 0x9956, 0x9957, 0x9958, 0x9959, 0x995a, 0x995b, - 0x995c, 0x995d, 0x995e, 0x995f, 0x9960, 0x9961, 0x9962, 0x9963, - 0x9964, 0x9965, 0x9966, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, - 0x996c, 0x996d, 0x996e, 0x996f, 0x9970, 0x9971, 0x9972, 0x9973, - 0x9974, 0x9975, 0x9976, 0x9977, 0x9978, 0x9979, 0x997a, 0x997b, - 0x997c, 0x997d, 0x997e, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a5, - 0x99a6, 0x99a7, 0x99a8, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, - 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, - 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, - 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, - 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, - 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, - 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, - 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, - 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, - 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, - 0x99f6, 0x99f7, 0x99f8, 0x99f9, 0x99fa, 0x99fb, 0x99fc, 0x99fd, - 0x99fe, 0x9a40, 0x9a41, 0x9a42, 0x9a43, 0x9a44, 0x9a45, 0x9a46, - 0x9a47, 0x9a48, 0x9a49, 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4d, 0x9a4e, - 0x9a4f, 0x9a50, 0x9a51, 0x9a52, 0x9a53, 0x9a54, 0x9a55, 0x9a56, - 0x9a57, 0x9a58, 0x9a59, 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, - 0x9a5f, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, 0x9a66, - 0x9a67, 0x9a68, 0x9a69, 0x9a6a, 0x9a6b, 0x9a6c, 0x9a6d, 0x9a6e, - 0x9a6f, 0x9a70, 0x9a71, 0x9a72, 0x9a73, 0x9a74, 0x9a75, 0x9a76, - 0x9a77, 0x9a78, 0x9a79, 0x9a7a, 0x9a7b, 0x9a7c, 0x9a7d, 0x9a7e, - 0x9aa1, 0x9aa2, 0x9aa3, 0x9aa4, 0x9aa5, 0x9aa6, 0x9aa7, 0x9aa8, - 0x9aa9, 0x9aaa, 0x9aab, 0x9aac, 0x9aad, 0x9aae, 0x9aaf, 0x9ab0, - 0x9ab1, 0x9ab2, 0x9ab3, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab7, 0x9ab8, - 0x9ab9, 0x9aba, 0x9abb, 0x9abc, 0x9abd, 0x9abe, 0x9abf, 0x9ac0, - 0x9ac1, 0x9ac2, 0x9ac3, 0x9ac4, 0x9ac5, 0x9ac6, 0x9ac7, 0x9ac8, - 0x9ac9, 0x9aca, 0x9acb, 0x9acc, 0x9acd, 0x9ace, 0x9acf, 0x9ad0, - 0x9ad1, 0x9ad2, 0x9ad3, 0x9ad4, 0x9ad5, 0x9ad6, 0x9ad7, 0x9ad8, - 0x9ad9, 0x9ada, 0x9adb, 0x9adc, 0x9add, 0x9ade, 0x9adf, 0x9ae0, - 0x9ae1, 0x9ae2, 0x9ae3, 0x9ae4, 0x9ae5, 0x9ae6, 0x9ae7, 0x9ae8, - 0x9ae9, 0x9aea, 0x9aeb, 0x9aec, 0x9aed, 0x9aee, 0x9aef, 0x9af0, - 0x9af1, 0x9af2, 0x9af3, 0x9af4, 0x9af5, 0x9af6, 0x9af7, 0x9af8, - 0x9af9, 0x9afa, 0x9afb, 0x9afc, 0x9afd, 0x9afe, 0x9b40, 0x9b41, - 0x9b42, 0x9b43, 0x9b44, 0x9b45, 0x9b46, 0x9b47, 0x9b48, 0x9b49, - 0x9b4a, 0x9b4b, 0x9b4c, 0x9b4d, 0x9b4e, 0x9b4f, 0x9b50, 0x9b51, - 0x9b52, 0x9b53, 0x9b54, 0x9b55, 0x9b56, 0x9b57, 0x9b58, 0x9b59, - 0x9b5a, 0x9b5b, 0x9b5c, 0x9b5d, 0x9b5e, 0x9b5f, 0x9b60, 0x9b61, - 0x9b62, 0x9b63, 0x9b64, 0x9b65, 0x9b66, 0x9b67, 0x9b68, 0x9b69, - 0x9b6a, 0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, 0x9b70, 0x9b71, - 0x9b72, 0x9b73, 0x9b74, 0x9b75, 0xeff9, 0x9b77, 0xc5f7, 0x9b79, - 0x9b7a, 0xf5e8, 0x9b7c, 0x9b7d, 0x9b7e, 0x9ba1, 0x9ba2, 0x9ba3, - 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0x9ba8, 0x9ba9, 0x9baa, 0x9bab, - 0x9bac, 0x9bad, 0x9bae, 0x9baf, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb3, - 0x9bb4, 0x9bb5, 0x9bb6, 0x9bb7, 0x9bb8, 0x9bb9, 0x9bba, 0x9bbb, - 0x9bbc, 0x9bbd, 0x9bbe, 0x9bbf, 0x9bc0, 0x9bc1, 0x9bc2, 0x9bc3, - 0x9bc4, 0x9bc5, 0xe8cd, 0x9bc7, 0x9bc8, 0x9bc9, 0x9bca, 0x9bcb, - 0x9bcc, 0x9bcd, 0x9bce, 0x9bcf, 0x9bd0, 0x9bd1, 0x9bd2, 0x9bd3, - 0x9bd4, 0x9bd5, 0x9bd6, 0x9bd7, 0x9bd8, 0x9bd9, 0x9bda, 0x9bdb, - 0x9bdc, 0x9bdd, 0xd0c0, 0x9bdf, 0x9be0, 0x9be1, 0x9be2, 0x9be3, - 0x9be4, 0x9be5, 0x9be6, 0x9be7, 0x9be8, 0x9be9, 0x9bea, 0x9beb, - 0xfd64, 0x9bed, 0x9bee, 0x9bef, 0x9bf0, 0x9bf1, 0x9bf2, 0x9bf3, - 0x9bf4, 0x9bf5, 0xbf47, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfb, - 0x9bfc, 0x9bfd, 0x9bfe, 0x9c40, 0x9c41, 0xebc9, 0x9c43, 0x9c44, - 0x9c45, 0x9c46, 0x9c47, 0x9c48, 0x9c49, 0x9c4a, 0x9c4b, 0x9c4c, - 0x9c4d, 0x9c4e, 0x9c4f, 0x9c50, 0x9c51, 0x9c52, 0xcde7, 0x9c54, - 0x9c55, 0x9c56, 0x9c57, 0x9c58, 0x9c59, 0x9c5a, 0x9c5b, 0x9c5c, - 0x9c5d, 0x9c5e, 0x9c5f, 0x9c60, 0x9c61, 0xc0e7, 0x9c63, 0x9c64, - 0x9c65, 0x9c66, 0x9c67, 0xdc52, 0x9c69, 0x9c6a, 0xf86d, 0x9c6c, - 0x9c6d, 0x9c6e, 0x9c6f, 0x9c70, 0x9c71, 0x9c72, 0x9c73, 0x9c74, - 0x9c75, 0x9c76, 0xdb5d, 0x9c78, 0x9c79, 0x9c7a, 0x9c7b, 0x9c7c, - 0x9c7d, 0x9c7e, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca4, 0x9ca5, 0x9ca6, - 0x9ca7, 0x9ca8, 0x9ca9, 0x9caa, 0x9cab, 0x9cac, 0x9cad, 0x9cae, - 0x9caf, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, 0x9cb4, 0x9cb5, 0x9cb6, - 0x9cb7, 0x9cb8, 0x9cb9, 0x9cba, 0x9cbb, 0xc95c, 0xafb0, 0x9cbe, - 0x9cbf, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc3, 0x9cc4, 0x9cc5, 0x9cc6, - 0x9cc7, 0x9cc8, 0x9cc9, 0x9cca, 0x9ccb, 0x9ccc, 0x9ccd, 0x9cce, - 0x9ccf, 0xd4d1, 0x9cd1, 0x9cd2, 0x9cd3, 0x9cd4, 0x9cd5, 0x9cd6, - 0x9cd7, 0x9cd8, 0x9cd9, 0x9cda, 0x9cdb, 0x9cdc, 0x9cdd, 0x9cde, - 0x9cdf, 0x9ce0, 0x9ce1, 0x9ce2, 0x9ce3, 0x9ce4, 0x9ce5, 0x9ce6, - 0x9ce7, 0x9ce8, 0x9ce9, 0x9cea, 0x9ceb, 0x9cec, 0x9ced, 0x9cee, - 0x9cef, 0x9cf0, 0x9cf1, 0x9cf2, 0x9cf3, 0x9cf4, 0x9cf5, 0x9cf6, - 0x9cf7, 0x9cf8, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, - 0x9d40, 0x9d41, 0x9d42, 0x9d43, 0x9d44, 0x9d45, 0x9d46, 0x9d47, - 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, 0x9d4e, 0x9d4f, - 0x9d50, 0x9d51, 0x9d52, 0x9d53, 0x9d54, 0x9d55, 0x9d56, 0xe07c, - 0x9d58, 0x9d59, 0xb5ae, 0x9d5b, 0x9d5c, 0x9d5d, 0x9d5e, 0x9d5f, - 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, 0x9d67, - 0x9d68, 0x9d69, 0x9d6a, 0x9d6b, 0x9d6c, 0x9d6d, 0x9d6e, 0x9d6f, - 0x9d70, 0x9d71, 0x9d72, 0x9d73, 0x9d74, 0x9d75, 0x9d76, 0x9d77, - 0x9d78, 0x9d79, 0x9d7a, 0x9d7b, 0x9d7c, 0x9d7d, 0x9d7e, 0x9da1, - 0x9da2, 0x9da3, 0x9da4, 0x9da5, 0x9da6, 0x9da7, 0x9da8, 0x9da9, - 0x9daa, 0x9dab, 0x9dac, 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0x9db1, - 0x9db2, 0x9db3, 0x9db4, 0x9db5, 0x9db6, 0x9db7, 0x9db8, 0x9db9, - 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, 0x9dbf, 0x9dc0, 0x9dc1, - 0x9dc2, 0x9dc3, 0xa9e4, 0x9dc5, 0x9dc6, 0x9dc7, 0x9dc8, 0x9dc9, - 0x9dca, 0x9dcb, 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, - 0x9dd2, 0x9dd3, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dd8, 0x9dd9, - 0x9dda, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, 0x9de1, - 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, 0x9de7, 0x9de8, 0x9de9, - 0x9dea, 0x9deb, 0x9dec, 0x9ded, 0x9dee, 0x9def, 0x9df0, 0x9df1, - 0x9df2, 0x9df3, 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, - 0x9dfa, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9e40, 0x9e41, 0x9e42, - 0x9e43, 0x9e44, 0x9e45, 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4a, - 0x9e4b, 0x9e4c, 0x9e4d, 0x9e4e, 0x9e4f, 0x9e50, 0x9e51, 0x9e52, - 0x9e53, 0x9e54, 0x9e55, 0x9e56, 0x9e57, 0x9e58, 0x9e59, 0x9e5a, - 0x9e5b, 0x9e5c, 0x9e5d, 0x9e5e, 0x9e5f, 0x9e60, 0x9e61, 0x9e62, - 0x9e63, 0x9e64, 0x9e65, 0x9e66, 0x9e67, 0x9e68, 0x9e69, 0x9e6a, - 0x9e6b, 0x9e6c, 0x9e6d, 0x9e6e, 0x9e6f, 0x9e70, 0x9e71, 0x9e72, - 0x9e73, 0x9e74, 0x9e75, 0x9e76, 0x9e77, 0x9e78, 0x9e79, 0x9e7a, - 0x9e7b, 0x9e7c, 0x9e7d, 0x9e7e, 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, - 0x9ea5, 0x9ea6, 0x9ea7, 0x9ea8, 0xabec, 0x9eaa, 0x9eab, 0x9eac, - 0x9ead, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb4, - 0x9eb5, 0x9eb6, 0x9eb7, 0x9eb8, 0x9eb9, 0x9eba, 0x9ebb, 0x9ebc, - 0x9ebd, 0x9ebe, 0x9ebf, 0x9ec0, 0x9ec1, 0x9ec2, 0x9ec3, 0x9ec4, - 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0x9ec9, 0x9eca, 0x9ecb, 0x9ecc, - 0x9ecd, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed1, 0x9ed2, 0x9ed3, 0x9ed4, - 0x9ed5, 0x9ed6, 0x9ed7, 0x9ed8, 0x9ed9, 0x9eda, 0x9edb, 0x9edc, - 0x9edd, 0x9ede, 0x9edf, 0x9ee0, 0x9ee1, 0x9ee2, 0x9ee3, 0x9ee4, - 0x9ee5, 0x9ee6, 0x9ee7, 0x9ee8, 0x9ee9, 0x9eea, 0x9eeb, 0x9eec, - 0x9eed, 0x9eee, 0xdecd, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, - 0x9ef5, 0x9ef6, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa, 0x9efb, 0x9efc, - 0xc9fc, 0x9efe, 0x9f40, 0x9f41, 0x9f42, 0x9f43, 0x9f44, 0x9f45, - 0x9f46, 0x9f47, 0x9f48, 0x9f49, 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, - 0x9f4e, 0x9f4f, 0x9f50, 0x9f51, 0x9f52, 0x9f53, 0x9f54, 0x9f55, - 0x9f56, 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, - 0x9f5e, 0x9f5f, 0xf9c4, 0x9f61, 0x9f62, 0x9f63, 0x9f64, 0x9f65, - 0x91be, 0x9f67, 0x9f68, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, - 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0x9f74, 0x9f75, - 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0x9f7c, 0x9f7d, - 0x9f7e, 0x9fa1, 0x9fa2, 0x9fa3, 0x9fa4, 0x9fa5, 0x9fa6, 0x9fa7, - 0x9fa8, 0x9fa9, 0x9faa, 0x9fab, 0x9fac, 0x9fad, 0x9fae, 0x9faf, - 0x9fb0, 0x9fb1, 0x9fb2, 0x9fb3, 0x9fb4, 0x9fb5, 0x9fb6, 0x9fb7, - 0x9fb8, 0x9fb9, 0x9fba, 0x9fbb, 0x9fbc, 0x9fbd, 0x9fbe, 0x9fbf, - 0x9fc0, 0x9fc1, 0x9fc2, 0x9fc3, 0x9fc4, 0x9fc5, 0x9fc6, 0x9fc7, - 0x9fc8, 0x9fc9, 0x9fca, 0xb9b0, 0x9fcc, 0x9fcd, 0x9fce, 0x9fcf, - 0x9fd0, 0x9fd1, 0x9fd2, 0x9fd3, 0x9fd4, 0x9fd5, 0x9fd6, 0x9fd7, - 0x9361, 0x9fd9, 0x9fda, 0x9fdb, 0x9fdc, 0x9fdd, 0x9fde, 0x9fdf, - 0x9fe0, 0x9fe1, 0x9fe2, 0x9fe3, 0x9fe4, 0x9fe5, 0x9fe6, 0x9fe7, - 0x9fe8, 0x9fe9, 0x9fea, 0x9feb, 0x9fec, 0x9fed, 0x9fee, 0x9fef, - 0x9ff0, 0x9ff1, 0x9ff2, 0x9ff3, 0x9ff4, 0x9ff5, 0x9ff6, 0x9ff7, - 0x9ff8, 0x9ff9, 0x9ffa, 0x9ffb, 0x9ffc, 0x9ffd, 0x9ffe, 0xa040, - 0xa041, 0xa042, 0xa043, 0xa044, 0xa045, 0xa046, 0xa047, 0xa048, - 0xa049, 0xa04a, 0xa04b, 0xa04c, 0xa04d, 0xa04e, 0xa04f, 0xa050, - 0xa051, 0xa052, 0xa053, 0xa054, 0xa055, 0xa056, 0xa057, 0xa058, - 0xa059, 0xa05a, 0xa05b, 0xa05c, 0xa05d, 0xa05e, 0xa05f, 0xa060, - 0xa061, 0xa062, 0x8fb6, 0xa064, 0xa065, 0xa066, 0xa067, 0xa068, - 0xa069, 0xa06a, 0xa06b, 0xa06c, 0xa06d, 0xa06e, 0xa06f, 0xa070, - 0xa071, 0xa072, 0xa073, 0xa074, 0xa075, 0xa076, 0xa9f0, 0xa078, - 0xa079, 0xa07a, 0xa07b, 0xa07c, 0xa07d, 0xa07e, 0xa0a1, 0xa0a2, - 0xa0a3, 0xa0a4, 0xa0a5, 0xa0a6, 0xa0a7, 0xa0a8, 0xa0a9, 0xa0aa, - 0xa0ab, 0xa0ac, 0xa0ad, 0xa0ae, 0xa0af, 0xa0b0, 0xa0b1, 0xa0b2, - 0xa0b3, 0xa0b4, 0xa0b5, 0xa0b6, 0xa0b7, 0xa0b8, 0xa0b9, 0xa0ba, - 0xa0bb, 0xa0bc, 0xa0bd, 0xa0be, 0xa0bf, 0xa0c0, 0xa0c1, 0xa0c2, - 0xa0c3, 0xa0c4, 0xa0c5, 0xa0c6, 0xa0c7, 0xa0c8, 0xa0c9, 0xa0ca, - 0xa0cb, 0xa0cc, 0xa0cd, 0xa0ce, 0xa0cf, 0xa0d0, 0xa0d1, 0xa0d2, - 0xa0d3, 0xa0d4, 0x947a, 0xa0d6, 0xa0d7, 0xa0d8, 0xa0d9, 0xa0da, - 0xa0db, 0xa0dc, 0xa0dd, 0xa0de, 0xde72, 0xa0e0, 0xa0e1, 0xa0e2, - 0xa0e3, 0x9455, 0xa0e5, 0xa0e6, 0xa0e7, 0xa0e8, 0xa0e9, 0xa0ea, - 0xa0eb, 0xa0ec, 0xa0ed, 0xa0ee, 0xa0ef, 0xa0f0, 0xa0f1, 0xa0f2, - 0xa0f3, 0xa0f4, 0xa0f5, 0xa0f6, 0xa0f7, 0xa0f8, 0xa0f9, 0xa0fa, - 0xa0fb, 0xa0fc, 0xa0fd, 0xa0fe, 0x8140, 0x8141, 0x8142, 0x8143, - 0x8144, 0x8145, 0x8146, 0x8147, 0x8148, 0x8149, 0x814a, 0x814b, - 0x814c, 0x814d, 0x814e, 0x814f, 0x8150, 0x8151, 0x8152, 0x8153, - 0x8154, 0x8155, 0x8156, 0x8157, 0x8158, 0x8159, 0x815a, 0x815b, - 0x815c, 0x815d, 0x815e, 0x815f, 0x8160, 0x8161, 0x8162, 0x8163, - 0x8164, 0x8165, 0x8166, 0x8167, 0x8168, 0x8169, 0x816a, 0x816b, - 0x816c, 0x816d, 0x816e, 0x816f, 0x8170, 0x8171, 0x8172, 0x8173, - 0x8174, 0x8175, 0x8176, 0x8177, 0x8178, 0x8179, 0x817a, 0x817b, - 0x817c, 0x817d, 0x817e, 0x81a1, 0x81a2, 0x81a3, 0x81a4, 0x81a5, - 0x81a6, 0x81a7, 0x81a8, 0x81a9, 0x81aa, 0x81ab, 0x81ac, 0x81ad, - 0x81ae, 0x81af, 0x81b0, 0x81b1, 0x81b2, 0x81b3, 0x81b4, 0x81b5, - 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0x81ba, 0x81bb, 0x81bc, 0x81bd, - 0x81be, 0x81bf, 0x81c0, 0x81c1, 0x81c2, 0x81c3, 0x81c4, 0x81c5, - 0x81c6, 0x81c7, 0x81c8, 0x81c9, 0x81ca, 0x81cb, 0x81cc, 0x81cd, - 0x81ce, 0x81cf, 0x81d0, 0x81d1, 0x81d2, 0x81d3, 0x81d4, 0x81d5, - 0x81d6, 0x81d7, 0x81d8, 0x81d9, 0x81da, 0x81db, 0x81dc, 0x81dd, - 0x81de, 0x81df, 0x81e0, 0x81e1, 0x81e2, 0x81e3, 0x81e4, 0x81e5, - 0x81e6, 0x81e7, 0x81e8, 0x81e9, 0x81ea, 0x81eb, 0x81ec, 0x81ed, - 0x81ee, 0x81ef, 0x81f0, 0x81f1, 0x81f2, 0x81f3, 0x81f4, 0x81f5, - 0x81f6, 0x81f7, 0x81f8, 0x81f9, 0x81fa, 0x81fb, 0x81fc, 0x81fd, - 0x81fe, 0x8240, 0x8241, 0x8242, 0x8243, 0x8244, 0x8245, 0x8246, - 0x8247, 0x8248, 0x8249, 0x824a, 0x824b, 0x824c, 0x824d, 0x824e, - 0x824f, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, - 0x8257, 0x8258, 0x8259, 0x825a, 0x825b, 0x825c, 0x825d, 0x825e, - 0x825f, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, - 0x8267, 0x8268, 0x8269, 0x826a, 0x826b, 0x826c, 0x826d, 0x826e, - 0x826f, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276, - 0x8277, 0x8278, 0x8279, 0x827a, 0x827b, 0x827c, 0x827d, 0x827e, - 0x82a1, 0x82a2, 0x82a3, 0x82a4, 0x82a5, 0x82a6, 0x82a7, 0x82a8, - 0x82a9, 0x82aa, 0x82ab, 0x82ac, 0x82ad, 0x82ae, 0x82af, 0x82b0, - 0x82b1, 0x82b2, 0x82b3, 0x82b4, 0x82b5, 0x82b6, 0x82b7, 0x82b8, - 0x82b9, 0x82ba, 0x82bb, 0x82bc, 0x82bd, 0x82be, 0x82bf, 0x82c0, - 0x82c1, 0x82c2, 0x82c3, 0x82c4, 0x82c5, 0x82c6, 0x82c7, 0x82c8, - 0x82c9, 0x82ca, 0x82cb, 0x82cc, 0x82cd, 0x82ce, 0x82cf, 0x82d0, - 0x82d1, 0x82d2, 0x82d3, 0x82d4, 0x82d5, 0x82d6, 0x82d7, 0x82d8, - 0x82d9, 0x82da, 0x82db, 0x82dc, 0x82dd, 0x82de, 0x82df, 0x82e0, - 0x82e1, 0x82e2, 0x82e3, 0x82e4, 0x82e5, 0x82e6, 0x82e7, 0x82e8, - 0x82e9, 0x82ea, 0x82eb, 0x82ec, 0x82ed, 0x82ee, 0x82ef, 0x82f0, - 0x82f1, 0x82f2, 0x82f3, 0x82f4, 0x82f5, 0x82f6, 0x82f7, 0x82f8, - 0x82f9, 0x82fa, 0x82fb, 0x82fc, 0x82fd, 0x82fe, 0x8340, 0x8341, - 0x8342, 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, - 0x834a, 0x834b, 0x834c, 0x834d, 0x834e, 0x834f, 0x8350, 0x8351, - 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0x8358, 0x8359, - 0x835a, 0x835b, 0x835c, 0x835d, 0x835e, 0x835f, 0x8360, 0x8361, - 0x8362, 0x8363, 0x8364, 0x8365, 0x8366, 0x8367, 0x8368, 0x8369, - 0x836a, 0x836b, 0x836c, 0x836d, 0x836e, 0x836f, 0x8370, 0x8371, - 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, 0x8377, 0x8378, 0x8379, - 0x837a, 0x837b, 0x837c, 0x837d, 0x837e, 0x83a1, 0x83a2, 0x83a3, - 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83a8, 0x83a9, 0x83aa, 0x83ab, - 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b0, 0x83b1, 0x83b2, 0x83b3, - 0x83b4, 0x83b5, 0x83b6, 0x83b7, 0x83b8, 0x83b9, 0x83ba, 0x83bb, - 0x83bc, 0x83bd, 0x83be, 0x83bf, 0x83c0, 0x83c1, 0x83c2, 0x83c3, - 0x83c4, 0x83c5, 0x83c6, 0x83c7, 0x83c8, 0x83c9, 0x83ca, 0x83cb, - 0x83cc, 0x83cd, 0x83ce, 0x83cf, 0x83d0, 0x83d1, 0x83d2, 0x83d3, - 0x83d4, 0x83d5, 0x83d6, 0x83d7, 0x83d8, 0x83d9, 0x83da, 0x83db, - 0x83dc, 0x83dd, 0x83de, 0x83df, 0x83e0, 0x83e1, 0x83e2, 0x83e3, - 0x83e4, 0x83e5, 0x83e6, 0x83e7, 0x83e8, 0x83e9, 0x83ea, 0x83eb, - 0x83ec, 0x83ed, 0x83ee, 0x83ef, 0x83f0, 0x83f1, 0x83f2, 0x83f3, - 0x83f4, 0x83f5, 0x83f6, 0x83f7, 0x83f8, 0x83f9, 0x83fa, 0x83fb, - 0x83fc, 0x83fd, 0x83fe, 0x8440, 0x8441, 0x8442, 0x8443, 0x8444, - 0x8445, 0x8446, 0x8447, 0x8448, 0x8449, 0x844a, 0x844b, 0x844c, - 0x844d, 0x844e, 0x844f, 0x8450, 0x8451, 0x8452, 0x8453, 0x8454, - 0x8455, 0x8456, 0x8457, 0x8458, 0x8459, 0x845a, 0x845b, 0x845c, - 0x845d, 0x845e, 0x845f, 0x8460, 0x8461, 0x8462, 0x8463, 0x8464, - 0x8465, 0x8466, 0x8467, 0x8468, 0x8469, 0x846a, 0x846b, 0x846c, - 0x846d, 0x846e, 0x846f, 0x8470, 0x8471, 0x8472, 0x8473, 0x8474, - 0x8475, 0x8476, 0x8477, 0x8478, 0x8479, 0x847a, 0x847b, 0x847c, - 0x847d, 0x847e, 0x84a1, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, - 0x84a7, 0x84a8, 0x84a9, 0x84aa, 0x84ab, 0x84ac, 0x84ad, 0x84ae, - 0x84af, 0x84b0, 0x84b1, 0x84b2, 0x84b3, 0x84b4, 0x84b5, 0x84b6, - 0x84b7, 0x84b8, 0x84b9, 0x84ba, 0x84bb, 0x84bc, 0x84bd, 0x84be, - 0x84bf, 0x84c0, 0x84c1, 0x84c2, 0x84c3, 0x84c4, 0x84c5, 0x84c6, - 0x84c7, 0x84c8, 0x84c9, 0x84ca, 0x84cb, 0x84cc, 0x84cd, 0x84ce, - 0x84cf, 0x84d0, 0x84d1, 0x84d2, 0x84d3, 0x84d4, 0x84d5, 0x84d6, - 0x84d7, 0x84d8, 0x84d9, 0x84da, 0x84db, 0x84dc, 0x84dd, 0x84de, - 0x84df, 0x84e0, 0x84e1, 0x84e2, 0x84e3, 0x84e4, 0x84e5, 0x84e6, - 0x84e7, 0x84e8, 0x84e9, 0x84ea, 0x84eb, 0x84ec, 0x84ed, 0x84ee, - 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f3, 0x84f4, 0x84f5, 0x84f6, - 0x84f7, 0x84f8, 0x84f9, 0x84fa, 0x84fb, 0x84fc, 0x84fd, 0x84fe, - 0x8540, 0x8541, 0x8542, 0x8543, 0x8544, 0x8545, 0x8546, 0x8547, - 0x8548, 0x8549, 0x854a, 0x854b, 0x854c, 0x854d, 0x854e, 0x854f, - 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, 0x8556, 0x8557, - 0x8558, 0x8559, 0x855a, 0x855b, 0x855c, 0x855d, 0x855e, 0x855f, - 0x8560, 0x8561, 0x8562, 0x8563, 0x8564, 0x8565, 0x8566, 0x8567, - 0x8568, 0x8569, 0x856a, 0x856b, 0x856c, 0x856d, 0x856e, 0x856f, - 0x8570, 0x8571, 0x8572, 0x8573, 0x8574, 0x8575, 0x8576, 0x8577, - 0x8578, 0x8579, 0x857a, 0x857b, 0x857c, 0x857d, 0x857e, 0x85a1, - 0x85a2, 0x85a3, 0x85a4, 0x85a5, 0x85a6, 0x85a7, 0x85a8, 0x85a9, - 0x85aa, 0x85ab, 0x85ac, 0x85ad, 0x85ae, 0x85af, 0x85b0, 0x85b1, - 0x85b2, 0x85b3, 0x85b4, 0x85b5, 0x85b6, 0x85b7, 0x85b8, 0x85b9, - 0x85ba, 0x85bb, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c0, 0x85c1, - 0x85c2, 0x85c3, 0x85c4, 0x85c5, 0x85c6, 0x85c7, 0x85c8, 0x85c9, - 0x85ca, 0x85cb, 0x85cc, 0x85cd, 0x85ce, 0x85cf, 0x85d0, 0x85d1, - 0x85d2, 0x85d3, 0x85d4, 0x85d5, 0x85d6, 0x85d7, 0x85d8, 0x85d9, - 0x85da, 0x85db, 0x85dc, 0x85dd, 0x85de, 0x85df, 0x85e0, 0x85e1, - 0x85e2, 0x85e3, 0x85e4, 0x85e5, 0x85e6, 0x85e7, 0x85e8, 0x85e9, - 0x85ea, 0x85eb, 0x85ec, 0x85ed, 0x85ee, 0x85ef, 0x85f0, 0x85f1, - 0x85f2, 0x85f3, 0x85f4, 0x85f5, 0x85f6, 0x85f7, 0x85f8, 0x85f9, - 0x85fa, 0x85fb, 0x85fc, 0x85fd, 0x85fe, 0x8640, 0x8641, 0x8642, - 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, 0x8649, 0x864a, - 0x864b, 0x864c, 0x864d, 0x864e, 0x864f, 0x8650, 0x8651, 0x8652, - 0x8653, 0x8654, 0x8655, 0x8656, 0x8657, 0x8658, 0x8659, 0x865a, - 0x865b, 0x865c, 0x865d, 0x865e, 0x865f, 0x8660, 0x8661, 0x8662, - 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, 0x866a, - 0x866b, 0x866c, 0x866d, 0x866e, 0x866f, 0x8670, 0x8671, 0x8672, - 0x8673, 0x8674, 0x8675, 0x8676, 0x8677, 0x8678, 0x8679, 0x867a, - 0x867b, 0x867c, 0x867d, 0x867e, 0x86a1, 0x86a2, 0x86a3, 0x86a4, - 0x86a5, 0x86a6, 0x86a7, 0x86a8, 0x86a9, 0x86aa, 0x86ab, 0x86ac, - 0x86ad, 0x86ae, 0x86af, 0x86b0, 0x86b1, 0x86b2, 0x86b3, 0x86b4, - 0x86b5, 0x86b6, 0x86b7, 0x86b8, 0x86b9, 0x86ba, 0x86bb, 0x86bc, - 0x86bd, 0x86be, 0x86bf, 0x86c0, 0x86c1, 0x86c2, 0x86c3, 0x86c4, - 0x86c5, 0x86c6, 0x86c7, 0x86c8, 0x86c9, 0x86ca, 0x86cb, 0x86cc, - 0x86cd, 0x86ce, 0x86cf, 0x86d0, 0x86d1, 0x86d2, 0x86d3, 0x86d4, - 0x86d5, 0x86d6, 0x86d7, 0x86d8, 0x86d9, 0x86da, 0x86db, 0x86dc, - 0x86dd, 0x86de, 0x86df, 0x86e0, 0x86e1, 0x86e2, 0x86e3, 0x86e4, - 0x86e5, 0x86e6, 0x86e7, 0x86e8, 0x86e9, 0x86ea, 0x86eb, 0x86ec, - 0x86ed, 0x86ee, 0x86ef, 0x86f0, 0x86f1, 0x86f2, 0x86f3, 0x86f4, - 0x86f5, 0x86f6, 0x86f7, 0x86f8, 0x86f9, 0x86fa, 0x86fb, 0x86fc, - 0x86fd, 0x86fe, 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, - 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c, 0x874d, - 0x874e, 0x874f, 0x8750, 0x8751, 0x8752, 0x8753, 0x8754, 0x8755, - 0x8756, 0x8757, 0x8758, 0x8759, 0x875a, 0x875b, 0x875c, 0x875d, - 0x875e, 0x875f, 0x8760, 0x8761, 0x8762, 0x8763, 0x8764, 0x8765, - 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, 0x876d, - 0x876e, 0x876f, 0x8770, 0x8771, 0x8772, 0x8773, 0x8774, 0x8775, - 0x8776, 0x8777, 0x8778, 0x8779, 0x877a, 0x877b, 0x877c, 0x877d, - 0x877e, 0x87a1, 0x87a2, 0x87a3, 0x87a4, 0x87a5, 0x87a6, 0x87a7, - 0x87a8, 0x87a9, 0x87aa, 0x87ab, 0x87ac, 0x87ad, 0x87ae, 0x87af, - 0x87b0, 0x87b1, 0x87b2, 0x87b3, 0x87b4, 0x87b5, 0x87b6, 0x87b7, - 0x87b8, 0x87b9, 0x87ba, 0x87bb, 0x87bc, 0x87bd, 0x87be, 0x87bf, - 0x87c0, 0x87c1, 0x87c2, 0x87c3, 0x87c4, 0x87c5, 0x87c6, 0x87c7, - 0x87c8, 0x87c9, 0x87ca, 0x87cb, 0x87cc, 0x87cd, 0x87ce, 0x87cf, - 0x87d0, 0x87d1, 0x87d2, 0x87d3, 0x87d4, 0x87d5, 0x87d6, 0x87d7, - 0x87d8, 0x87d9, 0x87da, 0x87db, 0x87dc, 0x87dd, 0x87de, 0x87df, - 0x87e0, 0x87e1, 0x87e2, 0x87e3, 0x87e4, 0x87e5, 0x87e6, 0x87e7, - 0x87e8, 0x87e9, 0x87ea, 0x87eb, 0x87ec, 0x87ed, 0x87ee, 0x87ef, - 0x87f0, 0x87f1, 0x87f2, 0x87f3, 0x87f4, 0x87f5, 0x87f6, 0x87f7, - 0x87f8, 0x87f9, 0x87fa, 0x87fb, 0x87fc, 0x87fd, 0x87fe, 0x8840, - 0x8841, 0x8842, 0x8843, 0x8844, 0x8845, 0x8846, 0x8847, 0x8848, - 0x8849, 0x884a, 0x884b, 0x884c, 0x884d, 0x884e, 0x884f, 0x8850, - 0x8851, 0x8852, 0x8853, 0x8854, 0x8855, 0x8856, 0x8857, 0x8858, - 0x8859, 0x885a, 0x885b, 0x885c, 0x885d, 0x885e, 0x885f, 0x8860, - 0x8861, 0x8862, 0x8863, 0x8864, 0x8865, 0x8866, 0x8867, 0x8868, - 0x8869, 0x886a, 0x886b, 0x886c, 0x886d, 0x886e, 0x886f, 0x8870, - 0x8871, 0x8872, 0x8873, 0x8874, 0x8875, 0x8876, 0x8877, 0x8878, - 0x8879, 0x887a, 0x887b, 0x887c, 0x887d, 0x887e, 0x88a1, 0x88a2, - 0x88a3, 0x88a4, 0x88a5, 0x88a6, 0x88a7, 0x88a8, 0x88a9, 0x88aa, - 0x88ab, 0x88ac, 0x88ad, 0x88ae, 0x88af, 0x88b0, 0x88b1, 0x88b2, - 0x88b3, 0x88b4, 0x88b5, 0x88b6, 0x88b7, 0x88b8, 0x88b9, 0x88ba, - 0x88bb, 0x88bc, 0x88bd, 0x88be, 0x88bf, 0x88c0, 0x88c1, 0x88c2, - 0x88c3, 0x88c4, 0x88c5, 0x88c6, 0x88c7, 0x88c8, 0x88c9, 0x88ca, - 0x88cb, 0x88cc, 0x88cd, 0x88ce, 0x88cf, 0x88d0, 0x88d1, 0x88d2, - 0x88d3, 0x88d4, 0x88d5, 0x88d6, 0x88d7, 0x88d8, 0x88d9, 0x88da, - 0x88db, 0x88dc, 0x88dd, 0x88de, 0x88df, 0x88e0, 0x88e1, 0x88e2, - 0x88e3, 0x88e4, 0x88e5, 0x88e6, 0x88e7, 0x88e8, 0x88e9, 0x88ea, - 0x88eb, 0x88ec, 0x88ed, 0x88ee, 0x88ef, 0x88f0, 0x88f1, 0x88f2, - 0x88f3, 0x88f4, 0x88f5, 0x88f6, 0x88f7, 0x88f8, 0x88f9, 0x88fa, - 0x88fb, 0x88fc, 0x88fd, 0x88fe, 0x8940, 0x8941, 0x8942, 0x8943, - 0x8944, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, 0x894a, 0x894b, - 0x894c, 0x894d, 0x894e, 0x894f, 0x8950, 0x8951, 0x8952, 0x8953, - 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0x895a, 0x895b, - 0x895c, 0x895d, 0x895e, 0x895f, 0x8960, 0x8961, 0x8962, 0x8963, - 0x8964, 0x8965, 0x8966, 0x8967, 0x8968, 0x8969, 0x896a, 0x896b, - 0x896c, 0x896d, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, - 0x8974, 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897a, 0x897b, - 0x897c, 0x897d, 0x897e, 0x89a1, 0x89a2, 0x89a3, 0x89a4, 0x89a5, - 0x89a6, 0x89a7, 0x89a8, 0x89a9, 0x89aa, 0x89ab, 0x89ac, 0x89ad, - 0x89ae, 0x89af, 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, - 0x89b6, 0x89b7, 0x89b8, 0x89b9, 0x89ba, 0x89bb, 0x89bc, 0x89bd, - 0x89be, 0x89bf, 0x89c0, 0x89c1, 0x89c2, 0x89c3, 0x89c4, 0x89c5, - 0x89c6, 0x89c7, 0x89c8, 0x89c9, 0x89ca, 0x89cb, 0x89cc, 0x89cd, - 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x89d2, 0x89d3, 0x89d4, 0x89d5, - 0x89d6, 0x89d7, 0x89d8, 0x89d9, 0x89da, 0x89db, 0x89dc, 0x89dd, - 0x89de, 0x89df, 0x89e0, 0x89e1, 0x89e2, 0x89e3, 0x89e4, 0x89e5, - 0x89e6, 0x89e7, 0x89e8, 0x89e9, 0x89ea, 0x89eb, 0x89ec, 0x89ed, - 0x89ee, 0x89ef, 0x89f0, 0x89f1, 0x89f2, 0x89f3, 0x89f4, 0x89f5, - 0x89f6, 0x89f7, 0x89f8, 0x89f9, 0x89fa, 0x89fb, 0x89fc, 0x89fd, - 0x89fe, 0x8a40, 0x8a41, 0x8a42, 0x8a43, 0x8a44, 0x8a45, 0x8a46, - 0x8a47, 0x8a48, 0x8a49, 0x8a4a, 0x8a4b, 0x8a4c, 0x8a4d, 0x8a4e, - 0x8a4f, 0x8a50, 0x8a51, 0x8a52, 0x8a53, 0x8a54, 0x8a55, 0x8a56, - 0x8a57, 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, - 0x8a5f, 0x8a60, 0x8a61, 0x8a62, 0x8a63, 0x8a64, 0x8a65, 0x8a66, - 0x8a67, 0x8a68, 0x8a69, 0x8a6a, 0x8a6b, 0x8a6c, 0x8a6d, 0x8a6e, - 0x8a6f, 0x8a70, 0x8a71, 0x8a72, 0x8a73, 0x8a74, 0x8a75, 0x8a76, - 0x8a77, 0x8a78, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7c, 0x8a7d, 0x8a7e, - 0x8aa1, 0x8aa2, 0x8aa3, 0x8aa4, 0x8aa5, 0x8aa6, 0x8aa7, 0x8aa8, - 0x8aa9, 0x8aaa, 0x8aab, 0x8aac, 0x8aad, 0x8aae, 0x8aaf, 0x8ab0, - 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, 0x8ab6, 0x8ab7, 0x8ab8, - 0x8ab9, 0x8aba, 0x8abb, 0x8abc, 0x8abd, 0x8abe, 0x8abf, 0x8ac0, - 0x8ac1, 0x8ac2, 0x8ac3, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, 0x8ac8, - 0x8ac9, 0x8aca, 0x8acb, 0x8acc, 0x8acd, 0x8ace, 0x8acf, 0x8ad0, - 0x8ad1, 0x8ad2, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, - 0x8ad9, 0x8ada, 0x8adb, 0x8adc, 0x8add, 0x8ade, 0x8adf, 0x8ae0, - 0x8ae1, 0x8ae2, 0x8ae3, 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, - 0x8ae9, 0x8aea, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, 0x8af0, - 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0x8af5, 0x8af6, 0x8af7, 0x8af8, - 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, 0x8afe, 0x8b40, 0x8b41, - 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, 0x8b47, 0x8b48, 0x8b49, - 0x8b4a, 0x8b4b, 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0x8b50, 0x8b51, - 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0x8b56, 0x8b57, 0x8b58, 0x8b59, - 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, - 0x8b62, 0x8b63, 0x8b64, 0x8b65, 0x8b66, 0x8b67, 0x8b68, 0x8b69, - 0x8b6a, 0x8b6b, 0x8b6c, 0x8b6d, 0x8b6e, 0x8b6f, 0x8b70, 0x8b71, - 0x8b72, 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, - 0x8b7a, 0x8b7b, 0x8b7c, 0x8b7d, 0x8b7e, 0x8ba1, 0x8ba2, 0x8ba3, - 0x8ba4, 0x8ba5, 0x8ba6, 0x8ba7, 0x8ba8, 0x8ba9, 0x8baa, 0x8bab, - 0x8bac, 0x8bad, 0x8bae, 0x8baf, 0x8bb0, 0x8bb1, 0x8bb2, 0x8bb3, - 0x8bb4, 0x8bb5, 0x8bb6, 0x8bb7, 0x8bb8, 0x8bb9, 0x8bba, 0x8bbb, - 0x8bbc, 0x8bbd, 0x8bbe, 0x8bbf, 0x8bc0, 0x8bc1, 0x8bc2, 0x8bc3, - 0x8bc4, 0x8bc5, 0x8bc6, 0x8bc7, 0x8bc8, 0x8bc9, 0x8bca, 0x8bcb, - 0x8bcc, 0x8bcd, 0x8bce, 0x8bcf, 0x8bd0, 0x8bd1, 0x8bd2, 0x8bd3, - 0x8bd4, 0x8bd5, 0x8bd6, 0x8bd7, 0x8bd8, 0x8bd9, 0x8bda, 0x8bdb, - 0x8bdc, 0x8bdd, 0x8bde, 0x8bdf, 0x8be0, 0x8be1, 0x8be2, 0x8be3, - 0x8be4, 0x8be5, 0x8be6, 0x8be7, 0x8be8, 0x8be9, 0x8bea, 0x8beb, - 0x8bec, 0x8bed, 0x8bee, 0x8bef, 0x8bf0, 0x8bf1, 0x8bf2, 0x8bf3, - 0x8bf4, 0x8bf5, 0x8bf6, 0x8bf7, 0x8bf8, 0x8bf9, 0x8bfa, 0x8bfb, - 0x8bfc, 0x8bfd, 0x8bfe, 0x8c40, 0x8c41, 0x8c42, 0x8c43, 0x8c44, - 0x8c45, 0x8c46, 0x8c47, 0x8c48, 0x8c49, 0x8c4a, 0x8c4b, 0x8c4c, - 0x8c4d, 0x8c4e, 0x8c4f, 0x8c50, 0x8c51, 0x8c52, 0x8c53, 0x8c54, - 0x8c55, 0x8c56, 0x8c57, 0x8c58, 0x8c59, 0x8c5a, 0x8c5b, 0x8c5c, - 0x8c5d, 0x8c5e, 0x8c5f, 0x8c60, 0x8c61, 0x8c62, 0x8c63, 0x8c64, - 0x8c65, 0x8c66, 0x8c67, 0x8c68, 0x8c69, 0x8c6a, 0x8c6b, 0x8c6c, - 0x8c6d, 0x8c6e, 0x8c6f, 0x8c70, 0x8c71, 0x8c72, 0x8c73, 0x8c74, - 0x8c75, 0x8c76, 0x8c77, 0x8c78, 0x8c79, 0x8c7a, 0x8c7b, 0x8c7c, - 0x8c7d, 0x8c7e, 0x8ca1, 0x8ca2, 0x8ca3, 0x8ca4, 0x8ca5, 0x8ca6, - 0x8ca7, 0x8ca8, 0x8ca9, 0x8caa, 0x8cab, 0x8cac, 0x8cad, 0x8cae, - 0x8caf, 0x8cb0, 0x8cb1, 0x8cb2, 0x8cb3, 0x8cb4, 0x8cb5, 0x8cb6, - 0x8cb7, 0x8cb8, 0x8cb9, 0x8cba, 0x8cbb, 0x8cbc, 0x8cbd, 0x8cbe, - 0x8cbf, 0x8cc0, 0x8cc1, 0x8cc2, 0x8cc3, 0x8cc4, 0x8cc5, 0x8cc6, - 0x8cc7, 0x8cc8, 0x8cc9, 0x8cca, 0x8ccb, 0x8ccc, 0x8ccd, 0x8cce, - 0x8ccf, 0x8cd0, 0x8cd1, 0x8cd2, 0x8cd3, 0x8cd4, 0x8cd5, 0x8cd6, - 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0x8cdb, 0x8cdc, 0x8cdd, 0x8cde, - 0x8cdf, 0x8ce0, 0x8ce1, 0x8ce2, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, - 0x8ce7, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, 0x8ced, 0x8cee, - 0x8cef, 0x8cf0, 0x8cf1, 0x8cf2, 0x8cf3, 0x8cf4, 0x8cf5, 0x8cf6, - 0x8cf7, 0x8cf8, 0x8cf9, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, 0x8cfe, - 0x8d40, 0x8d41, 0x8d42, 0x8d43, 0x8d44, 0x8d45, 0x8d46, 0x8d47, - 0x8d48, 0x8d49, 0x8d4a, 0x8d4b, 0x8d4c, 0x8d4d, 0x8d4e, 0x8d4f, - 0x8d50, 0x8d51, 0x8d52, 0x8d53, 0x8d54, 0x8d55, 0x8d56, 0x8d57, - 0x8d58, 0x8d59, 0x8d5a, 0x8d5b, 0x8d5c, 0x8d5d, 0x8d5e, 0x8d5f, - 0x8d60, 0x8d61, 0x8d62, 0x8d63, 0x8d64, 0x8d65, 0x8d66, 0x8d67, - 0x8d68, 0x8d69, 0x8d6a, 0x8d6b, 0x8d6c, 0x8d6d, 0x8d6e, 0x8d6f, - 0x8d70, 0x8d71, 0x8d72, 0x8d73, 0x8d74, 0x8d75, 0x8d76, 0x8d77, - 0x8d78, 0x8d79, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, 0x8d7e, 0x8da1, - 0x8da2, 0x8da3, 0x8da4, 0x8da5, 0x8da6, 0x8da7, 0x8da8, 0x8da9, - 0x8daa, 0x8dab, 0x8dac, 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db1, - 0x8db2, 0x8db3, 0x8db4, 0x8db5, 0x8db6, 0x8db7, 0x8db8, 0x8db9, - 0x8dba, 0x8dbb, 0x8dbc, 0x8dbd, 0x8dbe, 0x8dbf, 0x8dc0, 0x8dc1, - 0x8dc2, 0x8dc3, 0x8dc4, 0x8dc5, 0x8dc6, 0x8dc7, 0x8dc8, 0x8dc9, - 0x8dca, 0x8dcb, 0x8dcc, 0x8dcd, 0x8dce, 0x8dcf, 0x8dd0, 0x8dd1, - 0x8dd2, 0x8dd3, 0x8dd4, 0x8dd5, 0x8dd6, 0x8dd7, 0x8dd8, 0x8dd9, - 0x8dda, 0x8ddb, 0x8ddc, 0x8ddd, 0x8dde, 0x8ddf, 0x8de0, 0x8de1, - 0x8de2, 0x8de3, 0x8de4, 0x8de5, 0x8de6, 0x8de7, 0x8de8, 0x8de9, - 0x8dea, 0x8deb, 0x8dec, 0x8ded, 0x8dee, 0x8def, 0x8df0, 0x8df1, - 0x8df2, 0x8df3, 0x8df4, 0x8df5, 0x8df6, 0x8df7, 0x8df8, 0x8df9, - 0x8dfa, 0x8dfb, 0x8dfc, 0x8dfd, 0x8dfe, 0xc6a1, 0xc6a2, 0xc6a3, - 0xc6a4, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, - 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, - 0xc6b4, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, - 0xc6bc, 0xc6bd, 0xc6be, 0xc6bf, 0xc6c0, 0xc6c1, 0xc6c2, 0xc6c3, - 0xc6c4, 0xc6c5, 0xc6c6, 0xc6c7, 0xc6c8, 0xc6c9, 0xc6ca, 0xc6cb, - 0xc6cc, 0xc6cd, 0xc6ce, 0xc6cf, 0xc6d0, 0xc6d1, 0xc6d2, 0xc6d3, - 0xc6d4, 0xc6d5, 0xc6d6, 0xc6d7, 0xc6d8, 0xc6d9, 0xc6da, 0xc6db, - 0xc6dc, 0xc6dd, 0xc6de, 0xc6df, 0xc6e0, 0xc6e1, 0xc6e2, 0xc6e3, - 0xc6e4, 0xc6e5, 0xc6e6, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, - 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, - 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, - 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, - 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, - 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, - 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, - 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, - 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, - 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, - 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, 0xc77c, - 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, - 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, 0xc7ad, 0xc7ae, - 0xc7af, 0xc7b0, 0xc7b1, 0xc7b2, 0xc7b3, 0xc7b4, 0xc7b5, 0xc7b6, - 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, - 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, - 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, 0xc7cd, 0xc7ce, - 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, 0xc7d5, 0xc7d6, - 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, 0xc7dd, 0xc7de, - 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, 0xc7e5, 0xc7e6, - 0xc7e7, 0xc7e8, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, 0xc7ed, 0xc7ee, - 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, - 0xc7f7, 0xc7f8, 0xc7f9, 0xc7fa, 0xc7fb, 0xc7fc, 0xc7fd, 0xc7fe, - 0xc840, 0xc841, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, 0xc847, - 0xc848, 0xc849, 0xc84a, 0xc84b, 0xc84c, 0xc84d, 0xc84e, 0xc84f, - 0xc850, 0xc851, 0xc852, 0xc853, 0xc854, 0xc855, 0xc856, 0xc857, - 0xc858, 0xc859, 0xc85a, 0xc85b, 0xc85c, 0xc85d, 0xc85e, 0xc85f, - 0xc860, 0xc861, 0xc862, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, - 0xc868, 0xc869, 0xc86a, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, - 0xc870, 0xc871, 0xc872, 0xc873, 0xc874, 0xc875, 0xc876, 0xc877, - 0xc878, 0xc879, 0xc87a, 0xc87b, 0xc87c, 0xc87d, 0xc87e, 0xc8a1, - 0xc8a2, 0xc8a3, 0xc8a4, 0xc8a5, 0xc8a6, 0xc8a7, 0xc8a8, 0xc8a9, - 0xc8aa, 0xc8ab, 0xc8ac, 0xc8ad, 0xc8ae, 0xc8af, 0xc8b0, 0xc8b1, - 0xc8b2, 0xc8b3, 0xc8b4, 0xc8b5, 0xc8b6, 0xc8b7, 0xc8b8, 0xc8b9, - 0xc8ba, 0xc8bb, 0xc8bc, 0xc8bd, 0xc8be, 0xc8bf, 0xc8c0, 0xc8c1, - 0xc8c2, 0xc8c3, 0xc8c4, 0xc8c5, 0xc8c6, 0xc8c7, 0xc8c8, 0xc8c9, - 0xc8ca, 0xc8cb, 0xc8cc, 0xc8cd, 0xc8ce, 0xc8cf, 0xc8d0, 0xc8d1, - 0xc8d2, 0xc8d3, 0xc8d4, 0xc8d5, 0xc8d6, 0xc8d7, 0xc8d8, 0xc8d9, - 0xc8da, 0xc8db, 0xc8dc, 0xc8dd, 0xc8de, 0xc8df, 0xc8e0, 0xc8e1, - 0xc8e2, 0xc8e3, 0xc8e4, 0xc8e5, 0xc8e6, 0xc8e7, 0xc8e8, 0xc8e9, - 0xc8ea, 0xc8eb, 0xc8ec, 0xc8ed, 0xc8ee, 0xc8ef, 0xc8f0, 0xc8f1, - 0xc8f2, 0xc8f3, 0xc8f4, 0xc8f5, 0xc8f6, 0xc8f7, 0xc8f8, 0xc8f9, - 0xc8fa, 0xc8fb, 0xc8fc, 0xc8fd, 0xc8fe, 0xb05a, 0xa7f3, 0xa8ae, - 0xb8eb, 0xb7c6, 0xa6ea, 0xa579, 0x8bf8, 0xc074, 0xabb4, 0xaaf7, - 0xb3e2, 0xa960, 0xc369, 0xc4ee, 0xc3b9, 0xc5da, 0xc1b3, 0xbb72, - 0xc5de, 0xbcd6, 0xaca5, 0xaf4f, 0xaf5f, 0xb8a8, 0xb954, 0xc064, - 0xb6c3, 0xa75a, 0xc4e6, 0xc4ea, 0xc4f5, 0xc67d, 0xb450, 0xc0dd, - 0xc2c5, 0xc4b0, 0xa9d4, 0xc3be, 0xc4fa, 0xb459, 0xaed4, 0xaef6, - 0xaf54, 0xa8d3, 0xa74e, 0xb3d2, 0xbedb, 0xc372, 0xc46c, 0xbf63, - 0xa6d1, 0xc4aa, 0xb8b8, 0xb8f4, 0xc553, 0xbe7c, 0xc64f, 0xb84c, - 0xb853, 0xbaf1, 0xdb77, 0xbffd, 0xb3c0, 0xbdd7, 0xc362, 0xa7cb, - 0xc5a2, 0xc5a4, 0xa863, 0xbd55, 0xb8ef, 0xb970, 0xc253, 0xb9f0, - 0xbcd3, 0xb25c, 0xba7c, 0xb2d6, 0xc15c, 0xadae, 0xb0c7, 0xa6d8, - 0xbbfe, 0xade2, 0xb857, 0xbaf0, 0xb5d9, 0xb3ae, 0xc5aa, 0xced4, - 0xbcd6, 0xbfd5, 0xa4a6, 0xb9e7, 0xabe3, 0xb276, 0xb2a7, 0xa55f, - 0xeda8, 0xab4b, 0xb45f, 0xa4a3, 0xaa63, 0xbcc6, 0xafc1, 0xb0d1, - 0xb6eb, 0xacd9, 0xb8ad, 0xbba1, 0xb1fe, 0xa8b0, 0xa848, 0xac42, - 0xad59, 0xb1b0, 0xb2a4, 0xab47, 0xa8e2, 0xb1e7, 0xc2b3, 0xa87d, - 0xbdcc, 0xb671, 0xc079, 0xa766, 0xa46b, 0xc366, 0xaec8, 0xc26f, - 0xc472, 0xbe5b, 0xc67a, 0xc452, 0xbea4, 0xa44f, 0xbee4, 0xbefa, - 0xf765, 0xa67e, 0xbca6, 0xc5ca, 0xbcbf, 0xbaa7, 0xb7d2, 0xe6a3, - 0xbd6d, 0xc170, 0xbdfb, 0xbdac, 0xb373, 0xc1e5, 0xa643, 0xa648, - 0xab7c, 0xaf50, 0xb5f5, 0xbba1, 0xb747, 0xa9c0, 0xb1c9, 0xc0d4, - 0xc3ae, 0xc279, 0xa54f, 0xcbf1, 0xb9e7, 0xc0ad, 0xccb0, 0xacc2, - 0xbcfc, 0xb2dc, 0xb2e2, 0xb961, 0xb973, 0xc646, 0xbbe2, 0xa8d2, - 0xc2a7, 0xc4bf, 0xc1f5, 0xb463, 0xa446, 0xb9b1, 0xbc64, 0xa7bf, - 0xaec6, 0xbcd6, 0xbf52, 0xc0f8, 0xe764, 0xbff1, 0xc073, 0xb777, - 0xa8bf, 0xbc42, 0xccd8, 0xac68, 0xac79, 0xb7c8, 0xaf5b, 0xaf64, - 0xb2b8, 0xafc3, 0xc3fe, 0xa4bb, 0xbcae, 0xb3b0, 0xaddb, 0xb15b, - 0xb25f, 0xbdfc, 0xabdf, 0xb758, 0xaedf, 0xb276, 0xb6a9, 0xa751, - 0xa64f, 0xbc69, 0xa9f6, 0xa7f5, 0xb1f9, 0xaa64, 0xb27a, 0xb567, - 0xbfa9, 0xb8cc, 0xa8bd, 0xc2f7, 0xb0ce, 0xb7c4, 0xa75b, 0xbf4d, - 0xbf5a, 0xc4a9, 0xc5ec, 0xc5ef, 0xaa4c, 0xb24f, 0xc17b, 0xa5df, - 0xb2c1, 0xb2c9, 0xaaac, 0xaaa5, 0xc3d1, 0xa4b0, 0xaff9, 0xa8eb, - 0xa4c1, 0xabd7, 0xa9dd, 0xbf7d, 0xa676, 0xac7d, 0xbcc9, 0xbfe7, - 0xa6e6, 0xadb0, 0xa8a3, 0xb9f8, 0xc94a, 0xddfc, 0xb6ef, 0xb4b8, - 0xe8f9, 0xbdde, 0xaf71, 0xafab, 0xb2bb, 0xbad6, 0xb974, 0xbaeb, - 0xa6d0, 0xbdd1, 0xb668, 0xb3a3, 0xb6ba, 0xb97d, 0xc05d, 0xc562, - 0xa14a, 0xa157, 0xa159, 0xa15b, 0xa15f, 0xa160, 0xa163, 0xa164, - 0xa167, 0xa168, 0xa16b, 0xa16c, 0xa16f, 0xa170, 0xa173, 0xa174, - 0xa177, 0xa178, 0xa17b, 0xa17c, 0xa1c6, 0xa1c7, 0xa1ca, 0xa1cb, - 0xa1c8, 0xa1c9, 0xa15c, 0xa14d, 0xa14e, 0xa14f, 0xa151, 0xa152, - 0xa153, 0xa154, 0xa17d, 0xa17e, 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, - 0xa1cc, 0xa1cd, 0xa1ce, 0xa1de, 0xa1df, 0xa1e0, 0xa1e1, 0xa1e2, - 0xa242, 0xa24c, 0xa24d, 0xa24e, 0xa149, 0xc8d0, 0xa1ad, 0xa243, - 0xa248, 0xa1ae, 0xc8cf, 0xa15d, 0xa15e, 0xa1af, 0xa1cf, 0xa141, - 0xa1d0, 0xa144, 0xa1fe, 0xa2af, 0xa2b0, 0xa2b1, 0xa2b2, 0xa2b3, - 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, 0xa147, 0xa146, 0xa1d5, - 0xa1d7, 0xa1d6, 0xa148, 0xa249, 0xa2cf, 0xa2d0, 0xa2d1, 0xa2d2, - 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, 0xa2d9, 0xa2da, - 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, 0xa2e1, 0xa2e2, - 0xa2e3, 0xa2e4, 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xc6e4, 0xa240, - 0xc6e5, 0xa173, 0xa1c4, 0xa1a5, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, - 0xa2ed, 0xa2ee, 0xa2ef, 0xa2f0, 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, - 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, - 0xa2fd, 0xa2fe, 0xa340, 0xa341, 0xa342, 0xa343, 0xa161, 0xa155, - 0xa162, 0xa1e3, 0xa14e, 0xa246, 0xa247, 0xc8cd, 0xa1c3, 0xc8ce, - 0xa244, 0xf9fe, -}; - -static const Summary16 big5hkscs_uni2indx_page00[16] = { - /* 0x0000 */ - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x81ac }, { 6, 0x01b3 }, - { 12, 0x0703 }, { 17, 0x008c }, { 20, 0x3703 }, { 27, 0x178c }, -}; -static const Summary16 big5hkscs_uni2indx_page02[29] = { - /* 0x0200 */ - { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, - { 56, 0x0000 }, { 56, 0x0813 }, { 60, 0x0402 }, { 62, 0x0020 }, - { 63, 0x0408 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, - { 65, 0x2ec0 }, { 71, 0x0200 }, { 72, 0x0000 }, { 72, 0x0000 }, - /* 0x0300 */ - { 72, 0x0020 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, - { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, - { 73, 0x0000 }, { 73, 0xfffe }, { 88, 0x03fb }, { 97, 0xfffe }, - { 112, 0x03fb }, -}; -static const Summary16 big5hkscs_uni2indx_page20[44] = { - /* 0x2000 */ - { 191, 0x0000 }, { 191, 0x3378 }, { 199, 0x00f4 }, { 204, 0x482c }, - { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, - { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, - { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, - /* 0x2100 */ - { 209, 0x0228 }, { 212, 0x0040 }, { 213, 0x0002 }, { 214, 0x0000 }, - { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x03ff }, { 224, 0x03ff }, - { 234, 0x0000 }, { 234, 0x03cf }, { 242, 0x0000 }, { 242, 0x0300 }, - { 244, 0x0000 }, { 244, 0x0000 }, { 244, 0x0080 }, { 245, 0x0000 }, - /* 0x2200 */ - { 245, 0x0000 }, { 245, 0xc560 }, { 251, 0x4e29 }, { 258, 0x0030 }, - { 260, 0x0000 }, { 260, 0x0004 }, { 261, 0x00cb }, { 266, 0x0000 }, - { 266, 0x0000 }, { 266, 0x0220 }, { 268, 0x0020 }, { 269, 0x8000 }, -}; -static const Summary16 big5hkscs_uni2indx_page25[21] = { - /* 0x2500 */ - { 291, 0x1005 }, { 294, 0x1111 }, { 298, 0x1010 }, { 300, 0x1010 }, - { 302, 0x0000 }, { 302, 0xffff }, { 318, 0xffff }, { 334, 0x001f }, - { 339, 0xfffe }, { 354, 0x0038 }, { 357, 0x0003 }, { 359, 0x300c }, - { 363, 0xc8c0 }, { 368, 0x0000 }, { 368, 0x003c }, { 372, 0x0000 }, - /* 0x2600 */ - { 372, 0x0260 }, { 375, 0x0000 }, { 375, 0x0000 }, { 375, 0x0000 }, - { 375, 0x0007 }, -}; -static const Summary16 big5hkscs_uni2indx_page30[62] = { - /* 0x3000 */ - { 408, 0xffef }, { 423, 0x7037 }, { 431, 0x03fe }, { 440, 0x0001 }, - { 441, 0xfffe }, { 456, 0xffff }, { 472, 0xffff }, { 488, 0xffff }, - { 504, 0xffff }, { 520, 0x780f }, { 528, 0xfffe }, { 543, 0xffff }, - { 559, 0xffff }, { 575, 0xffff }, { 591, 0xffff }, { 607, 0x707f }, - /* 0x3100 */ - { 617, 0xffe0 }, { 628, 0xffff }, { 644, 0x03ff }, { 654, 0x0000 }, - { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, - { 654, 0x0000 }, { 654, 0xfffc }, { 668, 0x0000 }, { 668, 0x0000 }, - { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, - /* 0x3200 */ - { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0xffff }, { 684, 0xffff }, - { 700, 0x000f }, { 704, 0x0000 }, { 704, 0x0000 }, { 704, 0x0000 }, - { 704, 0xffff }, { 720, 0xffff }, { 736, 0xffff }, { 752, 0x0001 }, - { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, - /* 0x3300 */ - { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, - { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, - { 753, 0xc000 }, { 755, 0x7000 }, { 758, 0x0002 }, { 759, 0x0000 }, - { 759, 0x4010 }, { 761, 0x0026 }, -}; -static const Summary16 big5hkscs_uni2indx_page4e[1307] = { - /* 0x4e00 */ - { 1275, 0xff9b }, { 1288, 0xd773 }, { 1299, 0xfd52 }, { 1309, 0xbbcf }, - { 1321, 0xebac }, { 1331, 0xff4c }, { 1342, 0x0600 }, { 1344, 0xc108 }, - { 1348, 0x7bff }, { 1362, 0xcf3e }, { 1373, 0x797f }, { 1385, 0x9ec8 }, - { 1393, 0x6fdf }, { 1406, 0xf7f0 }, { 1417, 0x4f3a }, { 1426, 0xa9ff }, - /* 0x4f00 */ - { 1438, 0xef3f }, { 1451, 0x27bf }, { 1462, 0xb304 }, { 1468, 0xffdd }, - { 1482, 0xfbee }, { 1495, 0xffff }, { 1511, 0xde9f }, { 1523, 0xfffd }, - { 1538, 0xafff }, { 1552, 0x7df7 }, { 1565, 0xc904 }, { 1570, 0xaeed }, - { 1581, 0xffbf }, { 1596, 0xffdb }, { 1610, 0xd033 }, { 1617, 0x67ff }, - /* 0x5000 */ - { 1630, 0xfbe9 }, { 1642, 0xdffe }, { 1656, 0xffef }, { 1671, 0x18bb }, - { 1679, 0xffeb }, { 1693, 0xfdea }, { 1705, 0xff7f }, { 1720, 0x24fd }, - { 1729, 0x79af }, { 1740, 0x7f77 }, { 1753, 0xf04c }, { 1760, 0xfdff }, - { 1775, 0xeff6 }, { 1788, 0xaefb }, { 1800, 0xf7fb }, { 1814, 0xfb7b }, - /* 0x5100 */ - { 1827, 0x7fff }, { 1842, 0x95bf }, { 1853, 0x6e77 }, { 1864, 0xbfbf }, - { 1878, 0x3bfb }, { 1890, 0xfef4 }, { 1902, 0x7faf }, { 1915, 0x13f2 }, - { 1923, 0xa7c5 }, { 1932, 0x55fe }, { 1943, 0x5db5 }, { 1953, 0x73ff }, - { 1966, 0xfff8 }, { 1979, 0xf99f }, { 1991, 0x2017 }, { 1996, 0x777b }, - /* 0x5200 */ - { 2008, 0x5fef }, { 2021, 0xf0cf }, { 2031, 0x47f3 }, { 2041, 0x1dff }, - { 2053, 0x7eda }, { 2064, 0xfef4 }, { 2076, 0xff07 }, { 2087, 0xbfbc }, - { 2099, 0xbf9f }, { 2112, 0x8fdb }, { 2123, 0x7f5b }, { 2135, 0x5a20 }, - { 2140, 0x32af }, { 2149, 0xebef }, { 2162, 0x8a5f }, { 2171, 0xdfbb }, - /* 0x5300 */ - { 2184, 0xef62 }, { 2194, 0xb6e7 }, { 2205, 0xb49f }, { 2215, 0xfb9f }, - { 2228, 0x77bf }, { 2241, 0xf49e }, { 2251, 0xf2db }, { 2262, 0xfbbf }, - { 2276, 0xc414 }, { 2281, 0xf7dc }, { 2293, 0x7ff5 }, { 2306, 0x0a55 }, - { 2312, 0x3f2e }, { 2322, 0x8fd7 }, { 2333, 0xff7f }, { 2348, 0x59ef }, - /* 0x5400 */ - { 2359, 0xffda }, { 2372, 0xff5f }, { 2386, 0xfffb }, { 2401, 0x7bff }, - { 2415, 0xedef }, { 2428, 0x0010 }, { 2429, 0xbfff }, { 2444, 0xfdff }, - { 2459, 0xf9f7 }, { 2472, 0x55ff }, { 2484, 0xffff }, { 2500, 0xffdf }, - { 2515, 0xfbff }, { 2530, 0x4441 }, { 2534, 0xefff }, { 2549, 0xbd8e }, - /* 0x5500 */ - { 2559, 0xfffe }, { 2574, 0x459f }, { 2583, 0xfde8 }, { 2594, 0xdbff }, - { 2608, 0xeffb }, { 2622, 0xf0ef }, { 2633, 0x0e7e }, { 2642, 0xfaee }, - { 2654, 0xffdf }, { 2669, 0xb73f }, { 2681, 0x7ffe }, { 2695, 0x9e3f }, - { 2706, 0xffff }, { 2722, 0xffff }, { 2738, 0x97fe }, { 2750, 0xfee7 }, - /* 0x5600 */ - { 2763, 0xf377 }, { 2775, 0xf8ff }, { 2788, 0xf6af }, { 2800, 0xeffd }, - { 2814, 0xf76f }, { 2827, 0x679d }, { 2837, 0xff7f }, { 2852, 0xdfdf }, - { 2866, 0xfeff }, { 2881, 0xf7ad }, { 2893, 0xfdf2 }, { 2905, 0xf2fe }, - { 2917, 0x3f6f }, { 2929, 0xecda }, { 2939, 0xecb7 }, { 2950, 0xa683 }, - /* 0x5700 */ - { 2957, 0x3f9f }, { 2969, 0xfd7c }, { 2981, 0xf70d }, { 2991, 0xe81d }, - { 2999, 0xfeef }, { 3013, 0x8897 }, { 3020, 0xafd6 }, { 3031, 0xfcff }, - { 3045, 0xbd0d }, { 3054, 0xffb9 }, { 3067, 0x44bf }, { 3076, 0xff70 }, - { 3087, 0xd9de }, { 3098, 0xf0b5 }, { 3107, 0xf2ff }, { 3120, 0x7fff }, - /* 0x5800 */ - { 3135, 0x7fff }, { 3150, 0x7a15 }, { 3158, 0xf7ff }, { 3173, 0xafff }, - { 3187, 0xff91 }, { 3198, 0xffbe }, { 3212, 0xbb3c }, { 3222, 0xfe7e }, - { 3235, 0xcfef }, { 3248, 0xf71f }, { 3260, 0xdfeb }, { 3273, 0xfc6b }, - { 3284, 0xcbe6 }, { 3294, 0xff7f }, { 3309, 0x9b9d }, { 3319, 0xfe1d }, - /* 0x5900 */ - { 3330, 0xf4fc }, { 3341, 0x96f6 }, { 3351, 0xfeb5 }, { 3363, 0x5196 }, - { 3370, 0xc7b1 }, { 3379, 0x15bb }, { 3388, 0x6ea7 }, { 3398, 0xfbff }, - { 3413, 0xe63f }, { 3424, 0xe7dd }, { 3436, 0xd1ff }, { 3448, 0x7fff }, - { 3463, 0xfffb }, { 3478, 0x7f5f }, { 3491, 0xff7b }, { 3505, 0xffff }, - /* 0x5a00 */ - { 3521, 0xbe0f }, { 3531, 0xdfee }, { 3544, 0x7ebb }, { 3556, 0x73e8 }, - { 3565, 0x37ff }, { 3578, 0xffff }, { 3594, 0x7fff }, { 3609, 0xff83 }, - { 3620, 0xdd5e }, { 3631, 0xfeff }, { 3646, 0xdae7 }, { 3657, 0xffff }, - { 3673, 0xffdf }, { 3688, 0xffe8 }, { 3700, 0x7f7f }, { 3714, 0xeffd }, - /* 0x5b00 */ - { 3728, 0xbbae }, { 3739, 0xeefb }, { 3752, 0xfdfb }, { 3766, 0xf115 }, - { 3774, 0xfdfb }, { 3788, 0xbdfb }, { 3801, 0x7b7c }, { 3812, 0xbdff }, - { 3826, 0xdbbf }, { 3839, 0xffed }, { 3853, 0x75fc }, { 3864, 0x8379 }, - { 3872, 0x7cff }, { 3885, 0xc3ff }, { 3897, 0xdfff }, { 3912, 0x856f }, - /* 0x5c00 */ - { 3921, 0xffba }, { 3934, 0xd47f }, { 3945, 0x153d }, { 3953, 0xdf8b }, - { 3964, 0xfff3 }, { 3978, 0x737b }, { 3989, 0xf7bd }, { 4002, 0x5e1a }, - { 4010, 0xbf60 }, { 4019, 0xf63f }, { 4031, 0xffff }, { 4047, 0x05eb }, - { 4055, 0xdfc6 }, { 4066, 0xcfdf }, { 4079, 0xf720 }, { 4087, 0xabf3 }, - /* 0x5d00 */ - { 4098, 0xf8c3 }, { 4107, 0xeff7 }, { 4121, 0xd3fd }, { 4133, 0xf7ff }, - { 4148, 0x5fef }, { 4161, 0x4ae7 }, { 4170, 0x9bac }, { 4179, 0xfe97 }, - { 4191, 0x6ff7 }, { 4204, 0xf6bc }, { 4215, 0xff97 }, { 4228, 0x37f7 }, - { 4240, 0xaacf }, { 4250, 0xe9f6 }, { 4261, 0x49e7 }, { 4270, 0xe2bf }, - /* 0x5e00 */ - { 4281, 0x5e5c }, { 4290, 0xaff6 }, { 4302, 0x6b3f }, { 4313, 0x61d8 }, - { 4320, 0xfd3f }, { 4333, 0xfbb8 }, { 4344, 0xffcf }, { 4358, 0xff7d }, - { 4372, 0xbfdd }, { 4385, 0x1ee4 }, { 4393, 0x7dfd }, { 4406, 0x63ff }, - { 4418, 0x7ff6 }, { 4431, 0xffff }, { 4447, 0xd3ef }, { 4459, 0xdfde }, - /* 0x5f00 */ - { 4472, 0xfdb6 }, { 4484, 0xadbc }, { 4494, 0x63fc }, { 4504, 0x15eb }, - { 4513, 0xff59 }, { 4525, 0x33d3 }, { 4534, 0xbebe }, { 4546, 0xfbdf }, - { 4560, 0x1fef }, { 4572, 0xdbc7 }, { 4583, 0xfff3 }, { 4597, 0xfee6 }, - { 4609, 0xb23f }, { 4619, 0xebf7 }, { 4632, 0xed3b }, { 4643, 0xadba }, - /* 0x6000 */ - { 4653, 0xfe01 }, { 4661, 0x7eff }, { 4675, 0xffff }, { 4691, 0x0abe }, - { 4699, 0x36ff }, { 4711, 0xef3d }, { 4723, 0xfffc }, { 4737, 0xc0a5 }, - { 4743, 0x77fb }, { 4756, 0xfcf5 }, { 4768, 0x019d }, { 4774, 0xffff }, - { 4790, 0xfffb }, { 4805, 0xffba }, { 4818, 0x03df }, { 4827, 0xffff }, - /* 0x6100 */ - { 4843, 0xfffb }, { 4858, 0xbf7d }, { 4871, 0xdb8c }, { 4880, 0xe8d5 }, - { 4889, 0xfff7 }, { 4904, 0xff7d }, { 4918, 0xddff }, { 4932, 0x76ff }, - { 4945, 0x7e8f }, { 4956, 0xbf7f }, { 4970, 0xff96 }, { 4982, 0xd7ff }, - { 4996, 0xbfef }, { 5010, 0xc549 }, { 5017, 0x6ffd }, { 5030, 0xffe7 }, - /* 0x6200 */ - { 5044, 0x779b }, { 5055, 0x8e77 }, { 5065, 0x7ebf }, { 5078, 0xe6dd }, - { 5089, 0x7fcf }, { 5102, 0x5f1f }, { 5113, 0xe17f }, { 5124, 0xfedf }, - { 5138, 0xd7ff }, { 5152, 0x21ff }, { 5162, 0xff50 }, { 5172, 0xfb7b }, - { 5185, 0xfffc }, { 5199, 0x9fff }, { 5213, 0xf820 }, { 5219, 0xffff }, - /* 0x6300 */ - { 5235, 0xfb8f }, { 5247, 0x017b }, { 5254, 0xff00 }, { 5262, 0x7ffe }, - { 5276, 0xffff }, { 5292, 0x07f3 }, { 5301, 0xfbb0 }, { 5311, 0xbfe7 }, - { 5324, 0xffbf }, { 5339, 0xfbd7 }, { 5352, 0xffbf }, { 5367, 0x6203 }, - { 5372, 0xffff }, { 5388, 0xffef }, { 5403, 0xefff }, { 5418, 0x5b7f }, - /* 0x6400 */ - { 5430, 0xfec0 }, { 5439, 0xddfd }, { 5452, 0xfdff }, { 5467, 0xeffd }, - { 5481, 0x680b }, { 5487, 0xff1f }, { 5500, 0xfbe3 }, { 5512, 0xbfff }, - { 5527, 0xbfa4 }, { 5537, 0xf7ef }, { 5551, 0xfa7d }, { 5563, 0xf85f }, - { 5574, 0xeebf }, { 5587, 0x2fdd }, { 5598, 0xbfff }, { 5613, 0xfd9f }, - /* 0x6500 */ - { 5626, 0xf6db }, { 5638, 0xfbfb }, { 5652, 0xfe7f }, { 5666, 0xebfd }, - { 5679, 0xa76a }, { 5688, 0xf3fa }, { 5700, 0xbdfc }, { 5712, 0x9ffc }, - { 5724, 0x1bff }, { 5736, 0xfaf7 }, { 5749, 0xddb7 }, { 5761, 0xfbed }, - { 5774, 0xf87e }, { 5785, 0xecdf }, { 5797, 0xf36f }, { 5809, 0xbc3f }, - /* 0x6600 */ - { 5820, 0xfffd }, { 5835, 0xf13f }, { 5846, 0xe9ff }, { 5859, 0x067f }, - { 5868, 0x9fbe }, { 5880, 0xfe8e }, { 5891, 0xddfe }, { 5904, 0x7fdf }, - { 5918, 0x7ff1 }, { 5930, 0xa7f7 }, { 5942, 0xef17 }, { 5953, 0xefff }, - { 5968, 0xffd1 }, { 5980, 0x7f44 }, { 5989, 0x7b59 }, { 5999, 0xd3df }, - /* 0x6700 */ - { 6011, 0xff3f }, { 6025, 0xebfd }, { 6038, 0x7def }, { 6051, 0xff7a }, - { 6064, 0xfbf0 }, { 6075, 0xf6eb }, { 6087, 0xbc87 }, { 6096, 0xffff }, - { 6112, 0xfafa }, { 6124, 0xb7bf }, { 6137, 0xd011 }, { 6142, 0x8fff }, - { 6155, 0xff7f }, { 6170, 0xffdf }, { 6185, 0xfefc }, { 6198, 0xd7ff }, - /* 0x6800 */ - { 6212, 0x201f }, { 6218, 0xfddd }, { 6231, 0xef67 }, { 6243, 0x7ffe }, - { 6257, 0xffff }, { 6273, 0x207b }, { 6280, 0xe820 }, { 6285, 0xfbf6 }, - { 6298, 0x9fff }, { 6312, 0xb9df }, { 6324, 0xffdf }, { 6339, 0x227f }, - { 6348, 0x7ff8 }, { 6360, 0xf5ff }, { 6374, 0xdfdb }, { 6387, 0x3fff }, - /* 0x6900 */ - { 6401, 0xffff }, { 6417, 0x0fbf }, { 6428, 0x9420 }, { 6432, 0xfbfd }, - { 6446, 0xdf7f }, { 6460, 0xfffe }, { 6475, 0xffff }, { 6491, 0x0fff }, - { 6503, 0x646d }, { 6511, 0xdffb }, { 6525, 0xffff }, { 6541, 0xfaff }, - { 6555, 0xfe5f }, { 6568, 0x027b }, { 6575, 0x7bf6 }, { 6587, 0xffde }, - /* 0x6a00 */ - { 6601, 0xbfff }, { 6616, 0xfffa }, { 6630, 0x39eb }, { 6640, 0xff3c }, - { 6652, 0xfbfb }, { 6666, 0xefff }, { 6681, 0xafff }, { 6695, 0xc452 }, - { 6701, 0xf6bf }, { 6714, 0xfeff }, { 6729, 0xf9ff }, { 6743, 0x6ffe }, - { 6756, 0xbfec }, { 6768, 0xff1b }, { 6780, 0xdda3 }, { 6790, 0x1f4b }, - /* 0x6b00 */ - { 6799, 0x8f3d }, { 6809, 0x67cf }, { 6820, 0xb12b }, { 6828, 0xfffe }, - { 6843, 0x7fee }, { 6856, 0xdaf7 }, { 6868, 0xa4ff }, { 6879, 0xcfd4 }, - { 6889, 0xf75f }, { 6902, 0xcbf2 }, { 6912, 0xecfd }, { 6924, 0xb4ed }, - { 6934, 0xbffb }, { 6948, 0x5ddd }, { 6959, 0x9ddf }, { 6971, 0xff8d }, - /* 0x6c00 */ - { 6983, 0xbb7f }, { 6996, 0xbf7b }, { 7009, 0xddfb }, { 7022, 0xeffb }, - { 7036, 0xfe4f }, { 7048, 0xffb5 }, { 7061, 0xefe3 }, { 7073, 0xef7f }, - { 7087, 0xffff }, { 7103, 0xbf7d }, { 7116, 0xfc04 }, { 7123, 0xffdf }, - { 7138, 0xfeff }, { 7153, 0xfeff }, { 7168, 0xffaf }, { 7182, 0x822f }, - /* 0x6d00 */ - { 7189, 0xffff }, { 7205, 0xefc7 }, { 7217, 0xfff5 }, { 7231, 0xffff }, - { 7247, 0x4007 }, { 7251, 0xdf80 }, { 7259, 0xf7ff }, { 7274, 0xfff7 }, - { 7289, 0xffff }, { 7305, 0x01ff }, { 7314, 0xdc30 }, { 7321, 0xffbe }, - { 7335, 0xbff5 }, { 7348, 0xffff }, { 7364, 0xff7f }, { 7379, 0x7eff }, - /* 0x6e00 */ - { 7393, 0x843d }, { 7400, 0xbf20 }, { 7408, 0xffff }, { 7424, 0xff7f }, - { 7439, 0xeefb }, { 7452, 0xff7f }, { 7467, 0xcbff }, { 7480, 0x13de }, - { 7489, 0xeb40 }, { 7496, 0xffdd }, { 7510, 0xccff }, { 7522, 0xffff }, - { 7538, 0xffff }, { 7554, 0x3f7f }, { 7567, 0xfb04 }, { 7575, 0xfff6 }, - /* 0x6f00 */ - { 7589, 0xffff }, { 7605, 0xd7fc }, { 7617, 0xfeff }, { 7632, 0xffff }, - { 7648, 0xc01b }, { 7654, 0xfdff }, { 7669, 0xfedf }, { 7683, 0xffdd }, - { 7697, 0x7ff7 }, { 7711, 0xe0fd }, { 7721, 0xffff }, { 7737, 0xff7f }, - { 7752, 0xffdf }, { 7767, 0xff38 }, { 7778, 0xfbdf }, { 7792, 0xddd7 }, - /* 0x7000 */ - { 7804, 0xfefb }, { 7818, 0xfff2 }, { 7831, 0x9fdf }, { 7844, 0xdfbf }, - { 7858, 0x3f7f }, { 7871, 0xfdf7 }, { 7885, 0x9fff }, { 7899, 0xf7f3 }, - { 7912, 0xce7e }, { 7923, 0x877e }, { 7933, 0xfafb }, { 7946, 0x7fbb }, - { 7959, 0xfdf1 }, { 7971, 0xf7ff }, { 7986, 0x8017 }, { 7991, 0xfffb }, - /* 0x7100 */ - { 8006, 0x7e75 }, { 8017, 0xfe89 }, { 8027, 0xdb6f }, { 8039, 0x4c7f }, - { 8049, 0xfeff }, { 8064, 0xf75f }, { 8077, 0x5fff }, { 8091, 0x7def }, - { 8104, 0xd7f7 }, { 8117, 0xffd7 }, { 8131, 0xb7bf }, { 8144, 0xf7bf }, - { 8158, 0xcfff }, { 8172, 0xbf77 }, { 8185, 0x79f7 }, { 8197, 0xfb77 }, - /* 0x7200 */ - { 8210, 0xf6ef }, { 8223, 0xeef9 }, { 8235, 0x7fdc }, { 8247, 0xef61 }, - { 8257, 0x9fd7 }, { 8269, 0xffed }, { 8283, 0xd6cf }, { 8294, 0xfbdd }, - { 8307, 0xfbf7 }, { 8321, 0xedff }, { 8335, 0xf7fe }, { 8349, 0xa435 }, - { 8356, 0x7e7f }, { 8369, 0x97d7 }, { 8380, 0x0f5f }, { 8390, 0xffd8 }, - /* 0x7300 */ - { 8402, 0x9d97 }, { 8412, 0x7bcf }, { 8424, 0x7fec }, { 8436, 0xdfff }, - { 8451, 0xf73f }, { 8464, 0xef87 }, { 8475, 0xdfe7 }, { 8488, 0xfdff }, - { 8503, 0xdfff }, { 8518, 0xf1fc }, { 8529, 0x3ff7 }, { 8542, 0xdffc }, - { 8555, 0xffed }, { 8569, 0x7ffd }, { 8583, 0xefff }, { 8598, 0xfff8 }, - /* 0x7400 */ - { 8611, 0x3fff }, { 8625, 0xfef6 }, { 8638, 0xff7f }, { 8653, 0x97ff }, - { 8666, 0xefff }, { 8681, 0xfeff }, { 8696, 0xffbd }, { 8710, 0xf67f }, - { 8723, 0x3fef }, { 8736, 0xdfb5 }, { 8748, 0xaffb }, { 8761, 0xeff7 }, - { 8775, 0x9d2f }, { 8785, 0xfff9 }, { 8799, 0x53ff }, { 8811, 0xe9f7 }, - /* 0x7500 */ - { 8823, 0xf9bd }, { 8835, 0xf7ff }, { 8850, 0xff66 }, { 8862, 0xefbf }, - { 8876, 0xfdc5 }, { 8887, 0xbe3a }, { 8897, 0xfcfd }, { 8910, 0xe7c5 }, - { 8920, 0xfcd9 }, { 8931, 0x6737 }, { 8941, 0x0cbc }, { 8948, 0xff7f }, - { 8963, 0xfdbf }, { 8977, 0xffb7 }, { 8991, 0xa0df }, { 9000, 0xffff }, - /* 0x7600 */ - { 9016, 0xbf8f }, { 9028, 0xfe7b }, { 9041, 0xb3ff }, { 9054, 0x3d3f }, - { 9065, 0xf3cd }, { 9076, 0x97df }, { 9088, 0xf6f7 }, { 9101, 0xff7f }, - { 9116, 0xcfd6 }, { 9127, 0x7e6d }, { 9138, 0xec72 }, { 9147, 0xedb1 }, - { 9157, 0x777c }, { 9168, 0xfe5c }, { 9179, 0xf6fa }, { 9191, 0x5fbf }, - /* 0x7700 */ - { 9204, 0xdfba }, { 9216, 0xee2f }, { 9227, 0xabfd }, { 9239, 0x7ffe }, - { 9253, 0xfcf9 }, { 9265, 0xdf74 }, { 9276, 0xffef }, { 9291, 0xff84 }, - { 9301, 0xfbbf }, { 9315, 0xffaa }, { 9327, 0xbdaf }, { 9339, 0xfeff }, - { 9354, 0xfebc }, { 9366, 0x7fb9 }, { 9378, 0xf3ed }, { 9390, 0x7f9f }, - /* 0x7800 */ - { 9403, 0xf36c }, { 9413, 0xf11f }, { 9423, 0xffef }, { 9438, 0x33bf }, - { 9449, 0x7fbc }, { 9461, 0x701f }, { 9469, 0xff75 }, { 9482, 0xde03 }, - { 9490, 0xf3fb }, { 9503, 0xc7fa }, { 9514, 0xbfbf }, { 9528, 0x5f5f }, - { 9540, 0xffba }, { 9553, 0xedbf }, { 9566, 0xf7bf }, { 9580, 0xfebf }, - /* 0x7900 */ - { 9594, 0x5276 }, { 9602, 0x7a9f }, { 9613, 0xfffa }, { 9627, 0xff7e }, - { 9641, 0x9ff7 }, { 9654, 0xffff }, { 9670, 0x2fbf }, { 9682, 0xf61f }, - { 9693, 0xedcf }, { 9705, 0xbfff }, { 9720, 0x7ff7 }, { 9734, 0xefdf }, - { 9748, 0xfb73 }, { 9760, 0xf176 }, { 9770, 0x7edd }, { 9782, 0x0dd2 }, - /* 0x7a00 */ - { 9789, 0x3d7d }, { 9800, 0xdfbf }, { 9814, 0xed45 }, { 9823, 0xfe83 }, - { 9833, 0x7ff9 }, { 9846, 0x9dd0 }, { 9854, 0x7ba7 }, { 9865, 0xef73 }, - { 9877, 0x9ffb }, { 9890, 0xc3ff }, { 9902, 0xdf0d }, { 9912, 0xddff }, - { 9926, 0x8fbf }, { 9938, 0xbf0a }, { 9947, 0xeefd }, { 9960, 0xeec0 }, - /* 0x7b00 */ - { 9968, 0xdf73 }, { 9980, 0xef1f }, { 9992, 0xfffd }, { 10007, 0x0b3f }, - { 10016, 0xfffd }, { 10031, 0x0177 }, { 10038, 0xf2ff }, { 10051, 0x09ff }, - { 10061, 0xfdb4 }, { 10072, 0x3bf7 }, { 10084, 0xb01f }, { 10092, 0x43b6 }, - { 10100, 0xded3 }, { 10111, 0xff31 }, { 10122, 0x1fff }, { 10135, 0xff9f }, - /* 0x7c00 */ - { 10149, 0xfeef }, { 10163, 0xfa27 }, { 10173, 0x3fef }, { 10186, 0xfba9 }, - { 10197, 0x37bd }, { 10208, 0xbedb }, { 10220, 0xfef9 }, { 10233, 0xff3d }, - { 10246, 0x777b }, { 10258, 0xd1f6 }, { 10268, 0xd1ee }, { 10278, 0xff3e }, - { 10291, 0x7fac }, { 10302, 0xf6ff }, { 10316, 0xf5c5 }, { 10326, 0x7bff }, - /* 0x7d00 */ - { 10340, 0xffff }, { 10356, 0xffff }, { 10372, 0xdb27 }, { 10382, 0xff6f }, - { 10396, 0xe4ff }, { 10408, 0xfd7f }, { 10422, 0xefce }, { 10434, 0xbe0f }, - { 10444, 0xfb7b }, { 10457, 0xf0de }, { 10467, 0xffdf }, { 10482, 0xffbf }, - { 10497, 0xfef7 }, { 10511, 0xff9d }, { 10524, 0xd7fb }, { 10537, 0x6eff }, - /* 0x7e00 */ - { 10550, 0xff88 }, { 10560, 0xfcff }, { 10574, 0xeebf }, { 10587, 0xffff }, - { 10603, 0x13ff }, { 10614, 0xdfff }, { 10629, 0xffaf }, { 10643, 0xfffd }, - { 10658, 0xfdc7 }, { 10670, 0x9ffe }, { 10683, 0x1010 }, { 10685, 0x0400 }, - { 10686, 0x8080 }, { 10688, 0x8000 }, { 10689, 0x0000 }, { 10689, 0x0000 }, - /* 0x7f00 */ - { 10689, 0x0040 }, { 10690, 0x0000 }, { 10690, 0x0000 }, { 10690, 0xe7c0 }, - { 10698, 0xffbb }, { 10712, 0xf93f }, { 10724, 0x7feb }, { 10737, 0xffef }, - { 10752, 0xffe8 }, { 10764, 0x7cfe }, { 10776, 0xf3ff }, { 10790, 0xffff }, - { 10806, 0xfeaf }, { 10819, 0xf8b7 }, { 10830, 0xffef }, { 10845, 0xffbf }, - /* 0x8000 */ - { 10860, 0xf9ff }, { 10874, 0xfbf7 }, { 10888, 0xd773 }, { 10899, 0xfafb }, - { 10912, 0x85c8 }, { 10918, 0x7d57 }, { 10929, 0x90de }, { 10937, 0xe3ef }, - { 10949, 0x9ef5 }, { 10960, 0xbf6d }, { 10972, 0xeeae }, { 10983, 0x35f6 }, - { 10993, 0xf7fc }, { 11006, 0x7ff3 }, { 11019, 0xb27b }, { 11029, 0x7f7f }, - /* 0x8100 */ - { 11043, 0x57ef }, { 11055, 0xeff4 }, { 11067, 0xbebe }, { 11079, 0x6695 }, - { 11087, 0xfddc }, { 11099, 0x5e7f }, { 11111, 0xeaf7 }, { 11123, 0x97df }, - { 11135, 0xbfdd }, { 11148, 0xffa8 }, { 11159, 0x5fed }, { 11171, 0xfeff }, - { 11186, 0xb7ff }, { 11200, 0xefa7 }, { 11212, 0xf7ff }, { 11227, 0xdfdc }, - /* 0x8200 */ - { 11239, 0x3fb7 }, { 11251, 0xfd77 }, { 11264, 0xbf67 }, { 11276, 0xf7fc }, - { 11289, 0xcab5 }, { 11298, 0xdfff }, { 11313, 0xfb7e }, { 11326, 0xfff6 }, - { 11340, 0xecb9 }, { 11350, 0xef1f }, { 11362, 0xffff }, { 11378, 0xfffb }, - { 11393, 0x841d }, { 11399, 0xdbff }, { 11413, 0xfdff }, { 11428, 0xffff }, - /* 0x8300 */ - { 11444, 0x3bff }, { 11457, 0x7fc0 }, { 11466, 0xbff5 }, { 11479, 0xbffe }, - { 11493, 0xffbf }, { 11508, 0x00df }, { 11515, 0x804c }, { 11519, 0xfdf8 }, - { 11531, 0xffea }, { 11544, 0x7fff }, { 11559, 0xdffd }, { 11573, 0xe201 }, - { 11578, 0xffff }, { 11594, 0xfbfa }, { 11607, 0xffbf }, { 11622, 0xff7f }, - /* 0x8400 */ - { 11637, 0xfefa }, { 11650, 0x195f }, { 11659, 0xfa5b }, { 11670, 0xffff }, - { 11686, 0x7ffd }, { 11700, 0xffff }, { 11716, 0xfbff }, { 11731, 0xe7ff }, - { 11745, 0xe145 }, { 11752, 0xffdf }, { 11767, 0xff9f }, { 11781, 0xff57 }, - { 11794, 0xfef7 }, { 11808, 0x4cdf }, { 11818, 0xdfb6 }, { 11830, 0xffdf }, - /* 0x8500 */ - { 11845, 0xffed }, { 11859, 0xf7ff }, { 11874, 0xfffb }, { 11889, 0x691b }, - { 11897, 0x7fff }, { 11912, 0xeffe }, { 11926, 0xffff }, { 11942, 0x5feb }, - { 11954, 0xffff }, { 11970, 0xfff3 }, { 11984, 0x87df }, { 11995, 0xe7fb }, - { 12008, 0xebff }, { 12022, 0xf7e7 }, { 12035, 0xff7f }, { 12050, 0xffc7 }, - /* 0x8600 */ - { 12063, 0xbef7 }, { 12076, 0xdfd3 }, { 12088, 0xf7ff }, { 12103, 0xdf7e }, - { 12116, 0x79ed }, { 12127, 0xda7d }, { 12138, 0xffbe }, { 12152, 0x5e9f }, - { 12163, 0x7ce0 }, { 12171, 0x77ff }, { 12185, 0xa7bf }, { 12197, 0xffff }, - { 12213, 0x1bff }, { 12225, 0xffdb }, { 12239, 0xbf5c }, { 12250, 0x4fe0 }, - /* 0x8700 */ - { 12258, 0x7fff }, { 12273, 0x5f0e }, { 12282, 0x77ff }, { 12296, 0xddbf }, - { 12309, 0xf04f }, { 12318, 0xffff }, { 12334, 0xffff }, { 12350, 0x2ffb }, - { 12362, 0xbbfe }, { 12375, 0xfddf }, { 12389, 0xfe3c }, { 12400, 0xffff }, - { 12416, 0x5f7f }, { 12429, 0xffde }, { 12443, 0xfdff }, { 12458, 0xdefc }, - /* 0x8800 */ - { 12470, 0xbf7f }, { 12484, 0xbbfb }, { 12497, 0xffff }, { 12513, 0xfbef }, - { 12527, 0xfd7f }, { 12541, 0x6eec }, { 12551, 0xefbf }, { 12565, 0xf2f7 }, - { 12577, 0xfb9f }, { 12590, 0xdfef }, { 12604, 0x5d97 }, { 12614, 0xf7f6 }, - { 12627, 0xfea7 }, { 12639, 0xfff5 }, { 12653, 0xd9c2 }, { 12661, 0xffff }, - /* 0x8900 */ - { 12677, 0x5ee7 }, { 12688, 0xc7ff }, { 12701, 0xfefe }, { 12715, 0x79ef }, - { 12727, 0xbade }, { 12738, 0xffdf }, { 12753, 0xfe7f }, { 12767, 0xdede }, - { 12779, 0x8fef }, { 12791, 0xf9fa }, { 12803, 0xf6fe }, { 12816, 0xf6c4 }, - { 12825, 0x0043 }, { 12828, 0xbe7c }, { 12839, 0x3bff }, { 12852, 0xdddf }, - /* 0x8a00 */ - { 12865, 0xd59d }, { 12875, 0xf9ef }, { 12888, 0x3eac }, { 12897, 0xff53 }, - { 12909, 0xf773 }, { 12921, 0x4bf7 }, { 12932, 0x7bcf }, { 12944, 0xdeff }, - { 12958, 0xb8fe }, { 12969, 0x577f }, { 12981, 0x8ffb }, { 12993, 0xff55 }, - { 13005, 0xabfd }, { 13017, 0xfffe }, { 13032, 0xedd7 }, { 13044, 0xddff }, - /* 0x8b00 */ - { 13058, 0xfdf7 }, { 13072, 0xffff }, { 13088, 0xfdfd }, { 13102, 0xfeeb }, - { 13115, 0xffef }, { 13130, 0xf7ff }, { 13145, 0xbfed }, { 13158, 0xef91 }, - { 13168, 0x5d7f }, { 13180, 0xdf7d }, { 13193, 0x0001 }, { 13194, 0x4000 }, - { 13195, 0x0000 }, { 13195, 0x0000 }, { 13195, 0x0004 }, { 13196, 0x0000 }, - /* 0x8c00 */ - { 13196, 0x0000 }, { 13196, 0x0000 }, { 13196, 0x0000 }, { 13196, 0xfa80 }, - { 13203, 0xffee }, { 13217, 0xb4f3 }, { 13227, 0xbf76 }, { 13239, 0x2fef }, - { 13251, 0xb677 }, { 13262, 0xffbf }, { 13277, 0xbfbf }, { 13291, 0xfffd }, - { 13306, 0xb5bf }, { 13318, 0xfefe }, { 13332, 0x7fff }, { 13347, 0x7fbf }, - /* 0x8d00 */ - { 13361, 0xbffd }, { 13375, 0x3bff }, { 13388, 0x0000 }, { 13388, 0x0000 }, - { 13388, 0x0000 }, { 13388, 0x0000 }, { 13388, 0xfbd0 }, { 13398, 0x2fdd }, - { 13409, 0xf637 }, { 13420, 0x9a7f }, { 13431, 0xffeb }, { 13445, 0xd6fc }, - { 13456, 0xf9ef }, { 13469, 0xbffb }, { 13483, 0xdfdf }, { 13497, 0xf41f }, - /* 0x8e00 */ - { 13507, 0xe6ff }, { 13520, 0xffff }, { 13536, 0x6fff }, { 13550, 0xf77b }, - { 13563, 0xfff7 }, { 13578, 0xfef9 }, { 13591, 0xb7ff }, { 13605, 0x5dfe }, - { 13617, 0x7ff7 }, { 13631, 0xe5ff }, { 13644, 0x3ffb }, { 13657, 0x3645 }, - { 13664, 0xfe0d }, { 13674, 0xfd9e }, { 13686, 0xfbf7 }, { 13700, 0xdff6 }, - /* 0x8f00 */ - { 13713, 0x6fef }, { 13726, 0xffff }, { 13742, 0xf679 }, { 13753, 0xcbfd }, - { 13765, 0xefff }, { 13780, 0xffff }, { 13796, 0x40df }, { 13804, 0x0000 }, - { 13804, 0x0000 }, { 13804, 0x9808 }, { 13808, 0xe1e9 }, { 13817, 0xdfff }, - { 13832, 0xfe76 }, { 13844, 0x04ff }, { 13853, 0x6d7f }, { 13865, 0xfff1 }, - /* 0x9000 */ - { 13878, 0xb97f }, { 13890, 0xfef7 }, { 13904, 0xe01f }, { 13912, 0xf1fe }, - { 13924, 0xfe96 }, { 13935, 0x7b7f }, { 13948, 0xfb9f }, { 13961, 0xfffd }, - { 13976, 0xadff }, { 13989, 0xcbb3 }, { 13999, 0xc5ef }, { 14010, 0xe97f }, - { 14022, 0x4dba }, { 14031, 0xbff0 }, { 14042, 0xbf3f }, { 14055, 0xfe3f }, - /* 0x9100 */ - { 14068, 0xebff }, { 14082, 0xffd7 }, { 14096, 0xffdf }, { 14111, 0xcf7f }, - { 14124, 0xfffb }, { 14139, 0xd7ef }, { 14152, 0xd7bf }, { 14165, 0x17fd }, - { 14176, 0xfeff }, { 14191, 0xfe0f }, { 14202, 0xffaf }, { 14216, 0x7eff }, - { 14230, 0xfaff }, { 14244, 0xb7fb }, { 14257, 0x7ffc }, { 14270, 0xe7fa }, - /* 0x9200 */ - { 14282, 0xf7ff }, { 14297, 0x56ff }, { 14309, 0x6dfa }, { 14320, 0xf7ff }, - { 14335, 0xff73 }, { 14348, 0xedff }, { 14362, 0xf8ff }, { 14375, 0xffc5 }, - { 14387, 0xffff }, { 14403, 0x3ffa }, { 14415, 0x5fff }, { 14429, 0xdefe }, - { 14442, 0xffff }, { 14458, 0xebbf }, { 14471, 0xdffb }, { 14485, 0xffdf }, - /* 0x9300 */ - { 14500, 0xfbdf }, { 14514, 0xef7d }, { 14527, 0xffff }, { 14543, 0x137b }, - { 14552, 0xffff }, { 14568, 0xdff7 }, { 14582, 0x7fff }, { 14597, 0x7ffb }, - { 14611, 0xf7ff }, { 14626, 0xfff7 }, { 14641, 0xf7ff }, { 14656, 0xa9bf }, - { 14667, 0xfddd }, { 14680, 0xffff }, { 14696, 0x51df }, { 14706, 0xfffb }, - /* 0x9400 */ - { 14721, 0xffdb }, { 14735, 0x2bff }, { 14747, 0x7ff1 }, { 14759, 0xffef }, - { 14774, 0xbffd }, { 14788, 0x69b7 }, { 14798, 0xffbd }, { 14812, 0xfbff }, - { 14827, 0x002f }, { 14832, 0x8000 }, { 14833, 0x0004 }, { 14834, 0x0000 }, - { 14834, 0x000a }, { 14836, 0x1000 }, { 14837, 0x0000 }, { 14837, 0x0040 }, - /* 0x9500 */ - { 14838, 0x0000 }, { 14838, 0x0000 }, { 14838, 0x2000 }, { 14839, 0x0000 }, - { 14839, 0x0080 }, { 14840, 0x0000 }, { 14840, 0x0000 }, { 14840, 0xbd80 }, - { 14847, 0xfb6d }, { 14859, 0xdbdf }, { 14872, 0x7fff }, { 14887, 0xfee3 }, - { 14899, 0x3fe9 }, { 14910, 0xdc7f }, { 14922, 0x013f }, { 14929, 0x0010 }, - /* 0x9600 */ - { 14930, 0x0000 }, { 14930, 0x7000 }, { 14933, 0xf51f }, { 14944, 0xbf0f }, - { 14955, 0xfc3f }, { 14967, 0xf95b }, { 14978, 0xbe1e }, { 14988, 0x79ff }, - { 15001, 0xeffb }, { 15015, 0x5bfe }, { 15027, 0x57be }, { 15038, 0xbb5b }, - { 15049, 0x7fff }, { 15064, 0xfffc }, { 15078, 0x872e }, { 15086, 0xaff7 }, - /* 0x9700 */ - { 15099, 0xebfd }, { 15112, 0xfb4f }, { 15124, 0xdfff }, { 15139, 0xe767 }, - { 15150, 0x0bdf }, { 15160, 0xfde6 }, { 15172, 0x7747 }, { 15182, 0xfddf }, - { 15196, 0xefbf }, { 15210, 0xff90 }, { 15220, 0x7d7f }, { 15233, 0xefde }, - { 15246, 0xfbff }, { 15261, 0xf3fd }, { 15274, 0x606b }, { 15281, 0xef6f }, - /* 0x9800 */ - { 15294, 0xf5ff }, { 15308, 0xf9ff }, { 15322, 0xebdb }, { 15334, 0x0bbd }, - { 15343, 0xfffa }, { 15357, 0xfb8f }, { 15369, 0x9ffd }, { 15382, 0x003f }, - { 15388, 0x0000 }, { 15388, 0x0000 }, { 15388, 0xf300 }, { 15394, 0xffde }, - { 15408, 0x5fdf }, { 15421, 0xd800 }, { 15425, 0xbeef }, { 15438, 0x7676 }, - /* 0x9900 */ - { 15448, 0x57ad }, { 15458, 0xdfff }, { 15473, 0xffb2 }, { 15485, 0xffaf }, - { 15499, 0x7faf }, { 15512, 0xfbff }, { 15527, 0x000e }, { 15530, 0x0000 }, - { 15530, 0x0000 }, { 15530, 0x7bc0 }, { 15538, 0xfdfa }, { 15551, 0x3f3f }, - { 15563, 0xfabe }, { 15575, 0xbfff }, { 15590, 0x76ff }, { 15603, 0xfff3 }, - /* 0x9a00 */ - { 15617, 0xfefe }, { 15631, 0xfe73 }, { 15643, 0xfeff }, { 15658, 0xfff7 }, - { 15673, 0xf77f }, { 15687, 0xdffd }, { 15701, 0x1ffd }, { 15713, 0x0000 }, - { 15713, 0x8000 }, { 15714, 0x0000 }, { 15714, 0xa900 }, { 15718, 0xffdf }, - { 15733, 0xa4c7 }, { 15741, 0x91ff }, { 15752, 0xf8cf }, { 15763, 0xfede }, - /* 0x9b00 */ - { 15776, 0xff7e }, { 15790, 0xc7f7 }, { 15802, 0xefbd }, { 15815, 0xdebe }, - { 15827, 0xfd7f }, { 15841, 0x8f77 }, { 15852, 0x93d3 }, { 15861, 0xfcf3 }, - { 15873, 0xe9ef }, { 15885, 0xecaf }, { 15896, 0xed77 }, { 15908, 0xa361 }, - { 15915, 0x87db }, { 15925, 0x7ef8 }, { 15936, 0x3ff7 }, { 15949, 0xa193 }, - /* 0x9c00 */ - { 15956, 0x7fe4 }, { 15967, 0xb8bd }, { 15977, 0xbb7b }, { 15989, 0xfefe }, - { 16003, 0xff73 }, { 16016, 0xe3fd }, { 16028, 0x61cd }, { 16036, 0x1fbe }, - { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, - { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x26e0 }, { 16053, 0xbefe }, - /* 0x9d00 */ - { 16066, 0x13fd }, { 16076, 0xebf5 }, { 16088, 0xe36f }, { 16099, 0xebdb }, - { 16111, 0xde3f }, { 16123, 0xffdf }, { 16138, 0xff83 }, { 16149, 0xfbbf }, - { 16163, 0x1fff }, { 16176, 0xffdd }, { 16190, 0xbfff }, { 16205, 0xfffe }, - { 16220, 0xffbf }, { 16235, 0xffff }, { 16251, 0xfb7e }, { 16264, 0xfffd }, - /* 0x9e00 */ - { 16279, 0xfeff }, { 16294, 0xffbf }, { 16309, 0x0000 }, { 16309, 0x0000 }, - { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0xbe20 }, - { 16316, 0x7fff }, { 16331, 0xffff }, { 16347, 0xfff7 }, { 16362, 0xf8f3 }, - { 16373, 0xf1df }, { 16385, 0xfd7b }, { 16398, 0xe9f5 }, { 16409, 0xffff }, - /* 0x9f00 */ - { 16425, 0xc7c7 }, { 16435, 0x5fed }, { 16447, 0xfffd }, { 16462, 0x6bff }, - { 16475, 0xffff }, { 16491, 0xfffd }, { 16506, 0xdeff }, { 16520, 0xcff7 }, - { 16533, 0x6000 }, { 16535, 0x9337 }, { 16544, 0x0035 }, -}; -static const Summary16 big5hkscs_uni2indx_pagee0[419] = { - /* 0xe000 */ - { 16548, 0xffff }, { 16564, 0xffff }, { 16580, 0xffff }, { 16596, 0xffff }, - { 16612, 0xffff }, { 16628, 0xffff }, { 16644, 0xffff }, { 16660, 0xffff }, - { 16676, 0xffff }, { 16692, 0xffff }, { 16708, 0xffff }, { 16724, 0xffff }, - { 16740, 0xffff }, { 16756, 0xffff }, { 16772, 0xffff }, { 16788, 0xffff }, - /* 0xe100 */ - { 16804, 0xffff }, { 16820, 0xffff }, { 16836, 0xffff }, { 16852, 0xffff }, - { 16868, 0xffff }, { 16884, 0xffff }, { 16900, 0xffff }, { 16916, 0xffff }, - { 16932, 0xffff }, { 16948, 0xffff }, { 16964, 0xffff }, { 16980, 0xffff }, - { 16996, 0xffff }, { 17012, 0xffff }, { 17028, 0xffff }, { 17044, 0xffff }, - /* 0xe200 */ - { 17060, 0xffff }, { 17076, 0xffff }, { 17092, 0xffff }, { 17108, 0xffff }, - { 17124, 0xffff }, { 17140, 0xffff }, { 17156, 0xffff }, { 17172, 0xffff }, - { 17188, 0xffff }, { 17204, 0xffff }, { 17220, 0xffff }, { 17236, 0xffff }, - { 17252, 0xffff }, { 17268, 0xffff }, { 17284, 0xffff }, { 17300, 0xffff }, - /* 0xe300 */ - { 17316, 0xffff }, { 17332, 0xffff }, { 17348, 0xffff }, { 17364, 0xffff }, - { 17380, 0xffff }, { 17396, 0xffff }, { 17412, 0xffff }, { 17428, 0xffff }, - { 17444, 0xffff }, { 17460, 0xffff }, { 17476, 0xffff }, { 17492, 0xffff }, - { 17508, 0xffff }, { 17524, 0xffff }, { 17540, 0xffff }, { 17556, 0xffff }, - /* 0xe400 */ - { 17572, 0xffff }, { 17588, 0xffff }, { 17604, 0xffff }, { 17620, 0xffff }, - { 17636, 0xffff }, { 17652, 0xffff }, { 17668, 0xffff }, { 17684, 0xffff }, - { 17700, 0xffff }, { 17716, 0xffff }, { 17732, 0xffff }, { 17748, 0xffff }, - { 17764, 0xffff }, { 17780, 0xffff }, { 17796, 0xffff }, { 17812, 0xffff }, - /* 0xe500 */ - { 17828, 0xffff }, { 17844, 0xffff }, { 17860, 0xffff }, { 17876, 0xffff }, - { 17892, 0xffff }, { 17908, 0xffff }, { 17924, 0xffff }, { 17940, 0xffff }, - { 17956, 0xffff }, { 17972, 0xffff }, { 17988, 0xffff }, { 18004, 0xffff }, - { 18020, 0xffff }, { 18036, 0xffff }, { 18052, 0xffff }, { 18068, 0xffff }, - /* 0xe600 */ - { 18084, 0xffff }, { 18100, 0xffff }, { 18116, 0xffff }, { 18132, 0xffff }, - { 18148, 0xffff }, { 18164, 0xffff }, { 18180, 0xffff }, { 18196, 0xffff }, - { 18212, 0xffff }, { 18228, 0xffff }, { 18244, 0xffff }, { 18260, 0xffff }, - { 18276, 0xffff }, { 18292, 0xffff }, { 18308, 0xffff }, { 18324, 0xffff }, - /* 0xe700 */ - { 18340, 0xffff }, { 18356, 0xffff }, { 18372, 0xffff }, { 18388, 0xffff }, - { 18404, 0xffff }, { 18420, 0xffff }, { 18436, 0xffff }, { 18452, 0xffff }, - { 18468, 0xffff }, { 18484, 0xffff }, { 18500, 0xffff }, { 18516, 0xffff }, - { 18532, 0xffff }, { 18548, 0xffff }, { 18564, 0xffff }, { 18580, 0xffff }, - /* 0xe800 */ - { 18596, 0xffff }, { 18612, 0xffff }, { 18628, 0xffff }, { 18644, 0xffff }, - { 18660, 0xffff }, { 18676, 0xffff }, { 18692, 0xffff }, { 18708, 0xffff }, - { 18724, 0xffff }, { 18740, 0xffff }, { 18756, 0xffff }, { 18772, 0xffff }, - { 18788, 0xffff }, { 18804, 0xffff }, { 18820, 0xffff }, { 18836, 0xffff }, - /* 0xe900 */ - { 18852, 0xffff }, { 18868, 0xffff }, { 18884, 0xffff }, { 18900, 0xffff }, - { 18916, 0xffff }, { 18932, 0xffff }, { 18948, 0xffff }, { 18964, 0xffff }, - { 18980, 0xffff }, { 18996, 0xffff }, { 19012, 0xffff }, { 19028, 0xffff }, - { 19044, 0xffff }, { 19060, 0xffff }, { 19076, 0xffff }, { 19092, 0xffff }, - /* 0xea00 */ - { 19108, 0xffff }, { 19124, 0xffff }, { 19140, 0xffff }, { 19156, 0xffff }, - { 19172, 0xffff }, { 19188, 0xffff }, { 19204, 0xffff }, { 19220, 0xffff }, - { 19236, 0xffff }, { 19252, 0xffff }, { 19268, 0xffff }, { 19284, 0xffff }, - { 19300, 0xffff }, { 19316, 0xffff }, { 19332, 0xffff }, { 19348, 0xffff }, - /* 0xeb00 */ - { 19364, 0xffff }, { 19380, 0xffff }, { 19396, 0xffff }, { 19412, 0xffff }, - { 19428, 0xffff }, { 19444, 0xffff }, { 19460, 0xffff }, { 19476, 0xffff }, - { 19492, 0xffff }, { 19508, 0xffff }, { 19524, 0xffff }, { 19540, 0xffff }, - { 19556, 0xffff }, { 19572, 0xffff }, { 19588, 0xffff }, { 19604, 0xffff }, - /* 0xec00 */ - { 19620, 0xffff }, { 19636, 0xffff }, { 19652, 0xffff }, { 19668, 0xffff }, - { 19684, 0xffff }, { 19700, 0xffff }, { 19716, 0xffff }, { 19732, 0xffff }, - { 19748, 0xffff }, { 19764, 0xffff }, { 19780, 0xffff }, { 19796, 0xffff }, - { 19812, 0xffff }, { 19828, 0xffff }, { 19844, 0xffff }, { 19860, 0xffff }, - /* 0xed00 */ - { 19876, 0xffff }, { 19892, 0xffff }, { 19908, 0xffff }, { 19924, 0xffff }, - { 19940, 0xffff }, { 19956, 0xffff }, { 19972, 0xffff }, { 19988, 0xffff }, - { 20004, 0xffff }, { 20020, 0xffff }, { 20036, 0xffff }, { 20052, 0xffff }, - { 20068, 0xffff }, { 20084, 0xffff }, { 20100, 0xffff }, { 20116, 0xffff }, - /* 0xee00 */ - { 20132, 0xffff }, { 20148, 0xffff }, { 20164, 0xffff }, { 20180, 0xffff }, - { 20196, 0xffff }, { 20212, 0xffff }, { 20228, 0xffff }, { 20244, 0xffff }, - { 20260, 0xffff }, { 20276, 0xffff }, { 20292, 0xffff }, { 20308, 0xffff }, - { 20324, 0xffff }, { 20340, 0xffff }, { 20356, 0xffff }, { 20372, 0xffff }, - /* 0xef00 */ - { 20388, 0xffff }, { 20404, 0xffff }, { 20420, 0xffff }, { 20436, 0xffff }, - { 20452, 0xffff }, { 20468, 0xffff }, { 20484, 0xffff }, { 20500, 0xffff }, - { 20516, 0xffff }, { 20532, 0xffff }, { 20548, 0xffff }, { 20564, 0xffff }, - { 20580, 0xffff }, { 20596, 0xffff }, { 20612, 0xffff }, { 20628, 0xffff }, - /* 0xf000 */ - { 20644, 0xffff }, { 20660, 0xffff }, { 20676, 0xffff }, { 20692, 0xffff }, - { 20708, 0xffff }, { 20724, 0xffff }, { 20740, 0xffff }, { 20756, 0xffff }, - { 20772, 0xffff }, { 20788, 0xffff }, { 20804, 0xffff }, { 20820, 0xffff }, - { 20836, 0xffff }, { 20852, 0xffff }, { 20868, 0xffff }, { 20884, 0xffff }, - /* 0xf100 */ - { 20900, 0xffff }, { 20916, 0xffff }, { 20932, 0xffff }, { 20948, 0xffff }, - { 20964, 0xffff }, { 20980, 0xffff }, { 20996, 0xffff }, { 21012, 0xffff }, - { 21028, 0xffff }, { 21044, 0xffff }, { 21060, 0xffff }, { 21076, 0xffff }, - { 21092, 0xffff }, { 21108, 0xffff }, { 21124, 0xffff }, { 21140, 0xffff }, - /* 0xf200 */ - { 21156, 0xffff }, { 21172, 0xffff }, { 21188, 0xffff }, { 21204, 0xffff }, - { 21220, 0xffff }, { 21236, 0xffff }, { 21252, 0xffff }, { 21268, 0xffff }, - { 21284, 0xffff }, { 21300, 0xffff }, { 21316, 0xffff }, { 21332, 0xffff }, - { 21348, 0xffff }, { 21364, 0xffff }, { 21380, 0xffff }, { 21396, 0xffff }, - /* 0xf300 */ - { 21412, 0xffff }, { 21428, 0xffff }, { 21444, 0xffff }, { 21460, 0xffff }, - { 21476, 0xffff }, { 21492, 0xffff }, { 21508, 0xffff }, { 21524, 0xffff }, - { 21540, 0xffff }, { 21556, 0xffff }, { 21572, 0xffff }, { 21588, 0xffff }, - { 21604, 0xffff }, { 21620, 0xffff }, { 21636, 0xffff }, { 21652, 0xffff }, - /* 0xf400 */ - { 21668, 0xffff }, { 21684, 0xffff }, { 21700, 0xffff }, { 21716, 0xffff }, - { 21732, 0xffff }, { 21748, 0xffff }, { 21764, 0xffff }, { 21780, 0xffff }, - { 21796, 0xffff }, { 21812, 0xffff }, { 21828, 0xffff }, { 21844, 0xffff }, - { 21860, 0xffff }, { 21876, 0xffff }, { 21892, 0xffff }, { 21908, 0xffff }, - /* 0xf500 */ - { 21924, 0xffff }, { 21940, 0xffff }, { 21956, 0xffff }, { 21972, 0xffff }, - { 21988, 0xffff }, { 22004, 0xffff }, { 22020, 0xffff }, { 22036, 0xffff }, - { 22052, 0xffff }, { 22068, 0xffff }, { 22084, 0xffff }, { 22100, 0xffff }, - { 22116, 0xffff }, { 22132, 0xffff }, { 22148, 0xffff }, { 22164, 0xffff }, - /* 0xf600 */ - { 22180, 0xffff }, { 22196, 0xffff }, { 22212, 0xffff }, { 22228, 0xffff }, - { 22244, 0xffff }, { 22260, 0xffff }, { 22276, 0xffff }, { 22292, 0xffff }, - { 22308, 0xffff }, { 22324, 0xffff }, { 22340, 0xffff }, { 22356, 0xffff }, - { 22372, 0xffff }, { 22388, 0xffff }, { 22404, 0xffff }, { 22420, 0xffff }, - /* 0xf700 */ - { 22436, 0xffff }, { 22452, 0xffff }, { 22468, 0xffff }, { 22484, 0xffff }, - { 22500, 0xffff }, { 22516, 0xffff }, { 22532, 0xffff }, { 22548, 0xffff }, - { 22564, 0xffff }, { 22580, 0xffff }, { 22596, 0xffff }, { 22612, 0xffff }, - { 22628, 0xffff }, { 22644, 0xffff }, { 22660, 0xffff }, { 22676, 0xffff }, - /* 0xf800 */ - { 22692, 0xffff }, { 22708, 0xffff }, { 22724, 0xffff }, { 22740, 0xffff }, - { 22756, 0x01ff }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, - { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, - { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, - /* 0xf900 */ - { 22765, 0xffff }, { 22781, 0xffff }, { 22797, 0xefff }, { 22812, 0xffff }, - { 22828, 0xffff }, { 22844, 0xffff }, { 22860, 0xffff }, { 22876, 0xfdff }, - { 22891, 0xffff }, { 22907, 0xffdf }, { 22922, 0xffff }, { 22938, 0xffff }, - { 22954, 0xffff }, { 22970, 0xffff }, { 22986, 0xff7f }, { 23001, 0xfffd }, - /* 0xfa00 */ - { 23016, 0x3fff }, { 23030, 0x7ee5 }, { 23041, 0x3c64 }, -}; -static const Summary16 big5hkscs_uni2indx_pagefe[31] = { - /* 0xfe00 */ - { 23048, 0x0000 }, { 23048, 0x0000 }, { 23048, 0x0000 }, { 23048, 0xfffb }, - { 23063, 0xfe1f }, { 23075, 0xfef7 }, { 23089, 0x0f7f }, { 23100, 0x0000 }, - { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, - { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, - /* 0xff00 */ - { 23100, 0xfffe }, { 23115, 0xffff }, { 23131, 0xffff }, { 23147, 0xffff }, - { 23163, 0xffff }, { 23179, 0x7fff }, { 23194, 0x0010 }, { 23195, 0x0000 }, - { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, - { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x203f }, -}; - -static int -big5hkscs_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - const Summary16 *summary = NULL; - if (wc >= 0x0000 && wc < 0x0100) - summary = &big5hkscs_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x0200 && wc < 0x03d0) - summary = &big5hkscs_uni2indx_page02[(wc>>4)-0x020]; - else if (wc >= 0x2000 && wc < 0x22c0) - summary = &big5hkscs_uni2indx_page20[(wc>>4)-0x200]; - else if (wc >= 0x2500 && wc < 0x2650) - summary = &big5hkscs_uni2indx_page25[(wc>>4)-0x250]; - else if (wc >= 0x3000 && wc < 0x33e0) - summary = &big5hkscs_uni2indx_page30[(wc>>4)-0x300]; - else if (wc >= 0x4e00 && wc < 0x9fb0) - summary = &big5hkscs_uni2indx_page4e[(wc>>4)-0x4e0]; - else if (wc >= 0xe000 && wc < 0xfa30) - summary = &big5hkscs_uni2indx_pagee0[(wc>>4)-0xe00]; - else if (wc >= 0xfe00 && wc < 0xfff0) - summary = &big5hkscs_uni2indx_pagefe[(wc>>4)-0xfe0]; - if (summary) { - unsigned short used = summary->used; - unsigned int i = wc & 0x0f; - if (used & ((unsigned short) 1 << i)) { - unsigned short c; - /* Keep in `used' only the bits 0..i-1. */ - used &= ((unsigned short) 1 << i) - 1; - /* Add `summary->indx' and the number of bits set in `used'. */ - used = (used & 0x5555) + ((used & 0xaaaa) >> 1); - used = (used & 0x3333) + ((used & 0xcccc) >> 2); - used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); - used = (used & 0x00ff) + (used >> 8); - c = big5hkscs_2charset[summary->indx + used]; - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} - diff --git a/nx-X11/lib/X11/lcUniConv/cp1133.h b/nx-X11/lib/X11/lcUniConv/cp1133.h deleted file mode 100644 index cf79b7aa1..000000000 --- a/nx-X11/lib/X11/lcUniConv/cp1133.h +++ /dev/null @@ -1,91 +0,0 @@ - -/* - * IBM-CP1133 - */ - -static const unsigned short cp1133_2uni_1[64] = { - /* 0xa0 */ - 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, - 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, - /* 0xb0 */ - 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, - 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, - /* 0xc0 */ - 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, - 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, - /* 0xd0 */ - 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, - 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, -}; -static const unsigned short cp1133_2uni_2[16] = { - /* 0xf0 */ - 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, - 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, -}; - -static int -cp1133_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) { - *pwc = (ucs4_t) c; - return 1; - } - else if (c < 0xe0) { - unsigned short wc = cp1133_2uni_1[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - else if (c < 0xf0) { - } - else { - unsigned short wc = cp1133_2uni_2[c-0xf0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char cp1133_page00[16] = { - 0xa0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ -}; -static const unsigned char cp1133_page0e[96] = { - 0x00, 0xa1, 0xa2, 0x00, 0xa3, 0x00, 0x00, 0xa4, /* 0x80-0x87 */ - 0xa5, 0x00, 0xa7, 0x00, 0x00, 0xa8, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x00, 0x00, 0xa9, 0xaa, 0xab, 0xac, /* 0x90-0x97 */ - 0x00, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, /* 0x98-0x9f */ - 0x00, 0xb4, 0xb5, 0xb6, 0x00, 0xb7, 0x00, 0xb8, /* 0xa0-0xa7 */ - 0x00, 0x00, 0xa6, 0xb9, 0x00, 0xba, 0xbb, 0xbf, /* 0xa8-0xaf */ - 0xc0, 0xca, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, /* 0xb0-0xb7 */ - 0xc7, 0xc8, 0x00, 0xcb, 0xc9, 0xcc, 0x00, 0x00, /* 0xb8-0xbf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xdb, 0x00, /* 0xc0-0xc7 */ - 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0x00, 0x00, /* 0xc8-0xcf */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ - 0xf8, 0xf9, 0x00, 0x00, 0xdd, 0xde, 0x00, 0x00, /* 0xd8-0xdf */ -}; - -static int -cp1133_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00b0) - c = cp1133_page00[wc-0x00a0]; - else if (wc >= 0x0e80 && wc < 0x0ee0) - c = cp1133_page0e[wc-0x0e80]; - else if (wc == 0x20ad) - c = 0xdf; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/cp1251.h b/nx-X11/lib/X11/lcUniConv/cp1251.h deleted file mode 100644 index 8c0847a0c..000000000 --- a/nx-X11/lib/X11/lcUniConv/cp1251.h +++ /dev/null @@ -1,112 +0,0 @@ - -/* - * CP1251 - */ - -static const unsigned short cp1251_2uni[128] = { - /* 0x80 */ - 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, - 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, - /* 0x90 */ - 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, - /* 0xa0 */ - 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, - 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, - 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, - /* 0xc0 */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - /* 0xd0 */ - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - /* 0xe0 */ - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - /* 0xf0 */ - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, -}; - -static int -cp1251_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = cp1251_2uni[c-0x80]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char cp1251_page00[32] = { - 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ -}; -static const unsigned char cp1251_page04[152] = { - 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ - 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ - 0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ - 0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ -}; -static const unsigned char cp1251_page20[48] = { - 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ - 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ -}; - -static int -cp1251_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00c0) - c = cp1251_page00[wc-0x00a0]; - else if (wc >= 0x0400 && wc < 0x0498) - c = cp1251_page04[wc-0x0400]; - else if (wc >= 0x2010 && wc < 0x2040) - c = cp1251_page20[wc-0x2010]; - else if (wc == 0x20ac) - c = 0x88; - else if (wc == 0x2116) - c = 0xb9; - else if (wc == 0x2122) - c = 0x99; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/cp1255.h b/nx-X11/lib/X11/lcUniConv/cp1255.h deleted file mode 100644 index 61b2b59d7..000000000 --- a/nx-X11/lib/X11/lcUniConv/cp1255.h +++ /dev/null @@ -1,120 +0,0 @@ - -/* - * CP1255 - */ - -static const unsigned short cp1255_2uni[128] = { - /* 0x80 */ - 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x90 */ - 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa0 */ - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, - /* 0xc0 */ - 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, - 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, - /* 0xd0 */ - 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, - 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xe0 */ - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, - /* 0xf0 */ - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, - 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, -}; - -static int -cp1255_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = cp1255_2uni[c-0x80]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char cp1255_page00[88] = { - 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ -}; -static const unsigned char cp1255_page02[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ -}; -static const unsigned char cp1255_page05[72] = { - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xb0-0xb7 */ - 0xc8, 0xc9, 0x00, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xb8-0xbf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ - 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ -}; -static const unsigned char cp1255_page20[56] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ - 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ -}; - -static int -cp1255_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00f8) - c = cp1255_page00[wc-0x00a0]; - else if (wc == 0x0192) - c = 0x83; - else if (wc >= 0x02c0 && wc < 0x02e0) - c = cp1255_page02[wc-0x02c0]; - else if (wc >= 0x05b0 && wc < 0x05f8) - c = cp1255_page05[wc-0x05b0]; - else if (wc >= 0x2008 && wc < 0x2040) - c = cp1255_page20[wc-0x2008]; - else if (wc == 0x20aa) - c = 0xa4; - else if (wc == 0x20ac) - c = 0x80; - else if (wc == 0x2122) - c = 0x99; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/cp1256.h b/nx-X11/lib/X11/lcUniConv/cp1256.h deleted file mode 100644 index 72284f4c1..000000000 --- a/nx-X11/lib/X11/lcUniConv/cp1256.h +++ /dev/null @@ -1,134 +0,0 @@ - -/* - * CP1256 - */ - -static const unsigned short cp1256_2uni[128] = { - /* 0x80 */ - 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, - /* 0x90 */ - 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, - /* 0xa0 */ - 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, - /* 0xc0 */ - 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, - /* 0xd0 */ - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, - 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, - /* 0xe0 */ - 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, - 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, -}; - -static int -cp1256_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) cp1256_2uni[c-0x80]; - return 1; -} - -static const unsigned char cp1256_page00[96] = { - 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0xe0, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0xf9, 0x00, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ -}; -static const unsigned char cp1256_page01[72] = { - 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ -}; -static const unsigned char cp1256_page06[208] = { - 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ - 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, /* 0x30-0x37 */ - 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0xdc, 0xdd, 0xde, 0xdf, 0xe1, 0xe3, 0xe4, 0xe5, /* 0x40-0x47 */ - 0xe6, 0xec, 0xed, 0xf0, 0xf1, 0xf2, 0xf3, 0xf5, /* 0x48-0x4f */ - 0xf6, 0xf8, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, /* 0x80-0x87 */ - 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0xa8-0xaf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xb8-0xbf */ - 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ -}; -static const unsigned char cp1256_page20[56] = { - 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0xfd, 0xfe, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ - 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ -}; - -static int -cp1256_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0100) - c = cp1256_page00[wc-0x00a0]; - else if (wc >= 0x0150 && wc < 0x0198) - c = cp1256_page01[wc-0x0150]; - else if (wc == 0x02c6) - c = 0x88; - else if (wc >= 0x0608 && wc < 0x06d8) - c = cp1256_page06[wc-0x0608]; - else if (wc >= 0x2008 && wc < 0x2040) - c = cp1256_page20[wc-0x2008]; - else if (wc == 0x20ac) - c = 0x80; - else if (wc == 0x2122) - c = 0x99; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/gb2312.h b/nx-X11/lib/X11/lcUniConv/gb2312.h deleted file mode 100644 index 2eec308d2..000000000 --- a/nx-X11/lib/X11/lcUniConv/gb2312.h +++ /dev/null @@ -1,2552 +0,0 @@ - -/* - * GB2312.1980-0 - */ - -static const unsigned short gb2312_2uni_page21[831] = { - /* 0x21 */ - 0x3000, 0x3001, 0x3002, 0x30fb, 0x02c9, 0x02c7, 0x00a8, 0x3003, - 0x3005, 0x2015, 0xff5e, 0x2016, 0x2026, 0x2018, 0x2019, 0x201c, - 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, - 0x300d, 0x300e, 0x300f, 0x3016, 0x3017, 0x3010, 0x3011, 0x00b1, - 0x00d7, 0x00f7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220f, 0x222a, - 0x2229, 0x2208, 0x2237, 0x221a, 0x22a5, 0x2225, 0x2220, 0x2312, - 0x2299, 0x222b, 0x222e, 0x2261, 0x224c, 0x2248, 0x223d, 0x221d, - 0x2260, 0x226e, 0x226f, 0x2264, 0x2265, 0x221e, 0x2235, 0x2234, - 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xff04, 0x00a4, - 0xffe0, 0xffe1, 0x2030, 0x00a7, 0x2116, 0x2606, 0x2605, 0x25cb, - 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, - 0x203b, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, - /* 0x22 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f, - 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, 0x2497, - 0x2498, 0x2499, 0x249a, 0x249b, 0x2474, 0x2475, 0x2476, 0x2477, - 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, - 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, 0x2487, - 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, - 0x2468, 0x2469, 0xfffd, 0xfffd, 0x3220, 0x3221, 0x3222, 0x3223, - 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0xfffd, 0xfffd, - 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, - 0x2168, 0x2169, 0x216a, 0x216b, 0xfffd, 0xfffd, - /* 0x23 */ - 0xff01, 0xff02, 0xff03, 0xffe5, 0xff05, 0xff06, 0xff07, 0xff08, - 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, - 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, - 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, - 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, - 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, - 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, - 0xff39, 0xff3a, 0xff3b, 0xff3c, 0xff3d, 0xff3e, 0xff3f, 0xff40, - 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, - 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, - 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, - 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, - /* 0x24 */ - 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, - 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, - 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, - 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, - 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, - 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, - 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, - 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, - 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, - 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, - 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x25 */ - 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, - 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, - 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, - 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, - 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, - 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, - 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, - 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, - 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, - 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, - 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x26 */ - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, - 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, - 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, - 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, - 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x27 */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, - 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, - 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, - 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, - 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, - 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, - 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x28 */ - 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0113, 0x00e9, 0x011b, 0x00e8, - 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, - 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, - 0x00fc, 0x00ea, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3105, 0x3106, 0x3107, 0x3108, - 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, - 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, - 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, - 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, - 0x3129, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x29 */ - 0xfffd, 0xfffd, 0xfffd, 0x2500, 0x2501, 0x2502, 0x2503, 0x2504, - 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250a, 0x250b, 0x250c, - 0x250d, 0x250e, 0x250f, 0x2510, 0x2511, 0x2512, 0x2513, 0x2514, - 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251a, 0x251b, 0x251c, - 0x251d, 0x251e, 0x251f, 0x2520, 0x2521, 0x2522, 0x2523, 0x2524, - 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, - 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, - 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, - 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, - 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, -}; -static const unsigned short gb2312_2uni_page30[6768] = { - /* 0x30 */ - 0x554a, 0x963f, 0x57c3, 0x6328, 0x54ce, 0x5509, 0x54c0, 0x7691, - 0x764c, 0x853c, 0x77ee, 0x827e, 0x788d, 0x7231, 0x9698, 0x978d, - 0x6c28, 0x5b89, 0x4ffa, 0x6309, 0x6697, 0x5cb8, 0x80fa, 0x6848, - 0x80ae, 0x6602, 0x76ce, 0x51f9, 0x6556, 0x71ac, 0x7ff1, 0x8884, - 0x50b2, 0x5965, 0x61ca, 0x6fb3, 0x82ad, 0x634c, 0x6252, 0x53ed, - 0x5427, 0x7b06, 0x516b, 0x75a4, 0x5df4, 0x62d4, 0x8dcb, 0x9776, - 0x628a, 0x8019, 0x575d, 0x9738, 0x7f62, 0x7238, 0x767d, 0x67cf, - 0x767e, 0x6446, 0x4f70, 0x8d25, 0x62dc, 0x7a17, 0x6591, 0x73ed, - 0x642c, 0x6273, 0x822c, 0x9881, 0x677f, 0x7248, 0x626e, 0x62cc, - 0x4f34, 0x74e3, 0x534a, 0x529e, 0x7eca, 0x90a6, 0x5e2e, 0x6886, - 0x699c, 0x8180, 0x7ed1, 0x68d2, 0x78c5, 0x868c, 0x9551, 0x508d, - 0x8c24, 0x82de, 0x80de, 0x5305, 0x8912, 0x5265, - /* 0x31 */ - 0x8584, 0x96f9, 0x4fdd, 0x5821, 0x9971, 0x5b9d, 0x62b1, 0x62a5, - 0x66b4, 0x8c79, 0x9c8d, 0x7206, 0x676f, 0x7891, 0x60b2, 0x5351, - 0x5317, 0x8f88, 0x80cc, 0x8d1d, 0x94a1, 0x500d, 0x72c8, 0x5907, - 0x60eb, 0x7119, 0x88ab, 0x5954, 0x82ef, 0x672c, 0x7b28, 0x5d29, - 0x7ef7, 0x752d, 0x6cf5, 0x8e66, 0x8ff8, 0x903c, 0x9f3b, 0x6bd4, - 0x9119, 0x7b14, 0x5f7c, 0x78a7, 0x84d6, 0x853d, 0x6bd5, 0x6bd9, - 0x6bd6, 0x5e01, 0x5e87, 0x75f9, 0x95ed, 0x655d, 0x5f0a, 0x5fc5, - 0x8f9f, 0x58c1, 0x81c2, 0x907f, 0x965b, 0x97ad, 0x8fb9, 0x7f16, - 0x8d2c, 0x6241, 0x4fbf, 0x53d8, 0x535e, 0x8fa8, 0x8fa9, 0x8fab, - 0x904d, 0x6807, 0x5f6a, 0x8198, 0x8868, 0x9cd6, 0x618b, 0x522b, - 0x762a, 0x5f6c, 0x658c, 0x6fd2, 0x6ee8, 0x5bbe, 0x6448, 0x5175, - 0x51b0, 0x67c4, 0x4e19, 0x79c9, 0x997c, 0x70b3, - /* 0x32 */ - 0x75c5, 0x5e76, 0x73bb, 0x83e0, 0x64ad, 0x62e8, 0x94b5, 0x6ce2, - 0x535a, 0x52c3, 0x640f, 0x94c2, 0x7b94, 0x4f2f, 0x5e1b, 0x8236, - 0x8116, 0x818a, 0x6e24, 0x6cca, 0x9a73, 0x6355, 0x535c, 0x54fa, - 0x8865, 0x57e0, 0x4e0d, 0x5e03, 0x6b65, 0x7c3f, 0x90e8, 0x6016, - 0x64e6, 0x731c, 0x88c1, 0x6750, 0x624d, 0x8d22, 0x776c, 0x8e29, - 0x91c7, 0x5f69, 0x83dc, 0x8521, 0x9910, 0x53c2, 0x8695, 0x6b8b, - 0x60ed, 0x60e8, 0x707f, 0x82cd, 0x8231, 0x4ed3, 0x6ca7, 0x85cf, - 0x64cd, 0x7cd9, 0x69fd, 0x66f9, 0x8349, 0x5395, 0x7b56, 0x4fa7, - 0x518c, 0x6d4b, 0x5c42, 0x8e6d, 0x63d2, 0x53c9, 0x832c, 0x8336, - 0x67e5, 0x78b4, 0x643d, 0x5bdf, 0x5c94, 0x5dee, 0x8be7, 0x62c6, - 0x67f4, 0x8c7a, 0x6400, 0x63ba, 0x8749, 0x998b, 0x8c17, 0x7f20, - 0x94f2, 0x4ea7, 0x9610, 0x98a4, 0x660c, 0x7316, - /* 0x33 */ - 0x573a, 0x5c1d, 0x5e38, 0x957f, 0x507f, 0x80a0, 0x5382, 0x655e, - 0x7545, 0x5531, 0x5021, 0x8d85, 0x6284, 0x949e, 0x671d, 0x5632, - 0x6f6e, 0x5de2, 0x5435, 0x7092, 0x8f66, 0x626f, 0x64a4, 0x63a3, - 0x5f7b, 0x6f88, 0x90f4, 0x81e3, 0x8fb0, 0x5c18, 0x6668, 0x5ff1, - 0x6c89, 0x9648, 0x8d81, 0x886c, 0x6491, 0x79f0, 0x57ce, 0x6a59, - 0x6210, 0x5448, 0x4e58, 0x7a0b, 0x60e9, 0x6f84, 0x8bda, 0x627f, - 0x901e, 0x9a8b, 0x79e4, 0x5403, 0x75f4, 0x6301, 0x5319, 0x6c60, - 0x8fdf, 0x5f1b, 0x9a70, 0x803b, 0x9f7f, 0x4f88, 0x5c3a, 0x8d64, - 0x7fc5, 0x65a5, 0x70bd, 0x5145, 0x51b2, 0x866b, 0x5d07, 0x5ba0, - 0x62bd, 0x916c, 0x7574, 0x8e0c, 0x7a20, 0x6101, 0x7b79, 0x4ec7, - 0x7ef8, 0x7785, 0x4e11, 0x81ed, 0x521d, 0x51fa, 0x6a71, 0x53a8, - 0x8e87, 0x9504, 0x96cf, 0x6ec1, 0x9664, 0x695a, - /* 0x34 */ - 0x7840, 0x50a8, 0x77d7, 0x6410, 0x89e6, 0x5904, 0x63e3, 0x5ddd, - 0x7a7f, 0x693d, 0x4f20, 0x8239, 0x5598, 0x4e32, 0x75ae, 0x7a97, - 0x5e62, 0x5e8a, 0x95ef, 0x521b, 0x5439, 0x708a, 0x6376, 0x9524, - 0x5782, 0x6625, 0x693f, 0x9187, 0x5507, 0x6df3, 0x7eaf, 0x8822, - 0x6233, 0x7ef0, 0x75b5, 0x8328, 0x78c1, 0x96cc, 0x8f9e, 0x6148, - 0x74f7, 0x8bcd, 0x6b64, 0x523a, 0x8d50, 0x6b21, 0x806a, 0x8471, - 0x56f1, 0x5306, 0x4ece, 0x4e1b, 0x51d1, 0x7c97, 0x918b, 0x7c07, - 0x4fc3, 0x8e7f, 0x7be1, 0x7a9c, 0x6467, 0x5d14, 0x50ac, 0x8106, - 0x7601, 0x7cb9, 0x6dec, 0x7fe0, 0x6751, 0x5b58, 0x5bf8, 0x78cb, - 0x64ae, 0x6413, 0x63aa, 0x632b, 0x9519, 0x642d, 0x8fbe, 0x7b54, - 0x7629, 0x6253, 0x5927, 0x5446, 0x6b79, 0x50a3, 0x6234, 0x5e26, - 0x6b86, 0x4ee3, 0x8d37, 0x888b, 0x5f85, 0x902e, - /* 0x35 */ - 0x6020, 0x803d, 0x62c5, 0x4e39, 0x5355, 0x90f8, 0x63b8, 0x80c6, - 0x65e6, 0x6c2e, 0x4f46, 0x60ee, 0x6de1, 0x8bde, 0x5f39, 0x86cb, - 0x5f53, 0x6321, 0x515a, 0x8361, 0x6863, 0x5200, 0x6363, 0x8e48, - 0x5012, 0x5c9b, 0x7977, 0x5bfc, 0x5230, 0x7a3b, 0x60bc, 0x9053, - 0x76d7, 0x5fb7, 0x5f97, 0x7684, 0x8e6c, 0x706f, 0x767b, 0x7b49, - 0x77aa, 0x51f3, 0x9093, 0x5824, 0x4f4e, 0x6ef4, 0x8fea, 0x654c, - 0x7b1b, 0x72c4, 0x6da4, 0x7fdf, 0x5ae1, 0x62b5, 0x5e95, 0x5730, - 0x8482, 0x7b2c, 0x5e1d, 0x5f1f, 0x9012, 0x7f14, 0x98a0, 0x6382, - 0x6ec7, 0x7898, 0x70b9, 0x5178, 0x975b, 0x57ab, 0x7535, 0x4f43, - 0x7538, 0x5e97, 0x60e6, 0x5960, 0x6dc0, 0x6bbf, 0x7889, 0x53fc, - 0x96d5, 0x51cb, 0x5201, 0x6389, 0x540a, 0x9493, 0x8c03, 0x8dcc, - 0x7239, 0x789f, 0x8776, 0x8fed, 0x8c0d, 0x53e0, - /* 0x36 */ - 0x4e01, 0x76ef, 0x53ee, 0x9489, 0x9876, 0x9f0e, 0x952d, 0x5b9a, - 0x8ba2, 0x4e22, 0x4e1c, 0x51ac, 0x8463, 0x61c2, 0x52a8, 0x680b, - 0x4f97, 0x606b, 0x51bb, 0x6d1e, 0x515c, 0x6296, 0x6597, 0x9661, - 0x8c46, 0x9017, 0x75d8, 0x90fd, 0x7763, 0x6bd2, 0x728a, 0x72ec, - 0x8bfb, 0x5835, 0x7779, 0x8d4c, 0x675c, 0x9540, 0x809a, 0x5ea6, - 0x6e21, 0x5992, 0x7aef, 0x77ed, 0x953b, 0x6bb5, 0x65ad, 0x7f0e, - 0x5806, 0x5151, 0x961f, 0x5bf9, 0x58a9, 0x5428, 0x8e72, 0x6566, - 0x987f, 0x56e4, 0x949d, 0x76fe, 0x9041, 0x6387, 0x54c6, 0x591a, - 0x593a, 0x579b, 0x8eb2, 0x6735, 0x8dfa, 0x8235, 0x5241, 0x60f0, - 0x5815, 0x86fe, 0x5ce8, 0x9e45, 0x4fc4, 0x989d, 0x8bb9, 0x5a25, - 0x6076, 0x5384, 0x627c, 0x904f, 0x9102, 0x997f, 0x6069, 0x800c, - 0x513f, 0x8033, 0x5c14, 0x9975, 0x6d31, 0x4e8c, - /* 0x37 */ - 0x8d30, 0x53d1, 0x7f5a, 0x7b4f, 0x4f10, 0x4e4f, 0x9600, 0x6cd5, - 0x73d0, 0x85e9, 0x5e06, 0x756a, 0x7ffb, 0x6a0a, 0x77fe, 0x9492, - 0x7e41, 0x51e1, 0x70e6, 0x53cd, 0x8fd4, 0x8303, 0x8d29, 0x72af, - 0x996d, 0x6cdb, 0x574a, 0x82b3, 0x65b9, 0x80aa, 0x623f, 0x9632, - 0x59a8, 0x4eff, 0x8bbf, 0x7eba, 0x653e, 0x83f2, 0x975e, 0x5561, - 0x98de, 0x80a5, 0x532a, 0x8bfd, 0x5420, 0x80ba, 0x5e9f, 0x6cb8, - 0x8d39, 0x82ac, 0x915a, 0x5429, 0x6c1b, 0x5206, 0x7eb7, 0x575f, - 0x711a, 0x6c7e, 0x7c89, 0x594b, 0x4efd, 0x5fff, 0x6124, 0x7caa, - 0x4e30, 0x5c01, 0x67ab, 0x8702, 0x5cf0, 0x950b, 0x98ce, 0x75af, - 0x70fd, 0x9022, 0x51af, 0x7f1d, 0x8bbd, 0x5949, 0x51e4, 0x4f5b, - 0x5426, 0x592b, 0x6577, 0x80a4, 0x5b75, 0x6276, 0x62c2, 0x8f90, - 0x5e45, 0x6c1f, 0x7b26, 0x4f0f, 0x4fd8, 0x670d, - /* 0x38 */ - 0x6d6e, 0x6daa, 0x798f, 0x88b1, 0x5f17, 0x752b, 0x629a, 0x8f85, - 0x4fef, 0x91dc, 0x65a7, 0x812f, 0x8151, 0x5e9c, 0x8150, 0x8d74, - 0x526f, 0x8986, 0x8d4b, 0x590d, 0x5085, 0x4ed8, 0x961c, 0x7236, - 0x8179, 0x8d1f, 0x5bcc, 0x8ba3, 0x9644, 0x5987, 0x7f1a, 0x5490, - 0x5676, 0x560e, 0x8be5, 0x6539, 0x6982, 0x9499, 0x76d6, 0x6e89, - 0x5e72, 0x7518, 0x6746, 0x67d1, 0x7aff, 0x809d, 0x8d76, 0x611f, - 0x79c6, 0x6562, 0x8d63, 0x5188, 0x521a, 0x94a2, 0x7f38, 0x809b, - 0x7eb2, 0x5c97, 0x6e2f, 0x6760, 0x7bd9, 0x768b, 0x9ad8, 0x818f, - 0x7f94, 0x7cd5, 0x641e, 0x9550, 0x7a3f, 0x544a, 0x54e5, 0x6b4c, - 0x6401, 0x6208, 0x9e3d, 0x80f3, 0x7599, 0x5272, 0x9769, 0x845b, - 0x683c, 0x86e4, 0x9601, 0x9694, 0x94ec, 0x4e2a, 0x5404, 0x7ed9, - 0x6839, 0x8ddf, 0x8015, 0x66f4, 0x5e9a, 0x7fb9, - /* 0x39 */ - 0x57c2, 0x803f, 0x6897, 0x5de5, 0x653b, 0x529f, 0x606d, 0x9f9a, - 0x4f9b, 0x8eac, 0x516c, 0x5bab, 0x5f13, 0x5de9, 0x6c5e, 0x62f1, - 0x8d21, 0x5171, 0x94a9, 0x52fe, 0x6c9f, 0x82df, 0x72d7, 0x57a2, - 0x6784, 0x8d2d, 0x591f, 0x8f9c, 0x83c7, 0x5495, 0x7b8d, 0x4f30, - 0x6cbd, 0x5b64, 0x59d1, 0x9f13, 0x53e4, 0x86ca, 0x9aa8, 0x8c37, - 0x80a1, 0x6545, 0x987e, 0x56fa, 0x96c7, 0x522e, 0x74dc, 0x5250, - 0x5be1, 0x6302, 0x8902, 0x4e56, 0x62d0, 0x602a, 0x68fa, 0x5173, - 0x5b98, 0x51a0, 0x89c2, 0x7ba1, 0x9986, 0x7f50, 0x60ef, 0x704c, - 0x8d2f, 0x5149, 0x5e7f, 0x901b, 0x7470, 0x89c4, 0x572d, 0x7845, - 0x5f52, 0x9f9f, 0x95fa, 0x8f68, 0x9b3c, 0x8be1, 0x7678, 0x6842, - 0x67dc, 0x8dea, 0x8d35, 0x523d, 0x8f8a, 0x6eda, 0x68cd, 0x9505, - 0x90ed, 0x56fd, 0x679c, 0x88f9, 0x8fc7, 0x54c8, - /* 0x3a */ - 0x9ab8, 0x5b69, 0x6d77, 0x6c26, 0x4ea5, 0x5bb3, 0x9a87, 0x9163, - 0x61a8, 0x90af, 0x97e9, 0x542b, 0x6db5, 0x5bd2, 0x51fd, 0x558a, - 0x7f55, 0x7ff0, 0x64bc, 0x634d, 0x65f1, 0x61be, 0x608d, 0x710a, - 0x6c57, 0x6c49, 0x592f, 0x676d, 0x822a, 0x58d5, 0x568e, 0x8c6a, - 0x6beb, 0x90dd, 0x597d, 0x8017, 0x53f7, 0x6d69, 0x5475, 0x559d, - 0x8377, 0x83cf, 0x6838, 0x79be, 0x548c, 0x4f55, 0x5408, 0x76d2, - 0x8c89, 0x9602, 0x6cb3, 0x6db8, 0x8d6b, 0x8910, 0x9e64, 0x8d3a, - 0x563f, 0x9ed1, 0x75d5, 0x5f88, 0x72e0, 0x6068, 0x54fc, 0x4ea8, - 0x6a2a, 0x8861, 0x6052, 0x8f70, 0x54c4, 0x70d8, 0x8679, 0x9e3f, - 0x6d2a, 0x5b8f, 0x5f18, 0x7ea2, 0x5589, 0x4faf, 0x7334, 0x543c, - 0x539a, 0x5019, 0x540e, 0x547c, 0x4e4e, 0x5ffd, 0x745a, 0x58f6, - 0x846b, 0x80e1, 0x8774, 0x72d0, 0x7cca, 0x6e56, - /* 0x3b */ - 0x5f27, 0x864e, 0x552c, 0x62a4, 0x4e92, 0x6caa, 0x6237, 0x82b1, - 0x54d7, 0x534e, 0x733e, 0x6ed1, 0x753b, 0x5212, 0x5316, 0x8bdd, - 0x69d0, 0x5f8a, 0x6000, 0x6dee, 0x574f, 0x6b22, 0x73af, 0x6853, - 0x8fd8, 0x7f13, 0x6362, 0x60a3, 0x5524, 0x75ea, 0x8c62, 0x7115, - 0x6da3, 0x5ba6, 0x5e7b, 0x8352, 0x614c, 0x9ec4, 0x78fa, 0x8757, - 0x7c27, 0x7687, 0x51f0, 0x60f6, 0x714c, 0x6643, 0x5e4c, 0x604d, - 0x8c0e, 0x7070, 0x6325, 0x8f89, 0x5fbd, 0x6062, 0x86d4, 0x56de, - 0x6bc1, 0x6094, 0x6167, 0x5349, 0x60e0, 0x6666, 0x8d3f, 0x79fd, - 0x4f1a, 0x70e9, 0x6c47, 0x8bb3, 0x8bf2, 0x7ed8, 0x8364, 0x660f, - 0x5a5a, 0x9b42, 0x6d51, 0x6df7, 0x8c41, 0x6d3b, 0x4f19, 0x706b, - 0x83b7, 0x6216, 0x60d1, 0x970d, 0x8d27, 0x7978, 0x51fb, 0x573e, - 0x57fa, 0x673a, 0x7578, 0x7a3d, 0x79ef, 0x7b95, - /* 0x3c */ - 0x808c, 0x9965, 0x8ff9, 0x6fc0, 0x8ba5, 0x9e21, 0x59ec, 0x7ee9, - 0x7f09, 0x5409, 0x6781, 0x68d8, 0x8f91, 0x7c4d, 0x96c6, 0x53ca, - 0x6025, 0x75be, 0x6c72, 0x5373, 0x5ac9, 0x7ea7, 0x6324, 0x51e0, - 0x810a, 0x5df1, 0x84df, 0x6280, 0x5180, 0x5b63, 0x4f0e, 0x796d, - 0x5242, 0x60b8, 0x6d4e, 0x5bc4, 0x5bc2, 0x8ba1, 0x8bb0, 0x65e2, - 0x5fcc, 0x9645, 0x5993, 0x7ee7, 0x7eaa, 0x5609, 0x67b7, 0x5939, - 0x4f73, 0x5bb6, 0x52a0, 0x835a, 0x988a, 0x8d3e, 0x7532, 0x94be, - 0x5047, 0x7a3c, 0x4ef7, 0x67b6, 0x9a7e, 0x5ac1, 0x6b7c, 0x76d1, - 0x575a, 0x5c16, 0x7b3a, 0x95f4, 0x714e, 0x517c, 0x80a9, 0x8270, - 0x5978, 0x7f04, 0x8327, 0x68c0, 0x67ec, 0x78b1, 0x7877, 0x62e3, - 0x6361, 0x7b80, 0x4fed, 0x526a, 0x51cf, 0x8350, 0x69db, 0x9274, - 0x8df5, 0x8d31, 0x89c1, 0x952e, 0x7bad, 0x4ef6, - /* 0x3d */ - 0x5065, 0x8230, 0x5251, 0x996f, 0x6e10, 0x6e85, 0x6da7, 0x5efa, - 0x50f5, 0x59dc, 0x5c06, 0x6d46, 0x6c5f, 0x7586, 0x848b, 0x6868, - 0x5956, 0x8bb2, 0x5320, 0x9171, 0x964d, 0x8549, 0x6912, 0x7901, - 0x7126, 0x80f6, 0x4ea4, 0x90ca, 0x6d47, 0x9a84, 0x5a07, 0x56bc, - 0x6405, 0x94f0, 0x77eb, 0x4fa5, 0x811a, 0x72e1, 0x89d2, 0x997a, - 0x7f34, 0x7ede, 0x527f, 0x6559, 0x9175, 0x8f7f, 0x8f83, 0x53eb, - 0x7a96, 0x63ed, 0x63a5, 0x7686, 0x79f8, 0x8857, 0x9636, 0x622a, - 0x52ab, 0x8282, 0x6854, 0x6770, 0x6377, 0x776b, 0x7aed, 0x6d01, - 0x7ed3, 0x89e3, 0x59d0, 0x6212, 0x85c9, 0x82a5, 0x754c, 0x501f, - 0x4ecb, 0x75a5, 0x8beb, 0x5c4a, 0x5dfe, 0x7b4b, 0x65a4, 0x91d1, - 0x4eca, 0x6d25, 0x895f, 0x7d27, 0x9526, 0x4ec5, 0x8c28, 0x8fdb, - 0x9773, 0x664b, 0x7981, 0x8fd1, 0x70ec, 0x6d78, - /* 0x3e */ - 0x5c3d, 0x52b2, 0x8346, 0x5162, 0x830e, 0x775b, 0x6676, 0x9cb8, - 0x4eac, 0x60ca, 0x7cbe, 0x7cb3, 0x7ecf, 0x4e95, 0x8b66, 0x666f, - 0x9888, 0x9759, 0x5883, 0x656c, 0x955c, 0x5f84, 0x75c9, 0x9756, - 0x7adf, 0x7ade, 0x51c0, 0x70af, 0x7a98, 0x63ea, 0x7a76, 0x7ea0, - 0x7396, 0x97ed, 0x4e45, 0x7078, 0x4e5d, 0x9152, 0x53a9, 0x6551, - 0x65e7, 0x81fc, 0x8205, 0x548e, 0x5c31, 0x759a, 0x97a0, 0x62d8, - 0x72d9, 0x75bd, 0x5c45, 0x9a79, 0x83ca, 0x5c40, 0x5480, 0x77e9, - 0x4e3e, 0x6cae, 0x805a, 0x62d2, 0x636e, 0x5de8, 0x5177, 0x8ddd, - 0x8e1e, 0x952f, 0x4ff1, 0x53e5, 0x60e7, 0x70ac, 0x5267, 0x6350, - 0x9e43, 0x5a1f, 0x5026, 0x7737, 0x5377, 0x7ee2, 0x6485, 0x652b, - 0x6289, 0x6398, 0x5014, 0x7235, 0x89c9, 0x51b3, 0x8bc0, 0x7edd, - 0x5747, 0x83cc, 0x94a7, 0x519b, 0x541b, 0x5cfb, - /* 0x3f */ - 0x4fca, 0x7ae3, 0x6d5a, 0x90e1, 0x9a8f, 0x5580, 0x5496, 0x5361, - 0x54af, 0x5f00, 0x63e9, 0x6977, 0x51ef, 0x6168, 0x520a, 0x582a, - 0x52d8, 0x574e, 0x780d, 0x770b, 0x5eb7, 0x6177, 0x7ce0, 0x625b, - 0x6297, 0x4ea2, 0x7095, 0x8003, 0x62f7, 0x70e4, 0x9760, 0x5777, - 0x82db, 0x67ef, 0x68f5, 0x78d5, 0x9897, 0x79d1, 0x58f3, 0x54b3, - 0x53ef, 0x6e34, 0x514b, 0x523b, 0x5ba2, 0x8bfe, 0x80af, 0x5543, - 0x57a6, 0x6073, 0x5751, 0x542d, 0x7a7a, 0x6050, 0x5b54, 0x63a7, - 0x62a0, 0x53e3, 0x6263, 0x5bc7, 0x67af, 0x54ed, 0x7a9f, 0x82e6, - 0x9177, 0x5e93, 0x88e4, 0x5938, 0x57ae, 0x630e, 0x8de8, 0x80ef, - 0x5757, 0x7b77, 0x4fa9, 0x5feb, 0x5bbd, 0x6b3e, 0x5321, 0x7b50, - 0x72c2, 0x6846, 0x77ff, 0x7736, 0x65f7, 0x51b5, 0x4e8f, 0x76d4, - 0x5cbf, 0x7aa5, 0x8475, 0x594e, 0x9b41, 0x5080, - /* 0x40 */ - 0x9988, 0x6127, 0x6e83, 0x5764, 0x6606, 0x6346, 0x56f0, 0x62ec, - 0x6269, 0x5ed3, 0x9614, 0x5783, 0x62c9, 0x5587, 0x8721, 0x814a, - 0x8fa3, 0x5566, 0x83b1, 0x6765, 0x8d56, 0x84dd, 0x5a6a, 0x680f, - 0x62e6, 0x7bee, 0x9611, 0x5170, 0x6f9c, 0x8c30, 0x63fd, 0x89c8, - 0x61d2, 0x7f06, 0x70c2, 0x6ee5, 0x7405, 0x6994, 0x72fc, 0x5eca, - 0x90ce, 0x6717, 0x6d6a, 0x635e, 0x52b3, 0x7262, 0x8001, 0x4f6c, - 0x59e5, 0x916a, 0x70d9, 0x6d9d, 0x52d2, 0x4e50, 0x96f7, 0x956d, - 0x857e, 0x78ca, 0x7d2f, 0x5121, 0x5792, 0x64c2, 0x808b, 0x7c7b, - 0x6cea, 0x68f1, 0x695e, 0x51b7, 0x5398, 0x68a8, 0x7281, 0x9ece, - 0x7bf1, 0x72f8, 0x79bb, 0x6f13, 0x7406, 0x674e, 0x91cc, 0x9ca4, - 0x793c, 0x8389, 0x8354, 0x540f, 0x6817, 0x4e3d, 0x5389, 0x52b1, - 0x783e, 0x5386, 0x5229, 0x5088, 0x4f8b, 0x4fd0, - /* 0x41 */ - 0x75e2, 0x7acb, 0x7c92, 0x6ca5, 0x96b6, 0x529b, 0x7483, 0x54e9, - 0x4fe9, 0x8054, 0x83b2, 0x8fde, 0x9570, 0x5ec9, 0x601c, 0x6d9f, - 0x5e18, 0x655b, 0x8138, 0x94fe, 0x604b, 0x70bc, 0x7ec3, 0x7cae, - 0x51c9, 0x6881, 0x7cb1, 0x826f, 0x4e24, 0x8f86, 0x91cf, 0x667e, - 0x4eae, 0x8c05, 0x64a9, 0x804a, 0x50da, 0x7597, 0x71ce, 0x5be5, - 0x8fbd, 0x6f66, 0x4e86, 0x6482, 0x9563, 0x5ed6, 0x6599, 0x5217, - 0x88c2, 0x70c8, 0x52a3, 0x730e, 0x7433, 0x6797, 0x78f7, 0x9716, - 0x4e34, 0x90bb, 0x9cde, 0x6dcb, 0x51db, 0x8d41, 0x541d, 0x62ce, - 0x73b2, 0x83f1, 0x96f6, 0x9f84, 0x94c3, 0x4f36, 0x7f9a, 0x51cc, - 0x7075, 0x9675, 0x5cad, 0x9886, 0x53e6, 0x4ee4, 0x6e9c, 0x7409, - 0x69b4, 0x786b, 0x998f, 0x7559, 0x5218, 0x7624, 0x6d41, 0x67f3, - 0x516d, 0x9f99, 0x804b, 0x5499, 0x7b3c, 0x7abf, - /* 0x42 */ - 0x9686, 0x5784, 0x62e2, 0x9647, 0x697c, 0x5a04, 0x6402, 0x7bd3, - 0x6f0f, 0x964b, 0x82a6, 0x5362, 0x9885, 0x5e90, 0x7089, 0x63b3, - 0x5364, 0x864f, 0x9c81, 0x9e93, 0x788c, 0x9732, 0x8def, 0x8d42, - 0x9e7f, 0x6f5e, 0x7984, 0x5f55, 0x9646, 0x622e, 0x9a74, 0x5415, - 0x94dd, 0x4fa3, 0x65c5, 0x5c65, 0x5c61, 0x7f15, 0x8651, 0x6c2f, - 0x5f8b, 0x7387, 0x6ee4, 0x7eff, 0x5ce6, 0x631b, 0x5b6a, 0x6ee6, - 0x5375, 0x4e71, 0x63a0, 0x7565, 0x62a1, 0x8f6e, 0x4f26, 0x4ed1, - 0x6ca6, 0x7eb6, 0x8bba, 0x841d, 0x87ba, 0x7f57, 0x903b, 0x9523, - 0x7ba9, 0x9aa1, 0x88f8, 0x843d, 0x6d1b, 0x9a86, 0x7edc, 0x5988, - 0x9ebb, 0x739b, 0x7801, 0x8682, 0x9a6c, 0x9a82, 0x561b, 0x5417, - 0x57cb, 0x4e70, 0x9ea6, 0x5356, 0x8fc8, 0x8109, 0x7792, 0x9992, - 0x86ee, 0x6ee1, 0x8513, 0x66fc, 0x6162, 0x6f2b, - /* 0x43 */ - 0x8c29, 0x8292, 0x832b, 0x76f2, 0x6c13, 0x5fd9, 0x83bd, 0x732b, - 0x8305, 0x951a, 0x6bdb, 0x77db, 0x94c6, 0x536f, 0x8302, 0x5192, - 0x5e3d, 0x8c8c, 0x8d38, 0x4e48, 0x73ab, 0x679a, 0x6885, 0x9176, - 0x9709, 0x7164, 0x6ca1, 0x7709, 0x5a92, 0x9541, 0x6bcf, 0x7f8e, - 0x6627, 0x5bd0, 0x59b9, 0x5a9a, 0x95e8, 0x95f7, 0x4eec, 0x840c, - 0x8499, 0x6aac, 0x76df, 0x9530, 0x731b, 0x68a6, 0x5b5f, 0x772f, - 0x919a, 0x9761, 0x7cdc, 0x8ff7, 0x8c1c, 0x5f25, 0x7c73, 0x79d8, - 0x89c5, 0x6ccc, 0x871c, 0x5bc6, 0x5e42, 0x68c9, 0x7720, 0x7ef5, - 0x5195, 0x514d, 0x52c9, 0x5a29, 0x7f05, 0x9762, 0x82d7, 0x63cf, - 0x7784, 0x85d0, 0x79d2, 0x6e3a, 0x5e99, 0x5999, 0x8511, 0x706d, - 0x6c11, 0x62bf, 0x76bf, 0x654f, 0x60af, 0x95fd, 0x660e, 0x879f, - 0x9e23, 0x94ed, 0x540d, 0x547d, 0x8c2c, 0x6478, - /* 0x44 */ - 0x6479, 0x8611, 0x6a21, 0x819c, 0x78e8, 0x6469, 0x9b54, 0x62b9, - 0x672b, 0x83ab, 0x58a8, 0x9ed8, 0x6cab, 0x6f20, 0x5bde, 0x964c, - 0x8c0b, 0x725f, 0x67d0, 0x62c7, 0x7261, 0x4ea9, 0x59c6, 0x6bcd, - 0x5893, 0x66ae, 0x5e55, 0x52df, 0x6155, 0x6728, 0x76ee, 0x7766, - 0x7267, 0x7a46, 0x62ff, 0x54ea, 0x5450, 0x94a0, 0x90a3, 0x5a1c, - 0x7eb3, 0x6c16, 0x4e43, 0x5976, 0x8010, 0x5948, 0x5357, 0x7537, - 0x96be, 0x56ca, 0x6320, 0x8111, 0x607c, 0x95f9, 0x6dd6, 0x5462, - 0x9981, 0x5185, 0x5ae9, 0x80fd, 0x59ae, 0x9713, 0x502a, 0x6ce5, - 0x5c3c, 0x62df, 0x4f60, 0x533f, 0x817b, 0x9006, 0x6eba, 0x852b, - 0x62c8, 0x5e74, 0x78be, 0x64b5, 0x637b, 0x5ff5, 0x5a18, 0x917f, - 0x9e1f, 0x5c3f, 0x634f, 0x8042, 0x5b7d, 0x556e, 0x954a, 0x954d, - 0x6d85, 0x60a8, 0x67e0, 0x72de, 0x51dd, 0x5b81, - /* 0x45 */ - 0x62e7, 0x6cde, 0x725b, 0x626d, 0x94ae, 0x7ebd, 0x8113, 0x6d53, - 0x519c, 0x5f04, 0x5974, 0x52aa, 0x6012, 0x5973, 0x6696, 0x8650, - 0x759f, 0x632a, 0x61e6, 0x7cef, 0x8bfa, 0x54e6, 0x6b27, 0x9e25, - 0x6bb4, 0x85d5, 0x5455, 0x5076, 0x6ca4, 0x556a, 0x8db4, 0x722c, - 0x5e15, 0x6015, 0x7436, 0x62cd, 0x6392, 0x724c, 0x5f98, 0x6e43, - 0x6d3e, 0x6500, 0x6f58, 0x76d8, 0x78d0, 0x76fc, 0x7554, 0x5224, - 0x53db, 0x4e53, 0x5e9e, 0x65c1, 0x802a, 0x80d6, 0x629b, 0x5486, - 0x5228, 0x70ae, 0x888d, 0x8dd1, 0x6ce1, 0x5478, 0x80da, 0x57f9, - 0x88f4, 0x8d54, 0x966a, 0x914d, 0x4f69, 0x6c9b, 0x55b7, 0x76c6, - 0x7830, 0x62a8, 0x70f9, 0x6f8e, 0x5f6d, 0x84ec, 0x68da, 0x787c, - 0x7bf7, 0x81a8, 0x670b, 0x9e4f, 0x6367, 0x78b0, 0x576f, 0x7812, - 0x9739, 0x6279, 0x62ab, 0x5288, 0x7435, 0x6bd7, - /* 0x46 */ - 0x5564, 0x813e, 0x75b2, 0x76ae, 0x5339, 0x75de, 0x50fb, 0x5c41, - 0x8b6c, 0x7bc7, 0x504f, 0x7247, 0x9a97, 0x98d8, 0x6f02, 0x74e2, - 0x7968, 0x6487, 0x77a5, 0x62fc, 0x9891, 0x8d2b, 0x54c1, 0x8058, - 0x4e52, 0x576a, 0x82f9, 0x840d, 0x5e73, 0x51ed, 0x74f6, 0x8bc4, - 0x5c4f, 0x5761, 0x6cfc, 0x9887, 0x5a46, 0x7834, 0x9b44, 0x8feb, - 0x7c95, 0x5256, 0x6251, 0x94fa, 0x4ec6, 0x8386, 0x8461, 0x83e9, - 0x84b2, 0x57d4, 0x6734, 0x5703, 0x666e, 0x6d66, 0x8c31, 0x66dd, - 0x7011, 0x671f, 0x6b3a, 0x6816, 0x621a, 0x59bb, 0x4e03, 0x51c4, - 0x6f06, 0x67d2, 0x6c8f, 0x5176, 0x68cb, 0x5947, 0x6b67, 0x7566, - 0x5d0e, 0x8110, 0x9f50, 0x65d7, 0x7948, 0x7941, 0x9a91, 0x8d77, - 0x5c82, 0x4e5e, 0x4f01, 0x542f, 0x5951, 0x780c, 0x5668, 0x6c14, - 0x8fc4, 0x5f03, 0x6c7d, 0x6ce3, 0x8bab, 0x6390, - /* 0x47 */ - 0x6070, 0x6d3d, 0x7275, 0x6266, 0x948e, 0x94c5, 0x5343, 0x8fc1, - 0x7b7e, 0x4edf, 0x8c26, 0x4e7e, 0x9ed4, 0x94b1, 0x94b3, 0x524d, - 0x6f5c, 0x9063, 0x6d45, 0x8c34, 0x5811, 0x5d4c, 0x6b20, 0x6b49, - 0x67aa, 0x545b, 0x8154, 0x7f8c, 0x5899, 0x8537, 0x5f3a, 0x62a2, - 0x6a47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77a7, 0x4e54, 0x4fa8, - 0x5de7, 0x9798, 0x64ac, 0x7fd8, 0x5ced, 0x4fcf, 0x7a8d, 0x5207, - 0x8304, 0x4e14, 0x602f, 0x7a83, 0x94a6, 0x4fb5, 0x4eb2, 0x79e6, - 0x7434, 0x52e4, 0x82b9, 0x64d2, 0x79bd, 0x5bdd, 0x6c81, 0x9752, - 0x8f7b, 0x6c22, 0x503e, 0x537f, 0x6e05, 0x64ce, 0x6674, 0x6c30, - 0x60c5, 0x9877, 0x8bf7, 0x5e86, 0x743c, 0x7a77, 0x79cb, 0x4e18, - 0x90b1, 0x7403, 0x6c42, 0x56da, 0x914b, 0x6cc5, 0x8d8b, 0x533a, - 0x86c6, 0x66f2, 0x8eaf, 0x5c48, 0x9a71, 0x6e20, - /* 0x48 */ - 0x53d6, 0x5a36, 0x9f8b, 0x8da3, 0x53bb, 0x5708, 0x98a7, 0x6743, - 0x919b, 0x6cc9, 0x5168, 0x75ca, 0x62f3, 0x72ac, 0x5238, 0x529d, - 0x7f3a, 0x7094, 0x7638, 0x5374, 0x9e4a, 0x69b7, 0x786e, 0x96c0, - 0x88d9, 0x7fa4, 0x7136, 0x71c3, 0x5189, 0x67d3, 0x74e4, 0x58e4, - 0x6518, 0x56b7, 0x8ba9, 0x9976, 0x6270, 0x7ed5, 0x60f9, 0x70ed, - 0x58ec, 0x4ec1, 0x4eba, 0x5fcd, 0x97e7, 0x4efb, 0x8ba4, 0x5203, - 0x598a, 0x7eab, 0x6254, 0x4ecd, 0x65e5, 0x620e, 0x8338, 0x84c9, - 0x8363, 0x878d, 0x7194, 0x6eb6, 0x5bb9, 0x7ed2, 0x5197, 0x63c9, - 0x67d4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5b7a, 0x5982, 0x8fb1, - 0x4e73, 0x6c5d, 0x5165, 0x8925, 0x8f6f, 0x962e, 0x854a, 0x745e, - 0x9510, 0x95f0, 0x6da6, 0x82e5, 0x5f31, 0x6492, 0x6d12, 0x8428, - 0x816e, 0x9cc3, 0x585e, 0x8d5b, 0x4e09, 0x53c1, - /* 0x49 */ - 0x4f1e, 0x6563, 0x6851, 0x55d3, 0x4e27, 0x6414, 0x9a9a, 0x626b, - 0x5ac2, 0x745f, 0x8272, 0x6da9, 0x68ee, 0x50e7, 0x838e, 0x7802, - 0x6740, 0x5239, 0x6c99, 0x7eb1, 0x50bb, 0x5565, 0x715e, 0x7b5b, - 0x6652, 0x73ca, 0x82eb, 0x6749, 0x5c71, 0x5220, 0x717d, 0x886b, - 0x95ea, 0x9655, 0x64c5, 0x8d61, 0x81b3, 0x5584, 0x6c55, 0x6247, - 0x7f2e, 0x5892, 0x4f24, 0x5546, 0x8d4f, 0x664c, 0x4e0a, 0x5c1a, - 0x88f3, 0x68a2, 0x634e, 0x7a0d, 0x70e7, 0x828d, 0x52fa, 0x97f6, - 0x5c11, 0x54e8, 0x90b5, 0x7ecd, 0x5962, 0x8d4a, 0x86c7, 0x820c, - 0x820d, 0x8d66, 0x6444, 0x5c04, 0x6151, 0x6d89, 0x793e, 0x8bbe, - 0x7837, 0x7533, 0x547b, 0x4f38, 0x8eab, 0x6df1, 0x5a20, 0x7ec5, - 0x795e, 0x6c88, 0x5ba1, 0x5a76, 0x751a, 0x80be, 0x614e, 0x6e17, - 0x58f0, 0x751f, 0x7525, 0x7272, 0x5347, 0x7ef3, - /* 0x4a */ - 0x7701, 0x76db, 0x5269, 0x80dc, 0x5723, 0x5e08, 0x5931, 0x72ee, - 0x65bd, 0x6e7f, 0x8bd7, 0x5c38, 0x8671, 0x5341, 0x77f3, 0x62fe, - 0x65f6, 0x4ec0, 0x98df, 0x8680, 0x5b9e, 0x8bc6, 0x53f2, 0x77e2, - 0x4f7f, 0x5c4e, 0x9a76, 0x59cb, 0x5f0f, 0x793a, 0x58eb, 0x4e16, - 0x67ff, 0x4e8b, 0x62ed, 0x8a93, 0x901d, 0x52bf, 0x662f, 0x55dc, - 0x566c, 0x9002, 0x4ed5, 0x4f8d, 0x91ca, 0x9970, 0x6c0f, 0x5e02, - 0x6043, 0x5ba4, 0x89c6, 0x8bd5, 0x6536, 0x624b, 0x9996, 0x5b88, - 0x5bff, 0x6388, 0x552e, 0x53d7, 0x7626, 0x517d, 0x852c, 0x67a2, - 0x68b3, 0x6b8a, 0x6292, 0x8f93, 0x53d4, 0x8212, 0x6dd1, 0x758f, - 0x4e66, 0x8d4e, 0x5b70, 0x719f, 0x85af, 0x6691, 0x66d9, 0x7f72, - 0x8700, 0x9ecd, 0x9f20, 0x5c5e, 0x672f, 0x8ff0, 0x6811, 0x675f, - 0x620d, 0x7ad6, 0x5885, 0x5eb6, 0x6570, 0x6f31, - /* 0x4b */ - 0x6055, 0x5237, 0x800d, 0x6454, 0x8870, 0x7529, 0x5e05, 0x6813, - 0x62f4, 0x971c, 0x53cc, 0x723d, 0x8c01, 0x6c34, 0x7761, 0x7a0e, - 0x542e, 0x77ac, 0x987a, 0x821c, 0x8bf4, 0x7855, 0x6714, 0x70c1, - 0x65af, 0x6495, 0x5636, 0x601d, 0x79c1, 0x53f8, 0x4e1d, 0x6b7b, - 0x8086, 0x5bfa, 0x55e3, 0x56db, 0x4f3a, 0x4f3c, 0x9972, 0x5df3, - 0x677e, 0x8038, 0x6002, 0x9882, 0x9001, 0x5b8b, 0x8bbc, 0x8bf5, - 0x641c, 0x8258, 0x64de, 0x55fd, 0x82cf, 0x9165, 0x4fd7, 0x7d20, - 0x901f, 0x7c9f, 0x50f3, 0x5851, 0x6eaf, 0x5bbf, 0x8bc9, 0x8083, - 0x9178, 0x849c, 0x7b97, 0x867d, 0x968b, 0x968f, 0x7ee5, 0x9ad3, - 0x788e, 0x5c81, 0x7a57, 0x9042, 0x96a7, 0x795f, 0x5b59, 0x635f, - 0x7b0b, 0x84d1, 0x68ad, 0x5506, 0x7f29, 0x7410, 0x7d22, 0x9501, - 0x6240, 0x584c, 0x4ed6, 0x5b83, 0x5979, 0x5854, - /* 0x4c */ - 0x736d, 0x631e, 0x8e4b, 0x8e0f, 0x80ce, 0x82d4, 0x62ac, 0x53f0, - 0x6cf0, 0x915e, 0x592a, 0x6001, 0x6c70, 0x574d, 0x644a, 0x8d2a, - 0x762b, 0x6ee9, 0x575b, 0x6a80, 0x75f0, 0x6f6d, 0x8c2d, 0x8c08, - 0x5766, 0x6bef, 0x8892, 0x78b3, 0x63a2, 0x53f9, 0x70ad, 0x6c64, - 0x5858, 0x642a, 0x5802, 0x68e0, 0x819b, 0x5510, 0x7cd6, 0x5018, - 0x8eba, 0x6dcc, 0x8d9f, 0x70eb, 0x638f, 0x6d9b, 0x6ed4, 0x7ee6, - 0x8404, 0x6843, 0x9003, 0x6dd8, 0x9676, 0x8ba8, 0x5957, 0x7279, - 0x85e4, 0x817e, 0x75bc, 0x8a8a, 0x68af, 0x5254, 0x8e22, 0x9511, - 0x63d0, 0x9898, 0x8e44, 0x557c, 0x4f53, 0x66ff, 0x568f, 0x60d5, - 0x6d95, 0x5243, 0x5c49, 0x5929, 0x6dfb, 0x586b, 0x7530, 0x751c, - 0x606c, 0x8214, 0x8146, 0x6311, 0x6761, 0x8fe2, 0x773a, 0x8df3, - 0x8d34, 0x94c1, 0x5e16, 0x5385, 0x542c, 0x70c3, - /* 0x4d */ - 0x6c40, 0x5ef7, 0x505c, 0x4ead, 0x5ead, 0x633a, 0x8247, 0x901a, - 0x6850, 0x916e, 0x77b3, 0x540c, 0x94dc, 0x5f64, 0x7ae5, 0x6876, - 0x6345, 0x7b52, 0x7edf, 0x75db, 0x5077, 0x6295, 0x5934, 0x900f, - 0x51f8, 0x79c3, 0x7a81, 0x56fe, 0x5f92, 0x9014, 0x6d82, 0x5c60, - 0x571f, 0x5410, 0x5154, 0x6e4d, 0x56e2, 0x63a8, 0x9893, 0x817f, - 0x8715, 0x892a, 0x9000, 0x541e, 0x5c6f, 0x81c0, 0x62d6, 0x6258, - 0x8131, 0x9e35, 0x9640, 0x9a6e, 0x9a7c, 0x692d, 0x59a5, 0x62d3, - 0x553e, 0x6316, 0x54c7, 0x86d9, 0x6d3c, 0x5a03, 0x74e6, 0x889c, - 0x6b6a, 0x5916, 0x8c4c, 0x5f2f, 0x6e7e, 0x73a9, 0x987d, 0x4e38, - 0x70f7, 0x5b8c, 0x7897, 0x633d, 0x665a, 0x7696, 0x60cb, 0x5b9b, - 0x5a49, 0x4e07, 0x8155, 0x6c6a, 0x738b, 0x4ea1, 0x6789, 0x7f51, - 0x5f80, 0x65fa, 0x671b, 0x5fd8, 0x5984, 0x5a01, - /* 0x4e */ - 0x5dcd, 0x5fae, 0x5371, 0x97e6, 0x8fdd, 0x6845, 0x56f4, 0x552f, - 0x60df, 0x4e3a, 0x6f4d, 0x7ef4, 0x82c7, 0x840e, 0x59d4, 0x4f1f, - 0x4f2a, 0x5c3e, 0x7eac, 0x672a, 0x851a, 0x5473, 0x754f, 0x80c3, - 0x5582, 0x9b4f, 0x4f4d, 0x6e2d, 0x8c13, 0x5c09, 0x6170, 0x536b, - 0x761f, 0x6e29, 0x868a, 0x6587, 0x95fb, 0x7eb9, 0x543b, 0x7a33, - 0x7d0a, 0x95ee, 0x55e1, 0x7fc1, 0x74ee, 0x631d, 0x8717, 0x6da1, - 0x7a9d, 0x6211, 0x65a1, 0x5367, 0x63e1, 0x6c83, 0x5deb, 0x545c, - 0x94a8, 0x4e4c, 0x6c61, 0x8bec, 0x5c4b, 0x65e0, 0x829c, 0x68a7, - 0x543e, 0x5434, 0x6bcb, 0x6b66, 0x4e94, 0x6342, 0x5348, 0x821e, - 0x4f0d, 0x4fae, 0x575e, 0x620a, 0x96fe, 0x6664, 0x7269, 0x52ff, - 0x52a1, 0x609f, 0x8bef, 0x6614, 0x7199, 0x6790, 0x897f, 0x7852, - 0x77fd, 0x6670, 0x563b, 0x5438, 0x9521, 0x727a, - /* 0x4f */ - 0x7a00, 0x606f, 0x5e0c, 0x6089, 0x819d, 0x5915, 0x60dc, 0x7184, - 0x70ef, 0x6eaa, 0x6c50, 0x7280, 0x6a84, 0x88ad, 0x5e2d, 0x4e60, - 0x5ab3, 0x559c, 0x94e3, 0x6d17, 0x7cfb, 0x9699, 0x620f, 0x7ec6, - 0x778e, 0x867e, 0x5323, 0x971e, 0x8f96, 0x6687, 0x5ce1, 0x4fa0, - 0x72ed, 0x4e0b, 0x53a6, 0x590f, 0x5413, 0x6380, 0x9528, 0x5148, - 0x4ed9, 0x9c9c, 0x7ea4, 0x54b8, 0x8d24, 0x8854, 0x8237, 0x95f2, - 0x6d8e, 0x5f26, 0x5acc, 0x663e, 0x9669, 0x73b0, 0x732e, 0x53bf, - 0x817a, 0x9985, 0x7fa1, 0x5baa, 0x9677, 0x9650, 0x7ebf, 0x76f8, - 0x53a2, 0x9576, 0x9999, 0x7bb1, 0x8944, 0x6e58, 0x4e61, 0x7fd4, - 0x7965, 0x8be6, 0x60f3, 0x54cd, 0x4eab, 0x9879, 0x5df7, 0x6a61, - 0x50cf, 0x5411, 0x8c61, 0x8427, 0x785d, 0x9704, 0x524a, 0x54ee, - 0x56a3, 0x9500, 0x6d88, 0x5bb5, 0x6dc6, 0x6653, - /* 0x50 */ - 0x5c0f, 0x5b5d, 0x6821, 0x8096, 0x5578, 0x7b11, 0x6548, 0x6954, - 0x4e9b, 0x6b47, 0x874e, 0x978b, 0x534f, 0x631f, 0x643a, 0x90aa, - 0x659c, 0x80c1, 0x8c10, 0x5199, 0x68b0, 0x5378, 0x87f9, 0x61c8, - 0x6cc4, 0x6cfb, 0x8c22, 0x5c51, 0x85aa, 0x82af, 0x950c, 0x6b23, - 0x8f9b, 0x65b0, 0x5ffb, 0x5fc3, 0x4fe1, 0x8845, 0x661f, 0x8165, - 0x7329, 0x60fa, 0x5174, 0x5211, 0x578b, 0x5f62, 0x90a2, 0x884c, - 0x9192, 0x5e78, 0x674f, 0x6027, 0x59d3, 0x5144, 0x51f6, 0x80f8, - 0x5308, 0x6c79, 0x96c4, 0x718a, 0x4f11, 0x4fee, 0x7f9e, 0x673d, - 0x55c5, 0x9508, 0x79c0, 0x8896, 0x7ee3, 0x589f, 0x620c, 0x9700, - 0x865a, 0x5618, 0x987b, 0x5f90, 0x8bb8, 0x84c4, 0x9157, 0x53d9, - 0x65ed, 0x5e8f, 0x755c, 0x6064, 0x7d6e, 0x5a7f, 0x7eea, 0x7eed, - 0x8f69, 0x55a7, 0x5ba3, 0x60ac, 0x65cb, 0x7384, - /* 0x51 */ - 0x9009, 0x7663, 0x7729, 0x7eda, 0x9774, 0x859b, 0x5b66, 0x7a74, - 0x96ea, 0x8840, 0x52cb, 0x718f, 0x5faa, 0x65ec, 0x8be2, 0x5bfb, - 0x9a6f, 0x5de1, 0x6b89, 0x6c5b, 0x8bad, 0x8baf, 0x900a, 0x8fc5, - 0x538b, 0x62bc, 0x9e26, 0x9e2d, 0x5440, 0x4e2b, 0x82bd, 0x7259, - 0x869c, 0x5d16, 0x8859, 0x6daf, 0x96c5, 0x54d1, 0x4e9a, 0x8bb6, - 0x7109, 0x54bd, 0x9609, 0x70df, 0x6df9, 0x76d0, 0x4e25, 0x7814, - 0x8712, 0x5ca9, 0x5ef6, 0x8a00, 0x989c, 0x960e, 0x708e, 0x6cbf, - 0x5944, 0x63a9, 0x773c, 0x884d, 0x6f14, 0x8273, 0x5830, 0x71d5, - 0x538c, 0x781a, 0x96c1, 0x5501, 0x5f66, 0x7130, 0x5bb4, 0x8c1a, - 0x9a8c, 0x6b83, 0x592e, 0x9e2f, 0x79e7, 0x6768, 0x626c, 0x4f6f, - 0x75a1, 0x7f8a, 0x6d0b, 0x9633, 0x6c27, 0x4ef0, 0x75d2, 0x517b, - 0x6837, 0x6f3e, 0x9080, 0x8170, 0x5996, 0x7476, - /* 0x52 */ - 0x6447, 0x5c27, 0x9065, 0x7a91, 0x8c23, 0x59da, 0x54ac, 0x8200, - 0x836f, 0x8981, 0x8000, 0x6930, 0x564e, 0x8036, 0x7237, 0x91ce, - 0x51b6, 0x4e5f, 0x9875, 0x6396, 0x4e1a, 0x53f6, 0x66f3, 0x814b, - 0x591c, 0x6db2, 0x4e00, 0x58f9, 0x533b, 0x63d6, 0x94f1, 0x4f9d, - 0x4f0a, 0x8863, 0x9890, 0x5937, 0x9057, 0x79fb, 0x4eea, 0x80f0, - 0x7591, 0x6c82, 0x5b9c, 0x59e8, 0x5f5d, 0x6905, 0x8681, 0x501a, - 0x5df2, 0x4e59, 0x77e3, 0x4ee5, 0x827a, 0x6291, 0x6613, 0x9091, - 0x5c79, 0x4ebf, 0x5f79, 0x81c6, 0x9038, 0x8084, 0x75ab, 0x4ea6, - 0x88d4, 0x610f, 0x6bc5, 0x5fc6, 0x4e49, 0x76ca, 0x6ea2, 0x8be3, - 0x8bae, 0x8c0a, 0x8bd1, 0x5f02, 0x7ffc, 0x7fcc, 0x7ece, 0x8335, - 0x836b, 0x56e0, 0x6bb7, 0x97f3, 0x9634, 0x59fb, 0x541f, 0x94f6, - 0x6deb, 0x5bc5, 0x996e, 0x5c39, 0x5f15, 0x9690, - /* 0x53 */ - 0x5370, 0x82f1, 0x6a31, 0x5a74, 0x9e70, 0x5e94, 0x7f28, 0x83b9, - 0x8424, 0x8425, 0x8367, 0x8747, 0x8fce, 0x8d62, 0x76c8, 0x5f71, - 0x9896, 0x786c, 0x6620, 0x54df, 0x62e5, 0x4f63, 0x81c3, 0x75c8, - 0x5eb8, 0x96cd, 0x8e0a, 0x86f9, 0x548f, 0x6cf3, 0x6d8c, 0x6c38, - 0x607f, 0x52c7, 0x7528, 0x5e7d, 0x4f18, 0x60a0, 0x5fe7, 0x5c24, - 0x7531, 0x90ae, 0x94c0, 0x72b9, 0x6cb9, 0x6e38, 0x9149, 0x6709, - 0x53cb, 0x53f3, 0x4f51, 0x91c9, 0x8bf1, 0x53c8, 0x5e7c, 0x8fc2, - 0x6de4, 0x4e8e, 0x76c2, 0x6986, 0x865e, 0x611a, 0x8206, 0x4f59, - 0x4fde, 0x903e, 0x9c7c, 0x6109, 0x6e1d, 0x6e14, 0x9685, 0x4e88, - 0x5a31, 0x96e8, 0x4e0e, 0x5c7f, 0x79b9, 0x5b87, 0x8bed, 0x7fbd, - 0x7389, 0x57df, 0x828b, 0x90c1, 0x5401, 0x9047, 0x55bb, 0x5cea, - 0x5fa1, 0x6108, 0x6b32, 0x72f1, 0x80b2, 0x8a89, - /* 0x54 */ - 0x6d74, 0x5bd3, 0x88d5, 0x9884, 0x8c6b, 0x9a6d, 0x9e33, 0x6e0a, - 0x51a4, 0x5143, 0x57a3, 0x8881, 0x539f, 0x63f4, 0x8f95, 0x56ed, - 0x5458, 0x5706, 0x733f, 0x6e90, 0x7f18, 0x8fdc, 0x82d1, 0x613f, - 0x6028, 0x9662, 0x66f0, 0x7ea6, 0x8d8a, 0x8dc3, 0x94a5, 0x5cb3, - 0x7ca4, 0x6708, 0x60a6, 0x9605, 0x8018, 0x4e91, 0x90e7, 0x5300, - 0x9668, 0x5141, 0x8fd0, 0x8574, 0x915d, 0x6655, 0x97f5, 0x5b55, - 0x531d, 0x7838, 0x6742, 0x683d, 0x54c9, 0x707e, 0x5bb0, 0x8f7d, - 0x518d, 0x5728, 0x54b1, 0x6512, 0x6682, 0x8d5e, 0x8d43, 0x810f, - 0x846c, 0x906d, 0x7cdf, 0x51ff, 0x85fb, 0x67a3, 0x65e9, 0x6fa1, - 0x86a4, 0x8e81, 0x566a, 0x9020, 0x7682, 0x7076, 0x71e5, 0x8d23, - 0x62e9, 0x5219, 0x6cfd, 0x8d3c, 0x600e, 0x589e, 0x618e, 0x66fe, - 0x8d60, 0x624e, 0x55b3, 0x6e23, 0x672d, 0x8f67, - /* 0x55 */ - 0x94e1, 0x95f8, 0x7728, 0x6805, 0x69a8, 0x548b, 0x4e4d, 0x70b8, - 0x8bc8, 0x6458, 0x658b, 0x5b85, 0x7a84, 0x503a, 0x5be8, 0x77bb, - 0x6be1, 0x8a79, 0x7c98, 0x6cbe, 0x76cf, 0x65a9, 0x8f97, 0x5d2d, - 0x5c55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7ad9, 0x6e5b, 0x7efd, - 0x6a1f, 0x7ae0, 0x5f70, 0x6f33, 0x5f20, 0x638c, 0x6da8, 0x6756, - 0x4e08, 0x5e10, 0x8d26, 0x4ed7, 0x80c0, 0x7634, 0x969c, 0x62db, - 0x662d, 0x627e, 0x6cbc, 0x8d75, 0x7167, 0x7f69, 0x5146, 0x8087, - 0x53ec, 0x906e, 0x6298, 0x54f2, 0x86f0, 0x8f99, 0x8005, 0x9517, - 0x8517, 0x8fd9, 0x6d59, 0x73cd, 0x659f, 0x771f, 0x7504, 0x7827, - 0x81fb, 0x8d1e, 0x9488, 0x4fa6, 0x6795, 0x75b9, 0x8bca, 0x9707, - 0x632f, 0x9547, 0x9635, 0x84b8, 0x6323, 0x7741, 0x5f81, 0x72f0, - 0x4e89, 0x6014, 0x6574, 0x62ef, 0x6b63, 0x653f, - /* 0x56 */ - 0x5e27, 0x75c7, 0x90d1, 0x8bc1, 0x829d, 0x679d, 0x652f, 0x5431, - 0x8718, 0x77e5, 0x80a2, 0x8102, 0x6c41, 0x4e4b, 0x7ec7, 0x804c, - 0x76f4, 0x690d, 0x6b96, 0x6267, 0x503c, 0x4f84, 0x5740, 0x6307, - 0x6b62, 0x8dbe, 0x53ea, 0x65e8, 0x7eb8, 0x5fd7, 0x631a, 0x63b7, - 0x81f3, 0x81f4, 0x7f6e, 0x5e1c, 0x5cd9, 0x5236, 0x667a, 0x79e9, - 0x7a1a, 0x8d28, 0x7099, 0x75d4, 0x6ede, 0x6cbb, 0x7a92, 0x4e2d, - 0x76c5, 0x5fe0, 0x949f, 0x8877, 0x7ec8, 0x79cd, 0x80bf, 0x91cd, - 0x4ef2, 0x4f17, 0x821f, 0x5468, 0x5dde, 0x6d32, 0x8bcc, 0x7ca5, - 0x8f74, 0x8098, 0x5e1a, 0x5492, 0x76b1, 0x5b99, 0x663c, 0x9aa4, - 0x73e0, 0x682a, 0x86db, 0x6731, 0x732a, 0x8bf8, 0x8bdb, 0x9010, - 0x7af9, 0x70db, 0x716e, 0x62c4, 0x77a9, 0x5631, 0x4e3b, 0x8457, - 0x67f1, 0x52a9, 0x86c0, 0x8d2e, 0x94f8, 0x7b51, - /* 0x57 */ - 0x4f4f, 0x6ce8, 0x795d, 0x9a7b, 0x6293, 0x722a, 0x62fd, 0x4e13, - 0x7816, 0x8f6c, 0x64b0, 0x8d5a, 0x7bc6, 0x6869, 0x5e84, 0x88c5, - 0x5986, 0x649e, 0x58ee, 0x72b6, 0x690e, 0x9525, 0x8ffd, 0x8d58, - 0x5760, 0x7f00, 0x8c06, 0x51c6, 0x6349, 0x62d9, 0x5353, 0x684c, - 0x7422, 0x8301, 0x914c, 0x5544, 0x7740, 0x707c, 0x6d4a, 0x5179, - 0x54a8, 0x8d44, 0x59ff, 0x6ecb, 0x6dc4, 0x5b5c, 0x7d2b, 0x4ed4, - 0x7c7d, 0x6ed3, 0x5b50, 0x81ea, 0x6e0d, 0x5b57, 0x9b03, 0x68d5, - 0x8e2a, 0x5b97, 0x7efc, 0x603b, 0x7eb5, 0x90b9, 0x8d70, 0x594f, - 0x63cd, 0x79df, 0x8db3, 0x5352, 0x65cf, 0x7956, 0x8bc5, 0x963b, - 0x7ec4, 0x94bb, 0x7e82, 0x5634, 0x9189, 0x6700, 0x7f6a, 0x5c0a, - 0x9075, 0x6628, 0x5de6, 0x4f50, 0x67de, 0x505a, 0x4f5c, 0x5750, - 0x5ea7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x58 */ - 0x4e8d, 0x4e0c, 0x5140, 0x4e10, 0x5eff, 0x5345, 0x4e15, 0x4e98, - 0x4e1e, 0x9b32, 0x5b6c, 0x5669, 0x4e28, 0x79ba, 0x4e3f, 0x5315, - 0x4e47, 0x592d, 0x723b, 0x536e, 0x6c10, 0x56df, 0x80e4, 0x9997, - 0x6bd3, 0x777e, 0x9f17, 0x4e36, 0x4e9f, 0x9f10, 0x4e5c, 0x4e69, - 0x4e93, 0x8288, 0x5b5b, 0x556c, 0x560f, 0x4ec4, 0x538d, 0x539d, - 0x53a3, 0x53a5, 0x53ae, 0x9765, 0x8d5d, 0x531a, 0x53f5, 0x5326, - 0x532e, 0x533e, 0x8d5c, 0x5366, 0x5363, 0x5202, 0x5208, 0x520e, - 0x522d, 0x5233, 0x523f, 0x5240, 0x524c, 0x525e, 0x5261, 0x525c, - 0x84af, 0x527d, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, 0x7f54, - 0x4ebb, 0x4ec3, 0x4ec9, 0x4ec2, 0x4ee8, 0x4ee1, 0x4eeb, 0x4ede, - 0x4f1b, 0x4ef3, 0x4f22, 0x4f64, 0x4ef5, 0x4f25, 0x4f27, 0x4f09, - 0x4f2b, 0x4f5e, 0x4f67, 0x6538, 0x4f5a, 0x4f5d, - /* 0x59 */ - 0x4f5f, 0x4f57, 0x4f32, 0x4f3d, 0x4f76, 0x4f74, 0x4f91, 0x4f89, - 0x4f83, 0x4f8f, 0x4f7e, 0x4f7b, 0x4faa, 0x4f7c, 0x4fac, 0x4f94, - 0x4fe6, 0x4fe8, 0x4fea, 0x4fc5, 0x4fda, 0x4fe3, 0x4fdc, 0x4fd1, - 0x4fdf, 0x4ff8, 0x5029, 0x504c, 0x4ff3, 0x502c, 0x500f, 0x502e, - 0x502d, 0x4ffe, 0x501c, 0x500c, 0x5025, 0x5028, 0x507e, 0x5043, - 0x5055, 0x5048, 0x504e, 0x506c, 0x507b, 0x50a5, 0x50a7, 0x50a9, - 0x50ba, 0x50d6, 0x5106, 0x50ed, 0x50ec, 0x50e6, 0x50ee, 0x5107, - 0x510b, 0x4edd, 0x6c3d, 0x4f58, 0x4f65, 0x4fce, 0x9fa0, 0x6c46, - 0x7c74, 0x516e, 0x5dfd, 0x9ec9, 0x9998, 0x5181, 0x5914, 0x52f9, - 0x530d, 0x8a07, 0x5310, 0x51eb, 0x5919, 0x5155, 0x4ea0, 0x5156, - 0x4eb3, 0x886e, 0x88a4, 0x4eb5, 0x8114, 0x88d2, 0x7980, 0x5b34, - 0x8803, 0x7fb8, 0x51ab, 0x51b1, 0x51bd, 0x51bc, - /* 0x5a */ - 0x51c7, 0x5196, 0x51a2, 0x51a5, 0x8ba0, 0x8ba6, 0x8ba7, 0x8baa, - 0x8bb4, 0x8bb5, 0x8bb7, 0x8bc2, 0x8bc3, 0x8bcb, 0x8bcf, 0x8bce, - 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd6, 0x8bd8, 0x8bd9, 0x8bdc, 0x8bdf, - 0x8be0, 0x8be4, 0x8be8, 0x8be9, 0x8bee, 0x8bf0, 0x8bf3, 0x8bf6, - 0x8bf9, 0x8bfc, 0x8bff, 0x8c00, 0x8c02, 0x8c04, 0x8c07, 0x8c0c, - 0x8c0f, 0x8c11, 0x8c12, 0x8c14, 0x8c15, 0x8c16, 0x8c19, 0x8c1b, - 0x8c18, 0x8c1d, 0x8c1f, 0x8c20, 0x8c21, 0x8c25, 0x8c27, 0x8c2a, - 0x8c2b, 0x8c2e, 0x8c2f, 0x8c32, 0x8c33, 0x8c35, 0x8c36, 0x5369, - 0x537a, 0x961d, 0x9622, 0x9621, 0x9631, 0x962a, 0x963d, 0x963c, - 0x9642, 0x9649, 0x9654, 0x965f, 0x9667, 0x966c, 0x9672, 0x9674, - 0x9688, 0x968d, 0x9697, 0x96b0, 0x9097, 0x909b, 0x909d, 0x9099, - 0x90ac, 0x90a1, 0x90b4, 0x90b3, 0x90b6, 0x90ba, - /* 0x5b */ - 0x90b8, 0x90b0, 0x90cf, 0x90c5, 0x90be, 0x90d0, 0x90c4, 0x90c7, - 0x90d3, 0x90e6, 0x90e2, 0x90dc, 0x90d7, 0x90db, 0x90eb, 0x90ef, - 0x90fe, 0x9104, 0x9122, 0x911e, 0x9123, 0x9131, 0x912f, 0x9139, - 0x9143, 0x9146, 0x520d, 0x5942, 0x52a2, 0x52ac, 0x52ad, 0x52be, - 0x54ff, 0x52d0, 0x52d6, 0x52f0, 0x53df, 0x71ee, 0x77cd, 0x5ef4, - 0x51f5, 0x51fc, 0x9b2f, 0x53b6, 0x5f01, 0x755a, 0x5def, 0x574c, - 0x57a9, 0x57a1, 0x587e, 0x58bc, 0x58c5, 0x58d1, 0x5729, 0x572c, - 0x572a, 0x5733, 0x5739, 0x572e, 0x572f, 0x575c, 0x573b, 0x5742, - 0x5769, 0x5785, 0x576b, 0x5786, 0x577c, 0x577b, 0x5768, 0x576d, - 0x5776, 0x5773, 0x57ad, 0x57a4, 0x578c, 0x57b2, 0x57cf, 0x57a7, - 0x57b4, 0x5793, 0x57a0, 0x57d5, 0x57d8, 0x57da, 0x57d9, 0x57d2, - 0x57b8, 0x57f4, 0x57ef, 0x57f8, 0x57e4, 0x57dd, - /* 0x5c */ - 0x580b, 0x580d, 0x57fd, 0x57ed, 0x5800, 0x581e, 0x5819, 0x5844, - 0x5820, 0x5865, 0x586c, 0x5881, 0x5889, 0x589a, 0x5880, 0x99a8, - 0x9f19, 0x61ff, 0x8279, 0x827d, 0x827f, 0x828f, 0x828a, 0x82a8, - 0x8284, 0x828e, 0x8291, 0x8297, 0x8299, 0x82ab, 0x82b8, 0x82be, - 0x82b0, 0x82c8, 0x82ca, 0x82e3, 0x8298, 0x82b7, 0x82ae, 0x82cb, - 0x82cc, 0x82c1, 0x82a9, 0x82b4, 0x82a1, 0x82aa, 0x829f, 0x82c4, - 0x82ce, 0x82a4, 0x82e1, 0x8309, 0x82f7, 0x82e4, 0x830f, 0x8307, - 0x82dc, 0x82f4, 0x82d2, 0x82d8, 0x830c, 0x82fb, 0x82d3, 0x8311, - 0x831a, 0x8306, 0x8314, 0x8315, 0x82e0, 0x82d5, 0x831c, 0x8351, - 0x835b, 0x835c, 0x8308, 0x8392, 0x833c, 0x8334, 0x8331, 0x839b, - 0x835e, 0x832f, 0x834f, 0x8347, 0x8343, 0x835f, 0x8340, 0x8317, - 0x8360, 0x832d, 0x833a, 0x8333, 0x8366, 0x8365, - /* 0x5d */ - 0x8368, 0x831b, 0x8369, 0x836c, 0x836a, 0x836d, 0x836e, 0x83b0, - 0x8378, 0x83b3, 0x83b4, 0x83a0, 0x83aa, 0x8393, 0x839c, 0x8385, - 0x837c, 0x83b6, 0x83a9, 0x837d, 0x83b8, 0x837b, 0x8398, 0x839e, - 0x83a8, 0x83ba, 0x83bc, 0x83c1, 0x8401, 0x83e5, 0x83d8, 0x5807, - 0x8418, 0x840b, 0x83dd, 0x83fd, 0x83d6, 0x841c, 0x8438, 0x8411, - 0x8406, 0x83d4, 0x83df, 0x840f, 0x8403, 0x83f8, 0x83f9, 0x83ea, - 0x83c5, 0x83c0, 0x8426, 0x83f0, 0x83e1, 0x845c, 0x8451, 0x845a, - 0x8459, 0x8473, 0x8487, 0x8488, 0x847a, 0x8489, 0x8478, 0x843c, - 0x8446, 0x8469, 0x8476, 0x848c, 0x848e, 0x8431, 0x846d, 0x84c1, - 0x84cd, 0x84d0, 0x84e6, 0x84bd, 0x84d3, 0x84ca, 0x84bf, 0x84ba, - 0x84e0, 0x84a1, 0x84b9, 0x84b4, 0x8497, 0x84e5, 0x84e3, 0x850c, - 0x750d, 0x8538, 0x84f0, 0x8539, 0x851f, 0x853a, - /* 0x5e */ - 0x8556, 0x853b, 0x84ff, 0x84fc, 0x8559, 0x8548, 0x8568, 0x8564, - 0x855e, 0x857a, 0x77a2, 0x8543, 0x8572, 0x857b, 0x85a4, 0x85a8, - 0x8587, 0x858f, 0x8579, 0x85ae, 0x859c, 0x8585, 0x85b9, 0x85b7, - 0x85b0, 0x85d3, 0x85c1, 0x85dc, 0x85ff, 0x8627, 0x8605, 0x8629, - 0x8616, 0x863c, 0x5efe, 0x5f08, 0x593c, 0x5941, 0x8037, 0x5955, - 0x595a, 0x5958, 0x530f, 0x5c22, 0x5c25, 0x5c2c, 0x5c34, 0x624c, - 0x626a, 0x629f, 0x62bb, 0x62ca, 0x62da, 0x62d7, 0x62ee, 0x6322, - 0x62f6, 0x6339, 0x634b, 0x6343, 0x63ad, 0x63f6, 0x6371, 0x637a, - 0x638e, 0x63b4, 0x636d, 0x63ac, 0x638a, 0x6369, 0x63ae, 0x63bc, - 0x63f2, 0x63f8, 0x63e0, 0x63ff, 0x63c4, 0x63de, 0x63ce, 0x6452, - 0x63c6, 0x63be, 0x6445, 0x6441, 0x640b, 0x641b, 0x6420, 0x640c, - 0x6426, 0x6421, 0x645e, 0x6484, 0x646d, 0x6496, - /* 0x5f */ - 0x647a, 0x64b7, 0x64b8, 0x6499, 0x64ba, 0x64c0, 0x64d0, 0x64d7, - 0x64e4, 0x64e2, 0x6509, 0x6525, 0x652e, 0x5f0b, 0x5fd2, 0x7519, - 0x5f11, 0x535f, 0x53f1, 0x53fd, 0x53e9, 0x53e8, 0x53fb, 0x5412, - 0x5416, 0x5406, 0x544b, 0x5452, 0x5453, 0x5454, 0x5456, 0x5443, - 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, 0x5477, - 0x5471, 0x5464, 0x549a, 0x549b, 0x5484, 0x5476, 0x5466, 0x549d, - 0x54d0, 0x54ad, 0x54c2, 0x54b4, 0x54d2, 0x54a7, 0x54a6, 0x54d3, - 0x54d4, 0x5472, 0x54a3, 0x54d5, 0x54bb, 0x54bf, 0x54cc, 0x54d9, - 0x54da, 0x54dc, 0x54a9, 0x54aa, 0x54a4, 0x54dd, 0x54cf, 0x54de, - 0x551b, 0x54e7, 0x5520, 0x54fd, 0x5514, 0x54f3, 0x5522, 0x5523, - 0x550f, 0x5511, 0x5527, 0x552a, 0x5567, 0x558f, 0x55b5, 0x5549, - 0x556d, 0x5541, 0x5555, 0x553f, 0x5550, 0x553c, - /* 0x60 */ - 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, 0x555c, - 0x558b, 0x55d2, 0x5583, 0x55b1, 0x55b9, 0x5588, 0x5581, 0x559f, - 0x557e, 0x55d6, 0x5591, 0x557b, 0x55df, 0x55bd, 0x55be, 0x5594, - 0x5599, 0x55ea, 0x55f7, 0x55c9, 0x561f, 0x55d1, 0x55eb, 0x55ec, - 0x55d4, 0x55e6, 0x55dd, 0x55c4, 0x55ef, 0x55e5, 0x55f2, 0x55f3, - 0x55cc, 0x55cd, 0x55e8, 0x55f5, 0x55e4, 0x8f94, 0x561e, 0x5608, - 0x560c, 0x5601, 0x5624, 0x5623, 0x55fe, 0x5600, 0x5627, 0x562d, - 0x5658, 0x5639, 0x5657, 0x562c, 0x564d, 0x5662, 0x5659, 0x565c, - 0x564c, 0x5654, 0x5686, 0x5664, 0x5671, 0x566b, 0x567b, 0x567c, - 0x5685, 0x5693, 0x56af, 0x56d4, 0x56d7, 0x56dd, 0x56e1, 0x56f5, - 0x56eb, 0x56f9, 0x56ff, 0x5704, 0x570a, 0x5709, 0x571c, 0x5e0f, - 0x5e19, 0x5e14, 0x5e11, 0x5e31, 0x5e3b, 0x5e3c, - /* 0x61 */ - 0x5e37, 0x5e44, 0x5e54, 0x5e5b, 0x5e5e, 0x5e61, 0x5c8c, 0x5c7a, - 0x5c8d, 0x5c90, 0x5c96, 0x5c88, 0x5c98, 0x5c99, 0x5c91, 0x5c9a, - 0x5c9c, 0x5cb5, 0x5ca2, 0x5cbd, 0x5cac, 0x5cab, 0x5cb1, 0x5ca3, - 0x5cc1, 0x5cb7, 0x5cc4, 0x5cd2, 0x5ce4, 0x5ccb, 0x5ce5, 0x5d02, - 0x5d03, 0x5d27, 0x5d26, 0x5d2e, 0x5d24, 0x5d1e, 0x5d06, 0x5d1b, - 0x5d58, 0x5d3e, 0x5d34, 0x5d3d, 0x5d6c, 0x5d5b, 0x5d6f, 0x5d5d, - 0x5d6b, 0x5d4b, 0x5d4a, 0x5d69, 0x5d74, 0x5d82, 0x5d99, 0x5d9d, - 0x8c73, 0x5db7, 0x5dc5, 0x5f73, 0x5f77, 0x5f82, 0x5f87, 0x5f89, - 0x5f8c, 0x5f95, 0x5f99, 0x5f9c, 0x5fa8, 0x5fad, 0x5fb5, 0x5fbc, - 0x8862, 0x5f61, 0x72ad, 0x72b0, 0x72b4, 0x72b7, 0x72b8, 0x72c3, - 0x72c1, 0x72ce, 0x72cd, 0x72d2, 0x72e8, 0x72ef, 0x72e9, 0x72f2, - 0x72f4, 0x72f7, 0x7301, 0x72f3, 0x7303, 0x72fa, - /* 0x62 */ - 0x72fb, 0x7317, 0x7313, 0x7321, 0x730a, 0x731e, 0x731d, 0x7315, - 0x7322, 0x7339, 0x7325, 0x732c, 0x7338, 0x7331, 0x7350, 0x734d, - 0x7357, 0x7360, 0x736c, 0x736f, 0x737e, 0x821b, 0x5925, 0x98e7, - 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, - 0x996c, 0x9974, 0x9977, 0x997d, 0x9980, 0x9984, 0x9987, 0x998a, - 0x998d, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5e80, 0x5e91, - 0x5e8b, 0x5e96, 0x5ea5, 0x5ea0, 0x5eb9, 0x5eb5, 0x5ebe, 0x5eb3, - 0x8d53, 0x5ed2, 0x5ed1, 0x5edb, 0x5ee8, 0x5eea, 0x81ba, 0x5fc4, - 0x5fc9, 0x5fd6, 0x5fcf, 0x6003, 0x5fee, 0x6004, 0x5fe1, 0x5fe4, - 0x5ffe, 0x6005, 0x6006, 0x5fea, 0x5fed, 0x5ff8, 0x6019, 0x6035, - 0x6026, 0x601b, 0x600f, 0x600d, 0x6029, 0x602b, 0x600a, 0x603f, - 0x6021, 0x6078, 0x6079, 0x607b, 0x607a, 0x6042, - /* 0x63 */ - 0x606a, 0x607d, 0x6096, 0x609a, 0x60ad, 0x609d, 0x6083, 0x6092, - 0x608c, 0x609b, 0x60ec, 0x60bb, 0x60b1, 0x60dd, 0x60d8, 0x60c6, - 0x60da, 0x60b4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60f4, 0x6100, - 0x610e, 0x612b, 0x614a, 0x6175, 0x61ac, 0x6194, 0x61a7, 0x61b7, - 0x61d4, 0x61f5, 0x5fdd, 0x96b3, 0x95e9, 0x95eb, 0x95f1, 0x95f3, - 0x95f5, 0x95f6, 0x95fc, 0x95fe, 0x9603, 0x9604, 0x9606, 0x9608, - 0x960a, 0x960b, 0x960c, 0x960d, 0x960f, 0x9612, 0x9615, 0x9616, - 0x9617, 0x9619, 0x961a, 0x4e2c, 0x723f, 0x6215, 0x6c35, 0x6c54, - 0x6c5c, 0x6c4a, 0x6ca3, 0x6c85, 0x6c90, 0x6c94, 0x6c8c, 0x6c68, - 0x6c69, 0x6c74, 0x6c76, 0x6c86, 0x6ca9, 0x6cd0, 0x6cd4, 0x6cad, - 0x6cf7, 0x6cf8, 0x6cf1, 0x6cd7, 0x6cb2, 0x6ce0, 0x6cd6, 0x6cfa, - 0x6ceb, 0x6cee, 0x6cb1, 0x6cd3, 0x6cef, 0x6cfe, - /* 0x64 */ - 0x6d39, 0x6d27, 0x6d0c, 0x6d43, 0x6d48, 0x6d07, 0x6d04, 0x6d19, - 0x6d0e, 0x6d2b, 0x6d4d, 0x6d2e, 0x6d35, 0x6d1a, 0x6d4f, 0x6d52, - 0x6d54, 0x6d33, 0x6d91, 0x6d6f, 0x6d9e, 0x6da0, 0x6d5e, 0x6d93, - 0x6d94, 0x6d5c, 0x6d60, 0x6d7c, 0x6d63, 0x6e1a, 0x6dc7, 0x6dc5, - 0x6dde, 0x6e0e, 0x6dbf, 0x6de0, 0x6e11, 0x6de6, 0x6ddd, 0x6dd9, - 0x6e16, 0x6dab, 0x6e0c, 0x6dae, 0x6e2b, 0x6e6e, 0x6e4e, 0x6e6b, - 0x6eb2, 0x6e5f, 0x6e86, 0x6e53, 0x6e54, 0x6e32, 0x6e25, 0x6e44, - 0x6edf, 0x6eb1, 0x6e98, 0x6ee0, 0x6f2d, 0x6ee2, 0x6ea5, 0x6ea7, - 0x6ebd, 0x6ebb, 0x6eb7, 0x6ed7, 0x6eb4, 0x6ecf, 0x6e8f, 0x6ec2, - 0x6e9f, 0x6f62, 0x6f46, 0x6f47, 0x6f24, 0x6f15, 0x6ef9, 0x6f2f, - 0x6f36, 0x6f4b, 0x6f74, 0x6f2a, 0x6f09, 0x6f29, 0x6f89, 0x6f8d, - 0x6f8c, 0x6f78, 0x6f72, 0x6f7c, 0x6f7a, 0x6fd1, - /* 0x65 */ - 0x6fc9, 0x6fa7, 0x6fb9, 0x6fb6, 0x6fc2, 0x6fe1, 0x6fee, 0x6fde, - 0x6fe0, 0x6fef, 0x701a, 0x7023, 0x701b, 0x7039, 0x7035, 0x704f, - 0x705e, 0x5b80, 0x5b84, 0x5b95, 0x5b93, 0x5ba5, 0x5bb8, 0x752f, - 0x9a9e, 0x6434, 0x5be4, 0x5bee, 0x8930, 0x5bf0, 0x8e47, 0x8b07, - 0x8fb6, 0x8fd3, 0x8fd5, 0x8fe5, 0x8fee, 0x8fe4, 0x8fe9, 0x8fe6, - 0x8ff3, 0x8fe8, 0x9005, 0x9004, 0x900b, 0x9026, 0x9011, 0x900d, - 0x9016, 0x9021, 0x9035, 0x9036, 0x902d, 0x902f, 0x9044, 0x9051, - 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905b, 0x66b9, 0x9074, - 0x907d, 0x9082, 0x9088, 0x9083, 0x908b, 0x5f50, 0x5f57, 0x5f56, - 0x5f58, 0x5c3b, 0x54ab, 0x5c50, 0x5c59, 0x5b71, 0x5c63, 0x5c66, - 0x7fbc, 0x5f2a, 0x5f29, 0x5f2d, 0x8274, 0x5f3c, 0x9b3b, 0x5c6e, - 0x5981, 0x5983, 0x598d, 0x59a9, 0x59aa, 0x59a3, - /* 0x66 */ - 0x5997, 0x59ca, 0x59ab, 0x599e, 0x59a4, 0x59d2, 0x59b2, 0x59af, - 0x59d7, 0x59be, 0x5a05, 0x5a06, 0x59dd, 0x5a08, 0x59e3, 0x59d8, - 0x59f9, 0x5a0c, 0x5a09, 0x5a32, 0x5a34, 0x5a11, 0x5a23, 0x5a13, - 0x5a40, 0x5a67, 0x5a4a, 0x5a55, 0x5a3c, 0x5a62, 0x5a75, 0x80ec, - 0x5aaa, 0x5a9b, 0x5a77, 0x5a7a, 0x5abe, 0x5aeb, 0x5ab2, 0x5ad2, - 0x5ad4, 0x5ab8, 0x5ae0, 0x5ae3, 0x5af1, 0x5ad6, 0x5ae6, 0x5ad8, - 0x5adc, 0x5b09, 0x5b17, 0x5b16, 0x5b32, 0x5b37, 0x5b40, 0x5c15, - 0x5c1c, 0x5b5a, 0x5b65, 0x5b73, 0x5b51, 0x5b53, 0x5b62, 0x9a75, - 0x9a77, 0x9a78, 0x9a7a, 0x9a7f, 0x9a7d, 0x9a80, 0x9a81, 0x9a85, - 0x9a88, 0x9a8a, 0x9a90, 0x9a92, 0x9a93, 0x9a96, 0x9a98, 0x9a9b, - 0x9a9c, 0x9a9d, 0x9a9f, 0x9aa0, 0x9aa2, 0x9aa3, 0x9aa5, 0x9aa7, - 0x7e9f, 0x7ea1, 0x7ea3, 0x7ea5, 0x7ea8, 0x7ea9, - /* 0x67 */ - 0x7ead, 0x7eb0, 0x7ebe, 0x7ec0, 0x7ec1, 0x7ec2, 0x7ec9, 0x7ecb, - 0x7ecc, 0x7ed0, 0x7ed4, 0x7ed7, 0x7edb, 0x7ee0, 0x7ee1, 0x7ee8, - 0x7eeb, 0x7eee, 0x7eef, 0x7ef1, 0x7ef2, 0x7f0d, 0x7ef6, 0x7efa, - 0x7efb, 0x7efe, 0x7f01, 0x7f02, 0x7f03, 0x7f07, 0x7f08, 0x7f0b, - 0x7f0c, 0x7f0f, 0x7f11, 0x7f12, 0x7f17, 0x7f19, 0x7f1c, 0x7f1b, - 0x7f1f, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27, - 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2f, 0x7f30, 0x7f31, 0x7f32, - 0x7f33, 0x7f35, 0x5e7a, 0x757f, 0x5ddb, 0x753e, 0x9095, 0x738e, - 0x7391, 0x73ae, 0x73a2, 0x739f, 0x73cf, 0x73c2, 0x73d1, 0x73b7, - 0x73b3, 0x73c0, 0x73c9, 0x73c8, 0x73e5, 0x73d9, 0x987c, 0x740a, - 0x73e9, 0x73e7, 0x73de, 0x73ba, 0x73f2, 0x740f, 0x742a, 0x745b, - 0x7426, 0x7425, 0x7428, 0x7430, 0x742e, 0x742c, - /* 0x68 */ - 0x741b, 0x741a, 0x7441, 0x745c, 0x7457, 0x7455, 0x7459, 0x7477, - 0x746d, 0x747e, 0x749c, 0x748e, 0x7480, 0x7481, 0x7487, 0x748b, - 0x749e, 0x74a8, 0x74a9, 0x7490, 0x74a7, 0x74d2, 0x74ba, 0x97ea, - 0x97eb, 0x97ec, 0x674c, 0x6753, 0x675e, 0x6748, 0x6769, 0x67a5, - 0x6787, 0x676a, 0x6773, 0x6798, 0x67a7, 0x6775, 0x67a8, 0x679e, - 0x67ad, 0x678b, 0x6777, 0x677c, 0x67f0, 0x6809, 0x67d8, 0x680a, - 0x67e9, 0x67b0, 0x680c, 0x67d9, 0x67b5, 0x67da, 0x67b3, 0x67dd, - 0x6800, 0x67c3, 0x67b8, 0x67e2, 0x680e, 0x67c1, 0x67fd, 0x6832, - 0x6833, 0x6860, 0x6861, 0x684e, 0x6862, 0x6844, 0x6864, 0x6883, - 0x681d, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683e, 0x684a, - 0x6849, 0x6829, 0x68b5, 0x688f, 0x6874, 0x6877, 0x6893, 0x686b, - 0x68c2, 0x696e, 0x68fc, 0x691f, 0x6920, 0x68f9, - /* 0x69 */ - 0x6924, 0x68f0, 0x690b, 0x6901, 0x6957, 0x68e3, 0x6910, 0x6971, - 0x6939, 0x6960, 0x6942, 0x695d, 0x6984, 0x696b, 0x6980, 0x6998, - 0x6978, 0x6934, 0x69cc, 0x6987, 0x6988, 0x69ce, 0x6989, 0x6966, - 0x6963, 0x6979, 0x699b, 0x69a7, 0x69bb, 0x69ab, 0x69ad, 0x69d4, - 0x69b1, 0x69c1, 0x69ca, 0x69df, 0x6995, 0x69e0, 0x698d, 0x69ff, - 0x6a2f, 0x69ed, 0x6a17, 0x6a18, 0x6a65, 0x69f2, 0x6a44, 0x6a3e, - 0x6aa0, 0x6a50, 0x6a5b, 0x6a35, 0x6a8e, 0x6a79, 0x6a3d, 0x6a28, - 0x6a58, 0x6a7c, 0x6a91, 0x6a90, 0x6aa9, 0x6a97, 0x6aab, 0x7337, - 0x7352, 0x6b81, 0x6b82, 0x6b87, 0x6b84, 0x6b92, 0x6b93, 0x6b8d, - 0x6b9a, 0x6b9b, 0x6ba1, 0x6baa, 0x8f6b, 0x8f6d, 0x8f71, 0x8f72, - 0x8f73, 0x8f75, 0x8f76, 0x8f78, 0x8f77, 0x8f79, 0x8f7a, 0x8f7c, - 0x8f7e, 0x8f81, 0x8f82, 0x8f84, 0x8f87, 0x8f8b, - /* 0x6a */ - 0x8f8d, 0x8f8e, 0x8f8f, 0x8f98, 0x8f9a, 0x8ece, 0x620b, 0x6217, - 0x621b, 0x621f, 0x6222, 0x6221, 0x6225, 0x6224, 0x622c, 0x81e7, - 0x74ef, 0x74f4, 0x74ff, 0x750f, 0x7511, 0x7513, 0x6534, 0x65ee, - 0x65ef, 0x65f0, 0x660a, 0x6619, 0x6772, 0x6603, 0x6615, 0x6600, - 0x7085, 0x66f7, 0x661d, 0x6634, 0x6631, 0x6636, 0x6635, 0x8006, - 0x665f, 0x6654, 0x6641, 0x664f, 0x6656, 0x6661, 0x6657, 0x6677, - 0x6684, 0x668c, 0x66a7, 0x669d, 0x66be, 0x66db, 0x66dc, 0x66e6, - 0x66e9, 0x8d32, 0x8d33, 0x8d36, 0x8d3b, 0x8d3d, 0x8d40, 0x8d45, - 0x8d46, 0x8d48, 0x8d49, 0x8d47, 0x8d4d, 0x8d55, 0x8d59, 0x89c7, - 0x89ca, 0x89cb, 0x89cc, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x726e, - 0x729f, 0x725d, 0x7266, 0x726f, 0x727e, 0x727f, 0x7284, 0x728b, - 0x728d, 0x728f, 0x7292, 0x6308, 0x6332, 0x63b0, - /* 0x6b */ - 0x643f, 0x64d8, 0x8004, 0x6bea, 0x6bf3, 0x6bfd, 0x6bf5, 0x6bf9, - 0x6c05, 0x6c07, 0x6c06, 0x6c0d, 0x6c15, 0x6c18, 0x6c19, 0x6c1a, - 0x6c21, 0x6c29, 0x6c24, 0x6c2a, 0x6c32, 0x6535, 0x6555, 0x656b, - 0x724d, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809f, 0x809c, - 0x8093, 0x80bc, 0x670a, 0x80bd, 0x80b1, 0x80ab, 0x80ad, 0x80b4, - 0x80b7, 0x80e7, 0x80e8, 0x80e9, 0x80ea, 0x80db, 0x80c2, 0x80c4, - 0x80d9, 0x80cd, 0x80d7, 0x6710, 0x80dd, 0x80eb, 0x80f1, 0x80f4, - 0x80ed, 0x810d, 0x810e, 0x80f2, 0x80fc, 0x6715, 0x8112, 0x8c5a, - 0x8136, 0x811e, 0x812c, 0x8118, 0x8132, 0x8148, 0x814c, 0x8153, - 0x8174, 0x8159, 0x815a, 0x8171, 0x8160, 0x8169, 0x817c, 0x817d, - 0x816d, 0x8167, 0x584d, 0x5ab5, 0x8188, 0x8182, 0x8191, 0x6ed5, - 0x81a3, 0x81aa, 0x81cc, 0x6726, 0x81ca, 0x81bb, - /* 0x6c */ - 0x81c1, 0x81a6, 0x6b24, 0x6b37, 0x6b39, 0x6b43, 0x6b46, 0x6b59, - 0x98d1, 0x98d2, 0x98d3, 0x98d5, 0x98d9, 0x98da, 0x6bb3, 0x5f40, - 0x6bc2, 0x89f3, 0x6590, 0x9f51, 0x6593, 0x65bc, 0x65c6, 0x65c4, - 0x65c3, 0x65cc, 0x65ce, 0x65d2, 0x65d6, 0x7080, 0x709c, 0x7096, - 0x709d, 0x70bb, 0x70c0, 0x70b7, 0x70ab, 0x70b1, 0x70e8, 0x70ca, - 0x7110, 0x7113, 0x7116, 0x712f, 0x7131, 0x7173, 0x715c, 0x7168, - 0x7145, 0x7172, 0x714a, 0x7178, 0x717a, 0x7198, 0x71b3, 0x71b5, - 0x71a8, 0x71a0, 0x71e0, 0x71d4, 0x71e7, 0x71f9, 0x721d, 0x7228, - 0x706c, 0x7118, 0x7166, 0x71b9, 0x623e, 0x623d, 0x6243, 0x6248, - 0x6249, 0x793b, 0x7940, 0x7946, 0x7949, 0x795b, 0x795c, 0x7953, - 0x795a, 0x7962, 0x7957, 0x7960, 0x796f, 0x7967, 0x797a, 0x7985, - 0x798a, 0x799a, 0x79a7, 0x79b3, 0x5fd1, 0x5fd0, - /* 0x6d */ - 0x603c, 0x605d, 0x605a, 0x6067, 0x6041, 0x6059, 0x6063, 0x60ab, - 0x6106, 0x610d, 0x615d, 0x61a9, 0x619d, 0x61cb, 0x61d1, 0x6206, - 0x8080, 0x807f, 0x6c93, 0x6cf6, 0x6dfc, 0x77f6, 0x77f8, 0x7800, - 0x7809, 0x7817, 0x7818, 0x7811, 0x65ab, 0x782d, 0x781c, 0x781d, - 0x7839, 0x783a, 0x783b, 0x781f, 0x783c, 0x7825, 0x782c, 0x7823, - 0x7829, 0x784e, 0x786d, 0x7856, 0x7857, 0x7826, 0x7850, 0x7847, - 0x784c, 0x786a, 0x789b, 0x7893, 0x789a, 0x7887, 0x789c, 0x78a1, - 0x78a3, 0x78b2, 0x78b9, 0x78a5, 0x78d4, 0x78d9, 0x78c9, 0x78ec, - 0x78f2, 0x7905, 0x78f4, 0x7913, 0x7924, 0x791e, 0x7934, 0x9f9b, - 0x9ef9, 0x9efb, 0x9efc, 0x76f1, 0x7704, 0x770d, 0x76f9, 0x7707, - 0x7708, 0x771a, 0x7722, 0x7719, 0x772d, 0x7726, 0x7735, 0x7738, - 0x7750, 0x7751, 0x7747, 0x7743, 0x775a, 0x7768, - /* 0x6e */ - 0x7762, 0x7765, 0x777f, 0x778d, 0x777d, 0x7780, 0x778c, 0x7791, - 0x779f, 0x77a0, 0x77b0, 0x77b5, 0x77bd, 0x753a, 0x7540, 0x754e, - 0x754b, 0x7548, 0x755b, 0x7572, 0x7579, 0x7583, 0x7f58, 0x7f61, - 0x7f5f, 0x8a48, 0x7f68, 0x7f74, 0x7f71, 0x7f79, 0x7f81, 0x7f7e, - 0x76cd, 0x76e5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948b, 0x948a, - 0x948c, 0x948d, 0x948f, 0x9490, 0x9494, 0x9497, 0x9495, 0x949a, - 0x949b, 0x949c, 0x94a3, 0x94a4, 0x94ab, 0x94aa, 0x94ad, 0x94ac, - 0x94af, 0x94b0, 0x94b2, 0x94b4, 0x94b6, 0x94b7, 0x94b8, 0x94b9, - 0x94ba, 0x94bc, 0x94bd, 0x94bf, 0x94c4, 0x94c8, 0x94c9, 0x94ca, - 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94d0, 0x94d1, 0x94d2, 0x94d5, - 0x94d6, 0x94d7, 0x94d9, 0x94d8, 0x94db, 0x94de, 0x94df, 0x94e0, - 0x94e2, 0x94e4, 0x94e5, 0x94e7, 0x94e8, 0x94ea, - /* 0x6f */ - 0x94e9, 0x94eb, 0x94ee, 0x94ef, 0x94f3, 0x94f4, 0x94f5, 0x94f7, - 0x94f9, 0x94fc, 0x94fd, 0x94ff, 0x9503, 0x9502, 0x9506, 0x9507, - 0x9509, 0x950a, 0x950d, 0x950e, 0x950f, 0x9512, 0x9513, 0x9514, - 0x9515, 0x9516, 0x9518, 0x951b, 0x951d, 0x951e, 0x951f, 0x9522, - 0x952a, 0x952b, 0x9529, 0x952c, 0x9531, 0x9532, 0x9534, 0x9536, - 0x9537, 0x9538, 0x953c, 0x953e, 0x953f, 0x9542, 0x9535, 0x9544, - 0x9545, 0x9546, 0x9549, 0x954c, 0x954e, 0x954f, 0x9552, 0x9553, - 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955b, 0x955e, 0x955f, - 0x955d, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, - 0x9569, 0x956a, 0x956b, 0x956c, 0x956f, 0x9571, 0x9572, 0x9573, - 0x953a, 0x77e7, 0x77ec, 0x96c9, 0x79d5, 0x79ed, 0x79e3, 0x79eb, - 0x7a06, 0x5d47, 0x7a03, 0x7a02, 0x7a1e, 0x7a14, - /* 0x70 */ - 0x7a39, 0x7a37, 0x7a51, 0x9ecf, 0x99a5, 0x7a70, 0x7688, 0x768e, - 0x7693, 0x7699, 0x76a4, 0x74de, 0x74e0, 0x752c, 0x9e20, 0x9e22, - 0x9e28, 0x9e29, 0x9e2a, 0x9e2b, 0x9e2c, 0x9e32, 0x9e31, 0x9e36, - 0x9e38, 0x9e37, 0x9e39, 0x9e3a, 0x9e3e, 0x9e41, 0x9e42, 0x9e44, - 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4b, 0x9e4c, 0x9e4e, 0x9e51, - 0x9e55, 0x9e57, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5e, 0x9e63, 0x9e66, - 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e71, 0x9e6d, - 0x9e73, 0x7592, 0x7594, 0x7596, 0x75a0, 0x759d, 0x75ac, 0x75a3, - 0x75b3, 0x75b4, 0x75b8, 0x75c4, 0x75b1, 0x75b0, 0x75c3, 0x75c2, - 0x75d6, 0x75cd, 0x75e3, 0x75e8, 0x75e6, 0x75e4, 0x75eb, 0x75e7, - 0x7603, 0x75f1, 0x75fc, 0x75ff, 0x7610, 0x7600, 0x7605, 0x760c, - 0x7617, 0x760a, 0x7625, 0x7618, 0x7615, 0x7619, - /* 0x71 */ - 0x761b, 0x763c, 0x7622, 0x7620, 0x7640, 0x762d, 0x7630, 0x763f, - 0x7635, 0x7643, 0x763e, 0x7633, 0x764d, 0x765e, 0x7654, 0x765c, - 0x7656, 0x766b, 0x766f, 0x7fca, 0x7ae6, 0x7a78, 0x7a79, 0x7a80, - 0x7a86, 0x7a88, 0x7a95, 0x7aa6, 0x7aa0, 0x7aac, 0x7aa8, 0x7aad, - 0x7ab3, 0x8864, 0x8869, 0x8872, 0x887d, 0x887f, 0x8882, 0x88a2, - 0x88c6, 0x88b7, 0x88bc, 0x88c9, 0x88e2, 0x88ce, 0x88e3, 0x88e5, - 0x88f1, 0x891a, 0x88fc, 0x88e8, 0x88fe, 0x88f0, 0x8921, 0x8919, - 0x8913, 0x891b, 0x890a, 0x8934, 0x892b, 0x8936, 0x8941, 0x8966, - 0x897b, 0x758b, 0x80e5, 0x76b2, 0x76b4, 0x77dc, 0x8012, 0x8014, - 0x8016, 0x801c, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, 0x8029, - 0x8028, 0x8031, 0x800b, 0x8035, 0x8043, 0x8046, 0x804d, 0x8052, - 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, - /* 0x72 */ - 0x9889, 0x988c, 0x988d, 0x988f, 0x9894, 0x989a, 0x989b, 0x989e, - 0x989f, 0x98a1, 0x98a2, 0x98a5, 0x98a6, 0x864d, 0x8654, 0x866c, - 0x866e, 0x867f, 0x867a, 0x867c, 0x867b, 0x86a8, 0x868d, 0x868b, - 0x86ac, 0x869d, 0x86a7, 0x86a3, 0x86aa, 0x8693, 0x86a9, 0x86b6, - 0x86c4, 0x86b5, 0x86ce, 0x86b0, 0x86ba, 0x86b1, 0x86af, 0x86c9, - 0x86cf, 0x86b4, 0x86e9, 0x86f1, 0x86f2, 0x86ed, 0x86f3, 0x86d0, - 0x8713, 0x86de, 0x86f4, 0x86df, 0x86d8, 0x86d1, 0x8703, 0x8707, - 0x86f8, 0x8708, 0x870a, 0x870d, 0x8709, 0x8723, 0x873b, 0x871e, - 0x8725, 0x872e, 0x871a, 0x873e, 0x8748, 0x8734, 0x8731, 0x8729, - 0x8737, 0x873f, 0x8782, 0x8722, 0x877d, 0x877e, 0x877b, 0x8760, - 0x8770, 0x874c, 0x876e, 0x878b, 0x8753, 0x8763, 0x877c, 0x8764, - 0x8759, 0x8765, 0x8793, 0x87af, 0x87a8, 0x87d2, - /* 0x73 */ - 0x87c6, 0x8788, 0x8785, 0x87ad, 0x8797, 0x8783, 0x87ab, 0x87e5, - 0x87ac, 0x87b5, 0x87b3, 0x87cb, 0x87d3, 0x87bd, 0x87d1, 0x87c0, - 0x87ca, 0x87db, 0x87ea, 0x87e0, 0x87ee, 0x8816, 0x8813, 0x87fe, - 0x880a, 0x881b, 0x8821, 0x8839, 0x883c, 0x7f36, 0x7f42, 0x7f44, - 0x7f45, 0x8210, 0x7afa, 0x7afd, 0x7b08, 0x7b03, 0x7b04, 0x7b15, - 0x7b0a, 0x7b2b, 0x7b0f, 0x7b47, 0x7b38, 0x7b2a, 0x7b19, 0x7b2e, - 0x7b31, 0x7b20, 0x7b25, 0x7b24, 0x7b33, 0x7b3e, 0x7b1e, 0x7b58, - 0x7b5a, 0x7b45, 0x7b75, 0x7b4c, 0x7b5d, 0x7b60, 0x7b6e, 0x7b7b, - 0x7b62, 0x7b72, 0x7b71, 0x7b90, 0x7ba6, 0x7ba7, 0x7bb8, 0x7bac, - 0x7b9d, 0x7ba8, 0x7b85, 0x7baa, 0x7b9c, 0x7ba2, 0x7bab, 0x7bb4, - 0x7bd1, 0x7bc1, 0x7bcc, 0x7bdd, 0x7bda, 0x7be5, 0x7be6, 0x7bea, - 0x7c0c, 0x7bfe, 0x7bfc, 0x7c0f, 0x7c16, 0x7c0b, - /* 0x74 */ - 0x7c1f, 0x7c2a, 0x7c26, 0x7c38, 0x7c41, 0x7c40, 0x81fe, 0x8201, - 0x8202, 0x8204, 0x81ec, 0x8844, 0x8221, 0x8222, 0x8223, 0x822d, - 0x822f, 0x8228, 0x822b, 0x8238, 0x823b, 0x8233, 0x8234, 0x823e, - 0x8244, 0x8249, 0x824b, 0x824f, 0x825a, 0x825f, 0x8268, 0x887e, - 0x8885, 0x8888, 0x88d8, 0x88df, 0x895e, 0x7f9d, 0x7f9f, 0x7fa7, - 0x7faf, 0x7fb0, 0x7fb2, 0x7c7c, 0x6549, 0x7c91, 0x7c9d, 0x7c9c, - 0x7c9e, 0x7ca2, 0x7cb2, 0x7cbc, 0x7cbd, 0x7cc1, 0x7cc7, 0x7ccc, - 0x7ccd, 0x7cc8, 0x7cc5, 0x7cd7, 0x7ce8, 0x826e, 0x66a8, 0x7fbf, - 0x7fce, 0x7fd5, 0x7fe5, 0x7fe1, 0x7fe6, 0x7fe9, 0x7fee, 0x7ff3, - 0x7cf8, 0x7d77, 0x7da6, 0x7dae, 0x7e47, 0x7e9b, 0x9eb8, 0x9eb4, - 0x8d73, 0x8d84, 0x8d94, 0x8d91, 0x8db1, 0x8d67, 0x8d6d, 0x8c47, - 0x8c49, 0x914a, 0x9150, 0x914e, 0x914f, 0x9164, - /* 0x75 */ - 0x9162, 0x9161, 0x9170, 0x9169, 0x916f, 0x917d, 0x917e, 0x9172, - 0x9174, 0x9179, 0x918c, 0x9185, 0x9190, 0x918d, 0x9191, 0x91a2, - 0x91a3, 0x91aa, 0x91ad, 0x91ae, 0x91af, 0x91b5, 0x91b4, 0x91ba, - 0x8c55, 0x9e7e, 0x8db8, 0x8deb, 0x8e05, 0x8e59, 0x8e69, 0x8db5, - 0x8dbf, 0x8dbc, 0x8dba, 0x8dc4, 0x8dd6, 0x8dd7, 0x8dda, 0x8dde, - 0x8dce, 0x8dcf, 0x8ddb, 0x8dc6, 0x8dec, 0x8df7, 0x8df8, 0x8de3, - 0x8df9, 0x8dfb, 0x8de4, 0x8e09, 0x8dfd, 0x8e14, 0x8e1d, 0x8e1f, - 0x8e2c, 0x8e2e, 0x8e23, 0x8e2f, 0x8e3a, 0x8e40, 0x8e39, 0x8e35, - 0x8e3d, 0x8e31, 0x8e49, 0x8e41, 0x8e42, 0x8e51, 0x8e52, 0x8e4a, - 0x8e70, 0x8e76, 0x8e7c, 0x8e6f, 0x8e74, 0x8e85, 0x8e8f, 0x8e94, - 0x8e90, 0x8e9c, 0x8e9e, 0x8c78, 0x8c82, 0x8c8a, 0x8c85, 0x8c98, - 0x8c94, 0x659b, 0x89d6, 0x89de, 0x89da, 0x89dc, - /* 0x76 */ - 0x89e5, 0x89eb, 0x89ef, 0x8a3e, 0x8b26, 0x9753, 0x96e9, 0x96f3, - 0x96ef, 0x9706, 0x9701, 0x9708, 0x970f, 0x970e, 0x972a, 0x972d, - 0x9730, 0x973e, 0x9f80, 0x9f83, 0x9f85, 0x9f86, 0x9f87, 0x9f88, - 0x9f89, 0x9f8a, 0x9f8c, 0x9efe, 0x9f0b, 0x9f0d, 0x96b9, 0x96bc, - 0x96bd, 0x96ce, 0x96d2, 0x77bf, 0x96e0, 0x928e, 0x92ae, 0x92c8, - 0x933e, 0x936a, 0x93ca, 0x938f, 0x943e, 0x946b, 0x9c7f, 0x9c82, - 0x9c85, 0x9c86, 0x9c87, 0x9c88, 0x7a23, 0x9c8b, 0x9c8e, 0x9c90, - 0x9c91, 0x9c92, 0x9c94, 0x9c95, 0x9c9a, 0x9c9b, 0x9c9e, 0x9c9f, - 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, - 0x9ca9, 0x9cab, 0x9cad, 0x9cae, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, - 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cba, 0x9cbb, 0x9cbc, 0x9cbd, - 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cca, 0x9ccb, - /* 0x77 */ - 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0x9cd0, 0x9cd3, 0x9cd4, 0x9cd5, - 0x9cd7, 0x9cd8, 0x9cd9, 0x9cdc, 0x9cdd, 0x9cdf, 0x9ce2, 0x977c, - 0x9785, 0x9791, 0x9792, 0x9794, 0x97af, 0x97ab, 0x97a3, 0x97b2, - 0x97b4, 0x9ab1, 0x9ab0, 0x9ab7, 0x9e58, 0x9ab6, 0x9aba, 0x9abc, - 0x9ac1, 0x9ac0, 0x9ac5, 0x9ac2, 0x9acb, 0x9acc, 0x9ad1, 0x9b45, - 0x9b43, 0x9b47, 0x9b49, 0x9b48, 0x9b4d, 0x9b51, 0x98e8, 0x990d, - 0x992e, 0x9955, 0x9954, 0x9adf, 0x9ae1, 0x9ae6, 0x9aef, 0x9aeb, - 0x9afb, 0x9aed, 0x9af9, 0x9b08, 0x9b0f, 0x9b13, 0x9b1f, 0x9b23, - 0x9ebd, 0x9ebe, 0x7e3b, 0x9e82, 0x9e87, 0x9e88, 0x9e8b, 0x9e92, - 0x93d6, 0x9e9d, 0x9e9f, 0x9edb, 0x9edc, 0x9edd, 0x9ee0, 0x9edf, - 0x9ee2, 0x9ee9, 0x9ee7, 0x9ee5, 0x9eea, 0x9eef, 0x9f22, 0x9f2c, - 0x9f2f, 0x9f39, 0x9f37, 0x9f3d, 0x9f3e, 0x9f44, -}; - -static int -gb2312_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = (s[0] & 0x7F); - if ((c1 >= 0x21 && c1 <= 0x29) || (c1 >= 0x30 && c1 <= 0x77)) { - if (n >= 2) { - unsigned char c2 = (s[1] & 0x7F); - if (c2 >= 0x21 && c2 < 0x7f) { - unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); - unsigned short wc = 0xfffd; - if (i < 1410) { - if (i < 831) - wc = gb2312_2uni_page21[i]; - } else { - if (i < 8178) - wc = gb2312_2uni_page30[i-1410]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short gb2312_2charset[7445] = { - 0x2168, 0x216c, 0x2127, 0x2163, 0x2140, 0x2141, 0x2824, 0x2822, - 0x2828, 0x2826, 0x283a, 0x282c, 0x282a, 0x2830, 0x282e, 0x2142, - 0x2834, 0x2832, 0x2839, 0x2821, 0x2825, 0x2827, 0x2829, 0x282d, - 0x2831, 0x2823, 0x282b, 0x282f, 0x2833, 0x2835, 0x2836, 0x2837, - 0x2838, 0x2126, 0x2125, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, - 0x2626, 0x2627, 0x2628, 0x2629, 0x262a, 0x262b, 0x262c, 0x262d, - 0x262e, 0x262f, 0x2630, 0x2631, 0x2632, 0x2633, 0x2634, 0x2635, - 0x2636, 0x2637, 0x2638, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, - 0x2646, 0x2647, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, 0x264d, - 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x2654, 0x2655, - 0x2656, 0x2657, 0x2658, 0x2727, 0x2721, 0x2722, 0x2723, 0x2724, - 0x2725, 0x2726, 0x2728, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, - 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, - 0x2736, 0x2737, 0x2738, 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, - 0x273e, 0x273f, 0x2740, 0x2741, 0x2751, 0x2752, 0x2753, 0x2754, - 0x2755, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, 0x275d, - 0x275e, 0x275f, 0x2760, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, - 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, 0x276d, - 0x276e, 0x276f, 0x2770, 0x2771, 0x2757, 0x212a, 0x212c, 0x212e, - 0x212f, 0x2130, 0x2131, 0x212d, 0x216b, 0x2164, 0x2165, 0x2179, - 0x2166, 0x216d, 0x2271, 0x2272, 0x2273, 0x2274, 0x2275, 0x2276, - 0x2277, 0x2278, 0x2279, 0x227a, 0x227b, 0x227c, 0x217b, 0x217c, - 0x217a, 0x217d, 0x214a, 0x2147, 0x2146, 0x214c, 0x2158, 0x215e, - 0x214f, 0x214e, 0x2144, 0x2145, 0x2149, 0x2148, 0x2152, 0x2153, - 0x2160, 0x215f, 0x2143, 0x214b, 0x2157, 0x2156, 0x2155, 0x2159, - 0x2154, 0x215c, 0x215d, 0x215a, 0x215b, 0x2151, 0x214d, 0x2150, - 0x2259, 0x225a, 0x225b, 0x225c, 0x225d, 0x225e, 0x225f, 0x2260, - 0x2261, 0x2262, 0x2245, 0x2246, 0x2247, 0x2248, 0x2249, 0x224a, - 0x224b, 0x224c, 0x224d, 0x224e, 0x224f, 0x2250, 0x2251, 0x2252, - 0x2253, 0x2254, 0x2255, 0x2256, 0x2257, 0x2258, 0x2231, 0x2232, - 0x2233, 0x2234, 0x2235, 0x2236, 0x2237, 0x2238, 0x2239, 0x223a, - 0x223b, 0x223c, 0x223d, 0x223e, 0x223f, 0x2240, 0x2241, 0x2242, - 0x2243, 0x2244, 0x2924, 0x2925, 0x2926, 0x2927, 0x2928, 0x2929, - 0x292a, 0x292b, 0x292c, 0x292d, 0x292e, 0x292f, 0x2930, 0x2931, - 0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, - 0x293a, 0x293b, 0x293c, 0x293d, 0x293e, 0x293f, 0x2940, 0x2941, - 0x2942, 0x2943, 0x2944, 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, - 0x294a, 0x294b, 0x294c, 0x294d, 0x294e, 0x294f, 0x2950, 0x2951, - 0x2952, 0x2953, 0x2954, 0x2955, 0x2956, 0x2957, 0x2958, 0x2959, - 0x295a, 0x295b, 0x295c, 0x295d, 0x295e, 0x295f, 0x2960, 0x2961, - 0x2962, 0x2963, 0x2964, 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, - 0x296a, 0x296b, 0x296c, 0x296d, 0x296e, 0x296f, 0x2176, 0x2175, - 0x2178, 0x2177, 0x2174, 0x2173, 0x2170, 0x2172, 0x2171, 0x216f, - 0x216e, 0x2162, 0x2161, 0x2121, 0x2122, 0x2123, 0x2128, 0x2129, - 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213a, 0x213b, - 0x213e, 0x213f, 0x217e, 0x2132, 0x2133, 0x213c, 0x213d, 0x2421, - 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, - 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, - 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, - 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, - 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, - 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, - 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, - 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, - 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, - 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, - 0x2472, 0x2473, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, - 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, - 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, - 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, - 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, - 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, - 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, - 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, - 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, - 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, - 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, - 0x2124, 0x2845, 0x2846, 0x2847, 0x2848, 0x2849, 0x284a, 0x284b, - 0x284c, 0x284d, 0x284e, 0x284f, 0x2850, 0x2851, 0x2852, 0x2853, - 0x2854, 0x2855, 0x2856, 0x2857, 0x2858, 0x2859, 0x285a, 0x285b, - 0x285c, 0x285d, 0x285e, 0x285f, 0x2860, 0x2861, 0x2862, 0x2863, - 0x2864, 0x2865, 0x2866, 0x2867, 0x2868, 0x2869, 0x2265, 0x2266, - 0x2267, 0x2268, 0x2269, 0x226a, 0x226b, 0x226c, 0x226d, 0x226e, - 0x523b, 0x3621, 0x465f, 0x4d72, 0x5549, 0x487d, 0x494f, 0x4f42, - 0x5822, 0x323b, 0x536b, 0x5824, 0x3373, 0x5728, 0x4752, 0x5827, - 0x4a40, 0x4770, 0x317b, 0x5235, 0x3454, 0x362b, 0x4b3f, 0x5829, - 0x362a, 0x413d, 0x514f, 0x4925, 0x582d, 0x3876, 0x513e, 0x635c, - 0x5650, 0x3761, 0x342e, 0x4159, 0x583c, 0x4d68, 0x3524, 0x4e2a, - 0x5677, 0x4076, 0x3e59, 0x582f, 0x444b, 0x3e43, 0x5831, 0x4334, - 0x5265, 0x562e, 0x4e5a, 0x5527, 0x3a75, 0x3726, 0x4056, 0x4639, - 0x4552, 0x4747, 0x3954, 0x334b, 0x5252, 0x583f, 0x3e45, 0x4672, - 0x5232, 0x4f30, 0x4f67, 0x4a69, 0x5840, 0x4272, 0x4252, 0x4869, - 0x472c, 0x414b, 0x5368, 0x5579, 0x4a42, 0x367e, 0x5821, 0x535a, - 0x3f77, 0x5446, 0x3b25, 0x5841, 0x4e65, 0x3e2e, 0x5828, 0x5147, - 0x5029, 0x583d, 0x596f, 0x4d76, 0x3f3a, 0x3d3b, 0x3a25, 0x5260, - 0x327a, 0x3a60, 0x4436, 0x4f6d, 0x3e29, 0x4d24, 0x4141, 0x4757, - 0x5971, 0x5974, 0x484b, 0x5869, 0x525a, 0x4a32, 0x484a, 0x586c, - 0x586a, 0x5846, 0x3d76, 0x464d, 0x3370, 0x586b, 0x3d71, 0x3d69, - 0x4854, 0x3453, 0x4258, 0x3256, 0x5750, 0x4a4b, 0x4b7b, 0x554c, - 0x3836, 0x4f49, 0x595a, 0x5870, 0x472a, 0x586e, 0x347a, 0x416e, - 0x5254, 0x586d, 0x5247, 0x586f, 0x4347, 0x5176, 0x5659, 0x5872, - 0x5875, 0x3c7e, 0x3c5b, 0x484e, 0x375d, 0x3742, 0x4673, 0x5878, - 0x5241, 0x4e69, 0x3c3f, 0x377c, 0x3725, 0x505d, 0x565a, 0x5345, - 0x3b6f, 0x3b61, 0x5871, 0x4921, 0x4e30, 0x342b, 0x5873, 0x494b, - 0x5876, 0x4257, 0x5877, 0x4e31, 0x5879, 0x322e, 0x3940, 0x5923, - 0x3069, 0x4166, 0x496c, 0x4b45, 0x4b46, 0x5924, 0x3568, 0x352b, - 0x4e3b, 0x354d, 0x5721, 0x5774, 0x5353, 0x4c65, 0x3a4e, 0x5922, - 0x595c, 0x5360, 0x587d, 0x3770, 0x5777, 0x587e, 0x587a, 0x5921, - 0x4463, 0x5336, 0x5874, 0x595d, 0x587b, 0x4565, 0x4050, 0x5170, - 0x305b, 0x3c51, 0x5926, 0x5925, 0x592c, 0x592e, 0x592b, 0x4a39, - 0x5929, 0x5636, 0x335e, 0x5928, 0x407d, 0x4a4c, 0x592a, 0x5927, - 0x5930, 0x3631, 0x3929, 0x5240, 0x4f40, 0x4242, 0x3d44, 0x556c, - 0x3260, 0x4748, 0x3f6b, 0x592d, 0x592f, 0x4e6a, 0x3a6e, 0x4756, - 0x3163, 0x3459, 0x366d, 0x5934, 0x3f21, 0x595e, 0x474e, 0x407e, - 0x5938, 0x4b57, 0x377d, 0x5935, 0x5937, 0x3123, 0x5361, 0x5939, - 0x5045, 0x5936, 0x5931, 0x5932, 0x4129, 0x5933, 0x3c73, 0x505e, - 0x3829, 0x3e63, 0x593d, 0x593a, 0x3033, 0x5942, 0x5944, 0x3136, - 0x593f, 0x3539, 0x3e73, 0x4c48, 0x3a72, 0x5250, 0x5943, 0x3d68, - 0x332b, 0x5945, 0x3e6b, 0x5946, 0x593b, 0x445f, 0x593e, 0x5941, - 0x5940, 0x552e, 0x5635, 0x4763, 0x5948, 0x3c59, 0x594a, 0x593c, - 0x594b, 0x462b, 0x5949, 0x5776, 0x4d23, 0x3d21, 0x594c, 0x453c, - 0x4d35, 0x594d, 0x5947, 0x3325, 0x3f7e, 0x3835, 0x407c, 0x3078, - 0x3476, 0x594e, 0x594f, 0x3422, 0x5950, 0x345f, 0x3041, 0x5951, - 0x4935, 0x4f71, 0x5952, 0x4145, 0x5956, 0x492e, 0x5955, 0x5954, - 0x5957, 0x4b5b, 0x3d29, 0x4627, 0x5953, 0x5958, 0x5959, 0x4865, - 0x405c, 0x3679, 0x5823, 0x544a, 0x542a, 0x5056, 0x3364, 0x5557, - 0x4f48, 0x3962, 0x3f4b, 0x4362, 0x3652, 0x4d43, 0x596e, 0x5970, - 0x3533, 0x3635, 0x3e24, 0x486b, 0x482b, 0x304b, 0x392b, 0x4179, - 0x5962, 0x403c, 0x3932, 0x3958, 0x504b, 0x3178, 0x4664, 0x3e5f, - 0x3564, 0x5748, 0x5178, 0x3c66, 0x4a5e, 0x3c3d, 0x5966, 0x5867, - 0x445a, 0x3854, 0x483d, 0x3261, 0x5459, 0x4330, 0x4361, 0x5a22, - 0x485f, 0x5034, 0x3e7c, 0x4529, 0x395a, 0x5a23, 0x5429, 0x5a24, - 0x597b, 0x362c, 0x376b, 0x3179, 0x597c, 0x3365, 0x3e76, 0x3f76, - 0x5231, 0x4064, 0x3633, 0x597e, 0x597d, 0x3e3b, 0x4660, 0x573c, - 0x5a21, 0x4139, 0x3572, 0x4168, 0x3c75, 0x3455, 0x415d, 0x447d, - 0x3c38, 0x3732, 0x376f, 0x596c, 0x463e, 0x3f2d, 0x3b4b, 0x354a, - 0x5b49, 0x5057, 0x4d39, 0x303c, 0x3376, 0x3b77, 0x5b4a, 0x3a2f, - 0x5464, 0x3536, 0x3573, 0x5856, 0x4850, 0x3756, 0x4750, 0x5857, - 0x3f2f, 0x5b3b, 0x5858, 0x504c, 0x3b2e, 0x6b3e, 0x4150, 0x4175, - 0x5472, 0x3855, 0x3434, 0x3375, 0x493e, 0x4550, 0x4559, 0x407b, - 0x3170, 0x5859, 0x394e, 0x353d, 0x585a, 0x5646, 0x4b22, 0x482f, - 0x4932, 0x344c, 0x3f4c, 0x3974, 0x585b, 0x585c, 0x3667, 0x3c41, - 0x4c6a, 0x4f77, 0x585d, 0x4730, 0x3950, 0x3d23, 0x4c5e, 0x464a, - 0x5860, 0x585e, 0x585f, 0x307e, 0x3e67, 0x4a23, 0x3c74, 0x3831, - 0x386e, 0x5862, 0x3d4b, 0x5864, 0x5863, 0x457c, 0x5865, 0x5866, - 0x4126, 0x4830, 0x306c, 0x3926, 0x3c53, 0x4e71, 0x5b3d, 0x4153, - 0x362f, 0x567a, 0x452c, 0x3d59, 0x5b3e, 0x5b3f, 0x4078, 0x3e22, - 0x404d, 0x5b40, 0x4a46, 0x322a, 0x5342, 0x4363, 0x512b, 0x5b42, - 0x4055, 0x5b43, 0x3f31, 0x443c, 0x475a, 0x5b44, 0x5968, 0x4957, - 0x3934, 0x4e70, 0x5448, 0x307c, 0x3452, 0x5059, 0x5969, 0x5e4b, - 0x596b, 0x5830, 0x3b2f, 0x3131, 0x3357, 0x584e, 0x5451, 0x3d33, - 0x3f6f, 0x4f3b, 0x5850, 0x374b, 0x5851, 0x4625, 0x4778, 0x523d, - 0x5852, 0x4464, 0x4a2e, 0x4727, 0x5826, 0x497d, 0x4e67, 0x3b5c, - 0x306b, 0x3b2a, 0x502d, 0x3130, 0x5764, 0x573f, 0x3525, 0x4274, - 0x444f, 0x3229, 0x3237, 0x3165, 0x5f32, 0x553c, 0x3f28, 0x422c, - 0x5855, 0x4231, 0x5854, 0x4e54, 0x5a60, 0x4e40, 0x5834, 0x432e, - 0x5321, 0x4e23, 0x3c34, 0x4834, 0x4251, 0x3e6d, 0x5036, 0x5a61, - 0x4764, 0x3327, 0x3672, 0x4c7c, 0x407a, 0x4077, 0x5139, 0x5161, - 0x5847, 0x325e, 0x4065, 0x3a71, 0x5848, 0x542d, 0x4f61, 0x5849, - 0x584a, 0x4f43, 0x3378, 0x3e47, 0x584b, 0x5b4c, 0x4825, 0x4f58, - 0x487e, 0x324e, 0x5356, 0x3266, 0x3c30, 0x5351, 0x4b2b, 0x3734, - 0x3722, 0x4a65, 0x4821, 0x4a5c, 0x3164, 0x5070, 0x4551, 0x5b45, - 0x357e, 0x3f5a, 0x3945, 0x3e64, 0x416d, 0x5f36, 0x5f35, 0x563b, - 0x3d50, 0x5559, 0x3048, 0x3623, 0x3f49, 0x4c28, 0x5f33, 0x4a37, - 0x5352, 0x584f, 0x5236, 0x3a45, 0x4b3e, 0x4c3e, 0x5f37, 0x3570, - 0x5f34, 0x5375, 0x3354, 0x3877, 0x5f3a, 0x3a4f, 0x3c2a, 0x3575, - 0x4d2c, 0x437b, 0x3a73, 0x4074, 0x4d42, 0x4f72, 0x5f38, 0x4f45, - 0x4240, 0x5f39, 0x4270, 0x3e7d, 0x415f, 0x4d4c, 0x5277, 0x374d, - 0x5f41, 0x5f44, 0x3771, 0x3049, 0x3656, 0x3754, 0x3a2c, 0x4c7d, - 0x3f54, 0x4b31, 0x4674, 0x5628, 0x5f45, 0x4e62, 0x3333, 0x4e7c, - 0x3435, 0x4e47, 0x3a70, 0x4e61, 0x513d, 0x5f40, 0x3474, 0x334a, - 0x3866, 0x5f3b, 0x4445, 0x5f3c, 0x5f3d, 0x5f3e, 0x453b, 0x5f3f, - 0x5f42, 0x5431, 0x5f43, 0x473a, 0x4e58, 0x4458, 0x5f4a, 0x5f4f, - 0x565c, 0x5f49, 0x5f5a, 0x4e36, 0x3a47, 0x5f4e, 0x5f48, 0x455e, - 0x496b, 0x3a74, 0x437c, 0x3e57, 0x5f46, 0x5f4d, 0x4558, 0x5526, - 0x3a4d, 0x3e4c, 0x533d, 0x3840, 0x5664, 0x5f47, 0x393e, 0x3f27, - 0x417c, 0x5f4b, 0x5f4c, 0x5f50, 0x5f5b, 0x5f65, 0x5f57, 0x5f56, - 0x5749, 0x5f63, 0x5f64, 0x656b, 0x5227, 0x5f52, 0x3f29, 0x545b, - 0x3f48, 0x5f54, 0x4f4c, 0x5f5d, 0x514a, 0x5f5e, 0x3027, 0x4637, - 0x5f53, 0x3a65, 0x365f, 0x4d5b, 0x397e, 0x5455, 0x5f5f, 0x4f6c, - 0x3025, 0x5f67, 0x5f51, 0x5146, 0x5f55, 0x5f58, 0x5f59, 0x5f5c, - 0x3b29, 0x5f60, 0x5f61, 0x5f62, 0x5f66, 0x5f68, 0x5334, 0x3867, - 0x4536, 0x5f6a, 0x495a, 0x4128, 0x4444, 0x3f5e, 0x4f78, 0x555c, - 0x5f6e, 0x3238, 0x3a5f, 0x5f6c, 0x5b41, 0x5164, 0x4b74, 0x343d, - 0x3026, 0x5f71, 0x4c46, 0x5f72, 0x5f6d, 0x5f69, 0x5f6b, 0x5f6f, - 0x5f70, 0x3b3d, 0x5f73, 0x5f74, 0x3b23, 0x4a5b, 0x4e28, 0x6027, - 0x332a, 0x6026, 0x6021, 0x5f7e, 0x4d59, 0x5f7c, 0x5f7a, 0x3f50, - 0x5744, 0x494c, 0x5f78, 0x3021, 0x5f7d, 0x5f7b, 0x6022, 0x6028, - 0x3748, 0x4621, 0x4936, 0x4032, 0x5f75, 0x453e, 0x5844, 0x5f79, - 0x4476, 0x6023, 0x6024, 0x6025, 0x5025, 0x6034, 0x4c64, 0x6031, - 0x3f26, 0x602f, 0x4e39, 0x602b, 0x4946, 0x402e, 0x602e, 0x3a6d, - 0x3a30, 0x6029, 0x5f76, 0x6033, 0x6038, 0x342d, 0x6039, 0x4f32, - 0x3a48, 0x6030, 0x507a, 0x602c, 0x547b, 0x5f77, 0x4567, 0x602d, - 0x5377, 0x6036, 0x6037, 0x6044, 0x5061, 0x603c, 0x6049, 0x604a, - 0x603e, 0x602a, 0x4924, 0x6041, 0x6032, 0x4a48, 0x6043, 0x6035, - 0x4e4b, 0x4b43, 0x604d, 0x6046, 0x6042, 0x604b, 0x603a, 0x603f, - 0x6040, 0x6045, 0x6047, 0x6048, 0x604c, 0x603b, 0x4b54, 0x6055, - 0x6056, 0x6052, 0x6050, 0x3c4e, 0x6051, 0x3842, 0x5845, 0x506a, - 0x426f, 0x604f, 0x603d, 0x6054, 0x6053, 0x6057, 0x605c, 0x6058, - 0x5676, 0x3330, 0x576c, 0x4b3b, 0x605a, 0x4e7b, 0x3a59, 0x6061, - 0x605d, 0x522d, 0x6062, 0x605b, 0x6059, 0x605f, 0x6060, 0x605e, - 0x6064, 0x4677, 0x582c, 0x546b, 0x6066, 0x4a49, 0x6065, 0x3841, - 0x6067, 0x6068, 0x6069, 0x6063, 0x3a3f, 0x4c67, 0x606a, 0x4f79, - 0x606b, 0x4842, 0x3d40, 0x4452, 0x606c, 0x606d, 0x4774, 0x4b44, - 0x606e, 0x3b58, 0x5836, 0x5272, 0x606f, 0x4d45, 0x365a, 0x6071, - 0x5430, 0x4027, 0x3451, 0x4e27, 0x6070, 0x6072, 0x394c, 0x397a, - 0x4d3c, 0x6073, 0x4654, 0x6074, 0x5432, 0x4826, 0x6076, 0x6075, - 0x6077, 0x4d41, 0x4a25, 0x545a, 0x5b57, 0x5b59, 0x5b58, 0x3967, - 0x5b5c, 0x5b5d, 0x3558, 0x5b5a, 0x5b5b, 0x3321, 0x5b5f, 0x3b78, - 0x5637, 0x5b60, 0x3e79, 0x373b, 0x5b50, 0x4c2e, 0x3f32, 0x3b35, - 0x5778, 0x3f53, 0x3f69, 0x3c61, 0x4c33, 0x5b5e, 0x3053, 0x4e6b, - 0x3758, 0x5739, 0x4642, 0x4024, 0x4c39, 0x5b67, 0x5b61, 0x463a, - 0x5b63, 0x5b68, 0x4577, 0x5b6a, 0x5b69, 0x3f40, 0x5b66, 0x5b65, - 0x3439, 0x402c, 0x4222, 0x5b62, 0x5b64, 0x504d, 0x5b6d, 0x405d, - 0x5b72, 0x3662, 0x5b73, 0x5b52, 0x3938, 0x542b, 0x5b6c, 0x3f51, - 0x5b70, 0x5b51, 0x3566, 0x5b6b, 0x3f65, 0x5b6e, 0x5b71, 0x5b79, - 0x3921, 0x3023, 0x4271, 0x3347, 0x5b6f, 0x5b78, 0x4652, 0x5b74, - 0x5b75, 0x5b77, 0x5b76, 0x5b7e, 0x5372, 0x323a, 0x5b7d, 0x5c24, - 0x5b7b, 0x5b7a, 0x5b7c, 0x4560, 0x3b79, 0x5c23, 0x5c25, 0x4c43, - 0x3651, 0x5d40, 0x5c21, 0x5c22, 0x4735, 0x3669, 0x5c27, 0x5c26, - 0x5c29, 0x3124, 0x354c, 0x3f30, 0x515f, 0x3642, 0x5c28, 0x4b7a, - 0x6b73, 0x4b5c, 0x4b7e, 0x4c41, 0x487b, 0x5c2a, 0x4c6e, 0x5c2b, - 0x5b53, 0x5c2f, 0x5c2c, 0x3e33, 0x4a7b, 0x5c2d, 0x494a, 0x4439, - 0x473d, 0x5c2e, 0x5476, 0x5066, 0x442b, 0x3655, 0x5b54, 0x315a, - 0x5b55, 0x5b56, 0x3a3e, 0x4840, 0x4a3f, 0x4849, 0x5733, 0x4979, - 0x3f47, 0x3a78, 0x523c, 0x623a, 0x3426, 0x3138, 0x3834, 0x4f44, - 0x5967, 0x4f26, 0x4d62, 0x596d, 0x3660, 0x5239, 0x393b, 0x6239, - 0x6237, 0x3473, 0x4c6c, 0x4c2b, 0x3772, 0x5832, 0x516b, 0x3a3b, - 0x4a27, 0x4d37, 0x5244, 0x3f64, 0x3c50, 0x3661, 0x5e45, 0x5e46, - 0x5b3c, 0x5159, 0x4666, 0x444e, 0x376e, 0x375c, 0x3f7c, 0x5760, - 0x4675, 0x313c, 0x5e48, 0x3d31, 0x4c57, 0x5e4a, 0x5e49, 0x356c, - 0x495d, 0x3042, 0x452e, 0x452b, 0x444c, 0x3c69, 0x4b7d, 0x3a43, - 0x6579, 0x4867, 0x657a, 0x4d7d, 0x5731, 0x383e, 0x4268, 0x4851, - 0x657b, 0x364a, 0x3c4b, 0x517d, 0x6621, 0x436e, 0x6624, 0x657e, - 0x6625, 0x4d57, 0x3741, 0x657c, 0x657d, 0x6623, 0x445d, 0x6628, - 0x6627, 0x4343, 0x465e, 0x662a, 0x4437, 0x6622, 0x4a3c, 0x3d63, - 0x3943, 0x6626, 0x5055, 0x4e2f, 0x6629, 0x6630, 0x5226, 0x3d2a, - 0x662d, 0x662f, 0x4051, 0x524c, 0x3c27, 0x6631, 0x5276, 0x574b, - 0x4d7e, 0x4d5e, 0x4226, 0x662b, 0x662c, 0x3d3f, 0x662e, 0x6633, - 0x6632, 0x6636, 0x6638, 0x446f, 0x4448, 0x3e6a, 0x496f, 0x6637, - 0x3670, 0x4364, 0x5369, 0x6634, 0x6635, 0x4822, 0x663d, 0x6639, - 0x4645, 0x4d71, 0x663b, 0x663c, 0x3b69, 0x663e, 0x663a, 0x4037, - 0x5324, 0x663f, 0x4974, 0x6643, 0x6644, 0x5076, 0x433d, 0x4344, - 0x6642, 0x6641, 0x6647, 0x4f31, 0x6b74, 0x664a, 0x6645, 0x3c5e, - 0x4929, 0x3c35, 0x4f53, 0x6648, 0x6649, 0x664e, 0x6650, 0x6651, - 0x664b, 0x3555, 0x664c, 0x664f, 0x445b, 0x6646, 0x664d, 0x6652, - 0x6654, 0x6653, 0x6655, 0x5978, 0x6656, 0x6657, 0x5753, 0x665d, - 0x665e, 0x3f57, 0x5450, 0x5756, 0x3466, 0x4b6f, 0x665a, 0x5843, - 0x574e, 0x5022, 0x434f, 0x665f, 0x3c3e, 0x3942, 0x665b, 0x5127, - 0x3a22, 0x424f, 0x582b, 0x4a6b, 0x656e, 0x665c, 0x3775, 0x4866, - 0x4475, 0x6532, 0x447e, 0x4b7c, 0x6533, 0x552c, 0x536e, 0x4a58, - 0x3032, 0x4b4e, 0x4d6a, 0x3a6a, 0x6535, 0x6534, 0x575a, 0x3959, - 0x5666, 0x3628, 0x4d70, 0x524b, 0x3126, 0x4a35, 0x3368, 0x4973, - 0x3f4d, 0x507b, 0x4a52, 0x6536, 0x3b42, 0x4f5c, 0x392c, 0x5457, - 0x3a26, 0x5167, 0x4f7c, 0x3c52, 0x6537, 0x485d, 0x3f6d, 0x3176, - 0x4b5e, 0x3c45, 0x3c44, 0x527a, 0x435c, 0x3f5c, 0x383b, 0x4342, - 0x3a2e, 0x5422, 0x475e, 0x442f, 0x326c, 0x3951, 0x653b, 0x4148, - 0x552f, 0x653c, 0x653e, 0x3467, 0x3654, 0x4b42, 0x5130, 0x353c, - 0x4a59, 0x3762, 0x4964, 0x3d2b, 0x4e3e, 0x5770, 0x5021, 0x4959, - 0x367b, 0x6658, 0x3c62, 0x333e, 0x4950, 0x6659, 0x3322, 0x5e4c, - 0x5348, 0x5e4d, 0x5222, 0x5e4e, 0x3e4d, 0x5e4f, 0x4a2c, 0x527c, - 0x335f, 0x656a, 0x4461, 0x3e21, 0x4e32, 0x4472, 0x3e56, 0x4628, - 0x3263, 0x3e53, 0x477c, 0x4c6b, 0x3d6c, 0x4e5d, 0x4a3a, 0x4641, - 0x656c, 0x503c, 0x5539, 0x656d, 0x4a74, 0x4d40, 0x4245, 0x656f, - 0x4244, 0x6570, 0x6578, 0x4d4d, 0x493d, 0x5259, 0x6128, 0x536c, - 0x4b6a, 0x4671, 0x612c, 0x6127, 0x6129, 0x612a, 0x612f, 0x326d, - 0x612b, 0x385a, 0x612d, 0x612e, 0x6130, 0x353a, 0x6131, 0x6133, - 0x6138, 0x5152, 0x6136, 0x6135, 0x416b, 0x6137, 0x5440, 0x6132, - 0x613a, 0x3036, 0x6134, 0x3f79, 0x6139, 0x613b, 0x613e, 0x613c, - 0x5645, 0x4f3f, 0x613d, 0x613f, 0x424d, 0x366b, 0x5378, 0x474d, - 0x3765, 0x3e7e, 0x6140, 0x6141, 0x6147, 0x3367, 0x4669, 0x345e, - 0x5142, 0x6148, 0x6146, 0x6145, 0x6143, 0x6142, 0x3140, 0x5538, - 0x6144, 0x614b, 0x614c, 0x614a, 0x6f7a, 0x6153, 0x6152, 0x4736, - 0x6149, 0x614e, 0x6150, 0x6154, 0x6151, 0x614d, 0x614f, 0x6155, - 0x6156, 0x6157, 0x6158, 0x615a, 0x615b, 0x4e21, 0x675d, 0x3428, - 0x565d, 0x5132, 0x3332, 0x3924, 0x5773, 0x4749, 0x3e5e, 0x392e, - 0x4e57, 0x326e, 0x5b4f, 0x3c3a, 0x5251, 0x4b48, 0x304d, 0x4f6f, - 0x5963, 0x3d6d, 0x3152, 0x4a50, 0x323c, 0x4b27, 0x372b, 0x4a26, - 0x4f23, 0x6078, 0x554a, 0x607b, 0x607a, 0x4541, 0x4c7b, 0x4131, - 0x6079, 0x5663, 0x322f, 0x5644, 0x355b, 0x3478, 0x5621, 0x4f2f, - 0x306f, 0x607c, 0x6121, 0x3323, 0x607d, 0x607e, 0x4331, 0x435d, - 0x6122, 0x3779, 0x3b4f, 0x6123, 0x443b, 0x6124, 0x6125, 0x6126, - 0x3431, 0x3849, 0x463d, 0x446a, 0x3222, 0x5052, 0x675b, 0x3b43, - 0x5357, 0x5344, 0x3963, 0x624f, 0x572f, 0x476c, 0x3153, 0x3432, - 0x6251, 0x5072, 0x422e, 0x6250, 0x3f62, 0x5326, 0x3557, 0x6252, - 0x356a, 0x436d, 0x387d, 0x382e, 0x4553, 0x374f, 0x6254, 0x6253, - 0x3648, 0x5779, 0x4d25, 0x6258, 0x6256, 0x4a7c, 0x3f35, 0x5339, - 0x6255, 0x6257, 0x412e, 0x4048, 0x625b, 0x625a, 0x402a, 0x414e, - 0x625c, 0x625d, 0x625e, 0x5b48, 0x5153, 0x4d22, 0x3d28, 0x5e43, - 0x5825, 0x3f2a, 0x5b4d, 0x526c, 0x467a, 0x452a, 0x5e44, 0x3157, - 0x5f2e, 0x4a3d, 0x5f31, 0x392d, 0x527d, 0x3825, 0x3a6b, 0x335a, - 0x355c, 0x5545, 0x4356, 0x4f52, 0x3b21, 0x6573, 0x6572, 0x6574, - 0x4d64, 0x4875, 0x352f, 0x473f, 0x6576, 0x6c30, 0x6566, 0x3969, - 0x3531, 0x423c, 0x6568, 0x6567, 0x6569, 0x524d, 0x616a, 0x504e, - 0x4d2e, 0x5165, 0x324a, 0x316b, 0x3172, 0x456d, 0x5543, 0x5330, - 0x615c, 0x615d, 0x525b, 0x3339, 0x314b, 0x4d79, 0x5577, 0x615e, - 0x3e36, 0x347d, 0x615f, 0x3a5c, 0x6160, 0x3b32, 0x4249, 0x6161, - 0x506c, 0x4d3d, 0x6162, 0x3543, 0x4547, 0x6163, 0x6164, 0x5379, - 0x6165, 0x512d, 0x6166, 0x4e22, 0x6167, 0x3542, 0x6168, 0x3b55, - 0x5044, 0x6260, 0x3158, 0x5264, 0x6261, 0x3c49, 0x484c, 0x6263, - 0x6c7e, 0x6c7d, 0x5f2f, 0x6262, 0x563e, 0x4d7c, 0x4326, 0x6343, - 0x5652, 0x6267, 0x6268, 0x5347, 0x626c, 0x3f6c, 0x626d, 0x6265, - 0x3340, 0x446e, 0x626e, 0x5043, 0x3a76, 0x6269, 0x375e, 0x3b33, - 0x4c2c, 0x4b4b, 0x6264, 0x6266, 0x626a, 0x626b, 0x6277, 0x6274, - 0x5475, 0x6273, 0x452d, 0x557a, 0x4542, 0x3240, 0x626f, 0x6272, - 0x412f, 0x4b3c, 0x3521, 0x6279, 0x3c31, 0x6271, 0x5054, 0x5439, - 0x6275, 0x3956, 0x6276, 0x4753, 0x6270, 0x575c, 0x6d21, 0x6278, - 0x6d25, 0x627e, 0x4a51, 0x4135, 0x3b50, 0x3f56, 0x3a63, 0x4b21, - 0x6d26, 0x6d23, 0x6d22, 0x3b56, 0x6d27, 0x5074, 0x6d24, 0x3a5e, - 0x3677, 0x6321, 0x3632, 0x4c71, 0x3927, 0x4f22, 0x4721, 0x3f52, - 0x3671, 0x627a, 0x627b, 0x627d, 0x627c, 0x4455, 0x6322, 0x5341, - 0x6327, 0x4744, 0x4f24, 0x6329, 0x3a37, 0x6328, 0x3b5a, 0x6323, - 0x6324, 0x632a, 0x6326, 0x4e72, 0x5346, 0x3b3c, 0x5443, 0x447a, - 0x6d28, 0x507c, 0x6325, 0x4375, 0x632d, 0x312f, 0x6332, 0x3c42, - 0x632c, 0x353f, 0x4769, 0x6330, 0x3e2a, 0x4d6f, 0x3b73, 0x4c68, - 0x632f, 0x6331, 0x4f27, 0x632e, 0x4e29, 0x3b5d, 0x356b, 0x3e65, - 0x3252, 0x334d, 0x3139, 0x632b, 0x3251, 0x352c, 0x395f, 0x3668, - 0x4f6b, 0x6337, 0x3b4c, 0x4847, 0x504a, 0x6338, 0x336e, 0x6d29, - 0x537a, 0x5364, 0x6d2a, 0x6339, 0x5262, 0x6335, 0x535e, 0x3850, - 0x6333, 0x6336, 0x375f, 0x6334, 0x4022, 0x633a, 0x5438, 0x3448, - 0x633b, 0x3b45, 0x4977, 0x4965, 0x443d, 0x6d2b, 0x427d, 0x3b5b, - 0x3f2e, 0x4e3f, 0x633c, 0x3f36, 0x316f, 0x5477, 0x633e, 0x6d2d, - 0x633f, 0x3a29, 0x6d2c, 0x633d, 0x6340, 0x3a36, 0x362e, 0x5038, - 0x3043, 0x6d2e, 0x6d2f, 0x4041, 0x6341, 0x4533, 0x6342, 0x5c32, - 0x6d30, 0x386a, 0x4e6c, 0x6a27, 0x5067, 0x4a79, 0x4856, 0x4f37, - 0x3349, 0x4e52, 0x3d64, 0x635e, 0x3b72, 0x6a28, 0x553d, 0x465d, - 0x6a29, 0x6a2a, 0x6a2c, 0x6a2b, 0x6a2e, 0x6a2d, 0x3d58, 0x6a2f, - 0x423e, 0x3441, 0x3477, 0x3b27, 0x6c66, 0x6c65, 0x373f, 0x4b79, - 0x3162, 0x6c67, 0x4948, 0x6c68, 0x6c69, 0x4a56, 0x5e50, 0x3245, - 0x547a, 0x464b, 0x3047, 0x3472, 0x4853, 0x4d50, 0x3f38, 0x3f5b, - 0x4724, 0x5634, 0x4029, 0x5e51, 0x4928, 0x516f, 0x4524, 0x3067, - 0x3336, 0x4845, 0x3062, 0x3776, 0x457a, 0x3673, 0x5552, 0x3350, - 0x3c3c, 0x332d, 0x3e71, 0x3051, 0x5256, 0x4a63, 0x5725, 0x4d36, - 0x3636, 0x3f39, 0x555b, 0x3827, 0x4557, 0x5e52, 0x3f59, 0x4255, - 0x4740, 0x3b24, 0x3128, 0x456a, 0x457b, 0x4c27, 0x3127, 0x3556, - 0x4428, 0x5e53, 0x513a, 0x3369, 0x4372, 0x3777, 0x5674, 0x3523, - 0x3270, 0x4434, 0x4469, 0x402d, 0x5e54, 0x3068, 0x4544, 0x4160, - 0x3955, 0x3e5c, 0x4d58, 0x304e, 0x4d4f, 0x5e56, 0x3e50, 0x573e, - 0x5e55, 0x5550, 0x305d, 0x4462, 0x4223, 0x3c70, 0x5335, 0x4039, - 0x4521, 0x3226, 0x5471, 0x4028, 0x4a43, 0x5e57, 0x557c, 0x3930, - 0x482d, 0x4b29, 0x5e59, 0x3f3d, 0x4634, 0x5727, 0x4a30, 0x4443, - 0x3356, 0x3952, 0x5638, 0x6a7c, 0x3034, 0x3f66, 0x4c74, 0x4d5a, - 0x563f, 0x424e, 0x4e4e, 0x4c22, 0x502e, 0x4453, 0x3532, 0x5e58, - 0x5575, 0x3c37, 0x3b53, 0x3024, 0x4532, 0x346c, 0x5571, 0x6a7d, - 0x5e5a, 0x4d26, 0x4d6c, 0x4e66, 0x5e5c, 0x4d31, 0x4026, 0x573d, - 0x5e5b, 0x3046, 0x3a34, 0x4953, 0x4473, 0x3e68, 0x3236, 0x404c, - 0x4b70, 0x3c71, 0x3b3b, 0x3537, 0x4575, 0x5e66, 0x5e63, 0x3e5d, - 0x5e5f, 0x3437, 0x3d5d, 0x5e60, 0x446d, 0x4f46, 0x3560, 0x365e, - 0x4a5a, 0x3574, 0x5e65, 0x5546, 0x5e61, 0x4c4d, 0x467e, 0x4545, - 0x5234, 0x3e72, 0x4253, 0x4c3d, 0x3338, 0x3d53, 0x3f58, 0x4d46, - 0x515a, 0x346b, 0x5e64, 0x5e5d, 0x5e67, 0x6a7e, 0x4230, 0x5e62, - 0x5640, 0x3527, 0x3274, 0x5e68, 0x5e72, 0x5e6d, 0x5e71, 0x4860, - 0x5761, 0x5e6f, 0x4368, 0x4c61, 0x3265, 0x523e, 0x5e6e, 0x5e6b, - 0x4e55, 0x3427, 0x3f2b, 0x3e3e, 0x3d52, 0x5e69, 0x542e, 0x5e5e, - 0x5e6a, 0x403f, 0x5e6c, 0x3273, 0x3869, 0x4227, 0x3d41, 0x5e75, - 0x5e78, 0x322b, 0x3424, 0x346a, 0x4926, 0x5e76, 0x4b51, 0x3863, - 0x5e77, 0x5e7a, 0x5e79, 0x4c42, 0x3061, 0x346e, 0x653a, 0x502f, - 0x326b, 0x6b21, 0x5e74, 0x4963, 0x5e73, 0x305a, 0x5221, 0x3177, - 0x4c2f, 0x5e70, 0x4b24, 0x552a, 0x5e7b, 0x345d, 0x4426, 0x5e7d, - 0x437e, 0x4421, 0x5f21, 0x414c, 0x5e7c, 0x3e6f, 0x4632, 0x3345, - 0x4876, 0x4b3a, 0x5e7e, 0x5f24, 0x5732, 0x3337, 0x4143, 0x474b, - 0x3225, 0x3469, 0x572b, 0x446c, 0x5f22, 0x5f23, 0x5f25, 0x3a33, - 0x5f26, 0x405e, 0x4943, 0x3259, 0x4766, 0x5f27, 0x475c, 0x5f28, - 0x6b22, 0x4b53, 0x5f2a, 0x5f29, 0x3241, 0x454a, 0x5f2b, 0x545c, - 0x4841, 0x5f2c, 0x3e70, 0x5f2d, 0x5627, 0x6a37, 0x6b36, 0x4a55, - 0x587c, 0x3844, 0x3925, 0x3745, 0x557e, 0x394a, 0x5027, 0x744d, - 0x3550, 0x4374, 0x3e48, 0x6b37, 0x303d, 0x3d4c, 0x4132, 0x3156, - 0x3328, 0x3852, 0x4922, 0x3658, 0x6b38, 0x3e34, 0x4a7d, 0x4743, - 0x557b, 0x3773, 0x4e44, 0x552b, 0x3173, 0x6c33, 0x305f, 0x6c35, - 0x3637, 0x414f, 0x757a, 0x5031, 0x5565, 0x4e53, 0x3d6f, 0x3362, - 0x382b, 0x5536, 0x6d3d, 0x364f, 0x4b39, 0x5042, 0x373d, 0x6c36, - 0x4a29, 0x4554, 0x6c39, 0x6c38, 0x4243, 0x6c37, 0x507d, 0x6c3a, - 0x6c3b, 0x5765, 0x6c3c, 0x6c3d, 0x466c, 0x4e5e, 0x3c48, 0x4855, - 0x3529, 0x3e49, 0x563c, 0x5467, 0x512e, 0x5071, 0x6a38, 0x6a39, - 0x6a3a, 0x3a35, 0x4a31, 0x3f75, 0x4d7a, 0x6a40, 0x303a, 0x6a3e, - 0x4025, 0x6a3b, 0x327d, 0x4377, 0x3b68, 0x5257, 0x4e74, 0x6a3f, - 0x6a3c, 0x6a43, 0x5047, 0x5333, 0x343a, 0x4341, 0x5772, 0x5551, - 0x4a47, 0x6a45, 0x6a44, 0x6a47, 0x6a46, 0x5667, 0x4f54, 0x6a4b, - 0x3b4e, 0x3d7a, 0x494e, 0x6a4c, 0x4939, 0x4f7e, 0x6a4a, 0x544e, - 0x6a4d, 0x6a4f, 0x4d6d, 0x6a49, 0x6a4e, 0x4e6e, 0x3b5e, 0x333f, - 0x4655, 0x3e30, 0x4e7a, 0x4767, 0x3e27, 0x6a50, 0x5647, 0x4140, - 0x545d, 0x6a51, 0x4f3e, 0x6a52, 0x4a6e, 0x452f, 0x3035, 0x6a54, - 0x6a53, 0x745f, 0x443a, 0x3129, 0x655f, 0x6a55, 0x4a6f, 0x6a56, - 0x6a57, 0x4658, 0x6a58, 0x6a59, 0x543b, 0x477a, 0x5237, 0x387c, - 0x6a42, 0x325c, 0x427c, 0x5478, 0x4c66, 0x576e, 0x5442, 0x5350, - 0x6b43, 0x4573, 0x377e, 0x6b54, 0x4b37, 0x6b5e, 0x404a, 0x4d7b, - 0x332f, 0x465a, 0x6b7c, 0x443e, 0x4e34, 0x4429, 0x313e, 0x547d, - 0x4a75, 0x566c, 0x4653, 0x3664, 0x3b7a, 0x5060, 0x4931, 0x5453, - 0x4828, 0x384b, 0x683e, 0x493c, 0x683b, 0x406e, 0x5053, 0x3244, - 0x3465, 0x683c, 0x5548, 0x3645, 0x683d, 0x4a78, 0x385c, 0x4c75, - 0x4034, 0x516e, 0x683f, 0x6842, 0x3a3c, 0x312d, 0x3d5c, 0x6a3d, - 0x6843, 0x6846, 0x684b, 0x684c, 0x4b49, 0x3065, 0x3c2b, 0x3939, - 0x6841, 0x4d77, 0x684a, 0x4e76, 0x556d, 0x4156, 0x6844, 0x4336, - 0x397b, 0x5626, 0x6848, 0x4a60, 0x5466, 0x6840, 0x6845, 0x6847, - 0x4739, 0x3763, 0x6849, 0x3f5d, 0x6852, 0x6857, 0x6855, 0x3c5c, - 0x3c4f, 0x685b, 0x685e, 0x685a, 0x317a, 0x3058, 0x4433, 0x384c, - 0x4662, 0x483e, 0x4861, 0x684f, 0x6854, 0x6856, 0x3971, 0x6858, - 0x5775, 0x447b, 0x685c, 0x3269, 0x6851, 0x3c6d, 0x3f42, 0x684d, - 0x5679, 0x4178, 0x3271, 0x685f, 0x4a41, 0x6859, 0x5524, 0x316a, - 0x553b, 0x684e, 0x6850, 0x3630, 0x6853, 0x685d, 0x4038, 0x4a77, - 0x4b28, 0x465c, 0x4075, 0x6869, 0x5023, 0x6872, 0x566a, 0x6860, - 0x6861, 0x5179, 0x3a4b, 0x3879, 0x3871, 0x5454, 0x686f, 0x686e, - 0x686c, 0x3970, 0x4c52, 0x6866, 0x4e26, 0x3f72, 0x3038, 0x6871, - 0x6870, 0x5740, 0x6864, 0x4d29, 0x4923, 0x3b38, 0x3d5b, 0x686a, - 0x6862, 0x6863, 0x6865, 0x3535, 0x6867, 0x4745, 0x686b, 0x686d, - 0x3d30, 0x572e, 0x6878, 0x6875, 0x4d30, 0x6876, 0x413a, 0x6868, - 0x4337, 0x3070, 0x6874, 0x6877, 0x3923, 0x4952, 0x434e, 0x4e60, - 0x4066, 0x4b73, 0x4c5d, 0x5035, 0x4a61, 0x6873, 0x3c6c, 0x6879, - 0x435e, 0x4665, 0x3977, 0x3074, 0x5758, 0x3c2c, 0x456f, 0x4c44, - 0x6926, 0x492d, 0x6922, 0x4062, 0x3f43, 0x687e, 0x3957, 0x687b, - 0x6924, 0x524e, 0x6923, 0x5632, 0x5735, 0x6927, 0x3d37, 0x687c, - 0x687d, 0x6921, 0x4d56, 0x522c, 0x6932, 0x6929, 0x342a, 0x343b, - 0x692b, 0x5028, 0x6925, 0x337e, 0x692c, 0x4063, 0x692a, 0x6939, - 0x6938, 0x692e, 0x687a, 0x6928, 0x3f2c, 0x6931, 0x693a, 0x4225, - 0x692f, 0x3845, 0x692d, 0x535c, 0x6934, 0x6935, 0x6937, 0x6947, - 0x4046, 0x6945, 0x6930, 0x693b, 0x3071, 0x693c, 0x5525, 0x693e, - 0x693f, 0x6941, 0x4171, 0x4836, 0x693d, 0x6942, 0x6943, 0x6933, - 0x6936, 0x3b31, 0x6940, 0x3c77, 0x6944, 0x6946, 0x694a, 0x694e, - 0x325b, 0x6948, 0x372e, 0x694b, 0x694c, 0x5541, 0x4423, 0x6958, - 0x3a61, 0x6949, 0x5323, 0x6954, 0x6957, 0x6950, 0x694f, 0x4741, - 0x6952, 0x6959, 0x3348, 0x6953, 0x4f70, 0x694d, 0x3377, 0x6956, - 0x695a, 0x4c34, 0x4f2d, 0x6955, 0x695c, 0x695b, 0x695e, 0x6951, - 0x695d, 0x695f, 0x434a, 0x4737, 0x344e, 0x3b36, 0x5040, 0x6c23, - 0x4537, 0x537b, 0x6c24, 0x6c25, 0x465b, 0x3f6e, 0x6c26, 0x6c27, - 0x502a, 0x4738, 0x3868, 0x6c28, 0x5639, 0x557d, 0x344b, 0x323d, - 0x4e64, 0x4667, 0x4d61, 0x3475, 0x4b40, 0x3c5f, 0x6962, 0x6963, - 0x516a, 0x6965, 0x3479, 0x6964, 0x5133, 0x4a62, 0x3250, 0x6968, - 0x6966, 0x6967, 0x5633, 0x6969, 0x696a, 0x696b, 0x696c, 0x6c2f, - 0x4539, 0x364e, 0x5273, 0x356e, 0x3b59, 0x6c31, 0x5263, 0x4e63, - 0x4438, 0x433f, 0x363e, 0x5839, 0x3148, 0x314f, 0x3151, 0x457e, - 0x3150, 0x432b, 0x5531, 0x6b24, 0x3a41, 0x4c3a, 0x6b25, 0x6b27, - 0x6b28, 0x6b26, 0x6b29, 0x6b2b, 0x6b2a, 0x6b2c, 0x4a4f, 0x5835, - 0x4371, 0x4325, 0x4678, 0x6b2d, 0x444a, 0x6b2e, 0x6b2f, 0x6b30, - 0x3755, 0x377a, 0x6b31, 0x4762, 0x6b33, 0x3a24, 0x5175, 0x3031, - 0x6b32, 0x6b34, 0x352a, 0x4248, 0x4768, 0x6b35, 0x4b2e, 0x635f, - 0x5340, 0x595b, 0x4d21, 0x562d, 0x4773, 0x5960, 0x3b63, 0x3a3a, - 0x6362, 0x4f2b, 0x6360, 0x4947, 0x3a39, 0x5134, 0x6361, 0x486a, - 0x392f, 0x3d2d, 0x3358, 0x4e5b, 0x4c40, 0x6368, 0x6369, 0x4d74, - 0x4c2d, 0x3c33, 0x636a, 0x636b, 0x505a, 0x467b, 0x375a, 0x475f, - 0x524a, 0x4e56, 0x6364, 0x636c, 0x4972, 0x3341, 0x6367, 0x4663, - 0x6365, 0x6d33, 0x6366, 0x4933, 0x4566, 0x3935, 0x433b, 0x6363, - 0x453d, 0x4124, 0x4259, 0x3257, 0x636d, 0x3b26, 0x442d, 0x6370, - 0x3e5a, 0x637b, 0x6375, 0x3a53, 0x3750, 0x534d, 0x564e, 0x5553, - 0x3941, 0x5534, 0x5158, 0x5039, 0x4776, 0x482a, 0x3234, 0x435a, - 0x636e, 0x637c, 0x636f, 0x3728, 0x6377, 0x6374, 0x373a, 0x4522, - 0x6376, 0x455d, 0x3228, 0x467c, 0x4460, 0x5722, 0x4061, 0x6379, - 0x637a, 0x637d, 0x4c29, 0x6373, 0x533e, 0x3143, 0x6d34, 0x6371, - 0x6372, 0x6378, 0x503a, 0x4643, 0x5473, 0x637e, 0x3d60, 0x6427, - 0x6426, 0x5173, 0x6423, 0x6429, 0x4877, 0x4f34, 0x6428, 0x642e, - 0x4265, 0x3634, 0x3d72, 0x6422, 0x3a69, 0x642a, 0x642c, 0x367d, - 0x565e, 0x6432, 0x642d, 0x6421, 0x3b6e, 0x4d5d, 0x4722, 0x4549, - 0x4177, 0x6424, 0x4733, 0x3d2c, 0x3d3d, 0x6425, 0x5747, 0x3262, - 0x642b, 0x3c43, 0x642f, 0x3b6b, 0x6430, 0x4528, 0x6431, 0x5563, - 0x3f23, 0x643a, 0x6437, 0x643b, 0x643d, 0x4656, 0x3a46, 0x404b, - 0x3821, 0x6434, 0x5421, 0x3a23, 0x3d7e, 0x643c, 0x4d3f, 0x4479, - 0x4f7b, 0x4966, 0x533f, 0x4f51, 0x6433, 0x6438, 0x6439, 0x4c69, - 0x4c4e, 0x4054, 0x6435, 0x4130, 0x6436, 0x4e50, 0x3b41, 0x3553, - 0x4873, 0x3d27, 0x5547, 0x492c, 0x3822, 0x644a, 0x644c, 0x5144, - 0x523a, 0x3a2d, 0x3a54, 0x6443, 0x356d, 0x574d, 0x6440, 0x4f7d, - 0x643f, 0x415c, 0x4c4a, 0x4a67, 0x4457, 0x4c54, 0x6448, 0x6447, - 0x6441, 0x6444, 0x352d, 0x5359, 0x6446, 0x5279, 0x3463, 0x3b34, - 0x496e, 0x343e, 0x3b6c, 0x514d, 0x4c6d, 0x6d35, 0x4765, 0x5428, - 0x644b, 0x5755, 0x6442, 0x3d25, 0x6445, 0x5366, 0x6449, 0x4978, - 0x643e, 0x5365, 0x477e, 0x3649, 0x547c, 0x3233, 0x6457, 0x4e42, - 0x644d, 0x4e3c, 0x385b, 0x6456, 0x3f4a, 0x534e, 0x436c, 0x4548, - 0x6458, 0x4d44, 0x644f, 0x6454, 0x6455, 0x3a7e, 0x4f66, 0x553f, - 0x6452, 0x6450, 0x644e, 0x4d65, 0x4a2a, 0x4023, 0x3d26, 0x6453, - 0x3848, 0x6467, 0x5434, 0x645b, 0x416f, 0x6469, 0x5267, 0x645f, - 0x6460, 0x4f2a, 0x4b5d, 0x645a, 0x6451, 0x6465, 0x485c, 0x6463, - 0x4467, 0x6462, 0x6461, 0x337c, 0x6468, 0x3561, 0x574c, 0x6466, - 0x3b2c, 0x5752, 0x4c4f, 0x6b78, 0x6464, 0x3976, 0x564d, 0x6459, - 0x645c, 0x427a, 0x645e, 0x424b, 0x4044, 0x4250, 0x3175, 0x4c32, - 0x354e, 0x646f, 0x462f, 0x4661, 0x6475, 0x4229, 0x406c, 0x515d, - 0x646e, 0x442e, 0x646d, 0x6476, 0x6474, 0x427e, 0x645d, 0x6470, - 0x4a7e, 0x5544, 0x6471, 0x517a, 0x646b, 0x646c, 0x6472, 0x4e2b, - 0x454b, 0x4731, 0x423a, 0x646a, 0x414a, 0x4c36, 0x3331, 0x647b, - 0x6473, 0x647a, 0x647d, 0x647c, 0x334e, 0x333a, 0x6477, 0x6479, - 0x6478, 0x456c, 0x403d, 0x5468, 0x6522, 0x3044, 0x6524, 0x6523, - 0x3c24, 0x6525, 0x6521, 0x647e, 0x3174, 0x6528, 0x6529, 0x6526, - 0x6527, 0x652a, 0x4659, 0x652b, 0x652d, 0x652c, 0x652f, 0x652e, - 0x3960, 0x6530, 0x6531, 0x3b70, 0x6c61, 0x4370, 0x3546, 0x3b52, - 0x4169, 0x546e, 0x3e44, 0x5746, 0x5456, 0x3253, 0x6c3e, 0x6a41, - 0x422f, 0x3436, 0x5157, 0x3334, 0x4832, 0x3f3b, 0x6c40, 0x564b, - 0x6c3f, 0x6c41, 0x6c45, 0x3e66, 0x4c3f, 0x455a, 0x3e3c, 0x6c46, - 0x317e, 0x6c44, 0x5528, 0x3563, 0x6c42, 0x4136, 0x3363, 0x6c43, - 0x4b38, 0x4043, 0x4c7e, 0x4152, 0x6c48, 0x3a66, 0x4053, 0x5672, - 0x514c, 0x3f3e, 0x3733, 0x4955, 0x6c47, 0x3b62, 0x4c4c, 0x3d7d, - 0x4848, 0x4f29, 0x4d69, 0x456b, 0x3769, 0x5149, 0x3a38, 0x6c49, - 0x6c4a, 0x3b40, 0x6c4b, 0x6c62, 0x313a, 0x3759, 0x3d39, 0x6c4c, - 0x5166, 0x6c4d, 0x483b, 0x6c51, 0x6c53, 0x3b4d, 0x3c65, 0x6c4f, - 0x4937, 0x433a, 0x6c63, 0x5555, 0x6c50, 0x5673, 0x6c52, 0x6c4e, - 0x6c54, 0x6c55, 0x493f, 0x4f28, 0x505c, 0x512c, 0x485b, 0x6c56, - 0x4e75, 0x4a6c, 0x6c5a, 0x6c59, 0x303e, 0x6c57, 0x6c58, 0x6c64, - 0x483c, 0x4147, 0x6c5c, 0x5160, 0x6c5b, 0x546f, 0x6c5d, 0x5b46, - 0x6c5e, 0x312c, 0x6c5f, 0x6c60, 0x5726, 0x4540, 0x6b3c, 0x302e, - 0x3e74, 0x3838, 0x522f, 0x3056, 0x3579, 0x5833, 0x4b2c, 0x635d, - 0x462c, 0x3066, 0x4546, 0x6b39, 0x6b3a, 0x6b3b, 0x5140, 0x4523, - 0x6a72, 0x4432, 0x4435, 0x404e, 0x6a73, 0x4441, 0x4e6f, 0x6a70, - 0x6a74, 0x497c, 0x4723, 0x4c58, 0x4e7e, 0x6a75, 0x6a76, 0x4f2c, - 0x4067, 0x6a77, 0x363f, 0x6a78, 0x6a79, 0x6a7a, 0x6a7b, 0x6a71, - 0x482e, 0x616b, 0x3738, 0x616c, 0x616d, 0x5734, 0x616e, 0x616f, - 0x534c, 0x6171, 0x3f71, 0x6170, 0x3552, 0x3137, 0x6173, 0x6172, - 0x3a7c, 0x6174, 0x3937, 0x3e51, 0x447c, 0x3a5d, 0x3d46, 0x6175, - 0x6177, 0x3640, 0x4f41, 0x4a28, 0x6176, 0x5578, 0x537c, 0x6178, - 0x617c, 0x6179, 0x617a, 0x406a, 0x617e, 0x6221, 0x4047, 0x617b, - 0x617d, 0x6225, 0x4154, 0x6223, 0x6228, 0x327e, 0x6222, 0x434d, - 0x3242, 0x6227, 0x6226, 0x6224, 0x6229, 0x622b, 0x5049, 0x566d, - 0x4328, 0x622c, 0x4f57, 0x622e, 0x3a6f, 0x6960, 0x622d, 0x622a, - 0x3b2b, 0x5433, 0x6230, 0x622f, 0x6961, 0x6231, 0x6232, 0x6233, - 0x4c21, 0x6234, 0x6235, 0x507e, 0x424a, 0x5371, 0x4d75, 0x6760, - 0x6761, 0x3e41, 0x426a, 0x6764, 0x6763, 0x4d66, 0x4335, 0x6762, - 0x3b37, 0x4f56, 0x4161, 0x6769, 0x6768, 0x6774, 0x3223, 0x676a, - 0x6766, 0x676c, 0x676b, 0x493a, 0x5564, 0x6765, 0x3729, 0x6767, - 0x676e, 0x6773, 0x5669, 0x676d, 0x6772, 0x6771, 0x3060, 0x6775, - 0x4772, 0x4045, 0x406d, 0x4170, 0x6770, 0x6776, 0x4b76, 0x6822, - 0x6821, 0x5741, 0x677a, 0x6779, 0x677b, 0x6777, 0x677e, 0x677d, - 0x677c, 0x4155, 0x4759, 0x457d, 0x4543, 0x476d, 0x6823, 0x6826, - 0x6825, 0x6827, 0x3a77, 0x6778, 0x6824, 0x4870, 0x492a, 0x6829, - 0x3965, 0x517e, 0x6828, 0x682a, 0x682d, 0x682e, 0x4127, 0x682f, - 0x6830, 0x682c, 0x6834, 0x682b, 0x6831, 0x6835, 0x6832, 0x6833, - 0x6837, 0x6836, 0x394f, 0x702c, 0x702d, 0x4630, 0x306a, 0x483f, - 0x4d5f, 0x4e4d, 0x6a31, 0x6a32, 0x463f, 0x3449, 0x6a33, 0x5567, - 0x5d79, 0x6a34, 0x6a35, 0x6a36, 0x384a, 0x5f30, 0x4975, 0x4c70, - 0x497a, 0x497b, 0x5343, 0x4b26, 0x3826, 0x702e, 0x3142, 0x6538, - 0x4c6f, 0x5349, 0x3c57, 0x496a, 0x3567, 0x4450, 0x3569, 0x6e2e, - 0x3b2d, 0x675e, 0x6e2f, 0x3329, 0x6e32, 0x6e31, 0x3d67, 0x6e30, - 0x4e37, 0x454f, 0x4174, 0x5b4e, 0x6e33, 0x5073, 0x4254, 0x4668, - 0x372c, 0x6e34, 0x336b, 0x3b7b, 0x6e35, 0x675c, 0x6e36, 0x3d2e, - 0x7162, 0x4a68, 0x5249, 0x705a, 0x705b, 0x705c, 0x4146, 0x386d, - 0x3e4e, 0x705e, 0x4531, 0x705d, 0x5171, 0x7060, 0x304c, 0x3d6a, - 0x525f, 0x705f, 0x342f, 0x3768, 0x7066, 0x7065, 0x4623, 0x7061, - 0x7062, 0x3443, 0x7063, 0x556e, 0x4c5b, 0x3e52, 0x3c32, 0x7068, - 0x7067, 0x7064, 0x3221, 0x5622, 0x5338, 0x3e37, 0x482c, 0x706a, - 0x5177, 0x564c, 0x3a5b, 0x7069, 0x363b, 0x4d34, 0x4626, 0x4121, - 0x706b, 0x706e, 0x706d, 0x7070, 0x706c, 0x3b3e, 0x706f, 0x4c35, - 0x7072, 0x3355, 0x3154, 0x7073, 0x7074, 0x7076, 0x3461, 0x7071, - 0x7077, 0x707a, 0x7078, 0x7075, 0x707d, 0x7079, 0x707c, 0x707e, - 0x7121, 0x4e41, 0x7124, 0x7123, 0x4176, 0x707b, 0x4a5d, 0x3471, - 0x3171, 0x4c31, 0x7126, 0x7127, 0x712c, 0x554e, 0x7129, 0x4833, - 0x7122, 0x712b, 0x7128, 0x7125, 0x712a, 0x3029, 0x712d, 0x712f, - 0x7131, 0x7130, 0x712e, 0x5122, 0x7132, 0x7133, 0x396f, 0x3547, - 0x3057, 0x3059, 0x546d, 0x3544, 0x3d54, 0x3b4a, 0x7027, 0x385e, - 0x7028, 0x3028, 0x7029, 0x4d6e, 0x702a, 0x702b, 0x4624, 0x5665, - 0x7164, 0x7165, 0x4373, 0x535b, 0x5651, 0x4568, 0x532f, 0x5266, - 0x6e41, 0x303b, 0x5535, 0x514e, 0x3c60, 0x3a50, 0x3f78, 0x3847, - 0x3541, 0x454c, 0x4a22, 0x434b, 0x6e42, 0x443f, 0x3622, 0x6d6c, - 0x4324, 0x5631, 0x4f60, 0x6d6f, 0x454e, 0x365c, 0x4a21, 0x6d6d, - 0x6d70, 0x6d71, 0x433c, 0x3f34, 0x6d6e, 0x6d74, 0x6d72, 0x5566, - 0x435f, 0x6d73, 0x6d76, 0x5523, 0x5123, 0x6d75, 0x4350, 0x6d77, - 0x3f74, 0x3e6c, 0x6d78, 0x4c77, 0x515b, 0x5745, 0x5576, 0x6d7c, - 0x6d7b, 0x6d79, 0x6d7a, 0x6d7d, 0x3e26, 0x4b2f, 0x6e21, 0x363d, - 0x6e22, 0x4440, 0x6d7e, 0x3d5e, 0x3247, 0x3643, 0x6e25, 0x583a, - 0x6e23, 0x6e26, 0x4369, 0x3372, 0x6e27, 0x6e24, 0x4f39, 0x6e28, - 0x4277, 0x6e29, 0x6e2a, 0x5e2b, 0x4633, 0x4746, 0x5675, 0x3549, - 0x4b32, 0x6e2b, 0x4d2b, 0x6e2c, 0x5530, 0x6e2d, 0x7644, 0x5b47, - 0x3423, 0x432c, 0x7166, 0x4a38, 0x5253, 0x562a, 0x6f72, 0x3e58, - 0x3d43, 0x6f73, 0x364c, 0x302b, 0x4a2f, 0x6d36, 0x6d37, 0x4e79, - 0x372f, 0x3f73, 0x6d38, 0x426b, 0x4930, 0x6d39, 0x4676, 0x3f33, - 0x6d3c, 0x4578, 0x5150, 0x5729, 0x6d3a, 0x6d3b, 0x5162, 0x6d3f, - 0x6d40, 0x6d44, 0x6d48, 0x6d46, 0x6d4e, 0x5568, 0x6d49, 0x6d47, - 0x6d3e, 0x4569, 0x4646, 0x4969, 0x5452, 0x6d41, 0x6d42, 0x6d43, - 0x6d45, 0x4079, 0x3421, 0x3968, 0x6d50, 0x6d51, 0x6d4a, 0x6d4f, - 0x4e78, 0x4b36, 0x6d4c, 0x6d4d, 0x4f75, 0x6d52, 0x4172, 0x5332, - 0x6d4b, 0x4837, 0x3c6f, 0x4570, 0x6d56, 0x356f, 0x4235, 0x302d, - 0x4b69, 0x312e, 0x6d54, 0x4d6b, 0x3562, 0x6d55, 0x6d53, 0x6d57, - 0x357a, 0x6d58, 0x6d59, 0x6d5c, 0x314c, 0x4576, 0x3c6e, 0x6d5a, - 0x4c3c, 0x326a, 0x6d5b, 0x446b, 0x3445, 0x3075, 0x6d5f, 0x405a, - 0x3468, 0x454d, 0x6d5d, 0x3f44, 0x6d5e, 0x4425, 0x6d60, 0x6d61, - 0x6d63, 0x4157, 0x3b47, 0x3d38, 0x6d62, 0x6d64, 0x6d66, 0x6d65, - 0x6d67, 0x4a3e, 0x6c6a, 0x4071, 0x4967, 0x6c6b, 0x466e, 0x6c6c, - 0x466d, 0x6c6d, 0x6c70, 0x5766, 0x6c73, 0x6c71, 0x6c6e, 0x6c6f, - 0x5723, 0x4971, 0x4b6e, 0x6c74, 0x6c72, 0x4f69, 0x6c76, 0x4631, - 0x3c40, 0x6c75, 0x353b, 0x3b76, 0x6c77, 0x5977, 0x3d7b, 0x423b, - 0x6c78, 0x6c79, 0x3823, 0x6c7a, 0x6c7b, 0x6c7c, 0x536d, 0x582e, - 0x406b, 0x475d, 0x3a4c, 0x5063, 0x4b3d, 0x4d3a, 0x3851, 0x317c, - 0x476f, 0x5656, 0x3f46, 0x436b, 0x6f75, 0x4358, 0x5762, 0x6f77, - 0x3353, 0x4758, 0x516d, 0x5648, 0x6f78, 0x6f76, 0x3b7d, 0x3346, - 0x3d55, 0x5246, 0x3b60, 0x4f21, 0x6f7c, 0x6f7b, 0x6f79, 0x334c, - 0x4954, 0x4b30, 0x6f7e, 0x305e, 0x5649, 0x6f7d, 0x336d, 0x7655, - 0x4e48, 0x7022, 0x7021, 0x353e, 0x3c5a, 0x3b7c, 0x3865, 0x4442, - 0x7023, 0x4b6b, 0x7026, 0x5128, 0x3e3f, 0x476e, 0x7136, 0x7137, - 0x3f55, 0x3429, 0x7138, 0x4d3b, 0x4754, 0x552d, 0x7139, 0x713a, - 0x474f, 0x5224, 0x564f, 0x713b, 0x3d51, 0x3430, 0x3e3d, 0x345c, - 0x4e51, 0x3f5f, 0x713d, 0x3f7a, 0x713c, 0x713f, 0x713e, 0x7140, - 0x7141, 0x417e, 0x4122, 0x4a7a, 0x553e, 0x3e3a, 0x3e39, 0x5542, - 0x3f22, 0x4d2f, 0x7135, 0x3d5f, 0x364b, 0x5671, 0x7343, 0x7344, - 0x384d, 0x7346, 0x7347, 0x304a, 0x7345, 0x7349, 0x4b71, 0x734b, - 0x5026, 0x314a, 0x7348, 0x734f, 0x3551, 0x7357, 0x7352, 0x7354, - 0x7353, 0x377b, 0x313f, 0x734e, 0x734a, 0x355a, 0x7350, 0x7351, - 0x7355, 0x734d, 0x3c63, 0x417d, 0x7356, 0x735a, 0x734c, 0x3548, - 0x3d6e, 0x735c, 0x3724, 0x3f70, 0x567e, 0x4d32, 0x3470, 0x325f, - 0x7358, 0x7359, 0x4938, 0x735d, 0x735e, 0x7361, 0x735f, 0x7363, - 0x7362, 0x735b, 0x3f6a, 0x336f, 0x7360, 0x4729, 0x3c72, 0x736b, - 0x393f, 0x7364, 0x322d, 0x3b7e, 0x4b63, 0x736d, 0x7369, 0x395c, - 0x736e, 0x7365, 0x7366, 0x736a, 0x4261, 0x736c, 0x736f, 0x7368, - 0x3c7d, 0x4f64, 0x7370, 0x7367, 0x7372, 0x572d, 0x462a, 0x7373, - 0x7371, 0x4228, 0x385d, 0x7375, 0x7374, 0x345b, 0x7376, 0x7377, - 0x7378, 0x403a, 0x4069, 0x4571, 0x737b, 0x737a, 0x3458, 0x737e, - 0x7379, 0x737c, 0x737d, 0x7421, 0x7423, 0x3b49, 0x7422, 0x7424, - 0x323e, 0x7426, 0x7425, 0x3c2e, 0x4357, 0x5961, 0x4060, 0x744c, - 0x5751, 0x375b, 0x744e, 0x4123, 0x4649, 0x3456, 0x5533, 0x7450, - 0x744f, 0x7451, 0x4b5a, 0x7452, 0x5441, 0x5660, 0x3760, 0x4138, - 0x413b, 0x7453, 0x3e2c, 0x3462, 0x7454, 0x7455, 0x3e2b, 0x7456, - 0x745b, 0x7457, 0x745a, 0x3a7d, 0x7458, 0x7459, 0x3862, 0x4c47, - 0x745c, 0x325a, 0x4353, 0x5463, 0x3f37, 0x745d, 0x4534, 0x7469, - 0x4f35, 0x4e49, 0x4b58, 0x4b77, 0x3d74, 0x574f, 0x405b, 0x5075, - 0x746a, 0x746b, 0x746c, 0x7763, 0x3731, 0x746d, 0x576b, 0x746e, - 0x6679, 0x3e40, 0x667a, 0x3a6c, 0x667b, 0x4f4b, 0x667c, 0x543c, - 0x3c36, 0x667d, 0x667e, 0x3c4d, 0x4852, 0x4e33, 0x6721, 0x343f, - 0x6722, 0x4934, 0x3859, 0x4449, 0x575d, 0x425a, 0x3757, 0x563d, - 0x4e46, 0x3744, 0x4526, 0x6723, 0x4f5f, 0x6724, 0x6725, 0x6726, - 0x4137, 0x5769, 0x4970, 0x4f38, 0x562f, 0x5655, 0x6727, 0x306d, - 0x6728, 0x6729, 0x495c, 0x526f, 0x3e2d, 0x672a, 0x3073, 0x485e, - 0x3d61, 0x672b, 0x4846, 0x672c, 0x3b66, 0x3878, 0x5124, 0x672d, - 0x4267, 0x3e78, 0x3d4a, 0x4d33, 0x672e, 0x672f, 0x3e6e, 0x5065, - 0x4b67, 0x4c50, 0x3c4c, 0x6730, 0x3c28, 0x5077, 0x6731, 0x5078, - 0x6732, 0x6733, 0x3442, 0x6734, 0x6735, 0x497e, 0x4e2c, 0x4360, - 0x6737, 0x3141, 0x3371, 0x6738, 0x6739, 0x575b, 0x5540, 0x673a, - 0x424c, 0x573a, 0x673b, 0x673c, 0x673d, 0x3c6a, 0x4365, 0x4042, - 0x673e, 0x673f, 0x3c29, 0x6740, 0x6741, 0x6736, 0x3650, 0x6742, - 0x6743, 0x6744, 0x3b3a, 0x355e, 0x4246, 0x3160, 0x6745, 0x5435, - 0x6746, 0x383f, 0x6748, 0x6747, 0x376c, 0x6749, 0x3278, 0x674a, - 0x674b, 0x674c, 0x674d, 0x674e, 0x674f, 0x6750, 0x5327, 0x4b75, - 0x6751, 0x6752, 0x6753, 0x6754, 0x4949, 0x6755, 0x6756, 0x6757, - 0x6758, 0x6759, 0x3d49, 0x675a, 0x733e, 0x3857, 0x4831, 0x733f, - 0x7340, 0x7341, 0x395e, 0x4d78, 0x5868, 0x3a31, 0x425e, 0x6e37, - 0x3723, 0x6e39, 0x6e38, 0x3055, 0x6e3b, 0x5556, 0x576f, 0x5643, - 0x6e3d, 0x4a70, 0x6e3c, 0x6e3e, 0x6e40, 0x6e3f, 0x5172, 0x473c, - 0x4340, 0x3861, 0x4167, 0x7446, 0x505f, 0x7447, 0x4f5b, 0x483a, - 0x7448, 0x7449, 0x744a, 0x744b, 0x597a, 0x387e, 0x6571, 0x5370, - 0x7460, 0x4e4c, 0x3361, 0x7134, 0x526e, 0x7461, 0x4f68, 0x7462, - 0x474c, 0x3554, 0x3464, 0x7464, 0x7463, 0x7465, 0x7466, 0x7467, - 0x3a32, 0x303f, 0x7468, 0x372d, 0x526d, 0x522b, 0x404f, 0x3f3c, - 0x6b23, 0x555f, 0x6a48, 0x7173, 0x3678, 0x4b23, 0x444d, 0x7167, - 0x7168, 0x387b, 0x7169, 0x3a44, 0x5445, 0x3052, 0x716a, 0x716b, - 0x716c, 0x716d, 0x716e, 0x716f, 0x7171, 0x7170, 0x4555, 0x7172, - 0x367a, 0x7174, 0x522e, 0x5e47, 0x4b4a, 0x335c, 0x3522, 0x3922, - 0x4474, 0x7175, 0x7176, 0x4144, 0x417b, 0x5630, 0x7177, 0x7178, - 0x412a, 0x4638, 0x3e5b, 0x7179, 0x344f, 0x717a, 0x6d32, 0x6d31, - 0x4b60, 0x525e, 0x4b41, 0x5558, 0x4862, 0x405f, 0x3c21, 0x6b41, - 0x5024, 0x5662, 0x3647, 0x3858, 0x6b40, 0x384e, 0x6b3f, 0x3326, - 0x3949, 0x562b, 0x3774, 0x374a, 0x3c67, 0x373e, 0x6b46, 0x6b47, - 0x3039, 0x3f4f, 0x6b45, 0x537d, 0x6b48, 0x6b49, 0x374e, 0x6b42, - 0x6b44, 0x4976, 0x5657, 0x554d, 0x5032, 0x6b4f, 0x4e38, 0x6b50, - 0x3528, 0x3133, 0x6b52, 0x4c25, 0x4556, 0x6b53, 0x6b51, 0x455f, - 0x6b4e, 0x4a24, 0x6b55, 0x307b, 0x3a7a, 0x5837, 0x7163, 0x6b4a, - 0x6b4b, 0x6b4c, 0x6b4d, 0x6b56, 0x6640, 0x6b59, 0x3f68, 0x5248, - 0x6b57, 0x6b5c, 0x386c, 0x6b58, 0x3d3a, 0x5058, 0x3037, 0x6b5d, - 0x445c, 0x562c, 0x3460, 0x4276, 0x3c39, 0x6b5a, 0x6b5b, 0x5460, - 0x466a, 0x4454, 0x6b5f, 0x4527, 0x5975, 0x3231, 0x6b64, 0x3d45, - 0x6b62, 0x6b63, 0x382c, 0x4d51, 0x6b65, 0x6b61, 0x4133, 0x4622, - 0x4c73, 0x6b66, 0x4030, 0x5238, 0x6b67, 0x382f, 0x382d, 0x6b68, - 0x473b, 0x4d73, 0x6b6a, 0x6b6b, 0x6b6d, 0x5048, 0x6b72, 0x6b6e, - 0x6b71, 0x4879, 0x517c, 0x6b6c, 0x6b69, 0x3839, 0x4f59, 0x4465, - 0x6b6f, 0x6b70, 0x4c5a, 0x4d48, 0x3072, 0x6b76, 0x6b75, 0x3232, - 0x3860, 0x6b77, 0x316c, 0x4c45, 0x4424, 0x4f25, 0x6b79, 0x6c22, - 0x4572, 0x6b7a, 0x4945, 0x625f, 0x6b7e, 0x4d4e, 0x6c21, 0x315b, - 0x5337, 0x525c, 0x6b7d, 0x6b7b, 0x333c, 0x6a30, 0x5754, 0x742b, - 0x3374, 0x5641, 0x5642, 0x5569, 0x3e4a, 0x7427, 0x5228, 0x7428, - 0x7429, 0x742a, 0x3e4b, 0x535f, 0x4960, 0x4961, 0x7342, 0x4a66, - 0x4c72, 0x6236, 0x4b34, 0x4e68, 0x565b, 0x742d, 0x742e, 0x742f, - 0x7432, 0x3a3d, 0x7433, 0x3063, 0x7430, 0x7431, 0x3d22, 0x3255, - 0x7436, 0x7437, 0x3666, 0x3230, 0x4f4f, 0x7434, 0x342c, 0x7435, - 0x7438, 0x7439, 0x4d27, 0x743a, 0x743b, 0x743c, 0x4b52, 0x743d, - 0x743e, 0x743f, 0x745e, 0x413c, 0x3c68, 0x492b, 0x515e, 0x6575, - 0x5c33, 0x5255, 0x5c34, 0x302c, 0x5c35, 0x3d5a, 0x5c39, 0x5842, - 0x5c37, 0x5373, 0x4956, 0x5c3a, 0x5c36, 0x5c3b, 0x4322, 0x5c3c, - 0x5c45, 0x5c3d, 0x4e5f, 0x5625, 0x5c4f, 0x5c4d, 0x5c52, 0x3d66, - 0x422b, 0x5c38, 0x5c4b, 0x5c4e, 0x5c3e, 0x3752, 0x3045, 0x5c47, - 0x503e, 0x5c41, 0x3b28, 0x373c, 0x5c4c, 0x5c46, 0x5c3f, 0x475b, - 0x513f, 0x5c40, 0x5c4a, 0x5c50, 0x4e2d, 0x5c42, 0x5c43, 0x5c48, - 0x5c49, 0x3254, 0x5c51, 0x4b55, 0x5437, 0x5c5b, 0x5c5f, 0x4c26, - 0x5c66, 0x4367, 0x5c5c, 0x3f41, 0x5c59, 0x307a, 0x3936, 0x5c65, - 0x5c53, 0x5c44, 0x5c56, 0x4874, 0x3f60, 0x493b, 0x313d, 0x5322, - 0x5c5a, 0x5c55, 0x463b, 0x5c5e, 0x5742, 0x432f, 0x3736, 0x4751, - 0x4329, 0x5c62, 0x5c58, 0x5c6b, 0x5c54, 0x5c5d, 0x3e25, 0x5c57, - 0x5c60, 0x5c63, 0x5c64, 0x5c78, 0x5c61, 0x5d22, 0x5c67, 0x3c6b, - 0x3444, 0x4323, 0x3267, 0x5c7a, 0x5c72, 0x5c6f, 0x5c7c, 0x5c6e, - 0x5270, 0x3268, 0x4857, 0x4863, 0x5c7b, 0x5c6d, 0x5c77, 0x5c75, - 0x3e23, 0x5c74, 0x325d, 0x5c73, 0x3c76, 0x5c68, 0x3b44, 0x4073, - 0x3c54, 0x5c69, 0x5c6a, 0x5c71, 0x5c76, 0x5c79, 0x3534, 0x4859, - 0x3b67, 0x5c7e, 0x5c7d, 0x532b, 0x5d21, 0x5d23, 0x5d25, 0x5271, - 0x5d24, 0x5d26, 0x5d27, 0x5229, 0x3a49, 0x5d29, 0x5d36, 0x5d31, - 0x5d34, 0x5d30, 0x464e, 0x4072, 0x492f, 0x5c6c, 0x5d2e, 0x5d37, - 0x5c70, 0x5d2f, 0x5d38, 0x5d2c, 0x5d39, 0x5d33, 0x5d2d, 0x442a, - 0x5d28, 0x4033, 0x412b, 0x5d2a, 0x5d2b, 0x5d32, 0x3b71, 0x5d35, - 0x5328, 0x5d3a, 0x5d3b, 0x4327, 0x5d52, 0x5d3c, 0x5d51, 0x393d, - 0x3e55, 0x3e7a, 0x3a4a, 0x5d4a, 0x5d45, 0x5d3f, 0x324b, 0x5d43, - 0x5d4b, 0x3224, 0x5d55, 0x5d3e, 0x4650, 0x5d50, 0x5d54, 0x4162, - 0x3746, 0x5d4e, 0x5d4f, 0x5d44, 0x5d3d, 0x5d4d, 0x4c51, 0x5d49, - 0x5d42, 0x4348, 0x463c, 0x4e2e, 0x5d4c, 0x5d48, 0x5d41, 0x5d46, - 0x425c, 0x5329, 0x532a, 0x5d53, 0x4f74, 0x4878, 0x5d66, 0x5d47, - 0x5d60, 0x4264, 0x5d61, 0x5d57, 0x5678, 0x5d59, 0x5d58, 0x3870, - 0x5d56, 0x464f, 0x362d, 0x5d62, 0x3a79, 0x5461, 0x5d67, 0x3450, - 0x5d5a, 0x3f7b, 0x5d63, 0x5d5f, 0x5d5d, 0x3559, 0x5d5b, 0x5d5c, - 0x5d5e, 0x3d2f, 0x5d64, 0x5d65, 0x5d75, 0x4349, 0x4b62, 0x5d72, - 0x5861, 0x4651, 0x5d74, 0x5574, 0x5d73, 0x5d70, 0x5d6c, 0x5d6f, - 0x5d68, 0x506e, 0x4858, 0x5d6e, 0x5d69, 0x5d6a, 0x4b72, 0x5d6d, - 0x314d, 0x4036, 0x3c3b, 0x5d71, 0x5d77, 0x5d76, 0x5d6b, 0x456e, - 0x5d7b, 0x5e24, 0x5e23, 0x5d78, 0x436f, 0x427b, 0x5561, 0x4e35, - 0x5d7d, 0x324c, 0x4468, 0x4a5f, 0x473e, 0x5d7a, 0x5d7c, 0x5d7e, - 0x5e22, 0x302a, 0x314e, 0x5e2c, 0x5e26, 0x3d36, 0x486f, 0x5e21, - 0x5e25, 0x5e29, 0x5e28, 0x5e27, 0x5e2d, 0x544c, 0x5e33, 0x5e2a, - 0x5e2e, 0x4059, 0x3121, 0x5e36, 0x5e31, 0x5e32, 0x5126, 0x5e35, - 0x5e2f, 0x5e30, 0x503d, 0x5e34, 0x4a6d, 0x5e39, 0x5e38, 0x5e37, - 0x5e3b, 0x3d65, 0x3258, 0x436a, 0x5e3a, 0x453a, 0x5e3c, 0x4c59, - 0x372a, 0x5465, 0x5e3d, 0x5e3f, 0x4422, 0x5e41, 0x5e3e, 0x5e40, - 0x553a, 0x5e42, 0x722e, 0x3b22, 0x4232, 0x4530, 0x4247, 0x722f, - 0x5069, 0x535d, 0x6b3d, 0x3366, 0x7230, 0x7231, 0x4a2d, 0x3a67, - 0x7233, 0x7235, 0x7234, 0x4b64, 0x4f3a, 0x7232, 0x4a34, 0x524f, - 0x426c, 0x4e43, 0x7238, 0x3076, 0x7237, 0x723e, 0x324f, 0x5141, - 0x723a, 0x723c, 0x5469, 0x723b, 0x7236, 0x723f, 0x723d, 0x7239, - 0x7247, 0x7244, 0x7246, 0x724a, 0x7242, 0x7240, 0x7245, 0x567b, - 0x7241, 0x4779, 0x495f, 0x7248, 0x3946, 0x3530, 0x7243, 0x7249, - 0x7250, 0x7256, 0x3b57, 0x7255, 0x4d5c, 0x566b, 0x7252, 0x7254, - 0x3872, 0x724b, 0x724e, 0x4279, 0x555d, 0x724c, 0x724d, 0x724f, - 0x7253, 0x7259, 0x533c, 0x366a, 0x4a71, 0x3764, 0x7257, 0x7258, - 0x725a, 0x725d, 0x725b, 0x725c, 0x5151, 0x7251, 0x4d49, 0x4e4f, - 0x5629, 0x7263, 0x435b, 0x7260, 0x402f, 0x726c, 0x725e, 0x7261, - 0x7268, 0x7262, 0x7267, 0x7266, 0x7269, 0x725f, 0x7264, 0x726a, - 0x532c, 0x7265, 0x3275, 0x7272, 0x502b, 0x7275, 0x3b48, 0x7279, - 0x7270, 0x7276, 0x7278, 0x727a, 0x7273, 0x7271, 0x3a7b, 0x357b, - 0x726f, 0x7277, 0x726d, 0x726e, 0x726b, 0x7326, 0x7323, 0x7322, - 0x7274, 0x485a, 0x727b, 0x7325, 0x4378, 0x727d, 0x7327, 0x7329, - 0x7324, 0x727c, 0x732b, 0x732a, 0x425d, 0x732e, 0x7330, 0x7321, - 0x7331, 0x732c, 0x732f, 0x727e, 0x732d, 0x7332, 0x7334, 0x7328, - 0x7333, 0x7335, 0x5037, 0x7338, 0x5979, 0x7339, 0x7337, 0x4864, - 0x7336, 0x733a, 0x733b, 0x3440, 0x6e43, 0x733c, 0x733d, 0x512a, - 0x742c, 0x5046, 0x5050, 0x515c, 0x4f4e, 0x3d56, 0x5143, 0x3a62, - 0x6169, 0x5242, 0x7142, 0x3239, 0x316d, 0x7143, 0x4940, 0x3344, - 0x5972, 0x4b25, 0x7144, 0x5654, 0x7145, 0x7440, 0x7146, 0x542c, - 0x7147, 0x3040, 0x7441, 0x7442, 0x347c, 0x455b, 0x4c3b, 0x5064, - 0x4d60, 0x7148, 0x5973, 0x313b, 0x4f2e, 0x3824, 0x714a, 0x714b, - 0x3243, 0x4151, 0x5730, 0x7149, 0x714c, 0x714e, 0x5976, 0x5261, - 0x5423, 0x7443, 0x4839, 0x7444, 0x714d, 0x714f, 0x3f63, 0x7150, - 0x7154, 0x7156, 0x7151, 0x4951, 0x4561, 0x4263, 0x397c, 0x7153, - 0x7155, 0x3953, 0x715b, 0x3a56, 0x307d, 0x7159, 0x7158, 0x7152, - 0x715a, 0x7157, 0x486c, 0x4d4a, 0x715d, 0x653d, 0x715c, 0x715e, - 0x715f, 0x4f65, 0x7445, 0x3d73, 0x7160, 0x7161, 0x4e77, 0x522a, - 0x717b, 0x3832, 0x3c7b, 0x395b, 0x3966, 0x4359, 0x4a53, 0x6a68, - 0x4040, 0x3e75, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, - 0x6a6f, 0x3d47, 0x757b, 0x757d, 0x757e, 0x757c, 0x3d62, 0x7621, - 0x3425, 0x7622, 0x7623, 0x6c32, 0x5154, 0x596a, 0x7624, 0x6e3a, - 0x5532, 0x537e, 0x4c5c, 0x4a44, 0x6540, 0x7625, 0x3e2f, 0x4629, - 0x5a25, 0x3c46, 0x3629, 0x383c, 0x484f, 0x3c25, 0x5a26, 0x5a27, - 0x4c56, 0x4843, 0x5a28, 0x467d, 0x5135, 0x5269, 0x5136, 0x3c47, - 0x3d32, 0x3b64, 0x5a29, 0x5a2a, 0x5148, 0x5a2b, 0x506d, 0x366f, - 0x425b, 0x4b4f, 0x376d, 0x4968, 0x3743, 0x3e77, 0x5624, 0x5a2c, - 0x5a2d, 0x4640, 0x5767, 0x4a36, 0x5529, 0x4b5f, 0x556f, 0x5a2e, - 0x565f, 0x344a, 0x5a30, 0x5a2f, 0x526b, 0x5a31, 0x5a32, 0x5a33, - 0x4a54, 0x5a34, 0x4a2b, 0x5a35, 0x5a36, 0x334f, 0x566f, 0x5a37, - 0x3b30, 0x352e, 0x5a38, 0x5a39, 0x396e, 0x512f, 0x5268, 0x5a3a, - 0x3843, 0x4f6a, 0x326f, 0x5a3b, 0x5a3c, 0x3d6b, 0x4e5c, 0x536f, - 0x5a3d, 0x4e73, 0x5a3e, 0x5355, 0x3b65, 0x5a3f, 0x4b35, 0x4b50, - 0x5a40, 0x476b, 0x566e, 0x5a41, 0x4535, 0x3641, 0x5a42, 0x374c, - 0x3f4e, 0x5a43, 0x5a44, 0x4b2d, 0x5a45, 0x3577, 0x5a46, 0x4142, - 0x573b, 0x5a47, 0x4c38, 0x526a, 0x4431, 0x5a48, 0x357d, 0x3b51, - 0x5a49, 0x5033, 0x5a4a, 0x5a4b, 0x4e3d, 0x5a4c, 0x5a4d, 0x5a4e, - 0x3277, 0x5a51, 0x5a4f, 0x5168, 0x5a50, 0x4355, 0x5a52, 0x5a53, - 0x5a54, 0x5a55, 0x503b, 0x5225, 0x3079, 0x5a56, 0x472b, 0x5a57, - 0x3d77, 0x4321, 0x5a58, 0x5a59, 0x437d, 0x4c37, 0x5a5a, 0x5a5b, - 0x403e, 0x4657, 0x5a5c, 0x5a5d, 0x4734, 0x5a5e, 0x5a5f, 0x3948, - 0x3b6d, 0x3639, 0x7478, 0x7479, 0x4d63, 0x7539, 0x6b60, 0x4f73, - 0x3b3f, 0x3a40, 0x5425, 0x6159, 0x7574, 0x312a, 0x3272, 0x7575, - 0x7577, 0x3a51, 0x7576, 0x4332, 0x7579, 0x7578, 0x3134, 0x556a, - 0x383a, 0x3931, 0x3246, 0x5470, 0x4f4d, 0x305c, 0x554b, 0x3b75, - 0x564a, 0x3737, 0x4c30, 0x4636, 0x3161, 0x393a, 0x567c, 0x3961, - 0x3721, 0x3c7a, 0x6a5a, 0x6a5b, 0x4c79, 0x3973, 0x6a5c, 0x347b, - 0x4333, 0x3751, 0x3a58, 0x6a5d, 0x5474, 0x6a5e, 0x3c56, 0x3b5f, - 0x6a5f, 0x415e, 0x4238, 0x545f, 0x574a, 0x6a60, 0x6a61, 0x6a64, - 0x6a62, 0x6a63, 0x495e, 0x3833, 0x3644, 0x6a65, 0x4a6a, 0x494d, - 0x344d, 0x6259, 0x4562, 0x6a66, 0x4035, 0x5738, 0x6a67, 0x572c, - 0x487c, 0x5853, 0x584d, 0x545e, 0x5479, 0x4944, 0x532e, 0x3853, - 0x3360, 0x4962, 0x7476, 0x3a55, 0x7477, 0x575f, 0x7471, 0x3830, - 0x5554, 0x384f, 0x4670, 0x3343, 0x7472, 0x332c, 0x543d, 0x4777, - 0x7474, 0x7473, 0x4c4b, 0x4824, 0x7475, 0x5763, 0x453f, 0x7540, - 0x753b, 0x7543, 0x7542, 0x563a, 0x7541, 0x543e, 0x7544, 0x754c, - 0x304f, 0x3578, 0x7549, 0x754a, 0x455c, 0x7545, 0x7546, 0x7547, - 0x754b, 0x3e60, 0x7548, 0x387a, 0x7550, 0x7553, 0x3f67, 0x3972, - 0x753c, 0x754d, 0x4237, 0x4c78, 0x3c79, 0x754e, 0x754f, 0x7551, - 0x3665, 0x7552, 0x7555, 0x753d, 0x7554, 0x533b, 0x336c, 0x4c24, - 0x7556, 0x7557, 0x3e61, 0x7558, 0x4c5f, 0x755b, 0x3248, 0x5759, - 0x7559, 0x755a, 0x755c, 0x7562, 0x7560, 0x755f, 0x755d, 0x7561, - 0x755e, 0x7564, 0x7565, 0x4c63, 0x653f, 0x3538, 0x7563, 0x7568, - 0x4c23, 0x7566, 0x7567, 0x753e, 0x3144, 0x753f, 0x3545, 0x3264, - 0x756c, 0x7569, 0x3657, 0x756d, 0x756a, 0x756b, 0x345a, 0x546a, - 0x756e, 0x3379, 0x756f, 0x7571, 0x7570, 0x7572, 0x7573, 0x496d, - 0x392a, 0x477b, 0x3663, 0x4c49, 0x6a26, 0x3335, 0x547e, 0x396c, - 0x5079, 0x696d, 0x572a, 0x696e, 0x4256, 0x486d, 0x3a64, 0x696f, - 0x6970, 0x6971, 0x5661, 0x6972, 0x6973, 0x6975, 0x6974, 0x6976, - 0x6977, 0x4761, 0x6978, 0x5458, 0x6979, 0x3d4e, 0x697a, 0x697b, - 0x3d4f, 0x697c, 0x3828, 0x413e, 0x697d, 0x3132, 0x3b54, 0x3975, - 0x697e, 0x6a21, 0x6a22, 0x6a23, 0x3778, 0x3c2d, 0x4a64, 0x604e, - 0x542f, 0x4f3d, 0x5537, 0x6a24, 0x555e, 0x6a25, 0x5041, 0x393c, - 0x3447, 0x3159, 0x4031, 0x3166, 0x3167, 0x3168, 0x333d, 0x4868, - 0x6541, 0x315f, 0x4149, 0x346f, 0x4728, 0x5358, 0x4679, 0x5138, - 0x397d, 0x4275, 0x532d, 0x544b, 0x3d7c, 0x6542, 0x3735, 0x6543, - 0x3b39, 0x5562, 0x3d78, 0x5436, 0x4e25, 0x412c, 0x3359, 0x4c76, - 0x6546, 0x6544, 0x6548, 0x654a, 0x6547, 0x354f, 0x4648, 0x357c, - 0x6545, 0x4a76, 0x6549, 0x4354, 0x3145, 0x3c23, 0x5737, 0x4d4b, - 0x4b4d, 0x4a4a, 0x4c53, 0x654c, 0x654b, 0x4466, 0x5121, 0x5137, - 0x654d, 0x6550, 0x4d38, 0x5670, 0x654f, 0x355d, 0x4d3e, 0x6551, - 0x363a, 0x4d28, 0x3964, 0x4a45, 0x3351, 0x4b59, 0x546c, 0x6552, - 0x376a, 0x654e, 0x6555, 0x347e, 0x6556, 0x6553, 0x6554, 0x525d, - 0x425f, 0x3146, 0x5362, 0x365d, 0x4b6c, 0x6557, 0x5376, 0x3169, - 0x3674, 0x655a, 0x6558, 0x6559, 0x3540, 0x5245, 0x655c, 0x655e, - 0x655d, 0x4732, 0x5223, 0x655b, 0x5462, 0x555a, 0x6560, 0x5771, - 0x6561, 0x315c, 0x517b, 0x6562, 0x6564, 0x6563, 0x6565, 0x5258, - 0x354b, 0x675f, 0x5a75, 0x5a78, 0x5a76, 0x5a77, 0x5a7a, 0x504f, - 0x4447, 0x306e, 0x5030, 0x5a79, 0x534a, 0x3a2a, 0x5b22, 0x4771, - 0x5a7c, 0x5a7b, 0x495b, 0x5a7d, 0x5b21, 0x575e, 0x5a7e, 0x415a, - 0x5b25, 0x5374, 0x5b27, 0x5b24, 0x5b28, 0x3d3c, 0x4049, 0x5b23, - 0x5b26, 0x5623, 0x5b29, 0x5b2d, 0x5b2e, 0x5b2c, 0x3a42, 0x3f24, - 0x5b2b, 0x5b2a, 0x5447, 0x323f, 0x5b2f, 0x3979, 0x5b30, 0x333b, - 0x3526, 0x363c, 0x5b31, 0x3675, 0x5b32, 0x3149, 0x5b34, 0x5b33, - 0x5b35, 0x5b37, 0x5b36, 0x5b38, 0x5b39, 0x5b3a, 0x534f, 0x747a, - 0x4775, 0x5743, 0x4564, 0x747c, 0x747d, 0x747b, 0x3e46, 0x506f, - 0x3753, 0x544d, 0x4c2a, 0x7522, 0x7521, 0x3a28, 0x747e, 0x4b56, - 0x7524, 0x4052, 0x336a, 0x4d2a, 0x7525, 0x7523, 0x3d34, 0x7528, - 0x7529, 0x3d4d, 0x4338, 0x3f61, 0x4b61, 0x752a, 0x7526, 0x7527, - 0x4470, 0x752c, 0x343c, 0x576d, 0x3457, 0x752b, 0x752e, 0x752d, - 0x752f, 0x5051, 0x4351, 0x4829, 0x7530, 0x7531, 0x7532, 0x7533, - 0x7534, 0x7535, 0x7537, 0x7536, 0x7538, 0x3249, 0x5354, 0x4a4d, - 0x406f, 0x5658, 0x5230, 0x413f, 0x3d70, 0x382a, 0x3c78, 0x7646, - 0x7647, 0x7648, 0x7649, 0x764a, 0x764c, 0x764b, 0x7769, 0x764d, - 0x764e, 0x6e44, 0x6e45, 0x6e46, 0x556b, 0x3624, 0x6e48, 0x6e47, - 0x6e49, 0x6e4a, 0x4725, 0x6e4b, 0x6e4c, 0x3730, 0x3576, 0x6e4d, - 0x6e4f, 0x6e4e, 0x3846, 0x6e50, 0x6e51, 0x6e52, 0x365b, 0x332e, - 0x5653, 0x4446, 0x3135, 0x3856, 0x6e53, 0x6e54, 0x543f, 0x4755, - 0x3e7b, 0x4e59, 0x3933, 0x6e56, 0x6e55, 0x6e58, 0x6e57, 0x4525, - 0x6e59, 0x6e5a, 0x472e, 0x6e5b, 0x472f, 0x6e5c, 0x3227, 0x6e5d, - 0x6e5e, 0x6e5f, 0x6e60, 0x6e61, 0x576a, 0x6e62, 0x6e63, 0x3c58, - 0x6e64, 0x534b, 0x4c7a, 0x322c, 0x4165, 0x6e65, 0x4726, 0x432d, - 0x6e66, 0x6e67, 0x6e68, 0x6e69, 0x6e6a, 0x6e6b, 0x6e6c, 0x6e6d, - 0x6e6e, 0x6e6f, 0x6e70, 0x6e71, 0x6e72, 0x6e74, 0x6e73, 0x6e75, - 0x4d2d, 0x4241, 0x6e76, 0x6e77, 0x6e78, 0x5521, 0x6e79, 0x4f33, - 0x6e7a, 0x6e7b, 0x6e7c, 0x6e7d, 0x6f21, 0x6e7e, 0x6f22, 0x3875, - 0x437a, 0x6f23, 0x6f24, 0x3d42, 0x523f, 0x3279, 0x6f25, 0x6f26, - 0x6f27, 0x5278, 0x6f28, 0x567d, 0x6f29, 0x464c, 0x6f2a, 0x6f2b, - 0x4134, 0x6f2c, 0x4f7a, 0x4b78, 0x6f2e, 0x6f2d, 0x337a, 0x3978, - 0x6f2f, 0x6f30, 0x5062, 0x6f31, 0x6f32, 0x3766, 0x503f, 0x6f33, - 0x6f34, 0x6f35, 0x4871, 0x4c60, 0x6f36, 0x6f37, 0x6f38, 0x6f39, - 0x6f3a, 0x5560, 0x6f3b, 0x346d, 0x432a, 0x6f3c, 0x6f3d, 0x6f3e, - 0x6f3f, 0x4e7d, 0x6f40, 0x4260, 0x3438, 0x5736, 0x3d75, 0x4f47, - 0x6f43, 0x6f41, 0x6f42, 0x6f44, 0x3627, 0x3c7c, 0x3e62, 0x434c, - 0x6f45, 0x6f46, 0x6f47, 0x6f4f, 0x6f48, 0x6f49, 0x6f4a, 0x4742, - 0x6f71, 0x364d, 0x6f4b, 0x6f4c, 0x6f4d, 0x3646, 0x433e, 0x6f4e, - 0x6f50, 0x6f51, 0x6f52, 0x5572, 0x6f53, 0x4477, 0x6f54, 0x4478, - 0x6f55, 0x6f56, 0x3864, 0x3077, 0x6f57, 0x6f58, 0x6f59, 0x6f5a, - 0x6f5b, 0x6f5c, 0x6f5d, 0x6f5e, 0x3e35, 0x6f61, 0x6f5f, 0x6f60, - 0x6f62, 0x6f63, 0x414d, 0x6f64, 0x6f65, 0x6f66, 0x6f67, 0x6f68, - 0x6f69, 0x6f6a, 0x6f6b, 0x6f6c, 0x4058, 0x6f6d, 0x412d, 0x6f6e, - 0x6f6f, 0x6f70, 0x4f62, 0x3324, 0x4345, 0x6345, 0x4941, 0x6346, - 0x3155, 0x4e4a, 0x3433, 0x4872, 0x6347, 0x4f50, 0x6348, 0x3c64, - 0x6349, 0x634a, 0x4346, 0x5522, 0x4456, 0x396b, 0x4e45, 0x634b, - 0x4376, 0x634c, 0x3727, 0x3873, 0x3a52, 0x634d, 0x634e, 0x5444, - 0x634f, 0x6350, 0x514b, 0x6351, 0x6352, 0x6353, 0x6354, 0x5156, - 0x6355, 0x327b, 0x403b, 0x6356, 0x402b, 0x6357, 0x6358, 0x6359, - 0x635a, 0x635b, 0x3837, 0x5a62, 0x3653, 0x5a64, 0x5a63, 0x5a66, - 0x486e, 0x5a65, 0x3740, 0x5174, 0x5275, 0x5573, 0x3d57, 0x5768, - 0x5a68, 0x5a67, 0x3022, 0x4d53, 0x5a69, 0x383d, 0x3c4a, 0x423d, - 0x4224, 0x3342, 0x5a6a, 0x422a, 0x4430, 0x3d35, 0x4f5e, 0x5a6b, - 0x4942, 0x315d, 0x5a6c, 0x3638, 0x543a, 0x337d, 0x5a6d, 0x5449, - 0x4f55, 0x4563, 0x5a6e, 0x5a6f, 0x5a70, 0x416a, 0x4c55, 0x4f5d, - 0x5367, 0x4221, 0x5a71, 0x4b65, 0x5a72, 0x4b66, 0x527e, 0x3874, - 0x5a73, 0x302f, 0x4f36, 0x554f, 0x4b6d, 0x5a74, 0x6344, 0x4125, - 0x763f, 0x7640, 0x7641, 0x4451, 0x4838, 0x5163, 0x505b, 0x5145, - 0x3c2f, 0x394d, 0x6f74, 0x3446, 0x533a, 0x7642, 0x337b, 0x7643, - 0x3571, 0x7645, 0x536a, 0x7627, 0x5129, 0x7629, 0x7628, 0x4163, - 0x4057, 0x3122, 0x4e6d, 0x5068, 0x762b, 0x4f76, 0x762a, 0x5570, - 0x762c, 0x4339, 0x3b74, 0x762e, 0x762d, 0x445e, 0x4158, 0x4b2a, - 0x4f3c, 0x762f, 0x7630, 0x7631, 0x4236, 0x3054, 0x4579, 0x7632, - 0x4760, 0x7626, 0x3e38, 0x3e32, 0x3565, 0x3747, 0x3f3f, 0x4352, - 0x4366, 0x584c, 0x386f, 0x3d79, 0x5125, 0x3050, 0x7730, 0x7731, - 0x502c, 0x3030, 0x7732, 0x7733, 0x7734, 0x474a, 0x3e4f, 0x7737, - 0x7736, 0x315e, 0x7735, 0x7738, 0x7739, 0x4e24, 0x484d, 0x3a2b, - 0x6838, 0x6839, 0x683a, 0x3e42, 0x5274, 0x544f, 0x4958, 0x5233, - 0x3625, 0x476a, 0x717c, 0x4f6e, 0x4b33, 0x506b, 0x676f, 0x4d67, - 0x394b, 0x3659, 0x717d, 0x3064, 0x4b4c, 0x717e, 0x5424, 0x422d, - 0x416c, 0x4644, 0x3e31, 0x7221, 0x3c55, 0x7222, 0x7223, 0x7224, - 0x5243, 0x4635, 0x4d47, 0x7225, 0x5331, 0x3f45, 0x4c62, 0x7226, - 0x7227, 0x5155, 0x366e, 0x7228, 0x7229, 0x355f, 0x722a, 0x722b, - 0x327c, 0x722c, 0x722d, 0x4827, 0x3767, 0x6c29, 0x6c2a, 0x6c2b, - 0x6c2c, 0x462e, 0x6c2d, 0x6c2e, 0x3749, 0x4a33, 0x6238, 0x774f, - 0x7750, 0x324d, 0x7751, 0x7753, 0x7752, 0x623b, 0x3c22, 0x623c, - 0x623d, 0x623e, 0x623f, 0x6240, 0x6241, 0x3739, 0x527b, 0x3d24, - 0x4a4e, 0x3125, 0x4b47, 0x6242, 0x367c, 0x4844, 0x6243, 0x3d48, - 0x317d, 0x6244, 0x3676, 0x6245, 0x4459, 0x6246, 0x4f5a, 0x395d, - 0x6247, 0x4021, 0x6248, 0x3276, 0x6249, 0x4173, 0x624a, 0x624b, - 0x4278, 0x624c, 0x624d, 0x624e, 0x4a57, 0x5838, 0x5965, 0x4f63, - 0x7025, 0x5c30, 0x426d, 0x5426, 0x4d54, 0x5131, 0x335b, 0x477d, - 0x3235, 0x423f, 0x6660, 0x4a3b, 0x6661, 0x6662, 0x3e54, 0x6663, - 0x5724, 0x4d55, 0x6665, 0x3c5d, 0x6664, 0x6666, 0x6667, 0x426e, - 0x3d3e, 0x6668, 0x4266, 0x3a27, 0x6669, 0x666a, 0x3352, 0x5169, - 0x3f25, 0x666b, 0x466f, 0x666c, 0x666d, 0x666e, 0x462d, 0x666f, - 0x4927, 0x6670, 0x6671, 0x6672, 0x6539, 0x6673, 0x6674, 0x4262, - 0x6675, 0x6676, 0x5668, 0x6677, 0x6678, 0x3947, 0x773b, 0x773a, - 0x773e, 0x773c, 0x3a21, 0x773f, 0x7740, 0x7742, 0x7741, 0x7744, - 0x7743, 0x7745, 0x7746, 0x7747, 0x4b68, 0x385f, 0x7754, 0x7755, - 0x7756, 0x7758, 0x775a, 0x7757, 0x775b, 0x7759, 0x5757, 0x775c, - 0x775d, 0x775e, 0x775f, 0x7760, 0x5b4b, 0x582a, 0x6577, 0x396d, - 0x3f7d, 0x3b6a, 0x7749, 0x4647, 0x7748, 0x774a, 0x774c, 0x774b, - 0x774d, 0x4e3a, 0x774e, 0x4427, 0x5363, 0x764f, 0x4233, 0x7650, - 0x7651, 0x7652, 0x7653, 0x7654, 0x7656, 0x312b, 0x7657, 0x7658, - 0x7659, 0x765a, 0x765b, 0x765c, 0x765d, 0x765e, 0x4f4a, 0x765f, - 0x7660, 0x7661, 0x7662, 0x7663, 0x7664, 0x4070, 0x7665, 0x7666, - 0x7667, 0x7668, 0x7669, 0x766a, 0x766b, 0x766c, 0x766d, 0x766e, - 0x766f, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x3e28, 0x7675, - 0x7676, 0x7677, 0x7678, 0x487a, 0x7679, 0x767a, 0x767b, 0x767c, - 0x767d, 0x767e, 0x7721, 0x7722, 0x7723, 0x7724, 0x7725, 0x7726, - 0x7727, 0x7728, 0x316e, 0x7729, 0x772a, 0x772b, 0x772c, 0x772d, - 0x415b, 0x772e, 0x772f, 0x4471, 0x702f, 0x3c26, 0x7030, 0x4379, - 0x4538, 0x513b, 0x7031, 0x7032, 0x7033, 0x7034, 0x7035, 0x513c, - 0x516c, 0x7037, 0x7036, 0x5427, 0x4d52, 0x7038, 0x703a, 0x7039, - 0x703b, 0x703c, 0x386b, 0x703d, 0x3a68, 0x703e, 0x703f, 0x3e69, - 0x7040, 0x366c, 0x7041, 0x7042, 0x7043, 0x7044, 0x4835, 0x7045, - 0x7046, 0x7047, 0x4574, 0x7048, 0x7049, 0x704a, 0x773d, 0x704b, - 0x704c, 0x704d, 0x704e, 0x704f, 0x3a57, 0x7050, 0x7051, 0x7052, - 0x7053, 0x7054, 0x7055, 0x7056, 0x7058, 0x5325, 0x7057, 0x7059, - 0x753a, 0x4239, 0x7764, 0x7765, 0x7766, 0x7767, 0x7768, 0x4234, - 0x776a, 0x776b, 0x4273, 0x7470, 0x746f, 0x4269, 0x7761, 0x7762, - 0x3b46, 0x5964, 0x4a72, 0x4068, 0x7024, 0x3a5a, 0x472d, 0x442c, - 0x776c, 0x776d, 0x776e, 0x7770, 0x776f, 0x7771, 0x7774, 0x7773, - 0x7772, 0x7775, 0x7776, 0x6d69, 0x6d6a, 0x6d6b, 0x763c, 0x763d, - 0x763e, 0x3626, 0x583e, 0x3944, 0x583b, 0x5c31, 0x4a73, 0x7777, - 0x7778, 0x7779, 0x777b, 0x777a, 0x3147, 0x777c, 0x777d, 0x777e, - 0x466b, 0x6c34, 0x335d, 0x7633, 0x7634, 0x4164, 0x7635, 0x7636, - 0x7637, 0x7638, 0x7639, 0x763a, 0x4823, 0x763b, 0x417a, 0x3928, - 0x6d68, 0x396a, 0x595f, 0x2321, 0x2322, 0x2323, 0x2167, 0x2325, - 0x2326, 0x2327, 0x2328, 0x2329, 0x232a, 0x232b, 0x232c, 0x232d, - 0x232e, 0x232f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, - 0x2336, 0x2337, 0x2338, 0x2339, 0x233a, 0x233b, 0x233c, 0x233d, - 0x233e, 0x233f, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, - 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, - 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, - 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x235b, 0x235c, 0x235d, - 0x235e, 0x235f, 0x2360, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, - 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, - 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, - 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x237b, 0x237c, 0x237d, - 0x212b, 0x2169, 0x216a, 0x237e, 0x2324, -}; - -static const Summary16 gb2312_uni2indx_page00[70] = { - /* 0x0000 */ - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0190 }, { 3, 0x0003 }, - { 5, 0x0000 }, { 5, 0x0080 }, { 6, 0x3703 }, { 13, 0x168c }, - /* 0x0100 */ - { 19, 0x0002 }, { 20, 0x0808 }, { 22, 0x0800 }, { 23, 0x0000 }, - { 23, 0x2000 }, { 24, 0x0000 }, { 24, 0x0800 }, { 25, 0x0000 }, - { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, - { 25, 0x4000 }, { 26, 0x1555 }, { 33, 0x0000 }, { 33, 0x0000 }, - /* 0x0200 */ - { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, - { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, - { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, - { 33, 0x0280 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, - /* 0x0300 */ - { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, - { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, - { 35, 0x0000 }, { 35, 0xfffe }, { 50, 0x03fb }, { 59, 0xfffe }, - { 74, 0x03fb }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, - /* 0x0400 */ - { 83, 0x0002 }, { 84, 0xffff }, { 100, 0xffff }, { 116, 0xffff }, - { 132, 0xffff }, { 148, 0x0002 }, -}; -static const Summary16 gb2312_uni2indx_page20[101] = { - /* 0x2000 */ - { 149, 0x0000 }, { 149, 0x3360 }, { 155, 0x0040 }, { 156, 0x080d }, - { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, - { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, - { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, - /* 0x2100 */ - { 160, 0x0008 }, { 161, 0x0040 }, { 162, 0x0000 }, { 162, 0x0000 }, - { 162, 0x0000 }, { 162, 0x0000 }, { 162, 0x0fff }, { 174, 0x0000 }, - { 174, 0x0000 }, { 174, 0x000f }, { 178, 0x0000 }, { 178, 0x0000 }, - { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, - /* 0x2200 */ - { 178, 0x8100 }, { 180, 0x6402 }, { 184, 0x4fa1 }, { 192, 0x20f0 }, - { 197, 0x1100 }, { 199, 0x0000 }, { 199, 0xc033 }, { 205, 0x0000 }, - { 205, 0x0000 }, { 205, 0x0200 }, { 206, 0x0020 }, { 207, 0x0000 }, - { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, - /* 0x2300 */ - { 207, 0x0000 }, { 207, 0x0004 }, { 208, 0x0000 }, { 208, 0x0000 }, - { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, - { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, - { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, - /* 0x2400 */ - { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, - { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x03ff }, { 218, 0xfff0 }, - { 230, 0xffff }, { 246, 0x0fff }, { 258, 0x0000 }, { 258, 0x0000 }, - { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, - /* 0x2500 */ - { 258, 0xffff }, { 274, 0xffff }, { 290, 0xffff }, { 306, 0xffff }, - { 322, 0x0fff }, { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0000 }, - { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0003 }, { 336, 0x000c }, - { 338, 0xc8c0 }, { 343, 0x0000 }, { 343, 0x0000 }, { 343, 0x0000 }, - /* 0x2600 */ - { 343, 0x0060 }, { 345, 0x0000 }, { 345, 0x0000 }, { 345, 0x0000 }, - { 345, 0x0005 }, -}; -static const Summary16 gb2312_uni2indx_page30[35] = { - /* 0x3000 */ - { 347, 0xff2f }, { 360, 0x00fb }, { 367, 0x0000 }, { 367, 0x0000 }, - { 367, 0xfffe }, { 382, 0xffff }, { 398, 0xffff }, { 414, 0xffff }, - { 430, 0xffff }, { 446, 0x000f }, { 450, 0xfffe }, { 465, 0xffff }, - { 481, 0xffff }, { 497, 0xffff }, { 513, 0xffff }, { 529, 0x087f }, - /* 0x3100 */ - { 537, 0xffe0 }, { 548, 0xffff }, { 564, 0x03ff }, { 574, 0x0000 }, - { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, - { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, - { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, - /* 0x3200 */ - { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x03ff }, -}; -static const Summary16 gb2312_uni2indx_page4e[1263] = { - /* 0x4e00 */ - { 584, 0x7f8b }, { 595, 0x7f7b }, { 608, 0x3db4 }, { 617, 0xef55 }, - { 628, 0xfba8 }, { 638, 0xf35d }, { 649, 0x0243 }, { 653, 0x400b }, - { 657, 0xfb40 }, { 665, 0x8d3e }, { 674, 0x7bf7 }, { 687, 0x8c2c }, - { 693, 0x6eff }, { 706, 0xe3fa }, { 717, 0x1d3a }, { 725, 0xa8ed }, - /* 0x4f00 */ - { 734, 0xe602 }, { 740, 0xcf83 }, { 749, 0x8cf5 }, { 758, 0x3555 }, - { 766, 0xe048 }, { 771, 0xffab }, { 784, 0x92b9 }, { 792, 0xd859 }, - { 800, 0xab18 }, { 807, 0x2892 }, { 812, 0xd7e9 }, { 823, 0x8020 }, - { 825, 0xc438 }, { 831, 0xf583 }, { 840, 0xe74a }, { 849, 0x450a }, - /* 0x5000 */ - { 854, 0xb000 }, { 857, 0x9714 }, { 864, 0x7762 }, { 873, 0x5400 }, - { 876, 0xd188 }, { 882, 0x1420 }, { 885, 0x1020 }, { 887, 0xc8c0 }, - { 892, 0x2121 }, { 896, 0x0000 }, { 896, 0x13a8 }, { 902, 0x0c04 }, - { 905, 0x8000 }, { 906, 0x0440 }, { 908, 0x70c0 }, { 913, 0x0828 }, - /* 0x5100 */ - { 916, 0x08c0 }, { 919, 0x0004 }, { 920, 0x0002 }, { 921, 0x8000 }, - { 922, 0x2b7b }, { 932, 0x1472 }, { 938, 0x7924 }, { 945, 0x3bfb }, - { 957, 0x3327 }, { 965, 0x1ae4 }, { 972, 0x9835 }, { 979, 0x38ef }, - { 989, 0x9ad1 }, { 997, 0x2802 }, { 1000, 0xa813 }, { 1006, 0xbf69 }, - /* 0x5200 */ - { 1017, 0x65cf }, { 1027, 0x2fc6 }, { 1036, 0x6b11 }, { 1043, 0xafc9 }, - { 1053, 0x340f }, { 1060, 0x5053 }, { 1066, 0x86a2 }, { 1072, 0xa004 }, - { 1075, 0x0106 }, { 1078, 0xe809 }, { 1084, 0x3f0f }, { 1094, 0xc00e }, - { 1099, 0x0a88 }, { 1103, 0x8145 }, { 1108, 0x0010 }, { 1109, 0xc601 }, - /* 0x5300 */ - { 1114, 0xa161 }, { 1120, 0x26e1 }, { 1127, 0x444b }, { 1133, 0xce00 }, - { 1138, 0xc7aa }, { 1147, 0xd4ee }, { 1157, 0xcadf }, { 1168, 0x85bb }, - { 1177, 0x3a74 }, { 1185, 0xa520 }, { 1190, 0x436c }, { 1197, 0x8840 }, - { 1200, 0x3f06 }, { 1208, 0x8bd2 }, { 1216, 0xff79 }, { 1229, 0x3bef }, - /* 0x5400 */ - { 1241, 0xf75a }, { 1252, 0xe8ef }, { 1263, 0xfbcb }, { 1275, 0x5b36 }, - { 1284, 0x0d49 }, { 1290, 0x1bfd }, { 1301, 0x0154 }, { 1305, 0x39ee }, - { 1315, 0xd855 }, { 1323, 0x2e75 }, { 1332, 0xbfd8 }, { 1343, 0xa91a }, - { 1350, 0xf3d7 }, { 1362, 0xf6bf }, { 1375, 0x67e0 }, { 1383, 0xb40c }, - /* 0x5500 */ - { 1389, 0x82c2 }, { 1394, 0x0813 }, { 1398, 0xd49d }, { 1407, 0xd08b }, - { 1414, 0x065a }, { 1420, 0x1061 }, { 1424, 0x74f2 }, { 1433, 0x59e0 }, - { 1440, 0x8f9f }, { 1451, 0xb312 }, { 1458, 0x0080 }, { 1459, 0x6aaa }, - { 1467, 0x3230 }, { 1472, 0xb05e }, { 1480, 0x9d7a }, { 1490, 0x60ac }, - /* 0x5600 */ - { 1496, 0xd303 }, { 1503, 0xc900 }, { 1507, 0x3098 }, { 1512, 0x8a56 }, - { 1519, 0x7000 }, { 1522, 0x1390 }, { 1527, 0x1f14 }, { 1534, 0x1842 }, - { 1538, 0xc060 }, { 1542, 0x0008 }, { 1543, 0x8008 }, { 1545, 0x1080 }, - { 1547, 0x0400 }, { 1548, 0xec90 }, { 1555, 0x2817 }, { 1561, 0xe633 }, - /* 0x5700 */ - { 1570, 0x0758 }, { 1576, 0x9000 }, { 1578, 0xf708 }, { 1586, 0x4e09 }, - { 1592, 0xf485 }, { 1600, 0xfc83 }, { 1609, 0xaf53 }, { 1619, 0x18c8 }, - { 1624, 0x187c }, { 1631, 0x080c }, { 1634, 0x6adf }, { 1645, 0x0114 }, - { 1648, 0xc80c }, { 1653, 0xa734 }, { 1661, 0xa011 }, { 1665, 0x2710 }, - /* 0x5800 */ - { 1670, 0x28c5 }, { 1676, 0x4222 }, { 1680, 0x0413 }, { 1684, 0x0021 }, - { 1686, 0x3010 }, { 1689, 0x4112 }, { 1693, 0x1820 }, { 1696, 0x4000 }, - { 1697, 0x022b }, { 1702, 0xc60c }, { 1708, 0x0300 }, { 1710, 0x1000 }, - { 1711, 0x0022 }, { 1713, 0x0022 }, { 1715, 0x5810 }, { 1719, 0x0249 }, - /* 0x5900 */ - { 1723, 0xa094 }, { 1728, 0x9670 }, { 1735, 0xeeb0 }, { 1744, 0x1792 }, - { 1751, 0xcb96 }, { 1760, 0x05f2 }, { 1767, 0x0025 }, { 1770, 0x2358 }, - { 1776, 0x25de }, { 1785, 0x42cc }, { 1791, 0xcf38 }, { 1800, 0x4a04 }, - { 1804, 0x0c40 }, { 1807, 0x359f }, { 1817, 0x1128 }, { 1821, 0x8a00 }, - /* 0x5a00 */ - { 1824, 0x13fa }, { 1833, 0x910a }, { 1838, 0x0229 }, { 1842, 0x1056 }, - { 1847, 0x0641 }, { 1851, 0x0420 }, { 1853, 0x0484 }, { 1856, 0x84f0 }, - { 1862, 0x0000 }, { 1862, 0x0c04 }, { 1865, 0x0400 }, { 1866, 0x412c }, - { 1871, 0x1206 }, { 1875, 0x1154 }, { 1880, 0x0a4b }, { 1886, 0x0002 }, - /* 0x5b00 */ - { 1887, 0x0200 }, { 1888, 0x00c0 }, { 1890, 0x0000 }, { 1890, 0x0094 }, - { 1893, 0x0001 }, { 1894, 0xbfbb }, { 1907, 0x167c }, { 1915, 0x242b }, - { 1921, 0x9bbb }, { 1932, 0x7fa8 }, { 1942, 0x0c7f }, { 1951, 0xe379 }, - { 1961, 0x10f4 }, { 1967, 0xe00d }, { 1973, 0x4132 }, { 1978, 0x9f01 }, - /* 0x5c00 */ - { 1985, 0x8652 }, { 1991, 0x3572 }, { 1999, 0x10b4 }, { 2004, 0xff12 }, - { 2014, 0xcf27 }, { 2024, 0x4223 }, { 2029, 0xc06b }, { 2036, 0x8602 }, - { 2040, 0x3106 }, { 2045, 0x1fd3 }, { 2055, 0x3a0c }, { 2061, 0xa1aa }, - { 2068, 0x0812 }, { 2071, 0x0204 }, { 2073, 0x2572 }, { 2080, 0x0801 }, - /* 0x5d00 */ - { 2082, 0x40cc }, { 2087, 0x4850 }, { 2091, 0x62d0 }, { 2097, 0x6010 }, - { 2100, 0x1c80 }, { 2104, 0x2900 }, { 2107, 0x9a00 }, { 2111, 0x0010 }, - { 2112, 0x0004 }, { 2113, 0x2200 }, { 2115, 0x0000 }, { 2115, 0x0080 }, - { 2116, 0x2020 }, { 2118, 0x6800 }, { 2121, 0xcbe6 }, { 2131, 0x609e }, - /* 0x5e00 */ - { 2138, 0x916e }, { 2146, 0x3f73 }, { 2157, 0x60c0 }, { 2161, 0x3982 }, - { 2167, 0x1034 }, { 2171, 0x4830 }, { 2175, 0x0006 }, { 2177, 0xbd5c }, - { 2187, 0x8cd1 }, { 2194, 0xd6fb }, { 2206, 0x20e1 }, { 2211, 0x43e8 }, - { 2218, 0x0600 }, { 2220, 0x084e }, { 2225, 0x0500 }, { 2227, 0xc4d0 }, - /* 0x5f00 */ - { 2233, 0x8d1f }, { 2242, 0x89aa }, { 2249, 0xa6e1 }, { 2257, 0x1602 }, - { 2261, 0x0001 }, { 2262, 0x21ed }, { 2270, 0x3656 }, { 2278, 0x1a8b }, - { 2285, 0x1fb7 }, { 2296, 0x13a5 }, { 2303, 0x6502 }, { 2308, 0x30a0 }, - { 2312, 0xb278 }, { 2320, 0x23c7 }, { 2328, 0x6c93 }, { 2336, 0xe922 }, - /* 0x6000 */ - { 2343, 0xe47f }, { 2354, 0x3a74 }, { 2362, 0x8fe3 }, { 2372, 0x9820 }, - { 2376, 0x280e }, { 2381, 0x2625 }, { 2387, 0xbf9c }, { 2398, 0xbf49 }, - { 2408, 0x3218 }, { 2413, 0xac54 }, { 2420, 0xb949 }, { 2428, 0x1916 }, - { 2434, 0x0c60 }, { 2438, 0xb522 }, { 2445, 0xfbc1 }, { 2455, 0x0659 }, - /* 0x6100 */ - { 2461, 0xe343 }, { 2469, 0x8420 }, { 2472, 0x08d9 }, { 2478, 0x8000 }, - { 2479, 0x5500 }, { 2483, 0x2022 }, { 2486, 0x0184 }, { 2489, 0x00a1 }, - { 2492, 0x4800 }, { 2494, 0x2010 }, { 2496, 0x1380 }, { 2500, 0x4080 }, - { 2502, 0x0d04 }, { 2506, 0x0016 }, { 2509, 0x0040 }, { 2510, 0x8020 }, - /* 0x6200 */ - { 2512, 0xfd40 }, { 2520, 0x8de7 }, { 2530, 0x5436 }, { 2537, 0xe098 }, - { 2543, 0x7b8b }, { 2553, 0x091e }, { 2559, 0xfec8 }, { 2569, 0xd249 }, - { 2576, 0x0611 }, { 2580, 0x8dee }, { 2590, 0x1937 }, { 2598, 0xba22 }, - { 2605, 0x77f4 }, { 2616, 0x9fdd }, { 2628, 0xf3ec }, { 2639, 0xf0da }, - /* 0x6300 */ - { 2648, 0x4386 }, { 2654, 0xec42 }, { 2661, 0x8d3f }, { 2671, 0x2604 }, - { 2675, 0xfa6c }, { 2685, 0xc021 }, { 2689, 0x628e }, { 2696, 0x0cc2 }, - { 2701, 0xd785 }, { 2710, 0x0145 }, { 2714, 0x77ad }, { 2725, 0x5599 }, - { 2733, 0xe250 }, { 2739, 0x4045 }, { 2743, 0x260b }, { 2749, 0xa154 }, - /* 0x6400 */ - { 2755, 0x9827 }, { 2762, 0x5819 }, { 2768, 0x3443 }, { 2774, 0xa410 }, - { 2778, 0x05f2 }, { 2785, 0x4114 }, { 2789, 0x2280 }, { 2792, 0x0700 }, - { 2795, 0x00b4 }, { 2799, 0x4266 }, { 2805, 0x7210 }, { 2810, 0x15a1 }, - { 2816, 0x6025 }, { 2821, 0x4185 }, { 2826, 0x0054 }, { 2829, 0x0000 }, - /* 0x6500 */ - { 2829, 0x0201 }, { 2831, 0x0104 }, { 2833, 0xc820 }, { 2837, 0xcb70 }, - { 2845, 0x9320 }, { 2850, 0x6a62 }, { 2857, 0x184c }, { 2862, 0x0095 }, - { 2866, 0x1880 }, { 2869, 0x9a8b }, { 2877, 0xaab2 }, { 2885, 0x3201 }, - { 2889, 0xd87a }, { 2898, 0x00c4 }, { 2901, 0xf3e5 }, { 2912, 0x04c3 }, - /* 0x6600 */ - { 2917, 0xd44d }, { 2925, 0xa238 }, { 2931, 0xa1a1 }, { 2937, 0x5072 }, - { 2943, 0x980a }, { 2948, 0x84fc }, { 2956, 0xc152 }, { 2962, 0x44d1 }, - { 2968, 0x1094 }, { 2972, 0x20c2 }, { 2976, 0x4180 }, { 2979, 0x4210 }, - { 2982, 0x0000 }, { 2982, 0x3a00 }, { 2986, 0x0240 }, { 2988, 0xd29d }, - /* 0x6700 */ - { 2997, 0x2f01 }, { 3003, 0xa8b1 }, { 3010, 0xbd40 }, { 3017, 0x2432 }, - { 3022, 0xd34d }, { 3031, 0xd04b }, { 3038, 0xa723 }, { 3046, 0xd0ad }, - { 3054, 0x0a92 }, { 3059, 0x75a1 }, { 3067, 0xadac }, { 3076, 0x01e9 }, - { 3082, 0x801a }, { 3086, 0x771f }, { 3097, 0x9225 }, { 3103, 0xa01b }, - /* 0x6800 */ - { 3109, 0xdfa1 }, { 3119, 0x20ca }, { 3124, 0x0602 }, { 3127, 0x738c }, - { 3135, 0x577f }, { 3147, 0x003b }, { 3152, 0x0bff }, { 3163, 0x00d0 }, - { 3166, 0x806a }, { 3171, 0x0088 }, { 3173, 0xa1c4 }, { 3179, 0x0029 }, - { 3182, 0x2a05 }, { 3187, 0x0524 }, { 3191, 0x4009 }, { 3194, 0x1623 }, - /* 0x6900 */ - { 3200, 0x6822 }, { 3205, 0x8005 }, { 3208, 0x2011 }, { 3211, 0xa211 }, - { 3216, 0x0004 }, { 3217, 0x6490 }, { 3222, 0x4849 }, { 3227, 0x1382 }, - { 3232, 0x23d5 }, { 3240, 0x1930 }, { 3245, 0x2980 }, { 3249, 0x0892 }, - { 3253, 0x5402 }, { 3257, 0x8811 }, { 3261, 0x2001 }, { 3263, 0xa004 }, - /* 0x6a00 */ - { 3266, 0x0400 }, { 3267, 0x8180 }, { 3270, 0x8502 }, { 3274, 0x6022 }, - { 3278, 0x0090 }, { 3280, 0x0b01 }, { 3284, 0x0022 }, { 3286, 0x1202 }, - { 3289, 0x4011 }, { 3292, 0x0083 }, { 3295, 0x1a01 }, { 3299, 0x0000 }, - { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, - /* 0x6b00 */ - { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x009f }, { 3305, 0x4684 }, - { 3310, 0x12c8 }, { 3315, 0x0200 }, { 3316, 0x04fc }, { 3323, 0x1a00 }, - { 3326, 0x2ede }, { 3336, 0x0c4c }, { 3341, 0x0402 }, { 3343, 0x80b8 }, - { 3348, 0xa826 }, { 3354, 0x0afc }, { 3362, 0x8c02 }, { 3366, 0x2228 }, - /* 0x6c00 */ - { 3370, 0xa0e0 }, { 3375, 0x8f7b }, { 3386, 0xc7d6 }, { 3396, 0x2135 }, - { 3402, 0x06c7 }, { 3409, 0xf8b1 }, { 3418, 0x0713 }, { 3424, 0x6255 }, - { 3431, 0x936e }, { 3440, 0x8a19 }, { 3446, 0x6efa }, { 3457, 0xfb0e }, - { 3467, 0x1630 }, { 3472, 0x48f9 }, { 3480, 0xcd2f }, { 3490, 0x7deb }, - /* 0x6d00 */ - { 3502, 0x5892 }, { 3508, 0x4e84 }, { 3514, 0x4ca0 }, { 3519, 0x7a2e }, - { 3528, 0xedea }, { 3539, 0x561e }, { 3547, 0xc649 }, { 3554, 0x1190 }, - { 3558, 0x5324 }, { 3564, 0xe83a }, { 3572, 0xcfdb }, { 3584, 0x8124 }, - { 3588, 0x18f1 }, { 3595, 0x6342 }, { 3601, 0x5853 }, { 3608, 0x1a8a }, - /* 0x6e00 */ - { 3614, 0x7420 }, { 3619, 0x24d3 }, { 3626, 0xaa3b }, { 3635, 0x0514 }, - { 3639, 0x6018 }, { 3643, 0x8958 }, { 3649, 0x4800 }, { 3651, 0xc000 }, - { 3653, 0x8268 }, { 3658, 0x9101 }, { 3662, 0x84a4 }, { 3667, 0x2cd6 }, - { 3675, 0x8886 }, { 3680, 0xc4ba }, { 3688, 0x0377 }, { 3696, 0x0210 }, - /* 0x6f00 */ - { 3698, 0x8244 }, { 3702, 0x0038 }, { 3705, 0xae11 }, { 3712, 0x404a }, - { 3716, 0x28c0 }, { 3720, 0x5100 }, { 3723, 0x6044 }, { 3727, 0x1514 }, - { 3732, 0x7310 }, { 3738, 0x1000 }, { 3739, 0x0082 }, { 3741, 0x0248 }, - { 3744, 0x0205 }, { 3747, 0x4006 }, { 3750, 0xc003 }, { 3754, 0x0000 }, - /* 0x7000 */ - { 3754, 0x0000 }, { 3754, 0x0c02 }, { 3757, 0x0008 }, { 3758, 0x0220 }, - { 3760, 0x9000 }, { 3762, 0x4000 }, { 3763, 0xb800 }, { 3767, 0xd161 }, - { 3774, 0x4621 }, { 3779, 0x3274 }, { 3786, 0xf800 }, { 3791, 0x3b8a }, - { 3799, 0x050f }, { 3805, 0x8b00 }, { 3809, 0xbbd0 }, { 3818, 0x2280 }, - /* 0x7100 */ - { 3821, 0x0600 }, { 3823, 0x0769 }, { 3830, 0x8040 }, { 3832, 0x0043 }, - { 3835, 0x5420 }, { 3839, 0x5000 }, { 3841, 0x41d0 }, { 3846, 0x250c }, - { 3851, 0x8410 }, { 3854, 0x8310 }, { 3858, 0x1101 }, { 3861, 0x0228 }, - { 3864, 0x4008 }, { 3866, 0x0030 }, { 3868, 0x40a1 }, { 3872, 0x0200 }, - /* 0x7200 */ - { 3873, 0x0040 }, { 3874, 0x2000 }, { 3875, 0x1500 }, { 3878, 0xabe3 }, - { 3888, 0x3180 }, { 3892, 0xaa44 }, { 3898, 0xc2c6 }, { 3905, 0xc624 }, - { 3911, 0xac13 }, { 3918, 0x8004 }, { 3920, 0xb000 }, { 3923, 0x03d1 }, - { 3929, 0x611e }, { 3936, 0x4285 }, { 3941, 0xf303 }, { 3949, 0x1d9f }, - /* 0x7300 */ - { 3959, 0x440a }, { 3963, 0x78e8 }, { 3971, 0x5e26 }, { 3979, 0xc392 }, - { 3986, 0x2000 }, { 3987, 0x0085 }, { 3990, 0xb001 }, { 3994, 0x4000 }, - { 3995, 0x4a90 }, { 4000, 0x8842 }, { 4004, 0xca04 }, { 4009, 0x0c8d }, - { 4015, 0xa705 }, { 4022, 0x4203 }, { 4026, 0x22a1 }, { 4031, 0x0004 }, - /* 0x7400 */ - { 4032, 0x8668 }, { 4038, 0x0c01 }, { 4041, 0x5564 }, { 4048, 0x1079 }, - { 4054, 0x0002 }, { 4055, 0xdea0 }, { 4063, 0x2000 }, { 4064, 0x40c1 }, - { 4068, 0x488b }, { 4074, 0x5001 }, { 4077, 0x0380 }, { 4080, 0x0400 }, - { 4081, 0x0000 }, { 4081, 0x5004 }, { 4084, 0xc05d }, { 4091, 0x80d0 }, - /* 0x7500 */ - { 4095, 0xa010 }, { 4098, 0x970a }, { 4105, 0xbb20 }, { 4112, 0x4daf }, - { 4122, 0xd921 }, { 4129, 0x1e10 }, { 4134, 0x0460 }, { 4137, 0x8314 }, - { 4142, 0x8848 }, { 4146, 0xa6d6 }, { 4155, 0xd83b }, { 4164, 0x733f }, - { 4175, 0x27bc }, { 4184, 0x4974 }, { 4191, 0x0ddc }, { 4199, 0x9213 }, - /* 0x7600 */ - { 4205, 0x142b }, { 4211, 0x8ba1 }, { 4218, 0x2e75 }, { 4227, 0xd139 }, - { 4235, 0x3009 }, { 4239, 0x5050 }, { 4243, 0x8808 }, { 4246, 0x6900 }, - { 4250, 0x49d4 }, { 4257, 0x024a }, { 4261, 0x4010 }, { 4263, 0x8016 }, - { 4267, 0xe564 }, { 4275, 0x89d7 }, { 4284, 0xc020 }, { 4287, 0x5316 }, - /* 0x7700 */ - { 4294, 0x2b92 }, { 4301, 0x8600 }, { 4304, 0xa345 }, { 4311, 0x15e0 }, - { 4317, 0x008b }, { 4321, 0x0c03 }, { 4325, 0x196e }, { 4333, 0xe200 }, - { 4337, 0x7031 }, { 4343, 0x8006 }, { 4346, 0x16a5 }, { 4353, 0xa829 }, - { 4359, 0x2000 }, { 4360, 0x1880 }, { 4363, 0x7aac }, { 4372, 0xe148 }, - /* 0x7800 */ - { 4378, 0x3207 }, { 4384, 0xb5d6 }, { 4394, 0x32e8 }, { 4401, 0x5f91 }, - { 4410, 0x50a1 }, { 4415, 0x20e5 }, { 4421, 0x7c00 }, { 4426, 0x1080 }, - { 4428, 0x7280 }, { 4433, 0x9d8a }, { 4441, 0x00aa }, { 4445, 0x421f }, - { 4452, 0x0e22 }, { 4457, 0x0231 }, { 4461, 0x1100 }, { 4463, 0x0494 }, - /* 0x7900 */ - { 4467, 0x0022 }, { 4469, 0x4008 }, { 4471, 0x0010 }, { 4472, 0x5c10 }, - { 4477, 0x0343 }, { 4482, 0xfcc8 }, { 4491, 0xa1a5 }, { 4498, 0x0580 }, - { 4501, 0x8433 }, { 4507, 0x0400 }, { 4508, 0x0080 }, { 4509, 0x6e08 }, - { 4515, 0x2a4b }, { 4522, 0x8126 }, { 4527, 0xaad8 }, { 4535, 0x2901 }, - /* 0x7a00 */ - { 4539, 0x684d }, { 4546, 0x4490 }, { 4550, 0x0009 }, { 4552, 0xba88 }, - { 4559, 0x0040 }, { 4560, 0x0082 }, { 4562, 0x0000 }, { 4562, 0x87d1 }, - { 4570, 0x215b }, { 4577, 0xb1e6 }, { 4586, 0x3161 }, { 4592, 0x8008 }, - { 4594, 0x0800 }, { 4595, 0xc240 }, { 4599, 0xa069 }, { 4605, 0xa600 }, - /* 0x7b00 */ - { 4609, 0x8d58 }, { 4616, 0x4a32 }, { 4622, 0x5d71 }, { 4631, 0x550a }, - { 4637, 0x9aa0 }, { 4643, 0x2d57 }, { 4652, 0x4005 }, { 4655, 0x4aa6 }, - { 4662, 0x2021 }, { 4665, 0x30b1 }, { 4671, 0x3fc6 }, { 4681, 0x0112 }, - { 4684, 0x10c2 }, { 4688, 0x260a }, { 4693, 0x4462 }, { 4698, 0x5082 }, - /* 0x7c00 */ - { 4702, 0x9880 }, { 4706, 0x8040 }, { 4708, 0x04c0 }, { 4711, 0x8100 }, - { 4713, 0x2003 }, { 4716, 0x0000 }, { 4716, 0x0000 }, { 4716, 0x3818 }, - { 4721, 0x0200 }, { 4722, 0xf1a6 }, { 4731, 0x4434 }, { 4736, 0x720e }, - { 4743, 0x35a2 }, { 4750, 0x92e0 }, { 4756, 0x8101 }, { 4759, 0x0900 }, - /* 0x7d00 */ - { 4761, 0x0400 }, { 4762, 0x0000 }, { 4762, 0x8885 }, { 4767, 0x0000 }, - { 4767, 0x0000 }, { 4767, 0x0000 }, { 4767, 0x4000 }, { 4768, 0x0080 }, - { 4769, 0x0000 }, { 4769, 0x0000 }, { 4769, 0x4040 }, { 4771, 0x0000 }, - { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, - /* 0x7e00 */ - { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0800 }, - { 4772, 0x0082 }, { 4774, 0x0000 }, { 4774, 0x0000 }, { 4774, 0x0000 }, - { 4774, 0x0004 }, { 4775, 0x8800 }, { 4777, 0xbfff }, { 4792, 0xe7ef }, - { 4805, 0xffff }, { 4821, 0xffbf }, { 4836, 0xefef }, { 4850, 0xfdff }, - /* 0x7f00 */ - { 4865, 0xfbff }, { 4880, 0xbffe }, { 4894, 0xffff }, { 4910, 0x057f }, - { 4919, 0x0034 }, { 4922, 0x85b3 }, { 4930, 0x4706 }, { 4936, 0x4216 }, - { 4941, 0x5402 }, { 4945, 0xe410 }, { 4950, 0x8092 }, { 4954, 0xb305 }, - { 4961, 0x5422 }, { 4966, 0x8130 }, { 4970, 0x4263 }, { 4976, 0x180b }, - /* 0x8000 */ - { 4981, 0x387b }, { 4990, 0x13f5 }, { 4999, 0x07e5 }, { 5007, 0xa9ea }, - { 5016, 0x3c4c }, { 5023, 0x0514 }, { 5027, 0x0600 }, { 5029, 0x8002 }, - { 5031, 0x1ad9 }, { 5039, 0xbd48 }, { 5047, 0xee37 }, { 5058, 0xf496 }, - { 5067, 0x705f }, { 5076, 0x7ec0 }, { 5084, 0xbfb2 }, { 5095, 0x355f }, - /* 0x8100 */ - { 5105, 0xe644 }, { 5112, 0x455f }, { 5121, 0x9000 }, { 5123, 0x4146 }, - { 5128, 0x1d40 }, { 5133, 0x063b }, { 5140, 0x62a1 }, { 5146, 0xfe13 }, - { 5156, 0x8505 }, { 5161, 0x3902 }, { 5166, 0x0548 }, { 5170, 0x0c08 }, - { 5173, 0x144f }, { 5180, 0x0000 }, { 5180, 0x3488 }, { 5185, 0x5818 }, - /* 0x8200 */ - { 5190, 0x3077 }, { 5198, 0xd815 }, { 5205, 0xbd0e }, { 5214, 0x4bfb }, - { 5225, 0x8a90 }, { 5230, 0x8500 }, { 5233, 0xc100 }, { 5236, 0xe61d }, - { 5245, 0xed14 }, { 5253, 0xb386 }, { 5261, 0xff72 }, { 5273, 0x639b }, - { 5282, 0xfd92 }, { 5292, 0xd9be }, { 5303, 0x887b }, { 5311, 0x0a92 }, - /* 0x8300 */ - { 5316, 0xd3fe }, { 5328, 0x1cb2 }, { 5335, 0xb980 }, { 5341, 0x177a }, - { 5350, 0x82c9 }, { 5356, 0xdc17 }, { 5365, 0xfffb }, { 5380, 0x3980 }, - { 5385, 0x4260 }, { 5389, 0x590c }, { 5395, 0x0f01 }, { 5400, 0x37df }, - { 5412, 0x94a3 }, { 5419, 0xb150 }, { 5425, 0x0623 }, { 5430, 0x2307 }, - /* 0x8400 */ - { 5436, 0xf85a }, { 5445, 0x3102 }, { 5449, 0x01f0 }, { 5454, 0x3102 }, - { 5458, 0x0040 }, { 5459, 0x1e82 }, { 5465, 0x3a0a }, { 5471, 0x056a }, - { 5477, 0x5b84 }, { 5484, 0x1280 }, { 5487, 0x8002 }, { 5489, 0xa714 }, - { 5496, 0x2612 }, { 5501, 0xa04b }, { 5507, 0x1069 }, { 5512, 0x9001 }, - /* 0x8500 */ - { 5515, 0x1000 }, { 5516, 0x848a }, { 5521, 0x1802 }, { 5524, 0x3f80 }, - { 5531, 0x0708 }, { 5535, 0x4240 }, { 5538, 0x0110 }, { 5540, 0x4e14 }, - { 5546, 0x80b0 }, { 5550, 0x1800 }, { 5552, 0xc510 }, { 5557, 0x0281 }, - { 5560, 0x8202 }, { 5563, 0x1029 }, { 5567, 0x0210 }, { 5569, 0x8800 }, - /* 0x8600 */ - { 5571, 0x0020 }, { 5572, 0x0042 }, { 5574, 0x0280 }, { 5576, 0x1100 }, - { 5578, 0xe000 }, { 5581, 0x4413 }, { 5586, 0x5804 }, { 5590, 0xfe02 }, - { 5598, 0x3c07 }, { 5605, 0x3028 }, { 5609, 0x9798 }, { 5617, 0x0473 }, - { 5623, 0xced1 }, { 5632, 0xcb13 }, { 5640, 0x6210 }, { 5644, 0x431f }, - /* 0x8700 */ - { 5652, 0x278d }, { 5660, 0x55ac }, { 5668, 0x422e }, { 5674, 0xc892 }, - { 5680, 0x5380 }, { 5685, 0x0288 }, { 5688, 0x4039 }, { 5693, 0x7851 }, - { 5700, 0x292c }, { 5706, 0x8088 }, { 5709, 0xb900 }, { 5714, 0x2428 }, - { 5718, 0x0c41 }, { 5722, 0x080e }, { 5726, 0x4421 }, { 5730, 0x4200 }, - /* 0x8800 */ - { 5732, 0x0408 }, { 5734, 0x0868 }, { 5738, 0x0006 }, { 5740, 0x1204 }, - { 5743, 0x3031 }, { 5748, 0x0290 }, { 5751, 0x5b3e }, { 5761, 0xe085 }, - { 5767, 0x2936 }, { 5774, 0x1044 }, { 5777, 0x2814 }, { 5781, 0x1082 }, - { 5784, 0x4266 }, { 5790, 0x8334 }, { 5796, 0x013c }, { 5801, 0x531b }, - /* 0x8900 */ - { 5809, 0x0404 }, { 5811, 0x0e0d }, { 5817, 0x0c22 }, { 5821, 0x0051 }, - { 5824, 0x0012 }, { 5826, 0xc000 }, { 5828, 0x0040 }, { 5829, 0x8800 }, - { 5831, 0x004a }, { 5834, 0x0000 }, { 5834, 0x0000 }, { 5834, 0x0000 }, - { 5834, 0xdff6 }, { 5847, 0x5447 }, { 5854, 0x8868 }, { 5859, 0x0008 }, - /* 0x8a00 */ - { 5860, 0x0081 }, { 5862, 0x0000 }, { 5862, 0x0000 }, { 5862, 0x4000 }, - { 5863, 0x0100 }, { 5864, 0x0000 }, { 5864, 0x0000 }, { 5864, 0x0200 }, - { 5865, 0x0600 }, { 5867, 0x0008 }, { 5868, 0x0000 }, { 5868, 0x0000 }, - { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, - /* 0x8b00 */ - { 5868, 0x0080 }, { 5869, 0x0000 }, { 5869, 0x0040 }, { 5870, 0x0000 }, - { 5870, 0x0000 }, { 5870, 0x0000 }, { 5870, 0x1040 }, { 5872, 0x0000 }, - { 5872, 0x0000 }, { 5872, 0x0000 }, { 5872, 0xefff }, { 5887, 0xf7fd }, - { 5901, 0xff7f }, { 5916, 0xfffe }, { 5931, 0xfbff }, { 5946, 0xffff }, - /* 0x8c00 */ - { 5962, 0xfdff }, { 5977, 0xbfff }, { 5992, 0xffff }, { 6008, 0x00ff }, - { 6016, 0x12c2 }, { 6021, 0x0420 }, { 6023, 0x0c06 }, { 6027, 0x0708 }, - { 6031, 0x1624 }, { 6036, 0x0110 }, { 6038, 0x0000 }, { 6038, 0x0000 }, - { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, - /* 0x8d00 */ - { 6038, 0x0000 }, { 6038, 0xe000 }, { 6041, 0xfffe }, { 6056, 0xffff }, - { 6072, 0xffff }, { 6088, 0x7f79 }, { 6100, 0x28df }, { 6109, 0x00f9 }, - { 6115, 0x0c32 }, { 6120, 0x8012 }, { 6123, 0x0008 }, { 6124, 0xd53a }, - { 6133, 0xd858 }, { 6140, 0xecc2 }, { 6148, 0x9d18 }, { 6155, 0x2fa8 }, - /* 0x8e00 */ - { 6163, 0x9620 }, { 6168, 0xe010 }, { 6172, 0xd60c }, { 6179, 0x2622 }, - { 6184, 0x0f97 }, { 6193, 0x0206 }, { 6196, 0xb240 }, { 6201, 0x9055 }, - { 6207, 0x80a2 }, { 6211, 0x5011 }, { 6215, 0x9800 }, { 6218, 0x0404 }, - { 6220, 0x4000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, - /* 0x8f00 */ - { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, - { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0xfbc0 }, { 6230, 0xffff }, - { 6246, 0xeffe }, { 6260, 0xdffb }, { 6274, 0x0b08 }, { 6278, 0x6243 }, - { 6284, 0x41b6 }, { 6291, 0xfb3b }, { 6303, 0x6f74 }, { 6313, 0x2389 }, - /* 0x9000 */ - { 6319, 0xae7f }, { 6331, 0xecd7 }, { 6342, 0xe047 }, { 6349, 0x5960 }, - { 6355, 0xa096 }, { 6361, 0x098f }, { 6368, 0x612c }, { 6374, 0xa030 }, - { 6378, 0x090d }, { 6383, 0x2aaa }, { 6390, 0xd44e }, { 6398, 0x4f7b }, - { 6409, 0xc4b2 }, { 6416, 0x388b }, { 6423, 0xa9c6 }, { 6431, 0x6110 }, - /* 0x9100 */ - { 6435, 0x0014 }, { 6437, 0x4200 }, { 6439, 0x800c }, { 6442, 0x0202 }, - { 6444, 0xfe48 }, { 6453, 0x6485 }, { 6459, 0xd63e }, { 6469, 0xe3f7 }, - { 6481, 0x3aa0 }, { 6487, 0x0c07 }, { 6492, 0xe40c }, { 6498, 0x0430 }, - { 6501, 0xf680 }, { 6508, 0x1002 }, { 6510, 0x0000 }, { 6510, 0x0000 }, - /* 0x9200 */ - { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, - { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0010 }, - { 6511, 0x4000 }, { 6512, 0x0000 }, { 6512, 0x4000 }, { 6513, 0x0000 }, - { 6513, 0x0100 }, { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x0000 }, - /* 0x9300 */ - { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x4000 }, - { 6515, 0x0000 }, { 6515, 0x0000 }, { 6515, 0x0400 }, { 6516, 0x0000 }, - { 6516, 0x8000 }, { 6517, 0x0000 }, { 6517, 0x0000 }, { 6517, 0x0000 }, - { 6517, 0x0400 }, { 6518, 0x0040 }, { 6519, 0x0000 }, { 6519, 0x0000 }, - /* 0x9400 */ - { 6519, 0x0000 }, { 6519, 0x0000 }, { 6519, 0x0000 }, { 6519, 0x4000 }, - { 6520, 0x0000 }, { 6520, 0x0000 }, { 6520, 0x0800 }, { 6521, 0x0000 }, - { 6521, 0xffe0 }, { 6532, 0xfebd }, { 6545, 0xffff }, { 6561, 0xffff }, - { 6577, 0x7f7f }, { 6591, 0xfbe7 }, { 6604, 0xffbf }, { 6619, 0xf7ff }, - /* 0x9500 */ - { 6634, 0xffff }, { 6650, 0xefff }, { 6665, 0xff7e }, { 6679, 0xdff7 }, - { 6693, 0xf6f7 }, { 6706, 0xfbdf }, { 6720, 0xbffe }, { 6734, 0x804f }, - { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, - { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0xef00 }, { 6747, 0x7fff }, - /* 0x9600 */ - { 6762, 0xff7f }, { 6777, 0xb6f7 }, { 6789, 0x4406 }, { 6793, 0xb87e }, - { 6803, 0x3bf5 }, { 6814, 0x8831 }, { 6819, 0x1796 }, { 6827, 0x00f4 }, - { 6832, 0xa960 }, { 6838, 0x1391 }, { 6844, 0x0080 }, { 6845, 0x7249 }, - { 6852, 0xf2f3 }, { 6863, 0x0024 }, { 6865, 0x8701 }, { 6870, 0x42c8 }, - /* 0x9700 */ - { 6875, 0xe3d3 }, { 6885, 0x5048 }, { 6889, 0x2400 }, { 6891, 0x4305 }, - { 6896, 0x0000 }, { 6896, 0x4a4c }, { 6902, 0x0227 }, { 6907, 0x1058 }, - { 6911, 0x2820 }, { 6914, 0x0116 }, { 6918, 0xa809 }, { 6923, 0x0014 }, - { 6925, 0x0000 }, { 6925, 0x0000 }, { 6925, 0x3ec0 }, { 6932, 0x0068 }, - /* 0x9800 */ - { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, - { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0xffe0 }, - { 6946, 0xb7ff }, { 6960, 0xfddb }, { 6973, 0x00f7 }, { 6980, 0x0000 }, - { 6980, 0x4000 }, { 6981, 0xc72e }, { 6990, 0x0180 }, { 6992, 0x0000 }, - /* 0x9900 */ - { 6992, 0x2000 }, { 6993, 0x0001 }, { 6994, 0x4000 }, { 6995, 0x0000 }, - { 6995, 0x0000 }, { 6995, 0x0030 }, { 6997, 0xffa8 }, { 7008, 0xb4f7 }, - { 7019, 0xadf3 }, { 7030, 0x03ff }, { 7040, 0x0120 }, { 7042, 0x0000 }, - { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, - /* 0x9a00 */ - { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, - { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0xf000 }, { 7046, 0xfffb }, - { 7061, 0x9df7 }, { 7073, 0xfdcf }, { 7086, 0x01bf }, { 7094, 0x15c3 }, - { 7101, 0x1827 }, { 7107, 0x810a }, { 7111, 0xa842 }, { 7116, 0x0a00 }, - /* 0x9b00 */ - { 7118, 0x8108 }, { 7121, 0x8008 }, { 7123, 0x8008 }, { 7125, 0x1804 }, - { 7128, 0xa3be }, { 7138, 0x0012 }, { 7140, 0x0000 }, { 7140, 0x0000 }, - { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, - { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, - /* 0x9c00 */ - { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, - { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x9000 }, - { 7142, 0x69e6 }, { 7151, 0xdc37 }, { 7161, 0x6bff }, { 7174, 0x3dff }, - { 7187, 0xfcf8 }, { 7198, 0xf3f9 }, { 7210, 0x0004 }, -}; -static const Summary16 gb2312_uni2indx_page9e[27] = { - /* 0x9e00 */ - { 7211, 0x0000 }, { 7211, 0x8000 }, { 7212, 0xbf6f }, { 7225, 0xe7ee }, - { 7237, 0xdffe }, { 7251, 0x5da2 }, { 7259, 0x3fd8 }, { 7269, 0xc00b }, - { 7274, 0x0984 }, { 7278, 0xa00c }, { 7282, 0x0040 }, { 7283, 0x6910 }, - { 7288, 0xe210 }, { 7293, 0xb912 }, { 7300, 0x86a5 }, { 7307, 0x5a00 }, - /* 0x9f00 */ - { 7311, 0x6800 }, { 7314, 0x0289 }, { 7318, 0x9005 }, { 7322, 0x6a80 }, - { 7327, 0x0010 }, { 7328, 0x0003 }, { 7330, 0x0000 }, { 7330, 0x8000 }, - { 7331, 0x1ff9 }, { 7342, 0x8e00 }, { 7346, 0x0001 }, -}; -static const Summary16 gb2312_uni2indx_pageff[15] = { - /* 0xff00 */ - { 7347, 0xfffe }, { 7362, 0xffff }, { 7378, 0xffff }, { 7394, 0xffff }, - { 7410, 0xffff }, { 7426, 0x7fff }, { 7441, 0x0000 }, { 7441, 0x0000 }, - { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, - { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x002b }, -}; - -static int -gb2312_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - const Summary16 *summary = NULL; - if (wc < 0x0460) - summary = &gb2312_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x2000 && wc < 0x2650) - summary = &gb2312_uni2indx_page20[(wc>>4)-0x200]; - else if (wc >= 0x3000 && wc < 0x3230) - summary = &gb2312_uni2indx_page30[(wc>>4)-0x300]; - else if (wc >= 0x4e00 && wc < 0x9cf0) - summary = &gb2312_uni2indx_page4e[(wc>>4)-0x4e0]; - else if (wc >= 0x9e00 && wc < 0x9fb0) - summary = &gb2312_uni2indx_page9e[(wc>>4)-0x9e0]; - else if (wc >= 0xff00 && wc < 0xfff0) - summary = &gb2312_uni2indx_pageff[(wc>>4)-0xff0]; - if (summary) { - unsigned short used = summary->used; - unsigned int i = wc & 0x0f; - if (used & ((unsigned short) 1 << i)) { - unsigned short c; - /* Keep in `used' only the bits 0..i-1. */ - used &= ((unsigned short) 1 << i) - 1; - /* Add `summary->indx' and the number of bits set in `used'. */ - used = (used & 0x5555) + ((used & 0xaaaa) >> 1); - used = (used & 0x3333) + ((used & 0xcccc) >> 2); - used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); - used = (used & 0x00ff) + (used >> 8); - c = gb2312_2charset[summary->indx + used]; - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/gbk.h b/nx-X11/lib/X11/lcUniConv/gbk.h deleted file mode 100644 index 09c2e63ee..000000000 --- a/nx-X11/lib/X11/lcUniConv/gbk.h +++ /dev/null @@ -1,6200 +0,0 @@ - -/* - * GBK-0 - */ - -static const unsigned short gbk_2uni_page81[23766] = { - /* 0x81 */ - 0x4e02, 0x4e04, 0x4e05, 0x4e06, 0x4e0f, 0x4e12, 0x4e17, 0x4e1f, - 0x4e20, 0x4e21, 0x4e23, 0x4e26, 0x4e29, 0x4e2e, 0x4e2f, 0x4e31, - 0x4e33, 0x4e35, 0x4e37, 0x4e3c, 0x4e40, 0x4e41, 0x4e42, 0x4e44, - 0x4e46, 0x4e4a, 0x4e51, 0x4e55, 0x4e57, 0x4e5a, 0x4e5b, 0x4e62, - 0x4e63, 0x4e64, 0x4e65, 0x4e67, 0x4e68, 0x4e6a, 0x4e6b, 0x4e6c, - 0x4e6d, 0x4e6e, 0x4e6f, 0x4e72, 0x4e74, 0x4e75, 0x4e76, 0x4e77, - 0x4e78, 0x4e79, 0x4e7a, 0x4e7b, 0x4e7c, 0x4e7d, 0x4e7f, 0x4e80, - 0x4e81, 0x4e82, 0x4e83, 0x4e84, 0x4e85, 0x4e87, 0x4e8a, 0x4e90, - 0x4e96, 0x4e97, 0x4e99, 0x4e9c, 0x4e9d, 0x4e9e, 0x4ea3, 0x4eaa, - 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb4, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, - 0x4ebc, 0x4ebd, 0x4ebe, 0x4ec8, 0x4ecc, 0x4ecf, 0x4ed0, 0x4ed2, - 0x4eda, 0x4edb, 0x4edc, 0x4ee0, 0x4ee2, 0x4ee6, 0x4ee7, 0x4ee9, - 0x4eed, 0x4eee, 0x4eef, 0x4ef1, 0x4ef4, 0x4ef8, 0x4ef9, 0x4efa, - 0x4efc, 0x4efe, 0x4f00, 0x4f02, 0x4f03, 0x4f04, 0x4f05, 0x4f06, - 0x4f07, 0x4f08, 0x4f0b, 0x4f0c, 0x4f12, 0x4f13, 0x4f14, 0x4f15, - 0x4f16, 0x4f1c, 0x4f1d, 0x4f21, 0x4f23, 0x4f28, 0x4f29, 0x4f2c, - 0x4f2d, 0x4f2e, 0x4f31, 0x4f33, 0x4f35, 0x4f37, 0x4f39, 0x4f3b, - 0x4f3e, 0x4f3f, 0x4f40, 0x4f41, 0x4f42, 0x4f44, 0x4f45, 0x4f47, - 0x4f48, 0x4f49, 0x4f4a, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, - 0x4f61, 0x4f62, 0x4f66, 0x4f68, 0x4f6a, 0x4f6b, 0x4f6d, 0x4f6e, - 0x4f71, 0x4f72, 0x4f75, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7d, - 0x4f80, 0x4f81, 0x4f82, 0x4f85, 0x4f86, 0x4f87, 0x4f8a, 0x4f8c, - 0x4f8e, 0x4f90, 0x4f92, 0x4f93, 0x4f95, 0x4f96, 0x4f98, 0x4f99, - 0x4f9a, 0x4f9c, 0x4f9e, 0x4f9f, 0x4fa1, 0x4fa2, - /* 0x82 */ - 0x4fa4, 0x4fab, 0x4fad, 0x4fb0, 0x4fb1, 0x4fb2, 0x4fb3, 0x4fb4, - 0x4fb6, 0x4fb7, 0x4fb8, 0x4fb9, 0x4fba, 0x4fbb, 0x4fbc, 0x4fbd, - 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc2, 0x4fc6, 0x4fc7, 0x4fc8, 0x4fc9, - 0x4fcb, 0x4fcc, 0x4fcd, 0x4fd2, 0x4fd3, 0x4fd4, 0x4fd5, 0x4fd6, - 0x4fd9, 0x4fdb, 0x4fe0, 0x4fe2, 0x4fe4, 0x4fe5, 0x4fe7, 0x4feb, - 0x4fec, 0x4ff0, 0x4ff2, 0x4ff4, 0x4ff5, 0x4ff6, 0x4ff7, 0x4ff9, - 0x4ffb, 0x4ffc, 0x4ffd, 0x4fff, 0x5000, 0x5001, 0x5002, 0x5003, - 0x5004, 0x5005, 0x5006, 0x5007, 0x5008, 0x5009, 0x500a, 0x500b, - 0x500e, 0x5010, 0x5011, 0x5013, 0x5015, 0x5016, 0x5017, 0x501b, - 0x501d, 0x501e, 0x5020, 0x5022, 0x5023, 0x5024, 0x5027, 0x502b, - 0x502f, 0x5030, 0x5031, 0x5032, 0x5033, 0x5034, 0x5035, 0x5036, - 0x5037, 0x5038, 0x5039, 0x503b, 0x503d, 0x503f, 0x5040, 0x5041, - 0x5042, 0x5044, 0x5045, 0x5046, 0x5049, 0x504a, 0x504b, 0x504d, - 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5056, 0x5057, 0x5058, - 0x5059, 0x505b, 0x505d, 0x505e, 0x505f, 0x5060, 0x5061, 0x5062, - 0x5063, 0x5064, 0x5066, 0x5067, 0x5068, 0x5069, 0x506a, 0x506b, - 0x506d, 0x506e, 0x506f, 0x5070, 0x5071, 0x5072, 0x5073, 0x5074, - 0x5075, 0x5078, 0x5079, 0x507a, 0x507c, 0x507d, 0x5081, 0x5082, - 0x5083, 0x5084, 0x5086, 0x5087, 0x5089, 0x508a, 0x508b, 0x508c, - 0x508e, 0x508f, 0x5090, 0x5091, 0x5092, 0x5093, 0x5094, 0x5095, - 0x5096, 0x5097, 0x5098, 0x5099, 0x509a, 0x509b, 0x509c, 0x509d, - 0x509e, 0x509f, 0x50a0, 0x50a1, 0x50a2, 0x50a4, 0x50a6, 0x50aa, - 0x50ab, 0x50ad, 0x50ae, 0x50af, 0x50b0, 0x50b1, 0x50b3, 0x50b4, - 0x50b5, 0x50b6, 0x50b7, 0x50b8, 0x50b9, 0x50bc, - /* 0x83 */ - 0x50bd, 0x50be, 0x50bf, 0x50c0, 0x50c1, 0x50c2, 0x50c3, 0x50c4, - 0x50c5, 0x50c6, 0x50c7, 0x50c8, 0x50c9, 0x50ca, 0x50cb, 0x50cc, - 0x50cd, 0x50ce, 0x50d0, 0x50d1, 0x50d2, 0x50d3, 0x50d4, 0x50d5, - 0x50d7, 0x50d8, 0x50d9, 0x50db, 0x50dc, 0x50dd, 0x50de, 0x50df, - 0x50e0, 0x50e1, 0x50e2, 0x50e3, 0x50e4, 0x50e5, 0x50e8, 0x50e9, - 0x50ea, 0x50eb, 0x50ef, 0x50f0, 0x50f1, 0x50f2, 0x50f4, 0x50f6, - 0x50f7, 0x50f8, 0x50f9, 0x50fa, 0x50fc, 0x50fd, 0x50fe, 0x50ff, - 0x5100, 0x5101, 0x5102, 0x5103, 0x5104, 0x5105, 0x5108, 0x5109, - 0x510a, 0x510c, 0x510d, 0x510e, 0x510f, 0x5110, 0x5111, 0x5113, - 0x5114, 0x5115, 0x5116, 0x5117, 0x5118, 0x5119, 0x511a, 0x511b, - 0x511c, 0x511d, 0x511e, 0x511f, 0x5120, 0x5122, 0x5123, 0x5124, - 0x5125, 0x5126, 0x5127, 0x5128, 0x5129, 0x512a, 0x512b, 0x512c, - 0x512d, 0x512e, 0x512f, 0x5130, 0x5131, 0x5132, 0x5133, 0x5134, - 0x5135, 0x5136, 0x5137, 0x5138, 0x5139, 0x513a, 0x513b, 0x513c, - 0x513d, 0x513e, 0x5142, 0x5147, 0x514a, 0x514c, 0x514e, 0x514f, - 0x5150, 0x5152, 0x5153, 0x5157, 0x5158, 0x5159, 0x515b, 0x515d, - 0x515e, 0x515f, 0x5160, 0x5161, 0x5163, 0x5164, 0x5166, 0x5167, - 0x5169, 0x516a, 0x516f, 0x5172, 0x517a, 0x517e, 0x517f, 0x5183, - 0x5184, 0x5186, 0x5187, 0x518a, 0x518b, 0x518e, 0x518f, 0x5190, - 0x5191, 0x5193, 0x5194, 0x5198, 0x519a, 0x519d, 0x519e, 0x519f, - 0x51a1, 0x51a3, 0x51a6, 0x51a7, 0x51a8, 0x51a9, 0x51aa, 0x51ad, - 0x51ae, 0x51b4, 0x51b8, 0x51b9, 0x51ba, 0x51be, 0x51bf, 0x51c1, - 0x51c2, 0x51c3, 0x51c5, 0x51c8, 0x51ca, 0x51cd, 0x51ce, 0x51d0, - 0x51d2, 0x51d3, 0x51d4, 0x51d5, 0x51d6, 0x51d7, - /* 0x84 */ - 0x51d8, 0x51d9, 0x51da, 0x51dc, 0x51de, 0x51df, 0x51e2, 0x51e3, - 0x51e5, 0x51e6, 0x51e7, 0x51e8, 0x51e9, 0x51ea, 0x51ec, 0x51ee, - 0x51f1, 0x51f2, 0x51f4, 0x51f7, 0x51fe, 0x5204, 0x5205, 0x5209, - 0x520b, 0x520c, 0x520f, 0x5210, 0x5213, 0x5214, 0x5215, 0x521c, - 0x521e, 0x521f, 0x5221, 0x5222, 0x5223, 0x5225, 0x5226, 0x5227, - 0x522a, 0x522c, 0x522f, 0x5231, 0x5232, 0x5234, 0x5235, 0x523c, - 0x523e, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524b, - 0x524e, 0x524f, 0x5252, 0x5253, 0x5255, 0x5257, 0x5258, 0x5259, - 0x525a, 0x525b, 0x525d, 0x525f, 0x5260, 0x5262, 0x5263, 0x5264, - 0x5266, 0x5268, 0x526b, 0x526c, 0x526d, 0x526e, 0x5270, 0x5271, - 0x5273, 0x5274, 0x5275, 0x5276, 0x5277, 0x5278, 0x5279, 0x527a, - 0x527b, 0x527c, 0x527e, 0x5280, 0x5283, 0x5284, 0x5285, 0x5286, - 0x5287, 0x5289, 0x528a, 0x528b, 0x528c, 0x528d, 0x528e, 0x528f, - 0x5291, 0x5292, 0x5294, 0x5295, 0x5296, 0x5297, 0x5298, 0x5299, - 0x529a, 0x529c, 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52ae, 0x52af, - 0x52b0, 0x52b4, 0x52b5, 0x52b6, 0x52b7, 0x52b8, 0x52b9, 0x52ba, - 0x52bb, 0x52bc, 0x52bd, 0x52c0, 0x52c1, 0x52c2, 0x52c4, 0x52c5, - 0x52c6, 0x52c8, 0x52ca, 0x52cc, 0x52cd, 0x52ce, 0x52cf, 0x52d1, - 0x52d3, 0x52d4, 0x52d5, 0x52d7, 0x52d9, 0x52da, 0x52db, 0x52dc, - 0x52dd, 0x52de, 0x52e0, 0x52e1, 0x52e2, 0x52e3, 0x52e5, 0x52e6, - 0x52e7, 0x52e8, 0x52e9, 0x52ea, 0x52eb, 0x52ec, 0x52ed, 0x52ee, - 0x52ef, 0x52f1, 0x52f2, 0x52f3, 0x52f4, 0x52f5, 0x52f6, 0x52f7, - 0x52f8, 0x52fb, 0x52fc, 0x52fd, 0x5301, 0x5302, 0x5303, 0x5304, - 0x5307, 0x5309, 0x530a, 0x530b, 0x530c, 0x530e, - /* 0x85 */ - 0x5311, 0x5312, 0x5313, 0x5314, 0x5318, 0x531b, 0x531c, 0x531e, - 0x531f, 0x5322, 0x5324, 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, - 0x532c, 0x532d, 0x532f, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, - 0x5335, 0x5336, 0x5337, 0x5338, 0x533c, 0x533d, 0x5340, 0x5342, - 0x5344, 0x5346, 0x534b, 0x534c, 0x534d, 0x5350, 0x5354, 0x5358, - 0x5359, 0x535b, 0x535d, 0x5365, 0x5368, 0x536a, 0x536c, 0x536d, - 0x5372, 0x5376, 0x5379, 0x537b, 0x537c, 0x537d, 0x537e, 0x5380, - 0x5381, 0x5383, 0x5387, 0x5388, 0x538a, 0x538e, 0x538f, 0x5390, - 0x5391, 0x5392, 0x5393, 0x5394, 0x5396, 0x5397, 0x5399, 0x539b, - 0x539c, 0x539e, 0x53a0, 0x53a1, 0x53a4, 0x53a7, 0x53aa, 0x53ab, - 0x53ac, 0x53ad, 0x53af, 0x53b0, 0x53b1, 0x53b2, 0x53b3, 0x53b4, - 0x53b5, 0x53b7, 0x53b8, 0x53b9, 0x53ba, 0x53bc, 0x53bd, 0x53be, - 0x53c0, 0x53c3, 0x53c4, 0x53c5, 0x53c6, 0x53c7, 0x53ce, 0x53cf, - 0x53d0, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dc, 0x53dd, 0x53de, - 0x53e1, 0x53e2, 0x53e7, 0x53f4, 0x53fa, 0x53fe, 0x53ff, 0x5400, - 0x5402, 0x5405, 0x5407, 0x540b, 0x5414, 0x5418, 0x5419, 0x541a, - 0x541c, 0x5422, 0x5424, 0x5425, 0x542a, 0x5430, 0x5433, 0x5436, - 0x5437, 0x543a, 0x543d, 0x543f, 0x5441, 0x5442, 0x5444, 0x5445, - 0x5447, 0x5449, 0x544c, 0x544d, 0x544e, 0x544f, 0x5451, 0x545a, - 0x545d, 0x545e, 0x545f, 0x5460, 0x5461, 0x5463, 0x5465, 0x5467, - 0x5469, 0x546a, 0x546b, 0x546c, 0x546d, 0x546e, 0x546f, 0x5470, - 0x5474, 0x5479, 0x547a, 0x547e, 0x547f, 0x5481, 0x5483, 0x5485, - 0x5487, 0x5488, 0x5489, 0x548a, 0x548d, 0x5491, 0x5493, 0x5497, - 0x5498, 0x549c, 0x549e, 0x549f, 0x54a0, 0x54a1, - /* 0x86 */ - 0x54a2, 0x54a5, 0x54ae, 0x54b0, 0x54b2, 0x54b5, 0x54b6, 0x54b7, - 0x54b9, 0x54ba, 0x54bc, 0x54be, 0x54c3, 0x54c5, 0x54ca, 0x54cb, - 0x54d6, 0x54d8, 0x54db, 0x54e0, 0x54e1, 0x54e2, 0x54e3, 0x54e4, - 0x54eb, 0x54ec, 0x54ef, 0x54f0, 0x54f1, 0x54f4, 0x54f5, 0x54f6, - 0x54f7, 0x54f8, 0x54f9, 0x54fb, 0x54fe, 0x5500, 0x5502, 0x5503, - 0x5504, 0x5505, 0x5508, 0x550a, 0x550b, 0x550c, 0x550d, 0x550e, - 0x5512, 0x5513, 0x5515, 0x5516, 0x5517, 0x5518, 0x5519, 0x551a, - 0x551c, 0x551d, 0x551e, 0x551f, 0x5521, 0x5525, 0x5526, 0x5528, - 0x5529, 0x552b, 0x552d, 0x5532, 0x5534, 0x5535, 0x5536, 0x5538, - 0x5539, 0x553a, 0x553b, 0x553d, 0x5540, 0x5542, 0x5545, 0x5547, - 0x5548, 0x554b, 0x554c, 0x554d, 0x554e, 0x554f, 0x5551, 0x5552, - 0x5553, 0x5554, 0x5557, 0x5558, 0x5559, 0x555a, 0x555b, 0x555d, - 0x555e, 0x555f, 0x5560, 0x5562, 0x5563, 0x5568, 0x5569, 0x556b, - 0x556f, 0x5570, 0x5571, 0x5572, 0x5573, 0x5574, 0x5579, 0x557a, - 0x557d, 0x557f, 0x5585, 0x5586, 0x558c, 0x558d, 0x558e, 0x5590, - 0x5592, 0x5593, 0x5595, 0x5596, 0x5597, 0x559a, 0x559b, 0x559e, - 0x55a0, 0x55a1, 0x55a2, 0x55a3, 0x55a4, 0x55a5, 0x55a6, 0x55a8, - 0x55a9, 0x55aa, 0x55ab, 0x55ac, 0x55ad, 0x55ae, 0x55af, 0x55b0, - 0x55b2, 0x55b4, 0x55b6, 0x55b8, 0x55ba, 0x55bc, 0x55bf, 0x55c0, - 0x55c1, 0x55c2, 0x55c3, 0x55c6, 0x55c7, 0x55c8, 0x55ca, 0x55cb, - 0x55ce, 0x55cf, 0x55d0, 0x55d5, 0x55d7, 0x55d8, 0x55d9, 0x55da, - 0x55db, 0x55de, 0x55e0, 0x55e2, 0x55e7, 0x55e9, 0x55ed, 0x55ee, - 0x55f0, 0x55f1, 0x55f4, 0x55f6, 0x55f8, 0x55f9, 0x55fa, 0x55fb, - 0x55fc, 0x55ff, 0x5602, 0x5603, 0x5604, 0x5605, - /* 0x87 */ - 0x5606, 0x5607, 0x560a, 0x560b, 0x560d, 0x5610, 0x5611, 0x5612, - 0x5613, 0x5614, 0x5615, 0x5616, 0x5617, 0x5619, 0x561a, 0x561c, - 0x561d, 0x5620, 0x5621, 0x5622, 0x5625, 0x5626, 0x5628, 0x5629, - 0x562a, 0x562b, 0x562e, 0x562f, 0x5630, 0x5633, 0x5635, 0x5637, - 0x5638, 0x563a, 0x563c, 0x563d, 0x563e, 0x5640, 0x5641, 0x5642, - 0x5643, 0x5644, 0x5645, 0x5646, 0x5647, 0x5648, 0x5649, 0x564a, - 0x564b, 0x564f, 0x5650, 0x5651, 0x5652, 0x5653, 0x5655, 0x5656, - 0x565a, 0x565b, 0x565d, 0x565e, 0x565f, 0x5660, 0x5661, 0x5663, - 0x5665, 0x5666, 0x5667, 0x566d, 0x566e, 0x566f, 0x5670, 0x5672, - 0x5673, 0x5674, 0x5675, 0x5677, 0x5678, 0x5679, 0x567a, 0x567d, - 0x567e, 0x567f, 0x5680, 0x5681, 0x5682, 0x5683, 0x5684, 0x5687, - 0x5688, 0x5689, 0x568a, 0x568b, 0x568c, 0x568d, 0x5690, 0x5691, - 0x5692, 0x5694, 0x5695, 0x5696, 0x5697, 0x5698, 0x5699, 0x569a, - 0x569b, 0x569c, 0x569d, 0x569e, 0x569f, 0x56a0, 0x56a1, 0x56a2, - 0x56a4, 0x56a5, 0x56a6, 0x56a7, 0x56a8, 0x56a9, 0x56aa, 0x56ab, - 0x56ac, 0x56ad, 0x56ae, 0x56b0, 0x56b1, 0x56b2, 0x56b3, 0x56b4, - 0x56b5, 0x56b6, 0x56b8, 0x56b9, 0x56ba, 0x56bb, 0x56bd, 0x56be, - 0x56bf, 0x56c0, 0x56c1, 0x56c2, 0x56c3, 0x56c4, 0x56c5, 0x56c6, - 0x56c7, 0x56c8, 0x56c9, 0x56cb, 0x56cc, 0x56cd, 0x56ce, 0x56cf, - 0x56d0, 0x56d1, 0x56d2, 0x56d3, 0x56d5, 0x56d6, 0x56d8, 0x56d9, - 0x56dc, 0x56e3, 0x56e5, 0x56e6, 0x56e7, 0x56e8, 0x56e9, 0x56ea, - 0x56ec, 0x56ee, 0x56ef, 0x56f2, 0x56f3, 0x56f6, 0x56f7, 0x56f8, - 0x56fb, 0x56fc, 0x5700, 0x5701, 0x5702, 0x5705, 0x5707, 0x570b, - 0x570c, 0x570d, 0x570e, 0x570f, 0x5710, 0x5711, - /* 0x88 */ - 0x5712, 0x5713, 0x5714, 0x5715, 0x5716, 0x5717, 0x5718, 0x5719, - 0x571a, 0x571b, 0x571d, 0x571e, 0x5720, 0x5721, 0x5722, 0x5724, - 0x5725, 0x5726, 0x5727, 0x572b, 0x5731, 0x5732, 0x5734, 0x5735, - 0x5736, 0x5737, 0x5738, 0x573c, 0x573d, 0x573f, 0x5741, 0x5743, - 0x5744, 0x5745, 0x5746, 0x5748, 0x5749, 0x574b, 0x5752, 0x5753, - 0x5754, 0x5755, 0x5756, 0x5758, 0x5759, 0x5762, 0x5763, 0x5765, - 0x5767, 0x576c, 0x576e, 0x5770, 0x5771, 0x5772, 0x5774, 0x5775, - 0x5778, 0x5779, 0x577a, 0x577d, 0x577e, 0x577f, 0x5780, 0x5781, - 0x5787, 0x5788, 0x5789, 0x578a, 0x578d, 0x578e, 0x578f, 0x5790, - 0x5791, 0x5794, 0x5795, 0x5796, 0x5797, 0x5798, 0x5799, 0x579a, - 0x579c, 0x579d, 0x579e, 0x579f, 0x57a5, 0x57a8, 0x57aa, 0x57ac, - 0x57af, 0x57b0, 0x57b1, 0x57b3, 0x57b5, 0x57b6, 0x57b7, 0x57b9, - 0x57ba, 0x57bb, 0x57bc, 0x57bd, 0x57be, 0x57bf, 0x57c0, 0x57c1, - 0x57c4, 0x57c5, 0x57c6, 0x57c7, 0x57c8, 0x57c9, 0x57ca, 0x57cc, - 0x57cd, 0x57d0, 0x57d1, 0x57d3, 0x57d6, 0x57d7, 0x57db, 0x57dc, - 0x57de, 0x57e1, 0x57e2, 0x57e3, 0x57e5, 0x57e6, 0x57e7, 0x57e8, - 0x57e9, 0x57ea, 0x57eb, 0x57ec, 0x57ee, 0x57f0, 0x57f1, 0x57f2, - 0x57f3, 0x57f5, 0x57f6, 0x57f7, 0x57fb, 0x57fc, 0x57fe, 0x57ff, - 0x5801, 0x5803, 0x5804, 0x5805, 0x5808, 0x5809, 0x580a, 0x580c, - 0x580e, 0x580f, 0x5810, 0x5812, 0x5813, 0x5814, 0x5816, 0x5817, - 0x5818, 0x581a, 0x581b, 0x581c, 0x581d, 0x581f, 0x5822, 0x5823, - 0x5825, 0x5826, 0x5827, 0x5828, 0x5829, 0x582b, 0x582c, 0x582d, - 0x582e, 0x582f, 0x5831, 0x5832, 0x5833, 0x5834, 0x5836, 0x5837, - 0x5838, 0x5839, 0x583a, 0x583b, 0x583c, 0x583d, - /* 0x89 */ - 0x583e, 0x583f, 0x5840, 0x5841, 0x5842, 0x5843, 0x5845, 0x5846, - 0x5847, 0x5848, 0x5849, 0x584a, 0x584b, 0x584e, 0x584f, 0x5850, - 0x5852, 0x5853, 0x5855, 0x5856, 0x5857, 0x5859, 0x585a, 0x585b, - 0x585c, 0x585d, 0x585f, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, - 0x5866, 0x5867, 0x5868, 0x5869, 0x586a, 0x586d, 0x586e, 0x586f, - 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, 0x5877, - 0x5878, 0x5879, 0x587a, 0x587b, 0x587c, 0x587d, 0x587f, 0x5882, - 0x5884, 0x5886, 0x5887, 0x5888, 0x588a, 0x588b, 0x588c, 0x588d, - 0x588e, 0x588f, 0x5890, 0x5891, 0x5894, 0x5895, 0x5896, 0x5897, - 0x5898, 0x589b, 0x589c, 0x589d, 0x58a0, 0x58a1, 0x58a2, 0x58a3, - 0x58a4, 0x58a5, 0x58a6, 0x58a7, 0x58aa, 0x58ab, 0x58ac, 0x58ad, - 0x58ae, 0x58af, 0x58b0, 0x58b1, 0x58b2, 0x58b3, 0x58b4, 0x58b5, - 0x58b6, 0x58b7, 0x58b8, 0x58b9, 0x58ba, 0x58bb, 0x58bd, 0x58be, - 0x58bf, 0x58c0, 0x58c2, 0x58c3, 0x58c4, 0x58c6, 0x58c7, 0x58c8, - 0x58c9, 0x58ca, 0x58cb, 0x58cc, 0x58cd, 0x58ce, 0x58cf, 0x58d0, - 0x58d2, 0x58d3, 0x58d4, 0x58d6, 0x58d7, 0x58d8, 0x58d9, 0x58da, - 0x58db, 0x58dc, 0x58dd, 0x58de, 0x58df, 0x58e0, 0x58e1, 0x58e2, - 0x58e3, 0x58e5, 0x58e6, 0x58e7, 0x58e8, 0x58e9, 0x58ea, 0x58ed, - 0x58ef, 0x58f1, 0x58f2, 0x58f4, 0x58f5, 0x58f7, 0x58f8, 0x58fa, - 0x58fb, 0x58fc, 0x58fd, 0x58fe, 0x58ff, 0x5900, 0x5901, 0x5903, - 0x5905, 0x5906, 0x5908, 0x5909, 0x590a, 0x590b, 0x590c, 0x590e, - 0x5910, 0x5911, 0x5912, 0x5913, 0x5917, 0x5918, 0x591b, 0x591d, - 0x591e, 0x5920, 0x5921, 0x5922, 0x5923, 0x5926, 0x5928, 0x592c, - 0x5930, 0x5932, 0x5933, 0x5935, 0x5936, 0x593b, - /* 0x8a */ - 0x593d, 0x593e, 0x593f, 0x5940, 0x5943, 0x5945, 0x5946, 0x594a, - 0x594c, 0x594d, 0x5950, 0x5952, 0x5953, 0x5959, 0x595b, 0x595c, - 0x595d, 0x595e, 0x595f, 0x5961, 0x5963, 0x5964, 0x5966, 0x5967, - 0x5968, 0x5969, 0x596a, 0x596b, 0x596c, 0x596d, 0x596e, 0x596f, - 0x5970, 0x5971, 0x5972, 0x5975, 0x5977, 0x597a, 0x597b, 0x597c, - 0x597e, 0x597f, 0x5980, 0x5985, 0x5989, 0x598b, 0x598c, 0x598e, - 0x598f, 0x5990, 0x5991, 0x5994, 0x5995, 0x5998, 0x599a, 0x599b, - 0x599c, 0x599d, 0x599f, 0x59a0, 0x59a1, 0x59a2, 0x59a6, 0x59a7, - 0x59ac, 0x59ad, 0x59b0, 0x59b1, 0x59b3, 0x59b4, 0x59b5, 0x59b6, - 0x59b7, 0x59b8, 0x59ba, 0x59bc, 0x59bd, 0x59bf, 0x59c0, 0x59c1, - 0x59c2, 0x59c3, 0x59c4, 0x59c5, 0x59c7, 0x59c8, 0x59c9, 0x59cc, - 0x59cd, 0x59ce, 0x59cf, 0x59d5, 0x59d6, 0x59d9, 0x59db, 0x59de, - 0x59df, 0x59e0, 0x59e1, 0x59e2, 0x59e4, 0x59e6, 0x59e7, 0x59e9, - 0x59ea, 0x59eb, 0x59ed, 0x59ee, 0x59ef, 0x59f0, 0x59f1, 0x59f2, - 0x59f3, 0x59f4, 0x59f5, 0x59f6, 0x59f7, 0x59f8, 0x59fa, 0x59fc, - 0x59fd, 0x59fe, 0x5a00, 0x5a02, 0x5a0a, 0x5a0b, 0x5a0d, 0x5a0e, - 0x5a0f, 0x5a10, 0x5a12, 0x5a14, 0x5a15, 0x5a16, 0x5a17, 0x5a19, - 0x5a1a, 0x5a1b, 0x5a1d, 0x5a1e, 0x5a21, 0x5a22, 0x5a24, 0x5a26, - 0x5a27, 0x5a28, 0x5a2a, 0x5a2b, 0x5a2c, 0x5a2d, 0x5a2e, 0x5a2f, - 0x5a30, 0x5a33, 0x5a35, 0x5a37, 0x5a38, 0x5a39, 0x5a3a, 0x5a3b, - 0x5a3d, 0x5a3e, 0x5a3f, 0x5a41, 0x5a42, 0x5a43, 0x5a44, 0x5a45, - 0x5a47, 0x5a48, 0x5a4b, 0x5a4c, 0x5a4d, 0x5a4e, 0x5a4f, 0x5a50, - 0x5a51, 0x5a52, 0x5a53, 0x5a54, 0x5a56, 0x5a57, 0x5a58, 0x5a59, - 0x5a5b, 0x5a5c, 0x5a5d, 0x5a5e, 0x5a5f, 0x5a60, - /* 0x8b */ - 0x5a61, 0x5a63, 0x5a64, 0x5a65, 0x5a66, 0x5a68, 0x5a69, 0x5a6b, - 0x5a6c, 0x5a6d, 0x5a6e, 0x5a6f, 0x5a70, 0x5a71, 0x5a72, 0x5a73, - 0x5a78, 0x5a79, 0x5a7b, 0x5a7c, 0x5a7d, 0x5a7e, 0x5a80, 0x5a81, - 0x5a82, 0x5a83, 0x5a84, 0x5a85, 0x5a86, 0x5a87, 0x5a88, 0x5a89, - 0x5a8a, 0x5a8b, 0x5a8c, 0x5a8d, 0x5a8e, 0x5a8f, 0x5a90, 0x5a91, - 0x5a93, 0x5a94, 0x5a95, 0x5a96, 0x5a97, 0x5a98, 0x5a99, 0x5a9c, - 0x5a9d, 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa1, 0x5aa2, 0x5aa3, 0x5aa4, - 0x5aa5, 0x5aa6, 0x5aa7, 0x5aa8, 0x5aa9, 0x5aab, 0x5aac, 0x5aad, - 0x5aae, 0x5aaf, 0x5ab0, 0x5ab1, 0x5ab4, 0x5ab6, 0x5ab7, 0x5ab9, - 0x5aba, 0x5abb, 0x5abc, 0x5abd, 0x5abf, 0x5ac0, 0x5ac3, 0x5ac4, - 0x5ac5, 0x5ac6, 0x5ac7, 0x5ac8, 0x5aca, 0x5acb, 0x5acd, 0x5ace, - 0x5acf, 0x5ad0, 0x5ad1, 0x5ad3, 0x5ad5, 0x5ad7, 0x5ad9, 0x5ada, - 0x5adb, 0x5add, 0x5ade, 0x5adf, 0x5ae2, 0x5ae4, 0x5ae5, 0x5ae7, - 0x5ae8, 0x5aea, 0x5aec, 0x5aed, 0x5aee, 0x5aef, 0x5af0, 0x5af2, - 0x5af3, 0x5af4, 0x5af5, 0x5af6, 0x5af7, 0x5af8, 0x5af9, 0x5afa, - 0x5afb, 0x5afc, 0x5afd, 0x5afe, 0x5aff, 0x5b00, 0x5b01, 0x5b02, - 0x5b03, 0x5b04, 0x5b05, 0x5b06, 0x5b07, 0x5b08, 0x5b0a, 0x5b0b, - 0x5b0c, 0x5b0d, 0x5b0e, 0x5b0f, 0x5b10, 0x5b11, 0x5b12, 0x5b13, - 0x5b14, 0x5b15, 0x5b18, 0x5b19, 0x5b1a, 0x5b1b, 0x5b1c, 0x5b1d, - 0x5b1e, 0x5b1f, 0x5b20, 0x5b21, 0x5b22, 0x5b23, 0x5b24, 0x5b25, - 0x5b26, 0x5b27, 0x5b28, 0x5b29, 0x5b2a, 0x5b2b, 0x5b2c, 0x5b2d, - 0x5b2e, 0x5b2f, 0x5b30, 0x5b31, 0x5b33, 0x5b35, 0x5b36, 0x5b38, - 0x5b39, 0x5b3a, 0x5b3b, 0x5b3c, 0x5b3d, 0x5b3e, 0x5b3f, 0x5b41, - 0x5b42, 0x5b43, 0x5b44, 0x5b45, 0x5b46, 0x5b47, - /* 0x8c */ - 0x5b48, 0x5b49, 0x5b4a, 0x5b4b, 0x5b4c, 0x5b4d, 0x5b4e, 0x5b4f, - 0x5b52, 0x5b56, 0x5b5e, 0x5b60, 0x5b61, 0x5b67, 0x5b68, 0x5b6b, - 0x5b6d, 0x5b6e, 0x5b6f, 0x5b72, 0x5b74, 0x5b76, 0x5b77, 0x5b78, - 0x5b79, 0x5b7b, 0x5b7c, 0x5b7e, 0x5b7f, 0x5b82, 0x5b86, 0x5b8a, - 0x5b8d, 0x5b8e, 0x5b90, 0x5b91, 0x5b92, 0x5b94, 0x5b96, 0x5b9f, - 0x5ba7, 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5bae, 0x5baf, 0x5bb1, - 0x5bb2, 0x5bb7, 0x5bba, 0x5bbb, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bc3, - 0x5bc8, 0x5bc9, 0x5bca, 0x5bcb, 0x5bcd, 0x5bce, 0x5bcf, 0x5bd1, - 0x5bd4, 0x5bd5, 0x5bd6, 0x5bd7, 0x5bd8, 0x5bd9, 0x5bda, 0x5bdb, - 0x5bdc, 0x5be0, 0x5be2, 0x5be3, 0x5be6, 0x5be7, 0x5be9, 0x5bea, - 0x5beb, 0x5bec, 0x5bed, 0x5bef, 0x5bf1, 0x5bf2, 0x5bf3, 0x5bf4, - 0x5bf5, 0x5bf6, 0x5bf7, 0x5bfd, 0x5bfe, 0x5c00, 0x5c02, 0x5c03, - 0x5c05, 0x5c07, 0x5c08, 0x5c0b, 0x5c0c, 0x5c0d, 0x5c0e, 0x5c10, - 0x5c12, 0x5c13, 0x5c17, 0x5c19, 0x5c1b, 0x5c1e, 0x5c1f, 0x5c20, - 0x5c21, 0x5c23, 0x5c26, 0x5c28, 0x5c29, 0x5c2a, 0x5c2b, 0x5c2d, - 0x5c2e, 0x5c2f, 0x5c30, 0x5c32, 0x5c33, 0x5c35, 0x5c36, 0x5c37, - 0x5c43, 0x5c44, 0x5c46, 0x5c47, 0x5c4c, 0x5c4d, 0x5c52, 0x5c53, - 0x5c54, 0x5c56, 0x5c57, 0x5c58, 0x5c5a, 0x5c5b, 0x5c5c, 0x5c5d, - 0x5c5f, 0x5c62, 0x5c64, 0x5c67, 0x5c68, 0x5c69, 0x5c6a, 0x5c6b, - 0x5c6c, 0x5c6d, 0x5c70, 0x5c72, 0x5c73, 0x5c74, 0x5c75, 0x5c76, - 0x5c77, 0x5c78, 0x5c7b, 0x5c7c, 0x5c7d, 0x5c7e, 0x5c80, 0x5c83, - 0x5c84, 0x5c85, 0x5c86, 0x5c87, 0x5c89, 0x5c8a, 0x5c8b, 0x5c8e, - 0x5c8f, 0x5c92, 0x5c93, 0x5c95, 0x5c9d, 0x5c9e, 0x5c9f, 0x5ca0, - 0x5ca1, 0x5ca4, 0x5ca5, 0x5ca6, 0x5ca7, 0x5ca8, - /* 0x8d */ - 0x5caa, 0x5cae, 0x5caf, 0x5cb0, 0x5cb2, 0x5cb4, 0x5cb6, 0x5cb9, - 0x5cba, 0x5cbb, 0x5cbc, 0x5cbe, 0x5cc0, 0x5cc2, 0x5cc3, 0x5cc5, - 0x5cc6, 0x5cc7, 0x5cc8, 0x5cc9, 0x5cca, 0x5ccc, 0x5ccd, 0x5cce, - 0x5ccf, 0x5cd0, 0x5cd1, 0x5cd3, 0x5cd4, 0x5cd5, 0x5cd6, 0x5cd7, - 0x5cd8, 0x5cda, 0x5cdb, 0x5cdc, 0x5cdd, 0x5cde, 0x5cdf, 0x5ce0, - 0x5ce2, 0x5ce3, 0x5ce7, 0x5ce9, 0x5ceb, 0x5cec, 0x5cee, 0x5cef, - 0x5cf1, 0x5cf2, 0x5cf3, 0x5cf4, 0x5cf5, 0x5cf6, 0x5cf7, 0x5cf8, - 0x5cf9, 0x5cfa, 0x5cfc, 0x5cfd, 0x5cfe, 0x5cff, 0x5d00, 0x5d01, - 0x5d04, 0x5d05, 0x5d08, 0x5d09, 0x5d0a, 0x5d0b, 0x5d0c, 0x5d0d, - 0x5d0f, 0x5d10, 0x5d11, 0x5d12, 0x5d13, 0x5d15, 0x5d17, 0x5d18, - 0x5d19, 0x5d1a, 0x5d1c, 0x5d1d, 0x5d1f, 0x5d20, 0x5d21, 0x5d22, - 0x5d23, 0x5d25, 0x5d28, 0x5d2a, 0x5d2b, 0x5d2c, 0x5d2f, 0x5d30, - 0x5d31, 0x5d32, 0x5d33, 0x5d35, 0x5d36, 0x5d37, 0x5d38, 0x5d39, - 0x5d3a, 0x5d3b, 0x5d3c, 0x5d3f, 0x5d40, 0x5d41, 0x5d42, 0x5d43, - 0x5d44, 0x5d45, 0x5d46, 0x5d48, 0x5d49, 0x5d4d, 0x5d4e, 0x5d4f, - 0x5d50, 0x5d51, 0x5d52, 0x5d53, 0x5d54, 0x5d55, 0x5d56, 0x5d57, - 0x5d59, 0x5d5a, 0x5d5c, 0x5d5e, 0x5d5f, 0x5d60, 0x5d61, 0x5d62, - 0x5d63, 0x5d64, 0x5d65, 0x5d66, 0x5d67, 0x5d68, 0x5d6a, 0x5d6d, - 0x5d6e, 0x5d70, 0x5d71, 0x5d72, 0x5d73, 0x5d75, 0x5d76, 0x5d77, - 0x5d78, 0x5d79, 0x5d7a, 0x5d7b, 0x5d7c, 0x5d7d, 0x5d7e, 0x5d7f, - 0x5d80, 0x5d81, 0x5d83, 0x5d84, 0x5d85, 0x5d86, 0x5d87, 0x5d88, - 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c, 0x5d8d, 0x5d8e, 0x5d8f, 0x5d90, - 0x5d91, 0x5d92, 0x5d93, 0x5d94, 0x5d95, 0x5d96, 0x5d97, 0x5d98, - 0x5d9a, 0x5d9b, 0x5d9c, 0x5d9e, 0x5d9f, 0x5da0, - /* 0x8e */ - 0x5da1, 0x5da2, 0x5da3, 0x5da4, 0x5da5, 0x5da6, 0x5da7, 0x5da8, - 0x5da9, 0x5daa, 0x5dab, 0x5dac, 0x5dad, 0x5dae, 0x5daf, 0x5db0, - 0x5db1, 0x5db2, 0x5db3, 0x5db4, 0x5db5, 0x5db6, 0x5db8, 0x5db9, - 0x5dba, 0x5dbb, 0x5dbc, 0x5dbd, 0x5dbe, 0x5dbf, 0x5dc0, 0x5dc1, - 0x5dc2, 0x5dc3, 0x5dc4, 0x5dc6, 0x5dc7, 0x5dc8, 0x5dc9, 0x5dca, - 0x5dcb, 0x5dcc, 0x5dce, 0x5dcf, 0x5dd0, 0x5dd1, 0x5dd2, 0x5dd3, - 0x5dd4, 0x5dd5, 0x5dd6, 0x5dd7, 0x5dd8, 0x5dd9, 0x5dda, 0x5ddc, - 0x5ddf, 0x5de0, 0x5de3, 0x5de4, 0x5dea, 0x5dec, 0x5ded, 0x5df0, - 0x5df5, 0x5df6, 0x5df8, 0x5df9, 0x5dfa, 0x5dfb, 0x5dfc, 0x5dff, - 0x5e00, 0x5e04, 0x5e07, 0x5e09, 0x5e0a, 0x5e0b, 0x5e0d, 0x5e0e, - 0x5e12, 0x5e13, 0x5e17, 0x5e1e, 0x5e1f, 0x5e20, 0x5e21, 0x5e22, - 0x5e23, 0x5e24, 0x5e25, 0x5e28, 0x5e29, 0x5e2a, 0x5e2b, 0x5e2c, - 0x5e2f, 0x5e30, 0x5e32, 0x5e33, 0x5e34, 0x5e35, 0x5e36, 0x5e39, - 0x5e3a, 0x5e3e, 0x5e3f, 0x5e40, 0x5e41, 0x5e43, 0x5e46, 0x5e47, - 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, - 0x5e51, 0x5e52, 0x5e53, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, - 0x5e5c, 0x5e5d, 0x5e5f, 0x5e60, 0x5e63, 0x5e64, 0x5e65, 0x5e66, - 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, - 0x5e6f, 0x5e70, 0x5e71, 0x5e75, 0x5e77, 0x5e79, 0x5e7e, 0x5e81, - 0x5e82, 0x5e83, 0x5e85, 0x5e88, 0x5e89, 0x5e8c, 0x5e8d, 0x5e8e, - 0x5e92, 0x5e98, 0x5e9b, 0x5e9d, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4, - 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac, 0x5eae, 0x5eaf, 0x5eb0, - 0x5eb1, 0x5eb2, 0x5eb4, 0x5eba, 0x5ebb, 0x5ebc, 0x5ebd, 0x5ebf, - 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4, 0x5ec5, - /* 0x8f */ - 0x5ec6, 0x5ec7, 0x5ec8, 0x5ecb, 0x5ecc, 0x5ecd, 0x5ece, 0x5ecf, - 0x5ed0, 0x5ed4, 0x5ed5, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edc, - 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4, - 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee9, 0x5eeb, 0x5eec, 0x5eed, 0x5eee, - 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef5, 0x5ef8, 0x5ef9, - 0x5efb, 0x5efc, 0x5efd, 0x5f05, 0x5f06, 0x5f07, 0x5f09, 0x5f0c, - 0x5f0d, 0x5f0e, 0x5f10, 0x5f12, 0x5f14, 0x5f16, 0x5f19, 0x5f1a, - 0x5f1c, 0x5f1d, 0x5f1e, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f28, - 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f32, 0x5f33, 0x5f34, 0x5f35, - 0x5f36, 0x5f37, 0x5f38, 0x5f3b, 0x5f3d, 0x5f3e, 0x5f3f, 0x5f41, - 0x5f42, 0x5f43, 0x5f44, 0x5f45, 0x5f46, 0x5f47, 0x5f48, 0x5f49, - 0x5f4a, 0x5f4b, 0x5f4c, 0x5f4d, 0x5f4e, 0x5f4f, 0x5f51, 0x5f54, - 0x5f59, 0x5f5a, 0x5f5b, 0x5f5c, 0x5f5e, 0x5f5f, 0x5f60, 0x5f63, - 0x5f65, 0x5f67, 0x5f68, 0x5f6b, 0x5f6e, 0x5f6f, 0x5f72, 0x5f74, - 0x5f75, 0x5f76, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, 0x5f7f, 0x5f83, - 0x5f86, 0x5f8d, 0x5f8e, 0x5f8f, 0x5f91, 0x5f93, 0x5f94, 0x5f96, - 0x5f9a, 0x5f9b, 0x5f9d, 0x5f9e, 0x5f9f, 0x5fa0, 0x5fa2, 0x5fa3, - 0x5fa4, 0x5fa5, 0x5fa6, 0x5fa7, 0x5fa9, 0x5fab, 0x5fac, 0x5faf, - 0x5fb0, 0x5fb1, 0x5fb2, 0x5fb3, 0x5fb4, 0x5fb6, 0x5fb8, 0x5fb9, - 0x5fba, 0x5fbb, 0x5fbe, 0x5fbf, 0x5fc0, 0x5fc1, 0x5fc2, 0x5fc7, - 0x5fc8, 0x5fca, 0x5fcb, 0x5fce, 0x5fd3, 0x5fd4, 0x5fd5, 0x5fda, - 0x5fdb, 0x5fdc, 0x5fde, 0x5fdf, 0x5fe2, 0x5fe3, 0x5fe5, 0x5fe6, - 0x5fe8, 0x5fe9, 0x5fec, 0x5fef, 0x5ff0, 0x5ff2, 0x5ff3, 0x5ff4, - 0x5ff6, 0x5ff7, 0x5ff9, 0x5ffa, 0x5ffc, 0x6007, - /* 0x90 */ - 0x6008, 0x6009, 0x600b, 0x600c, 0x6010, 0x6011, 0x6013, 0x6017, - 0x6018, 0x601a, 0x601e, 0x601f, 0x6022, 0x6023, 0x6024, 0x602c, - 0x602d, 0x602e, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6036, - 0x6037, 0x6038, 0x6039, 0x603a, 0x603d, 0x603e, 0x6040, 0x6044, - 0x6045, 0x6046, 0x6047, 0x6048, 0x6049, 0x604a, 0x604c, 0x604e, - 0x604f, 0x6051, 0x6053, 0x6054, 0x6056, 0x6057, 0x6058, 0x605b, - 0x605c, 0x605e, 0x605f, 0x6060, 0x6061, 0x6065, 0x6066, 0x606e, - 0x6071, 0x6072, 0x6074, 0x6075, 0x6077, 0x607e, 0x6080, 0x6081, - 0x6082, 0x6085, 0x6086, 0x6087, 0x6088, 0x608a, 0x608b, 0x608e, - 0x608f, 0x6090, 0x6091, 0x6093, 0x6095, 0x6097, 0x6098, 0x6099, - 0x609c, 0x609e, 0x60a1, 0x60a2, 0x60a4, 0x60a5, 0x60a7, 0x60a9, - 0x60aa, 0x60ae, 0x60b0, 0x60b3, 0x60b5, 0x60b6, 0x60b7, 0x60b9, - 0x60ba, 0x60bd, 0x60be, 0x60bf, 0x60c0, 0x60c1, 0x60c2, 0x60c3, - 0x60c4, 0x60c7, 0x60c8, 0x60c9, 0x60cc, 0x60cd, 0x60ce, 0x60cf, - 0x60d0, 0x60d2, 0x60d3, 0x60d4, 0x60d6, 0x60d7, 0x60d9, 0x60db, - 0x60de, 0x60e1, 0x60e2, 0x60e3, 0x60e4, 0x60e5, 0x60ea, 0x60f1, - 0x60f2, 0x60f5, 0x60f7, 0x60f8, 0x60fb, 0x60fc, 0x60fd, 0x60fe, - 0x60ff, 0x6102, 0x6103, 0x6104, 0x6105, 0x6107, 0x610a, 0x610b, - 0x610c, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, 0x6116, 0x6117, - 0x6118, 0x6119, 0x611b, 0x611c, 0x611d, 0x611e, 0x6121, 0x6122, - 0x6125, 0x6128, 0x6129, 0x612a, 0x612c, 0x612d, 0x612e, 0x612f, - 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, 0x6137, - 0x6138, 0x6139, 0x613a, 0x613b, 0x613c, 0x613d, 0x613e, 0x6140, - 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, - /* 0x91 */ - 0x6147, 0x6149, 0x614b, 0x614d, 0x614f, 0x6150, 0x6152, 0x6153, - 0x6154, 0x6156, 0x6157, 0x6158, 0x6159, 0x615a, 0x615b, 0x615c, - 0x615e, 0x615f, 0x6160, 0x6161, 0x6163, 0x6164, 0x6165, 0x6166, - 0x6169, 0x616a, 0x616b, 0x616c, 0x616d, 0x616e, 0x616f, 0x6171, - 0x6172, 0x6173, 0x6174, 0x6176, 0x6178, 0x6179, 0x617a, 0x617b, - 0x617c, 0x617d, 0x617e, 0x617f, 0x6180, 0x6181, 0x6182, 0x6183, - 0x6184, 0x6185, 0x6186, 0x6187, 0x6188, 0x6189, 0x618a, 0x618c, - 0x618d, 0x618f, 0x6190, 0x6191, 0x6192, 0x6193, 0x6195, 0x6196, - 0x6197, 0x6198, 0x6199, 0x619a, 0x619b, 0x619c, 0x619e, 0x619f, - 0x61a0, 0x61a1, 0x61a2, 0x61a3, 0x61a4, 0x61a5, 0x61a6, 0x61aa, - 0x61ab, 0x61ad, 0x61ae, 0x61af, 0x61b0, 0x61b1, 0x61b2, 0x61b3, - 0x61b4, 0x61b5, 0x61b6, 0x61b8, 0x61b9, 0x61ba, 0x61bb, 0x61bc, - 0x61bd, 0x61bf, 0x61c0, 0x61c1, 0x61c3, 0x61c4, 0x61c5, 0x61c6, - 0x61c7, 0x61c9, 0x61cc, 0x61cd, 0x61ce, 0x61cf, 0x61d0, 0x61d3, - 0x61d5, 0x61d6, 0x61d7, 0x61d8, 0x61d9, 0x61da, 0x61db, 0x61dc, - 0x61dd, 0x61de, 0x61df, 0x61e0, 0x61e1, 0x61e2, 0x61e3, 0x61e4, - 0x61e5, 0x61e7, 0x61e8, 0x61e9, 0x61ea, 0x61eb, 0x61ec, 0x61ed, - 0x61ee, 0x61ef, 0x61f0, 0x61f1, 0x61f2, 0x61f3, 0x61f4, 0x61f6, - 0x61f7, 0x61f8, 0x61f9, 0x61fa, 0x61fb, 0x61fc, 0x61fd, 0x61fe, - 0x6200, 0x6201, 0x6202, 0x6203, 0x6204, 0x6205, 0x6207, 0x6209, - 0x6213, 0x6214, 0x6219, 0x621c, 0x621d, 0x621e, 0x6220, 0x6223, - 0x6226, 0x6227, 0x6228, 0x6229, 0x622b, 0x622d, 0x622f, 0x6230, - 0x6231, 0x6232, 0x6235, 0x6236, 0x6238, 0x6239, 0x623a, 0x623b, - 0x623c, 0x6242, 0x6244, 0x6245, 0x6246, 0x624a, - /* 0x92 */ - 0x624f, 0x6250, 0x6255, 0x6256, 0x6257, 0x6259, 0x625a, 0x625c, - 0x625d, 0x625e, 0x625f, 0x6260, 0x6261, 0x6262, 0x6264, 0x6265, - 0x6268, 0x6271, 0x6272, 0x6274, 0x6275, 0x6277, 0x6278, 0x627a, - 0x627b, 0x627d, 0x6281, 0x6282, 0x6283, 0x6285, 0x6286, 0x6287, - 0x6288, 0x628b, 0x628c, 0x628d, 0x628e, 0x628f, 0x6290, 0x6294, - 0x6299, 0x629c, 0x629d, 0x629e, 0x62a3, 0x62a6, 0x62a7, 0x62a9, - 0x62aa, 0x62ad, 0x62ae, 0x62af, 0x62b0, 0x62b2, 0x62b3, 0x62b4, - 0x62b6, 0x62b7, 0x62b8, 0x62ba, 0x62be, 0x62c0, 0x62c1, 0x62c3, - 0x62cb, 0x62cf, 0x62d1, 0x62d5, 0x62dd, 0x62de, 0x62e0, 0x62e1, - 0x62e4, 0x62ea, 0x62eb, 0x62f0, 0x62f2, 0x62f5, 0x62f8, 0x62f9, - 0x62fa, 0x62fb, 0x6300, 0x6303, 0x6304, 0x6305, 0x6306, 0x630a, - 0x630b, 0x630c, 0x630d, 0x630f, 0x6310, 0x6312, 0x6313, 0x6314, - 0x6315, 0x6317, 0x6318, 0x6319, 0x631c, 0x6326, 0x6327, 0x6329, - 0x632c, 0x632d, 0x632e, 0x6330, 0x6331, 0x6333, 0x6334, 0x6335, - 0x6336, 0x6337, 0x6338, 0x633b, 0x633c, 0x633e, 0x633f, 0x6340, - 0x6341, 0x6344, 0x6347, 0x6348, 0x634a, 0x6351, 0x6352, 0x6353, - 0x6354, 0x6356, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, 0x635c, - 0x635d, 0x6360, 0x6364, 0x6365, 0x6366, 0x6368, 0x636a, 0x636b, - 0x636c, 0x636f, 0x6370, 0x6372, 0x6373, 0x6374, 0x6375, 0x6378, - 0x6379, 0x637c, 0x637d, 0x637e, 0x637f, 0x6381, 0x6383, 0x6384, - 0x6385, 0x6386, 0x638b, 0x638d, 0x6391, 0x6393, 0x6394, 0x6395, - 0x6397, 0x6399, 0x639a, 0x639b, 0x639c, 0x639d, 0x639e, 0x639f, - 0x63a1, 0x63a4, 0x63a6, 0x63ab, 0x63af, 0x63b1, 0x63b2, 0x63b5, - 0x63b6, 0x63b9, 0x63bb, 0x63bd, 0x63bf, 0x63c0, - /* 0x93 */ - 0x63c1, 0x63c2, 0x63c3, 0x63c5, 0x63c7, 0x63c8, 0x63ca, 0x63cb, - 0x63cc, 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63d7, 0x63d8, 0x63d9, - 0x63da, 0x63db, 0x63dc, 0x63dd, 0x63df, 0x63e2, 0x63e4, 0x63e5, - 0x63e6, 0x63e7, 0x63e8, 0x63eb, 0x63ec, 0x63ee, 0x63ef, 0x63f0, - 0x63f1, 0x63f3, 0x63f5, 0x63f7, 0x63f9, 0x63fa, 0x63fb, 0x63fc, - 0x63fe, 0x6403, 0x6404, 0x6406, 0x6407, 0x6408, 0x6409, 0x640a, - 0x640d, 0x640e, 0x6411, 0x6412, 0x6415, 0x6416, 0x6417, 0x6418, - 0x6419, 0x641a, 0x641d, 0x641f, 0x6422, 0x6423, 0x6424, 0x6425, - 0x6427, 0x6428, 0x6429, 0x642b, 0x642e, 0x642f, 0x6430, 0x6431, - 0x6432, 0x6433, 0x6435, 0x6436, 0x6437, 0x6438, 0x6439, 0x643b, - 0x643c, 0x643e, 0x6440, 0x6442, 0x6443, 0x6449, 0x644b, 0x644c, - 0x644d, 0x644e, 0x644f, 0x6450, 0x6451, 0x6453, 0x6455, 0x6456, - 0x6457, 0x6459, 0x645a, 0x645b, 0x645c, 0x645d, 0x645f, 0x6460, - 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, 0x6466, 0x6468, 0x646a, - 0x646b, 0x646c, 0x646e, 0x646f, 0x6470, 0x6471, 0x6472, 0x6473, - 0x6474, 0x6475, 0x6476, 0x6477, 0x647b, 0x647c, 0x647d, 0x647e, - 0x647f, 0x6480, 0x6481, 0x6483, 0x6486, 0x6488, 0x6489, 0x648a, - 0x648b, 0x648c, 0x648d, 0x648e, 0x648f, 0x6490, 0x6493, 0x6494, - 0x6497, 0x6498, 0x649a, 0x649b, 0x649c, 0x649d, 0x649f, 0x64a0, - 0x64a1, 0x64a2, 0x64a3, 0x64a5, 0x64a6, 0x64a7, 0x64a8, 0x64aa, - 0x64ab, 0x64af, 0x64b1, 0x64b2, 0x64b3, 0x64b4, 0x64b6, 0x64b9, - 0x64bb, 0x64bd, 0x64be, 0x64bf, 0x64c1, 0x64c3, 0x64c4, 0x64c6, - 0x64c7, 0x64c8, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64cf, 0x64d1, - 0x64d3, 0x64d4, 0x64d5, 0x64d6, 0x64d9, 0x64da, - /* 0x94 */ - 0x64db, 0x64dc, 0x64dd, 0x64df, 0x64e0, 0x64e1, 0x64e3, 0x64e5, - 0x64e7, 0x64e8, 0x64e9, 0x64ea, 0x64eb, 0x64ec, 0x64ed, 0x64ee, - 0x64ef, 0x64f0, 0x64f1, 0x64f2, 0x64f3, 0x64f4, 0x64f5, 0x64f6, - 0x64f7, 0x64f8, 0x64f9, 0x64fa, 0x64fb, 0x64fc, 0x64fd, 0x64fe, - 0x64ff, 0x6501, 0x6502, 0x6503, 0x6504, 0x6505, 0x6506, 0x6507, - 0x6508, 0x650a, 0x650b, 0x650c, 0x650d, 0x650e, 0x650f, 0x6510, - 0x6511, 0x6513, 0x6514, 0x6515, 0x6516, 0x6517, 0x6519, 0x651a, - 0x651b, 0x651c, 0x651d, 0x651e, 0x651f, 0x6520, 0x6521, 0x6522, - 0x6523, 0x6524, 0x6526, 0x6527, 0x6528, 0x6529, 0x652a, 0x652c, - 0x652d, 0x6530, 0x6531, 0x6532, 0x6533, 0x6537, 0x653a, 0x653c, - 0x653d, 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6546, 0x6547, - 0x654a, 0x654b, 0x654d, 0x654e, 0x6550, 0x6552, 0x6553, 0x6554, - 0x6557, 0x6558, 0x655a, 0x655c, 0x655f, 0x6560, 0x6561, 0x6564, - 0x6565, 0x6567, 0x6568, 0x6569, 0x656a, 0x656d, 0x656e, 0x656f, - 0x6571, 0x6573, 0x6575, 0x6576, 0x6578, 0x6579, 0x657a, 0x657b, - 0x657c, 0x657d, 0x657e, 0x657f, 0x6580, 0x6581, 0x6582, 0x6583, - 0x6584, 0x6585, 0x6586, 0x6588, 0x6589, 0x658a, 0x658d, 0x658e, - 0x658f, 0x6592, 0x6594, 0x6595, 0x6596, 0x6598, 0x659a, 0x659d, - 0x659e, 0x65a0, 0x65a2, 0x65a3, 0x65a6, 0x65a8, 0x65aa, 0x65ac, - 0x65ae, 0x65b1, 0x65b2, 0x65b3, 0x65b4, 0x65b5, 0x65b6, 0x65b7, - 0x65b8, 0x65ba, 0x65bb, 0x65be, 0x65bf, 0x65c0, 0x65c2, 0x65c7, - 0x65c8, 0x65c9, 0x65ca, 0x65cd, 0x65d0, 0x65d1, 0x65d3, 0x65d4, - 0x65d5, 0x65d8, 0x65d9, 0x65da, 0x65db, 0x65dc, 0x65dd, 0x65de, - 0x65df, 0x65e1, 0x65e3, 0x65e4, 0x65ea, 0x65eb, - /* 0x95 */ - 0x65f2, 0x65f3, 0x65f4, 0x65f5, 0x65f8, 0x65f9, 0x65fb, 0x65fc, - 0x65fd, 0x65fe, 0x65ff, 0x6601, 0x6604, 0x6605, 0x6607, 0x6608, - 0x6609, 0x660b, 0x660d, 0x6610, 0x6611, 0x6612, 0x6616, 0x6617, - 0x6618, 0x661a, 0x661b, 0x661c, 0x661e, 0x6621, 0x6622, 0x6623, - 0x6624, 0x6626, 0x6629, 0x662a, 0x662b, 0x662c, 0x662e, 0x6630, - 0x6632, 0x6633, 0x6637, 0x6638, 0x6639, 0x663a, 0x663b, 0x663d, - 0x663f, 0x6640, 0x6642, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, - 0x6649, 0x664a, 0x664d, 0x664e, 0x6650, 0x6651, 0x6658, 0x6659, - 0x665b, 0x665c, 0x665d, 0x665e, 0x6660, 0x6662, 0x6663, 0x6665, - 0x6667, 0x6669, 0x666a, 0x666b, 0x666c, 0x666d, 0x6671, 0x6672, - 0x6673, 0x6675, 0x6678, 0x6679, 0x667b, 0x667c, 0x667d, 0x667f, - 0x6680, 0x6681, 0x6683, 0x6685, 0x6686, 0x6688, 0x6689, 0x668a, - 0x668b, 0x668d, 0x668e, 0x668f, 0x6690, 0x6692, 0x6693, 0x6694, - 0x6695, 0x6698, 0x6699, 0x669a, 0x669b, 0x669c, 0x669e, 0x669f, - 0x66a0, 0x66a1, 0x66a2, 0x66a3, 0x66a4, 0x66a5, 0x66a6, 0x66a9, - 0x66aa, 0x66ab, 0x66ac, 0x66ad, 0x66af, 0x66b0, 0x66b1, 0x66b2, - 0x66b3, 0x66b5, 0x66b6, 0x66b7, 0x66b8, 0x66ba, 0x66bb, 0x66bc, - 0x66bd, 0x66bf, 0x66c0, 0x66c1, 0x66c2, 0x66c3, 0x66c4, 0x66c5, - 0x66c6, 0x66c7, 0x66c8, 0x66c9, 0x66ca, 0x66cb, 0x66cc, 0x66cd, - 0x66ce, 0x66cf, 0x66d0, 0x66d1, 0x66d2, 0x66d3, 0x66d4, 0x66d5, - 0x66d6, 0x66d7, 0x66d8, 0x66da, 0x66de, 0x66df, 0x66e0, 0x66e1, - 0x66e2, 0x66e3, 0x66e4, 0x66e5, 0x66e7, 0x66e8, 0x66ea, 0x66eb, - 0x66ec, 0x66ed, 0x66ee, 0x66ef, 0x66f1, 0x66f5, 0x66f6, 0x66f8, - 0x66fa, 0x66fb, 0x66fd, 0x6701, 0x6702, 0x6703, - /* 0x96 */ - 0x6704, 0x6705, 0x6706, 0x6707, 0x670c, 0x670e, 0x670f, 0x6711, - 0x6712, 0x6713, 0x6716, 0x6718, 0x6719, 0x671a, 0x671c, 0x671e, - 0x6720, 0x6721, 0x6722, 0x6723, 0x6724, 0x6725, 0x6727, 0x6729, - 0x672e, 0x6730, 0x6732, 0x6733, 0x6736, 0x6737, 0x6738, 0x6739, - 0x673b, 0x673c, 0x673e, 0x673f, 0x6741, 0x6744, 0x6745, 0x6747, - 0x674a, 0x674b, 0x674d, 0x6752, 0x6754, 0x6755, 0x6757, 0x6758, - 0x6759, 0x675a, 0x675b, 0x675d, 0x6762, 0x6763, 0x6764, 0x6766, - 0x6767, 0x676b, 0x676c, 0x676e, 0x6771, 0x6774, 0x6776, 0x6778, - 0x6779, 0x677a, 0x677b, 0x677d, 0x6780, 0x6782, 0x6783, 0x6785, - 0x6786, 0x6788, 0x678a, 0x678c, 0x678d, 0x678e, 0x678f, 0x6791, - 0x6792, 0x6793, 0x6794, 0x6796, 0x6799, 0x679b, 0x679f, 0x67a0, - 0x67a1, 0x67a4, 0x67a6, 0x67a9, 0x67ac, 0x67ae, 0x67b1, 0x67b2, - 0x67b4, 0x67b9, 0x67ba, 0x67bb, 0x67bc, 0x67bd, 0x67be, 0x67bf, - 0x67c0, 0x67c2, 0x67c5, 0x67c6, 0x67c7, 0x67c8, 0x67c9, 0x67ca, - 0x67cb, 0x67cc, 0x67cd, 0x67ce, 0x67d5, 0x67d6, 0x67d7, 0x67db, - 0x67df, 0x67e1, 0x67e3, 0x67e4, 0x67e6, 0x67e7, 0x67e8, 0x67ea, - 0x67eb, 0x67ed, 0x67ee, 0x67f2, 0x67f5, 0x67f6, 0x67f7, 0x67f8, - 0x67f9, 0x67fa, 0x67fb, 0x67fc, 0x67fe, 0x6801, 0x6802, 0x6803, - 0x6804, 0x6806, 0x680d, 0x6810, 0x6812, 0x6814, 0x6815, 0x6818, - 0x6819, 0x681a, 0x681b, 0x681c, 0x681e, 0x681f, 0x6820, 0x6822, - 0x6823, 0x6824, 0x6825, 0x6826, 0x6827, 0x6828, 0x682b, 0x682c, - 0x682d, 0x682e, 0x682f, 0x6830, 0x6831, 0x6834, 0x6835, 0x6836, - 0x683a, 0x683b, 0x683f, 0x6847, 0x684b, 0x684d, 0x684f, 0x6852, - 0x6856, 0x6857, 0x6858, 0x6859, 0x685a, 0x685b, - /* 0x97 */ - 0x685c, 0x685d, 0x685e, 0x685f, 0x686a, 0x686c, 0x686d, 0x686e, - 0x686f, 0x6870, 0x6871, 0x6872, 0x6873, 0x6875, 0x6878, 0x6879, - 0x687a, 0x687b, 0x687c, 0x687d, 0x687e, 0x687f, 0x6880, 0x6882, - 0x6884, 0x6887, 0x6888, 0x6889, 0x688a, 0x688b, 0x688c, 0x688d, - 0x688e, 0x6890, 0x6891, 0x6892, 0x6894, 0x6895, 0x6896, 0x6898, - 0x6899, 0x689a, 0x689b, 0x689c, 0x689d, 0x689e, 0x689f, 0x68a0, - 0x68a1, 0x68a3, 0x68a4, 0x68a5, 0x68a9, 0x68aa, 0x68ab, 0x68ac, - 0x68ae, 0x68b1, 0x68b2, 0x68b4, 0x68b6, 0x68b7, 0x68b8, 0x68b9, - 0x68ba, 0x68bb, 0x68bc, 0x68bd, 0x68be, 0x68bf, 0x68c1, 0x68c3, - 0x68c4, 0x68c5, 0x68c6, 0x68c7, 0x68c8, 0x68ca, 0x68cc, 0x68ce, - 0x68cf, 0x68d0, 0x68d1, 0x68d3, 0x68d4, 0x68d6, 0x68d7, 0x68d9, - 0x68db, 0x68dc, 0x68dd, 0x68de, 0x68df, 0x68e1, 0x68e2, 0x68e4, - 0x68e5, 0x68e6, 0x68e7, 0x68e8, 0x68e9, 0x68ea, 0x68eb, 0x68ec, - 0x68ed, 0x68ef, 0x68f2, 0x68f3, 0x68f4, 0x68f6, 0x68f7, 0x68f8, - 0x68fb, 0x68fd, 0x68fe, 0x68ff, 0x6900, 0x6902, 0x6903, 0x6904, - 0x6906, 0x6907, 0x6908, 0x6909, 0x690a, 0x690c, 0x690f, 0x6911, - 0x6913, 0x6914, 0x6915, 0x6916, 0x6917, 0x6918, 0x6919, 0x691a, - 0x691b, 0x691c, 0x691d, 0x691e, 0x6921, 0x6922, 0x6923, 0x6925, - 0x6926, 0x6927, 0x6928, 0x6929, 0x692a, 0x692b, 0x692c, 0x692e, - 0x692f, 0x6931, 0x6932, 0x6933, 0x6935, 0x6936, 0x6937, 0x6938, - 0x693a, 0x693b, 0x693c, 0x693e, 0x6940, 0x6941, 0x6943, 0x6944, - 0x6945, 0x6946, 0x6947, 0x6948, 0x6949, 0x694a, 0x694b, 0x694c, - 0x694d, 0x694e, 0x694f, 0x6950, 0x6951, 0x6952, 0x6953, 0x6955, - 0x6956, 0x6958, 0x6959, 0x695b, 0x695c, 0x695f, - /* 0x98 */ - 0x6961, 0x6962, 0x6964, 0x6965, 0x6967, 0x6968, 0x6969, 0x696a, - 0x696c, 0x696d, 0x696f, 0x6970, 0x6972, 0x6973, 0x6974, 0x6975, - 0x6976, 0x697a, 0x697b, 0x697d, 0x697e, 0x697f, 0x6981, 0x6983, - 0x6985, 0x698a, 0x698b, 0x698c, 0x698e, 0x698f, 0x6990, 0x6991, - 0x6992, 0x6993, 0x6996, 0x6997, 0x6999, 0x699a, 0x699d, 0x699e, - 0x699f, 0x69a0, 0x69a1, 0x69a2, 0x69a3, 0x69a4, 0x69a5, 0x69a6, - 0x69a9, 0x69aa, 0x69ac, 0x69ae, 0x69af, 0x69b0, 0x69b2, 0x69b3, - 0x69b5, 0x69b6, 0x69b8, 0x69b9, 0x69ba, 0x69bc, 0x69bd, 0x69be, - 0x69bf, 0x69c0, 0x69c2, 0x69c3, 0x69c4, 0x69c5, 0x69c6, 0x69c7, - 0x69c8, 0x69c9, 0x69cb, 0x69cd, 0x69cf, 0x69d1, 0x69d2, 0x69d3, - 0x69d5, 0x69d6, 0x69d7, 0x69d8, 0x69d9, 0x69da, 0x69dc, 0x69dd, - 0x69de, 0x69e1, 0x69e2, 0x69e3, 0x69e4, 0x69e5, 0x69e6, 0x69e7, - 0x69e8, 0x69e9, 0x69ea, 0x69eb, 0x69ec, 0x69ee, 0x69ef, 0x69f0, - 0x69f1, 0x69f3, 0x69f4, 0x69f5, 0x69f6, 0x69f7, 0x69f8, 0x69f9, - 0x69fa, 0x69fb, 0x69fc, 0x69fe, 0x6a00, 0x6a01, 0x6a02, 0x6a03, - 0x6a04, 0x6a05, 0x6a06, 0x6a07, 0x6a08, 0x6a09, 0x6a0b, 0x6a0c, - 0x6a0d, 0x6a0e, 0x6a0f, 0x6a10, 0x6a11, 0x6a12, 0x6a13, 0x6a14, - 0x6a15, 0x6a16, 0x6a19, 0x6a1a, 0x6a1b, 0x6a1c, 0x6a1d, 0x6a1e, - 0x6a20, 0x6a22, 0x6a23, 0x6a24, 0x6a25, 0x6a26, 0x6a27, 0x6a29, - 0x6a2b, 0x6a2c, 0x6a2d, 0x6a2e, 0x6a30, 0x6a32, 0x6a33, 0x6a34, - 0x6a36, 0x6a37, 0x6a38, 0x6a39, 0x6a3a, 0x6a3b, 0x6a3c, 0x6a3f, - 0x6a40, 0x6a41, 0x6a42, 0x6a43, 0x6a45, 0x6a46, 0x6a48, 0x6a49, - 0x6a4a, 0x6a4b, 0x6a4c, 0x6a4d, 0x6a4e, 0x6a4f, 0x6a51, 0x6a52, - 0x6a53, 0x6a54, 0x6a55, 0x6a56, 0x6a57, 0x6a5a, - /* 0x99 */ - 0x6a5c, 0x6a5d, 0x6a5e, 0x6a5f, 0x6a60, 0x6a62, 0x6a63, 0x6a64, - 0x6a66, 0x6a67, 0x6a68, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, - 0x6a6e, 0x6a6f, 0x6a70, 0x6a72, 0x6a73, 0x6a74, 0x6a75, 0x6a76, - 0x6a77, 0x6a78, 0x6a7a, 0x6a7b, 0x6a7d, 0x6a7e, 0x6a7f, 0x6a81, - 0x6a82, 0x6a83, 0x6a85, 0x6a86, 0x6a87, 0x6a88, 0x6a89, 0x6a8a, - 0x6a8b, 0x6a8c, 0x6a8d, 0x6a8f, 0x6a92, 0x6a93, 0x6a94, 0x6a95, - 0x6a96, 0x6a98, 0x6a99, 0x6a9a, 0x6a9b, 0x6a9c, 0x6a9d, 0x6a9e, - 0x6a9f, 0x6aa1, 0x6aa2, 0x6aa3, 0x6aa4, 0x6aa5, 0x6aa6, 0x6aa7, - 0x6aa8, 0x6aaa, 0x6aad, 0x6aae, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab2, - 0x6ab3, 0x6ab4, 0x6ab5, 0x6ab6, 0x6ab7, 0x6ab8, 0x6ab9, 0x6aba, - 0x6abb, 0x6abc, 0x6abd, 0x6abe, 0x6abf, 0x6ac0, 0x6ac1, 0x6ac2, - 0x6ac3, 0x6ac4, 0x6ac5, 0x6ac6, 0x6ac7, 0x6ac8, 0x6ac9, 0x6aca, - 0x6acb, 0x6acc, 0x6acd, 0x6ace, 0x6acf, 0x6ad0, 0x6ad1, 0x6ad2, - 0x6ad3, 0x6ad4, 0x6ad5, 0x6ad6, 0x6ad7, 0x6ad8, 0x6ad9, 0x6ada, - 0x6adb, 0x6adc, 0x6add, 0x6ade, 0x6adf, 0x6ae0, 0x6ae1, 0x6ae2, - 0x6ae3, 0x6ae4, 0x6ae5, 0x6ae6, 0x6ae7, 0x6ae8, 0x6ae9, 0x6aea, - 0x6aeb, 0x6aec, 0x6aed, 0x6aee, 0x6aef, 0x6af0, 0x6af1, 0x6af2, - 0x6af3, 0x6af4, 0x6af5, 0x6af6, 0x6af7, 0x6af8, 0x6af9, 0x6afa, - 0x6afb, 0x6afc, 0x6afd, 0x6afe, 0x6aff, 0x6b00, 0x6b01, 0x6b02, - 0x6b03, 0x6b04, 0x6b05, 0x6b06, 0x6b07, 0x6b08, 0x6b09, 0x6b0a, - 0x6b0b, 0x6b0c, 0x6b0d, 0x6b0e, 0x6b0f, 0x6b10, 0x6b11, 0x6b12, - 0x6b13, 0x6b14, 0x6b15, 0x6b16, 0x6b17, 0x6b18, 0x6b19, 0x6b1a, - 0x6b1b, 0x6b1c, 0x6b1d, 0x6b1e, 0x6b1f, 0x6b25, 0x6b26, 0x6b28, - 0x6b29, 0x6b2a, 0x6b2b, 0x6b2c, 0x6b2d, 0x6b2e, - /* 0x9a */ - 0x6b2f, 0x6b30, 0x6b31, 0x6b33, 0x6b34, 0x6b35, 0x6b36, 0x6b38, - 0x6b3b, 0x6b3c, 0x6b3d, 0x6b3f, 0x6b40, 0x6b41, 0x6b42, 0x6b44, - 0x6b45, 0x6b48, 0x6b4a, 0x6b4b, 0x6b4d, 0x6b4e, 0x6b4f, 0x6b50, - 0x6b51, 0x6b52, 0x6b53, 0x6b54, 0x6b55, 0x6b56, 0x6b57, 0x6b58, - 0x6b5a, 0x6b5b, 0x6b5c, 0x6b5d, 0x6b5e, 0x6b5f, 0x6b60, 0x6b61, - 0x6b68, 0x6b69, 0x6b6b, 0x6b6c, 0x6b6d, 0x6b6e, 0x6b6f, 0x6b70, - 0x6b71, 0x6b72, 0x6b73, 0x6b74, 0x6b75, 0x6b76, 0x6b77, 0x6b78, - 0x6b7a, 0x6b7d, 0x6b7e, 0x6b7f, 0x6b80, 0x6b85, 0x6b88, 0x6b8c, - 0x6b8e, 0x6b8f, 0x6b90, 0x6b91, 0x6b94, 0x6b95, 0x6b97, 0x6b98, - 0x6b99, 0x6b9c, 0x6b9d, 0x6b9e, 0x6b9f, 0x6ba0, 0x6ba2, 0x6ba3, - 0x6ba4, 0x6ba5, 0x6ba6, 0x6ba7, 0x6ba8, 0x6ba9, 0x6bab, 0x6bac, - 0x6bad, 0x6bae, 0x6baf, 0x6bb0, 0x6bb1, 0x6bb2, 0x6bb6, 0x6bb8, - 0x6bb9, 0x6bba, 0x6bbb, 0x6bbc, 0x6bbd, 0x6bbe, 0x6bc0, 0x6bc3, - 0x6bc4, 0x6bc6, 0x6bc7, 0x6bc8, 0x6bc9, 0x6bca, 0x6bcc, 0x6bce, - 0x6bd0, 0x6bd1, 0x6bd8, 0x6bda, 0x6bdc, 0x6bdd, 0x6bde, 0x6bdf, - 0x6be0, 0x6be2, 0x6be3, 0x6be4, 0x6be5, 0x6be6, 0x6be7, 0x6be8, - 0x6be9, 0x6bec, 0x6bed, 0x6bee, 0x6bf0, 0x6bf1, 0x6bf2, 0x6bf4, - 0x6bf6, 0x6bf7, 0x6bf8, 0x6bfa, 0x6bfb, 0x6bfc, 0x6bfe, 0x6bff, - 0x6c00, 0x6c01, 0x6c02, 0x6c03, 0x6c04, 0x6c08, 0x6c09, 0x6c0a, - 0x6c0b, 0x6c0c, 0x6c0e, 0x6c12, 0x6c17, 0x6c1c, 0x6c1d, 0x6c1e, - 0x6c20, 0x6c23, 0x6c25, 0x6c2b, 0x6c2c, 0x6c2d, 0x6c31, 0x6c33, - 0x6c36, 0x6c37, 0x6c39, 0x6c3a, 0x6c3b, 0x6c3c, 0x6c3e, 0x6c3f, - 0x6c43, 0x6c44, 0x6c45, 0x6c48, 0x6c4b, 0x6c4c, 0x6c4d, 0x6c4e, - 0x6c4f, 0x6c51, 0x6c52, 0x6c53, 0x6c56, 0x6c58, - /* 0x9b */ - 0x6c59, 0x6c5a, 0x6c62, 0x6c63, 0x6c65, 0x6c66, 0x6c67, 0x6c6b, - 0x6c6c, 0x6c6d, 0x6c6e, 0x6c6f, 0x6c71, 0x6c73, 0x6c75, 0x6c77, - 0x6c78, 0x6c7a, 0x6c7b, 0x6c7c, 0x6c7f, 0x6c80, 0x6c84, 0x6c87, - 0x6c8a, 0x6c8b, 0x6c8d, 0x6c8e, 0x6c91, 0x6c92, 0x6c95, 0x6c96, - 0x6c97, 0x6c98, 0x6c9a, 0x6c9c, 0x6c9d, 0x6c9e, 0x6ca0, 0x6ca2, - 0x6ca8, 0x6cac, 0x6caf, 0x6cb0, 0x6cb4, 0x6cb5, 0x6cb6, 0x6cb7, - 0x6cba, 0x6cc0, 0x6cc1, 0x6cc2, 0x6cc3, 0x6cc6, 0x6cc7, 0x6cc8, - 0x6ccb, 0x6ccd, 0x6cce, 0x6ccf, 0x6cd1, 0x6cd2, 0x6cd8, 0x6cd9, - 0x6cda, 0x6cdc, 0x6cdd, 0x6cdf, 0x6ce4, 0x6ce6, 0x6ce7, 0x6ce9, - 0x6cec, 0x6ced, 0x6cf2, 0x6cf4, 0x6cf9, 0x6cff, 0x6d00, 0x6d02, - 0x6d03, 0x6d05, 0x6d06, 0x6d08, 0x6d09, 0x6d0a, 0x6d0d, 0x6d0f, - 0x6d10, 0x6d11, 0x6d13, 0x6d14, 0x6d15, 0x6d16, 0x6d18, 0x6d1c, - 0x6d1d, 0x6d1f, 0x6d20, 0x6d21, 0x6d22, 0x6d23, 0x6d24, 0x6d26, - 0x6d28, 0x6d29, 0x6d2c, 0x6d2d, 0x6d2f, 0x6d30, 0x6d34, 0x6d36, - 0x6d37, 0x6d38, 0x6d3a, 0x6d3f, 0x6d40, 0x6d42, 0x6d44, 0x6d49, - 0x6d4c, 0x6d50, 0x6d55, 0x6d56, 0x6d57, 0x6d58, 0x6d5b, 0x6d5d, - 0x6d5f, 0x6d61, 0x6d62, 0x6d64, 0x6d65, 0x6d67, 0x6d68, 0x6d6b, - 0x6d6c, 0x6d6d, 0x6d70, 0x6d71, 0x6d72, 0x6d73, 0x6d75, 0x6d76, - 0x6d79, 0x6d7a, 0x6d7b, 0x6d7d, 0x6d7e, 0x6d7f, 0x6d80, 0x6d81, - 0x6d83, 0x6d84, 0x6d86, 0x6d87, 0x6d8a, 0x6d8b, 0x6d8d, 0x6d8f, - 0x6d90, 0x6d92, 0x6d96, 0x6d97, 0x6d98, 0x6d99, 0x6d9a, 0x6d9c, - 0x6da2, 0x6da5, 0x6dac, 0x6dad, 0x6db0, 0x6db1, 0x6db3, 0x6db4, - 0x6db6, 0x6db7, 0x6db9, 0x6dba, 0x6dbb, 0x6dbc, 0x6dbd, 0x6dbe, - 0x6dc1, 0x6dc2, 0x6dc3, 0x6dc8, 0x6dc9, 0x6dca, - /* 0x9c */ - 0x6dcd, 0x6dce, 0x6dcf, 0x6dd0, 0x6dd2, 0x6dd3, 0x6dd4, 0x6dd5, - 0x6dd7, 0x6dda, 0x6ddb, 0x6ddc, 0x6ddf, 0x6de2, 0x6de3, 0x6de5, - 0x6de7, 0x6de8, 0x6de9, 0x6dea, 0x6ded, 0x6def, 0x6df0, 0x6df2, - 0x6df4, 0x6df5, 0x6df6, 0x6df8, 0x6dfa, 0x6dfd, 0x6dfe, 0x6dff, - 0x6e00, 0x6e01, 0x6e02, 0x6e03, 0x6e04, 0x6e06, 0x6e07, 0x6e08, - 0x6e09, 0x6e0b, 0x6e0f, 0x6e12, 0x6e13, 0x6e15, 0x6e18, 0x6e19, - 0x6e1b, 0x6e1c, 0x6e1e, 0x6e1f, 0x6e22, 0x6e26, 0x6e27, 0x6e28, - 0x6e2a, 0x6e2c, 0x6e2e, 0x6e30, 0x6e31, 0x6e33, 0x6e35, 0x6e36, - 0x6e37, 0x6e39, 0x6e3b, 0x6e3c, 0x6e3d, 0x6e3e, 0x6e3f, 0x6e40, - 0x6e41, 0x6e42, 0x6e45, 0x6e46, 0x6e47, 0x6e48, 0x6e49, 0x6e4a, - 0x6e4b, 0x6e4c, 0x6e4f, 0x6e50, 0x6e51, 0x6e52, 0x6e55, 0x6e57, - 0x6e59, 0x6e5a, 0x6e5c, 0x6e5d, 0x6e5e, 0x6e60, 0x6e61, 0x6e62, - 0x6e63, 0x6e64, 0x6e65, 0x6e66, 0x6e67, 0x6e68, 0x6e69, 0x6e6a, - 0x6e6c, 0x6e6d, 0x6e6f, 0x6e70, 0x6e71, 0x6e72, 0x6e73, 0x6e74, - 0x6e75, 0x6e76, 0x6e77, 0x6e78, 0x6e79, 0x6e7a, 0x6e7b, 0x6e7c, - 0x6e7d, 0x6e80, 0x6e81, 0x6e82, 0x6e84, 0x6e87, 0x6e88, 0x6e8a, - 0x6e8b, 0x6e8c, 0x6e8d, 0x6e8e, 0x6e91, 0x6e92, 0x6e93, 0x6e94, - 0x6e95, 0x6e96, 0x6e97, 0x6e99, 0x6e9a, 0x6e9b, 0x6e9d, 0x6e9e, - 0x6ea0, 0x6ea1, 0x6ea3, 0x6ea4, 0x6ea6, 0x6ea8, 0x6ea9, 0x6eab, - 0x6eac, 0x6ead, 0x6eae, 0x6eb0, 0x6eb3, 0x6eb5, 0x6eb8, 0x6eb9, - 0x6ebc, 0x6ebe, 0x6ebf, 0x6ec0, 0x6ec3, 0x6ec4, 0x6ec5, 0x6ec6, - 0x6ec8, 0x6ec9, 0x6eca, 0x6ecc, 0x6ecd, 0x6ece, 0x6ed0, 0x6ed2, - 0x6ed6, 0x6ed8, 0x6ed9, 0x6edb, 0x6edc, 0x6edd, 0x6ee3, 0x6ee7, - 0x6eea, 0x6eeb, 0x6eec, 0x6eed, 0x6eee, 0x6eef, - /* 0x9d */ - 0x6ef0, 0x6ef1, 0x6ef2, 0x6ef3, 0x6ef5, 0x6ef6, 0x6ef7, 0x6ef8, - 0x6efa, 0x6efb, 0x6efc, 0x6efd, 0x6efe, 0x6eff, 0x6f00, 0x6f01, - 0x6f03, 0x6f04, 0x6f05, 0x6f07, 0x6f08, 0x6f0a, 0x6f0b, 0x6f0c, - 0x6f0d, 0x6f0e, 0x6f10, 0x6f11, 0x6f12, 0x6f16, 0x6f17, 0x6f18, - 0x6f19, 0x6f1a, 0x6f1b, 0x6f1c, 0x6f1d, 0x6f1e, 0x6f1f, 0x6f21, - 0x6f22, 0x6f23, 0x6f25, 0x6f26, 0x6f27, 0x6f28, 0x6f2c, 0x6f2e, - 0x6f30, 0x6f32, 0x6f34, 0x6f35, 0x6f37, 0x6f38, 0x6f39, 0x6f3a, - 0x6f3b, 0x6f3c, 0x6f3d, 0x6f3f, 0x6f40, 0x6f41, 0x6f42, 0x6f43, - 0x6f44, 0x6f45, 0x6f48, 0x6f49, 0x6f4a, 0x6f4c, 0x6f4e, 0x6f4f, - 0x6f50, 0x6f51, 0x6f52, 0x6f53, 0x6f54, 0x6f55, 0x6f56, 0x6f57, - 0x6f59, 0x6f5a, 0x6f5b, 0x6f5d, 0x6f5f, 0x6f60, 0x6f61, 0x6f63, - 0x6f64, 0x6f65, 0x6f67, 0x6f68, 0x6f69, 0x6f6a, 0x6f6b, 0x6f6c, - 0x6f6f, 0x6f70, 0x6f71, 0x6f73, 0x6f75, 0x6f76, 0x6f77, 0x6f79, - 0x6f7b, 0x6f7d, 0x6f7e, 0x6f7f, 0x6f80, 0x6f81, 0x6f82, 0x6f83, - 0x6f85, 0x6f86, 0x6f87, 0x6f8a, 0x6f8b, 0x6f8f, 0x6f90, 0x6f91, - 0x6f92, 0x6f93, 0x6f94, 0x6f95, 0x6f96, 0x6f97, 0x6f98, 0x6f99, - 0x6f9a, 0x6f9b, 0x6f9d, 0x6f9e, 0x6f9f, 0x6fa0, 0x6fa2, 0x6fa3, - 0x6fa4, 0x6fa5, 0x6fa6, 0x6fa8, 0x6fa9, 0x6faa, 0x6fab, 0x6fac, - 0x6fad, 0x6fae, 0x6faf, 0x6fb0, 0x6fb1, 0x6fb2, 0x6fb4, 0x6fb5, - 0x6fb7, 0x6fb8, 0x6fba, 0x6fbb, 0x6fbc, 0x6fbd, 0x6fbe, 0x6fbf, - 0x6fc1, 0x6fc3, 0x6fc4, 0x6fc5, 0x6fc6, 0x6fc7, 0x6fc8, 0x6fca, - 0x6fcb, 0x6fcc, 0x6fcd, 0x6fce, 0x6fcf, 0x6fd0, 0x6fd3, 0x6fd4, - 0x6fd5, 0x6fd6, 0x6fd7, 0x6fd8, 0x6fd9, 0x6fda, 0x6fdb, 0x6fdc, - 0x6fdd, 0x6fdf, 0x6fe2, 0x6fe3, 0x6fe4, 0x6fe5, - /* 0x9e */ - 0x6fe6, 0x6fe7, 0x6fe8, 0x6fe9, 0x6fea, 0x6feb, 0x6fec, 0x6fed, - 0x6ff0, 0x6ff1, 0x6ff2, 0x6ff3, 0x6ff4, 0x6ff5, 0x6ff6, 0x6ff7, - 0x6ff8, 0x6ff9, 0x6ffa, 0x6ffb, 0x6ffc, 0x6ffd, 0x6ffe, 0x6fff, - 0x7000, 0x7001, 0x7002, 0x7003, 0x7004, 0x7005, 0x7006, 0x7007, - 0x7008, 0x7009, 0x700a, 0x700b, 0x700c, 0x700d, 0x700e, 0x700f, - 0x7010, 0x7012, 0x7013, 0x7014, 0x7015, 0x7016, 0x7017, 0x7018, - 0x7019, 0x701c, 0x701d, 0x701e, 0x701f, 0x7020, 0x7021, 0x7022, - 0x7024, 0x7025, 0x7026, 0x7027, 0x7028, 0x7029, 0x702a, 0x702b, - 0x702c, 0x702d, 0x702e, 0x702f, 0x7030, 0x7031, 0x7032, 0x7033, - 0x7034, 0x7036, 0x7037, 0x7038, 0x703a, 0x703b, 0x703c, 0x703d, - 0x703e, 0x703f, 0x7040, 0x7041, 0x7042, 0x7043, 0x7044, 0x7045, - 0x7046, 0x7047, 0x7048, 0x7049, 0x704a, 0x704b, 0x704d, 0x704e, - 0x7050, 0x7051, 0x7052, 0x7053, 0x7054, 0x7055, 0x7056, 0x7057, - 0x7058, 0x7059, 0x705a, 0x705b, 0x705c, 0x705d, 0x705f, 0x7060, - 0x7061, 0x7062, 0x7063, 0x7064, 0x7065, 0x7066, 0x7067, 0x7068, - 0x7069, 0x706a, 0x706e, 0x7071, 0x7072, 0x7073, 0x7074, 0x7077, - 0x7079, 0x707a, 0x707b, 0x707d, 0x7081, 0x7082, 0x7083, 0x7084, - 0x7086, 0x7087, 0x7088, 0x708b, 0x708c, 0x708d, 0x708f, 0x7090, - 0x7091, 0x7093, 0x7097, 0x7098, 0x709a, 0x709b, 0x709e, 0x709f, - 0x70a0, 0x70a1, 0x70a2, 0x70a3, 0x70a4, 0x70a5, 0x70a6, 0x70a7, - 0x70a8, 0x70a9, 0x70aa, 0x70b0, 0x70b2, 0x70b4, 0x70b5, 0x70b6, - 0x70ba, 0x70be, 0x70bf, 0x70c4, 0x70c5, 0x70c6, 0x70c7, 0x70c9, - 0x70cb, 0x70cc, 0x70cd, 0x70ce, 0x70cf, 0x70d0, 0x70d1, 0x70d2, - 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d7, 0x70da, - /* 0x9f */ - 0x70dc, 0x70dd, 0x70de, 0x70e0, 0x70e1, 0x70e2, 0x70e3, 0x70e5, - 0x70ea, 0x70ee, 0x70f0, 0x70f1, 0x70f2, 0x70f3, 0x70f4, 0x70f5, - 0x70f6, 0x70f8, 0x70fa, 0x70fb, 0x70fc, 0x70fe, 0x70ff, 0x7100, - 0x7101, 0x7102, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x7108, - 0x710b, 0x710c, 0x710d, 0x710e, 0x710f, 0x7111, 0x7112, 0x7114, - 0x7117, 0x711b, 0x711c, 0x711d, 0x711e, 0x711f, 0x7120, 0x7121, - 0x7122, 0x7123, 0x7124, 0x7125, 0x7127, 0x7128, 0x7129, 0x712a, - 0x712b, 0x712c, 0x712d, 0x712e, 0x7132, 0x7133, 0x7134, 0x7135, - 0x7137, 0x7138, 0x7139, 0x713a, 0x713b, 0x713c, 0x713d, 0x713e, - 0x713f, 0x7140, 0x7141, 0x7142, 0x7143, 0x7144, 0x7146, 0x7147, - 0x7148, 0x7149, 0x714b, 0x714d, 0x714f, 0x7150, 0x7151, 0x7152, - 0x7153, 0x7154, 0x7155, 0x7156, 0x7157, 0x7158, 0x7159, 0x715a, - 0x715b, 0x715d, 0x715f, 0x7160, 0x7161, 0x7162, 0x7163, 0x7165, - 0x7169, 0x716a, 0x716b, 0x716c, 0x716d, 0x716f, 0x7170, 0x7171, - 0x7174, 0x7175, 0x7176, 0x7177, 0x7179, 0x717b, 0x717c, 0x717e, - 0x717f, 0x7180, 0x7181, 0x7182, 0x7183, 0x7185, 0x7186, 0x7187, - 0x7188, 0x7189, 0x718b, 0x718c, 0x718d, 0x718e, 0x7190, 0x7191, - 0x7192, 0x7193, 0x7195, 0x7196, 0x7197, 0x719a, 0x719b, 0x719c, - 0x719d, 0x719e, 0x71a1, 0x71a2, 0x71a3, 0x71a4, 0x71a5, 0x71a6, - 0x71a7, 0x71a9, 0x71aa, 0x71ab, 0x71ad, 0x71ae, 0x71af, 0x71b0, - 0x71b1, 0x71b2, 0x71b4, 0x71b6, 0x71b7, 0x71b8, 0x71ba, 0x71bb, - 0x71bc, 0x71bd, 0x71be, 0x71bf, 0x71c0, 0x71c1, 0x71c2, 0x71c4, - 0x71c5, 0x71c6, 0x71c7, 0x71c8, 0x71c9, 0x71ca, 0x71cb, 0x71cc, - 0x71cd, 0x71cf, 0x71d0, 0x71d1, 0x71d2, 0x71d3, - /* 0xa0 */ - 0x71d6, 0x71d7, 0x71d8, 0x71d9, 0x71da, 0x71db, 0x71dc, 0x71dd, - 0x71de, 0x71df, 0x71e1, 0x71e2, 0x71e3, 0x71e4, 0x71e6, 0x71e8, - 0x71e9, 0x71ea, 0x71eb, 0x71ec, 0x71ed, 0x71ef, 0x71f0, 0x71f1, - 0x71f2, 0x71f3, 0x71f4, 0x71f5, 0x71f6, 0x71f7, 0x71f8, 0x71fa, - 0x71fb, 0x71fc, 0x71fd, 0x71fe, 0x71ff, 0x7200, 0x7201, 0x7202, - 0x7203, 0x7204, 0x7205, 0x7207, 0x7208, 0x7209, 0x720a, 0x720b, - 0x720c, 0x720d, 0x720e, 0x720f, 0x7210, 0x7211, 0x7212, 0x7213, - 0x7214, 0x7215, 0x7216, 0x7217, 0x7218, 0x7219, 0x721a, 0x721b, - 0x721c, 0x721e, 0x721f, 0x7220, 0x7221, 0x7222, 0x7223, 0x7224, - 0x7225, 0x7226, 0x7227, 0x7229, 0x722b, 0x722d, 0x722e, 0x722f, - 0x7232, 0x7233, 0x7234, 0x723a, 0x723c, 0x723e, 0x7240, 0x7241, - 0x7242, 0x7243, 0x7244, 0x7245, 0x7246, 0x7249, 0x724a, 0x724b, - 0x724e, 0x724f, 0x7250, 0x7251, 0x7253, 0x7254, 0x7255, 0x7257, - 0x7258, 0x725a, 0x725c, 0x725e, 0x7260, 0x7263, 0x7264, 0x7265, - 0x7268, 0x726a, 0x726b, 0x726c, 0x726d, 0x7270, 0x7271, 0x7273, - 0x7274, 0x7276, 0x7277, 0x7278, 0x727b, 0x727c, 0x727d, 0x7282, - 0x7283, 0x7285, 0x7286, 0x7287, 0x7288, 0x7289, 0x728c, 0x728e, - 0x7290, 0x7291, 0x7293, 0x7294, 0x7295, 0x7296, 0x7297, 0x7298, - 0x7299, 0x729a, 0x729b, 0x729c, 0x729d, 0x729e, 0x72a0, 0x72a1, - 0x72a2, 0x72a3, 0x72a4, 0x72a5, 0x72a6, 0x72a7, 0x72a8, 0x72a9, - 0x72aa, 0x72ab, 0x72ae, 0x72b1, 0x72b2, 0x72b3, 0x72b5, 0x72ba, - 0x72bb, 0x72bc, 0x72bd, 0x72be, 0x72bf, 0x72c0, 0x72c5, 0x72c6, - 0x72c7, 0x72c9, 0x72ca, 0x72cb, 0x72cc, 0x72cf, 0x72d1, 0x72d3, - 0x72d4, 0x72d5, 0x72d6, 0x72d8, 0x72da, 0x72db, - /* 0xa1 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x3000, 0x3001, 0x3002, 0x00b7, 0x02c9, 0x02c7, 0x00a8, 0x3003, - 0x3005, 0x2014, 0xff5e, 0x2016, 0x2026, 0x2018, 0x2019, 0x201c, - 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, - 0x300d, 0x300e, 0x300f, 0x3016, 0x3017, 0x3010, 0x3011, 0x00b1, - 0x00d7, 0x00f7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220f, 0x222a, - 0x2229, 0x2208, 0x2237, 0x221a, 0x22a5, 0x2225, 0x2220, 0x2312, - 0x2299, 0x222b, 0x222e, 0x2261, 0x224c, 0x2248, 0x223d, 0x221d, - 0x2260, 0x226e, 0x226f, 0x2264, 0x2265, 0x221e, 0x2235, 0x2234, - 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xff04, 0x00a4, - 0xffe0, 0xffe1, 0x2030, 0x00a7, 0x2116, 0x2606, 0x2605, 0x25cb, - 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, - 0x203b, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, - /* 0xa2 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, - 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f, - 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, 0x2497, - 0x2498, 0x2499, 0x249a, 0x249b, 0x2474, 0x2475, 0x2476, 0x2477, - 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, - 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, 0x2487, - 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, - 0x2468, 0x2469, 0xfffd, 0xfffd, 0x3220, 0x3221, 0x3222, 0x3223, - 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0xfffd, 0xfffd, - 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, - 0x2168, 0x2169, 0x216a, 0x216b, 0xfffd, 0xfffd, - /* 0xa3 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xff01, 0xff02, 0xff03, 0xffe5, 0xff05, 0xff06, 0xff07, 0xff08, - 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, - 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, - 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, - 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, - 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, - 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, - 0xff39, 0xff3a, 0xff3b, 0xff3c, 0xff3d, 0xff3e, 0xff3f, 0xff40, - 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, - 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, - 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, - 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, - /* 0xa4 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, - 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, - 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, - 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, - 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, - 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, - 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, - 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, - 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, - 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, - 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa5 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, - 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, - 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, - 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, - 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, - 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, - 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, - 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, - 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, - 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, - 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa6 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, - 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, - 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, - 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, - 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfe35, - 0xfe36, 0xfe39, 0xfe3a, 0xfe3f, 0xfe40, 0xfe3d, 0xfe3e, 0xfe41, - 0xfe42, 0xfe43, 0xfe44, 0xfffd, 0xfffd, 0xfe3b, 0xfe3c, 0xfe37, - 0xfe38, 0xfe31, 0xfffd, 0xfe33, 0xfe34, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa7 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, - 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, - 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, - 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, - 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, - 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, - 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa8 */ - 0x02ca, 0x02cb, 0x02d9, 0x2013, 0x2015, 0x2025, 0x2035, 0x2105, - 0x2109, 0x2196, 0x2197, 0x2198, 0x2199, 0x2215, 0x221f, 0x2223, - 0x2252, 0x2266, 0x2267, 0x22bf, 0x2550, 0x2551, 0x2552, 0x2553, - 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, - 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, - 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, - 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, - 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587, 0x2588, - 0x2589, 0x258a, 0x258b, 0x258c, 0x258d, 0x258e, 0x258f, 0x2593, - 0x2594, 0x2595, 0x25bc, 0x25bd, 0x25e2, 0x25e3, 0x25e4, 0x25e5, - 0x2609, 0x2295, 0x3012, 0x301d, 0x301e, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0113, 0x00e9, 0x011b, 0x00e8, - 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, - 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, - 0x00fc, 0x00ea, 0x0251, 0xfffd, 0x0144, 0x0148, 0xfffd, 0x0261, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3105, 0x3106, 0x3107, 0x3108, - 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, - 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, - 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, - 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, - 0x3129, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xa9 */ - 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, - 0x3029, 0x32a3, 0x338e, 0x338f, 0x339c, 0x339d, 0x339e, 0x33a1, - 0x33c4, 0x33ce, 0x33d1, 0x33d2, 0x33d5, 0xfe30, 0xffe2, 0xffe4, - 0xfffd, 0x2121, 0x3231, 0xfffd, 0x2010, 0xfffd, 0xfffd, 0xfffd, - 0x30fc, 0x309b, 0x309c, 0x30fd, 0x30fe, 0x3006, 0x309d, 0x309e, - 0xfe49, 0xfe4a, 0xfe4b, 0xfe4c, 0xfe4d, 0xfe4e, 0xfe4f, 0xfe50, - 0xfe51, 0xfe52, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xfe59, 0xfe5a, - 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xfe5f, 0xfe60, 0xfe61, 0xfe62, - 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xfe68, 0xfe69, 0xfe6a, 0xfe6b, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3007, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0x2500, 0x2501, 0x2502, 0x2503, 0x2504, - 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250a, 0x250b, 0x250c, - 0x250d, 0x250e, 0x250f, 0x2510, 0x2511, 0x2512, 0x2513, 0x2514, - 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251a, 0x251b, 0x251c, - 0x251d, 0x251e, 0x251f, 0x2520, 0x2521, 0x2522, 0x2523, 0x2524, - 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, - 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, - 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, - 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, - 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xaa */ - 0x72dc, 0x72dd, 0x72df, 0x72e2, 0x72e3, 0x72e4, 0x72e5, 0x72e6, - 0x72e7, 0x72ea, 0x72eb, 0x72f5, 0x72f6, 0x72f9, 0x72fd, 0x72fe, - 0x72ff, 0x7300, 0x7302, 0x7304, 0x7305, 0x7306, 0x7307, 0x7308, - 0x7309, 0x730b, 0x730c, 0x730d, 0x730f, 0x7310, 0x7311, 0x7312, - 0x7314, 0x7318, 0x7319, 0x731a, 0x731f, 0x7320, 0x7323, 0x7324, - 0x7326, 0x7327, 0x7328, 0x732d, 0x732f, 0x7330, 0x7332, 0x7333, - 0x7335, 0x7336, 0x733a, 0x733b, 0x733c, 0x733d, 0x7340, 0x7341, - 0x7342, 0x7343, 0x7344, 0x7345, 0x7346, 0x7347, 0x7348, 0x7349, - 0x734a, 0x734b, 0x734c, 0x734e, 0x734f, 0x7351, 0x7353, 0x7354, - 0x7355, 0x7356, 0x7358, 0x7359, 0x735a, 0x735b, 0x735c, 0x735d, - 0x735e, 0x735f, 0x7361, 0x7362, 0x7363, 0x7364, 0x7365, 0x7366, - 0x7367, 0x7368, 0x7369, 0x736a, 0x736b, 0x736e, 0x7370, 0x7371, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xab */ - 0x7372, 0x7373, 0x7374, 0x7375, 0x7376, 0x7377, 0x7378, 0x7379, - 0x737a, 0x737b, 0x737c, 0x737d, 0x737f, 0x7380, 0x7381, 0x7382, - 0x7383, 0x7385, 0x7386, 0x7388, 0x738a, 0x738c, 0x738d, 0x738f, - 0x7390, 0x7392, 0x7393, 0x7394, 0x7395, 0x7397, 0x7398, 0x7399, - 0x739a, 0x739c, 0x739d, 0x739e, 0x73a0, 0x73a1, 0x73a3, 0x73a4, - 0x73a5, 0x73a6, 0x73a7, 0x73a8, 0x73aa, 0x73ac, 0x73ad, 0x73b1, - 0x73b4, 0x73b5, 0x73b6, 0x73b8, 0x73b9, 0x73bc, 0x73bd, 0x73be, - 0x73bf, 0x73c1, 0x73c3, 0x73c4, 0x73c5, 0x73c6, 0x73c7, 0x73cb, - 0x73cc, 0x73ce, 0x73d2, 0x73d3, 0x73d4, 0x73d5, 0x73d6, 0x73d7, - 0x73d8, 0x73da, 0x73db, 0x73dc, 0x73dd, 0x73df, 0x73e1, 0x73e2, - 0x73e3, 0x73e4, 0x73e6, 0x73e8, 0x73ea, 0x73eb, 0x73ec, 0x73ee, - 0x73ef, 0x73f0, 0x73f1, 0x73f3, 0x73f4, 0x73f5, 0x73f6, 0x73f7, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xac */ - 0x73f8, 0x73f9, 0x73fa, 0x73fb, 0x73fc, 0x73fd, 0x73fe, 0x73ff, - 0x7400, 0x7401, 0x7402, 0x7404, 0x7407, 0x7408, 0x740b, 0x740c, - 0x740d, 0x740e, 0x7411, 0x7412, 0x7413, 0x7414, 0x7415, 0x7416, - 0x7417, 0x7418, 0x7419, 0x741c, 0x741d, 0x741e, 0x741f, 0x7420, - 0x7421, 0x7423, 0x7424, 0x7427, 0x7429, 0x742b, 0x742d, 0x742f, - 0x7431, 0x7432, 0x7437, 0x7438, 0x7439, 0x743a, 0x743b, 0x743d, - 0x743e, 0x743f, 0x7440, 0x7442, 0x7443, 0x7444, 0x7445, 0x7446, - 0x7447, 0x7448, 0x7449, 0x744a, 0x744b, 0x744c, 0x744d, 0x744e, - 0x744f, 0x7450, 0x7451, 0x7452, 0x7453, 0x7454, 0x7456, 0x7458, - 0x745d, 0x7460, 0x7461, 0x7462, 0x7463, 0x7464, 0x7465, 0x7466, - 0x7467, 0x7468, 0x7469, 0x746a, 0x746b, 0x746c, 0x746e, 0x746f, - 0x7471, 0x7472, 0x7473, 0x7474, 0x7475, 0x7478, 0x7479, 0x747a, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xad */ - 0x747b, 0x747c, 0x747d, 0x747f, 0x7482, 0x7484, 0x7485, 0x7486, - 0x7488, 0x7489, 0x748a, 0x748c, 0x748d, 0x748f, 0x7491, 0x7492, - 0x7493, 0x7494, 0x7495, 0x7496, 0x7497, 0x7498, 0x7499, 0x749a, - 0x749b, 0x749d, 0x749f, 0x74a0, 0x74a1, 0x74a2, 0x74a3, 0x74a4, - 0x74a5, 0x74a6, 0x74aa, 0x74ab, 0x74ac, 0x74ad, 0x74ae, 0x74af, - 0x74b0, 0x74b1, 0x74b2, 0x74b3, 0x74b4, 0x74b5, 0x74b6, 0x74b7, - 0x74b8, 0x74b9, 0x74bb, 0x74bc, 0x74bd, 0x74be, 0x74bf, 0x74c0, - 0x74c1, 0x74c2, 0x74c3, 0x74c4, 0x74c5, 0x74c6, 0x74c7, 0x74c8, - 0x74c9, 0x74ca, 0x74cb, 0x74cc, 0x74cd, 0x74ce, 0x74cf, 0x74d0, - 0x74d1, 0x74d3, 0x74d4, 0x74d5, 0x74d6, 0x74d7, 0x74d8, 0x74d9, - 0x74da, 0x74db, 0x74dd, 0x74df, 0x74e1, 0x74e5, 0x74e7, 0x74e8, - 0x74e9, 0x74ea, 0x74eb, 0x74ec, 0x74ed, 0x74f0, 0x74f1, 0x74f2, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xae */ - 0x74f3, 0x74f5, 0x74f8, 0x74f9, 0x74fa, 0x74fb, 0x74fc, 0x74fd, - 0x74fe, 0x7500, 0x7501, 0x7502, 0x7503, 0x7505, 0x7506, 0x7507, - 0x7508, 0x7509, 0x750a, 0x750b, 0x750c, 0x750e, 0x7510, 0x7512, - 0x7514, 0x7515, 0x7516, 0x7517, 0x751b, 0x751d, 0x751e, 0x7520, - 0x7521, 0x7522, 0x7523, 0x7524, 0x7526, 0x7527, 0x752a, 0x752e, - 0x7534, 0x7536, 0x7539, 0x753c, 0x753d, 0x753f, 0x7541, 0x7542, - 0x7543, 0x7544, 0x7546, 0x7547, 0x7549, 0x754a, 0x754d, 0x7550, - 0x7551, 0x7552, 0x7553, 0x7555, 0x7556, 0x7557, 0x7558, 0x755d, - 0x755e, 0x755f, 0x7560, 0x7561, 0x7562, 0x7563, 0x7564, 0x7567, - 0x7568, 0x7569, 0x756b, 0x756c, 0x756d, 0x756e, 0x756f, 0x7570, - 0x7571, 0x7573, 0x7575, 0x7576, 0x7577, 0x757a, 0x757b, 0x757c, - 0x757d, 0x757e, 0x7580, 0x7581, 0x7582, 0x7584, 0x7585, 0x7587, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xaf */ - 0x7588, 0x7589, 0x758a, 0x758c, 0x758d, 0x758e, 0x7590, 0x7593, - 0x7595, 0x7598, 0x759b, 0x759c, 0x759e, 0x75a2, 0x75a6, 0x75a7, - 0x75a8, 0x75a9, 0x75aa, 0x75ad, 0x75b6, 0x75b7, 0x75ba, 0x75bb, - 0x75bf, 0x75c0, 0x75c1, 0x75c6, 0x75cb, 0x75cc, 0x75ce, 0x75cf, - 0x75d0, 0x75d1, 0x75d3, 0x75d7, 0x75d9, 0x75da, 0x75dc, 0x75dd, - 0x75df, 0x75e0, 0x75e1, 0x75e5, 0x75e9, 0x75ec, 0x75ed, 0x75ee, - 0x75ef, 0x75f2, 0x75f3, 0x75f5, 0x75f6, 0x75f7, 0x75f8, 0x75fa, - 0x75fb, 0x75fd, 0x75fe, 0x7602, 0x7604, 0x7606, 0x7607, 0x7608, - 0x7609, 0x760b, 0x760d, 0x760e, 0x760f, 0x7611, 0x7612, 0x7613, - 0x7614, 0x7616, 0x761a, 0x761c, 0x761d, 0x761e, 0x7621, 0x7623, - 0x7627, 0x7628, 0x762c, 0x762e, 0x762f, 0x7631, 0x7632, 0x7636, - 0x7637, 0x7639, 0x763a, 0x763b, 0x763d, 0x7641, 0x7642, 0x7644, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xb0 */ - 0x7645, 0x7646, 0x7647, 0x7648, 0x7649, 0x764a, 0x764b, 0x764e, - 0x764f, 0x7650, 0x7651, 0x7652, 0x7653, 0x7655, 0x7657, 0x7658, - 0x7659, 0x765a, 0x765b, 0x765d, 0x765f, 0x7660, 0x7661, 0x7662, - 0x7664, 0x7665, 0x7666, 0x7667, 0x7668, 0x7669, 0x766a, 0x766c, - 0x766d, 0x766e, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x7675, - 0x7676, 0x7677, 0x7679, 0x767a, 0x767c, 0x767f, 0x7680, 0x7681, - 0x7683, 0x7685, 0x7689, 0x768a, 0x768c, 0x768d, 0x768f, 0x7690, - 0x7692, 0x7694, 0x7695, 0x7697, 0x7698, 0x769a, 0x769b, 0x769c, - 0x769d, 0x769e, 0x769f, 0x76a0, 0x76a1, 0x76a2, 0x76a3, 0x76a5, - 0x76a6, 0x76a7, 0x76a8, 0x76a9, 0x76aa, 0x76ab, 0x76ac, 0x76ad, - 0x76af, 0x76b0, 0x76b3, 0x76b5, 0x76b6, 0x76b7, 0x76b8, 0x76b9, - 0x76ba, 0x76bb, 0x76bc, 0x76bd, 0x76be, 0x76c0, 0x76c1, 0x76c3, - 0x554a, 0x963f, 0x57c3, 0x6328, 0x54ce, 0x5509, 0x54c0, 0x7691, - 0x764c, 0x853c, 0x77ee, 0x827e, 0x788d, 0x7231, 0x9698, 0x978d, - 0x6c28, 0x5b89, 0x4ffa, 0x6309, 0x6697, 0x5cb8, 0x80fa, 0x6848, - 0x80ae, 0x6602, 0x76ce, 0x51f9, 0x6556, 0x71ac, 0x7ff1, 0x8884, - 0x50b2, 0x5965, 0x61ca, 0x6fb3, 0x82ad, 0x634c, 0x6252, 0x53ed, - 0x5427, 0x7b06, 0x516b, 0x75a4, 0x5df4, 0x62d4, 0x8dcb, 0x9776, - 0x628a, 0x8019, 0x575d, 0x9738, 0x7f62, 0x7238, 0x767d, 0x67cf, - 0x767e, 0x6446, 0x4f70, 0x8d25, 0x62dc, 0x7a17, 0x6591, 0x73ed, - 0x642c, 0x6273, 0x822c, 0x9881, 0x677f, 0x7248, 0x626e, 0x62cc, - 0x4f34, 0x74e3, 0x534a, 0x529e, 0x7eca, 0x90a6, 0x5e2e, 0x6886, - 0x699c, 0x8180, 0x7ed1, 0x68d2, 0x78c5, 0x868c, 0x9551, 0x508d, - 0x8c24, 0x82de, 0x80de, 0x5305, 0x8912, 0x5265, - /* 0xb1 */ - 0x76c4, 0x76c7, 0x76c9, 0x76cb, 0x76cc, 0x76d3, 0x76d5, 0x76d9, - 0x76da, 0x76dc, 0x76dd, 0x76de, 0x76e0, 0x76e1, 0x76e2, 0x76e3, - 0x76e4, 0x76e6, 0x76e7, 0x76e8, 0x76e9, 0x76ea, 0x76eb, 0x76ec, - 0x76ed, 0x76f0, 0x76f3, 0x76f5, 0x76f6, 0x76f7, 0x76fa, 0x76fb, - 0x76fd, 0x76ff, 0x7700, 0x7702, 0x7703, 0x7705, 0x7706, 0x770a, - 0x770c, 0x770e, 0x770f, 0x7710, 0x7711, 0x7712, 0x7713, 0x7714, - 0x7715, 0x7716, 0x7717, 0x7718, 0x771b, 0x771c, 0x771d, 0x771e, - 0x7721, 0x7723, 0x7724, 0x7725, 0x7727, 0x772a, 0x772b, 0x772c, - 0x772e, 0x7730, 0x7731, 0x7732, 0x7733, 0x7734, 0x7739, 0x773b, - 0x773d, 0x773e, 0x773f, 0x7742, 0x7744, 0x7745, 0x7746, 0x7748, - 0x7749, 0x774a, 0x774b, 0x774c, 0x774d, 0x774e, 0x774f, 0x7752, - 0x7753, 0x7754, 0x7755, 0x7756, 0x7757, 0x7758, 0x7759, 0x775c, - 0x8584, 0x96f9, 0x4fdd, 0x5821, 0x9971, 0x5b9d, 0x62b1, 0x62a5, - 0x66b4, 0x8c79, 0x9c8d, 0x7206, 0x676f, 0x7891, 0x60b2, 0x5351, - 0x5317, 0x8f88, 0x80cc, 0x8d1d, 0x94a1, 0x500d, 0x72c8, 0x5907, - 0x60eb, 0x7119, 0x88ab, 0x5954, 0x82ef, 0x672c, 0x7b28, 0x5d29, - 0x7ef7, 0x752d, 0x6cf5, 0x8e66, 0x8ff8, 0x903c, 0x9f3b, 0x6bd4, - 0x9119, 0x7b14, 0x5f7c, 0x78a7, 0x84d6, 0x853d, 0x6bd5, 0x6bd9, - 0x6bd6, 0x5e01, 0x5e87, 0x75f9, 0x95ed, 0x655d, 0x5f0a, 0x5fc5, - 0x8f9f, 0x58c1, 0x81c2, 0x907f, 0x965b, 0x97ad, 0x8fb9, 0x7f16, - 0x8d2c, 0x6241, 0x4fbf, 0x53d8, 0x535e, 0x8fa8, 0x8fa9, 0x8fab, - 0x904d, 0x6807, 0x5f6a, 0x8198, 0x8868, 0x9cd6, 0x618b, 0x522b, - 0x762a, 0x5f6c, 0x658c, 0x6fd2, 0x6ee8, 0x5bbe, 0x6448, 0x5175, - 0x51b0, 0x67c4, 0x4e19, 0x79c9, 0x997c, 0x70b3, - /* 0xb2 */ - 0x775d, 0x775e, 0x775f, 0x7760, 0x7764, 0x7767, 0x7769, 0x776a, - 0x776d, 0x776e, 0x776f, 0x7770, 0x7771, 0x7772, 0x7773, 0x7774, - 0x7775, 0x7776, 0x7777, 0x7778, 0x777a, 0x777b, 0x777c, 0x7781, - 0x7782, 0x7783, 0x7786, 0x7787, 0x7788, 0x7789, 0x778a, 0x778b, - 0x778f, 0x7790, 0x7793, 0x7794, 0x7795, 0x7796, 0x7797, 0x7798, - 0x7799, 0x779a, 0x779b, 0x779c, 0x779d, 0x779e, 0x77a1, 0x77a3, - 0x77a4, 0x77a6, 0x77a8, 0x77ab, 0x77ad, 0x77ae, 0x77af, 0x77b1, - 0x77b2, 0x77b4, 0x77b6, 0x77b7, 0x77b8, 0x77b9, 0x77ba, 0x77bc, - 0x77be, 0x77c0, 0x77c1, 0x77c2, 0x77c3, 0x77c4, 0x77c5, 0x77c6, - 0x77c7, 0x77c8, 0x77c9, 0x77ca, 0x77cb, 0x77cc, 0x77ce, 0x77cf, - 0x77d0, 0x77d1, 0x77d2, 0x77d3, 0x77d4, 0x77d5, 0x77d6, 0x77d8, - 0x77d9, 0x77da, 0x77dd, 0x77de, 0x77df, 0x77e0, 0x77e1, 0x77e4, - 0x75c5, 0x5e76, 0x73bb, 0x83e0, 0x64ad, 0x62e8, 0x94b5, 0x6ce2, - 0x535a, 0x52c3, 0x640f, 0x94c2, 0x7b94, 0x4f2f, 0x5e1b, 0x8236, - 0x8116, 0x818a, 0x6e24, 0x6cca, 0x9a73, 0x6355, 0x535c, 0x54fa, - 0x8865, 0x57e0, 0x4e0d, 0x5e03, 0x6b65, 0x7c3f, 0x90e8, 0x6016, - 0x64e6, 0x731c, 0x88c1, 0x6750, 0x624d, 0x8d22, 0x776c, 0x8e29, - 0x91c7, 0x5f69, 0x83dc, 0x8521, 0x9910, 0x53c2, 0x8695, 0x6b8b, - 0x60ed, 0x60e8, 0x707f, 0x82cd, 0x8231, 0x4ed3, 0x6ca7, 0x85cf, - 0x64cd, 0x7cd9, 0x69fd, 0x66f9, 0x8349, 0x5395, 0x7b56, 0x4fa7, - 0x518c, 0x6d4b, 0x5c42, 0x8e6d, 0x63d2, 0x53c9, 0x832c, 0x8336, - 0x67e5, 0x78b4, 0x643d, 0x5bdf, 0x5c94, 0x5dee, 0x8be7, 0x62c6, - 0x67f4, 0x8c7a, 0x6400, 0x63ba, 0x8749, 0x998b, 0x8c17, 0x7f20, - 0x94f2, 0x4ea7, 0x9610, 0x98a4, 0x660c, 0x7316, - /* 0xb3 */ - 0x77e6, 0x77e8, 0x77ea, 0x77ef, 0x77f0, 0x77f1, 0x77f2, 0x77f4, - 0x77f5, 0x77f7, 0x77f9, 0x77fa, 0x77fb, 0x77fc, 0x7803, 0x7804, - 0x7805, 0x7806, 0x7807, 0x7808, 0x780a, 0x780b, 0x780e, 0x780f, - 0x7810, 0x7813, 0x7815, 0x7819, 0x781b, 0x781e, 0x7820, 0x7821, - 0x7822, 0x7824, 0x7828, 0x782a, 0x782b, 0x782e, 0x782f, 0x7831, - 0x7832, 0x7833, 0x7835, 0x7836, 0x783d, 0x783f, 0x7841, 0x7842, - 0x7843, 0x7844, 0x7846, 0x7848, 0x7849, 0x784a, 0x784b, 0x784d, - 0x784f, 0x7851, 0x7853, 0x7854, 0x7858, 0x7859, 0x785a, 0x785b, - 0x785c, 0x785e, 0x785f, 0x7860, 0x7861, 0x7862, 0x7863, 0x7864, - 0x7865, 0x7866, 0x7867, 0x7868, 0x7869, 0x786f, 0x7870, 0x7871, - 0x7872, 0x7873, 0x7874, 0x7875, 0x7876, 0x7878, 0x7879, 0x787a, - 0x787b, 0x787d, 0x787e, 0x787f, 0x7880, 0x7881, 0x7882, 0x7883, - 0x573a, 0x5c1d, 0x5e38, 0x957f, 0x507f, 0x80a0, 0x5382, 0x655e, - 0x7545, 0x5531, 0x5021, 0x8d85, 0x6284, 0x949e, 0x671d, 0x5632, - 0x6f6e, 0x5de2, 0x5435, 0x7092, 0x8f66, 0x626f, 0x64a4, 0x63a3, - 0x5f7b, 0x6f88, 0x90f4, 0x81e3, 0x8fb0, 0x5c18, 0x6668, 0x5ff1, - 0x6c89, 0x9648, 0x8d81, 0x886c, 0x6491, 0x79f0, 0x57ce, 0x6a59, - 0x6210, 0x5448, 0x4e58, 0x7a0b, 0x60e9, 0x6f84, 0x8bda, 0x627f, - 0x901e, 0x9a8b, 0x79e4, 0x5403, 0x75f4, 0x6301, 0x5319, 0x6c60, - 0x8fdf, 0x5f1b, 0x9a70, 0x803b, 0x9f7f, 0x4f88, 0x5c3a, 0x8d64, - 0x7fc5, 0x65a5, 0x70bd, 0x5145, 0x51b2, 0x866b, 0x5d07, 0x5ba0, - 0x62bd, 0x916c, 0x7574, 0x8e0c, 0x7a20, 0x6101, 0x7b79, 0x4ec7, - 0x7ef8, 0x7785, 0x4e11, 0x81ed, 0x521d, 0x51fa, 0x6a71, 0x53a8, - 0x8e87, 0x9504, 0x96cf, 0x6ec1, 0x9664, 0x695a, - /* 0xb4 */ - 0x7884, 0x7885, 0x7886, 0x7888, 0x788a, 0x788b, 0x788f, 0x7890, - 0x7892, 0x7894, 0x7895, 0x7896, 0x7899, 0x789d, 0x789e, 0x78a0, - 0x78a2, 0x78a4, 0x78a6, 0x78a8, 0x78a9, 0x78aa, 0x78ab, 0x78ac, - 0x78ad, 0x78ae, 0x78af, 0x78b5, 0x78b6, 0x78b7, 0x78b8, 0x78ba, - 0x78bb, 0x78bc, 0x78bd, 0x78bf, 0x78c0, 0x78c2, 0x78c3, 0x78c4, - 0x78c6, 0x78c7, 0x78c8, 0x78cc, 0x78cd, 0x78ce, 0x78cf, 0x78d1, - 0x78d2, 0x78d3, 0x78d6, 0x78d7, 0x78d8, 0x78da, 0x78db, 0x78dc, - 0x78dd, 0x78de, 0x78df, 0x78e0, 0x78e1, 0x78e2, 0x78e3, 0x78e4, - 0x78e5, 0x78e6, 0x78e7, 0x78e9, 0x78ea, 0x78eb, 0x78ed, 0x78ee, - 0x78ef, 0x78f0, 0x78f1, 0x78f3, 0x78f5, 0x78f6, 0x78f8, 0x78f9, - 0x78fb, 0x78fc, 0x78fd, 0x78fe, 0x78ff, 0x7900, 0x7902, 0x7903, - 0x7904, 0x7906, 0x7907, 0x7908, 0x7909, 0x790a, 0x790b, 0x790c, - 0x7840, 0x50a8, 0x77d7, 0x6410, 0x89e6, 0x5904, 0x63e3, 0x5ddd, - 0x7a7f, 0x693d, 0x4f20, 0x8239, 0x5598, 0x4e32, 0x75ae, 0x7a97, - 0x5e62, 0x5e8a, 0x95ef, 0x521b, 0x5439, 0x708a, 0x6376, 0x9524, - 0x5782, 0x6625, 0x693f, 0x9187, 0x5507, 0x6df3, 0x7eaf, 0x8822, - 0x6233, 0x7ef0, 0x75b5, 0x8328, 0x78c1, 0x96cc, 0x8f9e, 0x6148, - 0x74f7, 0x8bcd, 0x6b64, 0x523a, 0x8d50, 0x6b21, 0x806a, 0x8471, - 0x56f1, 0x5306, 0x4ece, 0x4e1b, 0x51d1, 0x7c97, 0x918b, 0x7c07, - 0x4fc3, 0x8e7f, 0x7be1, 0x7a9c, 0x6467, 0x5d14, 0x50ac, 0x8106, - 0x7601, 0x7cb9, 0x6dec, 0x7fe0, 0x6751, 0x5b58, 0x5bf8, 0x78cb, - 0x64ae, 0x6413, 0x63aa, 0x632b, 0x9519, 0x642d, 0x8fbe, 0x7b54, - 0x7629, 0x6253, 0x5927, 0x5446, 0x6b79, 0x50a3, 0x6234, 0x5e26, - 0x6b86, 0x4ee3, 0x8d37, 0x888b, 0x5f85, 0x902e, - /* 0xb5 */ - 0x790d, 0x790e, 0x790f, 0x7910, 0x7911, 0x7912, 0x7914, 0x7915, - 0x7916, 0x7917, 0x7918, 0x7919, 0x791a, 0x791b, 0x791c, 0x791d, - 0x791f, 0x7920, 0x7921, 0x7922, 0x7923, 0x7925, 0x7926, 0x7927, - 0x7928, 0x7929, 0x792a, 0x792b, 0x792c, 0x792d, 0x792e, 0x792f, - 0x7930, 0x7931, 0x7932, 0x7933, 0x7935, 0x7936, 0x7937, 0x7938, - 0x7939, 0x793d, 0x793f, 0x7942, 0x7943, 0x7944, 0x7945, 0x7947, - 0x794a, 0x794b, 0x794c, 0x794d, 0x794e, 0x794f, 0x7950, 0x7951, - 0x7952, 0x7954, 0x7955, 0x7958, 0x7959, 0x7961, 0x7963, 0x7964, - 0x7966, 0x7969, 0x796a, 0x796b, 0x796c, 0x796e, 0x7970, 0x7971, - 0x7972, 0x7973, 0x7974, 0x7975, 0x7976, 0x7979, 0x797b, 0x797c, - 0x797d, 0x797e, 0x797f, 0x7982, 0x7983, 0x7986, 0x7987, 0x7988, - 0x7989, 0x798b, 0x798c, 0x798d, 0x798e, 0x7990, 0x7991, 0x7992, - 0x6020, 0x803d, 0x62c5, 0x4e39, 0x5355, 0x90f8, 0x63b8, 0x80c6, - 0x65e6, 0x6c2e, 0x4f46, 0x60ee, 0x6de1, 0x8bde, 0x5f39, 0x86cb, - 0x5f53, 0x6321, 0x515a, 0x8361, 0x6863, 0x5200, 0x6363, 0x8e48, - 0x5012, 0x5c9b, 0x7977, 0x5bfc, 0x5230, 0x7a3b, 0x60bc, 0x9053, - 0x76d7, 0x5fb7, 0x5f97, 0x7684, 0x8e6c, 0x706f, 0x767b, 0x7b49, - 0x77aa, 0x51f3, 0x9093, 0x5824, 0x4f4e, 0x6ef4, 0x8fea, 0x654c, - 0x7b1b, 0x72c4, 0x6da4, 0x7fdf, 0x5ae1, 0x62b5, 0x5e95, 0x5730, - 0x8482, 0x7b2c, 0x5e1d, 0x5f1f, 0x9012, 0x7f14, 0x98a0, 0x6382, - 0x6ec7, 0x7898, 0x70b9, 0x5178, 0x975b, 0x57ab, 0x7535, 0x4f43, - 0x7538, 0x5e97, 0x60e6, 0x5960, 0x6dc0, 0x6bbf, 0x7889, 0x53fc, - 0x96d5, 0x51cb, 0x5201, 0x6389, 0x540a, 0x9493, 0x8c03, 0x8dcc, - 0x7239, 0x789f, 0x8776, 0x8fed, 0x8c0d, 0x53e0, - /* 0xb6 */ - 0x7993, 0x7994, 0x7995, 0x7996, 0x7997, 0x7998, 0x7999, 0x799b, - 0x799c, 0x799d, 0x799e, 0x799f, 0x79a0, 0x79a1, 0x79a2, 0x79a3, - 0x79a4, 0x79a5, 0x79a6, 0x79a8, 0x79a9, 0x79aa, 0x79ab, 0x79ac, - 0x79ad, 0x79ae, 0x79af, 0x79b0, 0x79b1, 0x79b2, 0x79b4, 0x79b5, - 0x79b6, 0x79b7, 0x79b8, 0x79bc, 0x79bf, 0x79c2, 0x79c4, 0x79c5, - 0x79c7, 0x79c8, 0x79ca, 0x79cc, 0x79ce, 0x79cf, 0x79d0, 0x79d3, - 0x79d4, 0x79d6, 0x79d7, 0x79d9, 0x79da, 0x79db, 0x79dc, 0x79dd, - 0x79de, 0x79e0, 0x79e1, 0x79e2, 0x79e5, 0x79e8, 0x79ea, 0x79ec, - 0x79ee, 0x79f1, 0x79f2, 0x79f3, 0x79f4, 0x79f5, 0x79f6, 0x79f7, - 0x79f9, 0x79fa, 0x79fc, 0x79fe, 0x79ff, 0x7a01, 0x7a04, 0x7a05, - 0x7a07, 0x7a08, 0x7a09, 0x7a0a, 0x7a0c, 0x7a0f, 0x7a10, 0x7a11, - 0x7a12, 0x7a13, 0x7a15, 0x7a16, 0x7a18, 0x7a19, 0x7a1b, 0x7a1c, - 0x4e01, 0x76ef, 0x53ee, 0x9489, 0x9876, 0x9f0e, 0x952d, 0x5b9a, - 0x8ba2, 0x4e22, 0x4e1c, 0x51ac, 0x8463, 0x61c2, 0x52a8, 0x680b, - 0x4f97, 0x606b, 0x51bb, 0x6d1e, 0x515c, 0x6296, 0x6597, 0x9661, - 0x8c46, 0x9017, 0x75d8, 0x90fd, 0x7763, 0x6bd2, 0x728a, 0x72ec, - 0x8bfb, 0x5835, 0x7779, 0x8d4c, 0x675c, 0x9540, 0x809a, 0x5ea6, - 0x6e21, 0x5992, 0x7aef, 0x77ed, 0x953b, 0x6bb5, 0x65ad, 0x7f0e, - 0x5806, 0x5151, 0x961f, 0x5bf9, 0x58a9, 0x5428, 0x8e72, 0x6566, - 0x987f, 0x56e4, 0x949d, 0x76fe, 0x9041, 0x6387, 0x54c6, 0x591a, - 0x593a, 0x579b, 0x8eb2, 0x6735, 0x8dfa, 0x8235, 0x5241, 0x60f0, - 0x5815, 0x86fe, 0x5ce8, 0x9e45, 0x4fc4, 0x989d, 0x8bb9, 0x5a25, - 0x6076, 0x5384, 0x627c, 0x904f, 0x9102, 0x997f, 0x6069, 0x800c, - 0x513f, 0x8033, 0x5c14, 0x9975, 0x6d31, 0x4e8c, - /* 0xb7 */ - 0x7a1d, 0x7a1f, 0x7a21, 0x7a22, 0x7a24, 0x7a25, 0x7a26, 0x7a27, - 0x7a28, 0x7a29, 0x7a2a, 0x7a2b, 0x7a2c, 0x7a2d, 0x7a2e, 0x7a2f, - 0x7a30, 0x7a31, 0x7a32, 0x7a34, 0x7a35, 0x7a36, 0x7a38, 0x7a3a, - 0x7a3e, 0x7a40, 0x7a41, 0x7a42, 0x7a43, 0x7a44, 0x7a45, 0x7a47, - 0x7a48, 0x7a49, 0x7a4a, 0x7a4b, 0x7a4c, 0x7a4d, 0x7a4e, 0x7a4f, - 0x7a50, 0x7a52, 0x7a53, 0x7a54, 0x7a55, 0x7a56, 0x7a58, 0x7a59, - 0x7a5a, 0x7a5b, 0x7a5c, 0x7a5d, 0x7a5e, 0x7a5f, 0x7a60, 0x7a61, - 0x7a62, 0x7a63, 0x7a64, 0x7a65, 0x7a66, 0x7a67, 0x7a68, 0x7a69, - 0x7a6a, 0x7a6b, 0x7a6c, 0x7a6d, 0x7a6e, 0x7a6f, 0x7a71, 0x7a72, - 0x7a73, 0x7a75, 0x7a7b, 0x7a7c, 0x7a7d, 0x7a7e, 0x7a82, 0x7a85, - 0x7a87, 0x7a89, 0x7a8a, 0x7a8b, 0x7a8c, 0x7a8e, 0x7a8f, 0x7a90, - 0x7a93, 0x7a94, 0x7a99, 0x7a9a, 0x7a9b, 0x7a9e, 0x7aa1, 0x7aa2, - 0x8d30, 0x53d1, 0x7f5a, 0x7b4f, 0x4f10, 0x4e4f, 0x9600, 0x6cd5, - 0x73d0, 0x85e9, 0x5e06, 0x756a, 0x7ffb, 0x6a0a, 0x77fe, 0x9492, - 0x7e41, 0x51e1, 0x70e6, 0x53cd, 0x8fd4, 0x8303, 0x8d29, 0x72af, - 0x996d, 0x6cdb, 0x574a, 0x82b3, 0x65b9, 0x80aa, 0x623f, 0x9632, - 0x59a8, 0x4eff, 0x8bbf, 0x7eba, 0x653e, 0x83f2, 0x975e, 0x5561, - 0x98de, 0x80a5, 0x532a, 0x8bfd, 0x5420, 0x80ba, 0x5e9f, 0x6cb8, - 0x8d39, 0x82ac, 0x915a, 0x5429, 0x6c1b, 0x5206, 0x7eb7, 0x575f, - 0x711a, 0x6c7e, 0x7c89, 0x594b, 0x4efd, 0x5fff, 0x6124, 0x7caa, - 0x4e30, 0x5c01, 0x67ab, 0x8702, 0x5cf0, 0x950b, 0x98ce, 0x75af, - 0x70fd, 0x9022, 0x51af, 0x7f1d, 0x8bbd, 0x5949, 0x51e4, 0x4f5b, - 0x5426, 0x592b, 0x6577, 0x80a4, 0x5b75, 0x6276, 0x62c2, 0x8f90, - 0x5e45, 0x6c1f, 0x7b26, 0x4f0f, 0x4fd8, 0x670d, - /* 0xb8 */ - 0x7aa3, 0x7aa4, 0x7aa7, 0x7aa9, 0x7aaa, 0x7aab, 0x7aae, 0x7aaf, - 0x7ab0, 0x7ab1, 0x7ab2, 0x7ab4, 0x7ab5, 0x7ab6, 0x7ab7, 0x7ab8, - 0x7ab9, 0x7aba, 0x7abb, 0x7abc, 0x7abd, 0x7abe, 0x7ac0, 0x7ac1, - 0x7ac2, 0x7ac3, 0x7ac4, 0x7ac5, 0x7ac6, 0x7ac7, 0x7ac8, 0x7ac9, - 0x7aca, 0x7acc, 0x7acd, 0x7ace, 0x7acf, 0x7ad0, 0x7ad1, 0x7ad2, - 0x7ad3, 0x7ad4, 0x7ad5, 0x7ad7, 0x7ad8, 0x7ada, 0x7adb, 0x7adc, - 0x7add, 0x7ae1, 0x7ae2, 0x7ae4, 0x7ae7, 0x7ae8, 0x7ae9, 0x7aea, - 0x7aeb, 0x7aec, 0x7aee, 0x7af0, 0x7af1, 0x7af2, 0x7af3, 0x7af4, - 0x7af5, 0x7af6, 0x7af7, 0x7af8, 0x7afb, 0x7afc, 0x7afe, 0x7b00, - 0x7b01, 0x7b02, 0x7b05, 0x7b07, 0x7b09, 0x7b0c, 0x7b0d, 0x7b0e, - 0x7b10, 0x7b12, 0x7b13, 0x7b16, 0x7b17, 0x7b18, 0x7b1a, 0x7b1c, - 0x7b1d, 0x7b1f, 0x7b21, 0x7b22, 0x7b23, 0x7b27, 0x7b29, 0x7b2d, - 0x6d6e, 0x6daa, 0x798f, 0x88b1, 0x5f17, 0x752b, 0x629a, 0x8f85, - 0x4fef, 0x91dc, 0x65a7, 0x812f, 0x8151, 0x5e9c, 0x8150, 0x8d74, - 0x526f, 0x8986, 0x8d4b, 0x590d, 0x5085, 0x4ed8, 0x961c, 0x7236, - 0x8179, 0x8d1f, 0x5bcc, 0x8ba3, 0x9644, 0x5987, 0x7f1a, 0x5490, - 0x5676, 0x560e, 0x8be5, 0x6539, 0x6982, 0x9499, 0x76d6, 0x6e89, - 0x5e72, 0x7518, 0x6746, 0x67d1, 0x7aff, 0x809d, 0x8d76, 0x611f, - 0x79c6, 0x6562, 0x8d63, 0x5188, 0x521a, 0x94a2, 0x7f38, 0x809b, - 0x7eb2, 0x5c97, 0x6e2f, 0x6760, 0x7bd9, 0x768b, 0x9ad8, 0x818f, - 0x7f94, 0x7cd5, 0x641e, 0x9550, 0x7a3f, 0x544a, 0x54e5, 0x6b4c, - 0x6401, 0x6208, 0x9e3d, 0x80f3, 0x7599, 0x5272, 0x9769, 0x845b, - 0x683c, 0x86e4, 0x9601, 0x9694, 0x94ec, 0x4e2a, 0x5404, 0x7ed9, - 0x6839, 0x8ddf, 0x8015, 0x66f4, 0x5e9a, 0x7fb9, - /* 0xb9 */ - 0x7b2f, 0x7b30, 0x7b32, 0x7b34, 0x7b35, 0x7b36, 0x7b37, 0x7b39, - 0x7b3b, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b42, 0x7b43, 0x7b44, - 0x7b46, 0x7b48, 0x7b4a, 0x7b4d, 0x7b4e, 0x7b53, 0x7b55, 0x7b57, - 0x7b59, 0x7b5c, 0x7b5e, 0x7b5f, 0x7b61, 0x7b63, 0x7b64, 0x7b65, - 0x7b66, 0x7b67, 0x7b68, 0x7b69, 0x7b6a, 0x7b6b, 0x7b6c, 0x7b6d, - 0x7b6f, 0x7b70, 0x7b73, 0x7b74, 0x7b76, 0x7b78, 0x7b7a, 0x7b7c, - 0x7b7d, 0x7b7f, 0x7b81, 0x7b82, 0x7b83, 0x7b84, 0x7b86, 0x7b87, - 0x7b88, 0x7b89, 0x7b8a, 0x7b8b, 0x7b8c, 0x7b8e, 0x7b8f, 0x7b91, - 0x7b92, 0x7b93, 0x7b96, 0x7b98, 0x7b99, 0x7b9a, 0x7b9b, 0x7b9e, - 0x7b9f, 0x7ba0, 0x7ba3, 0x7ba4, 0x7ba5, 0x7bae, 0x7baf, 0x7bb0, - 0x7bb2, 0x7bb3, 0x7bb5, 0x7bb6, 0x7bb7, 0x7bb9, 0x7bba, 0x7bbb, - 0x7bbc, 0x7bbd, 0x7bbe, 0x7bbf, 0x7bc0, 0x7bc2, 0x7bc3, 0x7bc4, - 0x57c2, 0x803f, 0x6897, 0x5de5, 0x653b, 0x529f, 0x606d, 0x9f9a, - 0x4f9b, 0x8eac, 0x516c, 0x5bab, 0x5f13, 0x5de9, 0x6c5e, 0x62f1, - 0x8d21, 0x5171, 0x94a9, 0x52fe, 0x6c9f, 0x82df, 0x72d7, 0x57a2, - 0x6784, 0x8d2d, 0x591f, 0x8f9c, 0x83c7, 0x5495, 0x7b8d, 0x4f30, - 0x6cbd, 0x5b64, 0x59d1, 0x9f13, 0x53e4, 0x86ca, 0x9aa8, 0x8c37, - 0x80a1, 0x6545, 0x987e, 0x56fa, 0x96c7, 0x522e, 0x74dc, 0x5250, - 0x5be1, 0x6302, 0x8902, 0x4e56, 0x62d0, 0x602a, 0x68fa, 0x5173, - 0x5b98, 0x51a0, 0x89c2, 0x7ba1, 0x9986, 0x7f50, 0x60ef, 0x704c, - 0x8d2f, 0x5149, 0x5e7f, 0x901b, 0x7470, 0x89c4, 0x572d, 0x7845, - 0x5f52, 0x9f9f, 0x95fa, 0x8f68, 0x9b3c, 0x8be1, 0x7678, 0x6842, - 0x67dc, 0x8dea, 0x8d35, 0x523d, 0x8f8a, 0x6eda, 0x68cd, 0x9505, - 0x90ed, 0x56fd, 0x679c, 0x88f9, 0x8fc7, 0x54c8, - /* 0xba */ - 0x7bc5, 0x7bc8, 0x7bc9, 0x7bca, 0x7bcb, 0x7bcd, 0x7bce, 0x7bcf, - 0x7bd0, 0x7bd2, 0x7bd4, 0x7bd5, 0x7bd6, 0x7bd7, 0x7bd8, 0x7bdb, - 0x7bdc, 0x7bde, 0x7bdf, 0x7be0, 0x7be2, 0x7be3, 0x7be4, 0x7be7, - 0x7be8, 0x7be9, 0x7beb, 0x7bec, 0x7bed, 0x7bef, 0x7bf0, 0x7bf2, - 0x7bf3, 0x7bf4, 0x7bf5, 0x7bf6, 0x7bf8, 0x7bf9, 0x7bfa, 0x7bfb, - 0x7bfd, 0x7bff, 0x7c00, 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c05, - 0x7c06, 0x7c08, 0x7c09, 0x7c0a, 0x7c0d, 0x7c0e, 0x7c10, 0x7c11, - 0x7c12, 0x7c13, 0x7c14, 0x7c15, 0x7c17, 0x7c18, 0x7c19, 0x7c1a, - 0x7c1b, 0x7c1c, 0x7c1d, 0x7c1e, 0x7c20, 0x7c21, 0x7c22, 0x7c23, - 0x7c24, 0x7c25, 0x7c28, 0x7c29, 0x7c2b, 0x7c2c, 0x7c2d, 0x7c2e, - 0x7c2f, 0x7c30, 0x7c31, 0x7c32, 0x7c33, 0x7c34, 0x7c35, 0x7c36, - 0x7c37, 0x7c39, 0x7c3a, 0x7c3b, 0x7c3c, 0x7c3d, 0x7c3e, 0x7c42, - 0x9ab8, 0x5b69, 0x6d77, 0x6c26, 0x4ea5, 0x5bb3, 0x9a87, 0x9163, - 0x61a8, 0x90af, 0x97e9, 0x542b, 0x6db5, 0x5bd2, 0x51fd, 0x558a, - 0x7f55, 0x7ff0, 0x64bc, 0x634d, 0x65f1, 0x61be, 0x608d, 0x710a, - 0x6c57, 0x6c49, 0x592f, 0x676d, 0x822a, 0x58d5, 0x568e, 0x8c6a, - 0x6beb, 0x90dd, 0x597d, 0x8017, 0x53f7, 0x6d69, 0x5475, 0x559d, - 0x8377, 0x83cf, 0x6838, 0x79be, 0x548c, 0x4f55, 0x5408, 0x76d2, - 0x8c89, 0x9602, 0x6cb3, 0x6db8, 0x8d6b, 0x8910, 0x9e64, 0x8d3a, - 0x563f, 0x9ed1, 0x75d5, 0x5f88, 0x72e0, 0x6068, 0x54fc, 0x4ea8, - 0x6a2a, 0x8861, 0x6052, 0x8f70, 0x54c4, 0x70d8, 0x8679, 0x9e3f, - 0x6d2a, 0x5b8f, 0x5f18, 0x7ea2, 0x5589, 0x4faf, 0x7334, 0x543c, - 0x539a, 0x5019, 0x540e, 0x547c, 0x4e4e, 0x5ffd, 0x745a, 0x58f6, - 0x846b, 0x80e1, 0x8774, 0x72d0, 0x7cca, 0x6e56, - /* 0xbb */ - 0x7c43, 0x7c44, 0x7c45, 0x7c46, 0x7c47, 0x7c48, 0x7c49, 0x7c4a, - 0x7c4b, 0x7c4c, 0x7c4e, 0x7c4f, 0x7c50, 0x7c51, 0x7c52, 0x7c53, - 0x7c54, 0x7c55, 0x7c56, 0x7c57, 0x7c58, 0x7c59, 0x7c5a, 0x7c5b, - 0x7c5c, 0x7c5d, 0x7c5e, 0x7c5f, 0x7c60, 0x7c61, 0x7c62, 0x7c63, - 0x7c64, 0x7c65, 0x7c66, 0x7c67, 0x7c68, 0x7c69, 0x7c6a, 0x7c6b, - 0x7c6c, 0x7c6d, 0x7c6e, 0x7c6f, 0x7c70, 0x7c71, 0x7c72, 0x7c75, - 0x7c76, 0x7c77, 0x7c78, 0x7c79, 0x7c7a, 0x7c7e, 0x7c7f, 0x7c80, - 0x7c81, 0x7c82, 0x7c83, 0x7c84, 0x7c85, 0x7c86, 0x7c87, 0x7c88, - 0x7c8a, 0x7c8b, 0x7c8c, 0x7c8d, 0x7c8e, 0x7c8f, 0x7c90, 0x7c93, - 0x7c94, 0x7c96, 0x7c99, 0x7c9a, 0x7c9b, 0x7ca0, 0x7ca1, 0x7ca3, - 0x7ca6, 0x7ca7, 0x7ca8, 0x7ca9, 0x7cab, 0x7cac, 0x7cad, 0x7caf, - 0x7cb0, 0x7cb4, 0x7cb5, 0x7cb6, 0x7cb7, 0x7cb8, 0x7cba, 0x7cbb, - 0x5f27, 0x864e, 0x552c, 0x62a4, 0x4e92, 0x6caa, 0x6237, 0x82b1, - 0x54d7, 0x534e, 0x733e, 0x6ed1, 0x753b, 0x5212, 0x5316, 0x8bdd, - 0x69d0, 0x5f8a, 0x6000, 0x6dee, 0x574f, 0x6b22, 0x73af, 0x6853, - 0x8fd8, 0x7f13, 0x6362, 0x60a3, 0x5524, 0x75ea, 0x8c62, 0x7115, - 0x6da3, 0x5ba6, 0x5e7b, 0x8352, 0x614c, 0x9ec4, 0x78fa, 0x8757, - 0x7c27, 0x7687, 0x51f0, 0x60f6, 0x714c, 0x6643, 0x5e4c, 0x604d, - 0x8c0e, 0x7070, 0x6325, 0x8f89, 0x5fbd, 0x6062, 0x86d4, 0x56de, - 0x6bc1, 0x6094, 0x6167, 0x5349, 0x60e0, 0x6666, 0x8d3f, 0x79fd, - 0x4f1a, 0x70e9, 0x6c47, 0x8bb3, 0x8bf2, 0x7ed8, 0x8364, 0x660f, - 0x5a5a, 0x9b42, 0x6d51, 0x6df7, 0x8c41, 0x6d3b, 0x4f19, 0x706b, - 0x83b7, 0x6216, 0x60d1, 0x970d, 0x8d27, 0x7978, 0x51fb, 0x573e, - 0x57fa, 0x673a, 0x7578, 0x7a3d, 0x79ef, 0x7b95, - /* 0xbc */ - 0x7cbf, 0x7cc0, 0x7cc2, 0x7cc3, 0x7cc4, 0x7cc6, 0x7cc9, 0x7ccb, - 0x7cce, 0x7ccf, 0x7cd0, 0x7cd1, 0x7cd2, 0x7cd3, 0x7cd4, 0x7cd8, - 0x7cda, 0x7cdb, 0x7cdd, 0x7cde, 0x7ce1, 0x7ce2, 0x7ce3, 0x7ce4, - 0x7ce5, 0x7ce6, 0x7ce7, 0x7ce9, 0x7cea, 0x7ceb, 0x7cec, 0x7ced, - 0x7cee, 0x7cf0, 0x7cf1, 0x7cf2, 0x7cf3, 0x7cf4, 0x7cf5, 0x7cf6, - 0x7cf7, 0x7cf9, 0x7cfa, 0x7cfc, 0x7cfd, 0x7cfe, 0x7cff, 0x7d00, - 0x7d01, 0x7d02, 0x7d03, 0x7d04, 0x7d05, 0x7d06, 0x7d07, 0x7d08, - 0x7d09, 0x7d0b, 0x7d0c, 0x7d0d, 0x7d0e, 0x7d0f, 0x7d10, 0x7d11, - 0x7d12, 0x7d13, 0x7d14, 0x7d15, 0x7d16, 0x7d17, 0x7d18, 0x7d19, - 0x7d1a, 0x7d1b, 0x7d1c, 0x7d1d, 0x7d1e, 0x7d1f, 0x7d21, 0x7d23, - 0x7d24, 0x7d25, 0x7d26, 0x7d28, 0x7d29, 0x7d2a, 0x7d2c, 0x7d2d, - 0x7d2e, 0x7d30, 0x7d31, 0x7d32, 0x7d33, 0x7d34, 0x7d35, 0x7d36, - 0x808c, 0x9965, 0x8ff9, 0x6fc0, 0x8ba5, 0x9e21, 0x59ec, 0x7ee9, - 0x7f09, 0x5409, 0x6781, 0x68d8, 0x8f91, 0x7c4d, 0x96c6, 0x53ca, - 0x6025, 0x75be, 0x6c72, 0x5373, 0x5ac9, 0x7ea7, 0x6324, 0x51e0, - 0x810a, 0x5df1, 0x84df, 0x6280, 0x5180, 0x5b63, 0x4f0e, 0x796d, - 0x5242, 0x60b8, 0x6d4e, 0x5bc4, 0x5bc2, 0x8ba1, 0x8bb0, 0x65e2, - 0x5fcc, 0x9645, 0x5993, 0x7ee7, 0x7eaa, 0x5609, 0x67b7, 0x5939, - 0x4f73, 0x5bb6, 0x52a0, 0x835a, 0x988a, 0x8d3e, 0x7532, 0x94be, - 0x5047, 0x7a3c, 0x4ef7, 0x67b6, 0x9a7e, 0x5ac1, 0x6b7c, 0x76d1, - 0x575a, 0x5c16, 0x7b3a, 0x95f4, 0x714e, 0x517c, 0x80a9, 0x8270, - 0x5978, 0x7f04, 0x8327, 0x68c0, 0x67ec, 0x78b1, 0x7877, 0x62e3, - 0x6361, 0x7b80, 0x4fed, 0x526a, 0x51cf, 0x8350, 0x69db, 0x9274, - 0x8df5, 0x8d31, 0x89c1, 0x952e, 0x7bad, 0x4ef6, - /* 0xbd */ - 0x7d37, 0x7d38, 0x7d39, 0x7d3a, 0x7d3b, 0x7d3c, 0x7d3d, 0x7d3e, - 0x7d3f, 0x7d40, 0x7d41, 0x7d42, 0x7d43, 0x7d44, 0x7d45, 0x7d46, - 0x7d47, 0x7d48, 0x7d49, 0x7d4a, 0x7d4b, 0x7d4c, 0x7d4d, 0x7d4e, - 0x7d4f, 0x7d50, 0x7d51, 0x7d52, 0x7d53, 0x7d54, 0x7d55, 0x7d56, - 0x7d57, 0x7d58, 0x7d59, 0x7d5a, 0x7d5b, 0x7d5c, 0x7d5d, 0x7d5e, - 0x7d5f, 0x7d60, 0x7d61, 0x7d62, 0x7d63, 0x7d64, 0x7d65, 0x7d66, - 0x7d67, 0x7d68, 0x7d69, 0x7d6a, 0x7d6b, 0x7d6c, 0x7d6d, 0x7d6f, - 0x7d70, 0x7d71, 0x7d72, 0x7d73, 0x7d74, 0x7d75, 0x7d76, 0x7d78, - 0x7d79, 0x7d7a, 0x7d7b, 0x7d7c, 0x7d7d, 0x7d7e, 0x7d7f, 0x7d80, - 0x7d81, 0x7d82, 0x7d83, 0x7d84, 0x7d85, 0x7d86, 0x7d87, 0x7d88, - 0x7d89, 0x7d8a, 0x7d8b, 0x7d8c, 0x7d8d, 0x7d8e, 0x7d8f, 0x7d90, - 0x7d91, 0x7d92, 0x7d93, 0x7d94, 0x7d95, 0x7d96, 0x7d97, 0x7d98, - 0x5065, 0x8230, 0x5251, 0x996f, 0x6e10, 0x6e85, 0x6da7, 0x5efa, - 0x50f5, 0x59dc, 0x5c06, 0x6d46, 0x6c5f, 0x7586, 0x848b, 0x6868, - 0x5956, 0x8bb2, 0x5320, 0x9171, 0x964d, 0x8549, 0x6912, 0x7901, - 0x7126, 0x80f6, 0x4ea4, 0x90ca, 0x6d47, 0x9a84, 0x5a07, 0x56bc, - 0x6405, 0x94f0, 0x77eb, 0x4fa5, 0x811a, 0x72e1, 0x89d2, 0x997a, - 0x7f34, 0x7ede, 0x527f, 0x6559, 0x9175, 0x8f7f, 0x8f83, 0x53eb, - 0x7a96, 0x63ed, 0x63a5, 0x7686, 0x79f8, 0x8857, 0x9636, 0x622a, - 0x52ab, 0x8282, 0x6854, 0x6770, 0x6377, 0x776b, 0x7aed, 0x6d01, - 0x7ed3, 0x89e3, 0x59d0, 0x6212, 0x85c9, 0x82a5, 0x754c, 0x501f, - 0x4ecb, 0x75a5, 0x8beb, 0x5c4a, 0x5dfe, 0x7b4b, 0x65a4, 0x91d1, - 0x4eca, 0x6d25, 0x895f, 0x7d27, 0x9526, 0x4ec5, 0x8c28, 0x8fdb, - 0x9773, 0x664b, 0x7981, 0x8fd1, 0x70ec, 0x6d78, - /* 0xbe */ - 0x7d99, 0x7d9a, 0x7d9b, 0x7d9c, 0x7d9d, 0x7d9e, 0x7d9f, 0x7da0, - 0x7da1, 0x7da2, 0x7da3, 0x7da4, 0x7da5, 0x7da7, 0x7da8, 0x7da9, - 0x7daa, 0x7dab, 0x7dac, 0x7dad, 0x7daf, 0x7db0, 0x7db1, 0x7db2, - 0x7db3, 0x7db4, 0x7db5, 0x7db6, 0x7db7, 0x7db8, 0x7db9, 0x7dba, - 0x7dbb, 0x7dbc, 0x7dbd, 0x7dbe, 0x7dbf, 0x7dc0, 0x7dc1, 0x7dc2, - 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dc7, 0x7dc8, 0x7dc9, 0x7dca, - 0x7dcb, 0x7dcc, 0x7dcd, 0x7dce, 0x7dcf, 0x7dd0, 0x7dd1, 0x7dd2, - 0x7dd3, 0x7dd4, 0x7dd5, 0x7dd6, 0x7dd7, 0x7dd8, 0x7dd9, 0x7dda, - 0x7ddb, 0x7ddc, 0x7ddd, 0x7dde, 0x7ddf, 0x7de0, 0x7de1, 0x7de2, - 0x7de3, 0x7de4, 0x7de5, 0x7de6, 0x7de7, 0x7de8, 0x7de9, 0x7dea, - 0x7deb, 0x7dec, 0x7ded, 0x7dee, 0x7def, 0x7df0, 0x7df1, 0x7df2, - 0x7df3, 0x7df4, 0x7df5, 0x7df6, 0x7df7, 0x7df8, 0x7df9, 0x7dfa, - 0x5c3d, 0x52b2, 0x8346, 0x5162, 0x830e, 0x775b, 0x6676, 0x9cb8, - 0x4eac, 0x60ca, 0x7cbe, 0x7cb3, 0x7ecf, 0x4e95, 0x8b66, 0x666f, - 0x9888, 0x9759, 0x5883, 0x656c, 0x955c, 0x5f84, 0x75c9, 0x9756, - 0x7adf, 0x7ade, 0x51c0, 0x70af, 0x7a98, 0x63ea, 0x7a76, 0x7ea0, - 0x7396, 0x97ed, 0x4e45, 0x7078, 0x4e5d, 0x9152, 0x53a9, 0x6551, - 0x65e7, 0x81fc, 0x8205, 0x548e, 0x5c31, 0x759a, 0x97a0, 0x62d8, - 0x72d9, 0x75bd, 0x5c45, 0x9a79, 0x83ca, 0x5c40, 0x5480, 0x77e9, - 0x4e3e, 0x6cae, 0x805a, 0x62d2, 0x636e, 0x5de8, 0x5177, 0x8ddd, - 0x8e1e, 0x952f, 0x4ff1, 0x53e5, 0x60e7, 0x70ac, 0x5267, 0x6350, - 0x9e43, 0x5a1f, 0x5026, 0x7737, 0x5377, 0x7ee2, 0x6485, 0x652b, - 0x6289, 0x6398, 0x5014, 0x7235, 0x89c9, 0x51b3, 0x8bc0, 0x7edd, - 0x5747, 0x83cc, 0x94a7, 0x519b, 0x541b, 0x5cfb, - /* 0xbf */ - 0x7dfb, 0x7dfc, 0x7dfd, 0x7dfe, 0x7dff, 0x7e00, 0x7e01, 0x7e02, - 0x7e03, 0x7e04, 0x7e05, 0x7e06, 0x7e07, 0x7e08, 0x7e09, 0x7e0a, - 0x7e0b, 0x7e0c, 0x7e0d, 0x7e0e, 0x7e0f, 0x7e10, 0x7e11, 0x7e12, - 0x7e13, 0x7e14, 0x7e15, 0x7e16, 0x7e17, 0x7e18, 0x7e19, 0x7e1a, - 0x7e1b, 0x7e1c, 0x7e1d, 0x7e1e, 0x7e1f, 0x7e20, 0x7e21, 0x7e22, - 0x7e23, 0x7e24, 0x7e25, 0x7e26, 0x7e27, 0x7e28, 0x7e29, 0x7e2a, - 0x7e2b, 0x7e2c, 0x7e2d, 0x7e2e, 0x7e2f, 0x7e30, 0x7e31, 0x7e32, - 0x7e33, 0x7e34, 0x7e35, 0x7e36, 0x7e37, 0x7e38, 0x7e39, 0x7e3a, - 0x7e3c, 0x7e3d, 0x7e3e, 0x7e3f, 0x7e40, 0x7e42, 0x7e43, 0x7e44, - 0x7e45, 0x7e46, 0x7e48, 0x7e49, 0x7e4a, 0x7e4b, 0x7e4c, 0x7e4d, - 0x7e4e, 0x7e4f, 0x7e50, 0x7e51, 0x7e52, 0x7e53, 0x7e54, 0x7e55, - 0x7e56, 0x7e57, 0x7e58, 0x7e59, 0x7e5a, 0x7e5b, 0x7e5c, 0x7e5d, - 0x4fca, 0x7ae3, 0x6d5a, 0x90e1, 0x9a8f, 0x5580, 0x5496, 0x5361, - 0x54af, 0x5f00, 0x63e9, 0x6977, 0x51ef, 0x6168, 0x520a, 0x582a, - 0x52d8, 0x574e, 0x780d, 0x770b, 0x5eb7, 0x6177, 0x7ce0, 0x625b, - 0x6297, 0x4ea2, 0x7095, 0x8003, 0x62f7, 0x70e4, 0x9760, 0x5777, - 0x82db, 0x67ef, 0x68f5, 0x78d5, 0x9897, 0x79d1, 0x58f3, 0x54b3, - 0x53ef, 0x6e34, 0x514b, 0x523b, 0x5ba2, 0x8bfe, 0x80af, 0x5543, - 0x57a6, 0x6073, 0x5751, 0x542d, 0x7a7a, 0x6050, 0x5b54, 0x63a7, - 0x62a0, 0x53e3, 0x6263, 0x5bc7, 0x67af, 0x54ed, 0x7a9f, 0x82e6, - 0x9177, 0x5e93, 0x88e4, 0x5938, 0x57ae, 0x630e, 0x8de8, 0x80ef, - 0x5757, 0x7b77, 0x4fa9, 0x5feb, 0x5bbd, 0x6b3e, 0x5321, 0x7b50, - 0x72c2, 0x6846, 0x77ff, 0x7736, 0x65f7, 0x51b5, 0x4e8f, 0x76d4, - 0x5cbf, 0x7aa5, 0x8475, 0x594e, 0x9b41, 0x5080, - /* 0xc0 */ - 0x7e5e, 0x7e5f, 0x7e60, 0x7e61, 0x7e62, 0x7e63, 0x7e64, 0x7e65, - 0x7e66, 0x7e67, 0x7e68, 0x7e69, 0x7e6a, 0x7e6b, 0x7e6c, 0x7e6d, - 0x7e6e, 0x7e6f, 0x7e70, 0x7e71, 0x7e72, 0x7e73, 0x7e74, 0x7e75, - 0x7e76, 0x7e77, 0x7e78, 0x7e79, 0x7e7a, 0x7e7b, 0x7e7c, 0x7e7d, - 0x7e7e, 0x7e7f, 0x7e80, 0x7e81, 0x7e83, 0x7e84, 0x7e85, 0x7e86, - 0x7e87, 0x7e88, 0x7e89, 0x7e8a, 0x7e8b, 0x7e8c, 0x7e8d, 0x7e8e, - 0x7e8f, 0x7e90, 0x7e91, 0x7e92, 0x7e93, 0x7e94, 0x7e95, 0x7e96, - 0x7e97, 0x7e98, 0x7e99, 0x7e9a, 0x7e9c, 0x7e9d, 0x7e9e, 0x7eae, - 0x7eb4, 0x7ebb, 0x7ebc, 0x7ed6, 0x7ee4, 0x7eec, 0x7ef9, 0x7f0a, - 0x7f10, 0x7f1e, 0x7f37, 0x7f39, 0x7f3b, 0x7f3c, 0x7f3d, 0x7f3e, - 0x7f3f, 0x7f40, 0x7f41, 0x7f43, 0x7f46, 0x7f47, 0x7f48, 0x7f49, - 0x7f4a, 0x7f4b, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f4f, 0x7f52, 0x7f53, - 0x9988, 0x6127, 0x6e83, 0x5764, 0x6606, 0x6346, 0x56f0, 0x62ec, - 0x6269, 0x5ed3, 0x9614, 0x5783, 0x62c9, 0x5587, 0x8721, 0x814a, - 0x8fa3, 0x5566, 0x83b1, 0x6765, 0x8d56, 0x84dd, 0x5a6a, 0x680f, - 0x62e6, 0x7bee, 0x9611, 0x5170, 0x6f9c, 0x8c30, 0x63fd, 0x89c8, - 0x61d2, 0x7f06, 0x70c2, 0x6ee5, 0x7405, 0x6994, 0x72fc, 0x5eca, - 0x90ce, 0x6717, 0x6d6a, 0x635e, 0x52b3, 0x7262, 0x8001, 0x4f6c, - 0x59e5, 0x916a, 0x70d9, 0x6d9d, 0x52d2, 0x4e50, 0x96f7, 0x956d, - 0x857e, 0x78ca, 0x7d2f, 0x5121, 0x5792, 0x64c2, 0x808b, 0x7c7b, - 0x6cea, 0x68f1, 0x695e, 0x51b7, 0x5398, 0x68a8, 0x7281, 0x9ece, - 0x7bf1, 0x72f8, 0x79bb, 0x6f13, 0x7406, 0x674e, 0x91cc, 0x9ca4, - 0x793c, 0x8389, 0x8354, 0x540f, 0x6817, 0x4e3d, 0x5389, 0x52b1, - 0x783e, 0x5386, 0x5229, 0x5088, 0x4f8b, 0x4fd0, - /* 0xc1 */ - 0x7f56, 0x7f59, 0x7f5b, 0x7f5c, 0x7f5d, 0x7f5e, 0x7f60, 0x7f63, - 0x7f64, 0x7f65, 0x7f66, 0x7f67, 0x7f6b, 0x7f6c, 0x7f6d, 0x7f6f, - 0x7f70, 0x7f73, 0x7f75, 0x7f76, 0x7f77, 0x7f78, 0x7f7a, 0x7f7b, - 0x7f7c, 0x7f7d, 0x7f7f, 0x7f80, 0x7f82, 0x7f83, 0x7f84, 0x7f85, - 0x7f86, 0x7f87, 0x7f88, 0x7f89, 0x7f8b, 0x7f8d, 0x7f8f, 0x7f90, - 0x7f91, 0x7f92, 0x7f93, 0x7f95, 0x7f96, 0x7f97, 0x7f98, 0x7f99, - 0x7f9b, 0x7f9c, 0x7fa0, 0x7fa2, 0x7fa3, 0x7fa5, 0x7fa6, 0x7fa8, - 0x7fa9, 0x7faa, 0x7fab, 0x7fac, 0x7fad, 0x7fae, 0x7fb1, 0x7fb3, - 0x7fb4, 0x7fb5, 0x7fb6, 0x7fb7, 0x7fba, 0x7fbb, 0x7fbe, 0x7fc0, - 0x7fc2, 0x7fc3, 0x7fc4, 0x7fc6, 0x7fc7, 0x7fc8, 0x7fc9, 0x7fcb, - 0x7fcd, 0x7fcf, 0x7fd0, 0x7fd1, 0x7fd2, 0x7fd3, 0x7fd6, 0x7fd7, - 0x7fd9, 0x7fda, 0x7fdb, 0x7fdc, 0x7fdd, 0x7fde, 0x7fe2, 0x7fe3, - 0x75e2, 0x7acb, 0x7c92, 0x6ca5, 0x96b6, 0x529b, 0x7483, 0x54e9, - 0x4fe9, 0x8054, 0x83b2, 0x8fde, 0x9570, 0x5ec9, 0x601c, 0x6d9f, - 0x5e18, 0x655b, 0x8138, 0x94fe, 0x604b, 0x70bc, 0x7ec3, 0x7cae, - 0x51c9, 0x6881, 0x7cb1, 0x826f, 0x4e24, 0x8f86, 0x91cf, 0x667e, - 0x4eae, 0x8c05, 0x64a9, 0x804a, 0x50da, 0x7597, 0x71ce, 0x5be5, - 0x8fbd, 0x6f66, 0x4e86, 0x6482, 0x9563, 0x5ed6, 0x6599, 0x5217, - 0x88c2, 0x70c8, 0x52a3, 0x730e, 0x7433, 0x6797, 0x78f7, 0x9716, - 0x4e34, 0x90bb, 0x9cde, 0x6dcb, 0x51db, 0x8d41, 0x541d, 0x62ce, - 0x73b2, 0x83f1, 0x96f6, 0x9f84, 0x94c3, 0x4f36, 0x7f9a, 0x51cc, - 0x7075, 0x9675, 0x5cad, 0x9886, 0x53e6, 0x4ee4, 0x6e9c, 0x7409, - 0x69b4, 0x786b, 0x998f, 0x7559, 0x5218, 0x7624, 0x6d41, 0x67f3, - 0x516d, 0x9f99, 0x804b, 0x5499, 0x7b3c, 0x7abf, - /* 0xc2 */ - 0x7fe4, 0x7fe7, 0x7fe8, 0x7fea, 0x7feb, 0x7fec, 0x7fed, 0x7fef, - 0x7ff2, 0x7ff4, 0x7ff5, 0x7ff6, 0x7ff7, 0x7ff8, 0x7ff9, 0x7ffa, - 0x7ffd, 0x7ffe, 0x7fff, 0x8002, 0x8007, 0x8008, 0x8009, 0x800a, - 0x800e, 0x800f, 0x8011, 0x8013, 0x801a, 0x801b, 0x801d, 0x801e, - 0x801f, 0x8021, 0x8023, 0x8024, 0x802b, 0x802c, 0x802d, 0x802e, - 0x802f, 0x8030, 0x8032, 0x8034, 0x8039, 0x803a, 0x803c, 0x803e, - 0x8040, 0x8041, 0x8044, 0x8045, 0x8047, 0x8048, 0x8049, 0x804e, - 0x804f, 0x8050, 0x8051, 0x8053, 0x8055, 0x8056, 0x8057, 0x8059, - 0x805b, 0x805c, 0x805d, 0x805e, 0x805f, 0x8060, 0x8061, 0x8062, - 0x8063, 0x8064, 0x8065, 0x8066, 0x8067, 0x8068, 0x806b, 0x806c, - 0x806d, 0x806e, 0x806f, 0x8070, 0x8072, 0x8073, 0x8074, 0x8075, - 0x8076, 0x8077, 0x8078, 0x8079, 0x807a, 0x807b, 0x807c, 0x807d, - 0x9686, 0x5784, 0x62e2, 0x9647, 0x697c, 0x5a04, 0x6402, 0x7bd3, - 0x6f0f, 0x964b, 0x82a6, 0x5362, 0x9885, 0x5e90, 0x7089, 0x63b3, - 0x5364, 0x864f, 0x9c81, 0x9e93, 0x788c, 0x9732, 0x8def, 0x8d42, - 0x9e7f, 0x6f5e, 0x7984, 0x5f55, 0x9646, 0x622e, 0x9a74, 0x5415, - 0x94dd, 0x4fa3, 0x65c5, 0x5c65, 0x5c61, 0x7f15, 0x8651, 0x6c2f, - 0x5f8b, 0x7387, 0x6ee4, 0x7eff, 0x5ce6, 0x631b, 0x5b6a, 0x6ee6, - 0x5375, 0x4e71, 0x63a0, 0x7565, 0x62a1, 0x8f6e, 0x4f26, 0x4ed1, - 0x6ca6, 0x7eb6, 0x8bba, 0x841d, 0x87ba, 0x7f57, 0x903b, 0x9523, - 0x7ba9, 0x9aa1, 0x88f8, 0x843d, 0x6d1b, 0x9a86, 0x7edc, 0x5988, - 0x9ebb, 0x739b, 0x7801, 0x8682, 0x9a6c, 0x9a82, 0x561b, 0x5417, - 0x57cb, 0x4e70, 0x9ea6, 0x5356, 0x8fc8, 0x8109, 0x7792, 0x9992, - 0x86ee, 0x6ee1, 0x8513, 0x66fc, 0x6162, 0x6f2b, - /* 0xc3 */ - 0x807e, 0x8081, 0x8082, 0x8085, 0x8088, 0x808a, 0x808d, 0x808e, - 0x808f, 0x8090, 0x8091, 0x8092, 0x8094, 0x8095, 0x8097, 0x8099, - 0x809e, 0x80a3, 0x80a6, 0x80a7, 0x80a8, 0x80ac, 0x80b0, 0x80b3, - 0x80b5, 0x80b6, 0x80b8, 0x80b9, 0x80bb, 0x80c5, 0x80c7, 0x80c8, - 0x80c9, 0x80ca, 0x80cb, 0x80cf, 0x80d0, 0x80d1, 0x80d2, 0x80d3, - 0x80d4, 0x80d5, 0x80d8, 0x80df, 0x80e0, 0x80e2, 0x80e3, 0x80e6, - 0x80ee, 0x80f5, 0x80f7, 0x80f9, 0x80fb, 0x80fe, 0x80ff, 0x8100, - 0x8101, 0x8103, 0x8104, 0x8105, 0x8107, 0x8108, 0x810b, 0x810c, - 0x8115, 0x8117, 0x8119, 0x811b, 0x811c, 0x811d, 0x811f, 0x8120, - 0x8121, 0x8122, 0x8123, 0x8124, 0x8125, 0x8126, 0x8127, 0x8128, - 0x8129, 0x812a, 0x812b, 0x812d, 0x812e, 0x8130, 0x8133, 0x8134, - 0x8135, 0x8137, 0x8139, 0x813a, 0x813b, 0x813c, 0x813d, 0x813f, - 0x8c29, 0x8292, 0x832b, 0x76f2, 0x6c13, 0x5fd9, 0x83bd, 0x732b, - 0x8305, 0x951a, 0x6bdb, 0x77db, 0x94c6, 0x536f, 0x8302, 0x5192, - 0x5e3d, 0x8c8c, 0x8d38, 0x4e48, 0x73ab, 0x679a, 0x6885, 0x9176, - 0x9709, 0x7164, 0x6ca1, 0x7709, 0x5a92, 0x9541, 0x6bcf, 0x7f8e, - 0x6627, 0x5bd0, 0x59b9, 0x5a9a, 0x95e8, 0x95f7, 0x4eec, 0x840c, - 0x8499, 0x6aac, 0x76df, 0x9530, 0x731b, 0x68a6, 0x5b5f, 0x772f, - 0x919a, 0x9761, 0x7cdc, 0x8ff7, 0x8c1c, 0x5f25, 0x7c73, 0x79d8, - 0x89c5, 0x6ccc, 0x871c, 0x5bc6, 0x5e42, 0x68c9, 0x7720, 0x7ef5, - 0x5195, 0x514d, 0x52c9, 0x5a29, 0x7f05, 0x9762, 0x82d7, 0x63cf, - 0x7784, 0x85d0, 0x79d2, 0x6e3a, 0x5e99, 0x5999, 0x8511, 0x706d, - 0x6c11, 0x62bf, 0x76bf, 0x654f, 0x60af, 0x95fd, 0x660e, 0x879f, - 0x9e23, 0x94ed, 0x540d, 0x547d, 0x8c2c, 0x6478, - /* 0xc4 */ - 0x8140, 0x8141, 0x8142, 0x8143, 0x8144, 0x8145, 0x8147, 0x8149, - 0x814d, 0x814e, 0x814f, 0x8152, 0x8156, 0x8157, 0x8158, 0x815b, - 0x815c, 0x815d, 0x815e, 0x815f, 0x8161, 0x8162, 0x8163, 0x8164, - 0x8166, 0x8168, 0x816a, 0x816b, 0x816c, 0x816f, 0x8172, 0x8173, - 0x8175, 0x8176, 0x8177, 0x8178, 0x8181, 0x8183, 0x8184, 0x8185, - 0x8186, 0x8187, 0x8189, 0x818b, 0x818c, 0x818d, 0x818e, 0x8190, - 0x8192, 0x8193, 0x8194, 0x8195, 0x8196, 0x8197, 0x8199, 0x819a, - 0x819e, 0x819f, 0x81a0, 0x81a1, 0x81a2, 0x81a4, 0x81a5, 0x81a7, - 0x81a9, 0x81ab, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, - 0x81b2, 0x81b4, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0x81bc, - 0x81bd, 0x81be, 0x81bf, 0x81c4, 0x81c5, 0x81c7, 0x81c8, 0x81c9, - 0x81cb, 0x81cd, 0x81ce, 0x81cf, 0x81d0, 0x81d1, 0x81d2, 0x81d3, - 0x6479, 0x8611, 0x6a21, 0x819c, 0x78e8, 0x6469, 0x9b54, 0x62b9, - 0x672b, 0x83ab, 0x58a8, 0x9ed8, 0x6cab, 0x6f20, 0x5bde, 0x964c, - 0x8c0b, 0x725f, 0x67d0, 0x62c7, 0x7261, 0x4ea9, 0x59c6, 0x6bcd, - 0x5893, 0x66ae, 0x5e55, 0x52df, 0x6155, 0x6728, 0x76ee, 0x7766, - 0x7267, 0x7a46, 0x62ff, 0x54ea, 0x5450, 0x94a0, 0x90a3, 0x5a1c, - 0x7eb3, 0x6c16, 0x4e43, 0x5976, 0x8010, 0x5948, 0x5357, 0x7537, - 0x96be, 0x56ca, 0x6320, 0x8111, 0x607c, 0x95f9, 0x6dd6, 0x5462, - 0x9981, 0x5185, 0x5ae9, 0x80fd, 0x59ae, 0x9713, 0x502a, 0x6ce5, - 0x5c3c, 0x62df, 0x4f60, 0x533f, 0x817b, 0x9006, 0x6eba, 0x852b, - 0x62c8, 0x5e74, 0x78be, 0x64b5, 0x637b, 0x5ff5, 0x5a18, 0x917f, - 0x9e1f, 0x5c3f, 0x634f, 0x8042, 0x5b7d, 0x556e, 0x954a, 0x954d, - 0x6d85, 0x60a8, 0x67e0, 0x72de, 0x51dd, 0x5b81, - /* 0xc5 */ - 0x81d4, 0x81d5, 0x81d6, 0x81d7, 0x81d8, 0x81d9, 0x81da, 0x81db, - 0x81dc, 0x81dd, 0x81de, 0x81df, 0x81e0, 0x81e1, 0x81e2, 0x81e4, - 0x81e5, 0x81e6, 0x81e8, 0x81e9, 0x81eb, 0x81ee, 0x81ef, 0x81f0, - 0x81f1, 0x81f2, 0x81f5, 0x81f6, 0x81f7, 0x81f8, 0x81f9, 0x81fa, - 0x81fd, 0x81ff, 0x8203, 0x8207, 0x8208, 0x8209, 0x820a, 0x820b, - 0x820e, 0x820f, 0x8211, 0x8213, 0x8215, 0x8216, 0x8217, 0x8218, - 0x8219, 0x821a, 0x821d, 0x8220, 0x8224, 0x8225, 0x8226, 0x8227, - 0x8229, 0x822e, 0x8232, 0x823a, 0x823c, 0x823d, 0x823f, 0x8240, - 0x8241, 0x8242, 0x8243, 0x8245, 0x8246, 0x8248, 0x824a, 0x824c, - 0x824d, 0x824e, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, - 0x8256, 0x8257, 0x8259, 0x825b, 0x825c, 0x825d, 0x825e, 0x8260, - 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8269, - 0x62e7, 0x6cde, 0x725b, 0x626d, 0x94ae, 0x7ebd, 0x8113, 0x6d53, - 0x519c, 0x5f04, 0x5974, 0x52aa, 0x6012, 0x5973, 0x6696, 0x8650, - 0x759f, 0x632a, 0x61e6, 0x7cef, 0x8bfa, 0x54e6, 0x6b27, 0x9e25, - 0x6bb4, 0x85d5, 0x5455, 0x5076, 0x6ca4, 0x556a, 0x8db4, 0x722c, - 0x5e15, 0x6015, 0x7436, 0x62cd, 0x6392, 0x724c, 0x5f98, 0x6e43, - 0x6d3e, 0x6500, 0x6f58, 0x76d8, 0x78d0, 0x76fc, 0x7554, 0x5224, - 0x53db, 0x4e53, 0x5e9e, 0x65c1, 0x802a, 0x80d6, 0x629b, 0x5486, - 0x5228, 0x70ae, 0x888d, 0x8dd1, 0x6ce1, 0x5478, 0x80da, 0x57f9, - 0x88f4, 0x8d54, 0x966a, 0x914d, 0x4f69, 0x6c9b, 0x55b7, 0x76c6, - 0x7830, 0x62a8, 0x70f9, 0x6f8e, 0x5f6d, 0x84ec, 0x68da, 0x787c, - 0x7bf7, 0x81a8, 0x670b, 0x9e4f, 0x6367, 0x78b0, 0x576f, 0x7812, - 0x9739, 0x6279, 0x62ab, 0x5288, 0x7435, 0x6bd7, - /* 0xc6 */ - 0x826a, 0x826b, 0x826c, 0x826d, 0x8271, 0x8275, 0x8276, 0x8277, - 0x8278, 0x827b, 0x827c, 0x8280, 0x8281, 0x8283, 0x8285, 0x8286, - 0x8287, 0x8289, 0x828c, 0x8290, 0x8293, 0x8294, 0x8295, 0x8296, - 0x829a, 0x829b, 0x829e, 0x82a0, 0x82a2, 0x82a3, 0x82a7, 0x82b2, - 0x82b5, 0x82b6, 0x82ba, 0x82bb, 0x82bc, 0x82bf, 0x82c0, 0x82c2, - 0x82c3, 0x82c5, 0x82c6, 0x82c9, 0x82d0, 0x82d6, 0x82d9, 0x82da, - 0x82dd, 0x82e2, 0x82e7, 0x82e8, 0x82e9, 0x82ea, 0x82ec, 0x82ed, - 0x82ee, 0x82f0, 0x82f2, 0x82f3, 0x82f5, 0x82f6, 0x82f8, 0x82fa, - 0x82fc, 0x82fd, 0x82fe, 0x82ff, 0x8300, 0x830a, 0x830b, 0x830d, - 0x8310, 0x8312, 0x8313, 0x8316, 0x8318, 0x8319, 0x831d, 0x831e, - 0x831f, 0x8320, 0x8321, 0x8322, 0x8323, 0x8324, 0x8325, 0x8326, - 0x8329, 0x832a, 0x832e, 0x8330, 0x8332, 0x8337, 0x833b, 0x833d, - 0x5564, 0x813e, 0x75b2, 0x76ae, 0x5339, 0x75de, 0x50fb, 0x5c41, - 0x8b6c, 0x7bc7, 0x504f, 0x7247, 0x9a97, 0x98d8, 0x6f02, 0x74e2, - 0x7968, 0x6487, 0x77a5, 0x62fc, 0x9891, 0x8d2b, 0x54c1, 0x8058, - 0x4e52, 0x576a, 0x82f9, 0x840d, 0x5e73, 0x51ed, 0x74f6, 0x8bc4, - 0x5c4f, 0x5761, 0x6cfc, 0x9887, 0x5a46, 0x7834, 0x9b44, 0x8feb, - 0x7c95, 0x5256, 0x6251, 0x94fa, 0x4ec6, 0x8386, 0x8461, 0x83e9, - 0x84b2, 0x57d4, 0x6734, 0x5703, 0x666e, 0x6d66, 0x8c31, 0x66dd, - 0x7011, 0x671f, 0x6b3a, 0x6816, 0x621a, 0x59bb, 0x4e03, 0x51c4, - 0x6f06, 0x67d2, 0x6c8f, 0x5176, 0x68cb, 0x5947, 0x6b67, 0x7566, - 0x5d0e, 0x8110, 0x9f50, 0x65d7, 0x7948, 0x7941, 0x9a91, 0x8d77, - 0x5c82, 0x4e5e, 0x4f01, 0x542f, 0x5951, 0x780c, 0x5668, 0x6c14, - 0x8fc4, 0x5f03, 0x6c7d, 0x6ce3, 0x8bab, 0x6390, - /* 0xc7 */ - 0x833e, 0x833f, 0x8341, 0x8342, 0x8344, 0x8345, 0x8348, 0x834a, - 0x834b, 0x834c, 0x834d, 0x834e, 0x8353, 0x8355, 0x8356, 0x8357, - 0x8358, 0x8359, 0x835d, 0x8362, 0x8370, 0x8371, 0x8372, 0x8373, - 0x8374, 0x8375, 0x8376, 0x8379, 0x837a, 0x837e, 0x837f, 0x8380, - 0x8381, 0x8382, 0x8383, 0x8384, 0x8387, 0x8388, 0x838a, 0x838b, - 0x838c, 0x838d, 0x838f, 0x8390, 0x8391, 0x8394, 0x8395, 0x8396, - 0x8397, 0x8399, 0x839a, 0x839d, 0x839f, 0x83a1, 0x83a2, 0x83a3, - 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83ac, 0x83ad, 0x83ae, 0x83af, - 0x83b5, 0x83bb, 0x83be, 0x83bf, 0x83c2, 0x83c3, 0x83c4, 0x83c6, - 0x83c8, 0x83c9, 0x83cb, 0x83cd, 0x83ce, 0x83d0, 0x83d1, 0x83d2, - 0x83d3, 0x83d5, 0x83d7, 0x83d9, 0x83da, 0x83db, 0x83de, 0x83e2, - 0x83e3, 0x83e4, 0x83e6, 0x83e7, 0x83e8, 0x83eb, 0x83ec, 0x83ed, - 0x6070, 0x6d3d, 0x7275, 0x6266, 0x948e, 0x94c5, 0x5343, 0x8fc1, - 0x7b7e, 0x4edf, 0x8c26, 0x4e7e, 0x9ed4, 0x94b1, 0x94b3, 0x524d, - 0x6f5c, 0x9063, 0x6d45, 0x8c34, 0x5811, 0x5d4c, 0x6b20, 0x6b49, - 0x67aa, 0x545b, 0x8154, 0x7f8c, 0x5899, 0x8537, 0x5f3a, 0x62a2, - 0x6a47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77a7, 0x4e54, 0x4fa8, - 0x5de7, 0x9798, 0x64ac, 0x7fd8, 0x5ced, 0x4fcf, 0x7a8d, 0x5207, - 0x8304, 0x4e14, 0x602f, 0x7a83, 0x94a6, 0x4fb5, 0x4eb2, 0x79e6, - 0x7434, 0x52e4, 0x82b9, 0x64d2, 0x79bd, 0x5bdd, 0x6c81, 0x9752, - 0x8f7b, 0x6c22, 0x503e, 0x537f, 0x6e05, 0x64ce, 0x6674, 0x6c30, - 0x60c5, 0x9877, 0x8bf7, 0x5e86, 0x743c, 0x7a77, 0x79cb, 0x4e18, - 0x90b1, 0x7403, 0x6c42, 0x56da, 0x914b, 0x6cc5, 0x8d8b, 0x533a, - 0x86c6, 0x66f2, 0x8eaf, 0x5c48, 0x9a71, 0x6e20, - /* 0xc8 */ - 0x83ee, 0x83ef, 0x83f3, 0x83f4, 0x83f5, 0x83f6, 0x83f7, 0x83fa, - 0x83fb, 0x83fc, 0x83fe, 0x83ff, 0x8400, 0x8402, 0x8405, 0x8407, - 0x8408, 0x8409, 0x840a, 0x8410, 0x8412, 0x8413, 0x8414, 0x8415, - 0x8416, 0x8417, 0x8419, 0x841a, 0x841b, 0x841e, 0x841f, 0x8420, - 0x8421, 0x8422, 0x8423, 0x8429, 0x842a, 0x842b, 0x842c, 0x842d, - 0x842e, 0x842f, 0x8430, 0x8432, 0x8433, 0x8434, 0x8435, 0x8436, - 0x8437, 0x8439, 0x843a, 0x843b, 0x843e, 0x843f, 0x8440, 0x8441, - 0x8442, 0x8443, 0x8444, 0x8445, 0x8447, 0x8448, 0x8449, 0x844a, - 0x844b, 0x844c, 0x844d, 0x844e, 0x844f, 0x8450, 0x8452, 0x8453, - 0x8454, 0x8455, 0x8456, 0x8458, 0x845d, 0x845e, 0x845f, 0x8460, - 0x8462, 0x8464, 0x8465, 0x8466, 0x8467, 0x8468, 0x846a, 0x846e, - 0x846f, 0x8470, 0x8472, 0x8474, 0x8477, 0x8479, 0x847b, 0x847c, - 0x53d6, 0x5a36, 0x9f8b, 0x8da3, 0x53bb, 0x5708, 0x98a7, 0x6743, - 0x919b, 0x6cc9, 0x5168, 0x75ca, 0x62f3, 0x72ac, 0x5238, 0x529d, - 0x7f3a, 0x7094, 0x7638, 0x5374, 0x9e4a, 0x69b7, 0x786e, 0x96c0, - 0x88d9, 0x7fa4, 0x7136, 0x71c3, 0x5189, 0x67d3, 0x74e4, 0x58e4, - 0x6518, 0x56b7, 0x8ba9, 0x9976, 0x6270, 0x7ed5, 0x60f9, 0x70ed, - 0x58ec, 0x4ec1, 0x4eba, 0x5fcd, 0x97e7, 0x4efb, 0x8ba4, 0x5203, - 0x598a, 0x7eab, 0x6254, 0x4ecd, 0x65e5, 0x620e, 0x8338, 0x84c9, - 0x8363, 0x878d, 0x7194, 0x6eb6, 0x5bb9, 0x7ed2, 0x5197, 0x63c9, - 0x67d4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5b7a, 0x5982, 0x8fb1, - 0x4e73, 0x6c5d, 0x5165, 0x8925, 0x8f6f, 0x962e, 0x854a, 0x745e, - 0x9510, 0x95f0, 0x6da6, 0x82e5, 0x5f31, 0x6492, 0x6d12, 0x8428, - 0x816e, 0x9cc3, 0x585e, 0x8d5b, 0x4e09, 0x53c1, - /* 0xc9 */ - 0x847d, 0x847e, 0x847f, 0x8480, 0x8481, 0x8483, 0x8484, 0x8485, - 0x8486, 0x848a, 0x848d, 0x848f, 0x8490, 0x8491, 0x8492, 0x8493, - 0x8494, 0x8495, 0x8496, 0x8498, 0x849a, 0x849b, 0x849d, 0x849e, - 0x849f, 0x84a0, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, - 0x84a8, 0x84a9, 0x84aa, 0x84ab, 0x84ac, 0x84ad, 0x84ae, 0x84b0, - 0x84b1, 0x84b3, 0x84b5, 0x84b6, 0x84b7, 0x84bb, 0x84bc, 0x84be, - 0x84c0, 0x84c2, 0x84c3, 0x84c5, 0x84c6, 0x84c7, 0x84c8, 0x84cb, - 0x84cc, 0x84ce, 0x84cf, 0x84d2, 0x84d4, 0x84d5, 0x84d7, 0x84d8, - 0x84d9, 0x84da, 0x84db, 0x84dc, 0x84de, 0x84e1, 0x84e2, 0x84e4, - 0x84e7, 0x84e8, 0x84e9, 0x84ea, 0x84eb, 0x84ed, 0x84ee, 0x84ef, - 0x84f1, 0x84f2, 0x84f3, 0x84f4, 0x84f5, 0x84f6, 0x84f7, 0x84f8, - 0x84f9, 0x84fa, 0x84fb, 0x84fd, 0x84fe, 0x8500, 0x8501, 0x8502, - 0x4f1e, 0x6563, 0x6851, 0x55d3, 0x4e27, 0x6414, 0x9a9a, 0x626b, - 0x5ac2, 0x745f, 0x8272, 0x6da9, 0x68ee, 0x50e7, 0x838e, 0x7802, - 0x6740, 0x5239, 0x6c99, 0x7eb1, 0x50bb, 0x5565, 0x715e, 0x7b5b, - 0x6652, 0x73ca, 0x82eb, 0x6749, 0x5c71, 0x5220, 0x717d, 0x886b, - 0x95ea, 0x9655, 0x64c5, 0x8d61, 0x81b3, 0x5584, 0x6c55, 0x6247, - 0x7f2e, 0x5892, 0x4f24, 0x5546, 0x8d4f, 0x664c, 0x4e0a, 0x5c1a, - 0x88f3, 0x68a2, 0x634e, 0x7a0d, 0x70e7, 0x828d, 0x52fa, 0x97f6, - 0x5c11, 0x54e8, 0x90b5, 0x7ecd, 0x5962, 0x8d4a, 0x86c7, 0x820c, - 0x820d, 0x8d66, 0x6444, 0x5c04, 0x6151, 0x6d89, 0x793e, 0x8bbe, - 0x7837, 0x7533, 0x547b, 0x4f38, 0x8eab, 0x6df1, 0x5a20, 0x7ec5, - 0x795e, 0x6c88, 0x5ba1, 0x5a76, 0x751a, 0x80be, 0x614e, 0x6e17, - 0x58f0, 0x751f, 0x7525, 0x7272, 0x5347, 0x7ef3, - /* 0xca */ - 0x8503, 0x8504, 0x8505, 0x8506, 0x8507, 0x8508, 0x8509, 0x850a, - 0x850b, 0x850d, 0x850e, 0x850f, 0x8510, 0x8512, 0x8514, 0x8515, - 0x8516, 0x8518, 0x8519, 0x851b, 0x851c, 0x851d, 0x851e, 0x8520, - 0x8522, 0x8523, 0x8524, 0x8525, 0x8526, 0x8527, 0x8528, 0x8529, - 0x852a, 0x852d, 0x852e, 0x852f, 0x8530, 0x8531, 0x8532, 0x8533, - 0x8534, 0x8535, 0x8536, 0x853e, 0x853f, 0x8540, 0x8541, 0x8542, - 0x8544, 0x8545, 0x8546, 0x8547, 0x854b, 0x854c, 0x854d, 0x854e, - 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, 0x8557, - 0x8558, 0x855a, 0x855b, 0x855c, 0x855d, 0x855f, 0x8560, 0x8561, - 0x8562, 0x8563, 0x8565, 0x8566, 0x8567, 0x8569, 0x856a, 0x856b, - 0x856c, 0x856d, 0x856e, 0x856f, 0x8570, 0x8571, 0x8573, 0x8575, - 0x8576, 0x8577, 0x8578, 0x857c, 0x857d, 0x857f, 0x8580, 0x8581, - 0x7701, 0x76db, 0x5269, 0x80dc, 0x5723, 0x5e08, 0x5931, 0x72ee, - 0x65bd, 0x6e7f, 0x8bd7, 0x5c38, 0x8671, 0x5341, 0x77f3, 0x62fe, - 0x65f6, 0x4ec0, 0x98df, 0x8680, 0x5b9e, 0x8bc6, 0x53f2, 0x77e2, - 0x4f7f, 0x5c4e, 0x9a76, 0x59cb, 0x5f0f, 0x793a, 0x58eb, 0x4e16, - 0x67ff, 0x4e8b, 0x62ed, 0x8a93, 0x901d, 0x52bf, 0x662f, 0x55dc, - 0x566c, 0x9002, 0x4ed5, 0x4f8d, 0x91ca, 0x9970, 0x6c0f, 0x5e02, - 0x6043, 0x5ba4, 0x89c6, 0x8bd5, 0x6536, 0x624b, 0x9996, 0x5b88, - 0x5bff, 0x6388, 0x552e, 0x53d7, 0x7626, 0x517d, 0x852c, 0x67a2, - 0x68b3, 0x6b8a, 0x6292, 0x8f93, 0x53d4, 0x8212, 0x6dd1, 0x758f, - 0x4e66, 0x8d4e, 0x5b70, 0x719f, 0x85af, 0x6691, 0x66d9, 0x7f72, - 0x8700, 0x9ecd, 0x9f20, 0x5c5e, 0x672f, 0x8ff0, 0x6811, 0x675f, - 0x620d, 0x7ad6, 0x5885, 0x5eb6, 0x6570, 0x6f31, - /* 0xcb */ - 0x8582, 0x8583, 0x8586, 0x8588, 0x8589, 0x858a, 0x858b, 0x858c, - 0x858d, 0x858e, 0x8590, 0x8591, 0x8592, 0x8593, 0x8594, 0x8595, - 0x8596, 0x8597, 0x8598, 0x8599, 0x859a, 0x859d, 0x859e, 0x859f, - 0x85a0, 0x85a1, 0x85a2, 0x85a3, 0x85a5, 0x85a6, 0x85a7, 0x85a9, - 0x85ab, 0x85ac, 0x85ad, 0x85b1, 0x85b2, 0x85b3, 0x85b4, 0x85b5, - 0x85b6, 0x85b8, 0x85ba, 0x85bb, 0x85bc, 0x85bd, 0x85be, 0x85bf, - 0x85c0, 0x85c2, 0x85c3, 0x85c4, 0x85c5, 0x85c6, 0x85c7, 0x85c8, - 0x85ca, 0x85cb, 0x85cc, 0x85cd, 0x85ce, 0x85d1, 0x85d2, 0x85d4, - 0x85d6, 0x85d7, 0x85d8, 0x85d9, 0x85da, 0x85db, 0x85dd, 0x85de, - 0x85df, 0x85e0, 0x85e1, 0x85e2, 0x85e3, 0x85e5, 0x85e6, 0x85e7, - 0x85e8, 0x85ea, 0x85eb, 0x85ec, 0x85ed, 0x85ee, 0x85ef, 0x85f0, - 0x85f1, 0x85f2, 0x85f3, 0x85f4, 0x85f5, 0x85f6, 0x85f7, 0x85f8, - 0x6055, 0x5237, 0x800d, 0x6454, 0x8870, 0x7529, 0x5e05, 0x6813, - 0x62f4, 0x971c, 0x53cc, 0x723d, 0x8c01, 0x6c34, 0x7761, 0x7a0e, - 0x542e, 0x77ac, 0x987a, 0x821c, 0x8bf4, 0x7855, 0x6714, 0x70c1, - 0x65af, 0x6495, 0x5636, 0x601d, 0x79c1, 0x53f8, 0x4e1d, 0x6b7b, - 0x8086, 0x5bfa, 0x55e3, 0x56db, 0x4f3a, 0x4f3c, 0x9972, 0x5df3, - 0x677e, 0x8038, 0x6002, 0x9882, 0x9001, 0x5b8b, 0x8bbc, 0x8bf5, - 0x641c, 0x8258, 0x64de, 0x55fd, 0x82cf, 0x9165, 0x4fd7, 0x7d20, - 0x901f, 0x7c9f, 0x50f3, 0x5851, 0x6eaf, 0x5bbf, 0x8bc9, 0x8083, - 0x9178, 0x849c, 0x7b97, 0x867d, 0x968b, 0x968f, 0x7ee5, 0x9ad3, - 0x788e, 0x5c81, 0x7a57, 0x9042, 0x96a7, 0x795f, 0x5b59, 0x635f, - 0x7b0b, 0x84d1, 0x68ad, 0x5506, 0x7f29, 0x7410, 0x7d22, 0x9501, - 0x6240, 0x584c, 0x4ed6, 0x5b83, 0x5979, 0x5854, - /* 0xcc */ - 0x85f9, 0x85fa, 0x85fc, 0x85fd, 0x85fe, 0x8600, 0x8601, 0x8602, - 0x8603, 0x8604, 0x8606, 0x8607, 0x8608, 0x8609, 0x860a, 0x860b, - 0x860c, 0x860d, 0x860e, 0x860f, 0x8610, 0x8612, 0x8613, 0x8614, - 0x8615, 0x8617, 0x8618, 0x8619, 0x861a, 0x861b, 0x861c, 0x861d, - 0x861e, 0x861f, 0x8620, 0x8621, 0x8622, 0x8623, 0x8624, 0x8625, - 0x8626, 0x8628, 0x862a, 0x862b, 0x862c, 0x862d, 0x862e, 0x862f, - 0x8630, 0x8631, 0x8632, 0x8633, 0x8634, 0x8635, 0x8636, 0x8637, - 0x8639, 0x863a, 0x863b, 0x863d, 0x863e, 0x863f, 0x8640, 0x8641, - 0x8642, 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, 0x8649, - 0x864a, 0x864b, 0x864c, 0x8652, 0x8653, 0x8655, 0x8656, 0x8657, - 0x8658, 0x8659, 0x865b, 0x865c, 0x865d, 0x865f, 0x8660, 0x8661, - 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, 0x866a, - 0x736d, 0x631e, 0x8e4b, 0x8e0f, 0x80ce, 0x82d4, 0x62ac, 0x53f0, - 0x6cf0, 0x915e, 0x592a, 0x6001, 0x6c70, 0x574d, 0x644a, 0x8d2a, - 0x762b, 0x6ee9, 0x575b, 0x6a80, 0x75f0, 0x6f6d, 0x8c2d, 0x8c08, - 0x5766, 0x6bef, 0x8892, 0x78b3, 0x63a2, 0x53f9, 0x70ad, 0x6c64, - 0x5858, 0x642a, 0x5802, 0x68e0, 0x819b, 0x5510, 0x7cd6, 0x5018, - 0x8eba, 0x6dcc, 0x8d9f, 0x70eb, 0x638f, 0x6d9b, 0x6ed4, 0x7ee6, - 0x8404, 0x6843, 0x9003, 0x6dd8, 0x9676, 0x8ba8, 0x5957, 0x7279, - 0x85e4, 0x817e, 0x75bc, 0x8a8a, 0x68af, 0x5254, 0x8e22, 0x9511, - 0x63d0, 0x9898, 0x8e44, 0x557c, 0x4f53, 0x66ff, 0x568f, 0x60d5, - 0x6d95, 0x5243, 0x5c49, 0x5929, 0x6dfb, 0x586b, 0x7530, 0x751c, - 0x606c, 0x8214, 0x8146, 0x6311, 0x6761, 0x8fe2, 0x773a, 0x8df3, - 0x8d34, 0x94c1, 0x5e16, 0x5385, 0x542c, 0x70c3, - /* 0xcd */ - 0x866d, 0x866f, 0x8670, 0x8672, 0x8673, 0x8674, 0x8675, 0x8676, - 0x8677, 0x8678, 0x8683, 0x8684, 0x8685, 0x8686, 0x8687, 0x8688, - 0x8689, 0x868e, 0x868f, 0x8690, 0x8691, 0x8692, 0x8694, 0x8696, - 0x8697, 0x8698, 0x8699, 0x869a, 0x869b, 0x869e, 0x869f, 0x86a0, - 0x86a1, 0x86a2, 0x86a5, 0x86a6, 0x86ab, 0x86ad, 0x86ae, 0x86b2, - 0x86b3, 0x86b7, 0x86b8, 0x86b9, 0x86bb, 0x86bc, 0x86bd, 0x86be, - 0x86bf, 0x86c1, 0x86c2, 0x86c3, 0x86c5, 0x86c8, 0x86cc, 0x86cd, - 0x86d2, 0x86d3, 0x86d5, 0x86d6, 0x86d7, 0x86da, 0x86dc, 0x86dd, - 0x86e0, 0x86e1, 0x86e2, 0x86e3, 0x86e5, 0x86e6, 0x86e7, 0x86e8, - 0x86ea, 0x86eb, 0x86ec, 0x86ef, 0x86f5, 0x86f6, 0x86f7, 0x86fa, - 0x86fb, 0x86fc, 0x86fd, 0x86ff, 0x8701, 0x8704, 0x8705, 0x8706, - 0x870b, 0x870c, 0x870e, 0x870f, 0x8710, 0x8711, 0x8714, 0x8716, - 0x6c40, 0x5ef7, 0x505c, 0x4ead, 0x5ead, 0x633a, 0x8247, 0x901a, - 0x6850, 0x916e, 0x77b3, 0x540c, 0x94dc, 0x5f64, 0x7ae5, 0x6876, - 0x6345, 0x7b52, 0x7edf, 0x75db, 0x5077, 0x6295, 0x5934, 0x900f, - 0x51f8, 0x79c3, 0x7a81, 0x56fe, 0x5f92, 0x9014, 0x6d82, 0x5c60, - 0x571f, 0x5410, 0x5154, 0x6e4d, 0x56e2, 0x63a8, 0x9893, 0x817f, - 0x8715, 0x892a, 0x9000, 0x541e, 0x5c6f, 0x81c0, 0x62d6, 0x6258, - 0x8131, 0x9e35, 0x9640, 0x9a6e, 0x9a7c, 0x692d, 0x59a5, 0x62d3, - 0x553e, 0x6316, 0x54c7, 0x86d9, 0x6d3c, 0x5a03, 0x74e6, 0x889c, - 0x6b6a, 0x5916, 0x8c4c, 0x5f2f, 0x6e7e, 0x73a9, 0x987d, 0x4e38, - 0x70f7, 0x5b8c, 0x7897, 0x633d, 0x665a, 0x7696, 0x60cb, 0x5b9b, - 0x5a49, 0x4e07, 0x8155, 0x6c6a, 0x738b, 0x4ea1, 0x6789, 0x7f51, - 0x5f80, 0x65fa, 0x671b, 0x5fd8, 0x5984, 0x5a01, - /* 0xce */ - 0x8719, 0x871b, 0x871d, 0x871f, 0x8720, 0x8724, 0x8726, 0x8727, - 0x8728, 0x872a, 0x872b, 0x872c, 0x872d, 0x872f, 0x8730, 0x8732, - 0x8733, 0x8735, 0x8736, 0x8738, 0x8739, 0x873a, 0x873c, 0x873d, - 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, 0x8746, 0x874a, - 0x874b, 0x874d, 0x874f, 0x8750, 0x8751, 0x8752, 0x8754, 0x8755, - 0x8756, 0x8758, 0x875a, 0x875b, 0x875c, 0x875d, 0x875e, 0x875f, - 0x8761, 0x8762, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, - 0x876c, 0x876d, 0x876f, 0x8771, 0x8772, 0x8773, 0x8775, 0x8777, - 0x8778, 0x8779, 0x877a, 0x877f, 0x8780, 0x8781, 0x8784, 0x8786, - 0x8787, 0x8789, 0x878a, 0x878c, 0x878e, 0x878f, 0x8790, 0x8791, - 0x8792, 0x8794, 0x8795, 0x8796, 0x8798, 0x8799, 0x879a, 0x879b, - 0x879c, 0x879d, 0x879e, 0x87a0, 0x87a1, 0x87a2, 0x87a3, 0x87a4, - 0x5dcd, 0x5fae, 0x5371, 0x97e6, 0x8fdd, 0x6845, 0x56f4, 0x552f, - 0x60df, 0x4e3a, 0x6f4d, 0x7ef4, 0x82c7, 0x840e, 0x59d4, 0x4f1f, - 0x4f2a, 0x5c3e, 0x7eac, 0x672a, 0x851a, 0x5473, 0x754f, 0x80c3, - 0x5582, 0x9b4f, 0x4f4d, 0x6e2d, 0x8c13, 0x5c09, 0x6170, 0x536b, - 0x761f, 0x6e29, 0x868a, 0x6587, 0x95fb, 0x7eb9, 0x543b, 0x7a33, - 0x7d0a, 0x95ee, 0x55e1, 0x7fc1, 0x74ee, 0x631d, 0x8717, 0x6da1, - 0x7a9d, 0x6211, 0x65a1, 0x5367, 0x63e1, 0x6c83, 0x5deb, 0x545c, - 0x94a8, 0x4e4c, 0x6c61, 0x8bec, 0x5c4b, 0x65e0, 0x829c, 0x68a7, - 0x543e, 0x5434, 0x6bcb, 0x6b66, 0x4e94, 0x6342, 0x5348, 0x821e, - 0x4f0d, 0x4fae, 0x575e, 0x620a, 0x96fe, 0x6664, 0x7269, 0x52ff, - 0x52a1, 0x609f, 0x8bef, 0x6614, 0x7199, 0x6790, 0x897f, 0x7852, - 0x77fd, 0x6670, 0x563b, 0x5438, 0x9521, 0x727a, - /* 0xcf */ - 0x87a5, 0x87a6, 0x87a7, 0x87a9, 0x87aa, 0x87ae, 0x87b0, 0x87b1, - 0x87b2, 0x87b4, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87bb, 0x87bc, - 0x87be, 0x87bf, 0x87c1, 0x87c2, 0x87c3, 0x87c4, 0x87c5, 0x87c7, - 0x87c8, 0x87c9, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d4, - 0x87d5, 0x87d6, 0x87d7, 0x87d8, 0x87d9, 0x87da, 0x87dc, 0x87dd, - 0x87de, 0x87df, 0x87e1, 0x87e2, 0x87e3, 0x87e4, 0x87e6, 0x87e7, - 0x87e8, 0x87e9, 0x87eb, 0x87ec, 0x87ed, 0x87ef, 0x87f0, 0x87f1, - 0x87f2, 0x87f3, 0x87f4, 0x87f5, 0x87f6, 0x87f7, 0x87f8, 0x87fa, - 0x87fb, 0x87fc, 0x87fd, 0x87ff, 0x8800, 0x8801, 0x8802, 0x8804, - 0x8805, 0x8806, 0x8807, 0x8808, 0x8809, 0x880b, 0x880c, 0x880d, - 0x880e, 0x880f, 0x8810, 0x8811, 0x8812, 0x8814, 0x8817, 0x8818, - 0x8819, 0x881a, 0x881c, 0x881d, 0x881e, 0x881f, 0x8820, 0x8823, - 0x7a00, 0x606f, 0x5e0c, 0x6089, 0x819d, 0x5915, 0x60dc, 0x7184, - 0x70ef, 0x6eaa, 0x6c50, 0x7280, 0x6a84, 0x88ad, 0x5e2d, 0x4e60, - 0x5ab3, 0x559c, 0x94e3, 0x6d17, 0x7cfb, 0x9699, 0x620f, 0x7ec6, - 0x778e, 0x867e, 0x5323, 0x971e, 0x8f96, 0x6687, 0x5ce1, 0x4fa0, - 0x72ed, 0x4e0b, 0x53a6, 0x590f, 0x5413, 0x6380, 0x9528, 0x5148, - 0x4ed9, 0x9c9c, 0x7ea4, 0x54b8, 0x8d24, 0x8854, 0x8237, 0x95f2, - 0x6d8e, 0x5f26, 0x5acc, 0x663e, 0x9669, 0x73b0, 0x732e, 0x53bf, - 0x817a, 0x9985, 0x7fa1, 0x5baa, 0x9677, 0x9650, 0x7ebf, 0x76f8, - 0x53a2, 0x9576, 0x9999, 0x7bb1, 0x8944, 0x6e58, 0x4e61, 0x7fd4, - 0x7965, 0x8be6, 0x60f3, 0x54cd, 0x4eab, 0x9879, 0x5df7, 0x6a61, - 0x50cf, 0x5411, 0x8c61, 0x8427, 0x785d, 0x9704, 0x524a, 0x54ee, - 0x56a3, 0x9500, 0x6d88, 0x5bb5, 0x6dc6, 0x6653, - /* 0xd0 */ - 0x8824, 0x8825, 0x8826, 0x8827, 0x8828, 0x8829, 0x882a, 0x882b, - 0x882c, 0x882d, 0x882e, 0x882f, 0x8830, 0x8831, 0x8833, 0x8834, - 0x8835, 0x8836, 0x8837, 0x8838, 0x883a, 0x883b, 0x883d, 0x883e, - 0x883f, 0x8841, 0x8842, 0x8843, 0x8846, 0x8847, 0x8848, 0x8849, - 0x884a, 0x884b, 0x884e, 0x884f, 0x8850, 0x8851, 0x8852, 0x8853, - 0x8855, 0x8856, 0x8858, 0x885a, 0x885b, 0x885c, 0x885d, 0x885e, - 0x885f, 0x8860, 0x8866, 0x8867, 0x886a, 0x886d, 0x886f, 0x8871, - 0x8873, 0x8874, 0x8875, 0x8876, 0x8878, 0x8879, 0x887a, 0x887b, - 0x887c, 0x8880, 0x8883, 0x8886, 0x8887, 0x8889, 0x888a, 0x888c, - 0x888e, 0x888f, 0x8890, 0x8891, 0x8893, 0x8894, 0x8895, 0x8897, - 0x8898, 0x8899, 0x889a, 0x889b, 0x889d, 0x889e, 0x889f, 0x88a0, - 0x88a1, 0x88a3, 0x88a5, 0x88a6, 0x88a7, 0x88a8, 0x88a9, 0x88aa, - 0x5c0f, 0x5b5d, 0x6821, 0x8096, 0x5578, 0x7b11, 0x6548, 0x6954, - 0x4e9b, 0x6b47, 0x874e, 0x978b, 0x534f, 0x631f, 0x643a, 0x90aa, - 0x659c, 0x80c1, 0x8c10, 0x5199, 0x68b0, 0x5378, 0x87f9, 0x61c8, - 0x6cc4, 0x6cfb, 0x8c22, 0x5c51, 0x85aa, 0x82af, 0x950c, 0x6b23, - 0x8f9b, 0x65b0, 0x5ffb, 0x5fc3, 0x4fe1, 0x8845, 0x661f, 0x8165, - 0x7329, 0x60fa, 0x5174, 0x5211, 0x578b, 0x5f62, 0x90a2, 0x884c, - 0x9192, 0x5e78, 0x674f, 0x6027, 0x59d3, 0x5144, 0x51f6, 0x80f8, - 0x5308, 0x6c79, 0x96c4, 0x718a, 0x4f11, 0x4fee, 0x7f9e, 0x673d, - 0x55c5, 0x9508, 0x79c0, 0x8896, 0x7ee3, 0x589f, 0x620c, 0x9700, - 0x865a, 0x5618, 0x987b, 0x5f90, 0x8bb8, 0x84c4, 0x9157, 0x53d9, - 0x65ed, 0x5e8f, 0x755c, 0x6064, 0x7d6e, 0x5a7f, 0x7eea, 0x7eed, - 0x8f69, 0x55a7, 0x5ba3, 0x60ac, 0x65cb, 0x7384, - /* 0xd1 */ - 0x88ac, 0x88ae, 0x88af, 0x88b0, 0x88b2, 0x88b3, 0x88b4, 0x88b5, - 0x88b6, 0x88b8, 0x88b9, 0x88ba, 0x88bb, 0x88bd, 0x88be, 0x88bf, - 0x88c0, 0x88c3, 0x88c4, 0x88c7, 0x88c8, 0x88ca, 0x88cb, 0x88cc, - 0x88cd, 0x88cf, 0x88d0, 0x88d1, 0x88d3, 0x88d6, 0x88d7, 0x88da, - 0x88db, 0x88dc, 0x88dd, 0x88de, 0x88e0, 0x88e1, 0x88e6, 0x88e7, - 0x88e9, 0x88ea, 0x88eb, 0x88ec, 0x88ed, 0x88ee, 0x88ef, 0x88f2, - 0x88f5, 0x88f6, 0x88f7, 0x88fa, 0x88fb, 0x88fd, 0x88ff, 0x8900, - 0x8901, 0x8903, 0x8904, 0x8905, 0x8906, 0x8907, 0x8908, 0x8909, - 0x890b, 0x890c, 0x890d, 0x890e, 0x890f, 0x8911, 0x8914, 0x8915, - 0x8916, 0x8917, 0x8918, 0x891c, 0x891d, 0x891e, 0x891f, 0x8920, - 0x8922, 0x8923, 0x8924, 0x8926, 0x8927, 0x8928, 0x8929, 0x892c, - 0x892d, 0x892e, 0x892f, 0x8931, 0x8932, 0x8933, 0x8935, 0x8937, - 0x9009, 0x7663, 0x7729, 0x7eda, 0x9774, 0x859b, 0x5b66, 0x7a74, - 0x96ea, 0x8840, 0x52cb, 0x718f, 0x5faa, 0x65ec, 0x8be2, 0x5bfb, - 0x9a6f, 0x5de1, 0x6b89, 0x6c5b, 0x8bad, 0x8baf, 0x900a, 0x8fc5, - 0x538b, 0x62bc, 0x9e26, 0x9e2d, 0x5440, 0x4e2b, 0x82bd, 0x7259, - 0x869c, 0x5d16, 0x8859, 0x6daf, 0x96c5, 0x54d1, 0x4e9a, 0x8bb6, - 0x7109, 0x54bd, 0x9609, 0x70df, 0x6df9, 0x76d0, 0x4e25, 0x7814, - 0x8712, 0x5ca9, 0x5ef6, 0x8a00, 0x989c, 0x960e, 0x708e, 0x6cbf, - 0x5944, 0x63a9, 0x773c, 0x884d, 0x6f14, 0x8273, 0x5830, 0x71d5, - 0x538c, 0x781a, 0x96c1, 0x5501, 0x5f66, 0x7130, 0x5bb4, 0x8c1a, - 0x9a8c, 0x6b83, 0x592e, 0x9e2f, 0x79e7, 0x6768, 0x626c, 0x4f6f, - 0x75a1, 0x7f8a, 0x6d0b, 0x9633, 0x6c27, 0x4ef0, 0x75d2, 0x517b, - 0x6837, 0x6f3e, 0x9080, 0x8170, 0x5996, 0x7476, - /* 0xd2 */ - 0x8938, 0x8939, 0x893a, 0x893b, 0x893c, 0x893d, 0x893e, 0x893f, - 0x8940, 0x8942, 0x8943, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, - 0x894a, 0x894b, 0x894c, 0x894d, 0x894e, 0x894f, 0x8950, 0x8951, - 0x8952, 0x8953, 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, - 0x895a, 0x895b, 0x895c, 0x895d, 0x8960, 0x8961, 0x8962, 0x8963, - 0x8964, 0x8965, 0x8967, 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, - 0x896d, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, - 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897a, 0x897c, 0x897d, - 0x897e, 0x8980, 0x8982, 0x8984, 0x8985, 0x8987, 0x8988, 0x8989, - 0x898a, 0x898b, 0x898c, 0x898d, 0x898e, 0x898f, 0x8990, 0x8991, - 0x8992, 0x8993, 0x8994, 0x8995, 0x8996, 0x8997, 0x8998, 0x8999, - 0x899a, 0x899b, 0x899c, 0x899d, 0x899e, 0x899f, 0x89a0, 0x89a1, - 0x6447, 0x5c27, 0x9065, 0x7a91, 0x8c23, 0x59da, 0x54ac, 0x8200, - 0x836f, 0x8981, 0x8000, 0x6930, 0x564e, 0x8036, 0x7237, 0x91ce, - 0x51b6, 0x4e5f, 0x9875, 0x6396, 0x4e1a, 0x53f6, 0x66f3, 0x814b, - 0x591c, 0x6db2, 0x4e00, 0x58f9, 0x533b, 0x63d6, 0x94f1, 0x4f9d, - 0x4f0a, 0x8863, 0x9890, 0x5937, 0x9057, 0x79fb, 0x4eea, 0x80f0, - 0x7591, 0x6c82, 0x5b9c, 0x59e8, 0x5f5d, 0x6905, 0x8681, 0x501a, - 0x5df2, 0x4e59, 0x77e3, 0x4ee5, 0x827a, 0x6291, 0x6613, 0x9091, - 0x5c79, 0x4ebf, 0x5f79, 0x81c6, 0x9038, 0x8084, 0x75ab, 0x4ea6, - 0x88d4, 0x610f, 0x6bc5, 0x5fc6, 0x4e49, 0x76ca, 0x6ea2, 0x8be3, - 0x8bae, 0x8c0a, 0x8bd1, 0x5f02, 0x7ffc, 0x7fcc, 0x7ece, 0x8335, - 0x836b, 0x56e0, 0x6bb7, 0x97f3, 0x9634, 0x59fb, 0x541f, 0x94f6, - 0x6deb, 0x5bc5, 0x996e, 0x5c39, 0x5f15, 0x9690, - /* 0xd3 */ - 0x89a2, 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0x89a7, 0x89a8, 0x89a9, - 0x89aa, 0x89ab, 0x89ac, 0x89ad, 0x89ae, 0x89af, 0x89b0, 0x89b1, - 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, 0x89b8, 0x89b9, - 0x89ba, 0x89bb, 0x89bc, 0x89bd, 0x89be, 0x89bf, 0x89c0, 0x89c3, - 0x89cd, 0x89d3, 0x89d4, 0x89d5, 0x89d7, 0x89d8, 0x89d9, 0x89db, - 0x89dd, 0x89df, 0x89e0, 0x89e1, 0x89e2, 0x89e4, 0x89e7, 0x89e8, - 0x89e9, 0x89ea, 0x89ec, 0x89ed, 0x89ee, 0x89f0, 0x89f1, 0x89f2, - 0x89f4, 0x89f5, 0x89f6, 0x89f7, 0x89f8, 0x89f9, 0x89fa, 0x89fb, - 0x89fc, 0x89fd, 0x89fe, 0x89ff, 0x8a01, 0x8a02, 0x8a03, 0x8a04, - 0x8a05, 0x8a06, 0x8a08, 0x8a09, 0x8a0a, 0x8a0b, 0x8a0c, 0x8a0d, - 0x8a0e, 0x8a0f, 0x8a10, 0x8a11, 0x8a12, 0x8a13, 0x8a14, 0x8a15, - 0x8a16, 0x8a17, 0x8a18, 0x8a19, 0x8a1a, 0x8a1b, 0x8a1c, 0x8a1d, - 0x5370, 0x82f1, 0x6a31, 0x5a74, 0x9e70, 0x5e94, 0x7f28, 0x83b9, - 0x8424, 0x8425, 0x8367, 0x8747, 0x8fce, 0x8d62, 0x76c8, 0x5f71, - 0x9896, 0x786c, 0x6620, 0x54df, 0x62e5, 0x4f63, 0x81c3, 0x75c8, - 0x5eb8, 0x96cd, 0x8e0a, 0x86f9, 0x548f, 0x6cf3, 0x6d8c, 0x6c38, - 0x607f, 0x52c7, 0x7528, 0x5e7d, 0x4f18, 0x60a0, 0x5fe7, 0x5c24, - 0x7531, 0x90ae, 0x94c0, 0x72b9, 0x6cb9, 0x6e38, 0x9149, 0x6709, - 0x53cb, 0x53f3, 0x4f51, 0x91c9, 0x8bf1, 0x53c8, 0x5e7c, 0x8fc2, - 0x6de4, 0x4e8e, 0x76c2, 0x6986, 0x865e, 0x611a, 0x8206, 0x4f59, - 0x4fde, 0x903e, 0x9c7c, 0x6109, 0x6e1d, 0x6e14, 0x9685, 0x4e88, - 0x5a31, 0x96e8, 0x4e0e, 0x5c7f, 0x79b9, 0x5b87, 0x8bed, 0x7fbd, - 0x7389, 0x57df, 0x828b, 0x90c1, 0x5401, 0x9047, 0x55bb, 0x5cea, - 0x5fa1, 0x6108, 0x6b32, 0x72f1, 0x80b2, 0x8a89, - /* 0xd4 */ - 0x8a1e, 0x8a1f, 0x8a20, 0x8a21, 0x8a22, 0x8a23, 0x8a24, 0x8a25, - 0x8a26, 0x8a27, 0x8a28, 0x8a29, 0x8a2a, 0x8a2b, 0x8a2c, 0x8a2d, - 0x8a2e, 0x8a2f, 0x8a30, 0x8a31, 0x8a32, 0x8a33, 0x8a34, 0x8a35, - 0x8a36, 0x8a37, 0x8a38, 0x8a39, 0x8a3a, 0x8a3b, 0x8a3c, 0x8a3d, - 0x8a3f, 0x8a40, 0x8a41, 0x8a42, 0x8a43, 0x8a44, 0x8a45, 0x8a46, - 0x8a47, 0x8a49, 0x8a4a, 0x8a4b, 0x8a4c, 0x8a4d, 0x8a4e, 0x8a4f, - 0x8a50, 0x8a51, 0x8a52, 0x8a53, 0x8a54, 0x8a55, 0x8a56, 0x8a57, - 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, - 0x8a60, 0x8a61, 0x8a62, 0x8a63, 0x8a64, 0x8a65, 0x8a66, 0x8a67, - 0x8a68, 0x8a69, 0x8a6a, 0x8a6b, 0x8a6c, 0x8a6d, 0x8a6e, 0x8a6f, - 0x8a70, 0x8a71, 0x8a72, 0x8a73, 0x8a74, 0x8a75, 0x8a76, 0x8a77, - 0x8a78, 0x8a7a, 0x8a7b, 0x8a7c, 0x8a7d, 0x8a7e, 0x8a7f, 0x8a80, - 0x6d74, 0x5bd3, 0x88d5, 0x9884, 0x8c6b, 0x9a6d, 0x9e33, 0x6e0a, - 0x51a4, 0x5143, 0x57a3, 0x8881, 0x539f, 0x63f4, 0x8f95, 0x56ed, - 0x5458, 0x5706, 0x733f, 0x6e90, 0x7f18, 0x8fdc, 0x82d1, 0x613f, - 0x6028, 0x9662, 0x66f0, 0x7ea6, 0x8d8a, 0x8dc3, 0x94a5, 0x5cb3, - 0x7ca4, 0x6708, 0x60a6, 0x9605, 0x8018, 0x4e91, 0x90e7, 0x5300, - 0x9668, 0x5141, 0x8fd0, 0x8574, 0x915d, 0x6655, 0x97f5, 0x5b55, - 0x531d, 0x7838, 0x6742, 0x683d, 0x54c9, 0x707e, 0x5bb0, 0x8f7d, - 0x518d, 0x5728, 0x54b1, 0x6512, 0x6682, 0x8d5e, 0x8d43, 0x810f, - 0x846c, 0x906d, 0x7cdf, 0x51ff, 0x85fb, 0x67a3, 0x65e9, 0x6fa1, - 0x86a4, 0x8e81, 0x566a, 0x9020, 0x7682, 0x7076, 0x71e5, 0x8d23, - 0x62e9, 0x5219, 0x6cfd, 0x8d3c, 0x600e, 0x589e, 0x618e, 0x66fe, - 0x8d60, 0x624e, 0x55b3, 0x6e23, 0x672d, 0x8f67, - /* 0xd5 */ - 0x8a81, 0x8a82, 0x8a83, 0x8a84, 0x8a85, 0x8a86, 0x8a87, 0x8a88, - 0x8a8b, 0x8a8c, 0x8a8d, 0x8a8e, 0x8a8f, 0x8a90, 0x8a91, 0x8a92, - 0x8a94, 0x8a95, 0x8a96, 0x8a97, 0x8a98, 0x8a99, 0x8a9a, 0x8a9b, - 0x8a9c, 0x8a9d, 0x8a9e, 0x8a9f, 0x8aa0, 0x8aa1, 0x8aa2, 0x8aa3, - 0x8aa4, 0x8aa5, 0x8aa6, 0x8aa7, 0x8aa8, 0x8aa9, 0x8aaa, 0x8aab, - 0x8aac, 0x8aad, 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, - 0x8ab4, 0x8ab5, 0x8ab6, 0x8ab7, 0x8ab8, 0x8ab9, 0x8aba, 0x8abb, - 0x8abc, 0x8abd, 0x8abe, 0x8abf, 0x8ac0, 0x8ac1, 0x8ac2, 0x8ac3, - 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, 0x8ac8, 0x8ac9, 0x8aca, 0x8acb, - 0x8acc, 0x8acd, 0x8ace, 0x8acf, 0x8ad0, 0x8ad1, 0x8ad2, 0x8ad3, - 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, 0x8ad9, 0x8ada, 0x8adb, - 0x8adc, 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0x8ae1, 0x8ae2, 0x8ae3, - 0x94e1, 0x95f8, 0x7728, 0x6805, 0x69a8, 0x548b, 0x4e4d, 0x70b8, - 0x8bc8, 0x6458, 0x658b, 0x5b85, 0x7a84, 0x503a, 0x5be8, 0x77bb, - 0x6be1, 0x8a79, 0x7c98, 0x6cbe, 0x76cf, 0x65a9, 0x8f97, 0x5d2d, - 0x5c55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7ad9, 0x6e5b, 0x7efd, - 0x6a1f, 0x7ae0, 0x5f70, 0x6f33, 0x5f20, 0x638c, 0x6da8, 0x6756, - 0x4e08, 0x5e10, 0x8d26, 0x4ed7, 0x80c0, 0x7634, 0x969c, 0x62db, - 0x662d, 0x627e, 0x6cbc, 0x8d75, 0x7167, 0x7f69, 0x5146, 0x8087, - 0x53ec, 0x906e, 0x6298, 0x54f2, 0x86f0, 0x8f99, 0x8005, 0x9517, - 0x8517, 0x8fd9, 0x6d59, 0x73cd, 0x659f, 0x771f, 0x7504, 0x7827, - 0x81fb, 0x8d1e, 0x9488, 0x4fa6, 0x6795, 0x75b9, 0x8bca, 0x9707, - 0x632f, 0x9547, 0x9635, 0x84b8, 0x6323, 0x7741, 0x5f81, 0x72f0, - 0x4e89, 0x6014, 0x6574, 0x62ef, 0x6b63, 0x653f, - /* 0xd6 */ - 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0x8ae9, 0x8aea, 0x8aeb, - 0x8aec, 0x8aed, 0x8aee, 0x8aef, 0x8af0, 0x8af1, 0x8af2, 0x8af3, - 0x8af4, 0x8af5, 0x8af6, 0x8af7, 0x8af8, 0x8af9, 0x8afa, 0x8afb, - 0x8afc, 0x8afd, 0x8afe, 0x8aff, 0x8b00, 0x8b01, 0x8b02, 0x8b03, - 0x8b04, 0x8b05, 0x8b06, 0x8b08, 0x8b09, 0x8b0a, 0x8b0b, 0x8b0c, - 0x8b0d, 0x8b0e, 0x8b0f, 0x8b10, 0x8b11, 0x8b12, 0x8b13, 0x8b14, - 0x8b15, 0x8b16, 0x8b17, 0x8b18, 0x8b19, 0x8b1a, 0x8b1b, 0x8b1c, - 0x8b1d, 0x8b1e, 0x8b1f, 0x8b20, 0x8b21, 0x8b22, 0x8b23, 0x8b24, - 0x8b25, 0x8b27, 0x8b28, 0x8b29, 0x8b2a, 0x8b2b, 0x8b2c, 0x8b2d, - 0x8b2e, 0x8b2f, 0x8b30, 0x8b31, 0x8b32, 0x8b33, 0x8b34, 0x8b35, - 0x8b36, 0x8b37, 0x8b38, 0x8b39, 0x8b3a, 0x8b3b, 0x8b3c, 0x8b3d, - 0x8b3e, 0x8b3f, 0x8b40, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0x8b45, - 0x5e27, 0x75c7, 0x90d1, 0x8bc1, 0x829d, 0x679d, 0x652f, 0x5431, - 0x8718, 0x77e5, 0x80a2, 0x8102, 0x6c41, 0x4e4b, 0x7ec7, 0x804c, - 0x76f4, 0x690d, 0x6b96, 0x6267, 0x503c, 0x4f84, 0x5740, 0x6307, - 0x6b62, 0x8dbe, 0x53ea, 0x65e8, 0x7eb8, 0x5fd7, 0x631a, 0x63b7, - 0x81f3, 0x81f4, 0x7f6e, 0x5e1c, 0x5cd9, 0x5236, 0x667a, 0x79e9, - 0x7a1a, 0x8d28, 0x7099, 0x75d4, 0x6ede, 0x6cbb, 0x7a92, 0x4e2d, - 0x76c5, 0x5fe0, 0x949f, 0x8877, 0x7ec8, 0x79cd, 0x80bf, 0x91cd, - 0x4ef2, 0x4f17, 0x821f, 0x5468, 0x5dde, 0x6d32, 0x8bcc, 0x7ca5, - 0x8f74, 0x8098, 0x5e1a, 0x5492, 0x76b1, 0x5b99, 0x663c, 0x9aa4, - 0x73e0, 0x682a, 0x86db, 0x6731, 0x732a, 0x8bf8, 0x8bdb, 0x9010, - 0x7af9, 0x70db, 0x716e, 0x62c4, 0x77a9, 0x5631, 0x4e3b, 0x8457, - 0x67f1, 0x52a9, 0x86c0, 0x8d2e, 0x94f8, 0x7b51, - /* 0xd7 */ - 0x8b46, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, 0x8b4c, 0x8b4d, - 0x8b4e, 0x8b4f, 0x8b50, 0x8b51, 0x8b52, 0x8b53, 0x8b54, 0x8b55, - 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, - 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, - 0x8b67, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6d, 0x8b6e, 0x8b6f, - 0x8b70, 0x8b71, 0x8b72, 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, - 0x8b78, 0x8b79, 0x8b7a, 0x8b7b, 0x8b7c, 0x8b7d, 0x8b7e, 0x8b7f, - 0x8b80, 0x8b81, 0x8b82, 0x8b83, 0x8b84, 0x8b85, 0x8b86, 0x8b87, - 0x8b88, 0x8b89, 0x8b8a, 0x8b8b, 0x8b8c, 0x8b8d, 0x8b8e, 0x8b8f, - 0x8b90, 0x8b91, 0x8b92, 0x8b93, 0x8b94, 0x8b95, 0x8b96, 0x8b97, - 0x8b98, 0x8b99, 0x8b9a, 0x8b9b, 0x8b9c, 0x8b9d, 0x8b9e, 0x8b9f, - 0x8bac, 0x8bb1, 0x8bbb, 0x8bc7, 0x8bd0, 0x8bea, 0x8c09, 0x8c1e, - 0x4f4f, 0x6ce8, 0x795d, 0x9a7b, 0x6293, 0x722a, 0x62fd, 0x4e13, - 0x7816, 0x8f6c, 0x64b0, 0x8d5a, 0x7bc6, 0x6869, 0x5e84, 0x88c5, - 0x5986, 0x649e, 0x58ee, 0x72b6, 0x690e, 0x9525, 0x8ffd, 0x8d58, - 0x5760, 0x7f00, 0x8c06, 0x51c6, 0x6349, 0x62d9, 0x5353, 0x684c, - 0x7422, 0x8301, 0x914c, 0x5544, 0x7740, 0x707c, 0x6d4a, 0x5179, - 0x54a8, 0x8d44, 0x59ff, 0x6ecb, 0x6dc4, 0x5b5c, 0x7d2b, 0x4ed4, - 0x7c7d, 0x6ed3, 0x5b50, 0x81ea, 0x6e0d, 0x5b57, 0x9b03, 0x68d5, - 0x8e2a, 0x5b97, 0x7efc, 0x603b, 0x7eb5, 0x90b9, 0x8d70, 0x594f, - 0x63cd, 0x79df, 0x8db3, 0x5352, 0x65cf, 0x7956, 0x8bc5, 0x963b, - 0x7ec4, 0x94bb, 0x7e82, 0x5634, 0x9189, 0x6700, 0x7f6a, 0x5c0a, - 0x9075, 0x6628, 0x5de6, 0x4f50, 0x67de, 0x505a, 0x4f5c, 0x5750, - 0x5ea7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xd8 */ - 0x8c38, 0x8c39, 0x8c3a, 0x8c3b, 0x8c3c, 0x8c3d, 0x8c3e, 0x8c3f, - 0x8c40, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c48, 0x8c4a, 0x8c4b, - 0x8c4d, 0x8c4e, 0x8c4f, 0x8c50, 0x8c51, 0x8c52, 0x8c53, 0x8c54, - 0x8c56, 0x8c57, 0x8c58, 0x8c59, 0x8c5b, 0x8c5c, 0x8c5d, 0x8c5e, - 0x8c5f, 0x8c60, 0x8c63, 0x8c64, 0x8c65, 0x8c66, 0x8c67, 0x8c68, - 0x8c69, 0x8c6c, 0x8c6d, 0x8c6e, 0x8c6f, 0x8c70, 0x8c71, 0x8c72, - 0x8c74, 0x8c75, 0x8c76, 0x8c77, 0x8c7b, 0x8c7c, 0x8c7d, 0x8c7e, - 0x8c7f, 0x8c80, 0x8c81, 0x8c83, 0x8c84, 0x8c86, 0x8c87, 0x8c88, - 0x8c8b, 0x8c8d, 0x8c8e, 0x8c8f, 0x8c90, 0x8c91, 0x8c92, 0x8c93, - 0x8c95, 0x8c96, 0x8c97, 0x8c99, 0x8c9a, 0x8c9b, 0x8c9c, 0x8c9d, - 0x8c9e, 0x8c9f, 0x8ca0, 0x8ca1, 0x8ca2, 0x8ca3, 0x8ca4, 0x8ca5, - 0x8ca6, 0x8ca7, 0x8ca8, 0x8ca9, 0x8caa, 0x8cab, 0x8cac, 0x8cad, - 0x4e8d, 0x4e0c, 0x5140, 0x4e10, 0x5eff, 0x5345, 0x4e15, 0x4e98, - 0x4e1e, 0x9b32, 0x5b6c, 0x5669, 0x4e28, 0x79ba, 0x4e3f, 0x5315, - 0x4e47, 0x592d, 0x723b, 0x536e, 0x6c10, 0x56df, 0x80e4, 0x9997, - 0x6bd3, 0x777e, 0x9f17, 0x4e36, 0x4e9f, 0x9f10, 0x4e5c, 0x4e69, - 0x4e93, 0x8288, 0x5b5b, 0x556c, 0x560f, 0x4ec4, 0x538d, 0x539d, - 0x53a3, 0x53a5, 0x53ae, 0x9765, 0x8d5d, 0x531a, 0x53f5, 0x5326, - 0x532e, 0x533e, 0x8d5c, 0x5366, 0x5363, 0x5202, 0x5208, 0x520e, - 0x522d, 0x5233, 0x523f, 0x5240, 0x524c, 0x525e, 0x5261, 0x525c, - 0x84af, 0x527d, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, 0x7f54, - 0x4ebb, 0x4ec3, 0x4ec9, 0x4ec2, 0x4ee8, 0x4ee1, 0x4eeb, 0x4ede, - 0x4f1b, 0x4ef3, 0x4f22, 0x4f64, 0x4ef5, 0x4f25, 0x4f27, 0x4f09, - 0x4f2b, 0x4f5e, 0x4f67, 0x6538, 0x4f5a, 0x4f5d, - /* 0xd9 */ - 0x8cae, 0x8caf, 0x8cb0, 0x8cb1, 0x8cb2, 0x8cb3, 0x8cb4, 0x8cb5, - 0x8cb6, 0x8cb7, 0x8cb8, 0x8cb9, 0x8cba, 0x8cbb, 0x8cbc, 0x8cbd, - 0x8cbe, 0x8cbf, 0x8cc0, 0x8cc1, 0x8cc2, 0x8cc3, 0x8cc4, 0x8cc5, - 0x8cc6, 0x8cc7, 0x8cc8, 0x8cc9, 0x8cca, 0x8ccb, 0x8ccc, 0x8ccd, - 0x8cce, 0x8ccf, 0x8cd0, 0x8cd1, 0x8cd2, 0x8cd3, 0x8cd4, 0x8cd5, - 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0x8cdb, 0x8cdc, 0x8cdd, - 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, 0x8ce2, 0x8ce3, 0x8ce4, 0x8ce5, - 0x8ce6, 0x8ce7, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, 0x8ced, - 0x8cee, 0x8cef, 0x8cf0, 0x8cf1, 0x8cf2, 0x8cf3, 0x8cf4, 0x8cf5, - 0x8cf6, 0x8cf7, 0x8cf8, 0x8cf9, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, - 0x8cfe, 0x8cff, 0x8d00, 0x8d01, 0x8d02, 0x8d03, 0x8d04, 0x8d05, - 0x8d06, 0x8d07, 0x8d08, 0x8d09, 0x8d0a, 0x8d0b, 0x8d0c, 0x8d0d, - 0x4f5f, 0x4f57, 0x4f32, 0x4f3d, 0x4f76, 0x4f74, 0x4f91, 0x4f89, - 0x4f83, 0x4f8f, 0x4f7e, 0x4f7b, 0x4faa, 0x4f7c, 0x4fac, 0x4f94, - 0x4fe6, 0x4fe8, 0x4fea, 0x4fc5, 0x4fda, 0x4fe3, 0x4fdc, 0x4fd1, - 0x4fdf, 0x4ff8, 0x5029, 0x504c, 0x4ff3, 0x502c, 0x500f, 0x502e, - 0x502d, 0x4ffe, 0x501c, 0x500c, 0x5025, 0x5028, 0x507e, 0x5043, - 0x5055, 0x5048, 0x504e, 0x506c, 0x507b, 0x50a5, 0x50a7, 0x50a9, - 0x50ba, 0x50d6, 0x5106, 0x50ed, 0x50ec, 0x50e6, 0x50ee, 0x5107, - 0x510b, 0x4edd, 0x6c3d, 0x4f58, 0x4f65, 0x4fce, 0x9fa0, 0x6c46, - 0x7c74, 0x516e, 0x5dfd, 0x9ec9, 0x9998, 0x5181, 0x5914, 0x52f9, - 0x530d, 0x8a07, 0x5310, 0x51eb, 0x5919, 0x5155, 0x4ea0, 0x5156, - 0x4eb3, 0x886e, 0x88a4, 0x4eb5, 0x8114, 0x88d2, 0x7980, 0x5b34, - 0x8803, 0x7fb8, 0x51ab, 0x51b1, 0x51bd, 0x51bc, - /* 0xda */ - 0x8d0e, 0x8d0f, 0x8d10, 0x8d11, 0x8d12, 0x8d13, 0x8d14, 0x8d15, - 0x8d16, 0x8d17, 0x8d18, 0x8d19, 0x8d1a, 0x8d1b, 0x8d1c, 0x8d20, - 0x8d51, 0x8d52, 0x8d57, 0x8d5f, 0x8d65, 0x8d68, 0x8d69, 0x8d6a, - 0x8d6c, 0x8d6e, 0x8d6f, 0x8d71, 0x8d72, 0x8d78, 0x8d79, 0x8d7a, - 0x8d7b, 0x8d7c, 0x8d7d, 0x8d7e, 0x8d7f, 0x8d80, 0x8d82, 0x8d83, - 0x8d86, 0x8d87, 0x8d88, 0x8d89, 0x8d8c, 0x8d8d, 0x8d8e, 0x8d8f, - 0x8d90, 0x8d92, 0x8d93, 0x8d95, 0x8d96, 0x8d97, 0x8d98, 0x8d99, - 0x8d9a, 0x8d9b, 0x8d9c, 0x8d9d, 0x8d9e, 0x8da0, 0x8da1, 0x8da2, - 0x8da4, 0x8da5, 0x8da6, 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, - 0x8dac, 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db2, 0x8db6, 0x8db7, - 0x8db9, 0x8dbb, 0x8dbd, 0x8dc0, 0x8dc1, 0x8dc2, 0x8dc5, 0x8dc7, - 0x8dc8, 0x8dc9, 0x8dca, 0x8dcd, 0x8dd0, 0x8dd2, 0x8dd3, 0x8dd4, - 0x51c7, 0x5196, 0x51a2, 0x51a5, 0x8ba0, 0x8ba6, 0x8ba7, 0x8baa, - 0x8bb4, 0x8bb5, 0x8bb7, 0x8bc2, 0x8bc3, 0x8bcb, 0x8bcf, 0x8bce, - 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd6, 0x8bd8, 0x8bd9, 0x8bdc, 0x8bdf, - 0x8be0, 0x8be4, 0x8be8, 0x8be9, 0x8bee, 0x8bf0, 0x8bf3, 0x8bf6, - 0x8bf9, 0x8bfc, 0x8bff, 0x8c00, 0x8c02, 0x8c04, 0x8c07, 0x8c0c, - 0x8c0f, 0x8c11, 0x8c12, 0x8c14, 0x8c15, 0x8c16, 0x8c19, 0x8c1b, - 0x8c18, 0x8c1d, 0x8c1f, 0x8c20, 0x8c21, 0x8c25, 0x8c27, 0x8c2a, - 0x8c2b, 0x8c2e, 0x8c2f, 0x8c32, 0x8c33, 0x8c35, 0x8c36, 0x5369, - 0x537a, 0x961d, 0x9622, 0x9621, 0x9631, 0x962a, 0x963d, 0x963c, - 0x9642, 0x9649, 0x9654, 0x965f, 0x9667, 0x966c, 0x9672, 0x9674, - 0x9688, 0x968d, 0x9697, 0x96b0, 0x9097, 0x909b, 0x909d, 0x9099, - 0x90ac, 0x90a1, 0x90b4, 0x90b3, 0x90b6, 0x90ba, - /* 0xdb */ - 0x8dd5, 0x8dd8, 0x8dd9, 0x8ddc, 0x8de0, 0x8de1, 0x8de2, 0x8de5, - 0x8de6, 0x8de7, 0x8de9, 0x8ded, 0x8dee, 0x8df0, 0x8df1, 0x8df2, - 0x8df4, 0x8df6, 0x8dfc, 0x8dfe, 0x8dff, 0x8e00, 0x8e01, 0x8e02, - 0x8e03, 0x8e04, 0x8e06, 0x8e07, 0x8e08, 0x8e0b, 0x8e0d, 0x8e0e, - 0x8e10, 0x8e11, 0x8e12, 0x8e13, 0x8e15, 0x8e16, 0x8e17, 0x8e18, - 0x8e19, 0x8e1a, 0x8e1b, 0x8e1c, 0x8e20, 0x8e21, 0x8e24, 0x8e25, - 0x8e26, 0x8e27, 0x8e28, 0x8e2b, 0x8e2d, 0x8e30, 0x8e32, 0x8e33, - 0x8e34, 0x8e36, 0x8e37, 0x8e38, 0x8e3b, 0x8e3c, 0x8e3e, 0x8e3f, - 0x8e43, 0x8e45, 0x8e46, 0x8e4c, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e50, - 0x8e53, 0x8e54, 0x8e55, 0x8e56, 0x8e57, 0x8e58, 0x8e5a, 0x8e5b, - 0x8e5c, 0x8e5d, 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0x8e63, - 0x8e64, 0x8e65, 0x8e67, 0x8e68, 0x8e6a, 0x8e6b, 0x8e6e, 0x8e71, - 0x90b8, 0x90b0, 0x90cf, 0x90c5, 0x90be, 0x90d0, 0x90c4, 0x90c7, - 0x90d3, 0x90e6, 0x90e2, 0x90dc, 0x90d7, 0x90db, 0x90eb, 0x90ef, - 0x90fe, 0x9104, 0x9122, 0x911e, 0x9123, 0x9131, 0x912f, 0x9139, - 0x9143, 0x9146, 0x520d, 0x5942, 0x52a2, 0x52ac, 0x52ad, 0x52be, - 0x54ff, 0x52d0, 0x52d6, 0x52f0, 0x53df, 0x71ee, 0x77cd, 0x5ef4, - 0x51f5, 0x51fc, 0x9b2f, 0x53b6, 0x5f01, 0x755a, 0x5def, 0x574c, - 0x57a9, 0x57a1, 0x587e, 0x58bc, 0x58c5, 0x58d1, 0x5729, 0x572c, - 0x572a, 0x5733, 0x5739, 0x572e, 0x572f, 0x575c, 0x573b, 0x5742, - 0x5769, 0x5785, 0x576b, 0x5786, 0x577c, 0x577b, 0x5768, 0x576d, - 0x5776, 0x5773, 0x57ad, 0x57a4, 0x578c, 0x57b2, 0x57cf, 0x57a7, - 0x57b4, 0x5793, 0x57a0, 0x57d5, 0x57d8, 0x57da, 0x57d9, 0x57d2, - 0x57b8, 0x57f4, 0x57ef, 0x57f8, 0x57e4, 0x57dd, - /* 0xdc */ - 0x8e73, 0x8e75, 0x8e77, 0x8e78, 0x8e79, 0x8e7a, 0x8e7b, 0x8e7d, - 0x8e7e, 0x8e80, 0x8e82, 0x8e83, 0x8e84, 0x8e86, 0x8e88, 0x8e89, - 0x8e8a, 0x8e8b, 0x8e8c, 0x8e8d, 0x8e8e, 0x8e91, 0x8e92, 0x8e93, - 0x8e95, 0x8e96, 0x8e97, 0x8e98, 0x8e99, 0x8e9a, 0x8e9b, 0x8e9d, - 0x8e9f, 0x8ea0, 0x8ea1, 0x8ea2, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, - 0x8ea7, 0x8ea8, 0x8ea9, 0x8eaa, 0x8ead, 0x8eae, 0x8eb0, 0x8eb1, - 0x8eb3, 0x8eb4, 0x8eb5, 0x8eb6, 0x8eb7, 0x8eb8, 0x8eb9, 0x8ebb, - 0x8ebc, 0x8ebd, 0x8ebe, 0x8ebf, 0x8ec0, 0x8ec1, 0x8ec2, 0x8ec3, - 0x8ec4, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, 0x8eca, 0x8ecb, - 0x8ecc, 0x8ecd, 0x8ecf, 0x8ed0, 0x8ed1, 0x8ed2, 0x8ed3, 0x8ed4, - 0x8ed5, 0x8ed6, 0x8ed7, 0x8ed8, 0x8ed9, 0x8eda, 0x8edb, 0x8edc, - 0x8edd, 0x8ede, 0x8edf, 0x8ee0, 0x8ee1, 0x8ee2, 0x8ee3, 0x8ee4, - 0x580b, 0x580d, 0x57fd, 0x57ed, 0x5800, 0x581e, 0x5819, 0x5844, - 0x5820, 0x5865, 0x586c, 0x5881, 0x5889, 0x589a, 0x5880, 0x99a8, - 0x9f19, 0x61ff, 0x8279, 0x827d, 0x827f, 0x828f, 0x828a, 0x82a8, - 0x8284, 0x828e, 0x8291, 0x8297, 0x8299, 0x82ab, 0x82b8, 0x82be, - 0x82b0, 0x82c8, 0x82ca, 0x82e3, 0x8298, 0x82b7, 0x82ae, 0x82cb, - 0x82cc, 0x82c1, 0x82a9, 0x82b4, 0x82a1, 0x82aa, 0x829f, 0x82c4, - 0x82ce, 0x82a4, 0x82e1, 0x8309, 0x82f7, 0x82e4, 0x830f, 0x8307, - 0x82dc, 0x82f4, 0x82d2, 0x82d8, 0x830c, 0x82fb, 0x82d3, 0x8311, - 0x831a, 0x8306, 0x8314, 0x8315, 0x82e0, 0x82d5, 0x831c, 0x8351, - 0x835b, 0x835c, 0x8308, 0x8392, 0x833c, 0x8334, 0x8331, 0x839b, - 0x835e, 0x832f, 0x834f, 0x8347, 0x8343, 0x835f, 0x8340, 0x8317, - 0x8360, 0x832d, 0x833a, 0x8333, 0x8366, 0x8365, - /* 0xdd */ - 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, - 0x8eed, 0x8eee, 0x8eef, 0x8ef0, 0x8ef1, 0x8ef2, 0x8ef3, 0x8ef4, - 0x8ef5, 0x8ef6, 0x8ef7, 0x8ef8, 0x8ef9, 0x8efa, 0x8efb, 0x8efc, - 0x8efd, 0x8efe, 0x8eff, 0x8f00, 0x8f01, 0x8f02, 0x8f03, 0x8f04, - 0x8f05, 0x8f06, 0x8f07, 0x8f08, 0x8f09, 0x8f0a, 0x8f0b, 0x8f0c, - 0x8f0d, 0x8f0e, 0x8f0f, 0x8f10, 0x8f11, 0x8f12, 0x8f13, 0x8f14, - 0x8f15, 0x8f16, 0x8f17, 0x8f18, 0x8f19, 0x8f1a, 0x8f1b, 0x8f1c, - 0x8f1d, 0x8f1e, 0x8f1f, 0x8f20, 0x8f21, 0x8f22, 0x8f23, 0x8f24, - 0x8f25, 0x8f26, 0x8f27, 0x8f28, 0x8f29, 0x8f2a, 0x8f2b, 0x8f2c, - 0x8f2d, 0x8f2e, 0x8f2f, 0x8f30, 0x8f31, 0x8f32, 0x8f33, 0x8f34, - 0x8f35, 0x8f36, 0x8f37, 0x8f38, 0x8f39, 0x8f3a, 0x8f3b, 0x8f3c, - 0x8f3d, 0x8f3e, 0x8f3f, 0x8f40, 0x8f41, 0x8f42, 0x8f43, 0x8f44, - 0x8368, 0x831b, 0x8369, 0x836c, 0x836a, 0x836d, 0x836e, 0x83b0, - 0x8378, 0x83b3, 0x83b4, 0x83a0, 0x83aa, 0x8393, 0x839c, 0x8385, - 0x837c, 0x83b6, 0x83a9, 0x837d, 0x83b8, 0x837b, 0x8398, 0x839e, - 0x83a8, 0x83ba, 0x83bc, 0x83c1, 0x8401, 0x83e5, 0x83d8, 0x5807, - 0x8418, 0x840b, 0x83dd, 0x83fd, 0x83d6, 0x841c, 0x8438, 0x8411, - 0x8406, 0x83d4, 0x83df, 0x840f, 0x8403, 0x83f8, 0x83f9, 0x83ea, - 0x83c5, 0x83c0, 0x8426, 0x83f0, 0x83e1, 0x845c, 0x8451, 0x845a, - 0x8459, 0x8473, 0x8487, 0x8488, 0x847a, 0x8489, 0x8478, 0x843c, - 0x8446, 0x8469, 0x8476, 0x848c, 0x848e, 0x8431, 0x846d, 0x84c1, - 0x84cd, 0x84d0, 0x84e6, 0x84bd, 0x84d3, 0x84ca, 0x84bf, 0x84ba, - 0x84e0, 0x84a1, 0x84b9, 0x84b4, 0x8497, 0x84e5, 0x84e3, 0x850c, - 0x750d, 0x8538, 0x84f0, 0x8539, 0x851f, 0x853a, - /* 0xde */ - 0x8f45, 0x8f46, 0x8f47, 0x8f48, 0x8f49, 0x8f4a, 0x8f4b, 0x8f4c, - 0x8f4d, 0x8f4e, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, 0x8f53, 0x8f54, - 0x8f55, 0x8f56, 0x8f57, 0x8f58, 0x8f59, 0x8f5a, 0x8f5b, 0x8f5c, - 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, 0x8f61, 0x8f62, 0x8f63, 0x8f64, - 0x8f65, 0x8f6a, 0x8f80, 0x8f8c, 0x8f92, 0x8f9d, 0x8fa0, 0x8fa1, - 0x8fa2, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fa7, 0x8faa, 0x8fac, 0x8fad, - 0x8fae, 0x8faf, 0x8fb2, 0x8fb3, 0x8fb4, 0x8fb5, 0x8fb7, 0x8fb8, - 0x8fba, 0x8fbb, 0x8fbc, 0x8fbf, 0x8fc0, 0x8fc3, 0x8fc6, 0x8fc9, - 0x8fca, 0x8fcb, 0x8fcc, 0x8fcd, 0x8fcf, 0x8fd2, 0x8fd6, 0x8fd7, - 0x8fda, 0x8fe0, 0x8fe1, 0x8fe3, 0x8fe7, 0x8fec, 0x8fef, 0x8ff1, - 0x8ff2, 0x8ff4, 0x8ff5, 0x8ff6, 0x8ffa, 0x8ffb, 0x8ffc, 0x8ffe, - 0x8fff, 0x9007, 0x9008, 0x900c, 0x900e, 0x9013, 0x9015, 0x9018, - 0x8556, 0x853b, 0x84ff, 0x84fc, 0x8559, 0x8548, 0x8568, 0x8564, - 0x855e, 0x857a, 0x77a2, 0x8543, 0x8572, 0x857b, 0x85a4, 0x85a8, - 0x8587, 0x858f, 0x8579, 0x85ae, 0x859c, 0x8585, 0x85b9, 0x85b7, - 0x85b0, 0x85d3, 0x85c1, 0x85dc, 0x85ff, 0x8627, 0x8605, 0x8629, - 0x8616, 0x863c, 0x5efe, 0x5f08, 0x593c, 0x5941, 0x8037, 0x5955, - 0x595a, 0x5958, 0x530f, 0x5c22, 0x5c25, 0x5c2c, 0x5c34, 0x624c, - 0x626a, 0x629f, 0x62bb, 0x62ca, 0x62da, 0x62d7, 0x62ee, 0x6322, - 0x62f6, 0x6339, 0x634b, 0x6343, 0x63ad, 0x63f6, 0x6371, 0x637a, - 0x638e, 0x63b4, 0x636d, 0x63ac, 0x638a, 0x6369, 0x63ae, 0x63bc, - 0x63f2, 0x63f8, 0x63e0, 0x63ff, 0x63c4, 0x63de, 0x63ce, 0x6452, - 0x63c6, 0x63be, 0x6445, 0x6441, 0x640b, 0x641b, 0x6420, 0x640c, - 0x6426, 0x6421, 0x645e, 0x6484, 0x646d, 0x6496, - /* 0xdf */ - 0x9019, 0x901c, 0x9023, 0x9024, 0x9025, 0x9027, 0x9028, 0x9029, - 0x902a, 0x902b, 0x902c, 0x9030, 0x9031, 0x9032, 0x9033, 0x9034, - 0x9037, 0x9039, 0x903a, 0x903d, 0x903f, 0x9040, 0x9043, 0x9045, - 0x9046, 0x9048, 0x9049, 0x904a, 0x904b, 0x904c, 0x904e, 0x9054, - 0x9055, 0x9056, 0x9059, 0x905a, 0x905c, 0x905d, 0x905e, 0x905f, - 0x9060, 0x9061, 0x9064, 0x9066, 0x9067, 0x9069, 0x906a, 0x906b, - 0x906c, 0x906f, 0x9070, 0x9071, 0x9072, 0x9073, 0x9076, 0x9077, - 0x9078, 0x9079, 0x907a, 0x907b, 0x907c, 0x907e, 0x9081, 0x9084, - 0x9085, 0x9086, 0x9087, 0x9089, 0x908a, 0x908c, 0x908d, 0x908e, - 0x908f, 0x9090, 0x9092, 0x9094, 0x9096, 0x9098, 0x909a, 0x909c, - 0x909e, 0x909f, 0x90a0, 0x90a4, 0x90a5, 0x90a7, 0x90a8, 0x90a9, - 0x90ab, 0x90ad, 0x90b2, 0x90b7, 0x90bc, 0x90bd, 0x90bf, 0x90c0, - 0x647a, 0x64b7, 0x64b8, 0x6499, 0x64ba, 0x64c0, 0x64d0, 0x64d7, - 0x64e4, 0x64e2, 0x6509, 0x6525, 0x652e, 0x5f0b, 0x5fd2, 0x7519, - 0x5f11, 0x535f, 0x53f1, 0x53fd, 0x53e9, 0x53e8, 0x53fb, 0x5412, - 0x5416, 0x5406, 0x544b, 0x5452, 0x5453, 0x5454, 0x5456, 0x5443, - 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, 0x5477, - 0x5471, 0x5464, 0x549a, 0x549b, 0x5484, 0x5476, 0x5466, 0x549d, - 0x54d0, 0x54ad, 0x54c2, 0x54b4, 0x54d2, 0x54a7, 0x54a6, 0x54d3, - 0x54d4, 0x5472, 0x54a3, 0x54d5, 0x54bb, 0x54bf, 0x54cc, 0x54d9, - 0x54da, 0x54dc, 0x54a9, 0x54aa, 0x54a4, 0x54dd, 0x54cf, 0x54de, - 0x551b, 0x54e7, 0x5520, 0x54fd, 0x5514, 0x54f3, 0x5522, 0x5523, - 0x550f, 0x5511, 0x5527, 0x552a, 0x5567, 0x558f, 0x55b5, 0x5549, - 0x556d, 0x5541, 0x5555, 0x553f, 0x5550, 0x553c, - /* 0xe0 */ - 0x90c2, 0x90c3, 0x90c6, 0x90c8, 0x90c9, 0x90cb, 0x90cc, 0x90cd, - 0x90d2, 0x90d4, 0x90d5, 0x90d6, 0x90d8, 0x90d9, 0x90da, 0x90de, - 0x90df, 0x90e0, 0x90e3, 0x90e4, 0x90e5, 0x90e9, 0x90ea, 0x90ec, - 0x90ee, 0x90f0, 0x90f1, 0x90f2, 0x90f3, 0x90f5, 0x90f6, 0x90f7, - 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90ff, 0x9100, 0x9101, 0x9103, - 0x9105, 0x9106, 0x9107, 0x9108, 0x9109, 0x910a, 0x910b, 0x910c, - 0x910d, 0x910e, 0x910f, 0x9110, 0x9111, 0x9112, 0x9113, 0x9114, - 0x9115, 0x9116, 0x9117, 0x9118, 0x911a, 0x911b, 0x911c, 0x911d, - 0x911f, 0x9120, 0x9121, 0x9124, 0x9125, 0x9126, 0x9127, 0x9128, - 0x9129, 0x912a, 0x912b, 0x912c, 0x912d, 0x912e, 0x9130, 0x9132, - 0x9133, 0x9134, 0x9135, 0x9136, 0x9137, 0x9138, 0x913a, 0x913b, - 0x913c, 0x913d, 0x913e, 0x913f, 0x9140, 0x9141, 0x9142, 0x9144, - 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, 0x555c, - 0x558b, 0x55d2, 0x5583, 0x55b1, 0x55b9, 0x5588, 0x5581, 0x559f, - 0x557e, 0x55d6, 0x5591, 0x557b, 0x55df, 0x55bd, 0x55be, 0x5594, - 0x5599, 0x55ea, 0x55f7, 0x55c9, 0x561f, 0x55d1, 0x55eb, 0x55ec, - 0x55d4, 0x55e6, 0x55dd, 0x55c4, 0x55ef, 0x55e5, 0x55f2, 0x55f3, - 0x55cc, 0x55cd, 0x55e8, 0x55f5, 0x55e4, 0x8f94, 0x561e, 0x5608, - 0x560c, 0x5601, 0x5624, 0x5623, 0x55fe, 0x5600, 0x5627, 0x562d, - 0x5658, 0x5639, 0x5657, 0x562c, 0x564d, 0x5662, 0x5659, 0x565c, - 0x564c, 0x5654, 0x5686, 0x5664, 0x5671, 0x566b, 0x567b, 0x567c, - 0x5685, 0x5693, 0x56af, 0x56d4, 0x56d7, 0x56dd, 0x56e1, 0x56f5, - 0x56eb, 0x56f9, 0x56ff, 0x5704, 0x570a, 0x5709, 0x571c, 0x5e0f, - 0x5e19, 0x5e14, 0x5e11, 0x5e31, 0x5e3b, 0x5e3c, - /* 0xe1 */ - 0x9145, 0x9147, 0x9148, 0x9151, 0x9153, 0x9154, 0x9155, 0x9156, - 0x9158, 0x9159, 0x915b, 0x915c, 0x915f, 0x9160, 0x9166, 0x9167, - 0x9168, 0x916b, 0x916d, 0x9173, 0x917a, 0x917b, 0x917c, 0x9180, - 0x9181, 0x9182, 0x9183, 0x9184, 0x9186, 0x9188, 0x918a, 0x918e, - 0x918f, 0x9193, 0x9194, 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, - 0x919c, 0x919d, 0x919e, 0x919f, 0x91a0, 0x91a1, 0x91a4, 0x91a5, - 0x91a6, 0x91a7, 0x91a8, 0x91a9, 0x91ab, 0x91ac, 0x91b0, 0x91b1, - 0x91b2, 0x91b3, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91bb, 0x91bc, - 0x91bd, 0x91be, 0x91bf, 0x91c0, 0x91c1, 0x91c2, 0x91c3, 0x91c4, - 0x91c5, 0x91c6, 0x91c8, 0x91cb, 0x91d0, 0x91d2, 0x91d3, 0x91d4, - 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0x91d9, 0x91da, 0x91db, 0x91dd, - 0x91de, 0x91df, 0x91e0, 0x91e1, 0x91e2, 0x91e3, 0x91e4, 0x91e5, - 0x5e37, 0x5e44, 0x5e54, 0x5e5b, 0x5e5e, 0x5e61, 0x5c8c, 0x5c7a, - 0x5c8d, 0x5c90, 0x5c96, 0x5c88, 0x5c98, 0x5c99, 0x5c91, 0x5c9a, - 0x5c9c, 0x5cb5, 0x5ca2, 0x5cbd, 0x5cac, 0x5cab, 0x5cb1, 0x5ca3, - 0x5cc1, 0x5cb7, 0x5cc4, 0x5cd2, 0x5ce4, 0x5ccb, 0x5ce5, 0x5d02, - 0x5d03, 0x5d27, 0x5d26, 0x5d2e, 0x5d24, 0x5d1e, 0x5d06, 0x5d1b, - 0x5d58, 0x5d3e, 0x5d34, 0x5d3d, 0x5d6c, 0x5d5b, 0x5d6f, 0x5d5d, - 0x5d6b, 0x5d4b, 0x5d4a, 0x5d69, 0x5d74, 0x5d82, 0x5d99, 0x5d9d, - 0x8c73, 0x5db7, 0x5dc5, 0x5f73, 0x5f77, 0x5f82, 0x5f87, 0x5f89, - 0x5f8c, 0x5f95, 0x5f99, 0x5f9c, 0x5fa8, 0x5fad, 0x5fb5, 0x5fbc, - 0x8862, 0x5f61, 0x72ad, 0x72b0, 0x72b4, 0x72b7, 0x72b8, 0x72c3, - 0x72c1, 0x72ce, 0x72cd, 0x72d2, 0x72e8, 0x72ef, 0x72e9, 0x72f2, - 0x72f4, 0x72f7, 0x7301, 0x72f3, 0x7303, 0x72fa, - /* 0xe2 */ - 0x91e6, 0x91e7, 0x91e8, 0x91e9, 0x91ea, 0x91eb, 0x91ec, 0x91ed, - 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f2, 0x91f3, 0x91f4, 0x91f5, - 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0x91fa, 0x91fb, 0x91fc, 0x91fd, - 0x91fe, 0x91ff, 0x9200, 0x9201, 0x9202, 0x9203, 0x9204, 0x9205, - 0x9206, 0x9207, 0x9208, 0x9209, 0x920a, 0x920b, 0x920c, 0x920d, - 0x920e, 0x920f, 0x9210, 0x9211, 0x9212, 0x9213, 0x9214, 0x9215, - 0x9216, 0x9217, 0x9218, 0x9219, 0x921a, 0x921b, 0x921c, 0x921d, - 0x921e, 0x921f, 0x9220, 0x9221, 0x9222, 0x9223, 0x9224, 0x9225, - 0x9226, 0x9227, 0x9228, 0x9229, 0x922a, 0x922b, 0x922c, 0x922d, - 0x922e, 0x922f, 0x9230, 0x9231, 0x9232, 0x9233, 0x9234, 0x9235, - 0x9236, 0x9237, 0x9238, 0x9239, 0x923a, 0x923b, 0x923c, 0x923d, - 0x923e, 0x923f, 0x9240, 0x9241, 0x9242, 0x9243, 0x9244, 0x9245, - 0x72fb, 0x7317, 0x7313, 0x7321, 0x730a, 0x731e, 0x731d, 0x7315, - 0x7322, 0x7339, 0x7325, 0x732c, 0x7338, 0x7331, 0x7350, 0x734d, - 0x7357, 0x7360, 0x736c, 0x736f, 0x737e, 0x821b, 0x5925, 0x98e7, - 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, - 0x996c, 0x9974, 0x9977, 0x997d, 0x9980, 0x9984, 0x9987, 0x998a, - 0x998d, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5e80, 0x5e91, - 0x5e8b, 0x5e96, 0x5ea5, 0x5ea0, 0x5eb9, 0x5eb5, 0x5ebe, 0x5eb3, - 0x8d53, 0x5ed2, 0x5ed1, 0x5edb, 0x5ee8, 0x5eea, 0x81ba, 0x5fc4, - 0x5fc9, 0x5fd6, 0x5fcf, 0x6003, 0x5fee, 0x6004, 0x5fe1, 0x5fe4, - 0x5ffe, 0x6005, 0x6006, 0x5fea, 0x5fed, 0x5ff8, 0x6019, 0x6035, - 0x6026, 0x601b, 0x600f, 0x600d, 0x6029, 0x602b, 0x600a, 0x603f, - 0x6021, 0x6078, 0x6079, 0x607b, 0x607a, 0x6042, - /* 0xe3 */ - 0x9246, 0x9247, 0x9248, 0x9249, 0x924a, 0x924b, 0x924c, 0x924d, - 0x924e, 0x924f, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, - 0x9256, 0x9257, 0x9258, 0x9259, 0x925a, 0x925b, 0x925c, 0x925d, - 0x925e, 0x925f, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, - 0x9266, 0x9267, 0x9268, 0x9269, 0x926a, 0x926b, 0x926c, 0x926d, - 0x926e, 0x926f, 0x9270, 0x9271, 0x9272, 0x9273, 0x9275, 0x9276, - 0x9277, 0x9278, 0x9279, 0x927a, 0x927b, 0x927c, 0x927d, 0x927e, - 0x927f, 0x9280, 0x9281, 0x9282, 0x9283, 0x9284, 0x9285, 0x9286, - 0x9287, 0x9288, 0x9289, 0x928a, 0x928b, 0x928c, 0x928d, 0x928f, - 0x9290, 0x9291, 0x9292, 0x9293, 0x9294, 0x9295, 0x9296, 0x9297, - 0x9298, 0x9299, 0x929a, 0x929b, 0x929c, 0x929d, 0x929e, 0x929f, - 0x92a0, 0x92a1, 0x92a2, 0x92a3, 0x92a4, 0x92a5, 0x92a6, 0x92a7, - 0x606a, 0x607d, 0x6096, 0x609a, 0x60ad, 0x609d, 0x6083, 0x6092, - 0x608c, 0x609b, 0x60ec, 0x60bb, 0x60b1, 0x60dd, 0x60d8, 0x60c6, - 0x60da, 0x60b4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60f4, 0x6100, - 0x610e, 0x612b, 0x614a, 0x6175, 0x61ac, 0x6194, 0x61a7, 0x61b7, - 0x61d4, 0x61f5, 0x5fdd, 0x96b3, 0x95e9, 0x95eb, 0x95f1, 0x95f3, - 0x95f5, 0x95f6, 0x95fc, 0x95fe, 0x9603, 0x9604, 0x9606, 0x9608, - 0x960a, 0x960b, 0x960c, 0x960d, 0x960f, 0x9612, 0x9615, 0x9616, - 0x9617, 0x9619, 0x961a, 0x4e2c, 0x723f, 0x6215, 0x6c35, 0x6c54, - 0x6c5c, 0x6c4a, 0x6ca3, 0x6c85, 0x6c90, 0x6c94, 0x6c8c, 0x6c68, - 0x6c69, 0x6c74, 0x6c76, 0x6c86, 0x6ca9, 0x6cd0, 0x6cd4, 0x6cad, - 0x6cf7, 0x6cf8, 0x6cf1, 0x6cd7, 0x6cb2, 0x6ce0, 0x6cd6, 0x6cfa, - 0x6ceb, 0x6cee, 0x6cb1, 0x6cd3, 0x6cef, 0x6cfe, - /* 0xe4 */ - 0x92a8, 0x92a9, 0x92aa, 0x92ab, 0x92ac, 0x92ad, 0x92af, 0x92b0, - 0x92b1, 0x92b2, 0x92b3, 0x92b4, 0x92b5, 0x92b6, 0x92b7, 0x92b8, - 0x92b9, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92be, 0x92bf, 0x92c0, - 0x92c1, 0x92c2, 0x92c3, 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0x92c9, - 0x92ca, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92cf, 0x92d0, 0x92d1, - 0x92d2, 0x92d3, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0x92d8, 0x92d9, - 0x92da, 0x92db, 0x92dc, 0x92dd, 0x92de, 0x92df, 0x92e0, 0x92e1, - 0x92e2, 0x92e3, 0x92e4, 0x92e5, 0x92e6, 0x92e7, 0x92e8, 0x92e9, - 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, 0x92f1, - 0x92f2, 0x92f3, 0x92f4, 0x92f5, 0x92f6, 0x92f7, 0x92f8, 0x92f9, - 0x92fa, 0x92fb, 0x92fc, 0x92fd, 0x92fe, 0x92ff, 0x9300, 0x9301, - 0x9302, 0x9303, 0x9304, 0x9305, 0x9306, 0x9307, 0x9308, 0x9309, - 0x6d39, 0x6d27, 0x6d0c, 0x6d43, 0x6d48, 0x6d07, 0x6d04, 0x6d19, - 0x6d0e, 0x6d2b, 0x6d4d, 0x6d2e, 0x6d35, 0x6d1a, 0x6d4f, 0x6d52, - 0x6d54, 0x6d33, 0x6d91, 0x6d6f, 0x6d9e, 0x6da0, 0x6d5e, 0x6d93, - 0x6d94, 0x6d5c, 0x6d60, 0x6d7c, 0x6d63, 0x6e1a, 0x6dc7, 0x6dc5, - 0x6dde, 0x6e0e, 0x6dbf, 0x6de0, 0x6e11, 0x6de6, 0x6ddd, 0x6dd9, - 0x6e16, 0x6dab, 0x6e0c, 0x6dae, 0x6e2b, 0x6e6e, 0x6e4e, 0x6e6b, - 0x6eb2, 0x6e5f, 0x6e86, 0x6e53, 0x6e54, 0x6e32, 0x6e25, 0x6e44, - 0x6edf, 0x6eb1, 0x6e98, 0x6ee0, 0x6f2d, 0x6ee2, 0x6ea5, 0x6ea7, - 0x6ebd, 0x6ebb, 0x6eb7, 0x6ed7, 0x6eb4, 0x6ecf, 0x6e8f, 0x6ec2, - 0x6e9f, 0x6f62, 0x6f46, 0x6f47, 0x6f24, 0x6f15, 0x6ef9, 0x6f2f, - 0x6f36, 0x6f4b, 0x6f74, 0x6f2a, 0x6f09, 0x6f29, 0x6f89, 0x6f8d, - 0x6f8c, 0x6f78, 0x6f72, 0x6f7c, 0x6f7a, 0x6fd1, - /* 0xe5 */ - 0x930a, 0x930b, 0x930c, 0x930d, 0x930e, 0x930f, 0x9310, 0x9311, - 0x9312, 0x9313, 0x9314, 0x9315, 0x9316, 0x9317, 0x9318, 0x9319, - 0x931a, 0x931b, 0x931c, 0x931d, 0x931e, 0x931f, 0x9320, 0x9321, - 0x9322, 0x9323, 0x9324, 0x9325, 0x9326, 0x9327, 0x9328, 0x9329, - 0x932a, 0x932b, 0x932c, 0x932d, 0x932e, 0x932f, 0x9330, 0x9331, - 0x9332, 0x9333, 0x9334, 0x9335, 0x9336, 0x9337, 0x9338, 0x9339, - 0x933a, 0x933b, 0x933c, 0x933d, 0x933f, 0x9340, 0x9341, 0x9342, - 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, 0x934a, - 0x934b, 0x934c, 0x934d, 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, - 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, 0x935a, - 0x935b, 0x935c, 0x935d, 0x935e, 0x935f, 0x9360, 0x9361, 0x9362, - 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, 0x936b, - 0x6fc9, 0x6fa7, 0x6fb9, 0x6fb6, 0x6fc2, 0x6fe1, 0x6fee, 0x6fde, - 0x6fe0, 0x6fef, 0x701a, 0x7023, 0x701b, 0x7039, 0x7035, 0x704f, - 0x705e, 0x5b80, 0x5b84, 0x5b95, 0x5b93, 0x5ba5, 0x5bb8, 0x752f, - 0x9a9e, 0x6434, 0x5be4, 0x5bee, 0x8930, 0x5bf0, 0x8e47, 0x8b07, - 0x8fb6, 0x8fd3, 0x8fd5, 0x8fe5, 0x8fee, 0x8fe4, 0x8fe9, 0x8fe6, - 0x8ff3, 0x8fe8, 0x9005, 0x9004, 0x900b, 0x9026, 0x9011, 0x900d, - 0x9016, 0x9021, 0x9035, 0x9036, 0x902d, 0x902f, 0x9044, 0x9051, - 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905b, 0x66b9, 0x9074, - 0x907d, 0x9082, 0x9088, 0x9083, 0x908b, 0x5f50, 0x5f57, 0x5f56, - 0x5f58, 0x5c3b, 0x54ab, 0x5c50, 0x5c59, 0x5b71, 0x5c63, 0x5c66, - 0x7fbc, 0x5f2a, 0x5f29, 0x5f2d, 0x8274, 0x5f3c, 0x9b3b, 0x5c6e, - 0x5981, 0x5983, 0x598d, 0x59a9, 0x59aa, 0x59a3, - /* 0xe6 */ - 0x936c, 0x936d, 0x936e, 0x936f, 0x9370, 0x9371, 0x9372, 0x9373, - 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, 0x937a, 0x937b, - 0x937c, 0x937d, 0x937e, 0x937f, 0x9380, 0x9381, 0x9382, 0x9383, - 0x9384, 0x9385, 0x9386, 0x9387, 0x9388, 0x9389, 0x938a, 0x938b, - 0x938c, 0x938d, 0x938e, 0x9390, 0x9391, 0x9392, 0x9393, 0x9394, - 0x9395, 0x9396, 0x9397, 0x9398, 0x9399, 0x939a, 0x939b, 0x939c, - 0x939d, 0x939e, 0x939f, 0x93a0, 0x93a1, 0x93a2, 0x93a3, 0x93a4, - 0x93a5, 0x93a6, 0x93a7, 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, - 0x93ad, 0x93ae, 0x93af, 0x93b0, 0x93b1, 0x93b2, 0x93b3, 0x93b4, - 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, - 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, 0x93c2, 0x93c3, 0x93c4, - 0x93c5, 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93cb, 0x93cc, 0x93cd, - 0x5997, 0x59ca, 0x59ab, 0x599e, 0x59a4, 0x59d2, 0x59b2, 0x59af, - 0x59d7, 0x59be, 0x5a05, 0x5a06, 0x59dd, 0x5a08, 0x59e3, 0x59d8, - 0x59f9, 0x5a0c, 0x5a09, 0x5a32, 0x5a34, 0x5a11, 0x5a23, 0x5a13, - 0x5a40, 0x5a67, 0x5a4a, 0x5a55, 0x5a3c, 0x5a62, 0x5a75, 0x80ec, - 0x5aaa, 0x5a9b, 0x5a77, 0x5a7a, 0x5abe, 0x5aeb, 0x5ab2, 0x5ad2, - 0x5ad4, 0x5ab8, 0x5ae0, 0x5ae3, 0x5af1, 0x5ad6, 0x5ae6, 0x5ad8, - 0x5adc, 0x5b09, 0x5b17, 0x5b16, 0x5b32, 0x5b37, 0x5b40, 0x5c15, - 0x5c1c, 0x5b5a, 0x5b65, 0x5b73, 0x5b51, 0x5b53, 0x5b62, 0x9a75, - 0x9a77, 0x9a78, 0x9a7a, 0x9a7f, 0x9a7d, 0x9a80, 0x9a81, 0x9a85, - 0x9a88, 0x9a8a, 0x9a90, 0x9a92, 0x9a93, 0x9a96, 0x9a98, 0x9a9b, - 0x9a9c, 0x9a9d, 0x9a9f, 0x9aa0, 0x9aa2, 0x9aa3, 0x9aa5, 0x9aa7, - 0x7e9f, 0x7ea1, 0x7ea3, 0x7ea5, 0x7ea8, 0x7ea9, - /* 0xe7 */ - 0x93ce, 0x93cf, 0x93d0, 0x93d1, 0x93d2, 0x93d3, 0x93d4, 0x93d5, - 0x93d7, 0x93d8, 0x93d9, 0x93da, 0x93db, 0x93dc, 0x93dd, 0x93de, - 0x93df, 0x93e0, 0x93e1, 0x93e2, 0x93e3, 0x93e4, 0x93e5, 0x93e6, - 0x93e7, 0x93e8, 0x93e9, 0x93ea, 0x93eb, 0x93ec, 0x93ed, 0x93ee, - 0x93ef, 0x93f0, 0x93f1, 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, - 0x93f7, 0x93f8, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0x93fd, 0x93fe, - 0x93ff, 0x9400, 0x9401, 0x9402, 0x9403, 0x9404, 0x9405, 0x9406, - 0x9407, 0x9408, 0x9409, 0x940a, 0x940b, 0x940c, 0x940d, 0x940e, - 0x940f, 0x9410, 0x9411, 0x9412, 0x9413, 0x9414, 0x9415, 0x9416, - 0x9417, 0x9418, 0x9419, 0x941a, 0x941b, 0x941c, 0x941d, 0x941e, - 0x941f, 0x9420, 0x9421, 0x9422, 0x9423, 0x9424, 0x9425, 0x9426, - 0x9427, 0x9428, 0x9429, 0x942a, 0x942b, 0x942c, 0x942d, 0x942e, - 0x7ead, 0x7eb0, 0x7ebe, 0x7ec0, 0x7ec1, 0x7ec2, 0x7ec9, 0x7ecb, - 0x7ecc, 0x7ed0, 0x7ed4, 0x7ed7, 0x7edb, 0x7ee0, 0x7ee1, 0x7ee8, - 0x7eeb, 0x7eee, 0x7eef, 0x7ef1, 0x7ef2, 0x7f0d, 0x7ef6, 0x7efa, - 0x7efb, 0x7efe, 0x7f01, 0x7f02, 0x7f03, 0x7f07, 0x7f08, 0x7f0b, - 0x7f0c, 0x7f0f, 0x7f11, 0x7f12, 0x7f17, 0x7f19, 0x7f1c, 0x7f1b, - 0x7f1f, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27, - 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2f, 0x7f30, 0x7f31, 0x7f32, - 0x7f33, 0x7f35, 0x5e7a, 0x757f, 0x5ddb, 0x753e, 0x9095, 0x738e, - 0x7391, 0x73ae, 0x73a2, 0x739f, 0x73cf, 0x73c2, 0x73d1, 0x73b7, - 0x73b3, 0x73c0, 0x73c9, 0x73c8, 0x73e5, 0x73d9, 0x987c, 0x740a, - 0x73e9, 0x73e7, 0x73de, 0x73ba, 0x73f2, 0x740f, 0x742a, 0x745b, - 0x7426, 0x7425, 0x7428, 0x7430, 0x742e, 0x742c, - /* 0xe8 */ - 0x942f, 0x9430, 0x9431, 0x9432, 0x9433, 0x9434, 0x9435, 0x9436, - 0x9437, 0x9438, 0x9439, 0x943a, 0x943b, 0x943c, 0x943d, 0x943f, - 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, 0x9445, 0x9446, 0x9447, - 0x9448, 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, - 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, - 0x9458, 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, - 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, - 0x9468, 0x9469, 0x946a, 0x946c, 0x946d, 0x946e, 0x946f, 0x9470, - 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, 0x9476, 0x9477, 0x9478, - 0x9479, 0x947a, 0x947b, 0x947c, 0x947d, 0x947e, 0x947f, 0x9480, - 0x9481, 0x9482, 0x9483, 0x9484, 0x9491, 0x9496, 0x9498, 0x94c7, - 0x94cf, 0x94d3, 0x94d4, 0x94da, 0x94e6, 0x94fb, 0x951c, 0x9520, - 0x741b, 0x741a, 0x7441, 0x745c, 0x7457, 0x7455, 0x7459, 0x7477, - 0x746d, 0x747e, 0x749c, 0x748e, 0x7480, 0x7481, 0x7487, 0x748b, - 0x749e, 0x74a8, 0x74a9, 0x7490, 0x74a7, 0x74d2, 0x74ba, 0x97ea, - 0x97eb, 0x97ec, 0x674c, 0x6753, 0x675e, 0x6748, 0x6769, 0x67a5, - 0x6787, 0x676a, 0x6773, 0x6798, 0x67a7, 0x6775, 0x67a8, 0x679e, - 0x67ad, 0x678b, 0x6777, 0x677c, 0x67f0, 0x6809, 0x67d8, 0x680a, - 0x67e9, 0x67b0, 0x680c, 0x67d9, 0x67b5, 0x67da, 0x67b3, 0x67dd, - 0x6800, 0x67c3, 0x67b8, 0x67e2, 0x680e, 0x67c1, 0x67fd, 0x6832, - 0x6833, 0x6860, 0x6861, 0x684e, 0x6862, 0x6844, 0x6864, 0x6883, - 0x681d, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683e, 0x684a, - 0x6849, 0x6829, 0x68b5, 0x688f, 0x6874, 0x6877, 0x6893, 0x686b, - 0x68c2, 0x696e, 0x68fc, 0x691f, 0x6920, 0x68f9, - /* 0xe9 */ - 0x9527, 0x9533, 0x953d, 0x9543, 0x9548, 0x954b, 0x9555, 0x955a, - 0x9560, 0x956e, 0x9574, 0x9575, 0x9577, 0x9578, 0x9579, 0x957a, - 0x957b, 0x957c, 0x957d, 0x957e, 0x9580, 0x9581, 0x9582, 0x9583, - 0x9584, 0x9585, 0x9586, 0x9587, 0x9588, 0x9589, 0x958a, 0x958b, - 0x958c, 0x958d, 0x958e, 0x958f, 0x9590, 0x9591, 0x9592, 0x9593, - 0x9594, 0x9595, 0x9596, 0x9597, 0x9598, 0x9599, 0x959a, 0x959b, - 0x959c, 0x959d, 0x959e, 0x959f, 0x95a0, 0x95a1, 0x95a2, 0x95a3, - 0x95a4, 0x95a5, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0x95aa, 0x95ab, - 0x95ac, 0x95ad, 0x95ae, 0x95af, 0x95b0, 0x95b1, 0x95b2, 0x95b3, - 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0x95b8, 0x95b9, 0x95ba, 0x95bb, - 0x95bc, 0x95bd, 0x95be, 0x95bf, 0x95c0, 0x95c1, 0x95c2, 0x95c3, - 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0x95ca, 0x95cb, - 0x6924, 0x68f0, 0x690b, 0x6901, 0x6957, 0x68e3, 0x6910, 0x6971, - 0x6939, 0x6960, 0x6942, 0x695d, 0x6984, 0x696b, 0x6980, 0x6998, - 0x6978, 0x6934, 0x69cc, 0x6987, 0x6988, 0x69ce, 0x6989, 0x6966, - 0x6963, 0x6979, 0x699b, 0x69a7, 0x69bb, 0x69ab, 0x69ad, 0x69d4, - 0x69b1, 0x69c1, 0x69ca, 0x69df, 0x6995, 0x69e0, 0x698d, 0x69ff, - 0x6a2f, 0x69ed, 0x6a17, 0x6a18, 0x6a65, 0x69f2, 0x6a44, 0x6a3e, - 0x6aa0, 0x6a50, 0x6a5b, 0x6a35, 0x6a8e, 0x6a79, 0x6a3d, 0x6a28, - 0x6a58, 0x6a7c, 0x6a91, 0x6a90, 0x6aa9, 0x6a97, 0x6aab, 0x7337, - 0x7352, 0x6b81, 0x6b82, 0x6b87, 0x6b84, 0x6b92, 0x6b93, 0x6b8d, - 0x6b9a, 0x6b9b, 0x6ba1, 0x6baa, 0x8f6b, 0x8f6d, 0x8f71, 0x8f72, - 0x8f73, 0x8f75, 0x8f76, 0x8f78, 0x8f77, 0x8f79, 0x8f7a, 0x8f7c, - 0x8f7e, 0x8f81, 0x8f82, 0x8f84, 0x8f87, 0x8f8b, - /* 0xea */ - 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, 0x95d3, - 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0x95d9, 0x95da, 0x95db, - 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, 0x95e3, - 0x95e4, 0x95e5, 0x95e6, 0x95e7, 0x95ec, 0x95ff, 0x9607, 0x9613, - 0x9618, 0x961b, 0x961e, 0x9620, 0x9623, 0x9624, 0x9625, 0x9626, - 0x9627, 0x9628, 0x9629, 0x962b, 0x962c, 0x962d, 0x962f, 0x9630, - 0x9637, 0x9638, 0x9639, 0x963a, 0x963e, 0x9641, 0x9643, 0x964a, - 0x964e, 0x964f, 0x9651, 0x9652, 0x9653, 0x9656, 0x9657, 0x9658, - 0x9659, 0x965a, 0x965c, 0x965d, 0x965e, 0x9660, 0x9663, 0x9665, - 0x9666, 0x966b, 0x966d, 0x966e, 0x966f, 0x9670, 0x9671, 0x9673, - 0x9678, 0x9679, 0x967a, 0x967b, 0x967c, 0x967d, 0x967e, 0x967f, - 0x9680, 0x9681, 0x9682, 0x9683, 0x9684, 0x9687, 0x9689, 0x968a, - 0x8f8d, 0x8f8e, 0x8f8f, 0x8f98, 0x8f9a, 0x8ece, 0x620b, 0x6217, - 0x621b, 0x621f, 0x6222, 0x6221, 0x6225, 0x6224, 0x622c, 0x81e7, - 0x74ef, 0x74f4, 0x74ff, 0x750f, 0x7511, 0x7513, 0x6534, 0x65ee, - 0x65ef, 0x65f0, 0x660a, 0x6619, 0x6772, 0x6603, 0x6615, 0x6600, - 0x7085, 0x66f7, 0x661d, 0x6634, 0x6631, 0x6636, 0x6635, 0x8006, - 0x665f, 0x6654, 0x6641, 0x664f, 0x6656, 0x6661, 0x6657, 0x6677, - 0x6684, 0x668c, 0x66a7, 0x669d, 0x66be, 0x66db, 0x66dc, 0x66e6, - 0x66e9, 0x8d32, 0x8d33, 0x8d36, 0x8d3b, 0x8d3d, 0x8d40, 0x8d45, - 0x8d46, 0x8d48, 0x8d49, 0x8d47, 0x8d4d, 0x8d55, 0x8d59, 0x89c7, - 0x89ca, 0x89cb, 0x89cc, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x726e, - 0x729f, 0x725d, 0x7266, 0x726f, 0x727e, 0x727f, 0x7284, 0x728b, - 0x728d, 0x728f, 0x7292, 0x6308, 0x6332, 0x63b0, - /* 0xeb */ - 0x968c, 0x968e, 0x9691, 0x9692, 0x9693, 0x9695, 0x9696, 0x969a, - 0x969b, 0x969d, 0x969e, 0x969f, 0x96a0, 0x96a1, 0x96a2, 0x96a3, - 0x96a4, 0x96a5, 0x96a6, 0x96a8, 0x96a9, 0x96aa, 0x96ab, 0x96ac, - 0x96ad, 0x96ae, 0x96af, 0x96b1, 0x96b2, 0x96b4, 0x96b5, 0x96b7, - 0x96b8, 0x96ba, 0x96bb, 0x96bf, 0x96c2, 0x96c3, 0x96c8, 0x96ca, - 0x96cb, 0x96d0, 0x96d1, 0x96d3, 0x96d4, 0x96d6, 0x96d7, 0x96d8, - 0x96d9, 0x96da, 0x96db, 0x96dc, 0x96dd, 0x96de, 0x96df, 0x96e1, - 0x96e2, 0x96e3, 0x96e4, 0x96e5, 0x96e6, 0x96e7, 0x96eb, 0x96ec, - 0x96ed, 0x96ee, 0x96f0, 0x96f1, 0x96f2, 0x96f4, 0x96f5, 0x96f8, - 0x96fa, 0x96fb, 0x96fc, 0x96fd, 0x96ff, 0x9702, 0x9703, 0x9705, - 0x970a, 0x970b, 0x970c, 0x9710, 0x9711, 0x9712, 0x9714, 0x9715, - 0x9717, 0x9718, 0x9719, 0x971a, 0x971b, 0x971d, 0x971f, 0x9720, - 0x643f, 0x64d8, 0x8004, 0x6bea, 0x6bf3, 0x6bfd, 0x6bf5, 0x6bf9, - 0x6c05, 0x6c07, 0x6c06, 0x6c0d, 0x6c15, 0x6c18, 0x6c19, 0x6c1a, - 0x6c21, 0x6c29, 0x6c24, 0x6c2a, 0x6c32, 0x6535, 0x6555, 0x656b, - 0x724d, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809f, 0x809c, - 0x8093, 0x80bc, 0x670a, 0x80bd, 0x80b1, 0x80ab, 0x80ad, 0x80b4, - 0x80b7, 0x80e7, 0x80e8, 0x80e9, 0x80ea, 0x80db, 0x80c2, 0x80c4, - 0x80d9, 0x80cd, 0x80d7, 0x6710, 0x80dd, 0x80eb, 0x80f1, 0x80f4, - 0x80ed, 0x810d, 0x810e, 0x80f2, 0x80fc, 0x6715, 0x8112, 0x8c5a, - 0x8136, 0x811e, 0x812c, 0x8118, 0x8132, 0x8148, 0x814c, 0x8153, - 0x8174, 0x8159, 0x815a, 0x8171, 0x8160, 0x8169, 0x817c, 0x817d, - 0x816d, 0x8167, 0x584d, 0x5ab5, 0x8188, 0x8182, 0x8191, 0x6ed5, - 0x81a3, 0x81aa, 0x81cc, 0x6726, 0x81ca, 0x81bb, - /* 0xec */ - 0x9721, 0x9722, 0x9723, 0x9724, 0x9725, 0x9726, 0x9727, 0x9728, - 0x9729, 0x972b, 0x972c, 0x972e, 0x972f, 0x9731, 0x9733, 0x9734, - 0x9735, 0x9736, 0x9737, 0x973a, 0x973b, 0x973c, 0x973d, 0x973f, - 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, 0x9746, 0x9747, - 0x9748, 0x9749, 0x974a, 0x974b, 0x974c, 0x974d, 0x974e, 0x974f, - 0x9750, 0x9751, 0x9754, 0x9755, 0x9757, 0x9758, 0x975a, 0x975c, - 0x975d, 0x975f, 0x9763, 0x9764, 0x9766, 0x9767, 0x9768, 0x976a, - 0x976b, 0x976c, 0x976d, 0x976e, 0x976f, 0x9770, 0x9771, 0x9772, - 0x9775, 0x9777, 0x9778, 0x9779, 0x977a, 0x977b, 0x977d, 0x977e, - 0x977f, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9786, 0x9787, - 0x9788, 0x9789, 0x978a, 0x978c, 0x978e, 0x978f, 0x9790, 0x9793, - 0x9795, 0x9796, 0x9797, 0x9799, 0x979a, 0x979b, 0x979c, 0x979d, - 0x81c1, 0x81a6, 0x6b24, 0x6b37, 0x6b39, 0x6b43, 0x6b46, 0x6b59, - 0x98d1, 0x98d2, 0x98d3, 0x98d5, 0x98d9, 0x98da, 0x6bb3, 0x5f40, - 0x6bc2, 0x89f3, 0x6590, 0x9f51, 0x6593, 0x65bc, 0x65c6, 0x65c4, - 0x65c3, 0x65cc, 0x65ce, 0x65d2, 0x65d6, 0x7080, 0x709c, 0x7096, - 0x709d, 0x70bb, 0x70c0, 0x70b7, 0x70ab, 0x70b1, 0x70e8, 0x70ca, - 0x7110, 0x7113, 0x7116, 0x712f, 0x7131, 0x7173, 0x715c, 0x7168, - 0x7145, 0x7172, 0x714a, 0x7178, 0x717a, 0x7198, 0x71b3, 0x71b5, - 0x71a8, 0x71a0, 0x71e0, 0x71d4, 0x71e7, 0x71f9, 0x721d, 0x7228, - 0x706c, 0x7118, 0x7166, 0x71b9, 0x623e, 0x623d, 0x6243, 0x6248, - 0x6249, 0x793b, 0x7940, 0x7946, 0x7949, 0x795b, 0x795c, 0x7953, - 0x795a, 0x7962, 0x7957, 0x7960, 0x796f, 0x7967, 0x797a, 0x7985, - 0x798a, 0x799a, 0x79a7, 0x79b3, 0x5fd1, 0x5fd0, - /* 0xed */ - 0x979e, 0x979f, 0x97a1, 0x97a2, 0x97a4, 0x97a5, 0x97a6, 0x97a7, - 0x97a8, 0x97a9, 0x97aa, 0x97ac, 0x97ae, 0x97b0, 0x97b1, 0x97b3, - 0x97b5, 0x97b6, 0x97b7, 0x97b8, 0x97b9, 0x97ba, 0x97bb, 0x97bc, - 0x97bd, 0x97be, 0x97bf, 0x97c0, 0x97c1, 0x97c2, 0x97c3, 0x97c4, - 0x97c5, 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, - 0x97cd, 0x97ce, 0x97cf, 0x97d0, 0x97d1, 0x97d2, 0x97d3, 0x97d4, - 0x97d5, 0x97d6, 0x97d7, 0x97d8, 0x97d9, 0x97da, 0x97db, 0x97dc, - 0x97dd, 0x97de, 0x97df, 0x97e0, 0x97e1, 0x97e2, 0x97e3, 0x97e4, - 0x97e5, 0x97e8, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f4, - 0x97f7, 0x97f8, 0x97f9, 0x97fa, 0x97fb, 0x97fc, 0x97fd, 0x97fe, - 0x97ff, 0x9800, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, 0x9806, - 0x9807, 0x9808, 0x9809, 0x980a, 0x980b, 0x980c, 0x980d, 0x980e, - 0x603c, 0x605d, 0x605a, 0x6067, 0x6041, 0x6059, 0x6063, 0x60ab, - 0x6106, 0x610d, 0x615d, 0x61a9, 0x619d, 0x61cb, 0x61d1, 0x6206, - 0x8080, 0x807f, 0x6c93, 0x6cf6, 0x6dfc, 0x77f6, 0x77f8, 0x7800, - 0x7809, 0x7817, 0x7818, 0x7811, 0x65ab, 0x782d, 0x781c, 0x781d, - 0x7839, 0x783a, 0x783b, 0x781f, 0x783c, 0x7825, 0x782c, 0x7823, - 0x7829, 0x784e, 0x786d, 0x7856, 0x7857, 0x7826, 0x7850, 0x7847, - 0x784c, 0x786a, 0x789b, 0x7893, 0x789a, 0x7887, 0x789c, 0x78a1, - 0x78a3, 0x78b2, 0x78b9, 0x78a5, 0x78d4, 0x78d9, 0x78c9, 0x78ec, - 0x78f2, 0x7905, 0x78f4, 0x7913, 0x7924, 0x791e, 0x7934, 0x9f9b, - 0x9ef9, 0x9efb, 0x9efc, 0x76f1, 0x7704, 0x770d, 0x76f9, 0x7707, - 0x7708, 0x771a, 0x7722, 0x7719, 0x772d, 0x7726, 0x7735, 0x7738, - 0x7750, 0x7751, 0x7747, 0x7743, 0x775a, 0x7768, - /* 0xee */ - 0x980f, 0x9810, 0x9811, 0x9812, 0x9813, 0x9814, 0x9815, 0x9816, - 0x9817, 0x9818, 0x9819, 0x981a, 0x981b, 0x981c, 0x981d, 0x981e, - 0x981f, 0x9820, 0x9821, 0x9822, 0x9823, 0x9824, 0x9825, 0x9826, - 0x9827, 0x9828, 0x9829, 0x982a, 0x982b, 0x982c, 0x982d, 0x982e, - 0x982f, 0x9830, 0x9831, 0x9832, 0x9833, 0x9834, 0x9835, 0x9836, - 0x9837, 0x9838, 0x9839, 0x983a, 0x983b, 0x983c, 0x983d, 0x983e, - 0x983f, 0x9840, 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, - 0x9847, 0x9848, 0x9849, 0x984a, 0x984b, 0x984c, 0x984d, 0x984e, - 0x984f, 0x9850, 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, 0x9856, - 0x9857, 0x9858, 0x9859, 0x985a, 0x985b, 0x985c, 0x985d, 0x985e, - 0x985f, 0x9860, 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, 0x9866, - 0x9867, 0x9868, 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, - 0x7762, 0x7765, 0x777f, 0x778d, 0x777d, 0x7780, 0x778c, 0x7791, - 0x779f, 0x77a0, 0x77b0, 0x77b5, 0x77bd, 0x753a, 0x7540, 0x754e, - 0x754b, 0x7548, 0x755b, 0x7572, 0x7579, 0x7583, 0x7f58, 0x7f61, - 0x7f5f, 0x8a48, 0x7f68, 0x7f74, 0x7f71, 0x7f79, 0x7f81, 0x7f7e, - 0x76cd, 0x76e5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948b, 0x948a, - 0x948c, 0x948d, 0x948f, 0x9490, 0x9494, 0x9497, 0x9495, 0x949a, - 0x949b, 0x949c, 0x94a3, 0x94a4, 0x94ab, 0x94aa, 0x94ad, 0x94ac, - 0x94af, 0x94b0, 0x94b2, 0x94b4, 0x94b6, 0x94b7, 0x94b8, 0x94b9, - 0x94ba, 0x94bc, 0x94bd, 0x94bf, 0x94c4, 0x94c8, 0x94c9, 0x94ca, - 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94d0, 0x94d1, 0x94d2, 0x94d5, - 0x94d6, 0x94d7, 0x94d9, 0x94d8, 0x94db, 0x94de, 0x94df, 0x94e0, - 0x94e2, 0x94e4, 0x94e5, 0x94e7, 0x94e8, 0x94ea, - /* 0xef */ - 0x986f, 0x9870, 0x9871, 0x9872, 0x9873, 0x9874, 0x988b, 0x988e, - 0x9892, 0x9895, 0x9899, 0x98a3, 0x98a8, 0x98a9, 0x98aa, 0x98ab, - 0x98ac, 0x98ad, 0x98ae, 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, - 0x98b4, 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, - 0x98bc, 0x98bd, 0x98be, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, - 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0x98cb, - 0x98cc, 0x98cd, 0x98cf, 0x98d0, 0x98d4, 0x98d6, 0x98d7, 0x98db, - 0x98dc, 0x98dd, 0x98e0, 0x98e1, 0x98e2, 0x98e3, 0x98e4, 0x98e5, - 0x98e6, 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0x98ed, 0x98ee, 0x98ef, - 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, 0x98f7, - 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, 0x98fe, 0x98ff, - 0x9900, 0x9901, 0x9902, 0x9903, 0x9904, 0x9905, 0x9906, 0x9907, - 0x94e9, 0x94eb, 0x94ee, 0x94ef, 0x94f3, 0x94f4, 0x94f5, 0x94f7, - 0x94f9, 0x94fc, 0x94fd, 0x94ff, 0x9503, 0x9502, 0x9506, 0x9507, - 0x9509, 0x950a, 0x950d, 0x950e, 0x950f, 0x9512, 0x9513, 0x9514, - 0x9515, 0x9516, 0x9518, 0x951b, 0x951d, 0x951e, 0x951f, 0x9522, - 0x952a, 0x952b, 0x9529, 0x952c, 0x9531, 0x9532, 0x9534, 0x9536, - 0x9537, 0x9538, 0x953c, 0x953e, 0x953f, 0x9542, 0x9535, 0x9544, - 0x9545, 0x9546, 0x9549, 0x954c, 0x954e, 0x954f, 0x9552, 0x9553, - 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955b, 0x955e, 0x955f, - 0x955d, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, - 0x9569, 0x956a, 0x956b, 0x956c, 0x956f, 0x9571, 0x9572, 0x9573, - 0x953a, 0x77e7, 0x77ec, 0x96c9, 0x79d5, 0x79ed, 0x79e3, 0x79eb, - 0x7a06, 0x5d47, 0x7a03, 0x7a02, 0x7a1e, 0x7a14, - /* 0xf0 */ - 0x9908, 0x9909, 0x990a, 0x990b, 0x990c, 0x990e, 0x990f, 0x9911, - 0x9912, 0x9913, 0x9914, 0x9915, 0x9916, 0x9917, 0x9918, 0x9919, - 0x991a, 0x991b, 0x991c, 0x991d, 0x991e, 0x991f, 0x9920, 0x9921, - 0x9922, 0x9923, 0x9924, 0x9925, 0x9926, 0x9927, 0x9928, 0x9929, - 0x992a, 0x992b, 0x992c, 0x992d, 0x992f, 0x9930, 0x9931, 0x9932, - 0x9933, 0x9934, 0x9935, 0x9936, 0x9937, 0x9938, 0x9939, 0x993a, - 0x993b, 0x993c, 0x993d, 0x993e, 0x993f, 0x9940, 0x9941, 0x9942, - 0x9943, 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, 0x994a, - 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, 0x9952, - 0x9953, 0x9956, 0x9957, 0x9958, 0x9959, 0x995a, 0x995b, 0x995c, - 0x995d, 0x995e, 0x995f, 0x9960, 0x9961, 0x9962, 0x9964, 0x9966, - 0x9973, 0x9978, 0x9979, 0x997b, 0x997e, 0x9982, 0x9983, 0x9989, - 0x7a39, 0x7a37, 0x7a51, 0x9ecf, 0x99a5, 0x7a70, 0x7688, 0x768e, - 0x7693, 0x7699, 0x76a4, 0x74de, 0x74e0, 0x752c, 0x9e20, 0x9e22, - 0x9e28, 0x9e29, 0x9e2a, 0x9e2b, 0x9e2c, 0x9e32, 0x9e31, 0x9e36, - 0x9e38, 0x9e37, 0x9e39, 0x9e3a, 0x9e3e, 0x9e41, 0x9e42, 0x9e44, - 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4b, 0x9e4c, 0x9e4e, 0x9e51, - 0x9e55, 0x9e57, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5e, 0x9e63, 0x9e66, - 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e71, 0x9e6d, - 0x9e73, 0x7592, 0x7594, 0x7596, 0x75a0, 0x759d, 0x75ac, 0x75a3, - 0x75b3, 0x75b4, 0x75b8, 0x75c4, 0x75b1, 0x75b0, 0x75c3, 0x75c2, - 0x75d6, 0x75cd, 0x75e3, 0x75e8, 0x75e6, 0x75e4, 0x75eb, 0x75e7, - 0x7603, 0x75f1, 0x75fc, 0x75ff, 0x7610, 0x7600, 0x7605, 0x760c, - 0x7617, 0x760a, 0x7625, 0x7618, 0x7615, 0x7619, - /* 0xf1 */ - 0x998c, 0x998e, 0x999a, 0x999b, 0x999c, 0x999d, 0x999e, 0x999f, - 0x99a0, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a6, 0x99a7, 0x99a9, - 0x99aa, 0x99ab, 0x99ac, 0x99ad, 0x99ae, 0x99af, 0x99b0, 0x99b1, - 0x99b2, 0x99b3, 0x99b4, 0x99b5, 0x99b6, 0x99b7, 0x99b8, 0x99b9, - 0x99ba, 0x99bb, 0x99bc, 0x99bd, 0x99be, 0x99bf, 0x99c0, 0x99c1, - 0x99c2, 0x99c3, 0x99c4, 0x99c5, 0x99c6, 0x99c7, 0x99c8, 0x99c9, - 0x99ca, 0x99cb, 0x99cc, 0x99cd, 0x99ce, 0x99cf, 0x99d0, 0x99d1, - 0x99d2, 0x99d3, 0x99d4, 0x99d5, 0x99d6, 0x99d7, 0x99d8, 0x99d9, - 0x99da, 0x99db, 0x99dc, 0x99dd, 0x99de, 0x99df, 0x99e0, 0x99e1, - 0x99e2, 0x99e3, 0x99e4, 0x99e5, 0x99e6, 0x99e7, 0x99e8, 0x99e9, - 0x99ea, 0x99eb, 0x99ec, 0x99ed, 0x99ee, 0x99ef, 0x99f0, 0x99f1, - 0x99f2, 0x99f3, 0x99f4, 0x99f5, 0x99f6, 0x99f7, 0x99f8, 0x99f9, - 0x761b, 0x763c, 0x7622, 0x7620, 0x7640, 0x762d, 0x7630, 0x763f, - 0x7635, 0x7643, 0x763e, 0x7633, 0x764d, 0x765e, 0x7654, 0x765c, - 0x7656, 0x766b, 0x766f, 0x7fca, 0x7ae6, 0x7a78, 0x7a79, 0x7a80, - 0x7a86, 0x7a88, 0x7a95, 0x7aa6, 0x7aa0, 0x7aac, 0x7aa8, 0x7aad, - 0x7ab3, 0x8864, 0x8869, 0x8872, 0x887d, 0x887f, 0x8882, 0x88a2, - 0x88c6, 0x88b7, 0x88bc, 0x88c9, 0x88e2, 0x88ce, 0x88e3, 0x88e5, - 0x88f1, 0x891a, 0x88fc, 0x88e8, 0x88fe, 0x88f0, 0x8921, 0x8919, - 0x8913, 0x891b, 0x890a, 0x8934, 0x892b, 0x8936, 0x8941, 0x8966, - 0x897b, 0x758b, 0x80e5, 0x76b2, 0x76b4, 0x77dc, 0x8012, 0x8014, - 0x8016, 0x801c, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, 0x8029, - 0x8028, 0x8031, 0x800b, 0x8035, 0x8043, 0x8046, 0x804d, 0x8052, - 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, - /* 0xf2 */ - 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x99ff, 0x9a00, 0x9a01, - 0x9a02, 0x9a03, 0x9a04, 0x9a05, 0x9a06, 0x9a07, 0x9a08, 0x9a09, - 0x9a0a, 0x9a0b, 0x9a0c, 0x9a0d, 0x9a0e, 0x9a0f, 0x9a10, 0x9a11, - 0x9a12, 0x9a13, 0x9a14, 0x9a15, 0x9a16, 0x9a17, 0x9a18, 0x9a19, - 0x9a1a, 0x9a1b, 0x9a1c, 0x9a1d, 0x9a1e, 0x9a1f, 0x9a20, 0x9a21, - 0x9a22, 0x9a23, 0x9a24, 0x9a25, 0x9a26, 0x9a27, 0x9a28, 0x9a29, - 0x9a2a, 0x9a2b, 0x9a2c, 0x9a2d, 0x9a2e, 0x9a2f, 0x9a30, 0x9a31, - 0x9a32, 0x9a33, 0x9a34, 0x9a35, 0x9a36, 0x9a37, 0x9a38, 0x9a39, - 0x9a3a, 0x9a3b, 0x9a3c, 0x9a3d, 0x9a3e, 0x9a3f, 0x9a40, 0x9a41, - 0x9a42, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0x9a47, 0x9a48, 0x9a49, - 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4d, 0x9a4e, 0x9a4f, 0x9a50, 0x9a51, - 0x9a52, 0x9a53, 0x9a54, 0x9a55, 0x9a56, 0x9a57, 0x9a58, 0x9a59, - 0x9889, 0x988c, 0x988d, 0x988f, 0x9894, 0x989a, 0x989b, 0x989e, - 0x989f, 0x98a1, 0x98a2, 0x98a5, 0x98a6, 0x864d, 0x8654, 0x866c, - 0x866e, 0x867f, 0x867a, 0x867c, 0x867b, 0x86a8, 0x868d, 0x868b, - 0x86ac, 0x869d, 0x86a7, 0x86a3, 0x86aa, 0x8693, 0x86a9, 0x86b6, - 0x86c4, 0x86b5, 0x86ce, 0x86b0, 0x86ba, 0x86b1, 0x86af, 0x86c9, - 0x86cf, 0x86b4, 0x86e9, 0x86f1, 0x86f2, 0x86ed, 0x86f3, 0x86d0, - 0x8713, 0x86de, 0x86f4, 0x86df, 0x86d8, 0x86d1, 0x8703, 0x8707, - 0x86f8, 0x8708, 0x870a, 0x870d, 0x8709, 0x8723, 0x873b, 0x871e, - 0x8725, 0x872e, 0x871a, 0x873e, 0x8748, 0x8734, 0x8731, 0x8729, - 0x8737, 0x873f, 0x8782, 0x8722, 0x877d, 0x877e, 0x877b, 0x8760, - 0x8770, 0x874c, 0x876e, 0x878b, 0x8753, 0x8763, 0x877c, 0x8764, - 0x8759, 0x8765, 0x8793, 0x87af, 0x87a8, 0x87d2, - /* 0xf3 */ - 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, 0x9a5f, 0x9a60, 0x9a61, - 0x9a62, 0x9a63, 0x9a64, 0x9a65, 0x9a66, 0x9a67, 0x9a68, 0x9a69, - 0x9a6a, 0x9a6b, 0x9a72, 0x9a83, 0x9a89, 0x9a8d, 0x9a8e, 0x9a94, - 0x9a95, 0x9a99, 0x9aa6, 0x9aa9, 0x9aaa, 0x9aab, 0x9aac, 0x9aad, - 0x9aae, 0x9aaf, 0x9ab2, 0x9ab3, 0x9ab4, 0x9ab5, 0x9ab9, 0x9abb, - 0x9abd, 0x9abe, 0x9abf, 0x9ac3, 0x9ac4, 0x9ac6, 0x9ac7, 0x9ac8, - 0x9ac9, 0x9aca, 0x9acd, 0x9ace, 0x9acf, 0x9ad0, 0x9ad2, 0x9ad4, - 0x9ad5, 0x9ad6, 0x9ad7, 0x9ad9, 0x9ada, 0x9adb, 0x9adc, 0x9add, - 0x9ade, 0x9ae0, 0x9ae2, 0x9ae3, 0x9ae4, 0x9ae5, 0x9ae7, 0x9ae8, - 0x9ae9, 0x9aea, 0x9aec, 0x9aee, 0x9af0, 0x9af1, 0x9af2, 0x9af3, - 0x9af4, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9afa, 0x9afc, 0x9afd, - 0x9afe, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b04, 0x9b05, 0x9b06, - 0x87c6, 0x8788, 0x8785, 0x87ad, 0x8797, 0x8783, 0x87ab, 0x87e5, - 0x87ac, 0x87b5, 0x87b3, 0x87cb, 0x87d3, 0x87bd, 0x87d1, 0x87c0, - 0x87ca, 0x87db, 0x87ea, 0x87e0, 0x87ee, 0x8816, 0x8813, 0x87fe, - 0x880a, 0x881b, 0x8821, 0x8839, 0x883c, 0x7f36, 0x7f42, 0x7f44, - 0x7f45, 0x8210, 0x7afa, 0x7afd, 0x7b08, 0x7b03, 0x7b04, 0x7b15, - 0x7b0a, 0x7b2b, 0x7b0f, 0x7b47, 0x7b38, 0x7b2a, 0x7b19, 0x7b2e, - 0x7b31, 0x7b20, 0x7b25, 0x7b24, 0x7b33, 0x7b3e, 0x7b1e, 0x7b58, - 0x7b5a, 0x7b45, 0x7b75, 0x7b4c, 0x7b5d, 0x7b60, 0x7b6e, 0x7b7b, - 0x7b62, 0x7b72, 0x7b71, 0x7b90, 0x7ba6, 0x7ba7, 0x7bb8, 0x7bac, - 0x7b9d, 0x7ba8, 0x7b85, 0x7baa, 0x7b9c, 0x7ba2, 0x7bab, 0x7bb4, - 0x7bd1, 0x7bc1, 0x7bcc, 0x7bdd, 0x7bda, 0x7be5, 0x7be6, 0x7bea, - 0x7c0c, 0x7bfe, 0x7bfc, 0x7c0f, 0x7c16, 0x7c0b, - /* 0xf4 */ - 0x9b07, 0x9b09, 0x9b0a, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, 0x9b10, - 0x9b11, 0x9b12, 0x9b14, 0x9b15, 0x9b16, 0x9b17, 0x9b18, 0x9b19, - 0x9b1a, 0x9b1b, 0x9b1c, 0x9b1d, 0x9b1e, 0x9b20, 0x9b21, 0x9b22, - 0x9b24, 0x9b25, 0x9b26, 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2b, - 0x9b2c, 0x9b2d, 0x9b2e, 0x9b30, 0x9b31, 0x9b33, 0x9b34, 0x9b35, - 0x9b36, 0x9b37, 0x9b38, 0x9b39, 0x9b3a, 0x9b3d, 0x9b3e, 0x9b3f, - 0x9b40, 0x9b46, 0x9b4a, 0x9b4b, 0x9b4c, 0x9b4e, 0x9b50, 0x9b52, - 0x9b53, 0x9b55, 0x9b56, 0x9b57, 0x9b58, 0x9b59, 0x9b5a, 0x9b5b, - 0x9b5c, 0x9b5d, 0x9b5e, 0x9b5f, 0x9b60, 0x9b61, 0x9b62, 0x9b63, - 0x9b64, 0x9b65, 0x9b66, 0x9b67, 0x9b68, 0x9b69, 0x9b6a, 0x9b6b, - 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, 0x9b70, 0x9b71, 0x9b72, 0x9b73, - 0x9b74, 0x9b75, 0x9b76, 0x9b77, 0x9b78, 0x9b79, 0x9b7a, 0x9b7b, - 0x7c1f, 0x7c2a, 0x7c26, 0x7c38, 0x7c41, 0x7c40, 0x81fe, 0x8201, - 0x8202, 0x8204, 0x81ec, 0x8844, 0x8221, 0x8222, 0x8223, 0x822d, - 0x822f, 0x8228, 0x822b, 0x8238, 0x823b, 0x8233, 0x8234, 0x823e, - 0x8244, 0x8249, 0x824b, 0x824f, 0x825a, 0x825f, 0x8268, 0x887e, - 0x8885, 0x8888, 0x88d8, 0x88df, 0x895e, 0x7f9d, 0x7f9f, 0x7fa7, - 0x7faf, 0x7fb0, 0x7fb2, 0x7c7c, 0x6549, 0x7c91, 0x7c9d, 0x7c9c, - 0x7c9e, 0x7ca2, 0x7cb2, 0x7cbc, 0x7cbd, 0x7cc1, 0x7cc7, 0x7ccc, - 0x7ccd, 0x7cc8, 0x7cc5, 0x7cd7, 0x7ce8, 0x826e, 0x66a8, 0x7fbf, - 0x7fce, 0x7fd5, 0x7fe5, 0x7fe1, 0x7fe6, 0x7fe9, 0x7fee, 0x7ff3, - 0x7cf8, 0x7d77, 0x7da6, 0x7dae, 0x7e47, 0x7e9b, 0x9eb8, 0x9eb4, - 0x8d73, 0x8d84, 0x8d94, 0x8d91, 0x8db1, 0x8d67, 0x8d6d, 0x8c47, - 0x8c49, 0x914a, 0x9150, 0x914e, 0x914f, 0x9164, - /* 0xf5 */ - 0x9b7c, 0x9b7d, 0x9b7e, 0x9b7f, 0x9b80, 0x9b81, 0x9b82, 0x9b83, - 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b88, 0x9b89, 0x9b8a, 0x9b8b, - 0x9b8c, 0x9b8d, 0x9b8e, 0x9b8f, 0x9b90, 0x9b91, 0x9b92, 0x9b93, - 0x9b94, 0x9b95, 0x9b96, 0x9b97, 0x9b98, 0x9b99, 0x9b9a, 0x9b9b, - 0x9b9c, 0x9b9d, 0x9b9e, 0x9b9f, 0x9ba0, 0x9ba1, 0x9ba2, 0x9ba3, - 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0x9ba8, 0x9ba9, 0x9baa, 0x9bab, - 0x9bac, 0x9bad, 0x9bae, 0x9baf, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb3, - 0x9bb4, 0x9bb5, 0x9bb6, 0x9bb7, 0x9bb8, 0x9bb9, 0x9bba, 0x9bbb, - 0x9bbc, 0x9bbd, 0x9bbe, 0x9bbf, 0x9bc0, 0x9bc1, 0x9bc2, 0x9bc3, - 0x9bc4, 0x9bc5, 0x9bc6, 0x9bc7, 0x9bc8, 0x9bc9, 0x9bca, 0x9bcb, - 0x9bcc, 0x9bcd, 0x9bce, 0x9bcf, 0x9bd0, 0x9bd1, 0x9bd2, 0x9bd3, - 0x9bd4, 0x9bd5, 0x9bd6, 0x9bd7, 0x9bd8, 0x9bd9, 0x9bda, 0x9bdb, - 0x9162, 0x9161, 0x9170, 0x9169, 0x916f, 0x917d, 0x917e, 0x9172, - 0x9174, 0x9179, 0x918c, 0x9185, 0x9190, 0x918d, 0x9191, 0x91a2, - 0x91a3, 0x91aa, 0x91ad, 0x91ae, 0x91af, 0x91b5, 0x91b4, 0x91ba, - 0x8c55, 0x9e7e, 0x8db8, 0x8deb, 0x8e05, 0x8e59, 0x8e69, 0x8db5, - 0x8dbf, 0x8dbc, 0x8dba, 0x8dc4, 0x8dd6, 0x8dd7, 0x8dda, 0x8dde, - 0x8dce, 0x8dcf, 0x8ddb, 0x8dc6, 0x8dec, 0x8df7, 0x8df8, 0x8de3, - 0x8df9, 0x8dfb, 0x8de4, 0x8e09, 0x8dfd, 0x8e14, 0x8e1d, 0x8e1f, - 0x8e2c, 0x8e2e, 0x8e23, 0x8e2f, 0x8e3a, 0x8e40, 0x8e39, 0x8e35, - 0x8e3d, 0x8e31, 0x8e49, 0x8e41, 0x8e42, 0x8e51, 0x8e52, 0x8e4a, - 0x8e70, 0x8e76, 0x8e7c, 0x8e6f, 0x8e74, 0x8e85, 0x8e8f, 0x8e94, - 0x8e90, 0x8e9c, 0x8e9e, 0x8c78, 0x8c82, 0x8c8a, 0x8c85, 0x8c98, - 0x8c94, 0x659b, 0x89d6, 0x89de, 0x89da, 0x89dc, - /* 0xf6 */ - 0x9bdc, 0x9bdd, 0x9bde, 0x9bdf, 0x9be0, 0x9be1, 0x9be2, 0x9be3, - 0x9be4, 0x9be5, 0x9be6, 0x9be7, 0x9be8, 0x9be9, 0x9bea, 0x9beb, - 0x9bec, 0x9bed, 0x9bee, 0x9bef, 0x9bf0, 0x9bf1, 0x9bf2, 0x9bf3, - 0x9bf4, 0x9bf5, 0x9bf6, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfb, - 0x9bfc, 0x9bfd, 0x9bfe, 0x9bff, 0x9c00, 0x9c01, 0x9c02, 0x9c03, - 0x9c04, 0x9c05, 0x9c06, 0x9c07, 0x9c08, 0x9c09, 0x9c0a, 0x9c0b, - 0x9c0c, 0x9c0d, 0x9c0e, 0x9c0f, 0x9c10, 0x9c11, 0x9c12, 0x9c13, - 0x9c14, 0x9c15, 0x9c16, 0x9c17, 0x9c18, 0x9c19, 0x9c1a, 0x9c1b, - 0x9c1c, 0x9c1d, 0x9c1e, 0x9c1f, 0x9c20, 0x9c21, 0x9c22, 0x9c23, - 0x9c24, 0x9c25, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c2b, - 0x9c2c, 0x9c2d, 0x9c2e, 0x9c2f, 0x9c30, 0x9c31, 0x9c32, 0x9c33, - 0x9c34, 0x9c35, 0x9c36, 0x9c37, 0x9c38, 0x9c39, 0x9c3a, 0x9c3b, - 0x89e5, 0x89eb, 0x89ef, 0x8a3e, 0x8b26, 0x9753, 0x96e9, 0x96f3, - 0x96ef, 0x9706, 0x9701, 0x9708, 0x970f, 0x970e, 0x972a, 0x972d, - 0x9730, 0x973e, 0x9f80, 0x9f83, 0x9f85, 0x9f86, 0x9f87, 0x9f88, - 0x9f89, 0x9f8a, 0x9f8c, 0x9efe, 0x9f0b, 0x9f0d, 0x96b9, 0x96bc, - 0x96bd, 0x96ce, 0x96d2, 0x77bf, 0x96e0, 0x928e, 0x92ae, 0x92c8, - 0x933e, 0x936a, 0x93ca, 0x938f, 0x943e, 0x946b, 0x9c7f, 0x9c82, - 0x9c85, 0x9c86, 0x9c87, 0x9c88, 0x7a23, 0x9c8b, 0x9c8e, 0x9c90, - 0x9c91, 0x9c92, 0x9c94, 0x9c95, 0x9c9a, 0x9c9b, 0x9c9e, 0x9c9f, - 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, - 0x9ca9, 0x9cab, 0x9cad, 0x9cae, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, - 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cba, 0x9cbb, 0x9cbc, 0x9cbd, - 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cca, 0x9ccb, - /* 0xf7 */ - 0x9c3c, 0x9c3d, 0x9c3e, 0x9c3f, 0x9c40, 0x9c41, 0x9c42, 0x9c43, - 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0x9c48, 0x9c49, 0x9c4a, 0x9c4b, - 0x9c4c, 0x9c4d, 0x9c4e, 0x9c4f, 0x9c50, 0x9c51, 0x9c52, 0x9c53, - 0x9c54, 0x9c55, 0x9c56, 0x9c57, 0x9c58, 0x9c59, 0x9c5a, 0x9c5b, - 0x9c5c, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c60, 0x9c61, 0x9c62, 0x9c63, - 0x9c64, 0x9c65, 0x9c66, 0x9c67, 0x9c68, 0x9c69, 0x9c6a, 0x9c6b, - 0x9c6c, 0x9c6d, 0x9c6e, 0x9c6f, 0x9c70, 0x9c71, 0x9c72, 0x9c73, - 0x9c74, 0x9c75, 0x9c76, 0x9c77, 0x9c78, 0x9c79, 0x9c7a, 0x9c7b, - 0x9c7d, 0x9c7e, 0x9c80, 0x9c83, 0x9c84, 0x9c89, 0x9c8a, 0x9c8c, - 0x9c8f, 0x9c93, 0x9c96, 0x9c97, 0x9c98, 0x9c99, 0x9c9d, 0x9caa, - 0x9cac, 0x9caf, 0x9cb9, 0x9cbe, 0x9cbf, 0x9cc0, 0x9cc1, 0x9cc2, - 0x9cc8, 0x9cc9, 0x9cd1, 0x9cd2, 0x9cda, 0x9cdb, 0x9ce0, 0x9ce1, - 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0x9cd0, 0x9cd3, 0x9cd4, 0x9cd5, - 0x9cd7, 0x9cd8, 0x9cd9, 0x9cdc, 0x9cdd, 0x9cdf, 0x9ce2, 0x977c, - 0x9785, 0x9791, 0x9792, 0x9794, 0x97af, 0x97ab, 0x97a3, 0x97b2, - 0x97b4, 0x9ab1, 0x9ab0, 0x9ab7, 0x9e58, 0x9ab6, 0x9aba, 0x9abc, - 0x9ac1, 0x9ac0, 0x9ac5, 0x9ac2, 0x9acb, 0x9acc, 0x9ad1, 0x9b45, - 0x9b43, 0x9b47, 0x9b49, 0x9b48, 0x9b4d, 0x9b51, 0x98e8, 0x990d, - 0x992e, 0x9955, 0x9954, 0x9adf, 0x9ae1, 0x9ae6, 0x9aef, 0x9aeb, - 0x9afb, 0x9aed, 0x9af9, 0x9b08, 0x9b0f, 0x9b13, 0x9b1f, 0x9b23, - 0x9ebd, 0x9ebe, 0x7e3b, 0x9e82, 0x9e87, 0x9e88, 0x9e8b, 0x9e92, - 0x93d6, 0x9e9d, 0x9e9f, 0x9edb, 0x9edc, 0x9edd, 0x9ee0, 0x9edf, - 0x9ee2, 0x9ee9, 0x9ee7, 0x9ee5, 0x9eea, 0x9eef, 0x9f22, 0x9f2c, - 0x9f2f, 0x9f39, 0x9f37, 0x9f3d, 0x9f3e, 0x9f44, - /* 0xf8 */ - 0x9ce3, 0x9ce4, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0x9ce9, 0x9cea, - 0x9ceb, 0x9cec, 0x9ced, 0x9cee, 0x9cef, 0x9cf0, 0x9cf1, 0x9cf2, - 0x9cf3, 0x9cf4, 0x9cf5, 0x9cf6, 0x9cf7, 0x9cf8, 0x9cf9, 0x9cfa, - 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, 0x9cff, 0x9d00, 0x9d01, 0x9d02, - 0x9d03, 0x9d04, 0x9d05, 0x9d06, 0x9d07, 0x9d08, 0x9d09, 0x9d0a, - 0x9d0b, 0x9d0c, 0x9d0d, 0x9d0e, 0x9d0f, 0x9d10, 0x9d11, 0x9d12, - 0x9d13, 0x9d14, 0x9d15, 0x9d16, 0x9d17, 0x9d18, 0x9d19, 0x9d1a, - 0x9d1b, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d1f, 0x9d20, 0x9d21, 0x9d22, - 0x9d23, 0x9d24, 0x9d25, 0x9d26, 0x9d27, 0x9d28, 0x9d29, 0x9d2a, - 0x9d2b, 0x9d2c, 0x9d2d, 0x9d2e, 0x9d2f, 0x9d30, 0x9d31, 0x9d32, - 0x9d33, 0x9d34, 0x9d35, 0x9d36, 0x9d37, 0x9d38, 0x9d39, 0x9d3a, - 0x9d3b, 0x9d3c, 0x9d3d, 0x9d3e, 0x9d3f, 0x9d40, 0x9d41, 0x9d42, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xf9 */ - 0x9d43, 0x9d44, 0x9d45, 0x9d46, 0x9d47, 0x9d48, 0x9d49, 0x9d4a, - 0x9d4b, 0x9d4c, 0x9d4d, 0x9d4e, 0x9d4f, 0x9d50, 0x9d51, 0x9d52, - 0x9d53, 0x9d54, 0x9d55, 0x9d56, 0x9d57, 0x9d58, 0x9d59, 0x9d5a, - 0x9d5b, 0x9d5c, 0x9d5d, 0x9d5e, 0x9d5f, 0x9d60, 0x9d61, 0x9d62, - 0x9d63, 0x9d64, 0x9d65, 0x9d66, 0x9d67, 0x9d68, 0x9d69, 0x9d6a, - 0x9d6b, 0x9d6c, 0x9d6d, 0x9d6e, 0x9d6f, 0x9d70, 0x9d71, 0x9d72, - 0x9d73, 0x9d74, 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, - 0x9d7b, 0x9d7c, 0x9d7d, 0x9d7e, 0x9d7f, 0x9d80, 0x9d81, 0x9d82, - 0x9d83, 0x9d84, 0x9d85, 0x9d86, 0x9d87, 0x9d88, 0x9d89, 0x9d8a, - 0x9d8b, 0x9d8c, 0x9d8d, 0x9d8e, 0x9d8f, 0x9d90, 0x9d91, 0x9d92, - 0x9d93, 0x9d94, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9d99, 0x9d9a, - 0x9d9b, 0x9d9c, 0x9d9d, 0x9d9e, 0x9d9f, 0x9da0, 0x9da1, 0x9da2, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xfa */ - 0x9da3, 0x9da4, 0x9da5, 0x9da6, 0x9da7, 0x9da8, 0x9da9, 0x9daa, - 0x9dab, 0x9dac, 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0x9db1, 0x9db2, - 0x9db3, 0x9db4, 0x9db5, 0x9db6, 0x9db7, 0x9db8, 0x9db9, 0x9dba, - 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, - 0x9dc3, 0x9dc4, 0x9dc5, 0x9dc6, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, - 0x9dcb, 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, - 0x9dd3, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dd8, 0x9dd9, 0x9dda, - 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, 0x9de1, 0x9de2, - 0x9de3, 0x9de4, 0x9de5, 0x9de6, 0x9de7, 0x9de8, 0x9de9, 0x9dea, - 0x9deb, 0x9dec, 0x9ded, 0x9dee, 0x9def, 0x9df0, 0x9df1, 0x9df2, - 0x9df3, 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0x9dfa, - 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9dff, 0x9e00, 0x9e01, 0x9e02, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xfb */ - 0x9e03, 0x9e04, 0x9e05, 0x9e06, 0x9e07, 0x9e08, 0x9e09, 0x9e0a, - 0x9e0b, 0x9e0c, 0x9e0d, 0x9e0e, 0x9e0f, 0x9e10, 0x9e11, 0x9e12, - 0x9e13, 0x9e14, 0x9e15, 0x9e16, 0x9e17, 0x9e18, 0x9e19, 0x9e1a, - 0x9e1b, 0x9e1c, 0x9e1d, 0x9e1e, 0x9e24, 0x9e27, 0x9e2e, 0x9e30, - 0x9e34, 0x9e3b, 0x9e3c, 0x9e40, 0x9e4d, 0x9e50, 0x9e52, 0x9e53, - 0x9e54, 0x9e56, 0x9e59, 0x9e5d, 0x9e5f, 0x9e60, 0x9e61, 0x9e62, - 0x9e65, 0x9e6e, 0x9e6f, 0x9e72, 0x9e74, 0x9e75, 0x9e76, 0x9e77, - 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e7d, 0x9e80, 0x9e81, - 0x9e83, 0x9e84, 0x9e85, 0x9e86, 0x9e89, 0x9e8a, 0x9e8c, 0x9e8d, - 0x9e8e, 0x9e8f, 0x9e90, 0x9e91, 0x9e94, 0x9e95, 0x9e96, 0x9e97, - 0x9e98, 0x9e99, 0x9e9a, 0x9e9b, 0x9e9c, 0x9e9e, 0x9ea0, 0x9ea1, - 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea7, 0x9ea8, 0x9ea9, 0x9eaa, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xfc */ - 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb1, 0x9eb2, - 0x9eb3, 0x9eb5, 0x9eb6, 0x9eb7, 0x9eb9, 0x9eba, 0x9ebc, 0x9ebf, - 0x9ec0, 0x9ec1, 0x9ec2, 0x9ec3, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, - 0x9eca, 0x9ecb, 0x9ecc, 0x9ed0, 0x9ed2, 0x9ed3, 0x9ed5, 0x9ed6, - 0x9ed7, 0x9ed9, 0x9eda, 0x9ede, 0x9ee1, 0x9ee3, 0x9ee4, 0x9ee6, - 0x9ee8, 0x9eeb, 0x9eec, 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, - 0x9ef3, 0x9ef4, 0x9ef5, 0x9ef6, 0x9ef7, 0x9ef8, 0x9efa, 0x9efd, - 0x9eff, 0x9f00, 0x9f01, 0x9f02, 0x9f03, 0x9f04, 0x9f05, 0x9f06, - 0x9f07, 0x9f08, 0x9f09, 0x9f0a, 0x9f0c, 0x9f0f, 0x9f11, 0x9f12, - 0x9f14, 0x9f15, 0x9f16, 0x9f18, 0x9f1a, 0x9f1b, 0x9f1c, 0x9f1d, - 0x9f1e, 0x9f1f, 0x9f21, 0x9f23, 0x9f24, 0x9f25, 0x9f26, 0x9f27, - 0x9f28, 0x9f29, 0x9f2a, 0x9f2b, 0x9f2d, 0x9f2e, 0x9f30, 0x9f31, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xfd */ - 0x9f32, 0x9f33, 0x9f34, 0x9f35, 0x9f36, 0x9f38, 0x9f3a, 0x9f3c, - 0x9f3f, 0x9f40, 0x9f41, 0x9f42, 0x9f43, 0x9f45, 0x9f46, 0x9f47, - 0x9f48, 0x9f49, 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, - 0x9f52, 0x9f53, 0x9f54, 0x9f55, 0x9f56, 0x9f57, 0x9f58, 0x9f59, - 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, 0x9f5f, 0x9f60, 0x9f61, - 0x9f62, 0x9f63, 0x9f64, 0x9f65, 0x9f66, 0x9f67, 0x9f68, 0x9f69, - 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, - 0x9f72, 0x9f73, 0x9f74, 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, - 0x9f7a, 0x9f7b, 0x9f7c, 0x9f7d, 0x9f7e, 0x9f81, 0x9f82, 0x9f8d, - 0x9f8e, 0x9f8f, 0x9f90, 0x9f91, 0x9f92, 0x9f93, 0x9f94, 0x9f95, - 0x9f96, 0x9f97, 0x9f98, 0x9f9c, 0x9f9d, 0x9f9e, 0x9fa1, 0x9fa2, - 0x9fa3, 0x9fa4, 0x9fa5, 0xf92c, 0xf979, 0xf995, 0xf9e7, 0xf9f1, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xfe */ - 0xfa0c, 0xfa0d, 0xfa0e, 0xfa0f, 0xfa11, 0xfa13, 0xfa14, 0xfa18, - 0xfa1f, 0xfa20, 0xfa21, 0xfa23, 0xfa24, 0xfa27, 0xfa28, 0xfa29, -}; - -static int -gbk_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = s[0]; - if ((c1 >= 0x81 && c1 <= 0xfe)) { - if (n >= 2) { - unsigned char c2 = s[1]; - if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xff)) { - unsigned int i = 190 * (c1 - 0x81) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40)); - unsigned short wc = 0xfffd; - { - if (i < 23766) - wc = gbk_2uni_page81[i]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short gbk_page00[208] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0xa1e8, 0x0000, 0x0000, 0xa1ec, /*0xa0-0xa7*/ - 0xa1a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ - 0xa1e3, 0xa1c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1a4, /*0xb0-0xb7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1c1, /*0xd0-0xd7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ - 0xa8a4, 0xa8a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xe0-0xe7*/ - 0xa8a8, 0xa8a6, 0xa8ba, 0x0000, 0xa8ac, 0xa8aa, 0x0000, 0x0000, /*0xe8-0xef*/ - 0x0000, 0x0000, 0xa8b0, 0xa8ae, 0x0000, 0x0000, 0x0000, 0xa1c2, /*0xf0-0xf7*/ - 0x0000, 0xa8b4, 0xa8b2, 0x0000, 0xa8b9, 0x0000, 0x0000, 0x0000, /*0xf8-0xff*/ - /* 0x0100 */ - 0x0000, 0xa8a1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x00-0x07*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ - 0x0000, 0x0000, 0x0000, 0xa8a5, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ - 0x0000, 0x0000, 0x0000, 0xa8a7, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ - 0x0000, 0x0000, 0x0000, 0xa8a9, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa8bd, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ - 0xa8be, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8ad, 0x0000, 0x0000, /*0x48-0x4f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ - 0x0000, 0x0000, 0x0000, 0xa8b1, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ -}; -static const unsigned short gbk_page01[24] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8a3, 0x0000, /*0xc8-0xcf*/ - 0xa8ab, 0x0000, 0xa8af, 0x0000, 0xa8b3, 0x0000, 0xa8b5, 0x0000, /*0xd0-0xd7*/ - 0xa8b6, 0x0000, 0xa8b7, 0x0000, 0xa8b8, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ -}; -static const unsigned short gbk_page02a[24] = { - 0x0000, 0xa8bb, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ - 0x0000, 0xa8c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ -}; -static const unsigned short gbk_page02b[32] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1a6, /*0xc0-0xc7*/ - 0x0000, 0xa1a5, 0xa840, 0xa841, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/ - 0x0000, 0xa842, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ -}; -static const unsigned short gbk_page03[64] = { - 0x0000, 0xa6a1, 0xa6a2, 0xa6a3, 0xa6a4, 0xa6a5, 0xa6a6, 0xa6a7, /*0x90-0x97*/ - 0xa6a8, 0xa6a9, 0xa6aa, 0xa6ab, 0xa6ac, 0xa6ad, 0xa6ae, 0xa6af, /*0x98-0x9f*/ - 0xa6b0, 0xa6b1, 0x0000, 0xa6b2, 0xa6b3, 0xa6b4, 0xa6b5, 0xa6b6, /*0xa0-0xa7*/ - 0xa6b7, 0xa6b8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ - 0x0000, 0xa6c1, 0xa6c2, 0xa6c3, 0xa6c4, 0xa6c5, 0xa6c6, 0xa6c7, /*0xb0-0xb7*/ - 0xa6c8, 0xa6c9, 0xa6ca, 0xa6cb, 0xa6cc, 0xa6cd, 0xa6ce, 0xa6cf, /*0xb8-0xbf*/ - 0xa6d0, 0xa6d1, 0x0000, 0xa6d2, 0xa6d3, 0xa6d4, 0xa6d5, 0xa6d6, /*0xc0-0xc7*/ - 0xa6d7, 0xa6d8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ -}; -static const unsigned short gbk_page04[88] = { - 0x0000, 0xa7a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x00-0x07*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ - 0xa7a1, 0xa7a2, 0xa7a3, 0xa7a4, 0xa7a5, 0xa7a6, 0xa7a8, 0xa7a9, /*0x10-0x17*/ - 0xa7aa, 0xa7ab, 0xa7ac, 0xa7ad, 0xa7ae, 0xa7af, 0xa7b0, 0xa7b1, /*0x18-0x1f*/ - 0xa7b2, 0xa7b3, 0xa7b4, 0xa7b5, 0xa7b6, 0xa7b7, 0xa7b8, 0xa7b9, /*0x20-0x27*/ - 0xa7ba, 0xa7bb, 0xa7bc, 0xa7bd, 0xa7be, 0xa7bf, 0xa7c0, 0xa7c1, /*0x28-0x2f*/ - 0xa7d1, 0xa7d2, 0xa7d3, 0xa7d4, 0xa7d5, 0xa7d6, 0xa7d8, 0xa7d9, /*0x30-0x37*/ - 0xa7da, 0xa7db, 0xa7dc, 0xa7dd, 0xa7de, 0xa7df, 0xa7e0, 0xa7e1, /*0x38-0x3f*/ - 0xa7e2, 0xa7e3, 0xa7e4, 0xa7e5, 0xa7e6, 0xa7e7, 0xa7e8, 0xa7e9, /*0x40-0x47*/ - 0xa7ea, 0xa7eb, 0xa7ec, 0xa7ed, 0xa7ee, 0xa7ef, 0xa7f0, 0xa7f1, /*0x48-0x4f*/ - 0x0000, 0xa7d7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ -}; -static const unsigned short gbk_page20[48] = { - 0xa95c, 0x0000, 0x0000, 0xa843, 0xa1aa, 0xa844, 0xa1ac, 0x0000, /*0x10-0x17*/ - 0xa1ae, 0xa1af, 0x0000, 0x0000, 0xa1b0, 0xa1b1, 0x0000, 0x0000, /*0x18-0x1f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa845, 0xa1ad, 0x0000, /*0x20-0x27*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ - 0xa1eb, 0x0000, 0xa1e4, 0xa1e5, 0x0000, 0xa846, 0x0000, 0x0000, /*0x30-0x37*/ - 0x0000, 0x0000, 0x0000, 0xa1f9, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ -}; -static const unsigned short gbk_page21[160] = { - 0x0000, 0x0000, 0x0000, 0xa1e6, 0x0000, 0xa847, 0x0000, 0x0000, /*0x00-0x07*/ - 0x0000, 0xa848, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1ed, 0x0000, /*0x10-0x17*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ - 0x0000, 0xa959, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ - 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, /*0x60-0x67*/ - 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ - 0xa2a1, 0xa2a2, 0xa2a3, 0xa2a4, 0xa2a5, 0xa2a6, 0xa2a7, 0xa2a8, /*0x70-0x77*/ - 0xa2a9, 0xa2aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ - 0xa1fb, 0xa1fc, 0xa1fa, 0xa1fd, 0x0000, 0x0000, 0xa849, 0xa84a, /*0x90-0x97*/ - 0xa84b, 0xa84c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ -}; -static const unsigned short gbk_page22[184] = { - 0xa1ca, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1c7, /*0x08-0x0f*/ - 0x0000, 0xa1c6, 0x0000, 0x0000, 0x0000, 0xa84d, 0x0000, 0x0000, /*0x10-0x17*/ - 0x0000, 0x0000, 0xa1cc, 0x0000, 0x0000, 0xa1d8, 0xa1de, 0xa84e, /*0x18-0x1f*/ - 0xa1cf, 0x0000, 0x0000, 0xa84f, 0x0000, 0xa1ce, 0x0000, 0xa1c4, /*0x20-0x27*/ - 0xa1c5, 0xa1c9, 0xa1c8, 0xa1d2, 0x0000, 0x0000, 0xa1d3, 0x0000, /*0x28-0x2f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa1e0, 0xa1df, 0xa1c3, 0xa1cb, /*0x30-0x37*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1d7, 0x0000, 0x0000, /*0x38-0x3f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ - 0xa1d6, 0x0000, 0x0000, 0x0000, 0xa1d5, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ - 0x0000, 0x0000, 0xa850, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ - 0xa1d9, 0xa1d4, 0x0000, 0x0000, 0xa1dc, 0xa1dd, 0xa851, 0xa852, /*0x60-0x67*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1da, 0xa1db, /*0x68-0x6f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa892, 0x0000, 0x0000, /*0x90-0x97*/ - 0x0000, 0xa1d1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1cd, 0x0000, 0x0000, /*0xa0-0xa7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa853, /*0xb8-0xbf*/ -}; -static const unsigned short gbk_page24[64] = { - 0xa2d9, 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, /*0x60-0x67*/ - 0xa2e1, 0xa2e2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, /*0x70-0x77*/ - 0xa2c9, 0xa2ca, 0xa2cb, 0xa2cc, 0xa2cd, 0xa2ce, 0xa2cf, 0xa2d0, /*0x78-0x7f*/ - 0xa2d1, 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, /*0x80-0x87*/ - 0xa2b1, 0xa2b2, 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, /*0x88-0x8f*/ - 0xa2b9, 0xa2ba, 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, /*0x90-0x97*/ - 0xa2c1, 0xa2c2, 0xa2c3, 0xa2c4, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ -}; -static const unsigned short gbk_page25[232] = { - 0xa9a4, 0xa9a5, 0xa9a6, 0xa9a7, 0xa9a8, 0xa9a9, 0xa9aa, 0xa9ab, /*0x00-0x07*/ - 0xa9ac, 0xa9ad, 0xa9ae, 0xa9af, 0xa9b0, 0xa9b1, 0xa9b2, 0xa9b3, /*0x08-0x0f*/ - 0xa9b4, 0xa9b5, 0xa9b6, 0xa9b7, 0xa9b8, 0xa9b9, 0xa9ba, 0xa9bb, /*0x10-0x17*/ - 0xa9bc, 0xa9bd, 0xa9be, 0xa9bf, 0xa9c0, 0xa9c1, 0xa9c2, 0xa9c3, /*0x18-0x1f*/ - 0xa9c4, 0xa9c5, 0xa9c6, 0xa9c7, 0xa9c8, 0xa9c9, 0xa9ca, 0xa9cb, /*0x20-0x27*/ - 0xa9cc, 0xa9cd, 0xa9ce, 0xa9cf, 0xa9d0, 0xa9d1, 0xa9d2, 0xa9d3, /*0x28-0x2f*/ - 0xa9d4, 0xa9d5, 0xa9d6, 0xa9d7, 0xa9d8, 0xa9d9, 0xa9da, 0xa9db, /*0x30-0x37*/ - 0xa9dc, 0xa9dd, 0xa9de, 0xa9df, 0xa9e0, 0xa9e1, 0xa9e2, 0xa9e3, /*0x38-0x3f*/ - 0xa9e4, 0xa9e5, 0xa9e6, 0xa9e7, 0xa9e8, 0xa9e9, 0xa9ea, 0xa9eb, /*0x40-0x47*/ - 0xa9ec, 0xa9ed, 0xa9ee, 0xa9ef, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ - 0xa854, 0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, /*0x50-0x57*/ - 0xa85c, 0xa85d, 0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, /*0x58-0x5f*/ - 0xa864, 0xa865, 0xa866, 0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, /*0x60-0x67*/ - 0xa86c, 0xa86d, 0xa86e, 0xa86f, 0xa870, 0xa871, 0xa872, 0xa873, /*0x68-0x6f*/ - 0xa874, 0xa875, 0xa876, 0xa877, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ - 0x0000, 0xa878, 0xa879, 0xa87a, 0xa87b, 0xa87c, 0xa87d, 0xa87e, /*0x80-0x87*/ - 0xa880, 0xa881, 0xa882, 0xa883, 0xa884, 0xa885, 0xa886, 0xa887, /*0x88-0x8f*/ - 0x0000, 0x0000, 0x0000, 0xa888, 0xa889, 0xa88a, 0x0000, 0x0000, /*0x90-0x97*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ - 0xa1f6, 0xa1f5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ - 0x0000, 0x0000, 0xa1f8, 0xa1f7, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa88b, 0xa88c, 0x0000, 0x0000, /*0xb8-0xbf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1f4, 0xa1f3, /*0xc0-0xc7*/ - 0x0000, 0x0000, 0x0000, 0xa1f0, 0x0000, 0x0000, 0xa1f2, 0xa1f1, /*0xc8-0xcf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ - 0x0000, 0x0000, 0xa88d, 0xa88e, 0xa88f, 0xa890, 0x0000, 0x0000, /*0xe0-0xe7*/ -}; -static const unsigned short gbk_page26[72] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1ef, 0xa1ee, 0x0000, /*0x00-0x07*/ - 0x0000, 0xa891, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ - 0xa1e2, 0x0000, 0xa1e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ -}; -static const unsigned short gbk_page30[304] = { - 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a8, 0x0000, 0xa1a9, 0xa965, 0xa996, /*0x00-0x07*/ - 0xa1b4, 0xa1b5, 0xa1b6, 0xa1b7, 0xa1b8, 0xa1b9, 0xa1ba, 0xa1bb, /*0x08-0x0f*/ - 0xa1be, 0xa1bf, 0xa893, 0xa1fe, 0xa1b2, 0xa1b3, 0xa1bc, 0xa1bd, /*0x10-0x17*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa894, 0xa895, 0x0000, /*0x18-0x1f*/ - 0x0000, 0xa940, 0xa941, 0xa942, 0xa943, 0xa944, 0xa945, 0xa946, /*0x20-0x27*/ - 0xa947, 0xa948, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ - 0x0000, 0xa4a1, 0xa4a2, 0xa4a3, 0xa4a4, 0xa4a5, 0xa4a6, 0xa4a7, /*0x40-0x47*/ - 0xa4a8, 0xa4a9, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4ae, 0xa4af, /*0x48-0x4f*/ - 0xa4b0, 0xa4b1, 0xa4b2, 0xa4b3, 0xa4b4, 0xa4b5, 0xa4b6, 0xa4b7, /*0x50-0x57*/ - 0xa4b8, 0xa4b9, 0xa4ba, 0xa4bb, 0xa4bc, 0xa4bd, 0xa4be, 0xa4bf, /*0x58-0x5f*/ - 0xa4c0, 0xa4c1, 0xa4c2, 0xa4c3, 0xa4c4, 0xa4c5, 0xa4c6, 0xa4c7, /*0x60-0x67*/ - 0xa4c8, 0xa4c9, 0xa4ca, 0xa4cb, 0xa4cc, 0xa4cd, 0xa4ce, 0xa4cf, /*0x68-0x6f*/ - 0xa4d0, 0xa4d1, 0xa4d2, 0xa4d3, 0xa4d4, 0xa4d5, 0xa4d6, 0xa4d7, /*0x70-0x77*/ - 0xa4d8, 0xa4d9, 0xa4da, 0xa4db, 0xa4dc, 0xa4dd, 0xa4de, 0xa4df, /*0x78-0x7f*/ - 0xa4e0, 0xa4e1, 0xa4e2, 0xa4e3, 0xa4e4, 0xa4e5, 0xa4e6, 0xa4e7, /*0x80-0x87*/ - 0xa4e8, 0xa4e9, 0xa4ea, 0xa4eb, 0xa4ec, 0xa4ed, 0xa4ee, 0xa4ef, /*0x88-0x8f*/ - 0xa4f0, 0xa4f1, 0xa4f2, 0xa4f3, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/ - 0x0000, 0x0000, 0x0000, 0xa961, 0xa962, 0xa966, 0xa967, 0x0000, /*0x98-0x9f*/ - 0x0000, 0xa5a1, 0xa5a2, 0xa5a3, 0xa5a4, 0xa5a5, 0xa5a6, 0xa5a7, /*0xa0-0xa7*/ - 0xa5a8, 0xa5a9, 0xa5aa, 0xa5ab, 0xa5ac, 0xa5ad, 0xa5ae, 0xa5af, /*0xa8-0xaf*/ - 0xa5b0, 0xa5b1, 0xa5b2, 0xa5b3, 0xa5b4, 0xa5b5, 0xa5b6, 0xa5b7, /*0xb0-0xb7*/ - 0xa5b8, 0xa5b9, 0xa5ba, 0xa5bb, 0xa5bc, 0xa5bd, 0xa5be, 0xa5bf, /*0xb8-0xbf*/ - 0xa5c0, 0xa5c1, 0xa5c2, 0xa5c3, 0xa5c4, 0xa5c5, 0xa5c6, 0xa5c7, /*0xc0-0xc7*/ - 0xa5c8, 0xa5c9, 0xa5ca, 0xa5cb, 0xa5cc, 0xa5cd, 0xa5ce, 0xa5cf, /*0xc8-0xcf*/ - 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0xa5d4, 0xa5d5, 0xa5d6, 0xa5d7, /*0xd0-0xd7*/ - 0xa5d8, 0xa5d9, 0xa5da, 0xa5db, 0xa5dc, 0xa5dd, 0xa5de, 0xa5df, /*0xd8-0xdf*/ - 0xa5e0, 0xa5e1, 0xa5e2, 0xa5e3, 0xa5e4, 0xa5e5, 0xa5e6, 0xa5e7, /*0xe0-0xe7*/ - 0xa5e8, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5ee, 0xa5ef, /*0xe8-0xef*/ - 0xa5f0, 0xa5f1, 0xa5f2, 0xa5f3, 0xa5f4, 0xa5f5, 0xa5f6, 0x0000, /*0xf0-0xf7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa960, 0xa963, 0xa964, 0x0000, /*0xf8-0xff*/ - /* 0x3100 */ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8c5, 0xa8c6, 0xa8c7, /*0x00-0x07*/ - 0xa8c8, 0xa8c9, 0xa8ca, 0xa8cb, 0xa8cc, 0xa8cd, 0xa8ce, 0xa8cf, /*0x08-0x0f*/ - 0xa8d0, 0xa8d1, 0xa8d2, 0xa8d3, 0xa8d4, 0xa8d5, 0xa8d6, 0xa8d7, /*0x10-0x17*/ - 0xa8d8, 0xa8d9, 0xa8da, 0xa8db, 0xa8dc, 0xa8dd, 0xa8de, 0xa8df, /*0x18-0x1f*/ - 0xa8e0, 0xa8e1, 0xa8e2, 0xa8e3, 0xa8e4, 0xa8e5, 0xa8e6, 0xa8e7, /*0x20-0x27*/ - 0xa8e8, 0xa8e9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ -}; -static const unsigned short gbk_page32[24] = { - 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, /*0x20-0x27*/ - 0xa2ed, 0xa2ee, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ - 0x0000, 0xa95a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ -}; -static const unsigned short gbk_page33[80] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa94a, 0xa94b, /*0x88-0x8f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa94c, 0xa94d, 0xa94e, 0x0000, /*0x98-0x9f*/ - 0x0000, 0xa94f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0xa950, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa951, 0x0000, /*0xc8-0xcf*/ - 0x0000, 0xa952, 0xa953, 0x0000, 0x0000, 0xa954, 0x0000, 0x0000, /*0xd0-0xd7*/ -}; -static const unsigned short gbk_page4e[20904] = { - 0xd2bb, 0xb6a1, 0x8140, 0xc6df, 0x8141, 0x8142, 0x8143, 0xcdf2, /*0x00-0x07*/ - 0xd5c9, 0xc8fd, 0xc9cf, 0xcfc2, 0xd8a2, 0xb2bb, 0xd3eb, 0x8144, /*0x08-0x0f*/ - 0xd8a4, 0xb3f3, 0x8145, 0xd7a8, 0xc7d2, 0xd8a7, 0xcac0, 0x8146, /*0x10-0x17*/ - 0xc7f0, 0xb1fb, 0xd2b5, 0xb4d4, 0xb6ab, 0xcbbf, 0xd8a9, 0x8147, /*0x18-0x1f*/ - 0x8148, 0x8149, 0xb6aa, 0x814a, 0xc1bd, 0xd1cf, 0x814b, 0xc9a5, /*0x20-0x27*/ - 0xd8ad, 0x814c, 0xb8f6, 0xd1be, 0xe3dc, 0xd6d0, 0x814d, 0x814e, /*0x28-0x2f*/ - 0xb7e1, 0x814f, 0xb4ae, 0x8150, 0xc1d9, 0x8151, 0xd8bc, 0x8152, /*0x30-0x37*/ - 0xcde8, 0xb5a4, 0xceaa, 0xd6f7, 0x8153, 0xc0f6, 0xbed9, 0xd8af, /*0x38-0x3f*/ - 0x8154, 0x8155, 0x8156, 0xc4cb, 0x8157, 0xbec3, 0x8158, 0xd8b1, /*0x40-0x47*/ - 0xc3b4, 0xd2e5, 0x8159, 0xd6ae, 0xceda, 0xd5a7, 0xbaf5, 0xb7a6, /*0x48-0x4f*/ - 0xc0d6, 0x815a, 0xc6b9, 0xc5d2, 0xc7c7, 0x815b, 0xb9d4, 0x815c, /*0x50-0x57*/ - 0xb3cb, 0xd2d2, 0x815d, 0x815e, 0xd8bf, 0xbec5, 0xc6f2, 0xd2b2, /*0x58-0x5f*/ - 0xcfb0, 0xcfe7, 0x815f, 0x8160, 0x8161, 0x8162, 0xcae9, 0x8163, /*0x60-0x67*/ - 0x8164, 0xd8c0, 0x8165, 0x8166, 0x8167, 0x8168, 0x8169, 0x816a, /*0x68-0x6f*/ - 0xc2f2, 0xc2d2, 0x816b, 0xc8e9, 0x816c, 0x816d, 0x816e, 0x816f, /*0x70-0x77*/ - 0x8170, 0x8171, 0x8172, 0x8173, 0x8174, 0x8175, 0xc7ac, 0x8176, /*0x78-0x7f*/ - 0x8177, 0x8178, 0x8179, 0x817a, 0x817b, 0x817c, 0xc1cb, 0x817d, /*0x80-0x87*/ - 0xd3e8, 0xd5f9, 0x817e, 0xcac2, 0xb6fe, 0xd8a1, 0xd3da, 0xbff7, /*0x88-0x8f*/ - 0x8180, 0xd4c6, 0xbba5, 0xd8c1, 0xcee5, 0xbeae, 0x8181, 0x8182, /*0x90-0x97*/ - 0xd8a8, 0x8183, 0xd1c7, 0xd0a9, 0x8184, 0x8185, 0x8186, 0xd8bd, /*0x98-0x9f*/ - 0xd9ef, 0xcdf6, 0xbfba, 0x8187, 0xbdbb, 0xbaa5, 0xd2e0, 0xb2fa, /*0xa0-0xa7*/ - 0xbae0, 0xc4b6, 0x8188, 0xcfed, 0xbea9, 0xcda4, 0xc1c1, 0x8189, /*0xa8-0xaf*/ - 0x818a, 0x818b, 0xc7d7, 0xd9f1, 0x818c, 0xd9f4, 0x818d, 0x818e, /*0xb0-0xb7*/ - 0x818f, 0x8190, 0xc8cb, 0xd8e9, 0x8191, 0x8192, 0x8193, 0xd2da, /*0xb8-0xbf*/ - 0xcab2, 0xc8ca, 0xd8ec, 0xd8ea, 0xd8c6, 0xbdf6, 0xc6cd, 0xb3f0, /*0xc0-0xc7*/ - 0x8194, 0xd8eb, 0xbdf1, 0xbde9, 0x8195, 0xc8d4, 0xb4d3, 0x8196, /*0xc8-0xcf*/ - 0x8197, 0xc2d8, 0x8198, 0xb2d6, 0xd7d0, 0xcacb, 0xcbfb, 0xd5cc, /*0xd0-0xd7*/ - 0xb8b6, 0xcfc9, 0x8199, 0x819a, 0x819b, 0xd9da, 0xd8f0, 0xc7aa, /*0xd8-0xdf*/ - 0x819c, 0xd8ee, 0x819d, 0xb4fa, 0xc1ee, 0xd2d4, 0x819e, 0x819f, /*0xe0-0xe7*/ - 0xd8ed, 0x81a0, 0xd2c7, 0xd8ef, 0xc3c7, 0x81a1, 0x81a2, 0x81a3, /*0xe8-0xef*/ - 0xd1f6, 0x81a4, 0xd6d9, 0xd8f2, 0x81a5, 0xd8f5, 0xbcfe, 0xbcdb, /*0xf0-0xf7*/ - 0x81a6, 0x81a7, 0x81a8, 0xc8ce, 0x81a9, 0xb7dd, 0x81aa, 0xb7c2, /*0xf8-0xff*/ - /* 0x4f00 */ - 0x81ab, 0xc6f3, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, /*0x00-0x07*/ - 0x81b2, 0xd8f8, 0xd2c1, 0x81b3, 0x81b4, 0xcee9, 0xbcbf, 0xb7fc, /*0x08-0x0f*/ - 0xb7a5, 0xd0dd, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0xd6da, /*0x10-0x17*/ - 0xd3c5, 0xbbef, 0xbbe1, 0xd8f1, 0x81ba, 0x81bb, 0xc9a1, 0xceb0, /*0x18-0x1f*/ - 0xb4ab, 0x81bc, 0xd8f3, 0x81bd, 0xc9cb, 0xd8f6, 0xc2d7, 0xd8f7, /*0x20-0x27*/ - 0x81be, 0x81bf, 0xceb1, 0xd8f9, 0x81c0, 0x81c1, 0x81c2, 0xb2ae, /*0x28-0x2f*/ - 0xb9c0, 0x81c3, 0xd9a3, 0x81c4, 0xb0e9, 0x81c5, 0xc1e6, 0x81c6, /*0x30-0x37*/ - 0xc9ec, 0x81c7, 0xcbc5, 0x81c8, 0xcbc6, 0xd9a4, 0x81c9, 0x81ca, /*0x38-0x3f*/ - 0x81cb, 0x81cc, 0x81cd, 0xb5e8, 0x81ce, 0x81cf, 0xb5ab, 0x81d0, /*0x40-0x47*/ - 0x81d1, 0x81d2, 0x81d3, 0x81d4, 0x81d5, 0xcebb, 0xb5cd, 0xd7a1, /*0x48-0x4f*/ - 0xd7f4, 0xd3d3, 0x81d6, 0xcce5, 0x81d7, 0xbace, 0x81d8, 0xd9a2, /*0x50-0x57*/ - 0xd9dc, 0xd3e0, 0xd8fd, 0xb7f0, 0xd7f7, 0xd8fe, 0xd8fa, 0xd9a1, /*0x58-0x5f*/ - 0xc4e3, 0x81d9, 0x81da, 0xd3b6, 0xd8f4, 0xd9dd, 0x81db, 0xd8fb, /*0x60-0x67*/ - 0x81dc, 0xc5e5, 0x81dd, 0x81de, 0xc0d0, 0x81df, 0x81e0, 0xd1f0, /*0x68-0x6f*/ - 0xb0db, 0x81e1, 0x81e2, 0xbcd1, 0xd9a6, 0x81e3, 0xd9a5, 0x81e4, /*0x70-0x77*/ - 0x81e5, 0x81e6, 0x81e7, 0xd9ac, 0xd9ae, 0x81e8, 0xd9ab, 0xcab9, /*0x78-0x7f*/ - 0x81e9, 0x81ea, 0x81eb, 0xd9a9, 0xd6b6, 0x81ec, 0x81ed, 0x81ee, /*0x80-0x87*/ - 0xb3de, 0xd9a8, 0x81ef, 0xc0fd, 0x81f0, 0xcacc, 0x81f1, 0xd9aa, /*0x88-0x8f*/ - 0x81f2, 0xd9a7, 0x81f3, 0x81f4, 0xd9b0, 0x81f5, 0x81f6, 0xb6b1, /*0x90-0x97*/ - 0x81f7, 0x81f8, 0x81f9, 0xb9a9, 0x81fa, 0xd2c0, 0x81fb, 0x81fc, /*0x98-0x9f*/ - 0xcfc0, 0x81fd, 0x81fe, 0xc2c2, 0x8240, 0xbdc4, 0xd5ec, 0xb2e0, /*0xa0-0xa7*/ - 0xc7c8, 0xbfeb, 0xd9ad, 0x8241, 0xd9af, 0x8242, 0xceea, 0xbaee, /*0xa8-0xaf*/ - 0x8243, 0x8244, 0x8245, 0x8246, 0x8247, 0xc7d6, 0x8248, 0x8249, /*0xb0-0xb7*/ - 0x824a, 0x824b, 0x824c, 0x824d, 0x824e, 0x824f, 0x8250, 0xb1e3, /*0xb8-0xbf*/ - 0x8251, 0x8252, 0x8253, 0xb4d9, 0xb6ed, 0xd9b4, 0x8254, 0x8255, /*0xc0-0xc7*/ - 0x8256, 0x8257, 0xbfa1, 0x8258, 0x8259, 0x825a, 0xd9de, 0xc7ce, /*0xc8-0xcf*/ - 0xc0fe, 0xd9b8, 0x825b, 0x825c, 0x825d, 0x825e, 0x825f, 0xcbd7, /*0xd0-0xd7*/ - 0xb7fd, 0x8260, 0xd9b5, 0x8261, 0xd9b7, 0xb1a3, 0xd3e1, 0xd9b9, /*0xd8-0xdf*/ - 0x8262, 0xd0c5, 0x8263, 0xd9b6, 0x8264, 0x8265, 0xd9b1, 0x8266, /*0xe0-0xe7*/ - 0xd9b2, 0xc1a9, 0xd9b3, 0x8267, 0x8268, 0xbcf3, 0xd0de, 0xb8a9, /*0xe8-0xef*/ - 0x8269, 0xbee3, 0x826a, 0xd9bd, 0x826b, 0x826c, 0x826d, 0x826e, /*0xf0-0xf7*/ - 0xd9ba, 0x826f, 0xb0b3, 0x8270, 0x8271, 0x8272, 0xd9c2, 0x8273, /*0xf8-0xff*/ - /* 0x5000 */ - 0x8274, 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x827a, 0x827b, /*0x00-0x07*/ - 0x827c, 0x827d, 0x827e, 0x8280, 0xd9c4, 0xb1b6, 0x8281, 0xd9bf, /*0x08-0x0f*/ - 0x8282, 0x8283, 0xb5b9, 0x8284, 0xbef3, 0x8285, 0x8286, 0x8287, /*0x10-0x17*/ - 0xccc8, 0xbaf2, 0xd2d0, 0x8288, 0xd9c3, 0x8289, 0x828a, 0xbde8, /*0x18-0x1f*/ - 0x828b, 0xb3ab, 0x828c, 0x828d, 0x828e, 0xd9c5, 0xbeeb, 0x828f, /*0x20-0x27*/ - 0xd9c6, 0xd9bb, 0xc4df, 0x8290, 0xd9be, 0xd9c1, 0xd9c0, 0x8291, /*0x28-0x2f*/ - 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, /*0x30-0x37*/ - 0x829a, 0x829b, 0xd5ae, 0x829c, 0xd6b5, 0x829d, 0xc7e3, 0x829e, /*0x38-0x3f*/ - 0x829f, 0x82a0, 0x82a1, 0xd9c8, 0x82a2, 0x82a3, 0x82a4, 0xbcd9, /*0x40-0x47*/ - 0xd9ca, 0x82a5, 0x82a6, 0x82a7, 0xd9bc, 0x82a8, 0xd9cb, 0xc6ab, /*0x48-0x4f*/ - 0x82a9, 0x82aa, 0x82ab, 0x82ac, 0x82ad, 0xd9c9, 0x82ae, 0x82af, /*0x50-0x57*/ - 0x82b0, 0x82b1, 0xd7f6, 0x82b2, 0xcda3, 0x82b3, 0x82b4, 0x82b5, /*0x58-0x5f*/ - 0x82b6, 0x82b7, 0x82b8, 0x82b9, 0x82ba, 0xbda1, 0x82bb, 0x82bc, /*0x60-0x67*/ - 0x82bd, 0x82be, 0x82bf, 0x82c0, 0xd9cc, 0x82c1, 0x82c2, 0x82c3, /*0x68-0x6f*/ - 0x82c4, 0x82c5, 0x82c6, 0x82c7, 0x82c8, 0x82c9, 0xc5bc, 0xcdb5, /*0x70-0x77*/ - 0x82ca, 0x82cb, 0x82cc, 0xd9cd, 0x82cd, 0x82ce, 0xd9c7, 0xb3a5, /*0x78-0x7f*/ - 0xbffe, 0x82cf, 0x82d0, 0x82d1, 0x82d2, 0xb8b5, 0x82d3, 0x82d4, /*0x80-0x87*/ - 0xc0fc, 0x82d5, 0x82d6, 0x82d7, 0x82d8, 0xb0f8, 0x82d9, 0x82da, /*0x88-0x8f*/ - 0x82db, 0x82dc, 0x82dd, 0x82de, 0x82df, 0x82e0, 0x82e1, 0x82e2, /*0x90-0x97*/ - 0x82e3, 0x82e4, 0x82e5, 0x82e6, 0x82e7, 0x82e8, 0x82e9, 0x82ea, /*0x98-0x9f*/ - 0x82eb, 0x82ec, 0x82ed, 0xb4f6, 0x82ee, 0xd9ce, 0x82ef, 0xd9cf, /*0xa0-0xa7*/ - 0xb4a2, 0xd9d0, 0x82f0, 0x82f1, 0xb4df, 0x82f2, 0x82f3, 0x82f4, /*0xa8-0xaf*/ - 0x82f5, 0x82f6, 0xb0c1, 0x82f7, 0x82f8, 0x82f9, 0x82fa, 0x82fb, /*0xb0-0xb7*/ - 0x82fc, 0x82fd, 0xd9d1, 0xc9b5, 0x82fe, 0x8340, 0x8341, 0x8342, /*0xb8-0xbf*/ - 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, 0x834a, /*0xc0-0xc7*/ - 0x834b, 0x834c, 0x834d, 0x834e, 0x834f, 0x8350, 0x8351, 0xcff1, /*0xc8-0xcf*/ - 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0xd9d2, 0x8358, /*0xd0-0xd7*/ - 0x8359, 0x835a, 0xc1c5, 0x835b, 0x835c, 0x835d, 0x835e, 0x835f, /*0xd8-0xdf*/ - 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, 0x8365, 0xd9d6, 0xc9ae, /*0xe0-0xe7*/ - 0x8366, 0x8367, 0x8368, 0x8369, 0xd9d5, 0xd9d4, 0xd9d7, 0x836a, /*0xe8-0xef*/ - 0x836b, 0x836c, 0x836d, 0xcbdb, 0x836e, 0xbda9, 0x836f, 0x8370, /*0xf0-0xf7*/ - 0x8371, 0x8372, 0x8373, 0xc6a7, 0x8374, 0x8375, 0x8376, 0x8377, /*0xf8-0xff*/ - /* 0x5100 */ - 0x8378, 0x8379, 0x837a, 0x837b, 0x837c, 0x837d, 0xd9d3, 0xd9d8, /*0x00-0x07*/ - 0x837e, 0x8380, 0x8381, 0xd9d9, 0x8382, 0x8383, 0x8384, 0x8385, /*0x08-0x0f*/ - 0x8386, 0x8387, 0xc8e5, 0x8388, 0x8389, 0x838a, 0x838b, 0x838c, /*0x10-0x17*/ - 0x838d, 0x838e, 0x838f, 0x8390, 0x8391, 0x8392, 0x8393, 0x8394, /*0x18-0x1f*/ - 0x8395, 0xc0dc, 0x8396, 0x8397, 0x8398, 0x8399, 0x839a, 0x839b, /*0x20-0x27*/ - 0x839c, 0x839d, 0x839e, 0x839f, 0x83a0, 0x83a1, 0x83a2, 0x83a3, /*0x28-0x2f*/ - 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83a8, 0x83a9, 0x83aa, 0x83ab, /*0x30-0x37*/ - 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b0, 0x83b1, 0x83b2, 0xb6f9, /*0x38-0x3f*/ - 0xd8a3, 0xd4ca, 0x83b3, 0xd4aa, 0xd0d6, 0xb3e4, 0xd5d7, 0x83b4, /*0x40-0x47*/ - 0xcfc8, 0xb9e2, 0x83b5, 0xbfcb, 0x83b6, 0xc3e2, 0x83b7, 0x83b8, /*0x48-0x4f*/ - 0x83b9, 0xb6d2, 0x83ba, 0x83bb, 0xcdc3, 0xd9ee, 0xd9f0, 0x83bc, /*0x50-0x57*/ - 0x83bd, 0x83be, 0xb5b3, 0x83bf, 0xb6b5, 0x83c0, 0x83c1, 0x83c2, /*0x58-0x5f*/ - 0x83c3, 0x83c4, 0xbea4, 0x83c5, 0x83c6, 0xc8eb, 0x83c7, 0x83c8, /*0x60-0x67*/ - 0xc8ab, 0x83c9, 0x83ca, 0xb0cb, 0xb9ab, 0xc1f9, 0xd9e2, 0x83cb, /*0x68-0x6f*/ - 0xc0bc, 0xb9b2, 0x83cc, 0xb9d8, 0xd0cb, 0xb1f8, 0xc6e4, 0xbedf, /*0x70-0x77*/ - 0xb5e4, 0xd7c8, 0x83cd, 0xd1f8, 0xbce6, 0xcade, 0x83ce, 0x83cf, /*0x78-0x7f*/ - 0xbcbd, 0xd9e6, 0xd8e7, 0x83d0, 0x83d1, 0xc4da, 0x83d2, 0x83d3, /*0x80-0x87*/ - 0xb8d4, 0xc8bd, 0x83d4, 0x83d5, 0xb2e1, 0xd4d9, 0x83d6, 0x83d7, /*0x88-0x8f*/ - 0x83d8, 0x83d9, 0xc3b0, 0x83da, 0x83db, 0xc3e1, 0xdaa2, 0xc8df, /*0x90-0x97*/ - 0x83dc, 0xd0b4, 0x83dd, 0xbefc, 0xc5a9, 0x83de, 0x83df, 0x83e0, /*0x98-0x9f*/ - 0xb9da, 0x83e1, 0xdaa3, 0x83e2, 0xd4a9, 0xdaa4, 0x83e3, 0x83e4, /*0xa0-0xa7*/ - 0x83e5, 0x83e6, 0x83e7, 0xd9fb, 0xb6ac, 0x83e8, 0x83e9, 0xb7eb, /*0xa8-0xaf*/ - 0xb1f9, 0xd9fc, 0xb3e5, 0xbef6, 0x83ea, 0xbff6, 0xd2b1, 0xc0e4, /*0xb0-0xb7*/ - 0x83eb, 0x83ec, 0x83ed, 0xb6b3, 0xd9fe, 0xd9fd, 0x83ee, 0x83ef, /*0xb8-0xbf*/ - 0xbebb, 0x83f0, 0x83f1, 0x83f2, 0xc6e0, 0x83f3, 0xd7bc, 0xdaa1, /*0xc0-0xc7*/ - 0x83f4, 0xc1b9, 0x83f5, 0xb5f2, 0xc1e8, 0x83f6, 0x83f7, 0xbcf5, /*0xc8-0xcf*/ - 0x83f8, 0xb4d5, 0x83f9, 0x83fa, 0x83fb, 0x83fc, 0x83fd, 0x83fe, /*0xd0-0xd7*/ - 0x8440, 0x8441, 0x8442, 0xc1dd, 0x8443, 0xc4fd, 0x8444, 0x8445, /*0xd8-0xdf*/ - 0xbcb8, 0xb7b2, 0x8446, 0x8447, 0xb7ef, 0x8448, 0x8449, 0x844a, /*0xe0-0xe7*/ - 0x844b, 0x844c, 0x844d, 0xd9ec, 0x844e, 0xc6be, 0x844f, 0xbfad, /*0xe8-0xef*/ - 0xbbcb, 0x8450, 0x8451, 0xb5ca, 0x8452, 0xdbc9, 0xd0d7, 0x8453, /*0xf0-0xf7*/ - 0xcdb9, 0xb0bc, 0xb3f6, 0xbbf7, 0xdbca, 0xbaaf, 0x8454, 0xd4e4, /*0xf8-0xff*/ - /* 0x5200 */ - 0xb5b6, 0xb5f3, 0xd8d6, 0xc8d0, 0x8455, 0x8456, 0xb7d6, 0xc7d0, /*0x00-0x07*/ - 0xd8d7, 0x8457, 0xbfaf, 0x8458, 0x8459, 0xdbbb, 0xd8d8, 0x845a, /*0x08-0x0f*/ - 0x845b, 0xd0cc, 0xbbae, 0x845c, 0x845d, 0x845e, 0xebbe, 0xc1d0, /*0x10-0x17*/ - 0xc1f5, 0xd4f2, 0xb8d5, 0xb4b4, 0x845f, 0xb3f5, 0x8460, 0x8461, /*0x18-0x1f*/ - 0xc9be, 0x8462, 0x8463, 0x8464, 0xc5d0, 0x8465, 0x8466, 0x8467, /*0x20-0x27*/ - 0xc5d9, 0xc0fb, 0x8468, 0xb1f0, 0x8469, 0xd8d9, 0xb9ce, 0x846a, /*0x28-0x2f*/ - 0xb5bd, 0x846b, 0x846c, 0xd8da, 0x846d, 0x846e, 0xd6c6, 0xcba2, /*0x30-0x37*/ - 0xc8af, 0xc9b2, 0xb4cc, 0xbfcc, 0x846f, 0xb9f4, 0x8470, 0xd8db, /*0x38-0x3f*/ - 0xd8dc, 0xb6e7, 0xbcc1, 0xccea, 0x8471, 0x8472, 0x8473, 0x8474, /*0x40-0x47*/ - 0x8475, 0x8476, 0xcff7, 0x8477, 0xd8dd, 0xc7b0, 0x8478, 0x8479, /*0x48-0x4f*/ - 0xb9d0, 0xbda3, 0x847a, 0x847b, 0xccde, 0x847c, 0xc6ca, 0x847d, /*0x50-0x57*/ - 0x847e, 0x8480, 0x8481, 0x8482, 0xd8e0, 0x8483, 0xd8de, 0x8484, /*0x58-0x5f*/ - 0x8485, 0xd8df, 0x8486, 0x8487, 0x8488, 0xb0fe, 0x8489, 0xbee7, /*0x60-0x67*/ - 0x848a, 0xcaa3, 0xbcf4, 0x848b, 0x848c, 0x848d, 0x848e, 0xb8b1, /*0x68-0x6f*/ - 0x848f, 0x8490, 0xb8ee, 0x8491, 0x8492, 0x8493, 0x8494, 0x8495, /*0x70-0x77*/ - 0x8496, 0x8497, 0x8498, 0x8499, 0x849a, 0xd8e2, 0x849b, 0xbdcb, /*0x78-0x7f*/ - 0x849c, 0xd8e4, 0xd8e3, 0x849d, 0x849e, 0x849f, 0x84a0, 0x84a1, /*0x80-0x87*/ - 0xc5fc, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, 0x84a8, /*0x88-0x8f*/ - 0xd8e5, 0x84a9, 0x84aa, 0xd8e6, 0x84ab, 0x84ac, 0x84ad, 0x84ae, /*0x90-0x97*/ - 0x84af, 0x84b0, 0x84b1, 0xc1a6, 0x84b2, 0xc8b0, 0xb0ec, 0xb9a6, /*0x98-0x9f*/ - 0xbcd3, 0xcef1, 0xdbbd, 0xc1d3, 0x84b3, 0x84b4, 0x84b5, 0x84b6, /*0xa0-0xa7*/ - 0xb6af, 0xd6fa, 0xc5ac, 0xbdd9, 0xdbbe, 0xdbbf, 0x84b7, 0x84b8, /*0xa8-0xaf*/ - 0x84b9, 0xc0f8, 0xbea2, 0xc0cd, 0x84ba, 0x84bb, 0x84bc, 0x84bd, /*0xb0-0xb7*/ - 0x84be, 0x84bf, 0x84c0, 0x84c1, 0x84c2, 0x84c3, 0xdbc0, 0xcac6, /*0xb8-0xbf*/ - 0x84c4, 0x84c5, 0x84c6, 0xb2aa, 0x84c7, 0x84c8, 0x84c9, 0xd3c2, /*0xc0-0xc7*/ - 0x84ca, 0xc3e3, 0x84cb, 0xd1ab, 0x84cc, 0x84cd, 0x84ce, 0x84cf, /*0xc8-0xcf*/ - 0xdbc2, 0x84d0, 0xc0d5, 0x84d1, 0x84d2, 0x84d3, 0xdbc3, 0x84d4, /*0xd0-0xd7*/ - 0xbfb1, 0x84d5, 0x84d6, 0x84d7, 0x84d8, 0x84d9, 0x84da, 0xc4bc, /*0xd8-0xdf*/ - 0x84db, 0x84dc, 0x84dd, 0x84de, 0xc7da, 0x84df, 0x84e0, 0x84e1, /*0xe0-0xe7*/ - 0x84e2, 0x84e3, 0x84e4, 0x84e5, 0x84e6, 0x84e7, 0x84e8, 0x84e9, /*0xe8-0xef*/ - 0xdbc4, 0x84ea, 0x84eb, 0x84ec, 0x84ed, 0x84ee, 0x84ef, 0x84f0, /*0xf0-0xf7*/ - 0x84f1, 0xd9e8, 0xc9d7, 0x84f2, 0x84f3, 0x84f4, 0xb9b4, 0xcef0, /*0xf8-0xff*/ - /* 0x5300 */ - 0xd4c8, 0x84f5, 0x84f6, 0x84f7, 0x84f8, 0xb0fc, 0xb4d2, 0x84f9, /*0x00-0x07*/ - 0xd0d9, 0x84fa, 0x84fb, 0x84fc, 0x84fd, 0xd9e9, 0x84fe, 0xdecb, /*0x08-0x0f*/ - 0xd9eb, 0x8540, 0x8541, 0x8542, 0x8543, 0xd8b0, 0xbbaf, 0xb1b1, /*0x10-0x17*/ - 0x8544, 0xb3d7, 0xd8ce, 0x8545, 0x8546, 0xd4d1, 0x8547, 0x8548, /*0x18-0x1f*/ - 0xbdb3, 0xbfef, 0x8549, 0xcfbb, 0x854a, 0x854b, 0xd8d0, 0x854c, /*0x20-0x27*/ - 0x854d, 0x854e, 0xb7cb, 0x854f, 0x8550, 0x8551, 0xd8d1, 0x8552, /*0x28-0x2f*/ - 0x8553, 0x8554, 0x8555, 0x8556, 0x8557, 0x8558, 0x8559, 0x855a, /*0x30-0x37*/ - 0x855b, 0xc6a5, 0xc7f8, 0xd2bd, 0x855c, 0x855d, 0xd8d2, 0xc4e4, /*0x38-0x3f*/ - 0x855e, 0xcaae, 0x855f, 0xc7a7, 0x8560, 0xd8a6, 0x8561, 0xc9fd, /*0x40-0x47*/ - 0xcee7, 0xbbdc, 0xb0eb, 0x8562, 0x8563, 0x8564, 0xbbaa, 0xd0ad, /*0x48-0x4f*/ - 0x8565, 0xb1b0, 0xd7e4, 0xd7bf, 0x8566, 0xb5a5, 0xc2f4, 0xc4cf, /*0x50-0x57*/ - 0x8567, 0x8568, 0xb2a9, 0x8569, 0xb2b7, 0x856a, 0xb1e5, 0xdfb2, /*0x58-0x5f*/ - 0xd5bc, 0xbfa8, 0xc2ac, 0xd8d5, 0xc2b1, 0x856b, 0xd8d4, 0xced4, /*0x60-0x67*/ - 0x856c, 0xdae0, 0x856d, 0xcec0, 0x856e, 0x856f, 0xd8b4, 0xc3ae, /*0x68-0x6f*/ - 0xd3a1, 0xcea3, 0x8570, 0xbcb4, 0xc8b4, 0xc2d1, 0x8571, 0xbeed, /*0x70-0x77*/ - 0xd0b6, 0x8572, 0xdae1, 0x8573, 0x8574, 0x8575, 0x8576, 0xc7e4, /*0x78-0x7f*/ - 0x8577, 0x8578, 0xb3a7, 0x8579, 0xb6f2, 0xccfc, 0xc0fa, 0x857a, /*0x80-0x87*/ - 0x857b, 0xc0f7, 0x857c, 0xd1b9, 0xd1e1, 0xd8c7, 0x857d, 0x857e, /*0x88-0x8f*/ - 0x8580, 0x8581, 0x8582, 0x8583, 0x8584, 0xb2de, 0x8585, 0x8586, /*0x90-0x97*/ - 0xc0e5, 0x8587, 0xbaf1, 0x8588, 0x8589, 0xd8c8, 0x858a, 0xd4ad, /*0x98-0x9f*/ - 0x858b, 0x858c, 0xcfe1, 0xd8c9, 0x858d, 0xd8ca, 0xcfc3, 0x858e, /*0xa0-0xa7*/ - 0xb3f8, 0xbec7, 0x858f, 0x8590, 0x8591, 0x8592, 0xd8cb, 0x8593, /*0xa8-0xaf*/ - 0x8594, 0x8595, 0x8596, 0x8597, 0x8598, 0x8599, 0xdbcc, 0x859a, /*0xb0-0xb7*/ - 0x859b, 0x859c, 0x859d, 0xc8a5, 0x859e, 0x859f, 0x85a0, 0xcfd8, /*0xb8-0xbf*/ - 0x85a1, 0xc8fe, 0xb2ce, 0x85a2, 0x85a3, 0x85a4, 0x85a5, 0x85a6, /*0xc0-0xc7*/ - 0xd3d6, 0xb2e6, 0xbcb0, 0xd3d1, 0xcbab, 0xb7b4, 0x85a7, 0x85a8, /*0xc8-0xcf*/ - 0x85a9, 0xb7a2, 0x85aa, 0x85ab, 0xcae5, 0x85ac, 0xc8a1, 0xcadc, /*0xd0-0xd7*/ - 0xb1e4, 0xd0f0, 0x85ad, 0xc5d1, 0x85ae, 0x85af, 0x85b0, 0xdbc5, /*0xd8-0xdf*/ - 0xb5fe, 0x85b1, 0x85b2, 0xbfda, 0xb9c5, 0xbee4, 0xc1ed, 0x85b3, /*0xe0-0xe7*/ - 0xdfb6, 0xdfb5, 0xd6bb, 0xbdd0, 0xd5d9, 0xb0c8, 0xb6a3, 0xbfc9, /*0xe8-0xef*/ - 0xcca8, 0xdfb3, 0xcab7, 0xd3d2, 0x85b4, 0xd8cf, 0xd2b6, 0xbac5, /*0xf0-0xf7*/ - 0xcbbe, 0xccbe, 0x85b5, 0xdfb7, 0xb5f0, 0xdfb4, 0x85b6, 0x85b7, /*0xf8-0xff*/ - /* 0x5400 */ - 0x85b8, 0xd3f5, 0x85b9, 0xb3d4, 0xb8f7, 0x85ba, 0xdfba, 0x85bb, /*0x00-0x07*/ - 0xbacf, 0xbcaa, 0xb5f5, 0x85bc, 0xcdac, 0xc3fb, 0xbaf3, 0xc0f4, /*0x08-0x0f*/ - 0xcdc2, 0xcff2, 0xdfb8, 0xcfc5, 0x85bd, 0xc2c0, 0xdfb9, 0xc2f0, /*0x10-0x17*/ - 0x85be, 0x85bf, 0x85c0, 0xbefd, 0x85c1, 0xc1df, 0xcdcc, 0xd2f7, /*0x18-0x1f*/ - 0xb7cd, 0xdfc1, 0x85c2, 0xdfc4, 0x85c3, 0x85c4, 0xb7f1, 0xb0c9, /*0x20-0x27*/ - 0xb6d6, 0xb7d4, 0x85c5, 0xbaac, 0xccfd, 0xbfd4, 0xcbb1, 0xc6f4, /*0x28-0x2f*/ - 0x85c6, 0xd6a8, 0xdfc5, 0x85c7, 0xcee2, 0xb3b3, 0x85c8, 0x85c9, /*0x30-0x37*/ - 0xcefc, 0xb4b5, 0x85ca, 0xcec7, 0xbaf0, 0x85cb, 0xcee1, 0x85cc, /*0x38-0x3f*/ - 0xd1bd, 0x85cd, 0x85ce, 0xdfc0, 0x85cf, 0x85d0, 0xb4f4, 0x85d1, /*0x40-0x47*/ - 0xb3ca, 0x85d2, 0xb8e6, 0xdfbb, 0x85d3, 0x85d4, 0x85d5, 0x85d6, /*0x48-0x4f*/ - 0xc4c5, 0x85d7, 0xdfbc, 0xdfbd, 0xdfbe, 0xc5bb, 0xdfbf, 0xdfc2, /*0x50-0x57*/ - 0xd4b1, 0xdfc3, 0x85d8, 0xc7ba, 0xced8, 0x85d9, 0x85da, 0x85db, /*0x58-0x5f*/ - 0x85dc, 0x85dd, 0xc4d8, 0x85de, 0xdfca, 0x85df, 0xdfcf, 0x85e0, /*0x60-0x67*/ - 0xd6dc, 0x85e1, 0x85e2, 0x85e3, 0x85e4, 0x85e5, 0x85e6, 0x85e7, /*0x68-0x6f*/ - 0x85e8, 0xdfc9, 0xdfda, 0xceb6, 0x85e9, 0xbac7, 0xdfce, 0xdfc8, /*0x70-0x77*/ - 0xc5de, 0x85ea, 0x85eb, 0xc9eb, 0xbaf4, 0xc3fc, 0x85ec, 0x85ed, /*0x78-0x7f*/ - 0xbed7, 0x85ee, 0xdfc6, 0x85ef, 0xdfcd, 0x85f0, 0xc5d8, 0x85f1, /*0x80-0x87*/ - 0x85f2, 0x85f3, 0x85f4, 0xd5a6, 0xbacd, 0x85f5, 0xbecc, 0xd3bd, /*0x88-0x8f*/ - 0xb8c0, 0x85f6, 0xd6e4, 0x85f7, 0xdfc7, 0xb9be, 0xbfa7, 0x85f8, /*0x90-0x97*/ - 0x85f9, 0xc1fc, 0xdfcb, 0xdfcc, 0x85fa, 0xdfd0, 0x85fb, 0x85fc, /*0x98-0x9f*/ - 0x85fd, 0x85fe, 0x8640, 0xdfdb, 0xdfe5, 0x8641, 0xdfd7, 0xdfd6, /*0xa0-0xa7*/ - 0xd7c9, 0xdfe3, 0xdfe4, 0xe5eb, 0xd2a7, 0xdfd2, 0x8642, 0xbfa9, /*0xa8-0xaf*/ - 0x8643, 0xd4db, 0x8644, 0xbfc8, 0xdfd4, 0x8645, 0x8646, 0x8647, /*0xb0-0xb7*/ - 0xcfcc, 0x8648, 0x8649, 0xdfdd, 0x864a, 0xd1ca, 0x864b, 0xdfde, /*0xb8-0xbf*/ - 0xb0a7, 0xc6b7, 0xdfd3, 0x864c, 0xbae5, 0x864d, 0xb6df, 0xcddb, /*0xc0-0xc7*/ - 0xb9fe, 0xd4d5, 0x864e, 0x864f, 0xdfdf, 0xcfec, 0xb0a5, 0xdfe7, /*0xc8-0xcf*/ - 0xdfd1, 0xd1c6, 0xdfd5, 0xdfd8, 0xdfd9, 0xdfdc, 0x8650, 0xbba9, /*0xd0-0xd7*/ - 0x8651, 0xdfe0, 0xdfe1, 0x8652, 0xdfe2, 0xdfe6, 0xdfe8, 0xd3b4, /*0xd8-0xdf*/ - 0x8653, 0x8654, 0x8655, 0x8656, 0x8657, 0xb8e7, 0xc5b6, 0xdfea, /*0xe0-0xe7*/ - 0xc9da, 0xc1a8, 0xc4c4, 0x8658, 0x8659, 0xbfde, 0xcff8, 0x865a, /*0xe8-0xef*/ - 0x865b, 0x865c, 0xd5dc, 0xdfee, 0x865d, 0x865e, 0x865f, 0x8660, /*0xf0-0xf7*/ - 0x8661, 0x8662, 0xb2b8, 0x8663, 0xbadf, 0xdfec, 0x8664, 0xdbc1, /*0xf8-0xff*/ - /* 0x5500 */ - 0x8665, 0xd1e4, 0x8666, 0x8667, 0x8668, 0x8669, 0xcbf4, 0xb4bd, /*0x00-0x07*/ - 0x866a, 0xb0a6, 0x866b, 0x866c, 0x866d, 0x866e, 0x866f, 0xdff1, /*0x08-0x0f*/ - 0xccc6, 0xdff2, 0x8670, 0x8671, 0xdfed, 0x8672, 0x8673, 0x8674, /*0x10-0x17*/ - 0x8675, 0x8676, 0x8677, 0xdfe9, 0x8678, 0x8679, 0x867a, 0x867b, /*0x18-0x1f*/ - 0xdfeb, 0x867c, 0xdfef, 0xdff0, 0xbbbd, 0x867d, 0x867e, 0xdff3, /*0x20-0x27*/ - 0x8680, 0x8681, 0xdff4, 0x8682, 0xbba3, 0x8683, 0xcadb, 0xcea8, /*0x28-0x2f*/ - 0xe0a7, 0xb3aa, 0x8684, 0xe0a6, 0x8685, 0x8686, 0x8687, 0xe0a1, /*0x30-0x37*/ - 0x8688, 0x8689, 0x868a, 0x868b, 0xdffe, 0x868c, 0xcdd9, 0xdffc, /*0x38-0x3f*/ - 0x868d, 0xdffa, 0x868e, 0xbfd0, 0xd7c4, 0x868f, 0xc9cc, 0x8690, /*0x40-0x47*/ - 0x8691, 0xdff8, 0xb0a1, 0x8692, 0x8693, 0x8694, 0x8695, 0x8696, /*0x48-0x4f*/ - 0xdffd, 0x8697, 0x8698, 0x8699, 0x869a, 0xdffb, 0xe0a2, 0x869b, /*0x50-0x57*/ - 0x869c, 0x869d, 0x869e, 0x869f, 0xe0a8, 0x86a0, 0x86a1, 0x86a2, /*0x58-0x5f*/ - 0x86a3, 0xb7c8, 0x86a4, 0x86a5, 0xc6a1, 0xc9b6, 0xc0b2, 0xdff5, /*0x60-0x67*/ - 0x86a6, 0x86a7, 0xc5be, 0x86a8, 0xd8c4, 0xdff9, 0xc4f6, 0x86a9, /*0x68-0x6f*/ - 0x86aa, 0x86ab, 0x86ac, 0x86ad, 0x86ae, 0xe0a3, 0xe0a4, 0xe0a5, /*0x70-0x77*/ - 0xd0a5, 0x86af, 0x86b0, 0xe0b4, 0xcce4, 0x86b1, 0xe0b1, 0x86b2, /*0x78-0x7f*/ - 0xbfa6, 0xe0af, 0xceb9, 0xe0ab, 0xc9c6, 0x86b3, 0x86b4, 0xc0ae, /*0x80-0x87*/ - 0xe0ae, 0xbaed, 0xbab0, 0xe0a9, 0x86b5, 0x86b6, 0x86b7, 0xdff6, /*0x88-0x8f*/ - 0x86b8, 0xe0b3, 0x86b9, 0x86ba, 0xe0b8, 0x86bb, 0x86bc, 0x86bd, /*0x90-0x97*/ - 0xb4ad, 0xe0b9, 0x86be, 0x86bf, 0xcfb2, 0xbac8, 0x86c0, 0xe0b0, /*0x98-0x9f*/ - 0x86c1, 0x86c2, 0x86c3, 0x86c4, 0x86c5, 0x86c6, 0x86c7, 0xd0fa, /*0xa0-0xa7*/ - 0x86c8, 0x86c9, 0x86ca, 0x86cb, 0x86cc, 0x86cd, 0x86ce, 0x86cf, /*0xa8-0xaf*/ - 0x86d0, 0xe0ac, 0x86d1, 0xd4fb, 0x86d2, 0xdff7, 0x86d3, 0xc5e7, /*0xb0-0xb7*/ - 0x86d4, 0xe0ad, 0x86d5, 0xd3f7, 0x86d6, 0xe0b6, 0xe0b7, 0x86d7, /*0xb8-0xbf*/ - 0x86d8, 0x86d9, 0x86da, 0x86db, 0xe0c4, 0xd0e1, 0x86dc, 0x86dd, /*0xc0-0xc7*/ - 0x86de, 0xe0bc, 0x86df, 0x86e0, 0xe0c9, 0xe0ca, 0x86e1, 0x86e2, /*0xc8-0xcf*/ - 0x86e3, 0xe0be, 0xe0aa, 0xc9a4, 0xe0c1, 0x86e4, 0xe0b2, 0x86e5, /*0xd0-0xd7*/ - 0x86e6, 0x86e7, 0x86e8, 0x86e9, 0xcac8, 0xe0c3, 0x86ea, 0xe0b5, /*0xd8-0xdf*/ - 0x86eb, 0xcecb, 0x86ec, 0xcbc3, 0xe0cd, 0xe0c6, 0xe0c2, 0x86ed, /*0xe0-0xe7*/ - 0xe0cb, 0x86ee, 0xe0ba, 0xe0bf, 0xe0c0, 0x86ef, 0x86f0, 0xe0c5, /*0xe8-0xef*/ - 0x86f1, 0x86f2, 0xe0c7, 0xe0c8, 0x86f3, 0xe0cc, 0x86f4, 0xe0bb, /*0xf0-0xf7*/ - 0x86f5, 0x86f6, 0x86f7, 0x86f8, 0x86f9, 0xcbd4, 0xe0d5, 0x86fa, /*0xf8-0xff*/ - /* 0x5600 */ - 0xe0d6, 0xe0d2, 0x86fb, 0x86fc, 0x86fd, 0x86fe, 0x8740, 0x8741, /*0x00-0x07*/ - 0xe0d0, 0xbcce, 0x8742, 0x8743, 0xe0d1, 0x8744, 0xb8c2, 0xd8c5, /*0x08-0x0f*/ - 0x8745, 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c, /*0x10-0x17*/ - 0xd0ea, 0x874d, 0x874e, 0xc2ef, 0x874f, 0x8750, 0xe0cf, 0xe0bd, /*0x18-0x1f*/ - 0x8751, 0x8752, 0x8753, 0xe0d4, 0xe0d3, 0x8754, 0x8755, 0xe0d7, /*0x20-0x27*/ - 0x8756, 0x8757, 0x8758, 0x8759, 0xe0dc, 0xe0d8, 0x875a, 0x875b, /*0x28-0x2f*/ - 0x875c, 0xd6f6, 0xb3b0, 0x875d, 0xd7ec, 0x875e, 0xcbbb, 0x875f, /*0x30-0x37*/ - 0x8760, 0xe0da, 0x8761, 0xcefb, 0x8762, 0x8763, 0x8764, 0xbad9, /*0x38-0x3f*/ - 0x8765, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, /*0x40-0x47*/ - 0x876d, 0x876e, 0x876f, 0x8770, 0xe0e1, 0xe0dd, 0xd2ad, 0x8771, /*0x48-0x4f*/ - 0x8772, 0x8773, 0x8774, 0x8775, 0xe0e2, 0x8776, 0x8777, 0xe0db, /*0x50-0x57*/ - 0xe0d9, 0xe0df, 0x8778, 0x8779, 0xe0e0, 0x877a, 0x877b, 0x877c, /*0x58-0x5f*/ - 0x877d, 0x877e, 0xe0de, 0x8780, 0xe0e4, 0x8781, 0x8782, 0x8783, /*0x60-0x67*/ - 0xc6f7, 0xd8ac, 0xd4eb, 0xe0e6, 0xcac9, 0x8784, 0x8785, 0x8786, /*0x68-0x6f*/ - 0x8787, 0xe0e5, 0x8788, 0x8789, 0x878a, 0x878b, 0xb8c1, 0x878c, /*0x70-0x77*/ - 0x878d, 0x878e, 0x878f, 0xe0e7, 0xe0e8, 0x8790, 0x8791, 0x8792, /*0x78-0x7f*/ - 0x8793, 0x8794, 0x8795, 0x8796, 0x8797, 0xe0e9, 0xe0e3, 0x8798, /*0x80-0x87*/ - 0x8799, 0x879a, 0x879b, 0x879c, 0x879d, 0x879e, 0xbabf, 0xcce7, /*0x88-0x8f*/ - 0x879f, 0x87a0, 0x87a1, 0xe0ea, 0x87a2, 0x87a3, 0x87a4, 0x87a5, /*0x90-0x97*/ - 0x87a6, 0x87a7, 0x87a8, 0x87a9, 0x87aa, 0x87ab, 0x87ac, 0x87ad, /*0x98-0x9f*/ - 0x87ae, 0x87af, 0x87b0, 0xcff9, 0x87b1, 0x87b2, 0x87b3, 0x87b4, /*0xa0-0xa7*/ - 0x87b5, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87ba, 0x87bb, 0xe0eb, /*0xa8-0xaf*/ - 0x87bc, 0x87bd, 0x87be, 0x87bf, 0x87c0, 0x87c1, 0x87c2, 0xc8c2, /*0xb0-0xb7*/ - 0x87c3, 0x87c4, 0x87c5, 0x87c6, 0xbdc0, 0x87c7, 0x87c8, 0x87c9, /*0xb8-0xbf*/ - 0x87ca, 0x87cb, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d1, /*0xc0-0xc7*/ - 0x87d2, 0x87d3, 0xc4d2, 0x87d4, 0x87d5, 0x87d6, 0x87d7, 0x87d8, /*0xc8-0xcf*/ - 0x87d9, 0x87da, 0x87db, 0x87dc, 0xe0ec, 0x87dd, 0x87de, 0xe0ed, /*0xd0-0xd7*/ - 0x87df, 0x87e0, 0xc7f4, 0xcbc4, 0x87e1, 0xe0ee, 0xbbd8, 0xd8b6, /*0xd8-0xdf*/ - 0xd2f2, 0xe0ef, 0xcdc5, 0x87e2, 0xb6da, 0x87e3, 0x87e4, 0x87e5, /*0xe0-0xe7*/ - 0x87e6, 0x87e7, 0x87e8, 0xe0f1, 0x87e9, 0xd4b0, 0x87ea, 0x87eb, /*0xe8-0xef*/ - 0xc0a7, 0xb4d1, 0x87ec, 0x87ed, 0xcea7, 0xe0f0, 0x87ee, 0x87ef, /*0xf0-0xf7*/ - 0x87f0, 0xe0f2, 0xb9cc, 0x87f1, 0x87f2, 0xb9fa, 0xcdbc, 0xe0f3, /*0xf8-0xff*/ - /* 0x5700 */ - 0x87f3, 0x87f4, 0x87f5, 0xc6d4, 0xe0f4, 0x87f6, 0xd4b2, 0x87f7, /*0x00-0x07*/ - 0xc8a6, 0xe0f6, 0xe0f5, 0x87f8, 0x87f9, 0x87fa, 0x87fb, 0x87fc, /*0x08-0x0f*/ - 0x87fd, 0x87fe, 0x8840, 0x8841, 0x8842, 0x8843, 0x8844, 0x8845, /*0x10-0x17*/ - 0x8846, 0x8847, 0x8848, 0x8849, 0xe0f7, 0x884a, 0x884b, 0xcdc1, /*0x18-0x1f*/ - 0x884c, 0x884d, 0x884e, 0xcaa5, 0x884f, 0x8850, 0x8851, 0x8852, /*0x20-0x27*/ - 0xd4da, 0xdbd7, 0xdbd9, 0x8853, 0xdbd8, 0xb9e7, 0xdbdc, 0xdbdd, /*0x28-0x2f*/ - 0xb5d8, 0x8854, 0x8855, 0xdbda, 0x8856, 0x8857, 0x8858, 0x8859, /*0x30-0x37*/ - 0x885a, 0xdbdb, 0xb3a1, 0xdbdf, 0x885b, 0x885c, 0xbbf8, 0x885d, /*0x38-0x3f*/ - 0xd6b7, 0x885e, 0xdbe0, 0x885f, 0x8860, 0x8861, 0x8862, 0xbef9, /*0x40-0x47*/ - 0x8863, 0x8864, 0xb7bb, 0x8865, 0xdbd0, 0xccae, 0xbfb2, 0xbbb5, /*0x48-0x4f*/ - 0xd7f8, 0xbfd3, 0x8866, 0x8867, 0x8868, 0x8869, 0x886a, 0xbfe9, /*0x50-0x57*/ - 0x886b, 0x886c, 0xbce1, 0xccb3, 0xdbde, 0xb0d3, 0xceeb, 0xb7d8, /*0x58-0x5f*/ - 0xd7b9, 0xc6c2, 0x886d, 0x886e, 0xc0a4, 0x886f, 0xccb9, 0x8870, /*0x60-0x67*/ - 0xdbe7, 0xdbe1, 0xc6ba, 0xdbe3, 0x8871, 0xdbe8, 0x8872, 0xc5f7, /*0x68-0x6f*/ - 0x8873, 0x8874, 0x8875, 0xdbea, 0x8876, 0x8877, 0xdbe9, 0xbfc0, /*0x70-0x77*/ - 0x8878, 0x8879, 0x887a, 0xdbe6, 0xdbe5, 0x887b, 0x887c, 0x887d, /*0x78-0x7f*/ - 0x887e, 0x8880, 0xb4b9, 0xc0ac, 0xc2a2, 0xdbe2, 0xdbe4, 0x8881, /*0x80-0x87*/ - 0x8882, 0x8883, 0x8884, 0xd0cd, 0xdbed, 0x8885, 0x8886, 0x8887, /*0x88-0x8f*/ - 0x8888, 0x8889, 0xc0dd, 0xdbf2, 0x888a, 0x888b, 0x888c, 0x888d, /*0x90-0x97*/ - 0x888e, 0x888f, 0x8890, 0xb6e2, 0x8891, 0x8892, 0x8893, 0x8894, /*0x98-0x9f*/ - 0xdbf3, 0xdbd2, 0xb9b8, 0xd4ab, 0xdbec, 0x8895, 0xbfd1, 0xdbf0, /*0xa0-0xa7*/ - 0x8896, 0xdbd1, 0x8897, 0xb5e6, 0x8898, 0xdbeb, 0xbfe5, 0x8899, /*0xa8-0xaf*/ - 0x889a, 0x889b, 0xdbee, 0x889c, 0xdbf1, 0x889d, 0x889e, 0x889f, /*0xb0-0xb7*/ - 0xdbf9, 0x88a0, 0x88a1, 0x88a2, 0x88a3, 0x88a4, 0x88a5, 0x88a6, /*0xb8-0xbf*/ - 0x88a7, 0x88a8, 0xb9a1, 0xb0a3, 0x88a9, 0x88aa, 0x88ab, 0x88ac, /*0xc0-0xc7*/ - 0x88ad, 0x88ae, 0x88af, 0xc2f1, 0x88b0, 0x88b1, 0xb3c7, 0xdbef, /*0xc8-0xcf*/ - 0x88b2, 0x88b3, 0xdbf8, 0x88b4, 0xc6d2, 0xdbf4, 0x88b5, 0x88b6, /*0xd0-0xd7*/ - 0xdbf5, 0xdbf7, 0xdbf6, 0x88b7, 0x88b8, 0xdbfe, 0x88b9, 0xd3f2, /*0xd8-0xdf*/ - 0xb2ba, 0x88ba, 0x88bb, 0x88bc, 0xdbfd, 0x88bd, 0x88be, 0x88bf, /*0xe0-0xe7*/ - 0x88c0, 0x88c1, 0x88c2, 0x88c3, 0x88c4, 0xdca4, 0x88c5, 0xdbfb, /*0xe8-0xef*/ - 0x88c6, 0x88c7, 0x88c8, 0x88c9, 0xdbfa, 0x88ca, 0x88cb, 0x88cc, /*0xf0-0xf7*/ - 0xdbfc, 0xc5e0, 0xbbf9, 0x88cd, 0x88ce, 0xdca3, 0x88cf, 0x88d0, /*0xf8-0xff*/ - /* 0x5800 */ - 0xdca5, 0x88d1, 0xccc3, 0x88d2, 0x88d3, 0x88d4, 0xb6d1, 0xddc0, /*0x00-0x07*/ - 0x88d5, 0x88d6, 0x88d7, 0xdca1, 0x88d8, 0xdca2, 0x88d9, 0x88da, /*0x08-0x0f*/ - 0x88db, 0xc7b5, 0x88dc, 0x88dd, 0x88de, 0xb6e9, 0x88df, 0x88e0, /*0x10-0x17*/ - 0x88e1, 0xdca7, 0x88e2, 0x88e3, 0x88e4, 0x88e5, 0xdca6, 0x88e6, /*0x18-0x1f*/ - 0xdca9, 0xb1a4, 0x88e7, 0x88e8, 0xb5cc, 0x88e9, 0x88ea, 0x88eb, /*0x20-0x27*/ - 0x88ec, 0x88ed, 0xbfb0, 0x88ee, 0x88ef, 0x88f0, 0x88f1, 0x88f2, /*0x28-0x2f*/ - 0xd1df, 0x88f3, 0x88f4, 0x88f5, 0x88f6, 0xb6c2, 0x88f7, 0x88f8, /*0x30-0x37*/ - 0x88f9, 0x88fa, 0x88fb, 0x88fc, 0x88fd, 0x88fe, 0x8940, 0x8941, /*0x38-0x3f*/ - 0x8942, 0x8943, 0x8944, 0x8945, 0xdca8, 0x8946, 0x8947, 0x8948, /*0x40-0x47*/ - 0x8949, 0x894a, 0x894b, 0x894c, 0xcbfa, 0xebf3, 0x894d, 0x894e, /*0x48-0x4f*/ - 0x894f, 0xcbdc, 0x8950, 0x8951, 0xcbfe, 0x8952, 0x8953, 0x8954, /*0x50-0x57*/ - 0xccc1, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0xc8fb, 0x895a, /*0x58-0x5f*/ - 0x895b, 0x895c, 0x895d, 0x895e, 0x895f, 0xdcaa, 0x8960, 0x8961, /*0x60-0x67*/ - 0x8962, 0x8963, 0x8964, 0xccee, 0xdcab, 0x8965, 0x8966, 0x8967, /*0x68-0x6f*/ - 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, 0x896d, 0x896e, 0x896f, /*0x70-0x77*/ - 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, 0x8975, 0xdbd3, 0x8976, /*0x78-0x7f*/ - 0xdcaf, 0xdcac, 0x8977, 0xbeb3, 0x8978, 0xcafb, 0x8979, 0x897a, /*0x80-0x87*/ - 0x897b, 0xdcad, 0x897c, 0x897d, 0x897e, 0x8980, 0x8981, 0x8982, /*0x88-0x8f*/ - 0x8983, 0x8984, 0xc9ca, 0xc4b9, 0x8985, 0x8986, 0x8987, 0x8988, /*0x90-0x97*/ - 0x8989, 0xc7bd, 0xdcae, 0x898a, 0x898b, 0x898c, 0xd4f6, 0xd0e6, /*0x98-0x9f*/ - 0x898d, 0x898e, 0x898f, 0x8990, 0x8991, 0x8992, 0x8993, 0x8994, /*0xa0-0xa7*/ - 0xc4ab, 0xb6d5, 0x8995, 0x8996, 0x8997, 0x8998, 0x8999, 0x899a, /*0xa8-0xaf*/ - 0x899b, 0x899c, 0x899d, 0x899e, 0x899f, 0x89a0, 0x89a1, 0x89a2, /*0xb0-0xb7*/ - 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0xdbd4, 0x89a7, 0x89a8, 0x89a9, /*0xb8-0xbf*/ - 0x89aa, 0xb1da, 0x89ab, 0x89ac, 0x89ad, 0xdbd5, 0x89ae, 0x89af, /*0xc0-0xc7*/ - 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, /*0xc8-0xcf*/ - 0x89b8, 0xdbd6, 0x89b9, 0x89ba, 0x89bb, 0xbabe, 0x89bc, 0x89bd, /*0xd0-0xd7*/ - 0x89be, 0x89bf, 0x89c0, 0x89c1, 0x89c2, 0x89c3, 0x89c4, 0x89c5, /*0xd8-0xdf*/ - 0x89c6, 0x89c7, 0x89c8, 0x89c9, 0xc8c0, 0x89ca, 0x89cb, 0x89cc, /*0xe0-0xe7*/ - 0x89cd, 0x89ce, 0x89cf, 0xcabf, 0xc8c9, 0x89d0, 0xd7b3, 0x89d1, /*0xe8-0xef*/ - 0xc9f9, 0x89d2, 0x89d3, 0xbfc7, 0x89d4, 0x89d5, 0xbaf8, 0x89d6, /*0xf0-0xf7*/ - 0x89d7, 0xd2bc, 0x89d8, 0x89d9, 0x89da, 0x89db, 0x89dc, 0x89dd, /*0xf8-0xff*/ - /* 0x5900 */ - 0x89de, 0x89df, 0xe2ba, 0x89e0, 0xb4a6, 0x89e1, 0x89e2, 0xb1b8, /*0x00-0x07*/ - 0x89e3, 0x89e4, 0x89e5, 0x89e6, 0x89e7, 0xb8b4, 0x89e8, 0xcfc4, /*0x08-0x0f*/ - 0x89e9, 0x89ea, 0x89eb, 0x89ec, 0xd9e7, 0xcfa6, 0xcde2, 0x89ed, /*0x10-0x17*/ - 0x89ee, 0xd9ed, 0xb6e0, 0x89ef, 0xd2b9, 0x89f0, 0x89f1, 0xb9bb, /*0x18-0x1f*/ - 0x89f2, 0x89f3, 0x89f4, 0x89f5, 0xe2b9, 0xe2b7, 0x89f6, 0xb4f3, /*0x20-0x27*/ - 0x89f7, 0xccec, 0xccab, 0xb7f2, 0x89f8, 0xd8b2, 0xd1eb, 0xbabb, /*0x28-0x2f*/ - 0x89f9, 0xcaa7, 0x89fa, 0x89fb, 0xcdb7, 0x89fc, 0x89fd, 0xd2c4, /*0x30-0x37*/ - 0xbfe4, 0xbcd0, 0xb6e1, 0x89fe, 0xdec5, 0x8a40, 0x8a41, 0x8a42, /*0x38-0x3f*/ - 0x8a43, 0xdec6, 0xdbbc, 0x8a44, 0xd1d9, 0x8a45, 0x8a46, 0xc6e6, /*0x40-0x47*/ - 0xc4ce, 0xb7ee, 0x8a47, 0xb7dc, 0x8a48, 0x8a49, 0xbffc, 0xd7e0, /*0x48-0x4f*/ - 0x8a4a, 0xc6f5, 0x8a4b, 0x8a4c, 0xb1bc, 0xdec8, 0xbdb1, 0xccd7, /*0x50-0x57*/ - 0xdeca, 0x8a4d, 0xdec9, 0x8a4e, 0x8a4f, 0x8a50, 0x8a51, 0x8a52, /*0x58-0x5f*/ - 0xb5ec, 0x8a53, 0xc9dd, 0x8a54, 0x8a55, 0xb0c2, 0x8a56, 0x8a57, /*0x60-0x67*/ - 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, /*0x68-0x6f*/ - 0x8a60, 0x8a61, 0x8a62, 0xc5ae, 0xc5ab, 0x8a63, 0xc4cc, 0x8a64, /*0x70-0x77*/ - 0xbce9, 0xcbfd, 0x8a65, 0x8a66, 0x8a67, 0xbac3, 0x8a68, 0x8a69, /*0x78-0x7f*/ - 0x8a6a, 0xe5f9, 0xc8e7, 0xe5fa, 0xcdfd, 0x8a6b, 0xd7b1, 0xb8be, /*0x80-0x87*/ - 0xc2e8, 0x8a6c, 0xc8d1, 0x8a6d, 0x8a6e, 0xe5fb, 0x8a6f, 0x8a70, /*0x88-0x8f*/ - 0x8a71, 0x8a72, 0xb6ca, 0xbccb, 0x8a73, 0x8a74, 0xd1fd, 0xe6a1, /*0x90-0x97*/ - 0x8a75, 0xc3ee, 0x8a76, 0x8a77, 0x8a78, 0x8a79, 0xe6a4, 0x8a7a, /*0x98-0x9f*/ - 0x8a7b, 0x8a7c, 0x8a7d, 0xe5fe, 0xe6a5, 0xcdd7, 0x8a7e, 0x8a80, /*0xa0-0xa7*/ - 0xb7c1, 0xe5fc, 0xe5fd, 0xe6a3, 0x8a81, 0x8a82, 0xc4dd, 0xe6a8, /*0xa8-0xaf*/ - 0x8a83, 0x8a84, 0xe6a7, 0x8a85, 0x8a86, 0x8a87, 0x8a88, 0x8a89, /*0xb0-0xb7*/ - 0x8a8a, 0xc3c3, 0x8a8b, 0xc6de, 0x8a8c, 0x8a8d, 0xe6aa, 0x8a8e, /*0xb8-0xbf*/ - 0x8a8f, 0x8a90, 0x8a91, 0x8a92, 0x8a93, 0x8a94, 0xc4b7, 0x8a95, /*0xc0-0xc7*/ - 0x8a96, 0x8a97, 0xe6a2, 0xcabc, 0x8a98, 0x8a99, 0x8a9a, 0x8a9b, /*0xc8-0xcf*/ - 0xbde3, 0xb9c3, 0xe6a6, 0xd0d5, 0xceaf, 0x8a9c, 0x8a9d, 0xe6a9, /*0xd0-0xd7*/ - 0xe6b0, 0x8a9e, 0xd2a6, 0x8a9f, 0xbdaa, 0xe6ad, 0x8aa0, 0x8aa1, /*0xd8-0xdf*/ - 0x8aa2, 0x8aa3, 0x8aa4, 0xe6af, 0x8aa5, 0xc0d1, 0x8aa6, 0x8aa7, /*0xe0-0xe7*/ - 0xd2cc, 0x8aa8, 0x8aa9, 0x8aaa, 0xbca7, 0x8aab, 0x8aac, 0x8aad, /*0xe8-0xef*/ - 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, /*0xf0-0xf7*/ - 0x8ab6, 0xe6b1, 0x8ab7, 0xd2f6, 0x8ab8, 0x8ab9, 0x8aba, 0xd7cb, /*0xf8-0xff*/ - /* 0x5a00 */ - 0x8abb, 0xcdfe, 0x8abc, 0xcdde, 0xc2a6, 0xe6ab, 0xe6ac, 0xbdbf, /*0x00-0x07*/ - 0xe6ae, 0xe6b3, 0x8abd, 0x8abe, 0xe6b2, 0x8abf, 0x8ac0, 0x8ac1, /*0x08-0x0f*/ - 0x8ac2, 0xe6b6, 0x8ac3, 0xe6b8, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, /*0x10-0x17*/ - 0xc4ef, 0x8ac8, 0x8ac9, 0x8aca, 0xc4c8, 0x8acb, 0x8acc, 0xbeea, /*0x18-0x1f*/ - 0xc9ef, 0x8acd, 0x8ace, 0xe6b7, 0x8acf, 0xb6f0, 0x8ad0, 0x8ad1, /*0x20-0x27*/ - 0x8ad2, 0xc3e4, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, /*0x28-0x2f*/ - 0x8ad9, 0xd3e9, 0xe6b4, 0x8ada, 0xe6b5, 0x8adb, 0xc8a2, 0x8adc, /*0x30-0x37*/ - 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0xe6bd, 0x8ae1, 0x8ae2, 0x8ae3, /*0x38-0x3f*/ - 0xe6b9, 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0xc6c5, 0x8ae9, /*0x40-0x47*/ - 0x8aea, 0xcdf1, 0xe6bb, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, /*0x48-0x4f*/ - 0x8af0, 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0xe6bc, 0x8af5, 0x8af6, /*0x50-0x57*/ - 0x8af7, 0x8af8, 0xbbe9, 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, /*0x58-0x5f*/ - 0x8afe, 0x8b40, 0xe6be, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0xe6ba, /*0x60-0x67*/ - 0x8b45, 0x8b46, 0xc0b7, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, /*0x68-0x6f*/ - 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0xd3a4, 0xe6bf, 0xc9f4, 0xe6c3, /*0x70-0x77*/ - 0x8b50, 0x8b51, 0xe6c4, 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0xd0f6, /*0x78-0x7f*/ - 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, /*0x80-0x87*/ - 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, /*0x88-0x8f*/ - 0x8b66, 0x8b67, 0xc3bd, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6c, /*0x90-0x97*/ - 0x8b6d, 0x8b6e, 0xc3c4, 0xe6c2, 0x8b6f, 0x8b70, 0x8b71, 0x8b72, /*0x98-0x9f*/ - 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, 0x8b7a, /*0xa0-0xa7*/ - 0x8b7b, 0x8b7c, 0xe6c1, 0x8b7d, 0x8b7e, 0x8b80, 0x8b81, 0x8b82, /*0xa8-0xaf*/ - 0x8b83, 0x8b84, 0xe6c7, 0xcfb1, 0x8b85, 0xebf4, 0x8b86, 0x8b87, /*0xb0-0xb7*/ - 0xe6ca, 0x8b88, 0x8b89, 0x8b8a, 0x8b8b, 0x8b8c, 0xe6c5, 0x8b8d, /*0xb8-0xbf*/ - 0x8b8e, 0xbcde, 0xc9a9, 0x8b8f, 0x8b90, 0x8b91, 0x8b92, 0x8b93, /*0xc0-0xc7*/ - 0x8b94, 0xbcb5, 0x8b95, 0x8b96, 0xcfd3, 0x8b97, 0x8b98, 0x8b99, /*0xc8-0xcf*/ - 0x8b9a, 0x8b9b, 0xe6c8, 0x8b9c, 0xe6c9, 0x8b9d, 0xe6ce, 0x8b9e, /*0xd0-0xd7*/ - 0xe6d0, 0x8b9f, 0x8ba0, 0x8ba1, 0xe6d1, 0x8ba2, 0x8ba3, 0x8ba4, /*0xd8-0xdf*/ - 0xe6cb, 0xb5d5, 0x8ba5, 0xe6cc, 0x8ba6, 0x8ba7, 0xe6cf, 0x8ba8, /*0xe0-0xe7*/ - 0x8ba9, 0xc4db, 0x8baa, 0xe6c6, 0x8bab, 0x8bac, 0x8bad, 0x8bae, /*0xe8-0xef*/ - 0x8baf, 0xe6cd, 0x8bb0, 0x8bb1, 0x8bb2, 0x8bb3, 0x8bb4, 0x8bb5, /*0xf0-0xf7*/ - 0x8bb6, 0x8bb7, 0x8bb8, 0x8bb9, 0x8bba, 0x8bbb, 0x8bbc, 0x8bbd, /*0xf8-0xff*/ - /* 0x5b00 */ - 0x8bbe, 0x8bbf, 0x8bc0, 0x8bc1, 0x8bc2, 0x8bc3, 0x8bc4, 0x8bc5, /*0x00-0x07*/ - 0x8bc6, 0xe6d2, 0x8bc7, 0x8bc8, 0x8bc9, 0x8bca, 0x8bcb, 0x8bcc, /*0x08-0x0f*/ - 0x8bcd, 0x8bce, 0x8bcf, 0x8bd0, 0x8bd1, 0x8bd2, 0xe6d4, 0xe6d3, /*0x10-0x17*/ - 0x8bd3, 0x8bd4, 0x8bd5, 0x8bd6, 0x8bd7, 0x8bd8, 0x8bd9, 0x8bda, /*0x18-0x1f*/ - 0x8bdb, 0x8bdc, 0x8bdd, 0x8bde, 0x8bdf, 0x8be0, 0x8be1, 0x8be2, /*0x20-0x27*/ - 0x8be3, 0x8be4, 0x8be5, 0x8be6, 0x8be7, 0x8be8, 0x8be9, 0x8bea, /*0x28-0x2f*/ - 0x8beb, 0x8bec, 0xe6d5, 0x8bed, 0xd9f8, 0x8bee, 0x8bef, 0xe6d6, /*0x30-0x37*/ - 0x8bf0, 0x8bf1, 0x8bf2, 0x8bf3, 0x8bf4, 0x8bf5, 0x8bf6, 0x8bf7, /*0x38-0x3f*/ - 0xe6d7, 0x8bf8, 0x8bf9, 0x8bfa, 0x8bfb, 0x8bfc, 0x8bfd, 0x8bfe, /*0x40-0x47*/ - 0x8c40, 0x8c41, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c46, 0x8c47, /*0x48-0x4f*/ - 0xd7d3, 0xe6dd, 0x8c48, 0xe6de, 0xbfd7, 0xd4d0, 0x8c49, 0xd7d6, /*0x50-0x57*/ - 0xb4e6, 0xcbef, 0xe6da, 0xd8c3, 0xd7ce, 0xd0a2, 0x8c4a, 0xc3cf, /*0x58-0x5f*/ - 0x8c4b, 0x8c4c, 0xe6df, 0xbcbe, 0xb9c2, 0xe6db, 0xd1a7, 0x8c4d, /*0x60-0x67*/ - 0x8c4e, 0xbaa2, 0xc2cf, 0x8c4f, 0xd8ab, 0x8c50, 0x8c51, 0x8c52, /*0x68-0x6f*/ - 0xcaeb, 0xe5ee, 0x8c53, 0xe6dc, 0x8c54, 0xb7f5, 0x8c55, 0x8c56, /*0x70-0x77*/ - 0x8c57, 0x8c58, 0xc8e6, 0x8c59, 0x8c5a, 0xc4f5, 0x8c5b, 0x8c5c, /*0x78-0x7f*/ - 0xe5b2, 0xc4fe, 0x8c5d, 0xcbfc, 0xe5b3, 0xd5ac, 0x8c5e, 0xd3ee, /*0x80-0x87*/ - 0xcad8, 0xb0b2, 0x8c5f, 0xcbce, 0xcdea, 0x8c60, 0x8c61, 0xbaea, /*0x88-0x8f*/ - 0x8c62, 0x8c63, 0x8c64, 0xe5b5, 0x8c65, 0xe5b4, 0x8c66, 0xd7da, /*0x90-0x97*/ - 0xb9d9, 0xd6e6, 0xb6a8, 0xcdf0, 0xd2cb, 0xb1a6, 0xcab5, 0x8c67, /*0x98-0x9f*/ - 0xb3e8, 0xc9f3, 0xbfcd, 0xd0fb, 0xcad2, 0xe5b6, 0xbbc2, 0x8c68, /*0xa0-0xa7*/ - 0x8c69, 0x8c6a, 0xcfdc, 0xb9ac, 0x8c6b, 0x8c6c, 0x8c6d, 0x8c6e, /*0xa8-0xaf*/ - 0xd4d7, 0x8c6f, 0x8c70, 0xbaa6, 0xd1e7, 0xcffc, 0xbcd2, 0x8c71, /*0xb0-0xb7*/ - 0xe5b7, 0xc8dd, 0x8c72, 0x8c73, 0x8c74, 0xbfed, 0xb1f6, 0xcbde, /*0xb8-0xbf*/ - 0x8c75, 0x8c76, 0xbcc5, 0x8c77, 0xbcc4, 0xd2fa, 0xc3dc, 0xbfdc, /*0xc0-0xc7*/ - 0x8c78, 0x8c79, 0x8c7a, 0x8c7b, 0xb8bb, 0x8c7c, 0x8c7d, 0x8c7e, /*0xc8-0xcf*/ - 0xc3c2, 0x8c80, 0xbaae, 0xd4a2, 0x8c81, 0x8c82, 0x8c83, 0x8c84, /*0xd0-0xd7*/ - 0x8c85, 0x8c86, 0x8c87, 0x8c88, 0x8c89, 0xc7de, 0xc4af, 0xb2ec, /*0xd8-0xdf*/ - 0x8c8a, 0xb9d1, 0x8c8b, 0x8c8c, 0xe5bb, 0xc1c8, 0x8c8d, 0x8c8e, /*0xe0-0xe7*/ - 0xd5af, 0x8c8f, 0x8c90, 0x8c91, 0x8c92, 0x8c93, 0xe5bc, 0x8c94, /*0xe8-0xef*/ - 0xe5be, 0x8c95, 0x8c96, 0x8c97, 0x8c98, 0x8c99, 0x8c9a, 0x8c9b, /*0xf0-0xf7*/ - 0xb4e7, 0xb6d4, 0xcbc2, 0xd1b0, 0xb5bc, 0x8c9c, 0x8c9d, 0xcad9, /*0xf8-0xff*/ - /* 0x5c00 */ - 0x8c9e, 0xb7e2, 0x8c9f, 0x8ca0, 0xc9e4, 0x8ca1, 0xbdab, 0x8ca2, /*0x00-0x07*/ - 0x8ca3, 0xcebe, 0xd7f0, 0x8ca4, 0x8ca5, 0x8ca6, 0x8ca7, 0xd0a1, /*0x08-0x0f*/ - 0x8ca8, 0xc9d9, 0x8ca9, 0x8caa, 0xb6fb, 0xe6d8, 0xbce2, 0x8cab, /*0x10-0x17*/ - 0xb3be, 0x8cac, 0xc9d0, 0x8cad, 0xe6d9, 0xb3a2, 0x8cae, 0x8caf, /*0x18-0x1f*/ - 0x8cb0, 0x8cb1, 0xdecc, 0x8cb2, 0xd3c8, 0xdecd, 0x8cb3, 0xd2a2, /*0x20-0x27*/ - 0x8cb4, 0x8cb5, 0x8cb6, 0x8cb7, 0xdece, 0x8cb8, 0x8cb9, 0x8cba, /*0x28-0x2f*/ - 0x8cbb, 0xbecd, 0x8cbc, 0x8cbd, 0xdecf, 0x8cbe, 0x8cbf, 0x8cc0, /*0x30-0x37*/ - 0xcaac, 0xd2fc, 0xb3df, 0xe5ea, 0xc4e1, 0xbea1, 0xceb2, 0xc4f2, /*0x38-0x3f*/ - 0xbed6, 0xc6a8, 0xb2e3, 0x8cc1, 0x8cc2, 0xbed3, 0x8cc3, 0x8cc4, /*0x40-0x47*/ - 0xc7fc, 0xcceb, 0xbdec, 0xcedd, 0x8cc5, 0x8cc6, 0xcaba, 0xc6c1, /*0x48-0x4f*/ - 0xe5ec, 0xd0bc, 0x8cc7, 0x8cc8, 0x8cc9, 0xd5b9, 0x8cca, 0x8ccb, /*0x50-0x57*/ - 0x8ccc, 0xe5ed, 0x8ccd, 0x8cce, 0x8ccf, 0x8cd0, 0xcaf4, 0x8cd1, /*0x58-0x5f*/ - 0xcdc0, 0xc2c5, 0x8cd2, 0xe5ef, 0x8cd3, 0xc2c4, 0xe5f0, 0x8cd4, /*0x60-0x67*/ - 0x8cd5, 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0xe5f8, 0xcdcd, /*0x68-0x6f*/ - 0x8cdb, 0xc9bd, 0x8cdc, 0x8cdd, 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, /*0x70-0x77*/ - 0x8ce2, 0xd2d9, 0xe1a8, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, 0xd3ec, /*0x78-0x7f*/ - 0x8ce7, 0xcbea, 0xc6f1, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, /*0x80-0x87*/ - 0xe1ac, 0x8ced, 0x8cee, 0x8cef, 0xe1a7, 0xe1a9, 0x8cf0, 0x8cf1, /*0x88-0x8f*/ - 0xe1aa, 0xe1af, 0x8cf2, 0x8cf3, 0xb2ed, 0x8cf4, 0xe1ab, 0xb8da, /*0x90-0x97*/ - 0xe1ad, 0xe1ae, 0xe1b0, 0xb5ba, 0xe1b1, 0x8cf5, 0x8cf6, 0x8cf7, /*0x98-0x9f*/ - 0x8cf8, 0x8cf9, 0xe1b3, 0xe1b8, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, /*0xa0-0xa7*/ - 0x8cfe, 0xd1d2, 0x8d40, 0xe1b6, 0xe1b5, 0xc1eb, 0x8d41, 0x8d42, /*0xa8-0xaf*/ - 0x8d43, 0xe1b7, 0x8d44, 0xd4c0, 0x8d45, 0xe1b2, 0x8d46, 0xe1ba, /*0xb0-0xb7*/ - 0xb0b6, 0x8d47, 0x8d48, 0x8d49, 0x8d4a, 0xe1b4, 0x8d4b, 0xbff9, /*0xb8-0xbf*/ - 0x8d4c, 0xe1b9, 0x8d4d, 0x8d4e, 0xe1bb, 0x8d4f, 0x8d50, 0x8d51, /*0xc0-0xc7*/ - 0x8d52, 0x8d53, 0x8d54, 0xe1be, 0x8d55, 0x8d56, 0x8d57, 0x8d58, /*0xc8-0xcf*/ - 0x8d59, 0x8d5a, 0xe1bc, 0x8d5b, 0x8d5c, 0x8d5d, 0x8d5e, 0x8d5f, /*0xd0-0xd7*/ - 0x8d60, 0xd6c5, 0x8d61, 0x8d62, 0x8d63, 0x8d64, 0x8d65, 0x8d66, /*0xd8-0xdf*/ - 0x8d67, 0xcfbf, 0x8d68, 0x8d69, 0xe1bd, 0xe1bf, 0xc2cd, 0x8d6a, /*0xe0-0xe7*/ - 0xb6eb, 0x8d6b, 0xd3f8, 0x8d6c, 0x8d6d, 0xc7cd, 0x8d6e, 0x8d6f, /*0xe8-0xef*/ - 0xb7e5, 0x8d70, 0x8d71, 0x8d72, 0x8d73, 0x8d74, 0x8d75, 0x8d76, /*0xf0-0xf7*/ - 0x8d77, 0x8d78, 0x8d79, 0xbefe, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, /*0xf8-0xff*/ - /* 0x5d00 */ - 0x8d7e, 0x8d80, 0xe1c0, 0xe1c1, 0x8d81, 0x8d82, 0xe1c7, 0xb3e7, /*0x00-0x07*/ - 0x8d83, 0x8d84, 0x8d85, 0x8d86, 0x8d87, 0x8d88, 0xc6e9, 0x8d89, /*0x08-0x0f*/ - 0x8d8a, 0x8d8b, 0x8d8c, 0x8d8d, 0xb4de, 0x8d8e, 0xd1c2, 0x8d8f, /*0x10-0x17*/ - 0x8d90, 0x8d91, 0x8d92, 0xe1c8, 0x8d93, 0x8d94, 0xe1c6, 0x8d95, /*0x18-0x1f*/ - 0x8d96, 0x8d97, 0x8d98, 0x8d99, 0xe1c5, 0x8d9a, 0xe1c3, 0xe1c2, /*0x20-0x27*/ - 0x8d9b, 0xb1c0, 0x8d9c, 0x8d9d, 0x8d9e, 0xd5b8, 0xe1c4, 0x8d9f, /*0x28-0x2f*/ - 0x8da0, 0x8da1, 0x8da2, 0x8da3, 0xe1cb, 0x8da4, 0x8da5, 0x8da6, /*0x30-0x37*/ - 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, 0xe1cc, 0xe1ca, 0x8dac, /*0x38-0x3f*/ - 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db1, 0x8db2, 0x8db3, 0xeffa, /*0x40-0x47*/ - 0x8db4, 0x8db5, 0xe1d3, 0xe1d2, 0xc7b6, 0x8db6, 0x8db7, 0x8db8, /*0x48-0x4f*/ - 0x8db9, 0x8dba, 0x8dbb, 0x8dbc, 0x8dbd, 0x8dbe, 0x8dbf, 0x8dc0, /*0x50-0x57*/ - 0xe1c9, 0x8dc1, 0x8dc2, 0xe1ce, 0x8dc3, 0xe1d0, 0x8dc4, 0x8dc5, /*0x58-0x5f*/ - 0x8dc6, 0x8dc7, 0x8dc8, 0x8dc9, 0x8dca, 0x8dcb, 0x8dcc, 0x8dcd, /*0x60-0x67*/ - 0x8dce, 0xe1d4, 0x8dcf, 0xe1d1, 0xe1cd, 0x8dd0, 0x8dd1, 0xe1cf, /*0x68-0x6f*/ - 0x8dd2, 0x8dd3, 0x8dd4, 0x8dd5, 0xe1d5, 0x8dd6, 0x8dd7, 0x8dd8, /*0x70-0x77*/ - 0x8dd9, 0x8dda, 0x8ddb, 0x8ddc, 0x8ddd, 0x8dde, 0x8ddf, 0x8de0, /*0x78-0x7f*/ - 0x8de1, 0x8de2, 0xe1d6, 0x8de3, 0x8de4, 0x8de5, 0x8de6, 0x8de7, /*0x80-0x87*/ - 0x8de8, 0x8de9, 0x8dea, 0x8deb, 0x8dec, 0x8ded, 0x8dee, 0x8def, /*0x88-0x8f*/ - 0x8df0, 0x8df1, 0x8df2, 0x8df3, 0x8df4, 0x8df5, 0x8df6, 0x8df7, /*0x90-0x97*/ - 0x8df8, 0xe1d7, 0x8df9, 0x8dfa, 0x8dfb, 0xe1d8, 0x8dfc, 0x8dfd, /*0x98-0x9f*/ - 0x8dfe, 0x8e40, 0x8e41, 0x8e42, 0x8e43, 0x8e44, 0x8e45, 0x8e46, /*0xa0-0xa7*/ - 0x8e47, 0x8e48, 0x8e49, 0x8e4a, 0x8e4b, 0x8e4c, 0x8e4d, 0x8e4e, /*0xa8-0xaf*/ - 0x8e4f, 0x8e50, 0x8e51, 0x8e52, 0x8e53, 0x8e54, 0x8e55, 0xe1da, /*0xb0-0xb7*/ - 0x8e56, 0x8e57, 0x8e58, 0x8e59, 0x8e5a, 0x8e5b, 0x8e5c, 0x8e5d, /*0xb8-0xbf*/ - 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0xe1db, 0x8e63, 0x8e64, /*0xc0-0xc7*/ - 0x8e65, 0x8e66, 0x8e67, 0x8e68, 0x8e69, 0xcea1, 0x8e6a, 0x8e6b, /*0xc8-0xcf*/ - 0x8e6c, 0x8e6d, 0x8e6e, 0x8e6f, 0x8e70, 0x8e71, 0x8e72, 0x8e73, /*0xd0-0xd7*/ - 0x8e74, 0x8e75, 0x8e76, 0xe7dd, 0x8e77, 0xb4a8, 0xd6dd, 0x8e78, /*0xd8-0xdf*/ - 0x8e79, 0xd1b2, 0xb3b2, 0x8e7a, 0x8e7b, 0xb9a4, 0xd7f3, 0xc7c9, /*0xe0-0xe7*/ - 0xbede, 0xb9ae, 0x8e7c, 0xced7, 0x8e7d, 0x8e7e, 0xb2ee, 0xdbcf, /*0xe8-0xef*/ - 0x8e80, 0xbcba, 0xd2d1, 0xcbc8, 0xb0cd, 0x8e81, 0x8e82, 0xcfef, /*0xf0-0xf7*/ - 0x8e83, 0x8e84, 0x8e85, 0x8e86, 0x8e87, 0xd9e3, 0xbded, 0x8e88, /*0xf8-0xff*/ - /* 0x5e00 */ - 0x8e89, 0xb1d2, 0xcad0, 0xb2bc, 0x8e8a, 0xcba7, 0xb7ab, 0x8e8b, /*0x00-0x07*/ - 0xcaa6, 0x8e8c, 0x8e8d, 0x8e8e, 0xcfa3, 0x8e8f, 0x8e90, 0xe0f8, /*0x08-0x0f*/ - 0xd5ca, 0xe0fb, 0x8e91, 0x8e92, 0xe0fa, 0xc5c1, 0xccfb, 0x8e93, /*0x10-0x17*/ - 0xc1b1, 0xe0f9, 0xd6e3, 0xb2af, 0xd6c4, 0xb5db, 0x8e94, 0x8e95, /*0x18-0x1f*/ - 0x8e96, 0x8e97, 0x8e98, 0x8e99, 0x8e9a, 0x8e9b, 0xb4f8, 0xd6a1, /*0x20-0x27*/ - 0x8e9c, 0x8e9d, 0x8e9e, 0x8e9f, 0x8ea0, 0xcfaf, 0xb0ef, 0x8ea1, /*0x28-0x2f*/ - 0x8ea2, 0xe0fc, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, 0x8ea7, 0xe1a1, /*0x30-0x37*/ - 0xb3a3, 0x8ea8, 0x8ea9, 0xe0fd, 0xe0fe, 0xc3b1, 0x8eaa, 0x8eab, /*0x38-0x3f*/ - 0x8eac, 0x8ead, 0xc3dd, 0x8eae, 0xe1a2, 0xb7f9, 0x8eaf, 0x8eb0, /*0x40-0x47*/ - 0x8eb1, 0x8eb2, 0x8eb3, 0x8eb4, 0xbbcf, 0x8eb5, 0x8eb6, 0x8eb7, /*0x48-0x4f*/ - 0x8eb8, 0x8eb9, 0x8eba, 0x8ebb, 0xe1a3, 0xc4bb, 0x8ebc, 0x8ebd, /*0x50-0x57*/ - 0x8ebe, 0x8ebf, 0x8ec0, 0xe1a4, 0x8ec1, 0x8ec2, 0xe1a5, 0x8ec3, /*0x58-0x5f*/ - 0x8ec4, 0xe1a6, 0xb4b1, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, /*0x60-0x67*/ - 0x8eca, 0x8ecb, 0x8ecc, 0x8ecd, 0x8ece, 0x8ecf, 0x8ed0, 0x8ed1, /*0x68-0x6f*/ - 0x8ed2, 0x8ed3, 0xb8c9, 0xc6bd, 0xc4ea, 0x8ed4, 0xb2a2, 0x8ed5, /*0x70-0x77*/ - 0xd0d2, 0x8ed6, 0xe7db, 0xbbc3, 0xd3d7, 0xd3c4, 0x8ed7, 0xb9e3, /*0x78-0x7f*/ - 0xe2cf, 0x8ed8, 0x8ed9, 0x8eda, 0xd7af, 0x8edb, 0xc7ec, 0xb1d3, /*0x80-0x87*/ - 0x8edc, 0x8edd, 0xb4b2, 0xe2d1, 0x8ede, 0x8edf, 0x8ee0, 0xd0f2, /*0x88-0x8f*/ - 0xc2ae, 0xe2d0, 0x8ee1, 0xbfe2, 0xd3a6, 0xb5d7, 0xe2d2, 0xb5ea, /*0x90-0x97*/ - 0x8ee2, 0xc3ed, 0xb8fd, 0x8ee3, 0xb8ae, 0x8ee4, 0xc5d3, 0xb7cf, /*0x98-0x9f*/ - 0xe2d4, 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0xe2d3, 0xb6c8, 0xd7f9, /*0xa0-0xa7*/ - 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, 0x8eed, 0xcda5, 0x8eee, 0x8eef, /*0xa8-0xaf*/ - 0x8ef0, 0x8ef1, 0x8ef2, 0xe2d8, 0x8ef3, 0xe2d6, 0xcafc, 0xbfb5, /*0xb0-0xb7*/ - 0xd3b9, 0xe2d5, 0x8ef4, 0x8ef5, 0x8ef6, 0x8ef7, 0xe2d7, 0x8ef8, /*0xb8-0xbf*/ - 0x8ef9, 0x8efa, 0x8efb, 0x8efc, 0x8efd, 0x8efe, 0x8f40, 0x8f41, /*0xc0-0xc7*/ - 0x8f42, 0xc1ae, 0xc0c8, 0x8f43, 0x8f44, 0x8f45, 0x8f46, 0x8f47, /*0xc8-0xcf*/ - 0x8f48, 0xe2db, 0xe2da, 0xc0aa, 0x8f49, 0x8f4a, 0xc1ce, 0x8f4b, /*0xd0-0xd7*/ - 0x8f4c, 0x8f4d, 0x8f4e, 0xe2dc, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, /*0xd8-0xdf*/ - 0x8f53, 0x8f54, 0x8f55, 0x8f56, 0x8f57, 0x8f58, 0x8f59, 0x8f5a, /*0xe0-0xe7*/ - 0xe2dd, 0x8f5b, 0xe2de, 0x8f5c, 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, /*0xe8-0xef*/ - 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0xdbc8, 0x8f65, 0xd1d3, 0xcda2, /*0xf0-0xf7*/ - 0x8f66, 0x8f67, 0xbda8, 0x8f68, 0x8f69, 0x8f6a, 0xdec3, 0xd8a5, /*0xf8-0xff*/ - /* 0x5f00 */ - 0xbfaa, 0xdbcd, 0xd2ec, 0xc6fa, 0xc5aa, 0x8f6b, 0x8f6c, 0x8f6d, /*0x00-0x07*/ - 0xdec4, 0x8f6e, 0xb1d7, 0xdfae, 0x8f6f, 0x8f70, 0x8f71, 0xcabd, /*0x08-0x0f*/ - 0x8f72, 0xdfb1, 0x8f73, 0xb9ad, 0x8f74, 0xd2fd, 0x8f75, 0xb8a5, /*0x10-0x17*/ - 0xbaeb, 0x8f76, 0x8f77, 0xb3da, 0x8f78, 0x8f79, 0x8f7a, 0xb5dc, /*0x18-0x1f*/ - 0xd5c5, 0x8f7b, 0x8f7c, 0x8f7d, 0x8f7e, 0xc3d6, 0xcfd2, 0xbba1, /*0x20-0x27*/ - 0x8f80, 0xe5f3, 0xe5f2, 0x8f81, 0x8f82, 0xe5f4, 0x8f83, 0xcde4, /*0x28-0x2f*/ - 0x8f84, 0xc8f5, 0x8f85, 0x8f86, 0x8f87, 0x8f88, 0x8f89, 0x8f8a, /*0x30-0x37*/ - 0x8f8b, 0xb5af, 0xc7bf, 0x8f8c, 0xe5f6, 0x8f8d, 0x8f8e, 0x8f8f, /*0x38-0x3f*/ - 0xecb0, 0x8f90, 0x8f91, 0x8f92, 0x8f93, 0x8f94, 0x8f95, 0x8f96, /*0x40-0x47*/ - 0x8f97, 0x8f98, 0x8f99, 0x8f9a, 0x8f9b, 0x8f9c, 0x8f9d, 0x8f9e, /*0x48-0x4f*/ - 0xe5e6, 0x8f9f, 0xb9e9, 0xb5b1, 0x8fa0, 0xc2bc, 0xe5e8, 0xe5e7, /*0x50-0x57*/ - 0xe5e9, 0x8fa1, 0x8fa2, 0x8fa3, 0x8fa4, 0xd2cd, 0x8fa5, 0x8fa6, /*0x58-0x5f*/ - 0x8fa7, 0xe1ea, 0xd0ce, 0x8fa8, 0xcdae, 0x8fa9, 0xd1e5, 0x8faa, /*0x60-0x67*/ - 0x8fab, 0xb2ca, 0xb1eb, 0x8fac, 0xb1f2, 0xc5ed, 0x8fad, 0x8fae, /*0x68-0x6f*/ - 0xd5c3, 0xd3b0, 0x8faf, 0xe1dc, 0x8fb0, 0x8fb1, 0x8fb2, 0xe1dd, /*0x70-0x77*/ - 0x8fb3, 0xd2db, 0x8fb4, 0xb3b9, 0xb1cb, 0x8fb5, 0x8fb6, 0x8fb7, /*0x78-0x7f*/ - 0xcdf9, 0xd5f7, 0xe1de, 0x8fb8, 0xbeb6, 0xb4fd, 0x8fb9, 0xe1df, /*0x80-0x87*/ - 0xbadc, 0xe1e0, 0xbbb2, 0xc2c9, 0xe1e1, 0x8fba, 0x8fbb, 0x8fbc, /*0x88-0x8f*/ - 0xd0ec, 0x8fbd, 0xcdbd, 0x8fbe, 0x8fbf, 0xe1e2, 0x8fc0, 0xb5c3, /*0x90-0x97*/ - 0xc5c7, 0xe1e3, 0x8fc1, 0x8fc2, 0xe1e4, 0x8fc3, 0x8fc4, 0x8fc5, /*0x98-0x9f*/ - 0x8fc6, 0xd3f9, 0x8fc7, 0x8fc8, 0x8fc9, 0x8fca, 0x8fcb, 0x8fcc, /*0xa0-0xa7*/ - 0xe1e5, 0x8fcd, 0xd1ad, 0x8fce, 0x8fcf, 0xe1e6, 0xcea2, 0x8fd0, /*0xa8-0xaf*/ - 0x8fd1, 0x8fd2, 0x8fd3, 0x8fd4, 0x8fd5, 0xe1e7, 0x8fd6, 0xb5c2, /*0xb0-0xb7*/ - 0x8fd7, 0x8fd8, 0x8fd9, 0x8fda, 0xe1e8, 0xbbd5, 0x8fdb, 0x8fdc, /*0xb8-0xbf*/ - 0x8fdd, 0x8fde, 0x8fdf, 0xd0c4, 0xe2e0, 0xb1d8, 0xd2e4, 0x8fe0, /*0xc0-0xc7*/ - 0x8fe1, 0xe2e1, 0x8fe2, 0x8fe3, 0xbcc9, 0xc8cc, 0x8fe4, 0xe2e3, /*0xc8-0xcf*/ - 0xecfe, 0xecfd, 0xdfaf, 0x8fe5, 0x8fe6, 0x8fe7, 0xe2e2, 0xd6be, /*0xd0-0xd7*/ - 0xcdfc, 0xc3a6, 0x8fe8, 0x8fe9, 0x8fea, 0xe3c3, 0x8feb, 0x8fec, /*0xd8-0xdf*/ - 0xd6d2, 0xe2e7, 0x8fed, 0x8fee, 0xe2e8, 0x8fef, 0x8ff0, 0xd3c7, /*0xe0-0xe7*/ - 0x8ff1, 0x8ff2, 0xe2ec, 0xbfec, 0x8ff3, 0xe2ed, 0xe2e5, 0x8ff4, /*0xe8-0xef*/ - 0x8ff5, 0xb3c0, 0x8ff6, 0x8ff7, 0x8ff8, 0xc4ee, 0x8ff9, 0x8ffa, /*0xf0-0xf7*/ - 0xe2ee, 0x8ffb, 0x8ffc, 0xd0c3, 0x8ffd, 0xbaf6, 0xe2e9, 0xb7de, /*0xf8-0xff*/ - /* 0x6000 */ - 0xbbb3, 0xccac, 0xcbcb, 0xe2e4, 0xe2e6, 0xe2ea, 0xe2eb, 0x8ffe, /*0x00-0x07*/ - 0x9040, 0x9041, 0xe2f7, 0x9042, 0x9043, 0xe2f4, 0xd4f5, 0xe2f3, /*0x08-0x0f*/ - 0x9044, 0x9045, 0xc5ad, 0x9046, 0xd5fa, 0xc5c2, 0xb2c0, 0x9047, /*0x10-0x17*/ - 0x9048, 0xe2ef, 0x9049, 0xe2f2, 0xc1af, 0xcbbc, 0x904a, 0x904b, /*0x18-0x1f*/ - 0xb5a1, 0xe2f9, 0x904c, 0x904d, 0x904e, 0xbcb1, 0xe2f1, 0xd0d4, /*0x20-0x27*/ - 0xd4b9, 0xe2f5, 0xb9d6, 0xe2f6, 0x904f, 0x9050, 0x9051, 0xc7d3, /*0x28-0x2f*/ - 0x9052, 0x9053, 0x9054, 0x9055, 0x9056, 0xe2f0, 0x9057, 0x9058, /*0x30-0x37*/ - 0x9059, 0x905a, 0x905b, 0xd7dc, 0xeda1, 0x905c, 0x905d, 0xe2f8, /*0x38-0x3f*/ - 0x905e, 0xeda5, 0xe2fe, 0xcad1, 0x905f, 0x9060, 0x9061, 0x9062, /*0x40-0x47*/ - 0x9063, 0x9064, 0x9065, 0xc1b5, 0x9066, 0xbbd0, 0x9067, 0x9068, /*0x48-0x4f*/ - 0xbfd6, 0x9069, 0xbae3, 0x906a, 0x906b, 0xcba1, 0x906c, 0x906d, /*0x50-0x57*/ - 0x906e, 0xeda6, 0xeda3, 0x906f, 0x9070, 0xeda2, 0x9071, 0x9072, /*0x58-0x5f*/ - 0x9073, 0x9074, 0xbbd6, 0xeda7, 0xd0f4, 0x9075, 0x9076, 0xeda4, /*0x60-0x67*/ - 0xbade, 0xb6f7, 0xe3a1, 0xb6b2, 0xccf1, 0xb9a7, 0x9077, 0xcfa2, /*0x68-0x6f*/ - 0xc7a1, 0x9078, 0x9079, 0xbfd2, 0x907a, 0x907b, 0xb6f1, 0x907c, /*0x70-0x77*/ - 0xe2fa, 0xe2fb, 0xe2fd, 0xe2fc, 0xc4d5, 0xe3a2, 0x907d, 0xd3c1, /*0x78-0x7f*/ - 0x907e, 0x9080, 0x9081, 0xe3a7, 0xc7c4, 0x9082, 0x9083, 0x9084, /*0x80-0x87*/ - 0x9085, 0xcfa4, 0x9086, 0x9087, 0xe3a9, 0xbab7, 0x9088, 0x9089, /*0x88-0x8f*/ - 0x908a, 0x908b, 0xe3a8, 0x908c, 0xbbda, 0x908d, 0xe3a3, 0x908e, /*0x90-0x97*/ - 0x908f, 0x9090, 0xe3a4, 0xe3aa, 0x9091, 0xe3a6, 0x9092, 0xcef2, /*0x98-0x9f*/ - 0xd3c6, 0x9093, 0x9094, 0xbbbc, 0x9095, 0x9096, 0xd4c3, 0x9097, /*0xa0-0xa7*/ - 0xc4fa, 0x9098, 0x9099, 0xeda8, 0xd0fc, 0xe3a5, 0x909a, 0xc3f5, /*0xa8-0xaf*/ - 0x909b, 0xe3ad, 0xb1af, 0x909c, 0xe3b2, 0x909d, 0x909e, 0x909f, /*0xb0-0xb7*/ - 0xbcc2, 0x90a0, 0x90a1, 0xe3ac, 0xb5bf, 0x90a2, 0x90a3, 0x90a4, /*0xb8-0xbf*/ - 0x90a5, 0x90a6, 0x90a7, 0x90a8, 0x90a9, 0xc7e9, 0xe3b0, 0x90aa, /*0xc0-0xc7*/ - 0x90ab, 0x90ac, 0xbeaa, 0xcdef, 0x90ad, 0x90ae, 0x90af, 0x90b0, /*0xc8-0xcf*/ - 0x90b1, 0xbbf3, 0x90b2, 0x90b3, 0x90b4, 0xcce8, 0x90b5, 0x90b6, /*0xd0-0xd7*/ - 0xe3af, 0x90b7, 0xe3b1, 0x90b8, 0xcfa7, 0xe3ae, 0x90b9, 0xcea9, /*0xd8-0xdf*/ - 0xbbdd, 0x90ba, 0x90bb, 0x90bc, 0x90bd, 0x90be, 0xb5eb, 0xbee5, /*0xe0-0xe7*/ - 0xb2d2, 0xb3cd, 0x90bf, 0xb1b9, 0xe3ab, 0xb2d1, 0xb5ac, 0xb9df, /*0xe8-0xef*/ - 0xb6e8, 0x90c0, 0x90c1, 0xcfeb, 0xe3b7, 0x90c2, 0xbbcc, 0x90c3, /*0xf0-0xf7*/ - 0x90c4, 0xc8c7, 0xd0ca, 0x90c5, 0x90c6, 0x90c7, 0x90c8, 0x90c9, /*0xf8-0xff*/ - /* 0x6100 */ - 0xe3b8, 0xb3ee, 0x90ca, 0x90cb, 0x90cc, 0x90cd, 0xeda9, 0x90ce, /*0x00-0x07*/ - 0xd3fa, 0xd3e4, 0x90cf, 0x90d0, 0x90d1, 0xedaa, 0xe3b9, 0xd2e2, /*0x08-0x0f*/ - 0x90d2, 0x90d3, 0x90d4, 0x90d5, 0x90d6, 0xe3b5, 0x90d7, 0x90d8, /*0x10-0x17*/ - 0x90d9, 0x90da, 0xd3de, 0x90db, 0x90dc, 0x90dd, 0x90de, 0xb8d0, /*0x18-0x1f*/ - 0xe3b3, 0x90df, 0x90e0, 0xe3b6, 0xb7df, 0x90e1, 0xe3b4, 0xc0a2, /*0x20-0x27*/ - 0x90e2, 0x90e3, 0x90e4, 0xe3ba, 0x90e5, 0x90e6, 0x90e7, 0x90e8, /*0x28-0x2f*/ - 0x90e9, 0x90ea, 0x90eb, 0x90ec, 0x90ed, 0x90ee, 0x90ef, 0x90f0, /*0x30-0x37*/ - 0x90f1, 0x90f2, 0x90f3, 0x90f4, 0x90f5, 0x90f6, 0x90f7, 0xd4b8, /*0x38-0x3f*/ - 0x90f8, 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90fd, 0x90fe, 0x9140, /*0x40-0x47*/ - 0xb4c8, 0x9141, 0xe3bb, 0x9142, 0xbbc5, 0x9143, 0xc9f7, 0x9144, /*0x48-0x4f*/ - 0x9145, 0xc9e5, 0x9146, 0x9147, 0x9148, 0xc4bd, 0x9149, 0x914a, /*0x50-0x57*/ - 0x914b, 0x914c, 0x914d, 0x914e, 0x914f, 0xedab, 0x9150, 0x9151, /*0x58-0x5f*/ - 0x9152, 0x9153, 0xc2fd, 0x9154, 0x9155, 0x9156, 0x9157, 0xbbdb, /*0x60-0x67*/ - 0xbfae, 0x9158, 0x9159, 0x915a, 0x915b, 0x915c, 0x915d, 0x915e, /*0x68-0x6f*/ - 0xcebf, 0x915f, 0x9160, 0x9161, 0x9162, 0xe3bc, 0x9163, 0xbfb6, /*0x70-0x77*/ - 0x9164, 0x9165, 0x9166, 0x9167, 0x9168, 0x9169, 0x916a, 0x916b, /*0x78-0x7f*/ - 0x916c, 0x916d, 0x916e, 0x916f, 0x9170, 0x9171, 0x9172, 0x9173, /*0x80-0x87*/ - 0x9174, 0x9175, 0x9176, 0xb1ef, 0x9177, 0x9178, 0xd4f7, 0x9179, /*0x88-0x8f*/ - 0x917a, 0x917b, 0x917c, 0x917d, 0xe3be, 0x917e, 0x9180, 0x9181, /*0x90-0x97*/ - 0x9182, 0x9183, 0x9184, 0x9185, 0x9186, 0xedad, 0x9187, 0x9188, /*0x98-0x9f*/ - 0x9189, 0x918a, 0x918b, 0x918c, 0x918d, 0x918e, 0x918f, 0xe3bf, /*0xa0-0xa7*/ - 0xbaa9, 0xedac, 0x9190, 0x9191, 0xe3bd, 0x9192, 0x9193, 0x9194, /*0xa8-0xaf*/ - 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, 0x919a, 0x919b, 0xe3c0, /*0xb0-0xb7*/ - 0x919c, 0x919d, 0x919e, 0x919f, 0x91a0, 0x91a1, 0xbab6, 0x91a2, /*0xb8-0xbf*/ - 0x91a3, 0x91a4, 0xb6ae, 0x91a5, 0x91a6, 0x91a7, 0x91a8, 0x91a9, /*0xc0-0xc7*/ - 0xd0b8, 0x91aa, 0xb0c3, 0xedae, 0x91ab, 0x91ac, 0x91ad, 0x91ae, /*0xc8-0xcf*/ - 0x91af, 0xedaf, 0xc0c1, 0x91b0, 0xe3c1, 0x91b1, 0x91b2, 0x91b3, /*0xd0-0xd7*/ - 0x91b4, 0x91b5, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91ba, 0x91bb, /*0xd8-0xdf*/ - 0x91bc, 0x91bd, 0x91be, 0x91bf, 0x91c0, 0x91c1, 0xc5b3, 0x91c2, /*0xe0-0xe7*/ - 0x91c3, 0x91c4, 0x91c5, 0x91c6, 0x91c7, 0x91c8, 0x91c9, 0x91ca, /*0xe8-0xef*/ - 0x91cb, 0x91cc, 0x91cd, 0x91ce, 0x91cf, 0xe3c2, 0x91d0, 0x91d1, /*0xf0-0xf7*/ - 0x91d2, 0x91d3, 0x91d4, 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0xdcb2, /*0xf8-0xff*/ - /* 0x6200 */ - 0x91d9, 0x91da, 0x91db, 0x91dc, 0x91dd, 0x91de, 0xedb0, 0x91df, /*0x00-0x07*/ - 0xb8ea, 0x91e0, 0xceec, 0xeaa7, 0xd0e7, 0xcaf9, 0xc8d6, 0xcfb7, /*0x08-0x0f*/ - 0xb3c9, 0xced2, 0xbde4, 0x91e1, 0x91e2, 0xe3de, 0xbbf2, 0xeaa8, /*0x10-0x17*/ - 0xd5bd, 0x91e3, 0xc6dd, 0xeaa9, 0x91e4, 0x91e5, 0x91e6, 0xeaaa, /*0x18-0x1f*/ - 0x91e7, 0xeaac, 0xeaab, 0x91e8, 0xeaae, 0xeaad, 0x91e9, 0x91ea, /*0x20-0x27*/ - 0x91eb, 0x91ec, 0xbdd8, 0x91ed, 0xeaaf, 0x91ee, 0xc2be, 0x91ef, /*0x28-0x2f*/ - 0x91f0, 0x91f1, 0x91f2, 0xb4c1, 0xb4f7, 0x91f3, 0x91f4, 0xbba7, /*0x30-0x37*/ - 0x91f5, 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0xece6, 0xece5, 0xb7bf, /*0x38-0x3f*/ - 0xcbf9, 0xb1e2, 0x91fa, 0xece7, 0x91fb, 0x91fc, 0x91fd, 0xc9c8, /*0x40-0x47*/ - 0xece8, 0xece9, 0x91fe, 0xcad6, 0xded0, 0xb2c5, 0xd4fa, 0x9240, /*0x48-0x4f*/ - 0x9241, 0xc6cb, 0xb0c7, 0xb4f2, 0xc8d3, 0x9242, 0x9243, 0x9244, /*0x50-0x57*/ - 0xcdd0, 0x9245, 0x9246, 0xbfb8, 0x9247, 0x9248, 0x9249, 0x924a, /*0x58-0x5f*/ - 0x924b, 0x924c, 0x924d, 0xbfdb, 0x924e, 0x924f, 0xc7a4, 0xd6b4, /*0x60-0x67*/ - 0x9250, 0xc0a9, 0xded1, 0xc9a8, 0xd1ef, 0xc5a4, 0xb0e7, 0xb3b6, /*0x68-0x6f*/ - 0xc8c5, 0x9251, 0x9252, 0xb0e2, 0x9253, 0x9254, 0xb7f6, 0x9255, /*0x70-0x77*/ - 0x9256, 0xc5fa, 0x9257, 0x9258, 0xb6f3, 0x9259, 0xd5d2, 0xb3d0, /*0x78-0x7f*/ - 0xbcbc, 0x925a, 0x925b, 0x925c, 0xb3ad, 0x925d, 0x925e, 0x925f, /*0x80-0x87*/ - 0x9260, 0xbef1, 0xb0d1, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, /*0x88-0x8f*/ - 0x9266, 0xd2d6, 0xcae3, 0xd7a5, 0x9267, 0xcdb6, 0xb6b6, 0xbfb9, /*0x90-0x97*/ - 0xd5db, 0x9268, 0xb8a7, 0xc5d7, 0x9269, 0x926a, 0x926b, 0xded2, /*0x98-0x9f*/ - 0xbfd9, 0xc2d5, 0xc7c0, 0x926c, 0xbba4, 0xb1a8, 0x926d, 0x926e, /*0xa0-0xa7*/ - 0xc5ea, 0x926f, 0x9270, 0xc5fb, 0xcca7, 0x9271, 0x9272, 0x9273, /*0xa8-0xaf*/ - 0x9274, 0xb1a7, 0x9275, 0x9276, 0x9277, 0xb5d6, 0x9278, 0x9279, /*0xb0-0xb7*/ - 0x927a, 0xc4a8, 0x927b, 0xded3, 0xd1ba, 0xb3e9, 0x927c, 0xc3f2, /*0xb8-0xbf*/ - 0x927d, 0x927e, 0xb7f7, 0x9280, 0xd6f4, 0xb5a3, 0xb2f0, 0xc4b4, /*0xc0-0xc7*/ - 0xc4e9, 0xc0ad, 0xded4, 0x9281, 0xb0e8, 0xc5c4, 0xc1e0, 0x9282, /*0xc8-0xcf*/ - 0xb9d5, 0x9283, 0xbedc, 0xcdd8, 0xb0ce, 0x9284, 0xcdcf, 0xded6, /*0xd0-0xd7*/ - 0xbed0, 0xd7be, 0xded5, 0xd5d0, 0xb0dd, 0x9285, 0x9286, 0xc4e2, /*0xd8-0xdf*/ - 0x9287, 0x9288, 0xc2a3, 0xbcf0, 0x9289, 0xd3b5, 0xc0b9, 0xc5a1, /*0xe0-0xe7*/ - 0xb2a6, 0xd4f1, 0x928a, 0x928b, 0xc0a8, 0xcac3, 0xded7, 0xd5fc, /*0xe8-0xef*/ - 0x928c, 0xb9b0, 0x928d, 0xc8ad, 0xcba9, 0x928e, 0xded9, 0xbfbd, /*0xf0-0xf7*/ - 0x928f, 0x9290, 0x9291, 0x9292, 0xc6b4, 0xd7a7, 0xcab0, 0xc4c3, /*0xf8-0xff*/ - /* 0x6300 */ - 0x9293, 0xb3d6, 0xb9d2, 0x9294, 0x9295, 0x9296, 0x9297, 0xd6b8, /*0x00-0x07*/ - 0xeafc, 0xb0b4, 0x9298, 0x9299, 0x929a, 0x929b, 0xbfe6, 0x929c, /*0x08-0x0f*/ - 0x929d, 0xccf4, 0x929e, 0x929f, 0x92a0, 0x92a1, 0xcdda, 0x92a2, /*0x10-0x17*/ - 0x92a3, 0x92a4, 0xd6bf, 0xc2ce, 0x92a5, 0xcece, 0xcca2, 0xd0ae, /*0x18-0x1f*/ - 0xc4d3, 0xb5b2, 0xded8, 0xd5f5, 0xbcb7, 0xbbd3, 0x92a6, 0x92a7, /*0x20-0x27*/ - 0xb0a4, 0x92a8, 0xc5b2, 0xb4ec, 0x92a9, 0x92aa, 0x92ab, 0xd5f1, /*0x28-0x2f*/ - 0x92ac, 0x92ad, 0xeafd, 0x92ae, 0x92af, 0x92b0, 0x92b1, 0x92b2, /*0x30-0x37*/ - 0x92b3, 0xdeda, 0xcda6, 0x92b4, 0x92b5, 0xcdec, 0x92b6, 0x92b7, /*0x38-0x3f*/ - 0x92b8, 0x92b9, 0xcee6, 0xdedc, 0x92ba, 0xcdb1, 0xc0a6, 0x92bb, /*0x40-0x47*/ - 0x92bc, 0xd7bd, 0x92bd, 0xdedb, 0xb0c6, 0xbab4, 0xc9d3, 0xc4f3, /*0x48-0x4f*/ - 0xbee8, 0x92be, 0x92bf, 0x92c0, 0x92c1, 0xb2b6, 0x92c2, 0x92c3, /*0x50-0x57*/ - 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0x92c8, 0x92c9, 0xc0cc, 0xcbf0, /*0x58-0x5f*/ - 0x92ca, 0xbcf1, 0xbbbb, 0xb5b7, 0x92cb, 0x92cc, 0x92cd, 0xc5f5, /*0x60-0x67*/ - 0x92ce, 0xdee6, 0x92cf, 0x92d0, 0x92d1, 0xdee3, 0xbedd, 0x92d2, /*0x68-0x6f*/ - 0x92d3, 0xdedf, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0xb4b7, 0xbddd, /*0x70-0x77*/ - 0x92d8, 0x92d9, 0xdee0, 0xc4ed, 0x92da, 0x92db, 0x92dc, 0x92dd, /*0x78-0x7f*/ - 0xcfc6, 0x92de, 0xb5e0, 0x92df, 0x92e0, 0x92e1, 0x92e2, 0xb6de, /*0x80-0x87*/ - 0xcada, 0xb5f4, 0xdee5, 0x92e3, 0xd5c6, 0x92e4, 0xdee1, 0xcccd, /*0x88-0x8f*/ - 0xc6fe, 0x92e5, 0xc5c5, 0x92e6, 0x92e7, 0x92e8, 0xd2b4, 0x92e9, /*0x90-0x97*/ - 0xbef2, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, /*0x98-0x9f*/ - 0xc2d3, 0x92f1, 0xccbd, 0xb3b8, 0x92f2, 0xbdd3, 0x92f3, 0xbfd8, /*0xa0-0xa7*/ - 0xcdc6, 0xd1da, 0xb4eb, 0x92f4, 0xdee4, 0xdedd, 0xdee7, 0x92f5, /*0xa8-0xaf*/ - 0xeafe, 0x92f6, 0x92f7, 0xc2b0, 0xdee2, 0x92f8, 0x92f9, 0xd6c0, /*0xb0-0xb7*/ - 0xb5a7, 0x92fa, 0xb2f4, 0x92fb, 0xdee8, 0x92fc, 0xdef2, 0x92fd, /*0xb8-0xbf*/ - 0x92fe, 0x9340, 0x9341, 0x9342, 0xdeed, 0x9343, 0xdef1, 0x9344, /*0xc0-0xc7*/ - 0x9345, 0xc8e0, 0x9346, 0x9347, 0x9348, 0xd7e1, 0xdeef, 0xc3e8, /*0xc8-0xcf*/ - 0xcce1, 0x9349, 0xb2e5, 0x934a, 0x934b, 0x934c, 0xd2be, 0x934d, /*0xd0-0xd7*/ - 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, 0x9353, 0xdeee, 0x9354, /*0xd8-0xdf*/ - 0xdeeb, 0xced5, 0x9355, 0xb4a7, 0x9356, 0x9357, 0x9358, 0x9359, /*0xe0-0xe7*/ - 0x935a, 0xbfab, 0xbebe, 0x935b, 0x935c, 0xbdd2, 0x935d, 0x935e, /*0xe8-0xef*/ - 0x935f, 0x9360, 0xdee9, 0x9361, 0xd4ae, 0x9362, 0xdede, 0x9363, /*0xf0-0xf7*/ - 0xdeea, 0x9364, 0x9365, 0x9366, 0x9367, 0xc0bf, 0x9368, 0xdeec, /*0xf8-0xff*/ - /* 0x6400 */ - 0xb2f3, 0xb8e9, 0xc2a7, 0x9369, 0x936a, 0xbdc1, 0x936b, 0x936c, /*0x00-0x07*/ - 0x936d, 0x936e, 0x936f, 0xdef5, 0xdef8, 0x9370, 0x9371, 0xb2ab, /*0x08-0x0f*/ - 0xb4a4, 0x9372, 0x9373, 0xb4ea, 0xc9a6, 0x9374, 0x9375, 0x9376, /*0x10-0x17*/ - 0x9377, 0x9378, 0x9379, 0xdef6, 0xcbd1, 0x937a, 0xb8e3, 0x937b, /*0x18-0x1f*/ - 0xdef7, 0xdefa, 0x937c, 0x937d, 0x937e, 0x9380, 0xdef9, 0x9381, /*0x20-0x27*/ - 0x9382, 0x9383, 0xccc2, 0x9384, 0xb0e1, 0xb4ee, 0x9385, 0x9386, /*0x28-0x2f*/ - 0x9387, 0x9388, 0x9389, 0x938a, 0xe5ba, 0x938b, 0x938c, 0x938d, /*0x30-0x37*/ - 0x938e, 0x938f, 0xd0af, 0x9390, 0x9391, 0xb2eb, 0x9392, 0xeba1, /*0x38-0x3f*/ - 0x9393, 0xdef4, 0x9394, 0x9395, 0xc9e3, 0xdef3, 0xb0da, 0xd2a1, /*0x40-0x47*/ - 0xb1f7, 0x9396, 0xccaf, 0x9397, 0x9398, 0x9399, 0x939a, 0x939b, /*0x48-0x4f*/ - 0x939c, 0x939d, 0xdef0, 0x939e, 0xcba4, 0x939f, 0x93a0, 0x93a1, /*0x50-0x57*/ - 0xd5aa, 0x93a2, 0x93a3, 0x93a4, 0x93a5, 0x93a6, 0xdefb, 0x93a7, /*0x58-0x5f*/ - 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, 0x93ad, 0x93ae, 0xb4dd, /*0x60-0x67*/ - 0x93af, 0xc4a6, 0x93b0, 0x93b1, 0x93b2, 0xdefd, 0x93b3, 0x93b4, /*0x68-0x6f*/ - 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, /*0x70-0x77*/ - 0xc3fe, 0xc4a1, 0xdfa1, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, /*0x78-0x7f*/ - 0x93c2, 0x93c3, 0xc1cc, 0x93c4, 0xdefc, 0xbeef, 0x93c5, 0xc6b2, /*0x80-0x87*/ - 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, /*0x88-0x8f*/ - 0x93ce, 0xb3c5, 0xc8f6, 0x93cf, 0x93d0, 0xcbba, 0xdefe, 0x93d1, /*0x90-0x97*/ - 0x93d2, 0xdfa4, 0x93d3, 0x93d4, 0x93d5, 0x93d6, 0xd7b2, 0x93d7, /*0x98-0x9f*/ - 0x93d8, 0x93d9, 0x93da, 0x93db, 0xb3b7, 0x93dc, 0x93dd, 0x93de, /*0xa0-0xa7*/ - 0x93df, 0xc1c3, 0x93e0, 0x93e1, 0xc7cb, 0xb2a5, 0xb4e9, 0x93e2, /*0xa8-0xaf*/ - 0xd7ab, 0x93e3, 0x93e4, 0x93e5, 0x93e6, 0xc4ec, 0x93e7, 0xdfa2, /*0xb0-0xb7*/ - 0xdfa3, 0x93e8, 0xdfa5, 0x93e9, 0xbab3, 0x93ea, 0x93eb, 0x93ec, /*0xb8-0xbf*/ - 0xdfa6, 0x93ed, 0xc0de, 0x93ee, 0x93ef, 0xc9c3, 0x93f0, 0x93f1, /*0xc0-0xc7*/ - 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, 0xb2d9, 0xc7e6, 0x93f7, /*0xc8-0xcf*/ - 0xdfa7, 0x93f8, 0xc7dc, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0xdfa8, /*0xd0-0xd7*/ - 0xeba2, 0x93fd, 0x93fe, 0x9440, 0x9441, 0x9442, 0xcbd3, 0x9443, /*0xd8-0xdf*/ - 0x9444, 0x9445, 0xdfaa, 0x9446, 0xdfa9, 0x9447, 0xb2c1, 0x9448, /*0xe0-0xe7*/ - 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, 0x9450, /*0xe8-0xef*/ - 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, 0x9458, /*0xf0-0xf7*/ - 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, 0x9460, /*0xf8-0xff*/ - /* 0x6500 */ - 0xc5ca, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, /*0x00-0x07*/ - 0x9468, 0xdfab, 0x9469, 0x946a, 0x946b, 0x946c, 0x946d, 0x946e, /*0x08-0x0f*/ - 0x946f, 0x9470, 0xd4dc, 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, /*0x10-0x17*/ - 0xc8c1, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, /*0x18-0x1f*/ - 0x947d, 0x947e, 0x9480, 0x9481, 0x9482, 0xdfac, 0x9483, 0x9484, /*0x20-0x27*/ - 0x9485, 0x9486, 0x9487, 0xbef0, 0x9488, 0x9489, 0xdfad, 0xd6a7, /*0x28-0x2f*/ - 0x948a, 0x948b, 0x948c, 0x948d, 0xeab7, 0xebb6, 0xcad5, 0x948e, /*0x30-0x37*/ - 0xd8fc, 0xb8c4, 0x948f, 0xb9a5, 0x9490, 0x9491, 0xb7c5, 0xd5fe, /*0x38-0x3f*/ - 0x9492, 0x9493, 0x9494, 0x9495, 0x9496, 0xb9ca, 0x9497, 0x9498, /*0x40-0x47*/ - 0xd0a7, 0xf4cd, 0x9499, 0x949a, 0xb5d0, 0x949b, 0x949c, 0xc3f4, /*0x48-0x4f*/ - 0x949d, 0xbec8, 0x949e, 0x949f, 0x94a0, 0xebb7, 0xb0bd, 0x94a1, /*0x50-0x57*/ - 0x94a2, 0xbdcc, 0x94a3, 0xc1b2, 0x94a4, 0xb1d6, 0xb3a8, 0x94a5, /*0x58-0x5f*/ - 0x94a6, 0x94a7, 0xb8d2, 0xc9a2, 0x94a8, 0x94a9, 0xb6d8, 0x94aa, /*0x60-0x67*/ - 0x94ab, 0x94ac, 0x94ad, 0xebb8, 0xbeb4, 0x94ae, 0x94af, 0x94b0, /*0x68-0x6f*/ - 0xcafd, 0x94b1, 0xc7c3, 0x94b2, 0xd5fb, 0x94b3, 0x94b4, 0xb7f3, /*0x70-0x77*/ - 0x94b5, 0x94b6, 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bb, 0x94bc, /*0x78-0x7f*/ - 0x94bd, 0x94be, 0x94bf, 0x94c0, 0x94c1, 0x94c2, 0x94c3, 0xcec4, /*0x80-0x87*/ - 0x94c4, 0x94c5, 0x94c6, 0xd5ab, 0xb1f3, 0x94c7, 0x94c8, 0x94c9, /*0x88-0x8f*/ - 0xecb3, 0xb0df, 0x94ca, 0xecb5, 0x94cb, 0x94cc, 0x94cd, 0xb6b7, /*0x90-0x97*/ - 0x94ce, 0xc1cf, 0x94cf, 0xf5fa, 0xd0b1, 0x94d0, 0x94d1, 0xd5e5, /*0x98-0x9f*/ - 0x94d2, 0xced3, 0x94d3, 0x94d4, 0xbdef, 0xb3e2, 0x94d5, 0xb8ab, /*0xa0-0xa7*/ - 0x94d6, 0xd5b6, 0x94d7, 0xedbd, 0x94d8, 0xb6cf, 0x94d9, 0xcbb9, /*0xa8-0xaf*/ - 0xd0c2, 0x94da, 0x94db, 0x94dc, 0x94dd, 0x94de, 0x94df, 0x94e0, /*0xb0-0xb7*/ - 0x94e1, 0xb7bd, 0x94e2, 0x94e3, 0xecb6, 0xcaa9, 0x94e4, 0x94e5, /*0xb8-0xbf*/ - 0x94e6, 0xc5d4, 0x94e7, 0xecb9, 0xecb8, 0xc2c3, 0xecb7, 0x94e8, /*0xc0-0xc7*/ - 0x94e9, 0x94ea, 0x94eb, 0xd0fd, 0xecba, 0x94ec, 0xecbb, 0xd7e5, /*0xc8-0xcf*/ - 0x94ed, 0x94ee, 0xecbc, 0x94ef, 0x94f0, 0x94f1, 0xecbd, 0xc6ec, /*0xd0-0xd7*/ - 0x94f2, 0x94f3, 0x94f4, 0x94f5, 0x94f6, 0x94f7, 0x94f8, 0x94f9, /*0xd8-0xdf*/ - 0xcede, 0x94fa, 0xbcc8, 0x94fb, 0x94fc, 0xc8d5, 0xb5a9, 0xbec9, /*0xe0-0xe7*/ - 0xd6bc, 0xd4e7, 0x94fd, 0x94fe, 0xd1ae, 0xd0f1, 0xeab8, 0xeab9, /*0xe8-0xef*/ - 0xeaba, 0xbab5, 0x9540, 0x9541, 0x9542, 0x9543, 0xcab1, 0xbff5, /*0xf0-0xf7*/ - 0x9544, 0x9545, 0xcdfa, 0x9546, 0x9547, 0x9548, 0x9549, 0x954a, /*0xf8-0xff*/ - /* 0x6600 */ - 0xeac0, 0x954b, 0xb0ba, 0xeabe, 0x954c, 0x954d, 0xc0a5, 0x954e, /*0x00-0x07*/ - 0x954f, 0x9550, 0xeabb, 0x9551, 0xb2fd, 0x9552, 0xc3f7, 0xbbe8, /*0x08-0x0f*/ - 0x9553, 0x9554, 0x9555, 0xd2d7, 0xcef4, 0xeabf, 0x9556, 0x9557, /*0x10-0x17*/ - 0x9558, 0xeabc, 0x9559, 0x955a, 0x955b, 0xeac3, 0x955c, 0xd0c7, /*0x18-0x1f*/ - 0xd3b3, 0x955d, 0x955e, 0x955f, 0x9560, 0xb4ba, 0x9561, 0xc3c1, /*0x20-0x27*/ - 0xd7f2, 0x9562, 0x9563, 0x9564, 0x9565, 0xd5d1, 0x9566, 0xcac7, /*0x28-0x2f*/ - 0x9567, 0xeac5, 0x9568, 0x9569, 0xeac4, 0xeac7, 0xeac6, 0x956a, /*0x30-0x37*/ - 0x956b, 0x956c, 0x956d, 0x956e, 0xd6e7, 0x956f, 0xcfd4, 0x9570, /*0x38-0x3f*/ - 0x9571, 0xeacb, 0x9572, 0xbbce, 0x9573, 0x9574, 0x9575, 0x9576, /*0x40-0x47*/ - 0x9577, 0x9578, 0x9579, 0xbdfa, 0xc9ce, 0x957a, 0x957b, 0xeacc, /*0x48-0x4f*/ - 0x957c, 0x957d, 0xc9b9, 0xcffe, 0xeaca, 0xd4ce, 0xeacd, 0xeacf, /*0x50-0x57*/ - 0x957e, 0x9580, 0xcded, 0x9581, 0x9582, 0x9583, 0x9584, 0xeac9, /*0x58-0x5f*/ - 0x9585, 0xeace, 0x9586, 0x9587, 0xceee, 0x9588, 0xbbde, 0x9589, /*0x60-0x67*/ - 0xb3bf, 0x958a, 0x958b, 0x958c, 0x958d, 0x958e, 0xc6d5, 0xbeb0, /*0x68-0x6f*/ - 0xcefa, 0x958f, 0x9590, 0x9591, 0xc7e7, 0x9592, 0xbea7, 0xead0, /*0x70-0x77*/ - 0x9593, 0x9594, 0xd6c7, 0x9595, 0x9596, 0x9597, 0xc1c0, 0x9598, /*0x78-0x7f*/ - 0x9599, 0x959a, 0xd4dd, 0x959b, 0xead1, 0x959c, 0x959d, 0xcfbe, /*0x80-0x87*/ - 0x959e, 0x959f, 0x95a0, 0x95a1, 0xead2, 0x95a2, 0x95a3, 0x95a4, /*0x88-0x8f*/ - 0x95a5, 0xcaee, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0xc5af, 0xb0b5, /*0x90-0x97*/ - 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0xead4, 0x95af, 0x95b0, /*0x98-0x9f*/ - 0x95b1, 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0xead3, /*0xa0-0xa7*/ - 0xf4df, 0x95b8, 0x95b9, 0x95ba, 0x95bb, 0x95bc, 0xc4ba, 0x95bd, /*0xa8-0xaf*/ - 0x95be, 0x95bf, 0x95c0, 0x95c1, 0xb1a9, 0x95c2, 0x95c3, 0x95c4, /*0xb0-0xb7*/ - 0x95c5, 0xe5df, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0xead5, 0x95ca, /*0xb8-0xbf*/ - 0x95cb, 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, /*0xc0-0xc7*/ - 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0x95d9, 0x95da, /*0xc8-0xcf*/ - 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, /*0xd0-0xd7*/ - 0x95e3, 0xcaef, 0x95e4, 0xead6, 0xead7, 0xc6d8, 0x95e5, 0x95e6, /*0xd8-0xdf*/ - 0x95e7, 0x95e8, 0x95e9, 0x95ea, 0x95eb, 0x95ec, 0xead8, 0x95ed, /*0xe0-0xe7*/ - 0x95ee, 0xead9, 0x95ef, 0x95f0, 0x95f1, 0x95f2, 0x95f3, 0x95f4, /*0xe8-0xef*/ - 0xd4bb, 0x95f5, 0xc7fa, 0xd2b7, 0xb8fc, 0x95f6, 0x95f7, 0xeac2, /*0xf0-0xf7*/ - 0x95f8, 0xb2dc, 0x95f9, 0x95fa, 0xc2fc, 0x95fb, 0xd4f8, 0xcce6, /*0xf8-0xff*/ - /* 0x6700 */ - 0xd7ee, 0x95fc, 0x95fd, 0x95fe, 0x9640, 0x9641, 0x9642, 0x9643, /*0x00-0x07*/ - 0xd4c2, 0xd3d0, 0xebc3, 0xc5f3, 0x9644, 0xb7fe, 0x9645, 0x9646, /*0x08-0x0f*/ - 0xebd4, 0x9647, 0x9648, 0x9649, 0xcbb7, 0xebde, 0x964a, 0xc0ca, /*0x10-0x17*/ - 0x964b, 0x964c, 0x964d, 0xcdfb, 0x964e, 0xb3af, 0x964f, 0xc6da, /*0x18-0x1f*/ - 0x9650, 0x9651, 0x9652, 0x9653, 0x9654, 0x9655, 0xebfc, 0x9656, /*0x20-0x27*/ - 0xc4be, 0x9657, 0xceb4, 0xc4a9, 0xb1be, 0xd4fd, 0x9658, 0xcaf5, /*0x28-0x2f*/ - 0x9659, 0xd6ec, 0x965a, 0x965b, 0xc6d3, 0xb6e4, 0x965c, 0x965d, /*0x30-0x37*/ - 0x965e, 0x965f, 0xbbfa, 0x9660, 0x9661, 0xd0e0, 0x9662, 0x9663, /*0x38-0x3f*/ - 0xc9b1, 0x9664, 0xd4d3, 0xc8a8, 0x9665, 0x9666, 0xb8cb, 0x9667, /*0x40-0x47*/ - 0xe8be, 0xc9bc, 0x9668, 0x9669, 0xe8bb, 0x966a, 0xc0ee, 0xd0d3, /*0x48-0x4f*/ - 0xb2c4, 0xb4e5, 0x966b, 0xe8bc, 0x966c, 0x966d, 0xd5c8, 0x966e, /*0x50-0x57*/ - 0x966f, 0x9670, 0x9671, 0x9672, 0xb6c5, 0x9673, 0xe8bd, 0xcaf8, /*0x58-0x5f*/ - 0xb8dc, 0xccf5, 0x9674, 0x9675, 0x9676, 0xc0b4, 0x9677, 0x9678, /*0x60-0x67*/ - 0xd1ee, 0xe8bf, 0xe8c2, 0x9679, 0x967a, 0xbabc, 0x967b, 0xb1ad, /*0x68-0x6f*/ - 0xbddc, 0x967c, 0xeabd, 0xe8c3, 0x967d, 0xe8c6, 0x967e, 0xe8cb, /*0x70-0x77*/ - 0x9680, 0x9681, 0x9682, 0x9683, 0xe8cc, 0x9684, 0xcbc9, 0xb0e5, /*0x78-0x7f*/ - 0x9685, 0xbcab, 0x9686, 0x9687, 0xb9b9, 0x9688, 0x9689, 0xe8c1, /*0x80-0x87*/ - 0x968a, 0xcdf7, 0x968b, 0xe8ca, 0x968c, 0x968d, 0x968e, 0x968f, /*0x88-0x8f*/ - 0xcef6, 0x9690, 0x9691, 0x9692, 0x9693, 0xd5ed, 0x9694, 0xc1d6, /*0x90-0x97*/ - 0xe8c4, 0x9695, 0xc3b6, 0x9696, 0xb9fb, 0xd6a6, 0xe8c8, 0x9697, /*0x98-0x9f*/ - 0x9698, 0x9699, 0xcae0, 0xd4e6, 0x969a, 0xe8c0, 0x969b, 0xe8c5, /*0xa0-0xa7*/ - 0xe8c7, 0x969c, 0xc7b9, 0xb7e3, 0x969d, 0xe8c9, 0x969e, 0xbfdd, /*0xa8-0xaf*/ - 0xe8d2, 0x969f, 0x96a0, 0xe8d7, 0x96a1, 0xe8d5, 0xbcdc, 0xbccf, /*0xb0-0xb7*/ - 0xe8db, 0x96a2, 0x96a3, 0x96a4, 0x96a5, 0x96a6, 0x96a7, 0x96a8, /*0xb8-0xbf*/ - 0x96a9, 0xe8de, 0x96aa, 0xe8da, 0xb1fa, 0x96ab, 0x96ac, 0x96ad, /*0xc0-0xc7*/ - 0x96ae, 0x96af, 0x96b0, 0x96b1, 0x96b2, 0x96b3, 0x96b4, 0xb0d8, /*0xc8-0xcf*/ - 0xc4b3, 0xb8cc, 0xc6e2, 0xc8be, 0xc8e1, 0x96b5, 0x96b6, 0x96b7, /*0xd0-0xd7*/ - 0xe8cf, 0xe8d4, 0xe8d6, 0x96b8, 0xb9f1, 0xe8d8, 0xd7f5, 0x96b9, /*0xd8-0xdf*/ - 0xc4fb, 0x96ba, 0xe8dc, 0x96bb, 0x96bc, 0xb2e9, 0x96bd, 0x96be, /*0xe0-0xe7*/ - 0x96bf, 0xe8d1, 0x96c0, 0x96c1, 0xbced, 0x96c2, 0x96c3, 0xbfc2, /*0xe8-0xef*/ - 0xe8cd, 0xd6f9, 0x96c4, 0xc1f8, 0xb2f1, 0x96c5, 0x96c6, 0x96c7, /*0xf0-0xf7*/ - 0x96c8, 0x96c9, 0x96ca, 0x96cb, 0x96cc, 0xe8df, 0x96cd, 0xcac1, /*0xf8-0xff*/ - /* 0x6800 */ - 0xe8d9, 0x96ce, 0x96cf, 0x96d0, 0x96d1, 0xd5a4, 0x96d2, 0xb1ea, /*0x00-0x07*/ - 0xd5bb, 0xe8ce, 0xe8d0, 0xb6b0, 0xe8d3, 0x96d3, 0xe8dd, 0xc0b8, /*0x08-0x0f*/ - 0x96d4, 0xcaf7, 0x96d5, 0xcba8, 0x96d6, 0x96d7, 0xc6dc, 0xc0f5, /*0x10-0x17*/ - 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, 0xe8e9, 0x96dd, 0x96de, /*0x18-0x1f*/ - 0x96df, 0xd0a3, 0x96e0, 0x96e1, 0x96e2, 0x96e3, 0x96e4, 0x96e5, /*0x20-0x27*/ - 0x96e6, 0xe8f2, 0xd6ea, 0x96e7, 0x96e8, 0x96e9, 0x96ea, 0x96eb, /*0x28-0x2f*/ - 0x96ec, 0x96ed, 0xe8e0, 0xe8e1, 0x96ee, 0x96ef, 0x96f0, 0xd1f9, /*0x30-0x37*/ - 0xbacb, 0xb8f9, 0x96f1, 0x96f2, 0xb8f1, 0xd4d4, 0xe8ef, 0x96f3, /*0x38-0x3f*/ - 0xe8ee, 0xe8ec, 0xb9f0, 0xccd2, 0xe8e6, 0xcea6, 0xbff2, 0x96f4, /*0x40-0x47*/ - 0xb0b8, 0xe8f1, 0xe8f0, 0x96f5, 0xd7c0, 0x96f6, 0xe8e4, 0x96f7, /*0x48-0x4f*/ - 0xcda9, 0xc9a3, 0x96f8, 0xbbb8, 0xbddb, 0xe8ea, 0x96f9, 0x96fa, /*0x50-0x57*/ - 0x96fb, 0x96fc, 0x96fd, 0x96fe, 0x9740, 0x9741, 0x9742, 0x9743, /*0x58-0x5f*/ - 0xe8e2, 0xe8e3, 0xe8e5, 0xb5b5, 0xe8e7, 0xc7c5, 0xe8eb, 0xe8ed, /*0x60-0x67*/ - 0xbdb0, 0xd7ae, 0x9744, 0xe8f8, 0x9745, 0x9746, 0x9747, 0x9748, /*0x68-0x6f*/ - 0x9749, 0x974a, 0x974b, 0x974c, 0xe8f5, 0x974d, 0xcdb0, 0xe8f6, /*0x70-0x77*/ - 0x974e, 0x974f, 0x9750, 0x9751, 0x9752, 0x9753, 0x9754, 0x9755, /*0x78-0x7f*/ - 0x9756, 0xc1ba, 0x9757, 0xe8e8, 0x9758, 0xc3b7, 0xb0f0, 0x9759, /*0x80-0x87*/ - 0x975a, 0x975b, 0x975c, 0x975d, 0x975e, 0x975f, 0x9760, 0xe8f4, /*0x88-0x8f*/ - 0x9761, 0x9762, 0x9763, 0xe8f7, 0x9764, 0x9765, 0x9766, 0xb9a3, /*0x90-0x97*/ - 0x9767, 0x9768, 0x9769, 0x976a, 0x976b, 0x976c, 0x976d, 0x976e, /*0x98-0x9f*/ - 0x976f, 0x9770, 0xc9d2, 0x9771, 0x9772, 0x9773, 0xc3ce, 0xcee0, /*0xa0-0xa7*/ - 0xc0e6, 0x9774, 0x9775, 0x9776, 0x9777, 0xcbf3, 0x9778, 0xccdd, /*0xa8-0xaf*/ - 0xd0b5, 0x9779, 0x977a, 0xcae1, 0x977b, 0xe8f3, 0x977c, 0x977d, /*0xb0-0xb7*/ - 0x977e, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9785, 0x9786, /*0xb8-0xbf*/ - 0xbcec, 0x9787, 0xe8f9, 0x9788, 0x9789, 0x978a, 0x978b, 0x978c, /*0xc0-0xc7*/ - 0x978d, 0xc3de, 0x978e, 0xc6e5, 0x978f, 0xb9f7, 0x9790, 0x9791, /*0xc8-0xcf*/ - 0x9792, 0x9793, 0xb0f4, 0x9794, 0x9795, 0xd7d8, 0x9796, 0x9797, /*0xd0-0xd7*/ - 0xbcac, 0x9798, 0xc5ef, 0x9799, 0x979a, 0x979b, 0x979c, 0x979d, /*0xd8-0xdf*/ - 0xccc4, 0x979e, 0x979f, 0xe9a6, 0x97a0, 0x97a1, 0x97a2, 0x97a3, /*0xe0-0xe7*/ - 0x97a4, 0x97a5, 0x97a6, 0x97a7, 0x97a8, 0x97a9, 0xc9ad, 0x97aa, /*0xe8-0xef*/ - 0xe9a2, 0xc0e2, 0x97ab, 0x97ac, 0x97ad, 0xbfc3, 0x97ae, 0x97af, /*0xf0-0xf7*/ - 0x97b0, 0xe8fe, 0xb9d7, 0x97b1, 0xe8fb, 0x97b2, 0x97b3, 0x97b4, /*0xf8-0xff*/ - /* 0x6900 */ - 0x97b5, 0xe9a4, 0x97b6, 0x97b7, 0x97b8, 0xd2ce, 0x97b9, 0x97ba, /*0x00-0x07*/ - 0x97bb, 0x97bc, 0x97bd, 0xe9a3, 0x97be, 0xd6b2, 0xd7b5, 0x97bf, /*0x08-0x0f*/ - 0xe9a7, 0x97c0, 0xbdb7, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, /*0x10-0x17*/ - 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0xe8fc, /*0x18-0x1f*/ - 0xe8fd, 0x97cd, 0x97ce, 0x97cf, 0xe9a1, 0x97d0, 0x97d1, 0x97d2, /*0x20-0x27*/ - 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, 0xcdd6, 0x97d8, 0x97d9, /*0x28-0x2f*/ - 0xd2ac, 0x97da, 0x97db, 0x97dc, 0xe9b2, 0x97dd, 0x97de, 0x97df, /*0x30-0x37*/ - 0x97e0, 0xe9a9, 0x97e1, 0x97e2, 0x97e3, 0xb4aa, 0x97e4, 0xb4bb, /*0x38-0x3f*/ - 0x97e5, 0x97e6, 0xe9ab, 0x97e7, 0x97e8, 0x97e9, 0x97ea, 0x97eb, /*0x40-0x47*/ - 0x97ec, 0x97ed, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f3, /*0x48-0x4f*/ - 0x97f4, 0x97f5, 0x97f6, 0x97f7, 0xd0a8, 0x97f8, 0x97f9, 0xe9a5, /*0x50-0x57*/ - 0x97fa, 0x97fb, 0xb3fe, 0x97fc, 0x97fd, 0xe9ac, 0xc0e3, 0x97fe, /*0x58-0x5f*/ - 0xe9aa, 0x9840, 0x9841, 0xe9b9, 0x9842, 0x9843, 0xe9b8, 0x9844, /*0x60-0x67*/ - 0x9845, 0x9846, 0x9847, 0xe9ae, 0x9848, 0x9849, 0xe8fa, 0x984a, /*0x68-0x6f*/ - 0x984b, 0xe9a8, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, 0xbfac, /*0x70-0x77*/ - 0xe9b1, 0xe9ba, 0x9851, 0x9852, 0xc2a5, 0x9853, 0x9854, 0x9855, /*0x78-0x7f*/ - 0xe9af, 0x9856, 0xb8c5, 0x9857, 0xe9ad, 0x9858, 0xd3dc, 0xe9b4, /*0x80-0x87*/ - 0xe9b5, 0xe9b7, 0x9859, 0x985a, 0x985b, 0xe9c7, 0x985c, 0x985d, /*0x88-0x8f*/ - 0x985e, 0x985f, 0x9860, 0x9861, 0xc0c6, 0xe9c5, 0x9862, 0x9863, /*0x90-0x97*/ - 0xe9b0, 0x9864, 0x9865, 0xe9bb, 0xb0f1, 0x9866, 0x9867, 0x9868, /*0x98-0x9f*/ - 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x986f, 0xe9bc, /*0xa0-0xa7*/ - 0xd5a5, 0x9870, 0x9871, 0xe9be, 0x9872, 0xe9bf, 0x9873, 0x9874, /*0xa8-0xaf*/ - 0x9875, 0xe9c1, 0x9876, 0x9877, 0xc1f1, 0x9878, 0x9879, 0xc8b6, /*0xb0-0xb7*/ - 0x987a, 0x987b, 0x987c, 0xe9bd, 0x987d, 0x987e, 0x9880, 0x9881, /*0xb8-0xbf*/ - 0x9882, 0xe9c2, 0x9883, 0x9884, 0x9885, 0x9886, 0x9887, 0x9888, /*0xc0-0xc7*/ - 0x9889, 0x988a, 0xe9c3, 0x988b, 0xe9b3, 0x988c, 0xe9b6, 0x988d, /*0xc8-0xcf*/ - 0xbbb1, 0x988e, 0x988f, 0x9890, 0xe9c0, 0x9891, 0x9892, 0x9893, /*0xd0-0xd7*/ - 0x9894, 0x9895, 0x9896, 0xbcf7, 0x9897, 0x9898, 0x9899, 0xe9c4, /*0xd8-0xdf*/ - 0xe9c6, 0x989a, 0x989b, 0x989c, 0x989d, 0x989e, 0x989f, 0x98a0, /*0xe0-0xe7*/ - 0x98a1, 0x98a2, 0x98a3, 0x98a4, 0x98a5, 0xe9ca, 0x98a6, 0x98a7, /*0xe8-0xef*/ - 0x98a8, 0x98a9, 0xe9ce, 0x98aa, 0x98ab, 0x98ac, 0x98ad, 0x98ae, /*0xf0-0xf7*/ - 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, 0xb2db, 0x98b4, 0xe9c8, /*0xf8-0xff*/ - /* 0x6a00 */ - 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, 0x98bc, /*0x00-0x07*/ - 0x98bd, 0x98be, 0xb7ae, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, /*0x08-0x0f*/ - 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0xe9cb, /*0x10-0x17*/ - 0xe9cc, 0x98cb, 0x98cc, 0x98cd, 0x98ce, 0x98cf, 0x98d0, 0xd5c1, /*0x18-0x1f*/ - 0x98d1, 0xc4a3, 0x98d2, 0x98d3, 0x98d4, 0x98d5, 0x98d6, 0x98d7, /*0x20-0x27*/ - 0xe9d8, 0x98d8, 0xbae1, 0x98d9, 0x98da, 0x98db, 0x98dc, 0xe9c9, /*0x28-0x2f*/ - 0x98dd, 0xd3a3, 0x98de, 0x98df, 0x98e0, 0xe9d4, 0x98e1, 0x98e2, /*0x30-0x37*/ - 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e7, 0xe9d7, 0xe9d0, 0x98e8, /*0x38-0x3f*/ - 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0xe9cf, 0x98ed, 0x98ee, 0xc7c1, /*0x40-0x47*/ - 0x98ef, 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, /*0x48-0x4f*/ - 0xe9d2, 0x98f7, 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, /*0x50-0x57*/ - 0xe9d9, 0xb3c8, 0x98fe, 0xe9d3, 0x9940, 0x9941, 0x9942, 0x9943, /*0x58-0x5f*/ - 0x9944, 0xcff0, 0x9945, 0x9946, 0x9947, 0xe9cd, 0x9948, 0x9949, /*0x60-0x67*/ - 0x994a, 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, /*0x68-0x6f*/ - 0x9952, 0xb3f7, 0x9953, 0x9954, 0x9955, 0x9956, 0x9957, 0x9958, /*0x70-0x77*/ - 0x9959, 0xe9d6, 0x995a, 0x995b, 0xe9da, 0x995c, 0x995d, 0x995e, /*0x78-0x7f*/ - 0xccb4, 0x995f, 0x9960, 0x9961, 0xcfad, 0x9962, 0x9963, 0x9964, /*0x80-0x87*/ - 0x9965, 0x9966, 0x9967, 0x9968, 0x9969, 0x996a, 0xe9d5, 0x996b, /*0x88-0x8f*/ - 0xe9dc, 0xe9db, 0x996c, 0x996d, 0x996e, 0x996f, 0x9970, 0xe9de, /*0x90-0x97*/ - 0x9971, 0x9972, 0x9973, 0x9974, 0x9975, 0x9976, 0x9977, 0x9978, /*0x98-0x9f*/ - 0xe9d1, 0x9979, 0x997a, 0x997b, 0x997c, 0x997d, 0x997e, 0x9980, /*0xa0-0xa7*/ - 0x9981, 0xe9dd, 0x9982, 0xe9df, 0xc3ca, 0x9983, 0x9984, 0x9985, /*0xa8-0xaf*/ - 0x9986, 0x9987, 0x9988, 0x9989, 0x998a, 0x998b, 0x998c, 0x998d, /*0xb0-0xb7*/ - 0x998e, 0x998f, 0x9990, 0x9991, 0x9992, 0x9993, 0x9994, 0x9995, /*0xb8-0xbf*/ - 0x9996, 0x9997, 0x9998, 0x9999, 0x999a, 0x999b, 0x999c, 0x999d, /*0xc0-0xc7*/ - 0x999e, 0x999f, 0x99a0, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a5, /*0xc8-0xcf*/ - 0x99a6, 0x99a7, 0x99a8, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, /*0xd0-0xd7*/ - 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, /*0xd8-0xdf*/ - 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, /*0xe0-0xe7*/ - 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, /*0xe8-0xef*/ - 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, /*0xf0-0xf7*/ - 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, /*0xf8-0xff*/ - /* 0x6b00 */ - 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, /*0x00-0x07*/ - 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, /*0x08-0x0f*/ - 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, /*0x10-0x17*/ - 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, /*0x18-0x1f*/ - 0xc7b7, 0xb4ce, 0xbbb6, 0xd0c0, 0xeca3, 0x99f6, 0x99f7, 0xc5b7, /*0x20-0x27*/ - 0x99f8, 0x99f9, 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x9a40, /*0x28-0x2f*/ - 0x9a41, 0x9a42, 0xd3fb, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0xeca4, /*0x30-0x37*/ - 0x9a47, 0xeca5, 0xc6db, 0x9a48, 0x9a49, 0x9a4a, 0xbfee, 0x9a4b, /*0x38-0x3f*/ - 0x9a4c, 0x9a4d, 0x9a4e, 0xeca6, 0x9a4f, 0x9a50, 0xeca7, 0xd0aa, /*0x40-0x47*/ - 0x9a51, 0xc7b8, 0x9a52, 0x9a53, 0xb8e8, 0x9a54, 0x9a55, 0x9a56, /*0x48-0x4f*/ - 0x9a57, 0x9a58, 0x9a59, 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, /*0x50-0x57*/ - 0x9a5f, 0xeca8, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, /*0x58-0x5f*/ - 0x9a66, 0x9a67, 0xd6b9, 0xd5fd, 0xb4cb, 0xb2bd, 0xcee4, 0xc6e7, /*0x60-0x67*/ - 0x9a68, 0x9a69, 0xcde1, 0x9a6a, 0x9a6b, 0x9a6c, 0x9a6d, 0x9a6e, /*0x68-0x6f*/ - 0x9a6f, 0x9a70, 0x9a71, 0x9a72, 0x9a73, 0x9a74, 0x9a75, 0x9a76, /*0x70-0x77*/ - 0x9a77, 0xb4f5, 0x9a78, 0xcbc0, 0xbcdf, 0x9a79, 0x9a7a, 0x9a7b, /*0x78-0x7f*/ - 0x9a7c, 0xe9e2, 0xe9e3, 0xd1ea, 0xe9e5, 0x9a7d, 0xb4f9, 0xe9e4, /*0x80-0x87*/ - 0x9a7e, 0xd1b3, 0xcae2, 0xb2d0, 0x9a80, 0xe9e8, 0x9a81, 0x9a82, /*0x88-0x8f*/ - 0x9a83, 0x9a84, 0xe9e6, 0xe9e7, 0x9a85, 0x9a86, 0xd6b3, 0x9a87, /*0x90-0x97*/ - 0x9a88, 0x9a89, 0xe9e9, 0xe9ea, 0x9a8a, 0x9a8b, 0x9a8c, 0x9a8d, /*0x98-0x9f*/ - 0x9a8e, 0xe9eb, 0x9a8f, 0x9a90, 0x9a91, 0x9a92, 0x9a93, 0x9a94, /*0xa0-0xa7*/ - 0x9a95, 0x9a96, 0xe9ec, 0x9a97, 0x9a98, 0x9a99, 0x9a9a, 0x9a9b, /*0xa8-0xaf*/ - 0x9a9c, 0x9a9d, 0x9a9e, 0xecaf, 0xc5b9, 0xb6ce, 0x9a9f, 0xd2f3, /*0xb0-0xb7*/ - 0x9aa0, 0x9aa1, 0x9aa2, 0x9aa3, 0x9aa4, 0x9aa5, 0x9aa6, 0xb5ee, /*0xb8-0xbf*/ - 0x9aa7, 0xbbd9, 0xecb1, 0x9aa8, 0x9aa9, 0xd2e3, 0x9aaa, 0x9aab, /*0xc0-0xc7*/ - 0x9aac, 0x9aad, 0x9aae, 0xcee3, 0x9aaf, 0xc4b8, 0x9ab0, 0xc3bf, /*0xc8-0xcf*/ - 0x9ab1, 0x9ab2, 0xb6be, 0xd8b9, 0xb1c8, 0xb1cf, 0xb1d1, 0xc5fe, /*0xd0-0xd7*/ - 0x9ab3, 0xb1d0, 0x9ab4, 0xc3ab, 0x9ab5, 0x9ab6, 0x9ab7, 0x9ab8, /*0xd8-0xdf*/ - 0x9ab9, 0xd5b1, 0x9aba, 0x9abb, 0x9abc, 0x9abd, 0x9abe, 0x9abf, /*0xe0-0xe7*/ - 0x9ac0, 0x9ac1, 0xeba4, 0xbac1, 0x9ac2, 0x9ac3, 0x9ac4, 0xccba, /*0xe8-0xef*/ - 0x9ac5, 0x9ac6, 0x9ac7, 0xeba5, 0x9ac8, 0xeba7, 0x9ac9, 0x9aca, /*0xf0-0xf7*/ - 0x9acb, 0xeba8, 0x9acc, 0x9acd, 0x9ace, 0xeba6, 0x9acf, 0x9ad0, /*0xf8-0xff*/ - /* 0x6c00 */ - 0x9ad1, 0x9ad2, 0x9ad3, 0x9ad4, 0x9ad5, 0xeba9, 0xebab, 0xebaa, /*0x00-0x07*/ - 0x9ad6, 0x9ad7, 0x9ad8, 0x9ad9, 0x9ada, 0xebac, 0x9adb, 0xcacf, /*0x08-0x0f*/ - 0xd8b5, 0xc3f1, 0x9adc, 0xc3a5, 0xc6f8, 0xebad, 0xc4ca, 0x9add, /*0x10-0x17*/ - 0xebae, 0xebaf, 0xebb0, 0xb7d5, 0x9ade, 0x9adf, 0x9ae0, 0xb7fa, /*0x18-0x1f*/ - 0x9ae1, 0xebb1, 0xc7e2, 0x9ae2, 0xebb3, 0x9ae3, 0xbaa4, 0xd1f5, /*0x20-0x27*/ - 0xb0b1, 0xebb2, 0xebb4, 0x9ae4, 0x9ae5, 0x9ae6, 0xb5aa, 0xc2c8, /*0x28-0x2f*/ - 0xc7e8, 0x9ae7, 0xebb5, 0x9ae8, 0xcbae, 0xe3df, 0x9ae9, 0x9aea, /*0x30-0x37*/ - 0xd3c0, 0x9aeb, 0x9aec, 0x9aed, 0x9aee, 0xd9db, 0x9aef, 0x9af0, /*0x38-0x3f*/ - 0xcda1, 0xd6ad, 0xc7f3, 0x9af1, 0x9af2, 0x9af3, 0xd9e0, 0xbbe3, /*0x40-0x47*/ - 0x9af4, 0xbaba, 0xe3e2, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9af9, /*0x48-0x4f*/ - 0xcfab, 0x9afa, 0x9afb, 0x9afc, 0xe3e0, 0xc9c7, 0x9afd, 0xbab9, /*0x50-0x57*/ - 0x9afe, 0x9b40, 0x9b41, 0xd1b4, 0xe3e1, 0xc8ea, 0xb9af, 0xbdad, /*0x58-0x5f*/ - 0xb3d8, 0xcedb, 0x9b42, 0x9b43, 0xccc0, 0x9b44, 0x9b45, 0x9b46, /*0x60-0x67*/ - 0xe3e8, 0xe3e9, 0xcdf4, 0x9b47, 0x9b48, 0x9b49, 0x9b4a, 0x9b4b, /*0x68-0x6f*/ - 0xccad, 0x9b4c, 0xbcb3, 0x9b4d, 0xe3ea, 0x9b4e, 0xe3eb, 0x9b4f, /*0x70-0x77*/ - 0x9b50, 0xd0da, 0x9b51, 0x9b52, 0x9b53, 0xc6fb, 0xb7da, 0x9b54, /*0x78-0x7f*/ - 0x9b55, 0xc7df, 0xd2ca, 0xced6, 0x9b56, 0xe3e4, 0xe3ec, 0x9b57, /*0x80-0x87*/ - 0xc9f2, 0xb3c1, 0x9b58, 0x9b59, 0xe3e7, 0x9b5a, 0x9b5b, 0xc6e3, /*0x88-0x8f*/ - 0xe3e5, 0x9b5c, 0x9b5d, 0xedb3, 0xe3e6, 0x9b5e, 0x9b5f, 0x9b60, /*0x90-0x97*/ - 0x9b61, 0xc9b3, 0x9b62, 0xc5e6, 0x9b63, 0x9b64, 0x9b65, 0xb9b5, /*0x98-0x9f*/ - 0x9b66, 0xc3bb, 0x9b67, 0xe3e3, 0xc5bd, 0xc1a4, 0xc2d9, 0xb2d7, /*0xa0-0xa7*/ - 0x9b68, 0xe3ed, 0xbba6, 0xc4ad, 0x9b69, 0xe3f0, 0xbeda, 0x9b6a, /*0xa8-0xaf*/ - 0x9b6b, 0xe3fb, 0xe3f5, 0xbad3, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, /*0xb0-0xb7*/ - 0xb7d0, 0xd3cd, 0x9b70, 0xd6ce, 0xd5d3, 0xb9c1, 0xd5b4, 0xd1d8, /*0xb8-0xbf*/ - 0x9b71, 0x9b72, 0x9b73, 0x9b74, 0xd0b9, 0xc7f6, 0x9b75, 0x9b76, /*0xc0-0xc7*/ - 0x9b77, 0xc8aa, 0xb2b4, 0x9b78, 0xc3da, 0x9b79, 0x9b7a, 0x9b7b, /*0xc8-0xcf*/ - 0xe3ee, 0x9b7c, 0x9b7d, 0xe3fc, 0xe3ef, 0xb7a8, 0xe3f7, 0xe3f4, /*0xd0-0xd7*/ - 0x9b7e, 0x9b80, 0x9b81, 0xb7ba, 0x9b82, 0x9b83, 0xc5a2, 0x9b84, /*0xd8-0xdf*/ - 0xe3f6, 0xc5dd, 0xb2a8, 0xc6fc, 0x9b85, 0xc4e0, 0x9b86, 0x9b87, /*0xe0-0xe7*/ - 0xd7a2, 0x9b88, 0xc0e1, 0xe3f9, 0x9b89, 0x9b8a, 0xe3fa, 0xe3fd, /*0xe8-0xef*/ - 0xcca9, 0xe3f3, 0x9b8b, 0xd3be, 0x9b8c, 0xb1c3, 0xedb4, 0xe3f1, /*0xf0-0xf7*/ - 0xe3f2, 0x9b8d, 0xe3f8, 0xd0ba, 0xc6c3, 0xd4f3, 0xe3fe, 0x9b8e, /*0xf8-0xff*/ - /* 0x6d00 */ - 0x9b8f, 0xbde0, 0x9b90, 0x9b91, 0xe4a7, 0x9b92, 0x9b93, 0xe4a6, /*0x00-0x07*/ - 0x9b94, 0x9b95, 0x9b96, 0xd1f3, 0xe4a3, 0x9b97, 0xe4a9, 0x9b98, /*0x08-0x0f*/ - 0x9b99, 0x9b9a, 0xc8f7, 0x9b9b, 0x9b9c, 0x9b9d, 0x9b9e, 0xcfb4, /*0x10-0x17*/ - 0x9b9f, 0xe4a8, 0xe4ae, 0xc2e5, 0x9ba0, 0x9ba1, 0xb6b4, 0x9ba2, /*0x18-0x1f*/ - 0x9ba3, 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0xbdf2, 0x9ba8, 0xe4a2, /*0x20-0x27*/ - 0x9ba9, 0x9baa, 0xbae9, 0xe4aa, 0x9bab, 0x9bac, 0xe4ac, 0x9bad, /*0x28-0x2f*/ - 0x9bae, 0xb6fd, 0xd6de, 0xe4b2, 0x9baf, 0xe4ad, 0x9bb0, 0x9bb1, /*0x30-0x37*/ - 0x9bb2, 0xe4a1, 0x9bb3, 0xbbee, 0xcddd, 0xc7a2, 0xc5c9, 0x9bb4, /*0x38-0x3f*/ - 0x9bb5, 0xc1f7, 0x9bb6, 0xe4a4, 0x9bb7, 0xc7b3, 0xbdac, 0xbdbd, /*0x40-0x47*/ - 0xe4a5, 0x9bb8, 0xd7c7, 0xb2e2, 0x9bb9, 0xe4ab, 0xbcc3, 0xe4af, /*0x48-0x4f*/ - 0x9bba, 0xbbeb, 0xe4b0, 0xc5a8, 0xe4b1, 0x9bbb, 0x9bbc, 0x9bbd, /*0x50-0x57*/ - 0x9bbe, 0xd5e3, 0xbfa3, 0x9bbf, 0xe4ba, 0x9bc0, 0xe4b7, 0x9bc1, /*0x58-0x5f*/ - 0xe4bb, 0x9bc2, 0x9bc3, 0xe4bd, 0x9bc4, 0x9bc5, 0xc6d6, 0x9bc6, /*0x60-0x67*/ - 0x9bc7, 0xbac6, 0xc0cb, 0x9bc8, 0x9bc9, 0x9bca, 0xb8a1, 0xe4b4, /*0x68-0x6f*/ - 0x9bcb, 0x9bcc, 0x9bcd, 0x9bce, 0xd4a1, 0x9bcf, 0x9bd0, 0xbaa3, /*0x70-0x77*/ - 0xbdfe, 0x9bd1, 0x9bd2, 0x9bd3, 0xe4bc, 0x9bd4, 0x9bd5, 0x9bd6, /*0x78-0x7f*/ - 0x9bd7, 0x9bd8, 0xcdbf, 0x9bd9, 0x9bda, 0xc4f9, 0x9bdb, 0x9bdc, /*0x80-0x87*/ - 0xcffb, 0xc9e6, 0x9bdd, 0x9bde, 0xd3bf, 0x9bdf, 0xcfd1, 0x9be0, /*0x88-0x8f*/ - 0x9be1, 0xe4b3, 0x9be2, 0xe4b8, 0xe4b9, 0xcce9, 0x9be3, 0x9be4, /*0x90-0x97*/ - 0x9be5, 0x9be6, 0x9be7, 0xccce, 0x9be8, 0xc0d4, 0xe4b5, 0xc1b0, /*0x98-0x9f*/ - 0xe4b6, 0xced0, 0x9be9, 0xbbc1, 0xb5d3, 0x9bea, 0xc8f3, 0xbda7, /*0xa0-0xa7*/ - 0xd5c7, 0xc9ac, 0xb8a2, 0xe4ca, 0x9beb, 0x9bec, 0xe4cc, 0xd1c4, /*0xa8-0xaf*/ - 0x9bed, 0x9bee, 0xd2ba, 0x9bef, 0x9bf0, 0xbaad, 0x9bf1, 0x9bf2, /*0xb0-0xb7*/ - 0xbad4, 0x9bf3, 0x9bf4, 0x9bf5, 0x9bf6, 0x9bf7, 0x9bf8, 0xe4c3, /*0xb8-0xbf*/ - 0xb5ed, 0x9bf9, 0x9bfa, 0x9bfb, 0xd7cd, 0xe4c0, 0xcffd, 0xe4bf, /*0xc0-0xc7*/ - 0x9bfc, 0x9bfd, 0x9bfe, 0xc1dc, 0xccca, 0x9c40, 0x9c41, 0x9c42, /*0xc8-0xcf*/ - 0x9c43, 0xcae7, 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0xc4d7, 0x9c48, /*0xd0-0xd7*/ - 0xccd4, 0xe4c8, 0x9c49, 0x9c4a, 0x9c4b, 0xe4c7, 0xe4c1, 0x9c4c, /*0xd8-0xdf*/ - 0xe4c4, 0xb5ad, 0x9c4d, 0x9c4e, 0xd3d9, 0x9c4f, 0xe4c6, 0x9c50, /*0xe0-0xe7*/ - 0x9c51, 0x9c52, 0x9c53, 0xd2f9, 0xb4e3, 0x9c54, 0xbbb4, 0x9c55, /*0xe8-0xef*/ - 0x9c56, 0xc9ee, 0x9c57, 0xb4be, 0x9c58, 0x9c59, 0x9c5a, 0xbbec, /*0xf0-0xf7*/ - 0x9c5b, 0xd1cd, 0x9c5c, 0xcced, 0xedb5, 0x9c5d, 0x9c5e, 0x9c5f, /*0xf8-0xff*/ - /* 0x6e00 */ - 0x9c60, 0x9c61, 0x9c62, 0x9c63, 0x9c64, 0xc7e5, 0x9c65, 0x9c66, /*0x00-0x07*/ - 0x9c67, 0x9c68, 0xd4a8, 0x9c69, 0xe4cb, 0xd7d5, 0xe4c2, 0x9c6a, /*0x08-0x0f*/ - 0xbda5, 0xe4c5, 0x9c6b, 0x9c6c, 0xd3e6, 0x9c6d, 0xe4c9, 0xc9f8, /*0x10-0x17*/ - 0x9c6e, 0x9c6f, 0xe4be, 0x9c70, 0x9c71, 0xd3e5, 0x9c72, 0x9c73, /*0x18-0x1f*/ - 0xc7fe, 0xb6c9, 0x9c74, 0xd4fc, 0xb2b3, 0xe4d7, 0x9c75, 0x9c76, /*0x20-0x27*/ - 0x9c77, 0xcec2, 0x9c78, 0xe4cd, 0x9c79, 0xcebc, 0x9c7a, 0xb8db, /*0x28-0x2f*/ - 0x9c7b, 0x9c7c, 0xe4d6, 0x9c7d, 0xbfca, 0x9c7e, 0x9c80, 0x9c81, /*0x30-0x37*/ - 0xd3ce, 0x9c82, 0xc3ec, 0x9c83, 0x9c84, 0x9c85, 0x9c86, 0x9c87, /*0x38-0x3f*/ - 0x9c88, 0x9c89, 0x9c8a, 0xc5c8, 0xe4d8, 0x9c8b, 0x9c8c, 0x9c8d, /*0x40-0x47*/ - 0x9c8e, 0x9c8f, 0x9c90, 0x9c91, 0x9c92, 0xcdc4, 0xe4cf, 0x9c93, /*0x48-0x4f*/ - 0x9c94, 0x9c95, 0x9c96, 0xe4d4, 0xe4d5, 0x9c97, 0xbafe, 0x9c98, /*0x50-0x57*/ - 0xcfe6, 0x9c99, 0x9c9a, 0xd5bf, 0x9c9b, 0x9c9c, 0x9c9d, 0xe4d2, /*0x58-0x5f*/ - 0x9c9e, 0x9c9f, 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca4, 0x9ca5, /*0x60-0x67*/ - 0x9ca6, 0x9ca7, 0x9ca8, 0xe4d0, 0x9ca9, 0x9caa, 0xe4ce, 0x9cab, /*0x68-0x6f*/ - 0x9cac, 0x9cad, 0x9cae, 0x9caf, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, /*0x70-0x77*/ - 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cb8, 0x9cb9, 0xcde5, 0xcaaa, /*0x78-0x7f*/ - 0x9cba, 0x9cbb, 0x9cbc, 0xc0a3, 0x9cbd, 0xbda6, 0xe4d3, 0x9cbe, /*0x80-0x87*/ - 0x9cbf, 0xb8c8, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc3, 0x9cc4, 0xe4e7, /*0x88-0x8f*/ - 0xd4b4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cc8, 0x9cc9, 0x9cca, 0x9ccb, /*0x90-0x97*/ - 0xe4db, 0x9ccc, 0x9ccd, 0x9cce, 0xc1ef, 0x9ccf, 0x9cd0, 0xe4e9, /*0x98-0x9f*/ - 0x9cd1, 0x9cd2, 0xd2e7, 0x9cd3, 0x9cd4, 0xe4df, 0x9cd5, 0xe4e0, /*0xa0-0xa7*/ - 0x9cd6, 0x9cd7, 0xcfaa, 0x9cd8, 0x9cd9, 0x9cda, 0x9cdb, 0xcbdd, /*0xa8-0xaf*/ - 0x9cdc, 0xe4da, 0xe4d1, 0x9cdd, 0xe4e5, 0x9cde, 0xc8dc, 0xe4e3, /*0xb0-0xb7*/ - 0x9cdf, 0x9ce0, 0xc4e7, 0xe4e2, 0x9ce1, 0xe4e1, 0x9ce2, 0x9ce3, /*0xb8-0xbf*/ - 0x9ce4, 0xb3fc, 0xe4e8, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0xb5e1, /*0xc0-0xc7*/ - 0x9ce9, 0x9cea, 0x9ceb, 0xd7cc, 0x9cec, 0x9ced, 0x9cee, 0xe4e6, /*0xc8-0xcf*/ - 0x9cef, 0xbbac, 0x9cf0, 0xd7d2, 0xcccf, 0xebf8, 0x9cf1, 0xe4e4, /*0xd0-0xd7*/ - 0x9cf2, 0x9cf3, 0xb9f6, 0x9cf4, 0x9cf5, 0x9cf6, 0xd6cd, 0xe4d9, /*0xd8-0xdf*/ - 0xe4dc, 0xc2fa, 0xe4de, 0x9cf7, 0xc2cb, 0xc0c4, 0xc2d0, 0x9cf8, /*0xe0-0xe7*/ - 0xb1f5, 0xccb2, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, /*0xe8-0xef*/ - 0x9d40, 0x9d41, 0x9d42, 0x9d43, 0xb5ce, 0x9d44, 0x9d45, 0x9d46, /*0xf0-0xf7*/ - 0x9d47, 0xe4ef, 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, /*0xf8-0xff*/ - /* 0x6f00 */ - 0x9d4e, 0x9d4f, 0xc6af, 0x9d50, 0x9d51, 0x9d52, 0xc6e1, 0x9d53, /*0x00-0x07*/ - 0x9d54, 0xe4f5, 0x9d55, 0x9d56, 0x9d57, 0x9d58, 0x9d59, 0xc2a9, /*0x08-0x0f*/ - 0x9d5a, 0x9d5b, 0x9d5c, 0xc0ec, 0xd1dd, 0xe4ee, 0x9d5d, 0x9d5e, /*0x10-0x17*/ - 0x9d5f, 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, /*0x18-0x1f*/ - 0xc4ae, 0x9d67, 0x9d68, 0x9d69, 0xe4ed, 0x9d6a, 0x9d6b, 0x9d6c, /*0x20-0x27*/ - 0x9d6d, 0xe4f6, 0xe4f4, 0xc2fe, 0x9d6e, 0xe4dd, 0x9d6f, 0xe4f0, /*0x28-0x2f*/ - 0x9d70, 0xcafe, 0x9d71, 0xd5c4, 0x9d72, 0x9d73, 0xe4f1, 0x9d74, /*0x30-0x37*/ - 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, 0xd1fa, 0x9d7b, /*0x38-0x3f*/ - 0x9d7c, 0x9d7d, 0x9d7e, 0x9d80, 0x9d81, 0x9d82, 0xe4eb, 0xe4ec, /*0x40-0x47*/ - 0x9d83, 0x9d84, 0x9d85, 0xe4f2, 0x9d86, 0xceab, 0x9d87, 0x9d88, /*0x48-0x4f*/ - 0x9d89, 0x9d8a, 0x9d8b, 0x9d8c, 0x9d8d, 0x9d8e, 0x9d8f, 0x9d90, /*0x50-0x57*/ - 0xc5cb, 0x9d91, 0x9d92, 0x9d93, 0xc7b1, 0x9d94, 0xc2ba, 0x9d95, /*0x58-0x5f*/ - 0x9d96, 0x9d97, 0xe4ea, 0x9d98, 0x9d99, 0x9d9a, 0xc1ca, 0x9d9b, /*0x60-0x67*/ - 0x9d9c, 0x9d9d, 0x9d9e, 0x9d9f, 0x9da0, 0xccb6, 0xb3b1, 0x9da1, /*0x68-0x6f*/ - 0x9da2, 0x9da3, 0xe4fb, 0x9da4, 0xe4f3, 0x9da5, 0x9da6, 0x9da7, /*0x70-0x77*/ - 0xe4fa, 0x9da8, 0xe4fd, 0x9da9, 0xe4fc, 0x9daa, 0x9dab, 0x9dac, /*0x78-0x7f*/ - 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0xb3ce, 0x9db1, 0x9db2, 0x9db3, /*0x80-0x87*/ - 0xb3ba, 0xe4f7, 0x9db4, 0x9db5, 0xe4f9, 0xe4f8, 0xc5ec, 0x9db6, /*0x88-0x8f*/ - 0x9db7, 0x9db8, 0x9db9, 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, /*0x90-0x97*/ - 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, 0xc0bd, 0x9dc3, 0x9dc4, 0x9dc5, /*0x98-0x9f*/ - 0x9dc6, 0xd4e8, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, 0x9dcb, 0xe5a2, /*0xa0-0xa7*/ - 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, 0x9dd3, /*0xa8-0xaf*/ - 0x9dd4, 0x9dd5, 0x9dd6, 0xb0c4, 0x9dd7, 0x9dd8, 0xe5a4, 0x9dd9, /*0xb0-0xb7*/ - 0x9dda, 0xe5a3, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, /*0xb8-0xbf*/ - 0xbca4, 0x9de1, 0xe5a5, 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, /*0xc0-0xc7*/ - 0x9de7, 0xe5a1, 0x9de8, 0x9de9, 0x9dea, 0x9deb, 0x9dec, 0x9ded, /*0xc8-0xcf*/ - 0x9dee, 0xe4fe, 0xb1f4, 0x9def, 0x9df0, 0x9df1, 0x9df2, 0x9df3, /*0xd0-0xd7*/ - 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0xe5a8, 0x9dfa, /*0xd8-0xdf*/ - 0xe5a9, 0xe5a6, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9e40, 0x9e41, /*0xe0-0xe7*/ - 0x9e42, 0x9e43, 0x9e44, 0x9e45, 0x9e46, 0x9e47, 0xe5a7, 0xe5aa, /*0xe8-0xef*/ - 0x9e48, 0x9e49, 0x9e4a, 0x9e4b, 0x9e4c, 0x9e4d, 0x9e4e, 0x9e4f, /*0xf0-0xf7*/ - 0x9e50, 0x9e51, 0x9e52, 0x9e53, 0x9e54, 0x9e55, 0x9e56, 0x9e57, /*0xf8-0xff*/ - /* 0x7000 */ - 0x9e58, 0x9e59, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5d, 0x9e5e, 0x9e5f, /*0x00-0x07*/ - 0x9e60, 0x9e61, 0x9e62, 0x9e63, 0x9e64, 0x9e65, 0x9e66, 0x9e67, /*0x08-0x0f*/ - 0x9e68, 0xc6d9, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e6d, 0x9e6e, /*0x10-0x17*/ - 0x9e6f, 0x9e70, 0xe5ab, 0xe5ad, 0x9e71, 0x9e72, 0x9e73, 0x9e74, /*0x18-0x1f*/ - 0x9e75, 0x9e76, 0x9e77, 0xe5ac, 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, /*0x20-0x27*/ - 0x9e7c, 0x9e7d, 0x9e7e, 0x9e80, 0x9e81, 0x9e82, 0x9e83, 0x9e84, /*0x28-0x2f*/ - 0x9e85, 0x9e86, 0x9e87, 0x9e88, 0x9e89, 0xe5af, 0x9e8a, 0x9e8b, /*0x30-0x37*/ - 0x9e8c, 0xe5ae, 0x9e8d, 0x9e8e, 0x9e8f, 0x9e90, 0x9e91, 0x9e92, /*0x38-0x3f*/ - 0x9e93, 0x9e94, 0x9e95, 0x9e96, 0x9e97, 0x9e98, 0x9e99, 0x9e9a, /*0x40-0x47*/ - 0x9e9b, 0x9e9c, 0x9e9d, 0x9e9e, 0xb9e0, 0x9e9f, 0x9ea0, 0xe5b0, /*0x48-0x4f*/ - 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea6, 0x9ea7, 0x9ea8, /*0x50-0x57*/ - 0x9ea9, 0x9eaa, 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0xe5b1, 0x9eaf, /*0x58-0x5f*/ - 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb4, 0x9eb5, 0x9eb6, 0x9eb7, /*0x60-0x67*/ - 0x9eb8, 0x9eb9, 0x9eba, 0xbbf0, 0xece1, 0xc3f0, 0x9ebb, 0xb5c6, /*0x68-0x6f*/ - 0xbbd2, 0x9ebc, 0x9ebd, 0x9ebe, 0x9ebf, 0xc1e9, 0xd4ee, 0x9ec0, /*0x70-0x77*/ - 0xbec4, 0x9ec1, 0x9ec2, 0x9ec3, 0xd7c6, 0x9ec4, 0xd4d6, 0xb2d3, /*0x78-0x7f*/ - 0xecbe, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0xeac1, 0x9ec9, 0x9eca, /*0x80-0x87*/ - 0x9ecb, 0xc2af, 0xb4b6, 0x9ecc, 0x9ecd, 0x9ece, 0xd1d7, 0x9ecf, /*0x88-0x8f*/ - 0x9ed0, 0x9ed1, 0xb3b4, 0x9ed2, 0xc8b2, 0xbfbb, 0xecc0, 0x9ed3, /*0x90-0x97*/ - 0x9ed4, 0xd6cb, 0x9ed5, 0x9ed6, 0xecbf, 0xecc1, 0x9ed7, 0x9ed8, /*0x98-0x9f*/ - 0x9ed9, 0x9eda, 0x9edb, 0x9edc, 0x9edd, 0x9ede, 0x9edf, 0x9ee0, /*0xa0-0xa7*/ - 0x9ee1, 0x9ee2, 0x9ee3, 0xecc5, 0xbee6, 0xccbf, 0xc5da, 0xbebc, /*0xa8-0xaf*/ - 0x9ee4, 0xecc6, 0x9ee5, 0xb1fe, 0x9ee6, 0x9ee7, 0x9ee8, 0xecc4, /*0xb0-0xb7*/ - 0xd5a8, 0xb5e3, 0x9ee9, 0xecc2, 0xc1b6, 0xb3e3, 0x9eea, 0x9eeb, /*0xb8-0xbf*/ - 0xecc3, 0xcbb8, 0xc0c3, 0xccfe, 0x9eec, 0x9eed, 0x9eee, 0x9eef, /*0xc0-0xc7*/ - 0xc1d2, 0x9ef0, 0xecc8, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, 0x9ef5, /*0xc8-0xcf*/ - 0x9ef6, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa, 0x9efb, 0x9efc, 0x9efd, /*0xd0-0xd7*/ - 0xbae6, 0xc0d3, 0x9efe, 0xd6f2, 0x9f40, 0x9f41, 0x9f42, 0xd1cc, /*0xd8-0xdf*/ - 0x9f43, 0x9f44, 0x9f45, 0x9f46, 0xbfbe, 0x9f47, 0xb7b3, 0xc9d5, /*0xe0-0xe7*/ - 0xecc7, 0xbbe2, 0x9f48, 0xcccc, 0xbdfd, 0xc8c8, 0x9f49, 0xcfa9, /*0xe8-0xef*/ - 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, 0x9f50, 0xcde9, /*0xf0-0xf7*/ - 0x9f51, 0xc5eb, 0x9f52, 0x9f53, 0x9f54, 0xb7e9, 0x9f55, 0x9f56, /*0xf8-0xff*/ - /* 0x7100 */ - 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, /*0x00-0x07*/ - 0x9f5f, 0xd1c9, 0xbab8, 0x9f60, 0x9f61, 0x9f62, 0x9f63, 0x9f64, /*0x08-0x0f*/ - 0xecc9, 0x9f65, 0x9f66, 0xecca, 0x9f67, 0xbbc0, 0xeccb, 0x9f68, /*0x10-0x17*/ - 0xece2, 0xb1ba, 0xb7d9, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, /*0x18-0x1f*/ - 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0xbdb9, 0x9f74, /*0x20-0x27*/ - 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0xeccc, /*0x28-0x2f*/ - 0xd1e6, 0xeccd, 0x9f7c, 0x9f7d, 0x9f7e, 0x9f80, 0xc8bb, 0x9f81, /*0x30-0x37*/ - 0x9f82, 0x9f83, 0x9f84, 0x9f85, 0x9f86, 0x9f87, 0x9f88, 0x9f89, /*0x38-0x3f*/ - 0x9f8a, 0x9f8b, 0x9f8c, 0x9f8d, 0x9f8e, 0xecd1, 0x9f8f, 0x9f90, /*0x40-0x47*/ - 0x9f91, 0x9f92, 0xecd3, 0x9f93, 0xbbcd, 0x9f94, 0xbce5, 0x9f95, /*0x48-0x4f*/ - 0x9f96, 0x9f97, 0x9f98, 0x9f99, 0x9f9a, 0x9f9b, 0x9f9c, 0x9f9d, /*0x50-0x57*/ - 0x9f9e, 0x9f9f, 0x9fa0, 0x9fa1, 0xeccf, 0x9fa2, 0xc9b7, 0x9fa3, /*0x58-0x5f*/ - 0x9fa4, 0x9fa5, 0x9fa6, 0x9fa7, 0xc3ba, 0x9fa8, 0xece3, 0xd5d5, /*0x60-0x67*/ - 0xecd0, 0x9fa9, 0x9faa, 0x9fab, 0x9fac, 0x9fad, 0xd6f3, 0x9fae, /*0x68-0x6f*/ - 0x9faf, 0x9fb0, 0xecd2, 0xecce, 0x9fb1, 0x9fb2, 0x9fb3, 0x9fb4, /*0x70-0x77*/ - 0xecd4, 0x9fb5, 0xecd5, 0x9fb6, 0x9fb7, 0xc9bf, 0x9fb8, 0x9fb9, /*0x78-0x7f*/ - 0x9fba, 0x9fbb, 0x9fbc, 0x9fbd, 0xcfa8, 0x9fbe, 0x9fbf, 0x9fc0, /*0x80-0x87*/ - 0x9fc1, 0x9fc2, 0xd0dc, 0x9fc3, 0x9fc4, 0x9fc5, 0x9fc6, 0xd1ac, /*0x88-0x8f*/ - 0x9fc7, 0x9fc8, 0x9fc9, 0x9fca, 0xc8db, 0x9fcb, 0x9fcc, 0x9fcd, /*0x90-0x97*/ - 0xecd6, 0xcef5, 0x9fce, 0x9fcf, 0x9fd0, 0x9fd1, 0x9fd2, 0xcaec, /*0x98-0x9f*/ - 0xecda, 0x9fd3, 0x9fd4, 0x9fd5, 0x9fd6, 0x9fd7, 0x9fd8, 0x9fd9, /*0xa0-0xa7*/ - 0xecd9, 0x9fda, 0x9fdb, 0x9fdc, 0xb0be, 0x9fdd, 0x9fde, 0x9fdf, /*0xa8-0xaf*/ - 0x9fe0, 0x9fe1, 0x9fe2, 0xecd7, 0x9fe3, 0xecd8, 0x9fe4, 0x9fe5, /*0xb0-0xb7*/ - 0x9fe6, 0xece4, 0x9fe7, 0x9fe8, 0x9fe9, 0x9fea, 0x9feb, 0x9fec, /*0xb8-0xbf*/ - 0x9fed, 0x9fee, 0x9fef, 0xc8bc, 0x9ff0, 0x9ff1, 0x9ff2, 0x9ff3, /*0xc0-0xc7*/ - 0x9ff4, 0x9ff5, 0x9ff6, 0x9ff7, 0x9ff8, 0x9ff9, 0xc1c7, 0x9ffa, /*0xc8-0xcf*/ - 0x9ffb, 0x9ffc, 0x9ffd, 0x9ffe, 0xecdc, 0xd1e0, 0xa040, 0xa041, /*0xd0-0xd7*/ - 0xa042, 0xa043, 0xa044, 0xa045, 0xa046, 0xa047, 0xa048, 0xa049, /*0xd8-0xdf*/ - 0xecdb, 0xa04a, 0xa04b, 0xa04c, 0xa04d, 0xd4ef, 0xa04e, 0xecdd, /*0xe0-0xe7*/ - 0xa04f, 0xa050, 0xa051, 0xa052, 0xa053, 0xa054, 0xdbc6, 0xa055, /*0xe8-0xef*/ - 0xa056, 0xa057, 0xa058, 0xa059, 0xa05a, 0xa05b, 0xa05c, 0xa05d, /*0xf0-0xf7*/ - 0xa05e, 0xecde, 0xa05f, 0xa060, 0xa061, 0xa062, 0xa063, 0xa064, /*0xf8-0xff*/ - /* 0x7200 */ - 0xa065, 0xa066, 0xa067, 0xa068, 0xa069, 0xa06a, 0xb1ac, 0xa06b, /*0x00-0x07*/ - 0xa06c, 0xa06d, 0xa06e, 0xa06f, 0xa070, 0xa071, 0xa072, 0xa073, /*0x08-0x0f*/ - 0xa074, 0xa075, 0xa076, 0xa077, 0xa078, 0xa079, 0xa07a, 0xa07b, /*0x10-0x17*/ - 0xa07c, 0xa07d, 0xa07e, 0xa080, 0xa081, 0xecdf, 0xa082, 0xa083, /*0x18-0x1f*/ - 0xa084, 0xa085, 0xa086, 0xa087, 0xa088, 0xa089, 0xa08a, 0xa08b, /*0x20-0x27*/ - 0xece0, 0xa08c, 0xd7a6, 0xa08d, 0xc5c0, 0xa08e, 0xa08f, 0xa090, /*0x28-0x2f*/ - 0xebbc, 0xb0ae, 0xa091, 0xa092, 0xa093, 0xbef4, 0xb8b8, 0xd2af, /*0x30-0x37*/ - 0xb0d6, 0xb5f9, 0xa094, 0xd8b3, 0xa095, 0xcbac, 0xa096, 0xe3dd, /*0x38-0x3f*/ - 0xa097, 0xa098, 0xa099, 0xa09a, 0xa09b, 0xa09c, 0xa09d, 0xc6ac, /*0x40-0x47*/ - 0xb0e6, 0xa09e, 0xa09f, 0xa0a0, 0xc5c6, 0xebb9, 0xa0a1, 0xa0a2, /*0x48-0x4f*/ - 0xa0a3, 0xa0a4, 0xebba, 0xa0a5, 0xa0a6, 0xa0a7, 0xebbb, 0xa0a8, /*0x50-0x57*/ - 0xa0a9, 0xd1c0, 0xa0aa, 0xc5a3, 0xa0ab, 0xeaf2, 0xa0ac, 0xc4b2, /*0x58-0x5f*/ - 0xa0ad, 0xc4b5, 0xc0ce, 0xa0ae, 0xa0af, 0xa0b0, 0xeaf3, 0xc4c1, /*0x60-0x67*/ - 0xa0b1, 0xceef, 0xa0b2, 0xa0b3, 0xa0b4, 0xa0b5, 0xeaf0, 0xeaf4, /*0x68-0x6f*/ - 0xa0b6, 0xa0b7, 0xc9fc, 0xa0b8, 0xa0b9, 0xc7a3, 0xa0ba, 0xa0bb, /*0x70-0x77*/ - 0xa0bc, 0xccd8, 0xcefe, 0xa0bd, 0xa0be, 0xa0bf, 0xeaf5, 0xeaf6, /*0x78-0x7f*/ - 0xcfac, 0xc0e7, 0xa0c0, 0xa0c1, 0xeaf7, 0xa0c2, 0xa0c3, 0xa0c4, /*0x80-0x87*/ - 0xa0c5, 0xa0c6, 0xb6bf, 0xeaf8, 0xa0c7, 0xeaf9, 0xa0c8, 0xeafa, /*0x88-0x8f*/ - 0xa0c9, 0xa0ca, 0xeafb, 0xa0cb, 0xa0cc, 0xa0cd, 0xa0ce, 0xa0cf, /*0x90-0x97*/ - 0xa0d0, 0xa0d1, 0xa0d2, 0xa0d3, 0xa0d4, 0xa0d5, 0xa0d6, 0xeaf1, /*0x98-0x9f*/ - 0xa0d7, 0xa0d8, 0xa0d9, 0xa0da, 0xa0db, 0xa0dc, 0xa0dd, 0xa0de, /*0xa0-0xa7*/ - 0xa0df, 0xa0e0, 0xa0e1, 0xa0e2, 0xc8ae, 0xe1eb, 0xa0e3, 0xb7b8, /*0xa8-0xaf*/ - 0xe1ec, 0xa0e4, 0xa0e5, 0xa0e6, 0xe1ed, 0xa0e7, 0xd7b4, 0xe1ee, /*0xb0-0xb7*/ - 0xe1ef, 0xd3cc, 0xa0e8, 0xa0e9, 0xa0ea, 0xa0eb, 0xa0ec, 0xa0ed, /*0xb8-0xbf*/ - 0xa0ee, 0xe1f1, 0xbff1, 0xe1f0, 0xb5d2, 0xa0ef, 0xa0f0, 0xa0f1, /*0xc0-0xc7*/ - 0xb1b7, 0xa0f2, 0xa0f3, 0xa0f4, 0xa0f5, 0xe1f3, 0xe1f2, 0xa0f6, /*0xc8-0xcf*/ - 0xbafc, 0xa0f7, 0xe1f4, 0xa0f8, 0xa0f9, 0xa0fa, 0xa0fb, 0xb9b7, /*0xd0-0xd7*/ - 0xa0fc, 0xbed1, 0xa0fd, 0xa0fe, 0xaa40, 0xaa41, 0xc4fc, 0xaa42, /*0xd8-0xdf*/ - 0xbadd, 0xbdc6, 0xaa43, 0xaa44, 0xaa45, 0xaa46, 0xaa47, 0xaa48, /*0xe0-0xe7*/ - 0xe1f5, 0xe1f7, 0xaa49, 0xaa4a, 0xb6c0, 0xcfc1, 0xcaa8, 0xe1f6, /*0xe8-0xef*/ - 0xd5f8, 0xd3fc, 0xe1f8, 0xe1fc, 0xe1f9, 0xaa4b, 0xaa4c, 0xe1fa, /*0xf0-0xf7*/ - 0xc0ea, 0xaa4d, 0xe1fe, 0xe2a1, 0xc0c7, 0xaa4e, 0xaa4f, 0xaa50, /*0xf8-0xff*/ - /* 0x7300 */ - 0xaa51, 0xe1fb, 0xaa52, 0xe1fd, 0xaa53, 0xaa54, 0xaa55, 0xaa56, /*0x00-0x07*/ - 0xaa57, 0xaa58, 0xe2a5, 0xaa59, 0xaa5a, 0xaa5b, 0xc1d4, 0xaa5c, /*0x08-0x0f*/ - 0xaa5d, 0xaa5e, 0xaa5f, 0xe2a3, 0xaa60, 0xe2a8, 0xb2fe, 0xe2a2, /*0x10-0x17*/ - 0xaa61, 0xaa62, 0xaa63, 0xc3cd, 0xb2c2, 0xe2a7, 0xe2a6, 0xaa64, /*0x18-0x1f*/ - 0xaa65, 0xe2a4, 0xe2a9, 0xaa66, 0xaa67, 0xe2ab, 0xaa68, 0xaa69, /*0x20-0x27*/ - 0xaa6a, 0xd0c9, 0xd6ed, 0xc3a8, 0xe2ac, 0xaa6b, 0xcfd7, 0xaa6c, /*0x28-0x2f*/ - 0xaa6d, 0xe2ae, 0xaa6e, 0xaa6f, 0xbaef, 0xaa70, 0xaa71, 0xe9e0, /*0x30-0x37*/ - 0xe2ad, 0xe2aa, 0xaa72, 0xaa73, 0xaa74, 0xaa75, 0xbbab, 0xd4b3, /*0x38-0x3f*/ - 0xaa76, 0xaa77, 0xaa78, 0xaa79, 0xaa7a, 0xaa7b, 0xaa7c, 0xaa7d, /*0x40-0x47*/ - 0xaa7e, 0xaa80, 0xaa81, 0xaa82, 0xaa83, 0xe2b0, 0xaa84, 0xaa85, /*0x48-0x4f*/ - 0xe2af, 0xaa86, 0xe9e1, 0xaa87, 0xaa88, 0xaa89, 0xaa8a, 0xe2b1, /*0x50-0x57*/ - 0xaa8b, 0xaa8c, 0xaa8d, 0xaa8e, 0xaa8f, 0xaa90, 0xaa91, 0xaa92, /*0x58-0x5f*/ - 0xe2b2, 0xaa93, 0xaa94, 0xaa95, 0xaa96, 0xaa97, 0xaa98, 0xaa99, /*0x60-0x67*/ - 0xaa9a, 0xaa9b, 0xaa9c, 0xaa9d, 0xe2b3, 0xcca1, 0xaa9e, 0xe2b4, /*0x68-0x6f*/ - 0xaa9f, 0xaaa0, 0xab40, 0xab41, 0xab42, 0xab43, 0xab44, 0xab45, /*0x70-0x77*/ - 0xab46, 0xab47, 0xab48, 0xab49, 0xab4a, 0xab4b, 0xe2b5, 0xab4c, /*0x78-0x7f*/ - 0xab4d, 0xab4e, 0xab4f, 0xab50, 0xd0fe, 0xab51, 0xab52, 0xc2ca, /*0x80-0x87*/ - 0xab53, 0xd3f1, 0xab54, 0xcdf5, 0xab55, 0xab56, 0xe7e0, 0xab57, /*0x88-0x8f*/ - 0xab58, 0xe7e1, 0xab59, 0xab5a, 0xab5b, 0xab5c, 0xbec1, 0xab5d, /*0x90-0x97*/ - 0xab5e, 0xab5f, 0xab60, 0xc2ea, 0xab61, 0xab62, 0xab63, 0xe7e4, /*0x98-0x9f*/ - 0xab64, 0xab65, 0xe7e3, 0xab66, 0xab67, 0xab68, 0xab69, 0xab6a, /*0xa0-0xa7*/ - 0xab6b, 0xcde6, 0xab6c, 0xc3b5, 0xab6d, 0xab6e, 0xe7e2, 0xbbb7, /*0xa8-0xaf*/ - 0xcfd6, 0xab6f, 0xc1e1, 0xe7e9, 0xab70, 0xab71, 0xab72, 0xe7e8, /*0xb0-0xb7*/ - 0xab73, 0xab74, 0xe7f4, 0xb2a3, 0xab75, 0xab76, 0xab77, 0xab78, /*0xb8-0xbf*/ - 0xe7ea, 0xab79, 0xe7e6, 0xab7a, 0xab7b, 0xab7c, 0xab7d, 0xab7e, /*0xc0-0xc7*/ - 0xe7ec, 0xe7eb, 0xc9ba, 0xab80, 0xab81, 0xd5e4, 0xab82, 0xe7e5, /*0xc8-0xcf*/ - 0xb7a9, 0xe7e7, 0xab83, 0xab84, 0xab85, 0xab86, 0xab87, 0xab88, /*0xd0-0xd7*/ - 0xab89, 0xe7ee, 0xab8a, 0xab8b, 0xab8c, 0xab8d, 0xe7f3, 0xab8e, /*0xd8-0xdf*/ - 0xd6e9, 0xab8f, 0xab90, 0xab91, 0xab92, 0xe7ed, 0xab93, 0xe7f2, /*0xe0-0xe7*/ - 0xab94, 0xe7f1, 0xab95, 0xab96, 0xab97, 0xb0e0, 0xab98, 0xab99, /*0xe8-0xef*/ - 0xab9a, 0xab9b, 0xe7f5, 0xab9c, 0xab9d, 0xab9e, 0xab9f, 0xaba0, /*0xf0-0xf7*/ - 0xac40, 0xac41, 0xac42, 0xac43, 0xac44, 0xac45, 0xac46, 0xac47, /*0xf8-0xff*/ - /* 0x7400 */ - 0xac48, 0xac49, 0xac4a, 0xc7f2, 0xac4b, 0xc0c5, 0xc0ed, 0xac4c, /*0x00-0x07*/ - 0xac4d, 0xc1f0, 0xe7f0, 0xac4e, 0xac4f, 0xac50, 0xac51, 0xe7f6, /*0x08-0x0f*/ - 0xcbf6, 0xac52, 0xac53, 0xac54, 0xac55, 0xac56, 0xac57, 0xac58, /*0x10-0x17*/ - 0xac59, 0xac5a, 0xe8a2, 0xe8a1, 0xac5b, 0xac5c, 0xac5d, 0xac5e, /*0x18-0x1f*/ - 0xac5f, 0xac60, 0xd7c1, 0xac61, 0xac62, 0xe7fa, 0xe7f9, 0xac63, /*0x20-0x27*/ - 0xe7fb, 0xac64, 0xe7f7, 0xac65, 0xe7fe, 0xac66, 0xe7fd, 0xac67, /*0x28-0x2f*/ - 0xe7fc, 0xac68, 0xac69, 0xc1d5, 0xc7d9, 0xc5fd, 0xc5c3, 0xac6a, /*0x30-0x37*/ - 0xac6b, 0xac6c, 0xac6d, 0xac6e, 0xc7ed, 0xac6f, 0xac70, 0xac71, /*0x38-0x3f*/ - 0xac72, 0xe8a3, 0xac73, 0xac74, 0xac75, 0xac76, 0xac77, 0xac78, /*0x40-0x47*/ - 0xac79, 0xac7a, 0xac7b, 0xac7c, 0xac7d, 0xac7e, 0xac80, 0xac81, /*0x48-0x4f*/ - 0xac82, 0xac83, 0xac84, 0xac85, 0xac86, 0xe8a6, 0xac87, 0xe8a5, /*0x50-0x57*/ - 0xac88, 0xe8a7, 0xbaf7, 0xe7f8, 0xe8a4, 0xac89, 0xc8f0, 0xc9aa, /*0x58-0x5f*/ - 0xac8a, 0xac8b, 0xac8c, 0xac8d, 0xac8e, 0xac8f, 0xac90, 0xac91, /*0x60-0x67*/ - 0xac92, 0xac93, 0xac94, 0xac95, 0xac96, 0xe8a9, 0xac97, 0xac98, /*0x68-0x6f*/ - 0xb9e5, 0xac99, 0xac9a, 0xac9b, 0xac9c, 0xac9d, 0xd1fe, 0xe8a8, /*0x70-0x77*/ - 0xac9e, 0xac9f, 0xaca0, 0xad40, 0xad41, 0xad42, 0xe8aa, 0xad43, /*0x78-0x7f*/ - 0xe8ad, 0xe8ae, 0xad44, 0xc1a7, 0xad45, 0xad46, 0xad47, 0xe8af, /*0x80-0x87*/ - 0xad48, 0xad49, 0xad4a, 0xe8b0, 0xad4b, 0xad4c, 0xe8ac, 0xad4d, /*0x88-0x8f*/ - 0xe8b4, 0xad4e, 0xad4f, 0xad50, 0xad51, 0xad52, 0xad53, 0xad54, /*0x90-0x97*/ - 0xad55, 0xad56, 0xad57, 0xad58, 0xe8ab, 0xad59, 0xe8b1, 0xad5a, /*0x98-0x9f*/ - 0xad5b, 0xad5c, 0xad5d, 0xad5e, 0xad5f, 0xad60, 0xad61, 0xe8b5, /*0xa0-0xa7*/ - 0xe8b2, 0xe8b3, 0xad62, 0xad63, 0xad64, 0xad65, 0xad66, 0xad67, /*0xa8-0xaf*/ - 0xad68, 0xad69, 0xad6a, 0xad6b, 0xad6c, 0xad6d, 0xad6e, 0xad6f, /*0xb0-0xb7*/ - 0xad70, 0xad71, 0xe8b7, 0xad72, 0xad73, 0xad74, 0xad75, 0xad76, /*0xb8-0xbf*/ - 0xad77, 0xad78, 0xad79, 0xad7a, 0xad7b, 0xad7c, 0xad7d, 0xad7e, /*0xc0-0xc7*/ - 0xad80, 0xad81, 0xad82, 0xad83, 0xad84, 0xad85, 0xad86, 0xad87, /*0xc8-0xcf*/ - 0xad88, 0xad89, 0xe8b6, 0xad8a, 0xad8b, 0xad8c, 0xad8d, 0xad8e, /*0xd0-0xd7*/ - 0xad8f, 0xad90, 0xad91, 0xad92, 0xb9cf, 0xad93, 0xf0ac, 0xad94, /*0xd8-0xdf*/ - 0xf0ad, 0xad95, 0xc6b0, 0xb0ea, 0xc8bf, 0xad96, 0xcddf, 0xad97, /*0xe0-0xe7*/ - 0xad98, 0xad99, 0xad9a, 0xad9b, 0xad9c, 0xad9d, 0xcecd, 0xeab1, /*0xe8-0xef*/ - 0xad9e, 0xad9f, 0xada0, 0xae40, 0xeab2, 0xae41, 0xc6bf, 0xb4c9, /*0xf0-0xf7*/ - 0xae42, 0xae43, 0xae44, 0xae45, 0xae46, 0xae47, 0xae48, 0xeab3, /*0xf8-0xff*/ - /* 0x7500 */ - 0xae49, 0xae4a, 0xae4b, 0xae4c, 0xd5e7, 0xae4d, 0xae4e, 0xae4f, /*0x00-0x07*/ - 0xae50, 0xae51, 0xae52, 0xae53, 0xae54, 0xddf9, 0xae55, 0xeab4, /*0x08-0x0f*/ - 0xae56, 0xeab5, 0xae57, 0xeab6, 0xae58, 0xae59, 0xae5a, 0xae5b, /*0x10-0x17*/ - 0xb8ca, 0xdfb0, 0xc9f5, 0xae5c, 0xccf0, 0xae5d, 0xae5e, 0xc9fa, /*0x18-0x1f*/ - 0xae5f, 0xae60, 0xae61, 0xae62, 0xae63, 0xc9fb, 0xae64, 0xae65, /*0x20-0x27*/ - 0xd3c3, 0xcba6, 0xae66, 0xb8a6, 0xf0ae, 0xb1c2, 0xae67, 0xe5b8, /*0x28-0x2f*/ - 0xccef, 0xd3c9, 0xbcd7, 0xc9ea, 0xae68, 0xb5e7, 0xae69, 0xc4d0, /*0x30-0x37*/ - 0xb5e9, 0xae6a, 0xeeae, 0xbbad, 0xae6b, 0xae6c, 0xe7de, 0xae6d, /*0x38-0x3f*/ - 0xeeaf, 0xae6e, 0xae6f, 0xae70, 0xae71, 0xb3a9, 0xae72, 0xae73, /*0x40-0x47*/ - 0xeeb2, 0xae74, 0xae75, 0xeeb1, 0xbde7, 0xae76, 0xeeb0, 0xceb7, /*0x48-0x4f*/ - 0xae77, 0xae78, 0xae79, 0xae7a, 0xc5cf, 0xae7b, 0xae7c, 0xae7d, /*0x50-0x57*/ - 0xae7e, 0xc1f4, 0xdbce, 0xeeb3, 0xd0f3, 0xae80, 0xae81, 0xae82, /*0x58-0x5f*/ - 0xae83, 0xae84, 0xae85, 0xae86, 0xae87, 0xc2d4, 0xc6e8, 0xae88, /*0x60-0x67*/ - 0xae89, 0xae8a, 0xb7ac, 0xae8b, 0xae8c, 0xae8d, 0xae8e, 0xae8f, /*0x68-0x6f*/ - 0xae90, 0xae91, 0xeeb4, 0xae92, 0xb3eb, 0xae93, 0xae94, 0xae95, /*0x70-0x77*/ - 0xbbfb, 0xeeb5, 0xae96, 0xae97, 0xae98, 0xae99, 0xae9a, 0xe7dc, /*0x78-0x7f*/ - 0xae9b, 0xae9c, 0xae9d, 0xeeb6, 0xae9e, 0xae9f, 0xbdae, 0xaea0, /*0x80-0x87*/ - 0xaf40, 0xaf41, 0xaf42, 0xf1e2, 0xaf43, 0xaf44, 0xaf45, 0xcae8, /*0x88-0x8f*/ - 0xaf46, 0xd2c9, 0xf0da, 0xaf47, 0xf0db, 0xaf48, 0xf0dc, 0xc1c6, /*0x90-0x97*/ - 0xaf49, 0xb8ed, 0xbece, 0xaf4a, 0xaf4b, 0xf0de, 0xaf4c, 0xc5b1, /*0x98-0x9f*/ - 0xf0dd, 0xd1f1, 0xaf4d, 0xf0e0, 0xb0cc, 0xbdea, 0xaf4e, 0xaf4f, /*0xa0-0xa7*/ - 0xaf50, 0xaf51, 0xaf52, 0xd2df, 0xf0df, 0xaf53, 0xb4af, 0xb7e8, /*0xa8-0xaf*/ - 0xf0e6, 0xf0e5, 0xc6a3, 0xf0e1, 0xf0e2, 0xb4c3, 0xaf54, 0xaf55, /*0xb0-0xb7*/ - 0xf0e3, 0xd5ee, 0xaf56, 0xaf57, 0xccdb, 0xbed2, 0xbcb2, 0xaf58, /*0xb8-0xbf*/ - 0xaf59, 0xaf5a, 0xf0e8, 0xf0e7, 0xf0e4, 0xb2a1, 0xaf5b, 0xd6a2, /*0xc0-0xc7*/ - 0xd3b8, 0xbeb7, 0xc8ac, 0xaf5c, 0xaf5d, 0xf0ea, 0xaf5e, 0xaf5f, /*0xc8-0xcf*/ - 0xaf60, 0xaf61, 0xd1f7, 0xaf62, 0xd6cc, 0xbadb, 0xf0e9, 0xaf63, /*0xd0-0xd7*/ - 0xb6bb, 0xaf64, 0xaf65, 0xcdb4, 0xaf66, 0xaf67, 0xc6a6, 0xaf68, /*0xd8-0xdf*/ - 0xaf69, 0xaf6a, 0xc1a1, 0xf0eb, 0xf0ee, 0xaf6b, 0xf0ed, 0xf0f0, /*0xe0-0xe7*/ - 0xf0ec, 0xaf6c, 0xbbbe, 0xf0ef, 0xaf6d, 0xaf6e, 0xaf6f, 0xaf70, /*0xe8-0xef*/ - 0xccb5, 0xf0f2, 0xaf71, 0xaf72, 0xb3d5, 0xaf73, 0xaf74, 0xaf75, /*0xf0-0xf7*/ - 0xaf76, 0xb1d4, 0xaf77, 0xaf78, 0xf0f3, 0xaf79, 0xaf7a, 0xf0f4, /*0xf8-0xff*/ - /* 0x7600 */ - 0xf0f6, 0xb4e1, 0xaf7b, 0xf0f1, 0xaf7c, 0xf0f7, 0xaf7d, 0xaf7e, /*0x00-0x07*/ - 0xaf80, 0xaf81, 0xf0fa, 0xaf82, 0xf0f8, 0xaf83, 0xaf84, 0xaf85, /*0x08-0x0f*/ - 0xf0f5, 0xaf86, 0xaf87, 0xaf88, 0xaf89, 0xf0fd, 0xaf8a, 0xf0f9, /*0x10-0x17*/ - 0xf0fc, 0xf0fe, 0xaf8b, 0xf1a1, 0xaf8c, 0xaf8d, 0xaf8e, 0xcec1, /*0x18-0x1f*/ - 0xf1a4, 0xaf8f, 0xf1a3, 0xaf90, 0xc1f6, 0xf0fb, 0xcadd, 0xaf91, /*0x20-0x27*/ - 0xaf92, 0xb4f1, 0xb1f1, 0xccb1, 0xaf93, 0xf1a6, 0xaf94, 0xaf95, /*0x28-0x2f*/ - 0xf1a7, 0xaf96, 0xaf97, 0xf1ac, 0xd5ce, 0xf1a9, 0xaf98, 0xaf99, /*0x30-0x37*/ - 0xc8b3, 0xaf9a, 0xaf9b, 0xaf9c, 0xf1a2, 0xaf9d, 0xf1ab, 0xf1a8, /*0x38-0x3f*/ - 0xf1a5, 0xaf9e, 0xaf9f, 0xf1aa, 0xafa0, 0xb040, 0xb041, 0xb042, /*0x40-0x47*/ - 0xb043, 0xb044, 0xb045, 0xb046, 0xb0a9, 0xf1ad, 0xb047, 0xb048, /*0x48-0x4f*/ - 0xb049, 0xb04a, 0xb04b, 0xb04c, 0xf1af, 0xb04d, 0xf1b1, 0xb04e, /*0x50-0x57*/ - 0xb04f, 0xb050, 0xb051, 0xb052, 0xf1b0, 0xb053, 0xf1ae, 0xb054, /*0x58-0x5f*/ - 0xb055, 0xb056, 0xb057, 0xd1a2, 0xb058, 0xb059, 0xb05a, 0xb05b, /*0x60-0x67*/ - 0xb05c, 0xb05d, 0xb05e, 0xf1b2, 0xb05f, 0xb060, 0xb061, 0xf1b3, /*0x68-0x6f*/ - 0xb062, 0xb063, 0xb064, 0xb065, 0xb066, 0xb067, 0xb068, 0xb069, /*0x70-0x77*/ - 0xb9ef, 0xb06a, 0xb06b, 0xb5c7, 0xb06c, 0xb0d7, 0xb0d9, 0xb06d, /*0x78-0x7f*/ - 0xb06e, 0xb06f, 0xd4ed, 0xb070, 0xb5c4, 0xb071, 0xbdd4, 0xbbca, /*0x80-0x87*/ - 0xf0a7, 0xb072, 0xb073, 0xb8de, 0xb074, 0xb075, 0xf0a8, 0xb076, /*0x88-0x8f*/ - 0xb077, 0xb0a8, 0xb078, 0xf0a9, 0xb079, 0xb07a, 0xcdee, 0xb07b, /*0x90-0x97*/ - 0xb07c, 0xf0aa, 0xb07d, 0xb07e, 0xb080, 0xb081, 0xb082, 0xb083, /*0x98-0x9f*/ - 0xb084, 0xb085, 0xb086, 0xb087, 0xf0ab, 0xb088, 0xb089, 0xb08a, /*0xa0-0xa7*/ - 0xb08b, 0xb08c, 0xb08d, 0xb08e, 0xb08f, 0xb090, 0xc6a4, 0xb091, /*0xa8-0xaf*/ - 0xb092, 0xd6e5, 0xf1e4, 0xb093, 0xf1e5, 0xb094, 0xb095, 0xb096, /*0xb0-0xb7*/ - 0xb097, 0xb098, 0xb099, 0xb09a, 0xb09b, 0xb09c, 0xb09d, 0xc3f3, /*0xb8-0xbf*/ - 0xb09e, 0xb09f, 0xd3db, 0xb0a0, 0xb140, 0xd6d1, 0xc5e8, 0xb141, /*0xc0-0xc7*/ - 0xd3af, 0xb142, 0xd2e6, 0xb143, 0xb144, 0xeec1, 0xb0bb, 0xd5b5, /*0xc8-0xcf*/ - 0xd1ce, 0xbce0, 0xbad0, 0xb145, 0xbff8, 0xb146, 0xb8c7, 0xb5c1, /*0xd0-0xd7*/ - 0xc5cc, 0xb147, 0xb148, 0xcaa2, 0xb149, 0xb14a, 0xb14b, 0xc3cb, /*0xd8-0xdf*/ - 0xb14c, 0xb14d, 0xb14e, 0xb14f, 0xb150, 0xeec2, 0xb151, 0xb152, /*0xe0-0xe7*/ - 0xb153, 0xb154, 0xb155, 0xb156, 0xb157, 0xb158, 0xc4bf, 0xb6a2, /*0xe8-0xef*/ - 0xb159, 0xedec, 0xc3a4, 0xb15a, 0xd6b1, 0xb15b, 0xb15c, 0xb15d, /*0xf0-0xf7*/ - 0xcfe0, 0xedef, 0xb15e, 0xb15f, 0xc5ce, 0xb160, 0xb6dc, 0xb161, /*0xf8-0xff*/ - /* 0x7700 */ - 0xb162, 0xcaa1, 0xb163, 0xb164, 0xeded, 0xb165, 0xb166, 0xedf0, /*0x00-0x07*/ - 0xedf1, 0xc3bc, 0xb167, 0xbfb4, 0xb168, 0xedee, 0xb169, 0xb16a, /*0x08-0x0f*/ - 0xb16b, 0xb16c, 0xb16d, 0xb16e, 0xb16f, 0xb170, 0xb171, 0xb172, /*0x10-0x17*/ - 0xb173, 0xedf4, 0xedf2, 0xb174, 0xb175, 0xb176, 0xb177, 0xd5e6, /*0x18-0x1f*/ - 0xc3df, 0xb178, 0xedf3, 0xb179, 0xb17a, 0xb17b, 0xedf6, 0xb17c, /*0x20-0x27*/ - 0xd5a3, 0xd1a3, 0xb17d, 0xb17e, 0xb180, 0xedf5, 0xb181, 0xc3d0, /*0x28-0x2f*/ - 0xb182, 0xb183, 0xb184, 0xb185, 0xb186, 0xedf7, 0xbff4, 0xbeec, /*0x30-0x37*/ - 0xedf8, 0xb187, 0xccf7, 0xb188, 0xd1db, 0xb189, 0xb18a, 0xb18b, /*0x38-0x3f*/ - 0xd7c5, 0xd5f6, 0xb18c, 0xedfc, 0xb18d, 0xb18e, 0xb18f, 0xedfb, /*0x40-0x47*/ - 0xb190, 0xb191, 0xb192, 0xb193, 0xb194, 0xb195, 0xb196, 0xb197, /*0x48-0x4f*/ - 0xedf9, 0xedfa, 0xb198, 0xb199, 0xb19a, 0xb19b, 0xb19c, 0xb19d, /*0x50-0x57*/ - 0xb19e, 0xb19f, 0xedfd, 0xbea6, 0xb1a0, 0xb240, 0xb241, 0xb242, /*0x58-0x5f*/ - 0xb243, 0xcbaf, 0xeea1, 0xb6bd, 0xb244, 0xeea2, 0xc4c0, 0xb245, /*0x60-0x67*/ - 0xedfe, 0xb246, 0xb247, 0xbdde, 0xb2c7, 0xb248, 0xb249, 0xb24a, /*0x68-0x6f*/ - 0xb24b, 0xb24c, 0xb24d, 0xb24e, 0xb24f, 0xb250, 0xb251, 0xb252, /*0x70-0x77*/ - 0xb253, 0xb6c3, 0xb254, 0xb255, 0xb256, 0xeea5, 0xd8ba, 0xeea3, /*0x78-0x7f*/ - 0xeea6, 0xb257, 0xb258, 0xb259, 0xc3e9, 0xb3f2, 0xb25a, 0xb25b, /*0x80-0x87*/ - 0xb25c, 0xb25d, 0xb25e, 0xb25f, 0xeea7, 0xeea4, 0xcfb9, 0xb260, /*0x88-0x8f*/ - 0xb261, 0xeea8, 0xc2f7, 0xb262, 0xb263, 0xb264, 0xb265, 0xb266, /*0x90-0x97*/ - 0xb267, 0xb268, 0xb269, 0xb26a, 0xb26b, 0xb26c, 0xb26d, 0xeea9, /*0x98-0x9f*/ - 0xeeaa, 0xb26e, 0xdeab, 0xb26f, 0xb270, 0xc6b3, 0xb271, 0xc7c6, /*0xa0-0xa7*/ - 0xb272, 0xd6f5, 0xb5c9, 0xb273, 0xcbb2, 0xb274, 0xb275, 0xb276, /*0xa8-0xaf*/ - 0xeeab, 0xb277, 0xb278, 0xcdab, 0xb279, 0xeeac, 0xb27a, 0xb27b, /*0xb0-0xb7*/ - 0xb27c, 0xb27d, 0xb27e, 0xd5b0, 0xb280, 0xeead, 0xb281, 0xf6c4, /*0xb8-0xbf*/ - 0xb282, 0xb283, 0xb284, 0xb285, 0xb286, 0xb287, 0xb288, 0xb289, /*0xc0-0xc7*/ - 0xb28a, 0xb28b, 0xb28c, 0xb28d, 0xb28e, 0xdbc7, 0xb28f, 0xb290, /*0xc8-0xcf*/ - 0xb291, 0xb292, 0xb293, 0xb294, 0xb295, 0xb296, 0xb297, 0xb4a3, /*0xd0-0xd7*/ - 0xb298, 0xb299, 0xb29a, 0xc3ac, 0xf1e6, 0xb29b, 0xb29c, 0xb29d, /*0xd8-0xdf*/ - 0xb29e, 0xb29f, 0xcab8, 0xd2d3, 0xb2a0, 0xd6aa, 0xb340, 0xeff2, /*0xe0-0xe7*/ - 0xb341, 0xbed8, 0xb342, 0xbdc3, 0xeff3, 0xb6cc, 0xb0ab, 0xb343, /*0xe8-0xef*/ - 0xb344, 0xb345, 0xb346, 0xcaaf, 0xb347, 0xb348, 0xedb6, 0xb349, /*0xf0-0xf7*/ - 0xedb7, 0xb34a, 0xb34b, 0xb34c, 0xb34d, 0xcef9, 0xb7af, 0xbff3, /*0xf8-0xff*/ - /* 0x7800 */ - 0xedb8, 0xc2eb, 0xc9b0, 0xb34e, 0xb34f, 0xb350, 0xb351, 0xb352, /*0x00-0x07*/ - 0xb353, 0xedb9, 0xb354, 0xb355, 0xc6f6, 0xbfb3, 0xb356, 0xb357, /*0x08-0x0f*/ - 0xb358, 0xedbc, 0xc5f8, 0xb359, 0xd1d0, 0xb35a, 0xd7a9, 0xedba, /*0x10-0x17*/ - 0xedbb, 0xb35b, 0xd1e2, 0xb35c, 0xedbf, 0xedc0, 0xb35d, 0xedc4, /*0x18-0x1f*/ - 0xb35e, 0xb35f, 0xb360, 0xedc8, 0xb361, 0xedc6, 0xedce, 0xd5e8, /*0x20-0x27*/ - 0xb362, 0xedc9, 0xb363, 0xb364, 0xedc7, 0xedbe, 0xb365, 0xb366, /*0x28-0x2f*/ - 0xc5e9, 0xb367, 0xb368, 0xb369, 0xc6c6, 0xb36a, 0xb36b, 0xc9e9, /*0x30-0x37*/ - 0xd4d2, 0xedc1, 0xedc2, 0xedc3, 0xedc5, 0xb36c, 0xc0f9, 0xb36d, /*0x38-0x3f*/ - 0xb4a1, 0xb36e, 0xb36f, 0xb370, 0xb371, 0xb9e8, 0xb372, 0xedd0, /*0x40-0x47*/ - 0xb373, 0xb374, 0xb375, 0xb376, 0xedd1, 0xb377, 0xedca, 0xb378, /*0x48-0x4f*/ - 0xedcf, 0xb379, 0xcef8, 0xb37a, 0xb37b, 0xcbb6, 0xedcc, 0xedcd, /*0x50-0x57*/ - 0xb37c, 0xb37d, 0xb37e, 0xb380, 0xb381, 0xcff5, 0xb382, 0xb383, /*0x58-0x5f*/ - 0xb384, 0xb385, 0xb386, 0xb387, 0xb388, 0xb389, 0xb38a, 0xb38b, /*0x60-0x67*/ - 0xb38c, 0xb38d, 0xedd2, 0xc1f2, 0xd3b2, 0xedcb, 0xc8b7, 0xb38e, /*0x68-0x6f*/ - 0xb38f, 0xb390, 0xb391, 0xb392, 0xb393, 0xb394, 0xb395, 0xbcef, /*0x70-0x77*/ - 0xb396, 0xb397, 0xb398, 0xb399, 0xc5f0, 0xb39a, 0xb39b, 0xb39c, /*0x78-0x7f*/ - 0xb39d, 0xb39e, 0xb39f, 0xb3a0, 0xb440, 0xb441, 0xb442, 0xedd6, /*0x80-0x87*/ - 0xb443, 0xb5ef, 0xb444, 0xb445, 0xc2b5, 0xb0ad, 0xcbe9, 0xb446, /*0x88-0x8f*/ - 0xb447, 0xb1ae, 0xb448, 0xedd4, 0xb449, 0xb44a, 0xb44b, 0xcdeb, /*0x90-0x97*/ - 0xb5e2, 0xb44c, 0xedd5, 0xedd3, 0xedd7, 0xb44d, 0xb44e, 0xb5fa, /*0x98-0x9f*/ - 0xb44f, 0xedd8, 0xb450, 0xedd9, 0xb451, 0xeddc, 0xb452, 0xb1cc, /*0xa0-0xa7*/ - 0xb453, 0xb454, 0xb455, 0xb456, 0xb457, 0xb458, 0xb459, 0xb45a, /*0xa8-0xaf*/ - 0xc5f6, 0xbcee, 0xedda, 0xccbc, 0xb2ea, 0xb45b, 0xb45c, 0xb45d, /*0xb0-0xb7*/ - 0xb45e, 0xeddb, 0xb45f, 0xb460, 0xb461, 0xb462, 0xc4eb, 0xb463, /*0xb8-0xbf*/ - 0xb464, 0xb4c5, 0xb465, 0xb466, 0xb467, 0xb0f5, 0xb468, 0xb469, /*0xc0-0xc7*/ - 0xb46a, 0xeddf, 0xc0da, 0xb4e8, 0xb46b, 0xb46c, 0xb46d, 0xb46e, /*0xc8-0xcf*/ - 0xc5cd, 0xb46f, 0xb470, 0xb471, 0xeddd, 0xbfc4, 0xb472, 0xb473, /*0xd0-0xd7*/ - 0xb474, 0xedde, 0xb475, 0xb476, 0xb477, 0xb478, 0xb479, 0xb47a, /*0xd8-0xdf*/ - 0xb47b, 0xb47c, 0xb47d, 0xb47e, 0xb480, 0xb481, 0xb482, 0xb483, /*0xe0-0xe7*/ - 0xc4a5, 0xb484, 0xb485, 0xb486, 0xede0, 0xb487, 0xb488, 0xb489, /*0xe8-0xef*/ - 0xb48a, 0xb48b, 0xede1, 0xb48c, 0xede3, 0xb48d, 0xb48e, 0xc1d7, /*0xf0-0xf7*/ - 0xb48f, 0xb490, 0xbbc7, 0xb491, 0xb492, 0xb493, 0xb494, 0xb495, /*0xf8-0xff*/ - /* 0x7900 */ - 0xb496, 0xbdb8, 0xb497, 0xb498, 0xb499, 0xede2, 0xb49a, 0xb49b, /*0x00-0x07*/ - 0xb49c, 0xb49d, 0xb49e, 0xb49f, 0xb4a0, 0xb540, 0xb541, 0xb542, /*0x08-0x0f*/ - 0xb543, 0xb544, 0xb545, 0xede4, 0xb546, 0xb547, 0xb548, 0xb549, /*0x10-0x17*/ - 0xb54a, 0xb54b, 0xb54c, 0xb54d, 0xb54e, 0xb54f, 0xede6, 0xb550, /*0x18-0x1f*/ - 0xb551, 0xb552, 0xb553, 0xb554, 0xede5, 0xb555, 0xb556, 0xb557, /*0x20-0x27*/ - 0xb558, 0xb559, 0xb55a, 0xb55b, 0xb55c, 0xb55d, 0xb55e, 0xb55f, /*0x28-0x2f*/ - 0xb560, 0xb561, 0xb562, 0xb563, 0xede7, 0xb564, 0xb565, 0xb566, /*0x30-0x37*/ - 0xb567, 0xb568, 0xcabe, 0xecea, 0xc0f1, 0xb569, 0xc9e7, 0xb56a, /*0x38-0x3f*/ - 0xeceb, 0xc6ee, 0xb56b, 0xb56c, 0xb56d, 0xb56e, 0xecec, 0xb56f, /*0x40-0x47*/ - 0xc6ed, 0xeced, 0xb570, 0xb571, 0xb572, 0xb573, 0xb574, 0xb575, /*0x48-0x4f*/ - 0xb576, 0xb577, 0xb578, 0xecf0, 0xb579, 0xb57a, 0xd7e6, 0xecf3, /*0x50-0x57*/ - 0xb57b, 0xb57c, 0xecf1, 0xecee, 0xecef, 0xd7a3, 0xc9f1, 0xcbee, /*0x58-0x5f*/ - 0xecf4, 0xb57d, 0xecf2, 0xb57e, 0xb580, 0xcfe9, 0xb581, 0xecf6, /*0x60-0x67*/ - 0xc6b1, 0xb582, 0xb583, 0xb584, 0xb585, 0xbcc0, 0xb586, 0xecf5, /*0x68-0x6f*/ - 0xb587, 0xb588, 0xb589, 0xb58a, 0xb58b, 0xb58c, 0xb58d, 0xb5bb, /*0x70-0x77*/ - 0xbbf6, 0xb58e, 0xecf7, 0xb58f, 0xb590, 0xb591, 0xb592, 0xb593, /*0x78-0x7f*/ - 0xd9f7, 0xbdfb, 0xb594, 0xb595, 0xc2bb, 0xecf8, 0xb596, 0xb597, /*0x80-0x87*/ - 0xb598, 0xb599, 0xecf9, 0xb59a, 0xb59b, 0xb59c, 0xb59d, 0xb8a3, /*0x88-0x8f*/ - 0xb59e, 0xb59f, 0xb5a0, 0xb640, 0xb641, 0xb642, 0xb643, 0xb644, /*0x90-0x97*/ - 0xb645, 0xb646, 0xecfa, 0xb647, 0xb648, 0xb649, 0xb64a, 0xb64b, /*0x98-0x9f*/ - 0xb64c, 0xb64d, 0xb64e, 0xb64f, 0xb650, 0xb651, 0xb652, 0xecfb, /*0xa0-0xa7*/ - 0xb653, 0xb654, 0xb655, 0xb656, 0xb657, 0xb658, 0xb659, 0xb65a, /*0xa8-0xaf*/ - 0xb65b, 0xb65c, 0xb65d, 0xecfc, 0xb65e, 0xb65f, 0xb660, 0xb661, /*0xb0-0xb7*/ - 0xb662, 0xd3ed, 0xd8ae, 0xc0eb, 0xb663, 0xc7dd, 0xbacc, 0xb664, /*0xb8-0xbf*/ - 0xd0e3, 0xcbbd, 0xb665, 0xcdba, 0xb666, 0xb667, 0xb8d1, 0xb668, /*0xc0-0xc7*/ - 0xb669, 0xb1fc, 0xb66a, 0xc7ef, 0xb66b, 0xd6d6, 0xb66c, 0xb66d, /*0xc8-0xcf*/ - 0xb66e, 0xbfc6, 0xc3eb, 0xb66f, 0xb670, 0xeff5, 0xb671, 0xb672, /*0xd0-0xd7*/ - 0xc3d8, 0xb673, 0xb674, 0xb675, 0xb676, 0xb677, 0xb678, 0xd7e2, /*0xd8-0xdf*/ - 0xb679, 0xb67a, 0xb67b, 0xeff7, 0xb3d3, 0xb67c, 0xc7d8, 0xd1ed, /*0xe0-0xe7*/ - 0xb67d, 0xd6c8, 0xb67e, 0xeff8, 0xb680, 0xeff6, 0xb681, 0xbbfd, /*0xe8-0xef*/ - 0xb3c6, 0xb682, 0xb683, 0xb684, 0xb685, 0xb686, 0xb687, 0xb688, /*0xf0-0xf7*/ - 0xbdd5, 0xb689, 0xb68a, 0xd2c6, 0xb68b, 0xbbe0, 0xb68c, 0xb68d, /*0xf8-0xff*/ - /* 0x7a00 */ - 0xcfa1, 0xb68e, 0xeffc, 0xeffb, 0xb68f, 0xb690, 0xeff9, 0xb691, /*0x00-0x07*/ - 0xb692, 0xb693, 0xb694, 0xb3cc, 0xb695, 0xc9d4, 0xcbb0, 0xb696, /*0x08-0x0f*/ - 0xb697, 0xb698, 0xb699, 0xb69a, 0xeffe, 0xb69b, 0xb69c, 0xb0de, /*0x10-0x17*/ - 0xb69d, 0xb69e, 0xd6c9, 0xb69f, 0xb6a0, 0xb740, 0xeffd, 0xb741, /*0x18-0x1f*/ - 0xb3ed, 0xb742, 0xb743, 0xf6d5, 0xb744, 0xb745, 0xb746, 0xb747, /*0x20-0x27*/ - 0xb748, 0xb749, 0xb74a, 0xb74b, 0xb74c, 0xb74d, 0xb74e, 0xb74f, /*0x28-0x2f*/ - 0xb750, 0xb751, 0xb752, 0xcec8, 0xb753, 0xb754, 0xb755, 0xf0a2, /*0x30-0x37*/ - 0xb756, 0xf0a1, 0xb757, 0xb5be, 0xbcda, 0xbbfc, 0xb758, 0xb8e5, /*0x38-0x3f*/ - 0xb759, 0xb75a, 0xb75b, 0xb75c, 0xb75d, 0xb75e, 0xc4c2, 0xb75f, /*0x40-0x47*/ - 0xb760, 0xb761, 0xb762, 0xb763, 0xb764, 0xb765, 0xb766, 0xb767, /*0x48-0x4f*/ - 0xb768, 0xf0a3, 0xb769, 0xb76a, 0xb76b, 0xb76c, 0xb76d, 0xcbeb, /*0x50-0x57*/ - 0xb76e, 0xb76f, 0xb770, 0xb771, 0xb772, 0xb773, 0xb774, 0xb775, /*0x58-0x5f*/ - 0xb776, 0xb777, 0xb778, 0xb779, 0xb77a, 0xb77b, 0xb77c, 0xb77d, /*0x60-0x67*/ - 0xb77e, 0xb780, 0xb781, 0xb782, 0xb783, 0xb784, 0xb785, 0xb786, /*0x68-0x6f*/ - 0xf0a6, 0xb787, 0xb788, 0xb789, 0xd1a8, 0xb78a, 0xbebf, 0xc7ee, /*0x70-0x77*/ - 0xf1b6, 0xf1b7, 0xbfd5, 0xb78b, 0xb78c, 0xb78d, 0xb78e, 0xb4a9, /*0x78-0x7f*/ - 0xf1b8, 0xcdbb, 0xb78f, 0xc7d4, 0xd5ad, 0xb790, 0xf1b9, 0xb791, /*0x80-0x87*/ - 0xf1ba, 0xb792, 0xb793, 0xb794, 0xb795, 0xc7cf, 0xb796, 0xb797, /*0x88-0x8f*/ - 0xb798, 0xd2a4, 0xd6cf, 0xb799, 0xb79a, 0xf1bb, 0xbdd1, 0xb4b0, /*0x90-0x97*/ - 0xbebd, 0xb79b, 0xb79c, 0xb79d, 0xb4dc, 0xced1, 0xb79e, 0xbfdf, /*0x98-0x9f*/ - 0xf1bd, 0xb79f, 0xb7a0, 0xb840, 0xb841, 0xbffa, 0xf1bc, 0xb842, /*0xa0-0xa7*/ - 0xf1bf, 0xb843, 0xb844, 0xb845, 0xf1be, 0xf1c0, 0xb846, 0xb847, /*0xa8-0xaf*/ - 0xb848, 0xb849, 0xb84a, 0xf1c1, 0xb84b, 0xb84c, 0xb84d, 0xb84e, /*0xb0-0xb7*/ - 0xb84f, 0xb850, 0xb851, 0xb852, 0xb853, 0xb854, 0xb855, 0xc1fe, /*0xb8-0xbf*/ - 0xb856, 0xb857, 0xb858, 0xb859, 0xb85a, 0xb85b, 0xb85c, 0xb85d, /*0xc0-0xc7*/ - 0xb85e, 0xb85f, 0xb860, 0xc1a2, 0xb861, 0xb862, 0xb863, 0xb864, /*0xc8-0xcf*/ - 0xb865, 0xb866, 0xb867, 0xb868, 0xb869, 0xb86a, 0xcafa, 0xb86b, /*0xd0-0xd7*/ - 0xb86c, 0xd5be, 0xb86d, 0xb86e, 0xb86f, 0xb870, 0xbeba, 0xbeb9, /*0xd8-0xdf*/ - 0xd5c2, 0xb871, 0xb872, 0xbfa2, 0xb873, 0xcdaf, 0xf1b5, 0xb874, /*0xe0-0xe7*/ - 0xb875, 0xb876, 0xb877, 0xb878, 0xb879, 0xbddf, 0xb87a, 0xb6cb, /*0xe8-0xef*/ - 0xb87b, 0xb87c, 0xb87d, 0xb87e, 0xb880, 0xb881, 0xb882, 0xb883, /*0xf0-0xf7*/ - 0xb884, 0xd6f1, 0xf3c3, 0xb885, 0xb886, 0xf3c4, 0xb887, 0xb8cd, /*0xf8-0xff*/ - /* 0x7b00 */ - 0xb888, 0xb889, 0xb88a, 0xf3c6, 0xf3c7, 0xb88b, 0xb0ca, 0xb88c, /*0x00-0x07*/ - 0xf3c5, 0xb88d, 0xf3c9, 0xcbf1, 0xb88e, 0xb88f, 0xb890, 0xf3cb, /*0x08-0x0f*/ - 0xb891, 0xd0a6, 0xb892, 0xb893, 0xb1ca, 0xf3c8, 0xb894, 0xb895, /*0x10-0x17*/ - 0xb896, 0xf3cf, 0xb897, 0xb5d1, 0xb898, 0xb899, 0xf3d7, 0xb89a, /*0x18-0x1f*/ - 0xf3d2, 0xb89b, 0xb89c, 0xb89d, 0xf3d4, 0xf3d3, 0xb7fb, 0xb89e, /*0x20-0x27*/ - 0xb1bf, 0xb89f, 0xf3ce, 0xf3ca, 0xb5da, 0xb8a0, 0xf3d0, 0xb940, /*0x28-0x2f*/ - 0xb941, 0xf3d1, 0xb942, 0xf3d5, 0xb943, 0xb944, 0xb945, 0xb946, /*0x30-0x37*/ - 0xf3cd, 0xb947, 0xbce3, 0xb948, 0xc1fd, 0xb949, 0xf3d6, 0xb94a, /*0x38-0x3f*/ - 0xb94b, 0xb94c, 0xb94d, 0xb94e, 0xb94f, 0xf3da, 0xb950, 0xf3cc, /*0x40-0x47*/ - 0xb951, 0xb5c8, 0xb952, 0xbdee, 0xf3dc, 0xb953, 0xb954, 0xb7a4, /*0x48-0x4f*/ - 0xbff0, 0xd6fe, 0xcdb2, 0xb955, 0xb4f0, 0xb956, 0xb2df, 0xb957, /*0x50-0x57*/ - 0xf3d8, 0xb958, 0xf3d9, 0xc9b8, 0xb959, 0xf3dd, 0xb95a, 0xb95b, /*0x58-0x5f*/ - 0xf3de, 0xb95c, 0xf3e1, 0xb95d, 0xb95e, 0xb95f, 0xb960, 0xb961, /*0x60-0x67*/ - 0xb962, 0xb963, 0xb964, 0xb965, 0xb966, 0xb967, 0xf3df, 0xb968, /*0x68-0x6f*/ - 0xb969, 0xf3e3, 0xf3e2, 0xb96a, 0xb96b, 0xf3db, 0xb96c, 0xbfea, /*0x70-0x77*/ - 0xb96d, 0xb3ef, 0xb96e, 0xf3e0, 0xb96f, 0xb970, 0xc7a9, 0xb971, /*0x78-0x7f*/ - 0xbcf2, 0xb972, 0xb973, 0xb974, 0xb975, 0xf3eb, 0xb976, 0xb977, /*0x80-0x87*/ - 0xb978, 0xb979, 0xb97a, 0xb97b, 0xb97c, 0xb9bf, 0xb97d, 0xb97e, /*0x88-0x8f*/ - 0xf3e4, 0xb980, 0xb981, 0xb982, 0xb2ad, 0xbbfe, 0xb983, 0xcbe3, /*0x90-0x97*/ - 0xb984, 0xb985, 0xb986, 0xb987, 0xf3ed, 0xf3e9, 0xb988, 0xb989, /*0x98-0x9f*/ - 0xb98a, 0xb9dc, 0xf3ee, 0xb98b, 0xb98c, 0xb98d, 0xf3e5, 0xf3e6, /*0xa0-0xa7*/ - 0xf3ea, 0xc2e1, 0xf3ec, 0xf3ef, 0xf3e8, 0xbcfd, 0xb98e, 0xb98f, /*0xa8-0xaf*/ - 0xb990, 0xcfe4, 0xb991, 0xb992, 0xf3f0, 0xb993, 0xb994, 0xb995, /*0xb0-0xb7*/ - 0xf3e7, 0xb996, 0xb997, 0xb998, 0xb999, 0xb99a, 0xb99b, 0xb99c, /*0xb8-0xbf*/ - 0xb99d, 0xf3f2, 0xb99e, 0xb99f, 0xb9a0, 0xba40, 0xd7ad, 0xc6aa, /*0xc0-0xc7*/ - 0xba41, 0xba42, 0xba43, 0xba44, 0xf3f3, 0xba45, 0xba46, 0xba47, /*0xc8-0xcf*/ - 0xba48, 0xf3f1, 0xba49, 0xc2a8, 0xba4a, 0xba4b, 0xba4c, 0xba4d, /*0xd0-0xd7*/ - 0xba4e, 0xb8dd, 0xf3f5, 0xba4f, 0xba50, 0xf3f4, 0xba51, 0xba52, /*0xd8-0xdf*/ - 0xba53, 0xb4db, 0xba54, 0xba55, 0xba56, 0xf3f6, 0xf3f7, 0xba57, /*0xe0-0xe7*/ - 0xba58, 0xba59, 0xf3f8, 0xba5a, 0xba5b, 0xba5c, 0xc0ba, 0xba5d, /*0xe8-0xef*/ - 0xba5e, 0xc0e9, 0xba5f, 0xba60, 0xba61, 0xba62, 0xba63, 0xc5f1, /*0xf0-0xf7*/ - 0xba64, 0xba65, 0xba66, 0xba67, 0xf3fb, 0xba68, 0xf3fa, 0xba69, /*0xf8-0xff*/ - /* 0x7c00 */ - 0xba6a, 0xba6b, 0xba6c, 0xba6d, 0xba6e, 0xba6f, 0xba70, 0xb4d8, /*0x00-0x07*/ - 0xba71, 0xba72, 0xba73, 0xf3fe, 0xf3f9, 0xba74, 0xba75, 0xf3fc, /*0x08-0x0f*/ - 0xba76, 0xba77, 0xba78, 0xba79, 0xba7a, 0xba7b, 0xf3fd, 0xba7c, /*0x10-0x17*/ - 0xba7d, 0xba7e, 0xba80, 0xba81, 0xba82, 0xba83, 0xba84, 0xf4a1, /*0x18-0x1f*/ - 0xba85, 0xba86, 0xba87, 0xba88, 0xba89, 0xba8a, 0xf4a3, 0xbbc9, /*0x20-0x27*/ - 0xba8b, 0xba8c, 0xf4a2, 0xba8d, 0xba8e, 0xba8f, 0xba90, 0xba91, /*0x28-0x2f*/ - 0xba92, 0xba93, 0xba94, 0xba95, 0xba96, 0xba97, 0xba98, 0xba99, /*0x30-0x37*/ - 0xf4a4, 0xba9a, 0xba9b, 0xba9c, 0xba9d, 0xba9e, 0xba9f, 0xb2be, /*0x38-0x3f*/ - 0xf4a6, 0xf4a5, 0xbaa0, 0xbb40, 0xbb41, 0xbb42, 0xbb43, 0xbb44, /*0x40-0x47*/ - 0xbb45, 0xbb46, 0xbb47, 0xbb48, 0xbb49, 0xbcae, 0xbb4a, 0xbb4b, /*0x48-0x4f*/ - 0xbb4c, 0xbb4d, 0xbb4e, 0xbb4f, 0xbb50, 0xbb51, 0xbb52, 0xbb53, /*0x50-0x57*/ - 0xbb54, 0xbb55, 0xbb56, 0xbb57, 0xbb58, 0xbb59, 0xbb5a, 0xbb5b, /*0x58-0x5f*/ - 0xbb5c, 0xbb5d, 0xbb5e, 0xbb5f, 0xbb60, 0xbb61, 0xbb62, 0xbb63, /*0x60-0x67*/ - 0xbb64, 0xbb65, 0xbb66, 0xbb67, 0xbb68, 0xbb69, 0xbb6a, 0xbb6b, /*0x68-0x6f*/ - 0xbb6c, 0xbb6d, 0xbb6e, 0xc3d7, 0xd9e1, 0xbb6f, 0xbb70, 0xbb71, /*0x70-0x77*/ - 0xbb72, 0xbb73, 0xbb74, 0xc0e0, 0xf4cc, 0xd7d1, 0xbb75, 0xbb76, /*0x78-0x7f*/ - 0xbb77, 0xbb78, 0xbb79, 0xbb7a, 0xbb7b, 0xbb7c, 0xbb7d, 0xbb7e, /*0x80-0x87*/ - 0xbb80, 0xb7db, 0xbb81, 0xbb82, 0xbb83, 0xbb84, 0xbb85, 0xbb86, /*0x88-0x8f*/ - 0xbb87, 0xf4ce, 0xc1a3, 0xbb88, 0xbb89, 0xc6c9, 0xbb8a, 0xb4d6, /*0x90-0x97*/ - 0xd5b3, 0xbb8b, 0xbb8c, 0xbb8d, 0xf4d0, 0xf4cf, 0xf4d1, 0xcbda, /*0x98-0x9f*/ - 0xbb8e, 0xbb8f, 0xf4d2, 0xbb90, 0xd4c1, 0xd6e0, 0xbb91, 0xbb92, /*0xa0-0xa7*/ - 0xbb93, 0xbb94, 0xb7e0, 0xbb95, 0xbb96, 0xbb97, 0xc1b8, 0xbb98, /*0xa8-0xaf*/ - 0xbb99, 0xc1bb, 0xf4d3, 0xbeac, 0xbb9a, 0xbb9b, 0xbb9c, 0xbb9d, /*0xb0-0xb7*/ - 0xbb9e, 0xb4e2, 0xbb9f, 0xbba0, 0xf4d4, 0xf4d5, 0xbeab, 0xbc40, /*0xb8-0xbf*/ - 0xbc41, 0xf4d6, 0xbc42, 0xbc43, 0xbc44, 0xf4db, 0xbc45, 0xf4d7, /*0xc0-0xc7*/ - 0xf4da, 0xbc46, 0xbafd, 0xbc47, 0xf4d8, 0xf4d9, 0xbc48, 0xbc49, /*0xc8-0xcf*/ - 0xbc4a, 0xbc4b, 0xbc4c, 0xbc4d, 0xbc4e, 0xb8e2, 0xccc7, 0xf4dc, /*0xd0-0xd7*/ - 0xbc4f, 0xb2da, 0xbc50, 0xbc51, 0xc3d3, 0xbc52, 0xbc53, 0xd4e3, /*0xd8-0xdf*/ - 0xbfb7, 0xbc54, 0xbc55, 0xbc56, 0xbc57, 0xbc58, 0xbc59, 0xbc5a, /*0xe0-0xe7*/ - 0xf4dd, 0xbc5b, 0xbc5c, 0xbc5d, 0xbc5e, 0xbc5f, 0xbc60, 0xc5b4, /*0xe8-0xef*/ - 0xbc61, 0xbc62, 0xbc63, 0xbc64, 0xbc65, 0xbc66, 0xbc67, 0xbc68, /*0xf0-0xf7*/ - 0xf4e9, 0xbc69, 0xbc6a, 0xcfb5, 0xbc6b, 0xbc6c, 0xbc6d, 0xbc6e, /*0xf8-0xff*/ - /* 0x7d00 */ - 0xbc6f, 0xbc70, 0xbc71, 0xbc72, 0xbc73, 0xbc74, 0xbc75, 0xbc76, /*0x00-0x07*/ - 0xbc77, 0xbc78, 0xcec9, 0xbc79, 0xbc7a, 0xbc7b, 0xbc7c, 0xbc7d, /*0x08-0x0f*/ - 0xbc7e, 0xbc80, 0xbc81, 0xbc82, 0xbc83, 0xbc84, 0xbc85, 0xbc86, /*0x10-0x17*/ - 0xbc87, 0xbc88, 0xbc89, 0xbc8a, 0xbc8b, 0xbc8c, 0xbc8d, 0xbc8e, /*0x18-0x1f*/ - 0xcbd8, 0xbc8f, 0xcbf7, 0xbc90, 0xbc91, 0xbc92, 0xbc93, 0xbdf4, /*0x20-0x27*/ - 0xbc94, 0xbc95, 0xbc96, 0xd7cf, 0xbc97, 0xbc98, 0xbc99, 0xc0db, /*0x28-0x2f*/ - 0xbc9a, 0xbc9b, 0xbc9c, 0xbc9d, 0xbc9e, 0xbc9f, 0xbca0, 0xbd40, /*0x30-0x37*/ - 0xbd41, 0xbd42, 0xbd43, 0xbd44, 0xbd45, 0xbd46, 0xbd47, 0xbd48, /*0x38-0x3f*/ - 0xbd49, 0xbd4a, 0xbd4b, 0xbd4c, 0xbd4d, 0xbd4e, 0xbd4f, 0xbd50, /*0x40-0x47*/ - 0xbd51, 0xbd52, 0xbd53, 0xbd54, 0xbd55, 0xbd56, 0xbd57, 0xbd58, /*0x48-0x4f*/ - 0xbd59, 0xbd5a, 0xbd5b, 0xbd5c, 0xbd5d, 0xbd5e, 0xbd5f, 0xbd60, /*0x50-0x57*/ - 0xbd61, 0xbd62, 0xbd63, 0xbd64, 0xbd65, 0xbd66, 0xbd67, 0xbd68, /*0x58-0x5f*/ - 0xbd69, 0xbd6a, 0xbd6b, 0xbd6c, 0xbd6d, 0xbd6e, 0xbd6f, 0xbd70, /*0x60-0x67*/ - 0xbd71, 0xbd72, 0xbd73, 0xbd74, 0xbd75, 0xbd76, 0xd0f5, 0xbd77, /*0x68-0x6f*/ - 0xbd78, 0xbd79, 0xbd7a, 0xbd7b, 0xbd7c, 0xbd7d, 0xbd7e, 0xf4ea, /*0x70-0x77*/ - 0xbd80, 0xbd81, 0xbd82, 0xbd83, 0xbd84, 0xbd85, 0xbd86, 0xbd87, /*0x78-0x7f*/ - 0xbd88, 0xbd89, 0xbd8a, 0xbd8b, 0xbd8c, 0xbd8d, 0xbd8e, 0xbd8f, /*0x80-0x87*/ - 0xbd90, 0xbd91, 0xbd92, 0xbd93, 0xbd94, 0xbd95, 0xbd96, 0xbd97, /*0x88-0x8f*/ - 0xbd98, 0xbd99, 0xbd9a, 0xbd9b, 0xbd9c, 0xbd9d, 0xbd9e, 0xbd9f, /*0x90-0x97*/ - 0xbda0, 0xbe40, 0xbe41, 0xbe42, 0xbe43, 0xbe44, 0xbe45, 0xbe46, /*0x98-0x9f*/ - 0xbe47, 0xbe48, 0xbe49, 0xbe4a, 0xbe4b, 0xbe4c, 0xf4eb, 0xbe4d, /*0xa0-0xa7*/ - 0xbe4e, 0xbe4f, 0xbe50, 0xbe51, 0xbe52, 0xbe53, 0xf4ec, 0xbe54, /*0xa8-0xaf*/ - 0xbe55, 0xbe56, 0xbe57, 0xbe58, 0xbe59, 0xbe5a, 0xbe5b, 0xbe5c, /*0xb0-0xb7*/ - 0xbe5d, 0xbe5e, 0xbe5f, 0xbe60, 0xbe61, 0xbe62, 0xbe63, 0xbe64, /*0xb8-0xbf*/ - 0xbe65, 0xbe66, 0xbe67, 0xbe68, 0xbe69, 0xbe6a, 0xbe6b, 0xbe6c, /*0xc0-0xc7*/ - 0xbe6d, 0xbe6e, 0xbe6f, 0xbe70, 0xbe71, 0xbe72, 0xbe73, 0xbe74, /*0xc8-0xcf*/ - 0xbe75, 0xbe76, 0xbe77, 0xbe78, 0xbe79, 0xbe7a, 0xbe7b, 0xbe7c, /*0xd0-0xd7*/ - 0xbe7d, 0xbe7e, 0xbe80, 0xbe81, 0xbe82, 0xbe83, 0xbe84, 0xbe85, /*0xd8-0xdf*/ - 0xbe86, 0xbe87, 0xbe88, 0xbe89, 0xbe8a, 0xbe8b, 0xbe8c, 0xbe8d, /*0xe0-0xe7*/ - 0xbe8e, 0xbe8f, 0xbe90, 0xbe91, 0xbe92, 0xbe93, 0xbe94, 0xbe95, /*0xe8-0xef*/ - 0xbe96, 0xbe97, 0xbe98, 0xbe99, 0xbe9a, 0xbe9b, 0xbe9c, 0xbe9d, /*0xf0-0xf7*/ - 0xbe9e, 0xbe9f, 0xbea0, 0xbf40, 0xbf41, 0xbf42, 0xbf43, 0xbf44, /*0xf8-0xff*/ - /* 0x7e00 */ - 0xbf45, 0xbf46, 0xbf47, 0xbf48, 0xbf49, 0xbf4a, 0xbf4b, 0xbf4c, /*0x00-0x07*/ - 0xbf4d, 0xbf4e, 0xbf4f, 0xbf50, 0xbf51, 0xbf52, 0xbf53, 0xbf54, /*0x08-0x0f*/ - 0xbf55, 0xbf56, 0xbf57, 0xbf58, 0xbf59, 0xbf5a, 0xbf5b, 0xbf5c, /*0x10-0x17*/ - 0xbf5d, 0xbf5e, 0xbf5f, 0xbf60, 0xbf61, 0xbf62, 0xbf63, 0xbf64, /*0x18-0x1f*/ - 0xbf65, 0xbf66, 0xbf67, 0xbf68, 0xbf69, 0xbf6a, 0xbf6b, 0xbf6c, /*0x20-0x27*/ - 0xbf6d, 0xbf6e, 0xbf6f, 0xbf70, 0xbf71, 0xbf72, 0xbf73, 0xbf74, /*0x28-0x2f*/ - 0xbf75, 0xbf76, 0xbf77, 0xbf78, 0xbf79, 0xbf7a, 0xbf7b, 0xbf7c, /*0x30-0x37*/ - 0xbf7d, 0xbf7e, 0xbf80, 0xf7e3, 0xbf81, 0xbf82, 0xbf83, 0xbf84, /*0x38-0x3f*/ - 0xbf85, 0xb7b1, 0xbf86, 0xbf87, 0xbf88, 0xbf89, 0xbf8a, 0xf4ed, /*0x40-0x47*/ - 0xbf8b, 0xbf8c, 0xbf8d, 0xbf8e, 0xbf8f, 0xbf90, 0xbf91, 0xbf92, /*0x48-0x4f*/ - 0xbf93, 0xbf94, 0xbf95, 0xbf96, 0xbf97, 0xbf98, 0xbf99, 0xbf9a, /*0x50-0x57*/ - 0xbf9b, 0xbf9c, 0xbf9d, 0xbf9e, 0xbf9f, 0xbfa0, 0xc040, 0xc041, /*0x58-0x5f*/ - 0xc042, 0xc043, 0xc044, 0xc045, 0xc046, 0xc047, 0xc048, 0xc049, /*0x60-0x67*/ - 0xc04a, 0xc04b, 0xc04c, 0xc04d, 0xc04e, 0xc04f, 0xc050, 0xc051, /*0x68-0x6f*/ - 0xc052, 0xc053, 0xc054, 0xc055, 0xc056, 0xc057, 0xc058, 0xc059, /*0x70-0x77*/ - 0xc05a, 0xc05b, 0xc05c, 0xc05d, 0xc05e, 0xc05f, 0xc060, 0xc061, /*0x78-0x7f*/ - 0xc062, 0xc063, 0xd7eb, 0xc064, 0xc065, 0xc066, 0xc067, 0xc068, /*0x80-0x87*/ - 0xc069, 0xc06a, 0xc06b, 0xc06c, 0xc06d, 0xc06e, 0xc06f, 0xc070, /*0x88-0x8f*/ - 0xc071, 0xc072, 0xc073, 0xc074, 0xc075, 0xc076, 0xc077, 0xc078, /*0x90-0x97*/ - 0xc079, 0xc07a, 0xc07b, 0xf4ee, 0xc07c, 0xc07d, 0xc07e, 0xe6f9, /*0x98-0x9f*/ - 0xbec0, 0xe6fa, 0xbaec, 0xe6fb, 0xcfcb, 0xe6fc, 0xd4bc, 0xbcb6, /*0xa0-0xa7*/ - 0xe6fd, 0xe6fe, 0xbccd, 0xc8d2, 0xceb3, 0xe7a1, 0xc080, 0xb4bf, /*0xa8-0xaf*/ - 0xe7a2, 0xc9b4, 0xb8d9, 0xc4c9, 0xc081, 0xd7dd, 0xc2da, 0xb7d7, /*0xb0-0xb7*/ - 0xd6bd, 0xcec6, 0xb7c4, 0xc082, 0xc083, 0xc5a6, 0xe7a3, 0xcfdf, /*0xb8-0xbf*/ - 0xe7a4, 0xe7a5, 0xe7a6, 0xc1b7, 0xd7e9, 0xc9f0, 0xcfb8, 0xd6af, /*0xc0-0xc7*/ - 0xd6d5, 0xe7a7, 0xb0ed, 0xe7a8, 0xe7a9, 0xc9dc, 0xd2ef, 0xbead, /*0xc8-0xcf*/ - 0xe7aa, 0xb0f3, 0xc8de, 0xbde1, 0xe7ab, 0xc8c6, 0xc084, 0xe7ac, /*0xd0-0xd7*/ - 0xbbe6, 0xb8f8, 0xd1a4, 0xe7ad, 0xc2e7, 0xbef8, 0xbdca, 0xcdb3, /*0xd8-0xdf*/ - 0xe7ae, 0xe7af, 0xbeee, 0xd0e5, 0xc085, 0xcbe7, 0xccd0, 0xbccc, /*0xe0-0xe7*/ - 0xe7b0, 0xbca8, 0xd0f7, 0xe7b1, 0xc086, 0xd0f8, 0xe7b2, 0xe7b3, /*0xe8-0xef*/ - 0xb4c2, 0xe7b4, 0xe7b5, 0xc9fe, 0xceac, 0xc3e0, 0xe7b7, 0xb1c1, /*0xf0-0xf7*/ - 0xb3f1, 0xc087, 0xe7b8, 0xe7b9, 0xd7db, 0xd5c0, 0xe7ba, 0xc2cc, /*0xf8-0xff*/ - /* 0x7f00 */ - 0xd7ba, 0xe7bb, 0xe7bc, 0xe7bd, 0xbcea, 0xc3e5, 0xc0c2, 0xe7be, /*0x00-0x07*/ - 0xe7bf, 0xbca9, 0xc088, 0xe7c0, 0xe7c1, 0xe7b6, 0xb6d0, 0xe7c2, /*0x08-0x0f*/ - 0xc089, 0xe7c3, 0xe7c4, 0xbbba, 0xb5de, 0xc2c6, 0xb1e0, 0xe7c5, /*0x10-0x17*/ - 0xd4b5, 0xe7c6, 0xb8bf, 0xe7c8, 0xe7c7, 0xb7ec, 0xc08a, 0xe7c9, /*0x18-0x1f*/ - 0xb2f8, 0xe7ca, 0xe7cb, 0xe7cc, 0xe7cd, 0xe7ce, 0xe7cf, 0xe7d0, /*0x20-0x27*/ - 0xd3a7, 0xcbf5, 0xe7d1, 0xe7d2, 0xe7d3, 0xe7d4, 0xc9c9, 0xe7d5, /*0x28-0x2f*/ - 0xe7d6, 0xe7d7, 0xe7d8, 0xe7d9, 0xbdc9, 0xe7da, 0xf3be, 0xc08b, /*0x30-0x37*/ - 0xb8d7, 0xc08c, 0xc8b1, 0xc08d, 0xc08e, 0xc08f, 0xc090, 0xc091, /*0x38-0x3f*/ - 0xc092, 0xc093, 0xf3bf, 0xc094, 0xf3c0, 0xf3c1, 0xc095, 0xc096, /*0x40-0x47*/ - 0xc097, 0xc098, 0xc099, 0xc09a, 0xc09b, 0xc09c, 0xc09d, 0xc09e, /*0x48-0x4f*/ - 0xb9de, 0xcdf8, 0xc09f, 0xc0a0, 0xd8e8, 0xbab1, 0xc140, 0xc2de, /*0x50-0x57*/ - 0xeeb7, 0xc141, 0xb7a3, 0xc142, 0xc143, 0xc144, 0xc145, 0xeeb9, /*0x58-0x5f*/ - 0xc146, 0xeeb8, 0xb0d5, 0xc147, 0xc148, 0xc149, 0xc14a, 0xc14b, /*0x60-0x67*/ - 0xeebb, 0xd5d6, 0xd7ef, 0xc14c, 0xc14d, 0xc14e, 0xd6c3, 0xc14f, /*0x68-0x6f*/ - 0xc150, 0xeebd, 0xcaf0, 0xc151, 0xeebc, 0xc152, 0xc153, 0xc154, /*0x70-0x77*/ - 0xc155, 0xeebe, 0xc156, 0xc157, 0xc158, 0xc159, 0xeec0, 0xc15a, /*0x78-0x7f*/ - 0xc15b, 0xeebf, 0xc15c, 0xc15d, 0xc15e, 0xc15f, 0xc160, 0xc161, /*0x80-0x87*/ - 0xc162, 0xc163, 0xd1f2, 0xc164, 0xc7bc, 0xc165, 0xc3c0, 0xc166, /*0x88-0x8f*/ - 0xc167, 0xc168, 0xc169, 0xc16a, 0xb8e1, 0xc16b, 0xc16c, 0xc16d, /*0x90-0x97*/ - 0xc16e, 0xc16f, 0xc1e7, 0xc170, 0xc171, 0xf4c6, 0xd0df, 0xf4c7, /*0x98-0x9f*/ - 0xc172, 0xcfdb, 0xc173, 0xc174, 0xc8ba, 0xc175, 0xc176, 0xf4c8, /*0xa0-0xa7*/ - 0xc177, 0xc178, 0xc179, 0xc17a, 0xc17b, 0xc17c, 0xc17d, 0xf4c9, /*0xa8-0xaf*/ - 0xf4ca, 0xc17e, 0xf4cb, 0xc180, 0xc181, 0xc182, 0xc183, 0xc184, /*0xb0-0xb7*/ - 0xd9fa, 0xb8fe, 0xc185, 0xc186, 0xe5f1, 0xd3f0, 0xc187, 0xf4e0, /*0xb8-0xbf*/ - 0xc188, 0xcecc, 0xc189, 0xc18a, 0xc18b, 0xb3e1, 0xc18c, 0xc18d, /*0xc0-0xc7*/ - 0xc18e, 0xc18f, 0xf1b4, 0xc190, 0xd2ee, 0xc191, 0xf4e1, 0xc192, /*0xc8-0xcf*/ - 0xc193, 0xc194, 0xc195, 0xc196, 0xcfe8, 0xf4e2, 0xc197, 0xc198, /*0xd0-0xd7*/ - 0xc7cc, 0xc199, 0xc19a, 0xc19b, 0xc19c, 0xc19d, 0xc19e, 0xb5d4, /*0xd8-0xdf*/ - 0xb4e4, 0xf4e4, 0xc19f, 0xc1a0, 0xc240, 0xf4e3, 0xf4e5, 0xc241, /*0xe0-0xe7*/ - 0xc242, 0xf4e6, 0xc243, 0xc244, 0xc245, 0xc246, 0xf4e7, 0xc247, /*0xe8-0xef*/ - 0xbab2, 0xb0bf, 0xc248, 0xf4e8, 0xc249, 0xc24a, 0xc24b, 0xc24c, /*0xf0-0xf7*/ - 0xc24d, 0xc24e, 0xc24f, 0xb7ad, 0xd2ed, 0xc250, 0xc251, 0xc252, /*0xf8-0xff*/ - /* 0x8000 */ - 0xd2ab, 0xc0cf, 0xc253, 0xbfbc, 0xeba3, 0xd5df, 0xeac8, 0xc254, /*0x00-0x07*/ - 0xc255, 0xc256, 0xc257, 0xf1f3, 0xb6f8, 0xcba3, 0xc258, 0xc259, /*0x08-0x0f*/ - 0xc4cd, 0xc25a, 0xf1e7, 0xc25b, 0xf1e8, 0xb8fb, 0xf1e9, 0xbac4, /*0x10-0x17*/ - 0xd4c5, 0xb0d2, 0xc25c, 0xc25d, 0xf1ea, 0xc25e, 0xc25f, 0xc260, /*0x18-0x1f*/ - 0xf1eb, 0xc261, 0xf1ec, 0xc262, 0xc263, 0xf1ed, 0xf1ee, 0xf1ef, /*0x20-0x27*/ - 0xf1f1, 0xf1f0, 0xc5d5, 0xc264, 0xc265, 0xc266, 0xc267, 0xc268, /*0x28-0x2f*/ - 0xc269, 0xf1f2, 0xc26a, 0xb6fa, 0xc26b, 0xf1f4, 0xd2ae, 0xdec7, /*0x30-0x37*/ - 0xcbca, 0xc26c, 0xc26d, 0xb3dc, 0xc26e, 0xb5a2, 0xc26f, 0xb9a2, /*0x38-0x3f*/ - 0xc270, 0xc271, 0xc4f4, 0xf1f5, 0xc272, 0xc273, 0xf1f6, 0xc274, /*0x40-0x47*/ - 0xc275, 0xc276, 0xc1c4, 0xc1fb, 0xd6b0, 0xf1f7, 0xc277, 0xc278, /*0x48-0x4f*/ - 0xc279, 0xc27a, 0xf1f8, 0xc27b, 0xc1aa, 0xc27c, 0xc27d, 0xc27e, /*0x50-0x57*/ - 0xc6b8, 0xc280, 0xbedb, 0xc281, 0xc282, 0xc283, 0xc284, 0xc285, /*0x58-0x5f*/ - 0xc286, 0xc287, 0xc288, 0xc289, 0xc28a, 0xc28b, 0xc28c, 0xc28d, /*0x60-0x67*/ - 0xc28e, 0xf1f9, 0xb4cf, 0xc28f, 0xc290, 0xc291, 0xc292, 0xc293, /*0x68-0x6f*/ - 0xc294, 0xf1fa, 0xc295, 0xc296, 0xc297, 0xc298, 0xc299, 0xc29a, /*0x70-0x77*/ - 0xc29b, 0xc29c, 0xc29d, 0xc29e, 0xc29f, 0xc2a0, 0xc340, 0xedb2, /*0x78-0x7f*/ - 0xedb1, 0xc341, 0xc342, 0xcbe0, 0xd2de, 0xc343, 0xcbc1, 0xd5d8, /*0x80-0x87*/ - 0xc344, 0xc8e2, 0xc345, 0xc0df, 0xbca1, 0xc346, 0xc347, 0xc348, /*0x88-0x8f*/ - 0xc349, 0xc34a, 0xc34b, 0xebc1, 0xc34c, 0xc34d, 0xd0a4, 0xc34e, /*0x90-0x97*/ - 0xd6e2, 0xc34f, 0xb6c7, 0xb8d8, 0xebc0, 0xb8ce, 0xc350, 0xebbf, /*0x98-0x9f*/ - 0xb3a6, 0xb9c9, 0xd6ab, 0xc351, 0xb7f4, 0xb7ca, 0xc352, 0xc353, /*0xa0-0xa7*/ - 0xc354, 0xbce7, 0xb7be, 0xebc6, 0xc355, 0xebc7, 0xb0b9, 0xbfcf, /*0xa8-0xaf*/ - 0xc356, 0xebc5, 0xd3fd, 0xc357, 0xebc8, 0xc358, 0xc359, 0xebc9, /*0xb0-0xb7*/ - 0xc35a, 0xc35b, 0xb7ce, 0xc35c, 0xebc2, 0xebc4, 0xc9f6, 0xd6d7, /*0xb8-0xbf*/ - 0xd5cd, 0xd0b2, 0xebcf, 0xceb8, 0xebd0, 0xc35d, 0xb5a8, 0xc35e, /*0xc0-0xc7*/ - 0xc35f, 0xc360, 0xc361, 0xc362, 0xb1b3, 0xebd2, 0xcca5, 0xc363, /*0xc8-0xcf*/ - 0xc364, 0xc365, 0xc366, 0xc367, 0xc368, 0xc369, 0xc5d6, 0xebd3, /*0xd0-0xd7*/ - 0xc36a, 0xebd1, 0xc5df, 0xebce, 0xcaa4, 0xebd5, 0xb0fb, 0xc36b, /*0xd8-0xdf*/ - 0xc36c, 0xbafa, 0xc36d, 0xc36e, 0xd8b7, 0xf1e3, 0xc36f, 0xebca, /*0xe0-0xe7*/ - 0xebcb, 0xebcc, 0xebcd, 0xebd6, 0xe6c0, 0xebd9, 0xc370, 0xbfe8, /*0xe8-0xef*/ - 0xd2c8, 0xebd7, 0xebdc, 0xb8ec, 0xebd8, 0xc371, 0xbdba, 0xc372, /*0xf0-0xf7*/ - 0xd0d8, 0xc373, 0xb0b7, 0xc374, 0xebdd, 0xc4dc, 0xc375, 0xc376, /*0xf8-0xff*/ - /* 0x8100 */ - 0xc377, 0xc378, 0xd6ac, 0xc379, 0xc37a, 0xc37b, 0xb4e0, 0xc37c, /*0x00-0x07*/ - 0xc37d, 0xc2f6, 0xbcb9, 0xc37e, 0xc380, 0xebda, 0xebdb, 0xd4e0, /*0x08-0x0f*/ - 0xc6ea, 0xc4d4, 0xebdf, 0xc5a7, 0xd9f5, 0xc381, 0xb2b1, 0xc382, /*0x10-0x17*/ - 0xebe4, 0xc383, 0xbdc5, 0xc384, 0xc385, 0xc386, 0xebe2, 0xc387, /*0x18-0x1f*/ - 0xc388, 0xc389, 0xc38a, 0xc38b, 0xc38c, 0xc38d, 0xc38e, 0xc38f, /*0x20-0x27*/ - 0xc390, 0xc391, 0xc392, 0xc393, 0xebe3, 0xc394, 0xc395, 0xb8ac, /*0x28-0x2f*/ - 0xc396, 0xcdd1, 0xebe5, 0xc397, 0xc398, 0xc399, 0xebe1, 0xc39a, /*0x30-0x37*/ - 0xc1b3, 0xc39b, 0xc39c, 0xc39d, 0xc39e, 0xc39f, 0xc6a2, 0xc3a0, /*0x38-0x3f*/ - 0xc440, 0xc441, 0xc442, 0xc443, 0xc444, 0xc445, 0xccf3, 0xc446, /*0x40-0x47*/ - 0xebe6, 0xc447, 0xc0b0, 0xd2b8, 0xebe7, 0xc448, 0xc449, 0xc44a, /*0x48-0x4f*/ - 0xb8af, 0xb8ad, 0xc44b, 0xebe8, 0xc7bb, 0xcdf3, 0xc44c, 0xc44d, /*0x50-0x57*/ - 0xc44e, 0xebea, 0xebeb, 0xc44f, 0xc450, 0xc451, 0xc452, 0xc453, /*0x58-0x5f*/ - 0xebed, 0xc454, 0xc455, 0xc456, 0xc457, 0xd0c8, 0xc458, 0xebf2, /*0x60-0x67*/ - 0xc459, 0xebee, 0xc45a, 0xc45b, 0xc45c, 0xebf1, 0xc8f9, 0xc45d, /*0x68-0x6f*/ - 0xd1fc, 0xebec, 0xc45e, 0xc45f, 0xebe9, 0xc460, 0xc461, 0xc462, /*0x70-0x77*/ - 0xc463, 0xb8b9, 0xcfd9, 0xc4e5, 0xebef, 0xebf0, 0xccda, 0xcdc8, /*0x78-0x7f*/ - 0xb0f2, 0xc464, 0xebf6, 0xc465, 0xc466, 0xc467, 0xc468, 0xc469, /*0x80-0x87*/ - 0xebf5, 0xc46a, 0xb2b2, 0xc46b, 0xc46c, 0xc46d, 0xc46e, 0xb8e0, /*0x88-0x8f*/ - 0xc46f, 0xebf7, 0xc470, 0xc471, 0xc472, 0xc473, 0xc474, 0xc475, /*0x90-0x97*/ - 0xb1ec, 0xc476, 0xc477, 0xccc5, 0xc4a4, 0xcfa5, 0xc478, 0xc479, /*0x98-0x9f*/ - 0xc47a, 0xc47b, 0xc47c, 0xebf9, 0xc47d, 0xc47e, 0xeca2, 0xc480, /*0xa0-0xa7*/ - 0xc5f2, 0xc481, 0xebfa, 0xc482, 0xc483, 0xc484, 0xc485, 0xc486, /*0xa8-0xaf*/ - 0xc487, 0xc488, 0xc489, 0xc9c5, 0xc48a, 0xc48b, 0xc48c, 0xc48d, /*0xb0-0xb7*/ - 0xc48e, 0xc48f, 0xe2df, 0xebfe, 0xc490, 0xc491, 0xc492, 0xc493, /*0xb8-0xbf*/ - 0xcdce, 0xeca1, 0xb1db, 0xd3b7, 0xc494, 0xc495, 0xd2dc, 0xc496, /*0xc0-0xc7*/ - 0xc497, 0xc498, 0xebfd, 0xc499, 0xebfb, 0xc49a, 0xc49b, 0xc49c, /*0xc8-0xcf*/ - 0xc49d, 0xc49e, 0xc49f, 0xc4a0, 0xc540, 0xc541, 0xc542, 0xc543, /*0xd0-0xd7*/ - 0xc544, 0xc545, 0xc546, 0xc547, 0xc548, 0xc549, 0xc54a, 0xc54b, /*0xd8-0xdf*/ - 0xc54c, 0xc54d, 0xc54e, 0xb3bc, 0xc54f, 0xc550, 0xc551, 0xeab0, /*0xe0-0xe7*/ - 0xc552, 0xc553, 0xd7d4, 0xc554, 0xf4ab, 0xb3f4, 0xc555, 0xc556, /*0xe8-0xef*/ - 0xc557, 0xc558, 0xc559, 0xd6c1, 0xd6c2, 0xc55a, 0xc55b, 0xc55c, /*0xf0-0xf7*/ - 0xc55d, 0xc55e, 0xc55f, 0xd5e9, 0xbeca, 0xc560, 0xf4a7, 0xc561, /*0xf8-0xff*/ - /* 0x8200 */ - 0xd2a8, 0xf4a8, 0xf4a9, 0xc562, 0xf4aa, 0xbecb, 0xd3df, 0xc563, /*0x00-0x07*/ - 0xc564, 0xc565, 0xc566, 0xc567, 0xc9e0, 0xc9e1, 0xc568, 0xc569, /*0x08-0x0f*/ - 0xf3c2, 0xc56a, 0xcae6, 0xc56b, 0xccf2, 0xc56c, 0xc56d, 0xc56e, /*0x10-0x17*/ - 0xc56f, 0xc570, 0xc571, 0xe2b6, 0xcbb4, 0xc572, 0xcee8, 0xd6db, /*0x18-0x1f*/ - 0xc573, 0xf4ad, 0xf4ae, 0xf4af, 0xc574, 0xc575, 0xc576, 0xc577, /*0x20-0x27*/ - 0xf4b2, 0xc578, 0xbabd, 0xf4b3, 0xb0e3, 0xf4b0, 0xc579, 0xf4b1, /*0x28-0x2f*/ - 0xbda2, 0xb2d5, 0xc57a, 0xf4b6, 0xf4b7, 0xb6e6, 0xb2b0, 0xcfcf, /*0x30-0x37*/ - 0xf4b4, 0xb4ac, 0xc57b, 0xf4b5, 0xc57c, 0xc57d, 0xf4b8, 0xc57e, /*0x38-0x3f*/ - 0xc580, 0xc581, 0xc582, 0xc583, 0xf4b9, 0xc584, 0xc585, 0xcda7, /*0x40-0x47*/ - 0xc586, 0xf4ba, 0xc587, 0xf4bb, 0xc588, 0xc589, 0xc58a, 0xf4bc, /*0x48-0x4f*/ - 0xc58b, 0xc58c, 0xc58d, 0xc58e, 0xc58f, 0xc590, 0xc591, 0xc592, /*0x50-0x57*/ - 0xcbd2, 0xc593, 0xf4bd, 0xc594, 0xc595, 0xc596, 0xc597, 0xf4be, /*0x58-0x5f*/ - 0xc598, 0xc599, 0xc59a, 0xc59b, 0xc59c, 0xc59d, 0xc59e, 0xc59f, /*0x60-0x67*/ - 0xf4bf, 0xc5a0, 0xc640, 0xc641, 0xc642, 0xc643, 0xf4de, 0xc1bc, /*0x68-0x6f*/ - 0xbce8, 0xc644, 0xc9ab, 0xd1de, 0xe5f5, 0xc645, 0xc646, 0xc647, /*0x70-0x77*/ - 0xc648, 0xdcb3, 0xd2d5, 0xc649, 0xc64a, 0xdcb4, 0xb0ac, 0xdcb5, /*0x78-0x7f*/ - 0xc64b, 0xc64c, 0xbdda, 0xc64d, 0xdcb9, 0xc64e, 0xc64f, 0xc650, /*0x80-0x87*/ - 0xd8c2, 0xc651, 0xdcb7, 0xd3f3, 0xc652, 0xc9d6, 0xdcba, 0xdcb6, /*0x88-0x8f*/ - 0xc653, 0xdcbb, 0xc3a2, 0xc654, 0xc655, 0xc656, 0xc657, 0xdcbc, /*0x90-0x97*/ - 0xdcc5, 0xdcbd, 0xc658, 0xc659, 0xcedf, 0xd6a5, 0xc65a, 0xdccf, /*0x98-0x9f*/ - 0xc65b, 0xdccd, 0xc65c, 0xc65d, 0xdcd2, 0xbde6, 0xc2ab, 0xc65e, /*0xa0-0xa7*/ - 0xdcb8, 0xdccb, 0xdcce, 0xdcbe, 0xb7d2, 0xb0c5, 0xdcc7, 0xd0be, /*0xa8-0xaf*/ - 0xdcc1, 0xbba8, 0xc65f, 0xb7bc, 0xdccc, 0xc660, 0xc661, 0xdcc6, /*0xb0-0xb7*/ - 0xdcbf, 0xc7db, 0xc662, 0xc663, 0xc664, 0xd1bf, 0xdcc0, 0xc665, /*0xb8-0xbf*/ - 0xc666, 0xdcca, 0xc667, 0xc668, 0xdcd0, 0xc669, 0xc66a, 0xcead, /*0xc0-0xc7*/ - 0xdcc2, 0xc66b, 0xdcc3, 0xdcc8, 0xdcc9, 0xb2d4, 0xdcd1, 0xcbd5, /*0xc8-0xcf*/ - 0xc66c, 0xd4b7, 0xdcdb, 0xdcdf, 0xcca6, 0xdce6, 0xc66d, 0xc3e7, /*0xd0-0xd7*/ - 0xdcdc, 0xc66e, 0xc66f, 0xbfc1, 0xdcd9, 0xc670, 0xb0fa, 0xb9b6, /*0xd8-0xdf*/ - 0xdce5, 0xdcd3, 0xc671, 0xdcc4, 0xdcd6, 0xc8f4, 0xbfe0, 0xc672, /*0xe0-0xe7*/ - 0xc673, 0xc674, 0xc675, 0xc9bb, 0xc676, 0xc677, 0xc678, 0xb1bd, /*0xe8-0xef*/ - 0xc679, 0xd3a2, 0xc67a, 0xc67b, 0xdcda, 0xc67c, 0xc67d, 0xdcd5, /*0xf0-0xf7*/ - 0xc67e, 0xc6bb, 0xc680, 0xdcde, 0xc681, 0xc682, 0xc683, 0xc684, /*0xf8-0xff*/ - /* 0x8300 */ - 0xc685, 0xd7c2, 0xc3af, 0xb7b6, 0xc7d1, 0xc3a9, 0xdce2, 0xdcd8, /*0x00-0x07*/ - 0xdceb, 0xdcd4, 0xc686, 0xc687, 0xdcdd, 0xc688, 0xbea5, 0xdcd7, /*0x08-0x0f*/ - 0xc689, 0xdce0, 0xc68a, 0xc68b, 0xdce3, 0xdce4, 0xc68c, 0xdcf8, /*0x10-0x17*/ - 0xc68d, 0xc68e, 0xdce1, 0xdda2, 0xdce7, 0xc68f, 0xc690, 0xc691, /*0x18-0x1f*/ - 0xc692, 0xc693, 0xc694, 0xc695, 0xc696, 0xc697, 0xc698, 0xbceb, /*0x20-0x27*/ - 0xb4c4, 0xc699, 0xc69a, 0xc3a3, 0xb2e7, 0xdcfa, 0xc69b, 0xdcf2, /*0x28-0x2f*/ - 0xc69c, 0xdcef, 0xc69d, 0xdcfc, 0xdcee, 0xd2f0, 0xb2e8, 0xc69e, /*0x30-0x37*/ - 0xc8d7, 0xc8e3, 0xdcfb, 0xc69f, 0xdced, 0xc6a0, 0xc740, 0xc741, /*0x38-0x3f*/ - 0xdcf7, 0xc742, 0xc743, 0xdcf5, 0xc744, 0xc745, 0xbea3, 0xdcf4, /*0x40-0x47*/ - 0xc746, 0xb2dd, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xdcf3, /*0x48-0x4f*/ - 0xbcf6, 0xdce8, 0xbbc4, 0xc74c, 0xc0f3, 0xc74d, 0xc74e, 0xc74f, /*0x50-0x57*/ - 0xc750, 0xc751, 0xbcd4, 0xdce9, 0xdcea, 0xc752, 0xdcf1, 0xdcf6, /*0x58-0x5f*/ - 0xdcf9, 0xb5b4, 0xc753, 0xc8d9, 0xbbe7, 0xdcfe, 0xdcfd, 0xd3ab, /*0x60-0x67*/ - 0xdda1, 0xdda3, 0xdda5, 0xd2f1, 0xdda4, 0xdda6, 0xdda7, 0xd2a9, /*0x68-0x6f*/ - 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xbac9, /*0x70-0x77*/ - 0xdda9, 0xc75b, 0xc75c, 0xddb6, 0xddb1, 0xddb4, 0xc75d, 0xc75e, /*0x78-0x7f*/ - 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xddb0, 0xc6ce, 0xc764, /*0x80-0x87*/ - 0xc765, 0xc0f2, 0xc766, 0xc767, 0xc768, 0xc769, 0xc9af, 0xc76a, /*0x88-0x8f*/ - 0xc76b, 0xc76c, 0xdcec, 0xddae, 0xc76d, 0xc76e, 0xc76f, 0xc770, /*0x90-0x97*/ - 0xddb7, 0xc771, 0xc772, 0xdcf0, 0xddaf, 0xc773, 0xddb8, 0xc774, /*0x98-0x9f*/ - 0xddac, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, /*0xa0-0xa7*/ - 0xddb9, 0xddb3, 0xddad, 0xc4aa, 0xc77c, 0xc77d, 0xc77e, 0xc780, /*0xa8-0xaf*/ - 0xdda8, 0xc0b3, 0xc1ab, 0xddaa, 0xddab, 0xc781, 0xddb2, 0xbbf1, /*0xb0-0xb7*/ - 0xddb5, 0xd3a8, 0xddba, 0xc782, 0xddbb, 0xc3a7, 0xc783, 0xc784, /*0xb8-0xbf*/ - 0xddd2, 0xddbc, 0xc785, 0xc786, 0xc787, 0xddd1, 0xc788, 0xb9bd, /*0xc0-0xc7*/ - 0xc789, 0xc78a, 0xbed5, 0xc78b, 0xbefa, 0xc78c, 0xc78d, 0xbaca, /*0xc8-0xcf*/ - 0xc78e, 0xc78f, 0xc790, 0xc791, 0xddca, 0xc792, 0xddc5, 0xc793, /*0xd0-0xd7*/ - 0xddbf, 0xc794, 0xc795, 0xc796, 0xb2cb, 0xddc3, 0xc797, 0xddcb, /*0xd8-0xdf*/ - 0xb2a4, 0xddd5, 0xc798, 0xc799, 0xc79a, 0xddbe, 0xc79b, 0xc79c, /*0xe0-0xe7*/ - 0xc79d, 0xc6d0, 0xddd0, 0xc79e, 0xc79f, 0xc7a0, 0xc840, 0xc841, /*0xe8-0xef*/ - 0xddd4, 0xc1e2, 0xb7c6, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, /*0xf0-0xf7*/ - 0xddce, 0xddcf, 0xc847, 0xc848, 0xc849, 0xddc4, 0xc84a, 0xc84b, /*0xf8-0xff*/ - /* 0x8400 */ - 0xc84c, 0xddbd, 0xc84d, 0xddcd, 0xccd1, 0xc84e, 0xddc9, 0xc84f, /*0x00-0x07*/ - 0xc850, 0xc851, 0xc852, 0xddc2, 0xc3c8, 0xc6bc, 0xceae, 0xddcc, /*0x08-0x0f*/ - 0xc853, 0xddc8, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, /*0x10-0x17*/ - 0xddc1, 0xc85a, 0xc85b, 0xc85c, 0xddc6, 0xc2dc, 0xc85d, 0xc85e, /*0x18-0x1f*/ - 0xc85f, 0xc860, 0xc861, 0xc862, 0xd3a9, 0xd3aa, 0xddd3, 0xcff4, /*0x20-0x27*/ - 0xc8f8, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, /*0x28-0x2f*/ - 0xc86a, 0xdde6, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, /*0x30-0x37*/ - 0xddc7, 0xc871, 0xc872, 0xc873, 0xdde0, 0xc2e4, 0xc874, 0xc875, /*0x38-0x3f*/ - 0xc876, 0xc877, 0xc878, 0xc879, 0xc87a, 0xc87b, 0xdde1, 0xc87c, /*0x40-0x47*/ - 0xc87d, 0xc87e, 0xc880, 0xc881, 0xc882, 0xc883, 0xc884, 0xc885, /*0x48-0x4f*/ - 0xc886, 0xddd7, 0xc887, 0xc888, 0xc889, 0xc88a, 0xc88b, 0xd6f8, /*0x50-0x57*/ - 0xc88c, 0xddd9, 0xddd8, 0xb8f0, 0xddd6, 0xc88d, 0xc88e, 0xc88f, /*0x58-0x5f*/ - 0xc890, 0xc6cf, 0xc891, 0xb6ad, 0xc892, 0xc893, 0xc894, 0xc895, /*0x60-0x67*/ - 0xc896, 0xdde2, 0xc897, 0xbaf9, 0xd4e1, 0xdde7, 0xc898, 0xc899, /*0x68-0x6f*/ - 0xc89a, 0xb4d0, 0xc89b, 0xddda, 0xc89c, 0xbffb, 0xdde3, 0xc89d, /*0x70-0x77*/ - 0xdddf, 0xc89e, 0xdddd, 0xc89f, 0xc8a0, 0xc940, 0xc941, 0xc942, /*0x78-0x7f*/ - 0xc943, 0xc944, 0xb5d9, 0xc945, 0xc946, 0xc947, 0xc948, 0xdddb, /*0x80-0x87*/ - 0xdddc, 0xddde, 0xc949, 0xbdaf, 0xdde4, 0xc94a, 0xdde5, 0xc94b, /*0x88-0x8f*/ - 0xc94c, 0xc94d, 0xc94e, 0xc94f, 0xc950, 0xc951, 0xc952, 0xddf5, /*0x90-0x97*/ - 0xc953, 0xc3c9, 0xc954, 0xc955, 0xcbe2, 0xc956, 0xc957, 0xc958, /*0x98-0x9f*/ - 0xc959, 0xddf2, 0xc95a, 0xc95b, 0xc95c, 0xc95d, 0xc95e, 0xc95f, /*0xa0-0xa7*/ - 0xc960, 0xc961, 0xc962, 0xc963, 0xc964, 0xc965, 0xc966, 0xd8e1, /*0xa8-0xaf*/ - 0xc967, 0xc968, 0xc6d1, 0xc969, 0xddf4, 0xc96a, 0xc96b, 0xc96c, /*0xb0-0xb7*/ - 0xd5f4, 0xddf3, 0xddf0, 0xc96d, 0xc96e, 0xddec, 0xc96f, 0xddef, /*0xb8-0xbf*/ - 0xc970, 0xdde8, 0xc971, 0xc972, 0xd0ee, 0xc973, 0xc974, 0xc975, /*0xc0-0xc7*/ - 0xc976, 0xc8d8, 0xddee, 0xc977, 0xc978, 0xdde9, 0xc979, 0xc97a, /*0xc8-0xcf*/ - 0xddea, 0xcbf2, 0xc97b, 0xdded, 0xc97c, 0xc97d, 0xb1cd, 0xc97e, /*0xd0-0xd7*/ - 0xc980, 0xc981, 0xc982, 0xc983, 0xc984, 0xc0b6, 0xc985, 0xbcbb, /*0xd8-0xdf*/ - 0xddf1, 0xc986, 0xc987, 0xddf7, 0xc988, 0xddf6, 0xddeb, 0xc989, /*0xe0-0xe7*/ - 0xc98a, 0xc98b, 0xc98c, 0xc98d, 0xc5ee, 0xc98e, 0xc98f, 0xc990, /*0xe8-0xef*/ - 0xddfb, 0xc991, 0xc992, 0xc993, 0xc994, 0xc995, 0xc996, 0xc997, /*0xf0-0xf7*/ - 0xc998, 0xc999, 0xc99a, 0xc99b, 0xdea4, 0xc99c, 0xc99d, 0xdea3, /*0xf8-0xff*/ - /* 0x8500 */ - 0xc99e, 0xc99f, 0xc9a0, 0xca40, 0xca41, 0xca42, 0xca43, 0xca44, /*0x00-0x07*/ - 0xca45, 0xca46, 0xca47, 0xca48, 0xddf8, 0xca49, 0xca4a, 0xca4b, /*0x08-0x0f*/ - 0xca4c, 0xc3ef, 0xca4d, 0xc2fb, 0xca4e, 0xca4f, 0xca50, 0xd5e1, /*0x10-0x17*/ - 0xca51, 0xca52, 0xceb5, 0xca53, 0xca54, 0xca55, 0xca56, 0xddfd, /*0x18-0x1f*/ - 0xca57, 0xb2cc, 0xca58, 0xca59, 0xca5a, 0xca5b, 0xca5c, 0xca5d, /*0x20-0x27*/ - 0xca5e, 0xca5f, 0xca60, 0xc4e8, 0xcadf, 0xca61, 0xca62, 0xca63, /*0x28-0x2f*/ - 0xca64, 0xca65, 0xca66, 0xca67, 0xca68, 0xca69, 0xca6a, 0xc7be, /*0x30-0x37*/ - 0xddfa, 0xddfc, 0xddfe, 0xdea2, 0xb0aa, 0xb1ce, 0xca6b, 0xca6c, /*0x38-0x3f*/ - 0xca6d, 0xca6e, 0xca6f, 0xdeac, 0xca70, 0xca71, 0xca72, 0xca73, /*0x40-0x47*/ - 0xdea6, 0xbdb6, 0xc8ef, 0xca74, 0xca75, 0xca76, 0xca77, 0xca78, /*0x48-0x4f*/ - 0xca79, 0xca7a, 0xca7b, 0xca7c, 0xca7d, 0xca7e, 0xdea1, 0xca80, /*0x50-0x57*/ - 0xca81, 0xdea5, 0xca82, 0xca83, 0xca84, 0xca85, 0xdea9, 0xca86, /*0x58-0x5f*/ - 0xca87, 0xca88, 0xca89, 0xca8a, 0xdea8, 0xca8b, 0xca8c, 0xca8d, /*0x60-0x67*/ - 0xdea7, 0xca8e, 0xca8f, 0xca90, 0xca91, 0xca92, 0xca93, 0xca94, /*0x68-0x6f*/ - 0xca95, 0xca96, 0xdead, 0xca97, 0xd4cc, 0xca98, 0xca99, 0xca9a, /*0x70-0x77*/ - 0xca9b, 0xdeb3, 0xdeaa, 0xdeae, 0xca9c, 0xca9d, 0xc0d9, 0xca9e, /*0x78-0x7f*/ - 0xca9f, 0xcaa0, 0xcb40, 0xcb41, 0xb1a1, 0xdeb6, 0xcb42, 0xdeb1, /*0x80-0x87*/ - 0xcb43, 0xcb44, 0xcb45, 0xcb46, 0xcb47, 0xcb48, 0xcb49, 0xdeb2, /*0x88-0x8f*/ - 0xcb4a, 0xcb4b, 0xcb4c, 0xcb4d, 0xcb4e, 0xcb4f, 0xcb50, 0xcb51, /*0x90-0x97*/ - 0xcb52, 0xcb53, 0xcb54, 0xd1a6, 0xdeb5, 0xcb55, 0xcb56, 0xcb57, /*0x98-0x9f*/ - 0xcb58, 0xcb59, 0xcb5a, 0xcb5b, 0xdeaf, 0xcb5c, 0xcb5d, 0xcb5e, /*0xa0-0xa7*/ - 0xdeb0, 0xcb5f, 0xd0bd, 0xcb60, 0xcb61, 0xcb62, 0xdeb4, 0xcaed, /*0xa8-0xaf*/ - 0xdeb9, 0xcb63, 0xcb64, 0xcb65, 0xcb66, 0xcb67, 0xcb68, 0xdeb8, /*0xb0-0xb7*/ - 0xcb69, 0xdeb7, 0xcb6a, 0xcb6b, 0xcb6c, 0xcb6d, 0xcb6e, 0xcb6f, /*0xb8-0xbf*/ - 0xcb70, 0xdebb, 0xcb71, 0xcb72, 0xcb73, 0xcb74, 0xcb75, 0xcb76, /*0xc0-0xc7*/ - 0xcb77, 0xbde5, 0xcb78, 0xcb79, 0xcb7a, 0xcb7b, 0xcb7c, 0xb2d8, /*0xc8-0xcf*/ - 0xc3ea, 0xcb7d, 0xcb7e, 0xdeba, 0xcb80, 0xc5ba, 0xcb81, 0xcb82, /*0xd0-0xd7*/ - 0xcb83, 0xcb84, 0xcb85, 0xcb86, 0xdebc, 0xcb87, 0xcb88, 0xcb89, /*0xd8-0xdf*/ - 0xcb8a, 0xcb8b, 0xcb8c, 0xcb8d, 0xccd9, 0xcb8e, 0xcb8f, 0xcb90, /*0xe0-0xe7*/ - 0xcb91, 0xb7aa, 0xcb92, 0xcb93, 0xcb94, 0xcb95, 0xcb96, 0xcb97, /*0xe8-0xef*/ - 0xcb98, 0xcb99, 0xcb9a, 0xcb9b, 0xcb9c, 0xcb9d, 0xcb9e, 0xcb9f, /*0xf0-0xf7*/ - 0xcba0, 0xcc40, 0xcc41, 0xd4e5, 0xcc42, 0xcc43, 0xcc44, 0xdebd, /*0xf8-0xff*/ - /* 0x8600 */ - 0xcc45, 0xcc46, 0xcc47, 0xcc48, 0xcc49, 0xdebf, 0xcc4a, 0xcc4b, /*0x00-0x07*/ - 0xcc4c, 0xcc4d, 0xcc4e, 0xcc4f, 0xcc50, 0xcc51, 0xcc52, 0xcc53, /*0x08-0x0f*/ - 0xcc54, 0xc4a2, 0xcc55, 0xcc56, 0xcc57, 0xcc58, 0xdec1, 0xcc59, /*0x10-0x17*/ - 0xcc5a, 0xcc5b, 0xcc5c, 0xcc5d, 0xcc5e, 0xcc5f, 0xcc60, 0xcc61, /*0x18-0x1f*/ - 0xcc62, 0xcc63, 0xcc64, 0xcc65, 0xcc66, 0xcc67, 0xcc68, 0xdebe, /*0x20-0x27*/ - 0xcc69, 0xdec0, 0xcc6a, 0xcc6b, 0xcc6c, 0xcc6d, 0xcc6e, 0xcc6f, /*0x28-0x2f*/ - 0xcc70, 0xcc71, 0xcc72, 0xcc73, 0xcc74, 0xcc75, 0xcc76, 0xcc77, /*0x30-0x37*/ - 0xd5ba, 0xcc78, 0xcc79, 0xcc7a, 0xdec2, 0xcc7b, 0xcc7c, 0xcc7d, /*0x38-0x3f*/ - 0xcc7e, 0xcc80, 0xcc81, 0xcc82, 0xcc83, 0xcc84, 0xcc85, 0xcc86, /*0x40-0x47*/ - 0xcc87, 0xcc88, 0xcc89, 0xcc8a, 0xcc8b, 0xf2ae, 0xbba2, 0xc2b2, /*0x48-0x4f*/ - 0xc5b0, 0xc2c7, 0xcc8c, 0xcc8d, 0xf2af, 0xcc8e, 0xcc8f, 0xcc90, /*0x50-0x57*/ - 0xcc91, 0xcc92, 0xd0e9, 0xcc93, 0xcc94, 0xcc95, 0xd3dd, 0xcc96, /*0x58-0x5f*/ - 0xcc97, 0xcc98, 0xebbd, 0xcc99, 0xcc9a, 0xcc9b, 0xcc9c, 0xcc9d, /*0x60-0x67*/ - 0xcc9e, 0xcc9f, 0xcca0, 0xb3e6, 0xf2b0, 0xcd40, 0xf2b1, 0xcd41, /*0x68-0x6f*/ - 0xcd42, 0xcaad, 0xcd43, 0xcd44, 0xcd45, 0xcd46, 0xcd47, 0xcd48, /*0x70-0x77*/ - 0xcd49, 0xbae7, 0xf2b3, 0xf2b5, 0xf2b4, 0xcbe4, 0xcfba, 0xf2b2, /*0x78-0x7f*/ - 0xcab4, 0xd2cf, 0xc2ec, 0xcd4a, 0xcd4b, 0xcd4c, 0xcd4d, 0xcd4e, /*0x80-0x87*/ - 0xcd4f, 0xcd50, 0xcec3, 0xf2b8, 0xb0f6, 0xf2b7, 0xcd51, 0xcd52, /*0x88-0x8f*/ - 0xcd53, 0xcd54, 0xcd55, 0xf2be, 0xcd56, 0xb2cf, 0xcd57, 0xcd58, /*0x90-0x97*/ - 0xcd59, 0xcd5a, 0xcd5b, 0xcd5c, 0xd1c1, 0xf2ba, 0xcd5d, 0xcd5e, /*0x98-0x9f*/ - 0xcd5f, 0xcd60, 0xcd61, 0xf2bc, 0xd4e9, 0xcd62, 0xcd63, 0xf2bb, /*0xa0-0xa7*/ - 0xf2b6, 0xf2bf, 0xf2bd, 0xcd64, 0xf2b9, 0xcd65, 0xcd66, 0xf2c7, /*0xa8-0xaf*/ - 0xf2c4, 0xf2c6, 0xcd67, 0xcd68, 0xf2ca, 0xf2c2, 0xf2c0, 0xcd69, /*0xb0-0xb7*/ - 0xcd6a, 0xcd6b, 0xf2c5, 0xcd6c, 0xcd6d, 0xcd6e, 0xcd6f, 0xcd70, /*0xb8-0xbf*/ - 0xd6fb, 0xcd71, 0xcd72, 0xcd73, 0xf2c1, 0xcd74, 0xc7f9, 0xc9df, /*0xc0-0xc7*/ - 0xcd75, 0xf2c8, 0xb9c6, 0xb5b0, 0xcd76, 0xcd77, 0xf2c3, 0xf2c9, /*0xc8-0xcf*/ - 0xf2d0, 0xf2d6, 0xcd78, 0xcd79, 0xbbd7, 0xcd7a, 0xcd7b, 0xcd7c, /*0xd0-0xd7*/ - 0xf2d5, 0xcddc, 0xcd7d, 0xd6eb, 0xcd7e, 0xcd80, 0xf2d2, 0xf2d4, /*0xd8-0xdf*/ - 0xcd81, 0xcd82, 0xcd83, 0xcd84, 0xb8f2, 0xcd85, 0xcd86, 0xcd87, /*0xe0-0xe7*/ - 0xcd88, 0xf2cb, 0xcd89, 0xcd8a, 0xcd8b, 0xf2ce, 0xc2f9, 0xcd8c, /*0xe8-0xef*/ - 0xd5dd, 0xf2cc, 0xf2cd, 0xf2cf, 0xf2d3, 0xcd8d, 0xcd8e, 0xcd8f, /*0xf0-0xf7*/ - 0xf2d9, 0xd3bc, 0xcd90, 0xcd91, 0xcd92, 0xcd93, 0xb6ea, 0xcd94, /*0xf8-0xff*/ - /* 0x8700 */ - 0xcaf1, 0xcd95, 0xb7e4, 0xf2d7, 0xcd96, 0xcd97, 0xcd98, 0xf2d8, /*0x00-0x07*/ - 0xf2da, 0xf2dd, 0xf2db, 0xcd99, 0xcd9a, 0xf2dc, 0xcd9b, 0xcd9c, /*0x08-0x0f*/ - 0xcd9d, 0xcd9e, 0xd1d1, 0xf2d1, 0xcd9f, 0xcdc9, 0xcda0, 0xcecf, /*0x10-0x17*/ - 0xd6a9, 0xce40, 0xf2e3, 0xce41, 0xc3db, 0xce42, 0xf2e0, 0xce43, /*0x18-0x1f*/ - 0xce44, 0xc0af, 0xf2ec, 0xf2de, 0xce45, 0xf2e1, 0xce46, 0xce47, /*0x20-0x27*/ - 0xce48, 0xf2e8, 0xce49, 0xce4a, 0xce4b, 0xce4c, 0xf2e2, 0xce4d, /*0x28-0x2f*/ - 0xce4e, 0xf2e7, 0xce4f, 0xce50, 0xf2e6, 0xce51, 0xce52, 0xf2e9, /*0x30-0x37*/ - 0xce53, 0xce54, 0xce55, 0xf2df, 0xce56, 0xce57, 0xf2e4, 0xf2ea, /*0x38-0x3f*/ - 0xce58, 0xce59, 0xce5a, 0xce5b, 0xce5c, 0xce5d, 0xce5e, 0xd3ac, /*0x40-0x47*/ - 0xf2e5, 0xb2f5, 0xce5f, 0xce60, 0xf2f2, 0xce61, 0xd0ab, 0xce62, /*0x48-0x4f*/ - 0xce63, 0xce64, 0xce65, 0xf2f5, 0xce66, 0xce67, 0xce68, 0xbbc8, /*0x50-0x57*/ - 0xce69, 0xf2f9, 0xce6a, 0xce6b, 0xce6c, 0xce6d, 0xce6e, 0xce6f, /*0x58-0x5f*/ - 0xf2f0, 0xce70, 0xce71, 0xf2f6, 0xf2f8, 0xf2fa, 0xce72, 0xce73, /*0x60-0x67*/ - 0xce74, 0xce75, 0xce76, 0xce77, 0xce78, 0xce79, 0xf2f3, 0xce7a, /*0x68-0x6f*/ - 0xf2f1, 0xce7b, 0xce7c, 0xce7d, 0xbafb, 0xce7e, 0xb5fb, 0xce80, /*0x70-0x77*/ - 0xce81, 0xce82, 0xce83, 0xf2ef, 0xf2f7, 0xf2ed, 0xf2ee, 0xce84, /*0x78-0x7f*/ - 0xce85, 0xce86, 0xf2eb, 0xf3a6, 0xce87, 0xf3a3, 0xce88, 0xce89, /*0x80-0x87*/ - 0xf3a2, 0xce8a, 0xce8b, 0xf2f4, 0xce8c, 0xc8da, 0xce8d, 0xce8e, /*0x88-0x8f*/ - 0xce8f, 0xce90, 0xce91, 0xf2fb, 0xce92, 0xce93, 0xce94, 0xf3a5, /*0x90-0x97*/ - 0xce95, 0xce96, 0xce97, 0xce98, 0xce99, 0xce9a, 0xce9b, 0xc3f8, /*0x98-0x9f*/ - 0xce9c, 0xce9d, 0xce9e, 0xce9f, 0xcea0, 0xcf40, 0xcf41, 0xcf42, /*0xa0-0xa7*/ - 0xf2fd, 0xcf43, 0xcf44, 0xf3a7, 0xf3a9, 0xf3a4, 0xcf45, 0xf2fc, /*0xa8-0xaf*/ - 0xcf46, 0xcf47, 0xcf48, 0xf3ab, 0xcf49, 0xf3aa, 0xcf4a, 0xcf4b, /*0xb0-0xb7*/ - 0xcf4c, 0xcf4d, 0xc2dd, 0xcf4e, 0xcf4f, 0xf3ae, 0xcf50, 0xcf51, /*0xb8-0xbf*/ - 0xf3b0, 0xcf52, 0xcf53, 0xcf54, 0xcf55, 0xcf56, 0xf3a1, 0xcf57, /*0xc0-0xc7*/ - 0xcf58, 0xcf59, 0xf3b1, 0xf3ac, 0xcf5a, 0xcf5b, 0xcf5c, 0xcf5d, /*0xc8-0xcf*/ - 0xcf5e, 0xf3af, 0xf2fe, 0xf3ad, 0xcf5f, 0xcf60, 0xcf61, 0xcf62, /*0xd0-0xd7*/ - 0xcf63, 0xcf64, 0xcf65, 0xf3b2, 0xcf66, 0xcf67, 0xcf68, 0xcf69, /*0xd8-0xdf*/ - 0xf3b4, 0xcf6a, 0xcf6b, 0xcf6c, 0xcf6d, 0xf3a8, 0xcf6e, 0xcf6f, /*0xe0-0xe7*/ - 0xcf70, 0xcf71, 0xf3b3, 0xcf72, 0xcf73, 0xcf74, 0xf3b5, 0xcf75, /*0xe8-0xef*/ - 0xcf76, 0xcf77, 0xcf78, 0xcf79, 0xcf7a, 0xcf7b, 0xcf7c, 0xcf7d, /*0xf0-0xf7*/ - 0xcf7e, 0xd0b7, 0xcf80, 0xcf81, 0xcf82, 0xcf83, 0xf3b8, 0xcf84, /*0xf8-0xff*/ - /* 0x8800 */ - 0xcf85, 0xcf86, 0xcf87, 0xd9f9, 0xcf88, 0xcf89, 0xcf8a, 0xcf8b, /*0x00-0x07*/ - 0xcf8c, 0xcf8d, 0xf3b9, 0xcf8e, 0xcf8f, 0xcf90, 0xcf91, 0xcf92, /*0x08-0x0f*/ - 0xcf93, 0xcf94, 0xcf95, 0xf3b7, 0xcf96, 0xc8e4, 0xf3b6, 0xcf97, /*0x10-0x17*/ - 0xcf98, 0xcf99, 0xcf9a, 0xf3ba, 0xcf9b, 0xcf9c, 0xcf9d, 0xcf9e, /*0x18-0x1f*/ - 0xcf9f, 0xf3bb, 0xb4c0, 0xcfa0, 0xd040, 0xd041, 0xd042, 0xd043, /*0x20-0x27*/ - 0xd044, 0xd045, 0xd046, 0xd047, 0xd048, 0xd049, 0xd04a, 0xd04b, /*0x28-0x2f*/ - 0xd04c, 0xd04d, 0xeec3, 0xd04e, 0xd04f, 0xd050, 0xd051, 0xd052, /*0x30-0x37*/ - 0xd053, 0xf3bc, 0xd054, 0xd055, 0xf3bd, 0xd056, 0xd057, 0xd058, /*0x38-0x3f*/ - 0xd1aa, 0xd059, 0xd05a, 0xd05b, 0xf4ac, 0xd0c6, 0xd05c, 0xd05d, /*0x40-0x47*/ - 0xd05e, 0xd05f, 0xd060, 0xd061, 0xd0d0, 0xd1dc, 0xd062, 0xd063, /*0x48-0x4f*/ - 0xd064, 0xd065, 0xd066, 0xd067, 0xcfce, 0xd068, 0xd069, 0xbdd6, /*0x50-0x57*/ - 0xd06a, 0xd1c3, 0xd06b, 0xd06c, 0xd06d, 0xd06e, 0xd06f, 0xd070, /*0x58-0x5f*/ - 0xd071, 0xbae2, 0xe1e9, 0xd2c2, 0xf1c2, 0xb2b9, 0xd072, 0xd073, /*0x60-0x67*/ - 0xb1ed, 0xf1c3, 0xd074, 0xc9c0, 0xb3c4, 0xd075, 0xd9f2, 0xd076, /*0x68-0x6f*/ - 0xcba5, 0xd077, 0xf1c4, 0xd078, 0xd079, 0xd07a, 0xd07b, 0xd6d4, /*0x70-0x77*/ - 0xd07c, 0xd07d, 0xd07e, 0xd080, 0xd081, 0xf1c5, 0xf4c0, 0xf1c6, /*0x78-0x7f*/ - 0xd082, 0xd4ac, 0xf1c7, 0xd083, 0xb0c0, 0xf4c1, 0xd084, 0xd085, /*0x80-0x87*/ - 0xf4c2, 0xd086, 0xd087, 0xb4fc, 0xd088, 0xc5db, 0xd089, 0xd08a, /*0x88-0x8f*/ - 0xd08b, 0xd08c, 0xccbb, 0xd08d, 0xd08e, 0xd08f, 0xd0e4, 0xd090, /*0x90-0x97*/ - 0xd091, 0xd092, 0xd093, 0xd094, 0xcde0, 0xd095, 0xd096, 0xd097, /*0x98-0x9f*/ - 0xd098, 0xd099, 0xf1c8, 0xd09a, 0xd9f3, 0xd09b, 0xd09c, 0xd09d, /*0xa0-0xa7*/ - 0xd09e, 0xd09f, 0xd0a0, 0xb1bb, 0xd140, 0xcfae, 0xd141, 0xd142, /*0xa8-0xaf*/ - 0xd143, 0xb8a4, 0xd144, 0xd145, 0xd146, 0xd147, 0xd148, 0xf1ca, /*0xb0-0xb7*/ - 0xd149, 0xd14a, 0xd14b, 0xd14c, 0xf1cb, 0xd14d, 0xd14e, 0xd14f, /*0xb8-0xbf*/ - 0xd150, 0xb2c3, 0xc1d1, 0xd151, 0xd152, 0xd7b0, 0xf1c9, 0xd153, /*0xc0-0xc7*/ - 0xd154, 0xf1cc, 0xd155, 0xd156, 0xd157, 0xd158, 0xf1ce, 0xd159, /*0xc8-0xcf*/ - 0xd15a, 0xd15b, 0xd9f6, 0xd15c, 0xd2e1, 0xd4a3, 0xd15d, 0xd15e, /*0xd0-0xd7*/ - 0xf4c3, 0xc8b9, 0xd15f, 0xd160, 0xd161, 0xd162, 0xd163, 0xf4c4, /*0xd8-0xdf*/ - 0xd164, 0xd165, 0xf1cd, 0xf1cf, 0xbfe3, 0xf1d0, 0xd166, 0xd167, /*0xe0-0xe7*/ - 0xf1d4, 0xd168, 0xd169, 0xd16a, 0xd16b, 0xd16c, 0xd16d, 0xd16e, /*0xe8-0xef*/ - 0xf1d6, 0xf1d1, 0xd16f, 0xc9d1, 0xc5e1, 0xd170, 0xd171, 0xd172, /*0xf0-0xf7*/ - 0xc2e3, 0xb9fc, 0xd173, 0xd174, 0xf1d3, 0xd175, 0xf1d5, 0xd176, /*0xf8-0xff*/ - /* 0x8900 */ - 0xd177, 0xd178, 0xb9d3, 0xd179, 0xd17a, 0xd17b, 0xd17c, 0xd17d, /*0x00-0x07*/ - 0xd17e, 0xd180, 0xf1db, 0xd181, 0xd182, 0xd183, 0xd184, 0xd185, /*0x08-0x0f*/ - 0xbad6, 0xd186, 0xb0fd, 0xf1d9, 0xd187, 0xd188, 0xd189, 0xd18a, /*0x10-0x17*/ - 0xd18b, 0xf1d8, 0xf1d2, 0xf1da, 0xd18c, 0xd18d, 0xd18e, 0xd18f, /*0x18-0x1f*/ - 0xd190, 0xf1d7, 0xd191, 0xd192, 0xd193, 0xc8ec, 0xd194, 0xd195, /*0x20-0x27*/ - 0xd196, 0xd197, 0xcdca, 0xf1dd, 0xd198, 0xd199, 0xd19a, 0xd19b, /*0x28-0x2f*/ - 0xe5bd, 0xd19c, 0xd19d, 0xd19e, 0xf1dc, 0xd19f, 0xf1de, 0xd1a0, /*0x30-0x37*/ - 0xd240, 0xd241, 0xd242, 0xd243, 0xd244, 0xd245, 0xd246, 0xd247, /*0x38-0x3f*/ - 0xd248, 0xf1df, 0xd249, 0xd24a, 0xcfe5, 0xd24b, 0xd24c, 0xd24d, /*0x40-0x47*/ - 0xd24e, 0xd24f, 0xd250, 0xd251, 0xd252, 0xd253, 0xd254, 0xd255, /*0x48-0x4f*/ - 0xd256, 0xd257, 0xd258, 0xd259, 0xd25a, 0xd25b, 0xd25c, 0xd25d, /*0x50-0x57*/ - 0xd25e, 0xd25f, 0xd260, 0xd261, 0xd262, 0xd263, 0xf4c5, 0xbdf3, /*0x58-0x5f*/ - 0xd264, 0xd265, 0xd266, 0xd267, 0xd268, 0xd269, 0xf1e0, 0xd26a, /*0x60-0x67*/ - 0xd26b, 0xd26c, 0xd26d, 0xd26e, 0xd26f, 0xd270, 0xd271, 0xd272, /*0x68-0x6f*/ - 0xd273, 0xd274, 0xd275, 0xd276, 0xd277, 0xd278, 0xd279, 0xd27a, /*0x70-0x77*/ - 0xd27b, 0xd27c, 0xd27d, 0xf1e1, 0xd27e, 0xd280, 0xd281, 0xcef7, /*0x78-0x7f*/ - 0xd282, 0xd2aa, 0xd283, 0xf1fb, 0xd284, 0xd285, 0xb8b2, 0xd286, /*0x80-0x87*/ - 0xd287, 0xd288, 0xd289, 0xd28a, 0xd28b, 0xd28c, 0xd28d, 0xd28e, /*0x88-0x8f*/ - 0xd28f, 0xd290, 0xd291, 0xd292, 0xd293, 0xd294, 0xd295, 0xd296, /*0x90-0x97*/ - 0xd297, 0xd298, 0xd299, 0xd29a, 0xd29b, 0xd29c, 0xd29d, 0xd29e, /*0x98-0x9f*/ - 0xd29f, 0xd2a0, 0xd340, 0xd341, 0xd342, 0xd343, 0xd344, 0xd345, /*0xa0-0xa7*/ - 0xd346, 0xd347, 0xd348, 0xd349, 0xd34a, 0xd34b, 0xd34c, 0xd34d, /*0xa8-0xaf*/ - 0xd34e, 0xd34f, 0xd350, 0xd351, 0xd352, 0xd353, 0xd354, 0xd355, /*0xb0-0xb7*/ - 0xd356, 0xd357, 0xd358, 0xd359, 0xd35a, 0xd35b, 0xd35c, 0xd35d, /*0xb8-0xbf*/ - 0xd35e, 0xbcfb, 0xb9db, 0xd35f, 0xb9e6, 0xc3d9, 0xcad3, 0xeae8, /*0xc0-0xc7*/ - 0xc0c0, 0xbef5, 0xeae9, 0xeaea, 0xeaeb, 0xd360, 0xeaec, 0xeaed, /*0xc8-0xcf*/ - 0xeaee, 0xeaef, 0xbdc7, 0xd361, 0xd362, 0xd363, 0xf5fb, 0xd364, /*0xd0-0xd7*/ - 0xd365, 0xd366, 0xf5fd, 0xd367, 0xf5fe, 0xd368, 0xf5fc, 0xd369, /*0xd8-0xdf*/ - 0xd36a, 0xd36b, 0xd36c, 0xbde2, 0xd36d, 0xf6a1, 0xb4a5, 0xd36e, /*0xe0-0xe7*/ - 0xd36f, 0xd370, 0xd371, 0xf6a2, 0xd372, 0xd373, 0xd374, 0xf6a3, /*0xe8-0xef*/ - 0xd375, 0xd376, 0xd377, 0xecb2, 0xd378, 0xd379, 0xd37a, 0xd37b, /*0xf0-0xf7*/ - 0xd37c, 0xd37d, 0xd37e, 0xd380, 0xd381, 0xd382, 0xd383, 0xd384, /*0xf8-0xff*/ - /* 0x8a00 */ - 0xd1d4, 0xd385, 0xd386, 0xd387, 0xd388, 0xd389, 0xd38a, 0xd9ea, /*0x00-0x07*/ - 0xd38b, 0xd38c, 0xd38d, 0xd38e, 0xd38f, 0xd390, 0xd391, 0xd392, /*0x08-0x0f*/ - 0xd393, 0xd394, 0xd395, 0xd396, 0xd397, 0xd398, 0xd399, 0xd39a, /*0x10-0x17*/ - 0xd39b, 0xd39c, 0xd39d, 0xd39e, 0xd39f, 0xd3a0, 0xd440, 0xd441, /*0x18-0x1f*/ - 0xd442, 0xd443, 0xd444, 0xd445, 0xd446, 0xd447, 0xd448, 0xd449, /*0x20-0x27*/ - 0xd44a, 0xd44b, 0xd44c, 0xd44d, 0xd44e, 0xd44f, 0xd450, 0xd451, /*0x28-0x2f*/ - 0xd452, 0xd453, 0xd454, 0xd455, 0xd456, 0xd457, 0xd458, 0xd459, /*0x30-0x37*/ - 0xd45a, 0xd45b, 0xd45c, 0xd45d, 0xd45e, 0xd45f, 0xf6a4, 0xd460, /*0x38-0x3f*/ - 0xd461, 0xd462, 0xd463, 0xd464, 0xd465, 0xd466, 0xd467, 0xd468, /*0x40-0x47*/ - 0xeeba, 0xd469, 0xd46a, 0xd46b, 0xd46c, 0xd46d, 0xd46e, 0xd46f, /*0x48-0x4f*/ - 0xd470, 0xd471, 0xd472, 0xd473, 0xd474, 0xd475, 0xd476, 0xd477, /*0x50-0x57*/ - 0xd478, 0xd479, 0xd47a, 0xd47b, 0xd47c, 0xd47d, 0xd47e, 0xd480, /*0x58-0x5f*/ - 0xd481, 0xd482, 0xd483, 0xd484, 0xd485, 0xd486, 0xd487, 0xd488, /*0x60-0x67*/ - 0xd489, 0xd48a, 0xd48b, 0xd48c, 0xd48d, 0xd48e, 0xd48f, 0xd490, /*0x68-0x6f*/ - 0xd491, 0xd492, 0xd493, 0xd494, 0xd495, 0xd496, 0xd497, 0xd498, /*0x70-0x77*/ - 0xd499, 0xd5b2, 0xd49a, 0xd49b, 0xd49c, 0xd49d, 0xd49e, 0xd49f, /*0x78-0x7f*/ - 0xd4a0, 0xd540, 0xd541, 0xd542, 0xd543, 0xd544, 0xd545, 0xd546, /*0x80-0x87*/ - 0xd547, 0xd3fe, 0xccdc, 0xd548, 0xd549, 0xd54a, 0xd54b, 0xd54c, /*0x88-0x8f*/ - 0xd54d, 0xd54e, 0xd54f, 0xcac4, 0xd550, 0xd551, 0xd552, 0xd553, /*0x90-0x97*/ - 0xd554, 0xd555, 0xd556, 0xd557, 0xd558, 0xd559, 0xd55a, 0xd55b, /*0x98-0x9f*/ - 0xd55c, 0xd55d, 0xd55e, 0xd55f, 0xd560, 0xd561, 0xd562, 0xd563, /*0xa0-0xa7*/ - 0xd564, 0xd565, 0xd566, 0xd567, 0xd568, 0xd569, 0xd56a, 0xd56b, /*0xa8-0xaf*/ - 0xd56c, 0xd56d, 0xd56e, 0xd56f, 0xd570, 0xd571, 0xd572, 0xd573, /*0xb0-0xb7*/ - 0xd574, 0xd575, 0xd576, 0xd577, 0xd578, 0xd579, 0xd57a, 0xd57b, /*0xb8-0xbf*/ - 0xd57c, 0xd57d, 0xd57e, 0xd580, 0xd581, 0xd582, 0xd583, 0xd584, /*0xc0-0xc7*/ - 0xd585, 0xd586, 0xd587, 0xd588, 0xd589, 0xd58a, 0xd58b, 0xd58c, /*0xc8-0xcf*/ - 0xd58d, 0xd58e, 0xd58f, 0xd590, 0xd591, 0xd592, 0xd593, 0xd594, /*0xd0-0xd7*/ - 0xd595, 0xd596, 0xd597, 0xd598, 0xd599, 0xd59a, 0xd59b, 0xd59c, /*0xd8-0xdf*/ - 0xd59d, 0xd59e, 0xd59f, 0xd5a0, 0xd640, 0xd641, 0xd642, 0xd643, /*0xe0-0xe7*/ - 0xd644, 0xd645, 0xd646, 0xd647, 0xd648, 0xd649, 0xd64a, 0xd64b, /*0xe8-0xef*/ - 0xd64c, 0xd64d, 0xd64e, 0xd64f, 0xd650, 0xd651, 0xd652, 0xd653, /*0xf0-0xf7*/ - 0xd654, 0xd655, 0xd656, 0xd657, 0xd658, 0xd659, 0xd65a, 0xd65b, /*0xf8-0xff*/ - /* 0x8b00 */ - 0xd65c, 0xd65d, 0xd65e, 0xd65f, 0xd660, 0xd661, 0xd662, 0xe5c0, /*0x00-0x07*/ - 0xd663, 0xd664, 0xd665, 0xd666, 0xd667, 0xd668, 0xd669, 0xd66a, /*0x08-0x0f*/ - 0xd66b, 0xd66c, 0xd66d, 0xd66e, 0xd66f, 0xd670, 0xd671, 0xd672, /*0x10-0x17*/ - 0xd673, 0xd674, 0xd675, 0xd676, 0xd677, 0xd678, 0xd679, 0xd67a, /*0x18-0x1f*/ - 0xd67b, 0xd67c, 0xd67d, 0xd67e, 0xd680, 0xd681, 0xf6a5, 0xd682, /*0x20-0x27*/ - 0xd683, 0xd684, 0xd685, 0xd686, 0xd687, 0xd688, 0xd689, 0xd68a, /*0x28-0x2f*/ - 0xd68b, 0xd68c, 0xd68d, 0xd68e, 0xd68f, 0xd690, 0xd691, 0xd692, /*0x30-0x37*/ - 0xd693, 0xd694, 0xd695, 0xd696, 0xd697, 0xd698, 0xd699, 0xd69a, /*0x38-0x3f*/ - 0xd69b, 0xd69c, 0xd69d, 0xd69e, 0xd69f, 0xd6a0, 0xd740, 0xd741, /*0x40-0x47*/ - 0xd742, 0xd743, 0xd744, 0xd745, 0xd746, 0xd747, 0xd748, 0xd749, /*0x48-0x4f*/ - 0xd74a, 0xd74b, 0xd74c, 0xd74d, 0xd74e, 0xd74f, 0xd750, 0xd751, /*0x50-0x57*/ - 0xd752, 0xd753, 0xd754, 0xd755, 0xd756, 0xd757, 0xd758, 0xd759, /*0x58-0x5f*/ - 0xd75a, 0xd75b, 0xd75c, 0xd75d, 0xd75e, 0xd75f, 0xbeaf, 0xd760, /*0x60-0x67*/ - 0xd761, 0xd762, 0xd763, 0xd764, 0xc6a9, 0xd765, 0xd766, 0xd767, /*0x68-0x6f*/ - 0xd768, 0xd769, 0xd76a, 0xd76b, 0xd76c, 0xd76d, 0xd76e, 0xd76f, /*0x70-0x77*/ - 0xd770, 0xd771, 0xd772, 0xd773, 0xd774, 0xd775, 0xd776, 0xd777, /*0x78-0x7f*/ - 0xd778, 0xd779, 0xd77a, 0xd77b, 0xd77c, 0xd77d, 0xd77e, 0xd780, /*0x80-0x87*/ - 0xd781, 0xd782, 0xd783, 0xd784, 0xd785, 0xd786, 0xd787, 0xd788, /*0x88-0x8f*/ - 0xd789, 0xd78a, 0xd78b, 0xd78c, 0xd78d, 0xd78e, 0xd78f, 0xd790, /*0x90-0x97*/ - 0xd791, 0xd792, 0xd793, 0xd794, 0xd795, 0xd796, 0xd797, 0xd798, /*0x98-0x9f*/ - 0xdaa5, 0xbcc6, 0xb6a9, 0xb8bc, 0xc8cf, 0xbca5, 0xdaa6, 0xdaa7, /*0xa0-0xa7*/ - 0xccd6, 0xc8c3, 0xdaa8, 0xc6fd, 0xd799, 0xd1b5, 0xd2e9, 0xd1b6, /*0xa8-0xaf*/ - 0xbcc7, 0xd79a, 0xbdb2, 0xbbe4, 0xdaa9, 0xdaaa, 0xd1c8, 0xdaab, /*0xb0-0xb7*/ - 0xd0ed, 0xb6ef, 0xc2db, 0xd79b, 0xcbcf, 0xb7ed, 0xc9e8, 0xb7c3, /*0xb8-0xbf*/ - 0xbef7, 0xd6a4, 0xdaac, 0xdaad, 0xc6c0, 0xd7e7, 0xcab6, 0xd79c, /*0xc0-0xc7*/ - 0xd5a9, 0xcbdf, 0xd5ef, 0xdaae, 0xd6df, 0xb4ca, 0xdab0, 0xdaaf, /*0xc8-0xcf*/ - 0xd79d, 0xd2eb, 0xdab1, 0xdab2, 0xdab3, 0xcad4, 0xdab4, 0xcaab, /*0xd0-0xd7*/ - 0xdab5, 0xdab6, 0xb3cf, 0xd6ef, 0xdab7, 0xbbb0, 0xb5ae, 0xdab8, /*0xd8-0xdf*/ - 0xdab9, 0xb9ee, 0xd1af, 0xd2e8, 0xdaba, 0xb8c3, 0xcfea, 0xb2ef, /*0xe0-0xe7*/ - 0xdabb, 0xdabc, 0xd79e, 0xbdeb, 0xcedc, 0xd3ef, 0xdabd, 0xcef3, /*0xe8-0xef*/ - 0xdabe, 0xd3d5, 0xbbe5, 0xdabf, 0xcbb5, 0xcbd0, 0xdac0, 0xc7eb, /*0xf0-0xf7*/ - 0xd6ee, 0xdac1, 0xc5b5, 0xb6c1, 0xdac2, 0xb7cc, 0xbfce, 0xdac3, /*0xf8-0xff*/ - /* 0x8c00 */ - 0xdac4, 0xcbad, 0xdac5, 0xb5f7, 0xdac6, 0xc1c2, 0xd7bb, 0xdac7, /*0x00-0x07*/ - 0xccb8, 0xd79f, 0xd2ea, 0xc4b1, 0xdac8, 0xb5fd, 0xbbd1, 0xdac9, /*0x08-0x0f*/ - 0xd0b3, 0xdaca, 0xdacb, 0xcebd, 0xdacc, 0xdacd, 0xdace, 0xb2f7, /*0x10-0x17*/ - 0xdad1, 0xdacf, 0xd1e8, 0xdad0, 0xc3d5, 0xdad2, 0xd7a0, 0xdad3, /*0x18-0x1f*/ - 0xdad4, 0xdad5, 0xd0bb, 0xd2a5, 0xb0f9, 0xdad6, 0xc7ab, 0xdad7, /*0x20-0x27*/ - 0xbdf7, 0xc3a1, 0xdad8, 0xdad9, 0xc3fd, 0xccb7, 0xdada, 0xdadb, /*0x28-0x2f*/ - 0xc0be, 0xc6d7, 0xdadc, 0xdadd, 0xc7b4, 0xdade, 0xdadf, 0xb9c8, /*0x30-0x37*/ - 0xd840, 0xd841, 0xd842, 0xd843, 0xd844, 0xd845, 0xd846, 0xd847, /*0x38-0x3f*/ - 0xd848, 0xbbed, 0xd849, 0xd84a, 0xd84b, 0xd84c, 0xb6b9, 0xf4f8, /*0x40-0x47*/ - 0xd84d, 0xf4f9, 0xd84e, 0xd84f, 0xcde3, 0xd850, 0xd851, 0xd852, /*0x48-0x4f*/ - 0xd853, 0xd854, 0xd855, 0xd856, 0xd857, 0xf5b9, 0xd858, 0xd859, /*0x50-0x57*/ - 0xd85a, 0xd85b, 0xebe0, 0xd85c, 0xd85d, 0xd85e, 0xd85f, 0xd860, /*0x58-0x5f*/ - 0xd861, 0xcff3, 0xbbbf, 0xd862, 0xd863, 0xd864, 0xd865, 0xd866, /*0x60-0x67*/ - 0xd867, 0xd868, 0xbac0, 0xd4a5, 0xd869, 0xd86a, 0xd86b, 0xd86c, /*0x68-0x6f*/ - 0xd86d, 0xd86e, 0xd86f, 0xe1d9, 0xd870, 0xd871, 0xd872, 0xd873, /*0x70-0x77*/ - 0xf5f4, 0xb1aa, 0xb2f2, 0xd874, 0xd875, 0xd876, 0xd877, 0xd878, /*0x78-0x7f*/ - 0xd879, 0xd87a, 0xf5f5, 0xd87b, 0xd87c, 0xf5f7, 0xd87d, 0xd87e, /*0x80-0x87*/ - 0xd880, 0xbad1, 0xf5f6, 0xd881, 0xc3b2, 0xd882, 0xd883, 0xd884, /*0x88-0x8f*/ - 0xd885, 0xd886, 0xd887, 0xd888, 0xf5f9, 0xd889, 0xd88a, 0xd88b, /*0x90-0x97*/ - 0xf5f8, 0xd88c, 0xd88d, 0xd88e, 0xd88f, 0xd890, 0xd891, 0xd892, /*0x98-0x9f*/ - 0xd893, 0xd894, 0xd895, 0xd896, 0xd897, 0xd898, 0xd899, 0xd89a, /*0xa0-0xa7*/ - 0xd89b, 0xd89c, 0xd89d, 0xd89e, 0xd89f, 0xd8a0, 0xd940, 0xd941, /*0xa8-0xaf*/ - 0xd942, 0xd943, 0xd944, 0xd945, 0xd946, 0xd947, 0xd948, 0xd949, /*0xb0-0xb7*/ - 0xd94a, 0xd94b, 0xd94c, 0xd94d, 0xd94e, 0xd94f, 0xd950, 0xd951, /*0xb8-0xbf*/ - 0xd952, 0xd953, 0xd954, 0xd955, 0xd956, 0xd957, 0xd958, 0xd959, /*0xc0-0xc7*/ - 0xd95a, 0xd95b, 0xd95c, 0xd95d, 0xd95e, 0xd95f, 0xd960, 0xd961, /*0xc8-0xcf*/ - 0xd962, 0xd963, 0xd964, 0xd965, 0xd966, 0xd967, 0xd968, 0xd969, /*0xd0-0xd7*/ - 0xd96a, 0xd96b, 0xd96c, 0xd96d, 0xd96e, 0xd96f, 0xd970, 0xd971, /*0xd8-0xdf*/ - 0xd972, 0xd973, 0xd974, 0xd975, 0xd976, 0xd977, 0xd978, 0xd979, /*0xe0-0xe7*/ - 0xd97a, 0xd97b, 0xd97c, 0xd97d, 0xd97e, 0xd980, 0xd981, 0xd982, /*0xe8-0xef*/ - 0xd983, 0xd984, 0xd985, 0xd986, 0xd987, 0xd988, 0xd989, 0xd98a, /*0xf0-0xf7*/ - 0xd98b, 0xd98c, 0xd98d, 0xd98e, 0xd98f, 0xd990, 0xd991, 0xd992, /*0xf8-0xff*/ - /* 0x8d00 */ - 0xd993, 0xd994, 0xd995, 0xd996, 0xd997, 0xd998, 0xd999, 0xd99a, /*0x00-0x07*/ - 0xd99b, 0xd99c, 0xd99d, 0xd99e, 0xd99f, 0xd9a0, 0xda40, 0xda41, /*0x08-0x0f*/ - 0xda42, 0xda43, 0xda44, 0xda45, 0xda46, 0xda47, 0xda48, 0xda49, /*0x10-0x17*/ - 0xda4a, 0xda4b, 0xda4c, 0xda4d, 0xda4e, 0xb1b4, 0xd5ea, 0xb8ba, /*0x18-0x1f*/ - 0xda4f, 0xb9b1, 0xb2c6, 0xd4f0, 0xcfcd, 0xb0dc, 0xd5cb, 0xbbf5, /*0x20-0x27*/ - 0xd6ca, 0xb7b7, 0xccb0, 0xc6b6, 0xb1e1, 0xb9ba, 0xd6fc, 0xb9e1, /*0x28-0x2f*/ - 0xb7a1, 0xbcfa, 0xeada, 0xeadb, 0xccf9, 0xb9f3, 0xeadc, 0xb4fb, /*0x30-0x37*/ - 0xc3b3, 0xb7d1, 0xbad8, 0xeadd, 0xd4f4, 0xeade, 0xbcd6, 0xbbdf, /*0x38-0x3f*/ - 0xeadf, 0xc1de, 0xc2b8, 0xd4df, 0xd7ca, 0xeae0, 0xeae1, 0xeae4, /*0x40-0x47*/ - 0xeae2, 0xeae3, 0xc9de, 0xb8b3, 0xb6c4, 0xeae5, 0xcaea, 0xc9cd, /*0x48-0x4f*/ - 0xb4cd, 0xda50, 0xda51, 0xe2d9, 0xc5e2, 0xeae6, 0xc0b5, 0xda52, /*0x50-0x57*/ - 0xd7b8, 0xeae7, 0xd7ac, 0xc8fc, 0xd8d3, 0xd8cd, 0xd4de, 0xda53, /*0x58-0x5f*/ - 0xd4f9, 0xc9c4, 0xd3ae, 0xb8d3, 0xb3e0, 0xda54, 0xc9e2, 0xf4f6, /*0x60-0x67*/ - 0xda55, 0xda56, 0xda57, 0xbad5, 0xda58, 0xf4f7, 0xda59, 0xda5a, /*0x68-0x6f*/ - 0xd7df, 0xda5b, 0xda5c, 0xf4f1, 0xb8b0, 0xd5d4, 0xb8cf, 0xc6f0, /*0x70-0x77*/ - 0xda5d, 0xda5e, 0xda5f, 0xda60, 0xda61, 0xda62, 0xda63, 0xda64, /*0x78-0x7f*/ - 0xda65, 0xb3c3, 0xda66, 0xda67, 0xf4f2, 0xb3ac, 0xda68, 0xda69, /*0x80-0x87*/ - 0xda6a, 0xda6b, 0xd4bd, 0xc7f7, 0xda6c, 0xda6d, 0xda6e, 0xda6f, /*0x88-0x8f*/ - 0xda70, 0xf4f4, 0xda71, 0xda72, 0xf4f3, 0xda73, 0xda74, 0xda75, /*0x90-0x97*/ - 0xda76, 0xda77, 0xda78, 0xda79, 0xda7a, 0xda7b, 0xda7c, 0xcccb, /*0x98-0x9f*/ - 0xda7d, 0xda7e, 0xda80, 0xc8a4, 0xda81, 0xda82, 0xda83, 0xda84, /*0xa0-0xa7*/ - 0xda85, 0xda86, 0xda87, 0xda88, 0xda89, 0xda8a, 0xda8b, 0xda8c, /*0xa8-0xaf*/ - 0xda8d, 0xf4f5, 0xda8e, 0xd7e3, 0xc5bf, 0xf5c0, 0xda8f, 0xda90, /*0xb0-0xb7*/ - 0xf5bb, 0xda91, 0xf5c3, 0xda92, 0xf5c2, 0xda93, 0xd6ba, 0xf5c1, /*0xb8-0xbf*/ - 0xda94, 0xda95, 0xda96, 0xd4be, 0xf5c4, 0xda97, 0xf5cc, 0xda98, /*0xc0-0xc7*/ - 0xda99, 0xda9a, 0xda9b, 0xb0cf, 0xb5f8, 0xda9c, 0xf5c9, 0xf5ca, /*0xc8-0xcf*/ - 0xda9d, 0xc5dc, 0xda9e, 0xda9f, 0xdaa0, 0xdb40, 0xf5c5, 0xf5c6, /*0xd0-0xd7*/ - 0xdb41, 0xdb42, 0xf5c7, 0xf5cb, 0xdb43, 0xbee0, 0xf5c8, 0xb8fa, /*0xd8-0xdf*/ - 0xdb44, 0xdb45, 0xdb46, 0xf5d0, 0xf5d3, 0xdb47, 0xdb48, 0xdb49, /*0xe0-0xe7*/ - 0xbfe7, 0xdb4a, 0xb9f2, 0xf5bc, 0xf5cd, 0xdb4b, 0xdb4c, 0xc2b7, /*0xe8-0xef*/ - 0xdb4d, 0xdb4e, 0xdb4f, 0xccf8, 0xdb50, 0xbcf9, 0xdb51, 0xf5ce, /*0xf0-0xf7*/ - 0xf5cf, 0xf5d1, 0xb6e5, 0xf5d2, 0xdb52, 0xf5d5, 0xdb53, 0xdb54, /*0xf8-0xff*/ - /* 0x8e00 */ - 0xdb55, 0xdb56, 0xdb57, 0xdb58, 0xdb59, 0xf5bd, 0xdb5a, 0xdb5b, /*0x00-0x07*/ - 0xdb5c, 0xf5d4, 0xd3bb, 0xdb5d, 0xb3ec, 0xdb5e, 0xdb5f, 0xcca4, /*0x08-0x0f*/ - 0xdb60, 0xdb61, 0xdb62, 0xdb63, 0xf5d6, 0xdb64, 0xdb65, 0xdb66, /*0x10-0x17*/ - 0xdb67, 0xdb68, 0xdb69, 0xdb6a, 0xdb6b, 0xf5d7, 0xbee1, 0xf5d8, /*0x18-0x1f*/ - 0xdb6c, 0xdb6d, 0xccdf, 0xf5db, 0xdb6e, 0xdb6f, 0xdb70, 0xdb71, /*0x20-0x27*/ - 0xdb72, 0xb2c8, 0xd7d9, 0xdb73, 0xf5d9, 0xdb74, 0xf5da, 0xf5dc, /*0x28-0x2f*/ - 0xdb75, 0xf5e2, 0xdb76, 0xdb77, 0xdb78, 0xf5e0, 0xdb79, 0xdb7a, /*0x30-0x37*/ - 0xdb7b, 0xf5df, 0xf5dd, 0xdb7c, 0xdb7d, 0xf5e1, 0xdb7e, 0xdb80, /*0x38-0x3f*/ - 0xf5de, 0xf5e4, 0xf5e5, 0xdb81, 0xcce3, 0xdb82, 0xdb83, 0xe5bf, /*0x40-0x47*/ - 0xb5b8, 0xf5e3, 0xf5e8, 0xcca3, 0xdb84, 0xdb85, 0xdb86, 0xdb87, /*0x48-0x4f*/ - 0xdb88, 0xf5e6, 0xf5e7, 0xdb89, 0xdb8a, 0xdb8b, 0xdb8c, 0xdb8d, /*0x50-0x57*/ - 0xdb8e, 0xf5be, 0xdb8f, 0xdb90, 0xdb91, 0xdb92, 0xdb93, 0xdb94, /*0x58-0x5f*/ - 0xdb95, 0xdb96, 0xdb97, 0xdb98, 0xdb99, 0xdb9a, 0xb1c4, 0xdb9b, /*0x60-0x67*/ - 0xdb9c, 0xf5bf, 0xdb9d, 0xdb9e, 0xb5c5, 0xb2e4, 0xdb9f, 0xf5ec, /*0x68-0x6f*/ - 0xf5e9, 0xdba0, 0xb6d7, 0xdc40, 0xf5ed, 0xdc41, 0xf5ea, 0xdc42, /*0x70-0x77*/ - 0xdc43, 0xdc44, 0xdc45, 0xdc46, 0xf5eb, 0xdc47, 0xdc48, 0xb4da, /*0x78-0x7f*/ - 0xdc49, 0xd4ea, 0xdc4a, 0xdc4b, 0xdc4c, 0xf5ee, 0xdc4d, 0xb3f9, /*0x80-0x87*/ - 0xdc4e, 0xdc4f, 0xdc50, 0xdc51, 0xdc52, 0xdc53, 0xdc54, 0xf5ef, /*0x88-0x8f*/ - 0xf5f1, 0xdc55, 0xdc56, 0xdc57, 0xf5f0, 0xdc58, 0xdc59, 0xdc5a, /*0x90-0x97*/ - 0xdc5b, 0xdc5c, 0xdc5d, 0xdc5e, 0xf5f2, 0xdc5f, 0xf5f3, 0xdc60, /*0x98-0x9f*/ - 0xdc61, 0xdc62, 0xdc63, 0xdc64, 0xdc65, 0xdc66, 0xdc67, 0xdc68, /*0xa0-0xa7*/ - 0xdc69, 0xdc6a, 0xdc6b, 0xc9ed, 0xb9aa, 0xdc6c, 0xdc6d, 0xc7fb, /*0xa8-0xaf*/ - 0xdc6e, 0xdc6f, 0xb6e3, 0xdc70, 0xdc71, 0xdc72, 0xdc73, 0xdc74, /*0xb0-0xb7*/ - 0xdc75, 0xdc76, 0xccc9, 0xdc77, 0xdc78, 0xdc79, 0xdc7a, 0xdc7b, /*0xb8-0xbf*/ - 0xdc7c, 0xdc7d, 0xdc7e, 0xdc80, 0xdc81, 0xdc82, 0xdc83, 0xdc84, /*0xc0-0xc7*/ - 0xdc85, 0xdc86, 0xdc87, 0xdc88, 0xdc89, 0xdc8a, 0xeaa6, 0xdc8b, /*0xc8-0xcf*/ - 0xdc8c, 0xdc8d, 0xdc8e, 0xdc8f, 0xdc90, 0xdc91, 0xdc92, 0xdc93, /*0xd0-0xd7*/ - 0xdc94, 0xdc95, 0xdc96, 0xdc97, 0xdc98, 0xdc99, 0xdc9a, 0xdc9b, /*0xd8-0xdf*/ - 0xdc9c, 0xdc9d, 0xdc9e, 0xdc9f, 0xdca0, 0xdd40, 0xdd41, 0xdd42, /*0xe0-0xe7*/ - 0xdd43, 0xdd44, 0xdd45, 0xdd46, 0xdd47, 0xdd48, 0xdd49, 0xdd4a, /*0xe8-0xef*/ - 0xdd4b, 0xdd4c, 0xdd4d, 0xdd4e, 0xdd4f, 0xdd50, 0xdd51, 0xdd52, /*0xf0-0xf7*/ - 0xdd53, 0xdd54, 0xdd55, 0xdd56, 0xdd57, 0xdd58, 0xdd59, 0xdd5a, /*0xf8-0xff*/ - /* 0x8f00 */ - 0xdd5b, 0xdd5c, 0xdd5d, 0xdd5e, 0xdd5f, 0xdd60, 0xdd61, 0xdd62, /*0x00-0x07*/ - 0xdd63, 0xdd64, 0xdd65, 0xdd66, 0xdd67, 0xdd68, 0xdd69, 0xdd6a, /*0x08-0x0f*/ - 0xdd6b, 0xdd6c, 0xdd6d, 0xdd6e, 0xdd6f, 0xdd70, 0xdd71, 0xdd72, /*0x10-0x17*/ - 0xdd73, 0xdd74, 0xdd75, 0xdd76, 0xdd77, 0xdd78, 0xdd79, 0xdd7a, /*0x18-0x1f*/ - 0xdd7b, 0xdd7c, 0xdd7d, 0xdd7e, 0xdd80, 0xdd81, 0xdd82, 0xdd83, /*0x20-0x27*/ - 0xdd84, 0xdd85, 0xdd86, 0xdd87, 0xdd88, 0xdd89, 0xdd8a, 0xdd8b, /*0x28-0x2f*/ - 0xdd8c, 0xdd8d, 0xdd8e, 0xdd8f, 0xdd90, 0xdd91, 0xdd92, 0xdd93, /*0x30-0x37*/ - 0xdd94, 0xdd95, 0xdd96, 0xdd97, 0xdd98, 0xdd99, 0xdd9a, 0xdd9b, /*0x38-0x3f*/ - 0xdd9c, 0xdd9d, 0xdd9e, 0xdd9f, 0xdda0, 0xde40, 0xde41, 0xde42, /*0x40-0x47*/ - 0xde43, 0xde44, 0xde45, 0xde46, 0xde47, 0xde48, 0xde49, 0xde4a, /*0x48-0x4f*/ - 0xde4b, 0xde4c, 0xde4d, 0xde4e, 0xde4f, 0xde50, 0xde51, 0xde52, /*0x50-0x57*/ - 0xde53, 0xde54, 0xde55, 0xde56, 0xde57, 0xde58, 0xde59, 0xde5a, /*0x58-0x5f*/ - 0xde5b, 0xde5c, 0xde5d, 0xde5e, 0xde5f, 0xde60, 0xb3b5, 0xd4fe, /*0x60-0x67*/ - 0xb9ec, 0xd0f9, 0xde61, 0xe9ed, 0xd7aa, 0xe9ee, 0xc2d6, 0xc8ed, /*0x68-0x6f*/ - 0xbae4, 0xe9ef, 0xe9f0, 0xe9f1, 0xd6e1, 0xe9f2, 0xe9f3, 0xe9f5, /*0x70-0x77*/ - 0xe9f4, 0xe9f6, 0xe9f7, 0xc7e1, 0xe9f8, 0xd4d8, 0xe9f9, 0xbdce, /*0x78-0x7f*/ - 0xde62, 0xe9fa, 0xe9fb, 0xbdcf, 0xe9fc, 0xb8a8, 0xc1be, 0xe9fd, /*0x80-0x87*/ - 0xb1b2, 0xbbd4, 0xb9f5, 0xe9fe, 0xde63, 0xeaa1, 0xeaa2, 0xeaa3, /*0x88-0x8f*/ - 0xb7f8, 0xbcad, 0xde64, 0xcae4, 0xe0ce, 0xd4af, 0xcfbd, 0xd5b7, /*0x90-0x97*/ - 0xeaa4, 0xd5de, 0xeaa5, 0xd0c1, 0xb9bc, 0xde65, 0xb4c7, 0xb1d9, /*0x98-0x9f*/ - 0xde66, 0xde67, 0xde68, 0xc0b1, 0xde69, 0xde6a, 0xde6b, 0xde6c, /*0xa0-0xa7*/ - 0xb1e6, 0xb1e7, 0xde6d, 0xb1e8, 0xde6e, 0xde6f, 0xde70, 0xde71, /*0xa8-0xaf*/ - 0xb3bd, 0xc8e8, 0xde72, 0xde73, 0xde74, 0xde75, 0xe5c1, 0xde76, /*0xb0-0xb7*/ - 0xde77, 0xb1df, 0xde78, 0xde79, 0xde7a, 0xc1c9, 0xb4ef, 0xde7b, /*0xb8-0xbf*/ - 0xde7c, 0xc7a8, 0xd3d8, 0xde7d, 0xc6f9, 0xd1b8, 0xde7e, 0xb9fd, /*0xc0-0xc7*/ - 0xc2f5, 0xde80, 0xde81, 0xde82, 0xde83, 0xde84, 0xd3ad, 0xde85, /*0xc8-0xcf*/ - 0xd4cb, 0xbdfc, 0xde86, 0xe5c2, 0xb7b5, 0xe5c3, 0xde87, 0xde88, /*0xd0-0xd7*/ - 0xbbb9, 0xd5e2, 0xde89, 0xbdf8, 0xd4b6, 0xcea5, 0xc1ac, 0xb3d9, /*0xd8-0xdf*/ - 0xde8a, 0xde8b, 0xccf6, 0xde8c, 0xe5c6, 0xe5c4, 0xe5c8, 0xde8d, /*0xe0-0xe7*/ - 0xe5ca, 0xe5c7, 0xb5cf, 0xc6c8, 0xde8e, 0xb5fc, 0xe5c5, 0xde8f, /*0xe8-0xef*/ - 0xcaf6, 0xde90, 0xde91, 0xe5c9, 0xde92, 0xde93, 0xde94, 0xc3d4, /*0xf0-0xf7*/ - 0xb1c5, 0xbca3, 0xde95, 0xde96, 0xde97, 0xd7b7, 0xde98, 0xde99, /*0xf8-0xff*/ - /* 0x9000 */ - 0xcdcb, 0xcbcd, 0xcaca, 0xccd3, 0xe5cc, 0xe5cb, 0xc4e6, 0xde9a, /*0x00-0x07*/ - 0xde9b, 0xd1a1, 0xd1b7, 0xe5cd, 0xde9c, 0xe5d0, 0xde9d, 0xcdb8, /*0x08-0x0f*/ - 0xd6f0, 0xe5cf, 0xb5dd, 0xde9e, 0xcdbe, 0xde9f, 0xe5d1, 0xb6ba, /*0x10-0x17*/ - 0xdea0, 0xdf40, 0xcda8, 0xb9e4, 0xdf41, 0xcac5, 0xb3d1, 0xcbd9, /*0x18-0x1f*/ - 0xd4ec, 0xe5d2, 0xb7ea, 0xdf42, 0xdf43, 0xdf44, 0xe5ce, 0xdf45, /*0x20-0x27*/ - 0xdf46, 0xdf47, 0xdf48, 0xdf49, 0xdf4a, 0xe5d5, 0xb4fe, 0xe5d6, /*0x28-0x2f*/ - 0xdf4b, 0xdf4c, 0xdf4d, 0xdf4e, 0xdf4f, 0xe5d3, 0xe5d4, 0xdf50, /*0x30-0x37*/ - 0xd2dd, 0xdf51, 0xdf52, 0xc2df, 0xb1c6, 0xdf53, 0xd3e2, 0xdf54, /*0x38-0x3f*/ - 0xdf55, 0xb6dd, 0xcbec, 0xdf56, 0xe5d7, 0xdf57, 0xdf58, 0xd3f6, /*0x40-0x47*/ - 0xdf59, 0xdf5a, 0xdf5b, 0xdf5c, 0xdf5d, 0xb1e9, 0xdf5e, 0xb6f4, /*0x48-0x4f*/ - 0xe5da, 0xe5d8, 0xe5d9, 0xb5c0, 0xdf5f, 0xdf60, 0xdf61, 0xd2c5, /*0x50-0x57*/ - 0xe5dc, 0xdf62, 0xdf63, 0xe5de, 0xdf64, 0xdf65, 0xdf66, 0xdf67, /*0x58-0x5f*/ - 0xdf68, 0xdf69, 0xe5dd, 0xc7b2, 0xdf6a, 0xd2a3, 0xdf6b, 0xdf6c, /*0x60-0x67*/ - 0xe5db, 0xdf6d, 0xdf6e, 0xdf6f, 0xdf70, 0xd4e2, 0xd5da, 0xdf71, /*0x68-0x6f*/ - 0xdf72, 0xdf73, 0xdf74, 0xdf75, 0xe5e0, 0xd7f1, 0xdf76, 0xdf77, /*0x70-0x77*/ - 0xdf78, 0xdf79, 0xdf7a, 0xdf7b, 0xdf7c, 0xe5e1, 0xdf7d, 0xb1dc, /*0x78-0x7f*/ - 0xd1fb, 0xdf7e, 0xe5e2, 0xe5e4, 0xdf80, 0xdf81, 0xdf82, 0xdf83, /*0x80-0x87*/ - 0xe5e3, 0xdf84, 0xdf85, 0xe5e5, 0xdf86, 0xdf87, 0xdf88, 0xdf89, /*0x88-0x8f*/ - 0xdf8a, 0xd2d8, 0xdf8b, 0xb5cb, 0xdf8c, 0xe7df, 0xdf8d, 0xdaf5, /*0x90-0x97*/ - 0xdf8e, 0xdaf8, 0xdf8f, 0xdaf6, 0xdf90, 0xdaf7, 0xdf91, 0xdf92, /*0x98-0x9f*/ - 0xdf93, 0xdafa, 0xd0cf, 0xc4c7, 0xdf94, 0xdf95, 0xb0ee, 0xdf96, /*0xa0-0xa7*/ - 0xdf97, 0xdf98, 0xd0b0, 0xdf99, 0xdaf9, 0xdf9a, 0xd3ca, 0xbaaa, /*0xa8-0xaf*/ - 0xdba2, 0xc7f1, 0xdf9b, 0xdafc, 0xdafb, 0xc9db, 0xdafd, 0xdf9c, /*0xb0-0xb7*/ - 0xdba1, 0xd7de, 0xdafe, 0xc1da, 0xdf9d, 0xdf9e, 0xdba5, 0xdf9f, /*0xb8-0xbf*/ - 0xdfa0, 0xd3f4, 0xe040, 0xe041, 0xdba7, 0xdba4, 0xe042, 0xdba8, /*0xc0-0xc7*/ - 0xe043, 0xe044, 0xbdbc, 0xe045, 0xe046, 0xe047, 0xc0c9, 0xdba3, /*0xc8-0xcf*/ - 0xdba6, 0xd6a3, 0xe048, 0xdba9, 0xe049, 0xe04a, 0xe04b, 0xdbad, /*0xd0-0xd7*/ - 0xe04c, 0xe04d, 0xe04e, 0xdbae, 0xdbac, 0xbac2, 0xe04f, 0xe050, /*0xd8-0xdf*/ - 0xe051, 0xbfa4, 0xdbab, 0xe052, 0xe053, 0xe054, 0xdbaa, 0xd4c7, /*0xe0-0xe7*/ - 0xb2bf, 0xe055, 0xe056, 0xdbaf, 0xe057, 0xb9f9, 0xe058, 0xdbb0, /*0xe8-0xef*/ - 0xe059, 0xe05a, 0xe05b, 0xe05c, 0xb3bb, 0xe05d, 0xe05e, 0xe05f, /*0xf0-0xf7*/ - 0xb5a6, 0xe060, 0xe061, 0xe062, 0xe063, 0xb6bc, 0xdbb1, 0xe064, /*0xf8-0xff*/ - /* 0x9100 */ - 0xe065, 0xe066, 0xb6f5, 0xe067, 0xdbb2, 0xe068, 0xe069, 0xe06a, /*0x00-0x07*/ - 0xe06b, 0xe06c, 0xe06d, 0xe06e, 0xe06f, 0xe070, 0xe071, 0xe072, /*0x08-0x0f*/ - 0xe073, 0xe074, 0xe075, 0xe076, 0xe077, 0xe078, 0xe079, 0xe07a, /*0x10-0x17*/ - 0xe07b, 0xb1c9, 0xe07c, 0xe07d, 0xe07e, 0xe080, 0xdbb4, 0xe081, /*0x18-0x1f*/ - 0xe082, 0xe083, 0xdbb3, 0xdbb5, 0xe084, 0xe085, 0xe086, 0xe087, /*0x20-0x27*/ - 0xe088, 0xe089, 0xe08a, 0xe08b, 0xe08c, 0xe08d, 0xe08e, 0xdbb7, /*0x28-0x2f*/ - 0xe08f, 0xdbb6, 0xe090, 0xe091, 0xe092, 0xe093, 0xe094, 0xe095, /*0x30-0x37*/ - 0xe096, 0xdbb8, 0xe097, 0xe098, 0xe099, 0xe09a, 0xe09b, 0xe09c, /*0x38-0x3f*/ - 0xe09d, 0xe09e, 0xe09f, 0xdbb9, 0xe0a0, 0xe140, 0xdbba, 0xe141, /*0x40-0x47*/ - 0xe142, 0xd3cf, 0xf4fa, 0xc7f5, 0xd7c3, 0xc5e4, 0xf4fc, 0xf4fd, /*0x48-0x4f*/ - 0xf4fb, 0xe143, 0xbec6, 0xe144, 0xe145, 0xe146, 0xe147, 0xd0ef, /*0x50-0x57*/ - 0xe148, 0xe149, 0xb7d3, 0xe14a, 0xe14b, 0xd4cd, 0xccaa, 0xe14c, /*0x58-0x5f*/ - 0xe14d, 0xf5a2, 0xf5a1, 0xbaa8, 0xf4fe, 0xcbd6, 0xe14e, 0xe14f, /*0x60-0x67*/ - 0xe150, 0xf5a4, 0xc0d2, 0xe151, 0xb3ea, 0xe152, 0xcdaa, 0xf5a5, /*0x68-0x6f*/ - 0xf5a3, 0xbdb4, 0xf5a8, 0xe153, 0xf5a9, 0xbdcd, 0xc3b8, 0xbfe1, /*0x70-0x77*/ - 0xcbe1, 0xf5aa, 0xe154, 0xe155, 0xe156, 0xf5a6, 0xf5a7, 0xc4f0, /*0x78-0x7f*/ - 0xe157, 0xe158, 0xe159, 0xe15a, 0xe15b, 0xf5ac, 0xe15c, 0xb4bc, /*0x80-0x87*/ - 0xe15d, 0xd7ed, 0xe15e, 0xb4d7, 0xf5ab, 0xf5ae, 0xe15f, 0xe160, /*0x88-0x8f*/ - 0xf5ad, 0xf5af, 0xd0d1, 0xe161, 0xe162, 0xe163, 0xe164, 0xe165, /*0x90-0x97*/ - 0xe166, 0xe167, 0xc3d1, 0xc8a9, 0xe168, 0xe169, 0xe16a, 0xe16b, /*0x98-0x9f*/ - 0xe16c, 0xe16d, 0xf5b0, 0xf5b1, 0xe16e, 0xe16f, 0xe170, 0xe171, /*0xa0-0xa7*/ - 0xe172, 0xe173, 0xf5b2, 0xe174, 0xe175, 0xf5b3, 0xf5b4, 0xf5b5, /*0xa8-0xaf*/ - 0xe176, 0xe177, 0xe178, 0xe179, 0xf5b7, 0xf5b6, 0xe17a, 0xe17b, /*0xb0-0xb7*/ - 0xe17c, 0xe17d, 0xf5b8, 0xe17e, 0xe180, 0xe181, 0xe182, 0xe183, /*0xb8-0xbf*/ - 0xe184, 0xe185, 0xe186, 0xe187, 0xe188, 0xe189, 0xe18a, 0xb2c9, /*0xc0-0xc7*/ - 0xe18b, 0xd3d4, 0xcacd, 0xe18c, 0xc0ef, 0xd6d8, 0xd2b0, 0xc1bf, /*0xc8-0xcf*/ - 0xe18d, 0xbdf0, 0xe18e, 0xe18f, 0xe190, 0xe191, 0xe192, 0xe193, /*0xd0-0xd7*/ - 0xe194, 0xe195, 0xe196, 0xe197, 0xb8aa, 0xe198, 0xe199, 0xe19a, /*0xd8-0xdf*/ - 0xe19b, 0xe19c, 0xe19d, 0xe19e, 0xe19f, 0xe1a0, 0xe240, 0xe241, /*0xe0-0xe7*/ - 0xe242, 0xe243, 0xe244, 0xe245, 0xe246, 0xe247, 0xe248, 0xe249, /*0xe8-0xef*/ - 0xe24a, 0xe24b, 0xe24c, 0xe24d, 0xe24e, 0xe24f, 0xe250, 0xe251, /*0xf0-0xf7*/ - 0xe252, 0xe253, 0xe254, 0xe255, 0xe256, 0xe257, 0xe258, 0xe259, /*0xf8-0xff*/ - /* 0x9200 */ - 0xe25a, 0xe25b, 0xe25c, 0xe25d, 0xe25e, 0xe25f, 0xe260, 0xe261, /*0x00-0x07*/ - 0xe262, 0xe263, 0xe264, 0xe265, 0xe266, 0xe267, 0xe268, 0xe269, /*0x08-0x0f*/ - 0xe26a, 0xe26b, 0xe26c, 0xe26d, 0xe26e, 0xe26f, 0xe270, 0xe271, /*0x10-0x17*/ - 0xe272, 0xe273, 0xe274, 0xe275, 0xe276, 0xe277, 0xe278, 0xe279, /*0x18-0x1f*/ - 0xe27a, 0xe27b, 0xe27c, 0xe27d, 0xe27e, 0xe280, 0xe281, 0xe282, /*0x20-0x27*/ - 0xe283, 0xe284, 0xe285, 0xe286, 0xe287, 0xe288, 0xe289, 0xe28a, /*0x28-0x2f*/ - 0xe28b, 0xe28c, 0xe28d, 0xe28e, 0xe28f, 0xe290, 0xe291, 0xe292, /*0x30-0x37*/ - 0xe293, 0xe294, 0xe295, 0xe296, 0xe297, 0xe298, 0xe299, 0xe29a, /*0x38-0x3f*/ - 0xe29b, 0xe29c, 0xe29d, 0xe29e, 0xe29f, 0xe2a0, 0xe340, 0xe341, /*0x40-0x47*/ - 0xe342, 0xe343, 0xe344, 0xe345, 0xe346, 0xe347, 0xe348, 0xe349, /*0x48-0x4f*/ - 0xe34a, 0xe34b, 0xe34c, 0xe34d, 0xe34e, 0xe34f, 0xe350, 0xe351, /*0x50-0x57*/ - 0xe352, 0xe353, 0xe354, 0xe355, 0xe356, 0xe357, 0xe358, 0xe359, /*0x58-0x5f*/ - 0xe35a, 0xe35b, 0xe35c, 0xe35d, 0xe35e, 0xe35f, 0xe360, 0xe361, /*0x60-0x67*/ - 0xe362, 0xe363, 0xe364, 0xe365, 0xe366, 0xe367, 0xe368, 0xe369, /*0x68-0x6f*/ - 0xe36a, 0xe36b, 0xe36c, 0xe36d, 0xbcf8, 0xe36e, 0xe36f, 0xe370, /*0x70-0x77*/ - 0xe371, 0xe372, 0xe373, 0xe374, 0xe375, 0xe376, 0xe377, 0xe378, /*0x78-0x7f*/ - 0xe379, 0xe37a, 0xe37b, 0xe37c, 0xe37d, 0xe37e, 0xe380, 0xe381, /*0x80-0x87*/ - 0xe382, 0xe383, 0xe384, 0xe385, 0xe386, 0xe387, 0xf6c6, 0xe388, /*0x88-0x8f*/ - 0xe389, 0xe38a, 0xe38b, 0xe38c, 0xe38d, 0xe38e, 0xe38f, 0xe390, /*0x90-0x97*/ - 0xe391, 0xe392, 0xe393, 0xe394, 0xe395, 0xe396, 0xe397, 0xe398, /*0x98-0x9f*/ - 0xe399, 0xe39a, 0xe39b, 0xe39c, 0xe39d, 0xe39e, 0xe39f, 0xe3a0, /*0xa0-0xa7*/ - 0xe440, 0xe441, 0xe442, 0xe443, 0xe444, 0xe445, 0xf6c7, 0xe446, /*0xa8-0xaf*/ - 0xe447, 0xe448, 0xe449, 0xe44a, 0xe44b, 0xe44c, 0xe44d, 0xe44e, /*0xb0-0xb7*/ - 0xe44f, 0xe450, 0xe451, 0xe452, 0xe453, 0xe454, 0xe455, 0xe456, /*0xb8-0xbf*/ - 0xe457, 0xe458, 0xe459, 0xe45a, 0xe45b, 0xe45c, 0xe45d, 0xe45e, /*0xc0-0xc7*/ - 0xf6c8, 0xe45f, 0xe460, 0xe461, 0xe462, 0xe463, 0xe464, 0xe465, /*0xc8-0xcf*/ - 0xe466, 0xe467, 0xe468, 0xe469, 0xe46a, 0xe46b, 0xe46c, 0xe46d, /*0xd0-0xd7*/ - 0xe46e, 0xe46f, 0xe470, 0xe471, 0xe472, 0xe473, 0xe474, 0xe475, /*0xd8-0xdf*/ - 0xe476, 0xe477, 0xe478, 0xe479, 0xe47a, 0xe47b, 0xe47c, 0xe47d, /*0xe0-0xe7*/ - 0xe47e, 0xe480, 0xe481, 0xe482, 0xe483, 0xe484, 0xe485, 0xe486, /*0xe8-0xef*/ - 0xe487, 0xe488, 0xe489, 0xe48a, 0xe48b, 0xe48c, 0xe48d, 0xe48e, /*0xf0-0xf7*/ - 0xe48f, 0xe490, 0xe491, 0xe492, 0xe493, 0xe494, 0xe495, 0xe496, /*0xf8-0xff*/ - /* 0x9300 */ - 0xe497, 0xe498, 0xe499, 0xe49a, 0xe49b, 0xe49c, 0xe49d, 0xe49e, /*0x00-0x07*/ - 0xe49f, 0xe4a0, 0xe540, 0xe541, 0xe542, 0xe543, 0xe544, 0xe545, /*0x08-0x0f*/ - 0xe546, 0xe547, 0xe548, 0xe549, 0xe54a, 0xe54b, 0xe54c, 0xe54d, /*0x10-0x17*/ - 0xe54e, 0xe54f, 0xe550, 0xe551, 0xe552, 0xe553, 0xe554, 0xe555, /*0x18-0x1f*/ - 0xe556, 0xe557, 0xe558, 0xe559, 0xe55a, 0xe55b, 0xe55c, 0xe55d, /*0x20-0x27*/ - 0xe55e, 0xe55f, 0xe560, 0xe561, 0xe562, 0xe563, 0xe564, 0xe565, /*0x28-0x2f*/ - 0xe566, 0xe567, 0xe568, 0xe569, 0xe56a, 0xe56b, 0xe56c, 0xe56d, /*0x30-0x37*/ - 0xe56e, 0xe56f, 0xe570, 0xe571, 0xe572, 0xe573, 0xf6c9, 0xe574, /*0x38-0x3f*/ - 0xe575, 0xe576, 0xe577, 0xe578, 0xe579, 0xe57a, 0xe57b, 0xe57c, /*0x40-0x47*/ - 0xe57d, 0xe57e, 0xe580, 0xe581, 0xe582, 0xe583, 0xe584, 0xe585, /*0x48-0x4f*/ - 0xe586, 0xe587, 0xe588, 0xe589, 0xe58a, 0xe58b, 0xe58c, 0xe58d, /*0x50-0x57*/ - 0xe58e, 0xe58f, 0xe590, 0xe591, 0xe592, 0xe593, 0xe594, 0xe595, /*0x58-0x5f*/ - 0xe596, 0xe597, 0xe598, 0xe599, 0xe59a, 0xe59b, 0xe59c, 0xe59d, /*0x60-0x67*/ - 0xe59e, 0xe59f, 0xf6ca, 0xe5a0, 0xe640, 0xe641, 0xe642, 0xe643, /*0x68-0x6f*/ - 0xe644, 0xe645, 0xe646, 0xe647, 0xe648, 0xe649, 0xe64a, 0xe64b, /*0x70-0x77*/ - 0xe64c, 0xe64d, 0xe64e, 0xe64f, 0xe650, 0xe651, 0xe652, 0xe653, /*0x78-0x7f*/ - 0xe654, 0xe655, 0xe656, 0xe657, 0xe658, 0xe659, 0xe65a, 0xe65b, /*0x80-0x87*/ - 0xe65c, 0xe65d, 0xe65e, 0xe65f, 0xe660, 0xe661, 0xe662, 0xf6cc, /*0x88-0x8f*/ - 0xe663, 0xe664, 0xe665, 0xe666, 0xe667, 0xe668, 0xe669, 0xe66a, /*0x90-0x97*/ - 0xe66b, 0xe66c, 0xe66d, 0xe66e, 0xe66f, 0xe670, 0xe671, 0xe672, /*0x98-0x9f*/ - 0xe673, 0xe674, 0xe675, 0xe676, 0xe677, 0xe678, 0xe679, 0xe67a, /*0xa0-0xa7*/ - 0xe67b, 0xe67c, 0xe67d, 0xe67e, 0xe680, 0xe681, 0xe682, 0xe683, /*0xa8-0xaf*/ - 0xe684, 0xe685, 0xe686, 0xe687, 0xe688, 0xe689, 0xe68a, 0xe68b, /*0xb0-0xb7*/ - 0xe68c, 0xe68d, 0xe68e, 0xe68f, 0xe690, 0xe691, 0xe692, 0xe693, /*0xb8-0xbf*/ - 0xe694, 0xe695, 0xe696, 0xe697, 0xe698, 0xe699, 0xe69a, 0xe69b, /*0xc0-0xc7*/ - 0xe69c, 0xe69d, 0xf6cb, 0xe69e, 0xe69f, 0xe6a0, 0xe740, 0xe741, /*0xc8-0xcf*/ - 0xe742, 0xe743, 0xe744, 0xe745, 0xe746, 0xe747, 0xf7e9, 0xe748, /*0xd0-0xd7*/ - 0xe749, 0xe74a, 0xe74b, 0xe74c, 0xe74d, 0xe74e, 0xe74f, 0xe750, /*0xd8-0xdf*/ - 0xe751, 0xe752, 0xe753, 0xe754, 0xe755, 0xe756, 0xe757, 0xe758, /*0xe0-0xe7*/ - 0xe759, 0xe75a, 0xe75b, 0xe75c, 0xe75d, 0xe75e, 0xe75f, 0xe760, /*0xe8-0xef*/ - 0xe761, 0xe762, 0xe763, 0xe764, 0xe765, 0xe766, 0xe767, 0xe768, /*0xf0-0xf7*/ - 0xe769, 0xe76a, 0xe76b, 0xe76c, 0xe76d, 0xe76e, 0xe76f, 0xe770, /*0xf8-0xff*/ - /* 0x9400 */ - 0xe771, 0xe772, 0xe773, 0xe774, 0xe775, 0xe776, 0xe777, 0xe778, /*0x00-0x07*/ - 0xe779, 0xe77a, 0xe77b, 0xe77c, 0xe77d, 0xe77e, 0xe780, 0xe781, /*0x08-0x0f*/ - 0xe782, 0xe783, 0xe784, 0xe785, 0xe786, 0xe787, 0xe788, 0xe789, /*0x10-0x17*/ - 0xe78a, 0xe78b, 0xe78c, 0xe78d, 0xe78e, 0xe78f, 0xe790, 0xe791, /*0x18-0x1f*/ - 0xe792, 0xe793, 0xe794, 0xe795, 0xe796, 0xe797, 0xe798, 0xe799, /*0x20-0x27*/ - 0xe79a, 0xe79b, 0xe79c, 0xe79d, 0xe79e, 0xe79f, 0xe7a0, 0xe840, /*0x28-0x2f*/ - 0xe841, 0xe842, 0xe843, 0xe844, 0xe845, 0xe846, 0xe847, 0xe848, /*0x30-0x37*/ - 0xe849, 0xe84a, 0xe84b, 0xe84c, 0xe84d, 0xe84e, 0xf6cd, 0xe84f, /*0x38-0x3f*/ - 0xe850, 0xe851, 0xe852, 0xe853, 0xe854, 0xe855, 0xe856, 0xe857, /*0x40-0x47*/ - 0xe858, 0xe859, 0xe85a, 0xe85b, 0xe85c, 0xe85d, 0xe85e, 0xe85f, /*0x48-0x4f*/ - 0xe860, 0xe861, 0xe862, 0xe863, 0xe864, 0xe865, 0xe866, 0xe867, /*0x50-0x57*/ - 0xe868, 0xe869, 0xe86a, 0xe86b, 0xe86c, 0xe86d, 0xe86e, 0xe86f, /*0x58-0x5f*/ - 0xe870, 0xe871, 0xe872, 0xe873, 0xe874, 0xe875, 0xe876, 0xe877, /*0x60-0x67*/ - 0xe878, 0xe879, 0xe87a, 0xf6ce, 0xe87b, 0xe87c, 0xe87d, 0xe87e, /*0x68-0x6f*/ - 0xe880, 0xe881, 0xe882, 0xe883, 0xe884, 0xe885, 0xe886, 0xe887, /*0x70-0x77*/ - 0xe888, 0xe889, 0xe88a, 0xe88b, 0xe88c, 0xe88d, 0xe88e, 0xe88f, /*0x78-0x7f*/ - 0xe890, 0xe891, 0xe892, 0xe893, 0xe894, 0xeec4, 0xeec5, 0xeec6, /*0x80-0x87*/ - 0xd5eb, 0xb6a4, 0xeec8, 0xeec7, 0xeec9, 0xeeca, 0xc7a5, 0xeecb, /*0x88-0x8f*/ - 0xeecc, 0xe895, 0xb7b0, 0xb5f6, 0xeecd, 0xeecf, 0xe896, 0xeece, /*0x90-0x97*/ - 0xe897, 0xb8c6, 0xeed0, 0xeed1, 0xeed2, 0xb6db, 0xb3ae, 0xd6d3, /*0x98-0x9f*/ - 0xc4c6, 0xb1b5, 0xb8d6, 0xeed3, 0xeed4, 0xd4bf, 0xc7d5, 0xbefb, /*0xa0-0xa7*/ - 0xced9, 0xb9b3, 0xeed6, 0xeed5, 0xeed8, 0xeed7, 0xc5a5, 0xeed9, /*0xa8-0xaf*/ - 0xeeda, 0xc7ae, 0xeedb, 0xc7af, 0xeedc, 0xb2a7, 0xeedd, 0xeede, /*0xb0-0xb7*/ - 0xeedf, 0xeee0, 0xeee1, 0xd7ea, 0xeee2, 0xeee3, 0xbcd8, 0xeee4, /*0xb8-0xbf*/ - 0xd3cb, 0xccfa, 0xb2ac, 0xc1e5, 0xeee5, 0xc7a6, 0xc3ad, 0xe898, /*0xc0-0xc7*/ - 0xeee6, 0xeee7, 0xeee8, 0xeee9, 0xeeea, 0xeeeb, 0xeeec, 0xe899, /*0xc8-0xcf*/ - 0xeeed, 0xeeee, 0xeeef, 0xe89a, 0xe89b, 0xeef0, 0xeef1, 0xeef2, /*0xd0-0xd7*/ - 0xeef4, 0xeef3, 0xe89c, 0xeef5, 0xcdad, 0xc2c1, 0xeef6, 0xeef7, /*0xd8-0xdf*/ - 0xeef8, 0xd5a1, 0xeef9, 0xcfb3, 0xeefa, 0xeefb, 0xe89d, 0xeefc, /*0xe0-0xe7*/ - 0xeefd, 0xefa1, 0xeefe, 0xefa2, 0xb8f5, 0xc3fa, 0xefa3, 0xefa4, /*0xe8-0xef*/ - 0xbdc2, 0xd2bf, 0xb2f9, 0xefa5, 0xefa6, 0xefa7, 0xd2f8, 0xefa8, /*0xf0-0xf7*/ - 0xd6fd, 0xefa9, 0xc6cc, 0xe89e, 0xefaa, 0xefab, 0xc1b4, 0xefac, /*0xf8-0xff*/ - /* 0x9500 */ - 0xcffa, 0xcbf8, 0xefae, 0xefad, 0xb3fa, 0xb9f8, 0xefaf, 0xefb0, /*0x00-0x07*/ - 0xd0e2, 0xefb1, 0xefb2, 0xb7e6, 0xd0bf, 0xefb3, 0xefb4, 0xefb5, /*0x08-0x0f*/ - 0xc8f1, 0xcce0, 0xefb6, 0xefb7, 0xefb8, 0xefb9, 0xefba, 0xd5e0, /*0x10-0x17*/ - 0xefbb, 0xb4ed, 0xc3aa, 0xefbc, 0xe89f, 0xefbd, 0xefbe, 0xefbf, /*0x18-0x1f*/ - 0xe8a0, 0xcefd, 0xefc0, 0xc2e0, 0xb4b8, 0xd7b6, 0xbdf5, 0xe940, /*0x20-0x27*/ - 0xcfc7, 0xefc3, 0xefc1, 0xefc2, 0xefc4, 0xb6a7, 0xbcfc, 0xbee2, /*0x28-0x2f*/ - 0xc3cc, 0xefc5, 0xefc6, 0xe941, 0xefc7, 0xefcf, 0xefc8, 0xefc9, /*0x30-0x37*/ - 0xefca, 0xc7c2, 0xeff1, 0xb6cd, 0xefcb, 0xe942, 0xefcc, 0xefcd, /*0x38-0x3f*/ - 0xb6c6, 0xc3be, 0xefce, 0xe943, 0xefd0, 0xefd1, 0xefd2, 0xd5f2, /*0x40-0x47*/ - 0xe944, 0xefd3, 0xc4f7, 0xe945, 0xefd4, 0xc4f8, 0xefd5, 0xefd6, /*0x48-0x4f*/ - 0xb8e4, 0xb0f7, 0xefd7, 0xefd8, 0xefd9, 0xe946, 0xefda, 0xefdb, /*0x50-0x57*/ - 0xefdc, 0xefdd, 0xe947, 0xefde, 0xbeb5, 0xefe1, 0xefdf, 0xefe0, /*0x58-0x5f*/ - 0xe948, 0xefe2, 0xefe3, 0xc1cd, 0xefe4, 0xefe5, 0xefe6, 0xefe7, /*0x60-0x67*/ - 0xefe8, 0xefe9, 0xefea, 0xefeb, 0xefec, 0xc0d8, 0xe949, 0xefed, /*0x68-0x6f*/ - 0xc1ad, 0xefee, 0xefef, 0xeff0, 0xe94a, 0xe94b, 0xcfe2, 0xe94c, /*0x70-0x77*/ - 0xe94d, 0xe94e, 0xe94f, 0xe950, 0xe951, 0xe952, 0xe953, 0xb3a4, /*0x78-0x7f*/ - 0xe954, 0xe955, 0xe956, 0xe957, 0xe958, 0xe959, 0xe95a, 0xe95b, /*0x80-0x87*/ - 0xe95c, 0xe95d, 0xe95e, 0xe95f, 0xe960, 0xe961, 0xe962, 0xe963, /*0x88-0x8f*/ - 0xe964, 0xe965, 0xe966, 0xe967, 0xe968, 0xe969, 0xe96a, 0xe96b, /*0x90-0x97*/ - 0xe96c, 0xe96d, 0xe96e, 0xe96f, 0xe970, 0xe971, 0xe972, 0xe973, /*0x98-0x9f*/ - 0xe974, 0xe975, 0xe976, 0xe977, 0xe978, 0xe979, 0xe97a, 0xe97b, /*0xa0-0xa7*/ - 0xe97c, 0xe97d, 0xe97e, 0xe980, 0xe981, 0xe982, 0xe983, 0xe984, /*0xa8-0xaf*/ - 0xe985, 0xe986, 0xe987, 0xe988, 0xe989, 0xe98a, 0xe98b, 0xe98c, /*0xb0-0xb7*/ - 0xe98d, 0xe98e, 0xe98f, 0xe990, 0xe991, 0xe992, 0xe993, 0xe994, /*0xb8-0xbf*/ - 0xe995, 0xe996, 0xe997, 0xe998, 0xe999, 0xe99a, 0xe99b, 0xe99c, /*0xc0-0xc7*/ - 0xe99d, 0xe99e, 0xe99f, 0xe9a0, 0xea40, 0xea41, 0xea42, 0xea43, /*0xc8-0xcf*/ - 0xea44, 0xea45, 0xea46, 0xea47, 0xea48, 0xea49, 0xea4a, 0xea4b, /*0xd0-0xd7*/ - 0xea4c, 0xea4d, 0xea4e, 0xea4f, 0xea50, 0xea51, 0xea52, 0xea53, /*0xd8-0xdf*/ - 0xea54, 0xea55, 0xea56, 0xea57, 0xea58, 0xea59, 0xea5a, 0xea5b, /*0xe0-0xe7*/ - 0xc3c5, 0xe3c5, 0xc9c1, 0xe3c6, 0xea5c, 0xb1d5, 0xceca, 0xb4b3, /*0xe8-0xef*/ - 0xc8f2, 0xe3c7, 0xcfd0, 0xe3c8, 0xbce4, 0xe3c9, 0xe3ca, 0xc3c6, /*0xf0-0xf7*/ - 0xd5a2, 0xc4d6, 0xb9eb, 0xcec5, 0xe3cb, 0xc3f6, 0xe3cc, 0xea5d, /*0xf8-0xff*/ - /* 0x9600 */ - 0xb7a7, 0xb8f3, 0xbad2, 0xe3cd, 0xe3ce, 0xd4c4, 0xe3cf, 0xea5e, /*0x00-0x07*/ - 0xe3d0, 0xd1cb, 0xe3d1, 0xe3d2, 0xe3d3, 0xe3d4, 0xd1d6, 0xe3d5, /*0x08-0x0f*/ - 0xb2fb, 0xc0bb, 0xe3d6, 0xea5f, 0xc0ab, 0xe3d7, 0xe3d8, 0xe3d9, /*0x10-0x17*/ - 0xea60, 0xe3da, 0xe3db, 0xea61, 0xb8b7, 0xdae2, 0xea62, 0xb6d3, /*0x18-0x1f*/ - 0xea63, 0xdae4, 0xdae3, 0xea64, 0xea65, 0xea66, 0xea67, 0xea68, /*0x20-0x27*/ - 0xea69, 0xea6a, 0xdae6, 0xea6b, 0xea6c, 0xea6d, 0xc8ee, 0xea6e, /*0x28-0x2f*/ - 0xea6f, 0xdae5, 0xb7c0, 0xd1f4, 0xd2f5, 0xd5f3, 0xbdd7, 0xea70, /*0x30-0x37*/ - 0xea71, 0xea72, 0xea73, 0xd7e8, 0xdae8, 0xdae7, 0xea74, 0xb0a2, /*0x38-0x3f*/ - 0xcdd3, 0xea75, 0xdae9, 0xea76, 0xb8bd, 0xbcca, 0xc2bd, 0xc2a4, /*0x40-0x47*/ - 0xb3c2, 0xdaea, 0xea77, 0xc2aa, 0xc4b0, 0xbdb5, 0xea78, 0xea79, /*0x48-0x4f*/ - 0xcfde, 0xea7a, 0xea7b, 0xea7c, 0xdaeb, 0xc9c2, 0xea7d, 0xea7e, /*0x50-0x57*/ - 0xea80, 0xea81, 0xea82, 0xb1dd, 0xea83, 0xea84, 0xea85, 0xdaec, /*0x58-0x5f*/ - 0xea86, 0xb6b8, 0xd4ba, 0xea87, 0xb3fd, 0xea88, 0xea89, 0xdaed, /*0x60-0x67*/ - 0xd4c9, 0xcfd5, 0xc5e3, 0xea8a, 0xdaee, 0xea8b, 0xea8c, 0xea8d, /*0x68-0x6f*/ - 0xea8e, 0xea8f, 0xdaef, 0xea90, 0xdaf0, 0xc1ea, 0xccd5, 0xcfdd, /*0x70-0x77*/ - 0xea91, 0xea92, 0xea93, 0xea94, 0xea95, 0xea96, 0xea97, 0xea98, /*0x78-0x7f*/ - 0xea99, 0xea9a, 0xea9b, 0xea9c, 0xea9d, 0xd3e7, 0xc2a1, 0xea9e, /*0x80-0x87*/ - 0xdaf1, 0xea9f, 0xeaa0, 0xcbe5, 0xeb40, 0xdaf2, 0xeb41, 0xcbe6, /*0x88-0x8f*/ - 0xd2fe, 0xeb42, 0xeb43, 0xeb44, 0xb8f4, 0xeb45, 0xeb46, 0xdaf3, /*0x90-0x97*/ - 0xb0af, 0xcfb6, 0xeb47, 0xeb48, 0xd5cf, 0xeb49, 0xeb4a, 0xeb4b, /*0x98-0x9f*/ - 0xeb4c, 0xeb4d, 0xeb4e, 0xeb4f, 0xeb50, 0xeb51, 0xeb52, 0xcbed, /*0xa0-0xa7*/ - 0xeb53, 0xeb54, 0xeb55, 0xeb56, 0xeb57, 0xeb58, 0xeb59, 0xeb5a, /*0xa8-0xaf*/ - 0xdaf4, 0xeb5b, 0xeb5c, 0xe3c4, 0xeb5d, 0xeb5e, 0xc1a5, 0xeb5f, /*0xb0-0xb7*/ - 0xeb60, 0xf6bf, 0xeb61, 0xeb62, 0xf6c0, 0xf6c1, 0xc4d1, 0xeb63, /*0xb8-0xbf*/ - 0xc8b8, 0xd1e3, 0xeb64, 0xeb65, 0xd0db, 0xd1c5, 0xbcaf, 0xb9cd, /*0xc0-0xc7*/ - 0xeb66, 0xeff4, 0xeb67, 0xeb68, 0xb4c6, 0xd3ba, 0xf6c2, 0xb3fb, /*0xc8-0xcf*/ - 0xeb69, 0xeb6a, 0xf6c3, 0xeb6b, 0xeb6c, 0xb5f1, 0xeb6d, 0xeb6e, /*0xd0-0xd7*/ - 0xeb6f, 0xeb70, 0xeb71, 0xeb72, 0xeb73, 0xeb74, 0xeb75, 0xeb76, /*0xd8-0xdf*/ - 0xf6c5, 0xeb77, 0xeb78, 0xeb79, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, /*0xe0-0xe7*/ - 0xd3ea, 0xf6a7, 0xd1a9, 0xeb7e, 0xeb80, 0xeb81, 0xeb82, 0xf6a9, /*0xe8-0xef*/ - 0xeb83, 0xeb84, 0xeb85, 0xf6a8, 0xeb86, 0xeb87, 0xc1e3, 0xc0d7, /*0xf0-0xf7*/ - 0xeb88, 0xb1a2, 0xeb89, 0xeb8a, 0xeb8b, 0xeb8c, 0xceed, 0xeb8d, /*0xf8-0xff*/ - /* 0x9700 */ - 0xd0e8, 0xf6ab, 0xeb8e, 0xeb8f, 0xcff6, 0xeb90, 0xf6aa, 0xd5f0, /*0x00-0x07*/ - 0xf6ac, 0xc3b9, 0xeb91, 0xeb92, 0xeb93, 0xbbf4, 0xf6ae, 0xf6ad, /*0x08-0x0f*/ - 0xeb94, 0xeb95, 0xeb96, 0xc4de, 0xeb97, 0xeb98, 0xc1d8, 0xeb99, /*0x10-0x17*/ - 0xeb9a, 0xeb9b, 0xeb9c, 0xeb9d, 0xcbaa, 0xeb9e, 0xcfbc, 0xeb9f, /*0x18-0x1f*/ - 0xeba0, 0xec40, 0xec41, 0xec42, 0xec43, 0xec44, 0xec45, 0xec46, /*0x20-0x27*/ - 0xec47, 0xec48, 0xf6af, 0xec49, 0xec4a, 0xf6b0, 0xec4b, 0xec4c, /*0x28-0x2f*/ - 0xf6b1, 0xec4d, 0xc2b6, 0xec4e, 0xec4f, 0xec50, 0xec51, 0xec52, /*0x30-0x37*/ - 0xb0d4, 0xc5f9, 0xec53, 0xec54, 0xec55, 0xec56, 0xf6b2, 0xec57, /*0x38-0x3f*/ - 0xec58, 0xec59, 0xec5a, 0xec5b, 0xec5c, 0xec5d, 0xec5e, 0xec5f, /*0x40-0x47*/ - 0xec60, 0xec61, 0xec62, 0xec63, 0xec64, 0xec65, 0xec66, 0xec67, /*0x48-0x4f*/ - 0xec68, 0xec69, 0xc7e0, 0xf6a6, 0xec6a, 0xec6b, 0xbeb8, 0xec6c, /*0x50-0x57*/ - 0xec6d, 0xbeb2, 0xec6e, 0xb5e5, 0xec6f, 0xec70, 0xb7c7, 0xec71, /*0x58-0x5f*/ - 0xbfbf, 0xc3d2, 0xc3e6, 0xec72, 0xec73, 0xd8cc, 0xec74, 0xec75, /*0x60-0x67*/ - 0xec76, 0xb8ef, 0xec77, 0xec78, 0xec79, 0xec7a, 0xec7b, 0xec7c, /*0x68-0x6f*/ - 0xec7d, 0xec7e, 0xec80, 0xbdf9, 0xd1a5, 0xec81, 0xb0d0, 0xec82, /*0x70-0x77*/ - 0xec83, 0xec84, 0xec85, 0xec86, 0xf7b0, 0xec87, 0xec88, 0xec89, /*0x78-0x7f*/ - 0xec8a, 0xec8b, 0xec8c, 0xec8d, 0xec8e, 0xf7b1, 0xec8f, 0xec90, /*0x80-0x87*/ - 0xec91, 0xec92, 0xec93, 0xd0ac, 0xec94, 0xb0b0, 0xec95, 0xec96, /*0x88-0x8f*/ - 0xec97, 0xf7b2, 0xf7b3, 0xec98, 0xf7b4, 0xec99, 0xec9a, 0xec9b, /*0x90-0x97*/ - 0xc7ca, 0xec9c, 0xec9d, 0xec9e, 0xec9f, 0xeca0, 0xed40, 0xed41, /*0x98-0x9f*/ - 0xbecf, 0xed42, 0xed43, 0xf7b7, 0xed44, 0xed45, 0xed46, 0xed47, /*0xa0-0xa7*/ - 0xed48, 0xed49, 0xed4a, 0xf7b6, 0xed4b, 0xb1de, 0xed4c, 0xf7b5, /*0xa8-0xaf*/ - 0xed4d, 0xed4e, 0xf7b8, 0xed4f, 0xf7b9, 0xed50, 0xed51, 0xed52, /*0xb0-0xb7*/ - 0xed53, 0xed54, 0xed55, 0xed56, 0xed57, 0xed58, 0xed59, 0xed5a, /*0xb8-0xbf*/ - 0xed5b, 0xed5c, 0xed5d, 0xed5e, 0xed5f, 0xed60, 0xed61, 0xed62, /*0xc0-0xc7*/ - 0xed63, 0xed64, 0xed65, 0xed66, 0xed67, 0xed68, 0xed69, 0xed6a, /*0xc8-0xcf*/ - 0xed6b, 0xed6c, 0xed6d, 0xed6e, 0xed6f, 0xed70, 0xed71, 0xed72, /*0xd0-0xd7*/ - 0xed73, 0xed74, 0xed75, 0xed76, 0xed77, 0xed78, 0xed79, 0xed7a, /*0xd8-0xdf*/ - 0xed7b, 0xed7c, 0xed7d, 0xed7e, 0xed80, 0xed81, 0xcea4, 0xc8cd, /*0xe0-0xe7*/ - 0xed82, 0xbaab, 0xe8b8, 0xe8b9, 0xe8ba, 0xbec2, 0xed83, 0xed84, /*0xe8-0xef*/ - 0xed85, 0xed86, 0xed87, 0xd2f4, 0xed88, 0xd4cf, 0xc9d8, 0xed89, /*0xf0-0xf7*/ - 0xed8a, 0xed8b, 0xed8c, 0xed8d, 0xed8e, 0xed8f, 0xed90, 0xed91, /*0xf8-0xff*/ - /* 0x9800 */ - 0xed92, 0xed93, 0xed94, 0xed95, 0xed96, 0xed97, 0xed98, 0xed99, /*0x00-0x07*/ - 0xed9a, 0xed9b, 0xed9c, 0xed9d, 0xed9e, 0xed9f, 0xeda0, 0xee40, /*0x08-0x0f*/ - 0xee41, 0xee42, 0xee43, 0xee44, 0xee45, 0xee46, 0xee47, 0xee48, /*0x10-0x17*/ - 0xee49, 0xee4a, 0xee4b, 0xee4c, 0xee4d, 0xee4e, 0xee4f, 0xee50, /*0x18-0x1f*/ - 0xee51, 0xee52, 0xee53, 0xee54, 0xee55, 0xee56, 0xee57, 0xee58, /*0x20-0x27*/ - 0xee59, 0xee5a, 0xee5b, 0xee5c, 0xee5d, 0xee5e, 0xee5f, 0xee60, /*0x28-0x2f*/ - 0xee61, 0xee62, 0xee63, 0xee64, 0xee65, 0xee66, 0xee67, 0xee68, /*0x30-0x37*/ - 0xee69, 0xee6a, 0xee6b, 0xee6c, 0xee6d, 0xee6e, 0xee6f, 0xee70, /*0x38-0x3f*/ - 0xee71, 0xee72, 0xee73, 0xee74, 0xee75, 0xee76, 0xee77, 0xee78, /*0x40-0x47*/ - 0xee79, 0xee7a, 0xee7b, 0xee7c, 0xee7d, 0xee7e, 0xee80, 0xee81, /*0x48-0x4f*/ - 0xee82, 0xee83, 0xee84, 0xee85, 0xee86, 0xee87, 0xee88, 0xee89, /*0x50-0x57*/ - 0xee8a, 0xee8b, 0xee8c, 0xee8d, 0xee8e, 0xee8f, 0xee90, 0xee91, /*0x58-0x5f*/ - 0xee92, 0xee93, 0xee94, 0xee95, 0xee96, 0xee97, 0xee98, 0xee99, /*0x60-0x67*/ - 0xee9a, 0xee9b, 0xee9c, 0xee9d, 0xee9e, 0xee9f, 0xeea0, 0xef40, /*0x68-0x6f*/ - 0xef41, 0xef42, 0xef43, 0xef44, 0xef45, 0xd2b3, 0xb6a5, 0xc7ea, /*0x70-0x77*/ - 0xf1fc, 0xcfee, 0xcbb3, 0xd0eb, 0xe7ef, 0xcde7, 0xb9cb, 0xb6d9, /*0x78-0x7f*/ - 0xf1fd, 0xb0e4, 0xcbcc, 0xf1fe, 0xd4a4, 0xc2ad, 0xc1ec, 0xc6c4, /*0x80-0x87*/ - 0xbeb1, 0xf2a1, 0xbcd5, 0xef46, 0xf2a2, 0xf2a3, 0xef47, 0xf2a4, /*0x88-0x8f*/ - 0xd2c3, 0xc6b5, 0xef48, 0xcdc7, 0xf2a5, 0xef49, 0xd3b1, 0xbfc5, /*0x90-0x97*/ - 0xcce2, 0xef4a, 0xf2a6, 0xf2a7, 0xd1d5, 0xb6ee, 0xf2a8, 0xf2a9, /*0x98-0x9f*/ - 0xb5df, 0xf2aa, 0xf2ab, 0xef4b, 0xb2fc, 0xf2ac, 0xf2ad, 0xc8a7, /*0xa0-0xa7*/ - 0xef4c, 0xef4d, 0xef4e, 0xef4f, 0xef50, 0xef51, 0xef52, 0xef53, /*0xa8-0xaf*/ - 0xef54, 0xef55, 0xef56, 0xef57, 0xef58, 0xef59, 0xef5a, 0xef5b, /*0xb0-0xb7*/ - 0xef5c, 0xef5d, 0xef5e, 0xef5f, 0xef60, 0xef61, 0xef62, 0xef63, /*0xb8-0xbf*/ - 0xef64, 0xef65, 0xef66, 0xef67, 0xef68, 0xef69, 0xef6a, 0xef6b, /*0xc0-0xc7*/ - 0xef6c, 0xef6d, 0xef6e, 0xef6f, 0xef70, 0xef71, 0xb7e7, 0xef72, /*0xc8-0xcf*/ - 0xef73, 0xeca9, 0xecaa, 0xecab, 0xef74, 0xecac, 0xef75, 0xef76, /*0xd0-0xd7*/ - 0xc6ae, 0xecad, 0xecae, 0xef77, 0xef78, 0xef79, 0xb7c9, 0xcab3, /*0xd8-0xdf*/ - 0xef7a, 0xef7b, 0xef7c, 0xef7d, 0xef7e, 0xef80, 0xef81, 0xe2b8, /*0xe0-0xe7*/ - 0xf7cf, 0xef82, 0xef83, 0xef84, 0xef85, 0xef86, 0xef87, 0xef88, /*0xe8-0xef*/ - 0xef89, 0xef8a, 0xef8b, 0xef8c, 0xef8d, 0xef8e, 0xef8f, 0xef90, /*0xf0-0xf7*/ - 0xef91, 0xef92, 0xef93, 0xef94, 0xef95, 0xef96, 0xef97, 0xef98, /*0xf8-0xff*/ - /* 0x9900 */ - 0xef99, 0xef9a, 0xef9b, 0xef9c, 0xef9d, 0xef9e, 0xef9f, 0xefa0, /*0x00-0x07*/ - 0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf7d0, 0xf045, 0xf046, /*0x08-0x0f*/ - 0xb2cd, 0xf047, 0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, /*0x10-0x17*/ - 0xf04e, 0xf04f, 0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, /*0x18-0x1f*/ - 0xf056, 0xf057, 0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, /*0x20-0x27*/ - 0xf05e, 0xf05f, 0xf060, 0xf061, 0xf062, 0xf063, 0xf7d1, 0xf064, /*0x28-0x2f*/ - 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, /*0x30-0x37*/ - 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, 0xf072, 0xf073, 0xf074, /*0x38-0x3f*/ - 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, /*0x40-0x47*/ - 0xf07d, 0xf07e, 0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, /*0x48-0x4f*/ - 0xf086, 0xf087, 0xf088, 0xf089, 0xf7d3, 0xf7d2, 0xf08a, 0xf08b, /*0x50-0x57*/ - 0xf08c, 0xf08d, 0xf08e, 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, /*0x58-0x5f*/ - 0xf094, 0xf095, 0xf096, 0xe2bb, 0xf097, 0xbca2, 0xf098, 0xe2bc, /*0x60-0x67*/ - 0xe2bd, 0xe2be, 0xe2bf, 0xe2c0, 0xe2c1, 0xb7b9, 0xd2fb, 0xbda4, /*0x68-0x6f*/ - 0xcace, 0xb1a5, 0xcbc7, 0xf099, 0xe2c2, 0xb6fc, 0xc8c4, 0xe2c3, /*0x70-0x77*/ - 0xf09a, 0xf09b, 0xbdc8, 0xf09c, 0xb1fd, 0xe2c4, 0xf09d, 0xb6f6, /*0x78-0x7f*/ - 0xe2c5, 0xc4d9, 0xf09e, 0xf09f, 0xe2c6, 0xcfda, 0xb9dd, 0xe2c7, /*0x80-0x87*/ - 0xc0a1, 0xf0a0, 0xe2c8, 0xb2f6, 0xf140, 0xe2c9, 0xf141, 0xc1f3, /*0x88-0x8f*/ - 0xe2ca, 0xe2cb, 0xc2f8, 0xe2cc, 0xe2cd, 0xe2ce, 0xcad7, 0xd8b8, /*0x90-0x97*/ - 0xd9e5, 0xcfe3, 0xf142, 0xf143, 0xf144, 0xf145, 0xf146, 0xf147, /*0x98-0x9f*/ - 0xf148, 0xf149, 0xf14a, 0xf14b, 0xf14c, 0xf0a5, 0xf14d, 0xf14e, /*0xa0-0xa7*/ - 0xdcb0, 0xf14f, 0xf150, 0xf151, 0xf152, 0xf153, 0xf154, 0xf155, /*0xa8-0xaf*/ - 0xf156, 0xf157, 0xf158, 0xf159, 0xf15a, 0xf15b, 0xf15c, 0xf15d, /*0xb0-0xb7*/ - 0xf15e, 0xf15f, 0xf160, 0xf161, 0xf162, 0xf163, 0xf164, 0xf165, /*0xb8-0xbf*/ - 0xf166, 0xf167, 0xf168, 0xf169, 0xf16a, 0xf16b, 0xf16c, 0xf16d, /*0xc0-0xc7*/ - 0xf16e, 0xf16f, 0xf170, 0xf171, 0xf172, 0xf173, 0xf174, 0xf175, /*0xc8-0xcf*/ - 0xf176, 0xf177, 0xf178, 0xf179, 0xf17a, 0xf17b, 0xf17c, 0xf17d, /*0xd0-0xd7*/ - 0xf17e, 0xf180, 0xf181, 0xf182, 0xf183, 0xf184, 0xf185, 0xf186, /*0xd8-0xdf*/ - 0xf187, 0xf188, 0xf189, 0xf18a, 0xf18b, 0xf18c, 0xf18d, 0xf18e, /*0xe0-0xe7*/ - 0xf18f, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf195, 0xf196, /*0xe8-0xef*/ - 0xf197, 0xf198, 0xf199, 0xf19a, 0xf19b, 0xf19c, 0xf19d, 0xf19e, /*0xf0-0xf7*/ - 0xf19f, 0xf1a0, 0xf240, 0xf241, 0xf242, 0xf243, 0xf244, 0xf245, /*0xf8-0xff*/ - /* 0x9a00 */ - 0xf246, 0xf247, 0xf248, 0xf249, 0xf24a, 0xf24b, 0xf24c, 0xf24d, /*0x00-0x07*/ - 0xf24e, 0xf24f, 0xf250, 0xf251, 0xf252, 0xf253, 0xf254, 0xf255, /*0x08-0x0f*/ - 0xf256, 0xf257, 0xf258, 0xf259, 0xf25a, 0xf25b, 0xf25c, 0xf25d, /*0x10-0x17*/ - 0xf25e, 0xf25f, 0xf260, 0xf261, 0xf262, 0xf263, 0xf264, 0xf265, /*0x18-0x1f*/ - 0xf266, 0xf267, 0xf268, 0xf269, 0xf26a, 0xf26b, 0xf26c, 0xf26d, /*0x20-0x27*/ - 0xf26e, 0xf26f, 0xf270, 0xf271, 0xf272, 0xf273, 0xf274, 0xf275, /*0x28-0x2f*/ - 0xf276, 0xf277, 0xf278, 0xf279, 0xf27a, 0xf27b, 0xf27c, 0xf27d, /*0x30-0x37*/ - 0xf27e, 0xf280, 0xf281, 0xf282, 0xf283, 0xf284, 0xf285, 0xf286, /*0x38-0x3f*/ - 0xf287, 0xf288, 0xf289, 0xf28a, 0xf28b, 0xf28c, 0xf28d, 0xf28e, /*0x40-0x47*/ - 0xf28f, 0xf290, 0xf291, 0xf292, 0xf293, 0xf294, 0xf295, 0xf296, /*0x48-0x4f*/ - 0xf297, 0xf298, 0xf299, 0xf29a, 0xf29b, 0xf29c, 0xf29d, 0xf29e, /*0x50-0x57*/ - 0xf29f, 0xf2a0, 0xf340, 0xf341, 0xf342, 0xf343, 0xf344, 0xf345, /*0x58-0x5f*/ - 0xf346, 0xf347, 0xf348, 0xf349, 0xf34a, 0xf34b, 0xf34c, 0xf34d, /*0x60-0x67*/ - 0xf34e, 0xf34f, 0xf350, 0xf351, 0xc2ed, 0xd4a6, 0xcdd4, 0xd1b1, /*0x68-0x6f*/ - 0xb3db, 0xc7fd, 0xf352, 0xb2b5, 0xc2bf, 0xe6e0, 0xcabb, 0xe6e1, /*0x70-0x77*/ - 0xe6e2, 0xbed4, 0xe6e3, 0xd7a4, 0xcdd5, 0xe6e5, 0xbcdd, 0xe6e4, /*0x78-0x7f*/ - 0xe6e6, 0xe6e7, 0xc2ee, 0xf353, 0xbdbe, 0xe6e8, 0xc2e6, 0xbaa7, /*0x80-0x87*/ - 0xe6e9, 0xf354, 0xe6ea, 0xb3d2, 0xd1e9, 0xf355, 0xf356, 0xbfa5, /*0x88-0x8f*/ - 0xe6eb, 0xc6ef, 0xe6ec, 0xe6ed, 0xf357, 0xf358, 0xe6ee, 0xc6ad, /*0x90-0x97*/ - 0xe6ef, 0xf359, 0xc9a7, 0xe6f0, 0xe6f1, 0xe6f2, 0xe5b9, 0xe6f3, /*0x98-0x9f*/ - 0xe6f4, 0xc2e2, 0xe6f5, 0xe6f6, 0xd6e8, 0xe6f7, 0xf35a, 0xe6f8, /*0xa0-0xa7*/ - 0xb9c7, 0xf35b, 0xf35c, 0xf35d, 0xf35e, 0xf35f, 0xf360, 0xf361, /*0xa8-0xaf*/ - 0xf7bb, 0xf7ba, 0xf362, 0xf363, 0xf364, 0xf365, 0xf7be, 0xf7bc, /*0xb0-0xb7*/ - 0xbaa1, 0xf366, 0xf7bf, 0xf367, 0xf7c0, 0xf368, 0xf369, 0xf36a, /*0xb8-0xbf*/ - 0xf7c2, 0xf7c1, 0xf7c4, 0xf36b, 0xf36c, 0xf7c3, 0xf36d, 0xf36e, /*0xc0-0xc7*/ - 0xf36f, 0xf370, 0xf371, 0xf7c5, 0xf7c6, 0xf372, 0xf373, 0xf374, /*0xc8-0xcf*/ - 0xf375, 0xf7c7, 0xf376, 0xcbe8, 0xf377, 0xf378, 0xf379, 0xf37a, /*0xd0-0xd7*/ - 0xb8df, 0xf37b, 0xf37c, 0xf37d, 0xf37e, 0xf380, 0xf381, 0xf7d4, /*0xd8-0xdf*/ - 0xf382, 0xf7d5, 0xf383, 0xf384, 0xf385, 0xf386, 0xf7d6, 0xf387, /*0xe0-0xe7*/ - 0xf388, 0xf389, 0xf38a, 0xf7d8, 0xf38b, 0xf7da, 0xf38c, 0xf7d7, /*0xe8-0xef*/ - 0xf38d, 0xf38e, 0xf38f, 0xf390, 0xf391, 0xf392, 0xf393, 0xf394, /*0xf0-0xf7*/ - 0xf395, 0xf7db, 0xf396, 0xf7d9, 0xf397, 0xf398, 0xf399, 0xf39a, /*0xf8-0xff*/ - /* 0x9b00 */ - 0xf39b, 0xf39c, 0xf39d, 0xd7d7, 0xf39e, 0xf39f, 0xf3a0, 0xf440, /*0x00-0x07*/ - 0xf7dc, 0xf441, 0xf442, 0xf443, 0xf444, 0xf445, 0xf446, 0xf7dd, /*0x08-0x0f*/ - 0xf447, 0xf448, 0xf449, 0xf7de, 0xf44a, 0xf44b, 0xf44c, 0xf44d, /*0x10-0x17*/ - 0xf44e, 0xf44f, 0xf450, 0xf451, 0xf452, 0xf453, 0xf454, 0xf7df, /*0x18-0x1f*/ - 0xf455, 0xf456, 0xf457, 0xf7e0, 0xf458, 0xf459, 0xf45a, 0xf45b, /*0x20-0x27*/ - 0xf45c, 0xf45d, 0xf45e, 0xf45f, 0xf460, 0xf461, 0xf462, 0xdbcb, /*0x28-0x2f*/ - 0xf463, 0xf464, 0xd8aa, 0xf465, 0xf466, 0xf467, 0xf468, 0xf469, /*0x30-0x37*/ - 0xf46a, 0xf46b, 0xf46c, 0xe5f7, 0xb9ed, 0xf46d, 0xf46e, 0xf46f, /*0x38-0x3f*/ - 0xf470, 0xbffd, 0xbbea, 0xf7c9, 0xc6c7, 0xf7c8, 0xf471, 0xf7ca, /*0x40-0x47*/ - 0xf7cc, 0xf7cb, 0xf472, 0xf473, 0xf474, 0xf7cd, 0xf475, 0xceba, /*0x48-0x4f*/ - 0xf476, 0xf7ce, 0xf477, 0xf478, 0xc4a7, 0xf479, 0xf47a, 0xf47b, /*0x50-0x57*/ - 0xf47c, 0xf47d, 0xf47e, 0xf480, 0xf481, 0xf482, 0xf483, 0xf484, /*0x58-0x5f*/ - 0xf485, 0xf486, 0xf487, 0xf488, 0xf489, 0xf48a, 0xf48b, 0xf48c, /*0x60-0x67*/ - 0xf48d, 0xf48e, 0xf48f, 0xf490, 0xf491, 0xf492, 0xf493, 0xf494, /*0x68-0x6f*/ - 0xf495, 0xf496, 0xf497, 0xf498, 0xf499, 0xf49a, 0xf49b, 0xf49c, /*0x70-0x77*/ - 0xf49d, 0xf49e, 0xf49f, 0xf4a0, 0xf540, 0xf541, 0xf542, 0xf543, /*0x78-0x7f*/ - 0xf544, 0xf545, 0xf546, 0xf547, 0xf548, 0xf549, 0xf54a, 0xf54b, /*0x80-0x87*/ - 0xf54c, 0xf54d, 0xf54e, 0xf54f, 0xf550, 0xf551, 0xf552, 0xf553, /*0x88-0x8f*/ - 0xf554, 0xf555, 0xf556, 0xf557, 0xf558, 0xf559, 0xf55a, 0xf55b, /*0x90-0x97*/ - 0xf55c, 0xf55d, 0xf55e, 0xf55f, 0xf560, 0xf561, 0xf562, 0xf563, /*0x98-0x9f*/ - 0xf564, 0xf565, 0xf566, 0xf567, 0xf568, 0xf569, 0xf56a, 0xf56b, /*0xa0-0xa7*/ - 0xf56c, 0xf56d, 0xf56e, 0xf56f, 0xf570, 0xf571, 0xf572, 0xf573, /*0xa8-0xaf*/ - 0xf574, 0xf575, 0xf576, 0xf577, 0xf578, 0xf579, 0xf57a, 0xf57b, /*0xb0-0xb7*/ - 0xf57c, 0xf57d, 0xf57e, 0xf580, 0xf581, 0xf582, 0xf583, 0xf584, /*0xb8-0xbf*/ - 0xf585, 0xf586, 0xf587, 0xf588, 0xf589, 0xf58a, 0xf58b, 0xf58c, /*0xc0-0xc7*/ - 0xf58d, 0xf58e, 0xf58f, 0xf590, 0xf591, 0xf592, 0xf593, 0xf594, /*0xc8-0xcf*/ - 0xf595, 0xf596, 0xf597, 0xf598, 0xf599, 0xf59a, 0xf59b, 0xf59c, /*0xd0-0xd7*/ - 0xf59d, 0xf59e, 0xf59f, 0xf5a0, 0xf640, 0xf641, 0xf642, 0xf643, /*0xd8-0xdf*/ - 0xf644, 0xf645, 0xf646, 0xf647, 0xf648, 0xf649, 0xf64a, 0xf64b, /*0xe0-0xe7*/ - 0xf64c, 0xf64d, 0xf64e, 0xf64f, 0xf650, 0xf651, 0xf652, 0xf653, /*0xe8-0xef*/ - 0xf654, 0xf655, 0xf656, 0xf657, 0xf658, 0xf659, 0xf65a, 0xf65b, /*0xf0-0xf7*/ - 0xf65c, 0xf65d, 0xf65e, 0xf65f, 0xf660, 0xf661, 0xf662, 0xf663, /*0xf8-0xff*/ - /* 0x9c00 */ - 0xf664, 0xf665, 0xf666, 0xf667, 0xf668, 0xf669, 0xf66a, 0xf66b, /*0x00-0x07*/ - 0xf66c, 0xf66d, 0xf66e, 0xf66f, 0xf670, 0xf671, 0xf672, 0xf673, /*0x08-0x0f*/ - 0xf674, 0xf675, 0xf676, 0xf677, 0xf678, 0xf679, 0xf67a, 0xf67b, /*0x10-0x17*/ - 0xf67c, 0xf67d, 0xf67e, 0xf680, 0xf681, 0xf682, 0xf683, 0xf684, /*0x18-0x1f*/ - 0xf685, 0xf686, 0xf687, 0xf688, 0xf689, 0xf68a, 0xf68b, 0xf68c, /*0x20-0x27*/ - 0xf68d, 0xf68e, 0xf68f, 0xf690, 0xf691, 0xf692, 0xf693, 0xf694, /*0x28-0x2f*/ - 0xf695, 0xf696, 0xf697, 0xf698, 0xf699, 0xf69a, 0xf69b, 0xf69c, /*0x30-0x37*/ - 0xf69d, 0xf69e, 0xf69f, 0xf6a0, 0xf740, 0xf741, 0xf742, 0xf743, /*0x38-0x3f*/ - 0xf744, 0xf745, 0xf746, 0xf747, 0xf748, 0xf749, 0xf74a, 0xf74b, /*0x40-0x47*/ - 0xf74c, 0xf74d, 0xf74e, 0xf74f, 0xf750, 0xf751, 0xf752, 0xf753, /*0x48-0x4f*/ - 0xf754, 0xf755, 0xf756, 0xf757, 0xf758, 0xf759, 0xf75a, 0xf75b, /*0x50-0x57*/ - 0xf75c, 0xf75d, 0xf75e, 0xf75f, 0xf760, 0xf761, 0xf762, 0xf763, /*0x58-0x5f*/ - 0xf764, 0xf765, 0xf766, 0xf767, 0xf768, 0xf769, 0xf76a, 0xf76b, /*0x60-0x67*/ - 0xf76c, 0xf76d, 0xf76e, 0xf76f, 0xf770, 0xf771, 0xf772, 0xf773, /*0x68-0x6f*/ - 0xf774, 0xf775, 0xf776, 0xf777, 0xf778, 0xf779, 0xf77a, 0xf77b, /*0x70-0x77*/ - 0xf77c, 0xf77d, 0xf77e, 0xf780, 0xd3e3, 0xf781, 0xf782, 0xf6cf, /*0x78-0x7f*/ - 0xf783, 0xc2b3, 0xf6d0, 0xf784, 0xf785, 0xf6d1, 0xf6d2, 0xf6d3, /*0x80-0x87*/ - 0xf6d4, 0xf786, 0xf787, 0xf6d6, 0xf788, 0xb1ab, 0xf6d7, 0xf789, /*0x88-0x8f*/ - 0xf6d8, 0xf6d9, 0xf6da, 0xf78a, 0xf6db, 0xf6dc, 0xf78b, 0xf78c, /*0x90-0x97*/ - 0xf78d, 0xf78e, 0xf6dd, 0xf6de, 0xcfca, 0xf78f, 0xf6df, 0xf6e0, /*0x98-0x9f*/ - 0xf6e1, 0xf6e2, 0xf6e3, 0xf6e4, 0xc0f0, 0xf6e5, 0xf6e6, 0xf6e7, /*0xa0-0xa7*/ - 0xf6e8, 0xf6e9, 0xf790, 0xf6ea, 0xf791, 0xf6eb, 0xf6ec, 0xf792, /*0xa8-0xaf*/ - 0xf6ed, 0xf6ee, 0xf6ef, 0xf6f0, 0xf6f1, 0xf6f2, 0xf6f3, 0xf6f4, /*0xb0-0xb7*/ - 0xbea8, 0xf793, 0xf6f5, 0xf6f6, 0xf6f7, 0xf6f8, 0xf794, 0xf795, /*0xb8-0xbf*/ - 0xf796, 0xf797, 0xf798, 0xc8fa, 0xf6f9, 0xf6fa, 0xf6fb, 0xf6fc, /*0xc0-0xc7*/ - 0xf799, 0xf79a, 0xf6fd, 0xf6fe, 0xf7a1, 0xf7a2, 0xf7a3, 0xf7a4, /*0xc8-0xcf*/ - 0xf7a5, 0xf79b, 0xf79c, 0xf7a6, 0xf7a7, 0xf7a8, 0xb1ee, 0xf7a9, /*0xd0-0xd7*/ - 0xf7aa, 0xf7ab, 0xf79d, 0xf79e, 0xf7ac, 0xf7ad, 0xc1db, 0xf7ae, /*0xd8-0xdf*/ - 0xf79f, 0xf7a0, 0xf7af, 0xf840, 0xf841, 0xf842, 0xf843, 0xf844, /*0xe0-0xe7*/ - 0xf845, 0xf846, 0xf847, 0xf848, 0xf849, 0xf84a, 0xf84b, 0xf84c, /*0xe8-0xef*/ - 0xf84d, 0xf84e, 0xf84f, 0xf850, 0xf851, 0xf852, 0xf853, 0xf854, /*0xf0-0xf7*/ - 0xf855, 0xf856, 0xf857, 0xf858, 0xf859, 0xf85a, 0xf85b, 0xf85c, /*0xf8-0xff*/ - /* 0x9d00 */ - 0xf85d, 0xf85e, 0xf85f, 0xf860, 0xf861, 0xf862, 0xf863, 0xf864, /*0x00-0x07*/ - 0xf865, 0xf866, 0xf867, 0xf868, 0xf869, 0xf86a, 0xf86b, 0xf86c, /*0x08-0x0f*/ - 0xf86d, 0xf86e, 0xf86f, 0xf870, 0xf871, 0xf872, 0xf873, 0xf874, /*0x10-0x17*/ - 0xf875, 0xf876, 0xf877, 0xf878, 0xf879, 0xf87a, 0xf87b, 0xf87c, /*0x18-0x1f*/ - 0xf87d, 0xf87e, 0xf880, 0xf881, 0xf882, 0xf883, 0xf884, 0xf885, /*0x20-0x27*/ - 0xf886, 0xf887, 0xf888, 0xf889, 0xf88a, 0xf88b, 0xf88c, 0xf88d, /*0x28-0x2f*/ - 0xf88e, 0xf88f, 0xf890, 0xf891, 0xf892, 0xf893, 0xf894, 0xf895, /*0x30-0x37*/ - 0xf896, 0xf897, 0xf898, 0xf899, 0xf89a, 0xf89b, 0xf89c, 0xf89d, /*0x38-0x3f*/ - 0xf89e, 0xf89f, 0xf8a0, 0xf940, 0xf941, 0xf942, 0xf943, 0xf944, /*0x40-0x47*/ - 0xf945, 0xf946, 0xf947, 0xf948, 0xf949, 0xf94a, 0xf94b, 0xf94c, /*0x48-0x4f*/ - 0xf94d, 0xf94e, 0xf94f, 0xf950, 0xf951, 0xf952, 0xf953, 0xf954, /*0x50-0x57*/ - 0xf955, 0xf956, 0xf957, 0xf958, 0xf959, 0xf95a, 0xf95b, 0xf95c, /*0x58-0x5f*/ - 0xf95d, 0xf95e, 0xf95f, 0xf960, 0xf961, 0xf962, 0xf963, 0xf964, /*0x60-0x67*/ - 0xf965, 0xf966, 0xf967, 0xf968, 0xf969, 0xf96a, 0xf96b, 0xf96c, /*0x68-0x6f*/ - 0xf96d, 0xf96e, 0xf96f, 0xf970, 0xf971, 0xf972, 0xf973, 0xf974, /*0x70-0x77*/ - 0xf975, 0xf976, 0xf977, 0xf978, 0xf979, 0xf97a, 0xf97b, 0xf97c, /*0x78-0x7f*/ - 0xf97d, 0xf97e, 0xf980, 0xf981, 0xf982, 0xf983, 0xf984, 0xf985, /*0x80-0x87*/ - 0xf986, 0xf987, 0xf988, 0xf989, 0xf98a, 0xf98b, 0xf98c, 0xf98d, /*0x88-0x8f*/ - 0xf98e, 0xf98f, 0xf990, 0xf991, 0xf992, 0xf993, 0xf994, 0xf995, /*0x90-0x97*/ - 0xf996, 0xf997, 0xf998, 0xf999, 0xf99a, 0xf99b, 0xf99c, 0xf99d, /*0x98-0x9f*/ - 0xf99e, 0xf99f, 0xf9a0, 0xfa40, 0xfa41, 0xfa42, 0xfa43, 0xfa44, /*0xa0-0xa7*/ - 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0xfa4a, 0xfa4b, 0xfa4c, /*0xa8-0xaf*/ - 0xfa4d, 0xfa4e, 0xfa4f, 0xfa50, 0xfa51, 0xfa52, 0xfa53, 0xfa54, /*0xb0-0xb7*/ - 0xfa55, 0xfa56, 0xfa57, 0xfa58, 0xfa59, 0xfa5a, 0xfa5b, 0xfa5c, /*0xb8-0xbf*/ - 0xfa5d, 0xfa5e, 0xfa5f, 0xfa60, 0xfa61, 0xfa62, 0xfa63, 0xfa64, /*0xc0-0xc7*/ - 0xfa65, 0xfa66, 0xfa67, 0xfa68, 0xfa69, 0xfa6a, 0xfa6b, 0xfa6c, /*0xc8-0xcf*/ - 0xfa6d, 0xfa6e, 0xfa6f, 0xfa70, 0xfa71, 0xfa72, 0xfa73, 0xfa74, /*0xd0-0xd7*/ - 0xfa75, 0xfa76, 0xfa77, 0xfa78, 0xfa79, 0xfa7a, 0xfa7b, 0xfa7c, /*0xd8-0xdf*/ - 0xfa7d, 0xfa7e, 0xfa80, 0xfa81, 0xfa82, 0xfa83, 0xfa84, 0xfa85, /*0xe0-0xe7*/ - 0xfa86, 0xfa87, 0xfa88, 0xfa89, 0xfa8a, 0xfa8b, 0xfa8c, 0xfa8d, /*0xe8-0xef*/ - 0xfa8e, 0xfa8f, 0xfa90, 0xfa91, 0xfa92, 0xfa93, 0xfa94, 0xfa95, /*0xf0-0xf7*/ - 0xfa96, 0xfa97, 0xfa98, 0xfa99, 0xfa9a, 0xfa9b, 0xfa9c, 0xfa9d, /*0xf8-0xff*/ - /* 0x9e00 */ - 0xfa9e, 0xfa9f, 0xfaa0, 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, /*0x00-0x07*/ - 0xfb45, 0xfb46, 0xfb47, 0xfb48, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, /*0x08-0x0f*/ - 0xfb4d, 0xfb4e, 0xfb4f, 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, /*0x10-0x17*/ - 0xfb55, 0xfb56, 0xfb57, 0xfb58, 0xfb59, 0xfb5a, 0xfb5b, 0xc4f1, /*0x18-0x1f*/ - 0xf0af, 0xbca6, 0xf0b0, 0xc3f9, 0xfb5c, 0xc5b8, 0xd1bb, 0xfb5d, /*0x20-0x27*/ - 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xd1bc, 0xfb5e, 0xd1ec, /*0x28-0x2f*/ - 0xfb5f, 0xf0b7, 0xf0b6, 0xd4a7, 0xfb60, 0xcdd2, 0xf0b8, 0xf0ba, /*0x30-0x37*/ - 0xf0b9, 0xf0bb, 0xf0bc, 0xfb61, 0xfb62, 0xb8eb, 0xf0bd, 0xbae8, /*0x38-0x3f*/ - 0xfb63, 0xf0be, 0xf0bf, 0xbee9, 0xf0c0, 0xb6ec, 0xf0c1, 0xf0c2, /*0x40-0x47*/ - 0xf0c3, 0xf0c4, 0xc8b5, 0xf0c5, 0xf0c6, 0xfb64, 0xf0c7, 0xc5f4, /*0x48-0x4f*/ - 0xfb65, 0xf0c8, 0xfb66, 0xfb67, 0xfb68, 0xf0c9, 0xfb69, 0xf0ca, /*0x50-0x57*/ - 0xf7bd, 0xfb6a, 0xf0cb, 0xf0cc, 0xf0cd, 0xfb6b, 0xf0ce, 0xfb6c, /*0x58-0x5f*/ - 0xfb6d, 0xfb6e, 0xfb6f, 0xf0cf, 0xbad7, 0xfb70, 0xf0d0, 0xf0d1, /*0x60-0x67*/ - 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d8, 0xfb71, 0xfb72, /*0x68-0x6f*/ - 0xd3a5, 0xf0d7, 0xfb73, 0xf0d9, 0xfb74, 0xfb75, 0xfb76, 0xfb77, /*0x70-0x77*/ - 0xfb78, 0xfb79, 0xfb7a, 0xfb7b, 0xfb7c, 0xfb7d, 0xf5ba, 0xc2b9, /*0x78-0x7f*/ - 0xfb7e, 0xfb80, 0xf7e4, 0xfb81, 0xfb82, 0xfb83, 0xfb84, 0xf7e5, /*0x80-0x87*/ - 0xf7e6, 0xfb85, 0xfb86, 0xf7e7, 0xfb87, 0xfb88, 0xfb89, 0xfb8a, /*0x88-0x8f*/ - 0xfb8b, 0xfb8c, 0xf7e8, 0xc2b4, 0xfb8d, 0xfb8e, 0xfb8f, 0xfb90, /*0x90-0x97*/ - 0xfb91, 0xfb92, 0xfb93, 0xfb94, 0xfb95, 0xf7ea, 0xfb96, 0xf7eb, /*0x98-0x9f*/ - 0xfb97, 0xfb98, 0xfb99, 0xfb9a, 0xfb9b, 0xfb9c, 0xc2f3, 0xfb9d, /*0xa0-0xa7*/ - 0xfb9e, 0xfb9f, 0xfba0, 0xfc40, 0xfc41, 0xfc42, 0xfc43, 0xfc44, /*0xa8-0xaf*/ - 0xfc45, 0xfc46, 0xfc47, 0xfc48, 0xf4f0, 0xfc49, 0xfc4a, 0xfc4b, /*0xb0-0xb7*/ - 0xf4ef, 0xfc4c, 0xfc4d, 0xc2e9, 0xfc4e, 0xf7e1, 0xf7e2, 0xfc4f, /*0xb8-0xbf*/ - 0xfc50, 0xfc51, 0xfc52, 0xfc53, 0xbbc6, 0xfc54, 0xfc55, 0xfc56, /*0xc0-0xc7*/ - 0xfc57, 0xd9e4, 0xfc58, 0xfc59, 0xfc5a, 0xcaf2, 0xc0e8, 0xf0a4, /*0xc8-0xcf*/ - 0xfc5b, 0xbada, 0xfc5c, 0xfc5d, 0xc7ad, 0xfc5e, 0xfc5f, 0xfc60, /*0xd0-0xd7*/ - 0xc4ac, 0xfc61, 0xfc62, 0xf7ec, 0xf7ed, 0xf7ee, 0xfc63, 0xf7f0, /*0xd8-0xdf*/ - 0xf7ef, 0xfc64, 0xf7f1, 0xfc65, 0xfc66, 0xf7f4, 0xfc67, 0xf7f3, /*0xe0-0xe7*/ - 0xfc68, 0xf7f2, 0xf7f5, 0xfc69, 0xfc6a, 0xfc6b, 0xfc6c, 0xf7f6, /*0xe8-0xef*/ - 0xfc6d, 0xfc6e, 0xfc6f, 0xfc70, 0xfc71, 0xfc72, 0xfc73, 0xfc74, /*0xf0-0xf7*/ - 0xfc75, 0xede9, 0xfc76, 0xedea, 0xedeb, 0xfc77, 0xf6bc, 0xfc78, /*0xf8-0xff*/ - /* 0x9f00 */ - 0xfc79, 0xfc7a, 0xfc7b, 0xfc7c, 0xfc7d, 0xfc7e, 0xfc80, 0xfc81, /*0x00-0x07*/ - 0xfc82, 0xfc83, 0xfc84, 0xf6bd, 0xfc85, 0xf6be, 0xb6a6, 0xfc86, /*0x08-0x0f*/ - 0xd8be, 0xfc87, 0xfc88, 0xb9c4, 0xfc89, 0xfc8a, 0xfc8b, 0xd8bb, /*0x10-0x17*/ - 0xfc8c, 0xdcb1, 0xfc8d, 0xfc8e, 0xfc8f, 0xfc90, 0xfc91, 0xfc92, /*0x18-0x1f*/ - 0xcaf3, 0xfc93, 0xf7f7, 0xfc94, 0xfc95, 0xfc96, 0xfc97, 0xfc98, /*0x20-0x27*/ - 0xfc99, 0xfc9a, 0xfc9b, 0xfc9c, 0xf7f8, 0xfc9d, 0xfc9e, 0xf7f9, /*0x28-0x2f*/ - 0xfc9f, 0xfca0, 0xfd40, 0xfd41, 0xfd42, 0xfd43, 0xfd44, 0xf7fb, /*0x30-0x37*/ - 0xfd45, 0xf7fa, 0xfd46, 0xb1c7, 0xfd47, 0xf7fc, 0xf7fd, 0xfd48, /*0x38-0x3f*/ - 0xfd49, 0xfd4a, 0xfd4b, 0xfd4c, 0xf7fe, 0xfd4d, 0xfd4e, 0xfd4f, /*0x40-0x47*/ - 0xfd50, 0xfd51, 0xfd52, 0xfd53, 0xfd54, 0xfd55, 0xfd56, 0xfd57, /*0x48-0x4f*/ - 0xc6eb, 0xecb4, 0xfd58, 0xfd59, 0xfd5a, 0xfd5b, 0xfd5c, 0xfd5d, /*0x50-0x57*/ - 0xfd5e, 0xfd5f, 0xfd60, 0xfd61, 0xfd62, 0xfd63, 0xfd64, 0xfd65, /*0x58-0x5f*/ - 0xfd66, 0xfd67, 0xfd68, 0xfd69, 0xfd6a, 0xfd6b, 0xfd6c, 0xfd6d, /*0x60-0x67*/ - 0xfd6e, 0xfd6f, 0xfd70, 0xfd71, 0xfd72, 0xfd73, 0xfd74, 0xfd75, /*0x68-0x6f*/ - 0xfd76, 0xfd77, 0xfd78, 0xfd79, 0xfd7a, 0xfd7b, 0xfd7c, 0xfd7d, /*0x70-0x77*/ - 0xfd7e, 0xfd80, 0xfd81, 0xfd82, 0xfd83, 0xfd84, 0xfd85, 0xb3dd, /*0x78-0x7f*/ - 0xf6b3, 0xfd86, 0xfd87, 0xf6b4, 0xc1e4, 0xf6b5, 0xf6b6, 0xf6b7, /*0x80-0x87*/ - 0xf6b8, 0xf6b9, 0xf6ba, 0xc8a3, 0xf6bb, 0xfd88, 0xfd89, 0xfd8a, /*0x88-0x8f*/ - 0xfd8b, 0xfd8c, 0xfd8d, 0xfd8e, 0xfd8f, 0xfd90, 0xfd91, 0xfd92, /*0x90-0x97*/ - 0xfd93, 0xc1fa, 0xb9a8, 0xede8, 0xfd94, 0xfd95, 0xfd96, 0xb9ea, /*0x98-0x9f*/ - 0xd9df, 0xfd97, 0xfd98, 0xfd99, 0xfd9a, 0xfd9b, 0x0000, 0x0000, /*0xa0-0xa7*/ -}; -static const unsigned short gbk_pagef9a[32] = { - 0x0000, 0xfd9d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfd9e, 0x0000, 0x0000, /*0x90-0x97*/ -}; -static const unsigned short gbk_pagef9b[24] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfd9f, /*0xe0-0xe7*/ - 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xe8-0xef*/ - 0x0000, 0xfda0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xf0-0xf7*/ -}; -static const unsigned short gbk_pagefa[40] = { - 0x0000, 0x0000, 0x0000, 0x0000, 0xfe40, 0xfe41, 0xfe42, 0xfe43, /*0x08-0x0f*/ - 0x0000, 0xfe44, 0x0000, 0xfe45, 0xfe46, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ - 0xfe47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe48, /*0x18-0x1f*/ - 0xfe49, 0xfe4a, 0x0000, 0xfe4b, 0xfe4c, 0x0000, 0x0000, 0xfe4d, /*0x20-0x27*/ - 0xfe4e, 0xfe4f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ -}; -static const unsigned short gbk_pagefe[64] = { - 0xa955, 0xa6f2, 0x0000, 0xa6f4, 0xa6f5, 0xa6e0, 0xa6e1, 0xa6f0, /*0x30-0x37*/ - 0xa6f1, 0xa6e2, 0xa6e3, 0xa6ee, 0xa6ef, 0xa6e6, 0xa6e7, 0xa6e4, /*0x38-0x3f*/ - 0xa6e5, 0xa6e8, 0xa6e9, 0xa6ea, 0xa6eb, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ - 0x0000, 0xa968, 0xa969, 0xa96a, 0xa96b, 0xa96c, 0xa96d, 0xa96e, /*0x48-0x4f*/ - 0xa96f, 0xa970, 0xa971, 0x0000, 0xa972, 0xa973, 0xa974, 0xa975, /*0x50-0x57*/ - 0x0000, 0xa976, 0xa977, 0xa978, 0xa979, 0xa97a, 0xa97b, 0xa97c, /*0x58-0x5f*/ - 0xa97d, 0xa97e, 0xa980, 0xa981, 0xa982, 0xa983, 0xa984, 0x0000, /*0x60-0x67*/ - 0xa985, 0xa986, 0xa987, 0xa988, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ -}; -static const unsigned short gbk_pageffa[96] = { - 0x0000, 0xa3a1, 0xa3a2, 0xa3a3, 0xa1e7, 0xa3a5, 0xa3a6, 0xa3a7, /*0x00-0x07*/ - 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, /*0x08-0x0f*/ - 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, /*0x10-0x17*/ - 0xa3b8, 0xa3b9, 0xa3ba, 0xa3bb, 0xa3bc, 0xa3bd, 0xa3be, 0xa3bf, /*0x18-0x1f*/ - 0xa3c0, 0xa3c1, 0xa3c2, 0xa3c3, 0xa3c4, 0xa3c5, 0xa3c6, 0xa3c7, /*0x20-0x27*/ - 0xa3c8, 0xa3c9, 0xa3ca, 0xa3cb, 0xa3cc, 0xa3cd, 0xa3ce, 0xa3cf, /*0x28-0x2f*/ - 0xa3d0, 0xa3d1, 0xa3d2, 0xa3d3, 0xa3d4, 0xa3d5, 0xa3d6, 0xa3d7, /*0x30-0x37*/ - 0xa3d8, 0xa3d9, 0xa3da, 0xa3db, 0xa3dc, 0xa3dd, 0xa3de, 0xa3df, /*0x38-0x3f*/ - 0xa3e0, 0xa3e1, 0xa3e2, 0xa3e3, 0xa3e4, 0xa3e5, 0xa3e6, 0xa3e7, /*0x40-0x47*/ - 0xa3e8, 0xa3e9, 0xa3ea, 0xa3eb, 0xa3ec, 0xa3ed, 0xa3ee, 0xa3ef, /*0x48-0x4f*/ - 0xa3f0, 0xa3f1, 0xa3f2, 0xa3f3, 0xa3f4, 0xa3f5, 0xa3f6, 0xa3f7, /*0x50-0x57*/ - 0xa3f8, 0xa3f9, 0xa3fa, 0xa3fb, 0xa3fc, 0xa3fd, 0xa1ab, 0x0000, /*0x58-0x5f*/ -}; -static const unsigned short gbk_pageffb[8] = { - 0xa1e9, 0xa1ea, 0xa956, 0xa3fe, 0xa957, 0xa3a4, 0x0000, 0x0000, /*0xe0-0xe7*/ -}; - -static int -gbk_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - unsigned short c = 0; - if (wc >= 0x00a0 && wc < 0x0170) - c = gbk_page00[wc-0x00a0]; - else if (wc >= 0x01c8 && wc < 0x01e0) - c = gbk_page01[wc-0x01c8]; - else if (wc >= 0x0250 && wc < 0x0268) - c = gbk_page02a[wc-0x0250]; - else if (wc >= 0x02c0 && wc < 0x02e0) - c = gbk_page02b[wc-0x02c0]; - else if (wc >= 0x0390 && wc < 0x03d0) - c = gbk_page03[wc-0x0390]; - else if (wc >= 0x0400 && wc < 0x0458) - c = gbk_page04[wc-0x0400]; - else if (wc >= 0x2010 && wc < 0x2040) - c = gbk_page20[wc-0x2010]; - else if (wc >= 0x2100 && wc < 0x21a0) - c = gbk_page21[wc-0x2100]; - else if (wc >= 0x2208 && wc < 0x22c0) - c = gbk_page22[wc-0x2208]; - else if (wc == 0x2312) - c = 0xa1d0; - else if (wc >= 0x2460 && wc < 0x24a0) - c = gbk_page24[wc-0x2460]; - else if (wc >= 0x2500 && wc < 0x25e8) - c = gbk_page25[wc-0x2500]; - else if (wc >= 0x2600 && wc < 0x2648) - c = gbk_page26[wc-0x2600]; - else if (wc >= 0x3000 && wc < 0x3130) - c = gbk_page30[wc-0x3000]; - else if (wc >= 0x3220 && wc < 0x3238) - c = gbk_page32[wc-0x3220]; - else if (wc == 0x32a3) - c = 0xa949; - else if (wc >= 0x3388 && wc < 0x33d8) - c = gbk_page33[wc-0x3388]; - else if (wc >= 0x4e00 && wc < 0x9fa8) - c = gbk_page4e[wc-0x4e00]; - else if (wc == 0xf92c) - c = 0xfd9c; - else if (wc >= 0xf978 && wc < 0xf998) - c = gbk_pagef9a[wc-0xf978]; - else if (wc >= 0xf9e0 && wc < 0xf9f8) - c = gbk_pagef9b[wc-0xf9e0]; - else if (wc >= 0xfa08 && wc < 0xfa30) - c = gbk_pagefa[wc-0xfa08]; - else if (wc >= 0xfe30 && wc < 0xfe70) - c = gbk_pagefe[wc-0xfe30]; - else if (wc >= 0xff00 && wc < 0xff60) - c = gbk_pageffa[wc-0xff00]; - else if (wc >= 0xffe0 && wc < 0xffe8) - c = gbk_pageffb[wc-0xffe0]; - if (c != 0) { - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/georgian_academy.h b/nx-X11/lib/X11/lcUniConv/georgian_academy.h deleted file mode 100644 index 0e4350461..000000000 --- a/nx-X11/lib/X11/lcUniConv/georgian_academy.h +++ /dev/null @@ -1,87 +0,0 @@ - -/* - * GEORGIAN-ACADEMY - */ - -static const unsigned short georgian_academy_2uni[32] = { - /* 0x80 */ - 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, - /* 0x90 */ - 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, -}; - -static int -georgian_academy_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0x80 && c < 0xa0) - *pwc = (ucs4_t) georgian_academy_2uni[c-0x80]; - else if (c >= 0xc0 && c < 0xe7) - *pwc = (ucs4_t) c + 0x1010; - else - *pwc = (ucs4_t) c; - return 1; -} - -static const unsigned char georgian_academy_page00[32] = { - 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ -}; -static const unsigned char georgian_academy_page01[72] = { - 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ -}; -static const unsigned char georgian_academy_page02[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ -}; -static const unsigned char georgian_academy_page20[48] = { - 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ - 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ -}; - -static int -georgian_academy_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x0080 && wc < 0x00a0) - c = georgian_academy_page00[wc-0x0080]; - else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e7 && wc < 0x0100)) - c = wc; - else if (wc >= 0x0150 && wc < 0x0198) - c = georgian_academy_page01[wc-0x0150]; - else if (wc >= 0x02c0 && wc < 0x02e0) - c = georgian_academy_page02[wc-0x02c0]; - else if (wc >= 0x10d0 && wc < 0x10f7) - c = wc-0x1010; - else if (wc >= 0x2010 && wc < 0x2040) - c = georgian_academy_page20[wc-0x2010]; - else if (wc == 0x2122) - c = 0x99; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/georgian_ps.h b/nx-X11/lib/X11/lcUniConv/georgian_ps.h deleted file mode 100644 index b96c491df..000000000 --- a/nx-X11/lib/X11/lcUniConv/georgian_ps.h +++ /dev/null @@ -1,104 +0,0 @@ - -/* - * GEORGIAN-PS - */ - -static const unsigned short georgian_ps_2uni_1[32] = { - /* 0x80 */ - 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, - 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, - /* 0x90 */ - 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, -}; -static const unsigned short georgian_ps_2uni_2[39] = { - /* 0xc0 */ - 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10f1, - 0x10d7, 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10f2, 0x10dd, - /* 0xd0 */ - 0x10de, 0x10df, 0x10e0, 0x10e1, 0x10e2, 0x10f3, 0x10e3, 0x10e4, - 0x10e5, 0x10e6, 0x10e7, 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, - /* 0xe0 */ - 0x10ed, 0x10ee, 0x10f4, 0x10ef, 0x10f0, 0x10f5, -}; - -static int -georgian_ps_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0x80 && c < 0xa0) - *pwc = (ucs4_t) georgian_ps_2uni_1[c-0x80]; - else if (c >= 0xc0 && c < 0xe6) - *pwc = (ucs4_t) georgian_ps_2uni_2[c-0xc0]; - else - *pwc = (ucs4_t) c; - return 1; -} - -static const unsigned char georgian_ps_page00[32] = { - 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ - 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ -}; -static const unsigned char georgian_ps_page01[72] = { - 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ -}; -static const unsigned char georgian_ps_page02[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ -}; -static const unsigned char georgian_ps_page10[40] = { - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, /* 0xd0-0xd7 */ - 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xcf, 0xd0, 0xd1, /* 0xd8-0xdf */ - 0xd2, 0xd3, 0xd4, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, /* 0xe0-0xe7 */ - 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe3, /* 0xe8-0xef */ - 0xe4, 0xc7, 0xce, 0xd5, 0xe2, 0xe5, 0x00, 0x00, /* 0xf0-0xf7 */ -}; -static const unsigned char georgian_ps_page20[48] = { - 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ - 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ -}; - -static int -georgian_ps_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x0080 && wc < 0x00a0) - c = georgian_ps_page00[wc-0x0080]; - else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e6 && wc < 0x0100)) - c = wc; - else if (wc >= 0x0150 && wc < 0x0198) - c = georgian_ps_page01[wc-0x0150]; - else if (wc >= 0x02c0 && wc < 0x02e0) - c = georgian_ps_page02[wc-0x02c0]; - else if (wc >= 0x10d0 && wc < 0x10f8) - c = georgian_ps_page10[wc-0x10d0]; - else if (wc >= 0x2010 && wc < 0x2040) - c = georgian_ps_page20[wc-0x2010]; - else if (wc == 0x2122) - c = 0x99; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_1.h b/nx-X11/lib/X11/lcUniConv/iso8859_1.h deleted file mode 100644 index fc302bb44..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_1.h +++ /dev/null @@ -1,22 +0,0 @@ - -/* - * ISO-8859-1 - */ - -static int -iso8859_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - *pwc = (ucs4_t) c; - return 1; -} - -static int -iso8859_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (wc < 0x0100) { - *r = wc; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_10.h b/nx-X11/lib/X11/lcUniConv/iso8859_10.h deleted file mode 100644 index 508db5758..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_10.h +++ /dev/null @@ -1,87 +0,0 @@ - -/* - * ISO-8859-10 - */ - -static const unsigned short iso8859_10_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, - 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, - /* 0xb0 */ - 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, - 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, - /* 0xc0 */ - 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, - /* 0xd0 */ - 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, - 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, - /* 0xe0 */ - 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, - 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, -}; - -static int -iso8859_10_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) iso8859_10_2uni[c-0xa0]; - return 1; -} - -static const unsigned char iso8859_10_page00[224] = { - 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ - 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ - 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0xd0, 0x00, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ - 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ - 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0xf0, 0x00, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ - 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ - /* 0x0100 */ - 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ - 0xa9, 0xb9, 0xa2, 0xb2, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ - 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0xa3, 0xb3, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0xa5, 0xb5, 0xa4, 0xb4, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, /* 0x30-0x37 */ - 0xff, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0xaf, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0xaa, 0xba, 0x00, 0x00, 0x00, 0x00, 0xab, 0xbb, /* 0x60-0x67 */ - 0xd7, 0xf7, 0xae, 0xbe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0x00, /* 0x78-0x7f */ -}; - -static int -iso8859_10_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0180) - c = iso8859_10_page00[wc-0x00a0]; - else if (wc == 0x2015) - c = 0xbd; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_11.h b/nx-X11/lib/X11/lcUniConv/iso8859_11.h deleted file mode 100644 index 5458da514..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_11.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * ISO8859-11 - */ - -static const unsigned short iso8859_11_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - /* 0xb0 */ - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - /* 0xc0 */ - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - /* 0xd0 */ - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, - /* 0xe0 */ - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - /* 0xf0 */ - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, -}; - -static int -iso8859_11_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) { - *pwc = (ucs4_t) c; - return 1; - } - else if (c < 0xa0) { - } - else { - unsigned short wc = iso8859_11_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char iso8859_11_page0e[96] = { - 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ - 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ -}; - -static int -iso8859_11_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080 || wc == 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x0e00 && wc < 0x0e60) - c = iso8859_11_page0e[wc-0x0e00]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_13.h b/nx-X11/lib/X11/lcUniConv/iso8859_13.h deleted file mode 100644 index c041b154a..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_13.h +++ /dev/null @@ -1,90 +0,0 @@ - -/* - * ISO-8859-13 - */ - -static const unsigned short iso8859_13_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, - 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, - 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, - /* 0xc0 */ - 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, - 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, - /* 0xd0 */ - 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, - 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, - /* 0xe0 */ - 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, - 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, - /* 0xf0 */ - 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, - 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, -}; - -static int -iso8859_13_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) iso8859_13_2uni[c-0xa0]; - return 1; -} - -static const unsigned char iso8859_13_page00[224] = { - 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0xc4, 0xc5, 0xaf, 0x00, /* 0xc0-0xc7 */ - 0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0xd3, 0x00, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xa8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0xe4, 0xe5, 0xbf, 0x00, /* 0xe0-0xe7 */ - 0x00, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0xf3, 0x00, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ - /* 0x0100 */ - 0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */ - 0xc6, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0xce, 0xee, 0x00, 0x00, 0xc1, 0xe1, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xed, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0xcf, 0xef, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0xd9, 0xf9, 0xd1, 0xf1, 0xd2, 0xf2, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0xd4, 0xf4, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0x50-0x57 */ - 0x00, 0x00, 0xda, 0xfa, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */ -}; -static const unsigned char iso8859_13_page20[8] = { - 0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */ -}; - -static int -iso8859_13_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0180) - c = iso8859_13_page00[wc-0x00a0]; - else if (wc >= 0x2018 && wc < 0x2020) - c = iso8859_13_page20[wc-0x2018]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_14.h b/nx-X11/lib/X11/lcUniConv/iso8859_14.h deleted file mode 100644 index f01581492..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_14.h +++ /dev/null @@ -1,108 +0,0 @@ - -/* - * ISO-8859-14 - */ - -static const unsigned short iso8859_14_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, - 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, - /* 0xb0 */ - 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, - 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, - /* 0xc0 */ - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - /* 0xd0 */ - 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, -}; - -static int -iso8859_14_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0xa0) - *pwc = (ucs4_t) iso8859_14_2uni[c-0xa0]; - else - *pwc = (ucs4_t) c; - return 1; -} - -static const unsigned char iso8859_14_page00[96] = { - 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0x00, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */ -}; -static const unsigned char iso8859_14_page01_0[32] = { - 0x00, 0x00, 0xa4, 0xa5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ -}; -static const unsigned char iso8859_14_page01_1[16] = { - 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, 0xde, 0xfe, /* 0x70-0x77 */ - 0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ -}; -static const unsigned char iso8859_14_page1e_0[136] = { - 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xb1, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0xb4, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xb9, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0xbb, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0xa8, 0xb8, 0xaa, 0xba, 0xbd, 0xbe, 0x00, 0x00, /* 0x80-0x87 */ -}; -static const unsigned char iso8859_14_page1e_1[8] = { - 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ -}; - -static int -iso8859_14_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0100) - c = iso8859_14_page00[wc-0x00a0]; - else if (wc >= 0x0108 && wc < 0x0128) - c = iso8859_14_page01_0[wc-0x0108]; - else if (wc >= 0x0170 && wc < 0x0180) - c = iso8859_14_page01_1[wc-0x0170]; - else if (wc >= 0x1e00 && wc < 0x1e88) - c = iso8859_14_page1e_0[wc-0x1e00]; - else if (wc >= 0x1ef0 && wc < 0x1ef8) - c = iso8859_14_page1e_1[wc-0x1ef0]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_15.h b/nx-X11/lib/X11/lcUniConv/iso8859_15.h deleted file mode 100644 index 631d9b5e2..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_15.h +++ /dev/null @@ -1,62 +0,0 @@ - -/* - * ISO-8859-15 - */ - -static const unsigned short iso8859_15_2uni[32] = { - /* 0xa0 */ - 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, - 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, - 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, -}; - -static int -iso8859_15_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0xa0 && c < 0xc0) - *pwc = (ucs4_t) iso8859_15_2uni[c-0xa0]; - else - *pwc = (ucs4_t) c; - return 1; -} - -static const unsigned char iso8859_15_page00[32] = { - 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ -}; -static const unsigned char iso8859_15_page01[48] = { - 0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ -}; - -static int -iso8859_15_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00c0) - c = iso8859_15_page00[wc-0x00a0]; - else if (wc >= 0x00c0 && wc < 0x0100) - c = wc; - else if (wc >= 0x0150 && wc < 0x0180) - c = iso8859_15_page01[wc-0x0150]; - else if (wc == 0x20ac) - c = 0xa4; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_16.h b/nx-X11/lib/X11/lcUniConv/iso8859_16.h deleted file mode 100644 index 99a54d98f..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_16.h +++ /dev/null @@ -1,97 +0,0 @@ - -/* - * ISO-8859-16 - */ - -static const unsigned short iso8859_16_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, - 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, - 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, - /* 0xc0 */ - 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - /* 0xd0 */ - 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, - 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, - 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, -}; - -static int -iso8859_16_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) iso8859_16_2uni[c-0xa0]; - return 1; -} - -static const unsigned char iso8859_16_page00[224] = { - 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0xc7, /* 0xc0-0xc7 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0x00, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0x00, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0x00, 0x00, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */ - 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ - /* 0x0100 */ - 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xa2, 0xc5, 0xe5, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0xb2, 0xb9, 0x00, 0x00, /* 0x08-0x0f */ - 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0xd5, 0xf5, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0xbe, 0xac, 0xae, 0xaf, 0xbf, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ -}; -static const unsigned char iso8859_16_page02[8] = { - 0xaa, 0xba, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ -}; -static const unsigned char iso8859_16_page20[8] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xa5, 0x00, /* 0x18-0x1f */ -}; - -static int -iso8859_16_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0180) - c = iso8859_16_page00[wc-0x00a0]; - else if (wc >= 0x0218 && wc < 0x0220) - c = iso8859_16_page02[wc-0x0218]; - else if (wc >= 0x2018 && wc < 0x2020) - c = iso8859_16_page20[wc-0x2018]; - else if (wc == 0x20ac) - c = 0xa4; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_2.h b/nx-X11/lib/X11/lcUniConv/iso8859_2.h deleted file mode 100644 index a63d00424..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_2.h +++ /dev/null @@ -1,93 +0,0 @@ - -/* - * ISO-8859-2 - */ - -static const unsigned short iso8859_2_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, - 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, - /* 0xb0 */ - 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, - 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, - /* 0xc0 */ - 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, - /* 0xd0 */ - 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, - 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, - /* 0xe0 */ - 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, - /* 0xf0 */ - 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, - 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, -}; - -static int -iso8859_2_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) iso8859_2_2uni[c-0xa0]; - return 1; -} - -static const unsigned char iso8859_2_page00[224] = { - 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ - 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ - 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ - 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ - 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ - 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ - /* 0x0100 */ - 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ - 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0xc5, 0xe5, 0x00, 0x00, 0xa5, 0xb5, 0x00, /* 0x38-0x3f */ - 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */ - 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */ - 0xd8, 0xf8, 0xa6, 0xb6, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */ - 0xa9, 0xb9, 0xde, 0xfe, 0xab, 0xbb, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */ - 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ -}; -static const unsigned char iso8859_2_page02[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ -}; - -static int -iso8859_2_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0180) - c = iso8859_2_page00[wc-0x00a0]; - else if (wc >= 0x02c0 && wc < 0x02e0) - c = iso8859_2_page02[wc-0x02c0]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_3.h b/nx-X11/lib/X11/lcUniConv/iso8859_3.h deleted file mode 100644 index 2282f19cf..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_3.h +++ /dev/null @@ -1,99 +0,0 @@ - -/* - * ISO-8859-3 - */ - -static const unsigned short iso8859_3_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0xfffd, 0x0124, 0x00a7, - 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0xfffd, 0x017b, - /* 0xb0 */ - 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, - 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0xfffd, 0x017c, - /* 0xc0 */ - 0x00c0, 0x00c1, 0x00c2, 0xfffd, 0x00c4, 0x010a, 0x0108, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - /* 0xd0 */ - 0xfffd, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, - 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0xfffd, 0x00e4, 0x010b, 0x0109, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0xfffd, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, - 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, -}; - -static int -iso8859_3_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = iso8859_3_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char iso8859_3_page00[96] = { - 0xa0, 0x00, 0x00, 0xa3, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ - 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ -}; -static const unsigned char iso8859_3_page01[120] = { - 0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0xd8, 0xf8, 0xab, 0xbb, /* 0x18-0x1f */ - 0xd5, 0xf5, 0x00, 0x00, 0xa6, 0xb6, 0xa1, 0xb1, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0xa9, 0xb9, 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, 0xaa, 0xba, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */ -}; -static const unsigned char iso8859_3_page02[8] = { - 0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ -}; - -static int -iso8859_3_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0100) - c = iso8859_3_page00[wc-0x00a0]; - else if (wc >= 0x0108 && wc < 0x0180) - c = iso8859_3_page01[wc-0x0108]; - else if (wc >= 0x02d8 && wc < 0x02e0) - c = iso8859_3_page02[wc-0x02d8]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_4.h b/nx-X11/lib/X11/lcUniConv/iso8859_4.h deleted file mode 100644 index 878a7e44a..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_4.h +++ /dev/null @@ -1,93 +0,0 @@ - -/* - * ISO-8859-4 - */ - -static const unsigned short iso8859_4_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, - 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, - /* 0xb0 */ - 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, - 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, - /* 0xc0 */ - 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, - 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, - /* 0xd0 */ - 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, - /* 0xe0 */ - 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, - 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, - /* 0xf0 */ - 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, -}; - -static int -iso8859_4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) iso8859_4_2uni[c-0xa0]; - return 1; -} - -static const unsigned char iso8859_4_page00[224] = { - 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ - 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ - 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ - 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ - 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ - /* 0x0100 */ - 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ - 0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ - 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0xab, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0xa5, 0xb5, 0xcf, 0xef, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0xf3, /* 0x30-0x37 */ - 0xa2, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0xbd, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xb3, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0xa9, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, /* 0x60-0x67 */ - 0xdd, 0xfd, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ -}; -static const unsigned char iso8859_4_page02[32] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ -}; - -static int -iso8859_4_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0180) - c = iso8859_4_page00[wc-0x00a0]; - else if (wc >= 0x02c0 && wc < 0x02e0) - c = iso8859_4_page02[wc-0x02c0]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_5.h b/nx-X11/lib/X11/lcUniConv/iso8859_5.h deleted file mode 100644 index cdd6c45db..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_5.h +++ /dev/null @@ -1,76 +0,0 @@ - -/* - * ISO-8859-5 - */ - -static const unsigned short iso8859_5_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, - /* 0xb0 */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - /* 0xc0 */ - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - /* 0xd0 */ - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - /* 0xe0 */ - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, - /* 0xf0 */ - 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, -}; - -static int -iso8859_5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) iso8859_5_2uni[c-0xa0]; - return 1; -} - -static const unsigned char iso8859_5_page00[16] = { - 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ -}; -static const unsigned char iso8859_5_page04[96] = { - 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ - 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ -}; - -static int -iso8859_5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00b0) - c = iso8859_5_page00[wc-0x00a0]; - else if (wc >= 0x0400 && wc < 0x0460) - c = iso8859_5_page04[wc-0x0400]; - else if (wc == 0x2116) - c = 0xf0; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_6.h b/nx-X11/lib/X11/lcUniConv/iso8859_6.h deleted file mode 100644 index 4c80a64f5..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_6.h +++ /dev/null @@ -1,79 +0,0 @@ - -/* - * ISO-8859-6 - */ - -static const unsigned short iso8859_6_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0xfffd, 0xfffd, 0xfffd, 0x00a4, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x060c, 0x00ad, 0xfffd, 0xfffd, - /* 0xb0 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0x061b, 0xfffd, 0xfffd, 0xfffd, 0x061f, - /* 0xc0 */ - 0xfffd, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, - 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, - /* 0xd0 */ - 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, - 0x0638, 0x0639, 0x063a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xe0 */ - 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, - 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, - /* 0xf0 */ - 0x0650, 0x0651, 0x0652, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, -}; - -static int -iso8859_6_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = iso8859_6_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char iso8859_6_page00[16] = { - 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ -}; -static const unsigned char iso8859_6_page06[80] = { - 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ - 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ - 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ - 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ -}; - -static int -iso8859_6_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00b0) - c = iso8859_6_page00[wc-0x00a0]; - else if (wc >= 0x0608 && wc < 0x0658) - c = iso8859_6_page06[wc-0x0608]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_7.h b/nx-X11/lib/X11/lcUniConv/iso8859_7.h deleted file mode 100644 index 9b500e4b3..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_7.h +++ /dev/null @@ -1,87 +0,0 @@ - -/* - * ISO-8859-7 - */ - -static const unsigned short iso8859_7_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x2018, 0x2019, 0x00a3, 0xfffd, 0xfffd, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0xfffd, 0x00ab, 0x00ac, 0x00ad, 0xfffd, 0x2015, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, - 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, - /* 0xc0 */ - 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, - 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, - /* 0xd0 */ - 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, - 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, - /* 0xe0 */ - 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, - 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, - /* 0xf0 */ - 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, - 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, -}; - -static int -iso8859_7_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = iso8859_7_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char iso8859_7_page00[32] = { - 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ -}; -static const unsigned char iso8859_7_page03[80] = { - 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0x00, /* 0x80-0x87 */ - 0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf, /* 0x88-0x8f */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x90-0x97 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x98-0x9f */ - 0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xa0-0xa7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xa8-0xaf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xb0-0xb7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xb8-0xbf */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xc0-0xc7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */ -}; -static const unsigned char iso8859_7_page20[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */ - 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ -}; - -static int -iso8859_7_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00c0) - c = iso8859_7_page00[wc-0x00a0]; - else if (wc >= 0x0380 && wc < 0x03d0) - c = iso8859_7_page03[wc-0x0380]; - else if (wc >= 0x2010 && wc < 0x2020) - c = iso8859_7_page20[wc-0x2010]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_8.h b/nx-X11/lib/X11/lcUniConv/iso8859_8.h deleted file mode 100644 index 152dc3cae..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_8.h +++ /dev/null @@ -1,88 +0,0 @@ - -/* - * ISO-8859-8 - */ - -static const unsigned short iso8859_8_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0xfffd, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, - 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, - 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0xfffd, - /* 0xc0 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0xd0 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2017, - /* 0xe0 */ - 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, - 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, - /* 0xf0 */ - 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, - 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, -}; - -static int -iso8859_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0xa0) { - unsigned short wc = iso8859_8_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - else { - *pwc = (ucs4_t) c; - return 1; - } - return RET_ILSEQ; -} - -static const unsigned char iso8859_8_page00[88] = { - 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ -}; -static const unsigned char iso8859_8_page05[32] = { - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ - 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ -}; -static const unsigned char iso8859_8_page20[16] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x10-0x17 */ -}; - -static int -iso8859_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00f8) - c = iso8859_8_page00[wc-0x00a0]; - else if (wc >= 0x05d0 && wc < 0x05f0) - c = iso8859_8_page05[wc-0x05d0]; - else if (wc >= 0x2008 && wc < 0x2018) - c = iso8859_8_page20[wc-0x2008]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_9.h b/nx-X11/lib/X11/lcUniConv/iso8859_9.h deleted file mode 100644 index b94ac9de6..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_9.h +++ /dev/null @@ -1,66 +0,0 @@ - -/* - * ISO-8859-9 - */ - -static const unsigned short iso8859_9_2uni[48] = { - /* 0xd0 */ - 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, - 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, - 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, -}; - -static int -iso8859_9_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0xd0) - *pwc = (ucs4_t) iso8859_9_2uni[c-0xd0]; - else - *pwc = (ucs4_t) c; - return 1; -} - -static const unsigned char iso8859_9_page00[48] = { - 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ -}; -static const unsigned char iso8859_9_page01[72] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ -}; - -static int -iso8859_9_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00d0) { - *r = wc; - return 1; - } - else if (wc >= 0x00d0 && wc < 0x0100) - c = iso8859_9_page00[wc-0x00d0]; - else if (wc >= 0x0118 && wc < 0x0160) - c = iso8859_9_page01[wc-0x0118]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/iso8859_9e.h b/nx-X11/lib/X11/lcUniConv/iso8859_9e.h deleted file mode 100644 index cbab5816c..000000000 --- a/nx-X11/lib/X11/lcUniConv/iso8859_9e.h +++ /dev/null @@ -1,102 +0,0 @@ - -/* - * ISO-8859-9E - */ - -static const unsigned short iso8859_9e_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x017d, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x012c, 0x00a7, - 0x016c, 0x00a9, 0x01e6, 0x00ab, 0x014a, 0x00ad, 0x00ae, 0x01d1, - /* 0xb0 */ - 0x00b0, 0x017e, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x012d, 0x00b7, - 0x016d, 0x00b9, 0x01e7, 0x00bb, 0x014b, 0x00bd, 0x0178, 0x01d2, - /* 0xc0 */ - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x018f, 0x00c7, - 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, - /* 0xd0 */ - 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00dd, - 0x019f, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x0259, 0x00e7, - 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, - /* 0xf0 */ - 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00fd, - 0x0275, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, -}; - -static int -iso8859_9e_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c >= 0xa0) - *pwc = (ucs4_t) iso8859_9e_2uni[c-0xa0]; - else - *pwc = (ucs4_t) c; - return 1; -} - -static const unsigned char iso8859_9e_page00[96] = { - 0xa0, 0x00, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ - 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ - 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xd7, 0x00, 0xdf, /* 0xd8-0xdf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0x00, 0xe7, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ - 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ - 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0xf7, 0x00, 0xff, /* 0xf8-0xff */ -}; -static const unsigned char iso8859_9e_page01[136] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, /* 0x28-0x2f */ - 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0xbe, 0x00, 0x00, 0x00, 0x00, 0xa1, 0xb1, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, /* 0x88-0x8f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, /* 0x98-0x9f */ -}; -static const unsigned char iso8859_9e_page01_d[24] = { - 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0xe0-0xe7 */ -}; - -static int -iso8859_9e_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x0100) - c = iso8859_9e_page00[wc-0x00a0]; - else if (wc >= 0x0118 && wc < 0x01a0) - c = iso8859_9e_page01[wc-0x0118]; - else if (wc >= 0x01d0 && wc < 0x01e8) - c = iso8859_9e_page01_d[wc-0x01d0]; - else if (wc == 0x0259) - c = 0xe6; - else if (wc == 0x0275) - c = 0xf8; - else if (wc == 0x20ac) - c = 0xa4; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/jisx0201.h b/nx-X11/lib/X11/lcUniConv/jisx0201.h deleted file mode 100644 index e4af9666f..000000000 --- a/nx-X11/lib/X11/lcUniConv/jisx0201.h +++ /dev/null @@ -1,47 +0,0 @@ - -/* - * JISX0201.1976-0 - */ - -static int -jisx0201_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) { - if (c == 0x5c) - *pwc = (ucs4_t) 0x00a5; - else if (c == 0x7e) - *pwc = (ucs4_t) 0x203e; - else - *pwc = (ucs4_t) c; - return 1; - } else { - if (c >= 0xa1 && c < 0xe0) { - *pwc = (ucs4_t) c + 0xfec0; - return 1; - } - } - return RET_ILSEQ; -} - -static int -jisx0201_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) { - *r = wc; - return 1; - } - if (wc == 0x00a5) { - *r = 0x5c; - return 1; - } - if (wc == 0x203e) { - *r = 0x7e; - return 1; - } - if (wc >= 0xff61 && wc < 0xffa0) { - *r = wc - 0xfec0; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/jisx0208.h b/nx-X11/lib/X11/lcUniConv/jisx0208.h deleted file mode 100644 index 5888f6f21..000000000 --- a/nx-X11/lib/X11/lcUniConv/jisx0208.h +++ /dev/null @@ -1,2396 +0,0 @@ - -/* - * JISX0208.1990-0 - */ - -static const unsigned short jisx0208_2uni_page21[690] = { - /* 0x21 */ - 0x3000, 0x3001, 0x3002, 0xff0c, 0xff0e, 0x30fb, 0xff1a, 0xff1b, - 0xff1f, 0xff01, 0x309b, 0x309c, 0x00b4, 0xff40, 0x00a8, 0xff3e, - 0xffe3, 0xff3f, 0x30fd, 0x30fe, 0x309d, 0x309e, 0x3003, 0x4edd, - 0x3005, 0x3006, 0x3007, 0x30fc, 0x2015, 0x2010, 0xff0f, 0xff3c, - 0x301c, 0x2016, 0xff5c, 0x2026, 0x2025, 0x2018, 0x2019, 0x201c, - 0x201d, 0xff08, 0xff09, 0x3014, 0x3015, 0xff3b, 0xff3d, 0xff5b, - 0xff5d, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, - 0x300f, 0x3010, 0x3011, 0xff0b, 0x2212, 0x00b1, 0x00d7, 0x00f7, - 0xff1d, 0x2260, 0xff1c, 0xff1e, 0x2266, 0x2267, 0x221e, 0x2234, - 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xffe5, 0xff04, - 0x00a2, 0x00a3, 0xff05, 0xff03, 0xff06, 0xff0a, 0xff20, 0x00a7, - 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, - /* 0x22 */ - 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x203b, - 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, 0x2283, 0x222a, - 0x2229, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0x2227, 0x2228, 0x00ac, 0x21d2, 0x21d4, 0x2200, 0x2203, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0x2220, 0x22a5, 0x2312, 0x2202, 0x2207, - 0x2261, 0x2252, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, 0x2235, - 0x222b, 0x222c, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0x212b, 0x2030, 0x266f, 0x266d, 0x266a, 0x2020, 0x2021, - 0x00b6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x25ef, - /* 0x23 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff10, - 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, - 0xff19, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, - 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, - 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, - 0xff39, 0xff3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, - 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, - 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, - 0xff59, 0xff5a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x24 */ - 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, - 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, - 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, - 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, - 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, - 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, - 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, - 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, - 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, - 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, - 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x25 */ - 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, - 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, - 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, - 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, - 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, - 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, - 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, - 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, - 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, - 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, - 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x26 */ - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, - 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, - 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, - 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, - 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x27 */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, - 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, - 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, - 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, - 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, - 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, - 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x28 */ - 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c, - 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b, - 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f, - 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542, -}; -static const unsigned short jisx0208_2uni_page30[6398] = { - /* 0x30 */ - 0x4e9c, 0x5516, 0x5a03, 0x963f, 0x54c0, 0x611b, 0x6328, 0x59f6, - 0x9022, 0x8475, 0x831c, 0x7a50, 0x60aa, 0x63e1, 0x6e25, 0x65ed, - 0x8466, 0x82a6, 0x9bf5, 0x6893, 0x5727, 0x65a1, 0x6271, 0x5b9b, - 0x59d0, 0x867b, 0x98f4, 0x7d62, 0x7dbe, 0x9b8e, 0x6216, 0x7c9f, - 0x88b7, 0x5b89, 0x5eb5, 0x6309, 0x6697, 0x6848, 0x95c7, 0x978d, - 0x674f, 0x4ee5, 0x4f0a, 0x4f4d, 0x4f9d, 0x5049, 0x56f2, 0x5937, - 0x59d4, 0x5a01, 0x5c09, 0x60df, 0x610f, 0x6170, 0x6613, 0x6905, - 0x70ba, 0x754f, 0x7570, 0x79fb, 0x7dad, 0x7def, 0x80c3, 0x840e, - 0x8863, 0x8b02, 0x9055, 0x907a, 0x533b, 0x4e95, 0x4ea5, 0x57df, - 0x80b2, 0x90c1, 0x78ef, 0x4e00, 0x58f1, 0x6ea2, 0x9038, 0x7a32, - 0x8328, 0x828b, 0x9c2f, 0x5141, 0x5370, 0x54bd, 0x54e1, 0x56e0, - 0x59fb, 0x5f15, 0x98f2, 0x6deb, 0x80e4, 0x852d, - /* 0x31 */ - 0x9662, 0x9670, 0x96a0, 0x97fb, 0x540b, 0x53f3, 0x5b87, 0x70cf, - 0x7fbd, 0x8fc2, 0x96e8, 0x536f, 0x9d5c, 0x7aba, 0x4e11, 0x7893, - 0x81fc, 0x6e26, 0x5618, 0x5504, 0x6b1d, 0x851a, 0x9c3b, 0x59e5, - 0x53a9, 0x6d66, 0x74dc, 0x958f, 0x5642, 0x4e91, 0x904b, 0x96f2, - 0x834f, 0x990c, 0x53e1, 0x55b6, 0x5b30, 0x5f71, 0x6620, 0x66f3, - 0x6804, 0x6c38, 0x6cf3, 0x6d29, 0x745b, 0x76c8, 0x7a4e, 0x9834, - 0x82f1, 0x885b, 0x8a60, 0x92ed, 0x6db2, 0x75ab, 0x76ca, 0x99c5, - 0x60a6, 0x8b01, 0x8d8a, 0x95b2, 0x698e, 0x53ad, 0x5186, 0x5712, - 0x5830, 0x5944, 0x5bb4, 0x5ef6, 0x6028, 0x63a9, 0x63f4, 0x6cbf, - 0x6f14, 0x708e, 0x7114, 0x7159, 0x71d5, 0x733f, 0x7e01, 0x8276, - 0x82d1, 0x8597, 0x9060, 0x925b, 0x9d1b, 0x5869, 0x65bc, 0x6c5a, - 0x7525, 0x51f9, 0x592e, 0x5965, 0x5f80, 0x5fdc, - /* 0x32 */ - 0x62bc, 0x65fa, 0x6a2a, 0x6b27, 0x6bb4, 0x738b, 0x7fc1, 0x8956, - 0x9d2c, 0x9d0e, 0x9ec4, 0x5ca1, 0x6c96, 0x837b, 0x5104, 0x5c4b, - 0x61b6, 0x81c6, 0x6876, 0x7261, 0x4e59, 0x4ffa, 0x5378, 0x6069, - 0x6e29, 0x7a4f, 0x97f3, 0x4e0b, 0x5316, 0x4eee, 0x4f55, 0x4f3d, - 0x4fa1, 0x4f73, 0x52a0, 0x53ef, 0x5609, 0x590f, 0x5ac1, 0x5bb6, - 0x5be1, 0x79d1, 0x6687, 0x679c, 0x67b6, 0x6b4c, 0x6cb3, 0x706b, - 0x73c2, 0x798d, 0x79be, 0x7a3c, 0x7b87, 0x82b1, 0x82db, 0x8304, - 0x8377, 0x83ef, 0x83d3, 0x8766, 0x8ab2, 0x5629, 0x8ca8, 0x8fe6, - 0x904e, 0x971e, 0x868a, 0x4fc4, 0x5ce8, 0x6211, 0x7259, 0x753b, - 0x81e5, 0x82bd, 0x86fe, 0x8cc0, 0x96c5, 0x9913, 0x99d5, 0x4ecb, - 0x4f1a, 0x89e3, 0x56de, 0x584a, 0x58ca, 0x5efb, 0x5feb, 0x602a, - 0x6094, 0x6062, 0x61d0, 0x6212, 0x62d0, 0x6539, - /* 0x33 */ - 0x9b41, 0x6666, 0x68b0, 0x6d77, 0x7070, 0x754c, 0x7686, 0x7d75, - 0x82a5, 0x87f9, 0x958b, 0x968e, 0x8c9d, 0x51f1, 0x52be, 0x5916, - 0x54b3, 0x5bb3, 0x5d16, 0x6168, 0x6982, 0x6daf, 0x788d, 0x84cb, - 0x8857, 0x8a72, 0x93a7, 0x9ab8, 0x6d6c, 0x99a8, 0x86d9, 0x57a3, - 0x67ff, 0x86ce, 0x920e, 0x5283, 0x5687, 0x5404, 0x5ed3, 0x62e1, - 0x64b9, 0x683c, 0x6838, 0x6bbb, 0x7372, 0x78ba, 0x7a6b, 0x899a, - 0x89d2, 0x8d6b, 0x8f03, 0x90ed, 0x95a3, 0x9694, 0x9769, 0x5b66, - 0x5cb3, 0x697d, 0x984d, 0x984e, 0x639b, 0x7b20, 0x6a2b, 0x6a7f, - 0x68b6, 0x9c0d, 0x6f5f, 0x5272, 0x559d, 0x6070, 0x62ec, 0x6d3b, - 0x6e07, 0x6ed1, 0x845b, 0x8910, 0x8f44, 0x4e14, 0x9c39, 0x53f6, - 0x691b, 0x6a3a, 0x9784, 0x682a, 0x515c, 0x7ac3, 0x84b2, 0x91dc, - 0x938c, 0x565b, 0x9d28, 0x6822, 0x8305, 0x8431, - /* 0x34 */ - 0x7ca5, 0x5208, 0x82c5, 0x74e6, 0x4e7e, 0x4f83, 0x51a0, 0x5bd2, - 0x520a, 0x52d8, 0x52e7, 0x5dfb, 0x559a, 0x582a, 0x59e6, 0x5b8c, - 0x5b98, 0x5bdb, 0x5e72, 0x5e79, 0x60a3, 0x611f, 0x6163, 0x61be, - 0x63db, 0x6562, 0x67d1, 0x6853, 0x68fa, 0x6b3e, 0x6b53, 0x6c57, - 0x6f22, 0x6f97, 0x6f45, 0x74b0, 0x7518, 0x76e3, 0x770b, 0x7aff, - 0x7ba1, 0x7c21, 0x7de9, 0x7f36, 0x7ff0, 0x809d, 0x8266, 0x839e, - 0x89b3, 0x8acc, 0x8cab, 0x9084, 0x9451, 0x9593, 0x9591, 0x95a2, - 0x9665, 0x97d3, 0x9928, 0x8218, 0x4e38, 0x542b, 0x5cb8, 0x5dcc, - 0x73a9, 0x764c, 0x773c, 0x5ca9, 0x7feb, 0x8d0b, 0x96c1, 0x9811, - 0x9854, 0x9858, 0x4f01, 0x4f0e, 0x5371, 0x559c, 0x5668, 0x57fa, - 0x5947, 0x5b09, 0x5bc4, 0x5c90, 0x5e0c, 0x5e7e, 0x5fcc, 0x63ee, - 0x673a, 0x65d7, 0x65e2, 0x671f, 0x68cb, 0x68c4, - /* 0x35 */ - 0x6a5f, 0x5e30, 0x6bc5, 0x6c17, 0x6c7d, 0x757f, 0x7948, 0x5b63, - 0x7a00, 0x7d00, 0x5fbd, 0x898f, 0x8a18, 0x8cb4, 0x8d77, 0x8ecc, - 0x8f1d, 0x98e2, 0x9a0e, 0x9b3c, 0x4e80, 0x507d, 0x5100, 0x5993, - 0x5b9c, 0x622f, 0x6280, 0x64ec, 0x6b3a, 0x72a0, 0x7591, 0x7947, - 0x7fa9, 0x87fb, 0x8abc, 0x8b70, 0x63ac, 0x83ca, 0x97a0, 0x5409, - 0x5403, 0x55ab, 0x6854, 0x6a58, 0x8a70, 0x7827, 0x6775, 0x9ecd, - 0x5374, 0x5ba2, 0x811a, 0x8650, 0x9006, 0x4e18, 0x4e45, 0x4ec7, - 0x4f11, 0x53ca, 0x5438, 0x5bae, 0x5f13, 0x6025, 0x6551, 0x673d, - 0x6c42, 0x6c72, 0x6ce3, 0x7078, 0x7403, 0x7a76, 0x7aae, 0x7b08, - 0x7d1a, 0x7cfe, 0x7d66, 0x65e7, 0x725b, 0x53bb, 0x5c45, 0x5de8, - 0x62d2, 0x62e0, 0x6319, 0x6e20, 0x865a, 0x8a31, 0x8ddd, 0x92f8, - 0x6f01, 0x79a6, 0x9b5a, 0x4ea8, 0x4eab, 0x4eac, - /* 0x36 */ - 0x4f9b, 0x4fa0, 0x50d1, 0x5147, 0x7af6, 0x5171, 0x51f6, 0x5354, - 0x5321, 0x537f, 0x53eb, 0x55ac, 0x5883, 0x5ce1, 0x5f37, 0x5f4a, - 0x602f, 0x6050, 0x606d, 0x631f, 0x6559, 0x6a4b, 0x6cc1, 0x72c2, - 0x72ed, 0x77ef, 0x80f8, 0x8105, 0x8208, 0x854e, 0x90f7, 0x93e1, - 0x97ff, 0x9957, 0x9a5a, 0x4ef0, 0x51dd, 0x5c2d, 0x6681, 0x696d, - 0x5c40, 0x66f2, 0x6975, 0x7389, 0x6850, 0x7c81, 0x50c5, 0x52e4, - 0x5747, 0x5dfe, 0x9326, 0x65a4, 0x6b23, 0x6b3d, 0x7434, 0x7981, - 0x79bd, 0x7b4b, 0x7dca, 0x82b9, 0x83cc, 0x887f, 0x895f, 0x8b39, - 0x8fd1, 0x91d1, 0x541f, 0x9280, 0x4e5d, 0x5036, 0x53e5, 0x533a, - 0x72d7, 0x7396, 0x77e9, 0x82e6, 0x8eaf, 0x99c6, 0x99c8, 0x99d2, - 0x5177, 0x611a, 0x865e, 0x55b0, 0x7a7a, 0x5076, 0x5bd3, 0x9047, - 0x9685, 0x4e32, 0x6adb, 0x91e7, 0x5c51, 0x5c48, - /* 0x37 */ - 0x6398, 0x7a9f, 0x6c93, 0x9774, 0x8f61, 0x7aaa, 0x718a, 0x9688, - 0x7c82, 0x6817, 0x7e70, 0x6851, 0x936c, 0x52f2, 0x541b, 0x85ab, - 0x8a13, 0x7fa4, 0x8ecd, 0x90e1, 0x5366, 0x8888, 0x7941, 0x4fc2, - 0x50be, 0x5211, 0x5144, 0x5553, 0x572d, 0x73ea, 0x578b, 0x5951, - 0x5f62, 0x5f84, 0x6075, 0x6176, 0x6167, 0x61a9, 0x63b2, 0x643a, - 0x656c, 0x666f, 0x6842, 0x6e13, 0x7566, 0x7a3d, 0x7cfb, 0x7d4c, - 0x7d99, 0x7e4b, 0x7f6b, 0x830e, 0x834a, 0x86cd, 0x8a08, 0x8a63, - 0x8b66, 0x8efd, 0x981a, 0x9d8f, 0x82b8, 0x8fce, 0x9be8, 0x5287, - 0x621f, 0x6483, 0x6fc0, 0x9699, 0x6841, 0x5091, 0x6b20, 0x6c7a, - 0x6f54, 0x7a74, 0x7d50, 0x8840, 0x8a23, 0x6708, 0x4ef6, 0x5039, - 0x5026, 0x5065, 0x517c, 0x5238, 0x5263, 0x55a7, 0x570f, 0x5805, - 0x5acc, 0x5efa, 0x61b2, 0x61f8, 0x62f3, 0x6372, - /* 0x38 */ - 0x691c, 0x6a29, 0x727d, 0x72ac, 0x732e, 0x7814, 0x786f, 0x7d79, - 0x770c, 0x80a9, 0x898b, 0x8b19, 0x8ce2, 0x8ed2, 0x9063, 0x9375, - 0x967a, 0x9855, 0x9a13, 0x9e78, 0x5143, 0x539f, 0x53b3, 0x5e7b, - 0x5f26, 0x6e1b, 0x6e90, 0x7384, 0x73fe, 0x7d43, 0x8237, 0x8a00, - 0x8afa, 0x9650, 0x4e4e, 0x500b, 0x53e4, 0x547c, 0x56fa, 0x59d1, - 0x5b64, 0x5df1, 0x5eab, 0x5f27, 0x6238, 0x6545, 0x67af, 0x6e56, - 0x72d0, 0x7cca, 0x88b4, 0x80a1, 0x80e1, 0x83f0, 0x864e, 0x8a87, - 0x8de8, 0x9237, 0x96c7, 0x9867, 0x9f13, 0x4e94, 0x4e92, 0x4f0d, - 0x5348, 0x5449, 0x543e, 0x5a2f, 0x5f8c, 0x5fa1, 0x609f, 0x68a7, - 0x6a8e, 0x745a, 0x7881, 0x8a9e, 0x8aa4, 0x8b77, 0x9190, 0x4e5e, - 0x9bc9, 0x4ea4, 0x4f7c, 0x4faf, 0x5019, 0x5016, 0x5149, 0x516c, - 0x529f, 0x52b9, 0x52fe, 0x539a, 0x53e3, 0x5411, - /* 0x39 */ - 0x540e, 0x5589, 0x5751, 0x57a2, 0x597d, 0x5b54, 0x5b5d, 0x5b8f, - 0x5de5, 0x5de7, 0x5df7, 0x5e78, 0x5e83, 0x5e9a, 0x5eb7, 0x5f18, - 0x6052, 0x614c, 0x6297, 0x62d8, 0x63a7, 0x653b, 0x6602, 0x6643, - 0x66f4, 0x676d, 0x6821, 0x6897, 0x69cb, 0x6c5f, 0x6d2a, 0x6d69, - 0x6e2f, 0x6e9d, 0x7532, 0x7687, 0x786c, 0x7a3f, 0x7ce0, 0x7d05, - 0x7d18, 0x7d5e, 0x7db1, 0x8015, 0x8003, 0x80af, 0x80b1, 0x8154, - 0x818f, 0x822a, 0x8352, 0x884c, 0x8861, 0x8b1b, 0x8ca2, 0x8cfc, - 0x90ca, 0x9175, 0x9271, 0x783f, 0x92fc, 0x95a4, 0x964d, 0x9805, - 0x9999, 0x9ad8, 0x9d3b, 0x525b, 0x52ab, 0x53f7, 0x5408, 0x58d5, - 0x62f7, 0x6fe0, 0x8c6a, 0x8f5f, 0x9eb9, 0x514b, 0x523b, 0x544a, - 0x56fd, 0x7a40, 0x9177, 0x9d60, 0x9ed2, 0x7344, 0x6f09, 0x8170, - 0x7511, 0x5ffd, 0x60da, 0x9aa8, 0x72db, 0x8fbc, - /* 0x3a */ - 0x6b64, 0x9803, 0x4eca, 0x56f0, 0x5764, 0x58be, 0x5a5a, 0x6068, - 0x61c7, 0x660f, 0x6606, 0x6839, 0x68b1, 0x6df7, 0x75d5, 0x7d3a, - 0x826e, 0x9b42, 0x4e9b, 0x4f50, 0x53c9, 0x5506, 0x5d6f, 0x5de6, - 0x5dee, 0x67fb, 0x6c99, 0x7473, 0x7802, 0x8a50, 0x9396, 0x88df, - 0x5750, 0x5ea7, 0x632b, 0x50b5, 0x50ac, 0x518d, 0x6700, 0x54c9, - 0x585e, 0x59bb, 0x5bb0, 0x5f69, 0x624d, 0x63a1, 0x683d, 0x6b73, - 0x6e08, 0x707d, 0x91c7, 0x7280, 0x7815, 0x7826, 0x796d, 0x658e, - 0x7d30, 0x83dc, 0x88c1, 0x8f09, 0x969b, 0x5264, 0x5728, 0x6750, - 0x7f6a, 0x8ca1, 0x51b4, 0x5742, 0x962a, 0x583a, 0x698a, 0x80b4, - 0x54b2, 0x5d0e, 0x57fc, 0x7895, 0x9dfa, 0x4f5c, 0x524a, 0x548b, - 0x643e, 0x6628, 0x6714, 0x67f5, 0x7a84, 0x7b56, 0x7d22, 0x932f, - 0x685c, 0x9bad, 0x7b39, 0x5319, 0x518a, 0x5237, - /* 0x3b */ - 0x5bdf, 0x62f6, 0x64ae, 0x64e6, 0x672d, 0x6bba, 0x85a9, 0x96d1, - 0x7690, 0x9bd6, 0x634c, 0x9306, 0x9bab, 0x76bf, 0x6652, 0x4e09, - 0x5098, 0x53c2, 0x5c71, 0x60e8, 0x6492, 0x6563, 0x685f, 0x71e6, - 0x73ca, 0x7523, 0x7b97, 0x7e82, 0x8695, 0x8b83, 0x8cdb, 0x9178, - 0x9910, 0x65ac, 0x66ab, 0x6b8b, 0x4ed5, 0x4ed4, 0x4f3a, 0x4f7f, - 0x523a, 0x53f8, 0x53f2, 0x55e3, 0x56db, 0x58eb, 0x59cb, 0x59c9, - 0x59ff, 0x5b50, 0x5c4d, 0x5e02, 0x5e2b, 0x5fd7, 0x601d, 0x6307, - 0x652f, 0x5b5c, 0x65af, 0x65bd, 0x65e8, 0x679d, 0x6b62, 0x6b7b, - 0x6c0f, 0x7345, 0x7949, 0x79c1, 0x7cf8, 0x7d19, 0x7d2b, 0x80a2, - 0x8102, 0x81f3, 0x8996, 0x8a5e, 0x8a69, 0x8a66, 0x8a8c, 0x8aee, - 0x8cc7, 0x8cdc, 0x96cc, 0x98fc, 0x6b6f, 0x4e8b, 0x4f3c, 0x4f8d, - 0x5150, 0x5b57, 0x5bfa, 0x6148, 0x6301, 0x6642, - /* 0x3c */ - 0x6b21, 0x6ecb, 0x6cbb, 0x723e, 0x74bd, 0x75d4, 0x78c1, 0x793a, - 0x800c, 0x8033, 0x81ea, 0x8494, 0x8f9e, 0x6c50, 0x9e7f, 0x5f0f, - 0x8b58, 0x9d2b, 0x7afa, 0x8ef8, 0x5b8d, 0x96eb, 0x4e03, 0x53f1, - 0x57f7, 0x5931, 0x5ac9, 0x5ba4, 0x6089, 0x6e7f, 0x6f06, 0x75be, - 0x8cea, 0x5b9f, 0x8500, 0x7be0, 0x5072, 0x67f4, 0x829d, 0x5c61, - 0x854a, 0x7e1e, 0x820e, 0x5199, 0x5c04, 0x6368, 0x8d66, 0x659c, - 0x716e, 0x793e, 0x7d17, 0x8005, 0x8b1d, 0x8eca, 0x906e, 0x86c7, - 0x90aa, 0x501f, 0x52fa, 0x5c3a, 0x6753, 0x707c, 0x7235, 0x914c, - 0x91c8, 0x932b, 0x82e5, 0x5bc2, 0x5f31, 0x60f9, 0x4e3b, 0x53d6, - 0x5b88, 0x624b, 0x6731, 0x6b8a, 0x72e9, 0x73e0, 0x7a2e, 0x816b, - 0x8da3, 0x9152, 0x9996, 0x5112, 0x53d7, 0x546a, 0x5bff, 0x6388, - 0x6a39, 0x7dac, 0x9700, 0x56da, 0x53ce, 0x5468, - /* 0x3d */ - 0x5b97, 0x5c31, 0x5dde, 0x4fee, 0x6101, 0x62fe, 0x6d32, 0x79c0, - 0x79cb, 0x7d42, 0x7e4d, 0x7fd2, 0x81ed, 0x821f, 0x8490, 0x8846, - 0x8972, 0x8b90, 0x8e74, 0x8f2f, 0x9031, 0x914b, 0x916c, 0x96c6, - 0x919c, 0x4ec0, 0x4f4f, 0x5145, 0x5341, 0x5f93, 0x620e, 0x67d4, - 0x6c41, 0x6e0b, 0x7363, 0x7e26, 0x91cd, 0x9283, 0x53d4, 0x5919, - 0x5bbf, 0x6dd1, 0x795d, 0x7e2e, 0x7c9b, 0x587e, 0x719f, 0x51fa, - 0x8853, 0x8ff0, 0x4fca, 0x5cfb, 0x6625, 0x77ac, 0x7ae3, 0x821c, - 0x99ff, 0x51c6, 0x5faa, 0x65ec, 0x696f, 0x6b89, 0x6df3, 0x6e96, - 0x6f64, 0x76fe, 0x7d14, 0x5de1, 0x9075, 0x9187, 0x9806, 0x51e6, - 0x521d, 0x6240, 0x6691, 0x66d9, 0x6e1a, 0x5eb6, 0x7dd2, 0x7f72, - 0x66f8, 0x85af, 0x85f7, 0x8af8, 0x52a9, 0x53d9, 0x5973, 0x5e8f, - 0x5f90, 0x6055, 0x92e4, 0x9664, 0x50b7, 0x511f, - /* 0x3e */ - 0x52dd, 0x5320, 0x5347, 0x53ec, 0x54e8, 0x5546, 0x5531, 0x5617, - 0x5968, 0x59be, 0x5a3c, 0x5bb5, 0x5c06, 0x5c0f, 0x5c11, 0x5c1a, - 0x5e84, 0x5e8a, 0x5ee0, 0x5f70, 0x627f, 0x6284, 0x62db, 0x638c, - 0x6377, 0x6607, 0x660c, 0x662d, 0x6676, 0x677e, 0x68a2, 0x6a1f, - 0x6a35, 0x6cbc, 0x6d88, 0x6e09, 0x6e58, 0x713c, 0x7126, 0x7167, - 0x75c7, 0x7701, 0x785d, 0x7901, 0x7965, 0x79f0, 0x7ae0, 0x7b11, - 0x7ca7, 0x7d39, 0x8096, 0x83d6, 0x848b, 0x8549, 0x885d, 0x88f3, - 0x8a1f, 0x8a3c, 0x8a54, 0x8a73, 0x8c61, 0x8cde, 0x91a4, 0x9266, - 0x937e, 0x9418, 0x969c, 0x9798, 0x4e0a, 0x4e08, 0x4e1e, 0x4e57, - 0x5197, 0x5270, 0x57ce, 0x5834, 0x58cc, 0x5b22, 0x5e38, 0x60c5, - 0x64fe, 0x6761, 0x6756, 0x6d44, 0x72b6, 0x7573, 0x7a63, 0x84b8, - 0x8b72, 0x91b8, 0x9320, 0x5631, 0x57f4, 0x98fe, - /* 0x3f */ - 0x62ed, 0x690d, 0x6b96, 0x71ed, 0x7e54, 0x8077, 0x8272, 0x89e6, - 0x98df, 0x8755, 0x8fb1, 0x5c3b, 0x4f38, 0x4fe1, 0x4fb5, 0x5507, - 0x5a20, 0x5bdd, 0x5be9, 0x5fc3, 0x614e, 0x632f, 0x65b0, 0x664b, - 0x68ee, 0x699b, 0x6d78, 0x6df1, 0x7533, 0x75b9, 0x771f, 0x795e, - 0x79e6, 0x7d33, 0x81e3, 0x82af, 0x85aa, 0x89aa, 0x8a3a, 0x8eab, - 0x8f9b, 0x9032, 0x91dd, 0x9707, 0x4eba, 0x4ec1, 0x5203, 0x5875, - 0x58ec, 0x5c0b, 0x751a, 0x5c3d, 0x814e, 0x8a0a, 0x8fc5, 0x9663, - 0x976d, 0x7b25, 0x8acf, 0x9808, 0x9162, 0x56f3, 0x53a8, 0x9017, - 0x5439, 0x5782, 0x5e25, 0x63a8, 0x6c34, 0x708a, 0x7761, 0x7c8b, - 0x7fe0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968f, 0x745e, - 0x9ac4, 0x5d07, 0x5d69, 0x6570, 0x67a2, 0x8da8, 0x96db, 0x636e, - 0x6749, 0x6919, 0x83c5, 0x9817, 0x96c0, 0x88fe, - /* 0x40 */ - 0x6f84, 0x647a, 0x5bf8, 0x4e16, 0x702c, 0x755d, 0x662f, 0x51c4, - 0x5236, 0x52e2, 0x59d3, 0x5f81, 0x6027, 0x6210, 0x653f, 0x6574, - 0x661f, 0x6674, 0x68f2, 0x6816, 0x6b63, 0x6e05, 0x7272, 0x751f, - 0x76db, 0x7cbe, 0x8056, 0x58f0, 0x88fd, 0x897f, 0x8aa0, 0x8a93, - 0x8acb, 0x901d, 0x9192, 0x9752, 0x9759, 0x6589, 0x7a0e, 0x8106, - 0x96bb, 0x5e2d, 0x60dc, 0x621a, 0x65a5, 0x6614, 0x6790, 0x77f3, - 0x7a4d, 0x7c4d, 0x7e3e, 0x810a, 0x8cac, 0x8d64, 0x8de1, 0x8e5f, - 0x78a9, 0x5207, 0x62d9, 0x63a5, 0x6442, 0x6298, 0x8a2d, 0x7a83, - 0x7bc0, 0x8aac, 0x96ea, 0x7d76, 0x820c, 0x8749, 0x4ed9, 0x5148, - 0x5343, 0x5360, 0x5ba3, 0x5c02, 0x5c16, 0x5ddd, 0x6226, 0x6247, - 0x64b0, 0x6813, 0x6834, 0x6cc9, 0x6d45, 0x6d17, 0x67d3, 0x6f5c, - 0x714e, 0x717d, 0x65cb, 0x7a7f, 0x7bad, 0x7dda, - /* 0x41 */ - 0x7e4a, 0x7fa8, 0x817a, 0x821b, 0x8239, 0x85a6, 0x8a6e, 0x8cce, - 0x8df5, 0x9078, 0x9077, 0x92ad, 0x9291, 0x9583, 0x9bae, 0x524d, - 0x5584, 0x6f38, 0x7136, 0x5168, 0x7985, 0x7e55, 0x81b3, 0x7cce, - 0x564c, 0x5851, 0x5ca8, 0x63aa, 0x66fe, 0x66fd, 0x695a, 0x72d9, - 0x758f, 0x758e, 0x790e, 0x7956, 0x79df, 0x7c97, 0x7d20, 0x7d44, - 0x8607, 0x8a34, 0x963b, 0x9061, 0x9f20, 0x50e7, 0x5275, 0x53cc, - 0x53e2, 0x5009, 0x55aa, 0x58ee, 0x594f, 0x723d, 0x5b8b, 0x5c64, - 0x531d, 0x60e3, 0x60f3, 0x635c, 0x6383, 0x633f, 0x63bb, 0x64cd, - 0x65e9, 0x66f9, 0x5de3, 0x69cd, 0x69fd, 0x6f15, 0x71e5, 0x4e89, - 0x75e9, 0x76f8, 0x7a93, 0x7cdf, 0x7dcf, 0x7d9c, 0x8061, 0x8349, - 0x8358, 0x846c, 0x84bc, 0x85fb, 0x88c5, 0x8d70, 0x9001, 0x906d, - 0x9397, 0x971c, 0x9a12, 0x50cf, 0x5897, 0x618e, - /* 0x42 */ - 0x81d3, 0x8535, 0x8d08, 0x9020, 0x4fc3, 0x5074, 0x5247, 0x5373, - 0x606f, 0x6349, 0x675f, 0x6e2c, 0x8db3, 0x901f, 0x4fd7, 0x5c5e, - 0x8cca, 0x65cf, 0x7d9a, 0x5352, 0x8896, 0x5176, 0x63c3, 0x5b58, - 0x5b6b, 0x5c0a, 0x640d, 0x6751, 0x905c, 0x4ed6, 0x591a, 0x592a, - 0x6c70, 0x8a51, 0x553e, 0x5815, 0x59a5, 0x60f0, 0x6253, 0x67c1, - 0x8235, 0x6955, 0x9640, 0x99c4, 0x9a28, 0x4f53, 0x5806, 0x5bfe, - 0x8010, 0x5cb1, 0x5e2f, 0x5f85, 0x6020, 0x614b, 0x6234, 0x66ff, - 0x6cf0, 0x6ede, 0x80ce, 0x817f, 0x82d4, 0x888b, 0x8cb8, 0x9000, - 0x902e, 0x968a, 0x9edb, 0x9bdb, 0x4ee3, 0x53f0, 0x5927, 0x7b2c, - 0x918d, 0x984c, 0x9df9, 0x6edd, 0x7027, 0x5353, 0x5544, 0x5b85, - 0x6258, 0x629e, 0x62d3, 0x6ca2, 0x6fef, 0x7422, 0x8a17, 0x9438, - 0x6fc1, 0x8afe, 0x8338, 0x51e7, 0x86f8, 0x53ea, - /* 0x43 */ - 0x53e9, 0x4f46, 0x9054, 0x8fb0, 0x596a, 0x8131, 0x5dfd, 0x7aea, - 0x8fbf, 0x68da, 0x8c37, 0x72f8, 0x9c48, 0x6a3d, 0x8ab0, 0x4e39, - 0x5358, 0x5606, 0x5766, 0x62c5, 0x63a2, 0x65e6, 0x6b4e, 0x6de1, - 0x6e5b, 0x70ad, 0x77ed, 0x7aef, 0x7baa, 0x7dbb, 0x803d, 0x80c6, - 0x86cb, 0x8a95, 0x935b, 0x56e3, 0x58c7, 0x5f3e, 0x65ad, 0x6696, - 0x6a80, 0x6bb5, 0x7537, 0x8ac7, 0x5024, 0x77e5, 0x5730, 0x5f1b, - 0x6065, 0x667a, 0x6c60, 0x75f4, 0x7a1a, 0x7f6e, 0x81f4, 0x8718, - 0x9045, 0x99b3, 0x7bc9, 0x755c, 0x7af9, 0x7b51, 0x84c4, 0x9010, - 0x79e9, 0x7a92, 0x8336, 0x5ae1, 0x7740, 0x4e2d, 0x4ef2, 0x5b99, - 0x5fe0, 0x62bd, 0x663c, 0x67f1, 0x6ce8, 0x866b, 0x8877, 0x8a3b, - 0x914e, 0x92f3, 0x99d0, 0x6a17, 0x7026, 0x732a, 0x82e7, 0x8457, - 0x8caf, 0x4e01, 0x5146, 0x51cb, 0x558b, 0x5bf5, - /* 0x44 */ - 0x5e16, 0x5e33, 0x5e81, 0x5f14, 0x5f35, 0x5f6b, 0x5fb4, 0x61f2, - 0x6311, 0x66a2, 0x671d, 0x6f6e, 0x7252, 0x753a, 0x773a, 0x8074, - 0x8139, 0x8178, 0x8776, 0x8abf, 0x8adc, 0x8d85, 0x8df3, 0x929a, - 0x9577, 0x9802, 0x9ce5, 0x52c5, 0x6357, 0x76f4, 0x6715, 0x6c88, - 0x73cd, 0x8cc3, 0x93ae, 0x9673, 0x6d25, 0x589c, 0x690e, 0x69cc, - 0x8ffd, 0x939a, 0x75db, 0x901a, 0x585a, 0x6802, 0x63b4, 0x69fb, - 0x4f43, 0x6f2c, 0x67d8, 0x8fbb, 0x8526, 0x7db4, 0x9354, 0x693f, - 0x6f70, 0x576a, 0x58f7, 0x5b2c, 0x7d2c, 0x722a, 0x540a, 0x91e3, - 0x9db4, 0x4ead, 0x4f4e, 0x505c, 0x5075, 0x5243, 0x8c9e, 0x5448, - 0x5824, 0x5b9a, 0x5e1d, 0x5e95, 0x5ead, 0x5ef7, 0x5f1f, 0x608c, - 0x62b5, 0x633a, 0x63d0, 0x68af, 0x6c40, 0x7887, 0x798e, 0x7a0b, - 0x7de0, 0x8247, 0x8a02, 0x8ae6, 0x8e44, 0x9013, - /* 0x45 */ - 0x90b8, 0x912d, 0x91d8, 0x9f0e, 0x6ce5, 0x6458, 0x64e2, 0x6575, - 0x6ef4, 0x7684, 0x7b1b, 0x9069, 0x93d1, 0x6eba, 0x54f2, 0x5fb9, - 0x64a4, 0x8f4d, 0x8fed, 0x9244, 0x5178, 0x586b, 0x5929, 0x5c55, - 0x5e97, 0x6dfb, 0x7e8f, 0x751c, 0x8cbc, 0x8ee2, 0x985b, 0x70b9, - 0x4f1d, 0x6bbf, 0x6fb1, 0x7530, 0x96fb, 0x514e, 0x5410, 0x5835, - 0x5857, 0x59ac, 0x5c60, 0x5f92, 0x6597, 0x675c, 0x6e21, 0x767b, - 0x83df, 0x8ced, 0x9014, 0x90fd, 0x934d, 0x7825, 0x783a, 0x52aa, - 0x5ea6, 0x571f, 0x5974, 0x6012, 0x5012, 0x515a, 0x51ac, 0x51cd, - 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5b95, 0x5cf6, 0x5d8b, - 0x60bc, 0x6295, 0x642d, 0x6771, 0x6843, 0x68bc, 0x68df, 0x76d7, - 0x6dd8, 0x6e6f, 0x6d9b, 0x706f, 0x71c8, 0x5f53, 0x75d8, 0x7977, - 0x7b49, 0x7b54, 0x7b52, 0x7cd6, 0x7d71, 0x5230, - /* 0x46 */ - 0x8463, 0x8569, 0x85e4, 0x8a0e, 0x8b04, 0x8c46, 0x8e0f, 0x9003, - 0x900f, 0x9419, 0x9676, 0x982d, 0x9a30, 0x95d8, 0x50cd, 0x52d5, - 0x540c, 0x5802, 0x5c0e, 0x61a7, 0x649e, 0x6d1e, 0x77b3, 0x7ae5, - 0x80f4, 0x8404, 0x9053, 0x9285, 0x5ce0, 0x9d07, 0x533f, 0x5f97, - 0x5fb3, 0x6d9c, 0x7279, 0x7763, 0x79bf, 0x7be4, 0x6bd2, 0x72ec, - 0x8aad, 0x6803, 0x6a61, 0x51f8, 0x7a81, 0x6934, 0x5c4a, 0x9cf6, - 0x82eb, 0x5bc5, 0x9149, 0x701e, 0x5678, 0x5c6f, 0x60c7, 0x6566, - 0x6c8c, 0x8c5a, 0x9041, 0x9813, 0x5451, 0x66c7, 0x920d, 0x5948, - 0x90a3, 0x5185, 0x4e4d, 0x51ea, 0x8599, 0x8b0e, 0x7058, 0x637a, - 0x934b, 0x6962, 0x99b4, 0x7e04, 0x7577, 0x5357, 0x6960, 0x8edf, - 0x96e3, 0x6c5d, 0x4e8c, 0x5c3c, 0x5f10, 0x8fe9, 0x5302, 0x8cd1, - 0x8089, 0x8679, 0x5eff, 0x65e5, 0x4e73, 0x5165, - /* 0x47 */ - 0x5982, 0x5c3f, 0x97ee, 0x4efb, 0x598a, 0x5fcd, 0x8a8d, 0x6fe1, - 0x79b0, 0x7962, 0x5be7, 0x8471, 0x732b, 0x71b1, 0x5e74, 0x5ff5, - 0x637b, 0x649a, 0x71c3, 0x7c98, 0x4e43, 0x5efc, 0x4e4b, 0x57dc, - 0x56a2, 0x60a9, 0x6fc3, 0x7d0d, 0x80fd, 0x8133, 0x81bf, 0x8fb2, - 0x8997, 0x86a4, 0x5df4, 0x628a, 0x64ad, 0x8987, 0x6777, 0x6ce2, - 0x6d3e, 0x7436, 0x7834, 0x5a46, 0x7f75, 0x82ad, 0x99ac, 0x4ff3, - 0x5ec3, 0x62dd, 0x6392, 0x6557, 0x676f, 0x76c3, 0x724c, 0x80cc, - 0x80ba, 0x8f29, 0x914d, 0x500d, 0x57f9, 0x5a92, 0x6885, 0x6973, - 0x7164, 0x72fd, 0x8cb7, 0x58f2, 0x8ce0, 0x966a, 0x9019, 0x877f, - 0x79e4, 0x77e7, 0x8429, 0x4f2f, 0x5265, 0x535a, 0x62cd, 0x67cf, - 0x6cca, 0x767d, 0x7b94, 0x7c95, 0x8236, 0x8584, 0x8feb, 0x66dd, - 0x6f20, 0x7206, 0x7e1b, 0x83ab, 0x99c1, 0x9ea6, - /* 0x48 */ - 0x51fd, 0x7bb1, 0x7872, 0x7bb8, 0x8087, 0x7b48, 0x6ae8, 0x5e61, - 0x808c, 0x7551, 0x7560, 0x516b, 0x9262, 0x6e8c, 0x767a, 0x9197, - 0x9aea, 0x4f10, 0x7f70, 0x629c, 0x7b4f, 0x95a5, 0x9ce9, 0x567a, - 0x5859, 0x86e4, 0x96bc, 0x4f34, 0x5224, 0x534a, 0x53cd, 0x53db, - 0x5e06, 0x642c, 0x6591, 0x677f, 0x6c3e, 0x6c4e, 0x7248, 0x72af, - 0x73ed, 0x7554, 0x7e41, 0x822c, 0x85e9, 0x8ca9, 0x7bc4, 0x91c6, - 0x7169, 0x9812, 0x98ef, 0x633d, 0x6669, 0x756a, 0x76e4, 0x78d0, - 0x8543, 0x86ee, 0x532a, 0x5351, 0x5426, 0x5983, 0x5e87, 0x5f7c, - 0x60b2, 0x6249, 0x6279, 0x62ab, 0x6590, 0x6bd4, 0x6ccc, 0x75b2, - 0x76ae, 0x7891, 0x79d8, 0x7dcb, 0x7f77, 0x80a5, 0x88ab, 0x8ab9, - 0x8cbb, 0x907f, 0x975e, 0x98db, 0x6a0b, 0x7c38, 0x5099, 0x5c3e, - 0x5fae, 0x6787, 0x6bd8, 0x7435, 0x7709, 0x7f8e, - /* 0x49 */ - 0x9f3b, 0x67ca, 0x7a17, 0x5339, 0x758b, 0x9aed, 0x5f66, 0x819d, - 0x83f1, 0x8098, 0x5f3c, 0x5fc5, 0x7562, 0x7b46, 0x903c, 0x6867, - 0x59eb, 0x5a9b, 0x7d10, 0x767e, 0x8b2c, 0x4ff5, 0x5f6a, 0x6a19, - 0x6c37, 0x6f02, 0x74e2, 0x7968, 0x8868, 0x8a55, 0x8c79, 0x5edf, - 0x63cf, 0x75c5, 0x79d2, 0x82d7, 0x9328, 0x92f2, 0x849c, 0x86ed, - 0x9c2d, 0x54c1, 0x5f6c, 0x658c, 0x6d5c, 0x7015, 0x8ca7, 0x8cd3, - 0x983b, 0x654f, 0x74f6, 0x4e0d, 0x4ed8, 0x57e0, 0x592b, 0x5a66, - 0x5bcc, 0x51a8, 0x5e03, 0x5e9c, 0x6016, 0x6276, 0x6577, 0x65a7, - 0x666e, 0x6d6e, 0x7236, 0x7b26, 0x8150, 0x819a, 0x8299, 0x8b5c, - 0x8ca0, 0x8ce6, 0x8d74, 0x961c, 0x9644, 0x4fae, 0x64ab, 0x6b66, - 0x821e, 0x8461, 0x856a, 0x90e8, 0x5c01, 0x6953, 0x98a8, 0x847a, - 0x8557, 0x4f0f, 0x526f, 0x5fa9, 0x5e45, 0x670d, - /* 0x4a */ - 0x798f, 0x8179, 0x8907, 0x8986, 0x6df5, 0x5f17, 0x6255, 0x6cb8, - 0x4ecf, 0x7269, 0x9b92, 0x5206, 0x543b, 0x5674, 0x58b3, 0x61a4, - 0x626e, 0x711a, 0x596e, 0x7c89, 0x7cde, 0x7d1b, 0x96f0, 0x6587, - 0x805e, 0x4e19, 0x4f75, 0x5175, 0x5840, 0x5e63, 0x5e73, 0x5f0a, - 0x67c4, 0x4e26, 0x853d, 0x9589, 0x965b, 0x7c73, 0x9801, 0x50fb, - 0x58c1, 0x7656, 0x78a7, 0x5225, 0x77a5, 0x8511, 0x7b86, 0x504f, - 0x5909, 0x7247, 0x7bc7, 0x7de8, 0x8fba, 0x8fd4, 0x904d, 0x4fbf, - 0x52c9, 0x5a29, 0x5f01, 0x97ad, 0x4fdd, 0x8217, 0x92ea, 0x5703, - 0x6355, 0x6b69, 0x752b, 0x88dc, 0x8f14, 0x7a42, 0x52df, 0x5893, - 0x6155, 0x620a, 0x66ae, 0x6bcd, 0x7c3f, 0x83e9, 0x5023, 0x4ff8, - 0x5305, 0x5446, 0x5831, 0x5949, 0x5b9d, 0x5cf0, 0x5cef, 0x5d29, - 0x5e96, 0x62b1, 0x6367, 0x653e, 0x65b9, 0x670b, - /* 0x4b */ - 0x6cd5, 0x6ce1, 0x70f9, 0x7832, 0x7e2b, 0x80de, 0x82b3, 0x840c, - 0x84ec, 0x8702, 0x8912, 0x8a2a, 0x8c4a, 0x90a6, 0x92d2, 0x98fd, - 0x9cf3, 0x9d6c, 0x4e4f, 0x4ea1, 0x508d, 0x5256, 0x574a, 0x59a8, - 0x5e3d, 0x5fd8, 0x5fd9, 0x623f, 0x66b4, 0x671b, 0x67d0, 0x68d2, - 0x5192, 0x7d21, 0x80aa, 0x81a8, 0x8b00, 0x8c8c, 0x8cbf, 0x927e, - 0x9632, 0x5420, 0x982c, 0x5317, 0x50d5, 0x535c, 0x58a8, 0x64b2, - 0x6734, 0x7267, 0x7766, 0x7a46, 0x91e6, 0x52c3, 0x6ca1, 0x6b86, - 0x5800, 0x5e4c, 0x5954, 0x672c, 0x7ffb, 0x51e1, 0x76c6, 0x6469, - 0x78e8, 0x9b54, 0x9ebb, 0x57cb, 0x59b9, 0x6627, 0x679a, 0x6bce, - 0x54e9, 0x69d9, 0x5e55, 0x819c, 0x6795, 0x9baa, 0x67fe, 0x9c52, - 0x685d, 0x4ea6, 0x4fe3, 0x53c8, 0x62b9, 0x672b, 0x6cab, 0x8fc4, - 0x4fad, 0x7e6d, 0x9ebf, 0x4e07, 0x6162, 0x6e80, - /* 0x4c */ - 0x6f2b, 0x8513, 0x5473, 0x672a, 0x9b45, 0x5df3, 0x7b95, 0x5cac, - 0x5bc6, 0x871c, 0x6e4a, 0x84d1, 0x7a14, 0x8108, 0x5999, 0x7c8d, - 0x6c11, 0x7720, 0x52d9, 0x5922, 0x7121, 0x725f, 0x77db, 0x9727, - 0x9d61, 0x690b, 0x5a7f, 0x5a18, 0x51a5, 0x540d, 0x547d, 0x660e, - 0x76df, 0x8ff7, 0x9298, 0x9cf4, 0x59ea, 0x725d, 0x6ec5, 0x514d, - 0x68c9, 0x7dbf, 0x7dec, 0x9762, 0x9eba, 0x6478, 0x6a21, 0x8302, - 0x5984, 0x5b5f, 0x6bdb, 0x731b, 0x76f2, 0x7db2, 0x8017, 0x8499, - 0x5132, 0x6728, 0x9ed9, 0x76ee, 0x6762, 0x52ff, 0x9905, 0x5c24, - 0x623b, 0x7c7e, 0x8cb0, 0x554f, 0x60b6, 0x7d0b, 0x9580, 0x5301, - 0x4e5f, 0x51b6, 0x591c, 0x723a, 0x8036, 0x91ce, 0x5f25, 0x77e2, - 0x5384, 0x5f79, 0x7d04, 0x85ac, 0x8a33, 0x8e8d, 0x9756, 0x67f3, - 0x85ae, 0x9453, 0x6109, 0x6108, 0x6cb9, 0x7652, - /* 0x4d */ - 0x8aed, 0x8f38, 0x552f, 0x4f51, 0x512a, 0x52c7, 0x53cb, 0x5ba5, - 0x5e7d, 0x60a0, 0x6182, 0x63d6, 0x6709, 0x67da, 0x6e67, 0x6d8c, - 0x7336, 0x7337, 0x7531, 0x7950, 0x88d5, 0x8a98, 0x904a, 0x9091, - 0x90f5, 0x96c4, 0x878d, 0x5915, 0x4e88, 0x4f59, 0x4e0e, 0x8a89, - 0x8f3f, 0x9810, 0x50ad, 0x5e7c, 0x5996, 0x5bb9, 0x5eb8, 0x63da, - 0x63fa, 0x64c1, 0x66dc, 0x694a, 0x69d8, 0x6d0b, 0x6eb6, 0x7194, - 0x7528, 0x7aaf, 0x7f8a, 0x8000, 0x8449, 0x84c9, 0x8981, 0x8b21, - 0x8e0a, 0x9065, 0x967d, 0x990a, 0x617e, 0x6291, 0x6b32, 0x6c83, - 0x6d74, 0x7fcc, 0x7ffc, 0x6dc0, 0x7f85, 0x87ba, 0x88f8, 0x6765, - 0x83b1, 0x983c, 0x96f7, 0x6d1b, 0x7d61, 0x843d, 0x916a, 0x4e71, - 0x5375, 0x5d50, 0x6b04, 0x6feb, 0x85cd, 0x862d, 0x89a7, 0x5229, - 0x540f, 0x5c65, 0x674e, 0x68a8, 0x7406, 0x7483, - /* 0x4e */ - 0x75e2, 0x88cf, 0x88e1, 0x91cc, 0x96e2, 0x9678, 0x5f8b, 0x7387, - 0x7acb, 0x844e, 0x63a0, 0x7565, 0x5289, 0x6d41, 0x6e9c, 0x7409, - 0x7559, 0x786b, 0x7c92, 0x9686, 0x7adc, 0x9f8d, 0x4fb6, 0x616e, - 0x65c5, 0x865c, 0x4e86, 0x4eae, 0x50da, 0x4e21, 0x51cc, 0x5bee, - 0x6599, 0x6881, 0x6dbc, 0x731f, 0x7642, 0x77ad, 0x7a1c, 0x7ce7, - 0x826f, 0x8ad2, 0x907c, 0x91cf, 0x9675, 0x9818, 0x529b, 0x7dd1, - 0x502b, 0x5398, 0x6797, 0x6dcb, 0x71d0, 0x7433, 0x81e8, 0x8f2a, - 0x96a3, 0x9c57, 0x9e9f, 0x7460, 0x5841, 0x6d99, 0x7d2f, 0x985e, - 0x4ee4, 0x4f36, 0x4f8b, 0x51b7, 0x52b1, 0x5dba, 0x601c, 0x73b2, - 0x793c, 0x82d3, 0x9234, 0x96b7, 0x96f6, 0x970a, 0x9e97, 0x9f62, - 0x66a6, 0x6b74, 0x5217, 0x52a3, 0x70c8, 0x88c2, 0x5ec9, 0x604b, - 0x6190, 0x6f23, 0x7149, 0x7c3e, 0x7df4, 0x806f, - /* 0x4f */ - 0x84ee, 0x9023, 0x932c, 0x5442, 0x9b6f, 0x6ad3, 0x7089, 0x8cc2, - 0x8def, 0x9732, 0x52b4, 0x5a41, 0x5eca, 0x5f04, 0x6717, 0x697c, - 0x6994, 0x6d6a, 0x6f0f, 0x7262, 0x72fc, 0x7bed, 0x8001, 0x807e, - 0x874b, 0x90ce, 0x516d, 0x9e93, 0x7984, 0x808b, 0x9332, 0x8ad6, - 0x502d, 0x548c, 0x8a71, 0x6b6a, 0x8cc4, 0x8107, 0x60d1, 0x67a0, - 0x9df2, 0x4e99, 0x4e98, 0x9c10, 0x8a6b, 0x85c1, 0x8568, 0x6900, - 0x6e7e, 0x7897, 0x8155, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x50 */ - 0x5f0c, 0x4e10, 0x4e15, 0x4e2a, 0x4e31, 0x4e36, 0x4e3c, 0x4e3f, - 0x4e42, 0x4e56, 0x4e58, 0x4e82, 0x4e85, 0x8c6b, 0x4e8a, 0x8212, - 0x5f0d, 0x4e8e, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea2, 0x4eb0, 0x4eb3, - 0x4eb6, 0x4ece, 0x4ecd, 0x4ec4, 0x4ec6, 0x4ec2, 0x4ed7, 0x4ede, - 0x4eed, 0x4edf, 0x4ef7, 0x4f09, 0x4f5a, 0x4f30, 0x4f5b, 0x4f5d, - 0x4f57, 0x4f47, 0x4f76, 0x4f88, 0x4f8f, 0x4f98, 0x4f7b, 0x4f69, - 0x4f70, 0x4f91, 0x4f6f, 0x4f86, 0x4f96, 0x5118, 0x4fd4, 0x4fdf, - 0x4fce, 0x4fd8, 0x4fdb, 0x4fd1, 0x4fda, 0x4fd0, 0x4fe4, 0x4fe5, - 0x501a, 0x5028, 0x5014, 0x502a, 0x5025, 0x5005, 0x4f1c, 0x4ff6, - 0x5021, 0x5029, 0x502c, 0x4ffe, 0x4fef, 0x5011, 0x5006, 0x5043, - 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505a, 0x5056, 0x506c, - 0x5078, 0x5080, 0x509a, 0x5085, 0x50b4, 0x50b2, - /* 0x51 */ - 0x50c9, 0x50ca, 0x50b3, 0x50c2, 0x50d6, 0x50de, 0x50e5, 0x50ed, - 0x50e3, 0x50ee, 0x50f9, 0x50f5, 0x5109, 0x5101, 0x5102, 0x5116, - 0x5115, 0x5114, 0x511a, 0x5121, 0x513a, 0x5137, 0x513c, 0x513b, - 0x513f, 0x5140, 0x5152, 0x514c, 0x5154, 0x5162, 0x7af8, 0x5169, - 0x516a, 0x516e, 0x5180, 0x5182, 0x56d8, 0x518c, 0x5189, 0x518f, - 0x5191, 0x5193, 0x5195, 0x5196, 0x51a4, 0x51a6, 0x51a2, 0x51a9, - 0x51aa, 0x51ab, 0x51b3, 0x51b1, 0x51b2, 0x51b0, 0x51b5, 0x51bd, - 0x51c5, 0x51c9, 0x51db, 0x51e0, 0x8655, 0x51e9, 0x51ed, 0x51f0, - 0x51f5, 0x51fe, 0x5204, 0x520b, 0x5214, 0x520e, 0x5227, 0x522a, - 0x522e, 0x5233, 0x5239, 0x524f, 0x5244, 0x524b, 0x524c, 0x525e, - 0x5254, 0x526a, 0x5274, 0x5269, 0x5273, 0x527f, 0x527d, 0x528d, - 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8fa8, - /* 0x52 */ - 0x8fa7, 0x52ac, 0x52ad, 0x52bc, 0x52b5, 0x52c1, 0x52cd, 0x52d7, - 0x52de, 0x52e3, 0x52e6, 0x98ed, 0x52e0, 0x52f3, 0x52f5, 0x52f8, - 0x52f9, 0x5306, 0x5308, 0x7538, 0x530d, 0x5310, 0x530f, 0x5315, - 0x531a, 0x5323, 0x532f, 0x5331, 0x5333, 0x5338, 0x5340, 0x5346, - 0x5345, 0x4e17, 0x5349, 0x534d, 0x51d6, 0x535e, 0x5369, 0x536e, - 0x5918, 0x537b, 0x5377, 0x5382, 0x5396, 0x53a0, 0x53a6, 0x53a5, - 0x53ae, 0x53b0, 0x53b6, 0x53c3, 0x7c12, 0x96d9, 0x53df, 0x66fc, - 0x71ee, 0x53ee, 0x53e8, 0x53ed, 0x53fa, 0x5401, 0x543d, 0x5440, - 0x542c, 0x542d, 0x543c, 0x542e, 0x5436, 0x5429, 0x541d, 0x544e, - 0x548f, 0x5475, 0x548e, 0x545f, 0x5471, 0x5477, 0x5470, 0x5492, - 0x547b, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54c7, 0x54a2, - 0x54b8, 0x54a5, 0x54ac, 0x54c4, 0x54c8, 0x54a8, - /* 0x53 */ - 0x54ab, 0x54c2, 0x54a4, 0x54be, 0x54bc, 0x54d8, 0x54e5, 0x54e6, - 0x550f, 0x5514, 0x54fd, 0x54ee, 0x54ed, 0x54fa, 0x54e2, 0x5539, - 0x5540, 0x5563, 0x554c, 0x552e, 0x555c, 0x5545, 0x5556, 0x5557, - 0x5538, 0x5533, 0x555d, 0x5599, 0x5580, 0x54af, 0x558a, 0x559f, - 0x557b, 0x557e, 0x5598, 0x559e, 0x55ae, 0x557c, 0x5583, 0x55a9, - 0x5587, 0x55a8, 0x55da, 0x55c5, 0x55df, 0x55c4, 0x55dc, 0x55e4, - 0x55d4, 0x5614, 0x55f7, 0x5616, 0x55fe, 0x55fd, 0x561b, 0x55f9, - 0x564e, 0x5650, 0x71df, 0x5634, 0x5636, 0x5632, 0x5638, 0x566b, - 0x5664, 0x562f, 0x566c, 0x566a, 0x5686, 0x5680, 0x568a, 0x56a0, - 0x5694, 0x568f, 0x56a5, 0x56ae, 0x56b6, 0x56b4, 0x56c2, 0x56bc, - 0x56c1, 0x56c3, 0x56c0, 0x56c8, 0x56ce, 0x56d1, 0x56d3, 0x56d7, - 0x56ee, 0x56f9, 0x5700, 0x56ff, 0x5704, 0x5709, - /* 0x54 */ - 0x5708, 0x570b, 0x570d, 0x5713, 0x5718, 0x5716, 0x55c7, 0x571c, - 0x5726, 0x5737, 0x5738, 0x574e, 0x573b, 0x5740, 0x574f, 0x5769, - 0x57c0, 0x5788, 0x5761, 0x577f, 0x5789, 0x5793, 0x57a0, 0x57b3, - 0x57a4, 0x57aa, 0x57b0, 0x57c3, 0x57c6, 0x57d4, 0x57d2, 0x57d3, - 0x580a, 0x57d6, 0x57e3, 0x580b, 0x5819, 0x581d, 0x5872, 0x5821, - 0x5862, 0x584b, 0x5870, 0x6bc0, 0x5852, 0x583d, 0x5879, 0x5885, - 0x58b9, 0x589f, 0x58ab, 0x58ba, 0x58de, 0x58bb, 0x58b8, 0x58ae, - 0x58c5, 0x58d3, 0x58d1, 0x58d7, 0x58d9, 0x58d8, 0x58e5, 0x58dc, - 0x58e4, 0x58df, 0x58ef, 0x58fa, 0x58f9, 0x58fb, 0x58fc, 0x58fd, - 0x5902, 0x590a, 0x5910, 0x591b, 0x68a6, 0x5925, 0x592c, 0x592d, - 0x5932, 0x5938, 0x593e, 0x7ad2, 0x5955, 0x5950, 0x594e, 0x595a, - 0x5958, 0x5962, 0x5960, 0x5967, 0x596c, 0x5969, - /* 0x55 */ - 0x5978, 0x5981, 0x599d, 0x4f5e, 0x4fab, 0x59a3, 0x59b2, 0x59c6, - 0x59e8, 0x59dc, 0x598d, 0x59d9, 0x59da, 0x5a25, 0x5a1f, 0x5a11, - 0x5a1c, 0x5a09, 0x5a1a, 0x5a40, 0x5a6c, 0x5a49, 0x5a35, 0x5a36, - 0x5a62, 0x5a6a, 0x5a9a, 0x5abc, 0x5abe, 0x5acb, 0x5ac2, 0x5abd, - 0x5ae3, 0x5ad7, 0x5ae6, 0x5ae9, 0x5ad6, 0x5afa, 0x5afb, 0x5b0c, - 0x5b0b, 0x5b16, 0x5b32, 0x5ad0, 0x5b2a, 0x5b36, 0x5b3e, 0x5b43, - 0x5b45, 0x5b40, 0x5b51, 0x5b55, 0x5b5a, 0x5b5b, 0x5b65, 0x5b69, - 0x5b70, 0x5b73, 0x5b75, 0x5b78, 0x6588, 0x5b7a, 0x5b80, 0x5b83, - 0x5ba6, 0x5bb8, 0x5bc3, 0x5bc7, 0x5bc9, 0x5bd4, 0x5bd0, 0x5be4, - 0x5be6, 0x5be2, 0x5bde, 0x5be5, 0x5beb, 0x5bf0, 0x5bf6, 0x5bf3, - 0x5c05, 0x5c07, 0x5c08, 0x5c0d, 0x5c13, 0x5c20, 0x5c22, 0x5c28, - 0x5c38, 0x5c39, 0x5c41, 0x5c46, 0x5c4e, 0x5c53, - /* 0x56 */ - 0x5c50, 0x5c4f, 0x5b71, 0x5c6c, 0x5c6e, 0x4e62, 0x5c76, 0x5c79, - 0x5c8c, 0x5c91, 0x5c94, 0x599b, 0x5cab, 0x5cbb, 0x5cb6, 0x5cbc, - 0x5cb7, 0x5cc5, 0x5cbe, 0x5cc7, 0x5cd9, 0x5ce9, 0x5cfd, 0x5cfa, - 0x5ced, 0x5d8c, 0x5cea, 0x5d0b, 0x5d15, 0x5d17, 0x5d5c, 0x5d1f, - 0x5d1b, 0x5d11, 0x5d14, 0x5d22, 0x5d1a, 0x5d19, 0x5d18, 0x5d4c, - 0x5d52, 0x5d4e, 0x5d4b, 0x5d6c, 0x5d73, 0x5d76, 0x5d87, 0x5d84, - 0x5d82, 0x5da2, 0x5d9d, 0x5dac, 0x5dae, 0x5dbd, 0x5d90, 0x5db7, - 0x5dbc, 0x5dc9, 0x5dcd, 0x5dd3, 0x5dd2, 0x5dd6, 0x5ddb, 0x5deb, - 0x5df2, 0x5df5, 0x5e0b, 0x5e1a, 0x5e19, 0x5e11, 0x5e1b, 0x5e36, - 0x5e37, 0x5e44, 0x5e43, 0x5e40, 0x5e4e, 0x5e57, 0x5e54, 0x5e5f, - 0x5e62, 0x5e64, 0x5e47, 0x5e75, 0x5e76, 0x5e7a, 0x9ebc, 0x5e7f, - 0x5ea0, 0x5ec1, 0x5ec2, 0x5ec8, 0x5ed0, 0x5ecf, - /* 0x57 */ - 0x5ed6, 0x5ee3, 0x5edd, 0x5eda, 0x5edb, 0x5ee2, 0x5ee1, 0x5ee8, - 0x5ee9, 0x5eec, 0x5ef1, 0x5ef3, 0x5ef0, 0x5ef4, 0x5ef8, 0x5efe, - 0x5f03, 0x5f09, 0x5f5d, 0x5f5c, 0x5f0b, 0x5f11, 0x5f16, 0x5f29, - 0x5f2d, 0x5f38, 0x5f41, 0x5f48, 0x5f4c, 0x5f4e, 0x5f2f, 0x5f51, - 0x5f56, 0x5f57, 0x5f59, 0x5f61, 0x5f6d, 0x5f73, 0x5f77, 0x5f83, - 0x5f82, 0x5f7f, 0x5f8a, 0x5f88, 0x5f91, 0x5f87, 0x5f9e, 0x5f99, - 0x5f98, 0x5fa0, 0x5fa8, 0x5fad, 0x5fbc, 0x5fd6, 0x5ffb, 0x5fe4, - 0x5ff8, 0x5ff1, 0x5fdd, 0x60b3, 0x5fff, 0x6021, 0x6060, 0x6019, - 0x6010, 0x6029, 0x600e, 0x6031, 0x601b, 0x6015, 0x602b, 0x6026, - 0x600f, 0x603a, 0x605a, 0x6041, 0x606a, 0x6077, 0x605f, 0x604a, - 0x6046, 0x604d, 0x6063, 0x6043, 0x6064, 0x6042, 0x606c, 0x606b, - 0x6059, 0x6081, 0x608d, 0x60e7, 0x6083, 0x609a, - /* 0x58 */ - 0x6084, 0x609b, 0x6096, 0x6097, 0x6092, 0x60a7, 0x608b, 0x60e1, - 0x60b8, 0x60e0, 0x60d3, 0x60b4, 0x5ff0, 0x60bd, 0x60c6, 0x60b5, - 0x60d8, 0x614d, 0x6115, 0x6106, 0x60f6, 0x60f7, 0x6100, 0x60f4, - 0x60fa, 0x6103, 0x6121, 0x60fb, 0x60f1, 0x610d, 0x610e, 0x6147, - 0x613e, 0x6128, 0x6127, 0x614a, 0x613f, 0x613c, 0x612c, 0x6134, - 0x613d, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, 0x615a, - 0x616b, 0x6174, 0x616f, 0x6165, 0x6171, 0x615f, 0x615d, 0x6153, - 0x6175, 0x6199, 0x6196, 0x6187, 0x61ac, 0x6194, 0x619a, 0x618a, - 0x6191, 0x61ab, 0x61ae, 0x61cc, 0x61ca, 0x61c9, 0x61f7, 0x61c8, - 0x61c3, 0x61c6, 0x61ba, 0x61cb, 0x7f79, 0x61cd, 0x61e6, 0x61e3, - 0x61f6, 0x61fa, 0x61f4, 0x61ff, 0x61fd, 0x61fc, 0x61fe, 0x6200, - 0x6208, 0x6209, 0x620d, 0x620c, 0x6214, 0x621b, - /* 0x59 */ - 0x621e, 0x6221, 0x622a, 0x622e, 0x6230, 0x6232, 0x6233, 0x6241, - 0x624e, 0x625e, 0x6263, 0x625b, 0x6260, 0x6268, 0x627c, 0x6282, - 0x6289, 0x627e, 0x6292, 0x6293, 0x6296, 0x62d4, 0x6283, 0x6294, - 0x62d7, 0x62d1, 0x62bb, 0x62cf, 0x62ff, 0x62c6, 0x64d4, 0x62c8, - 0x62dc, 0x62cc, 0x62ca, 0x62c2, 0x62c7, 0x629b, 0x62c9, 0x630c, - 0x62ee, 0x62f1, 0x6327, 0x6302, 0x6308, 0x62ef, 0x62f5, 0x6350, - 0x633e, 0x634d, 0x641c, 0x634f, 0x6396, 0x638e, 0x6380, 0x63ab, - 0x6376, 0x63a3, 0x638f, 0x6389, 0x639f, 0x63b5, 0x636b, 0x6369, - 0x63be, 0x63e9, 0x63c0, 0x63c6, 0x63e3, 0x63c9, 0x63d2, 0x63f6, - 0x63c4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, 0x651d, - 0x6417, 0x6428, 0x640f, 0x6467, 0x646f, 0x6476, 0x644e, 0x652a, - 0x6495, 0x6493, 0x64a5, 0x64a9, 0x6488, 0x64bc, - /* 0x5a */ - 0x64da, 0x64d2, 0x64c5, 0x64c7, 0x64bb, 0x64d8, 0x64c2, 0x64f1, - 0x64e7, 0x8209, 0x64e0, 0x64e1, 0x62ac, 0x64e3, 0x64ef, 0x652c, - 0x64f6, 0x64f4, 0x64f2, 0x64fa, 0x6500, 0x64fd, 0x6518, 0x651c, - 0x6505, 0x6524, 0x6523, 0x652b, 0x6534, 0x6535, 0x6537, 0x6536, - 0x6538, 0x754b, 0x6548, 0x6556, 0x6555, 0x654d, 0x6558, 0x655e, - 0x655d, 0x6572, 0x6578, 0x6582, 0x6583, 0x8b8a, 0x659b, 0x659f, - 0x65ab, 0x65b7, 0x65c3, 0x65c6, 0x65c1, 0x65c4, 0x65cc, 0x65d2, - 0x65db, 0x65d9, 0x65e0, 0x65e1, 0x65f1, 0x6772, 0x660a, 0x6603, - 0x65fb, 0x6773, 0x6635, 0x6636, 0x6634, 0x661c, 0x664f, 0x6644, - 0x6649, 0x6641, 0x665e, 0x665d, 0x6664, 0x6667, 0x6668, 0x665f, - 0x6662, 0x6670, 0x6683, 0x6688, 0x668e, 0x6689, 0x6684, 0x6698, - 0x669d, 0x66c1, 0x66b9, 0x66c9, 0x66be, 0x66bc, - /* 0x5b */ - 0x66c4, 0x66b8, 0x66d6, 0x66da, 0x66e0, 0x663f, 0x66e6, 0x66e9, - 0x66f0, 0x66f5, 0x66f7, 0x670f, 0x6716, 0x671e, 0x6726, 0x6727, - 0x9738, 0x672e, 0x673f, 0x6736, 0x6741, 0x6738, 0x6737, 0x6746, - 0x675e, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, 0x67a9, - 0x677c, 0x676a, 0x678c, 0x678b, 0x67a6, 0x67a1, 0x6785, 0x67b7, - 0x67ef, 0x67b4, 0x67ec, 0x67b3, 0x67e9, 0x67b8, 0x67e4, 0x67de, - 0x67dd, 0x67e2, 0x67ee, 0x67b9, 0x67ce, 0x67c6, 0x67e7, 0x6a9c, - 0x681e, 0x6846, 0x6829, 0x6840, 0x684d, 0x6832, 0x684e, 0x68b3, - 0x682b, 0x6859, 0x6863, 0x6877, 0x687f, 0x689f, 0x688f, 0x68ad, - 0x6894, 0x689d, 0x689b, 0x6883, 0x6aae, 0x68b9, 0x6874, 0x68b5, - 0x68a0, 0x68ba, 0x690f, 0x688d, 0x687e, 0x6901, 0x68ca, 0x6908, - 0x68d8, 0x6922, 0x6926, 0x68e1, 0x690c, 0x68cd, - /* 0x5c */ - 0x68d4, 0x68e7, 0x68d5, 0x6936, 0x6912, 0x6904, 0x68d7, 0x68e3, - 0x6925, 0x68f9, 0x68e0, 0x68ef, 0x6928, 0x692a, 0x691a, 0x6923, - 0x6921, 0x68c6, 0x6979, 0x6977, 0x695c, 0x6978, 0x696b, 0x6954, - 0x697e, 0x696e, 0x6939, 0x6974, 0x693d, 0x6959, 0x6930, 0x6961, - 0x695e, 0x695d, 0x6981, 0x696a, 0x69b2, 0x69ae, 0x69d0, 0x69bf, - 0x69c1, 0x69d3, 0x69be, 0x69ce, 0x5be8, 0x69ca, 0x69dd, 0x69bb, - 0x69c3, 0x69a7, 0x6a2e, 0x6991, 0x69a0, 0x699c, 0x6995, 0x69b4, - 0x69de, 0x69e8, 0x6a02, 0x6a1b, 0x69ff, 0x6b0a, 0x69f9, 0x69f2, - 0x69e7, 0x6a05, 0x69b1, 0x6a1e, 0x69ed, 0x6a14, 0x69eb, 0x6a0a, - 0x6a12, 0x6ac1, 0x6a23, 0x6a13, 0x6a44, 0x6a0c, 0x6a72, 0x6a36, - 0x6a78, 0x6a47, 0x6a62, 0x6a59, 0x6a66, 0x6a48, 0x6a38, 0x6a22, - 0x6a90, 0x6a8d, 0x6aa0, 0x6a84, 0x6aa2, 0x6aa3, - /* 0x5d */ - 0x6a97, 0x8617, 0x6abb, 0x6ac3, 0x6ac2, 0x6ab8, 0x6ab3, 0x6aac, - 0x6ade, 0x6ad1, 0x6adf, 0x6aaa, 0x6ada, 0x6aea, 0x6afb, 0x6b05, - 0x8616, 0x6afa, 0x6b12, 0x6b16, 0x9b31, 0x6b1f, 0x6b38, 0x6b37, - 0x76dc, 0x6b39, 0x98ee, 0x6b47, 0x6b43, 0x6b49, 0x6b50, 0x6b59, - 0x6b54, 0x6b5b, 0x6b5f, 0x6b61, 0x6b78, 0x6b79, 0x6b7f, 0x6b80, - 0x6b84, 0x6b83, 0x6b8d, 0x6b98, 0x6b95, 0x6b9e, 0x6ba4, 0x6baa, - 0x6bab, 0x6baf, 0x6bb2, 0x6bb1, 0x6bb3, 0x6bb7, 0x6bbc, 0x6bc6, - 0x6bcb, 0x6bd3, 0x6bdf, 0x6bec, 0x6beb, 0x6bf3, 0x6bef, 0x9ebe, - 0x6c08, 0x6c13, 0x6c14, 0x6c1b, 0x6c24, 0x6c23, 0x6c5e, 0x6c55, - 0x6c62, 0x6c6a, 0x6c82, 0x6c8d, 0x6c9a, 0x6c81, 0x6c9b, 0x6c7e, - 0x6c68, 0x6c73, 0x6c92, 0x6c90, 0x6cc4, 0x6cf1, 0x6cd3, 0x6cbd, - 0x6cd7, 0x6cc5, 0x6cdd, 0x6cae, 0x6cb1, 0x6cbe, - /* 0x5e */ - 0x6cba, 0x6cdb, 0x6cef, 0x6cd9, 0x6cea, 0x6d1f, 0x884d, 0x6d36, - 0x6d2b, 0x6d3d, 0x6d38, 0x6d19, 0x6d35, 0x6d33, 0x6d12, 0x6d0c, - 0x6d63, 0x6d93, 0x6d64, 0x6d5a, 0x6d79, 0x6d59, 0x6d8e, 0x6d95, - 0x6fe4, 0x6d85, 0x6df9, 0x6e15, 0x6e0a, 0x6db5, 0x6dc7, 0x6de6, - 0x6db8, 0x6dc6, 0x6dec, 0x6dde, 0x6dcc, 0x6de8, 0x6dd2, 0x6dc5, - 0x6dfa, 0x6dd9, 0x6de4, 0x6dd5, 0x6dea, 0x6dee, 0x6e2d, 0x6e6e, - 0x6e2e, 0x6e19, 0x6e72, 0x6e5f, 0x6e3e, 0x6e23, 0x6e6b, 0x6e2b, - 0x6e76, 0x6e4d, 0x6e1f, 0x6e43, 0x6e3a, 0x6e4e, 0x6e24, 0x6eff, - 0x6e1d, 0x6e38, 0x6e82, 0x6eaa, 0x6e98, 0x6ec9, 0x6eb7, 0x6ed3, - 0x6ebd, 0x6eaf, 0x6ec4, 0x6eb2, 0x6ed4, 0x6ed5, 0x6e8f, 0x6ea5, - 0x6ec2, 0x6e9f, 0x6f41, 0x6f11, 0x704c, 0x6eec, 0x6ef8, 0x6efe, - 0x6f3f, 0x6ef2, 0x6f31, 0x6eef, 0x6f32, 0x6ecc, - /* 0x5f */ - 0x6f3e, 0x6f13, 0x6ef7, 0x6f86, 0x6f7a, 0x6f78, 0x6f81, 0x6f80, - 0x6f6f, 0x6f5b, 0x6ff3, 0x6f6d, 0x6f82, 0x6f7c, 0x6f58, 0x6f8e, - 0x6f91, 0x6fc2, 0x6f66, 0x6fb3, 0x6fa3, 0x6fa1, 0x6fa4, 0x6fb9, - 0x6fc6, 0x6faa, 0x6fdf, 0x6fd5, 0x6fec, 0x6fd4, 0x6fd8, 0x6ff1, - 0x6fee, 0x6fdb, 0x7009, 0x700b, 0x6ffa, 0x7011, 0x7001, 0x700f, - 0x6ffe, 0x701b, 0x701a, 0x6f74, 0x701d, 0x7018, 0x701f, 0x7030, - 0x703e, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70af, 0x70f1, - 0x70ac, 0x70b8, 0x70b3, 0x70ae, 0x70df, 0x70cb, 0x70dd, 0x70d9, - 0x7109, 0x70fd, 0x711c, 0x7119, 0x7165, 0x7155, 0x7188, 0x7166, - 0x7162, 0x714c, 0x7156, 0x716c, 0x718f, 0x71fb, 0x7184, 0x7195, - 0x71a8, 0x71ac, 0x71d7, 0x71b9, 0x71be, 0x71d2, 0x71c9, 0x71d4, - 0x71ce, 0x71e0, 0x71ec, 0x71e7, 0x71f5, 0x71fc, - /* 0x60 */ - 0x71f9, 0x71ff, 0x720d, 0x7210, 0x721b, 0x7228, 0x722d, 0x722c, - 0x7230, 0x7232, 0x723b, 0x723c, 0x723f, 0x7240, 0x7246, 0x724b, - 0x7258, 0x7274, 0x727e, 0x7282, 0x7281, 0x7287, 0x7292, 0x7296, - 0x72a2, 0x72a7, 0x72b9, 0x72b2, 0x72c3, 0x72c6, 0x72c4, 0x72ce, - 0x72d2, 0x72e2, 0x72e0, 0x72e1, 0x72f9, 0x72f7, 0x500f, 0x7317, - 0x730a, 0x731c, 0x7316, 0x731d, 0x7334, 0x732f, 0x7329, 0x7325, - 0x733e, 0x734e, 0x734f, 0x9ed8, 0x7357, 0x736a, 0x7368, 0x7370, - 0x7378, 0x7375, 0x737b, 0x737a, 0x73c8, 0x73b3, 0x73ce, 0x73bb, - 0x73c0, 0x73e5, 0x73ee, 0x73de, 0x74a2, 0x7405, 0x746f, 0x7425, - 0x73f8, 0x7432, 0x743a, 0x7455, 0x743f, 0x745f, 0x7459, 0x7441, - 0x745c, 0x7469, 0x7470, 0x7463, 0x746a, 0x7476, 0x747e, 0x748b, - 0x749e, 0x74a7, 0x74ca, 0x74cf, 0x74d4, 0x73f1, - /* 0x61 */ - 0x74e0, 0x74e3, 0x74e7, 0x74e9, 0x74ee, 0x74f2, 0x74f0, 0x74f1, - 0x74f8, 0x74f7, 0x7504, 0x7503, 0x7505, 0x750c, 0x750e, 0x750d, - 0x7515, 0x7513, 0x751e, 0x7526, 0x752c, 0x753c, 0x7544, 0x754d, - 0x754a, 0x7549, 0x755b, 0x7546, 0x755a, 0x7569, 0x7564, 0x7567, - 0x756b, 0x756d, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, 0x758a, - 0x7589, 0x7582, 0x7594, 0x759a, 0x759d, 0x75a5, 0x75a3, 0x75c2, - 0x75b3, 0x75c3, 0x75b5, 0x75bd, 0x75b8, 0x75bc, 0x75b1, 0x75cd, - 0x75ca, 0x75d2, 0x75d9, 0x75e3, 0x75de, 0x75fe, 0x75ff, 0x75fc, - 0x7601, 0x75f0, 0x75fa, 0x75f2, 0x75f3, 0x760b, 0x760d, 0x7609, - 0x761f, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, 0x7630, - 0x763b, 0x7647, 0x7648, 0x7646, 0x765c, 0x7658, 0x7661, 0x7662, - 0x7668, 0x7669, 0x766a, 0x7667, 0x766c, 0x7670, - /* 0x62 */ - 0x7672, 0x7676, 0x7678, 0x767c, 0x7680, 0x7683, 0x7688, 0x768b, - 0x768e, 0x7696, 0x7693, 0x7699, 0x769a, 0x76b0, 0x76b4, 0x76b8, - 0x76b9, 0x76ba, 0x76c2, 0x76cd, 0x76d6, 0x76d2, 0x76de, 0x76e1, - 0x76e5, 0x76e7, 0x76ea, 0x862f, 0x76fb, 0x7708, 0x7707, 0x7704, - 0x7729, 0x7724, 0x771e, 0x7725, 0x7726, 0x771b, 0x7737, 0x7738, - 0x7747, 0x775a, 0x7768, 0x776b, 0x775b, 0x7765, 0x777f, 0x777e, - 0x7779, 0x778e, 0x778b, 0x7791, 0x77a0, 0x779e, 0x77b0, 0x77b6, - 0x77b9, 0x77bf, 0x77bc, 0x77bd, 0x77bb, 0x77c7, 0x77cd, 0x77d7, - 0x77da, 0x77dc, 0x77e3, 0x77ee, 0x77fc, 0x780c, 0x7812, 0x7926, - 0x7820, 0x792a, 0x7845, 0x788e, 0x7874, 0x7886, 0x787c, 0x789a, - 0x788c, 0x78a3, 0x78b5, 0x78aa, 0x78af, 0x78d1, 0x78c6, 0x78cb, - 0x78d4, 0x78be, 0x78bc, 0x78c5, 0x78ca, 0x78ec, - /* 0x63 */ - 0x78e7, 0x78da, 0x78fd, 0x78f4, 0x7907, 0x7912, 0x7911, 0x7919, - 0x792c, 0x792b, 0x7940, 0x7960, 0x7957, 0x795f, 0x795a, 0x7955, - 0x7953, 0x797a, 0x797f, 0x798a, 0x799d, 0x79a7, 0x9f4b, 0x79aa, - 0x79ae, 0x79b3, 0x79b9, 0x79ba, 0x79c9, 0x79d5, 0x79e7, 0x79ec, - 0x79e1, 0x79e3, 0x7a08, 0x7a0d, 0x7a18, 0x7a19, 0x7a20, 0x7a1f, - 0x7980, 0x7a31, 0x7a3b, 0x7a3e, 0x7a37, 0x7a43, 0x7a57, 0x7a49, - 0x7a61, 0x7a62, 0x7a69, 0x9f9d, 0x7a70, 0x7a79, 0x7a7d, 0x7a88, - 0x7a97, 0x7a95, 0x7a98, 0x7a96, 0x7aa9, 0x7ac8, 0x7ab0, 0x7ab6, - 0x7ac5, 0x7ac4, 0x7abf, 0x9083, 0x7ac7, 0x7aca, 0x7acd, 0x7acf, - 0x7ad5, 0x7ad3, 0x7ad9, 0x7ada, 0x7add, 0x7ae1, 0x7ae2, 0x7ae6, - 0x7aed, 0x7af0, 0x7b02, 0x7b0f, 0x7b0a, 0x7b06, 0x7b33, 0x7b18, - 0x7b19, 0x7b1e, 0x7b35, 0x7b28, 0x7b36, 0x7b50, - /* 0x64 */ - 0x7b7a, 0x7b04, 0x7b4d, 0x7b0b, 0x7b4c, 0x7b45, 0x7b75, 0x7b65, - 0x7b74, 0x7b67, 0x7b70, 0x7b71, 0x7b6c, 0x7b6e, 0x7b9d, 0x7b98, - 0x7b9f, 0x7b8d, 0x7b9c, 0x7b9a, 0x7b8b, 0x7b92, 0x7b8f, 0x7b5d, - 0x7b99, 0x7bcb, 0x7bc1, 0x7bcc, 0x7bcf, 0x7bb4, 0x7bc6, 0x7bdd, - 0x7be9, 0x7c11, 0x7c14, 0x7be6, 0x7be5, 0x7c60, 0x7c00, 0x7c07, - 0x7c13, 0x7bf3, 0x7bf7, 0x7c17, 0x7c0d, 0x7bf6, 0x7c23, 0x7c27, - 0x7c2a, 0x7c1f, 0x7c37, 0x7c2b, 0x7c3d, 0x7c4c, 0x7c43, 0x7c54, - 0x7c4f, 0x7c40, 0x7c50, 0x7c58, 0x7c5f, 0x7c64, 0x7c56, 0x7c65, - 0x7c6c, 0x7c75, 0x7c83, 0x7c90, 0x7ca4, 0x7cad, 0x7ca2, 0x7cab, - 0x7ca1, 0x7ca8, 0x7cb3, 0x7cb2, 0x7cb1, 0x7cae, 0x7cb9, 0x7cbd, - 0x7cc0, 0x7cc5, 0x7cc2, 0x7cd8, 0x7cd2, 0x7cdc, 0x7ce2, 0x9b3b, - 0x7cef, 0x7cf2, 0x7cf4, 0x7cf6, 0x7cfa, 0x7d06, - /* 0x65 */ - 0x7d02, 0x7d1c, 0x7d15, 0x7d0a, 0x7d45, 0x7d4b, 0x7d2e, 0x7d32, - 0x7d3f, 0x7d35, 0x7d46, 0x7d73, 0x7d56, 0x7d4e, 0x7d72, 0x7d68, - 0x7d6e, 0x7d4f, 0x7d63, 0x7d93, 0x7d89, 0x7d5b, 0x7d8f, 0x7d7d, - 0x7d9b, 0x7dba, 0x7dae, 0x7da3, 0x7db5, 0x7dc7, 0x7dbd, 0x7dab, - 0x7e3d, 0x7da2, 0x7daf, 0x7ddc, 0x7db8, 0x7d9f, 0x7db0, 0x7dd8, - 0x7ddd, 0x7de4, 0x7dde, 0x7dfb, 0x7df2, 0x7de1, 0x7e05, 0x7e0a, - 0x7e23, 0x7e21, 0x7e12, 0x7e31, 0x7e1f, 0x7e09, 0x7e0b, 0x7e22, - 0x7e46, 0x7e66, 0x7e3b, 0x7e35, 0x7e39, 0x7e43, 0x7e37, 0x7e32, - 0x7e3a, 0x7e67, 0x7e5d, 0x7e56, 0x7e5e, 0x7e59, 0x7e5a, 0x7e79, - 0x7e6a, 0x7e69, 0x7e7c, 0x7e7b, 0x7e83, 0x7dd5, 0x7e7d, 0x8fae, - 0x7e7f, 0x7e88, 0x7e89, 0x7e8c, 0x7e92, 0x7e90, 0x7e93, 0x7e94, - 0x7e96, 0x7e8e, 0x7e9b, 0x7e9c, 0x7f38, 0x7f3a, - /* 0x66 */ - 0x7f45, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f50, 0x7f51, 0x7f55, 0x7f54, - 0x7f58, 0x7f5f, 0x7f60, 0x7f68, 0x7f69, 0x7f67, 0x7f78, 0x7f82, - 0x7f86, 0x7f83, 0x7f88, 0x7f87, 0x7f8c, 0x7f94, 0x7f9e, 0x7f9d, - 0x7f9a, 0x7fa3, 0x7faf, 0x7fb2, 0x7fb9, 0x7fae, 0x7fb6, 0x7fb8, - 0x8b71, 0x7fc5, 0x7fc6, 0x7fca, 0x7fd5, 0x7fd4, 0x7fe1, 0x7fe6, - 0x7fe9, 0x7ff3, 0x7ff9, 0x98dc, 0x8006, 0x8004, 0x800b, 0x8012, - 0x8018, 0x8019, 0x801c, 0x8021, 0x8028, 0x803f, 0x803b, 0x804a, - 0x8046, 0x8052, 0x8058, 0x805a, 0x805f, 0x8062, 0x8068, 0x8073, - 0x8072, 0x8070, 0x8076, 0x8079, 0x807d, 0x807f, 0x8084, 0x8086, - 0x8085, 0x809b, 0x8093, 0x809a, 0x80ad, 0x5190, 0x80ac, 0x80db, - 0x80e5, 0x80d9, 0x80dd, 0x80c4, 0x80da, 0x80d6, 0x8109, 0x80ef, - 0x80f1, 0x811b, 0x8129, 0x8123, 0x812f, 0x814b, - /* 0x67 */ - 0x968b, 0x8146, 0x813e, 0x8153, 0x8151, 0x80fc, 0x8171, 0x816e, - 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818a, 0x8180, 0x8182, - 0x81a0, 0x8195, 0x81a4, 0x81a3, 0x815f, 0x8193, 0x81a9, 0x81b0, - 0x81b5, 0x81be, 0x81b8, 0x81bd, 0x81c0, 0x81c2, 0x81ba, 0x81c9, - 0x81cd, 0x81d1, 0x81d9, 0x81d8, 0x81c8, 0x81da, 0x81df, 0x81e0, - 0x81e7, 0x81fa, 0x81fb, 0x81fe, 0x8201, 0x8202, 0x8205, 0x8207, - 0x820a, 0x820d, 0x8210, 0x8216, 0x8229, 0x822b, 0x8238, 0x8233, - 0x8240, 0x8259, 0x8258, 0x825d, 0x825a, 0x825f, 0x8264, 0x8262, - 0x8268, 0x826a, 0x826b, 0x822e, 0x8271, 0x8277, 0x8278, 0x827e, - 0x828d, 0x8292, 0x82ab, 0x829f, 0x82bb, 0x82ac, 0x82e1, 0x82e3, - 0x82df, 0x82d2, 0x82f4, 0x82f3, 0x82fa, 0x8393, 0x8303, 0x82fb, - 0x82f9, 0x82de, 0x8306, 0x82dc, 0x8309, 0x82d9, - /* 0x68 */ - 0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, 0x8350, - 0x8345, 0x832f, 0x832b, 0x8317, 0x8318, 0x8385, 0x839a, 0x83aa, - 0x839f, 0x83a2, 0x8396, 0x8323, 0x838e, 0x8387, 0x838a, 0x837c, - 0x83b5, 0x8373, 0x8375, 0x83a0, 0x8389, 0x83a8, 0x83f4, 0x8413, - 0x83eb, 0x83ce, 0x83fd, 0x8403, 0x83d8, 0x840b, 0x83c1, 0x83f7, - 0x8407, 0x83e0, 0x83f2, 0x840d, 0x8422, 0x8420, 0x83bd, 0x8438, - 0x8506, 0x83fb, 0x846d, 0x842a, 0x843c, 0x855a, 0x8484, 0x8477, - 0x846b, 0x84ad, 0x846e, 0x8482, 0x8469, 0x8446, 0x842c, 0x846f, - 0x8479, 0x8435, 0x84ca, 0x8462, 0x84b9, 0x84bf, 0x849f, 0x84d9, - 0x84cd, 0x84bb, 0x84da, 0x84d0, 0x84c1, 0x84c6, 0x84d6, 0x84a1, - 0x8521, 0x84ff, 0x84f4, 0x8517, 0x8518, 0x852c, 0x851f, 0x8515, - 0x8514, 0x84fc, 0x8540, 0x8563, 0x8558, 0x8548, - /* 0x69 */ - 0x8541, 0x8602, 0x854b, 0x8555, 0x8580, 0x85a4, 0x8588, 0x8591, - 0x858a, 0x85a8, 0x856d, 0x8594, 0x859b, 0x85ea, 0x8587, 0x859c, - 0x8577, 0x857e, 0x8590, 0x85c9, 0x85ba, 0x85cf, 0x85b9, 0x85d0, - 0x85d5, 0x85dd, 0x85e5, 0x85dc, 0x85f9, 0x860a, 0x8613, 0x860b, - 0x85fe, 0x85fa, 0x8606, 0x8622, 0x861a, 0x8630, 0x863f, 0x864d, - 0x4e55, 0x8654, 0x865f, 0x8667, 0x8671, 0x8693, 0x86a3, 0x86a9, - 0x86aa, 0x868b, 0x868c, 0x86b6, 0x86af, 0x86c4, 0x86c6, 0x86b0, - 0x86c9, 0x8823, 0x86ab, 0x86d4, 0x86de, 0x86e9, 0x86ec, 0x86df, - 0x86db, 0x86ef, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, 0x86fb, - 0x8711, 0x8709, 0x870d, 0x86f9, 0x870a, 0x8734, 0x873f, 0x8737, - 0x873b, 0x8725, 0x8729, 0x871a, 0x8760, 0x875f, 0x8778, 0x874c, - 0x874e, 0x8774, 0x8757, 0x8768, 0x876e, 0x8759, - /* 0x6a */ - 0x8753, 0x8763, 0x876a, 0x8805, 0x87a2, 0x879f, 0x8782, 0x87af, - 0x87cb, 0x87bd, 0x87c0, 0x87d0, 0x96d6, 0x87ab, 0x87c4, 0x87b3, - 0x87c7, 0x87c6, 0x87bb, 0x87ef, 0x87f2, 0x87e0, 0x880f, 0x880d, - 0x87fe, 0x87f6, 0x87f7, 0x880e, 0x87d2, 0x8811, 0x8816, 0x8815, - 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883b, 0x8844, - 0x8842, 0x8852, 0x8859, 0x885e, 0x8862, 0x886b, 0x8881, 0x887e, - 0x889e, 0x8875, 0x887d, 0x88b5, 0x8872, 0x8882, 0x8897, 0x8892, - 0x88ae, 0x8899, 0x88a2, 0x888d, 0x88a4, 0x88b0, 0x88bf, 0x88b1, - 0x88c3, 0x88c4, 0x88d4, 0x88d8, 0x88d9, 0x88dd, 0x88f9, 0x8902, - 0x88fc, 0x88f4, 0x88e8, 0x88f2, 0x8904, 0x890c, 0x890a, 0x8913, - 0x8943, 0x891e, 0x8925, 0x892a, 0x892b, 0x8941, 0x8944, 0x893b, - 0x8936, 0x8938, 0x894c, 0x891d, 0x8960, 0x895e, - /* 0x6b */ - 0x8966, 0x8964, 0x896d, 0x896a, 0x896f, 0x8974, 0x8977, 0x897e, - 0x8983, 0x8988, 0x898a, 0x8993, 0x8998, 0x89a1, 0x89a9, 0x89a6, - 0x89ac, 0x89af, 0x89b2, 0x89ba, 0x89bd, 0x89bf, 0x89c0, 0x89da, - 0x89dc, 0x89dd, 0x89e7, 0x89f4, 0x89f8, 0x8a03, 0x8a16, 0x8a10, - 0x8a0c, 0x8a1b, 0x8a1d, 0x8a25, 0x8a36, 0x8a41, 0x8a5b, 0x8a52, - 0x8a46, 0x8a48, 0x8a7c, 0x8a6d, 0x8a6c, 0x8a62, 0x8a85, 0x8a82, - 0x8a84, 0x8aa8, 0x8aa1, 0x8a91, 0x8aa5, 0x8aa6, 0x8a9a, 0x8aa3, - 0x8ac4, 0x8acd, 0x8ac2, 0x8ada, 0x8aeb, 0x8af3, 0x8ae7, 0x8ae4, - 0x8af1, 0x8b14, 0x8ae0, 0x8ae2, 0x8af7, 0x8ade, 0x8adb, 0x8b0c, - 0x8b07, 0x8b1a, 0x8ae1, 0x8b16, 0x8b10, 0x8b17, 0x8b20, 0x8b33, - 0x97ab, 0x8b26, 0x8b2b, 0x8b3e, 0x8b28, 0x8b41, 0x8b4c, 0x8b4f, - 0x8b4e, 0x8b49, 0x8b56, 0x8b5b, 0x8b5a, 0x8b6b, - /* 0x6c */ - 0x8b5f, 0x8b6c, 0x8b6f, 0x8b74, 0x8b7d, 0x8b80, 0x8b8c, 0x8b8e, - 0x8b92, 0x8b93, 0x8b96, 0x8b99, 0x8b9a, 0x8c3a, 0x8c41, 0x8c3f, - 0x8c48, 0x8c4c, 0x8c4e, 0x8c50, 0x8c55, 0x8c62, 0x8c6c, 0x8c78, - 0x8c7a, 0x8c82, 0x8c89, 0x8c85, 0x8c8a, 0x8c8d, 0x8c8e, 0x8c94, - 0x8c7c, 0x8c98, 0x621d, 0x8cad, 0x8caa, 0x8cbd, 0x8cb2, 0x8cb3, - 0x8cae, 0x8cb6, 0x8cc8, 0x8cc1, 0x8ce4, 0x8ce3, 0x8cda, 0x8cfd, - 0x8cfa, 0x8cfb, 0x8d04, 0x8d05, 0x8d0a, 0x8d07, 0x8d0f, 0x8d0d, - 0x8d10, 0x9f4e, 0x8d13, 0x8ccd, 0x8d14, 0x8d16, 0x8d67, 0x8d6d, - 0x8d71, 0x8d73, 0x8d81, 0x8d99, 0x8dc2, 0x8dbe, 0x8dba, 0x8dcf, - 0x8dda, 0x8dd6, 0x8dcc, 0x8ddb, 0x8dcb, 0x8dea, 0x8deb, 0x8ddf, - 0x8de3, 0x8dfc, 0x8e08, 0x8e09, 0x8dff, 0x8e1d, 0x8e1e, 0x8e10, - 0x8e1f, 0x8e42, 0x8e35, 0x8e30, 0x8e34, 0x8e4a, - /* 0x6d */ - 0x8e47, 0x8e49, 0x8e4c, 0x8e50, 0x8e48, 0x8e59, 0x8e64, 0x8e60, - 0x8e2a, 0x8e63, 0x8e55, 0x8e76, 0x8e72, 0x8e7c, 0x8e81, 0x8e87, - 0x8e85, 0x8e84, 0x8e8b, 0x8e8a, 0x8e93, 0x8e91, 0x8e94, 0x8e99, - 0x8eaa, 0x8ea1, 0x8eac, 0x8eb0, 0x8ec6, 0x8eb1, 0x8ebe, 0x8ec5, - 0x8ec8, 0x8ecb, 0x8edb, 0x8ee3, 0x8efc, 0x8efb, 0x8eeb, 0x8efe, - 0x8f0a, 0x8f05, 0x8f15, 0x8f12, 0x8f19, 0x8f13, 0x8f1c, 0x8f1f, - 0x8f1b, 0x8f0c, 0x8f26, 0x8f33, 0x8f3b, 0x8f39, 0x8f45, 0x8f42, - 0x8f3e, 0x8f4c, 0x8f49, 0x8f46, 0x8f4e, 0x8f57, 0x8f5c, 0x8f62, - 0x8f63, 0x8f64, 0x8f9c, 0x8f9f, 0x8fa3, 0x8fad, 0x8faf, 0x8fb7, - 0x8fda, 0x8fe5, 0x8fe2, 0x8fea, 0x8fef, 0x9087, 0x8ff4, 0x9005, - 0x8ff9, 0x8ffa, 0x9011, 0x9015, 0x9021, 0x900d, 0x901e, 0x9016, - 0x900b, 0x9027, 0x9036, 0x9035, 0x9039, 0x8ff8, - /* 0x6e */ - 0x904f, 0x9050, 0x9051, 0x9052, 0x900e, 0x9049, 0x903e, 0x9056, - 0x9058, 0x905e, 0x9068, 0x906f, 0x9076, 0x96a8, 0x9072, 0x9082, - 0x907d, 0x9081, 0x9080, 0x908a, 0x9089, 0x908f, 0x90a8, 0x90af, - 0x90b1, 0x90b5, 0x90e2, 0x90e4, 0x6248, 0x90db, 0x9102, 0x9112, - 0x9119, 0x9132, 0x9130, 0x914a, 0x9156, 0x9158, 0x9163, 0x9165, - 0x9169, 0x9173, 0x9172, 0x918b, 0x9189, 0x9182, 0x91a2, 0x91ab, - 0x91af, 0x91aa, 0x91b5, 0x91b4, 0x91ba, 0x91c0, 0x91c1, 0x91c9, - 0x91cb, 0x91d0, 0x91d6, 0x91df, 0x91e1, 0x91db, 0x91fc, 0x91f5, - 0x91f6, 0x921e, 0x91ff, 0x9214, 0x922c, 0x9215, 0x9211, 0x925e, - 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923f, 0x924b, - 0x9250, 0x929c, 0x9296, 0x9293, 0x929b, 0x925a, 0x92cf, 0x92b9, - 0x92b7, 0x92e9, 0x930f, 0x92fa, 0x9344, 0x932e, - /* 0x6f */ - 0x9319, 0x9322, 0x931a, 0x9323, 0x933a, 0x9335, 0x933b, 0x935c, - 0x9360, 0x937c, 0x936e, 0x9356, 0x93b0, 0x93ac, 0x93ad, 0x9394, - 0x93b9, 0x93d6, 0x93d7, 0x93e8, 0x93e5, 0x93d8, 0x93c3, 0x93dd, - 0x93d0, 0x93c8, 0x93e4, 0x941a, 0x9414, 0x9413, 0x9403, 0x9407, - 0x9410, 0x9436, 0x942b, 0x9435, 0x9421, 0x943a, 0x9441, 0x9452, - 0x9444, 0x945b, 0x9460, 0x9462, 0x945e, 0x946a, 0x9229, 0x9470, - 0x9475, 0x9477, 0x947d, 0x945a, 0x947c, 0x947e, 0x9481, 0x947f, - 0x9582, 0x9587, 0x958a, 0x9594, 0x9596, 0x9598, 0x9599, 0x95a0, - 0x95a8, 0x95a7, 0x95ad, 0x95bc, 0x95bb, 0x95b9, 0x95be, 0x95ca, - 0x6ff6, 0x95c3, 0x95cd, 0x95cc, 0x95d5, 0x95d4, 0x95d6, 0x95dc, - 0x95e1, 0x95e5, 0x95e2, 0x9621, 0x9628, 0x962e, 0x962f, 0x9642, - 0x964c, 0x964f, 0x964b, 0x9677, 0x965c, 0x965e, - /* 0x70 */ - 0x965d, 0x965f, 0x9666, 0x9672, 0x966c, 0x968d, 0x9698, 0x9695, - 0x9697, 0x96aa, 0x96a7, 0x96b1, 0x96b2, 0x96b0, 0x96b4, 0x96b6, - 0x96b8, 0x96b9, 0x96ce, 0x96cb, 0x96c9, 0x96cd, 0x894d, 0x96dc, - 0x970d, 0x96d5, 0x96f9, 0x9704, 0x9706, 0x9708, 0x9713, 0x970e, - 0x9711, 0x970f, 0x9716, 0x9719, 0x9724, 0x972a, 0x9730, 0x9739, - 0x973d, 0x973e, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, 0x975c, - 0x9760, 0x9764, 0x9766, 0x9768, 0x52d2, 0x976b, 0x9771, 0x9779, - 0x9785, 0x977c, 0x9781, 0x977a, 0x9786, 0x978b, 0x978f, 0x9790, - 0x979c, 0x97a8, 0x97a6, 0x97a3, 0x97b3, 0x97b4, 0x97c3, 0x97c6, - 0x97c8, 0x97cb, 0x97dc, 0x97ed, 0x9f4f, 0x97f2, 0x7adf, 0x97f6, - 0x97f5, 0x980f, 0x980c, 0x9838, 0x9824, 0x9821, 0x9837, 0x983d, - 0x9846, 0x984f, 0x984b, 0x986b, 0x986f, 0x9870, - /* 0x71 */ - 0x9871, 0x9874, 0x9873, 0x98aa, 0x98af, 0x98b1, 0x98b6, 0x98c4, - 0x98c3, 0x98c6, 0x98e9, 0x98eb, 0x9903, 0x9909, 0x9912, 0x9914, - 0x9918, 0x9921, 0x991d, 0x991e, 0x9924, 0x9920, 0x992c, 0x992e, - 0x993d, 0x993e, 0x9942, 0x9949, 0x9945, 0x9950, 0x994b, 0x9951, - 0x9952, 0x994c, 0x9955, 0x9997, 0x9998, 0x99a5, 0x99ad, 0x99ae, - 0x99bc, 0x99df, 0x99db, 0x99dd, 0x99d8, 0x99d1, 0x99ed, 0x99ee, - 0x99f1, 0x99f2, 0x99fb, 0x99f8, 0x9a01, 0x9a0f, 0x9a05, 0x99e2, - 0x9a19, 0x9a2b, 0x9a37, 0x9a45, 0x9a42, 0x9a40, 0x9a43, 0x9a3e, - 0x9a55, 0x9a4d, 0x9a5b, 0x9a57, 0x9a5f, 0x9a62, 0x9a65, 0x9a64, - 0x9a69, 0x9a6b, 0x9a6a, 0x9aad, 0x9ab0, 0x9abc, 0x9ac0, 0x9acf, - 0x9ad1, 0x9ad3, 0x9ad4, 0x9ade, 0x9adf, 0x9ae2, 0x9ae3, 0x9ae6, - 0x9aef, 0x9aeb, 0x9aee, 0x9af4, 0x9af1, 0x9af7, - /* 0x72 */ - 0x9afb, 0x9b06, 0x9b18, 0x9b1a, 0x9b1f, 0x9b22, 0x9b23, 0x9b25, - 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2e, 0x9b2f, 0x9b32, 0x9b44, - 0x9b43, 0x9b4f, 0x9b4d, 0x9b4e, 0x9b51, 0x9b58, 0x9b74, 0x9b93, - 0x9b83, 0x9b91, 0x9b96, 0x9b97, 0x9b9f, 0x9ba0, 0x9ba8, 0x9bb4, - 0x9bc0, 0x9bca, 0x9bb9, 0x9bc6, 0x9bcf, 0x9bd1, 0x9bd2, 0x9be3, - 0x9be2, 0x9be4, 0x9bd4, 0x9be1, 0x9c3a, 0x9bf2, 0x9bf1, 0x9bf0, - 0x9c15, 0x9c14, 0x9c09, 0x9c13, 0x9c0c, 0x9c06, 0x9c08, 0x9c12, - 0x9c0a, 0x9c04, 0x9c2e, 0x9c1b, 0x9c25, 0x9c24, 0x9c21, 0x9c30, - 0x9c47, 0x9c32, 0x9c46, 0x9c3e, 0x9c5a, 0x9c60, 0x9c67, 0x9c76, - 0x9c78, 0x9ce7, 0x9cec, 0x9cf0, 0x9d09, 0x9d08, 0x9ceb, 0x9d03, - 0x9d06, 0x9d2a, 0x9d26, 0x9daf, 0x9d23, 0x9d1f, 0x9d44, 0x9d15, - 0x9d12, 0x9d41, 0x9d3f, 0x9d3e, 0x9d46, 0x9d48, - /* 0x73 */ - 0x9d5d, 0x9d5e, 0x9d64, 0x9d51, 0x9d50, 0x9d59, 0x9d72, 0x9d89, - 0x9d87, 0x9dab, 0x9d6f, 0x9d7a, 0x9d9a, 0x9da4, 0x9da9, 0x9db2, - 0x9dc4, 0x9dc1, 0x9dbb, 0x9db8, 0x9dba, 0x9dc6, 0x9dcf, 0x9dc2, - 0x9dd9, 0x9dd3, 0x9df8, 0x9de6, 0x9ded, 0x9def, 0x9dfd, 0x9e1a, - 0x9e1b, 0x9e1e, 0x9e75, 0x9e79, 0x9e7d, 0x9e81, 0x9e88, 0x9e8b, - 0x9e8c, 0x9e92, 0x9e95, 0x9e91, 0x9e9d, 0x9ea5, 0x9ea9, 0x9eb8, - 0x9eaa, 0x9ead, 0x9761, 0x9ecc, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed4, - 0x9edc, 0x9ede, 0x9edd, 0x9ee0, 0x9ee5, 0x9ee8, 0x9eef, 0x9ef4, - 0x9ef6, 0x9ef7, 0x9ef9, 0x9efb, 0x9efc, 0x9efd, 0x9f07, 0x9f08, - 0x76b7, 0x9f15, 0x9f21, 0x9f2c, 0x9f3e, 0x9f4a, 0x9f52, 0x9f54, - 0x9f63, 0x9f5f, 0x9f60, 0x9f61, 0x9f66, 0x9f67, 0x9f6c, 0x9f6a, - 0x9f77, 0x9f72, 0x9f76, 0x9f95, 0x9f9c, 0x9fa0, - /* 0x74 */ - 0x582f, 0x69c7, 0x9059, 0x7464, 0x51dc, 0x7199, -}; - -static int -jisx0208_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = (s[0] & 0x7F); - if ((c1 >= 0x21 && c1 <= 0x28) || (c1 >= 0x30 && c1 <= 0x74)) { - if (n >= 2) { - unsigned char c2 = (s[1] & 0x7F); - if (c2 >= 0x21 && c2 < 0x7f) { - unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); - unsigned short wc = 0xfffd; - if (i < 1410) { - if (i < 690) - wc = jisx0208_2uni_page21[i]; - } else { - if (i < 7808) - wc = jisx0208_2uni_page30[i-1410]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short jisx0208_2charset[6879] = { - 0x2140, 0x2171, 0x2172, 0x2178, 0x212f, 0x224c, 0x216b, 0x215e, - 0x212d, 0x2279, 0x215f, 0x2160, 0x2621, 0x2622, 0x2623, 0x2624, - 0x2625, 0x2626, 0x2627, 0x2628, 0x2629, 0x262a, 0x262b, 0x262c, - 0x262d, 0x262e, 0x262f, 0x2630, 0x2631, 0x2632, 0x2633, 0x2634, - 0x2635, 0x2636, 0x2637, 0x2638, 0x2641, 0x2642, 0x2643, 0x2644, - 0x2645, 0x2646, 0x2647, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, - 0x264d, 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x2654, - 0x2655, 0x2656, 0x2657, 0x2658, 0x2727, 0x2721, 0x2722, 0x2723, - 0x2724, 0x2725, 0x2726, 0x2728, 0x2729, 0x272a, 0x272b, 0x272c, - 0x272d, 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, - 0x2735, 0x2736, 0x2737, 0x2738, 0x2739, 0x273a, 0x273b, 0x273c, - 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2751, 0x2752, 0x2753, - 0x2754, 0x2755, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, - 0x275d, 0x275e, 0x275f, 0x2760, 0x2761, 0x2762, 0x2763, 0x2764, - 0x2765, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, - 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2757, 0x213e, 0x213d, - 0x2142, 0x2146, 0x2147, 0x2148, 0x2149, 0x2277, 0x2278, 0x2145, - 0x2144, 0x2273, 0x216c, 0x216d, 0x2228, 0x216e, 0x2272, 0x222b, - 0x222c, 0x222a, 0x222d, 0x224d, 0x224e, 0x224f, 0x225f, 0x2250, - 0x2260, 0x223a, 0x223b, 0x215d, 0x2265, 0x2267, 0x2167, 0x225c, - 0x224a, 0x224b, 0x2241, 0x2240, 0x2269, 0x226a, 0x2168, 0x2268, - 0x2266, 0x2262, 0x2162, 0x2261, 0x2165, 0x2166, 0x2263, 0x2264, - 0x223e, 0x223f, 0x223c, 0x223d, 0x225d, 0x225e, 0x2821, 0x282c, - 0x2822, 0x282d, 0x2823, 0x282e, 0x2824, 0x282f, 0x2826, 0x2831, - 0x2825, 0x2830, 0x2827, 0x283c, 0x2837, 0x2832, 0x2829, 0x283e, - 0x2839, 0x2834, 0x2828, 0x2838, 0x283d, 0x2833, 0x282a, 0x283a, - 0x283f, 0x2835, 0x282b, 0x283b, 0x2840, 0x2836, 0x2223, 0x2222, - 0x2225, 0x2224, 0x2227, 0x2226, 0x2221, 0x217e, 0x217b, 0x217d, - 0x217c, 0x227e, 0x217a, 0x2179, 0x216a, 0x2169, 0x2276, 0x2275, - 0x2274, 0x2121, 0x2122, 0x2123, 0x2137, 0x2139, 0x213a, 0x213b, - 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, - 0x215a, 0x215b, 0x2229, 0x222e, 0x214c, 0x214d, 0x2141, 0x2421, - 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, - 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, - 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, - 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, - 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, - 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, - 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, - 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, - 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, - 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, - 0x2472, 0x2473, 0x212b, 0x212c, 0x2135, 0x2136, 0x2521, 0x2522, - 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, - 0x252b, 0x252c, 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, - 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, - 0x253b, 0x253c, 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, - 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, - 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, - 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, - 0x255b, 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, - 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, - 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, - 0x2573, 0x2574, 0x2575, 0x2576, 0x2126, 0x213c, 0x2133, 0x2134, - 0x306c, 0x437a, 0x3c37, 0x4b7c, 0x3e66, 0x3b30, 0x3e65, 0x323c, - 0x4954, 0x4d3f, 0x5022, 0x312f, 0x336e, 0x5023, 0x4024, 0x5242, - 0x3556, 0x4a3a, 0x3e67, 0x4e3e, 0x4a42, 0x5024, 0x4366, 0x5025, - 0x367a, 0x5026, 0x345d, 0x4330, 0x3c67, 0x5027, 0x5028, 0x5029, - 0x4735, 0x3557, 0x4737, 0x4663, 0x3843, 0x4b33, 0x6949, 0x502a, - 0x3e68, 0x502b, 0x3235, 0x3665, 0x3870, 0x4c69, 0x5626, 0x4d70, - 0x467d, 0x3425, 0x3535, 0x502c, 0x502d, 0x4e3b, 0x4d3d, 0x4168, - 0x502f, 0x3b76, 0x4673, 0x5032, 0x313e, 0x385f, 0x385e, 0x3066, - 0x4f4b, 0x4f4a, 0x3a33, 0x3021, 0x5033, 0x5034, 0x5035, 0x4b34, - 0x5036, 0x3872, 0x3067, 0x4b72, 0x357c, 0x357d, 0x357e, 0x4462, - 0x4e3c, 0x5037, 0x5038, 0x5039, 0x3f4d, 0x3d3a, 0x3f4e, 0x503e, - 0x503c, 0x503d, 0x3558, 0x3a23, 0x3270, 0x503b, 0x503a, 0x4a29, - 0x3b46, 0x3b45, 0x423e, 0x503f, 0x4955, 0x4067, 0x2138, 0x5040, - 0x5042, 0x4265, 0x4e61, 0x304a, 0x5041, 0x323e, 0x3644, 0x4367, - 0x376f, 0x5043, 0x4724, 0x346b, 0x5044, 0x304b, 0x3860, 0x346c, - 0x497a, 0x4832, 0x3559, 0x3271, 0x5067, 0x4541, 0x476c, 0x5046, - 0x483c, 0x4e62, 0x3f2d, 0x3b47, 0x3b77, 0x3240, 0x4451, 0x4322, - 0x504a, 0x304c, 0x4463, 0x3d3b, 0x3a34, 0x4d24, 0x424e, 0x323f, - 0x5049, 0x4d3e, 0x5045, 0x5047, 0x3a6e, 0x5048, 0x5524, 0x5050, - 0x5053, 0x5051, 0x3242, 0x4a3b, 0x504b, 0x504f, 0x3873, 0x3b48, - 0x3426, 0x5054, 0x504c, 0x4e63, 0x3b78, 0x504d, 0x5052, 0x5055, - 0x504e, 0x3621, 0x304d, 0x3622, 0x3241, 0x5525, 0x4b79, 0x496e, - 0x3874, 0x3f2f, 0x4e37, 0x4a58, 0x3738, 0x4225, 0x3264, 0x3d53, - 0x5059, 0x505e, 0x505c, 0x5057, 0x422f, 0x505a, 0x505d, 0x505b, - 0x4a5d, 0x5058, 0x3f2e, 0x4b73, 0x505f, 0x5060, 0x3d24, 0x506d, - 0x4750, 0x4936, 0x5068, 0x4a70, 0x3236, 0x506c, 0x5066, 0x506f, - 0x4152, 0x3844, 0x475c, 0x6047, 0x506e, 0x455d, 0x5063, 0x3876, - 0x3875, 0x5061, 0x3c5a, 0x5069, 0x4a6f, 0x434d, 0x5065, 0x3771, - 0x5062, 0x506a, 0x5064, 0x4e51, 0x506b, 0x4f41, 0x3666, 0x3770, - 0x5070, 0x5071, 0x5075, 0x304e, 0x4a50, 0x5074, 0x5073, 0x5077, - 0x5076, 0x4464, 0x3772, 0x5078, 0x3c45, 0x4226, 0x4465, 0x3676, - 0x5079, 0x3536, 0x507a, 0x507c, 0x4b35, 0x3766, 0x3b31, 0x4877, - 0x507b, 0x3a45, 0x4d43, 0x507e, 0x5123, 0x507d, 0x3a44, 0x3d7d, - 0x3739, 0x5124, 0x364f, 0x5121, 0x5122, 0x462f, 0x417c, 0x3623, - 0x4b4d, 0x5125, 0x4e3d, 0x5126, 0x5129, 0x5127, 0x414e, 0x5128, - 0x512a, 0x512c, 0x512b, 0x4a48, 0x3537, 0x512e, 0x512f, 0x322f, - 0x512d, 0x3c74, 0x5132, 0x5131, 0x5130, 0x5056, 0x5133, 0x3d7e, - 0x5134, 0x4d25, 0x4c59, 0x5136, 0x5135, 0x5138, 0x5137, 0x5139, - 0x513a, 0x3074, 0x3835, 0x373b, 0x3d3c, 0x437b, 0x3624, 0x4068, - 0x3877, 0x396e, 0x513c, 0x4c48, 0x4546, 0x3b79, 0x513b, 0x513d, - 0x455e, 0x3375, 0x513e, 0x467e, 0x4134, 0x5140, 0x5141, 0x482c, - 0x3878, 0x4f3b, 0x5142, 0x3626, 0x4a3c, 0x4236, 0x3671, 0x4535, - 0x3773, 0x5143, 0x5144, 0x4662, 0x315f, 0x5147, 0x3a7d, 0x5146, - 0x3a46, 0x5148, 0x666e, 0x5149, 0x4b41, 0x514a, 0x514b, 0x514c, - 0x3e69, 0x3c4c, 0x3427, 0x514f, 0x514d, 0x4c3d, 0x514e, 0x495a, - 0x5150, 0x5151, 0x5152, 0x455f, 0x5156, 0x5154, 0x5155, 0x5153, - 0x3a63, 0x5157, 0x4c6a, 0x4e64, 0x5158, 0x4028, 0x5159, 0x3d5a, - 0x515a, 0x437c, 0x4e3f, 0x4560, 0x5245, 0x515b, 0x7425, 0x3645, - 0x515c, 0x4b5e, 0x3d68, 0x427c, 0x515e, 0x4664, 0x515f, 0x5160, - 0x332e, 0x5161, 0x3627, 0x464c, 0x317a, 0x3d50, 0x4821, 0x5162, - 0x4561, 0x3f4f, 0x5163, 0x4a2c, 0x405a, 0x3422, 0x3429, 0x5164, - 0x5166, 0x373a, 0x5165, 0x4e73, 0x3d69, 0x483d, 0x4a4c, 0x5167, - 0x4d78, 0x5168, 0x5169, 0x457e, 0x516a, 0x4029, 0x3a7e, 0x3774, - 0x516b, 0x3b49, 0x396f, 0x4466, 0x516d, 0x4227, 0x3a6f, 0x516e, - 0x516f, 0x4130, 0x516c, 0x5171, 0x4b36, 0x3964, 0x5170, 0x3775, - 0x3a5e, 0x476d, 0x5174, 0x5172, 0x497b, 0x3e6a, 0x517b, 0x3364, - 0x5175, 0x5173, 0x414f, 0x5177, 0x5176, 0x3344, 0x3760, 0x517c, - 0x4e2d, 0x5178, 0x517d, 0x517a, 0x5179, 0x4e4f, 0x3879, 0x3243, - 0x4e74, 0x3d75, 0x4558, 0x3965, 0x5222, 0x5223, 0x4e65, 0x4f2b, - 0x5225, 0x387a, 0x5224, 0x332f, 0x5226, 0x4b56, 0x443c, 0x4d26, - 0x4a59, 0x5227, 0x7055, 0x4630, 0x5228, 0x342a, 0x4c33, 0x3e21, - 0x5229, 0x4a67, 0x522d, 0x402a, 0x522a, 0x3650, 0x522b, 0x342b, - 0x372e, 0x522e, 0x522f, 0x5230, 0x5231, 0x3c5b, 0x387b, 0x4c5e, - 0x4c68, 0x4677, 0x4a71, 0x5232, 0x5233, 0x5235, 0x5237, 0x5236, - 0x5238, 0x323d, 0x4b4c, 0x3a7c, 0x5239, 0x4159, 0x3e22, 0x3629, - 0x523a, 0x485b, 0x523b, 0x523c, 0x523d, 0x523e, 0x4924, 0x3668, - 0x3065, 0x463f, 0x523f, 0x3d3d, 0x4069, 0x5241, 0x5240, 0x3e23, - 0x3861, 0x5243, 0x483e, 0x5244, 0x485c, 0x4234, 0x426e, 0x3628, - 0x466e, 0x4331, 0x476e, 0x4b4e, 0x5246, 0x406a, 0x3735, 0x5247, - 0x5248, 0x312c, 0x3075, 0x346d, 0x4228, 0x3551, 0x4d71, 0x524b, - 0x3237, 0x524a, 0x362a, 0x524c, 0x4c71, 0x524d, 0x4e52, 0x387c, - 0x3836, 0x524e, 0x5250, 0x524f, 0x3f5f, 0x3139, 0x315e, 0x5251, - 0x5252, 0x3837, 0x5253, 0x356e, 0x3b32, 0x5254, 0x4b74, 0x3a35, - 0x355a, 0x4d27, 0x4150, 0x483f, 0x3c7d, 0x3d47, 0x3c68, 0x3c75, - 0x3d76, 0x4840, 0x5257, 0x3143, 0x4151, 0x387d, 0x3845, 0x3667, - 0x525b, 0x4321, 0x427e, 0x362b, 0x3e24, 0x525c, 0x525a, 0x3244, - 0x4266, 0x3c38, 0x3b4b, 0x3126, 0x3370, 0x3966, 0x3b4a, 0x525d, - 0x525e, 0x3549, 0x3346, 0x3967, 0x3548, 0x445f, 0x3125, 0x4631, - 0x4c3e, 0x3921, 0x4d79, 0x4547, 0x387e, 0x372f, 0x5267, 0x3663, - 0x4b4a, 0x485d, 0x5266, 0x345e, 0x5261, 0x5262, 0x5264, 0x5265, - 0x355b, 0x3f61, 0x4a2d, 0x5263, 0x525f, 0x3863, 0x5260, 0x4f24, - 0x4a72, 0x4468, 0x3862, 0x3970, 0x5268, 0x465d, 0x526c, 0x3c7e, - 0x3c76, 0x526f, 0x526d, 0x4c23, 0x526a, 0x5273, 0x526e, 0x5271, - 0x3846, 0x4c3f, 0x5272, 0x5274, 0x5276, 0x3a70, 0x4f42, 0x526b, - 0x5269, 0x5275, 0x5270, 0x5278, 0x5323, 0x527a, 0x527e, 0x5321, - 0x527b, 0x533e, 0x3a69, 0x3331, 0x5279, 0x5325, 0x3076, 0x5324, - 0x3025, 0x494a, 0x5322, 0x527c, 0x5277, 0x527d, 0x3a48, 0x5326, - 0x3077, 0x532f, 0x5327, 0x5328, 0x3e25, 0x4b69, 0x532d, 0x532c, - 0x452f, 0x532e, 0x532b, 0x3134, 0x3a36, 0x3f30, 0x5329, 0x4562, - 0x532a, 0x3022, 0x5334, 0x4d23, 0x3e27, 0x533a, 0x5339, 0x5330, - 0x4243, 0x5331, 0x426f, 0x5336, 0x3e26, 0x5333, 0x4c64, 0x373c, - 0x5337, 0x5338, 0x5335, 0x533b, 0x5332, 0x5341, 0x5346, 0x5342, - 0x533d, 0x5347, 0x4131, 0x5349, 0x3922, 0x533f, 0x437d, 0x5343, - 0x533c, 0x342d, 0x346e, 0x3365, 0x5344, 0x5340, 0x3776, 0x534a, - 0x5348, 0x4153, 0x354a, 0x362c, 0x5345, 0x3674, 0x3144, 0x534e, - 0x534c, 0x5427, 0x5351, 0x534b, 0x534f, 0x534d, 0x3b4c, 0x5350, - 0x5353, 0x5358, 0x5356, 0x5355, 0x4332, 0x3245, 0x5352, 0x5354, - 0x3e28, 0x3133, 0x5357, 0x325e, 0x5362, 0x3e7c, 0x535e, 0x535c, - 0x535d, 0x535f, 0x313d, 0x4139, 0x5359, 0x535a, 0x337a, 0x5361, - 0x346f, 0x5364, 0x5360, 0x5363, 0x4a2e, 0x4655, 0x4838, 0x5366, - 0x5365, 0x3345, 0x5367, 0x536a, 0x5369, 0x5368, 0x4739, 0x536b, - 0x536c, 0x536e, 0x536d, 0x5370, 0x5373, 0x5371, 0x536f, 0x5372, - 0x5374, 0x5375, 0x5376, 0x5377, 0x5378, 0x5145, 0x3c7c, 0x3b4d, - 0x3273, 0x3078, 0x4344, 0x5379, 0x3a24, 0x304f, 0x3f5e, 0x537a, - 0x3847, 0x3971, 0x537c, 0x537b, 0x4a60, 0x537d, 0x5421, 0x537e, - 0x5422, 0x5423, 0x3777, 0x3160, 0x5424, 0x5426, 0x5425, 0x5428, - 0x455a, 0x5429, 0x3035, 0x3a5f, 0x373d, 0x434f, 0x542a, 0x542b, - 0x542d, 0x542e, 0x3a64, 0x3651, 0x4b37, 0x542c, 0x542f, 0x3a41, - 0x3923, 0x5433, 0x3a25, 0x4333, 0x5430, 0x445a, 0x5434, 0x3f62, - 0x5432, 0x5435, 0x373f, 0x5436, 0x5437, 0x3924, 0x3340, 0x5439, - 0x543a, 0x543b, 0x5438, 0x5431, 0x543c, 0x543d, 0x4b64, 0x3e6b, - 0x543f, 0x5440, 0x543e, 0x5442, 0x4738, 0x3068, 0x4956, 0x5443, - 0x3e7d, 0x3c39, 0x475d, 0x3470, 0x3a6b, 0x4b59, 0x4632, 0x3778, - 0x424f, 0x5441, 0x5444, 0x4244, 0x5445, 0x5446, 0x5448, 0x4469, - 0x342e, 0x7421, 0x3161, 0x4a73, 0x3e6c, 0x4548, 0x3a66, 0x544e, - 0x4a3d, 0x4e5d, 0x3274, 0x544a, 0x413a, 0x544d, 0x4563, 0x4549, - 0x4564, 0x4839, 0x444d, 0x3a49, 0x5449, 0x3176, 0x4536, 0x544b, - 0x5447, 0x3f50, 0x544f, 0x3d4e, 0x362d, 0x5450, 0x4a68, 0x417d, - 0x4446, 0x5452, 0x4b4f, 0x5453, 0x5458, 0x4a2f, 0x5457, 0x5451, - 0x5454, 0x5456, 0x3a26, 0x4a49, 0x5459, 0x4345, 0x3275, 0x3e6d, - 0x545b, 0x545a, 0x3968, 0x545c, 0x545e, 0x545d, 0x5460, 0x5455, - 0x5462, 0x5461, 0x545f, 0x3b4e, 0x3f51, 0x4154, 0x5463, 0x403c, - 0x306d, 0x4764, 0x445b, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, - 0x5469, 0x4a51, 0x546a, 0x3246, 0x546b, 0x4d3c, 0x3330, 0x5249, - 0x3d48, 0x423f, 0x546c, 0x4c6b, 0x4c34, 0x546e, 0x4267, 0x4537, - 0x4240, 0x4957, 0x546f, 0x5470, 0x317b, 0x3c3a, 0x5471, 0x3050, - 0x5472, 0x5473, 0x3162, 0x3471, 0x4660, 0x4a74, 0x5477, 0x4155, - 0x5476, 0x3740, 0x4b5b, 0x5475, 0x4565, 0x5479, 0x5478, 0x547b, - 0x547a, 0x317c, 0x547c, 0x3e29, 0x547e, 0x4325, 0x547d, 0x4a33, - 0x3d77, 0x455b, 0x5521, 0x3925, 0x5522, 0x4721, 0x485e, 0x4c51, - 0x4725, 0x552b, 0x3538, 0x4d45, 0x4c2f, 0x562c, 0x5523, 0x5526, - 0x4245, 0x4b38, 0x454a, 0x5527, 0x4b65, 0x3a4a, 0x3e2a, 0x5528, - 0x3b50, 0x3b4f, 0x3039, 0x3848, 0x402b, 0x3051, 0x552c, 0x552d, - 0x552a, 0x3138, 0x342f, 0x5529, 0x4c45, 0x4931, 0x3028, 0x3079, - 0x3b51, 0x3052, 0x3023, 0x5532, 0x5530, 0x4c3c, 0x5533, 0x5531, - 0x552f, 0x3f31, 0x552e, 0x4a5a, 0x3864, 0x5537, 0x5538, 0x3e2b, - 0x5534, 0x4f2c, 0x474c, 0x5536, 0x3a27, 0x5539, 0x4958, 0x553a, - 0x5535, 0x4c3b, 0x475e, 0x553b, 0x4932, 0x553c, 0x5540, 0x553d, - 0x3247, 0x553f, 0x3c3b, 0x553e, 0x3779, 0x554c, 0x5545, 0x5542, - 0x4364, 0x5541, 0x5543, 0x5544, 0x5546, 0x5547, 0x3472, 0x5549, - 0x5548, 0x554a, 0x3e6e, 0x554d, 0x445c, 0x3145, 0x554b, 0x554e, - 0x554f, 0x5552, 0x5550, 0x5551, 0x3b52, 0x5553, 0x3926, 0x5554, - 0x3b7a, 0x4238, 0x5555, 0x5556, 0x3b5a, 0x3927, 0x4c52, 0x3528, - 0x3849, 0x5557, 0x3358, 0x5558, 0x4239, 0x5559, 0x5623, 0x555a, - 0x555b, 0x555c, 0x555e, 0x555f, 0x5560, 0x4270, 0x3127, 0x3c69, - 0x3042, 0x4157, 0x3430, 0x3c35, 0x3928, 0x4566, 0x3d21, 0x3431, - 0x4368, 0x446a, 0x3038, 0x3539, 0x4a75, 0x3c42, 0x3552, 0x406b, - 0x3c3c, 0x4d28, 0x5561, 0x355c, 0x3a4b, 0x3332, 0x3163, 0x3e2c, - 0x3248, 0x5562, 0x4d46, 0x3d49, 0x3c64, 0x5563, 0x3473, 0x4652, - 0x4c29, 0x5564, 0x5565, 0x4959, 0x5567, 0x3428, 0x3677, 0x5566, - 0x3432, 0x3f32, 0x556b, 0x3b21, 0x3249, 0x556a, 0x5568, 0x556c, - 0x5569, 0x472b, 0x5c4d, 0x3f33, 0x556d, 0x4e40, 0x556e, 0x5570, - 0x437e, 0x556f, 0x4023, 0x3b7b, 0x4250, 0x3c77, 0x4975, 0x406c, - 0x3c4d, 0x5571, 0x3e2d, 0x5572, 0x5573, 0x3053, 0x423a, 0x3f52, - 0x5574, 0x4633, 0x3e2e, 0x3e2f, 0x5575, 0x406d, 0x3e30, 0x5576, - 0x5577, 0x4c60, 0x5578, 0x3646, 0x3d22, 0x5579, 0x557a, 0x3c5c, - 0x3f2c, 0x4674, 0x3f54, 0x4878, 0x4722, 0x3649, 0x557b, 0x356f, - 0x557c, 0x367e, 0x464f, 0x3230, 0x3b53, 0x557d, 0x5622, 0x5621, - 0x367d, 0x557e, 0x4538, 0x4230, 0x454b, 0x3c48, 0x4158, 0x4d7a, - 0x5624, 0x5625, 0x4656, 0x3b33, 0x5627, 0x5628, 0x5629, 0x3474, - 0x562a, 0x562b, 0x322c, 0x413b, 0x3464, 0x562d, 0x4c28, 0x4252, - 0x3359, 0x562f, 0x5631, 0x345f, 0x562e, 0x5630, 0x5633, 0x5632, - 0x5634, 0x5635, 0x463d, 0x362e, 0x3265, 0x5636, 0x563b, 0x5639, - 0x4a77, 0x4a76, 0x4567, 0x5638, 0x3d54, 0x5637, 0x3f72, 0x563c, - 0x3a6a, 0x5642, 0x5643, 0x563d, 0x3333, 0x563e, 0x5647, 0x5646, - 0x5645, 0x5641, 0x5640, 0x5644, 0x4a78, 0x564b, 0x5648, 0x564a, - 0x4d72, 0x5649, 0x563f, 0x3f73, 0x564c, 0x3a37, 0x564d, 0x564e, - 0x5651, 0x5650, 0x564f, 0x4568, 0x563a, 0x5657, 0x5653, 0x5652, - 0x5654, 0x5655, 0x5658, 0x4e66, 0x5659, 0x5656, 0x565a, 0x3460, - 0x565b, 0x565d, 0x565c, 0x565e, 0x565f, 0x406e, 0x3d23, 0x3d64, - 0x4163, 0x3929, 0x3a38, 0x392a, 0x3570, 0x5660, 0x3a39, 0x384a, - 0x5661, 0x4c26, 0x4743, 0x5662, 0x392b, 0x342c, 0x4327, 0x3652, - 0x3b54, 0x495b, 0x4841, 0x5663, 0x3475, 0x5666, 0x4421, 0x5665, - 0x5664, 0x5667, 0x446b, 0x3f63, 0x3b55, 0x404a, 0x4253, 0x3522, - 0x4422, 0x5668, 0x5669, 0x3e6f, 0x4b39, 0x566c, 0x566b, 0x566a, - 0x497d, 0x5673, 0x4b5a, 0x566d, 0x566f, 0x4b6b, 0x566e, 0x5670, - 0x4828, 0x5671, 0x4a3e, 0x5672, 0x3433, 0x4a3f, 0x472f, 0x5674, - 0x5675, 0x392c, 0x3434, 0x5676, 0x3838, 0x4d44, 0x4d29, 0x3476, - 0x5678, 0x4423, 0x392d, 0x3e31, 0x485f, 0x3e32, 0x3d78, 0x446c, - 0x4a79, 0x4539, 0x392e, 0x495c, 0x5679, 0x4559, 0x3a42, 0x384b, - 0x446d, 0x3043, 0x3d6e, 0x392f, 0x4d47, 0x567a, 0x567b, 0x4751, - 0x567c, 0x4e77, 0x4f2d, 0x567e, 0x567d, 0x3347, 0x5721, 0x5724, - 0x5725, 0x5723, 0x4940, 0x3e33, 0x5727, 0x5726, 0x5722, 0x5728, - 0x5729, 0x572a, 0x572d, 0x572b, 0x572c, 0x572e, 0x3164, 0x446e, - 0x572f, 0x377a, 0x3276, 0x4736, 0x5730, 0x467b, 0x4a5b, 0x5731, - 0x4f2e, 0x5732, 0x4a40, 0x5735, 0x5021, 0x5031, 0x3c30, 0x4675, - 0x5736, 0x355d, 0x4424, 0x307a, 0x5737, 0x4a26, 0x3930, 0x4350, - 0x446f, 0x4c6f, 0x3839, 0x384c, 0x5738, 0x5739, 0x573f, 0x3c65, - 0x4425, 0x362f, 0x573a, 0x492b, 0x4346, 0x573b, 0x573c, 0x3630, - 0x573d, 0x573e, 0x5740, 0x4576, 0x5741, 0x5742, 0x5743, 0x5734, - 0x5733, 0x5744, 0x3741, 0x4927, 0x3a4c, 0x4937, 0x4426, 0x494b, - 0x5745, 0x3e34, 0x3146, 0x5746, 0x5747, 0x4c72, 0x4860, 0x574a, - 0x317d, 0x402c, 0x5749, 0x5748, 0x3742, 0x4254, 0x574e, 0x574c, - 0x574b, 0x4e27, 0x3865, 0x3d79, 0x574d, 0x454c, 0x3d3e, 0x4640, - 0x5751, 0x5750, 0x574f, 0x5752, 0x3866, 0x5753, 0x497c, 0x3d5b, - 0x5754, 0x4879, 0x4641, 0x4427, 0x4530, 0x5755, 0x352b, 0x3f34, - 0x492c, 0x3477, 0x4726, 0x5756, 0x3b56, 0x4b3a, 0x4b3b, 0x317e, - 0x575b, 0x4369, 0x5758, 0x3277, 0x582d, 0x575a, 0x4730, 0x5759, - 0x5757, 0x397a, 0x575d, 0x5763, 0x5769, 0x5761, 0x455c, 0x5766, - 0x495d, 0x5760, 0x5765, 0x4e67, 0x3b57, 0x4255, 0x575e, 0x355e, - 0x5768, 0x402d, 0x3165, 0x5762, 0x3278, 0x5767, 0x3631, 0x5764, - 0x576a, 0x576c, 0x5776, 0x5774, 0x5771, 0x5770, 0x4e78, 0x5772, - 0x3632, 0x3931, 0x3d7a, 0x5779, 0x576b, 0x576f, 0x575f, 0x327a, - 0x5773, 0x5775, 0x4351, 0x3a28, 0x3238, 0x576d, 0x5778, 0x5777, - 0x3633, 0x4229, 0x3366, 0x3743, 0x576e, 0x577a, 0x577d, 0x5821, - 0x3c3d, 0x5827, 0x4470, 0x577b, 0x5825, 0x3279, 0x5823, 0x5824, - 0x577e, 0x5822, 0x3867, 0x4d2a, 0x3435, 0x3159, 0x5826, 0x473a, - 0x302d, 0x4861, 0x575c, 0x582c, 0x5830, 0x4c65, 0x5829, 0x4569, - 0x582e, 0x3e70, 0x582f, 0x4657, 0x4f47, 0x582b, 0x5831, 0x397b, - 0x404b, 0x3054, 0x582a, 0x5828, 0x415a, 0x577c, 0x3b34, 0x4246, - 0x583d, 0x415b, 0x5838, 0x5835, 0x5836, 0x3c66, 0x5839, 0x583c, - 0x5837, 0x3d25, 0x583a, 0x5834, 0x4c7c, 0x4c7b, 0x583e, 0x583f, - 0x3055, 0x5833, 0x3672, 0x3026, 0x3436, 0x583b, 0x5843, 0x5842, - 0x5847, 0x5848, 0x5846, 0x5849, 0x5841, 0x5845, 0x584a, 0x584b, - 0x5840, 0x3b7c, 0x5844, 0x4256, 0x3932, 0x5832, 0x3f35, 0x5858, - 0x4a69, 0x584e, 0x584f, 0x5850, 0x5857, 0x5856, 0x4b7d, 0x3437, - 0x5854, 0x3745, 0x3334, 0x5851, 0x4e38, 0x5853, 0x3056, 0x5855, - 0x584c, 0x5852, 0x5859, 0x3744, 0x584d, 0x4d5d, 0x4d2b, 0x585c, - 0x5860, 0x417e, 0x4e79, 0x5861, 0x585e, 0x585b, 0x585a, 0x585f, - 0x4a30, 0x4634, 0x3746, 0x5862, 0x585d, 0x5863, 0x377b, 0x3231, - 0x586b, 0x3438, 0x5869, 0x586a, 0x3a29, 0x5868, 0x5866, 0x5865, - 0x586c, 0x5864, 0x586e, 0x327b, 0x5870, 0x586f, 0x4428, 0x5873, - 0x5871, 0x5867, 0x377c, 0x5872, 0x5876, 0x5875, 0x5877, 0x5874, - 0x5878, 0x5879, 0x587a, 0x4a6a, 0x587c, 0x587b, 0x3d3f, 0x402e, - 0x3266, 0x327c, 0x587d, 0x303f, 0x404c, 0x587e, 0x6c43, 0x5921, - 0x3761, 0x5922, 0x406f, 0x5923, 0x5924, 0x353a, 0x5925, 0x5926, - 0x5927, 0x4257, 0x384d, 0x4c61, 0x4b3c, 0x3d6a, 0x5928, 0x4070, - 0x6e3d, 0x4862, 0x3c6a, 0x3a4d, 0x5929, 0x4247, 0x4a27, 0x4271, - 0x592c, 0x592a, 0x592d, 0x592b, 0x592e, 0x4a31, 0x3037, 0x495e, - 0x4863, 0x592f, 0x5932, 0x3e35, 0x353b, 0x5930, 0x5937, 0x3e36, - 0x5931, 0x4744, 0x4d5e, 0x5933, 0x5934, 0x5938, 0x456a, 0x5935, - 0x3933, 0x405e, 0x5946, 0x4834, 0x4272, 0x4864, 0x5a2d, 0x4a7a, - 0x4471, 0x4b75, 0x593b, 0x3221, 0x436a, 0x5944, 0x4334, 0x593e, - 0x5945, 0x5940, 0x5947, 0x5943, 0x5942, 0x476f, 0x593c, 0x327d, - 0x593a, 0x3571, 0x4273, 0x5936, 0x5939, 0x3934, 0x405b, 0x3e37, - 0x5941, 0x4752, 0x3572, 0x3348, 0x3367, 0x3f21, 0x5949, 0x594e, - 0x594a, 0x377d, 0x594f, 0x3b22, 0x3969, 0x3d26, 0x593d, 0x3b7d, - 0x594c, 0x3b58, 0x594d, 0x3044, 0x5948, 0x4429, 0x3573, 0x3634, - 0x594b, 0x3027, 0x3a43, 0x3f36, 0x4472, 0x4854, 0x5951, 0x415e, - 0x422a, 0x3b2b, 0x5952, 0x5954, 0x5950, 0x4a61, 0x443d, 0x415c, - 0x4a7b, 0x3c4e, 0x5960, 0x595f, 0x3f78, 0x377e, 0x5959, 0x3e39, - 0x4668, 0x4731, 0x5957, 0x415d, 0x3c78, 0x595c, 0x3e38, 0x5956, - 0x595b, 0x4753, 0x5955, 0x3721, 0x335d, 0x595d, 0x4e2b, 0x3a4e, - 0x4335, 0x595a, 0x405c, 0x3935, 0x3f64, 0x3166, 0x413c, 0x5958, - 0x3545, 0x3747, 0x444f, 0x595e, 0x415f, 0x5961, 0x5963, 0x4237, - 0x5969, 0x5964, 0x5966, 0x4941, 0x4473, 0x5967, 0x4d2c, 0x4d48, - 0x3439, 0x302e, 0x5965, 0x5962, 0x3478, 0x3167, 0x5968, 0x4d49, - 0x596c, 0x423b, 0x5973, 0x596d, 0x596a, 0x5971, 0x5953, 0x596e, - 0x5972, 0x4842, 0x456b, 0x596b, 0x596f, 0x3748, 0x3a71, 0x405d, - 0x5977, 0x4526, 0x5974, 0x4b60, 0x5975, 0x5976, 0x4c4e, 0x4022, - 0x3762, 0x597d, 0x3b35, 0x597a, 0x5979, 0x4732, 0x4635, 0x4531, - 0x597b, 0x597c, 0x496f, 0x4745, 0x3b23, 0x4071, 0x4b50, 0x3349, - 0x5a25, 0x597e, 0x4d4a, 0x5a27, 0x5a23, 0x5a24, 0x4160, 0x5a22, - 0x593f, 0x5a26, 0x5a21, 0x5a2b, 0x5a2c, 0x4527, 0x5a2e, 0x3b24, - 0x5a29, 0x353c, 0x5a2f, 0x5a28, 0x5a33, 0x5a32, 0x5a31, 0x5a34, - 0x5a36, 0x3e71, 0x5a35, 0x5a39, 0x5a37, 0x5a38, 0x5970, 0x5a3b, - 0x5a3a, 0x5978, 0x5a3c, 0x5a30, 0x3b59, 0x5a3d, 0x5a3e, 0x5a40, - 0x5a3f, 0x5a41, 0x327e, 0x3936, 0x4a7c, 0x402f, 0x384e, 0x5a43, - 0x5a46, 0x4952, 0x355f, 0x5a45, 0x5a44, 0x4754, 0x5a47, 0x3635, - 0x5a49, 0x5a48, 0x343a, 0x3b36, 0x4658, 0x3749, 0x3f74, 0x5a4a, - 0x4030, 0x4528, 0x495f, 0x5a4b, 0x5a4c, 0x5a4d, 0x4a38, 0x555d, - 0x4046, 0x494c, 0x3a58, 0x4865, 0x4843, 0x454d, 0x4e41, 0x5a4f, - 0x3c50, 0x5a50, 0x3036, 0x3654, 0x404d, 0x4960, 0x5a51, 0x3b42, - 0x4347, 0x3b5b, 0x3f37, 0x5a52, 0x4a7d, 0x3177, 0x3b5c, 0x5a55, - 0x5a53, 0x5a56, 0x4e39, 0x5a54, 0x407b, 0x5a57, 0x4232, 0x5a58, - 0x347a, 0x5a5a, 0x5a59, 0x5a5b, 0x5a5c, 0x347b, 0x467c, 0x4336, - 0x356c, 0x3b5d, 0x4161, 0x3d5c, 0x3030, 0x5a5d, 0x3222, 0x5a61, - 0x3937, 0x5a60, 0x3a2b, 0x3e3a, 0x5a5f, 0x3e3b, 0x4c40, 0x3a2a, - 0x3057, 0x404e, 0x5a66, 0x4031, 0x3147, 0x3d55, 0x4b66, 0x3a72, - 0x3e3c, 0x4027, 0x5a65, 0x5a63, 0x5a64, 0x436b, 0x5b26, 0x5a6a, - 0x3b7e, 0x3938, 0x5a68, 0x5a69, 0x3f38, 0x5a67, 0x3b2f, 0x5a6c, - 0x5a6b, 0x5a70, 0x5a71, 0x5a6d, 0x3322, 0x5a6e, 0x5a6f, 0x4855, - 0x4961, 0x374a, 0x5a72, 0x4032, 0x3e3d, 0x4352, 0x3647, 0x5a73, - 0x5a77, 0x324b, 0x5a74, 0x5a76, 0x5a75, 0x3d6b, 0x4348, 0x3045, - 0x5a78, 0x5a79, 0x442a, 0x4e71, 0x3b43, 0x4a6b, 0x4b3d, 0x5b22, - 0x5a7b, 0x5a7e, 0x5a7d, 0x5a7a, 0x5b21, 0x465e, 0x5a7c, 0x5b23, - 0x3d6c, 0x5b24, 0x4d4b, 0x4778, 0x5b25, 0x5b27, 0x5b28, 0x5b29, - 0x364a, 0x3148, 0x3939, 0x5b2a, 0x5b2b, 0x3d71, 0x4162, 0x5258, - 0x413e, 0x413d, 0x4258, 0x3a47, 0x5072, 0x376e, 0x4d2d, 0x4a7e, - 0x497e, 0x5b2c, 0x3a73, 0x443f, 0x5b2d, 0x4f2f, 0x4b3e, 0x442b, - 0x5b2e, 0x347c, 0x5b2f, 0x5b30, 0x4c5a, 0x4c24, 0x4b76, 0x4b5c, - 0x3b25, 0x5b32, 0x3c6b, 0x4b51, 0x5b34, 0x5b37, 0x5b36, 0x3479, - 0x3560, 0x5b33, 0x5b35, 0x5b38, 0x3f79, 0x4d7b, 0x3049, 0x3a60, - 0x423c, 0x3c5d, 0x3e73, 0x5b3b, 0x454e, 0x5b39, 0x422b, 0x5b3a, - 0x3e72, 0x4c5d, 0x5b3c, 0x5b3d, 0x4d68, 0x5b42, 0x393a, 0x4755, - 0x5b3f, 0x456c, 0x5a5e, 0x5a62, 0x354f, 0x4747, 0x5b41, 0x3e3e, - 0x4844, 0x5b47, 0x487a, 0x5b3e, 0x5b44, 0x5b43, 0x404f, 0x4b6d, - 0x4e53, 0x4b67, 0x324c, 0x3b5e, 0x4f48, 0x5b46, 0x3f75, 0x5b45, - 0x5b40, 0x384f, 0x5b4c, 0x5b4a, 0x324d, 0x5b48, 0x5b4e, 0x5b54, - 0x4248, 0x4a41, 0x5b56, 0x4922, 0x5b55, 0x4770, 0x4b3f, 0x343b, - 0x4077, 0x3d40, 0x4453, 0x4d2e, 0x5b51, 0x5b50, 0x5b52, 0x5b4f, - 0x5b57, 0x5b4d, 0x5b4b, 0x5b53, 0x5b49, 0x436c, 0x4c78, 0x3c46, - 0x3a74, 0x3a3a, 0x4b6f, 0x3341, 0x444e, 0x464a, 0x3149, 0x4072, - 0x4034, 0x372a, 0x5b59, 0x393b, 0x337c, 0x5b5b, 0x3374, 0x5b61, - 0x5b5e, 0x4073, 0x334b, 0x3a2c, 0x334a, 0x3a4f, 0x5b5c, 0x3765, - 0x374b, 0x456d, 0x5b5a, 0x3046, 0x5b5d, 0x5b5f, 0x364d, 0x372c, - 0x343c, 0x354b, 0x5b62, 0x3a79, 0x4b71, 0x3b37, 0x5b63, 0x4930, - 0x5b6f, 0x3233, 0x5b64, 0x5b75, 0x5b65, 0x4e42, 0x5b6c, 0x475f, - 0x5b74, 0x5b67, 0x3034, 0x5b69, 0x393c, 0x5b6b, 0x5b6a, 0x5b66, - 0x5b71, 0x3e3f, 0x546d, 0x3868, 0x4d7c, 0x5b68, 0x4474, 0x3323, - 0x3a2d, 0x5b60, 0x5b70, 0x3361, 0x5b6e, 0x5b72, 0x456e, 0x347e, - 0x5c32, 0x4c49, 0x5b77, 0x347d, 0x5b7e, 0x4b40, 0x5c21, 0x5c23, - 0x5c27, 0x5b79, 0x432a, 0x456f, 0x5c2b, 0x5b7c, 0x5c28, 0x5c22, - 0x3f39, 0x5c2c, 0x4033, 0x5c2a, 0x343d, 0x4f50, 0x5b76, 0x5c26, - 0x3058, 0x5b78, 0x4c3a, 0x5b7d, 0x3f22, 0x4447, 0x5b73, 0x5c25, - 0x3f7a, 0x5c2f, 0x3371, 0x3821, 0x5c31, 0x5b7a, 0x5c30, 0x5c29, - 0x5b7b, 0x5c2d, 0x5c2e, 0x5c3f, 0x464e, 0x5c24, 0x5c3b, 0x5c3d, - 0x4458, 0x4d4c, 0x4976, 0x5c38, 0x424a, 0x5c3e, 0x413f, 0x5c35, - 0x5c42, 0x5c41, 0x466f, 0x5c40, 0x466a, 0x5c44, 0x5c37, 0x3648, - 0x5c3a, 0x3d5d, 0x4760, 0x5c3c, 0x364b, 0x5c34, 0x5c36, 0x5c33, - 0x4f30, 0x335a, 0x5c39, 0x5c43, 0x3335, 0x3a67, 0x315d, 0x5c54, - 0x4f31, 0x5c57, 0x3f3a, 0x5c56, 0x5c55, 0x5c52, 0x5c46, 0x5c63, - 0x5c45, 0x5c58, 0x5c50, 0x5c4b, 0x5c48, 0x5c49, 0x5c51, 0x7422, - 0x5c4e, 0x393d, 0x4448, 0x4164, 0x5c4c, 0x5c47, 0x5c4a, 0x4d4d, - 0x4b6a, 0x5c4f, 0x5c59, 0x5c61, 0x5c5a, 0x5c67, 0x5c65, 0x5c60, - 0x5c5f, 0x4450, 0x4165, 0x5c5d, 0x5c5b, 0x5c62, 0x5c68, 0x4875, - 0x5c6e, 0x5c69, 0x5c6c, 0x5c66, 0x4374, 0x4938, 0x5c5c, 0x5c64, - 0x3e40, 0x4c4f, 0x5c78, 0x5c6b, 0x3822, 0x3223, 0x335f, 0x5c53, - 0x3e41, 0x5c70, 0x5c77, 0x3c79, 0x3372, 0x432e, 0x5c6d, 0x5c72, - 0x5c76, 0x3636, 0x354c, 0x5c74, 0x3521, 0x464b, 0x5c73, 0x5c75, - 0x5c6f, 0x5c71, 0x3360, 0x4349, 0x5c7c, 0x5c7a, 0x3869, 0x5c79, - 0x5d21, 0x5b58, 0x5c7b, 0x5c7d, 0x5c7e, 0x5d2c, 0x5d28, 0x5b6d, - 0x5d27, 0x5d26, 0x5d23, 0x5c6a, 0x5d25, 0x5d24, 0x5d2a, 0x4f26, - 0x5d2d, 0x367b, 0x5d29, 0x5d2b, 0x4827, 0x5d2e, 0x5d32, 0x5d2f, - 0x4d73, 0x5d30, 0x5c5e, 0x5d33, 0x5d34, 0x3135, 0x5d36, 0x3767, - 0x3c21, 0x3655, 0x3224, 0x4d5f, 0x5d38, 0x5d37, 0x5d3a, 0x353d, - 0x3656, 0x343e, 0x5d3d, 0x5d3c, 0x5d3e, 0x324e, 0x4337, 0x5d3f, - 0x343f, 0x5d41, 0x5d40, 0x5d42, 0x5d43, 0x5d44, 0x3b5f, 0x4035, - 0x3a21, 0x4970, 0x4a62, 0x4f44, 0x3b75, 0x3a50, 0x4e72, 0x5d45, - 0x5d46, 0x3b60, 0x5d47, 0x5d48, 0x5d4a, 0x5d49, 0x4b58, 0x3d5e, - 0x3c6c, 0x3b44, 0x5d4b, 0x5d4d, 0x3f23, 0x5d4c, 0x5d4e, 0x5d4f, - 0x5d50, 0x5d51, 0x5d52, 0x5d54, 0x5d53, 0x5d55, 0x3225, 0x434a, - 0x5d56, 0x3b26, 0x334c, 0x5d57, 0x4542, 0x544c, 0x3523, 0x5d58, - 0x5d59, 0x4a6c, 0x4b68, 0x4647, 0x5d5a, 0x4866, 0x487b, 0x4c53, - 0x5d5b, 0x5d5d, 0x5d5c, 0x5d5f, 0x5d5e, 0x5d61, 0x3b61, 0x4c31, - 0x5d62, 0x5d63, 0x3524, 0x5d64, 0x5d66, 0x5d65, 0x3f65, 0x4939, - 0x314a, 0x4845, 0x4475, 0x3d41, 0x3561, 0x4846, 0x3c2e, 0x5d68, - 0x3440, 0x3178, 0x4672, 0x5d67, 0x393e, 0x4353, 0x5d69, 0x5d71, - 0x5d6a, 0x4241, 0x3562, 0x5d72, 0x3768, 0x3525, 0x5d70, 0x5d6e, - 0x5d6b, 0x4d60, 0x4440, 0x4659, 0x5d6c, 0x5d74, 0x5d73, 0x3723, - 0x322d, 0x3a3b, 0x5d6d, 0x5d6f, 0x4b57, 0x4274, 0x4b77, 0x5d7c, - 0x5d7d, 0x324f, 0x4a28, 0x4c7d, 0x5e21, 0x3c23, 0x3e42, 0x5d78, - 0x5d7e, 0x3168, 0x3637, 0x5d75, 0x5d7a, 0x4074, 0x4771, 0x4867, - 0x5d77, 0x4b21, 0x5d79, 0x5e24, 0x5e22, 0x5d7b, 0x4b22, 0x4748, - 0x3563, 0x4525, 0x436d, 0x5e25, 0x5e23, 0x4259, 0x5d76, 0x314b, - 0x4d4e, 0x5e30, 0x5e2f, 0x4076, 0x5e2c, 0x4d6c, 0x4636, 0x5e26, - 0x4445, 0x314c, 0x393f, 0x5e29, 0x3d27, 0x5e2e, 0x5e2d, 0x5e28, - 0x5e2b, 0x3368, 0x5e2a, 0x4749, 0x4e2e, 0x3e74, 0x4075, 0x5e36, - 0x5e34, 0x494d, 0x5e31, 0x5e33, 0x313a, 0x3940, 0x4f32, 0x333d, - 0x4962, 0x4d61, 0x3324, 0x3f3b, 0x5e35, 0x5e3a, 0x3e43, 0x4d30, - 0x5e37, 0x5e32, 0x5e38, 0x4e5e, 0x4573, 0x4642, 0x3336, 0x3155, - 0x5e3e, 0x5e41, 0x4e43, 0x4d64, 0x5e48, 0x5e42, 0x5e3f, 0x4e54, - 0x5e45, 0x3d4a, 0x5e47, 0x5e4c, 0x4571, 0x5e4a, 0x5e44, 0x4338, - 0x5e4b, 0x5e40, 0x5e46, 0x5e4d, 0x307c, 0x5e43, 0x5e4e, 0x3f3c, - 0x3d5f, 0x4a25, 0x3a2e, 0x5e3b, 0x5e49, 0x453a, 0x4036, 0x3369, - 0x3a51, 0x3e44, 0x5e3d, 0x3d42, 0x374c, 0x5e3c, 0x5e52, 0x3d6d, - 0x383a, 0x5e61, 0x5e5b, 0x3574, 0x454f, 0x5e56, 0x5e5f, 0x302f, - 0x3132, 0x3239, 0x5e58, 0x422c, 0x5e4f, 0x5e51, 0x3941, 0x5e62, - 0x5e5d, 0x5e55, 0x5e5c, 0x4c2b, 0x5e5a, 0x5e5e, 0x3850, 0x3e45, - 0x4339, 0x5e54, 0x4d2f, 0x5e57, 0x5e50, 0x4572, 0x5e53, 0x5e59, - 0x4f51, 0x3c3e, 0x4b7e, 0x5e63, 0x482e, 0x5e6f, 0x383b, 0x3d60, - 0x5e65, 0x4e2f, 0x3942, 0x5e72, 0x306e, 0x5e70, 0x5e64, 0x5e6a, - 0x5e6c, 0x4d4f, 0x5e67, 0x452e, 0x5e69, 0x5e71, 0x5e6b, 0x4c47, - 0x5e66, 0x3c22, 0x5e7e, 0x336a, 0x5e68, 0x5e6d, 0x5e6e, 0x426c, - 0x425a, 0x5e76, 0x5e7c, 0x5e7a, 0x4529, 0x5f23, 0x5e77, 0x5e78, - 0x5e60, 0x3579, 0x493a, 0x3c3f, 0x3977, 0x4f33, 0x5e74, 0x5f22, - 0x3169, 0x4166, 0x4779, 0x3441, 0x4e7a, 0x4c21, 0x4452, 0x5e7b, - 0x5e7d, 0x4132, 0x5f21, 0x5e79, 0x5e73, 0x3443, 0x3769, 0x5f2f, - 0x5f2a, 0x4078, 0x3363, 0x3d61, 0x5f33, 0x5f2c, 0x442c, 0x5f29, - 0x4459, 0x5f4c, 0x5f26, 0x5f25, 0x5f2e, 0x5f28, 0x5f27, 0x5f2d, - 0x4021, 0x5f24, 0x5f30, 0x5f31, 0x3442, 0x5f36, 0x5f35, 0x5f37, - 0x5f3a, 0x4543, 0x5f34, 0x5f38, 0x3763, 0x4279, 0x5f32, 0x473b, - 0x5f39, 0x5f3e, 0x5f3c, 0x5f3f, 0x5f42, 0x5f3b, 0x396a, 0x4728, - 0x5e39, 0x4d74, 0x5f3d, 0x5f41, 0x4275, 0x5f40, 0x5f2b, 0x6f69, - 0x5f45, 0x5f49, 0x5f47, 0x5f43, 0x5f44, 0x5f48, 0x5f46, 0x494e, - 0x5f4e, 0x5f4b, 0x5f4a, 0x5f4d, 0x4654, 0x5f4f, 0x4375, 0x426d, - 0x4025, 0x5f50, 0x5f52, 0x5f51, 0x5e75, 0x5f53, 0x4667, 0x5f54, - 0x3250, 0x4574, 0x3325, 0x3564, 0x3c5e, 0x3a52, 0x4f27, 0x3f66, - 0x316a, 0x5f56, 0x5f55, 0x5f59, 0x433a, 0x5f5c, 0x5f57, 0x5f5b, - 0x5f5a, 0x4540, 0x3059, 0x4e75, 0x5f5e, 0x3128, 0x5f60, 0x5f5f, - 0x5f5d, 0x5f58, 0x4b23, 0x5f62, 0x5f61, 0x316b, 0x5f64, 0x4a32, - 0x5f63, 0x4c35, 0x3e47, 0x4133, 0x3e46, 0x4e7b, 0x5f6a, 0x4079, - 0x5f66, 0x5f6b, 0x316c, 0x5f69, 0x4761, 0x5f65, 0x5f68, 0x3e48, - 0x4851, 0x5f6c, 0x3c51, 0x407a, 0x5f6f, 0x5f67, 0x3727, 0x5f6d, - 0x4d50, 0x5f70, 0x7426, 0x3d4f, 0x5f71, 0x5f72, 0x472e, 0x5f74, - 0x5f75, 0x4733, 0x4575, 0x5f77, 0x5f79, 0x4e55, 0x5f76, 0x5f78, - 0x316d, 0x5f73, 0x535b, 0x5f7a, 0x4167, 0x3b38, 0x5f7c, 0x5f7b, - 0x3f24, 0x5259, 0x5f7d, 0x6021, 0x5f6e, 0x5f7e, 0x6022, 0x477a, - 0x6023, 0x6024, 0x6025, 0x6026, 0x445e, 0x6028, 0x6027, 0x6029, - 0x602a, 0x3c5f, 0x4963, 0x4c6c, 0x602b, 0x602c, 0x4156, 0x3c24, - 0x602d, 0x602e, 0x602f, 0x4a52, 0x4847, 0x6030, 0x4757, 0x442d, - 0x6031, 0x3267, 0x356d, 0x4c46, 0x4c36, 0x3234, 0x4f34, 0x4b52, - 0x4a2a, 0x4037, 0x6032, 0x4643, 0x3823, 0x6033, 0x3a54, 0x6035, - 0x6034, 0x6036, 0x6037, 0x6038, 0x353e, 0x6039, 0x603a, 0x3824, - 0x4848, 0x603c, 0x3e75, 0x603b, 0x3638, 0x603d, 0x603f, 0x603e, - 0x6040, 0x3851, 0x6041, 0x3669, 0x4140, 0x397d, 0x6043, 0x6044, - 0x6042, 0x3c6d, 0x4648, 0x3639, 0x6046, 0x432c, 0x6045, 0x4f35, - 0x4762, 0x6049, 0x604b, 0x6048, 0x4c54, 0x604a, 0x604c, 0x4e44, - 0x6050, 0x604f, 0x4376, 0x472d, 0x3825, 0x604e, 0x604d, 0x4d31, - 0x4d32, 0x6051, 0x316e, 0x3976, 0x3b62, 0x6052, 0x6053, 0x6055, - 0x3d43, 0x6057, 0x6056, 0x6058, 0x334d, 0x605a, 0x6059, 0x605c, - 0x605b, 0x383c, 0x4e28, 0x364c, 0x3226, 0x366a, 0x3461, 0x4e68, - 0x605e, 0x6060, 0x6061, 0x3251, 0x605d, 0x3b39, 0x4441, 0x605f, - 0x6064, 0x3c6e, 0x6062, 0x373e, 0x4849, 0x6063, 0x607e, 0x6069, - 0x383d, 0x3565, 0x6066, 0x4d7d, 0x4e30, 0x4276, 0x6068, 0x606a, - 0x4e56, 0x3657, 0x487c, 0x474a, 0x606b, 0x606d, 0x6070, 0x606c, - 0x606f, 0x386a, 0x314d, 0x6071, 0x3f70, 0x606e, 0x4e5c, 0x6074, - 0x7424, 0x6072, 0x6075, 0x6067, 0x6073, 0x3a3c, 0x6076, 0x6077, - 0x4d7e, 0x6078, 0x6079, 0x6065, 0x607a, 0x3444, 0x3c25, 0x607b, - 0x607c, 0x607d, 0x313b, 0x6121, 0x493b, 0x6122, 0x3424, 0x6123, - 0x6124, 0x6125, 0x6127, 0x6128, 0x6126, 0x4953, 0x612a, 0x6129, - 0x612c, 0x612b, 0x612d, 0x612e, 0x6130, 0x612f, 0x3979, 0x6132, - 0x6131, 0x3445, 0x3f53, 0x453c, 0x6133, 0x4038, 0x3b3a, 0x3179, - 0x6134, 0x4d51, 0x4a63, 0x6135, 0x4544, 0x4d33, 0x3943, 0x3f3d, - 0x434b, 0x5234, 0x442e, 0x3268, 0x6136, 0x6137, 0x613c, 0x613a, - 0x6139, 0x5a42, 0x3326, 0x6138, 0x305a, 0x482a, 0x484a, 0x4e31, - 0x613d, 0x613b, 0x435c, 0x4026, 0x482b, 0x492d, 0x613f, 0x4e2c, - 0x374d, 0x6140, 0x613e, 0x4856, 0x6141, 0x6142, 0x305b, 0x3e76, - 0x6147, 0x6144, 0x466d, 0x6143, 0x3526, 0x614a, 0x6145, 0x6146, - 0x6149, 0x6148, 0x4925, 0x4142, 0x4141, 0x353f, 0x614b, 0x614c, - 0x614d, 0x614f, 0x614e, 0x3156, 0x6157, 0x4868, 0x6151, 0x6153, - 0x6155, 0x3f3e, 0x6156, 0x6154, 0x3c40, 0x6150, 0x6152, 0x4942, - 0x3e49, 0x6159, 0x6158, 0x615a, 0x3c26, 0x3a2f, 0x4577, 0x615b, - 0x444b, 0x615d, 0x4e21, 0x615c, 0x4169, 0x6162, 0x6164, 0x6165, - 0x4354, 0x6163, 0x6160, 0x615e, 0x615f, 0x6161, 0x6168, 0x6166, - 0x6167, 0x6169, 0x616b, 0x616c, 0x616d, 0x616e, 0x616a, 0x6170, - 0x616f, 0x6171, 0x4e45, 0x6174, 0x6172, 0x6173, 0x3462, 0x4c7e, - 0x4a4a, 0x6176, 0x6175, 0x6177, 0x6178, 0x617c, 0x6179, 0x617a, - 0x617b, 0x617d, 0x617e, 0x6221, 0x6222, 0x6223, 0x482f, 0x4550, - 0x6224, 0x4772, 0x4934, 0x6225, 0x6226, 0x452a, 0x3327, 0x3944, - 0x6227, 0x6228, 0x6229, 0x3b29, 0x622b, 0x622a, 0x622c, 0x622d, - 0x4869, 0x622e, 0x622f, 0x7369, 0x6230, 0x6231, 0x6232, 0x3b2e, - 0x6233, 0x4756, 0x4b5f, 0x314e, 0x3157, 0x6234, 0x6236, 0x6235, - 0x4570, 0x4039, 0x5d39, 0x6237, 0x4c41, 0x6238, 0x3446, 0x4857, - 0x6239, 0x623a, 0x623b, 0x4c5c, 0x4c55, 0x443e, 0x416a, 0x623d, - 0x3d62, 0x3e4a, 0x6240, 0x623f, 0x623e, 0x487d, 0x3447, 0x3829, - 0x6246, 0x6243, 0x3f3f, 0x4c32, 0x6242, 0x6244, 0x6245, 0x6241, - 0x6247, 0x6248, 0x442f, 0x3463, 0x4365, 0x6249, 0x624a, 0x624d, - 0x3f67, 0x4644, 0x624e, 0x4b53, 0x624b, 0x624c, 0x6251, 0x6250, - 0x624f, 0x6253, 0x6252, 0x6254, 0x6256, 0x6255, 0x4a4d, 0x3d56, - 0x4e46, 0x6257, 0x4637, 0x6258, 0x6259, 0x625d, 0x625b, 0x625c, - 0x625a, 0x625e, 0x625f, 0x6260, 0x6261, 0x4c37, 0x6262, 0x4c70, - 0x6263, 0x434e, 0x476a, 0x366b, 0x433b, 0x6264, 0x363a, 0x4050, - 0x6265, 0x3a3d, 0x6266, 0x6267, 0x3826, 0x3a55, 0x6269, 0x4556, - 0x3a56, 0x354e, 0x4b24, 0x474b, 0x4557, 0x395c, 0x626b, 0x3e4b, - 0x4e32, 0x3945, 0x3827, 0x4823, 0x626d, 0x626f, 0x386b, 0x626e, - 0x4476, 0x6271, 0x3337, 0x626c, 0x486a, 0x3130, 0x3a6c, 0x4f52, - 0x6270, 0x6272, 0x4a4b, 0x4059, 0x6274, 0x6275, 0x6273, 0x334e, - 0x627b, 0x627a, 0x3c27, 0x627c, 0x6277, 0x627d, 0x6278, 0x4858, - 0x6276, 0x6279, 0x6322, 0x6321, 0x4b61, 0x627e, 0x306b, 0x6324, - 0x6323, 0x3e4c, 0x6325, 0x4143, 0x6327, 0x6326, 0x6328, 0x6268, - 0x626a, 0x632a, 0x6329, 0x3c28, 0x4e69, 0x3c52, 0x632b, 0x3737, - 0x3540, 0x3527, 0x3b63, 0x4d34, 0x6331, 0x6330, 0x4144, 0x632d, - 0x632f, 0x3d4b, 0x3f40, 0x632e, 0x632c, 0x472a, 0x3e4d, 0x493c, - 0x3a57, 0x4578, 0x6332, 0x6333, 0x6349, 0x3658, 0x4f3d, 0x4135, - 0x6334, 0x3252, 0x4477, 0x4a21, 0x6335, 0x357a, 0x6336, 0x6338, - 0x6339, 0x4729, 0x633a, 0x633b, 0x633c, 0x3659, 0x3253, 0x4645, - 0x3d28, 0x3b64, 0x633d, 0x3d29, 0x324a, 0x4943, 0x633e, 0x486b, - 0x4145, 0x6341, 0x6342, 0x4769, 0x3f41, 0x633f, 0x4361, 0x6340, - 0x3e4e, 0x305c, 0x3529, 0x6343, 0x4478, 0x6344, 0x4047, 0x4c2d, - 0x4923, 0x6345, 0x6346, 0x4355, 0x4e47, 0x6348, 0x6347, 0x3c6f, - 0x634a, 0x3070, 0x634d, 0x634b, 0x3254, 0x374e, 0x634c, 0x3946, - 0x3972, 0x4a66, 0x634e, 0x4b54, 0x6350, 0x4051, 0x314f, 0x323a, - 0x302c, 0x634f, 0x6351, 0x6352, 0x3e77, 0x6353, 0x334f, 0x6355, - 0x376a, 0x3566, 0x6356, 0x3675, 0x6357, 0x407c, 0x464d, 0x4060, - 0x3a75, 0x6358, 0x4362, 0x416b, 0x635a, 0x635c, 0x6359, 0x635b, - 0x3722, 0x635d, 0x3726, 0x3567, 0x4d52, 0x635f, 0x6360, 0x312e, - 0x6363, 0x3376, 0x6362, 0x6361, 0x6365, 0x635e, 0x6366, 0x4e29, - 0x6367, 0x6368, 0x5474, 0x636a, 0x6369, 0x636b, 0x636c, 0x4e35, - 0x636d, 0x706f, 0x3e4f, 0x636e, 0x636f, 0x3d57, 0x4638, 0x6370, - 0x4328, 0x6371, 0x433c, 0x6372, 0x3625, 0x513f, 0x435d, 0x3c33, - 0x3448, 0x6373, 0x6422, 0x6376, 0x3568, 0x6375, 0x6424, 0x6374, - 0x3e50, 0x6378, 0x6379, 0x452b, 0x637a, 0x335e, 0x3f5a, 0x4964, - 0x637c, 0x4268, 0x6377, 0x637b, 0x637d, 0x3a7b, 0x6426, 0x492e, - 0x4826, 0x4579, 0x365a, 0x6425, 0x6423, 0x4835, 0x637e, 0x435e, - 0x457b, 0x457a, 0x3a76, 0x6438, 0x6428, 0x642a, 0x642d, 0x642e, - 0x642b, 0x642c, 0x6429, 0x6427, 0x6421, 0x4a4f, 0x3255, 0x6435, - 0x6432, 0x6437, 0x6436, 0x4773, 0x4c27, 0x3b3b, 0x6430, 0x6439, - 0x6434, 0x6433, 0x642f, 0x6431, 0x3449, 0x433d, 0x407d, 0x4822, - 0x643e, 0x4824, 0x4061, 0x643b, 0x484f, 0x643f, 0x4a53, 0x435b, - 0x643a, 0x643c, 0x643d, 0x6440, 0x3c44, 0x4646, 0x6445, 0x6444, - 0x6441, 0x4f36, 0x644a, 0x644e, 0x644b, 0x6447, 0x6448, 0x644d, - 0x6442, 0x5255, 0x6449, 0x6443, 0x644c, 0x6452, 0x344a, 0x644f, - 0x6450, 0x6451, 0x6454, 0x6453, 0x4876, 0x6455, 0x4e7c, 0x4a6d, - 0x645a, 0x6457, 0x6456, 0x4052, 0x6459, 0x645b, 0x6458, 0x645f, - 0x645c, 0x645d, 0x6446, 0x645e, 0x6460, 0x6461, 0x4a46, 0x6462, - 0x4c62, 0x364e, 0x3729, 0x6463, 0x4a34, 0x3f68, 0x4c30, 0x6464, - 0x4e33, 0x4774, 0x4146, 0x4734, 0x3d4d, 0x3040, 0x6469, 0x6467, - 0x6465, 0x3421, 0x3e51, 0x646a, 0x6468, 0x6466, 0x646e, 0x646d, - 0x646c, 0x646b, 0x646f, 0x6470, 0x403a, 0x6471, 0x6473, 0x6472, - 0x3852, 0x4138, 0x6475, 0x457c, 0x6474, 0x6476, 0x4a35, 0x416c, - 0x3947, 0x6477, 0x4e48, 0x6479, 0x647a, 0x647b, 0x647c, 0x3b65, - 0x647d, 0x374f, 0x356a, 0x352a, 0x6521, 0x4c73, 0x3948, 0x647e, - 0x6524, 0x4c66, 0x473c, 0x4933, 0x3d63, 0x6523, 0x3c53, 0x3949, - 0x3b66, 0x3569, 0x4a36, 0x6522, 0x4147, 0x4b42, 0x3a77, 0x3b67, - 0x445d, 0x6527, 0x4e5f, 0x3a59, 0x6528, 0x3f42, 0x652a, 0x3e52, - 0x3a30, 0x6529, 0x3d2a, 0x383e, 0x4148, 0x6525, 0x652b, 0x6526, - 0x3750, 0x652e, 0x6532, 0x376b, 0x652d, 0x6536, 0x394a, 0x4d6d, - 0x303c, 0x6533, 0x356b, 0x6530, 0x6531, 0x457d, 0x652f, 0x652c, - 0x3328, 0x4064, 0x3828, 0x6538, 0x6535, 0x6537, 0x6534, 0x3751, - 0x4233, 0x6539, 0x416e, 0x6546, 0x6542, 0x653c, 0x6540, 0x3c7a, - 0x305d, 0x653b, 0x6543, 0x6547, 0x394b, 0x4c56, 0x4456, 0x653d, - 0x6545, 0x653a, 0x433e, 0x653f, 0x303d, 0x4c4a, 0x653e, 0x365b, - 0x486c, 0x416d, 0x4e50, 0x3d6f, 0x656e, 0x6548, 0x407e, 0x6544, - 0x6549, 0x654b, 0x4479, 0x654e, 0x654a, 0x4a54, 0x344b, 0x4c4b, - 0x305e, 0x654d, 0x4e7d, 0x654c, 0x316f, 0x466c, 0x654f, 0x6556, - 0x6550, 0x6557, 0x6553, 0x477b, 0x3c4a, 0x6555, 0x6552, 0x6558, - 0x6551, 0x3d44, 0x4b25, 0x3d4c, 0x6554, 0x6560, 0x655c, 0x655f, - 0x655d, 0x6561, 0x655b, 0x6541, 0x4053, 0x484b, 0x655e, 0x6559, - 0x4121, 0x3752, 0x3d2b, 0x3f25, 0x4136, 0x6564, 0x6566, 0x6567, - 0x6563, 0x6565, 0x655a, 0x6562, 0x656a, 0x6569, 0x4b7a, 0x372b, - 0x6568, 0x656c, 0x656b, 0x656f, 0x6571, 0x3b3c, 0x656d, 0x6572, - 0x6573, 0x6574, 0x657a, 0x453b, 0x6576, 0x6575, 0x6577, 0x6578, - 0x6579, 0x657b, 0x657c, 0x344c, 0x657d, 0x657e, 0x6621, 0x6622, - 0x6623, 0x6624, 0x6625, 0x6626, 0x6628, 0x6627, 0x6629, 0x662a, - 0x662b, 0x662e, 0x662c, 0x662d, 0x3a61, 0x3753, 0x4356, 0x4833, - 0x3d70, 0x474d, 0x486d, 0x662f, 0x586d, 0x6630, 0x6632, 0x4d65, - 0x6631, 0x6634, 0x6633, 0x4d53, 0x6635, 0x487e, 0x6636, 0x6639, - 0x6638, 0x6637, 0x663a, 0x3732, 0x4122, 0x3541, 0x663e, 0x663b, - 0x663c, 0x663f, 0x6640, 0x663d, 0x3129, 0x3227, 0x6642, 0x6643, - 0x6644, 0x4d62, 0x3d2c, 0x6646, 0x6645, 0x3f69, 0x6647, 0x6648, - 0x6649, 0x3465, 0x344d, 0x664a, 0x664b, 0x4b5d, 0x4d63, 0x4d54, - 0x4f37, 0x394d, 0x664e, 0x3c54, 0x664d, 0x664f, 0x3c29, 0x4251, - 0x6650, 0x394c, 0x4c57, 0x6651, 0x6652, 0x6653, 0x6654, 0x6655, - 0x3c2a, 0x4c6d, 0x6657, 0x433f, 0x6656, 0x6659, 0x6658, 0x665a, - 0x403b, 0x665b, 0x665c, 0x4a39, 0x665d, 0x416f, 0x665e, 0x665f, - 0x4e7e, 0x6662, 0x6661, 0x6660, 0x4430, 0x6663, 0x3f26, 0x6664, - 0x6665, 0x4f38, 0x6666, 0x6667, 0x6669, 0x6668, 0x4825, 0x4679, - 0x4f3e, 0x4829, 0x666b, 0x3e53, 0x492a, 0x666c, 0x666a, 0x344e, - 0x3854, 0x3b68, 0x486e, 0x382a, 0x4b43, 0x666f, 0x666d, 0x394e, - 0x394f, 0x3069, 0x3a68, 0x4759, 0x305f, 0x6674, 0x4340, 0x4758, - 0x425b, 0x6676, 0x6672, 0x6675, 0x6670, 0x6673, 0x4b26, 0x3855, - 0x307d, 0x6671, 0x6678, 0x6679, 0x4639, 0x363b, 0x6726, 0x473d, - 0x3b69, 0x363c, 0x4048, 0x4f46, 0x4c2e, 0x6677, 0x4054, 0x3553, - 0x667a, 0x667c, 0x667b, 0x667d, 0x4326, 0x473e, 0x4431, 0x6723, - 0x6722, 0x667e, 0x3f55, 0x4965, 0x6725, 0x6724, 0x3950, 0x4f53, - 0x6735, 0x6729, 0x672a, 0x3c70, 0x6728, 0x3978, 0x6727, 0x672b, - 0x4432, 0x4a22, 0x4123, 0x425c, 0x672f, 0x6730, 0x672c, 0x672d, - 0x672e, 0x3951, 0x6736, 0x6732, 0x4966, 0x4b6c, 0x4928, 0x6731, - 0x6734, 0x6733, 0x4b44, 0x6737, 0x6738, 0x4137, 0x6739, 0x673b, - 0x673f, 0x673c, 0x673a, 0x473f, 0x673d, 0x673e, 0x3232, 0x6745, - 0x6740, 0x6741, 0x6742, 0x4221, 0x6744, 0x6743, 0x6746, 0x6747, - 0x6748, 0x3f43, 0x3269, 0x6749, 0x4e57, 0x3c2b, 0x3d2d, 0x3b6a, - 0x4357, 0x674a, 0x674b, 0x3131, 0x674c, 0x674d, 0x674e, 0x674f, - 0x6750, 0x363d, 0x5a2a, 0x6751, 0x4065, 0x6752, 0x3c4b, 0x6753, - 0x5030, 0x6754, 0x4a5e, 0x345c, 0x4124, 0x3d58, 0x4971, 0x3d2e, - 0x6755, 0x3952, 0x6756, 0x484c, 0x6764, 0x6758, 0x4249, 0x4775, - 0x383f, 0x6757, 0x4125, 0x6759, 0x447a, 0x675b, 0x675a, 0x675d, - 0x675c, 0x675e, 0x6760, 0x675f, 0x344f, 0x6761, 0x6762, 0x6763, - 0x3a31, 0x4e49, 0x6765, 0x3f27, 0x3170, 0x6766, 0x6767, 0x6768, - 0x3072, 0x6769, 0x676a, 0x4967, 0x3c47, 0x676c, 0x3329, 0x3032, - 0x676b, 0x676e, 0x474e, 0x3f44, 0x3256, 0x4b27, 0x375d, 0x365c, - 0x676d, 0x326a, 0x3423, 0x3171, 0x6772, 0x4e6a, 0x425d, 0x4944, - 0x677e, 0x3257, 0x677c, 0x677a, 0x6771, 0x676f, 0x6770, 0x3c63, - 0x366c, 0x4377, 0x4651, 0x3151, 0x6774, 0x6773, 0x6779, 0x6775, - 0x6778, 0x4c50, 0x6777, 0x3258, 0x337d, 0x677b, 0x677d, 0x3754, - 0x6823, 0x682c, 0x682d, 0x302b, 0x6834, 0x3071, 0x682b, 0x682a, - 0x6825, 0x6824, 0x6822, 0x6821, 0x4363, 0x427b, 0x6827, 0x6826, - 0x6829, 0x4170, 0x3755, 0x3141, 0x6828, 0x3953, 0x4171, 0x683a, - 0x683b, 0x3259, 0x322e, 0x6838, 0x682e, 0x6836, 0x683d, 0x6837, - 0x6835, 0x6776, 0x6833, 0x682f, 0x3450, 0x6831, 0x683c, 0x6832, - 0x683e, 0x6830, 0x477c, 0x4d69, 0x6839, 0x684f, 0x6847, 0x3f7b, - 0x3546, 0x365d, 0x6842, 0x325b, 0x3e54, 0x6845, 0x3a5a, 0x4551, - 0x684a, 0x4a6e, 0x6841, 0x325a, 0x3856, 0x4929, 0x684b, 0x683f, - 0x6848, 0x6852, 0x6843, 0x6844, 0x463a, 0x6849, 0x6846, 0x4b28, - 0x684c, 0x3060, 0x6840, 0x684e, 0x684d, 0x476b, 0x6854, 0x685f, - 0x337e, 0x6862, 0x6850, 0x6855, 0x4d6e, 0x685e, 0x4d55, 0x4e2a, - 0x4378, 0x336b, 0x4972, 0x6864, 0x4621, 0x3031, 0x685d, 0x6859, - 0x4172, 0x6853, 0x685b, 0x6860, 0x472c, 0x302a, 0x6858, 0x6861, - 0x4978, 0x685c, 0x6857, 0x3e55, 0x3d2f, 0x3c2c, 0x4c58, 0x4947, - 0x6867, 0x6870, 0x685a, 0x3377, 0x3e78, 0x6865, 0x686a, 0x4173, - 0x6866, 0x686d, 0x435f, 0x686e, 0x4d56, 0x6863, 0x3338, 0x6869, - 0x686c, 0x4c2c, 0x686f, 0x6868, 0x686b, 0x4b29, 0x4f21, 0x6873, - 0x687a, 0x6872, 0x3c43, 0x6851, 0x4a4e, 0x4c22, 0x6879, 0x6878, - 0x6874, 0x6875, 0x3136, 0x6877, 0x6871, 0x4455, 0x6876, 0x307e, - 0x4222, 0x4a43, 0x687b, 0x6921, 0x4859, 0x687e, 0x3e56, 0x3c49, - 0x6923, 0x363e, 0x6924, 0x4979, 0x687d, 0x6856, 0x687c, 0x4f4f, - 0x4622, 0x4973, 0x692b, 0x6931, 0x6932, 0x6925, 0x4776, 0x692f, - 0x6927, 0x6929, 0x6933, 0x6928, 0x692c, 0x3172, 0x4665, 0x692d, - 0x6930, 0x6926, 0x4126, 0x692a, 0x3b27, 0x3f45, 0x3730, 0x4c74, - 0x4c79, 0x3d72, 0x6937, 0x6935, 0x4f4e, 0x6934, 0x4d75, 0x6936, - 0x6938, 0x6939, 0x693c, 0x693a, 0x4623, 0x693b, 0x484d, 0x692e, - 0x3d73, 0x693d, 0x6942, 0x4174, 0x6941, 0x6922, 0x6943, 0x4149, - 0x693e, 0x6940, 0x693f, 0x5d31, 0x5d22, 0x6945, 0x6944, 0x4d76, - 0x623c, 0x6946, 0x6947, 0x6948, 0x3857, 0x3554, 0x694a, 0x515d, - 0x3575, 0x4e3a, 0x3673, 0x694b, 0x694c, 0x436e, 0x694d, 0x467a, - 0x303a, 0x3263, 0x6952, 0x6953, 0x694e, 0x3b3d, 0x694f, 0x4742, - 0x6950, 0x6951, 0x695b, 0x6955, 0x6958, 0x6954, 0x6956, 0x6957, - 0x3c58, 0x6959, 0x4341, 0x3756, 0x3342, 0x695c, 0x333f, 0x6961, - 0x695d, 0x6960, 0x483a, 0x695e, 0x695f, 0x4948, 0x485a, 0x6962, - 0x427d, 0x696c, 0x6968, 0x326b, 0x6966, 0x4b2a, 0x6967, 0x6964, - 0x6965, 0x696a, 0x696d, 0x696b, 0x6969, 0x6963, 0x4358, 0x6974, - 0x4c2a, 0x6972, 0x6973, 0x696e, 0x6970, 0x6971, 0x696f, 0x4066, - 0x4f39, 0x6978, 0x6979, 0x6a21, 0x3f2a, 0x697b, 0x697e, 0x6976, - 0x6975, 0x6a22, 0x325c, 0x697c, 0x6a23, 0x697d, 0x697a, 0x4433, - 0x6977, 0x4768, 0x6a27, 0x4d3b, 0x6a26, 0x6a25, 0x6a2e, 0x6a28, - 0x6a30, 0x4d66, 0x6a33, 0x6a2a, 0x6a2b, 0x6a2f, 0x6a32, 0x6a31, - 0x6a29, 0x6a2c, 0x6a3d, 0x6a36, 0x6a34, 0x6a35, 0x6a3a, 0x6a3b, - 0x332a, 0x3542, 0x6a39, 0x6a24, 0x6a38, 0x6a3c, 0x6a37, 0x6a3e, - 0x6a40, 0x6a3f, 0x6a42, 0x6a41, 0x695a, 0x6a46, 0x6a43, 0x6a44, - 0x6a45, 0x6a47, 0x376c, 0x6a49, 0x6a48, 0x3d30, 0x3954, 0x5e27, - 0x6a4a, 0x3d51, 0x3339, 0x6a4b, 0x3152, 0x3e57, 0x6a4c, 0x3955, - 0x6a4d, 0x3061, 0x493d, 0x6a4e, 0x3f6a, 0x6a55, 0x6a52, 0x436f, - 0x6a53, 0x6a50, 0x365e, 0x6a4f, 0x6a56, 0x3736, 0x425e, 0x6a5c, - 0x6a58, 0x4235, 0x6a57, 0x6a5a, 0x6a51, 0x6a5b, 0x6a5d, 0x486f, - 0x6a59, 0x6a5e, 0x6a60, 0x3853, 0x6a54, 0x3041, 0x6a5f, 0x3a5b, - 0x4e76, 0x6a61, 0x6a62, 0x4175, 0x4e22, 0x6a63, 0x4d35, 0x6a64, - 0x6a65, 0x4a64, 0x6a66, 0x3a40, 0x4e23, 0x6a6b, 0x6a6c, 0x3e58, - 0x6a6a, 0x4d67, 0x6a67, 0x6a69, 0x403d, 0x3f7e, 0x6a68, 0x6a6d, - 0x4a23, 0x6a6f, 0x6a6e, 0x336c, 0x4b2b, 0x6a70, 0x6a7c, 0x6a72, - 0x6a73, 0x6a74, 0x6a75, 0x6a79, 0x6a7a, 0x6a78, 0x6a76, 0x6a71, - 0x6a77, 0x6a7b, 0x7037, 0x3228, 0x6a7e, 0x365f, 0x6a7d, 0x6b22, - 0x6b21, 0x6b24, 0x6b23, 0x6b25, 0x3d31, 0x6b26, 0x6b27, 0x6b28, - 0x403e, 0x4d57, 0x6b29, 0x4a24, 0x4746, 0x6b2a, 0x6b2b, 0x382b, - 0x352c, 0x6b2c, 0x3b6b, 0x4741, 0x6b2d, 0x3350, 0x6b2e, 0x6b30, - 0x4d77, 0x6b2f, 0x3f46, 0x6b31, 0x6b32, 0x6b33, 0x3451, 0x6b34, - 0x6b35, 0x6b36, 0x6b37, 0x3351, 0x6b38, 0x6b39, 0x6b3a, 0x3272, - 0x3f28, 0x6b3b, 0x6b3c, 0x6b3d, 0x3840, 0x447b, 0x6b3e, 0x3757, - 0x3f56, 0x6b41, 0x4624, 0x6b40, 0x3731, 0x6b3f, 0x4277, 0x352d, - 0x6b42, 0x6b43, 0x3e59, 0x376d, 0x6b44, 0x4b2c, 0x405f, 0x3576, - 0x4c75, 0x414a, 0x6b45, 0x3f47, 0x4370, 0x3e5a, 0x6b46, 0x6b49, - 0x6b4a, 0x3a3e, 0x4242, 0x6b48, 0x3e5b, 0x493e, 0x6b47, 0x3b6c, - 0x3153, 0x6b4e, 0x3758, 0x3b6e, 0x3b6d, 0x4f4d, 0x6b4d, 0x6b4c, - 0x4127, 0x354d, 0x4f43, 0x333a, 0x3e5c, 0x6b4b, 0x6b50, 0x6b51, - 0x6b4f, 0x3858, 0x4d40, 0x3b6f, 0x4727, 0x6b54, 0x4040, 0x4342, - 0x4d36, 0x6b57, 0x386c, 0x403f, 0x6b53, 0x6b58, 0x386d, 0x6b55, - 0x6b56, 0x6b52, 0x4062, 0x4649, 0x432f, 0x325d, 0x4870, 0x3543, - 0x4434, 0x6b5b, 0x6b59, 0x434c, 0x4041, 0x3452, 0x6b5a, 0x3f5b, - 0x4e4a, 0x4f40, 0x6b5c, 0x6b67, 0x4435, 0x6b66, 0x6b63, 0x6b6b, - 0x6b64, 0x6b60, 0x447c, 0x6b5f, 0x6b5d, 0x4d21, 0x3b70, 0x6b61, - 0x6b5e, 0x6b65, 0x3d74, 0x3841, 0x427a, 0x4b45, 0x315a, 0x3062, - 0x4625, 0x6b69, 0x6b68, 0x4666, 0x6b6d, 0x6b62, 0x6b6c, 0x6b6e, - 0x382c, 0x6b6a, 0x3956, 0x3c55, 0x6b6f, 0x4d58, 0x6b72, 0x6b75, - 0x6b73, 0x4935, 0x6b70, 0x3660, 0x6b74, 0x6b76, 0x6b7a, 0x6b77, - 0x6b79, 0x6b78, 0x6b7b, 0x3c31, 0x6b7d, 0x6b7c, 0x4968, 0x6c21, - 0x3759, 0x6b7e, 0x6c22, 0x6c23, 0x3544, 0x6641, 0x3e79, 0x6c24, - 0x386e, 0x6c25, 0x6c26, 0x3b3e, 0x5a4e, 0x6c27, 0x6c28, 0x3d32, - 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x6c2d, 0x432b, 0x6c2e, 0x6c30, - 0x6c2f, 0x4626, 0x6c31, 0x4b2d, 0x6c32, 0x6c33, 0x6c34, 0x6c35, - 0x465a, 0x3e5d, 0x6c36, 0x396b, 0x502e, 0x6c37, 0x6c38, 0x493f, - 0x6c39, 0x6c41, 0x6c3a, 0x6c3c, 0x6c3b, 0x6c3d, 0x4b46, 0x6c3e, - 0x6c3f, 0x6c40, 0x6c42, 0x332d, 0x4467, 0x4969, 0x3a62, 0x3957, - 0x494f, 0x325f, 0x484e, 0x6c45, 0x3453, 0x4055, 0x6c44, 0x6c49, - 0x4379, 0x4c63, 0x6c47, 0x6c48, 0x352e, 0x6c4a, 0x4763, 0x425f, - 0x4871, 0x453d, 0x6c46, 0x4b47, 0x326c, 0x6c4c, 0x4f28, 0x4442, - 0x4f45, 0x3b71, 0x6c4b, 0x4231, 0x6c5c, 0x4128, 0x4678, 0x4950, - 0x6c4f, 0x3b3f, 0x3b72, 0x3e5e, 0x4765, 0x382d, 0x6c4e, 0x6c4d, - 0x496a, 0x3c41, 0x4552, 0x6c51, 0x6c52, 0x3958, 0x6c50, 0x6c53, - 0x6c54, 0x6c56, 0x4223, 0x6c55, 0x3466, 0x6c58, 0x6c57, 0x6c59, - 0x6c5b, 0x6c5d, 0x6c5e, 0x4056, 0x3c4f, 0x6c5f, 0x3352, 0x6c60, - 0x4176, 0x6c61, 0x6c62, 0x496b, 0x352f, 0x6c63, 0x4436, 0x315b, - 0x6c64, 0x3c71, 0x3f76, 0x422d, 0x6c67, 0x6c66, 0x6c65, 0x6c6d, - 0x6c6b, 0x6c68, 0x6c6a, 0x6c69, 0x6c6c, 0x3577, 0x6c70, 0x4057, - 0x6c71, 0x3859, 0x6c6e, 0x6c6f, 0x4f29, 0x4437, 0x4129, 0x6c72, - 0x6c75, 0x6c73, 0x6c74, 0x4d59, 0x4627, 0x6c78, 0x6c76, 0x6c77, - 0x6c79, 0x6d29, 0x6c7c, 0x6c7d, 0x6c7b, 0x6c7a, 0x447d, 0x6d21, - 0x6d25, 0x6d22, 0x6c7e, 0x6d23, 0x6d24, 0x6d2b, 0x6d26, 0x4058, - 0x6d28, 0x6d2a, 0x6d27, 0x6d2d, 0x3d33, 0x6d2c, 0x6d2e, 0x6d2f, - 0x6d32, 0x6d31, 0x6d30, 0x6d34, 0x6d33, 0x4c76, 0x6d36, 0x6d35, - 0x6d37, 0x6d38, 0x6d3a, 0x6d39, 0x3f48, 0x6d3b, 0x366d, 0x6d3c, - 0x6d3e, 0x6d3f, 0x6d40, 0x6d3d, 0x6d41, 0x3c56, 0x6d42, 0x3530, - 0x3733, 0x382e, 0x6d43, 0x4670, 0x453e, 0x6d44, 0x6d47, 0x3c34, - 0x6d46, 0x6d45, 0x375a, 0x6d48, 0x3353, 0x6d4a, 0x3a5c, 0x6d49, - 0x6d52, 0x6d4c, 0x6d4e, 0x4a65, 0x6d4b, 0x6d4d, 0x6d51, 0x6d4f, - 0x3531, 0x6d50, 0x6d53, 0x475a, 0x4e58, 0x3d34, 0x6d54, 0x4d22, - 0x6d56, 0x6d55, 0x6d59, 0x4d41, 0x6d58, 0x336d, 0x6d57, 0x6d5c, - 0x6d5b, 0x6d5a, 0x4532, 0x6d5d, 0x6d5e, 0x6d5f, 0x396c, 0x3725, - 0x6d60, 0x6d61, 0x6d62, 0x3f49, 0x6d63, 0x3c2d, 0x6d64, 0x6d65, - 0x5221, 0x517e, 0x6d66, 0x6570, 0x6d67, 0x4324, 0x3f2b, 0x4740, - 0x6d68, 0x4a55, 0x4454, 0x397e, 0x4329, 0x312a, 0x4b78, 0x3f57, - 0x375e, 0x3661, 0x4a56, 0x6d69, 0x6d6b, 0x6d6a, 0x3260, 0x4676, - 0x6d6c, 0x4777, 0x4533, 0x6d6d, 0x3d52, 0x6d6f, 0x4c42, 0x6d7e, - 0x6d71, 0x6d72, 0x4449, 0x4260, 0x4177, 0x4628, 0x6d70, 0x3555, - 0x6d79, 0x6d76, 0x6e25, 0x4629, 0x4360, 0x6d73, 0x447e, 0x4553, - 0x6d74, 0x6d78, 0x3f60, 0x4767, 0x444c, 0x4042, 0x6d77, 0x422e, - 0x4224, 0x6d75, 0x3029, 0x4f22, 0x6d7a, 0x4261, 0x3d35, 0x3f4a, - 0x6d7c, 0x6d7b, 0x306f, 0x6d7d, 0x492f, 0x6e27, 0x465b, 0x3f6b, - 0x4359, 0x3678, 0x6e26, 0x4d37, 0x313f, 0x4a57, 0x3261, 0x6e21, - 0x6e22, 0x6e23, 0x6e24, 0x463b, 0x4323, 0x3063, 0x6e28, 0x6e29, - 0x7423, 0x423d, 0x6e2a, 0x3173, 0x414c, 0x382f, 0x4d5a, 0x6e2b, - 0x452c, 0x4178, 0x3c57, 0x6e2c, 0x6e2f, 0x3d65, 0x6e2d, 0x412b, - 0x412a, 0x3064, 0x4e4b, 0x6e31, 0x4872, 0x6e33, 0x6e32, 0x6e30, - 0x6364, 0x3454, 0x6d6e, 0x6e35, 0x6e34, 0x6e36, 0x4d38, 0x4661, - 0x4b2e, 0x6e37, 0x3c59, 0x6e38, 0x6e39, 0x6e3a, 0x4521, 0x306a, - 0x3959, 0x4f3a, 0x6e3e, 0x3734, 0x6e3b, 0x6e3c, 0x4974, 0x3354, - 0x4d39, 0x363f, 0x4554, 0x6e3f, 0x6e40, 0x6e41, 0x4522, 0x6e43, - 0x6e42, 0x4653, 0x6e44, 0x3d36, 0x3c60, 0x475b, 0x4371, 0x3c72, - 0x3f6c, 0x6e45, 0x6e46, 0x3f5d, 0x6e47, 0x6e48, 0x6e49, 0x4d6f, - 0x3d37, 0x6e4b, 0x6e4a, 0x395a, 0x3973, 0x3b40, 0x6e4e, 0x3d66, - 0x6e4d, 0x6e4c, 0x4269, 0x386f, 0x4043, 0x4830, 0x3d39, 0x6e4f, - 0x3e5f, 0x6e52, 0x6e50, 0x6e51, 0x6e54, 0x6e53, 0x3e7a, 0x6e55, - 0x6e56, 0x6e57, 0x4850, 0x3a53, 0x3c61, 0x6e58, 0x6e59, 0x4e24, - 0x3d45, 0x4c6e, 0x4e4c, 0x6e5a, 0x3662, 0x6e5b, 0x4523, 0x6e5e, - 0x3378, 0x3f4b, 0x6e5c, 0x6e5d, 0x4460, 0x4b55, 0x367c, 0x6e60, - 0x6e61, 0x6e5f, 0x6e63, 0x465f, 0x3343, 0x6e67, 0x6e64, 0x6e66, - 0x6e62, 0x6f4f, 0x6e65, 0x4e6b, 0x385a, 0x6e6f, 0x4534, 0x6e6a, - 0x6e6d, 0x6e6b, 0x6e70, 0x6e71, 0x6e69, 0x6e76, 0x3174, 0x6e68, - 0x482d, 0x6e6c, 0x3e60, 0x395b, 0x4b48, 0x3664, 0x3d46, 0x463c, - 0x412d, 0x6e74, 0x6e6e, 0x6e73, 0x4c43, 0x4438, 0x6e75, 0x6e72, - 0x412c, 0x6e79, 0x6e78, 0x6e77, 0x4b2f, 0x3d7b, 0x6e7a, 0x4a5f, - 0x3154, 0x4946, 0x4372, 0x3578, 0x6e7c, 0x395d, 0x3b2c, 0x6e7b, - 0x3f6d, 0x3f6e, 0x6f21, 0x6f23, 0x3e7b, 0x6f22, 0x6f24, 0x3653, - 0x4945, 0x3c62, 0x4f23, 0x6e7e, 0x3a78, 0x4f3f, 0x6f26, 0x6f25, - 0x6f27, 0x6e7d, 0x4669, 0x4555, 0x4457, 0x6f2c, 0x4343, 0x6f28, - 0x6f29, 0x372d, 0x6f2b, 0x3830, 0x6f2a, 0x3e61, 0x3379, 0x6f30, - 0x3a3f, 0x4179, 0x444a, 0x333b, 0x6f2e, 0x6f2f, 0x4443, 0x6f2d, - 0x6f31, 0x6f37, 0x6f3a, 0x6f39, 0x452d, 0x6f32, 0x6f33, 0x6f36, - 0x6f38, 0x3640, 0x6f3b, 0x6f35, 0x6f34, 0x6f3f, 0x6f40, 0x6f41, - 0x6f3e, 0x6f3d, 0x3e62, 0x462a, 0x6f3c, 0x6f45, 0x6f43, 0x6f44, - 0x6f42, 0x4278, 0x6f46, 0x6f47, 0x6f49, 0x3455, 0x6f48, 0x4c7a, - 0x6f54, 0x6f4a, 0x6f4d, 0x6f4b, 0x6f4c, 0x6f4e, 0x6f50, 0x6f51, - 0x6f52, 0x6f55, 0x6f53, 0x6f56, 0x6f58, 0x6f57, 0x4439, 0x4c67, - 0x6f59, 0x412e, 0x6f5a, 0x4a44, 0x6f5b, 0x332b, 0x313c, 0x3457, - 0x3456, 0x6f5c, 0x6f5d, 0x6f5e, 0x6f5f, 0x6f60, 0x3458, 0x3355, - 0x395e, 0x4836, 0x6f62, 0x6f61, 0x6f63, 0x315c, 0x6f66, 0x6f65, - 0x6f64, 0x6f67, 0x6f6a, 0x3047, 0x6f68, 0x6f6c, 0x6f6b, 0x6f6e, - 0x6f6d, 0x6f6f, 0x462e, 0x6f70, 0x6f71, 0x6f73, 0x6f72, 0x496c, - 0x6f74, 0x6f75, 0x3a65, 0x6f76, 0x6f77, 0x4b49, 0x414b, 0x3024, - 0x424b, 0x6f78, 0x496d, 0x6f7b, 0x6f79, 0x395f, 0x6f7a, 0x3842, - 0x4a45, 0x6f7d, 0x7021, 0x6f7e, 0x7022, 0x3121, 0x3f58, 0x3d7c, - 0x3459, 0x7023, 0x4766, 0x7025, 0x3122, 0x7024, 0x4444, 0x4e4d, - 0x462b, 0x6f7c, 0x4e26, 0x3831, 0x4d5b, 0x3679, 0x4e34, 0x3728, - 0x4262, 0x6721, 0x7026, 0x332c, 0x3f6f, 0x3356, 0x7028, 0x7029, - 0x7027, 0x3764, 0x3a5d, 0x3e63, 0x3123, 0x4e59, 0x702b, 0x6e2e, - 0x702a, 0x702e, 0x702c, 0x702d, 0x702f, 0x7030, 0x4e6c, 0x7031, - 0x7032, 0x4049, 0x483b, 0x3f7d, 0x3467, 0x4d3a, 0x326d, 0x3d38, - 0x385b, 0x7035, 0x7034, 0x3b73, 0x7036, 0x7033, 0x3b28, 0x703a, - 0x6a2d, 0x5256, 0x3f77, 0x7038, 0x4e25, 0x4671, 0x312b, 0x4063, - 0x3c36, 0x4a37, 0x3140, 0x4e6d, 0x4d6b, 0x703b, 0x4545, 0x3c7b, - 0x703c, 0x703d, 0x3f4c, 0x703e, 0x4e6e, 0x7039, 0x7040, 0x7042, - 0x7041, 0x703f, 0x7043, 0x7044, 0x417a, 0x3262, 0x7045, 0x4c38, - 0x7046, 0x7047, 0x4f2a, 0x5b31, 0x7048, 0x7049, 0x704a, 0x704e, - 0x704b, 0x704c, 0x704d, 0x704f, 0x4044, 0x4c77, 0x4045, 0x7050, - 0x4873, 0x7051, 0x7353, 0x4c4c, 0x7052, 0x7053, 0x7054, 0x3357, - 0x7056, 0x3f59, 0x7057, 0x3724, 0x7058, 0x705c, 0x705a, 0x705b, - 0x3373, 0x7059, 0x705d, 0x705e, 0x3048, 0x705f, 0x7060, 0x3e64, - 0x7061, 0x3547, 0x7064, 0x7063, 0x7062, 0x6b71, 0x4a5c, 0x7065, - 0x7066, 0x7067, 0x7068, 0x7069, 0x706a, 0x345a, 0x706b, 0x706c, - 0x4723, 0x706e, 0x323b, 0x7071, 0x7070, 0x3124, 0x3641, 0x4a47, - 0x443a, 0x3a22, 0x3960, 0x3d67, 0x3f5c, 0x7073, 0x7072, 0x4d42, - 0x3468, 0x4852, 0x465c, 0x3f7c, 0x4e4e, 0x375b, 0x7076, 0x7075, - 0x4b4b, 0x462c, 0x3150, 0x7077, 0x7074, 0x4951, 0x4d6a, 0x7078, - 0x7079, 0x707b, 0x426a, 0x335b, 0x335c, 0x707a, 0x3469, 0x3832, - 0x346a, 0x453f, 0x4e60, 0x385c, 0x707c, 0x707d, 0x707e, 0x7121, - 0x7123, 0x7122, 0x4977, 0x7124, 0x7125, 0x7126, 0x7127, 0x7129, - 0x7128, 0x712a, 0x4874, 0x664c, 0x3f29, 0x3532, 0x712b, 0x712c, - 0x522c, 0x5d3b, 0x4853, 0x307b, 0x303b, 0x3b74, 0x4b30, 0x3e7e, - 0x712d, 0x4c5f, 0x712e, 0x4d5c, 0x3142, 0x3b41, 0x712f, 0x326e, - 0x7130, 0x7131, 0x7133, 0x7134, 0x7136, 0x7132, 0x7135, 0x345b, - 0x7137, 0x7138, 0x7139, 0x713a, 0x713b, 0x713d, 0x713c, 0x713f, - 0x7142, 0x713e, 0x7140, 0x7141, 0x7143, 0x3642, 0x3c73, 0x7144, - 0x7145, 0x3961, 0x7146, 0x333e, 0x474f, 0x7147, 0x7148, 0x435a, - 0x466b, 0x7149, 0x477d, 0x424c, 0x3158, 0x366e, 0x366f, 0x4373, - 0x714e, 0x3670, 0x326f, 0x714d, 0x714b, 0x714c, 0x714a, 0x7158, - 0x714f, 0x7150, 0x7151, 0x7152, 0x7154, 0x7153, 0x3d59, 0x7155, - 0x7157, 0x3533, 0x7156, 0x417b, 0x3833, 0x7159, 0x424d, 0x715a, - 0x462d, 0x715b, 0x7160, 0x715e, 0x715d, 0x715f, 0x715c, 0x7162, - 0x7161, 0x7164, 0x3643, 0x7163, 0x7165, 0x7166, 0x7168, 0x7167, - 0x7169, 0x716b, 0x716a, 0x397c, 0x716c, 0x716d, 0x333c, 0x716e, - 0x716f, 0x3f71, 0x7170, 0x7171, 0x7172, 0x7173, 0x3962, 0x7174, - 0x7175, 0x7176, 0x7177, 0x7178, 0x4831, 0x717a, 0x4926, 0x717b, - 0x7179, 0x717d, 0x717c, 0x717e, 0x7221, 0x7222, 0x7223, 0x7224, - 0x7225, 0x7226, 0x7227, 0x7228, 0x7229, 0x722a, 0x722b, 0x722c, - 0x722d, 0x722e, 0x5d35, 0x722f, 0x6478, 0x3534, 0x3321, 0x3a32, - 0x7231, 0x7230, 0x4c25, 0x7233, 0x7234, 0x7232, 0x7235, 0x4b62, - 0x7236, 0x357b, 0x4f25, 0x7237, 0x7239, 0x303e, 0x723a, 0x4a2b, - 0x7238, 0x723b, 0x723c, 0x723d, 0x723e, 0x723f, 0x4b6e, 0x3b2d, - 0x3a7a, 0x412f, 0x7240, 0x7243, 0x7241, 0x7244, 0x3871, 0x7242, - 0x7245, 0x7246, 0x7247, 0x724b, 0x3b2a, 0x4264, 0x724c, 0x7249, - 0x7248, 0x724a, 0x375f, 0x7250, 0x724f, 0x724e, 0x3033, 0x725a, - 0x7256, 0x7257, 0x7253, 0x7259, 0x7255, 0x3362, 0x4f4c, 0x7258, - 0x7254, 0x7252, 0x7251, 0x725c, 0x725f, 0x725e, 0x725d, 0x4949, - 0x725b, 0x3073, 0x7260, 0x7262, 0x336f, 0x724d, 0x3137, 0x7264, - 0x7263, 0x7261, 0x432d, 0x4b70, 0x4e5a, 0x7265, 0x7266, 0x7267, - 0x7268, 0x7269, 0x443b, 0x726a, 0x4837, 0x726f, 0x726b, 0x726c, - 0x4b31, 0x4c44, 0x4650, 0x7270, 0x7271, 0x463e, 0x726e, 0x726d, - 0x322a, 0x7279, 0x7278, 0x3175, 0x7276, 0x7275, 0x7273, 0x337b, - 0x7272, 0x3c32, 0x3229, 0x3963, 0x727c, 0x727b, 0x727a, 0x7277, - 0x727d, 0x727e, 0x7325, 0x7324, 0x7326, 0x312d, 0x7321, 0x7322, - 0x3974, 0x4c39, 0x7323, 0x4b32, 0x732b, 0x7327, 0x732c, 0x7329, - 0x7328, 0x375c, 0x732d, 0x732e, 0x732f, 0x732a, 0x7274, 0x7330, - 0x4461, 0x7334, 0x7335, 0x7333, 0x7332, 0x7338, 0x7331, 0x7336, - 0x7337, 0x733a, 0x7339, 0x733c, 0x733d, 0x733e, 0x4f49, 0x733b, - 0x426b, 0x3a6d, 0x733f, 0x7340, 0x7341, 0x7342, 0x7343, 0x3834, - 0x7344, 0x7345, 0x3c2f, 0x7346, 0x7347, 0x7348, 0x7349, 0x734c, - 0x734a, 0x4f3c, 0x734b, 0x4e6f, 0x734d, 0x4e5b, 0x734e, 0x477e, - 0x734f, 0x7351, 0x7352, 0x7350, 0x396d, 0x4c4d, 0x4b63, 0x5677, - 0x5d60, 0x4b7b, 0x322b, 0x7354, 0x3550, 0x7355, 0x7356, 0x7357, - 0x3975, 0x7358, 0x6054, 0x4c5b, 0x4263, 0x7359, 0x735b, 0x735a, - 0x735c, 0x735d, 0x735e, 0x735f, 0x7360, 0x7361, 0x7362, 0x7363, - 0x7364, 0x7365, 0x7366, 0x7367, 0x7368, 0x4524, 0x385d, 0x736a, - 0x414d, 0x736b, 0x736c, 0x4921, 0x736d, 0x736e, 0x6337, 0x6c5a, - 0x706d, 0x736f, 0x7370, 0x7372, 0x7373, 0x7374, 0x4e70, 0x7371, - 0x7375, 0x7376, 0x7378, 0x7377, 0x737a, 0x737b, 0x7379, 0x4e36, - 0x737c, 0x737d, 0x6354, 0x737e, 0x212a, 0x2174, 0x2170, 0x2173, - 0x2175, 0x214a, 0x214b, 0x2176, 0x215c, 0x2124, 0x2125, 0x213f, - 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337, - 0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129, - 0x2177, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347, - 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f, - 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357, - 0x2358, 0x2359, 0x235a, 0x214e, 0x214f, 0x2130, 0x2132, 0x212e, - 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367, 0x2368, - 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, 0x236f, 0x2370, - 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377, 0x2378, - 0x2379, 0x237a, 0x2150, 0x2143, 0x2151, 0x2131, 0x216f, -}; - -static const Summary16 jisx0208_uni2indx_page00[16] = { - /* 0x0000 */ - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x1000 }, { 1, 0x0000 }, { 1, 0x0000 }, - { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x118c }, { 6, 0x0053 }, - { 10, 0x0000 }, { 10, 0x0080 }, { 11, 0x0000 }, { 11, 0x0080 }, -}; -static const Summary16 jisx0208_uni2indx_page03[22] = { - /* 0x0300 */ - { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, - { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, - { 12, 0x0000 }, { 12, 0xfffe }, { 27, 0x03fb }, { 36, 0xfffe }, - { 51, 0x03fb }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, - /* 0x0400 */ - { 60, 0x0002 }, { 61, 0xffff }, { 77, 0xffff }, { 93, 0xffff }, - { 109, 0xffff }, { 125, 0x0002 }, -}; -static const Summary16 jisx0208_uni2indx_page20[50] = { - /* 0x2000 */ - { 126, 0x0000 }, { 126, 0x3361 }, { 133, 0x0063 }, { 137, 0x080d }, - { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, - { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, - { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, - /* 0x2100 */ - { 141, 0x0008 }, { 142, 0x0000 }, { 142, 0x0800 }, { 143, 0x0000 }, - { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, - { 143, 0x0000 }, { 143, 0x000f }, { 147, 0x0000 }, { 147, 0x0000 }, - { 147, 0x0000 }, { 147, 0x0014 }, { 149, 0x0000 }, { 149, 0x0000 }, - /* 0x2200 */ - { 149, 0x098d }, { 155, 0x6404 }, { 159, 0x1f81 }, { 166, 0x2030 }, - { 169, 0x0000 }, { 169, 0x0004 }, { 170, 0x0cc3 }, { 176, 0x0000 }, - { 176, 0x00cc }, { 180, 0x0000 }, { 180, 0x0020 }, { 181, 0x0000 }, - { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, - /* 0x2300 */ - { 181, 0x0000 }, { 181, 0x0004 }, -}; -static const Summary16 jisx0208_uni2indx_page25[23] = { - /* 0x2500 */ - { 182, 0x900f }, { 188, 0x3999 }, { 196, 0x9939 }, { 204, 0x9999 }, - { 212, 0x0804 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0000 }, - { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0003 }, { 216, 0x300c }, - { 220, 0xc8c0 }, { 225, 0x0000 }, { 225, 0x8000 }, { 226, 0x0000 }, - /* 0x2600 */ - { 226, 0x0060 }, { 228, 0x0000 }, { 228, 0x0000 }, { 228, 0x0000 }, - { 228, 0x0005 }, { 230, 0x0000 }, { 230, 0xa400 }, -}; -static const Summary16 jisx0208_uni2indx_page30[16] = { - /* 0x3000 */ - { 233, 0xffef }, { 248, 0x103f }, { 255, 0x0000 }, { 255, 0x0000 }, - { 255, 0xfffe }, { 270, 0xffff }, { 286, 0xffff }, { 302, 0xffff }, - { 318, 0xffff }, { 334, 0x780f }, { 342, 0xfffe }, { 357, 0xffff }, - { 373, 0xffff }, { 389, 0xffff }, { 405, 0xffff }, { 421, 0x787f }, -}; -static const Summary16 jisx0208_uni2indx_page4e[1307] = { - /* 0x4e00 */ - { 432, 0x6f8b }, { 442, 0x43f3 }, { 451, 0x2442 }, { 455, 0x9b46 }, - { 463, 0xe82c }, { 470, 0xe3e0 }, { 478, 0x0004 }, { 479, 0x400a }, - { 482, 0x5f65 }, { 492, 0xdb36 }, { 502, 0x7977 }, { 513, 0x0449 }, - { 517, 0xecd7 }, { 528, 0xe3f0 }, { 537, 0x6038 }, { 542, 0x08c5 }, - /* 0x4f00 */ - { 547, 0xe602 }, { 553, 0x3403 }, { 558, 0x8000 }, { 559, 0x3551 }, - { 566, 0xe0c8 }, { 572, 0x7eab }, { 583, 0x8200 }, { 585, 0x9869 }, - { 592, 0xa948 }, { 598, 0x2942 }, { 603, 0xe803 }, { 609, 0x8060 }, - { 612, 0x441c }, { 617, 0xad93 }, { 626, 0xc03a }, { 632, 0x4568 }, - /* 0x5000 */ - { 638, 0xaa60 }, { 644, 0x8656 }, { 651, 0x3f7a }, { 662, 0x0240 }, - { 664, 0x8388 }, { 669, 0x1461 }, { 674, 0x1020 }, { 676, 0x2174 }, - { 682, 0x2021 }, { 685, 0x0702 }, { 689, 0x3000 }, { 691, 0x40bc }, - { 697, 0xa624 }, { 703, 0x4462 }, { 708, 0x60a8 }, { 713, 0x0a20 }, - /* 0x5100 */ - { 716, 0x0217 }, { 721, 0x8574 }, { 728, 0x0402 }, { 730, 0x9c84 }, - { 736, 0x7bfb }, { 749, 0x1415 }, { 754, 0x7f24 }, { 763, 0x11e2 }, - { 769, 0xb665 }, { 778, 0x02ef }, { 786, 0x1f75 }, { 796, 0x20ff }, - { 805, 0x3a70 }, { 812, 0x3840 }, { 816, 0x26c3 }, { 823, 0x6763 }, - /* 0x5200 */ - { 832, 0x4dd9 }, { 841, 0x2092 }, { 845, 0x46b0 }, { 851, 0x0fc9 }, - { 859, 0xbc98 }, { 867, 0x4850 }, { 871, 0x8638 }, { 877, 0xa03f }, - { 885, 0x2388 }, { 890, 0x8816 }, { 895, 0x3e09 }, { 902, 0x5232 }, - { 908, 0x22aa }, { 914, 0xe3a4 }, { 922, 0x00dd }, { 928, 0xc72c }, - /* 0x5300 */ - { 936, 0xa166 }, { 943, 0x26e1 }, { 950, 0x840b }, { 955, 0x8f0a }, - { 962, 0x27eb }, { 972, 0x559e }, { 981, 0xc241 }, { 986, 0x89bb }, - { 995, 0x0014 }, { 997, 0x8540 }, { 1001, 0x6361 }, { 1008, 0x0849 }, - { 1012, 0x7f0c }, { 1021, 0x8ad0 }, { 1027, 0xff3e }, { 1040, 0x05cf }, - /* 0x5400 */ - { 1048, 0xff1a }, { 1059, 0xa803 }, { 1064, 0x7a41 }, { 1071, 0x7b40 }, - { 1078, 0x4745 }, { 1085, 0x8002 }, { 1087, 0x0500 }, { 1089, 0x38eb }, - { 1098, 0xd851 }, { 1105, 0x0005 }, { 1107, 0x9934 }, { 1114, 0x710c }, - { 1120, 0x0397 }, { 1127, 0x0100 }, { 1128, 0x6366 }, { 1136, 0x2404 }, - /* 0x5500 */ - { 1139, 0x80d0 }, { 1143, 0x0051 }, { 1146, 0xc000 }, { 1148, 0x430a }, - { 1153, 0x9071 }, { 1159, 0x30c8 }, { 1164, 0x0008 }, { 1165, 0x5800 }, - { 1168, 0x0e99 }, { 1175, 0xf700 }, { 1182, 0x5f80 }, { 1189, 0x0041 }, - { 1191, 0x00b0 }, { 1194, 0x9410 }, { 1198, 0x0018 }, { 1200, 0x6280 }, - /* 0x5600 */ - { 1204, 0x0240 }, { 1206, 0x09d0 }, { 1211, 0x8200 }, { 1213, 0x0156 }, - { 1218, 0x5004 }, { 1221, 0x0801 }, { 1223, 0x1d10 }, { 1228, 0x0510 }, - { 1231, 0x84c1 }, { 1236, 0x0010 }, { 1237, 0x4025 }, { 1241, 0x1050 }, - { 1244, 0x410f }, { 1250, 0x4d8a }, { 1257, 0x4009 }, { 1260, 0xa60d }, - /* 0x5700 */ - { 1267, 0xab19 }, { 1275, 0x914c }, { 1281, 0x21c0 }, { 1285, 0x0981 }, - { 1289, 0xc485 }, { 1295, 0x0003 }, { 1297, 0x0652 }, { 1302, 0x8000 }, - { 1303, 0x0b04 }, { 1307, 0x0008 }, { 1308, 0x041d }, { 1313, 0x0009 }, - { 1315, 0x4849 }, { 1320, 0x905c }, { 1326, 0x0009 }, { 1328, 0x1690 }, - /* 0x5800 */ - { 1333, 0x0c65 }, { 1339, 0x2220 }, { 1342, 0x8412 }, { 1346, 0x2433 }, - { 1352, 0x0c03 }, { 1356, 0x4796 }, { 1364, 0x0a04 }, { 1367, 0x4225 }, - { 1372, 0x0028 }, { 1374, 0x9088 }, { 1378, 0x4900 }, { 1381, 0x4f08 }, - { 1387, 0x14a2 }, { 1392, 0xd3aa }, { 1401, 0xd830 }, { 1407, 0x3e87 }, - /* 0x5900 */ - { 1416, 0x8604 }, { 1420, 0x1f61 }, { 1428, 0x7ea4 }, { 1437, 0x4186 }, - { 1442, 0xc390 }, { 1448, 0x05b3 }, { 1455, 0x57a5 }, { 1464, 0x2118 }, - { 1468, 0x241e }, { 1474, 0x2a48 }, { 1479, 0x1128 }, { 1483, 0x4a04 }, - { 1487, 0x0a40 }, { 1490, 0x161b }, { 1497, 0x0d60 }, { 1502, 0x8840 }, - /* 0x5a00 */ - { 1505, 0x020a }, { 1508, 0x9502 }, { 1513, 0x8221 }, { 1517, 0x1060 }, - { 1520, 0x0243 }, { 1524, 0x0400 }, { 1525, 0x1444 }, { 1529, 0x8000 }, - { 1530, 0x0000 }, { 1530, 0x0c04 }, { 1533, 0x0000 }, { 1533, 0x7000 }, - { 1536, 0x1a06 }, { 1541, 0x00c1 }, { 1544, 0x024a }, { 1548, 0x0c00 }, - /* 0x5b00 */ - { 1550, 0x1a00 }, { 1553, 0x0040 }, { 1554, 0x1404 }, { 1557, 0x4045 }, - { 1561, 0x0029 }, { 1564, 0xbdb3 }, { 1575, 0x0a78 }, { 1581, 0x052b }, - { 1587, 0xbba9 }, { 1597, 0xbfa0 }, { 1606, 0x407c }, { 1612, 0x8379 }, - { 1620, 0x12fc }, { 1628, 0xe81d }, { 1636, 0x4bf6 }, { 1646, 0xc569 }, - /* 0x5c00 */ - { 1654, 0xeff6 }, { 1667, 0x044a }, { 1671, 0x2115 }, { 1676, 0xff02 }, - { 1685, 0xed63 }, { 1695, 0x402b }, { 1700, 0xd033 }, { 1707, 0x0242 }, - { 1710, 0x1000 }, { 1711, 0x0013 }, { 1714, 0x1b02 }, { 1719, 0x59ca }, - { 1727, 0x00a0 }, { 1729, 0x0200 }, { 1730, 0xa703 }, { 1737, 0x2c41 }, - /* 0x5d00 */ - { 1742, 0x4880 }, { 1745, 0x8ff2 }, { 1755, 0x0204 }, { 1757, 0x0000 }, - { 1757, 0x5800 }, { 1760, 0x1005 }, { 1763, 0x9200 }, { 1766, 0x0048 }, - { 1768, 0x1894 }, { 1773, 0x2001 }, { 1775, 0x5004 }, { 1778, 0x3480 }, - { 1782, 0x3200 }, { 1785, 0x684c }, { 1791, 0x49ea }, { 1799, 0x68be }, - /* 0x5e00 */ - { 1808, 0x184c }, { 1813, 0x2e42 }, { 1819, 0xa820 }, { 1823, 0x21c9 }, - { 1829, 0x50b9 }, { 1836, 0x80b0 }, { 1840, 0x001e }, { 1844, 0xff7c }, - { 1857, 0x849a }, { 1863, 0x14e0 }, { 1868, 0x28c1 }, { 1873, 0x01e0 }, - { 1877, 0x870e }, { 1884, 0xac49 }, { 1891, 0x130f }, { 1898, 0xdddb }, - /* 0x5f00 */ - { 1910, 0xbe1a }, { 1919, 0x89fb }, { 1929, 0xa2e0 }, { 1935, 0x51a2 }, - { 1941, 0x5502 }, { 1946, 0x32ca }, { 1953, 0x3e46 }, { 1961, 0x928b }, - { 1968, 0x1dbf }, { 1979, 0x438f }, { 1987, 0x6703 }, { 1994, 0x3218 }, - { 1999, 0x3028 }, { 2003, 0x33c0 }, { 2009, 0x0811 }, { 2012, 0xa923 }, - /* 0x6000 */ - { 2019, 0xc000 }, { 2021, 0x3a65 }, { 2029, 0x8fe3 }, { 2039, 0x0402 }, - { 2041, 0x2c4e }, { 2048, 0x8625 }, { 2054, 0xbf3d }, { 2066, 0x00a1 }, - { 2069, 0x3a1a }, { 2076, 0x8cd4 }, { 2083, 0x06c9 }, { 2089, 0x317c }, - { 2097, 0x00e0 }, { 2100, 0x950a }, { 2106, 0x018b }, { 2111, 0x0edb }, - /* 0x6100 */ - { 2120, 0xe34b }, { 2129, 0x8c20 }, { 2133, 0x1182 }, { 2137, 0xf010 }, - { 2142, 0x7d94 }, { 2151, 0xa728 }, { 2158, 0xc9ac }, { 2166, 0x40fb }, - { 2174, 0x4484 }, { 2178, 0x0653 }, { 2184, 0x5a90 }, { 2190, 0x4444 }, - { 2194, 0x3fc8 }, { 2203, 0x0001 }, { 2204, 0x0048 }, { 2206, 0xf5d4 }, - /* 0x6200 */ - { 2216, 0x7701 }, { 2223, 0xec57 }, { 2233, 0xc442 }, { 2238, 0x891d }, - { 2245, 0x6b83 }, { 2253, 0x4928 }, { 2258, 0x4109 }, { 2262, 0xd242 }, - { 2268, 0x061d }, { 2274, 0x59fe }, { 2285, 0x1800 }, { 2287, 0x3a22 }, - { 2293, 0xb7e4 }, { 2303, 0x3b9f }, { 2314, 0xf003 }, { 2320, 0xc0ea }, - /* 0x6300 */ - { 2327, 0x1386 }, { 2333, 0x8202 }, { 2336, 0x8980 }, { 2340, 0xe400 }, - { 2344, 0xb200 }, { 2348, 0x10a1 }, { 2352, 0x4b80 }, { 2357, 0x0cc4 }, - { 2362, 0xd309 }, { 2369, 0x8944 }, { 2374, 0x1faf }, { 2385, 0x4834 }, - { 2390, 0x8259 }, { 2396, 0x0c45 }, { 2401, 0x420a }, { 2405, 0x0450 }, - /* 0x6400 */ - { 2408, 0xa040 }, { 2411, 0x10c8 }, { 2415, 0x3140 }, { 2419, 0x4450 }, - { 2423, 0x4004 }, { 2425, 0x0100 }, { 2426, 0x8280 }, { 2429, 0x0540 }, - { 2432, 0x0108 }, { 2434, 0x442c }, { 2439, 0x6a30 }, { 2445, 0x1a05 }, - { 2450, 0x20a6 }, { 2455, 0x0514 }, { 2459, 0x90cf }, { 2467, 0x6456 }, - /* 0x6500 */ - { 2474, 0x0021 }, { 2476, 0x3100 }, { 2479, 0x9c18 }, { 2485, 0xcbf0 }, - { 2494, 0xa120 }, { 2498, 0x63e2 }, { 2506, 0x104c }, { 2510, 0x01b5 }, - { 2516, 0x538c }, { 2523, 0x9a83 }, { 2530, 0xb8b2 }, { 2538, 0x3281 }, - { 2543, 0x987a }, { 2551, 0x0a84 }, { 2555, 0x33e7 }, { 2565, 0x0c02 }, - /* 0x6600 */ - { 2568, 0xd4cc }, { 2576, 0x9018 }, { 2580, 0xa1a1 }, { 2586, 0x9070 }, - { 2591, 0x8a1e }, { 2598, 0xe004 }, { 2602, 0xc3d4 }, { 2610, 0x0451 }, - { 2614, 0x439a }, { 2621, 0x21c2 }, { 2626, 0x4844 }, { 2630, 0x5310 }, - { 2635, 0x0292 }, { 2639, 0x3640 }, { 2644, 0x0241 }, { 2647, 0xf3bd }, - /* 0x6700 */ - { 2659, 0xab09 }, { 2666, 0xe8f0 }, { 2674, 0x7dc0 }, { 2682, 0xa5d2 }, - { 2690, 0xc242 }, { 2695, 0xd24b }, { 2703, 0xa43f }, { 2712, 0xd0af }, - { 2721, 0x1aa0 }, { 2726, 0x34a1 }, { 2732, 0x8247 }, { 2738, 0x03d8 }, - { 2744, 0xc452 }, { 2750, 0x651b }, { 2758, 0xd294 }, { 2765, 0xc83a }, - /* 0x6800 */ - { 2772, 0x001c }, { 2775, 0x40c8 }, { 2779, 0x0e06 }, { 2784, 0x3314 }, - { 2790, 0x614f }, { 2798, 0xb21b }, { 2806, 0x0088 }, { 2808, 0xc0d0 }, - { 2813, 0xa02a }, { 2818, 0xa898 }, { 2824, 0xa1c5 }, { 2831, 0x166b }, - { 2839, 0x2e50 }, { 2845, 0x85b4 }, { 2852, 0xc08b }, { 2858, 0x0604 }, - /* 0x6900 */ - { 2861, 0xf933 }, { 2871, 0x1e04 }, { 2876, 0x056e }, { 2883, 0xa251 }, - { 2889, 0x0400 }, { 2890, 0x7638 }, { 2898, 0xec07 }, { 2906, 0x73b8 }, - { 2915, 0x4406 }, { 2919, 0x1832 }, { 2924, 0x4081 }, { 2927, 0xc816 }, - { 2933, 0x7c8a }, { 2941, 0x6309 }, { 2947, 0x2980 }, { 2951, 0xaa04 }, - /* 0x6a00 */ - { 2956, 0x1c24 }, { 2961, 0xca9c }, { 2969, 0x4e0e }, { 2976, 0x2760 }, - { 2982, 0x0990 }, { 2986, 0x8300 }, { 2989, 0x0046 }, { 2992, 0x8104 }, - { 2995, 0x6011 }, { 2999, 0x1081 }, { 3002, 0x540d }, { 3008, 0x0908 }, - { 3011, 0x000e }, { 3014, 0xcc0a }, { 3020, 0x0500 }, { 3022, 0x0c00 }, - /* 0x6b00 */ - { 3024, 0x0430 }, { 3027, 0xa044 }, { 3031, 0x008b }, { 3035, 0x6784 }, - { 3042, 0x5288 }, { 3047, 0x8a19 }, { 3053, 0x865e }, { 3061, 0x8b18 }, - { 3067, 0x2e59 }, { 3075, 0x4160 }, { 3079, 0x8c10 }, { 3083, 0x9cbe }, - { 3093, 0x6861 }, { 3099, 0x891c }, { 3105, 0x9800 }, { 3108, 0x0008 }, - /* 0x6c00 */ - { 3109, 0x8100 }, { 3111, 0x089a }, { 3116, 0x0018 }, { 3118, 0x4190 }, - { 3122, 0x4007 }, { 3126, 0xe4a1 }, { 3133, 0x0505 }, { 3137, 0x640d }, - { 3143, 0x310e }, { 3149, 0x0e4d }, { 3156, 0x4806 }, { 3160, 0xff0a }, - { 3170, 0x1632 }, { 3176, 0x2aa8 }, { 3182, 0x852e }, { 3189, 0x000b }, - /* 0x6d00 */ - { 3192, 0x1800 }, { 3194, 0xca84 }, { 3200, 0x0e20 }, { 3204, 0x696c }, - { 3212, 0x0032 }, { 3215, 0x1600 }, { 3218, 0x5658 }, { 3225, 0x0390 }, - { 3229, 0x5120 }, { 3233, 0x1a28 }, { 3238, 0x8000 }, { 3239, 0x1124 }, - { 3243, 0x18e1 }, { 3249, 0x4326 }, { 3255, 0x5d52 }, { 3263, 0x0eaa }, - /* 0x6e00 */ - { 3270, 0x0fa0 }, { 3276, 0xae28 }, { 3283, 0xfa7b }, { 3295, 0x4500 }, - { 3298, 0x6408 }, { 3302, 0x8940 }, { 3306, 0xc880 }, { 3310, 0xc044 }, - { 3314, 0x9005 }, { 3318, 0xb141 }, { 3324, 0x8424 }, { 3328, 0x24c4 }, - { 3333, 0x1a34 }, { 3339, 0x603a }, { 3345, 0x9000 }, { 3347, 0xc194 }, - /* 0x6f00 */ - { 3353, 0x8246 }, { 3358, 0x003a }, { 3362, 0x180d }, { 3367, 0xc106 }, - { 3372, 0x0022 }, { 3374, 0x9910 }, { 3379, 0xe050 }, { 3384, 0x1511 }, - { 3389, 0x4057 }, { 3395, 0x0082 }, { 3397, 0x041a }, { 3401, 0x020a }, - { 3404, 0x004f }, { 3409, 0x8930 }, { 3414, 0xd813 }, { 3421, 0x444a }, - /* 0x7000 */ - { 3426, 0x8a02 }, { 3430, 0xed22 }, { 3438, 0x10c0 }, { 3441, 0x4005 }, - { 3444, 0x1000 }, { 3445, 0x0102 }, { 3447, 0x8808 }, { 3450, 0x3101 }, - { 3454, 0x4600 }, { 3457, 0x0204 }, { 3459, 0xf000 }, { 3463, 0x0708 }, - { 3467, 0x8900 }, { 3470, 0xa200 }, { 3473, 0x0000 }, { 3473, 0x2202 }, - /* 0x7100 */ - { 3476, 0x0200 }, { 3477, 0x1610 }, { 3481, 0x0042 }, { 3483, 0x1040 }, - { 3485, 0x5200 }, { 3488, 0x0260 }, { 3491, 0x52f4 }, { 3499, 0x2000 }, - { 3500, 0x8510 }, { 3504, 0x8230 }, { 3508, 0x1100 }, { 3510, 0x4202 }, - { 3513, 0x4308 }, { 3517, 0x80b5 }, { 3523, 0x70e1 }, { 3530, 0x9a20 }, - /* 0x7200 */ - { 3535, 0x2040 }, { 3537, 0x0801 }, { 3539, 0x3500 }, { 3543, 0xfc65 }, - { 3553, 0x19c1 }, { 3559, 0xab04 }, { 3565, 0x0286 }, { 3569, 0x6214 }, - { 3574, 0x0087 }, { 3578, 0x0044 }, { 3580, 0x9085 }, { 3585, 0x0244 }, - { 3588, 0x405c }, { 3593, 0x0a85 }, { 3598, 0x3207 }, { 3604, 0x3380 }, - /* 0x7300 */ - { 3609, 0x0400 }, { 3610, 0xb8c0 }, { 3616, 0xce20 }, { 3622, 0xc0d0 }, - { 3627, 0xc030 }, { 3631, 0x0080 }, { 3632, 0x0508 }, { 3635, 0x0d25 }, - { 3641, 0x0a90 }, { 3645, 0x0040 }, { 3646, 0x0200 }, { 3647, 0x080c }, - { 3650, 0x6505 }, { 3656, 0x4000 }, { 3657, 0x6421 }, { 3662, 0x4102 }, - /* 0x7400 */ - { 3665, 0x0268 }, { 3669, 0x0000 }, { 3669, 0x0024 }, { 3671, 0x847c }, - { 3678, 0x0002 }, { 3679, 0xde20 }, { 3686, 0x8619 }, { 3692, 0x4049 }, - { 3696, 0x0808 }, { 3698, 0x4000 }, { 3699, 0x0084 }, { 3701, 0x2001 }, - { 3703, 0x8400 }, { 3705, 0x1010 }, { 3707, 0x42cd }, { 3714, 0x01c7 }, - /* 0x7500 */ - { 3720, 0x7038 }, { 3726, 0xd52a }, { 3734, 0x1968 }, { 3740, 0x1d8f }, - { 3749, 0xbe50 }, { 3757, 0x3e12 }, { 3764, 0x2ef5 }, { 3774, 0x81d9 }, - { 3781, 0xcec4 }, { 3789, 0x2412 }, { 3793, 0x0828 }, { 3796, 0x732e }, - { 3805, 0x24ac }, { 3811, 0x4b34 }, { 3818, 0x020c }, { 3821, 0xd41d }, - /* 0x7600 */ - { 3829, 0x2a02 }, { 3833, 0x8000 }, { 3834, 0x0097 }, { 3839, 0x0811 }, - { 3842, 0x11c4 }, { 3847, 0x1144 }, { 3851, 0x1786 }, { 3858, 0x7d45 }, - { 3867, 0x49d9 }, { 3875, 0x0649 }, { 3880, 0x4000 }, { 3881, 0x8791 }, - { 3888, 0x254c }, { 3894, 0xd8c4 }, { 3901, 0x44ba }, { 3908, 0x4914 }, - /* 0x7700 */ - { 3913, 0x1b92 }, { 3920, 0xc800 }, { 3923, 0x0271 }, { 3928, 0x1580 }, - { 3932, 0x0081 }, { 3934, 0x0c00 }, { 3936, 0x096a }, { 3942, 0xc200 }, - { 3945, 0x4800 }, { 3947, 0x4002 }, { 3949, 0x3021 }, { 3953, 0xba49 }, - { 3961, 0x2080 }, { 3963, 0x1c80 }, { 3967, 0xe2ac }, { 3975, 0x1008 }, - /* 0x7800 */ - { 3977, 0x1004 }, { 3979, 0x0034 }, { 3982, 0x00e1 }, { 3986, 0x8414 }, - { 3990, 0x0020 }, { 3991, 0x2000 }, { 3992, 0x9800 }, { 3995, 0x1014 }, - { 3998, 0x70c2 }, { 4004, 0x04aa }, { 4009, 0x8688 }, { 4014, 0x5420 }, - { 4018, 0x0c62 }, { 4023, 0x0413 }, { 4027, 0x9180 }, { 4031, 0x2010 }, - /* 0x7900 */ - { 4033, 0x4082 }, { 4036, 0x0206 }, { 4039, 0x1c40 }, { 4043, 0x5400 }, - { 4046, 0x0383 }, { 4051, 0xe4e9 }, { 4060, 0x2125 }, { 4065, 0x8480 }, - { 4068, 0xe433 }, { 4076, 0x2000 }, { 4077, 0x44c0 }, { 4081, 0xe609 }, - { 4088, 0x0a03 }, { 4092, 0x8126 }, { 4097, 0x12da }, { 4104, 0x0801 }, - /* 0x7a00 */ - { 4106, 0x6901 }, { 4111, 0x9790 }, { 4118, 0x4001 }, { 4120, 0xf886 }, - { 4128, 0xe24d }, { 4136, 0x0081 }, { 4138, 0x0a0e }, { 4143, 0xa651 }, - { 4150, 0x011a }, { 4154, 0x81ec }, { 4161, 0xc600 }, { 4165, 0x8441 }, - { 4169, 0xadb8 }, { 4178, 0xb62c }, { 4186, 0xa46f }, { 4195, 0x8741 }, - /* 0x7b00 */ - { 4201, 0x8d54 }, { 4208, 0x4b02 }, { 4213, 0x1161 }, { 4218, 0x0268 }, - { 4222, 0xbb60 }, { 4230, 0x2057 }, { 4236, 0x50a0 }, { 4240, 0x0433 }, - { 4245, 0xa8c0 }, { 4250, 0xb7b4 }, { 4260, 0x2402 }, { 4263, 0x0112 }, - { 4266, 0x9ad3 }, { 4275, 0x2000 }, { 4276, 0x2271 }, { 4282, 0x00c8 }, - /* 0x7c00 */ - { 4285, 0x2081 }, { 4288, 0x809e }, { 4294, 0x0c8a }, { 4299, 0xe180 }, - { 4304, 0xb009 }, { 4309, 0x8151 }, { 4314, 0x1031 }, { 4318, 0x4028 }, - { 4321, 0x2a0e }, { 4327, 0x89a5 }, { 4334, 0x69b6 }, { 4343, 0x620e }, - { 4349, 0x4425 }, { 4354, 0xd144 }, { 4360, 0x8085 }, { 4364, 0x4d54 }, - /* 0x7d00 */ - { 4371, 0x2c75 }, { 4379, 0x1fb1 }, { 4388, 0xd807 }, { 4395, 0x862d }, - { 4402, 0xd87c }, { 4411, 0x4841 }, { 4415, 0x414e }, { 4421, 0x226e }, - { 4428, 0x8200 }, { 4430, 0x9e08 }, { 4436, 0xf80c }, { 4443, 0xed37 }, - { 4454, 0x8c80 }, { 4458, 0x7526 }, { 4466, 0x9313 }, { 4473, 0x0814 }, - /* 0x7e00 */ - { 4476, 0x0e32 }, { 4482, 0xc804 }, { 4486, 0x484e }, { 4492, 0x6ea6 }, - { 4501, 0x2c4a }, { 4507, 0x6670 }, { 4514, 0x26c0 }, { 4519, 0xba01 }, - { 4525, 0xd30c }, { 4532, 0x185d }, { 4539, 0x0000 }, { 4539, 0x0000 }, - { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, - /* 0x7f00 */ - { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0540 }, - { 4542, 0x7020 }, { 4546, 0x8133 }, { 4552, 0x4f81 }, { 4559, 0x03a5 }, - { 4565, 0x55ec }, { 4574, 0x6410 }, { 4578, 0xc318 }, { 4584, 0x2344 }, - { 4589, 0x1462 }, { 4594, 0x0034 }, { 4597, 0x0a43 }, { 4602, 0x1a09 }, - /* 0x8000 */ - { 4607, 0x187b }, { 4615, 0x13a5 }, { 4622, 0x0102 }, { 4624, 0xa848 }, - { 4629, 0x0440 }, { 4631, 0xc544 }, { 4637, 0x8106 }, { 4641, 0xe2dd }, - { 4651, 0x1af0 }, { 4658, 0x2d48 }, { 4664, 0xb626 }, { 4672, 0x0416 }, - { 4676, 0x5058 }, { 4681, 0x6e40 }, { 4687, 0x8032 }, { 4691, 0x3112 }, - /* 0x8100 */ - { 4696, 0x07e4 }, { 4703, 0x0c00 }, { 4705, 0x8208 }, { 4708, 0x420a }, - { 4712, 0x4840 }, { 4715, 0x803b }, { 4721, 0x4860 }, { 4725, 0x8713 }, - { 4732, 0x850d }, { 4738, 0x3428 }, { 4743, 0x0319 }, { 4748, 0xe529 }, - { 4756, 0x2345 }, { 4762, 0x870a }, { 4768, 0x25a9 }, { 4775, 0x5c18 }, - /* 0x8200 */ - { 4781, 0x77a6 }, { 4791, 0xd9c5 }, { 4800, 0x5e00 }, { 4805, 0x03e8 }, - { 4811, 0x0081 }, { 4813, 0xa700 }, { 4818, 0xcd54 }, { 4826, 0x41c6 }, - { 4832, 0x2800 }, { 4834, 0xa204 }, { 4838, 0xb860 }, { 4844, 0x2b0a }, - { 4850, 0x0020 }, { 4851, 0xda9e }, { 4861, 0x08ea }, { 4867, 0x0e1a }, - /* 0x8300 */ - { 4873, 0x427c }, { 4880, 0x11c0 }, { 4884, 0x8908 }, { 4888, 0x0376 }, - { 4895, 0x8621 }, { 4900, 0x0105 }, { 4903, 0x0000 }, { 4903, 0x18a8 }, - { 4908, 0x46a0 }, { 4913, 0xc448 }, { 4918, 0x0d05 }, { 4923, 0x2022 }, - { 4926, 0x5422 }, { 4931, 0x9148 }, { 4936, 0x8a01 }, { 4940, 0x2897 }, - /* 0x8400 */ - { 4947, 0x7898 }, { 4954, 0x0008 }, { 4955, 0x1605 }, { 4960, 0x3122 }, - { 4965, 0x4240 }, { 4968, 0x0880 }, { 4970, 0xfa4e }, { 4980, 0x06a2 }, - { 4985, 0x0814 }, { 4988, 0x9211 }, { 4993, 0x2002 }, { 4995, 0x9b04 }, - { 5001, 0x2e52 }, { 5008, 0x0643 }, { 5013, 0x5000 }, { 5015, 0x9010 }, - /* 0x8500 */ - { 5018, 0x0041 }, { 5020, 0x85ba }, { 5028, 0x3042 }, { 5032, 0x2020 }, - { 5034, 0x4f0b }, { 5042, 0x05a0 }, { 5046, 0x2708 }, { 5051, 0x4080 }, - { 5053, 0x0591 }, { 5058, 0x1a93 }, { 5065, 0xdf50 }, { 5074, 0x0600 }, - { 5076, 0xa202 }, { 5080, 0x3021 }, { 5084, 0x0630 }, { 5088, 0x4e80 }, - /* 0x8600 */ - { 5093, 0x0cc4 }, { 5098, 0x04c8 }, { 5102, 0xa004 }, { 5105, 0x8001 }, - { 5107, 0x6000 }, { 5109, 0xd431 }, { 5116, 0x0880 }, { 5118, 0x0a02 }, - { 5121, 0x1c00 }, { 5124, 0x0028 }, { 5126, 0x8e18 }, { 5132, 0x0041 }, - { 5134, 0x6ad0 }, { 5141, 0xca10 }, { 5146, 0xf210 }, { 5152, 0x4b00 }, - /* 0x8700 */ - { 5156, 0x274d }, { 5164, 0x1506 }, { 5169, 0x0220 }, { 5171, 0x8890 }, - { 5175, 0x5a00 }, { 5179, 0x82a8 }, { 5184, 0x4549 }, { 5190, 0x8150 }, - { 5194, 0x2004 }, { 5196, 0x8000 }, { 5197, 0x8804 }, { 5200, 0x2c08 }, - { 5204, 0x08d1 }, { 5209, 0x0005 }, { 5211, 0x8001 }, { 5213, 0x4ac4 }, - /* 0x8800 */ - { 5219, 0xe020 }, { 5223, 0x0062 }, { 5226, 0x008e }, { 5230, 0x0a42 }, - { 5234, 0x3055 }, { 5240, 0x6a8c }, { 5247, 0x090e }, { 5252, 0xe0a5 }, - { 5259, 0x2906 }, { 5264, 0x42c4 }, { 5269, 0x4814 }, { 5273, 0x80b3 }, - { 5279, 0x803e }, { 5285, 0xb330 }, { 5292, 0x0102 }, { 5294, 0x731c }, - /* 0x8900 */ - { 5302, 0x1494 }, { 5307, 0x600d }, { 5312, 0x0c20 }, { 5315, 0x0940 }, - { 5318, 0x301a }, { 5323, 0xc040 }, { 5326, 0xa451 }, { 5332, 0xc094 }, - { 5337, 0x8dca }, { 5345, 0x05c8 }, { 5350, 0x96c2 }, { 5357, 0xa40c }, - { 5362, 0x0001 }, { 5363, 0x3404 }, { 5367, 0x00c8 }, { 5370, 0x0110 }, - /* 0x8a00 */ - { 5372, 0x550d }, { 5379, 0xa9c9 }, { 5387, 0x2428 }, { 5391, 0x1c5a }, - { 5398, 0x0142 }, { 5401, 0x4837 }, { 5408, 0x7a4d }, { 5417, 0x100f }, - { 5422, 0x32b4 }, { 5429, 0x452a }, { 5435, 0x317b }, { 5444, 0x9205 }, - { 5449, 0xb894 }, { 5456, 0x5c44 }, { 5462, 0x68d7 }, { 5471, 0x458a }, - /* 0x8b00 */ - { 5477, 0x5097 }, { 5484, 0x2ed1 }, { 5492, 0x1943 }, { 5498, 0x4208 }, - { 5501, 0xd202 }, { 5506, 0x9d40 }, { 5512, 0x9840 }, { 5516, 0x2097 }, - { 5522, 0x5409 }, { 5527, 0x064d }, { 5533, 0x0000 }, { 5533, 0x0000 }, - { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, - /* 0x8c00 */ - { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x8480 }, - { 5536, 0x5542 }, { 5542, 0x0421 }, { 5545, 0x1c06 }, { 5550, 0x1700 }, - { 5554, 0x7624 }, { 5561, 0x6110 }, { 5565, 0xff87 }, { 5577, 0xb9dd }, - { 5588, 0x659f }, { 5598, 0x5c0a }, { 5604, 0x245d }, { 5611, 0x3c00 }, - /* 0x8d00 */ - { 5615, 0xadb0 }, { 5623, 0x0059 }, { 5627, 0x0000 }, { 5627, 0x0000 }, - { 5627, 0x0000 }, { 5627, 0x0000 }, { 5627, 0x28d0 }, { 5632, 0x009b }, - { 5637, 0x0422 }, { 5640, 0x0200 }, { 5641, 0x0108 }, { 5643, 0x4408 }, - { 5646, 0x9804 }, { 5650, 0xac40 }, { 5655, 0x8d0a }, { 5661, 0x9028 }, - /* 0x8e00 */ - { 5665, 0x8700 }, { 5669, 0xe001 }, { 5673, 0x0400 }, { 5674, 0x0031 }, - { 5677, 0x1794 }, { 5684, 0x8221 }, { 5688, 0x0019 }, { 5691, 0x1054 }, - { 5695, 0x2cb2 }, { 5702, 0x021a }, { 5706, 0x9c02 }, { 5711, 0x4003 }, - { 5714, 0x3d60 }, { 5721, 0x8804 }, { 5724, 0x080c }, { 5727, 0x7900 }, - /* 0x8f00 */ - { 5732, 0x1628 }, { 5737, 0xba3c }, { 5746, 0x8640 }, { 5750, 0xcb08 }, - { 5756, 0x7274 }, { 5764, 0x9080 }, { 5767, 0x001e }, { 5771, 0x0000 }, - { 5771, 0x0000 }, { 5771, 0xd800 }, { 5775, 0xe188 }, { 5781, 0x9c87 }, - { 5789, 0x4034 }, { 5793, 0x0412 }, { 5796, 0xae64 }, { 5804, 0x2791 }, - /* 0x9000 */ - { 5811, 0xe86b }, { 5820, 0xe6fb }, { 5832, 0x408f }, { 5838, 0x5366 }, - { 5846, 0xeea6 }, { 5856, 0x537f }, { 5867, 0xe32b }, { 5876, 0xb5e4 }, - { 5885, 0x869f }, { 5894, 0x0002 }, { 5895, 0x8548 }, { 5900, 0x0122 }, - { 5903, 0x4402 }, { 5906, 0x0800 }, { 5907, 0x2116 }, { 5912, 0x20a0 }, - /* 0x9100 */ - { 5915, 0x0004 }, { 5916, 0x0204 }, { 5918, 0x2000 }, { 5919, 0x0005 }, - { 5921, 0x7e00 }, { 5927, 0x0154 }, { 5931, 0x162c }, { 5937, 0x01ac }, - { 5942, 0x2a84 }, { 5947, 0x1085 }, { 5951, 0x8c14 }, { 5956, 0x0530 }, - { 5960, 0xfbc3 }, { 5971, 0xb943 }, { 5979, 0x00ca }, { 5983, 0x9060 }, - /* 0x9200 */ - { 5987, 0x6000 }, { 5989, 0x4032 }, { 5993, 0x1200 }, { 5995, 0x8090 }, - { 5998, 0x0b30 }, { 6003, 0x4c81 }, { 6008, 0x0054 }, { 6011, 0x4002 }, - { 6013, 0x0029 }, { 6016, 0x1d6a }, { 6024, 0x2000 }, { 6025, 0x0280 }, - { 6027, 0x8000 }, { 6028, 0x0004 }, { 6029, 0x2610 }, { 6033, 0x150c }, - /* 0x9300 */ - { 6038, 0x8040 }, { 6040, 0x0701 }, { 6044, 0xd94d }, { 6053, 0x0c24 }, - { 6057, 0x2810 }, { 6060, 0x1850 }, { 6064, 0x5001 }, { 6067, 0x5020 }, - { 6070, 0x1000 }, { 6071, 0x04d0 }, { 6075, 0x7080 }, { 6079, 0x0201 }, - { 6081, 0x0108 }, { 6083, 0x21c3 }, { 6089, 0x0132 }, { 6093, 0x0000 }, - /* 0x9400 */ - { 6093, 0x0088 }, { 6095, 0x0719 }, { 6101, 0x0802 }, { 6103, 0x0560 }, - { 6107, 0x0012 }, { 6109, 0x4c0e }, { 6115, 0x0405 }, { 6118, 0xf0a1 }, - { 6125, 0x0002 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, - { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, - /* 0x9500 */ - { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, - { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0080 }, - { 6127, 0x8e8d }, { 6135, 0x035a }, { 6141, 0x21bd }, { 6149, 0x5a04 }, - { 6154, 0x3488 }, { 6159, 0x1170 }, { 6164, 0x0026 }, { 6167, 0x0000 }, - /* 0x9600 */ - { 6167, 0x0000 }, { 6167, 0x1000 }, { 6168, 0xc502 }, { 6173, 0x8804 }, - { 6176, 0xb815 }, { 6183, 0xf801 }, { 6189, 0x147c }, { 6196, 0x25ed }, - { 6205, 0xed60 }, { 6213, 0x1bb0 }, { 6220, 0x0589 }, { 6225, 0x1bd7 }, - { 6235, 0x7af3 }, { 6246, 0x1a62 }, { 6252, 0x0d0c }, { 6257, 0x0ac5 }, - /* 0x9700 */ - { 6263, 0xe5d1 }, { 6272, 0x524a }, { 6278, 0x0490 }, { 6281, 0x6305 }, - { 6287, 0x0354 }, { 6292, 0x5244 }, { 6297, 0x2b57 }, { 6306, 0x1612 }, - { 6311, 0xa872 }, { 6318, 0x1101 }, { 6321, 0x2949 }, { 6327, 0x0018 }, - { 6329, 0x0948 }, { 6333, 0x1008 }, { 6335, 0x6000 }, { 6337, 0x886c }, - /* 0x9800 */ - { 6343, 0x916e }, { 6351, 0x058f }, { 6358, 0x3012 }, { 6362, 0x3990 }, - { 6368, 0xf840 }, { 6374, 0x4930 }, { 6379, 0x8880 }, { 6382, 0x001b }, - { 6386, 0x0000 }, { 6386, 0x0000 }, { 6386, 0x8500 }, { 6389, 0x0042 }, - { 6391, 0x0058 }, { 6394, 0x9800 }, { 6397, 0xea04 }, { 6403, 0x7014 }, - /* 0x9900 */ - { 6408, 0x1628 }, { 6413, 0x611d }, { 6420, 0x5113 }, { 6426, 0x6000 }, - { 6428, 0x1a24 }, { 6433, 0x00a7 }, { 6438, 0x0000 }, { 6438, 0x0000 }, - { 6438, 0x0000 }, { 6438, 0x03c0 }, { 6442, 0x7120 }, { 6447, 0x1018 }, - { 6450, 0x0172 }, { 6455, 0xa927 }, { 6463, 0x6004 }, { 6466, 0x8906 }, - /* 0x9a00 */ - { 6471, 0xc022 }, { 6475, 0x020c }, { 6478, 0x0900 }, { 6480, 0x4081 }, - { 6483, 0x202d }, { 6488, 0x8ca0 }, { 6493, 0x0e34 }, { 6499, 0x0000 }, - { 6499, 0x0000 }, { 6499, 0x0000 }, { 6499, 0x2100 }, { 6501, 0x1101 }, - { 6504, 0x8011 }, { 6507, 0xc11a }, { 6513, 0xec4c }, { 6521, 0x0892 }, - /* 0x9b00 */ - { 6525, 0x0040 }, { 6526, 0x8500 }, { 6529, 0xc7ac }, { 6538, 0x1806 }, - { 6542, 0xe03e }, { 6550, 0x0512 }, { 6554, 0x8000 }, { 6555, 0x0010 }, - { 6556, 0x4008 }, { 6558, 0x80ce }, { 6564, 0x6d01 }, { 6570, 0x0210 }, - { 6572, 0x8641 }, { 6577, 0x0856 }, { 6582, 0x011e }, { 6587, 0x0027 }, - /* 0x9c00 */ - { 6591, 0x3750 }, { 6598, 0x083d }, { 6604, 0xe032 }, { 6610, 0x4e05 }, - { 6616, 0x01c0 }, { 6619, 0x0484 }, { 6622, 0x0081 }, { 6624, 0x0140 }, - { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, - { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x1aa0 }, { 6631, 0x0059 }, - /* 0x9d00 */ - { 6635, 0x43c8 }, { 6641, 0x8824 }, { 6645, 0x1d48 }, { 6651, 0xc800 }, - { 6654, 0x0152 }, { 6658, 0x7203 }, { 6664, 0x9013 }, { 6669, 0x0404 }, - { 6671, 0x8280 }, { 6674, 0x0400 }, { 6675, 0x8a10 }, { 6679, 0x0d14 }, - { 6684, 0x8056 }, { 6689, 0x0208 }, { 6691, 0xa040 }, { 6694, 0x2704 }, - /* 0x9e00 */ - { 6699, 0x0000 }, { 6699, 0x4c00 }, { 6702, 0x0000 }, { 6702, 0x0000 }, - { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0xa320 }, - { 6707, 0x1902 }, { 6711, 0xa0ae }, { 6718, 0x2660 }, { 6723, 0xdf00 }, - { 6730, 0xf010 }, { 6735, 0x7b15 }, { 6744, 0x8121 }, { 6748, 0x3ad0 }, - /* 0x9f00 */ - { 6755, 0x4180 }, { 6758, 0x0028 }, { 6760, 0x1003 }, { 6763, 0x4800 }, - { 6765, 0xcc00 }, { 6769, 0x8014 }, { 6772, 0x14cf }, { 6780, 0x00c4 }, - { 6783, 0x2000 }, { 6784, 0x3020 }, { 6787, 0x0001 }, -}; -static const Summary16 jisx0208_uni2indx_pageff[15] = { - /* 0xff00 */ - { 6788, 0xdf7a }, { 6800, 0xffff }, { 6816, 0xffff }, { 6832, 0xefff }, - { 6847, 0xffff }, { 6863, 0x3fff }, { 6877, 0x0000 }, { 6877, 0x0000 }, - { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, - { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0028 }, -}; - -static int -jisx0208_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - const Summary16 *summary = NULL; - if (wc < 0x0100) - summary = &jisx0208_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x0300 && wc < 0x0460) - summary = &jisx0208_uni2indx_page03[(wc>>4)-0x030]; - else if (wc >= 0x2000 && wc < 0x2320) - summary = &jisx0208_uni2indx_page20[(wc>>4)-0x200]; - else if (wc >= 0x2500 && wc < 0x2670) - summary = &jisx0208_uni2indx_page25[(wc>>4)-0x250]; - else if (wc >= 0x3000 && wc < 0x3100) - summary = &jisx0208_uni2indx_page30[(wc>>4)-0x300]; - else if (wc >= 0x4e00 && wc < 0x9fb0) - summary = &jisx0208_uni2indx_page4e[(wc>>4)-0x4e0]; - else if (wc >= 0xff00 && wc < 0xfff0) - summary = &jisx0208_uni2indx_pageff[(wc>>4)-0xff0]; - if (summary) { - unsigned short used = summary->used; - unsigned int i = wc & 0x0f; - if (used & ((unsigned short) 1 << i)) { - unsigned short c; - /* Keep in `used' only the bits 0..i-1. */ - used &= ((unsigned short) 1 << i) - 1; - /* Add `summary->indx' and the number of bits set in `used'. */ - used = (used & 0x5555) + ((used & 0xaaaa) >> 1); - used = (used & 0x3333) + ((used & 0xcccc) >> 2); - used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); - used = (used & 0x00ff) + (used >> 8); - c = jisx0208_2charset[summary->indx + used]; - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/jisx0212.h b/nx-X11/lib/X11/lcUniConv/jisx0212.h deleted file mode 100644 index 05cca5203..000000000 --- a/nx-X11/lib/X11/lcUniConv/jisx0212.h +++ /dev/null @@ -1,2163 +0,0 @@ - -/* - * JISX0212.1990-0 - */ - -static const unsigned short jisx0212_2uni_page22[81] = { - /* 0x22 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x02d8, 0x02c7, - 0x00b8, 0x02d9, 0x02dd, 0x00af, 0x02db, 0x02da, 0x007e, 0x0384, - 0x0385, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0x00a1, 0x00a6, 0x00bf, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0x00ba, 0x00aa, 0x00a9, 0x00ae, 0x2122, 0x00a4, - 0x2116, -}; -static const unsigned short jisx0212_2uni_page26[188] = { - /* 0x26 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0xfffd, 0x038c, 0xfffd, - 0x038e, 0x03ab, 0xfffd, 0x038f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, 0x03c2, - 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0xfffd, 0xfffd, - /* 0x27 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, - 0x0409, 0x040a, 0x040b, 0x040c, 0x040e, 0x040f, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, - 0x0459, 0x045a, 0x045b, 0x045c, 0x045e, 0x045f, -}; -static const unsigned short jisx0212_2uni_page29[275] = { - /* 0x29 */ - 0x00c6, 0x0110, 0xfffd, 0x0126, 0xfffd, 0x0132, 0xfffd, 0x0141, - 0x013f, 0xfffd, 0x014a, 0x00d8, 0x0152, 0xfffd, 0x0166, 0x00de, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138, 0x0142, - 0x0140, 0x0149, 0x014b, 0x00f8, 0x0153, 0x00df, 0x0167, 0x00fe, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x2a */ - 0x00c1, 0x00c0, 0x00c4, 0x00c2, 0x0102, 0x01cd, 0x0100, 0x0104, - 0x00c5, 0x00c3, 0x0106, 0x0108, 0x010c, 0x00c7, 0x010a, 0x010e, - 0x00c9, 0x00c8, 0x00cb, 0x00ca, 0x011a, 0x0116, 0x0112, 0x0118, - 0xfffd, 0x011c, 0x011e, 0x0122, 0x0120, 0x0124, 0x00cd, 0x00cc, - 0x00cf, 0x00ce, 0x01cf, 0x0130, 0x012a, 0x012e, 0x0128, 0x0134, - 0x0136, 0x0139, 0x013d, 0x013b, 0x0143, 0x0147, 0x0145, 0x00d1, - 0x00d3, 0x00d2, 0x00d6, 0x00d4, 0x01d1, 0x0150, 0x014c, 0x00d5, - 0x0154, 0x0158, 0x0156, 0x015a, 0x015c, 0x0160, 0x015e, 0x0164, - 0x0162, 0x00da, 0x00d9, 0x00dc, 0x00db, 0x016c, 0x01d3, 0x0170, - 0x016a, 0x0172, 0x016e, 0x0168, 0x01d7, 0x01db, 0x01d9, 0x01d5, - 0x0174, 0x00dd, 0x0178, 0x0176, 0x0179, 0x017d, 0x017b, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x2b */ - 0x00e1, 0x00e0, 0x00e4, 0x00e2, 0x0103, 0x01ce, 0x0101, 0x0105, - 0x00e5, 0x00e3, 0x0107, 0x0109, 0x010d, 0x00e7, 0x010b, 0x010f, - 0x00e9, 0x00e8, 0x00eb, 0x00ea, 0x011b, 0x0117, 0x0113, 0x0119, - 0x01f5, 0x011d, 0x011f, 0xfffd, 0x0121, 0x0125, 0x00ed, 0x00ec, - 0x00ef, 0x00ee, 0x01d0, 0xfffd, 0x012b, 0x012f, 0x0129, 0x0135, - 0x0137, 0x013a, 0x013e, 0x013c, 0x0144, 0x0148, 0x0146, 0x00f1, - 0x00f3, 0x00f2, 0x00f6, 0x00f4, 0x01d2, 0x0151, 0x014d, 0x00f5, - 0x0155, 0x0159, 0x0157, 0x015b, 0x015d, 0x0161, 0x015f, 0x0165, - 0x0163, 0x00fa, 0x00f9, 0x00fc, 0x00fb, 0x016d, 0x01d4, 0x0171, - 0x016b, 0x0173, 0x016f, 0x0169, 0x01d8, 0x01dc, 0x01da, 0x01d6, - 0x0175, 0x00fd, 0x00ff, 0x0177, 0x017a, 0x017e, 0x017c, -}; -static const unsigned short jisx0212_2uni_page30[5801] = { - /* 0x30 */ - 0x4e02, 0x4e04, 0x4e05, 0x4e0c, 0x4e12, 0x4e1f, 0x4e23, 0x4e24, - 0x4e28, 0x4e2b, 0x4e2e, 0x4e2f, 0x4e30, 0x4e35, 0x4e40, 0x4e41, - 0x4e44, 0x4e47, 0x4e51, 0x4e5a, 0x4e5c, 0x4e63, 0x4e68, 0x4e69, - 0x4e74, 0x4e75, 0x4e79, 0x4e7f, 0x4e8d, 0x4e96, 0x4e97, 0x4e9d, - 0x4eaf, 0x4eb9, 0x4ec3, 0x4ed0, 0x4eda, 0x4edb, 0x4ee0, 0x4ee1, - 0x4ee2, 0x4ee8, 0x4eef, 0x4ef1, 0x4ef3, 0x4ef5, 0x4efd, 0x4efe, - 0x4eff, 0x4f00, 0x4f02, 0x4f03, 0x4f08, 0x4f0b, 0x4f0c, 0x4f12, - 0x4f15, 0x4f16, 0x4f17, 0x4f19, 0x4f2e, 0x4f31, 0x4f60, 0x4f33, - 0x4f35, 0x4f37, 0x4f39, 0x4f3b, 0x4f3e, 0x4f40, 0x4f42, 0x4f48, - 0x4f49, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, 0x4f58, 0x4f5f, - 0x4f63, 0x4f6a, 0x4f6c, 0x4f6e, 0x4f71, 0x4f77, 0x4f78, 0x4f79, - 0x4f7a, 0x4f7d, 0x4f7e, 0x4f81, 0x4f82, 0x4f84, - /* 0x31 */ - 0x4f85, 0x4f89, 0x4f8a, 0x4f8c, 0x4f8e, 0x4f90, 0x4f92, 0x4f93, - 0x4f94, 0x4f97, 0x4f99, 0x4f9a, 0x4f9e, 0x4f9f, 0x4fb2, 0x4fb7, - 0x4fb9, 0x4fbb, 0x4fbc, 0x4fbd, 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc5, - 0x4fc6, 0x4fc8, 0x4fc9, 0x4fcb, 0x4fcc, 0x4fcd, 0x4fcf, 0x4fd2, - 0x4fdc, 0x4fe0, 0x4fe2, 0x4ff0, 0x4ff2, 0x4ffc, 0x4ffd, 0x4fff, - 0x5000, 0x5001, 0x5004, 0x5007, 0x500a, 0x500c, 0x500e, 0x5010, - 0x5013, 0x5017, 0x5018, 0x501b, 0x501c, 0x501d, 0x501e, 0x5022, - 0x5027, 0x502e, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040, 0x5041, - 0x5042, 0x5045, 0x5046, 0x504a, 0x504c, 0x504e, 0x5051, 0x5052, - 0x5053, 0x5057, 0x5059, 0x505f, 0x5060, 0x5062, 0x5063, 0x5066, - 0x5067, 0x506a, 0x506d, 0x5070, 0x5071, 0x503b, 0x5081, 0x5083, - 0x5084, 0x5086, 0x508a, 0x508e, 0x508f, 0x5090, - /* 0x32 */ - 0x5092, 0x5093, 0x5094, 0x5096, 0x509b, 0x509c, 0x509e, 0x509f, - 0x50a0, 0x50a1, 0x50a2, 0x50aa, 0x50af, 0x50b0, 0x50b9, 0x50ba, - 0x50bd, 0x50c0, 0x50c3, 0x50c4, 0x50c7, 0x50cc, 0x50ce, 0x50d0, - 0x50d3, 0x50d4, 0x50d8, 0x50dc, 0x50dd, 0x50df, 0x50e2, 0x50e4, - 0x50e6, 0x50e8, 0x50e9, 0x50ef, 0x50f1, 0x50f6, 0x50fa, 0x50fe, - 0x5103, 0x5106, 0x5107, 0x5108, 0x510b, 0x510c, 0x510d, 0x510e, - 0x50f2, 0x5110, 0x5117, 0x5119, 0x511b, 0x511c, 0x511d, 0x511e, - 0x5123, 0x5127, 0x5128, 0x512c, 0x512d, 0x512f, 0x5131, 0x5133, - 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514a, 0x514f, 0x5153, - 0x5155, 0x5157, 0x5158, 0x515f, 0x5164, 0x5166, 0x517e, 0x5183, - 0x5184, 0x518b, 0x518e, 0x5198, 0x519d, 0x51a1, 0x51a3, 0x51ad, - 0x51b8, 0x51ba, 0x51bc, 0x51be, 0x51bf, 0x51c2, - /* 0x33 */ - 0x51c8, 0x51cf, 0x51d1, 0x51d2, 0x51d3, 0x51d5, 0x51d8, 0x51de, - 0x51e2, 0x51e5, 0x51ee, 0x51f2, 0x51f3, 0x51f4, 0x51f7, 0x5201, - 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218, 0x5222, - 0x5228, 0x5231, 0x5232, 0x5235, 0x523c, 0x5245, 0x5249, 0x5255, - 0x5257, 0x5258, 0x525a, 0x525c, 0x525f, 0x5260, 0x5261, 0x5266, - 0x526e, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285, 0x528a, - 0x528c, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529a, 0x529c, - 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52af, 0x52b0, 0x52b6, 0x52b7, - 0x52b8, 0x52ba, 0x52bb, 0x52bd, 0x52c0, 0x52c4, 0x52c6, 0x52c8, - 0x52cc, 0x52cf, 0x52d1, 0x52d4, 0x52d6, 0x52db, 0x52dc, 0x52e1, - 0x52e5, 0x52e8, 0x52e9, 0x52ea, 0x52ec, 0x52f0, 0x52f1, 0x52f4, - 0x52f6, 0x52f7, 0x5300, 0x5303, 0x530a, 0x530b, - /* 0x34 */ - 0x530c, 0x5311, 0x5313, 0x5318, 0x531b, 0x531c, 0x531e, 0x531f, - 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, 0x532c, 0x532d, 0x5330, - 0x5332, 0x5335, 0x533c, 0x533d, 0x533e, 0x5342, 0x534c, 0x534b, - 0x5359, 0x535b, 0x5361, 0x5363, 0x5365, 0x536c, 0x536d, 0x5372, - 0x5379, 0x537e, 0x5383, 0x5387, 0x5388, 0x538e, 0x5393, 0x5394, - 0x5399, 0x539d, 0x53a1, 0x53a4, 0x53aa, 0x53ab, 0x53af, 0x53b2, - 0x53b4, 0x53b5, 0x53b7, 0x53b8, 0x53ba, 0x53bd, 0x53c0, 0x53c5, - 0x53cf, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dd, 0x53de, 0x53e0, - 0x53e6, 0x53e7, 0x53f5, 0x5402, 0x5413, 0x541a, 0x5421, 0x5427, - 0x5428, 0x542a, 0x542f, 0x5431, 0x5434, 0x5435, 0x5443, 0x5444, - 0x5447, 0x544d, 0x544f, 0x545e, 0x5462, 0x5464, 0x5466, 0x5467, - 0x5469, 0x546b, 0x546d, 0x546e, 0x5474, 0x547f, - /* 0x35 */ - 0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548d, 0x5491, 0x5495, - 0x5496, 0x549c, 0x549f, 0x54a1, 0x54a6, 0x54a7, 0x54a9, 0x54aa, - 0x54ad, 0x54ae, 0x54b1, 0x54b7, 0x54b9, 0x54ba, 0x54bb, 0x54bf, - 0x54c6, 0x54ca, 0x54cd, 0x54ce, 0x54e0, 0x54ea, 0x54ec, 0x54ef, - 0x54f6, 0x54fc, 0x54fe, 0x54ff, 0x5500, 0x5501, 0x5505, 0x5508, - 0x5509, 0x550c, 0x550d, 0x550e, 0x5515, 0x552a, 0x552b, 0x5532, - 0x5535, 0x5536, 0x553b, 0x553c, 0x553d, 0x5541, 0x5547, 0x5549, - 0x554a, 0x554d, 0x5550, 0x5551, 0x5558, 0x555a, 0x555b, 0x555e, - 0x5560, 0x5561, 0x5564, 0x5566, 0x557f, 0x5581, 0x5582, 0x5586, - 0x5588, 0x558e, 0x558f, 0x5591, 0x5592, 0x5593, 0x5594, 0x5597, - 0x55a3, 0x55a4, 0x55ad, 0x55b2, 0x55bf, 0x55c1, 0x55c3, 0x55c6, - 0x55c9, 0x55cb, 0x55cc, 0x55ce, 0x55d1, 0x55d2, - /* 0x36 */ - 0x55d3, 0x55d7, 0x55d8, 0x55db, 0x55de, 0x55e2, 0x55e9, 0x55f6, - 0x55ff, 0x5605, 0x5608, 0x560a, 0x560d, 0x560e, 0x560f, 0x5610, - 0x5611, 0x5612, 0x5619, 0x562c, 0x5630, 0x5633, 0x5635, 0x5637, - 0x5639, 0x563b, 0x563c, 0x563d, 0x563f, 0x5640, 0x5641, 0x5643, - 0x5644, 0x5646, 0x5649, 0x564b, 0x564d, 0x564f, 0x5654, 0x565e, - 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566d, 0x566f, - 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568b, 0x568c, - 0x5695, 0x5699, 0x569a, 0x569d, 0x569e, 0x569f, 0x56a6, 0x56a7, - 0x56a8, 0x56a9, 0x56ab, 0x56ac, 0x56ad, 0x56b1, 0x56b3, 0x56b7, - 0x56be, 0x56c5, 0x56c9, 0x56ca, 0x56cb, 0x56cf, 0x56d0, 0x56cc, - 0x56cd, 0x56d9, 0x56dc, 0x56dd, 0x56df, 0x56e1, 0x56e4, 0x56e5, - 0x56e6, 0x56e7, 0x56e8, 0x56f1, 0x56eb, 0x56ed, - /* 0x37 */ - 0x56f6, 0x56f7, 0x5701, 0x5702, 0x5707, 0x570a, 0x570c, 0x5711, - 0x5715, 0x571a, 0x571b, 0x571d, 0x5720, 0x5722, 0x5723, 0x5724, - 0x5725, 0x5729, 0x572a, 0x572c, 0x572e, 0x572f, 0x5733, 0x5734, - 0x573d, 0x573e, 0x573f, 0x5745, 0x5746, 0x574c, 0x574d, 0x5752, - 0x5762, 0x5765, 0x5767, 0x5768, 0x576b, 0x576d, 0x576e, 0x576f, - 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779, 0x577a, - 0x577b, 0x577c, 0x577e, 0x5781, 0x5783, 0x578c, 0x5794, 0x5797, - 0x5799, 0x579a, 0x579c, 0x579d, 0x579e, 0x579f, 0x57a1, 0x5795, - 0x57a7, 0x57a8, 0x57a9, 0x57ac, 0x57b8, 0x57bd, 0x57c7, 0x57c8, - 0x57cc, 0x57cf, 0x57d5, 0x57dd, 0x57de, 0x57e4, 0x57e6, 0x57e7, - 0x57e9, 0x57ed, 0x57f0, 0x57f5, 0x57f6, 0x57f8, 0x57fd, 0x57fe, - 0x57ff, 0x5803, 0x5804, 0x5808, 0x5809, 0x57e1, - /* 0x38 */ - 0x580c, 0x580d, 0x581b, 0x581e, 0x581f, 0x5820, 0x5826, 0x5827, - 0x582d, 0x5832, 0x5839, 0x583f, 0x5849, 0x584c, 0x584d, 0x584f, - 0x5850, 0x5855, 0x585f, 0x5861, 0x5864, 0x5867, 0x5868, 0x5878, - 0x587c, 0x587f, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889, 0x588a, - 0x588c, 0x588d, 0x588f, 0x5890, 0x5894, 0x5896, 0x589d, 0x58a0, - 0x58a1, 0x58a2, 0x58a6, 0x58a9, 0x58b1, 0x58b2, 0x58c4, 0x58bc, - 0x58c2, 0x58c8, 0x58cd, 0x58ce, 0x58d0, 0x58d2, 0x58d4, 0x58d6, - 0x58da, 0x58dd, 0x58e1, 0x58e2, 0x58e9, 0x58f3, 0x5905, 0x5906, - 0x590b, 0x590c, 0x5912, 0x5913, 0x5914, 0x8641, 0x591d, 0x5921, - 0x5923, 0x5924, 0x5928, 0x592f, 0x5930, 0x5933, 0x5935, 0x5936, - 0x593f, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595b, 0x595d, - 0x595e, 0x595f, 0x5961, 0x5963, 0x596b, 0x596d, - /* 0x39 */ - 0x596f, 0x5972, 0x5975, 0x5976, 0x5979, 0x597b, 0x597c, 0x598b, - 0x598c, 0x598e, 0x5992, 0x5995, 0x5997, 0x599f, 0x59a4, 0x59a7, - 0x59ad, 0x59ae, 0x59af, 0x59b0, 0x59b3, 0x59b7, 0x59ba, 0x59bc, - 0x59c1, 0x59c3, 0x59c4, 0x59c8, 0x59ca, 0x59cd, 0x59d2, 0x59dd, - 0x59de, 0x59df, 0x59e3, 0x59e4, 0x59e7, 0x59ee, 0x59ef, 0x59f1, - 0x59f2, 0x59f4, 0x59f7, 0x5a00, 0x5a04, 0x5a0c, 0x5a0d, 0x5a0e, - 0x5a12, 0x5a13, 0x5a1e, 0x5a23, 0x5a24, 0x5a27, 0x5a28, 0x5a2a, - 0x5a2d, 0x5a30, 0x5a44, 0x5a45, 0x5a47, 0x5a48, 0x5a4c, 0x5a50, - 0x5a55, 0x5a5e, 0x5a63, 0x5a65, 0x5a67, 0x5a6d, 0x5a77, 0x5a7a, - 0x5a7b, 0x5a7e, 0x5a8b, 0x5a90, 0x5a93, 0x5a96, 0x5a99, 0x5a9c, - 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa2, 0x5aa7, 0x5aac, 0x5ab1, 0x5ab2, - 0x5ab3, 0x5ab5, 0x5ab8, 0x5aba, 0x5abb, 0x5abf, - /* 0x3a */ - 0x5ac4, 0x5ac6, 0x5ac8, 0x5acf, 0x5ada, 0x5adc, 0x5ae0, 0x5ae5, - 0x5aea, 0x5aee, 0x5af5, 0x5af6, 0x5afd, 0x5b00, 0x5b01, 0x5b08, - 0x5b17, 0x5b34, 0x5b19, 0x5b1b, 0x5b1d, 0x5b21, 0x5b25, 0x5b2d, - 0x5b38, 0x5b41, 0x5b4b, 0x5b4c, 0x5b52, 0x5b56, 0x5b5e, 0x5b68, - 0x5b6e, 0x5b6f, 0x5b7c, 0x5b7d, 0x5b7e, 0x5b7f, 0x5b81, 0x5b84, - 0x5b86, 0x5b8a, 0x5b8e, 0x5b90, 0x5b91, 0x5b93, 0x5b94, 0x5b96, - 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5baf, 0x5bb1, 0x5bb2, 0x5bb7, - 0x5bba, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bcd, 0x5bcf, 0x5bd6, 0x5bd7, - 0x5bd8, 0x5bd9, 0x5bda, 0x5be0, 0x5bef, 0x5bf1, 0x5bf4, 0x5bfd, - 0x5c0c, 0x5c17, 0x5c1e, 0x5c1f, 0x5c23, 0x5c26, 0x5c29, 0x5c2b, - 0x5c2c, 0x5c2e, 0x5c30, 0x5c32, 0x5c35, 0x5c36, 0x5c59, 0x5c5a, - 0x5c5c, 0x5c62, 0x5c63, 0x5c67, 0x5c68, 0x5c69, - /* 0x3b */ - 0x5c6d, 0x5c70, 0x5c74, 0x5c75, 0x5c7a, 0x5c7b, 0x5c7c, 0x5c7d, - 0x5c87, 0x5c88, 0x5c8a, 0x5c8f, 0x5c92, 0x5c9d, 0x5c9f, 0x5ca0, - 0x5ca2, 0x5ca3, 0x5ca6, 0x5caa, 0x5cb2, 0x5cb4, 0x5cb5, 0x5cba, - 0x5cc9, 0x5ccb, 0x5cd2, 0x5cdd, 0x5cd7, 0x5cee, 0x5cf1, 0x5cf2, - 0x5cf4, 0x5d01, 0x5d06, 0x5d0d, 0x5d12, 0x5d2b, 0x5d23, 0x5d24, - 0x5d26, 0x5d27, 0x5d31, 0x5d34, 0x5d39, 0x5d3d, 0x5d3f, 0x5d42, - 0x5d43, 0x5d46, 0x5d48, 0x5d55, 0x5d51, 0x5d59, 0x5d4a, 0x5d5f, - 0x5d60, 0x5d61, 0x5d62, 0x5d64, 0x5d6a, 0x5d6d, 0x5d70, 0x5d79, - 0x5d7a, 0x5d7e, 0x5d7f, 0x5d81, 0x5d83, 0x5d88, 0x5d8a, 0x5d92, - 0x5d93, 0x5d94, 0x5d95, 0x5d99, 0x5d9b, 0x5d9f, 0x5da0, 0x5da7, - 0x5dab, 0x5db0, 0x5db4, 0x5db8, 0x5db9, 0x5dc3, 0x5dc7, 0x5dcb, - 0x5dd0, 0x5dce, 0x5dd8, 0x5dd9, 0x5de0, 0x5de4, - /* 0x3c */ - 0x5de9, 0x5df8, 0x5df9, 0x5e00, 0x5e07, 0x5e0d, 0x5e12, 0x5e14, - 0x5e15, 0x5e18, 0x5e1f, 0x5e20, 0x5e2e, 0x5e28, 0x5e32, 0x5e35, - 0x5e3e, 0x5e4b, 0x5e50, 0x5e49, 0x5e51, 0x5e56, 0x5e58, 0x5e5b, - 0x5e5c, 0x5e5e, 0x5e68, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, - 0x5e70, 0x5e80, 0x5e8b, 0x5e8e, 0x5ea2, 0x5ea4, 0x5ea5, 0x5ea8, - 0x5eaa, 0x5eac, 0x5eb1, 0x5eb3, 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec6, - 0x5ecc, 0x5ecb, 0x5ece, 0x5ed1, 0x5ed2, 0x5ed4, 0x5ed5, 0x5edc, - 0x5ede, 0x5ee5, 0x5eeb, 0x5f02, 0x5f06, 0x5f07, 0x5f08, 0x5f0e, - 0x5f19, 0x5f1c, 0x5f1d, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f28, - 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f34, 0x5f36, 0x5f3b, 0x5f3d, - 0x5f3f, 0x5f40, 0x5f44, 0x5f45, 0x5f47, 0x5f4d, 0x5f50, 0x5f54, - 0x5f58, 0x5f5b, 0x5f60, 0x5f63, 0x5f64, 0x5f67, - /* 0x3d */ - 0x5f6f, 0x5f72, 0x5f74, 0x5f75, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, - 0x5f89, 0x5f8d, 0x5f8f, 0x5f96, 0x5f9c, 0x5f9d, 0x5fa2, 0x5fa7, - 0x5fab, 0x5fa4, 0x5fac, 0x5faf, 0x5fb0, 0x5fb1, 0x5fb8, 0x5fc4, - 0x5fc7, 0x5fc8, 0x5fc9, 0x5fcb, 0x5fd0, 0x5fd1, 0x5fd2, 0x5fd3, - 0x5fd4, 0x5fde, 0x5fe1, 0x5fe2, 0x5fe8, 0x5fe9, 0x5fea, 0x5fec, - 0x5fed, 0x5fee, 0x5fef, 0x5ff2, 0x5ff3, 0x5ff6, 0x5ffa, 0x5ffc, - 0x6007, 0x600a, 0x600d, 0x6013, 0x6014, 0x6017, 0x6018, 0x601a, - 0x601f, 0x6024, 0x602d, 0x6033, 0x6035, 0x6040, 0x6047, 0x6048, - 0x6049, 0x604c, 0x6051, 0x6054, 0x6056, 0x6057, 0x605d, 0x6061, - 0x6067, 0x6071, 0x607e, 0x607f, 0x6082, 0x6086, 0x6088, 0x608a, - 0x608e, 0x6091, 0x6093, 0x6095, 0x6098, 0x609d, 0x609e, 0x60a2, - 0x60a4, 0x60a5, 0x60a8, 0x60b0, 0x60b1, 0x60b7, - /* 0x3e */ - 0x60bb, 0x60be, 0x60c2, 0x60c4, 0x60c8, 0x60c9, 0x60ca, 0x60cb, - 0x60ce, 0x60cf, 0x60d4, 0x60d5, 0x60d9, 0x60db, 0x60dd, 0x60de, - 0x60e2, 0x60e5, 0x60f2, 0x60f5, 0x60f8, 0x60fc, 0x60fd, 0x6102, - 0x6107, 0x610a, 0x610c, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, - 0x6116, 0x6117, 0x6119, 0x611c, 0x611e, 0x6122, 0x612a, 0x612b, - 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141, 0x6145, - 0x6146, 0x6149, 0x615e, 0x6160, 0x616c, 0x6172, 0x6178, 0x617b, - 0x617c, 0x617f, 0x6180, 0x6181, 0x6183, 0x6184, 0x618b, 0x618d, - 0x6192, 0x6193, 0x6197, 0x6198, 0x619c, 0x619d, 0x619f, 0x61a0, - 0x61a5, 0x61a8, 0x61aa, 0x61ad, 0x61b8, 0x61b9, 0x61bc, 0x61c0, - 0x61c1, 0x61c2, 0x61ce, 0x61cf, 0x61d5, 0x61dc, 0x61dd, 0x61de, - 0x61df, 0x61e1, 0x61e2, 0x61e7, 0x61e9, 0x61e5, - /* 0x3f */ - 0x61ec, 0x61ed, 0x61ef, 0x6201, 0x6203, 0x6204, 0x6207, 0x6213, - 0x6215, 0x621c, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229, 0x622b, - 0x6239, 0x623d, 0x6242, 0x6243, 0x6244, 0x6246, 0x624c, 0x6250, - 0x6251, 0x6252, 0x6254, 0x6256, 0x625a, 0x625c, 0x6264, 0x626d, - 0x626f, 0x6273, 0x627a, 0x627d, 0x628d, 0x628e, 0x628f, 0x6290, - 0x62a6, 0x62a8, 0x62b3, 0x62b6, 0x62b7, 0x62ba, 0x62be, 0x62bf, - 0x62c4, 0x62ce, 0x62d5, 0x62d6, 0x62da, 0x62ea, 0x62f2, 0x62f4, - 0x62fc, 0x62fd, 0x6303, 0x6304, 0x630a, 0x630b, 0x630d, 0x6310, - 0x6313, 0x6316, 0x6318, 0x6329, 0x632a, 0x632d, 0x6335, 0x6336, - 0x6339, 0x633c, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346, 0x634a, - 0x634b, 0x634e, 0x6352, 0x6353, 0x6354, 0x6358, 0x635b, 0x6365, - 0x6366, 0x636c, 0x636d, 0x6371, 0x6374, 0x6375, - /* 0x40 */ - 0x6378, 0x637c, 0x637d, 0x637f, 0x6382, 0x6384, 0x6387, 0x638a, - 0x6390, 0x6394, 0x6395, 0x6399, 0x639a, 0x639e, 0x63a4, 0x63a6, - 0x63ad, 0x63ae, 0x63af, 0x63bd, 0x63c1, 0x63c5, 0x63c8, 0x63ce, - 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63dc, 0x63e0, 0x63e5, 0x63ea, - 0x63ec, 0x63f2, 0x63f3, 0x63f5, 0x63f8, 0x63f9, 0x6409, 0x640a, - 0x6410, 0x6412, 0x6414, 0x6418, 0x641e, 0x6420, 0x6422, 0x6424, - 0x6425, 0x6429, 0x642a, 0x642f, 0x6430, 0x6435, 0x643d, 0x643f, - 0x644b, 0x644f, 0x6451, 0x6452, 0x6453, 0x6454, 0x645a, 0x645b, - 0x645c, 0x645d, 0x645f, 0x6460, 0x6461, 0x6463, 0x646d, 0x6473, - 0x6474, 0x647b, 0x647d, 0x6485, 0x6487, 0x648f, 0x6490, 0x6491, - 0x6498, 0x6499, 0x649b, 0x649d, 0x649f, 0x64a1, 0x64a3, 0x64a6, - 0x64a8, 0x64ac, 0x64b3, 0x64bd, 0x64be, 0x64bf, - /* 0x41 */ - 0x64c4, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64ce, 0x64d0, 0x64d1, - 0x64d5, 0x64d7, 0x64e4, 0x64e5, 0x64e9, 0x64ea, 0x64ed, 0x64f0, - 0x64f5, 0x64f7, 0x64fb, 0x64ff, 0x6501, 0x6504, 0x6508, 0x6509, - 0x650a, 0x650f, 0x6513, 0x6514, 0x6516, 0x6519, 0x651b, 0x651e, - 0x651f, 0x6522, 0x6526, 0x6529, 0x652e, 0x6531, 0x653a, 0x653c, - 0x653d, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554, 0x655f, - 0x6560, 0x6567, 0x656b, 0x657a, 0x657d, 0x6581, 0x6585, 0x658a, - 0x6592, 0x6595, 0x6598, 0x659d, 0x65a0, 0x65a3, 0x65a6, 0x65ae, - 0x65b2, 0x65b3, 0x65b4, 0x65bf, 0x65c2, 0x65c8, 0x65c9, 0x65ce, - 0x65d0, 0x65d4, 0x65d6, 0x65d8, 0x65df, 0x65f0, 0x65f2, 0x65f4, - 0x65f5, 0x65f9, 0x65fe, 0x65ff, 0x6600, 0x6604, 0x6608, 0x6609, - 0x660d, 0x6611, 0x6612, 0x6615, 0x6616, 0x661d, - /* 0x42 */ - 0x661e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629, 0x662a, - 0x662b, 0x662c, 0x662e, 0x6630, 0x6631, 0x6633, 0x6639, 0x6637, - 0x6640, 0x6645, 0x6646, 0x664a, 0x664c, 0x6651, 0x664e, 0x6657, - 0x6658, 0x6659, 0x665b, 0x665c, 0x6660, 0x6661, 0x66fb, 0x666a, - 0x666b, 0x666c, 0x667e, 0x6673, 0x6675, 0x667f, 0x6677, 0x6678, - 0x6679, 0x667b, 0x6680, 0x667c, 0x668b, 0x668c, 0x668d, 0x6690, - 0x6692, 0x6699, 0x669a, 0x669b, 0x669c, 0x669f, 0x66a0, 0x66a4, - 0x66ad, 0x66b1, 0x66b2, 0x66b5, 0x66bb, 0x66bf, 0x66c0, 0x66c2, - 0x66c3, 0x66c8, 0x66cc, 0x66ce, 0x66cf, 0x66d4, 0x66db, 0x66df, - 0x66e8, 0x66eb, 0x66ec, 0x66ee, 0x66fa, 0x6705, 0x6707, 0x670e, - 0x6713, 0x6719, 0x671c, 0x6720, 0x6722, 0x6733, 0x673e, 0x6745, - 0x6747, 0x6748, 0x674c, 0x6754, 0x6755, 0x675d, - /* 0x43 */ - 0x6766, 0x676c, 0x676e, 0x6774, 0x6776, 0x677b, 0x6781, 0x6784, - 0x678e, 0x678f, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799, 0x679b, - 0x67b0, 0x67b1, 0x67b2, 0x67b5, 0x67bb, 0x67bc, 0x67bd, 0x67f9, - 0x67c0, 0x67c2, 0x67c3, 0x67c5, 0x67c8, 0x67c9, 0x67d2, 0x67d7, - 0x67d9, 0x67dc, 0x67e1, 0x67e6, 0x67f0, 0x67f2, 0x67f6, 0x67f7, - 0x6852, 0x6814, 0x6819, 0x681d, 0x681f, 0x6828, 0x6827, 0x682c, - 0x682d, 0x682f, 0x6830, 0x6831, 0x6833, 0x683b, 0x683f, 0x6844, - 0x6845, 0x684a, 0x684c, 0x6855, 0x6857, 0x6858, 0x685b, 0x686b, - 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879, 0x687a, - 0x687b, 0x687c, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896, 0x6898, - 0x689a, 0x689c, 0x68a1, 0x68a3, 0x68a5, 0x68a9, 0x68aa, 0x68ae, - 0x68b2, 0x68bb, 0x68c5, 0x68c8, 0x68cc, 0x68cf, - /* 0x44 */ - 0x68d0, 0x68d1, 0x68d3, 0x68d6, 0x68d9, 0x68dc, 0x68dd, 0x68e5, - 0x68e8, 0x68ea, 0x68eb, 0x68ec, 0x68ed, 0x68f0, 0x68f1, 0x68f5, - 0x68f6, 0x68fb, 0x68fc, 0x68fd, 0x6906, 0x6909, 0x690a, 0x6910, - 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935, 0x6938, - 0x693b, 0x6942, 0x6945, 0x6949, 0x694e, 0x6957, 0x695b, 0x6963, - 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696c, 0x6970, 0x6971, - 0x6972, 0x697a, 0x697b, 0x697f, 0x6980, 0x698d, 0x6992, 0x6996, - 0x6998, 0x69a1, 0x69a5, 0x69a6, 0x69a8, 0x69ab, 0x69ad, 0x69af, - 0x69b7, 0x69b8, 0x69ba, 0x69bc, 0x69c5, 0x69c8, 0x69d1, 0x69d6, - 0x69d7, 0x69e2, 0x69e5, 0x69ee, 0x69ef, 0x69f1, 0x69f3, 0x69f5, - 0x69fe, 0x6a00, 0x6a01, 0x6a03, 0x6a0f, 0x6a11, 0x6a15, 0x6a1a, - 0x6a1d, 0x6a20, 0x6a24, 0x6a28, 0x6a30, 0x6a32, - /* 0x45 */ - 0x6a34, 0x6a37, 0x6a3b, 0x6a3e, 0x6a3f, 0x6a45, 0x6a46, 0x6a49, - 0x6a4a, 0x6a4e, 0x6a50, 0x6a51, 0x6a52, 0x6a55, 0x6a56, 0x6a5b, - 0x6a64, 0x6a67, 0x6a6a, 0x6a71, 0x6a73, 0x6a7e, 0x6a81, 0x6a83, - 0x6a86, 0x6a87, 0x6a89, 0x6a8b, 0x6a91, 0x6a9b, 0x6a9d, 0x6a9e, - 0x6a9f, 0x6aa5, 0x6aab, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab4, 0x6abd, - 0x6abe, 0x6abf, 0x6ac6, 0x6ac9, 0x6ac8, 0x6acc, 0x6ad0, 0x6ad4, - 0x6ad5, 0x6ad6, 0x6adc, 0x6add, 0x6ae4, 0x6ae7, 0x6aec, 0x6af0, - 0x6af1, 0x6af2, 0x6afc, 0x6afd, 0x6b02, 0x6b03, 0x6b06, 0x6b07, - 0x6b09, 0x6b0f, 0x6b10, 0x6b11, 0x6b17, 0x6b1b, 0x6b1e, 0x6b24, - 0x6b28, 0x6b2b, 0x6b2c, 0x6b2f, 0x6b35, 0x6b36, 0x6b3b, 0x6b3f, - 0x6b46, 0x6b4a, 0x6b4d, 0x6b52, 0x6b56, 0x6b58, 0x6b5d, 0x6b60, - 0x6b67, 0x6b6b, 0x6b6e, 0x6b70, 0x6b75, 0x6b7d, - /* 0x46 */ - 0x6b7e, 0x6b82, 0x6b85, 0x6b97, 0x6b9b, 0x6b9f, 0x6ba0, 0x6ba2, - 0x6ba3, 0x6ba8, 0x6ba9, 0x6bac, 0x6bad, 0x6bae, 0x6bb0, 0x6bb8, - 0x6bb9, 0x6bbd, 0x6bbe, 0x6bc3, 0x6bc4, 0x6bc9, 0x6bcc, 0x6bd6, - 0x6bda, 0x6be1, 0x6be3, 0x6be6, 0x6be7, 0x6bee, 0x6bf1, 0x6bf7, - 0x6bf9, 0x6bff, 0x6c02, 0x6c04, 0x6c05, 0x6c09, 0x6c0d, 0x6c0e, - 0x6c10, 0x6c12, 0x6c19, 0x6c1f, 0x6c26, 0x6c27, 0x6c28, 0x6c2c, - 0x6c2e, 0x6c33, 0x6c35, 0x6c36, 0x6c3a, 0x6c3b, 0x6c3f, 0x6c4a, - 0x6c4b, 0x6c4d, 0x6c4f, 0x6c52, 0x6c54, 0x6c59, 0x6c5b, 0x6c5c, - 0x6c6b, 0x6c6d, 0x6c6f, 0x6c74, 0x6c76, 0x6c78, 0x6c79, 0x6c7b, - 0x6c85, 0x6c86, 0x6c87, 0x6c89, 0x6c94, 0x6c95, 0x6c97, 0x6c98, - 0x6c9c, 0x6c9f, 0x6cb0, 0x6cb2, 0x6cb4, 0x6cc2, 0x6cc6, 0x6ccd, - 0x6ccf, 0x6cd0, 0x6cd1, 0x6cd2, 0x6cd4, 0x6cd6, - /* 0x47 */ - 0x6cda, 0x6cdc, 0x6ce0, 0x6ce7, 0x6ce9, 0x6ceb, 0x6cec, 0x6cee, - 0x6cf2, 0x6cf4, 0x6d04, 0x6d07, 0x6d0a, 0x6d0e, 0x6d0f, 0x6d11, - 0x6d13, 0x6d1a, 0x6d26, 0x6d27, 0x6d28, 0x6c67, 0x6d2e, 0x6d2f, - 0x6d31, 0x6d39, 0x6d3c, 0x6d3f, 0x6d57, 0x6d5e, 0x6d5f, 0x6d61, - 0x6d65, 0x6d67, 0x6d6f, 0x6d70, 0x6d7c, 0x6d82, 0x6d87, 0x6d91, - 0x6d92, 0x6d94, 0x6d96, 0x6d97, 0x6d98, 0x6daa, 0x6dac, 0x6db4, - 0x6db7, 0x6db9, 0x6dbd, 0x6dbf, 0x6dc4, 0x6dc8, 0x6dca, 0x6dce, - 0x6dcf, 0x6dd6, 0x6ddb, 0x6ddd, 0x6ddf, 0x6de0, 0x6de2, 0x6de5, - 0x6de9, 0x6def, 0x6df0, 0x6df4, 0x6df6, 0x6dfc, 0x6e00, 0x6e04, - 0x6e1e, 0x6e22, 0x6e27, 0x6e32, 0x6e36, 0x6e39, 0x6e3b, 0x6e3c, - 0x6e44, 0x6e45, 0x6e48, 0x6e49, 0x6e4b, 0x6e4f, 0x6e51, 0x6e52, - 0x6e53, 0x6e54, 0x6e57, 0x6e5c, 0x6e5d, 0x6e5e, - /* 0x48 */ - 0x6e62, 0x6e63, 0x6e68, 0x6e73, 0x6e7b, 0x6e7d, 0x6e8d, 0x6e93, - 0x6e99, 0x6ea0, 0x6ea7, 0x6ead, 0x6eae, 0x6eb1, 0x6eb3, 0x6ebb, - 0x6ebf, 0x6ec0, 0x6ec1, 0x6ec3, 0x6ec7, 0x6ec8, 0x6eca, 0x6ecd, - 0x6ece, 0x6ecf, 0x6eeb, 0x6eed, 0x6eee, 0x6ef9, 0x6efb, 0x6efd, - 0x6f04, 0x6f08, 0x6f0a, 0x6f0c, 0x6f0d, 0x6f16, 0x6f18, 0x6f1a, - 0x6f1b, 0x6f26, 0x6f29, 0x6f2a, 0x6f2f, 0x6f30, 0x6f33, 0x6f36, - 0x6f3b, 0x6f3c, 0x6f2d, 0x6f4f, 0x6f51, 0x6f52, 0x6f53, 0x6f57, - 0x6f59, 0x6f5a, 0x6f5d, 0x6f5e, 0x6f61, 0x6f62, 0x6f68, 0x6f6c, - 0x6f7d, 0x6f7e, 0x6f83, 0x6f87, 0x6f88, 0x6f8b, 0x6f8c, 0x6f8d, - 0x6f90, 0x6f92, 0x6f93, 0x6f94, 0x6f96, 0x6f9a, 0x6f9f, 0x6fa0, - 0x6fa5, 0x6fa6, 0x6fa7, 0x6fa8, 0x6fae, 0x6faf, 0x6fb0, 0x6fb5, - 0x6fb6, 0x6fbc, 0x6fc5, 0x6fc7, 0x6fc8, 0x6fca, - /* 0x49 */ - 0x6fda, 0x6fde, 0x6fe8, 0x6fe9, 0x6ff0, 0x6ff5, 0x6ff9, 0x6ffc, - 0x6ffd, 0x7000, 0x7005, 0x7006, 0x7007, 0x700d, 0x7017, 0x7020, - 0x7023, 0x702f, 0x7034, 0x7037, 0x7039, 0x703c, 0x7043, 0x7044, - 0x7048, 0x7049, 0x704a, 0x704b, 0x7054, 0x7055, 0x705d, 0x705e, - 0x704e, 0x7064, 0x7065, 0x706c, 0x706e, 0x7075, 0x7076, 0x707e, - 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097, 0x7098, - 0x709b, 0x70a4, 0x70ab, 0x70b0, 0x70b1, 0x70b4, 0x70b7, 0x70ca, - 0x70d1, 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d8, 0x70dc, 0x70e4, - 0x70fa, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710b, 0x710c, - 0x710f, 0x711e, 0x7120, 0x712b, 0x712d, 0x712f, 0x7130, 0x7131, - 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714a, 0x714b, 0x7150, - 0x7152, 0x7157, 0x715a, 0x715c, 0x715e, 0x7160, - /* 0x4a */ - 0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718c, 0x7192, 0x719a, - 0x719b, 0x71a0, 0x71a2, 0x71af, 0x71b0, 0x71b2, 0x71b3, 0x71ba, - 0x71bf, 0x71c0, 0x71c1, 0x71c4, 0x71cb, 0x71cc, 0x71d3, 0x71d6, - 0x71d9, 0x71da, 0x71dc, 0x71f8, 0x71fe, 0x7200, 0x7207, 0x7208, - 0x7209, 0x7213, 0x7217, 0x721a, 0x721d, 0x721f, 0x7224, 0x722b, - 0x722f, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243, 0x7245, - 0x724e, 0x724f, 0x7250, 0x7253, 0x7255, 0x7256, 0x725a, 0x725c, - 0x725e, 0x7260, 0x7263, 0x7268, 0x726b, 0x726e, 0x726f, 0x7271, - 0x7277, 0x7278, 0x727b, 0x727c, 0x727f, 0x7284, 0x7289, 0x728d, - 0x728e, 0x7293, 0x729b, 0x72a8, 0x72ad, 0x72ae, 0x72b1, 0x72b4, - 0x72be, 0x72c1, 0x72c7, 0x72c9, 0x72cc, 0x72d5, 0x72d6, 0x72d8, - 0x72df, 0x72e5, 0x72f3, 0x72f4, 0x72fa, 0x72fb, - /* 0x4b */ - 0x72fe, 0x7302, 0x7304, 0x7305, 0x7307, 0x730b, 0x730d, 0x7312, - 0x7313, 0x7318, 0x7319, 0x731e, 0x7322, 0x7324, 0x7327, 0x7328, - 0x732c, 0x7331, 0x7332, 0x7335, 0x733a, 0x733b, 0x733d, 0x7343, - 0x734d, 0x7350, 0x7352, 0x7356, 0x7358, 0x735d, 0x735e, 0x735f, - 0x7360, 0x7366, 0x7367, 0x7369, 0x736b, 0x736c, 0x736e, 0x736f, - 0x7371, 0x7377, 0x7379, 0x737c, 0x7380, 0x7381, 0x7383, 0x7385, - 0x7386, 0x738e, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398, 0x739c, - 0x739e, 0x739f, 0x73a0, 0x73a2, 0x73a5, 0x73a6, 0x73aa, 0x73ab, - 0x73ad, 0x73b5, 0x73b7, 0x73b9, 0x73bc, 0x73bd, 0x73bf, 0x73c5, - 0x73c6, 0x73c9, 0x73cb, 0x73cc, 0x73cf, 0x73d2, 0x73d3, 0x73d6, - 0x73d9, 0x73dd, 0x73e1, 0x73e3, 0x73e6, 0x73e7, 0x73e9, 0x73f4, - 0x73f5, 0x73f7, 0x73f9, 0x73fa, 0x73fb, 0x73fd, - /* 0x4c */ - 0x73ff, 0x7400, 0x7401, 0x7404, 0x7407, 0x740a, 0x7411, 0x741a, - 0x741b, 0x7424, 0x7426, 0x7428, 0x7429, 0x742a, 0x742b, 0x742c, - 0x742d, 0x742e, 0x742f, 0x7430, 0x7431, 0x7439, 0x7440, 0x7443, - 0x7444, 0x7446, 0x7447, 0x744b, 0x744d, 0x7451, 0x7452, 0x7457, - 0x745d, 0x7462, 0x7466, 0x7467, 0x7468, 0x746b, 0x746d, 0x746e, - 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487, 0x7489, - 0x748f, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749a, 0x749c, - 0x749f, 0x74a0, 0x74a1, 0x74a3, 0x74a6, 0x74a8, 0x74a9, 0x74aa, - 0x74ab, 0x74ae, 0x74af, 0x74b1, 0x74b2, 0x74b5, 0x74b9, 0x74bb, - 0x74bf, 0x74c8, 0x74c9, 0x74cc, 0x74d0, 0x74d3, 0x74d8, 0x74da, - 0x74db, 0x74de, 0x74df, 0x74e4, 0x74e8, 0x74ea, 0x74eb, 0x74ef, - 0x74f4, 0x74fa, 0x74fb, 0x74fc, 0x74ff, 0x7506, - /* 0x4d */ - 0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527, 0x7529, - 0x752a, 0x752f, 0x7536, 0x7539, 0x753d, 0x753e, 0x753f, 0x7540, - 0x7543, 0x7547, 0x7548, 0x754e, 0x7550, 0x7552, 0x7557, 0x755e, - 0x755f, 0x7561, 0x756f, 0x7571, 0x7579, 0x757a, 0x757b, 0x757c, - 0x757d, 0x757e, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593, 0x7595, - 0x7599, 0x759c, 0x75a2, 0x75a4, 0x75b4, 0x75ba, 0x75bf, 0x75c0, - 0x75c1, 0x75c4, 0x75c6, 0x75cc, 0x75ce, 0x75cf, 0x75d7, 0x75dc, - 0x75df, 0x75e0, 0x75e1, 0x75e4, 0x75e7, 0x75ec, 0x75ee, 0x75ef, - 0x75f1, 0x75f9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607, 0x7608, - 0x760a, 0x760c, 0x760f, 0x7612, 0x7613, 0x7615, 0x7616, 0x7619, - 0x761b, 0x761c, 0x761d, 0x761e, 0x7623, 0x7625, 0x7626, 0x7629, - 0x762d, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639, - /* 0x4e */ - 0x763a, 0x763c, 0x764a, 0x7640, 0x7641, 0x7643, 0x7644, 0x7645, - 0x7649, 0x764b, 0x7655, 0x7659, 0x765f, 0x7664, 0x7665, 0x766d, - 0x766e, 0x766f, 0x7671, 0x7674, 0x7681, 0x7685, 0x768c, 0x768d, - 0x7695, 0x769b, 0x769c, 0x769d, 0x769f, 0x76a0, 0x76a2, 0x76a3, - 0x76a4, 0x76a5, 0x76a6, 0x76a7, 0x76a8, 0x76aa, 0x76ad, 0x76bd, - 0x76c1, 0x76c5, 0x76c9, 0x76cb, 0x76cc, 0x76ce, 0x76d4, 0x76d9, - 0x76e0, 0x76e6, 0x76e8, 0x76ec, 0x76f0, 0x76f1, 0x76f6, 0x76f9, - 0x76fc, 0x7700, 0x7706, 0x770a, 0x770e, 0x7712, 0x7714, 0x7715, - 0x7717, 0x7719, 0x771a, 0x771c, 0x7722, 0x7728, 0x772d, 0x772e, - 0x772f, 0x7734, 0x7735, 0x7736, 0x7739, 0x773d, 0x773e, 0x7742, - 0x7745, 0x7746, 0x774a, 0x774d, 0x774e, 0x774f, 0x7752, 0x7756, - 0x7757, 0x775c, 0x775e, 0x775f, 0x7760, 0x7762, - /* 0x4f */ - 0x7764, 0x7767, 0x776a, 0x776c, 0x7770, 0x7772, 0x7773, 0x7774, - 0x777a, 0x777d, 0x7780, 0x7784, 0x778c, 0x778d, 0x7794, 0x7795, - 0x7796, 0x779a, 0x779f, 0x77a2, 0x77a7, 0x77aa, 0x77ae, 0x77af, - 0x77b1, 0x77b5, 0x77be, 0x77c3, 0x77c9, 0x77d1, 0x77d2, 0x77d5, - 0x77d9, 0x77de, 0x77df, 0x77e0, 0x77e4, 0x77e6, 0x77ea, 0x77ec, - 0x77f0, 0x77f1, 0x77f4, 0x77f8, 0x77fb, 0x7805, 0x7806, 0x7809, - 0x780d, 0x780e, 0x7811, 0x781d, 0x7821, 0x7822, 0x7823, 0x782d, - 0x782e, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847, 0x7848, - 0x784c, 0x784e, 0x7852, 0x785c, 0x785e, 0x7860, 0x7861, 0x7863, - 0x7864, 0x7868, 0x786a, 0x786e, 0x787a, 0x787e, 0x788a, 0x788f, - 0x7894, 0x7898, 0x78a1, 0x789d, 0x789e, 0x789f, 0x78a4, 0x78a8, - 0x78ac, 0x78ad, 0x78b0, 0x78b1, 0x78b2, 0x78b3, - /* 0x50 */ - 0x78bb, 0x78bd, 0x78bf, 0x78c7, 0x78c8, 0x78c9, 0x78cc, 0x78ce, - 0x78d2, 0x78d3, 0x78d5, 0x78d6, 0x78e4, 0x78db, 0x78df, 0x78e0, - 0x78e1, 0x78e6, 0x78ea, 0x78f2, 0x78f3, 0x7900, 0x78f6, 0x78f7, - 0x78fa, 0x78fb, 0x78ff, 0x7906, 0x790c, 0x7910, 0x791a, 0x791c, - 0x791e, 0x791f, 0x7920, 0x7925, 0x7927, 0x7929, 0x792d, 0x7931, - 0x7934, 0x7935, 0x793b, 0x793d, 0x793f, 0x7944, 0x7945, 0x7946, - 0x794a, 0x794b, 0x794f, 0x7951, 0x7954, 0x7958, 0x795b, 0x795c, - 0x7967, 0x7969, 0x796b, 0x7972, 0x7979, 0x797b, 0x797c, 0x797e, - 0x798b, 0x798c, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996, 0x7998, - 0x799b, 0x799c, 0x79a1, 0x79a8, 0x79a9, 0x79ab, 0x79af, 0x79b1, - 0x79b4, 0x79b8, 0x79bb, 0x79c2, 0x79c4, 0x79c7, 0x79c8, 0x79ca, - 0x79cf, 0x79d4, 0x79d6, 0x79da, 0x79dd, 0x79de, - /* 0x51 */ - 0x79e0, 0x79e2, 0x79e5, 0x79ea, 0x79eb, 0x79ed, 0x79f1, 0x79f8, - 0x79fc, 0x7a02, 0x7a03, 0x7a07, 0x7a09, 0x7a0a, 0x7a0c, 0x7a11, - 0x7a15, 0x7a1b, 0x7a1e, 0x7a21, 0x7a27, 0x7a2b, 0x7a2d, 0x7a2f, - 0x7a30, 0x7a34, 0x7a35, 0x7a38, 0x7a39, 0x7a3a, 0x7a44, 0x7a45, - 0x7a47, 0x7a48, 0x7a4c, 0x7a55, 0x7a56, 0x7a59, 0x7a5c, 0x7a5d, - 0x7a5f, 0x7a60, 0x7a65, 0x7a67, 0x7a6a, 0x7a6d, 0x7a75, 0x7a78, - 0x7a7e, 0x7a80, 0x7a82, 0x7a85, 0x7a86, 0x7a8a, 0x7a8b, 0x7a90, - 0x7a91, 0x7a94, 0x7a9e, 0x7aa0, 0x7aa3, 0x7aac, 0x7ab3, 0x7ab5, - 0x7ab9, 0x7abb, 0x7abc, 0x7ac6, 0x7ac9, 0x7acc, 0x7ace, 0x7ad1, - 0x7adb, 0x7ae8, 0x7ae9, 0x7aeb, 0x7aec, 0x7af1, 0x7af4, 0x7afb, - 0x7afd, 0x7afe, 0x7b07, 0x7b14, 0x7b1f, 0x7b23, 0x7b27, 0x7b29, - 0x7b2a, 0x7b2b, 0x7b2d, 0x7b2e, 0x7b2f, 0x7b30, - /* 0x52 */ - 0x7b31, 0x7b34, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b47, 0x7b4e, - 0x7b55, 0x7b60, 0x7b64, 0x7b66, 0x7b69, 0x7b6a, 0x7b6d, 0x7b6f, - 0x7b72, 0x7b73, 0x7b77, 0x7b84, 0x7b89, 0x7b8e, 0x7b90, 0x7b91, - 0x7b96, 0x7b9b, 0x7b9e, 0x7ba0, 0x7ba5, 0x7bac, 0x7baf, 0x7bb0, - 0x7bb2, 0x7bb5, 0x7bb6, 0x7bba, 0x7bbb, 0x7bbc, 0x7bbd, 0x7bc2, - 0x7bc5, 0x7bc8, 0x7bca, 0x7bd4, 0x7bd6, 0x7bd7, 0x7bd9, 0x7bda, - 0x7bdb, 0x7be8, 0x7bea, 0x7bf2, 0x7bf4, 0x7bf5, 0x7bf8, 0x7bf9, - 0x7bfa, 0x7bfc, 0x7bfe, 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c06, - 0x7c09, 0x7c0b, 0x7c0c, 0x7c0e, 0x7c0f, 0x7c19, 0x7c1b, 0x7c20, - 0x7c25, 0x7c26, 0x7c28, 0x7c2c, 0x7c31, 0x7c33, 0x7c34, 0x7c36, - 0x7c39, 0x7c3a, 0x7c46, 0x7c4a, 0x7c55, 0x7c51, 0x7c52, 0x7c53, - 0x7c59, 0x7c5a, 0x7c5b, 0x7c5c, 0x7c5d, 0x7c5e, - /* 0x53 */ - 0x7c61, 0x7c63, 0x7c67, 0x7c69, 0x7c6d, 0x7c6e, 0x7c70, 0x7c72, - 0x7c79, 0x7c7c, 0x7c7d, 0x7c86, 0x7c87, 0x7c8f, 0x7c94, 0x7c9e, - 0x7ca0, 0x7ca6, 0x7cb0, 0x7cb6, 0x7cb7, 0x7cba, 0x7cbb, 0x7cbc, - 0x7cbf, 0x7cc4, 0x7cc7, 0x7cc8, 0x7cc9, 0x7ccd, 0x7ccf, 0x7cd3, - 0x7cd4, 0x7cd5, 0x7cd7, 0x7cd9, 0x7cda, 0x7cdd, 0x7ce6, 0x7ce9, - 0x7ceb, 0x7cf5, 0x7d03, 0x7d07, 0x7d08, 0x7d09, 0x7d0f, 0x7d11, - 0x7d12, 0x7d13, 0x7d16, 0x7d1d, 0x7d1e, 0x7d23, 0x7d26, 0x7d2a, - 0x7d2d, 0x7d31, 0x7d3c, 0x7d3d, 0x7d3e, 0x7d40, 0x7d41, 0x7d47, - 0x7d48, 0x7d4d, 0x7d51, 0x7d53, 0x7d57, 0x7d59, 0x7d5a, 0x7d5c, - 0x7d5d, 0x7d65, 0x7d67, 0x7d6a, 0x7d70, 0x7d78, 0x7d7a, 0x7d7b, - 0x7d7f, 0x7d81, 0x7d82, 0x7d83, 0x7d85, 0x7d86, 0x7d88, 0x7d8b, - 0x7d8c, 0x7d8d, 0x7d91, 0x7d96, 0x7d97, 0x7d9d, - /* 0x54 */ - 0x7d9e, 0x7da6, 0x7da7, 0x7daa, 0x7db3, 0x7db6, 0x7db7, 0x7db9, - 0x7dc2, 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dcc, 0x7dcd, 0x7dce, - 0x7dd7, 0x7dd9, 0x7e00, 0x7de2, 0x7de5, 0x7de6, 0x7dea, 0x7deb, - 0x7ded, 0x7df1, 0x7df5, 0x7df6, 0x7df9, 0x7dfa, 0x7e08, 0x7e10, - 0x7e11, 0x7e15, 0x7e17, 0x7e1c, 0x7e1d, 0x7e20, 0x7e27, 0x7e28, - 0x7e2c, 0x7e2d, 0x7e2f, 0x7e33, 0x7e36, 0x7e3f, 0x7e44, 0x7e45, - 0x7e47, 0x7e4e, 0x7e50, 0x7e52, 0x7e58, 0x7e5f, 0x7e61, 0x7e62, - 0x7e65, 0x7e6b, 0x7e6e, 0x7e6f, 0x7e73, 0x7e78, 0x7e7e, 0x7e81, - 0x7e86, 0x7e87, 0x7e8a, 0x7e8d, 0x7e91, 0x7e95, 0x7e98, 0x7e9a, - 0x7e9d, 0x7e9e, 0x7f3c, 0x7f3b, 0x7f3d, 0x7f3e, 0x7f3f, 0x7f43, - 0x7f44, 0x7f47, 0x7f4f, 0x7f52, 0x7f53, 0x7f5b, 0x7f5c, 0x7f5d, - 0x7f61, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f6d, - /* 0x55 */ - 0x7f71, 0x7f7d, 0x7f7e, 0x7f7f, 0x7f80, 0x7f8b, 0x7f8d, 0x7f8f, - 0x7f90, 0x7f91, 0x7f96, 0x7f97, 0x7f9c, 0x7fa1, 0x7fa2, 0x7fa6, - 0x7faa, 0x7fad, 0x7fb4, 0x7fbc, 0x7fbf, 0x7fc0, 0x7fc3, 0x7fc8, - 0x7fce, 0x7fcf, 0x7fdb, 0x7fdf, 0x7fe3, 0x7fe5, 0x7fe8, 0x7fec, - 0x7fee, 0x7fef, 0x7ff2, 0x7ffa, 0x7ffd, 0x7ffe, 0x7fff, 0x8007, - 0x8008, 0x800a, 0x800d, 0x800e, 0x800f, 0x8011, 0x8013, 0x8014, - 0x8016, 0x801d, 0x801e, 0x801f, 0x8020, 0x8024, 0x8026, 0x802c, - 0x802e, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803a, 0x803c, - 0x803e, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806d, 0x8071, - 0x8075, 0x8081, 0x8088, 0x808e, 0x809c, 0x809e, 0x80a6, 0x80a7, - 0x80ab, 0x80b8, 0x80b9, 0x80c8, 0x80cd, 0x80cf, 0x80d2, 0x80d4, - 0x80d5, 0x80d7, 0x80d8, 0x80e0, 0x80ed, 0x80ee, - /* 0x56 */ - 0x80f0, 0x80f2, 0x80f3, 0x80f6, 0x80f9, 0x80fa, 0x80fe, 0x8103, - 0x810b, 0x8116, 0x8117, 0x8118, 0x811c, 0x811e, 0x8120, 0x8124, - 0x8127, 0x812c, 0x8130, 0x8135, 0x813a, 0x813c, 0x8145, 0x8147, - 0x814a, 0x814c, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167, 0x8168, - 0x8169, 0x816d, 0x816f, 0x8177, 0x8181, 0x8190, 0x8184, 0x8185, - 0x8186, 0x818b, 0x818e, 0x8196, 0x8198, 0x819b, 0x819e, 0x81a2, - 0x81ae, 0x81b2, 0x81b4, 0x81bb, 0x81cb, 0x81c3, 0x81c5, 0x81ca, - 0x81ce, 0x81cf, 0x81d5, 0x81d7, 0x81db, 0x81dd, 0x81de, 0x81e1, - 0x81e4, 0x81eb, 0x81ec, 0x81f0, 0x81f1, 0x81f2, 0x81f5, 0x81f6, - 0x81f8, 0x81f9, 0x81fd, 0x81ff, 0x8200, 0x8203, 0x820f, 0x8213, - 0x8214, 0x8219, 0x821a, 0x821d, 0x8221, 0x8222, 0x8228, 0x8232, - 0x8234, 0x823a, 0x8243, 0x8244, 0x8245, 0x8246, - /* 0x57 */ - 0x824b, 0x824e, 0x824f, 0x8251, 0x8256, 0x825c, 0x8260, 0x8263, - 0x8267, 0x826d, 0x8274, 0x827b, 0x827d, 0x827f, 0x8280, 0x8281, - 0x8283, 0x8284, 0x8287, 0x8289, 0x828a, 0x828e, 0x8291, 0x8294, - 0x8296, 0x8298, 0x829a, 0x829b, 0x82a0, 0x82a1, 0x82a3, 0x82a4, - 0x82a7, 0x82a8, 0x82a9, 0x82aa, 0x82ae, 0x82b0, 0x82b2, 0x82b4, - 0x82b7, 0x82ba, 0x82bc, 0x82be, 0x82bf, 0x82c6, 0x82d0, 0x82d5, - 0x82da, 0x82e0, 0x82e2, 0x82e4, 0x82e8, 0x82ea, 0x82ed, 0x82ef, - 0x82f6, 0x82f7, 0x82fd, 0x82fe, 0x8300, 0x8301, 0x8307, 0x8308, - 0x830a, 0x830b, 0x8354, 0x831b, 0x831d, 0x831e, 0x831f, 0x8321, - 0x8322, 0x832c, 0x832d, 0x832e, 0x8330, 0x8333, 0x8337, 0x833a, - 0x833c, 0x833d, 0x8342, 0x8343, 0x8344, 0x8347, 0x834d, 0x834e, - 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378, - /* 0x58 */ - 0x837d, 0x837f, 0x8380, 0x8382, 0x8384, 0x8386, 0x838d, 0x8392, - 0x8394, 0x8395, 0x8398, 0x8399, 0x839b, 0x839c, 0x839d, 0x83a6, - 0x83a7, 0x83a9, 0x83ac, 0x83be, 0x83bf, 0x83c0, 0x83c7, 0x83c9, - 0x83cf, 0x83d0, 0x83d1, 0x83d4, 0x83dd, 0x8353, 0x83e8, 0x83ea, - 0x83f6, 0x83f8, 0x83f9, 0x83fc, 0x8401, 0x8406, 0x840a, 0x840f, - 0x8411, 0x8415, 0x8419, 0x83ad, 0x842f, 0x8439, 0x8445, 0x8447, - 0x8448, 0x844a, 0x844d, 0x844f, 0x8451, 0x8452, 0x8456, 0x8458, - 0x8459, 0x845a, 0x845c, 0x8460, 0x8464, 0x8465, 0x8467, 0x846a, - 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847c, 0x847d, 0x8481, - 0x8485, 0x8492, 0x8493, 0x8495, 0x849e, 0x84a6, 0x84a8, 0x84a9, - 0x84aa, 0x84af, 0x84b1, 0x84b4, 0x84ba, 0x84bd, 0x84be, 0x84c0, - 0x84c2, 0x84c7, 0x84c8, 0x84cc, 0x84cf, 0x84d3, - /* 0x59 */ - 0x84dc, 0x84e7, 0x84ea, 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f7, - 0x8532, 0x84fa, 0x84fb, 0x84fd, 0x8502, 0x8503, 0x8507, 0x850c, - 0x850e, 0x8510, 0x851c, 0x851e, 0x8522, 0x8523, 0x8524, 0x8525, - 0x8527, 0x852a, 0x852b, 0x852f, 0x8533, 0x8534, 0x8536, 0x853f, - 0x8546, 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556, 0x8559, - 0x855c, 0x855d, 0x855e, 0x855f, 0x8560, 0x8561, 0x8562, 0x8564, - 0x856b, 0x856f, 0x8579, 0x857a, 0x857b, 0x857d, 0x857f, 0x8581, - 0x8585, 0x8586, 0x8589, 0x858b, 0x858c, 0x858f, 0x8593, 0x8598, - 0x859d, 0x859f, 0x85a0, 0x85a2, 0x85a5, 0x85a7, 0x85b4, 0x85b6, - 0x85b7, 0x85b8, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c2, 0x85c7, - 0x85ca, 0x85cb, 0x85ce, 0x85ad, 0x85d8, 0x85da, 0x85df, 0x85e0, - 0x85e6, 0x85e8, 0x85ed, 0x85f3, 0x85f6, 0x85fc, - /* 0x5a */ - 0x85ff, 0x8600, 0x8604, 0x8605, 0x860d, 0x860e, 0x8610, 0x8611, - 0x8612, 0x8618, 0x8619, 0x861b, 0x861e, 0x8621, 0x8627, 0x8629, - 0x8636, 0x8638, 0x863a, 0x863c, 0x863d, 0x8640, 0x8642, 0x8646, - 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865d, 0x8660, - 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866c, 0x866f, 0x8675, - 0x8676, 0x8677, 0x867a, 0x868d, 0x8691, 0x8696, 0x8698, 0x869a, - 0x869c, 0x86a1, 0x86a6, 0x86a7, 0x86a8, 0x86ad, 0x86b1, 0x86b3, - 0x86b4, 0x86b5, 0x86b7, 0x86b8, 0x86b9, 0x86bf, 0x86c0, 0x86c1, - 0x86c3, 0x86c5, 0x86d1, 0x86d2, 0x86d5, 0x86d7, 0x86da, 0x86dc, - 0x86e0, 0x86e3, 0x86e5, 0x86e7, 0x8688, 0x86fa, 0x86fc, 0x86fd, - 0x8704, 0x8705, 0x8707, 0x870b, 0x870e, 0x870f, 0x8710, 0x8713, - 0x8714, 0x8719, 0x871e, 0x871f, 0x8721, 0x8723, - /* 0x5b */ - 0x8728, 0x872e, 0x872f, 0x8731, 0x8732, 0x8739, 0x873a, 0x873c, - 0x873d, 0x873e, 0x8740, 0x8743, 0x8745, 0x874d, 0x8758, 0x875d, - 0x8761, 0x8764, 0x8765, 0x876f, 0x8771, 0x8772, 0x877b, 0x8783, - 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878b, 0x878c, - 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879e, 0x87a0, - 0x87a3, 0x87a7, 0x87ac, 0x87ad, 0x87ae, 0x87b1, 0x87b5, 0x87be, - 0x87bf, 0x87c1, 0x87c8, 0x87c9, 0x87ca, 0x87ce, 0x87d5, 0x87d6, - 0x87d9, 0x87da, 0x87dc, 0x87df, 0x87e2, 0x87e3, 0x87e4, 0x87ea, - 0x87eb, 0x87ed, 0x87f1, 0x87f3, 0x87f8, 0x87fa, 0x87ff, 0x8801, - 0x8803, 0x8806, 0x8809, 0x880a, 0x880b, 0x8810, 0x8819, 0x8812, - 0x8813, 0x8814, 0x8818, 0x881a, 0x881b, 0x881c, 0x881e, 0x881f, - 0x8828, 0x882d, 0x882e, 0x8830, 0x8832, 0x8835, - /* 0x5c */ - 0x883a, 0x883c, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849, 0x884a, - 0x884b, 0x884e, 0x8851, 0x8855, 0x8856, 0x8858, 0x885a, 0x885c, - 0x885f, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887b, 0x8880, - 0x8898, 0x889a, 0x889b, 0x889c, 0x889f, 0x88a0, 0x88a8, 0x88aa, - 0x88ba, 0x88bd, 0x88be, 0x88c0, 0x88ca, 0x88cb, 0x88cc, 0x88cd, - 0x88ce, 0x88d1, 0x88d2, 0x88d3, 0x88db, 0x88de, 0x88e7, 0x88ef, - 0x88f0, 0x88f1, 0x88f5, 0x88f7, 0x8901, 0x8906, 0x890d, 0x890e, - 0x890f, 0x8915, 0x8916, 0x8918, 0x8919, 0x891a, 0x891c, 0x8920, - 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935, 0x8939, - 0x893a, 0x893e, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949, 0x894f, - 0x8952, 0x8957, 0x895a, 0x895b, 0x895c, 0x8961, 0x8962, 0x8963, - 0x896b, 0x896e, 0x8970, 0x8973, 0x8975, 0x897a, - /* 0x5d */ - 0x897b, 0x897c, 0x897d, 0x8989, 0x898d, 0x8990, 0x8994, 0x8995, - 0x899b, 0x899c, 0x899f, 0x89a0, 0x89a5, 0x89b0, 0x89b4, 0x89b5, - 0x89b6, 0x89b7, 0x89bc, 0x89d4, 0x89d5, 0x89d6, 0x89d7, 0x89d8, - 0x89e5, 0x89e9, 0x89eb, 0x89ed, 0x89f1, 0x89f3, 0x89f6, 0x89f9, - 0x89fd, 0x89ff, 0x8a04, 0x8a05, 0x8a07, 0x8a0f, 0x8a11, 0x8a12, - 0x8a14, 0x8a15, 0x8a1e, 0x8a20, 0x8a22, 0x8a24, 0x8a26, 0x8a2b, - 0x8a2c, 0x8a2f, 0x8a35, 0x8a37, 0x8a3d, 0x8a3e, 0x8a40, 0x8a43, - 0x8a45, 0x8a47, 0x8a49, 0x8a4d, 0x8a4e, 0x8a53, 0x8a56, 0x8a57, - 0x8a58, 0x8a5c, 0x8a5d, 0x8a61, 0x8a65, 0x8a67, 0x8a75, 0x8a76, - 0x8a77, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7e, 0x8a7f, 0x8a80, 0x8a83, - 0x8a86, 0x8a8b, 0x8a8f, 0x8a90, 0x8a92, 0x8a96, 0x8a97, 0x8a99, - 0x8a9f, 0x8aa7, 0x8aa9, 0x8aae, 0x8aaf, 0x8ab3, - /* 0x5e */ - 0x8ab6, 0x8ab7, 0x8abb, 0x8abe, 0x8ac3, 0x8ac6, 0x8ac8, 0x8ac9, - 0x8aca, 0x8ad1, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad7, 0x8add, 0x8adf, - 0x8aec, 0x8af0, 0x8af4, 0x8af5, 0x8af6, 0x8afc, 0x8aff, 0x8b05, - 0x8b06, 0x8b0b, 0x8b11, 0x8b1c, 0x8b1e, 0x8b1f, 0x8b0a, 0x8b2d, - 0x8b30, 0x8b37, 0x8b3c, 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, - 0x8b48, 0x8b52, 0x8b53, 0x8b54, 0x8b59, 0x8b4d, 0x8b5e, 0x8b63, - 0x8b6d, 0x8b76, 0x8b78, 0x8b79, 0x8b7c, 0x8b7e, 0x8b81, 0x8b84, - 0x8b85, 0x8b8b, 0x8b8d, 0x8b8f, 0x8b94, 0x8b95, 0x8b9c, 0x8b9e, - 0x8b9f, 0x8c38, 0x8c39, 0x8c3d, 0x8c3e, 0x8c45, 0x8c47, 0x8c49, - 0x8c4b, 0x8c4f, 0x8c51, 0x8c53, 0x8c54, 0x8c57, 0x8c58, 0x8c5b, - 0x8c5d, 0x8c59, 0x8c63, 0x8c64, 0x8c66, 0x8c68, 0x8c69, 0x8c6d, - 0x8c73, 0x8c75, 0x8c76, 0x8c7b, 0x8c7e, 0x8c86, - /* 0x5f */ - 0x8c87, 0x8c8b, 0x8c90, 0x8c92, 0x8c93, 0x8c99, 0x8c9b, 0x8c9c, - 0x8ca4, 0x8cb9, 0x8cba, 0x8cc5, 0x8cc6, 0x8cc9, 0x8ccb, 0x8ccf, - 0x8cd6, 0x8cd5, 0x8cd9, 0x8cdd, 0x8ce1, 0x8ce8, 0x8cec, 0x8cef, - 0x8cf0, 0x8cf2, 0x8cf5, 0x8cf7, 0x8cf8, 0x8cfe, 0x8cff, 0x8d01, - 0x8d03, 0x8d09, 0x8d12, 0x8d17, 0x8d1b, 0x8d65, 0x8d69, 0x8d6c, - 0x8d6e, 0x8d7f, 0x8d82, 0x8d84, 0x8d88, 0x8d8d, 0x8d90, 0x8d91, - 0x8d95, 0x8d9e, 0x8d9f, 0x8da0, 0x8da6, 0x8dab, 0x8dac, 0x8daf, - 0x8db2, 0x8db5, 0x8db7, 0x8db9, 0x8dbb, 0x8dc0, 0x8dc5, 0x8dc6, - 0x8dc7, 0x8dc8, 0x8dca, 0x8dce, 0x8dd1, 0x8dd4, 0x8dd5, 0x8dd7, - 0x8dd9, 0x8de4, 0x8de5, 0x8de7, 0x8dec, 0x8df0, 0x8dbc, 0x8df1, - 0x8df2, 0x8df4, 0x8dfd, 0x8e01, 0x8e04, 0x8e05, 0x8e06, 0x8e0b, - 0x8e11, 0x8e14, 0x8e16, 0x8e20, 0x8e21, 0x8e22, - /* 0x60 */ - 0x8e23, 0x8e26, 0x8e27, 0x8e31, 0x8e33, 0x8e36, 0x8e37, 0x8e38, - 0x8e39, 0x8e3d, 0x8e40, 0x8e41, 0x8e4b, 0x8e4d, 0x8e4e, 0x8e4f, - 0x8e54, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e61, 0x8e62, 0x8e69, - 0x8e6c, 0x8e6d, 0x8e6f, 0x8e70, 0x8e71, 0x8e79, 0x8e7a, 0x8e7b, - 0x8e82, 0x8e83, 0x8e89, 0x8e90, 0x8e92, 0x8e95, 0x8e9a, 0x8e9b, - 0x8e9d, 0x8e9e, 0x8ea2, 0x8ea7, 0x8ea9, 0x8ead, 0x8eae, 0x8eb3, - 0x8eb5, 0x8eba, 0x8ebb, 0x8ec0, 0x8ec1, 0x8ec3, 0x8ec4, 0x8ec7, - 0x8ecf, 0x8ed1, 0x8ed4, 0x8edc, 0x8ee8, 0x8eee, 0x8ef0, 0x8ef1, - 0x8ef7, 0x8ef9, 0x8efa, 0x8eed, 0x8f00, 0x8f02, 0x8f07, 0x8f08, - 0x8f0f, 0x8f10, 0x8f16, 0x8f17, 0x8f18, 0x8f1e, 0x8f20, 0x8f21, - 0x8f23, 0x8f25, 0x8f27, 0x8f28, 0x8f2c, 0x8f2d, 0x8f2e, 0x8f34, - 0x8f35, 0x8f36, 0x8f37, 0x8f3a, 0x8f40, 0x8f41, - /* 0x61 */ - 0x8f43, 0x8f47, 0x8f4f, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, - 0x8f58, 0x8f5d, 0x8f5e, 0x8f65, 0x8f9d, 0x8fa0, 0x8fa1, 0x8fa4, - 0x8fa5, 0x8fa6, 0x8fb5, 0x8fb6, 0x8fb8, 0x8fbe, 0x8fc0, 0x8fc1, - 0x8fc6, 0x8fca, 0x8fcb, 0x8fcd, 0x8fd0, 0x8fd2, 0x8fd3, 0x8fd5, - 0x8fe0, 0x8fe3, 0x8fe4, 0x8fe8, 0x8fee, 0x8ff1, 0x8ff5, 0x8ff6, - 0x8ffb, 0x8ffe, 0x9002, 0x9004, 0x9008, 0x900c, 0x9018, 0x901b, - 0x9028, 0x9029, 0x902f, 0x902a, 0x902c, 0x902d, 0x9033, 0x9034, - 0x9037, 0x903f, 0x9043, 0x9044, 0x904c, 0x905b, 0x905d, 0x9062, - 0x9066, 0x9067, 0x906c, 0x9070, 0x9074, 0x9079, 0x9085, 0x9088, - 0x908b, 0x908c, 0x908e, 0x9090, 0x9095, 0x9097, 0x9098, 0x9099, - 0x909b, 0x90a0, 0x90a1, 0x90a2, 0x90a5, 0x90b0, 0x90b2, 0x90b3, - 0x90b4, 0x90b6, 0x90bd, 0x90cc, 0x90be, 0x90c3, - /* 0x62 */ - 0x90c4, 0x90c5, 0x90c7, 0x90c8, 0x90d5, 0x90d7, 0x90d8, 0x90d9, - 0x90dc, 0x90dd, 0x90df, 0x90e5, 0x90d2, 0x90f6, 0x90eb, 0x90ef, - 0x90f0, 0x90f4, 0x90fe, 0x90ff, 0x9100, 0x9104, 0x9105, 0x9106, - 0x9108, 0x910d, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118, 0x911a, - 0x911c, 0x911e, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127, 0x9129, - 0x912e, 0x912f, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139, 0x913a, - 0x913c, 0x913d, 0x9143, 0x9147, 0x9148, 0x914f, 0x9153, 0x9157, - 0x9159, 0x915a, 0x915b, 0x9161, 0x9164, 0x9167, 0x916d, 0x9174, - 0x9179, 0x917a, 0x917b, 0x9181, 0x9183, 0x9185, 0x9186, 0x918a, - 0x918e, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919e, 0x91a1, - 0x91a6, 0x91a8, 0x91ac, 0x91ad, 0x91ae, 0x91b0, 0x91b1, 0x91b2, - 0x91b3, 0x91b6, 0x91bb, 0x91bc, 0x91bd, 0x91bf, - /* 0x63 */ - 0x91c2, 0x91c3, 0x91c5, 0x91d3, 0x91d4, 0x91d7, 0x91d9, 0x91da, - 0x91de, 0x91e4, 0x91e5, 0x91e9, 0x91ea, 0x91ec, 0x91ed, 0x91ee, - 0x91ef, 0x91f0, 0x91f1, 0x91f7, 0x91f9, 0x91fb, 0x91fd, 0x9200, - 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920a, 0x920c, - 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921c, 0x921d, 0x9223, - 0x9224, 0x9225, 0x9226, 0x9228, 0x922e, 0x922f, 0x9230, 0x9233, - 0x9235, 0x9236, 0x9238, 0x9239, 0x923a, 0x923c, 0x923e, 0x9240, - 0x9242, 0x9243, 0x9246, 0x9247, 0x924a, 0x924d, 0x924e, 0x924f, - 0x9251, 0x9258, 0x9259, 0x925c, 0x925d, 0x9260, 0x9261, 0x9265, - 0x9267, 0x9268, 0x9269, 0x926e, 0x926f, 0x9270, 0x9275, 0x9276, - 0x9277, 0x9278, 0x9279, 0x927b, 0x927c, 0x927d, 0x927f, 0x9288, - 0x9289, 0x928a, 0x928d, 0x928e, 0x9292, 0x9297, - /* 0x64 */ - 0x9299, 0x929f, 0x92a0, 0x92a4, 0x92a5, 0x92a7, 0x92a8, 0x92ab, - 0x92af, 0x92b2, 0x92b6, 0x92b8, 0x92ba, 0x92bb, 0x92bc, 0x92bd, - 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c5, 0x92c6, 0x92c7, - 0x92c8, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92d0, 0x92d3, 0x92d5, - 0x92d7, 0x92d8, 0x92d9, 0x92dc, 0x92dd, 0x92df, 0x92e0, 0x92e1, - 0x92e3, 0x92e5, 0x92e7, 0x92e8, 0x92ec, 0x92ee, 0x92f0, 0x92f9, - 0x92fb, 0x92ff, 0x9300, 0x9302, 0x9308, 0x930d, 0x9311, 0x9314, - 0x9315, 0x931c, 0x931d, 0x931e, 0x931f, 0x9321, 0x9324, 0x9325, - 0x9327, 0x9329, 0x932a, 0x9333, 0x9334, 0x9336, 0x9337, 0x9347, - 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357, 0x9358, - 0x935a, 0x935e, 0x9364, 0x9365, 0x9367, 0x9369, 0x936a, 0x936d, - 0x936f, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376, - /* 0x65 */ - 0x937a, 0x937d, 0x937f, 0x9380, 0x9381, 0x9382, 0x9388, 0x938a, - 0x938b, 0x938d, 0x938f, 0x9392, 0x9395, 0x9398, 0x939b, 0x939e, - 0x93a1, 0x93a3, 0x93a4, 0x93a6, 0x93a8, 0x93ab, 0x93b4, 0x93b5, - 0x93b6, 0x93ba, 0x93a9, 0x93c1, 0x93c4, 0x93c5, 0x93c6, 0x93c7, - 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, 0x93d3, 0x93d9, 0x93dc, - 0x93de, 0x93df, 0x93e2, 0x93e6, 0x93e7, 0x93f9, 0x93f7, 0x93f8, - 0x93fa, 0x93fb, 0x93fd, 0x9401, 0x9402, 0x9404, 0x9408, 0x9409, - 0x940d, 0x940e, 0x940f, 0x9415, 0x9416, 0x9417, 0x941f, 0x942e, - 0x942f, 0x9431, 0x9432, 0x9433, 0x9434, 0x943b, 0x943f, 0x943d, - 0x9443, 0x9445, 0x9448, 0x944a, 0x944c, 0x9455, 0x9459, 0x945c, - 0x945f, 0x9461, 0x9463, 0x9468, 0x946b, 0x946d, 0x946e, 0x946f, - 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579, - /* 0x66 */ - 0x957e, 0x9584, 0x9588, 0x958c, 0x958d, 0x958e, 0x959d, 0x959e, - 0x959f, 0x95a1, 0x95a6, 0x95a9, 0x95ab, 0x95ac, 0x95b4, 0x95b6, - 0x95ba, 0x95bd, 0x95bf, 0x95c6, 0x95c8, 0x95c9, 0x95cb, 0x95d0, - 0x95d1, 0x95d2, 0x95d3, 0x95d9, 0x95da, 0x95dd, 0x95de, 0x95df, - 0x95e0, 0x95e4, 0x95e6, 0x961d, 0x961e, 0x9622, 0x9624, 0x9625, - 0x9626, 0x962c, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639, 0x963a, - 0x963c, 0x963d, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657, 0x9658, - 0x9661, 0x966e, 0x9674, 0x967b, 0x967c, 0x967e, 0x967f, 0x9681, - 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969a, 0x969d, - 0x969f, 0x96a4, 0x96a5, 0x96a6, 0x96a9, 0x96ae, 0x96af, 0x96b3, - 0x96ba, 0x96ca, 0x96d2, 0x5db2, 0x96d8, 0x96da, 0x96dd, 0x96de, - 0x96df, 0x96e9, 0x96ef, 0x96f1, 0x96fa, 0x9702, - /* 0x67 */ - 0x9703, 0x9705, 0x9709, 0x971a, 0x971b, 0x971d, 0x9721, 0x9722, - 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974a, 0x974e, - 0x974f, 0x9755, 0x9757, 0x9758, 0x975a, 0x975b, 0x9763, 0x9767, - 0x976a, 0x976e, 0x9773, 0x9776, 0x9777, 0x9778, 0x977b, 0x977d, - 0x977f, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799, 0x979a, - 0x979e, 0x979f, 0x97a2, 0x97ac, 0x97ae, 0x97b1, 0x97b2, 0x97b5, - 0x97b6, 0x97b8, 0x97b9, 0x97ba, 0x97bc, 0x97be, 0x97bf, 0x97c1, - 0x97c4, 0x97c5, 0x97c7, 0x97c9, 0x97ca, 0x97cc, 0x97cd, 0x97ce, - 0x97d0, 0x97d1, 0x97d4, 0x97d7, 0x97d8, 0x97d9, 0x97dd, 0x97de, - 0x97e0, 0x97db, 0x97e1, 0x97e4, 0x97ef, 0x97f1, 0x97f4, 0x97f7, - 0x97f8, 0x97fa, 0x9807, 0x980a, 0x9819, 0x980d, 0x980e, 0x9814, - 0x9816, 0x981c, 0x981e, 0x9820, 0x9823, 0x9826, - /* 0x68 */ - 0x982b, 0x982e, 0x982f, 0x9830, 0x9832, 0x9833, 0x9835, 0x9825, - 0x983e, 0x9844, 0x9847, 0x984a, 0x9851, 0x9852, 0x9853, 0x9856, - 0x9857, 0x9859, 0x985a, 0x9862, 0x9863, 0x9865, 0x9866, 0x986a, - 0x986c, 0x98ab, 0x98ad, 0x98ae, 0x98b0, 0x98b4, 0x98b7, 0x98b8, - 0x98ba, 0x98bb, 0x98bf, 0x98c2, 0x98c5, 0x98c8, 0x98cc, 0x98e1, - 0x98e3, 0x98e5, 0x98e6, 0x98e7, 0x98ea, 0x98f3, 0x98f6, 0x9902, - 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991a, 0x991b, - 0x991c, 0x991f, 0x9922, 0x9926, 0x9927, 0x992b, 0x9931, 0x9932, - 0x9933, 0x9934, 0x9935, 0x9939, 0x993a, 0x993b, 0x993c, 0x9940, - 0x9941, 0x9946, 0x9947, 0x9948, 0x994d, 0x994e, 0x9954, 0x9958, - 0x9959, 0x995b, 0x995c, 0x995e, 0x995f, 0x9960, 0x999b, 0x999d, - 0x999f, 0x99a6, 0x99b0, 0x99b1, 0x99b2, 0x99b5, - /* 0x69 */ - 0x99b9, 0x99ba, 0x99bd, 0x99bf, 0x99c3, 0x99c9, 0x99d3, 0x99d4, - 0x99d9, 0x99da, 0x99dc, 0x99de, 0x99e7, 0x99ea, 0x99eb, 0x99ec, - 0x99f0, 0x99f4, 0x99f5, 0x99f9, 0x99fd, 0x99fe, 0x9a02, 0x9a03, - 0x9a04, 0x9a0b, 0x9a0c, 0x9a10, 0x9a11, 0x9a16, 0x9a1e, 0x9a20, - 0x9a22, 0x9a23, 0x9a24, 0x9a27, 0x9a2d, 0x9a2e, 0x9a33, 0x9a35, - 0x9a36, 0x9a38, 0x9a47, 0x9a41, 0x9a44, 0x9a4a, 0x9a4b, 0x9a4c, - 0x9a4e, 0x9a51, 0x9a54, 0x9a56, 0x9a5d, 0x9aaa, 0x9aac, 0x9aae, - 0x9aaf, 0x9ab2, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab9, 0x9abb, 0x9abe, - 0x9abf, 0x9ac1, 0x9ac3, 0x9ac6, 0x9ac8, 0x9ace, 0x9ad0, 0x9ad2, - 0x9ad5, 0x9ad6, 0x9ad7, 0x9adb, 0x9adc, 0x9ae0, 0x9ae4, 0x9ae5, - 0x9ae7, 0x9ae9, 0x9aec, 0x9af2, 0x9af3, 0x9af5, 0x9af9, 0x9afa, - 0x9afd, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b03, - /* 0x6a */ - 0x9b04, 0x9b05, 0x9b08, 0x9b09, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, - 0x9b10, 0x9b12, 0x9b16, 0x9b19, 0x9b1b, 0x9b1c, 0x9b20, 0x9b26, - 0x9b2b, 0x9b2d, 0x9b33, 0x9b34, 0x9b35, 0x9b37, 0x9b39, 0x9b3a, - 0x9b3d, 0x9b48, 0x9b4b, 0x9b4c, 0x9b55, 0x9b56, 0x9b57, 0x9b5b, - 0x9b5e, 0x9b61, 0x9b63, 0x9b65, 0x9b66, 0x9b68, 0x9b6a, 0x9b6b, - 0x9b6c, 0x9b6d, 0x9b6e, 0x9b73, 0x9b75, 0x9b77, 0x9b78, 0x9b79, - 0x9b7f, 0x9b80, 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b89, 0x9b8a, - 0x9b8b, 0x9b8d, 0x9b8f, 0x9b90, 0x9b94, 0x9b9a, 0x9b9d, 0x9b9e, - 0x9ba6, 0x9ba7, 0x9ba9, 0x9bac, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb7, - 0x9bb8, 0x9bbb, 0x9bbc, 0x9bbe, 0x9bbf, 0x9bc1, 0x9bc7, 0x9bc8, - 0x9bce, 0x9bd0, 0x9bd7, 0x9bd8, 0x9bdd, 0x9bdf, 0x9be5, 0x9be7, - 0x9bea, 0x9beb, 0x9bef, 0x9bf3, 0x9bf7, 0x9bf8, - /* 0x6b */ - 0x9bf9, 0x9bfa, 0x9bfd, 0x9bff, 0x9c00, 0x9c02, 0x9c0b, 0x9c0f, - 0x9c11, 0x9c16, 0x9c18, 0x9c19, 0x9c1a, 0x9c1c, 0x9c1e, 0x9c22, - 0x9c23, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c31, 0x9c35, - 0x9c36, 0x9c37, 0x9c3d, 0x9c41, 0x9c43, 0x9c44, 0x9c45, 0x9c49, - 0x9c4a, 0x9c4e, 0x9c4f, 0x9c50, 0x9c53, 0x9c54, 0x9c56, 0x9c58, - 0x9c5b, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c63, 0x9c69, 0x9c6a, 0x9c5c, - 0x9c6b, 0x9c68, 0x9c6e, 0x9c70, 0x9c72, 0x9c75, 0x9c77, 0x9c7b, - 0x9ce6, 0x9cf2, 0x9cf7, 0x9cf9, 0x9d0b, 0x9d02, 0x9d11, 0x9d17, - 0x9d18, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d2f, 0x9d30, 0x9d32, 0x9d33, - 0x9d34, 0x9d3a, 0x9d3c, 0x9d45, 0x9d3d, 0x9d42, 0x9d43, 0x9d47, - 0x9d4a, 0x9d53, 0x9d54, 0x9d5f, 0x9d63, 0x9d62, 0x9d65, 0x9d69, - 0x9d6a, 0x9d6b, 0x9d70, 0x9d76, 0x9d77, 0x9d7b, - /* 0x6c */ - 0x9d7c, 0x9d7e, 0x9d83, 0x9d84, 0x9d86, 0x9d8a, 0x9d8d, 0x9d8e, - 0x9d92, 0x9d93, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9da1, 0x9daa, - 0x9dac, 0x9dae, 0x9db1, 0x9db5, 0x9db9, 0x9dbc, 0x9dbf, 0x9dc3, - 0x9dc7, 0x9dc9, 0x9dca, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dda, - 0x9dde, 0x9ddf, 0x9de0, 0x9de5, 0x9de7, 0x9de9, 0x9deb, 0x9dee, - 0x9df0, 0x9df3, 0x9df4, 0x9dfe, 0x9e0a, 0x9e02, 0x9e07, 0x9e0e, - 0x9e10, 0x9e11, 0x9e12, 0x9e15, 0x9e16, 0x9e19, 0x9e1c, 0x9e1d, - 0x9e7a, 0x9e7b, 0x9e7c, 0x9e80, 0x9e82, 0x9e83, 0x9e84, 0x9e85, - 0x9e87, 0x9e8e, 0x9e8f, 0x9e96, 0x9e98, 0x9e9b, 0x9e9e, 0x9ea4, - 0x9ea8, 0x9eac, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb3, 0x9eb4, 0x9eb5, - 0x9ec6, 0x9ec8, 0x9ecb, 0x9ed5, 0x9edf, 0x9ee4, 0x9ee7, 0x9eec, - 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef5, - /* 0x6d */ - 0x9ef8, 0x9eff, 0x9f02, 0x9f03, 0x9f09, 0x9f0f, 0x9f10, 0x9f11, - 0x9f12, 0x9f14, 0x9f16, 0x9f17, 0x9f19, 0x9f1a, 0x9f1b, 0x9f1f, - 0x9f22, 0x9f26, 0x9f2a, 0x9f2b, 0x9f2f, 0x9f31, 0x9f32, 0x9f34, - 0x9f37, 0x9f39, 0x9f3a, 0x9f3c, 0x9f3d, 0x9f3f, 0x9f41, 0x9f43, - 0x9f44, 0x9f45, 0x9f46, 0x9f47, 0x9f53, 0x9f55, 0x9f56, 0x9f57, - 0x9f58, 0x9f5a, 0x9f5d, 0x9f5e, 0x9f68, 0x9f69, 0x9f6d, 0x9f6e, - 0x9f6f, 0x9f70, 0x9f71, 0x9f73, 0x9f75, 0x9f7a, 0x9f7d, 0x9f8f, - 0x9f90, 0x9f91, 0x9f92, 0x9f94, 0x9f96, 0x9f97, 0x9f9e, 0x9fa1, - 0x9fa2, 0x9fa3, 0x9fa5, -}; - -static int -jisx0212_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = (s[0] & 0x7F); - if ((c1 == 0x22) || (c1 >= 0x26 && c1 <= 0x27) || (c1 >= 0x29 && c1 <= 0x2b) || (c1 >= 0x30 && c1 <= 0x6d)) { - if (n >= 2) { - unsigned char c2 = (s[1] & 0x7F); - if (c2 >= 0x21 && c2 < 0x7f) { - unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); - unsigned short wc = 0xfffd; - if (i < 470) { - if (i < 175) - wc = jisx0212_2uni_page22[i-94]; - } else if (i < 752) { - if (i < 658) - wc = jisx0212_2uni_page26[i-470]; - } else if (i < 1410) { - if (i < 1027) - wc = jisx0212_2uni_page29[i-752]; - } else { - if (i < 7211) - wc = jisx0212_2uni_page30[i-1410]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short jisx0212_2charset[6067] = { - 0x2237, 0x2242, 0x2270, 0x2243, 0x226d, 0x226c, 0x226e, 0x2234, - 0x2231, 0x226b, 0x2244, 0x2a22, 0x2a21, 0x2a24, 0x2a2a, 0x2a23, - 0x2a29, 0x2921, 0x2a2e, 0x2a32, 0x2a31, 0x2a34, 0x2a33, 0x2a40, - 0x2a3f, 0x2a42, 0x2a41, 0x2a50, 0x2a52, 0x2a51, 0x2a54, 0x2a58, - 0x2a53, 0x292c, 0x2a63, 0x2a62, 0x2a65, 0x2a64, 0x2a72, 0x2930, - 0x294e, 0x2b22, 0x2b21, 0x2b24, 0x2b2a, 0x2b23, 0x2b29, 0x2941, - 0x2b2e, 0x2b32, 0x2b31, 0x2b34, 0x2b33, 0x2b40, 0x2b3f, 0x2b42, - 0x2b41, 0x2943, 0x2b50, 0x2b52, 0x2b51, 0x2b54, 0x2b58, 0x2b53, - 0x294c, 0x2b63, 0x2b62, 0x2b65, 0x2b64, 0x2b72, 0x2950, 0x2b73, - 0x2a27, 0x2b27, 0x2a25, 0x2b25, 0x2a28, 0x2b28, 0x2a2b, 0x2b2b, - 0x2a2c, 0x2b2c, 0x2a2f, 0x2b2f, 0x2a2d, 0x2b2d, 0x2a30, 0x2b30, - 0x2922, 0x2942, 0x2a37, 0x2b37, 0x2a36, 0x2b36, 0x2a38, 0x2b38, - 0x2a35, 0x2b35, 0x2a3a, 0x2b3a, 0x2a3b, 0x2b3b, 0x2a3d, 0x2b3d, - 0x2a3c, 0x2a3e, 0x2b3e, 0x2924, 0x2944, 0x2a47, 0x2b47, 0x2a45, - 0x2b45, 0x2a46, 0x2b46, 0x2a44, 0x2945, 0x2926, 0x2946, 0x2a48, - 0x2b48, 0x2a49, 0x2b49, 0x2947, 0x2a4a, 0x2b4a, 0x2a4c, 0x2b4c, - 0x2a4b, 0x2b4b, 0x2929, 0x2949, 0x2928, 0x2948, 0x2a4d, 0x2b4d, - 0x2a4f, 0x2b4f, 0x2a4e, 0x2b4e, 0x294a, 0x292b, 0x294b, 0x2a57, - 0x2b57, 0x2a56, 0x2b56, 0x292d, 0x294d, 0x2a59, 0x2b59, 0x2a5b, - 0x2b5b, 0x2a5a, 0x2b5a, 0x2a5c, 0x2b5c, 0x2a5d, 0x2b5d, 0x2a5f, - 0x2b5f, 0x2a5e, 0x2b5e, 0x2a61, 0x2b61, 0x2a60, 0x2b60, 0x292f, - 0x294f, 0x2a6c, 0x2b6c, 0x2a69, 0x2b69, 0x2a66, 0x2b66, 0x2a6b, - 0x2b6b, 0x2a68, 0x2b68, 0x2a6a, 0x2b6a, 0x2a71, 0x2b71, 0x2a74, - 0x2b74, 0x2a73, 0x2a75, 0x2b75, 0x2a77, 0x2b77, 0x2a76, 0x2b76, - 0x2a26, 0x2b26, 0x2a43, 0x2b43, 0x2a55, 0x2b55, 0x2a67, 0x2b67, - 0x2a70, 0x2b70, 0x2a6d, 0x2b6d, 0x2a6f, 0x2b6f, 0x2a6e, 0x2b6e, - 0x2b39, 0x2230, 0x222f, 0x2232, 0x2236, 0x2235, 0x2233, 0x2238, - 0x2239, 0x2661, 0x2662, 0x2663, 0x2664, 0x2667, 0x2669, 0x266c, - 0x2676, 0x2665, 0x266a, 0x2671, 0x2672, 0x2673, 0x2674, 0x267b, - 0x2678, 0x2675, 0x267a, 0x2677, 0x2679, 0x267c, 0x2742, 0x2743, - 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, - 0x274c, 0x274d, 0x274e, 0x2772, 0x2773, 0x2774, 0x2775, 0x2776, - 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x277d, 0x277e, - 0x2271, 0x226f, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, - 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, - 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, - 0x3037, 0x3038, 0x3039, 0x303a, 0x303b, 0x303c, 0x303d, 0x303e, - 0x303f, 0x3040, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, - 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, - 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, - 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, - 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, - 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, - 0x3070, 0x305f, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, - 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, - 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, - 0x3129, 0x312a, 0x312b, 0x312c, 0x312d, 0x312e, 0x312f, 0x3130, - 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, - 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, - 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, - 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, - 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, - 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x3176, 0x315f, - 0x3160, 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, - 0x3168, 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, - 0x3170, 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3177, 0x3178, - 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x3221, 0x3222, - 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, - 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, - 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323a, - 0x323b, 0x323c, 0x323d, 0x323e, 0x323f, 0x3240, 0x3241, 0x3242, - 0x3243, 0x3244, 0x3245, 0x3251, 0x3246, 0x3247, 0x3248, 0x3249, - 0x324a, 0x324b, 0x324c, 0x324d, 0x324e, 0x324f, 0x3250, 0x3252, - 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a, - 0x325b, 0x325c, 0x325d, 0x325e, 0x325f, 0x3260, 0x3261, 0x3262, - 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, - 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, - 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, - 0x327b, 0x327c, 0x327d, 0x327e, 0x3321, 0x3322, 0x3323, 0x3324, - 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332a, 0x332b, 0x332c, - 0x332d, 0x332e, 0x332f, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, - 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333a, 0x333b, 0x333c, - 0x333d, 0x333e, 0x333f, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, - 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334a, 0x334b, 0x334c, - 0x334d, 0x334e, 0x334f, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, - 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335a, 0x335b, 0x335c, - 0x335d, 0x335e, 0x335f, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, - 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336a, 0x336b, 0x336c, - 0x336d, 0x336e, 0x336f, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, - 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, - 0x337d, 0x337e, 0x3421, 0x3422, 0x3423, 0x3424, 0x3425, 0x3426, - 0x3427, 0x3428, 0x3429, 0x342a, 0x342b, 0x342c, 0x342d, 0x342e, - 0x342f, 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, - 0x3438, 0x3437, 0x3439, 0x343a, 0x343b, 0x343c, 0x343d, 0x343e, - 0x343f, 0x3440, 0x3441, 0x3442, 0x3443, 0x3444, 0x3445, 0x3446, - 0x3447, 0x3448, 0x3449, 0x344a, 0x344b, 0x344c, 0x344d, 0x344e, - 0x344f, 0x3450, 0x3451, 0x3452, 0x3453, 0x3454, 0x3455, 0x3456, - 0x3457, 0x3458, 0x3459, 0x345a, 0x345b, 0x345c, 0x345d, 0x345e, - 0x345f, 0x3460, 0x3461, 0x3462, 0x3463, 0x3464, 0x3465, 0x3466, - 0x3467, 0x3468, 0x3469, 0x346a, 0x346b, 0x346c, 0x346d, 0x346e, - 0x346f, 0x3470, 0x3471, 0x3472, 0x3473, 0x3474, 0x3475, 0x3476, - 0x3477, 0x3478, 0x3479, 0x347a, 0x347b, 0x347c, 0x347d, 0x347e, - 0x3521, 0x3522, 0x3523, 0x3524, 0x3525, 0x3526, 0x3527, 0x3528, - 0x3529, 0x352a, 0x352b, 0x352c, 0x352d, 0x352e, 0x352f, 0x3530, - 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, - 0x3539, 0x353a, 0x353b, 0x353c, 0x353d, 0x353e, 0x353f, 0x3540, - 0x3541, 0x3542, 0x3543, 0x3544, 0x3545, 0x3546, 0x3547, 0x3548, - 0x3549, 0x354a, 0x354b, 0x354c, 0x354d, 0x354e, 0x354f, 0x3550, - 0x3551, 0x3552, 0x3553, 0x3554, 0x3555, 0x3556, 0x3557, 0x3558, - 0x3559, 0x355a, 0x355b, 0x355c, 0x355d, 0x355e, 0x355f, 0x3560, - 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, - 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, - 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x3576, 0x3577, 0x3578, - 0x3579, 0x357a, 0x357b, 0x357c, 0x357d, 0x357e, 0x3621, 0x3622, - 0x3623, 0x3624, 0x3625, 0x3626, 0x3627, 0x3628, 0x3629, 0x362a, - 0x362b, 0x362c, 0x362d, 0x362e, 0x362f, 0x3630, 0x3631, 0x3632, - 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, 0x363a, - 0x363b, 0x363c, 0x363d, 0x363e, 0x363f, 0x3640, 0x3641, 0x3642, - 0x3643, 0x3644, 0x3645, 0x3646, 0x3647, 0x3648, 0x3649, 0x364a, - 0x364b, 0x364c, 0x364d, 0x364e, 0x364f, 0x3650, 0x3651, 0x3652, - 0x3653, 0x3654, 0x3655, 0x3656, 0x3657, 0x3658, 0x3659, 0x365a, - 0x365b, 0x365c, 0x365d, 0x365e, 0x365f, 0x3660, 0x3661, 0x3662, - 0x3663, 0x3664, 0x3665, 0x3666, 0x3667, 0x3668, 0x3669, 0x366a, - 0x366b, 0x366c, 0x366d, 0x3670, 0x3671, 0x366e, 0x366f, 0x3672, - 0x3673, 0x3674, 0x3675, 0x3676, 0x3677, 0x3678, 0x3679, 0x367a, - 0x367b, 0x367d, 0x367e, 0x367c, 0x3721, 0x3722, 0x3723, 0x3724, - 0x3725, 0x3726, 0x3727, 0x3728, 0x3729, 0x372a, 0x372b, 0x372c, - 0x372d, 0x372e, 0x372f, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, - 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, - 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, - 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, - 0x374d, 0x374e, 0x374f, 0x3750, 0x3751, 0x3752, 0x3753, 0x3754, - 0x3755, 0x3756, 0x3757, 0x3760, 0x3758, 0x3759, 0x375a, 0x375b, - 0x375c, 0x375d, 0x375e, 0x375f, 0x3761, 0x3762, 0x3763, 0x3764, - 0x3765, 0x3766, 0x3767, 0x3768, 0x3769, 0x376a, 0x376b, 0x376c, - 0x376d, 0x377e, 0x376e, 0x376f, 0x3770, 0x3771, 0x3772, 0x3773, - 0x3774, 0x3775, 0x3776, 0x3777, 0x3778, 0x3779, 0x377a, 0x377b, - 0x377c, 0x377d, 0x3821, 0x3822, 0x3823, 0x3824, 0x3825, 0x3826, - 0x3827, 0x3828, 0x3829, 0x382a, 0x382b, 0x382c, 0x382d, 0x382e, - 0x382f, 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, - 0x3837, 0x3838, 0x3839, 0x383a, 0x383b, 0x383c, 0x383d, 0x383e, - 0x383f, 0x3840, 0x3841, 0x3842, 0x3843, 0x3844, 0x3845, 0x3846, - 0x3847, 0x3848, 0x3849, 0x384a, 0x384b, 0x384c, 0x384d, 0x384e, - 0x3850, 0x3851, 0x384f, 0x3852, 0x3853, 0x3854, 0x3855, 0x3856, - 0x3857, 0x3858, 0x3859, 0x385a, 0x385b, 0x385c, 0x385d, 0x385e, - 0x385f, 0x3860, 0x3861, 0x3862, 0x3863, 0x3864, 0x3865, 0x3867, - 0x3868, 0x3869, 0x386a, 0x386b, 0x386c, 0x386d, 0x386e, 0x386f, - 0x3870, 0x3871, 0x3872, 0x3873, 0x3874, 0x3875, 0x3876, 0x3877, - 0x3878, 0x3879, 0x387a, 0x387b, 0x387c, 0x387d, 0x387e, 0x3921, - 0x3922, 0x3923, 0x3924, 0x3925, 0x3926, 0x3927, 0x3928, 0x3929, - 0x392a, 0x392b, 0x392c, 0x392d, 0x392e, 0x392f, 0x3930, 0x3931, - 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, 0x3939, - 0x393a, 0x393b, 0x393c, 0x393d, 0x393e, 0x393f, 0x3940, 0x3941, - 0x3942, 0x3943, 0x3944, 0x3945, 0x3946, 0x3947, 0x3948, 0x3949, - 0x394a, 0x394b, 0x394c, 0x394d, 0x394e, 0x394f, 0x3950, 0x3951, - 0x3952, 0x3953, 0x3954, 0x3955, 0x3956, 0x3957, 0x3958, 0x3959, - 0x395a, 0x395b, 0x395c, 0x395d, 0x395e, 0x395f, 0x3960, 0x3961, - 0x3962, 0x3963, 0x3964, 0x3965, 0x3966, 0x3967, 0x3968, 0x3969, - 0x396a, 0x396b, 0x396c, 0x396d, 0x396e, 0x396f, 0x3970, 0x3971, - 0x3972, 0x3973, 0x3974, 0x3975, 0x3976, 0x3977, 0x3978, 0x3979, - 0x397a, 0x397b, 0x397c, 0x397d, 0x397e, 0x3a21, 0x3a22, 0x3a23, - 0x3a24, 0x3a25, 0x3a26, 0x3a27, 0x3a28, 0x3a29, 0x3a2a, 0x3a2b, - 0x3a2c, 0x3a2d, 0x3a2e, 0x3a2f, 0x3a30, 0x3a31, 0x3a33, 0x3a34, - 0x3a35, 0x3a36, 0x3a37, 0x3a38, 0x3a32, 0x3a39, 0x3a3a, 0x3a3b, - 0x3a3c, 0x3a3d, 0x3a3e, 0x3a3f, 0x3a40, 0x3a41, 0x3a42, 0x3a43, - 0x3a44, 0x3a45, 0x3a46, 0x3a47, 0x3a48, 0x3a49, 0x3a4a, 0x3a4b, - 0x3a4c, 0x3a4d, 0x3a4e, 0x3a4f, 0x3a50, 0x3a51, 0x3a52, 0x3a53, - 0x3a54, 0x3a55, 0x3a56, 0x3a57, 0x3a58, 0x3a59, 0x3a5a, 0x3a5b, - 0x3a5c, 0x3a5d, 0x3a5e, 0x3a5f, 0x3a60, 0x3a61, 0x3a62, 0x3a63, - 0x3a64, 0x3a65, 0x3a66, 0x3a67, 0x3a68, 0x3a69, 0x3a6a, 0x3a6b, - 0x3a6c, 0x3a6d, 0x3a6e, 0x3a6f, 0x3a70, 0x3a71, 0x3a72, 0x3a73, - 0x3a74, 0x3a75, 0x3a76, 0x3a77, 0x3a78, 0x3a79, 0x3a7a, 0x3a7b, - 0x3a7c, 0x3a7d, 0x3a7e, 0x3b21, 0x3b22, 0x3b23, 0x3b24, 0x3b25, - 0x3b26, 0x3b27, 0x3b28, 0x3b29, 0x3b2a, 0x3b2b, 0x3b2c, 0x3b2d, - 0x3b2e, 0x3b2f, 0x3b30, 0x3b31, 0x3b32, 0x3b33, 0x3b34, 0x3b35, - 0x3b36, 0x3b37, 0x3b38, 0x3b39, 0x3b3a, 0x3b3b, 0x3b3d, 0x3b3c, - 0x3b3e, 0x3b3f, 0x3b40, 0x3b41, 0x3b42, 0x3b43, 0x3b44, 0x3b45, - 0x3b47, 0x3b48, 0x3b49, 0x3b4a, 0x3b46, 0x3b4b, 0x3b4c, 0x3b4d, - 0x3b4e, 0x3b4f, 0x3b50, 0x3b51, 0x3b52, 0x3b53, 0x3b57, 0x3b55, - 0x3b54, 0x3b56, 0x3b58, 0x3b59, 0x3b5a, 0x3b5b, 0x3b5c, 0x3b5d, - 0x3b5e, 0x3b5f, 0x3b60, 0x3b61, 0x3b62, 0x3b63, 0x3b64, 0x3b65, - 0x3b66, 0x3b67, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x3b6c, 0x3b6d, - 0x3b6e, 0x3b6f, 0x3b70, 0x3b71, 0x3b72, 0x6674, 0x3b73, 0x3b74, - 0x3b75, 0x3b76, 0x3b77, 0x3b78, 0x3b7a, 0x3b79, 0x3b7b, 0x3b7c, - 0x3b7d, 0x3b7e, 0x3c21, 0x3c22, 0x3c23, 0x3c24, 0x3c25, 0x3c26, - 0x3c27, 0x3c28, 0x3c29, 0x3c2a, 0x3c2b, 0x3c2c, 0x3c2e, 0x3c2d, - 0x3c2f, 0x3c30, 0x3c31, 0x3c34, 0x3c32, 0x3c33, 0x3c35, 0x3c36, - 0x3c37, 0x3c38, 0x3c39, 0x3c3a, 0x3c3b, 0x3c3c, 0x3c3d, 0x3c3e, - 0x3c3f, 0x3c40, 0x3c41, 0x3c42, 0x3c43, 0x3c44, 0x3c45, 0x3c46, - 0x3c47, 0x3c48, 0x3c49, 0x3c4a, 0x3c4b, 0x3c4c, 0x3c4d, 0x3c4e, - 0x3c4f, 0x3c50, 0x3c52, 0x3c51, 0x3c53, 0x3c54, 0x3c55, 0x3c56, - 0x3c57, 0x3c58, 0x3c59, 0x3c5a, 0x3c5b, 0x3c5c, 0x3c5d, 0x3c5e, - 0x3c5f, 0x3c60, 0x3c61, 0x3c62, 0x3c63, 0x3c64, 0x3c65, 0x3c66, - 0x3c67, 0x3c68, 0x3c69, 0x3c6a, 0x3c6b, 0x3c6c, 0x3c6d, 0x3c6e, - 0x3c6f, 0x3c70, 0x3c71, 0x3c72, 0x3c73, 0x3c74, 0x3c75, 0x3c76, - 0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c, 0x3c7d, 0x3c7e, - 0x3d21, 0x3d22, 0x3d23, 0x3d24, 0x3d25, 0x3d26, 0x3d27, 0x3d28, - 0x3d29, 0x3d2a, 0x3d2b, 0x3d2c, 0x3d2d, 0x3d2e, 0x3d2f, 0x3d32, - 0x3d30, 0x3d31, 0x3d33, 0x3d34, 0x3d35, 0x3d36, 0x3d37, 0x3d38, - 0x3d39, 0x3d3a, 0x3d3b, 0x3d3c, 0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, - 0x3d41, 0x3d42, 0x3d43, 0x3d44, 0x3d45, 0x3d46, 0x3d47, 0x3d48, - 0x3d49, 0x3d4a, 0x3d4b, 0x3d4c, 0x3d4d, 0x3d4e, 0x3d4f, 0x3d50, - 0x3d51, 0x3d52, 0x3d53, 0x3d54, 0x3d55, 0x3d56, 0x3d57, 0x3d58, - 0x3d59, 0x3d5a, 0x3d5b, 0x3d5c, 0x3d5d, 0x3d5e, 0x3d5f, 0x3d60, - 0x3d61, 0x3d62, 0x3d63, 0x3d64, 0x3d65, 0x3d66, 0x3d67, 0x3d68, - 0x3d69, 0x3d6a, 0x3d6b, 0x3d6c, 0x3d6d, 0x3d6e, 0x3d6f, 0x3d70, - 0x3d71, 0x3d72, 0x3d73, 0x3d74, 0x3d75, 0x3d76, 0x3d77, 0x3d78, - 0x3d79, 0x3d7a, 0x3d7b, 0x3d7c, 0x3d7d, 0x3d7e, 0x3e21, 0x3e22, - 0x3e23, 0x3e24, 0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x3e29, 0x3e2a, - 0x3e2b, 0x3e2c, 0x3e2d, 0x3e2e, 0x3e2f, 0x3e30, 0x3e31, 0x3e32, - 0x3e33, 0x3e34, 0x3e35, 0x3e36, 0x3e37, 0x3e38, 0x3e39, 0x3e3a, - 0x3e3b, 0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x3e41, 0x3e42, - 0x3e43, 0x3e44, 0x3e45, 0x3e46, 0x3e47, 0x3e48, 0x3e49, 0x3e4a, - 0x3e4b, 0x3e4c, 0x3e4d, 0x3e4e, 0x3e4f, 0x3e50, 0x3e51, 0x3e52, - 0x3e53, 0x3e54, 0x3e55, 0x3e56, 0x3e57, 0x3e58, 0x3e59, 0x3e5a, - 0x3e5b, 0x3e5c, 0x3e5d, 0x3e5e, 0x3e5f, 0x3e60, 0x3e61, 0x3e62, - 0x3e63, 0x3e64, 0x3e65, 0x3e66, 0x3e67, 0x3e68, 0x3e69, 0x3e6a, - 0x3e6b, 0x3e6c, 0x3e6d, 0x3e6e, 0x3e6f, 0x3e70, 0x3e71, 0x3e72, - 0x3e73, 0x3e74, 0x3e75, 0x3e76, 0x3e77, 0x3e78, 0x3e79, 0x3e7a, - 0x3e7b, 0x3e7e, 0x3e7c, 0x3e7d, 0x3f21, 0x3f22, 0x3f23, 0x3f24, - 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, - 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, - 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, - 0x3f3d, 0x3f3e, 0x3f3f, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, - 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, - 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, - 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, - 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, - 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, - 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, - 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, - 0x3f7d, 0x3f7e, 0x4021, 0x4022, 0x4023, 0x4024, 0x4025, 0x4026, - 0x4027, 0x4028, 0x4029, 0x402a, 0x402b, 0x402c, 0x402d, 0x402e, - 0x402f, 0x4030, 0x4031, 0x4032, 0x4033, 0x4034, 0x4035, 0x4036, - 0x4037, 0x4038, 0x4039, 0x403a, 0x403b, 0x403c, 0x403d, 0x403e, - 0x403f, 0x4040, 0x4041, 0x4042, 0x4043, 0x4044, 0x4045, 0x4046, - 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d, 0x404e, - 0x404f, 0x4050, 0x4051, 0x4052, 0x4053, 0x4054, 0x4055, 0x4056, - 0x4057, 0x4058, 0x4059, 0x405a, 0x405b, 0x405c, 0x405d, 0x405e, - 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, - 0x4067, 0x4068, 0x4069, 0x406a, 0x406b, 0x406c, 0x406d, 0x406e, - 0x406f, 0x4070, 0x4071, 0x4072, 0x4073, 0x4074, 0x4075, 0x4076, - 0x4077, 0x4078, 0x4079, 0x407a, 0x407b, 0x407c, 0x407d, 0x407e, - 0x4121, 0x4122, 0x4123, 0x4124, 0x4125, 0x4126, 0x4127, 0x4128, - 0x4129, 0x412a, 0x412b, 0x412c, 0x412d, 0x412e, 0x412f, 0x4130, - 0x4131, 0x4132, 0x4133, 0x4134, 0x4135, 0x4136, 0x4137, 0x4138, - 0x4139, 0x413a, 0x413b, 0x413c, 0x413d, 0x413e, 0x413f, 0x4140, - 0x4141, 0x4142, 0x4143, 0x4144, 0x4145, 0x4146, 0x4147, 0x4148, - 0x4149, 0x414a, 0x414b, 0x414c, 0x414d, 0x414e, 0x414f, 0x4150, - 0x4151, 0x4152, 0x4153, 0x4154, 0x4155, 0x4156, 0x4157, 0x4158, - 0x4159, 0x415a, 0x415b, 0x415c, 0x415d, 0x415e, 0x415f, 0x4160, - 0x4161, 0x4162, 0x4163, 0x4164, 0x4165, 0x4166, 0x4167, 0x4168, - 0x4169, 0x416a, 0x416b, 0x416c, 0x416d, 0x416e, 0x416f, 0x4170, - 0x4171, 0x4172, 0x4173, 0x4174, 0x4175, 0x4176, 0x4177, 0x4178, - 0x4179, 0x417a, 0x417b, 0x417c, 0x417d, 0x417e, 0x4221, 0x4222, - 0x4223, 0x4224, 0x4225, 0x4226, 0x4227, 0x4228, 0x4229, 0x422a, - 0x422b, 0x422c, 0x422d, 0x422e, 0x4230, 0x422f, 0x4231, 0x4232, - 0x4233, 0x4234, 0x4235, 0x4237, 0x4236, 0x4238, 0x4239, 0x423a, - 0x423b, 0x423c, 0x423d, 0x423e, 0x4240, 0x4241, 0x4242, 0x4244, - 0x4245, 0x4247, 0x4248, 0x4249, 0x424a, 0x424c, 0x4243, 0x4246, - 0x424b, 0x424d, 0x424e, 0x424f, 0x4250, 0x4251, 0x4252, 0x4253, - 0x4254, 0x4255, 0x4256, 0x4257, 0x4258, 0x4259, 0x425a, 0x425b, - 0x425c, 0x425d, 0x425e, 0x425f, 0x4260, 0x4261, 0x4262, 0x4263, - 0x4264, 0x4265, 0x4266, 0x4267, 0x4268, 0x4269, 0x426a, 0x426b, - 0x426c, 0x426d, 0x423f, 0x426e, 0x426f, 0x4270, 0x4271, 0x4272, - 0x4273, 0x4274, 0x4275, 0x4276, 0x4277, 0x4278, 0x4279, 0x427a, - 0x427b, 0x427c, 0x427d, 0x427e, 0x4321, 0x4322, 0x4323, 0x4324, - 0x4325, 0x4326, 0x4327, 0x4328, 0x4329, 0x432a, 0x432b, 0x432c, - 0x432d, 0x432e, 0x432f, 0x4330, 0x4331, 0x4332, 0x4333, 0x4334, - 0x4335, 0x4336, 0x4337, 0x4339, 0x433a, 0x433b, 0x433c, 0x433d, - 0x433e, 0x433f, 0x4340, 0x4341, 0x4342, 0x4343, 0x4344, 0x4345, - 0x4346, 0x4347, 0x4348, 0x4338, 0x434a, 0x434b, 0x434c, 0x434d, - 0x434f, 0x434e, 0x4350, 0x4351, 0x4352, 0x4353, 0x4354, 0x4355, - 0x4356, 0x4357, 0x4358, 0x4359, 0x435a, 0x435b, 0x4349, 0x435c, - 0x435d, 0x435e, 0x435f, 0x4360, 0x4361, 0x4362, 0x4363, 0x4364, - 0x4365, 0x4366, 0x4367, 0x4368, 0x4369, 0x436a, 0x436b, 0x436c, - 0x436d, 0x436e, 0x436f, 0x4370, 0x4371, 0x4372, 0x4373, 0x4374, - 0x4375, 0x4376, 0x4377, 0x4378, 0x4379, 0x437a, 0x437b, 0x437c, - 0x437d, 0x437e, 0x4421, 0x4422, 0x4423, 0x4424, 0x4425, 0x4426, - 0x4427, 0x4428, 0x4429, 0x442a, 0x442b, 0x442c, 0x442d, 0x442e, - 0x442f, 0x4430, 0x4431, 0x4432, 0x4433, 0x4434, 0x4435, 0x4436, - 0x4437, 0x4438, 0x4439, 0x443a, 0x443b, 0x443c, 0x443d, 0x443e, - 0x443f, 0x4440, 0x4441, 0x4442, 0x4443, 0x4444, 0x4445, 0x4446, - 0x4447, 0x4448, 0x4449, 0x444a, 0x444b, 0x444c, 0x444d, 0x444e, - 0x444f, 0x4450, 0x4451, 0x4452, 0x4453, 0x4454, 0x4455, 0x4456, - 0x4457, 0x4458, 0x4459, 0x445a, 0x445b, 0x445c, 0x445d, 0x445e, - 0x445f, 0x4460, 0x4461, 0x4462, 0x4463, 0x4464, 0x4465, 0x4466, - 0x4467, 0x4468, 0x4469, 0x446a, 0x446b, 0x446c, 0x446d, 0x446e, - 0x446f, 0x4470, 0x4471, 0x4472, 0x4473, 0x4474, 0x4475, 0x4476, - 0x4477, 0x4478, 0x4479, 0x447a, 0x447b, 0x447c, 0x447d, 0x447e, - 0x4521, 0x4522, 0x4523, 0x4524, 0x4525, 0x4526, 0x4527, 0x4528, - 0x4529, 0x452a, 0x452b, 0x452c, 0x452d, 0x452e, 0x452f, 0x4530, - 0x4531, 0x4532, 0x4533, 0x4534, 0x4535, 0x4536, 0x4537, 0x4538, - 0x4539, 0x453a, 0x453b, 0x453c, 0x453d, 0x453e, 0x453f, 0x4540, - 0x4541, 0x4542, 0x4543, 0x4544, 0x4545, 0x4546, 0x4547, 0x4548, - 0x4549, 0x454a, 0x454b, 0x454d, 0x454c, 0x454e, 0x454f, 0x4550, - 0x4551, 0x4552, 0x4553, 0x4554, 0x4555, 0x4556, 0x4557, 0x4558, - 0x4559, 0x455a, 0x455b, 0x455c, 0x455d, 0x455e, 0x455f, 0x4560, - 0x4561, 0x4562, 0x4563, 0x4564, 0x4565, 0x4566, 0x4567, 0x4568, - 0x4569, 0x456a, 0x456b, 0x456c, 0x456d, 0x456e, 0x456f, 0x4570, - 0x4571, 0x4572, 0x4573, 0x4574, 0x4575, 0x4576, 0x4577, 0x4578, - 0x4579, 0x457a, 0x457b, 0x457c, 0x457d, 0x457e, 0x4621, 0x4622, - 0x4623, 0x4624, 0x4625, 0x4626, 0x4627, 0x4628, 0x4629, 0x462a, - 0x462b, 0x462c, 0x462d, 0x462e, 0x462f, 0x4630, 0x4631, 0x4632, - 0x4633, 0x4634, 0x4635, 0x4636, 0x4637, 0x4638, 0x4639, 0x463a, - 0x463b, 0x463c, 0x463d, 0x463e, 0x463f, 0x4640, 0x4641, 0x4642, - 0x4643, 0x4644, 0x4645, 0x4646, 0x4647, 0x4648, 0x4649, 0x464a, - 0x464b, 0x464c, 0x464d, 0x464e, 0x464f, 0x4650, 0x4651, 0x4652, - 0x4653, 0x4654, 0x4655, 0x4656, 0x4657, 0x4658, 0x4659, 0x465a, - 0x465b, 0x465c, 0x465d, 0x465e, 0x465f, 0x4660, 0x4736, 0x4661, - 0x4662, 0x4663, 0x4664, 0x4665, 0x4666, 0x4667, 0x4668, 0x4669, - 0x466a, 0x466b, 0x466c, 0x466d, 0x466e, 0x466f, 0x4670, 0x4671, - 0x4672, 0x4673, 0x4674, 0x4675, 0x4676, 0x4677, 0x4678, 0x4679, - 0x467a, 0x467b, 0x467c, 0x467d, 0x467e, 0x4721, 0x4722, 0x4723, - 0x4724, 0x4725, 0x4726, 0x4727, 0x4728, 0x4729, 0x472a, 0x472b, - 0x472c, 0x472d, 0x472e, 0x472f, 0x4730, 0x4731, 0x4732, 0x4733, - 0x4734, 0x4735, 0x4737, 0x4738, 0x4739, 0x473a, 0x473b, 0x473c, - 0x473d, 0x473e, 0x473f, 0x4740, 0x4741, 0x4742, 0x4743, 0x4744, - 0x4745, 0x4746, 0x4747, 0x4748, 0x4749, 0x474a, 0x474b, 0x474c, - 0x474d, 0x474e, 0x474f, 0x4750, 0x4751, 0x4752, 0x4753, 0x4754, - 0x4755, 0x4756, 0x4757, 0x4758, 0x4759, 0x475a, 0x475b, 0x475c, - 0x475d, 0x475e, 0x475f, 0x4760, 0x4761, 0x4762, 0x4763, 0x4764, - 0x4765, 0x4766, 0x4767, 0x4768, 0x4769, 0x476a, 0x476b, 0x476c, - 0x476d, 0x476e, 0x476f, 0x4770, 0x4771, 0x4772, 0x4773, 0x4774, - 0x4775, 0x4776, 0x4777, 0x4778, 0x4779, 0x477a, 0x477b, 0x477c, - 0x477d, 0x477e, 0x4821, 0x4822, 0x4823, 0x4824, 0x4825, 0x4826, - 0x4827, 0x4828, 0x4829, 0x482a, 0x482b, 0x482c, 0x482d, 0x482e, - 0x482f, 0x4830, 0x4831, 0x4832, 0x4833, 0x4834, 0x4835, 0x4836, - 0x4837, 0x4838, 0x4839, 0x483a, 0x483b, 0x483c, 0x483d, 0x483e, - 0x483f, 0x4840, 0x4841, 0x4842, 0x4843, 0x4844, 0x4845, 0x4846, - 0x4847, 0x4848, 0x4849, 0x484a, 0x484b, 0x484c, 0x4853, 0x484d, - 0x484e, 0x484f, 0x4850, 0x4851, 0x4852, 0x4854, 0x4855, 0x4856, - 0x4857, 0x4858, 0x4859, 0x485a, 0x485b, 0x485c, 0x485d, 0x485e, - 0x485f, 0x4860, 0x4861, 0x4862, 0x4863, 0x4864, 0x4865, 0x4866, - 0x4867, 0x4868, 0x4869, 0x486a, 0x486b, 0x486c, 0x486d, 0x486e, - 0x486f, 0x4870, 0x4871, 0x4872, 0x4873, 0x4874, 0x4875, 0x4876, - 0x4877, 0x4878, 0x4879, 0x487a, 0x487b, 0x487c, 0x487d, 0x487e, - 0x4921, 0x4922, 0x4923, 0x4924, 0x4925, 0x4926, 0x4927, 0x4928, - 0x4929, 0x492a, 0x492b, 0x492c, 0x492d, 0x492e, 0x492f, 0x4930, - 0x4931, 0x4932, 0x4933, 0x4934, 0x4935, 0x4936, 0x4937, 0x4938, - 0x4939, 0x493a, 0x493b, 0x493c, 0x4941, 0x493d, 0x493e, 0x493f, - 0x4940, 0x4942, 0x4943, 0x4944, 0x4945, 0x4946, 0x4947, 0x4948, - 0x4949, 0x494a, 0x494b, 0x494c, 0x494d, 0x494e, 0x494f, 0x4950, - 0x4951, 0x4952, 0x4953, 0x4954, 0x4955, 0x4956, 0x4957, 0x4958, - 0x4959, 0x495a, 0x495b, 0x495c, 0x495d, 0x495e, 0x495f, 0x4960, - 0x4961, 0x4962, 0x4963, 0x4964, 0x4965, 0x4966, 0x4967, 0x4968, - 0x4969, 0x496a, 0x496b, 0x496c, 0x496d, 0x496e, 0x496f, 0x4970, - 0x4971, 0x4972, 0x4973, 0x4974, 0x4975, 0x4976, 0x4977, 0x4978, - 0x4979, 0x497a, 0x497b, 0x497c, 0x497d, 0x497e, 0x4a21, 0x4a22, - 0x4a23, 0x4a24, 0x4a25, 0x4a26, 0x4a27, 0x4a28, 0x4a29, 0x4a2a, - 0x4a2b, 0x4a2c, 0x4a2d, 0x4a2e, 0x4a2f, 0x4a30, 0x4a31, 0x4a32, - 0x4a33, 0x4a34, 0x4a35, 0x4a36, 0x4a37, 0x4a38, 0x4a39, 0x4a3a, - 0x4a3b, 0x4a3c, 0x4a3d, 0x4a3e, 0x4a3f, 0x4a40, 0x4a41, 0x4a42, - 0x4a43, 0x4a44, 0x4a45, 0x4a46, 0x4a47, 0x4a48, 0x4a49, 0x4a4a, - 0x4a4b, 0x4a4c, 0x4a4d, 0x4a4e, 0x4a4f, 0x4a50, 0x4a51, 0x4a52, - 0x4a53, 0x4a54, 0x4a55, 0x4a56, 0x4a57, 0x4a58, 0x4a59, 0x4a5a, - 0x4a5b, 0x4a5c, 0x4a5d, 0x4a5e, 0x4a5f, 0x4a60, 0x4a61, 0x4a62, - 0x4a63, 0x4a64, 0x4a65, 0x4a66, 0x4a67, 0x4a68, 0x4a69, 0x4a6a, - 0x4a6b, 0x4a6c, 0x4a6d, 0x4a6e, 0x4a6f, 0x4a70, 0x4a71, 0x4a72, - 0x4a73, 0x4a74, 0x4a75, 0x4a76, 0x4a77, 0x4a78, 0x4a79, 0x4a7a, - 0x4a7b, 0x4a7c, 0x4a7d, 0x4a7e, 0x4b21, 0x4b22, 0x4b23, 0x4b24, - 0x4b25, 0x4b26, 0x4b27, 0x4b28, 0x4b29, 0x4b2a, 0x4b2b, 0x4b2c, - 0x4b2d, 0x4b2e, 0x4b2f, 0x4b30, 0x4b31, 0x4b32, 0x4b33, 0x4b34, - 0x4b35, 0x4b36, 0x4b37, 0x4b38, 0x4b39, 0x4b3a, 0x4b3b, 0x4b3c, - 0x4b3d, 0x4b3e, 0x4b3f, 0x4b40, 0x4b41, 0x4b42, 0x4b43, 0x4b44, - 0x4b45, 0x4b46, 0x4b47, 0x4b48, 0x4b49, 0x4b4a, 0x4b4b, 0x4b4c, - 0x4b4d, 0x4b4e, 0x4b4f, 0x4b50, 0x4b51, 0x4b52, 0x4b53, 0x4b54, - 0x4b55, 0x4b56, 0x4b57, 0x4b58, 0x4b59, 0x4b5a, 0x4b5b, 0x4b5c, - 0x4b5d, 0x4b5e, 0x4b5f, 0x4b60, 0x4b61, 0x4b62, 0x4b63, 0x4b64, - 0x4b65, 0x4b66, 0x4b67, 0x4b68, 0x4b69, 0x4b6a, 0x4b6b, 0x4b6c, - 0x4b6d, 0x4b6e, 0x4b6f, 0x4b70, 0x4b71, 0x4b72, 0x4b73, 0x4b74, - 0x4b75, 0x4b76, 0x4b77, 0x4b78, 0x4b79, 0x4b7a, 0x4b7b, 0x4b7c, - 0x4b7d, 0x4b7e, 0x4c21, 0x4c22, 0x4c23, 0x4c24, 0x4c25, 0x4c26, - 0x4c27, 0x4c28, 0x4c29, 0x4c2a, 0x4c2b, 0x4c2c, 0x4c2d, 0x4c2e, - 0x4c2f, 0x4c30, 0x4c31, 0x4c32, 0x4c33, 0x4c34, 0x4c35, 0x4c36, - 0x4c37, 0x4c38, 0x4c39, 0x4c3a, 0x4c3b, 0x4c3c, 0x4c3d, 0x4c3e, - 0x4c3f, 0x4c40, 0x4c41, 0x4c42, 0x4c43, 0x4c44, 0x4c45, 0x4c46, - 0x4c47, 0x4c48, 0x4c49, 0x4c4a, 0x4c4b, 0x4c4c, 0x4c4d, 0x4c4e, - 0x4c4f, 0x4c50, 0x4c51, 0x4c52, 0x4c53, 0x4c54, 0x4c55, 0x4c56, - 0x4c57, 0x4c58, 0x4c59, 0x4c5a, 0x4c5b, 0x4c5c, 0x4c5d, 0x4c5e, - 0x4c5f, 0x4c60, 0x4c61, 0x4c62, 0x4c63, 0x4c64, 0x4c65, 0x4c66, - 0x4c67, 0x4c68, 0x4c69, 0x4c6a, 0x4c6b, 0x4c6c, 0x4c6d, 0x4c6e, - 0x4c6f, 0x4c70, 0x4c71, 0x4c72, 0x4c73, 0x4c74, 0x4c75, 0x4c76, - 0x4c77, 0x4c78, 0x4c79, 0x4c7a, 0x4c7b, 0x4c7c, 0x4c7d, 0x4c7e, - 0x4d21, 0x4d22, 0x4d23, 0x4d24, 0x4d25, 0x4d26, 0x4d27, 0x4d28, - 0x4d29, 0x4d2a, 0x4d2b, 0x4d2c, 0x4d2d, 0x4d2e, 0x4d2f, 0x4d30, - 0x4d31, 0x4d32, 0x4d33, 0x4d34, 0x4d35, 0x4d36, 0x4d37, 0x4d38, - 0x4d39, 0x4d3a, 0x4d3b, 0x4d3c, 0x4d3d, 0x4d3e, 0x4d3f, 0x4d40, - 0x4d41, 0x4d42, 0x4d43, 0x4d44, 0x4d45, 0x4d46, 0x4d47, 0x4d48, - 0x4d49, 0x4d4a, 0x4d4b, 0x4d4c, 0x4d4d, 0x4d4e, 0x4d4f, 0x4d50, - 0x4d51, 0x4d52, 0x4d53, 0x4d54, 0x4d55, 0x4d56, 0x4d57, 0x4d58, - 0x4d59, 0x4d5a, 0x4d5b, 0x4d5c, 0x4d5d, 0x4d5e, 0x4d5f, 0x4d60, - 0x4d61, 0x4d62, 0x4d63, 0x4d64, 0x4d65, 0x4d66, 0x4d67, 0x4d68, - 0x4d69, 0x4d6a, 0x4d6b, 0x4d6c, 0x4d6d, 0x4d6e, 0x4d6f, 0x4d70, - 0x4d71, 0x4d72, 0x4d73, 0x4d74, 0x4d75, 0x4d76, 0x4d77, 0x4d78, - 0x4d79, 0x4d7a, 0x4d7b, 0x4d7c, 0x4d7d, 0x4d7e, 0x4e21, 0x4e22, - 0x4e24, 0x4e25, 0x4e26, 0x4e27, 0x4e28, 0x4e29, 0x4e23, 0x4e2a, - 0x4e2b, 0x4e2c, 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, - 0x4e33, 0x4e34, 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, - 0x4e3b, 0x4e3c, 0x4e3d, 0x4e3e, 0x4e3f, 0x4e40, 0x4e41, 0x4e42, - 0x4e43, 0x4e44, 0x4e45, 0x4e46, 0x4e47, 0x4e48, 0x4e49, 0x4e4a, - 0x4e4b, 0x4e4c, 0x4e4d, 0x4e4e, 0x4e4f, 0x4e50, 0x4e51, 0x4e52, - 0x4e53, 0x4e54, 0x4e55, 0x4e56, 0x4e57, 0x4e58, 0x4e59, 0x4e5a, - 0x4e5b, 0x4e5c, 0x4e5d, 0x4e5e, 0x4e5f, 0x4e60, 0x4e61, 0x4e62, - 0x4e63, 0x4e64, 0x4e65, 0x4e66, 0x4e67, 0x4e68, 0x4e69, 0x4e6a, - 0x4e6b, 0x4e6c, 0x4e6d, 0x4e6e, 0x4e6f, 0x4e70, 0x4e71, 0x4e72, - 0x4e73, 0x4e74, 0x4e75, 0x4e76, 0x4e77, 0x4e78, 0x4e79, 0x4e7a, - 0x4e7b, 0x4e7c, 0x4e7d, 0x4e7e, 0x4f21, 0x4f22, 0x4f23, 0x4f24, - 0x4f25, 0x4f26, 0x4f27, 0x4f28, 0x4f29, 0x4f2a, 0x4f2b, 0x4f2c, - 0x4f2d, 0x4f2e, 0x4f2f, 0x4f30, 0x4f31, 0x4f32, 0x4f33, 0x4f34, - 0x4f35, 0x4f36, 0x4f37, 0x4f38, 0x4f39, 0x4f3a, 0x4f3b, 0x4f3c, - 0x4f3d, 0x4f3e, 0x4f3f, 0x4f40, 0x4f41, 0x4f42, 0x4f43, 0x4f44, - 0x4f45, 0x4f46, 0x4f47, 0x4f48, 0x4f49, 0x4f4a, 0x4f4b, 0x4f4c, - 0x4f4d, 0x4f4e, 0x4f4f, 0x4f50, 0x4f51, 0x4f52, 0x4f53, 0x4f54, - 0x4f55, 0x4f56, 0x4f57, 0x4f58, 0x4f59, 0x4f5a, 0x4f5b, 0x4f5c, - 0x4f5d, 0x4f5e, 0x4f5f, 0x4f60, 0x4f61, 0x4f62, 0x4f63, 0x4f64, - 0x4f65, 0x4f66, 0x4f67, 0x4f68, 0x4f69, 0x4f6a, 0x4f6b, 0x4f6c, - 0x4f6d, 0x4f6e, 0x4f6f, 0x4f70, 0x4f71, 0x4f72, 0x4f74, 0x4f75, - 0x4f76, 0x4f73, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7b, 0x4f7c, - 0x4f7d, 0x4f7e, 0x5021, 0x5022, 0x5023, 0x5024, 0x5025, 0x5026, - 0x5027, 0x5028, 0x5029, 0x502a, 0x502b, 0x502c, 0x502e, 0x502f, - 0x5030, 0x5031, 0x502d, 0x5032, 0x5033, 0x5034, 0x5035, 0x5037, - 0x5038, 0x5039, 0x503a, 0x503b, 0x5036, 0x503c, 0x503d, 0x503e, - 0x503f, 0x5040, 0x5041, 0x5042, 0x5043, 0x5044, 0x5045, 0x5046, - 0x5047, 0x5048, 0x5049, 0x504a, 0x504b, 0x504c, 0x504d, 0x504e, - 0x504f, 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5055, 0x5056, - 0x5057, 0x5058, 0x5059, 0x505a, 0x505b, 0x505c, 0x505d, 0x505e, - 0x505f, 0x5060, 0x5061, 0x5062, 0x5063, 0x5064, 0x5065, 0x5066, - 0x5067, 0x5068, 0x5069, 0x506a, 0x506b, 0x506c, 0x506d, 0x506e, - 0x506f, 0x5070, 0x5071, 0x5072, 0x5073, 0x5074, 0x5075, 0x5076, - 0x5077, 0x5078, 0x5079, 0x507a, 0x507b, 0x507c, 0x507d, 0x507e, - 0x5121, 0x5122, 0x5123, 0x5124, 0x5125, 0x5126, 0x5127, 0x5128, - 0x5129, 0x512a, 0x512b, 0x512c, 0x512d, 0x512e, 0x512f, 0x5130, - 0x5131, 0x5132, 0x5133, 0x5134, 0x5135, 0x5136, 0x5137, 0x5138, - 0x5139, 0x513a, 0x513b, 0x513c, 0x513d, 0x513e, 0x513f, 0x5140, - 0x5141, 0x5142, 0x5143, 0x5144, 0x5145, 0x5146, 0x5147, 0x5148, - 0x5149, 0x514a, 0x514b, 0x514c, 0x514d, 0x514e, 0x514f, 0x5150, - 0x5151, 0x5152, 0x5153, 0x5154, 0x5155, 0x5156, 0x5157, 0x5158, - 0x5159, 0x515a, 0x515b, 0x515c, 0x515d, 0x515e, 0x515f, 0x5160, - 0x5161, 0x5162, 0x5163, 0x5164, 0x5165, 0x5166, 0x5167, 0x5168, - 0x5169, 0x516a, 0x516b, 0x516c, 0x516d, 0x516e, 0x516f, 0x5170, - 0x5171, 0x5172, 0x5173, 0x5174, 0x5175, 0x5176, 0x5177, 0x5178, - 0x5179, 0x517a, 0x517b, 0x517c, 0x517d, 0x517e, 0x5221, 0x5222, - 0x5223, 0x5224, 0x5225, 0x5226, 0x5227, 0x5228, 0x5229, 0x522a, - 0x522b, 0x522c, 0x522d, 0x522e, 0x522f, 0x5230, 0x5231, 0x5232, - 0x5233, 0x5234, 0x5235, 0x5236, 0x5237, 0x5238, 0x5239, 0x523a, - 0x523b, 0x523c, 0x523d, 0x523e, 0x523f, 0x5240, 0x5241, 0x5242, - 0x5243, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524a, - 0x524b, 0x524c, 0x524d, 0x524e, 0x524f, 0x5250, 0x5251, 0x5252, - 0x5253, 0x5254, 0x5255, 0x5256, 0x5257, 0x5258, 0x5259, 0x525a, - 0x525b, 0x525c, 0x525d, 0x525e, 0x525f, 0x5260, 0x5261, 0x5262, - 0x5263, 0x5264, 0x5265, 0x5266, 0x5267, 0x5268, 0x5269, 0x526a, - 0x526b, 0x526c, 0x526d, 0x526e, 0x526f, 0x5270, 0x5271, 0x5272, - 0x5273, 0x5274, 0x5276, 0x5277, 0x5278, 0x5275, 0x5279, 0x527a, - 0x527b, 0x527c, 0x527d, 0x527e, 0x5321, 0x5322, 0x5323, 0x5324, - 0x5325, 0x5326, 0x5327, 0x5328, 0x5329, 0x532a, 0x532b, 0x532c, - 0x532d, 0x532e, 0x532f, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, - 0x5335, 0x5336, 0x5337, 0x5338, 0x5339, 0x533a, 0x533b, 0x533c, - 0x533d, 0x533e, 0x533f, 0x5340, 0x5341, 0x5342, 0x5343, 0x5344, - 0x5345, 0x5346, 0x5347, 0x5348, 0x5349, 0x534a, 0x534b, 0x534c, - 0x534d, 0x534e, 0x534f, 0x5350, 0x5351, 0x5352, 0x5353, 0x5354, - 0x5355, 0x5356, 0x5357, 0x5358, 0x5359, 0x535a, 0x535b, 0x535c, - 0x535d, 0x535e, 0x535f, 0x5360, 0x5361, 0x5362, 0x5363, 0x5364, - 0x5365, 0x5366, 0x5367, 0x5368, 0x5369, 0x536a, 0x536b, 0x536c, - 0x536d, 0x536e, 0x536f, 0x5370, 0x5371, 0x5372, 0x5373, 0x5374, - 0x5375, 0x5376, 0x5377, 0x5378, 0x5379, 0x537a, 0x537b, 0x537c, - 0x537d, 0x537e, 0x5421, 0x5422, 0x5423, 0x5424, 0x5425, 0x5426, - 0x5427, 0x5428, 0x5429, 0x542a, 0x542b, 0x542c, 0x542d, 0x542e, - 0x542f, 0x5430, 0x5431, 0x5432, 0x5434, 0x5435, 0x5436, 0x5437, - 0x5438, 0x5439, 0x543a, 0x543b, 0x543c, 0x543d, 0x543e, 0x5433, - 0x543f, 0x5440, 0x5441, 0x5442, 0x5443, 0x5444, 0x5445, 0x5446, - 0x5447, 0x5448, 0x5449, 0x544a, 0x544b, 0x544c, 0x544d, 0x544e, - 0x544f, 0x5450, 0x5451, 0x5452, 0x5453, 0x5454, 0x5455, 0x5456, - 0x5457, 0x5458, 0x5459, 0x545a, 0x545b, 0x545c, 0x545d, 0x545e, - 0x545f, 0x5460, 0x5461, 0x5462, 0x5463, 0x5464, 0x5465, 0x5466, - 0x5467, 0x5468, 0x5469, 0x546a, 0x546c, 0x546b, 0x546d, 0x546e, - 0x546f, 0x5470, 0x5471, 0x5472, 0x5473, 0x5474, 0x5475, 0x5476, - 0x5477, 0x5478, 0x5479, 0x547a, 0x547b, 0x547c, 0x547d, 0x547e, - 0x5521, 0x5522, 0x5523, 0x5524, 0x5525, 0x5526, 0x5527, 0x5528, - 0x5529, 0x552a, 0x552b, 0x552c, 0x552d, 0x552e, 0x552f, 0x5530, - 0x5531, 0x5532, 0x5533, 0x5534, 0x5535, 0x5536, 0x5537, 0x5538, - 0x5539, 0x553a, 0x553b, 0x553c, 0x553d, 0x553e, 0x553f, 0x5540, - 0x5541, 0x5542, 0x5543, 0x5544, 0x5545, 0x5546, 0x5547, 0x5548, - 0x5549, 0x554a, 0x554b, 0x554c, 0x554d, 0x554e, 0x554f, 0x5550, - 0x5551, 0x5552, 0x5553, 0x5554, 0x5555, 0x5556, 0x5557, 0x5558, - 0x5559, 0x555a, 0x555b, 0x555c, 0x555d, 0x555e, 0x555f, 0x5560, - 0x5561, 0x5562, 0x5563, 0x5564, 0x5565, 0x5566, 0x5567, 0x5568, - 0x5569, 0x556a, 0x556b, 0x556c, 0x556d, 0x556e, 0x556f, 0x5570, - 0x5571, 0x5572, 0x5573, 0x5574, 0x5575, 0x5576, 0x5577, 0x5578, - 0x5579, 0x557a, 0x557b, 0x557c, 0x557d, 0x557e, 0x5621, 0x5622, - 0x5623, 0x5624, 0x5625, 0x5626, 0x5627, 0x5628, 0x5629, 0x562a, - 0x562b, 0x562c, 0x562d, 0x562e, 0x562f, 0x5630, 0x5631, 0x5632, - 0x5633, 0x5634, 0x5635, 0x5636, 0x5637, 0x5638, 0x5639, 0x563a, - 0x563b, 0x563c, 0x563d, 0x563e, 0x563f, 0x5640, 0x5641, 0x5642, - 0x5643, 0x5644, 0x5645, 0x5647, 0x5648, 0x5649, 0x564a, 0x564b, - 0x5646, 0x564c, 0x564d, 0x564e, 0x564f, 0x5650, 0x5651, 0x5652, - 0x5653, 0x5654, 0x5656, 0x5657, 0x5658, 0x5655, 0x5659, 0x565a, - 0x565b, 0x565c, 0x565d, 0x565e, 0x565f, 0x5660, 0x5661, 0x5662, - 0x5663, 0x5664, 0x5665, 0x5666, 0x5667, 0x5668, 0x5669, 0x566a, - 0x566b, 0x566c, 0x566d, 0x566e, 0x566f, 0x5670, 0x5671, 0x5672, - 0x5673, 0x5674, 0x5675, 0x5676, 0x5677, 0x5678, 0x5679, 0x567a, - 0x567b, 0x567c, 0x567d, 0x567e, 0x5721, 0x5722, 0x5723, 0x5724, - 0x5725, 0x5726, 0x5727, 0x5728, 0x5729, 0x572a, 0x572b, 0x572c, - 0x572d, 0x572e, 0x572f, 0x5730, 0x5731, 0x5732, 0x5733, 0x5734, - 0x5735, 0x5736, 0x5737, 0x5738, 0x5739, 0x573a, 0x573b, 0x573c, - 0x573d, 0x573e, 0x573f, 0x5740, 0x5741, 0x5742, 0x5743, 0x5744, - 0x5745, 0x5746, 0x5747, 0x5748, 0x5749, 0x574a, 0x574b, 0x574c, - 0x574d, 0x574e, 0x574f, 0x5750, 0x5751, 0x5752, 0x5753, 0x5754, - 0x5755, 0x5756, 0x5757, 0x5758, 0x5759, 0x575a, 0x575b, 0x575c, - 0x575d, 0x575e, 0x575f, 0x5760, 0x5761, 0x5762, 0x5764, 0x5765, - 0x5766, 0x5767, 0x5768, 0x5769, 0x576a, 0x576b, 0x576c, 0x576d, - 0x576e, 0x576f, 0x5770, 0x5771, 0x5772, 0x5773, 0x5774, 0x5775, - 0x5776, 0x5777, 0x5778, 0x5779, 0x583e, 0x5763, 0x577a, 0x577b, - 0x577c, 0x577d, 0x577e, 0x5821, 0x5822, 0x5823, 0x5824, 0x5825, - 0x5826, 0x5827, 0x5828, 0x5829, 0x582a, 0x582b, 0x582c, 0x582d, - 0x582e, 0x582f, 0x5830, 0x5831, 0x5832, 0x5833, 0x584c, 0x5834, - 0x5835, 0x5836, 0x5837, 0x5838, 0x5839, 0x583a, 0x583b, 0x583c, - 0x583d, 0x583f, 0x5840, 0x5841, 0x5842, 0x5843, 0x5844, 0x5845, - 0x5846, 0x5847, 0x5848, 0x5849, 0x584a, 0x584b, 0x584d, 0x584e, - 0x584f, 0x5850, 0x5851, 0x5852, 0x5853, 0x5854, 0x5855, 0x5856, - 0x5857, 0x5858, 0x5859, 0x585a, 0x585b, 0x585c, 0x585d, 0x585e, - 0x585f, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, 0x5865, 0x5866, - 0x5867, 0x5868, 0x5869, 0x586a, 0x586b, 0x586c, 0x586d, 0x586e, - 0x586f, 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, - 0x5877, 0x5878, 0x5879, 0x587a, 0x587b, 0x587c, 0x587d, 0x587e, - 0x5921, 0x5922, 0x5923, 0x5924, 0x5925, 0x5926, 0x5927, 0x5928, - 0x592a, 0x592b, 0x592c, 0x592d, 0x592e, 0x592f, 0x5930, 0x5931, - 0x5932, 0x5933, 0x5934, 0x5935, 0x5936, 0x5937, 0x5938, 0x5939, - 0x593a, 0x593b, 0x593c, 0x5929, 0x593d, 0x593e, 0x593f, 0x5940, - 0x5941, 0x5942, 0x5943, 0x5944, 0x5945, 0x5946, 0x5947, 0x5948, - 0x5949, 0x594a, 0x594b, 0x594c, 0x594d, 0x594e, 0x594f, 0x5950, - 0x5951, 0x5952, 0x5953, 0x5954, 0x5955, 0x5956, 0x5957, 0x5958, - 0x5959, 0x595a, 0x595b, 0x595c, 0x595d, 0x595e, 0x595f, 0x5960, - 0x5961, 0x5962, 0x5963, 0x5964, 0x5965, 0x5966, 0x5974, 0x5967, - 0x5968, 0x5969, 0x596a, 0x596b, 0x596c, 0x596d, 0x596e, 0x596f, - 0x5970, 0x5971, 0x5972, 0x5973, 0x5975, 0x5976, 0x5977, 0x5978, - 0x5979, 0x597a, 0x597b, 0x597c, 0x597d, 0x597e, 0x5a21, 0x5a22, - 0x5a23, 0x5a24, 0x5a25, 0x5a26, 0x5a27, 0x5a28, 0x5a29, 0x5a2a, - 0x5a2b, 0x5a2c, 0x5a2d, 0x5a2e, 0x5a2f, 0x5a30, 0x5a31, 0x5a32, - 0x5a33, 0x5a34, 0x5a35, 0x5a36, 0x3866, 0x5a37, 0x5a38, 0x5a39, - 0x5a3a, 0x5a3b, 0x5a3c, 0x5a3d, 0x5a3e, 0x5a3f, 0x5a40, 0x5a41, - 0x5a42, 0x5a43, 0x5a44, 0x5a45, 0x5a46, 0x5a47, 0x5a48, 0x5a49, - 0x5a4a, 0x5a4b, 0x5a6d, 0x5a4c, 0x5a4d, 0x5a4e, 0x5a4f, 0x5a50, - 0x5a51, 0x5a52, 0x5a53, 0x5a54, 0x5a55, 0x5a56, 0x5a57, 0x5a58, - 0x5a59, 0x5a5a, 0x5a5b, 0x5a5c, 0x5a5d, 0x5a5e, 0x5a5f, 0x5a60, - 0x5a61, 0x5a62, 0x5a63, 0x5a64, 0x5a65, 0x5a66, 0x5a67, 0x5a68, - 0x5a69, 0x5a6a, 0x5a6b, 0x5a6c, 0x5a6e, 0x5a6f, 0x5a70, 0x5a71, - 0x5a72, 0x5a73, 0x5a74, 0x5a75, 0x5a76, 0x5a77, 0x5a78, 0x5a79, - 0x5a7a, 0x5a7b, 0x5a7c, 0x5a7d, 0x5a7e, 0x5b21, 0x5b22, 0x5b23, - 0x5b24, 0x5b25, 0x5b26, 0x5b27, 0x5b28, 0x5b29, 0x5b2a, 0x5b2b, - 0x5b2c, 0x5b2d, 0x5b2e, 0x5b2f, 0x5b30, 0x5b31, 0x5b32, 0x5b33, - 0x5b34, 0x5b35, 0x5b36, 0x5b37, 0x5b38, 0x5b39, 0x5b3a, 0x5b3b, - 0x5b3c, 0x5b3d, 0x5b3e, 0x5b3f, 0x5b40, 0x5b41, 0x5b42, 0x5b43, - 0x5b44, 0x5b45, 0x5b46, 0x5b47, 0x5b48, 0x5b49, 0x5b4a, 0x5b4b, - 0x5b4c, 0x5b4d, 0x5b4e, 0x5b4f, 0x5b50, 0x5b51, 0x5b52, 0x5b53, - 0x5b54, 0x5b55, 0x5b56, 0x5b57, 0x5b58, 0x5b59, 0x5b5a, 0x5b5b, - 0x5b5c, 0x5b5d, 0x5b5e, 0x5b5f, 0x5b60, 0x5b61, 0x5b62, 0x5b63, - 0x5b64, 0x5b65, 0x5b66, 0x5b67, 0x5b68, 0x5b69, 0x5b6a, 0x5b6b, - 0x5b6c, 0x5b6d, 0x5b6e, 0x5b70, 0x5b71, 0x5b72, 0x5b73, 0x5b6f, - 0x5b74, 0x5b75, 0x5b76, 0x5b77, 0x5b78, 0x5b79, 0x5b7a, 0x5b7b, - 0x5b7c, 0x5b7d, 0x5b7e, 0x5c21, 0x5c22, 0x5c23, 0x5c24, 0x5c25, - 0x5c26, 0x5c27, 0x5c28, 0x5c29, 0x5c2a, 0x5c2b, 0x5c2c, 0x5c2d, - 0x5c2e, 0x5c2f, 0x5c30, 0x5c31, 0x5c32, 0x5c33, 0x5c34, 0x5c35, - 0x5c36, 0x5c37, 0x5c38, 0x5c39, 0x5c3a, 0x5c3b, 0x5c3c, 0x5c3d, - 0x5c3e, 0x5c3f, 0x5c40, 0x5c41, 0x5c42, 0x5c43, 0x5c44, 0x5c45, - 0x5c46, 0x5c47, 0x5c48, 0x5c49, 0x5c4a, 0x5c4b, 0x5c4c, 0x5c4d, - 0x5c4e, 0x5c4f, 0x5c50, 0x5c51, 0x5c52, 0x5c53, 0x5c54, 0x5c55, - 0x5c56, 0x5c57, 0x5c58, 0x5c59, 0x5c5a, 0x5c5b, 0x5c5c, 0x5c5d, - 0x5c5e, 0x5c5f, 0x5c60, 0x5c61, 0x5c62, 0x5c63, 0x5c64, 0x5c65, - 0x5c66, 0x5c67, 0x5c68, 0x5c69, 0x5c6a, 0x5c6b, 0x5c6c, 0x5c6d, - 0x5c6e, 0x5c6f, 0x5c70, 0x5c71, 0x5c72, 0x5c73, 0x5c74, 0x5c75, - 0x5c76, 0x5c77, 0x5c78, 0x5c79, 0x5c7a, 0x5c7b, 0x5c7c, 0x5c7d, - 0x5c7e, 0x5d21, 0x5d22, 0x5d23, 0x5d24, 0x5d25, 0x5d26, 0x5d27, - 0x5d28, 0x5d29, 0x5d2a, 0x5d2b, 0x5d2c, 0x5d2d, 0x5d2e, 0x5d2f, - 0x5d30, 0x5d31, 0x5d32, 0x5d33, 0x5d34, 0x5d35, 0x5d36, 0x5d37, - 0x5d38, 0x5d39, 0x5d3a, 0x5d3b, 0x5d3c, 0x5d3d, 0x5d3e, 0x5d3f, - 0x5d40, 0x5d41, 0x5d42, 0x5d43, 0x5d44, 0x5d45, 0x5d46, 0x5d47, - 0x5d48, 0x5d49, 0x5d4a, 0x5d4b, 0x5d4c, 0x5d4d, 0x5d4e, 0x5d4f, - 0x5d50, 0x5d51, 0x5d52, 0x5d53, 0x5d54, 0x5d55, 0x5d56, 0x5d57, - 0x5d58, 0x5d59, 0x5d5a, 0x5d5b, 0x5d5c, 0x5d5d, 0x5d5e, 0x5d5f, - 0x5d60, 0x5d61, 0x5d62, 0x5d63, 0x5d64, 0x5d65, 0x5d66, 0x5d67, - 0x5d68, 0x5d69, 0x5d6a, 0x5d6b, 0x5d6c, 0x5d6d, 0x5d6e, 0x5d6f, - 0x5d70, 0x5d71, 0x5d72, 0x5d73, 0x5d74, 0x5d75, 0x5d76, 0x5d77, - 0x5d78, 0x5d79, 0x5d7a, 0x5d7b, 0x5d7c, 0x5d7d, 0x5d7e, 0x5e21, - 0x5e22, 0x5e23, 0x5e24, 0x5e25, 0x5e26, 0x5e27, 0x5e28, 0x5e29, - 0x5e2a, 0x5e2b, 0x5e2c, 0x5e2d, 0x5e2e, 0x5e2f, 0x5e30, 0x5e31, - 0x5e32, 0x5e33, 0x5e34, 0x5e35, 0x5e36, 0x5e37, 0x5e38, 0x5e39, - 0x5e3f, 0x5e3a, 0x5e3b, 0x5e3c, 0x5e3d, 0x5e3e, 0x5e40, 0x5e41, - 0x5e42, 0x5e43, 0x5e44, 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, - 0x5e4e, 0x5e4a, 0x5e4b, 0x5e4c, 0x5e4d, 0x5e4f, 0x5e50, 0x5e51, - 0x5e52, 0x5e53, 0x5e54, 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, - 0x5e5a, 0x5e5b, 0x5e5c, 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, - 0x5e62, 0x5e63, 0x5e64, 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, - 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, 0x5e6f, 0x5e72, 0x5e70, - 0x5e71, 0x5e73, 0x5e74, 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, - 0x5e7a, 0x5e7b, 0x5e7c, 0x5e7d, 0x5e7e, 0x5f21, 0x5f22, 0x5f23, - 0x5f24, 0x5f25, 0x5f26, 0x5f27, 0x5f28, 0x5f29, 0x5f2a, 0x5f2b, - 0x5f2c, 0x5f2d, 0x5f2e, 0x5f2f, 0x5f30, 0x5f32, 0x5f31, 0x5f33, - 0x5f34, 0x5f35, 0x5f36, 0x5f37, 0x5f38, 0x5f39, 0x5f3a, 0x5f3b, - 0x5f3c, 0x5f3d, 0x5f3e, 0x5f3f, 0x5f40, 0x5f41, 0x5f42, 0x5f43, - 0x5f44, 0x5f45, 0x5f46, 0x5f47, 0x5f48, 0x5f49, 0x5f4a, 0x5f4b, - 0x5f4c, 0x5f4d, 0x5f4e, 0x5f4f, 0x5f50, 0x5f51, 0x5f52, 0x5f53, - 0x5f54, 0x5f55, 0x5f56, 0x5f57, 0x5f58, 0x5f59, 0x5f5a, 0x5f5b, - 0x5f5c, 0x5f5d, 0x5f6f, 0x5f5e, 0x5f5f, 0x5f60, 0x5f61, 0x5f62, - 0x5f63, 0x5f64, 0x5f65, 0x5f66, 0x5f67, 0x5f68, 0x5f69, 0x5f6a, - 0x5f6b, 0x5f6c, 0x5f6d, 0x5f6e, 0x5f70, 0x5f71, 0x5f72, 0x5f73, - 0x5f74, 0x5f75, 0x5f76, 0x5f77, 0x5f78, 0x5f79, 0x5f7a, 0x5f7b, - 0x5f7c, 0x5f7d, 0x5f7e, 0x6021, 0x6022, 0x6023, 0x6024, 0x6025, - 0x6026, 0x6027, 0x6028, 0x6029, 0x602a, 0x602b, 0x602c, 0x602d, - 0x602e, 0x602f, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6035, - 0x6036, 0x6037, 0x6038, 0x6039, 0x603a, 0x603b, 0x603c, 0x603d, - 0x603e, 0x603f, 0x6040, 0x6041, 0x6042, 0x6043, 0x6044, 0x6045, - 0x6046, 0x6047, 0x6048, 0x6049, 0x604a, 0x604b, 0x604c, 0x604d, - 0x604e, 0x604f, 0x6050, 0x6051, 0x6052, 0x6053, 0x6054, 0x6055, - 0x6056, 0x6057, 0x6058, 0x6059, 0x605a, 0x605b, 0x605c, 0x605d, - 0x6064, 0x605e, 0x605f, 0x6060, 0x6061, 0x6062, 0x6063, 0x6065, - 0x6066, 0x6067, 0x6068, 0x6069, 0x606a, 0x606b, 0x606c, 0x606d, - 0x606e, 0x606f, 0x6070, 0x6071, 0x6072, 0x6073, 0x6074, 0x6075, - 0x6076, 0x6077, 0x6078, 0x6079, 0x607a, 0x607b, 0x607c, 0x607d, - 0x607e, 0x6121, 0x6122, 0x6123, 0x6124, 0x6125, 0x6126, 0x6127, - 0x6128, 0x6129, 0x612a, 0x612b, 0x612c, 0x612d, 0x612e, 0x612f, - 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, 0x6137, - 0x6138, 0x6139, 0x613a, 0x613b, 0x613c, 0x613d, 0x613e, 0x613f, - 0x6140, 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, 0x6147, - 0x6148, 0x6149, 0x614a, 0x614b, 0x614c, 0x614d, 0x614e, 0x614f, - 0x6150, 0x6151, 0x6152, 0x6154, 0x6155, 0x6156, 0x6153, 0x6157, - 0x6158, 0x6159, 0x615a, 0x615b, 0x615c, 0x615d, 0x615e, 0x615f, - 0x6160, 0x6161, 0x6162, 0x6163, 0x6164, 0x6165, 0x6166, 0x6167, - 0x6168, 0x6169, 0x616a, 0x616b, 0x616c, 0x616d, 0x616e, 0x616f, - 0x6170, 0x6171, 0x6172, 0x6173, 0x6174, 0x6175, 0x6176, 0x6177, - 0x6178, 0x6179, 0x617a, 0x617b, 0x617d, 0x617e, 0x6221, 0x6222, - 0x6223, 0x6224, 0x617c, 0x622d, 0x6225, 0x6226, 0x6227, 0x6228, - 0x6229, 0x622a, 0x622b, 0x622c, 0x622f, 0x6230, 0x6231, 0x6232, - 0x622e, 0x6233, 0x6234, 0x6235, 0x6236, 0x6237, 0x6238, 0x6239, - 0x623a, 0x623b, 0x623c, 0x623d, 0x623e, 0x623f, 0x6240, 0x6241, - 0x6242, 0x6243, 0x6245, 0x6246, 0x6244, 0x6247, 0x6248, 0x6249, - 0x624a, 0x624b, 0x624c, 0x624d, 0x624e, 0x624f, 0x6250, 0x6251, - 0x6252, 0x6253, 0x6254, 0x6255, 0x6256, 0x6257, 0x6258, 0x6259, - 0x625a, 0x625b, 0x625c, 0x625d, 0x625e, 0x625f, 0x6260, 0x6261, - 0x6262, 0x6263, 0x6264, 0x6265, 0x6266, 0x6267, 0x6268, 0x6269, - 0x626a, 0x626b, 0x626c, 0x626d, 0x626e, 0x626f, 0x6270, 0x6271, - 0x6272, 0x6273, 0x6274, 0x6275, 0x6276, 0x6277, 0x6278, 0x6279, - 0x627a, 0x627b, 0x627c, 0x627d, 0x627e, 0x6321, 0x6322, 0x6323, - 0x6324, 0x6325, 0x6326, 0x6327, 0x6328, 0x6329, 0x632a, 0x632b, - 0x632c, 0x632d, 0x632e, 0x632f, 0x6330, 0x6331, 0x6332, 0x6333, - 0x6334, 0x6335, 0x6336, 0x6337, 0x6338, 0x6339, 0x633a, 0x633b, - 0x633c, 0x633d, 0x633e, 0x633f, 0x6340, 0x6341, 0x6342, 0x6343, - 0x6344, 0x6345, 0x6346, 0x6347, 0x6348, 0x6349, 0x634a, 0x634b, - 0x634c, 0x634d, 0x634e, 0x634f, 0x6350, 0x6351, 0x6352, 0x6353, - 0x6354, 0x6355, 0x6356, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, - 0x635c, 0x635d, 0x635e, 0x635f, 0x6360, 0x6361, 0x6362, 0x6363, - 0x6364, 0x6365, 0x6366, 0x6367, 0x6368, 0x6369, 0x636a, 0x636b, - 0x636c, 0x636d, 0x636e, 0x636f, 0x6370, 0x6371, 0x6372, 0x6373, - 0x6374, 0x6375, 0x6376, 0x6377, 0x6378, 0x6379, 0x637a, 0x637b, - 0x637c, 0x637d, 0x637e, 0x6421, 0x6422, 0x6423, 0x6424, 0x6425, - 0x6426, 0x6427, 0x6428, 0x6429, 0x642a, 0x642b, 0x642c, 0x642d, - 0x642e, 0x642f, 0x6430, 0x6431, 0x6432, 0x6433, 0x6434, 0x6435, - 0x6436, 0x6437, 0x6438, 0x6439, 0x643a, 0x643b, 0x643c, 0x643d, - 0x643e, 0x643f, 0x6440, 0x6441, 0x6442, 0x6443, 0x6444, 0x6445, - 0x6446, 0x6447, 0x6448, 0x6449, 0x644a, 0x644b, 0x644c, 0x644d, - 0x644e, 0x644f, 0x6450, 0x6451, 0x6452, 0x6453, 0x6454, 0x6455, - 0x6456, 0x6457, 0x6458, 0x6459, 0x645a, 0x645b, 0x645c, 0x645d, - 0x645e, 0x645f, 0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, - 0x6466, 0x6467, 0x6468, 0x6469, 0x646a, 0x646b, 0x646c, 0x646d, - 0x646e, 0x646f, 0x6470, 0x6471, 0x6472, 0x6473, 0x6474, 0x6475, - 0x6476, 0x6477, 0x6478, 0x6479, 0x647a, 0x647b, 0x647c, 0x647d, - 0x647e, 0x6521, 0x6522, 0x6523, 0x6524, 0x6525, 0x6526, 0x6527, - 0x6528, 0x6529, 0x652a, 0x652b, 0x652c, 0x652d, 0x652e, 0x652f, - 0x6530, 0x6531, 0x6532, 0x6533, 0x6534, 0x6535, 0x653b, 0x6536, - 0x6537, 0x6538, 0x6539, 0x653a, 0x653c, 0x653d, 0x653e, 0x653f, - 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6545, 0x6546, 0x6547, - 0x6548, 0x6549, 0x654a, 0x654b, 0x654c, 0x654d, 0x654f, 0x6550, - 0x654e, 0x6551, 0x6552, 0x6553, 0x6554, 0x6555, 0x6556, 0x6557, - 0x6558, 0x6559, 0x655a, 0x655b, 0x655c, 0x655d, 0x655e, 0x655f, - 0x6560, 0x6561, 0x6562, 0x6563, 0x6564, 0x6565, 0x6566, 0x6568, - 0x6567, 0x6569, 0x656a, 0x656b, 0x656c, 0x656d, 0x656e, 0x656f, - 0x6570, 0x6571, 0x6572, 0x6573, 0x6574, 0x6575, 0x6576, 0x6577, - 0x6578, 0x6579, 0x657a, 0x657c, 0x657b, 0x657d, 0x657e, 0x6621, - 0x6622, 0x6623, 0x6624, 0x6625, 0x6626, 0x6627, 0x6628, 0x6629, - 0x662a, 0x662b, 0x662c, 0x662d, 0x662e, 0x662f, 0x6630, 0x6631, - 0x6632, 0x6633, 0x6634, 0x6635, 0x6636, 0x6637, 0x6638, 0x6639, - 0x663a, 0x663b, 0x663c, 0x663d, 0x663e, 0x663f, 0x6640, 0x6641, - 0x6642, 0x6643, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, 0x6649, - 0x664a, 0x664b, 0x664c, 0x664d, 0x664e, 0x664f, 0x6650, 0x6651, - 0x6652, 0x6653, 0x6654, 0x6655, 0x6656, 0x6657, 0x6658, 0x6659, - 0x665a, 0x665b, 0x665c, 0x665d, 0x665e, 0x665f, 0x6660, 0x6661, - 0x6662, 0x6663, 0x6664, 0x6665, 0x6666, 0x6667, 0x6668, 0x6669, - 0x666a, 0x666b, 0x666c, 0x666d, 0x666e, 0x666f, 0x6670, 0x6671, - 0x6672, 0x6673, 0x6675, 0x6676, 0x6677, 0x6678, 0x6679, 0x667a, - 0x667b, 0x667c, 0x667d, 0x667e, 0x6721, 0x6722, 0x6723, 0x6724, - 0x6725, 0x6726, 0x6727, 0x6728, 0x6729, 0x672a, 0x672b, 0x672c, - 0x672d, 0x672e, 0x672f, 0x6730, 0x6731, 0x6732, 0x6733, 0x6734, - 0x6735, 0x6736, 0x6737, 0x6738, 0x6739, 0x673a, 0x673b, 0x673c, - 0x673d, 0x673e, 0x673f, 0x6740, 0x6741, 0x6742, 0x6743, 0x6744, - 0x6745, 0x6746, 0x6747, 0x6748, 0x6749, 0x674a, 0x674b, 0x674c, - 0x674d, 0x674e, 0x674f, 0x6750, 0x6751, 0x6752, 0x6753, 0x6754, - 0x6755, 0x6756, 0x6757, 0x6758, 0x6759, 0x675a, 0x675b, 0x675c, - 0x675d, 0x675e, 0x675f, 0x6760, 0x6761, 0x6762, 0x6763, 0x6764, - 0x6765, 0x6766, 0x676a, 0x6767, 0x6768, 0x6769, 0x676b, 0x676c, - 0x676d, 0x676e, 0x676f, 0x6770, 0x6771, 0x6772, 0x6773, 0x6774, - 0x6776, 0x6777, 0x6778, 0x6779, 0x6775, 0x677a, 0x677b, 0x677c, - 0x677d, 0x6828, 0x677e, 0x6821, 0x6822, 0x6823, 0x6824, 0x6825, - 0x6826, 0x6827, 0x6829, 0x682a, 0x682b, 0x682c, 0x682d, 0x682e, - 0x682f, 0x6830, 0x6831, 0x6832, 0x6833, 0x6834, 0x6835, 0x6836, - 0x6837, 0x6838, 0x6839, 0x683a, 0x683b, 0x683c, 0x683d, 0x683e, - 0x683f, 0x6840, 0x6841, 0x6842, 0x6843, 0x6844, 0x6845, 0x6846, - 0x6847, 0x6848, 0x6849, 0x684a, 0x684b, 0x684c, 0x684d, 0x684e, - 0x684f, 0x6850, 0x6851, 0x6852, 0x6853, 0x6854, 0x6855, 0x6856, - 0x6857, 0x6858, 0x6859, 0x685a, 0x685b, 0x685c, 0x685d, 0x685e, - 0x685f, 0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6865, 0x6866, - 0x6867, 0x6868, 0x6869, 0x686a, 0x686b, 0x686c, 0x686d, 0x686e, - 0x686f, 0x6870, 0x6871, 0x6872, 0x6873, 0x6874, 0x6875, 0x6876, - 0x6877, 0x6878, 0x6879, 0x687a, 0x687b, 0x687c, 0x687d, 0x687e, - 0x6921, 0x6922, 0x6923, 0x6924, 0x6925, 0x6926, 0x6927, 0x6928, - 0x6929, 0x692a, 0x692b, 0x692c, 0x692d, 0x692e, 0x692f, 0x6930, - 0x6931, 0x6932, 0x6933, 0x6934, 0x6935, 0x6936, 0x6937, 0x6938, - 0x6939, 0x693a, 0x693b, 0x693c, 0x693d, 0x693e, 0x693f, 0x6940, - 0x6941, 0x6942, 0x6943, 0x6944, 0x6945, 0x6946, 0x6947, 0x6948, - 0x6949, 0x694a, 0x694c, 0x694d, 0x694b, 0x694e, 0x694f, 0x6950, - 0x6951, 0x6952, 0x6953, 0x6954, 0x6955, 0x6956, 0x6957, 0x6958, - 0x6959, 0x695a, 0x695b, 0x695c, 0x695d, 0x695e, 0x695f, 0x6960, - 0x6961, 0x6962, 0x6963, 0x6964, 0x6965, 0x6966, 0x6967, 0x6968, - 0x6969, 0x696a, 0x696b, 0x696c, 0x696d, 0x696e, 0x696f, 0x6970, - 0x6971, 0x6972, 0x6973, 0x6974, 0x6975, 0x6976, 0x6977, 0x6978, - 0x6979, 0x697a, 0x697b, 0x697c, 0x697d, 0x697e, 0x6a21, 0x6a22, - 0x6a23, 0x6a24, 0x6a25, 0x6a26, 0x6a27, 0x6a28, 0x6a29, 0x6a2a, - 0x6a2b, 0x6a2c, 0x6a2d, 0x6a2e, 0x6a2f, 0x6a30, 0x6a31, 0x6a32, - 0x6a33, 0x6a34, 0x6a35, 0x6a36, 0x6a37, 0x6a38, 0x6a39, 0x6a3a, - 0x6a3b, 0x6a3c, 0x6a3d, 0x6a3e, 0x6a3f, 0x6a40, 0x6a41, 0x6a42, - 0x6a43, 0x6a44, 0x6a45, 0x6a46, 0x6a47, 0x6a48, 0x6a49, 0x6a4a, - 0x6a4b, 0x6a4c, 0x6a4d, 0x6a4e, 0x6a4f, 0x6a50, 0x6a51, 0x6a52, - 0x6a53, 0x6a54, 0x6a55, 0x6a56, 0x6a57, 0x6a58, 0x6a59, 0x6a5a, - 0x6a5b, 0x6a5c, 0x6a5d, 0x6a5e, 0x6a5f, 0x6a60, 0x6a61, 0x6a62, - 0x6a63, 0x6a64, 0x6a65, 0x6a66, 0x6a67, 0x6a68, 0x6a69, 0x6a6a, - 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, 0x6a6f, 0x6a70, 0x6a71, 0x6a72, - 0x6a73, 0x6a74, 0x6a75, 0x6a76, 0x6a77, 0x6a78, 0x6a79, 0x6a7a, - 0x6a7b, 0x6a7c, 0x6a7d, 0x6a7e, 0x6b21, 0x6b22, 0x6b23, 0x6b24, - 0x6b25, 0x6b26, 0x6b27, 0x6b28, 0x6b29, 0x6b2a, 0x6b2b, 0x6b2c, - 0x6b2d, 0x6b2e, 0x6b2f, 0x6b30, 0x6b31, 0x6b32, 0x6b33, 0x6b34, - 0x6b35, 0x6b36, 0x6b37, 0x6b38, 0x6b39, 0x6b3a, 0x6b3b, 0x6b3c, - 0x6b3d, 0x6b3e, 0x6b3f, 0x6b40, 0x6b41, 0x6b42, 0x6b43, 0x6b44, - 0x6b45, 0x6b46, 0x6b47, 0x6b48, 0x6b49, 0x6b50, 0x6b4a, 0x6b4b, - 0x6b4c, 0x6b4d, 0x6b52, 0x6b4e, 0x6b4f, 0x6b51, 0x6b53, 0x6b54, - 0x6b55, 0x6b56, 0x6b57, 0x6b58, 0x6b59, 0x6b5a, 0x6b5b, 0x6b5c, - 0x6b5e, 0x6b5d, 0x6b5f, 0x6b60, 0x6b61, 0x6b62, 0x6b63, 0x6b64, - 0x6b65, 0x6b66, 0x6b67, 0x6b68, 0x6b69, 0x6b6a, 0x6b6b, 0x6b6d, - 0x6b6e, 0x6b6f, 0x6b6c, 0x6b70, 0x6b71, 0x6b72, 0x6b73, 0x6b74, - 0x6b76, 0x6b75, 0x6b77, 0x6b78, 0x6b79, 0x6b7a, 0x6b7b, 0x6b7c, - 0x6b7d, 0x6b7e, 0x6c21, 0x6c22, 0x6c23, 0x6c24, 0x6c25, 0x6c26, - 0x6c27, 0x6c28, 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x6c2d, 0x6c2e, - 0x6c2f, 0x6c30, 0x6c31, 0x6c32, 0x6c33, 0x6c34, 0x6c35, 0x6c36, - 0x6c37, 0x6c38, 0x6c39, 0x6c3a, 0x6c3b, 0x6c3c, 0x6c3d, 0x6c3e, - 0x6c3f, 0x6c40, 0x6c41, 0x6c42, 0x6c43, 0x6c44, 0x6c45, 0x6c46, - 0x6c47, 0x6c48, 0x6c49, 0x6c4a, 0x6c4b, 0x6c4c, 0x6c4e, 0x6c4f, - 0x6c4d, 0x6c50, 0x6c51, 0x6c52, 0x6c53, 0x6c54, 0x6c55, 0x6c56, - 0x6c57, 0x6c58, 0x6c59, 0x6c5a, 0x6c5b, 0x6c5c, 0x6c5d, 0x6c5e, - 0x6c5f, 0x6c60, 0x6c61, 0x6c62, 0x6c63, 0x6c64, 0x6c65, 0x6c66, - 0x6c67, 0x6c68, 0x6c69, 0x6c6a, 0x6c6b, 0x6c6c, 0x6c6d, 0x6c6e, - 0x6c6f, 0x6c70, 0x6c71, 0x6c72, 0x6c73, 0x6c74, 0x6c75, 0x6c76, - 0x6c77, 0x6c78, 0x6c79, 0x6c7a, 0x6c7b, 0x6c7c, 0x6c7d, 0x6c7e, - 0x6d21, 0x6d22, 0x6d23, 0x6d24, 0x6d25, 0x6d26, 0x6d27, 0x6d28, - 0x6d29, 0x6d2a, 0x6d2b, 0x6d2c, 0x6d2d, 0x6d2e, 0x6d2f, 0x6d30, - 0x6d31, 0x6d32, 0x6d33, 0x6d34, 0x6d35, 0x6d36, 0x6d37, 0x6d38, - 0x6d39, 0x6d3a, 0x6d3b, 0x6d3c, 0x6d3d, 0x6d3e, 0x6d3f, 0x6d40, - 0x6d41, 0x6d42, 0x6d43, 0x6d44, 0x6d45, 0x6d46, 0x6d47, 0x6d48, - 0x6d49, 0x6d4a, 0x6d4b, 0x6d4c, 0x6d4d, 0x6d4e, 0x6d4f, 0x6d50, - 0x6d51, 0x6d52, 0x6d53, 0x6d54, 0x6d55, 0x6d56, 0x6d57, 0x6d58, - 0x6d59, 0x6d5a, 0x6d5b, 0x6d5c, 0x6d5d, 0x6d5e, 0x6d5f, 0x6d60, - 0x6d61, 0x6d62, 0x6d63, -}; - -static const Summary16 jisx0212_uni2indx_page00[70] = { - /* 0x0000 */ - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x4000 }, - { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0xc652 }, { 8, 0x8500 }, - { 11, 0xffff }, { 27, 0xff7e }, { 41, 0xffff }, { 57, 0xff7f }, - /* 0x0100 */ - { 72, 0xffff }, { 88, 0xffcf }, { 102, 0xcff7 }, { 115, 0xffff }, - { 131, 0x3fff }, { 145, 0xffff }, { 161, 0xffff }, { 177, 0x7fff }, - { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, - { 192, 0xe000 }, { 195, 0x1fff }, { 208, 0x0000 }, { 208, 0x0020 }, - /* 0x0200 */ - { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, - { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, - { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, - { 209, 0x0080 }, { 210, 0x2f00 }, { 215, 0x0000 }, { 215, 0x0000 }, - /* 0x0300 */ - { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, - { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, - { 215, 0xd770 }, { 224, 0x0001 }, { 225, 0xfc00 }, { 231, 0x0001 }, - { 232, 0x7c04 }, { 238, 0x0000 }, { 238, 0x0000 }, { 238, 0x0000 }, - /* 0x0400 */ - { 238, 0xdffc }, { 251, 0x0000 }, { 251, 0x0000 }, { 251, 0x0000 }, - { 251, 0x0000 }, { 251, 0xdffc }, -}; -static const Summary16 jisx0212_uni2indx_page21[3] = { - /* 0x2100 */ - { 264, 0x0000 }, { 264, 0x0040 }, { 265, 0x0004 }, -}; -static const Summary16 jisx0212_uni2indx_page4e[1307] = { - /* 0x4e00 */ - { 266, 0x1034 }, { 270, 0x8004 }, { 272, 0xc918 }, { 278, 0x0021 }, - { 280, 0x0093 }, { 284, 0x1402 }, { 287, 0x0308 }, { 290, 0x8230 }, - { 294, 0x2000 }, { 295, 0x20c0 }, { 298, 0x8000 }, { 299, 0x0200 }, - { 300, 0x0008 }, { 301, 0x0c01 }, { 304, 0x8107 }, { 309, 0xe02a }, - /* 0x4f00 */ - { 315, 0x190d }, { 321, 0x02e4 }, { 326, 0x4000 }, { 327, 0x4aaa }, - { 334, 0x1b05 }, { 340, 0x8154 }, { 345, 0x5409 }, { 350, 0x6782 }, - { 357, 0x5636 }, { 365, 0xc69d }, { 374, 0x0000 }, { 374, 0x7a84 }, - { 381, 0xbb63 }, { 391, 0x1004 }, { 393, 0x0005 }, { 395, 0xb005 }, - /* 0x5000 */ - { 400, 0x5493 }, { 407, 0x7989 }, { 415, 0x4084 }, { 418, 0x082d }, - { 423, 0x5467 }, { 431, 0x828e }, { 437, 0x24cd }, { 444, 0x0003 }, - { 446, 0xc45a }, { 453, 0xd85d }, { 462, 0x8407 }, { 467, 0x2601 }, - { 471, 0x5099 }, { 477, 0xb119 }, { 484, 0x8354 }, { 490, 0x4446 }, - /* 0x5100 */ - { 495, 0x79c8 }, { 503, 0x7a81 }, { 510, 0xb188 }, { 516, 0x033a }, - { 522, 0x8404 }, { 525, 0x81a8 }, { 530, 0x0050 }, { 532, 0x4000 }, - { 533, 0x4818 }, { 537, 0x2100 }, { 539, 0x200a }, { 542, 0xd500 }, - { 547, 0x8104 }, { 550, 0x412e }, { 556, 0x4024 }, { 559, 0x009c }, - /* 0x5200 */ - { 563, 0x0026 }, { 566, 0x016c }, { 571, 0x0104 }, { 573, 0x1026 }, - { 577, 0x0220 }, { 579, 0x95a0 }, { 585, 0x4043 }, { 589, 0x0380 }, - { 592, 0x1425 }, { 597, 0x15e8 }, { 604, 0x80f0 }, { 609, 0x2dc1 }, - { 616, 0x9151 }, { 622, 0x1852 }, { 627, 0x1722 }, { 633, 0x00d3 }, - /* 0x5300 */ - { 638, 0x1c09 }, { 643, 0xd90a }, { 650, 0x3ba0 }, { 657, 0x7025 }, - { 663, 0x1804 }, { 666, 0x0a00 }, { 668, 0x302a }, { 673, 0x4204 }, - { 676, 0x4188 }, { 680, 0x2218 }, { 684, 0x8c12 }, { 689, 0x25b4 }, - { 696, 0x8021 }, { 699, 0x642c }, { 705, 0x00c1 }, { 708, 0x0020 }, - /* 0x5400 */ - { 709, 0x0004 }, { 710, 0x0408 }, { 712, 0x8582 }, { 717, 0x0032 }, - { 720, 0xa098 }, { 725, 0x4000 }, { 726, 0x6ad4 }, { 734, 0x8010 }, - { 736, 0x232a }, { 742, 0x9062 }, { 747, 0x66c2 }, { 754, 0x8e82 }, - { 760, 0x6440 }, { 764, 0x0000 }, { 764, 0x9401 }, { 768, 0xd040 }, - /* 0x5500 */ - { 772, 0x7323 }, { 780, 0x0020 }, { 781, 0x0c00 }, { 783, 0x3864 }, - { 789, 0x2682 }, { 794, 0x4d03 }, { 800, 0x0053 }, { 804, 0x8000 }, - { 805, 0xc146 }, { 811, 0x009e }, { 816, 0x2018 }, { 819, 0x8004 }, - { 821, 0x5a4a }, { 828, 0x498e }, { 835, 0x0204 }, { 837, 0x8040 }, - /* 0x5600 */ - { 839, 0xe520 }, { 845, 0x0207 }, { 849, 0x1000 }, { 850, 0xbaa9 }, - { 859, 0xaa5b }, { 868, 0x4010 }, { 870, 0xa24f }, { 878, 0x0026 }, - { 881, 0x1930 }, { 886, 0xe620 }, { 892, 0x3bc0 }, { 899, 0x408a }, - { 903, 0xbe20 }, { 910, 0xb201 }, { 915, 0x29f2 }, { 923, 0x00c2 }, - /* 0x5700 */ - { 926, 0x1486 }, { 931, 0x2c22 }, { 936, 0xd63d }, { 946, 0xe018 }, - { 951, 0x3060 }, { 955, 0x0004 }, { 956, 0xe9a4 }, { 964, 0x5ebb }, - { 975, 0x100a }, { 978, 0xf6b0 }, { 987, 0x1382 }, { 992, 0x2100 }, - { 994, 0x9180 }, { 998, 0x6020 }, { 1001, 0x22d2 }, { 1007, 0xe161 }, - /* 0x5800 */ - { 1014, 0x3318 }, { 1020, 0xc800 }, { 1023, 0x20c1 }, { 1027, 0x8204 }, - { 1030, 0xb200 }, { 1034, 0x8021 }, { 1037, 0x0192 }, { 1041, 0x9100 }, - { 1044, 0xb783 }, { 1053, 0x2051 }, { 1057, 0x0247 }, { 1062, 0x1006 }, - { 1065, 0x6114 }, { 1070, 0x2455 }, { 1076, 0x0206 }, { 1079, 0x0008 }, - /* 0x5900 */ - { 1080, 0x1860 }, { 1084, 0x201c }, { 1088, 0x811a }, { 1093, 0x8069 }, - { 1098, 0x0048 }, { 1100, 0xea0c }, { 1107, 0xa80a }, { 1112, 0x1a64 }, - { 1118, 0x5800 }, { 1121, 0x80a4 }, { 1125, 0xe090 }, { 1130, 0x1489 }, - { 1135, 0x251a }, { 1141, 0xe004 }, { 1145, 0xc098 }, { 1150, 0x0096 }, - /* 0x5a00 */ - { 1154, 0x7011 }, { 1159, 0x400c }, { 1162, 0x2598 }, { 1168, 0x0001 }, - { 1169, 0x11b0 }, { 1174, 0x4021 }, { 1177, 0x20a8 }, { 1181, 0x4c80 }, - { 1185, 0x0800 }, { 1186, 0xd249 }, { 1193, 0x1085 }, { 1197, 0x8d2e }, - { 1205, 0x8150 }, { 1209, 0x1400 }, { 1211, 0x4421 }, { 1215, 0x2060 }, - /* 0x5b00 */ - { 1218, 0x0103 }, { 1221, 0x2a80 }, { 1225, 0x2022 }, { 1228, 0x0110 }, - { 1230, 0x1802 }, { 1233, 0x4044 }, { 1236, 0xc100 }, { 1239, 0xf000 }, - { 1243, 0x4452 }, { 1248, 0x005b }, { 1253, 0xb300 }, { 1258, 0x1486 }, - { 1263, 0xa003 }, { 1267, 0x07c0 }, { 1272, 0x8001 }, { 1274, 0x2012 }, - /* 0x5c00 */ - { 1277, 0x1000 }, { 1278, 0xc080 }, { 1281, 0x5a48 }, { 1287, 0x0065 }, - { 1291, 0x0000 }, { 1291, 0x1600 }, { 1294, 0x238c }, { 1300, 0x3c31 }, - { 1307, 0x8580 }, { 1311, 0xa004 }, { 1314, 0x044d }, { 1319, 0x0434 }, - { 1323, 0x0a00 }, { 1325, 0x2084 }, { 1328, 0x4000 }, { 1329, 0x0016 }, - /* 0x5d00 */ - { 1332, 0x2042 }, { 1335, 0x0004 }, { 1336, 0x08d8 }, { 1341, 0xa212 }, - { 1346, 0x054c }, { 1351, 0x8222 }, { 1355, 0x2417 }, { 1361, 0xc601 }, - { 1366, 0x050a }, { 1370, 0x8a3c }, { 1377, 0x0881 }, { 1380, 0x0315 }, - { 1385, 0x4888 }, { 1389, 0x0301 }, { 1392, 0x0211 }, { 1395, 0x0300 }, - /* 0x5e00 */ - { 1397, 0x2081 }, { 1400, 0x8134 }, { 1405, 0x4101 }, { 1408, 0x4024 }, - { 1411, 0x0a00 }, { 1413, 0x5943 }, { 1420, 0x7d00 }, { 1426, 0x0001 }, - { 1427, 0x4801 }, { 1430, 0x0000 }, { 1430, 0x1534 }, { 1436, 0xe00a }, - { 1441, 0x5840 }, { 1445, 0x5036 }, { 1451, 0x0820 }, { 1453, 0x0000 }, - /* 0x5f00 */ - { 1453, 0x41c4 }, { 1458, 0x3200 }, { 1461, 0x591e }, { 1469, 0xa851 }, - { 1475, 0x20b1 }, { 1480, 0x0911 }, { 1484, 0x8099 }, { 1489, 0x6534 }, - { 1496, 0xa200 }, { 1499, 0x3040 }, { 1502, 0x9894 }, { 1508, 0x0103 }, - { 1511, 0x0b90 }, { 1516, 0x401f }, { 1522, 0xf706 }, { 1531, 0x144c }, - /* 0x6000 */ - { 1536, 0x2480 }, { 1539, 0x8598 }, { 1545, 0x2010 }, { 1547, 0x0028 }, - { 1549, 0x1381 }, { 1554, 0x20d2 }, { 1559, 0x0082 }, { 1561, 0xc002 }, - { 1564, 0x4544 }, { 1569, 0x612a }, { 1575, 0x0134 }, { 1579, 0x4883 }, - { 1584, 0xcf14 }, { 1592, 0x6a30 }, { 1598, 0x0024 }, { 1600, 0x3124 }, - /* 0x6100 */ - { 1605, 0x1484 }, { 1609, 0x52df }, { 1619, 0x0c04 }, { 1622, 0x02e3 }, - { 1628, 0x0262 }, { 1632, 0x4000 }, { 1633, 0x1001 }, { 1635, 0x9904 }, - { 1640, 0x281b }, { 1646, 0xb18c }, { 1653, 0x2521 }, { 1658, 0x1300 }, - { 1661, 0xc007 }, { 1666, 0xf020 }, { 1671, 0xb2a6 }, { 1679, 0x0000 }, - /* 0x6200 */ - { 1679, 0x009a }, { 1683, 0x1028 }, { 1686, 0x0a8d }, { 1692, 0x2200 }, - { 1694, 0x105c }, { 1699, 0x1457 }, { 1706, 0xa010 }, { 1709, 0x2408 }, - { 1712, 0xe000 }, { 1715, 0x0001 }, { 1716, 0x0140 }, { 1718, 0xc4c8 }, - { 1724, 0x4010 }, { 1726, 0x0460 }, { 1729, 0x0400 }, { 1730, 0x3014 }, - /* 0x6300 */ - { 1734, 0x2c18 }, { 1739, 0x0149 }, { 1743, 0x2600 }, { 1746, 0x1260 }, - { 1750, 0x4c5e }, { 1758, 0x091c }, { 1763, 0x3060 }, { 1767, 0xb132 }, - { 1774, 0x0494 }, { 1778, 0x4631 }, { 1784, 0xe050 }, { 1789, 0x2000 }, - { 1790, 0x4122 }, { 1794, 0x103a }, { 1799, 0x1421 }, { 1803, 0x032c }, - /* 0x6400 */ - { 1808, 0x0600 }, { 1810, 0x4115 }, { 1815, 0x8635 }, { 1822, 0xa021 }, - { 1826, 0x8800 }, { 1828, 0xbc1e }, { 1837, 0x200b }, { 1841, 0x2818 }, - { 1845, 0x80a0 }, { 1848, 0xab03 }, { 1855, 0x114a }, { 1860, 0xe008 }, - { 1864, 0x5e10 }, { 1870, 0x00a3 }, { 1874, 0x2630 }, { 1879, 0x88a1 }, - /* 0x6500 */ - { 1884, 0x8712 }, { 1890, 0xca58 }, { 1897, 0x4244 }, { 1901, 0x3402 }, - { 1905, 0x0288 }, { 1908, 0x8015 }, { 1912, 0x0881 }, { 1915, 0x2400 }, - { 1917, 0x0422 }, { 1920, 0x2124 }, { 1924, 0x4049 }, { 1928, 0x801c }, - { 1932, 0x4304 }, { 1936, 0x8151 }, { 1941, 0x0000 }, { 1941, 0xc235 }, - /* 0x6600 */ - { 1948, 0x2311 }, { 1953, 0x6066 }, { 1959, 0x5e5e }, { 1969, 0x028b }, - { 1974, 0x5461 }, { 1980, 0x1b82 }, { 1986, 0x1c03 }, { 1991, 0xdba8 }, - { 2000, 0x3801 }, { 2004, 0x9e05 }, { 2011, 0x2011 }, { 2014, 0x8826 }, - { 2019, 0xd10d }, { 2026, 0x8810 }, { 2029, 0x5900 }, { 2033, 0x0c00 }, - /* 0x6700 */ - { 2035, 0x40a0 }, { 2038, 0x1208 }, { 2041, 0x0005 }, { 2043, 0x4008 }, - { 2045, 0x11a0 }, { 2049, 0x2030 }, { 2052, 0x5040 }, { 2055, 0x0850 }, - { 2058, 0xc012 }, { 2062, 0x0b4a }, { 2068, 0x0000 }, { 2068, 0x3827 }, - { 2075, 0x032d }, { 2081, 0x1284 }, { 2085, 0x0042 }, { 2087, 0x02c5 }, - /* 0x6800 */ - { 2092, 0x0000 }, { 2092, 0xa210 }, { 2096, 0xb180 }, { 2101, 0x880b }, - { 2106, 0x1430 }, { 2110, 0x09a4 }, { 2115, 0xc800 }, { 2118, 0x1e27 }, - { 2126, 0x0154 }, { 2130, 0x1540 }, { 2134, 0x462a }, { 2140, 0x0804 }, - { 2142, 0x9120 }, { 2146, 0x324b }, { 2153, 0x3d20 }, { 2159, 0x3863 }, - /* 0x6900 */ - { 2166, 0x0640 }, { 2169, 0x00cb }, { 2174, 0x0000 }, { 2174, 0x092a }, - { 2179, 0x4224 }, { 2183, 0x0880 }, { 2185, 0x1378 }, { 2192, 0x8c07 }, - { 2198, 0x2001 }, { 2200, 0x0144 }, { 2203, 0xa962 }, { 2210, 0x1580 }, - { 2214, 0x0120 }, { 2216, 0x00c2 }, { 2219, 0xc024 }, { 2223, 0x402a }, - /* 0x6a00 */ - { 2227, 0x800b }, { 2231, 0x2422 }, { 2235, 0x0111 }, { 2238, 0xc895 }, - { 2245, 0x4660 }, { 2250, 0x0867 }, { 2256, 0x0490 }, { 2259, 0x400a }, - { 2262, 0x0aca }, { 2268, 0xe802 }, { 2273, 0x8820 }, { 2276, 0xe013 }, - { 2282, 0x1340 }, { 2286, 0x3071 }, { 2292, 0x1090 }, { 2295, 0x3007 }, - /* 0x6b00 */ - { 2300, 0x82cc }, { 2306, 0x4883 }, { 2311, 0x9910 }, { 2316, 0x8860 }, - { 2320, 0x2440 }, { 2323, 0x2144 }, { 2327, 0x4881 }, { 2331, 0x6021 }, - { 2335, 0x0024 }, { 2337, 0x8880 }, { 2340, 0x730d }, { 2348, 0x6301 }, - { 2353, 0x1218 }, { 2357, 0x0440 }, { 2359, 0x40ca }, { 2364, 0x8282 }, - /* 0x6c00 */ - { 2368, 0x6234 }, { 2374, 0x8205 }, { 2378, 0x51c0 }, { 2383, 0x8c68 }, - { 2389, 0xac00 }, { 2393, 0x1a14 }, { 2398, 0xa880 }, { 2402, 0x0b50 }, - { 2407, 0x02e0 }, { 2411, 0x91b0 }, { 2417, 0x0000 }, { 2417, 0x0015 }, - { 2420, 0xa044 }, { 2424, 0x1457 }, { 2431, 0x5a81 }, { 2437, 0x0014 }, - /* 0x6d00 */ - { 2439, 0xc490 }, { 2444, 0x040a }, { 2447, 0xc1c0 }, { 2452, 0x9202 }, - { 2456, 0x0000 }, { 2456, 0xc080 }, { 2459, 0x80a2 }, { 2463, 0x1001 }, - { 2465, 0x0084 }, { 2467, 0x01d6 }, { 2473, 0x1400 }, { 2475, 0xa290 }, - { 2480, 0xc510 }, { 2485, 0xa840 }, { 2489, 0x8225 }, { 2494, 0x1051 }, - /* 0x6e00 */ - { 2498, 0x0011 }, { 2500, 0x4000 }, { 2501, 0x0084 }, { 2503, 0x1a44 }, - { 2508, 0x8b30 }, { 2514, 0x709e }, { 2522, 0x010c }, { 2525, 0x2808 }, - { 2528, 0x2000 }, { 2529, 0x0208 }, { 2531, 0x6081 }, { 2535, 0x880a }, - { 2539, 0xe58b }, { 2548, 0x0000 }, { 2548, 0x6800 }, { 2551, 0x2a00 }, - /* 0x6f00 */ - { 2554, 0x3510 }, { 2559, 0x0d40 }, { 2563, 0xa640 }, { 2568, 0x1849 }, - { 2573, 0x8000 }, { 2574, 0x668e }, { 2582, 0x1106 }, { 2586, 0x6000 }, - { 2588, 0x3988 }, { 2594, 0x845d }, { 2601, 0xc1e1 }, { 2608, 0x1061 }, - { 2612, 0x05a0 }, { 2616, 0x4400 }, { 2618, 0x0300 }, { 2620, 0x3221 }, - /* 0x7000 */ - { 2625, 0x20e1 }, { 2630, 0x0080 }, { 2631, 0x8009 }, { 2634, 0x1290 }, - { 2638, 0x4f18 }, { 2645, 0x6030 }, { 2649, 0x5030 }, { 2653, 0x4060 }, - { 2656, 0x0062 }, { 2659, 0x09f0 }, { 2665, 0x0810 }, { 2667, 0x0093 }, - { 2671, 0x0400 }, { 2672, 0x117a }, { 2679, 0x0010 }, { 2680, 0x0400 }, - /* 0x7100 */ - { 2681, 0x98f8 }, { 2689, 0x4000 }, { 2690, 0xa801 }, { 2694, 0x0103 }, - { 2697, 0x0ce2 }, { 2703, 0x5485 }, { 2709, 0x0101 }, { 2711, 0x0200 }, - { 2712, 0x10a1 }, { 2716, 0x0c04 }, { 2719, 0x8005 }, { 2722, 0x840d }, - { 2727, 0x1813 }, { 2732, 0x1648 }, { 2737, 0x0000 }, { 2737, 0x4100 }, - /* 0x7200 */ - { 2739, 0x0381 }, { 2743, 0xa488 }, { 2748, 0x8810 }, { 2751, 0x0310 }, - { 2754, 0xc02e }, { 2760, 0x5469 }, { 2767, 0xc909 }, { 2773, 0x9982 }, - { 2779, 0x6210 }, { 2783, 0x0808 }, { 2785, 0x6100 }, { 2788, 0x4012 }, - { 2791, 0x1282 }, { 2795, 0x8160 }, { 2799, 0x0020 }, { 2800, 0x4c18 }, - /* 0x7300 */ - { 2805, 0x28b4 }, { 2811, 0x430c }, { 2816, 0x1194 }, { 2821, 0x2c26 }, - { 2827, 0x2008 }, { 2829, 0xe145 }, { 2836, 0xdac1 }, { 2844, 0x1282 }, - { 2848, 0x406b }, { 2854, 0xd1a9 }, { 2862, 0x2c65 }, { 2869, 0xb2a0 }, - { 2875, 0x9a60 }, { 2881, 0x224c }, { 2886, 0x02ca }, { 2891, 0xaeb0 }, - /* 0x7400 */ - { 2899, 0x0493 }, { 2904, 0x0c02 }, { 2907, 0xff50 }, { 2917, 0x0203 }, - { 2920, 0x28d9 }, { 2927, 0x2086 }, { 2931, 0x69c4 }, { 2938, 0x0006 }, - { 2940, 0x82e3 }, { 2947, 0x9707 }, { 2955, 0xcf4b }, { 2965, 0x8a26 }, - { 2971, 0x1300 }, { 2974, 0xcd09 }, { 2981, 0x8d10 }, { 2986, 0x9c10 }, - /* 0x7500 */ - { 2991, 0x0040 }, { 2992, 0x00c4 }, { 2995, 0x8693 }, { 3002, 0xe240 }, - { 3007, 0x4189 }, { 3012, 0xc085 }, { 3017, 0x8002 }, { 3019, 0x7e02 }, - { 3026, 0x0022 }, { 3028, 0x122d }, { 3034, 0x0014 }, { 3036, 0x8410 }, - { 3039, 0xd053 }, { 3046, 0x9080 }, { 3049, 0xd093 }, { 3056, 0x0202 }, - /* 0x7600 */ - { 3058, 0x959d }, { 3067, 0x7a6c }, { 3076, 0x2268 }, { 3081, 0x172c }, - { 3088, 0x0e3b }, { 3096, 0x8220 }, { 3099, 0xe030 }, { 3104, 0x0012 }, - { 3106, 0x3022 }, { 3110, 0xb820 }, { 3115, 0x25fd }, { 3125, 0x2000 }, - { 3126, 0x5a22 }, { 3132, 0x0210 }, { 3134, 0x1141 }, { 3138, 0x1243 }, - /* 0x7700 */ - { 3143, 0x4441 }, { 3147, 0x16b4 }, { 3154, 0xe104 }, { 3159, 0x6270 }, - { 3165, 0xe464 }, { 3172, 0xd0c4 }, { 3178, 0x1495 }, { 3184, 0x241d }, - { 3190, 0x3011 }, { 3194, 0x8470 }, { 3199, 0xc484 }, { 3204, 0x4022 }, - { 3207, 0x0208 }, { 3209, 0xc226 }, { 3215, 0x1451 }, { 3220, 0x0913 }, - /* 0x7800 */ - { 3225, 0x6260 }, { 3230, 0x2002 }, { 3232, 0x600e }, { 3237, 0x00a1 }, - { 3240, 0x5198 }, { 3246, 0x5004 }, { 3249, 0x451b }, { 3256, 0x4400 }, - { 3258, 0x8400 }, { 3260, 0xe110 }, { 3265, 0x3112 }, { 3270, 0xa80f }, - { 3277, 0x5380 }, { 3282, 0x886c }, { 3288, 0x0453 }, { 3293, 0x8ccc }, - /* 0x7900 */ - { 3300, 0x1041 }, { 3303, 0xd401 }, { 3308, 0x22a1 }, { 3313, 0xa832 }, - { 3319, 0x8c70 }, { 3325, 0x1912 }, { 3330, 0x0a80 }, { 3333, 0x5a04 }, - { 3338, 0x1800 }, { 3340, 0x197a }, { 3348, 0x8b02 }, { 3353, 0x0912 }, - { 3357, 0x8594 }, { 3363, 0x6450 }, { 3368, 0x2c25 }, { 3374, 0x1102 }, - /* 0x7a00 */ - { 3377, 0x168c }, { 3383, 0x4822 }, { 3387, 0xa882 }, { 3392, 0x0731 }, - { 3398, 0x11b0 }, { 3403, 0xb260 }, { 3409, 0x24a1 }, { 3414, 0x4120 }, - { 3417, 0x0c65 }, { 3423, 0x4013 }, { 3427, 0x1009 }, { 3430, 0x1a28 }, - { 3435, 0x5240 }, { 3439, 0x0802 }, { 3441, 0x1b00 }, { 3445, 0x6812 }, - /* 0x7b00 */ - { 3450, 0x0080 }, { 3451, 0x8010 }, { 3453, 0xee88 }, { 3461, 0xa013 }, - { 3466, 0x4083 }, { 3470, 0x0020 }, { 3471, 0xa651 }, { 3478, 0x008c }, - { 3481, 0x4210 }, { 3484, 0x4843 }, { 3489, 0x9021 }, { 3493, 0x3c65 }, - { 3501, 0x0524 }, { 3505, 0x0ed0 }, { 3511, 0x0500 }, { 3513, 0x5734 }, - /* 0x7c00 */ - { 3521, 0xda5e }, { 3531, 0x0a00 }, { 3533, 0x1161 }, { 3538, 0x065a }, - { 3544, 0x0440 }, { 3546, 0x7e2e }, { 3556, 0x628a }, { 3562, 0x3205 }, - { 3567, 0x80c0 }, { 3570, 0x4010 }, { 3572, 0x0041 }, { 3574, 0x9cc1 }, - { 3581, 0xa390 }, { 3587, 0x26b8 }, { 3594, 0x0a40 }, { 3597, 0x0020 }, - /* 0x7d00 */ - { 3598, 0x8388 }, { 3603, 0x604e }, { 3609, 0x2448 }, { 3613, 0x7002 }, - { 3617, 0x2183 }, { 3622, 0x368a }, { 3629, 0x04a0 }, { 3632, 0x8d01 }, - { 3637, 0x396e }, { 3646, 0x60c2 }, { 3651, 0x04c0 }, { 3654, 0x02c8 }, - { 3658, 0x707c }, { 3666, 0x0280 }, { 3668, 0x2c64 }, { 3674, 0x0662 }, - /* 0x7e00 */ - { 3679, 0x0101 }, { 3681, 0x30a3 }, { 3687, 0xb181 }, { 3693, 0x8048 }, - { 3696, 0x40b0 }, { 3700, 0x8105 }, { 3704, 0xc826 }, { 3710, 0x4108 }, - { 3713, 0x24c2 }, { 3718, 0x6522 }, { 3724, 0x0000 }, { 3724, 0x0000 }, - { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, - /* 0x7f00 */ - { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0xf800 }, - { 3729, 0x8098 }, { 3733, 0x380c }, { 3738, 0x207a }, { 3744, 0xe002 }, - { 3748, 0xa801 }, { 3752, 0x10c3 }, { 3757, 0x2446 }, { 3762, 0x9010 }, - { 3765, 0xc109 }, { 3770, 0x8800 }, { 3772, 0xd128 }, { 3778, 0xe404 }, - /* 0x8000 */ - { 3783, 0xe580 }, { 3789, 0xe05a }, { 3796, 0x5051 }, { 3801, 0x56b1 }, - { 3809, 0x0011 }, { 3811, 0x0000 }, { 3811, 0x2051 }, { 3815, 0x0022 }, - { 3817, 0x4102 }, { 3820, 0x5000 }, { 3822, 0x08c0 }, { 3825, 0x0300 }, - { 3827, 0xa100 }, { 3830, 0x01b4 }, { 3835, 0x6001 }, { 3838, 0x464d }, - /* 0x8100 */ - { 3845, 0x0808 }, { 3847, 0x51c0 }, { 3852, 0x1091 }, { 3856, 0x1421 }, - { 3860, 0x14a0 }, { 3864, 0x0084 }, { 3866, 0xa383 }, { 3873, 0x0080 }, - { 3874, 0x4872 }, { 3880, 0x4941 }, { 3885, 0x4004 }, { 3887, 0x0814 }, - { 3890, 0xcc28 }, { 3896, 0x68a0 }, { 3901, 0x1812 }, { 3905, 0xa367 }, - /* 0x8200 */ - { 3914, 0x8009 }, { 3917, 0x2618 }, { 3922, 0x0106 }, { 3925, 0x0414 }, - { 3928, 0xc878 }, { 3935, 0x1042 }, { 3938, 0x2089 }, { 3942, 0xa810 }, - { 3946, 0x469b }, { 3954, 0x0d52 }, { 3960, 0x479b }, { 3969, 0xd495 }, - { 3977, 0x0040 }, { 3978, 0x0421 }, { 3981, 0xa515 }, { 3988, 0x60c0 }, - /* 0x8300 */ - { 3992, 0x0d83 }, { 3998, 0xe800 }, { 4002, 0x7006 }, { 4007, 0x3489 }, - { 4013, 0x609c }, { 4019, 0x00fa }, { 4025, 0x0000 }, { 4025, 0xa101 }, - { 4029, 0x2055 }, { 4034, 0x3b34 }, { 4042, 0x32c0 }, { 4047, 0xc000 }, - { 4049, 0x8281 }, { 4053, 0x2013 }, { 4057, 0x0500 }, { 4059, 0x1340 }, - /* 0x8400 */ - { 4063, 0x8442 }, { 4067, 0x0222 }, { 4070, 0x8000 }, { 4071, 0x0200 }, - { 4072, 0xa5a0 }, { 4078, 0x1746 }, { 4085, 0x04b1 }, { 4090, 0x3159 }, - { 4097, 0x0022 }, { 4099, 0x402c }, { 4103, 0x8740 }, { 4108, 0x6412 }, - { 4113, 0x9185 }, { 4119, 0x1008 }, { 4121, 0x8480 }, { 4124, 0x2c87 }, - /* 0x8500 */ - { 4131, 0x508c }, { 4136, 0x5001 }, { 4139, 0x8cbc }, { 4147, 0x805c }, - { 4152, 0x8040 }, { 4154, 0xf24f }, { 4164, 0x8817 }, { 4170, 0xae00 }, - { 4175, 0x9a62 }, { 4182, 0xa108 }, { 4186, 0x20a5 }, { 4191, 0xf1d0 }, - { 4199, 0x4c84 }, { 4204, 0x8500 }, { 4207, 0x2141 }, { 4211, 0x9048 }, - /* 0x8600 */ - { 4215, 0x6031 }, { 4220, 0x4b07 }, { 4227, 0x0282 }, { 4230, 0x3540 }, - { 4235, 0x0047 }, { 4239, 0x23cc }, { 4246, 0x921f }, { 4254, 0x04e0 }, - { 4258, 0x2100 }, { 4260, 0x1542 }, { 4265, 0x21c2 }, { 4270, 0x83ba }, - { 4278, 0x002b }, { 4282, 0x14a6 }, { 4288, 0x00a9 }, { 4292, 0x3400 }, - /* 0x8700 */ - { 4295, 0xc8b0 }, { 4301, 0xc219 }, { 4307, 0xc10a }, { 4312, 0x7606 }, - { 4319, 0x2029 }, { 4323, 0x2100 }, { 4325, 0x8032 }, { 4329, 0x0806 }, - { 4332, 0x1bf8 }, { 4341, 0x43a9 }, { 4348, 0x7089 }, { 4354, 0xc022 }, - { 4358, 0x4702 }, { 4363, 0x9660 }, { 4369, 0x2c1c }, { 4375, 0x850a }, - /* 0x8800 */ - { 4380, 0x0e4a }, { 4386, 0xdf1d }, { 4397, 0x6100 }, { 4400, 0x1425 }, - { 4405, 0x4f2a }, { 4413, 0x9562 }, { 4420, 0x0211 }, { 4423, 0x0a02 }, - { 4426, 0x0001 }, { 4427, 0x9d00 }, { 4432, 0x0501 }, { 4435, 0x6400 }, - { 4438, 0x7c01 }, { 4444, 0x480e }, { 4449, 0x8080 }, { 4451, 0x00a3 }, - /* 0x8900 */ - { 4455, 0xe042 }, { 4460, 0x1760 }, { 4466, 0x01c1 }, { 4470, 0x4627 }, - { 4477, 0x8265 }, { 4483, 0x1c84 }, { 4488, 0x480e }, { 4493, 0x3c29 }, - { 4500, 0x2200 }, { 4502, 0x9831 }, { 4508, 0x0021 }, { 4510, 0x10f1 }, - { 4516, 0x0000 }, { 4516, 0x01f0 }, { 4521, 0x2a20 }, { 4525, 0xa24a }, - /* 0x8a00 */ - { 4531, 0x80b0 }, { 4535, 0x4036 }, { 4540, 0x9855 }, { 4547, 0x60a0 }, - { 4551, 0x62a9 }, { 4558, 0x31c8 }, { 4564, 0x00a2 }, { 4567, 0xcee0 }, - { 4575, 0x8849 }, { 4580, 0x82c5 }, { 4586, 0xc280 }, { 4590, 0x48c8 }, - { 4595, 0x0748 }, { 4600, 0xa0ba }, { 4607, 0x1000 }, { 4608, 0x9071 }, - /* 0x8b00 */ - { 4614, 0x0c60 }, { 4618, 0xd002 }, { 4622, 0x2000 }, { 4623, 0x1081 }, - { 4626, 0x217c }, { 4633, 0x421c }, { 4638, 0x2008 }, { 4640, 0x5340 }, - { 4645, 0xa832 }, { 4651, 0xd030 }, { 4656, 0x0000 }, { 4656, 0x0000 }, - { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, - /* 0x8c00 */ - { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x6300 }, - { 4660, 0x8aa0 }, { 4665, 0x2b9a }, { 4673, 0x2358 }, { 4679, 0x4868 }, - { 4684, 0x08c0 }, { 4687, 0x1a0d }, { 4693, 0x0010 }, { 4694, 0x0600 }, - { 4696, 0x8a60 }, { 4701, 0x2260 }, { 4705, 0x9102 }, { 4709, 0xc1a5 }, - /* 0x8d00 */ - { 4716, 0x020a }, { 4719, 0x0884 }, { 4722, 0x0000 }, { 4722, 0x0000 }, - { 4722, 0x0000 }, { 4722, 0x0000 }, { 4722, 0x5220 }, { 4726, 0x8000 }, - { 4727, 0x2114 }, { 4731, 0xc023 }, { 4736, 0x9841 }, { 4741, 0x1aa4 }, - { 4747, 0x45e1 }, { 4754, 0x02b2 }, { 4759, 0x10b0 }, { 4763, 0x2017 }, - /* 0x8e00 */ - { 4768, 0x0872 }, { 4773, 0x0052 }, { 4776, 0x00cf }, { 4782, 0x23ca }, - { 4789, 0xe803 }, { 4795, 0x7810 }, { 4800, 0xb206 }, { 4806, 0x0e03 }, - { 4811, 0x020c }, { 4814, 0x6c25 }, { 4821, 0x6284 }, { 4826, 0x0c28 }, - { 4830, 0x809b }, { 4836, 0x1012 }, { 4839, 0x6100 }, { 4842, 0x0683 }, - /* 0x8f00 */ - { 4847, 0x8185 }, { 4852, 0x41c1 }, { 4857, 0x71ab }, { 4866, 0x04f0 }, - { 4871, 0x808b }, { 4876, 0x613e }, { 4884, 0x0020 }, { 4885, 0x0000 }, - { 4885, 0x0000 }, { 4885, 0x2000 }, { 4886, 0x0073 }, { 4891, 0x4160 }, - { 4895, 0x2c43 }, { 4901, 0x002d }, { 4905, 0x4119 }, { 4910, 0x4862 }, - /* 0x9000 */ - { 4915, 0x1114 }, { 4919, 0x0900 }, { 4921, 0xb700 }, { 4927, 0x8098 }, - { 4931, 0x1018 }, { 4934, 0x2800 }, { 4936, 0x10c4 }, { 4940, 0x0211 }, - { 4943, 0x5920 }, { 4948, 0x0ba1 }, { 4954, 0x0027 }, { 4958, 0x605d }, - { 4965, 0x11b8 }, { 4971, 0xb3a4 }, { 4979, 0x8820 }, { 4982, 0xc051 }, - /* 0x9100 */ - { 4987, 0x2171 }, { 4993, 0x55d1 }, { 5001, 0xc2ad }, { 5009, 0x36d2 }, - { 5017, 0x8188 }, { 5021, 0x0e88 }, { 5026, 0x2092 }, { 5030, 0x0e10 }, - { 5034, 0x446a }, { 5040, 0x413a }, { 5046, 0x7142 }, { 5052, 0xb84f }, - { 5061, 0x002c }, { 5064, 0x4698 }, { 5070, 0xf630 }, { 5078, 0x2a83 }, - /* 0x9200 */ - { 5084, 0x16f3 }, { 5093, 0x314d }, { 5100, 0xc178 }, { 5107, 0x5769 }, - { 5116, 0xe4cd }, { 5125, 0x3302 }, { 5130, 0xc3a3 }, { 5138, 0xbbe1 }, - { 5148, 0x6700 }, { 5153, 0x8284 }, { 5157, 0x89b1 }, { 5164, 0xbd44 }, - { 5172, 0x79ef }, { 5184, 0xb3a9 }, { 5193, 0x51ab }, { 5201, 0x8a01 }, - /* 0x9300 */ - { 5205, 0x2105 }, { 5209, 0xf032 }, { 5216, 0x06b2 }, { 5222, 0x00d8 }, - { 5226, 0x0380 }, { 5229, 0x45a7 }, { 5237, 0xa6b0 }, { 5244, 0xa45b }, - { 5252, 0xad07 }, { 5260, 0x4924 }, { 5265, 0x0b5a }, { 5272, 0x0470 }, - { 5276, 0x3ef2 }, { 5286, 0xd208 }, { 5291, 0x00c4 }, { 5294, 0x2f80 }, - /* 0x9400 */ - { 5300, 0xe316 }, { 5308, 0x80e0 }, { 5312, 0xc000 }, { 5314, 0xa81e }, - { 5321, 0x1528 }, { 5326, 0x9220 }, { 5330, 0xe90a }, { 5337, 0x0006 }, - { 5339, 0x0018 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, - { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, - /* 0x9500 */ - { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, - { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x4300 }, - { 5344, 0x7110 }, { 5349, 0xe000 }, { 5352, 0x1a42 }, { 5357, 0xa450 }, - { 5362, 0x0b40 }, { 5366, 0xe60f }, { 5375, 0x0051 }, { 5378, 0x0000 }, - /* 0x9600 */ - { 5378, 0x0000 }, { 5378, 0x6000 }, { 5380, 0x1074 }, { 5385, 0x378a }, - { 5393, 0x0002 }, { 5394, 0x01d4 }, { 5399, 0x4002 }, { 5401, 0xd810 }, - { 5406, 0x021e }, { 5411, 0xa442 }, { 5416, 0xc270 }, { 5422, 0x0408 }, - { 5424, 0x0400 }, { 5425, 0xe504 }, { 5431, 0x8200 }, { 5433, 0x0402 }, - /* 0x9700 */ - { 5435, 0x022c }, { 5439, 0x2c00 }, { 5442, 0x010e }, { 5446, 0x000a }, - { 5448, 0xc40a }, { 5453, 0x0da0 }, { 5458, 0x4488 }, { 5462, 0xa9c8 }, - { 5469, 0x0201 }, { 5471, 0xc6e0 }, { 5478, 0x5004 }, { 5481, 0xd766 }, - { 5491, 0x76b2 }, { 5500, 0x6b93 }, { 5509, 0x8013 }, { 5513, 0x0592 }, - /* 0x9800 */ - { 5518, 0x6480 }, { 5522, 0x5250 }, { 5527, 0xc869 }, { 5534, 0x402d }, - { 5539, 0x0490 }, { 5542, 0x06ce }, { 5549, 0x146c }, { 5555, 0x0000 }, - { 5555, 0x0000 }, { 5555, 0x0000 }, { 5555, 0x6800 }, { 5558, 0x8d91 }, - { 5565, 0x1124 }, { 5569, 0x0000 }, { 5569, 0x04ea }, { 5575, 0x0048 }, - /* 0x9900 */ - { 5577, 0x0184 }, { 5580, 0x9ce2 }, { 5588, 0x08c4 }, { 5592, 0x1e3e }, - { 5601, 0x61c3 }, { 5608, 0xdb10 }, { 5615, 0x0001 }, { 5616, 0x0000 }, - { 5616, 0x0000 }, { 5616, 0xa800 }, { 5619, 0x0040 }, { 5620, 0xa627 }, - { 5628, 0x0208 }, { 5630, 0x5618 }, { 5636, 0x1c80 }, { 5640, 0x6231 }, - /* 0x9a00 */ - { 5646, 0x181c }, { 5651, 0x4043 }, { 5655, 0x609d }, { 5662, 0x0168 }, - { 5666, 0x5c92 }, { 5673, 0x2052 }, { 5677, 0x0000 }, { 5677, 0x0000 }, - { 5677, 0x0000 }, { 5677, 0x0000 }, { 5677, 0xd400 }, { 5681, 0xca74 }, - { 5689, 0x414a }, { 5694, 0x18e5 }, { 5701, 0x12b1 }, { 5707, 0xa62c }, - /* 0x9b00 */ - { 5714, 0x7b3f }, { 5726, 0x1a45 }, { 5732, 0x2841 }, { 5736, 0x26b8 }, - { 5743, 0x1900 }, { 5746, 0x48e0 }, { 5751, 0x7d6a }, { 5761, 0x83a8 }, - { 5767, 0xaef1 }, { 5777, 0x6411 }, { 5782, 0x12c0 }, { 5786, 0xd987 }, - { 5795, 0x4182 }, { 5799, 0xa181 }, { 5804, 0x8ca0 }, { 5809, 0xa788 }, - /* 0x9c00 */ - { 5816, 0x8805 }, { 5820, 0x5742 }, { 5827, 0x07cc }, { 5834, 0x20e2 }, - { 5839, 0xc63a }, { 5847, 0xf959 }, { 5857, 0x4f08 }, { 5863, 0x08a5 }, - { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, - { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0040 }, { 5869, 0x0284 }, - /* 0x9d00 */ - { 5872, 0x0804 }, { 5874, 0x7182 }, { 5880, 0x8000 }, { 5881, 0x341d }, - { 5888, 0x04ac }, { 5893, 0x8018 }, { 5896, 0x0e2c }, { 5902, 0x58c1 }, - { 5908, 0x6458 }, { 5914, 0x01ec }, { 5920, 0x5402 }, { 5924, 0x9222 }, - { 5929, 0x0688 }, { 5933, 0xc4f0 }, { 5940, 0x4aa1 }, { 5946, 0x4019 }, - /* 0x9e00 */ - { 5950, 0x4484 }, { 5954, 0x3267 }, { 5962, 0x0000 }, { 5962, 0x0000 }, - { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x1c00 }, - { 5965, 0xc0bd }, { 5973, 0x4940 }, { 5977, 0xd110 }, { 5982, 0x0039 }, - { 5986, 0x0940 }, { 5989, 0x8020 }, { 5991, 0x7090 }, { 5996, 0x8127 }, - /* 0x9f00 */ - { 6002, 0x820c }, { 6006, 0x8ed7 }, { 6016, 0x8c44 }, { 6021, 0xb696 }, - { 6030, 0x00fa }, { 6036, 0x65e8 }, { 6044, 0xe300 }, { 6049, 0x242b }, - { 6055, 0x8000 }, { 6056, 0x40d7 }, { 6063, 0x002e }, -}; - -static int -jisx0212_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - const Summary16 *summary = NULL; - if (wc < 0x0460) - summary = &jisx0212_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x2100 && wc < 0x2130) - summary = &jisx0212_uni2indx_page21[(wc>>4)-0x210]; - else if (wc >= 0x4e00 && wc < 0x9fb0) - summary = &jisx0212_uni2indx_page4e[(wc>>4)-0x4e0]; - if (summary) { - unsigned short used = summary->used; - unsigned int i = wc & 0x0f; - if (used & ((unsigned short) 1 << i)) { - unsigned short c; - /* Keep in `used' only the bits 0..i-1. */ - used &= ((unsigned short) 1 << i) - 1; - /* Add `summary->indx' and the number of bits set in `used'. */ - used = (used & 0x5555) + ((used & 0xaaaa) >> 1); - used = (used & 0x3333) + ((used & 0xcccc) >> 2); - used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); - used = (used & 0x00ff) + (used >> 8); - c = jisx0212_2charset[summary->indx + used]; - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/koi8_c.h b/nx-X11/lib/X11/lcUniConv/koi8_c.h deleted file mode 100644 index d870a01db..000000000 --- a/nx-X11/lib/X11/lcUniConv/koi8_c.h +++ /dev/null @@ -1,102 +0,0 @@ - -/* - * KOI8-C - */ - -static const unsigned short koi8_c_2uni[128] = { - /* 0x80 */ - 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, - 0x04b7, 0x04b9, 0x04bb, 0x2580, 0x04d9, 0x04e3, 0x04e9, 0x04ef, - /* 0x90 */ - 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, - 0x04b6, 0x04b8, 0x04ba, 0x2321, 0x04d8, 0x04e2, 0x04e8, 0x04ee, - /* 0xa0 */ - 0x00a0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, - 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, - /* 0xb0 */ - 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, - 0x0486, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, - /* 0xc0 */ - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - /* 0xd0 */ - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - /* 0xe0 */ - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - /* 0xf0 */ - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, -}; - -static int -koi8_c_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) koi8_c_2uni[c-0x80]; - return 1; -} - -static const unsigned char koi8_c_page00[1] = { - 0xa0, /* 0xa0-0xa7 */ -}; -static const unsigned char koi8_c_page04[240] = { - 0x00, 0xb3, 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x00-0x07 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0xbf, /* 0x08-0x0f */ - 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ - 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ - 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ - 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ - 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ - 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ - 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ - 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ - 0x00, 0xa3, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x50-0x57 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0xbd, 0xad, 0x90, 0x80, 0x00, 0x00, 0x91, 0x81, /* 0x90-0x97 */ - 0x00, 0x00, 0x92, 0x82, 0x93, 0x83, 0x00, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x94, 0x84, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x85, /* 0xa8-0xaf */ - 0x96, 0x86, 0x97, 0x87, 0x00, 0x00, 0x98, 0x88, /* 0xb0-0xb7 */ - 0x99, 0x89, 0x9a, 0x8a, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x9c, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x9d, 0x8d, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x9e, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x8f, /* 0xe8-0xef */ -}; -static const unsigned char koi8_c_page22[1] = { - 0xb0, /* 0x16-0x16 */ -}; - -static int -koi8_c_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00a1) - c = koi8_c_page00[wc-0x00a0]; - else if (wc >= 0x0400 && wc < 0x04ef) - c = koi8_c_page04[wc-0x0400]; - else if (wc >= 0x2216 && wc < 0x2217) - c = koi8_c_page22[wc-0x2216]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/koi8_r.h b/nx-X11/lib/X11/lcUniConv/koi8_r.h deleted file mode 100644 index 37ca594f6..000000000 --- a/nx-X11/lib/X11/lcUniConv/koi8_r.h +++ /dev/null @@ -1,134 +0,0 @@ - -/* - * KOI8-R - */ - -/* Specification: RFC 1489 */ - -static const unsigned short koi8_r_2uni[128] = { - /* 0x80 */ - 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, - 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, - /* 0x90 */ - 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, - 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, - /* 0xa0 */ - 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, - 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, - /* 0xb0 */ - 0x255f, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x00a9, - /* 0xc0 */ - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - /* 0xd0 */ - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - /* 0xe0 */ - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - /* 0xf0 */ - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, -}; - -static int -koi8_r_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) koi8_r_2uni[c-0x80]; - return 1; -} - -static const unsigned char koi8_r_page00[88] = { - 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ - 0x9c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ -}; -static const unsigned char koi8_r_page04[88] = { - 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ - 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ - 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ - 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ - 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ - 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ - 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ - 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ - 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ -}; -static const unsigned char koi8_r_page22[80] = { - 0x00, 0x95, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ -}; -static const unsigned char koi8_r_page23[8] = { - 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ -}; -static const unsigned char koi8_r_page25[168] = { - 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x85, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0xa0, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, /* 0x50-0x57 */ - 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, /* 0x58-0x5f */ - 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, /* 0x60-0x67 */ - 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x8f, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ -}; - -static int -koi8_r_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00f8) - c = koi8_r_page00[wc-0x00a0]; - else if (wc >= 0x0400 && wc < 0x0458) - c = koi8_r_page04[wc-0x0400]; - else if (wc >= 0x2218 && wc < 0x2268) - c = koi8_r_page22[wc-0x2218]; - else if (wc >= 0x2320 && wc < 0x2328) - c = koi8_r_page23[wc-0x2320]; - else if (wc >= 0x2500 && wc < 0x25a8) - c = koi8_r_page25[wc-0x2500]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/koi8_u.h b/nx-X11/lib/X11/lcUniConv/koi8_u.h deleted file mode 100644 index e094419bc..000000000 --- a/nx-X11/lib/X11/lcUniConv/koi8_u.h +++ /dev/null @@ -1,142 +0,0 @@ - -/* - * KOI8-U - */ - -/* Specification: RFC 2319 */ - -static const unsigned short koi8_u_2uni[128] = { - /* 0x80 */ - 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, - 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, - /* 0x90 */ - 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, - 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, - /* 0xa0 */ - 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, - 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x0491, 0x255d, 0x255e, - /* 0xb0 */ - 0x255f, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, - 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x0490, 0x256c, 0x00a9, - /* 0xc0 */ - 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, - 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - /* 0xd0 */ - 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, - 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, - /* 0xe0 */ - 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, - 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - /* 0xf0 */ - 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, - 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, -}; - -static int -koi8_u_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) koi8_u_2uni[c-0x80]; - return 1; -} - -static const unsigned char koi8_u_page00[88] = { - 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ - 0x9c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ -}; -static const unsigned char koi8_u_page04[152] = { - 0x00, 0xb3, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0xb7, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ - 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ - 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ - 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ - 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ - 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ - 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ - 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ - 0x00, 0xa3, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0xbd, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ -}; -static const unsigned char koi8_u_page22[80] = { - 0x00, 0x95, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ -}; -static const unsigned char koi8_u_page23[8] = { - 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ -}; -static const unsigned char koi8_u_page25[168] = { - 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x85, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0xa0, 0xa1, 0xa2, 0x00, 0xa5, 0x00, 0x00, 0xa8, /* 0x50-0x57 */ - 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, 0xb0, /* 0x58-0x5f */ - 0xb1, 0xb2, 0x00, 0xb5, 0x00, 0x00, 0xb8, 0xb9, /* 0x60-0x67 */ - 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x8f, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ -}; - -static int -koi8_u_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00f8) - c = koi8_u_page00[wc-0x00a0]; - else if (wc >= 0x0400 && wc < 0x0498) - c = koi8_u_page04[wc-0x0400]; - else if (wc >= 0x2218 && wc < 0x2268) - c = koi8_u_page22[wc-0x2218]; - else if (wc >= 0x2320 && wc < 0x2328) - c = koi8_u_page23[wc-0x2320]; - else if (wc >= 0x2500 && wc < 0x25a8) - c = koi8_u_page25[wc-0x2500]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/ksc5601.h b/nx-X11/lib/X11/lcUniConv/ksc5601.h deleted file mode 100644 index 843dcff19..000000000 --- a/nx-X11/lib/X11/lcUniConv/ksc5601.h +++ /dev/null @@ -1,3002 +0,0 @@ - -/* - * KSC5601.1987-0 - */ - -static const unsigned short ksc5601_2uni_page21[1115] = { - /* 0x21 */ - 0x3000, 0x3001, 0x3002, 0x00b7, 0x2025, 0x2026, 0x00a8, 0x3003, - 0x00ad, 0x2015, 0x2225, 0xff3c, 0x223c, 0x2018, 0x2019, 0x201c, - 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, - 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0x00b1, 0x00d7, 0x00f7, - 0x2260, 0x2264, 0x2265, 0x221e, 0x2234, 0x00b0, 0x2032, 0x2033, - 0x2103, 0x212b, 0xffe0, 0xffe1, 0xffe5, 0x2642, 0x2640, 0x2220, - 0x22a5, 0x2312, 0x2202, 0x2207, 0x2261, 0x2252, 0x00a7, 0x203b, - 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, - 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x2192, 0x2190, 0x2191, - 0x2193, 0x2194, 0x3013, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, - 0x2235, 0x222b, 0x222c, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, - 0x2283, 0x222a, 0x2229, 0x2227, 0x2228, 0xffe2, - /* 0x22 */ - 0x21d2, 0x21d4, 0x2200, 0x2203, 0x00b4, 0xff5e, 0x02c7, 0x02d8, - 0x02dd, 0x02da, 0x02d9, 0x00b8, 0x02db, 0x00a1, 0x00bf, 0x02d0, - 0x222e, 0x2211, 0x220f, 0x00a4, 0x2109, 0x2030, 0x25c1, 0x25c0, - 0x25b7, 0x25b6, 0x2664, 0x2660, 0x2661, 0x2665, 0x2667, 0x2663, - 0x2299, 0x25c8, 0x25a3, 0x25d0, 0x25d1, 0x2592, 0x25a4, 0x25a5, - 0x25a8, 0x25a7, 0x25a6, 0x25a9, 0x2668, 0x260f, 0x260e, 0x261c, - 0x261e, 0x00b6, 0x2020, 0x2021, 0x2195, 0x2197, 0x2199, 0x2196, - 0x2198, 0x266d, 0x2669, 0x266a, 0x266c, 0x327f, 0x321c, 0x2116, - 0x33c7, 0x2122, 0x33c2, 0x33d8, 0x2121, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x23 */ - 0xff01, 0xff02, 0xff03, 0xff04, 0xff05, 0xff06, 0xff07, 0xff08, - 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, - 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, - 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, - 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, - 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, - 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, - 0xff39, 0xff3a, 0xff3b, 0xffe6, 0xff3d, 0xff3e, 0xff3f, 0xff40, - 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, - 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, - 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, - 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, - /* 0x24 */ - 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, - 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, - 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, - 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, - 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, - 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, - 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, - 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, - 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, - 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x317f, 0x3180, - 0x3181, 0x3182, 0x3183, 0x3184, 0x3185, 0x3186, 0x3187, 0x3188, - 0x3189, 0x318a, 0x318b, 0x318c, 0x318d, 0x318e, - /* 0x25 */ - 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, - 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2160, - 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, - 0x2169, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, - 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, - 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, - 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, - 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x26 */ - 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c, - 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b, - 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f, - 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542, - 0x2512, 0x2511, 0x251a, 0x2519, 0x2516, 0x2515, 0x250e, 0x250d, - 0x251e, 0x251f, 0x2521, 0x2522, 0x2526, 0x2527, 0x2529, 0x252a, - 0x252d, 0x252e, 0x2531, 0x2532, 0x2535, 0x2536, 0x2539, 0x253a, - 0x253d, 0x253e, 0x2540, 0x2541, 0x2543, 0x2544, 0x2545, 0x2546, - 0x2547, 0x2548, 0x2549, 0x254a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x27 */ - 0x3395, 0x3396, 0x3397, 0x2113, 0x3398, 0x33c4, 0x33a3, 0x33a4, - 0x33a5, 0x33a6, 0x3399, 0x339a, 0x339b, 0x339c, 0x339d, 0x339e, - 0x339f, 0x33a0, 0x33a1, 0x33a2, 0x33ca, 0x338d, 0x338e, 0x338f, - 0x33cf, 0x3388, 0x3389, 0x33c8, 0x33a7, 0x33a8, 0x33b0, 0x33b1, - 0x33b2, 0x33b3, 0x33b4, 0x33b5, 0x33b6, 0x33b7, 0x33b8, 0x33b9, - 0x3380, 0x3381, 0x3382, 0x3383, 0x3384, 0x33ba, 0x33bb, 0x33bc, - 0x33bd, 0x33be, 0x33bf, 0x3390, 0x3391, 0x3392, 0x3393, 0x3394, - 0x2126, 0x33c0, 0x33c1, 0x338a, 0x338b, 0x338c, 0x33d6, 0x33c5, - 0x33ad, 0x33ae, 0x33af, 0x33db, 0x33a9, 0x33aa, 0x33ab, 0x33ac, - 0x33dd, 0x33d0, 0x33d3, 0x33c3, 0x33c9, 0x33dc, 0x33c6, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x28 */ - 0x00c6, 0x00d0, 0x00aa, 0x0126, 0xfffd, 0x0132, 0xfffd, 0x013f, - 0x0141, 0x00d8, 0x0152, 0x00ba, 0x00de, 0x0166, 0x014a, 0xfffd, - 0x3260, 0x3261, 0x3262, 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, - 0x3268, 0x3269, 0x326a, 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, - 0x3270, 0x3271, 0x3272, 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, - 0x3278, 0x3279, 0x327a, 0x327b, 0x24d0, 0x24d1, 0x24d2, 0x24d3, - 0x24d4, 0x24d5, 0x24d6, 0x24d7, 0x24d8, 0x24d9, 0x24da, 0x24db, - 0x24dc, 0x24dd, 0x24de, 0x24df, 0x24e0, 0x24e1, 0x24e2, 0x24e3, - 0x24e4, 0x24e5, 0x24e6, 0x24e7, 0x24e8, 0x24e9, 0x2460, 0x2461, - 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, - 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x00bd, 0x2153, 0x2154, - 0x00bc, 0x00be, 0x215b, 0x215c, 0x215d, 0x215e, - /* 0x29 */ - 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138, 0x0140, - 0x0142, 0x00f8, 0x0153, 0x00df, 0x00fe, 0x0167, 0x014b, 0x0149, - 0x3200, 0x3201, 0x3202, 0x3203, 0x3204, 0x3205, 0x3206, 0x3207, - 0x3208, 0x3209, 0x320a, 0x320b, 0x320c, 0x320d, 0x320e, 0x320f, - 0x3210, 0x3211, 0x3212, 0x3213, 0x3214, 0x3215, 0x3216, 0x3217, - 0x3218, 0x3219, 0x321a, 0x321b, 0x249c, 0x249d, 0x249e, 0x249f, - 0x24a0, 0x24a1, 0x24a2, 0x24a3, 0x24a4, 0x24a5, 0x24a6, 0x24a7, - 0x24a8, 0x24a9, 0x24aa, 0x24ab, 0x24ac, 0x24ad, 0x24ae, 0x24af, - 0x24b0, 0x24b1, 0x24b2, 0x24b3, 0x24b4, 0x24b5, 0x2474, 0x2475, - 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, - 0x247e, 0x247f, 0x2480, 0x2481, 0x2482, 0x00b9, 0x00b2, 0x00b3, - 0x2074, 0x207f, 0x2081, 0x2082, 0x2083, 0x2084, - /* 0x2a */ - 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, - 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, - 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, - 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, - 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, - 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, - 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, - 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, - 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, - 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, - 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x2b */ - 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, - 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, - 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, - 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, - 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, - 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, - 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, - 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, - 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, - 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, - 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - /* 0x2c */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, - 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, - 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, - 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, - 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, - 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, - 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, - 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, - 0x044f, -}; -static const unsigned short ksc5601_2uni_page30[2350] = { - /* 0x30 */ - 0xac00, 0xac01, 0xac04, 0xac07, 0xac08, 0xac09, 0xac0a, 0xac10, - 0xac11, 0xac12, 0xac13, 0xac14, 0xac15, 0xac16, 0xac17, 0xac19, - 0xac1a, 0xac1b, 0xac1c, 0xac1d, 0xac20, 0xac24, 0xac2c, 0xac2d, - 0xac2f, 0xac30, 0xac31, 0xac38, 0xac39, 0xac3c, 0xac40, 0xac4b, - 0xac4d, 0xac54, 0xac58, 0xac5c, 0xac70, 0xac71, 0xac74, 0xac77, - 0xac78, 0xac7a, 0xac80, 0xac81, 0xac83, 0xac84, 0xac85, 0xac86, - 0xac89, 0xac8a, 0xac8b, 0xac8c, 0xac90, 0xac94, 0xac9c, 0xac9d, - 0xac9f, 0xaca0, 0xaca1, 0xaca8, 0xaca9, 0xacaa, 0xacac, 0xacaf, - 0xacb0, 0xacb8, 0xacb9, 0xacbb, 0xacbc, 0xacbd, 0xacc1, 0xacc4, - 0xacc8, 0xaccc, 0xacd5, 0xacd7, 0xace0, 0xace1, 0xace4, 0xace7, - 0xace8, 0xacea, 0xacec, 0xacef, 0xacf0, 0xacf1, 0xacf3, 0xacf5, - 0xacf6, 0xacfc, 0xacfd, 0xad00, 0xad04, 0xad06, - /* 0x31 */ - 0xad0c, 0xad0d, 0xad0f, 0xad11, 0xad18, 0xad1c, 0xad20, 0xad29, - 0xad2c, 0xad2d, 0xad34, 0xad35, 0xad38, 0xad3c, 0xad44, 0xad45, - 0xad47, 0xad49, 0xad50, 0xad54, 0xad58, 0xad61, 0xad63, 0xad6c, - 0xad6d, 0xad70, 0xad73, 0xad74, 0xad75, 0xad76, 0xad7b, 0xad7c, - 0xad7d, 0xad7f, 0xad81, 0xad82, 0xad88, 0xad89, 0xad8c, 0xad90, - 0xad9c, 0xad9d, 0xada4, 0xadb7, 0xadc0, 0xadc1, 0xadc4, 0xadc8, - 0xadd0, 0xadd1, 0xadd3, 0xaddc, 0xade0, 0xade4, 0xadf8, 0xadf9, - 0xadfc, 0xadff, 0xae00, 0xae01, 0xae08, 0xae09, 0xae0b, 0xae0d, - 0xae14, 0xae30, 0xae31, 0xae34, 0xae37, 0xae38, 0xae3a, 0xae40, - 0xae41, 0xae43, 0xae45, 0xae46, 0xae4a, 0xae4c, 0xae4d, 0xae4e, - 0xae50, 0xae54, 0xae56, 0xae5c, 0xae5d, 0xae5f, 0xae60, 0xae61, - 0xae65, 0xae68, 0xae69, 0xae6c, 0xae70, 0xae78, - /* 0x32 */ - 0xae79, 0xae7b, 0xae7c, 0xae7d, 0xae84, 0xae85, 0xae8c, 0xaebc, - 0xaebd, 0xaebe, 0xaec0, 0xaec4, 0xaecc, 0xaecd, 0xaecf, 0xaed0, - 0xaed1, 0xaed8, 0xaed9, 0xaedc, 0xaee8, 0xaeeb, 0xaeed, 0xaef4, - 0xaef8, 0xaefc, 0xaf07, 0xaf08, 0xaf0d, 0xaf10, 0xaf2c, 0xaf2d, - 0xaf30, 0xaf32, 0xaf34, 0xaf3c, 0xaf3d, 0xaf3f, 0xaf41, 0xaf42, - 0xaf43, 0xaf48, 0xaf49, 0xaf50, 0xaf5c, 0xaf5d, 0xaf64, 0xaf65, - 0xaf79, 0xaf80, 0xaf84, 0xaf88, 0xaf90, 0xaf91, 0xaf95, 0xaf9c, - 0xafb8, 0xafb9, 0xafbc, 0xafc0, 0xafc7, 0xafc8, 0xafc9, 0xafcb, - 0xafcd, 0xafce, 0xafd4, 0xafdc, 0xafe8, 0xafe9, 0xaff0, 0xaff1, - 0xaff4, 0xaff8, 0xb000, 0xb001, 0xb004, 0xb00c, 0xb010, 0xb014, - 0xb01c, 0xb01d, 0xb028, 0xb044, 0xb045, 0xb048, 0xb04a, 0xb04c, - 0xb04e, 0xb053, 0xb054, 0xb055, 0xb057, 0xb059, - /* 0x33 */ - 0xb05d, 0xb07c, 0xb07d, 0xb080, 0xb084, 0xb08c, 0xb08d, 0xb08f, - 0xb091, 0xb098, 0xb099, 0xb09a, 0xb09c, 0xb09f, 0xb0a0, 0xb0a1, - 0xb0a2, 0xb0a8, 0xb0a9, 0xb0ab, 0xb0ac, 0xb0ad, 0xb0ae, 0xb0af, - 0xb0b1, 0xb0b3, 0xb0b4, 0xb0b5, 0xb0b8, 0xb0bc, 0xb0c4, 0xb0c5, - 0xb0c7, 0xb0c8, 0xb0c9, 0xb0d0, 0xb0d1, 0xb0d4, 0xb0d8, 0xb0e0, - 0xb0e5, 0xb108, 0xb109, 0xb10b, 0xb10c, 0xb110, 0xb112, 0xb113, - 0xb118, 0xb119, 0xb11b, 0xb11c, 0xb11d, 0xb123, 0xb124, 0xb125, - 0xb128, 0xb12c, 0xb134, 0xb135, 0xb137, 0xb138, 0xb139, 0xb140, - 0xb141, 0xb144, 0xb148, 0xb150, 0xb151, 0xb154, 0xb155, 0xb158, - 0xb15c, 0xb160, 0xb178, 0xb179, 0xb17c, 0xb180, 0xb182, 0xb188, - 0xb189, 0xb18b, 0xb18d, 0xb192, 0xb193, 0xb194, 0xb198, 0xb19c, - 0xb1a8, 0xb1cc, 0xb1d0, 0xb1d4, 0xb1dc, 0xb1dd, - /* 0x34 */ - 0xb1df, 0xb1e8, 0xb1e9, 0xb1ec, 0xb1f0, 0xb1f9, 0xb1fb, 0xb1fd, - 0xb204, 0xb205, 0xb208, 0xb20b, 0xb20c, 0xb214, 0xb215, 0xb217, - 0xb219, 0xb220, 0xb234, 0xb23c, 0xb258, 0xb25c, 0xb260, 0xb268, - 0xb269, 0xb274, 0xb275, 0xb27c, 0xb284, 0xb285, 0xb289, 0xb290, - 0xb291, 0xb294, 0xb298, 0xb299, 0xb29a, 0xb2a0, 0xb2a1, 0xb2a3, - 0xb2a5, 0xb2a6, 0xb2aa, 0xb2ac, 0xb2b0, 0xb2b4, 0xb2c8, 0xb2c9, - 0xb2cc, 0xb2d0, 0xb2d2, 0xb2d8, 0xb2d9, 0xb2db, 0xb2dd, 0xb2e2, - 0xb2e4, 0xb2e5, 0xb2e6, 0xb2e8, 0xb2eb, 0xb2ec, 0xb2ed, 0xb2ee, - 0xb2ef, 0xb2f3, 0xb2f4, 0xb2f5, 0xb2f7, 0xb2f8, 0xb2f9, 0xb2fa, - 0xb2fb, 0xb2ff, 0xb300, 0xb301, 0xb304, 0xb308, 0xb310, 0xb311, - 0xb313, 0xb314, 0xb315, 0xb31c, 0xb354, 0xb355, 0xb356, 0xb358, - 0xb35b, 0xb35c, 0xb35e, 0xb35f, 0xb364, 0xb365, - /* 0x35 */ - 0xb367, 0xb369, 0xb36b, 0xb36e, 0xb370, 0xb371, 0xb374, 0xb378, - 0xb380, 0xb381, 0xb383, 0xb384, 0xb385, 0xb38c, 0xb390, 0xb394, - 0xb3a0, 0xb3a1, 0xb3a8, 0xb3ac, 0xb3c4, 0xb3c5, 0xb3c8, 0xb3cb, - 0xb3cc, 0xb3ce, 0xb3d0, 0xb3d4, 0xb3d5, 0xb3d7, 0xb3d9, 0xb3db, - 0xb3dd, 0xb3e0, 0xb3e4, 0xb3e8, 0xb3fc, 0xb410, 0xb418, 0xb41c, - 0xb420, 0xb428, 0xb429, 0xb42b, 0xb434, 0xb450, 0xb451, 0xb454, - 0xb458, 0xb460, 0xb461, 0xb463, 0xb465, 0xb46c, 0xb480, 0xb488, - 0xb49d, 0xb4a4, 0xb4a8, 0xb4ac, 0xb4b5, 0xb4b7, 0xb4b9, 0xb4c0, - 0xb4c4, 0xb4c8, 0xb4d0, 0xb4d5, 0xb4dc, 0xb4dd, 0xb4e0, 0xb4e3, - 0xb4e4, 0xb4e6, 0xb4ec, 0xb4ed, 0xb4ef, 0xb4f1, 0xb4f8, 0xb514, - 0xb515, 0xb518, 0xb51b, 0xb51c, 0xb524, 0xb525, 0xb527, 0xb528, - 0xb529, 0xb52a, 0xb530, 0xb531, 0xb534, 0xb538, - /* 0x36 */ - 0xb540, 0xb541, 0xb543, 0xb544, 0xb545, 0xb54b, 0xb54c, 0xb54d, - 0xb550, 0xb554, 0xb55c, 0xb55d, 0xb55f, 0xb560, 0xb561, 0xb5a0, - 0xb5a1, 0xb5a4, 0xb5a8, 0xb5aa, 0xb5ab, 0xb5b0, 0xb5b1, 0xb5b3, - 0xb5b4, 0xb5b5, 0xb5bb, 0xb5bc, 0xb5bd, 0xb5c0, 0xb5c4, 0xb5cc, - 0xb5cd, 0xb5cf, 0xb5d0, 0xb5d1, 0xb5d8, 0xb5ec, 0xb610, 0xb611, - 0xb614, 0xb618, 0xb625, 0xb62c, 0xb634, 0xb648, 0xb664, 0xb668, - 0xb69c, 0xb69d, 0xb6a0, 0xb6a4, 0xb6ab, 0xb6ac, 0xb6b1, 0xb6d4, - 0xb6f0, 0xb6f4, 0xb6f8, 0xb700, 0xb701, 0xb705, 0xb728, 0xb729, - 0xb72c, 0xb72f, 0xb730, 0xb738, 0xb739, 0xb73b, 0xb744, 0xb748, - 0xb74c, 0xb754, 0xb755, 0xb760, 0xb764, 0xb768, 0xb770, 0xb771, - 0xb773, 0xb775, 0xb77c, 0xb77d, 0xb780, 0xb784, 0xb78c, 0xb78d, - 0xb78f, 0xb790, 0xb791, 0xb792, 0xb796, 0xb797, - /* 0x37 */ - 0xb798, 0xb799, 0xb79c, 0xb7a0, 0xb7a8, 0xb7a9, 0xb7ab, 0xb7ac, - 0xb7ad, 0xb7b4, 0xb7b5, 0xb7b8, 0xb7c7, 0xb7c9, 0xb7ec, 0xb7ed, - 0xb7f0, 0xb7f4, 0xb7fc, 0xb7fd, 0xb7ff, 0xb800, 0xb801, 0xb807, - 0xb808, 0xb809, 0xb80c, 0xb810, 0xb818, 0xb819, 0xb81b, 0xb81d, - 0xb824, 0xb825, 0xb828, 0xb82c, 0xb834, 0xb835, 0xb837, 0xb838, - 0xb839, 0xb840, 0xb844, 0xb851, 0xb853, 0xb85c, 0xb85d, 0xb860, - 0xb864, 0xb86c, 0xb86d, 0xb86f, 0xb871, 0xb878, 0xb87c, 0xb88d, - 0xb8a8, 0xb8b0, 0xb8b4, 0xb8b8, 0xb8c0, 0xb8c1, 0xb8c3, 0xb8c5, - 0xb8cc, 0xb8d0, 0xb8d4, 0xb8dd, 0xb8df, 0xb8e1, 0xb8e8, 0xb8e9, - 0xb8ec, 0xb8f0, 0xb8f8, 0xb8f9, 0xb8fb, 0xb8fd, 0xb904, 0xb918, - 0xb920, 0xb93c, 0xb93d, 0xb940, 0xb944, 0xb94c, 0xb94f, 0xb951, - 0xb958, 0xb959, 0xb95c, 0xb960, 0xb968, 0xb969, - /* 0x38 */ - 0xb96b, 0xb96d, 0xb974, 0xb975, 0xb978, 0xb97c, 0xb984, 0xb985, - 0xb987, 0xb989, 0xb98a, 0xb98d, 0xb98e, 0xb9ac, 0xb9ad, 0xb9b0, - 0xb9b4, 0xb9bc, 0xb9bd, 0xb9bf, 0xb9c1, 0xb9c8, 0xb9c9, 0xb9cc, - 0xb9ce, 0xb9cf, 0xb9d0, 0xb9d1, 0xb9d2, 0xb9d8, 0xb9d9, 0xb9db, - 0xb9dd, 0xb9de, 0xb9e1, 0xb9e3, 0xb9e4, 0xb9e5, 0xb9e8, 0xb9ec, - 0xb9f4, 0xb9f5, 0xb9f7, 0xb9f8, 0xb9f9, 0xb9fa, 0xba00, 0xba01, - 0xba08, 0xba15, 0xba38, 0xba39, 0xba3c, 0xba40, 0xba42, 0xba48, - 0xba49, 0xba4b, 0xba4d, 0xba4e, 0xba53, 0xba54, 0xba55, 0xba58, - 0xba5c, 0xba64, 0xba65, 0xba67, 0xba68, 0xba69, 0xba70, 0xba71, - 0xba74, 0xba78, 0xba83, 0xba84, 0xba85, 0xba87, 0xba8c, 0xbaa8, - 0xbaa9, 0xbaab, 0xbaac, 0xbab0, 0xbab2, 0xbab8, 0xbab9, 0xbabb, - 0xbabd, 0xbac4, 0xbac8, 0xbad8, 0xbad9, 0xbafc, - /* 0x39 */ - 0xbb00, 0xbb04, 0xbb0d, 0xbb0f, 0xbb11, 0xbb18, 0xbb1c, 0xbb20, - 0xbb29, 0xbb2b, 0xbb34, 0xbb35, 0xbb36, 0xbb38, 0xbb3b, 0xbb3c, - 0xbb3d, 0xbb3e, 0xbb44, 0xbb45, 0xbb47, 0xbb49, 0xbb4d, 0xbb4f, - 0xbb50, 0xbb54, 0xbb58, 0xbb61, 0xbb63, 0xbb6c, 0xbb88, 0xbb8c, - 0xbb90, 0xbba4, 0xbba8, 0xbbac, 0xbbb4, 0xbbb7, 0xbbc0, 0xbbc4, - 0xbbc8, 0xbbd0, 0xbbd3, 0xbbf8, 0xbbf9, 0xbbfc, 0xbbff, 0xbc00, - 0xbc02, 0xbc08, 0xbc09, 0xbc0b, 0xbc0c, 0xbc0d, 0xbc0f, 0xbc11, - 0xbc14, 0xbc15, 0xbc16, 0xbc17, 0xbc18, 0xbc1b, 0xbc1c, 0xbc1d, - 0xbc1e, 0xbc1f, 0xbc24, 0xbc25, 0xbc27, 0xbc29, 0xbc2d, 0xbc30, - 0xbc31, 0xbc34, 0xbc38, 0xbc40, 0xbc41, 0xbc43, 0xbc44, 0xbc45, - 0xbc49, 0xbc4c, 0xbc4d, 0xbc50, 0xbc5d, 0xbc84, 0xbc85, 0xbc88, - 0xbc8b, 0xbc8c, 0xbc8e, 0xbc94, 0xbc95, 0xbc97, - /* 0x3a */ - 0xbc99, 0xbc9a, 0xbca0, 0xbca1, 0xbca4, 0xbca7, 0xbca8, 0xbcb0, - 0xbcb1, 0xbcb3, 0xbcb4, 0xbcb5, 0xbcbc, 0xbcbd, 0xbcc0, 0xbcc4, - 0xbccd, 0xbccf, 0xbcd0, 0xbcd1, 0xbcd5, 0xbcd8, 0xbcdc, 0xbcf4, - 0xbcf5, 0xbcf6, 0xbcf8, 0xbcfc, 0xbd04, 0xbd05, 0xbd07, 0xbd09, - 0xbd10, 0xbd14, 0xbd24, 0xbd2c, 0xbd40, 0xbd48, 0xbd49, 0xbd4c, - 0xbd50, 0xbd58, 0xbd59, 0xbd64, 0xbd68, 0xbd80, 0xbd81, 0xbd84, - 0xbd87, 0xbd88, 0xbd89, 0xbd8a, 0xbd90, 0xbd91, 0xbd93, 0xbd95, - 0xbd99, 0xbd9a, 0xbd9c, 0xbda4, 0xbdb0, 0xbdb8, 0xbdd4, 0xbdd5, - 0xbdd8, 0xbddc, 0xbde9, 0xbdf0, 0xbdf4, 0xbdf8, 0xbe00, 0xbe03, - 0xbe05, 0xbe0c, 0xbe0d, 0xbe10, 0xbe14, 0xbe1c, 0xbe1d, 0xbe1f, - 0xbe44, 0xbe45, 0xbe48, 0xbe4c, 0xbe4e, 0xbe54, 0xbe55, 0xbe57, - 0xbe59, 0xbe5a, 0xbe5b, 0xbe60, 0xbe61, 0xbe64, - /* 0x3b */ - 0xbe68, 0xbe6a, 0xbe70, 0xbe71, 0xbe73, 0xbe74, 0xbe75, 0xbe7b, - 0xbe7c, 0xbe7d, 0xbe80, 0xbe84, 0xbe8c, 0xbe8d, 0xbe8f, 0xbe90, - 0xbe91, 0xbe98, 0xbe99, 0xbea8, 0xbed0, 0xbed1, 0xbed4, 0xbed7, - 0xbed8, 0xbee0, 0xbee3, 0xbee4, 0xbee5, 0xbeec, 0xbf01, 0xbf08, - 0xbf09, 0xbf18, 0xbf19, 0xbf1b, 0xbf1c, 0xbf1d, 0xbf40, 0xbf41, - 0xbf44, 0xbf48, 0xbf50, 0xbf51, 0xbf55, 0xbf94, 0xbfb0, 0xbfc5, - 0xbfcc, 0xbfcd, 0xbfd0, 0xbfd4, 0xbfdc, 0xbfdf, 0xbfe1, 0xc03c, - 0xc051, 0xc058, 0xc05c, 0xc060, 0xc068, 0xc069, 0xc090, 0xc091, - 0xc094, 0xc098, 0xc0a0, 0xc0a1, 0xc0a3, 0xc0a5, 0xc0ac, 0xc0ad, - 0xc0af, 0xc0b0, 0xc0b3, 0xc0b4, 0xc0b5, 0xc0b6, 0xc0bc, 0xc0bd, - 0xc0bf, 0xc0c0, 0xc0c1, 0xc0c5, 0xc0c8, 0xc0c9, 0xc0cc, 0xc0d0, - 0xc0d8, 0xc0d9, 0xc0db, 0xc0dc, 0xc0dd, 0xc0e4, - /* 0x3c */ - 0xc0e5, 0xc0e8, 0xc0ec, 0xc0f4, 0xc0f5, 0xc0f7, 0xc0f9, 0xc100, - 0xc104, 0xc108, 0xc110, 0xc115, 0xc11c, 0xc11d, 0xc11e, 0xc11f, - 0xc120, 0xc123, 0xc124, 0xc126, 0xc127, 0xc12c, 0xc12d, 0xc12f, - 0xc130, 0xc131, 0xc136, 0xc138, 0xc139, 0xc13c, 0xc140, 0xc148, - 0xc149, 0xc14b, 0xc14c, 0xc14d, 0xc154, 0xc155, 0xc158, 0xc15c, - 0xc164, 0xc165, 0xc167, 0xc168, 0xc169, 0xc170, 0xc174, 0xc178, - 0xc185, 0xc18c, 0xc18d, 0xc18e, 0xc190, 0xc194, 0xc196, 0xc19c, - 0xc19d, 0xc19f, 0xc1a1, 0xc1a5, 0xc1a8, 0xc1a9, 0xc1ac, 0xc1b0, - 0xc1bd, 0xc1c4, 0xc1c8, 0xc1cc, 0xc1d4, 0xc1d7, 0xc1d8, 0xc1e0, - 0xc1e4, 0xc1e8, 0xc1f0, 0xc1f1, 0xc1f3, 0xc1fc, 0xc1fd, 0xc200, - 0xc204, 0xc20c, 0xc20d, 0xc20f, 0xc211, 0xc218, 0xc219, 0xc21c, - 0xc21f, 0xc220, 0xc228, 0xc229, 0xc22b, 0xc22d, - /* 0x3d */ - 0xc22f, 0xc231, 0xc232, 0xc234, 0xc248, 0xc250, 0xc251, 0xc254, - 0xc258, 0xc260, 0xc265, 0xc26c, 0xc26d, 0xc270, 0xc274, 0xc27c, - 0xc27d, 0xc27f, 0xc281, 0xc288, 0xc289, 0xc290, 0xc298, 0xc29b, - 0xc29d, 0xc2a4, 0xc2a5, 0xc2a8, 0xc2ac, 0xc2ad, 0xc2b4, 0xc2b5, - 0xc2b7, 0xc2b9, 0xc2dc, 0xc2dd, 0xc2e0, 0xc2e3, 0xc2e4, 0xc2eb, - 0xc2ec, 0xc2ed, 0xc2ef, 0xc2f1, 0xc2f6, 0xc2f8, 0xc2f9, 0xc2fb, - 0xc2fc, 0xc300, 0xc308, 0xc309, 0xc30c, 0xc30d, 0xc313, 0xc314, - 0xc315, 0xc318, 0xc31c, 0xc324, 0xc325, 0xc328, 0xc329, 0xc345, - 0xc368, 0xc369, 0xc36c, 0xc370, 0xc372, 0xc378, 0xc379, 0xc37c, - 0xc37d, 0xc384, 0xc388, 0xc38c, 0xc3c0, 0xc3d8, 0xc3d9, 0xc3dc, - 0xc3df, 0xc3e0, 0xc3e2, 0xc3e8, 0xc3e9, 0xc3ed, 0xc3f4, 0xc3f5, - 0xc3f8, 0xc408, 0xc410, 0xc424, 0xc42c, 0xc430, - /* 0x3e */ - 0xc434, 0xc43c, 0xc43d, 0xc448, 0xc464, 0xc465, 0xc468, 0xc46c, - 0xc474, 0xc475, 0xc479, 0xc480, 0xc494, 0xc49c, 0xc4b8, 0xc4bc, - 0xc4e9, 0xc4f0, 0xc4f1, 0xc4f4, 0xc4f8, 0xc4fa, 0xc4ff, 0xc500, - 0xc501, 0xc50c, 0xc510, 0xc514, 0xc51c, 0xc528, 0xc529, 0xc52c, - 0xc530, 0xc538, 0xc539, 0xc53b, 0xc53d, 0xc544, 0xc545, 0xc548, - 0xc549, 0xc54a, 0xc54c, 0xc54d, 0xc54e, 0xc553, 0xc554, 0xc555, - 0xc557, 0xc558, 0xc559, 0xc55d, 0xc55e, 0xc560, 0xc561, 0xc564, - 0xc568, 0xc570, 0xc571, 0xc573, 0xc574, 0xc575, 0xc57c, 0xc57d, - 0xc580, 0xc584, 0xc587, 0xc58c, 0xc58d, 0xc58f, 0xc591, 0xc595, - 0xc597, 0xc598, 0xc59c, 0xc5a0, 0xc5a9, 0xc5b4, 0xc5b5, 0xc5b8, - 0xc5b9, 0xc5bb, 0xc5bc, 0xc5bd, 0xc5be, 0xc5c4, 0xc5c5, 0xc5c6, - 0xc5c7, 0xc5c8, 0xc5c9, 0xc5ca, 0xc5cc, 0xc5ce, - /* 0x3f */ - 0xc5d0, 0xc5d1, 0xc5d4, 0xc5d8, 0xc5e0, 0xc5e1, 0xc5e3, 0xc5e5, - 0xc5ec, 0xc5ed, 0xc5ee, 0xc5f0, 0xc5f4, 0xc5f6, 0xc5f7, 0xc5fc, - 0xc5fd, 0xc5fe, 0xc5ff, 0xc600, 0xc601, 0xc605, 0xc606, 0xc607, - 0xc608, 0xc60c, 0xc610, 0xc618, 0xc619, 0xc61b, 0xc61c, 0xc624, - 0xc625, 0xc628, 0xc62c, 0xc62d, 0xc62e, 0xc630, 0xc633, 0xc634, - 0xc635, 0xc637, 0xc639, 0xc63b, 0xc640, 0xc641, 0xc644, 0xc648, - 0xc650, 0xc651, 0xc653, 0xc654, 0xc655, 0xc65c, 0xc65d, 0xc660, - 0xc66c, 0xc66f, 0xc671, 0xc678, 0xc679, 0xc67c, 0xc680, 0xc688, - 0xc689, 0xc68b, 0xc68d, 0xc694, 0xc695, 0xc698, 0xc69c, 0xc6a4, - 0xc6a5, 0xc6a7, 0xc6a9, 0xc6b0, 0xc6b1, 0xc6b4, 0xc6b8, 0xc6b9, - 0xc6ba, 0xc6c0, 0xc6c1, 0xc6c3, 0xc6c5, 0xc6cc, 0xc6cd, 0xc6d0, - 0xc6d4, 0xc6dc, 0xc6dd, 0xc6e0, 0xc6e1, 0xc6e8, - /* 0x40 */ - 0xc6e9, 0xc6ec, 0xc6f0, 0xc6f8, 0xc6f9, 0xc6fd, 0xc704, 0xc705, - 0xc708, 0xc70c, 0xc714, 0xc715, 0xc717, 0xc719, 0xc720, 0xc721, - 0xc724, 0xc728, 0xc730, 0xc731, 0xc733, 0xc735, 0xc737, 0xc73c, - 0xc73d, 0xc740, 0xc744, 0xc74a, 0xc74c, 0xc74d, 0xc74f, 0xc751, - 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc75c, - 0xc760, 0xc768, 0xc76b, 0xc774, 0xc775, 0xc778, 0xc77c, 0xc77d, - 0xc77e, 0xc783, 0xc784, 0xc785, 0xc787, 0xc788, 0xc789, 0xc78a, - 0xc78e, 0xc790, 0xc791, 0xc794, 0xc796, 0xc797, 0xc798, 0xc79a, - 0xc7a0, 0xc7a1, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, 0xc7ac, 0xc7ad, - 0xc7b0, 0xc7b4, 0xc7bc, 0xc7bd, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c8, - 0xc7c9, 0xc7cc, 0xc7ce, 0xc7d0, 0xc7d8, 0xc7dd, 0xc7e4, 0xc7e8, - 0xc7ec, 0xc800, 0xc801, 0xc804, 0xc808, 0xc80a, - /* 0x41 */ - 0xc810, 0xc811, 0xc813, 0xc815, 0xc816, 0xc81c, 0xc81d, 0xc820, - 0xc824, 0xc82c, 0xc82d, 0xc82f, 0xc831, 0xc838, 0xc83c, 0xc840, - 0xc848, 0xc849, 0xc84c, 0xc84d, 0xc854, 0xc870, 0xc871, 0xc874, - 0xc878, 0xc87a, 0xc880, 0xc881, 0xc883, 0xc885, 0xc886, 0xc887, - 0xc88b, 0xc88c, 0xc88d, 0xc894, 0xc89d, 0xc89f, 0xc8a1, 0xc8a8, - 0xc8bc, 0xc8bd, 0xc8c4, 0xc8c8, 0xc8cc, 0xc8d4, 0xc8d5, 0xc8d7, - 0xc8d9, 0xc8e0, 0xc8e1, 0xc8e4, 0xc8f5, 0xc8fc, 0xc8fd, 0xc900, - 0xc904, 0xc905, 0xc906, 0xc90c, 0xc90d, 0xc90f, 0xc911, 0xc918, - 0xc92c, 0xc934, 0xc950, 0xc951, 0xc954, 0xc958, 0xc960, 0xc961, - 0xc963, 0xc96c, 0xc970, 0xc974, 0xc97c, 0xc988, 0xc989, 0xc98c, - 0xc990, 0xc998, 0xc999, 0xc99b, 0xc99d, 0xc9c0, 0xc9c1, 0xc9c4, - 0xc9c7, 0xc9c8, 0xc9ca, 0xc9d0, 0xc9d1, 0xc9d3, - /* 0x42 */ - 0xc9d5, 0xc9d6, 0xc9d9, 0xc9da, 0xc9dc, 0xc9dd, 0xc9e0, 0xc9e2, - 0xc9e4, 0xc9e7, 0xc9ec, 0xc9ed, 0xc9ef, 0xc9f0, 0xc9f1, 0xc9f8, - 0xc9f9, 0xc9fc, 0xca00, 0xca08, 0xca09, 0xca0b, 0xca0c, 0xca0d, - 0xca14, 0xca18, 0xca29, 0xca4c, 0xca4d, 0xca50, 0xca54, 0xca5c, - 0xca5d, 0xca5f, 0xca60, 0xca61, 0xca68, 0xca7d, 0xca84, 0xca98, - 0xcabc, 0xcabd, 0xcac0, 0xcac4, 0xcacc, 0xcacd, 0xcacf, 0xcad1, - 0xcad3, 0xcad8, 0xcad9, 0xcae0, 0xcaec, 0xcaf4, 0xcb08, 0xcb10, - 0xcb14, 0xcb18, 0xcb20, 0xcb21, 0xcb41, 0xcb48, 0xcb49, 0xcb4c, - 0xcb50, 0xcb58, 0xcb59, 0xcb5d, 0xcb64, 0xcb78, 0xcb79, 0xcb9c, - 0xcbb8, 0xcbd4, 0xcbe4, 0xcbe7, 0xcbe9, 0xcc0c, 0xcc0d, 0xcc10, - 0xcc14, 0xcc1c, 0xcc1d, 0xcc21, 0xcc22, 0xcc27, 0xcc28, 0xcc29, - 0xcc2c, 0xcc2e, 0xcc30, 0xcc38, 0xcc39, 0xcc3b, - /* 0x43 */ - 0xcc3c, 0xcc3d, 0xcc3e, 0xcc44, 0xcc45, 0xcc48, 0xcc4c, 0xcc54, - 0xcc55, 0xcc57, 0xcc58, 0xcc59, 0xcc60, 0xcc64, 0xcc66, 0xcc68, - 0xcc70, 0xcc75, 0xcc98, 0xcc99, 0xcc9c, 0xcca0, 0xcca8, 0xcca9, - 0xccab, 0xccac, 0xccad, 0xccb4, 0xccb5, 0xccb8, 0xccbc, 0xccc4, - 0xccc5, 0xccc7, 0xccc9, 0xccd0, 0xccd4, 0xcce4, 0xccec, 0xccf0, - 0xcd01, 0xcd08, 0xcd09, 0xcd0c, 0xcd10, 0xcd18, 0xcd19, 0xcd1b, - 0xcd1d, 0xcd24, 0xcd28, 0xcd2c, 0xcd39, 0xcd5c, 0xcd60, 0xcd64, - 0xcd6c, 0xcd6d, 0xcd6f, 0xcd71, 0xcd78, 0xcd88, 0xcd94, 0xcd95, - 0xcd98, 0xcd9c, 0xcda4, 0xcda5, 0xcda7, 0xcda9, 0xcdb0, 0xcdc4, - 0xcdcc, 0xcdd0, 0xcde8, 0xcdec, 0xcdf0, 0xcdf8, 0xcdf9, 0xcdfb, - 0xcdfd, 0xce04, 0xce08, 0xce0c, 0xce14, 0xce19, 0xce20, 0xce21, - 0xce24, 0xce28, 0xce30, 0xce31, 0xce33, 0xce35, - /* 0x44 */ - 0xce58, 0xce59, 0xce5c, 0xce5f, 0xce60, 0xce61, 0xce68, 0xce69, - 0xce6b, 0xce6d, 0xce74, 0xce75, 0xce78, 0xce7c, 0xce84, 0xce85, - 0xce87, 0xce89, 0xce90, 0xce91, 0xce94, 0xce98, 0xcea0, 0xcea1, - 0xcea3, 0xcea4, 0xcea5, 0xceac, 0xcead, 0xcec1, 0xcee4, 0xcee5, - 0xcee8, 0xceeb, 0xceec, 0xcef4, 0xcef5, 0xcef7, 0xcef8, 0xcef9, - 0xcf00, 0xcf01, 0xcf04, 0xcf08, 0xcf10, 0xcf11, 0xcf13, 0xcf15, - 0xcf1c, 0xcf20, 0xcf24, 0xcf2c, 0xcf2d, 0xcf2f, 0xcf30, 0xcf31, - 0xcf38, 0xcf54, 0xcf55, 0xcf58, 0xcf5c, 0xcf64, 0xcf65, 0xcf67, - 0xcf69, 0xcf70, 0xcf71, 0xcf74, 0xcf78, 0xcf80, 0xcf85, 0xcf8c, - 0xcfa1, 0xcfa8, 0xcfb0, 0xcfc4, 0xcfe0, 0xcfe1, 0xcfe4, 0xcfe8, - 0xcff0, 0xcff1, 0xcff3, 0xcff5, 0xcffc, 0xd000, 0xd004, 0xd011, - 0xd018, 0xd02d, 0xd034, 0xd035, 0xd038, 0xd03c, - /* 0x45 */ - 0xd044, 0xd045, 0xd047, 0xd049, 0xd050, 0xd054, 0xd058, 0xd060, - 0xd06c, 0xd06d, 0xd070, 0xd074, 0xd07c, 0xd07d, 0xd081, 0xd0a4, - 0xd0a5, 0xd0a8, 0xd0ac, 0xd0b4, 0xd0b5, 0xd0b7, 0xd0b9, 0xd0c0, - 0xd0c1, 0xd0c4, 0xd0c8, 0xd0c9, 0xd0d0, 0xd0d1, 0xd0d3, 0xd0d4, - 0xd0d5, 0xd0dc, 0xd0dd, 0xd0e0, 0xd0e4, 0xd0ec, 0xd0ed, 0xd0ef, - 0xd0f0, 0xd0f1, 0xd0f8, 0xd10d, 0xd130, 0xd131, 0xd134, 0xd138, - 0xd13a, 0xd140, 0xd141, 0xd143, 0xd144, 0xd145, 0xd14c, 0xd14d, - 0xd150, 0xd154, 0xd15c, 0xd15d, 0xd15f, 0xd161, 0xd168, 0xd16c, - 0xd17c, 0xd184, 0xd188, 0xd1a0, 0xd1a1, 0xd1a4, 0xd1a8, 0xd1b0, - 0xd1b1, 0xd1b3, 0xd1b5, 0xd1ba, 0xd1bc, 0xd1c0, 0xd1d8, 0xd1f4, - 0xd1f8, 0xd207, 0xd209, 0xd210, 0xd22c, 0xd22d, 0xd230, 0xd234, - 0xd23c, 0xd23d, 0xd23f, 0xd241, 0xd248, 0xd25c, - /* 0x46 */ - 0xd264, 0xd280, 0xd281, 0xd284, 0xd288, 0xd290, 0xd291, 0xd295, - 0xd29c, 0xd2a0, 0xd2a4, 0xd2ac, 0xd2b1, 0xd2b8, 0xd2b9, 0xd2bc, - 0xd2bf, 0xd2c0, 0xd2c2, 0xd2c8, 0xd2c9, 0xd2cb, 0xd2d4, 0xd2d8, - 0xd2dc, 0xd2e4, 0xd2e5, 0xd2f0, 0xd2f1, 0xd2f4, 0xd2f8, 0xd300, - 0xd301, 0xd303, 0xd305, 0xd30c, 0xd30d, 0xd30e, 0xd310, 0xd314, - 0xd316, 0xd31c, 0xd31d, 0xd31f, 0xd320, 0xd321, 0xd325, 0xd328, - 0xd329, 0xd32c, 0xd330, 0xd338, 0xd339, 0xd33b, 0xd33c, 0xd33d, - 0xd344, 0xd345, 0xd37c, 0xd37d, 0xd380, 0xd384, 0xd38c, 0xd38d, - 0xd38f, 0xd390, 0xd391, 0xd398, 0xd399, 0xd39c, 0xd3a0, 0xd3a8, - 0xd3a9, 0xd3ab, 0xd3ad, 0xd3b4, 0xd3b8, 0xd3bc, 0xd3c4, 0xd3c5, - 0xd3c8, 0xd3c9, 0xd3d0, 0xd3d8, 0xd3e1, 0xd3e3, 0xd3ec, 0xd3ed, - 0xd3f0, 0xd3f4, 0xd3fc, 0xd3fd, 0xd3ff, 0xd401, - /* 0x47 */ - 0xd408, 0xd41d, 0xd440, 0xd444, 0xd45c, 0xd460, 0xd464, 0xd46d, - 0xd46f, 0xd478, 0xd479, 0xd47c, 0xd47f, 0xd480, 0xd482, 0xd488, - 0xd489, 0xd48b, 0xd48d, 0xd494, 0xd4a9, 0xd4cc, 0xd4d0, 0xd4d4, - 0xd4dc, 0xd4df, 0xd4e8, 0xd4ec, 0xd4f0, 0xd4f8, 0xd4fb, 0xd4fd, - 0xd504, 0xd508, 0xd50c, 0xd514, 0xd515, 0xd517, 0xd53c, 0xd53d, - 0xd540, 0xd544, 0xd54c, 0xd54d, 0xd54f, 0xd551, 0xd558, 0xd559, - 0xd55c, 0xd560, 0xd565, 0xd568, 0xd569, 0xd56b, 0xd56d, 0xd574, - 0xd575, 0xd578, 0xd57c, 0xd584, 0xd585, 0xd587, 0xd588, 0xd589, - 0xd590, 0xd5a5, 0xd5c8, 0xd5c9, 0xd5cc, 0xd5d0, 0xd5d2, 0xd5d8, - 0xd5d9, 0xd5db, 0xd5dd, 0xd5e4, 0xd5e5, 0xd5e8, 0xd5ec, 0xd5f4, - 0xd5f5, 0xd5f7, 0xd5f9, 0xd600, 0xd601, 0xd604, 0xd608, 0xd610, - 0xd611, 0xd613, 0xd614, 0xd615, 0xd61c, 0xd620, - /* 0x48 */ - 0xd624, 0xd62d, 0xd638, 0xd639, 0xd63c, 0xd640, 0xd645, 0xd648, - 0xd649, 0xd64b, 0xd64d, 0xd651, 0xd654, 0xd655, 0xd658, 0xd65c, - 0xd667, 0xd669, 0xd670, 0xd671, 0xd674, 0xd683, 0xd685, 0xd68c, - 0xd68d, 0xd690, 0xd694, 0xd69d, 0xd69f, 0xd6a1, 0xd6a8, 0xd6ac, - 0xd6b0, 0xd6b9, 0xd6bb, 0xd6c4, 0xd6c5, 0xd6c8, 0xd6cc, 0xd6d1, - 0xd6d4, 0xd6d7, 0xd6d9, 0xd6e0, 0xd6e4, 0xd6e8, 0xd6f0, 0xd6f5, - 0xd6fc, 0xd6fd, 0xd700, 0xd704, 0xd711, 0xd718, 0xd719, 0xd71c, - 0xd720, 0xd728, 0xd729, 0xd72b, 0xd72d, 0xd734, 0xd735, 0xd738, - 0xd73c, 0xd744, 0xd747, 0xd749, 0xd750, 0xd751, 0xd754, 0xd756, - 0xd757, 0xd758, 0xd759, 0xd760, 0xd761, 0xd763, 0xd765, 0xd769, - 0xd76c, 0xd770, 0xd774, 0xd77c, 0xd77d, 0xd781, 0xd788, 0xd789, - 0xd78c, 0xd790, 0xd798, 0xd799, 0xd79b, 0xd79d, -}; -static const unsigned short ksc5601_2uni_page4a[4888] = { - /* 0x4a */ - 0x4f3d, 0x4f73, 0x5047, 0x50f9, 0x52a0, 0x53ef, 0x5475, 0x54e5, - 0x5609, 0x5ac1, 0x5bb6, 0x6687, 0x67b6, 0x67b7, 0x67ef, 0x6b4c, - 0x73c2, 0x75c2, 0x7a3c, 0x82db, 0x8304, 0x8857, 0x8888, 0x8a36, - 0x8cc8, 0x8dcf, 0x8efb, 0x8fe6, 0x99d5, 0x523b, 0x5374, 0x5404, - 0x606a, 0x6164, 0x6bbc, 0x73cf, 0x811a, 0x89ba, 0x89d2, 0x95a3, - 0x4f83, 0x520a, 0x58be, 0x5978, 0x59e6, 0x5e72, 0x5e79, 0x61c7, - 0x63c0, 0x6746, 0x67ec, 0x687f, 0x6f97, 0x764e, 0x770b, 0x78f5, - 0x7a08, 0x7aff, 0x7c21, 0x809d, 0x826e, 0x8271, 0x8aeb, 0x9593, - 0x4e6b, 0x559d, 0x66f7, 0x6e34, 0x78a3, 0x7aed, 0x845b, 0x8910, - 0x874e, 0x97a8, 0x52d8, 0x574e, 0x582a, 0x5d4c, 0x611f, 0x61be, - 0x6221, 0x6562, 0x67d1, 0x6a44, 0x6e1b, 0x7518, 0x75b3, 0x76e3, - 0x77b0, 0x7d3a, 0x90af, 0x9451, 0x9452, 0x9f95, - /* 0x4b */ - 0x5323, 0x5cac, 0x7532, 0x80db, 0x9240, 0x9598, 0x525b, 0x5808, - 0x59dc, 0x5ca1, 0x5d17, 0x5eb7, 0x5f3a, 0x5f4a, 0x6177, 0x6c5f, - 0x757a, 0x7586, 0x7ce0, 0x7d73, 0x7db1, 0x7f8c, 0x8154, 0x8221, - 0x8591, 0x8941, 0x8b1b, 0x92fc, 0x964d, 0x9c47, 0x4ecb, 0x4ef7, - 0x500b, 0x51f1, 0x584f, 0x6137, 0x613e, 0x6168, 0x6539, 0x69ea, - 0x6f11, 0x75a5, 0x7686, 0x76d6, 0x7b87, 0x82a5, 0x84cb, 0xf900, - 0x93a7, 0x958b, 0x5580, 0x5ba2, 0x5751, 0xf901, 0x7cb3, 0x7fb9, - 0x91b5, 0x5028, 0x53bb, 0x5c45, 0x5de8, 0x62d2, 0x636e, 0x64da, - 0x64e7, 0x6e20, 0x70ac, 0x795b, 0x8ddd, 0x8e1e, 0xf902, 0x907d, - 0x9245, 0x92f8, 0x4e7e, 0x4ef6, 0x5065, 0x5dfe, 0x5efa, 0x6106, - 0x6957, 0x8171, 0x8654, 0x8e47, 0x9375, 0x9a2b, 0x4e5e, 0x5091, - 0x6770, 0x6840, 0x5109, 0x528d, 0x5292, 0x6aa2, - /* 0x4c */ - 0x77bc, 0x9210, 0x9ed4, 0x52ab, 0x602f, 0x8ff2, 0x5048, 0x61a9, - 0x63ed, 0x64ca, 0x683c, 0x6a84, 0x6fc0, 0x8188, 0x89a1, 0x9694, - 0x5805, 0x727d, 0x72ac, 0x7504, 0x7d79, 0x7e6d, 0x80a9, 0x898b, - 0x8b74, 0x9063, 0x9d51, 0x6289, 0x6c7a, 0x6f54, 0x7d50, 0x7f3a, - 0x8a23, 0x517c, 0x614a, 0x7b9d, 0x8b19, 0x9257, 0x938c, 0x4eac, - 0x4fd3, 0x501e, 0x50be, 0x5106, 0x52c1, 0x52cd, 0x537f, 0x5770, - 0x5883, 0x5e9a, 0x5f91, 0x6176, 0x61ac, 0x64ce, 0x656c, 0x666f, - 0x66bb, 0x66f4, 0x6897, 0x6d87, 0x7085, 0x70f1, 0x749f, 0x74a5, - 0x74ca, 0x75d9, 0x786c, 0x78ec, 0x7adf, 0x7af6, 0x7d45, 0x7d93, - 0x8015, 0x803f, 0x811b, 0x8396, 0x8b66, 0x8f15, 0x9015, 0x93e1, - 0x9803, 0x9838, 0x9a5a, 0x9be8, 0x4fc2, 0x5553, 0x583a, 0x5951, - 0x5b63, 0x5c46, 0x60b8, 0x6212, 0x6842, 0x68b0, - /* 0x4d */ - 0x68e8, 0x6eaa, 0x754c, 0x7678, 0x78ce, 0x7a3d, 0x7cfb, 0x7e6b, - 0x7e7c, 0x8a08, 0x8aa1, 0x8c3f, 0x968e, 0x9dc4, 0x53e4, 0x53e9, - 0x544a, 0x5471, 0x56fa, 0x59d1, 0x5b64, 0x5c3b, 0x5eab, 0x62f7, - 0x6537, 0x6545, 0x6572, 0x66a0, 0x67af, 0x69c1, 0x6cbd, 0x75fc, - 0x7690, 0x777e, 0x7a3f, 0x7f94, 0x8003, 0x80a1, 0x818f, 0x82e6, - 0x82fd, 0x83f0, 0x85c1, 0x8831, 0x88b4, 0x8aa5, 0xf903, 0x8f9c, - 0x932e, 0x96c7, 0x9867, 0x9ad8, 0x9f13, 0x54ed, 0x659b, 0x66f2, - 0x688f, 0x7a40, 0x8c37, 0x9d60, 0x56f0, 0x5764, 0x5d11, 0x6606, - 0x68b1, 0x68cd, 0x6efe, 0x7428, 0x889e, 0x9be4, 0x6c68, 0xf904, - 0x9aa8, 0x4f9b, 0x516c, 0x5171, 0x529f, 0x5b54, 0x5de5, 0x6050, - 0x606d, 0x62f1, 0x63a7, 0x653b, 0x73d9, 0x7a7a, 0x86a3, 0x8ca2, - 0x978f, 0x4e32, 0x5be1, 0x6208, 0x679c, 0x74dc, - /* 0x4e */ - 0x79d1, 0x83d3, 0x8a87, 0x8ab2, 0x8de8, 0x904e, 0x934b, 0x9846, - 0x5ed3, 0x69e8, 0x85ff, 0x90ed, 0xf905, 0x51a0, 0x5b98, 0x5bec, - 0x6163, 0x68fa, 0x6b3e, 0x704c, 0x742f, 0x74d8, 0x7ba1, 0x7f50, - 0x83c5, 0x89c0, 0x8cab, 0x95dc, 0x9928, 0x522e, 0x605d, 0x62ec, - 0x9002, 0x4f8a, 0x5149, 0x5321, 0x58d9, 0x5ee3, 0x66e0, 0x6d38, - 0x709a, 0x72c2, 0x73d6, 0x7b50, 0x80f1, 0x945b, 0x5366, 0x639b, - 0x7f6b, 0x4e56, 0x5080, 0x584a, 0x58de, 0x602a, 0x6127, 0x62d0, - 0x69d0, 0x9b41, 0x5b8f, 0x7d18, 0x80b1, 0x8f5f, 0x4ea4, 0x50d1, - 0x54ac, 0x55ac, 0x5b0c, 0x5da0, 0x5de7, 0x652a, 0x654e, 0x6821, - 0x6a4b, 0x72e1, 0x768e, 0x77ef, 0x7d5e, 0x7ff9, 0x81a0, 0x854e, - 0x86df, 0x8f03, 0x8f4e, 0x90ca, 0x9903, 0x9a55, 0x9bab, 0x4e18, - 0x4e45, 0x4e5d, 0x4ec7, 0x4ff1, 0x5177, 0x52fe, - /* 0x4f */ - 0x5340, 0x53e3, 0x53e5, 0x548e, 0x5614, 0x5775, 0x57a2, 0x5bc7, - 0x5d87, 0x5ed0, 0x61fc, 0x62d8, 0x6551, 0x67b8, 0x67e9, 0x69cb, - 0x6b50, 0x6bc6, 0x6bec, 0x6c42, 0x6e9d, 0x7078, 0x72d7, 0x7396, - 0x7403, 0x77bf, 0x77e9, 0x7a76, 0x7d7f, 0x8009, 0x81fc, 0x8205, - 0x820a, 0x82df, 0x8862, 0x8b33, 0x8cfc, 0x8ec0, 0x9011, 0x90b1, - 0x9264, 0x92b6, 0x99d2, 0x9a45, 0x9ce9, 0x9dd7, 0x9f9c, 0x570b, - 0x5c40, 0x83ca, 0x97a0, 0x97ab, 0x9eb4, 0x541b, 0x7a98, 0x7fa4, - 0x88d9, 0x8ecd, 0x90e1, 0x5800, 0x5c48, 0x6398, 0x7a9f, 0x5bae, - 0x5f13, 0x7a79, 0x7aae, 0x828e, 0x8eac, 0x5026, 0x5238, 0x52f8, - 0x5377, 0x5708, 0x62f3, 0x6372, 0x6b0a, 0x6dc3, 0x7737, 0x53a5, - 0x7357, 0x8568, 0x8e76, 0x95d5, 0x673a, 0x6ac3, 0x6f70, 0x8a6d, - 0x8ecc, 0x994b, 0xf906, 0x6677, 0x6b78, 0x8cb4, - /* 0x50 */ - 0x9b3c, 0xf907, 0x53eb, 0x572d, 0x594e, 0x63c6, 0x69fb, 0x73ea, - 0x7845, 0x7aba, 0x7ac5, 0x7cfe, 0x8475, 0x898f, 0x8d73, 0x9035, - 0x95a8, 0x52fb, 0x5747, 0x7547, 0x7b60, 0x83cc, 0x921e, 0xf908, - 0x6a58, 0x514b, 0x524b, 0x5287, 0x621f, 0x68d8, 0x6975, 0x9699, - 0x50c5, 0x52a4, 0x52e4, 0x61c3, 0x65a4, 0x6839, 0x69ff, 0x747e, - 0x7b4b, 0x82b9, 0x83eb, 0x89b2, 0x8b39, 0x8fd1, 0x9949, 0xf909, - 0x4eca, 0x5997, 0x64d2, 0x6611, 0x6a8e, 0x7434, 0x7981, 0x79bd, - 0x82a9, 0x887e, 0x887f, 0x895f, 0xf90a, 0x9326, 0x4f0b, 0x53ca, - 0x6025, 0x6271, 0x6c72, 0x7d1a, 0x7d66, 0x4e98, 0x5162, 0x77dc, - 0x80af, 0x4f01, 0x4f0e, 0x5176, 0x5180, 0x55dc, 0x5668, 0x573b, - 0x57fa, 0x57fc, 0x5914, 0x5947, 0x5993, 0x5bc4, 0x5c90, 0x5d0e, - 0x5df1, 0x5e7e, 0x5fcc, 0x6280, 0x65d7, 0x65e3, - /* 0x51 */ - 0x671e, 0x671f, 0x675e, 0x68cb, 0x68c4, 0x6a5f, 0x6b3a, 0x6c23, - 0x6c7d, 0x6c82, 0x6dc7, 0x7398, 0x7426, 0x742a, 0x7482, 0x74a3, - 0x7578, 0x757f, 0x7881, 0x78ef, 0x7941, 0x7947, 0x7948, 0x797a, - 0x7b95, 0x7d00, 0x7dba, 0x7f88, 0x8006, 0x802d, 0x808c, 0x8a18, - 0x8b4f, 0x8c48, 0x8d77, 0x9321, 0x9324, 0x98e2, 0x9951, 0x9a0e, - 0x9a0f, 0x9a65, 0x9e92, 0x7dca, 0x4f76, 0x5409, 0x62ee, 0x6854, - 0x91d1, 0x55ab, 0x513a, 0xf90b, 0xf90c, 0x5a1c, 0x61e6, 0xf90d, - 0x62cf, 0x62ff, 0xf90e, 0xf90f, 0xf910, 0xf911, 0xf912, 0xf913, - 0x90a3, 0xf914, 0xf915, 0xf916, 0xf917, 0xf918, 0x8afe, 0xf919, - 0xf91a, 0xf91b, 0xf91c, 0x6696, 0xf91d, 0x7156, 0xf91e, 0xf91f, - 0x96e3, 0xf920, 0x634f, 0x637a, 0x5357, 0xf921, 0x678f, 0x6960, - 0x6e73, 0xf922, 0x7537, 0xf923, 0xf924, 0xf925, - /* 0x52 */ - 0x7d0d, 0xf926, 0xf927, 0x8872, 0x56ca, 0x5a18, 0xf928, 0xf929, - 0xf92a, 0xf92b, 0xf92c, 0x4e43, 0xf92d, 0x5167, 0x5948, 0x67f0, - 0x8010, 0xf92e, 0x5973, 0x5e74, 0x649a, 0x79ca, 0x5ff5, 0x606c, - 0x62c8, 0x637b, 0x5be7, 0x5bd7, 0x52aa, 0xf92f, 0x5974, 0x5f29, - 0x6012, 0xf930, 0xf931, 0xf932, 0x7459, 0xf933, 0xf934, 0xf935, - 0xf936, 0xf937, 0xf938, 0x99d1, 0xf939, 0xf93a, 0xf93b, 0xf93c, - 0xf93d, 0xf93e, 0xf93f, 0xf940, 0xf941, 0xf942, 0xf943, 0x6fc3, - 0xf944, 0xf945, 0x81bf, 0x8fb2, 0x60f1, 0xf946, 0xf947, 0x8166, - 0xf948, 0xf949, 0x5c3f, 0xf94a, 0xf94b, 0xf94c, 0xf94d, 0xf94e, - 0xf94f, 0xf950, 0xf951, 0x5ae9, 0x8a25, 0x677b, 0x7d10, 0xf952, - 0xf953, 0xf954, 0xf955, 0xf956, 0xf957, 0x80fd, 0xf958, 0xf959, - 0x5c3c, 0x6ce5, 0x533f, 0x6eba, 0x591a, 0x8336, - /* 0x53 */ - 0x4e39, 0x4eb6, 0x4f46, 0x55ae, 0x5718, 0x58c7, 0x5f56, 0x65b7, - 0x65e6, 0x6a80, 0x6bb5, 0x6e4d, 0x77ed, 0x7aef, 0x7c1e, 0x7dde, - 0x86cb, 0x8892, 0x9132, 0x935b, 0x64bb, 0x6fbe, 0x737a, 0x75b8, - 0x9054, 0x5556, 0x574d, 0x61ba, 0x64d4, 0x66c7, 0x6de1, 0x6e5b, - 0x6f6d, 0x6fb9, 0x75f0, 0x8043, 0x81bd, 0x8541, 0x8983, 0x8ac7, - 0x8b5a, 0x931f, 0x6c93, 0x7553, 0x7b54, 0x8e0f, 0x905d, 0x5510, - 0x5802, 0x5858, 0x5e62, 0x6207, 0x649e, 0x68e0, 0x7576, 0x7cd6, - 0x87b3, 0x9ee8, 0x4ee3, 0x5788, 0x576e, 0x5927, 0x5c0d, 0x5cb1, - 0x5e36, 0x5f85, 0x6234, 0x64e1, 0x73b3, 0x81fa, 0x888b, 0x8cb8, - 0x968a, 0x9edb, 0x5b85, 0x5fb7, 0x60b3, 0x5012, 0x5200, 0x5230, - 0x5716, 0x5835, 0x5857, 0x5c0e, 0x5c60, 0x5cf6, 0x5d8b, 0x5ea6, - 0x5f92, 0x60bc, 0x6311, 0x6389, 0x6417, 0x6843, - /* 0x54 */ - 0x68f9, 0x6ac2, 0x6dd8, 0x6e21, 0x6ed4, 0x6fe4, 0x71fe, 0x76dc, - 0x7779, 0x79b1, 0x7a3b, 0x8404, 0x89a9, 0x8ced, 0x8df3, 0x8e48, - 0x9003, 0x9014, 0x9053, 0x90fd, 0x934d, 0x9676, 0x97dc, 0x6bd2, - 0x7006, 0x7258, 0x72a2, 0x7368, 0x7763, 0x79bf, 0x7be4, 0x7e9b, - 0x8b80, 0x58a9, 0x60c7, 0x6566, 0x65fd, 0x66be, 0x6c8c, 0x711e, - 0x71c9, 0x8c5a, 0x9813, 0x4e6d, 0x7a81, 0x4edd, 0x51ac, 0x51cd, - 0x52d5, 0x540c, 0x61a7, 0x6771, 0x6850, 0x68df, 0x6d1e, 0x6f7c, - 0x75bc, 0x77b3, 0x7ae5, 0x80f4, 0x8463, 0x9285, 0x515c, 0x6597, - 0x675c, 0x6793, 0x75d8, 0x7ac7, 0x8373, 0xf95a, 0x8c46, 0x9017, - 0x982d, 0x5c6f, 0x81c0, 0x829a, 0x9041, 0x906f, 0x920d, 0x5f97, - 0x5d9d, 0x6a59, 0x71c8, 0x767b, 0x7b49, 0x85e4, 0x8b04, 0x9127, - 0x9a30, 0x5587, 0x61f6, 0xf95b, 0x7669, 0x7f85, - /* 0x55 */ - 0x863f, 0x87ba, 0x88f8, 0x908f, 0xf95c, 0x6d1b, 0x70d9, 0x73de, - 0x7d61, 0x843d, 0xf95d, 0x916a, 0x99f1, 0xf95e, 0x4e82, 0x5375, - 0x6b04, 0x6b12, 0x703e, 0x721b, 0x862d, 0x9e1e, 0x524c, 0x8fa3, - 0x5d50, 0x64e5, 0x652c, 0x6b16, 0x6feb, 0x7c43, 0x7e9c, 0x85cd, - 0x8964, 0x89bd, 0x62c9, 0x81d8, 0x881f, 0x5eca, 0x6717, 0x6d6a, - 0x72fc, 0x7405, 0x746f, 0x8782, 0x90de, 0x4f86, 0x5d0d, 0x5fa0, - 0x840a, 0x51b7, 0x63a0, 0x7565, 0x4eae, 0x5006, 0x5169, 0x51c9, - 0x6881, 0x6a11, 0x7cae, 0x7cb1, 0x7ce7, 0x826f, 0x8ad2, 0x8f1b, - 0x91cf, 0x4fb6, 0x5137, 0x52f5, 0x5442, 0x5eec, 0x616e, 0x623e, - 0x65c5, 0x6ada, 0x6ffe, 0x792a, 0x85dc, 0x8823, 0x95ad, 0x9a62, - 0x9a6a, 0x9e97, 0x9ece, 0x529b, 0x66c6, 0x6b77, 0x701d, 0x792b, - 0x8f62, 0x9742, 0x6190, 0x6200, 0x6523, 0x6f23, - /* 0x56 */ - 0x7149, 0x7489, 0x7df4, 0x806f, 0x84ee, 0x8f26, 0x9023, 0x934a, - 0x51bd, 0x5217, 0x52a3, 0x6d0c, 0x70c8, 0x88c2, 0x5ec9, 0x6582, - 0x6bae, 0x6fc2, 0x7c3e, 0x7375, 0x4ee4, 0x4f36, 0x56f9, 0xf95f, - 0x5cba, 0x5dba, 0x601c, 0x73b2, 0x7b2d, 0x7f9a, 0x7fce, 0x8046, - 0x901e, 0x9234, 0x96f6, 0x9748, 0x9818, 0x9f61, 0x4f8b, 0x6fa7, - 0x79ae, 0x91b4, 0x96b7, 0x52de, 0xf960, 0x6488, 0x64c4, 0x6ad3, - 0x6f5e, 0x7018, 0x7210, 0x76e7, 0x8001, 0x8606, 0x865c, 0x8def, - 0x8f05, 0x9732, 0x9b6f, 0x9dfa, 0x9e75, 0x788c, 0x797f, 0x7da0, - 0x83c9, 0x9304, 0x9e7f, 0x9e93, 0x8ad6, 0x58df, 0x5f04, 0x6727, - 0x7027, 0x74cf, 0x7c60, 0x807e, 0x5121, 0x7028, 0x7262, 0x78ca, - 0x8cc2, 0x8cda, 0x8cf4, 0x96f7, 0x4e86, 0x50da, 0x5bee, 0x5ed6, - 0x6599, 0x71ce, 0x7642, 0x77ad, 0x804a, 0x84fc, - /* 0x57 */ - 0x907c, 0x9b27, 0x9f8d, 0x58d8, 0x5a41, 0x5c62, 0x6a13, 0x6dda, - 0x6f0f, 0x763b, 0x7d2f, 0x7e37, 0x851e, 0x8938, 0x93e4, 0x964b, - 0x5289, 0x65d2, 0x67f3, 0x69b4, 0x6d41, 0x6e9c, 0x700f, 0x7409, - 0x7460, 0x7559, 0x7624, 0x786b, 0x8b2c, 0x985e, 0x516d, 0x622e, - 0x9678, 0x4f96, 0x502b, 0x5d19, 0x6dea, 0x7db8, 0x8f2a, 0x5f8b, - 0x6144, 0x6817, 0xf961, 0x9686, 0x52d2, 0x808b, 0x51dc, 0x51cc, - 0x695e, 0x7a1c, 0x7dbe, 0x83f1, 0x9675, 0x4fda, 0x5229, 0x5398, - 0x540f, 0x550e, 0x5c65, 0x60a7, 0x674e, 0x68a8, 0x6d6c, 0x7281, - 0x72f8, 0x7406, 0x7483, 0xf962, 0x75e2, 0x7c6c, 0x7f79, 0x7fb8, - 0x8389, 0x88cf, 0x88e1, 0x91cc, 0x91d0, 0x96e2, 0x9bc9, 0x541d, - 0x6f7e, 0x71d0, 0x7498, 0x85fa, 0x8eaa, 0x96a3, 0x9c57, 0x9e9f, - 0x6797, 0x6dcb, 0x7433, 0x81e8, 0x9716, 0x782c, - /* 0x58 */ - 0x7acb, 0x7b20, 0x7c92, 0x6469, 0x746a, 0x75f2, 0x78bc, 0x78e8, - 0x99ac, 0x9b54, 0x9ebb, 0x5bde, 0x5e55, 0x6f20, 0x819c, 0x83ab, - 0x9088, 0x4e07, 0x534d, 0x5a29, 0x5dd2, 0x5f4e, 0x6162, 0x633d, - 0x6669, 0x66fc, 0x6eff, 0x6f2b, 0x7063, 0x779e, 0x842c, 0x8513, - 0x883b, 0x8f13, 0x9945, 0x9c3b, 0x551c, 0x62b9, 0x672b, 0x6cab, - 0x8309, 0x896a, 0x977a, 0x4ea1, 0x5984, 0x5fd8, 0x5fd9, 0x671b, - 0x7db2, 0x7f54, 0x8292, 0x832b, 0x83bd, 0x8f1e, 0x9099, 0x57cb, - 0x59b9, 0x5a92, 0x5bd0, 0x6627, 0x679a, 0x6885, 0x6bcf, 0x7164, - 0x7f75, 0x8cb7, 0x8ce3, 0x9081, 0x9b45, 0x8108, 0x8c8a, 0x964c, - 0x9a40, 0x9ea5, 0x5b5f, 0x6c13, 0x731b, 0x76f2, 0x76df, 0x840c, - 0x51aa, 0x8993, 0x514d, 0x5195, 0x52c9, 0x68c9, 0x6c94, 0x7704, - 0x7720, 0x7dbf, 0x7dec, 0x9762, 0x9eb5, 0x6ec5, - /* 0x59 */ - 0x8511, 0x51a5, 0x540d, 0x547d, 0x660e, 0x669d, 0x6927, 0x6e9f, - 0x76bf, 0x7791, 0x8317, 0x84c2, 0x879f, 0x9169, 0x9298, 0x9cf4, - 0x8882, 0x4fae, 0x5192, 0x52df, 0x59c6, 0x5e3d, 0x6155, 0x6478, - 0x6479, 0x66ae, 0x67d0, 0x6a21, 0x6bcd, 0x6bdb, 0x725f, 0x7261, - 0x7441, 0x7738, 0x77db, 0x8017, 0x82bc, 0x8305, 0x8b00, 0x8b28, - 0x8c8c, 0x6728, 0x6c90, 0x7267, 0x76ee, 0x7766, 0x7a46, 0x9da9, - 0x6b7f, 0x6c92, 0x5922, 0x6726, 0x8499, 0x536f, 0x5893, 0x5999, - 0x5edf, 0x63cf, 0x6634, 0x6773, 0x6e3a, 0x732b, 0x7ad7, 0x82d7, - 0x9328, 0x52d9, 0x5deb, 0x61ae, 0x61cb, 0x620a, 0x62c7, 0x64ab, - 0x65e0, 0x6959, 0x6b66, 0x6bcb, 0x7121, 0x73f7, 0x755d, 0x7e46, - 0x821e, 0x8302, 0x856a, 0x8aa3, 0x8cbf, 0x9727, 0x9d61, 0x58a8, - 0x9ed8, 0x5011, 0x520e, 0x543b, 0x554f, 0x6587, - /* 0x5a */ - 0x6c76, 0x7d0a, 0x7d0b, 0x805e, 0x868a, 0x9580, 0x96ef, 0x52ff, - 0x6c95, 0x7269, 0x5473, 0x5a9a, 0x5c3e, 0x5d4b, 0x5f4c, 0x5fae, - 0x672a, 0x68b6, 0x6963, 0x6e3c, 0x6e44, 0x7709, 0x7c73, 0x7f8e, - 0x8587, 0x8b0e, 0x8ff7, 0x9761, 0x9ef4, 0x5cb7, 0x60b6, 0x610d, - 0x61ab, 0x654f, 0x65fb, 0x65fc, 0x6c11, 0x6cef, 0x739f, 0x73c9, - 0x7de1, 0x9594, 0x5bc6, 0x871c, 0x8b10, 0x525d, 0x535a, 0x62cd, - 0x640f, 0x64b2, 0x6734, 0x6a38, 0x6cca, 0x73c0, 0x749e, 0x7b94, - 0x7c95, 0x7e1b, 0x818a, 0x8236, 0x8584, 0x8feb, 0x96f9, 0x99c1, - 0x4f34, 0x534a, 0x53cd, 0x53db, 0x62cc, 0x642c, 0x6500, 0x6591, - 0x69c3, 0x6cee, 0x6f58, 0x73ed, 0x7554, 0x7622, 0x76e4, 0x76fc, - 0x78d0, 0x78fb, 0x792c, 0x7d46, 0x822c, 0x87e0, 0x8fd4, 0x9812, - 0x98ef, 0x52c3, 0x62d4, 0x64a5, 0x6e24, 0x6f51, - /* 0x5b */ - 0x767c, 0x8dcb, 0x91b1, 0x9262, 0x9aee, 0x9b43, 0x5023, 0x508d, - 0x574a, 0x59a8, 0x5c28, 0x5e47, 0x5f77, 0x623f, 0x653e, 0x65b9, - 0x65c1, 0x6609, 0x678b, 0x699c, 0x6ec2, 0x78c5, 0x7d21, 0x80aa, - 0x8180, 0x822b, 0x82b3, 0x84a1, 0x868c, 0x8a2a, 0x8b17, 0x90a6, - 0x9632, 0x9f90, 0x500d, 0x4ff3, 0xf963, 0x57f9, 0x5f98, 0x62dc, - 0x6392, 0x676f, 0x6e43, 0x7119, 0x76c3, 0x80cc, 0x80da, 0x88f4, - 0x88f5, 0x8919, 0x8ce0, 0x8f29, 0x914d, 0x966a, 0x4f2f, 0x4f70, - 0x5e1b, 0x67cf, 0x6822, 0x767d, 0x767e, 0x9b44, 0x5e61, 0x6a0a, - 0x7169, 0x71d4, 0x756a, 0xf964, 0x7e41, 0x8543, 0x85e9, 0x98dc, - 0x4f10, 0x7b4f, 0x7f70, 0x95a5, 0x51e1, 0x5e06, 0x68b5, 0x6c3e, - 0x6c4e, 0x6cdb, 0x72af, 0x7bc4, 0x8303, 0x6cd5, 0x743a, 0x50fb, - 0x5288, 0x58c1, 0x64d8, 0x6a97, 0x74a7, 0x7656, - /* 0x5c */ - 0x78a7, 0x8617, 0x95e2, 0x9739, 0xf965, 0x535e, 0x5f01, 0x8b8a, - 0x8fa8, 0x8faf, 0x908a, 0x5225, 0x77a5, 0x9c49, 0x9f08, 0x4e19, - 0x5002, 0x5175, 0x5c5b, 0x5e77, 0x661e, 0x663a, 0x67c4, 0x68c5, - 0x70b3, 0x7501, 0x75c5, 0x79c9, 0x7add, 0x8f27, 0x9920, 0x9a08, - 0x4fdd, 0x5821, 0x5831, 0x5bf6, 0x666e, 0x6b65, 0x6d11, 0x6e7a, - 0x6f7d, 0x73e4, 0x752b, 0x83e9, 0x88dc, 0x8913, 0x8b5c, 0x8f14, - 0x4f0f, 0x50d5, 0x5310, 0x535c, 0x5b93, 0x5fa9, 0x670d, 0x798f, - 0x8179, 0x832f, 0x8514, 0x8907, 0x8986, 0x8f39, 0x8f3b, 0x99a5, - 0x9c12, 0x672c, 0x4e76, 0x4ff8, 0x5949, 0x5c01, 0x5cef, 0x5cf0, - 0x6367, 0x68d2, 0x70fd, 0x71a2, 0x742b, 0x7e2b, 0x84ec, 0x8702, - 0x9022, 0x92d2, 0x9cf3, 0x4e0d, 0x4ed8, 0x4fef, 0x5085, 0x5256, - 0x526f, 0x5426, 0x5490, 0x57e0, 0x592b, 0x5a66, - /* 0x5d */ - 0x5b5a, 0x5b75, 0x5bcc, 0x5e9c, 0xf966, 0x6276, 0x6577, 0x65a7, - 0x6d6e, 0x6ea5, 0x7236, 0x7b26, 0x7c3f, 0x7f36, 0x8150, 0x8151, - 0x819a, 0x8240, 0x8299, 0x83a9, 0x8a03, 0x8ca0, 0x8ce6, 0x8cfb, - 0x8d74, 0x8dba, 0x90e8, 0x91dc, 0x961c, 0x9644, 0x99d9, 0x9ce7, - 0x5317, 0x5206, 0x5429, 0x5674, 0x58b3, 0x5954, 0x596e, 0x5fff, - 0x61a4, 0x626e, 0x6610, 0x6c7e, 0x711a, 0x76c6, 0x7c89, 0x7cde, - 0x7d1b, 0x82ac, 0x8cc1, 0x96f0, 0xf967, 0x4f5b, 0x5f17, 0x5f7f, - 0x62c2, 0x5d29, 0x670b, 0x68da, 0x787c, 0x7e43, 0x9d6c, 0x4e15, - 0x5099, 0x5315, 0x532a, 0x5351, 0x5983, 0x5a62, 0x5e87, 0x60b2, - 0x618a, 0x6249, 0x6279, 0x6590, 0x6787, 0x69a7, 0x6bd4, 0x6bd6, - 0x6bd7, 0x6bd8, 0x6cb8, 0xf968, 0x7435, 0x75fa, 0x7812, 0x7891, - 0x79d5, 0x79d8, 0x7c83, 0x7dcb, 0x7fe1, 0x80a5, - /* 0x5e */ - 0x813e, 0x81c2, 0x83f2, 0x871a, 0x88e8, 0x8ab9, 0x8b6c, 0x8cbb, - 0x9119, 0x975e, 0x98db, 0x9f3b, 0x56ac, 0x5b2a, 0x5f6c, 0x658c, - 0x6ab3, 0x6baf, 0x6d5c, 0x6ff1, 0x7015, 0x725d, 0x73ad, 0x8ca7, - 0x8cd3, 0x983b, 0x6191, 0x6c37, 0x8058, 0x9a01, 0x4e4d, 0x4e8b, - 0x4e9b, 0x4ed5, 0x4f3a, 0x4f3c, 0x4f7f, 0x4fdf, 0x50ff, 0x53f2, - 0x53f8, 0x5506, 0x55e3, 0x56db, 0x58eb, 0x5962, 0x5a11, 0x5beb, - 0x5bfa, 0x5c04, 0x5df3, 0x5e2b, 0x5f99, 0x601d, 0x6368, 0x659c, - 0x65af, 0x67f6, 0x67fb, 0x68ad, 0x6b7b, 0x6c99, 0x6cd7, 0x6e23, - 0x7009, 0x7345, 0x7802, 0x793e, 0x7940, 0x7960, 0x79c1, 0x7be9, - 0x7d17, 0x7d72, 0x8086, 0x820d, 0x838e, 0x84d1, 0x86c7, 0x88df, - 0x8a50, 0x8a5e, 0x8b1d, 0x8cdc, 0x8d66, 0x8fad, 0x90aa, 0x98fc, - 0x99df, 0x9e9d, 0x524a, 0xf969, 0x6714, 0xf96a, - /* 0x5f */ - 0x5098, 0x522a, 0x5c71, 0x6563, 0x6c55, 0x73ca, 0x7523, 0x759d, - 0x7b97, 0x849c, 0x9178, 0x9730, 0x4e77, 0x6492, 0x6bba, 0x715e, - 0x85a9, 0x4e09, 0xf96b, 0x6749, 0x68ee, 0x6e17, 0x829f, 0x8518, - 0x886b, 0x63f7, 0x6f81, 0x9212, 0x98af, 0x4e0a, 0x50b7, 0x50cf, - 0x511f, 0x5546, 0x55aa, 0x5617, 0x5b40, 0x5c19, 0x5ce0, 0x5e38, - 0x5e8a, 0x5ea0, 0x5ec2, 0x60f3, 0x6851, 0x6a61, 0x6e58, 0x723d, - 0x7240, 0x72c0, 0x76f8, 0x7965, 0x7bb1, 0x7fd4, 0x88f3, 0x89f4, - 0x8a73, 0x8c61, 0x8cde, 0x971c, 0x585e, 0x74bd, 0x8cfd, 0x55c7, - 0xf96c, 0x7a61, 0x7d22, 0x8272, 0x7272, 0x751f, 0x7525, 0xf96d, - 0x7b19, 0x5885, 0x58fb, 0x5dbc, 0x5e8f, 0x5eb6, 0x5f90, 0x6055, - 0x6292, 0x637f, 0x654d, 0x6691, 0x66d9, 0x66f8, 0x6816, 0x68f2, - 0x7280, 0x745e, 0x7b6e, 0x7d6e, 0x7dd6, 0x7f72, - /* 0x60 */ - 0x80e5, 0x8212, 0x85af, 0x897f, 0x8a93, 0x901d, 0x92e4, 0x9ecd, - 0x9f20, 0x5915, 0x596d, 0x5e2d, 0x60dc, 0x6614, 0x6673, 0x6790, - 0x6c50, 0x6dc5, 0x6f5f, 0x77f3, 0x78a9, 0x84c6, 0x91cb, 0x932b, - 0x4ed9, 0x50ca, 0x5148, 0x5584, 0x5b0b, 0x5ba3, 0x6247, 0x657e, - 0x65cb, 0x6e32, 0x717d, 0x7401, 0x7444, 0x7487, 0x74bf, 0x766c, - 0x79aa, 0x7dda, 0x7e55, 0x7fa8, 0x817a, 0x81b3, 0x8239, 0x861a, - 0x87ec, 0x8a75, 0x8de3, 0x9078, 0x9291, 0x9425, 0x994d, 0x9bae, - 0x5368, 0x5c51, 0x6954, 0x6cc4, 0x6d29, 0x6e2b, 0x820c, 0x859b, - 0x893b, 0x8a2d, 0x8aaa, 0x96ea, 0x9f67, 0x5261, 0x66b9, 0x6bb2, - 0x7e96, 0x87fe, 0x8d0d, 0x9583, 0x965d, 0x651d, 0x6d89, 0x71ee, - 0xf96e, 0x57ce, 0x59d3, 0x5bac, 0x6027, 0x60fa, 0x6210, 0x661f, - 0x665f, 0x7329, 0x73f9, 0x76db, 0x7701, 0x7b6c, - /* 0x61 */ - 0x8056, 0x8072, 0x8165, 0x8aa0, 0x9192, 0x4e16, 0x52e2, 0x6b72, - 0x6d17, 0x7a05, 0x7b39, 0x7d30, 0xf96f, 0x8cb0, 0x53ec, 0x562f, - 0x5851, 0x5bb5, 0x5c0f, 0x5c11, 0x5de2, 0x6240, 0x6383, 0x6414, - 0x662d, 0x68b3, 0x6cbc, 0x6d88, 0x6eaf, 0x701f, 0x70a4, 0x71d2, - 0x7526, 0x758f, 0x758e, 0x7619, 0x7b11, 0x7be0, 0x7c2b, 0x7d20, - 0x7d39, 0x852c, 0x856d, 0x8607, 0x8a34, 0x900d, 0x9061, 0x90b5, - 0x92b7, 0x97f6, 0x9a37, 0x4fd7, 0x5c6c, 0x675f, 0x6d91, 0x7c9f, - 0x7e8c, 0x8b16, 0x8d16, 0x901f, 0x5b6b, 0x5dfd, 0x640d, 0x84c0, - 0x905c, 0x98e1, 0x7387, 0x5b8b, 0x609a, 0x677e, 0x6dde, 0x8a1f, - 0x8aa6, 0x9001, 0x980c, 0x5237, 0xf970, 0x7051, 0x788e, 0x9396, - 0x8870, 0x91d7, 0x4fee, 0x53d7, 0x55fd, 0x56da, 0x5782, 0x58fd, - 0x5ac2, 0x5b88, 0x5cab, 0x5cc0, 0x5e25, 0x6101, - /* 0x62 */ - 0x620d, 0x624b, 0x6388, 0x641c, 0x6536, 0x6578, 0x6a39, 0x6b8a, - 0x6c34, 0x6d19, 0x6f31, 0x71e7, 0x72e9, 0x7378, 0x7407, 0x74b2, - 0x7626, 0x7761, 0x79c0, 0x7a57, 0x7aea, 0x7cb9, 0x7d8f, 0x7dac, - 0x7e61, 0x7f9e, 0x8129, 0x8331, 0x8490, 0x84da, 0x85ea, 0x8896, - 0x8ab0, 0x8b90, 0x8f38, 0x9042, 0x9083, 0x916c, 0x9296, 0x92b9, - 0x968b, 0x96a7, 0x96a8, 0x96d6, 0x9700, 0x9808, 0x9996, 0x9ad3, - 0x9b1a, 0x53d4, 0x587e, 0x5919, 0x5b70, 0x5bbf, 0x6dd1, 0x6f5a, - 0x719f, 0x7421, 0x74b9, 0x8085, 0x83fd, 0x5de1, 0x5f87, 0x5faa, - 0x6042, 0x65ec, 0x6812, 0x696f, 0x6a53, 0x6b89, 0x6d35, 0x6df3, - 0x73e3, 0x76fe, 0x77ac, 0x7b4d, 0x7d14, 0x8123, 0x821c, 0x8340, - 0x84f4, 0x8563, 0x8a62, 0x8ac4, 0x9187, 0x931e, 0x9806, 0x99b4, - 0x620c, 0x8853, 0x8ff0, 0x9265, 0x5d07, 0x5d27, - /* 0x63 */ - 0x5d69, 0x745f, 0x819d, 0x8768, 0x6fd5, 0x62fe, 0x7fd2, 0x8936, - 0x8972, 0x4e1e, 0x4e58, 0x50e7, 0x52dd, 0x5347, 0x627f, 0x6607, - 0x7e69, 0x8805, 0x965e, 0x4f8d, 0x5319, 0x5636, 0x59cb, 0x5aa4, - 0x5c38, 0x5c4e, 0x5c4d, 0x5e02, 0x5f11, 0x6043, 0x65bd, 0x662f, - 0x6642, 0x67be, 0x67f4, 0x731c, 0x77e2, 0x793a, 0x7fc5, 0x8494, - 0x84cd, 0x8996, 0x8a66, 0x8a69, 0x8ae1, 0x8c55, 0x8c7a, 0x57f4, - 0x5bd4, 0x5f0f, 0x606f, 0x62ed, 0x690d, 0x6b96, 0x6e5c, 0x7184, - 0x7bd2, 0x8755, 0x8b58, 0x8efe, 0x98df, 0x98fe, 0x4f38, 0x4f81, - 0x4fe1, 0x547b, 0x5a20, 0x5bb8, 0x613c, 0x65b0, 0x6668, 0x71fc, - 0x7533, 0x795e, 0x7d33, 0x814e, 0x81e3, 0x8398, 0x85aa, 0x85ce, - 0x8703, 0x8a0a, 0x8eab, 0x8f9b, 0xf971, 0x8fc5, 0x5931, 0x5ba4, - 0x5be6, 0x6089, 0x5be9, 0x5c0b, 0x5fc3, 0x6c81, - /* 0x64 */ - 0xf972, 0x6df1, 0x700b, 0x751a, 0x82af, 0x8af6, 0x4ec0, 0x5341, - 0xf973, 0x96d9, 0x6c0f, 0x4e9e, 0x4fc4, 0x5152, 0x555e, 0x5a25, - 0x5ce8, 0x6211, 0x7259, 0x82bd, 0x83aa, 0x86fe, 0x8859, 0x8a1d, - 0x963f, 0x96c5, 0x9913, 0x9d09, 0x9d5d, 0x580a, 0x5cb3, 0x5dbd, - 0x5e44, 0x60e1, 0x6115, 0x63e1, 0x6a02, 0x6e25, 0x9102, 0x9354, - 0x984e, 0x9c10, 0x9f77, 0x5b89, 0x5cb8, 0x6309, 0x664f, 0x6848, - 0x773c, 0x96c1, 0x978d, 0x9854, 0x9b9f, 0x65a1, 0x8b01, 0x8ecb, - 0x95bc, 0x5535, 0x5ca9, 0x5dd6, 0x5eb5, 0x6697, 0x764c, 0x83f4, - 0x95c7, 0x58d3, 0x62bc, 0x72ce, 0x9d28, 0x4ef0, 0x592e, 0x600f, - 0x663b, 0x6b83, 0x79e7, 0x9d26, 0x5393, 0x54c0, 0x57c3, 0x5d16, - 0x611b, 0x66d6, 0x6daf, 0x788d, 0x827e, 0x9698, 0x9744, 0x5384, - 0x627c, 0x6396, 0x6db2, 0x7e0a, 0x814b, 0x984d, - /* 0x65 */ - 0x6afb, 0x7f4c, 0x9daf, 0x9e1a, 0x4e5f, 0x503b, 0x51b6, 0x591c, - 0x60f9, 0x63f6, 0x6930, 0x723a, 0x8036, 0xf974, 0x91ce, 0x5f31, - 0xf975, 0xf976, 0x7d04, 0x82e5, 0x846f, 0x84bb, 0x85e5, 0x8e8d, - 0xf977, 0x4f6f, 0xf978, 0xf979, 0x58e4, 0x5b43, 0x6059, 0x63da, - 0x6518, 0x656d, 0x6698, 0xf97a, 0x694a, 0x6a23, 0x6d0b, 0x7001, - 0x716c, 0x75d2, 0x760d, 0x79b3, 0x7a70, 0xf97b, 0x7f8a, 0xf97c, - 0x8944, 0xf97d, 0x8b93, 0x91c0, 0x967d, 0xf97e, 0x990a, 0x5704, - 0x5fa1, 0x65bc, 0x6f01, 0x7600, 0x79a6, 0x8a9e, 0x99ad, 0x9b5a, - 0x9f6c, 0x5104, 0x61b6, 0x6291, 0x6a8d, 0x81c6, 0x5043, 0x5830, - 0x5f66, 0x7109, 0x8a00, 0x8afa, 0x5b7c, 0x8616, 0x4ffa, 0x513c, - 0x56b4, 0x5944, 0x63a9, 0x6df9, 0x5daa, 0x696d, 0x5186, 0x4e88, - 0x4f59, 0xf97f, 0xf980, 0xf981, 0x5982, 0xf982, - /* 0x66 */ - 0xf983, 0x6b5f, 0x6c5d, 0xf984, 0x74b5, 0x7916, 0xf985, 0x8207, - 0x8245, 0x8339, 0x8f3f, 0x8f5d, 0xf986, 0x9918, 0xf987, 0xf988, - 0xf989, 0x4ea6, 0xf98a, 0x57df, 0x5f79, 0x6613, 0xf98b, 0xf98c, - 0x75ab, 0x7e79, 0x8b6f, 0xf98d, 0x9006, 0x9a5b, 0x56a5, 0x5827, - 0x59f8, 0x5a1f, 0x5bb4, 0xf98e, 0x5ef6, 0xf98f, 0xf990, 0x6350, - 0x633b, 0xf991, 0x693d, 0x6c87, 0x6cbf, 0x6d8e, 0x6d93, 0x6df5, - 0x6f14, 0xf992, 0x70df, 0x7136, 0x7159, 0xf993, 0x71c3, 0x71d5, - 0xf994, 0x784f, 0x786f, 0xf995, 0x7b75, 0x7de3, 0xf996, 0x7e2f, - 0xf997, 0x884d, 0x8edf, 0xf998, 0xf999, 0xf99a, 0x925b, 0xf99b, - 0x9cf6, 0xf99c, 0xf99d, 0xf99e, 0x6085, 0x6d85, 0xf99f, 0x71b1, - 0xf9a0, 0xf9a1, 0x95b1, 0x53ad, 0xf9a2, 0xf9a3, 0xf9a4, 0x67d3, - 0xf9a5, 0x708e, 0x7130, 0x7430, 0x8276, 0x82d2, - /* 0x67 */ - 0xf9a6, 0x95bb, 0x9ae5, 0x9e7d, 0x66c4, 0xf9a7, 0x71c1, 0x8449, - 0xf9a8, 0xf9a9, 0x584b, 0xf9aa, 0xf9ab, 0x5db8, 0x5f71, 0xf9ac, - 0x6620, 0x668e, 0x6979, 0x69ae, 0x6c38, 0x6cf3, 0x6e36, 0x6f41, - 0x6fda, 0x701b, 0x702f, 0x7150, 0x71df, 0x7370, 0xf9ad, 0x745b, - 0xf9ae, 0x74d4, 0x76c8, 0x7a4e, 0x7e93, 0xf9af, 0xf9b0, 0x82f1, - 0x8a60, 0x8fce, 0xf9b1, 0x9348, 0xf9b2, 0x9719, 0xf9b3, 0xf9b4, - 0x4e42, 0x502a, 0xf9b5, 0x5208, 0x53e1, 0x66f3, 0x6c6d, 0x6fca, - 0x730a, 0x777f, 0x7a62, 0x82ae, 0x85dd, 0x8602, 0xf9b6, 0x88d4, - 0x8a63, 0x8b7d, 0x8c6b, 0xf9b7, 0x92b3, 0xf9b8, 0x9713, 0x9810, - 0x4e94, 0x4f0d, 0x4fc9, 0x50b2, 0x5348, 0x543e, 0x5433, 0x55da, - 0x5862, 0x58ba, 0x5967, 0x5a1b, 0x5be4, 0x609f, 0xf9b9, 0x61ca, - 0x6556, 0x65ff, 0x6664, 0x68a7, 0x6c5a, 0x6fb3, - /* 0x68 */ - 0x70cf, 0x71ac, 0x7352, 0x7b7d, 0x8708, 0x8aa4, 0x9c32, 0x9f07, - 0x5c4b, 0x6c83, 0x7344, 0x7389, 0x923a, 0x6eab, 0x7465, 0x761f, - 0x7a69, 0x7e15, 0x860a, 0x5140, 0x58c5, 0x64c1, 0x74ee, 0x7515, - 0x7670, 0x7fc1, 0x9095, 0x96cd, 0x9954, 0x6e26, 0x74e6, 0x7aa9, - 0x7aaa, 0x81e5, 0x86d9, 0x8778, 0x8a1b, 0x5a49, 0x5b8c, 0x5b9b, - 0x68a1, 0x6900, 0x6d63, 0x73a9, 0x7413, 0x742c, 0x7897, 0x7de9, - 0x7feb, 0x8118, 0x8155, 0x839e, 0x8c4c, 0x962e, 0x9811, 0x66f0, - 0x5f80, 0x65fa, 0x6789, 0x6c6a, 0x738b, 0x502d, 0x5a03, 0x6b6a, - 0x77ee, 0x5916, 0x5d6c, 0x5dcd, 0x7325, 0x754f, 0xf9ba, 0xf9bb, - 0x50e5, 0x51f9, 0x582f, 0x592d, 0x5996, 0x59da, 0x5be5, 0xf9bc, - 0xf9bd, 0x5da2, 0x62d7, 0x6416, 0x6493, 0x64fe, 0xf9be, 0x66dc, - 0xf9bf, 0x6a48, 0xf9c0, 0x71ff, 0x7464, 0xf9c1, - /* 0x69 */ - 0x7a88, 0x7aaf, 0x7e47, 0x7e5e, 0x8000, 0x8170, 0xf9c2, 0x87ef, - 0x8981, 0x8b20, 0x9059, 0xf9c3, 0x9080, 0x9952, 0x617e, 0x6b32, - 0x6d74, 0x7e1f, 0x8925, 0x8fb1, 0x4fd1, 0x50ad, 0x5197, 0x52c7, - 0x57c7, 0x5889, 0x5bb9, 0x5eb8, 0x6142, 0x6995, 0x6d8c, 0x6e67, - 0x6eb6, 0x7194, 0x7462, 0x7528, 0x752c, 0x8073, 0x8338, 0x84c9, - 0x8e0a, 0x9394, 0x93de, 0xf9c4, 0x4e8e, 0x4f51, 0x5076, 0x512a, - 0x53c8, 0x53cb, 0x53f3, 0x5b87, 0x5bd3, 0x5c24, 0x611a, 0x6182, - 0x65f4, 0x725b, 0x7397, 0x7440, 0x76c2, 0x7950, 0x7991, 0x79b9, - 0x7d06, 0x7fbd, 0x828b, 0x85d5, 0x865e, 0x8fc2, 0x9047, 0x90f5, - 0x91ea, 0x9685, 0x96e8, 0x96e9, 0x52d6, 0x5f67, 0x65ed, 0x6631, - 0x682f, 0x715c, 0x7a36, 0x90c1, 0x980a, 0x4e91, 0xf9c5, 0x6a52, - 0x6b9e, 0x6f90, 0x7189, 0x8018, 0x82b8, 0x8553, - /* 0x6a */ - 0x904b, 0x9695, 0x96f2, 0x97fb, 0x851a, 0x9b31, 0x4e90, 0x718a, - 0x96c4, 0x5143, 0x539f, 0x54e1, 0x5713, 0x5712, 0x57a3, 0x5a9b, - 0x5ac4, 0x5bc3, 0x6028, 0x613f, 0x63f4, 0x6c85, 0x6d39, 0x6e72, - 0x6e90, 0x7230, 0x733f, 0x7457, 0x82d1, 0x8881, 0x8f45, 0x9060, - 0xf9c6, 0x9662, 0x9858, 0x9d1b, 0x6708, 0x8d8a, 0x925e, 0x4f4d, - 0x5049, 0x50de, 0x5371, 0x570d, 0x59d4, 0x5a01, 0x5c09, 0x6170, - 0x6690, 0x6e2d, 0x7232, 0x744b, 0x7def, 0x80c3, 0x840e, 0x8466, - 0x853f, 0x875f, 0x885b, 0x8918, 0x8b02, 0x9055, 0x97cb, 0x9b4f, - 0x4e73, 0x4f91, 0x5112, 0x516a, 0xf9c7, 0x552f, 0x55a9, 0x5b7a, - 0x5ba5, 0x5e7c, 0x5e7d, 0x5ebe, 0x60a0, 0x60df, 0x6108, 0x6109, - 0x63c4, 0x6538, 0x6709, 0xf9c8, 0x67d4, 0x67da, 0xf9c9, 0x6961, - 0x6962, 0x6cb9, 0x6d27, 0xf9ca, 0x6e38, 0xf9cb, - /* 0x6b */ - 0x6fe1, 0x7336, 0x7337, 0xf9cc, 0x745c, 0x7531, 0xf9cd, 0x7652, - 0xf9ce, 0xf9cf, 0x7dad, 0x81fe, 0x8438, 0x88d5, 0x8a98, 0x8adb, - 0x8aed, 0x8e30, 0x8e42, 0x904a, 0x903e, 0x907a, 0x9149, 0x91c9, - 0x936e, 0xf9d0, 0xf9d1, 0x5809, 0xf9d2, 0x6bd3, 0x8089, 0x80b2, - 0xf9d3, 0xf9d4, 0x5141, 0x596b, 0x5c39, 0xf9d5, 0xf9d6, 0x6f64, - 0x73a7, 0x80e4, 0x8d07, 0xf9d7, 0x9217, 0x958f, 0xf9d8, 0xf9d9, - 0xf9da, 0xf9db, 0x807f, 0x620e, 0x701c, 0x7d68, 0x878d, 0xf9dc, - 0x57a0, 0x6069, 0x6147, 0x6bb7, 0x8abe, 0x9280, 0x96b1, 0x4e59, - 0x541f, 0x6deb, 0x852d, 0x9670, 0x97f3, 0x98ee, 0x63d6, 0x6ce3, - 0x9091, 0x51dd, 0x61c9, 0x81ba, 0x9df9, 0x4f9d, 0x501a, 0x5100, - 0x5b9c, 0x610f, 0x61ff, 0x64ec, 0x6905, 0x6bc5, 0x7591, 0x77e3, - 0x7fa9, 0x8264, 0x858f, 0x87fb, 0x8863, 0x8abc, - /* 0x6c */ - 0x8b70, 0x91ab, 0x4e8c, 0x4ee5, 0x4f0a, 0xf9dd, 0xf9de, 0x5937, - 0x59e8, 0xf9df, 0x5df2, 0x5f1b, 0x5f5b, 0x6021, 0xf9e0, 0xf9e1, - 0xf9e2, 0xf9e3, 0x723e, 0x73e5, 0xf9e4, 0x7570, 0x75cd, 0xf9e5, - 0x79fb, 0xf9e6, 0x800c, 0x8033, 0x8084, 0x82e1, 0x8351, 0xf9e7, - 0xf9e8, 0x8cbd, 0x8cb3, 0x9087, 0xf9e9, 0xf9ea, 0x98f4, 0x990c, - 0xf9eb, 0xf9ec, 0x7037, 0x76ca, 0x7fca, 0x7fcc, 0x7ffc, 0x8b1a, - 0x4eba, 0x4ec1, 0x5203, 0x5370, 0xf9ed, 0x54bd, 0x56e0, 0x59fb, - 0x5bc5, 0x5f15, 0x5fcd, 0x6e6e, 0xf9ee, 0xf9ef, 0x7d6a, 0x8335, - 0xf9f0, 0x8693, 0x8a8d, 0xf9f1, 0x976d, 0x9777, 0xf9f2, 0xf9f3, - 0x4e00, 0x4f5a, 0x4f7e, 0x58f9, 0x65e5, 0x6ea2, 0x9038, 0x93b0, - 0x99b9, 0x4efb, 0x58ec, 0x598a, 0x59d9, 0x6041, 0xf9f4, 0xf9f5, - 0x7a14, 0xf9f6, 0x834f, 0x8cc3, 0x5165, 0x5344, - /* 0x6d */ - 0xf9f7, 0xf9f8, 0xf9f9, 0x4ecd, 0x5269, 0x5b55, 0x82bf, 0x4ed4, - 0x523a, 0x54a8, 0x59c9, 0x59ff, 0x5b50, 0x5b57, 0x5b5c, 0x6063, - 0x6148, 0x6ecb, 0x7099, 0x716e, 0x7386, 0x74f7, 0x75b5, 0x78c1, - 0x7d2b, 0x8005, 0x81ea, 0x8328, 0x8517, 0x85c9, 0x8aee, 0x8cc7, - 0x96cc, 0x4f5c, 0x52fa, 0x56bc, 0x65ab, 0x6628, 0x707c, 0x70b8, - 0x7235, 0x7dbd, 0x828d, 0x914c, 0x96c0, 0x9d72, 0x5b71, 0x68e7, - 0x6b98, 0x6f7a, 0x76de, 0x5c91, 0x66ab, 0x6f5b, 0x7bb4, 0x7c2a, - 0x8836, 0x96dc, 0x4e08, 0x4ed7, 0x5320, 0x5834, 0x58bb, 0x58ef, - 0x596c, 0x5c07, 0x5e33, 0x5e84, 0x5f35, 0x638c, 0x66b2, 0x6756, - 0x6a1f, 0x6aa3, 0x6b0c, 0x6f3f, 0x7246, 0xf9fa, 0x7350, 0x748b, - 0x7ae0, 0x7ca7, 0x8178, 0x81df, 0x81e7, 0x838a, 0x846c, 0x8523, - 0x8594, 0x85cf, 0x88dd, 0x8d13, 0x91ac, 0x9577, - /* 0x6e */ - 0x969c, 0x518d, 0x54c9, 0x5728, 0x5bb0, 0x624d, 0x6750, 0x683d, - 0x6893, 0x6e3d, 0x6ed3, 0x707d, 0x7e21, 0x88c1, 0x8ca1, 0x8f09, - 0x9f4b, 0x9f4e, 0x722d, 0x7b8f, 0x8acd, 0x931a, 0x4f47, 0x4f4e, - 0x5132, 0x5480, 0x59d0, 0x5e95, 0x62b5, 0x6775, 0x696e, 0x6a17, - 0x6cae, 0x6e1a, 0x72d9, 0x732a, 0x75bd, 0x7bb8, 0x7d35, 0x82e7, - 0x83f9, 0x8457, 0x85f7, 0x8a5b, 0x8caf, 0x8e87, 0x9019, 0x90b8, - 0x96ce, 0x9f5f, 0x52e3, 0x540a, 0x5ae1, 0x5bc2, 0x6458, 0x6575, - 0x6ef4, 0x72c4, 0xf9fb, 0x7684, 0x7a4d, 0x7b1b, 0x7c4d, 0x7e3e, - 0x7fdf, 0x837b, 0x8b2b, 0x8cca, 0x8d64, 0x8de1, 0x8e5f, 0x8fea, - 0x8ff9, 0x9069, 0x93d1, 0x4f43, 0x4f7a, 0x50b3, 0x5168, 0x5178, - 0x524d, 0x526a, 0x5861, 0x587c, 0x5960, 0x5c08, 0x5c55, 0x5edb, - 0x609b, 0x6230, 0x6813, 0x6bbf, 0x6c08, 0x6fb1, - /* 0x6f */ - 0x714e, 0x7420, 0x7530, 0x7538, 0x7551, 0x7672, 0x7b4c, 0x7b8b, - 0x7bad, 0x7bc6, 0x7e8f, 0x8a6e, 0x8f3e, 0x8f49, 0x923f, 0x9293, - 0x9322, 0x942b, 0x96fb, 0x985a, 0x986b, 0x991e, 0x5207, 0x622a, - 0x6298, 0x6d59, 0x7664, 0x7aca, 0x7bc0, 0x7d76, 0x5360, 0x5cbe, - 0x5e97, 0x6f38, 0x70b9, 0x7c98, 0x9711, 0x9b8e, 0x9ede, 0x63a5, - 0x647a, 0x8776, 0x4e01, 0x4e95, 0x4ead, 0x505c, 0x5075, 0x5448, - 0x59c3, 0x5b9a, 0x5e40, 0x5ead, 0x5ef7, 0x5f81, 0x60c5, 0x633a, - 0x653f, 0x6574, 0x65cc, 0x6676, 0x6678, 0x67fe, 0x6968, 0x6a89, - 0x6b63, 0x6c40, 0x6dc0, 0x6de8, 0x6e1f, 0x6e5e, 0x701e, 0x70a1, - 0x738e, 0x73fd, 0x753a, 0x775b, 0x7887, 0x798e, 0x7a0b, 0x7a7d, - 0x7cbe, 0x7d8e, 0x8247, 0x8a02, 0x8aea, 0x8c9e, 0x912d, 0x914a, - 0x91d8, 0x9266, 0x92cc, 0x9320, 0x9706, 0x9756, - /* 0x70 */ - 0x975c, 0x9802, 0x9f0e, 0x5236, 0x5291, 0x557c, 0x5824, 0x5e1d, - 0x5f1f, 0x608c, 0x63d0, 0x68af, 0x6fdf, 0x796d, 0x7b2c, 0x81cd, - 0x85ba, 0x88fd, 0x8af8, 0x8e44, 0x918d, 0x9664, 0x969b, 0x973d, - 0x984c, 0x9f4a, 0x4fce, 0x5146, 0x51cb, 0x52a9, 0x5632, 0x5f14, - 0x5f6b, 0x63aa, 0x64cd, 0x65e9, 0x6641, 0x66fa, 0x66f9, 0x671d, - 0x689d, 0x68d7, 0x69fd, 0x6f15, 0x6f6e, 0x7167, 0x71e5, 0x722a, - 0x74aa, 0x773a, 0x7956, 0x795a, 0x79df, 0x7a20, 0x7a95, 0x7c97, - 0x7cdf, 0x7d44, 0x7e70, 0x8087, 0x85fb, 0x86a4, 0x8a54, 0x8abf, - 0x8d99, 0x8e81, 0x9020, 0x906d, 0x91e3, 0x963b, 0x96d5, 0x9ce5, - 0x65cf, 0x7c07, 0x8db3, 0x93c3, 0x5b58, 0x5c0a, 0x5352, 0x62d9, - 0x731d, 0x5027, 0x5b97, 0x5f9e, 0x60b0, 0x616b, 0x68d5, 0x6dd9, - 0x742e, 0x7a2e, 0x7d42, 0x7d9c, 0x7e31, 0x816b, - /* 0x71 */ - 0x8e2a, 0x8e35, 0x937e, 0x9418, 0x4f50, 0x5750, 0x5de6, 0x5ea7, - 0x632b, 0x7f6a, 0x4e3b, 0x4f4f, 0x4f8f, 0x505a, 0x59dd, 0x80c4, - 0x546a, 0x5468, 0x55fe, 0x594f, 0x5b99, 0x5dde, 0x5eda, 0x665d, - 0x6731, 0x67f1, 0x682a, 0x6ce8, 0x6d32, 0x6e4a, 0x6f8d, 0x70b7, - 0x73e0, 0x7587, 0x7c4c, 0x7d02, 0x7d2c, 0x7da2, 0x821f, 0x86db, - 0x8a3b, 0x8a85, 0x8d70, 0x8e8a, 0x8f33, 0x9031, 0x914e, 0x9152, - 0x9444, 0x99d0, 0x7af9, 0x7ca5, 0x4fca, 0x5101, 0x51c6, 0x57c8, - 0x5bef, 0x5cfb, 0x6659, 0x6a3d, 0x6d5a, 0x6e96, 0x6fec, 0x710c, - 0x756f, 0x7ae3, 0x8822, 0x9021, 0x9075, 0x96cb, 0x99ff, 0x8301, - 0x4e2d, 0x4ef2, 0x8846, 0x91cd, 0x537d, 0x6adb, 0x696b, 0x6c41, - 0x847a, 0x589e, 0x618e, 0x66fe, 0x62ef, 0x70dd, 0x7511, 0x75c7, - 0x7e52, 0x84b8, 0x8b49, 0x8d08, 0x4e4b, 0x53ea, - /* 0x72 */ - 0x54ab, 0x5730, 0x5740, 0x5fd7, 0x6301, 0x6307, 0x646f, 0x652f, - 0x65e8, 0x667a, 0x679d, 0x67b3, 0x6b62, 0x6c60, 0x6c9a, 0x6f2c, - 0x77e5, 0x7825, 0x7949, 0x7957, 0x7d19, 0x80a2, 0x8102, 0x81f3, - 0x829d, 0x82b7, 0x8718, 0x8a8c, 0xf9fc, 0x8d04, 0x8dbe, 0x9072, - 0x76f4, 0x7a19, 0x7a37, 0x7e54, 0x8077, 0x5507, 0x55d4, 0x5875, - 0x632f, 0x6422, 0x6649, 0x664b, 0x686d, 0x699b, 0x6b84, 0x6d25, - 0x6eb1, 0x73cd, 0x7468, 0x74a1, 0x755b, 0x75b9, 0x76e1, 0x771e, - 0x778b, 0x79e6, 0x7e09, 0x7e1d, 0x81fb, 0x852f, 0x8897, 0x8a3a, - 0x8cd1, 0x8eeb, 0x8fb0, 0x9032, 0x93ad, 0x9663, 0x9673, 0x9707, - 0x4f84, 0x53f1, 0x59ea, 0x5ac9, 0x5e19, 0x684e, 0x74c6, 0x75be, - 0x79e9, 0x7a92, 0x81a3, 0x86ed, 0x8cea, 0x8dcc, 0x8fed, 0x659f, - 0x6715, 0xf9fd, 0x57f7, 0x6f57, 0x7ddd, 0x8f2f, - /* 0x73 */ - 0x93f6, 0x96c6, 0x5fb5, 0x61f2, 0x6f84, 0x4e14, 0x4f98, 0x501f, - 0x53c9, 0x55df, 0x5d6f, 0x5dee, 0x6b21, 0x6b64, 0x78cb, 0x7b9a, - 0xf9fe, 0x8e49, 0x8eca, 0x906e, 0x6349, 0x643e, 0x7740, 0x7a84, - 0x932f, 0x947f, 0x9f6a, 0x64b0, 0x6faf, 0x71e6, 0x74a8, 0x74da, - 0x7ac4, 0x7c12, 0x7e82, 0x7cb2, 0x7e98, 0x8b9a, 0x8d0a, 0x947d, - 0x9910, 0x994c, 0x5239, 0x5bdf, 0x64e6, 0x672d, 0x7d2e, 0x50ed, - 0x53c3, 0x5879, 0x6158, 0x6159, 0x61fa, 0x65ac, 0x7ad9, 0x8b92, - 0x8b96, 0x5009, 0x5021, 0x5275, 0x5531, 0x5a3c, 0x5ee0, 0x5f70, - 0x6134, 0x655e, 0x660c, 0x6636, 0x66a2, 0x69cd, 0x6ec4, 0x6f32, - 0x7316, 0x7621, 0x7a93, 0x8139, 0x8259, 0x83d6, 0x84bc, 0x50b5, - 0x57f0, 0x5bc0, 0x5be8, 0x5f69, 0x63a1, 0x7826, 0x7db5, 0x83dc, - 0x8521, 0x91c7, 0x91f5, 0x518a, 0x67f5, 0x7b56, - /* 0x74 */ - 0x8cac, 0x51c4, 0x59bb, 0x60bd, 0x8655, 0x501c, 0xf9ff, 0x5254, - 0x5c3a, 0x617d, 0x621a, 0x62d3, 0x64f2, 0x65a5, 0x6ecc, 0x7620, - 0x810a, 0x8e60, 0x965f, 0x96bb, 0x4edf, 0x5343, 0x5598, 0x5929, - 0x5ddd, 0x64c5, 0x6cc9, 0x6dfa, 0x7394, 0x7a7f, 0x821b, 0x85a6, - 0x8ce4, 0x8e10, 0x9077, 0x91e7, 0x95e1, 0x9621, 0x97c6, 0x51f8, - 0x54f2, 0x5586, 0x5fb9, 0x64a4, 0x6f88, 0x7db4, 0x8f1f, 0x8f4d, - 0x9435, 0x50c9, 0x5c16, 0x6cbe, 0x6dfb, 0x751b, 0x77bb, 0x7c3d, - 0x7c64, 0x8a79, 0x8ac2, 0x581e, 0x59be, 0x5e16, 0x6377, 0x7252, - 0x758a, 0x776b, 0x8adc, 0x8cbc, 0x8f12, 0x5ef3, 0x6674, 0x6df8, - 0x807d, 0x83c1, 0x8acb, 0x9751, 0x9bd6, 0xfa00, 0x5243, 0x66ff, - 0x6d95, 0x6eef, 0x7de0, 0x8ae6, 0x902e, 0x905e, 0x9ad4, 0x521d, - 0x527f, 0x54e8, 0x6194, 0x6284, 0x62db, 0x68a2, - /* 0x75 */ - 0x6912, 0x695a, 0x6a35, 0x7092, 0x7126, 0x785d, 0x7901, 0x790e, - 0x79d2, 0x7a0d, 0x8096, 0x8278, 0x82d5, 0x8349, 0x8549, 0x8c82, - 0x8d85, 0x9162, 0x918b, 0x91ae, 0x4fc3, 0x56d1, 0x71ed, 0x77d7, - 0x8700, 0x89f8, 0x5bf8, 0x5fd6, 0x6751, 0x90a8, 0x53e2, 0x585a, - 0x5bf5, 0x60a4, 0x6181, 0x6460, 0x7e3d, 0x8070, 0x8525, 0x9283, - 0x64ae, 0x50ac, 0x5d14, 0x6700, 0x589c, 0x62bd, 0x63a8, 0x690e, - 0x6978, 0x6a1e, 0x6e6b, 0x76ba, 0x79cb, 0x82bb, 0x8429, 0x8acf, - 0x8da8, 0x8ffd, 0x9112, 0x914b, 0x919c, 0x9310, 0x9318, 0x939a, - 0x96db, 0x9a36, 0x9c0d, 0x4e11, 0x755c, 0x795d, 0x7afa, 0x7b51, - 0x7bc9, 0x7e2e, 0x84c4, 0x8e59, 0x8e74, 0x8ef8, 0x9010, 0x6625, - 0x693f, 0x7443, 0x51fa, 0x672e, 0x9edc, 0x5145, 0x5fe0, 0x6c96, - 0x87f2, 0x885d, 0x8877, 0x60b4, 0x81b5, 0x8403, - /* 0x76 */ - 0x8d05, 0x53d6, 0x5439, 0x5634, 0x5a36, 0x5c31, 0x708a, 0x7fe0, - 0x805a, 0x8106, 0x81ed, 0x8da3, 0x9189, 0x9a5f, 0x9df2, 0x5074, - 0x4ec4, 0x53a0, 0x60fb, 0x6e2c, 0x5c64, 0x4f88, 0x5024, 0x55e4, - 0x5cd9, 0x5e5f, 0x6065, 0x6894, 0x6cbb, 0x6dc4, 0x71be, 0x75d4, - 0x75f4, 0x7661, 0x7a1a, 0x7a49, 0x7dc7, 0x7dfb, 0x7f6e, 0x81f4, - 0x86a9, 0x8f1c, 0x96c9, 0x99b3, 0x9f52, 0x5247, 0x52c5, 0x98ed, - 0x89aa, 0x4e03, 0x67d2, 0x6f06, 0x4fb5, 0x5be2, 0x6795, 0x6c88, - 0x6d78, 0x741b, 0x7827, 0x91dd, 0x937c, 0x87c4, 0x79e4, 0x7a31, - 0x5feb, 0x4ed6, 0x54a4, 0x553e, 0x58ae, 0x59a5, 0x60f0, 0x6253, - 0x62d6, 0x6736, 0x6955, 0x8235, 0x9640, 0x99b1, 0x99dd, 0x502c, - 0x5353, 0x5544, 0x577c, 0xfa01, 0x6258, 0xfa02, 0x64e2, 0x666b, - 0x67dd, 0x6fc1, 0x6fef, 0x7422, 0x7438, 0x8a17, - /* 0x77 */ - 0x9438, 0x5451, 0x5606, 0x5766, 0x5f48, 0x619a, 0x6b4e, 0x7058, - 0x70ad, 0x7dbb, 0x8a95, 0x596a, 0x812b, 0x63a2, 0x7708, 0x803d, - 0x8caa, 0x5854, 0x642d, 0x69bb, 0x5b95, 0x5e11, 0x6e6f, 0xfa03, - 0x8569, 0x514c, 0x53f0, 0x592a, 0x6020, 0x614b, 0x6b86, 0x6c70, - 0x6cf0, 0x7b1e, 0x80ce, 0x82d4, 0x8dc6, 0x90b0, 0x98b1, 0xfa04, - 0x64c7, 0x6fa4, 0x6491, 0x6504, 0x514e, 0x5410, 0x571f, 0x8a0e, - 0x615f, 0x6876, 0xfa05, 0x75db, 0x7b52, 0x7d71, 0x901a, 0x5806, - 0x69cc, 0x817f, 0x892a, 0x9000, 0x9839, 0x5078, 0x5957, 0x59ac, - 0x6295, 0x900f, 0x9b2a, 0x615d, 0x7279, 0x95d6, 0x5761, 0x5a46, - 0x5df4, 0x628a, 0x64ad, 0x64fa, 0x6777, 0x6ce2, 0x6d3e, 0x722c, - 0x7436, 0x7834, 0x7f77, 0x82ad, 0x8ddb, 0x9817, 0x5224, 0x5742, - 0x677f, 0x7248, 0x74e3, 0x8ca9, 0x8fa6, 0x9211, - /* 0x78 */ - 0x962a, 0x516b, 0x53ed, 0x634c, 0x4f69, 0x5504, 0x6096, 0x6557, - 0x6c9b, 0x6d7f, 0x724c, 0x72fd, 0x7a17, 0x8987, 0x8c9d, 0x5f6d, - 0x6f8e, 0x70f9, 0x81a8, 0x610e, 0x4fbf, 0x504f, 0x6241, 0x7247, - 0x7bc7, 0x7de8, 0x7fe9, 0x904d, 0x97ad, 0x9a19, 0x8cb6, 0x576a, - 0x5e73, 0x67b0, 0x840d, 0x8a55, 0x5420, 0x5b16, 0x5e63, 0x5ee2, - 0x5f0a, 0x6583, 0x80ba, 0x853d, 0x9589, 0x965b, 0x4f48, 0x5305, - 0x530d, 0x530f, 0x5486, 0x54fa, 0x5703, 0x5e03, 0x6016, 0x629b, - 0x62b1, 0x6355, 0xfa06, 0x6ce1, 0x6d66, 0x75b1, 0x7832, 0x80de, - 0x812f, 0x82de, 0x8461, 0x84b2, 0x888d, 0x8912, 0x900b, 0x92ea, - 0x98fd, 0x9b91, 0x5e45, 0x66b4, 0x66dd, 0x7011, 0x7206, 0xfa07, - 0x4ff5, 0x527d, 0x5f6a, 0x6153, 0x6753, 0x6a19, 0x6f02, 0x74e2, - 0x7968, 0x8868, 0x8c79, 0x98c7, 0x98c4, 0x9a43, - /* 0x79 */ - 0x54c1, 0x7a1f, 0x6953, 0x8af7, 0x8c4a, 0x98a8, 0x99ae, 0x5f7c, - 0x62ab, 0x75b2, 0x76ae, 0x88ab, 0x907f, 0x9642, 0x5339, 0x5f3c, - 0x5fc5, 0x6ccc, 0x73cc, 0x7562, 0x758b, 0x7b46, 0x82fe, 0x999d, - 0x4e4f, 0x903c, 0x4e0b, 0x4f55, 0x53a6, 0x590f, 0x5ec8, 0x6630, - 0x6cb3, 0x7455, 0x8377, 0x8766, 0x8cc0, 0x9050, 0x971e, 0x9c15, - 0x58d1, 0x5b78, 0x8650, 0x8b14, 0x9db4, 0x5bd2, 0x6068, 0x608d, - 0x65f1, 0x6c57, 0x6f22, 0x6fa3, 0x701a, 0x7f55, 0x7ff0, 0x9591, - 0x9592, 0x9650, 0x97d3, 0x5272, 0x8f44, 0x51fd, 0x542b, 0x54b8, - 0x5563, 0x558a, 0x6abb, 0x6db5, 0x7dd8, 0x8266, 0x929c, 0x9677, - 0x9e79, 0x5408, 0x54c8, 0x76d2, 0x86e4, 0x95a4, 0x95d4, 0x965c, - 0x4ea2, 0x4f09, 0x59ee, 0x5ae6, 0x5df7, 0x6052, 0x6297, 0x676d, - 0x6841, 0x6c86, 0x6e2f, 0x7f38, 0x809b, 0x822a, - /* 0x7a */ - 0xfa08, 0xfa09, 0x9805, 0x4ea5, 0x5055, 0x54b3, 0x5793, 0x595a, - 0x5b69, 0x5bb3, 0x61c8, 0x6977, 0x6d77, 0x7023, 0x87f9, 0x89e3, - 0x8a72, 0x8ae7, 0x9082, 0x99ed, 0x9ab8, 0x52be, 0x6838, 0x5016, - 0x5e78, 0x674f, 0x8347, 0x884c, 0x4eab, 0x5411, 0x56ae, 0x73e6, - 0x9115, 0x97ff, 0x9909, 0x9957, 0x9999, 0x5653, 0x589f, 0x865b, - 0x8a31, 0x61b2, 0x6af6, 0x737b, 0x8ed2, 0x6b47, 0x96aa, 0x9a57, - 0x5955, 0x7200, 0x8d6b, 0x9769, 0x4fd4, 0x5cf4, 0x5f26, 0x61f8, - 0x665b, 0x6ceb, 0x70ab, 0x7384, 0x73b9, 0x73fe, 0x7729, 0x774d, - 0x7d43, 0x7d62, 0x7e23, 0x8237, 0x8852, 0xfa0a, 0x8ce2, 0x9249, - 0x986f, 0x5b51, 0x7a74, 0x8840, 0x9801, 0x5acc, 0x4fe0, 0x5354, - 0x593e, 0x5cfd, 0x633e, 0x6d79, 0x72f9, 0x8105, 0x8107, 0x83a2, - 0x92cf, 0x9830, 0x4ea8, 0x5144, 0x5211, 0x578b, - /* 0x7b */ - 0x5f62, 0x6cc2, 0x6ece, 0x7005, 0x7050, 0x70af, 0x7192, 0x73e9, - 0x7469, 0x834a, 0x87a2, 0x8861, 0x9008, 0x90a2, 0x93a3, 0x99a8, - 0x516e, 0x5f57, 0x60e0, 0x6167, 0x66b3, 0x8559, 0x8e4a, 0x91af, - 0x978b, 0x4e4e, 0x4e92, 0x547c, 0x58d5, 0x58fa, 0x597d, 0x5cb5, - 0x5f27, 0x6236, 0x6248, 0x660a, 0x6667, 0x6beb, 0x6d69, 0x6dcf, - 0x6e56, 0x6ef8, 0x6f94, 0x6fe0, 0x6fe9, 0x705d, 0x72d0, 0x7425, - 0x745a, 0x74e0, 0x7693, 0x795c, 0x7cca, 0x7e1e, 0x80e1, 0x82a6, - 0x846b, 0x84bf, 0x864e, 0x865f, 0x8774, 0x8b77, 0x8c6a, 0x93ac, - 0x9800, 0x9865, 0x60d1, 0x6216, 0x9177, 0x5a5a, 0x660f, 0x6df7, - 0x6e3e, 0x743f, 0x9b42, 0x5ffd, 0x60da, 0x7b0f, 0x54c4, 0x5f18, - 0x6c5e, 0x6cd3, 0x6d2a, 0x70d8, 0x7d05, 0x8679, 0x8a0c, 0x9d3b, - 0x5316, 0x548c, 0x5b05, 0x6a3a, 0x706b, 0x7575, - /* 0x7c */ - 0x798d, 0x79be, 0x82b1, 0x83ef, 0x8a71, 0x8b41, 0x8ca8, 0x9774, - 0xfa0b, 0x64f4, 0x652b, 0x78ba, 0x78bb, 0x7a6b, 0x4e38, 0x559a, - 0x5950, 0x5ba6, 0x5e7b, 0x60a3, 0x63db, 0x6b61, 0x6665, 0x6853, - 0x6e19, 0x7165, 0x74b0, 0x7d08, 0x9084, 0x9a69, 0x9c25, 0x6d3b, - 0x6ed1, 0x733e, 0x8c41, 0x95ca, 0x51f0, 0x5e4c, 0x5fa8, 0x604d, - 0x60f6, 0x6130, 0x614c, 0x6643, 0x6644, 0x69a5, 0x6cc1, 0x6e5f, - 0x6ec9, 0x6f62, 0x714c, 0x749c, 0x7687, 0x7bc1, 0x7c27, 0x8352, - 0x8757, 0x9051, 0x968d, 0x9ec3, 0x532f, 0x56de, 0x5efb, 0x5f8a, - 0x6062, 0x6094, 0x61f7, 0x6666, 0x6703, 0x6a9c, 0x6dee, 0x6fae, - 0x7070, 0x736a, 0x7e6a, 0x81be, 0x8334, 0x86d4, 0x8aa8, 0x8cc4, - 0x5283, 0x7372, 0x5b96, 0x6a6b, 0x9404, 0x54ee, 0x5686, 0x5b5d, - 0x6548, 0x6585, 0x66c9, 0x689f, 0x6d8d, 0x6dc6, - /* 0x7d */ - 0x723b, 0x80b4, 0x9175, 0x9a4d, 0x4faf, 0x5019, 0x539a, 0x540e, - 0x543c, 0x5589, 0x55c5, 0x5e3f, 0x5f8c, 0x673d, 0x7166, 0x73dd, - 0x9005, 0x52db, 0x52f3, 0x5864, 0x58ce, 0x7104, 0x718f, 0x71fb, - 0x85b0, 0x8a13, 0x6688, 0x85a8, 0x55a7, 0x6684, 0x714a, 0x8431, - 0x5349, 0x5599, 0x6bc1, 0x5f59, 0x5fbd, 0x63ee, 0x6689, 0x7147, - 0x8af1, 0x8f1d, 0x9ebe, 0x4f11, 0x643a, 0x70cb, 0x7566, 0x8667, - 0x6064, 0x8b4e, 0x9df8, 0x5147, 0x51f6, 0x5308, 0x6d36, 0x80f8, - 0x9ed1, 0x6615, 0x6b23, 0x7098, 0x75d5, 0x5403, 0x5c79, 0x7d07, - 0x8a16, 0x6b20, 0x6b3d, 0x6b46, 0x5438, 0x6070, 0x6d3d, 0x7fd5, - 0x8208, 0x50d6, 0x51de, 0x559c, 0x566b, 0x56cd, 0x59ec, 0x5b09, - 0x5e0c, 0x6199, 0x6198, 0x6231, 0x665e, 0x66e6, 0x7199, 0x71b9, - 0x71ba, 0x72a7, 0x79a7, 0x7a00, 0x7fb2, 0x8a70, -}; - -static int -ksc5601_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c1 = (s[0] & 0x7F); - if ((c1 >= 0x21 && c1 <= 0x2c) || (c1 >= 0x30 && c1 <= 0x48) || (c1 >= 0x4a && c1 <= 0x7d)) { - if (n >= 2) { - unsigned char c2 = (s[1] & 0x7F); - if (c2 >= 0x21 && c2 < 0x7f) { - unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); - unsigned short wc = 0xfffd; - if (i < 1410) { - if (i < 1115) - wc = ksc5601_2uni_page21[i]; - } else if (i < 3854) { - if (i < 3760) - wc = ksc5601_2uni_page30[i-1410]; - } else { - if (i < 8742) - wc = ksc5601_2uni_page4a[i-3854]; - } - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOFEW(0); - } - return RET_ILSEQ; -} - -static const unsigned short ksc5601_2charset[8224] = { - 0x222e, 0x2234, 0x2157, 0x2127, 0x2823, 0x2129, 0x2146, 0x213e, - 0x2977, 0x2978, 0x2225, 0x2252, 0x2124, 0x222c, 0x2976, 0x282c, - 0x2879, 0x2876, 0x287a, 0x222f, 0x2821, 0x2822, 0x213f, 0x282a, - 0x282d, 0x292c, 0x2921, 0x2923, 0x2140, 0x292a, 0x292d, 0x2922, - 0x2824, 0x2924, 0x2925, 0x2826, 0x2926, 0x2927, 0x2828, 0x2928, - 0x2829, 0x2929, 0x2930, 0x282f, 0x292f, 0x282b, 0x292b, 0x282e, - 0x292e, 0x2227, 0x2230, 0x2228, 0x222b, 0x222a, 0x222d, 0x2229, - 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, - 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, - 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, - 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, - 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, - 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2577, 0x2578, - 0x2c27, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c28, - 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c2f, 0x2c30, - 0x2c31, 0x2c32, 0x2c33, 0x2c34, 0x2c35, 0x2c36, 0x2c37, 0x2c38, - 0x2c39, 0x2c3a, 0x2c3b, 0x2c3c, 0x2c3d, 0x2c3e, 0x2c3f, 0x2c40, - 0x2c41, 0x2c51, 0x2c52, 0x2c53, 0x2c54, 0x2c55, 0x2c56, 0x2c58, - 0x2c59, 0x2c5a, 0x2c5b, 0x2c5c, 0x2c5d, 0x2c5e, 0x2c5f, 0x2c60, - 0x2c61, 0x2c62, 0x2c63, 0x2c64, 0x2c65, 0x2c66, 0x2c67, 0x2c68, - 0x2c69, 0x2c6a, 0x2c6b, 0x2c6c, 0x2c6d, 0x2c6e, 0x2c6f, 0x2c70, - 0x2c71, 0x2c57, 0x212a, 0x212e, 0x212f, 0x2130, 0x2131, 0x2253, - 0x2254, 0x2125, 0x2126, 0x2236, 0x2147, 0x2148, 0x2158, 0x2979, - 0x297a, 0x297b, 0x297c, 0x297d, 0x297e, 0x2149, 0x2235, 0x2724, - 0x2260, 0x2265, 0x2262, 0x2759, 0x214a, 0x2877, 0x2878, 0x287b, - 0x287c, 0x287d, 0x287e, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, - 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x2521, 0x2522, 0x2523, - 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x2167, - 0x2168, 0x2166, 0x2169, 0x216a, 0x2255, 0x2258, 0x2256, 0x2259, - 0x2257, 0x2221, 0x2222, 0x2223, 0x2153, 0x2224, 0x2154, 0x2174, - 0x2175, 0x2233, 0x2232, 0x216e, 0x2170, 0x2144, 0x2150, 0x212b, - 0x217c, 0x217d, 0x217b, 0x217a, 0x2172, 0x2173, 0x2231, 0x2145, - 0x2171, 0x212d, 0x216f, 0x2156, 0x2141, 0x2155, 0x2142, 0x2143, - 0x216c, 0x216d, 0x2178, 0x2179, 0x2176, 0x2177, 0x2241, 0x2151, - 0x2152, 0x2867, 0x2868, 0x2869, 0x286a, 0x286b, 0x286c, 0x286d, - 0x286e, 0x286f, 0x2870, 0x2871, 0x2872, 0x2873, 0x2874, 0x2875, - 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x296c, 0x296d, 0x296e, - 0x296f, 0x2970, 0x2971, 0x2972, 0x2973, 0x2974, 0x2975, 0x294d, - 0x294e, 0x294f, 0x2950, 0x2951, 0x2952, 0x2953, 0x2954, 0x2955, - 0x2956, 0x2957, 0x2958, 0x2959, 0x295a, 0x295b, 0x295c, 0x295d, - 0x295e, 0x295f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965, - 0x2966, 0x284d, 0x284e, 0x284f, 0x2850, 0x2851, 0x2852, 0x2853, - 0x2854, 0x2855, 0x2856, 0x2857, 0x2858, 0x2859, 0x285a, 0x285b, - 0x285c, 0x285d, 0x285e, 0x285f, 0x2860, 0x2861, 0x2862, 0x2863, - 0x2864, 0x2865, 0x2866, 0x2621, 0x262c, 0x2622, 0x262d, 0x2623, - 0x2648, 0x2647, 0x262e, 0x2624, 0x2642, 0x2641, 0x262f, 0x2626, - 0x2646, 0x2645, 0x2631, 0x2625, 0x2644, 0x2643, 0x2630, 0x2627, - 0x263c, 0x2649, 0x264a, 0x2637, 0x264b, 0x264c, 0x2632, 0x2629, - 0x263e, 0x264d, 0x264e, 0x2639, 0x264f, 0x2650, 0x2634, 0x2628, - 0x2651, 0x2652, 0x2638, 0x263d, 0x2653, 0x2654, 0x2633, 0x262a, - 0x2655, 0x2656, 0x263a, 0x263f, 0x2657, 0x2658, 0x2635, 0x262b, - 0x2659, 0x265a, 0x263b, 0x265b, 0x265c, 0x2640, 0x265d, 0x265e, - 0x265f, 0x2660, 0x2661, 0x2662, 0x2663, 0x2664, 0x2636, 0x2246, - 0x2161, 0x2160, 0x2243, 0x2247, 0x2248, 0x224b, 0x224a, 0x2249, - 0x224c, 0x2163, 0x2162, 0x223a, 0x2239, 0x2165, 0x2164, 0x2238, - 0x2237, 0x215f, 0x215e, 0x2242, 0x215b, 0x215d, 0x215c, 0x2244, - 0x2245, 0x215a, 0x2159, 0x224f, 0x224e, 0x2250, 0x2251, 0x214f, - 0x214e, 0x223c, 0x223d, 0x2240, 0x223b, 0x223e, 0x223f, 0x224d, - 0x225b, 0x225c, 0x225d, 0x225a, 0x2121, 0x2122, 0x2123, 0x2128, - 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213a, 0x213b, - 0x213c, 0x213d, 0x216b, 0x2132, 0x2133, 0x2a21, 0x2a22, 0x2a23, - 0x2a24, 0x2a25, 0x2a26, 0x2a27, 0x2a28, 0x2a29, 0x2a2a, 0x2a2b, - 0x2a2c, 0x2a2d, 0x2a2e, 0x2a2f, 0x2a30, 0x2a31, 0x2a32, 0x2a33, - 0x2a34, 0x2a35, 0x2a36, 0x2a37, 0x2a38, 0x2a39, 0x2a3a, 0x2a3b, - 0x2a3c, 0x2a3d, 0x2a3e, 0x2a3f, 0x2a40, 0x2a41, 0x2a42, 0x2a43, - 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48, 0x2a49, 0x2a4a, 0x2a4b, - 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50, 0x2a51, 0x2a52, 0x2a53, - 0x2a54, 0x2a55, 0x2a56, 0x2a57, 0x2a58, 0x2a59, 0x2a5a, 0x2a5b, - 0x2a5c, 0x2a5d, 0x2a5e, 0x2a5f, 0x2a60, 0x2a61, 0x2a62, 0x2a63, - 0x2a64, 0x2a65, 0x2a66, 0x2a67, 0x2a68, 0x2a69, 0x2a6a, 0x2a6b, - 0x2a6c, 0x2a6d, 0x2a6e, 0x2a6f, 0x2a70, 0x2a71, 0x2a72, 0x2a73, - 0x2b21, 0x2b22, 0x2b23, 0x2b24, 0x2b25, 0x2b26, 0x2b27, 0x2b28, - 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e, 0x2b2f, 0x2b30, - 0x2b31, 0x2b32, 0x2b33, 0x2b34, 0x2b35, 0x2b36, 0x2b37, 0x2b38, - 0x2b39, 0x2b3a, 0x2b3b, 0x2b3c, 0x2b3d, 0x2b3e, 0x2b3f, 0x2b40, - 0x2b41, 0x2b42, 0x2b43, 0x2b44, 0x2b45, 0x2b46, 0x2b47, 0x2b48, - 0x2b49, 0x2b4a, 0x2b4b, 0x2b4c, 0x2b4d, 0x2b4e, 0x2b4f, 0x2b50, - 0x2b51, 0x2b52, 0x2b53, 0x2b54, 0x2b55, 0x2b56, 0x2b57, 0x2b58, - 0x2b59, 0x2b5a, 0x2b5b, 0x2b5c, 0x2b5d, 0x2b5e, 0x2b5f, 0x2b60, - 0x2b61, 0x2b62, 0x2b63, 0x2b64, 0x2b65, 0x2b66, 0x2b67, 0x2b68, - 0x2b69, 0x2b6a, 0x2b6b, 0x2b6c, 0x2b6d, 0x2b6e, 0x2b6f, 0x2b70, - 0x2b71, 0x2b72, 0x2b73, 0x2b74, 0x2b75, 0x2b76, 0x2421, 0x2422, - 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, 0x242a, - 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, 0x2432, - 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, 0x243a, - 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, 0x2442, - 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, 0x244a, - 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, 0x2452, - 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, 0x245a, - 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, 0x2462, - 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, - 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, - 0x2473, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, - 0x247b, 0x247c, 0x247d, 0x247e, 0x2931, 0x2932, 0x2933, 0x2934, - 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c, - 0x293d, 0x293e, 0x293f, 0x2940, 0x2941, 0x2942, 0x2943, 0x2944, - 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, 0x294a, 0x294b, 0x294c, - 0x225f, 0x2831, 0x2832, 0x2833, 0x2834, 0x2835, 0x2836, 0x2837, - 0x2838, 0x2839, 0x283a, 0x283b, 0x283c, 0x283d, 0x283e, 0x283f, - 0x2840, 0x2841, 0x2842, 0x2843, 0x2844, 0x2845, 0x2846, 0x2847, - 0x2848, 0x2849, 0x284a, 0x284b, 0x284c, 0x225e, 0x2749, 0x274a, - 0x274b, 0x274c, 0x274d, 0x273a, 0x273b, 0x275c, 0x275d, 0x275e, - 0x2736, 0x2737, 0x2738, 0x2754, 0x2755, 0x2756, 0x2757, 0x2758, - 0x2721, 0x2722, 0x2723, 0x2725, 0x272b, 0x272c, 0x272d, 0x272e, - 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2727, 0x2728, - 0x2729, 0x272a, 0x273d, 0x273e, 0x2765, 0x2766, 0x2767, 0x2768, - 0x2761, 0x2762, 0x2763, 0x273f, 0x2740, 0x2741, 0x2742, 0x2743, - 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x274e, 0x274f, 0x2750, - 0x2751, 0x2752, 0x2753, 0x275a, 0x275b, 0x2263, 0x276c, 0x2726, - 0x2760, 0x276f, 0x2261, 0x273c, 0x276d, 0x2735, 0x2739, 0x276a, - 0x276b, 0x275f, 0x2264, 0x2764, 0x276e, 0x2769, 0x6c69, 0x6f4b, - 0x7652, 0x5832, 0x6d5b, 0x5f32, 0x5f3e, 0x793b, 0x5c74, 0x7564, - 0x7326, 0x5d60, 0x6126, 0x4e78, 0x5c30, 0x632a, 0x7169, 0x4d7a, - 0x7c2f, 0x5321, 0x712b, 0x6751, 0x522c, 0x4e79, 0x717d, 0x5e3f, - 0x7b3a, 0x7939, 0x4e52, 0x632b, 0x6b60, 0x4e7a, 0x4b77, 0x6525, - 0x4a61, 0x544c, 0x6a61, 0x5c63, 0x5f2d, 0x4b6b, 0x552f, 0x5675, - 0x6578, 0x5e40, 0x6c23, 0x694d, 0x6a27, 0x6976, 0x7b3b, 0x6769, - 0x6f4c, 0x5066, 0x5e41, 0x642c, 0x584c, 0x7971, 0x4e5f, 0x7a24, - 0x6632, 0x7a7b, 0x7a3d, 0x4c48, 0x6f4d, 0x5555, 0x5322, 0x6c51, - 0x6427, 0x6c52, 0x7631, 0x4e7b, 0x5051, 0x4b3f, 0x6d24, 0x6d28, - 0x5e42, 0x7662, 0x6d5c, 0x5c75, 0x6039, 0x544e, 0x7435, 0x535b, - 0x5635, 0x6c24, 0x6466, 0x716a, 0x4b6c, 0x4b40, 0x6c72, 0x506a, - 0x7972, 0x6c25, 0x505f, 0x676a, 0x506b, 0x5c51, 0x5b69, 0x7d4c, - 0x5b57, 0x5a61, 0x5636, 0x635f, 0x5e43, 0x5e44, 0x4a21, 0x6e6c, - 0x5323, 0x6e37, 0x784f, 0x6a48, 0x6e38, 0x712c, 0x7125, 0x694e, - 0x793c, 0x6579, 0x6c6a, 0x5d56, 0x6d42, 0x7825, 0x653a, 0x5b58, - 0x4a22, 0x514d, 0x6e6d, 0x6c6b, 0x5e45, 0x6360, 0x4a49, 0x7269, - 0x554e, 0x7636, 0x4e42, 0x5647, 0x6334, 0x712d, 0x6a62, 0x5742, - 0x7327, 0x4d6a, 0x6b6e, 0x5932, 0x7d25, 0x7655, 0x5562, 0x7835, - 0x4c75, 0x7535, 0x642d, 0x676b, 0x7155, 0x703b, 0x6935, 0x4c49, - 0x7a55, 0x6154, 0x5756, 0x5c41, 0x5e46, 0x7a6f, 0x6361, 0x6173, - 0x5c76, 0x4e7c, 0x5b44, 0x7871, 0x5c64, 0x656f, 0x5c31, 0x5556, - 0x735a, 0x4b41, 0x5b43, 0x597a, 0x536e, 0x7a38, 0x7d26, 0x6b6f, - 0x7426, 0x4c4a, 0x7328, 0x735b, 0x5b27, 0x7637, 0x4f66, 0x7072, - 0x4b5a, 0x6752, 0x5743, 0x7670, 0x685e, 0x6526, 0x6567, 0x4a23, - 0x4c27, 0x6a49, 0x7836, 0x7a25, 0x712e, 0x6f4e, 0x4b6d, 0x7630, - 0x6f4f, 0x694f, 0x775e, 0x4e53, 0x5c77, 0x5b28, 0x4b78, 0x5f21, - 0x5d61, 0x754a, 0x6936, 0x676c, 0x6e6e, 0x7370, 0x5f3f, 0x4c4b, - 0x5041, 0x7452, 0x603a, 0x5f40, 0x4e60, 0x5c52, 0x7d6a, 0x5676, - 0x6a4a, 0x6869, 0x632c, 0x7350, 0x4a24, 0x5b78, 0x5e47, 0x6b70, - 0x7156, 0x6562, 0x4c4c, 0x4b7b, 0x6a63, 0x5f41, 0x566d, 0x6950, - 0x6e39, 0x5563, 0x5153, 0x6570, 0x6834, 0x6b43, 0x6a2a, 0x7a7c, - 0x7576, 0x703c, 0x7d54, 0x603b, 0x4e43, 0x503a, 0x773a, 0x5873, - 0x774d, 0x642e, 0x545f, 0x5067, 0x6c7d, 0x522e, 0x6e6f, 0x5557, - 0x6a64, 0x7822, 0x4d6b, 0x573f, 0x7b31, 0x4d6c, 0x5c32, 0x506c, - 0x4e7d, 0x6e70, 0x4c42, 0x506d, 0x6577, 0x737c, 0x6e22, 0x5933, - 0x5874, 0x6937, 0x4e2e, 0x5922, 0x5871, 0x544f, 0x6527, 0x5552, - 0x5629, 0x7422, 0x7157, 0x5558, 0x703d, 0x5750, 0x5450, 0x574f, - 0x6b6a, 0x7d6b, 0x5b6d, 0x7c45, 0x4b42, 0x7d55, 0x7448, 0x686a, - 0x7573, 0x795e, 0x536f, 0x6c53, 0x5d42, 0x6f37, 0x6754, 0x4a4a, - 0x597b, 0x7a7d, 0x562a, 0x7478, 0x7777, 0x5c2c, 0x5757, 0x5f22, - 0x4e3e, 0x5370, 0x7024, 0x616c, 0x4f67, 0x734b, 0x6d29, 0x4a3e, - 0x746f, 0x764e, 0x5e7b, 0x503b, 0x5537, 0x6e71, 0x7428, 0x5c78, - 0x4b27, 0x5a4e, 0x6066, 0x6d25, 0x6e72, 0x5c79, 0x795c, 0x735c, - 0x7872, 0x7479, 0x7c71, 0x503c, 0x5b79, 0x5731, 0x4b7c, 0x7025, - 0x4b7d, 0x5574, 0x4d6d, 0x4a25, 0x562b, 0x5042, 0x703e, 0x523d, - 0x4c24, 0x7a36, 0x4c4d, 0x5a7a, 0x764f, 0x6938, 0x5875, 0x4c4e, - 0x574d, 0x5451, 0x696d, 0x4a6b, 0x5962, 0x7d32, 0x632d, 0x564c, - 0x5934, 0x6127, 0x6e53, 0x5043, 0x7d33, 0x5564, 0x4f68, 0x6d43, - 0x5032, 0x4e7e, 0x5a28, 0x7850, 0x7d56, 0x7851, 0x7852, 0x5c53, - 0x5d62, 0x7b79, 0x5d41, 0x6335, 0x6d5d, 0x4e44, 0x4b21, 0x5d63, - 0x7c5d, 0x792f, 0x527b, 0x4f21, 0x6428, 0x7436, 0x6c7e, 0x632e, - 0x676d, 0x7d41, 0x5a62, 0x5833, 0x5d64, 0x706f, 0x7671, 0x7a70, - 0x5175, 0x5a4f, 0x5c54, 0x5c26, 0x6f3f, 0x4e4f, 0x6059, 0x5956, - 0x6c54, 0x6a4b, 0x4a3f, 0x5530, 0x4f69, 0x716d, 0x4c4f, 0x6478, - 0x646d, 0x5758, 0x7d27, 0x6a2b, 0x7632, 0x4f70, 0x793d, 0x6674, - 0x4b5b, 0x7351, 0x6951, 0x7329, 0x5060, 0x6952, 0x5a63, 0x6252, - 0x7622, 0x6174, 0x5a64, 0x6755, 0x753f, 0x4f22, 0x4d2f, 0x4f23, - 0x4d30, 0x717e, 0x5023, 0x612f, 0x7823, 0x4a26, 0x773b, 0x726a, - 0x5e48, 0x6953, 0x5e49, 0x7d5e, 0x4a40, 0x796a, 0x514e, 0x6e54, - 0x5452, 0x5923, 0x7d28, 0x5759, 0x774e, 0x7a3e, 0x4f56, 0x5770, - 0x6b61, 0x7845, 0x5c7a, 0x5d43, 0x795f, 0x676f, 0x7d65, 0x7623, - 0x597c, 0x7d29, 0x676e, 0x5565, 0x6f50, 0x4d31, 0x7722, 0x7132, - 0x7131, 0x4d32, 0x5a2b, 0x4a27, 0x6362, 0x7b3c, 0x5924, 0x6e3a, - 0x7853, 0x7b7a, 0x4f24, 0x5c7b, 0x7663, 0x6d2a, 0x7221, 0x4e61, - 0x7a26, 0x7960, 0x6c56, 0x646e, 0x7921, 0x7b6f, 0x796b, 0x6e23, - 0x6a2c, 0x4a28, 0x747a, 0x4d56, 0x7c76, 0x7449, 0x7854, 0x7826, - 0x5e4a, 0x7246, 0x575a, 0x5350, 0x5845, 0x6a66, 0x735d, 0x645a, - 0x7664, 0x7672, 0x5f42, 0x597d, 0x4c76, 0x533a, 0x642f, 0x7961, - 0x7026, 0x4b53, 0x603c, 0x744a, 0x547a, 0x7d2a, 0x7962, 0x7437, - 0x7d42, 0x7c30, 0x7d6c, 0x4a62, 0x7d3d, 0x6a67, 0x5f43, 0x5152, - 0x4e62, 0x5324, 0x7d2b, 0x5f60, 0x7247, 0x6770, 0x506e, 0x732a, - 0x5e4b, 0x7638, 0x6175, 0x7133, 0x7723, 0x4a29, 0x4f25, 0x5f44, - 0x6130, 0x703f, 0x7624, 0x6336, 0x7a46, 0x506f, 0x7d6d, 0x5d44, - 0x7c77, 0x663f, 0x5e2d, 0x7a3f, 0x6571, 0x6d44, 0x5225, 0x7d6e, - 0x7536, 0x6176, 0x5e4c, 0x7c5e, 0x6c57, 0x4d5d, 0x5637, 0x4d33, - 0x7855, 0x6558, 0x4f6a, 0x4f50, 0x6a4c, 0x6a2e, 0x6a2d, 0x5371, - 0x5325, 0x774f, 0x6e24, 0x5024, 0x7222, 0x5070, 0x7223, 0x7778, - 0x5033, 0x5b29, 0x533b, 0x4a6c, 0x7126, 0x4b55, 0x7767, 0x4d5e, - 0x7724, 0x7840, 0x535d, 0x4c50, 0x4f26, 0x7673, 0x6177, 0x535c, - 0x7a7e, 0x7a27, 0x6b59, 0x4f27, 0x6a2f, 0x646f, 0x6939, 0x7158, - 0x5858, 0x6072, 0x6634, 0x5c7c, 0x7371, 0x6350, 0x727b, 0x5b46, - 0x5071, 0x5072, 0x4f5c, 0x5351, 0x4c31, 0x7758, 0x4b28, 0x6b3c, - 0x643e, 0x745c, 0x5c42, 0x7027, 0x6640, 0x4a6d, 0x686b, 0x6568, - 0x5c43, 0x6d5e, 0x5372, 0x4c77, 0x4e54, 0x672b, 0x4b43, 0x6131, - 0x7732, 0x5373, 0x5352, 0x7540, 0x5f5d, 0x6e73, 0x6771, 0x7d34, - 0x7248, 0x7352, 0x6e74, 0x6253, 0x4c51, 0x5f6a, 0x693a, 0x5957, - 0x754d, 0x7172, 0x7a47, 0x5978, 0x5442, 0x7665, 0x5d45, 0x6772, - 0x6d5f, 0x4a4b, 0x5b7a, 0x6835, 0x5326, 0x7d35, 0x7949, 0x6462, - 0x7b3d, 0x5724, 0x4e45, 0x4e55, 0x5666, 0x653d, 0x5e4d, 0x6c73, - 0x6d60, 0x6c6c, 0x7b3e, 0x5f6b, 0x6178, 0x793e, 0x5073, 0x602a, - 0x6862, 0x6254, 0x527d, 0x6528, 0x5953, 0x535e, 0x7438, 0x773c, - 0x5c7d, 0x686c, 0x6467, 0x6377, 0x6c28, 0x7a71, 0x6572, 0x5074, - 0x522f, 0x5c65, 0x5025, 0x7134, 0x7c31, 0x4c78, 0x5d46, 0x7a51, - 0x775f, 0x7a28, 0x6e75, 0x5e4e, 0x6773, 0x772c, 0x6b44, 0x6d61, - 0x602b, 0x5d47, 0x5233, 0x523f, 0x4a4c, 0x7b3f, 0x657d, 0x5d65, - 0x584d, 0x6c74, 0x5075, 0x686d, 0x5052, 0x5958, 0x7666, 0x5b2a, - 0x7760, 0x5859, 0x7423, 0x745d, 0x6f51, 0x5935, 0x6d2b, 0x6337, - 0x6e3b, 0x4d34, 0x6073, 0x6a4d, 0x6c75, 0x686e, 0x4b29, 0x712f, - 0x4a4d, 0x6c29, 0x726b, 0x7d6f, 0x7973, 0x6641, 0x6c58, 0x6d2c, - 0x6a4e, 0x685f, 0x5e4f, 0x5226, 0x6774, 0x5156, 0x6642, 0x6363, - 0x6430, 0x5834, 0x7625, 0x735e, 0x5725, 0x7768, 0x6846, 0x7b66, - 0x5d66, 0x5c7e, 0x585a, 0x5a2c, 0x6a30, 0x6338, 0x4a2a, 0x6179, - 0x6a31, 0x726c, 0x7a6e, 0x6e55, 0x7974, 0x526c, 0x7b7b, 0x7d70, - 0x603d, 0x4e63, 0x7846, 0x5e2e, 0x5f45, 0x653e, 0x6d2d, 0x7a6a, - 0x4d6e, 0x6d26, 0x6d2e, 0x706d, 0x5d21, 0x6d2f, 0x7c78, 0x586b, - 0x4c79, 0x4d35, 0x7a29, 0x615d, 0x6255, 0x6d4f, 0x5d22, 0x794a, - 0x6a68, 0x656d, 0x536b, 0x6954, 0x617a, 0x644c, 0x6164, 0x6847, - 0x4e5b, 0x5c55, 0x7735, 0x7c73, 0x7073, 0x4e2f, 0x7135, 0x6f52, - 0x6848, 0x6b71, 0x4b54, 0x603e, 0x6378, 0x6a69, 0x7c32, 0x6074, - 0x4f60, 0x6e25, 0x7a2a, 0x6643, 0x6132, 0x4a2b, 0x6364, 0x693b, - 0x6256, 0x7372, 0x6e56, 0x6a32, 0x5076, 0x6c59, 0x5a4b, 0x4f28, - 0x5d23, 0x585b, 0x794e, 0x6955, 0x6351, 0x523c, 0x582c, 0x734c, - 0x4d7b, 0x7656, 0x6775, 0x686f, 0x6379, 0x523b, 0x7373, 0x637b, - 0x5e50, 0x4e30, 0x5677, 0x7159, 0x7541, 0x5c44, 0x753b, 0x5e51, - 0x5c66, 0x5e52, 0x6d62, 0x6e76, 0x6a4f, 0x706e, 0x637c, 0x535f, - 0x5374, 0x6133, 0x6134, 0x7453, 0x5f46, 0x6956, 0x5b2b, 0x7626, - 0x6339, 0x6b45, 0x7429, 0x4d36, 0x5279, 0x5a2d, 0x5263, 0x4f51, - 0x4b5c, 0x4c7a, 0x4f5d, 0x6829, 0x633b, 0x633a, 0x605a, 0x6e77, - 0x5c33, 0x5375, 0x5726, 0x7635, 0x575b, 0x6155, 0x546a, 0x5f23, - 0x7d5f, 0x5077, 0x6d54, 0x4b2a, 0x645b, 0x617b, 0x4b22, 0x5360, - 0x643f, 0x7b40, 0x5a3e, 0x644d, 0x5639, 0x6f40, 0x617c, 0x7639, - 0x5f47, 0x6431, 0x5c67, 0x5c68, 0x7a56, 0x5376, 0x715a, 0x7a72, - 0x627d, 0x554f, 0x5078, 0x4d5f, 0x754b, 0x6470, 0x4b2b, 0x5744, - 0x627e, 0x5d5a, 0x5a2e, 0x4a6e, 0x5539, 0x6321, 0x6863, 0x732b, - 0x4f29, 0x5377, 0x5471, 0x4e64, 0x6872, 0x6575, 0x672e, 0x563a, - 0x5f6c, 0x6440, 0x6864, 0x5835, 0x645c, 0x7439, 0x7136, 0x625e, - 0x6135, 0x4d6f, 0x7127, 0x4e65, 0x4b5d, 0x5963, 0x732c, 0x5079, - 0x6c2b, 0x5e53, 0x7769, 0x7975, 0x615e, 0x4b6e, 0x633c, 0x7856, - 0x5b6e, 0x7d71, 0x7736, 0x745e, 0x726d, 0x5b59, 0x7028, 0x617d, - 0x5e54, 0x602c, 0x6d63, 0x5361, 0x5f48, 0x5936, 0x7d2c, 0x6f53, - 0x6441, 0x786b, 0x5b2c, 0x7c46, 0x582d, 0x763a, 0x5b5f, 0x5353, - 0x7847, 0x4a4e, 0x7841, 0x5234, 0x5c34, 0x7a39, 0x4a4f, 0x7c33, - 0x6a6a, 0x6a6b, 0x507a, 0x6d64, 0x5d67, 0x5f49, 0x5f6d, 0x6e3c, - 0x6f41, 0x4c52, 0x5d24, 0x5f4a, 0x5378, 0x7128, 0x4d37, 0x6f54, - 0x645d, 0x5f6e, 0x4b2c, 0x693c, 0x6a6c, 0x5f4b, 0x793f, 0x562f, - 0x5546, 0x4f2a, 0x4e29, 0x5678, 0x7137, 0x6e78, 0x5959, 0x735f, - 0x7848, 0x4e46, 0x5566, 0x7466, 0x6645, 0x6f55, 0x4b6f, 0x7c5f, - 0x5c27, 0x5667, 0x7849, 0x6352, 0x633d, 0x4f61, 0x7040, 0x6c5a, - 0x5d57, 0x7b70, 0x6c2c, 0x7029, 0x7a57, 0x7b41, 0x5240, 0x6530, - 0x6d65, 0x4b2d, 0x7930, 0x7725, 0x4b2e, 0x5a2f, 0x5836, 0x5327, - 0x7b32, 0x7d44, 0x6c2d, 0x7b21, 0x6569, 0x696e, 0x7374, 0x7873, - 0x7041, 0x5e2f, 0x7830, 0x7360, 0x672f, 0x5b2d, 0x6635, 0x7928, - 0x5d58, 0x6859, 0x6f56, 0x5362, 0x625f, 0x7c60, 0x5748, 0x7d2d, - 0x5f6f, 0x4c53, 0x5379, 0x5470, 0x5b47, 0x5e55, 0x7074, 0x5550, - 0x6559, 0x7c47, 0x5c56, 0x6260, 0x5a30, 0x7323, 0x536c, 0x744b, - 0x7d45, 0x637d, 0x7931, 0x507b, 0x6c5b, 0x753c, 0x7224, 0x584e, - 0x584f, 0x7577, 0x7661, 0x5237, 0x7b6c, 0x5d48, 0x6468, 0x5241, - 0x7857, 0x563b, 0x5e56, 0x773d, 0x6c2e, 0x5061, 0x6075, 0x6a33, - 0x4e56, 0x4c25, 0x6c76, 0x6261, 0x633e, 0x7c48, 0x4d70, 0x7976, - 0x5f70, 0x653f, 0x4e3f, 0x7c61, 0x6d30, 0x7d51, 0x763b, 0x794f, - 0x6b5a, 0x4a41, 0x5238, 0x4d71, 0x6353, 0x7d66, 0x666d, 0x637a, - 0x702a, 0x7950, 0x7c62, 0x7827, 0x6165, 0x6e79, 0x6776, 0x6a6d, - 0x7c34, 0x7542, 0x575c, 0x7075, 0x5d68, 0x536d, 0x757c, 0x5a3f, - 0x4c7b, 0x537a, 0x7424, 0x6f57, 0x5443, 0x7b63, 0x7b6d, 0x602d, - 0x6a6e, 0x7b33, 0x6442, 0x7667, 0x525d, 0x5f4c, 0x7c49, 0x6529, - 0x6076, 0x7633, 0x617e, 0x4b70, 0x6a6f, 0x6a70, 0x5a40, 0x7834, - 0x6b72, 0x6443, 0x6957, 0x6471, 0x4a6f, 0x4e57, 0x7c4a, 0x7361, - 0x4b44, 0x6365, 0x4b45, 0x6a34, 0x693d, 0x5749, 0x6b5b, 0x6d31, - 0x4c43, 0x773e, 0x7c4b, 0x7874, 0x5937, 0x7353, 0x7354, 0x7764, - 0x7751, 0x5837, 0x4e31, 0x4a42, 0x7b34, 0x4b46, 0x7076, 0x5567, - 0x6a50, 0x4c54, 0x4b2f, 0x742a, 0x692f, 0x7543, 0x6958, 0x5d69, - 0x7173, 0x557b, 0x5e3b, 0x747b, 0x7d73, 0x7d72, 0x7726, 0x5d49, - 0x5453, 0x4c28, 0x5a41, 0x4c55, 0x5964, 0x7a4a, 0x6563, 0x533c, - 0x4a70, 0x5044, 0x4a50, 0x7a2b, 0x6b6b, 0x6778, 0x5965, 0x5157, - 0x7324, 0x547b, 0x7c63, 0x7a58, 0x7355, 0x4f2b, 0x6b73, 0x557c, - 0x5354, 0x4d7c, 0x5966, 0x6279, 0x6221, 0x6b54, 0x6077, 0x6432, - 0x4c7c, 0x7b64, 0x742b, 0x503d, 0x4a71, 0x6f38, 0x5740, 0x6e7a, - 0x7d74, 0x5363, 0x7b42, 0x5568, 0x5b2e, 0x6136, 0x7837, 0x603f, - 0x7b43, 0x5d6a, 0x6222, 0x6e26, 0x7668, 0x7675, 0x5d4a, 0x5062, - 0x5d26, 0x5d6b, 0x6479, 0x632f, 0x507c, 0x747c, 0x4c3c, 0x776a, - 0x6564, 0x5f71, 0x7761, 0x7977, 0x6f39, 0x7858, 0x7929, 0x7859, - 0x6e3d, 0x5846, 0x6463, 0x754e, 0x5d59, 0x5967, 0x5239, 0x5543, - 0x5a65, 0x5a50, 0x5159, 0x4e58, 0x4b5e, 0x742c, 0x5a7b, 0x7669, - 0x6873, 0x4f2c, 0x7070, 0x747d, 0x5b48, 0x4e40, 0x6354, 0x514f, - 0x7175, 0x4d72, 0x4f6b, 0x4d38, 0x6326, 0x515a, 0x7225, 0x7226, - 0x644e, 0x537b, 0x7129, 0x7249, 0x6f58, 0x6649, 0x5838, 0x7a73, - 0x7335, 0x7824, 0x5173, 0x6648, 0x785a, 0x5c69, 0x5e57, 0x4b5f, - 0x4f6c, 0x745f, 0x5174, 0x523a, 0x5f72, 0x6137, 0x6223, 0x537c, - 0x6d66, 0x5b49, 0x647a, 0x4f5e, 0x4e50, 0x5553, 0x7375, 0x772e, - 0x6f48, 0x4d73, 0x754f, 0x6573, 0x7042, 0x4a51, 0x6a71, 0x5026, - 0x595a, 0x702b, 0x6b67, 0x6540, 0x7c35, 0x6444, 0x4c29, 0x7d46, - 0x6a35, 0x652a, 0x5f3a, 0x615f, 0x5a51, 0x6138, 0x6874, 0x537d, - 0x6224, 0x724a, 0x5a66, 0x7733, 0x7d4d, 0x7336, 0x6e57, 0x7544, - 0x5824, 0x7227, 0x5938, 0x5939, 0x6f49, 0x564e, 0x774b, 0x5f2e, - 0x6875, 0x5235, 0x5355, 0x744c, 0x5a7c, 0x5968, 0x776b, 0x7549, - 0x733c, 0x5a52, 0x5335, 0x6836, 0x564f, 0x743a, 0x7749, 0x4c2a, - 0x7043, 0x4c56, 0x5053, 0x533d, 0x5b7b, 0x4b60, 0x5364, 0x7677, - 0x553a, 0x734d, 0x4b61, 0x6b74, 0x742d, 0x7c2a, 0x776c, 0x6876, - 0x5a67, 0x774c, 0x6541, 0x606e, 0x557d, 0x4e66, 0x7c2b, 0x553b, - 0x7228, 0x6225, 0x4d39, 0x6a72, 0x4b47, 0x4d74, 0x5b2f, 0x6f59, - 0x4d3a, 0x7c79, 0x5f73, 0x4e67, 0x5a42, 0x4f2d, 0x6779, 0x7828, - 0x7362, 0x4a72, 0x5f24, 0x5444, 0x4c57, 0x6542, 0x4d3b, 0x6f5a, - 0x6e58, 0x5d27, 0x6226, 0x6040, 0x5630, 0x784a, 0x7c7a, 0x597e, - 0x5e30, 0x5d6c, 0x5a68, 0x5460, 0x5679, 0x4d57, 0x5e58, 0x7278, - 0x6456, 0x5045, 0x742e, 0x5d28, 0x6d45, 0x7356, 0x5e59, 0x6366, - 0x5328, 0x5b30, 0x655a, 0x633f, 0x5b31, 0x5569, 0x6041, 0x6f5b, - 0x7069, 0x5732, 0x507d, 0x5969, 0x507e, 0x6c6d, 0x5329, 0x7229, - 0x7044, 0x6262, 0x696f, 0x7951, 0x6959, 0x685a, 0x5a43, 0x5a44, - 0x5445, 0x677a, 0x4d60, 0x6330, 0x5b32, 0x7b44, 0x7363, 0x5925, - 0x7b67, 0x5d4b, 0x5054, 0x6636, 0x602e, 0x7d5a, 0x5c35, 0x6078, - 0x6731, 0x7570, 0x585c, 0x6d46, 0x6139, 0x6340, 0x7940, 0x6970, - 0x595b, 0x7364, 0x5c36, 0x6469, 0x7045, 0x6341, 0x7c4c, 0x7c4d, - 0x724b, 0x724c, 0x644f, 0x715b, 0x7a59, 0x7138, 0x7d75, 0x6079, - 0x677b, 0x7c37, 0x7c64, 0x7b45, 0x6367, 0x5839, 0x7678, 0x5c45, - 0x4c58, 0x602f, 0x7467, 0x6f5c, 0x4f7c, 0x6f5d, 0x722a, 0x7d3e, - 0x4a2c, 0x7d3b, 0x7d47, 0x6732, 0x6a51, 0x5f74, 0x516c, 0x645e, - 0x6543, 0x5926, 0x4d3c, 0x7365, 0x6d55, 0x593a, 0x6d67, 0x7b35, - 0x786c, 0x6067, 0x4c59, 0x5446, 0x6725, 0x5575, 0x533e, 0x7c7b, - 0x6472, 0x5f75, 0x6878, 0x786d, 0x4e47, 0x7d76, 0x6858, 0x4d58, - 0x6756, 0x4c5a, 0x4a63, 0x5f76, 0x7047, 0x7046, 0x583a, 0x7174, - 0x7470, 0x754c, 0x7c65, 0x6a45, 0x6a73, 0x5d5b, 0x5c57, 0x5e7d, - 0x7279, 0x5547, 0x5850, 0x7048, 0x5121, 0x5122, 0x5954, 0x5668, - 0x594a, 0x5a31, 0x5847, 0x5c62, 0x734e, 0x7574, 0x7139, 0x5a53, - 0x766a, 0x4f75, 0x7d2e, 0x4a52, 0x5f34, 0x575d, 0x7a3a, 0x6e27, - 0x753d, 0x7875, 0x6d68, 0x5461, 0x5123, 0x6156, 0x7978, 0x5b4a, - 0x4b79, 0x5454, 0x595c, 0x6e3e, 0x776d, 0x526e, 0x6166, 0x7779, - 0x5d6d, 0x685b, 0x5b33, 0x5177, 0x6030, 0x5462, 0x7657, 0x5779, - 0x585d, 0x4d7d, 0x722b, 0x4d3d, 0x7842, 0x722c, 0x4a2d, 0x4a2e, - 0x4f2e, 0x6342, 0x5c37, 0x5b5a, 0x593b, 0x4a73, 0x7653, 0x6678, - 0x6a75, 0x6a76, 0x7679, 0x4f2f, 0x4a53, 0x4a2f, 0x5230, 0x713a, - 0x5733, 0x6343, 0x737d, 0x5e5a, 0x5e5b, 0x6f5e, 0x6263, 0x6e7b, - 0x5f77, 0x574a, 0x4e68, 0x5b5b, 0x713b, 0x6971, 0x7a37, 0x5046, - 0x4c2b, 0x6e28, 0x4b7a, 0x7979, 0x4c7d, 0x537e, 0x6450, 0x726e, - 0x5455, 0x5f4d, 0x7c38, 0x5150, 0x724d, 0x7752, 0x4a54, 0x5559, - 0x585e, 0x4d59, 0x6e29, 0x763c, 0x4c5b, 0x7049, 0x7c7c, 0x6849, - 0x747e, 0x677c, 0x575e, 0x5e5c, 0x702c, 0x4c7e, 0x4d61, 0x613a, - 0x5b6f, 0x5a32, 0x5125, 0x5c38, 0x5876, 0x5124, 0x4d62, 0x5c6a, - 0x7077, 0x704a, 0x503e, 0x5d5c, 0x5456, 0x5356, 0x6d50, 0x4d21, - 0x5f35, 0x5f78, 0x5421, 0x4e32, 0x684a, 0x6b75, 0x6355, 0x7550, - 0x7521, 0x5927, 0x652b, 0x664b, 0x7571, 0x6545, 0x7923, 0x605b, - 0x766b, 0x4b71, 0x596a, 0x7522, 0x5751, 0x5178, 0x6a78, 0x6a79, - 0x5a33, 0x6f5f, 0x716f, 0x6576, 0x6e3f, 0x6264, 0x503f, 0x7a2c, - 0x7551, 0x6733, 0x693e, 0x724e, 0x5b34, 0x7c4e, 0x5d6e, 0x6734, - 0x5734, 0x7734, 0x4d3e, 0x5a69, 0x4f30, 0x7759, 0x7366, 0x4e59, - 0x4e2a, 0x4b48, 0x5027, 0x704b, 0x5047, 0x6445, 0x5b60, 0x555a, - 0x5727, 0x6e40, 0x7876, 0x7552, 0x6d69, 0x593c, 0x6546, 0x7523, - 0x5a54, 0x6227, 0x7b7c, 0x715c, 0x4a74, 0x687a, 0x4e69, 0x6978, - 0x6265, 0x5039, 0x5472, 0x5126, 0x5f4e, 0x7c74, 0x532a, 0x4c2c, - 0x6f60, 0x6565, 0x5055, 0x5b7c, 0x7c66, 0x4b7e, 0x6d6a, 0x5e31, - 0x7963, 0x5422, 0x4f76, 0x5650, 0x556a, 0x716e, 0x7a4b, 0x6521, - 0x5531, 0x4f6d, 0x6d6b, 0x5532, 0x553c, 0x7d62, 0x732d, 0x7d5b, - 0x6930, 0x5127, 0x7d63, 0x4e33, 0x7d64, 0x7a4e, 0x4a30, 0x7727, - 0x4f31, 0x6622, 0x7c36, 0x722d, 0x6f61, 0x732e, 0x5c46, 0x596b, - 0x6860, 0x6128, 0x5576, 0x4f7d, 0x5e5d, 0x5951, 0x646a, 0x724f, - 0x773f, 0x6266, 0x6228, 0x6356, 0x6d51, 0x6979, 0x5631, 0x5e32, - 0x6068, 0x532b, 0x6b5c, 0x5f2f, 0x4a43, 0x6e7c, 0x7d43, 0x6b76, - 0x4f32, 0x596c, 0x593d, 0x585f, 0x5438, 0x6b3e, 0x5d6f, 0x5d70, - 0x5d71, 0x5d72, 0x593e, 0x7b46, 0x4f33, 0x6e7d, 0x642b, 0x5a45, - 0x586c, 0x5128, 0x6229, 0x5e3c, 0x6735, 0x5b70, 0x6f62, 0x7170, - 0x4f34, 0x5b71, 0x6031, 0x5f25, 0x7952, 0x677d, 0x6623, 0x7b71, - 0x4b30, 0x722e, 0x4d67, 0x685c, 0x6757, 0x7740, 0x5063, 0x5a21, - 0x4c3d, 0x5129, 0x5d4c, 0x637e, 0x512a, 0x682a, 0x6a36, 0x797a, - 0x664c, 0x7658, 0x5447, 0x594b, 0x5952, 0x534b, 0x5877, 0x5a29, - 0x7578, 0x5e5e, 0x722f, 0x7829, 0x5848, 0x6e41, 0x7941, 0x5d73, - 0x6a7a, 0x763d, 0x613b, 0x4d3f, 0x7454, 0x664d, 0x7c4f, 0x7b22, - 0x605c, 0x743b, 0x5a55, 0x7932, 0x7b72, 0x5b76, 0x5e5f, 0x5b72, - 0x785c, 0x776e, 0x6b68, 0x527a, 0x713c, 0x7a5a, 0x5a6a, 0x5a46, - 0x7741, 0x6736, 0x6547, 0x562c, 0x5c47, 0x6129, 0x622a, 0x5526, - 0x5457, 0x7250, 0x6a7b, 0x605d, 0x7b73, 0x713d, 0x6267, 0x7d57, - 0x4e48, 0x6a37, 0x7c40, 0x7d67, 0x776f, 0x5735, 0x6f3a, 0x715d, - 0x5e33, 0x684b, 0x785d, 0x7b47, 0x5548, 0x575f, 0x5d29, 0x6931, - 0x7a2d, 0x7659, 0x7a74, 0x782a, 0x666e, 0x4c5c, 0x613c, 0x606f, - 0x693f, 0x7c7d, 0x664e, 0x6157, 0x664f, 0x7471, 0x6473, 0x647b, - 0x7964, 0x6f63, 0x4f6e, 0x763e, 0x6032, 0x7c7e, 0x512b, 0x577a, - 0x7b48, 0x6257, 0x5423, 0x7078, 0x5728, 0x6167, 0x533f, 0x6f64, - 0x5745, 0x6b62, 0x7c67, 0x6422, 0x6268, 0x6650, 0x7b68, 0x7468, - 0x6574, 0x743c, 0x7455, 0x5f36, 0x7c39, 0x6e42, 0x4a75, 0x6f65, - 0x4b62, 0x5424, 0x5e60, 0x5a7d, 0x6446, 0x683e, 0x605e, 0x7634, - 0x6a52, 0x797b, 0x6042, 0x4a64, 0x6737, 0x6a7d, 0x595d, 0x5a34, - 0x6e2a, 0x7b69, 0x5b4b, 0x5a35, 0x713e, 0x532c, 0x7b49, 0x5f4f, - 0x5340, 0x6357, 0x6f66, 0x7c50, 0x6940, 0x7553, 0x6c5c, 0x7737, - 0x6a38, 0x5179, 0x5c48, 0x6a39, 0x715e, 0x5736, 0x4f35, 0x5928, - 0x6c6e, 0x5d2a, 0x4d22, 0x682e, 0x613d, 0x7251, 0x6941, 0x527c, - 0x5b35, 0x7367, 0x587e, 0x7c51, 0x6d32, 0x742f, 0x7b23, 0x7c41, - 0x6e2b, 0x5425, 0x7472, 0x6e59, 0x7b4a, 0x4d63, 0x583b, 0x655b, - 0x7877, 0x7654, 0x5729, 0x4b49, 0x6651, 0x704c, 0x582e, 0x7953, - 0x557e, 0x583c, 0x7230, 0x622b, 0x7368, 0x6f42, 0x6d6c, 0x6738, - 0x5a7e, 0x4c3e, 0x727c, 0x5a6b, 0x6258, 0x6d56, 0x5651, 0x6033, - 0x7c52, 0x6b48, 0x5341, 0x704d, 0x4f77, 0x6d52, 0x5458, 0x5c49, - 0x5771, 0x5f3b, 0x7325, 0x744d, 0x713f, 0x7831, 0x697a, 0x7b4b, - 0x4a55, 0x7954, 0x774a, 0x5648, 0x7c68, 0x733d, 0x6e7e, 0x677e, - 0x5342, 0x5336, 0x4c2d, 0x767a, 0x5632, 0x5258, 0x6758, 0x6325, - 0x6739, 0x702d, 0x7b4c, 0x6b21, 0x5426, 0x7b4d, 0x553d, 0x715f, - 0x767b, 0x5e34, 0x556b, 0x6548, 0x7b24, 0x5439, 0x5e61, 0x6423, - 0x5737, 0x786e, 0x5e35, 0x5652, 0x7955, 0x673a, 0x6b55, 0x5577, - 0x6f67, 0x613e, 0x7a2e, 0x5669, 0x566e, 0x673b, 0x6c4b, 0x5533, - 0x4e34, 0x7b25, 0x616e, 0x7728, 0x7b4e, 0x583d, 0x7b7d, 0x7c69, - 0x4f36, 0x6d47, 0x6e2c, 0x4c5d, 0x7627, 0x667a, 0x7524, 0x7d5c, - 0x6d33, 0x4e49, 0x6f68, 0x613f, 0x7a5b, 0x4b63, 0x7729, 0x7b26, - 0x5c39, 0x7140, 0x6d48, 0x6f43, 0x562d, 0x7d4e, 0x6821, 0x7b74, - 0x5527, 0x7176, 0x6653, 0x4c5e, 0x7832, 0x5c6b, 0x7d36, 0x656a, - 0x7160, 0x5b4c, 0x5d4d, 0x5448, 0x596d, 0x7525, 0x667b, 0x6654, - 0x7d48, 0x5621, 0x7d3f, 0x7c53, 0x6f21, 0x673c, 0x516e, 0x6655, - 0x6972, 0x5f30, 0x5860, 0x7c3a, 0x7d2f, 0x704e, 0x5b61, 0x6549, - 0x6d34, 0x6043, 0x6358, 0x697b, 0x6a28, 0x7d37, 0x7b27, 0x6942, - 0x7d77, 0x6259, 0x5c6c, 0x6822, 0x6670, 0x7d78, 0x7d79, 0x763f, - 0x6727, 0x6657, 0x5473, 0x5449, 0x567a, 0x5772, 0x6140, 0x5b62, - 0x6658, 0x673d, 0x704f, 0x733e, 0x622c, 0x7537, 0x6070, 0x7d38, - 0x6368, 0x5427, 0x687c, 0x7a52, 0x786f, 0x5653, 0x5534, 0x7050, - 0x7770, 0x6e33, 0x6a3a, 0x6a53, 0x6d49, 0x5d2b, 0x652c, 0x7d21, - 0x5f50, 0x6c33, 0x5f51, 0x6d6d, 0x7838, 0x777a, 0x782b, 0x7460, - 0x543a, 0x6433, 0x695a, 0x5e36, 0x593f, 0x5940, 0x566f, 0x594c, - 0x5a2a, 0x5f65, 0x7765, 0x4c32, 0x5f79, 0x5760, 0x543b, 0x7d7a, - 0x4c33, 0x5b73, 0x5f52, 0x4e4a, 0x6e5a, 0x6464, 0x7b4f, 0x4f37, - 0x6e43, 0x4e6a, 0x622d, 0x5761, 0x7a75, 0x5549, 0x782c, 0x6759, - 0x7369, 0x586d, 0x6344, 0x7071, 0x6865, 0x607a, 0x6e44, 0x595e, - 0x6b22, 0x6b23, 0x7c42, 0x6a3b, 0x682b, 0x5e62, 0x6d6f, 0x6823, - 0x4f71, 0x543c, 0x7c6a, 0x673e, 0x7c72, 0x5634, 0x622e, 0x5337, - 0x7a4c, 0x7a5c, 0x6d35, 0x6163, 0x682c, 0x685d, 0x6f69, 0x743d, - 0x4f38, 0x695b, 0x512c, 0x5a47, 0x6b49, 0x684c, 0x5e37, 0x563c, - 0x5365, 0x7a5d, 0x5a56, 0x4a31, 0x5a48, 0x5f26, 0x7933, 0x7252, - 0x4a44, 0x4e4b, 0x4d75, 0x7d30, 0x5528, 0x7141, 0x6269, 0x5c4a, - 0x6c34, 0x7a40, 0x7b28, 0x5028, 0x5a6c, 0x596e, 0x607b, 0x6f6a, - 0x7a5e, 0x6044, 0x4f39, 0x554a, 0x5762, 0x622f, 0x5738, 0x684d, - 0x765a, 0x6f22, 0x625a, 0x767c, 0x7b50, 0x512d, 0x4d64, 0x512e, - 0x5c6d, 0x684e, 0x7079, 0x4e35, 0x667c, 0x577b, 0x5056, 0x5d75, - 0x7771, 0x767d, 0x5b77, 0x7b6a, 0x695c, 0x5941, 0x7572, 0x6045, - 0x6a54, 0x7942, 0x6a3c, 0x5245, 0x7b51, 0x6740, 0x6b25, 0x5f7a, - 0x6322, 0x5739, 0x6943, 0x687d, 0x682f, 0x7253, 0x7b29, 0x5825, - 0x554b, 0x5048, 0x512f, 0x5763, 0x6046, 0x5622, 0x6d70, 0x5773, - 0x7c54, 0x5a57, 0x4c5f, 0x7254, 0x5130, 0x4c60, 0x5b7d, 0x733f, - 0x7051, 0x7c3b, 0x6230, 0x6625, 0x625b, 0x5f5e, 0x6047, 0x726f, - 0x4c61, 0x566a, 0x6742, 0x4e36, 0x7340, 0x4d7e, 0x7b52, 0x7878, - 0x777b, 0x683f, 0x6837, 0x6d36, 0x5c3a, 0x4c34, 0x7177, 0x6838, - 0x4a76, 0x6424, 0x7456, 0x5f66, 0x5f27, 0x5f67, 0x6141, 0x6944, - 0x5c4b, 0x6945, 0x6f23, 0x6b26, 0x4b23, 0x6369, 0x517b, 0x6f24, - 0x6f6b, 0x5034, 0x4d23, 0x6866, 0x6f25, 0x534c, 0x5a6d, 0x573a, - 0x7255, 0x7565, 0x596f, 0x7934, 0x5554, 0x7d4f, 0x5b63, 0x7161, - 0x6c36, 0x7b7e, 0x5357, 0x5131, 0x4b31, 0x5132, 0x4b32, 0x7142, - 0x7461, 0x7935, 0x6143, 0x6142, 0x6b77, 0x5f28, 0x4b4a, 0x6639, - 0x785e, 0x792a, 0x4a77, 0x6d37, 0x5338, 0x7256, 0x5459, 0x6e45, - 0x7270, 0x4a32, 0x5c3b, 0x7178, 0x6c37, 0x654a, 0x7640, 0x7d5d, - 0x5463, 0x4c62, 0x7754, 0x5765, 0x5343, 0x5826, 0x7641, 0x5d76, - 0x4d40, 0x655c, 0x654b, 0x6144, 0x6830, 0x7430, 0x736a, 0x5a6e, - 0x573b, 0x6231, 0x572a, 0x567b, 0x645f, 0x4a56, 0x6b28, 0x5b7e, - 0x7642, 0x6f3b, 0x547d, 0x6048, 0x6839, 0x6f26, 0x4d24, 0x5474, - 0x5b21, 0x5b5c, 0x5b5d, 0x6e5c, 0x4b4b, 0x7c55, 0x4e6b, 0x4d41, - 0x7b53, 0x792b, 0x7554, 0x5929, 0x695d, 0x5b4d, 0x5d4e, 0x6743, - 0x6c4c, 0x796c, 0x4b4c, 0x607c, 0x5428, 0x6d53, 0x586f, 0x7257, - 0x4a78, 0x5a6f, 0x5654, 0x594d, 0x586e, 0x7241, 0x5f53, 0x5a70, - 0x626a, 0x607d, 0x5878, 0x772f, 0x5a36, 0x4a57, 0x7258, 0x5879, - 0x7a5f, 0x4f6f, 0x5942, 0x7052, 0x6451, 0x7337, 0x7a60, 0x6f6c, - 0x6232, 0x543d, 0x594e, 0x7462, 0x5429, 0x4d42, 0x675a, 0x7259, - 0x592a, 0x583e, 0x5c2d, 0x626b, 0x567c, 0x4a79, 0x545a, 0x7457, - 0x4c21, 0x4f3a, 0x7538, 0x5943, 0x5068, 0x6345, 0x6b78, 0x7231, - 0x4f3b, 0x532d, 0x6861, 0x4e6c, 0x6034, 0x5e63, 0x5d77, 0x7232, - 0x7376, 0x765b, 0x577e, 0x785f, 0x7772, 0x5029, 0x665a, 0x7526, - 0x573c, 0x4c63, 0x665b, 0x5d5d, 0x5133, 0x6f6d, 0x565e, 0x6474, - 0x616f, 0x5d78, 0x684f, 0x4a65, 0x5c21, 0x6035, 0x7c2c, 0x7c2d, - 0x5827, 0x6d38, 0x5b36, 0x5670, 0x732f, 0x4d25, 0x5a71, 0x5828, - 0x4c64, 0x5134, 0x4a58, 0x5a72, 0x7527, 0x7528, 0x6626, 0x556c, - 0x5578, 0x5a73, 0x6346, 0x5e64, 0x5e65, 0x5135, 0x5136, 0x5137, - 0x7233, 0x695e, 0x7053, 0x7234, 0x7054, 0x4b64, 0x7b54, 0x7566, - 0x636a, 0x5e66, 0x5f54, 0x7879, 0x702e, 0x5138, 0x565f, 0x5057, - 0x7c21, 0x6f6e, 0x5c58, 0x695f, 0x655d, 0x7d7b, 0x6049, 0x5649, - 0x542a, 0x654c, 0x6960, 0x5058, 0x7c22, 0x543e, 0x6233, 0x5e67, - 0x5c3c, 0x5236, 0x7555, 0x4e21, 0x7529, 0x5d79, 0x5d7a, 0x7055, - 0x765f, 0x725a, 0x646b, 0x7271, 0x6c39, 0x7d7c, 0x612a, 0x4a59, - 0x6f6f, 0x752a, 0x6c79, 0x782d, 0x7242, 0x7643, 0x5752, 0x7922, - 0x7056, 0x707a, 0x7660, 0x6973, 0x7243, 0x542b, 0x4a33, 0x4d26, - 0x4d43, 0x4d5a, 0x594f, 0x7644, 0x6e5d, 0x6744, 0x6234, 0x5f62, - 0x675b, 0x6831, 0x7c2e, 0x654d, 0x7a6b, 0x4f3c, 0x4f62, 0x4d76, - 0x6f70, 0x743e, 0x544d, 0x7338, 0x6921, 0x7272, 0x736b, 0x7057, - 0x4f57, 0x4f5f, 0x6840, 0x6841, 0x4f63, 0x6922, 0x502a, 0x7341, - 0x502b, 0x5464, 0x6f3c, 0x5821, 0x595f, 0x7357, 0x5c3d, 0x4c65, - 0x6d71, 0x7162, 0x545b, 0x6235, 0x4a66, 0x532e, 0x4c66, 0x7153, - 0x7567, 0x4a5a, 0x7b6e, 0x6145, 0x5f69, 0x6e5e, 0x7742, 0x5822, - 0x5d2c, 0x702f, 0x563d, 0x612b, 0x7936, 0x5475, 0x5049, 0x6f27, - 0x626c, 0x5b6a, 0x4e4c, 0x7568, 0x7755, 0x534d, 0x737e, 0x5035, - 0x607e, 0x5f7b, 0x665d, 0x6824, 0x4b4d, 0x6f28, 0x6e34, 0x5a58, - 0x5139, 0x5f29, 0x7330, 0x4c44, 0x4e37, 0x6f29, 0x5f55, 0x6d57, - 0x6e46, 0x6f3d, 0x7c56, 0x5b74, 0x6f2a, 0x7839, 0x7569, 0x6359, - 0x6146, 0x543f, 0x5e68, 0x706a, 0x7342, 0x532f, 0x4a5b, 0x7c57, - 0x6d58, 0x6147, 0x7458, 0x5633, 0x5d2d, 0x553e, 0x7143, 0x6e5f, - 0x566b, 0x7459, 0x5766, 0x5a37, 0x5d7b, 0x5d4f, 0x5823, 0x5a59, - 0x7058, 0x6f44, 0x6158, 0x7154, 0x6d72, 0x555b, 0x555c, 0x7344, - 0x4b57, 0x6236, 0x6f71, 0x7b55, 0x5358, 0x5d50, 0x7059, 0x4b33, - 0x555d, 0x4d27, 0x502c, 0x513a, 0x7144, 0x6533, 0x7b75, 0x6961, - 0x7d60, 0x7c3c, 0x5a22, 0x5a23, 0x5221, 0x526f, 0x626d, 0x5e69, - 0x4e5c, 0x7235, 0x5064, 0x5d51, 0x6148, 0x5b37, 0x5f63, 0x6d39, - 0x7145, 0x734f, 0x572b, 0x612c, 0x636b, 0x6e47, 0x6149, 0x4a7a, - 0x707b, 0x7a61, 0x705a, 0x4c67, 0x5a74, 0x4c3f, 0x4e6d, 0x5529, - 0x7a62, 0x5065, 0x6b56, 0x6c5f, 0x5f7c, 0x7756, 0x5e6a, 0x4b34, - 0x6f3e, 0x4c35, 0x4f3d, 0x6f72, 0x6237, 0x4c68, 0x707c, 0x5660, - 0x7146, 0x6238, 0x6b2b, 0x4b35, 0x5851, 0x744e, 0x7377, 0x5746, - 0x513b, 0x772a, 0x6d4a, 0x5753, 0x587a, 0x7645, 0x514c, 0x5d7c, - 0x5f7d, 0x7965, 0x604a, 0x727d, 0x5330, 0x7473, 0x5a49, 0x665e, - 0x783a, 0x6850, 0x587b, 0x6a55, 0x5623, 0x7646, 0x725b, 0x647c, - 0x6832, 0x5a5a, 0x725c, 0x7b56, 0x6932, 0x6e2d, 0x7a63, 0x5c6e, - 0x756a, 0x6660, 0x707d, 0x572c, 0x7545, 0x6e60, 0x5b65, 0x5d5e, - 0x5970, 0x6923, 0x7179, 0x7244, 0x604b, 0x6924, 0x6239, 0x6331, - 0x7c6b, 0x4d28, 0x4c36, 0x705b, 0x663a, 0x4d29, 0x7343, 0x6159, - 0x6f2b, 0x6745, 0x6069, 0x7345, 0x5440, 0x553f, 0x5d2e, 0x797c, - 0x4c40, 0x6522, 0x4e38, 0x5852, 0x7956, 0x712a, 0x4e51, 0x7647, - 0x5b6b, 0x5f7e, 0x5861, 0x7773, 0x5767, 0x547e, 0x513c, 0x654f, - 0x4b36, 0x5a38, 0x4d44, 0x563e, 0x623a, 0x4f58, 0x604c, 0x6b79, - 0x7d7d, 0x5768, 0x4b58, 0x6962, 0x683a, 0x6347, 0x6c4d, 0x6c4e, - 0x563f, 0x6327, 0x5f56, 0x7d68, 0x6e61, 0x7628, 0x5d7d, 0x783b, - 0x6851, 0x7957, 0x4e6e, 0x6c4f, 0x6925, 0x5655, 0x4d45, 0x6d3a, - 0x513d, 0x4f3e, 0x6c3b, 0x5231, 0x4c69, 0x5944, 0x697c, 0x513e, - 0x6c3c, 0x652d, 0x7730, 0x4c6a, 0x5344, 0x5640, 0x567d, 0x6121, - 0x5e3d, 0x7629, 0x5a24, 0x5624, 0x7546, 0x6122, 0x6946, 0x7245, - 0x7469, 0x566c, 0x6b53, 0x6c3d, 0x625c, 0x5e6b, 0x705c, 0x6b3f, - 0x574e, 0x513f, 0x752b, 0x797d, 0x4a5c, 0x4d46, 0x7236, 0x5d7e, - 0x4c37, 0x5b38, 0x5069, 0x4e5d, 0x6b40, 0x7d22, 0x784b, 0x6a56, - 0x7130, 0x5b4e, 0x7743, 0x5b4f, 0x4b24, 0x7860, 0x7b57, 0x6b4a, - 0x6021, 0x4e4d, 0x545c, 0x7d58, 0x5276, 0x7237, 0x7a76, 0x762a, - 0x7a77, 0x5866, 0x7431, 0x6852, 0x4a45, 0x4c6b, 0x626e, 0x623b, - 0x772d, 0x7861, 0x736c, 0x5e21, 0x647d, 0x636c, 0x5d2f, 0x5d30, - 0x4b37, 0x6853, 0x6123, 0x5260, 0x707e, 0x6926, 0x4b72, 0x6d73, - 0x5c59, 0x604d, 0x775a, 0x5b39, 0x4c2e, 0x5a5b, 0x4d47, 0x5d31, - 0x582f, 0x6323, 0x4e6f, 0x7273, 0x7833, 0x604e, 0x757d, 0x6b6c, - 0x5345, 0x7c6c, 0x525b, 0x546b, 0x5e22, 0x6566, 0x7030, 0x5544, - 0x6d74, 0x636d, 0x6842, 0x6d75, 0x577c, 0x6d3b, 0x762b, 0x7238, - 0x7648, 0x5366, 0x725d, 0x4f3f, 0x6b2c, 0x4f40, 0x6628, 0x7d69, - 0x4f41, 0x605f, 0x5e6c, 0x6022, 0x743f, 0x626f, 0x5971, 0x7147, - 0x4b38, 0x797e, 0x5b3a, 0x5a75, 0x766c, 0x5a5c, 0x7a64, 0x604f, - 0x5d32, 0x6629, 0x6f73, 0x736d, 0x6b7a, 0x7966, 0x4a5d, 0x555e, - 0x4a5e, 0x5f64, 0x667d, 0x752c, 0x6475, 0x6963, 0x6d4b, 0x4f64, - 0x5853, 0x5d33, 0x546c, 0x7239, 0x5f37, 0x4b4e, 0x7b58, 0x5059, - 0x5d52, 0x7774, 0x675c, 0x6425, 0x7c23, 0x5b3b, 0x723a, 0x697d, - 0x504a, 0x7556, 0x5945, 0x6434, 0x6d27, 0x6a3d, 0x667e, 0x7744, - 0x752d, 0x5960, 0x4a34, 0x7862, 0x4f42, 0x6c3e, 0x6534, 0x4d48, - 0x6e48, 0x6748, 0x4d49, 0x7937, 0x7168, 0x5972, 0x5b75, 0x4a35, - 0x5946, 0x5849, 0x592b, 0x6d3c, 0x5854, 0x5c5a, 0x623c, 0x7c6d, - 0x6c60, 0x527e, 0x6947, 0x662a, 0x6270, 0x7a3b, 0x752e, 0x7b2a, - 0x6c7b, 0x6c3f, 0x7c58, 0x5465, 0x7943, 0x6e62, 0x5769, 0x6d76, - 0x5e6d, 0x4c6c, 0x636e, 0x6854, 0x7a78, 0x5d34, 0x6435, 0x5830, - 0x5855, 0x746a, 0x4e39, 0x5661, 0x4f52, 0x5036, 0x4e22, 0x736e, - 0x7378, 0x5c4c, 0x504b, 0x7c24, 0x4d4a, 0x5754, 0x5e23, 0x6460, - 0x6e49, 0x625d, 0x757e, 0x542c, 0x5551, 0x5870, 0x7843, 0x6a57, - 0x7557, 0x583f, 0x7d40, 0x6b2d, 0x552a, 0x6728, 0x6e4a, 0x4a67, - 0x7863, 0x545d, 0x6a58, 0x7b59, 0x6d77, 0x6535, 0x502d, 0x7171, - 0x623d, 0x6348, 0x5955, 0x5f2a, 0x5b3c, 0x7864, 0x717a, 0x6536, - 0x736f, 0x7b5a, 0x6160, 0x592c, 0x756b, 0x6036, 0x6948, 0x4b4f, - 0x6349, 0x5e6e, 0x623e, 0x5c6f, 0x5625, 0x6271, 0x567e, 0x5921, - 0x5840, 0x5c5b, 0x6d3d, 0x5f38, 0x6a25, 0x572d, 0x7379, 0x6d78, - 0x7547, 0x614a, 0x6b63, 0x725e, 0x784c, 0x6a59, 0x5346, 0x5b66, - 0x752f, 0x4e70, 0x697e, 0x7b36, 0x6272, 0x4f72, 0x7739, 0x5973, - 0x614b, 0x5a5d, 0x5a39, 0x6b7b, 0x4b39, 0x6d79, 0x6060, 0x7440, - 0x7d3c, 0x5f31, 0x636f, 0x6023, 0x7d39, 0x7031, 0x4d4b, 0x6d3e, - 0x5540, 0x6370, 0x6d7a, 0x6964, 0x556d, 0x675d, 0x5476, 0x6537, - 0x5b67, 0x623f, 0x6e4b, 0x5774, 0x705d, 0x4e2b, 0x675e, 0x5656, - 0x614c, 0x6833, 0x656e, 0x5c22, 0x6050, 0x5535, 0x5521, 0x7b5b, - 0x794b, 0x4b73, 0x7425, 0x7a48, 0x5657, 0x6965, 0x7b5c, 0x7d50, - 0x7b76, 0x5a25, 0x5b3d, 0x6c62, 0x4d77, 0x705e, 0x7649, 0x5e6f, - 0x5331, 0x7c6e, 0x6843, 0x7148, 0x4e71, 0x796d, 0x7274, 0x6436, - 0x7539, 0x5c70, 0x6371, 0x6825, 0x723b, 0x5e24, 0x5a4c, 0x4a69, - 0x635a, 0x7c59, 0x6a5a, 0x7944, 0x6324, 0x7b5d, 0x6f4a, 0x6844, - 0x554c, 0x6b57, 0x592d, 0x7b2b, 0x5359, 0x5522, 0x765e, 0x5a76, - 0x6051, 0x6928, 0x7579, 0x7a2f, 0x6b7c, 0x606a, 0x6332, 0x5545, - 0x7163, 0x556e, 0x4d4c, 0x6d59, 0x5841, 0x7a6c, 0x716b, 0x7a3c, - 0x6662, 0x7a65, 0x627a, 0x4a36, 0x6437, 0x6a5b, 0x757a, 0x7b2c, - 0x4f43, 0x6b7d, 0x787a, 0x5f39, 0x6171, 0x5224, 0x757b, 0x505a, - 0x505b, 0x6a3e, 0x5931, 0x4a37, 0x5367, 0x7865, 0x5332, 0x6240, - 0x725f, 0x4d65, 0x792c, 0x4d4d, 0x6e2e, 0x562e, 0x576a, 0x6760, - 0x6b2e, 0x4f59, 0x5c4d, 0x6d7b, 0x5e70, 0x576b, 0x5e25, 0x5f57, - 0x5b50, 0x5b51, 0x5523, 0x7032, 0x5c5c, 0x4a68, 0x7866, 0x5c4e, - 0x6a5c, 0x5b52, 0x6933, 0x775b, 0x6328, 0x572e, 0x6061, 0x4b3a, - 0x6551, 0x505c, 0x5541, 0x584a, 0x6329, 0x6024, 0x6929, 0x5347, - 0x5c5d, 0x782e, 0x4c38, 0x502e, 0x5872, 0x634a, 0x4c2f, 0x542d, - 0x7651, 0x504c, 0x4a46, 0x5542, 0x4e3a, 0x4a47, 0x7a30, 0x5f58, - 0x753a, 0x656b, 0x6f74, 0x5d35, 0x4d2a, 0x6372, 0x7b77, 0x7750, - 0x7d3a, 0x7d61, 0x767e, 0x5140, 0x6845, 0x6438, 0x6168, 0x4c41, - 0x526d, 0x5b3e, 0x6062, 0x7a49, 0x614d, 0x4a38, 0x7260, 0x7149, - 0x5e71, 0x705f, 0x7844, 0x6e4c, 0x5e72, 0x6749, 0x6273, 0x6761, - 0x634b, 0x634c, 0x4f78, 0x6f2c, 0x7d7e, 0x7c25, 0x7a31, 0x5f59, - 0x6052, 0x745a, 0x714a, 0x4e23, 0x723c, 0x6c63, 0x6025, 0x772b, - 0x6b2f, 0x655e, 0x6124, 0x4d2b, 0x5974, 0x6826, 0x4d4e, 0x6169, - 0x7c6f, 0x6063, 0x6241, 0x4e24, 0x5e26, 0x6b7e, 0x6b5d, 0x7060, - 0x745b, 0x6274, 0x5348, 0x746b, 0x6e35, 0x7558, 0x555f, 0x5665, - 0x6b30, 0x7463, 0x634d, 0x7474, 0x7a32, 0x6f75, 0x4a5f, 0x6b31, - 0x6d3f, 0x7d49, 0x6426, 0x7924, 0x7033, 0x656c, 0x5167, 0x5947, - 0x6457, 0x6a5d, 0x5477, 0x5a3a, 0x5a4d, 0x794c, 0x615a, 0x5b3f, - 0x4c45, 0x6c50, 0x4b3b, 0x5e73, 0x692a, 0x5948, 0x6e63, 0x573d, - 0x4f44, 0x504d, 0x7c26, 0x717b, 0x7d52, 0x5141, 0x635b, 0x5349, - 0x5c4f, 0x4c6d, 0x5e27, 0x663b, 0x6c21, 0x4c39, 0x7b5e, 0x6762, - 0x5441, 0x5c28, 0x6242, 0x7358, 0x6553, 0x7359, 0x7346, 0x4d5b, - 0x4d2c, 0x7c43, 0x5467, 0x5142, 0x7925, 0x6855, 0x634e, 0x544a, - 0x5f5a, 0x7b5f, 0x6763, 0x787b, 0x634f, 0x7530, 0x5867, 0x5949, - 0x782f, 0x6f76, 0x5d36, 0x6e2f, 0x4d78, 0x5e38, 0x7c27, 0x777c, - 0x7731, 0x4e3b, 0x7421, 0x6e4d, 0x612e, 0x6c43, 0x4f7e, 0x783f, - 0x5862, 0x5368, 0x5e28, 0x7464, 0x6c42, 0x5975, 0x7945, 0x5d53, - 0x5671, 0x6c7c, 0x7c70, 0x6d40, 0x4a39, 0x6e64, 0x7261, 0x5e39, - 0x5672, 0x5e74, 0x5f5b, 0x5b53, 0x7a67, 0x5863, 0x7441, 0x5d37, - 0x7275, 0x542e, 0x5673, 0x5d38, 0x4f45, 0x5f5f, 0x723e, 0x7621, - 0x6b4b, 0x717c, 0x7347, 0x606b, 0x6d7c, 0x615b, 0x6e65, 0x5e75, - 0x7a53, 0x714b, 0x502f, 0x5d39, 0x5143, 0x7531, 0x6a46, 0x7061, - 0x762c, 0x7559, 0x706b, 0x5d3a, 0x723f, 0x7745, 0x5b22, 0x7276, - 0x4a3a, 0x7775, 0x4b65, 0x6e66, 0x6053, 0x4e25, 0x5658, 0x542f, - 0x6949, 0x534e, 0x7442, 0x4b66, 0x7121, 0x6b32, 0x7122, 0x6b33, - 0x7034, 0x4b74, 0x5430, 0x7332, 0x7b37, 0x756c, 0x6e67, 0x7432, - 0x756d, 0x4f73, 0x7062, 0x6e4e, 0x714c, 0x6538, 0x5775, 0x6373, - 0x4f65, 0x4f46, 0x7333, 0x6458, 0x4f79, 0x4f5a, 0x7a4d, 0x6663, - 0x7262, 0x756e, 0x4a3b, 0x635c, 0x4e72, 0x5659, 0x6e30, 0x7465, - 0x5842, 0x5c50, 0x4c6e, 0x5560, 0x764a, 0x7d4a, 0x5856, 0x744f, - 0x5626, 0x5c3e, 0x5b54, 0x5747, 0x727e, 0x714d, 0x6243, 0x5c5e, - 0x5c5f, 0x6f2d, 0x662b, 0x795d, 0x6a3f, 0x6f2e, 0x7450, 0x4e73, - 0x662c, 0x4e5e, 0x5579, 0x6374, 0x4d50, 0x5538, 0x777d, 0x5c29, - 0x5e76, 0x5c2a, 0x7263, 0x6934, 0x525c, 0x6966, 0x6376, 0x674a, - 0x504e, 0x5a77, 0x4a3c, 0x6e68, 0x5a5e, 0x7277, 0x627b, 0x4c26, - 0x5a3b, 0x6e69, 0x755a, 0x775c, 0x616a, 0x4e41, 0x5431, 0x7d31, - 0x663d, 0x7b2d, 0x7867, 0x614e, 0x7762, 0x756f, 0x4f47, 0x5432, - 0x4c6f, 0x5468, 0x6e4f, 0x7757, 0x6026, 0x5641, 0x615c, 0x7063, - 0x7164, 0x5c71, 0x5627, 0x7475, 0x714e, 0x7264, 0x5030, 0x6c6f, - 0x793a, 0x6b35, 0x546d, 0x6244, 0x6967, 0x6b34, 0x6a21, 0x783c, - 0x4e26, 0x7946, 0x7c5a, 0x5433, 0x5339, 0x6a5e, 0x692b, 0x6161, - 0x534f, 0x7476, 0x6a40, 0x614f, 0x4c3a, 0x6e6a, 0x7064, 0x7334, - 0x546e, 0x7240, 0x7165, 0x7443, 0x6054, 0x6b36, 0x5721, 0x4b68, - 0x792d, 0x692d, 0x5864, 0x7a33, 0x6245, 0x7c3d, 0x6c44, 0x5831, - 0x5c2b, 0x5524, 0x6b69, 0x683b, 0x5857, 0x7b2e, 0x5161, 0x5b40, - 0x753e, 0x5e77, 0x4a7b, 0x7746, 0x4f48, 0x6150, 0x6e50, 0x6974, - 0x4e74, 0x554d, 0x4f5b, 0x5d3b, 0x4e2c, 0x6968, 0x5434, 0x6447, - 0x755b, 0x7a41, 0x5e29, 0x5478, 0x6f77, 0x5333, 0x6b37, 0x6f78, - 0x755c, 0x6d4c, 0x5b55, 0x714f, 0x7150, 0x7532, 0x592e, 0x552c, - 0x6246, 0x7d23, 0x7b65, 0x5f2b, 0x6275, 0x762d, 0x7533, 0x7035, - 0x6125, 0x755d, 0x6c22, 0x6d7d, 0x7534, 0x7b38, 0x5b23, 0x564a, - 0x4b59, 0x6554, 0x737a, 0x6b38, 0x6037, 0x576c, 0x716c, 0x652f, - 0x5561, 0x576d, 0x5151, 0x6172, 0x6f79, 0x5d3c, 0x765c, 0x7065, - 0x7444, 0x6969, 0x737b, 0x546f, 0x4c22, 0x777e, 0x5f3c, 0x6b4d, - 0x5037, 0x5642, 0x682d, 0x6f2f, 0x4b25, 0x4b69, 0x7a68, 0x4c46, - 0x6667, 0x6a47, 0x5b24, 0x4f49, 0x627c, 0x6f7a, 0x6b5e, 0x7548, - 0x545e, 0x6055, 0x6f30, 0x6247, 0x592f, 0x7967, 0x6765, 0x4f4a, - 0x6151, 0x6248, 0x6f7b, 0x7a79, 0x5c72, 0x6027, 0x7868, 0x4b6a, - 0x4b3c, 0x5662, 0x755e, 0x755f, 0x6e36, 0x6276, 0x534a, 0x6f7c, - 0x5144, 0x6f31, 0x5145, 0x505e, 0x5961, 0x6038, 0x4d51, 0x7339, - 0x674c, 0x5628, 0x4e27, 0x5435, 0x6448, 0x5334, 0x6b39, 0x4b75, - 0x765d, 0x7123, 0x4c47, 0x694a, 0x6170, 0x7560, 0x7b2f, 0x4b51, - 0x7b60, 0x7265, 0x6c70, 0x706c, 0x6e6b, 0x694b, 0x4c70, 0x572f, - 0x7321, 0x7c75, 0x7124, 0x6056, 0x6f32, 0x7451, 0x7721, 0x7151, - 0x4a7c, 0x4a7d, 0x4e4e, 0x7348, 0x733a, 0x6d7e, 0x5a26, 0x606c, - 0x784d, 0x4b52, 0x6b4e, 0x7958, 0x7959, 0x4a60, 0x5a4a, 0x4b26, - 0x4a48, 0x796e, 0x5b6c, 0x5031, 0x556f, 0x6673, 0x6722, 0x6459, - 0x6461, 0x7c44, 0x796f, 0x4f74, 0x7766, 0x4e3c, 0x7445, 0x5c23, - 0x5d3d, 0x7446, 0x7821, 0x6856, 0x5b41, 0x7066, 0x6439, 0x766d, - 0x792e, 0x5d3e, 0x5730, 0x5868, 0x4b3d, 0x795a, 0x784e, 0x7970, - 0x606d, 0x6333, 0x7433, 0x6a42, 0x7266, 0x7036, 0x5b56, 0x6b64, - 0x7267, 0x5755, 0x5436, 0x7968, 0x5741, 0x6555, 0x696a, 0x574c, - 0x5369, 0x6249, 0x7c5b, 0x4d2d, 0x4c30, 0x6a22, 0x6476, 0x5040, - 0x7037, 0x6e21, 0x5776, 0x624a, 0x624b, 0x7a4f, 0x6b5f, 0x564b, - 0x7434, 0x6d4d, 0x6452, 0x6a29, 0x643a, 0x7322, 0x4d52, 0x764b, - 0x7166, 0x6d41, 0x683c, 0x6e51, 0x7067, 0x624c, 0x642a, 0x7561, - 0x6d5a, 0x576e, 0x5171, 0x696b, 0x696c, 0x6064, 0x5a27, 0x5d54, - 0x6a23, 0x5643, 0x5674, 0x5a5f, 0x6f33, 0x624d, 0x6f7d, 0x7268, - 0x6f45, 0x6767, 0x577d, 0x674e, 0x5f5c, 0x7947, 0x5976, 0x5f2c, - 0x565a, 0x5c24, 0x7038, 0x557a, 0x6477, 0x5644, 0x746c, 0x6f7e, - 0x7021, 0x5e2a, 0x5a3c, 0x587c, 0x7a54, 0x6c65, 0x7c28, 0x6c66, - 0x584b, 0x7b39, 0x6453, 0x4d79, 0x4f53, 0x4a6a, 0x4f54, 0x783d, - 0x7447, 0x6a5f, 0x795b, 0x5437, 0x6b65, 0x6152, 0x6a24, 0x7a42, - 0x7b61, 0x7a6d, 0x7022, 0x4c71, 0x7a23, 0x6277, 0x624e, 0x6975, - 0x616b, 0x6768, 0x6857, 0x5a78, 0x544b, 0x7776, 0x5645, 0x5469, - 0x7a7a, 0x4c72, 0x775d, 0x5e3a, 0x4e28, 0x7039, 0x647e, 0x6449, - 0x6454, 0x6a43, 0x6f34, 0x573e, 0x7b62, 0x4d53, 0x6f35, 0x7a69, - 0x7926, 0x5f3d, 0x7747, 0x787d, 0x787c, 0x5e2b, 0x5b68, 0x635d, - 0x6162, 0x5146, 0x7650, 0x6b66, 0x5a79, 0x6c47, 0x5e78, 0x7869, - 0x635e, 0x4e75, 0x7a43, 0x6557, 0x6c48, 0x7349, 0x643b, 0x662e, - 0x6f36, 0x5c3f, 0x4e3d, 0x5843, 0x504f, 0x4f7a, 0x734a, 0x6057, - 0x5147, 0x692e, 0x683d, 0x7a44, 0x624f, 0x7a45, 0x7938, 0x5c60, - 0x7b30, 0x5829, 0x655f, 0x7927, 0x766e, 0x764c, 0x6278, 0x6c71, - 0x5a60, 0x7152, 0x524c, 0x4f4b, 0x4a3d, 0x5d3f, 0x766f, 0x5e79, - 0x7a34, 0x552d, 0x7167, 0x5e3e, 0x5c40, 0x5148, 0x5149, 0x783e, - 0x4b76, 0x5479, 0x7562, 0x6153, 0x5869, 0x787e, 0x4f4c, 0x7d24, - 0x4e76, 0x7a50, 0x4c73, 0x663e, 0x762e, 0x5570, 0x514a, 0x7c3e, - 0x5571, 0x4d69, 0x7a35, 0x6250, 0x7477, 0x4d54, 0x6723, 0x5b25, - 0x6251, 0x5722, 0x7763, 0x6a26, 0x5021, 0x4e5a, 0x7b6b, 0x5b26, - 0x5b5e, 0x5865, 0x6a60, 0x582a, 0x6560, 0x565b, 0x6f46, 0x786a, - 0x6455, 0x4e77, 0x6058, 0x576f, 0x746d, 0x4d66, 0x4c74, 0x7563, - 0x644a, 0x5c61, 0x7948, 0x7c3f, 0x6827, 0x5844, 0x4b3e, 0x5c2e, - 0x5777, 0x7068, 0x5d40, 0x4f4d, 0x5c73, 0x5930, 0x6669, 0x643c, - 0x6a44, 0x646c, 0x6465, 0x7b78, 0x4c3b, 0x643d, 0x4d5c, 0x5977, - 0x5d5f, 0x6d4e, 0x5950, 0x6523, 0x794d, 0x4d2e, 0x4f4e, 0x762f, - 0x7d53, 0x6b6d, 0x565c, 0x6524, 0x5536, 0x565d, 0x7969, 0x6724, - 0x5663, 0x514b, 0x5664, 0x5572, 0x5e7a, 0x5778, 0x586a, 0x4f55, - 0x587d, 0x582b, 0x7d4b, 0x7c5c, 0x6028, 0x5573, 0x7d59, 0x4c23, - 0x5979, 0x536a, 0x7575, 0x6f47, 0x535a, 0x5a3d, 0x6828, 0x5c2f, - 0x7023, 0x4d55, 0x6029, 0x5e2c, 0x703a, 0x6e31, 0x6e32, 0x764d, - 0x6e52, 0x5646, 0x6065, 0x733b, 0x6561, 0x644b, 0x5723, 0x5b42, - 0x4a7e, 0x4f4f, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, - 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, - 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, - 0x3037, 0x3038, 0x3039, 0x303a, 0x303b, 0x303c, 0x303d, 0x303e, - 0x303f, 0x3040, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, - 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, - 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, - 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, - 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, - 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, - 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, - 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, - 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, - 0x3129, 0x312a, 0x312b, 0x312c, 0x312d, 0x312e, 0x312f, 0x3130, - 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, - 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, - 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, - 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, - 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, - 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, - 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, - 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, - 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, - 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x3221, 0x3222, - 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, - 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, - 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323a, - 0x323b, 0x323c, 0x323d, 0x323e, 0x323f, 0x3240, 0x3241, 0x3242, - 0x3243, 0x3244, 0x3245, 0x3246, 0x3247, 0x3248, 0x3249, 0x324a, - 0x324b, 0x324c, 0x324d, 0x324e, 0x324f, 0x3250, 0x3251, 0x3252, - 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a, - 0x325b, 0x325c, 0x325d, 0x325e, 0x325f, 0x3260, 0x3261, 0x3262, - 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, - 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, - 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, - 0x327b, 0x327c, 0x327d, 0x327e, 0x3321, 0x3322, 0x3323, 0x3324, - 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332a, 0x332b, 0x332c, - 0x332d, 0x332e, 0x332f, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, - 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333a, 0x333b, 0x333c, - 0x333d, 0x333e, 0x333f, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, - 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334a, 0x334b, 0x334c, - 0x334d, 0x334e, 0x334f, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, - 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335a, 0x335b, 0x335c, - 0x335d, 0x335e, 0x335f, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, - 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336a, 0x336b, 0x336c, - 0x336d, 0x336e, 0x336f, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, - 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, - 0x337d, 0x337e, 0x3421, 0x3422, 0x3423, 0x3424, 0x3425, 0x3426, - 0x3427, 0x3428, 0x3429, 0x342a, 0x342b, 0x342c, 0x342d, 0x342e, - 0x342f, 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, - 0x3437, 0x3438, 0x3439, 0x343a, 0x343b, 0x343c, 0x343d, 0x343e, - 0x343f, 0x3440, 0x3441, 0x3442, 0x3443, 0x3444, 0x3445, 0x3446, - 0x3447, 0x3448, 0x3449, 0x344a, 0x344b, 0x344c, 0x344d, 0x344e, - 0x344f, 0x3450, 0x3451, 0x3452, 0x3453, 0x3454, 0x3455, 0x3456, - 0x3457, 0x3458, 0x3459, 0x345a, 0x345b, 0x345c, 0x345d, 0x345e, - 0x345f, 0x3460, 0x3461, 0x3462, 0x3463, 0x3464, 0x3465, 0x3466, - 0x3467, 0x3468, 0x3469, 0x346a, 0x346b, 0x346c, 0x346d, 0x346e, - 0x346f, 0x3470, 0x3471, 0x3472, 0x3473, 0x3474, 0x3475, 0x3476, - 0x3477, 0x3478, 0x3479, 0x347a, 0x347b, 0x347c, 0x347d, 0x347e, - 0x3521, 0x3522, 0x3523, 0x3524, 0x3525, 0x3526, 0x3527, 0x3528, - 0x3529, 0x352a, 0x352b, 0x352c, 0x352d, 0x352e, 0x352f, 0x3530, - 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, - 0x3539, 0x353a, 0x353b, 0x353c, 0x353d, 0x353e, 0x353f, 0x3540, - 0x3541, 0x3542, 0x3543, 0x3544, 0x3545, 0x3546, 0x3547, 0x3548, - 0x3549, 0x354a, 0x354b, 0x354c, 0x354d, 0x354e, 0x354f, 0x3550, - 0x3551, 0x3552, 0x3553, 0x3554, 0x3555, 0x3556, 0x3557, 0x3558, - 0x3559, 0x355a, 0x355b, 0x355c, 0x355d, 0x355e, 0x355f, 0x3560, - 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, - 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, - 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x3576, 0x3577, 0x3578, - 0x3579, 0x357a, 0x357b, 0x357c, 0x357d, 0x357e, 0x3621, 0x3622, - 0x3623, 0x3624, 0x3625, 0x3626, 0x3627, 0x3628, 0x3629, 0x362a, - 0x362b, 0x362c, 0x362d, 0x362e, 0x362f, 0x3630, 0x3631, 0x3632, - 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, 0x363a, - 0x363b, 0x363c, 0x363d, 0x363e, 0x363f, 0x3640, 0x3641, 0x3642, - 0x3643, 0x3644, 0x3645, 0x3646, 0x3647, 0x3648, 0x3649, 0x364a, - 0x364b, 0x364c, 0x364d, 0x364e, 0x364f, 0x3650, 0x3651, 0x3652, - 0x3653, 0x3654, 0x3655, 0x3656, 0x3657, 0x3658, 0x3659, 0x365a, - 0x365b, 0x365c, 0x365d, 0x365e, 0x365f, 0x3660, 0x3661, 0x3662, - 0x3663, 0x3664, 0x3665, 0x3666, 0x3667, 0x3668, 0x3669, 0x366a, - 0x366b, 0x366c, 0x366d, 0x366e, 0x366f, 0x3670, 0x3671, 0x3672, - 0x3673, 0x3674, 0x3675, 0x3676, 0x3677, 0x3678, 0x3679, 0x367a, - 0x367b, 0x367c, 0x367d, 0x367e, 0x3721, 0x3722, 0x3723, 0x3724, - 0x3725, 0x3726, 0x3727, 0x3728, 0x3729, 0x372a, 0x372b, 0x372c, - 0x372d, 0x372e, 0x372f, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, - 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, - 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, - 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, - 0x374d, 0x374e, 0x374f, 0x3750, 0x3751, 0x3752, 0x3753, 0x3754, - 0x3755, 0x3756, 0x3757, 0x3758, 0x3759, 0x375a, 0x375b, 0x375c, - 0x375d, 0x375e, 0x375f, 0x3760, 0x3761, 0x3762, 0x3763, 0x3764, - 0x3765, 0x3766, 0x3767, 0x3768, 0x3769, 0x376a, 0x376b, 0x376c, - 0x376d, 0x376e, 0x376f, 0x3770, 0x3771, 0x3772, 0x3773, 0x3774, - 0x3775, 0x3776, 0x3777, 0x3778, 0x3779, 0x377a, 0x377b, 0x377c, - 0x377d, 0x377e, 0x3821, 0x3822, 0x3823, 0x3824, 0x3825, 0x3826, - 0x3827, 0x3828, 0x3829, 0x382a, 0x382b, 0x382c, 0x382d, 0x382e, - 0x382f, 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, - 0x3837, 0x3838, 0x3839, 0x383a, 0x383b, 0x383c, 0x383d, 0x383e, - 0x383f, 0x3840, 0x3841, 0x3842, 0x3843, 0x3844, 0x3845, 0x3846, - 0x3847, 0x3848, 0x3849, 0x384a, 0x384b, 0x384c, 0x384d, 0x384e, - 0x384f, 0x3850, 0x3851, 0x3852, 0x3853, 0x3854, 0x3855, 0x3856, - 0x3857, 0x3858, 0x3859, 0x385a, 0x385b, 0x385c, 0x385d, 0x385e, - 0x385f, 0x3860, 0x3861, 0x3862, 0x3863, 0x3864, 0x3865, 0x3866, - 0x3867, 0x3868, 0x3869, 0x386a, 0x386b, 0x386c, 0x386d, 0x386e, - 0x386f, 0x3870, 0x3871, 0x3872, 0x3873, 0x3874, 0x3875, 0x3876, - 0x3877, 0x3878, 0x3879, 0x387a, 0x387b, 0x387c, 0x387d, 0x387e, - 0x3921, 0x3922, 0x3923, 0x3924, 0x3925, 0x3926, 0x3927, 0x3928, - 0x3929, 0x392a, 0x392b, 0x392c, 0x392d, 0x392e, 0x392f, 0x3930, - 0x3931, 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, - 0x3939, 0x393a, 0x393b, 0x393c, 0x393d, 0x393e, 0x393f, 0x3940, - 0x3941, 0x3942, 0x3943, 0x3944, 0x3945, 0x3946, 0x3947, 0x3948, - 0x3949, 0x394a, 0x394b, 0x394c, 0x394d, 0x394e, 0x394f, 0x3950, - 0x3951, 0x3952, 0x3953, 0x3954, 0x3955, 0x3956, 0x3957, 0x3958, - 0x3959, 0x395a, 0x395b, 0x395c, 0x395d, 0x395e, 0x395f, 0x3960, - 0x3961, 0x3962, 0x3963, 0x3964, 0x3965, 0x3966, 0x3967, 0x3968, - 0x3969, 0x396a, 0x396b, 0x396c, 0x396d, 0x396e, 0x396f, 0x3970, - 0x3971, 0x3972, 0x3973, 0x3974, 0x3975, 0x3976, 0x3977, 0x3978, - 0x3979, 0x397a, 0x397b, 0x397c, 0x397d, 0x397e, 0x3a21, 0x3a22, - 0x3a23, 0x3a24, 0x3a25, 0x3a26, 0x3a27, 0x3a28, 0x3a29, 0x3a2a, - 0x3a2b, 0x3a2c, 0x3a2d, 0x3a2e, 0x3a2f, 0x3a30, 0x3a31, 0x3a32, - 0x3a33, 0x3a34, 0x3a35, 0x3a36, 0x3a37, 0x3a38, 0x3a39, 0x3a3a, - 0x3a3b, 0x3a3c, 0x3a3d, 0x3a3e, 0x3a3f, 0x3a40, 0x3a41, 0x3a42, - 0x3a43, 0x3a44, 0x3a45, 0x3a46, 0x3a47, 0x3a48, 0x3a49, 0x3a4a, - 0x3a4b, 0x3a4c, 0x3a4d, 0x3a4e, 0x3a4f, 0x3a50, 0x3a51, 0x3a52, - 0x3a53, 0x3a54, 0x3a55, 0x3a56, 0x3a57, 0x3a58, 0x3a59, 0x3a5a, - 0x3a5b, 0x3a5c, 0x3a5d, 0x3a5e, 0x3a5f, 0x3a60, 0x3a61, 0x3a62, - 0x3a63, 0x3a64, 0x3a65, 0x3a66, 0x3a67, 0x3a68, 0x3a69, 0x3a6a, - 0x3a6b, 0x3a6c, 0x3a6d, 0x3a6e, 0x3a6f, 0x3a70, 0x3a71, 0x3a72, - 0x3a73, 0x3a74, 0x3a75, 0x3a76, 0x3a77, 0x3a78, 0x3a79, 0x3a7a, - 0x3a7b, 0x3a7c, 0x3a7d, 0x3a7e, 0x3b21, 0x3b22, 0x3b23, 0x3b24, - 0x3b25, 0x3b26, 0x3b27, 0x3b28, 0x3b29, 0x3b2a, 0x3b2b, 0x3b2c, - 0x3b2d, 0x3b2e, 0x3b2f, 0x3b30, 0x3b31, 0x3b32, 0x3b33, 0x3b34, - 0x3b35, 0x3b36, 0x3b37, 0x3b38, 0x3b39, 0x3b3a, 0x3b3b, 0x3b3c, - 0x3b3d, 0x3b3e, 0x3b3f, 0x3b40, 0x3b41, 0x3b42, 0x3b43, 0x3b44, - 0x3b45, 0x3b46, 0x3b47, 0x3b48, 0x3b49, 0x3b4a, 0x3b4b, 0x3b4c, - 0x3b4d, 0x3b4e, 0x3b4f, 0x3b50, 0x3b51, 0x3b52, 0x3b53, 0x3b54, - 0x3b55, 0x3b56, 0x3b57, 0x3b58, 0x3b59, 0x3b5a, 0x3b5b, 0x3b5c, - 0x3b5d, 0x3b5e, 0x3b5f, 0x3b60, 0x3b61, 0x3b62, 0x3b63, 0x3b64, - 0x3b65, 0x3b66, 0x3b67, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x3b6c, - 0x3b6d, 0x3b6e, 0x3b6f, 0x3b70, 0x3b71, 0x3b72, 0x3b73, 0x3b74, - 0x3b75, 0x3b76, 0x3b77, 0x3b78, 0x3b79, 0x3b7a, 0x3b7b, 0x3b7c, - 0x3b7d, 0x3b7e, 0x3c21, 0x3c22, 0x3c23, 0x3c24, 0x3c25, 0x3c26, - 0x3c27, 0x3c28, 0x3c29, 0x3c2a, 0x3c2b, 0x3c2c, 0x3c2d, 0x3c2e, - 0x3c2f, 0x3c30, 0x3c31, 0x3c32, 0x3c33, 0x3c34, 0x3c35, 0x3c36, - 0x3c37, 0x3c38, 0x3c39, 0x3c3a, 0x3c3b, 0x3c3c, 0x3c3d, 0x3c3e, - 0x3c3f, 0x3c40, 0x3c41, 0x3c42, 0x3c43, 0x3c44, 0x3c45, 0x3c46, - 0x3c47, 0x3c48, 0x3c49, 0x3c4a, 0x3c4b, 0x3c4c, 0x3c4d, 0x3c4e, - 0x3c4f, 0x3c50, 0x3c51, 0x3c52, 0x3c53, 0x3c54, 0x3c55, 0x3c56, - 0x3c57, 0x3c58, 0x3c59, 0x3c5a, 0x3c5b, 0x3c5c, 0x3c5d, 0x3c5e, - 0x3c5f, 0x3c60, 0x3c61, 0x3c62, 0x3c63, 0x3c64, 0x3c65, 0x3c66, - 0x3c67, 0x3c68, 0x3c69, 0x3c6a, 0x3c6b, 0x3c6c, 0x3c6d, 0x3c6e, - 0x3c6f, 0x3c70, 0x3c71, 0x3c72, 0x3c73, 0x3c74, 0x3c75, 0x3c76, - 0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c, 0x3c7d, 0x3c7e, - 0x3d21, 0x3d22, 0x3d23, 0x3d24, 0x3d25, 0x3d26, 0x3d27, 0x3d28, - 0x3d29, 0x3d2a, 0x3d2b, 0x3d2c, 0x3d2d, 0x3d2e, 0x3d2f, 0x3d30, - 0x3d31, 0x3d32, 0x3d33, 0x3d34, 0x3d35, 0x3d36, 0x3d37, 0x3d38, - 0x3d39, 0x3d3a, 0x3d3b, 0x3d3c, 0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, - 0x3d41, 0x3d42, 0x3d43, 0x3d44, 0x3d45, 0x3d46, 0x3d47, 0x3d48, - 0x3d49, 0x3d4a, 0x3d4b, 0x3d4c, 0x3d4d, 0x3d4e, 0x3d4f, 0x3d50, - 0x3d51, 0x3d52, 0x3d53, 0x3d54, 0x3d55, 0x3d56, 0x3d57, 0x3d58, - 0x3d59, 0x3d5a, 0x3d5b, 0x3d5c, 0x3d5d, 0x3d5e, 0x3d5f, 0x3d60, - 0x3d61, 0x3d62, 0x3d63, 0x3d64, 0x3d65, 0x3d66, 0x3d67, 0x3d68, - 0x3d69, 0x3d6a, 0x3d6b, 0x3d6c, 0x3d6d, 0x3d6e, 0x3d6f, 0x3d70, - 0x3d71, 0x3d72, 0x3d73, 0x3d74, 0x3d75, 0x3d76, 0x3d77, 0x3d78, - 0x3d79, 0x3d7a, 0x3d7b, 0x3d7c, 0x3d7d, 0x3d7e, 0x3e21, 0x3e22, - 0x3e23, 0x3e24, 0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x3e29, 0x3e2a, - 0x3e2b, 0x3e2c, 0x3e2d, 0x3e2e, 0x3e2f, 0x3e30, 0x3e31, 0x3e32, - 0x3e33, 0x3e34, 0x3e35, 0x3e36, 0x3e37, 0x3e38, 0x3e39, 0x3e3a, - 0x3e3b, 0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x3e41, 0x3e42, - 0x3e43, 0x3e44, 0x3e45, 0x3e46, 0x3e47, 0x3e48, 0x3e49, 0x3e4a, - 0x3e4b, 0x3e4c, 0x3e4d, 0x3e4e, 0x3e4f, 0x3e50, 0x3e51, 0x3e52, - 0x3e53, 0x3e54, 0x3e55, 0x3e56, 0x3e57, 0x3e58, 0x3e59, 0x3e5a, - 0x3e5b, 0x3e5c, 0x3e5d, 0x3e5e, 0x3e5f, 0x3e60, 0x3e61, 0x3e62, - 0x3e63, 0x3e64, 0x3e65, 0x3e66, 0x3e67, 0x3e68, 0x3e69, 0x3e6a, - 0x3e6b, 0x3e6c, 0x3e6d, 0x3e6e, 0x3e6f, 0x3e70, 0x3e71, 0x3e72, - 0x3e73, 0x3e74, 0x3e75, 0x3e76, 0x3e77, 0x3e78, 0x3e79, 0x3e7a, - 0x3e7b, 0x3e7c, 0x3e7d, 0x3e7e, 0x3f21, 0x3f22, 0x3f23, 0x3f24, - 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, - 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, - 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, - 0x3f3d, 0x3f3e, 0x3f3f, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, - 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, - 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, - 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, - 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, - 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, - 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, - 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, - 0x3f7d, 0x3f7e, 0x4021, 0x4022, 0x4023, 0x4024, 0x4025, 0x4026, - 0x4027, 0x4028, 0x4029, 0x402a, 0x402b, 0x402c, 0x402d, 0x402e, - 0x402f, 0x4030, 0x4031, 0x4032, 0x4033, 0x4034, 0x4035, 0x4036, - 0x4037, 0x4038, 0x4039, 0x403a, 0x403b, 0x403c, 0x403d, 0x403e, - 0x403f, 0x4040, 0x4041, 0x4042, 0x4043, 0x4044, 0x4045, 0x4046, - 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d, 0x404e, - 0x404f, 0x4050, 0x4051, 0x4052, 0x4053, 0x4054, 0x4055, 0x4056, - 0x4057, 0x4058, 0x4059, 0x405a, 0x405b, 0x405c, 0x405d, 0x405e, - 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, - 0x4067, 0x4068, 0x4069, 0x406a, 0x406b, 0x406c, 0x406d, 0x406e, - 0x406f, 0x4070, 0x4071, 0x4072, 0x4073, 0x4074, 0x4075, 0x4076, - 0x4077, 0x4078, 0x4079, 0x407a, 0x407b, 0x407c, 0x407d, 0x407e, - 0x4121, 0x4122, 0x4123, 0x4124, 0x4125, 0x4126, 0x4127, 0x4128, - 0x4129, 0x412a, 0x412b, 0x412c, 0x412d, 0x412e, 0x412f, 0x4130, - 0x4131, 0x4132, 0x4133, 0x4134, 0x4135, 0x4136, 0x4137, 0x4138, - 0x4139, 0x413a, 0x413b, 0x413c, 0x413d, 0x413e, 0x413f, 0x4140, - 0x4141, 0x4142, 0x4143, 0x4144, 0x4145, 0x4146, 0x4147, 0x4148, - 0x4149, 0x414a, 0x414b, 0x414c, 0x414d, 0x414e, 0x414f, 0x4150, - 0x4151, 0x4152, 0x4153, 0x4154, 0x4155, 0x4156, 0x4157, 0x4158, - 0x4159, 0x415a, 0x415b, 0x415c, 0x415d, 0x415e, 0x415f, 0x4160, - 0x4161, 0x4162, 0x4163, 0x4164, 0x4165, 0x4166, 0x4167, 0x4168, - 0x4169, 0x416a, 0x416b, 0x416c, 0x416d, 0x416e, 0x416f, 0x4170, - 0x4171, 0x4172, 0x4173, 0x4174, 0x4175, 0x4176, 0x4177, 0x4178, - 0x4179, 0x417a, 0x417b, 0x417c, 0x417d, 0x417e, 0x4221, 0x4222, - 0x4223, 0x4224, 0x4225, 0x4226, 0x4227, 0x4228, 0x4229, 0x422a, - 0x422b, 0x422c, 0x422d, 0x422e, 0x422f, 0x4230, 0x4231, 0x4232, - 0x4233, 0x4234, 0x4235, 0x4236, 0x4237, 0x4238, 0x4239, 0x423a, - 0x423b, 0x423c, 0x423d, 0x423e, 0x423f, 0x4240, 0x4241, 0x4242, - 0x4243, 0x4244, 0x4245, 0x4246, 0x4247, 0x4248, 0x4249, 0x424a, - 0x424b, 0x424c, 0x424d, 0x424e, 0x424f, 0x4250, 0x4251, 0x4252, - 0x4253, 0x4254, 0x4255, 0x4256, 0x4257, 0x4258, 0x4259, 0x425a, - 0x425b, 0x425c, 0x425d, 0x425e, 0x425f, 0x4260, 0x4261, 0x4262, - 0x4263, 0x4264, 0x4265, 0x4266, 0x4267, 0x4268, 0x4269, 0x426a, - 0x426b, 0x426c, 0x426d, 0x426e, 0x426f, 0x4270, 0x4271, 0x4272, - 0x4273, 0x4274, 0x4275, 0x4276, 0x4277, 0x4278, 0x4279, 0x427a, - 0x427b, 0x427c, 0x427d, 0x427e, 0x4321, 0x4322, 0x4323, 0x4324, - 0x4325, 0x4326, 0x4327, 0x4328, 0x4329, 0x432a, 0x432b, 0x432c, - 0x432d, 0x432e, 0x432f, 0x4330, 0x4331, 0x4332, 0x4333, 0x4334, - 0x4335, 0x4336, 0x4337, 0x4338, 0x4339, 0x433a, 0x433b, 0x433c, - 0x433d, 0x433e, 0x433f, 0x4340, 0x4341, 0x4342, 0x4343, 0x4344, - 0x4345, 0x4346, 0x4347, 0x4348, 0x4349, 0x434a, 0x434b, 0x434c, - 0x434d, 0x434e, 0x434f, 0x4350, 0x4351, 0x4352, 0x4353, 0x4354, - 0x4355, 0x4356, 0x4357, 0x4358, 0x4359, 0x435a, 0x435b, 0x435c, - 0x435d, 0x435e, 0x435f, 0x4360, 0x4361, 0x4362, 0x4363, 0x4364, - 0x4365, 0x4366, 0x4367, 0x4368, 0x4369, 0x436a, 0x436b, 0x436c, - 0x436d, 0x436e, 0x436f, 0x4370, 0x4371, 0x4372, 0x4373, 0x4374, - 0x4375, 0x4376, 0x4377, 0x4378, 0x4379, 0x437a, 0x437b, 0x437c, - 0x437d, 0x437e, 0x4421, 0x4422, 0x4423, 0x4424, 0x4425, 0x4426, - 0x4427, 0x4428, 0x4429, 0x442a, 0x442b, 0x442c, 0x442d, 0x442e, - 0x442f, 0x4430, 0x4431, 0x4432, 0x4433, 0x4434, 0x4435, 0x4436, - 0x4437, 0x4438, 0x4439, 0x443a, 0x443b, 0x443c, 0x443d, 0x443e, - 0x443f, 0x4440, 0x4441, 0x4442, 0x4443, 0x4444, 0x4445, 0x4446, - 0x4447, 0x4448, 0x4449, 0x444a, 0x444b, 0x444c, 0x444d, 0x444e, - 0x444f, 0x4450, 0x4451, 0x4452, 0x4453, 0x4454, 0x4455, 0x4456, - 0x4457, 0x4458, 0x4459, 0x445a, 0x445b, 0x445c, 0x445d, 0x445e, - 0x445f, 0x4460, 0x4461, 0x4462, 0x4463, 0x4464, 0x4465, 0x4466, - 0x4467, 0x4468, 0x4469, 0x446a, 0x446b, 0x446c, 0x446d, 0x446e, - 0x446f, 0x4470, 0x4471, 0x4472, 0x4473, 0x4474, 0x4475, 0x4476, - 0x4477, 0x4478, 0x4479, 0x447a, 0x447b, 0x447c, 0x447d, 0x447e, - 0x4521, 0x4522, 0x4523, 0x4524, 0x4525, 0x4526, 0x4527, 0x4528, - 0x4529, 0x452a, 0x452b, 0x452c, 0x452d, 0x452e, 0x452f, 0x4530, - 0x4531, 0x4532, 0x4533, 0x4534, 0x4535, 0x4536, 0x4537, 0x4538, - 0x4539, 0x453a, 0x453b, 0x453c, 0x453d, 0x453e, 0x453f, 0x4540, - 0x4541, 0x4542, 0x4543, 0x4544, 0x4545, 0x4546, 0x4547, 0x4548, - 0x4549, 0x454a, 0x454b, 0x454c, 0x454d, 0x454e, 0x454f, 0x4550, - 0x4551, 0x4552, 0x4553, 0x4554, 0x4555, 0x4556, 0x4557, 0x4558, - 0x4559, 0x455a, 0x455b, 0x455c, 0x455d, 0x455e, 0x455f, 0x4560, - 0x4561, 0x4562, 0x4563, 0x4564, 0x4565, 0x4566, 0x4567, 0x4568, - 0x4569, 0x456a, 0x456b, 0x456c, 0x456d, 0x456e, 0x456f, 0x4570, - 0x4571, 0x4572, 0x4573, 0x4574, 0x4575, 0x4576, 0x4577, 0x4578, - 0x4579, 0x457a, 0x457b, 0x457c, 0x457d, 0x457e, 0x4621, 0x4622, - 0x4623, 0x4624, 0x4625, 0x4626, 0x4627, 0x4628, 0x4629, 0x462a, - 0x462b, 0x462c, 0x462d, 0x462e, 0x462f, 0x4630, 0x4631, 0x4632, - 0x4633, 0x4634, 0x4635, 0x4636, 0x4637, 0x4638, 0x4639, 0x463a, - 0x463b, 0x463c, 0x463d, 0x463e, 0x463f, 0x4640, 0x4641, 0x4642, - 0x4643, 0x4644, 0x4645, 0x4646, 0x4647, 0x4648, 0x4649, 0x464a, - 0x464b, 0x464c, 0x464d, 0x464e, 0x464f, 0x4650, 0x4651, 0x4652, - 0x4653, 0x4654, 0x4655, 0x4656, 0x4657, 0x4658, 0x4659, 0x465a, - 0x465b, 0x465c, 0x465d, 0x465e, 0x465f, 0x4660, 0x4661, 0x4662, - 0x4663, 0x4664, 0x4665, 0x4666, 0x4667, 0x4668, 0x4669, 0x466a, - 0x466b, 0x466c, 0x466d, 0x466e, 0x466f, 0x4670, 0x4671, 0x4672, - 0x4673, 0x4674, 0x4675, 0x4676, 0x4677, 0x4678, 0x4679, 0x467a, - 0x467b, 0x467c, 0x467d, 0x467e, 0x4721, 0x4722, 0x4723, 0x4724, - 0x4725, 0x4726, 0x4727, 0x4728, 0x4729, 0x472a, 0x472b, 0x472c, - 0x472d, 0x472e, 0x472f, 0x4730, 0x4731, 0x4732, 0x4733, 0x4734, - 0x4735, 0x4736, 0x4737, 0x4738, 0x4739, 0x473a, 0x473b, 0x473c, - 0x473d, 0x473e, 0x473f, 0x4740, 0x4741, 0x4742, 0x4743, 0x4744, - 0x4745, 0x4746, 0x4747, 0x4748, 0x4749, 0x474a, 0x474b, 0x474c, - 0x474d, 0x474e, 0x474f, 0x4750, 0x4751, 0x4752, 0x4753, 0x4754, - 0x4755, 0x4756, 0x4757, 0x4758, 0x4759, 0x475a, 0x475b, 0x475c, - 0x475d, 0x475e, 0x475f, 0x4760, 0x4761, 0x4762, 0x4763, 0x4764, - 0x4765, 0x4766, 0x4767, 0x4768, 0x4769, 0x476a, 0x476b, 0x476c, - 0x476d, 0x476e, 0x476f, 0x4770, 0x4771, 0x4772, 0x4773, 0x4774, - 0x4775, 0x4776, 0x4777, 0x4778, 0x4779, 0x477a, 0x477b, 0x477c, - 0x477d, 0x477e, 0x4821, 0x4822, 0x4823, 0x4824, 0x4825, 0x4826, - 0x4827, 0x4828, 0x4829, 0x482a, 0x482b, 0x482c, 0x482d, 0x482e, - 0x482f, 0x4830, 0x4831, 0x4832, 0x4833, 0x4834, 0x4835, 0x4836, - 0x4837, 0x4838, 0x4839, 0x483a, 0x483b, 0x483c, 0x483d, 0x483e, - 0x483f, 0x4840, 0x4841, 0x4842, 0x4843, 0x4844, 0x4845, 0x4846, - 0x4847, 0x4848, 0x4849, 0x484a, 0x484b, 0x484c, 0x484d, 0x484e, - 0x484f, 0x4850, 0x4851, 0x4852, 0x4853, 0x4854, 0x4855, 0x4856, - 0x4857, 0x4858, 0x4859, 0x485a, 0x485b, 0x485c, 0x485d, 0x485e, - 0x485f, 0x4860, 0x4861, 0x4862, 0x4863, 0x4864, 0x4865, 0x4866, - 0x4867, 0x4868, 0x4869, 0x486a, 0x486b, 0x486c, 0x486d, 0x486e, - 0x486f, 0x4870, 0x4871, 0x4872, 0x4873, 0x4874, 0x4875, 0x4876, - 0x4877, 0x4878, 0x4879, 0x487a, 0x487b, 0x487c, 0x487d, 0x487e, - 0x4b50, 0x4b56, 0x4b67, 0x4d4f, 0x4d68, 0x4e2d, 0x4f7b, 0x5022, - 0x5038, 0x5050, 0x505d, 0x5154, 0x5155, 0x5158, 0x515b, 0x515c, - 0x515d, 0x515e, 0x515f, 0x5160, 0x5162, 0x5163, 0x5164, 0x5165, - 0x5166, 0x5168, 0x5169, 0x516a, 0x516b, 0x516d, 0x516f, 0x5170, - 0x5172, 0x5176, 0x517a, 0x517c, 0x517d, 0x517e, 0x5222, 0x5223, - 0x5227, 0x5228, 0x5229, 0x522a, 0x522b, 0x522d, 0x5232, 0x523e, - 0x5242, 0x5243, 0x5244, 0x5246, 0x5247, 0x5248, 0x5249, 0x524a, - 0x524b, 0x524d, 0x524e, 0x524f, 0x5250, 0x5251, 0x5252, 0x5253, - 0x5254, 0x5255, 0x5256, 0x5257, 0x5259, 0x525a, 0x525e, 0x525f, - 0x5261, 0x5262, 0x5264, 0x5265, 0x5266, 0x5267, 0x5268, 0x5269, - 0x526a, 0x526b, 0x5270, 0x5271, 0x5272, 0x5273, 0x5274, 0x5275, - 0x5277, 0x5278, 0x5466, 0x547c, 0x5525, 0x552b, 0x552e, 0x5638, - 0x564d, 0x574b, 0x5764, 0x5b45, 0x5b64, 0x5c25, 0x5d25, 0x5d55, - 0x5d74, 0x5e7c, 0x5e7e, 0x5f33, 0x5f61, 0x5f68, 0x6071, 0x612d, - 0x616d, 0x6375, 0x6421, 0x6429, 0x652e, 0x6531, 0x6532, 0x6539, - 0x653b, 0x653c, 0x6544, 0x654e, 0x6550, 0x6552, 0x6556, 0x657a, - 0x657b, 0x657c, 0x657e, 0x6621, 0x6624, 0x6627, 0x662d, 0x662f, - 0x6630, 0x6631, 0x6633, 0x6637, 0x6638, 0x663c, 0x6644, 0x6646, - 0x6647, 0x664a, 0x6652, 0x6656, 0x6659, 0x665c, 0x665f, 0x6661, - 0x6664, 0x6665, 0x6666, 0x6668, 0x666a, 0x666b, 0x666c, 0x666f, - 0x6671, 0x6672, 0x6675, 0x6676, 0x6677, 0x6679, 0x6721, 0x6726, - 0x6729, 0x672a, 0x672c, 0x672d, 0x6730, 0x673f, 0x6741, 0x6746, - 0x6747, 0x674b, 0x674d, 0x674f, 0x6750, 0x6753, 0x675f, 0x6764, - 0x6766, 0x6777, 0x6867, 0x6868, 0x6870, 0x6871, 0x6877, 0x6879, - 0x687b, 0x687e, 0x6927, 0x692c, 0x694c, 0x6977, 0x6a41, 0x6a65, - 0x6a74, 0x6a77, 0x6a7c, 0x6a7e, 0x6b24, 0x6b27, 0x6b29, 0x6b2a, - 0x6b3a, 0x6b3b, 0x6b3d, 0x6b41, 0x6b42, 0x6b46, 0x6b47, 0x6b4c, - 0x6b4f, 0x6b50, 0x6b51, 0x6b52, 0x6b58, 0x6c26, 0x6c27, 0x6c2a, - 0x6c2f, 0x6c30, 0x6c31, 0x6c32, 0x6c35, 0x6c38, 0x6c3a, 0x6c40, - 0x6c41, 0x6c45, 0x6c46, 0x6c49, 0x6c4a, 0x6c55, 0x6c5d, 0x6c5e, - 0x6c61, 0x6c64, 0x6c67, 0x6c68, 0x6c77, 0x6c78, 0x6c7a, 0x6d21, - 0x6d22, 0x6d23, 0x6d6e, 0x6e5b, 0x723d, 0x727a, 0x7331, 0x7427, - 0x746e, 0x7674, 0x7676, 0x7738, 0x7748, 0x7753, 0x785b, 0x7870, - 0x7a21, 0x7a22, 0x7a66, 0x7c29, 0x2321, 0x2322, 0x2323, 0x2324, - 0x2325, 0x2326, 0x2327, 0x2328, 0x2329, 0x232a, 0x232b, 0x232c, - 0x232d, 0x232e, 0x232f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, - 0x2335, 0x2336, 0x2337, 0x2338, 0x2339, 0x233a, 0x233b, 0x233c, - 0x233d, 0x233e, 0x233f, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, - 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, - 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, - 0x2355, 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x235b, 0x212c, - 0x235d, 0x235e, 0x235f, 0x2360, 0x2361, 0x2362, 0x2363, 0x2364, - 0x2365, 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, - 0x236d, 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, - 0x2375, 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x237b, 0x237c, - 0x237d, 0x2226, 0x214b, 0x214c, 0x217e, 0x237e, 0x214d, 0x235c, -}; - -static const Summary16 ksc5601_uni2indx_page00[70] = { - /* 0x0000 */ - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, - { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x2592 }, { 6, 0xf7df }, - { 20, 0x0040 }, { 21, 0xc181 }, { 26, 0x0040 }, { 27, 0x4181 }, - /* 0x0100 */ - { 31, 0x0000 }, { 31, 0x0002 }, { 32, 0x00c0 }, { 34, 0x810e }, - { 39, 0x0e07 }, { 45, 0x000c }, { 47, 0x00c0 }, { 49, 0x0000 }, - { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, - { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, - /* 0x0200 */ - { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, - { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, - { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, - { 49, 0x0080 }, { 50, 0x2f01 }, { 56, 0x0000 }, { 56, 0x0000 }, - /* 0x0300 */ - { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, - { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, - { 56, 0x0000 }, { 56, 0xfffe }, { 71, 0x03fb }, { 80, 0xfffe }, - { 95, 0x03fb }, { 104, 0x0000 }, { 104, 0x0000 }, { 104, 0x0000 }, - /* 0x0400 */ - { 104, 0x0002 }, { 105, 0xffff }, { 121, 0xffff }, { 137, 0xffff }, - { 153, 0xffff }, { 169, 0x0002 }, -}; -static const Summary16 ksc5601_uni2indx_page20[103] = { - /* 0x2000 */ - { 170, 0x0000 }, { 170, 0x3320 }, { 175, 0x0063 }, { 179, 0x080d }, - { 183, 0x0000 }, { 183, 0x0000 }, { 183, 0x0000 }, { 183, 0x8010 }, - { 185, 0x001e }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, - { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, - /* 0x2100 */ - { 189, 0x0208 }, { 191, 0x0048 }, { 193, 0x0846 }, { 197, 0x0000 }, - { 197, 0x0000 }, { 197, 0x7818 }, { 203, 0x03ff }, { 213, 0x03ff }, - { 223, 0x0000 }, { 223, 0x03ff }, { 233, 0x0000 }, { 233, 0x0000 }, - { 233, 0x0000 }, { 233, 0x0014 }, { 235, 0x0000 }, { 235, 0x0000 }, - /* 0x2200 */ - { 235, 0x898d }, { 242, 0x6402 }, { 246, 0x5fa1 }, { 255, 0x3030 }, - { 259, 0x0000 }, { 259, 0x0004 }, { 260, 0x0c33 }, { 266, 0x0000 }, - { 266, 0x00cc }, { 270, 0x0200 }, { 271, 0x0020 }, { 272, 0x0000 }, - { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, - /* 0x2300 */ - { 272, 0x0000 }, { 272, 0x0004 }, { 273, 0x0000 }, { 273, 0x0000 }, - { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, - { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, - { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, - /* 0x2400 */ - { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, - { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x7fff }, { 288, 0xfff0 }, - { 300, 0x0007 }, { 303, 0xf000 }, { 307, 0xffff }, { 323, 0x003f }, - { 329, 0x0000 }, { 329, 0xffff }, { 345, 0x03ff }, { 355, 0x0000 }, - /* 0x2500 */ - { 355, 0xf00f }, { 363, 0xffff }, { 379, 0xffff }, { 395, 0xffff }, - { 411, 0x0fff }, { 423, 0x0000 }, { 423, 0x0000 }, { 423, 0x0000 }, - { 423, 0x0000 }, { 423, 0x0004 }, { 424, 0x03fb }, { 433, 0x30cc }, - { 439, 0xc9c3 }, { 447, 0x0003 }, { 449, 0x0000 }, { 449, 0x0000 }, - /* 0x2600 */ - { 449, 0xc060 }, { 453, 0x5000 }, { 455, 0x0000 }, { 455, 0x0000 }, - { 455, 0x0005 }, { 457, 0x0000 }, { 457, 0x37bb }, -}; -static const Summary16 ksc5601_uni2indx_page30[62] = { - /* 0x3000 */ - { 468, 0xff0f }, { 480, 0x003b }, { 485, 0x0000 }, { 485, 0x0000 }, - { 485, 0xfffe }, { 500, 0xffff }, { 516, 0xffff }, { 532, 0xffff }, - { 548, 0xffff }, { 564, 0x000f }, { 568, 0xfffe }, { 583, 0xffff }, - { 599, 0xffff }, { 615, 0xffff }, { 631, 0xffff }, { 647, 0x007f }, - /* 0x3100 */ - { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0xfffe }, - { 669, 0xffff }, { 685, 0xffff }, { 701, 0xffff }, { 717, 0xffff }, - { 733, 0x7fff }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, - { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, - /* 0x3200 */ - { 748, 0xffff }, { 764, 0x1fff }, { 777, 0x0000 }, { 777, 0x0000 }, - { 777, 0x0000 }, { 777, 0x0000 }, { 777, 0xffff }, { 793, 0x8fff }, - { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, - { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, - /* 0x3300 */ - { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, - { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, - { 806, 0xff1f }, { 819, 0xffff }, { 835, 0xffff }, { 851, 0xffff }, - { 867, 0x87ff }, { 879, 0x3949 }, -}; -static const Summary16 ksc5601_uni2indx_page4e[1306] = { - /* 0x4e00 */ - { 886, 0x2f8b }, { 895, 0x4372 }, { 902, 0x2000 }, { 903, 0x0b04 }, - { 907, 0xe82c }, { 914, 0xe340 }, { 920, 0x2800 }, { 922, 0x40c8 }, - { 926, 0x5944 }, { 932, 0x4937 }, { 940, 0x7976 }, { 950, 0x0440 }, - { 952, 0x2c93 }, { 959, 0xa3f0 }, { 967, 0x0038 }, { 970, 0x08c5 }, - /* 0x4f00 */ - { 975, 0xee02 }, { 982, 0x0003 }, { 984, 0x8000 }, { 985, 0x3550 }, - { 991, 0xe1c8 }, { 998, 0x1e23 }, { 1005, 0x8200 }, { 1007, 0xc449 }, - { 1013, 0xad5a }, { 1022, 0x2942 }, { 1027, 0xc000 }, { 1029, 0x8060 }, - { 1032, 0x461c }, { 1038, 0xa49a }, { 1045, 0xc003 }, { 1049, 0x052a }, - /* 0x5000 */ - { 1054, 0x2a44 }, { 1059, 0xd646 }, { 1067, 0x3dda }, { 1077, 0x0800 }, - { 1078, 0x8388 }, { 1083, 0x1420 }, { 1086, 0x0020 }, { 1087, 0x0170 }, - { 1091, 0x2021 }, { 1094, 0x0302 }, { 1097, 0x3000 }, { 1099, 0x40ac }, - { 1104, 0x8620 }, { 1108, 0x4462 }, { 1113, 0x20a0 }, { 1116, 0x8a00 }, - /* 0x5100 */ - { 1119, 0x0253 }, { 1124, 0x8004 }, { 1126, 0x0402 }, { 1128, 0x1484 }, - { 1132, 0x7bfb }, { 1145, 0x1004 }, { 1147, 0x7fa4 }, { 1157, 0x11e2 }, - { 1163, 0x2441 }, { 1167, 0x00a4 }, { 1170, 0x1421 }, { 1174, 0x20c0 }, - { 1177, 0x3a50 }, { 1183, 0x7000 }, { 1186, 0x0002 }, { 1187, 0x2743 }, - /* 0x5200 */ - { 1194, 0x45c9 }, { 1201, 0x2082 }, { 1204, 0x4630 }, { 1209, 0x0fc1 }, - { 1216, 0x3c88 }, { 1222, 0x2850 }, { 1226, 0x8602 }, { 1230, 0xa024 }, - { 1234, 0x2388 }, { 1239, 0x8806 }, { 1243, 0x0e19 }, { 1249, 0x4000 }, - { 1250, 0x22aa }, { 1256, 0xeb64 }, { 1265, 0x001c }, { 1268, 0xcd28 }, - /* 0x5300 */ - { 1275, 0xa120 }, { 1279, 0x02e1 }, { 1284, 0x840b }, { 1289, 0x8200 }, - { 1291, 0x279b }, { 1300, 0x549e }, { 1308, 0x8141 }, { 1312, 0xa0b3 }, - { 1319, 0x0010 }, { 1320, 0x8508 }, { 1324, 0x2061 }, { 1328, 0x0800 }, - { 1329, 0x2f08 }, { 1335, 0x08d0 }, { 1339, 0xbe3e }, { 1350, 0x010f }, - /* 0x5400 */ - { 1355, 0xf718 }, { 1364, 0xa803 }, { 1369, 0x0a41 }, { 1373, 0x5b08 }, - { 1379, 0x0504 }, { 1382, 0x0002 }, { 1383, 0x0500 }, { 1385, 0x382a }, - { 1391, 0x5041 }, { 1395, 0x0001 }, { 1396, 0x1910 }, { 1400, 0x2108 }, - { 1403, 0x0313 }, { 1408, 0x0000 }, { 1408, 0x6122 }, { 1413, 0x0404 }, - /* 0x5500 */ - { 1415, 0x40d0 }, { 1419, 0x1001 }, { 1421, 0x8000 }, { 1422, 0x4022 }, - { 1425, 0x8050 }, { 1428, 0x4048 }, { 1431, 0x0008 }, { 1432, 0x1000 }, - { 1433, 0x06d1 }, { 1439, 0x3700 }, { 1444, 0x5e80 }, { 1450, 0x0000 }, - { 1450, 0x00a0 }, { 1452, 0x9410 }, { 1456, 0x0018 }, { 1458, 0x6000 }, - /* 0x5600 */ - { 1460, 0x0240 }, { 1462, 0x0090 }, { 1464, 0x8000 }, { 1465, 0x0054 }, - { 1468, 0x0000 }, { 1468, 0x0008 }, { 1469, 0x0900 }, { 1471, 0x0010 }, - { 1472, 0x0040 }, { 1473, 0x0000 }, { 1473, 0x5020 }, { 1476, 0x1010 }, - { 1478, 0x2400 }, { 1480, 0x4c02 }, { 1484, 0x0001 }, { 1485, 0x0601 }, - /* 0x5700 */ - { 1488, 0x2918 }, { 1493, 0x814c }, { 1498, 0x2100 }, { 1500, 0x0801 }, - { 1502, 0x6485 }, { 1508, 0x0003 }, { 1510, 0x4452 }, { 1515, 0x1021 }, - { 1518, 0x0904 }, { 1521, 0x0008 }, { 1522, 0x000d }, { 1525, 0x0000 }, - { 1525, 0x4988 }, { 1530, 0x8000 }, { 1531, 0x0001 }, { 1532, 0x1691 }, - /* 0x5800 */ - { 1538, 0x0765 }, { 1545, 0x4000 }, { 1546, 0x8492 }, { 1551, 0x0433 }, - { 1556, 0x8c00 }, { 1559, 0x4592 }, { 1565, 0x0016 }, { 1568, 0x5220 }, - { 1572, 0x0228 }, { 1575, 0xd008 }, { 1579, 0x4300 }, { 1582, 0x4c08 }, - { 1586, 0x40a2 }, { 1590, 0xc32a }, { 1597, 0x9810 }, { 1601, 0x2e00 }, - /* 0x5900 */ - { 1605, 0x8000 }, { 1606, 0x1670 }, { 1612, 0x6e84 }, { 1619, 0x4082 }, - { 1622, 0xc390 }, { 1628, 0x04b3 }, { 1634, 0x7c85 }, { 1642, 0x2118 }, - { 1646, 0x041c }, { 1650, 0x02c8 }, { 1654, 0x1120 }, { 1657, 0x4a00 }, - { 1660, 0x0a48 }, { 1664, 0x361b }, { 1672, 0x5540 }, { 1677, 0x8900 }, - /* 0x5a00 */ - { 1680, 0x000a }, { 1682, 0x9902 }, { 1687, 0x0221 }, { 1690, 0x1040 }, - { 1692, 0x0242 }, { 1695, 0x0400 }, { 1696, 0x0044 }, { 1698, 0x0000 }, - { 1698, 0x0000 }, { 1698, 0x0c04 }, { 1701, 0x0010 }, { 1702, 0x0000 }, - { 1702, 0x1216 }, { 1707, 0x0000 }, { 1707, 0x0242 }, { 1710, 0x0000 }, - /* 0x5b00 */ - { 1710, 0x1a20 }, { 1714, 0x0040 }, { 1715, 0x0400 }, { 1716, 0x0000 }, - { 1716, 0x0009 }, { 1718, 0xb5b3 }, { 1728, 0x0a18 }, { 1732, 0x1523 }, - { 1738, 0x9ba0 }, { 1745, 0x1fe8 }, { 1754, 0x507c }, { 1761, 0x8379 }, - { 1769, 0x10fd }, { 1777, 0xc09d }, { 1784, 0xdbf6 }, { 1796, 0x0560 }, - /* 0x5c00 */ - { 1800, 0xef92 }, { 1810, 0x0242 }, { 1813, 0x0110 }, { 1815, 0xdf02 }, - { 1823, 0x6961 }, { 1830, 0x0822 }, { 1833, 0x9035 }, { 1839, 0x0202 }, - { 1841, 0x0000 }, { 1841, 0x0003 }, { 1843, 0x1a02 }, { 1847, 0x45aa }, - { 1854, 0x0001 }, { 1855, 0x0200 }, { 1856, 0x8101 }, { 1859, 0x2851 }, - /* 0x5d00 */ - { 1864, 0x6080 }, { 1867, 0x02d2 }, { 1872, 0x0280 }, { 1874, 0x0000 }, - { 1874, 0x1800 }, { 1876, 0x0001 }, { 1877, 0x9200 }, { 1880, 0x0000 }, - { 1880, 0x0880 }, { 1882, 0x2000 }, { 1883, 0x0405 }, { 1886, 0x3500 }, - { 1890, 0x2000 }, { 1891, 0x6044 }, { 1895, 0x49e6 }, { 1903, 0x609e }, - /* 0x5e00 */ - { 1910, 0x104c }, { 1914, 0x2a42 }, { 1919, 0x2820 }, { 1922, 0xa148 }, - { 1927, 0x10b1 }, { 1932, 0x8020 }, { 1934, 0x000e }, { 1937, 0x7b9c }, - { 1947, 0x8490 }, { 1951, 0x14a0 }, { 1955, 0x28c1 }, { 1960, 0x41e0 }, - { 1965, 0x0704 }, { 1969, 0x8c49 }, { 1975, 0x100d }, { 1979, 0x0cc8 }, - /* 0x5f00 */ - { 1984, 0x8412 }, { 1988, 0x89ba }, { 1996, 0x02c0 }, { 1999, 0x1422 }, - { 2003, 0x5500 }, { 2007, 0x0ac0 }, { 2011, 0x3ec4 }, { 2019, 0x9283 }, - { 2025, 0x1ca3 }, { 2032, 0x4387 }, { 2039, 0x4703 }, { 2045, 0x22a0 }, - { 2049, 0x3028 }, { 2053, 0x03c0 }, { 2057, 0x0801 }, { 2059, 0xa020 }, - /* 0x6000 */ - { 2062, 0x8000 }, { 2063, 0x3044 }, { 2067, 0x85a3 }, { 2074, 0x0000 }, - { 2074, 0x200e }, { 2078, 0x2225 }, { 2083, 0xb73c }, { 2093, 0x0001 }, - { 2094, 0x3220 }, { 2098, 0x8c50 }, { 2103, 0x0099 }, { 2107, 0x315d }, - { 2115, 0x00a0 }, { 2117, 0x9402 }, { 2121, 0x0003 }, { 2123, 0x0e4b }, - /* 0x6100 */ - { 2130, 0xe342 }, { 2137, 0x8c20 }, { 2141, 0x0080 }, { 2142, 0xd091 }, - { 2148, 0x1d94 }, { 2155, 0xa328 }, { 2161, 0x499c }, { 2168, 0x60c1 }, - { 2173, 0x4406 }, { 2177, 0x0713 }, { 2183, 0x5a90 }, { 2189, 0x4444 }, - { 2193, 0x0f88 }, { 2199, 0x0000 }, { 2199, 0x0040 }, { 2200, 0x95c4 }, - /* 0x6200 */ - { 2207, 0x7581 }, { 2214, 0x8447 }, { 2220, 0x4402 }, { 2223, 0xc053 }, - { 2229, 0x2b83 }, { 2236, 0x0108 }, { 2238, 0x4000 }, { 2239, 0x9242 }, - { 2244, 0x0611 }, { 2248, 0x09a6 }, { 2254, 0x0800 }, { 2255, 0x3222 }, - { 2260, 0xb384 }, { 2267, 0x1bdd }, { 2277, 0xf000 }, { 2281, 0xc08a }, - /* 0x6300 */ - { 2286, 0x0282 }, { 2289, 0x0002 }, { 2290, 0x8800 }, { 2292, 0x6c00 }, - { 2296, 0x9200 }, { 2299, 0x0021 }, { 2301, 0x4180 }, { 2304, 0x8c84 }, - { 2309, 0x1308 }, { 2313, 0x0944 }, { 2317, 0x07a7 }, { 2325, 0x0000 }, - { 2325, 0x8051 }, { 2329, 0x0c41 }, { 2333, 0x6002 }, { 2336, 0x00d0 }, - /* 0x6400 */ - { 2339, 0xa000 }, { 2341, 0x10d0 }, { 2345, 0x3004 }, { 2348, 0x4400 }, - { 2350, 0x0000 }, { 2350, 0x0100 }, { 2351, 0x8201 }, { 2354, 0x0700 }, - { 2357, 0x0100 }, { 2358, 0x440e }, { 2363, 0x6830 }, { 2368, 0x0805 }, - { 2371, 0x64b2 }, { 2378, 0x0514 }, { 2382, 0x10e6 }, { 2388, 0x4414 }, - /* 0x6500 */ - { 2392, 0x0011 }, { 2394, 0x2100 }, { 2396, 0x9c08 }, { 2401, 0xcbc0 }, - { 2408, 0xe120 }, { 2413, 0x40c2 }, { 2417, 0x304c }, { 2422, 0x41b4 }, - { 2428, 0x10ac }, { 2433, 0x9a83 }, { 2440, 0x98b2 }, { 2447, 0x3281 }, - { 2452, 0x9822 }, { 2457, 0x0084 }, { 2459, 0x3369 }, { 2467, 0xbc12 }, - /* 0x6600 */ - { 2474, 0xd6c0 }, { 2481, 0xc03b }, { 2488, 0xa1a1 }, { 2494, 0x0c53 }, - { 2500, 0x8a1e }, { 2507, 0xea00 }, { 2512, 0xcbf0 }, { 2521, 0x05d8 }, - { 2527, 0x4390 }, { 2532, 0x21c3 }, { 2538, 0x4805 }, { 2542, 0x4a1c }, - { 2548, 0x02d0 }, { 2552, 0x3240 }, { 2556, 0x0041 }, { 2558, 0xd79d }, - /* 0x6700 */ - { 2569, 0x2b09 }, { 2575, 0xe8b0 }, { 2582, 0x7dc0 }, { 2590, 0x2452 }, - { 2595, 0xc240 }, { 2599, 0xd04b }, { 2606, 0xa000 }, { 2608, 0xc8ab }, - { 2616, 0x8a80 }, { 2620, 0x34a9 }, { 2627, 0x8000 }, { 2628, 0x41c9 }, - { 2634, 0x8010 }, { 2636, 0x241f }, { 2643, 0x9200 }, { 2646, 0x487b }, - /* 0x6800 */ - { 2654, 0x0000 }, { 2654, 0x00cc }, { 2658, 0x8406 }, { 2662, 0x3300 }, - { 2666, 0x410f }, { 2672, 0x001b }, { 2676, 0x2000 }, { 2677, 0x8040 }, - { 2679, 0x8022 }, { 2682, 0xa098 }, { 2687, 0xa186 }, { 2693, 0x006b }, - { 2698, 0x2a30 }, { 2703, 0x85a4 }, { 2709, 0x4181 }, { 2713, 0x0604 }, - /* 0x6900 */ - { 2716, 0x6021 }, { 2720, 0x0004 }, { 2721, 0x0080 }, { 2722, 0xa001 }, - { 2725, 0x0400 }, { 2726, 0x46b8 }, { 2733, 0xe90f }, { 2742, 0x03a0 }, - { 2746, 0x0000 }, { 2746, 0x1820 }, { 2749, 0x40a0 }, { 2752, 0x0810 }, - { 2754, 0x380a }, { 2759, 0x0001 }, { 2760, 0x0500 }, { 2762, 0xa800 }, - /* 0x6a00 */ - { 2765, 0x0404 }, { 2767, 0xc28a }, { 2773, 0x000a }, { 2775, 0x2720 }, - { 2780, 0x0910 }, { 2783, 0x830c }, { 2788, 0x0802 }, { 2790, 0x0000 }, - { 2790, 0x6211 }, { 2795, 0x1080 }, { 2797, 0x000c }, { 2799, 0x0808 }, - { 2801, 0x000c }, { 2803, 0x0c08 }, { 2806, 0x0000 }, { 2806, 0x0840 }, - /* 0x6b00 */ - { 2808, 0x1410 }, { 2811, 0x0044 }, { 2813, 0x000b }, { 2816, 0x6404 }, - { 2820, 0x50c0 }, { 2824, 0x8001 }, { 2826, 0x047e }, { 2833, 0x8984 }, - { 2838, 0x0658 }, { 2843, 0x4140 }, { 2846, 0xc000 }, { 2848, 0x94a4 }, - { 2854, 0xa862 }, { 2860, 0x09dc }, { 2867, 0x1800 }, { 2869, 0x0000 }, - /* 0x6c00 */ - { 2869, 0x8100 }, { 2871, 0x000a }, { 2873, 0x0008 }, { 2874, 0x4190 }, - { 2878, 0x4007 }, { 2882, 0xe4a1 }, { 2889, 0x2501 }, { 2893, 0x6445 }, - { 2899, 0x11ee }, { 2907, 0x0e7d }, { 2916, 0x4800 }, { 2918, 0xfb08 }, - { 2926, 0x1616 }, { 2932, 0x08a8 }, { 2936, 0xc92e }, { 2944, 0x0009 }, - /* 0x6d00 */ - { 2946, 0x1800 }, { 2948, 0x4a82 }, { 2953, 0x06a0 }, { 2957, 0x6b64 }, - { 2965, 0x0002 }, { 2966, 0x1600 }, { 2969, 0x5648 }, { 2975, 0x8390 }, - { 2980, 0x73a0 }, { 2987, 0x002a }, { 2990, 0x8000 }, { 2991, 0x0024 }, - { 2993, 0x88f9 }, { 3001, 0x4702 }, { 3006, 0x4d02 }, { 3011, 0x0faa }, - /* 0x6e00 */ - { 3019, 0x0000 }, { 3019, 0x8e80 }, { 3024, 0xb87b }, { 3034, 0x7554 }, - { 3042, 0x2418 }, { 3046, 0xd940 }, { 3052, 0xc880 }, { 3056, 0x040c }, - { 3059, 0x0000 }, { 3059, 0xb041 }, { 3064, 0x8c24 }, { 3069, 0x0442 }, - { 3072, 0x5a34 }, { 3079, 0x001a }, { 3082, 0x8000 }, { 3083, 0xc110 }, - /* 0x6f00 */ - { 3087, 0x8046 }, { 3091, 0x0032 }, { 3094, 0x180d }, { 3099, 0x8106 }, - { 3103, 0x0002 }, { 3104, 0xcd92 }, { 3112, 0x6014 }, { 3116, 0x7401 }, - { 3121, 0x6112 }, { 3126, 0x0091 }, { 3129, 0xc098 }, { 3134, 0x420a }, - { 3138, 0x040f }, { 3143, 0x8420 }, { 3146, 0x9a13 }, { 3153, 0x4002 }, - /* 0x7000 */ - { 3155, 0x8a62 }, { 3161, 0xfd22 }, { 3170, 0x8188 }, { 3174, 0x4080 }, - { 3176, 0x1000 }, { 3177, 0x2103 }, { 3181, 0x0808 }, { 3183, 0x3101 }, - { 3187, 0x4420 }, { 3190, 0x0704 }, { 3194, 0xb812 }, { 3200, 0x0388 }, - { 3204, 0x8900 }, { 3207, 0xa300 }, { 3211, 0x0000 }, { 3211, 0x2202 }, - /* 0x7100 */ - { 3214, 0x1210 }, { 3217, 0x4600 }, { 3220, 0x0042 }, { 3222, 0x0041 }, - { 3224, 0x5680 }, { 3229, 0x5241 }, { 3234, 0x52f0 }, { 3241, 0x2000 }, - { 3242, 0x8610 }, { 3246, 0x8214 }, { 3250, 0x1004 }, { 3252, 0x4602 }, - { 3256, 0x430a }, { 3261, 0x8035 }, { 3266, 0x60e0 }, { 3271, 0xd800 }, - /* 0x7200 */ - { 3275, 0x0041 }, { 3277, 0x0801 }, { 3279, 0x3400 }, { 3282, 0x6c65 }, - { 3290, 0x11c1 }, { 3295, 0xab04 }, { 3301, 0x0286 }, { 3305, 0x2204 }, - { 3308, 0x0003 }, { 3310, 0x0000 }, { 3310, 0x9084 }, { 3314, 0x0000 }, - { 3314, 0x4015 }, { 3318, 0x0281 }, { 3321, 0x0202 }, { 3323, 0x3300 }, - /* 0x7300 */ - { 3327, 0x0400 }, { 3328, 0x3840 }, { 3332, 0x0e20 }, { 3336, 0xc0c0 }, - { 3340, 0x0030 }, { 3342, 0x0085 }, { 3345, 0x0500 }, { 3347, 0x0d25 }, - { 3353, 0x4ad0 }, { 3359, 0x81d0 }, { 3364, 0x2280 }, { 3367, 0x020c }, - { 3370, 0xb605 }, { 3377, 0x6240 }, { 3381, 0x2679 }, { 3389, 0x6280 }, - /* 0x7400 */ - { 3393, 0x02ea }, { 3399, 0x0808 }, { 3401, 0xdd67 }, { 3412, 0x8579 }, - { 3420, 0x081b }, { 3425, 0xdea0 }, { 3433, 0x8735 }, { 3441, 0x4000 }, - { 3442, 0x0a8c }, { 3447, 0xd100 }, { 3451, 0x05aa }, { 3457, 0xa225 }, - { 3463, 0x8440 }, { 3466, 0x1510 }, { 3470, 0x404d }, { 3475, 0x0080 }, - /* 0x7500 */ - { 3476, 0x0012 }, { 3478, 0x8d22 }, { 3484, 0x1968 }, { 3490, 0x058f }, - { 3497, 0x9080 }, { 3500, 0x3a1a }, { 3507, 0x8464 }, { 3512, 0x8561 }, - { 3518, 0xccc0 }, { 3524, 0x2002 }, { 3526, 0x0820 }, { 3528, 0x732e }, - { 3537, 0x20a4 }, { 3541, 0x0b34 }, { 3547, 0x0004 }, { 3548, 0x1415 }, - /* 0x7600 */ - { 3553, 0x2001 }, { 3555, 0x8200 }, { 3557, 0x0057 }, { 3562, 0x0800 }, - { 3563, 0x5004 }, { 3566, 0x0044 }, { 3568, 0x1212 }, { 3572, 0x7905 }, - { 3579, 0x40d0 }, { 3583, 0x0009 }, { 3585, 0x4000 }, { 3586, 0x8400 }, - { 3588, 0x054c }, { 3593, 0xd844 }, { 3599, 0x409a }, { 3604, 0x5114 }, - /* 0x7700 */ - { 3609, 0x0b12 }, { 3614, 0x4000 }, { 3615, 0x0201 }, { 3617, 0x1580 }, - { 3621, 0x2001 }, { 3623, 0x0800 }, { 3624, 0x084a }, { 3628, 0xc200 }, - { 3631, 0x0800 }, { 3632, 0x4002 }, { 3634, 0x3020 }, { 3637, 0x9809 }, - { 3642, 0x0000 }, { 3642, 0x1880 }, { 3645, 0xe22c }, { 3652, 0x0008 }, - /* 0x7800 */ - { 3653, 0x0004 }, { 3654, 0x0004 }, { 3655, 0x10e0 }, { 3659, 0x0014 }, - { 3661, 0x8020 }, { 3663, 0x2000 }, { 3664, 0x9800 }, { 3667, 0x1000 }, - { 3668, 0x7082 }, { 3673, 0x0082 }, { 3675, 0x0288 }, { 3678, 0x1c00 }, - { 3681, 0x4c22 }, { 3686, 0x0001 }, { 3687, 0x9100 }, { 3690, 0x0820 }, - /* 0x7900 */ - { 3692, 0x4002 }, { 3694, 0x0040 }, { 3695, 0x1c00 }, { 3698, 0x4400 }, - { 3700, 0x0383 }, { 3705, 0x7cc1 }, { 3713, 0x2121 }, { 3717, 0x8400 }, - { 3719, 0xe002 }, { 3723, 0x0002 }, { 3724, 0x44c0 }, { 3728, 0xe20a }, - { 3734, 0x0e03 }, { 3739, 0x8126 }, { 3744, 0x02d0 }, { 3748, 0x0800 }, - /* 0x7a00 */ - { 3749, 0x2921 }, { 3754, 0x9690 }, { 3760, 0x4001 }, { 3762, 0xb8c2 }, - { 3769, 0x6241 }, { 3774, 0x0080 }, { 3775, 0x0a06 }, { 3779, 0xa651 }, - { 3786, 0x0112 }, { 3789, 0x812c }, { 3794, 0xc600 }, { 3798, 0x0400 }, - { 3799, 0x0cb0 }, { 3804, 0xa280 }, { 3808, 0xa429 }, { 3814, 0x8640 }, - /* 0x7b00 */ - { 3818, 0x8000 }, { 3819, 0x4a02 }, { 3823, 0x3041 }, { 3827, 0x0200 }, - { 3828, 0xba40 }, { 3834, 0x0057 }, { 3839, 0x5001 }, { 3842, 0x2020 }, - { 3844, 0x8880 }, { 3847, 0x24b0 }, { 3852, 0x2002 }, { 3854, 0x0112 }, - { 3857, 0x02d3 }, { 3863, 0x0004 }, { 3864, 0x0211 }, { 3867, 0x0000 }, - /* 0x7c00 */ - { 3867, 0x0080 }, { 3868, 0x4004 }, { 3870, 0x0c82 }, { 3874, 0xe000 }, - { 3877, 0x3008 }, { 3880, 0x0000 }, { 3880, 0x1011 }, { 3883, 0x0008 }, - { 3884, 0x0208 }, { 3886, 0x81a4 }, { 3891, 0x40a0 }, { 3894, 0x420e }, - { 3899, 0x0400 }, { 3900, 0xc040 }, { 3903, 0x0081 }, { 3905, 0x4800 }, - /* 0x7d00 */ - { 3907, 0x2df5 }, { 3917, 0x0f91 }, { 3924, 0xd807 }, { 3931, 0x0629 }, - { 3936, 0x007c }, { 3941, 0x4001 }, { 3943, 0x4546 }, { 3949, 0x824e }, - { 3955, 0xc000 }, { 3957, 0x1008 }, { 3959, 0x3005 }, { 3963, 0xed36 }, - { 3973, 0x0c80 }, { 3976, 0x6540 }, { 3981, 0x930b }, { 3988, 0x0810 }, - /* 0x7e00 */ - { 3990, 0x0600 }, { 3992, 0xe820 }, { 3997, 0xc80a }, { 4002, 0x6082 }, - { 4006, 0x00ca }, { 4010, 0x4034 }, { 4014, 0x2e02 }, { 4019, 0x1201 }, - { 4022, 0x9004 }, { 4025, 0x1948 }, { 4030, 0x0000 }, { 4030, 0x0000 }, - { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, - /* 0x7f00 */ - { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0540 }, - { 4033, 0x1000 }, { 4034, 0x0031 }, { 4037, 0x4c00 }, { 4040, 0x02a5 }, - { 4045, 0x5520 }, { 4050, 0x4410 }, { 4053, 0x0310 }, { 4056, 0x2304 }, - { 4060, 0x5422 }, { 4065, 0x8034 }, { 4069, 0x0a03 }, { 4073, 0x1201 }, - /* 0x8000 */ - { 4076, 0x126b }, { 4083, 0x01a1 }, { 4087, 0x2000 }, { 4088, 0xa048 }, - { 4092, 0x0448 }, { 4095, 0x4540 }, { 4099, 0x8000 }, { 4100, 0xe08d }, - { 4107, 0x1af0 }, { 4114, 0x2840 }, { 4117, 0x8626 }, { 4123, 0x0416 }, - { 4127, 0x5018 }, { 4131, 0x4c00 }, { 4134, 0x0032 }, { 4137, 0x2112 }, - /* 0x8100 */ - { 4141, 0x05e4 }, { 4147, 0x0d00 }, { 4150, 0x8a08 }, { 4154, 0x4200 }, - { 4156, 0x4800 }, { 4158, 0x0033 }, { 4162, 0x0860 }, { 4165, 0x8703 }, - { 4171, 0x8501 }, { 4175, 0x3400 }, { 4178, 0x0109 }, { 4181, 0xe428 }, - { 4187, 0x2045 }, { 4191, 0x8100 }, { 4193, 0x25a8 }, { 4199, 0x5c18 }, - /* 0x8200 */ - { 4205, 0x35a0 }, { 4211, 0xd804 }, { 4216, 0x1c02 }, { 4220, 0x02e0 }, - { 4224, 0x00a1 }, { 4227, 0x0200 }, { 4228, 0xc050 }, { 4232, 0x4146 }, - { 4237, 0x6800 }, { 4240, 0xa604 }, { 4245, 0xf260 }, { 4252, 0xbb8a }, - { 4261, 0x0000 }, { 4261, 0xc8b6 }, { 4269, 0x00e2 }, { 4273, 0x6002 }, - /* 0x8300 */ - { 4276, 0x023e }, { 4282, 0x0080 }, { 4283, 0x8900 }, { 4286, 0x0372 }, - { 4292, 0x8681 }, { 4297, 0x0006 }, { 4299, 0x0000 }, { 4299, 0x0888 }, - { 4302, 0x4600 }, { 4305, 0x4140 }, { 4308, 0x0e04 }, { 4312, 0x2000 }, - { 4313, 0x1622 }, { 4318, 0x1048 }, { 4321, 0x8a00 }, { 4324, 0x2217 }, - /* 0x8400 */ - { 4330, 0x7418 }, { 4336, 0x0000 }, { 4336, 0x1200 }, { 4338, 0x2102 }, - { 4341, 0x0200 }, { 4342, 0x0880 }, { 4344, 0x984a }, { 4350, 0x0420 }, - { 4352, 0x0000 }, { 4352, 0x1211 }, { 4356, 0x0002 }, { 4357, 0x9904 }, - { 4362, 0x2a55 }, { 4369, 0x0402 }, { 4371, 0x5000 }, { 4373, 0x1010 }, - /* 0x8500 */ - { 4375, 0x0000 }, { 4375, 0x459a }, { 4382, 0xb02a }, { 4388, 0xa000 }, - { 4390, 0x420a }, { 4394, 0x0208 }, { 4396, 0x2708 }, { 4401, 0x0000 }, - { 4401, 0x8090 }, { 4404, 0x0812 }, { 4407, 0x8740 }, { 4412, 0x0401 }, - { 4414, 0xe202 }, { 4419, 0x3020 }, { 4422, 0x0630 }, { 4426, 0x8c80 }, - /* 0x8600 */ - { 4430, 0x04c4 }, { 4434, 0x04c0 }, { 4437, 0x2000 }, { 4438, 0x8000 }, - { 4439, 0x4000 }, { 4440, 0xd831 }, { 4447, 0x0080 }, { 4448, 0x0200 }, - { 4449, 0x1400 }, { 4451, 0x0008 }, { 4452, 0x0218 }, { 4455, 0x0000 }, - { 4455, 0x0880 }, { 4457, 0x8a10 }, { 4461, 0x2010 }, { 4463, 0x4000 }, - /* 0x8700 */ - { 4464, 0x010d }, { 4468, 0x1500 }, { 4471, 0x0000 }, { 4471, 0x0000 }, - { 4471, 0x4000 }, { 4472, 0x80a0 }, { 4475, 0x0140 }, { 4477, 0x0150 }, - { 4480, 0x2004 }, { 4482, 0x8000 }, { 4483, 0x0004 }, { 4484, 0x0408 }, - { 4486, 0x0010 }, { 4487, 0x0000 }, { 4487, 0x9001 }, { 4490, 0x4a04 }, - /* 0x8800 */ - { 4494, 0x0020 }, { 4495, 0x8000 }, { 4496, 0x000c }, { 4498, 0x0842 }, - { 4501, 0x3041 }, { 4505, 0x2a8c }, { 4511, 0x090e }, { 4516, 0xc085 }, - { 4521, 0x2906 }, { 4526, 0x40c4 }, { 4530, 0x0800 }, { 4531, 0x0010 }, - { 4532, 0x8006 }, { 4535, 0xb230 }, { 4541, 0x0102 }, { 4543, 0x2138 }, - /* 0x8900 */ - { 4548, 0x0080 }, { 4549, 0x030d }, { 4554, 0x0420 }, { 4556, 0x0940 }, - { 4559, 0x0012 }, { 4561, 0x8000 }, { 4562, 0x0410 }, { 4564, 0x8004 }, - { 4566, 0x88ca }, { 4572, 0x0048 }, { 4574, 0x0602 }, { 4577, 0x2404 }, - { 4580, 0x0001 }, { 4581, 0x0004 }, { 4582, 0x0008 }, { 4583, 0x0110 }, - /* 0x8a00 */ - { 4585, 0x550d }, { 4592, 0xa9c8 }, { 4599, 0x2428 }, { 4603, 0x0c52 }, - { 4608, 0x0000 }, { 4608, 0x4831 }, { 4613, 0x624d }, { 4620, 0x022f }, - { 4626, 0x30a0 }, { 4630, 0x4128 }, { 4634, 0x057b }, { 4642, 0xd205 }, - { 4648, 0xa894 }, { 4654, 0x1844 }, { 4658, 0x6cc2 }, { 4665, 0x45c2 }, - /* 0x8b00 */ - { 4671, 0x4017 }, { 4676, 0x2ed1 }, { 4684, 0x1901 }, { 4688, 0x0208 }, - { 4690, 0xc202 }, { 4694, 0x1500 }, { 4697, 0x9040 }, { 4700, 0x2091 }, - { 4704, 0x0401 }, { 4706, 0x044d }, { 4711, 0x0000 }, { 4711, 0x0000 }, - { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, - /* 0x8c00 */ - { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x8080 }, - { 4713, 0x1542 }, { 4718, 0x0420 }, { 4720, 0x0c02 }, { 4723, 0x0600 }, - { 4725, 0x1404 }, { 4728, 0x6000 }, { 4730, 0x9f87 }, { 4740, 0xb9d9 }, - { 4750, 0x059f }, { 4758, 0x540a }, { 4763, 0x245d }, { 4770, 0x3810 }, - /* 0x8d00 */ - { 4774, 0x25b0 }, { 4780, 0x0048 }, { 4782, 0x0000 }, { 4782, 0x0000 }, - { 4782, 0x0000 }, { 4782, 0x0000 }, { 4782, 0x0850 }, { 4785, 0x0099 }, - { 4789, 0x0420 }, { 4791, 0x0200 }, { 4792, 0x0108 }, { 4794, 0x4408 }, - { 4797, 0x9840 }, { 4801, 0x2800 }, { 4803, 0x810a }, { 4807, 0x0008 }, - /* 0x8e00 */ - { 4808, 0x8400 }, { 4810, 0x4001 }, { 4812, 0x0400 }, { 4813, 0x0021 }, - { 4815, 0x0794 }, { 4821, 0x8200 }, { 4823, 0x0001 }, { 4824, 0x0050 }, - { 4826, 0x2482 }, { 4830, 0x0000 }, { 4830, 0x1c00 }, { 4833, 0x0000 }, - { 4833, 0x3c01 }, { 4838, 0x8004 }, { 4840, 0x0800 }, { 4841, 0x4900 }, - /* 0x8f00 */ - { 4844, 0x0228 }, { 4847, 0xf83c }, { 4856, 0x86c0 }, { 4861, 0xcb08 }, - { 4867, 0x6230 }, { 4872, 0xa000 }, { 4874, 0x0004 }, { 4875, 0x0000 }, - { 4875, 0x0000 }, { 4875, 0x1800 }, { 4877, 0xa148 }, { 4882, 0x0007 }, - { 4885, 0x4024 }, { 4888, 0x0012 }, { 4890, 0x2c40 }, { 4894, 0x2285 }, - /* 0x9000 */ - { 4899, 0xa96f }, { 4909, 0xe6b3 }, { 4919, 0x400f }, { 4924, 0x5126 }, - { 4930, 0x6c86 }, { 4937, 0x723b }, { 4946, 0xe20b }, { 4953, 0xb5a4 }, - { 4961, 0x859f }, { 4970, 0x0222 }, { 4973, 0x854c }, { 4979, 0x0123 }, - { 4983, 0x0402 }, { 4985, 0x4000 }, { 4986, 0x2102 }, { 4989, 0x2020 }, - /* 0x9100 */ - { 4991, 0x0004 }, { 4992, 0x0224 }, { 4995, 0x2080 }, { 4997, 0x0004 }, - { 4998, 0x7e00 }, { 5004, 0x0004 }, { 5005, 0x1604 }, { 5009, 0x01a0 }, - { 5012, 0x2a80 }, { 5016, 0x1004 }, { 5018, 0xd800 }, { 5022, 0x0032 }, - { 5025, 0xfa81 }, { 5033, 0x3183 }, { 5039, 0x0488 }, { 5042, 0x0020 }, - /* 0x9200 */ - { 5043, 0x2000 }, { 5044, 0x4087 }, { 5049, 0x0000 }, { 5049, 0x8410 }, - { 5052, 0x0221 }, { 5055, 0x4880 }, { 5058, 0x0074 }, { 5062, 0x0000 }, - { 5062, 0x0029 }, { 5065, 0x114a }, { 5070, 0x0000 }, { 5070, 0x02c8 }, - { 5074, 0x9000 }, { 5076, 0x0004 }, { 5077, 0x0410 }, { 5079, 0x1100 }, - /* 0x9300 */ - { 5081, 0x0010 }, { 5082, 0xc501 }, { 5087, 0xc957 }, { 5096, 0x0000 }, - { 5096, 0x2d00 }, { 5100, 0x0810 }, { 5102, 0x4000 }, { 5103, 0x5020 }, - { 5106, 0x1000 }, { 5107, 0x0450 }, { 5110, 0x3088 }, { 5114, 0x0001 }, - { 5115, 0x0008 }, { 5116, 0x4002 }, { 5118, 0x0012 }, { 5120, 0x0040 }, - /* 0x9400 */ - { 5121, 0x0010 }, { 5122, 0x0100 }, { 5123, 0x0820 }, { 5125, 0x0120 }, - { 5127, 0x0010 }, { 5128, 0x0806 }, { 5131, 0x0000 }, { 5131, 0xa000 }, - { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, - { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, - /* 0x9500 */ - { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, - { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0080 }, - { 5134, 0x8a09 }, { 5139, 0x011e }, { 5144, 0x2138 }, { 5149, 0x1802 }, - { 5152, 0x0480 }, { 5154, 0x1070 }, { 5158, 0x0006 }, { 5160, 0x0000 }, - /* 0x9600 */ - { 5160, 0x0000 }, { 5160, 0x1000 }, { 5161, 0x4402 }, { 5164, 0x8804 }, - { 5167, 0x3815 }, { 5173, 0xf801 }, { 5179, 0x041c }, { 5183, 0x21e9 }, - { 5190, 0x6c60 }, { 5196, 0x1b30 }, { 5202, 0x0588 }, { 5206, 0x0882 }, - { 5209, 0x7af3 }, { 5220, 0x1a60 }, { 5225, 0x870c }, { 5231, 0x0ac5 }, - /* 0x9700 */ - { 5237, 0x00c1 }, { 5240, 0x524a }, { 5246, 0x0080 }, { 5247, 0x2205 }, - { 5251, 0x0114 }, { 5254, 0x5042 }, { 5258, 0x2206 }, { 5262, 0x0490 }, - { 5265, 0xa800 }, { 5268, 0x0000 }, { 5268, 0x2901 }, { 5272, 0x0000 }, - { 5272, 0x0840 }, { 5274, 0x1008 }, { 5276, 0x0000 }, { 5276, 0x8848 }, - /* 0x9800 */ - { 5280, 0x156f }, { 5289, 0x018f }, { 5295, 0x2000 }, { 5296, 0x0b01 }, - { 5300, 0x7040 }, { 5304, 0x4510 }, { 5308, 0x88a0 }, { 5312, 0x0000 }, - { 5312, 0x0000 }, { 5312, 0x0000 }, { 5312, 0x8100 }, { 5314, 0x0002 }, - { 5315, 0x0090 }, { 5317, 0x9800 }, { 5320, 0xe006 }, { 5325, 0x7010 }, - /* 0x9900 */ - { 5329, 0x1608 }, { 5333, 0x4109 }, { 5337, 0x0101 }, { 5339, 0x0000 }, - { 5339, 0x3a20 }, { 5344, 0x0096 }, { 5348, 0x0000 }, { 5348, 0x0000 }, - { 5348, 0x0000 }, { 5348, 0x2240 }, { 5351, 0x7120 }, { 5356, 0x021a }, - { 5360, 0x0002 }, { 5361, 0xa227 }, { 5368, 0x2000 }, { 5369, 0x8002 }, - /* 0x9a00 */ - { 5371, 0xc102 }, { 5375, 0x0200 }, { 5376, 0x0800 }, { 5377, 0x00c1 }, - { 5380, 0x2029 }, { 5384, 0x8ca0 }, { 5389, 0x0624 }, { 5393, 0x0000 }, - { 5393, 0x0000 }, { 5393, 0x0000 }, { 5393, 0x0100 }, { 5394, 0x0100 }, - { 5395, 0x0000 }, { 5395, 0x0118 }, { 5398, 0x4020 }, { 5400, 0x0000 }, - /* 0x9b00 */ - { 5400, 0x0000 }, { 5400, 0x0400 }, { 5401, 0x0480 }, { 5403, 0x1002 }, - { 5405, 0x803e }, { 5411, 0x0410 }, { 5413, 0x8000 }, { 5414, 0x0000 }, - { 5414, 0x4000 }, { 5415, 0x8002 }, { 5417, 0x4800 }, { 5419, 0x0000 }, - { 5419, 0x0200 }, { 5420, 0x0040 }, { 5421, 0x0110 }, { 5423, 0x0000 }, - /* 0x9c00 */ - { 5423, 0x2000 }, { 5424, 0x0025 }, { 5427, 0x0020 }, { 5428, 0x0804 }, - { 5430, 0x0280 }, { 5432, 0x0080 }, { 5433, 0x0000 }, { 5433, 0x0000 }, - { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, - { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x02a0 }, { 5436, 0x0058 }, - /* 0x9d00 */ - { 5439, 0x0200 }, { 5440, 0x0800 }, { 5441, 0x0140 }, { 5443, 0x0800 }, - { 5444, 0x0000 }, { 5444, 0x2002 }, { 5446, 0x1003 }, { 5449, 0x0004 }, - { 5450, 0x0000 }, { 5450, 0x0000 }, { 5450, 0x8200 }, { 5452, 0x0010 }, - { 5453, 0x0010 }, { 5454, 0x0080 }, { 5455, 0x0000 }, { 5455, 0x0704 }, - /* 0x9e00 */ - { 5459, 0x0000 }, { 5459, 0x4400 }, { 5461, 0x0000 }, { 5461, 0x0000 }, - { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0xa220 }, - { 5465, 0x0000 }, { 5465, 0xa08c }, { 5470, 0x0020 }, { 5471, 0x4830 }, - { 5475, 0x6008 }, { 5478, 0x5912 }, { 5484, 0x0100 }, { 5485, 0x0010 }, - /* 0x9f00 */ - { 5486, 0x4180 }, { 5489, 0x0008 }, { 5490, 0x0001 }, { 5491, 0x0800 }, - { 5492, 0x4c00 }, { 5495, 0x8004 }, { 5497, 0x1482 }, { 5501, 0x0080 }, - { 5502, 0x2000 }, { 5503, 0x1021 }, -}; -static const Summary16 ksc5601_uni2indx_pageac[698] = { - /* 0xac00 */ - { 5506, 0x0793 }, { 5513, 0x3eff }, { 5526, 0xb011 }, { 5531, 0x1303 }, - { 5536, 0x2801 }, { 5539, 0x1110 }, { 5542, 0x0000 }, { 5542, 0x0593 }, - { 5548, 0x1e7b }, { 5558, 0xb011 }, { 5563, 0x9703 }, { 5570, 0x3b01 }, - { 5576, 0x1112 }, { 5580, 0x00a0 }, { 5582, 0x9593 }, { 5590, 0x306b }, - /* 0xad00 */ - { 5597, 0xb051 }, { 5603, 0x1102 }, { 5606, 0x3201 }, { 5610, 0x1130 }, - { 5614, 0x02b0 }, { 5618, 0x0111 }, { 5621, 0x300a }, { 5625, 0xb879 }, - { 5634, 0x1306 }, { 5639, 0x3001 }, { 5642, 0x0010 }, { 5643, 0x0080 }, - { 5644, 0x0113 }, { 5648, 0x100b }, { 5652, 0x0011 }, { 5654, 0x9300 }, - /* 0xae00 */ - { 5658, 0x2b03 }, { 5664, 0x0010 }, { 5665, 0x0000 }, { 5665, 0x0593 }, - { 5671, 0x746b }, { 5680, 0xb051 }, { 5686, 0x1323 }, { 5692, 0x3b01 }, - { 5698, 0x1030 }, { 5701, 0x0000 }, { 5701, 0x0000 }, { 5701, 0x7000 }, - { 5704, 0xb011 }, { 5709, 0x1303 }, { 5714, 0x2900 }, { 5717, 0x1110 }, - /* 0xaf00 */ - { 5720, 0x2180 }, { 5723, 0x0001 }, { 5724, 0x3000 }, { 5726, 0xb015 }, - { 5732, 0x030e }, { 5737, 0x3001 }, { 5740, 0x0030 }, { 5742, 0x0200 }, - { 5743, 0x0111 }, { 5746, 0x1023 }, { 5750, 0x0000 }, { 5750, 0x1300 }, - { 5753, 0x6b81 }, { 5760, 0x1010 }, { 5762, 0x0300 }, { 5764, 0x0113 }, - /* 0xb000 */ - { 5768, 0x1013 }, { 5772, 0x3011 }, { 5776, 0x0100 }, { 5777, 0x0000 }, - { 5777, 0x5530 }, { 5783, 0x22b8 }, { 5789, 0x0000 }, { 5789, 0x3000 }, - { 5791, 0xb011 }, { 5796, 0x9702 }, { 5802, 0xfb07 }, { 5812, 0x113a }, - { 5818, 0x03b0 }, { 5823, 0x0113 }, { 5827, 0x0021 }, { 5829, 0x0000 }, - /* 0xb100 */ - { 5829, 0x1b00 }, { 5833, 0x3b0d }, { 5841, 0x1138 }, { 5846, 0x03b0 }, - { 5851, 0x0113 }, { 5855, 0x1133 }, { 5861, 0x0001 }, { 5862, 0x1300 }, - { 5865, 0x2b05 }, { 5871, 0x111c }, { 5876, 0x0100 }, { 5877, 0x0000 }, - { 5877, 0x1000 }, { 5878, 0xb011 }, { 5883, 0x1300 }, { 5886, 0x2a01 }, - /* 0xb200 */ - { 5890, 0x1930 }, { 5895, 0x02b0 }, { 5899, 0x0001 }, { 5900, 0x1010 }, - { 5902, 0x0000 }, { 5902, 0x1100 }, { 5904, 0x0301 }, { 5907, 0x1030 }, - { 5910, 0x0230 }, { 5913, 0x0713 }, { 5919, 0x146b }, { 5926, 0x0011 }, - { 5928, 0x1300 }, { 5931, 0x2b05 }, { 5937, 0xf974 }, { 5947, 0x8fb8 }, - /* 0xb300 */ - { 5956, 0x0113 }, { 5960, 0x103b }, { 5966, 0x0000 }, { 5966, 0x0000 }, - { 5966, 0x0000 }, { 5966, 0xd970 }, { 5974, 0x4ab0 }, { 5980, 0x0113 }, - { 5984, 0x103b }, { 5990, 0x0011 }, { 5992, 0x1103 }, { 5996, 0x0000 }, - { 5996, 0x5930 }, { 6002, 0x2ab1 }, { 6009, 0x0111 }, { 6012, 0x1000 }, - /* 0xb400 */ - { 6013, 0x0000 }, { 6013, 0x1101 }, { 6016, 0x0b01 }, { 6020, 0x0010 }, - { 6021, 0x0000 }, { 6021, 0x0113 }, { 6025, 0x102b }, { 6030, 0x0000 }, - { 6030, 0x0101 }, { 6032, 0x2000 }, { 6033, 0x1110 }, { 6036, 0x02a0 }, - { 6039, 0x0111 }, { 6042, 0x3021 }, { 6046, 0xb059 }, { 6053, 0x0102 }, - /* 0xb500 */ - { 6055, 0x0000 }, { 6055, 0x1930 }, { 6060, 0x07b0 }, { 6066, 0x0113 }, - { 6070, 0x383b }, { 6078, 0xb011 }, { 6083, 0x0003 }, { 6085, 0x0000 }, - { 6085, 0x0000 }, { 6085, 0x0000 }, { 6085, 0x0d13 }, { 6091, 0x383b }, - { 6099, 0xb011 }, { 6104, 0x0103 }, { 6107, 0x1000 }, { 6108, 0x0000 }, - /* 0xb600 */ - { 6108, 0x0000 }, { 6108, 0x0113 }, { 6112, 0x1020 }, { 6114, 0x0010 }, - { 6115, 0x0100 }, { 6116, 0x0000 }, { 6116, 0x0110 }, { 6118, 0x0000 }, - { 6118, 0x0000 }, { 6118, 0x3000 }, { 6120, 0x1811 }, { 6124, 0x0002 }, - { 6125, 0x0000 }, { 6125, 0x0010 }, { 6126, 0x0000 }, { 6126, 0x0111 }, - /* 0xb700 */ - { 6129, 0x0023 }, { 6132, 0x0000 }, { 6132, 0x9300 }, { 6136, 0x0b01 }, - { 6140, 0x1110 }, { 6143, 0x0030 }, { 6145, 0x0111 }, { 6148, 0x302b }, - { 6154, 0xb011 }, { 6159, 0x13c7 }, { 6167, 0x3b01 }, { 6173, 0x0130 }, - { 6176, 0x0280 }, { 6178, 0x0000 }, { 6178, 0x3000 }, { 6180, 0xb011 }, - /* 0xb800 */ - { 6185, 0x1383 }, { 6191, 0x2b01 }, { 6196, 0x1130 }, { 6200, 0x03b0 }, - { 6205, 0x0011 }, { 6207, 0x300a }, { 6211, 0xb011 }, { 6216, 0x1102 }, - { 6219, 0x2000 }, { 6220, 0x0000 }, { 6220, 0x0100 }, { 6221, 0x0111 }, - { 6224, 0x102b }, { 6229, 0xa011 }, { 6233, 0x1302 }, { 6237, 0x2b01 }, - /* 0xb900 */ - { 6242, 0x0010 }, { 6243, 0x0100 }, { 6244, 0x0001 }, { 6245, 0x3000 }, - { 6247, 0x9011 }, { 6251, 0x1302 }, { 6255, 0x2b01 }, { 6260, 0x1130 }, - { 6264, 0x66b0 }, { 6271, 0x0000 }, { 6271, 0x3000 }, { 6273, 0xb011 }, - { 6278, 0xd302 }, { 6284, 0x6b07 }, { 6292, 0x113a }, { 6298, 0x07b0 }, - /* 0xba00 */ - { 6304, 0x0103 }, { 6307, 0x0020 }, { 6308, 0x0000 }, { 6308, 0x1300 }, - { 6311, 0x6b05 }, { 6318, 0x1138 }, { 6323, 0x03b0 }, { 6328, 0x0113 }, - { 6332, 0x10b8 }, { 6337, 0x0000 }, { 6337, 0x1b00 }, { 6341, 0x2b05 }, - { 6347, 0x0110 }, { 6349, 0x0300 }, { 6351, 0x0000 }, { 6351, 0x1000 }, - /* 0xbb00 */ - { 6352, 0xa011 }, { 6356, 0x1102 }, { 6359, 0x0a01 }, { 6362, 0x7970 }, - { 6370, 0xa2b0 }, { 6376, 0x0111 }, { 6379, 0x100a }, { 6382, 0x0000 }, - { 6382, 0x1100 }, { 6384, 0x0001 }, { 6385, 0x1110 }, { 6388, 0x0090 }, - { 6390, 0x0111 }, { 6393, 0x0009 }, { 6395, 0x0000 }, { 6395, 0x9300 }, - /* 0xbc00 */ - { 6399, 0xbb05 }, { 6407, 0xf9f2 }, { 6418, 0x22b0 }, { 6423, 0x0113 }, - { 6427, 0x323b }, { 6435, 0x2001 }, { 6437, 0x0000 }, { 6437, 0x0000 }, - { 6437, 0x5930 }, { 6443, 0x06b0 }, { 6448, 0x0193 }, { 6453, 0x303b }, - { 6460, 0xa011 }, { 6464, 0x1123 }, { 6469, 0x0000 }, { 6469, 0x1170 }, - /* 0xbd00 */ - { 6474, 0x02b0 }, { 6478, 0x0011 }, { 6480, 0x1010 }, { 6482, 0x0000 }, - { 6482, 0x1301 }, { 6486, 0x0301 }, { 6489, 0x0110 }, { 6491, 0x0000 }, - { 6491, 0x0793 }, { 6498, 0x162b }, { 6505, 0x0010 }, { 6506, 0x0101 }, - { 6508, 0x0000 }, { 6508, 0x1130 }, { 6512, 0x0200 }, { 6513, 0x0111 }, - /* 0xbe00 */ - { 6516, 0x3029 }, { 6521, 0xb011 }, { 6526, 0x0000 }, { 6526, 0x0000 }, - { 6526, 0x5130 }, { 6531, 0x0eb0 }, { 6537, 0x0513 }, { 6542, 0x383b }, - { 6550, 0xb011 }, { 6555, 0x0303 }, { 6559, 0x0100 }, { 6560, 0x0000 }, - { 6560, 0x0000 }, { 6560, 0x0193 }, { 6565, 0x1039 }, { 6570, 0x0000 }, - /* 0xbf00 */ - { 6570, 0x0302 }, { 6573, 0x3b00 }, { 6578, 0x0000 }, { 6578, 0x0000 }, - { 6578, 0x0113 }, { 6582, 0x0023 }, { 6585, 0x0000 }, { 6585, 0x0000 }, - { 6585, 0x0000 }, { 6585, 0x0010 }, { 6586, 0x0000 }, { 6586, 0x0001 }, - { 6587, 0x3020 }, { 6590, 0x9011 }, { 6594, 0x0002 }, { 6595, 0x0000 }, - /* 0xc000 */ - { 6595, 0x0000 }, { 6595, 0x0000 }, { 6595, 0x0000 }, { 6595, 0x1000 }, - { 6596, 0x0000 }, { 6596, 0x1102 }, { 6599, 0x0301 }, { 6602, 0x0000 }, - { 6602, 0x0000 }, { 6602, 0x0113 }, { 6606, 0xb02b }, { 6613, 0xb079 }, - { 6621, 0x1323 }, { 6627, 0x3b01 }, { 6633, 0x1130 }, { 6637, 0x02b0 }, - /* 0xc100 */ - { 6641, 0x0111 }, { 6644, 0xf021 }, { 6650, 0xb0d9 }, { 6658, 0x1343 }, - { 6664, 0x3b01 }, { 6670, 0x1130 }, { 6674, 0x03b0 }, { 6679, 0x0111 }, - { 6682, 0x7020 }, { 6686, 0xb051 }, { 6692, 0x1322 }, { 6697, 0x2001 }, - { 6699, 0x1110 }, { 6702, 0x0190 }, { 6705, 0x0111 }, { 6708, 0x300b }, - /* 0xc200 */ - { 6713, 0xb011 }, { 6718, 0x9302 }, { 6723, 0xab01 }, { 6729, 0x0016 }, - { 6732, 0x0100 }, { 6733, 0x0113 }, { 6737, 0x3021 }, { 6741, 0xb011 }, - { 6746, 0x0302 }, { 6749, 0x2901 }, { 6753, 0x3130 }, { 6758, 0x02b0 }, - { 6762, 0x0000 }, { 6762, 0x3000 }, { 6764, 0xb819 }, { 6771, 0x1b42 }, - /* 0xc300 */ - { 6777, 0x3301 }, { 6782, 0x1138 }, { 6787, 0x0330 }, { 6791, 0x0000 }, - { 6791, 0x0020 }, { 6792, 0x0000 }, { 6792, 0x1300 }, { 6795, 0x3305 }, - { 6801, 0x1110 }, { 6804, 0x0000 }, { 6804, 0x0000 }, { 6804, 0x0000 }, - { 6804, 0x0001 }, { 6805, 0x9300 }, { 6809, 0x2305 }, { 6814, 0x0130 }, - /* 0xc400 */ - { 6817, 0x0100 }, { 6818, 0x0001 }, { 6819, 0x1010 }, { 6821, 0x3011 }, - { 6825, 0x0100 }, { 6826, 0x0000 }, { 6826, 0x1130 }, { 6830, 0x0230 }, - { 6833, 0x0001 }, { 6834, 0x1010 }, { 6836, 0x0000 }, { 6836, 0x1100 }, - { 6838, 0x0000 }, { 6838, 0x0000 }, { 6838, 0x0200 }, { 6839, 0x8513 }, - /* 0xc500 */ - { 6845, 0x1003 }, { 6848, 0x1011 }, { 6851, 0x1300 }, { 6854, 0x2b01 }, - { 6859, 0x7730 }, { 6867, 0x63b8 }, { 6875, 0x0113 }, { 6879, 0x303b }, - { 6886, 0xb091 }, { 6892, 0x11a2 }, { 6897, 0x0201 }, { 6899, 0x7b30 }, - { 6907, 0x57f0 }, { 6916, 0x0113 }, { 6920, 0x702b }, { 6927, 0xf0d1 }, - /* 0xc600 */ - { 6935, 0x11e3 }, { 6942, 0x1b01 }, { 6947, 0x7130 }, { 6953, 0x0ab9 }, - { 6960, 0x0113 }, { 6964, 0x303b }, { 6971, 0x9001 }, { 6974, 0x1302 }, - { 6978, 0x2b01 }, { 6983, 0x1130 }, { 6987, 0x02b0 }, { 6991, 0x0713 }, - { 6997, 0x302b }, { 7003, 0x3011 }, { 7007, 0x1303 }, { 7012, 0x2301 }, - /* 0xc700 */ - { 7016, 0x1130 }, { 7020, 0x02b0 }, { 7024, 0x0113 }, { 7028, 0x30ab }, - { 7035, 0xb411 }, { 7041, 0x11fe }, { 7050, 0x0901 }, { 7053, 0x7130 }, - { 7059, 0x47b8 }, { 7067, 0x05d3 }, { 7074, 0x307b }, { 7082, 0xb011 }, - { 7087, 0x5303 }, { 7093, 0x2101 }, { 7096, 0x1110 }, { 7099, 0x0000 }, - /* 0xc800 */ - { 7099, 0x0513 }, { 7104, 0x306b }, { 7111, 0xb011 }, { 7116, 0x1102 }, - { 7119, 0x3301 }, { 7124, 0x0010 }, { 7125, 0x0000 }, { 7125, 0x0513 }, - { 7130, 0x38eb }, { 7139, 0xa010 }, { 7142, 0x0102 }, { 7144, 0x3000 }, - { 7146, 0x1110 }, { 7149, 0x02b0 }, { 7153, 0x0013 }, { 7156, 0x3020 }, - /* 0xc900 */ - { 7159, 0xb071 }, { 7166, 0x0102 }, { 7168, 0x1000 }, { 7169, 0x0010 }, - { 7170, 0x0000 }, { 7170, 0x0113 }, { 7174, 0x100b }, { 7178, 0x1011 }, - { 7181, 0x1300 }, { 7184, 0x2b01 }, { 7189, 0x0000 }, { 7189, 0x0000 }, - { 7189, 0x0593 }, { 7195, 0x366b }, { 7204, 0xb095 }, { 7211, 0x1303 }, - /* 0xca00 */ - { 7216, 0x3b01 }, { 7222, 0x0110 }, { 7224, 0x0200 }, { 7225, 0x0000 }, - { 7225, 0x3000 }, { 7227, 0xb011 }, { 7232, 0x0103 }, { 7235, 0x2000 }, - { 7236, 0x0010 }, { 7237, 0x0100 }, { 7238, 0x0000 }, { 7238, 0x3000 }, - { 7240, 0xb011 }, { 7245, 0x030a }, { 7249, 0x1001 }, { 7251, 0x0010 }, - /* 0xcb00 */ - { 7252, 0x0100 }, { 7253, 0x0111 }, { 7256, 0x0003 }, { 7258, 0x0000 }, - { 7258, 0x1302 }, { 7262, 0x2301 }, { 7266, 0x0010 }, { 7267, 0x0300 }, - { 7269, 0x0000 }, { 7269, 0x1000 }, { 7270, 0x0000 }, { 7270, 0x0100 }, - { 7271, 0x0000 }, { 7271, 0x0010 }, { 7272, 0x0290 }, { 7275, 0x0000 }, - /* 0xcc00 */ - { 7275, 0x3000 }, { 7277, 0x3011 }, { 7281, 0x5386 }, { 7288, 0x7b01 }, - { 7295, 0x1130 }, { 7299, 0x03b0 }, { 7304, 0x0151 }, { 7308, 0x0021 }, - { 7310, 0x0000 }, { 7310, 0x1300 }, { 7313, 0x3b01 }, { 7319, 0x1130 }, - { 7323, 0x02b0 }, { 7327, 0x0011 }, { 7329, 0x1010 }, { 7331, 0x0001 }, - /* 0xcd00 */ - { 7332, 0x1302 }, { 7336, 0x2b01 }, { 7341, 0x1110 }, { 7344, 0x0200 }, - { 7345, 0x0000 }, { 7345, 0x1000 }, { 7346, 0xb011 }, { 7351, 0x0102 }, - { 7353, 0x0100 }, { 7354, 0x1130 }, { 7358, 0x02b0 }, { 7362, 0x0001 }, - { 7363, 0x1010 }, { 7365, 0x0001 }, { 7366, 0x1100 }, { 7368, 0x2b01 }, - /* 0xce00 */ - { 7373, 0x1110 }, { 7376, 0x0210 }, { 7378, 0x0113 }, { 7382, 0x002b }, - { 7386, 0x0000 }, { 7386, 0x9300 }, { 7390, 0x2b03 }, { 7396, 0x1130 }, - { 7400, 0x02b0 }, { 7404, 0x0113 }, { 7408, 0x303b }, { 7415, 0x0000 }, - { 7415, 0x0002 }, { 7416, 0x0000 }, { 7416, 0x1930 }, { 7421, 0x03b0 }, - /* 0xcf00 */ - { 7426, 0x0113 }, { 7430, 0x102b }, { 7435, 0xb011 }, { 7440, 0x0103 }, - { 7443, 0x0000 }, { 7443, 0x1130 }, { 7447, 0x02b0 }, { 7451, 0x0113 }, - { 7455, 0x1021 }, { 7458, 0x0000 }, { 7458, 0x0102 }, { 7460, 0x0001 }, - { 7461, 0x0010 }, { 7462, 0x0000 }, { 7462, 0x0113 }, { 7466, 0x102b }, - /* 0xd000 */ - { 7471, 0x0011 }, { 7473, 0x0102 }, { 7475, 0x2000 }, { 7476, 0x1130 }, - { 7480, 0x02b0 }, { 7484, 0x0111 }, { 7487, 0x3001 }, { 7490, 0x3011 }, - { 7494, 0x0002 }, { 7495, 0x0000 }, { 7495, 0x1130 }, { 7499, 0x02b0 }, - { 7503, 0x0313 }, { 7508, 0x303b }, { 7515, 0xb011 }, { 7520, 0x0103 }, - /* 0xd100 */ - { 7523, 0x2000 }, { 7524, 0x0000 }, { 7524, 0x0000 }, { 7524, 0x0513 }, - { 7529, 0x303b }, { 7536, 0xb011 }, { 7541, 0x1102 }, { 7544, 0x1000 }, - { 7545, 0x0110 }, { 7547, 0x0000 }, { 7547, 0x0113 }, { 7551, 0x142b }, - { 7557, 0x0001 }, { 7558, 0x0100 }, { 7559, 0x0000 }, { 7559, 0x0110 }, - /* 0xd200 */ - { 7561, 0x0280 }, { 7563, 0x0001 }, { 7564, 0x3000 }, { 7566, 0xb011 }, - { 7571, 0x0102 }, { 7573, 0x1000 }, { 7574, 0x0010 }, { 7575, 0x0000 }, - { 7575, 0x0113 }, { 7579, 0x1023 }, { 7583, 0x1011 }, { 7586, 0x9302 }, - { 7591, 0x0b05 }, { 7596, 0x1110 }, { 7599, 0x0030 }, { 7601, 0x0113 }, - /* 0xd300 */ - { 7605, 0x702b }, { 7612, 0xb051 }, { 7618, 0x1323 }, { 7624, 0x3b01 }, - { 7630, 0x0030 }, { 7632, 0x0000 }, { 7632, 0x0000 }, { 7632, 0x3000 }, - { 7634, 0xb011 }, { 7639, 0x1303 }, { 7644, 0x2b01 }, { 7649, 0x1110 }, - { 7652, 0x0330 }, { 7656, 0x0101 }, { 7658, 0x300a }, { 7662, 0xb011 }, - /* 0xd400 */ - { 7667, 0x0102 }, { 7669, 0x2000 }, { 7670, 0x0000 }, { 7670, 0x0000 }, - { 7670, 0x0011 }, { 7672, 0x1000 }, { 7673, 0xa011 }, { 7677, 0x9300 }, - { 7681, 0x2b05 }, { 7687, 0x0010 }, { 7688, 0x0200 }, { 7689, 0x0000 }, - { 7689, 0x1000 }, { 7690, 0x9011 }, { 7694, 0x1100 }, { 7696, 0x2901 }, - /* 0xd500 */ - { 7700, 0x1110 }, { 7703, 0x00b0 }, { 7706, 0x0000 }, { 7706, 0x3000 }, - { 7708, 0xb011 }, { 7713, 0x1302 }, { 7717, 0x2b21 }, { 7723, 0x1130 }, - { 7727, 0x03b0 }, { 7732, 0x0001 }, { 7733, 0x0020 }, { 7734, 0x0000 }, - { 7734, 0x1300 }, { 7737, 0x2b05 }, { 7743, 0x1130 }, { 7747, 0x02b0 }, - /* 0xd600 */ - { 7751, 0x0113 }, { 7755, 0x103b }, { 7761, 0x2011 }, { 7764, 0x1300 }, - { 7767, 0x2b21 }, { 7773, 0x1132 }, { 7778, 0x0280 }, { 7780, 0x0013 }, - { 7783, 0x3028 }, { 7787, 0xa011 }, { 7791, 0x1102 }, { 7794, 0x0a01 }, - { 7797, 0x1130 }, { 7801, 0x0292 }, { 7805, 0x0111 }, { 7808, 0x3021 }, - /* 0xd700 */ - { 7812, 0x0011 }, { 7814, 0x1302 }, { 7818, 0x2b01 }, { 7823, 0x1130 }, - { 7827, 0x0290 }, { 7830, 0x03d3 }, { 7837, 0x122b }, { 7843, 0x3011 }, - { 7847, 0x1302 }, { 7851, 0x2b01 }, -}; -static const Summary16 ksc5601_uni2indx_pagef9[17] = { - /* 0xf900 */ - { 7856, 0xffff }, { 7872, 0xffff }, { 7888, 0xffff }, { 7904, 0xffff }, - { 7920, 0xffff }, { 7936, 0xffff }, { 7952, 0xffff }, { 7968, 0xffff }, - { 7984, 0xffff }, { 8000, 0xffff }, { 8016, 0xffff }, { 8032, 0xffff }, - { 8048, 0xffff }, { 8064, 0xffff }, { 8080, 0xffff }, { 8096, 0xffff }, - /* 0xfa00 */ - { 8112, 0x0fff }, -}; -static const Summary16 ksc5601_uni2indx_pageff[15] = { - /* 0xff00 */ - { 8124, 0xfffe }, { 8139, 0xffff }, { 8155, 0xffff }, { 8171, 0xffff }, - { 8187, 0xffff }, { 8203, 0x7fff }, { 8218, 0x0000 }, { 8218, 0x0000 }, - { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, - { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x006f }, -}; - -static int -ksc5601_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (n >= 2) { - const Summary16 *summary = NULL; - if (wc < 0x0460) - summary = &ksc5601_uni2indx_page00[(wc>>4)]; - else if (wc >= 0x2000 && wc < 0x2670) /* General Punctuation (2000, 206F) */ - summary = &ksc5601_uni2indx_page20[(wc>>4)-0x200]; - 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) /* CJK Unified Ideographs (4E00, 9FFF) */ - summary = &ksc5601_uni2indx_page4e[(wc>>4)-0x4e0]; - else if (wc >= 0xac00 && wc < 0xd7a0) /* Hangul Syllables (AC00, D7AF) 11183 */ - summary = &ksc5601_uni2indx_pageac[(wc>>4)-0xac0]; - else if (wc >= 0xf900 && wc < 0xfa10) /* CJK Compatibility Ideographs (F900, FAFF) */ - summary = &ksc5601_uni2indx_pagef9[(wc>>4)-0xf90]; - 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; - unsigned int i = wc & 0x0f; - if (used & ((unsigned short) 1 << i)) { - unsigned short c; - /* Keep in `used' only the bits 0..i-1. */ - used &= ((unsigned short) 1 << i) - 1; - /* Add `summary->indx' and the number of bits set in `used'. */ - used = (used & 0x5555) + ((used & 0xaaaa) >> 1); - used = (used & 0x3333) + ((used & 0xcccc) >> 2); - used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); - used = (used & 0x00ff) + (used >> 8); - c = ksc5601_2charset[summary->indx + used]; - r[0] = (c >> 8); r[1] = (c & 0xff); - return 2; - } - } - return RET_ILSEQ; - } - return RET_TOOSMALL; -} diff --git a/nx-X11/lib/X11/lcUniConv/mulelao.h b/nx-X11/lib/X11/lcUniConv/mulelao.h deleted file mode 100644 index 5b8245762..000000000 --- a/nx-X11/lib/X11/lcUniConv/mulelao.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * MULELAO-1 - */ - -static const unsigned short mulelao_2uni[96] = { - /* 0xa0 */ - 0x00a0, 0x0e81, 0x0e82, 0xfffd, 0x0e84, 0xfffd, 0xfffd, 0x0e87, - 0x0e88, 0xfffd, 0x0e8a, 0xfffd, 0xfffd, 0x0e8d, 0xfffd, 0xfffd, - /* 0xb0 */ - 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e94, 0x0e95, 0x0e96, 0x0e97, - 0xfffd, 0x0e99, 0x0e9a, 0x0e9b, 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, - /* 0xc0 */ - 0xfffd, 0x0ea1, 0x0ea2, 0x0ea3, 0xfffd, 0x0ea5, 0xfffd, 0x0ea7, - 0xfffd, 0xfffd, 0x0eaa, 0x0eab, 0xfffd, 0x0ead, 0x0eae, 0x0eaf, - /* 0xd0 */ - 0x0eb0, 0x0eb1, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, - 0x0eb8, 0x0eb9, 0xfffd, 0x0ebb, 0x0ebc, 0x0ebd, 0xfffd, 0xfffd, - /* 0xe0 */ - 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0xfffd, 0x0ec6, 0xfffd, - 0x0ec8, 0x0ec9, 0x0eca, 0x0ecb, 0x0ecc, 0x0ecd, 0xfffd, 0xfffd, - /* 0xf0 */ - 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, - 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x0edc, 0x0edd, 0xfffd, 0xfffd, -}; - -static int -mulelao_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0xa0) { - *pwc = (ucs4_t) c; - return 1; - } - else { - unsigned short wc = mulelao_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char mulelao_page0e[96] = { - 0x00, 0xa1, 0xa2, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0x80-0x87 */ - 0xa8, 0x00, 0xaa, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x90-0x97 */ - 0x00, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x98-0x9f */ - 0x00, 0xc1, 0xc2, 0xc3, 0x00, 0xc5, 0x00, 0xc7, /* 0xa0-0xa7 */ - 0x00, 0x00, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xa8-0xaf */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xb0-0xb7 */ - 0xd8, 0xd9, 0x00, 0xdb, 0xdc, 0xdd, 0x00, 0x00, /* 0xb8-0xbf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x00, 0xe6, 0x00, /* 0xc0-0xc7 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0x00, 0x00, /* 0xc8-0xcf */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ - 0xf8, 0xf9, 0x00, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xd8-0xdf */ -}; - -static int -mulelao_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x00a0) { - *r = wc; - return 1; - } - else if (wc == 0x00a0) - c = 0xa0; - else if (wc >= 0x0e80 && wc < 0x0ee0) - c = mulelao_page0e[wc-0x0e80]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/tatar_cyr.h b/nx-X11/lib/X11/lcUniConv/tatar_cyr.h deleted file mode 100644 index 471e5a79a..000000000 --- a/nx-X11/lib/X11/lcUniConv/tatar_cyr.h +++ /dev/null @@ -1,122 +0,0 @@ - -/* - * TATAR-CYR - */ - -static const unsigned short tatar_cyr_2uni[128] = { - /* 0x80 */ - 0x04d8, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, - 0x20ac, 0x2030, 0x04e8, 0x2039, 0x04ae, 0x0496, 0x04a2, 0x04ba, - /* 0x90 */ - 0x04d9, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, - 0x98, 0x2122, 0x04e9, 0x203a, 0x04af, 0x0497, 0x04a3, 0x04bb, - /* 0xa0 */ - 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, - 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, - /* 0xb0 */ - 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, - 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, - /* 0xc0 */ - 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, - 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, - /* 0xd0 */ - 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, - 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, - /* 0xe0 */ - 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, - 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, - /* 0xf0 */ - 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, - 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, -}; - -static int -tatar_cyr_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) tatar_cyr_2uni[c-0x80]; - return 1; -} - -static const unsigned char tatar_cyr_page00[32] = { - 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ - 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ - 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ -}; -static const unsigned char tatar_cyr_page04[240] = { - 0x00, 0xa8, 0x00, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ - 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, /* 0x08-0x0f */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ - 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ - 0x00, 0xb8, 0x00, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ - 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x9d, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0x00, 0x00, 0x8e, 0x9e, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x9c, /* 0xa8-0xaf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x8f, 0x9f, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x80, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ -}; -static const unsigned char tatar_cyr_page20[48] = { - 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ - 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ -}; -static const unsigned char tatar_cyr_page21[24] = { - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ -}; -static const unsigned char tatar_cyr_page22[1] = { - 0xb0, /* 0x16-0x16 */ -}; - -static int -tatar_cyr_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x00bc) - c = tatar_cyr_page00[wc-0x00a0]; - else if (wc >= 0x0400 && wc < 0x04ef) - c = tatar_cyr_page04[wc-0x0400]; - else if (wc >= 0x2010 && wc < 0x203b) - c = tatar_cyr_page20[wc-0x2010]; - else if (wc == 0x20ac) - c = 0x88; - else if (wc >= 0x2110 && wc < 0x2123) - c = tatar_cyr_page21[wc-0x2110]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/tcvn.h b/nx-X11/lib/X11/lcUniConv/tcvn.h deleted file mode 100644 index 4662683dc..000000000 --- a/nx-X11/lib/X11/lcUniConv/tcvn.h +++ /dev/null @@ -1,133 +0,0 @@ - -/* - * TCVN-5712 - */ - -static const unsigned short tcvn_2uni_1[32] = { - /* 0x00 */ - 0x0000, 0x00da, 0x1ee4, 0x0003, 0x1eea, 0x1eec, 0x1eee, 0x0007, - 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, - /* 0x10 */ - 0x0010, 0x1ee8, 0x1ef0, 0x1ef2, 0x1ef6, 0x1ef8, 0x00dd, 0x1ef4, - 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, -}; -static const unsigned short tcvn_2uni_2[128] = { - /* 0x80 */ - 0x00c0, 0x1ea2, 0x00c3, 0x00c1, 0x1ea0, 0x1eb6, 0x1eac, 0x00c8, - 0x1eba, 0x1ebc, 0x00c9, 0x1eb8, 0x1ec6, 0x00cc, 0x1ec8, 0x0128, - /* 0x90 */ - 0x00cd, 0x1eca, 0x00d2, 0x1ece, 0x00d5, 0x00d3, 0x1ecc, 0x1ed8, - 0x1edc, 0x1ede, 0x1ee0, 0x1eda, 0x1ee2, 0x00d9, 0x1ee6, 0x0168, - /* 0xa0 */ - 0x00a0, 0x0102, 0x00c2, 0x00ca, 0x00d4, 0x01a0, 0x01af, 0x0110, - 0x0103, 0x00e2, 0x00ea, 0x00f4, 0x01a1, 0x01b0, 0x0111, 0x1eb0, - /* 0xb0 */ - 0x0300, 0x0309, 0x0303, 0x0301, 0x0323, 0x00e0, 0x1ea3, 0x00e3, - 0x00e1, 0x1ea1, 0x1eb2, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eaf, 0x1eb4, - /* 0xc0 */ - 0x1eae, 0x1ea6, 0x1ea8, 0x1eaa, 0x1ea4, 0x1ec0, 0x1eb7, 0x1ea7, - 0x1ea9, 0x1eab, 0x1ea5, 0x1ead, 0x00e8, 0x1ec2, 0x1ebb, 0x1ebd, - /* 0xd0 */ - 0x00e9, 0x1eb9, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ebf, 0x1ec7, 0x00ec, - 0x1ec9, 0x1ec4, 0x1ebe, 0x1ed2, 0x0129, 0x00ed, 0x1ecb, 0x00f2, - /* 0xe0 */ - 0x1ed4, 0x1ecf, 0x00f5, 0x00f3, 0x1ecd, 0x1ed3, 0x1ed5, 0x1ed7, - 0x1ed1, 0x1ed9, 0x1edd, 0x1edf, 0x1ee1, 0x1edb, 0x1ee3, 0x00f9, - /* 0xf0 */ - 0x1ed6, 0x1ee7, 0x0169, 0x00fa, 0x1ee5, 0x1eeb, 0x1eed, 0x1eef, - 0x1ee9, 0x1ef1, 0x1ef3, 0x1ef7, 0x1ef9, 0x00fd, 0x1ef5, 0x1ed0, -}; - -static int -tcvn_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x20) - *pwc = (ucs4_t) tcvn_2uni_1[c]; - else if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) tcvn_2uni_2[c-0x80]; - return 1; -} - -static const unsigned char tcvn_page00[96+184] = { - 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ - 0x80, 0x83, 0xa2, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0x87, 0x8a, 0xa3, 0x00, 0x8d, 0x90, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0x92, 0x95, 0xa4, 0x94, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0x9d, 0x01, 0x00, 0x00, 0x16, 0x00, 0x00, /* 0xd8-0xdf */ - 0xb5, 0xb8, 0xa9, 0xb7, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0xcc, 0xd0, 0xaa, 0x00, 0xd7, 0xdd, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0xdf, 0xe3, 0xab, 0xe2, 0x00, 0x00, /* 0xf0-0xf7 */ - 0x00, 0xef, 0xf3, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ - /* 0x0100 */ - 0x00, 0x00, 0xa1, 0xa8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0xa7, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0x8f, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x9f, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0xa5, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, /* 0xa8-0xaf */ - 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ -}; -static const unsigned char tcvn_page03[40] = { - 0xb0, 0xb3, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ -}; -static const unsigned char tcvn_page1e[96] = { - 0x84, 0xb9, 0x81, 0xb6, 0xc4, 0xca, 0xc1, 0xc7, /* 0xa0-0xa7 */ - 0xc2, 0xc8, 0xc3, 0xc9, 0x86, 0xcb, 0xc0, 0xbe, /* 0xa8-0xaf */ - 0xaf, 0xbb, 0xba, 0xbc, 0xbf, 0xbd, 0x85, 0xc6, /* 0xb0-0xb7 */ - 0x8b, 0xd1, 0x88, 0xce, 0x89, 0xcf, 0xda, 0xd5, /* 0xb8-0xbf */ - 0xc5, 0xd2, 0xcd, 0xd3, 0xd9, 0xd4, 0x8c, 0xd6, /* 0xc0-0xc7 */ - 0x8e, 0xd8, 0x91, 0xde, 0x96, 0xe4, 0x93, 0xe1, /* 0xc8-0xcf */ - 0xff, 0xe8, 0xdb, 0xe5, 0xe0, 0xe6, 0xf0, 0xe7, /* 0xd0-0xd7 */ - 0x97, 0xe9, 0x9b, 0xed, 0x98, 0xea, 0x99, 0xeb, /* 0xd8-0xdf */ - 0x9a, 0xec, 0x9c, 0xee, 0x02, 0xf4, 0x9e, 0xf1, /* 0xe0-0xe7 */ - 0x11, 0xf8, 0x04, 0xf5, 0x05, 0xf6, 0x06, 0xf7, /* 0xe8-0xef */ - 0x12, 0xf9, 0x13, 0xfa, 0x17, 0xfe, 0x14, 0xfb, /* 0xf0-0xf7 */ - 0x15, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ -}; - -static int -tcvn_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080 && (wc >= 0x0020 || (0x00fe0076 & (1 << wc)) == 0)) { - *r = wc; - return 1; - } - else if (wc >= 0x00a0 && wc < 0x01b8) - c = tcvn_page00[wc-0x00a0]; - else if (wc >= 0x0300 && wc < 0x0328) - c = tcvn_page03[wc-0x0300]; - else if (wc >= 0x1ea0 && wc < 0x1f00) - c = tcvn_page1e[wc-0x1ea0]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/tis620.h b/nx-X11/lib/X11/lcUniConv/tis620.h deleted file mode 100644 index 4fa96ec98..000000000 --- a/nx-X11/lib/X11/lcUniConv/tis620.h +++ /dev/null @@ -1,77 +0,0 @@ - -/* - * TIS620-0 - */ - -static const unsigned short tis620_2uni[96] = { - /* 0xa0 */ - 0xfffd, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, - 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, - /* 0xb0 */ - 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, - 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, - /* 0xc0 */ - 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, - 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, - /* 0xd0 */ - 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, - 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, - /* 0xe0 */ - 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, - 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, - /* 0xf0 */ - 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, - 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, -}; - -static int -tis620_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x80) { - *pwc = (ucs4_t) c; - return 1; - } - else if (c < 0xa0) { - } - else { - unsigned short wc = tis620_2uni[c-0xa0]; - if (wc != 0xfffd) { - *pwc = (ucs4_t) wc; - return 1; - } - } - return RET_ILSEQ; -} - -static const unsigned char tis620_page0e[96] = { - 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ - 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ - 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ - 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ - 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ - 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ - 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ - 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ - 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ - 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ - 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ - 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ -}; - -static int -tis620_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080) { - *r = wc; - return 1; - } - else if (wc >= 0x0e00 && wc < 0x0e60) - c = tis620_page0e[wc-0x0e00]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/ucs2be.h b/nx-X11/lib/X11/lcUniConv/ucs2be.h deleted file mode 100644 index 20a8b27bd..000000000 --- a/nx-X11/lib/X11/lcUniConv/ucs2be.h +++ /dev/null @@ -1,31 +0,0 @@ -/* - * UCS-2BE = UCS-2 big endian - */ - -static int -ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - if (n >= 2) { - if (s[0] >= 0xd8 && s[0] < 0xe0) { - return RET_ILSEQ; - } else { - *pwc = (s[0] << 8) + s[1]; - return 2; - } - } - return RET_TOOFEW(0); -} - -static int -ucs2be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { - if (n >= 2) { - r[0] = (unsigned char) (wc >> 8); - r[1] = (unsigned char) wc; - return 2; - } else - return RET_TOOSMALL; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUniConv/utf8.h b/nx-X11/lib/X11/lcUniConv/utf8.h deleted file mode 100644 index d00995ca0..000000000 --- a/nx-X11/lib/X11/lcUniConv/utf8.h +++ /dev/null @@ -1,109 +0,0 @@ - -/* - * UTF-8 - */ - -/* Specification: RFC 2279 */ - -static int -utf8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = s[0]; - - if (c < 0x80) { - *pwc = c; - return 1; - } else if (c < 0xc2) { - return RET_ILSEQ; - } else if (c < 0xe0) { - if (n < 2) - return RET_TOOFEW(0); - if (!((s[1] ^ 0x80) < 0x40)) - return RET_ILSEQ; - *pwc = ((ucs4_t) (c & 0x1f) << 6) - | (ucs4_t) (s[1] ^ 0x80); - return 2; - } else if (c < 0xf0) { - if (n < 3) - return RET_TOOFEW(0); - if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (c >= 0xe1 || s[1] >= 0xa0))) - return RET_ILSEQ; - *pwc = ((ucs4_t) (c & 0x0f) << 12) - | ((ucs4_t) (s[1] ^ 0x80) << 6) - | (ucs4_t) (s[2] ^ 0x80); - return 3; - } else if (c < 0xf8) { - if (n < 4) - return RET_TOOFEW(0); - if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 - && (c >= 0xf1 || s[1] >= 0x90))) - return RET_ILSEQ; - *pwc = ((ucs4_t) (c & 0x07) << 18) - | ((ucs4_t) (s[1] ^ 0x80) << 12) - | ((ucs4_t) (s[2] ^ 0x80) << 6) - | (ucs4_t) (s[3] ^ 0x80); - return 4; - } else if (c < 0xfc) { - if (n < 5) - return RET_TOOFEW(0); - if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (c >= 0xf9 || s[1] >= 0x88))) - return RET_ILSEQ; - *pwc = ((ucs4_t) (c & 0x03) << 24) - | ((ucs4_t) (s[1] ^ 0x80) << 18) - | ((ucs4_t) (s[2] ^ 0x80) << 12) - | ((ucs4_t) (s[3] ^ 0x80) << 6) - | (ucs4_t) (s[4] ^ 0x80); - return 5; - } else if (c < 0xfe) { - if (n < 6) - return RET_TOOFEW(0); - if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 - && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 - && (s[5] ^ 0x80) < 0x40 - && (c >= 0xfd || s[1] >= 0x84))) - return RET_ILSEQ; - *pwc = ((ucs4_t) (c & 0x01) << 30) - | ((ucs4_t) (s[1] ^ 0x80) << 24) - | ((ucs4_t) (s[2] ^ 0x80) << 18) - | ((ucs4_t) (s[3] ^ 0x80) << 12) - | ((ucs4_t) (s[4] ^ 0x80) << 6) - | (ucs4_t) (s[5] ^ 0x80); - return 6; - } else - return RET_ILSEQ; -} - -static int -utf8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) /* n == 0 is acceptable */ -{ - int count; - if (wc < 0x80) - count = 1; - else if (wc < 0x800) - count = 2; - else if (wc < 0x10000) - count = 3; - else if (wc < 0x200000) - count = 4; - else if (wc < 0x4000000) - count = 5; - else if (wc <= 0x7fffffff) - count = 6; - else - return RET_ILSEQ; - if (n < count) - return RET_TOOSMALL; - switch (count) { /* note: code falls through cases! */ - case 6: r[5] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x4000000; - case 5: r[4] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x200000; - case 4: r[3] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x10000; - case 3: r[2] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x800; - case 2: r[1] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0xc0; - case 1: r[0] = wc; - } - return count; -} diff --git a/nx-X11/lib/X11/lcUniConv/viscii.h b/nx-X11/lib/X11/lcUniConv/viscii.h deleted file mode 100644 index d5147e81e..000000000 --- a/nx-X11/lib/X11/lcUniConv/viscii.h +++ /dev/null @@ -1,122 +0,0 @@ - -/* - * VISCII1.1-1 - */ - -/* Specification: RFC 1456 */ - -static const unsigned short viscii_2uni_1[32] = { - /* 0x00 */ - 0x0000, 0x0001, 0x1eb2, 0x0003, 0x0004, 0x1eb4, 0x1eaa, 0x0007, - 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, - /* 0x10 */ - 0x0010, 0x0011, 0x0012, 0x0013, 0x1ef6, 0x0015, 0x0016, 0x0017, - 0x0018, 0x1ef8, 0x001a, 0x001b, 0x001c, 0x001d, 0x1ef4, 0x001f, -}; -static const unsigned short viscii_2uni_2[128] = { - /* 0x80 */ - 0x1ea0, 0x1eae, 0x1eb0, 0x1eb6, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eac, - 0x1ebc, 0x1eb8, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ed0, - /* 0x90 */ - 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1ee2, 0x1eda, 0x1edc, 0x1ede, - 0x1eca, 0x1ece, 0x1ecc, 0x1ec8, 0x1ee6, 0x0168, 0x1ee4, 0x1ef2, - /* 0xa0 */ - 0x00d5, 0x1eaf, 0x1eb1, 0x1eb7, 0x1ea5, 0x1ea7, 0x1ea9, 0x1ead, - 0x1ebd, 0x1eb9, 0x1ebf, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ed1, - /* 0xb0 */ - 0x1ed3, 0x1ed5, 0x1ed7, 0x1ee0, 0x01a0, 0x1ed9, 0x1edd, 0x1edf, - 0x1ecb, 0x1ef0, 0x1ee8, 0x1eea, 0x1eec, 0x01a1, 0x1edb, 0x01af, - /* 0xc0 */ - 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x1ea2, 0x0102, 0x1eb3, 0x1eb5, - 0x00c8, 0x00c9, 0x00ca, 0x1eba, 0x00cc, 0x00cd, 0x0128, 0x1ef3, - /* 0xd0 */ - 0x0110, 0x1ee9, 0x00d2, 0x00d3, 0x00d4, 0x1ea1, 0x1ef7, 0x1eeb, - 0x1eed, 0x00d9, 0x00da, 0x1ef9, 0x1ef5, 0x00dd, 0x1ee1, 0x01b0, - /* 0xe0 */ - 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x1ea3, 0x0103, 0x1eef, 0x1eab, - 0x00e8, 0x00e9, 0x00ea, 0x1ebb, 0x00ec, 0x00ed, 0x0129, 0x1ec9, - /* 0xf0 */ - 0x0111, 0x1ef1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x1ecf, 0x1ecd, - 0x1ee5, 0x00f9, 0x00fa, 0x0169, 0x1ee7, 0x00fd, 0x1ee3, 0x1eee, -}; - -static int -viscii_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) -{ - unsigned char c = *s; - if (c < 0x20) - *pwc = (ucs4_t) viscii_2uni_1[c]; - else if (c < 0x80) - *pwc = (ucs4_t) c; - else - *pwc = (ucs4_t) viscii_2uni_2[c-0x80]; - return 1; -} - -static const unsigned char viscii_page00[64+184] = { - 0xc0, 0xc1, 0xc2, 0xc3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ - 0xc8, 0xc9, 0xca, 0x00, 0xcc, 0xcd, 0x00, 0x00, /* 0xc8-0xcf */ - 0x00, 0x00, 0xd2, 0xd3, 0xd4, 0xa0, 0x00, 0x00, /* 0xd0-0xd7 */ - 0x00, 0xd9, 0xda, 0x00, 0x00, 0xdd, 0x00, 0x00, /* 0xd8-0xdf */ - 0xe0, 0xe1, 0xe2, 0xe3, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ - 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xed, 0x00, 0x00, /* 0xe8-0xef */ - 0x00, 0x00, 0xf2, 0xf3, 0xf4, 0xf5, 0x00, 0x00, /* 0xf0-0xf7 */ - 0x00, 0xf9, 0xfa, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ - /* 0x0100 */ - 0x00, 0x00, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ - 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ - 0xce, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ - 0x9d, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ - 0xb4, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ - 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, /* 0xa8-0xaf */ - 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ -}; -static const unsigned char viscii_page1e[96] = { - 0x80, 0xd5, 0xc4, 0xe4, 0x84, 0xa4, 0x85, 0xa5, /* 0xa0-0xa7 */ - 0x86, 0xa6, 0x06, 0xe7, 0x87, 0xa7, 0x81, 0xa1, /* 0xa8-0xaf */ - 0x82, 0xa2, 0x02, 0xc6, 0x05, 0xc7, 0x83, 0xa3, /* 0xb0-0xb7 */ - 0x89, 0xa9, 0xcb, 0xeb, 0x88, 0xa8, 0x8a, 0xaa, /* 0xb8-0xbf */ - 0x8b, 0xab, 0x8c, 0xac, 0x8d, 0xad, 0x8e, 0xae, /* 0xc0-0xc7 */ - 0x9b, 0xef, 0x98, 0xb8, 0x9a, 0xf7, 0x99, 0xf6, /* 0xc8-0xcf */ - 0x8f, 0xaf, 0x90, 0xb0, 0x91, 0xb1, 0x92, 0xb2, /* 0xd0-0xd7 */ - 0x93, 0xb5, 0x95, 0xbe, 0x96, 0xb6, 0x97, 0xb7, /* 0xd8-0xdf */ - 0xb3, 0xde, 0x94, 0xfe, 0x9e, 0xf8, 0x9c, 0xfc, /* 0xe0-0xe7 */ - 0xba, 0xd1, 0xbb, 0xd7, 0xbc, 0xd8, 0xff, 0xe6, /* 0xe8-0xef */ - 0xb9, 0xf1, 0x9f, 0xcf, 0x1e, 0xdc, 0x14, 0xd6, /* 0xf0-0xf7 */ - 0x19, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ -}; - -static int -viscii_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) -{ - unsigned char c = 0; - if (wc < 0x0080 && (wc >= 0x0020 || (0x42100064 & (1 << wc)) == 0)) { - *r = wc; - return 1; - } - else if (wc >= 0x00c0 && wc < 0x01b8) - c = viscii_page00[wc-0x00c0]; - else if (wc >= 0x1ea0 && wc < 0x1f00) - c = viscii_page1e[wc-0x1ea0]; - if (c != 0) { - *r = c; - return 1; - } - return RET_ILSEQ; -} diff --git a/nx-X11/lib/X11/lcUtil.c b/nx-X11/lib/X11/lcUtil.c deleted file mode 100644 index 52a16daea..000000000 --- a/nx-X11/lib/X11/lcUtil.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - * Bug fixes: Bruno Haible XFree86 Inc. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "XlcPublic.h" - -/* Don't use here because it is locale dependent. */ - -#define set_toupper(ch) \ - if (ch >= 'a' && ch <= 'z') \ - ch = ch - 'a' + 'A'; - -/* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. - Like strcasecmp in an ASCII locale. */ -int -_XlcCompareISOLatin1( - const char *str1, - const char *str2) -{ - unsigned char ch1, ch2; - - for ( ; ; str1++, str2++) { - ch1 = *str1; - ch2 = *str2; - if (ch1 == '\0' || ch2 == '\0') - break; - set_toupper(ch1); - set_toupper(ch2); - if (ch1 != ch2) - break; - } - - return ch1 - ch2; -} - -/* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring - case of ASCII letters. Like strncasecmp in an ASCII locale. */ -int -_XlcNCompareISOLatin1( - const char *str1, - const char *str2, - int len) -{ - unsigned char ch1, ch2; - - for ( ; ; str1++, str2++, len--) { - if (len == 0) - return 0; - ch1 = *str1; - ch2 = *str2; - if (ch1 == '\0' || ch2 == '\0') - break; - set_toupper(ch1); - set_toupper(ch2); - if (ch1 != ch2) - break; - } - - return ch1 - ch2; -} diff --git a/nx-X11/lib/X11/lcWrap.c b/nx-X11/lib/X11/lcWrap.c deleted file mode 100644 index 067c501ba..000000000 --- a/nx-X11/lib/X11/lcWrap.c +++ /dev/null @@ -1,648 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * Copyright 1991 by the Open Software Foundation - * Copyright 1993 by the TOSHIBA Corp. - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 names of Open Software Foundation and TOSHIBA - * not be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Open Software - * Foundation and TOSHIBA 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 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 - * 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 - * - * Katsuhisa Yano TOSHIBA Corp. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xlcint.h" -#include -#include -#ifdef WIN32 -#undef close -#endif -#include -#include "XlcPubI.h" - -#ifdef XTHREADS -LockInfoPtr _Xi18n_lock; -#endif - -char * -XSetLocaleModifiers( - const char *modifiers) -{ - XLCd lcd = _XlcCurrentLC(); - char *user_mods; - char *mapped_mods; - - if (!lcd) - return (char *) NULL; - if (!modifiers) - return lcd->core->modifiers; - user_mods = getenv("XMODIFIERS"); - mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers); - if (mapped_mods) { - Xfree(lcd->core->modifiers); - lcd->core->modifiers = mapped_mods; - } - return mapped_mods; -} - -Bool -XSupportsLocale(void) -{ - return _XlcCurrentLC() != (XLCd)NULL; -} - -Bool _XlcValidModSyntax( - const char * mods, - const char * const *valid_mods) -{ - int i; - const char * const *ptr; - - while (mods && (*mods == '@')) { - mods++; - if (*mods == '@') - break; - for (ptr = valid_mods; *ptr; ptr++) { - i = strlen(*ptr); - if (strncmp(mods, *ptr, i) || ((mods[i] != '=') -#ifdef WIN32 - && (mods[i] != '#') -#endif - )) - continue; - mods = strchr(mods+i+1, '@'); - break; - } - } - return !mods || !*mods; -} - -static const char *im_valid[] = {"im", (const char *)NULL}; - -/*ARGSUSED*/ -char * -_XlcDefaultMapModifiers( - XLCd lcd, - const char *user_mods, - const char *prog_mods) -{ - int i; - char *mods; - - if (!_XlcValidModSyntax(prog_mods, im_valid)) - return (char *)NULL; - if (!_XlcValidModSyntax(user_mods, im_valid)) - return (char *)NULL; - i = strlen(prog_mods) + 1; - if (user_mods) - i += strlen(user_mods); - mods = Xmalloc(i); - if (mods) { - strcpy(mods, prog_mods); - if (user_mods) - strcat(mods, user_mods); -#ifdef WIN32 - { - char *s; - for (s = mods; (s = strchr(s, '@')); s++) { - for (s++; *s && *s != '='; s++) { - if (*s == '#') { - *s = '='; - break; - } - } - } - } -#endif - } - return mods; -} - -typedef struct _XLCdListRec { - struct _XLCdListRec *next; - XLCd lcd; - int ref_count; -} XLCdListRec, *XLCdList; - -static XLCdList lcd_list = NULL; - -typedef struct _XlcLoaderListRec { - struct _XlcLoaderListRec *next; - XLCdLoadProc proc; -} XlcLoaderListRec, *XlcLoaderList; - -static XlcLoaderList loader_list = NULL; - -void -_XlcRemoveLoader( - XLCdLoadProc proc) -{ - XlcLoaderList loader, prev; - - if (loader_list == NULL) - return; - - prev = loader = loader_list; - if (loader->proc == proc) { - loader_list = loader->next; - Xfree(loader); - return; - } - - while ((loader = loader->next)) { - if (loader->proc == proc) { - prev->next = loader->next; - Xfree(loader); - return; - } - prev = loader; - } - - return; -} - -Bool -_XlcAddLoader( - XLCdLoadProc proc, - XlcPosition position) -{ - XlcLoaderList loader, last; - - _XlcRemoveLoader(proc); /* remove old loader, if exist */ - - loader = Xmalloc(sizeof(XlcLoaderListRec)); - if (loader == NULL) - return False; - - loader->proc = proc; - - if (loader_list == NULL) - position = XlcHead; - - if (position == XlcHead) { - loader->next = loader_list; - loader_list = loader; - } else { - last = loader_list; - while (last->next) - last = last->next; - - loader->next = NULL; - last->next = loader; - } - - return True; -} - -XLCd -_XOpenLC( - char *name) -{ - XLCd lcd; - XlcLoaderList loader; - XLCdList cur; -#if !defined(X_LOCALE) - int len; - char sinamebuf[256]; - char* siname = sinamebuf; -#endif - - 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 - */ - if ((len = strlen(name)) >= sizeof sinamebuf) { - siname = Xmalloc (len + 1); - if (siname == NULL) - return NULL; - } - name = _XlcMapOSLocaleName(name, siname); -#endif - } - - _XLockMutex(_Xi18n_lock); - - /* - * search for needed lcd, if found return it - */ - for (cur = lcd_list; cur; cur = cur->next) { - if (!strcmp (cur->lcd->core->name, name)) { - lcd = cur->lcd; - cur->ref_count++; - goto found; - } - } - - if (!loader_list) - _XlcInitLoader(); - - /* - * not there, so try to get and add to list - */ - for (loader = loader_list; loader; loader = loader->next) { - lcd = (*loader->proc)(name); - if (lcd) { - cur = Xmalloc (sizeof(XLCdListRec)); - if (cur) { - cur->lcd = lcd; - cur->ref_count = 1; - cur->next = lcd_list; - lcd_list = cur; - } else { - (*lcd->methods->close)(lcd); - lcd = (XLCd) NULL; - } - goto found; - } - } - - lcd = NULL; - -found: - _XUnlockMutex(_Xi18n_lock); - -#if !defined(X_LOCALE) - if (siname != sinamebuf) Xfree(siname); -#endif - - return lcd; -} - -void -_XCloseLC( - XLCd lcd) -{ - XLCdList cur, *prev; - - for (prev = &lcd_list; (cur = *prev); prev = &cur->next) { - if (cur->lcd == lcd) { - if (--cur->ref_count < 1) { - (*lcd->methods->close)(lcd); - *prev = cur->next; - Xfree(cur); - } - break; - } - } - - if(loader_list) { - _XlcDeInitLoader(); - loader_list = NULL; - } -} - -/* - * Get the XLCd for the current locale - */ - -XLCd -_XlcCurrentLC(void) -{ - XLCd lcd; - static XLCd last_lcd = NULL; - - lcd = _XOpenLC((char *) NULL); - - if (last_lcd) - _XCloseLC(last_lcd); - - last_lcd = lcd; - - return lcd; -} - -XrmMethods -_XrmInitParseInfo( - XPointer *state) -{ - XLCd lcd = _XOpenLC((char *) NULL); - - if (lcd == (XLCd) NULL) - return (XrmMethods) NULL; - - return (*lcd->methods->init_parse_info)(lcd, state); -} - -int -XmbTextPropertyToTextList( - Display *dpy, - const XTextProperty *text_prop, - char ***list_ret, - int *count_ret) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return XLocaleNotSupported; - - return (*lcd->methods->mb_text_prop_to_list)(lcd, dpy, text_prop, list_ret, - count_ret); -} - -int -XwcTextPropertyToTextList( - Display *dpy, - const XTextProperty *text_prop, - wchar_t ***list_ret, - int *count_ret) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return XLocaleNotSupported; - - return (*lcd->methods->wc_text_prop_to_list)(lcd, dpy, text_prop, list_ret, - count_ret); -} - -int -Xutf8TextPropertyToTextList( - Display *dpy, - const XTextProperty *text_prop, - char ***list_ret, - int *count_ret) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return XLocaleNotSupported; - - return (*lcd->methods->utf8_text_prop_to_list)(lcd, dpy, text_prop, - list_ret, count_ret); -} - -int -XmbTextListToTextProperty( - Display *dpy, - char **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return XLocaleNotSupported; - - return (*lcd->methods->mb_text_list_to_prop)(lcd, dpy, list, count, style, - text_prop); -} - -int -XwcTextListToTextProperty( - Display *dpy, - wchar_t **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return XLocaleNotSupported; - - return (*lcd->methods->wc_text_list_to_prop)(lcd, dpy, list, count, style, - text_prop); -} - -int -Xutf8TextListToTextProperty( - Display *dpy, - char **list, - int count, - XICCEncodingStyle style, - XTextProperty *text_prop) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return XLocaleNotSupported; - - return (*lcd->methods->utf8_text_list_to_prop)(lcd, dpy, list, count, - style, text_prop); -} - -void -XwcFreeStringList( - wchar_t **list) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return; - - (*lcd->methods->wc_free_string_list)(lcd, list); -} - -const char * -XDefaultString(void) -{ - XLCd lcd = _XlcCurrentLC(); - - if (lcd == NULL) - return (char *) NULL; - - return (*lcd->methods->default_string)(lcd); -} - -void -_XlcCopyFromArg( - char *src, - char *dst, - int size) -{ - if (size == sizeof(long)) - *((long *) dst) = (long) src; -#ifdef LONG64 - else if (size == sizeof(int)) - *((int *) dst) = (int)(long) src; -#endif - else if (size == sizeof(short)) - *((short *) dst) = (short)(long) src; - else if (size == sizeof(char)) - *((char *) dst) = (char)(long) src; - else if (size == sizeof(XPointer)) - *((XPointer *) dst) = (XPointer) src; - else if (size > sizeof(XPointer)) - memcpy(dst, (char *) src, size); - else - memcpy(dst, (char *) &src, size); -} - -void -_XlcCopyToArg( - char *src, - char **dst, - int size) -{ - /* FIXME: - On Big Endian machines, this behaves differently than _XCopyToArg. */ - if (size == sizeof(long)) - *((long *) *dst) = *((long *) src); -#ifdef LONG64 - else if (size == sizeof(int)) - *((int *) *dst) = *((int *) src); -#endif - else if (size == sizeof(short)) - *((short *) *dst) = *((short *) src); - else if (size == sizeof(char)) - *((char *) *dst) = *((char *) src); - else if (size == sizeof(XPointer)) - *((XPointer *) *dst) = *((XPointer *) src); - else - memcpy(*dst, src, size); -} - -void -_XlcCountVaList( - va_list var, - int *count_ret) -{ - int count; - - for (count = 0; va_arg(var, char *); count++) - (void)va_arg(var, XPointer); - - *count_ret = count; -} - -void -_XlcVaToArgList( - va_list var, - int count, - XlcArgList *args_ret) -{ - XlcArgList args; - - *args_ret = args = 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); - } -} - -void -_XlcCompileResourceList( - XlcResourceList resources, - int num_resources) -{ - for ( ; num_resources-- > 0; resources++) - resources->xrm_name = XrmPermStringToQuark(resources->name); -} - -char * -_XlcGetValues( - XPointer base, - XlcResourceList resources, - int num_resources, - XlcArgList args, - int num_args, - unsigned long mask) -{ - XlcResourceList res; - XrmQuark xrm_name; - int count; - - for ( ; num_args-- > 0; args++) { - res = resources; - count = num_resources; - xrm_name = XrmPermStringToQuark(args->name); - - for ( ; count-- > 0; res++) { - if (xrm_name == res->xrm_name && (mask & res->mask)) { - _XlcCopyToArg(base + res->offset, &args->value, res->size); - break; - } - } - - if (count < 0) - return args->name; - } - - return NULL; -} - -char * -_XlcSetValues( - XPointer base, - XlcResourceList resources, - int num_resources, - XlcArgList args, - int num_args, - unsigned long mask) -{ - XlcResourceList res; - XrmQuark xrm_name; - int count; - - for ( ; num_args-- > 0; args++) { - res = resources; - count = num_resources; - xrm_name = XrmPermStringToQuark(args->name); - - for ( ; count-- > 0; res++) { - if (xrm_name == res->xrm_name && (mask & res->mask)) { - _XlcCopyFromArg(args->value, base + res->offset, res->size); - break; - } - } - - if (count < 0) - return args->name; - } - - return NULL; -} diff --git a/nx-X11/lib/X11/locking.c b/nx-X11/lib/X11/locking.c deleted file mode 100644 index 9f4fe0677..000000000 --- a/nx-X11/lib/X11/locking.c +++ /dev/null @@ -1,625 +0,0 @@ -/* - -Copyright 1992, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Author: Stephen Gildea, MIT X Consortium - * - * locking.c - multi-thread locking routines implemented in C Threads - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#undef _XLockMutex -#undef _XUnlockMutex -#undef _XCreateMutex -#undef _XFreeMutex - -#ifdef XTHREADS - -#ifdef __UNIXWARE__ -#include -#endif - -#include "Xprivate.h" -#include "locking.h" -#ifdef XTHREADS_WARN -#include /* for warn/debug stuff */ -#endif - -/* Additional arguments for source code location lock call was made from */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -# define XTHREADS_FILE_LINE_ARGS \ - , \ - char* file, /* source file, from macro */ \ - int line -#else -# define XTHREADS_FILE_LINE_ARGS /* None */ -#endif - - -#define NUM_FREE_CVLS 4 - -/* in lcWrap.c */ -extern LockInfoPtr _Xi18n_lock; - -#ifdef WIN32 -static DWORD _X_TlsIndex = (DWORD)-1; - -void _Xthread_init(void) -{ - if (_X_TlsIndex == (DWORD)-1) - _X_TlsIndex = TlsAlloc(); -} - -struct _xthread_waiter * -_Xthread_waiter(void) -{ - struct _xthread_waiter *me; - - if (!(me = TlsGetValue(_X_TlsIndex))) { - me = xmalloc(sizeof(struct _xthread_waiter)); - me->sem = CreateSemaphore(NULL, 0, 1, NULL); - me->next = NULL; - TlsSetValue(_X_TlsIndex, me); - } - return me; -} -#endif /* WIN32 */ - -static xthread_t _Xthread_self(void) -{ - return xthread_self(); -} - -static LockInfoRec global_lock; -static LockInfoRec i18n_lock; - -static void _XLockMutex( - LockInfoPtr lip - XTHREADS_FILE_LINE_ARGS - ) -{ - xmutex_lock(lip->lock); -} - -static void _XUnlockMutex( - LockInfoPtr lip - XTHREADS_FILE_LINE_ARGS - ) -{ - xmutex_unlock(lip->lock); -} - -static void _XCreateMutex( - LockInfoPtr lip) -{ - lip->lock = xmutex_malloc(); - if (lip->lock) { - xmutex_init(lip->lock); - xmutex_set_name(lip->lock, "Xlib"); - } -} - -static void _XFreeMutex( - LockInfoPtr lip) -{ - xmutex_clear(lip->lock); - xmutex_free(lip->lock); -} - -#ifdef XTHREADS_WARN -static char *locking_file; -static int locking_line; -static xthread_t locking_thread; -static Bool xlibint_unlock = False; /* XlibInt.c may Unlock and re-Lock */ - -/* history that is useful to examine in a debugger */ -#define LOCK_HIST_SIZE 21 - -static struct { - Bool lockp; /* True for lock, False for unlock */ - xthread_t thread; - char *file; - int line; -} locking_history[LOCK_HIST_SIZE]; - -int lock_hist_loc = 0; /* next slot to fill */ - -static void _XLockDisplayWarn( - Display *dpy, - char *file, /* source file, from macro */ - int line) -{ - xthread_t self; - xthread_t old_locker; - - self = xthread_self(); - old_locker = locking_thread; - if (xthread_have_id(old_locker)) { - if (xthread_equal(old_locker, self)) - printf("Xlib ERROR: %s line %d thread %x: locking display already locked at %s line %d\n", - file, line, self, locking_file, locking_line); -#ifdef XTHREADS_DEBUG - else - printf("%s line %d: thread %x waiting on lock held by %s line %d thread %x\n", - file, line, self, - locking_file, locking_line, old_locker); -#endif /* XTHREADS_DEBUG */ - } - - xmutex_lock(dpy->lock->mutex); - - if (strcmp(file, "XlibInt.c") == 0) { - if (!xlibint_unlock) - printf("Xlib ERROR: XlibInt.c line %d thread %x locking display it did not unlock\n", - line, self); - xlibint_unlock = False; - } - -#ifdef XTHREADS_DEBUG - /* if (old_locker && old_locker != self) */ - if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ - printf("%s line %d: thread %x got display lock\n", file, line, self); -#endif /* XTHREADS_DEBUG */ - - locking_thread = self; - if (strcmp(file, "XlibInt.c") != 0) { - locking_file = file; - locking_line = line; - } - locking_history[lock_hist_loc].file = file; - locking_history[lock_hist_loc].line = line; - locking_history[lock_hist_loc].thread = self; - locking_history[lock_hist_loc].lockp = True; - lock_hist_loc++; - if (lock_hist_loc >= LOCK_HIST_SIZE) - lock_hist_loc = 0; -} -#endif /* XTHREADS_WARN */ - -static void _XUnlockDisplay( - Display *dpy - XTHREADS_FILE_LINE_ARGS - ) -{ -#ifdef XTHREADS_WARN - xthread_t self = xthread_self(); - -#ifdef XTHREADS_DEBUG - if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ - printf("%s line %d: thread %x unlocking display\n", file, line, self); -#endif /* XTHREADS_DEBUG */ - - if (!xthread_have_id(locking_thread)) - printf("Xlib ERROR: %s line %d thread %x: unlocking display that is not locked\n", - file, line, self); - else if (strcmp(file, "XlibInt.c") == 0) - xlibint_unlock = True; -#ifdef XTHREADS_DEBUG - else if (strcmp(file, locking_file) != 0) - /* not always an error because locking_file is not per-thread */ - printf("%s line %d: unlocking display locked from %s line %d (probably okay)\n", - file, line, locking_file, locking_line); -#endif /* XTHREADS_DEBUG */ - xthread_clear_id(locking_thread); - - locking_history[lock_hist_loc].file = file; - locking_history[lock_hist_loc].line = line; - locking_history[lock_hist_loc].thread = self; - locking_history[lock_hist_loc].lockp = False; - lock_hist_loc++; - if (lock_hist_loc >= LOCK_HIST_SIZE) - lock_hist_loc = 0; -#endif /* XTHREADS_WARN */ - xmutex_unlock(dpy->lock->mutex); -} - - -static struct _XCVList *_XCreateCVL( - Display *dpy) -{ - struct _XCVList *cvl; - - if ((cvl = dpy->lock->free_cvls) != NULL) { - dpy->lock->free_cvls = cvl->next; - dpy->lock->num_free_cvls--; - } else { - cvl = Xmalloc(sizeof(struct _XCVList)); - if (!cvl) - return NULL; - cvl->cv = xcondition_malloc(); - if (!cvl->cv) { - Xfree(cvl); - return NULL; - } - xcondition_init(cvl->cv); - xcondition_set_name(cvl->cv, "Xlib read queue"); - } - cvl->next = NULL; - return cvl; -} - -/* Put ourselves on the queue to read the connection. - Allocates and returns a queue element. */ - -static struct _XCVList * -_XPushReader( - Display *dpy, - struct _XCVList ***tail) -{ - struct _XCVList *cvl; - - cvl = _XCreateCVL(dpy); -#ifdef XTHREADS_DEBUG - printf("_XPushReader called in thread %x, pushing %x\n", - xthread_self(), cvl); -#endif - **tail = cvl; - *tail = &cvl->next; - return cvl; -} - -/* signal the next thread waiting to read the connection */ - -static void _XPopReader( - Display *dpy, - struct _XCVList **list, - struct _XCVList ***tail) -{ - register struct _XCVList *front = *list; - -#ifdef XTHREADS_DEBUG - printf("_XPopReader called in thread %x, popping %x\n", - xthread_self(), front); -#endif - - if (dpy->flags & XlibDisplayProcConni) - /* we never added ourself in the first place */ - return; - - if (front) { /* check "front" for paranoia */ - *list = front->next; - if (*tail == &front->next) /* did we free the last elt? */ - *tail = list; - if (dpy->lock->num_free_cvls < NUM_FREE_CVLS) { - front->next = dpy->lock->free_cvls; - dpy->lock->free_cvls = front; - dpy->lock->num_free_cvls++; - } else { - xcondition_clear(front->cv); - Xfree(front->cv); - Xfree(front); - } - } - - /* signal new front after it is in place */ - if ((dpy->lock->reply_first = (dpy->lock->reply_awaiters != NULL))) { - ConditionSignal(dpy, dpy->lock->reply_awaiters->cv); - } else if (dpy->lock->event_awaiters) { - ConditionSignal(dpy, dpy->lock->event_awaiters->cv); - } -} - -static void _XConditionWait( - xcondition_t cv, - xmutex_t mutex - XTHREADS_FILE_LINE_ARGS - ) -{ -#ifdef XTHREADS_WARN - xthread_t self = xthread_self(); - char *old_file = locking_file; - int old_line = locking_line; - -#ifdef XTHREADS_DEBUG - printf("line %d thread %x in condition wait\n", line, self); -#endif - xthread_clear_id(locking_thread); - - locking_history[lock_hist_loc].file = file; - locking_history[lock_hist_loc].line = line; - locking_history[lock_hist_loc].thread = self; - locking_history[lock_hist_loc].lockp = False; - lock_hist_loc++; - if (lock_hist_loc >= LOCK_HIST_SIZE) - lock_hist_loc = 0; -#endif /* XTHREADS_WARN */ - - xcondition_wait(cv, mutex); - -#ifdef XTHREADS_WARN - locking_thread = self; - locking_file = old_file; - locking_line = old_line; - - locking_history[lock_hist_loc].file = file; - locking_history[lock_hist_loc].line = line; - locking_history[lock_hist_loc].thread = self; - locking_history[lock_hist_loc].lockp = True; - lock_hist_loc++; - if (lock_hist_loc >= LOCK_HIST_SIZE) - lock_hist_loc = 0; -#ifdef XTHREADS_DEBUG - printf("line %d thread %x was signaled\n", line, self); -#endif /* XTHREADS_DEBUG */ -#endif /* XTHREADS_WARN */ -} - -static void _XConditionSignal( - xcondition_t cv - XTHREADS_FILE_LINE_ARGS - ) -{ -#ifdef XTHREADS_WARN -#ifdef XTHREADS_DEBUG - printf("line %d thread %x is signalling\n", line, xthread_self()); -#endif -#endif - xcondition_signal(cv); -} - - -static void _XConditionBroadcast( - xcondition_t cv - XTHREADS_FILE_LINE_ARGS - ) -{ -#ifdef XTHREADS_WARN -#ifdef XTHREADS_DEBUG - printf("line %d thread %x is broadcasting\n", line, xthread_self()); -#endif -#endif - xcondition_broadcast(cv); -} - - -static void _XFreeDisplayLock( - Display *dpy) -{ - struct _XCVList *cvl; - - if (dpy->lock != NULL) { - if (dpy->lock->mutex != NULL) { - xmutex_clear(dpy->lock->mutex); - xmutex_free(dpy->lock->mutex); - } - if (dpy->lock->cv != NULL) { - xcondition_clear(dpy->lock->cv); - xcondition_free(dpy->lock->cv); - } - if (dpy->lock->writers != NULL) { - xcondition_clear(dpy->lock->writers); - xcondition_free(dpy->lock->writers); - } - while ((cvl = dpy->lock->free_cvls)) { - dpy->lock->free_cvls = cvl->next; - xcondition_clear(cvl->cv); - Xfree(cvl->cv); - Xfree(cvl); - } - Xfree(dpy->lock); - dpy->lock = NULL; - } - if (dpy->lock_fns != NULL) { - Xfree(dpy->lock_fns); - dpy->lock_fns = NULL; - } -} - -/* - * wait for thread with user-level display lock to release it. - */ - -static void _XDisplayLockWait( - Display *dpy) -{ - xthread_t self; - - while (dpy->lock->locking_level > 0) { - self = xthread_self(); - if (xthread_equal(dpy->lock->locking_thread, self)) - break; - ConditionWait(dpy, dpy->lock->cv); - } -} - -static void _XLockDisplay( - Display *dpy - XTHREADS_FILE_LINE_ARGS - ) -{ -#ifdef XTHREADS_WARN - _XLockDisplayWarn(dpy, file, line); -#else - xmutex_lock(dpy->lock->mutex); -#endif - if (dpy->lock->locking_level > 0) - _XDisplayLockWait(dpy); - _XIDHandler(dpy); - _XSeqSyncFunction(dpy); -} - -/* - * _XReply is allowed to exit from select/poll and clean up even if a - * user-level lock is in force, so it uses this instead of _XFancyLockDisplay. - */ -static void _XInternalLockDisplay( - Display *dpy, - Bool wskip - XTHREADS_FILE_LINE_ARGS - ) -{ -#ifdef XTHREADS_WARN - _XLockDisplayWarn(dpy, file, line); -#else - xmutex_lock(dpy->lock->mutex); -#endif - if (!wskip && dpy->lock->locking_level > 0) - _XDisplayLockWait(dpy); -} - -static void _XUserLockDisplay( - register Display* dpy) -{ - _XDisplayLockWait(dpy); - - if (++dpy->lock->locking_level == 1) { - dpy->lock->lock_wait = _XDisplayLockWait; - dpy->lock->locking_thread = xthread_self(); - } -} - -static -void _XUserUnlockDisplay( - register Display* dpy) -{ - if (dpy->lock->locking_level > 0 && --dpy->lock->locking_level == 0) { - /* signal other threads that might be waiting in XLockDisplay */ - ConditionBroadcast(dpy, dpy->lock->cv); - dpy->lock->lock_wait = NULL; - xthread_clear_id(dpy->lock->locking_thread); - } -} - -/* returns 0 if initialized ok, -1 if unable to allocate - a mutex or other memory */ - -static int _XInitDisplayLock( - Display *dpy) -{ - dpy->lock_fns = Xmalloc(sizeof(struct _XLockPtrs)); - if (dpy->lock_fns == NULL) - return -1; - dpy->lock = Xmalloc(sizeof(struct _XLockInfo)); - if (dpy->lock == NULL) { - _XFreeDisplayLock(dpy); - return -1; - } - dpy->lock->cv = xcondition_malloc(); - dpy->lock->mutex = xmutex_malloc(); - dpy->lock->writers = xcondition_malloc(); - if (!dpy->lock->cv || !dpy->lock->mutex || !dpy->lock->writers) { - _XFreeDisplayLock(dpy); - return -1; - } - - dpy->lock->reply_bytes_left = 0; - dpy->lock->reply_was_read = False; - dpy->lock->reply_awaiters = NULL; - dpy->lock->reply_awaiters_tail = &dpy->lock->reply_awaiters; - dpy->lock->event_awaiters = NULL; - dpy->lock->event_awaiters_tail = &dpy->lock->event_awaiters; - dpy->lock->reply_first = False; - dpy->lock->locking_level = 0; - dpy->lock->num_free_cvls = 0; - dpy->lock->free_cvls = NULL; - xthread_clear_id(dpy->lock->locking_thread); - xthread_clear_id(dpy->lock->reading_thread); - xthread_clear_id(dpy->lock->conni_thread); - xmutex_init(dpy->lock->mutex); - xmutex_set_name(dpy->lock->mutex, "Xlib Display"); - xcondition_init(dpy->lock->cv); - xcondition_set_name(dpy->lock->cv, "XLockDisplay"); - xcondition_init(dpy->lock->writers); - xcondition_set_name(dpy->lock->writers, "Xlib wait for writable"); - dpy->lock_fns->lock_display = _XLockDisplay; - dpy->lock->internal_lock_display = _XInternalLockDisplay; - dpy->lock_fns->unlock_display = _XUnlockDisplay; - dpy->lock->user_lock_display = _XUserLockDisplay; - dpy->lock->user_unlock_display = _XUserUnlockDisplay; - dpy->lock->pop_reader = _XPopReader; - dpy->lock->push_reader = _XPushReader; - dpy->lock->condition_wait = _XConditionWait; - dpy->lock->condition_signal = _XConditionSignal; - dpy->lock->condition_broadcast = _XConditionBroadcast; - dpy->lock->create_cvl = _XCreateCVL; - dpy->lock->lock_wait = NULL; /* filled in by XLockDisplay() */ - - return 0; -} - -#ifdef __UNIXWARE__ -xthread_t __x11_thr_self() { return 0; } -xthread_t (*_x11_thr_self)() = __x11_thr_self; -#endif - - -Status XInitThreads(void) -{ - if (_Xglobal_lock) - return 1; -#ifdef __UNIXWARE__ - else { - void *dl_handle = dlopen(NULL, RTLD_LAZY); - if (!dl_handle || - ((_x11_thr_self = (xthread_t(*)())dlsym(dl_handle,"thr_self")) == 0)) { - _x11_thr_self = __x11_thr_self; - (void) fprintf (stderr, - "XInitThreads called, but no libthread in the calling program!\n" ); - } - } -#endif /* __UNIXWARE__ */ -#ifdef xthread_init - xthread_init(); /* return value? */ -#endif - if (!(global_lock.lock = xmutex_malloc())) - return 0; - if (!(i18n_lock.lock = xmutex_malloc())) { - xmutex_free(global_lock.lock); - global_lock.lock = NULL; - return 0; - } - _Xglobal_lock = &global_lock; - xmutex_init(_Xglobal_lock->lock); - xmutex_set_name(_Xglobal_lock->lock, "Xlib global"); - _Xi18n_lock = &i18n_lock; - xmutex_init(_Xi18n_lock->lock); - xmutex_set_name(_Xi18n_lock->lock, "Xlib i18n"); - _XLockMutex_fn = _XLockMutex; - _XUnlockMutex_fn = _XUnlockMutex; - _XCreateMutex_fn = _XCreateMutex; - _XFreeMutex_fn = _XFreeMutex; - _XInitDisplayLock_fn = _XInitDisplayLock; - _XFreeDisplayLock_fn = _XFreeDisplayLock; - _Xthread_self_fn = _Xthread_self; - -#ifdef XTHREADS_WARN -#ifdef XTHREADS_DEBUG - setlinebuf(stdout); /* for debugging messages */ -#endif -#endif - - return 1; -} - -#else /* XTHREADS */ -Status XInitThreads(void) -{ - return 0; -} -#endif /* XTHREADS */ diff --git a/nx-X11/lib/X11/locking.h b/nx-X11/lib/X11/locking.h deleted file mode 100644 index 277c9afc8..000000000 --- a/nx-X11/lib/X11/locking.h +++ /dev/null @@ -1,156 +0,0 @@ -/* - -Copyright 1992, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - -*/ - -/* - * Author: Stephen Gildea, MIT X Consortium - * - * locking.h - data types for C Threads locking. - * Used by XlibInt.c, locking.c, LockDis.c - */ - -#ifndef _X_locking_H_ -#define _X_locking_H_ - -#define xmalloc(s) Xmalloc(s) -#define xfree(s) Xfree(s) -#include -#include -#include - -struct _XCVList { - xcondition_t cv; - xReply *buf; - struct _XCVList *next; -}; - -extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */ - void -); - -/* Display->lock is a pointer to one of these */ - -struct _XLockInfo { - xmutex_t mutex; /* mutex for critical sections */ - int reply_bytes_left; /* nbytes of the reply still to read */ - Bool reply_was_read; /* _XReadEvents read a reply for _XReply */ - struct _XCVList *reply_awaiters; /* list of CVs for _XReply */ - struct _XCVList **reply_awaiters_tail; - struct _XCVList *event_awaiters; /* list of CVs for _XReadEvents */ - struct _XCVList **event_awaiters_tail; - Bool reply_first; /* who may read, reply queue or event queue */ - /* for XLockDisplay */ - int locking_level; /* how many times into XLockDisplay we are */ - xthread_t locking_thread; /* thread that did XLockDisplay */ - xcondition_t cv; /* wait if another thread has XLockDisplay */ - xthread_t reading_thread; /* cache */ - xthread_t conni_thread; /* thread in XProcessInternalConnection */ - xcondition_t writers; /* wait for writable */ - int num_free_cvls; - struct _XCVList *free_cvls; - /* used only in XlibInt.c */ - void (*pop_reader)( - Display* /* dpy */, - struct _XCVList** /* list */, - struct _XCVList*** /* tail */ - ); - struct _XCVList *(*push_reader)( - Display * /* dpy */, - struct _XCVList*** /* tail */ - ); - void (*condition_wait)( - xcondition_t /* cv */, - xmutex_t /* mutex */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char* /* file */, - int /* line */ -#endif - ); - void (*internal_lock_display)( - Display* /* dpy */, - Bool /* wskip */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char* /* file */, - int /* line */ -#endif - ); - /* used in XlibInt.c and locking.c */ - void (*condition_signal)( - xcondition_t /* cv */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char* /* file */, - int /* line */ -#endif - ); - void (*condition_broadcast)( - xcondition_t /* cv */ -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) - , char* /* file */, - int /* line */ -#endif - ); - /* used in XlibInt.c and XLockDis.c */ - void (*lock_wait)( - Display* /* dpy */ - ); - void (*user_lock_display)( - Display* /* dpy */ - ); - void (*user_unlock_display)( - Display* /* dpy */ - ); - struct _XCVList *(*create_cvl)( - Display * /* dpy */ - ); -}; - -#define UnlockNextEventReader(d) if ((d)->lock) \ - (*(d)->lock->pop_reader)((d),&(d)->lock->event_awaiters,&(d)->lock->event_awaiters_tail) - -#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) -#define ConditionWait(d,c) if ((d)->lock) \ - (*(d)->lock->condition_wait)(c, (d)->lock->mutex,__FILE__,__LINE__) -#define ConditionSignal(d,c) if ((d)->lock) \ - (*(d)->lock->condition_signal)(c,__FILE__,__LINE__) -#define ConditionBroadcast(d,c) if ((d)->lock) \ - (*(d)->lock->condition_broadcast)(c,__FILE__,__LINE__) -#else -#define ConditionWait(d,c) if ((d)->lock) \ - (*(d)->lock->condition_wait)(c, (d)->lock->mutex) -#define ConditionSignal(d,c) if ((d)->lock) \ - (*(d)->lock->condition_signal)(c) -#define ConditionBroadcast(d,c) if ((d)->lock) \ - (*(d)->lock->condition_broadcast)(c) -#endif - -typedef struct _LockInfoRec { - xmutex_t lock; -} LockInfoRec; - -/* XOpenDis.c */ -extern int (*_XInitDisplayLock_fn)(Display *dpy); -extern void (*_XFreeDisplayLock_fn)(Display *dpy); - -#endif /* _X_locking_H_ */ diff --git a/nx-X11/lib/X11/mbWMProps.c b/nx-X11/lib/X11/mbWMProps.c deleted file mode 100644 index 9fb57faca..000000000 --- a/nx-X11/lib/X11/mbWMProps.c +++ /dev/null @@ -1,69 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -void -XmbSetWMProperties ( - Display *dpy, - Window w, - _Xconst char *windowName, - _Xconst char *iconName, - char **argv, - int argc, - XSizeHints *sizeHints, - XWMHints *wmHints, - XClassHint *classHints) -{ - XTextProperty wname, iname; - XTextProperty *wprop = NULL; - XTextProperty *iprop = NULL; - - if (windowName && - XmbTextListToTextProperty(dpy, (char**)&windowName, 1, - XStdICCTextStyle, &wname) >= Success) - wprop = &wname; - if (iconName && - XmbTextListToTextProperty(dpy, (char**)&iconName, 1, - XStdICCTextStyle, &iname) >= Success) - iprop = &iname; - XSetWMProperties(dpy, w, wprop, iprop, argv, argc, - sizeHints, wmHints, classHints); - if (wprop) - Xfree(wname.value); - if (iprop) - Xfree(iname.value); - - /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ -} diff --git a/nx-X11/lib/X11/mbWrap.c b/nx-X11/lib/X11/mbWrap.c deleted file mode 100644 index 766b8da01..000000000 --- a/nx-X11/lib/X11/mbWrap.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * Copyright 1991 by the Open Software Foundation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 - * 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 - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * 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 - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -void -XmbDrawText( - Display *dpy, - Drawable d, - GC gc, - int x, - int y, - XmbTextItem *text_items, - int nitems) -{ - register XFontSet fs = NULL; - register XmbTextItem *p = text_items; - register int i = nitems; - register int esc; - - /* ignore leading items with no fontset */ - while (i && !p->font_set) { - i--; - p++; - } - - for (; --i >= 0; p++) { - if (p->font_set) - fs = p->font_set; - x += p->delta; - esc = (*fs->methods->mb_draw_string) (dpy, d, fs, gc, x, y, - p->chars, p->nchars); - if (!esc) - esc = fs->methods->mb_escapement (fs, p->chars, p->nchars); - x += esc; - } -} - -void -XmbDrawString( - Display *dpy, - Drawable d, - XFontSet font_set, - GC gc, - int x, - int y, - _Xconst char *text, - int text_len) -{ - (void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y, - text, text_len); -} - - -void -XmbDrawImageString( - Display *dpy, - Drawable d, - XFontSet font_set, - GC gc, - int x, - int y, - _Xconst char *text, - int text_len) -{ - (*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y, - text, text_len); -} - -int -XmbTextEscapement( - XFontSet font_set, - _Xconst char *text, - int text_len) -{ - return (*font_set->methods->mb_escapement) (font_set, text, text_len); -} - -int -XmbTextExtents( - XFontSet font_set, - _Xconst char *text, - int text_len, - XRectangle *overall_ink_extents, - XRectangle *overall_logical_extents) -{ - return (*font_set->methods->mb_extents) (font_set, text, text_len, - overall_ink_extents, - overall_logical_extents); -} - -Status -XmbTextPerCharExtents( - XFontSet font_set, - _Xconst char *text, - int text_len, - XRectangle *ink_extents_buffer, - XRectangle *logical_extents_buffer, - int buffer_size, - int *num_chars, - XRectangle *max_ink_extents, - XRectangle *max_logical_extents) -{ - return (*font_set->methods->mb_extents_per_char) - (font_set, text, text_len, - ink_extents_buffer, logical_extents_buffer, - buffer_size, num_chars, max_ink_extents, max_logical_extents); -} diff --git a/nx-X11/lib/X11/omDefault.c b/nx-X11/lib/X11/omDefault.c deleted file mode 100644 index 134ef461a..000000000 --- a/nx-X11/lib/X11/omDefault.c +++ /dev/null @@ -1,449 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * (c) Copyright 1995 FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" -#include -#include -#include - -#define DefineLocalBuf char local_buf[BUFSIZ] -#define AllocLocalBuf(length) (length > BUFSIZ ? (char *)Xmalloc(length) : local_buf) -#define FreeLocalBuf(ptr) if (ptr != local_buf) Xfree(ptr) - -static Bool -wcs_to_mbs( - XOC oc, - char *to, - _Xconst wchar_t *from, - int length) -{ - XlcConv conv; - int to_left, ret; - - conv = _XomInitConverter(oc, XOMWideChar); - if (conv == NULL) - return False; - - to_left = length; - ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, - &to_left, NULL, 0); - if (ret != 0 || length > 0) - return False; - - return True; -} - -static Bool -utf8_to_mbs( - XOC oc, - char *to, - _Xconst char *from, - int length) -{ - XlcConv conv; - int to_left, ret; - - conv = _XomInitConverter(oc, XOMUtf8String); - if (conv == NULL) - return False; - - to_left = length; - ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, - &to_left, NULL, 0); - if (ret != 0 || length > 0) - return False; - - return True; -} - -int -_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length) -{ - return XTextWidth(*oc->core.font_info.font_struct_list, text, length); -} - -int -_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - int ret; - - if (buf == NULL) - return 0; - - if (wcs_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultTextEscapement(oc, buf, length); - -err: - FreeLocalBuf(buf); - - return ret; -} - -int -_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - int ret; - - if (buf == NULL) - return 0; - - if (utf8_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultTextEscapement(oc, buf, length); - -err: - FreeLocalBuf(buf); - - return ret; -} - -int -_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical) -{ - int direction, logical_ascent, logical_descent; - XCharStruct overall; - - XTextExtents(*oc->core.font_info.font_struct_list, text, length, &direction, - &logical_ascent, &logical_descent, &overall); - - if (overall_ink) { - overall_ink->x = overall.lbearing; - overall_ink->y = -(overall.ascent); - overall_ink->width = overall.rbearing - overall.lbearing; - overall_ink->height = overall.ascent + overall.descent; - } - - if (overall_logical) { - overall_logical->x = 0; - overall_logical->y = -(logical_ascent); - overall_logical->width = overall.width; - overall_logical->height = logical_ascent + logical_descent; - } - - return overall.width; -} - -int -_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - int ret; - - if (buf == NULL) - return 0; - - if (wcs_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); - -err: - FreeLocalBuf(buf); - - return ret; -} - -int -_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - int ret; - - if (buf == NULL) - return 0; - - if (utf8_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); - -err: - FreeLocalBuf(buf); - - return ret; -} - -Status -_XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - XFontStruct *font = *oc->core.font_info.font_struct_list; - XCharStruct *def, *cs, overall; - Bool first = True; - - if (buf_size < length) - return 0; - - bzero((char *) &overall, sizeof(XCharStruct)); - *num_chars = 0; - - CI_GET_DEFAULT_INFO_1D(font, def) - - while (length-- > 0) { - CI_GET_CHAR_INFO_1D(font, *text, def, cs) - text++; - if (cs == NULL) - continue; - - ink_buf->x = overall.width + cs->lbearing; - ink_buf->y = -(cs->ascent); - ink_buf->width = cs->rbearing - cs->lbearing; - ink_buf->height = cs->ascent + cs->descent; - ink_buf++; - - logical_buf->x = overall.width; - logical_buf->y = -(font->ascent); - logical_buf->width = cs->width; - logical_buf->height = font->ascent + font->descent; - logical_buf++; - - if (first) { - overall = *cs; - first = False; - } else { - overall.ascent = max(overall.ascent, cs->ascent); - overall.descent = max(overall.descent, cs->descent); - overall.lbearing = min(overall.lbearing, overall.width + - cs->lbearing); - overall.rbearing = max(overall.rbearing, overall.width + - cs->rbearing); - overall.width += cs->width; - } - - (*num_chars)++; - } - - if (overall_ink) { - overall_ink->x = overall.lbearing; - overall_ink->y = -(overall.ascent); - overall_ink->width = overall.rbearing - overall.lbearing; - overall_ink->height = overall.ascent + overall.descent; - } - - if (overall_logical) { - overall_logical->x = 0; - overall_logical->y = -(font->ascent); - overall_logical->width = overall.width; - overall_logical->height = font->ascent + font->descent; - } - - return 1; -} - -Status -_XwcDefaultTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - Status ret; - - if (buf == NULL) - return 0; - - if (wcs_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, - buf_size, num_chars, overall_ink, - overall_logical); - -err: - FreeLocalBuf(buf); - - return ret; -} - -Status -_Xutf8DefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - Status ret; - - if (buf == NULL) - return 0; - - if (utf8_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, - buf_size, num_chars, overall_ink, - overall_logical); - -err: - FreeLocalBuf(buf); - - return ret; -} - -int -_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length) -{ - XFontStruct *font = *oc->core.font_info.font_struct_list; - - XSetFont(dpy, gc, font->fid); - XDrawString(dpy, d, gc, x, y, text, length); - - return XTextWidth(font, text, length); -} - -int -_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst wchar_t *text, int length) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - int ret; - - if (buf == NULL) - return 0; - - if (wcs_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); - -err: - FreeLocalBuf(buf); - - return ret; -} - -int -_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - int ret; - - if (buf == NULL) - return 0; - - if (utf8_to_mbs(oc, buf, text, length) == False) { - ret = 0; - goto err; - } - - ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); - -err: - FreeLocalBuf(buf); - - return ret; -} - -void -_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length) -{ - XSetFont(dpy, gc, (*oc->core.font_info.font_struct_list)->fid); - XDrawImageString(dpy, d, gc, x, y, text, length); -} - -void -_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst wchar_t *text, int length) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - - if (buf == NULL) - return; - - if (wcs_to_mbs(oc, buf, text, length) == False) - goto err; - - _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); - -err: - FreeLocalBuf(buf); -} - -void -_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length) -{ - DefineLocalBuf; - char *buf = AllocLocalBuf(length); - - if (buf == NULL) - return; - - if (utf8_to_mbs(oc, buf, text, length) == False) - goto err; - - _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); - -err: - FreeLocalBuf(buf); -} diff --git a/nx-X11/lib/X11/omGeneric.c b/nx-X11/lib/X11/omGeneric.c deleted file mode 100644 index 68eec01c0..000000000 --- a/nx-X11/lib/X11/omGeneric.c +++ /dev/null @@ -1,2100 +0,0 @@ -/* #define FONTDEBUG */ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Takanori Tateno FUJITSU LIMITED - * - */ - -/* - * Fixed the algorithms in parse_fontname() and parse_fontdata() - * to improve the logic for determining which font should be - * returned for a given CharSet. We even added some comments - * so that you can figure out what in the heck we're doing. We - * realize this is a departure from the norm, but hey, we're - * rebels! :-) :-) - * - * Modifiers: Jeff Walls, Paul Anderson: HEWLETT-PACKARD - */ -/* - * Cleaned up mess, removed some blabla - * Egbert Eich, SuSE Linux AG - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" -#include "XlcGeneric.h" -#include -#include -#include -#include -#include - -#define MAXFONTS 100 -#define PIXEL_SIZE_FIELD 7 -#define POINT_SIZE_FIELD 8 -#define CHARSET_ENCODING_FIELD 14 -#define XLFD_MAX_LEN 255 - -/* For VW/UDC start */ - -static FontData -init_fontdata( - FontData font_data, - int font_data_count) -{ - FontData fd; - int i; - - fd = Xcalloc(font_data_count, sizeof(FontDataRec)); - if(fd == (FontData) NULL) - return False; - - for(i = 0 ; i < font_data_count ; i++) - fd[i] = font_data[i]; - - return fd; -} - -static VRotate -init_vrotate( - FontData font_data, - int font_data_count, - int type, - CodeRange code_range, - int code_range_num) -{ - VRotate vrotate; - int i; - - if(type == VROTATE_NONE) - return (VRotate)NULL; - - vrotate = Xcalloc(font_data_count, sizeof(VRotateRec)); - if(vrotate == (VRotate) NULL) - return False; - - for(i = 0 ; i < font_data_count ; i++) { - vrotate[i].charset_name = font_data[i].name; - vrotate[i].side = font_data[i].side; - if(type == VROTATE_PART) { - vrotate[i].num_cr = code_range_num; - vrotate[i].code_range = code_range; - } - } - - return vrotate; -} - -static Bool -init_fontset( - XOC oc) -{ - XOCGenericPart *gen; - FontSet font_set; - OMData data; - int count; - - count = XOM_GENERIC(oc->core.om)->data_num; - data = XOM_GENERIC(oc->core.om)->data; - - font_set = Xcalloc(count, sizeof(FontSetRec)); - if (font_set == NULL) - return False; - - gen = XOC_GENERIC(oc); - gen->font_set_num = count; - gen->font_set = font_set; - - for ( ; count-- > 0; data++, font_set++) { - font_set->charset_count = data->charset_count; - font_set->charset_list = data->charset_list; - - if((font_set->font_data = init_fontdata(data->font_data, - data->font_data_count)) == NULL) - goto err; - font_set->font_data_count = data->font_data_count; - if((font_set->substitute = init_fontdata(data->substitute, - data->substitute_num)) == NULL) - goto err; - font_set->substitute_num = data->substitute_num; - if((font_set->vmap = init_fontdata(data->vmap, - data->vmap_num)) == NULL) - goto err; - font_set->vmap_num = data->vmap_num; - - if(data->vrotate_type != VROTATE_NONE) { - /* A vrotate member is specified primary font data */ - /* as initial value. */ - if((font_set->vrotate = init_vrotate(data->font_data, - data->font_data_count, - data->vrotate_type, - data->vrotate, - data->vrotate_num)) == NULL) - goto err; - font_set->vrotate_num = data->font_data_count; - } - } - return True; - -err: - - Xfree(font_set->font_data); - Xfree(font_set->substitute); - Xfree(font_set->vmap); - Xfree(font_set->vrotate); - Xfree(font_set); - gen->font_set = (FontSet) NULL; - gen->font_set_num = 0; - return False; -} - -/* For VW/UDC end */ - -static char * -get_prop_name( - Display *dpy, - XFontStruct *fs) -{ - unsigned long fp; - - if (XGetFontProperty(fs, XA_FONT, &fp)) - return XGetAtomName(dpy, fp); - - return (char *) NULL; -} - -/* For VW/UDC start */ - -static Bool -load_fontdata( - XOC oc, - FontData font_data, - int font_data_num) -{ - Display *dpy = oc->core.om->core.display; - FontData fd = font_data; - - if(font_data == NULL) return(True); - for( ; font_data_num-- ; fd++) { - if(fd->xlfd_name != (char *) NULL && fd->font == NULL) { - fd->font = XLoadQueryFont(dpy, fd->xlfd_name); - if (fd->font == NULL){ - return False; - } - } - } - return True; -} - -static Bool -load_fontset_data( - XOC oc, - FontSet font_set) -{ - Display *dpy = oc->core.om->core.display; - - if(font_set->font_name == (char *)NULL) return False ; - - /* If font_set->font is not NULL, it contains the *best* - * match font for this FontSet. - * -- jjw/pma (HP) - */ - if(font_set->font == NULL) { - font_set->font = XLoadQueryFont(dpy, font_set->font_name); - if (font_set->font == NULL){ - return False; - } - } - return True; -} - -static Bool -load_font( - XOC oc) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set = gen->font_set; - int num = gen->font_set_num; - - for ( ; num-- > 0; font_set++) { - if (font_set->font_name == NULL) - continue; - - if (load_fontset_data (oc, font_set) != True) - return False; -#ifndef TESTVERSION - if(load_fontdata(oc, font_set->font_data, - font_set->font_data_count) != True) - return False; - - if(load_fontdata(oc, font_set->substitute, - font_set->substitute_num) != True) - return False; -#endif - -/* Add 1996.05.20 */ - if( oc->core.orientation == XOMOrientation_TTB_RTL || - oc->core.orientation == XOMOrientation_TTB_LTR ){ - if (font_set->vpart_initialize == 0) { - load_fontdata(oc, font_set->vmap, font_set->vmap_num); - load_fontdata(oc, (FontData) font_set->vrotate, - font_set->vrotate_num); - font_set->vpart_initialize = 1; - } - } - - if (font_set->font->min_byte1 || font_set->font->max_byte1) - font_set->is_xchar2b = True; - else - font_set->is_xchar2b = False; - } - - return True; -} - -/* For VW/UDC end */ - -static Bool -load_font_info( - XOC oc) -{ - Display *dpy = oc->core.om->core.display; - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set = gen->font_set; - char **fn_list; - int fn_num, num = gen->font_set_num; - - for ( ; num-- > 0; font_set++) { - if (font_set->font_name == NULL) - continue; - - if (font_set->info == NULL) { - fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num, - &font_set->info); - if (font_set->info == NULL) - return False; - - XFreeFontNames(fn_list); - } - } - - return True; -} - -/* For Vertical Writing start */ - -static void -check_fontset_extents( - XCharStruct *overall, - int *logical_ascent, - int *logical_descent, - XFontStruct *font) -{ - overall->lbearing = min(overall->lbearing, font->min_bounds.lbearing); - overall->rbearing = max(overall->rbearing, font->max_bounds.rbearing); - overall->ascent = max(overall->ascent, font->max_bounds.ascent); - overall->descent = max(overall->descent, font->max_bounds.descent); - overall->width = max(overall->width, font->max_bounds.width); - *logical_ascent = max(*logical_ascent, font->ascent); - *logical_descent = max(*logical_descent, font->descent); -} - -/* For Vertical Writing end */ - -static void -set_fontset_extents( - XOC oc) -{ - XRectangle *ink = &oc->core.font_set_extents.max_ink_extent; - XRectangle *logical = &oc->core.font_set_extents.max_logical_extent; - XFontStruct **font_list, *font; - XCharStruct overall; - int logical_ascent, logical_descent; - int num = oc->core.font_info.num_font; - - font_list = oc->core.font_info.font_struct_list; - font = *font_list++; - overall = font->max_bounds; - overall.lbearing = font->min_bounds.lbearing; - logical_ascent = font->ascent; - logical_descent = font->descent; - - /* For Vertical Writing start */ - - while (--num > 0) { - font = *font_list++; - check_fontset_extents(&overall, &logical_ascent, &logical_descent, - font); - } - - { - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set = gen->font_set; - FontData font_data; - int font_set_num = gen->font_set_num; - int font_data_count; - - for( ; font_set_num-- ; font_set++) { - if(font_set->vmap_num > 0) { - font_data = font_set->vmap; - font_data_count = font_set->vmap_num; - for( ; font_data_count-- ; font_data++) { - if(font_data->font != NULL) { - check_fontset_extents(&overall, &logical_ascent, - &logical_descent, - font_data->font); - } - } - } - - if(font_set->vrotate_num > 0 && font_set->vrotate != NULL) { - font_data = (FontData) font_set->vrotate; - font_data_count = font_set->vrotate_num; - for( ; font_data_count-- ; font_data++) { - if(font_data->font != NULL) { - check_fontset_extents(&overall, &logical_ascent, - &logical_descent, - font_data->font); - } - } - } - } - } - - /* For Vertical Writing start */ - - ink->x = overall.lbearing; - ink->y = -(overall.ascent); - ink->width = overall.rbearing - overall.lbearing; - ink->height = overall.ascent + overall.descent; - - logical->x = 0; - logical->y = -(logical_ascent); - logical->width = overall.width; - logical->height = logical_ascent + logical_descent; -} - -static Bool -init_core_part( - XOC oc) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - int font_set_num; - XFontStruct **font_struct_list; - char **font_name_list, *font_name_buf; - int count, length; - - font_set = gen->font_set; - font_set_num = gen->font_set_num; - count = length = 0; - - for ( ; font_set_num-- > 0; font_set++) { - if (font_set->font_name == NULL) - continue; - - length += strlen(font_set->font_name) + 1; - - count++; - } - if (count == 0) - return False; - - font_struct_list = Xmalloc(sizeof(XFontStruct *) * count); - if (font_struct_list == NULL) - return False; - - font_name_list = Xmalloc(sizeof(char *) * count); - if (font_name_list == NULL) - goto err; - - font_name_buf = Xmalloc(length); - if (font_name_buf == NULL) - goto err; - - oc->core.font_info.num_font = count; - oc->core.font_info.font_name_list = font_name_list; - oc->core.font_info.font_struct_list = font_struct_list; - - font_set = gen->font_set; - font_set_num = gen->font_set_num; - - for (count = 0; font_set_num-- > 0; font_set++) { - if (font_set->font_name == NULL) - continue; - - font_set->id = count; - if (font_set->font) - *font_struct_list++ = font_set->font; - else - *font_struct_list++ = font_set->info; - strcpy(font_name_buf, font_set->font_name); - Xfree(font_set->font_name); - *font_name_list++ = font_set->font_name = font_name_buf; - font_name_buf += strlen(font_name_buf) + 1; - - count++; - } - - set_fontset_extents(oc); - - return True; - -err: - - Xfree(font_name_list); - Xfree(font_struct_list); - - return False; -} - -static char * -get_font_name( - XOC oc, - char *pattern) -{ - char **list, *name; - int count = 0; - - list = XListFonts(oc->core.om->core.display, pattern, 1, &count); - if (list == NULL) - return NULL; - - name = strdup(*list); - - XFreeFontNames(list); - - return name; -} - -/* For VW/UDC start*/ - -static char * -get_rotate_fontname( - char *font_name) -{ - char *pattern = NULL, *ptr = NULL; - char *fields[CHARSET_ENCODING_FIELD]; - char str_pixel[32], str_point[4]; - char *rotate_font_ptr = NULL; - int pixel_size = 0; - int field_num = 0, len = 0; - - if(font_name == (char *) NULL || (len = strlen(font_name)) <= 0 - || len > XLFD_MAX_LEN) - return NULL; - - pattern = strdup(font_name); - if(!pattern) - return NULL; - - memset(fields, 0, sizeof(char *) * 14); - ptr = pattern; - while(isspace(*ptr)) { - ptr++; - } - if(*ptr == '-') - ptr++; - - for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && ptr && *ptr ; - ptr++, field_num++) { - fields[field_num] = ptr; - - if((ptr = strchr(ptr, '-'))) { - *ptr = '\0'; - } else { - field_num++; /* Count last field */ - break; - } - } - - if(field_num < CHARSET_ENCODING_FIELD) - goto free_pattern; - - /* Pixel Size field : fields[6] */ - for(ptr = fields[PIXEL_SIZE_FIELD - 1] ; ptr && *ptr; ptr++) { - if(!isdigit(*ptr)) { - if(*ptr == '['){ /* 960730 */ - strcpy(pattern, font_name); - return(pattern); - } - goto free_pattern; - } - } - pixel_size = atoi(fields[PIXEL_SIZE_FIELD - 1]); - snprintf(str_pixel, sizeof(str_pixel), - "[ 0 ~%d %d 0 ]", pixel_size, pixel_size); - fields[6] = str_pixel; - - /* Point Size field : fields[7] */ - strcpy(str_point, "*"); - fields[POINT_SIZE_FIELD - 1] = str_point; - - len = 0; - for (field_num = 0; field_num < CHARSET_ENCODING_FIELD && - fields[field_num]; field_num++) { - len += 1 + strlen(fields[field_num]); - } - - /* Max XLFD length is 255 */ - if (len > XLFD_MAX_LEN) - goto free_pattern; - - rotate_font_ptr = Xmalloc(len + 1); - if(!rotate_font_ptr) - goto free_pattern; - - rotate_font_ptr[0] = '\0'; - - for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && - fields[field_num] ; field_num++) { - strcat(rotate_font_ptr, "-"); - strcat(rotate_font_ptr, fields[field_num]); - } - -free_pattern: - Xfree(pattern); - - return rotate_font_ptr; -} - -static Bool -is_match_charset( - FontData font_data, - char *font_name) -{ - char *last; - int length, name_len; - - name_len = strlen(font_name); - last = font_name + name_len; - - length = strlen(font_data->name); - if (length > name_len) - return False; - - if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) - return True; - - return False; -} - -static int -parse_all_name( - XOC oc, - FontData font_data, - char *pattern) -{ - -#ifdef OLDCODE - if(is_match_charset(font_data, pattern) != True) - return False; - - font_data->xlfd_name = strdup(pattern); - if(font_data->xlfd_name == NULL) - return (-1); - - return True; -#else /* OLDCODE */ - Display *dpy = oc->core.om->core.display; - char **fn_list = NULL, *prop_fname = NULL; - int list_num; - XFontStruct *fs_list; - if(is_match_charset(font_data, pattern) != True) { - /* - * pattern should not contain any wildcard (execpt '?') - * this was probably added to make this case insensitive. - */ - if ((fn_list = XListFontsWithInfo(dpy, pattern, - MAXFONTS, - &list_num, &fs_list)) == NULL) { - return False; - } - /* shouldn't we loop here ? */ - else if ((prop_fname = get_prop_name(dpy, fs_list)) == NULL) { - XFreeFontInfo(fn_list, fs_list, list_num); - return False; - } - else if ((is_match_charset(font_data, prop_fname) != True)) { - XFree(prop_fname); - XFreeFontInfo(fn_list, fs_list, list_num); - return False; - } - else { - font_data->xlfd_name = prop_fname; - XFreeFontInfo(fn_list, fs_list, list_num); - return True; - } - } - - font_data->xlfd_name = strdup(pattern); - if(font_data->xlfd_name == NULL) - return (-1); - - return True; -#endif /* OLDCODE */ -} - -static int -parse_omit_name( - XOC oc, - FontData font_data, - char *pattern) -{ - char* last = (char *) NULL; - char* base_name; - char buf[XLFD_MAX_LEN + 1]; - int length = 0; - int num_fields; - /* - * If the font specified by "pattern" is expandable to be - * a member of "font_data"'s FontSet, we've found a match. - */ - if(is_match_charset(font_data, pattern) == True) { - if ((font_data->xlfd_name = get_font_name(oc, pattern)) != NULL) { - return True; - } - } - - length = strlen (pattern); - - if (length > XLFD_MAX_LEN) - return -1; - - strcpy(buf, pattern); - last = buf + length - 1; - - /* Replace the original encoding with the encoding for this FontSet. */ - - /* Figure out how many fields have been specified in this xlfd. */ - for (num_fields = 0, base_name = buf; *base_name != '\0'; base_name++) - if (*base_name == '-') num_fields++; - - switch (num_fields) { - case 12: - /* This is the best way to have specifed the fontset. In this - * case, there is no original encoding. E.g., - * -*-*-*-*-*-*-14-*-*-*-*-* - * To this, we'll append a dash: - * -*-*-*-*-*-*-14-*-*-*-*-*- - * then append the encoding to get: - * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 - */ - /* - * Take care of: - * -*-*-*-*-*-*-14-*-*-*-*- - */ - if (*(last) == '-') - *++last = '*'; - - *++last = '-'; - break; - case 13: - /* Got the charset, not the encoding, zap the charset In this - * case, there is no original encoding, but there is a charset. E.g., - * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990 - * To this, we remove the charset: - * -*-*-*-*-*-*-14-*-*-*-*-*- - * then append the new encoding to get: - * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 - */ - last = strrchr (buf, '-'); - num_fields = 12; - break; - case 14: - /* Both the charset and the encoding are specified. Get rid - * of them so that we can append the new charset encoding. E.g., - * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990-0 - * To this, we'll remove the encoding and charset to get: - * -*-*-*-*-*-*-14-*-*-*-*-*- - * then append the new encoding to get: - * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 - */ - last = strrchr (buf, '-'); - *last = '\0'; - last = strrchr (buf, '-'); - num_fields = 12; - break; - default: - if (*last != '-') - *++last = '-'; - break; - } - - /* At this point, "last" is pointing to the last "-" in the - * xlfd, and all xlfd's at this point take a form similar to: - * -*-*-*-*-*-*-14-*-*-*-*-*- - * (i.e., no encoding). - * After the strcpy, we'll end up with something similar to: - * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 - * - * If the modified font is found in the current FontSet, - * we've found a match. - */ - - last++; - - if ((last - buf) + strlen(font_data->name) > XLFD_MAX_LEN) - return -1; - - strcpy(last, font_data->name); - if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) - return True; - - /* This may mot be needed anymore as XListFonts() takes care of this */ - if (num_fields < 12) { - if ((last - buf) > (XLFD_MAX_LEN - 2)) - return -1; - *last = '*'; - *(last + 1) = '-'; - strcpy(last + 2, font_data->name); - num_fields++; - last+=2; - if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) - return True; - } - - - return False; -} - - -typedef enum{C_PRIMARY, C_SUBSTITUTE, C_VMAP, C_VROTATE } ClassType; - -static int -parse_fontdata( - XOC oc, - FontSet font_set, - FontData font_data, - int font_data_count, - char **name_list, - int name_list_count, - ClassType class, - FontDataRec *font_data_return) -{ - - char **cur_name_list = name_list; - char *font_name = (char *) NULL; - char *pattern = (char *) NULL; - int found_num = 0, ret = 0; - int count = name_list_count; - - if(name_list == NULL || count <= 0) { - return False; - } - - if(font_data == NULL || font_data_count <= 0) { - return False; - } - - /* Loop through each font encoding defined in the "font_data" FontSet. */ - for ( ; font_data_count-- > 0; font_data++) { - Bool is_found = False; - font_name = (char *) NULL; - count = name_list_count; - cur_name_list = name_list; - - /* - * Loop through each font specified by the user - * in the call to XCreateFontset(). - */ - while (count-- > 0) { - pattern = *cur_name_list++; - if (pattern == NULL || *pattern == '\0') - continue; -#ifdef FONTDEBUG - fprintf(stderr,"Font pattern: %s %s\n", - pattern,font_data->name); -#endif - - /* - * If the current font is fully specified (i.e., the - * xlfd contains no wildcards) and the font exists on - * the X Server, we have a match. - */ - if (strchr(pattern, '*') == NULL && - (font_name = get_font_name(oc, pattern))) { - /* - * Find the full xlfd name for this font. If the font is - * already in xlfd format, it is simply returned. If the - * font is an alias for another font, the xlfd of the - * aliased font is returned. - */ - ret = parse_all_name(oc, font_data, font_name); - Xfree(font_name); - - if (ret == -1) return -1; - if (ret == False) continue; - /* - * Since there was an exact match of a fully-specified font - * or a font alias, we can return now since the desired font - * was found for the current font encoding for this FontSet. - * - * Previous implementations of this algorithm would - * not return here. Instead, they continued searching - * through the font encodings for this FontSet. The side-effect - * of that behavior is you may return a "substitute" match - * instead of an "exact" match. We believe there should be a - * preference on exact matches. Therefore, as soon as we - * find one, we bail. - * - * Also, previous implementations seemed to think it was - * important to find either a primary or substitute font - * for each Font encoding in the FontSet before returning an - * acceptable font. We don't believe this is necessary. - * All the client cares about is finding a reasonable font - * for what was passed in. If we find an exact match, - * there's no reason to look any further. - * - * -- jjw/pma (HP) - */ - if (font_data_return) { - font_data_return->xlfd_name = strdup(font_data->xlfd_name); - if (!font_data_return->xlfd_name) return -1; - - font_data_return->side = font_data->side; - } -#ifdef FONTDEBUG - fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name); -#endif - - return True; - } - /* - * If the font name is not fully specified - * (i.e., it has wildcards), we have more work to do. - * See the comments in parse_omit_name() - * for the list of things to do. - */ - ret = parse_omit_name(oc, font_data, pattern); - - if (ret == -1) return -1; - if (ret == False) continue; - - /* - * A font which matched the wild-carded specification was found. - * Only update the return data if a font has not yet been found. - * This maintains the convention that FontSets listed higher in - * a CodeSet in the Locale Database have higher priority than - * those FontSets listed lower in the CodeSet. In the following - * example: - * - * fs1 { - * charset HP-JIS:GR - * font JISX0208.1990-0:GL;\ - * JISX0208.1990-1:GR;\ - * JISX0208.1983-0:GL;\ - * JISX0208.1983-1:GR - * } - * - * a font found in the JISX0208.1990-0 FontSet will have a - * higher priority than a font found in the JISX0208.1983-0 - * FontSet. - */ - if (font_data_return && font_data_return->xlfd_name == NULL) { - -#ifdef FONTDEBUG - fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name); -#endif - font_data_return->xlfd_name = strdup(font_data->xlfd_name); - if (!font_data_return->xlfd_name) return -1; - - font_data_return->side = font_data->side; - } - - found_num++; - is_found = True; - - break; - } - - switch(class) { - case C_PRIMARY: - if(is_found == False) { - /* - * Did not find a font for the current FontSet. Check the - * FontSet's "substitute" font for a match. If we find a - * match, we'll keep searching in hopes of finding an exact - * match later down the FontSet list. - * - * when we return and we have found a font font_data_return - * contains the first (ie. best) match no matter if this - * is a C_PRIMARY or a C_SUBSTITUTE font - */ - ret = parse_fontdata(oc, font_set, font_set->substitute, - font_set->substitute_num, name_list, - name_list_count, C_SUBSTITUTE, - font_data_return); - if (ret == -1) return -1; - if (ret == False) continue; - - found_num++; - is_found = True; - } -#ifdef TESTVERSION - else - return True; -#endif - break; - - case C_SUBSTITUTE: - case C_VMAP: - if(is_found == True) - return True; - break; - - case C_VROTATE: - if(is_found == True) { - char *rotate_name; - - if((rotate_name = get_rotate_fontname(font_data->xlfd_name)) - != NULL) { - Xfree(font_data->xlfd_name); - font_data->xlfd_name = rotate_name; - - return True; - } - Xfree(font_data->xlfd_name); - font_data->xlfd_name = NULL; - return False; - } - break; - } - } - - if(class == C_PRIMARY && found_num >= 1) - return True; - - return False; -} - - -static int -parse_vw( - XOC oc, - FontSet font_set, - char **name_list, - int count) -{ - FontData vmap = font_set->vmap; - VRotate vrotate = font_set->vrotate; - int vmap_num = font_set->vmap_num; - int vrotate_num = font_set->vrotate_num; - int ret = 0, i = 0; - - if(vmap_num > 0) { - if(parse_fontdata(oc, font_set, vmap, vmap_num, name_list, - count, C_VMAP,NULL) == -1) - return (-1); - } - - if(vrotate_num > 0) { - ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, - name_list, count, C_VROTATE, NULL); - if(ret == -1) { - return (-1); - } else if(ret == False) { - CodeRange code_range; - int num_cr; - int sub_num = font_set->substitute_num; - - code_range = vrotate[0].code_range; /* ? */ - num_cr = vrotate[0].num_cr; /* ? */ - for(i = 0 ; i < vrotate_num ; i++) { - if(vrotate[i].xlfd_name) - Xfree(vrotate[i].xlfd_name); - } - Xfree(vrotate); - - if(sub_num > 0) { - vrotate = font_set->vrotate = Xcalloc(sub_num, - sizeof(VRotateRec)); - if(font_set->vrotate == (VRotate)NULL) - return (-1); - - for(i = 0 ; i < sub_num ; i++) { - vrotate[i].charset_name = font_set->substitute[i].name; - vrotate[i].side = font_set->substitute[i].side; - vrotate[i].code_range = code_range; - vrotate[i].num_cr = num_cr; - } - vrotate_num = font_set->vrotate_num = sub_num; - } else { - vrotate = font_set->vrotate = (VRotate)NULL; - } - - ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, - name_list, count, C_VROTATE, NULL); - if(ret == -1) - return (-1); - } - } - - return True; -} - -static int -parse_fontname( - XOC oc) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - FontDataRec font_data_return; - char *base_name, **name_list; - int font_set_num = 0; - int found_num = 0; - int count = 0; - int ret; - int i; - - name_list = _XParseBaseFontNameList(oc->core.base_name_list, &count); - if (name_list == NULL) - return -1; - - font_set = gen->font_set; - font_set_num = gen->font_set_num; - - /* Loop through all of the CharSets defined in the Locale - * database for the current Locale. - */ - for( ; font_set_num-- > 0 ; font_set++) { - if(font_set->font_name) - continue; - - if(font_set->font_data_count > 0) { - - /* - * If there are a non-zero number of FontSets defined - * for this CharSet. - * Try to find a font for this CharSet. If we find an - * acceptable font, we save the information for return - * to the client. If we do not find an acceptable font, - * a "missing_charset" will be reported to the client - * for this CharSet. - */ - font_data_return.xlfd_name = NULL; - font_data_return.side = XlcUnknown; - - ret = parse_fontdata(oc, font_set, font_set->font_data, - font_set->font_data_count, - name_list, count, C_PRIMARY, - &font_data_return); - if(ret == -1) { - goto err; - } else if(ret == True) { - /* - * We can't just loop thru fontset->font_data to - * find the first (ie. best) match: parse_fontdata - * will try a substitute font if no primary one could - * be matched. It returns the required information in - * font_data_return. - */ - font_set->font_name = strdup(font_data_return.xlfd_name); - if(font_set->font_name == (char *) NULL) - goto err; - - font_set->side = font_data_return.side; - - Xfree (font_data_return.xlfd_name); - font_data_return.xlfd_name = NULL; - - if(parse_vw(oc, font_set, name_list, count) == -1) - goto err; - found_num++; - } - - } else if(font_set->substitute_num > 0) { - /* - * If there are no FontSets defined for this - * CharSet. We can only find "substitute" fonts. - */ - ret = parse_fontdata(oc, font_set, font_set->substitute, - font_set->substitute_num, - name_list, count, C_SUBSTITUTE, NULL); - if(ret == -1) { - goto err; - } else if(ret == True) { - for(i=0;isubstitute_num;i++){ - if(font_set->substitute[i].xlfd_name != NULL){ - break; - } - } - font_set->font_name = strdup(font_set->substitute[i].xlfd_name); - if(font_set->font_name == (char *) NULL) - goto err; - - font_set->side = font_set->substitute[i].side; - if(parse_vw(oc, font_set, name_list, count) == -1) - goto err; - - found_num++; - } - } - } - - base_name = strdup(oc->core.base_name_list); - if (base_name == NULL) - goto err; - - oc->core.base_name_list = base_name; - - XFreeStringList(name_list); - - return found_num; - -err: - XFreeStringList(name_list); - /* Prevent this from being freed twice */ - oc->core.base_name_list = NULL; - - return -1; -} - -/* For VW/UDC end*/ - -static Bool -set_missing_list( - XOC oc) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - char **charset_list, *charset_buf; - int count, length, font_set_num; - int result = 1; - - font_set = gen->font_set; - font_set_num = gen->font_set_num; - count = length = 0; - - for ( ; font_set_num-- > 0; font_set++) { - if (font_set->info || font_set->font) { - continue; - } - - /* Change 1996.01.23 start */ - if(font_set->font_data_count <= 0 || - font_set->font_data == (FontData)NULL) { - if(font_set->substitute_num <= 0 || - font_set->substitute == (FontData)NULL) { - if(font_set->charset_list != NULL){ - length += - strlen(font_set->charset_list[0]->encoding_name) + 1; - } else { - length += 1; - } - } else { - length += strlen(font_set->substitute->name) + 1; - } - } else { - length += strlen(font_set->font_data->name) + 1; - } - /* Change 1996.01.23 end */ - count++; - } - - if (count < 1) { - return True; - } - - charset_list = Xmalloc(sizeof(char *) * count); - if (charset_list == NULL) { - return False; - } - - charset_buf = Xmalloc(length); - if (charset_buf == NULL) { - Xfree(charset_list); - return False; - } - - oc->core.missing_list.charset_list = charset_list; - oc->core.missing_list.charset_count = count; - - font_set = gen->font_set; - font_set_num = gen->font_set_num; - - for ( ; font_set_num-- > 0; font_set++) { - if (font_set->info || font_set->font) { - continue; - } - - /* Change 1996.01.23 start */ - if(font_set->font_data_count <= 0 || - font_set->font_data == (FontData)NULL) { - if(font_set->substitute_num <= 0 || - font_set->substitute == (FontData)NULL) { - if(font_set->charset_list != NULL){ - strcpy(charset_buf, - font_set->charset_list[0]->encoding_name); - } else { - strcpy(charset_buf, ""); - } - result = 0; - } else { - strcpy(charset_buf, font_set->substitute->name); - } - } else { - strcpy(charset_buf, font_set->font_data->name); - } - /* Change 1996.01.23 end */ - *charset_list++ = charset_buf; - charset_buf += strlen(charset_buf) + 1; - } - - if(result == 0) { - return(False); - } - - return True; -} - -static Bool -create_fontset( - XOC oc) -{ - XOMGenericPart *gen = XOM_GENERIC(oc->core.om); - int found_num; - - if (init_fontset(oc) == False) - return False; - - found_num = parse_fontname(oc); - if (found_num <= 0) { - if (found_num == 0) - set_missing_list(oc); - return False; - } - - if (gen->on_demand_loading == True) { - if (load_font_info(oc) == False) - return False; - } else { - if (load_font(oc) == False) - return False; - } - - if (init_core_part(oc) == False) - return False; - - if (set_missing_list(oc) == False) - return False; - - return True; -} - -/* For VW/UDC start */ -static void -free_fontdataOC( - Display *dpy, - FontData font_data, - int font_data_count) -{ - for( ; font_data_count-- ; font_data++) { - if(font_data->xlfd_name){ - Xfree(font_data->xlfd_name); - font_data->xlfd_name = NULL; - } - if(font_data->font){ /* ADD 1996.01.7 */ - if(font_data->font->fid) /* Add 1996.01.23 */ - XFreeFont(dpy,font_data->font); /* ADD 1996.01.7 */ - else /* Add 1996.01.23 */ - XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ - font_data->font = NULL; - } -/* - * font_data->name and font_data->scopes belong to the OM not OC. - * To save space this data is shared between OM and OC. We are - * not allowed to free it here. - * It has been moved to free_fontdataOM() - */ -/* - if(font_data->scopes){ - Xfree(font_data->scopes); - font_data->scopes = NULL; - } - if(font_data->name){ - Xfree(font_data->name); - font_data->name = NULL; - } -*/ - } -} - -static void destroy_fontdata( - XOCGenericPart *gen, - Display *dpy) -{ - FontSet font_set = (FontSet) NULL; - int font_set_num = 0; - - if (gen->font_set) { - font_set = gen->font_set; - font_set_num = gen->font_set_num; - for( ; font_set_num-- ; font_set++) { - if (font_set->font) { - if(font_set->font->fid) - XFreeFont(dpy,font_set->font); - else - XFreeFontInfo(NULL, font_set->font, 1); - font_set->font = NULL; - } - if(font_set->font_data) { - if (font_set->info) - XFreeFontInfo(NULL, font_set->info, 1); - free_fontdataOC(dpy, - font_set->font_data, font_set->font_data_count); - Xfree(font_set->font_data); - font_set->font_data = NULL; - } - if(font_set->substitute) { - free_fontdataOC(dpy, - font_set->substitute, font_set->substitute_num); - Xfree(font_set->substitute); - font_set->substitute = NULL; - } - if(font_set->vmap) { - free_fontdataOC(dpy, - font_set->vmap, font_set->vmap_num); - Xfree(font_set->vmap); - font_set->vmap = NULL; - } - if(font_set->vrotate) { - free_fontdataOC(dpy, - (FontData)font_set->vrotate, - font_set->vrotate_num); - Xfree(font_set->vrotate); - font_set->vrotate = NULL; - } - } - Xfree(gen->font_set); - gen->font_set = NULL; - } -} -/* For VW/UDC end */ - -static void -destroy_oc( - XOC oc) -{ - Display *dpy = oc->core.om->core.display; - XOCGenericPart *gen = XOC_GENERIC(oc); - - if (gen->mbs_to_cs) - _XlcCloseConverter(gen->mbs_to_cs); - - if (gen->wcs_to_cs) - _XlcCloseConverter(gen->wcs_to_cs); - - if (gen->utf8_to_cs) - _XlcCloseConverter(gen->utf8_to_cs); - -/* For VW/UDC start */ /* Change 1996.01.8 */ - destroy_fontdata(gen,dpy); -/* -*/ -/* For VW/UDC end */ - - Xfree(oc->core.base_name_list); - XFreeStringList(oc->core.font_info.font_name_list); - Xfree(oc->core.font_info.font_struct_list); - XFreeStringList(oc->core.missing_list.charset_list); - -#ifdef notdef - - Xfree(oc->core.res_name); - Xfree(oc->core.res_class); -#endif - - Xfree(oc); -} - -static char * -set_oc_values( - XOC oc, - XlcArgList args, - int num_args) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set = gen->font_set; - char *ret; - int num = gen->font_set_num; - - if (oc->core.resources == NULL) - return NULL; - - ret = _XlcSetValues((XPointer) oc, oc->core.resources, - oc->core.num_resources, args, num_args, XlcSetMask); - if(ret != NULL){ - return(ret); - } else { - for ( ; num-- > 0; font_set++) { - if (font_set->font_name == NULL) - continue; - if (font_set->vpart_initialize != 0) - continue; - if( oc->core.orientation == XOMOrientation_TTB_RTL || - oc->core.orientation == XOMOrientation_TTB_LTR ){ - load_fontdata(oc, font_set->vmap, font_set->vmap_num); - load_fontdata(oc, (FontData) font_set->vrotate, - font_set->vrotate_num); - font_set->vpart_initialize = 1; - } - } - return(NULL); - } -} - -static char * -get_oc_values( - XOC oc, - XlcArgList args, - int num_args) -{ - if (oc->core.resources == NULL) - return NULL; - - return _XlcGetValues((XPointer) oc, oc->core.resources, - oc->core.num_resources, args, num_args, XlcGetMask); -} - -static XOCMethodsRec oc_default_methods = { - destroy_oc, - set_oc_values, - get_oc_values, - _XmbDefaultTextEscapement, - _XmbDefaultTextExtents, - _XmbDefaultTextPerCharExtents, - _XmbDefaultDrawString, - _XmbDefaultDrawImageString, - _XwcDefaultTextEscapement, - _XwcDefaultTextExtents, - _XwcDefaultTextPerCharExtents, - _XwcDefaultDrawString, - _XwcDefaultDrawImageString, - _Xutf8DefaultTextEscapement, - _Xutf8DefaultTextExtents, - _Xutf8DefaultTextPerCharExtents, - _Xutf8DefaultDrawString, - _Xutf8DefaultDrawImageString -}; - -static XOCMethodsRec oc_generic_methods = { - destroy_oc, - set_oc_values, - get_oc_values, - _XmbGenericTextEscapement, - _XmbGenericTextExtents, - _XmbGenericTextPerCharExtents, - _XmbGenericDrawString, - _XmbGenericDrawImageString, - _XwcGenericTextEscapement, - _XwcGenericTextExtents, - _XwcGenericTextPerCharExtents, - _XwcGenericDrawString, - _XwcGenericDrawImageString, - _Xutf8GenericTextEscapement, - _Xutf8GenericTextExtents, - _Xutf8GenericTextPerCharExtents, - _Xutf8GenericDrawString, - _Xutf8GenericDrawImageString -}; - -typedef struct _XOCMethodsListRec { - const char *name; - XOCMethods methods; -} XOCMethodsListRec, *XOCMethodsList; - -static XOCMethodsListRec oc_methods_list[] = { - { "default", &oc_default_methods }, - { "generic", &oc_generic_methods } -}; - -static XlcResource oc_resources[] = { - { XNBaseFontName, NULLQUARK, sizeof(char *), - XOffsetOf(XOCRec, core.base_name_list), XlcCreateMask | XlcGetMask }, - { XNOMAutomatic, NULLQUARK, sizeof(Bool), - XOffsetOf(XOCRec, core.om_automatic), XlcGetMask }, - { XNMissingCharSet, NULLQUARK, sizeof(XOMCharSetList), - XOffsetOf(XOCRec, core.missing_list), XlcGetMask }, - { XNDefaultString, NULLQUARK, sizeof(char *), - XOffsetOf(XOCRec, core.default_string), XlcGetMask }, - { XNOrientation, NULLQUARK, sizeof(XOrientation), - XOffsetOf(XOCRec, core.orientation), XlcDefaultMask | XlcSetMask | XlcGetMask }, - { XNResourceName, NULLQUARK, sizeof(char *), - XOffsetOf(XOCRec, core.res_name), XlcSetMask | XlcGetMask }, - { XNResourceClass, NULLQUARK, sizeof(char *), - XOffsetOf(XOCRec, core.res_class), XlcSetMask | XlcGetMask }, - { XNFontInfo, NULLQUARK, sizeof(XOMFontInfo), - XOffsetOf(XOCRec, core.font_info), XlcGetMask } -}; - -static XOC -create_oc( - XOM om, - XlcArgList args, - int num_args) -{ - XOC oc; - XOMGenericPart *gen = XOM_GENERIC(om); - XOCMethodsList methods_list = oc_methods_list; - int count; - - oc = Xcalloc(1, sizeof(XOCGenericRec)); - if (oc == NULL) - return (XOC) NULL; - - 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; - - if (oc->core.base_name_list == NULL) - goto err; - - oc->core.resources = oc_resources; - oc->core.num_resources = XlcNumber(oc_resources); - - if (create_fontset(oc) == False) - goto err; - - oc->methods = &oc_generic_methods; - - if (gen->object_name) { - count = XlcNumber(oc_methods_list); - - for ( ; count-- > 0; methods_list++) { - if (!_XlcCompareISOLatin1(gen->object_name, methods_list->name)) { - oc->methods = methods_list->methods; - break; - } - } - } - - return oc; - -err: - destroy_oc(oc); - - return (XOC) NULL; -} - -static void -free_fontdataOM( - FontData font_data, - int font_data_count) -{ - for( ; font_data_count-- ; font_data++) { - if(font_data->name){ - Xfree(font_data->name); - font_data->name = NULL; - } - if(font_data->scopes){ - Xfree(font_data->scopes); - font_data->scopes = NULL; - } - } -} - -static Status -close_om( - XOM om) -{ - XOMGenericPart *gen = XOM_GENERIC(om); - OMData data; - int count; - - if ((data = gen->data)) { - for (count = gen->data_num; count-- > 0; data++) { - if (data->charset_list){ - Xfree(data->charset_list); - data->charset_list = NULL; - } - /* free font_data for om */ - if (data->font_data) { - free_fontdataOM(data->font_data,data->font_data_count); - Xfree(data->font_data); - data->font_data = NULL; - } - /* free substitute for om */ - if (data->substitute) { - free_fontdataOM(data->substitute,data->substitute_num); - Xfree(data->substitute); - data->substitute = NULL; - } - /* free vmap for om */ - if (data->vmap) { - free_fontdataOM(data->vmap,data->vmap_num); - Xfree(data->vmap); - data->vmap = NULL; - } - /* free vrotate for om */ - if (data->vrotate) { - Xfree(data->vrotate); - data->vrotate = NULL; - } - } - Xfree(gen->data); - gen->data = NULL; - } - - if (gen->object_name){ - Xfree(gen->object_name); - gen->object_name = NULL; - } - - if (om->core.res_name){ - Xfree(om->core.res_name); - om->core.res_name = NULL; - } - if (om->core.res_class){ - Xfree(om->core.res_class); - om->core.res_class = NULL; - } - if (om->core.required_charset.charset_list && - om->core.required_charset.charset_count > 0){ - XFreeStringList(om->core.required_charset.charset_list); - om->core.required_charset.charset_list = NULL; - } else { - Xfree((char*)om->core.required_charset.charset_list); - om->core.required_charset.charset_list = NULL; - } - if (om->core.orientation_list.orientation){ - Xfree(om->core.orientation_list.orientation); - om->core.orientation_list.orientation = NULL; - } - - Xfree(om); - - return 1; -} - -static char * -set_om_values( - XOM om, - XlcArgList args, - int num_args) -{ - if (om->core.resources == NULL) - return NULL; - - return _XlcSetValues((XPointer) om, om->core.resources, - om->core.num_resources, args, num_args, XlcSetMask); -} - -static char * -get_om_values( - XOM om, - XlcArgList args, - int num_args) -{ - if (om->core.resources == NULL) - return NULL; - - return _XlcGetValues((XPointer) om, om->core.resources, - om->core.num_resources, args, num_args, XlcGetMask); -} - -static XOMMethodsRec methods = { - close_om, - set_om_values, - get_om_values, - create_oc -}; - -static XlcResource om_resources[] = { - { XNRequiredCharSet, NULLQUARK, sizeof(XOMCharSetList), - XOffsetOf(XOMRec, core.required_charset), XlcGetMask }, - { XNQueryOrientation, NULLQUARK, sizeof(XOMOrientation), - XOffsetOf(XOMRec, core.orientation_list), XlcGetMask }, - { XNDirectionalDependentDrawing, NULLQUARK, sizeof(Bool), - XOffsetOf(XOMRec, core.directional_dependent), XlcGetMask }, - { XNContextualDrawing, NULLQUARK, sizeof(Bool), - XOffsetOf(XOMRec, core.contextual_drawing), XlcGetMask } -}; - -static XOM -create_om( - XLCd lcd, - Display *dpy, - XrmDatabase rdb, - _Xconst char *res_name, - _Xconst char *res_class) -{ - XOM om; - - om = Xcalloc(1, sizeof(XOMGenericRec)); - if (om == NULL) - return (XOM) NULL; - - om->methods = &methods; - om->core.lcd = lcd; - om->core.display = dpy; - om->core.rdb = rdb; - if (res_name) { - om->core.res_name = strdup(res_name); - if (om->core.res_name == NULL) - goto err; - } - if (res_class) { - om->core.res_class = strdup(res_class); - if (om->core.res_class == NULL) - goto err; - } - - 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); - - return om; - -err: - close_om(om); - - return (XOM) NULL; -} - -static OMData -add_data( - XOM om) -{ - XOMGenericPart *gen = XOM_GENERIC(om); - OMData new; - int num; - - if ((num = gen->data_num)) - new = Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec)); - else - new = Xmalloc(sizeof(OMDataRec)); - - if (new == NULL) - return NULL; - - gen->data_num = num + 1; - gen->data = new; - - new += num; - bzero((char *) new, sizeof(OMDataRec)); - - return new; -} - -/* For VW/UDC */ - -FontData -read_EncodingInfo( - int count, - char **value) -{ - FontData font_data,ret; - char *buf, *bufptr,*scp; - int len, i; - font_data = Xcalloc(count, sizeof(FontDataRec)); - if (font_data == NULL) - return NULL; - - ret = font_data; - for (i = 0; i < count; i++, font_data++) { -/* - strcpy(buf, *value++); -*/ - buf = *value; value++; - if ((bufptr = strchr(buf, ':'))) { - len = (int)(bufptr - buf); - bufptr++ ; - } else - len = strlen(buf); - font_data->name = Xmalloc(len + 1); - if (font_data->name == NULL) { - free_fontdataOM(ret, i + 1); - Xfree(ret); - return NULL; - } - strncpy(font_data->name, buf,len); - font_data->name[len] = 0; - if (bufptr && _XlcCompareISOLatin1(bufptr, "GL") == 0) - font_data->side = XlcGL; - else if (bufptr && _XlcCompareISOLatin1(bufptr, "GR") == 0) - font_data->side = XlcGR; - else - font_data->side = XlcGLGR; - - if (bufptr && (scp = strchr(bufptr, '['))){ - font_data->scopes = _XlcParse_scopemaps(scp,&(font_data->scopes_num)); - } - } - return(ret); -} - -static CodeRange read_vrotate( - int count, - char **value, - int *type, - int *vrotate_num) -{ - CodeRange range; - if(!strcmp(value[0],"all")){ - *type = VROTATE_ALL ; - *vrotate_num = 0 ; - return (NULL); - } else if(*(value[0]) == '['){ - *type = VROTATE_PART ; - range = (CodeRange) _XlcParse_scopemaps(value[0],vrotate_num); - return (range); - } else { - *type = VROTATE_NONE ; - *vrotate_num = 0 ; - return (NULL); - } -} - -static void read_vw( - XLCd lcd, - OMData font_set, - int num) -{ - char **value, buf[BUFSIZ]; - int count; - - snprintf(buf, sizeof(buf), "fs%d.font.vertical_map", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count > 0){ - _XlcDbg_printValue(buf,value,count); - font_set->vmap_num = count; - font_set->vmap = read_EncodingInfo(count,value); - } - - snprintf(buf, sizeof(buf), "fs%d.font.vertical_rotate", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count > 0){ - _XlcDbg_printValue(buf,value,count); - font_set->vrotate = read_vrotate(count,value,&(font_set->vrotate_type), - &(font_set->vrotate_num)); - } -} -/* VW/UDC end */ -static Bool -init_om( - XOM om) -{ - XLCd lcd = om->core.lcd; - XOMGenericPart *gen = XOM_GENERIC(om); - OMData data; - XlcCharSet *charset_list; - FontData font_data; - char **required_list; - XOrientation *orientation; - char **value, buf[BUFSIZ], *bufptr; - int count = 0, num = 0, length = 0; - - _XlcGetResource(lcd, "XLC_FONTSET", "on_demand_loading", &value, &count); - if (count > 0 && _XlcCompareISOLatin1(*value, "True") == 0) - gen->on_demand_loading = True; - - _XlcGetResource(lcd, "XLC_FONTSET", "object_name", &value, &count); - if (count > 0) { - gen->object_name = strdup(*value); - if (gen->object_name == NULL) - return False; - } - - for (num = 0; ; num++) { - - snprintf(buf, sizeof(buf), "fs%d.charset.name", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - - if( count < 1){ - snprintf(buf, sizeof(buf), "fs%d.charset", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) - break; - } - - data = add_data(om); - if (data == NULL) - return False; - - charset_list = Xmalloc(sizeof(XlcCharSet) * count); - if (charset_list == NULL) - return False; - data->charset_list = charset_list; - data->charset_count = count; - - while (count-- > 0){ - *charset_list++ = _XlcGetCharSet(*value++); - } - snprintf(buf, sizeof(buf), "fs%d.charset.udc_area", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if( count > 0){ - UDCArea udc; - int i,flag = 0; - udc = Xmalloc(count * sizeof(UDCAreaRec)); - if (udc == NULL) - return False; - for(i=0;icharset_count;i++){ - if(data->charset_list[i]->udc_area == NULL){ - data->charset_list[i]->udc_area = udc; - data->charset_list[i]->udc_area_num = count; - flag = 1; - } - } - if(flag == 0){ - Xfree(udc); - } - } - - snprintf(buf, sizeof(buf), "fs%d.font.primary", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1){ - snprintf(buf, sizeof(buf), "fs%d.font", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) - return False; - } - - font_data = read_EncodingInfo(count,value); - if (font_data == NULL) - return False; - - data->font_data = font_data; - data->font_data_count = count; - - snprintf(buf, sizeof(buf), "fs%d.font.substitute", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count > 0){ - font_data = read_EncodingInfo(count,value); - if (font_data == NULL) - return False; - data->substitute = font_data; - data->substitute_num = count; - } else { - snprintf(buf, sizeof(buf), "fs%d.font", num); - _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); - if (count < 1) { - data->substitute = NULL; - data->substitute_num = 0; - } else { - font_data = read_EncodingInfo(count,value); - data->substitute = font_data; - data->substitute_num = count; - } - } - read_vw(lcd,data,num); - length += strlen(data->font_data->name) + 1; - } - - /* required charset list */ - required_list = Xmalloc(sizeof(char *) * gen->data_num); - if (required_list == NULL) - return False; - - om->core.required_charset.charset_list = required_list; - om->core.required_charset.charset_count = gen->data_num; - - count = gen->data_num; - data = gen->data; - - if (count > 0) { - bufptr = Xmalloc(length); - if (bufptr == NULL) { - Xfree(required_list); - return False; - } - - for ( ; count-- > 0; data++) { - strcpy(bufptr, data->font_data->name); - *required_list++ = bufptr; - bufptr += strlen(bufptr) + 1; - } - } - - /* orientation list */ - orientation = Xmalloc(sizeof(XOrientation) * 2); - if (orientation == NULL) - return False; - - orientation[0] = XOMOrientation_LTR_TTB; - orientation[1] = XOMOrientation_TTB_RTL; - om->core.orientation_list.orientation = orientation; - om->core.orientation_list.num_orientation = 2; - - /* directional dependent drawing */ - om->core.directional_dependent = False; - - /* contexual drawing */ - om->core.contextual_drawing = False; - - /* context dependent */ - om->core.context_dependent = False; - - return True; -} - -XOM -_XomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, - _Xconst char *res_name, _Xconst char *res_class) -{ - XOM om; - - om = create_om(lcd, dpy, rdb, res_name, res_class); - if (om == NULL) - return (XOM) NULL; - - if (init_om(om) == False) - goto err; - - return om; - -err: - close_om(om); - - return (XOM) NULL; -} - -Bool -_XInitOM( - XLCd lcd) -{ - lcd->methods->open_om = _XomGenericOpenOM; - - return True; -} diff --git a/nx-X11/lib/X11/omImText.c b/nx-X11/lib/X11/omImText.c deleted file mode 100644 index 9cfb5497d..000000000 --- a/nx-X11/lib/X11/omImText.c +++ /dev/null @@ -1,86 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" - -#define GET_VALUE_MASK (GCFunction | GCForeground | GCBackground | GCFillStyle) -#define SET_VALUE_MASK (GCFunction | GCForeground | GCFillStyle) - -static void -_XomGenericDrawImageString( - Display *dpy, - Drawable d, - XOC oc, - GC gc, - int x, int y, - XOMTextType type, - XPointer text, - int length) -{ - XGCValues values; - XRectangle extent; - - XGetGCValues(dpy, gc, GET_VALUE_MASK, &values); - - XSetFunction(dpy, gc, GXcopy); - XSetForeground(dpy, gc, values.background); - XSetFillStyle(dpy, gc, FillSolid); - - _XomGenericTextExtents(oc, type, text, length, 0, &extent); - XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width, - extent.height); - - XChangeGC(dpy, gc, SET_VALUE_MASK, &values); - - _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length); -} - -void -_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length) -{ - _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMMultiByte, - (XPointer) text, length); -} - -void -_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst wchar_t *text, int length) -{ - _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMWideChar, - (XPointer) text, length); -} - -void -_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, - int y, _Xconst char *text, int length) -{ - _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMUtf8String, - (XPointer) text, length); -} diff --git a/nx-X11/lib/X11/omText.c b/nx-X11/lib/X11/omText.c deleted file mode 100644 index bfceca96e..000000000 --- a/nx-X11/lib/X11/omText.c +++ /dev/null @@ -1,370 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ -/* - * Modifiers: Jeff Walls, Paul Anderson (HEWLETT-PACKARD) - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" -#include - -/* For VW/UDC */ - -static int -is_rotate( - XOC oc, - XFontStruct *font) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - VRotate vrotate; - int font_set_count; - int vrotate_num; - - font_set = gen->font_set; - font_set_count = gen->font_set_num; - for( ; font_set_count-- ; font_set++) { - if((font_set->vrotate_num > 0) && (font_set->vrotate)) { - vrotate = font_set->vrotate; - vrotate_num = font_set->vrotate_num; - for( ; vrotate_num-- ; vrotate++) - if(vrotate->font == font) - return True; - } - } - return False; -} - -static int -is_codemap( - XOC oc, - XFontStruct *font) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - FontData vmap; - int font_set_count; - int vmap_num; - - font_set = gen->font_set; - font_set_count = gen->font_set_num; - for( ; font_set_count-- ; font_set++) { - if(font_set->vmap_num > 0) { - vmap = font_set->vmap; - vmap_num = font_set->vmap_num; - for( ; vmap_num-- ; vmap++) - if(vmap->font == font) - return True; - } - } - return False; -} - -static int -draw_vertical( - Display *dpy, - Drawable d, - XOC oc, - GC gc, - XFontStruct *font, - Bool is_xchar2b, - int x, int y, - XPointer text, - int length) -{ - XChar2b *buf2b; - char *buf; - int wx = 0, wy = 0; - int direction = 0; - int font_ascent_return = 0, font_descent_return = 0; - int i; - XCharStruct overall; - - wy = y; - if (is_xchar2b) { - for(i = 0, buf2b = (XChar2b *) text ; i < length ; i++, buf2b++) { - if(is_rotate(oc, font) == True) { - XTextExtents16(font, buf2b, 1, - &direction, &font_ascent_return, - &font_descent_return, &overall); - wx = x - (int)((overall.rbearing - overall.lbearing) >> 1) - - (int) overall.lbearing; - wy += overall.ascent; - XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); - wy += overall.descent; - } else { - wx = x - (int)((font->max_bounds.rbearing - - font->min_bounds.lbearing) >> 1) - - (int) font->min_bounds.lbearing; - wy += font->max_bounds.ascent; - XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); - wy += font->max_bounds.descent; - } - } - } else { - for(i = 0, buf = (char *)text ; i < length && *buf ; i++, buf++) { - if(is_rotate(oc, font) == True) { - XTextExtents(font, buf, 1, - &direction, &font_ascent_return, - &font_descent_return, &overall); - wx = x - (int)((overall.rbearing - overall.lbearing) >> 1) - - (int) overall.lbearing; - wy += overall.ascent; - XDrawString(dpy, d, gc, wx, wy, buf, 1); - wy += overall.descent; - } else { - wx = x - (int)((font->max_bounds.rbearing - - font->min_bounds.lbearing) >> 1) - - (int) font->min_bounds.lbearing; - wy += font->max_bounds.ascent; - XDrawString(dpy, d, gc, wx, wy, buf, 1); - wy += font->max_bounds.descent; - } - } - } - return wy; -} - -#define VMAP 0 -#define VROTATE 1 -#define FONTSCOPE 2 - -static int -DrawStringWithFontSet( - Display *dpy, - Drawable d, - XOC oc, - FontSet fs, - GC gc, - int x, int y, - XPointer text, - int length) -{ - XFontStruct *font; - Bool is_xchar2b; - unsigned char *ptr; - int ptr_len, char_len = 0; - FontData fd; - int ret = 0; - - ptr = (unsigned char *)text; - is_xchar2b = fs->is_xchar2b; - - while (length > 0) { - fd = _XomGetFontDataFromFontSet(fs, - ptr,length,&ptr_len,is_xchar2b,FONTSCOPE); - if(ptr_len <= 0) - break; - - /* First, see if the "Best Match" font for the FontSet was set. - * If it was, use that font. If it was not set, then use the - * font defined by font_set->font_data[0] (which is what - * _XomGetFontDataFromFontSet() always seems to return for - * non-VW text). Note that given the new algorithm in - * parse_fontname() and parse_fontdata(), fs->font will - * *always* contain good data. We should probably remove - * the check for "fd->font", but we won't :-) -- jjw/pma (HP) - */ - if((font = fs->font) == (XFontStruct *) NULL){ - - if(fd == (FontData) NULL || - (font = fd->font) == (XFontStruct *) NULL) - break; - } - - switch(oc->core.orientation) { - case XOMOrientation_LTR_TTB: - case XOMOrientation_RTL_TTB: - XSetFont(dpy, gc, font->fid); - - if (is_xchar2b) { - char_len = ptr_len / sizeof(XChar2b); - XDrawString16(dpy, d, gc, x, y, (XChar2b *)ptr, char_len); - x += XTextWidth16(font, (XChar2b *)ptr, char_len); - } else { - char_len = ptr_len; - XDrawString(dpy, d, gc, x, y, (char *)ptr, char_len); - x += XTextWidth(font, (char *)ptr, char_len); - } - break; - case XOMOrientation_TTB_RTL: - case XOMOrientation_TTB_LTR: - if(fs->font == font) { - fd = _XomGetFontDataFromFontSet(fs, - ptr,length,&ptr_len,is_xchar2b,VMAP); - if(ptr_len <= 0) - break; - if(fd == (FontData) NULL || - (font = fd->font) == (XFontStruct *) NULL) - break; - - if(is_codemap(oc, fd->font) == False) { - fd = _XomGetFontDataFromFontSet(fs, - ptr,length,&ptr_len,is_xchar2b,VROTATE); - if(ptr_len <= 0) - break; - if(fd == (FontData) NULL || - (font = fd->font) == (XFontStruct *) NULL) - break; - } - } - - if(is_xchar2b) - char_len = ptr_len / sizeof(XChar2b); - else - char_len = ptr_len; - XSetFont(dpy, gc, font->fid); - y = draw_vertical(dpy, d, oc, gc, font, is_xchar2b, x, y, - (char *)ptr, char_len); - break; - - case XOMOrientation_Context: - /* never used? */ - break; - } - - if(char_len <= 0) - break; - - length -= char_len; - ptr += ptr_len; - } - - switch(oc->core.orientation) { - case XOMOrientation_LTR_TTB: - case XOMOrientation_RTL_TTB: - ret = x; - break; - case XOMOrientation_TTB_RTL: - case XOMOrientation_TTB_LTR: - ret = y; - break; - case XOMOrientation_Context: - /* not used? */ - break; - } - return ret; -} - -/* For VW/UDC */ - -int -_XomGenericDrawString( - Display *dpy, - Drawable d, - XOC oc, - GC gc, - int x, int y, - XOMTextType type, - XPointer text, - int length) -{ - XlcConv conv; - XFontStruct *font; - Bool is_xchar2b; -/* VW/UDC */ - XPointer args[3]; - FontSet fs; -/* VW/UDC */ - XChar2b xchar2b_buf[BUFSIZ], *buf; - int start_x = x; - int start_y = y; - int left = 0, buf_len = 0; - int next = 0; - - conv = _XomInitConverter(oc, type); - if (conv == NULL) - return -1; - - args[0] = (XPointer) &font; - args[1] = (XPointer) &is_xchar2b; - args[2] = (XPointer) &fs; - - while (length > 0) { - buf = xchar2b_buf; - left = buf_len = BUFSIZ; - - if (_XomConvert(oc, conv, (XPointer *) &text, &length, - (XPointer *) &buf, &left, args, 3) < 0) - break; - buf_len -= left; - -/* For VW/UDC */ - next = DrawStringWithFontSet(dpy, d, oc, fs, gc, x, y, - (XPointer)xchar2b_buf, buf_len); - - switch(oc->core.orientation) { - case XOMOrientation_LTR_TTB: - case XOMOrientation_RTL_TTB: - x = next; - break; - case XOMOrientation_TTB_RTL: - case XOMOrientation_TTB_LTR: - y = next; - break; - case XOMOrientation_Context: - /* not used */ - break; - } -/* For VW/UDC */ - } - - x -= start_x; - y -= start_y; - - return x; -} - -int -_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length) -{ - return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMMultiByte, - (XPointer) text, length); -} - -int -_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst wchar_t *text, int length) -{ - return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMWideChar, - (XPointer) text, length); -} - -int -_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, - _Xconst char *text, int length) -{ - return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMUtf8String, - (XPointer) text, length); -} diff --git a/nx-X11/lib/X11/omTextEsc.c b/nx-X11/lib/X11/omTextEsc.c deleted file mode 100644 index df1fb10c0..000000000 --- a/nx-X11/lib/X11/omTextEsc.c +++ /dev/null @@ -1,300 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" -#include - -/* For VW/UDC start */ - -#define VMAP 0 -#define VROTATE 1 -#define FONTSCOPE 2 - -static int -is_rotate( - XOC oc, - XFontStruct *font) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - VRotate vrotate; - int font_set_count; - int vrotate_num; - - font_set = gen->font_set; - font_set_count = gen->font_set_num; - for( ; font_set_count-- ; font_set++) { - if((font_set->vrotate_num > 0) && (font_set->vrotate != NULL)) { - vrotate = font_set->vrotate; - vrotate_num = font_set->vrotate_num; - for( ; vrotate_num-- ; vrotate++) - if(vrotate->font == font) - return True; - } - } - return False; -} - -static int -is_codemap( - XOC oc, - XFontStruct *font) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - FontSet font_set; - FontData vmap; - int font_set_count; - int vmap_num; - - font_set = gen->font_set; - font_set_count = gen->font_set_num; - for( ; font_set_count-- ; font_set++) { - if(font_set->vmap_num > 0) { - vmap = font_set->vmap; - vmap_num = font_set->vmap_num; - for( ; vmap_num-- ; vmap++) - if(vmap->font == font) - return True; - } - } - return False; -} - -static int -escapement_vertical( - XOC oc, - XFontStruct *font, - Bool is_xchar2b, - XPointer text, - int length) -{ - XChar2b *buf2b; - char *buf; - int escapement = 0, i; - - if(is_xchar2b) { - for(i = 0, buf2b = (XChar2b *) text ; i < length ; i++, buf2b++) { - if(is_rotate(oc, font) == True) { - escapement += _XTextHeight16(font, buf2b, 1); - } else { - escapement += (int) (font->max_bounds.ascent + - font->max_bounds.descent); - } - } - } else { - for(i = 0, buf = (char *)text ; i < length && *buf ; i++, buf++) { - if(is_rotate(oc, font) == True) { - escapement += _XTextHeight(font, buf, 1); - } else { - escapement += (int) (font->max_bounds.ascent + - font->max_bounds.descent); - } - } - } - return escapement; -} - - -static int -TextWidthWithFontSet( - FontSet font_set, - XOC oc, - XPointer text, - int length) -{ - FontData fd; - XFontStruct *font; - unsigned char *ptr = (unsigned char *)text; - Bool is_xchar2b; - int ptr_len = length; - int escapement = 0, char_len = 0; - - if(font_set == (FontSet) NULL) - return escapement; - - is_xchar2b = font_set->is_xchar2b; - - while(length > 0) { - fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, - is_xchar2b, FONTSCOPE); - if(ptr_len <= 0) - break; - - /* - * First, see if the "Best Match" font for the FontSet was set. - * If it was, use that font. If it was not set, then use the - * font defined by font_set->font_data[0] (which is what - * _XomGetFontDataFromFontSet() always seems to return for - * non-VW text). Note that given the new algorithm in - * parse_fontname() and parse_fontdata(), fs->font will - * *always* contain good data. We should probably remove - * the check for "fd->font", but we won't :-) -- jjw/pma (HP) - * - * Above comment and way this is done propagated from omText.c - * Note that fd->font is junk so using the result of the - * above call /needs/ to be ignored. - * - * Owen Taylor 12 Jul 2000 - * - */ - - if(fd == (FontData) NULL || - (font = font_set->font) == (XFontStruct *) NULL) { - - if((font = fd->font) == (XFontStruct *) NULL) - break; - } - - switch(oc->core.orientation) { - case XOMOrientation_LTR_TTB: - case XOMOrientation_RTL_TTB: - if (is_xchar2b) { - char_len = ptr_len / sizeof(XChar2b); - escapement += XTextWidth16(font, (XChar2b *)ptr, char_len); - } else { - char_len = ptr_len; - escapement += XTextWidth(font, (char *)ptr, char_len); - } - break; - - case XOMOrientation_TTB_LTR: - case XOMOrientation_TTB_RTL: - if(font_set->font == font) { - fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, - is_xchar2b, VMAP); - if(ptr_len <= 0) - break; - if(fd == (FontData) NULL || - (font = fd->font) == (XFontStruct *) NULL) - break; - - if(is_codemap(oc, fd->font) == False) { - fd = _XomGetFontDataFromFontSet(font_set, ptr, length, - &ptr_len, is_xchar2b, - VROTATE); - if(ptr_len <= 0) - break; - if(fd == (FontData) NULL || - (font = fd->font) == (XFontStruct *) NULL) - break; - } - } - - if(is_xchar2b) - char_len = ptr_len / sizeof(XChar2b); - else - char_len = ptr_len; - escapement += escapement_vertical(oc, font, is_xchar2b, - (XPointer) ptr, char_len); - break; - - case XOMOrientation_Context: - /* not used? */ - break; - } - - if(char_len <= 0) - break; - - length -= char_len; - ptr += ptr_len; - } - - return escapement; -} - -/* For VW/UDC end */ - -static int -_XomGenericTextEscapement( - XOC oc, - XOMTextType type, - XPointer text, - int length) -{ - XlcConv conv; - XFontStruct *font; - Bool is_xchar2b; -/* VW/UDC */ - XPointer args[3]; - FontSet font_set; -/* VW/UDC */ - XChar2b xchar2b_buf[BUFSIZ], *buf; - int escapement = 0; - int buf_len = 0, left = 0; - - conv = _XomInitConverter(oc, type); - if (conv == NULL) - return escapement; - - args[0] = (XPointer) &font; - args[1] = (XPointer) &is_xchar2b; - args[2] = (XPointer) &font_set; - - while (length > 0) { - buf = xchar2b_buf; - left = buf_len = BUFSIZ; - - if (_XomConvert(oc, conv, (XPointer *) &text, &length, - (XPointer *) &buf, &left, args, 3) < 0) - break; - buf_len -= left; - -/* VW/UDC */ - escapement += TextWidthWithFontSet(font_set, oc, - (XPointer) xchar2b_buf, buf_len); -/* VW/UDC */ - } - - return escapement; -} - -int -_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length) -{ - return _XomGenericTextEscapement(oc, XOMMultiByte, (XPointer) text, length); -} - -int -_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length) -{ - return _XomGenericTextEscapement(oc, XOMWideChar, (XPointer) text, length); -} - -int -_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length) -{ - return _XomGenericTextEscapement(oc, XOMUtf8String, (XPointer) text, - length); -} diff --git a/nx-X11/lib/X11/omTextExt.c b/nx-X11/lib/X11/omTextExt.c deleted file mode 100644 index baeadf6b0..000000000 --- a/nx-X11/lib/X11/omTextExt.c +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" -#include - -int -_XomGenericTextExtents( - XOC oc, - XOMTextType type, - XPointer text, - int length, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - XlcConv conv; - XFontStruct *font; - Bool is_xchar2b; - XPointer args[2]; - XChar2b xchar2b_buf[BUFSIZ], *buf; - int direction, logical_ascent, logical_descent, tmp_ascent, tmp_descent; - XCharStruct overall, tmp_overall; - int buf_len, left; - Bool first = True; - - conv = _XomInitConverter(oc, type); - if (conv == NULL) - return 0; - - bzero((char *) &overall, sizeof(XCharStruct)); - logical_ascent = logical_descent = 0; - - args[0] = (XPointer) &font; - args[1] = (XPointer) &is_xchar2b; - - while (length > 0) { - buf = xchar2b_buf; - left = buf_len = BUFSIZ; - - if (_XomConvert(oc, conv, (XPointer *) &text, &length, - (XPointer *) &buf, &left, args, 2) < 0) - break; - buf_len -= left; - - if (is_xchar2b) - XTextExtents16(font, xchar2b_buf, buf_len, &direction, - &tmp_ascent, &tmp_descent, &tmp_overall); - else - XTextExtents(font, (char *) xchar2b_buf, buf_len, &direction, - &tmp_ascent, &tmp_descent, &tmp_overall); - - if (first) { /* initialize overall */ - overall = tmp_overall; - logical_ascent = tmp_ascent; - logical_descent = tmp_descent; - first = False; - } else { - overall.lbearing = min(overall.lbearing, - overall.width + tmp_overall.lbearing); - overall.rbearing = max(overall.rbearing, - overall.width + tmp_overall.rbearing); - overall.ascent = max(overall.ascent, tmp_overall.ascent); - overall.descent = max(overall.descent, tmp_overall.descent); - overall.width += tmp_overall.width; - logical_ascent = max(logical_ascent, tmp_ascent); - logical_descent = max(logical_descent, tmp_descent); - } - } - - if (overall_ink) { - overall_ink->x = overall.lbearing; - overall_ink->y = -(overall.ascent); - overall_ink->width = overall.rbearing - overall.lbearing; - overall_ink->height = overall.ascent + overall.descent; - } - - if (overall_logical) { - overall_logical->x = 0; - overall_logical->y = -(logical_ascent); - overall_logical->width = overall.width; - overall_logical->height = logical_ascent + logical_descent; - } - - return overall.width; -} - -int -_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical) -{ - return _XomGenericTextExtents(oc, XOMMultiByte, (XPointer) text, length, - overall_ink, overall_logical); -} - -int -_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical) -{ - return _XomGenericTextExtents(oc, XOMWideChar, (XPointer) text, length, - overall_ink, overall_logical); -} - -int -_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, - XRectangle *overall_ink, XRectangle *overall_logical) -{ - return _XomGenericTextExtents(oc, XOMUtf8String, (XPointer) text, length, - overall_ink, overall_logical); -} diff --git a/nx-X11/lib/X11/omTextPer.c b/nx-X11/lib/X11/omTextPer.c deleted file mode 100644 index ae08fe6a4..000000000 --- a/nx-X11/lib/X11/omTextPer.c +++ /dev/null @@ -1,202 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XomGeneric.h" -#include - -static Status -_XomGenericTextPerCharExtents( - XOC oc, - XOMTextType type, - XPointer text, - int length, - XRectangle *ink_buf, - XRectangle *logical_buf, - int buf_size, - int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - XlcConv conv; - XFontStruct *font; - Bool is_xchar2b; - XPointer args[2]; - XChar2b xchar2b_buf[BUFSIZ], *xchar2b_ptr; - char *xchar_ptr = NULL; - XCharStruct *def, *cs, overall; - int buf_len, left, require_num; - int logical_ascent, logical_descent; - Bool first = True; - - conv = _XomInitConverter(oc, type); - if (conv == NULL) - return 0; - - bzero((char *) &overall, sizeof(XCharStruct)); - logical_ascent = logical_descent = require_num = *num_chars = 0; - - args[0] = (XPointer) &font; - args[1] = (XPointer) &is_xchar2b; - - while (length > 0) { - xchar2b_ptr = xchar2b_buf; - left = buf_len = BUFSIZ; - - if (_XomConvert(oc, conv, (XPointer *) &text, &length, - (XPointer *) &xchar2b_ptr, &left, args, 2) < 0) - break; - buf_len -= left; - - if (require_num) { - require_num += buf_len; - continue; - } - if (buf_size < buf_len) { - require_num = *num_chars + buf_len; - continue; - } - buf_size -= buf_len; - - if (first) { - logical_ascent = font->ascent; - logical_descent = font->descent; - } else { - logical_ascent = max(logical_ascent, font->ascent); - logical_descent = max(logical_descent, font->descent); - } - - if (is_xchar2b) { - CI_GET_DEFAULT_INFO_2D(font, def) - xchar2b_ptr = xchar2b_buf; - } else { - CI_GET_DEFAULT_INFO_1D(font, def) - xchar_ptr = (char *) xchar2b_buf; - } - - while (buf_len-- > 0) { - if (is_xchar2b) { - CI_GET_CHAR_INFO_2D(font, xchar2b_ptr->byte1, - xchar2b_ptr->byte2, def, cs) - xchar2b_ptr++; - } else { - CI_GET_CHAR_INFO_1D(font, *xchar_ptr, def, cs) - xchar_ptr++; - } - if (cs == NULL) - continue; - - ink_buf->x = overall.width + cs->lbearing; - ink_buf->y = -(cs->ascent); - ink_buf->width = cs->rbearing - cs->lbearing; - ink_buf->height = cs->ascent + cs->descent; - ink_buf++; - - logical_buf->x = overall.width; - logical_buf->y = -(font->ascent); - logical_buf->width = cs->width; - logical_buf->height = font->ascent + font->descent; - logical_buf++; - - if (first) { - overall = *cs; - first = False; - } else { - overall.ascent = max(overall.ascent, cs->ascent); - overall.descent = max(overall.descent, cs->descent); - overall.lbearing = min(overall.lbearing, - overall.width + cs->lbearing); - overall.rbearing = max(overall.rbearing, - overall.width + cs->rbearing); - overall.width += cs->width; - } - - (*num_chars)++; - } - } - - if (require_num) { - *num_chars = require_num; - return 0; - } else { - if (overall_ink) { - overall_ink->x = overall.lbearing; - overall_ink->y = -(overall.ascent); - overall_ink->width = overall.rbearing - overall.lbearing; - overall_ink->height = overall.ascent + overall.descent; - } - - if (overall_logical) { - overall_logical->x = 0; - overall_logical->y = -(logical_ascent); - overall_logical->width = overall.width; - overall_logical->height = logical_ascent + logical_descent; - } - } - - return 1; -} - -Status -_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - return _XomGenericTextPerCharExtents(oc, XOMMultiByte, (XPointer) text, - length, ink_buf, logical_buf, buf_size, - num_chars, overall_ink, - overall_logical); -} - -Status -_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - return _XomGenericTextPerCharExtents(oc, XOMWideChar, (XPointer) text, - length, ink_buf, logical_buf, buf_size, - num_chars, overall_ink, - overall_logical); -} - -Status -_Xutf8GenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, - XRectangle *ink_buf, XRectangle *logical_buf, - int buf_size, int *num_chars, - XRectangle *overall_ink, - XRectangle *overall_logical) -{ - return _XomGenericTextPerCharExtents(oc, XOMUtf8String, (XPointer) text, - length, ink_buf, logical_buf, buf_size, - num_chars, overall_ink, - overall_logical); -} diff --git a/nx-X11/lib/X11/omXChar.c b/nx-X11/lib/X11/omXChar.c deleted file mode 100644 index c9bbb8e88..000000000 --- a/nx-X11/lib/X11/omXChar.c +++ /dev/null @@ -1,404 +0,0 @@ -/* - * Copyright 1992, 1993 by TOSHIBA Corp. - * - * 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 supporting - * documentation, and that the name of TOSHIBA not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. TOSHIBA make no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING - * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL - * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. - * mopi@osa.ilab.toshiba.co.jp - */ -/* - * Copyright 1995 by FUJITSU LIMITED - * This is source code modified by FUJITSU LIMITED under the Joint - * Development Agreement for the CDE/Motif PST. - * - * Modifier: Takanori Tateno FUJITSU LIMITED - * - */ -/* - * Modifiers: Jeff Walls, Paul Anderson (HEWLETT-PACKARD) - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "XlcPublic.h" -#include "XomGeneric.h" -#include - -/* for VW/UDC start */ -static Bool -ismatch_scopes( - FontData fontdata, - unsigned long *value, - Bool is_shift) -{ - register int scopes_num = fontdata->scopes_num; - FontScope scopes = fontdata->scopes; - if (!scopes_num) - return False; - - if(fontdata->font == NULL) - return False; - - for(;scopes_num--;scopes++) - if ((scopes->start <= (*value & 0x7f7f)) && - ((scopes->end) >= (*value & 0x7f7f))){ - if(is_shift == True) { - if(scopes->shift){ - if(scopes->shift_direction == '+'){ - *value += scopes->shift ; - } else if( scopes->shift_direction == '-'){ - *value -= scopes->shift ; - } - } - } - return True; - } - - return False; -} - -static int -check_vertical_fonttype( - char *name) -{ - char *ptr; - int type = 0; - - if(name == (char *)NULL || (int) strlen(name) <= 0) - return False; - - /* Obtains the pointer of CHARSET_ENCODING_FIELD. */ - if((ptr = strchr(name, '-')) == (char *) NULL) - return False; - ptr++; - - /* Obtains the pointer of vertical_map font type. */ - if((ptr = strchr(ptr, '.')) == (char *) NULL) - return False; - ptr++; - - switch(*ptr) { - case '1': - type = 1; break; - case '2': - type = 2; break; - case '3': - type = 3; break; - } - return type; -} - -/* -*/ -#define VMAP 0 -#define VROTATE 1 -#define FONTSCOPE 2 - -FontData -_XomGetFontDataFromFontSet( - FontSet fs, - unsigned char *str, - int len, - int *len_ret, - int is2b, - int type) /* VMAP , VROTATE , else */ -{ - unsigned long value; - int num,i,hit,csize; - FontData fontdata; - unsigned char *c; - int vfont_type; - - c = str; - hit = -1; - if(type == VMAP){ - fontdata = fs->vmap; - num = fs->vmap_num; - } else if(type == VROTATE){ - fontdata = (FontData)fs->vrotate; - num = fs->vrotate_num; - } else { - if(fs->font_data_count <= 0 || fs->font_data == (FontData)NULL) { - fontdata = fs->substitute; - num = fs->substitute_num; - }else { - fontdata = fs->font_data; - num = fs->font_data_count; - } - /* CDExc20229 fix */ - if(fontdata == NULL || num == 0){ - return(NULL); - } - } - - - if(is2b){ - csize = 2; - } else { - csize = 1; - } - - for(;len;len--){ - if(is2b){ - value = (((unsigned long)*c) << 8)|(unsigned long)*(c + 1); - } else { - value = (unsigned long)*c; - } - - /* ### NOTE: This routine DOES NOT WORK! - * ### We can work around the problem in the calling routine, - * ### but we really need to understand this better. As it - * ### stands, the algorithm ALWAYS returns "fontdata[0]" - * ### for non-VW text! This is clearly wrong. In fact, - * ### given the new parse_font[name|data]() algorithms, - * ### we may not even need this routine to do anything - * ### for non-VW text (since font_set->font always contains - * ### the best font for this fontset). -- jjw/pma (HP) - */ - for (i=0;ifont_data_count <= 0 || - fs->font_data == (FontData)NULL) - fontdata = fs->substitute; - else - fontdata = fs->font_data; - /* Change 1996.01.23 end */ - } - hit = 0; - c += csize; - break; - } - if( hit == -1 ) hit = i; - if(is2b){ - *c = (unsigned char)(value >> 8); - *(c + 1) = (unsigned char)(value); - } else { - *c = (unsigned char)value; - } - c += csize; - } - *len_ret = (c - str); - return(&(fontdata[hit])); -} -/* for VW/UDC end */ - -static FontSet -_XomGetFontSetFromCharSet( - XOC oc, - XlcCharSet charset) -{ - register FontSet font_set = XOC_GENERIC(oc)->font_set; - register int num = XOC_GENERIC(oc)->font_set_num; - XlcCharSet *charset_list; - int charset_count; - - for ( ; num-- > 0; font_set++) { - charset_count = font_set->charset_count; - charset_list = font_set->charset_list; - for ( ; charset_count-- > 0; charset_list++) - if (*charset_list == charset) - return font_set; - } - - return (FontSet) NULL; -} - -static void -shift_to_gl( - register char *text, - register int length) -{ - while (length-- > 0) - *text++ &= 0x7f; -} - -static void -shift_to_gr( - register char *text, - register int length) -{ - while (length-- > 0) - *text++ |= 0x80; -} - -static Bool -load_font( - XOC oc, - FontSet font_set) -{ - font_set->font = XLoadQueryFont(oc->core.om->core.display, - oc->core.font_info.font_name_list[font_set->id]); - if (font_set->font == NULL) - return False; - - oc->core.font_info.font_struct_list[font_set->id] = font_set->font; - XFreeFontInfo(NULL, font_set->info, 1); - font_set->info = NULL; - - if (font_set->font->min_byte1 || font_set->font->max_byte1) - font_set->is_xchar2b = True; - else - font_set->is_xchar2b = False; - - return True; -} - -int -_XomConvert( - XOC oc, - XlcConv conv, - XPointer *from, - int *from_left, - XPointer *to, - int *to_left, - XPointer *args, - int num_args) -{ - XPointer cs, lc_args[1]; - XlcCharSet charset; - int length, cs_left, ret; - FontSet font_set; - - cs = *to; - cs_left = *to_left; - lc_args[0] = (XPointer) &charset; - - ret = _XlcConvert(conv, from, from_left, &cs, &cs_left, lc_args, 1); - if (ret < 0) - return -1; - - font_set = _XomGetFontSetFromCharSet(oc, charset); - if (font_set == NULL) - return -1; - - if (font_set->font == NULL && load_font(oc, font_set) == False) - return -1; - - length = *to_left - cs_left; - - if (font_set->side != charset->side) { - if (font_set->side == XlcGL) - shift_to_gl(*to, length); - else if (font_set->side == XlcGR) - shift_to_gr(*to, length); - } - - if (font_set->is_xchar2b) - length >>= 1; - *to = cs; - *to_left -= length; - - *((XFontStruct **) args[0]) = font_set->font; - *((Bool *) args[1]) = font_set->is_xchar2b; - if(num_args >= 3){ - *((FontSet *) args[2]) = font_set; - } - - return ret; -} - -XlcConv -_XomInitConverter( - XOC oc, - XOMTextType type) -{ - XOCGenericPart *gen = XOC_GENERIC(oc); - XlcConv *convp; - const char *conv_type; - XlcConv conv; - XLCd lcd; - - switch (type) { - case XOMWideChar: - convp = &gen->wcs_to_cs; - conv_type = XlcNWideChar; - break; - case XOMMultiByte: - convp = &gen->mbs_to_cs; - conv_type = XlcNMultiByte; - break; - case XOMUtf8String: - convp = &gen->utf8_to_cs; - conv_type = XlcNUtf8String; - break; - default: - return (XlcConv) NULL; - } - - conv = *convp; - if (conv) { - _XlcResetConverter(conv); - return conv; - } - - lcd = oc->core.om->core.lcd; - - conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNFontCharSet); - if (conv == (XlcConv) NULL) { - conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNCharSet); - if (conv == (XlcConv) NULL) - return (XlcConv) NULL; - } - - *convp = conv; - return conv; -} diff --git a/nx-X11/lib/X11/pathmax.h b/nx-X11/lib/X11/pathmax.h deleted file mode 100644 index 86e65fadf..000000000 --- a/nx-X11/lib/X11/pathmax.h +++ /dev/null @@ -1,81 +0,0 @@ - -/*********************************************************** - -Copyright 1987, 1988, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987, 1988 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -******************************************************************/ - -/* - * Provides a single definition of PATH_MAX instead of replicating this mess - * in multiple files - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include - -#ifndef X_NOT_POSIX -#ifdef _POSIX_SOURCE -#include -#else -#define _POSIX_SOURCE -#include -#undef _POSIX_SOURCE -#endif -#endif -#ifndef PATH_MAX -#ifdef WIN32 -#define PATH_MAX 512 -#else -#include -#endif -#ifndef PATH_MAX -#ifdef MAXPATHLEN -#define PATH_MAX MAXPATHLEN -#else -#define PATH_MAX 1024 -#endif -#endif -#endif diff --git a/nx-X11/lib/X11/poly.h b/nx-X11/lib/X11/poly.h deleted file mode 100644 index e064783d7..000000000 --- a/nx-X11/lib/X11/poly.h +++ /dev/null @@ -1,294 +0,0 @@ -/************************************************************************ - -Copyright 1987, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN -AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall not be -used in advertising or otherwise to promote the sale, use or other dealings -in this Software without prior written authorization from The Open Group. - - -Copyright 1987 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, -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 Digital not be -used in advertising or publicity pertaining to distribution of the -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 -DIGITAL 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. - -************************************************************************/ - -/* - * This file contains a few macros to help track - * the edge of a filled object. The object is assumed - * to be filled in scanline order, and thus the - * algorithm used is an extension of Bresenham's line - * drawing algorithm which assumes that y is always the - * major axis. - * Since these pieces of code are the same for any filled shape, - * it is more convenient to gather the library in one - * place, but since these pieces of code are also in - * the inner loops of output primitives, procedure call - * overhead is out of the question. - * See the author for a derivation if needed. - */ - - -/* - * In scan converting polygons, we want to choose those pixels - * which are inside the polygon. Thus, we add .5 to the starting - * x coordinate for both left and right edges. Now we choose the - * first pixel which is inside the pgon for the left edge and the - * first pixel which is outside the pgon for the right edge. - * Draw the left pixel, but not the right. - * - * How to add .5 to the starting x coordinate: - * If the edge is moving to the right, then subtract dy from the - * error term from the general form of the algorithm. - * If the edge is moving to the left, then add dy to the error term. - * - * The reason for the difference between edges moving to the left - * and edges moving to the right is simple: If an edge is moving - * to the right, then we want the algorithm to flip immediately. - * If it is moving to the left, then we don't want it to flip until - * we traverse an entire pixel. - */ -#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ - int dx; /* local storage */ \ -\ - /* \ - * if the edge is horizontal, then it is ignored \ - * and assumed not to be processed. Otherwise, do this stuff. \ - */ \ - if ((dy) != 0) { \ - xStart = (x1); \ - dx = (x2) - xStart; \ - if (dx < 0) { \ - m = dx / (dy); \ - m1 = m - 1; \ - incr1 = -2 * dx + 2 * (dy) * m1; \ - incr2 = -2 * dx + 2 * (dy) * m; \ - d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ - } else { \ - m = dx / (dy); \ - m1 = m + 1; \ - incr1 = 2 * dx - 2 * (dy) * m1; \ - incr2 = 2 * dx - 2 * (dy) * m; \ - d = -2 * m * (dy) + 2 * dx; \ - } \ - } \ -} - -#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ - if (m1 > 0) { \ - if (d > 0) { \ - minval += m1; \ - d += incr1; \ - } \ - else { \ - minval += m; \ - d += incr2; \ - } \ - } else {\ - if (d >= 0) { \ - minval += m1; \ - d += incr1; \ - } \ - else { \ - minval += m; \ - d += incr2; \ - } \ - } \ -} - - -/* - * This structure contains all of the information needed - * to run the bresenham algorithm. - * The variables may be hardcoded into the declarations - * instead of using this structure to make use of - * register declarations. - */ -typedef struct { - int minor_axis; /* minor axis */ - int d; /* decision variable */ - int m, m1; /* slope and slope+1 */ - int incr1, incr2; /* error increments */ -} BRESINFO; - - -#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ - BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \ - bres.m, bres.m1, bres.incr1, bres.incr2) - -#define BRESINCRPGONSTRUCT(bres) \ - BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2) - - - -/* - * These are the data structures needed to scan - * convert regions. Two different scan conversion - * methods are available -- the even-odd method, and - * the winding number method. - * The even-odd rule states that a point is inside - * the polygon if a ray drawn from that point in any - * direction will pass through an odd number of - * path segments. - * By the winding number rule, a point is decided - * to be inside the polygon if a ray drawn from that - * point in any direction passes through a different - * number of clockwise and counter-clockwise path - * segments. - * - * These data structures are adapted somewhat from - * the algorithm in (Foley/Van Dam) for scan converting - * polygons. - * The basic algorithm is to start at the top (smallest y) - * of the polygon, stepping down to the bottom of - * the polygon by incrementing the y coordinate. We - * keep a list of edges which the current scanline crosses, - * sorted by x. This list is called the Active Edge Table (AET) - * As we change the y-coordinate, we update each entry in - * in the active edge table to reflect the edges new xcoord. - * This list must be sorted at each scanline in case - * two edges intersect. - * We also keep a data structure known as the Edge Table (ET), - * which keeps track of all the edges which the current - * scanline has not yet reached. The ET is basically a - * list of ScanLineList structures containing a list of - * edges which are entered at a given scanline. There is one - * ScanLineList per scanline at which an edge is entered. - * When we enter a new edge, we move it from the ET to the AET. - * - * From the AET, we can implement the even-odd rule as in - * (Foley/Van Dam). - * The winding number rule is a little trickier. We also - * keep the EdgeTableEntries in the AET linked by the - * nextWETE (winding EdgeTableEntry) link. This allows - * the edges to be linked just as before for updating - * purposes, but only uses the edges linked by the nextWETE - * link as edges representing spans of the polygon to - * drawn (as with the even-odd rule). - */ - -/* - * for the winding number rule - */ -#define CLOCKWISE 1 -#define COUNTERCLOCKWISE -1 - -typedef struct _EdgeTableEntry { - int ymax; /* ycoord at which we exit this edge. */ - BRESINFO bres; /* Bresenham info to run the edge */ - struct _EdgeTableEntry *next; /* next in the list */ - struct _EdgeTableEntry *back; /* for insertion sort */ - struct _EdgeTableEntry *nextWETE; /* for winding num rule */ - int ClockWise; /* flag for winding number rule */ -} EdgeTableEntry; - - -typedef struct _ScanLineList{ - int scanline; /* the scanline represented */ - EdgeTableEntry *edgelist; /* header node */ - struct _ScanLineList *next; /* next in the list */ -} ScanLineList; - - -typedef struct { - int ymax; /* ymax for the polygon */ - int ymin; /* ymin for the polygon */ - ScanLineList scanlines; /* header node */ -} EdgeTable; - - -/* - * Here is a struct to help with storage allocation - * so we can allocate a big chunk at a time, and then take - * pieces from this heap when we need to. - */ -#define SLLSPERBLOCK 25 - -typedef struct _ScanLineListBlock { - ScanLineList SLLs[SLLSPERBLOCK]; - struct _ScanLineListBlock *next; -} ScanLineListBlock; - - - -/* - * - * a few macros for the inner loops of the fill code where - * performance considerations don't allow a procedure call. - * - * Evaluate the given edge at the given scanline. - * If the edge has expired, then we leave it and fix up - * the active edge table; otherwise, we increment the - * x value to be ready for the next scanline. - * The winding number rule is in effect, so we must notify - * the caller when the edge has been removed so he - * can reorder the Winding Active Edge Table. - */ -#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ - if (pAET->ymax == y) { /* leaving this edge */ \ - pPrevAET->next = pAET->next; \ - pAET = pPrevAET->next; \ - fixWAET = 1; \ - if (pAET) \ - pAET->back = pPrevAET; \ - } \ - else { \ - BRESINCRPGONSTRUCT(pAET->bres); \ - pPrevAET = pAET; \ - pAET = pAET->next; \ - } \ -} - - -/* - * Evaluate the given edge at the given scanline. - * If the edge has expired, then we leave it and fix up - * the active edge table; otherwise, we increment the - * x value to be ready for the next scanline. - * The even-odd rule is in effect. - */ -#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ - if (pAET->ymax == y) { /* leaving this edge */ \ - pPrevAET->next = pAET->next; \ - pAET = pPrevAET->next; \ - if (pAET) \ - pAET->back = pPrevAET; \ - } \ - else { \ - BRESINCRPGONSTRUCT(pAET->bres); \ - pPrevAET = pAET; \ - pAET = pAET->next; \ - } \ -} diff --git a/nx-X11/lib/X11/utf8WMProps.c b/nx-X11/lib/X11/utf8WMProps.c deleted file mode 100644 index 09d643377..000000000 --- a/nx-X11/lib/X11/utf8WMProps.c +++ /dev/null @@ -1,91 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * Copyright 2000 by Bruno Haible - * - * Permission to use, copy, modify, distribute, and sell this software - * and its 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 Bruno Haible not - * be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Bruno Haible - * makes no representations about the suitability of this software for - * any purpose. It is provided "as is" without express or implied - * warranty. - * - * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL Bruno Haible 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include -#include - -void -Xutf8SetWMProperties ( - Display *dpy, - Window w, - _Xconst char *windowName, - _Xconst char *iconName, - char **argv, - int argc, - XSizeHints *sizeHints, - XWMHints *wmHints, - XClassHint *classHints) -{ - XTextProperty wname, iname; - XTextProperty *wprop = NULL; - XTextProperty *iprop = NULL; - - if (windowName && - Xutf8TextListToTextProperty(dpy, (char**)&windowName, 1, - XStdICCTextStyle, &wname) >= Success) - wprop = &wname; - if (iconName && - Xutf8TextListToTextProperty(dpy, (char**)&iconName, 1, - XStdICCTextStyle, &iname) >= Success) - iprop = &iname; - XSetWMProperties(dpy, w, wprop, iprop, argv, argc, - sizeHints, wmHints, classHints); - if (wprop) - Xfree(wname.value); - if (iprop) - Xfree(iname.value); - - /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ -} diff --git a/nx-X11/lib/X11/utf8Wrap.c b/nx-X11/lib/X11/utf8Wrap.c deleted file mode 100644 index 24cb4494c..000000000 --- a/nx-X11/lib/X11/utf8Wrap.c +++ /dev/null @@ -1,183 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ -/* - * Copyright 1991 by the Open Software Foundation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 - * 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 - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * 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 - * 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 - */ -/* - * Copyright 2000 by Bruno Haible - * - * Permission to use, copy, modify, distribute, and sell this software - * and its 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 Bruno Haible not - * be used in advertising or publicity pertaining to distribution of the - * software without specific, written prior permission. Bruno Haible - * makes no representations about the suitability of this software for - * any purpose. It is provided "as is" without express or implied - * warranty. - * - * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL Bruno Haible 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. - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -void -Xutf8DrawText( - Display *dpy, - Drawable d, - GC gc, - int x, - int y, - XmbTextItem *text_items, - int nitems) -{ - register XFontSet fs = NULL; - register XmbTextItem *p = text_items; - register int i = nitems; - register int esc; - - /* ignore leading items with no fontset */ - while (i && !p->font_set) { - i--; - p++; - } - - for (; --i >= 0; p++) { - if (p->font_set) - fs = p->font_set; - x += p->delta; - esc = (*fs->methods->utf8_draw_string) (dpy, d, fs, gc, x, y, - p->chars, p->nchars); - if (!esc) - esc = fs->methods->utf8_escapement (fs, p->chars, p->nchars); - x += esc; - } -} - -void -Xutf8DrawString( - Display *dpy, - Drawable d, - XFontSet font_set, - GC gc, - int x, - int y, - _Xconst char *text, - int text_len) -{ - (void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y, - text, text_len); -} - - -void -Xutf8DrawImageString( - Display *dpy, - Drawable d, - XFontSet font_set, - GC gc, - int x, - int y, - _Xconst char *text, - int text_len) -{ - (*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y, - text, text_len); -} - -int -Xutf8TextEscapement( - XFontSet font_set, - _Xconst char *text, - int text_len) -{ - return (*font_set->methods->utf8_escapement) (font_set, text, text_len); -} - -int -Xutf8TextExtents( - XFontSet font_set, - _Xconst char *text, - int text_len, - XRectangle *overall_ink_extents, - XRectangle *overall_logical_extents) -{ - return (*font_set->methods->utf8_extents) (font_set, text, text_len, - overall_ink_extents, - overall_logical_extents); -} - -Status -Xutf8TextPerCharExtents( - XFontSet font_set, - _Xconst char *text, - int text_len, - XRectangle *ink_extents_buffer, - XRectangle *logical_extents_buffer, - int buffer_size, - int *num_chars, - XRectangle *max_ink_extents, - XRectangle *max_logical_extents) -{ - return (*font_set->methods->utf8_extents_per_char) - (font_set, text, text_len, - ink_extents_buffer, logical_extents_buffer, - buffer_size, num_chars, max_ink_extents, max_logical_extents); -} diff --git a/nx-X11/lib/X11/util/makekeys.c b/nx-X11/lib/X11/util/makekeys.c deleted file mode 100644 index 897b882dc..000000000 --- a/nx-X11/lib/X11/util/makekeys.c +++ /dev/null @@ -1,317 +0,0 @@ -/* - -Copyright 1990, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* Constructs hash tables for XStringToKeysym and XKeysymToString. */ - -#include -#include -#include -#include -#include -#include - -#include "../Xresinternal.h" - -#define KTNUM 4000 - -static struct info { - char *name; - KeySym val; -} info[KTNUM]; - -#define MIN_REHASH 15 -#define MATCHES 10 - -static char tab[KTNUM]; -static unsigned short offsets[KTNUM]; -static unsigned short indexes[KTNUM]; -static KeySym values[KTNUM]; -static int ksnum = 0; - -static int -parse_line(const char *buf, char *key, KeySym *val, char *prefix) -{ - int i; - char alias[128]; - char *tmp, *tmpa; - - /* See if we can catch a straight XK_foo 0x1234-style definition first; - * the trickery around tmp is to account for prefices. */ - i = sscanf(buf, "#define %127s 0x%lx", key, val); - if (i == 2 && (tmp = strstr(key, "XK_"))) { - memcpy(prefix, key, tmp - key); - prefix[tmp - key] = '\0'; - tmp += 3; - memmove(key, tmp, strlen(tmp) + 1); - return 1; - } - - /* Now try to catch alias (XK_foo XK_bar) definitions, and resolve them - * immediately: if the target is in the form XF86XK_foo, we need to - * canonicalise this to XF86foo before we do the lookup. */ - i = sscanf(buf, "#define %127s %127s", key, alias); - if (i == 2 && (tmp = strstr(key, "XK_")) && (tmpa = strstr(alias, "XK_"))) { - memcpy(prefix, key, tmp - key); - prefix[tmp - key] = '\0'; - tmp += 3; - memmove(key, tmp, strlen(tmp) + 1); - memmove(tmpa, tmpa + 3, strlen(tmpa + 3) + 1); - - for (i = ksnum - 1; i >= 0; i--) { - if (strcmp(info[i].name, alias) == 0) { - *val = info[i].val; - return 1; - } - } - - fprintf(stderr, "can't find matching definition %s for keysym %s%s\n", - alias, prefix, key); - } - - return 0; -} - -int -main(int argc, char *argv[]) -{ - int max_rehash; - Signature sig; - int i, j, k, l, z; - FILE *fptr; - char *name; - char c; - int first; - int best_max_rehash; - int best_z = 0; - int num_found; - KeySym val; - char key[128], prefix[128]; - static char buf[1024]; - - for (l = 1; l < argc; l++) { - fptr = fopen(argv[l], "r"); - if (!fptr) { - fprintf(stderr, "couldn't open %s\n", argv[l]); - continue; - } - - while (fgets(buf, sizeof(buf), fptr)) { - if (!parse_line(buf, key, &val, prefix)) - continue; - - if (val == XK_VoidSymbol) - val = 0; - if (val > 0x1fffffff) { - fprintf(stderr, "ignoring illegal keysym (%s, %lx)\n", key, - val); - continue; - } - - name = malloc(strlen(prefix) + strlen(key) + 1); - if (!name) { - fprintf(stderr, "makekeys: out of memory!\n"); - exit(1); - } - sprintf(name, "%s%s", prefix, key); - info[ksnum].name = name; - info[ksnum].val = val; - ksnum++; - if (ksnum == KTNUM) { - fprintf(stderr, "makekeys: too many keysyms!\n"); - exit(1); - } - } - - fclose(fptr); - } - - printf("/* This file is generated from keysymdef.h. */\n"); - printf("/* Do not edit. */\n"); - printf("\n"); - - best_max_rehash = ksnum; - num_found = 0; - for (z = ksnum; z < KTNUM; z++) { - max_rehash = 0; - for (name = tab, i = z; --i >= 0;) - *name++ = 0; - for (i = 0; i < ksnum; i++) { - name = info[i].name; - sig = 0; - while ((c = *name++)) - sig = (sig << 1) + c; - first = j = sig % z; - for (k = 0; tab[j]; k++) { - j += first + 1; - if (j >= z) - j -= z; - if (j == first) - goto next1; - } - tab[j] = 1; - if (k > max_rehash) - max_rehash = k; - } - if (max_rehash < MIN_REHASH) { - if (max_rehash < best_max_rehash) { - best_max_rehash = max_rehash; - best_z = z; - } - num_found++; - if (num_found >= MATCHES) - break; - } -next1: ; - } - - z = best_z; - if (z == 0) { - fprintf(stderr, "makekeys: failed to find small enough hash!\n" - "Try increasing KTNUM in makekeys.c\n"); - exit(1); - } - printf("#ifdef NEEDKTABLE\n"); - printf("const unsigned char _XkeyTable[] = {\n"); - printf("0,\n"); - k = 1; - for (i = 0; i < ksnum; i++) { - name = info[i].name; - sig = 0; - while ((c = *name++)) - sig = (sig << 1) + c; - first = j = sig % z; - while (offsets[j]) { - j += first + 1; - if (j >= z) - j -= z; - } - offsets[j] = k; - indexes[i] = k; - val = info[i].val; - printf("0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ", - (sig >> 8) & 0xff, sig & 0xff, - (val >> 24) & 0xff, (val >> 16) & 0xff, - (val >> 8) & 0xff, val & 0xff); - for (name = info[i].name, k += 7; (c = *name++); k++) - printf("'%c',", c); - printf((i == (ksnum-1)) ? "0\n" : "0,\n"); - } - printf("};\n"); - printf("\n"); - printf("#define KTABLESIZE %d\n", z); - printf("#define KMAXHASH %d\n", best_max_rehash + 1); - printf("\n"); - printf("static const unsigned short hashString[KTABLESIZE] = {\n"); - for (i = 0; i < z;) { - printf("0x%.4x", offsets[i]); - i++; - if (i == z) - break; - printf((i & 7) ? ", " : ",\n"); - } - printf("\n"); - printf("};\n"); - printf("#endif /* NEEDKTABLE */\n"); - - best_max_rehash = ksnum; - num_found = 0; - for (z = ksnum; z < KTNUM; z++) { - max_rehash = 0; - for (name = tab, i = z; --i >= 0;) - *name++ = 0; - for (i = 0; i < ksnum; i++) { - val = info[i].val; - first = j = val % z; - for (k = 0; tab[j]; k++) { - if (values[j] == val) - goto skip1; - j += first + 1; - if (j >= z) - j -= z; - if (j == first) - goto next2; - } - tab[j] = 1; - values[j] = val; - if (k > max_rehash) - max_rehash = k; -skip1: ; - } - if (max_rehash < MIN_REHASH) { - if (max_rehash < best_max_rehash) { - best_max_rehash = max_rehash; - best_z = z; - } - num_found++; - if (num_found >= MATCHES) - break; - } -next2: ; - } - - z = best_z; - if (z == 0) { - fprintf(stderr, "makekeys: failed to find small enough hash!\n" - "Try increasing KTNUM in makekeys.c\n"); - exit(1); - } - for (i = z; --i >= 0;) - offsets[i] = 0; - for (i = 0; i < ksnum; i++) { - val = info[i].val; - first = j = val % z; - while (offsets[j]) { - if (values[j] == val) - goto skip2; - j += first + 1; - if (j >= z) - j -= z; - } - offsets[j] = indexes[i] + 2; - values[j] = val; -skip2: ; - } - printf("\n"); - printf("#ifdef NEEDVTABLE\n"); - printf("#define VTABLESIZE %d\n", z); - printf("#define VMAXHASH %d\n", best_max_rehash + 1); - printf("\n"); - printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n"); - for (i = 0; i < z;) { - printf("0x%.4x", offsets[i]); - i++; - if (i == z) - break; - printf((i & 7) ? ", " : ",\n"); - } - printf("\n"); - printf("};\n"); - printf("#endif /* NEEDVTABLE */\n"); - - exit(0); -} diff --git a/nx-X11/lib/X11/utlist.h b/nx-X11/lib/X11/utlist.h deleted file mode 100644 index 215c2c62e..000000000 --- a/nx-X11/lib/X11/utlist.h +++ /dev/null @@ -1,116 +0,0 @@ -/* -Copyright (c) 2007-2009, Troy D. Hanson -All rights reserved. - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - - * Redistributions of source code must retain the above copyright - notice, this list of conditions and the following disclaimer. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER -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. -*/ - -#ifndef UTLIST_H -#define UTLIST_H - -#define UTLIST_VERSION 1.7 - -/* From: http://uthash.sourceforge.net/utlist.html */ -/* - * This file contains macros to manipulate singly and doubly-linked lists. - * - * 1. LL_ macros: singly-linked lists. - * 2. DL_ macros: doubly-linked lists. - * 3. CDL_ macros: circular doubly-linked lists. - * - * To use singly-linked lists, your structure must have a "next" pointer. - * To use doubly-linked lists, your structure must "prev" and "next" pointers. - * Either way, the pointer to the head of the list must be initialized to NULL. - * - * ----------------.EXAMPLE ------------------------- - * struct item { - * int id; - * struct item *prev, *next; - * } - * - * struct item *list = NULL: - * - * int main() { - * struct item *item; - * ... allocate and populate item ... - * DL_APPEND(list, item); - * } - * -------------------------------------------------- - * - * For doubly-linked lists, the append and delete macros are O(1) - * For singly-linked lists, append and delete are O(n) but prepend is O(1) - * The sort macro is O(n log(n)) for all types of single/double/circular lists. - */ - - -/****************************************************************************** - * doubly linked list macros (non-circular) * - *****************************************************************************/ -#define DL_PREPEND(head,add) \ -do { \ - (add)->next = head; \ - if (head) { \ - (add)->prev = (head)->prev; \ - (head)->prev = (add); \ - } else { \ - (add)->prev = (add); \ - } \ - (head) = (add); \ -} while (0) - -#define DL_APPEND(head,add) \ -do { \ - if (head) { \ - (add)->prev = (head)->prev; \ - (head)->prev->next = (add); \ - (head)->prev = (add); \ - (add)->next = NULL; \ - } else { \ - (head)=(add); \ - (head)->prev = (head); \ - (head)->next = NULL; \ - } \ -} while (0); - -#define DL_DELETE(head,del) \ -do { \ - if ((del)->prev == (del)) { \ - (head)=NULL; \ - } else if ((del)==(head)) { \ - (del)->next->prev = (del)->prev; \ - (head) = (del)->next; \ - } else { \ - (del)->prev->next = (del)->next; \ - if ((del)->next) { \ - (del)->next->prev = (del)->prev; \ - } else { \ - (head)->prev = (del)->prev; \ - } \ - } \ -} while (0); - - -#define DL_FOREACH(head,el) \ - for(el=head;el;el=el->next) - -#define DL_FOREACH_SAFE(head,el,tmp) \ - for(el=head,tmp=el->next;el;el=tmp,tmp=(el) ? (el->next) : NULL) - -#endif /* UTLIST_H */ - diff --git a/nx-X11/lib/X11/uvY.c b/nx-X11/lib/X11/uvY.c deleted file mode 100644 index 19e6c5232..000000000 --- a/nx-X11/lib/X11/uvY.c +++ /dev/null @@ -1,423 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of XCMS based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * - * NAME - * CIEuvy.c - * - * DESCRIPTION - * This file contains routines that support the CIE u'v'Y - * color space to include conversions to and from the CIE - * XYZ space. - * - * DOCUMENTATION - * "TekColor Color Management System, System Implementor's Manual" - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -#include - -/* - * FORWARD DECLARATIONS - */ -static int CIEuvY_ParseString(register char *spec, XcmsColor *pColor); - -/* - * DEFINES - * Internal definitions that need NOT be exported to any package - * or program using this package. - */ -#ifdef DBL_EPSILON -# define XMY_DBL_EPSILON DBL_EPSILON -#else -# define XMY_DBL_EPSILON 0.00001 -#endif - - -/* - * LOCAL VARIABLES - */ - - /* - * NULL terminated list of functions applied to get from CIEuvY to CIEXYZ - */ -static XcmsConversionProc Fl_CIEuvY_to_CIEXYZ[] = { - XcmsCIEuvYToCIEXYZ, - NULL -}; - - /* - * NULL terminated list of functions applied to get from CIEXYZ to CIEuvY - */ -static XcmsConversionProc Fl_CIEXYZ_to_CIEuvY[] = { - XcmsCIEXYZToCIEuvY, - NULL -}; - - -/* - * GLOBALS - */ - - /* - * CIE uvY Color Space - */ -XcmsColorSpace XcmsCIEuvYColorSpace = - { - _XcmsCIEuvY_prefix, /* prefix */ - XcmsCIEuvYFormat, /* id */ - CIEuvY_ParseString, /* parseString */ - Fl_CIEuvY_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_CIEuvY, /* from_CIEXYZ */ - 1 - }; - - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * CIEuvY_ParseString - * - * SYNOPSIS - */ -static int -CIEuvY_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsCIEuvYFormat. - * The assumed CIEuvY string syntax is: - * CIEuvY:// - * Where u, v, and Y are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - * 0 if failed, non-zero otherwise. - */ -{ - size_t n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (size_t)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsCIEuvY_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIEuvY.u_prime, - &pColor->spec.CIEuvY.v_prime, - &pColor->spec.CIEuvY.Y) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIEuvY.u_prime, - &pColor->spec.CIEuvY.v_prime, - &pColor->spec.CIEuvY.Y) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - pColor->format = XcmsCIEuvYFormat; - pColor->pixel = 0; - return(_XcmsCIEuvY_ValidSpec(pColor)); -} - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * XcmsCIEuvY_ValidSpec - * - * SYNOPSIS - */ -Status -_XcmsCIEuvY_ValidSpec( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks if color specification valid for CIE u'v'Y. - * - * RETURNS - * XcmsFailure if invalid, - * XcmsSuccess if valid. - * - */ -{ - if (pColor->format != XcmsCIEuvYFormat - || - (pColor->spec.CIEuvY.Y < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIEuvY.Y > 1.0 + XMY_DBL_EPSILON)) { - return(XcmsFailure); - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIEuvYToCIEXYZ - convert CIEuvY to CIEXYZ - * - * SYNOPSIS - */ -Status -XcmsCIEuvYToCIEXYZ( - XcmsCCC ccc, - XcmsColor *puvY_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIEuvY format to CIEXYZ format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsCIEXYZ XYZ_return; - XcmsColor whitePt; - unsigned int i; - XcmsColor *pColor = pColors_in_out; - XcmsFloat div, x, y, z, Y; - - /* - * Check arguments - * Postpone checking puvY_WhitePt until it is actually needed - * otherwise converting between XYZ and uvY will fail. - */ - if (pColors_in_out == NULL) { - return(XcmsFailure); - } - - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - /* Make sure original format is CIEuvY */ - if (!_XcmsCIEuvY_ValidSpec(pColor)) { - return(XcmsFailure); - } - - /* - * Convert to CIEXYZ - */ - - Y = pColor->spec.CIEuvY.Y; - - /* Convert color u'v' to xyz space */ - div = (6.0 * pColor->spec.CIEuvY.u_prime) - (16.0 * pColor->spec.CIEuvY.v_prime) + 12.0; - if (div == 0.0) { - /* use white point since div == 0 */ - if (puvY_WhitePt == NULL ) { - return(XcmsFailure); - } - /* - * Make sure white point is in CIEuvY form - */ - if (puvY_WhitePt->format != XcmsCIEuvYFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)puvY_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, - XcmsCIEuvYFormat)) { - return(XcmsFailure); - } - puvY_WhitePt = &whitePt; - } - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (puvY_WhitePt->spec.CIEuvY.Y != 1.0) { - return(XcmsFailure); - } - div = (6.0 * puvY_WhitePt->spec.CIEuvY.u_prime) - - (16.0 * puvY_WhitePt->spec.CIEuvY.v_prime) + 12.0; - if (div == 0) { - /* internal error */ - return(XcmsFailure); - } - x = 9.0 * puvY_WhitePt->spec.CIEuvY.u_prime / div; - y = 4.0 * puvY_WhitePt->spec.CIEuvY.v_prime / div; - } else { - x = 9.0 * pColor->spec.CIEuvY.u_prime / div; - y = 4.0 * pColor->spec.CIEuvY.v_prime / div; - } - z = 1.0 - x - y; - - /* Convert from xyz to XYZ */ - /* Conversion uses color normalized lightness based on Y */ - if (y != 0.0) { - XYZ_return.X = x * Y / y; - } else { - XYZ_return.X = x; - } - XYZ_return.Y = Y; - if (y != 0.0) { - XYZ_return.Z = z * Y / y; - } else { - XYZ_return.Z = z; - } - - memcpy((char *)&pColor->spec.CIEXYZ, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); - /* Identify that format is now CIEXYZ */ - pColor->format = XcmsCIEXYZFormat; - } - - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIEXYZToCIEuvY - convert CIEXYZ to CIEuvY - * - * SYNOPSIS - */ -Status -XcmsCIEXYZToCIEuvY( - XcmsCCC ccc, - XcmsColor *puvY_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIEXYZ format to CIEuvY format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsCIEuvY uvY_return; - XcmsColor whitePt; - unsigned int i; - XcmsColor *pColor = pColors_in_out; - XcmsFloat div; - - /* - * Check arguments - * Postpone checking puvY_WhitePt until it is actually needed - * otherwise converting between XYZ and uvY will fail. - */ - if (pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEuvY form - */ - for (i = 0; i < nColors; i++, pColor++) { - - /* Make sure original format is CIEXYZ */ - if (!_XcmsCIEXYZ_ValidSpec(pColor)) { - return(XcmsFailure); - } - - /* Convert to CIEuvY */ - div = pColor->spec.CIEXYZ.X + (15.0 * pColor->spec.CIEXYZ.Y) + - (3.0 * pColor->spec.CIEXYZ.Z); - if (div == 0.0) { - /* Use white point since div == 0.0 */ - if (puvY_WhitePt == NULL ) { - return(XcmsFailure); - } - /* - * Make sure white point is in CIEuvY form - */ - if (puvY_WhitePt->format != XcmsCIEuvYFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)puvY_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, - XcmsCIEuvYFormat)) { - return(XcmsFailure); - } - puvY_WhitePt = &whitePt; - } - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (puvY_WhitePt->spec.CIEuvY.Y != 1.0) { - return(XcmsFailure); - } - uvY_return.Y = pColor->spec.CIEXYZ.Y; - uvY_return.u_prime = puvY_WhitePt->spec.CIEuvY.u_prime; - uvY_return.v_prime = puvY_WhitePt->spec.CIEuvY.v_prime; - } else { - uvY_return.u_prime = 4.0 * pColor->spec.CIEXYZ.X / div; - uvY_return.v_prime = 9.0 * pColor->spec.CIEXYZ.Y / div; - uvY_return.Y = pColor->spec.CIEXYZ.Y; - } - - memcpy((char *)&pColor->spec.CIEuvY, (char *)&uvY_return, sizeof(XcmsCIEuvY)); - /* Identify that format is now CIEuvY */ - pColor->format = XcmsCIEuvYFormat; - } - - return(XcmsSuccess); -} diff --git a/nx-X11/lib/X11/wcWrap.c b/nx-X11/lib/X11/wcWrap.c deleted file mode 100644 index cc3b33f7d..000000000 --- a/nx-X11/lib/X11/wcWrap.c +++ /dev/null @@ -1,161 +0,0 @@ -/* - -Copyright 1991, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - -*/ - -/* - * Copyright 1991 by the Open Software Foundation - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 - * 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 - * software for any purpose. It is provided "as is" without express or - * implied warranty. - * - * 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 - * 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 - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include "Xlibint.h" -#include "Xlcint.h" - -void -XwcDrawText( - Display *dpy, - Drawable d, - GC gc, - int x, - int y, - XwcTextItem *text_items, - int nitems) -{ - register XFontSet fs = NULL; - register XwcTextItem *p = text_items; - register int i = nitems; - register int esc; - - /* ignore leading items with no fontset */ - while (i && !p->font_set) { - i--; - p++; - } - - for (; --i >= 0; p++) { - if (p->font_set) - fs = p->font_set; - x += p->delta; - esc = (*fs->methods->wc_draw_string) (dpy, d, fs, gc, x, y, - p->chars, p->nchars); - if (!esc) - esc = fs->methods->wc_escapement (fs, p->chars, p->nchars); - x += esc; - } -} - -void -XwcDrawString( - Display *dpy, - Drawable d, - XFontSet font_set, - GC gc, - int x, - int y, - _Xconst wchar_t *text, - int text_len) -{ - (void)(*font_set->methods->wc_draw_string) (dpy, d, font_set, gc, x, y, - text, text_len); -} - -void -XwcDrawImageString( - Display *dpy, - Drawable d, - XFontSet font_set, - GC gc, - int x, - int y, - _Xconst wchar_t *text, - int text_len) -{ - (*font_set->methods->wc_draw_image_string) (dpy, d, font_set, gc, x, y, - text, text_len); -} - -int -XwcTextEscapement( - XFontSet font_set, - _Xconst wchar_t *text, - int text_len) -{ - return (*font_set->methods->wc_escapement) (font_set, text, text_len); -} - -int -XwcTextExtents( - XFontSet font_set, - _Xconst wchar_t *text, - int text_len, - XRectangle *overall_ink_extents, - XRectangle *overall_logical_extents) -{ - return (*font_set->methods->wc_extents) (font_set, text, text_len, - overall_ink_extents, - overall_logical_extents); -} - -Status -XwcTextPerCharExtents( - XFontSet font_set, - _Xconst wchar_t *text, - int text_len, - XRectangle *ink_extents_buffer, - XRectangle *logical_extents_buffer, - int buffer_size, - int *num_chars, - XRectangle *max_ink_extents, - XRectangle *max_logical_extents) -{ - 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); -} diff --git a/nx-X11/lib/X11/x11_trans.c b/nx-X11/lib/X11/x11_trans.c deleted file mode 100644 index 40df7b9b1..000000000 --- a/nx-X11/lib/X11/x11_trans.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#define X11_t 1 -#define TRANS_CLIENT 1 -#include - diff --git a/nx-X11/lib/X11/xim_trans.c b/nx-X11/lib/X11/xim_trans.c deleted file mode 100644 index 928038ae2..000000000 --- a/nx-X11/lib/X11/xim_trans.c +++ /dev/null @@ -1,30 +0,0 @@ -/* - * Copyright © 2003 Keith Packard - * - * Permission to use, copy, modify, distribute, and sell this software and its - * 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 Keith Packard not be used in - * advertising or publicity pertaining to distribution of the software without - * specific, written prior permission. Keith Packard makes no - * representations about the suitability of this software for any purpose. It - * is provided "as is" without express or implied warranty. - * - * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO - * EVENT SHALL KEITH PACKARD 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. - */ - -#ifdef HAVE_CONFIG_H -# include "config.h" -#endif - -#define XIM_t 1 -#define TRANS_CLIENT 1 - -#include diff --git a/nx-X11/lib/X11/xyY.c b/nx-X11/lib/X11/xyY.c deleted file mode 100644 index e85b8d249..000000000 --- a/nx-X11/lib/X11/xyY.c +++ /dev/null @@ -1,395 +0,0 @@ - -/* - * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. - * All Rights Reserved - * - * This file is a component of an X Window System-specific implementation - * of Xcms based on the TekColor Color Management System. Permission is - * hereby granted to use, copy, modify, sell, and otherwise distribute this - * software and its documentation for any purpose and without fee, provided - * that this copyright, permission, and disclaimer notice is reproduced in - * all copies of this software and in supporting documentation. TekColor - * is a trademark of Tektronix, Inc. - * - * Tektronix makes no representation about the suitability of this software - * for any purpose. It is provided "as is" and with all faults. - * - * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, - * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A - * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. - * - * NAME - * CIExyY.c - * - * DESCRIPTION - * This file contains routines that support the CIE xyY - * color space to include conversions to and from the CIE - * XYZ space. - * - * DOCUMENTATION - * "TekColor Color Management System, System Implementor's Manual" - */ - -#ifdef HAVE_CONFIG_H -#include -#endif -#include -#include -#include "Xlibint.h" -#include "Xcmsint.h" -#include "Cv.h" - -/* - * DEFINES - */ -#define EPS 0.00001 /* some extremely small number */ -#ifdef DBL_EPSILON -# define XMY_DBL_EPSILON DBL_EPSILON -#else -# define XMY_DBL_EPSILON 0.00001 -#endif - -/* - * FORWARD DECLARATIONS - */ - -static int CIExyY_ParseString(register char *spec, XcmsColor *pColor); -static Status XcmsCIExyY_ValidSpec(XcmsColor *pColor); - - -/* - * LOCAL VARIABLES - */ - - /* - * NULL terminated list of functions applied to get from CIExyY to CIEXYZ - */ -static XcmsConversionProc Fl_CIExyY_to_CIEXYZ[] = { - XcmsCIExyYToCIEXYZ, - NULL -}; - - /* - * NULL terminated list of functions applied to get from CIEXYZ to CIExyY - */ -static XcmsConversionProc Fl_CIEXYZ_to_CIExyY[] = { - XcmsCIEXYZToCIExyY, - NULL -}; - - -/* - * GLOBALS - */ - - /* - * CIE xyY Color Space - */ -XcmsColorSpace XcmsCIExyYColorSpace = - { - _XcmsCIExyY_prefix, /* prefix */ - XcmsCIExyYFormat, /* id */ - CIExyY_ParseString, /* parseString */ - Fl_CIExyY_to_CIEXYZ, /* to_CIEXYZ */ - Fl_CIEXYZ_to_CIExyY, /* from_CIEXYZ */ - 1 - }; - - - -/************************************************************************ - * * - * PRIVATE ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * CIExyY_ParseString - * - * SYNOPSIS - */ -static int -CIExyY_ParseString( - register char *spec, - XcmsColor *pColor) -/* - * DESCRIPTION - * This routines takes a string and attempts to convert - * it into a XcmsColor structure with XcmsCIExyYFormat. - * The assumed CIExyY string syntax is: - * CIExyY:// - * Where x, y, and Y are in string input format for floats - * consisting of: - * a. an optional sign - * b. a string of numbers possibly containing a decimal point, - * c. an optional exponent field containing an 'E' or 'e' - * followed by a possibly signed integer string. - * - * RETURNS - * 0 if failed, non-zero otherwise. - */ -{ - int n; - char *pchar; - - if ((pchar = strchr(spec, ':')) == NULL) { - return(XcmsFailure); - } - n = (int)(pchar - spec); - - /* - * Check for proper prefix. - */ - if (strncmp(spec, _XcmsCIExyY_prefix, n) != 0) { - return(XcmsFailure); - } - - /* - * Attempt to parse the value portion. - */ - if (sscanf(spec + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIExyY.x, - &pColor->spec.CIExyY.y, - &pColor->spec.CIExyY.Y) != 3) { - char *s; /* Maybe failed due to locale */ - int f; - if ((s = strdup(spec))) { - for (f = 0; s[f]; ++f) - if (s[f] == '.') - s[f] = ','; - else if (s[f] == ',') - s[f] = '.'; - if (sscanf(s + n + 1, "%lf/%lf/%lf", - &pColor->spec.CIExyY.x, - &pColor->spec.CIExyY.y, - &pColor->spec.CIExyY.Y) != 3) { - free(s); - return(XcmsFailure); - } - free(s); - } else - return(XcmsFailure); - } - pColor->format = XcmsCIExyYFormat; - pColor->pixel = 0; - return(XcmsCIExyY_ValidSpec(pColor)); -} - - - -/************************************************************************ - * * - * PUBLIC ROUTINES * - * * - ************************************************************************/ - -/* - * NAME - * CIExyY_ValidSpec() - * - * SYNOPSIS - */ -static Status -XcmsCIExyY_ValidSpec( - XcmsColor *pColor) -/* - * DESCRIPTION - * Checks a valid CIExyY color specification. - * - * RETURNS - * XcmsFailure if invalid. - * XcmsSuccess if valid. - * - */ -{ - if (pColor->format != XcmsCIExyYFormat - || - (pColor->spec.CIExyY.x < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIExyY.x > 1.0 + XMY_DBL_EPSILON) - || - (pColor->spec.CIExyY.y < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIExyY.y > 1.0 + XMY_DBL_EPSILON) - || - (pColor->spec.CIExyY.Y < 0.0 - XMY_DBL_EPSILON) - || - (pColor->spec.CIExyY.Y > 1.0 + XMY_DBL_EPSILON)) { - return(XcmsFailure); - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIExyYToCIEXYZ - convert CIExyY to CIEXYZ - * - * SYNOPSIS - */ -Status -XcmsCIExyYToCIEXYZ( - XcmsCCC ccc, - XcmsColor *pxyY_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIExyY format to CIEXYZ format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - */ -{ - XcmsColor *pColor = pColors_in_out; - XcmsColor whitePt; - XcmsCIEXYZ XYZ_return; - XcmsFloat div; /* temporary storage in case divisor is zero */ - XcmsFloat u, v, x, y, z; /* temporary storage */ - unsigned int i; - - /* - * Check arguments - */ - if (pxyY_WhitePt == NULL || pColors_in_out == NULL) { - return(XcmsFailure); - } - - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - /* Make sure original format is CIExyY and valid */ - if (!XcmsCIExyY_ValidSpec(pColor)) { - return(XcmsFailure); - } - - if ((div = (-2 * pColor->spec.CIExyY.x) + (12 * pColor->spec.CIExyY.y) + 3) == 0.0) { - /* Note that the divisor is zero */ - /* This return is abitrary. */ - XYZ_return.X = 0; - XYZ_return.Y = 0; - XYZ_return.Z = 0; - } else { - /* - * Make sure white point is in CIEXYZ form - */ - if (pxyY_WhitePt->format != XcmsCIEXYZFormat) { - /* Make copy of the white point because we're going to modify it */ - memcpy((char *)&whitePt, (char *)pxyY_WhitePt, sizeof(XcmsColor)); - if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, - XcmsCIEXYZFormat)) { - return(XcmsFailure); - } - pxyY_WhitePt = &whitePt; - } - - /* Make sure it is a white point, i.e., Y == 1.0 */ - if (pxyY_WhitePt->spec.CIEXYZ.Y != 1.0) { - return(XcmsFailure); - } - - /* Convert from xyY to uvY to XYZ */ - u = (4 * pColor->spec.CIExyY.x) / div; - v = (9 * pColor->spec.CIExyY.y) / div; - div = (6.0 * u) - (16.0 * v) + 12.0; - if (div == 0.0) { - /* Note that the divisor is zero */ - /* This return is abitrary. */ - if ((div = (6.0 * whitePt.spec.CIEuvY.u_prime) - - (16.0 * whitePt.spec.CIEuvY.v_prime) + 12.0) == 0.0) { - div = EPS; - } - x = 9.0 * whitePt.spec.CIEuvY.u_prime / div; - y = 4.0 * whitePt.spec.CIEuvY.u_prime / div; - } else { - /* convert u, v to small xyz */ - x = 9.0 * u / div; - y = 4.0 * v / div; - } - z = 1.0 - x - y; - if (y == 0.0) y = EPS; /* Have to worry about divide by 0 */ - XYZ_return.Y = pColor->spec.CIExyY.Y; - XYZ_return.X = x * XYZ_return.Y / y; - XYZ_return.Z = z * XYZ_return.Y / y; - } - - /* Copy result to pColor */ - memcpy ((char *)&pColor->spec, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); - - /* Identify that the format is now CIEXYZ */ - pColor->format = XcmsCIEXYZFormat; - } - return(XcmsSuccess); -} - - -/* - * NAME - * XcmsCIEXYZToCIExyY - convert CIEXYZ to CIExyY - * - * SYNOPSIS - */ -/* ARGSUSED */ -Status -XcmsCIEXYZToCIExyY( - XcmsCCC ccc, - XcmsColor *pxyY_WhitePt, - XcmsColor *pColors_in_out, - unsigned int nColors) -/* - * DESCRIPTION - * Converts color specifications in an array of XcmsColor - * structures from CIEXYZ format to CIExyY format. - * - * RETURNS - * XcmsFailure if failed, - * XcmsSuccess if succeeded. - * - */ -{ - XcmsColor *pColor = pColors_in_out; - XcmsCIExyY xyY_return; - XcmsFloat div; /* temporary storage in case divisor is zero */ - unsigned int i; - - /* - * Check arguments - * pxyY_WhitePt ignored - */ - if (pColors_in_out == NULL) { - return(XcmsFailure); - } - - /* - * Now convert each XcmsColor structure to CIEXYZ form - */ - for (i = 0; i < nColors; i++, pColor++) { - - if (!_XcmsCIEXYZ_ValidSpec(pColor)) { - return(XcmsFailure); - } - /* Now convert for XYZ to xyY */ - if ((div = pColor->spec.CIEXYZ.X + pColor->spec.CIEXYZ.Y + pColor->spec.CIEXYZ.Z) == 0.0) { - div = EPS; - } - xyY_return.x = pColor->spec.CIEXYZ.X / div; - xyY_return.y = pColor->spec.CIEXYZ.Y / div; - xyY_return.Y = pColor->spec.CIEXYZ.Y; - - /* Copy result to pColor */ - memcpy ((char *)&pColor->spec, (char *)&xyY_return, sizeof(XcmsCIExyY)); - - /* Identify that the format is now CIEXYZ */ - pColor->format = XcmsCIExyYFormat; - } - return(XcmsSuccess); -} diff --git a/nx-X11/lib/configure.ac b/nx-X11/lib/configure.ac new file mode 100644 index 000000000..1eebf329f --- /dev/null +++ b/nx-X11/lib/configure.ac @@ -0,0 +1,309 @@ +# Initialize Autoconf +AC_PREREQ([2.60]) +AC_INIT([libNX_X11], [1.6.5], + [https://github.com/ArcticaProject/nx-libs/issues], [libNX_X11]) +AC_CONFIG_AUX_DIR([build-aux]) +AC_CONFIG_SRCDIR([Makefile.am]) +AC_CONFIG_HEADERS([src/config.h include/X11/XlibConf.h]) +AC_CONFIG_MACRO_DIR([m4]) + +AC_CANONICAL_BUILD +AC_CANONICAL_HOST + +# Set common system defines for POSIX extensions, such as _GNU_SOURCE +# Must be called before any macros that run the compiler (like AC_PROG_LIBTOOL) +# to avoid autoconf errors. +AC_USE_SYSTEM_EXTENSIONS + +# Initialize Automake +AM_INIT_AUTOMAKE([foreign dist-bzip2]) + +# Initialize libtool +AC_PROG_LIBTOOL + +# Upstream's pkg.m4 (since 0.27) offers this now, but define our own +# compatible version in case the local version of pkgconfig isn't new enough. +# https://bugs.freedesktop.org/show_bug.cgi?id=48743 +m4_ifdef([PKG_INSTALLDIR], [PKG_INSTALLDIR], + [AC_ARG_WITH([pkgconfigdir], + [AS_HELP_STRING([--with-pkgconfigdir], + [install directory for nx-x11.pc pkg-config file])], + [],[with_pkgconfigdir='$(libdir)/pkgconfig']) + AC_SUBST([pkgconfigdir], [${with_pkgconfigdir}])]) + +NX_COMPILER_BRAND +NX_DEFAULT_OPTIONS + +# Required when PKG_CHECK_MODULES called within an if statement +PKG_PROG_PKG_CONFIG + +# Checks for pkg-config packages + +X11_REQUIRES='nx-xproto nx-xextproto nx-xtrans' +X11_EXTRA_DEPS="" + +AC_SUBST(X11_EXTRA_DEPS) + +# Issue an error if nx-xtrans.m4 was not found and NX_XTRANS_CONNECTION_FLAGS macro +# was not expanded, since libNX_X11 with no transport types is rather useless. +m4_pattern_forbid([^NX_XTRANS_CONNECTION_FLAGS$]) + +# Transport selection macro from nx-xtrans.m4 +NX_XTRANS_CONNECTION_FLAGS + +# Checks for header files. +AC_CHECK_HEADERS([sys/select.h]) + +# Checks for typedefs, structures, and compiler characteristics. + +# Checks for library functions. +AC_CHECK_FUNCS([strtol seteuid]) + +# Used in lcFile.c (see also --enable-xlocaledir settings below) +XLOCALEDIR_IS_SAFE="no" + +AC_CHECK_DECL([issetugid]) +AC_CHECK_FUNC([issetugid]) +if test "$ac_cv_have_decl_issetugid" = yes && test "$ac_cv_func_issetugid" = yes; then + XLOCALEDIR_IS_SAFE="yes" + AC_DEFINE(HASSETUGID,1,[Has issetugid() function]) +fi +AC_CHECK_FUNC([getresuid], [XLOCALEDIR_IS_SAFE="yes"] + AC_DEFINE(HASGETRESUID,1,[Has getresuid() & getresgid() functions])) +# Used in Font.c +AC_CHECK_FUNC([shmat], AC_DEFINE(HAS_SHM,1,[Has shm*() functions])) + +# Checks for system services +# AC_PATH_XTRA + +# Threading support... + +AC_ARG_ENABLE(xthreads, + AS_HELP_STRING([--disable-xthreads], + [Disable Xlib support for Multithreading]), + [xthreads=$enableval],[xthreads=yes]) + +AC_CHECK_LIB(c, getpwuid_r, [mtsafeapi="yes"], [mtsafeapi="no"]) + +case x$xthreads in +xyes) + AC_DEFINE(XTHREADS,1,[Whether libNX_X11 is compiled with thread support]) + if test x$mtsafeapi = xyes + then + AC_DEFINE(XUSE_MTSAFE_API,1,[Whether libNX_X11 needs to use MT safe API's]) + fi + ;; +*) + ;; +esac + +AC_CHECK_LIB(c, pthread_self, [thrstubs="no"], [thrstubs="yes"]) +AM_CONDITIONAL(THRSTUBS, test x$thrstubs = xyes) + +# XXX incomplete, please fill this in +if test x$xthreads = xyes ; then + case $host_os in + linux*|gnu*|k*bsd*-gnu) + XTHREADLIB=-lpthread ;; + netbsd*) + XTHREAD_CFLAGS="-D_POSIX_THREAD_SAFE_FUNCTIONS" + XTHREADLIB="-lpthread" ;; + freebsd*) + XTHREAD_CFLAGS="-D_THREAD_SAFE" + XTHREADLIB="-pthread" ;; + dragonfly*|openbsd*) + XTHREADLIB="-pthread" ;; + solaris*) + XTHREAD_CFLAGS="-D_REENTRANT -D_POSIX_PTHREAD_SEMANTICS" ;; + esac +fi +AC_SUBST(XTHREADLIB) +AC_SUBST(XTHREAD_CFLAGS) + +AC_CHECK_FUNC(poll, [has_poll="yes"], [has_poll="no"]) + +AC_ARG_ENABLE([poll], + AS_HELP_STRING([--disable-poll], + [Disable poll() usage in XlibInt]), + AS_IF([test "x$enable_poll" = "xno"], + [want_poll="no"], [want_poll="yes"]), + [want_poll="yes"]) + +if test x"$has_poll" = "xyes" && test x"$want_poll" = "xyes"; then + use_poll="yes" + AC_DEFINE(USE_POLL,1,[Enable using the poll() function in XlibInt]) +else + use_poll="no" +fi + +# +# Find keysymdef.h +# +AC_MSG_CHECKING([keysym definitions]) +AC_ARG_WITH([keysymdefdir], + [AC_HELP_STRING([--with-keysymdefdir=DIR], [The location of keysymdef.h (defaults to xproto include dir)])], + [KEYSYMDEFDIR=$withval], + [KEYSYMDEFDIR=`pwd`/../include]) + +if test ! -d "$KEYSYMDEFDIR"; then + AC_MSG_ERROR([$KEYSYMDEFDIR doesn't exist or isn't a directory]) +fi + +FILES="keysymdef.h XF86keysym.h Sunkeysym.h DECkeysym.h HPkeysym.h" +for i in $FILES; do + if test -f "$KEYSYMDEFDIR/$i"; then + KEYSYMDEFS="$KEYSYMDEFS $KEYSYMDEFDIR/$i" + elif test "x$i" = "xkeysymdef.h"; then + AC_MSG_ERROR([Cannot find keysymdef.h]) + fi +done +AC_MSG_RESULT([$KEYSYMDEFS]) +AC_SUBST(KEYSYMDEFS) + +AC_ARG_ENABLE(xcms, + AS_HELP_STRING([--disable-xcms], + [Disable Xlib support for CMS *EXPERIMENTAL*]), + [XCMS=$enableval],[XCMS=yes]) +AM_CONDITIONAL(XCMS, [test x$XCMS = xyes ]) +if test x"$XCMS" = "xyes"; then + AC_DEFINE(XCMS,1,[Include support for XCMS]) +fi + +AC_ARG_ENABLE(xlocale, + AS_HELP_STRING([--disable-xlocale], + [Disable Xlib locale implementation *EXPERIMENTAL*]), + [XLOCALE=$enableval],[XLOCALE=yes]) + +AM_CONDITIONAL(XLOCALE, [ test x$XLOCALE = xyes ]) +if test x"$XLOCALE" = "xyes"; then + AC_DEFINE(XLOCALE,1,[support for X Locales]) +fi + + +# This disables XLOCALEDIR. Set it if you're using BuildLoadableXlibI18n, +# don't have either issetugid() or getresuid(), and you need to protect +# clients that are setgid or setuid to an id other than 0. +AC_MSG_CHECKING([if XLOCALEDIR support should be enabled]) +AC_ARG_ENABLE(xlocaledir, + AS_HELP_STRING([--enable-xlocaledir], + [Enable XLOCALEDIR environment variable support]), + [ENABLE_XLOCALEDIR=$enableval],[ENABLE_XLOCALEDIR=$XLOCALEDIR_IS_SAFE]) +if test "x$ENABLE_XLOCALEDIR" = "xno"; then + AC_DEFINE(NO_XLOCALEDIR,1,[Disable XLOCALEDIR environment variable]) +fi +AC_MSG_RESULT($ENABLE_XLOCALEDIR) + +AC_ARG_ENABLE(xf86bigfont, + AS_HELP_STRING([--disable-xf86bigfont], + [Disable XF86BigFont extension support]), + [XF86BIGFONT=$enableval],[XF86BIGFONT="yes"]) +if test "x$XF86BIGFONT" = "xyes"; then +# FIXME: Skip check for proto headers for now... Requires .pc files for all the proto +# header packages we have. Keeping that in mind for later... +# PKG_CHECK_MODULES(BIGFONT, [xf86bigfontproto >= 1.2.0], + AC_DEFINE(XF86BIGFONT,1,[Enable XF86BIGFONT extension]) +# ,XF86BIGFONT="no") +fi + +AC_ARG_ENABLE(xkb, + AS_HELP_STRING([--disable-xkb], + [Disable XKB support *EXPERIMENTAL*]), + [XKB=$enableval],[XKB=yes]) + +AM_CONDITIONAL(XKB, [ test x$XKB = xyes ]) +if test x"$XKB" = "xyes"; then + XKBPROTO_REQUIRES="kbproto" + X11_REQUIRES="${X11_REQUIRES} kbproto inputproto" + AC_DEFINE(XKB,1,[Use XKB]) +else + XKBPROTO_REQUIRES="" +fi +AC_SUBST(XKBPROTO_REQUIRES) + +AC_FUNC_MMAP() +composecache_default=$ac_cv_func_mmap_fixed_mapped +AC_CHECK_FUNC(nl_langinfo, , [composecache_default=no]) +AC_ARG_ENABLE(composecache, + AS_HELP_STRING([--disable-composecache], + [Disable compose table cache support]), + [COMPOSECACHE=$enableval],[COMPOSECACHE=$composecache_default]) +if test x"$COMPOSECACHE" = "xyes"; then + AC_DEFINE(COMPOSECACHE,1,[Include compose table cache support]) +fi + +X11_DATADIR="${datadir}/nx/X11" +AX_DEFINE_DIR(X11_DATADIR, X11_DATADIR, [Location of libNX_X11 data]) +AC_SUBST(X11_DATADIR) + +X11_LIBDIR="${libdir}" +AX_DEFINE_DIR(X11_LIBDIR, X11_LIBDIR, [Location of libNX_X11 library data]) +AC_SUBST(X11_LIBDIR) + +# FIXME: Skip check for proto headers for now... Requires .pc files for all the proto +# header packages we have. Keeping that in mind for later... +#PKG_CHECK_MODULES(X11, [$X11_REQUIRES]) +X11_CFLAGS="$X11_CFLAGS $XTHREAD_CFLAGS $BASE_CFLAGS" + +# +# Yes, it would be nice to put the locale data in +# /usr/share, but the locale stuff includes loadable +# libraries which must be located in the same directory +# as the other locale data, so for now, everything lives +# in ${libdir} +# + +AC_ARG_WITH(locale-lib-dir, AS_HELP_STRING([--with-locale-lib-dir=DIR], + [Directory where locale libraries files are installed (default: $libdir/X11/locale)]), + [ X11_LOCALELIBDIR="$withval" ], + [ X11_LOCALELIBDIR="${X11_LIBDIR}/locale" ]) +AX_DEFINE_DIR(XLOCALELIBDIR, X11_LOCALELIBDIR, [Location of libNX_X11 locale libraries]) +AC_SUBST(X11_LOCALELIBDIR) + +AC_ARG_WITH(locale-data-dir, AS_HELP_STRING([--with-locale-data-dir=DIR], + [Directory where locale data files are installed (default: /usr/share/X11/locale)]), + [ X11_LOCALEDATADIR="$withval" ], + [ X11_LOCALEDATADIR="/usr/share/X11/locale" ]) +AX_DEFINE_DIR(XLOCALEDATADIR, X11_LOCALEDATADIR, [Location of libNX_X11 locale data files]) +AC_SUBST(X11_LOCALEDATADIR) + +X11_LOCALEDIR="${X11_LOCALEDATADIR}" +AX_DEFINE_DIR(XLOCALEDIR, X11_LOCALEDIR, [Location of libNX_X11 locale data]) +AC_SUBST(X11_LOCALEDIR) + +XERRORDB="${X11_DATADIR}/XErrorDB" +AX_DEFINE_DIR(XERRORDB, XERRORDB, [Location of error message database]) + +NX_CHECK_MALLOC_ZERO + +AC_CONFIG_FILES([include/Makefile + modules/im/ximcp/Makefile + modules/im/Makefile + modules/lc/gen/Makefile + modules/lc/def/Makefile + modules/lc/Utf8/Makefile + modules/lc/Makefile + modules/om/generic/Makefile + modules/om/Makefile + modules/Makefile + src/util/Makefile + src/xcms/Makefile + src/xkb/Makefile + src/xlibi18n/Makefile + src/Makefile + Makefile + nx-x11.pc]) +AC_OUTPUT + +echo "" +echo "NX_X11 will be built with the following settings:" +echo " Threading support: "$xthreads +echo " Use Threads safe API: "$mtsafeapi +echo " Threads stubs in libNX_X11: "$thrstubs +echo " USE_POLL: "$use_poll +echo " XCMS: "$XCMS +echo " Internationalization support: "$XLOCALE +echo " XF86BigFont support: "$XF86BIGFONT +echo " XKB support: "$XKB +echo " XLOCALEDIR environment variable support: "$ENABLE_XLOCALEDIR +echo " Compose table cache enabled: "$COMPOSECACHE +echo "" diff --git a/nx-X11/lib/include/Makefile.am b/nx-X11/lib/include/Makefile.am new file mode 100644 index 000000000..9272e3cf5 --- /dev/null +++ b/nx-X11/lib/include/Makefile.am @@ -0,0 +1,32 @@ +NULL = + +x11includedir=${includedir}/nx-X11 +x11include_HEADERS= \ + X11/XKBlib.h \ + X11/Xcms.h \ + X11/Xlib.h \ + X11/Xlibint.h \ + X11/Xlocale.h \ + X11/Xresource.h \ + X11/Xutil.h \ + X11/cursorfont.h \ + X11/Xregion.h \ + X11/ImUtil.h \ + $(NULL) + +nodist_x11include_HEADERS=\ + X11/XlibConf.h + +xtransincludedir=${includedir}/nx-X11/Xtrans +xtransinclude_HEADERS = \ + xtrans/Xtransint.h \ + xtrans/Xtrans.h \ + xtrans/Xtranslcl.c \ + xtrans/transport.c \ + xtrans/Xtrans.c \ + xtrans/Xtranssock.c \ + xtrans/Xtransutil.c \ + $(NULL) + +EXTRA_DIST = \ + X11/XlibConf.h.in diff --git a/nx-X11/lib/include/X11/.gitignore b/nx-X11/lib/include/X11/.gitignore new file mode 100644 index 000000000..be3bc6cfb --- /dev/null +++ b/nx-X11/lib/include/X11/.gitignore @@ -0,0 +1 @@ +XlibConf.h diff --git a/nx-X11/lib/include/X11/ImUtil.h b/nx-X11/lib/include/X11/ImUtil.h new file mode 100644 index 000000000..a8b95eead --- /dev/null +++ b/nx-X11/lib/include/X11/ImUtil.h @@ -0,0 +1,31 @@ + +#if !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) +#define _X11_IMUTIL_H_ +#define _IMUTIL_H_ + +extern int +_XGetScanlinePad( + Display *dpy, + int depth); + +extern int +_XGetBitsPerPixel( + Display *dpy, + int depth); + +extern int +_XSetImage( + XImage *srcimg, + register XImage *dstimg, + register int x, + register int y); + +extern int +_XReverse_Bytes( + register unsigned char *bpt, + register int nb); +extern void +_XInitImageFuncPtrs( + register XImage *image); + +#endif /* !defined(_X11_IMUTIL_H_) && !defined(_IM_UTIL_H_) */ diff --git a/nx-X11/lib/include/X11/XKBlib.h b/nx-X11/lib/include/X11/XKBlib.h new file mode 100644 index 000000000..dd2841e9a --- /dev/null +++ b/nx-X11/lib/include/X11/XKBlib.h @@ -0,0 +1,1150 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#if !defined(_X11_XKBLIB_H_) && !defined(_XKBLIB_H_) +#define _X11_XKBLIB_H_ +#define _XKBLIB_H_ + +#include +#include + +typedef struct _XkbAnyEvent { + int type; /* XkbAnyEvent */ + unsigned long serial; /* # of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XKB event minor code */ + unsigned int device; /* device ID */ +} XkbAnyEvent; + +typedef struct _XkbNewKeyboardNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbNewKeyboardNotify */ + int device; /* device ID */ + int old_device; /* device ID of previous keyboard */ + int min_key_code; /* minimum key code */ + int max_key_code; /* maximum key code */ + int old_min_key_code;/* min key code of previous kbd */ + int old_max_key_code;/* max key code of previous kbd */ + unsigned int changed; /* changed aspects of the keyboard */ + char req_major; /* major and minor opcode of req */ + char req_minor; /* that caused change, if applicable */ +} XkbNewKeyboardNotifyEvent; + +typedef struct _XkbMapNotifyEvent { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbMapNotify */ + int device; /* device ID */ + unsigned int changed; /* fields which have been changed */ + unsigned int flags; /* reserved */ + int first_type; /* first changed key type */ + int num_types; /* number of changed key types */ + KeyCode min_key_code; + KeyCode max_key_code; + KeyCode first_key_sym; + KeyCode first_key_act; + KeyCode first_key_behavior; + KeyCode first_key_explicit; + KeyCode first_modmap_key; + KeyCode first_vmodmap_key; + int num_key_syms; + int num_key_acts; + int num_key_behaviors; + int num_key_explicit; + int num_modmap_keys; + int num_vmodmap_keys; + unsigned int vmods; /* mask of changed virtual mods */ +} XkbMapNotifyEvent; + +typedef struct _XkbStateNotifyEvent { + int type; /* XkbAnyEvent */ + unsigned long serial; /* # of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbStateNotify */ + int device; /* device ID */ + unsigned int changed; /* mask of changed state components */ + int group; /* keyboard group */ + int base_group; /* base keyboard group */ + int latched_group; /* latched keyboard group */ + int locked_group; /* locked keyboard group */ + unsigned int mods; /* modifier state */ + unsigned int base_mods; /* base modifier state */ + unsigned int latched_mods; /* latched modifiers */ + unsigned int locked_mods; /* locked modifiers */ + int compat_state; /* compatibility state */ + unsigned char grab_mods; /* mods used for grabs */ + unsigned char compat_grab_mods;/* grab mods for non-XKB clients */ + unsigned char lookup_mods; /* mods sent to clients */ + unsigned char compat_lookup_mods; /* mods sent to non-XKB clients */ + int ptr_buttons; /* pointer button state */ + KeyCode keycode; /* keycode that caused the change */ + char event_type; /* KeyPress or KeyRelease */ + char req_major; /* Major opcode of request */ + char req_minor; /* Minor opcode of request */ +} XkbStateNotifyEvent; + +typedef struct _XkbControlsNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbControlsNotify */ + int device; /* device ID */ + unsigned int changed_ctrls; /* controls with changed sub-values */ + unsigned int enabled_ctrls; /* controls currently enabled */ + unsigned int enabled_ctrl_changes;/* controls just {en,dis}abled */ + int num_groups; /* total groups on keyboard */ + KeyCode keycode; /* key that caused change or 0 */ + char event_type; /* type of event that caused change */ + char req_major; /* if keycode==0, major and minor */ + char req_minor; /* opcode of req that caused change */ +} XkbControlsNotifyEvent; + +typedef struct _XkbIndicatorNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbIndicatorNotify */ + int device; /* device ID */ + unsigned int changed; /* indicators with new state or map */ + unsigned int state; /* current state of all indicators */ +} XkbIndicatorNotifyEvent; + +typedef struct _XkbNamesNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbNamesNotify */ + int device; /* device ID */ + unsigned int changed; /* names that have changed */ + int first_type; /* first key type with new name */ + int num_types; /* number of key types with new names */ + int first_lvl; /* first key type new new level names */ + int num_lvls; /* # of key types w/new level names */ + int num_aliases; /* total number of key aliases*/ + int num_radio_groups;/* total number of radio groups */ + unsigned int changed_vmods; /* virtual modifiers with new names */ + unsigned int changed_groups; /* groups with new names */ + unsigned int changed_indicators;/* indicators with new names */ + int first_key; /* first key with new name */ + int num_keys; /* number of keys with new names */ +} XkbNamesNotifyEvent; + +typedef struct _XkbCompatMapNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbCompatMapNotify */ + int device; /* device ID */ + unsigned int changed_groups; /* groups with new compat maps */ + int first_si; /* first new symbol interp */ + int num_si; /* number of new symbol interps */ + int num_total_si; /* total # of symbol interps */ +} XkbCompatMapNotifyEvent; + +typedef struct _XkbBellNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbBellNotify */ + int device; /* device ID */ + int percent; /* requested volume as a % of maximum */ + int pitch; /* requested pitch in Hz */ + int duration; /* requested duration in useconds */ + int bell_class; /* (input extension) feedback class */ + int bell_id; /* (input extension) ID of feedback */ + Atom name; /* "name" of requested bell */ + Window window; /* window associated with event */ + Bool event_only; /* "event only" requested */ +} XkbBellNotifyEvent; + +typedef struct _XkbActionMessage { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbActionMessage */ + int device; /* device ID */ + KeyCode keycode; /* key that generated the event */ + Bool press; /* true if act caused by key press */ + Bool key_event_follows;/* true if key event also generated */ + int group; /* effective group */ + unsigned int mods; /* effective mods */ + char message[XkbActionMessageLength+1]; + /* message -- leave space for NUL */ +} XkbActionMessageEvent; + +typedef struct _XkbAccessXNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbAccessXNotify */ + int device; /* device ID */ + int detail; /* XkbAXN_* */ + int keycode; /* key of event */ + int sk_delay; /* current slow keys delay */ + int debounce_delay; /* current debounce delay */ +} XkbAccessXNotifyEvent; + +typedef struct _XkbExtensionDeviceNotify { + int type; /* XkbAnyEvent */ + unsigned long serial; /* of last req processed by server */ + Bool send_event; /* is this from a SendEvent request? */ + Display * display; /* Display the event was read from */ + Time time; /* milliseconds */ + int xkb_type; /* XkbExtensionDeviceNotify */ + int device; /* device ID */ + unsigned int reason; /* reason for the event */ + unsigned int supported; /* mask of supported features */ + unsigned int unsupported; /* mask of unsupported features */ + /* that some app tried to use */ + int first_btn; /* first button that changed */ + int num_btns; /* range of buttons changed */ + unsigned int leds_defined; /* indicators with names or maps */ + unsigned int led_state; /* current state of the indicators */ + int led_class; /* feedback class for led changes */ + int led_id; /* feedback id for led changes */ +} XkbExtensionDeviceNotifyEvent; + +typedef union _XkbEvent { + int type; + XkbAnyEvent any; + XkbNewKeyboardNotifyEvent new_kbd; + XkbMapNotifyEvent map; + XkbStateNotifyEvent state; + XkbControlsNotifyEvent ctrls; + XkbIndicatorNotifyEvent indicators; + XkbNamesNotifyEvent names; + XkbCompatMapNotifyEvent compat; + XkbBellNotifyEvent bell; + XkbActionMessageEvent message; + XkbAccessXNotifyEvent accessx; + XkbExtensionDeviceNotifyEvent device; + XEvent core; +} XkbEvent; + +typedef struct _XkbKbdDpyState XkbKbdDpyStateRec,*XkbKbdDpyStatePtr; + + /* XkbOpenDisplay error codes */ +#define XkbOD_Success 0 +#define XkbOD_BadLibraryVersion 1 +#define XkbOD_ConnectionRefused 2 +#define XkbOD_NonXkbServer 3 +#define XkbOD_BadServerVersion 4 + + /* Values for XlibFlags */ +#define XkbLC_ForceLatin1Lookup (1<<0) +#define XkbLC_ConsumeLookupMods (1<<1) +#define XkbLC_AlwaysConsumeShiftAndLock (1<<2) +#define XkbLC_IgnoreNewKeyboards (1<<3) +#define XkbLC_ControlFallback (1<<4) +#define XkbLC_ConsumeKeysOnComposeFail (1<<29) +#define XkbLC_ComposeLED (1<<30) +#define XkbLC_BeepOnComposeFail (1<<31) + +#define XkbLC_AllComposeControls (0xc0000000) +#define XkbLC_AllControls (0xc000001f) + +_XFUNCPROTOBEGIN + +extern Bool XkbIgnoreExtension( + Bool /* ignore */ +); + +extern Display *XkbOpenDisplay( + char * /* name */, + int * /* ev_rtrn */, + int * /* err_rtrn */, + int * /* major_rtrn */, + int * /* minor_rtrn */, + int * /* reason */ +); + +extern Bool XkbQueryExtension( + Display * /* dpy */, + int * /* opcodeReturn */, + int * /* eventBaseReturn */, + int * /* errorBaseReturn */, + int * /* majorRtrn */, + int * /* minorRtrn */ +); + +extern Bool XkbUseExtension( + Display * /* dpy */, + int * /* major_rtrn */, + int * /* minor_rtrn */ +); + +extern Bool XkbLibraryVersion( + int * /* libMajorRtrn */, + int * /* libMinorRtrn */ +); + +extern unsigned int XkbSetXlibControls( + Display* /* dpy */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern unsigned int XkbGetXlibControls( + Display* /* dpy */ +); + +extern unsigned int XkbXlibControlsImplemented(void); + +typedef Atom (*XkbInternAtomFunc)( + Display * /* dpy */, + _Xconst char * /* name */, + Bool /* only_if_exists */ +); + +typedef char * (*XkbGetAtomNameFunc)( + Display * /* dpy */, + Atom /* atom */ +); + +extern void XkbSetAtomFuncs( + XkbInternAtomFunc /* getAtom */, + XkbGetAtomNameFunc /* getName */ +); + +extern KeySym XkbKeycodeToKeysym( + Display * /* dpy */, +#if NeedWidePrototypes + unsigned int /* kc */, +#else + KeyCode /* kc */, +#endif + int /* group */, + int /* level */ +); + +extern unsigned int XkbKeysymToModifiers( + Display * /* dpy */, + KeySym /* ks */ +); + +extern Bool XkbLookupKeySym( + Display * /* dpy */, + KeyCode /* keycode */, + unsigned int /* modifiers */, + unsigned int * /* modifiers_return */, + KeySym * /* keysym_return */ +); + +extern int XkbLookupKeyBinding( + Display * /* dpy */, + KeySym /* sym_rtrn */, + unsigned int /* mods */, + char * /* buffer */, + int /* nbytes */, + int * /* extra_rtrn */ +); + +extern Bool XkbTranslateKeyCode( + XkbDescPtr /* xkb */, + KeyCode /* keycode */, + unsigned int /* modifiers */, + unsigned int * /* modifiers_return */, + KeySym * /* keysym_return */ +); + +extern int XkbTranslateKeySym( + Display * /* dpy */, + register KeySym * /* sym_return */, + unsigned int /* modifiers */, + char * /* buffer */, + int /* nbytes */, + int * /* extra_rtrn */ +); + +extern Bool XkbSetAutoRepeatRate( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* delay */, + unsigned int /* interval */ +); + +extern Bool XkbGetAutoRepeatRate( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int * /* delayRtrn */, + unsigned int * /* intervalRtrn */ +); + +extern Bool XkbChangeEnabledControls( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbDeviceBell( + Display * /* dpy */, + Window /* win */, + int /* deviceSpec */, + int /* bellClass */, + int /* bellID */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbForceDeviceBell( + Display * /* dpy */, + int /* deviceSpec */, + int /* bellClass */, + int /* bellID */, + int /* percent */ +); + +extern Bool XkbDeviceBellEvent( + Display * /* dpy */, + Window /* win */, + int /* deviceSpec */, + int /* bellClass */, + int /* bellID */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbBell( + Display * /* dpy */, + Window /* win */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbForceBell( + Display * /* dpy */, + int /* percent */ +); + +extern Bool XkbBellEvent( + Display * /* dpy */, + Window /* win */, + int /* percent */, + Atom /* name */ +); + +extern Bool XkbSelectEvents( + Display * /* dpy */, + unsigned int /* deviceID */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbSelectEventDetails( + Display * /* dpy */, + unsigned int /* deviceID */, + unsigned int /* eventType */, + unsigned long /* affect */, + unsigned long /* details */ +); + +extern void XkbNoteMapChanges( + XkbMapChangesPtr /* old */, + XkbMapNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +extern void XkbNoteNameChanges( + XkbNameChangesPtr /* old */, + XkbNamesNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +extern Status XkbGetIndicatorState( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int * /* pStateRtrn */ +); + +extern Status XkbGetDeviceIndicatorState( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + unsigned int * /* pStateRtrn */ +); + +extern Status XkbGetIndicatorMap( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbSetIndicatorMap( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +#define XkbNoteIndicatorMapChanges(o,n,w) \ + ((o)->map_changes|=((n)->map_changes&(w))) +#define XkbNoteIndicatorStateChanges(o,n,w)\ + ((o)->state_changes|=((n)->state_changes&(w))) +#define XkbGetIndicatorMapChanges(d,x,c) \ + (XkbGetIndicatorMap((d),(c)->map_changes,x)) +#define XkbChangeIndicatorMaps(d,x,c) \ + (XkbSetIndicatorMap((d),(c)->map_changes,x)) + +extern Bool XkbGetNamedIndicator( + Display * /* dpy */, + Atom /* name */, + int * /* pNdxRtrn */, + Bool * /* pStateRtrn */, + XkbIndicatorMapPtr /* pMapRtrn */, + Bool * /* pRealRtrn */ +); + +extern Bool XkbGetNamedDeviceIndicator( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + Atom /* name */, + int * /* pNdxRtrn */, + Bool * /* pStateRtrn */, + XkbIndicatorMapPtr /* pMapRtrn */, + Bool * /* pRealRtrn */ +); + +extern Bool XkbSetNamedIndicator( + Display * /* dpy */, + Atom /* name */, + Bool /* changeState */, + Bool /* state */, + Bool /* createNewMap */, + XkbIndicatorMapPtr /* pMap */ +); + +extern Bool XkbSetNamedDeviceIndicator( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + Atom /* name */, + Bool /* changeState */, + Bool /* state */, + Bool /* createNewMap */, + XkbIndicatorMapPtr /* pMap */ +); + +extern Bool XkbLockModifiers( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbLatchModifiers( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affect */, + unsigned int /* values */ +); + +extern Bool XkbLockGroup( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* group */ +); + +extern Bool XkbLatchGroup( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* group */ +); + +extern Bool XkbSetServerInternalMods( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affectReal */, + unsigned int /* realValues */, + unsigned int /* affectVirtual */, + unsigned int /* virtualValues */ +); + +extern Bool XkbSetIgnoreLockMods( + Display * /* dpy */, + unsigned int /* deviceSpec */, + unsigned int /* affectReal */, + unsigned int /* realValues */, + unsigned int /* affectVirtual */, + unsigned int /* virtualValues */ +); + + +extern Bool XkbVirtualModsToReal( + XkbDescPtr /* xkb */, + unsigned int /* virtual_mask */, + unsigned int * /* mask_rtrn */ +); + +extern Bool XkbComputeEffectiveMap( + XkbDescPtr /* xkb */, + XkbKeyTypePtr /* type */, + unsigned char * /* map_rtrn */ +); + +extern Status XkbInitCanonicalKeyTypes( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* keypadVMod */ +); + +extern XkbDescPtr XkbAllocKeyboard( + void +); + +extern void XkbFreeKeyboard( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeDesc */ +); + +extern Status XkbAllocClientMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nTypes */ +); + +extern Status XkbAllocServerMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nActions */ +); + +extern void XkbFreeClientMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern void XkbFreeServerMap( + XkbDescPtr /* xkb */, + unsigned int /* what */, + Bool /* freeMap */ +); + +extern XkbKeyTypePtr XkbAddKeyType( + XkbDescPtr /* xkb */, + Atom /* name */, + int /* map_count */, + Bool /* want_preserve */, + int /* num_lvls */ +); + +extern Status XkbAllocIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern void XkbFreeIndicatorMaps( + XkbDescPtr /* xkb */ +); + +extern XkbDescPtr XkbGetMap( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */ +); + +extern Status XkbGetUpdatedMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetMapChanges( + Display * /* dpy */, + XkbDescPtr /* xkb */, + XkbMapChangesPtr /* changes */ +); + + +extern Status XkbRefreshKeyboardMapping( + XkbMapNotifyEvent * /* event */ +); + +extern Status XkbGetKeyTypes( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbGetKeySyms( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbGetKeyActions( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbGetKeyBehaviors( + Display * /* dpy */, + unsigned int /* firstKey */, + unsigned int /* nKeys */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetVirtualMods( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetKeyExplicitComponents( + Display * /* dpy */, + unsigned int /* firstKey */, + unsigned int /* nKeys */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetKeyModifierMap( + Display * /* dpy */, + unsigned int /* firstKey */, + unsigned int /* nKeys */, + XkbDescPtr /* desc */ +); + +extern Status XkbGetKeyVirtualModMap( + Display * /* dpy */, + unsigned int /* first */, + unsigned int /* num */, + XkbDescPtr /* xkb */ +); + +extern Status XkbAllocControls( + XkbDescPtr /* xkb */, + unsigned int /* which*/ +); + +extern void XkbFreeControls( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern Status XkbGetControls( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbSetControls( + Display * /* dpy */, + unsigned long /* which */, + XkbDescPtr /* desc */ +); + +extern void XkbNoteControlsChanges( + XkbControlsChangesPtr /* old */, + XkbControlsNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +#define XkbGetControlsChanges(d,x,c) XkbGetControls(d,(c)->changed_ctrls,x) +#define XkbChangeControls(d,x,c) XkbSetControls(d,(c)->changed_ctrls,x) + +extern Status XkbAllocCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + unsigned int /* nInterpret */ +); + +extern void XkbFreeCompatMap( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + +extern Status XkbGetCompatMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* xkb */ +); + +extern Bool XkbSetCompatMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* xkb */, + Bool /* updateActions */ +); + +extern XkbSymInterpretPtr XkbAddSymInterpret( + XkbDescPtr /* xkb */, + XkbSymInterpretPtr /* si */, + Bool /* updateMap */, + XkbChangesPtr /* changes */ +); + +extern Status XkbAllocNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + int /* nTotalRG */, + int /* nTotalAliases */ +); + +extern Status XkbGetNames( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbSetNames( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* firstType */, + unsigned int /* nTypes */, + XkbDescPtr /* desc */ +); + +extern Bool XkbChangeNames( + Display * /* dpy */, + XkbDescPtr /* xkb */, + XkbNameChangesPtr /* changes */ +); + +extern void XkbFreeNames( + XkbDescPtr /* xkb */, + unsigned int /* which */, + Bool /* freeMap */ +); + + +extern Status XkbGetState( + Display * /* dpy */, + unsigned int /* deviceSpec */, + XkbStatePtr /* rtrnState */ +); + +extern Bool XkbSetMap( + Display * /* dpy */, + unsigned int /* which */, + XkbDescPtr /* desc */ +); + +extern Bool XkbChangeMap( + Display* /* dpy */, + XkbDescPtr /* desc */, + XkbMapChangesPtr /* changes */ +); + +extern Bool XkbSetDetectableAutoRepeat( + Display * /* dpy */, + Bool /* detectable */, + Bool * /* supported */ +); + +extern Bool XkbGetDetectableAutoRepeat( + Display * /* dpy */, + Bool * /* supported */ +); + +extern Bool XkbSetAutoResetControls( + Display * /* dpy */, + unsigned int /* changes */, + unsigned int * /* auto_ctrls */, + unsigned int * /* auto_values */ +); + +extern Bool XkbGetAutoResetControls( + Display * /* dpy */, + unsigned int * /* auto_ctrls */, + unsigned int * /* auto_ctrl_values */ +); + +extern Bool XkbSetPerClientControls( + Display * /* dpy */, + unsigned int /* change */, + unsigned int * /* values */ +); + +extern Bool XkbGetPerClientControls( + Display * /* dpy */, + unsigned int * /* ctrls */ +); + +extern Status XkbCopyKeyType( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */ +); + +extern Status XkbCopyKeyTypes( + XkbKeyTypePtr /* from */, + XkbKeyTypePtr /* into */, + int /* num_types */ +); + +extern Status XkbResizeKeyType( + XkbDescPtr /* xkb */, + int /* type_ndx */, + int /* map_count */, + Bool /* want_preserve */, + int /* new_num_lvls */ +); + +extern KeySym *XkbResizeKeySyms( + XkbDescPtr /* desc */, + int /* forKey */, + int /* symsNeeded */ +); + +extern XkbAction *XkbResizeKeyActions( + XkbDescPtr /* desc */, + int /* forKey */, + int /* actsNeeded */ +); + +extern Status XkbChangeTypesOfKey( + XkbDescPtr /* xkb */, + int /* key */, + int /* num_groups */, + unsigned int /* groups */, + int * /* newTypes */, + XkbMapChangesPtr /* pChanges */ +); + +extern Status XkbChangeKeycodeRange( + XkbDescPtr /* xkb */, + int /* minKC */, + int /* maxKC */, + XkbChangesPtr /* changes */ +); + +/***====================================================================***/ + +extern XkbComponentListPtr XkbListComponents( + Display * /* dpy */, + unsigned int /* deviceSpec */, + XkbComponentNamesPtr /* ptrns */, + int * /* max_inout */ +); + +extern void XkbFreeComponentList( + XkbComponentListPtr /* list */ +); + +extern XkbDescPtr XkbGetKeyboard( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */ +); + +extern XkbDescPtr XkbGetKeyboardByName( + Display * /* dpy */, + unsigned int /* deviceSpec */, + XkbComponentNamesPtr /* names */, + unsigned int /* want */, + unsigned int /* need */, + Bool /* load */ +); + +/***====================================================================***/ + +extern int XkbKeyTypesForCoreSymbols( /* returns # of groups */ + XkbDescPtr /* xkb */, /* keyboard device */ + int /* map_width */, /* width of core KeySym array */ + KeySym * /* core_syms */, /* always mapWidth symbols */ + unsigned int /* protected */, /* explicit key types */ + int * /* types_inout */, /* always four type indices */ + KeySym * /* xkb_syms_rtrn */ /* must have enough space */ +); + +extern Bool XkbApplyCompatMapToKey( /* False only on error */ + XkbDescPtr /* xkb */, /* keymap to be edited */ + KeyCode /* key */, /* key to be updated */ + XkbChangesPtr /* changes */ /* resulting changes to map */ +); + +extern Bool XkbUpdateMapFromCore( /* False only on error */ + XkbDescPtr /* xkb */, /* XKB keyboard to be edited */ + KeyCode /* first_key */, /* first changed key */ + int /* num_keys */, /* number of changed keys */ + int /* map_width */, /* width of core keymap */ + KeySym * /* core_keysyms */, /* symbols from core keymap */ + XkbChangesPtr /* changes */ /* resulting changes */ +); + +/***====================================================================***/ + +extern XkbDeviceLedInfoPtr XkbAddDeviceLedInfo( + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass */, + unsigned int /* ledId */ +); + +extern Status XkbResizeDeviceButtonActions( + XkbDeviceInfoPtr /* devi */, + unsigned int /* newTotal */ +); + +extern XkbDeviceInfoPtr XkbAllocDeviceInfo( + unsigned int /* deviceSpec */, + unsigned int /* nButtons */, + unsigned int /* szLeds */ +); + +extern void XkbFreeDeviceInfo( + XkbDeviceInfoPtr /* devi */, + unsigned int /* which */, + Bool /* freeDevI */ +); + +extern void XkbNoteDeviceChanges( + XkbDeviceChangesPtr /* old */, + XkbExtensionDeviceNotifyEvent * /* new */, + unsigned int /* wanted */ +); + +extern XkbDeviceInfoPtr XkbGetDeviceInfo( + Display * /* dpy */, + unsigned int /* which */, + unsigned int /* deviceSpec */, + unsigned int /* ledClass */, + unsigned int /* ledID */ +); + +extern Status XkbGetDeviceInfoChanges( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + XkbDeviceChangesPtr /* changes */ +); + +extern Status XkbGetDeviceButtonActions( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + Bool /* all */, + unsigned int /* first */, + unsigned int /* nBtns */ +); + +extern Status XkbGetDeviceLedInfo( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass (class, XIDflt, XIAll) */, + unsigned int /* ledId (id, XIDflt, XIAll) */, + unsigned int /* which (XkbXI_Indicator{Names,Map}Mask */ +); + +extern Bool XkbSetDeviceInfo( + Display * /* dpy */, + unsigned int /* which */, + XkbDeviceInfoPtr /* devi */ +); + +extern Bool XkbChangeDeviceInfo( + Display* /* dpy */, + XkbDeviceInfoPtr /* desc */, + XkbDeviceChangesPtr /* changes */ +); + +extern Bool XkbSetDeviceLedInfo( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + unsigned int /* ledClass */, + unsigned int /* ledID */, + unsigned int /* which */ +); + +extern Bool XkbSetDeviceButtonActions( + Display * /* dpy */, + XkbDeviceInfoPtr /* devi */, + unsigned int /* first */, + unsigned int /* nBtns */ +); + +/***====================================================================***/ + +extern char XkbToControl( + char /* c */ +); + +/***====================================================================***/ + +extern Bool XkbSetDebuggingFlags( + Display * /* dpy */, + unsigned int /* mask */, + unsigned int /* flags */, + char * /* msg */, + unsigned int /* ctrls_mask */, + unsigned int /* ctrls */, + unsigned int * /* rtrn_flags */, + unsigned int * /* rtrn_ctrls */ +); + +extern Bool XkbApplyVirtualModChanges( + XkbDescPtr /* xkb */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +extern Bool XkbUpdateActionVirtualMods( + XkbDescPtr /* xkb */, + XkbAction * /* act */, + unsigned int /* changed */ +); + +extern void XkbUpdateKeyTypeVirtualMods( + XkbDescPtr /* xkb */, + XkbKeyTypePtr /* type */, + unsigned int /* changed */, + XkbChangesPtr /* changes */ +); + +_XFUNCPROTOEND + +#endif /* !defined(_X11_XKBLIB_H_) && !defined(_XKBLIB_H_) */ diff --git a/nx-X11/lib/include/X11/Xcms.h b/nx-X11/lib/include/X11/Xcms.h new file mode 100644 index 000000000..3b0410533 --- /dev/null +++ b/nx-X11/lib/include/X11/Xcms.h @@ -0,0 +1,816 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * DESCRIPTION + * Public include file for X Color Management System + */ +#if !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) +#define _X11_XCMS_H_ +#define _XCMS_H_ + +#include + +/* The Xcms structs are full of implicit padding to properly align members. + We can't clean that up without breaking ABI, so tell clang not to bother + complaining about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + + /* + * XCMS Status Values + */ +#define XcmsFailure 0 +#define XcmsSuccess 1 +#define XcmsSuccessWithCompression 2 + + /* + * Color Space Format ID's + * Color Space ID's are of XcmsColorFormat type. + * + * bit 31 + * 0 == Device-Independent + * 1 == Device-Dependent + * + * bit 30: + * 0 == Registered with X Consortium + * 1 == Unregistered + */ +#define XcmsUndefinedFormat (XcmsColorFormat)0x00000000 +#define XcmsCIEXYZFormat (XcmsColorFormat)0x00000001 +#define XcmsCIEuvYFormat (XcmsColorFormat)0x00000002 +#define XcmsCIExyYFormat (XcmsColorFormat)0x00000003 +#define XcmsCIELabFormat (XcmsColorFormat)0x00000004 +#define XcmsCIELuvFormat (XcmsColorFormat)0x00000005 +#define XcmsTekHVCFormat (XcmsColorFormat)0x00000006 +#define XcmsRGBFormat (XcmsColorFormat)0x80000000 +#define XcmsRGBiFormat (XcmsColorFormat)0x80000001 + + /* + * State of XcmsPerScrnInfo + */ +#define XcmsInitNone 0x00 /* no initialization attempted */ +#define XcmsInitSuccess 0x01 /* initialization successful */ +#define XcmsInitFailure 0xff /* failure, use defaults */ + +#define DisplayOfCCC(ccc) ((ccc)->dpy) +#define ScreenNumberOfCCC(ccc) ((ccc)->screenNumber) +#define VisualOfCCC(ccc) ((ccc)->visual) +#define ClientWhitePointOfCCC(ccc) (&(ccc)->clientWhitePt) +#define ScreenWhitePointOfCCC(ccc) (&(ccc)->pPerScrnInfo->screenWhitePt) +#define FunctionSetOfCCC(ccc) ((ccc)->pPerScrnInfo->functionSet) + +typedef unsigned long XcmsColorFormat; /* Color Space Format ID */ + +typedef double XcmsFloat; + + /* + * Device RGB + */ +typedef struct { + unsigned short red; /* scaled from 0x0000 to 0xffff */ + unsigned short green; /* scaled from 0x0000 to 0xffff */ + unsigned short blue; /* scaled from 0x0000 to 0xffff */ +} XcmsRGB; + + /* + * RGB Intensity + */ +typedef struct { + XcmsFloat red; /* 0.0 - 1.0 */ + XcmsFloat green; /* 0.0 - 1.0 */ + XcmsFloat blue; /* 0.0 - 1.0 */ +} XcmsRGBi; + + /* + * CIE XYZ + */ +typedef struct { + XcmsFloat X; + XcmsFloat Y; + XcmsFloat Z; +} XcmsCIEXYZ; + + /* + * CIE u'v'Y + */ +typedef struct { + XcmsFloat u_prime; /* 0.0 - 1.0 */ + XcmsFloat v_prime; /* 0.0 - 1.0 */ + XcmsFloat Y; /* 0.0 - 1.0 */ +} XcmsCIEuvY; + + /* + * CIE xyY + */ +typedef struct { + XcmsFloat x; /* 0.0 - 1.0 */ + XcmsFloat y; /* 0.0 - 1.0 */ + XcmsFloat Y; /* 0.0 - 1.0 */ +} XcmsCIExyY; + + /* + * CIE L*a*b* + */ +typedef struct { + XcmsFloat L_star; /* 0.0 - 100.0 */ + XcmsFloat a_star; + XcmsFloat b_star; +} XcmsCIELab; + + /* + * CIE L*u*v* + */ +typedef struct { + XcmsFloat L_star; /* 0.0 - 100.0 */ + XcmsFloat u_star; + XcmsFloat v_star; +} XcmsCIELuv; + + /* + * TekHVC + */ +typedef struct { + XcmsFloat H; /* 0.0 - 360.0 */ + XcmsFloat V; /* 0.0 - 100.0 */ + XcmsFloat C; /* 0.0 - 100.0 */ +} XcmsTekHVC; + + /* + * PAD + */ +typedef struct { + XcmsFloat pad0; + XcmsFloat pad1; + XcmsFloat pad2; + XcmsFloat pad3; +} XcmsPad; + + + /* + * XCMS Color Structure + */ +typedef struct { + union { + XcmsRGB RGB; + XcmsRGBi RGBi; + XcmsCIEXYZ CIEXYZ; + XcmsCIEuvY CIEuvY; + XcmsCIExyY CIExyY; + XcmsCIELab CIELab; + XcmsCIELuv CIELuv; + XcmsTekHVC TekHVC; + XcmsPad Pad; + } spec; /* the color specification */ + unsigned long pixel; /* pixel value (as needed) */ + XcmsColorFormat format; /* the specification format */ +} XcmsColor; + + + /* + * XCMS Per Screen related data + */ + +typedef struct _XcmsPerScrnInfo { + XcmsColor screenWhitePt; /* Screen White point */ + XPointer functionSet; /* pointer to Screen Color Characterization */ + /* Function Set structure */ + XPointer screenData; /* pointer to corresponding Screen Color*/ + /* Characterization Data */ + unsigned char state; /* XcmsInitNone, XcmsInitSuccess, XcmsInitFailure */ + char pad[3]; +} XcmsPerScrnInfo; + +typedef struct _XcmsCCC *XcmsCCC; + +typedef Status (*XcmsCompressionProc)( /* Gamut Compression Proc */ + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +typedef Status (*XcmsWhiteAdjustProc)( /* White Point Adjust Proc */ + XcmsCCC /* ccc */, + XcmsColor* /* initial_white_point*/, + XcmsColor* /* target_white_point*/, + XcmsColorFormat /* target_format */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + + /* + * XCMS Color Conversion Context + */ +typedef struct _XcmsCCC { + Display *dpy; /* X Display */ + int screenNumber; /* X screen number */ + Visual *visual; /* X Visual */ + XcmsColor clientWhitePt; /* Client White Point */ + XcmsCompressionProc gamutCompProc; /* Gamut Compression Function */ + XPointer gamutCompClientData; /* Gamut Comp Func Client Data */ + XcmsWhiteAdjustProc whitePtAdjProc; /* White Point Adjustment Function */ + XPointer whitePtAdjClientData; /* White Pt Adj Func Client Data */ + XcmsPerScrnInfo *pPerScrnInfo; /* pointer to per screen information */ + /* associated with the above display */ + /* screenNumber */ +} XcmsCCCRec; + +typedef Status (*XcmsScreenInitProc)( /* Screen Initialization Proc */ + Display* /* dpy */, + int /* screen_number */, + XcmsPerScrnInfo* /* screen_info */ +); + +typedef void (*XcmsScreenFreeProc)( + XPointer /* screenData */ +); + + /* + * Function List Pointer -- pointer to an array of function pointers. + * The end of list is indicated by a NULL pointer. + */ +/* + * XXX: The use of the XcmsConversionProc type is broken. The + * device-independent colour conversion code uses it as: + +typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, XcmsColor *, + unsigned int); + + * while the device-dependent code uses it as: + +typedef Status (*XcmsConversionProc)(XcmsCCC, XcmsColor *, unsigned int, + Bool *); + + * Until this is reworked, it's probably best to leave it unprotoized. + * The code works regardless. + */ +typedef Status (*XcmsDDConversionProc)( /* using device-dependent version */ + XcmsCCC /* ccc */, + XcmsColor* /* pcolors_in_out */, + unsigned int /* ncolors */, + Bool* /* pCompressed */ + ); + +typedef Status (*XcmsDIConversionProc)( /* using device-independent version */ + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* pcolors_in_out */, + unsigned int /* ncolors */ + ); + +typedef XcmsDIConversionProc XcmsConversionProc; +typedef XcmsConversionProc *XcmsFuncListPtr; + +typedef int (*XcmsParseStringProc)( /* Color String Parsing Proc */ + char* /* color_string */, + XcmsColor* /* color_return */ +); + + /* + * Color Space -- per Color Space related data (Device-Independent + * or Device-Dependent) + */ +typedef struct _XcmsColorSpace { + const char *prefix; /* Prefix of string format. */ + XcmsColorFormat id; /* Format ID number. */ + XcmsParseStringProc parseString; + /* String format parsing function */ + XcmsFuncListPtr to_CIEXYZ; /* Pointer to an array of function */ + /* pointers such that when the */ + /* functions are executed in sequence */ + /* will convert a XcmsColor structure */ + /* from this color space to CIEXYZ */ + /* space. */ + XcmsFuncListPtr from_CIEXYZ;/* Pointer to an array of function */ + /* pointers such that when the */ + /* functions are executed in sequence */ + /* will convert a XcmsColor structure */ + /* from CIEXYZ space to this color */ + /* space. */ + int inverse_flag; /* If 1, indicates that for 0 <= i < n */ + /* where n is the number of function */ + /* pointers in the lists to_CIEXYZ */ + /* and from_CIEXYZ; for each function */ + /* to_CIEXYZ[i] its inverse function */ + /* is from_CIEXYZ[n - i]. */ + +} XcmsColorSpace; + + /* + * Screen Color Characterization Function Set -- per device class + * color space conversion functions. + */ +typedef struct _XcmsFunctionSet { + XcmsColorSpace **DDColorSpaces; + /* Pointer to an array of pointers to */ + /* Device-DEPENDENT color spaces */ + /* understood by this SCCFuncSet. */ + XcmsScreenInitProc screenInitProc; + /* Screen initialization function that */ + /* reads Screen Color Characterization*/ + /* Data off properties on the screen's*/ + /* root window. */ + XcmsScreenFreeProc screenFreeProc; + /* Function that frees the SCCData */ + /* structures. */ +} XcmsFunctionSet; + +_XFUNCPROTOBEGIN + +extern Status XcmsAddColorSpace ( + XcmsColorSpace* /* pColorSpace */ +); + +extern Status XcmsAddFunctionSet ( + XcmsFunctionSet* /* functionSet */ +); + +extern Status XcmsAllocColor ( + Display* /* dpy */, + Colormap /* colormap */, + XcmsColor* /* color_in_out */, + XcmsColorFormat /* result_format */ +); + +extern Status XcmsAllocNamedColor ( + Display* /* dpy */, + Colormap /* colormap */, + _Xconst char* /* color_string */, + XcmsColor* /* color_scrn_return */, + XcmsColor* /* color_exact_return */, + XcmsColorFormat /* result_format */ +); + +extern XcmsCCC XcmsCCCOfColormap ( + Display* /* dpy */, + Colormap /* colormap */ +); + +extern Status XcmsCIELabClipab( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELabClipL( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELabClipLab( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELabQueryMaxC ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsFloat /* L_star */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELabQueryMaxL ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsFloat /* chroma */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELabQueryMaxLC ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELabQueryMinL ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsFloat /* chroma */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELabToCIEXYZ ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIELabWhiteShiftColors( + XcmsCCC /* ccc */, + XcmsColor* /* initial_white_point*/, + XcmsColor* /* target_white_point*/, + XcmsColorFormat /* target_format */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELuvClipL( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELuvClipLuv( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELuvClipuv( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIELuvQueryMaxC ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsFloat /* L_star */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELuvQueryMaxL ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsFloat /* chroma */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELuvQueryMaxLC ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELuvQueryMinL ( + XcmsCCC /* ccc */, + XcmsFloat /* hue_angle */, + XcmsFloat /* chroma */, + XcmsColor* /* color_return */ +); + +extern Status XcmsCIELuvToCIEuvY ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIELuvWhiteShiftColors( + XcmsCCC /* ccc */, + XcmsColor* /* initial_white_point*/, + XcmsColor* /* target_white_point*/, + XcmsColorFormat /* target_format */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIEXYZToCIELab ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIEXYZToCIEuvY ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIEXYZToCIExyY ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIEXYZToRGBi ( + XcmsCCC /* ccc */, + XcmsColor* /* colors */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsCIEuvYToCIELuv ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIEuvYToCIEXYZ ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIEuvYToTekHVC ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsCIExyYToCIEXYZ ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern XcmsColor *XcmsClientWhitePointOfCCC ( + XcmsCCC /* ccc */ +); + +extern Status XcmsConvertColors ( + XcmsCCC /* ccc */, + XcmsColor* /* colorArry_in_out */, + unsigned int /* nColors */, + XcmsColorFormat /* targetFormat */, + Bool* /* compArry_return */ +); + +extern XcmsCCC XcmsCreateCCC ( + Display* /* dpy */, + int /* screenNumber */, + Visual* /* visual */, + XcmsColor* /* clientWhitePt */, + XcmsCompressionProc /* gamutCompProc */, + XPointer /* gamutCompClientData */, + XcmsWhiteAdjustProc /* whitePtAdjProc */, + XPointer /* whitePtAdjClientData */ +); + +extern XcmsCCC XcmsDefaultCCC ( + Display* /* dpy */, + int /* screenNumber */ +); + +extern Display *XcmsDisplayOfCCC ( + XcmsCCC /* ccc */ +); + +extern XcmsColorFormat XcmsFormatOfPrefix ( + char* /* prefix */ +); + +extern void XcmsFreeCCC ( + XcmsCCC /* ccc */ +); + +extern Status XcmsLookupColor ( + Display* /* dpy */, + Colormap /* colormap */, + _Xconst char* /* color_string */, + XcmsColor* /* pColor_exact_in_out */, + XcmsColor* /* pColor_scrn_in_out */, + XcmsColorFormat /* result_format */ +); + +extern char *XcmsPrefixOfFormat ( + XcmsColorFormat /* id */ +); + +extern Status XcmsQueryBlack ( + XcmsCCC /* ccc */, + XcmsColorFormat /* target_format */, + XcmsColor* /* color_return */ +); + +extern Status XcmsQueryBlue ( + XcmsCCC /* ccc */, + XcmsColorFormat /* target_format */, + XcmsColor* /* color_return */ +); + +extern Status XcmsQueryColor ( + Display* /* dpy */, + Colormap /* colormap */, + XcmsColor* /* pColor_in_out */, + XcmsColorFormat /* result_format */ +); + +extern Status XcmsQueryColors ( + Display* /* dpy */, + Colormap /* colormap */, + XcmsColor* /* colorArry_in_out */, + unsigned int /* nColors */, + XcmsColorFormat /* result_format */ +); + +extern Status XcmsQueryGreen ( + XcmsCCC /* ccc */, + XcmsColorFormat /* target_format */, + XcmsColor* /* color_return */ +); + +extern Status XcmsQueryRed ( + XcmsCCC /* ccc */, + XcmsColorFormat /* target_format */, + XcmsColor* /* color_return */ +); + +extern Status XcmsQueryWhite ( + XcmsCCC /* ccc */, + XcmsColorFormat /* target_format */, + XcmsColor* /* color_return */ +); + +extern Status XcmsRGBiToCIEXYZ ( + XcmsCCC /* ccc */, + XcmsColor* /* colors */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsRGBiToRGB ( + XcmsCCC /* ccc */, + XcmsColor* /* colors */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsRGBToRGBi ( + XcmsCCC /* ccc */, + XcmsColor* /* colors */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern int XcmsScreenNumberOfCCC ( + XcmsCCC /* ccc */ +); + +extern XcmsColor *XcmsScreenWhitePointOfCCC ( + XcmsCCC /* ccc */ +); + +extern XcmsCCC XcmsSetCCCOfColormap( + Display* /* dpy */, + Colormap /* colormap */, + XcmsCCC /* ccc */ +); + +extern XcmsCompressionProc XcmsSetCompressionProc ( + XcmsCCC /* ccc */, + XcmsCompressionProc /* compression_proc */, + XPointer /* client_data */ +); + +extern XcmsWhiteAdjustProc XcmsSetWhiteAdjustProc ( + XcmsCCC /* ccc */, + XcmsWhiteAdjustProc /* white_adjust_proc */, + XPointer /* client_data */ +); + +extern Status XcmsSetWhitePoint ( + XcmsCCC /* ccc */, + XcmsColor* /* color */ +); + +extern Status XcmsStoreColor ( + Display* /* dpy */, + Colormap /* colormap */, + XcmsColor* /* pColor_in */ +); + +extern Status XcmsStoreColors ( + Display* /* dpy */, + Colormap /* colormap */, + XcmsColor* /* colorArry_in */, + unsigned int /* nColors */, + Bool* /* compArry_return */ +); + +extern Status XcmsTekHVCClipC( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsTekHVCClipV( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsTekHVCClipVC( + XcmsCCC /* ccc */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + unsigned int /* index */, + Bool* /* compression_flags_return */ +); + +extern Status XcmsTekHVCQueryMaxC ( + XcmsCCC /* ccc */, + XcmsFloat /* hue */, + XcmsFloat /* value */, + XcmsColor* /* color_return */ +); + +extern Status XcmsTekHVCQueryMaxV ( + XcmsCCC /* ccc */, + XcmsFloat /* hue */, + XcmsFloat /* chroma */, + XcmsColor* /* color_return */ +); + +extern Status XcmsTekHVCQueryMaxVC ( + XcmsCCC /* ccc */, + XcmsFloat /* hue */, + XcmsColor* /* color_return */ +); + +extern Status XcmsTekHVCQueryMaxVSamples ( + XcmsCCC /* ccc */, + XcmsFloat /* hue */, + XcmsColor* /* colors_return */, + unsigned int /* nsamples */ +); + +extern Status XcmsTekHVCQueryMinV ( + XcmsCCC /* ccc */, + XcmsFloat /* hue */, + XcmsFloat /* chroma */, + XcmsColor* /* color_return */ +); + +extern Status XcmsTekHVCToCIEuvY ( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ +); + +extern Status XcmsTekHVCWhiteShiftColors( + XcmsCCC /* ccc */, + XcmsColor* /* initial_white_point*/, + XcmsColor* /* target_white_point*/, + XcmsColorFormat /* target_format */, + XcmsColor* /* colors_in_out */, + unsigned int /* ncolors */, + Bool* /* compression_flags_return */ +); + +extern Visual *XcmsVisualOfCCC ( + XcmsCCC /* ccc */ +); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +_XFUNCPROTOEND + +#endif /* !defined(_X11_XCMS_H_) && !defined(_XCMS_H_) */ diff --git a/nx-X11/lib/include/X11/Xlib.h b/nx-X11/lib/include/X11/Xlib.h new file mode 100644 index 000000000..362fdb69e --- /dev/null +++ b/nx-X11/lib/include/X11/Xlib.h @@ -0,0 +1,4036 @@ +/* + +Copyright 1985, 1986, 1987, 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +/* + * Xlib.h - Header definition and support file for the C subroutine + * interface library (Xlib) to the X Window System Protocol (V11). + * Structures and symbols starting with "_" are private to the library. + */ +#if !defined(_X11_XLIB_H_) && !defined(_XLIB_H_) +#define _X11_XLIB_H_ +#define _XLIB_H_ + +#define XlibSpecificationRelease 6 + +#include + +#if defined(__SCO__) || defined(__UNIXWARE__) +#include +#endif + +#include + +/* applications should not depend on these two headers being included! */ +#include +#include + +#ifndef X_WCHAR +#include +#else +/* replace this with #include or typedef appropriate for your system */ +typedef unsigned long wchar_t; +#endif + + +extern int +_Xmblen( + char *str, + int len + ); + +/* API mentioning "UTF8" or "utf8" is an XFree86 extension, introduced in + November 2000. Its presence is indicated through the following macro. */ +#define X_HAVE_UTF8_STRING 1 + +/* The Xlib structs are full of implicit padding to properly align members. + We can't clean that up without breaking ABI, so tell clang not to bother + complaining about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +typedef char *XPointer; + +#define Bool int +#define Status int +#define True 1 +#define False 0 + +#define QueuedAlready 0 +#define QueuedAfterReading 1 +#define QueuedAfterFlush 2 + +#define ConnectionNumber(dpy) (((_XPrivDisplay)(dpy))->fd) +#define RootWindow(dpy, scr) (ScreenOfDisplay(dpy,scr)->root) +#define DefaultScreen(dpy) (((_XPrivDisplay)(dpy))->default_screen) +#define DefaultRootWindow(dpy) (ScreenOfDisplay(dpy,DefaultScreen(dpy))->root) +#define DefaultVisual(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_visual) +#define DefaultGC(dpy, scr) (ScreenOfDisplay(dpy,scr)->default_gc) +#define BlackPixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->black_pixel) +#define WhitePixel(dpy, scr) (ScreenOfDisplay(dpy,scr)->white_pixel) +#define AllPlanes ((unsigned long)~0L) +#define QLength(dpy) (((_XPrivDisplay)(dpy))->qlen) +#define DisplayWidth(dpy, scr) (ScreenOfDisplay(dpy,scr)->width) +#define DisplayHeight(dpy, scr) (ScreenOfDisplay(dpy,scr)->height) +#define DisplayWidthMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mwidth) +#define DisplayHeightMM(dpy, scr)(ScreenOfDisplay(dpy,scr)->mheight) +#define DisplayPlanes(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) +#define DisplayCells(dpy, scr) (DefaultVisual(dpy,scr)->map_entries) +#define ScreenCount(dpy) (((_XPrivDisplay)(dpy))->nscreens) +#define ServerVendor(dpy) (((_XPrivDisplay)(dpy))->vendor) +#define ProtocolVersion(dpy) (((_XPrivDisplay)(dpy))->proto_major_version) +#define ProtocolRevision(dpy) (((_XPrivDisplay)(dpy))->proto_minor_version) +#define VendorRelease(dpy) (((_XPrivDisplay)(dpy))->release) +#define DisplayString(dpy) (((_XPrivDisplay)(dpy))->display_name) +#define DefaultDepth(dpy, scr) (ScreenOfDisplay(dpy,scr)->root_depth) +#define DefaultColormap(dpy, scr)(ScreenOfDisplay(dpy,scr)->cmap) +#define BitmapUnit(dpy) (((_XPrivDisplay)(dpy))->bitmap_unit) +#define BitmapBitOrder(dpy) (((_XPrivDisplay)(dpy))->bitmap_bit_order) +#define BitmapPad(dpy) (((_XPrivDisplay)(dpy))->bitmap_pad) +#define ImageByteOrder(dpy) (((_XPrivDisplay)(dpy))->byte_order) +#define NextRequest(dpy) (((_XPrivDisplay)(dpy))->request + 1) +#define LastKnownRequestProcessed(dpy) (((_XPrivDisplay)(dpy))->last_request_read) + +/* macros for screen oriented applications (toolkit) */ +#define ScreenOfDisplay(dpy, scr)(&((_XPrivDisplay)(dpy))->screens[scr]) +#define DefaultScreenOfDisplay(dpy) ScreenOfDisplay(dpy,DefaultScreen(dpy)) +#define DisplayOfScreen(s) ((s)->display) +#define RootWindowOfScreen(s) ((s)->root) +#define BlackPixelOfScreen(s) ((s)->black_pixel) +#define WhitePixelOfScreen(s) ((s)->white_pixel) +#define DefaultColormapOfScreen(s)((s)->cmap) +#define DefaultDepthOfScreen(s) ((s)->root_depth) +#define DefaultGCOfScreen(s) ((s)->default_gc) +#define DefaultVisualOfScreen(s)((s)->root_visual) +#define WidthOfScreen(s) ((s)->width) +#define HeightOfScreen(s) ((s)->height) +#define WidthMMOfScreen(s) ((s)->mwidth) +#define HeightMMOfScreen(s) ((s)->mheight) +#define PlanesOfScreen(s) ((s)->root_depth) +#define CellsOfScreen(s) (DefaultVisualOfScreen((s))->map_entries) +#define MinCmapsOfScreen(s) ((s)->min_maps) +#define MaxCmapsOfScreen(s) ((s)->max_maps) +#define DoesSaveUnders(s) ((s)->save_unders) +#define DoesBackingStore(s) ((s)->backing_store) +#define EventMaskOfScreen(s) ((s)->root_input_mask) + +/* + * Extensions need a way to hang private data on some structures. + */ +typedef struct _XExtData { + int number; /* number returned by XRegisterExtension */ + struct _XExtData *next; /* next item on list of data for structure */ + int (*free_private)( /* called to free private storage */ + struct _XExtData *extension + ); + XPointer private_data; /* data private to this extension. */ +} XExtData; + +/* + * This file contains structures used by the extension mechanism. + */ +typedef struct { /* public to extension, cannot be changed */ + int extension; /* extension number */ + int major_opcode; /* major op-code assigned by server */ + int first_event; /* first event number for the extension */ + int first_error; /* first error number for the extension */ +} XExtCodes; + +/* + * Data structure for retrieving info about pixmap formats. + */ + +typedef struct { + int depth; + int bits_per_pixel; + int scanline_pad; +} XPixmapFormatValues; + + +/* + * Data structure for setting graphics context. + */ +typedef struct { + int function; /* logical operation */ + unsigned long plane_mask;/* plane mask */ + unsigned long foreground;/* foreground pixel */ + unsigned long background;/* background pixel */ + int line_width; /* line width */ + int line_style; /* LineSolid, LineOnOffDash, LineDoubleDash */ + int cap_style; /* CapNotLast, CapButt, + CapRound, CapProjecting */ + int join_style; /* JoinMiter, JoinRound, JoinBevel */ + int fill_style; /* FillSolid, FillTiled, + FillStippled, FillOpaeueStippled */ + int fill_rule; /* EvenOddRule, WindingRule */ + int arc_mode; /* ArcChord, ArcPieSlice */ + Pixmap tile; /* tile pixmap for tiling operations */ + Pixmap stipple; /* stipple 1 plane pixmap for stipping */ + int ts_x_origin; /* offset for tile or stipple operations */ + int ts_y_origin; + Font font; /* default text font for text operations */ + int subwindow_mode; /* ClipByChildren, IncludeInferiors */ + Bool graphics_exposures;/* boolean, should exposures be generated */ + int clip_x_origin; /* origin for clipping */ + int clip_y_origin; + Pixmap clip_mask; /* bitmap clipping; other calls for rects */ + int dash_offset; /* patterned/dashed line information */ + char dashes; +} XGCValues; + +/* + * Graphics context. The contents of this structure are implementation + * dependent. A GC should be treated as opaque by application code. + */ + +typedef struct _XGC +#ifdef XLIB_ILLEGAL_ACCESS +{ + XExtData *ext_data; /* hook for extension to hang data */ + GContext gid; /* protocol ID for graphics context */ + /* there is more to this structure, but it is private to Xlib */ +} +#endif +*GC; + +/* + * Visual structure; contains information about colormapping possible. + */ +typedef struct { + XExtData *ext_data; /* hook for extension to hang data */ + VisualID visualid; /* visual id of this visual */ +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ class of screen (monochrome, etc.) */ +#else + int class; /* class of screen (monochrome, etc.) */ +#endif + unsigned long red_mask, green_mask, blue_mask; /* mask values */ + int bits_per_rgb; /* log base 2 of distinct color values */ + int map_entries; /* color map entries */ +} Visual; + +/* + * Depth structure; contains information for each possible depth. + */ +typedef struct { + int depth; /* this depth (Z) of the depth */ + int nvisuals; /* number of Visual types at this depth */ + Visual *visuals; /* list of visuals possible at this depth */ +} Depth; + +/* + * Information about the screen. The contents of this structure are + * implementation dependent. A Screen should be treated as opaque + * by application code. + */ + +struct _XDisplay; /* Forward declare before use for C++ */ + +typedef struct { + XExtData *ext_data; /* hook for extension to hang data */ + struct _XDisplay *display;/* back pointer to display structure */ + Window root; /* Root window id. */ + int width, height; /* width and height of screen */ + int mwidth, mheight; /* width and height of in millimeters */ + int ndepths; /* number of depths possible */ + Depth *depths; /* list of allowable depths on the screen */ + int root_depth; /* bits per pixel */ + Visual *root_visual; /* root visual */ + GC default_gc; /* GC for the root root visual */ + Colormap cmap; /* default color map */ + unsigned long white_pixel; + unsigned long black_pixel; /* White and Black pixel values */ + int max_maps, min_maps; /* max and min color maps */ + int backing_store; /* Never, WhenMapped, Always */ + Bool save_unders; + long root_input_mask; /* initial root input mask */ +} Screen; + +/* + * Format structure; describes ZFormat data the screen will understand. + */ +typedef struct { + XExtData *ext_data; /* hook for extension to hang data */ + int depth; /* depth of this image format */ + int bits_per_pixel; /* bits/pixel at this depth */ + int scanline_pad; /* scanline must padded to this multiple */ +} ScreenFormat; + +/* + * Data structure for setting window attributes. + */ +typedef struct { + Pixmap background_pixmap; /* background or None or ParentRelative */ + unsigned long background_pixel; /* background pixel */ + Pixmap border_pixmap; /* border of the window */ + unsigned long border_pixel; /* border pixel value */ + int bit_gravity; /* one of bit gravity values */ + int win_gravity; /* one of the window gravity values */ + int backing_store; /* NotUseful, WhenMapped, Always */ + unsigned long backing_planes;/* planes to be preseved if possible */ + unsigned long backing_pixel;/* value to use in restoring planes */ + Bool save_under; /* should bits under be saved? (popups) */ + long event_mask; /* set of events that should be saved */ + long do_not_propagate_mask; /* set of events that should not propagate */ + Bool override_redirect; /* boolean value for override-redirect */ + Colormap colormap; /* color map to be associated with window */ + Cursor cursor; /* cursor to be displayed (or None) */ +} XSetWindowAttributes; + +typedef struct { + int x, y; /* location of window */ + int width, height; /* width and height of window */ + int border_width; /* border width of window */ + int depth; /* depth of window */ + Visual *visual; /* the associated visual structure */ + Window root; /* root of screen containing window */ +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ InputOutput, InputOnly*/ +#else + int class; /* InputOutput, InputOnly*/ +#endif + int bit_gravity; /* one of bit gravity values */ + int win_gravity; /* one of the window gravity values */ + int backing_store; /* NotUseful, WhenMapped, Always */ + unsigned long backing_planes;/* planes to be preserved if possible */ + unsigned long backing_pixel;/* value to be used when restoring planes */ + Bool save_under; /* boolean, should bits under be saved? */ + Colormap colormap; /* color map to be associated with window */ + Bool map_installed; /* boolean, is color map currently installed*/ + int map_state; /* IsUnmapped, IsUnviewable, IsViewable */ + long all_event_masks; /* set of events all people have interest in*/ + long your_event_mask; /* my event mask */ + long do_not_propagate_mask; /* set of events that should not propagate */ + Bool override_redirect; /* boolean value for override-redirect */ + Screen *screen; /* back pointer to correct screen */ +} XWindowAttributes; + +/* + * Data structure for host setting; getting routines. + * + */ + +typedef struct { + int family; /* for example FamilyInternet */ + int length; /* length of address, in bytes */ + char *address; /* pointer to where to find the bytes */ +} XHostAddress; + +/* + * Data structure for ServerFamilyInterpreted addresses in host routines + */ +typedef struct { + int typelength; /* length of type string, in bytes */ + int valuelength; /* length of value string, in bytes */ + char *type; /* pointer to where to find the type string */ + char *value; /* pointer to where to find the address */ +} XServerInterpretedAddress; + +/* + * Data structure for "image" data, used by image manipulation routines. + */ +typedef struct _XImage { + int width, height; /* size of image */ + int xoffset; /* number of pixels offset in X direction */ + int format; /* XYBitmap, XYPixmap, ZPixmap */ + char *data; /* pointer to image data */ + int byte_order; /* data byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* quant. of scanline 8, 16, 32 */ + int bitmap_bit_order; /* LSBFirst, MSBFirst */ + int bitmap_pad; /* 8, 16, 32 either XY or ZPixmap */ + int depth; /* depth of image */ + int bytes_per_line; /* accelarator to next line */ + int bits_per_pixel; /* bits per pixel (ZPixmap) */ + unsigned long red_mask; /* bits in z arrangment */ + unsigned long green_mask; + unsigned long blue_mask; + XPointer obdata; /* hook for the object routines to hang on */ + struct funcs { /* image manipulation routines */ + struct _XImage *(*create_image)( + struct _XDisplay* /* display */, + Visual* /* visual */, + unsigned int /* depth */, + int /* format */, + int /* offset */, + char* /* data */, + unsigned int /* width */, + unsigned int /* height */, + int /* bitmap_pad */, + int /* bytes_per_line */); + int (*destroy_image) (struct _XImage *); + unsigned long (*get_pixel) (struct _XImage *, int, int); + int (*put_pixel) (struct _XImage *, int, int, unsigned long); + struct _XImage *(*sub_image)(struct _XImage *, int, int, unsigned int, unsigned int); + int (*add_pixel) (struct _XImage *, long); + } f; +} XImage; + +/* + * Data structure for XReconfigureWindow + */ +typedef struct { + int x, y; + int width, height; + int border_width; + Window sibling; + int stack_mode; +} XWindowChanges; + +/* + * Data structure used by color operations + */ +typedef struct { + unsigned long pixel; + unsigned short red, green, blue; + char flags; /* do_red, do_green, do_blue */ + char pad; +} XColor; + +/* + * Data structures for graphics operations. On most machines, these are + * congruent with the wire protocol structures, so reformatting the data + * can be avoided on these architectures. + */ +typedef struct { + short x1, y1, x2, y2; +} XSegment; + +typedef struct { + short x, y; +} XPoint; + +typedef struct { + short x, y; + unsigned short width, height; +} XRectangle; + +typedef struct { + short x, y; + unsigned short width, height; + short angle1, angle2; +} XArc; + + +/* Data structure for XChangeKeyboardControl */ + +typedef struct { + int key_click_percent; + int bell_percent; + int bell_pitch; + int bell_duration; + int led; + int led_mode; + int key; + int auto_repeat_mode; /* On, Off, Default */ +} XKeyboardControl; + +/* Data structure for XGetKeyboardControl */ + +typedef struct { + int key_click_percent; + int bell_percent; + unsigned int bell_pitch, bell_duration; + unsigned long led_mask; + int global_auto_repeat; + char auto_repeats[32]; +} XKeyboardState; + +/* Data structure for XGetMotionEvents. */ + +typedef struct { + Time time; + short x, y; +} XTimeCoord; + +/* Data structure for X{Set,Get}ModifierMapping */ + +typedef struct { + int max_keypermod; /* The server's max # of keys per modifier */ + KeyCode *modifiermap; /* An 8 by max_keypermod array of modifiers */ +} XModifierKeymap; + + +/* + * Display datatype maintaining display specific data. + * The contents of this structure are implementation dependent. + * A Display should be treated as opaque by application code. + */ +#ifndef XLIB_ILLEGAL_ACCESS +typedef struct _XDisplay Display; +#endif + +struct _XPrivate; /* Forward declare before use for C++ */ +struct _XrmHashBucketRec; + +typedef struct +#ifdef XLIB_ILLEGAL_ACCESS +_XDisplay +#endif +{ + XExtData *ext_data; /* hook for extension to hang data */ + struct _XPrivate *private1; + int fd; /* Network socket. */ + int private2; + int proto_major_version;/* major version of server's X protocol */ + int proto_minor_version;/* minor version of servers X protocol */ + char *vendor; /* vendor of the server hardware */ + XID private3; + XID private4; + XID private5; + int private6; + XID (*resource_alloc)( /* allocator function */ + struct _XDisplay* + ); + int byte_order; /* screen byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* padding and data requirements */ + int bitmap_pad; /* padding requirements on bitmaps */ + int bitmap_bit_order; /* LeastSignificant or MostSignificant */ + int nformats; /* number of pixmap formats in list */ + ScreenFormat *pixmap_format; /* pixmap format list */ + int private8; + int release; /* release of the server */ + struct _XPrivate *private9, *private10; + int qlen; /* Length of input event queue */ + unsigned long last_request_read; /* seq number of last event read */ + unsigned long request; /* sequence number of last request. */ + XPointer private11; + XPointer private12; + XPointer private13; + XPointer private14; + unsigned max_request_size; /* maximum number 32 bit words in request*/ + struct _XrmHashBucketRec *db; + int (*private15)( + struct _XDisplay* + ); + char *display_name; /* "host:display" string used on this connect*/ + int default_screen; /* default screen for operations */ + int nscreens; /* number of screens on this server*/ + Screen *screens; /* pointer to list of screens */ + unsigned long motion_buffer; /* size of motion buffer */ + unsigned long private16; + int min_keycode; /* minimum defined keycode */ + int max_keycode; /* maximum defined keycode */ + XPointer private17; + XPointer private18; + int private19; + char *xdefaults; /* contents of defaults from server */ + /* there is more to this structure, but it is private to Xlib */ +} +#ifdef XLIB_ILLEGAL_ACCESS +Display, +#endif +*_XPrivDisplay; + +#undef _XEVENT_ +#ifndef _XEVENT_ +/* + * Definitions of specific events. + */ +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window it is reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + unsigned int state; /* key or button mask */ + unsigned int keycode; /* detail */ + Bool same_screen; /* same screen flag */ +} XKeyEvent; +typedef XKeyEvent XKeyPressedEvent; +typedef XKeyEvent XKeyReleasedEvent; + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window it is reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + unsigned int state; /* key or button mask */ + unsigned int button; /* detail */ + Bool same_screen; /* same screen flag */ +} XButtonEvent; +typedef XButtonEvent XButtonPressedEvent; +typedef XButtonEvent XButtonReleasedEvent; + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + unsigned int state; /* key or button mask */ + char is_hint; /* detail */ + Bool same_screen; /* same screen flag */ +} XMotionEvent; +typedef XMotionEvent XPointerMovedEvent; + +typedef struct { + int type; /* of event */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* "event" window reported relative to */ + Window root; /* root window that the event occurred on */ + Window subwindow; /* child window */ + Time time; /* milliseconds */ + int x, y; /* pointer x, y coordinates in event window */ + int x_root, y_root; /* coordinates relative to root */ + int mode; /* NotifyNormal, NotifyGrab, NotifyUngrab */ + int detail; + /* + * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyNonlinear,NotifyNonlinearVirtual + */ + Bool same_screen; /* same screen flag */ + Bool focus; /* boolean focus */ + unsigned int state; /* key or button mask */ +} XCrossingEvent; +typedef XCrossingEvent XEnterWindowEvent; +typedef XCrossingEvent XLeaveWindowEvent; + +typedef struct { + int type; /* FocusIn or FocusOut */ + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* window of event */ + int mode; /* NotifyNormal, NotifyWhileGrabbed, + NotifyGrab, NotifyUngrab */ + int detail; + /* + * NotifyAncestor, NotifyVirtual, NotifyInferior, + * NotifyNonlinear,NotifyNonlinearVirtual, NotifyPointer, + * NotifyPointerRoot, NotifyDetailNone + */ +} XFocusChangeEvent; +typedef XFocusChangeEvent XFocusInEvent; +typedef XFocusChangeEvent XFocusOutEvent; + +/* generated on EnterWindow and FocusIn when KeyMapState selected */ +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + char key_vector[32]; +} XKeymapEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + int x, y; + int width, height; + int count; /* if non-zero, at least this many more */ +} XExposeEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Drawable drawable; + int x, y; + int width, height; + int count; /* if non-zero, at least this many more */ + int major_code; /* core is CopyArea or CopyPlane */ + int minor_code; /* not defined in the core */ +} XGraphicsExposeEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Drawable drawable; + int major_code; /* core is CopyArea or CopyPlane */ + int minor_code; /* not defined in the core */ +} XNoExposeEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + int state; /* Visibility state */ +} XVisibilityEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; /* parent of the window */ + Window window; /* window id of window created */ + int x, y; /* window location */ + int width, height; /* size of window */ + int border_width; /* border width */ + Bool override_redirect; /* creation should be overridden */ +} XCreateWindowEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; +} XDestroyWindowEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + Bool from_configure; +} XUnmapEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + Bool override_redirect; /* boolean, is override set... */ +} XMapEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; + Window window; +} XMapRequestEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + Window parent; + int x, y; + Bool override_redirect; +} XReparentEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + int x, y; + int width, height; + int border_width; + Window above; + Bool override_redirect; +} XConfigureEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + int x, y; +} XGravityEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + int width, height; +} XResizeRequestEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; + Window window; + int x, y; + int width, height; + int border_width; + Window above; + int detail; /* Above, Below, TopIf, BottomIf, Opposite */ + unsigned long value_mask; +} XConfigureRequestEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window event; + Window window; + int place; /* PlaceOnTop, PlaceOnBottom */ +} XCirculateEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window parent; + Window window; + int place; /* PlaceOnTop, PlaceOnBottom */ +} XCirculateRequestEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Atom atom; + Time time; + int state; /* NewValue, Deleted */ +} XPropertyEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Atom selection; + Time time; +} XSelectionClearEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window owner; + Window requestor; + Atom selection; + Atom target; + Atom property; + Time time; +} XSelectionRequestEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window requestor; + Atom selection; + Atom target; + Atom property; /* ATOM or None */ + Time time; +} XSelectionEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Colormap colormap; /* COLORMAP or None */ +#if defined(__cplusplus) || defined(c_plusplus) + Bool c_new; /* C++ */ +#else + Bool new; +#endif + int state; /* ColormapInstalled, ColormapUninstalled */ +} XColormapEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; + Atom message_type; + int format; + union { + char b[20]; + short s[10]; + long l[5]; + } data; +} XClientMessageEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display; /* Display the event was read from */ + Window window; /* unused */ + int request; /* one of MappingModifier, MappingKeyboard, + MappingPointer */ + int first_keycode; /* first keycode */ + int count; /* defines range of change w. first_keycode*/ +} XMappingEvent; + +typedef struct { + int type; + Display *display; /* Display the event was read from */ + XID resourceid; /* resource id */ + unsigned long serial; /* serial number of failed request */ + unsigned char error_code; /* error code of failed request */ + unsigned char request_code; /* Major op-code of failed request */ + unsigned char minor_code; /* Minor op-code of failed request */ +} XErrorEvent; + +typedef struct { + int type; + unsigned long serial; /* # of last request processed by server */ + Bool send_event; /* true if this came from a SendEvent request */ + Display *display;/* Display the event was read from */ + Window window; /* window on which event was requested in event mask */ +} XAnyEvent; + + +/*************************************************************** + * + * GenericEvent. This event is the standard event for all newer extensions. + */ + +typedef struct + { + int type; /* of event. Always GenericEvent */ + unsigned long serial; /* # of last request processed */ + Bool send_event; /* true if from SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* major opcode of extension that caused the event */ + int evtype; /* actual event type. */ + } XGenericEvent; + +typedef struct { + int type; /* of event. Always GenericEvent */ + unsigned long serial; /* # of last request processed */ + Bool send_event; /* true if from SendEvent request */ + Display *display; /* Display the event was read from */ + int extension; /* major opcode of extension that caused the event */ + int evtype; /* actual event type. */ + unsigned int cookie; + void *data; +} XGenericEventCookie; + +/* + * this union is defined so Xlib can always use the same sized + * event structure internally, to avoid memory fragmentation. + */ +typedef union _XEvent { + int type; /* must not be changed; first element */ + XAnyEvent xany; + XKeyEvent xkey; + XButtonEvent xbutton; + XMotionEvent xmotion; + XCrossingEvent xcrossing; + XFocusChangeEvent xfocus; + XExposeEvent xexpose; + XGraphicsExposeEvent xgraphicsexpose; + XNoExposeEvent xnoexpose; + XVisibilityEvent xvisibility; + XCreateWindowEvent xcreatewindow; + XDestroyWindowEvent xdestroywindow; + XUnmapEvent xunmap; + XMapEvent xmap; + XMapRequestEvent xmaprequest; + XReparentEvent xreparent; + XConfigureEvent xconfigure; + XGravityEvent xgravity; + XResizeRequestEvent xresizerequest; + XConfigureRequestEvent xconfigurerequest; + XCirculateEvent xcirculate; + XCirculateRequestEvent xcirculaterequest; + XPropertyEvent xproperty; + XSelectionClearEvent xselectionclear; + XSelectionRequestEvent xselectionrequest; + XSelectionEvent xselection; + XColormapEvent xcolormap; + XClientMessageEvent xclient; + XMappingEvent xmapping; + XErrorEvent xerror; + XKeymapEvent xkeymap; + XGenericEvent xgeneric; + XGenericEventCookie xcookie; + long pad[24]; +} XEvent; +#endif + +#define XAllocID(dpy) ((*((_XPrivDisplay)(dpy))->resource_alloc)((dpy))) + +/* + * per character font metric information. + */ +typedef struct { + short lbearing; /* origin to left edge of raster */ + short rbearing; /* origin to right edge of raster */ + short width; /* advance to next char's origin */ + short ascent; /* baseline to top edge of raster */ + short descent; /* baseline to bottom edge of raster */ + unsigned short attributes; /* per char flags (not predefined) */ +} XCharStruct; + +/* + * To allow arbitrary information with fonts, there are additional properties + * returned. + */ +typedef struct { + Atom name; + unsigned long card32; +} XFontProp; + +typedef struct { + XExtData *ext_data; /* hook for extension to hang data */ + Font fid; /* Font id for this font */ + unsigned direction; /* hint about direction the font is painted */ + unsigned min_char_or_byte2;/* first character */ + unsigned max_char_or_byte2;/* last character */ + unsigned min_byte1; /* first row that exists */ + unsigned max_byte1; /* last row that exists */ + Bool all_chars_exist;/* flag if all characters have non-zero size*/ + unsigned default_char; /* char to print for undefined character */ + int n_properties; /* how many properties there are */ + XFontProp *properties; /* pointer to array of additional properties*/ + XCharStruct min_bounds; /* minimum bounds over all existing char*/ + XCharStruct max_bounds; /* maximum bounds over all existing char*/ + XCharStruct *per_char; /* first_char to last_char information */ + int ascent; /* log. extent above baseline for spacing */ + int descent; /* log. descent below baseline for spacing */ +} XFontStruct; + +/* + * PolyText routines take these as arguments. + */ +typedef struct { + char *chars; /* pointer to string */ + int nchars; /* number of characters */ + int delta; /* delta between strings */ + Font font; /* font to print it in, None don't change */ +} XTextItem; + +typedef struct { /* normal 16 bit characters are two bytes */ + unsigned char byte1; + unsigned char byte2; +} XChar2b; + +typedef struct { + XChar2b *chars; /* two byte characters */ + int nchars; /* number of characters */ + int delta; /* delta between strings */ + Font font; /* font to print it in, None don't change */ +} XTextItem16; + + +typedef union { Display *display; + GC gc; + Visual *visual; + Screen *screen; + ScreenFormat *pixmap_format; + XFontStruct *font; } XEDataObject; + +typedef struct { + XRectangle max_ink_extent; + XRectangle max_logical_extent; +} XFontSetExtents; + +/* unused: +typedef void (*XOMProc)(); + */ + +typedef struct _XOM *XOM; +typedef struct _XOC *XOC, *XFontSet; + +typedef struct { + char *chars; + int nchars; + int delta; + XFontSet font_set; +} XmbTextItem; + +typedef struct { + wchar_t *chars; + int nchars; + int delta; + XFontSet font_set; +} XwcTextItem; + +#define XNRequiredCharSet "requiredCharSet" +#define XNQueryOrientation "queryOrientation" +#define XNBaseFontName "baseFontName" +#define XNOMAutomatic "omAutomatic" +#define XNMissingCharSet "missingCharSet" +#define XNDefaultString "defaultString" +#define XNOrientation "orientation" +#define XNDirectionalDependentDrawing "directionalDependentDrawing" +#define XNContextualDrawing "contextualDrawing" +#define XNFontInfo "fontInfo" + +typedef struct { + int charset_count; + char **charset_list; +} XOMCharSetList; + +typedef enum { + XOMOrientation_LTR_TTB, + XOMOrientation_RTL_TTB, + XOMOrientation_TTB_LTR, + XOMOrientation_TTB_RTL, + XOMOrientation_Context +} XOrientation; + +typedef struct { + int num_orientation; + XOrientation *orientation; /* Input Text description */ +} XOMOrientation; + +typedef struct { + int num_font; + XFontStruct **font_struct_list; + char **font_name_list; +} XOMFontInfo; + +typedef struct _XIM *XIM; +typedef struct _XIC *XIC; + +typedef void (*XIMProc)( + XIM, + XPointer, + XPointer +); + +typedef Bool (*XICProc)( + XIC, + XPointer, + XPointer +); + +typedef void (*XIDProc)( + Display*, + XPointer, + XPointer +); + +typedef unsigned long XIMStyle; + +typedef struct { + unsigned short count_styles; + XIMStyle *supported_styles; +} XIMStyles; + +#define XIMPreeditArea 0x0001L +#define XIMPreeditCallbacks 0x0002L +#define XIMPreeditPosition 0x0004L +#define XIMPreeditNothing 0x0008L +#define XIMPreeditNone 0x0010L +#define XIMStatusArea 0x0100L +#define XIMStatusCallbacks 0x0200L +#define XIMStatusNothing 0x0400L +#define XIMStatusNone 0x0800L + +#define XNVaNestedList "XNVaNestedList" +#define XNQueryInputStyle "queryInputStyle" +#define XNClientWindow "clientWindow" +#define XNInputStyle "inputStyle" +#define XNFocusWindow "focusWindow" +#define XNResourceName "resourceName" +#define XNResourceClass "resourceClass" +#define XNGeometryCallback "geometryCallback" +#define XNDestroyCallback "destroyCallback" +#define XNFilterEvents "filterEvents" +#define XNPreeditStartCallback "preeditStartCallback" +#define XNPreeditDoneCallback "preeditDoneCallback" +#define XNPreeditDrawCallback "preeditDrawCallback" +#define XNPreeditCaretCallback "preeditCaretCallback" +#define XNPreeditStateNotifyCallback "preeditStateNotifyCallback" +#define XNPreeditAttributes "preeditAttributes" +#define XNStatusStartCallback "statusStartCallback" +#define XNStatusDoneCallback "statusDoneCallback" +#define XNStatusDrawCallback "statusDrawCallback" +#define XNStatusAttributes "statusAttributes" +#define XNArea "area" +#define XNAreaNeeded "areaNeeded" +#define XNSpotLocation "spotLocation" +#define XNColormap "colorMap" +#define XNStdColormap "stdColorMap" +#define XNForeground "foreground" +#define XNBackground "background" +#define XNBackgroundPixmap "backgroundPixmap" +#define XNFontSet "fontSet" +#define XNLineSpace "lineSpace" +#define XNCursor "cursor" + +#define XNQueryIMValuesList "queryIMValuesList" +#define XNQueryICValuesList "queryICValuesList" +#define XNVisiblePosition "visiblePosition" +#define XNR6PreeditCallback "r6PreeditCallback" +#define XNStringConversionCallback "stringConversionCallback" +#define XNStringConversion "stringConversion" +#define XNResetState "resetState" +#define XNHotKey "hotKey" +#define XNHotKeyState "hotKeyState" +#define XNPreeditState "preeditState" +#define XNSeparatorofNestedList "separatorofNestedList" + +#define XBufferOverflow -1 +#define XLookupNone 1 +#define XLookupChars 2 +#define XLookupKeySym 3 +#define XLookupBoth 4 + +typedef void *XVaNestedList; + +typedef struct { + XPointer client_data; + XIMProc callback; +} XIMCallback; + +typedef struct { + XPointer client_data; + XICProc callback; +} XICCallback; + +typedef unsigned long XIMFeedback; + +#define XIMReverse 1L +#define XIMUnderline (1L<<1) +#define XIMHighlight (1L<<2) +#define XIMPrimary (1L<<5) +#define XIMSecondary (1L<<6) +#define XIMTertiary (1L<<7) +#define XIMVisibleToForward (1L<<8) +#define XIMVisibleToBackword (1L<<9) +#define XIMVisibleToCenter (1L<<10) + +typedef struct _XIMText { + unsigned short length; + XIMFeedback *feedback; + Bool encoding_is_wchar; + union { + char *multi_byte; + wchar_t *wide_char; + } string; +} XIMText; + +typedef unsigned long XIMPreeditState; + +#define XIMPreeditUnKnown 0L +#define XIMPreeditEnable 1L +#define XIMPreeditDisable (1L<<1) + +typedef struct _XIMPreeditStateNotifyCallbackStruct { + XIMPreeditState state; +} XIMPreeditStateNotifyCallbackStruct; + +typedef unsigned long XIMResetState; + +#define XIMInitialState 1L +#define XIMPreserveState (1L<<1) + +typedef unsigned long XIMStringConversionFeedback; + +#define XIMStringConversionLeftEdge (0x00000001) +#define XIMStringConversionRightEdge (0x00000002) +#define XIMStringConversionTopEdge (0x00000004) +#define XIMStringConversionBottomEdge (0x00000008) +#define XIMStringConversionConcealed (0x00000010) +#define XIMStringConversionWrapped (0x00000020) + +typedef struct _XIMStringConversionText { + unsigned short length; + XIMStringConversionFeedback *feedback; + Bool encoding_is_wchar; + union { + char *mbs; + wchar_t *wcs; + } string; +} XIMStringConversionText; + +typedef unsigned short XIMStringConversionPosition; + +typedef unsigned short XIMStringConversionType; + +#define XIMStringConversionBuffer (0x0001) +#define XIMStringConversionLine (0x0002) +#define XIMStringConversionWord (0x0003) +#define XIMStringConversionChar (0x0004) + +typedef unsigned short XIMStringConversionOperation; + +#define XIMStringConversionSubstitution (0x0001) +#define XIMStringConversionRetrieval (0x0002) + +typedef enum { + XIMForwardChar, XIMBackwardChar, + XIMForwardWord, XIMBackwardWord, + XIMCaretUp, XIMCaretDown, + XIMNextLine, XIMPreviousLine, + XIMLineStart, XIMLineEnd, + XIMAbsolutePosition, + XIMDontChange +} XIMCaretDirection; + +typedef struct _XIMStringConversionCallbackStruct { + XIMStringConversionPosition position; + XIMCaretDirection direction; + XIMStringConversionOperation operation; + unsigned short factor; + XIMStringConversionText *text; +} XIMStringConversionCallbackStruct; + +typedef struct _XIMPreeditDrawCallbackStruct { + int caret; /* Cursor offset within pre-edit string */ + int chg_first; /* Starting change position */ + int chg_length; /* Length of the change in character count */ + XIMText *text; +} XIMPreeditDrawCallbackStruct; + +typedef enum { + XIMIsInvisible, /* Disable caret feedback */ + XIMIsPrimary, /* UI defined caret feedback */ + XIMIsSecondary /* UI defined caret feedback */ +} XIMCaretStyle; + +typedef struct _XIMPreeditCaretCallbackStruct { + int position; /* Caret offset within pre-edit string */ + XIMCaretDirection direction; /* Caret moves direction */ + XIMCaretStyle style; /* Feedback of the caret */ +} XIMPreeditCaretCallbackStruct; + +typedef enum { + XIMTextType, + XIMBitmapType +} XIMStatusDataType; + +typedef struct _XIMStatusDrawCallbackStruct { + XIMStatusDataType type; + union { + XIMText *text; + Pixmap bitmap; + } data; +} XIMStatusDrawCallbackStruct; + +typedef struct _XIMHotKeyTrigger { + KeySym keysym; + int modifier; + int modifier_mask; +} XIMHotKeyTrigger; + +typedef struct _XIMHotKeyTriggers { + int num_hot_key; + XIMHotKeyTrigger *key; +} XIMHotKeyTriggers; + +typedef unsigned long XIMHotKeyState; + +#define XIMHotKeyStateON (0x0001L) +#define XIMHotKeyStateOFF (0x0002L) + +typedef struct { + unsigned short count_values; + char **supported_values; +} XIMValuesList; + +_XFUNCPROTOBEGIN + +#if defined(WIN32) && !defined(_XLIBINT_) +#define _Xdebug (*_Xdebug_p) +#endif + +extern int _Xdebug; + +extern XFontStruct *XLoadQueryFont( + Display* /* display */, + _Xconst char* /* name */ +); + +extern XFontStruct *XQueryFont( + Display* /* display */, + XID /* font_ID */ +); + + +extern XTimeCoord *XGetMotionEvents( + Display* /* display */, + Window /* w */, + Time /* start */, + Time /* stop */, + int* /* nevents_return */ +); + +extern XModifierKeymap *XDeleteModifiermapEntry( + XModifierKeymap* /* modmap */, +#if NeedWidePrototypes + unsigned int /* keycode_entry */, +#else + KeyCode /* keycode_entry */, +#endif + int /* modifier */ +); + +extern XModifierKeymap *XGetModifierMapping( + Display* /* display */ +); + +extern XModifierKeymap *XInsertModifiermapEntry( + XModifierKeymap* /* modmap */, +#if NeedWidePrototypes + unsigned int /* keycode_entry */, +#else + KeyCode /* keycode_entry */, +#endif + int /* modifier */ +); + +extern XModifierKeymap *XNewModifiermap( + int /* max_keys_per_mod */ +); + +extern XImage *XCreateImage( + Display* /* display */, + Visual* /* visual */, + unsigned int /* depth */, + int /* format */, + int /* offset */, + char* /* data */, + unsigned int /* width */, + unsigned int /* height */, + int /* bitmap_pad */, + int /* bytes_per_line */ +); +extern Status XInitImage( + XImage* /* image */ +); +extern XImage *XGetImage( + Display* /* display */, + Drawable /* d */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned long /* plane_mask */, + int /* format */ +); +extern XImage *XGetSubImage( + Display* /* display */, + Drawable /* d */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned long /* plane_mask */, + int /* format */, + XImage* /* dest_image */, + int /* dest_x */, + int /* dest_y */ +); + +/* + * X function declarations. + */ +extern Display *XOpenDisplay( + _Xconst char* /* display_name */ +); + +extern void XrmInitialize( + void +); + +extern char *XFetchBytes( + Display* /* display */, + int* /* nbytes_return */ +); +extern char *XFetchBuffer( + Display* /* display */, + int* /* nbytes_return */, + int /* buffer */ +); +extern char *XGetAtomName( + Display* /* display */, + Atom /* atom */ +); +extern Status XGetAtomNames( + Display* /* dpy */, + Atom* /* atoms */, + int /* count */, + char** /* names_return */ +); +extern char *XGetDefault( + Display* /* display */, + _Xconst char* /* program */, + _Xconst char* /* option */ +); +extern char *XDisplayName( + _Xconst char* /* string */ +); +extern char *XKeysymToString( + KeySym /* keysym */ +); + +extern int (*XSynchronize( + Display* /* display */, + Bool /* onoff */ +))( + Display* /* display */ +); +extern int (*XSetAfterFunction( + Display* /* display */, + int (*) ( + Display* /* display */ + ) /* procedure */ +))( + Display* /* display */ +); +extern Atom XInternAtom( + Display* /* display */, + _Xconst char* /* atom_name */, + Bool /* only_if_exists */ +); +extern Status XInternAtoms( + Display* /* dpy */, + char** /* names */, + int /* count */, + Bool /* onlyIfExists */, + Atom* /* atoms_return */ +); +extern Colormap XCopyColormapAndFree( + Display* /* display */, + Colormap /* colormap */ +); +extern Colormap XCreateColormap( + Display* /* display */, + Window /* w */, + Visual* /* visual */, + int /* alloc */ +); +extern Cursor XCreatePixmapCursor( + Display* /* display */, + Pixmap /* source */, + Pixmap /* mask */, + XColor* /* foreground_color */, + XColor* /* background_color */, + unsigned int /* x */, + unsigned int /* y */ +); +extern Cursor XCreateGlyphCursor( + Display* /* display */, + Font /* source_font */, + Font /* mask_font */, + unsigned int /* source_char */, + unsigned int /* mask_char */, + XColor _Xconst * /* foreground_color */, + XColor _Xconst * /* background_color */ +); +extern Cursor XCreateFontCursor( + Display* /* display */, + unsigned int /* shape */ +); +extern Font XLoadFont( + Display* /* display */, + _Xconst char* /* name */ +); +extern GC XCreateGC( + Display* /* display */, + Drawable /* d */, + unsigned long /* valuemask */, + XGCValues* /* values */ +); +extern GContext XGContextFromGC( + GC /* gc */ +); +extern void XFlushGC( + Display* /* display */, + GC /* gc */ +); +extern Pixmap XCreatePixmap( + Display* /* display */, + Drawable /* d */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int /* depth */ +); +extern Pixmap XCreateBitmapFromData( + Display* /* display */, + Drawable /* d */, + _Xconst char* /* data */, + unsigned int /* width */, + unsigned int /* height */ +); +extern Pixmap XCreatePixmapFromBitmapData( + Display* /* display */, + Drawable /* d */, + char* /* data */, + unsigned int /* width */, + unsigned int /* height */, + unsigned long /* fg */, + unsigned long /* bg */, + unsigned int /* depth */ +); +extern Window XCreateSimpleWindow( + Display* /* display */, + Window /* parent */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int /* border_width */, + unsigned long /* border */, + unsigned long /* background */ +); +extern Window XGetSelectionOwner( + Display* /* display */, + Atom /* selection */ +); +extern Window XCreateWindow( + Display* /* display */, + Window /* parent */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int /* border_width */, + int /* depth */, + unsigned int /* class */, + Visual* /* visual */, + unsigned long /* valuemask */, + XSetWindowAttributes* /* attributes */ +); +extern Colormap *XListInstalledColormaps( + Display* /* display */, + Window /* w */, + int* /* num_return */ +); +extern char **XListFonts( + Display* /* display */, + _Xconst char* /* pattern */, + int /* maxnames */, + int* /* actual_count_return */ +); +extern char **XListFontsWithInfo( + Display* /* display */, + _Xconst char* /* pattern */, + int /* maxnames */, + int* /* count_return */, + XFontStruct** /* info_return */ +); +extern char **XGetFontPath( + Display* /* display */, + int* /* npaths_return */ +); +extern char **XListExtensions( + Display* /* display */, + int* /* nextensions_return */ +); +extern Atom *XListProperties( + Display* /* display */, + Window /* w */, + int* /* num_prop_return */ +); +extern XHostAddress *XListHosts( + Display* /* display */, + int* /* nhosts_return */, + Bool* /* state_return */ +); + +/* this is marked as_X_DEPRECATED in Xorg's upstream libX11 but NX + needs it for performance reasons. Should be moved into the + server. */ +extern KeySym XKeycodeToKeysym( + Display* /* display */, +#if NeedWidePrototypes + unsigned int /* keycode */, +#else + KeyCode /* keycode */, +#endif + int /* index */ +); +extern KeySym XLookupKeysym( + XKeyEvent* /* key_event */, + int /* index */ +); +extern KeySym *XGetKeyboardMapping( + Display* /* display */, +#if NeedWidePrototypes + unsigned int /* first_keycode */, +#else + KeyCode /* first_keycode */, +#endif + int /* keycode_count */, + int* /* keysyms_per_keycode_return */ +); +extern KeySym XStringToKeysym( + _Xconst char* /* string */ +); +extern long XMaxRequestSize( + Display* /* display */ +); +extern long XExtendedMaxRequestSize( + Display* /* display */ +); +extern char *XResourceManagerString( + Display* /* display */ +); +extern char *XScreenResourceString( + Screen* /* screen */ +); +extern unsigned long XDisplayMotionBufferSize( + Display* /* display */ +); +extern VisualID XVisualIDFromVisual( + Visual* /* visual */ +); + +/* multithread routines */ + +extern Status XInitThreads( + void +); + +extern void XLockDisplay( + Display* /* display */ +); + +extern void XUnlockDisplay( + Display* /* display */ +); + +/* routines for dealing with extensions */ + +extern XExtCodes *XInitExtension( + Display* /* display */, + _Xconst char* /* name */ +); + +extern XExtCodes *XAddExtension( + Display* /* display */ +); +extern XExtData *XFindOnExtensionList( + XExtData** /* structure */, + int /* number */ +); +extern XExtData **XEHeadOfExtensionList( + XEDataObject /* object */ +); + +/* these are routines for which there are also macros */ +extern Window XRootWindow( + Display* /* display */, + int /* screen_number */ +); +extern Window XDefaultRootWindow( + Display* /* display */ +); +extern Window XRootWindowOfScreen( + Screen* /* screen */ +); +extern Visual *XDefaultVisual( + Display* /* display */, + int /* screen_number */ +); +extern Visual *XDefaultVisualOfScreen( + Screen* /* screen */ +); +extern GC XDefaultGC( + Display* /* display */, + int /* screen_number */ +); +extern GC XDefaultGCOfScreen( + Screen* /* screen */ +); +extern unsigned long XBlackPixel( + Display* /* display */, + int /* screen_number */ +); +extern unsigned long XWhitePixel( + Display* /* display */, + int /* screen_number */ +); +extern unsigned long XAllPlanes( + void +); +extern unsigned long XBlackPixelOfScreen( + Screen* /* screen */ +); +extern unsigned long XWhitePixelOfScreen( + Screen* /* screen */ +); +extern unsigned long XNextRequest( + Display* /* display */ +); +extern unsigned long XLastKnownRequestProcessed( + Display* /* display */ +); +extern char *XServerVendor( + Display* /* display */ +); +extern char *XDisplayString( + Display* /* display */ +); +extern Colormap XDefaultColormap( + Display* /* display */, + int /* screen_number */ +); +extern Colormap XDefaultColormapOfScreen( + Screen* /* screen */ +); +extern Display *XDisplayOfScreen( + Screen* /* screen */ +); +extern Screen *XScreenOfDisplay( + Display* /* display */, + int /* screen_number */ +); +extern Screen *XDefaultScreenOfDisplay( + Display* /* display */ +); +extern long XEventMaskOfScreen( + Screen* /* screen */ +); + +extern int XScreenNumberOfScreen( + Screen* /* screen */ +); + +typedef int (*XErrorHandler) ( /* WARNING, this type not in Xlib spec */ + Display* /* display */, + XErrorEvent* /* error_event */ +); + +extern XErrorHandler XSetErrorHandler ( + XErrorHandler /* handler */ +); + + +typedef int (*XIOErrorHandler) ( /* WARNING, this type not in Xlib spec */ + Display* /* display */ +); + +extern XIOErrorHandler XSetIOErrorHandler ( + XIOErrorHandler /* handler */ +); + + +extern XPixmapFormatValues *XListPixmapFormats( + Display* /* display */, + int* /* count_return */ +); +extern int *XListDepths( + Display* /* display */, + int /* screen_number */, + int* /* count_return */ +); + +/* ICCCM routines for things that don't require special include files; */ +/* other declarations are given in Xutil.h */ +extern Status XReconfigureWMWindow( + Display* /* display */, + Window /* w */, + int /* screen_number */, + unsigned int /* mask */, + XWindowChanges* /* changes */ +); + +extern Status XGetWMProtocols( + Display* /* display */, + Window /* w */, + Atom** /* protocols_return */, + int* /* count_return */ +); +extern Status XSetWMProtocols( + Display* /* display */, + Window /* w */, + Atom* /* protocols */, + int /* count */ +); +extern Status XIconifyWindow( + Display* /* display */, + Window /* w */, + int /* screen_number */ +); +extern Status XWithdrawWindow( + Display* /* display */, + Window /* w */, + int /* screen_number */ +); +extern Status XGetCommand( + Display* /* display */, + Window /* w */, + char*** /* argv_return */, + int* /* argc_return */ +); +extern Status XGetWMColormapWindows( + Display* /* display */, + Window /* w */, + Window** /* windows_return */, + int* /* count_return */ +); +extern Status XSetWMColormapWindows( + Display* /* display */, + Window /* w */, + Window* /* colormap_windows */, + int /* count */ +); +extern void XFreeStringList( + char** /* list */ +); +extern int XSetTransientForHint( + Display* /* display */, + Window /* w */, + Window /* prop_window */ +); + +/* The following are given in alphabetical order */ + +extern int XActivateScreenSaver( + Display* /* display */ +); + +extern int XAddHost( + Display* /* display */, + XHostAddress* /* host */ +); + +extern int XAddHosts( + Display* /* display */, + XHostAddress* /* hosts */, + int /* num_hosts */ +); + +extern int XAddToExtensionList( + struct _XExtData** /* structure */, + XExtData* /* ext_data */ +); + +extern int XAddToSaveSet( + Display* /* display */, + Window /* w */ +); + +extern Status XAllocColor( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */ +); + +extern Status XAllocColorCells( + Display* /* display */, + Colormap /* colormap */, + Bool /* contig */, + unsigned long* /* plane_masks_return */, + unsigned int /* nplanes */, + unsigned long* /* pixels_return */, + unsigned int /* npixels */ +); + +extern Status XAllocColorPlanes( + Display* /* display */, + Colormap /* colormap */, + Bool /* contig */, + unsigned long* /* pixels_return */, + int /* ncolors */, + int /* nreds */, + int /* ngreens */, + int /* nblues */, + unsigned long* /* rmask_return */, + unsigned long* /* gmask_return */, + unsigned long* /* bmask_return */ +); + +extern Status XAllocNamedColor( + Display* /* display */, + Colormap /* colormap */, + _Xconst char* /* color_name */, + XColor* /* screen_def_return */, + XColor* /* exact_def_return */ +); + +extern int XAllowEvents( + Display* /* display */, + int /* event_mode */, + Time /* time */ +); + +extern int XAutoRepeatOff( + Display* /* display */ +); + +extern int XAutoRepeatOn( + Display* /* display */ +); + +extern int XBell( + Display* /* display */, + int /* percent */ +); + +extern int XBitmapBitOrder( + Display* /* display */ +); + +extern int XBitmapPad( + Display* /* display */ +); + +extern int XBitmapUnit( + Display* /* display */ +); + +extern int XCellsOfScreen( + Screen* /* screen */ +); + +extern int XChangeActivePointerGrab( + Display* /* display */, + unsigned int /* event_mask */, + Cursor /* cursor */, + Time /* time */ +); + +extern int XChangeGC( + Display* /* display */, + GC /* gc */, + unsigned long /* valuemask */, + XGCValues* /* values */ +); + +extern int XChangeKeyboardControl( + Display* /* display */, + unsigned long /* value_mask */, + XKeyboardControl* /* values */ +); + +extern int XChangeKeyboardMapping( + Display* /* display */, + int /* first_keycode */, + int /* keysyms_per_keycode */, + KeySym* /* keysyms */, + int /* num_codes */ +); + +extern int XChangePointerControl( + Display* /* display */, + Bool /* do_accel */, + Bool /* do_threshold */, + int /* accel_numerator */, + int /* accel_denominator */, + int /* threshold */ +); + +extern int XChangeProperty( + Display* /* display */, + Window /* w */, + Atom /* property */, + Atom /* type */, + int /* format */, + int /* mode */, + _Xconst unsigned char* /* data */, + int /* nelements */ +); + +extern int XChangeSaveSet( + Display* /* display */, + Window /* w */, + int /* change_mode */ +); + +extern int XChangeWindowAttributes( + Display* /* display */, + Window /* w */, + unsigned long /* valuemask */, + XSetWindowAttributes* /* attributes */ +); + +extern Bool XCheckIfEvent( + Display* /* display */, + XEvent* /* event_return */, + Bool (*) ( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +#ifdef NX_TRANS_SOCKET + +/* + * This is just like XCheckIfEvent() but doesn't + * flush the output buffer if it can't read new + * events. + */ + +extern Bool XCheckIfEventNoFlush( + Display* /* display */, + XEvent* /* event_return */, + Bool (*) ( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +#endif + +extern Bool XCheckMaskEvent( + Display* /* display */, + long /* event_mask */, + XEvent* /* event_return */ +); + +extern Bool XCheckTypedEvent( + Display* /* display */, + int /* event_type */, + XEvent* /* event_return */ +); + +extern Bool XCheckTypedWindowEvent( + Display* /* display */, + Window /* w */, + int /* event_type */, + XEvent* /* event_return */ +); + +extern Bool XCheckWindowEvent( + Display* /* display */, + Window /* w */, + long /* event_mask */, + XEvent* /* event_return */ +); + +extern int XCirculateSubwindows( + Display* /* display */, + Window /* w */, + int /* direction */ +); + +extern int XCirculateSubwindowsDown( + Display* /* display */, + Window /* w */ +); + +extern int XCirculateSubwindowsUp( + Display* /* display */, + Window /* w */ +); + +extern int XClearArea( + Display* /* display */, + Window /* w */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + Bool /* exposures */ +); + +extern int XClearWindow( + Display* /* display */, + Window /* w */ +); + +extern int XCloseDisplay( + Display* /* display */ +); + +extern int XConfigureWindow( + Display* /* display */, + Window /* w */, + unsigned int /* value_mask */, + XWindowChanges* /* values */ +); + +extern int XConnectionNumber( + Display* /* display */ +); + +extern int XConvertSelection( + Display* /* display */, + Atom /* selection */, + Atom /* target */, + Atom /* property */, + Window /* requestor */, + Time /* time */ +); + +extern int XCopyArea( + Display* /* display */, + Drawable /* src */, + Drawable /* dest */, + GC /* gc */, + int /* src_x */, + int /* src_y */, + unsigned int /* width */, + unsigned int /* height */, + int /* dest_x */, + int /* dest_y */ +); + +extern int XCopyGC( + Display* /* display */, + GC /* src */, + unsigned long /* valuemask */, + GC /* dest */ +); + +extern int XCopyPlane( + Display* /* display */, + Drawable /* src */, + Drawable /* dest */, + GC /* gc */, + int /* src_x */, + int /* src_y */, + unsigned int /* width */, + unsigned int /* height */, + int /* dest_x */, + int /* dest_y */, + unsigned long /* plane */ +); + +extern int XDefaultDepth( + Display* /* display */, + int /* screen_number */ +); + +extern int XDefaultDepthOfScreen( + Screen* /* screen */ +); + +extern int XDefaultScreen( + Display* /* display */ +); + +extern int XDefineCursor( + Display* /* display */, + Window /* w */, + Cursor /* cursor */ +); + +extern int XDeleteProperty( + Display* /* display */, + Window /* w */, + Atom /* property */ +); + +extern int XDestroyWindow( + Display* /* display */, + Window /* w */ +); + +extern int XDestroySubwindows( + Display* /* display */, + Window /* w */ +); + +extern int XDoesBackingStore( + Screen* /* screen */ +); + +extern Bool XDoesSaveUnders( + Screen* /* screen */ +); + +extern int XDisableAccessControl( + Display* /* display */ +); + + +extern int XDisplayCells( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayHeight( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayHeightMM( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayKeycodes( + Display* /* display */, + int* /* min_keycodes_return */, + int* /* max_keycodes_return */ +); + +extern int XDisplayPlanes( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayWidth( + Display* /* display */, + int /* screen_number */ +); + +extern int XDisplayWidthMM( + Display* /* display */, + int /* screen_number */ +); + +extern int XDrawArc( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + int /* angle1 */, + int /* angle2 */ +); + +extern int XDrawArcs( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XArc* /* arcs */, + int /* narcs */ +); + +extern int XDrawImageString( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* string */, + int /* length */ +); + +extern int XDrawImageString16( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst XChar2b* /* string */, + int /* length */ +); + +extern int XDrawLine( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x1 */, + int /* y1 */, + int /* x2 */, + int /* y2 */ +); + +extern int XDrawLines( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XPoint* /* points */, + int /* npoints */, + int /* mode */ +); + +extern int XDrawPoint( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */ +); + +extern int XDrawPoints( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XPoint* /* points */, + int /* npoints */, + int /* mode */ +); + +extern int XDrawRectangle( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XDrawRectangles( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XRectangle* /* rectangles */, + int /* nrectangles */ +); + +extern int XDrawSegments( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XSegment* /* segments */, + int /* nsegments */ +); + +extern int XDrawString( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* string */, + int /* length */ +); + +extern int XDrawString16( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst XChar2b* /* string */, + int /* length */ +); + +extern int XDrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XTextItem* /* items */, + int /* nitems */ +); + +extern int XDrawText16( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XTextItem16* /* items */, + int /* nitems */ +); + +extern int XEnableAccessControl( + Display* /* display */ +); + +extern int XEventsQueued( + Display* /* display */, + int /* mode */ +); + +extern Status XFetchName( + Display* /* display */, + Window /* w */, + char** /* window_name_return */ +); + +extern int XFillArc( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */, + int /* angle1 */, + int /* angle2 */ +); + +extern int XFillArcs( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XArc* /* arcs */, + int /* narcs */ +); + +extern int XFillPolygon( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XPoint* /* points */, + int /* npoints */, + int /* shape */, + int /* mode */ +); + +extern int XFillRectangle( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XFillRectangles( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XRectangle* /* rectangles */, + int /* nrectangles */ +); + +extern int XFlush( + Display* /* display */ +); + +extern int XForceScreenSaver( + Display* /* display */, + int /* mode */ +); + +extern int XFree( + void* /* data */ +); + +extern int XFreeColormap( + Display* /* display */, + Colormap /* colormap */ +); + +extern int XFreeColors( + Display* /* display */, + Colormap /* colormap */, + unsigned long* /* pixels */, + int /* npixels */, + unsigned long /* planes */ +); + +extern int XFreeCursor( + Display* /* display */, + Cursor /* cursor */ +); + +extern int XFreeExtensionList( + char** /* list */ +); + +extern int XFreeFont( + Display* /* display */, + XFontStruct* /* font_struct */ +); + +extern int XFreeFontInfo( + char** /* names */, + XFontStruct* /* free_info */, + int /* actual_count */ +); + +extern int XFreeFontNames( + char** /* list */ +); + +extern int XFreeFontPath( + char** /* list */ +); + +extern int XFreeGC( + Display* /* display */, + GC /* gc */ +); + +extern int XFreeModifiermap( + XModifierKeymap* /* modmap */ +); + +extern int XFreePixmap( + Display* /* display */, + Pixmap /* pixmap */ +); + +extern int XGeometry( + Display* /* display */, + int /* screen */, + _Xconst char* /* position */, + _Xconst char* /* default_position */, + unsigned int /* bwidth */, + unsigned int /* fwidth */, + unsigned int /* fheight */, + int /* xadder */, + int /* yadder */, + int* /* x_return */, + int* /* y_return */, + int* /* width_return */, + int* /* height_return */ +); + +extern int XGetErrorDatabaseText( + Display* /* display */, + _Xconst char* /* name */, + _Xconst char* /* message */, + _Xconst char* /* default_string */, + char* /* buffer_return */, + int /* length */ +); + +extern int XGetErrorText( + Display* /* display */, + int /* code */, + char* /* buffer_return */, + int /* length */ +); + +extern Bool XGetFontProperty( + XFontStruct* /* font_struct */, + Atom /* atom */, + unsigned long* /* value_return */ +); + +extern Status XGetGCValues( + Display* /* display */, + GC /* gc */, + unsigned long /* valuemask */, + XGCValues* /* values_return */ +); + +extern Status XGetGeometry( + Display* /* display */, + Drawable /* d */, + Window* /* root_return */, + int* /* x_return */, + int* /* y_return */, + unsigned int* /* width_return */, + unsigned int* /* height_return */, + unsigned int* /* border_width_return */, + unsigned int* /* depth_return */ +); + +extern Status XGetIconName( + Display* /* display */, + Window /* w */, + char** /* icon_name_return */ +); + +extern int XGetInputFocus( + Display* /* display */, + Window* /* focus_return */, + int* /* revert_to_return */ +); + +extern int XGetKeyboardControl( + Display* /* display */, + XKeyboardState* /* values_return */ +); + +extern int XGetPointerControl( + Display* /* display */, + int* /* accel_numerator_return */, + int* /* accel_denominator_return */, + int* /* threshold_return */ +); + +extern int XGetPointerMapping( + Display* /* display */, + unsigned char* /* map_return */, + int /* nmap */ +); + +extern int XGetScreenSaver( + Display* /* display */, + int* /* timeout_return */, + int* /* interval_return */, + int* /* prefer_blanking_return */, + int* /* allow_exposures_return */ +); + +extern Status XGetTransientForHint( + Display* /* display */, + Window /* w */, + Window* /* prop_window_return */ +); + +extern int XGetWindowProperty( + Display* /* display */, + Window /* w */, + Atom /* property */, + long /* long_offset */, + long /* long_length */, + Bool /* delete */, + Atom /* req_type */, + Atom* /* actual_type_return */, + int* /* actual_format_return */, + unsigned long* /* nitems_return */, + unsigned long* /* bytes_after_return */, + unsigned char** /* prop_return */ +); + +extern Status XGetWindowAttributes( + Display* /* display */, + Window /* w */, + XWindowAttributes* /* window_attributes_return */ +); + +extern int XGrabButton( + Display* /* display */, + unsigned int /* button */, + unsigned int /* modifiers */, + Window /* grab_window */, + Bool /* owner_events */, + unsigned int /* event_mask */, + int /* pointer_mode */, + int /* keyboard_mode */, + Window /* confine_to */, + Cursor /* cursor */ +); + +extern int XGrabKey( + Display* /* display */, + int /* keycode */, + unsigned int /* modifiers */, + Window /* grab_window */, + Bool /* owner_events */, + int /* pointer_mode */, + int /* keyboard_mode */ +); + +extern int XGrabKeyboard( + Display* /* display */, + Window /* grab_window */, + Bool /* owner_events */, + int /* pointer_mode */, + int /* keyboard_mode */, + Time /* time */ +); + +extern int XGrabPointer( + Display* /* display */, + Window /* grab_window */, + Bool /* owner_events */, + unsigned int /* event_mask */, + int /* pointer_mode */, + int /* keyboard_mode */, + Window /* confine_to */, + Cursor /* cursor */, + Time /* time */ +); + +extern int XGrabServer( + Display* /* display */ +); + +extern int XHeightMMOfScreen( + Screen* /* screen */ +); + +extern int XHeightOfScreen( + Screen* /* screen */ +); + +extern int XIfEvent( + Display* /* display */, + XEvent* /* event_return */, + Bool (*) ( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +extern int XImageByteOrder( + Display* /* display */ +); + +extern int XInstallColormap( + Display* /* display */, + Colormap /* colormap */ +); + +extern KeyCode XKeysymToKeycode( + Display* /* display */, + KeySym /* keysym */ +); + +extern int XKillClient( + Display* /* display */, + XID /* resource */ +); + +extern Status XLookupColor( + Display* /* display */, + Colormap /* colormap */, + _Xconst char* /* color_name */, + XColor* /* exact_def_return */, + XColor* /* screen_def_return */ +); + +extern int XLowerWindow( + Display* /* display */, + Window /* w */ +); + +extern int XMapRaised( + Display* /* display */, + Window /* w */ +); + +extern int XMapSubwindows( + Display* /* display */, + Window /* w */ +); + +extern int XMapWindow( + Display* /* display */, + Window /* w */ +); + +extern int XMaskEvent( + Display* /* display */, + long /* event_mask */, + XEvent* /* event_return */ +); + +extern int XMaxCmapsOfScreen( + Screen* /* screen */ +); + +extern int XMinCmapsOfScreen( + Screen* /* screen */ +); + +extern int XMoveResizeWindow( + Display* /* display */, + Window /* w */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XMoveWindow( + Display* /* display */, + Window /* w */, + int /* x */, + int /* y */ +); + +extern int XNextEvent( + Display* /* display */, + XEvent* /* event_return */ +); + +extern int XNoOp( + Display* /* display */ +); + +extern Status XParseColor( + Display* /* display */, + Colormap /* colormap */, + _Xconst char* /* spec */, + XColor* /* exact_def_return */ +); + +extern int XParseGeometry( + _Xconst char* /* parsestring */, + int* /* x_return */, + int* /* y_return */, + unsigned int* /* width_return */, + unsigned int* /* height_return */ +); + +extern int XPeekEvent( + Display* /* display */, + XEvent* /* event_return */ +); + +extern int XPeekIfEvent( + Display* /* display */, + XEvent* /* event_return */, + Bool (*) ( + Display* /* display */, + XEvent* /* event */, + XPointer /* arg */ + ) /* predicate */, + XPointer /* arg */ +); + +extern int XPending( + Display* /* display */ +); + +extern int XPlanesOfScreen( + Screen* /* screen */ +); + +extern int XProtocolRevision( + Display* /* display */ +); + +extern int XProtocolVersion( + Display* /* display */ +); + + +extern int XPutBackEvent( + Display* /* display */, + XEvent* /* event */ +); + +extern int XPutImage( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + XImage* /* image */, + int /* src_x */, + int /* src_y */, + int /* dest_x */, + int /* dest_y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XQLength( + Display* /* display */ +); + +extern Status XQueryBestCursor( + Display* /* display */, + Drawable /* d */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int* /* width_return */, + unsigned int* /* height_return */ +); + +extern Status XQueryBestSize( + Display* /* display */, + int /* class */, + Drawable /* which_screen */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int* /* width_return */, + unsigned int* /* height_return */ +); + +extern Status XQueryBestStipple( + Display* /* display */, + Drawable /* which_screen */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int* /* width_return */, + unsigned int* /* height_return */ +); + +extern Status XQueryBestTile( + Display* /* display */, + Drawable /* which_screen */, + unsigned int /* width */, + unsigned int /* height */, + unsigned int* /* width_return */, + unsigned int* /* height_return */ +); + +extern int XQueryColor( + Display* /* display */, + Colormap /* colormap */, + XColor* /* def_in_out */ +); + +extern int XQueryColors( + Display* /* display */, + Colormap /* colormap */, + XColor* /* defs_in_out */, + int /* ncolors */ +); + +extern Bool XQueryExtension( + Display* /* display */, + _Xconst char* /* name */, + int* /* major_opcode_return */, + int* /* first_event_return */, + int* /* first_error_return */ +); + +extern int XQueryKeymap( + Display* /* display */, + char [32] /* keys_return */ +); + +extern Bool XQueryPointer( + Display* /* display */, + Window /* w */, + Window* /* root_return */, + Window* /* child_return */, + int* /* root_x_return */, + int* /* root_y_return */, + int* /* win_x_return */, + int* /* win_y_return */, + unsigned int* /* mask_return */ +); + +extern int XQueryTextExtents( + Display* /* display */, + XID /* font_ID */, + _Xconst char* /* string */, + int /* nchars */, + int* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct* /* overall_return */ +); + +extern int XQueryTextExtents16( + Display* /* display */, + XID /* font_ID */, + _Xconst XChar2b* /* string */, + int /* nchars */, + int* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct* /* overall_return */ +); + +extern Status XQueryTree( + Display* /* display */, + Window /* w */, + Window* /* root_return */, + Window* /* parent_return */, + Window** /* children_return */, + unsigned int* /* nchildren_return */ +); + +extern int XRaiseWindow( + Display* /* display */, + Window /* w */ +); + +extern int XReadBitmapFile( + Display* /* display */, + Drawable /* d */, + _Xconst char* /* filename */, + unsigned int* /* width_return */, + unsigned int* /* height_return */, + Pixmap* /* bitmap_return */, + int* /* x_hot_return */, + int* /* y_hot_return */ +); + +extern int XReadBitmapFileData( + _Xconst char* /* filename */, + unsigned int* /* width_return */, + unsigned int* /* height_return */, + unsigned char** /* data_return */, + int* /* x_hot_return */, + int* /* y_hot_return */ +); + +extern int XRebindKeysym( + Display* /* display */, + KeySym /* keysym */, + KeySym* /* list */, + int /* mod_count */, + _Xconst unsigned char* /* string */, + int /* bytes_string */ +); + +extern int XRecolorCursor( + Display* /* display */, + Cursor /* cursor */, + XColor* /* foreground_color */, + XColor* /* background_color */ +); + +extern int XRefreshKeyboardMapping( + XMappingEvent* /* event_map */ +); + +extern int XRemoveFromSaveSet( + Display* /* display */, + Window /* w */ +); + +extern int XRemoveHost( + Display* /* display */, + XHostAddress* /* host */ +); + +extern int XRemoveHosts( + Display* /* display */, + XHostAddress* /* hosts */, + int /* num_hosts */ +); + +extern int XReparentWindow( + Display* /* display */, + Window /* w */, + Window /* parent */, + int /* x */, + int /* y */ +); + +extern int XResetScreenSaver( + Display* /* display */ +); + +extern int XResizeWindow( + Display* /* display */, + Window /* w */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XRestackWindows( + Display* /* display */, + Window* /* windows */, + int /* nwindows */ +); + +extern int XRotateBuffers( + Display* /* display */, + int /* rotate */ +); + +extern int XRotateWindowProperties( + Display* /* display */, + Window /* w */, + Atom* /* properties */, + int /* num_prop */, + int /* npositions */ +); + +extern int XScreenCount( + Display* /* display */ +); + +extern int XSelectInput( + Display* /* display */, + Window /* w */, + long /* event_mask */ +); + +extern Status XSendEvent( + Display* /* display */, + Window /* w */, + Bool /* propagate */, + long /* event_mask */, + XEvent* /* event_send */ +); + +extern int XSetAccessControl( + Display* /* display */, + int /* mode */ +); + +extern int XSetArcMode( + Display* /* display */, + GC /* gc */, + int /* arc_mode */ +); + +extern int XSetBackground( + Display* /* display */, + GC /* gc */, + unsigned long /* background */ +); + +extern int XSetClipMask( + Display* /* display */, + GC /* gc */, + Pixmap /* pixmap */ +); + +extern int XSetClipOrigin( + Display* /* display */, + GC /* gc */, + int /* clip_x_origin */, + int /* clip_y_origin */ +); + +extern int XSetClipRectangles( + Display* /* display */, + GC /* gc */, + int /* clip_x_origin */, + int /* clip_y_origin */, + XRectangle* /* rectangles */, + int /* n */, + int /* ordering */ +); + +extern int XSetCloseDownMode( + Display* /* display */, + int /* close_mode */ +); + +extern int XSetCommand( + Display* /* display */, + Window /* w */, + char** /* argv */, + int /* argc */ +); + +extern int XSetDashes( + Display* /* display */, + GC /* gc */, + int /* dash_offset */, + _Xconst char* /* dash_list */, + int /* n */ +); + +extern int XSetFillRule( + Display* /* display */, + GC /* gc */, + int /* fill_rule */ +); + +extern int XSetFillStyle( + Display* /* display */, + GC /* gc */, + int /* fill_style */ +); + +extern int XSetFont( + Display* /* display */, + GC /* gc */, + Font /* font */ +); + +extern int XSetFontPath( + Display* /* display */, + char** /* directories */, + int /* ndirs */ +); + +extern int XSetForeground( + Display* /* display */, + GC /* gc */, + unsigned long /* foreground */ +); + +extern int XSetFunction( + Display* /* display */, + GC /* gc */, + int /* function */ +); + +extern int XSetGraphicsExposures( + Display* /* display */, + GC /* gc */, + Bool /* graphics_exposures */ +); + +extern int XSetIconName( + Display* /* display */, + Window /* w */, + _Xconst char* /* icon_name */ +); + +extern int XSetInputFocus( + Display* /* display */, + Window /* focus */, + int /* revert_to */, + Time /* time */ +); + +extern int XSetLineAttributes( + Display* /* display */, + GC /* gc */, + unsigned int /* line_width */, + int /* line_style */, + int /* cap_style */, + int /* join_style */ +); + +extern int XSetModifierMapping( + Display* /* display */, + XModifierKeymap* /* modmap */ +); + +extern int XSetPlaneMask( + Display* /* display */, + GC /* gc */, + unsigned long /* plane_mask */ +); + +extern int XSetPointerMapping( + Display* /* display */, + _Xconst unsigned char* /* map */, + int /* nmap */ +); + +extern int XSetScreenSaver( + Display* /* display */, + int /* timeout */, + int /* interval */, + int /* prefer_blanking */, + int /* allow_exposures */ +); + +extern int XSetSelectionOwner( + Display* /* display */, + Atom /* selection */, + Window /* owner */, + Time /* time */ +); + +extern int XSetState( + Display* /* display */, + GC /* gc */, + unsigned long /* foreground */, + unsigned long /* background */, + int /* function */, + unsigned long /* plane_mask */ +); + +extern int XSetStipple( + Display* /* display */, + GC /* gc */, + Pixmap /* stipple */ +); + +extern int XSetSubwindowMode( + Display* /* display */, + GC /* gc */, + int /* subwindow_mode */ +); + +extern int XSetTSOrigin( + Display* /* display */, + GC /* gc */, + int /* ts_x_origin */, + int /* ts_y_origin */ +); + +extern int XSetTile( + Display* /* display */, + GC /* gc */, + Pixmap /* tile */ +); + +extern int XSetWindowBackground( + Display* /* display */, + Window /* w */, + unsigned long /* background_pixel */ +); + +extern int XSetWindowBackgroundPixmap( + Display* /* display */, + Window /* w */, + Pixmap /* background_pixmap */ +); + +extern int XSetWindowBorder( + Display* /* display */, + Window /* w */, + unsigned long /* border_pixel */ +); + +extern int XSetWindowBorderPixmap( + Display* /* display */, + Window /* w */, + Pixmap /* border_pixmap */ +); + +extern int XSetWindowBorderWidth( + Display* /* display */, + Window /* w */, + unsigned int /* width */ +); + +extern int XSetWindowColormap( + Display* /* display */, + Window /* w */, + Colormap /* colormap */ +); + +extern int XStoreBuffer( + Display* /* display */, + _Xconst char* /* bytes */, + int /* nbytes */, + int /* buffer */ +); + +extern int XStoreBytes( + Display* /* display */, + _Xconst char* /* bytes */, + int /* nbytes */ +); + +extern int XStoreColor( + Display* /* display */, + Colormap /* colormap */, + XColor* /* color */ +); + +extern int XStoreColors( + Display* /* display */, + Colormap /* colormap */, + XColor* /* color */, + int /* ncolors */ +); + +extern int XStoreName( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */ +); + +extern int XStoreNamedColor( + Display* /* display */, + Colormap /* colormap */, + _Xconst char* /* color */, + unsigned long /* pixel */, + int /* flags */ +); + +extern int XSync( + Display* /* display */, + Bool /* discard */ +); + +extern int XTextExtents( + XFontStruct* /* font_struct */, + _Xconst char* /* string */, + int /* nchars */, + int* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct* /* overall_return */ +); + +extern int XTextExtents16( + XFontStruct* /* font_struct */, + _Xconst XChar2b* /* string */, + int /* nchars */, + int* /* direction_return */, + int* /* font_ascent_return */, + int* /* font_descent_return */, + XCharStruct* /* overall_return */ +); + +extern int XTextWidth( + XFontStruct* /* font_struct */, + _Xconst char* /* string */, + int /* count */ +); + +extern int XTextWidth16( + XFontStruct* /* font_struct */, + _Xconst XChar2b* /* string */, + int /* count */ +); + +extern Bool XTranslateCoordinates( + Display* /* display */, + Window /* src_w */, + Window /* dest_w */, + int /* src_x */, + int /* src_y */, + int* /* dest_x_return */, + int* /* dest_y_return */, + Window* /* child_return */ +); + +extern int XUndefineCursor( + Display* /* display */, + Window /* w */ +); + +extern int XUngrabButton( + Display* /* display */, + unsigned int /* button */, + unsigned int /* modifiers */, + Window /* grab_window */ +); + +extern int XUngrabKey( + Display* /* display */, + int /* keycode */, + unsigned int /* modifiers */, + Window /* grab_window */ +); + +extern int XUngrabKeyboard( + Display* /* display */, + Time /* time */ +); + +extern int XUngrabPointer( + Display* /* display */, + Time /* time */ +); + +extern int XUngrabServer( + Display* /* display */ +); + +extern int XUninstallColormap( + Display* /* display */, + Colormap /* colormap */ +); + +extern int XUnloadFont( + Display* /* display */, + Font /* font */ +); + +extern int XUnmapSubwindows( + Display* /* display */, + Window /* w */ +); + +extern int XUnmapWindow( + Display* /* display */, + Window /* w */ +); + +extern int XVendorRelease( + Display* /* display */ +); + +extern int XWarpPointer( + Display* /* display */, + Window /* src_w */, + Window /* dest_w */, + int /* src_x */, + int /* src_y */, + unsigned int /* src_width */, + unsigned int /* src_height */, + int /* dest_x */, + int /* dest_y */ +); + +extern int XWidthMMOfScreen( + Screen* /* screen */ +); + +extern int XWidthOfScreen( + Screen* /* screen */ +); + +extern int XWindowEvent( + Display* /* display */, + Window /* w */, + long /* event_mask */, + XEvent* /* event_return */ +); + +extern int XWriteBitmapFile( + Display* /* display */, + _Xconst char* /* filename */, + Pixmap /* bitmap */, + unsigned int /* width */, + unsigned int /* height */, + int /* x_hot */, + int /* y_hot */ +); + +extern Bool XSupportsLocale (void); + +extern char *XSetLocaleModifiers( + const char* /* modifier_list */ +); + +extern XOM XOpenOM( + Display* /* display */, + struct _XrmHashBucketRec* /* rdb */, + _Xconst char* /* res_name */, + _Xconst char* /* res_class */ +); + +extern Status XCloseOM( + XOM /* om */ +); + +extern char *XSetOMValues( + XOM /* om */, + ... +) _X_SENTINEL(0); + +extern char *XGetOMValues( + XOM /* om */, + ... +) _X_SENTINEL(0); + +extern Display *XDisplayOfOM( + XOM /* om */ +); + +extern char *XLocaleOfOM( + XOM /* om */ +); + +extern XOC XCreateOC( + XOM /* om */, + ... +) _X_SENTINEL(0); + +extern void XDestroyOC( + XOC /* oc */ +); + +extern XOM XOMOfOC( + XOC /* oc */ +); + +extern char *XSetOCValues( + XOC /* oc */, + ... +) _X_SENTINEL(0); + +extern char *XGetOCValues( + XOC /* oc */, + ... +) _X_SENTINEL(0); + +extern XFontSet XCreateFontSet( + Display* /* display */, + _Xconst char* /* base_font_name_list */, + char*** /* missing_charset_list */, + int* /* missing_charset_count */, + char** /* def_string */ +); + +extern void XFreeFontSet( + Display* /* display */, + XFontSet /* font_set */ +); + +extern int XFontsOfFontSet( + XFontSet /* font_set */, + XFontStruct*** /* font_struct_list */, + char*** /* font_name_list */ +); + +extern char *XBaseFontNameListOfFontSet( + XFontSet /* font_set */ +); + +extern char *XLocaleOfFontSet( + XFontSet /* font_set */ +); + +extern Bool XContextDependentDrawing( + XFontSet /* font_set */ +); + +extern Bool XDirectionalDependentDrawing( + XFontSet /* font_set */ +); + +extern Bool XContextualDrawing( + XFontSet /* font_set */ +); + +extern XFontSetExtents *XExtentsOfFontSet( + XFontSet /* font_set */ +); + +extern int XmbTextEscapement( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* bytes_text */ +); + +extern int XwcTextEscapement( + XFontSet /* font_set */, + _Xconst wchar_t* /* text */, + int /* num_wchars */ +); + +extern int Xutf8TextEscapement( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* bytes_text */ +); + +extern int XmbTextExtents( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* bytes_text */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern int XwcTextExtents( + XFontSet /* font_set */, + _Xconst wchar_t* /* text */, + int /* num_wchars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern int Xutf8TextExtents( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* bytes_text */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern Status XmbTextPerCharExtents( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* bytes_text */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern Status XwcTextPerCharExtents( + XFontSet /* font_set */, + _Xconst wchar_t* /* text */, + int /* num_wchars */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern Status Xutf8TextPerCharExtents( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* bytes_text */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* overall_ink_return */, + XRectangle* /* overall_logical_return */ +); + +extern void XmbDrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XmbTextItem* /* text_items */, + int /* nitems */ +); + +extern void XwcDrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XwcTextItem* /* text_items */, + int /* nitems */ +); + +extern void Xutf8DrawText( + Display* /* display */, + Drawable /* d */, + GC /* gc */, + int /* x */, + int /* y */, + XmbTextItem* /* text_items */, + int /* nitems */ +); + +extern void XmbDrawString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* text */, + int /* bytes_text */ +); + +extern void XwcDrawString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst wchar_t* /* text */, + int /* num_wchars */ +); + +extern void Xutf8DrawString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* text */, + int /* bytes_text */ +); + +extern void XmbDrawImageString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* text */, + int /* bytes_text */ +); + +extern void XwcDrawImageString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst wchar_t* /* text */, + int /* num_wchars */ +); + +extern void Xutf8DrawImageString( + Display* /* display */, + Drawable /* d */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* text */, + int /* bytes_text */ +); + +extern XIM XOpenIM( + Display* /* dpy */, + struct _XrmHashBucketRec* /* rdb */, + char* /* res_name */, + char* /* res_class */ +); + +extern Status XCloseIM( + XIM /* im */ +); + +extern char *XGetIMValues( + XIM /* im */, ... +) _X_SENTINEL(0); + +extern char *XSetIMValues( + XIM /* im */, ... +) _X_SENTINEL(0); + +extern Display *XDisplayOfIM( + XIM /* im */ +); + +extern char *XLocaleOfIM( + XIM /* im*/ +); + +extern XIC XCreateIC( + XIM /* im */, ... +) _X_SENTINEL(0); + +extern void XDestroyIC( + XIC /* ic */ +); + +extern void XSetICFocus( + XIC /* ic */ +); + +extern void XUnsetICFocus( + XIC /* ic */ +); + +extern wchar_t *XwcResetIC( + XIC /* ic */ +); + +extern char *XmbResetIC( + XIC /* ic */ +); + +extern char *Xutf8ResetIC( + XIC /* ic */ +); + +extern char *XSetICValues( + XIC /* ic */, ... +) _X_SENTINEL(0); + +extern char *XGetICValues( + XIC /* ic */, ... +) _X_SENTINEL(0); + +extern XIM XIMOfIC( + XIC /* ic */ +); + +extern Bool XFilterEvent( + XEvent* /* event */, + Window /* window */ +); + +extern int XmbLookupString( + XIC /* ic */, + XKeyPressedEvent* /* event */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + Status* /* status_return */ +); + +extern int XwcLookupString( + XIC /* ic */, + XKeyPressedEvent* /* event */, + wchar_t* /* buffer_return */, + int /* wchars_buffer */, + KeySym* /* keysym_return */, + Status* /* status_return */ +); + +extern int Xutf8LookupString( + XIC /* ic */, + XKeyPressedEvent* /* event */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + Status* /* status_return */ +); + +extern XVaNestedList XVaCreateNestedList( + int /*unused*/, ... +) _X_SENTINEL(0); + +/* internal connections for IMs */ + +extern Bool XRegisterIMInstantiateCallback( + Display* /* dpy */, + struct _XrmHashBucketRec* /* rdb */, + char* /* res_name */, + char* /* res_class */, + XIDProc /* callback */, + XPointer /* client_data */ +); + +extern Bool XUnregisterIMInstantiateCallback( + Display* /* dpy */, + struct _XrmHashBucketRec* /* rdb */, + char* /* res_name */, + char* /* res_class */, + XIDProc /* callback */, + XPointer /* client_data */ +); + +typedef void (*XConnectionWatchProc)( + Display* /* dpy */, + XPointer /* client_data */, + int /* fd */, + Bool /* opening */, /* open or close flag */ + XPointer* /* watch_data */ /* open sets, close uses */ +); + + +extern Status XInternalConnectionNumbers( + Display* /* dpy */, + int** /* fd_return */, + int* /* count_return */ +); + +extern void XProcessInternalConnection( + Display* /* dpy */, + int /* fd */ +); + +extern Status XAddConnectionWatch( + Display* /* dpy */, + XConnectionWatchProc /* callback */, + XPointer /* client_data */ +); + +extern void XRemoveConnectionWatch( + Display* /* dpy */, + XConnectionWatchProc /* callback */, + XPointer /* client_data */ +); + +extern void XSetAuthorization( + char * /* name */, + int /* namelen */, + char * /* data */, + int /* datalen */ +); + +extern int _Xmbtowc( + wchar_t * /* wstr */, + char * /* str */, + int /* len */ +); + +extern int _Xwctomb( + char * /* str */, + wchar_t /* wc */ +); + +extern Bool XGetEventData( + Display* /* dpy */, + XGenericEventCookie* /* cookie*/ +); + +extern void XFreeEventData( + Display* /* dpy */, + XGenericEventCookie* /* cookie*/ +); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +_XFUNCPROTOEND + +#endif /* #if !defined(_X11_XLIB_H_) && !defined(_XLIB_H_) */ diff --git a/nx-X11/lib/include/X11/XlibConf.h.in b/nx-X11/lib/include/X11/XlibConf.h.in new file mode 100644 index 000000000..8f36ac1d9 --- /dev/null +++ b/nx-X11/lib/include/X11/XlibConf.h.in @@ -0,0 +1,37 @@ +/* + * Copyright © 2005 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifndef _XLIBCONF_H_ +#define _XLIBCONF_H_ +/* + * This header file exports defines necessary to correctly + * use Xlibint.h both inside Xlib and by external libraries + * such as extensions. + */ + +/* Threading support? */ +#undef XTHREADS + +/* Use multi-threaded libc functions? */ +#undef XUSE_MTSAFE_API + +#endif /* _XLIBCONF_H_ */ diff --git a/nx-X11/lib/include/X11/Xlibint.h b/nx-X11/lib/include/X11/Xlibint.h new file mode 100644 index 000000000..b325182e3 --- /dev/null +++ b/nx-X11/lib/include/X11/Xlibint.h @@ -0,0 +1,1361 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* nx-X11, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +/* + +Copyright 1984, 1985, 1987, 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#if !defined(_X11_XLIBINT_H_) && !defined(_XLIBINT_H_) +#define _X11_XLIBINT_H_ +#define _XLIBINT_H_ + +/* + * Xlibint.h - Header definition and support file for the internal + * support routines used by the C subroutine interface + * library (Xlib) to the X Window System. + * + * Warning, there be dragons here.... + */ + +#include +#include /* to declare xEvent */ +#include /* for configured options like XTHREADS */ + +/* The Xlib structs are full of implicit padding to properly align members. + We can't clean that up without breaking ABI, so tell clang not to bother + complaining about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +#ifdef NX_TRANS_SOCKET + +#include + +#define _XGetIOError(dpy) \ + (dpy -> flags & XlibDisplayIOError) + +#endif + +#ifdef WIN32 +#define _XFlush _XFlushIt +#endif + +struct _XGC +{ + XExtData *ext_data; /* hook for extension to hang data */ + GContext gid; /* protocol ID for graphics context */ + Bool rects; /* boolean: TRUE if clipmask is list of rectangles */ + Bool dashes; /* boolean: TRUE if dash-list is really a list */ + unsigned long dirty;/* cache dirty bits */ + XGCValues values; /* shadow structure of values */ +}; + +struct _XDisplay +{ + XExtData *ext_data; /* hook for extension to hang data */ + struct _XFreeFuncs *free_funcs; /* internal free functions */ + int fd; /* Network socket. */ + int conn_checker; /* ugly thing used by _XEventsQueued */ + int proto_major_version;/* maj. version of server's X protocol */ + int proto_minor_version;/* minor version of server's X protocol */ + char *vendor; /* vendor of the server hardware */ + XID resource_base; /* resource ID base */ + XID resource_mask; /* resource ID mask bits */ + XID resource_id; /* allocator current ID */ + int resource_shift; /* allocator shift to correct bits */ + XID (*resource_alloc)( /* allocator function */ + struct _XDisplay* + ); + int byte_order; /* screen byte order, LSBFirst, MSBFirst */ + int bitmap_unit; /* padding and data requirements */ + int bitmap_pad; /* padding requirements on bitmaps */ + int bitmap_bit_order; /* LeastSignificant or MostSignificant */ + int nformats; /* number of pixmap formats in list */ + ScreenFormat *pixmap_format; /* pixmap format list */ + int vnumber; /* Xlib's X protocol version number. */ + int release; /* release of the server */ + struct _XSQEvent *head, *tail; /* Input event queue. */ + int qlen; /* Length of input event queue */ + unsigned long last_request_read; /* seq number of last event read */ + unsigned long request; /* sequence number of last request. */ + char *last_req; /* beginning of last request, or dummy */ + char *buffer; /* Output buffer starting address. */ + char *bufptr; /* Output buffer index pointer. */ + char *bufmax; /* Output buffer maximum+1 address. */ + unsigned max_request_size; /* maximum number 32 bit words in request*/ + struct _XrmHashBucketRec *db; + int (*synchandler)( /* Synchronization handler */ + struct _XDisplay* + ); + char *display_name; /* "host:display" string used on this connect*/ + int default_screen; /* default screen for operations */ + int nscreens; /* number of screens on this server*/ + Screen *screens; /* pointer to list of screens */ + unsigned long motion_buffer; /* size of motion buffer */ + volatile unsigned long flags; /* internal connection flags */ + int min_keycode; /* minimum defined keycode */ + int max_keycode; /* maximum defined keycode */ + KeySym *keysyms; /* This server's keysyms */ + XModifierKeymap *modifiermap; /* This server's modifier keymap */ + int keysyms_per_keycode;/* number of rows */ + char *xdefaults; /* contents of defaults from server */ + char *scratch_buffer; /* place to hang scratch buffer */ + unsigned long scratch_length; /* length of scratch buffer */ + int ext_number; /* extension number on this display */ + struct _XExten *ext_procs; /* extensions initialized on this display */ + /* + * the following can be fixed size, as the protocol defines how + * much address space is available. + * While this could be done using the extension vector, there + * may be MANY events processed, so a search through the extension + * list to find the right procedure for each event might be + * expensive if many extensions are being used. + */ + Bool (*event_vec[128])( /* vector for wire to event */ + Display * /* dpy */, + XEvent * /* re */, + xEvent * /* event */ + ); + Status (*wire_vec[128])( /* vector for event to wire */ + Display * /* dpy */, + XEvent * /* re */, + xEvent * /* event */ + ); + KeySym lock_meaning; /* for XLookupString */ + struct _XLockInfo *lock; /* multi-thread state, display lock */ + struct _XInternalAsync *async_handlers; /* for internal async */ + unsigned long bigreq_size; /* max size of big requests */ + struct _XLockPtrs *lock_fns; /* pointers to threads functions */ + void (*idlist_alloc)( /* XID list allocator function */ + Display * /* dpy */, + XID * /* ids */, + int /* count */ + ); + /* things above this line should not move, for binary compatibility */ + struct _XKeytrans *key_bindings; /* for XLookupString */ + Font cursor_font; /* for XCreateFontCursor */ + struct _XDisplayAtoms *atoms; /* for XInternAtom */ + unsigned int mode_switch; /* keyboard group modifiers */ + unsigned int num_lock; /* keyboard numlock modifiers */ + struct _XContextDB *context_db; /* context database */ + Bool (**error_vec)( /* vector for wire to error */ + Display * /* display */, + XErrorEvent * /* he */, + xError * /* we */ + ); + /* + * Xcms information + */ + struct { + XPointer defaultCCCs; /* pointer to an array of default XcmsCCC */ + XPointer clientCmaps; /* pointer to linked list of XcmsCmapRec */ + XPointer perVisualIntensityMaps; + /* linked list of XcmsIntensityMap */ + } cms; + struct _XIMFilter *im_filters; + struct _XSQEvent *qfree; /* unallocated event queue elements */ + unsigned long next_event_serial_num; /* inserted into next queue elt */ + struct _XExten *flushes; /* Flush hooks */ + struct _XConnectionInfo *im_fd_info; /* _XRegisterInternalConnection */ + int im_fd_length; /* number of im_fd_info */ + struct _XConnWatchInfo *conn_watchers; /* XAddConnectionWatch */ + int watcher_count; /* number of conn_watchers */ + XPointer filedes; /* struct pollfd cache for _XWaitForReadable */ + int (*savedsynchandler)( /* user synchandler when Xlib usurps */ + Display * /* dpy */ + ); + XID resource_max; /* allocator max ID */ + int xcmisc_opcode; /* major opcode for XC-MISC */ + struct _XkbInfoRec *xkb_info; /* XKB info */ + struct _XtransConnInfo *trans_conn; /* transport connection object */ + struct _X11XCBPrivate *xcb; /* XCB glue private data */ + + /* Generic event cookie handling */ + unsigned int next_cookie; /* next event cookie */ + /* vector for wire to generic event, index is (extension - 128) */ + Bool (*generic_event_vec[128])( + Display * /* dpy */, + XGenericEventCookie * /* Xlib event */, + xEvent * /* wire event */); + /* vector for event copy, index is (extension - 128) */ + Bool (*generic_event_copy_vec[128])( + Display * /* dpy */, + XGenericEventCookie * /* in */, + XGenericEventCookie * /* out*/); + void *cookiejar; /* cookie events returned but not claimed */ +}; + +#define XAllocIDs(dpy,ids,n) (*(dpy)->idlist_alloc)(dpy,ids,n) + +#ifndef _XEVENT_ +/* + * _QEvent datatype for use in input queueing. + */ +typedef struct _XSQEvent +{ + struct _XSQEvent *next; + XEvent event; + unsigned long qserial_num; /* so multi-threaded code can find new ones */ +} _XQEvent; +#endif + +#include +#include +#define _XBCOPYFUNC _Xbcopy +#include +#include + +/* Utek leaves kernel macros around in include files (bleah) */ +#ifdef dirty +#undef dirty +#endif + +#include +#include + +#include + +_XFUNCPROTOBEGIN + +/* + * The following definitions can be used for locking requests in multi-threaded + * address spaces. + */ +#ifdef XTHREADS +/* Author: Stephen Gildea, MIT X Consortium + * + * declarations for C Threads locking + */ + +typedef struct _LockInfoRec *LockInfoPtr; + +/* interfaces for locking.c */ +struct _XLockPtrs { + /* used by all, including extensions; do not move */ + void (*lock_display)( + Display *dpy +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char *file + , int line +#endif + ); + void (*unlock_display)( + Display *dpy +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char *file + , int line +#endif + ); +}; + +#if defined(WIN32) && !defined(_XLIBINT_) +#define _XCreateMutex_fn (*_XCreateMutex_fn_p) +#define _XFreeMutex_fn (*_XFreeMutex_fn_p) +#define _XLockMutex_fn (*_XLockMutex_fn_p) +#define _XUnlockMutex_fn (*_XUnlockMutex_fn_p) +#define _Xglobal_lock (*_Xglobal_lock_p) +#endif + +/* in XlibInt.c */ +extern void (*_XCreateMutex_fn)( + LockInfoPtr /* lock */ +); +extern void (*_XFreeMutex_fn)( + LockInfoPtr /* lock */ +); +extern void (*_XLockMutex_fn)( + LockInfoPtr /* lock */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char * /* file */ + , int /* line */ +#endif +); +extern void (*_XUnlockMutex_fn)( + LockInfoPtr /* lock */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char * /* file */ + , int /* line */ +#endif +); + +extern LockInfoPtr _Xglobal_lock; + +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) +#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)((d),__FILE__,__LINE__) +#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)((d),__FILE__,__LINE__) +#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock,__FILE__,__LINE__) +#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock,__FILE__,__LINE__) +#else +/* used everywhere, so must be fast if not using threads */ +#define LockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->lock_display)(d) +#define UnlockDisplay(d) if ((d)->lock_fns) (*(d)->lock_fns->unlock_display)(d) +#define _XLockMutex(lock) if (_XLockMutex_fn) (*_XLockMutex_fn)(lock) +#define _XUnlockMutex(lock) if (_XUnlockMutex_fn) (*_XUnlockMutex_fn)(lock) +#endif +#define _XCreateMutex(lock) if (_XCreateMutex_fn) (*_XCreateMutex_fn)(lock); +#define _XFreeMutex(lock) if (_XFreeMutex_fn) (*_XFreeMutex_fn)(lock); + +#else /* XTHREADS */ +#define LockDisplay(dis) +#define _XLockMutex(lock) +#define _XUnlockMutex(lock) +#define UnlockDisplay(dis) +#define _XCreateMutex(lock) +#define _XFreeMutex(lock) +#endif + +#define Xfree(ptr) free((ptr)) + +/* + * Note that some machines do not return a valid pointer for malloc(0), in + * which case we provide an alternate under the control of the + * define MALLOC_0_RETURNS_NULL. This is necessary because some + * Xlib code expects malloc(0) to return a valid pointer to storage. + */ +#if defined(MALLOC_0_RETURNS_NULL) || defined(__clang_analyzer__) + +# define Xmalloc(size) malloc(((size) == 0 ? 1 : (size))) +# define Xrealloc(ptr, size) realloc((ptr), ((size) == 0 ? 1 : (size))) +# define Xcalloc(nelem, elsize) calloc(((nelem) == 0 ? 1 : (nelem)), (elsize)) + +#else + +# define Xmalloc(size) malloc((size)) +# define Xrealloc(ptr, size) realloc((ptr), (size)) +# define Xcalloc(nelem, elsize) calloc((nelem), (elsize)) + +#endif + +#include + +#define LOCKED 1 +#define UNLOCKED 0 + +#ifdef NX_TRANS_SOCKET +#ifndef BUFSIZE /* Output buffer size is configurable */ +#define BUFSIZE 8192 /* but this is still used for reading. */ +#endif +#else +#ifndef BUFSIZE +#define BUFSIZE 2048 /* X output buffer size. */ +#endif +#endif +#ifndef PTSPERBATCH +#define PTSPERBATCH 1024 /* point batching */ +#endif +#ifndef WLNSPERBATCH +#define WLNSPERBATCH 50 /* wide line batching */ +#endif +#ifndef ZLNSPERBATCH +#define ZLNSPERBATCH 1024 /* thin line batching */ +#endif +#ifndef WRCTSPERBATCH +#define WRCTSPERBATCH 10 /* wide line rectangle batching */ +#endif +#ifndef ZRCTSPERBATCH +#define ZRCTSPERBATCH 256 /* thin line rectangle batching */ +#endif +#ifndef FRCTSPERBATCH +#define FRCTSPERBATCH 256 /* filled rectangle batching */ +#endif +#ifndef FARCSPERBATCH +#define FARCSPERBATCH 256 /* filled arc batching */ +#endif +#ifndef CURSORFONT +#define CURSORFONT "cursor" /* standard cursor fonts */ +#endif + +/* + * Display flags + */ +#define XlibDisplayIOError (1L << 0) +#define XlibDisplayClosing (1L << 1) +#define XlibDisplayNoXkb (1L << 2) +#define XlibDisplayPrivSync (1L << 3) +#define XlibDisplayProcConni (1L << 4) /* in _XProcessInternalConnection */ +#define XlibDisplayReadEvents (1L << 5) /* in _XReadEvents */ +#define XlibDisplayReply (1L << 5) /* in _XReply */ +#define XlibDisplayWriting (1L << 6) /* in _XFlushInt, _XSend */ +#define XlibDisplayDfltRMDB (1L << 7) /* mark if RM db from XGetDefault */ + +/* + * X Protocol packetizing macros. + */ + +/* Leftover from CRAY support - was defined empty on all non-Cray systems */ +#define WORD64ALIGN + +/** + * Return a len-sized request buffer for the request type. This function may + * flush the output queue. + * + * @param dpy The display connection + * @param type The request type + * @param len Length of the request in bytes + * + * @returns A pointer to the request buffer with a few default values + * initialized. + */ +extern void *_XGetRequest(Display *dpy, CARD8 type, size_t len); + +/* GetReqSized is the same as GetReq but allows the caller to specify the + * size in bytes. 'sz' must be a multiple of 4! */ + +#define GetReqSized(name, sz, req) \ + req = (x##name##Req *) _XGetRequest(dpy, X_##name, sz) + +/* + * GetReq - Get the next available X request packet in the buffer and + * return it. + * + * "name" is the name of the request, e.g. CreatePixmap, OpenFont, etc. + * "req" is the name of the request pointer. + * + */ + +#define GetReq(name, req) \ + GetReqSized(name, SIZEOF(x##name##Req), req) + +/* GetReqExtra is the same as GetReq, but allocates "n" additional + bytes after the request. "n" must be a multiple of 4! */ + +#define GetReqExtra(name, n, req) \ + GetReqSized(name, SIZEOF(x##name##Req) + n, req) + +/* + * GetResReq is for those requests that have a resource ID + * (Window, Pixmap, GContext, etc.) as their single argument. + * "rid" is the name of the resource. + */ + +#define GetResReq(name, rid, req) \ + req = (xResourceReq *) _XGetRequest(dpy, X_##name, SIZEOF(xResourceReq)); \ + req->id = (rid) + +/* + * GetEmptyReq is for those requests that have no arguments + * at all. + */ +#define GetEmptyReq(name, req) \ + req = (xReq *) _XGetRequest(dpy, X_##name, SIZEOF(xReq)) + +/* + * MakeBigReq sets the CARD16 "req->length" to 0 and inserts a new CARD32 + * length, after req->length, before the data in the request. The new length + * includes the "n" extra 32-bit words. + * + * Do not use MakeBigReq if there is no data already in the request. + * req->length must already be >= 2. + */ +#ifdef LONG64 +#define MakeBigReq(req,n) \ + { \ + CARD64 _BRdat; \ + CARD32 _BRlen = req->length - 1; \ + req->length = 0; \ + _BRdat = ((CARD32 *)req)[_BRlen]; \ + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ + ((CARD32 *)req)[1] = _BRlen + n + 2; \ + Data32(dpy, &_BRdat, 4); \ + } +#else +#define MakeBigReq(req,n) \ + { \ + CARD32 _BRdat; \ + CARD32 _BRlen = req->length - 1; \ + req->length = 0; \ + _BRdat = ((CARD32 *)req)[_BRlen]; \ + memmove(((char *)req) + 8, ((char *)req) + 4, (_BRlen - 1) << 2); \ + ((CARD32 *)req)[1] = _BRlen + n + 2; \ + Data32(dpy, &_BRdat, 4); \ + } +#endif + +/* + * SetReqLen increases the count of 32-bit words in the request by "n", + * or by "badlen" if "n" is too large. + * + * Do not use SetReqLen if "req" does not already have data after the + * xReq header. req->length must already be >= 2. + */ +#ifndef __clang_analyzer__ +#define SetReqLen(req,n,badlen) \ + if ((req->length + n) > (unsigned)65535) { \ + if (dpy->bigreq_size) { \ + MakeBigReq(req,n) \ + } else { \ + n = badlen; \ + req->length += n; \ + } \ + } else \ + req->length += n +#else +#define SetReqLen(req,n,badlen) \ + req->length += n +#endif + +#define SyncHandle() \ + if (dpy->synchandler) (*dpy->synchandler)(dpy) + +extern void _XFlushGCCache(Display *dpy, GC gc); +#define FlushGC(dpy, gc) \ + if ((gc)->dirty) _XFlushGCCache((dpy), (gc)) +/* + * Data - Place data in the buffer and pad the end to provide + * 32 bit word alignment. Transmit if the buffer fills. + * + * "dpy" is a pointer to a Display. + * "data" is a pointer to a data buffer. + * "len" is the length of the data buffer. + */ +#ifndef DataRoutineIsProcedure +#define Data(dpy, data, len) {\ + if (dpy->bufptr + (len) <= dpy->bufmax) {\ + memcpy(dpy->bufptr, data, (int)len);\ + dpy->bufptr += ((len) + 3) & ~3;\ + } else\ + _XSend(dpy, data, len);\ + } +#endif /* DataRoutineIsProcedure */ + + +/* Allocate bytes from the buffer. No padding is done, so if + * the length is not a multiple of 4, the caller must be + * careful to leave the buffer aligned after sending the + * current request. + * + * "type" is the type of the pointer being assigned to. + * "ptr" is the pointer being assigned to. + * "n" is the number of bytes to allocate. + * + * Example: + * xTextElt *elt; + * BufAlloc (xTextElt *, elt, nbytes) + */ + +#define BufAlloc(type, ptr, n) \ + if (dpy->bufptr + (n) > dpy->bufmax) \ + _XFlush (dpy); \ + ptr = (type) dpy->bufptr; \ + memset(ptr, '\0', n); \ + dpy->bufptr += (n); + +#define Data16(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) +#define _XRead16Pad(dpy, data, len) _XReadPad((dpy), (char *)(data), (len)) +#define _XRead16(dpy, data, len) _XRead((dpy), (char *)(data), (len)) +#ifdef LONG64 +#define Data32(dpy, data, len) _XData32(dpy, (_Xconst long *)data, len) +extern int _XData32( + Display *dpy, + register _Xconst long *data, + unsigned len +); +extern void _XRead32( + Display *dpy, + register long *data, + long len +); +#else +#define Data32(dpy, data, len) Data((dpy), (_Xconst char *)(data), (len)) +#define _XRead32(dpy, data, len) _XRead((dpy), (char *)(data), (len)) +#endif + +#define PackData16(dpy,data,len) Data16 (dpy, data, len) +#define PackData32(dpy,data,len) Data32 (dpy, data, len) + +/* Xlib manual is bogus */ +#define PackData(dpy,data,len) PackData16 (dpy, data, len) + +#define min(a,b) (((a) < (b)) ? (a) : (b)) +#define max(a,b) (((a) > (b)) ? (a) : (b)) + +#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \ + (((cs)->rbearing|(cs)->lbearing| \ + (cs)->ascent|(cs)->descent) == 0)) + +/* + * CI_GET_CHAR_INFO_1D - return the charinfo struct for the indicated 8bit + * character. If the character is in the column and exists, then return the + * appropriate metrics (note that fonts with common per-character metrics will + * return min_bounds). If none of these hold true, try again with the default + * char. + */ +#define CI_GET_CHAR_INFO_1D(fs,col,def,cs) \ +{ \ + cs = def; \ + if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \ + if (CI_NONEXISTCHAR(cs)) cs = def; \ + } \ + } \ +} + +#define CI_GET_DEFAULT_INFO_1D(fs,cs) \ + CI_GET_CHAR_INFO_1D (fs, fs->default_char, NULL, cs) + + + +/* + * CI_GET_CHAR_INFO_2D - return the charinfo struct for the indicated row and + * column. This is used for fonts that have more than row zero. + */ +#define CI_GET_CHAR_INFO_2D(fs,row,col,def,cs) \ +{ \ + cs = def; \ + if (row >= fs->min_byte1 && row <= fs->max_byte1 && \ + col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[((row - fs->min_byte1) * \ + (fs->max_char_or_byte2 - \ + fs->min_char_or_byte2 + 1)) + \ + (col - fs->min_char_or_byte2)]; \ + if (CI_NONEXISTCHAR(cs)) cs = def; \ + } \ + } \ +} + +#define CI_GET_DEFAULT_INFO_2D(fs,cs) \ +{ \ + unsigned int r = (fs->default_char >> 8); \ + unsigned int c = (fs->default_char & 0xff); \ + CI_GET_CHAR_INFO_2D (fs, r, c, NULL, cs); \ +} + + +/* srcvar must be a variable for large architecture version */ +#define OneDataCard32(dpy,dstaddr,srcvar) \ + { *(CARD32 *)(dstaddr) = (srcvar); } + + +typedef struct _XInternalAsync { + struct _XInternalAsync *next; + /* + * handler arguments: + * rep is the generic reply that caused this handler + * to be invoked. It must also be passed to _XGetAsyncReply. + * buf and len are opaque values that must be passed to + * _XGetAsyncReply or _XGetAsyncData. + * data is the closure stored in this struct. + * The handler returns True iff it handled this reply. + */ + Bool (*handler)( + Display* /* dpy */, + xReply* /* rep */, + char* /* buf */, + int /* len */, + XPointer /* data */ + ); + XPointer data; +} _XAsyncHandler; + +typedef struct _XAsyncEState { + unsigned long min_sequence_number; + unsigned long max_sequence_number; + unsigned char error_code; + unsigned char major_opcode; + unsigned short minor_opcode; + unsigned char last_error_received; + int error_count; +} _XAsyncErrorState; + +extern void _XDeqAsyncHandler(Display *dpy, _XAsyncHandler *handler); +#define DeqAsyncHandler(dpy,handler) { \ + if (dpy->async_handlers == (handler)) \ + dpy->async_handlers = (handler)->next; \ + else \ + _XDeqAsyncHandler(dpy, handler); \ + } + +typedef void (*FreeFuncType) ( + Display* /* display */ +); + +typedef int (*FreeModmapType) ( + XModifierKeymap* /* modmap */ +); + +/* + * This structure is private to the library. + */ +typedef struct _XFreeFuncs { + FreeFuncType atoms; /* _XFreeAtomTable */ + FreeModmapType modifiermap; /* XFreeModifiermap */ + FreeFuncType key_bindings; /* _XFreeKeyBindings */ + FreeFuncType context_db; /* _XFreeContextDB */ + FreeFuncType defaultCCCs; /* _XcmsFreeDefaultCCCs */ + FreeFuncType clientCmaps; /* _XcmsFreeClientCmaps */ + FreeFuncType intensityMaps; /* _XcmsFreeIntensityMaps */ + FreeFuncType im_filters; /* _XFreeIMFilters */ + FreeFuncType xkb; /* _XkbFreeInfo */ +} _XFreeFuncRec; + +/* types for InitExt.c */ +typedef int (*CreateGCType) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + +typedef int (*CopyGCType)( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + +typedef int (*FlushGCType) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + +typedef int (*FreeGCType) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ +); + +typedef int (*CreateFontType) ( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + +typedef int (*FreeFontType) ( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ +); + +typedef int (*CloseDisplayType) ( + Display* /* display */, + XExtCodes* /* codes */ +); + +typedef int (*ErrorType) ( + Display* /* display */, + xError* /* err */, + XExtCodes* /* codes */, + int* /* ret_code */ +); + +typedef char* (*ErrorStringType) ( + Display* /* display */, + int /* code */, + XExtCodes* /* codes */, + char* /* buffer */, + int /* nbytes */ +); + +typedef void (*PrintErrorType)( + Display* /* display */, + XErrorEvent* /* ev */, + void* /* fp */ +); + +typedef void (*BeforeFlushType)( + Display* /* display */, + XExtCodes* /* codes */, + _Xconst char* /* data */, + long /* len */ +); + +/* + * This structure is private to the library. + */ +typedef struct _XExten { /* private to extension mechanism */ + struct _XExten *next; /* next in list */ + XExtCodes codes; /* public information, all extension told */ + CreateGCType create_GC; /* routine to call when GC created */ + CopyGCType copy_GC; /* routine to call when GC copied */ + FlushGCType flush_GC; /* routine to call when GC flushed */ + FreeGCType free_GC; /* routine to call when GC freed */ + CreateFontType create_Font; /* routine to call when Font created */ + FreeFontType free_Font; /* routine to call when Font freed */ + CloseDisplayType close_display; /* routine to call when connection closed */ + ErrorType error; /* who to call when an error occurs */ + ErrorStringType error_string; /* routine to supply error string */ + char *name; /* name of this extension */ + PrintErrorType error_values; /* routine to supply error values */ + BeforeFlushType before_flush; /* routine to call when sending data */ + struct _XExten *next_flush; /* next in list of those with flushes */ +} _XExtension; + +/* Temporary definition until we can depend on an xproto release with it */ +#ifdef _X_COLD +# define _XLIB_COLD _X_COLD +#elif defined(__GNUC__) && ((__GNUC__ * 100 + __GNUC_MINOR__) >= 403) /* 4.3+ */ +# define _XLIB_COLD __attribute__((__cold__)) +#else +# define _XLIB_COLD /* nothing */ +#endif + +/* extension hooks */ + +#ifdef DataRoutineIsProcedure +extern void Data(Display *dpy, char *data, long len); +#endif +extern int _XError( + Display* /* dpy */, + xError* /* rep */ +); +extern int _XIOError( + Display* /* dpy */ +#ifdef NX_TRANS_SOCKET +); +#else +) _X_NORETURN; +#endif /* NX_TRANS_SOCKET */ + +extern int (*_XIOErrorFunction)( + Display* /* dpy */ +); +extern int (*_XErrorFunction)( + Display* /* dpy */, + XErrorEvent* /* error_event */ +); +extern void _XEatData( + Display* /* dpy */, + unsigned long /* n */ +) _XLIB_COLD; +extern void _XEatDataWords( + Display* /* dpy */, + unsigned long /* n */ +) _XLIB_COLD; +#if defined(__SUNPRO_C) /* Studio compiler alternative to "cold" attribute */ +# pragma rarely_called(_XEatData, _XEatDataWords) +#endif +extern char *_XAllocScratch( + Display* /* dpy */, + unsigned long /* nbytes */ +); +extern char *_XAllocTemp( + Display* /* dpy */, + unsigned long /* nbytes */ +); +extern void _XFreeTemp( + Display* /* dpy */, + char* /* buf */, + unsigned long /* nbytes */ +); +extern Visual *_XVIDtoVisual( + Display* /* dpy */, + VisualID /* id */ +); +extern unsigned long _XSetLastRequestRead( + Display* /* dpy */, + xGenericReply* /* rep */ +); +extern int _XGetHostname( + char* /* buf */, + int /* maxlen */ +); +extern Screen *_XScreenOfWindow( + Display* /* dpy */, + Window /* w */ +); +extern Bool _XAsyncErrorHandler( + Display* /* dpy */, + xReply* /* rep */, + char* /* buf */, + int /* len */, + XPointer /* data */ +); +extern char *_XGetAsyncReply( + Display* /* dpy */, + char* /* replbuf */, + xReply* /* rep */, + char* /* buf */, + int /* len */, + int /* extra */, + Bool /* discard */ +); +extern void _XGetAsyncData( + Display* /* dpy */, + char * /* data */, + char * /* buf */, + int /* len */, + int /* skip */, + int /* datalen */, + int /* discardtotal */ +); +extern void _XFlush( + Display* /* dpy */ +); +extern int _XEventsQueued( + Display* /* dpy */, + int /* mode */ +); +extern void _XReadEvents( + Display* /* dpy */ +); +extern int _XRead( + Display* /* dpy */, + char* /* data */, + long /* size */ +); +extern void _XReadPad( + Display* /* dpy */, + char* /* data */, + long /* size */ +); +extern void _XSend( + Display* /* dpy */, + _Xconst char* /* data */, + long /* size */ +); +extern Status _XReply( + Display* /* dpy */, + xReply* /* rep */, + int /* extra */, + Bool /* discard */ +); +extern void _XEnq( + Display* /* dpy */, + xEvent* /* event */ +); +extern void _XDeq( + Display* /* dpy */, + _XQEvent* /* prev */, + _XQEvent* /* qelt */ +); + +extern Bool _XUnknownWireEvent( + Display* /* dpy */, + XEvent* /* re */, + xEvent* /* event */ +); + +extern Bool _XUnknownWireEventCookie( + Display* /* dpy */, + XGenericEventCookie* /* re */, + xEvent* /* event */ +); + +extern Bool _XUnknownCopyEventCookie( + Display* /* dpy */, + XGenericEventCookie* /* in */, + XGenericEventCookie* /* out */ +); + +extern Status _XUnknownNativeEvent( + Display* /* dpy */, + XEvent* /* re */, + xEvent* /* event */ +); + +extern Bool _XWireToEvent(Display *dpy, XEvent *re, xEvent *event); +extern Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we); +extern Bool _XPollfdCacheInit(Display *dpy); +extern void _XPollfdCacheAdd(Display *dpy, int fd); +extern void _XPollfdCacheDel(Display *dpy, int fd); +extern XID _XAllocID(Display *dpy); +extern void _XAllocIDs(Display *dpy, XID *ids, int count); + +extern int _XFreeExtData( + XExtData* /* extension */ +); + +extern int (*XESetCreateGC( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, GC, XExtCodes* +); + +extern int (*XESetCopyGC( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, GC, XExtCodes* +); + +extern int (*XESetFlushGC( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, GC, XExtCodes* +); + +extern int (*XESetFreeGC( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + GC /* gc */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, GC, XExtCodes* +); + +extern int (*XESetCreateFont( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, XFontStruct*, XExtCodes* +); + +extern int (*XESetFreeFont( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + XFontStruct* /* fs */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, XFontStruct*, XExtCodes* +); + +extern int (*XESetCloseDisplay( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + XExtCodes* /* codes */ + ) /* proc */ +))( + Display*, XExtCodes* +); + +extern int (*XESetError( + Display* /* display */, + int /* extension */, + int (*) ( + Display* /* display */, + xError* /* err */, + XExtCodes* /* codes */, + int* /* ret_code */ + ) /* proc */ +))( + Display*, xError*, XExtCodes*, int* +); + +extern char* (*XESetErrorString( + Display* /* display */, + int /* extension */, + char* (*) ( + Display* /* display */, + int /* code */, + XExtCodes* /* codes */, + char* /* buffer */, + int /* nbytes */ + ) /* proc */ +))( + Display*, int, XExtCodes*, char*, int +); + +extern void (*XESetPrintErrorValues ( + Display* /* display */, + int /* extension */, + void (*)( + Display* /* display */, + XErrorEvent* /* ev */, + void* /* fp */ + ) /* proc */ +))( + Display*, XErrorEvent*, void* +); + +extern Bool (*XESetWireToEvent( + Display* /* display */, + int /* event_number */, + Bool (*) ( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ + ) /* proc */ +))( + Display*, XEvent*, xEvent* +); + +extern Bool (*XESetWireToEventCookie( + Display* /* display */, + int /* extension */, + Bool (*) ( + Display* /* display */, + XGenericEventCookie* /* re */, + xEvent* /* event */ + ) /* proc */ +))( + Display*, XGenericEventCookie*, xEvent* +); + +extern Bool (*XESetCopyEventCookie( + Display* /* display */, + int /* extension */, + Bool (*) ( + Display* /* display */, + XGenericEventCookie* /* in */, + XGenericEventCookie* /* out */ + ) /* proc */ +))( + Display*, XGenericEventCookie*, XGenericEventCookie* +); + + +extern Status (*XESetEventToWire( + Display* /* display */, + int /* event_number */, + Status (*) ( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ + ) /* proc */ +))( + Display*, XEvent*, xEvent* +); + +extern Bool (*XESetWireToError( + Display* /* display */, + int /* error_number */, + Bool (*) ( + Display* /* display */, + XErrorEvent* /* he */, + xError* /* we */ + ) /* proc */ +))( + Display*, XErrorEvent*, xError* +); + +extern void (*XESetBeforeFlush( + Display* /* display */, + int /* error_number */, + void (*) ( + Display* /* display */, + XExtCodes* /* codes */, + _Xconst char* /* data */, + long /* len */ + ) /* proc */ +))( + Display*, XExtCodes*, _Xconst char*, long +); + +/* internal connections for IMs */ + +typedef void (*_XInternalConnectionProc)( + Display* /* dpy */, + int /* fd */, + XPointer /* call_data */ +); + + +extern Status _XRegisterInternalConnection( + Display* /* dpy */, + int /* fd */, + _XInternalConnectionProc /* callback */, + XPointer /* call_data */ +); + +extern void _XUnregisterInternalConnection( + Display* /* dpy */, + int /* fd */ +); + +extern void _XProcessInternalConnection( + Display* /* dpy */, + struct _XConnectionInfo* /* conn_info */ +); + +/* Display structure has pointers to these */ + +struct _XConnectionInfo { /* info from _XRegisterInternalConnection */ + int fd; + _XInternalConnectionProc read_callback; + XPointer call_data; + XPointer *watch_data; /* set/used by XConnectionWatchProc */ + struct _XConnectionInfo *next; +}; + +struct _XConnWatchInfo { /* info from XAddConnectionWatch */ + XConnectionWatchProc fn; + XPointer client_data; + struct _XConnWatchInfo *next; +}; + +extern int _XTextHeight( + XFontStruct* /* font_struct */, + _Xconst char* /* string */, + int /* count */ +); + +extern int _XTextHeight16( + XFontStruct* /* font_struct */, + _Xconst XChar2b* /* string */, + int /* count */ +); + +#if defined(WIN32) + +extern int _XOpenFile( + _Xconst char* /* path */, + int /* flags */ +); + +extern int _XOpenFileMode( + _Xconst char* /* path */, + int /* flags */, + mode_t /* mode */ +); + +extern void* _XFopenFile( + _Xconst char* /* path */, + _Xconst char* /* mode */ +); + +extern int _XAccessFile( + _Xconst char* /* path */ +); +#else +#define _XOpenFile(path,flags) open(path,flags) +#define _XOpenFileMode(path,flags,mode) open(path,flags,mode) +#define _XFopenFile(path,mode) fopen(path,mode) +#endif + +/* EvToWire.c */ +extern Status _XEventToWire(Display *dpy, XEvent *re, xEvent *event); + +extern int _XF86LoadQueryLocaleFont( + Display* /* dpy */, + _Xconst char* /* name*/, + XFontStruct** /* xfp*/, + Font* /* fidp */ +); + +extern void _XProcessWindowAttributes ( + register Display *dpy, + xChangeWindowAttributesReq *req, + register unsigned long valuemask, + register XSetWindowAttributes *attributes); + +extern int _XDefaultError( + Display *dpy, + XErrorEvent *event); + +extern int _XDefaultIOError( + Display *dpy); + +extern void _XSetClipRectangles ( + register Display *dpy, + GC gc, + int clip_x_origin, int clip_y_origin, + XRectangle *rectangles, + int n, + int ordering); + +Status _XGetWindowAttributes( + register Display *dpy, + Window w, + XWindowAttributes *attr); + +int _XPutBackEvent ( + register Display *dpy, + register XEvent *event); + +extern Bool _XIsEventCookie( + Display *dpy, + XEvent *ev); + +extern void _XFreeEventCookies( + Display *dpy); + +extern void _XStoreEventCookie( + Display *dpy, + XEvent *ev); + +extern Bool _XFetchEventCookie( + Display *dpy, + XGenericEventCookie *ev); + +extern Bool _XCopyEventCookie( + Display *dpy, + XGenericEventCookie *in, + XGenericEventCookie *out); + +/* lcFile.c */ + +extern void xlocaledir( + char *buf, + int buf_len +); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +_XFUNCPROTOEND + +#endif /* !defined(_X11_XLIBINT_H_) && !defined(_XLIBINT_H_) */ diff --git a/nx-X11/lib/include/X11/Xlocale.h b/nx-X11/lib/include/X11/Xlocale.h new file mode 100644 index 000000000..4ac9bac30 --- /dev/null +++ b/nx-X11/lib/include/X11/Xlocale.h @@ -0,0 +1,38 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#if !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) +#define _X11_XLOCALE_H_ +#define _XLOCALE_H_ + +#include +#include + +#include + +#endif /* !defined(_X11_XLOCALE_H_) && !defined(_XLOCALE_H_) */ diff --git a/nx-X11/lib/include/X11/Xregion.h b/nx-X11/lib/include/X11/Xregion.h new file mode 100644 index 000000000..4f55af82f --- /dev/null +++ b/nx-X11/lib/include/X11/Xregion.h @@ -0,0 +1,191 @@ +/************************************************************************ + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +************************************************************************/ + +#if !defined(_X11_XREGION_H_) && !defined(_XREGION_H) +#define _X11_XREGION_H_ +#define _XREGION_H + +typedef struct { + short x1, x2, y1, y2; +} Box, BOX, BoxRec, *BoxPtr; + +typedef struct { + short x, y, width, height; +}RECTANGLE, RectangleRec, *RectanglePtr; + +#define TRUE 1 +#define FALSE 0 +#define MAXSHORT 32767 +#define MINSHORT -MAXSHORT +#ifndef MAX +#define MAX(a,b) (((a) > (b)) ? (a) : (b)) +#endif +#ifndef MIN +#define MIN(a,b) (((a) < (b)) ? (a) : (b)) +#endif + + +/* + * clip region + */ + +typedef struct _XRegion { + long size; + long numRects; + BOX *rects; + BOX extents; +} REGION; + +/* Xutil.h contains the declaration: + * typedef struct _XRegion *Region; + */ + +/* 1 if two BOXs overlap. + * 0 if two BOXs do not overlap. + * Remember, x2 and y2 are not in the region + */ +#define EXTENTCHECK(r1, r2) \ + ((r1)->x2 > (r2)->x1 && \ + (r1)->x1 < (r2)->x2 && \ + (r1)->y2 > (r2)->y1 && \ + (r1)->y1 < (r2)->y2) + +/* + * update region extents + */ +#define EXTENTS(r,idRect){\ + if((r)->x1 < (idRect)->extents.x1)\ + (idRect)->extents.x1 = (r)->x1;\ + if((r)->y1 < (idRect)->extents.y1)\ + (idRect)->extents.y1 = (r)->y1;\ + if((r)->x2 > (idRect)->extents.x2)\ + (idRect)->extents.x2 = (r)->x2;\ + if((r)->y2 > (idRect)->extents.y2)\ + (idRect)->extents.y2 = (r)->y2;\ + } + +/* + * Check to see if there is enough memory in the present region. + */ +#define MEMCHECK(reg, rect, firstrect){\ + if ((reg)->numRects >= ((reg)->size - 1)){\ + BoxPtr tmpRect = Xrealloc ((firstrect), \ + (2 * (sizeof(BOX)) * ((reg)->size))); \ + if (tmpRect == NULL) \ + return(0);\ + (firstrect) = tmpRect; \ + (reg)->size *= 2;\ + (rect) = &(firstrect)[(reg)->numRects];\ + }\ + } + +/* this routine checks to see if the previous rectangle is the same + * or subsumes the new rectangle to add. + */ + +#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\ + (!(((Reg)->numRects > 0)&&\ + ((R-1)->y1 == (Ry1)) &&\ + ((R-1)->y2 == (Ry2)) &&\ + ((R-1)->x1 <= (Rx1)) &&\ + ((R-1)->x2 >= (Rx2)))) + +/* add a rectangle to the given Region */ +#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\ + if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\ + CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ + (r)->x1 = (rx1);\ + (r)->y1 = (ry1);\ + (r)->x2 = (rx2);\ + (r)->y2 = (ry2);\ + EXTENTS((r), (reg));\ + (reg)->numRects++;\ + (r)++;\ + }\ + } + + + +/* add a rectangle to the given Region */ +#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\ + if ((rx1 < rx2) && (ry1 < ry2) &&\ + CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\ + (r)->x1 = (rx1);\ + (r)->y1 = (ry1);\ + (r)->x2 = (rx2);\ + (r)->y2 = (ry2);\ + (reg)->numRects++;\ + (r)++;\ + }\ + } + +#define EMPTY_REGION(pReg) pReg->numRects = 0 + +#define REGION_NOT_EMPTY(pReg) pReg->numRects + +#define INBOX(r, x, y) \ + ( ( ((r).x2 > x)) && \ + ( ((r).x1 <= x)) && \ + ( ((r).y2 > y)) && \ + ( ((r).y1 <= y)) ) + +/* + * number of points to buffer before sending them off + * to scanlines() : Must be an even number + */ +#define NUMPTSTOBUFFER 200 + +/* + * used to allocate buffers for points and link + * the buffers together + */ +typedef struct _POINTBLOCK { + XPoint pts[NUMPTSTOBUFFER]; + struct _POINTBLOCK *next; +} POINTBLOCK; + +#endif /* !defined(_X11_XREGION_H_) && !defined(_XREGION_H) */ diff --git a/nx-X11/lib/include/X11/Xresource.h b/nx-X11/lib/include/X11/Xresource.h new file mode 100644 index 000000000..f3977a209 --- /dev/null +++ b/nx-X11/lib/include/X11/Xresource.h @@ -0,0 +1,359 @@ + +/*********************************************************** + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#if !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) +#define _X11_XRESOURCE_H_ +#define _XRESOURCE_H_ + +#ifndef _XP_PRINT_SERVER_ +#include +#endif + +/**************************************************************** + **************************************************************** + *** *** + *** *** + *** X Resource Manager Intrinsics *** + *** *** + *** *** + **************************************************************** + ****************************************************************/ + +_XFUNCPROTOBEGIN + +/**************************************************************** + * + * Memory Management + * + ****************************************************************/ + +extern char *Xpermalloc( + unsigned int /* size */ +); + +/**************************************************************** + * + * Quark Management + * + ****************************************************************/ + +typedef int XrmQuark, *XrmQuarkList; +#define NULLQUARK ((XrmQuark) 0) + +typedef char *XrmString; +#define NULLSTRING ((XrmString) 0) + +/* find quark for string, create new quark if none already exists */ +extern XrmQuark XrmStringToQuark( + _Xconst char* /* string */ +); + +extern XrmQuark XrmPermStringToQuark( + _Xconst char* /* string */ +); + +/* find string for quark */ +extern XrmString XrmQuarkToString( + XrmQuark /* quark */ +); + +extern XrmQuark XrmUniqueQuark( + void +); + +#define XrmStringsEqual(a1, a2) (strcmp(a1, a2) == 0) + + +/**************************************************************** + * + * Conversion of Strings to Lists + * + ****************************************************************/ + +typedef enum {XrmBindTightly, XrmBindLoosely} XrmBinding, *XrmBindingList; + +extern void XrmStringToQuarkList( + _Xconst char* /* string */, + XrmQuarkList /* quarks_return */ +); + +extern void XrmStringToBindingQuarkList( + _Xconst char* /* string */, + XrmBindingList /* bindings_return */, + XrmQuarkList /* quarks_return */ +); + +/**************************************************************** + * + * Name and Class lists. + * + ****************************************************************/ + +typedef XrmQuark XrmName; +typedef XrmQuarkList XrmNameList; +#define XrmNameToString(name) XrmQuarkToString(name) +#define XrmStringToName(string) XrmStringToQuark(string) +#define XrmStringToNameList(str, name) XrmStringToQuarkList(str, name) + +typedef XrmQuark XrmClass; +typedef XrmQuarkList XrmClassList; +#define XrmClassToString(c_class) XrmQuarkToString(c_class) +#define XrmStringToClass(c_class) XrmStringToQuark(c_class) +#define XrmStringToClassList(str,c_class) XrmStringToQuarkList(str, c_class) + + + +/**************************************************************** + * + * Resource Representation Types and Values + * + ****************************************************************/ + +typedef XrmQuark XrmRepresentation; +#define XrmStringToRepresentation(string) XrmStringToQuark(string) +#define XrmRepresentationToString(type) XrmQuarkToString(type) + +typedef struct { + unsigned int size; + XPointer addr; +} XrmValue, *XrmValuePtr; + + +/**************************************************************** + * + * Resource Manager Functions + * + ****************************************************************/ + +typedef struct _XrmHashBucketRec *XrmHashBucket; +typedef XrmHashBucket *XrmHashTable; +typedef XrmHashTable XrmSearchList[]; +typedef struct _XrmHashBucketRec *XrmDatabase; + + +extern void XrmDestroyDatabase( + XrmDatabase /* database */ +); + +extern void XrmQPutResource( + XrmDatabase* /* database */, + XrmBindingList /* bindings */, + XrmQuarkList /* quarks */, + XrmRepresentation /* type */, + XrmValue* /* value */ +); + +extern void XrmPutResource( + XrmDatabase* /* database */, + _Xconst char* /* specifier */, + _Xconst char* /* type */, + XrmValue* /* value */ +); + +extern void XrmQPutStringResource( + XrmDatabase* /* database */, + XrmBindingList /* bindings */, + XrmQuarkList /* quarks */, + _Xconst char* /* value */ +); + +extern void XrmPutStringResource( + XrmDatabase* /* database */, + _Xconst char* /* specifier */, + _Xconst char* /* value */ +); + +extern void XrmPutLineResource( + XrmDatabase* /* database */, + _Xconst char* /* line */ +); + +extern Bool XrmQGetResource( + XrmDatabase /* database */, + XrmNameList /* quark_name */, + XrmClassList /* quark_class */, + XrmRepresentation* /* quark_type_return */, + XrmValue* /* value_return */ +); + +extern Bool XrmGetResource( + XrmDatabase /* database */, + _Xconst char* /* str_name */, + _Xconst char* /* str_class */, + char** /* str_type_return */, + XrmValue* /* value_return */ +); + +extern Bool XrmQGetSearchList( + XrmDatabase /* database */, + XrmNameList /* names */, + XrmClassList /* classes */, + XrmSearchList /* list_return */, + int /* list_length */ +); + +extern Bool XrmQGetSearchResource( + XrmSearchList /* list */, + XrmName /* name */, + XrmClass /* class */, + XrmRepresentation* /* type_return */, + XrmValue* /* value_return */ +); + +/**************************************************************** + * + * Resource Database Management + * + ****************************************************************/ + +#ifndef _XP_PRINT_SERVER_ + +extern void XrmSetDatabase( + Display* /* display */, + XrmDatabase /* database */ +); + +extern XrmDatabase XrmGetDatabase( + Display* /* display */ +); + +#endif /* !_XP_PRINT_SERVER_ */ + +extern XrmDatabase XrmGetFileDatabase( + _Xconst char* /* filename */ +); + +extern Status XrmCombineFileDatabase( + _Xconst char* /* filename */, + XrmDatabase* /* target */, + Bool /* override */ +); + +extern XrmDatabase XrmGetStringDatabase( + _Xconst char* /* data */ /* null terminated string */ +); + +extern void XrmPutFileDatabase( + XrmDatabase /* database */, + _Xconst char* /* filename */ +); + +extern void XrmMergeDatabases( + XrmDatabase /* source_db */, + XrmDatabase* /* target_db */ +); + +extern void XrmCombineDatabase( + XrmDatabase /* source_db */, + XrmDatabase* /* target_db */, + Bool /* override */ +); + +#define XrmEnumAllLevels 0 +#define XrmEnumOneLevel 1 + +extern Bool XrmEnumerateDatabase( + XrmDatabase /* db */, + XrmNameList /* name_prefix */, + XrmClassList /* class_prefix */, + int /* mode */, + Bool (*)( + XrmDatabase* /* db */, + XrmBindingList /* bindings */, + XrmQuarkList /* quarks */, + XrmRepresentation* /* type */, + XrmValue* /* value */, + XPointer /* closure */ + ) /* proc */, + XPointer /* closure */ +); + +extern const char *XrmLocaleOfDatabase( + XrmDatabase /* database */ +); + + +/**************************************************************** + * + * Command line option mapping to resource entries + * + ****************************************************************/ + +typedef enum { + XrmoptionNoArg, /* Value is specified in OptionDescRec.value */ + XrmoptionIsArg, /* Value is the option string itself */ + XrmoptionStickyArg, /* Value is characters immediately following option */ + XrmoptionSepArg, /* Value is next argument in argv */ + XrmoptionResArg, /* Resource and value in next argument in argv */ + XrmoptionSkipArg, /* Ignore this option and the next argument in argv */ + XrmoptionSkipLine, /* Ignore this option and the rest of argv */ + XrmoptionSkipNArgs /* Ignore this option and the next + OptionDescRes.value arguments in argv */ +} XrmOptionKind; + +typedef struct { + char *option; /* Option abbreviation in argv */ + char *specifier; /* Resource specifier */ + XrmOptionKind argKind; /* Which style of option it is */ + XPointer value; /* Value to provide if XrmoptionNoArg */ +} XrmOptionDescRec, *XrmOptionDescList; + + +extern void XrmParseCommand( + XrmDatabase* /* database */, + XrmOptionDescList /* table */, + int /* table_count */, + _Xconst char* /* name */, + int* /* argc_in_out */, + char** /* argv_in_out */ +); + +_XFUNCPROTOEND + +#endif /* !defined(_X11_XRESOURCE_H_) && !defined(_XRESOURCE_H_) */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/include/X11/Xutil.h b/nx-X11/lib/include/X11/Xutil.h new file mode 100644 index 000000000..48fa23cf5 --- /dev/null +++ b/nx-X11/lib/include/X11/Xutil.h @@ -0,0 +1,839 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#if !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) +#define _X11_XUTIL_H_ +#define _XUTIL_H_ + +/* You must include before including this file */ +#include +#include + +/* The Xlib structs are full of implicit padding to properly align members. + We can't clean that up without breaking ABI, so tell clang not to bother + complaining about it. */ +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +/* + * Bitmask returned by XParseGeometry(). Each bit tells if the corresponding + * value (x, y, width, height) was found in the parsed string. + */ +#define NoValue 0x0000 +#define XValue 0x0001 +#define YValue 0x0002 +#define WidthValue 0x0004 +#define HeightValue 0x0008 +#define AllValues 0x000F +#define XNegative 0x0010 +#define YNegative 0x0020 + +/* + * new version containing base_width, base_height, and win_gravity fields; + * used with WM_NORMAL_HINTS. + */ +typedef struct { + long flags; /* marks which fields in this structure are defined */ + int x, y; /* obsolete for new window mgrs, but clients */ + int width, height; /* should set so old wm's don't mess up */ + int min_width, min_height; + int max_width, max_height; + int width_inc, height_inc; + struct { + int x; /* numerator */ + int y; /* denominator */ + } min_aspect, max_aspect; + int base_width, base_height; /* added by ICCCM version 1 */ + int win_gravity; /* added by ICCCM version 1 */ +} XSizeHints; + +/* + * The next block of definitions are for window manager properties that + * clients and applications use for communication. + */ + +/* flags argument in size hints */ +#define USPosition (1L << 0) /* user specified x, y */ +#define USSize (1L << 1) /* user specified width, height */ + +#define PPosition (1L << 2) /* program specified position */ +#define PSize (1L << 3) /* program specified size */ +#define PMinSize (1L << 4) /* program specified minimum size */ +#define PMaxSize (1L << 5) /* program specified maximum size */ +#define PResizeInc (1L << 6) /* program specified resize increments */ +#define PAspect (1L << 7) /* program specified min and max aspect ratios */ +#define PBaseSize (1L << 8) /* program specified base for incrementing */ +#define PWinGravity (1L << 9) /* program specified window gravity */ + +/* obsolete */ +#define PAllHints (PPosition|PSize|PMinSize|PMaxSize|PResizeInc|PAspect) + + + +typedef struct { + long flags; /* marks which fields in this structure are defined */ + Bool input; /* does this application rely on the window manager to + get keyboard input? */ + int initial_state; /* see below */ + Pixmap icon_pixmap; /* pixmap to be used as icon */ + Window icon_window; /* window to be used as icon */ + int icon_x, icon_y; /* initial position of icon */ + Pixmap icon_mask; /* icon mask bitmap */ + XID window_group; /* id of related window group */ + /* this structure may be extended in the future */ +} XWMHints; + +/* definition for flags of XWMHints */ + +#define InputHint (1L << 0) +#define StateHint (1L << 1) +#define IconPixmapHint (1L << 2) +#define IconWindowHint (1L << 3) +#define IconPositionHint (1L << 4) +#define IconMaskHint (1L << 5) +#define WindowGroupHint (1L << 6) +#define AllHints (InputHint|StateHint|IconPixmapHint|IconWindowHint| \ +IconPositionHint|IconMaskHint|WindowGroupHint) +#define XUrgencyHint (1L << 8) + +/* definitions for initial window state */ +#define WithdrawnState 0 /* for windows that are not mapped */ +#define NormalState 1 /* most applications want to start this way */ +#define IconicState 3 /* application wants to start as an icon */ + +/* + * Obsolete states no longer defined by ICCCM + */ +#define DontCareState 0 /* don't know or care */ +#define ZoomState 2 /* application wants to start zoomed */ +#define InactiveState 4 /* application believes it is seldom used; */ + /* some wm's may put it on inactive menu */ + + +/* + * new structure for manipulating TEXT properties; used with WM_NAME, + * WM_ICON_NAME, WM_CLIENT_MACHINE, and WM_COMMAND. + */ +typedef struct { + unsigned char *value; /* same as Property routines */ + Atom encoding; /* prop type */ + int format; /* prop data format: 8, 16, or 32 */ + unsigned long nitems; /* number of data items in value */ +} XTextProperty; + +#define XNoMemory -1 +#define XLocaleNotSupported -2 +#define XConverterNotFound -3 + +typedef enum { + XStringStyle, /* STRING */ + XCompoundTextStyle, /* COMPOUND_TEXT */ + XTextStyle, /* text in owner's encoding (current locale)*/ + XStdICCTextStyle, /* STRING, else COMPOUND_TEXT */ + /* The following is an XFree86 extension, introduced in November 2000 */ + XUTF8StringStyle /* UTF8_STRING */ +} XICCEncodingStyle; + +typedef struct { + int min_width, min_height; + int max_width, max_height; + int width_inc, height_inc; +} XIconSize; + +typedef struct { + char *res_name; + char *res_class; +} XClassHint; + +#ifdef XUTIL_DEFINE_FUNCTIONS +extern int XDestroyImage( + XImage *ximage); +extern unsigned long XGetPixel( + XImage *ximage, + int x, int y); +extern int XPutPixel( + XImage *ximage, + int x, int y, + unsigned long pixel); +extern XImage *XSubImage( + XImage *ximage, + int x, int y, + unsigned int width, unsigned int height); +extern int XAddPixel( + XImage *ximage, + long value); +#else +/* + * These macros are used to give some sugar to the image routines so that + * naive people are more comfortable with them. + */ +#define XDestroyImage(ximage) \ + ((*((ximage)->f.destroy_image))((ximage))) +#define XGetPixel(ximage, x, y) \ + ((*((ximage)->f.get_pixel))((ximage), (x), (y))) +#define XPutPixel(ximage, x, y, pixel) \ + ((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))) +#define XSubImage(ximage, x, y, width, height) \ + ((*((ximage)->f.sub_image))((ximage), (x), (y), (width), (height))) +#define XAddPixel(ximage, value) \ + ((*((ximage)->f.add_pixel))((ximage), (value))) +#endif + +/* + * Compose sequence status structure, used in calling XLookupString. + */ +typedef struct _XComposeStatus { + XPointer compose_ptr; /* state table pointer */ + int chars_matched; /* match state */ +} XComposeStatus; + +/* + * Keysym macros, used on Keysyms to test for classes of symbols + */ +#define IsKeypadKey(keysym) \ + (((KeySym)(keysym) >= XK_KP_Space) && ((KeySym)(keysym) <= XK_KP_Equal)) + +#define IsPrivateKeypadKey(keysym) \ + (((KeySym)(keysym) >= 0x11000000) && ((KeySym)(keysym) <= 0x1100FFFF)) + +#define IsCursorKey(keysym) \ + (((KeySym)(keysym) >= XK_Home) && ((KeySym)(keysym) < XK_Select)) + +#define IsPFKey(keysym) \ + (((KeySym)(keysym) >= XK_KP_F1) && ((KeySym)(keysym) <= XK_KP_F4)) + +#define IsFunctionKey(keysym) \ + (((KeySym)(keysym) >= XK_F1) && ((KeySym)(keysym) <= XK_F35)) + +#define IsMiscFunctionKey(keysym) \ + (((KeySym)(keysym) >= XK_Select) && ((KeySym)(keysym) <= XK_Break)) + +#ifdef XK_XKB_KEYS +#define IsModifierKey(keysym) \ + ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ + || (((KeySym)(keysym) >= XK_ISO_Lock) && \ + ((KeySym)(keysym) <= XK_ISO_Level5_Lock)) \ + || ((KeySym)(keysym) == XK_Mode_switch) \ + || ((KeySym)(keysym) == XK_Num_Lock)) +#else +#define IsModifierKey(keysym) \ + ((((KeySym)(keysym) >= XK_Shift_L) && ((KeySym)(keysym) <= XK_Hyper_R)) \ + || ((KeySym)(keysym) == XK_Mode_switch) \ + || ((KeySym)(keysym) == XK_Num_Lock)) +#endif +/* + * opaque reference to Region data type + */ +typedef struct _XRegion *Region; + +/* Return values from XRectInRegion() */ + +#define RectangleOut 0 +#define RectangleIn 1 +#define RectanglePart 2 + + +/* + * Information used by the visual utility routines to find desired visual + * type from the many visuals a display may support. + */ + +typedef struct { + Visual *visual; + VisualID visualid; + int screen; + int depth; +#if defined(__cplusplus) || defined(c_plusplus) + int c_class; /* C++ */ +#else + int class; +#endif + unsigned long red_mask; + unsigned long green_mask; + unsigned long blue_mask; + int colormap_size; + int bits_per_rgb; +} XVisualInfo; + +#define VisualNoMask 0x0 +#define VisualIDMask 0x1 +#define VisualScreenMask 0x2 +#define VisualDepthMask 0x4 +#define VisualClassMask 0x8 +#define VisualRedMaskMask 0x10 +#define VisualGreenMaskMask 0x20 +#define VisualBlueMaskMask 0x40 +#define VisualColormapSizeMask 0x80 +#define VisualBitsPerRGBMask 0x100 +#define VisualAllMask 0x1FF + +/* + * This defines a window manager property that clients may use to + * share standard color maps of type RGB_COLOR_MAP: + */ +typedef struct { + Colormap colormap; + unsigned long red_max; + unsigned long red_mult; + unsigned long green_max; + unsigned long green_mult; + unsigned long blue_max; + unsigned long blue_mult; + unsigned long base_pixel; + VisualID visualid; /* added by ICCCM version 1 */ + XID killid; /* added by ICCCM version 1 */ +} XStandardColormap; + +#define ReleaseByFreeingColormap ((XID) 1L) /* for killid field above */ + + +/* + * return codes for XReadBitmapFile and XWriteBitmapFile + */ +#define BitmapSuccess 0 +#define BitmapOpenFailed 1 +#define BitmapFileInvalid 2 +#define BitmapNoMemory 3 + +/**************************************************************** + * + * Context Management + * + ****************************************************************/ + + +/* Associative lookup table return codes */ + +#define XCSUCCESS 0 /* No error. */ +#define XCNOMEM 1 /* Out of memory */ +#define XCNOENT 2 /* No entry in table */ + +typedef int XContext; + +#define XUniqueContext() ((XContext) XrmUniqueQuark()) +#define XStringToContext(string) ((XContext) XrmStringToQuark(string)) + +_XFUNCPROTOBEGIN + +/* The following declarations are alphabetized. */ + +extern XClassHint *XAllocClassHint ( + void +); + +extern XIconSize *XAllocIconSize ( + void +); + +extern XSizeHints *XAllocSizeHints ( + void +); + +extern XStandardColormap *XAllocStandardColormap ( + void +); + +extern XWMHints *XAllocWMHints ( + void +); + +extern int XClipBox( + Region /* r */, + XRectangle* /* rect_return */ +); + +extern Region XCreateRegion( + void +); + +extern const char *XDefaultString (void); + +extern int XDeleteContext( + Display* /* display */, + XID /* rid */, + XContext /* context */ +); + +extern int XDestroyRegion( + Region /* r */ +); + +extern int XEmptyRegion( + Region /* r */ +); + +extern int XEqualRegion( + Region /* r1 */, + Region /* r2 */ +); + +extern int XFindContext( + Display* /* display */, + XID /* rid */, + XContext /* context */, + XPointer* /* data_return */ +); + +extern Status XGetClassHint( + Display* /* display */, + Window /* w */, + XClassHint* /* class_hints_return */ +); + +extern Status XGetIconSizes( + Display* /* display */, + Window /* w */, + XIconSize** /* size_list_return */, + int* /* count_return */ +); + +extern Status XGetNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */ +); + +extern Status XGetRGBColormaps( + Display* /* display */, + Window /* w */, + XStandardColormap** /* stdcmap_return */, + int* /* count_return */, + Atom /* property */ +); + +extern Status XGetSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + Atom /* property */ +); + +extern Status XGetStandardColormap( + Display* /* display */, + Window /* w */, + XStandardColormap* /* colormap_return */, + Atom /* property */ +); + +extern Status XGetTextProperty( + Display* /* display */, + Window /* window */, + XTextProperty* /* text_prop_return */, + Atom /* property */ +); + +extern XVisualInfo *XGetVisualInfo( + Display* /* display */, + long /* vinfo_mask */, + XVisualInfo* /* vinfo_template */, + int* /* nitems_return */ +); + +extern Status XGetWMClientMachine( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern XWMHints *XGetWMHints( + Display* /* display */, + Window /* w */ +); + +extern Status XGetWMIconName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern Status XGetWMName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop_return */ +); + +extern Status XGetWMNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + long* /* supplied_return */ +); + +extern Status XGetWMSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints_return */, + long* /* supplied_return */, + Atom /* property */ +); + +extern Status XGetZoomHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* zhints_return */ +); + +extern int XIntersectRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern void XConvertCase( + KeySym /* sym */, + KeySym* /* lower */, + KeySym* /* upper */ +); + +extern int XLookupString( + XKeyEvent* /* event_struct */, + char* /* buffer_return */, + int /* bytes_buffer */, + KeySym* /* keysym_return */, + XComposeStatus* /* status_in_out */ +); + +extern Status XMatchVisualInfo( + Display* /* display */, + int /* screen */, + int /* depth */, + int /* class */, + XVisualInfo* /* vinfo_return */ +); + +extern int XOffsetRegion( + Region /* r */, + int /* dx */, + int /* dy */ +); + +extern Bool XPointInRegion( + Region /* r */, + int /* x */, + int /* y */ +); + +extern Region XPolygonRegion( + XPoint* /* points */, + int /* n */, + int /* fill_rule */ +); + +extern int XRectInRegion( + Region /* r */, + int /* x */, + int /* y */, + unsigned int /* width */, + unsigned int /* height */ +); + +extern int XSaveContext( + Display* /* display */, + XID /* rid */, + XContext /* context */, + _Xconst char* /* data */ +); + +extern int XSetClassHint( + Display* /* display */, + Window /* w */, + XClassHint* /* class_hints */ +); + +extern int XSetIconSizes( + Display* /* display */, + Window /* w */, + XIconSize* /* size_list */, + int /* count */ +); + +extern int XSetNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */ +); + +extern void XSetRGBColormaps( + Display* /* display */, + Window /* w */, + XStandardColormap* /* stdcmaps */, + int /* count */, + Atom /* property */ +); + +extern int XSetSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */, + Atom /* property */ +); + +extern int XSetStandardProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + Pixmap /* icon_pixmap */, + char** /* argv */, + int /* argc */, + XSizeHints* /* hints */ +); + +extern void XSetTextProperty( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */, + Atom /* property */ +); + +extern void XSetWMClientMachine( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern int XSetWMHints( + Display* /* display */, + Window /* w */, + XWMHints* /* wm_hints */ +); + +extern void XSetWMIconName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern void XSetWMName( + Display* /* display */, + Window /* w */, + XTextProperty* /* text_prop */ +); + +extern void XSetWMNormalHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */ +); + +extern void XSetWMProperties( + Display* /* display */, + Window /* w */, + XTextProperty* /* window_name */, + XTextProperty* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void XmbSetWMProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void Xutf8SetWMProperties( + Display* /* display */, + Window /* w */, + _Xconst char* /* window_name */, + _Xconst char* /* icon_name */, + char** /* argv */, + int /* argc */, + XSizeHints* /* normal_hints */, + XWMHints* /* wm_hints */, + XClassHint* /* class_hints */ +); + +extern void XSetWMSizeHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* hints */, + Atom /* property */ +); + +extern int XSetRegion( + Display* /* display */, + GC /* gc */, + Region /* r */ +); + +extern void XSetStandardColormap( + Display* /* display */, + Window /* w */, + XStandardColormap* /* colormap */, + Atom /* property */ +); + +extern int XSetZoomHints( + Display* /* display */, + Window /* w */, + XSizeHints* /* zhints */ +); + +extern int XShrinkRegion( + Region /* r */, + int /* dx */, + int /* dy */ +); + +extern Status XStringListToTextProperty( + char** /* list */, + int /* count */, + XTextProperty* /* text_prop_return */ +); + +extern int XSubtractRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern int XmbTextListToTextProperty( + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern int XwcTextListToTextProperty( + Display* display, + wchar_t** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern int Xutf8TextListToTextProperty( + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +extern void XwcFreeStringList( + wchar_t** list +); + +extern Status XTextPropertyToStringList( + XTextProperty* /* text_prop */, + char*** /* list_return */, + int* /* count_return */ +); + +extern int XmbTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +extern int XwcTextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + wchar_t*** list_return, + int* count_return +); + +extern int Xutf8TextPropertyToTextList( + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +extern int XUnionRectWithRegion( + XRectangle* /* rectangle */, + Region /* src_region */, + Region /* dest_region_return */ +); + +extern int XUnionRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +extern int XWMGeometry( + Display* /* display */, + int /* screen_number */, + _Xconst char* /* user_geometry */, + _Xconst char* /* default_geometry */, + unsigned int /* border_width */, + XSizeHints* /* hints */, + int* /* x_return */, + int* /* y_return */, + int* /* width_return */, + int* /* height_return */, + int* /* gravity_return */ +); + +extern int XXorRegion( + Region /* sra */, + Region /* srb */, + Region /* dr_return */ +); + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +_XFUNCPROTOEND + +#endif /* !defined(_X11_XUTIL_H_) && !defined(_XUTIL_H_) */ diff --git a/nx-X11/lib/include/X11/cursorfont.h b/nx-X11/lib/include/X11/cursorfont.h new file mode 100644 index 000000000..a0fbf3c6b --- /dev/null +++ b/nx-X11/lib/include/X11/cursorfont.h @@ -0,0 +1,112 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#if !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) +#define _X11_CURSORFONT_H_ +#define _cursorfont_h_ + +#define XC_num_glyphs 154 +#define XC_X_cursor 0 +#define XC_arrow 2 +#define XC_based_arrow_down 4 +#define XC_based_arrow_up 6 +#define XC_boat 8 +#define XC_bogosity 10 +#define XC_bottom_left_corner 12 +#define XC_bottom_right_corner 14 +#define XC_bottom_side 16 +#define XC_bottom_tee 18 +#define XC_box_spiral 20 +#define XC_center_ptr 22 +#define XC_circle 24 +#define XC_clock 26 +#define XC_coffee_mug 28 +#define XC_cross 30 +#define XC_cross_reverse 32 +#define XC_crosshair 34 +#define XC_diamond_cross 36 +#define XC_dot 38 +#define XC_dotbox 40 +#define XC_double_arrow 42 +#define XC_draft_large 44 +#define XC_draft_small 46 +#define XC_draped_box 48 +#define XC_exchange 50 +#define XC_fleur 52 +#define XC_gobbler 54 +#define XC_gumby 56 +#define XC_hand1 58 +#define XC_hand2 60 +#define XC_heart 62 +#define XC_icon 64 +#define XC_iron_cross 66 +#define XC_left_ptr 68 +#define XC_left_side 70 +#define XC_left_tee 72 +#define XC_leftbutton 74 +#define XC_ll_angle 76 +#define XC_lr_angle 78 +#define XC_man 80 +#define XC_middlebutton 82 +#define XC_mouse 84 +#define XC_pencil 86 +#define XC_pirate 88 +#define XC_plus 90 +#define XC_question_arrow 92 +#define XC_right_ptr 94 +#define XC_right_side 96 +#define XC_right_tee 98 +#define XC_rightbutton 100 +#define XC_rtl_logo 102 +#define XC_sailboat 104 +#define XC_sb_down_arrow 106 +#define XC_sb_h_double_arrow 108 +#define XC_sb_left_arrow 110 +#define XC_sb_right_arrow 112 +#define XC_sb_up_arrow 114 +#define XC_sb_v_double_arrow 116 +#define XC_shuttle 118 +#define XC_sizing 120 +#define XC_spider 122 +#define XC_spraycan 124 +#define XC_star 126 +#define XC_target 128 +#define XC_tcross 130 +#define XC_top_left_arrow 132 +#define XC_top_left_corner 134 +#define XC_top_right_corner 136 +#define XC_top_side 138 +#define XC_top_tee 140 +#define XC_trek 142 +#define XC_ul_angle 144 +#define XC_umbrella 146 +#define XC_ur_angle 148 +#define XC_watch 150 +#define XC_xterm 152 + +#endif /* !defined(_X11_CURSORFONT_H_) && !defined(_cursorfont_h_) */ diff --git a/nx-X11/lib/include/xtrans/Xtrans.c b/nx-X11/lib/include/xtrans/Xtrans.c new file mode 100644 index 000000000..328a970b1 --- /dev/null +++ b/nx-X11/lib/include/xtrans/Xtrans.c @@ -0,0 +1,1367 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +#include +#include +#include +#ifdef HAVE_SYSTEMD_DAEMON +#include +#endif + +/* + * The transport table contains a definition for every transport (protocol) + * family. All operations that can be made on the transport go through this + * table. + * + * Each transport is assigned a unique transport id. + * + * New transports can be added by adding an entry in this table. + * For compatiblity, the transport ids should never be renumbered. + * Always add to the end of the list. + */ + +#define TRANS_TLI_INET_INDEX 1 +#define TRANS_TLI_TCP_INDEX 2 +#define TRANS_TLI_TLI_INDEX 3 +#define TRANS_SOCKET_UNIX_INDEX 4 +#define TRANS_SOCKET_LOCAL_INDEX 5 +#define TRANS_SOCKET_INET_INDEX 6 +#define TRANS_SOCKET_TCP_INDEX 7 +#define TRANS_DNET_INDEX 8 +#define TRANS_LOCAL_LOCAL_INDEX 9 +#define TRANS_LOCAL_PTS_INDEX 10 +#define TRANS_LOCAL_NAMED_INDEX 11 +/* 12 used to be ISC, but that's gone. */ +#define TRANS_LOCAL_SCO_INDEX 13 +#define TRANS_SOCKET_INET6_INDEX 14 +#define TRANS_LOCAL_PIPE_INDEX 15 + + +static +Xtransport_table Xtransports[] = { +#if defined(TCPCONN) + { &TRANS(SocketTCPFuncs), TRANS_SOCKET_TCP_INDEX }, +#if defined(IPv6) && defined(AF_INET6) + { &TRANS(SocketINET6Funcs), TRANS_SOCKET_INET6_INDEX }, +#endif /* IPv6 */ + { &TRANS(SocketINETFuncs), TRANS_SOCKET_INET_INDEX }, +#endif /* TCPCONN */ +#if defined(UNIXCONN) +#if !defined(LOCALCONN) + { &TRANS(SocketLocalFuncs), TRANS_SOCKET_LOCAL_INDEX }, +#endif /* !LOCALCONN */ + { &TRANS(SocketUNIXFuncs), TRANS_SOCKET_UNIX_INDEX }, +#endif /* UNIXCONN */ +#if defined(LOCALCONN) + { &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX }, +#ifndef __sun + { &TRANS(PTSFuncs), TRANS_LOCAL_PTS_INDEX }, +#endif /* __sun */ +#if defined(SVR4) || defined(__SVR4) + { &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX }, +#endif +#ifdef __sun + { &TRANS(PIPEFuncs), TRANS_LOCAL_PIPE_INDEX }, +#endif /* __sun */ +#if defined(__SCO__) || defined(__UNIXWARE__) + { &TRANS(SCOFuncs), TRANS_LOCAL_SCO_INDEX }, +#endif /* __SCO__ || __UNIXWARE__ */ +#endif /* LOCALCONN */ +}; + +#define NUMTRANS (sizeof(Xtransports)/sizeof(Xtransport_table)) + + +#ifdef WIN32 +#define ioctl ioctlsocket +#endif + + + +/* + * These are a few utility function used by the public interface functions. + */ + +void +TRANS(FreeConnInfo) (XtransConnInfo ciptr) + +{ + prmsg (3,"FreeConnInfo(%p)\n", (void *) ciptr); + + if (ciptr->addr) + free (ciptr->addr); + + if (ciptr->peeraddr) + free (ciptr->peeraddr); + + if (ciptr->port) + free (ciptr->port); + + free (ciptr); +} + + +#define PROTOBUFSIZE 20 + +static Xtransport * +TRANS(SelectTransport) (const char *protocol) + +{ + char protobuf[PROTOBUFSIZE]; + int i; + + prmsg (3,"SelectTransport(%s)\n", protocol); + + /* + * Force Protocol to be lowercase as a way of doing + * a case insensitive match. + */ + + strncpy (protobuf, protocol, PROTOBUFSIZE - 1); + protobuf[PROTOBUFSIZE-1] = '\0'; + + for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++) + if (isupper ((unsigned char)protobuf[i])) + protobuf[i] = tolower ((unsigned char)protobuf[i]); + + /* Look at all of the configured protocols */ + + for (i = 0; i < NUMTRANS; i++) + { + if (!strcmp (protobuf, Xtransports[i].transport->TransName)) + return Xtransports[i].transport; + } + + return NULL; +} + +#ifndef TEST_t +static +#endif /* TEST_t */ +int +TRANS(ParseAddress) (const char *address, + char **protocol, char **host, char **port) + +{ + /* + * For the font library, the address is a string formatted + * as "protocol/host:port[/catalogue]". Note that the catologue + * is optional. At this time, the catologue info is ignored, but + * we have to parse it anyways. + * + * Other than fontlib, the address is a string formatted + * as "protocol/host:port". + * + * If the protocol part is missing, then assume TCP. + * If the protocol part and host part are missing, then assume local. + * If a "::" is found then assume DNET. + */ + + char *mybuf, *tmpptr; + const char *_protocol; + char *_host, *_port; + char hostnamebuf[256]; + int _host_len; + + prmsg (3,"ParseAddress(%s)\n", address); + + /* Copy the string so it can be changed */ + + tmpptr = mybuf = strdup (address); + + /* Parse the string to get each component */ + + /* Get the protocol part */ + + _protocol = mybuf; + + + if ( ((mybuf = strchr (mybuf,'/')) == NULL) && + ((mybuf = strrchr (tmpptr,':')) == NULL) ) + { + /* address is in a bad format */ + *protocol = NULL; + *host = NULL; + *port = NULL; + free (tmpptr); + return 0; + } + + if (*mybuf == ':') + { + /* + * If there is a hostname, then assume tcp, otherwise + * it must be local. + */ + if (mybuf == tmpptr) + { + /* There is neither a protocol or host specified */ + _protocol = "local"; + } + else + { + /* There is a hostname specified */ + _protocol = "tcp"; + mybuf = tmpptr; /* reset to the begining of the host ptr */ + } + } + else + { + /* *mybuf == '/' */ + + *mybuf ++= '\0'; /* put a null at the end of the protocol */ + + if (strlen(_protocol) == 0) + { + /* + * If there is a hostname, then assume tcp, otherwise + * it must be local. + */ + if (*mybuf != ':') + _protocol = "tcp"; + else + _protocol = "local"; + } + } + + /* Get the host part */ + + _host = mybuf; + + if ((mybuf = strrchr (mybuf,':')) == NULL) + { + *protocol = NULL; + *host = NULL; + *port = NULL; + free (tmpptr); + return 0; + } + + *mybuf ++= '\0'; + + _host_len = strlen(_host); + if (_host_len == 0) + { + TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); + _host = hostnamebuf; + } +#if defined(IPv6) && defined(AF_INET6) + /* hostname in IPv6 [numeric_addr]:0 form? */ + else if ( (_host_len > 3) && + ((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0)) + && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) { + struct sockaddr_in6 sin6; + + *(_host + _host_len - 1) = '\0'; + + /* Verify address is valid IPv6 numeric form */ + if (inet_pton(AF_INET6, _host + 1, &sin6) == 1) { + /* It is. Use it as such. */ + _host++; + _protocol = "inet6"; + } else { + /* It's not, restore it just in case some other code can use it. */ + *(_host + _host_len - 1) = ']'; + } + } +#endif + + + /* Get the port */ + + _port = mybuf; + +#if defined(FONT_t) || defined(FS_t) + /* + * Is there an optional catalogue list? + */ + + if ((mybuf = strchr (mybuf,'/')) != NULL) + *mybuf ++= '\0'; + + /* + * The rest, if any, is the (currently unused) catalogue list. + * + * _catalogue = mybuf; + */ +#endif + +#ifdef HAVE_LAUNCHD + /* launchd sockets will look like 'local//tmp/launch-XgkNns/:0' */ + if(address != NULL && strlen(address)>8 && (!strncmp(address,"local//",7))) { + _protocol="local"; + _host=""; + _port=address+6; + } +#endif + + /* + * Now that we have all of the components, allocate new + * string space for them. + */ + + if ((*protocol = strdup (_protocol)) == NULL) + { + /* Malloc failed */ + *port = NULL; + *host = NULL; + *protocol = NULL; + free (tmpptr); + return 0; + } + + if ((*host = strdup (_host)) == NULL) + { + /* Malloc failed */ + *port = NULL; + *host = NULL; + free (*protocol); + *protocol = NULL; + free (tmpptr); + return 0; + } + + if ((*port = strdup (_port)) == NULL) + { + /* Malloc failed */ + *port = NULL; + free (*host); + *host = NULL; + free (*protocol); + *protocol = NULL; + free (tmpptr); + return 0; + } + + free (tmpptr); + + return 1; +} + + +/* + * TRANS(Open) does all of the real work opening a connection. The only + * funny part about this is the type parameter which is used to decide which + * type of open to perform. + */ + +static XtransConnInfo +TRANS(Open) (int type, const char *address) + +{ + char *protocol = NULL, *host = NULL, *port = NULL; + XtransConnInfo ciptr = NULL; + Xtransport *thistrans; + + prmsg (2,"Open(%d,%s)\n", type, address); + +#if defined(WIN32) && defined(TCPCONN) + if (TRANS(WSAStartup)()) + { + prmsg (1,"Open: WSAStartup failed\n"); + return NULL; + } +#endif + + /* Parse the Address */ + + if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) + { + prmsg (1,"Open: Unable to Parse address %s\n", address); + return NULL; + } + + /* Determine the transport type */ + + if ((thistrans = TRANS(SelectTransport) (protocol)) == NULL) + { + prmsg (1,"Open: Unable to find transport for %s\n", + protocol); + + free (protocol); + free (host); + free (port); + return NULL; + } + + /* Open the transport */ + + switch (type) + { + case XTRANS_OPEN_COTS_CLIENT: +#ifdef TRANS_CLIENT + ciptr = thistrans->OpenCOTSClient(thistrans, protocol, host, port); +#endif /* TRANS_CLIENT */ + break; + case XTRANS_OPEN_COTS_SERVER: +#ifdef TRANS_SERVER + ciptr = thistrans->OpenCOTSServer(thistrans, protocol, host, port); +#endif /* TRANS_SERVER */ + break; + default: + prmsg (1,"Open: Unknown Open type %d\n", type); + } + + if (ciptr == NULL) + { + if (!(thistrans->flags & TRANS_DISABLED)) + { + prmsg (1,"Open: transport open failed for %s/%s:%s\n", + protocol, host, port); + } + free (protocol); + free (host); + free (port); + return NULL; + } + + ciptr->transptr = thistrans; + ciptr->port = port; /* We need this for TRANS(Reopen) */ + + free (protocol); + free (host); + + return ciptr; +} + + +#ifdef TRANS_REOPEN + +/* + * We might want to create an XtransConnInfo object based on a previously + * opened connection. For example, the font server may clone itself and + * pass file descriptors to the parent. + */ + +static XtransConnInfo +TRANS(Reopen) (int type, int trans_id, int fd, const char *port) + +{ + XtransConnInfo ciptr = NULL; + Xtransport *thistrans = NULL; + char *save_port; + int i; + + prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port); + + /* Determine the transport type */ + + for (i = 0; i < NUMTRANS; i++) + if (Xtransports[i].transport_id == trans_id) + { + thistrans = Xtransports[i].transport; + break; + } + + if (thistrans == NULL) + { + prmsg (1,"Reopen: Unable to find transport id %d\n", + trans_id); + + return NULL; + } + + if ((save_port = strdup (port)) == NULL) + { + prmsg (1,"Reopen: Unable to malloc port string\n"); + + return NULL; + } + + /* Get a new XtransConnInfo object */ + + switch (type) + { + case XTRANS_OPEN_COTS_SERVER: + ciptr = thistrans->ReopenCOTSServer(thistrans, fd, port); + break; + default: + prmsg (1,"Reopen: Bad Open type %d\n", type); + } + + if (ciptr == NULL) + { + prmsg (1,"Reopen: transport open failed\n"); + free (save_port); + return NULL; + } + + ciptr->transptr = thistrans; + ciptr->port = save_port; + + return ciptr; +} + +#endif /* TRANS_REOPEN */ + + + +/* + * These are the public interfaces to this Transport interface. + * These are the only functions that should have knowledge of the transport + * table. + */ + +#ifdef TRANS_CLIENT + +XtransConnInfo +TRANS(OpenCOTSClient) (const char *address) + +{ + prmsg (2,"OpenCOTSClient(%s)\n", address); + return TRANS(Open) (XTRANS_OPEN_COTS_CLIENT, address); +} + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + +XtransConnInfo +TRANS(OpenCOTSServer) (const char *address) + +{ + prmsg (2,"OpenCOTSServer(%s)\n", address); + return TRANS(Open) (XTRANS_OPEN_COTS_SERVER, address); +} + +#endif /* TRANS_SERVER */ + + +#ifdef TRANS_REOPEN + +XtransConnInfo +TRANS(ReopenCOTSServer) (int trans_id, int fd, const char *port) + +{ + prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port); + return TRANS(Reopen) (XTRANS_OPEN_COTS_SERVER, trans_id, fd, port); +} + +int +TRANS(GetReopenInfo) (XtransConnInfo ciptr, + int *trans_id, int *fd, char **port) + +{ + int i; + + for (i = 0; i < NUMTRANS; i++) + if (Xtransports[i].transport == ciptr->transptr) + { + *trans_id = Xtransports[i].transport_id; + *fd = ciptr->fd; + + if ((*port = strdup (ciptr->port)) == NULL) + return 0; + else + return 1; + } + + return 0; +} + +#endif /* TRANS_REOPEN */ + + +int +TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg) + +{ + int fd = ciptr->fd; + int ret = 0; + + prmsg (2,"SetOption(%d,%d,%d)\n", fd, option, arg); + + /* + * For now, all transport type use the same stuff for setting options. + * As long as this is true, we can put the common code here. Once a more + * complicated transport such as shared memory or an OSI implementation + * that uses the session and application libraries is implemented, this + * code may have to move to a transport dependent function. + * + * ret = ciptr->transptr->SetOption (ciptr, option, arg); + */ + + switch (option) + { + case TRANS_NONBLOCKING: + switch (arg) + { + case 0: + /* Set to blocking mode */ + break; + case 1: /* Set to non-blocking mode */ + +#if defined(O_NONBLOCK) && !defined(SCO325) + ret = fcntl (fd, F_GETFL, 0); + if (ret != -1) + ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK); +#else +#ifdef FIOSNBIO + { + int arg; + arg = 1; + ret = ioctl (fd, FIOSNBIO, &arg); + } +#else +#if defined(WIN32) + { +#ifdef WIN32 + u_long arg; +#else + int arg; +#endif + arg = 1; +/* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail + * eventually with EWOULDBLOCK */ + ret = ioctl (fd, FIONBIO, &arg); + } +#else + ret = fcntl (fd, F_GETFL, 0); +#ifdef FNDELAY + ret = fcntl (fd, F_SETFL, ret | FNDELAY); +#else + ret = fcntl (fd, F_SETFL, ret | O_NDELAY); +#endif +#endif /* WIN32 */ +#endif /* FIOSNBIO */ +#endif /* O_NONBLOCK */ + break; + default: + /* Unknown option */ + break; + } + break; + case TRANS_CLOSEONEXEC: +#ifdef F_SETFD +#ifdef FD_CLOEXEC + ret = fcntl (fd, F_SETFD, FD_CLOEXEC); +#else + ret = fcntl (fd, F_SETFD, 1); +#endif /* FD_CLOEXEC */ +#endif /* F_SETFD */ + break; + } + + return ret; +} + +#ifdef TRANS_SERVER + +int +TRANS(CreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags) + +{ + return ciptr->transptr->CreateListener (ciptr, port, flags); +} + +int +TRANS(Received) (const char * protocol) + +{ + Xtransport *trans; + int i = 0, ret = 0; + + prmsg (5, "Received(%s)\n", protocol); + + if ((trans = TRANS(SelectTransport)(protocol)) == NULL) + { + prmsg (1,"Received: unable to find transport: %s\n", + protocol); + + return -1; + } + if (trans->flags & TRANS_ALIAS) { + if (trans->nolisten) + while (trans->nolisten[i]) { + ret |= TRANS(Received)(trans->nolisten[i]); + i++; + } + } + + trans->flags |= TRANS_RECEIVED; + return ret; +} + +int +TRANS(NoListen) (const char * protocol) + +{ + Xtransport *trans; + int i = 0, ret = 0; + + if ((trans = TRANS(SelectTransport)(protocol)) == NULL) + { + prmsg (1,"TransNoListen: unable to find transport: %s\n", + protocol); + + return -1; + } + if (trans->flags & TRANS_ALIAS) { + if (trans->nolisten) + while (trans->nolisten[i]) { + ret |= TRANS(NoListen)(trans->nolisten[i]); + i++; + } + } + + trans->flags |= TRANS_NOLISTEN; + return ret; +} + +int +TRANS(Listen) (const char * protocol) +{ + Xtransport *trans; + int i = 0, ret = 0; + + if ((trans = TRANS(SelectTransport)(protocol)) == NULL) + { + prmsg (1,"TransListen: unable to find transport: %s\n", + protocol); + + return -1; + } + if (trans->flags & TRANS_ALIAS) { + if (trans->nolisten) + while (trans->nolisten[i]) { + ret |= TRANS(Listen)(trans->nolisten[i]); + i++; + } + } + + trans->flags &= ~TRANS_NOLISTEN; + return ret; +} + +int +TRANS(IsListening) (const char * protocol) +{ + Xtransport *trans; + + if ((trans = TRANS(SelectTransport)(protocol)) == NULL) + { + prmsg (1,"TransIsListening: unable to find transport: %s\n", + protocol); + + return 0; + } + + return !(trans->flags & TRANS_NOLISTEN); +} + +int +TRANS(ResetListener) (XtransConnInfo ciptr) + +{ + if (ciptr->transptr->ResetListener) + return ciptr->transptr->ResetListener (ciptr); + else + return TRANS_RESET_NOOP; +} + + +XtransConnInfo +TRANS(Accept) (XtransConnInfo ciptr, int *status) + +{ + XtransConnInfo newciptr; + + prmsg (2,"Accept(%d)\n", ciptr->fd); + + newciptr = ciptr->transptr->Accept (ciptr, status); + + if (newciptr) + newciptr->transptr = ciptr->transptr; + + return newciptr; +} + +#endif /* TRANS_SERVER */ + + +#ifdef TRANS_CLIENT + +int +TRANS(Connect) (XtransConnInfo ciptr, const char *address) + +{ + char *protocol; + char *host; + char *port; + int ret; + + prmsg (2,"Connect(%d,%s)\n", ciptr->fd, address); + + if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) + { + prmsg (1,"Connect: Unable to Parse address %s\n", + address); + return -1; + } + +#ifdef HAVE_LAUNCHD + if (!host) host=strdup(""); +#endif + + if (!port || !*port) + { + prmsg (1,"Connect: Missing port specification in %s\n", + address); + if (protocol) free (protocol); + if (host) free (host); + return -1; + } + + ret = ciptr->transptr->Connect (ciptr, host, port); + + if (protocol) free (protocol); + if (host) free (host); + if (port) free (port); + + return ret; +} + +#endif /* TRANS_CLIENT */ + + +int +TRANS(BytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) + +{ + return ciptr->transptr->BytesReadable (ciptr, pend); +} + +int +TRANS(Read) (XtransConnInfo ciptr, char *buf, int size) + +{ + return ciptr->transptr->Read (ciptr, buf, size); +} + +int +TRANS(Write) (XtransConnInfo ciptr, char *buf, int size) + +{ + return ciptr->transptr->Write (ciptr, buf, size); +} + +int +TRANS(Readv) (XtransConnInfo ciptr, struct iovec *buf, int size) + +{ + return ciptr->transptr->Readv (ciptr, buf, size); +} + +int +TRANS(Writev) (XtransConnInfo ciptr, struct iovec *buf, int size) + +{ + return ciptr->transptr->Writev (ciptr, buf, size); +} + +#if XTRANS_SEND_FDS +int +TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close) +{ + return ciptr->transptr->SendFd(ciptr, fd, do_close); +} + +int +TRANS(RecvFd) (XtransConnInfo ciptr) +{ + return ciptr->transptr->RecvFd(ciptr); +} +#endif + +int +TRANS(Disconnect) (XtransConnInfo ciptr) + +{ + return ciptr->transptr->Disconnect (ciptr); +} + +int +TRANS(Close) (XtransConnInfo ciptr) + +{ + int ret; + + prmsg (2,"Close(%d)\n", ciptr->fd); + + ret = ciptr->transptr->Close (ciptr); + + TRANS(FreeConnInfo) (ciptr); + + return ret; +} + +int +TRANS(CloseForCloning) (XtransConnInfo ciptr) + +{ + int ret; + + prmsg (2,"CloseForCloning(%d)\n", ciptr->fd); + + ret = ciptr->transptr->CloseForCloning (ciptr); + + TRANS(FreeConnInfo) (ciptr); + + return ret; +} + +int +TRANS(IsLocal) (XtransConnInfo ciptr) + +{ + return (ciptr->family == AF_UNIX); +} + +#ifdef NX_TRANS_SOCKET +/* this is needed for pre-xcb X11 as we have in NX */ +int +TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, + Xtransaddr **addrp) + +{ + prmsg (2,"GetMyAddr(%d)\n", ciptr->fd); + + *familyp = ciptr->family; + *addrlenp = ciptr->addrlen; + + if ((*addrp = (Xtransaddr *) malloc (ciptr->addrlen)) == NULL) + { + prmsg (1,"GetMyAddr: malloc failed\n"); + return -1; + } + memcpy(*addrp, ciptr->addr, ciptr->addrlen); + + return 0; +} +#endif + +int +TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, + Xtransaddr **addrp) + +{ + prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd); + + *familyp = ciptr->family; + *addrlenp = ciptr->peeraddrlen; + + if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL) + { + prmsg (1,"GetPeerAddr: malloc failed\n"); + return -1; + } + memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen); + + return 0; +} + + +int +TRANS(GetConnectionNumber) (XtransConnInfo ciptr) + +{ + return ciptr->fd; +} + + +/* + * These functions are really utility functions, but they require knowledge + * of the internal data structures, so they have to be part of the Transport + * Independant API. + */ + +#ifdef TRANS_SERVER + +static int +complete_network_count (void) + +{ + int count = 0; + int found_local = 0; + int i; + + /* + * For a complete network, we only need one LOCALCONN transport to work + */ + + for (i = 0; i < NUMTRANS; i++) + { + if (Xtransports[i].transport->flags & TRANS_ALIAS + || Xtransports[i].transport->flags & TRANS_NOLISTEN) + continue; + + if (Xtransports[i].transport->flags & TRANS_LOCAL) + found_local = 1; + else + count++; + } + + return (count + found_local); +} + + +static int +receive_listening_fds(const char* port, XtransConnInfo* temp_ciptrs, + int* count_ret) + +{ +#ifdef HAVE_SYSTEMD_DAEMON + XtransConnInfo ciptr; + int i, systemd_listen_fds; + + systemd_listen_fds = sd_listen_fds(1); + if (systemd_listen_fds < 0) + { + prmsg (1, "receive_listening_fds: sd_listen_fds error: %s\n", + strerror(-systemd_listen_fds)); + return -1; + } + + for (i = 0; i < systemd_listen_fds && *count_ret < NUMTRANS; i++) + { + struct sockaddr_storage a; + int ti; + const char* tn; + socklen_t al; + + al = sizeof(a); + if (getsockname(i + SD_LISTEN_FDS_START, (struct sockaddr*)&a, &al) < 0) { + prmsg (1, "receive_listening_fds: getsockname error: %s\n", + strerror(errno)); + return -1; + } + + switch (a.ss_family) + { + case AF_UNIX: + ti = TRANS_SOCKET_UNIX_INDEX; + if (*((struct sockaddr_un*)&a)->sun_path == '\0' && + al > sizeof(sa_family_t)) + tn = "local"; + else + tn = "unix"; + break; + case AF_INET: + ti = TRANS_SOCKET_INET_INDEX; + tn = "inet"; + break; +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + ti = TRANS_SOCKET_INET6_INDEX; + tn = "inet6"; + break; +#endif /* IPv6 */ + default: + prmsg (1, "receive_listening_fds:" + "Got unknown socket address family\n"); + return -1; + } + + ciptr = TRANS(ReopenCOTSServer)(ti, i + SD_LISTEN_FDS_START, port); + if (!ciptr) + { + prmsg (1, "receive_listening_fds:" + "Got NULL while trying to reopen socket received from systemd.\n"); + return -1; + } + + prmsg (5, "receive_listening_fds: received listener for %s, %d\n", + tn, ciptr->fd); + temp_ciptrs[(*count_ret)++] = ciptr; + TRANS(Received)(tn); + } +#endif /* HAVE_SYSTEMD_DAEMON */ + return 0; +} + +#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD +extern int xquartz_launchd_fd; +#endif + +int +TRANS(MakeAllCOTSServerListeners) (const char *port, int *partial, + int *count_ret, XtransConnInfo **ciptrs_ret) + +{ + char buffer[256]; /* ??? What size ?? */ + XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; + int status, i, j; + +#if defined(IPv6) && defined(AF_INET6) + int ipv6_succ = 0; +#endif + prmsg (2,"MakeAllCOTSServerListeners(%s,%p)\n", + port ? port : "NULL", (void *) ciptrs_ret); + + *count_ret = 0; + +#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD + fprintf(stderr, "Launchd socket fd: %d\n", xquartz_launchd_fd); + if(xquartz_launchd_fd != -1) { + if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX, + xquartz_launchd_fd, getenv("DISPLAY"))))==NULL) + fprintf(stderr,"Got NULL while trying to Reopen launchd port\n"); + else + temp_ciptrs[(*count_ret)++] = ciptr; + } +#endif + + if (receive_listening_fds(port, temp_ciptrs, count_ret) < 0) + return -1; + + for (i = 0; i < NUMTRANS; i++) + { + Xtransport *trans = Xtransports[i].transport; + unsigned int flags = 0; + + if (trans->flags&TRANS_ALIAS || trans->flags&TRANS_NOLISTEN || + trans->flags&TRANS_RECEIVED) + continue; + + snprintf(buffer, sizeof(buffer), "%s/:%s", + trans->TransName, port ? port : ""); + + prmsg (5,"MakeAllCOTSServerListeners: opening %s\n", + buffer); + + if ((ciptr = TRANS(OpenCOTSServer(buffer))) == NULL) + { + if (trans->flags & TRANS_DISABLED) + continue; + + prmsg (1, + "MakeAllCOTSServerListeners: failed to open listener for %s\n", + trans->TransName); + continue; + } +#if defined(IPv6) && defined(AF_INET6) + if ((Xtransports[i].transport_id == TRANS_SOCKET_INET_INDEX + && ipv6_succ)) + flags |= ADDR_IN_USE_ALLOWED; +#endif + + if ((status = TRANS(CreateListener (ciptr, port, flags))) < 0) + { + if (status == TRANS_ADDR_IN_USE) + { + /* + * We failed to bind to the specified address because the + * address is in use. It must be that a server is already + * running at this address, and this function should fail. + */ + + prmsg (1, + "MakeAllCOTSServerListeners: server already running\n"); + + for (j = 0; j < *count_ret; j++) + TRANS(Close) (temp_ciptrs[j]); + + *count_ret = 0; + *ciptrs_ret = NULL; + *partial = 0; + return -1; + } + else + { + prmsg (1, + "MakeAllCOTSServerListeners: failed to create listener for %s\n", + trans->TransName); + + continue; + } + } + +#if defined(IPv6) && defined(AF_INET6) + if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX) + ipv6_succ = 1; +#endif + + prmsg (5, + "MakeAllCOTSServerListeners: opened listener for %s, %d\n", + trans->TransName, ciptr->fd); + + temp_ciptrs[*count_ret] = ciptr; + (*count_ret)++; + } + + *partial = (*count_ret < complete_network_count()); + + prmsg (5, + "MakeAllCOTSServerListeners: partial=%d, actual=%d, complete=%d \n", + *partial, *count_ret, complete_network_count()); + + if (*count_ret > 0) + { + if ((*ciptrs_ret = malloc ( + *count_ret * sizeof (XtransConnInfo))) == NULL) + { + return -1; + } + + for (i = 0; i < *count_ret; i++) + { + (*ciptrs_ret)[i] = temp_ciptrs[i]; + } + } + else + *ciptrs_ret = NULL; + + return 0; +} + +#endif /* TRANS_SERVER */ + + + +/* + * These routines are not part of the X Transport Interface, but they + * may be used by it. + */ + + +#ifdef WIN32 + +/* + * emulate readv + */ + +static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) + +{ + int i, len, total; + char *base; + + ESET(0); + for (i = 0, total = 0; i < iovcnt; i++, iov++) { + len = iov->iov_len; + base = iov->iov_base; + while (len > 0) { + register int nbytes; + nbytes = TRANS(Read) (ciptr, base, len); + if (nbytes < 0 && total == 0) return -1; + if (nbytes <= 0) return total; + ESET(0); + len -= nbytes; + total += nbytes; + base += nbytes; + } + } + return total; +} + + +/* + * emulate writev + */ + +static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) + +{ + int i, len, total; + char *base; + + ESET(0); + for (i = 0, total = 0; i < iovcnt; i++, iov++) { + len = iov->iov_len; + base = iov->iov_base; + while (len > 0) { + register int nbytes; + nbytes = TRANS(Write) (ciptr, base, len); + if (nbytes < 0 && total == 0) return -1; + if (nbytes <= 0) return total; + ESET(0); + len -= nbytes; + total += nbytes; + base += nbytes; + } + } + return total; +} + +#endif /* WIN32 */ + + +#if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) +#ifndef NEED_UTSNAME +#define NEED_UTSNAME +#endif +#include +#endif + +/* + * TRANS(GetHostname) - similar to gethostname but allows special processing. + */ + +int TRANS(GetHostname) (char *buf, int maxlen) + +{ + int len; + +#ifdef NEED_UTSNAME + struct utsname name; + + uname (&name); + len = strlen (name.nodename); + if (len >= maxlen) len = maxlen - 1; + strncpy (buf, name.nodename, len); + buf[len] = '\0'; +#else + buf[0] = '\0'; + (void) gethostname (buf, maxlen); + buf [maxlen - 1] = '\0'; + len = strlen(buf); +#endif /* NEED_UTSNAME */ + return len; +} diff --git a/nx-X11/lib/include/xtrans/Xtrans.h b/nx-X11/lib/include/xtrans/Xtrans.h new file mode 100644 index 000000000..54b2a1425 --- /dev/null +++ b/nx-X11/lib/include/xtrans/Xtrans.h @@ -0,0 +1,426 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +#ifndef _XTRANS_H_ +#define _XTRANS_H_ + +#include +#include +#include + +#ifndef WIN32 +#include +#endif + +#ifdef __clang__ +/* Not all clients make use of all provided statics */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +#endif + +/* + * Set the functions names according to where this code is being compiled. + */ + +#ifdef X11_t +#define TRANS(func) _X11Trans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_X11Trans"; +#endif +#endif /* X11_t */ + +#ifdef XSERV_t +#define TRANS(func) _XSERVTrans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_XSERVTrans"; +#endif +#define X11_t +#endif /* XSERV_t */ + +#ifdef XIM_t +#define TRANS(func) _XimXTrans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_XimTrans"; +#endif +#endif /* XIM_t */ + +#ifdef FS_t +#define TRANS(func) _FSTrans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_FSTrans"; +#endif +#endif /* FS_t */ + +#ifdef FONT_t +#define TRANS(func) _FontTrans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_FontTrans"; +#endif +#endif /* FONT_t */ + +#ifdef ICE_t +#define TRANS(func) _IceTrans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_IceTrans"; +#endif +#endif /* ICE_t */ + +#if !defined(TRANS) +#define TRANS(func) _XTrans##func +#ifdef XTRANSDEBUG +static const char *__xtransname = "_XTrans"; +#endif +#endif /* !TRANS */ + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +/* + * Create a single address structure that can be used wherever + * an address structure is needed. struct sockaddr is not big enough + * to hold a sockadd_un, so we create this definition to have a single + * structure that is big enough for all the structures we might need. + * + * This structure needs to be independent of the socket/TLI interface used. + */ + +#if defined(IPv6) && defined(AF_INET6) +typedef struct sockaddr_storage Xtransaddr; +#else +#define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */ + +typedef struct { + unsigned char addr[XTRANS_MAX_ADDR_LEN]; +} Xtransaddr; +#endif + +#ifdef LONG64 +typedef int BytesReadable_t; +#else +typedef long BytesReadable_t; +#endif + + +#if defined(WIN32) || defined(USG) + +/* + * TRANS(Readv) and TRANS(Writev) use struct iovec, normally found + * in Berkeley systems in . See the readv(2) and writev(2) + * manual pages for details. + */ + +struct iovec { + caddr_t iov_base; + int iov_len; +}; + +#else +#include +#endif + +typedef struct _XtransConnInfo *XtransConnInfo; + + +/* + * Transport Option definitions + */ + +#define TRANS_NONBLOCKING 1 +#define TRANS_CLOSEONEXEC 2 + + +/* + * Return values of Connect (0 is success) + */ + +#define TRANS_CONNECT_FAILED -1 +#define TRANS_TRY_CONNECT_AGAIN -2 +#define TRANS_IN_PROGRESS -3 + + +/* + * Return values of CreateListener (0 is success) + */ + +#define TRANS_CREATE_LISTENER_FAILED -1 +#define TRANS_ADDR_IN_USE -2 + + +/* + * Return values of Accept (0 is success) + */ + +#define TRANS_ACCEPT_BAD_MALLOC -1 +#define TRANS_ACCEPT_FAILED -2 +#define TRANS_ACCEPT_MISC_ERROR -3 + + +/* + * ResetListener return values + */ + +#define TRANS_RESET_NOOP 1 +#define TRANS_RESET_NEW_FD 2 +#define TRANS_RESET_FAILURE 3 + + +/* + * Function prototypes for the exposed interface + */ + +void TRANS(FreeConnInfo) ( + XtransConnInfo /* ciptr */ +); + +#ifdef TRANS_CLIENT + +XtransConnInfo TRANS(OpenCOTSClient)( + const char * /* address */ +); + +#endif /* TRANS_CLIENT */ + +#ifdef TRANS_SERVER + +XtransConnInfo TRANS(OpenCOTSServer)( + const char * /* address */ +); + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_REOPEN + +XtransConnInfo TRANS(ReopenCOTSServer)( + int, /* trans_id */ + int, /* fd */ + const char * /* port */ +); + +int TRANS(GetReopenInfo)( + XtransConnInfo, /* ciptr */ + int *, /* trans_id */ + int *, /* fd */ + char ** /* port */ +); + +#endif /* TRANS_REOPEN */ + + +int TRANS(SetOption)( + XtransConnInfo, /* ciptr */ + int, /* option */ + int /* arg */ +); + +#ifdef TRANS_SERVER + +int TRANS(CreateListener)( + XtransConnInfo, /* ciptr */ + const char *, /* port */ + unsigned int /* flags */ +); + +int TRANS(Received) ( + const char* /* protocol*/ +); + +int TRANS(NoListen) ( + const char* /* protocol*/ +); + +int TRANS(Listen) ( + const char* /* protocol*/ +); + +int TRANS(IsListening) ( + const char* /* protocol*/ +); + +int TRANS(ResetListener)( + XtransConnInfo /* ciptr */ +); + +XtransConnInfo TRANS(Accept)( + XtransConnInfo, /* ciptr */ + int * /* status */ +); + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_CLIENT + +int TRANS(Connect)( + XtransConnInfo, /* ciptr */ + const char * /* address */ +); + +#endif /* TRANS_CLIENT */ + +int TRANS(BytesReadable)( + XtransConnInfo, /* ciptr */ + BytesReadable_t * /* pend */ +); + +int TRANS(Read)( + XtransConnInfo, /* ciptr */ + char *, /* buf */ + int /* size */ +); + +int TRANS(Write)( + XtransConnInfo, /* ciptr */ + char *, /* buf */ + int /* size */ +); + +int TRANS(Readv)( + XtransConnInfo, /* ciptr */ + struct iovec *, /* buf */ + int /* size */ +); + +int TRANS(Writev)( + XtransConnInfo, /* ciptr */ + struct iovec *, /* buf */ + int /* size */ +); + +int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close); + +int TRANS(RecvFd) (XtransConnInfo ciptr); + +int TRANS(Disconnect)( + XtransConnInfo /* ciptr */ +); + +int TRANS(Close)( + XtransConnInfo /* ciptr */ +); + +int TRANS(CloseForCloning)( + XtransConnInfo /* ciptr */ +); + +int TRANS(IsLocal)( + XtransConnInfo /* ciptr */ +); + +#ifdef NX_TRANS_SOCKET +/* needed for pre-xcb libX11 as we have in NX */ +int TRANS(GetMyAddr)( + XtransConnInfo, /* ciptr */ + int *, /* familyp */ + int *, /* addrlenp */ + Xtransaddr ** /* addrp */ +); +#endif + +int TRANS(GetPeerAddr)( + XtransConnInfo, /* ciptr */ + int *, /* familyp */ + int *, /* addrlenp */ + Xtransaddr ** /* addrp */ +); + +int TRANS(GetConnectionNumber)( + XtransConnInfo /* ciptr */ +); + +#ifdef TRANS_SERVER + +int TRANS(MakeAllCOTSServerListeners)( + const char *, /* port */ + int *, /* partial */ + int *, /* count_ret */ + XtransConnInfo ** /* ciptrs_ret */ +); + +#endif /* TRANS_SERVER */ + + +/* + * Function Prototypes for Utility Functions. + */ + +#ifdef X11_t + +int TRANS(ConvertAddress)( + int *, /* familyp */ + int *, /* addrlenp */ + Xtransaddr ** /* addrp */ +); + +#endif /* X11_t */ + +#ifdef ICE_t + +char * +TRANS(GetMyNetworkId)( + XtransConnInfo /* ciptr */ +); + +char * +TRANS(GetPeerNetworkId)( + XtransConnInfo /* ciptr */ +); + +#endif /* ICE_t */ + +int +TRANS(GetHostname) ( + char * /* buf */, + int /* maxlen */ +); + +#if defined(WIN32) && defined(TCPCONN) +int TRANS(WSAStartup)(); +#endif + +#endif /* _XTRANS_H_ */ diff --git a/nx-X11/lib/include/xtrans/Xtransint.h b/nx-X11/lib/include/xtrans/Xtransint.h new file mode 100644 index 000000000..f7e07687b --- /dev/null +++ b/nx-X11/lib/include/xtrans/Xtransint.h @@ -0,0 +1,433 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +#ifndef _XTRANSINT_H_ +#define _XTRANSINT_H_ + +/* + * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport + * Interface code. Each use of the PRMSG macro has a level associated with + * it. XTRANSDEBUG is defined to be a level. If the invocation level is =< + * the value of XTRANSDEBUG, then the message will be printed out to stderr. + * Recommended levels are: + * + * XTRANSDEBUG=1 Error messages + * XTRANSDEBUG=2 API Function Tracing + * XTRANSDEBUG=3 All Function Tracing + * XTRANSDEBUG=4 printing of intermediate values + * XTRANSDEBUG=5 really detailed stuff +#define XTRANSDEBUG 2 + * + * Defining XTRANSDEBUGTIMESTAMP will cause printing timestamps with each + * message. + */ + +#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C) +# define XTRANSDEBUG 1 +#endif + +#ifdef WIN32 +# define _WILLWINSOCK_ +#endif + +#include "Xtrans.h" + +#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */ +# define _X_UNUSED /* */ +#endif + +#ifdef XTRANSDEBUG +# include +#endif /* XTRANSDEBUG */ + +#include + +#ifndef WIN32 +# include +# include +# include + +/* + * Moved the setting of NEED_UTSNAME to this header file from Xtrans.c, + * to avoid a race condition. JKJ (6/5/97) + */ + +# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) +# ifndef NEED_UTSNAME +# define NEED_UTSNAME +# endif +# include +# endif + +# define ESET(val) errno = val +# define EGET() errno + +#else /* WIN32 */ + +# include /* for USHRT_MAX */ + +# define ESET(val) WSASetLastError(val) +# define EGET() WSAGetLastError() + +#endif /* WIN32 */ + +#include + +#ifdef X11_t +#define X_TCP_PORT 6000 +#endif + +#if XTRANS_SEND_FDS + +struct _XtransConnFd { + struct _XtransConnFd *next; + int fd; + int do_close; +}; + +#endif + +struct _XtransConnInfo { + struct _Xtransport *transptr; + int index; + char *priv; + int flags; + int fd; + char *port; + int family; + char *addr; + int addrlen; + char *peeraddr; + int peeraddrlen; + struct _XtransConnFd *recv_fds; + struct _XtransConnFd *send_fds; +}; + +#define XTRANS_OPEN_COTS_CLIENT 1 +#define XTRANS_OPEN_COTS_SERVER 2 + +typedef struct _Xtransport { + const char *TransName; + int flags; + +#ifdef TRANS_CLIENT + + XtransConnInfo (*OpenCOTSClient)( + struct _Xtransport *, /* transport */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ + ); + +#endif /* TRANS_CLIENT */ + +#ifdef TRANS_SERVER + const char ** nolisten; + XtransConnInfo (*OpenCOTSServer)( + struct _Xtransport *, /* transport */ + const char *, /* protocol */ + const char *, /* host */ + const char * /* port */ + ); + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_REOPEN + + XtransConnInfo (*ReopenCOTSServer)( + struct _Xtransport *, /* transport */ + int, /* fd */ + const char * /* port */ + ); + +#endif /* TRANS_REOPEN */ + + + int (*SetOption)( + XtransConnInfo, /* connection */ + int, /* option */ + int /* arg */ + ); + +#ifdef TRANS_SERVER +/* Flags */ +# define ADDR_IN_USE_ALLOWED 1 + + int (*CreateListener)( + XtransConnInfo, /* connection */ + const char *, /* port */ + unsigned int /* flags */ + ); + + int (*ResetListener)( + XtransConnInfo /* connection */ + ); + + XtransConnInfo (*Accept)( + XtransConnInfo, /* connection */ + int * /* status */ + ); + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_CLIENT + + int (*Connect)( + XtransConnInfo, /* connection */ + const char *, /* host */ + const char * /* port */ + ); + +#endif /* TRANS_CLIENT */ + + int (*BytesReadable)( + XtransConnInfo, /* connection */ + BytesReadable_t * /* pend */ + ); + + int (*Read)( + XtransConnInfo, /* connection */ + char *, /* buf */ + int /* size */ + ); + + int (*Write)( + XtransConnInfo, /* connection */ + char *, /* buf */ + int /* size */ + ); + + int (*Readv)( + XtransConnInfo, /* connection */ + struct iovec *, /* buf */ + int /* size */ + ); + + int (*Writev)( + XtransConnInfo, /* connection */ + struct iovec *, /* buf */ + int /* size */ + ); + +#if XTRANS_SEND_FDS + int (*SendFd)( + XtransConnInfo, /* connection */ + int, /* fd */ + int /* do_close */ + ); + + int (*RecvFd)( + XtransConnInfo /* connection */ + ); +#endif + + int (*Disconnect)( + XtransConnInfo /* connection */ + ); + + int (*Close)( + XtransConnInfo /* connection */ + ); + + int (*CloseForCloning)( + XtransConnInfo /* connection */ + ); + +} Xtransport; + + +typedef struct _Xtransport_table { + Xtransport *transport; + int transport_id; +} Xtransport_table; + + +/* + * Flags for the flags member of Xtransport. + */ + +#define TRANS_ALIAS (1<<0) /* record is an alias, don't create server */ +#define TRANS_LOCAL (1<<1) /* local transport */ +#define TRANS_DISABLED (1<<2) /* Don't open this one */ +#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */ +#define TRANS_NOUNLINK (1<<4) /* Don't unlink transport endpoints */ +#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */ +#define TRANS_NOXAUTH (1<<6) /* Don't verify authentication (because it's secure some other way at the OS layer) */ +#define TRANS_RECEIVED (1<<7) /* The fd for this has already been opened by someone else. */ + +/* Flags to preserve when setting others */ +#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) + +#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when + building the transport.c file that has them in */ + +#ifdef __clang__ +/* Not all clients make use of all provided statics */ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wunused-function" +#endif + +/* + * readv() and writev() don't exist or don't work correctly on some + * systems, so they may be emulated. + */ + +#ifdef WIN32 + +#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) + +static int TRANS(ReadV)( + XtransConnInfo, /* ciptr */ + struct iovec *, /* iov */ + int /* iovcnt */ +); + +#else + +#define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) + +#endif /* WIN32 */ + + +#ifdef WIN32 + +#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) + +static int TRANS(WriteV)( + XtransConnInfo, /* ciptr */ + struct iovec *, /* iov */ + int /* iovcnt */ +); + +#else + +#define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt) + +#endif /* WIN32 */ + +#if defined(X11_t) +static int is_numeric ( + const char * /* str */ +); +#endif + +#ifdef TRANS_SERVER +static int trans_mkdir ( + const char *, /* path */ + int /* mode */ +); +#endif + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +/* + * Some XTRANSDEBUG stuff + */ + +#ifdef XTRANSDEBUG +#include + +/* + * The X server provides ErrorF() & VErrorF(), for other software that uses + * xtrans, we provide our own simple versions. + */ +# if defined(XSERV_t) && defined(TRANS_SERVER) +# include "os.h" +# else +static inline void _X_ATTRIBUTE_PRINTF(1, 0) +VErrorF(const char *f, va_list args) +{ + vfprintf(stderr, f, args); + fflush(stderr); +} + +static inline void _X_ATTRIBUTE_PRINTF(1, 2) +ErrorF(const char *f, ...) +{ + va_list args; + + va_start(args, f); + VErrorF(f, args); + va_end(args); +} +# endif /* xserver */ +#endif /* XTRANSDEBUG */ + +static inline void _X_ATTRIBUTE_PRINTF(2, 3) +prmsg(int lvl, const char *f, ...) +{ +#ifdef XTRANSDEBUG + va_list args; + + va_start(args, f); + if (lvl <= XTRANSDEBUG) { + int saveerrno = errno; + + ErrorF("%s", __xtransname); + VErrorF(f, args); + +# ifdef XTRANSDEBUGTIMESTAMP + { + struct timeval tp; + gettimeofday(&tp, 0); + ErrorF("timestamp (ms): %d\n", + tp.tv_sec * 1000 + tp.tv_usec / 1000); + } +# endif + errno = saveerrno; + } + va_end(args); +#endif /* XTRANSDEBUG */ +} + +#endif /* XTRANS_TRANSPORT_C */ + +#endif /* _XTRANSINT_H_ */ diff --git a/nx-X11/lib/include/xtrans/Xtranslcl.c b/nx-X11/lib/include/xtrans/Xtranslcl.c new file mode 100644 index 000000000..7231d2a83 --- /dev/null +++ b/nx-X11/lib/include/xtrans/Xtranslcl.c @@ -0,0 +1,2486 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +/* + * + * The connection code/ideas in lib/X and server/os for SVR4/Intel + * environments was contributed by the following companies/groups: + * + * MetroLink Inc + * NCR + * Pittsburgh Powercomputing Corporation (PPc)/Quarterdeck Office Systems + * SGCS + * Unix System Laboratories (USL) / Novell + * XFree86 + * + * The goal is to have common connection code among all SVR4/Intel vendors. + * + * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS + * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, + * IN NO EVENT SHALL THESE COMPANIES * 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. + */ + +#include +#include +#include +#include +#include +#if defined(SVR4) || defined(__SVR4) +#include +#endif +#ifdef __sun +# include +#else +#include +#endif +#include +#include + +/* + * The local transports should be treated the same as a UNIX domain socket + * wrt authentication, etc. Because of this, we will use struct sockaddr_un + * for the address format. This will simplify the code in other places like + * The X Server. + */ + +#include +#ifndef X_NO_SYS_UN +#include +#endif + + +/* Types of local connections supported: + * - PTS + * - named pipes + * - SCO + */ +#if !defined(__sun) +# define LOCAL_TRANS_PTS +#endif +#if defined(SVR4) || defined(__SVR4) +# define LOCAL_TRANS_NAMED +#endif +#if defined(__SCO__) || defined(__UNIXWARE__) +# define LOCAL_TRANS_SCO +#endif + +static int TRANS(LocalClose)(XtransConnInfo ciptr); + +/* + * These functions actually implement the local connection mechanisms. + */ + +/* Type Not Supported */ + +static int +TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, const char *port _X_UNUSED) + +{ + return -1; +} + +#ifdef TRANS_REOPEN + +static int +TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, + const char *port _X_UNUSED) + +{ + return 0; +} + +#endif /* TRANS_REOPEN */ + +#if XTRANS_SEND_FDS +static int +TRANS(LocalRecvFdInvalid)(XtransConnInfo ciptr) +{ + errno = EINVAL; + return -1; +} + +static int +TRANS(LocalSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) +{ + errno = EINVAL; + return -1; +} +#endif + + +static int +TRANS(FillAddrInfo)(XtransConnInfo ciptr, + const char *sun_path, const char *peer_sun_path) + +{ + struct sockaddr_un *sunaddr; + struct sockaddr_un *p_sunaddr; + + ciptr->family = AF_UNIX; + ciptr->addrlen = sizeof (struct sockaddr_un); + + if ((sunaddr = malloc (ciptr->addrlen)) == NULL) + { + prmsg(1,"FillAddrInfo: failed to allocate memory for addr\n"); + return 0; + } + + sunaddr->sun_family = AF_UNIX; + + if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) { + prmsg(1, "FillAddrInfo: path too long\n"); + free((char *) sunaddr); + return 0; + } + strcpy (sunaddr->sun_path, sun_path); +#if defined(BSD44SOCKETS) + sunaddr->sun_len = strlen (sunaddr->sun_path); +#endif + + ciptr->addr = (char *) sunaddr; + + ciptr->peeraddrlen = sizeof (struct sockaddr_un); + + if ((p_sunaddr = malloc (ciptr->peeraddrlen)) == NULL) + { + prmsg(1, + "FillAddrInfo: failed to allocate memory for peer addr\n"); + free (sunaddr); + ciptr->addr = NULL; + + return 0; + } + + p_sunaddr->sun_family = AF_UNIX; + + if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) { + prmsg(1, "FillAddrInfo: peer path too long\n"); + free((char *) p_sunaddr); + return 0; + } + strcpy (p_sunaddr->sun_path, peer_sun_path); +#if defined(BSD44SOCKETS) + p_sunaddr->sun_len = strlen (p_sunaddr->sun_path); +#endif + + ciptr->peeraddr = (char *) p_sunaddr; + + return 1; +} + + + +#ifdef LOCAL_TRANS_PTS +/* PTS */ + +#if defined(SYSV) && !defined(__SCO__) +#define SIGNAL_T int +#else +#define SIGNAL_T void +#endif /* SYSV */ + +typedef SIGNAL_T (*PFV)(); + +extern PFV signal(); + +extern char *ptsname( + int +); + +static void _dummy(int sig _X_UNUSED) + +{ +} +#endif /* LOCAL_TRANS_PTS */ + +#ifndef __sun +#define X_STREAMS_DIR "/dev/X" +#define DEV_SPX "/dev/spx" +#else +#ifndef X11_t +#define X_STREAMS_DIR "/dev/X" +#else +#define X_STREAMS_DIR "/tmp/.X11-pipe" +#endif +#endif + +#define DEV_PTMX "/dev/ptmx" + +#if defined(X11_t) + +#define PTSNODENAME "/dev/X/server." +#ifdef __sun +#define NAMEDNODENAME "/tmp/.X11-pipe/X" +#else +#define NAMEDNODENAME "/dev/X/Nserver." + +#define SCORNODENAME "/dev/X%1sR" +#define SCOSNODENAME "/dev/X%1sS" +#endif /* !__sun */ +#endif +#if defined(XIM_t) +#ifdef __sun +#define NAMEDNODENAME "/tmp/.XIM-pipe/XIM" +#else +#define PTSNODENAME "/dev/X/XIM." +#define NAMEDNODENAME "/dev/X/NXIM." +#define SCORNODENAME "/dev/XIM.%sR" +#define SCOSNODENAME "/dev/XIM.%sS" +#endif +#endif +#if defined(FS_t) || defined (FONT_t) +#ifdef __sun +#define NAMEDNODENAME "/tmp/.font-pipe/fs" +#else +/* + * USL has already defined something here. We need to check with them + * and see if their choice is usable here. + */ +#define PTSNODENAME "/dev/X/fontserver." +#define NAMEDNODENAME "/dev/X/Nfontserver." +#define SCORNODENAME "/dev/fontserver.%sR" +#define SCOSNODENAME "/dev/fontserver.%sS" +#endif +#endif +#if defined(ICE_t) +#ifdef __sun +#define NAMEDNODENAME "/tmp/.ICE-pipe/" +#else +#define PTSNODENAME "/dev/X/ICE." +#define NAMEDNODENAME "/dev/X/NICE." +#define SCORNODENAME "/dev/ICE.%sR" +#define SCOSNODENAME "/dev/ICE.%sS" +#endif +#endif +#if defined(TEST_t) +#ifdef __sun +#define NAMEDNODENAME "/tmp/.Test-unix/test" +#endif +#define PTSNODENAME "/dev/X/transtest." +#define NAMEDNODENAME "/dev/X/Ntranstest." +#define SCORNODENAME "/dev/transtest.%sR" +#define SCOSNODENAME "/dev/transtest.%sS" +#endif + + + +#ifdef LOCAL_TRANS_PTS +#ifdef TRANS_CLIENT + +static int +TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port) + +{ +#ifdef PTSNODENAME + int fd,server,exitval,alarm_time,ret; + char server_path[64]; + char *slave, namelen; + char buf[20]; /* MAX_PATH_LEN?? */ + PFV savef; + pid_t saved_pid; +#endif + + prmsg(2,"PTSOpenClient(%s)\n", port); + +#if !defined(PTSNODENAME) + prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n"); + return -1; +#else + if (port && *port ) { + if( *port == '/' ) { /* A full pathname */ + snprintf(server_path, sizeof(server_path), "%s", port); + } else { + snprintf(server_path, sizeof(server_path), "%s%s", + PTSNODENAME, port); + } + } else { + snprintf(server_path, sizeof(server_path), "%s%d", + PTSNODENAME, getpid()); + } + + + /* + * Open the node the on which the server is listening. + */ + + if ((server = open (server_path, O_RDWR)) < 0) { + prmsg(1,"PTSOpenClient: failed to open %s\n", server_path); + return -1; + } + + + /* + * Open the streams based pipe that will be this connection. + */ + + if ((fd = open(DEV_PTMX, O_RDWR)) < 0) { + prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX); + close(server); + return(-1); + } + + (void) grantpt(fd); + (void) unlockpt(fd); + + slave = ptsname(fd); /* get name */ + + if( slave == NULL ) { + prmsg(1,"PTSOpenClient: failed to get ptsname()\n"); + close(fd); + close(server); + return -1; + } + + /* + * This is neccesary for the case where a program is setuid to non-root. + * grantpt() calls /usr/lib/pt_chmod which is set-uid root. This program will + * set the owner of the pt device incorrectly if the uid is not restored + * before it is called. The problem is that once it gets restored, it + * cannot be changed back to its original condition, hence the fork(). + */ + + if(!(saved_pid=fork())) { + uid_t saved_euid; + + saved_euid = geteuid(); + /** sets the euid to the actual/real uid **/ + if (setuid( getuid() ) == -1) { + exit(1); + } + if( chown( slave, saved_euid, -1 ) < 0 ) { + exit( 1 ); + } + + exit( 0 ); + } + + waitpid(saved_pid, &exitval, 0); + if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) { + close(fd); + close(server); + prmsg(1, "PTSOpenClient: cannot set the owner of %s\n", + slave); + return(-1); + } + if (chmod(slave, 0666) < 0) { + close(fd); + close(server); + prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave); + return(-1); + } + + /* + * write slave name to server + */ + + namelen = strlen(slave); + buf[0] = namelen; + (void) sprintf(&buf[1], slave); + (void) write(server, buf, namelen+1); + (void) close(server); + + /* + * wait for server to respond + */ + + savef = signal(SIGALRM, _dummy); + alarm_time = alarm (30); /* CONNECT_TIMEOUT */ + + ret = read(fd, buf, 1); + + (void) alarm(alarm_time); + (void) signal(SIGALRM, savef); + + if (ret != 1) { + prmsg(1, + "PTSOpenClient: failed to get acknoledgement from server\n"); + (void) close(fd); + fd = -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0) + { + prmsg(1,"PTSOpenClient: failed to fill in addr info\n"); + close(fd); + return -1; + } + + return(fd); + +#endif /* !PTSNODENAME */ +} + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + +static int +TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port) + +{ +#ifdef PTSNODENAME + int fd, server; + char server_path[64], *slave; + int mode; +#endif + + prmsg(2,"PTSOpenServer(%s)\n", port); + +#if !defined(PTSNODENAME) + prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n"); + return -1; +#else + if (port && *port ) { + if( *port == '/' ) { /* A full pathname */ + (void) sprintf(server_path, "%s", port); + } else { + (void) sprintf(server_path, "%s%s", PTSNODENAME, port); + } + } else { + (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid()); + } + +#ifdef HAS_STICKY_DIR_BIT + mode = 01777; +#else + mode = 0777; +#endif + if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { + prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n", + X_STREAMS_DIR, errno); + return(-1); + } + +#if 0 + if( (fd=open(server_path, O_RDWR)) >= 0 ) { + /* + * This doesn't prevent the server from starting up, and doesn't + * prevent clients from trying to connect to the in-use PTS (which + * is often in use by something other than another server). + */ + prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port); + prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path); + close(fd); + return(-1); + } +#else + /* Just remove the old path (which is what happens with UNIXCONN) */ +#endif + + unlink(server_path); + + if( (fd=open(DEV_PTMX, O_RDWR)) < 0) { + prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX); + return(-1); + } + + grantpt(fd); + unlockpt(fd); + + if( (slave=ptsname(fd)) == NULL) { + prmsg(1, "PTSOpenServer: Unable to get slave device name\n"); + close(fd); + return(-1); + } + + if( link(slave,server_path) < 0 ) { + prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path); + close(fd); + return(-1); + } + + if( chmod(server_path, 0666) < 0 ) { + prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path); + close(fd); + return(-1); + } + + if( (server=open(server_path, O_RDWR)) < 0 ) { + prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path); + close(fd); + return(-1); + } + + close(server); + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) + { + prmsg(1,"PTSOpenServer: failed to fill in addr info\n"); + close(fd); + return -1; + } + + return fd; + +#endif /* !PTSNODENAME */ +} + +static int +TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) + +{ + int newfd; + int in; + unsigned char length; + char buf[256]; + struct sockaddr_un *sunaddr; + + prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd); + + if( (in=read(ciptr->fd,&length,1)) <= 0 ){ + if( !in ) { + prmsg(2, + "PTSAccept: Incoming connection closed\n"); + } + else { + prmsg(1, + "PTSAccept: Error reading incoming connection. errno=%d \n", + errno); + } + *status = TRANS_ACCEPT_MISC_ERROR; + return -1; + } + + if( (in=read(ciptr->fd,buf,length)) <= 0 ){ + if( !in ) { + prmsg(2, + "PTSAccept: Incoming connection closed\n"); + } + else { + prmsg(1, +"PTSAccept: Error reading device name for new connection. errno=%d \n", + errno); + } + *status = TRANS_ACCEPT_MISC_ERROR; + return -1; + } + + buf[length] = '\0'; + + if( (newfd=open(buf,O_RDWR)) < 0 ) { + prmsg(1, "PTSAccept: Failed to open %s\n",buf); + *status = TRANS_ACCEPT_MISC_ERROR; + return -1; + } + + write(newfd,"1",1); + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + newciptr->addrlen=ciptr->addrlen; + if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { + prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); + close(newfd); + *status = TRANS_ACCEPT_BAD_MALLOC; + return -1; + } + + memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); + + newciptr->peeraddrlen=sizeof(struct sockaddr_un); + if( (sunaddr = malloc(newciptr->peeraddrlen)) == NULL ) { + prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); + free(newciptr->addr); + close(newfd); + *status = TRANS_ACCEPT_BAD_MALLOC; + return -1; + } + + sunaddr->sun_family=AF_UNIX; + strcpy(sunaddr->sun_path,buf); +#if defined(BSD44SOCKETS) + sunaddr->sun_len=strlen(sunaddr->sun_path); +#endif + + newciptr->peeraddr=(char *)sunaddr; + + *status = 0; + + return newfd; +} + +#endif /* TRANS_SERVER */ +#endif /* LOCAL_TRANS_PTS */ + + +#ifdef LOCAL_TRANS_NAMED + +/* NAMED */ + +#ifdef TRANS_CLIENT + +static int +TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port) + +{ +#ifdef NAMEDNODENAME + int fd; + char server_path[64]; + struct stat filestat; +# ifndef __sun + extern int isastream(int); +# endif +#endif + + prmsg(2,"NAMEDOpenClient(%s)\n", port); + +#if !defined(NAMEDNODENAME) + prmsg(1,"NAMEDOpenClient: Protocol is not supported by a NAMED connection\n"); + return -1; +#else + if ( port && *port ) { + if( *port == '/' ) { /* A full pathname */ + (void) snprintf(server_path, sizeof(server_path), "%s", port); + } else { + (void) snprintf(server_path, sizeof(server_path), "%s%s", NAMEDNODENAME, port); + } + } else { + (void) snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); + } + + if ((fd = open(server_path, O_RDWR)) < 0) { + prmsg(1,"NAMEDOpenClient: Cannot open %s for NAMED connection\n", server_path); + return -1; + } + + if (fstat(fd, &filestat) < 0 ) { + prmsg(1,"NAMEDOpenClient: Cannot stat %s for NAMED connection\n", server_path); + (void) close(fd); + return -1; + } + + if ((filestat.st_mode & S_IFMT) != S_IFIFO) { + prmsg(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path); + /* Is this really a failure? */ + (void) close(fd); + return -1; + } + + + if (isastream(fd) <= 0) { + prmsg(1,"NAMEDOpenClient: %s is not a streams device\n", server_path); + (void) close(fd); + return -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) + { + prmsg(1,"NAMEDOpenClient: failed to fill in addr info\n"); + close(fd); + return -1; + } + + return(fd); + +#endif /* !NAMEDNODENAME */ +} + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + + +#ifdef NAMEDNODENAME +static int +TRANS(NAMEDOpenPipe)(const char *server_path) +{ + int fd, pipefd[2]; + struct stat sbuf; + int mode; + + prmsg(2,"NAMEDOpenPipe(%s)\n", server_path); + +#ifdef HAS_STICKY_DIR_BIT + mode = 01777; +#else + mode = 0777; +#endif + if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { + prmsg (1, "NAMEDOpenPipe: mkdir(%s) failed, errno = %d\n", + X_STREAMS_DIR, errno); + return(-1); + } + + if(stat(server_path, &sbuf) != 0) { + if (errno == ENOENT) { + if ((fd = creat(server_path, (mode_t)0666)) == -1) { + prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); + return(-1); + } + close(fd); + if (chmod(server_path, (mode_t)0666) < 0) { + prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); + return(-1); + } + } else { + prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path); + return(-1); + } + } + + if( pipe(pipefd) != 0) { + prmsg(1, "NAMEDOpenPipe: pipe() failed, errno=%d\n",errno); + return(-1); + } + + if( ioctl(pipefd[0], I_PUSH, "connld") != 0) { + prmsg(1, "NAMEDOpenPipe: ioctl(I_PUSH,\"connld\") failed, errno=%d\n",errno); + close(pipefd[0]); + close(pipefd[1]); + return(-1); + } + + if( fattach(pipefd[0], server_path) != 0) { + prmsg(1, "NAMEDOpenPipe: fattach(%s) failed, errno=%d\n", server_path,errno); + close(pipefd[0]); + close(pipefd[1]); + return(-1); + } + + return(pipefd[1]); +} +#endif + +static int +TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, const char *port) +{ +#ifdef NAMEDNODENAME + int fd; + char server_path[64]; +#endif + + prmsg(2,"NAMEDOpenServer(%s)\n", port); + +#if !defined(NAMEDNODENAME) + prmsg(1,"NAMEDOpenServer: Protocol is not supported by a NAMED connection\n"); + return -1; +#else + if ( port && *port ) { + if( *port == '/' ) { /* A full pathname */ + (void) snprintf(server_path, sizeof(server_path), "%s", port); + } else { + (void) snprintf(server_path, sizeof(server_path), "%s%s", + NAMEDNODENAME, port); + } + } else { + (void) snprintf(server_path, sizeof(server_path), "%s%ld", + NAMEDNODENAME, (long)getpid()); + } + + fd = TRANS(NAMEDOpenPipe)(server_path); + if (fd < 0) { + return -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) + { + prmsg(1,"NAMEDOpenServer: failed to fill in addr info\n"); + TRANS(LocalClose)(ciptr); + return -1; + } + + return fd; + +#endif /* !NAMEDNODENAME */ +} + +static int +TRANS(NAMEDResetListener) (XtransConnInfo ciptr) + +{ + struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; + struct stat statb; + + prmsg(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd); + + if (ciptr->fd != -1) { + /* + * see if the pipe has disappeared + */ + + if (stat (sockname->sun_path, &statb) == -1 || + (statb.st_mode & S_IFMT) != S_IFIFO) { + prmsg(3, "Pipe %s trashed, recreating\n", sockname->sun_path); + TRANS(LocalClose)(ciptr); + ciptr->fd = TRANS(NAMEDOpenPipe)(sockname->sun_path); + if (ciptr->fd >= 0) + return TRANS_RESET_NEW_FD; + else + return TRANS_CREATE_LISTENER_FAILED; + } + } + return TRANS_RESET_NOOP; +} + +static int +TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) + +{ + struct strrecvfd str; + + prmsg(2,"NAMEDAccept(%p->%d)\n", ciptr, ciptr->fd); + + if( ioctl(ciptr->fd, I_RECVFD, &str ) < 0 ) { + prmsg(1, "NAMEDAccept: ioctl(I_RECVFD) failed, errno=%d\n", errno); + *status = TRANS_ACCEPT_MISC_ERROR; + return(-1); + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + newciptr->family=ciptr->family; + newciptr->addrlen=ciptr->addrlen; + if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { + prmsg(1, + "NAMEDAccept: failed to allocate memory for pipe addr\n"); + close(str.fd); + *status = TRANS_ACCEPT_BAD_MALLOC; + return -1; + } + + memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); + + newciptr->peeraddrlen=newciptr->addrlen; + if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { + prmsg(1, + "NAMEDAccept: failed to allocate memory for peer addr\n"); + free(newciptr->addr); + close(str.fd); + *status = TRANS_ACCEPT_BAD_MALLOC; + return -1; + } + + memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); + + *status = 0; + + return str.fd; +} + +#endif /* TRANS_SERVER */ + +#endif /* LOCAL_TRANS_NAMED */ + + + +#if defined(LOCAL_TRANS_SCO) + +/* + * connect_spipe is used by the SCO connection type. + */ +static int +connect_spipe(int fd1, int fd2) +{ + long temp; + struct strfdinsert sbuf; + + sbuf.databuf.maxlen = -1; + sbuf.databuf.len = -1; + sbuf.databuf.buf = NULL; + sbuf.ctlbuf.maxlen = sizeof(long); + sbuf.ctlbuf.len = sizeof(long); + sbuf.ctlbuf.buf = (caddr_t)&temp; + sbuf.offset = 0; + sbuf.fildes = fd2; + sbuf.flags = 0; + + if( ioctl(fd1, I_FDINSERT, &sbuf) < 0 ) + return(-1); + + return(0); +} + +/* + * named_spipe is used by the SCO connection type. + */ + +static int +named_spipe(int fd, char *path) + +{ + int oldUmask, ret; + struct stat sbuf; + + oldUmask = umask(0); + + (void) fstat(fd, &sbuf); + ret = mknod(path, 0020666, sbuf.st_rdev); + + umask(oldUmask); + + if (ret < 0) { + ret = -1; + } else { + ret = fd; + } + + return(ret); +} + +#endif /* defined(LOCAL_TRANS_SCO) */ + + + + +#ifdef LOCAL_TRANS_SCO +/* SCO */ + +/* + * 2002-11-09 (jkj@sco.com) + * + * This code has been modified to match what is in the actual SCO X server. + * This greatly helps inter-operability between X11R6 and X11R5 (the native + * SCO server). Mainly, it relies on streams nodes existing in /dev, not + * creating them or unlinking them, which breaks the native X server. + * + * However, this is only for the X protocol. For all other protocols, we + * do in fact create the nodes, as only X11R6 will use them, and this makes + * it possible to have both types of clients running, otherwise we get all + * kinds of nasty errors on startup for anything that doesnt use the X + * protocol (like SM, when KDE starts up). + */ + +#ifdef TRANS_CLIENT + +static int +TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port) +{ +#ifdef SCORNODENAME + int fd, server, fl, ret; + char server_path[64]; + struct strbuf ctlbuf; + unsigned long alarm_time; + void (*savef)(); + long temp; + extern int getmsg(), putmsg(); +#endif + + prmsg(2,"SCOOpenClient(%s)\n", port); + if (!port || !port[0]) + port = "0"; + +#if !defined(SCORNODENAME) + prmsg(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n"); + return -1; +#else + (void) sprintf(server_path, SCORNODENAME, port); + + if ((server = open(server_path, O_RDWR)) < 0) { + prmsg(1,"SCOOpenClient: failed to open %s\n", server_path); + return -1; + } + + if ((fd = open(DEV_SPX, O_RDWR)) < 0) { + prmsg(1,"SCOOpenClient: failed to open %s\n", DEV_SPX); + close(server); + return -1; + } + + (void) write(server, &server, 1); + ctlbuf.len = 0; + ctlbuf.maxlen = sizeof(long); + ctlbuf.buf = (caddr_t)&temp; + fl = 0; + + savef = signal(SIGALRM, _dummy); + alarm_time = alarm(10); + + ret = getmsg(server, &ctlbuf, 0, &fl); + + (void) alarm(alarm_time); + (void) signal(SIGALRM, savef); + + if (ret < 0) { + prmsg(1,"SCOOpenClient: error from getmsg\n"); + close(fd); + close(server); + return -1; + } + + /* The msg we got via getmsg is the result of an + * I_FDINSERT, so if we do a putmsg with whatever + * we recieved, we're doing another I_FDINSERT ... + */ + (void) putmsg(fd, &ctlbuf, 0, 0); + (void) fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0)|O_NDELAY); + + (void) close(server); + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + +#if defined(X11_t) && defined(__SCO__) + ciptr->flags |= TRANS_NOUNLINK; +#endif + if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) + { + prmsg(1,"SCOOpenClient: failed to fill addr info\n"); + close(fd); + return -1; + } + + return(fd); + +#endif /* !SCORNODENAME */ +} + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + +static int +TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port) +{ +#ifdef SCORNODENAME + char serverR_path[64]; + char serverS_path[64]; + struct flock mylock; + int fdr = -1; + int fds = -1; +#endif + + prmsg(2,"SCOOpenServer(%s)\n", port); + if (!port || !port[0]) + port = "0"; + +#if !defined(SCORNODENAME) + prmsg(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n"); + return -1; +#else + (void) sprintf(serverR_path, SCORNODENAME, port); + (void) sprintf(serverS_path, SCOSNODENAME, port); + +#if !defined(X11_t) || !defined(__SCO__) + unlink(serverR_path); + unlink(serverS_path); + + if ((fds = open(DEV_SPX, O_RDWR)) < 0 || + (fdr = open(DEV_SPX, O_RDWR)) < 0 ) { + prmsg(1,"SCOOpenServer: failed to open %s\n", DEV_SPX); + if (fds >= 0) + close(fds); + if (fdr >= 0) + close(fdr); + return -1; + } + + if (named_spipe (fds, serverS_path) == -1) { + prmsg(1,"SCOOpenServer: failed to create %s\n", serverS_path); + close (fdr); + close (fds); + return -1; + } + + if (named_spipe (fdr, serverR_path) == -1) { + prmsg(1,"SCOOpenServer: failed to create %s\n", serverR_path); + close (fdr); + close (fds); + return -1; + } +#else /* X11_t */ + + fds = open (serverS_path, O_RDWR | O_NDELAY); + if (fds < 0) { + prmsg(1,"SCOOpenServer: failed to open %s\n", serverS_path); + return -1; + } + + /* + * Lock the connection device for the duration of the server. + * This resolves multiple server starts especially on SMP machines. + */ + mylock.l_type = F_WRLCK; + mylock.l_whence = 0; + mylock.l_start = 0; + mylock.l_len = 0; + if (fcntl (fds, F_SETLK, &mylock) < 0) { + prmsg(1,"SCOOpenServer: failed to lock %s\n", serverS_path); + close (fds); + return -1; + } + + fdr = open (serverR_path, O_RDWR | O_NDELAY); + if (fdr < 0) { + prmsg(1,"SCOOpenServer: failed to open %s\n", serverR_path); + close (fds); + return -1; + } +#endif /* X11_t */ + + if (connect_spipe(fds, fdr)) { + prmsg(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n", + serverS_path); + close (fdr); + close (fds); + return -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + +#if defined(X11_t) && defined(__SCO__) + ciptr->flags |= TRANS_NOUNLINK; +#endif + if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) { + prmsg(1,"SCOOpenServer: failed to fill in addr info\n"); + close(fds); + close(fdr); + return -1; + } + + return(fds); + +#endif /* !SCORNODENAME */ +} + +static int +TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) +{ + char c; + int fd; + + prmsg(2,"SCOAccept(%d)\n", ciptr->fd); + + if (read(ciptr->fd, &c, 1) < 0) { + prmsg(1,"SCOAccept: can't read from client\n"); + *status = TRANS_ACCEPT_MISC_ERROR; + return(-1); + } + + if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) { + prmsg(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX); + *status = TRANS_ACCEPT_MISC_ERROR; + return(-1); + } + + if (connect_spipe (ciptr->fd, fd) < 0) { + prmsg(1,"SCOAccept: ioctl(I_FDINSERT) failed\n"); + close (fd); + *status = TRANS_ACCEPT_MISC_ERROR; + return -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + newciptr->addrlen=ciptr->addrlen; + if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { + prmsg(1, + "SCOAccept: failed to allocate memory for peer addr\n"); + close(fd); + *status = TRANS_ACCEPT_BAD_MALLOC; + return -1; + } + + memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); +#if defined(__SCO__) + newciptr->flags |= TRANS_NOUNLINK; +#endif + + newciptr->peeraddrlen=newciptr->addrlen; + if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { + prmsg(1, + "SCOAccept: failed to allocate memory for peer addr\n"); + free(newciptr->addr); + close(fd); + *status = TRANS_ACCEPT_BAD_MALLOC; + return -1; + } + + memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); + + *status = 0; + + return(fd); +} + +#endif /* TRANS_SERVER */ +#endif /* LOCAL_TRANS_SCO */ + + + +#ifdef TRANS_REOPEN +#ifdef LOCAL_TRANS_PTS + +static int +TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port) + +{ +#ifdef PTSNODENAME + char server_path[64]; +#endif + + prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port); + +#if !defined(PTSNODENAME) + prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n"); + return 0; +#else + if (port && *port ) { + if( *port == '/' ) { /* A full pathname */ + snprintf(server_path, sizeof(server_path), "%s", port); + } else { + snprintf(server_path, sizeof(server_path), "%s%s", + PTSNODENAME, port); + } + } else { + snprintf(server_path, sizeof(server_path), "%s%ld", + PTSNODENAME, (long)getpid()); + } + + if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) + { + prmsg(1,"PTSReopenServer: failed to fill in addr info\n"); + return 0; + } + + return 1; + +#endif /* !PTSNODENAME */ +} + +#endif /* LOCAL_TRANS_PTS */ + +#ifdef LOCAL_TRANS_NAMED + +static int +TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *port) + +{ +#ifdef NAMEDNODENAME + char server_path[64]; +#endif + + prmsg(2,"NAMEDReopenServer(%s)\n", port); + +#if !defined(NAMEDNODENAME) + prmsg(1,"NAMEDReopenServer: Protocol is not supported by a NAMED connection\n"); + return 0; +#else + if ( port && *port ) { + if( *port == '/' ) { /* A full pathname */ + snprintf(server_path, sizeof(server_path),"%s", port); + } else { + snprintf(server_path, sizeof(server_path), "%s%s", + NAMEDNODENAME, port); + } + } else { + snprintf(server_path, sizeof(server_path), "%s%ld", + NAMEDNODENAME, (long)getpid()); + } + + if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) + { + prmsg(1,"NAMEDReopenServer: failed to fill in addr info\n"); + return 0; + } + + return 1; + +#endif /* !NAMEDNODENAME */ +} + +#endif /* LOCAL_TRANS_NAMED */ + + +#ifdef LOCAL_TRANS_SCO +static int +TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port) + +{ +#ifdef SCORNODENAME + char serverR_path[64], serverS_path[64]; +#endif + + prmsg(2,"SCOReopenServer(%s)\n", port); + if (!port || !port[0]) + port = "0"; + +#if !defined(SCORNODENAME) + prmsg(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n"); + return 0; +#else + (void) sprintf(serverR_path, SCORNODENAME, port); + (void) sprintf(serverS_path, SCOSNODENAME, port); + +#if defined(X11_t) && defined(__SCO__) + ciptr->flags |= TRANS_NOUNLINK; +#endif + if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) + { + prmsg(1, "SCOReopenServer: failed to fill in addr info\n"); + return 0; + } + + return 1; + +#endif /* SCORNODENAME */ +} + +#endif /* LOCAL_TRANS_SCO */ + +#endif /* TRANS_REOPEN */ + + + +/* + * This table contains all of the entry points for the different local + * connection mechanisms. + */ + +typedef struct _LOCALtrans2dev { + const char *transname; + +#ifdef TRANS_CLIENT + + int (*devcotsopenclient)( + XtransConnInfo, const char * /*port*/ +); + +#endif /* TRANS_CLIENT */ + +#ifdef TRANS_SERVER + + int (*devcotsopenserver)( + XtransConnInfo, const char * /*port*/ +); + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_CLIENT + + int (*devcltsopenclient)( + XtransConnInfo, const char * /*port*/ +); + +#endif /* TRANS_CLIENT */ + +#ifdef TRANS_SERVER + + int (*devcltsopenserver)( + XtransConnInfo, const char * /*port*/ +); + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_REOPEN + + int (*devcotsreopenserver)( + XtransConnInfo, + int, /* fd */ + const char * /* port */ +); + + int (*devcltsreopenserver)( + XtransConnInfo, + int, /* fd */ + const char * /* port */ +); + +#endif /* TRANS_REOPEN */ + +#ifdef TRANS_SERVER + + int (*devreset)( + XtransConnInfo /* ciptr */ +); + + int (*devaccept)( + XtransConnInfo, XtransConnInfo, int * +); + +#endif /* TRANS_SERVER */ + +} LOCALtrans2dev; + +static LOCALtrans2dev LOCALtrans2devtab[] = { +#ifdef LOCAL_TRANS_PTS +{"", +#ifdef TRANS_CLIENT + TRANS(PTSOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(PTSOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(PTSReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + NULL, /* ResetListener */ + TRANS(PTSAccept) +#endif /* TRANS_SERVER */ +}, + +{"local", +#ifdef TRANS_CLIENT + TRANS(PTSOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(PTSOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(PTSReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + NULL, /* ResetListener */ + TRANS(PTSAccept) +#endif /* TRANS_SERVER */ +}, + +{"pts", +#ifdef TRANS_CLIENT + TRANS(PTSOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(PTSOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(PTSReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + NULL, /* ResetListener */ + TRANS(PTSAccept) +#endif /* TRANS_SERVER */ +}, +#else /* !LOCAL_TRANS_PTS */ +{"", +#ifdef TRANS_CLIENT + TRANS(NAMEDOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(NAMEDOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(NAMEDReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + TRANS(NAMEDResetListener), + TRANS(NAMEDAccept) +#endif /* TRANS_SERVER */ +}, + +{"local", +#ifdef TRANS_CLIENT + TRANS(NAMEDOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(NAMEDOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(NAMEDReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + TRANS(NAMEDResetListener), + TRANS(NAMEDAccept) +#endif /* TRANS_SERVER */ +}, +#endif /* !LOCAL_TRANS_PTS */ + +#ifdef LOCAL_TRANS_NAMED +{"named", +#ifdef TRANS_CLIENT + TRANS(NAMEDOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(NAMEDOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(NAMEDReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + TRANS(NAMEDResetListener), + TRANS(NAMEDAccept) +#endif /* TRANS_SERVER */ +}, + +#ifdef __sun /* Alias "pipe" to named, since that's what Solaris called it */ +{"pipe", +#ifdef TRANS_CLIENT + TRANS(NAMEDOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(NAMEDOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(NAMEDReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + TRANS(NAMEDResetListener), + TRANS(NAMEDAccept) +#endif /* TRANS_SERVER */ +}, +#endif /* __sun */ +#endif /* LOCAL_TRANS_NAMED */ + + +#ifdef LOCAL_TRANS_SCO +{"sco", +#ifdef TRANS_CLIENT + TRANS(SCOOpenClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(SCOOpenServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(OpenFail), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + TRANS(OpenFail), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(SCOReopenServer), + TRANS(ReopenFail), +#endif +#ifdef TRANS_SERVER + NULL, /* ResetListener */ + TRANS(SCOAccept) +#endif /* TRANS_SERVER */ +}, +#endif /* LOCAL_TRANS_SCO */ +}; + +#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev)) + +static const char *XLOCAL=NULL; +static char *workingXLOCAL=NULL; +static char *freeXLOCAL=NULL; + +#if defined(__SCO__) +#define DEF_XLOCAL "SCO:UNIX:PTS" +#elif defined(__UNIXWARE__) +#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" +#elif defined(__sun) +#define DEF_XLOCAL "UNIX:NAMED" +#else +#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" +#endif + +static void +TRANS(LocalInitTransports)(const char *protocol) + +{ + prmsg(3,"LocalInitTransports(%s)\n", protocol); + + if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") ) + { + workingXLOCAL = freeXLOCAL = strdup (protocol); + } + else { + XLOCAL=(char *)getenv("XLOCAL"); + if(XLOCAL==NULL) + XLOCAL=DEF_XLOCAL; + workingXLOCAL = freeXLOCAL = strdup (XLOCAL); + } +} + +static void +TRANS(LocalEndTransports)(void) + +{ + prmsg(3,"LocalEndTransports()\n"); + free(freeXLOCAL); +} + +#define TYPEBUFSIZE 32 + +#ifdef TRANS_CLIENT + +static LOCALtrans2dev * +TRANS(LocalGetNextTransport)(void) + +{ + int i,j; + char *typetocheck; + char typebuf[TYPEBUFSIZE]; + prmsg(3,"LocalGetNextTransport()\n"); + + while(1) + { + if( workingXLOCAL == NULL || *workingXLOCAL == '\0' ) + return NULL; + + typetocheck=workingXLOCAL; + workingXLOCAL=strchr(workingXLOCAL,':'); + if(workingXLOCAL && *workingXLOCAL) + *workingXLOCAL++='\0'; + + for(i=0;i +#endif + +/* + * Make sure 'host' is really local. + */ + +static int +HostReallyLocal (const char *host) + +{ + /* + * The 'host' passed to this function may have been generated + * by either uname() or gethostname(). We try both if possible. + */ + +#ifdef NEED_UTSNAME + struct utsname name; +#endif + char buf[256]; + +#ifdef NEED_UTSNAME + if (uname (&name) >= 0 && strcmp (host, name.nodename) == 0) + return (1); +#endif + + buf[0] = '\0'; + (void) gethostname (buf, 256); + buf[255] = '\0'; + + if (strcmp (host, buf) == 0) + return (1); + + return (0); +} + + +static XtransConnInfo +TRANS(LocalOpenClient)(int type, const char *protocol, + const char *host, const char *port) + +{ + LOCALtrans2dev *transptr; + XtransConnInfo ciptr; + int index; + + prmsg(3,"LocalOpenClient()\n"); + + /* + * Make sure 'host' is really local. If not, we return failure. + * The reason we make this check is because a process may advertise + * a "local" address for which it can accept connections, but if a + * process on a remote machine tries to connect to this address, + * we know for sure it will fail. + */ + + if (strcmp (host, "unix") != 0 && !HostReallyLocal (host)) + { + prmsg (1, + "LocalOpenClient: Cannot connect to non-local host %s\n", + host); + return NULL; + } + + +#if defined(X11_t) + /* + * X has a well known port, that is transport dependant. It is easier + * to handle it here, than try and come up with a transport independent + * representation that can be passed in and resolved the usual way. + * + * The port that is passed here is really a string containing the idisplay + * from ConnectDisplay(). Since that is what we want for the local transports, + * we don't have to do anything special. + */ +#endif /* X11_t */ + + if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + { + prmsg(1,"LocalOpenClient: calloc(1,%lu) failed\n", + sizeof(struct _XtransConnInfo)); + return NULL; + } + + ciptr->fd = -1; + + TRANS(LocalInitTransports)(protocol); + + index = 0; + for(transptr=TRANS(LocalGetNextTransport)(); + transptr!=NULL;transptr=TRANS(LocalGetNextTransport)(), index++) + { + switch( type ) + { + case XTRANS_OPEN_COTS_CLIENT: + ciptr->fd=transptr->devcotsopenclient(ciptr,port); + break; + case XTRANS_OPEN_COTS_SERVER: + prmsg(1, + "LocalOpenClient: Should not be opening a server with this function\n"); + break; + default: + prmsg(1, + "LocalOpenClient: Unknown Open type %d\n", + type); + } + if( ciptr->fd >= 0 ) + break; + } + + TRANS(LocalEndTransports)(); + + if( ciptr->fd < 0 ) + { + free(ciptr); + return NULL; + } + + ciptr->priv=(char *)transptr; + ciptr->index = index; + + return ciptr; +} + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + +static XtransConnInfo +TRANS(LocalOpenServer)(int type, const char *protocol, + const char *host _X_UNUSED, const char *port) + +{ + int i; + XtransConnInfo ciptr; + + prmsg(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port); + +#if defined(X11_t) + /* + * For X11, the port will be in the format xserverN where N is the + * display number. All of the local connections just need to know + * the display number because they don't do any name resolution on + * the port. This just truncates port to the display portion. + */ +#endif /* X11_t */ + + if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + { + prmsg(1,"LocalOpenServer: calloc(1,%lu) failed\n", + sizeof(struct _XtransConnInfo)); + return NULL; + } + + for(i=1;ifd=LOCALtrans2devtab[i].devcotsopenserver(ciptr,port); + break; + default: + prmsg(1,"LocalOpenServer: Unknown Open type %d\n", + type ); + } + if( ciptr->fd >= 0 ) { + ciptr->priv=(char *)&LOCALtrans2devtab[i]; + ciptr->index=i; + ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); + return ciptr; + } + } + + free(ciptr); + return NULL; +} + +#endif /* TRANS_SERVER */ + + +#ifdef TRANS_REOPEN + +static XtransConnInfo +TRANS(LocalReopenServer)(int type, int index, int fd, const char *port) + +{ + XtransConnInfo ciptr; + int stat = 0; + + prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd); + + if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) + { + prmsg(1,"LocalReopenServer: calloc(1,%lu) failed\n", + sizeof(struct _XtransConnInfo)); + return NULL; + } + + ciptr->fd = fd; + + switch( type ) + { + case XTRANS_OPEN_COTS_SERVER: + stat = LOCALtrans2devtab[index].devcotsreopenserver(ciptr,fd,port); + break; + default: + prmsg(1,"LocalReopenServer: Unknown Open type %d\n", + type ); + } + + if( stat > 0 ) { + ciptr->priv=(char *)&LOCALtrans2devtab[index]; + ciptr->index=index; + ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); + return ciptr; + } + + free(ciptr); + return NULL; +} + +#endif /* TRANS_REOPEN */ + + + +/* + * This is the Local implementation of the X Transport service layer + */ + +#ifdef TRANS_CLIENT + +static XtransConnInfo +TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, + const char *host, const char *port) + +{ + prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port); + + return TRANS(LocalOpenClient)(XTRANS_OPEN_COTS_CLIENT, protocol, host, port); +} + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + +static XtransConnInfo +TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol, + const char *host, const char *port) + +{ + char *typetocheck = NULL; + int found = 0; + char typebuf[TYPEBUFSIZE]; + + prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port); + + /* Check if this local type is in the XLOCAL list */ + TRANS(LocalInitTransports)("local"); + typetocheck = workingXLOCAL; + while (typetocheck && !found) { + int j; + + workingXLOCAL = strchr(workingXLOCAL, ':'); + if (workingXLOCAL && *workingXLOCAL) + *workingXLOCAL++ = '\0'; + strncpy(typebuf, typetocheck, TYPEBUFSIZE); + for (j = 0; j < TYPEBUFSIZE; j++) + if (isupper(typebuf[j])) + typebuf[j] = tolower(typebuf[j]); + if (!strcmp(thistrans->TransName, typebuf)) + found = 1; + typetocheck = workingXLOCAL; + } + TRANS(LocalEndTransports)(); + + if (!found) { + prmsg(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName); + thistrans->flags |= TRANS_DISABLED; + return NULL; + } + + return TRANS(LocalOpenServer)(XTRANS_OPEN_COTS_SERVER, protocol, host, port); +} + +#endif /* TRANS_SERVER */ + +#ifdef TRANS_REOPEN + +static XtransConnInfo +TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, const char *port) + +{ + int index; + + prmsg(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port); + + for(index=1;indexTransName, + LOCALtrans2devtab[index].transname) == 0 ) + break; + } + + if (index >= NUMTRANSPORTS) + { + return (NULL); + } + + return TRANS(LocalReopenServer)(XTRANS_OPEN_COTS_SERVER, + index, fd, port); +} + +#endif /* TRANS_REOPEN */ + + + +static int +TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg) + +{ + prmsg(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg); + + return -1; +} + + +#ifdef TRANS_SERVER + +static int +TRANS(LocalCreateListener)(XtransConnInfo ciptr, const char *port, + unsigned int flags _X_UNUSED) + +{ + prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port); + + return 0; +} + +static int +TRANS(LocalResetListener)(XtransConnInfo ciptr) + +{ + LOCALtrans2dev *transptr; + + prmsg(2,"LocalResetListener(%p)\n",ciptr); + + transptr=(LOCALtrans2dev *)ciptr->priv; + if (transptr->devreset != NULL) { + return transptr->devreset(ciptr); + } + return TRANS_RESET_NOOP; +} + + +static XtransConnInfo +TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) + +{ + XtransConnInfo newciptr; + LOCALtrans2dev *transptr; + + prmsg(2,"LocalAccept(%p->%d)\n", ciptr, ciptr->fd); + + transptr=(LOCALtrans2dev *)ciptr->priv; + + if( (newciptr = calloc(1,sizeof(struct _XtransConnInfo)))==NULL ) + { + prmsg(1,"LocalAccept: calloc(1,%lu) failed\n", + sizeof(struct _XtransConnInfo)); + *status = TRANS_ACCEPT_BAD_MALLOC; + return NULL; + } + + newciptr->fd=transptr->devaccept(ciptr,newciptr,status); + + if( newciptr->fd < 0 ) + { + free(newciptr); + return NULL; + } + + newciptr->priv=(char *)transptr; + newciptr->index = ciptr->index; + + *status = 0; + + return newciptr; +} + +#endif /* TRANS_SERVER */ + + +#ifdef TRANS_CLIENT + +static int +TRANS(LocalConnect)(XtransConnInfo ciptr, + const char *host _X_UNUSED, const char *port) + +{ + prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port); + + return 0; +} + +#endif /* TRANS_CLIENT */ + + +static int +TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend ) + +{ + prmsg(2,"LocalBytesReadable(%p->%d,%p)\n", ciptr, ciptr->fd, pend); + +#if defined(SCO325) + return ioctl(ciptr->fd, I_NREAD, (char *)pend); +#else + return ioctl(ciptr->fd, FIONREAD, (char *)pend); +#endif +} + +static int +TRANS(LocalRead)(XtransConnInfo ciptr, char *buf, int size) + +{ + prmsg(2,"LocalRead(%d,%p,%d)\n", ciptr->fd, buf, size ); + + return read(ciptr->fd,buf,size); +} + +static int +TRANS(LocalWrite)(XtransConnInfo ciptr, char *buf, int size) + +{ + prmsg(2,"LocalWrite(%d,%p,%d)\n", ciptr->fd, buf, size ); + + return write(ciptr->fd,buf,size); +} + +static int +TRANS(LocalReadv)(XtransConnInfo ciptr, struct iovec *buf, int size) + +{ + prmsg(2,"LocalReadv(%d,%p,%d)\n", ciptr->fd, buf, size ); + + return READV(ciptr,buf,size); +} + +static int +TRANS(LocalWritev)(XtransConnInfo ciptr, struct iovec *buf, int size) + +{ + prmsg(2,"LocalWritev(%d,%p,%d)\n", ciptr->fd, buf, size ); + + return WRITEV(ciptr,buf,size); +} + +static int +TRANS(LocalDisconnect)(XtransConnInfo ciptr) + +{ + prmsg(2,"LocalDisconnect(%p->%d)\n", ciptr, ciptr->fd); + + return 0; +} + +static int +TRANS(LocalClose)(XtransConnInfo ciptr) + +{ + struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; + int ret; + + prmsg(2,"LocalClose(%p->%d)\n", ciptr, ciptr->fd ); + + ret=close(ciptr->fd); + + if(ciptr->flags + && sockname + && sockname->sun_family == AF_UNIX + && sockname->sun_path[0] ) + { + if (!(ciptr->flags & TRANS_NOUNLINK)) + unlink(sockname->sun_path); + } + + return ret; +} + +static int +TRANS(LocalCloseForCloning)(XtransConnInfo ciptr) + +{ + int ret; + + prmsg(2,"LocalCloseForCloning(%p->%d)\n", ciptr, ciptr->fd ); + + /* Don't unlink path */ + + ret=close(ciptr->fd); + + return ret; +} + + +/* + * MakeAllCOTSServerListeners() will go through the entire Xtransports[] + * array defined in Xtrans.c and try to OpenCOTSServer() for each entry. + * We will add duplicate entries to that table so that the OpenCOTSServer() + * function will get called once for each type of local transport. + * + * The TransName is in lowercase, so it will never match during a normal + * call to SelectTransport() in Xtrans.c. + */ + +#ifdef TRANS_SERVER +static const char * local_aliases[] = { +# ifdef LOCAL_TRANS_PTS + "pts", +# endif + "named", +# ifdef __sun + "pipe", /* compatibility with Solaris Xlib */ +# endif +# ifdef LOCAL_TRANS_SCO + "sco", +# endif + NULL }; +#endif + +Xtransport TRANS(LocalFuncs) = { + /* Local Interface */ + "local", + TRANS_ALIAS | TRANS_LOCAL, +#ifdef TRANS_CLIENT + TRANS(LocalOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + local_aliases, + TRANS(LocalOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(LocalReopenCOTSServer), +#endif + TRANS(LocalSetOption), +#ifdef TRANS_SERVER + TRANS(LocalCreateListener), + TRANS(LocalResetListener), + TRANS(LocalAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(LocalConnect), +#endif /* TRANS_CLIENT */ + TRANS(LocalBytesReadable), + TRANS(LocalRead), + TRANS(LocalWrite), + TRANS(LocalReadv), + TRANS(LocalWritev), +#if XTRANS_SEND_FDS + TRANS(LocalSendFdInvalid), + TRANS(LocalRecvFdInvalid), +#endif + TRANS(LocalDisconnect), + TRANS(LocalClose), + TRANS(LocalCloseForCloning), +}; + +#ifdef LOCAL_TRANS_PTS + +Xtransport TRANS(PTSFuncs) = { + /* Local Interface */ + "pts", + TRANS_LOCAL, +#ifdef TRANS_CLIENT + TRANS(LocalOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(LocalOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(LocalReopenCOTSServer), +#endif + TRANS(LocalSetOption), +#ifdef TRANS_SERVER + TRANS(LocalCreateListener), + TRANS(LocalResetListener), + TRANS(LocalAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(LocalConnect), +#endif /* TRANS_CLIENT */ + TRANS(LocalBytesReadable), + TRANS(LocalRead), + TRANS(LocalWrite), + TRANS(LocalReadv), + TRANS(LocalWritev), +#if XTRANS_SEND_FDS + TRANS(LocalSendFdInvalid), + TRANS(LocalRecvFdInvalid), +#endif + TRANS(LocalDisconnect), + TRANS(LocalClose), + TRANS(LocalCloseForCloning), +}; + +#endif /* LOCAL_TRANS_PTS */ + +#ifdef LOCAL_TRANS_NAMED + +Xtransport TRANS(NAMEDFuncs) = { + /* Local Interface */ + "named", + TRANS_LOCAL, +#ifdef TRANS_CLIENT + TRANS(LocalOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(LocalOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(LocalReopenCOTSServer), +#endif + TRANS(LocalSetOption), +#ifdef TRANS_SERVER + TRANS(LocalCreateListener), + TRANS(LocalResetListener), + TRANS(LocalAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(LocalConnect), +#endif /* TRANS_CLIENT */ + TRANS(LocalBytesReadable), + TRANS(LocalRead), + TRANS(LocalWrite), + TRANS(LocalReadv), + TRANS(LocalWritev), +#if XTRANS_SEND_FDS + TRANS(LocalSendFdInvalid), + TRANS(LocalRecvFdInvalid), +#endif + TRANS(LocalDisconnect), + TRANS(LocalClose), + TRANS(LocalCloseForCloning), +}; + +#ifdef __sun +Xtransport TRANS(PIPEFuncs) = { + /* Local Interface */ + "pipe", + TRANS_ALIAS | TRANS_LOCAL, +#ifdef TRANS_CLIENT + TRANS(LocalOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(LocalOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(LocalReopenCOTSServer), +#endif + TRANS(LocalSetOption), +#ifdef TRANS_SERVER + TRANS(LocalCreateListener), + TRANS(LocalResetListener), + TRANS(LocalAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(LocalConnect), +#endif /* TRANS_CLIENT */ + TRANS(LocalBytesReadable), + TRANS(LocalRead), + TRANS(LocalWrite), + TRANS(LocalReadv), + TRANS(LocalWritev), +#if XTRANS_SEND_FDS + TRANS(LocalSendFdInvalid), + TRANS(LocalRecvFdInvalid), +#endif + TRANS(LocalDisconnect), + TRANS(LocalClose), + TRANS(LocalCloseForCloning), +}; +#endif /* __sun */ +#endif /* LOCAL_TRANS_NAMED */ + + +#ifdef LOCAL_TRANS_SCO +Xtransport TRANS(SCOFuncs) = { + /* Local Interface */ + "sco", + TRANS_LOCAL, +#ifdef TRANS_CLIENT + TRANS(LocalOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(LocalOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(LocalReopenCOTSServer), +#endif + TRANS(LocalSetOption), +#ifdef TRANS_SERVER + TRANS(LocalCreateListener), + TRANS(LocalResetListener), + TRANS(LocalAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(LocalConnect), +#endif /* TRANS_CLIENT */ + TRANS(LocalBytesReadable), + TRANS(LocalRead), + TRANS(LocalWrite), + TRANS(LocalReadv), + TRANS(LocalWritev), +#if XTRANS_SEND_FDS + TRANS(LocalSendFdInvalid), + TRANS(LocalRecvFdInvalid), +#endif + TRANS(LocalDisconnect), + TRANS(LocalClose), + TRANS(LocalCloseForCloning), +}; +#endif /* LOCAL_TRANS_SCO */ diff --git a/nx-X11/lib/include/xtrans/Xtranssock.c b/nx-X11/lib/include/xtrans/Xtranssock.c new file mode 100644 index 000000000..dff217e9d --- /dev/null +++ b/nx-X11/lib/include/xtrans/Xtranssock.c @@ -0,0 +1,3554 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* nx-X11, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +/* + * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of the copyright holders shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from the copyright holders. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +#ifdef NX_TRANS_SOCKET + +#ifdef NX_TRANS_DEBUG +#define XTRANSDEBUG 5 +#endif + +#ifndef PF_LOCAL +#define PF_LOCAL PF_UNIX +#endif + +#endif + +#include +#ifdef XTHREADS +#include +#endif + +#ifndef WIN32 + +#if defined(TCPCONN) || defined(UNIXCONN) +#include +#include +#include +#endif + +#if defined(TCPCONN) || defined(UNIXCONN) +#define X_INCLUDE_NETDB_H +#define XOS_USE_NO_LOCKING +#include +#endif + +#ifdef UNIXCONN +#ifndef X_NO_SYS_UN +#include +#endif +#include +#endif + + +#ifndef NO_TCP_H +#if defined(linux) || defined(__GLIBC__) +#include +#endif /* linux || __GLIBC__ */ +#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) +#include +#include +#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __DragonFly__ */ +#include +#endif /* !NO_TCP_H */ + +#include +#if defined(SVR4) || defined(__SVR4) +#include +#endif + +#include + +#else /* !WIN32 */ + +#include +#include +#include +#undef close +#define close closesocket +#define ECONNREFUSED WSAECONNREFUSED +#define EADDRINUSE WSAEADDRINUSE +#define EPROTOTYPE WSAEPROTOTYPE +#undef EWOULDBLOCK +#define EWOULDBLOCK WSAEWOULDBLOCK +#define EINPROGRESS WSAEINPROGRESS +#undef EINTR +#define EINTR WSAEINTR +#define X_INCLUDE_NETDB_H +#define XOS_USE_MTSAFE_NETDBAPI +#include +#endif /* WIN32 */ + +#if defined(SO_DONTLINGER) && defined(SO_LINGER) +#undef SO_DONTLINGER +#endif + +/* others don't need this */ +#define SocketInitOnce() /**/ + +#ifdef linux +#define HAVE_ABSTRACT_SOCKETS +#endif + +#define MIN_BACKLOG 128 +#ifdef SOMAXCONN +#if SOMAXCONN > MIN_BACKLOG +#define BACKLOG SOMAXCONN +#endif +#endif +#ifndef BACKLOG +#define BACKLOG MIN_BACKLOG +#endif + +/* + * This is the Socket implementation of the X Transport service layer + * + * This file contains the implementation for both the UNIX and INET domains, + * and can be built for either one, or both. + * + */ + +typedef struct _Sockettrans2dev { + const char *transname; + int family; + int devcotsname; + int devcltsname; + int protocol; +} Sockettrans2dev; + +static Sockettrans2dev Sockettrans2devtab[] = { +#ifdef TCPCONN + {"inet",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, +#if !defined(IPv6) || !defined(AF_INET6) + {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, +#else /* IPv6 */ + {"tcp",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, + {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, /* fallback */ + {"inet6",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, +#endif +#endif /* TCPCONN */ +#ifdef UNIXCONN + {"unix",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, +#if !defined(LOCALCONN) + {"local",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, +#endif /* !LOCALCONN */ +#endif /* UNIXCONN */ +}; + +#define NUMSOCKETFAMILIES (sizeof(Sockettrans2devtab)/sizeof(Sockettrans2dev)) + +#ifdef TCPCONN +static int TRANS(SocketINETClose) (XtransConnInfo ciptr); +#endif + +#ifdef UNIXCONN + + +#if defined(X11_t) +#define UNIX_PATH "/tmp/.X11-unix/X" +#define UNIX_DIR "/tmp/.X11-unix" +#endif /* X11_t */ +#if defined(XIM_t) +#define UNIX_PATH "/tmp/.XIM-unix/XIM" +#define UNIX_DIR "/tmp/.XIM-unix" +#endif /* XIM_t */ +#if defined(FS_t) || defined(FONT_t) +#define UNIX_PATH "/tmp/.font-unix/fs" +#define UNIX_DIR "/tmp/.font-unix" +#endif /* FS_t || FONT_t */ +#if defined(ICE_t) +#define UNIX_PATH "/tmp/.ICE-unix/" +#define UNIX_DIR "/tmp/.ICE-unix" +#endif /* ICE_t */ + + +#endif /* UNIXCONN */ + +#define PORTBUFSIZE 32 + +#ifndef MAXHOSTNAMELEN +#define MAXHOSTNAMELEN 255 +#endif + +#if defined HAVE_SOCKLEN_T || (defined(IPv6) && defined(AF_INET6)) +# define SOCKLEN_T socklen_t +#elif defined(SVR4) || defined(__SVR4) || defined(__SCO__) +# define SOCKLEN_T size_t +#else +# define SOCKLEN_T int +#endif + +#ifndef X11_t + +/* + * No NX changes if this is not + * compiled as a X11 transport. + */ + +#undef NX_TRANS_SOCKET + +#endif + +#ifdef NX_TRANS_SOCKET + +#if XTRANS_SEND_FDS + #error XTRANS_SEND_FDS is unsupported for NX! +#endif + +#ifdef TRANS_CLIENT + +#include + +typedef struct +{ + XtransConnInfo info; + int local; + int remote; + int congestion; + +} _NXProxyConnInfo; + +#define NX_PROXY_CONN_LIMIT 256 + +static _NXProxyConnInfo *_NXProxyConnInfoTab[NX_PROXY_CONN_LIMIT]; + +#endif /* #ifdef TRANS_CLIENT */ + +static char *_NXGetUnixDir(char *dir); +static char *_NXGetUnixPath(char *path); + +/* + * Forcibly close any connection attempt on the + * listening socket. Need this to avoid loopback + * connections to the agent server. + */ + +#ifdef TRANS_SERVER + +void TRANS(SocketRejectConnection) (XtransConnInfo ciptr) +{ + socklen_t sa_l = sizeof(struct sockaddr); + struct sockaddr sa; + fd_set fs; + struct timeval t; + int f; + + prmsg (3, "SocketRejectConnection(%p)\n", (void *) ciptr); + + FD_ZERO(&fs); + FD_SET(ciptr -> fd, &fs); + + t.tv_sec = 0; + t.tv_usec = 0; + + /* + * Check if there is an awaiting connection. + */ + + if (select(ciptr -> fd + 1, &fs, NULL, NULL, &t) == 1) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketRejectConnection: Accepting connection attempt on fd [%d].\n", + ciptr -> fd); +#endif + /* + * If there is one, close it. + */ + + if ((f = accept(ciptr -> fd, &sa, &sa_l)) >= 0) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketRejectConnection: Closing connection attempt on fd [%d].\n", + ciptr -> fd); +#endif + close(f); + } + } +} + +#endif /* #ifdef TRANS_SERVER */ + +#ifdef TRANS_CLIENT + +void *TRANS(SocketProxyConnInfo) (XtransConnInfo ciptr) +{ + if (_NXProxyConnInfoTab[ciptr->fd] != NULL) + { + return ciptr->priv; + } + + return NULL; +} + +static XtransConnInfo TRANS(SocketCreateConnInfo) () +{ + XtransConnInfo ciptr; + + int fds[2]; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCreateConnInfo: Going to create the NX connection info.\n"); +#endif + + if ((ciptr = (XtransConnInfo) calloc (1, sizeof(struct _XtransConnInfo))) == NULL) + { + prmsg (1, "SocketCreateConnInfo: malloc failed\n"); + return NULL; + } + + /* + * Create a pair of sockets. We'll communicate with + * the NX proxy by reading and writing to our end. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCreateConnInfo: Going to create the NX socketpair.\n"); +#endif + + if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) + { + prmsg (1, "SocketCreateConnInfo: socketpair() failed.\n"); + free ((char *) ciptr); + return NULL; + } + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCreateConnInfo: X socket end is [%d] NX proxy end is [%d].\n", + fds[0], fds[1]); +#endif + + /* + * Save in _NXProxyConnInfoTab the local and remote end of + * the socketpair. The remote end will be used by the proxy. + * When the memory-to-memory transport is activated, the + * agent and the proxy don't read or write to the real des- + * criptors but the communication takes place by reading + * and writing to the proxy's buffers. + */ + + ciptr->fd = fds[0]; + + if (ciptr->fd >= NX_PROXY_CONN_LIMIT) + { + prmsg (1, "SocketCreateConnInfo: No space for a new _NXProxyConnInfo for [%d].\n", + ciptr->fd); + free ((char *) ciptr); + return NULL; + } + else if (_NXProxyConnInfoTab[ciptr->fd] != NULL) + { + prmsg (1, "SocketCreateConnInfo: _NXProxyConnInfo for [%d] is not NULL. Exiting.\n", + ciptr->fd); + exit(1); + } + + _NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) calloc(1, sizeof(_NXProxyConnInfo)); + + if (_NXProxyConnInfoTab[ciptr->fd] == NULL) + { + prmsg (1, "SocketCreateConnInfo: Alloc of _NXProxyConnInfo failed.\n"); + free ((char *) ciptr); + return NULL; + } + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCreateConnInfo: Allocated new _NXProxyConnInfo for [%d].\n", + ciptr->fd); +#endif + + _NXProxyConnInfoTab[ciptr->fd]->info = ciptr; + _NXProxyConnInfoTab[ciptr->fd]->local = fds[0]; + _NXProxyConnInfoTab[ciptr->fd]->remote = fds[1]; + _NXProxyConnInfoTab[ciptr->fd]->congestion = 0; + + ciptr->priv = (char *) _NXProxyConnInfoTab[ciptr->fd]; + + return ciptr; +} + +static int TRANS(SocketConnectConnInfo) (XtransConnInfo ciptr, const char *host, const char *port) +{ + int fds[2]; + char display[1024]; + + _NXProxyConnInfo *proxy_conn; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketConnectConnInfo: Going to connect NX fd [%d] to host [%s] port [%s].\n", + ciptr->fd, host, port); +#endif + + /* + * We should have already created the socket pair. + */ + + proxy_conn = (_NXProxyConnInfo *) ciptr->priv; + + if (proxy_conn == NULL) + { + prmsg (1, "SocketConnectConnInfo: Pointer to _NXProxyConnInfo is NULL. Exiting.\n"); + + exit(1); + } + else if (_NXProxyConnInfoTab[ciptr->fd] != (_NXProxyConnInfo *) ciptr->priv) + { + prmsg (1, "SocketConnectConnInfo: Can't find _NXProxyConnInfo in table. Exiting.\n"); + + exit(1); + } + + if (strlen(host) + strlen(port) + 1 >= 1023) + { + prmsg (1, "SocketConnectConnInfo: Length of NX display string '%s:%s' would exceed %d characters.\n", + host, port, 1023); + + return TRANS_CONNECT_FAILED; + } + + sprintf(display, "%s:%s", host, port); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketConnectConnInfo: Setting close-on-exec flag on local NX descriptor [%d].\n", + proxy_conn -> local); +#endif + +#ifdef F_SETFD +#ifdef FD_CLOEXEC + if (fcntl(proxy_conn -> local, F_SETFD, FD_CLOEXEC) != 0) +#else + if (fcntl(proxy_conn -> local, F_SETFD, 1) != 0) +#endif +#endif + { + prmsg (1, "SocketConnectConnInfo: Cannot set close-on-exec on local NX descriptor [%d].\n", + proxy_conn -> local); + + return TRANS_CONNECT_FAILED; + } + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketConnectConnInfo: Creating the NX transport with display [%s].\n", + display); +#endif + + if (NXTransCreate(NX_FD_ANY, NX_MODE_CLIENT, display) < 0) + { + prmsg (1, "SocketConnectConnInfo: Cannot create the NX transport.\n"); + + return TRANS_CONNECT_FAILED; + } + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketConnectConnInfo: Starting the NX agent with descriptor [%d].\n", + proxy_conn -> remote); +#endif + + fds[0] = proxy_conn -> local; + fds[1] = proxy_conn -> remote; + + NXTransAgent(fds); + + return 0; +} + +static void TRANS(SocketCloseConnInfo) (XtransConnInfo ciptr) +{ + _NXProxyConnInfo *proxy_conn; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCloseConnInfo: Going to close the NX fd [%d].\n", ciptr->fd); +#endif + + proxy_conn = (_NXProxyConnInfo *) ciptr->priv; + + if (proxy_conn == NULL) + { + prmsg (1, "SocketCloseConnInfo: Pointer to _NXProxyConnInfo is NULL. Exiting.\n"); + + exit(1); + } + else if (ciptr->fd >= NX_PROXY_CONN_LIMIT || + _NXProxyConnInfoTab[ciptr->fd] != (_NXProxyConnInfo *) ciptr->priv) + { + prmsg (1, "SocketCloseConnInfo: Can't find _NXProxyConnInfo in table. Exiting.\n"); + exit(1); + } + else if (_NXProxyConnInfoTab[ciptr->fd] -> info != ciptr || + _NXProxyConnInfoTab[ciptr->fd] -> local != ciptr->fd) + { + prmsg (1, "SocketCloseConnInfo: Invalid _NXProxyConnInfo structure for [%d]. Exiting.\n", + ciptr->fd); + exit(1); + } + else if (proxy_conn->local < 0 || proxy_conn->remote < 0) + { + prmsg (1, "SocketCloseConnInfo: Invalid socket pair in NX connection for [%d]. Exiting.\n", + ciptr->fd); + exit(1); + } + + NXTransClose(ciptr->fd); + + /* + * Get rid of the _NXProxyConnInfo structure. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCloseConnInfo: Freeing _NXProxyConnInfo structure for [%d].\n", + ciptr->fd); +#endif + + free((char *) _NXProxyConnInfoTab[ciptr->fd]); + + _NXProxyConnInfoTab[ciptr->fd] = NULL; + + ciptr->priv = NULL; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCloseConnInfo: Should now close the local descriptor [%d].\n", + ciptr->fd); +#endif +} + +#endif /* #ifdef TRANS_CLIENT */ + +#if defined(TRANS_CLIENT) && defined(NX_TRANS_CHANGE) + +/* + * Check the congestion state of the NX transport + * and return 1 if there has been a change. This + * can be extended by adding a few counters track- + * ing the bandwidth usage of the X11 connection. + */ + +int TRANS(SocketCongestionChange) (XtransConnInfo ciptr, int *state) +{ + int congestion; + + _NXProxyConnInfo *proxy_conn; + + prmsg (3, "SocketCongestionChange(%p)\n", (void *) ciptr); + + proxy_conn = (_NXProxyConnInfo *) ciptr->priv; + + if (proxy_conn == NULL) + { +#ifdef NX_TRANS_DEBUG + fprintf(stderr, "SocketCongestionChange: Descriptor [%d] doesn't appear to be a NX connection.\n", + ciptr->fd); +#endif + return 0; + } + +#ifdef NX_TRANS_DEBUG + fprintf(stderr, "SocketCongestionChange: Checking congestion on fd [%d] with old state [%d].\n", + ciptr->fd, proxy_conn->congestion); +#endif + + congestion = NXTransCongestion(ciptr->fd); + + if (congestion != proxy_conn->congestion) + { + proxy_conn->congestion = congestion; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCongestionChange: Change detected on fd [%d] with new state [%d].\n", + ciptr->fd, proxy_conn->congestion); +#endif + return 1; + } + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketCongestionChange: No change on fd [%d] with current state [%d].\n", + ciptr->fd, congestion); +#endif + return 0; +} + +#endif /* #if defined(TRANS_CLIENT) && defined(NX_TRANS_CHANGE) */ + +#endif /* #ifdef NX_TRANS_SOCKET */ + +/* + * These are some utility function used by the real interface function below. + */ + +static int +TRANS(SocketSelectFamily) (int first, const char *family) + +{ + int i; + + prmsg (3,"SocketSelectFamily(%s)\n", family); + + for (i = first + 1; i < NUMSOCKETFAMILIES;i++) + { + if (!strcmp (family, Sockettrans2devtab[i].transname)) + return i; + } + + return (first == -1 ? -2 : -1); +} + + +/* + * This function gets the local address of the socket and stores it in the + * XtransConnInfo structure for the connection. + */ + +static int +TRANS(SocketINETGetAddr) (XtransConnInfo ciptr) + +{ +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_storage socknamev6; +#else + struct sockaddr_in socknamev4; +#endif + void *socknamePtr; + SOCKLEN_T namelen; + + prmsg (3,"SocketINETGetAddr(%p)\n", (void *) ciptr); + +#if defined(IPv6) && defined(AF_INET6) + namelen = sizeof(socknamev6); + socknamePtr = &socknamev6; +#else + namelen = sizeof(socknamev4); + socknamePtr = &socknamev4; +#endif + + bzero(socknamePtr, namelen); + + if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr, + (void *)&namelen) < 0) + { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + prmsg (1,"SocketINETGetAddr: getsockname() failed: %d\n", + EGET()); + return -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + if ((ciptr->addr = malloc (namelen)) == NULL) + { + prmsg (1, + "SocketINETGetAddr: Can't allocate space for the addr\n"); + return -1; + } + +#if defined(IPv6) && defined(AF_INET6) + ciptr->family = ((struct sockaddr *)socknamePtr)->sa_family; +#else + ciptr->family = socknamev4.sin_family; +#endif + ciptr->addrlen = namelen; + memcpy (ciptr->addr, socknamePtr, ciptr->addrlen); + + return 0; +} + + +/* + * This function gets the remote address of the socket and stores it in the + * XtransConnInfo structure for the connection. + */ + +static int +TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr) + +{ +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_storage socknamev6; +#endif + struct sockaddr_in socknamev4; + void *socknamePtr; + SOCKLEN_T namelen; + +#if defined(IPv6) && defined(AF_INET6) + if (ciptr->family == AF_INET6) + { + namelen = sizeof(socknamev6); + socknamePtr = &socknamev6; + } + else +#endif + { + namelen = sizeof(socknamev4); + socknamePtr = &socknamev4; + } + + bzero(socknamePtr, namelen); + + prmsg (3,"SocketINETGetPeerAddr(%p)\n", (void *) ciptr); + + if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr, + (void *)&namelen) < 0) + { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + prmsg (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n", + EGET()); + return -1; + } + + /* + * Everything looks good: fill in the XtransConnInfo structure. + */ + + if ((ciptr->peeraddr = malloc (namelen)) == NULL) + { + prmsg (1, + "SocketINETGetPeerAddr: Can't allocate space for the addr\n"); + return -1; + } + + ciptr->peeraddrlen = namelen; + memcpy (ciptr->peeraddr, socknamePtr, ciptr->peeraddrlen); + + return 0; +} + + +static XtransConnInfo +TRANS(SocketOpen) (int i, int type) + +{ + XtransConnInfo ciptr; + + prmsg (3,"SocketOpen(%d,%d)\n", i, type); + + if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) + { + prmsg (1, "SocketOpen: malloc failed\n"); + return NULL; + } + + if ((ciptr->fd = socket(Sockettrans2devtab[i].family, type, + Sockettrans2devtab[i].protocol)) < 0 +#ifndef WIN32 +#if (defined(X11_t) && !defined(USE_POLL)) || defined(FS_t) || defined(FONT_t) + || ciptr->fd >= sysconf(_SC_OPEN_MAX) +#endif +#endif + ) { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + prmsg (2, "SocketOpen: socket() failed for %s\n", + Sockettrans2devtab[i].transname); + + free (ciptr); + return NULL; + } + +#ifdef TCP_NODELAY + if (Sockettrans2devtab[i].family == AF_INET +#if defined(IPv6) && defined(AF_INET6) + || Sockettrans2devtab[i].family == AF_INET6 +#endif + ) + { + /* + * turn off TCP coalescence for INET sockets + */ + + int tmp = 1; + setsockopt (ciptr->fd, IPPROTO_TCP, TCP_NODELAY, + (char *) &tmp, sizeof (int)); + } +#endif + + /* + * Some systems provide a really small default buffer size for + * UNIX sockets. Bump it up a bit such that large transfers don't + * proceed at glacial speed. + */ +#ifdef SO_SNDBUF + if (Sockettrans2devtab[i].family == AF_UNIX) + { + SOCKLEN_T len = sizeof (int); + int val; + + if (getsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, + (char *) &val, &len) == 0 && val < 64 * 1024) + { + val = 64 * 1024; + setsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, + (char *) &val, sizeof (int)); + } + } +#endif + + return ciptr; +} + + +#ifdef TRANS_REOPEN + +static XtransConnInfo +TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, const char *port) + +{ + XtransConnInfo ciptr; + int portlen; + struct sockaddr *addr; + size_t addrlen; + + prmsg (3,"SocketReopen(%d,%d,%s)\n", type, fd, port); + + if (port == NULL) { + prmsg (1, "SocketReopen: port was null!\n"); + return NULL; + } + + portlen = strlen(port) + 1; // include space for trailing null +#ifdef SOCK_MAXADDRLEN + if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) { + prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); + return NULL; + } + if (portlen < 14) portlen = 14; +#else + if (portlen < 0 || portlen > 14) { + prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); + return NULL; + } +#endif /*SOCK_MAXADDRLEN*/ + + if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) + { + prmsg (1, "SocketReopen: malloc(ciptr) failed\n"); + return NULL; + } + + ciptr->fd = fd; + + addrlen = portlen + offsetof(struct sockaddr, sa_data); + if ((addr = calloc (1, addrlen)) == NULL) { + prmsg (1, "SocketReopen: malloc(addr) failed\n"); + free (ciptr); + return NULL; + } + ciptr->addr = (char *) addr; + ciptr->addrlen = addrlen; + + if ((ciptr->peeraddr = calloc (1, addrlen)) == NULL) { + prmsg (1, "SocketReopen: malloc(portaddr) failed\n"); + free (addr); + free (ciptr); + return NULL; + } + ciptr->peeraddrlen = addrlen; + + /* Initialize ciptr structure as if it were a normally-opened unix socket */ + ciptr->flags = TRANS_LOCAL | TRANS_NOUNLINK; +#ifdef BSD44SOCKETS + addr->sa_len = addrlen; +#endif + addr->sa_family = AF_UNIX; +#if defined(HAVE_STRLCPY) || defined(HAS_STRLCPY) + strlcpy(addr->sa_data, port, portlen); +#else + strncpy(addr->sa_data, port, portlen); +#endif + ciptr->family = AF_UNIX; + memcpy(ciptr->peeraddr, ciptr->addr, addrlen); + ciptr->port = rindex(addr->sa_data, ':'); + if (ciptr->port == NULL) { + if (is_numeric(addr->sa_data)) { + ciptr->port = addr->sa_data; + } + } else if (ciptr->port[0] == ':') { + ciptr->port++; + } + /* port should now point to portnum or NULL */ + return ciptr; +} + +#endif /* TRANS_REOPEN */ + + +/* + * These functions are the interface supplied in the Xtransport structure + */ + +#ifdef TRANS_CLIENT + +static XtransConnInfo +TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol, + const char *host, const char *port, int previndex) +{ + XtransConnInfo ciptr; + int i = previndex; + + prmsg (2, "SocketOpenCOTSClient(%s,%s,%s)\n", + protocol, host, port); + + SocketInitOnce(); + + while ((i = TRANS(SocketSelectFamily) (i, transname)) >= 0) { + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + if ((!strcmp(protocol, "local") || !strcmp(protocol, "nx")) && + (!strcasecmp(host, "nx") || !strncasecmp(host, "nx,", 3))) + { + ciptr = TRANS(SocketCreateConnInfo) (); + + if (ciptr == NULL) + { + prmsg (1, "SocketOpenCOTSClient: Unable to create the NX connection info for %s.\n", + transname); + + return NULL; + } + + ciptr->index = i; + + return ciptr; + } + +#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ + + if ((ciptr = TRANS(SocketOpen) ( + i, Sockettrans2devtab[i].devcotsname)) != NULL) { + /* Save the index for later use */ + + ciptr->index = i; + break; + } + } + if (i < 0) { + if (i == -1) + prmsg (1,"SocketOpenCOTSClient: Unable to open socket for %s\n", + transname); + else + prmsg (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n", + transname); + return NULL; + } + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + ciptr->priv = NULL; + +#endif + + return ciptr; +} + +static XtransConnInfo +TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol, + const char *host, const char *port) +{ + return TRANS(SocketOpenCOTSClientBase)( + thistrans->TransName, protocol, host, port, -1); +} + + +#endif /* TRANS_CLIENT */ + + +#ifdef TRANS_SERVER + +static XtransConnInfo +TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol, + const char *host, const char *port) + +{ + XtransConnInfo ciptr; + int i = -1; + + prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port); + + SocketInitOnce(); + + while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { + if ((ciptr = TRANS(SocketOpen) ( + i, Sockettrans2devtab[i].devcotsname)) != NULL) + break; + } + if (i < 0) { + if (i == -1) + prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n", + thistrans->TransName); + else + prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n", + thistrans->TransName); + return NULL; + } + + /* + * Using this prevents the bind() check for an existing server listening + * on the same port, but it is required for other reasons. + */ +#ifdef SO_REUSEADDR + + /* + * SO_REUSEADDR only applied to AF_INET && AF_INET6 + */ + + if (Sockettrans2devtab[i].family == AF_INET +#if defined(IPv6) && defined(AF_INET6) + || Sockettrans2devtab[i].family == AF_INET6 +#endif + ) + { + int one = 1; + setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR, + (char *) &one, sizeof (int)); + } +#endif +#ifdef IPV6_V6ONLY + if (Sockettrans2devtab[i].family == AF_INET6) + { + int one = 1; + setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int)); + } +#endif + /* Save the index for later use */ + + ciptr->index = i; + + return ciptr; +} + +#endif /* TRANS_SERVER */ + + +#ifdef TRANS_REOPEN + +static XtransConnInfo +TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, const char *port) + +{ + XtransConnInfo ciptr; + int i = -1; + + prmsg (2, + "SocketReopenCOTSServer(%d, %s)\n", fd, port); + + SocketInitOnce(); + + while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { + if ((ciptr = TRANS(SocketReopen) ( + i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL) + break; + } + if (i < 0) { + if (i == -1) + prmsg (1,"SocketReopenCOTSServer: Unable to open socket for %s\n", + thistrans->TransName); + else + prmsg (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n", + thistrans->TransName); + return NULL; + } + + /* Save the index for later use */ + + ciptr->index = i; + + return ciptr; +} + +#endif /* TRANS_REOPEN */ + + +static int +TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg) + +{ + prmsg (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "SocketSetOption: WARNING! Not setting option [%d] with value [%d] on descriptor [%d].\n", + option, arg, ciptr -> fd); +#endif + + return -1; +} + +#ifdef UNIXCONN +static int +set_sun_path(const char *port, const char *upath, char *path, int abstract) +{ + struct sockaddr_un s; + int maxlen = sizeof(s.sun_path) - 1; + const char *at = ""; + + if (!port || !*port || !path) + return -1; + +#ifdef HAVE_ABSTRACT_SOCKETS + if (port[0] == '@') + upath = ""; + else if (abstract) + at = "@"; +#endif + + if (*port == '/') /* a full pathname */ + upath = ""; + + if (strlen(port) + strlen(upath) > maxlen) + return -1; + snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port); + return 0; +} +#endif + +#ifdef TRANS_SERVER + +static int +TRANS(SocketCreateListener) (XtransConnInfo ciptr, + struct sockaddr *sockname, + int socknamelen, unsigned int flags) + +{ + SOCKLEN_T namelen = socknamelen; + int fd = ciptr->fd; + int retry; + + prmsg (3, "SocketCreateListener(%p,%d)\n", (void *) ciptr, fd); + + if (Sockettrans2devtab[ciptr->index].family == AF_INET +#if defined(IPv6) && defined(AF_INET6) + || Sockettrans2devtab[ciptr->index].family == AF_INET6 +#endif + ) + retry = 20; + else + retry = 0; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "SocketCreateListener: Creating listener for ciptr at [%p] on path [%s].\n", + (void *) ciptr, ((struct sockaddr_un *) sockname)->sun_family == AF_UNIX ? + ((struct sockaddr_un *) sockname)->sun_path : "TCP"); +#endif + while (bind (fd, (struct sockaddr *) sockname, namelen) < 0) + { + if (errno == EADDRINUSE) { + if (flags & ADDR_IN_USE_ALLOWED) + break; + else + return TRANS_ADDR_IN_USE; + } + + if (retry-- == 0) { + prmsg (1, "SocketCreateListener: failed to bind listener\n"); + close (fd); + return TRANS_CREATE_LISTENER_FAILED; + } +#ifdef SO_REUSEADDR + sleep (1); +#else + sleep (10); +#endif /* SO_REUSEDADDR */ + } + + if (Sockettrans2devtab[ciptr->index].family == AF_INET +#if defined(IPv6) && defined(AF_INET6) + || Sockettrans2devtab[ciptr->index].family == AF_INET6 +#endif + ) { +#ifdef SO_DONTLINGER + setsockopt (fd, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0); +#else +#ifdef SO_LINGER + { + static int linger[2] = { 0, 0 }; + setsockopt (fd, SOL_SOCKET, SO_LINGER, + (char *) linger, sizeof (linger)); + } +#endif +#endif +} + + if (listen (fd, BACKLOG) < 0) + { + prmsg (1, "SocketCreateListener: listen() failed\n"); + close (fd); + return TRANS_CREATE_LISTENER_FAILED; + } + + /* Set a flag to indicate that this connection is a listener */ + + ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "SocketCreateListener: Set flags to [%d] for ciptr [%p].\n", + ciptr->flags, (void *) ciptr); +#endif + + return 0; +} + +#ifdef TCPCONN +static int +TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, const char *port, + unsigned int flags) + +{ +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_storage sockname; +#else + struct sockaddr_in sockname; +#endif + unsigned short sport; + SOCKLEN_T namelen = sizeof(sockname); + int status; + long tmpport; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgetservbynameparams sparams; +#endif + struct servent *servp; + +#ifdef X11_t + char portbuf[PORTBUFSIZE]; +#endif + + prmsg (2, "SocketINETCreateListener(%s)\n", port); + +#ifdef X11_t + /* + * X has a well known port, that is transport dependent. It is easier + * to handle it here, than try and come up with a transport independent + * representation that can be passed in and resolved the usual way. + * + * The port that is passed here is really a string containing the idisplay + * from ConnectDisplay(). + */ + + if (is_numeric (port)) + { + /* fixup the server port address */ + tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); + snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); + port = portbuf; + } +#endif + + if (port && *port) + { + /* Check to see if the port string is just a number (handles X11) */ + + if (!is_numeric (port)) + { + if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) + { + prmsg (1, + "SocketINETCreateListener: Unable to get service for %s\n", + port); + return TRANS_CREATE_LISTENER_FAILED; + } + /* we trust getservbyname to return a valid number */ + sport = servp->s_port; + } + else + { + tmpport = strtol (port, (char**)NULL, 10); + /* + * check that somehow the port address isn't negative or in + * the range of reserved port addresses. This can happen and + * be very bad if the server is suid-root and the user does + * something (dumb) like `X :60049`. + */ + if (tmpport < 1024 || tmpport > USHRT_MAX) + return TRANS_CREATE_LISTENER_FAILED; + + sport = (unsigned short) tmpport; + } + } + else + sport = 0; + + bzero(&sockname, sizeof(sockname)); +#if defined(IPv6) && defined(AF_INET6) + if (Sockettrans2devtab[ciptr->index].family == AF_INET) { + namelen = sizeof (struct sockaddr_in); +#ifdef BSD44SOCKETS + ((struct sockaddr_in *)&sockname)->sin_len = namelen; +#endif + ((struct sockaddr_in *)&sockname)->sin_family = AF_INET; + ((struct sockaddr_in *)&sockname)->sin_port = htons(sport); + ((struct sockaddr_in *)&sockname)->sin_addr.s_addr = htonl(INADDR_ANY); + } else { + namelen = sizeof (struct sockaddr_in6); +#ifdef SIN6_LEN + ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname); +#endif + ((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6; + ((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport); + ((struct sockaddr_in6 *)&sockname)->sin6_addr = in6addr_any; + } +#else +#ifdef BSD44SOCKETS + sockname.sin_len = sizeof (sockname); +#endif + sockname.sin_family = AF_INET; + sockname.sin_port = htons (sport); + sockname.sin_addr.s_addr = htonl (INADDR_ANY); +#endif + + if ((status = TRANS(SocketCreateListener) (ciptr, + (struct sockaddr *) &sockname, namelen, flags)) < 0) + { + prmsg (1, + "SocketINETCreateListener: ...SocketCreateListener() failed\n"); + return status; + } + + if (TRANS(SocketINETGetAddr) (ciptr) < 0) + { + prmsg (1, + "SocketINETCreateListener: ...SocketINETGetAddr() failed\n"); + return TRANS_CREATE_LISTENER_FAILED; + } + + return 0; +} + +#endif /* TCPCONN */ + + +#ifdef UNIXCONN + +static int +TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, const char *port, + unsigned int flags) + +{ + struct sockaddr_un sockname; + int namelen; + int oldUmask; + int status; + unsigned int mode; + char tmpport[108]; + + int abstract = 0; +#ifdef HAVE_ABSTRACT_SOCKETS + abstract = ciptr->transptr->flags & TRANS_ABSTRACT; +#endif + + prmsg (2, "SocketUNIXCreateListener(%s)\n", + port ? port : "NULL"); + + /* Make sure the directory is created */ + + oldUmask = umask (0); + +#ifdef UNIX_DIR +#ifdef HAS_STICKY_DIR_BIT + mode = 01777; +#else + mode = 0777; +#endif +#ifdef NX_TRANS_SOCKET + if (!abstract && trans_mkdir(_NXGetUnixDir(UNIX_DIR), mode) == -1) { + prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n", + _NXGetUnixDir(UNIX_DIR), errno); +#else + if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) { + prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n", + UNIX_DIR, errno); +#endif + (void) umask (oldUmask); + return TRANS_CREATE_LISTENER_FAILED; + } +#endif + + memset(&sockname, 0, sizeof(sockname)); + sockname.sun_family = AF_UNIX; + + if (!(port && *port)) { + snprintf (tmpport, sizeof(tmpport), "%s%ld", UNIX_PATH, (long)getpid()); + port = tmpport; + } +#ifdef NX_TRANS_SOCKET + if (set_sun_path(port, _NXGetUnixPath(UNIX_PATH), sockname.sun_path, abstract) != 0) { +#else + if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { +#endif + prmsg (1, "SocketUNIXCreateListener: path too long\n"); + return TRANS_CREATE_LISTENER_FAILED; + } + +#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) + sockname.sun_len = strlen(sockname.sun_path); +#endif + +#if defined(BSD44SOCKETS) || defined(SUN_LEN) + namelen = SUN_LEN(&sockname); +#else + namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); +#endif + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "SocketUNIXCreateListener: Unlinking path [%s] for ciptr at [%p].\n", + sockname.sun_path, (void *) ciptr); +#endif + if (abstract) { + sockname.sun_path[0] = '\0'; + namelen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&sockname.sun_path[1]); + } + else + unlink (sockname.sun_path); + + if ((status = TRANS(SocketCreateListener) (ciptr, + (struct sockaddr *) &sockname, namelen, flags)) < 0) + { + prmsg (1, + "SocketUNIXCreateListener: ...SocketCreateListener() failed\n"); + (void) umask (oldUmask); + return status; + } + + /* + * Now that the listener is esablished, create the addr info for + * this connection. getpeername() doesn't work for UNIX Domain Sockets + * on some systems (hpux at least), so we will just do it manually, instead + * of calling something like TRANS(SocketUNIXGetAddr). + */ + + namelen = sizeof (sockname); /* this will always make it the same size */ + + if ((ciptr->addr = malloc (namelen)) == NULL) + { + prmsg (1, + "SocketUNIXCreateListener: Can't allocate space for the addr\n"); + (void) umask (oldUmask); + return TRANS_CREATE_LISTENER_FAILED; + } + + if (abstract) + sockname.sun_path[0] = '@'; + + ciptr->family = sockname.sun_family; + ciptr->addrlen = namelen; + memcpy (ciptr->addr, &sockname, ciptr->addrlen); + + (void) umask (oldUmask); + + return 0; +} + + +static int +TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr) + +{ + /* + * See if the unix domain socket has disappeared. If it has, recreate it. + */ + + struct sockaddr_un *unsock = (struct sockaddr_un *) ciptr->addr; + struct stat statb; + int status = TRANS_RESET_NOOP; + unsigned int mode; + int abstract = 0; +#ifdef HAVE_ABSTRACT_SOCKETS + abstract = ciptr->transptr->flags & TRANS_ABSTRACT; +#endif + + prmsg (3, "SocketUNIXResetListener(%p,%d)\n", (void *) ciptr, ciptr->fd); + + if (!abstract && ( + stat (unsock->sun_path, &statb) == -1 || + ((statb.st_mode & S_IFMT) != +#if defined(NCR) || defined(SCO325) || !defined(S_IFSOCK) + S_IFIFO +#else + S_IFSOCK +#endif + ))) + { + int oldUmask = umask (0); + +#ifdef UNIX_DIR +#ifdef HAS_STICKY_DIR_BIT + mode = 01777; +#else + mode = 0777; +#endif +#ifdef NX_TRANS_SOCKET + if (trans_mkdir(_NXGetUnixDir(UNIX_DIR), mode) == -1) { + prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n", + _NXGetUnixDir(UNIX_DIR), errno); +#else + if (trans_mkdir(UNIX_DIR, mode) == -1) { + prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n", + UNIX_DIR, errno); +#endif + (void) umask (oldUmask); + return TRANS_RESET_FAILURE; + } +#endif + + close (ciptr->fd); + unlink (unsock->sun_path); + + if ((ciptr->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) + { + TRANS(FreeConnInfo) (ciptr); + (void) umask (oldUmask); + return TRANS_RESET_FAILURE; + } + + if (bind (ciptr->fd, (struct sockaddr *) unsock, ciptr->addrlen) < 0) + { + close (ciptr->fd); + TRANS(FreeConnInfo) (ciptr); + return TRANS_RESET_FAILURE; + } + + if (listen (ciptr->fd, BACKLOG) < 0) + { + close (ciptr->fd); + TRANS(FreeConnInfo) (ciptr); + (void) umask (oldUmask); + return TRANS_RESET_FAILURE; + } + + umask (oldUmask); + + status = TRANS_RESET_NEW_FD; + } + + return status; +} + +#endif /* UNIXCONN */ + + +#ifdef TCPCONN + +static XtransConnInfo +TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) + +{ + XtransConnInfo newciptr; + struct sockaddr_in sockname; + SOCKLEN_T namelen = sizeof(sockname); + + prmsg (2, "SocketINETAccept(%p,%d)\n", (void *) ciptr, ciptr->fd); + + if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) + { + prmsg (1, "SocketINETAccept: malloc failed\n"); + *status = TRANS_ACCEPT_BAD_MALLOC; + return NULL; + } + + if ((newciptr->fd = accept (ciptr->fd, + (struct sockaddr *) &sockname, (void *)&namelen)) < 0) + { +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + prmsg (1, "SocketINETAccept: accept() failed\n"); + free (newciptr); + *status = TRANS_ACCEPT_FAILED; + return NULL; + } + +#ifdef TCP_NODELAY + { + /* + * turn off TCP coalescence for INET sockets + */ + + int tmp = 1; + setsockopt (newciptr->fd, IPPROTO_TCP, TCP_NODELAY, + (char *) &tmp, sizeof (int)); + } +#endif + + /* + * Get this address again because the transport may give a more + * specific address now that a connection is established. + */ + + if (TRANS(SocketINETGetAddr) (newciptr) < 0) + { + prmsg (1, + "SocketINETAccept: ...SocketINETGetAddr() failed:\n"); + close (newciptr->fd); + free (newciptr); + *status = TRANS_ACCEPT_MISC_ERROR; + return NULL; + } + + if (TRANS(SocketINETGetPeerAddr) (newciptr) < 0) + { + prmsg (1, + "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n"); + close (newciptr->fd); + if (newciptr->addr) free (newciptr->addr); + free (newciptr); + *status = TRANS_ACCEPT_MISC_ERROR; + return NULL; + } + + *status = 0; + + return newciptr; +} + +#endif /* TCPCONN */ + + +#ifdef UNIXCONN +static XtransConnInfo +TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) + +{ + XtransConnInfo newciptr; + struct sockaddr_un sockname; + SOCKLEN_T namelen = sizeof sockname; + + prmsg (2, "SocketUNIXAccept(%p,%d)\n", (void *) ciptr, ciptr->fd); + + if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) + { + prmsg (1, "SocketUNIXAccept: malloc() failed\n"); + *status = TRANS_ACCEPT_BAD_MALLOC; + return NULL; + } + + if ((newciptr->fd = accept (ciptr->fd, + (struct sockaddr *) &sockname, (void *)&namelen)) < 0) + { + prmsg (1, "SocketUNIXAccept: accept() failed\n"); + free (newciptr); + *status = TRANS_ACCEPT_FAILED; + return NULL; + } + + ciptr->addrlen = namelen; + /* + * Get the socket name and the peer name from the listener socket, + * since this is unix domain. + */ + + if ((newciptr->addr = malloc (ciptr->addrlen)) == NULL) + { + prmsg (1, + "SocketUNIXAccept: Can't allocate space for the addr\n"); + close (newciptr->fd); + free (newciptr); + *status = TRANS_ACCEPT_BAD_MALLOC; + return NULL; + } + + /* + * if the socket is abstract, we already modified the address to have a + * @ instead of the initial NUL, so no need to do that again here. + */ + + newciptr->addrlen = ciptr->addrlen; + memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen); + + if ((newciptr->peeraddr = malloc (ciptr->addrlen)) == NULL) + { + prmsg (1, + "SocketUNIXAccept: Can't allocate space for the addr\n"); + close (newciptr->fd); + if (newciptr->addr) free (newciptr->addr); + free (newciptr); + *status = TRANS_ACCEPT_BAD_MALLOC; + return NULL; + } + + newciptr->peeraddrlen = ciptr->addrlen; + memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen); + + newciptr->family = AF_UNIX; + + *status = 0; + + return newciptr; +} + +#endif /* UNIXCONN */ + +#endif /* TRANS_SERVER */ + + +#ifdef TRANS_CLIENT + +#ifdef TCPCONN + +#if defined(IPv6) && defined(AF_INET6) +struct addrlist { + struct addrinfo * addr; + struct addrinfo * firstaddr; + char port[PORTBUFSIZE]; + char host[MAXHOSTNAMELEN]; +}; +static struct addrlist *addrlist = NULL; +#endif + + +static int +TRANS(SocketINETConnect) (XtransConnInfo ciptr, + const char *host, const char *port) + +{ + struct sockaddr * socketaddr = NULL; + int socketaddrlen = 0; + int res; +#if defined(IPv6) && defined(AF_INET6) + struct addrinfo hints; + char ntopbuf[INET6_ADDRSTRLEN]; + int resetonce = 0; +#else + struct sockaddr_in sockname; + struct hostent *hostp; + struct servent *servp; + unsigned long tmpaddr; +#endif +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; + _Xgetservbynameparams sparams; +#endif +#ifdef X11_t + char portbuf[PORTBUFSIZE]; +#endif + + char hostnamebuf[256]; /* tmp space */ + + prmsg (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port); + + if (!host) + { + hostnamebuf[0] = '\0'; + (void) TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); + host = hostnamebuf; + } + +#ifdef X11_t + /* + * X has a well known port, that is transport dependent. It is easier + * to handle it here, than try and come up with a transport independent + * representation that can be passed in and resolved the usual way. + * + * The port that is passed here is really a string containing the idisplay + * from ConnectDisplay(). + */ + + if (is_numeric (port)) + { + long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); + snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); + port = portbuf; + } +#endif + +#if defined(IPv6) && defined(AF_INET6) + { + if (addrlist != NULL) { + if (strcmp(host,addrlist->host) || strcmp(port,addrlist->port)) { + if (addrlist->firstaddr) + freeaddrinfo(addrlist->firstaddr); + addrlist->firstaddr = NULL; + } + } else { + addrlist = malloc(sizeof(struct addrlist)); + addrlist->firstaddr = NULL; + } + + if (addrlist->firstaddr == NULL) { + strncpy(addrlist->port, port, sizeof(addrlist->port)); + addrlist->port[sizeof(addrlist->port) - 1] = '\0'; + strncpy(addrlist->host, host, sizeof(addrlist->host)); + addrlist->host[sizeof(addrlist->host) - 1] = '\0'; + + bzero(&hints,sizeof(hints)); + hints.ai_socktype = Sockettrans2devtab[ciptr->index].devcotsname; + + res = getaddrinfo(host,port,&hints,&addrlist->firstaddr); + if (res != 0) { + prmsg (1, "SocketINETConnect() can't get address " + "for %s:%s: %s\n", host, port, gai_strerror(res)); + ESET(EINVAL); + return TRANS_CONNECT_FAILED; + } + for (res = 0, addrlist->addr = addrlist->firstaddr; + addrlist->addr ; res++) { + addrlist->addr = addrlist->addr->ai_next; + } + prmsg(4,"Got New Address list with %d addresses\n", res); + res = 0; + addrlist->addr = NULL; + } + + while (socketaddr == NULL) { + if (addrlist->addr == NULL) { + if (resetonce) { + /* Already checked entire list - no usable addresses */ + prmsg (1, "SocketINETConnect() no usable address " + "for %s:%s\n", host, port); + return TRANS_CONNECT_FAILED; + } else { + /* Go back to beginning of list */ + resetonce = 1; + addrlist->addr = addrlist->firstaddr; + } + } + + socketaddr = addrlist->addr->ai_addr; + socketaddrlen = addrlist->addr->ai_addrlen; + + if (addrlist->addr->ai_family == AF_INET) { + struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr; + + prmsg (4,"SocketINETConnect() sockname.sin_addr = %s\n", + inet_ntop(addrlist->addr->ai_family,&sin->sin_addr, + ntopbuf,sizeof(ntopbuf))); + + prmsg (4,"SocketINETConnect() sockname.sin_port = %d\n", + ntohs(sin->sin_port)); + + if (Sockettrans2devtab[ciptr->index].family == AF_INET6) { + if (strcmp(Sockettrans2devtab[ciptr->index].transname, + "tcp") == 0) { + XtransConnInfo newciptr; + + /* + * Our socket is an IPv6 socket, but the address is + * IPv4. Close it and get an IPv4 socket. This is + * needed for IPv4 connections to work on platforms + * that don't allow IPv4 over IPv6 sockets. + */ + TRANS(SocketINETClose)(ciptr); + newciptr = TRANS(SocketOpenCOTSClientBase)( + "tcp", "tcp", host, port, ciptr->index); + if (newciptr) + ciptr->fd = newciptr->fd; + if (!newciptr || + Sockettrans2devtab[newciptr->index].family != + AF_INET) { + socketaddr = NULL; + prmsg (4,"SocketINETConnect() Cannot get IPv4 " + " socketfor IPv4 address\n"); + } + if (newciptr) + free(newciptr); + } else { + socketaddr = NULL; + prmsg (4,"SocketINETConnect Skipping IPv4 address\n"); + } + } + } else if (addrlist->addr->ai_family == AF_INET6) { + struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr; + + prmsg (4,"SocketINETConnect() sockname.sin6_addr = %s\n", + inet_ntop(addrlist->addr->ai_family, + &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf))); + prmsg (4,"SocketINETConnect() sockname.sin6_port = %d\n", + ntohs(sin6->sin6_port)); + + if (Sockettrans2devtab[ciptr->index].family == AF_INET) { + if (strcmp(Sockettrans2devtab[ciptr->index].transname, + "tcp") == 0) { + XtransConnInfo newciptr; + + /* + * Close the IPv4 socket and try to open an IPv6 socket. + */ + TRANS(SocketINETClose)(ciptr); + newciptr = TRANS(SocketOpenCOTSClientBase)( + "tcp", "tcp", host, port, -1); + if (newciptr) + ciptr->fd = newciptr->fd; + if (!newciptr || + Sockettrans2devtab[newciptr->index].family != + AF_INET6) { + socketaddr = NULL; + prmsg (4,"SocketINETConnect() Cannot get IPv6 " + "socket for IPv6 address\n"); + } + if (newciptr) + free(newciptr); + } + else + { + socketaddr = NULL; + prmsg (4,"SocketINETConnect() Skipping IPv6 address\n"); + } + } + } else { + socketaddr = NULL; /* Unsupported address type */ + } + if (socketaddr == NULL) { + addrlist->addr = addrlist->addr->ai_next; + } + } + } +#else + { + /* + * Build the socket name. + */ + +#ifdef BSD44SOCKETS + sockname.sin_len = sizeof (struct sockaddr_in); +#endif + sockname.sin_family = AF_INET; + + /* + * fill in sin_addr + */ + +#ifndef INADDR_NONE +#define INADDR_NONE ((in_addr_t) 0xffffffff) +#endif + + /* check for ww.xx.yy.zz host string */ + + if (isascii (host[0]) && isdigit (host[0])) { + tmpaddr = inet_addr (host); /* returns network byte order */ + } else { + tmpaddr = INADDR_NONE; + } + + prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr); + + if (tmpaddr == INADDR_NONE) { + if ((hostp = _XGethostbyname(host,hparams)) == NULL) { + prmsg (1,"SocketINETConnect: Can't get address for %s\n", + host); + ESET(EINVAL); + return TRANS_CONNECT_FAILED; + } + if (hostp->h_addrtype != AF_INET) { /* is IP host? */ + prmsg (1,"SocketINETConnect: not INET host%s\n", host); + ESET(EPROTOTYPE); + return TRANS_CONNECT_FAILED; + } + + memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr, + sizeof (sockname.sin_addr)); + + } else { + sockname.sin_addr.s_addr = tmpaddr; + } + + /* + * fill in sin_port + */ + + /* Check for number in the port string */ + + if (!is_numeric (port)) { + if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) { + prmsg (1,"SocketINETConnect: can't get service for %s\n", + port); + return TRANS_CONNECT_FAILED; + } + sockname.sin_port = htons (servp->s_port); + } else { + long tmpport = strtol (port, (char**)NULL, 10); + if (tmpport < 1024 || tmpport > USHRT_MAX) + return TRANS_CONNECT_FAILED; + sockname.sin_port = htons (((unsigned short) tmpport)); + } + + prmsg (4,"SocketINETConnect: sockname.sin_port = %d\n", + ntohs(sockname.sin_port)); + socketaddr = (struct sockaddr *) &sockname; + socketaddrlen = sizeof(sockname); + } +#endif + + /* + * Turn on socket keepalive so the client process will eventually + * be notified with a SIGPIPE signal if the display server fails + * to respond to a periodic transmission of messages + * on the connected socket. + * This is useful to avoid hung application processes when the + * processes are not spawned from the xdm session and + * the display server terminates abnormally. + * (Someone turned off the power switch.) + */ + + { + int tmp = 1; + setsockopt (ciptr->fd, SOL_SOCKET, SO_KEEPALIVE, + (char *) &tmp, sizeof (int)); + } + + /* + * Do the connect() + */ + + if (connect (ciptr->fd, socketaddr, socketaddrlen ) < 0) + { +#ifdef WIN32 + int olderrno = WSAGetLastError(); +#else + int olderrno = errno; +#endif + + /* + * If the error was ECONNREFUSED, the server may be overloaded + * and we should try again. + * + * If the error was EWOULDBLOCK or EINPROGRESS then the socket + * was non-blocking and we should poll using select + * + * If the error was EINTR, the connect was interrupted and we + * should try again. + * + * If multiple addresses are found for a host then we should + * try to connect again with a different address for a larger + * number of errors that made us quit before, since those + * could be caused by trying to use an IPv6 address to contact + * a machine with an IPv4-only server or other reasons that + * only affect one of a set of addresses. + */ + + if (olderrno == ECONNREFUSED || olderrno == EINTR +#if defined(IPv6) && defined(AF_INET6) + || (((addrlist->addr->ai_next != NULL) || + (addrlist->addr != addrlist->firstaddr)) && + (olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT || + olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT +#if defined(EHOSTDOWN) + || olderrno == EHOSTDOWN +#endif + )) +#endif + ) + res = TRANS_TRY_CONNECT_AGAIN; + else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) + res = TRANS_IN_PROGRESS; + else + { + prmsg (2,"SocketINETConnect: Can't connect: errno = %d\n", + olderrno); + + res = TRANS_CONNECT_FAILED; + } + } else { + res = 0; + + + /* + * Sync up the address fields of ciptr. + */ + + if (TRANS(SocketINETGetAddr) (ciptr) < 0) + { + prmsg (1, + "SocketINETConnect: ...SocketINETGetAddr() failed:\n"); + res = TRANS_CONNECT_FAILED; + } + + else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0) + { + prmsg (1, + "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n"); + res = TRANS_CONNECT_FAILED; + } + } + +#if defined(IPv6) && defined(AF_INET6) + if (res != 0) { + addrlist->addr = addrlist->addr->ai_next; + } +#endif + + return res; +} + +#endif /* TCPCONN */ + + + +#ifdef UNIXCONN + +/* + * Make sure 'host' is really local. + */ + +static int +UnixHostReallyLocal (const char *host) + +{ + char hostnamebuf[256]; + + TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); + + if (strcmp (hostnamebuf, host) == 0) + { + return (1); + } else { +#if defined(IPv6) && defined(AF_INET6) + struct addrinfo *localhostaddr; + struct addrinfo *otherhostaddr; + struct addrinfo *i, *j; + int equiv = 0; + + if (getaddrinfo(hostnamebuf, NULL, NULL, &localhostaddr) != 0) + return 0; + if (getaddrinfo(host, NULL, NULL, &otherhostaddr) != 0) { + freeaddrinfo(localhostaddr); + return 0; + } + + for (i = localhostaddr; i != NULL && equiv == 0; i = i->ai_next) { + for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) { + if (i->ai_family == j->ai_family) { + if (i->ai_family == AF_INET) { + struct sockaddr_in *sinA + = (struct sockaddr_in *) i->ai_addr; + struct sockaddr_in *sinB + = (struct sockaddr_in *) j->ai_addr; + struct in_addr *A = &sinA->sin_addr; + struct in_addr *B = &sinB->sin_addr; + + if (memcmp(A,B,sizeof(struct in_addr)) == 0) { + equiv = 1; + } + } else if (i->ai_family == AF_INET6) { + struct sockaddr_in6 *sinA + = (struct sockaddr_in6 *) i->ai_addr; + struct sockaddr_in6 *sinB + = (struct sockaddr_in6 *) j->ai_addr; + struct in6_addr *A = &sinA->sin6_addr; + struct in6_addr *B = &sinB->sin6_addr; + + if (memcmp(A,B,sizeof(struct in6_addr)) == 0) { + equiv = 1; + } + } + } + } + } + + freeaddrinfo(localhostaddr); + freeaddrinfo(otherhostaddr); + return equiv; +#else + /* + * A host may have more than one network address. If any of the + * network addresses of 'host' (specified to the connect call) + * match any of the network addresses of 'hostname' (determined + * by TRANS(GetHostname)), then the two hostnames are equivalent, + * and we know that 'host' is really a local host. + */ + char specified_local_addr_list[10][4]; + int scount, equiv, i, j; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + struct hostent *hostp; + + if ((hostp = _XGethostbyname (host,hparams)) == NULL) + return (0); + + scount = 0; + while (hostp->h_addr_list[scount] && scount <= 8) + { + /* + * The 2nd call to gethostname() overrides the data + * from the 1st call, so we must save the address list. + */ + + specified_local_addr_list[scount][0] = + hostp->h_addr_list[scount][0]; + specified_local_addr_list[scount][1] = + hostp->h_addr_list[scount][1]; + specified_local_addr_list[scount][2] = + hostp->h_addr_list[scount][2]; + specified_local_addr_list[scount][3] = + hostp->h_addr_list[scount][3]; + scount++; + } + if ((hostp = _XGethostbyname (hostnamebuf,hparams)) == NULL) + return (0); + + equiv = 0; + i = 0; + + while (i < scount && !equiv) + { + j = 0; + + while (hostp->h_addr_list[j]) + { + if ((specified_local_addr_list[i][0] == + hostp->h_addr_list[j][0]) && + (specified_local_addr_list[i][1] == + hostp->h_addr_list[j][1]) && + (specified_local_addr_list[i][2] == + hostp->h_addr_list[j][2]) && + (specified_local_addr_list[i][3] == + hostp->h_addr_list[j][3])) + { + /* They're equal, so we're done */ + + equiv = 1; + break; + } + + j++; + } + + i++; + } + return (equiv); +#endif + } +} + +static int +TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, + const char *host, const char *port) + +{ + struct sockaddr_un sockname; + SOCKLEN_T namelen; + + + int abstract = 0; +#ifdef HAVE_ABSTRACT_SOCKETS + abstract = ciptr->transptr->flags & TRANS_ABSTRACT; +#endif + + prmsg (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port); + + /* + * Make sure 'host' is really local. If not, we return failure. + * The reason we make this check is because a process may advertise + * a "local" network ID for which it can accept connections, but if + * a process on a remote machine tries to connect to this network ID, + * we know for sure it will fail. + */ + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + if (host && *host && host[0]!='/' && strcmp(host, "unix") != 0 && strcasecmp(host, "nx") != 0 && + strncasecmp(host, "nx,", 3) != 0 && !UnixHostReallyLocal (host)) +#else + if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host)) +#endif + { + prmsg (1, + "SocketUNIXConnect: Cannot connect to non-local host %s\n", + host); + return TRANS_CONNECT_FAILED; + } + + + /* + * Check the port. + */ + + if (!port || !*port) + { + prmsg (1,"SocketUNIXConnect: Missing port specification\n"); + return TRANS_CONNECT_FAILED; + } + + /* + * Build the socket name. + */ + + sockname.sun_family = AF_UNIX; + +#ifdef NX_TRANS_SOCKET + if (set_sun_path(port, _NXGetUnixPath(UNIX_PATH), sockname.sun_path, abstract) != 0) { +#else + if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { +#endif + prmsg (1, "SocketUNIXConnect: path too long\n"); + return TRANS_CONNECT_FAILED; + } + +#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) + sockname.sun_len = strlen (sockname.sun_path); +#endif + +#if defined(BSD44SOCKETS) || defined(SUN_LEN) + namelen = SUN_LEN (&sockname); +#else + namelen = strlen (sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); +#endif + + + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + if (ciptr->priv != NULL) + { + if (TRANS(SocketConnectConnInfo) (ciptr, host, port) != 0) + { + return TRANS_CONNECT_FAILED; + } + + goto SocketUNIXConnectPost; + } + +#endif + + /* + * Adjust the socket path if using abstract sockets. + * Done here because otherwise all the strlen() calls above would fail. + */ + + if (abstract) { + sockname.sun_path[0] = '\0'; + } + + /* + * Do the connect() + */ + + if (connect (ciptr->fd, (struct sockaddr *) &sockname, namelen) < 0) + { + int olderrno = errno; + int connected = 0; + + if (!connected) + { + errno = olderrno; + + /* + * If the error was ENOENT, the server may be starting up; we used + * to suggest to try again in this case with + * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for + * processes still referencing stale sockets in their environment. + * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it + * is suggested that higher level stacks handle retries on their + * level when they face a slow starting server. + * + * If the error was EWOULDBLOCK or EINPROGRESS then the socket + * was non-blocking and we should poll using select + * + * If the error was EINTR, the connect was interrupted and we + * should try again. + */ + + if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) + return TRANS_IN_PROGRESS; + else if (olderrno == EINTR) + return TRANS_TRY_CONNECT_AGAIN; + else if (olderrno == ENOENT || olderrno == ECONNREFUSED) { + /* If opening as abstract socket failed, try again normally */ + if (abstract) { + ciptr->transptr->flags &= ~(TRANS_ABSTRACT); + return TRANS_TRY_CONNECT_AGAIN; + } else { + return TRANS_CONNECT_FAILED; + } + } else { + prmsg (2,"SocketUNIXConnect: Can't connect: errno = %d\n", + EGET()); + + return TRANS_CONNECT_FAILED; + } + } + } + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + +SocketUNIXConnectPost: + +#endif + + /* + * Get the socket name and the peer name from the connect socket, + * since this is unix domain. + */ + + if ((ciptr->addr = malloc(namelen)) == NULL || + (ciptr->peeraddr = malloc(namelen)) == NULL) + { + prmsg (1, + "SocketUNIXCreateListener: Can't allocate space for the addr\n"); + return TRANS_CONNECT_FAILED; + } + + if (abstract) + sockname.sun_path[0] = '@'; + + ciptr->family = AF_UNIX; + ciptr->addrlen = namelen; + ciptr->peeraddrlen = namelen; + memcpy (ciptr->addr, &sockname, ciptr->addrlen); + memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); + + return 0; +} + +#endif /* UNIXCONN */ + +#endif /* TRANS_CLIENT */ + + +static int +TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) + +{ + prmsg (2,"SocketBytesReadable(%p,%d,%p)\n", + (void *) ciptr, ciptr->fd, (void *) pend); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + if (ciptr->priv) + { + if (NXTransRunning(ciptr->fd) == 0) + { + /* + * Force the application to shut down the + * socket if the NX transport is gone. We + * may probably save this additional call. + */ + +#ifdef NX_TRANS_DEBUG + fprintf(stderr, "SocketBytesReadable: NX transport not running for descriptor [%d].\n", + ciptr->fd); +#endif + ESET(EPIPE); + + return -1; + } + else + { + /* + * Emulate BytesReadable. Some X applications may use the system + * select() in their main loop, instead of the _XSelect() that is + * replaced by NX. Still these applications use _XEventsQueued to + * poll events from the X connection, and _XEventsQueued uses the + * NX _XSelect(), so it is generally possible to let the client + * yield the control to NX and let it handle the I/O on the proxy + * descriptors even if the application is not explicitly designed + * to work as a NX agent. + */ + +#ifdef NX_TRANS_DEBUG + + int result; + + result = NXTransReadable(ciptr->fd, (int *) pend); + + fprintf(stderr, "SocketBytesReadable: Descriptor [%d] result [%d] readable [%ld].\n", + ciptr->fd, result, *pend); + + return result; +#else + return NXTransReadable(ciptr->fd, (int *) pend); +#endif + } + } + +#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ + +#ifdef WIN32 + { + int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); + return ret; + } +#else + return ioctl (ciptr->fd, FIONREAD, (char *) pend); +#endif /* WIN32 */ +} + +#if XTRANS_SEND_FDS + +static void +appendFd(struct _XtransConnFd **prev, int fd, int do_close) +{ + struct _XtransConnFd *cf, *new; + + new = malloc (sizeof (struct _XtransConnFd)); + if (!new) { + /* XXX mark connection as broken */ + close(fd); + return; + } + new->next = 0; + new->fd = fd; + new->do_close = do_close; + /* search to end of list */ + for (; (cf = *prev); prev = &(cf->next)); + *prev = new; +} + +static int +removeFd(struct _XtransConnFd **prev) +{ + struct _XtransConnFd *cf; + int fd; + + if ((cf = *prev)) { + *prev = cf->next; + fd = cf->fd; + free(cf); + } else + fd = -1; + return fd; +} + +static void +discardFd(struct _XtransConnFd **prev, struct _XtransConnFd *upto, int do_close) +{ + struct _XtransConnFd *cf, *next; + + for (cf = *prev; cf != upto; cf = next) { + next = cf->next; + if (do_close || cf->do_close) + close(cf->fd); + free(cf); + } + *prev = upto; +} + +static void +cleanupFds(XtransConnInfo ciptr) +{ + /* Clean up the send list but don't close the fds */ + discardFd(&ciptr->send_fds, NULL, 0); + /* Clean up the recv list and *do* close the fds */ + discardFd(&ciptr->recv_fds, NULL, 1); +} + +static int +nFd(struct _XtransConnFd **prev) +{ + struct _XtransConnFd *cf; + int n = 0; + + for (cf = *prev; cf; cf = cf->next) + n++; + return n; +} + +static int +TRANS(SocketRecvFd) (XtransConnInfo ciptr) +{ + prmsg (2, "SocketRecvFd(%d)\n", ciptr->fd); + return removeFd(&ciptr->recv_fds); +} + +static int +TRANS(SocketSendFd) (XtransConnInfo ciptr, int fd, int do_close) +{ + appendFd(&ciptr->send_fds, fd, do_close); + return 0; +} + +static int +TRANS(SocketRecvFdInvalid)(XtransConnInfo ciptr) +{ + errno = EINVAL; + return -1; +} + +static int +TRANS(SocketSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) +{ + errno = EINVAL; + return -1; +} + +#define MAX_FDS 128 + +union fd_pass { + struct cmsghdr cmsghdr; + char buf[CMSG_SPACE(MAX_FDS * sizeof(int))]; +}; + +#endif /* XTRANS_SEND_FDS */ + +static int +TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size) + +{ + prmsg (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + /* + * If we have a valid priv pointer then this + * is an internal connection to the proxy. + * In this case we should emulate the read. + */ + + if (ciptr->priv) + { + int result; + + result = NXTransRead(ciptr->fd, buf, size); + +#ifdef NX_TRANS_DEBUG + if (result < 0 && EGET() == EAGAIN) + { + fprintf(stderr, "SocketRead: Read from descriptor [%d] would block.\n", + ciptr->fd); + } + else + { + fprintf(stderr, "SocketRead: Read [%d] bytes from descriptor [%d].\n", + result, ciptr->fd); + } +#endif + return result; + } + else + { + /* FIXME: same code as below, should be possible without duplication */ +#if XTRANS_SEND_FDS + struct iovec iov = { + .iov_base = buf, + .iov_len = size + }; + union fd_pass cmsgbuf; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) + }; + + size = recvmsg(ciptr->fd, &msg, 0); + if (size >= 0) { + struct cmsghdr *hdr; + + for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { + if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { + int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); + int i; + int *fd = (int *) CMSG_DATA(hdr); + + for (i = 0; i < nfd; i++) + appendFd(&ciptr->recv_fds, fd[i], 0); + } + } + } + return size; +#else + return read (ciptr->fd, buf, size); +#endif /* XTRANS_SEND_FDS */ + } + +#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ + +#if defined(WIN32) + { + int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); +#ifdef WIN32 + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); +#endif + return ret; + } +#else +#if XTRANS_SEND_FDS + { + struct iovec iov = { + .iov_base = buf, + .iov_len = size + }; + union fd_pass cmsgbuf; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = &iov, + .msg_iovlen = 1, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) + }; + + size = recvmsg(ciptr->fd, &msg, 0); + if (size >= 0) { + struct cmsghdr *hdr; + + for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { + if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { + int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); + int i; + int *fd = (int *) CMSG_DATA(hdr); + + for (i = 0; i < nfd; i++) + appendFd(&ciptr->recv_fds, fd[i], 0); + } + } + } + return size; + } +#else + return read (ciptr->fd, buf, size); +#endif /* XTRANS_SEND_FDS */ +#endif /* WIN32 */ + +#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ +} + +static int +TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size) + +{ + prmsg (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + /* + * If we have a valid priv pointer then this + * is an internal connection to the proxy. + * In this case we should emulate the readv. + */ + + if (ciptr->priv) + { + return NXTransReadVector(ciptr->fd, buf, size); + } + else + { + /* FIXME: same code as below, should be possible without duplication */ +#if XTRANS_SEND_FDS + union fd_pass cmsgbuf; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = buf, + .msg_iovlen = size, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) + }; + + size = recvmsg(ciptr->fd, &msg, 0); + if (size >= 0) { + struct cmsghdr *hdr; + + for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { + if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { + int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); + int i; + int *fd = (int *) CMSG_DATA(hdr); + + for (i = 0; i < nfd; i++) + appendFd(&ciptr->recv_fds, fd[i], 0); + } + } + } + return size; +#else + return READV (ciptr, buf, size); +#endif + } + +#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ + +#if XTRANS_SEND_FDS + { + union fd_pass cmsgbuf; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = buf, + .msg_iovlen = size, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) + }; + + size = recvmsg(ciptr->fd, &msg, 0); + if (size >= 0) { + struct cmsghdr *hdr; + + for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { + if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { + int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); + int i; + int *fd = (int *) CMSG_DATA(hdr); + + for (i = 0; i < nfd; i++) + appendFd(&ciptr->recv_fds, fd[i], 0); + } + } + } + return size; + } +#else + return READV (ciptr, buf, size); +#endif + +#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ +} + + +static int +TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size) + +{ + prmsg (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + /* + * If we have a valid priv pointer then this + * is an internal connection to the proxy. + * In this case we should emulate the writev. + */ + + if (ciptr->priv) + { + return NXTransWriteVector(ciptr->fd, buf, size); + } + else + { + /* FIXME: same code as below, should be possible without duplication */ +#if XTRANS_SEND_FDS + if (ciptr->send_fds) + { + union fd_pass cmsgbuf; + int nfd = nFd(&ciptr->send_fds); + struct _XtransConnFd *cf = ciptr->send_fds; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = buf, + .msg_iovlen = size, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(nfd * sizeof(int)) + }; + struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); + int i; + int *fds; + + hdr->cmsg_len = msg.msg_controllen; + hdr->cmsg_level = SOL_SOCKET; + hdr->cmsg_type = SCM_RIGHTS; + + fds = (int *) CMSG_DATA(hdr); + /* Set up fds */ + for (i = 0; i < nfd; i++) { + fds[i] = cf->fd; + cf = cf->next; + } + + i = sendmsg(ciptr->fd, &msg, 0); + if (i > 0) + discardFd(&ciptr->send_fds, cf, 0); + return i; + } +#endif + return WRITEV (ciptr, buf, size); + } + +#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ + +#if XTRANS_SEND_FDS + if (ciptr->send_fds) + { + union fd_pass cmsgbuf; + int nfd = nFd(&ciptr->send_fds); + struct _XtransConnFd *cf = ciptr->send_fds; + struct msghdr msg = { + .msg_name = NULL, + .msg_namelen = 0, + .msg_iov = buf, + .msg_iovlen = size, + .msg_control = cmsgbuf.buf, + .msg_controllen = CMSG_LEN(nfd * sizeof(int)) + }; + struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); + int i; + int *fds; + + hdr->cmsg_len = msg.msg_controllen; + hdr->cmsg_level = SOL_SOCKET; + hdr->cmsg_type = SCM_RIGHTS; + + fds = (int *) CMSG_DATA(hdr); + /* Set up fds */ + for (i = 0; i < nfd; i++) { + fds[i] = cf->fd; + cf = cf->next; + } + + i = sendmsg(ciptr->fd, &msg, 0); + if (i > 0) + discardFd(&ciptr->send_fds, cf, 0); + return i; + } +#endif + return WRITEV (ciptr, buf, size); + +#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ +} + + +static int +TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size) + +{ + prmsg (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + /* + * If we have a valid priv pointer then this + * is an internal connection to the proxy. + * In this case we should emulate the write. + */ + + if (ciptr->priv) + { + int result; + + result = NXTransWrite(ciptr->fd, buf, size); + +#ifdef NX_TRANS_DEBUG + if (result < 0 && EGET() == EAGAIN) + { + fprintf(stderr, "SocketWrite: Write on descriptor [%d] would block.\n", + ciptr->fd); + } + else + { + fprintf(stderr, "SocketWrite: Written [%d] bytes on descriptor [%d].\n", + result, ciptr->fd); + } +#endif + return result; + } + else + { + /* FIXME: same code as below, should be possible without duplication */ +#if XTRANS_SEND_FDS + if (ciptr->send_fds) + { + struct iovec iov; + + iov.iov_base = buf; + iov.iov_len = size; + return TRANS(SocketWritev)(ciptr, &iov, 1); + } +#endif /* XTRANS_SEND_FDS */ + return write (ciptr->fd, buf, size); + } + +#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ + +#if defined(WIN32) + { + int ret = send ((SOCKET)ciptr->fd, buf, size, 0); +#ifdef WIN32 + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); +#endif + return ret; + } +#else +#if XTRANS_SEND_FDS + if (ciptr->send_fds) + { + struct iovec iov; + + iov.iov_base = buf; + iov.iov_len = size; + return TRANS(SocketWritev)(ciptr, &iov, 1); + } +#endif /* XTRANS_SEND_FDS */ + return write (ciptr->fd, buf, size); +#endif /* WIN32 */ + +#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ +} + +static int +TRANS(SocketDisconnect) (XtransConnInfo ciptr) + +{ + prmsg (2,"SocketDisconnect(%p,%d)\n", (void *) ciptr, ciptr->fd); + +#ifdef WIN32 + { + int ret = shutdown (ciptr->fd, 2); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); + return ret; + } +#else + return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ +#endif +} + + +#ifdef TCPCONN +static int +TRANS(SocketINETClose) (XtransConnInfo ciptr) + +{ + prmsg (2,"SocketINETClose(%p,%d)\n", (void *) ciptr, ciptr->fd); + +#ifdef WIN32 + { + int ret = close (ciptr->fd); + if (ret == SOCKET_ERROR) errno = WSAGetLastError(); + return ret; + } +#else + return close (ciptr->fd); +#endif +} + +#endif /* TCPCONN */ + + +#ifdef UNIXCONN +static int +TRANS(SocketUNIXClose) (XtransConnInfo ciptr) +{ + /* + * If this is the server side, then once the socket is closed, + * it must be unlinked to completely close it + */ + + struct sockaddr_un *sockname = (struct sockaddr_un *) ciptr->addr; + int ret; + + prmsg (2,"SocketUNIXClose(%p,%d)\n", (void *) ciptr, ciptr->fd); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + if (ciptr->priv) + { + TRANS(SocketCloseConnInfo) (ciptr); + } + +#endif + +#if XTRANS_SEND_FDS + cleanupFds(ciptr); +#endif + ret = close(ciptr->fd); + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "SocketUNIXClose: Flags are [%d] for ciptr at [%p] check is [%d].\n", + ciptr->flags, (void *) ciptr, (ciptr->flags && sockname + && sockname->sun_family == AF_UNIX && sockname->sun_path[0])); +#endif + + if (ciptr->flags + && sockname + && sockname->sun_family == AF_UNIX + && sockname->sun_path[0]) + { +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + if (!(ciptr->flags & TRANS_NOUNLINK + || ciptr->transptr->flags & TRANS_ABSTRACT)) + { + fprintf(stderr, "SocketUNIXClose: Unlinking path [%s] for ciptr at [%p].\n", + sockname->sun_path, (void *) ciptr); + unlink (sockname->sun_path); + } +#else + if (!(ciptr->flags & TRANS_NOUNLINK + || ciptr->transptr->flags & TRANS_ABSTRACT)) + unlink (sockname->sun_path); +#endif + } + + return ret; +} + +static int +TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr) + +{ + /* + * Don't unlink path. + */ + + int ret; + + prmsg (2,"SocketUNIXCloseForCloning(%p,%d)\n", + (void *) ciptr, ciptr->fd); + +#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) + + if (ciptr->priv) + { + TRANS(SocketCloseConnInfo) (ciptr); + } + +#endif + +#if XTRANS_SEND_FDS + cleanupFds(ciptr); +#endif + ret = close(ciptr->fd); + + return ret; +} + +#endif /* UNIXCONN */ + + +#ifdef TCPCONN +# ifdef TRANS_SERVER +static const char* tcp_nolisten[] = { + "inet", +#if defined(IPv6) && defined(AF_INET6) + "inet6", +#endif + NULL +}; +# endif + +Xtransport TRANS(SocketTCPFuncs) = { + /* Socket Interface */ + "tcp", + TRANS_ALIAS, +#ifdef TRANS_CLIENT + TRANS(SocketOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + tcp_nolisten, + TRANS(SocketOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(SocketReopenCOTSServer), +#endif + TRANS(SocketSetOption), +#ifdef TRANS_SERVER + TRANS(SocketINETCreateListener), + NULL, /* ResetListener */ + TRANS(SocketINETAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(SocketINETConnect), +#endif /* TRANS_CLIENT */ + TRANS(SocketBytesReadable), + TRANS(SocketRead), + TRANS(SocketWrite), + TRANS(SocketReadv), + TRANS(SocketWritev), +#if XTRANS_SEND_FDS + TRANS(SocketSendFdInvalid), + TRANS(SocketRecvFdInvalid), +#endif + TRANS(SocketDisconnect), + TRANS(SocketINETClose), + TRANS(SocketINETClose), + }; + +Xtransport TRANS(SocketINETFuncs) = { + /* Socket Interface */ + "inet", + 0, +#ifdef TRANS_CLIENT + TRANS(SocketOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(SocketOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(SocketReopenCOTSServer), +#endif + TRANS(SocketSetOption), +#ifdef TRANS_SERVER + TRANS(SocketINETCreateListener), + NULL, /* ResetListener */ + TRANS(SocketINETAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(SocketINETConnect), +#endif /* TRANS_CLIENT */ + TRANS(SocketBytesReadable), + TRANS(SocketRead), + TRANS(SocketWrite), + TRANS(SocketReadv), + TRANS(SocketWritev), +#if XTRANS_SEND_FDS + TRANS(SocketSendFdInvalid), + TRANS(SocketRecvFdInvalid), +#endif + TRANS(SocketDisconnect), + TRANS(SocketINETClose), + TRANS(SocketINETClose), + }; + +#if defined(IPv6) && defined(AF_INET6) +Xtransport TRANS(SocketINET6Funcs) = { + /* Socket Interface */ + "inet6", + 0, +#ifdef TRANS_CLIENT + TRANS(SocketOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(SocketOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(SocketReopenCOTSServer), +#endif + TRANS(SocketSetOption), +#ifdef TRANS_SERVER + TRANS(SocketINETCreateListener), + NULL, /* ResetListener */ + TRANS(SocketINETAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(SocketINETConnect), +#endif /* TRANS_CLIENT */ + TRANS(SocketBytesReadable), + TRANS(SocketRead), + TRANS(SocketWrite), + TRANS(SocketReadv), + TRANS(SocketWritev), +#if XTRANS_SEND_FDS + TRANS(SocketSendFdInvalid), + TRANS(SocketRecvFdInvalid), +#endif + TRANS(SocketDisconnect), + TRANS(SocketINETClose), + TRANS(SocketINETClose), + }; +#endif /* IPv6 */ +#endif /* TCPCONN */ + +#ifdef UNIXCONN +#if !defined(LOCALCONN) +Xtransport TRANS(SocketLocalFuncs) = { + /* Socket Interface */ + "local", +#ifdef HAVE_ABSTRACT_SOCKETS + TRANS_ABSTRACT, +#else + 0, +#endif +#ifdef TRANS_CLIENT + TRANS(SocketOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER + NULL, + TRANS(SocketOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(SocketReopenCOTSServer), +#endif + TRANS(SocketSetOption), +#ifdef TRANS_SERVER + TRANS(SocketUNIXCreateListener), + TRANS(SocketUNIXResetListener), + TRANS(SocketUNIXAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(SocketUNIXConnect), +#endif /* TRANS_CLIENT */ + TRANS(SocketBytesReadable), + TRANS(SocketRead), + TRANS(SocketWrite), + TRANS(SocketReadv), + TRANS(SocketWritev), +#if XTRANS_SEND_FDS + TRANS(SocketSendFd), + TRANS(SocketRecvFd), +#endif + TRANS(SocketDisconnect), + TRANS(SocketUNIXClose), + TRANS(SocketUNIXCloseForCloning), + }; +#endif /* !LOCALCONN */ +# ifdef TRANS_SERVER +# if !defined(LOCALCONN) +static const char* unix_nolisten[] = { "local" , NULL }; +# endif +# endif + +Xtransport TRANS(SocketUNIXFuncs) = { + /* Socket Interface */ + "unix", +#if !defined(LOCALCONN) && !defined(HAVE_ABSTRACT_SOCKETS) + TRANS_ALIAS, +#else + 0, +#endif +#ifdef TRANS_CLIENT + TRANS(SocketOpenCOTSClient), +#endif /* TRANS_CLIENT */ +#ifdef TRANS_SERVER +#if !defined(LOCALCONN) + unix_nolisten, +#else + NULL, +#endif + TRANS(SocketOpenCOTSServer), +#endif /* TRANS_SERVER */ +#ifdef TRANS_REOPEN + TRANS(SocketReopenCOTSServer), +#endif + TRANS(SocketSetOption), +#ifdef TRANS_SERVER + TRANS(SocketUNIXCreateListener), + TRANS(SocketUNIXResetListener), + TRANS(SocketUNIXAccept), +#endif /* TRANS_SERVER */ +#ifdef TRANS_CLIENT + TRANS(SocketUNIXConnect), +#endif /* TRANS_CLIENT */ + TRANS(SocketBytesReadable), + TRANS(SocketRead), + TRANS(SocketWrite), + TRANS(SocketReadv), + TRANS(SocketWritev), +#if XTRANS_SEND_FDS + TRANS(SocketSendFd), + TRANS(SocketRecvFd), +#endif + TRANS(SocketDisconnect), + TRANS(SocketUNIXClose), + TRANS(SocketUNIXCloseForCloning), + }; + +#endif /* UNIXCONN */ + +#ifdef NX_TRANS_SOCKET +/* + * Override the UNIX_DIR and UNIX_PATH settings and + * make them configurable, based on the NX_TEMP or + * the TEMP environment. + * + * We must be careful as the same defines are used + * for different directories, based on the subsystem + * that is compiling this, while we want to override + * only the '/tmp/.X11-unix' and '/tmp/.X11-unix/X' + * settings. + */ + +static char _NXUnixDir[1024]; +static char _NXUnixPath[1024]; + +static char *_NXGetUnixDir(char *dir) +{ + const char *tempDir; + + prmsg (3, "_NXGetUnixDir(%s)\n", dir); + + if (strcmp(dir, UNIX_DIR) != 0) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixDir: Returning other Unix directory [%s].\n", dir); +#endif + return dir; + } + + /* + * Check the environment only once. + */ + + if (*_NXUnixDir != '\0') + { + return _NXUnixDir; + } + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixDir: Trying with the NX_TEMP environment.\n"); +#endif + + tempDir = getenv("NX_TEMP"); + + if (tempDir == NULL || *tempDir == '\0') + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixDir: Trying with the TEMP environment.\n"); +#endif + + tempDir = getenv("TEMP"); + } + + if (tempDir != NULL && *tempDir != '\0') + { + if (strlen(tempDir) + strlen("/.X11-unix") + 1 > 1024) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixDir: WARNING! Maximum length of X11 Unix directory exceeded.\n"); +#endif + goto _NXGetUnixDirError; + } + + strcpy(_NXUnixDir, tempDir); + strcat(_NXUnixDir, "/.X11-unix"); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixDir: Using X11 Unix directory [%s].\n", _NXUnixDir); +#endif + + return _NXUnixDir; + } + +_NXGetUnixDirError: + + strcpy(_NXUnixDir, dir); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixDir: Returning default X11 Unix directory [%s].\n", _NXUnixDir); +#endif + + return _NXUnixDir; +} + +static char *_NXGetUnixPath(char *path) +{ + const char *unixDir; + + prmsg (3, "_NXGetUnixPath(%s)\n", path); + + if (strcmp(path, UNIX_PATH) != 0) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixPath: Returning other X11 Unix path [%s].\n", path); +#endif + return path; + } + + /* + * Check the environment only once. + */ + + if (*_NXUnixPath != '\0') + { + return _NXUnixPath; + } + + unixDir = _NXGetUnixDir(UNIX_DIR); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixPath: Got X11 Unix directory [%s].\n", unixDir); +#endif + + if (strlen(unixDir) + strlen("/X") + 1 > 1024) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixPath: WARNING! Maximum length of X11 Unix path exceeded.\n"); +#endif + + goto _NXGetUnixPathError; + } + + strcpy(_NXUnixPath, unixDir); + strcat(_NXUnixPath, "/X"); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixPath: Returning X11 Unix path [%s].\n", _NXUnixPath); +#endif + + return _NXUnixPath; + +_NXGetUnixPathError: + + strcpy(_NXUnixPath, path); + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_NXGetUnixPath: Returning default X11 Unix path [%s].\n", _NXUnixPath); +#endif + + return _NXUnixPath; +} + +#endif /* NX_TRANS_SOCKET */ diff --git a/nx-X11/lib/include/xtrans/Xtransutil.c b/nx-X11/lib/include/xtrans/Xtransutil.c new file mode 100644 index 000000000..0063e83d8 --- /dev/null +++ b/nx-X11/lib/include/xtrans/Xtransutil.c @@ -0,0 +1,639 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCRS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +/* + * These are some utility functions created for convenience or to provide + * an interface that is similar to an existing interface. These are built + * only using the Transport Independant API, and have no knowledge of + * the internal implementation. + */ + +#ifdef XTHREADS +#include +#endif +#ifdef WIN32 +#include +#include +#endif + +#ifdef X11_t + +/* + * These values come from X.h and Xauth.h, and MUST match them. Some + * of these values are also defined by the ChangeHost protocol message. + */ + +#define FamilyInternet 0 /* IPv4 */ +#define FamilyDECnet 1 +#define FamilyChaos 2 +#define FamilyInternet6 6 +#define FamilyAmoeba 33 +#define FamilyLocalHost 252 +#define FamilyKrb5Principal 253 +#define FamilyNetname 254 +#define FamilyLocal 256 +#define FamilyWild 65535 + +/* + * TRANS(ConvertAddress) converts a sockaddr based address to an + * X authorization based address. Some of this is defined as part of + * the ChangeHost protocol. The rest is just done in a consistent manner. + */ + +int +TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) + +{ + + prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,(void *) *addrp); + + switch( *familyp ) + { +#if defined(TCPCONN) + case AF_INET: + { + /* + * Check for the BSD hack localhost address 127.0.0.1. + * In this case, we are really FamilyLocal. + */ + + struct sockaddr_in saddr; + int len = sizeof(saddr.sin_addr.s_addr); + char *cp = (char *) &saddr.sin_addr.s_addr; + + memcpy (&saddr, *addrp, sizeof (struct sockaddr_in)); + + if ((len == 4) && (cp[0] == 127) && (cp[1] == 0) && + (cp[2] == 0) && (cp[3] == 1)) + { + *familyp=FamilyLocal; + } + else + { + *familyp=FamilyInternet; + *addrlenp=len; + memcpy(*addrp,&saddr.sin_addr,len); + } + break; + } + +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + { + struct sockaddr_in6 saddr6; + + memcpy (&saddr6, *addrp, sizeof (struct sockaddr_in6)); + + if (IN6_IS_ADDR_LOOPBACK(&saddr6.sin6_addr)) + { + *familyp=FamilyLocal; + } + else if (IN6_IS_ADDR_V4MAPPED(&(saddr6.sin6_addr))) { + char *cp = (char *) &saddr6.sin6_addr.s6_addr[12]; + + if ((cp[0] == 127) && (cp[1] == 0) && + (cp[2] == 0) && (cp[3] == 1)) + { + *familyp=FamilyLocal; + } + else + { + *familyp=FamilyInternet; + *addrlenp = sizeof (struct in_addr); + memcpy(*addrp,cp,*addrlenp); + } + } + else + { + *familyp=FamilyInternet6; + *addrlenp=sizeof(saddr6.sin6_addr); + memcpy(*addrp,&saddr6.sin6_addr,sizeof(saddr6.sin6_addr)); + } + break; + } +#endif /* IPv6 */ +#endif /* defined(TCPCONN) */ + + +#if defined(UNIXCONN) || defined(LOCALCONN) + case AF_UNIX: + { + *familyp=FamilyLocal; + break; + } +#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ + +#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN) + case 0: + { + *familyp=FamilyLocal; + break; + } +#endif + + default: + prmsg(1,"ConvertAddress: Unknown family type %d\n", + *familyp); + return -1; + } + + + if (*familyp == FamilyLocal) + { + /* + * In the case of a local connection, we need to get the + * host name for authentication. + */ + + char hostnamebuf[256]; + int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); + + if (len > 0) { + if (*addrp && *addrlenp < (len + 1)) + { + free (*addrp); + *addrp = NULL; + } + if (!*addrp) + *addrp = malloc (len + 1); + if (*addrp) { + strcpy ((char *) *addrp, hostnamebuf); + *addrlenp = len; + } else { + *addrlenp = 0; + } + } + else + { + if (*addrp) + free (*addrp); + *addrp = NULL; + *addrlenp = 0; + } + } + + return 0; +} + +#endif /* X11_t */ + +#ifdef ICE_t + +/* Needed for _XGethostbyaddr usage in TRANS(GetPeerNetworkId) */ +# if defined(TCPCONN) || defined(UNIXCONN) +# define X_INCLUDE_NETDB_H +# define XOS_USE_NO_LOCKING +# include +# endif + +#include + +char * +TRANS(GetMyNetworkId) (XtransConnInfo ciptr) + +{ + int family = ciptr->family; + char *addr = ciptr->addr; + char hostnamebuf[256]; + char *networkId = NULL; + const char *transName = ciptr->transptr->TransName; + + if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0) + { + return (NULL); + } + + switch (family) + { +#if defined(UNIXCONN) || defined(LOCALCONN) + case AF_UNIX: + { + struct sockaddr_un *saddr = (struct sockaddr_un *) addr; + networkId = malloc (3 + strlen (transName) + + strlen (hostnamebuf) + strlen (saddr->sun_path)); + sprintf (networkId, "%s/%s:%s", transName, + hostnamebuf, saddr->sun_path); + break; + } +#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ + +#if defined(TCPCONN) + case AF_INET: +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: +#endif + { + struct sockaddr_in *saddr = (struct sockaddr_in *) addr; +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) addr; +#endif + int portnum; + char portnumbuf[10]; + + +#if defined(IPv6) && defined(AF_INET6) + if (family == AF_INET6) + portnum = ntohs (saddr6->sin6_port); + else +#endif + portnum = ntohs (saddr->sin_port); + + snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum); + networkId = malloc (3 + strlen (transName) + + strlen (hostnamebuf) + strlen (portnumbuf)); + sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); + break; + } +#endif /* defined(TCPCONN) */ + + + default: + break; + } + + return (networkId); +} + +#include +static jmp_buf env; + +#ifdef SIGALRM +static volatile int nameserver_timedout = 0; + +static void +nameserver_lost(int sig _X_UNUSED) +{ + nameserver_timedout = 1; + longjmp (env, -1); + /* NOTREACHED */ +} +#endif /* SIGALARM */ + + +char * +TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) + +{ + int family = ciptr->family; + char *peer_addr = ciptr->peeraddr; + char *hostname; + char addrbuf[256]; + const char *addr = NULL; + + switch (family) + { + case AF_UNSPEC: +#if defined(UNIXCONN) || defined(LOCALCONN) + case AF_UNIX: + { + if (gethostname (addrbuf, sizeof (addrbuf)) == 0) + addr = addrbuf; + break; + } +#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ + +#if defined(TCPCONN) + case AF_INET: +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: +#endif + { + struct sockaddr_in *saddr = (struct sockaddr_in *) peer_addr; +#if defined(IPv6) && defined(AF_INET6) + struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) peer_addr; +#endif + char *address; + int addresslen; +#ifdef XTHREADS_NEEDS_BYNAMEPARAMS + _Xgethostbynameparams hparams; +#endif + struct hostent * volatile hostp = NULL; + +#if defined(IPv6) && defined(AF_INET6) + if (family == AF_INET6) + { + address = (char *) &saddr6->sin6_addr; + addresslen = sizeof (saddr6->sin6_addr); + } + else +#endif + { + address = (char *) &saddr->sin_addr; + addresslen = sizeof (saddr->sin_addr); + } + +#ifdef SIGALRM + /* + * gethostbyaddr can take a LONG time if the host does not exist. + * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds + * that something is wrong and do not make the user wait. + * gethostbyaddr will continue after a signal, so we have to + * jump out of it. + */ + + nameserver_timedout = 0; + signal (SIGALRM, nameserver_lost); + alarm (4); + if (setjmp(env) == 0) { +#endif + hostp = _XGethostbyaddr (address, addresslen, family, hparams); +#ifdef SIGALRM + } + alarm (0); +#endif + if (hostp != NULL) + addr = hostp->h_name; + else +#if defined(IPv6) && defined(AF_INET6) + addr = inet_ntop (family, address, addrbuf, sizeof (addrbuf)); +#else + addr = inet_ntoa (saddr->sin_addr); +#endif + break; + } + +#endif /* defined(TCPCONN) */ + + + default: + return (NULL); + } + + + hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2); + strcpy (hostname, ciptr->transptr->TransName); + strcat (hostname, "/"); + if (addr) + strcat (hostname, addr); + + return (hostname); +} + +#endif /* ICE_t */ + + +#if defined(WIN32) && defined(TCPCONN) +int +TRANS(WSAStartup) (void) +{ + static WSADATA wsadata; + + prmsg (2,"WSAStartup()\n"); + + if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata)) + return 1; + return 0; +} +#endif + +#include + +#if defined(X11_t) +static int +is_numeric (const char *str) +{ + int i; + + for (i = 0; i < (int) strlen (str); i++) + if (!isdigit (str[i])) + return (0); + + return (1); +} +#endif + +#ifdef TRANS_SERVER +#include +#include +#include + +#if !defined(S_IFLNK) && !defined(S_ISLNK) +#undef lstat +#define lstat(a,b) stat(a,b) +#endif + +#define FAIL_IF_NOMODE 1 +#define FAIL_IF_NOT_ROOT 2 +#define WARN_NO_ACCESS 4 + +/* + * We make the assumption that when the 'sticky' (t) bit is requested + * it's not save if the directory has non-root ownership or the sticky + * bit cannot be set and fail. + */ +static int +trans_mkdir(const char *path, int mode) +{ + struct stat buf; + + if (lstat(path, &buf) != 0) { + if (errno != ENOENT) { + prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n", + path, errno); + return -1; + } + /* Dir doesn't exist. Try to create it */ + +#if !defined(WIN32) && !defined(__CYGWIN__) + /* + * 'sticky' bit requested: assume application makes + * certain security implications. If effective user ID + * is != 0: fail as we may not be able to meet them. + */ + if (geteuid() != 0) { + if (mode & 01000) { + prmsg(1, "mkdir: ERROR: euid != 0," + "directory %s will not be created.\n", + path); +#ifdef FAIL_HARD + return -1; +#endif + } else { + prmsg(1, "mkdir: Cannot create %s with root ownership\n", + path); + } + } +#endif + +#ifndef WIN32 + if (mkdir(path, mode) == 0) { + if (chmod(path, mode)) { + prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n", + path, mode); +#ifdef FAIL_HARD + return -1; +#endif + } +#else + if (mkdir(path) == 0) { +#endif + } else { + prmsg(1, "mkdir: ERROR: Cannot create %s\n", + path); + return -1; + } + + return 0; + + } else { + if (S_ISDIR(buf.st_mode)) { + int updateOwner = 0; + int updateMode = 0; + int updatedOwner = 0; + int updatedMode = 0; + int status = 0; + /* Check if the directory's ownership is OK. */ + if (buf.st_uid != 0) + updateOwner = 1; + + /* + * Check if the directory's mode is OK. An exact match isn't + * required, just a mode that isn't more permissive than the + * one requested. + */ + if ((~mode) & 0077 & buf.st_mode) + updateMode = 1; + + /* + * If the directory is not writeable not everybody may + * be able to create sockets. Therefore warn if mode + * cannot be fixed. + */ + if ((~buf.st_mode) & 0022 & mode) { + updateMode = 1; + status |= WARN_NO_ACCESS; + } + + /* + * If 'sticky' bit is requested fail if owner isn't root + * as we assume the caller makes certain security implications + */ + if (mode & 01000) { + status |= FAIL_IF_NOT_ROOT; + if (!(buf.st_mode & 01000)) { + status |= FAIL_IF_NOMODE; + updateMode = 1; + } + } + +#ifdef HAS_FCHOWN + /* + * If fchown(2) and fchmod(2) are available, try to correct the + * directory's owner and mode. Otherwise it isn't safe to attempt + * to do this. + */ + if (updateMode || updateOwner) { + int fd = -1; + struct stat fbuf; + if ((fd = open(path, O_RDONLY)) != -1) { + if (fstat(fd, &fbuf) == -1) { + prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n", + path, errno); + close(fd); + return -1; + } + /* + * Verify that we've opened the same directory as was + * checked above. + */ + if (!S_ISDIR(fbuf.st_mode) || + buf.st_dev != fbuf.st_dev || + buf.st_ino != fbuf.st_ino) { + prmsg(1, "mkdir: ERROR: inode for %s changed\n", + path); + close(fd); + return -1; + } + if (updateOwner && fchown(fd, 0, 0) == 0) + updatedOwner = 1; + if (updateMode && fchmod(fd, mode) == 0) + updatedMode = 1; + close(fd); + } + } +#endif + + if (updateOwner && !updatedOwner) { +#ifdef FAIL_HARD + if (status & FAIL_IF_NOT_ROOT) { + prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n", + path); + return -1; + } +#endif +#if !defined(__APPLE_CC__) && !defined(__CYGWIN__) + prmsg(1, "mkdir: Owner of %s should be set to root\n", + path); +#endif + } + + if (updateMode && !updatedMode) { +#ifdef FAIL_HARD + if (status & FAIL_IF_NOMODE) { + prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n", + path, mode); + return -1; + } +#endif + prmsg(1, "mkdir: Mode of %s should be set to %04o\n", + path, mode); + if (status & WARN_NO_ACCESS) { + prmsg(1, "mkdir: this may cause subsequent errors\n"); + } + } + return 0; + } + return -1; + } + + /* In all other cases, fail */ + return -1; +} + +#endif /* TRANS_SERVER */ diff --git a/nx-X11/lib/include/xtrans/transport.c b/nx-X11/lib/include/xtrans/transport.c new file mode 100644 index 000000000..b62fc7b64 --- /dev/null +++ b/nx-X11/lib/include/xtrans/transport.c @@ -0,0 +1,74 @@ +/* + +Copyright 1993, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + + * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA + * + * All Rights Reserved + * + * 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 supporting + * documentation, and that the name NCR not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. NCR makes no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL NCR 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. + */ + +#include + +#define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used + here, not just #included in another file */ + +#include "Xtransint.h" + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wformat-nonliteral" +#pragma clang diagnostic ignored "-Wdeprecated-declarations" +#endif + +#ifdef LOCALCONN +#include "Xtranslcl.c" +#endif +#if defined(TCPCONN) || defined(UNIXCONN) +#include "Xtranssock.c" +#endif +#include "Xtrans.c" +#include "Xtransutil.c" + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif diff --git a/nx-X11/lib/m4/ax_define_dir.m4 b/nx-X11/lib/m4/ax_define_dir.m4 new file mode 100644 index 000000000..b74d155fd --- /dev/null +++ b/nx-X11/lib/m4/ax_define_dir.m4 @@ -0,0 +1,49 @@ +# =========================================================================== +# http://www.gnu.org/software/autoconf-archive/ax_define_dir.html +# =========================================================================== +# +# SYNOPSIS +# +# AX_DEFINE_DIR(VARNAME, DIR [, DESCRIPTION]) +# +# DESCRIPTION +# +# This macro sets VARNAME to the expansion of the DIR variable, taking +# care of fixing up ${prefix} and such. +# +# VARNAME is then offered as both an output variable and a C preprocessor +# symbol. +# +# Example: +# +# AX_DEFINE_DIR([DATADIR], [datadir], [Where data are placed to.]) +# +# LICENSE +# +# Copyright (c) 2008 Stepan Kasal +# Copyright (c) 2008 Andreas Schwab +# Copyright (c) 2008 Guido U. Draheim +# Copyright (c) 2008 Alexandre Oliva +# +# Copying and distribution of this file, with or without modification, are +# permitted in any medium without royalty provided the copyright notice +# and this notice are preserved. This file is offered as-is, without any +# warranty. + +#serial 6 + +AU_ALIAS([AC_DEFINE_DIR], [AX_DEFINE_DIR]) +AC_DEFUN([AX_DEFINE_DIR], [ + prefix_NONE= + exec_prefix_NONE= + test "x$prefix" = xNONE && prefix_NONE=yes && prefix=$ac_default_prefix + test "x$exec_prefix" = xNONE && exec_prefix_NONE=yes && exec_prefix=$prefix +dnl In Autoconf 2.60, ${datadir} refers to ${datarootdir}, which in turn +dnl refers to ${prefix}. Thus we have to use `eval' twice. + eval ax_define_dir="\"[$]$2\"" + eval ax_define_dir="\"$ax_define_dir\"" + AC_SUBST($1, "$ax_define_dir") + AC_DEFINE_UNQUOTED($1, "$ax_define_dir", [$3]) + test "$prefix_NONE" && prefix=NONE + test "$exec_prefix_NONE" && exec_prefix=NONE +]) diff --git a/nx-X11/lib/m4/nx-macros.m4 b/nx-X11/lib/m4/nx-macros.m4 new file mode 120000 index 000000000..efbc5bdb4 --- /dev/null +++ b/nx-X11/lib/m4/nx-macros.m4 @@ -0,0 +1 @@ +../../../m4/nx-macros.m4 \ No newline at end of file diff --git a/nx-X11/lib/m4/nx-xtrans.m4 b/nx-X11/lib/m4/nx-xtrans.m4 new file mode 120000 index 000000000..5e3aef91e --- /dev/null +++ b/nx-X11/lib/m4/nx-xtrans.m4 @@ -0,0 +1 @@ +../../../m4/nx-xtrans.m4 \ No newline at end of file diff --git a/nx-X11/lib/modules/Makefile.am b/nx-X11/lib/modules/Makefile.am new file mode 100644 index 000000000..3bedb1a20 --- /dev/null +++ b/nx-X11/lib/modules/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = im lc om diff --git a/nx-X11/lib/modules/im/Makefile.am b/nx-X11/lib/modules/im/Makefile.am new file mode 100644 index 000000000..76d27dd77 --- /dev/null +++ b/nx-X11/lib/modules/im/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = ximcp diff --git a/nx-X11/lib/modules/im/ximcp/Makefile.am b/nx-X11/lib/modules/im/ximcp/Makefile.am new file mode 100644 index 000000000..e44ce0d90 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/Makefile.am @@ -0,0 +1,56 @@ +NULL = + +noinst_LTLIBRARIES=libximcp.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + -DXIM_t \ + -DTRANS_CLIENT \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(MALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +ximcp_la_SOURCES = \ + imCallbk.c \ + imDefFlt.c \ + imDefIc.c \ + imDefIm.c \ + imDefLkup.c \ + imDispch.c \ + imEvToWire.c \ + imExten.c \ + imImSw.c \ + imInsClbk.c \ + imInt.c \ + imLcFlt.c \ + imLcGIc.c \ + imLcIc.c \ + imLcIm.c \ + imLcLkup.c \ + imLcPrs.c \ + imLcSIc.c \ + imRmAttr.c \ + imRm.c \ + imThaiFlt.c \ + imThaiIc.c \ + imThaiIm.c \ + imTrans.c \ + imTransR.c \ + imTrX.c \ + $(NULL) + +libximcp_la_SOURCES = $(ximcp_la_SOURCES) diff --git a/nx-X11/lib/modules/im/ximcp/imCallbk.c b/nx-X11/lib/modules/im/ximcp/imCallbk.c new file mode 100644 index 000000000..4e091d8ef --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imCallbk.c @@ -0,0 +1,747 @@ +/*********************************************************************** +Copyright 1993 by Digital Equipment Corporation, Maynard, Massachusetts, +Copyright 1994 by FUJITSU LIMITED +Copyright 1994 by Sony Corporation + + All Rights Reserved + +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 +supporting documentation, and that the names of Digital, FUJITSU +LIMITED and Sony Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED +AND 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. + + Author: Hiroyuki Miyamoto Digital Equipment Corporation + miyamoto@jrd.dec.com + Modifier: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + +***********************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "XlcPubI.h" + +#define sz_CARD8 1 +#define sz_INT8 1 +#define sz_CARD16 2 +#define sz_INT16 2 +#define sz_BITMASK16 sz_CARD16 +#define sz_CARD32 4 +#define sz_INT32 4 +#define sz_BITMASK32 sz_CARD32 +#define sz_XIMID sizeof(XIMID) +#define sz_XICID sizeof(XICID) +#define sz_XIMATTRID sizeof(XIMATTRID) +#define sz_XICATTRID sizeof(XICATTRID) +#define sz_ximPacketHeader (XIM_HEADER_SIZE + sz_XIMID + sz_XICID) +#define sz_ximGeometry 0 +#define sz_ximStrConversion (sz_CARD32 + sz_CARD32 + sz_CARD32 + sz_CARD32) +#define sz_ximPreeditStart 0 +#define sz_ximPreeditStartReply sz_INT32 +#define sz_ximPreeditCaret (sz_INT32 + sz_CARD32 + sz_CARD32) +#define sz_ximPreeditCaretReply sz_CARD32 +#define sz_ximPreeditDone 0 +#define sz_ximStatusStart 0 +#define sz_ximStatusDone 0 + +typedef enum { + XimCbSuccess, + XimCbNoCallback, + XimCbError, + XimCbQueued, + XimCbBadContextID, + XimCbBadOpcode +} XimCbStatus; + +typedef XimCbStatus (*XimCb)( + Xim, Xic, char*, int + ); + +#define PACKET_TO_MAJOROPCODE(p) (*(CARD8*)((CARD8*)(p))) +#define PACKET_TO_MINOROPCODE(p) (*(CARD8*)((CARD8*)(p) + sz_CARD8)) +#define PACKET_TO_LENGTH(p) (*(CARD16*)((CARD8*)(p) + sz_CARD8 + sz_CARD8)) +#define PACKET_TO_IMID(p) (*(XIMID*)((CARD8*)(p) + XIM_HEADER_SIZE)) +#define PACKET_TO_ICID(p) (*(XICID*)((CARD8*)(p) + XIM_HEADER_SIZE + sz_XIMID)) + +#define _XimWriteData(im,len,data) \ + (im->private.proto.write((im),(len),(XPointer)(data))) +#define _XimReadData(im,buf,buf_len,len) \ + (im->private.proto.read((im),(XPointer)(buf),(buf_len),&(len))) +#define _XimFlushData(im) im->private.proto.flush((im)) + +static XimCbStatus _XimGeometryCallback(Xim, Xic, char*, int); +static XimCbStatus _XimStrConversionCallback(Xim, Xic, char*, int); +static XimCbStatus _XimPreeditStartCallback(Xim, Xic, char*, int); +static XimCbStatus _XimPreeditDoneCallback(Xim, Xic, char*, int); +static void _free_memory_for_text(XIMText*); +static XimCbStatus _XimPreeditDrawCallback(Xim, Xic, char*, int); +static XimCbStatus _XimPreeditCaretCallback(Xim, Xic, char*, int); +static XimCbStatus _XimStatusStartCallback(Xim, Xic, char*, int); +static XimCbStatus _XimStatusDoneCallback(Xim, Xic, char*, int); +static XimCbStatus _XimStatusDrawCallback(Xim, Xic, char*, int); +static XimCbStatus _XimPreeditStateNotifyCallback(Xim, Xic, char *, int); + +#if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) +#define RConst /**/ +#else +#define RConst const +#endif + +/* NOTE: + * the table below depends on the protocol number + * defined in the IM Protocol document. + */ +static RConst XimCb callback_table[] = { + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #000-009 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #010-019 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #020-029 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #030-039 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #040-049 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #050-059 */ + NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, /* #060-069 */ + _XimGeometryCallback, /* #070 */ + _XimStrConversionCallback, /* #071 */ + NULL, /* #072 */ + _XimPreeditStartCallback, /* #073 */ + NULL, /* #074 */ + _XimPreeditDrawCallback, /* #075 */ + _XimPreeditCaretCallback, /* #076 */ + NULL, /* #077 */ + _XimPreeditDoneCallback, /* #078 */ + _XimStatusStartCallback, /* #079 */ + _XimStatusDrawCallback, /* #080 */ + _XimStatusDoneCallback, /* #081 */ + _XimPreeditStateNotifyCallback /* #082 */ + }; + + +static Bool +_XimIsReadyForProcess(Xic ic) +{ + return(!ic->private.proto.waitCallback); /* check HM */ +} + +static void +_XimProcessPendingCallbacks(Xic ic) +{ + XimPendingCallback pcbq; + + while (((pcbq = ic->private.proto.pend_cb_que) != (XimPendingCallback)NULL) + && _XimIsReadyForProcess(ic)) { + (void) (*callback_table[pcbq->major_opcode])(pcbq->im, + pcbq->ic, + pcbq->proto, + pcbq->proto_len); + ic->private.proto.pend_cb_que = pcbq->next; + Xfree(pcbq->proto); /* free memory of XimPendingCallback */ + Xfree(pcbq); + } +} + +static void +_XimPutCbIntoQueue(Xic ic, XimPendingCallback call_data) +{ + XimPendingCallback pcbq = ic->private.proto.pend_cb_que; + + /* Queuing is FIFO + */ + while (pcbq != (XimPendingCallback)NULL) { + if (pcbq->next == (XimPendingCallback)NULL) { + break; + } + pcbq = pcbq->next; + } + if (pcbq == (XimPendingCallback)NULL) { + ic->private.proto.pend_cb_que = call_data; + } + else { + pcbq->next = call_data; + } +} + +Bool +_XimCbDispatch(Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + /* `data' points to the beginning of the packet defined in IM Protocol doc. + */ + int major_opcode = PACKET_TO_MAJOROPCODE(data); + XIMID imid = PACKET_TO_IMID(data); + XICID icid = PACKET_TO_ICID(data); + Xim im = (Xim)call_data; /* check HM */ + Xic ic = _XimICOfXICID(im, icid); + char* proto; + int proto_len; + + /* check validity of im/ic + */ + if ((imid != im->private.proto.imid) || !ic) { + return False; /* status = XimCbBadContextID; */ + } + + /* process pending callbacks + */ + _XimProcessPendingCallbacks(ic); + + /* check if the protocol should be processed here + */ + if (major_opcode > 82) { + return False; /* status = XimCbBadOpcode; */ + } + if (!callback_table[major_opcode]) { + return False; /* status = XimCbBadOpcode; */ + } + + /* move the pointer ahead by the IM Protocol packet header size + */ + proto = (char*)data + sz_ximPacketHeader; + proto_len = (int)len - sz_ximPacketHeader; + + /* check if it can be processed right away + * and if no, queue the protocol, otherwise invoke a callback + */ + if (!_XimIsReadyForProcess(ic)) { + + /* queue the protocol + */ + XimPendingCallback pcb; + char *proto_buf = (proto_len > 0) ? Xmalloc(proto_len) : NULL; + + pcb = Xmalloc(sizeof(XimPendingCallbackRec)); + if (pcb && (proto_len <= 0 || proto_buf)) { + if (proto_len > 0) + memcpy(proto_buf, proto, proto_len); + + pcb->major_opcode = major_opcode; + pcb->im = im; + pcb->ic = ic; + pcb->proto = proto_buf; + pcb->proto_len = proto_len; + pcb->next = (XimPendingCallback)NULL; /* queue is FIFO */ + _XimPutCbIntoQueue(ic, pcb); + /* status = XimCbQueued; */ + } else { + /* status = XimCbError; */ + Xfree(pcb); + Xfree(proto_buf); + } + } + else { + /* invoke each callback according to the major opcode. + * `proto' points to the next address of IM-ID and IC-ID. + * `proto_len' specifies the packet length. + */ + (void) (*callback_table[major_opcode])(im, ic, proto, proto_len); + } + return True; +} + +static XimCbStatus +_XimGeometryCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.geometry_callback; + + /* invoke the callack + */ + if (cb && cb->callback) { + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); + } + else { + + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimStrConversionCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.string_conversion_callback; /* check HM */ + XIMStringConversionCallbackStruct cbrec; + + /* invoke the callback + */ + if (cb && cb->callback) { + int p = XIM_HEADER_SIZE; + cbrec.position = (XIMStringConversionPosition) + *(CARD32*)&proto[p]; p += sz_CARD32; + cbrec.direction = (XIMCaretDirection) + *(CARD32*)&proto[p]; p += sz_CARD32; + cbrec.operation = (XIMStringConversionOperation) + *(CARD32*)&proto[p]; p += sz_CARD32; + cbrec.factor = (unsigned short) + *(CARD32*)&proto[p]; + + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbrec); + } + else { + + /* no callback registered + */ + _XimError(im, ic, + (CARD16)XIM_BadSomething, + (INT16)len, + (CARD16)XIM_STR_CONVERSION, + (char*)proto); /* send XIM_ERROR */ + return XimCbNoCallback; + } + + /* send a reply + */ + { + CARD8 *buf; + INT16 buf_len; + int p, length_in_bytes, i; + + /* Assumption: + * `cbrec.text->length' means the string length in characters + */ + { + length_in_bytes = (cbrec.text->encoding_is_wchar)? + sizeof(wchar_t) * cbrec.text->length: /* wchar */ + strlen(cbrec.text->string.mbs); /* mb */ + buf_len = XIM_HEADER_SIZE + + sz_CARD16 + + 2 + length_in_bytes + + XIM_PAD(2 + length_in_bytes) + + 2 + 2 + sz_CARD32 * cbrec.text->length; + buf = Xmalloc(buf_len); + } + _XimSetHeader((XPointer)buf, XIM_STR_CONVERSION_REPLY, 0, &buf_len); + buf_len -= XIM_HEADER_SIZE; /* added by _XimSetHeader (HACK) */ + p = XIM_HEADER_SIZE; + *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; + *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; + *(CARD16*)&buf[p] = (CARD16)cbrec.text->length; p += sz_CARD16; + memcpy(&buf[p],&cbrec.text->string.mbs,length_in_bytes); + p += length_in_bytes; + *(CARD16*)&buf[p] = (CARD16)(sz_CARD32*cbrec.text->length); + p += XIM_PAD(2); + for (i = 0; i < (int)cbrec.text->length; i++) { + *(CARD32*)&buf[p] = (CARD32)cbrec.text->feedback[i]; + p += sz_CARD32; + } + + if (!(_XimWriteData(im, buf_len, buf))) { + return XimCbError; + } + _XimFlushData(im); + + Xfree(buf); + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimPreeditStartCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.preedit_attr.start_callback; + int ret; + + /* invoke the callback + */ + if (cb && cb->callback){ + ret = (*(cb->callback))((XIC)ic, cb->client_data, (XPointer)NULL); + } + else { + + /* no callback registered + */ + _XimError(im, ic, + (CARD16)XIM_BadSomething, + (INT16)len, + (CARD16)XIM_PREEDIT_START, + (char*)proto); /* send XIM_ERROR */ + return XimCbNoCallback; + } + + /* send a reply + */ + { + CARD32 buf32[(sz_ximPacketHeader + sz_ximPreeditStartReply) / 4]; + CARD8 *buf = (CARD8 *)buf32; + INT16 buf_len = sz_XIMID + sz_XICID + sz_ximPreeditStartReply; + int p; + + _XimSetHeader((XPointer)buf, XIM_PREEDIT_START_REPLY, 0, &buf_len); + p = XIM_HEADER_SIZE; + *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; + *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; + *(INT32*)&buf[p] = (INT32)ret; + + if (!(_XimWriteData(im, buf_len, buf))) { + return XimCbError; + } + _XimFlushData(im); + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimPreeditDoneCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.preedit_attr.done_callback; + + /* invoke the callback + */ + if (cb && cb->callback) { + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); + } + else { + + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + +static void +_read_text_from_packet(Xim im, + char* buf, + XIMText** text_ptr) +{ + int status; + XIMText* text; + int tmp_len; + char* tmp_buf; + Status s = 0; + + status = (int)*(BITMASK32*)buf; buf += sz_BITMASK32; + + /* string part + */ + if (status & 0x00000001) /* "no string" bit on */ { + buf += sz_CARD16; /* skip "length of preedit string" */ + buf += 2; /* pad */ + *text_ptr = (XIMText*)NULL; + return; + } + + *text_ptr = text = Xmalloc(sizeof(XIMText)); + if (text == (XIMText*)NULL) return; + + tmp_len = (int)*(CARD16*)buf; + buf += sz_CARD16; + if ((tmp_buf = Xmalloc(tmp_len + 1))) { + memcpy(tmp_buf, buf, tmp_len); + tmp_buf[tmp_len] = '\0'; + + text->encoding_is_wchar = False; + text->length = im->methods->ctstombs((XIM)im, + tmp_buf, tmp_len, + NULL, 0, &s); /* CT? HM */ + if (s != XLookupNone) { +#ifndef NO_DEC_I18N_FIX + /* Allow for NULL-terminated */ + if ((text->string.multi_byte = Xmalloc(text->length * + XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1))) { +#else + if (text->string.multi_byte = Xmalloc(text->length+1)) { +#endif + int tmp; +#ifndef NO_DEC_I18N_FIX + char *char_tmp; + int char_len; +#endif + tmp = im->methods->ctstombs((XIM)im, + tmp_buf, tmp_len, +#ifndef NO_DEC_I18N_FIX + text->string.multi_byte, + text->length * XLC_PUBLIC(im->core.lcd,mb_cur_max) + 1, +#else + text->string.multi_byte, text->length, +#endif + &s); + text->string.multi_byte[tmp] = '\0'; +#ifndef NO_DEC_I18N_FIX + text->length = 0; + char_tmp = text->string.multi_byte; + while (*char_tmp != '\0') { + char_len = mblen(char_tmp, strlen(char_tmp)); + char_tmp = char_tmp + char_len; + (text->length)++; + } +#endif + } + } + else { + text->length = 0; + text->string.multi_byte = NULL; + } + + Xfree(tmp_buf); + } + buf += tmp_len; + + buf += XIM_PAD(sz_CARD16 + tmp_len); /* pad */ + + /* feedback part + */ + if (status & 0x00000002) /* "no feedback" bit on */ { + text->feedback = (XIMFeedback*)NULL; + } + else { + int i, j; + + i = (int)*(CARD16*)buf; buf += sz_CARD16; + buf += sz_CARD16; /* skip `unused' */ + text->feedback = Xmalloc(i*(sizeof(XIMFeedback)/sizeof(CARD32))); + j = 0; + while (i > 0) { + text->feedback[j] = (XIMFeedback)*(CARD32*)buf; + buf += sz_CARD32; + i -= sz_CARD32; + j++; + } + /* + * text->length tells how long both the status string and + * the feedback array are. If there's "no string" the + * text->length was set to zero previously. See above. + * But if there is feedback (i.e. not "no feedback") then + * we need to convey the length of the feedback array. + * It might have been better if the protocol sent two + * different values, one for the length of the status + * string and one for the length of the feedback array. + */ + if (status & 0x00000001) /* "no string" bit on */ { + text->length = j; + } + } +} + +static void +_free_memory_for_text(XIMText* text) +{ + if (text) { + Xfree(text->string.multi_byte); + Xfree(text->feedback); + Xfree(text); + } +} + +static XimCbStatus +_XimPreeditDrawCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.preedit_attr.draw_callback; + XIMPreeditDrawCallbackStruct cbs; + + /* invoke the callback + */ + if (cb && cb->callback) { + cbs.caret = (int)*(INT32*)proto; proto += sz_INT32; + cbs.chg_first = (int)*(INT32*)proto; proto += sz_INT32; + cbs.chg_length = (int)*(INT32*)proto; proto += sz_INT32; + _read_text_from_packet(im, proto, &cbs.text); + + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); + + _free_memory_for_text((XIMText*)cbs.text); + } + else { + + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimPreeditCaretCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.preedit_attr.caret_callback; + XIMPreeditCaretCallbackStruct cbs; + + /* invoke the callback + */ + if (cb && cb->callback) { + cbs.position = (int)*(INT32*)proto; proto += sz_INT32; + cbs.direction = (XIMCaretDirection)*(CARD32*)proto; proto += sz_CARD32; + cbs.style = (XIMCaretStyle)*(CARD32*)proto; proto += sz_CARD32; + + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); + } + else { + + /* no callback registered + */ + _XimError(im, ic, + (CARD16)XIM_BadSomething, + (INT16)len, + (CARD16)XIM_PREEDIT_CARET, + (char*)proto); /* send XIM_ERROR */ + return XimCbNoCallback; + } + + /* Send a reply + */ + { + CARD8 buf[sz_ximPacketHeader + sz_ximPreeditCaretReply]; + INT16 len = sz_XIMID + sz_XICID + sz_ximPreeditCaretReply; + int p; + + _XimSetHeader((XPointer)buf, XIM_PREEDIT_CARET_REPLY, 0, &len); + p = XIM_HEADER_SIZE; + *(CARD16*)&buf[p] = (CARD16)im->private.proto.imid; p += sz_CARD16; + *(CARD16*)&buf[p] = (CARD16)ic->private.proto.icid; p += sz_CARD16; + *(CARD32*)&buf[p] = (CARD32)cbs.position; + + if (!(_XimWriteData(im, len, buf))) { + return XimCbError; + } + _XimFlushData(im); + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimStatusStartCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.status_attr.start_callback; + + /* invoke the callback + */ + if (cb && cb->callback) { + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); + } + else { + + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimStatusDoneCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.status_attr.done_callback; + + /* invoke the callback + */ + if (cb && cb->callback) { + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)NULL); + } + else { + + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimStatusDrawCallback(Xim im, + Xic ic, + char* proto, + int len) +{ + XICCallback* cb = &ic->core.status_attr.draw_callback; + XIMStatusDrawCallbackStruct cbs; + + /* invoke the callback + */ + if (cb && cb->callback) { + cbs.type = (XIMStatusDataType)*(CARD32*)proto; proto += sz_CARD32; + if (cbs.type == XIMTextType) { + _read_text_from_packet(im, proto, &cbs.data.text); + } + else if (cbs.type == XIMBitmapType) { + cbs.data.bitmap = (Pixmap)*(CARD32*)proto; + } + + (*cb->callback)((XIC)ic, cb->client_data, (XPointer)&cbs); + + if (cbs.type == XIMTextType) + _free_memory_for_text((XIMText *)cbs.data.text); + } + else { + + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + +static XimCbStatus +_XimPreeditStateNotifyCallback( Xim im, Xic ic, char* proto, int len ) +{ + XICCallback *cb = &ic->core.preedit_attr.state_notify_callback; + + /* invoke the callack + */ + if( cb && cb->callback ) { + XIMPreeditStateNotifyCallbackStruct cbrec; + + cbrec.state = *(BITMASK32 *)proto; + (*cb->callback)( (XIC)ic, cb->client_data, (XPointer)&cbrec ); + } + else { + /* no callback registered + */ + return XimCbNoCallback; + } + + return XimCbSuccess; +} + diff --git a/nx-X11/lib/modules/im/ximcp/imDefFlt.c b/nx-X11/lib/modules/im/ximcp/imDefFlt.c new file mode 100644 index 000000000..b6473e176 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imDefFlt.c @@ -0,0 +1,413 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xutil.h" +#include "Xlcint.h" +#include "Ximint.h" + +static long +_XimTriggerCheck( + Xim im, + XKeyEvent *ev, + INT32 len, + CARD32 *keylist) +{ + register long i; + KeySym keysym; + CARD32 buf32[BUFSIZE/4]; + char *buf = (char *)buf32; + int modifier; + int modifier_mask; + CARD32 min_len = sizeof(CARD32) /* sizeof keysym */ + + sizeof(CARD32) /* sizeof modifier */ + + sizeof(CARD32); /* sizeof modifier mask */ + + XLookupString(ev, buf, BUFSIZE, &keysym, NULL); + if (!keysym) + return -1; + + for (i = 0; len >= min_len; i += 3, len -= min_len) { + modifier = keylist[i + 1]; + modifier_mask = keylist[i + 2]; + if (((KeySym)keylist[i] == keysym) + && ((ev->state & modifier_mask) == modifier)) + return i; + } + return -1; +} + +static long +_XimTriggerOnCheck( + Xim im, + XKeyEvent *ev) +{ + return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_onkeylist[0], + &im->private.proto.im_onkeylist[1]); +} + +static long +_XimTriggerOffCheck( + Xim im, + XKeyEvent *ev) +{ + return _XimTriggerCheck(im, ev, (INT32)im->private.proto.im_offkeylist[0], + &im->private.proto.im_offkeylist[1]); +} + +static Bool +_XimOnKeysCheck( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + long idx; + + if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && + im->private.proto.im_onkeylist && + im->private.proto.im_onkeylist[0]) { + if ((idx = _XimTriggerOnCheck(im, ev)) >= 0) { + (void)_XimTriggerNotify(im, ic, 0, (CARD32)idx); /* Trigger on */ + return True; + } + } + return False; +} + +static Bool +_XimOffKeysCheck( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + long idx; + + if (IS_DYNAMIC_EVENT_FLOW(ic->core.im) && + im->private.proto.im_offkeylist && + im->private.proto.im_offkeylist[0]) { + if ((idx = _XimTriggerOffCheck(im, ev)) >= 0) { + _XimTriggerNotify(im, ic, 1, (CARD32)idx); /* Trigger off */ + return True; + } + } + return False; +} + +static void +_XimPendingFilter( + Xic ic) +{ + Xim im = (Xim)ic->core.im; + + if (IS_NEED_SYNC_REPLY(im)) { + (void)_XimProcSyncReply(im, ic); + UNMARK_NEED_SYNC_REPLY(im); + } + return; +} + +static Bool +_XimProtoKeypressFilter( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + + if (IS_FABRICATED(im)) { + _XimPendingFilter(ic); + UNMARK_FABRICATED(im); + return NOTFILTERD; + } + + if (IS_NEGLECT_EVENT(ic, KeyPressMask)) + return FILTERD; + +#ifdef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } +#else + if (!IS_IC_CONNECTED(ic)) + return NOTFILTERD; +#endif /* XIM_CONNECTABLE */ + + if (!IS_FORWARD_EVENT(ic, KeyPressMask)) { + if (_XimOnKeysCheck(ic, ev)) + return FILTERD; + return NOTFILTERD; + } + if (_XimOffKeysCheck(ic, ev)) + return FILTERD; + + if (_XimForwardEvent(ic, (XEvent *)ev, + IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) + return FILTERD; + + return NOTFILTERD; +} + +static Bool +_XimFilterKeypress( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) +{ + return _XimProtoKeypressFilter((Xic)client_data, (XKeyEvent *)ev ); +} + +static Bool +_XimProtoKeyreleaseFilter( + Xic ic, + XKeyEvent *ev) +{ + Xim im = (Xim)ic->core.im; + + if (IS_FABRICATED(im)) { + _XimPendingFilter(ic); + UNMARK_FABRICATED(im); + return NOTFILTERD; + } + + if (IS_NEGLECT_EVENT(ic, KeyReleaseMask)) + return FILTERD; + +#ifdef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } else { + return NOTFILTERD; + } + } +#else + if (!IS_IC_CONNECTED(ic)) + return NOTFILTERD; +#endif /* XIM_CONNECTABLE */ + + if (!IS_FORWARD_EVENT(ic, KeyReleaseMask)) { + if (_XimOnKeysCheck(ic, ev)) + return FILTERD; + return NOTFILTERD; + } + if (_XimOffKeysCheck(ic, ev)) + return FILTERD; + + if (_XimForwardEvent(ic, (XEvent *)ev, + IS_SYNCHRONOUS_EVENT(ic, KeyPressMask))) + return FILTERD; + + return NOTFILTERD; +} + +static Bool +_XimFilterKeyrelease( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) +{ + return _XimProtoKeyreleaseFilter((Xic)client_data, (XKeyEvent *)ev); +} + +static void +_XimRegisterKeyPressFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (!(ic->private.proto.registed_filter_event & KEYPRESS_MASK)) { + _XRegisterFilterByType (ic->core.im->core.display, + ic->core.focus_window, + KeyPress, KeyPress, + _XimFilterKeypress, + (XPointer)ic); + ic->private.proto.registed_filter_event |= KEYPRESS_MASK; + } + } + return; +} + +static void +_XimRegisterKeyReleaseFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (!(ic->private.proto.registed_filter_event & KEYRELEASE_MASK)) { + _XRegisterFilterByType (ic->core.im->core.display, + ic->core.focus_window, + KeyRelease, KeyRelease, + _XimFilterKeyrelease, + (XPointer)ic); + ic->private.proto.registed_filter_event |= KEYRELEASE_MASK; + } + } + return; +} + +static void +_XimUnregisterKeyPressFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (ic->private.proto.registed_filter_event & KEYPRESS_MASK) { + _XUnregisterFilter (ic->core.im->core.display, + ic->core.focus_window, + _XimFilterKeypress, + (XPointer)ic); + ic->private.proto.registed_filter_event &= ~KEYPRESS_MASK; + } + } + return; +} + +static void +_XimUnregisterKeyReleaseFilter( + Xic ic) +{ + if (ic->core.focus_window) { + if (ic->private.proto.registed_filter_event & KEYRELEASE_MASK) { + _XUnregisterFilter (ic->core.im->core.display, + ic->core.focus_window, + _XimFilterKeyrelease, + (XPointer)ic); + ic->private.proto.registed_filter_event &= ~KEYRELEASE_MASK; + } + } + return; +} + +void +_XimRegisterFilter( + Xic ic) +{ + _XimRegisterKeyPressFilter(ic); + if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) + _XimRegisterKeyReleaseFilter(ic); + return; +} + +void +_XimUnregisterFilter( + Xic ic) +{ + _XimUnregisterKeyPressFilter(ic); + _XimUnregisterKeyReleaseFilter(ic); + return; +} + +void +_XimReregisterFilter( + Xic ic) +{ + if (IS_FORWARD_EVENT(ic, KeyReleaseMask)) + _XimRegisterKeyReleaseFilter(ic); + else + _XimUnregisterKeyReleaseFilter(ic); + + return; +} + +static Bool +_XimFilterServerDestroy( + Display *d, + Window w, + XEvent *ev, + XPointer client_data) +{ + Xim im = (Xim)client_data; + + if (ev->type == DestroyNotify) { + UNMARK_SERVER_CONNECTED(im); +#ifdef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { + _XimServerReconectableDestroy(); + return True; + } +#endif /* XIM_CONNECTABLE */ + _XimServerDestroy(im); + } + return True; +} + +void +_XimRegisterServerFilter( + Xim im) +{ + if (im->private.proto.im_window) { + if (!(im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK)) { + _XRegisterFilterByMask(im->core.display, + im->private.proto.im_window, + StructureNotifyMask, + _XimFilterServerDestroy, + (XPointer)im); + XSelectInput(im->core.display, im->private.proto.im_window, + StructureNotifyMask); + im->private.proto.registed_filter_event |= DESTROYNOTIFY_MASK; + } + } + return; +} + +void +_XimUnregisterServerFilter( + Xim im) +{ + if (im->private.proto.im_window) { + if (im->private.proto.registed_filter_event & DESTROYNOTIFY_MASK) { + _XUnregisterFilter(im->core.display, + im->private.proto.im_window, + _XimFilterServerDestroy, + (XPointer)im); + im->private.proto.registed_filter_event &= ~DESTROYNOTIFY_MASK; + } + } + return; +} + diff --git a/nx-X11/lib/modules/im/ximcp/imDefIc.c b/nx-X11/lib/modules/im/ximcp/imDefIc.c new file mode 100644 index 000000000..3cf46827a --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imDefIc.c @@ -0,0 +1,1576 @@ +/* + * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +static Bool +_XimCreateICCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_CREATE_IC_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +#ifdef XIM_CONNECTABLE +Bool +_XimReCreateIC(ic) + Xic ic; +{ + Xim im = (Xim)ic->core.im; + Xic save_ic; + XIMResourceList res; + unsigned int num; + XIMStyle input_style = ic->core.input_style; + XimDefICValues ic_values; + INT16 len; + CARD16 *buf_s; + char *tmp; + CARD32 tmp_buf32[BUFSIZE/4]; + char *tmp_buf = (char *)tmp_buf32; + char *buf; + int buf_size; + char *data; + int data_len; + int ret_len; + int total; + int idx; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int ret_code; + + if (!(save_ic = Xmalloc(sizeof(XicRec)))) + return False; + memcpy((char *)save_ic, (char *)ic, sizeof(XicRec)); + + ic->core.filter_events = im->private.proto.forward_event_mask; + ic->private.proto.forward_event_mask = + im->private.proto.forward_event_mask; + ic->private.proto.synchronous_event_mask = + im->private.proto.synchronous_event_mask; + + num = im->core.ic_num_resources; + buf_size = sizeof(XIMResource) * num; + if (!(res = Xmalloc(buf_size))) + goto ErrorOnReCreateIC; + (void)memcpy((char *)res, (char *)im->core.ic_resources, buf_size); + ic->private.proto.ic_resources = res; + ic->private.proto.ic_num_resources = num; + + num = im->private.proto.ic_num_inner_resources; + buf_size = sizeof(XIMResource) * num; + if (!(res = Xmalloc(buf_size))) + goto ErrorOnReCreateIC; + (void)memcpy((char *)res, + (char *)im->private.proto.ic_inner_resources, buf_size); + ic->private.proto.ic_inner_resources = res; + ic->private.proto.ic_num_inner_resources = num; + + _XimSetICMode(ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, input_style); + + _XimSetICMode(ic->private.proto.ic_inner_resources, + ic->private.proto.ic_num_inner_resources, input_style); + + _XimGetCurrentICValues(ic, &ic_values); + buf = tmp_buf; + buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); + data_len = BUFSIZE - buf_size; + total = 0; + idx = 0; + for (;;) { + data = &buf[buf_size]; + if (!_XimEncodeSavedICATTRIBUTE(ic, ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, &idx, data, data_len, + &ret_len, (XPointer)&ic_values, XIM_CREATEIC)) { + if (buf != tmp_buf) + Xfree(buf); + goto ErrorOnReCreateIC; + } + + total += ret_len; + if (idx == -1) { + break; + } + + buf_size += ret_len; + if (buf == tmp_buf) { + if (!(tmp = Xmalloc(buf_size + data_len))) { + goto ErrorOnReCreateIC; + } + memcpy(tmp, buf, buf_size); + buf = tmp; + } else { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { + Xfree(buf); + goto ErrorOnReCreateIC; + } + buf = tmp; + } + } + + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + buf_s[0] = im->private.proto.imid; + buf_s[1] = (INT16)total; + + len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); + _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + if (buf != tmp_buf) + Xfree(buf); + goto ErrorOnReCreateIC; + } + _XimFlush(im); + if (buf != tmp_buf) + Xfree(buf); + ic->private.proto.waitCallback = True; + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimCreateICCheck, 0); + if (ret_code == XIM_TRUE) { + preply = reply; + } else if (ret_code == XIM_OVERFLOW) { + if (len <= 0) { + preply = reply; + } else { + buf_size = (int)len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimCreateICCheck, 0); + if (ret_code != XIM_TRUE) { + Xfree(preply); + ic->private.proto.waitCallback = False; + goto ErrorOnReCreateIC; + } + } + } else { + ic->private.proto.waitCallback = False; + goto ErrorOnReCreateIC; + } + ic->private.proto.waitCallback = False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if (reply != preply) + Xfree(preply); + goto ErrorOnReCreateIC; + } + + ic->private.proto.icid = buf_s[1]; /* icid */ + if (reply != preply) + Xfree(preply); + + _XimRegisterFilter(ic); + MARK_IC_CONNECTED(ic); + if (save_ic->private.proto.ic_resources) + Xfree(save_ic->private.proto.ic_resources); + if (save_ic->private.proto.ic_inner_resources) + Xfree(save_ic->private.proto.ic_inner_resources); + Xfree(save_ic); + return True; + +ErrorOnReCreateIC: + memcpy((char *)ic, (char *)save_ic, sizeof(XicRec)); + Xfree(save_ic); + return False; +} + +static char * +_XimDelayModeGetICValues(ic, arg) + Xic ic; + XIMArg *arg; +{ + XimDefICValues ic_values; + + _XimGetCurrentICValues(ic, &ic_values); + return _XimGetICValueData(ic, (XPointer)&ic_values, + ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, + arg, XIM_GETICVALUES); +} +#endif /* XIM_CONNECTABLE */ + +static Bool +_XimGetICValuesCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_GET_IC_VALUES_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +static char * +_XimProtoGetICValues( + XIC xic, + XIMArg *arg) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + register XIMArg *p; + register XIMArg *pp; + register int n; + CARD8 *buf; + CARD16 *buf_s; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply = NULL; + int buf_size; + int ret_code; + char *makeid_name; + char *decode_name; + CARD16 *data = NULL; + INT16 data_len = 0; + +#ifndef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) + return arg->name; +#else + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return _XimDelayModeGetICValues(ic, arg); + } + } else { + return _XimDelayModeGetICValues(ic, arg); + } + } else { + return arg->name; + } + } +#endif /* XIM_CONNECTABLE */ + + for (n = 0, p = arg; p && p->name; p++) { + n++; + if ((strcmp(p->name, XNPreeditAttributes) == 0) + || (strcmp(p->name, XNStatusAttributes) == 0)) { + n++; + for (pp = (XIMArg *)p->value; pp && pp->name; pp++) + n++; + } + } + + if (!n) + return (char *)NULL; + + buf_size = sizeof(CARD16) * n; + buf_size += XIM_HEADER_SIZE + + sizeof(CARD16) + + sizeof(CARD16) + + sizeof(INT16) + + XIM_PAD(2 + buf_size); + + if (!(buf = Xmalloc(buf_size))) + return arg->name; + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + + makeid_name = _XimMakeICAttrIDList(ic, ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, arg, + &buf_s[3], &len, XIM_GETICVALUES); + + if (len > 0) { + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] = len; /* length of ic-attr-id */ + len += sizeof(INT16); /* sizeof length of attr */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_GET_IC_VALUES, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + Xfree(buf); + return arg->name; + } + _XimFlush(im); + Xfree(buf); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimGetICValuesCheck, (XPointer)ic); + if (ret_code == XIM_TRUE) { + preply = reply; + } else if (ret_code == XIM_OVERFLOW) { + if (len <= 0) { + preply = reply; + } else { + buf_size = (int)len; + preply = Xmalloc(len); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimGetICValuesCheck, (XPointer)ic); + if (ret_code != XIM_TRUE) { + if (preply != reply) + Xfree(preply); + return arg->name; + } + } + } else { + return arg->name; + } + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if (reply != preply) + Xfree(preply); + return arg->name; + } + data = &buf_s[4]; + data_len = buf_s[2]; + } + else if (len < 0) { + return arg->name; + } + + decode_name = _XimDecodeICATTRIBUTE(ic, ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, data, data_len, + arg, XIM_GETICVALUES); + if (reply != preply) + Xfree(preply); + + if (decode_name) + return decode_name; + else + return makeid_name; +} + +#ifdef XIM_CONNECTABLE +static Bool +_XimCheckNestQuarkList(quark_list, num_quark, quark, separator) + XrmQuark *quark_list; + int num_quark; + XrmQuark quark; + XrmQuark separator; +{ + register int i; + + for (i = 0; i < num_quark; i++) { + if (quark_list[i] == separator) { + break; + } + if (quark_list[i] == quark) { + return True; + } + } + return False; +} + +static Bool +_XimCheckNestedQuarkList(quark_list, idx, num_quark, arg, separator) + XrmQuark **quark_list; + int idx; + int *num_quark; + XIMArg *arg; + XrmQuark separator; +{ + XrmQuark *q_list = *quark_list; + int n_quark = *num_quark; + register XIMArg *p; + XrmQuark quark; + XrmQuark *tmp; + register int i; + + for (p = arg; p && p->name; p++) { + quark = XrmStringToQuark(p->name); + if (_XimCheckNestQuarkList(&q_list[idx], n_quark - idx, + quark, separator)) { + continue; + } + if (!(tmp = Xmalloc((sizeof(XrmQuark) * (n_quark + 1))))) { + *quark_list = q_list; + *num_quark = n_quark; + return False; + } + n_quark++; + for (i = 0; i < idx; i++) { + tmp[i] = q_list[i]; + } + tmp[i] = quark; + for (i = idx + 1; i < n_quark; i++) { + tmp[i] = q_list[i - 1]; + } + q_list = tmp; + } + *quark_list = q_list; + *num_quark = n_quark; + return True; +} + +static Bool +_XimCheckICQuarkList(quark_list, num_quark, quark, idx) + XrmQuark *quark_list; + int num_quark; + XrmQuark quark; + int *idx; +{ + register int i; + + for (i = 0; i < num_quark; i++) { + if (quark_list[i] == quark) { + *idx = i; + return True; + } + } + return False; +} + +static Bool +_XimSaveICValues(ic, arg) + Xic ic; + XIMArg *arg; +{ + register XIMArg *p; + register int n; + XrmQuark *quark_list; + XrmQuark *tmp; + XrmQuark quark; + int num_quark; + XrmQuark pre_quark; + XrmQuark sts_quark; + XrmQuark separator; + int idx; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + separator = XrmStringToQuark(XNSeparatorofNestedList); + + if (quark_list = ic->private.proto.saved_icvalues) { + num_quark = ic->private.proto.num_saved_icvalues; + for (p = arg; p && p->name; p++) { + quark = XrmStringToQuark(p->name); + if ((quark == pre_quark) || (quark == sts_quark)) { + if (!_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { + register XIMArg *pp; + int nn; + XrmQuark *q_list; + + for (pp = (XIMArg *)p->value, nn = 0; + pp && pp->name; pp++, nn++); + if (!(tmp = Xrealloc(quark_list, + (sizeof(XrmQuark) * (num_quark + nn + 2))))) { + ic->private.proto.saved_icvalues = quark_list; + ic->private.proto.num_saved_icvalues = num_quark; + return False; + } + quark_list = tmp; + q_list = &quark_list[num_quark]; + num_quark += nn + 2; + *q_list++ = quark; + for (pp = (XIMArg *)p->value; + pp && pp->name; pp++, quark_list++) { + *q_list = XrmStringToQuark(pp->name); + } + *q_list = separator; + } else { + if (!_XimCheckNestedQuarkList(&quark_list, idx + 1, + &num_quark, (XIMArg *)p->value, separator)) { + ic->private.proto.saved_icvalues = quark_list; + ic->private.proto.num_saved_icvalues = num_quark; + return False; + } + } + } else { + if (_XimCheckICQuarkList(quark_list, num_quark, quark, &idx)) { + continue; + } + if (!(tmp = Xrealloc(quark_list, + (sizeof(XrmQuark) * (num_quark + 1))))) { + ic->private.proto.saved_icvalues = quark_list; + ic->private.proto.num_saved_icvalues = num_quark; + return False; + } + quark_list = tmp; + quark_list[num_quark] = quark; + num_quark++; + } + } + ic->private.proto.saved_icvalues = quark_list; + ic->private.proto.num_saved_icvalues = num_quark; + return True; + } + + for (p = arg, n = 0; p && p->name; p++, n++) { + if ((!strcmp(p->name, XNPreeditAttributes)) + || (!strcmp(p->name, XNStatusAttributes))) { + register XIMArg *pp; + int nn; + + for (pp = (XIMArg *)p->value, nn = 0; pp && pp->name; pp++, nn++); + n += nn + 1; + } + } + + if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { + return False; + } + + ic->private.proto.saved_icvalues = quark_list; + ic->private.proto.num_saved_icvalues = n; + for (p = arg; p && p->name; p++, quark_list++) { + *quark_list = XrmStringToQuark(p->name); + if ((*quark_list == pre_quark) || (*quark_list == sts_quark)) { + register XIMArg *pp; + + quark_list++; + for (pp = (XIMArg *)p->value; pp && pp->name; pp++, quark_list++) { + *quark_list = XrmStringToQuark(pp->name); + } + *quark_list = separator; + } + } + return True; +} + +static char * +_XimDelayModeSetICValues(ic, arg) + Xic ic; + XIMArg *arg; +{ + XimDefICValues ic_values; + char *name; + + _XimGetCurrentICValues(ic, &ic_values); + name = _XimSetICValueData(ic, (XPointer)&ic_values, + ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, + arg, XIM_SETICVALUES, False); + _XimSetCurrentICValues(ic, &ic_values); + return name; +} +#endif /* XIM_CONNECTABLE */ + +static Bool +_XimSetICValuesCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_SET_IC_VALUES_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +static char * +_XimProtoSetICValues( + XIC xic, + XIMArg *arg) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + XimDefICValues ic_values; + INT16 len; + CARD16 *buf_s; + char *tmp; + CARD32 tmp_buf32[BUFSIZE/4]; + char *tmp_buf = (char *)tmp_buf32; + char *buf; + int buf_size; + char *data; + int data_len; + int ret_len; + int total; + XIMArg *arg_ret; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply = NULL; + int ret_code; + BITMASK32 flag = 0L; + char *name; + char *tmp_name = (arg) ? arg->name : NULL; + +#ifndef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) + return tmp_name; +#else + if (!_XimSaveICValues(ic, arg)) + return NULL; + + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return _XimDelayModeSetICValues(ic, arg); + } + } else { + return _XimDelayModeSetICValues(ic, arg); + } + } else { + return tmp_name; + } + } +#endif /* XIM_CONNECTABLE */ + + _XimGetCurrentICValues(ic, &ic_values); + buf = tmp_buf; + buf_size = XIM_HEADER_SIZE + + sizeof(CARD16) + sizeof(CARD16) + sizeof(INT16) + sizeof(CARD16); + data_len = BUFSIZE - buf_size; + total = 0; + arg_ret = arg; + for (;;) { + data = &buf[buf_size]; + if ((name = _XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, arg, &arg_ret, + data, data_len, &ret_len, (XPointer)&ic_values, + &flag, XIM_SETICVALUES))) { + break; + } + + total += ret_len; + if (!(arg = arg_ret)) { + break; + } + + buf_size += ret_len; + if (buf == tmp_buf) { + if (!(tmp = Xmalloc(buf_size + data_len))) { + return tmp_name; + } + memcpy(tmp, buf, buf_size); + buf = tmp; + } else { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { + Xfree(buf); + return tmp_name; + } + buf = tmp; + } + } + _XimSetCurrentICValues(ic, &ic_values); + + if (!total) { + return tmp_name; + } + + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + +#ifdef EXT_MOVE + if (_XimExtenMove(im, ic, flag, &buf_s[4], (INT16)total)) + return name; +#endif + + buf_s[0] = im->private.proto.imid; + buf_s[1] = ic->private.proto.icid; + buf_s[2] = (INT16)total; + buf_s[3] = 0; + len = (INT16)(sizeof(CARD16) + sizeof(CARD16) + + sizeof(INT16) + sizeof(CARD16) + total); + + _XimSetHeader((XPointer)buf, XIM_SET_IC_VALUES, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + if (buf != tmp_buf) + Xfree(buf); + return tmp_name; + } + _XimFlush(im); + if (buf != tmp_buf) + Xfree(buf); + ic->private.proto.waitCallback = True; + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimSetICValuesCheck, (XPointer)ic); + if (ret_code == XIM_TRUE) { + preply = reply; + } else if (ret_code == XIM_OVERFLOW) { + buf_size = (int)len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimSetICValuesCheck, (XPointer)ic); + if (ret_code != XIM_TRUE) { + Xfree(preply); + ic->private.proto.waitCallback = False; + return tmp_name; + } + } else { + ic->private.proto.waitCallback = False; + return tmp_name; + } + ic->private.proto.waitCallback = False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if (reply != preply) + Xfree(preply); + return tmp_name; + } + if (reply != preply) + Xfree(preply); + + return name; +} + +static Bool +_XimDestroyICCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Bool ret = False; + + if ((major_opcode == XIM_DESTROY_IC_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + ret = True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + ret = False; + return ret; +} + +static void +_XimProtoICFree( + Xic ic) +{ +#ifdef XIM_CONNECTABLE + Xim im = (Xim)ic->core.im; +#endif + + if (ic->private.proto.preedit_font) { + Xfree(ic->private.proto.preedit_font); + ic->private.proto.preedit_font = NULL; + } + if (ic->private.proto.status_font) { + Xfree(ic->private.proto.status_font); + ic->private.proto.status_font = NULL; + } + if (ic->private.proto.commit_info) { + _XimFreeCommitInfo(ic); + ic->private.proto.commit_info = NULL; + } + if (ic->private.proto.ic_inner_resources) { + Xfree(ic->private.proto.ic_inner_resources); + ic->private.proto.ic_inner_resources = NULL; + } + +#ifdef XIM_CONNECTABLE + if (IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { + return; + } +#endif /* XIM_CONNECTABLE */ + + if (ic->private.proto.saved_icvalues) { + Xfree(ic->private.proto.saved_icvalues); + ic->private.proto.saved_icvalues = NULL; + } + if (ic->private.proto.ic_resources) { + Xfree(ic->private.proto.ic_resources); + ic->private.proto.ic_resources = NULL; + } + if (ic->core.hotkey) { + Xfree(ic->core.hotkey); + ic->core.hotkey = NULL; + } + + return; +} + +static void +_XimProtoDestroyIC( + XIC xic) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + + if (IS_SERVER_CONNECTED(im)) { + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_DESTROY_IC, 0, &len); + (void)_XimWrite(im, len, (XPointer)buf); + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimDestroyICCheck, (XPointer)ic); + if (ret_code == XIM_OVERFLOW) { + buf_size = len; + preply = Xmalloc(buf_size); + (void)_XimRead(im, &len, preply, buf_size, + _XimDestroyICCheck, (XPointer)ic); + Xfree(preply); + } + } + UNMARK_IC_CONNECTED(ic); + _XimUnregisterFilter(ic); + _XimProtoICFree(ic); + return; +} + +static void +_XimProtoSetFocus( + XIC xic) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + +#ifndef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) + return; +#else + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return; + } + } else { + return; + } + } else { + return; + } + } +#endif /* XIM_CONNECTABLE */ + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_SET_IC_FOCUS, 0, &len); + (void)_XimWrite(im, len, (XPointer)buf); + _XimFlush(im); + + _XimRegisterFilter(ic); + return; +} + +static void +_XimProtoUnsetFocus( + XIC xic) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + +#ifndef XIM_CONNECTABLE + if (!IS_IC_CONNECTED(ic)) + return; +#else + if (!IS_IC_CONNECTED(ic)) { + if (IS_CONNECTABLE(im)) { + if (_XimConnectServer(im)) { + if (!_XimReCreateIC(ic)) { + _XimDelayModeSetAttr(im); + return; + } + } else { + return; + } + } else { + return; + } + } +#endif /* XIM_CONNECTABLE */ + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_UNSET_IC_FOCUS, 0, &len); + (void)_XimWrite(im, len, (XPointer)buf); + _XimFlush(im); + + _XimUnregisterFilter(ic); + return; +} + +static Bool +_XimResetICCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_RESET_IC_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +static char * +_XimProtoReset( + XIC xic, + char * (*retfunc) (Xim im, Xic ic, XPointer buf) ) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + char *commit; + + if (!IS_IC_CONNECTED(ic)) + return (char *)NULL; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_RESET_IC, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return NULL; + _XimFlush(im); + ic->private.proto.waitCallback = True; + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimResetICCheck, (XPointer)ic); + if (ret_code == XIM_TRUE) { + preply = reply; + } else if (ret_code == XIM_OVERFLOW) { + if (len < 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimResetICCheck, (XPointer)ic); + if (ret_code != XIM_TRUE) { + Xfree(preply); + ic->private.proto.waitCallback = False; + return NULL; + } + } + } else { + ic->private.proto.waitCallback = False; + return NULL; + } + ic->private.proto.waitCallback = False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if (reply != preply) + free(preply); + return NULL; + } + + commit = retfunc(im, ic, (XPointer)&buf_s[2]); + + if (reply != preply) + Xfree(preply); + return commit; +} + +static char * +_XimCommitedMbString( + Xim im, + Xic ic, + XPointer buf) +{ + CARD16 *buf_s = (CARD16 *)buf; + XimCommitInfo info; + int len; + int new_len; + char *commit; + char *new_commit = NULL; + char *str; + Status status; + + len = 0; + for (info = ic->private.proto.commit_info; info; info = info->next) + len += info->string_len; + len += buf_s[0]; + if ( len == 0 ) + return( NULL ); + + if (!(commit = Xmalloc(len + 1))) + goto Error_On_Reset; + + str = commit; + for (info = ic->private.proto.commit_info; info; info = info->next) { + (void)memcpy(str, info->string, info->string_len); + str += info->string_len; + } + (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); + commit[len] = '\0'; + + new_len = im->methods->ctstombs((XIM)im, commit, len, NULL, 0, &status); + if (status != XLookupNone) { + if (!(new_commit = Xmalloc(new_len + 1))) { + Xfree(commit); + goto Error_On_Reset; + } + (void)im->methods->ctstombs((XIM)im, commit, len, + new_commit, new_len, NULL); + new_commit[new_len] = '\0'; + } + Xfree(commit); + +Error_On_Reset: + _XimFreeCommitInfo( ic ); + return new_commit; +} + +static char * +_XimProtoMbReset( + XIC xic) +{ + return _XimProtoReset(xic, _XimCommitedMbString); +} + +static wchar_t * +_XimCommitedWcString( + Xim im, + Xic ic, + XPointer buf) +{ + CARD16 *buf_s = (CARD16 *)buf; + XimCommitInfo info; + int len; + int new_len; + char *commit; + wchar_t *new_commit = (wchar_t *)NULL; + char *str; + Status status; + + len = 0; + for (info = ic->private.proto.commit_info; info; info = info->next) + len += info->string_len; + len += buf_s[0]; + if ( len == 0 ) + return( (wchar_t *)NULL ); + + if (!(commit = Xmalloc(len + 1))) + goto Error_On_Reset; + + str = commit; + for (info = ic->private.proto.commit_info; info; info = info->next) { + (void)memcpy(str, info->string, info->string_len); + str += info->string_len; + } + (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); + commit[len] = '\0'; + + new_len = im->methods->ctstowcs((XIM)im, commit, len, NULL, 0, &status); + if (status != XLookupNone) { + if (!(new_commit = + (wchar_t *)Xmalloc(sizeof(wchar_t) * (new_len + 1)))) { + Xfree(commit); + goto Error_On_Reset; + } + (void)im->methods->ctstowcs((XIM)im, commit, len, + new_commit, new_len, NULL); + new_commit[new_len] = (wchar_t)'\0'; + } + Xfree(commit); + +Error_On_Reset: + _XimFreeCommitInfo( ic ); + return new_commit; +} + +static wchar_t * +_XimProtoWcReset( + XIC xic) +{ + return (wchar_t *) _XimProtoReset(xic, + (char * (*) (Xim, Xic, XPointer)) _XimCommitedWcString); +} + +static char * +_XimCommitedUtf8String( + Xim im, + Xic ic, + XPointer buf) +{ + CARD16 *buf_s = (CARD16 *)buf; + XimCommitInfo info; + int len; + int new_len; + char *commit; + char *new_commit = NULL; + char *str; + Status status; + + len = 0; + for (info = ic->private.proto.commit_info; info; info = info->next) + len += info->string_len; + len += buf_s[0]; + if ( len == 0 ) + return( NULL ); + + if (!(commit = Xmalloc(len + 1))) + goto Error_On_Reset; + + str = commit; + for (info = ic->private.proto.commit_info; info; info = info->next) { + (void)memcpy(str, info->string, info->string_len); + str += info->string_len; + } + (void)memcpy(str, (char *)&buf_s[1], buf_s[0]); + commit[len] = '\0'; + + new_len = im->methods->ctstoutf8((XIM)im, commit, len, NULL, 0, &status); + if (status != XLookupNone) { + if (!(new_commit = Xmalloc(new_len + 1))) { + Xfree(commit); + goto Error_On_Reset; + } + (void)im->methods->ctstoutf8((XIM)im, commit, len, + new_commit, new_len, NULL); + new_commit[new_len] = '\0'; + } + Xfree(commit); + +Error_On_Reset: + _XimFreeCommitInfo( ic ); + return new_commit; +} + +static char * +_XimProtoUtf8Reset( + XIC xic) +{ + return _XimProtoReset(xic, _XimCommitedUtf8String); +} + +static XICMethodsRec ic_methods = { + _XimProtoDestroyIC, /* destroy */ + _XimProtoSetFocus, /* set_focus */ + _XimProtoUnsetFocus, /* unset_focus */ + _XimProtoSetICValues, /* set_values */ + _XimProtoGetICValues, /* get_values */ + _XimProtoMbReset, /* mb_reset */ + _XimProtoWcReset, /* wc_reset */ + _XimProtoUtf8Reset, /* utf8_reset */ + _XimProtoMbLookupString, /* mb_lookup_string */ + _XimProtoWcLookupString, /* wc_lookup_string */ + _XimProtoUtf8LookupString /* utf8_lookup_string */ +}; + +static Bool +_XimGetInputStyle( + XIMArg *arg, + XIMStyle *input_style) +{ + register XIMArg *p; + + for (p = arg; p && p->name; p++) { + if (!(strcmp(p->name, XNInputStyle))) { + *input_style = (XIMStyle)p->value; + return True; + } + } + return False; +} + +#ifdef XIM_CONNECTABLE +static Bool +_XimDelayModeCreateIC( + Xic ic, + XIMArg *values, + XIMResourceList res, + unsigned int num) +{ + Xim im = (Xim)ic->core.im; + XimDefICValues ic_values; + int len; + XIMStyle input_style; + + bzero((char *)&ic_values, sizeof(XimDefICValues)); + _XimGetCurrentICValues(ic, &ic_values); + if (!(_XimGetInputStyle(values, &input_style))) + return False; + + _XimSetICMode(res, num, input_style); + + if (_XimSetICValueData(ic, (XPointer)&ic_values, res, num, + values, XIM_CREATEIC, False)) { + return False; + } + _XimSetCurrentICValues(ic, &ic_values); + if (!_XimSetICDefaults(ic, (XPointer)&ic_values, + XIM_SETICDEFAULTS, res, num)) { + return False; + } + ic_values.filter_events = KeyPressMask; + _XimSetCurrentICValues(ic, &ic_values); + _XimRegisterFilter(ic); + + return True; +} + +Bool +_XimReconnectModeCreateIC(ic) + Xic ic; +{ + Xim im = (Xim)ic->core.im; + int len; + XIMStyle input_style = ic->core.input_style; + XIMResourceList res; + unsigned int num; + + num = im->core.ic_num_resources; + len = sizeof(XIMResource) * num; + if (!(res = Xmalloc(len))) + return False; + (void)memcpy((char *)res, (char *)im->core.ic_resources, len); + ic->private.proto.ic_resources = res; + ic->private.proto.ic_num_resources = num; + + _XimSetICMode(res, num, input_style); + + ic->core.filter_events = KeyPressMask; + + return True; +} +#endif /* XIM_CONNECTABLE */ + +XIC +_XimProtoCreateIC( + XIM xim, + XIMArg *arg) +{ + Xim im = (Xim)xim; + Xic ic; + XimDefICValues ic_values; + XIMResourceList res; + unsigned int num; + XIMStyle input_style; + INT16 len; + CARD16 *buf_s; + char *tmp; + CARD32 tmp_buf32[BUFSIZE/4]; + char *tmp_buf = (char *)tmp_buf32; + char *buf; + int buf_size; + char *data; + int data_len; + int ret_len; + int total; + XIMArg *arg_ret; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int ret_code; + +#ifdef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im) && !IS_CONNECTABLE(im)) + return (XIC)NULL; +#else + if (!IS_SERVER_CONNECTED(im)) + return (XIC)NULL; +#endif /* XIM_CONNECTABLE */ + + if (!(_XimGetInputStyle(arg, &input_style))) + return (XIC)NULL; + + if ((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) + return (XIC)NULL; + + ic->methods = &ic_methods; + ic->core.im = (XIM)im; + ic->core.input_style = input_style; + + num = im->core.ic_num_resources; + len = sizeof(XIMResource) * num; + if (!(res = Xmalloc(len))) + goto ErrorOnCreatingIC; + (void)memcpy((char *)res, (char *)im->core.ic_resources, len); + ic->private.proto.ic_resources = res; + ic->private.proto.ic_num_resources = num; + +#ifdef XIM_CONNECTABLE + if (!_XimSaveICValues(ic, arg)) + return False; + + if (!IS_SERVER_CONNECTED(im)) { + if (!_XimConnectServer(im)) { + if (_XimDelayModeCreateIC(ic, arg, res, num)) { + return (XIC)ic; + } + goto ErrorOnCreatingIC; + } + } +#endif /* XIM_CONNECTABLE */ + + ic->core.filter_events = im->private.proto.forward_event_mask; + ic->private.proto.forward_event_mask = + im->private.proto.forward_event_mask; + ic->private.proto.synchronous_event_mask = + im->private.proto.synchronous_event_mask; + + num = im->private.proto.ic_num_inner_resources; + len = sizeof(XIMResource) * num; + if (!(res = Xmalloc(len))) + goto ErrorOnCreatingIC; + (void)memcpy((char *)res, + (char *)im->private.proto.ic_inner_resources, len); + ic->private.proto.ic_inner_resources = res; + ic->private.proto.ic_num_inner_resources = num; + + _XimSetICMode(ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, input_style); + + _XimSetICMode(ic->private.proto.ic_inner_resources, + ic->private.proto.ic_num_inner_resources, input_style); + + _XimGetCurrentICValues(ic, &ic_values); + buf = tmp_buf; + buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); + data_len = BUFSIZE - buf_size; + total = 0; + arg_ret = arg; + for (;;) { + data = &buf[buf_size]; + if (_XimEncodeICATTRIBUTE(ic, ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources, arg, &arg_ret, data, + data_len, &ret_len, (XPointer)&ic_values, 0, XIM_CREATEIC)) { + goto ErrorOnCreatingIC; + } + + total += ret_len; + if (!(arg = arg_ret)) { + break; + } + + buf_size += ret_len; + if (buf == tmp_buf) { + if (!(tmp = Xmalloc(buf_size + data_len))) { + goto ErrorOnCreatingIC; + } + memcpy(tmp, buf, buf_size); + buf = tmp; + } else { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { + Xfree(buf); + goto ErrorOnCreatingIC; + } + buf = tmp; + } + } + _XimSetCurrentICValues(ic, &ic_values); + + if (!(_XimCheckCreateICValues(ic->private.proto.ic_resources, + ic->private.proto.ic_num_resources))) + goto ErrorOnCreatingIC; + + _XimRegisterFilter(ic); + + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + buf_s[0] = im->private.proto.imid; + buf_s[1] = (INT16)total; + + len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); + _XimSetHeader((XPointer)buf, XIM_CREATE_IC, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + if (buf != tmp_buf) + Xfree(buf); + goto ErrorOnCreatingIC; + } + _XimFlush(im); + if (buf != tmp_buf) + Xfree(buf); + ic->private.proto.waitCallback = True; + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimCreateICCheck, 0); + if (ret_code == XIM_TRUE) { + preply = reply; + } else if (ret_code == XIM_OVERFLOW) { + if (len <= 0) { + preply = reply; + } else { + buf_size = (int)len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimCreateICCheck, 0); + if (ret_code != XIM_TRUE) { + Xfree(preply); + ic->private.proto.waitCallback = False; + goto ErrorOnCreatingIC; + } + } + } else { + ic->private.proto.waitCallback = False; + goto ErrorOnCreatingIC; + } + ic->private.proto.waitCallback = False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if (reply != preply) + Xfree(preply); + goto ErrorOnCreatingIC; + } + + ic->private.proto.icid = buf_s[1]; /* icid */ + if (reply != preply) + Xfree(preply); + MARK_IC_CONNECTED(ic); + return (XIC)ic; + +ErrorOnCreatingIC: + _XimUnregisterFilter(ic); + + Xfree(ic->private.proto.ic_resources); + Xfree(ic->private.proto.ic_inner_resources); + Xfree(ic); + return (XIC)NULL; +} diff --git a/nx-X11/lib/modules/im/ximcp/imDefIm.c b/nx-X11/lib/modules/im/ximcp/imDefIm.c new file mode 100644 index 000000000..2a1ccb4ec --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imDefIm.c @@ -0,0 +1,2042 @@ +/* + * Copyright 1990, 1991, 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/****************************************************************** + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993, 1994 by Sony Corporation + +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 +supporting documentation, and that the names of Digital, FUJITSU +LIMITED and Sony Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. + +DIGITAL, FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL DIGITAL, FUJITSU LIMITED +AND 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. + + Author: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "XlcPublic.h" +#include "XlcPubI.h" +#include "XimTrInt.h" +#include "Ximint.h" + + +int +_XimCheckDataSize( + XPointer buf, + int len) +{ + CARD16 *buf_s = (CARD16 *)buf; + + if(len < XIM_HEADER_SIZE) + return -1; + return buf_s[1]; +} + +void +_XimSetHeader( + XPointer buf, + CARD8 major_opcode, + CARD8 minor_opcode, + INT16 *len +) +{ + CARD8 *buf_b = (CARD8 *)buf; + CARD16 *buf_s = (CARD16 *)buf; + + buf_b[0] = major_opcode; + buf_b[1] = minor_opcode; + buf_s[1] = ((*len) / 4); + *len += XIM_HEADER_SIZE; + return; +} + +char +_XimGetMyEndian(void) +{ + CARD16 test_card = 1; + + if(*((char *)&test_card)) + return LITTLEENDIAN; + else + return BIGENDIAN; +} + +static Bool +_XimCheckServerName( + Xim im, + char *str) +{ + char *server_name = im->core.im_name; + int len; + int str_len; + int category_len = strlen(XIM_SERVER_CATEGORY); + char *pp; + register char *p; + + if(server_name && *server_name) + len = strlen(server_name); + else + return True; + + if((int)strlen(str) < category_len) + return False; + + if(strncmp(str, XIM_SERVER_CATEGORY, category_len)) + return False; + + pp = &str[category_len]; + + for(;;) { + for(p = pp; (*p != ',') && (*p); p++); + str_len = (int)(p - pp); + + if((len == str_len) && (!strncmp(pp, server_name, len))) + break; + if(!(*p)) + return False; + pp = p + 1; + } + return True; +} + +static char * +_XimCheckLocaleName( + Xim im, + char *address, + int address_len, + char *locale_name[], + int len) +{ + int category_len; + char *pp; + register char *p; + register int n; + Bool finish = False; + + category_len = strlen(XIM_LOCAL_CATEGORY); + if(address_len < category_len) + return (char*)NULL; + + if(strncmp(address, XIM_LOCAL_CATEGORY, category_len)) + return (char*)NULL; + + pp = &address[category_len]; + + for(;;) { + for( p = pp; *p && *p != ','; p++); + if (!*p) + finish = True; + address_len = (int)(p - pp); + *p = '\0'; + + for( n = 0; n < len; n++ ) + if( locale_name[n] && !_XlcCompareISOLatin1( pp, locale_name[n] ) ) + return locale_name[n]; + if (finish) + break; + pp = p + 1; + } + return (char *)NULL; +} + +static Bool +_XimCheckTransport( + char *address, + int address_len, + const char *transport, + int len, + char **trans_addr) +{ + int category_len = strlen(XIM_TRANSPORT_CATEGORY); + char *pp; + register char *p; + + if(address_len < category_len) + return False; + + if(strncmp(address, XIM_TRANSPORT_CATEGORY, category_len)) + return False; + + pp = &address[category_len]; + + for(;;) { + *trans_addr = pp; + + for(p = pp; (*p != '/') && (*p != ',') && (*p); p++); + if(*p == ',') { + pp = p + 1; + continue; + } + if(!(*p)) + return False; + + address_len = (int)(p - pp); + + if((len == address_len) && (!strncmp(pp, transport, len))) + break; + pp = p + 1; + } + pp = p + 1; + for(p = pp; (*p != ',') && (*p); p++); + if (*p) + *p = '\0'; + return True; +} + +static Bool +_CheckSNEvent( + Display *display, + XEvent *xevent, + XPointer arg) +{ + XSelectionEvent *event = (XSelectionEvent *)xevent; + Window window = *(Window*)arg; + + if((event->type == SelectionNotify) && (window == event->requestor)) + return True; + return False; +} + +static Bool +_XimGetSelectionNotify( + Display *display, + Window window, + Atom target, + char **ret_address) +{ + XEvent event; + XSelectionEvent *ev = (XSelectionEvent *)&event; + Atom actual_type; + int actual_format; + unsigned long nitems, bytes_after; + + for(;;) { + XIfEvent(display, &event, _CheckSNEvent, (XPointer)&window); + if((ev->type == SelectionNotify) && (window == ev->requestor)) + break; + } + + if(ev->property == (Atom)None) + return False; + if( XGetWindowProperty( display, window, target, 0L, 1000000L, + True, target, &actual_type, &actual_format, + &nitems, &bytes_after, + (unsigned char **)&*ret_address ) != Success ) + return False; + return True; +} + +static Bool +_XimPreConnectionIM( + Xim im, + Atom selection) +{ + Display *display = im->core.display; + Atom locales, transport; + char *address; + XLCd lcd; + char *language; + char *territory; + char *codeset; + char *trans_addr; + char *locale_name[4], *locale; + int llen, tlen, clen; + register int i; + Window window; + char *str; + + if(!(lcd = im->core.lcd)) + return False; + + for( i = 0; i < 4; i++ ) + locale_name[i] = NULL; + /* requestor window */ + if(!(window = XCreateSimpleWindow(display, DefaultRootWindow(display), + 0, 0, 1, 1, 1, 0, 0))) + return False; + + /* server name check */ + if( !(str = XGetAtomName( display, selection )) ) + return False; + if(!_XimCheckServerName(im, str)) { + XFree( (XPointer)str ); + goto Error; + } + XFree( (XPointer)str ); + + /* locale name check */ + _XGetLCValues(lcd, XlcNLanguage, &language, XlcNTerritory, &territory, + XlcNCodeset, &codeset, NULL); + llen = strlen( language ); + tlen = territory ? strlen( territory ): 0; + clen = codeset ? strlen( codeset ): 0; + + if( tlen != 0 && clen != 0 ) { + if( (locale_name[0] = Xmalloc(llen+tlen+clen+3)) != NULL ) + sprintf( locale_name[0], "%s_%s.%s", language, territory, codeset ); + } + if( clen != 0 ) { + if( (locale_name[1] = Xmalloc(llen+clen+2)) != NULL ) + sprintf( locale_name[1], "%s.%s", language, codeset ); + else + goto Error; + } + if( tlen != 0 ) { + if( (locale_name[2] = Xmalloc(llen+tlen+2)) != NULL ) + sprintf( locale_name[2], "%s_%s", language, territory ); + else + goto Error; + } + if( (locale_name[3] = Xmalloc(llen+1)) != NULL ) + strcpy( locale_name[3], language ); + else + goto Error; + if((locales = XInternAtom(display, XIM_LOCALES, True)) == (Atom)None) + goto Error; + + XConvertSelection(display, selection, locales, locales, window, + CurrentTime); + if(!(_XimGetSelectionNotify(display, window, locales, &address))) + goto Error; + + if((locale = _XimCheckLocaleName(im, address, strlen(address), locale_name, + 4)) == NULL) { + XFree((XPointer)address); + goto Error; + } + im->private.proto.locale_name = locale; + for( i = 0; i < 4; i++ ) { + if( locale_name[i] != NULL && locale_name[i] != locale ) { + XFree( locale_name[i] ); + locale_name[i] = NULL; + } + } + XFree((XPointer)address); + + /* transport check */ + if((transport = XInternAtom(display, XIM_TRANSPORT, True)) == (Atom)None) + goto Error; + + XConvertSelection(display, selection, transport, transport, window, + CurrentTime); + if(!_XimGetSelectionNotify(display, window, transport, &address)) + goto Error; + + for(i = 0; _XimTransportRec[i].transportname ; i++) { + if( _XimCheckTransport(address, strlen(address), + _XimTransportRec[i].transportname, + strlen(_XimTransportRec[i].transportname), + &trans_addr)) { + if( _XimTransportRec[i].config(im, trans_addr) ) { + XFree((XPointer)address); + XDestroyWindow(display, window); + return True; + } + } + } + + XFree((XPointer)address); +Error: + for( i = 0; i < 4; i++ ) + if( locale_name[i] != NULL ) + XFree( locale_name[i] ); + XDestroyWindow(display, window); + return False; +} + +static Bool +_XimPreConnect( + Xim im) +{ + Display *display = im->core.display; + Atom imserver; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long bytes_after; + unsigned char *prop_return; + Atom *atoms; + Window im_window = 0; + register int i; + + if((imserver = XInternAtom(display, XIM_SERVERS, True)) == (Atom)None) + return False; + + if(XGetWindowProperty(display, RootWindow(display, 0), + imserver, 0L, 1000000L, False, XA_ATOM, &actual_type, + &actual_format, &nitems, &bytes_after, + &prop_return) != Success) + return False; + + if( (actual_type != XA_ATOM) || (actual_format != 32) ) { + if( nitems ) + XFree((XPointer)prop_return); + return False; + } + + atoms = (Atom *)prop_return; + for(i = 0; i < nitems; i++) { + if((im_window = XGetSelectionOwner(display, atoms[i])) == (Window)None) + continue; + + if(_XimPreConnectionIM(im, atoms[i])) + break; + } + + XFree((XPointer)prop_return); + if(i >= nitems) + return False; + + im->private.proto.im_window = im_window; + return True; +} + +static Bool +_XimGetAuthProtocolNames( + Xim im, + CARD16 *buf, + CARD8 *num, + INT16 *len) +{ + if (!IS_USE_AUTHORIZATION_FUNC(im)) { + *num = 0; + *len = 0; + return True; + } + /* + * Not yet + */ + return True; +} + +static Bool +_XimSetAuthReplyData( + Xim im, + XPointer buf, + INT16 *len) +{ + /* + * Not yet + */ + *len = 0; + return True; +} + +static Bool +_XimSetAuthNextData( + Xim im, + XPointer buf, + INT16 *len) +{ + /* + * Not yet + */ + *len = 0; + return True; +} + +static Bool +_XimSetAuthRequiredData( + Xim im, + XPointer buf, + INT16 *len) +{ + /* + * Not yet + */ + *len = 0; + return True; +} + +static Bool +_XimCheckAuthSetupData( + Xim im, + XPointer buf) +{ + /* + * Not yet + */ + return True; +} + +static Bool +_XimCheckAuthNextData( + Xim im, + XPointer buf) +{ + /* + * Not yet + */ + return True; +} + +#define NO_MORE_AUTH 2 +#define GOOD_AUTH 1 +#define BAD_AUTH 0 + +static int +_XimClientAuthCheck( + Xim im, + XPointer buf) +{ + /* + * Not yet + */ + return NO_MORE_AUTH; +} + +static void +_XimAuthNG( + Xim im) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + INT16 len = 0; + + _XimSetHeader((XPointer)buf, XIM_AUTH_NG, 0, &len); + (void)_XimWrite(im, len, (XPointer)buf); + _XimFlush(im); + return; +} + +static Bool +_XimAllRecv( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + return True; +} + +#define CLIENT_WAIT1 1 +#define CLIENT_WAIT2 2 + +static Bool +_XimConnection( + Xim im) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; + CARD16 *buf_s = (CARD16 *)((XPointer)buf_b); + INT16 len; + CARD8 num; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + CARD8 major_opcode; + int wait_mode; + int ret; + + if(!(_XimConnect(im))) /* Transport Connect */ + return False; + + if(!_XimDispatchInit(im)) + return False; + + _XimRegProtoIntrCallback(im, XIM_ERROR, 0, _XimErrorCallback, (XPointer)im); + + if(!_XimGetAuthProtocolNames(im, &buf_s[4], &num, &len)) + return False; + + im->private.proto.protocol_major_version = PROTOCOLMAJORVERSION; + im->private.proto.protocol_minor_version = PROTOCOLMINORVERSION; + + buf_b[0] = _XimGetMyEndian(); + buf_b[1] = 0; + buf_s[1] = PROTOCOLMAJORVERSION; + buf_s[2] = PROTOCOLMINORVERSION; + buf_s[3] = num; + len += sizeof(CARD8) + + sizeof(CARD8) + + sizeof(CARD16) + + sizeof(CARD16) + + sizeof(CARD16); + + major_opcode = XIM_CONNECT; + wait_mode = (IS_USE_AUTHORIZATION_FUNC(im)) ? CLIENT_WAIT1 : CLIENT_WAIT2; + + for(;;) { + _XimSetHeader((XPointer)buf, major_opcode, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, reply, buf_size, _XimAllRecv, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, _XimAllRecv, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + + major_opcode = *((CARD8 *)preply); + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + + if (wait_mode == CLIENT_WAIT1) { + if (major_opcode == XIM_AUTH_REQUIRED) { + ret = _XimClientAuthCheck(im, (XPointer)buf_s); + if(reply != preply) + Xfree(preply); + if (ret == NO_MORE_AUTH) { + if (!(_XimSetAuthReplyData(im, + (XPointer)&buf[XIM_HEADER_SIZE], &len))) { + _XimAuthNG(im); + return False; + } + major_opcode = XIM_AUTH_REPLY; + wait_mode = CLIENT_WAIT2; + } else if (ret == GOOD_AUTH) { + if (!(_XimSetAuthNextData(im, + (XPointer)&buf[XIM_HEADER_SIZE], &len))) { + _XimAuthNG(im); + return False; + } + major_opcode = XIM_AUTH_NEXT; + } else { /* BAD_AUTH */ + _XimAuthNG(im); + return False; + } + } else { + if(reply != preply) + Xfree(preply); + _XimAuthNG(im); + return False; + } + } else { /* CLIENT_WAIT2 */ + if (major_opcode == XIM_CONNECT_REPLY) { + break; + } else if (major_opcode == XIM_AUTH_SETUP) { + if (!(_XimCheckAuthSetupData(im, (XPointer)buf_s))) { + _XimAuthNG(im); + return False; + } + if(reply != preply) + Xfree(preply); + if (!(_XimSetAuthRequiredData(im, + (XPointer)&buf[XIM_HEADER_SIZE], &len))) { + _XimAuthNG(im); + return False; + } + major_opcode = XIM_AUTH_REQUIRED; + } else if (major_opcode == XIM_AUTH_NEXT) { + if (!(_XimCheckAuthNextData(im, (XPointer)buf_s))) { + _XimAuthNG(im); + return False; + } + if(reply != preply) + Xfree(preply); + if (!(_XimSetAuthRequiredData(im, + (XPointer)&buf[XIM_HEADER_SIZE], &len))) { + _XimAuthNG(im); + return False; + } + major_opcode = XIM_AUTH_REQUIRED; + } else if (major_opcode == XIM_AUTH_NG) { + if(reply != preply) + Xfree(preply); + return False; + } else { + _XimAuthNG(im); + if(reply != preply) + Xfree(preply); + return False; + } + } + } + + if (!( buf_s[0] == im->private.proto.protocol_major_version + && buf_s[1] == im->private.proto.protocol_minor_version)) { + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + MARK_SERVER_CONNECTED(im); + + _XimRegProtoIntrCallback(im, XIM_REGISTER_TRIGGERKEYS, 0, + _XimRegisterTriggerKeysCallback, (XPointer)im); + return True; +} + +static Bool +_XimDisconnectCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + + if ((major_opcode == XIM_DISCONNECT_REPLY) + && (minor_opcode == 0)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0)) + return True; + return False; +} + +static Bool +_XimDisconnect( + Xim im) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + INT16 len = 0; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + + if (IS_SERVER_CONNECTED(im)) { + _XimSetHeader((XPointer)buf, XIM_DISCONNECT, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimDisconnectCheck, 0); + if(ret_code == XIM_OVERFLOW) { + if(len > 0) { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimDisconnectCheck, 0); + Xfree(preply); + if(ret_code != XIM_TRUE) + return False; + } + } else if(ret_code == XIM_FALSE) + return False; + + } + if (!(_XimShutdown(im))) /* Transport shutdown */ + return False; + return True; +} + +static Bool +_XimOpenCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + + if ((major_opcode == XIM_OPEN_REPLY) + && (minor_opcode == 0)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0)) + return True; + return False; +} + +static Bool +_XimOpen( + Xim im) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; + CARD16 *buf_s; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + char *locale_name; + + locale_name = im->private.proto.locale_name; + len = strlen(locale_name); + buf_b[0] = (BYTE)len; /* length of locale name */ + (void)strcpy((char *)&buf_b[1], locale_name); /* locale name */ + len += sizeof(BYTE); /* sizeof length */ + XIM_SET_PAD(buf_b, len); /* pad */ + + _XimSetHeader((XPointer)buf, XIM_OPEN, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, reply, buf_size, + _XimOpenCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimOpenCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + + im->private.proto.imid = buf_s[0]; /* imid */ + + if (!(_XimGetAttributeID(im, &buf_s[1]))) { + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + + if (!(_XimSetInnerIMResourceList(&(im->private.proto.im_inner_resources), + &(im->private.proto.im_num_inner_resources)))) + return False; + + if (!(_XimSetInnerICResourceList(&(im->private.proto.ic_inner_resources), + &(im->private.proto.ic_num_inner_resources)))) + return False; + + _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); + _XimSetIMMode(im->private.proto.im_inner_resources, + im->private.proto.im_num_inner_resources); + + /* Transport Callbak */ + _XimRegProtoIntrCallback(im, XIM_SET_EVENT_MASK, 0, + _XimSetEventMaskCallback, (XPointer)im); + _XimRegProtoIntrCallback(im, XIM_FORWARD_EVENT, 0, + _XimForwardEventCallback, (XPointer)im); + _XimRegProtoIntrCallback(im, XIM_COMMIT, 0, + _XimCommitCallback, (XPointer)im); + _XimRegProtoIntrCallback(im, XIM_SYNC, 0, + _XimSyncCallback, (XPointer)im); + + if(!_XimExtension(im)) + return False; + + /* register a hook for callback protocols */ + _XimRegisterDispatcher(im, _XimCbDispatch, (XPointer)im); + + return True; +} + +static Bool +_XimCloseCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_CLOSE_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +static Bool +_XimClose( + Xim im) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + + if (!IS_SERVER_CONNECTED(im)) + return True; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = 0; /* unused */ + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof unused */ + + _XimSetHeader((XPointer)buf, XIM_CLOSE, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimCloseCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, _XimCloseCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + + if(reply != preply) + Xfree(preply); + return True; +} + +void +_XimProtoIMFree( + Xim im) +{ + /* XIMPrivateRec */ + if (im->private.proto.im_onkeylist) { + Xfree(im->private.proto.im_onkeylist); + im->private.proto.im_onkeylist = NULL; + } + if (im->private.proto.im_offkeylist) { + Xfree(im->private.proto.im_offkeylist); + im->private.proto.im_offkeylist = NULL; + } + if (im->private.proto.intrproto) { + _XimFreeProtoIntrCallback(im); + im->private.proto.intrproto = NULL; + } + if (im->private.proto.im_inner_resources) { + Xfree(im->private.proto.im_inner_resources); + im->private.proto.im_inner_resources = NULL; + } + if (im->private.proto.ic_inner_resources) { + Xfree(im->private.proto.ic_inner_resources); + im->private.proto.ic_inner_resources = NULL; + } + if (im->private.proto.hold_data) { + Xfree(im->private.proto.hold_data); + im->private.proto.hold_data = NULL; + } + if (im->private.proto.locale_name) { + Xfree(im->private.proto.locale_name); + im->private.proto.locale_name = NULL; + } + if (im->private.proto.ctom_conv) { + _XlcCloseConverter(im->private.proto.ctom_conv); + im->private.proto.ctom_conv = NULL; + } + if (im->private.proto.ctow_conv) { + _XlcCloseConverter(im->private.proto.ctow_conv); + im->private.proto.ctow_conv = NULL; + } + if (im->private.proto.ctoutf8_conv) { + _XlcCloseConverter(im->private.proto.ctoutf8_conv); + im->private.proto.ctoutf8_conv = NULL; + } + if (im->private.proto.cstomb_conv) { + _XlcCloseConverter(im->private.proto.cstomb_conv); + im->private.proto.cstomb_conv = NULL; + } + if (im->private.proto.cstowc_conv) { + _XlcCloseConverter(im->private.proto.cstowc_conv); + im->private.proto.cstowc_conv = NULL; + } + if (im->private.proto.cstoutf8_conv) { + _XlcCloseConverter(im->private.proto.cstoutf8_conv); + im->private.proto.cstoutf8_conv = NULL; + } + if (im->private.proto.ucstoc_conv) { + _XlcCloseConverter(im->private.proto.ucstoc_conv); + im->private.proto.ucstoc_conv = NULL; + } + if (im->private.proto.ucstoutf8_conv) { + _XlcCloseConverter(im->private.proto.ucstoutf8_conv); + im->private.proto.ucstoutf8_conv = NULL; + } + +#ifdef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { + return; + } +#endif /* XIM_CONNECTABLE */ + + if (im->private.proto.saved_imvalues) { + Xfree(im->private.proto.saved_imvalues); + im->private.proto.saved_imvalues = NULL; + } + if (im->private.proto.default_styles) { + Xfree(im->private.proto.default_styles); + im->private.proto.default_styles = NULL; + } + + /* core */ + if (im->core.res_name) { + Xfree(im->core.res_name); + im->core.res_name = NULL; + } + if (im->core.res_class) { + Xfree(im->core.res_class); + im->core.res_class = NULL; + } + if (im->core.im_values_list) { + Xfree(im->core.im_values_list); + im->core.im_values_list = NULL; + } + if (im->core.ic_values_list) { + Xfree(im->core.ic_values_list); + im->core.ic_values_list = NULL; + } + if (im->core.im_name) { + Xfree(im->core.im_name); + im->core.im_name = NULL; + } + if (im->core.styles) { + Xfree(im->core.styles); + im->core.styles = NULL; + } + if (im->core.im_resources) { + Xfree(im->core.im_resources); + im->core.im_resources = NULL; + } + if (im->core.ic_resources) { + Xfree(im->core.ic_resources); + im->core.ic_resources = NULL; + } + + return; +} + +static Status +_XimProtoCloseIM( + XIM xim) +{ + Xim im = (Xim)xim; + XIC ic; + XIC next; + Status status; + + ic = im->core.ic_chain; + while (ic) { + (*ic->methods->destroy) (ic); + next = ic->core.next; +#ifdef XIM_CONNECTABLE + if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) { + Xfree (ic); + } +#else + Xfree (ic); +#endif /* XIM_CONNECTABLE */ + ic = next; + } +#ifdef XIM_CONNECTABLE + if (!(!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im))) + im->core.ic_chain = NULL; +#else + im->core.ic_chain = NULL; +#endif + + _XimUnregisterServerFilter(im); + _XimResetIMInstantiateCallback(im); + status = (Status)_XimClose(im); + status = (Status)_XimDisconnect(im) && status; + _XimProtoIMFree(im); +#ifdef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im) && IS_RECONNECTABLE(im)) { + _XimReconnectModeSetAttr(im); + for (ic = im->core.ic_chain; ic; ic = ic->core.next) { + _XimReconnectModeCreateIC(ic); + } + return 0; + } +#endif /* XIM_CONNECTABLE */ + _XimDestroyIMStructureList(im); + return status; +} + +#ifdef XIM_CONNECTABLE +static Bool +_XimCheckIMQuarkList( + XrmQuark *quark_list, + int num_quark, + XrmQuark quark) +{ + register int i; + + for (i = 0; i < num_quark; i++) { + if (quark_list[i] == quark) { + return True; + } + } + return False; +} + +static Bool +_XimSaveIMValues( + Xim im, + XIMArg *arg) +{ + register XIMArg *p; + register int n; + XrmQuark *quark_list; + XrmQuark *tmp; + XrmQuark quark; + int num_quark; + + if (quark_list = im->private.proto.saved_imvalues) { + num_quark = im->private.proto.num_saved_imvalues; + for (p = arg; p && p->name; p++) { + quark = XrmStringToQuark(p->name); + if (_XimCheckIMQuarkList(quark_list, num_quark, quark)) { + continue; + } + if (!(tmp = Xrealloc(quark_list, + (sizeof(XrmQuark) * (num_quark + 1))))) { + im->private.proto.saved_imvalues = quark_list; + im->private.proto.num_saved_imvalues = num_quark; + return False; + } + num_quark++; + quark_list = tmp; + quark_list[num_quark] = quark; + } + im->private.proto.saved_imvalues = quark_list; + im->private.proto.num_saved_imvalues = num_quark; + return True; + } + + for (p = arg, n = 0; p && p->name; p++, n++); + + if (!(quark_list = Xmalloc(sizeof(XrmQuark) * n))) { + return False; + } + + im->private.proto.saved_imvalues = quark_list; + im->private.proto.num_saved_imvalues = n; + for (p = arg; p && p->name; p++, quark_list++) { + *quark_list = XrmStringToQuark(p->name); + } + + return True; +} + +static char * +_XimDelayModeSetIMValues( + Xim im, + XIMArg *arg) +{ + XimDefIMValues im_values; + char *name; + XIMArg *values; + + _XimGetCurrentIMValues(im, &im_values); + name = _XimSetIMValueData(im, (XPointer)&im_values, values, + im->core.im_resources, im->core.im_num_resources); + _XimSetCurrentIMValues(im, &im_values); + + return name; +} +#endif /* XIM_CONNECTABLE */ + +static Bool +_XimSetIMValuesCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_SET_IM_VALUES_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +static char * +_XimProtoSetIMValues( + XIM xim, + XIMArg *arg) +{ + Xim im = (Xim)xim; + XimDefIMValues im_values; + INT16 len; + CARD16 *buf_s; + char *tmp; + CARD32 tmp_buf32[BUFSIZE/4]; + char *tmp_buf = (char *)tmp_buf32; + char *buf; + int buf_size; + char *data; + int data_len; + int ret_len; + int total; + XIMArg *arg_ret; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int ret_code; + char *name; + +#ifndef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im)) + return arg->name; +#else + if (!_XimSaveIMValues(im, arg)) + return arg->name; + + if (!IS_SERVER_CONNECTED(im)) { + if (IS_CONNECTABLE(im)) { + if (!_XimConnectServer(im)) { + return _XimDelayModeSetIMValues(im, arg); + } + } else { + return arg->name; + } + } +#endif /* XIM_CONNECTABLE */ + + _XimGetCurrentIMValues(im, &im_values); + buf = tmp_buf; + buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); + data_len = BUFSIZE - buf_size; + total = 0; + arg_ret = arg; + for (;;) { + data = &buf[buf_size]; + if ((name = _XimEncodeIMATTRIBUTE(im, im->core.im_resources, + im->core.im_num_resources, arg, &arg_ret, data, data_len, + &ret_len, (XPointer)&im_values, XIM_SETIMVALUES))) { + if (buf != tmp_buf) + Xfree(buf); + break; + } + + total += ret_len; + if (!(arg = arg_ret)) { + break; + } + + buf_size += ret_len; + if (buf == tmp_buf) { + if (!(tmp = Xmalloc(buf_size + data_len))) { + return arg->name; + } + memcpy(tmp, buf, buf_size); + buf = tmp; + } else { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { + Xfree(buf); + return arg->name; + } + buf = tmp; + } + } + _XimSetCurrentIMValues(im, &im_values); + + if (!total) + return (char *)NULL; + + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + buf_s[0] = im->private.proto.imid; + buf_s[1] = (INT16)total; + + len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); + _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + if (buf != tmp_buf) + Xfree(buf); + return arg->name; + } + _XimFlush(im); + if (buf != tmp_buf) + Xfree(buf); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimSetIMValuesCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = (int)len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, reply, buf_size, + _XimSetIMValuesCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return arg->name; + } + } + } else + return arg->name; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return arg->name; + } + if(reply != preply) + Xfree(preply); + + return name; +} + +#ifdef XIM_CONNECTABLE +static char * +_XimDelayModeGetIMValues( + Xim im, + XIMArg *arg) +{ + XimDefIMValues im_values; + + _XimGetCurrentIMValues(im, &im_values); + return(_XimGetIMValueData(im, (XPointer)&im_values, arg, + im->core.im_resources, im->core.im_num_resources)); +} +#endif /* XIM_CONNECTABLE */ + +static Bool +_XimGetIMValuesCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_GET_IM_VALUES_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +static char * +_XimProtoGetIMValues( + XIM xim, + XIMArg *arg) +{ + Xim im = (Xim)xim; + register XIMArg *p; + register int n; + CARD8 *buf; + CARD16 *buf_s; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply = NULL; + int buf_size; + int ret_code; + char *makeid_name; + char *decode_name; + CARD16 *data = NULL; + INT16 data_len = 0; + +#ifndef XIM_CONNECTABLE + if (!IS_SERVER_CONNECTED(im)) + return arg->name; +#else + if (!IS_SERVER_CONNECTED(im)) { + if (IS_CONNECTABLE(im)) { + if (!_XimConnectServer(im)) { + return _XimDelayModeGetIMValues(im, arg); + } + } else { + return arg->name; + } + } +#endif /* XIM_CONNECTABLE */ + + for (n = 0, p = arg; p->name; p++) + n++; + + if (!n) + return (char *)NULL; + + buf_size = sizeof(CARD16) * n; + buf_size += XIM_HEADER_SIZE + + sizeof(CARD16) + + sizeof(INT16) + + XIM_PAD(buf_size); + + if (!(buf = Xmalloc(buf_size))) + return arg->name; + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + + makeid_name = _XimMakeIMAttrIDList(im, im->core.im_resources, + im->core.im_num_resources, arg, + &buf_s[2], &len, XIM_GETIMVALUES); + + if (len) { + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = len; /* length of im-attr-id */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += sizeof(CARD16) /* sizeof imid */ + + sizeof(INT16); /* sizeof length of attr */ + + _XimSetHeader((XPointer)buf, XIM_GET_IM_VALUES, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + Xfree(buf); + return arg->name; + } + _XimFlush(im); + Xfree(buf); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimGetIMValuesCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimGetIMValuesCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return arg->name; + } + } + } else + return arg->name; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return arg->name; + } + data = &buf_s[2]; + data_len = buf_s[1]; + } + decode_name = _XimDecodeIMATTRIBUTE(im, im->core.im_resources, + im->core.im_num_resources, data, data_len, + arg, XIM_GETIMVALUES); + if (reply != preply) + Xfree(preply); + + if (decode_name) + return decode_name; + else + return makeid_name; +} + +static XIMMethodsRec im_methods = { + _XimProtoCloseIM, /* close */ + _XimProtoSetIMValues, /* set_values */ + _XimProtoGetIMValues, /* get_values */ + _XimProtoCreateIC, /* create_ic */ + _Ximctstombs, /* ctstombs */ + _Ximctstowcs, /* ctstowcs */ + _Ximctstoutf8 /* ctstoutf8 */ +}; + +static Bool +_XimSetEncodingByName( + Xim im, + char **buf, + int *len) +{ + char *encoding = (char *)NULL; + int encoding_len; + int compound_len; + BYTE *ret; + + _XGetLCValues(im->core.lcd, XlcNCodeset, &encoding, NULL); + if (!encoding) { + *buf = (char *)NULL; + *len = 0; + return True; + } + encoding_len = strlen(encoding); + compound_len = strlen("COMPOUND_TEXT"); + *len = encoding_len + sizeof(BYTE) + compound_len + sizeof(BYTE); + if (!(ret = Xmalloc(*len))) { + return False; + } + *buf = (char *)ret; + + ret[0] = (BYTE)encoding_len; + (void)strncpy((char *)&ret[1], encoding, encoding_len); + ret += (encoding_len + sizeof(BYTE)); + ret[0] = (BYTE)compound_len; + (void)strncpy((char *)&ret[1], "COMPOUND_TEXT", compound_len); + return True; +} + +static Bool +_XimSetEncodingByDetail( + Xim im, + char **buf, + int *len) +{ + *len = 0; + *buf = NULL; + return True; +} + +static Bool +_XimGetEncoding( + Xim im, + CARD16 *buf, + char *name, + int name_len, + char *detail, + int detail_len) +{ + XLCd lcd = im->core.lcd; + CARD16 category = buf[0]; + CARD16 idx = buf[1]; + int len; + XlcConv ctom_conv = NULL; + XlcConv ctow_conv = NULL; + XlcConv ctoutf8_conv = NULL; + XlcConv conv; + XimProtoPrivateRec *private = &im->private.proto; + + if (idx == (CARD16)XIM_Default_Encoding_IDX) { /* XXX */ + if (!(ctom_conv = _XlcOpenConverter(lcd, + XlcNCompoundText, lcd, XlcNMultiByte))) + return False; + if (!(ctow_conv = _XlcOpenConverter(lcd, + XlcNCompoundText, lcd, XlcNWideChar))) + return False; + if (!(ctoutf8_conv = _XlcOpenConverter(lcd, + XlcNCompoundText, lcd, XlcNUtf8String))) + return False; + } + + if (category == XIM_Encoding_NameCategory) { + while (name_len > 0) { + len = (int)name[0]; + if (!strncmp(&name[1], "COMPOUND_TEXT", len)) { + if (!(ctom_conv = _XlcOpenConverter(lcd, + XlcNCompoundText, lcd, XlcNMultiByte))) + return False; + if (!(ctow_conv = _XlcOpenConverter(lcd, + XlcNCompoundText, lcd, XlcNWideChar))) + return False; + if (!(ctoutf8_conv = _XlcOpenConverter(lcd, + XlcNCompoundText, lcd, XlcNUtf8String))) + return False; + break; + } else { + /* + * Not yet + */ + } + len += sizeof(BYTE); + name_len -= len; + name += len; + } + } else if (category == XIM_Encoding_DetailCategory) { + /* + * Not yet + */ + } else { + return False; + } + + private->ctom_conv = ctom_conv; + private->ctow_conv = ctow_conv; + private->ctoutf8_conv = ctoutf8_conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) + return False; + private->cstomb_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) + return False; + private->cstowc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) + return False; + private->cstoutf8_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) + return False; + private->ucstoc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) + return False; + private->ucstoutf8_conv = conv; + + return True; +} + +static Bool +_XimEncodingNegoCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_ENCODING_NEGOTIATION_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +static Bool +_XimEncodingNegotiation( + Xim im) +{ + char *name_ptr = 0; + int name_len = 0; + char *detail_ptr = 0; + int detail_len = 0; + CARD8 *buf; + CARD16 *buf_s; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + + if (!(_XimSetEncodingByName(im, &name_ptr, &name_len))) + return False; + + if (!(_XimSetEncodingByDetail(im, &detail_ptr, &detail_len))) + goto free_name_ptr; + + len = sizeof(CARD16) + + sizeof(INT16) + + name_len + + XIM_PAD(name_len) + + sizeof(INT16) + + sizeof(CARD16) + + detail_len; + + if (!(buf = Xmalloc(XIM_HEADER_SIZE + len))) + goto free_detail_ptr; + + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + + buf_s[0] = im->private.proto.imid; + buf_s[1] = (INT16)name_len; + if (name_ptr) + (void)memcpy((char *)&buf_s[2], name_ptr, name_len); + XIM_SET_PAD(&buf_s[2], name_len); + buf_s = (CARD16 *)((char *)&buf_s[2] + name_len); + buf_s[0] = detail_len; + buf_s[1] = 0; + if (detail_ptr) + (void)memcpy((char *)&buf_s[2], detail_ptr, detail_len); + + _XimSetHeader((XPointer)buf, XIM_ENCODING_NEGOTIATION, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + Xfree(buf); + goto free_detail_ptr; + } + _XimFlush(im); + Xfree(buf); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimEncodingNegoCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimEncodingNegoCheck, 0); + if(ret_code != XIM_TRUE) + goto free_preply; + } + } else + goto free_detail_ptr; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + goto free_preply; + } + + if (!(_XimGetEncoding(im, &buf_s[1], name_ptr, name_len, + detail_ptr, detail_len))) + goto free_preply; + + Xfree(name_ptr); + Xfree(detail_ptr); + + if(reply != preply) + Xfree(preply); + + return True; + +free_preply: + if (reply != preply) + Xfree(preply); + +free_detail_ptr: + Xfree(detail_ptr); + +free_name_ptr: + Xfree(name_ptr); + + return False; +} + +#ifdef XIM_CONNECTABLE +static Bool +_XimSendSavedIMValues( + Xim im) +{ + XimDefIMValues im_values; + INT16 len; + CARD16 *buf_s; + char *tmp; + CARD32 tmp_buf32[BUFSIZE/4]; + char *tmp_buf = (char *)tmp_buf32; + char *buf; + int buf_size; + char *data; + int data_len; + int ret_len; + int total; + int idx; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int ret_code; + + _XimGetCurrentIMValues(im, &im_values); + buf = tmp_buf; + buf_size = XIM_HEADER_SIZE + sizeof(CARD16) + sizeof(INT16); + data_len = BUFSIZE - buf_size; + total = 0; + idx = 0; + for (;;) { + data = &buf[buf_size]; + if (!_XimEncodeSavedIMATTRIBUTE(im, im->core.im_resources, + im->core.im_num_resources, &idx, data, data_len, + &ret_len, (XPointer)&im_values, XIM_SETIMVALUES)) { + if (buf != tmp_buf) + Xfree(buf); + return False; + } + + total += ret_len; + if (idx == -1) { + break; + } + + buf_size += ret_len; + if (buf == tmp_buf) { + if (!(tmp = Xmalloc(buf_size + data_len))) { + return False; + } + memcpy(tmp, buf, buf_size); + buf = tmp; + } else { + if (!(tmp = Xrealloc(buf, (buf_size + data_len)))) { + Xfree(buf); + return False; + } + buf = tmp; + } + } + + if (!total) + return True; + + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + buf_s[0] = im->private.proto.imid; + buf_s[1] = (INT16)total; + + len = (INT16)(sizeof(CARD16) + sizeof(INT16) + total); + _XimSetHeader((XPointer)buf, XIM_SET_IM_VALUES, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + if (buf != tmp_buf) + Xfree(buf); + return False; + } + _XimFlush(im); + if (buf != tmp_buf) + Xfree(buf); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimSetIMValuesCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = (int)len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, reply, buf_size, + _XimSetIMValuesCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + + return True; +} + +static void +_XimDelayModeIMFree( + Xim im) +{ + if (im->core.im_resources) { + Xfree(im->core.im_resources); + im->core.im_resources = NULL; + } + if (im->core.ic_resources) { + Xfree(im->core.ic_resources); + im->core.ic_resources = NULL; + } + if (im->core.im_values_list) { + Xfree(im->core.im_values_list); + im->core.im_values_list = NULL; + } + if (im->core.ic_values_list) { + Xfree(im->core.ic_values_list); + im->core.ic_values_list = NULL; + } + return; +} + +Bool +_XimConnectServer( + Xim im) +{ + Xim save_im; + + if (!(save_im = Xmalloc(sizeof(XimRec)))) + return False; + memcpy((char *)save_im, (char *)im, sizeof(XimRec)); + + if (_XimPreConnect(im) && _XimConnection(im) + && _XimOpen(im) && _XimEncodingNegotiation(im)) { + if (_XimSendSavedIMValues(im)) { + _XimDelayModeIMFree(save_im); + _XimRegisterServerFilter(im); + Xfree(save_im); + return True; + } + } + memcpy((char *)im, (char *)save_im, sizeof(XimRec)); + Xfree(save_im); + return False; +} + +Bool +_XimDelayModeSetAttr( + Xim im) +{ + XimDefIMValues im_values; + + if(!_XimSetIMResourceList(&im->core.im_resources, + &im->core.im_num_resources)) { + return False; + } + if(!_XimSetICResourceList(&im->core.ic_resources, + &im->core.ic_num_resources)) { + return False; + } + + _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); + + _XimGetCurrentIMValues(im, &im_values); + if(!_XimSetLocalIMDefaults(im, (XPointer)&im_values, + im->core.im_resources, im->core.im_num_resources)) { + return False; + } + _XimSetCurrentIMValues(im, &im_values); + if (im->private.proto.default_styles) { + if (im->core.styles) + Xfree(im->core.styles); + im->core.styles = im->private.proto.default_styles; + } + + return True; +} + +static Bool +_XimReconnectModeSetAttr( + Xim im) +{ + XimDefIMValues im_values; + + if(!_XimSetIMResourceList(&im->core.im_resources, + &im->core.im_num_resources)) { + return False; + } + if(!_XimSetICResourceList(&im->core.ic_resources, + &im->core.ic_num_resources)) { + return False; + } + + _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); + + if (im->private.proto.default_styles) { + if (im->core.styles) + Xfree(im->core.styles); + im->core.styles = im->private.proto.default_styles; + } + + return True; +} +#endif /* XIM_CONNECTABLE */ + +Bool +_XimProtoOpenIM( + Xim im) +{ + _XimInitialResourceInfo(); + + im->methods = &im_methods; + +#ifdef XIM_CONNECTABLE + _XimSetProtoResource(im); +#endif /* XIM_CONNECTABLE */ + + if (_XimPreConnect(im)) { + if (_XimConnection(im) && _XimOpen(im) && _XimEncodingNegotiation(im)) { + _XimRegisterServerFilter(im); + return True; + } + _XimShutdown(im); +#ifdef XIM_CONNECTABLE + } else if (IS_DELAYBINDABLE(im)) { + if (_XimDelayModeSetAttr(im)) + return True; +#endif /* XIM_CONNECTABLE */ + } + _XimProtoIMFree(im); + return False; +} diff --git a/nx-X11/lib/modules/im/ximcp/imDefLkup.c b/nx-X11/lib/modules/im/ximcp/imDefLkup.c new file mode 100644 index 000000000..af39008bc --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imDefLkup.c @@ -0,0 +1,1178 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +Xic +_XimICOfXICID( + Xim im, + XICID icid) +{ + Xic pic; + + for (pic = (Xic)im->core.ic_chain; pic; pic = (Xic)pic->core.next) { + if (pic->private.proto.icid == icid) + return pic; + } + return (Xic)0; +} + +static void +_XimProcIMSetEventMask( + Xim im, + XPointer buf) +{ + EVENTMASK *buf_l = (EVENTMASK *)buf; + + im->private.proto.forward_event_mask = buf_l[0]; + im->private.proto.synchronous_event_mask = buf_l[1]; + return; +} + +static void +_XimProcICSetEventMask( + Xic ic, + XPointer buf) +{ + EVENTMASK *buf_l = (EVENTMASK *)buf; + + ic->private.proto.forward_event_mask = buf_l[0]; + ic->private.proto.synchronous_event_mask = buf_l[1]; + _XimReregisterFilter(ic); + return; +} + +Bool +_XimSetEventMaskCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if (imid == im->private.proto.imid) { + if (icid) { + ic = _XimICOfXICID(im, icid); + _XimProcICSetEventMask(ic, (XPointer)&buf_s[2]); + } else { + _XimProcIMSetEventMask(im, (XPointer)&buf_s[2]); + } + return True; + } + return False; +} + +static Bool +_XimSyncCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_SYNC_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +Bool +_XimSync( + Xim im, + Xic ic) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_SYNC, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimSyncCheck, (XPointer)ic); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(len); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimSyncCheck, (XPointer)ic); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else { + return False; + } + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + return True; +} + +Bool +_XimProcSyncReply( + Xim im, + Xic ic) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16); /* sizeof icid */ + + _XimSetHeader((XPointer)buf, XIM_SYNC_REPLY, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + return True; +} + +Bool +_XimRespSyncReply( + Xic ic, + BITMASK16 mode) +{ + if (mode & XimSYNCHRONUS) /* SYNC Request */ + MARK_NEED_SYNC_REPLY(ic->core.im); + + return True; +} + +Bool +_XimSyncCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimProcSyncReply(im, ic); + return True; + } + return False; +} + +static INT16 +_XimSetEventToWire( + XEvent *ev, + xEvent *event) +{ + if (!(_XimProtoEventToWire(ev, event, False))) + return 0; + event->u.u.sequenceNumber = + ((XAnyEvent *)ev)->serial & (unsigned long)0xffff; + return sz_xEvent; +} + +static Bool +_XimForwardEventCore( + Xic ic, + XEvent *ev, + Bool sync) +{ + Xim im = (Xim)ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + INT16 len; + + bzero(buf32, sizeof(buf32)); /* valgrind noticed uninitialized memory use! */ + + if (!(len = _XimSetEventToWire(ev, (xEvent *)&buf_s[4]))) + return False; /* X event */ + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ + buf_s[3] = + (CARD16)((((XAnyEvent *)ev)->serial & ~((unsigned long)0xffff)) >> 16); + /* serial number */ + + len += sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(BITMASK16) /* sizeof flag */ + + sizeof(CARD16); /* sizeof serila number */ + + _XimSetHeader((XPointer)buf, XIM_FORWARD_EVENT, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + + if (sync) { + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimSyncCheck, (XPointer)ic); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(len); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimSyncCheck, (XPointer)ic); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else { + return False; + } + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + } + return True; +} + +Bool +_XimForwardEvent( + Xic ic, + XEvent *ev, + Bool sync) +{ +#ifdef EXT_FORWARD + if (((ev->type == KeyPress) || (ev->type == KeyRelease))) + if (_XimExtForwardKeyEvent(ic, (XKeyEvent *)ev, sync)) + return True; +#endif + return _XimForwardEventCore(ic, ev, sync); +} + +static void +_XimProcEvent( + Display *d, + Xic ic, + XEvent *ev, + CARD16 *buf) +{ + INT16 serial = buf[0]; + xEvent *xev = (xEvent *)&buf[1]; + + _XimProtoWireToEvent(ev, xev, False); + ev->xany.serial |= serial << 16; + ev->xany.send_event = False; + ev->xany.display = d; + MARK_FABRICATED(ic->core.im); + return; +} + +static Bool +_XimForwardEventRecv( + Xim im, + Xic ic, + XPointer buf) +{ + CARD16 *buf_s = (CARD16 *)buf; + Display *d = im->core.display; + XEvent ev; + + _XimProcEvent(d, ic, &ev, &buf_s[1]); + + (void)_XimRespSyncReply(ic, buf_s[0]); + + XPutBackEvent(d, &ev); + + return True; +} + +Bool +_XimForwardEventCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimForwardEventRecv(im, ic, (XPointer)&buf_s[2]); + return True; + } + return False; +} + +static Bool +_XimRegisterTriggerkey( + Xim im, + XPointer buf) +{ + CARD32 *buf_l = (CARD32 *)buf; + CARD32 len; + CARD32 *key; + + if (IS_DYNAMIC_EVENT_FLOW(im)) /* already Dynamic event flow mode */ + return True; + + /* + * register onkeylist + */ + + len = buf_l[0]; /* length of on-keys */ + len += sizeof(INT32); /* sizeof length of on-keys */ + + if (!(key = Xmalloc(len))) { + _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); + return False; + } + memcpy((char *)key, (char *)buf_l, len); + im->private.proto.im_onkeylist = key; + + MARK_DYNAMIC_EVENT_FLOW(im); + + /* + * register offkeylist + */ + + buf_l = (CARD32 *)((char *)buf + len); + len = buf_l[0]; /* length of off-keys */ + len += sizeof(INT32); /* sizeof length of off-keys */ + + if (!(key = Xmalloc(len))) { + _XimError(im, 0, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); + return False; + } + + memcpy((char *)key, (char *)buf_l, len); + im->private.proto.im_offkeylist = key; + + return True; +} + +Bool +_XimRegisterTriggerKeysCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + Xim im = (Xim)call_data; + + (void )_XimRegisterTriggerkey(im, (XPointer)&buf_s[2]); + return True; +} + +EVENTMASK +_XimGetWindowEventmask( + Xic ic) +{ + Xim im = (Xim )ic->core.im; + XWindowAttributes atr; + + if (!XGetWindowAttributes(im->core.display, ic->core.focus_window, &atr)) + return 0; + return (EVENTMASK)atr.your_event_mask; +} + + +static Bool +_XimTriggerNotifyCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_TRIGGER_NOTIFY_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +Bool +_XimTriggerNotify( + Xim im, + Xic ic, + int mode, + CARD32 idx) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + CARD32 *buf_l = (CARD32 *)&buf[XIM_HEADER_SIZE]; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + INT16 len; + EVENTMASK mask = _XimGetWindowEventmask(ic); + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_l[1] = mode; /* flag */ + buf_l[2] = idx; /* index of keys list */ + buf_l[3] = mask; /* select-event-mask */ + + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(CARD32) /* sizeof flag */ + + sizeof(CARD32) /* sizeof index of key list */ + + sizeof(EVENTMASK); /* sizeof select-event-mask */ + + _XimSetHeader((XPointer)buf, XIM_TRIGGER_NOTIFY, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimTriggerNotifyCheck, (XPointer)ic); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(len); + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimTriggerNotifyCheck, (XPointer)ic); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else { + return False; + } + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + return True; +} + +static Bool +_XimRegCommitInfo( + Xic ic, + char *string, + int string_len, + KeySym *keysym, + int keysym_len) +{ + XimCommitInfo info; + + if (!(info = Xmalloc(sizeof(XimCommitInfoRec)))) + return False; + info->string = string; + info->string_len = string_len; + info->keysym = keysym; + info->keysym_len = keysym_len; + info->next = ic->private.proto.commit_info; + ic->private.proto.commit_info = info; + return True; +} + +static void +_XimUnregCommitInfo( + Xic ic) +{ + XimCommitInfo info; + + if (!(info = ic->private.proto.commit_info)) + return; + + + Xfree(info->string); + Xfree(info->keysym); + ic->private.proto.commit_info = info->next; + Xfree(info); + return; +} + +void +_XimFreeCommitInfo( + Xic ic) +{ + while (ic->private.proto.commit_info) + _XimUnregCommitInfo(ic); + return; +} + +static Bool +_XimProcKeySym( + Xic ic, + CARD32 sym, + KeySym **xim_keysym, + int *xim_keysym_len) +{ + Xim im = (Xim)ic->core.im; + + if (!(*xim_keysym = Xmalloc(sizeof(KeySym)))) { + _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); + return False; + } + + **xim_keysym = (KeySym)sym; + *xim_keysym_len = 1; + + return True; +} + +static Bool +_XimProcCommit( + Xic ic, + BYTE *buf, + int len, + char **xim_string, + int *xim_string_len) +{ + Xim im = (Xim)ic->core.im; + char *string; + + if (!(string = Xmalloc(len + 1))) { + _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); + return False; + } + + (void)memcpy(string, (char *)buf, len); + string[len] = '\0'; + + *xim_string = string; + *xim_string_len = len; + return True; +} + +static Bool +_XimCommitRecv( + Xim im, + Xic ic, + XPointer buf) +{ + CARD16 *buf_s = (CARD16 *)buf; + BITMASK16 flag = buf_s[0]; + XKeyEvent ev; + char *string = NULL; + int string_len = 0; + KeySym *keysym = NULL; + int keysym_len = 0; + + if ((flag & XimLookupBoth) == XimLookupChars) { + if (!(_XimProcCommit(ic, (BYTE *)&buf_s[2], + (int)buf_s[1], &string, &string_len))) + return False; + + } else if ((flag & XimLookupBoth) == XimLookupKeySym) { + if (!(_XimProcKeySym(ic, *(CARD32 *)&buf_s[2], &keysym, &keysym_len))) + return False; + + } else if ((flag & XimLookupBoth) == XimLookupBoth) { + if (!(_XimProcKeySym(ic, *(CARD32 *)&buf_s[2], &keysym, &keysym_len))) + return False; + + if (!(_XimProcCommit(ic, (BYTE *)&buf_s[5], + (int)buf_s[4], &string, &string_len))) { + Xfree(keysym); + return False; + } + } + + if (!(_XimRegCommitInfo(ic, string, string_len, keysym, keysym_len))) { + Xfree(string); + Xfree(keysym); + _XimError(im, ic, XIM_BadAlloc, (INT16)0, (CARD16)0, (char *)NULL); + return False; + } + + (void)_XimRespSyncReply(ic, flag); + + if (ic->private.proto.registed_filter_event + & (KEYPRESS_MASK | KEYRELEASE_MASK)) + MARK_FABRICATED(im); + + bzero(&ev, sizeof(ev)); /* uninitialized : found when running kterm under valgrind */ + + ev.type = KeyPress; + ev.send_event = False; + ev.display = im->core.display; + ev.window = ic->core.focus_window; + ev.keycode = 0; + ev.state = 0; + + ev.time = 0L; + ev.serial = LastKnownRequestProcessed(im->core.display); + /* FIXME : + I wish there were COMMENTs (!) about the data passed around. + */ +#if 0 + fprintf(stderr,"%s,%d: putback k press FIXED ev.time=0 ev.serial=%lu\n", __FILE__, __LINE__, ev.serial); +#endif + + XPutBackEvent(im->core.display, (XEvent *)&ev); + + return True; +} + +Bool +_XimCommitCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimCommitRecv(im, ic, (XPointer)&buf_s[2]); + return True; + } + return False; +} + +void +_XimProcError( + Xim im, + Xic ic, + XPointer data) +{ + return; +} + +Bool +_XimErrorCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + BITMASK16 flag = buf_s[2]; + XIMID imid; + XICID icid; + Xim im = (Xim)call_data; + Xic ic = NULL; + + if (flag & XIM_IMID_VALID) { + imid = buf_s[0]; + if (imid != im->private.proto.imid) + return False; + } + if (flag & XIM_ICID_VALID) { + icid = buf_s[1]; + if (!(ic = _XimICOfXICID(im, icid))) + return False; + } + _XimProcError(im, ic, (XPointer)&buf_s[3]); + + return True; +} + +Bool +_XimError( + Xim im, + Xic ic, + CARD16 error_code, + INT16 detail_length, + CARD16 type, + char *detail) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len = 0; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[2] = XIM_IMID_VALID; /* flag */ + if (ic) { + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] |= XIM_ICID_VALID; /* flag */ + } + buf_s[3] = error_code; /* Error Code */ + buf_s[4] = detail_length; /* length of error detail */ + buf_s[5] = type; /* type of error detail */ + + if (detail_length && detail) { + len = detail_length; + memcpy((char *)&buf_s[6], detail, len); + XIM_SET_PAD(&buf_s[6], len); + } + + len += sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(BITMASK16) /* sizeof flag */ + + sizeof(CARD16) /* sizeof error_code */ + + sizeof(INT16) /* sizeof length of detail */ + + sizeof(CARD16); /* sizeof type */ + + _XimSetHeader((XPointer)buf, XIM_ERROR, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + return True; +} + +static int +_Ximctsconvert( + XlcConv conv, + char *from, + int from_len, + char *to, + int to_len, + Status *state) +{ + int from_left; + int to_left; + int from_savelen; + int to_savelen; + int from_cnvlen; + int to_cnvlen; + char *from_buf; + char *to_buf; + char scratchbuf[BUFSIZ]; + Status tmp_state; + + if (!state) + state = &tmp_state; + + if (!conv || !from || !from_len) { + *state = XLookupNone; + return 0; + } + + /* Reset the converter. The CompoundText at 'from' starts in + initial state. */ + _XlcResetConverter(conv); + + from_left = from_len; + to_left = BUFSIZ; + from_cnvlen = 0; + to_cnvlen = 0; + for (;;) { + from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; + if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, + (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { + *state = XLookupNone; + return 0; + } + from_cnvlen += (from_savelen - from_left); + to_cnvlen += (to_savelen - to_left); + if (from_left == 0) { + if (!to_cnvlen) { + *state = XLookupNone; + return 0; + } + break; + } + } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen); + *state = XLookupChars; + } + return to_cnvlen; +} + +int +_Ximctstombs(XIM xim, char *from, int from_len, + char *to, int to_len, Status *state) +{ + return _Ximctsconvert(((Xim)xim)->private.proto.ctom_conv, + from, from_len, to, to_len, state); +} + +int +_Ximctstowcs( + XIM xim, + char *from, + int from_len, + wchar_t *to, + int to_len, + Status *state) +{ + Xim im = (Xim)xim; + XlcConv conv = im->private.proto.ctow_conv; + int from_left; + int to_left; + int from_savelen; + int to_savelen; + int from_cnvlen; + int to_cnvlen; + char *from_buf; + wchar_t *to_buf; + wchar_t scratchbuf[BUFSIZ]; + Status tmp_state; + + if (!state) + state = &tmp_state; + + if (!conv || !from || !from_len) { + *state = XLookupNone; + return 0; + } + + /* Reset the converter. The CompoundText at 'from' starts in + initial state. */ + _XlcResetConverter(conv); + + from_left = from_len; + to_left = BUFSIZ; + from_cnvlen = 0; + to_cnvlen = 0; + for (;;) { + from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; + if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, + (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { + *state = XLookupNone; + return 0; + } + from_cnvlen += (from_savelen - from_left); + to_cnvlen += (to_savelen - to_left); + if (from_left == 0) { + if (!to_cnvlen){ + *state = XLookupNone; + return 0; + } + break; + } + } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); + *state = XLookupChars; + } + return to_cnvlen; +} + +int +_Ximctstoutf8( + XIM xim, + char *from, + int from_len, + char *to, + int to_len, + Status *state) +{ + return _Ximctsconvert(((Xim)xim)->private.proto.ctoutf8_conv, + from, from_len, to, to_len, state); +} + +int +_XimProtoMbLookupString( + XIC xic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *state) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + int ret; + Status tmp_state; + XimCommitInfo info; + + if (!IS_SERVER_CONNECTED(im)) + return 0; + + if (!state) + state = &tmp_state; + + if ((ev->type == KeyPress) && (ev->keycode == 0)) { /* Filter function */ + if (!(info = ic->private.proto.commit_info)) { + *state = XLookupNone; + return 0; + } + + ret = im->methods->ctstombs((XIM)im, info->string, + info->string_len, buffer, bytes, state); + if (*state == XBufferOverflow) + return ret; + if (keysym && (info->keysym && *(info->keysym))) { + *keysym = *(info->keysym); + if (*state == XLookupChars) + *state = XLookupBoth; + else + *state = XLookupKeySym; + } + _XimUnregCommitInfo(ic); + + } else if (ev->type == KeyPress) { + ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); + if (ret > 0) { + if (ret > bytes) + *state = XBufferOverflow; + else if (keysym && *keysym != NoSymbol) + *state = XLookupBoth; + else + *state = XLookupChars; + } else { + if (keysym && *keysym != NoSymbol) + *state = XLookupKeySym; + else + *state = XLookupNone; + } + } else { + *state = XLookupNone; + ret = 0; + } + + return ret; +} + +int +_XimProtoWcLookupString( + XIC xic, + XKeyEvent *ev, + wchar_t *buffer, + int bytes, + KeySym *keysym, + Status *state) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + int ret; + Status tmp_state; + XimCommitInfo info; + + if (!IS_SERVER_CONNECTED(im)) + return 0; + + if (!state) + state = &tmp_state; + + if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ + if (!(info = ic->private.proto.commit_info)) { + *state = XLookupNone; + return 0; + } + + ret = im->methods->ctstowcs((XIM)im, info->string, + info->string_len, buffer, bytes, state); + if (*state == XBufferOverflow) + return ret; + if (keysym && (info->keysym && *(info->keysym))) { + *keysym = *(info->keysym); + if (*state == XLookupChars) + *state = XLookupBoth; + else + *state = XLookupKeySym; + } + _XimUnregCommitInfo(ic); + + } else if (ev->type == KeyPress) { + ret = _XimLookupWCText(ic, ev, buffer, bytes, keysym, NULL); + if (ret > 0) { + if (ret > bytes) + *state = XBufferOverflow; + else if (keysym && *keysym != NoSymbol) + *state = XLookupBoth; + else + *state = XLookupChars; + } else { + if (keysym && *keysym != NoSymbol) + *state = XLookupKeySym; + else + *state = XLookupNone; + } + } else { + *state = XLookupNone; + ret = 0; + } + + return ret; +} + +int +_XimProtoUtf8LookupString( + XIC xic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *state) +{ + Xic ic = (Xic)xic; + Xim im = (Xim)ic->core.im; + int ret; + Status tmp_state; + XimCommitInfo info; + + if (!IS_SERVER_CONNECTED(im)) + return 0; + + if (!state) + state = &tmp_state; + + if (ev->type == KeyPress && ev->keycode == 0) { /* Filter function */ + if (!(info = ic->private.proto.commit_info)) { + *state = XLookupNone; + return 0; + } + + ret = im->methods->ctstoutf8((XIM)im, info->string, + info->string_len, buffer, bytes, state); + if (*state == XBufferOverflow) + return ret; + if (keysym && (info->keysym && *(info->keysym))) { + *keysym = *(info->keysym); + if (*state == XLookupChars) + *state = XLookupBoth; + else + *state = XLookupKeySym; + } + _XimUnregCommitInfo(ic); + + } else if (ev->type == KeyPress) { + ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); + if (ret > 0) { + if (ret > bytes) + *state = XBufferOverflow; + else if (keysym && *keysym != NoSymbol) + *state = XLookupBoth; + else + *state = XLookupChars; + } else { + if (keysym && *keysym != NoSymbol) + *state = XLookupKeySym; + else + *state = XLookupNone; + } + } else { + *state = XLookupNone; + ret = 0; + } + + return ret; +} diff --git a/nx-X11/lib/modules/im/ximcp/imDispch.c b/nx-X11/lib/modules/im/ximcp/imDispch.c new file mode 100644 index 000000000..862a9b651 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imDispch.c @@ -0,0 +1,104 @@ +/****************************************************************** + + Copyright 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xutil.h" +#include "Xlcint.h" +#include "Ximint.h" + + +Bool +_XimRegProtoIntrCallback( + Xim im, + CARD16 major_code, + CARD16 minor_code, + Bool (*proc)( + Xim, INT16, XPointer, XPointer + ), + + XPointer call_data) +{ + XimProtoIntrRec *rec; + + if (!(rec = Xmalloc(sizeof(XimProtoIntrRec)))) + return False; + rec->func = proc; + rec->major_code = major_code; + rec->minor_code = minor_code; + rec->call_data = call_data; + rec->next = im->private.proto.intrproto; + im->private.proto.intrproto = rec; + return True; +} + +void +_XimFreeProtoIntrCallback(Xim im) +{ + register XimProtoIntrRec *rec, *next; + + for (rec = im->private.proto.intrproto; rec;) { + next = rec->next; + Xfree(rec); + rec = next; + } + im->private.proto.intrproto = NULL; + return; +} + +static Bool +_XimTransportIntr( + Xim im, + INT16 len, + XPointer data, + XPointer call_data) +{ + Xim call_im = (Xim)call_data; + XimProtoIntrRec *rec = call_im->private.proto.intrproto; + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + + for (; rec; rec = rec->next) { + if ((major_opcode == (CARD8)rec->major_code) + && (minor_opcode == (CARD8)rec->minor_code)) + if ((*rec->func)(call_im, len, data, rec->call_data)) + return True; + } + return False; +} + +Bool +_XimDispatchInit(Xim im) +{ + if (_XimRegisterDispatcher(im, _XimTransportIntr, (XPointer)im)) + return True; + return False; +} diff --git a/nx-X11/lib/modules/im/ximcp/imEvToWire.c b/nx-X11/lib/modules/im/ximcp/imEvToWire.c new file mode 100644 index 000000000..45677c461 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imEvToWire.c @@ -0,0 +1,788 @@ +/*********************************************************** +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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Ximint.h" + + +#define sw16(n, s) ((s) ? \ + (((n) << 8 & 0xff00) | \ + ((n) >> 8 & 0xff) \ + ) : n) + +#define sw32(n, s) ((s) ? \ + (((n) << 24 & 0xff000000) | \ + ((n) << 8 & 0xff0000) | \ + ((n) >> 8 & 0xff00) | \ + ((n) >> 24 & 0xff) \ + ) : n) + +Status +_XimProtoEventToWire( + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event, /* wire protocol event */ + Bool sw) /* swap byte? */ +{ + switch (event->u.u.type = re->type) { + case KeyPress: + case KeyRelease: + { + register XKeyEvent *ev = (XKeyEvent*) re; + event->u.keyButtonPointer.root = sw32(ev->root, sw); + event->u.keyButtonPointer.event = + sw32(ev->window, sw); + event->u.keyButtonPointer.child = + sw32(ev->subwindow, sw); + event->u.keyButtonPointer.time = sw32(ev->time, sw); + event->u.keyButtonPointer.eventX = sw16(ev->x, sw) ; + event->u.keyButtonPointer.eventY = sw16(ev->y, sw) ; + event->u.keyButtonPointer.rootX = + sw16(ev->x_root, sw); + event->u.keyButtonPointer.rootY = + sw16(ev->y_root, sw); + event->u.keyButtonPointer.state = sw16(ev->state, sw); + event->u.keyButtonPointer.sameScreen = ev->same_screen; + event->u.u.detail = ev->keycode; + } + break; + case ButtonPress: + case ButtonRelease: + { + register XButtonEvent *ev = (XButtonEvent *) re; + event->u.keyButtonPointer.root = sw32(ev->root, sw); + event->u.keyButtonPointer.event = sw32(ev->window, sw); + event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); + event->u.keyButtonPointer.time = sw32(ev->time, sw); + event->u.keyButtonPointer.eventX = sw16(ev->x, sw); + event->u.keyButtonPointer.eventY = sw16(ev->y, sw); + event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); + event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); + event->u.keyButtonPointer.state = sw16(ev->state, sw); + event->u.keyButtonPointer.sameScreen = ev->same_screen; + event->u.u.detail = ev->button; + } + break; + case MotionNotify: + { + register XMotionEvent *ev = (XMotionEvent *)re; + event->u.keyButtonPointer.root = sw32(ev->root, sw); + event->u.keyButtonPointer.event = sw32(ev->window, sw); + event->u.keyButtonPointer.child = sw32(ev->subwindow, sw); + event->u.keyButtonPointer.time = sw32(ev->time, sw); + event->u.keyButtonPointer.eventX= sw16(ev->x, sw); + event->u.keyButtonPointer.eventY= sw16(ev->y, sw); + event->u.keyButtonPointer.rootX = sw16(ev->x_root, sw); + event->u.keyButtonPointer.rootY = sw16(ev->y_root, sw); + event->u.keyButtonPointer.state = sw16(ev->state, sw); + event->u.keyButtonPointer.sameScreen= ev->same_screen; + event->u.u.detail = ev->is_hint; + } + break; + case EnterNotify: + case LeaveNotify: + { + register XCrossingEvent *ev = (XCrossingEvent *) re; + event->u.enterLeave.root = sw32(ev->root, sw); + event->u.enterLeave.event = sw32(ev->window, sw); + event->u.enterLeave.child = sw32(ev->subwindow, sw); + event->u.enterLeave.time = sw32(ev->time, sw); + event->u.enterLeave.eventX = sw16(ev->x, sw); + event->u.enterLeave.eventY = sw16(ev->y, sw); + event->u.enterLeave.rootX = sw16(ev->x_root, sw); + event->u.enterLeave.rootY = sw16(ev->y_root, sw); + event->u.enterLeave.state = sw16(ev->state, sw); + event->u.enterLeave.mode = ev->mode; + event->u.enterLeave.flags = 0; + if (ev->same_screen) { + event->u.enterLeave.flags |= ELFlagSameScreen; + } + if (ev->focus) { + event->u.enterLeave.flags |= ELFlagFocus; + } + event->u.u.detail = ev->detail; + } + break; + case FocusIn: + case FocusOut: + { + register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; + event->u.focus.window = sw32(ev->window, sw); + event->u.focus.mode = ev->mode; + event->u.u.detail = ev->detail; + } + break; + case KeymapNotify: + { + register XKeymapEvent *ev = (XKeymapEvent *) re; + memcpy((char *)(((xKeymapEvent *) event)->map), + &ev->key_vector[1], + sizeof (((xKeymapEvent *) event)->map)); + } + break; + case Expose: + { + register XExposeEvent *ev = (XExposeEvent *) re; + event->u.expose.window = sw32(ev->window, sw); + event->u.expose.x = sw16(ev->x, sw); + event->u.expose.y = sw16(ev->y, sw); + event->u.expose.width = sw16(ev->width, sw); + event->u.expose.height = sw16(ev->height, sw); + event->u.expose.count = sw16(ev->count, sw); + } + break; + case GraphicsExpose: + { + register XGraphicsExposeEvent *ev = + (XGraphicsExposeEvent *) re; + event->u.graphicsExposure.drawable = sw32(ev->drawable, sw); + event->u.graphicsExposure.x = sw16(ev->x, sw); + event->u.graphicsExposure.y = sw16(ev->y, sw); + event->u.graphicsExposure.width = sw16(ev->width, sw); + event->u.graphicsExposure.height = sw16(ev->height, sw); + event->u.graphicsExposure.count = sw16(ev->count, sw); + event->u.graphicsExposure.majorEvent= ev->major_code; + event->u.graphicsExposure.minorEvent= sw16(ev->minor_code, sw); + } + break; + case NoExpose: + { + register XNoExposeEvent *ev = (XNoExposeEvent *) re; + event->u.noExposure.drawable = sw32(ev->drawable, sw); + event->u.noExposure.majorEvent = ev->major_code; + event->u.noExposure.minorEvent = sw16(ev->minor_code, sw); + } + break; + case VisibilityNotify: + { + register XVisibilityEvent *ev = (XVisibilityEvent *) re; + event->u.visibility.window = sw32(ev->window, sw); + event->u.visibility.state = ev->state; + } + break; + case CreateNotify: + { + register XCreateWindowEvent *ev = + (XCreateWindowEvent *) re; + event->u.createNotify.window = sw32(ev->window, sw); + event->u.createNotify.parent = sw32(ev->parent, sw); + event->u.createNotify.x = sw16(ev->x, sw); + event->u.createNotify.y = sw16(ev->y, sw); + event->u.createNotify.width = sw16(ev->width, sw); + event->u.createNotify.height = sw16(ev->height, sw); + event->u.createNotify.borderWidth = sw16(ev->border_width, sw); + event->u.createNotify.override = ev->override_redirect; + } + break; + case DestroyNotify: + { + register XDestroyWindowEvent *ev = + (XDestroyWindowEvent *) re; + event->u.destroyNotify.window = sw32(ev->window, sw); + event->u.destroyNotify.event = sw32(ev->event, sw); + } + break; + case UnmapNotify: + { + register XUnmapEvent *ev = (XUnmapEvent *) re; + event->u.unmapNotify.window = sw32(ev->window, sw); + event->u.unmapNotify.event = sw32(ev->event, sw); + event->u.unmapNotify.fromConfigure = ev->from_configure; + } + break; + case MapNotify: + { + register XMapEvent *ev = (XMapEvent *) re; + event->u.mapNotify.window = sw32(ev->window, sw); + event->u.mapNotify.event = sw32(ev->event, sw); + event->u.mapNotify.override = ev->override_redirect; + } + break; + case MapRequest: + { + register XMapRequestEvent *ev = (XMapRequestEvent *) re; + event->u.mapRequest.window = sw32(ev->window, sw); + event->u.mapRequest.parent = sw32(ev->parent, sw); + } + break; + case ReparentNotify: + { + register XReparentEvent *ev = (XReparentEvent *) re; + event->u.reparent.window = sw32(ev->window, sw); + event->u.reparent.event = sw32(ev->event, sw); + event->u.reparent.parent = sw32(ev->parent, sw); + event->u.reparent.x = sw16(ev->x, sw); + event->u.reparent.y = sw16(ev->y, sw); + event->u.reparent.override = ev->override_redirect; + } + break; + case ConfigureNotify: + { + register XConfigureEvent *ev = (XConfigureEvent *) re; + event->u.configureNotify.window = sw32(ev->window, sw); + event->u.configureNotify.event = sw32(ev->event, sw); + event->u.configureNotify.aboveSibling = sw32(ev->above, sw); + event->u.configureNotify.x = sw16(ev->x, sw); + event->u.configureNotify.y = sw16(ev->y, sw); + event->u.configureNotify.width = sw16(ev->width, sw); + event->u.configureNotify.height = sw16(ev->height, sw); + event->u.configureNotify.borderWidth= sw16(ev->border_width, sw); + event->u.configureNotify.override = ev->override_redirect; + } + break; + case ConfigureRequest: + { + register XConfigureRequestEvent *ev = + (XConfigureRequestEvent *) re; + event->u.configureRequest.window = sw32(ev->window, sw); + event->u.configureRequest.parent = sw32(ev->parent, sw); + event->u.configureRequest.sibling = sw32(ev->above, sw); + event->u.configureRequest.x = sw16(ev->x, sw); + event->u.configureRequest.y = sw16(ev->y, sw); + event->u.configureRequest.width = sw16(ev->width, sw); + event->u.configureRequest.height = sw16(ev->height, sw); + event->u.configureRequest.borderWidth= sw16(ev->border_width, sw); + event->u.configureRequest.valueMask= sw16(ev->value_mask, sw); + event->u.u.detail = ev->detail; + } + break; + case GravityNotify: + { + register XGravityEvent *ev = (XGravityEvent *) re; + event->u.gravity.window = sw32(ev->window, sw); + event->u.gravity.event = sw32(ev->event, sw); + event->u.gravity.x = sw16(ev->x, sw); + event->u.gravity.y = sw16(ev->y, sw); + } + break; + case ResizeRequest: + { + register XResizeRequestEvent *ev = + (XResizeRequestEvent *) re; + event->u.resizeRequest.window = sw32(ev->window, sw); + event->u.resizeRequest.width = sw16(ev->width, sw); + event->u.resizeRequest.height = sw16(ev->height, sw); + } + break; + case CirculateNotify: + { + register XCirculateEvent *ev = (XCirculateEvent *) re; + event->u.circulate.window = sw32(ev->window, sw); + event->u.circulate.event = sw32(ev->event, sw); + event->u.circulate.place = ev->place; + } + break; + case CirculateRequest: + { + register XCirculateRequestEvent *ev = + (XCirculateRequestEvent *) re; + event->u.circulate.window = sw32(ev->window, sw); + event->u.circulate.event = sw32(ev->parent, sw); + event->u.circulate.place = ev->place; + } + break; + case PropertyNotify: + { + register XPropertyEvent *ev = (XPropertyEvent *) re; + event->u.property.window = sw32(ev->window, sw); + event->u.property.atom = sw32(ev->atom, sw); + event->u.property.time = sw32(ev->time, sw); + event->u.property.state = ev->state; + } + break; + case SelectionClear: + { + register XSelectionClearEvent *ev = + (XSelectionClearEvent *) re; + event->u.selectionClear.window = sw32(ev->window, sw); + event->u.selectionClear.atom = sw32(ev->selection, sw); + event->u.selectionClear.time = sw32(ev->time, sw); + } + break; + case SelectionRequest: + { + register XSelectionRequestEvent *ev = + (XSelectionRequestEvent *) re; + event->u.selectionRequest.owner = sw32(ev->owner, sw); + event->u.selectionRequest.requestor = sw32(ev->requestor, sw); + event->u.selectionRequest.selection = sw32(ev->selection, sw); + event->u.selectionRequest.target = sw32(ev->target, sw); + event->u.selectionRequest.property = sw32(ev->property, sw); + event->u.selectionRequest.time = sw32(ev->time, sw); + } + break; + case SelectionNotify: + { + register XSelectionEvent *ev = (XSelectionEvent *) re; + event->u.selectionNotify.requestor = sw32(ev->requestor, sw); + event->u.selectionNotify.selection = sw32(ev->selection, sw); + event->u.selectionNotify.target = sw32(ev->target, sw); + event->u.selectionNotify.property = sw32(ev->property, sw); + event->u.selectionNotify.time = sw32(ev->time, sw); + } + break; + case ColormapNotify: + { + register XColormapEvent *ev = (XColormapEvent *) re; + event->u.colormap.window = sw32(ev->window, sw); + event->u.colormap.colormap = sw32(ev->colormap, sw); + event->u.colormap.new = ev->new; + event->u.colormap.state = ev->state; + } + break; + case ClientMessage: + { + register int i; + register XClientMessageEvent *ev + = (XClientMessageEvent *) re; + event->u.clientMessage.window = sw32(ev->window, sw); + event->u.u.detail = ev->format; + switch (ev->format) { + case 8: + event->u.clientMessage.u.b.type = sw32(ev->message_type, sw); + for (i = 0; i < 20; i++) + event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; + break; + case 16: + event->u.clientMessage.u.s.type = sw32(ev->message_type, sw); + event->u.clientMessage.u.s.shorts0 = sw16(ev->data.s[0], sw); + event->u.clientMessage.u.s.shorts1 = sw16(ev->data.s[1], sw); + event->u.clientMessage.u.s.shorts2 = sw16(ev->data.s[2], sw); + event->u.clientMessage.u.s.shorts3 = sw16(ev->data.s[3], sw); + event->u.clientMessage.u.s.shorts4 = sw16(ev->data.s[4], sw); + event->u.clientMessage.u.s.shorts5 = sw16(ev->data.s[5], sw); + event->u.clientMessage.u.s.shorts6 = sw16(ev->data.s[6], sw); + event->u.clientMessage.u.s.shorts7 = sw16(ev->data.s[7], sw); + event->u.clientMessage.u.s.shorts8 = sw16(ev->data.s[8], sw); + event->u.clientMessage.u.s.shorts9 = sw16(ev->data.s[9], sw); + break; + case 32: + event->u.clientMessage.u.l.type = sw32(ev->message_type, sw); + event->u.clientMessage.u.l.longs0 = sw32(ev->data.l[0], sw); + event->u.clientMessage.u.l.longs1 = sw32(ev->data.l[1], sw); + event->u.clientMessage.u.l.longs2 = sw32(ev->data.l[2], sw); + event->u.clientMessage.u.l.longs3 = sw32(ev->data.l[3], sw); + event->u.clientMessage.u.l.longs4 = sw32(ev->data.l[4], sw); + break; + default: + /* client passing bogus data, let server complain */ + break; + } + } + break; + case MappingNotify: + { + register XMappingEvent *ev = (XMappingEvent *) re; + event->u.mappingNotify.firstKeyCode = ev->first_keycode; + event->u.mappingNotify.request = ev->request; + event->u.mappingNotify.count = ev->count; + } + break; + + default: + return(0); + } + /* Common process */ + if (((XAnyEvent *)re)->send_event) + event->u.u.type |= 0x80; + event->u.u.sequenceNumber = + ((XAnyEvent *)re)->serial & ~((unsigned long)0xffff); + event->u.u.sequenceNumber = sw16(event->u.u.sequenceNumber, sw); + return(1); +} + + +/* + * reformat a wire event into an XEvent structure of the right type. + */ +Bool +_XimProtoWireToEvent( + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event, /* wire protocol event */ + Bool sw) /* swap byte? */ +{ + + re->type = event->u.u.type & 0x7f; + ((XAnyEvent *)re)->serial = sw16(event->u.u.sequenceNumber, sw); + ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); + ((XAnyEvent *)re)->display = NULL; + + /* Ignore the leading bit of the event type since it is set when a + client sends an event rather than the server. */ + + switch (event-> u.u.type & 0177) { + case KeyPress: + case KeyRelease: + { + register XKeyEvent *ev = (XKeyEvent*) re; + ev->root = sw32(event->u.keyButtonPointer.root, sw); + ev->window = sw32(event->u.keyButtonPointer.event, sw); + ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); + ev->time = sw32(event->u.keyButtonPointer.time, sw); + ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); + ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); + ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); + ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); + ev->state = sw16(event->u.keyButtonPointer.state, sw); + ev->same_screen = event->u.keyButtonPointer.sameScreen; + ev->keycode = event->u.u.detail; + } + break; + case ButtonPress: + case ButtonRelease: + { + register XButtonEvent *ev = (XButtonEvent *) re; + ev->root = sw32(event->u.keyButtonPointer.root, sw); + ev->window = sw32(event->u.keyButtonPointer.event, sw); + ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); + ev->time = sw32(event->u.keyButtonPointer.time, sw); + ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); + ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); + ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); + ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); + ev->state = sw16(event->u.keyButtonPointer.state, sw); + ev->same_screen = event->u.keyButtonPointer.sameScreen; + ev->button = event->u.u.detail; + } + break; + case MotionNotify: + { + register XMotionEvent *ev = (XMotionEvent *)re; + ev->root = sw32(event->u.keyButtonPointer.root, sw); + ev->window = sw32(event->u.keyButtonPointer.event, sw); + ev->subwindow = sw32(event->u.keyButtonPointer.child, sw); + ev->time = sw32(event->u.keyButtonPointer.time, sw); + ev->x = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventX, sw)); + ev->y = cvtINT16toInt(sw16(event->u.keyButtonPointer.eventY, sw)); + ev->x_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootX, sw)); + ev->y_root = cvtINT16toInt(sw16(event->u.keyButtonPointer.rootY, sw)); + ev->state = sw16(event->u.keyButtonPointer.state, sw); + ev->same_screen = event->u.keyButtonPointer.sameScreen; + ev->is_hint = event->u.u.detail; + } + break; + case EnterNotify: + case LeaveNotify: + { + register XCrossingEvent *ev = (XCrossingEvent *) re; + ev->root = sw32(event->u.enterLeave.root, sw); + ev->window = sw32(event->u.enterLeave.event, sw); + ev->subwindow = sw32(event->u.enterLeave.child, sw); + ev->time = sw32(event->u.enterLeave.time, sw); + ev->x = cvtINT16toInt(sw16(event->u.enterLeave.eventX, sw)); + ev->y = cvtINT16toInt(sw16(event->u.enterLeave.eventY, sw)); + ev->x_root = cvtINT16toInt(sw16(event->u.enterLeave.rootX, sw)); + ev->y_root = cvtINT16toInt(sw16(event->u.enterLeave.rootY, sw)); + ev->state = sw16(event->u.enterLeave.state, sw); + ev->mode = event->u.enterLeave.mode; + ev->same_screen = (event->u.enterLeave.flags & + ELFlagSameScreen) && True; + ev->focus = (event->u.enterLeave.flags & + ELFlagFocus) && True; + ev->detail = event->u.u.detail; + } + break; + case FocusIn: + case FocusOut: + { + register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; + ev->window = sw32(event->u.focus.window, sw); + ev->mode = event->u.focus.mode; + ev->detail = event->u.u.detail; + } + break; + case KeymapNotify: + { + register XKeymapEvent *ev = (XKeymapEvent *) re; + ev->window = None; + memcpy(&ev->key_vector[1], + (char *)((xKeymapEvent *) event)->map, + sizeof (((xKeymapEvent *) event)->map)); + } + break; + case Expose: + { + register XExposeEvent *ev = (XExposeEvent *) re; + ev->window = sw32(event->u.expose.window, sw); + ev->x = sw16(event->u.expose.x, sw); + ev->y = sw16(event->u.expose.y, sw); + ev->width = sw16(event->u.expose.width, sw); + ev->height = sw16(event->u.expose.height, sw); + ev->count = sw16(event->u.expose.count, sw); + } + break; + case GraphicsExpose: + { + register XGraphicsExposeEvent *ev = + (XGraphicsExposeEvent *) re; + ev->drawable = sw32(event->u.graphicsExposure.drawable, sw); + ev->x = sw16(event->u.graphicsExposure.x, sw); + ev->y = sw16(event->u.graphicsExposure.y, sw); + ev->width = sw16(event->u.graphicsExposure.width, sw); + ev->height = sw16(event->u.graphicsExposure.height, sw); + ev->count = sw16(event->u.graphicsExposure.count, sw); + ev->major_code = event->u.graphicsExposure.majorEvent; + ev->minor_code = sw16(event->u.graphicsExposure.minorEvent, sw); + } + break; + case NoExpose: + { + register XNoExposeEvent *ev = (XNoExposeEvent *) re; + ev->drawable = sw32(event->u.noExposure.drawable, sw); + ev->major_code = event->u.noExposure.majorEvent; + ev->minor_code = sw16(event->u.noExposure.minorEvent, sw); + } + break; + case VisibilityNotify: + { + register XVisibilityEvent *ev = (XVisibilityEvent *) re; + ev->window = sw32(event->u.visibility.window, sw); + ev->state = event->u.visibility.state; + } + break; + case CreateNotify: + { + register XCreateWindowEvent *ev = + (XCreateWindowEvent *) re; + ev->window = sw32(event->u.createNotify.window, sw); + ev->parent = sw32(event->u.createNotify.parent, sw); + ev->x = cvtINT16toInt(sw16(event->u.createNotify.x, sw)); + ev->y = cvtINT16toInt(sw16(event->u.createNotify.y, sw)); + ev->width = sw16(event->u.createNotify.width, sw); + ev->height = sw16(event->u.createNotify.height, sw); + ev->border_width = sw16(event->u.createNotify.borderWidth, sw); + ev->override_redirect = event->u.createNotify.override; + } + break; + case DestroyNotify: + { + register XDestroyWindowEvent *ev = + (XDestroyWindowEvent *) re; + ev->window = sw32(event->u.destroyNotify.window, sw); + ev->event = sw32(event->u.destroyNotify.event, sw); + } + break; + case UnmapNotify: + { + register XUnmapEvent *ev = (XUnmapEvent *) re; + ev->window = sw32(event->u.unmapNotify.window, sw); + ev->event = sw32(event->u.unmapNotify.event, sw); + ev->from_configure = event->u.unmapNotify.fromConfigure; + } + break; + case MapNotify: + { + register XMapEvent *ev = (XMapEvent *) re; + ev->window = sw32(event->u.mapNotify.window, sw); + ev->event = sw32(event->u.mapNotify.event, sw); + ev->override_redirect = event->u.mapNotify.override; + } + break; + case MapRequest: + { + register XMapRequestEvent *ev = (XMapRequestEvent *) re; + ev->window = sw32(event->u.mapRequest.window, sw); + ev->parent = sw32(event->u.mapRequest.parent, sw); + } + break; + case ReparentNotify: + { + register XReparentEvent *ev = (XReparentEvent *) re; + ev->event = sw32(event->u.reparent.event, sw); + ev->window = sw32(event->u.reparent.window, sw); + ev->parent = sw32(event->u.reparent.parent, sw); + ev->x = cvtINT16toInt(sw16(event->u.reparent.x, sw)); + ev->y = cvtINT16toInt(sw16(event->u.reparent.y, sw)); + ev->override_redirect = event->u.reparent.override; + } + break; + case ConfigureNotify: + { + register XConfigureEvent *ev = (XConfigureEvent *) re; + ev->event = sw32(event->u.configureNotify.event, sw); + ev->window = sw32(event->u.configureNotify.window, sw); + ev->above = sw32(event->u.configureNotify.aboveSibling, sw); + ev->x = cvtINT16toInt(sw16(event->u.configureNotify.x, sw)); + ev->y = cvtINT16toInt(sw16(event->u.configureNotify.y, sw)); + ev->width = sw16(event->u.configureNotify.width, sw); + ev->height = sw16(event->u.configureNotify.height, sw); + ev->border_width = sw16(event->u.configureNotify.borderWidth, sw); + ev->override_redirect = event->u.configureNotify.override; + } + break; + case ConfigureRequest: + { + register XConfigureRequestEvent *ev = + (XConfigureRequestEvent *) re; + ev->window = sw32(event->u.configureRequest.window, sw); + ev->parent = sw32(event->u.configureRequest.parent, sw); + ev->above = sw32(event->u.configureRequest.sibling, sw); + ev->x = cvtINT16toInt(sw16(event->u.configureRequest.x, sw)); + ev->y = cvtINT16toInt(sw16(event->u.configureRequest.y, sw)); + ev->width = sw16(event->u.configureRequest.width, sw); + ev->height = sw16(event->u.configureRequest.height, sw); + ev->border_width = sw16(event->u.configureRequest.borderWidth, sw); + ev->value_mask = sw16(event->u.configureRequest.valueMask, sw); + ev->detail = event->u.u.detail; + } + break; + case GravityNotify: + { + register XGravityEvent *ev = (XGravityEvent *) re; + ev->window = sw32(event->u.gravity.window, sw); + ev->event = sw32(event->u.gravity.event, sw); + ev->x = cvtINT16toInt(sw16(event->u.gravity.x, sw)); + ev->y = cvtINT16toInt(sw16(event->u.gravity.y, sw)); + } + break; + case ResizeRequest: + { + register XResizeRequestEvent *ev = + (XResizeRequestEvent *) re; + ev->window = sw32(event->u.resizeRequest.window, sw); + ev->width = sw16(event->u.resizeRequest.width, sw); + ev->height = sw16(event->u.resizeRequest.height, sw); + } + break; + case CirculateNotify: + { + register XCirculateEvent *ev = (XCirculateEvent *) re; + ev->window = sw32(event->u.circulate.window, sw); + ev->event = sw32(event->u.circulate.event, sw); + ev->place = event->u.circulate.place; + } + break; + case CirculateRequest: + { + register XCirculateRequestEvent *ev = + (XCirculateRequestEvent *) re; + ev->window = sw32(event->u.circulate.window, sw); + ev->parent = sw32(event->u.circulate.event, sw); + ev->place = event->u.circulate.place; + } + break; + case PropertyNotify: + { + register XPropertyEvent *ev = (XPropertyEvent *) re; + ev->window = sw32(event->u.property.window, sw); + ev->atom = sw32(event->u.property.atom, sw); + ev->time = sw32(event->u.property.time, sw); + ev->state = event->u.property.state; + } + break; + case SelectionClear: + { + register XSelectionClearEvent *ev = + (XSelectionClearEvent *) re; + ev->window = sw32(event->u.selectionClear.window, sw); + ev->selection = sw32(event->u.selectionClear.atom, sw); + ev->time = sw32(event->u.selectionClear.time, sw); + } + break; + case SelectionRequest: + { + register XSelectionRequestEvent *ev = + (XSelectionRequestEvent *) re; + ev->owner = sw32(event->u.selectionRequest.owner, sw); + ev->requestor = sw32(event->u.selectionRequest.requestor, sw); + ev->selection = sw32(event->u.selectionRequest.selection, sw); + ev->target = sw32(event->u.selectionRequest.target, sw); + ev->property = sw32(event->u.selectionRequest.property, sw); + ev->time = sw32(event->u.selectionRequest.time, sw); + } + break; + case SelectionNotify: + { + register XSelectionEvent *ev = (XSelectionEvent *) re; + ev->requestor = sw32(event->u.selectionNotify.requestor, sw); + ev->selection = sw32(event->u.selectionNotify.selection, sw); + ev->target = sw32(event->u.selectionNotify.target, sw); + ev->property = sw32(event->u.selectionNotify.property, sw); + ev->time = sw32(event->u.selectionNotify.time, sw); + } + break; + case ColormapNotify: + { + register XColormapEvent *ev = (XColormapEvent *) re; + ev->window = sw32(event->u.colormap.window, sw); + ev->colormap = sw32(event->u.colormap.colormap, sw); + ev->new = event->u.colormap.new; + ev->state = event->u.colormap.state; + } + break; + case ClientMessage: + { + register int i; + register XClientMessageEvent *ev + = (XClientMessageEvent *) re; + ev->window = sw32(event->u.clientMessage.window, sw); + ev->format = event->u.u.detail; + switch (ev->format) { + case 8: + ev->message_type = sw32(event->u.clientMessage.u.b.type, sw); + for (i = 0; i < 20; i++) + ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; + break; + case 16: + ev->message_type = sw32(event->u.clientMessage.u.s.type, sw); + ev->data.s[0] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts0, sw)); + ev->data.s[1] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts1, sw)); + ev->data.s[2] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts2, sw)); + ev->data.s[3] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts3, sw)); + ev->data.s[4] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts4, sw)); + ev->data.s[5] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts5, sw)); + ev->data.s[6] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts6, sw)); + ev->data.s[7] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts7, sw)); + ev->data.s[8] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts8, sw)); + ev->data.s[9] = cvtINT16toShort(sw16(event->u.clientMessage.u.s.shorts9, sw)); + break; + case 32: + ev->message_type = sw32(event->u.clientMessage.u.l.type, sw); + ev->data.l[0] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs0, sw)); + ev->data.l[1] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs1, sw)); + ev->data.l[2] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs2, sw)); + ev->data.l[3] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs3, sw)); + ev->data.l[4] = cvtINT32toLong(sw32(event->u.clientMessage.u.l.longs4, sw)); + break; + default: /* XXX should never occur */ + break; + } + } + break; + case MappingNotify: + { + register XMappingEvent *ev = (XMappingEvent *)re; + ev->window = 0; + ev->first_keycode = event->u.mappingNotify.firstKeyCode; + ev->request = event->u.mappingNotify.request; + ev->count = event->u.mappingNotify.count; + } + break; + default: + return(False); + } + return(True); +} diff --git a/nx-X11/lib/modules/im/ximcp/imExten.c b/nx-X11/lib/modules/im/ximcp/imExten.c new file mode 100644 index 000000000..532b18d3b --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imExten.c @@ -0,0 +1,576 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +/* + * index of extensions + */ + +#define XIM_EXT_SET_EVENT_MASK_IDX 0 +#ifdef EXT_FORWARD +#define XIM_EXT_FORWARD_KEYEVENT_IDX 1 +#endif +#ifdef EXT_MOVE +#define XIM_EXT_MOVE_IDX 2 +#endif + +typedef struct _XIM_QueryExtRec { + Bool is_support; + const char *name; + int name_len; + CARD16 major_opcode; + CARD16 minor_opcode; + int idx; +} XIM_QueryExtRec; + +static XIM_QueryExtRec extensions[] = { + {False, "XIM_EXT_SET_EVENT_MASK", 0, 0, 0, + XIM_EXT_SET_EVENT_MASK_IDX}, +#ifdef EXT_FORWARD + {False, "XIM_EXT_FORWARD_KEYEVENT", 0, 0, 0, + XIM_EXT_FORWARD_KEYEVENT_IDX}, +#endif +#ifdef EXT_MOVE + {False, "XIM_EXT_MOVE", 0, 0, 0, XIM_EXT_MOVE_IDX}, +#endif + {False, NULL, 0, 0, 0, 0} /* dummy */ +}; + +static int +_XimIsSupportExt( + int idx) +{ + register int i; + int n = XIMNumber(extensions) - 1; + + for (i = 0; i < n; i++) { + if (extensions[i].idx == idx) { + if (extensions[i].is_support) + return i; + else + break; + } + } + return -1; +} + +static Bool +_XimProcExtSetEventMask( + Xim im, + Xic ic, + XPointer buf) +{ + EVENTMASK *buf_l = (EVENTMASK *)buf; + EVENTMASK select_mask = _XimGetWindowEventmask(ic); + + ic->private.proto.filter_event_mask = buf_l[0]; + ic->private.proto.intercept_event_mask = buf_l[1]; + ic->private.proto.select_event_mask = buf_l[2]; + ic->private.proto.forward_event_mask = buf_l[3]; + ic->private.proto.synchronous_event_mask = buf_l[4]; + + select_mask &= ~ic->private.proto.intercept_event_mask; + /* deselected event mask */ + select_mask |= ic->private.proto.select_event_mask; + /* selected event mask */ + XSelectInput(im->core.display, ic->core.focus_window, select_mask); + _XimReregisterFilter(ic); + + if (!(_XimProcSyncReply(im, ic))) + return False; + return True; +} + +static Bool +_XimExtSetEventMaskCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimProcExtSetEventMask(im, ic, (XPointer)&buf_s[2]); + return True; + } + return False; +} + +#ifdef EXT_FORWARD +static Bool +_XimProcExtForwardKeyEvent( + Xim im, + Xic ic, + XPointer buf) +{ + CARD8 *buf_b = (CARD8 *)buf; + CARD16 *buf_s = (CARD16 *)buf; + CARD32 *buf_l = (CARD32 *)buf; + XEvent ev; + XKeyEvent *kev = (XKeyEvent *)&ev; + + bzero(&ev, sizeof(XEvent)); + kev->send_event = False; + kev->display = im->core.display; + kev->serial = buf_s[1]; /* sequence number */ + kev->type = buf_b[4] & 0x7f; /* xEvent.u.u.type */ + kev->keycode = buf_b[5]; /* Keycode */ + kev->state = buf_s[3]; /* state */ + kev->time = buf_l[2]; /* time */ + + XPutBackEvent(im->core.display, &ev); + + _XimRespSyncReply(ic, buf_s[0]); + MARK_FABRICATED(im); + + return True; +} + +static Bool +_XimExtForwardKeyEventCallback( + Xim xim, + INT16 len, + XPointer data, + XPointer call_data) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + Xim im = (Xim)call_data; + Xic ic; + + if ((imid == im->private.proto.imid) + && (ic = _XimICOfXICID(im, icid))) { + (void)_XimProcExtForwardKeyEvent(im, ic, (XPointer)&buf_s[2]); + return True; + } + return False; +} + +static Bool +_XimExtForwardKeyEventCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + Xic ic = (Xic)arg; + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + XICID icid = buf_s[1]; + + if ((major_opcode == XIM_SYNC_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid) + && (icid == ic->private.proto.icid)) + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid) + && (buf_s[2] & XIM_ICID_VALID) + && (icid == ic->private.proto.icid)) + return True; + return False; +} + +Bool +_XimExtForwardKeyEvent( + Xic ic, + XKeyEvent *ev, + Bool sync) +{ + Xim im = (Xim) ic->core.im; + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD8 *buf_b = &buf[XIM_HEADER_SIZE]; + CARD16 *buf_s = (CARD16 *)buf_b; + CARD32 *buf_l = (CARD32 *)buf_b; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + INT16 len; + int idx; + + if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) < 0) + return False; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] = sync ? XimSYNCHRONUS : 0; /* flag */ + buf_s[3] = (CARD16)(((XAnyEvent *)ev)->serial & ((unsigned long) 0xffff)); + /* sequence number */ + buf_b[8] = ev->type; /* xEvent.u.u.type */ + buf_b[9] = ev->keycode; /* keycode */ + buf_s[5] = ev->state; /* state */ + buf_l[3] = ev->time; /* time */ + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(BITMASK16) /* sizeof flag */ + + sizeof(CARD16) /* sizeof sequence number */ + + sizeof(BYTE) /* sizeof xEvent.u.u.type */ + + sizeof(BYTE) /* sizeof keycode */ + + sizeof(CARD16) /* sizeof state */ + + sizeof(CARD32); /* sizeof time */ + + _XimSetHeader((XPointer)buf, + extensions[idx].major_opcode, + extensions[idx].minor_opcode, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + if (sync) { + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimExtForwardKeyEventCheck, (XPointer)ic); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_sizex = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, preply, buf_size, + _XimExtForwardKeyEventCheck, (XPointer)ic); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + } + return True; +} +#endif /* EXT_FORWARD */ + +static int +_XimCheckExtensionListSize(void) +{ + register int i; + int len; + int total = 0; + int n = XIMNumber(extensions) - 1; + + for (i = 0; i < n; i++) { + len = strlen(extensions[i].name); + extensions[i].name_len = len; + len += sizeof(BYTE); + total += len; + } + return total; +} + +static void +_XimSetExtensionList( + CARD8 *buf) +{ + register int i; + int len; + int n = XIMNumber(extensions) - 1; + + for (i = 0; i < n; i++) { + len = extensions[i].name_len; + buf[0] = (BYTE)len; + (void)strcpy((char *)&buf[1], extensions[i].name); + len += sizeof(BYTE); + buf += len; + } + return; +} + +static unsigned int +_XimCountNumberOfExtension( + INT16 total, + CARD8 *ext) +{ + unsigned int n; + INT16 len; + INT16 min_len = sizeof(CARD8) + + sizeof(CARD8) + + sizeof(INT16); + + n = 0; + while (total > min_len) { + len = *((INT16 *)(&ext[2])); + len += (min_len + XIM_PAD(len)); + total -= len; + ext += len; + n++; + } + return n; +} + +static Bool +_XimParseExtensionList( + Xim im, + CARD16 *data) +{ + int num = XIMNumber(extensions) - 1; + unsigned int n; + CARD8 *buf; + register int i; + register int j; + INT16 len; + + if (!(n = _XimCountNumberOfExtension(data[0], (CARD8 *)&data[1]))) + return True; + + buf = (CARD8 *)&data[1]; + for (i = 0; i < n; i++) { + len = *((INT16 *)(&buf[2])); + for (j = 0; j < num; j++) { + if (!(strncmp(extensions[j].name, (char *)&buf[4], len))) { + extensions[j].major_opcode = buf[0]; + extensions[j].minor_opcode = buf[1]; + extensions[j].is_support = True; + break; + } + } + len += sizeof(CARD8) /* sizeof major_opcode */ + + sizeof(CARD8) /* sizeof minor_opcode */ + + sizeof(INT16) /* sizeof length */ + + XIM_PAD(len); /* sizeof pad */ + buf += len; + } + + return True; +} + +static Bool +_XimQueryExtensionCheck( + Xim im, + INT16 len, + XPointer data, + XPointer arg) +{ + CARD16 *buf_s = (CARD16 *)((CARD8 *)data + XIM_HEADER_SIZE); + CARD8 major_opcode = *((CARD8 *)data); + CARD8 minor_opcode = *((CARD8 *)data + 1); + XIMID imid = buf_s[0]; + + if ((major_opcode == XIM_QUERY_EXTENSION_REPLY) + && (minor_opcode == 0) + && (imid == im->private.proto.imid)) + return True; + if ((major_opcode == XIM_ERROR) + && (minor_opcode == 0) + && (buf_s[2] & XIM_IMID_VALID) + && (imid == im->private.proto.imid)) + return True; + return False; +} + +Bool +_XimExtension( + Xim im) +{ + CARD8 *buf; + CARD16 *buf_s; + int buf_len; + INT16 len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + int idx; + + if (!(len = _XimCheckExtensionListSize())) + return True; + + buf_len = XIM_HEADER_SIZE + + sizeof(CARD16) + + sizeof(INT16) + + len + + XIM_PAD(len); + + if (!(buf = Xmalloc(buf_len))) + return False; + buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = len; /* length of Extensions */ + _XimSetExtensionList((CARD8 *)&buf_s[2]); + /* extensions supported */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += sizeof(CARD16) /* sizeof imid */ + + sizeof(INT16); /* sizeof length of extensions */ + + _XimSetHeader((XPointer)buf, XIM_QUERY_EXTENSION, 0, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) { + XFree(buf); + return False; + } + XFree(buf); + _XimFlush(im); + buf_size = BUFSIZE; + ret_code = _XimRead(im, &len, (XPointer)reply, buf_size, + _XimQueryExtensionCheck, 0); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(len <= 0) { + preply = reply; + } else { + buf_size = len; + preply = Xmalloc(buf_size); + ret_code = _XimRead(im, &len, reply, buf_size, + _XimQueryExtensionCheck, 0); + if(ret_code != XIM_TRUE) { + Xfree(preply); + return False; + } + } + } else + return False; + buf_s = (CARD16 *)((char *)preply + XIM_HEADER_SIZE); + if (*((CARD8 *)preply) == XIM_ERROR) { + _XimProcError(im, 0, (XPointer)&buf_s[3]); + if(reply != preply) + Xfree(preply); + return False; + } + + if (!(_XimParseExtensionList(im, &buf_s[1]))) { + if(reply != preply) + Xfree(preply); + return False; + } + if(reply != preply) + Xfree(preply); + + if ((idx = _XimIsSupportExt(XIM_EXT_SET_EVENT_MASK_IDX)) >= 0) + _XimRegProtoIntrCallback(im, + extensions[idx].major_opcode, + extensions[idx].minor_opcode, + _XimExtSetEventMaskCallback, (XPointer)im); +#ifdef EXT_FORWARD + if ((idx = _XimIsSupportExt(XIM_EXT_FORWARD_KEYEVENT_IDX)) >= 0) + _XimRegProtoIntrCallback(im, + extensions[idx].major_opcode, + extensions[idx].minor_opcode, + _XimExtForwardKeyEventCallback, (XPointer)im); +#endif + + return True; +} + +#ifdef EXT_MOVE +/* flag of ExtenArgCheck */ +#define EXT_XNSPOTLOCATION (1L<<0) + +/* macro for ExtenArgCheck */ +#define SET_EXT_XNSPOTLOCATION(flag) (flag |= EXT_XNSPOTLOCATION) +#define IS_EXT_XNSPOTLOCATION(flag) (flag & EXT_XNSPOTLOCATION) + +/* length of XPoint attribute */ +#define XIM_Xpoint_length 12 + +static Bool +_XimExtMove( + Xim im, + Xic ic, + CARD16 x, + CARD16 y) +{ + CARD32 buf32[BUFSIZE/4]; + CARD8 *buf = (CARD8 *)buf32; + CARD16 *buf_s = (CARD16 *)&buf[XIM_HEADER_SIZE]; + INT16 len; + int idx; + + if ((idx = _XimIsSupportExt(XIM_EXT_MOVE_IDX)) < 0) + return False; + + buf_s[0] = im->private.proto.imid; /* imid */ + buf_s[1] = ic->private.proto.icid; /* icid */ + buf_s[2] = x; /* X */ + buf_s[3] = y; /* Y */ + len = sizeof(CARD16) /* sizeof imid */ + + sizeof(CARD16) /* sizeof icid */ + + sizeof(INT16) /* sizeof X */ + + sizeof(INT16); /* sizeof Y */ + + _XimSetHeader((XPointer)buf, extensions[idx].major_opcode, + extensions[idx].minor_opcode, &len); + if (!(_XimWrite(im, len, (XPointer)buf))) + return False; + _XimFlush(im); + return True; +} + +BITMASK32 +_XimExtenArgCheck( + XIMArg *arg) +{ + CARD32 flag = 0L; + if (!strcmp(arg->name, XNSpotLocation)) + SET_EXT_XNSPOTLOCATION(flag); + return flag; +} + +Bool +_XimExtenMove( + Xim im, + Xic ic, + CARD32 flag, + CARD16 *buf, + INT16 length) +{ + if ((IS_EXT_XNSPOTLOCATION(flag)) && (length == XIM_Xpoint_length)) + return _XimExtMove(im, ic, buf[4], buf[5]); + return False; +} +#endif /* EXT_MOVE */ diff --git a/nx-X11/lib/modules/im/ximcp/imImSw.c b/nx-X11/lib/modules/im/ximcp/imImSw.c new file mode 100644 index 000000000..28b1725a6 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imImSw.c @@ -0,0 +1,55 @@ +/****************************************************************** + + Copyright 1992, 1993 by FUJITSU LIMITED + Copyright 1993 by Digital Equipment Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED and +Digital Equipment Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. FUJITSU LIMITED and Digital Equipment Corporation +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 +THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Modifier: Franky Ling Digital Equipment Corporation + frankyling@hgrd01.enet.dec.com + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "XimImSw.h" + +static Bool +_XimCheckIfDefault( + Xim im) +{ + return(True); +} + +XimImsportSW _XimImSportRec[] = { + { _XimCheckIfLocalProcessing, _XimLocalOpenIM, _XimLocalIMFree }, + { _XimCheckIfThaiProcessing, _XimThaiOpenIM, _XimThaiIMFree }, + { _XimCheckIfDefault, _XimProtoOpenIM, _XimProtoIMFree }, + { NULL, NULL, NULL }, +}; diff --git a/nx-X11/lib/modules/im/ximcp/imInsClbk.c b/nx-X11/lib/modules/im/ximcp/imInsClbk.c new file mode 100644 index 000000000..3ae6b1bd7 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imInsClbk.c @@ -0,0 +1,288 @@ +/****************************************************************** + + Copyright 1993, 1994 by Sony Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 Sony Corporation + not be used in advertising or publicity pertaining to distribution + of the software without specific, written prior permission. +Sony Corporation makes no representations about the suitability of + this software for any purpose. It is provided "as is" without + express or implied warranty. + +SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL 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. + + Author: Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "XlcPublic.h" +#include "Ximint.h" + + +typedef struct _XimInstCallback { + Bool call; + Bool destroy; + Display *display; + XLCd lcd; + char name[XIM_MAXLCNAMELEN]; + char *modifiers; + XrmDatabase rdb; + char *res_name; + char *res_class; + XIDProc callback; + XPointer client_data; + struct _XimInstCallback *next; +} XimInstCallbackRec, *XimInstCallback; + + +static XimInstCallback callback_list = NULL; +static Bool lock = False; + + +static void +MakeLocale( XLCd lcd, char locale[] ) +{ + char *language, *territory, *codeset; + + _XGetLCValues( lcd, XlcNLanguage, &language, XlcNTerritory, &territory, + XlcNCodeset, &codeset, NULL ); + + strcpy( locale, language ); + if( territory && *territory ) { + strcat( locale, "_" ); + strcat( locale, territory ); + } + if( codeset && *codeset ) { + strcat( locale, "." ); + strcat( locale, codeset ); + } +} + + +static Bool +_XimFilterPropertyNotify( + Display *display, + Window window, + XEvent *event, + XPointer client_data) +{ + Atom ims, actual_type, *atoms; + int actual_format; + unsigned long nitems, bytes_after; + int ii; + XIM xim; + Bool flag = False; + XimInstCallback icb, picb, tmp; + + if( (ims = XInternAtom( display, XIM_SERVERS, True )) == None || + event->xproperty.atom != ims || + event->xproperty.state == PropertyDelete ) + return( False ); + + if( XGetWindowProperty( display, RootWindow(display, 0), ims, 0L, 1000000L, + False, XA_ATOM, &actual_type, &actual_format, + &nitems, &bytes_after, (unsigned char **)&atoms ) + != Success ) { + return( False ); + } + if( actual_type != XA_ATOM || actual_format != 32 ) { + XFree( atoms ); + return( False ); + } + + lock = True; + for( ii = 0; ii < nitems; ii++, atoms ) { + if(XGetSelectionOwner (display, atoms[ii])) { + for( icb = callback_list; icb; icb = icb->next ) { + if( !icb->call && !icb->destroy ) { + xim = (*icb->lcd->methods->open_im)( icb->lcd, display, + icb->rdb, + icb->res_name, + icb->res_class ); + if( xim ) { + xim->methods->close( (XIM)xim ); + flag = True; + icb->call = True; + icb->callback( icb->display, icb->client_data, NULL ); + } + } + } + break; + } + } + XFree( atoms ); + + for( icb = callback_list, picb = NULL; icb; ) { + if( icb->destroy ) { + if( picb ) + picb->next = icb->next; + else + callback_list = icb->next; + tmp = icb; + icb = icb->next; + XFree( tmp ); + } + else { + picb = icb; + icb = icb->next; + } + } + lock = False; + + return( flag ); +} + + +Bool +_XimRegisterIMInstantiateCallback( + XLCd lcd, + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data) +{ + XimInstCallback icb, tmp; + XIM xim; + Window root; + XWindowAttributes attr; + + if( lock ) + return( False ); + + icb = Xmalloc(sizeof(XimInstCallbackRec)); + if( !icb ) + return( False ); + icb->call = icb->destroy = False; + icb->display = display; + icb->lcd = lcd; + MakeLocale( lcd, icb->name ); + icb->modifiers = lcd->core->modifiers; /* XXXXX */ + icb->rdb = rdb; + icb->res_name = res_name; + icb->res_class = res_class; + icb->callback = callback; + icb->client_data = client_data; + icb->next = NULL; + + if( !callback_list ) + callback_list = icb; + else { + for( tmp = callback_list; tmp->next; tmp = tmp->next ); + tmp->next = icb; + } + + xim = (*lcd->methods->open_im)( lcd, display, rdb, res_name, res_class ); + + if( icb == callback_list ) { + root = RootWindow( display, 0 ); + XGetWindowAttributes( display, root, &attr ); + _XRegisterFilterByType( display, root, PropertyNotify, PropertyNotify, + _XimFilterPropertyNotify, (XPointer)NULL ); + XSelectInput( display, root, + attr.your_event_mask | PropertyChangeMask ); + } + + if( xim ) { + lock = True; + xim->methods->close( (XIM)xim ); + lock = False; + icb->call = True; + callback( display, client_data, NULL ); + } + + return( True ); +} + + +Bool +_XimUnRegisterIMInstantiateCallback( + XLCd lcd, + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data) +{ + char locale[XIM_MAXLCNAMELEN]; + XimInstCallback icb, picb; + + if( !callback_list ) + return( False ); + + MakeLocale( lcd, locale ); + + for( icb = callback_list, picb = NULL; icb; picb = icb, icb = icb->next ) { + if( !strcmp( locale, icb->name ) && + (lcd->core->modifiers == icb->modifiers || /* XXXXX */ + (lcd->core->modifiers && icb->modifiers && + !strcmp( lcd->core->modifiers, icb->modifiers ))) && + rdb == icb->rdb && /* XXXXX */ + ((res_name == NULL && icb->res_name == NULL) || + (res_name != NULL && icb->res_name != NULL && + !strcmp( res_name, icb->res_name ))) && + ((res_class == NULL && icb->res_class == NULL) || + (res_class != NULL && icb->res_class != NULL && + !strcmp( res_class, icb->res_class ))) && + (callback == icb->callback) && + (client_data == icb->client_data) && /* XXXXX */ + !icb->destroy ) { + if( lock ) + icb->destroy = True; + else { + if( !picb ) { + callback_list = icb->next; + _XUnregisterFilter( display, RootWindow(display, 0), + _XimFilterPropertyNotify, + (XPointer)NULL ); + } + else + picb->next = icb->next; + _XCloseLC( icb->lcd ); + XFree( icb ); + } + return( True ); + } + } + return( False ); +} + + +void +_XimResetIMInstantiateCallback(Xim xim) +{ + char locale[XIM_MAXLCNAMELEN]; + XimInstCallback icb; + XLCd lcd = xim->core.lcd; + + if( !callback_list && lock ) + return; + + MakeLocale( lcd, locale ); + + for( icb = callback_list; icb; icb = icb->next ) + if( !strcmp( locale, icb->name ) && + (lcd->core->modifiers == icb->modifiers || + (lcd->core->modifiers && icb->modifiers && + !strcmp( lcd->core->modifiers, icb->modifiers ))) ) + icb->call = False; +} diff --git a/nx-X11/lib/modules/im/ximcp/imInt.c b/nx-X11/lib/modules/im/ximcp/imInt.c new file mode 100644 index 000000000..05e04dac8 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imInt.c @@ -0,0 +1,260 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "XimImSw.h" + +static Xim *_XimCurrentIMlist = (Xim *)NULL; +static int _XimCurrentIMcount = 0; + +static Bool +_XimSetIMStructureList( + Xim im) +{ + register int i; + Xim *xim; + + if(!(_XimCurrentIMlist)) { + if(!(_XimCurrentIMlist = Xmalloc(sizeof(Xim)))) + return False; + _XimCurrentIMlist[0] = im; + _XimCurrentIMcount = 1; + } + else { + for(i = 0; i < _XimCurrentIMcount; i++) { + if(!( _XimCurrentIMlist[i])) { + _XimCurrentIMlist[i] = im; + break; + } + } + if(i >= _XimCurrentIMcount) { + if(!(xim = Xrealloc(_XimCurrentIMlist, + ((i + 1) * sizeof(Xim))))) + return False; + _XimCurrentIMlist = xim; + _XimCurrentIMlist[_XimCurrentIMcount] = im; + _XimCurrentIMcount++; + } + } + return True; +} + +void +_XimDestroyIMStructureList(Xim im) +{ + register int i; + + for(i = 0; i < _XimCurrentIMcount; i++) { + if(_XimCurrentIMlist[i] == im) { + _XimCurrentIMlist[i] = NULL; + break; + } + } + return; +} + +void +_XimServerDestroy(Xim im_2_destroy) +{ + register int i; + Xim im; + XIC ic; + + for(i = 0; i < _XimCurrentIMcount; i++) { + if(!(im = _XimCurrentIMlist[i])) + continue; + /* + * Only continue if this im is the one to be destroyed. + */ + if (im != im_2_destroy) + continue; + + if (im->core.destroy_callback.callback) + (*im->core.destroy_callback.callback)((XIM)im, + im->core.destroy_callback.client_data, NULL); + for (ic = im->core.ic_chain; ic; ic = ic->core.next) { + if (ic->core.destroy_callback.callback) { + (*ic->core.destroy_callback.callback)(ic, + ic->core.destroy_callback.client_data, NULL); + } + } + _XimResetIMInstantiateCallback( im ); + (void)im->methods->close((XIM)im); + Xfree(im); + _XimCurrentIMlist[i] = NULL; + return; + } +} + +#ifdef XIM_CONNECTABLE +void +_XimServerReconectableDestroy(void) +{ + register int i; + Xim im; + XIC ic; + + for(i = 0; i < _XimCurrentIMcount; i++) { + if(!(im = _XimCurrentIMlist[i])) + continue; + + if (im->core.destroy_callback.callback) + (*im->core.destroy_callback.callback)(im, + im->core.destroy_callback.client_data, NULL); + for (ic = im->core.ic_chain; ic; ic = ic->core.next) { + if (ic->core.destroy_callback.callback) { + (*ic->core.destroy_callback.callback)(ic, + ic->core.destroy_callback.client_data, NULL); + } + } + _XimResetIMInstantiateCallback( im ); + (void)im->methods->close((XIM)im); + } + return; +} +#endif /* XIM_CONNECTABLE */ + +static const char * +_XimStrstr( + register const char *src, + register const char *dest) +{ + int len; + + len = strlen(dest); + while((src = strchr(src, *dest))) { + if(!strncmp(src, dest, len)) + return src; + src++; + } + return NULL; +} + +static char * +_XimMakeImName( + XLCd lcd) +{ + const char* begin = NULL; + const char* end = NULL; + char* ret = NULL; + const char* ximmodifier = XIMMODIFIER; + + if(lcd->core->modifiers != NULL && *lcd->core->modifiers != '\0') { + begin = _XimStrstr(lcd->core->modifiers, ximmodifier); + if (begin != NULL) { + end = begin += strlen(ximmodifier); + while (*end && *end != '@') + end++; + } + } + ret = Xmalloc(end - begin + 1); + if (ret != NULL) { + if (begin != NULL && end != NULL) { + (void)strncpy(ret, begin, end - begin); + ret[end - begin] = '\0'; + } else { + ret[0] = '\0'; + } + } + + return ret; +} + +XIM +_XimOpenIM( + XLCd lcd, + Display *dpy, + XrmDatabase rdb, + char *res_name, + char *res_class) +{ + Xim im; + register int i; + + if (!(im = Xcalloc(1, sizeof(XimRec)))) + return (XIM)NULL; + + im->core.lcd = lcd; + im->core.ic_chain = (XIC)NULL; + im->core.display = dpy; + im->core.rdb = rdb; + im->core.res_name = NULL; + im->core.res_class = NULL; + if((res_name != NULL) && (*res_name != '\0')){ + if(!(im->core.res_name = strdup(res_name))) + goto Error1; + } + if((res_class != NULL) && (*res_class != '\0')){ + if(!(im->core.res_class = strdup(res_class))) + goto Error2; + } + if(!(im->core.im_name = _XimMakeImName(lcd))) + goto Error3; + + for(i= 0; ; i++) { + if(_XimImSportRec[i].checkprocessing(im)) { + if(!(_XimImSportRec[i].im_open(im))) + goto Error4; + if(!_XimSetIMStructureList(im)) + goto Error4; + return (XIM)im; + } + } + +Error4 : + _XimImSportRec[i].im_free(im); + Xfree(im); + return NULL; +Error3 : + Xfree(im->core.im_name); +Error2: + Xfree(im->core.res_class); +Error1: + Xfree(im->core.res_name); + Xfree(im); + return NULL; +} + +Bool +_XInitIM(XLCd lcd) +{ + if(lcd == (XLCd)NULL) + return False; + lcd->methods->open_im = _XimOpenIM; + lcd->methods->register_callback = _XimRegisterIMInstantiateCallback; + lcd->methods->unregister_callback = _XimUnRegisterIMInstantiateCallback; + return True; +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcFlt.c b/nx-X11/lib/modules/im/ximcp/imLcFlt.c new file mode 100644 index 000000000..50f4c252a --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcFlt.c @@ -0,0 +1,157 @@ +/****************************************************************** + + Copyright 1992 by Fuji Xerox Co., Ltd. + Copyright 1992, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 Fuji Xerox, +FUJITSU LIMITED not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. Fuji Xerox, FUJITSU LIMITED make no representations +about the suitability of this software for any purpose. +It is provided "as is" without express or implied warranty. + +FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, +FUJITSU LIMITED 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 : Kazunori Nishihara Fuji Xerox + Modifier : Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "Xlcint.h" +#include "Ximint.h" + +Bool +_XimLocalFilter(Display *d, Window w, XEvent *ev, XPointer client_data) +{ + Xic ic = (Xic)client_data; + KeySym keysym; + static char buf[256]; + static unsigned prevcode = 0, prevstate = 0; + unsigned currstate; + DefTree *b = ic->private.local.base.tree; + DTIndex t; + Bool braille = False, anymodifier = False; + + if(ev->xkey.keycode == 0) + return (False); + + XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); + + if(keysym >= XK_braille_dot_1 && keysym <= XK_braille_dot_8) { + if(ev->type == KeyPress) { + ic->private.local.brl_pressed |= + 1<<(keysym-XK_braille_dot_1); + return(True); + } else { + if(!ic->private.local.brl_committing + || ev->xkey.time - ic->private.local.brl_release_start > 300) { + ic->private.local.brl_committing = ic->private.local.brl_pressed; + ic->private.local.brl_release_start = ev->xkey.time; + } + ic->private.local.brl_pressed &= ~(1<<(keysym-XK_braille_dot_1)); + if(!ic->private.local.brl_pressed && ic->private.local.brl_committing) { + /* Commited a braille pattern, let it go through compose tree */ + keysym = XK_braille_blank | ic->private.local.brl_committing; + ev->type = KeyPress; + braille = True; + } else { + return(True); + } + } + } + + if(((Xim)ic->core.im)->private.local.top == 0 ) + goto emit_braille; + + currstate = ev->xkey.state; + if(ev->type == KeyPress) { + prevcode = ev->xkey.keycode; + prevstate = currstate; + + if(IsModifierKey(keysym)) + return(False); + prevcode = 0; + } else { + if(prevcode != ev->xkey.keycode) + return False; + + /* For lookup, we use the state at the time when the key was pressed, */ + /* because this state was not affected by the modifier that is mapped */ + /* to the key. */ + ev->xkey.state = prevstate; + XLookupString((XKeyEvent *)ev, buf, sizeof(buf), &keysym, NULL); + } + + for(t = ic->private.local.context; t; t = b[t].next) { + if(IsModifierKey(b[t].keysym)) + anymodifier = True; + if(((ev->xkey.state & b[t].modifier_mask) == b[t].modifier) && + (keysym == b[t].keysym)) + break; + } + + /* Restore the state */ + ev->xkey.state = currstate; + + if(t) { /* Matched */ + if(b[t].succession) { /* Intermediate */ + ic->private.local.context = b[t].succession; + return (ev->type == KeyPress); + } else { /* Terminate (reached to leaf) */ + ic->private.local.composed = t; + ic->private.local.brl_committed = 0; + /* return back to client KeyPressEvent keycode == 0 */ + ev->xkey.keycode = 0; + ev->xkey.type = KeyPress; + XPutBackEvent(d, ev); + if(prevcode){ + /* For modifier key releases, restore the event, as we do not */ + /* filter it. */ + ev->xkey.type = KeyRelease; + ev->xkey.keycode = prevcode; + } + /* initialize internal state for next key sequence */ + ic->private.local.context = ((Xim)ic->core.im)->private.local.top; + return (ev->type == KeyPress); + } + } else { /* Unmatched */ + /* Unmatched modifier key releases abort matching only in the case that */ + /* there was any modifier that would have matched */ + if((ic->private.local.context == ((Xim)ic->core.im)->private.local.top) || + (ev->type == KeyRelease && !anymodifier)) { + goto emit_braille; + } + /* Error (Sequence Unmatch occured) */ + /* initialize internal state for next key sequence */ + ic->private.local.context = ((Xim)ic->core.im)->private.local.top; + return (ev->type == KeyPress); + } + +emit_braille: + if(braille) { + /* Braille pattern is not in compose tree, emit alone */ + ic->private.local.brl_committed = ic->private.local.brl_committing; + ic->private.local.composed = 0; + ev->xkey.keycode = 0; + _XPutBackEvent(d, ev); + return(True); + } + return(False); +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcGIc.c b/nx-X11/lib/modules/im/ximcp/imLcGIc.c new file mode 100644 index 000000000..003b3897a --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcGIc.c @@ -0,0 +1,47 @@ +/****************************************************************** + + Copyright 1992,1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +char * +_XimLocalGetICValues(XIC xic, XIMArg *values) +{ + Xic ic = (Xic)xic; + XimDefICValues ic_values; + + _XimGetCurrentICValues(ic, &ic_values); + return(_XimGetICValueData(ic, (XPointer)&ic_values, + ic->private.local.ic_resources, + ic->private.local.ic_num_resources, + values, XIM_GETICVALUES)); +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcIc.c b/nx-X11/lib/modules/im/ximcp/imLcIc.c new file mode 100644 index 000000000..7ab9050c1 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcIc.c @@ -0,0 +1,199 @@ +/****************************************************************** + + Copyright 1992,1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +static void +_XimLocalUnSetFocus( + XIC xic) +{ + Xic ic = (Xic)xic; + ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; + + if (ic->core.focus_window) + _XUnregisterFilter(ic->core.im->core.display, + ic->core.focus_window, _XimLocalFilter, (XPointer)ic); + return; +} + +static void +_XimLocalDestroyIC( + XIC xic) +{ + Xic ic = (Xic)xic; + + if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { + ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; + } + if (ic->core.focus_window) + _XUnregisterFilter(ic->core.im->core.display, + ic->core.focus_window, _XimLocalFilter, (XPointer)ic); + if(ic->private.local.ic_resources) { + Xfree(ic->private.local.ic_resources); + ic->private.local.ic_resources = NULL; + } + return; +} + +static void +_XimLocalSetFocus( + XIC xic) +{ + Xic ic = (Xic)xic; + XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; + + if (current_ic == (XIC)ic) + return; + + if (current_ic != (XIC)NULL) { + _XimLocalUnSetFocus(current_ic); + } + ((Xim)ic->core.im)->private.local.current_ic = (XIC)ic; + + if (ic->core.focus_window) + _XRegisterFilterByType(ic->core.im->core.display, + ic->core.focus_window, KeyPress, KeyRelease, + _XimLocalFilter, (XPointer)ic); + return; +} + +static void +_XimLocalReset( + XIC xic) +{ + Xic ic = (Xic)xic; + ic->private.local.composed = 0; + ic->private.local.context = ((Xim)ic->core.im)->private.local.top; + ic->private.local.brl_pressed = 0; + ic->private.local.brl_committing = 0; + ic->private.local.brl_committed = 0; +} + +static char * +_XimLocalMbReset( + XIC xic) +{ + _XimLocalReset(xic); + return (char *)NULL; +} + +static wchar_t * +_XimLocalWcReset( + XIC xic) +{ + _XimLocalReset(xic); + return (wchar_t *)NULL; +} + +static XICMethodsRec Local_ic_methods = { + _XimLocalDestroyIC, /* destroy */ + _XimLocalSetFocus, /* set_focus */ + _XimLocalUnSetFocus, /* unset_focus */ + _XimLocalSetICValues, /* set_values */ + _XimLocalGetICValues, /* get_values */ + _XimLocalMbReset, /* mb_reset */ + _XimLocalWcReset, /* wc_reset */ + _XimLocalMbReset, /* utf8_reset */ + _XimLocalMbLookupString, /* mb_lookup_string */ + _XimLocalWcLookupString, /* wc_lookup_string */ + _XimLocalUtf8LookupString /* utf8_lookup_string */ +}; + +XIC +_XimLocalCreateIC( + XIM im, + XIMArg *values) +{ + Xic ic; + XimDefICValues ic_values; + XIMResourceList res; + unsigned int num; + int len; + + if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) { + return ((XIC)NULL); + } + + ic->methods = &Local_ic_methods; + ic->core.im = im; + ic->private.local.base = ((Xim)im)->private.local.base; + ic->private.local.context = ((Xim)im)->private.local.top; + ic->private.local.composed = 0; + ic->private.local.brl_pressed = 0; + ic->private.local.brl_committing = 0; + ic->private.local.brl_committed = 0; + + num = im->core.ic_num_resources; + len = sizeof(XIMResource) * num; + if((res = Xmalloc(len)) == (XIMResourceList)NULL) { + goto Set_Error; + } + (void)memcpy((char *)res, (char *)im->core.ic_resources, len); + ic->private.local.ic_resources = res; + ic->private.local.ic_num_resources = num; + + bzero((char *)&ic_values, sizeof(XimDefICValues)); + if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, + im->core.styles, res, num) == False) { + goto Set_Error; + } + + _XimSetICMode(res, num, ic_values.input_style); + + if(_XimSetICValueData(ic, (XPointer)&ic_values, + ic->private.local.ic_resources, + ic->private.local.ic_num_resources, + values, XIM_CREATEIC, True)) { + goto Set_Error; + } + ic_values.filter_events = KeyPressMask | KeyReleaseMask; + _XimSetCurrentICValues(ic, &ic_values); + if(_XimSetICDefaults(ic, (XPointer)&ic_values, + XIM_SETICDEFAULTS, res, num) == False) { + goto Set_Error; + } + _XimSetCurrentICValues(ic, &ic_values); + + return((XIC)ic); + +Set_Error : + if (ic->private.local.ic_resources) { + Xfree(ic->private.local.ic_resources); + ic->private.local.ic_resources = NULL; + } + Xfree(ic); + return((XIC)NULL); +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcIm.c b/nx-X11/lib/modules/im/ximcp/imLcIm.c new file mode 100644 index 000000000..b3662bc96 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcIm.c @@ -0,0 +1,711 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993 by Digital Equipment Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED and +Digital Equipment Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. FUJITSU LIMITED and Digital Equipment Corporation +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 +THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Modifier: Franky Ling Digital Equipment Corporation + frankyling@hgrd01.enet.dec.com + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "XlcPublic.h" +#include "XlcPubI.h" +#include "Ximint.h" +#include +#include + +#ifdef COMPOSECACHE +# include +# include +# include +# include +#endif + + +#ifdef COMPOSECACHE + +/* include trailing '/' for cache directory, file prefix otherwise */ +#define XIM_GLOBAL_CACHE_DIR "/var/cache/libx11/compose/" +#define XIM_HOME_CACHE_DIR "/.compose-cache/" +#define XIM_CACHE_MAGIC ('X' | 'i'<<8 | 'm'<<16 | 'C'<<24) +#define XIM_CACHE_VERSION 4 +#define XIM_CACHE_TREE_ALIGNMENT 4 + +#define XIM_HASH_PRIME_1 13 +#define XIM_HASH_PRIME_2 1234096939 + +typedef INT32 DTStructIndex; +struct _XimCacheStruct { + INT32 id; + INT32 version; + DTStructIndex tree; + DTStructIndex mb; + DTStructIndex wc; + DTStructIndex utf8; + DTStructIndex size; + DTIndex top; + DTIndex treeused; + DTCharIndex mbused; + DTCharIndex wcused; + DTCharIndex utf8used; + char fname[1]; + /* char encoding[1] */ +}; + +static struct _XimCacheStruct* _XimCache_mmap = NULL; +static DefTreeBase _XimCachedDefaultTreeBase; +static int _XimCachedDefaultTreeRefcount = 0; + +#endif + + +Bool +_XimCheckIfLocalProcessing(Xim im) +{ + FILE *fp; + char *name; + + if(strcmp(im->core.im_name, "") == 0) { + name = _XlcFileName(im->core.lcd, COMPOSE_FILE); + if (name != (char *)NULL) { + fp = _XFopenFile (name, "r"); + Xfree(name); + if (fp != (FILE *)NULL) { + fclose(fp); + return(True); + } + } + return(False); + } else if(strcmp(im->core.im_name, "local") == 0 || + strcmp(im->core.im_name, "none" ) == 0 ) { + return(True); + } + return(False); +} + +static void +XimFreeDefaultTree( + DefTreeBase *b) +{ + if (!b) return; + if (b->tree == NULL) return; +#ifdef COMPOSECACHE + if (b->tree == _XimCachedDefaultTreeBase.tree) { + _XimCachedDefaultTreeRefcount--; + /* No deleting, it's a cache after all. */ + return; + } +#endif + Xfree (b->tree); + b->tree = NULL; + Xfree (b->mb); + b->mb = NULL; + Xfree (b->wc); + b->wc = NULL; + Xfree (b->utf8); + b->utf8 = NULL; + + b->treeused = b->treesize = 0; + b->mbused = b->mbsize = 0; + b->wcused = b->wcsize = 0; + b->utf8used = b->utf8size = 0; +} + +void +_XimLocalIMFree( + Xim im) +{ + XimFreeDefaultTree(&im->private.local.base); + im->private.local.top = 0; + + Xfree(im->core.im_resources); + im->core.im_resources = NULL; + + Xfree(im->core.ic_resources); + im->core.ic_resources = NULL; + + Xfree(im->core.im_values_list); + im->core.im_values_list = NULL; + + Xfree(im->core.ic_values_list); + im->core.ic_values_list = NULL; + + Xfree(im->core.styles); + im->core.styles = NULL; + + Xfree(im->core.res_name); + im->core.res_name = NULL; + + Xfree(im->core.res_class); + im->core.res_class = NULL; + + Xfree(im->core.im_name); + im->core.im_name = NULL; + + if (im->private.local.ctom_conv) { + _XlcCloseConverter(im->private.local.ctom_conv); + im->private.local.ctom_conv = NULL; + } + if (im->private.local.ctow_conv) { + _XlcCloseConverter(im->private.local.ctow_conv); + im->private.local.ctow_conv = NULL; + } + if (im->private.local.ctoutf8_conv) { + _XlcCloseConverter(im->private.local.ctoutf8_conv); + im->private.local.ctoutf8_conv = NULL; + } + if (im->private.local.cstomb_conv) { + _XlcCloseConverter(im->private.local.cstomb_conv); + im->private.local.cstomb_conv = NULL; + } + if (im->private.local.cstowc_conv) { + _XlcCloseConverter(im->private.local.cstowc_conv); + im->private.local.cstowc_conv = NULL; + } + if (im->private.local.cstoutf8_conv) { + _XlcCloseConverter(im->private.local.cstoutf8_conv); + im->private.local.cstoutf8_conv = NULL; + } + if (im->private.local.ucstoc_conv) { + _XlcCloseConverter(im->private.local.ucstoc_conv); + im->private.local.ucstoc_conv = NULL; + } + if (im->private.local.ucstoutf8_conv) { + _XlcCloseConverter(im->private.local.ucstoutf8_conv); + im->private.local.ucstoutf8_conv = NULL; + } + return; +} + +static Status +_XimLocalCloseIM( + XIM xim) +{ + Xim im = (Xim)xim; + XIC ic; + XIC next; + + ic = im->core.ic_chain; + im->core.ic_chain = NULL; + while (ic) { + (*ic->methods->destroy) (ic); + next = ic->core.next; + Xfree (ic); + ic = next; + } + _XimLocalIMFree(im); + _XimDestroyIMStructureList(im); + return(True); +} + +char * +_XimLocalGetIMValues( + XIM xim, + XIMArg *values) +{ + Xim im = (Xim)xim; + XimDefIMValues im_values; + + _XimGetCurrentIMValues(im, &im_values); + return(_XimGetIMValueData(im, (XPointer)&im_values, values, + im->core.im_resources, im->core.im_num_resources)); +} + +char * +_XimLocalSetIMValues( + XIM xim, + XIMArg *values) +{ + Xim im = (Xim)xim; + XimDefIMValues im_values; + char *name = (char *)NULL; + + _XimGetCurrentIMValues(im, &im_values); + name = _XimSetIMValueData(im, (XPointer)&im_values, values, + im->core.im_resources, im->core.im_num_resources); + _XimSetCurrentIMValues(im, &im_values); + return(name); +} + + +#ifdef COMPOSECACHE + +static Bool +_XimReadCachedDefaultTree( + int fd_cache, + const char *name, + const char *encoding, + DTStructIndex size) +{ + struct _XimCacheStruct* m; + int namelen = strlen (name) + 1; + int encodinglen = strlen (encoding) + 1; + + m = mmap (NULL, size, PROT_READ, MAP_PRIVATE, fd_cache, 0); + if (m == NULL || m == MAP_FAILED) + return False; + assert (m->id == XIM_CACHE_MAGIC); + assert (m->version == XIM_CACHE_VERSION); + if (size != m->size || + size < XOffsetOf (struct _XimCacheStruct, fname) + namelen + encodinglen) { + fprintf (stderr, "Ignoring broken XimCache %s [%s]\n", name, encoding); + munmap (m, size); + return False; + } + if (strncmp (name, m->fname, namelen) != 0) { + /* m->fname may *not* be terminated - but who cares here */ + fprintf (stderr, "Filename hash clash - expected %s, got %s\n", + name, m->fname); + munmap (m, size); + return False; + } + if (strncmp (encoding, m->fname + namelen, encodinglen) != 0) { + /* m->fname+namelen may *not* be terminated - but who cares here */ + fprintf (stderr, "Enoding hash clash - expected %s, got %s\n", + encoding, m->fname + namelen); + munmap (m, size); + return False; + } + _XimCache_mmap = m; + _XimCachedDefaultTreeBase.tree = (DefTree *) (((char *) m) + m->tree); + _XimCachedDefaultTreeBase.mb = (((char *) m) + m->mb); + _XimCachedDefaultTreeBase.wc = (wchar_t *) (((char *) m) + m->wc); + _XimCachedDefaultTreeBase.utf8 = (((char *) m) + m->utf8); + _XimCachedDefaultTreeBase.treeused = m->treeused; + _XimCachedDefaultTreeBase.mbused = m->mbused; + _XimCachedDefaultTreeBase.wcused = m->wcused; + _XimCachedDefaultTreeBase.utf8used = m->utf8used; + /* treesize etc. is ignored because only used during parsing */ + _XimCachedDefaultTreeRefcount = 0; +/* fprintf (stderr, "read cached tree at %p: %s\n", (void *) m, name); */ + return True; +} + +static unsigned int strToHash ( + const char *name) +{ + unsigned int hash = 0; + while (*name) + hash = hash * XIM_HASH_PRIME_1 + *(unsigned const char *)name++; + return hash % XIM_HASH_PRIME_2; +} + + +/* Returns read-only fd of cache file, -1 if none. + * Sets *res to cache filename if safe. Sets *size to file size of cache. */ +static int _XimCachedFileName ( + const char *dir, const char *name, + const char *intname, const char *encoding, + uid_t uid, int isglobal, char **res, off_t *size) +{ + struct stat st_name, st; + int fd; + unsigned int len, hash, hash2; + struct _XimCacheStruct *m; + /* There are some races here with 'dir', but we are either in our own home + * or the global cache dir, and not inside some public writable dir */ +/* fprintf (stderr, "XimCachedFileName for dir %s name %s intname %s encoding %s uid %d\n", dir, name, intname, encoding, uid); */ + if (stat (name, &st_name) == -1 || ! S_ISREG (st_name.st_mode) + || stat (dir, &st) == -1 || ! S_ISDIR (st.st_mode) || st.st_uid != uid + || (st.st_mode & 0022) != 0000) { + *res = NULL; + return -1; + } + len = strlen (dir); + hash = strToHash (intname); + hash2 = strToHash (encoding); + *res = Xmalloc (len + 1 + 27 + 1); /* Max VERSION 9999 */ + + if (len == 0 || dir [len-1] != '/') + sprintf (*res, "%s/%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), + XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); + else + sprintf (*res, "%s%c%d_%03x_%08x_%08x", dir, _XimGetMyEndian(), + XIM_CACHE_VERSION, (unsigned int)sizeof (DefTree), hash, hash2); + +/* fprintf (stderr, "-> %s\n", *res); */ + if ( (fd = _XOpenFile (*res, O_RDONLY)) == -1) + return -1; + + if (fstat (fd, &st) == -1) { + Xfree (*res); + *res = NULL; + close (fd); + return -1; + } + *size = st.st_size; + + if (! S_ISREG (st.st_mode) || st.st_uid != uid + || (st.st_mode & 0022) != 0000 || st.st_mtime <= st_name.st_mtime + || (st.st_mtime < time (NULL) - 24*60*60 && ! isglobal)) { + + close (fd); + if (unlink (*res) != 0) { + Xfree (*res); + *res = NULL; /* cache is not safe */ + } + return -1; + } + + m = mmap (NULL, sizeof (struct _XimCacheStruct), PROT_READ, MAP_PRIVATE, + fd, 0); + if (m == NULL || m == MAP_FAILED) { + close (fd); + Xfree (*res); + *res = NULL; + return -1; + } + if (*size < sizeof (struct _XimCacheStruct) || m->id != XIM_CACHE_MAGIC) { + munmap (m, sizeof (struct _XimCacheStruct)); + close (fd); + fprintf (stderr, "Ignoring broken XimCache %s\n", *res); + Xfree (*res); + *res = NULL; + return -1; + } + if (m->version != XIM_CACHE_VERSION) { + munmap (m, sizeof (struct _XimCacheStruct)); + close (fd); + if (unlink (*res) != 0) { + Xfree (*res); + *res = NULL; /* cache is not safe */ + } + return -1; + } + munmap (m, sizeof (struct _XimCacheStruct)); + + return fd; +} + + +static Bool _XimLoadCache ( + int fd, + const char *name, + const char *encoding, + off_t size, + Xim im) +{ + if (_XimCache_mmap || + _XimReadCachedDefaultTree (fd, name, encoding, size)) { + _XimCachedDefaultTreeRefcount++; + memcpy (&im->private.local.base, &_XimCachedDefaultTreeBase, + sizeof (_XimCachedDefaultTreeBase)); + im->private.local.top = _XimCache_mmap->top; + return True; + } + + return False; +} + + +static void +_XimWriteCachedDefaultTree( + const char *name, + const char *encoding, + const char *cachename, + Xim im) +{ + int fd; + FILE *fp; + struct _XimCacheStruct *m; + int msize = (XOffsetOf(struct _XimCacheStruct, fname) + + strlen(name) + strlen(encoding) + 2 + + XIM_CACHE_TREE_ALIGNMENT-1) & -XIM_CACHE_TREE_ALIGNMENT; + DefTreeBase *b = &im->private.local.base; + + if (! b->tree && ! (b->tree = Xcalloc (1, sizeof(DefTree))) ) + return; + if (! b->mb && ! (b->mb = Xmalloc (1)) ) + return; + if (! b->wc && ! (b->wc = Xmalloc (sizeof(wchar_t))) ) + return; + if (! b->utf8 && ! (b->utf8 = Xmalloc (1)) ) + return; + + /* First entry is always unused */ + b->mb[0] = 0; + b->wc[0] = 0; + b->utf8[0] = 0; + + m = Xcalloc (1, msize); + m->id = XIM_CACHE_MAGIC; + m->version = XIM_CACHE_VERSION; + m->top = im->private.local.top; + m->treeused = b->treeused; + m->mbused = b->mbused; + m->wcused = b->wcused; + m->utf8used = b->utf8used; + /* Tree first, then wide chars, then the rest due to alignment */ + m->tree = msize; + m->wc = msize + sizeof (DefTree) * m->treeused; + m->mb = m->wc + sizeof (wchar_t) * m->wcused; + m->utf8 = m->mb + m->mbused; + m->size = m->utf8 + m->utf8used; + strcpy (m->fname, name); + strcpy (m->fname+strlen(name)+1, encoding); + + /* This STILL might be racy on NFS */ + if ( (fd = _XOpenFileMode (cachename, O_WRONLY | O_CREAT | O_EXCL, + 0600)) < 0) { + Xfree(m); + return; + } + if (! (fp = fdopen (fd, "wb")) ) { + close (fd); + Xfree(m); + return; + } + fwrite (m, msize, 1, fp); + fwrite (im->private.local.base.tree, sizeof(DefTree), m->treeused, fp); + fwrite (im->private.local.base.wc, sizeof(wchar_t), m->wcused, fp); + fwrite (im->private.local.base.mb, 1, m->mbused, fp); + fwrite (im->private.local.base.utf8, 1, m->utf8used, fp); + if (fclose (fp) != 0) + unlink (cachename); + _XimCache_mmap = m; + memcpy (&_XimCachedDefaultTreeBase, &im->private.local.base, + sizeof (_XimCachedDefaultTreeBase)); +/* fprintf (stderr, "wrote tree %s size %ld to %s\n", name, m->size, cachename); */ +} + +#endif + + +static void +_XimCreateDefaultTree( + Xim im) +{ + FILE *fp = NULL; + char *name, *tmpname = NULL; + char *cachename = NULL; + /* Should use getpwent() instead of $HOME (cross-platform?) */ + char *home = getenv("HOME"); + char *tmpcachedir = NULL; + int hl = home ? strlen (home) : 0; +#ifdef COMPOSECACHE + char *intname; + char *cachedir = NULL; + const char *encoding = nl_langinfo (CODESET); + uid_t euid = geteuid (); + gid_t egid = getegid (); + int cachefd = -1; + off_t size; +#endif + + name = getenv("XCOMPOSEFILE"); + if (name == (char *) NULL) { + if (home != (char *) NULL) { + tmpname = name = Xmalloc(hl + 10 + 1); + if (name != (char *) NULL) { + int fd; + strcpy(name, home); + strcpy(name + hl, "/.XCompose"); + if ( (fd = _XOpenFile (name, O_RDONLY)) < 0) { + Xfree (name); + name = tmpname = NULL; + } else + close (fd); + } + } + } + + if (name == (char *) NULL) { + tmpname = name = _XlcFileName(im->core.lcd, COMPOSE_FILE); + } +#ifdef COMPOSECACHE + intname = name; + + if (getuid () == euid && getgid () == egid && euid != 0) { + char *c; + /* Usage: XCOMPOSECACHE=[=] + * cachedir: directory of cache files + * filename: internally used name for cache file */ + cachedir = getenv("XCOMPOSECACHE"); + if (cachedir && (c = strchr (cachedir, '='))) { + tmpcachedir = strdup (cachedir); + intname = tmpcachedir + (c-cachedir) + 1; + tmpcachedir[c-cachedir] = '\0'; + cachedir = tmpcachedir; + } + } + + if (! cachedir) { + cachefd = _XimCachedFileName (XIM_GLOBAL_CACHE_DIR, name, intname, + encoding, 0, 1, &cachename, &size); + if (cachefd != -1) { + if (_XimLoadCache (cachefd, intname, encoding, size, im)) { + Xfree (tmpcachedir); + Xfree (tmpname); + Xfree (cachename); + close (cachefd); + return; + } + close (cachefd); + } + Xfree (cachename); + cachename = NULL; + } + + if (getuid () == euid && getgid () == egid && euid != 0 && home) { + + if (! cachedir) { + tmpcachedir = cachedir = Xmalloc (hl+strlen(XIM_HOME_CACHE_DIR)+1); + strcpy (cachedir, home); + strcat (cachedir, XIM_HOME_CACHE_DIR); + } + cachefd = _XimCachedFileName (cachedir, name, intname, encoding, + euid, 0, &cachename, &size); + if (cachefd != -1) { + if (_XimLoadCache (cachefd, intname, encoding, size, im)) { + Xfree (tmpcachedir); + Xfree (tmpname); + Xfree (cachename); + close (cachefd); + return; + } + close (cachefd); + } + } +#endif + + if (! (fp = _XFopenFile (name, "r"))) { + Xfree (tmpcachedir); + Xfree (tmpname); + Xfree (cachename); + return; + } + _XimParseStringFile(fp, im); + fclose(fp); + +#ifdef COMPOSECACHE + if (cachename) { + assert (euid != 0); + _XimWriteCachedDefaultTree (intname, encoding, cachename, im); + } +#endif + + Xfree (tmpcachedir); + Xfree (tmpname); + Xfree (cachename); +} + +static XIMMethodsRec Xim_im_local_methods = { + _XimLocalCloseIM, /* close */ + _XimLocalSetIMValues, /* set_values */ + _XimLocalGetIMValues, /* get_values */ + _XimLocalCreateIC, /* create_ic */ + _XimLcctstombs, /* ctstombs */ + _XimLcctstowcs, /* ctstowcs */ + _XimLcctstoutf8 /* ctstoutf8 */ +}; + +Bool +_XimLocalOpenIM( + Xim im) +{ + XLCd lcd = im->core.lcd; + XlcConv conv; + XimDefIMValues im_values; + XimLocalPrivateRec* private = &im->private.local; + + _XimInitialResourceInfo(); + if(_XimSetIMResourceList(&im->core.im_resources, + &im->core.im_num_resources) == False) { + goto Open_Error; + } + if(_XimSetICResourceList(&im->core.ic_resources, + &im->core.ic_num_resources) == False) { + goto Open_Error; + } + + _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); + + _XimGetCurrentIMValues(im, &im_values); + if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, + im->core.im_resources, im->core.im_num_resources) == False) { + goto Open_Error; + } + _XimSetCurrentIMValues(im, &im_values); + + if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) + goto Open_Error; + private->ctom_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) + goto Open_Error; + private->ctow_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) + goto Open_Error; + private->ctoutf8_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) + goto Open_Error; + private->cstomb_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) + goto Open_Error; + private->cstowc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) + goto Open_Error; + private->cstoutf8_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) + goto Open_Error; + private->ucstoc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) + goto Open_Error; + private->ucstoutf8_conv = conv; + + private->base.treeused = 1; + private->base.mbused = 1; + private->base.wcused = 1; + private->base.utf8used = 1; + + _XimCreateDefaultTree(im); + + im->methods = &Xim_im_local_methods; + private->current_ic = (XIC)NULL; + + return(True); + +Open_Error : + _XimLocalIMFree(im); + return(False); +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcLkup.c b/nx-X11/lib/modules/im/ximcp/imLcLkup.c new file mode 100644 index 000000000..878b8e350 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcLkup.c @@ -0,0 +1,417 @@ +/****************************************************************** + + Copyright 1992 by Fuji Xerox Co., Ltd. + Copyright 1992, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 Fuji Xerox, +FUJITSU LIMITED not be used in advertising or publicity pertaining +to distribution of the software without specific, written prior +permission. Fuji Xerox, FUJITSU LIMITED make no representations +about the suitability of this software for any purpose. +It is provided "as is" without express or implied warranty. + +FUJI XEROX, FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX, +FUJITSU LIMITED 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: Kazunori Nishihara Fuji Xerox + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "XlcPubI.h" +#include "Ximint.h" + +int +_XimLocalMbLookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, + KeySym *keysym, Status *status) +{ + Xic ic = (Xic)xic; + int ret; + DefTree *b = ic->private.local.base.tree; + char *mb = ic->private.local.base.mb; + + if(ev->type != KeyPress) { + if(status) *status = XLookupNone; + return(0); + } + if(ev->keycode == 0 && + ( (ic->private.local.composed != 0) + ||(ic->private.local.brl_committed != 0))) { + if (ic->private.local.brl_committed != 0) { /* Braille Event */ + unsigned char pattern = ic->private.local.brl_committed; + char mb[XLC_PUBLIC(ic->core.im->core.lcd, mb_cur_max)]; + ret = _Xlcwctomb(ic->core.im->core.lcd, mb, BRL_UC_ROW | pattern); + if(ret > bytes) { + if(status) *status = XBufferOverflow; + return(ret); + } + if(keysym) *keysym = XK_braille_blank | pattern; + if(ret > 0) { + if (keysym) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + memcpy(buffer, mb, ret); + } else { + if(keysym) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } else { /* Composed Event */ + ret = strlen(&mb[b[ic->private.local.composed].mb]); + if(ret > bytes) { + if(status) *status = XBufferOverflow; + return(ret); + } + memcpy(buffer, &mb[b[ic->private.local.composed].mb], ret); + if(keysym) *keysym = b[ic->private.local.composed].ks; + if (ret > 0) { + if (keysym && *keysym != NoSymbol) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + } else { + if(keysym && *keysym != NoSymbol) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } + return (ret); + } else { /* Throughed Event */ + ret = _XimLookupMBText(ic, ev, buffer, bytes, keysym, NULL); + if(ret > 0) { + if (ret > bytes) { + if (status) *status = XBufferOverflow; + } else if (keysym && *keysym != NoSymbol) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + } else { + if(keysym && *keysym != NoSymbol) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } + return (ret); +} + +int +_XimLocalWcLookupString(XIC xic, XKeyEvent *ev, wchar_t *buffer, int wlen, + KeySym *keysym, Status *status) +{ + Xic ic = (Xic)xic; + int ret; + DefTree *b = ic->private.local.base.tree; + wchar_t *wc = ic->private.local.base.wc; + + if(ev->type != KeyPress) { + if(status) *status = XLookupNone; + return(0); + } + if(ev->keycode == 0) { + if (ic->private.local.brl_committed != 0) { /* Braille Event */ + unsigned char pattern = ic->private.local.brl_committed; + ret = 1; + if (ret > wlen) { + if(status) *status = XBufferOverflow; + return (ret); + } + *buffer = BRL_UC_ROW | pattern; + if(keysym) { + *keysym = XK_braille_blank | pattern; + if(status) *status = XLookupBoth; + } else + if(status) *status = XLookupChars; + } else { /* Composed Event */ + ret = _Xwcslen(&wc[b[ic->private.local.composed].wc]); + if(ret > wlen) { + if(status) *status = XBufferOverflow; + return (ret); + } + memcpy((char *)buffer, (char *)&wc[b[ic->private.local.composed].wc], + ret * sizeof(wchar_t)); + if(keysym) *keysym = b[ic->private.local.composed].ks; + if (ret > 0) { + if (keysym && *keysym != NoSymbol) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + } else { + if(keysym && *keysym != NoSymbol) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } + return (ret); + } else { /* Throughed Event */ + ret = _XimLookupWCText(ic, ev, buffer, wlen, keysym, NULL); + if(ret > 0) { + if (ret > wlen) { + if (status) *status = XBufferOverflow; + } else if (keysym && *keysym != NoSymbol) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + } else { + if(keysym && *keysym != NoSymbol) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } + return (ret); +} + +int +_XimLocalUtf8LookupString(XIC xic, XKeyEvent *ev, char *buffer, int bytes, + KeySym *keysym, Status *status) +{ + Xic ic = (Xic)xic; + int ret; + DefTree *b = ic->private.local.base.tree; + char *utf8 = ic->private.local.base.utf8; + + if(ev->type != KeyPress) { + if(status) *status = XLookupNone; + return(0); + } + if(ev->keycode == 0) { + if (ic->private.local.brl_committed != 0) { /* Braille Event */ + unsigned char pattern = ic->private.local.brl_committed; + ret = 3; + if (ret > bytes) { + if(status) *status = XBufferOverflow; + return (ret); + } + buffer[0] = 0xe0 | ((BRL_UC_ROW >> 12) & 0x0f); + buffer[1] = 0x80 | ((BRL_UC_ROW >> 8) & 0x30) | (pattern >> 6); + buffer[2] = 0x80 | (pattern & 0x3f); + if(keysym) { + *keysym = XK_braille_blank | pattern; + if(status) *status = XLookupBoth; + } else + if(status) *status = XLookupChars; + } else { /* Composed Event */ + ret = strlen(&utf8[b[ic->private.local.composed].utf8]); + if(ret > bytes) { + if(status) *status = XBufferOverflow; + return (ret); + } + memcpy(buffer, &utf8[b[ic->private.local.composed].utf8], ret); + if(keysym) *keysym = b[ic->private.local.composed].ks; + if (ret > 0) { + if (keysym && *keysym != NoSymbol) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + } else { + if(keysym && *keysym != NoSymbol) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } + return (ret); + } else { /* Throughed Event */ + ret = _XimLookupUTF8Text(ic, ev, buffer, bytes, keysym, NULL); + if(ret > 0) { + if (ret > bytes) { + if (status) *status = XBufferOverflow; + } else if (keysym && *keysym != NoSymbol) { + if(status) *status = XLookupBoth; + } else { + if(status) *status = XLookupChars; + } + } else { + if(keysym && *keysym != NoSymbol) { + if(status) *status = XLookupKeySym; + } else { + if(status) *status = XLookupNone; + } + } + } + return (ret); +} + +static int +_XimLcctsconvert( + XlcConv conv, + char *from, + int from_len, + char *to, + int to_len, + Status *state) +{ + int from_left; + int to_left; + int from_savelen; + int to_savelen; + int from_cnvlen; + int to_cnvlen; + char *from_buf; + char *to_buf; + char scratchbuf[BUFSIZ]; + Status tmp_state; + + if (!state) + state = &tmp_state; + + if (!conv || !from || !from_len) { + *state = XLookupNone; + return 0; + } + + /* Reset the converter. The CompoundText at 'from' starts in + initial state. */ + _XlcResetConverter(conv); + + from_left = from_len; + to_left = BUFSIZ; + from_cnvlen = 0; + to_cnvlen = 0; + for (;;) { + from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; + if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, + (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { + *state = XLookupNone; + return 0; + } + from_cnvlen += (from_savelen - from_left); + to_cnvlen += (to_savelen - to_left); + if (from_left == 0) { + if (!to_cnvlen) { + *state = XLookupNone; + return 0; + } + break; + } + } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen); + *state = XLookupChars; + } + return to_cnvlen; +} + +int +_XimLcctstombs(XIM xim, char *from, int from_len, + char *to, int to_len, Status *state) +{ + return _XimLcctsconvert(((Xim)xim)->private.local.ctom_conv, + from, from_len, to, to_len, state); +} + +int +_XimLcctstowcs(XIM xim, char *from, int from_len, + wchar_t *to, int to_len, Status *state) +{ + Xim im = (Xim)xim; + XlcConv conv = im->private.local.ctow_conv; + int from_left; + int to_left; + int from_savelen; + int to_savelen; + int from_cnvlen; + int to_cnvlen; + char *from_buf; + wchar_t *to_buf; + wchar_t scratchbuf[BUFSIZ]; + Status tmp_state; + + if (!state) + state = &tmp_state; + + if (!conv || !from || !from_len) { + *state = XLookupNone; + return 0; + } + + /* Reset the converter. The CompoundText at 'from' starts in + initial state. */ + _XlcResetConverter(conv); + + from_left = from_len; + to_left = BUFSIZ; + from_cnvlen = 0; + to_cnvlen = 0; + for (;;) { + from_buf = &from[from_cnvlen]; + from_savelen = from_left; + to_buf = &scratchbuf[to_cnvlen]; + to_savelen = to_left; + if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, + (XPointer *)&to_buf, &to_left, NULL, 0) < 0) { + *state = XLookupNone; + return 0; + } + from_cnvlen += (from_savelen - from_left); + to_cnvlen += (to_savelen - to_left); + if (from_left == 0) { + if (!to_cnvlen){ + *state = XLookupNone; + return 0; + } + break; + } + } + + if (!to || !to_len || (to_len < to_cnvlen)) { + *state = XBufferOverflow; + } else { + memcpy(to, scratchbuf, to_cnvlen * sizeof(wchar_t)); + *state = XLookupChars; + } + return to_cnvlen; +} + +int +_XimLcctstoutf8(XIM xim, char *from, int from_len, + char *to, int to_len, Status *state) +{ + return _XimLcctsconvert(((Xim)xim)->private.local.ctoutf8_conv, + from, from_len, to, to_len, state); +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcPrs.c b/nx-X11/lib/modules/im/ximcp/imLcPrs.c new file mode 100644 index 000000000..fa992e5d3 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcPrs.c @@ -0,0 +1,741 @@ +/****************************************************************** + + Copyright 1992 by Oki Technosystems Laboratory, Inc. + Copyright 1992 by Fuji Xerox Co., Ltd. + +Permission to use, copy, modify, distribute, and sell this software +and its 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 Oki Technosystems +Laboratory and Fuji Xerox not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. +Oki Technosystems Laboratory and Fuji Xerox make no representations +about the suitability of this software for any purpose. It is provided +"as is" without express or implied warranty. + +OKI TECHNOSYSTEMS LABORATORY AND FUJI XEROX DISCLAIM ALL WARRANTIES +WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL OKI TECHNOSYSTEMS +LABORATORY AND FUJI XEROX 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: Yasuhiro Kawai Oki Technosystems Laboratory + Author: Kazunori Nishihara Fuji Xerox + +******************************************************************/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include +#include +#include +#include "pathmax.h" + +#define XLC_BUFSIZE 256 + +extern int _Xmbstowcs( + wchar_t *wstr, + char *str, + int len +); + +extern int _Xmbstoutf8( + char *ustr, + const char *str, + int len +); + +static void parsestringfile(FILE *fp, Xim im, int depth); + +/* + * Parsing File Format: + * + * FILE ::= { [PRODUCTION] [COMMENT] "\n"} + * PRODUCTION ::= LHS ":" RHS [ COMMENT ] + * COMMENT ::= "#" {} + * LHS ::= EVENT { EVENT } + * EVENT ::= [MODIFIER_LIST] "<" keysym ">" + * MODIFIER_LIST ::= (["!"] {MODIFIER} ) | "None" + * MODIFIER ::= ["~"] MODIFIER_NAME + * MODIFIER_NAME ::= ("Ctrl"|"Lock"|"Caps"|"Shift"|"Alt"|"Meta") + * RHS ::= ( STRING | keysym | STRING keysym ) + * STRING ::= '"' { CHAR } '"' + * CHAR ::= GRAPHIC_CHAR | ESCAPED_CHAR + * GRAPHIC_CHAR ::= locale (codeset) dependent code + * ESCAPED_CHAR ::= ('\\' | '\"' | OCTAL | HEX ) + * OCTAL ::= '\' OCTAL_CHAR [OCTAL_CHAR [OCTAL_CHAR]] + * OCTAL_CHAR ::= (0|1|2|3|4|5|6|7) + * HEX ::= '\' (x|X) HEX_CHAR [HEX_CHAR]] + * HEX_CHAR ::= (0|1|2|3|4|5|6|7|8|9|A|B|C|D|E|F|a|b|c|d|e|f) + * + */ + +static int +nextch( + FILE *fp, + int *lastch) +{ + int c; + + if (*lastch != 0) { + c = *lastch; + *lastch = 0; + } else { + c = getc(fp); + if (c == '\\') { + c = getc(fp); + if (c == '\n') { + c = getc(fp); + } else { + ungetc(c, fp); + c = '\\'; + } + } + } + return(c); +} + +static void +putbackch( + int c, + int *lastch) +{ + *lastch = c; +} + +#define ENDOFFILE 0 +#define ENDOFLINE 1 +#define COLON 2 +#define LESS 3 +#define GREATER 4 +#define EXCLAM 5 +#define TILDE 6 +#define STRING 7 +#define KEY 8 +#define ERROR 9 + +#ifndef isalnum +#define isalnum(c) \ + (('0' <= (c) && (c) <= '9') || \ + ('A' <= (c) && (c) <= 'Z') || \ + ('a' <= (c) && (c) <= 'z')) +#endif + +static int +nexttoken( + FILE *fp, + char *tokenbuf, + int *lastch) +{ + int c; + int token; + char *p; + int i, j; + + while ((c = nextch(fp, lastch)) == ' ' || c == '\t') { + } + switch (c) { + case EOF: + token = ENDOFFILE; + break; + case '\n': + token = ENDOFLINE; + break; + case '<': + token = LESS; + break; + case '>': + token = GREATER; + break; + case ':': + token = COLON; + break; + case '!': + token = EXCLAM; + break; + case '~': + token = TILDE; + break; + case '"': + p = tokenbuf; + while ((c = nextch(fp, lastch)) != '"') { + if (c == '\n' || c == EOF) { + putbackch(c, lastch); + token = ERROR; + goto string_error; + } else if (c == '\\') { + c = nextch(fp, lastch); + switch (c) { + case '\\': + case '"': + *p++ = c; + break; + case 'n': + *p++ = '\n'; + break; + case 'r': + *p++ = '\r'; + break; + case 't': + *p++ = '\t'; + break; + case '0': + case '1': + case '2': + case '3': + case '4': + case '5': + case '6': + case '7': + i = c - '0'; + c = nextch(fp, lastch); + for (j = 0; j < 2 && c >= '0' && c <= '7'; j++) { + i <<= 3; + i += c - '0'; + c = nextch(fp, lastch); + } + putbackch(c, lastch); + *p++ = (char)i; + break; + case 'X': + case 'x': + i = 0; + for (j = 0; j < 2; j++) { + c = nextch(fp, lastch); + i <<= 4; + if (c >= '0' && c <= '9') { + i += c - '0'; + } else if (c >= 'A' && c <= 'F') { + i += c - 'A' + 10; + } else if (c >= 'a' && c <= 'f') { + i += c - 'a' + 10; + } else { + putbackch(c, lastch); + i >>= 4; + break; + } + } + if (j == 0) { + token = ERROR; + goto string_error; + } + *p++ = (char)i; + break; + case EOF: + putbackch(c, lastch); + token = ERROR; + goto string_error; + default: + *p++ = c; + break; + } + } else { + *p++ = c; + } + } + *p = '\0'; + token = STRING; + break; + case '#': + while ((c = nextch(fp, lastch)) != '\n' && c != EOF) { + } + if (c == '\n') { + token = ENDOFLINE; + } else { + token = ENDOFFILE; + } + break; + default: + if (isalnum(c) || c == '_' || c == '-') { + p = tokenbuf; + *p++ = c; + c = nextch(fp, lastch); + while (isalnum(c) || c == '_' || c == '-') { + *p++ = c; + c = nextch(fp, lastch); + } + *p = '\0'; + putbackch(c, lastch); + token = KEY; + } else { + token = ERROR; + } + break; + } +string_error: + return(token); +} + +static long +modmask( + char *name) +{ + struct _modtbl { + const char name[6]; + long mask; + }; + + static const struct _modtbl tbl[] = { + { "Ctrl", ControlMask }, + { "Lock", LockMask }, + { "Caps", LockMask }, + { "Shift", ShiftMask }, + { "Alt", Mod1Mask }, + { "Meta", Mod1Mask }}; + + int i, num_entries = sizeof (tbl) / sizeof (tbl[0]); + + for (i = 0; i < num_entries; i++) + if (!strcmp (name, tbl[i].name)) + return tbl[i].mask; + + return 0; +} + +static char* +TransFileName(Xim im, char *name) +{ + char *home = NULL, *lcCompose = NULL; + char dir[XLC_BUFSIZE] = ""; + char *i = name, *ret = NULL, *j; + size_t l = 0; + + while (*i) { + if (*i == '%') { + i++; + switch (*i) { + case '%': + l++; + break; + case 'H': + if (home == NULL) + home = getenv("HOME"); + if (home) { + size_t Hsize = strlen(home); + if (Hsize > PATH_MAX) + /* your home directory length is ridiculous */ + goto end; + l += Hsize; + } + break; + case 'L': + if (lcCompose == NULL) + lcCompose = _XlcFileName(im->core.lcd, COMPOSE_FILE); + if (lcCompose) { + size_t Lsize = strlen(lcCompose); + if (Lsize > PATH_MAX) + /* your compose pathname length is ridiculous */ + goto end; + l += Lsize; + } + break; + case 'S': + if (dir[0] == '\0') + xlocaledir(dir, XLC_BUFSIZE); + if (dir[0]) { + size_t Ssize = strlen(dir); + if (Ssize > PATH_MAX) + /* your locale directory path length is ridiculous */ + goto end; + l += Ssize; + } + break; + } + } else { + l++; + } + i++; + if (l > PATH_MAX) + /* your expanded path length is ridiculous */ + goto end; + } + + j = ret = Xmalloc(l+1); + if (ret == NULL) + goto end; + i = name; + while (*i) { + if (*i == '%') { + i++; + switch (*i) { + case '%': + *j++ = '%'; + break; + case 'H': + if (home) { + strcpy(j, home); + j += strlen(home); + } + break; + case 'L': + if (lcCompose) { + strcpy(j, lcCompose); + j += strlen(lcCompose); + } + break; + case 'S': + strcpy(j, dir); + j += strlen(dir); + break; + } + i++; + } else { + *j++ = *i++; + } + } + *j = '\0'; +end: + Xfree(lcCompose); + return ret; +} + +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 6 +#endif + +static int +get_mb_string (Xim im, char *buf, KeySym ks) +{ + XPointer from, to; + int from_len, to_len, len; + XPointer args[1]; + XlcCharSet charset; + char local_buf[MB_LEN_MAX]; + unsigned int ucs; + ucs = KeySymToUcs4(ks); + + from = (XPointer) &ucs; + to = (XPointer) local_buf; + from_len = 1; + to_len = MB_LEN_MAX; + args[0] = (XPointer) &charset; + if (_XlcConvert(im->private.local.ucstoc_conv, + &from, &from_len, &to, &to_len, args, 1 ) != 0) { + return 0; + } + + from = (XPointer) local_buf; + to = (XPointer) buf; + from_len = MB_LEN_MAX - to_len; + to_len = MB_LEN_MAX + 1; + args[0] = (XPointer) charset; + if (_XlcConvert(im->private.local.cstomb_conv, + &from, &from_len, &to, &to_len, args, 1 ) != 0) { + return 0; + } + len = MB_LEN_MAX + 1 - to_len; + buf[len] = '\0'; + return len; +} + +#define AllMask (ShiftMask | LockMask | ControlMask | Mod1Mask) +#define LOCAL_WC_BUFSIZE 128 +#define LOCAL_UTF8_BUFSIZE 256 +#define SEQUENCE_MAX 10 + +static int +parseline( + FILE *fp, + Xim im, + char* tokenbuf, + int depth) +{ + int token; + DTModifier modifier_mask; + DTModifier modifier; + DTModifier tmp; + KeySym keysym = NoSymbol; + DTIndex *top = &im->private.local.top; + DefTreeBase *b = &im->private.local.base; + DTIndex t; + DefTree *p = NULL; + Bool exclam, tilde; + KeySym rhs_keysym = 0; + char *rhs_string_mb; + int l; + int lastch = 0; + char local_mb_buf[MB_LEN_MAX+1]; + wchar_t local_wc_buf[LOCAL_WC_BUFSIZE], *rhs_string_wc; + char local_utf8_buf[LOCAL_UTF8_BUFSIZE], *rhs_string_utf8; + + struct DefBuffer { + DTModifier modifier_mask; + DTModifier modifier; + KeySym keysym; + }; + + struct DefBuffer buf[SEQUENCE_MAX]; + int i, n; + + do { + token = nexttoken(fp, tokenbuf, &lastch); + } while (token == ENDOFLINE); + + if (token == ENDOFFILE) { + return(-1); + } + + n = 0; + do { + if ((token == KEY) && (strcmp("include", tokenbuf) == 0)) { + char *filename; + FILE *infp; + token = nexttoken(fp, tokenbuf, &lastch); + if (token != KEY && token != STRING) + goto error; + if (++depth > 100) + goto error; + if ((filename = TransFileName(im, tokenbuf)) == NULL) + goto error; + infp = _XFopenFile(filename, "r"); + Xfree(filename); + if (infp == NULL) + goto error; + parsestringfile(infp, im, depth); + fclose(infp); + return (0); + } else if ((token == KEY) && (strcmp("None", tokenbuf) == 0)) { + modifier = 0; + modifier_mask = AllMask; + token = nexttoken(fp, tokenbuf, &lastch); + } else { + modifier_mask = modifier = 0; + exclam = False; + if (token == EXCLAM) { + exclam = True; + token = nexttoken(fp, tokenbuf, &lastch); + } + while (token == TILDE || token == KEY) { + tilde = False; + if (token == TILDE) { + tilde = True; + token = nexttoken(fp, tokenbuf, &lastch); + if (token != KEY) + goto error; + } + tmp = modmask(tokenbuf); + if (!tmp) { + goto error; + } + modifier_mask |= tmp; + if (tilde) { + modifier &= ~tmp; + } else { + modifier |= tmp; + } + token = nexttoken(fp, tokenbuf, &lastch); + } + if (exclam) { + modifier_mask = AllMask; + } + } + + if (token != LESS) { + goto error; + } + + token = nexttoken(fp, tokenbuf, &lastch); + if (token != KEY) { + goto error; + } + + token = nexttoken(fp, tokenbuf, &lastch); + if (token != GREATER) { + goto error; + } + + keysym = XStringToKeysym(tokenbuf); + if (keysym == NoSymbol) { + goto error; + } + + buf[n].keysym = keysym; + buf[n].modifier = modifier; + buf[n].modifier_mask = modifier_mask; + n++; + if( n >= SEQUENCE_MAX ) + goto error; + token = nexttoken(fp, tokenbuf, &lastch); + } while (token != COLON); + + token = nexttoken(fp, tokenbuf, &lastch); + if (token == STRING) { + l = strlen(tokenbuf) + 1; + while (b->mbused + l > b->mbsize) { + DTCharIndex newsize = b->mbsize ? b->mbsize * 1.5 : 1024; + char *newmb = Xrealloc (b->mb, newsize); + if (newmb == NULL) + goto error; + b->mb = newmb; + b->mbsize = newsize; + } + rhs_string_mb = &b->mb[b->mbused]; + b->mbused += l; + strcpy(rhs_string_mb, tokenbuf); + token = nexttoken(fp, tokenbuf, &lastch); + if (token == KEY) { + rhs_keysym = XStringToKeysym(tokenbuf); + if (rhs_keysym == NoSymbol) { + goto error; + } + token = nexttoken(fp, tokenbuf, &lastch); + } + if (token != ENDOFLINE && token != ENDOFFILE) { + goto error; + } + } else if (token == KEY) { + rhs_keysym = XStringToKeysym(tokenbuf); + if (rhs_keysym == NoSymbol) { + goto error; + } + token = nexttoken(fp, tokenbuf, &lastch); + if (token != ENDOFLINE && token != ENDOFFILE) { + goto error; + } + + l = get_mb_string(im, local_mb_buf, rhs_keysym); + while (b->mbused + l + 1 > b->mbsize) { + DTCharIndex newsize = b->mbsize ? b->mbsize * 1.5 : 1024; + char *newmb = Xrealloc (b->mb, newsize); + if (newmb == NULL) + goto error; + b->mb = newmb; + b->mbsize = newsize; + } + rhs_string_mb = &b->mb[b->mbused]; + b->mbused += l + 1; + memcpy(rhs_string_mb, local_mb_buf, l); + rhs_string_mb[l] = '\0'; + } else { + goto error; + } + + l = _Xmbstowcs(local_wc_buf, rhs_string_mb, LOCAL_WC_BUFSIZE - 1); + if (l == LOCAL_WC_BUFSIZE - 1) { + local_wc_buf[l] = (wchar_t)'\0'; + } + while (b->wcused + l + 1 > b->wcsize) { + DTCharIndex newsize = b->wcsize ? b->wcsize * 1.5 : 512; + wchar_t *newwc = Xrealloc (b->wc, sizeof(wchar_t) * newsize); + if (newwc == NULL) + goto error; + b->wc = newwc; + b->wcsize = newsize; + } + rhs_string_wc = &b->wc[b->wcused]; + b->wcused += l + 1; + memcpy((char *)rhs_string_wc, (char *)local_wc_buf, (l + 1) * sizeof(wchar_t) ); + + l = _Xmbstoutf8(local_utf8_buf, rhs_string_mb, LOCAL_UTF8_BUFSIZE - 1); + if (l == LOCAL_UTF8_BUFSIZE - 1) { + local_utf8_buf[l] = '\0'; + } + while (b->utf8used + l + 1 > b->utf8size) { + DTCharIndex newsize = b->utf8size ? b->utf8size * 1.5 : 1024; + char *newutf8 = Xrealloc (b->utf8, newsize); + if (newutf8 == NULL) + goto error; + b->utf8 = newutf8; + b->utf8size = newsize; + } + rhs_string_utf8 = &b->utf8[b->utf8used]; + b->utf8used += l + 1; + memcpy(rhs_string_utf8, local_utf8_buf, l + 1); + + for (i = 0; i < n; i++) { + for (t = *top; t; t = b->tree[t].next) { + if (buf[i].keysym == b->tree[t].keysym && + buf[i].modifier == b->tree[t].modifier && + buf[i].modifier_mask == b->tree[t].modifier_mask) { + break; + } + } + if (t) { + p = &b->tree[t]; + top = &p->succession; + } else { + while (b->treeused >= b->treesize) { + DefTree *old = b->tree; + int oldsize = b->treesize; + int newsize = b->treesize ? b->treesize * 1.5 : 256; + DefTree *new = Xrealloc (b->tree, sizeof(DefTree) * newsize); + if (new == NULL) + goto error; + b->tree = new; + b->treesize = newsize; + if (top >= (DTIndex *) old && top < (DTIndex *) &old[oldsize]) + top = (DTIndex *) (((char *) top) + (((char *)b->tree)-(char *)old)); + } + p = &b->tree[b->treeused]; + p->keysym = buf[i].keysym; + p->modifier = buf[i].modifier; + p->modifier_mask = buf[i].modifier_mask; + p->succession = 0; + p->next = *top; + p->mb = 0; + p->wc = 0; + p->utf8 = 0; + p->ks = NoSymbol; + *top = b->treeused; + top = &p->succession; + b->treeused++; + } + } + + /* old entries no longer freed... */ + p->mb = rhs_string_mb - b->mb; + p->wc = rhs_string_wc - b->wc; + p->utf8 = rhs_string_utf8 - b->utf8; + p->ks = rhs_keysym; + return(n); +error: + while (token != ENDOFLINE && token != ENDOFFILE) { + token = nexttoken(fp, tokenbuf, &lastch); + } + return(0); +} + +void +_XimParseStringFile( + FILE *fp, + Xim im) +{ + parsestringfile(fp, im, 0); +} + +static void +parsestringfile( + FILE *fp, + Xim im, + int depth) +{ + char tb[8192]; + char* tbp; + struct stat st; + + if (fstat (fileno (fp), &st) != -1) { + unsigned long size = (unsigned long) st.st_size; + if (st.st_size >= INT_MAX) + return; + if (size <= sizeof tb) tbp = tb; + else tbp = malloc (size); + + if (tbp != NULL) { + while (parseline(fp, im, tbp, depth) >= 0) {} + if (tbp != tb) free (tbp); + } + } +} diff --git a/nx-X11/lib/modules/im/ximcp/imLcSIc.c b/nx-X11/lib/modules/im/ximcp/imLcSIc.c new file mode 100644 index 000000000..944bd8abd --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imLcSIc.c @@ -0,0 +1,54 @@ +/****************************************************************** + + Copyright 1990, 1991, 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +char * +_XimLocalSetICValues(XIC xic, XIMArg *values) +{ + XimDefICValues ic_values; + Xic ic = (Xic)xic; + char *name; + + _XimGetCurrentICValues(ic, &ic_values); + name = _XimSetICValueData(ic, (XPointer)&ic_values, + ic->private.local.ic_resources, + ic->private.local.ic_num_resources, + values, XIM_SETICVALUES, True); + _XimSetCurrentICValues(ic, &ic_values); + return(name); +} diff --git a/nx-X11/lib/modules/im/ximcp/imRm.c b/nx-X11/lib/modules/im/ximcp/imRm.c new file mode 100644 index 000000000..373217173 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imRm.c @@ -0,0 +1,3212 @@ +/****************************************************************** + + Copyright 1990, 1991, 1992,1993, 1994 by FUJITSU LIMITED + Copyright 1994 by Sony Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED +and 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 make +no representations about the suitability of this software for any +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 +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND +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. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Modifier: Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "Xresource.h" + +#define GET_NAME(x) name_table + x.name_offset + +typedef struct _XimValueOffsetInfo { + unsigned short name_offset; + XrmQuark quark; + unsigned int offset; + Bool (*defaults)( + struct _XimValueOffsetInfo *, XPointer, XPointer, unsigned long + ); + Bool (*encode)( + struct _XimValueOffsetInfo *, XPointer, XPointer + ); + Bool (*decode)( + struct _XimValueOffsetInfo *, XPointer, XPointer + ); +} XimValueOffsetInfoRec, *XimValueOffsetInfo; + +#ifdef XIM_CONNECTABLE +static Bool +_XimCheckBool(str) + char *str; +{ + if(!strcmp(str, "True") || !strcmp(str, "true") || + !strcmp(str, "Yes") || !strcmp(str, "yes") || + !strcmp(str, "ON") || !strcmp(str, "on")) + return True; + return False; +} + +void +_XimSetProtoResource(im) + Xim im; +{ + char res_name_buf[256]; + char* res_name; + size_t res_name_len; + char res_class_buf[256]; + char* res_class; + size_t res_class_len; + char* str_type; + XrmValue value; + XIMStyle preedit_style = 0; + XIMStyle status_style = 0; + XIMStyles* imstyles; + char* dotximdot = ".xim."; + char* ximdot = "xim."; + char* dotXimdot = ".Xim."; + char* Ximdot = "Xim."; + + if (!im->core.rdb) + return; + + res_name_len = strlen (im->core.res_name); + if (res_name_len < 200) { + res_name = res_name_buf; + res_name_len = sizeof(res_name_buf); + } + else { + res_name_len += 50; + res_name = Xmalloc (res_name_len); + } + res_class_len = strlen (im->core.res_class); + if (res_class_len < 200) { + res_class = res_class_buf; + res_class_len = sizeof(res_class_buf); + } + else { + res_class_len += 50; + res_class = Xmalloc (res_class_len); + } + /* pretend malloc always works */ + + (void) snprintf (res_name, res_name_len, "%s%s%s", + im->core.res_name != NULL ? im->core.res_name : "*", + im->core.res_name != NULL ? dotximdot : ximdot, + "useAuth"); + (void) snprintf (res_class, res_class_len, "%s%s%s", + im->core.res_class != NULL ? im->core.res_class : "*", + im->core.res_class != NULL ? dotXimdot : Ximdot, + "UseAuth"); + bzero(&value, sizeof(XrmValue)); + if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { + if(_XimCheckBool(value.addr)) { + MARK_USE_AUTHORIZATION_FUNC(im); + } + } + + (void) snprintf (res_name, res_name_len, "%s%s%s", + im->core.res_name != NULL ? im->core.res_name : "*", + im->core.res_name != NULL ? dotximdot : ximdot, + "delaybinding"); + (void) snprintf (res_class, res_class_len, "%s%s%s", + im->core.res_class != NULL ? im->core.res_class : "*", + im->core.res_class != NULL ? dotXimdot : Ximdot, + "Delaybinding"); + bzero(&value, sizeof(XrmValue)); + if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { + if(_XimCheckBool(value.addr)) { + MARK_DELAYBINDABLE(im); + } + } + + (void) snprintf (res_name, res_name_len, "%s%s%s", + im->core.res_name != NULL ? im->core.res_name : "*", + im->core.res_name != NULL ? dotximdot : ximdot, + "reconnect"); + (void) snprintf (res_class, res_class_len, "%s%s%s", + im->core.res_class != NULL ? im->core.res_class : "*", + im->core.res_class != NULL ? dotXimdot : Ximdot, + "Reconnect"); + bzero(&value, sizeof(XrmValue)); + if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { + if(_XimCheckBool(value.addr)) { + MARK_RECONNECTABLE(im); + } + } + + if(!IS_CONNECTABLE(im)) { + if (res_name != res_name_buf) Xfree (res_name); + if (res_class != res_class_buf) Xfree (res_class); + return; + } + + (void) snprintf (res_name, res_name_len, "%s%s%s", + im->core.res_name != NULL ? im->core.res_name : "*", + im->core.res_name != NULL ? dotximdot : ximdot, + "preeditDefaultStyle"); + (void) snprintf (res_class, res_class_len, "%s%s%s", + im->core.res_class != NULL ? im->core.res_class : "*", + im->core.res_class != NULL ? dotXimdot : Ximdot, + "PreeditDefaultStyle"); + if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { + if(!strcmp(value.addr, "XIMPreeditArea")) + preedit_style = XIMPreeditArea; + else if(!strcmp(value.addr, "XIMPreeditCallbacks")) + preedit_style = XIMPreeditCallbacks; + else if(!strcmp(value.addr, "XIMPreeditPosition")) + preedit_style = XIMPreeditPosition; + else if(!strcmp(value.addr, "XIMPreeditNothing")) + preedit_style = XIMPreeditNothing; + else if(!strcmp(value.addr, "XIMPreeditNone")) + preedit_style = XIMPreeditNone; + } + if(!preedit_style) + preedit_style = XIMPreeditNothing; + + (void) snprintf (res_name, res_name_len, "%s%s%s", + im->core.res_name != NULL ? im->core.res_name : "*", + im->core.res_name != NULL ? dotximdot : ximdot, + "statusDefaultStyle"); + (void) snprintf (res_class, res_class_len, "%s%s%s", + im->core.res_class != NULL ? im->core.res_class : "*", + im->core.res_class != NULL ? dotXimdot : Ximdot, + "StatusDefaultStyle"); + if(XrmGetResource(im->core.rdb, res_name, res_class, &str_type, &value)) { + if(!strcmp(value.addr, "XIMStatusArea")) + status_style = XIMStatusArea; + else if(!strcmp(value.addr, "XIMStatusCallbacks")) + status_style = XIMStatusCallbacks; + else if(!strcmp(value.addr, "XIMStatusNothing")) + status_style = XIMStatusNothing; + else if(!strcmp(value.addr, "XIMStatusNone")) + status_style = XIMStatusNone; + } + if(!status_style) + status_style = XIMStatusNothing; + + if(!(imstyles = Xmalloc(sizeof(XIMStyles) + sizeof(XIMStyle)))){ + if (res_name != res_name_buf) Xfree (res_name); + if (res_class != res_class_buf) Xfree (res_class); + return; + } + imstyles->count_styles = 1; + imstyles->supported_styles = + (XIMStyle *)((char *)imstyles + sizeof(XIMStyles)); + imstyles->supported_styles[0] = preedit_style | status_style; + im->private.proto.default_styles = imstyles; + if (res_name != res_name_buf) Xfree (res_name); + if (res_class != res_class_buf) Xfree (res_class); +} +#endif /* XIM_CONNECTABLE */ + +static const char name_table[] = + /* 0 */ XNQueryInputStyle"\0" + /* 16 */ XNClientWindow"\0" + /* 29 */ XNInputStyle"\0" + /* 40 */ XNFocusWindow"\0" + /* 52 */ XNResourceName"\0" + /* 65 */ XNResourceClass"\0" + /* 79 */ XNGeometryCallback"\0" + /* 96 */ XNDestroyCallback"\0" + /* 112 */ XNFilterEvents"\0" + /* 125 */ XNPreeditStartCallback"\0" + /* 146 */ XNPreeditDoneCallback"\0" + /* 166 */ XNPreeditDrawCallback"\0" + /* 186 */ XNPreeditCaretCallback"\0" + /* 207 */ XNPreeditStateNotifyCallback"\0" + /* 234 */ XNPreeditAttributes"\0" + /* 252 */ XNStatusStartCallback"\0" + /* 272 */ XNStatusDoneCallback"\0" + /* 291 */ XNStatusDrawCallback"\0" + /* 310 */ XNStatusAttributes"\0" + /* 327 */ XNArea"\0" + /* 332 */ XNAreaNeeded"\0" + /* 343 */ XNSpotLocation"\0" + /* 356 */ XNColormap"\0" + /* 365 */ XNStdColormap"\0" + /* 377 */ XNForeground"\0" + /* 388 */ XNBackground"\0" + /* 399 */ XNBackgroundPixmap"\0" + /* 416 */ XNFontSet"\0" + /* 424 */ XNLineSpace"\0" + /* 434 */ XNCursor"\0" + /* 441 */ XNQueryIMValuesList"\0" + /* 459 */ XNQueryICValuesList"\0" + /* 477 */ XNVisiblePosition"\0" + /* 493 */ XNStringConversionCallback"\0" + /* 518 */ XNStringConversion"\0" + /* 535 */ XNResetState"\0" + /* 546 */ XNHotKey"\0" + /* 553 */ XNHotKeyState"\0" + /* 565 */ XNPreeditState +; + +#define OFFSET_XNQUERYINPUTSTYLE 0 +#define OFFSET_XNCLIENTWINDOW 16 +#define OFFSET_XNINPUTSTYLE 29 +#define OFFSET_XNFOCUSWINDOW 40 +#define OFFSET_XNRESOURCENAME 52 +#define OFFSET_XNRESOURCECLASS 65 +#define OFFSET_XNGEOMETRYCALLBACK 79 +#define OFFSET_XNDESTROYCALLBACK 96 +#define OFFSET_XNFILTEREVENTS 112 +#define OFFSET_XNPREEDITSTARTCALLBACK 125 +#define OFFSET_XNPREEDITDONECALLBACK 146 +#define OFFSET_XNPREEDITDRAWCALLBACK 166 +#define OFFSET_XNPREEDITCARETCALLBACK 186 +#define OFFSET_XNPREEDITSTATENOTIFYCALLBACK 207 +#define OFFSET_XNPREEDITATTRIBUTES 234 +#define OFFSET_XNSTATUSSTARTCALLBACK 252 +#define OFFSET_XNSTATUSDONECALLBACK 272 +#define OFFSET_XNSTATUSDRAWCALLBACK 291 +#define OFFSET_XNSTATUSATTRIBUTES 310 +#define OFFSET_XNAREA 327 +#define OFFSET_XNAREANEEDED 332 +#define OFFSET_XNSPOTLOCATION 343 +#define OFFSET_XNCOLORMAP 356 +#define OFFSET_XNSTDCOLORMAP 365 +#define OFFSET_XNFOREGROUND 377 +#define OFFSET_XNBACKGROUND 388 +#define OFFSET_XNBACKGROUNDPIXMAP 399 +#define OFFSET_XNFONTSET 416 +#define OFFSET_XNLINESPACE 424 +#define OFFSET_XNCURSOR 434 +#define OFFSET_XNQUERYIMVALUESLIST 441 +#define OFFSET_XNQUERYICVALUESLIST 459 +#define OFFSET_XNVISIBLEPOSITION 477 +#define OFFSET_XNSTRINGCONVERSIONCALLBACK 493 +#define OFFSET_XNSTRINGCONVERSION 518 +#define OFFSET_XNRESETSTATE 535 +#define OFFSET_XNHOTKEY 546 +#define OFFSET_XNHOTKEYSTATE 553 +#define OFFSET_XNPREEDITSTATE 565 + +/* offsets into name_table */ +static const unsigned short supported_local_im_values_list[] = { + OFFSET_XNQUERYINPUTSTYLE, + OFFSET_XNRESOURCENAME, + OFFSET_XNRESOURCECLASS, + OFFSET_XNDESTROYCALLBACK, + OFFSET_XNQUERYIMVALUESLIST, + OFFSET_XNQUERYICVALUESLIST, + OFFSET_XNVISIBLEPOSITION +}; + +/* offsets into name_table */ +static const unsigned short supported_local_ic_values_list[] = { + OFFSET_XNINPUTSTYLE, + OFFSET_XNCLIENTWINDOW, + OFFSET_XNFOCUSWINDOW, + OFFSET_XNRESOURCENAME, + OFFSET_XNRESOURCECLASS, + OFFSET_XNGEOMETRYCALLBACK, + OFFSET_XNFILTEREVENTS, + OFFSET_XNDESTROYCALLBACK, + OFFSET_XNSTRINGCONVERSIONCALLBACK, + OFFSET_XNSTRINGCONVERSIONCALLBACK, + OFFSET_XNRESETSTATE, + OFFSET_XNHOTKEY, + OFFSET_XNHOTKEYSTATE, + OFFSET_XNPREEDITATTRIBUTES, + OFFSET_XNSTATUSATTRIBUTES, + OFFSET_XNAREA, + OFFSET_XNAREANEEDED, + OFFSET_XNSPOTLOCATION, + OFFSET_XNCOLORMAP, + OFFSET_XNSTDCOLORMAP, + OFFSET_XNFOREGROUND, + OFFSET_XNBACKGROUND, + OFFSET_XNBACKGROUNDPIXMAP, + OFFSET_XNFONTSET, + OFFSET_XNLINESPACE, + OFFSET_XNCURSOR, + OFFSET_XNPREEDITSTARTCALLBACK, + OFFSET_XNPREEDITDONECALLBACK, + OFFSET_XNPREEDITDRAWCALLBACK, + OFFSET_XNPREEDITCARETCALLBACK, + OFFSET_XNSTATUSSTARTCALLBACK, + OFFSET_XNSTATUSDONECALLBACK, + OFFSET_XNSTATUSDRAWCALLBACK, + OFFSET_XNPREEDITSTATE, + OFFSET_XNPREEDITSTATENOTIFYCALLBACK +}; + +static XIMStyle const supported_local_styles[] = { + XIMPreeditNone | XIMStatusNone, + XIMPreeditNothing | XIMStatusNothing, + 0 /* dummy */ +}; + +static Bool +_XimDefaultStyles( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ +{ + XIMStyles *styles; + XIMStyles **out; + register int i; + unsigned int n; + int len; + XPointer tmp; + + n = XIMNumber(supported_local_styles) - 1; + len = sizeof(XIMStyles) + sizeof(XIMStyle) * n; + if(!(tmp = Xcalloc(1, len))) { + return False; + } + + styles = (XIMStyles *)tmp; + if (n > 0) { + styles->count_styles = (unsigned short)n; + styles->supported_styles = + (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); + for(i = 0; i < n; i++) { + styles->supported_styles[i] = supported_local_styles[i]; + } + } + + out = (XIMStyles **)((char *)top + info->offset); + *out = styles; + return True; +} + +static Bool +_XimDefaultIMValues( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ +{ + XIMValuesList *values_list; + XIMValuesList **out; + register int i; + unsigned int n; + int len; + XPointer tmp; + + n = XIMNumber(supported_local_im_values_list); + len = sizeof(XIMValuesList) + sizeof(char **) * n; + if(!(tmp = Xcalloc(1, len))) { + return False; + } + + values_list = (XIMValuesList *)tmp; + if (n > 0) { + values_list->count_values = (unsigned short)n; + values_list->supported_values + = (char **)((char *)tmp + sizeof(XIMValuesList)); + for(i = 0; i < n; i++) { + values_list->supported_values[i] = + (char *)name_table + supported_local_im_values_list[i]; + } + } + + out = (XIMValuesList **)((char *)top + info->offset); + *out = values_list; + return True; +} + +static Bool +_XimDefaultICValues( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ +{ + XIMValuesList *values_list; + XIMValuesList **out; + register int i; + unsigned int n; + int len; + XPointer tmp; + + n = XIMNumber(supported_local_ic_values_list); + len = sizeof(XIMValuesList) + sizeof(char **) * n; + if(!(tmp = Xcalloc(1, len))) { + return False; + } + + values_list = (XIMValuesList *)tmp; + if (n > 0) { + values_list->count_values = (unsigned short)n; + values_list->supported_values + = (char **)((char *)tmp + sizeof(XIMValuesList)); + for(i = 0; i < n; i++) { + values_list->supported_values[i] = + (char *)name_table + supported_local_ic_values_list[i]; + } + } + + out = (XIMValuesList **)((char *)top + info->offset); + *out = values_list; + return True; +} + +static Bool +_XimDefaultVisiblePos( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, /* unused */ + unsigned long mode) /* unused */ +{ + Bool *out; + + out = (Bool *)((char *)top + info->offset); + *out = False; + return True; +} + +static Bool +_XimDefaultFocusWindow( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Window *out; + + if(ic->core.client_window == (Window)NULL) { + return True; + } + + out = (Window *)((char *)top + info->offset); + *out = ic->core.client_window; + return True; +} + +static Bool +_XimDefaultResName( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + char **out; + + if(im->core.res_name == (char *)NULL) { + return True; + } + + out = (char **)((char *)top + info->offset); + *out = im->core.res_name; + return True; +} + +static Bool +_XimDefaultResClass( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + char **out; + + if(im->core.res_class == (char *)NULL) { + return True; + } + + out = (char **)((char *)top + info->offset); + *out = im->core.res_class; + return True; +} + +static Bool +_XimDefaultDestroyCB( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + XIMCallback *out; + + out = (XIMCallback *)((char *)top + info->offset); + *out = im->core.destroy_callback; + return True; +} + +static Bool +_XimDefaultResetState( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + XIMResetState *out; + + out = (XIMResetState *)((char *)top + info->offset); + *out = XIMInitialState; + return True; +} + +static Bool +_XimDefaultHotKeyState( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + XIMHotKeyState *out; + + out = (XIMHotKeyState *)((char *)top + info->offset); + *out = XIMHotKeyStateOFF; + return True; +} + +static Bool +_XimDefaultArea( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + Window root_return; + int x_return, y_return; + unsigned int width_return, height_return; + unsigned int border_width_return; + unsigned int depth_return; + XRectangle area; + XRectangle *out; + + if(ic->core.focus_window == (Window)NULL) { + return True; + } + if(XGetGeometry(im->core.display, (Drawable)ic->core.focus_window, + &root_return, &x_return, &y_return, &width_return, + &height_return, &border_width_return, &depth_return) + == (Status)Success) { + return True; + } + area.x = 0; + area.y = 0; + area.width = width_return; + area.height = height_return; + + out = (XRectangle *)((char *)top + info->offset); + *out = area; + return True; +} + +static Bool +_XimDefaultColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + XWindowAttributes win_attr; + Colormap *out; + + if(ic->core.client_window == (Window)NULL) { + return True; + } + if(XGetWindowAttributes(im->core.display, ic->core.client_window, + &win_attr) == (Status)Success) { + return True; + } + + out = (Colormap *)((char *)top + info->offset); + *out = win_attr.colormap; + return True; +} + +static Bool +_XimDefaultStdColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Atom *out; + + out = (Atom *)((char *)top + info->offset); + *out = (Atom)0; + return True; +} + +static Bool +_XimDefaultFg( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + unsigned long fg; + unsigned long *out; + + fg = WhitePixel(im->core.display, DefaultScreen(im->core.display)); + out = (unsigned long *)((char *)top + info->offset); + *out = fg; + return True; +} + +static Bool +_XimDefaultBg( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + Xim im = (Xim)ic->core.im; + unsigned long bg; + unsigned long *out; + + bg = BlackPixel(im->core.display, DefaultScreen(im->core.display)); + out = (unsigned long *)((char *)top + info->offset); + *out = bg; + return True; +} + +static Bool +_XimDefaultBgPixmap( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Pixmap *out; + + out = (Pixmap *)((char *)top + info->offset); + *out = (Pixmap)0; + return True; +} + +static Bool +_XimDefaultFontSet( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + XFontSet *out; + + out = (XFontSet *)((char *)top + info->offset); + *out = 0; + return True; +} + +static Bool +_XimDefaultLineSpace( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Xic ic = (Xic)parm; + XFontSet fontset; + XFontSetExtents *fset_extents; + int line_space = 0; + int *out; + + if(mode & XIM_PREEDIT_ATTR) { + fontset = ic->core.preedit_attr.fontset; + } else if(mode & XIM_STATUS_ATTR) { + fontset = ic->core.status_attr.fontset; + } else { + return True; + } + if (fontset) { + fset_extents = XExtentsOfFontSet(fontset); + line_space = fset_extents->max_logical_extent.height; + } + out = (int *)((char *)top + info->offset); + *out = line_space; + return True; +} + +static Bool +_XimDefaultCursor( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + Cursor *out; + + out = (Cursor *)((char *)top + info->offset); + *out = (Cursor)0; + return True; +} + +static Bool +_XimDefaultPreeditState( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + XIMPreeditState *out; + + out = (XIMPreeditState *)((char *)top + info->offset); + *out = XIMPreeditDisable; + return True; +} + +static Bool +_XimDefaultNest( + XimValueOffsetInfo info, + XPointer top, + XPointer parm, + unsigned long mode) +{ + return True; +} + +static Bool +_XimEncodeCallback( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMCallback *out; + + out = (XIMCallback *)((char *)top + info->offset); + *out = *((XIMCallback *)val); + return True; +} + +static Bool +_XimEncodeString( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + char *string; + char **out; + + if(val == (XPointer)NULL) { + return False; + } + if (!(string = strdup((char *)val))) { + return False; + } + + out = (char **)((char *)top + info->offset); + if(*out) { + Xfree(*out); + } + *out = string; + return True; +} + +static Bool +_XimEncodeStyle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMStyle *out; + + out = (XIMStyle *)((char *)top + info->offset); + *out = (XIMStyle)val; + return True; +} + +static Bool +_XimEncodeWindow( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Window *out; + + out = (Window *)((char *)top + info->offset); + *out = (Window)val; + return True; +} + +static Bool +_XimEncodeStringConv( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + /* + * Not yet + */ + return True; +} + +static Bool +_XimEncodeResetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMResetState *out; + + out = (XIMResetState *)((char *)top + info->offset); + *out = (XIMResetState)val; + return True; +} + +static Bool +_XimEncodeHotKey( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)val; + XIMHotKeyTriggers **out; + XIMHotKeyTriggers *key_list; + XIMHotKeyTrigger *key; + XPointer tmp; + int num; + int len; + register int i; + + if(hotkey == (XIMHotKeyTriggers *)NULL) { + return True; + } + + if((num = hotkey->num_hot_key) == 0) { + return True; + } + + len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; + if(!(tmp = Xmalloc(len))) { + return False; + } + + key_list = (XIMHotKeyTriggers *)tmp; + key = (XIMHotKeyTrigger *)((char *)tmp + sizeof(XIMHotKeyTriggers)); + + for(i = 0; i < num; i++) { + key[i] = hotkey->key[i]; + } + + key_list->num_hot_key = num; + key_list->key = key; + + out = (XIMHotKeyTriggers **)((char *)top + info->offset); + *out = key_list; + return True; +} + +static Bool +_XimEncodeHotKetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMHotKeyState *out; + + out = (XIMHotKeyState *)((char *)top + info->offset); + *out = (XIMHotKeyState)val; + return True; +} + +static Bool +_XimEncodeRectangle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XRectangle *out; + + out = (XRectangle *)((char *)top + info->offset); + *out = *((XRectangle *)val); + return True; +} + +static Bool +_XimEncodeSpot( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XPoint *out; + + out = (XPoint *)((char *)top + info->offset); + *out = *((XPoint *)val); + return True; +} + +static Bool +_XimEncodeColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Colormap *out; + + out = (Colormap *)((char *)top + info->offset); + *out = (Colormap)val; + return True; +} + +static Bool +_XimEncodeStdColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Atom *out; + + out = (Atom *)((char *)top + info->offset); + *out = (Atom)val; + return True; +} + +static Bool +_XimEncodeLong( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + unsigned long *out; + + out = (unsigned long *)((char *)top + info->offset); + *out = (unsigned long)val; + return True; +} + +static Bool +_XimEncodeBgPixmap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Pixmap *out; + + out = (Pixmap *)((char *)top + info->offset); + *out = (Pixmap)val; + return True; +} + +static Bool +_XimEncodeFontSet( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XFontSet *out; + + out = (XFontSet *)((char *)top + info->offset); + *out = (XFontSet)val; + return True; +} + +static Bool +_XimEncodeLineSpace( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + int *out; + + out = (int *)((char *)top + info->offset); + *out = (long)val; + return True; +} + +static Bool +_XimEncodeCursor( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Cursor *out; + + out = (Cursor *)((char *)top + info->offset); + *out = (Cursor)val; + return True; +} + +static Bool +_XimEncodePreeditState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMPreeditState *out; + + out = (XIMPreeditState *)((char *)top + info->offset); + *out = (XIMPreeditState)val; + return True; +} + +static Bool +_XimEncodeNest( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + return True; +} + +static Bool +_XimDecodeStyles( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMStyles *styles; + XIMStyles *out; + register int i; + unsigned int num; + int len; + XPointer tmp; + + if(val == (XPointer)NULL) { + return False; + } + + styles = *((XIMStyles **)((char *)top + info->offset)); + num = styles->count_styles; + + len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; + if(!(tmp = Xcalloc(1, len))) { + return False; + } + + out = (XIMStyles *)tmp; + if(num >0) { + out->count_styles = (unsigned short)num; + out->supported_styles = (XIMStyle *)((char *)tmp + sizeof(XIMStyles)); + + for(i = 0; i < num; i++) { + out->supported_styles[i] = styles->supported_styles[i]; + } + } + *((XIMStyles **)val) = out; + return True; +} + +static Bool +_XimDecodeValues( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMValuesList *values_list; + XIMValuesList *out; + register int i; + unsigned int num; + int len; + XPointer tmp; + + if(val == (XPointer)NULL) { + return False; + } + + values_list = *((XIMValuesList **)((char *)top + info->offset)); + num = values_list->count_values; + + len = sizeof(XIMValuesList) + sizeof(char **) * num; + if(!(tmp = Xcalloc(1, len))) { + return False; + } + + out = (XIMValuesList *)tmp; + if(num) { + out->count_values = (unsigned short)num; + out->supported_values = (char **)((char *)tmp + sizeof(XIMValuesList)); + + for(i = 0; i < num; i++) { + out->supported_values[i] = values_list->supported_values[i]; + } + } + *((XIMValuesList **)val) = out; + return True; +} + +static Bool +_XimDecodeCallback( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMCallback *in; + XIMCallback *callback; + + in = (XIMCallback *)((char *)top + info->offset); + if(!(callback = Xmalloc(sizeof(XIMCallback)))) { + return False; + } + callback->client_data = in->client_data; + callback->callback = in->callback; + + *((XIMCallback **)val) = callback; + return True; +} + +static Bool +_XimDecodeString( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + char *in; + char *string; + + in = *((char **)((char *)top + info->offset)); + if (in != NULL) { + string = strdup(in); + } else { + string = Xcalloc(1, 1); /* strdup("") */ + } + if (string == NULL) { + return False; + } + *((char **)val) = string; + return True; +} + +static Bool +_XimDecodeBool( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Bool *in; + + in = (Bool *)((char *)top + info->offset); + *((Bool *)val) = *in; + return True; +} + +static Bool +_XimDecodeStyle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMStyle *in; + + in = (XIMStyle *)((char *)top + info->offset); + *((XIMStyle *)val) = *in; + return True; +} + +static Bool +_XimDecodeWindow( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Window *in; + + in = (Window *)((char *)top + info->offset); + *((Window *)val) = *in; + return True; +} + +static Bool +_XimDecodeStringConv( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + /* + * Not yet + */ + return True; +} + +static Bool +_XimDecodeResetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMResetState *in; + + in = (XIMResetState *)((char *)top + info->offset); + *((XIMResetState *)val) = *in; + return True; +} + +static Bool +_XimDecodeHotKey( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMHotKeyTriggers *in; + XIMHotKeyTriggers *hotkey; + XIMHotKeyTrigger *key; + XPointer tmp; + int num; + int len; + register int i; + + in = *((XIMHotKeyTriggers **)((char *)top + info->offset)); + num = in->num_hot_key; + len = sizeof(XIMHotKeyTriggers) + sizeof(XIMHotKeyTrigger) * num; + if(!(tmp = Xmalloc(len))) { + return False; + } + + hotkey = (XIMHotKeyTriggers *)tmp; + key = (XIMHotKeyTrigger *)((char *)tmp + sizeof(XIMHotKeyTriggers)); + + for(i = 0; i < num; i++) { + key[i] = in->key[i]; + } + hotkey->num_hot_key = num; + hotkey->key = key; + + *((XIMHotKeyTriggers **)val) = hotkey; + return True; +} + +static Bool +_XimDecodeHotKetState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMHotKeyState *in; + + in = (XIMHotKeyState *)((char *)top + info->offset); + *((XIMHotKeyState *)val) = *in; + return True; +} + +static Bool +_XimDecodeRectangle( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XRectangle *in; + XRectangle *rect; + + in = (XRectangle *)((char *)top + info->offset); + if(!(rect = Xmalloc(sizeof(XRectangle)))) { + return False; + } + *rect = *in; + *((XRectangle **)val) = rect; + return True; +} + +static Bool +_XimDecodeSpot( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XPoint *in; + XPoint *spot; + + in = (XPoint *)((char *)top + info->offset); + if(!(spot = Xmalloc(sizeof(XPoint)))) { + return False; + } + *spot = *in; + *((XPoint **)val) = spot; + return True; +} + +static Bool +_XimDecodeColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Colormap *in; + + in = (Colormap *)((char *)top + info->offset); + *((Colormap *)val) = *in; + return True; +} + +static Bool +_XimDecodeStdColormap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Atom *in; + + in = (Atom *)((char *)top + info->offset); + *((Atom *)val) = *in; + return True; +} + +static Bool +_XimDecodeLong( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + unsigned long *in; + + in = (unsigned long *)((char *)top + info->offset); + *((unsigned long *)val) = *in; + return True; +} + +static Bool +_XimDecodeBgPixmap( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Pixmap *in; + + in = (Pixmap *)((char *)top + info->offset); + *((Pixmap *)val) = *in; + return True; +} + +static Bool +_XimDecodeFontSet( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XFontSet *in; + + in = (XFontSet *)((char *)top + info->offset); + *((XFontSet *)val) = *in; + return True; +} + +static Bool +_XimDecodeLineSpace( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + int *in; + + in = (int *)((char *)top + info->offset); + *((int *)val) = *in; + return True; +} + +static Bool +_XimDecodeCursor( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + Cursor *in; + + in = (Cursor *)((char *)top + info->offset); + *((Cursor *)val) = *in; + return True; +} + +static Bool +_XimDecodePreeditState( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + XIMPreeditState *in; + + in = (XIMPreeditState *)((char *)top + info->offset); + *((XIMPreeditState *)val) = *in; + return True; +} + +static Bool +_XimDecodeNest( + XimValueOffsetInfo info, + XPointer top, + XPointer val) +{ + return True; +} + +static XIMResource im_resources[] = { + {XNQueryInputStyle, 0, XimType_XIMStyles, 0, 0, 0}, + {XNDestroyCallback, 0, 0, 0, 0, 0}, + {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, + {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, + {XNQueryIMValuesList, 0, 0, 0, 0, 0}, + {XNQueryICValuesList, 0, 0, 0, 0, 0}, + {XNVisiblePosition, 0, 0, 0, 0, 0} +}; + +static XIMResource im_inner_resources[] = { + {XNDestroyCallback, 0, 0, 0, 0, 0}, + {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, + {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, + {XNQueryIMValuesList, 0, 0, 0, 0, 0}, + {XNQueryICValuesList, 0, 0, 0, 0, 0}, + {XNVisiblePosition, 0, 0, 0, 0, 0} +}; + +static XIMResource ic_resources[] = { + {XNInputStyle, 0, XimType_CARD32, 0, 0, 0}, + {XNClientWindow, 0, XimType_Window, 0, 0, 0}, + {XNFocusWindow, 0, XimType_Window, 0, 0, 0}, + {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, + {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, + {XNGeometryCallback, 0, 0, 0, 0, 0}, + {XNFilterEvents, 0, XimType_CARD32, 0, 0, 0}, + {XNDestroyCallback, 0, 0, 0, 0, 0}, + {XNStringConversionCallback, 0, 0, 0, 0, 0}, + {XNStringConversion, 0, XimType_XIMStringConversion,0, 0, 0}, + {XNResetState, 0, 0, 0, 0, 0}, + {XNHotKey, 0, XimType_XIMHotKeyTriggers,0, 0, 0}, + {XNHotKeyState, 0, XimType_XIMHotKeyState, 0, 0, 0}, + {XNPreeditAttributes, 0, XimType_NEST, 0, 0, 0}, + {XNStatusAttributes, 0, XimType_NEST, 0, 0, 0}, + {XNArea, 0, XimType_XRectangle, 0, 0, 0}, + {XNAreaNeeded, 0, XimType_XRectangle, 0, 0, 0}, + {XNSpotLocation, 0, XimType_XPoint, 0, 0, 0}, + {XNColormap, 0, XimType_CARD32, 0, 0, 0}, + {XNStdColormap, 0, XimType_CARD32, 0, 0, 0}, + {XNForeground, 0, XimType_CARD32, 0, 0, 0}, + {XNBackground, 0, XimType_CARD32, 0, 0, 0}, + {XNBackgroundPixmap, 0, XimType_CARD32, 0, 0, 0}, + {XNFontSet, 0, XimType_XFontSet, 0, 0, 0}, + {XNLineSpace, 0, XimType_CARD32, 0, 0, 0}, + {XNCursor, 0, XimType_CARD32, 0, 0, 0}, + {XNPreeditStartCallback, 0, 0, 0, 0, 0}, + {XNPreeditDoneCallback, 0, 0, 0, 0, 0}, + {XNPreeditDrawCallback, 0, 0, 0, 0, 0}, + {XNPreeditCaretCallback, 0, 0, 0, 0, 0}, + {XNStatusStartCallback, 0, 0, 0, 0, 0}, + {XNStatusDoneCallback, 0, 0, 0, 0, 0}, + {XNStatusDrawCallback, 0, 0, 0, 0, 0}, + {XNPreeditState, 0, 0, 0, 0, 0}, + {XNPreeditStateNotifyCallback, 0, 0, 0, 0, 0}, +}; + +static XIMResource ic_inner_resources[] = { + {XNResourceName, 0, XimType_STRING8, 0, 0, 0}, + {XNResourceClass, 0, XimType_STRING8, 0, 0, 0}, + {XNGeometryCallback, 0, 0, 0, 0, 0}, + {XNDestroyCallback, 0, 0, 0, 0, 0}, + {XNStringConversionCallback, 0, 0, 0, 0, 0}, + {XNPreeditStartCallback, 0, 0, 0, 0, 0}, + {XNPreeditDoneCallback, 0, 0, 0, 0, 0}, + {XNPreeditDrawCallback, 0, 0, 0, 0, 0}, + {XNPreeditCaretCallback, 0, 0, 0, 0, 0}, + {XNStatusStartCallback, 0, 0, 0, 0, 0}, + {XNStatusDoneCallback, 0, 0, 0, 0, 0}, + {XNStatusDrawCallback, 0, 0, 0, 0, 0}, + {XNPreeditStateNotifyCallback, 0, 0, 0, 0, 0}, +}; + +static XimValueOffsetInfoRec im_attr_info[] = { + {OFFSET_XNQUERYINPUTSTYLE, 0, + XOffsetOf(XimDefIMValues, styles), + _XimDefaultStyles, NULL, _XimDecodeStyles}, + + {OFFSET_XNDESTROYCALLBACK, 0, + XOffsetOf(XimDefIMValues, destroy_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNRESOURCENAME, 0, + XOffsetOf(XimDefIMValues, res_name), + NULL, _XimEncodeString, _XimDecodeString}, + + {OFFSET_XNRESOURCECLASS, 0, + XOffsetOf(XimDefIMValues, res_class), + NULL, _XimEncodeString, _XimDecodeString}, + + {OFFSET_XNQUERYIMVALUESLIST, 0, + XOffsetOf(XimDefIMValues, im_values_list), + _XimDefaultIMValues, NULL, _XimDecodeValues}, + + {OFFSET_XNQUERYICVALUESLIST, 0, + XOffsetOf(XimDefIMValues, ic_values_list), + _XimDefaultICValues, NULL, _XimDecodeValues}, + + {OFFSET_XNVISIBLEPOSITION, 0, + XOffsetOf(XimDefIMValues, visible_position), + _XimDefaultVisiblePos, NULL, _XimDecodeBool} +}; + +static XimValueOffsetInfoRec ic_attr_info[] = { + {OFFSET_XNINPUTSTYLE, 0, + XOffsetOf(XimDefICValues, input_style), + NULL, _XimEncodeStyle, _XimDecodeStyle}, + + {OFFSET_XNCLIENTWINDOW, 0, + XOffsetOf(XimDefICValues, client_window), + NULL, _XimEncodeWindow, _XimDecodeWindow}, + + {OFFSET_XNFOCUSWINDOW, 0, + XOffsetOf(XimDefICValues, focus_window), + _XimDefaultFocusWindow, _XimEncodeWindow, _XimDecodeWindow}, + + {OFFSET_XNRESOURCENAME, 0, + XOffsetOf(XimDefICValues, res_name), + _XimDefaultResName, _XimEncodeString, _XimDecodeString}, + + {OFFSET_XNRESOURCECLASS, 0, + XOffsetOf(XimDefICValues, res_class), + _XimDefaultResClass, _XimEncodeString, _XimDecodeString}, + + {OFFSET_XNGEOMETRYCALLBACK, 0, + XOffsetOf(XimDefICValues, geometry_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNFILTEREVENTS, 0, + XOffsetOf(XimDefICValues, filter_events), + NULL, NULL, _XimDecodeLong}, + + {OFFSET_XNDESTROYCALLBACK, 0, + XOffsetOf(XimDefICValues, destroy_callback), + _XimDefaultDestroyCB, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNSTRINGCONVERSIONCALLBACK, 0, + XOffsetOf(XimDefICValues, string_conversion_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNSTRINGCONVERSION, 0, + XOffsetOf(XimDefICValues, string_conversion), + NULL, _XimEncodeStringConv, _XimDecodeStringConv}, + + {OFFSET_XNRESETSTATE, 0, + XOffsetOf(XimDefICValues, reset_state), + _XimDefaultResetState, _XimEncodeResetState, _XimDecodeResetState}, + + {OFFSET_XNHOTKEY, 0, + XOffsetOf(XimDefICValues, hotkey), + NULL, _XimEncodeHotKey, _XimDecodeHotKey}, + + {OFFSET_XNHOTKEYSTATE, 0, + XOffsetOf(XimDefICValues, hotkey_state), + _XimDefaultHotKeyState, _XimEncodeHotKetState, _XimDecodeHotKetState}, + + {OFFSET_XNPREEDITATTRIBUTES, 0, + XOffsetOf(XimDefICValues, preedit_attr), + _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, + + {OFFSET_XNSTATUSATTRIBUTES, 0, + XOffsetOf(XimDefICValues, status_attr), + _XimDefaultNest, _XimEncodeNest, _XimDecodeNest}, +}; + +static XimValueOffsetInfoRec ic_pre_attr_info[] = { + {OFFSET_XNAREA, 0, + XOffsetOf(ICPreeditAttributes, area), + _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, + + {OFFSET_XNAREANEEDED, 0, + XOffsetOf(ICPreeditAttributes, area_needed), + NULL, _XimEncodeRectangle, _XimDecodeRectangle}, + + {OFFSET_XNSPOTLOCATION, 0, + XOffsetOf(ICPreeditAttributes, spot_location), + NULL, _XimEncodeSpot, _XimDecodeSpot}, + + {OFFSET_XNCOLORMAP, 0, + XOffsetOf(ICPreeditAttributes, colormap), + _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, + + {OFFSET_XNSTDCOLORMAP, 0, + XOffsetOf(ICPreeditAttributes, std_colormap), + _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, + + {OFFSET_XNFOREGROUND, 0, + XOffsetOf(ICPreeditAttributes, foreground), + _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, + + {OFFSET_XNBACKGROUND, 0, + XOffsetOf(ICPreeditAttributes, background), + _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, + + {OFFSET_XNBACKGROUNDPIXMAP, 0, + XOffsetOf(ICPreeditAttributes, background_pixmap), + _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, + + {OFFSET_XNFONTSET, 0, + XOffsetOf(ICPreeditAttributes, fontset), + _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, + + {OFFSET_XNLINESPACE, 0, + XOffsetOf(ICPreeditAttributes, line_spacing), + _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, + + {OFFSET_XNCURSOR, 0, + XOffsetOf(ICPreeditAttributes, cursor), + _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, + + {OFFSET_XNPREEDITSTARTCALLBACK, 0, + XOffsetOf(ICPreeditAttributes, start_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNPREEDITDONECALLBACK, 0, + XOffsetOf(ICPreeditAttributes, done_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNPREEDITDRAWCALLBACK, 0, + XOffsetOf(ICPreeditAttributes, draw_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNPREEDITCARETCALLBACK, 0, + XOffsetOf(ICPreeditAttributes, caret_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNPREEDITSTATE, 0, + XOffsetOf(ICPreeditAttributes, preedit_state), + _XimDefaultPreeditState, _XimEncodePreeditState,_XimDecodePreeditState}, + + {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, 0, + XOffsetOf(ICPreeditAttributes, state_notify_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, +}; + +static XimValueOffsetInfoRec ic_sts_attr_info[] = { + {OFFSET_XNAREA, 0, + XOffsetOf(ICStatusAttributes, area), + _XimDefaultArea, _XimEncodeRectangle, _XimDecodeRectangle}, + + {OFFSET_XNAREANEEDED, 0, + XOffsetOf(ICStatusAttributes, area_needed), + NULL, _XimEncodeRectangle, _XimDecodeRectangle}, + + {OFFSET_XNCOLORMAP, 0, + XOffsetOf(ICStatusAttributes, colormap), + _XimDefaultColormap, _XimEncodeColormap, _XimDecodeColormap}, + + {OFFSET_XNSTDCOLORMAP, 0, + XOffsetOf(ICStatusAttributes, std_colormap), + _XimDefaultStdColormap, _XimEncodeStdColormap, _XimDecodeStdColormap}, + + {OFFSET_XNFOREGROUND, 0, + XOffsetOf(ICStatusAttributes, foreground), + _XimDefaultFg, _XimEncodeLong, _XimDecodeLong}, + + {OFFSET_XNBACKGROUND, 0, + XOffsetOf(ICStatusAttributes, background), + _XimDefaultBg, _XimEncodeLong, _XimDecodeLong}, + + {OFFSET_XNBACKGROUNDPIXMAP, 0, + XOffsetOf(ICStatusAttributes, background_pixmap), + _XimDefaultBgPixmap, _XimEncodeBgPixmap, _XimDecodeBgPixmap}, + + {OFFSET_XNFONTSET, 0, + XOffsetOf(ICStatusAttributes, fontset), + _XimDefaultFontSet, _XimEncodeFontSet, _XimDecodeFontSet}, + + {OFFSET_XNLINESPACE, 0, + XOffsetOf(ICStatusAttributes, line_spacing), + _XimDefaultLineSpace, _XimEncodeLineSpace, _XimDecodeLineSpace}, + + {OFFSET_XNCURSOR, 0, + XOffsetOf(ICStatusAttributes, cursor), + _XimDefaultCursor, _XimEncodeCursor, _XimDecodeCursor}, + + {OFFSET_XNSTATUSSTARTCALLBACK, 0, + XOffsetOf(ICStatusAttributes, start_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNSTATUSDONECALLBACK, 0, + XOffsetOf(ICStatusAttributes, done_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback}, + + {OFFSET_XNSTATUSDRAWCALLBACK, 0, + XOffsetOf(ICStatusAttributes, draw_callback), + NULL, _XimEncodeCallback, _XimDecodeCallback} +}; + +typedef struct _XimIMMode { + unsigned short name_offset; + unsigned short mode; +} XimIMMode; + +static const XimIMMode im_mode[] = { + {OFFSET_XNQUERYINPUTSTYLE, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, + {OFFSET_XNDESTROYCALLBACK, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, + {OFFSET_XNRESOURCENAME, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, + {OFFSET_XNRESOURCECLASS, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_SET | XIM_MODE_IM_GET)}, + {OFFSET_XNQUERYIMVALUESLIST, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, + {OFFSET_XNQUERYICVALUESLIST, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)}, + {OFFSET_XNVISIBLEPOSITION, + (XIM_MODE_IM_DEFAULT | XIM_MODE_IM_GET)} +}; + +typedef struct _XimICMode { + unsigned short name_offset; + unsigned short preedit_callback_mode; + unsigned short preedit_position_mode; + unsigned short preedit_area_mode; + unsigned short preedit_nothing_mode; + unsigned short preedit_none_mode; + unsigned short status_callback_mode; + unsigned short status_area_mode; + unsigned short status_nothing_mode; + unsigned short status_none_mode; +} XimICMode; + +static const XimICMode ic_mode[] = { + {OFFSET_XNINPUTSTYLE, + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_GET), + (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), + (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), + (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET), + (XIM_MODE_STS_CREATE | XIM_MODE_STS_GET)}, + {OFFSET_XNCLIENTWINDOW, + (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_ONCE | XIM_MODE_PRE_GET), + 0, + (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), + (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), + (XIM_MODE_STS_ONCE | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNFOCUSWINDOW, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNRESOURCENAME, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNRESOURCECLASS, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNGEOMETRYCALLBACK, + 0, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0, + 0}, + {OFFSET_XNFILTEREVENTS, + XIM_MODE_PRE_GET, + XIM_MODE_PRE_GET, + XIM_MODE_PRE_GET, + XIM_MODE_PRE_GET, + 0, + XIM_MODE_STS_GET, + XIM_MODE_STS_GET, + XIM_MODE_STS_GET, + XIM_MODE_STS_GET}, + {OFFSET_XNDESTROYCALLBACK, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0}, + {OFFSET_XNSTRINGCONVERSIONCALLBACK, + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0}, + {OFFSET_XNSTRINGCONVERSION, + XIM_MODE_PRE_SET, + XIM_MODE_PRE_SET, + XIM_MODE_PRE_SET, + XIM_MODE_PRE_SET, + XIM_MODE_PRE_SET, + 0, + 0, + 0, + 0}, + {OFFSET_XNRESETSTATE, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNHOTKEY, + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNHOTKEYSTATE, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNPREEDITATTRIBUTES, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNSTATUSATTRIBUTES, + 0, + 0, + 0, + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNAREA, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0, + 0}, + {OFFSET_XNAREANEEDED, + 0, + 0, + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + (XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0, + 0}, + {OFFSET_XNSPOTLOCATION, + 0, /*(XIM_MODE_PRE_SET | XIM_MODE_PRE_GET),*/ + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0}, + {OFFSET_XNCOLORMAP, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNSTDCOLORMAP, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNFOREGROUND, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNBACKGROUND, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNBACKGROUNDPIXMAP, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNFONTSET, + 0, + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNLINESPACE, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNCURSOR, + 0, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + (XIM_MODE_STS_DEFAULT | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0}, + {OFFSET_XNPREEDITSTARTCALLBACK, + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNPREEDITDONECALLBACK, + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNPREEDITDRAWCALLBACK, + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNPREEDITCARETCALLBACK, + (XIM_MODE_PRE_CREATE | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNPREEDITSTATE, + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_DEFAULT | XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNPREEDITSTATENOTIFYCALLBACK, + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + (XIM_MODE_PRE_SET | XIM_MODE_PRE_GET), + 0, + 0, + 0, + 0, + 0}, + {OFFSET_XNSTATUSSTARTCALLBACK, + 0, + 0, + 0, + 0, + 0, + (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0, + 0, + 0}, + {OFFSET_XNSTATUSDONECALLBACK, + 0, + 0, + 0, + 0, + 0, + (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0, + 0, + 0}, + {OFFSET_XNSTATUSDRAWCALLBACK, + 0, + 0, + 0, + 0, + 0, + (XIM_MODE_STS_CREATE | XIM_MODE_STS_SET | XIM_MODE_STS_GET), + 0, + 0, + 0} +}; + +/* the quarks are separated from im_mode/ic_mode so those arrays + * can be const. + */ +static XrmQuark im_mode_quark[sizeof(im_mode) / sizeof(im_mode[0])]; +static XrmQuark ic_mode_quark[sizeof(ic_mode) / sizeof(ic_mode[0])]; + +static Bool +_XimSetResourceList( + XIMResourceList *res_list, + unsigned int *list_num, + XIMResourceList resource, + unsigned int num_resource, + unsigned short id) +{ + register int i; + int len; + XIMResourceList res; + + len = sizeof(XIMResource) * num_resource; + if(!(res = Xcalloc(1, len))) { + return False; + } + + for(i = 0; i < num_resource; i++, id++) { + res[i] = resource[i]; + res[i].id = id; + } + + _XIMCompileResourceList(res, num_resource); + *res_list = res; + *list_num = num_resource; + return True; +} + +Bool +_XimSetIMResourceList( + XIMResourceList *res_list, + unsigned int *list_num) +{ + return _XimSetResourceList(res_list, list_num, + im_resources, XIMNumber(im_resources), 100); +} + +Bool +_XimSetICResourceList( + XIMResourceList *res_list, + unsigned int *list_num) +{ + return _XimSetResourceList(res_list, list_num, + ic_resources, XIMNumber(ic_resources), 200); +} + +Bool +_XimSetInnerIMResourceList( + XIMResourceList *res_list, + unsigned int *list_num) +{ + return _XimSetResourceList(res_list, list_num, + im_inner_resources, XIMNumber(im_inner_resources), 100); +} + +Bool +_XimSetInnerICResourceList( + XIMResourceList *res_list, + unsigned int *list_num) +{ + return _XimSetResourceList(res_list, list_num, + ic_inner_resources, XIMNumber(ic_inner_resources), 200); +} + +static XIMResourceList +_XimGetResourceListRecByMode( + XIMResourceList res_list, + unsigned int list_num, + unsigned short mode) +{ + register int i; + + for(i = 0; i < list_num; i++) { + if (res_list[i].mode & mode) { + return (XIMResourceList)&res_list[i]; + } + } + return (XIMResourceList)NULL; +} + +Bool +_XimCheckCreateICValues( + XIMResourceList res_list, + unsigned int list_num) +{ + if (!_XimGetResourceListRecByMode(res_list, list_num, XIM_MODE_IC_CREATE)) { + return True; + } + return False; +} + +XIMResourceList +_XimGetResourceListRecByQuark( + XIMResourceList res_list, + unsigned int list_num, + XrmQuark quark) +{ + register int i; + + for(i = 0; i < list_num; i++) { + if (res_list[i].xrm_name == quark) { + return (XIMResourceList)&res_list[i]; + } + } + return (XIMResourceList)NULL; +} + +XIMResourceList +_XimGetResourceListRec( + XIMResourceList res_list, + unsigned int list_num, + const char *name) +{ + XrmQuark quark = XrmStringToQuark(name); + + return _XimGetResourceListRecByQuark(res_list, list_num, quark); +} + +char * +_XimSetIMValueData( + Xim im, + XPointer top, + XIMArg *values, + XIMResourceList res_list, + unsigned int list_num) +{ + register XIMArg *p; + XIMResourceList res; + int check; + + for(p = values; p->name != NULL; p++) { + if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { + return p->name; + } + check = _XimCheckIMMode(res, XIM_SETIMVALUES); + if(check == XIM_CHECK_INVALID) { + continue; + } else if (check == XIM_CHECK_ERROR) { + return p->name; + } + + if(!_XimEncodeLocalIMAttr(res, top, p->value)) { + return p->name; + } + } + return NULL; +} + +char * +_XimGetIMValueData( + Xim im, + XPointer top, + XIMArg *values, + XIMResourceList res_list, + unsigned int list_num) +{ + register XIMArg *p; + XIMResourceList res; + int check; + + for(p = values; p->name != NULL; p++) { + if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { + return p->name; + } + check = _XimCheckIMMode(res, XIM_GETIMVALUES); + if(check == XIM_CHECK_INVALID) { + continue; + } else if (check == XIM_CHECK_ERROR) { + return p->name; + } + + if(!_XimDecodeLocalIMAttr(res, top, p->value)) { + return p->name; + } + } + return NULL; +} + +void +_XimSetIMMode( + XIMResourceList res_list, + unsigned int list_num) +{ + XIMResourceList res; + unsigned int n = XIMNumber(im_mode); + register int i; + + for(i = 0; i < n; i++) { + if(!(res = _XimGetResourceListRecByQuark(res_list, + list_num, im_mode_quark[i]))) { + continue; + } + res->mode = im_mode[i].mode; + } + return; +} + +static int +_XimCheckSetIMDefaultsMode( + XIMResourceList res) +{ + if(res->mode & XIM_MODE_IM_DEFAULT) { + return XIM_CHECK_VALID; + } + return XIM_CHECK_INVALID; +} + +static int +_XimCheckSetIMValuesMode( + XIMResourceList res) +{ + if(res->mode & XIM_MODE_IM_SET) { + return XIM_CHECK_VALID; + } + return XIM_CHECK_INVALID; +} + +static int + _XimCheckGetIMValuesMode( + XIMResourceList res) +{ + if(res->mode & XIM_MODE_IM_GET) { + return XIM_CHECK_VALID; + } + return XIM_CHECK_INVALID; +} + +int + _XimCheckIMMode( + XIMResourceList res, + unsigned long mode) +{ + if(res->mode == 0) { + return XIM_CHECK_INVALID; + } + if(mode & XIM_SETIMDEFAULTS) { + return _XimCheckSetIMDefaultsMode(res); + } else if (mode & XIM_SETIMVALUES) { + return _XimCheckSetIMValuesMode(res); + } else if (mode & XIM_GETIMVALUES) { + return _XimCheckGetIMValuesMode(res); + } else { + return XIM_CHECK_ERROR; + } +} + +void +_XimSetICMode(XIMResourceList res_list, unsigned int list_num, XIMStyle style) +{ + XIMResourceList res; + unsigned int n = XIMNumber(ic_mode); + register int i; + unsigned int pre_offset; + unsigned int sts_offset; + + if(style & XIMPreeditArea) { + pre_offset = XOffsetOf(XimICMode, preedit_area_mode); + } else if(style & XIMPreeditCallbacks) { + pre_offset = XOffsetOf(XimICMode, preedit_callback_mode); + } else if(style & XIMPreeditPosition) { + pre_offset = XOffsetOf(XimICMode, preedit_position_mode); + } else if(style & XIMPreeditNothing) { + pre_offset = XOffsetOf(XimICMode, preedit_nothing_mode); + } else { + pre_offset = XOffsetOf(XimICMode, preedit_none_mode); + } + + if(style & XIMStatusArea) { + sts_offset = XOffsetOf(XimICMode, status_area_mode); + } else if(style & XIMStatusCallbacks) { + sts_offset = XOffsetOf(XimICMode, status_callback_mode); + } else if(style & XIMStatusNothing) { + sts_offset = XOffsetOf(XimICMode, status_nothing_mode); + } else { + sts_offset = XOffsetOf(XimICMode, status_none_mode); + } + + for(i = 0; i < n; i++) { + if(!(res = _XimGetResourceListRecByQuark(res_list, + list_num, ic_mode_quark[i]))) { + continue; + } + res->mode = ( (*(const unsigned short *)((const char *)&ic_mode[i] + pre_offset)) + | (*(const unsigned short *)((const char *)&ic_mode[i] + sts_offset))); + } + return; +} + +static int +_XimCheckSetICDefaultsMode( + XIMResourceList res, + unsigned long mode) +{ + if(mode & XIM_PREEDIT_ATTR) { + if(!(res->mode & XIM_MODE_PRE_MASK)) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_PRE_CREATE) { + return XIM_CHECK_ERROR; + } else if (!(res->mode & XIM_MODE_PRE_DEFAULT)) { + return XIM_CHECK_INVALID; + } + + } else if(mode & XIM_STATUS_ATTR) { + if(!(res->mode & XIM_MODE_STS_MASK)) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_STS_CREATE) { + return XIM_CHECK_ERROR; + } + if(!(res->mode & XIM_MODE_STS_DEFAULT)) { + return XIM_CHECK_INVALID; + } + + } else { + if(!res->mode) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_IC_CREATE) { + return XIM_CHECK_ERROR; + } + if(!(res->mode & XIM_MODE_IC_DEFAULT)) { + return XIM_CHECK_INVALID; + } + } + return XIM_CHECK_VALID; +} + +static int +_XimCheckCreateICMode( + XIMResourceList res, + unsigned long mode) +{ + if(mode & XIM_PREEDIT_ATTR) { + if(!(res->mode & XIM_MODE_PRE_MASK)) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_PRE_CREATE) { + res->mode &= ~XIM_MODE_PRE_CREATE; + } else if(res->mode & XIM_MODE_PRE_ONCE) { + res->mode &= ~XIM_MODE_PRE_ONCE; + } else if(res->mode & XIM_MODE_PRE_DEFAULT) { + res->mode &= ~XIM_MODE_PRE_DEFAULT; + } else if (!(res->mode & XIM_MODE_PRE_SET)) { + return XIM_CHECK_ERROR; + } + + } else if(mode & XIM_STATUS_ATTR) { + if(!(res->mode & XIM_MODE_STS_MASK)) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_STS_CREATE) { + res->mode &= ~XIM_MODE_STS_CREATE; + } else if(res->mode & XIM_MODE_STS_ONCE) { + res->mode &= ~XIM_MODE_STS_ONCE; + } else if(res->mode & XIM_MODE_STS_DEFAULT) { + res->mode &= ~XIM_MODE_STS_DEFAULT; + } else if (!(res->mode & XIM_MODE_STS_SET)) { + return XIM_CHECK_ERROR; + } + + } else { + if(!res->mode) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_IC_CREATE) { + res->mode &= ~XIM_MODE_IC_CREATE; + } else if(res->mode & XIM_MODE_IC_ONCE) { + res->mode &= ~XIM_MODE_IC_ONCE; + } else if(res->mode & XIM_MODE_IC_DEFAULT) { + res->mode &= ~XIM_MODE_IC_DEFAULT; + } else if (!(res->mode & XIM_MODE_IC_SET)) { + return XIM_CHECK_ERROR; + } + } + return XIM_CHECK_VALID; +} + +static int +_XimCheckSetICValuesMode( + XIMResourceList res, + unsigned long mode) +{ + if(mode & XIM_PREEDIT_ATTR) { + if(!(res->mode & XIM_MODE_PRE_MASK)) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_PRE_ONCE) { + res->mode &= ~XIM_MODE_PRE_ONCE; + } else if(!(res->mode & XIM_MODE_PRE_SET)) { + return XIM_CHECK_ERROR; + } + + } else if(mode & XIM_STATUS_ATTR) { + if(!(res->mode & XIM_MODE_STS_MASK)) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_STS_ONCE) { + res->mode &= ~XIM_MODE_STS_ONCE; + } else if(!(res->mode & XIM_MODE_STS_SET)) { + return XIM_CHECK_ERROR; + } + + } else { + if(!res->mode) { + return XIM_CHECK_INVALID; + } + + if(res->mode & XIM_MODE_IC_ONCE) { + res->mode &= ~XIM_MODE_IC_ONCE; + } else if(!(res->mode & XIM_MODE_IC_SET)) { + return XIM_CHECK_ERROR; + } + } + return XIM_CHECK_VALID; +} + +static int +_XimCheckGetICValuesMode( + XIMResourceList res, + unsigned long mode) +{ + if(mode & XIM_PREEDIT_ATTR) { + if(!(res->mode & XIM_MODE_PRE_MASK)) { + return XIM_CHECK_INVALID; + } + + if(!(res->mode & XIM_MODE_PRE_GET)) { + return XIM_CHECK_ERROR; + } + + } else if(mode & XIM_STATUS_ATTR) { + if(!(res->mode & XIM_MODE_STS_MASK)) { + return XIM_CHECK_INVALID; + } + + if(!(res->mode & XIM_MODE_STS_GET)) { + return XIM_CHECK_ERROR; + } + + } else { + if(!res->mode) { + return XIM_CHECK_INVALID; + } + + if(!(res->mode & XIM_MODE_IC_GET)) { + return XIM_CHECK_ERROR; + } + } + return XIM_CHECK_VALID; +} + +int + _XimCheckICMode( + XIMResourceList res, + unsigned long mode) +{ + if(mode &XIM_SETICDEFAULTS) { + return _XimCheckSetICDefaultsMode(res, mode); + } else if (mode & XIM_CREATEIC) { + return _XimCheckCreateICMode(res, mode); + } else if (mode & XIM_SETICVALUES) { + return _XimCheckSetICValuesMode(res, mode); + } else if (mode & XIM_GETICVALUES) { + return _XimCheckGetICValuesMode(res, mode); + } else { + return XIM_CHECK_ERROR; + } +} + +Bool +_XimSetLocalIMDefaults( + Xim im, + XPointer top, + XIMResourceList res_list, + unsigned int list_num) +{ + XimValueOffsetInfo info; + unsigned int num; + register int i; + XIMResourceList res; + int check; + + info = im_attr_info; + num = XIMNumber(im_attr_info); + + for(i = 0; i < num; i++) { + if((res = _XimGetResourceListRecByQuark( res_list, list_num, + info[i].quark)) == (XIMResourceList)NULL) { + return False; + } + + check = _XimCheckIMMode(res, XIM_SETIMDEFAULTS); + if(check == XIM_CHECK_INVALID) { + continue; + } else if (check == XIM_CHECK_ERROR) { + return False; + } + + if(!info[i].defaults) { + continue; + } + if(!(info[i].defaults(&info[i], top, (XPointer)NULL, 0))) { + return False; + } + } + return True; +} + +Bool +_XimSetICDefaults( + Xic ic, + XPointer top, + unsigned long mode, + XIMResourceList res_list, + unsigned int list_num) +{ + unsigned int num; + XimValueOffsetInfo info; + register int i; + XIMResourceList res; + int check; + XrmQuark pre_quark; + XrmQuark sts_quark; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + + if(mode & XIM_PREEDIT_ATTR) { + info = ic_pre_attr_info; + num = XIMNumber(ic_pre_attr_info); + } else if(mode & XIM_STATUS_ATTR) { + info = ic_sts_attr_info; + num = XIMNumber(ic_sts_attr_info); + } else { + info = ic_attr_info; + num = XIMNumber(ic_attr_info); + } + + for(i = 0; i < num; i++) { + if(info[i].quark == pre_quark) { + if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), + (mode | XIM_PREEDIT_ATTR), res_list, list_num)) { + return False; + } + } else if (info[i].quark == sts_quark) { + if(!_XimSetICDefaults(ic, (XPointer)((char *)top + info[i].offset), + (mode | XIM_STATUS_ATTR), res_list, list_num)) { + return False; + } + } else { + if(!(res = _XimGetResourceListRecByQuark(res_list, list_num, + info[i].quark))) { + return False; + } + + check = _XimCheckICMode(res, mode); + if (check == XIM_CHECK_INVALID) { + continue; + } else if (check == XIM_CHECK_ERROR) { + return False; + } + + if (!info[i].defaults) { + continue; + } + if (!(info[i].defaults(&info[i], top, (XPointer)ic, mode))) { + return False; + } + } + } + return True; +} + +static Bool +_XimEncodeAttr( + XimValueOffsetInfo info, + unsigned int num, + XIMResourceList res, + XPointer top, + XPointer val) +{ + register int i; + + for(i = 0; i < num; i++ ) { + if(info[i].quark == res->xrm_name) { + if(!info[i].encode) { + return False; + } + return (*info[i].encode)(&info[i], top, val); + } + } + return False; +} + +Bool +_XimEncodeLocalIMAttr( + XIMResourceList res, + XPointer top, + XPointer val) +{ + return _XimEncodeAttr(im_attr_info, XIMNumber(im_attr_info), + res, top, val); +} + +Bool +_XimEncodeLocalICAttr( + Xic ic, + XIMResourceList res, + XPointer top, + XIMArg *arg, + unsigned long mode) +{ + unsigned int num; + XimValueOffsetInfo info; + + if(mode & XIM_PREEDIT_ATTR) { + info = ic_pre_attr_info; + num = XIMNumber(ic_pre_attr_info); + } else if(mode & XIM_STATUS_ATTR) { + info = ic_sts_attr_info; + num = XIMNumber(ic_sts_attr_info); + } else { + info = ic_attr_info; + num = XIMNumber(ic_attr_info); + } + + return _XimEncodeAttr(info, num, res, top, arg->value); +} + +static Bool +_XimEncodeLocalTopValue( + Xic ic, + XIMResourceList res, + XPointer val, + Bool flag) +{ + XIMArg *p = (XIMArg *)val; + + if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { + ic->core.client_window = (Window)p->value; + if (ic->core.focus_window == (Window)0) + ic->core.focus_window = ic->core.client_window; + if (flag) { + _XRegisterFilterByType(ic->core.im->core.display, + ic->core.focus_window, + KeyPress, KeyRelease, _XimLocalFilter, (XPointer)ic); + } + } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { + if (ic->core.client_window) { + if (flag) { + _XUnregisterFilter(ic->core.im->core.display, + ic->core.focus_window, _XimLocalFilter, (XPointer)ic); + } + ic->core.focus_window = (Window)p->value; + if (flag) { + _XRegisterFilterByType(ic->core.im->core.display, + ic->core.focus_window, KeyPress, KeyRelease, + _XimLocalFilter, (XPointer)ic); + } + } else + ic->core.focus_window = (Window)p->value; + } + return True; +} + +static Bool +_XimEncodeLocalPreeditValue( + Xic ic, + XIMResourceList res, + XPointer val) +{ + XIMArg *p = (XIMArg *)val; + + if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { + XStandardColormap *colormap_ret; + int count; + + if (!(XGetRGBColormaps(ic->core.im->core.display, + ic->core.focus_window, &colormap_ret, + &count, (Atom)p->value))) + return False; + + Xfree(colormap_ret); + } + return True; +} + +static Bool +_XimEncodeLocalStatusValue( + Xic ic, + XIMResourceList res, + XPointer val) +{ + XIMArg *p = (XIMArg *)val; + + if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { + XStandardColormap *colormap_ret; + int count; + + if (!(XGetRGBColormaps(ic->core.im->core.display, + ic->core.focus_window, &colormap_ret, + &count, (Atom)p->value))) + return False; + + Xfree(colormap_ret); + } + return True; +} + +char * +_XimSetICValueData( + Xic ic, + XPointer top, + XIMResourceList res_list, + unsigned int list_num, + XIMArg *values, + unsigned long mode, + Bool flag) +{ + register XIMArg *p; + XIMResourceList res; + char *name; + int check; + XrmQuark pre_quark; + XrmQuark sts_quark; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + + for(p = values; p->name != NULL; p++) { + if((res = _XimGetResourceListRec(res_list, list_num, + p->name)) == (XIMResourceList)NULL) { + return p->name; + } + if(res->xrm_name == pre_quark) { + if(((name = _XimSetICValueData(ic, + (XPointer)(&((XimDefICValues *)top)->preedit_attr), + res_list, list_num, (XIMArg *)p->value, + (mode | XIM_PREEDIT_ATTR), flag)))) { + return name; + } + } else if(res->xrm_name == sts_quark) { + if(((name = _XimSetICValueData(ic, + (XPointer)(&((XimDefICValues *)top)->status_attr), + res_list, list_num, (XIMArg *)p->value, + (mode | XIM_STATUS_ATTR), flag)))) { + return name; + } + } else { + check = _XimCheckICMode(res, mode); + if(check == XIM_CHECK_INVALID) { + continue; + } else if(check == XIM_CHECK_ERROR) { + return p->name; + } + + if(mode & XIM_PREEDIT_ATTR) { + if (!_XimEncodeLocalPreeditValue(ic, res, (XPointer)p)) + return p->name; + } else if(mode & XIM_STATUS_ATTR) { + if (!_XimEncodeLocalStatusValue(ic, res, (XPointer)p)) + return p->name; + } else { + if (!_XimEncodeLocalTopValue(ic, res, (XPointer)p, flag)) + return p->name; + } + if(_XimEncodeLocalICAttr(ic, res, top, p, mode) == False) { + return p->name; + } + } + } + return NULL; +} + +static Bool +_XimCheckInputStyle( + XIMStyles *styles, + XIMStyle style) +{ + int num = styles->count_styles; + register int i; + + for(i = 0; i < num; i++) { + if(styles->supported_styles[i] == style) { + return True; + } + } + return False; +} + +Bool +_XimCheckLocalInputStyle( + Xic ic, + XPointer top, + XIMArg *values, + XIMStyles *styles, + XIMResourceList res_list, + unsigned int list_num) +{ + XrmQuark quark = XrmStringToQuark(XNInputStyle); + register XIMArg *p; + XIMResourceList res; + + for(p = values; p && p->name != NULL; p++) { + if(quark == XrmStringToQuark(p->name)) { + if(!(res = _XimGetResourceListRec(res_list, list_num, p->name))) { + return False; + } + if(!_XimEncodeLocalICAttr(ic, res, top, p, 0)) { + return False; + } + if (_XimCheckInputStyle(styles, + ((XimDefICValues *)top)->input_style)) { + return True; + } + return False; + } + } + return False; +} + +static Bool +_XimDecodeAttr( + XimValueOffsetInfo info, + unsigned int num, + XIMResourceList res, + XPointer top, + XPointer val) +{ + register int i; + + for(i = 0; i < num; i++ ) { + if(info[i].quark == res->xrm_name) { + if(!info[i].decode) { + return False; + } + return (*info[i].decode)(&info[i], top, val); + } + } + return False; +} + +Bool +_XimDecodeLocalIMAttr( + XIMResourceList res, + XPointer top, + XPointer val) +{ + return _XimDecodeAttr(im_attr_info, XIMNumber(im_attr_info), + res, top, val); +} + +Bool +_XimDecodeLocalICAttr( + XIMResourceList res, + XPointer top, + XPointer val, + unsigned long mode) +{ + unsigned int num; + XimValueOffsetInfo info; + + if(mode & XIM_PREEDIT_ATTR) { + info = ic_pre_attr_info; + num = XIMNumber(ic_pre_attr_info); + } else if(mode & XIM_STATUS_ATTR) { + info = ic_sts_attr_info; + num = XIMNumber(ic_sts_attr_info); + } else { + info = ic_attr_info; + num = XIMNumber(ic_attr_info); + } + + return _XimDecodeAttr(info, num, res, top, val); +} + +char * +_XimGetICValueData(Xic ic, XPointer top, XIMResourceList res_list, + unsigned int list_num, XIMArg *values, unsigned long mode) +{ + register XIMArg *p; + XIMResourceList res; + char *name; + int check; + XrmQuark pre_quark; + XrmQuark sts_quark; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + + for(p = values; p->name != NULL; p++) { + if((res = _XimGetResourceListRec(res_list, list_num, + p->name)) == (XIMResourceList)NULL) { + return p->name; + } + if(res->xrm_name == pre_quark) { + if((name = _XimGetICValueData(ic, + (XPointer)(&((XimDefICValues *)top)->preedit_attr), + res_list, list_num, (XIMArg *)p->value, + (mode | XIM_PREEDIT_ATTR)))) { + return name; + } + } else if(res->xrm_name == sts_quark) { + if((name = _XimGetICValueData(ic, + (XPointer)(&((XimDefICValues *)top)->status_attr), + res_list, list_num, (XIMArg *)p->value, + (mode | XIM_STATUS_ATTR)))) { + return name; + } + } else { + check = _XimCheckICMode(res, mode); + if(check == XIM_CHECK_INVALID) { + continue; + } else if(check == XIM_CHECK_ERROR) { + return p->name; + } + + if(_XimDecodeLocalICAttr(res, top, p->value, mode) == False) { + return p->name; + } + } + } + return NULL; +} + +void +_XimGetCurrentIMValues(Xim im, XimDefIMValues *im_values) +{ + bzero((char *)im_values, sizeof(XimDefIMValues)); + + im_values->styles = im->core.styles; + im_values->im_values_list = im->core.im_values_list; + im_values->ic_values_list = im->core.ic_values_list; + im_values->destroy_callback = im->core.destroy_callback; + im_values->res_name = im->core.res_name; + im_values->res_class = im->core.res_class; + im_values->visible_position = im->core.visible_position; +} + +void +_XimSetCurrentIMValues(Xim im, XimDefIMValues *im_values) +{ + im->core.styles = im_values->styles; + im->core.im_values_list = im_values->im_values_list; + im->core.ic_values_list = im_values->ic_values_list; + im->core.destroy_callback = im_values->destroy_callback; + im->core.res_name = im_values->res_name; + im->core.res_class = im_values->res_class; + im->core.visible_position = im_values->visible_position; +} + +void +_XimGetCurrentICValues(Xic ic, XimDefICValues *ic_values) +{ + bzero((char *)ic_values, sizeof(XimDefICValues)); + + ic_values->input_style = ic->core.input_style; + ic_values->client_window = ic->core.client_window; + ic_values->focus_window = ic->core.focus_window; + ic_values->filter_events = ic->core.filter_events; + ic_values->geometry_callback = ic->core.geometry_callback; + ic_values->res_name = ic->core.res_name; + ic_values->res_class = ic->core.res_class; + ic_values->destroy_callback = ic->core.destroy_callback; + ic_values->string_conversion_callback + = ic->core.string_conversion_callback; + ic_values->string_conversion = ic->core.string_conversion; + ic_values->reset_state = ic->core.reset_state; + ic_values->hotkey = ic->core.hotkey; + ic_values->hotkey_state = ic->core.hotkey_state; + ic_values->preedit_attr = ic->core.preedit_attr; + ic_values->status_attr = ic->core.status_attr; +} + +void +_XimSetCurrentICValues( + Xic ic, + XimDefICValues *ic_values) +{ + ic->core.input_style = ic_values->input_style; + ic->core.client_window = ic_values->client_window; + if (ic_values->focus_window) + ic->core.focus_window = ic_values->focus_window; + ic->core.filter_events = ic_values->filter_events; + ic->core.geometry_callback = ic_values->geometry_callback; + ic->core.res_name = ic_values->res_name; + ic->core.res_class = ic_values->res_class; + ic->core.destroy_callback = ic_values->destroy_callback; + ic->core.string_conversion_callback + = ic_values->string_conversion_callback; + ic->core.string_conversion = ic_values->string_conversion; + ic->core.reset_state = ic_values->reset_state; + ic->core.hotkey = ic_values->hotkey; + ic->core.hotkey_state = ic_values->hotkey_state; + ic->core.preedit_attr = ic_values->preedit_attr; + ic->core.status_attr = ic_values->status_attr; +} + +static void +_XimInitialIMOffsetInfo(void) +{ + unsigned int n = XIMNumber(im_attr_info); + register int i; + + for(i = 0; i < n; i++) { + im_attr_info[i].quark = XrmStringToQuark(GET_NAME(im_attr_info[i])); + } +} + +static void +_XimInitialICOffsetInfo(void) +{ + unsigned int n; + register int i; + + n = XIMNumber(ic_attr_info); + for(i = 0; i < n; i++) { + ic_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_attr_info[i])); + } + + n = XIMNumber(ic_pre_attr_info); + for(i = 0; i < n; i++) { + ic_pre_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_pre_attr_info[i])); + } + + n = XIMNumber(ic_sts_attr_info); + for(i = 0; i < n; i++) { + ic_sts_attr_info[i].quark = XrmStringToQuark(GET_NAME(ic_sts_attr_info[i])); + } +} + +static void +_XimInitialIMMode(void) +{ + unsigned int n = XIMNumber(im_mode); + register int i; + + for(i = 0; i < n; i++) { + im_mode_quark[i] = XrmStringToQuark(GET_NAME(im_mode[i])); + } +} + +static void +_XimInitialICMode(void) +{ + unsigned int n = XIMNumber(ic_mode); + register int i; + + for(i = 0; i < n; i++) { + ic_mode_quark[i] = XrmStringToQuark(GET_NAME(ic_mode[i])); + } +} + +void +_XimInitialResourceInfo(void) +{ + static Bool init_flag = False; + + if(init_flag == True) { + return; + } + _XimInitialIMOffsetInfo(); + _XimInitialICOffsetInfo(); + _XimInitialIMMode(); + _XimInitialICMode(); + init_flag = True; +} diff --git a/nx-X11/lib/modules/im/ximcp/imRmAttr.c b/nx-X11/lib/modules/im/ximcp/imRmAttr.c new file mode 100644 index 000000000..9d4e46258 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imRmAttr.c @@ -0,0 +1,1514 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + + +static XIMResourceList +_XimGetNestedListSeparator( + XIMResourceList res_list, /* LISTofIMATTR or IMATTR */ + unsigned int res_num) +{ + return _XimGetResourceListRec(res_list, res_num, XNSeparatorofNestedList); +} + +static Bool +_XimCheckInnerIMAttributes( + Xim im, + XIMArg *arg, + unsigned long mode) +{ + XIMResourceList res; + int check; + + if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, + im->private.proto.im_num_inner_resources, arg->name))) + return False; + + check = _XimCheckIMMode(res, mode); + if(check == XIM_CHECK_INVALID) + return True; + else if(check == XIM_CHECK_ERROR) + return False; + + return True; +} + +char * +_XimMakeIMAttrIDList( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + CARD16 *buf, + INT16 *len, + unsigned long mode) +{ + register XIMArg *p; + XIMResourceList res; + int check; + + *len = 0; + if (!arg) + return (char *)NULL; + + for (p = arg; p->name; p++) { + if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { + if (_XimCheckInnerIMAttributes(im, p, mode)) + continue; + return p->name; + } + + check = _XimCheckIMMode(res, mode); + if (check == XIM_CHECK_INVALID) + continue; + else if (check == XIM_CHECK_ERROR) + return p->name; + + *buf = res->id; + *len += sizeof(CARD16); + buf++; + } + return (char *)NULL; +} + +static Bool +_XimCheckInnerICAttributes( + Xic ic, + XIMArg *arg, + unsigned long mode) +{ + XIMResourceList res; + int check; + + if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, + ic->private.proto.ic_num_inner_resources, arg->name))) + return False; + + check = _XimCheckICMode(res, mode); + if(check == XIM_CHECK_INVALID) + return True; + else if(check == XIM_CHECK_ERROR) + return False; + + return True; +} + +char * +_XimMakeICAttrIDList( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + CARD16 *buf, + INT16 *len, + unsigned long mode) +{ + register XIMArg *p; + XIMResourceList res; + int check; + XrmQuark pre_quark; + XrmQuark sts_quark; + char *name; + INT16 new_len; + + *len = 0; + if (!arg) + return (char *)NULL; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + + for (p = arg; p && p->name; p++) { + if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { + if (_XimCheckInnerICAttributes(ic, p, mode)) + continue; + *len = -1; + return p->name; + } + + check = _XimCheckICMode(res, mode); + if(check == XIM_CHECK_INVALID) + continue; + else if(check == XIM_CHECK_ERROR) { + *len = -1; + return p->name; + } + + *buf = res->id; + *len += sizeof(CARD16); + buf++; + if (res->resource_size == XimType_NEST) { + if (res->xrm_name == pre_quark) { + if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, + (XIMArg *)p->value, buf, &new_len, + (mode | XIM_PREEDIT_ATTR)))) { + if (new_len < 0) *len = -1; + else *len += new_len; + return name; + } + *len += new_len; + buf = (CARD16 *)((char *)buf + new_len); + } else if (res->xrm_name == sts_quark) { + if ((name = _XimMakeICAttrIDList(ic, res_list, res_num, + (XIMArg *)p->value, buf, &new_len, + (mode | XIM_STATUS_ATTR)))) { + if (new_len < 0) *len = -1; + else *len += new_len; + return name; + } + *len += new_len; + buf = (CARD16 *)((char *)buf + new_len); + } + + if (!(res = _XimGetNestedListSeparator(res_list, res_num))) { + p++; + if (p) { + *len = -1; + return p->name; + } + else { + return (char *)NULL; + } + } + *buf = res->id; + *len += sizeof(CARD16); + buf++; + } + } + return (char *)NULL; +} + +static Bool +_XimAttributeToValue( + Xic ic, + XIMResourceList res, + CARD16 *data, + INT16 data_len, + XPointer value, + BITMASK32 mode) +{ + switch (res->resource_size) { + case XimType_SeparatorOfNestedList: + case XimType_NEST: + break; + + case XimType_CARD8: + case XimType_CARD16: + case XimType_CARD32: + case XimType_Window: + case XimType_XIMHotKeyState: + _XCopyToArg((XPointer)data, (XPointer *)&value, data_len); + break; + + case XimType_STRING8: + { + char *str; + + if (!(value)) + return False; + + if (!(str = Xmalloc(data_len + 1))) + return False; + + (void)memcpy(str, (char *)data, data_len); + str[data_len] = '\0'; + + *((char **)value) = str; + break; + } + + case XimType_XIMStyles: + { + INT16 num = data[0]; + register CARD32 *style_list = (CARD32 *)&data[2]; + XIMStyle *style; + XIMStyles *rep; + register int i; + char *p; + int alloc_len; + + if (!(value)) + return False; + + alloc_len = sizeof(XIMStyles) + sizeof(XIMStyle) * num; + if (!(p = Xmalloc(alloc_len))) + return False; + + rep = (XIMStyles *)p; + style = (XIMStyle *)(p + sizeof(XIMStyles)); + + for (i = 0; i < num; i++) + style[i] = (XIMStyle)style_list[i]; + + rep->count_styles = (unsigned short)num; + rep->supported_styles = style; + *((XIMStyles **)value) = rep; + break; + } + + case XimType_XRectangle: + { + XRectangle *rep; + + if (!(value)) + return False; + + if (!(rep = Xmalloc(sizeof(XRectangle)))) + return False; + + rep->x = data[0]; + rep->y = data[1]; + rep->width = data[2]; + rep->height = data[3]; + *((XRectangle **)value) = rep; + break; + } + + case XimType_XPoint: + { + XPoint *rep; + + if (!(value)) + return False; + + if (!(rep = Xmalloc(sizeof(XPoint)))) + return False; + + rep->x = data[0]; + rep->y = data[1]; + *((XPoint **)value) = rep; + break; + } + + case XimType_XFontSet: + { + INT16 len = data[0]; + char *base_name; + XFontSet rep = (XFontSet)NULL; + char **missing_list = NULL; + int missing_count; + char *def_string; + + if (!(value)) + return False; + if (!ic) + return False; + + if (!(base_name = Xmalloc(len + 1))) + return False; + + (void)strncpy(base_name, (char *)&data[1], (int)len); + base_name[len] = '\0'; + + if (mode & XIM_PREEDIT_ATTR) { + if (!strcmp(base_name, ic->private.proto.preedit_font)) { + rep = ic->core.preedit_attr.fontset; + } else if (!ic->private.proto.preedit_font_length) { + rep = XCreateFontSet(ic->core.im->core.display, + base_name, &missing_list, + &missing_count, &def_string); + } + } else if (mode & XIM_STATUS_ATTR) { + if (!strcmp(base_name, ic->private.proto.status_font)) { + rep = ic->core.status_attr.fontset; + } else if (!ic->private.proto.status_font_length) { + rep = XCreateFontSet(ic->core.im->core.display, + base_name, &missing_list, + &missing_count, &def_string); + } + } + + Xfree(base_name); + Xfree(missing_list); + *((XFontSet *)value) = rep; + break; + } + + case XimType_XIMHotKeyTriggers: + { + INT32 num = *((CARD32 *)data); + register CARD32 *key_list = (CARD32 *)&data[2]; + XIMHotKeyTrigger *key; + XIMHotKeyTriggers *rep; + register int i; + char *p; + int alloc_len; + + if (!(value)) + return False; + + alloc_len = sizeof(XIMHotKeyTriggers) + + sizeof(XIMHotKeyTrigger) * num; + if (!(p = Xmalloc(alloc_len))) + return False; + + rep = (XIMHotKeyTriggers *)p; + key = (XIMHotKeyTrigger *)(p + sizeof(XIMHotKeyTriggers)); + + for (i = 0; i < num; i++, key_list += 3) { + key[i].keysym = (KeySym)key_list[0]; /* keysym */ + key[i].modifier = (int)key_list[1]; /* modifier */ + key[i].modifier_mask = (int)key_list[2]; /* modifier_mask */ + } + + rep->num_hot_key = (int)num; + rep->key = key; + *((XIMHotKeyTriggers **)value) = rep; + break; + } + + case XimType_XIMStringConversion: + { + break; + } + + default: + return False; + } + return True; +} + +static Bool +_XimDecodeInnerIMATTRIBUTE( + Xim im, + XIMArg *arg) +{ + XIMResourceList res; + XimDefIMValues im_values; + + if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, + im->private.proto.im_num_inner_resources, arg->name))) + return False; + + _XimGetCurrentIMValues(im, &im_values); + return _XimDecodeLocalIMAttr(res, (XPointer)&im_values, arg->value); +} + +char * +_XimDecodeIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + CARD16 *data, + INT16 data_len, + XIMArg *arg, + BITMASK32 mode) +{ + register XIMArg *p; + XIMResourceList res; + int check; + INT16 len; + CARD16 *buf; + INT16 total; + INT16 min_len = sizeof(CARD16) /* sizeof attributeID */ + + sizeof(INT16); /* sizeof length */ + + for (p = arg; p->name; p++) { + if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { + if (_XimDecodeInnerIMATTRIBUTE(im, p)) + continue; + return p->name; + } + + check = _XimCheckIMMode(res, mode); + if(check == XIM_CHECK_INVALID) + continue; + else if(check == XIM_CHECK_ERROR) + return p->name; + + total = data_len; + buf = data; + while (total >= min_len) { + if (res->id == buf[0]) + break; + + len = buf[1]; + len += XIM_PAD(len) + min_len; + buf = (CARD16 *)((char *)buf + len); + total -= len; + } + if (total < min_len) + return p->name; + + if (!(_XimAttributeToValue((Xic) im->private.local.current_ic, + res, &buf[2], buf[1], p->value, mode))) + return p->name; + } + return (char *)NULL; +} + +static Bool +_XimDecodeInnerICATTRIBUTE( + Xic ic, + XIMArg *arg, + unsigned long mode) +{ + XIMResourceList res; + XimDefICValues ic_values; + + if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, + ic->private.proto.ic_num_inner_resources, arg->name))) + return False; + + _XimGetCurrentICValues(ic, &ic_values); + if (!_XimDecodeLocalICAttr(res, (XPointer)&ic_values, arg->value, mode)) + return False; + _XimSetCurrentICValues(ic, &ic_values); + return True; +} + +char * +_XimDecodeICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + CARD16 *data, + INT16 data_len, + XIMArg *arg, + BITMASK32 mode) +{ + register XIMArg *p; + XIMResourceList res; + int check; + INT16 len; + CARD16 *buf; + INT16 total; + char *name; + INT16 min_len = sizeof(CARD16) /* sizeof attributeID */ + + sizeof(INT16); /* sizeof length */ + XrmQuark pre_quark; + XrmQuark sts_quark; + + if (!arg) + return (char *)NULL; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + + for (p = arg; p->name; p++) { + if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { + if (_XimDecodeInnerICATTRIBUTE(ic, p, mode)) + continue; + return p->name; + } + + check = _XimCheckICMode(res, mode); + if (check == XIM_CHECK_INVALID) + continue; + else if (check == XIM_CHECK_ERROR) + return p->name; + + total = data_len; + buf = data; + while (total >= min_len) { + if (res->id == buf[0]) + break; + + len = buf[1]; + len += XIM_PAD(len) + min_len; + buf = (CARD16 *)((char *)buf + len); + total -= len; + } + if (total < min_len) + return p->name; + + if (res->resource_size == XimType_NEST) { + if (res->xrm_name == pre_quark) { + if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, + &buf[2], buf[1], (XIMArg *)p->value, + (mode | XIM_PREEDIT_ATTR)))) + return name; + } else if (res->xrm_name == sts_quark) { + if ((name = _XimDecodeICATTRIBUTE(ic, res_list, res_num, + &buf[2], buf[1], (XIMArg *)p->value, + (mode | XIM_STATUS_ATTR)))) + return name; + } + } else { + if (!(_XimAttributeToValue(ic, res, &buf[2], buf[1], + p->value, mode))) + return p->name; + } + } + return (char *)NULL; +} + +static Bool +_XimValueToAttribute( + XIMResourceList res, + XPointer buf, + int buf_size, + XPointer value, + int *len, + unsigned long mode, + XPointer param) +{ + int ret_len; + + switch (res->resource_size) { + case XimType_SeparatorOfNestedList: + case XimType_NEST: + *len = 0; + break; + + case XimType_CARD8: + ret_len = sizeof(CARD8); + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + *((CARD8 *)buf) = (CARD8)(long)value; + *len = ret_len; + break; + + case XimType_CARD16: + ret_len = sizeof(CARD16); + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + *((CARD16 *)buf) = (CARD16)(long)value; + *len = ret_len; + break; + + case XimType_CARD32: + case XimType_Window: + case XimType_XIMHotKeyState: + ret_len = sizeof(CARD32); + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + *((CARD32 *)buf) = (CARD32)(long)value; + *len = ret_len; + break; + + case XimType_STRING8: + if (!value) { + *len = 0; + return False; + } + + ret_len = strlen((char *)value); + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + (void)memcpy((char *)buf, (char *)value, ret_len); + *len = ret_len; + break; + + case XimType_XRectangle: + { + XRectangle *rect = (XRectangle *)value; + CARD16 *buf_s = (CARD16 *)buf; + + if (!rect) { + *len = 0; + return False; + } + + ret_len = sizeof(INT16) /* sizeof X */ + + sizeof(INT16) /* sizeof Y */ + + sizeof(CARD16) /* sizeof width */ + + sizeof(CARD16); /* sizeof height */ + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + buf_s[0] = (CARD16)rect->x; /* X */ + buf_s[1] = (CARD16)rect->y; /* Y */ + buf_s[2] = (CARD16)rect->width; /* width */ + buf_s[3] = (CARD16)rect->height; /* heght */ + *len = ret_len; + break; + } + + case XimType_XPoint: + { + XPoint *point = (XPoint *)value; + CARD16 *buf_s = (CARD16 *)buf; + + if (!point) { + *len = 0; + return False; + } + + ret_len = sizeof(INT16) /* sizeof X */ + + sizeof(INT16); /* sizeof Y */ + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + buf_s[0] = (CARD16)point->x; /* X */ + buf_s[1] = (CARD16)point->y; /* Y */ + *len = ret_len; + break; + } + + case XimType_XFontSet: + { + XFontSet font = (XFontSet)value; + Xic ic = (Xic)param; + char *base_name = NULL; + int length = 0; + CARD16 *buf_s = (CARD16 *)buf; + + if (!font) { + *len = 0; + return False; + } + + if (mode & XIM_PREEDIT_ATTR) { + base_name = ic->private.proto.preedit_font; + length = ic->private.proto.preedit_font_length; + } else if (mode & XIM_STATUS_ATTR) { + base_name = ic->private.proto.status_font; + length = ic->private.proto.status_font_length; + } + + if (!base_name) { + *len = 0; + return False; + } + + ret_len = sizeof(CARD16) /* sizeof length of Base name */ + + length; /* sizeof Base font name list */ + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + buf_s[0] = (INT16)length; /* length of Base font name */ + (void)memcpy((char *)&buf_s[1], base_name, length); + /* Base font name list */ + *len = ret_len; + break; + } + + case XimType_XIMHotKeyTriggers: + { + XIMHotKeyTriggers *hotkey = (XIMHotKeyTriggers *)value; + INT32 num; + CARD32 *buf_l = (CARD32 *)buf; + register CARD32 *key = (CARD32 *)&buf_l[1]; + register int i; + + if (!hotkey) { + *len = 0; + return False; + } + num = (INT32)hotkey->num_hot_key; + + ret_len = sizeof(INT32) /* sizeof number of key list */ + + (sizeof(CARD32) /* sizeof keysyn */ + + sizeof(CARD32) /* sizeof modifier */ + + sizeof(CARD32)) /* sizeof modifier_mask */ + * num; /* number of key list */ + if (buf_size < ret_len + XIM_PAD(ret_len)) { + *len = -1; + return False; + } + + buf_l[0] = num; /* number of key list */ + for (i = 0; i < num; i++, key += 3) { + key[0] = (CARD32)(hotkey->key[i].keysym); + /* keysym */ + key[1] = (CARD32)(hotkey->key[i].modifier); + /* modifier */ + key[2] = (CARD32)(hotkey->key[i].modifier_mask); + /* modifier_mask */ + } + *len = ret_len; + break; + } + + case XimType_XIMStringConversion: + { + *len = 0; + break; + } + + default: + return False; + } + return True; +} + +static Bool +_XimSetInnerIMAttributes( + Xim im, + XPointer top, + XIMArg *arg, + unsigned long mode) +{ + XIMResourceList res; + int check; + + if (!(res = _XimGetResourceListRec(im->private.proto.im_inner_resources, + im->private.proto.im_num_inner_resources, arg->name))) + return False; + + check = _XimCheckIMMode(res, mode); + if(check == XIM_CHECK_INVALID) + return True; + else if(check == XIM_CHECK_ERROR) + return False; + + return _XimEncodeLocalIMAttr(res, top, arg->value); +} + +char * +_XimEncodeIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + XIMArg **arg_ret, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode) +{ + register XIMArg *p; + XIMResourceList res; + int check; + CARD16 *buf_s; + int len; + int min_len = sizeof(CARD16) /* sizeof attribute ID */ + + sizeof(INT16); /* sizeof value length */ + + *ret_len = 0; + for (p = arg; p->name; p++) { + if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { + if (_XimSetInnerIMAttributes(im, top, p, mode)) + continue; + return p->name; + } + + check = _XimCheckIMMode(res, mode); + if (check == XIM_CHECK_INVALID) + continue; + else if (check == XIM_CHECK_ERROR) + return p->name; + + if (!(_XimEncodeLocalIMAttr(res, top, p->value))) + return p->name; + + buf_s = (CARD16 *)buf; + if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], (size - min_len), + p->value, &len, mode, (XPointer)NULL))) + return p->name; + + if (len == 0) { + continue; + } else if (len < 0) { + *arg_ret = p; + return (char *)NULL; + } + + buf_s[0] = res->id; /* attribute ID */ + buf_s[1] = len; /* value length */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += min_len; + + buf += len; + *ret_len += len; + size -= len; + } + *arg_ret = (XIMArg *)NULL; + return (char *)NULL; +} + +#ifdef XIM_CONNECTABLE +Bool +_XimEncodeSavedIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + int *idx, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode) +{ + register int i; + int num = im->private.proto.num_saved_imvalues; + XrmQuark *quark_list = im->private.proto.saved_imvalues; + XIMResourceList res; + XPointer value; + CARD16 *buf_s; + int len; + int min_len = sizeof(CARD16) /* sizeof attribute ID */ + + sizeof(INT16); /* sizeof value length */ + + if (!im->private.proto.saved_imvalues) { + *idx = -1; + *ret_len = 0; + return True; + } + + *ret_len = 0; + for (i = *idx; i < num; i++) { + if (!(res = _XimGetResourceListRecByQuark(res_list, + res_num, quark_list[i]))) + continue; + + if (!_XimDecodeLocalIMAttr(res, top, value)) + return False; + + buf_s = (CARD16 *)buf; + if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], + (size - min_len), value, &len, mode, (XPointer)NULL))) + return False; + + if (len == 0) { + continue; + } else if (len < 0) { + *idx = i; + return True; + } + + buf_s[0] = res->id; /* attribute ID */ + buf_s[1] = len; /* value length */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += min_len; + + buf += len; + *ret_len += len; + size -= len; + } + *idx = -1; + return True; +} +#endif /* XIM_CONNECTABLE */ + +static Bool +_XimEncodeTopValue( + Xic ic, + XIMResourceList res, + XIMArg *p) +{ + if (res->xrm_name == XrmStringToQuark(XNClientWindow)) { + ic->core.client_window = (Window)p->value; + if (ic->core.focus_window == (Window)0) + ic->core.focus_window = ic->core.client_window; + _XimRegisterFilter(ic); + + } else if (res->xrm_name == XrmStringToQuark(XNFocusWindow)) { + if (ic->core.client_window) { + _XimUnregisterFilter(ic); + ic->core.focus_window = (Window)p->value; + _XimRegisterFilter(ic); + } else /* client_window not yet */ + ic->core.focus_window = (Window)p->value; + } + return True; +} + +static Bool +_XimEncodePreeditValue( + Xic ic, + XIMResourceList res, + XIMArg *p) +{ + if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { + XStandardColormap *colormap_ret; + int count; + + if (!(XGetRGBColormaps(ic->core.im->core.display, + ic->core.focus_window, &colormap_ret, + &count, (Atom)p->value))) + return False; + + XFree(colormap_ret); + } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { + int list_ret; + XFontStruct **struct_list; + char **name_list; + char *tmp; + int len; + register int i; + + if (!p->value) + return False; + + Xfree(ic->private.proto.preedit_font); + + list_ret = XFontsOfFontSet((XFontSet)p->value, + &struct_list, &name_list); + for (i = 0, len = 0; i < list_ret; i++) { + len += (strlen(name_list[i]) + sizeof(char)); + } + if (!(tmp = Xmalloc(len + 1))) { + ic->private.proto.preedit_font = NULL; + return False; + } + + tmp[0] = '\0'; + for (i = 0; i < list_ret; i++) { + strcat(tmp, name_list[i]); + strcat(tmp, ","); + } + tmp[len - 1] = 0; + ic->private.proto.preedit_font = tmp; + ic->private.proto.preedit_font_length = len - 1; + } + return True; +} + +static Bool +_XimEncodeStatusValue( + Xic ic, + XIMResourceList res, + XIMArg *p) +{ + if (res->xrm_name == XrmStringToQuark(XNStdColormap)) { + XStandardColormap *colormap_ret = NULL; + int count; + + if (!(XGetRGBColormaps(ic->core.im->core.display, + ic->core.focus_window, &colormap_ret, + &count, (Atom)p->value))) + return False; + + XFree(colormap_ret); + } else if (res->xrm_name == XrmStringToQuark(XNFontSet)) { + int list_ret; + XFontStruct **struct_list; + char **name_list; + char *tmp; + int len; + register int i; + + if (!p->value) + return False; + + Xfree(ic->private.proto.status_font); + + list_ret = XFontsOfFontSet((XFontSet)p->value, + &struct_list, &name_list); + for (i = 0, len = 0; i < list_ret; i++) { + len += (strlen(name_list[i]) + sizeof(char)); + } + if (!(tmp = Xmalloc(len+1))) { + ic->private.proto.status_font = NULL; + return False; + } + + tmp[0] = '\0'; + for(i = 0; i < list_ret; i++) { + strcat(tmp, name_list[i]); + strcat(tmp, ","); + } + tmp[len - 1] = 0; + ic->private.proto.status_font = tmp; + ic->private.proto.status_font_length = len - 1; + } + return True; +} + +static Bool +_XimSetInnerICAttributes( + Xic ic, + XPointer top, + XIMArg *arg, + unsigned long mode) +{ + XIMResourceList res; + int check; + + if (!(res = _XimGetResourceListRec(ic->private.proto.ic_inner_resources, + ic->private.proto.ic_num_inner_resources, arg->name))) + return False; + + check = _XimCheckICMode(res, mode); + if(check == XIM_CHECK_INVALID) + return True; + else if(check == XIM_CHECK_ERROR) + return False; + + return _XimEncodeLocalICAttr(ic, res, top, arg, mode); +} + +char * +_XimEncodeICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + XIMArg **arg_ret, + char *buf, + int size, + int *ret_len, + XPointer top, + BITMASK32 *flag, + unsigned long mode) +{ + register XIMArg *p; + XIMResourceList res; + int check; + CARD16 *buf_s; + int len; + int min_len = sizeof(CARD16) /* sizeof attribute ID */ + + sizeof(INT16); /* sizeof value length */ + XrmQuark pre_quark; + XrmQuark sts_quark; + char *name; + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + + *ret_len = 0; + for (p = arg; p && p->name; p++) { + buf_s = (CARD16 *)buf; + if (!(res = _XimGetResourceListRec(res_list, res_num, p->name))) { + if (_XimSetInnerICAttributes(ic, top, p, mode)) + continue; + return p->name; + } + + check = _XimCheckICMode(res, mode); + if (check == XIM_CHECK_INVALID) + continue; + else if (check == XIM_CHECK_ERROR) + return p->name; + + if (mode & XIM_PREEDIT_ATTR) { + if (!(_XimEncodePreeditValue(ic, res, p))) + return p->name; + } else if (mode & XIM_STATUS_ATTR) { + if (!(_XimEncodeStatusValue(ic, res, p))) + return p->name; + } else { + if (!(_XimEncodeTopValue(ic, res, p))) + return p->name; + } + + if (res->resource_size == XimType_NEST) { + XimDefICValues *ic_attr = (XimDefICValues *)top; + + if (res->xrm_name == pre_quark) { + XIMArg *arg_rt; + if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, + (XIMArg *)p->value, &arg_rt, + (char *)&buf_s[2], (size - min_len), + &len, (XPointer)&ic_attr->preedit_attr, flag, + (mode | XIM_PREEDIT_ATTR)))) { + return name; + } + + } else if (res->xrm_name == sts_quark) { + XIMArg *arg_rt; + if ((name = _XimEncodeICATTRIBUTE(ic, res_list, res_num, + (XIMArg *)p->value, &arg_rt, + (char *)&buf_s[2], (size - min_len), + &len, (XPointer)&ic_attr->status_attr, flag, + (mode | XIM_STATUS_ATTR)))) { + return name; + } + } + } else { +#ifdef EXT_MOVE + if (flag) + *flag |= _XimExtenArgCheck(p); +#endif + if (!(_XimEncodeLocalICAttr(ic, res, top, p, mode))) + return p->name; + + if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], + (size - min_len), p->value, + &len, mode, (XPointer)ic))) + return p->name; + } + + if (len == 0) { + continue; + } else if (len < 0) { + *arg_ret = p; + return (char *)NULL; + } + + buf_s[0] = res->id; /* attribute ID */ + buf_s[1] = len; /* value length */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += min_len; + + buf += len; + *ret_len += len; + size -= len; + } + *arg_ret = (XIMArg *)NULL; + return (char *)NULL; +} + +#ifdef XIM_CONNECTABLE +static Bool +_XimEncodeSavedPreeditValue( + Xic ic, + XIMResourceList res, + XPointer value) +{ + int list_ret; + XFontStruct **struct_list; + char **name_list; + char *tmp; + int len; + register int i; + + if (res->xrm_name == XrmStringToQuark(XNFontSet)) { + if (!value) + return False; + + if (ic->private.proto.preedit_font) + Xfree(ic->private.proto.preedit_font); + + list_ret = XFontsOfFontSet((XFontSet)value, + &struct_list, &name_list); + for(i = 0, len = 0; i < list_ret; i++) { + len += (strlen(name_list[i]) + sizeof(char)); + } + if(!(tmp = Xmalloc(len + 1))) { + ic->private.proto.preedit_font = NULL; + return False; + } + + tmp[0] = '\0'; + for(i = 0; i < list_ret; i++) { + strcat(tmp, name_list[i]); + strcat(tmp, ","); + } + tmp[len - 1] = 0; + ic->private.proto.preedit_font = tmp; + ic->private.proto.preedit_font_length = len - 1; + } + return True; +} + +static Bool +_XimEncodeSavedStatusValue( + Xic ic, + XIMResourceList res, + XPointer value) +{ + int list_ret; + XFontStruct **struct_list; + char **name_list; + char *tmp; + int len; + register int i; + + if (res->xrm_name == XrmStringToQuark(XNFontSet)) { + if (!value) + return False; + + Xfree(ic->private.proto.status_font); + + list_ret = XFontsOfFontSet((XFontSet)value, + &struct_list, &name_list); + for(i = 0, len = 0; i < list_ret; i++) { + len += (strlen(name_list[i]) + sizeof(char)); + } + if(!(tmp = Xmalloc(len + 1))) { + ic->private.proto.status_font = NULL; + return False; + } + + tmp[0] = '\0'; + for(i = 0; i < list_ret; i++) { + strcat(tmp, name_list[i]); + strcat(tmp, ","); + } + tmp[len - 1] = 0; + ic->private.proto.status_font = tmp; + ic->private.proto.status_font_length = len - 1; + } + return True; +} + +Bool +_XimEncodeSavedICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + int *idx, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode) +{ + int i; + int num = ic->private.proto.num_saved_icvalues; + XrmQuark *quark_list = ic->private.proto.saved_icvalues; + XIMResourceList res; + XPointer value; + CARD16 *buf_s; + int len; + int min_len = sizeof(CARD16) /* sizeof attribute ID */ + + sizeof(INT16); /* sizeof value length */ + XrmQuark pre_quark; + XrmQuark sts_quark; + XrmQuark separator; + + if (!ic->private.proto.saved_icvalues) { + *idx = -1; + *ret_len = 0; + return True; + } + + pre_quark = XrmStringToQuark(XNPreeditAttributes); + sts_quark = XrmStringToQuark(XNStatusAttributes); + separator = XrmStringToQuark(XNSeparatorofNestedList); + + *ret_len = 0; + for (i = *idx; i < num; i++) { + if (quark_list[i] == separator) { + *idx = i; + return True; + } + + if (!(res = _XimGetResourceListRecByQuark(res_list, + res_num, quark_list[i]))) + continue; + + if (!_XimDecodeLocalICAttr(res, top,(XPointer)&value, mode)) + return False; + + if (mode & XIM_PREEDIT_ATTR) { + if (!(_XimEncodeSavedPreeditValue(ic, res, value))) { + return False; + } + } else if (mode & XIM_STATUS_ATTR) { + if (!(_XimEncodeSavedStatusValue(ic, res, value))) { + return False; + } + } + + buf_s = (CARD16 *)buf; + if (res->resource_size == XimType_NEST) { + XimDefICValues *ic_attr = (XimDefICValues *)top; + + i++; + if (res->xrm_name == pre_quark) { + if (!_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, + &i, (char *)&buf_s[2], (size - min_len), + &len, (XPointer)&ic_attr->preedit_attr, + (mode | XIM_PREEDIT_ATTR))) { + return False; + } + + } else if (res->xrm_name == sts_quark) { + if (!_XimEncodeSavedICATTRIBUTE(ic, res_list, res_num, + &i, (char *)&buf_s[2], (size - min_len), + &len, (XPointer)&ic_attr->status_attr, + (mode | XIM_STATUS_ATTR))) { + return False; + } + } + } else { + if (!(_XimValueToAttribute(res, (XPointer)&buf_s[2], + (size - min_len), value, + &len, mode, (XPointer)ic))) { + return False; + } + } + + if (len == 0) { + continue; + } else if (len < 0) { + if (quark_list[i] == separator) + i++; + *idx = i; + return True; + } + + buf_s[0] = res->id; /* attribute ID */ + buf_s[1] = len; /* value length */ + XIM_SET_PAD(&buf_s[2], len); /* pad */ + len += min_len; + + buf += len; + *ret_len += len; + size -= len; + } + *idx = -1; + return True; +} +#endif /* XIM_CONNECTABLE */ + +static unsigned int +_XimCountNumberOfAttr( + INT16 total, + CARD16 *attr, + int *names_len) +{ + unsigned int n; + INT16 len; + INT16 min_len = sizeof(CARD16) /* sizeof attribute ID */ + + sizeof(CARD16) /* sizeof type of value */ + + sizeof(INT16); /* sizeof length of attribute */ + + n = 0; + *names_len = 0; + while (total > min_len) { + len = attr[2]; + *names_len += (len + 1); + len += (min_len + XIM_PAD(len + 2)); + total -= len; + attr = (CARD16 *)((char *)attr + len); + n++; + } + return n; +} + +Bool +_XimGetAttributeID( + Xim im, + CARD16 *buf) +{ + unsigned int n; + XIMResourceList res; + char *names; + int names_len; + XPointer tmp; + XIMValuesList *values_list; + char **values; + int values_len; + register int i; + INT16 len; + INT16 min_len = sizeof(CARD16) /* sizeof attribute ID */ + + sizeof(CARD16) /* sizeof type of value */ + + sizeof(INT16); /* sizeof length of attr */ + /* + * IM attribute ID + */ + + if (!(n = _XimCountNumberOfAttr(buf[0], &buf[1], &names_len))) + return False; + + if (!(res = Xcalloc(n, sizeof(XIMResource)))) + return False; + + values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; + if (!(tmp = Xcalloc(1, values_len))) { + Xfree(res); + return False; + } + + values_list = (XIMValuesList *)tmp; + values = (char **)((char *)tmp + sizeof(XIMValuesList)); + names = (char *)((char *)values + (sizeof(char **) * n)); + + values_list->count_values = n; + values_list->supported_values = values; + + buf++; + for (i = 0; i < n; i++) { + len = buf[2]; + (void)memcpy(names, (char *)&buf[3], len); + values[i] = names; + names[len] = '\0'; + res[i].resource_name = names; + res[i].resource_size = buf[1]; + res[i].id = buf[0]; + names += (len + 1); + len += (min_len + XIM_PAD(len + 2)); + buf = (CARD16 *)((char *)buf + len); + } + _XIMCompileResourceList(res, n); + + Xfree(im->core.im_resources); + Xfree(im->core.im_values_list); + + im->core.im_resources = res; + im->core.im_num_resources = n; + im->core.im_values_list = values_list; + + /* + * IC attribute ID + */ + + if (!(n = _XimCountNumberOfAttr(buf[0], &buf[2], &names_len))) + return False; + + if (!(res = Xcalloc(n, sizeof(XIMResource)))) + return False; + + values_len = sizeof(XIMValuesList) + (sizeof(char **) * n) + names_len; + if (!(tmp = Xcalloc(1, values_len))) { + Xfree(res); + return False; + } + + values_list = (XIMValuesList *)tmp; + values = (char **)((char *)tmp + sizeof(XIMValuesList)); + names = (char *)((char *)values + (sizeof(char **) * n)); + + values_list->count_values = n; + values_list->supported_values = values; + + buf += 2; + for (i = 0; i < n; i++) { + len = buf[2]; + (void)memcpy(names, (char *)&buf[3], len); + values[i] = names; + names[len] = '\0'; + res[i].resource_name = names; + res[i].resource_size = buf[1]; + res[i].id = buf[0]; + names += (len + 1); + len += (min_len + XIM_PAD(len + 2)); + buf = (CARD16 *)((char *)buf + len); + } + _XIMCompileResourceList(res, n); + + + Xfree(im->core.ic_resources); + Xfree(im->core.ic_values_list); + + im->core.ic_resources = res; + im->core.ic_num_resources = n; + im->core.ic_values_list = values_list; + + return True; +} diff --git a/nx-X11/lib/modules/im/ximcp/imThaiFlt.c b/nx-X11/lib/modules/im/ximcp/imThaiFlt.c new file mode 100644 index 000000000..401bd9a08 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imThaiFlt.c @@ -0,0 +1,1421 @@ +/*********************************************************** + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +/* +**++ +** FACILITY: +** +** Xlib +** +** ABSTRACT: +** +** Thai specific functions. +** Handles character classifications, composibility checking, +** Input sequence check and other Thai specific requirements +** according to WTT specification and DEC extensions. +** +** MODIFICATION HISTORY: +** +**/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "XimThai.h" +#include "XlcPubI.h" + + +#define SPACE 32 + +/* character classification table */ +#define TACTIS_CHARS 256 +static +char const tactis_chtype[TACTIS_CHARS] = { + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 0 - 7 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 8 - 15 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 16 - 23 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 24 - 31 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 32 - 39 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 40 - 47 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 48 - 55 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 56 - 63 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 64 - 71 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 72 - 79 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 80 - 87 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 88 - 95 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 96 - 103 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 104 - 111 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 112 - 119 */ + NON, NON, NON, NON, NON, NON, NON, CTRL, /* 120 - 127 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 128 - 135 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 136 - 143 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 144 - 151 */ + CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, CTRL, /* 152 - 159 */ + NON, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 160 - 167 */ + CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 168 - 175 */ + CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 176 - 183 */ + CONS, CONS, CONS, CONS, CONS, CONS, CONS, CONS, /* 184 - 191 */ + CONS, CONS, CONS, CONS, FV3, CONS, FV3, CONS, /* 192 - 199 */ + CONS, CONS, CONS, CONS, CONS, CONS, CONS, NON, /* 200 - 207 */ + FV1, AV2, FV1, FV1, AV1, AV3, AV2, AV3, /* 208 - 215 */ + BV1, BV2, BD, NON, NON, NON, NON, NON, /* 216 - 223 */ + LV, LV, LV, LV, LV, FV2, NON, AD2, /* 224 - 231 */ + TONE, TONE, TONE, TONE, AD1, AD1, AD3, NON, /* 232 - 239 */ + NON, NON, NON, NON, NON, NON, NON, NON, /* 240 - 247 */ + NON, NON, NON, NON, NON, NON, NON, CTRL /* 248 - 255 */ +}; + +/* Composibility checking tables */ +#define NC 0 /* NOT COMPOSIBLE - following char displays in next cell */ +#define CP 1 /* COMPOSIBLE - following char is displayed in the same cell + as leading char, also implies ACCEPT */ +#define XC 3 /* Non-display */ +#define AC 4 /* ACCEPT - display the following char in the next cell */ +#define RJ 5 /* REJECT - discard that following char, ignore it */ + +#define CH_CLASSES 17 /* 17 classes of chars */ + +static +char const write_rules_lookup[CH_CLASSES][CH_CLASSES] = { + /* Table 0: writing/outputing rules */ + /* row: leading char, column: following char */ +/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ + {XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*CTRL*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*NON*/ + ,{XC, NC, NC, NC, NC, NC, NC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*LV*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV1*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV2*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*FV3*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, CP, NC, NC, NC, NC, NC}/*BV1*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, NC, NC, NC, NC, NC}/*BV2*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*BD*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*TONE*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD1*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD2*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC, NC}/*AD3*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, CP, NC, NC, NC, NC, NC}/*AV1*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, NC, NC, NC, NC, NC}/*AV2*/ + ,{XC, NC, NC, NC, NC, NC, NC, NC, NC, NC, CP, NC, CP, NC, NC, NC, NC}/*AV3*/ +}; + +static +char const wtt_isc1_lookup[CH_CLASSES][CH_CLASSES] = { + /* Table 1: WTT default input sequence check rules */ + /* row: leading char, column: following char */ +/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ + {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ + ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ +}; + +static +char const wtt_isc2_lookup[CH_CLASSES][CH_CLASSES] = { + /* Table 2: WTT strict input sequence check rules */ + /* row: leading char, column: following char */ +/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ + {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ + ,{XC, AC, AC, AC, AC, RJ, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ + ,{XC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ + ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ + ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ + ,{XC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV3*/ + ,{XC, AC, AC, AC, AC, RJ, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*TONE*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD1*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD2*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ + ,{XC, AC, AC, AC, RJ, RJ, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ +}; + +static +char const thaicat_isc_lookup[CH_CLASSES][CH_CLASSES] = { + /* Table 3: Thaicat input sequence check rules */ + /* row: leading char, column: following char */ +/* CTRL NON CONS LV FV1 FV2 FV3 BV1 BV2 BD TONE AD1 AD2 AD3 AV1 AV2 AV3 */ + {XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*CTRL*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*NON*/ + ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, CP, CP, CP, CP, CP, CP, CP, CP}/*CONS*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*LV*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*FV2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ} /*FV3*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*BV1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*BV2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*BD*/ + ,{XC, AC, AC, AC, AC, AC, AC, CP, CP, RJ, RJ, RJ, RJ, RJ, CP, CP, CP}/*TONE*/ + ,{XC, AC, AC, AC, AC, AC, AC, CP, RJ, RJ, RJ, RJ, RJ, RJ, CP, RJ, RJ}/*AD1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, CP}/*AD2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ, RJ}/*AD3*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, CP, RJ, RJ, RJ, RJ, RJ}/*AV1*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, RJ, RJ, RJ, RJ, RJ}/*AV2*/ + ,{XC, AC, AC, AC, AC, AC, AC, RJ, RJ, RJ, CP, RJ, CP, RJ, RJ, RJ, RJ}/*AV3*/ +}; + + +/* returns classification of a char */ +static int +THAI_chtype (unsigned char ch) +{ + return tactis_chtype[ch]; +} + +#ifdef UNUSED +/* returns the display level */ +static int +THAI_chlevel (unsigned char ch) +{ + int chlevel; + + switch (tactis_chtype[ch]) + { + case CTRL: + chlevel = NON; + break; + case BV1: + case BV2: + case BD: + chlevel = BELOW; + break; + case TONE: + case AD1: + case AD2: + chlevel = TOP; + break; + case AV1: + case AV2: + case AV3: + case AD3: + chlevel = ABOVE; + break; + case NON: + case CONS: + case LV: + case FV1: + case FV2: + case FV3: + default: /* if tactis_chtype is invalid */ + chlevel = BASE; + break; + } + return chlevel; +} + + +/* return True if char is non-spacing */ +static Bool +THAI_isdead (unsigned char ch) +{ + return ((tactis_chtype[ch] == CTRL) || (tactis_chtype[ch] == BV1) || + (tactis_chtype[ch] == BV2) || (tactis_chtype[ch] == BD) || + (tactis_chtype[ch] == TONE) || (tactis_chtype[ch] == AD1) || + (tactis_chtype[ch] == AD2) || (tactis_chtype[ch] == AD3) || + (tactis_chtype[ch] == AV1) || (tactis_chtype[ch] == AV2) || + (tactis_chtype[ch] == AV3)); +} + + +/* return True if char is consonant */ +static Bool +THAI_iscons (unsigned char ch) +{ + return (tactis_chtype[ch] == CONS); +} + + +/* return True if char is vowel */ +static Bool +THAI_isvowel (unsigned char ch) +{ + return ((tactis_chtype[ch] == LV) || (tactis_chtype[ch] == FV1) || + (tactis_chtype[ch] == FV2) || (tactis_chtype[ch] == FV3) || + (tactis_chtype[ch] == BV1) || (tactis_chtype[ch] == BV2) || + (tactis_chtype[ch] == AV1) || (tactis_chtype[ch] == AV2) || + (tactis_chtype[ch] == AV3)); +} + + +/* return True if char is tonemark */ +static Bool +THAI_istone (unsigned char ch) +{ + return (tactis_chtype[ch] == TONE); +} +#endif + +static Bool +THAI_iscomposible ( + unsigned char follow_ch, + unsigned char lead_ch) +{/* "Can follow_ch be put in the same display cell as lead_ch?" */ + + return (write_rules_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] + == CP); +} + +static Bool +THAI_isaccepted ( + unsigned char follow_ch, + unsigned char lead_ch, + unsigned char mode) +{ + Bool iskeyvalid; /* means "Can follow_ch be keyed in after lead_ch?" */ + + switch (mode) + { + case WTT_ISC1: + iskeyvalid = + (wtt_isc1_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); + break; + case WTT_ISC2: + iskeyvalid = + (wtt_isc2_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); + break; + case THAICAT_ISC: + iskeyvalid = + (thaicat_isc_lookup[THAI_chtype(lead_ch)][THAI_chtype(follow_ch)] != RJ); + break; + default: + iskeyvalid = True; + break; + } + + return iskeyvalid; +} + +#ifdef UNUSED +static void +THAI_apply_write_rules( + unsigned char *instr, + unsigned char *outstr, + unsigned char insert_ch, + int *num_insert_ch) +{ +/* +Input parameters: + instr - input string + insert_ch specify what char to be added when invalid composition is found +Output parameters: + outstr - output string after input string has been applied the rules + num_insert_ch - number of insert_ch added to outstr. +*/ + unsigned char *lead_ch = NULL, *follow_ch = NULL, *out_ch = NULL; + + *num_insert_ch = 0; + lead_ch = follow_ch = instr; + out_ch = outstr; + if ((*lead_ch == '\0') || !(THAI_find_chtype(instr,DEAD))) + { /* Empty string or can't find any non-spacing char*/ + strcpy((char *)outstr, (char *)instr); + } else { /* String of length >= 1, keep looking */ + follow_ch++; + if (THAI_isdead(*lead_ch)) { /* is first char non-spacing? */ + *out_ch++ = SPACE; + (*num_insert_ch)++; + } + *out_ch++ = *lead_ch; + while (*follow_ch != '\0') /* more char in string to check */ + { + if (THAI_isdead(*follow_ch) && + !THAI_iscomposible(*follow_ch,*lead_ch)) + { + *out_ch++ = SPACE; + (*num_insert_ch)++; + } + *out_ch++ = *follow_ch; + lead_ch = follow_ch; + follow_ch++; + } + *out_ch = '\0'; + } +} + +static int +THAI_find_chtype ( + unsigned char *instr, + int chtype) +{ +/* +Input parameters: + instr - input string + chtype - type of character to look for +Output parameters: + function returns first position of character with matched chtype + function returns -1 if it does not find. +*/ + int i = 0, position = -1; + + switch (chtype) + { + case DEAD: + for (i = 0; *instr != '\0' && THAI_isdead(*instr); i++, instr++) + ; + if (*instr != '\0') position = i; + break; + default: + break; + } + return position; +} + + +static int +THAI_apply_scm( + unsigned char *instr, + unsigned char *outstr, + unsigned char spec_ch, + int num_sp, + unsigned char insert_ch) +{ + unsigned char *scan, *outch; + int i, dead_count, found_count; + Bool isconsecutive; + + scan = instr; + outch = outstr; + dead_count = found_count = 0; + isconsecutive = False; + while (*scan != '\0') { + if (THAI_isdead(*scan)) + dead_count++; /* count number of non-spacing char */ + if (*scan == spec_ch) + if (!isconsecutive) + found_count++; /* count number consecutive spec char found */ + *outch++ = *scan++; + if (found_count == num_sp) { + for (i = 0; i < dead_count; i++) + *outch++ = insert_ch; + dead_count = found_count = 0; + } + } + /* what to return? */ + return 0; /* probably not right but better than returning garbage */ +} + + +/* The following functions are copied from XKeyBind.c */ + +static void ComputeMaskFromKeytrans(); +static int IsCancelComposeKey(KeySym *symbol, XKeyEvent *event); +static void SetLed(Display *dpy, int num, int state); +static CARD8 FindKeyCode(); + + +/* The following functions are specific to this module */ + +static int XThaiTranslateKey(); +static int XThaiTranslateKeySym(); + + +static KeySym HexIMNormalKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event); +static KeySym HexIMFirstComposeKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event); +static KeySym HexIMSecondComposeKey( + XicThaiPart *thai_part, + KeySym symbol + XKeyEvent *event); +static KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2); +static void InitIscMode(Xic ic); +static Bool ThaiComposeConvert( + Display *dpy, + KeySym insym, + KeySym *outsym, KeySym *lower, KeySym *upper); +#endif + +/* + * Definitions + */ + +#define BellVolume 0 + +#define ucs2tis(wc) \ + (unsigned char) ( \ + (0<=(wc)&&(wc)<=0x7F) ? \ + (wc) : \ + ((0x0E01<=(wc)&&(wc)<=0x0E5F) ? ((wc)-0x0E00+0xA0) : 0)) +/* "c" is an unsigned char */ +#define tis2ucs(c) \ + ( \ + ((c)<=0x7F) ? \ + (wchar_t)(c) : \ + ((0x0A1<=(c)) ? ((wchar_t)(c)-0xA0+0x0E00) : 0)) + +/* + * Macros to save and recall last input character in XIC + */ +#define IC_SavePreviousChar(ic,ch) \ + ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = (char) (ch)) +#define IC_ClearPreviousChar(ic) \ + ((ic)->private.local.base.mb[(ic)->private.local.base.tree[(ic)->private.local.context].mb] = 0) +#define IC_GetPreviousChar(ic) \ + (IC_RealGetPreviousChar(ic,1)) +#define IC_GetContextChar(ic) \ + (IC_RealGetPreviousChar(ic,2)) +#define IC_DeletePreviousChar(ic) \ + (IC_RealDeletePreviousChar(ic)) + +static unsigned char +IC_RealGetPreviousChar(Xic ic, unsigned short pos) +{ + XICCallback* cb = &ic->core.string_conversion_callback; + DefTreeBase *b = &ic->private.local.base; + + if (cb && cb->callback) { + XIMStringConversionCallbackStruct screc; + unsigned char c; + + /* Use a safe value of position = 0 and stretch the range to desired + * place, as XIM protocol is unclear here whether it could be negative + */ + screc.position = 0; + screc.direction = XIMBackwardChar; + screc.operation = XIMStringConversionRetrieval; + screc.factor = pos; + screc.text = 0; + + (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); + if (!screc.text) + return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; + if ((screc.text->feedback && + *screc.text->feedback == XIMStringConversionLeftEdge) || + screc.text->length < 1) + { + c = 0; + } else { + Xim im; + XlcConv conv; + int from_left; + int to_left; + char *from_buf; + char *to_buf; + + im = (Xim) XIMOfIC((XIC)ic); + if (screc.text->encoding_is_wchar) { + conv = _XlcOpenConverter(im->core.lcd, XlcNWideChar, + im->core.lcd, XlcNCharSet); + from_buf = (char *) screc.text->string.wcs; + from_left = screc.text->length * sizeof(wchar_t); + } else { + conv = _XlcOpenConverter(im->core.lcd, XlcNMultiByte, + im->core.lcd, XlcNCharSet); + from_buf = screc.text->string.mbs; + from_left = screc.text->length; + } + to_buf = (char *)&c; + to_left = 1; + + _XlcResetConverter(conv); + if (_XlcConvert(conv, (XPointer *)&from_buf, &from_left, + (XPointer *)&to_buf, &to_left, NULL, 0) < 0) + { + c = (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; + } + _XlcCloseConverter(conv); + + XFree(screc.text->string.mbs); + } + XFree(screc.text); + return c; + } else { + return (unsigned char) b->mb[b->tree[(ic)->private.local.context].mb]; + } +} + +static unsigned char +IC_RealDeletePreviousChar(Xic ic) +{ + XICCallback* cb = &ic->core.string_conversion_callback; + + if (cb && cb->callback) { + XIMStringConversionCallbackStruct screc; + unsigned char c; + + screc.position = 0; + screc.direction = XIMBackwardChar; + screc.operation = XIMStringConversionSubstitution; + screc.factor = 1; + screc.text = 0; + + (cb->callback)((XIC)ic, cb->client_data, (XPointer)&screc); + if (!screc.text) { return 0; } + if ((screc.text->feedback && + *screc.text->feedback == XIMStringConversionLeftEdge) || + screc.text->length < 1) + { + c = 0; + } else { + if (screc.text->encoding_is_wchar) { + c = ucs2tis(screc.text->string.wcs[0]); + XFree(screc.text->string.wcs); + } else { + c = screc.text->string.mbs[0]; + XFree(screc.text->string.mbs); + } + } + XFree(screc.text); + return c; + } else { + return 0; + } +} +/* + * Input sequence check mode in XIC + */ +#define IC_IscMode(ic) ((ic)->private.local.thai.input_mode) + +/* + * Max. size of string handled by the two String Lookup functions. + */ +#define STR_LKUP_BUF_SIZE 256 + +/* + * Size of buffer to contain previous locale name. + */ +#define SAV_LOCALE_NAME_SIZE 256 + +/* + * Size of buffer to contain the IM modifier. + */ +#define MAXTHAIIMMODLEN 20 + +#define AllMods (ShiftMask|LockMask|ControlMask| \ + Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) + + +#define IsISOControlKey(ks) ((ks) >= XK_2 && (ks) <= XK_8) + +#define IsValidControlKey(ks) (((((ks)>=XK_A && (ks)<=XK_asciitilde) || \ + (ks)==XK_space || (ks)==XK_Delete) && \ + ((ks)!=0))) + +#define COMPOSE_LED 2 + +#ifdef UNUSED +typedef KeySym (*StateProc)( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event); + + +/* + * macros to classify XKeyEvent state field + */ + +#define IsShift(state) (((state) & ShiftMask) != 0) +#define IsLock(state) (((state) & LockMask) != 0) +#define IsControl(state) (((state) & ControlMask) != 0) +#define IsMod1(state) (((state) & Mod1Mask) != 0) +#define IsMod2(state) (((state) & Mod2Mask) != 0) +#define IsMod3(state) (((state) & Mod3Mask) != 0) +#define IsMod4(state) (((state) & Mod4Mask) != 0) +#define IsMod5(state) (((state) & Mod5Mask) != 0) + +/* + * key starts Thai compose sequence (Hex input method) if : + */ + +#define IsComposeKey(ks, event) \ + (( ks==XK_Alt_L && \ + IsControl((event)->state) && \ + !IsShift((event)->state)) \ + ? True : False) + + +/* + * State handler to implement the Thai hex input method. + */ + +static int const nstate_handlers = 3; +static StateProc state_handler[] = { + HexIMNormalKey, + HexIMFirstComposeKey, + HexIMSecondComposeKey +}; + + +/* + * Table for 'Thai Compose' character input. + * The current implementation uses latin-1 keysyms. + */ +struct _XMapThaiKey { + KeySym from; + KeySym to; +}; + +static struct _XMapThaiKey const ThaiComposeTable[] = { + { /* 0xa4 */ XK_currency, /* 0xa5 */ XK_yen }, + { /* 0xa2 */ XK_cent, /* 0xa3 */ XK_sterling }, + { /* 0xe6 */ XK_ae, /* 0xef */ XK_idiaeresis }, + { /* 0xd3 */ XK_Oacute, /* 0xee */ XK_icircumflex }, + { /* 0xb9 */ XK_onesuperior, /* 0xfa */ XK_uacute }, + { /* 0xd2 */ XK_Ograve, /* 0xe5 */ XK_aring }, + { /* 0xbc */ XK_onequarter, /* 0xfb */ XK_ucircumflex }, + { XK_VoidSymbol, XK_VoidSymbol } +}; + +struct _XKeytrans { + struct _XKeytrans *next;/* next on list */ + char *string; /* string to return when the time comes */ + int len; /* length of string (since NULL is legit)*/ + KeySym key; /* keysym rebound */ + unsigned int state; /* modifier state */ + KeySym *modifiers; /* modifier keysyms you want */ + int mlen; /* length of modifier list */ +}; + + +/* Convert keysym to 'Thai Compose' keysym */ +/* The current implementation use latin-1 keysyms */ +static Bool +ThaiComposeConvert( + Display *dpy, + KeySym insym, + KeySym *outsym, KeySym *lower, KeySym *upper) +{ + struct _XMapThaiKey const *table_entry = ThaiComposeTable; + + while (table_entry->from != XK_VoidSymbol) { + if (table_entry->from == insym) { + *outsym = table_entry->to; + *lower = *outsym; + *upper = *outsym; + return True; + } + table_entry++; + } + return False; +} + +static int +XThaiTranslateKey( + register Display *dpy, + KeyCode keycode, + register unsigned int modifiers, + unsigned int *modifiers_return, + KeySym *keysym_return, + KeySym *lsym_return, + KeySym *usym_return) +{ + int per; + register KeySym *syms; + KeySym sym = 0, lsym = 0, usym = 0; + + if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) + return 0; + *modifiers_return = (ShiftMask|LockMask) | dpy->mode_switch; + if (((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) + { + *keysym_return = NoSymbol; + return 1; + } + per = dpy->keysyms_per_keycode; + syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; + while ((per > 2) && (syms[per - 1] == NoSymbol)) + per--; + if ((per > 2) && (modifiers & dpy->mode_switch)) { + syms += 2; + per -= 2; + } + if (!(modifiers & ShiftMask) && + (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) { + if ((per == 1) || (syms[1] == NoSymbol)) + XConvertCase(syms[0], keysym_return, &usym); + else { + XConvertCase(syms[0], &lsym, &usym); + *keysym_return = syms[0]; + } + } else if (!(modifiers & LockMask) || + (dpy->lock_meaning != XK_Caps_Lock)) { + if ((per == 1) || ((usym = syms[1]) == NoSymbol)) + XConvertCase(syms[0], &lsym, &usym); + *keysym_return = usym; + } else { + if ((per == 1) || ((sym = syms[1]) == NoSymbol)) + sym = syms[0]; + XConvertCase(sym, &lsym, &usym); + if (!(modifiers & ShiftMask) && (sym != syms[0]) && + ((sym != usym) || (lsym == usym))) + XConvertCase(syms[0], &lsym, &usym); + *keysym_return = usym; + } + /* + * ThaiCat keyboard support : + * When the Shift and Thai keys are hold for some keys a 'Thai Compose' + * character code is generated which is different from column 3 and + * 4 of the keymap. + * Since we don't know whether ThaiCat keyboard or WTT keyboard is + * in use, the same mapping is done for all Thai input. + * We just arbitary choose to use column 3 keysyms as the indices of + * this mapping. + * When the control key is also hold, this mapping has no effect. + */ + if ((modifiers & Mod1Mask) && + (modifiers & ShiftMask) && + !(modifiers & ControlMask)) { + if (ThaiComposeConvert(dpy, syms[0], &sym, &lsym, &usym)) + *keysym_return = sym; + } + + if (*keysym_return == XK_VoidSymbol) + *keysym_return = NoSymbol; + *lsym_return = lsym; + *usym_return = usym; + return 1; +} + +/* + * XThaiTranslateKeySym + * + * Translate KeySym to TACTIS code output. + * The current implementation uses ISO latin-1 keysym. + * Should be changed to TACTIS keysyms when they are defined by the + * standard. + */ +static int +XThaiTranslateKeySym( + Display *dpy, + register KeySym symbol, + register KeySym lsym, + register KeySym usym, + unsigned int modifiers, + unsigned char *buffer, + int nbytes) +{ + KeySym ckey = 0; + register struct _XKeytrans *p; + int length; + unsigned long hiBytes; + register unsigned char c; + + /* + * initialize length = 1 ; + */ + length = 1; + + if (!symbol) + return 0; + /* see if symbol rebound, if so, return that string. */ + for (p = dpy->key_bindings; p; p = p->next) { + if (((modifiers & AllMods) == p->state) && (symbol == p->key)) { + length = p->len; + if (length > nbytes) length = nbytes; + memcpy (buffer, p->string, length); + return length; + } + } + /* try to convert to TACTIS, handling control */ + hiBytes = symbol >> 8; + if (!(nbytes && + ((hiBytes == 0) || + ((hiBytes == 0xFF) && + (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) || + (symbol == XK_Return) || + (symbol == XK_Escape) || + (symbol == XK_KP_Space) || + (symbol == XK_KP_Tab) || + (symbol == XK_KP_Enter) || + ((symbol >= XK_KP_Multiply) && (symbol <= XK_KP_9)) || + (symbol == XK_KP_Equal) || + (symbol == XK_Scroll_Lock) || +#ifdef DXK_PRIVATE /* DEC private keysyms */ + (symbol == DXK_Remove) || +#endif + (symbol == NoSymbol) || + (symbol == XK_Delete)))))) + return 0; + + /* if X keysym, convert to ascii by grabbing low 7 bits */ + if (symbol == XK_KP_Space) + c = XK_space & 0x7F; /* patch encoding botch */ +/* not for Thai + else if (symbol == XK_hyphen) + c = XK_minus & 0xFF; */ /* map to equiv character */ + else if (hiBytes == 0xFF) + c = symbol & 0x7F; + else + c = symbol & 0xFF; + /* only apply Control key if it makes sense, else ignore it */ + if (modifiers & ControlMask) { + if (!(IsKeypadKey(lsym) || lsym==XK_Return || lsym==XK_Tab)) { + if (IsISOControlKey(lsym)) ckey = lsym; + else if (IsISOControlKey(usym)) ckey = usym; + else if (lsym == XK_question) ckey = lsym; + else if (usym == XK_question) ckey = usym; + else if (IsValidControlKey(lsym)) ckey = lsym; + else if (IsValidControlKey(usym)) ckey = usym; + else length = 0; + + if (length != 0) { + if (ckey == XK_2) c = '\000'; + else if (ckey >= XK_3 && ckey <= XK_7) + c = (char)(ckey-('3'-'\033')); + else if (ckey == XK_8) c = '\177'; + else if (ckey == XK_Delete) c = '\030'; + else if (ckey == XK_question) c = '\037'; + else if (ckey == XK_quoteleft) c = '\036'; /* KLee 1/24/91 */ + else c = (char)(ckey & 0x1f); + } + } + } + /* + * ThaiCat has a key that generates two TACTIS codes D1 & E9. + * It is represented by the latin-1 keysym XK_thorn (0xfe). + * If c is XK_thorn, this key is pressed and it is converted to + * 0xd1 0xe9. + */ + if (c == XK_thorn) { + buffer[0] = 0xd1; + buffer[1] = 0xe9; + buffer[2] = '\0'; + return 2; + } + else { + /* Normal case */ + buffer[0] = c; + buffer[1] = '\0'; + return 1; + } +} + +/* + * given a KeySym, returns the first keycode containing it, if any. + */ +static CARD8 +FindKeyCode( + register Display *dpy, + register KeySym code) +{ + + register KeySym *kmax = dpy->keysyms + + (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; + register KeySym *k = dpy->keysyms; + while (k < kmax) { + if (*k == code) + return (((k - dpy->keysyms) / dpy->keysyms_per_keycode) + + dpy->min_keycode); + k += 1; + } + return 0; +} + +/* + * given a list of modifiers, computes the mask necessary for later matching. + * This routine must lookup the key in the Keymap and then search to see + * what modifier it is bound to, if any. Sets the AnyModifier bit if it + * can't map some keysym to a modifier. + */ +static void +ComputeMaskFromKeytrans( + Display *dpy, + register struct _XKeytrans *p) +{ + register int i; + register CARD8 code; + register XModifierKeymap *m = dpy->modifiermap; + + p->state = AnyModifier; + for (i = 0; i < p->mlen; i++) { + /* if not found, then not on current keyboard */ + if ((code = FindKeyCode(dpy, p->modifiers[i])) == 0) + return; + /* code is now the keycode for the modifier you want */ + { + register int j = m->max_keypermod<<3; + + while ((--j >= 0) && (code != m->modifiermap[j])) + ; + if (j < 0) + return; + p->state |= (1<<(j/m->max_keypermod)); + } + } + p->state &= AllMods; +} + +/************************************************************************ + * + * + * Compose handling routines - compose handlers 0,1,2 + * + * + ************************************************************************/ + +#define NORMAL_KEY_STATE 0 +#define FIRST_COMPOSE_KEY_STATE 1 +#define SECOND_COMPOSE_KEY_STATE 2 + +static +KeySym HexIMNormalKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event) +{ + if (IsComposeKey (symbol, event)) /* start compose sequence */ + { + SetLed (event->display,COMPOSE_LED, LedModeOn); + thai_part->comp_state = FIRST_COMPOSE_KEY_STATE; + return NoSymbol; + } + return symbol; +} + + +static +KeySym HexIMFirstComposeKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event) +{ + if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ + if (IsCancelComposeKey (&symbol, event)) /* cancel sequence */ + { + SetLed (event->display,COMPOSE_LED, LedModeOff); + thai_part->comp_state = NORMAL_KEY_STATE; + return symbol; + } + if (IsComposeKey (symbol, event)) /* restart sequence ?? */ + { + return NoSymbol; /* no state change necessary */ + } + + thai_part->keysym = symbol; /* save key pressed */ + thai_part->comp_state = SECOND_COMPOSE_KEY_STATE; + return NoSymbol; +} + +static +KeySym HexIMSecondComposeKey( + XicThaiPart *thai_part, + KeySym symbol, + XKeyEvent *event) +{ + if (IsModifierKey (symbol)) return symbol; /* ignore shift etc. */ + if (IsComposeKey (symbol, event)) /* restart sequence ? */ + { + thai_part->comp_state =FIRST_COMPOSE_KEY_STATE; + return NoSymbol; + } + SetLed (event->display,COMPOSE_LED, LedModeOff); + if (IsCancelComposeKey (&symbol, event)) /* cancel sequence ? */ + { + thai_part->comp_state = NORMAL_KEY_STATE; + return symbol; + } + + if ((symbol = HexIMComposeSequence (thai_part->keysym, symbol)) + ==NoSymbol) + { /* invalid compose sequence */ + XBell(event->display, BellVolume); + } + thai_part->comp_state = NORMAL_KEY_STATE; /* reset to normal state */ + return symbol; +} + + +/* + * Interprets two keysyms entered as hex digits and return the Thai keysym + * correspond to the TACTIS code formed. + * The current implementation of this routine returns ISO Latin Keysyms. + */ + +static +KeySym HexIMComposeSequence(KeySym ks1, KeySym ks2) +{ +int hi_digit; +int lo_digit; +int tactis_code; + + if ((ks1 >= XK_0) && (ks1 <= XK_9)) + hi_digit = ks1 - XK_0; + else if ((ks1 >= XK_A) && (ks1 <= XK_F)) + hi_digit = ks1 - XK_A + 10; + else if ((ks1 >= XK_a) && (ks1 <= XK_f)) + hi_digit = ks1 - XK_a + 10; + else /* out of range */ + return NoSymbol; + + if ((ks2 >= XK_0) && (ks2 <= XK_9)) + lo_digit = ks2 - XK_0; + else if ((ks2 >= XK_A) && (ks2 <= XK_F)) + lo_digit = ks2 - XK_A + 10; + else if ((ks2 >= XK_a) && (ks2 <= XK_f)) + lo_digit = ks2 - XK_a + 10; + else /* out of range */ + return NoSymbol; + + tactis_code = hi_digit * 0x10 + lo_digit ; + + return (KeySym)tactis_code; + +} + +/* + * routine determines + * 1) whether key event should cancel a compose sequence + * 2) whether cancelling key event should be processed or ignored + */ + +static +int IsCancelComposeKey( + KeySym *symbol, + XKeyEvent *event) +{ + if (*symbol==XK_Delete && !IsControl(event->state) && + !IsMod1(event->state)) { + *symbol=NoSymbol; /* cancel compose sequence, and ignore key */ + return True; + } + if (IsComposeKey(*symbol, event)) return False; + return ( + IsControl (event->state) || + IsMod1(event->state) || + IsKeypadKey (*symbol) || + IsFunctionKey (*symbol) || + IsMiscFunctionKey (*symbol) || +#ifdef DXK_PRIVATE /* DEC private keysyms */ + *symbol == DXK_Remove || +#endif + IsPFKey (*symbol) || + IsCursorKey (*symbol) || + (*symbol >= XK_Tab && *symbol < XK_Multi_key) + ? True : False); /* cancel compose sequence and pass */ + /* cancelling key through */ +} + + +/* + * set specified keyboard LED on or off + */ + +static +void SetLed( + Display *dpy, + int num, + int state) +{ + XKeyboardControl led_control; + + led_control.led_mode = state; + led_control.led = num; + XChangeKeyboardControl (dpy, KBLed | KBLedMode, &led_control); +} +#endif + +/* + * Initialize ISC mode from im modifier + */ +static void InitIscMode(Xic ic) +{ + Xim im; + char *im_modifier_name; + + /* If already defined, just return */ + + if (IC_IscMode(ic)) return; + + /* Get IM modifier */ + + im = (Xim) XIMOfIC((XIC)ic); + im_modifier_name = im->core.im_name; + + /* Match with predefined value, default is Basic Check */ + + if (!strncmp(im_modifier_name,"BasicCheck",MAXTHAIIMMODLEN+1)) + IC_IscMode(ic) = WTT_ISC1; + else if (!strncmp(im_modifier_name,"Strict",MAXTHAIIMMODLEN+1)) + IC_IscMode(ic) = WTT_ISC2; + else if (!strncmp(im_modifier_name,"Thaicat",MAXTHAIIMMODLEN+1)) + IC_IscMode(ic) = THAICAT_ISC; + else if (!strncmp(im_modifier_name,"Passthrough",MAXTHAIIMMODLEN+1)) + IC_IscMode(ic) = NOISC; + else + IC_IscMode(ic) = WTT_ISC1; + + return; +} + +/* + * Helper functions for _XimThaiFilter() + */ +static Bool +ThaiFltAcceptInput(Xic ic, unsigned char new_char, KeySym symbol) +{ + DefTreeBase *b = &ic->private.local.base; + b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); + b->wc[b->tree[ic->private.local.composed].wc+1] = '\0'; + + if ((new_char <= 0x1f) || (new_char == 0x7f)) + b->tree[ic->private.local.composed].keysym = symbol; + else + b->tree[ic->private.local.composed].keysym = NoSymbol; + + return True; +} + +static Bool +ThaiFltReorderInput(Xic ic, unsigned char previous_char, unsigned char new_char) +{ + DefTreeBase *b = &ic->private.local.base; + if (!IC_DeletePreviousChar(ic)) return False; + b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); + b->wc[b->tree[ic->private.local.composed].wc+1] = tis2ucs(previous_char); + b->wc[b->tree[ic->private.local.composed].wc+2] = '\0'; + + b->tree[ic->private.local.composed].keysym = NoSymbol; + + return True; +} + +static Bool +ThaiFltReplaceInput(Xic ic, unsigned char new_char, KeySym symbol) +{ + DefTreeBase *b = &ic->private.local.base; + if (!IC_DeletePreviousChar(ic)) return False; + b->wc[b->tree[ic->private.local.composed].wc+0] = tis2ucs(new_char); + b->wc[b->tree[ic->private.local.composed].wc+1] = '\0'; + + if ((new_char <= 0x1f) || (new_char == 0x7f)) + b->tree[ic->private.local.composed].keysym = symbol; + else + b->tree[ic->private.local.composed].keysym = NoSymbol; + + return True; +} + +static unsigned +NumLockMask(Display *d) +{ + int i; + XModifierKeymap *map; + KeyCode numlock_keycode = XKeysymToKeycode (d, XK_Num_Lock); + if (numlock_keycode == NoSymbol) + return 0; + + map = XGetModifierMapping (d); + if (!map) + return 0; + + for (i = 0; i < 8; i++) { + if (map->modifiermap[map->max_keypermod * i] == numlock_keycode) { + XFreeModifiermap(map); + return 1 << i; + } + } + XFreeModifiermap(map); + return 0; +} + +/* + * Filter function for TACTIS + */ +Bool +_XimThaiFilter(Display *d, Window w, XEvent *ev, XPointer client_data) +{ + Xic ic = (Xic)client_data; + KeySym symbol; + int isc_mode; /* Thai Input Sequence Check mode */ + unsigned char previous_char; /* Last inputted Thai char */ + unsigned char new_char; +#ifdef UNUSED + unsigned int modifiers; + KeySym lsym,usym; + int state; + XicThaiPart *thai_part; + char buf[10]; +#endif + wchar_t wbuf[10]; + Bool isReject; + DefTreeBase *b = &ic->private.local.base; + + if ((ev->type != KeyPress) + || (ev->xkey.keycode == 0)) + return False; + + if (!IC_IscMode(ic)) InitIscMode(ic); + + XwcLookupString((XIC)ic, &ev->xkey, wbuf, sizeof(wbuf) / sizeof(wbuf[0]), + &symbol, NULL); + + if ((ev->xkey.state & (AllMods & ~(ShiftMask|LockMask|NumLockMask(d)))) || + ((symbol >> 8 == 0xFF) && + ((XK_BackSpace <= symbol && symbol <= XK_Clear) || + (symbol == XK_Return) || + (symbol == XK_Pause) || + (symbol == XK_Scroll_Lock) || + (symbol == XK_Sys_Req) || + (symbol == XK_Escape) || + (symbol == XK_Delete) || + IsCursorKey(symbol) || + IsKeypadKey(symbol) || + IsMiscFunctionKey(symbol) || + IsFunctionKey(symbol)))) + { + IC_ClearPreviousChar(ic); + return False; + } + if (((symbol >> 8 == 0xFF) && + IsModifierKey(symbol)) || +#ifdef XK_XKB_KEYS + ((symbol >> 8 == 0xFE) && + (XK_ISO_Lock <= symbol && symbol <= XK_ISO_Last_Group_Lock)) || +#endif + (symbol == NoSymbol)) + { + return False; + } +#ifdef UNUSED + if (! XThaiTranslateKey(ev->xkey.display, ev->xkey.keycode, ev->xkey.state, + &modifiers, &symbol, &lsym, &usym)) + return False; + + /* + * Hex input method processing + */ + + thai_part = &ic->private.local.thai; + state = thai_part->comp_state; + if (state >= 0 && state < nstate_handlers) /* call handler for state */ + { + symbol = (* state_handler[state])(thai_part, symbol, (XKeyEvent *)ev); + } + + /* + * Translate KeySym into mb. + */ + count = XThaiTranslateKeySym(ev->xkey.display, symbol, lsym, + usym, ev->xkey.state, buf, 10); + + if (!symbol && !count) + return True; + + /* Return symbol if cannot convert to character */ + if (!count) + return False; +#endif + + /* + * Thai Input sequence check + */ + isc_mode = IC_IscMode(ic); + if (!(previous_char = IC_GetPreviousChar(ic))) previous_char = ' '; + new_char = ucs2tis(wbuf[0]); + isReject = True; + if (THAI_isaccepted(new_char, previous_char, isc_mode)) { + ThaiFltAcceptInput(ic, new_char, symbol); + isReject = False; + } else { + unsigned char context_char; + + context_char = IC_GetContextChar(ic); + if (context_char) { + if (THAI_iscomposible(new_char, context_char)) { + if (THAI_iscomposible(previous_char, new_char)) { + isReject = !ThaiFltReorderInput(ic, previous_char, new_char); + } else if (THAI_iscomposible(previous_char, context_char)) { + isReject = !ThaiFltReplaceInput(ic, new_char, symbol); + } else if (THAI_chtype(previous_char) == FV1 + && THAI_chtype(new_char) == TONE) { + isReject = !ThaiFltReorderInput(ic, previous_char, new_char); + } + } else if (THAI_isaccepted(new_char, context_char, isc_mode)) { + isReject = !ThaiFltReplaceInput(ic, new_char, symbol); + } + } + } + if (isReject) { + /* reject character */ + XBell(ev->xkey.display, BellVolume); + return True; + } + + _Xlcwcstombs(ic->core.im->core.lcd, &b->mb[b->tree[ic->private.local.composed].mb], + &b->wc[b->tree[ic->private.local.composed].wc], 10); + + _Xlcmbstoutf8(ic->core.im->core.lcd, &b->utf8[b->tree[ic->private.local.composed].utf8], + &b->mb[b->tree[ic->private.local.composed].mb], 10); + + /* Remember the last character inputted + * (as fallback in case StringConversionCallback is not provided) + */ + IC_SavePreviousChar(ic, new_char); + + ev->xkey.keycode = 0; + XPutBackEvent(d, ev); + return True; +} diff --git a/nx-X11/lib/modules/im/ximcp/imThaiIc.c b/nx-X11/lib/modules/im/ximcp/imThaiIc.c new file mode 100644 index 000000000..b559145d0 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imThaiIc.c @@ -0,0 +1,229 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993 by Digital Equipment Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED and +Digital Equipment Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. FUJITSU LIMITED and Digital Equipment Corporation +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 +THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Modifier: Franky Ling Digital Equipment Corporation + frankyling@hgrd01.enet.dec.com + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" + +static void +_XimThaiUnSetFocus( + XIC xic) +{ + Xic ic = (Xic)xic; + ((Xim)ic->core.im)->private.local.current_ic = (XIC)NULL; + + if (ic->core.focus_window) + _XUnregisterFilter(ic->core.im->core.display, ic->core.focus_window, + _XimThaiFilter, (XPointer)ic); + return; +} + +static void +_XimThaiDestroyIC( + XIC xic) +{ + Xic ic = (Xic)xic; + DefTreeBase *b = &ic->private.local.base; + + if(((Xim)ic->core.im)->private.local.current_ic == (XIC)ic) { + _XimThaiUnSetFocus(xic); + } + + Xfree(ic->private.local.ic_resources); + ic->private.local.ic_resources = NULL; + + Xfree (b->tree); + b->tree = NULL; + + Xfree (b->mb); + b->mb = NULL; + + Xfree (b->wc); + b->wc = NULL; + + Xfree (b->utf8); + b->utf8 = NULL; + return; +} + +static void +_XimThaiSetFocus( + XIC xic) +{ + Xic ic = (Xic)xic; + XIC current_ic = ((Xim)ic->core.im)->private.local.current_ic; + + if (current_ic == (XIC)ic) + return; + + if (current_ic != (XIC)NULL) { + _XimThaiUnSetFocus(current_ic); + } + ((Xim)ic->core.im)->private.local.current_ic = (XIC)ic; + + if (ic->core.focus_window) + _XRegisterFilterByType(ic->core.im->core.display, ic->core.focus_window, + KeyPress, KeyPress, _XimThaiFilter, (XPointer)ic); + return; +} + +static void +_XimThaiReset( + XIC xic) +{ + Xic ic = (Xic)xic; + DefTreeBase *b = &ic->private.local.base; + ic->private.local.thai.comp_state = 0; + ic->private.local.thai.keysym = 0; + b->mb[b->tree[ic->private.local.composed].mb] = '\0'; + b->wc[b->tree[ic->private.local.composed].wc] = '\0'; + b->utf8[b->tree[ic->private.local.composed].utf8] = '\0'; +} + +static char * +_XimThaiMbReset( + XIC xic) +{ + _XimThaiReset(xic); + return (char *)NULL; +} + +static wchar_t * +_XimThaiWcReset( + XIC xic) +{ + _XimThaiReset(xic); + return (wchar_t *)NULL; +} + +static XICMethodsRec Thai_ic_methods = { + _XimThaiDestroyIC, /* destroy */ + _XimThaiSetFocus, /* set_focus */ + _XimThaiUnSetFocus, /* unset_focus */ + _XimLocalSetICValues, /* set_values */ + _XimLocalGetICValues, /* get_values */ + _XimThaiMbReset, /* mb_reset */ + _XimThaiWcReset, /* wc_reset */ + _XimThaiMbReset, /* utf8_reset */ + _XimLocalMbLookupString, /* mb_lookup_string */ + _XimLocalWcLookupString, /* wc_lookup_string */ + _XimLocalUtf8LookupString /* utf8_lookup_string */ +}; + +XIC +_XimThaiCreateIC( + XIM im, + XIMArg *values) +{ + Xic ic; + XimDefICValues ic_values; + XIMResourceList res; + unsigned int num; + int len; + DefTree *tree; + + if((ic = Xcalloc(1, sizeof(XicRec))) == (Xic)NULL) { + return ((XIC)NULL); + } + + ic->methods = &Thai_ic_methods; + ic->core.im = im; + ic->core.filter_events = KeyPressMask; + + if (! (ic->private.local.base.tree = tree = Xmalloc(sizeof(DefTree)*3)) ) + goto Set_Error; + if (! (ic->private.local.base.mb = Xmalloc(21)) ) + goto Set_Error; + if (! (ic->private.local.base.wc = Xmalloc(sizeof(wchar_t)*21)) ) + goto Set_Error; + if (! (ic->private.local.base.utf8 = Xmalloc(21)) ) + goto Set_Error; + ic->private.local.context = 1; + tree[1].mb = 1; + tree[1].wc = 1; + tree[1].utf8 = 1; + ic->private.local.composed = 2; + tree[2].mb = 11; + tree[2].wc = 11; + tree[2].utf8 = 11; + + ic->private.local.thai.comp_state = 0; + ic->private.local.thai.keysym = 0; + ic->private.local.thai.input_mode = 0; + + num = im->core.ic_num_resources; + len = sizeof(XIMResource) * num; + if((res = Xmalloc(len)) == (XIMResourceList)NULL) { + goto Set_Error; + } + (void)memcpy((char *)res, (char *)im->core.ic_resources, len); + ic->private.local.ic_resources = res; + ic->private.local.ic_num_resources = num; + + bzero((char *)&ic_values, sizeof(XimDefICValues)); + if(_XimCheckLocalInputStyle(ic, (XPointer)&ic_values, values, + im->core.styles, res, num) == False) { + goto Set_Error; + } + + _XimSetICMode(res, num, ic_values.input_style); + + if(_XimSetICValueData(ic, (XPointer)&ic_values, + ic->private.local.ic_resources, + ic->private.local.ic_num_resources, + values, XIM_CREATEIC, True)) { + goto Set_Error; + } + if(_XimSetICDefaults(ic, (XPointer)&ic_values, + XIM_SETICDEFAULTS, res, num) == False) { + goto Set_Error; + } + ic_values.filter_events = KeyPressMask; + _XimSetCurrentICValues(ic, &ic_values); + + return ((XIC)ic); + +Set_Error : + if (ic->private.local.ic_resources) { + Xfree(ic->private.local.ic_resources); + } + Xfree(ic); + return((XIC)NULL); +} diff --git a/nx-X11/lib/modules/im/ximcp/imThaiIm.c b/nx-X11/lib/modules/im/ximcp/imThaiIm.c new file mode 100644 index 000000000..c17723aca --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imThaiIm.c @@ -0,0 +1,235 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993 by Digital Equipment Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED and +Digital Equipment Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. FUJITSU LIMITED and Digital Equipment Corporation +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 +THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Modifier: Franky Ling Digital Equipment Corporation + frankyling@hgrd01.enet.dec.com + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "XlcPublic.h" +#include "XlcPubI.h" +#include "Ximint.h" + +static XIMMethodsRec Xim_im_thai_methods = { + _XimThaiCloseIM, /* close */ + _XimLocalSetIMValues, /* set_values */ + _XimLocalGetIMValues, /* get_values */ + _XimThaiCreateIC, /* create_ic */ + _XimLcctstombs, /* ctstombs */ + _XimLcctstowcs, /* ctstowcs */ + _XimLcctstoutf8 /* ctstoutf8 */ +}; + +#define THAI_LANGUAGE_NAME "th" + +Bool +_XimCheckIfThaiProcessing(Xim im) +{ + char *language; + + _XGetLCValues(im->core.lcd, XlcNLanguage, &language, NULL); + if(strcmp(language, THAI_LANGUAGE_NAME) == 0 && + (strcmp(im->core.im_name, "") == 0 || + strcmp(im->core.im_name, "BasicCheck") == 0 || + strcmp(im->core.im_name, "Strict") == 0 || + strcmp(im->core.im_name, "Thaicat") == 0 || + strcmp(im->core.im_name, "Passthrough") == 0)) + { + return(True); + } + return(False); +} + +Bool +_XimThaiOpenIM(Xim im) +{ + XLCd lcd = im->core.lcd; + XlcConv conv; + XimDefIMValues im_values; + XimLocalPrivateRec* private = &im->private.local; + + _XimInitialResourceInfo(); + if(_XimSetIMResourceList(&im->core.im_resources, + &im->core.im_num_resources) == False) { + goto Open_Error; + } + if(_XimSetICResourceList(&im->core.ic_resources, + &im->core.ic_num_resources) == False) { + goto Open_Error; + } + + _XimSetIMMode(im->core.im_resources, im->core.im_num_resources); + + _XimGetCurrentIMValues(im, &im_values); + if(_XimSetLocalIMDefaults(im, (XPointer)&im_values, + im->core.im_resources, im->core.im_num_resources) == False) { + goto Open_Error; + } + _XimSetCurrentIMValues(im, &im_values); + + if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte))) + goto Open_Error; + private->ctom_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar))) + goto Open_Error; + private->ctow_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCompoundText, lcd, XlcNUtf8String))) + goto Open_Error; + private->ctoutf8_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte))) + goto Open_Error; + private->cstomb_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNWideChar))) + goto Open_Error; + private->cstowc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String))) + goto Open_Error; + private->cstoutf8_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNChar))) + goto Open_Error; + private->ucstoc_conv = conv; + + if (!(conv = _XlcOpenConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String))) + goto Open_Error; + private->ucstoutf8_conv = conv; + + im->methods = &Xim_im_thai_methods; + private->current_ic = (XIC)NULL; + + return(True); + +Open_Error : + _XimThaiIMFree(im); + return(False); +} + +void +_XimThaiIMFree(Xim im) +{ + if(im->core.im_resources) { + Xfree(im->core.im_resources); + im->core.im_resources = NULL; + } + if(im->core.ic_resources) { + Xfree(im->core.ic_resources); + im->core.ic_resources = NULL; + } + if(im->core.im_values_list) { + Xfree(im->core.im_values_list); + im->core.im_values_list = NULL; + } + if(im->core.ic_values_list) { + Xfree(im->core.ic_values_list); + im->core.ic_values_list = NULL; + } + if(im->core.styles) { + Xfree(im->core.styles); + im->core.styles = NULL; + } + if(im->core.res_name) { + Xfree(im->core.res_name); + im->core.res_name = NULL; + } + if(im->core.res_class) { + Xfree(im->core.res_class); + im->core.res_class = NULL; + } + if(im->core.im_name) { + Xfree(im->core.im_name); + im->core.im_name = NULL; + } + if (im->private.local.ctom_conv) { + _XlcCloseConverter(im->private.local.ctom_conv); + im->private.local.ctom_conv = NULL; + } + if (im->private.local.ctow_conv) { + _XlcCloseConverter(im->private.local.ctow_conv); + im->private.local.ctow_conv = NULL; + } + if (im->private.local.ctoutf8_conv) { + _XlcCloseConverter(im->private.local.ctoutf8_conv); + im->private.local.ctoutf8_conv = NULL; + } + if (im->private.local.cstomb_conv) { + _XlcCloseConverter(im->private.local.cstomb_conv); + im->private.local.cstomb_conv = NULL; + } + if (im->private.local.cstowc_conv) { + _XlcCloseConverter(im->private.local.cstowc_conv); + im->private.local.cstowc_conv = NULL; + } + if (im->private.local.cstoutf8_conv) { + _XlcCloseConverter(im->private.local.cstoutf8_conv); + im->private.local.cstoutf8_conv = NULL; + } + if (im->private.local.ucstoc_conv) { + _XlcCloseConverter(im->private.local.ucstoc_conv); + im->private.local.ucstoc_conv = NULL; + } + if (im->private.local.ucstoutf8_conv) { + _XlcCloseConverter(im->private.local.ucstoutf8_conv); + im->private.local.ucstoutf8_conv = NULL; + } + return; +} + +Status +_XimThaiCloseIM(XIM xim) +{ + Xim im = (Xim)xim; + XIC ic; + XIC next; + + ic = im->core.ic_chain; + im->core.ic_chain = NULL; + while (ic) { + (*ic->methods->destroy) (ic); + next = ic->core.next; + Xfree (ic); + ic = next; + } + _XimThaiIMFree(im); + return(True); +} diff --git a/nx-X11/lib/modules/im/ximcp/imTrX.c b/nx-X11/lib/modules/im/ximcp/imTrX.c new file mode 100644 index 000000000..148b7fc90 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imTrX.c @@ -0,0 +1,518 @@ +/* + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "XimTrInt.h" +#include "XimTrX.h" + +static Bool +_XimXRegisterDispatcher( + Xim im, + Bool (*callback)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data) +{ + XIntrCallbackPtr rec; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + + if (!(rec = Xmalloc(sizeof(XIntrCallbackRec)))) + return False; + + rec->func = callback; + rec->call_data = call_data; + rec->next = spec->intr_cb; + spec->intr_cb = rec; + return True; +} + +static void +_XimXFreeIntrCallback( + Xim im) +{ + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + register XIntrCallbackPtr rec, next; + + for (rec = spec->intr_cb; rec;) { + next = rec->next; + Xfree(rec); + rec = next; + } + return; +} + +static Bool +_XimXCallDispatcher(Xim im, INT16 len, XPointer data) +{ + register XIntrCallbackRec *rec; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + + for (rec = spec->intr_cb; rec; rec = rec->next) { + if ((*rec->func)(im, len, data, rec->call_data)) + return True; + } + return False; +} + +static Bool +_XimXFilterWaitEvent( + Display *d, + Window w, + XEvent *ev, + XPointer arg) +{ + Xim im = (Xim)arg; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + Bool ret; + + spec->ev = (XPointer)ev; + ret = _XimFilterWaitEvent(im); + + /* + * If ev is a pointer to a stack variable, there could be + * a coredump later on if the pointer is dereferenced. + * Therefore, reset to NULL to force reinitialization in + * _XimXRead(). + * + * Keep in mind _XimXRead may be called again when the stack + * is very different. + */ + spec->ev = (XPointer)NULL; + + return ret; +} + +static Bool +_CheckConnect( + Display *display, + XEvent *event, + XPointer xim) +{ + Xim im = (Xim)xim; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + + if ((event->type == ClientMessage) + && (event->xclient.message_type == spec->imconnectid)) { + return True; + } + return False; +} + +static Bool +_XimXConnect(Xim im) +{ + XEvent event; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + CARD32 major_code; + CARD32 minor_code; + + if (!(spec->lib_connect_wid = XCreateSimpleWindow(im->core.display, + DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0))) { + return False; + } + + event.xclient.type = ClientMessage; + event.xclient.display = im->core.display; + event.xclient.window = im->private.proto.im_window; + event.xclient.message_type = spec->imconnectid; + event.xclient.format = 32; + event.xclient.data.l[0] = (CARD32)spec->lib_connect_wid; + event.xclient.data.l[1] = spec->major_code; + event.xclient.data.l[2] = spec->minor_code; + event.xclient.data.l[3] = 0; + event.xclient.data.l[4] = 0; + + if(event.xclient.data.l[1] == 1 || event.xclient.data.l[1] == 2) { + XWindowAttributes atr; + long event_mask; + + XGetWindowAttributes(im->core.display, spec->lib_connect_wid, &atr); + event_mask = atr.your_event_mask | PropertyChangeMask; + XSelectInput(im->core.display, spec->lib_connect_wid, event_mask); + _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, + PropertyNotify, PropertyNotify, + _XimXFilterWaitEvent, (XPointer)im); + } + + XSendEvent(im->core.display, im->private.proto.im_window, + False, NoEventMask, &event); + XFlush(im->core.display); + + for (;;) { + XIfEvent(im->core.display, &event, _CheckConnect, (XPointer)im); + if (event.xclient.type != ClientMessage) { + return False; + } + if (event.xclient.message_type == spec->imconnectid) + break; + } + + spec->ims_connect_wid = (Window)event.xclient.data.l[0]; + major_code = (CARD32)event.xclient.data.l[1]; + minor_code = (CARD32)event.xclient.data.l[2]; + + if (((major_code == 0) && (minor_code <= 2)) || + ((major_code == 1) && (minor_code == 0)) || + ((major_code == 2) && (minor_code <= 1))) { + spec->major_code = major_code; + spec->minor_code = minor_code; + } + if (((major_code == 0) && (minor_code == 2)) || + ((major_code == 2) && (minor_code == 1))) { + spec->BoundarySize = (CARD32)event.xclient.data.l[3]; + } + + /* ClientMessage Event Filter */ + _XRegisterFilterByType(im->core.display, spec->lib_connect_wid, + ClientMessage, ClientMessage, + _XimXFilterWaitEvent, (XPointer)im); + return True; +} + +static Bool +_XimXShutdown(Xim im) +{ + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + + if (!spec) + return True; + + /* ClientMessage Event Filter */ + _XUnregisterFilter(im->core.display, + ((XSpecRec *)im->private.proto.spec)->lib_connect_wid, + _XimXFilterWaitEvent, (XPointer)im); + XDestroyWindow(im->core.display, + ((XSpecRec *)im->private.proto.spec)->lib_connect_wid); + _XimXFreeIntrCallback(im); + Xfree(spec); + im->private.proto.spec = 0; + return True; +} + +static char * +_NewAtom( + char *atomName) +{ + static int sequence = 0; + + (void)sprintf(atomName, "_client%d", sequence); + sequence = ((sequence < 20) ? sequence + 1 : 0); + return atomName; +} + +static Bool +_XimXWrite(Xim im, INT16 len, XPointer data) +{ + Atom atom; + char atomName[16]; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + XEvent event; + CARD8 *p; + CARD32 major_code = spec->major_code; + CARD32 minor_code = spec->minor_code; + int BoundSize; + + bzero(&event,sizeof(XEvent)); + event.xclient.type = ClientMessage; + event.xclient.display = im->core.display; + event.xclient.window = spec->ims_connect_wid; + if(major_code == 1 && minor_code == 0) { + BoundSize = 0; + } else if((major_code == 0 && minor_code == 2) || + (major_code == 2 && minor_code == 1)) { + BoundSize = spec->BoundarySize; + } else if(major_code == 0 && minor_code == 1) { + BoundSize = len; + } else { + BoundSize = XIM_CM_DATA_SIZE; + } + if (len > BoundSize) { + event.xclient.message_type = spec->improtocolid; + atom = XInternAtom(im->core.display, _NewAtom(atomName), False); + XChangeProperty(im->core.display, spec->ims_connect_wid, + atom, XA_STRING, 8, PropModeAppend, + (unsigned char *)data, len); + if(major_code == 0) { + event.xclient.format = 32; + event.xclient.data.l[0] = (long)len; + event.xclient.data.l[1] = (long)atom; + XSendEvent(im->core.display, spec->ims_connect_wid, + False, NoEventMask, &event); + } + } else { + int length; + + event.xclient.format = 8; + for(length = 0 ; length < len ; length += XIM_CM_DATA_SIZE) { + p = (CARD8 *)&event.xclient.data.b[0]; + if((length + XIM_CM_DATA_SIZE) >= len) { + event.xclient.message_type = spec->improtocolid; + bzero(p, XIM_CM_DATA_SIZE); + memcpy((char *)p, (data + length), (len - length)); + } else { + event.xclient.message_type = spec->immoredataid; + memcpy((char *)p, (data + length), XIM_CM_DATA_SIZE); + } + XSendEvent(im->core.display, spec->ims_connect_wid, + False, NoEventMask, &event); + } + } + + return True; +} + +static Bool +_XimXGetReadData( + Xim im, + char *buf, + int buf_len, + int *ret_len, + XEvent *event) +{ + char *data; + int len; + + char tmp_buf[XIM_CM_DATA_SIZE]; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + unsigned long length; + Atom prop; + int return_code; + Atom type_ret; + int format_ret; + unsigned long nitems; + unsigned long bytes_after_ret; + unsigned char *prop_ret; + + if ((event->type == ClientMessage) && + !((event->xclient.message_type == spec->improtocolid) || + (event->xclient.message_type == spec->immoredataid))) { + /* This event has nothing to do with us, + * FIXME should not have gotten here then... + */ + return False; + } else if ((event->type == ClientMessage) && (event->xclient.format == 8)) { + data = event->xclient.data.b; + if (buf_len >= XIM_CM_DATA_SIZE) { + (void)memcpy(buf, data, XIM_CM_DATA_SIZE); + *ret_len = XIM_CM_DATA_SIZE; + } else { + (void)memcpy(buf, data, buf_len); + len = XIM_CM_DATA_SIZE - buf_len; + (void)memcpy(tmp_buf, &data[buf_len], len); + bzero(data, XIM_CM_DATA_SIZE); + (void)memcpy(data, tmp_buf, len); + XPutBackEvent(im->core.display, event); + *ret_len = buf_len; + } + } else if ((event->type == ClientMessage) + && (event->xclient.format == 32)) { + length = (unsigned long)event->xclient.data.l[0]; + prop = (Atom)event->xclient.data.l[1]; + return_code = XGetWindowProperty(im->core.display, + spec->lib_connect_wid, prop, 0L, + (long)((length + 3)/ 4), True, AnyPropertyType, + &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); + if (return_code != Success || format_ret == 0 || nitems == 0) { + if (return_code == Success) + XFree(prop_ret); + return False; + } + if (buf_len >= (int)nitems) { + (void)memcpy(buf, prop_ret, (int)nitems); + *ret_len = (int)nitems; + if (bytes_after_ret > 0) { + XFree(prop_ret); + if (XGetWindowProperty(im->core.display, + spec->lib_connect_wid, prop, 0L, + ((length + bytes_after_ret + 3)/ 4), + True, AnyPropertyType, + &type_ret, &format_ret, &nitems, + &bytes_after_ret, + &prop_ret) == Success) { + XChangeProperty(im->core.display, spec->lib_connect_wid, prop, + XA_STRING, 8, PropModePrepend, &prop_ret[length], + (nitems - length)); + } else { + return False; + } + } + } else { + (void)memcpy(buf, prop_ret, buf_len); + *ret_len = buf_len; + len = nitems - buf_len; + + if (bytes_after_ret > 0) { + XFree(prop_ret); + if (XGetWindowProperty(im->core.display, + spec->lib_connect_wid, prop, 0L, + ((length + bytes_after_ret + 3)/ 4), + True, AnyPropertyType, + &type_ret, &format_ret, &nitems, + &bytes_after_ret, &prop_ret) != Success) { + return False; + } + } + XChangeProperty(im->core.display, spec->lib_connect_wid, prop, + XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); + event->xclient.data.l[0] = (long)len; + event->xclient.data.l[1] = (long)prop; + XPutBackEvent(im->core.display, event); + } + XFree(prop_ret); + } else if (event->type == PropertyNotify) { + prop = event->xproperty.atom; + return_code = XGetWindowProperty(im->core.display, + spec->lib_connect_wid, prop, 0L, + 1000000L, True, AnyPropertyType, + &type_ret, &format_ret, &nitems, &bytes_after_ret, &prop_ret); + if (return_code != Success || format_ret == 0 || nitems == 0) { + if (return_code == Success) + XFree(prop_ret); + return False; + } + if (buf_len >= nitems) { + (void)memcpy(buf, prop_ret, (int)nitems); + *ret_len = (int)nitems; + } else { + (void)memcpy(buf, prop_ret, buf_len); + *ret_len = buf_len; + len = nitems - buf_len; + XChangeProperty(im->core.display, spec->lib_connect_wid, prop, + XA_STRING, 8, PropModePrepend, &prop_ret[buf_len], len); + } + XFree(prop_ret); + } + return True; +} + +static Bool +_CheckCMEvent( + Display *display, + XEvent *event, + XPointer xim) +{ + Xim im = (Xim)xim; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + CARD32 major_code = spec->major_code; + + if ((event->type == ClientMessage) + &&((event->xclient.message_type == spec->improtocolid) || + (event->xclient.message_type == spec->immoredataid))) + return True; + if((major_code == 1 || major_code == 2) && + (event->type == PropertyNotify) && + (event->xproperty.state == PropertyNewValue)) + return True; + return False; +} + +static Bool +_XimXRead(Xim im, XPointer recv_buf, int buf_len, int *ret_len) +{ + XEvent *ev; + XEvent event; + int len = 0; + XSpecRec *spec = (XSpecRec *)im->private.proto.spec; + XPointer arg = spec->ev; + + if (!arg) { + bzero(&event, sizeof(XEvent)); + ev = &event; + XIfEvent(im->core.display, ev, _CheckCMEvent, (XPointer)im); + } else { + ev = (XEvent *)arg; + spec->ev = (XPointer)NULL; + } + if (!(_XimXGetReadData(im, recv_buf, buf_len, &len, ev))) + return False; + *ret_len = len; + return True; +} + +static void +_XimXFlush(Xim im) +{ + XFlush(im->core.display); + return; +} + +Bool +_XimXConf(Xim im, char *address) +{ + XSpecRec *spec; + + if (!(spec = Xcalloc(1, sizeof(XSpecRec)))) + return False; + + spec->improtocolid = XInternAtom(im->core.display, _XIM_PROTOCOL, False); + spec->imconnectid = XInternAtom(im->core.display, _XIM_XCONNECT, False); + spec->immoredataid = XInternAtom(im->core.display, _XIM_MOREDATA, False); + spec->major_code = MAJOR_TRANSPORT_VERSION; + spec->minor_code = MINOR_TRANSPORT_VERSION; + + im->private.proto.spec = (XPointer)spec; + im->private.proto.connect = _XimXConnect; + im->private.proto.shutdown = _XimXShutdown; + im->private.proto.write = _XimXWrite; + im->private.proto.read = _XimXRead; + im->private.proto.flush = _XimXFlush; + im->private.proto.register_dispatcher = _XimXRegisterDispatcher; + im->private.proto.call_dispatcher = _XimXCallDispatcher; + + return True; +} diff --git a/nx-X11/lib/modules/im/ximcp/imTrans.c b/nx-X11/lib/modules/im/ximcp/imTrans.c new file mode 100644 index 000000000..7f936cff6 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imTrans.c @@ -0,0 +1,321 @@ +/* + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include +#include "Xlcint.h" +#include "Ximint.h" +#include "XimTrans.h" +#include "XimTrInt.h" + +#ifdef WIN32 +#include +#endif + + +#ifndef XIM_CONNECTION_RETRIES +#define XIM_CONNECTION_RETRIES 5 +#endif + + +static Bool +_XimTransConnect( + Xim im) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + int connect_stat, retry; + Window window; + + for (retry = XIM_CONNECTION_RETRIES; retry >= 0; retry--) + { + if ((spec->trans_conn = _XimXTransOpenCOTSClient ( + spec->address)) == NULL) + { + break; + } + + if ((connect_stat = _XimXTransConnect ( + spec->trans_conn, spec->address)) < 0) + { + _XimXTransClose (spec->trans_conn); + spec->trans_conn = NULL; + + if (connect_stat == TRANS_TRY_CONNECT_AGAIN) + continue; + else + break; + } + else + break; + } + + if (spec->trans_conn == NULL) + return False; + + spec->fd = _XimXTransGetConnectionNumber (spec->trans_conn); + + if (!(window = XCreateSimpleWindow(im->core.display, + DefaultRootWindow(im->core.display), 0, 0, 1, 1, 1, 0, 0))) + return False; + spec->window = window; + + _XRegisterFilterByType(im->core.display, window, KeyPress, KeyPress, + _XimTransFilterWaitEvent, (XPointer)im); + + return _XRegisterInternalConnection(im->core.display, spec->fd, + (_XInternalConnectionProc)_XimTransInternalConnection, + (XPointer)im); +} + + +static Bool +_XimTransShutdown( + Xim im) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + + _XimXTransDisconnect(spec->trans_conn); + (void)_XimXTransClose(spec->trans_conn); + _XimFreeTransIntrCallback(im); + _XUnregisterInternalConnection(im->core.display, spec->fd); + _XUnregisterFilter(im->core.display, spec->window, + _XimTransFilterWaitEvent, (XPointer)im); + XDestroyWindow(im->core.display, spec->window); + Xfree(spec->address); + Xfree(spec); + return True; +} + + + +Bool +_XimTransRegisterDispatcher( + Xim im, + Bool (*callback)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + TransIntrCallbackPtr rec; + + if (!(rec = Xmalloc(sizeof(TransIntrCallbackRec)))) + return False; + + rec->func = callback; + rec->call_data = call_data; + rec->next = spec->intr_cb; + spec->intr_cb = rec; + return True; +} + + +void +_XimFreeTransIntrCallback( + Xim im) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + register TransIntrCallbackPtr rec, next; + + for (rec = spec->intr_cb; rec;) { + next = rec->next; + Xfree(rec); + rec = next; + } + return; +} + + +Bool +_XimTransCallDispatcher(Xim im, INT16 len, XPointer data) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + TransIntrCallbackRec *rec; + + for (rec = spec->intr_cb; rec; rec = rec->next) { + if ((*rec->func)(im, len, data, rec->call_data)) + return True; + } + return False; +} + + +Bool +_XimTransFilterWaitEvent( + Display *d, + Window w, + XEvent *ev, + XPointer arg) +{ + Xim im = (Xim)arg; + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + + spec->is_putback = False; + return _XimFilterWaitEvent(im); +} + + +void +_XimTransInternalConnection( + Display *d, + int fd, + XPointer arg) +{ + Xim im = (Xim)arg; + XEvent ev; + XKeyEvent *kev; + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + + if (spec->is_putback) + return; + + bzero(&ev, sizeof(ev)); /* FIXME: other fields may be accessed, too. */ + kev = (XKeyEvent *)&ev; + kev->type = KeyPress; + kev->send_event = False; + kev->display = im->core.display; + kev->window = spec->window; + kev->keycode = 0; + kev->time = 0L; + kev->serial = LastKnownRequestProcessed(im->core.display); +#if 0 + fprintf(stderr,"%s,%d: putback FIXED kev->time=0 kev->serial=%lu\n", __FILE__, __LINE__, kev->serial); +#endif + + XPutBackEvent(im->core.display, &ev); + XFlush(im->core.display); + spec->is_putback = True; + return; +} + + +Bool +_XimTransWrite(Xim im, INT16 len, XPointer data) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + char *buf = (char *)data; + register int nbyte; + + while (len > 0) { + if ((nbyte = _XimXTransWrite(spec->trans_conn, buf, len)) <= 0) + return False; + len -= nbyte; + buf += nbyte; + } + return True; +} + + +Bool +_XimTransRead( + Xim im, + XPointer recv_buf, + int buf_len, + int *ret_len) +{ + TransSpecRec *spec = (TransSpecRec *)im->private.proto.spec; + int len; + + if (buf_len == 0) { + *ret_len = 0; + return True; + } + if ((len = _XimXTransRead(spec->trans_conn, recv_buf, buf_len)) <= 0) + return False; + *ret_len = len; + return True; +} + + +void +_XimTransFlush( + Xim im) +{ + return; +} + + + +Bool +_XimTransConf( + Xim im, + char *address) +{ + char *paddr; + TransSpecRec *spec; + + if (!(paddr = strdup(address))) + return False; + + if (!(spec = Xcalloc(1, sizeof(TransSpecRec)))) { + Xfree(paddr); + return False; + } + + spec->address = paddr; + + im->private.proto.spec = (XPointer)spec; + im->private.proto.connect = _XimTransConnect; + im->private.proto.shutdown = _XimTransShutdown; + im->private.proto.write = _XimTransWrite; + im->private.proto.read = _XimTransRead; + im->private.proto.flush = _XimTransFlush; + im->private.proto.register_dispatcher = _XimTransRegisterDispatcher; + im->private.proto.call_dispatcher = _XimTransCallDispatcher; + + return True; +} diff --git a/nx-X11/lib/modules/im/ximcp/imTransR.c b/nx-X11/lib/modules/im/ximcp/imTransR.c new file mode 100644 index 000000000..50b549e71 --- /dev/null +++ b/nx-X11/lib/modules/im/ximcp/imTransR.c @@ -0,0 +1,306 @@ +/* + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include "XimTrInt.h" +#include "Ximint.h" + +TransportSW _XimTransportRec[] = { + { "X", _XimXConf }, /* 1st entry must be X. + This will be a fallback */ +#ifdef TCPCONN + { "tcp", _XimTransConf }, /* use X transport lib */ +#endif /* TCPCONN */ +#if defined(UNIXCONN) || defined(LOCALCONN) + { "local", _XimTransConf }, /* use X transport lib */ +#endif /* UNIXCONN */ + { (char *)NULL, (Bool (*)(Xim, char *))NULL }, +}; + +Bool +_XimConnect(Xim im) +{ + return im->private.proto.connect(im); +} + +Bool +_XimShutdown(Xim im) +{ + return im->private.proto.shutdown(im); +} + +Bool +_XimWrite(Xim im, INT16 len, XPointer data) +{ + return im->private.proto.write(im, len, data); +} + +static int +_CheckProtocolData( + Xim im, + char *recv_buf) +{ + int data_len; + + data_len = (int)(((*((CARD16 *)recv_buf + 1)) * 4) + XIM_HEADER_SIZE); + return data_len; +} + +static int +_XimReadData( + Xim im, + INT16 *len, + XPointer buf, + int buf_size) +{ + char *hold_buf; + char *tmp; + int data_len; + int packet_size; + int ret_len; + register int i; + + if (buf_size < XIM_HEADER_SIZE) { + *len = (INT16)XIM_HEADER_SIZE; + return XIM_OVERFLOW; + } + + bzero(buf, buf_size); + packet_size = 0; + data_len = 0; + + if ((hold_buf = im->private.proto.hold_data)) { + data_len = im->private.proto.hold_data_len; + if (data_len >= XIM_HEADER_SIZE) { + packet_size = _CheckProtocolData(im, hold_buf); + if (packet_size > buf_size) { + *len = (INT16)packet_size; + return XIM_OVERFLOW; + } + if (packet_size <= data_len) { + memcpy(buf, hold_buf, packet_size); + for (i = packet_size; i < data_len; i++) { + if (hold_buf[i]) + break; + } + data_len -= i; + + if (data_len) { + if (!(tmp = Xmalloc(data_len))) { + return XIM_FALSE; + } + memcpy(tmp, &hold_buf[i], data_len); + im->private.proto.hold_data = tmp; + im->private.proto.hold_data_len = data_len; + } else { + im->private.proto.hold_data = 0; + im->private.proto.hold_data_len = 0; + } + Xfree(hold_buf); + *len = (INT16)packet_size; + return XIM_TRUE; + } + } + memcpy(buf, hold_buf, data_len); + buf_size -= data_len; + Xfree(hold_buf); + im->private.proto.hold_data = 0; + im->private.proto.hold_data_len = 0; + } + + if (!packet_size) { + while (data_len < XIM_HEADER_SIZE) { + if (!(im->private.proto.read(im, + (XPointer)&buf[data_len], buf_size, &ret_len))) { + return XIM_FALSE; + } + data_len += ret_len; + buf_size -= ret_len; + } + packet_size = _CheckProtocolData(im, buf); + } + + if (packet_size > buf_size) { + if (!(tmp = Xmalloc(data_len))) { + return XIM_FALSE; + } + memcpy(tmp, buf, data_len); + bzero(buf, data_len); + im->private.proto.hold_data = tmp; + im->private.proto.hold_data_len = data_len; + *len = (INT16)packet_size; + return XIM_OVERFLOW; + } + + while (data_len < packet_size) { + if (!(im->private.proto.read(im, + (XPointer)&buf[data_len], buf_size, &ret_len))) { + return XIM_FALSE; + } + data_len += ret_len; + buf_size -= ret_len; + } + + for (i = packet_size; i < data_len; i++) { + if (buf[i]) + break; + } + data_len -= i; + + if (data_len) { + if (!(tmp = Xmalloc(data_len))) { + return XIM_FALSE; + } + memcpy(tmp, &buf[i], data_len); + bzero(&buf[i], data_len); + im->private.proto.hold_data = tmp; + im->private.proto.hold_data_len = data_len; + } else { + im->private.proto.hold_data = 0; + im->private.proto.hold_data_len = 0; + } + *len = (INT16)packet_size; + return XIM_TRUE; +} + +static Bool +_XimCallDispatcher( + Xim im, + INT16 len, + XPointer data) +{ + return im->private.proto.call_dispatcher(im, len, data); +} + +int +_XimRead(Xim im, INT16 *len, XPointer buf, int buf_size, + Bool (*predicate)(Xim, INT16, XPointer, XPointer), XPointer arg) +{ + INT16 read_len; + int ret_code; + + for (;;) { + ret_code = _XimReadData(im, &read_len, buf, buf_size); + if(ret_code != XIM_TRUE) { + return ret_code; + } + if ((*predicate)(im, read_len, buf, arg)) + break; + if (_XimCallDispatcher(im, read_len, buf)) + continue; + _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); + } + *len = read_len; + return True; +} + +Bool +_XimRegisterDispatcher( + Xim im, + Bool (*callback)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data) +{ + return im->private.proto.register_dispatcher(im, callback, call_data); +} + +void +_XimFlush(Xim im) +{ + im->private.proto.flush(im); + return; +} + +Bool +_XimFilterWaitEvent(Xim im) +{ + INT16 read_len; + CARD32 reply32[BUFSIZE/4]; + char *reply = (char *)reply32; + XPointer preply; + int buf_size; + int ret_code; + + buf_size = BUFSIZE; + ret_code = _XimReadData(im, &read_len, (XPointer)reply, buf_size); + if(ret_code == XIM_TRUE) { + preply = reply; + } else if(ret_code == XIM_OVERFLOW) { + if(read_len <= 0) { + preply = reply; + } else { + buf_size = (int)read_len; + preply = Xmalloc(buf_size); + ret_code = _XimReadData(im, &read_len, preply, buf_size); + if(ret_code != XIM_TRUE) { + if (preply != reply) + Xfree(preply); + return False; + } + } + } else { + return False; + } + if (_XimCallDispatcher(im, read_len, preply)) { + if(reply != preply) + Xfree(preply); + return True; + } + _XimError(im, 0, XIM_BadProtocol, (INT16)0, (CARD16)0, (char *)NULL); + if(reply != preply) + Xfree(preply); + return True; +} diff --git a/nx-X11/lib/modules/lc/Makefile.am b/nx-X11/lib/modules/lc/Makefile.am new file mode 100644 index 000000000..fe1ad2055 --- /dev/null +++ b/nx-X11/lib/modules/lc/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = Utf8 def gen diff --git a/nx-X11/lib/modules/lc/Utf8/Makefile.am b/nx-X11/lib/modules/lc/Utf8/Makefile.am new file mode 100644 index 000000000..7eb0fe258 --- /dev/null +++ b/nx-X11/lib/modules/lc/Utf8/Makefile.am @@ -0,0 +1,28 @@ +NULL = + +noinst_LTLIBRARIES = libxlcUTF8Load.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(MALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +xlcUTF8Load_la_SOURCES = \ + lcUTF8Load.c \ + $(NULL) + +libxlcUTF8Load_la_SOURCES = $(xlcUTF8Load_la_SOURCES) diff --git a/nx-X11/lib/modules/lc/Utf8/lcUTF8Load.c b/nx-X11/lib/modules/lc/Utf8/lcUTF8Load.c new file mode 100644 index 000000000..82ea3b54d --- /dev/null +++ b/nx-X11/lib/modules/lc/Utf8/lcUTF8Load.c @@ -0,0 +1,70 @@ +/****************************************************************** + + Copyright 1993 by SunSoft, Inc. + Copyright 1999-2000 by Bruno Haible + +Permission to use, copy, modify, distribute, and sell this software +and its 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 names of SunSoft, Inc. and +Bruno Haible not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. SunSoft, Inc. and Bruno Haible make no representations +about the suitability of this software for any purpose. It is +provided "as is" without express or implied warranty. + +SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible 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. + +******************************************************************/ + +/* + * This file contains the UTF-8 locale loader. + * Supports: all locales with codeset UTF-8. + * Platforms: all systems. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "XlcPubI.h" +#include "XlcGeneric.h" + +XLCd +_XlcUtf8Loader( + const char *name) +{ + XLCd lcd; + + lcd = _XlcCreateLC(name, _XlcGenericMethods); + if (lcd == (XLCd) NULL) + return lcd; + + /* The official IANA name for UTF-8 is "UTF-8" in upper case with a dash. */ + if (!XLC_PUBLIC_PART(lcd)->codeset) { + _XlcDestroyLC(lcd); + return (XLCd) NULL; + } + else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8")) { + _XlcAddUtf8LocaleConverters(lcd); + } + else if (!_XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "GB18030")) { + _XlcAddGB18030LocaleConverters(lcd); + } + else { + _XlcDestroyLC(lcd); + return (XLCd) NULL; + } + + _XlcAddUtf8Converters(lcd); + + return lcd; +} diff --git a/nx-X11/lib/modules/lc/def/Makefile.am b/nx-X11/lib/modules/lc/def/Makefile.am new file mode 100644 index 000000000..7d5766367 --- /dev/null +++ b/nx-X11/lib/modules/lc/def/Makefile.am @@ -0,0 +1,27 @@ +NULL = + +noinst_LTLIBRARIES = libxlcDef.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(CWARNFLAG) \ + $(NULL) + +xlcDef_la_SOURCES = \ + lcDefConv.c \ + $(NULL) + +libxlcDef_la_SOURCES = $(xlcDef_la_SOURCES) diff --git a/nx-X11/lib/modules/lc/def/lcDefConv.c b/nx-X11/lib/modules/lc/def/lcDefConv.c new file mode 100644 index 000000000..2096d871b --- /dev/null +++ b/nx-X11/lib/modules/lc/def/lcDefConv.c @@ -0,0 +1,806 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * 2000 + * Modifier: Ivan Pascal The XFree86 Project + */ + +/* + * The default locale loader. + * Supports: one byte per char (iso8859 like) locales. + * How: converts bytes to wide characters in a 1:1 manner. + * Platforms: all systems. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcGeneric.h" + +#ifndef MB_LEN_MAX +#define MB_LEN_MAX 6 +#endif + +#if !defined(X_LOCALE) +#define STDCVT +#endif + +#define GR 0x80 +#define GL 0x7f + +typedef struct _StateRec *State; +typedef struct _StateRec { + CodeSet GL_codeset; + CodeSet GR_codeset; + wchar_t wc_mask; + wchar_t wc_encode_mask; + Bool (*MBtoWC) (State state, const char *ch, wchar_t *wc); + Bool (*WCtoMB) (State state, wchar_t wc, char *ch); +} StateRec; + +static +Bool MBtoWCdef( + State state, + const char *ch, + wchar_t *wc) +{ + wchar_t wc_encoding; + CodeSet codeset = (*ch & GR) ? state->GR_codeset : state->GL_codeset; + if (!codeset) + return False; + wc_encoding = codeset->wc_encoding; + *wc = ((wchar_t) *ch & state->wc_mask) | wc_encoding; + return True; +} + +#ifdef STDCVT +static +Bool MBtoWCstd( + State state, + const char *ch, + wchar_t *wc) +{ + return (mbtowc(wc, ch, 1) == 1); +} +#endif + +static +Bool WCtoMBdef( + State state, + wchar_t wc, + char *ch) +{ + wchar_t wc_encoding = wc & state->wc_encode_mask; + CodeSet codeset; + + codeset = state->GL_codeset; + if (codeset && (wc_encoding == codeset->wc_encoding)) { + *ch = wc & state->wc_mask; + return True; + } + codeset = state->GR_codeset; + if (codeset && (wc_encoding == codeset->wc_encoding)) { + *ch = (wc & state->wc_mask) | GR; + return True; + } + return False; +} + +#ifdef STDCVT +static +Bool WCtoMBstd( + State state, + wchar_t wc, + char *ch) +{ + return (wctomb(ch, wc) == 1); +} +#endif + +static +XlcCharSet get_charset( + State state, + char side) +{ + CodeSet codeset = side ? state->GR_codeset : state->GL_codeset; + if (codeset) { + int i; + XlcCharSet charset; + for (i = 0; i < codeset->num_charsets; i++) { + charset = codeset->charset_list[i]; + if (*charset->ct_sequence != '\0') + return charset; + } + return *(codeset->charset_list); + } + return (XlcCharSet) NULL; +} + +static int +def_mbstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src; + wchar_t *dst = (wchar_t *) *to; + State state = (State) conv->state; + int unconv = 0; + + if (from == NULL || *from == NULL) + return 0; + + src = (const char *) *from; + + while (*from_left && *to_left) { + (*from_left)--; + if (state->MBtoWC (state, src++, dst)) { + dst++; + (*to_left)--; + } else { + unconv++; + } + } + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +def_wcstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const wchar_t *src; + char *dst = (char *) *to; + State state = (State) conv->state; + char ch[MB_LEN_MAX]; + int unconv = 0; + + if (from == NULL || *from == NULL) + return 0; + + src = (const wchar_t *) *from; + + while (*from_left && *to_left) { + (*from_left)--; + if (state->WCtoMB (state, *src++, ch)) { + *dst++ = *ch; + (*to_left)--; + } else { + unconv++; + } + } + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +mbstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src; + char *dst = (char *) *to; + CodeSet codeset; + State state = (State) conv->state; + char ch; + int unconv = 0; + + if (from == NULL || *from == NULL) + return 0; + + src = (const char *) *from; + + while (*from_left && *to_left) { + ch = *src++; + (*from_left)--; + + codeset = (ch & GR) ? state->GR_codeset : state->GL_codeset; + if (codeset && codeset->string_encoding) { + *dst++ = ch; + (*to_left)--; + } else { + unconv++; + } + } + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +wcstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const wchar_t *src; + char *dst = (char *) *to; + CodeSet codeset; + State state = (State) conv->state; + char ch[MB_LEN_MAX]; + int unconv = 0; + + if (from == NULL || *from == NULL) + return 0; + + src = (const wchar_t *) *from; + + while (*from_left && *to_left) { + (*from_left)--; + if (state->WCtoMB (state, *src++, ch)) { + codeset = (*ch & GR) ? state->GR_codeset : state->GL_codeset; + if (codeset && codeset->string_encoding) { + *dst++ = *ch; + (*to_left)--; + } else { + unconv++; + } + } else { + unconv++; + } + } + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +mbstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src; + char *dst = (char *) *to; + int length; + State state = (State) conv->state; + char cur_side; + int unconv = 0; + + if (from == NULL || *from == NULL) + return 0; + + src = (const char *) *from; + length = min(*from_left, *to_left); + + cur_side = *src & GR; + while (length) { + if ((char) (*src & GR) != cur_side) + break; + *dst++ = *src++; + length--; + } + + if (num_args > 0) { + XlcCharSet charset = get_charset(state, cur_side); + if (charset) { + *((XlcCharSet *) args[0]) = charset; + } else { + dst = *to; + unconv = -1; + } + } + *from_left -= src - (char *) *from; + *to_left -= dst - (char *) *to; + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const wchar_t *src; + char *dst = (char *) *to; + State state = (State) conv->state; + char cur_side = 0, ch[MB_LEN_MAX]; + int unconv = 0; + Bool found = False; + + if (from == NULL || *from == NULL) + return 0; + + src = (const wchar_t *) *from; + + while (*from_left) { + if ((found = state->WCtoMB (state, *src, ch))) + break; + unconv++; + src++; + (*from_left)--; + } + + if (found) { + cur_side = *ch & GR; + while (*from_left && *to_left) { + (*from_left)--; + if (state->WCtoMB (state, *src++, ch)) { + if ((char) (*ch & GR) != cur_side) { + src--; + (*from_left)++; + break; + } else { + *dst++ = *ch; + (*to_left)--; + } + } else { + unconv++; + } + } + } else { + unconv++; + } + + if (num_args > 0) { + XlcCharSet charset = get_charset(state, cur_side); + if (charset) { + *((XlcCharSet *) args[0]) = charset; + } else { + unconv = -1; + } + } + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +cstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src; + char *dst = (char *) *to; + CodeSet codeset; + XlcCharSet charset; + State state = (State) conv->state; + unsigned char cur_side = 0; + int i; + Bool found = False; + + if (from == NULL || *from == NULL) + return 0; + + src = (const char *) *from; + + if (num_args > 0) { + charset = (XlcCharSet) args[0]; + if (charset == NULL) + return -1; + } else { + return -1; + } + + if ((charset->side == XlcGL) || (charset->side == XlcGLGR)) { + codeset = state->GL_codeset; + if (codeset) { + for (i = 0; i < codeset->num_charsets; i++) + if (charset == codeset->charset_list[i]) { + found = True; + cur_side = 0; + break; + } + } + } + if (!found && ((charset->side == XlcGR) || (charset->side == XlcGLGR))) { + codeset = state->GR_codeset; + if (codeset) { + for (i = 0; i < codeset->num_charsets; i++) + if (charset == codeset->charset_list[i]) { + found = True; + cur_side = GR; + break; + } + } + } + if (found) { + int length = min(*from_left, *to_left); + while (length) { + *dst++ = *src++ | cur_side; + length--; + } + } else { + return -1; + } + + *from_left -= src - (char *) *from; + *to_left -= dst - (char *) *to; + *from = (XPointer) src; + *to = (XPointer) dst; + return 0; +} + +static int +cstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src; + wchar_t *dst = (wchar_t *) *to; + CodeSet codeset; + XlcCharSet charset; + State state = (State) conv->state; + Bool found = False; + int i, unconv = 0; + unsigned char cur_side = 0; + + if (from == NULL || *from == NULL) + return 0; + + src = (const char *) *from; + + if (num_args > 0) { + charset = (XlcCharSet) args[0]; + if (charset == NULL) + return -1; + } else { + return -1; + } + + if ((charset->side == XlcGL) || (charset->side == XlcGLGR)) { + codeset = state->GL_codeset; + if (codeset) { + for (i = 0; i < codeset->num_charsets; i++) + if (charset == codeset->charset_list[i]) { + found = True; + cur_side = 0; + break; + } + } + } + if (!found && ((charset->side == XlcGR) || (charset->side == XlcGLGR))) { + codeset = state->GR_codeset; + if (codeset) { + for (i = 0; i < codeset->num_charsets; i++) + if (charset == codeset->charset_list[i]) { + found = True; + cur_side = GR; + break; + } + } + } + if (found) { + char ch; + while (*from_left && *to_left) { + ch = *src++ | cur_side; + (*from_left)--; + if (state->MBtoWC (state, &ch, dst)) { + dst++; + (*to_left)--; + } else { + unconv++; + } + } + } else { + return -1; + } + *from = (XPointer) src; + *to = (XPointer) dst; + return unconv; +} + +static int +strtombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src; + char *dst = (char *) *to; + int length; + + if (from == NULL || *from == NULL) + return 0; + + src = (const char *) *from; + length = min(*from_left, *to_left); + while (length) { + *dst++ = *src++; + length--; + } + + *from_left -= src - (char *) *from; + *to_left -= dst - (char *) *to; + *from = (XPointer) src; + *to = (XPointer) dst; + return 0; +} + +static void +close_converter( + XlcConv conv) +{ + + Xfree(conv->state); + Xfree(conv); +} + +static XlcConv +create_conv( + XLCd lcd, + XlcConvMethods methods) +{ + XlcConv conv; + State state; + + conv = Xcalloc(1, sizeof(XlcConvRec)); + if (conv == NULL) + return (XlcConv) NULL; + + state = Xmalloc(sizeof(StateRec)); + if (state == NULL) { + close_converter(conv); + return (XlcConv) NULL; + } + state->GL_codeset = XLC_GENERIC(lcd, initial_state_GL); + state->GR_codeset = XLC_GENERIC(lcd, initial_state_GR); + state->wc_mask = (1 << XLC_GENERIC(lcd, wc_shift_bits)) - 1; + state->wc_encode_mask = XLC_GENERIC(lcd, wc_encode_mask); + +#ifdef STDCVT + if (XLC_GENERIC(lcd, use_stdc_env) == True) + state->MBtoWC = &MBtoWCstd; + else +#endif + state->MBtoWC = &MBtoWCdef; + +#ifdef STDCVT + if (XLC_GENERIC(lcd, use_stdc_env) == True) + state->WCtoMB = &WCtoMBstd; + else +#endif + state->WCtoMB = &WCtoMBdef; + + conv->methods = methods; + conv->state = (XPointer) state; + + return conv; +} + +static XlcConvMethodsRec mbstowcs_methods = { + close_converter, + def_mbstowcs, + NULL +}; + +static XlcConv +open_mbstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstowcs_methods); +} + +static XlcConvMethodsRec mbstostr_methods = { + close_converter, + mbstostr, + NULL +}; + +static XlcConv +open_mbstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstostr_methods); +} + +static XlcConvMethodsRec mbstocs_methods = { + close_converter, + mbstocs, + NULL +}; + +static XlcConv +open_mbstocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstocs_methods); +} + +static XlcConvMethodsRec wcstombs_methods = { + close_converter, + def_wcstombs, + NULL +}; + +static XlcConv +open_wcstombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstombs_methods); +} + +static XlcConvMethodsRec wcstostr_methods = { + close_converter, + wcstostr, + NULL +}; + +static XlcConv +open_wcstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstostr_methods); +} + +static XlcConvMethodsRec wcstocs_methods = { + close_converter, + wcstocs, + NULL +}; + +static XlcConv +open_wcstocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstocs_methods); +} + +static XlcConvMethodsRec strtombs_methods = { + close_converter, + strtombs, + NULL +}; + +static XlcConv +open_strtombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &strtombs_methods); +} + +static XlcConvMethodsRec cstombs_methods = { + close_converter, + cstombs, + NULL +}; + +static XlcConv +open_cstombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &cstombs_methods); +} + +static XlcConvMethodsRec cstowcs_methods = { + close_converter, + cstowcs, + NULL +}; + +static XlcConv +open_cstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &cstowcs_methods); +} + +XLCd +_XlcDefaultLoader( + const char *name) +{ + XLCd lcd; + + lcd = _XlcCreateLC(name, _XlcGenericMethods); + if (lcd == NULL) + return lcd; + + if (XLC_PUBLIC(lcd, mb_cur_max) != 1){ + _XlcDestroyLC(lcd); + return (XLCd) NULL; + } + + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbstocs); + + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); + + _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_mbstowcs); + + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); + + _XlcAddUtf8Converters(lcd); + + return lcd; +} diff --git a/nx-X11/lib/modules/lc/gen/Makefile.am b/nx-X11/lib/modules/lc/gen/Makefile.am new file mode 100644 index 000000000..6106cfd4b --- /dev/null +++ b/nx-X11/lib/modules/lc/gen/Makefile.am @@ -0,0 +1,27 @@ +NULL = + +noinst_LTLIBRARIES = libxlibi18n.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +xlibi18n_la_SOURCES = \ + lcGenConv.c \ + $(NULL) + +libxlibi18n_la_SOURCES = $(xlibi18n_la_SOURCES) diff --git a/nx-X11/lib/modules/lc/gen/lcGenConv.c b/nx-X11/lib/modules/lc/gen/lcGenConv.c new file mode 100644 index 000000000..799f49a30 --- /dev/null +++ b/nx-X11/lib/modules/lc/gen/lcGenConv.c @@ -0,0 +1,3112 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * (c) Copyright 1995 FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Masayoshi Shimamura FUJITSU LIMITED + * + */ +/* + * 2000 + * Modifier: Ivan Pascal The XFree86 Project + */ + +/* + * A generic locale loader for all kinds of ISO-2022 based codesets. + * Supports: all locales. + * How: Provides generic converters for ISO-2022 based codesets. Extensible as + * far as ISO-2022 is extensible: codesets can be given by name in the + * stream. Overall distinction between GL (0x00..0x7f) and GR (0x80..0xff). + * In every chunk between escape sequences, the number of bytes per + * character (char_size) is constant. + * Platforms: all systems. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcGeneric.h" +#include + +#if !defined(X_LOCALE) +#define STDCVT +#endif + +typedef struct _CTDataRec { + const char *name; + const char *encoding; /* Compound Text encoding */ +} CTDataRec, *CTData; + +static CTDataRec directionality_data[] = +{ + { "BEGIN_LEFT-TO-RIGHT_TEXT", "\2331]" }, + { "BEGIN_RIGHT-TO-LEFT_TEXT", "\2332]" }, + { "END_OF_STRING", "\233]" }, +}; + +typedef struct _StateRec { + XLCd lcd; + /* CT state */ + XlcCharSet charset; /* charset of current state */ + XlcCharSet GL_charset; /* charset of initial state in GL */ + XlcCharSet GR_charset; /* charset of initial state in GR */ + /* MB shift state */ + CodeSet GL_codeset; + CodeSet GR_codeset; +} StateRec, *State; + +#define GR 0x80 /* begins right-side (non-ascii) region */ +#define GL 0x7f /* ends left-side (ascii) region */ +#define ESC 0x1b +#define CSI 0x9b +#define STX 0x02 + +#define isrightside(c) ((c) & GR) +#define isleftside(c) (!isrightside(c)) + +/* Forward declarations for local routines. */ +static int mbstocts (XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args); +static int ctstombs (XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args); +static int cstombs (XlcConv conv, XPointer *from, int *from_left, + XPointer *to, int *to_left, XPointer *args, int num_args); + +/* ------------------------------------------------------------------------- */ +/* Misc */ +/* ------------------------------------------------------------------------- */ + +static int +compare( + const char *src, + const char *encoding, + int length) +{ + const char *start = src; + + while (length-- > 0) { + if (*src++ != *encoding++) + return 0; + if (*encoding == '\0') + return src - start; + } + + return 0; +} + +static unsigned long +conv_to_dest( + Conversion conv, + unsigned long code) +{ + int i; + int conv_num = conv->conv_num; + FontScope convlist = conv->convlist; + + for (i = 0; i < conv_num; i++) { + if (convlist[i].start <= code && code <= convlist[i].end) { + switch (convlist[i].shift_direction) { + case '+': + return(code + convlist[i].shift); + case '-': + return(code - convlist[i].shift); + default: + return(code); + } + } + } + + return(code); +} + +static unsigned long +conv_to_source( + Conversion conv, + unsigned long code) +{ + int i; + int conv_num; + FontScope convlist; + unsigned long start_p; + unsigned long start_m; + unsigned long end_p; + unsigned long end_m; + + if (!conv) + return(code); + + conv_num = conv->conv_num; + convlist = conv->convlist; + + for (i = 0; i < conv_num; i++) { + switch (convlist[i].shift_direction) { + case '+': + start_p = convlist[i].start + convlist[i].shift; + end_p = convlist[i].end + convlist[i].shift; + if (start_p <= code && code <= end_p) + return(code - convlist[i].shift); + break; + case '-': + start_m = convlist[i].start - convlist[i].shift; + end_m = convlist[i].end - convlist[i].shift; + if (start_m <= code && code <= end_m) + return(code + convlist[i].shift); + break; + default: + continue; + } + } + + return(code); +} + +static unsigned long +mb_to_gi( + unsigned long mb, + CodeSet codeset) +{ + int i; + unsigned long mb_tmp, mask = 0; + + if (codeset->mbconv) { + mb_tmp = conv_to_dest(codeset->mbconv, mb); + if (mb_tmp != mb) + return(mb_tmp); + } + + if (codeset->side == XlcC0 || codeset->side == XlcGL || + codeset->side == XlcC1 || codeset->side == XlcGR) { + + for (i = 0; i < codeset->length; i++) + mask = (mask << 8) | GL; + mb = mb & mask; + } + + return(mb); +} + +static unsigned long +gi_to_mb( + unsigned long glyph_index, + CodeSet codeset) +{ + int i; + unsigned long mask = 0; + + if (codeset->side == XlcC1 || codeset->side == XlcGR) { + for (i = 0; i < codeset->length; i++) + mask = (mask << 8) | GR; + glyph_index = glyph_index | mask; + } + + if (codeset->mbconv) + return( conv_to_source(codeset->mbconv, glyph_index) ); + + return(glyph_index); +} + +static Bool +gi_to_wc( + XLCd lcd, + unsigned long glyph_index, + CodeSet codeset, + wchar_t *wc) +{ + unsigned char mask = 0; + unsigned long wc_encoding = codeset->wc_encoding; + int length = codeset->length; + unsigned long wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); + + mask = (1 << wc_shift_bits) - 1 ; + + for (*wc = 0, length--; length >= 0; length--) + *wc = (*wc << wc_shift_bits) | ((glyph_index >> (length * 8 )) & mask); + + *wc = *wc | wc_encoding; + + return(True); +} + +static Bool +wc_to_gi( + XLCd lcd, + wchar_t wc, + unsigned long *glyph_index, + CodeSet *codeset) +{ + int i; + unsigned char mask = 0; + unsigned long wc_encoding; + unsigned long wc_encode_mask = XLC_GENERIC(lcd, wc_encode_mask); + unsigned long wc_shift_bits = XLC_GENERIC(lcd, wc_shift_bits); + int codeset_num = XLC_GENERIC(lcd, codeset_num); + CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); + + wc_encoding = wc & wc_encode_mask; + for (*codeset = NULL, i = 0; i < codeset_num; i++) { + if (wc_encoding == codeset_list[i]->wc_encoding) { + *codeset = codeset_list[i]; + break; + } + } + if (*codeset == NULL) + return(False); + + mask = (1 << wc_shift_bits) - 1 ; + + wc = wc & ~wc_encode_mask; + for (*glyph_index = 0, i = (*codeset)->length - 1; i >= 0; i--) + *glyph_index = (*glyph_index << 8) | + ( ((unsigned long)wc >> (i * wc_shift_bits)) & mask ); + + return(True); +} + +static CodeSet +mb_parse_codeset( + State state, + int num, + const char **inbufptr, + int *from_left) +{ + int len; + int from_len = (*from_left) + 1; + const char *src = (*inbufptr) - 1; + ParseInfo *mb_parse_list = XLC_GENERIC(state->lcd, mb_parse_list); + ParseInfo parse_info; + CodeSet codeset; + + for (--num ; (parse_info = mb_parse_list[num]) != NULL; num++) { + len = compare(src, parse_info->encoding, from_len); + if (len > 0) { + codeset = parse_info->codeset; + if (parse_info->type == E_LSL) + state->GL_codeset = codeset; + else if (parse_info->type == E_LSR) + state->GR_codeset = codeset; + --len; + *inbufptr += len; + *from_left -= len; + return codeset; + } + } + return (CodeSet) NULL; +} + +static CodeSet +byteM_parse_codeset( + XLCd lcd, + const char *inbufptr) +{ + unsigned char ch; + CodeSet codeset; + ByteInfoList byteM; + ByteInfoListRec byteM_rec; + ByteInfo byteinfo; + ByteInfoRec byteinfo_rec; + Bool hit = False; + int i, j, k; + + int codeset_num = XLC_GENERIC(lcd, codeset_num); + CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); + + for (i = 0; i < codeset_num; i++) { + codeset = codeset_list[i]; + byteM = codeset->byteM; + if (codeset->side != XlcNONE || byteM == NULL) + continue; + + for (j = 0; j < codeset->length; j++) { + ch = *((const unsigned char *)(inbufptr + j)); + byteM_rec = byteM[j]; + byteinfo = byteM_rec.byteinfo; + + for (hit = False, k = 0; k < byteM_rec.byteinfo_num; k++) { + byteinfo_rec = byteinfo[k]; + if (byteinfo_rec.start <= ch && ch <= byteinfo_rec.end) { + hit = True; + break; + } + } + + if (!hit) + break; + } + + if (hit) + return(codeset); + } + + return(NULL); +} + +#define GLGR_parse_codeset(ch) \ + (isrightside(ch) ? (state->GR_codeset) : \ + (state->GL_codeset) ) + +static XlcCharSet +gi_parse_charset( + unsigned long glyph_index, + CodeSet codeset) +{ + int i; + XlcCharSet *charset_list = codeset->charset_list; + int num_charsets = codeset->num_charsets; + ExtdSegment ctextseg = codeset->ctextseg; + XlcCharSet charset = NULL; + int area_num; + FontScope area; + + /* lockup ct sequence */ + for (i = 0; i < num_charsets; i++) { + charset = charset_list[i]; + if (*charset->ct_sequence != '\0') + break; + } + if (i >= num_charsets) + return(NULL); + + if (charset->source != CSsrcStd) + return (charset); + + if (!ctextseg) + return(charset); + + area = ctextseg->area; + area_num = ctextseg->area_num; + + for (i = 0; i < area_num; i++) { + + if (area[i].start <= glyph_index && glyph_index <= area[i].end) { + + charset = ctextseg->charset; + + if (*charset->ct_sequence == '\0') + return(NULL); + + break; + } + } + + return(charset); +} + +static Bool +ct_parse_csi( + const char *inbufptr, + int *ctr_seq_len) +{ + int i; + int num = sizeof(directionality_data) / sizeof(directionality_data[0]); + + for (i = 0; i < num; i++) { + if ( !(*ctr_seq_len = strlen(directionality_data[i].encoding)) ) + continue; + + if ( strncmp(inbufptr, directionality_data[i].encoding, + *ctr_seq_len) == 0) + return(True); + } + + return(False); +} + +static int +cmp_esc_sequence( + const char *inbufptr, + XlcCharSet charset) +{ + int seq_len, name_len, total_len; + unsigned char byte_m, byte_l; + const char *ct_sequence = charset->ct_sequence; + const char *encoding_name = charset->encoding_name; + + /* check esc sequence */ + if ( !(seq_len = strlen(ct_sequence) ) ) + return(0); + if ( strncmp(inbufptr, ct_sequence, seq_len) != 0) + return(0); + + /* Standard Character Set Encoding ? */ + if (charset->source == CSsrcStd) + return(seq_len); + + /* + * Non-Standard Character Set Encoding + * + * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ + * | ctseq | M | L | encoding name | STX | contents | + * +--- ---+-----+-----+-----+---- ----+-----+-----+------- ------+ + * 4bytes 1byte 1byte variable length 1byte variable length + * | | + * +----------------------------------------------+ + * rest length = ((M - 128) * 128) + (L - 128) + */ + + /* get length of encoding name */ + inbufptr += seq_len; + byte_m = *inbufptr++; + byte_l = *inbufptr++; + name_len = strlen(encoding_name); + + if (((byte_m - 128) * 128 + (byte_l - 128) - 1) < name_len) + return(0); + + if ( _XlcNCompareISOLatin1(inbufptr, encoding_name, name_len) != 0 ) + return(0); + + /* check STX (Start of Text) */ + inbufptr = inbufptr + name_len; + if ( *inbufptr != STX ) + return(0); + + total_len = seq_len + name_len + 3; + return(total_len); +} + +static Bool +ct_parse_charset( + XLCd lcd, + const char *inbufptr, + XlcCharSet *charset, + int *ctr_seq_len) +{ + int i, j; + ExtdSegment ctextseg; + int num_charsets; + XlcCharSet *charset_list; + CodeSet codeset; + int codeset_num = XLC_GENERIC(lcd, codeset_num); + CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); + int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); + SegConv segment_conv = XLC_GENERIC(lcd, segment_conv); + + /* get charset from XLC_XLOCALE by escape sequence */ + + for (i = 0; i < codeset_num; i++) { + codeset = codeset_list[i]; + + num_charsets = codeset->num_charsets; + charset_list = codeset->charset_list; + ctextseg = codeset->ctextseg; + + for (j = 0; j < num_charsets; j++) { + *charset = charset_list[j]; + if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) + return(True); + } + + if (ctextseg) { + *charset = ctextseg->charset; + if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) + return(True); + } + } + + /* get charset from XLC_SEGMENTCONVERSION by escape sequence */ + + if (!segment_conv) + return(False); + + for (i = 0; i < segment_conv_num; i++) { + *charset = segment_conv[i].source; + if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) + return(True); + *charset = segment_conv[i].dest; + if ((*ctr_seq_len = cmp_esc_sequence(inbufptr, *charset))) + return(True); + } + + return(False); +} + +static Bool +segment_conversion( + XLCd lcd, + XlcCharSet *charset, + unsigned long *glyph_index) +{ + int i; + int segment_conv_num = XLC_GENERIC(lcd, segment_conv_num); + SegConv segment_conv = XLC_GENERIC(lcd, segment_conv); + FontScopeRec range; + ConversionRec conv_rec; + + if (!segment_conv) + return(True); + + for (i = 0; i < segment_conv_num; i++) { + if (segment_conv[i].source == *charset) + break; + } + + if (i >= segment_conv_num) + return(True); + + range = segment_conv[i].range; + if (*glyph_index < range.start || range.end < *glyph_index) + return(True); + + *charset = segment_conv[i].dest; + conv_rec.conv_num = segment_conv[i].conv_num; + conv_rec.convlist = segment_conv[i].conv; + *glyph_index = conv_to_dest(&conv_rec, *glyph_index); + + return(True); +} + +static CodeSet +_XlcGetCodeSetFromName( + XLCd lcd, + const char *name) +{ + int i, j; + XlcCharSet charset; + int num_charsets; + XlcCharSet *charset_list; + CodeSet codeset; + + int codeset_num = XLC_GENERIC(lcd, codeset_num); + CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); + + for (i = 0; i < codeset_num; i++) { + codeset = codeset_list[i]; + + num_charsets = codeset->num_charsets; + charset_list = codeset->charset_list; + + for (j = 0; j < num_charsets; j++) { + charset = charset_list[j]; + + if (!strlen(charset->name)) + continue; + if ( strcmp(charset->name, name) == 0) + return(codeset); + } + } + + return(NULL); +} + +static Bool +_XlcGetCodeSetFromCharSet( + XLCd lcd, + XlcCharSet charset, + CodeSet *codeset, + unsigned long *glyph_index) +{ + int j, num; + CodeSet *codeset_list = XLC_GENERIC(lcd, codeset_list); + XlcCharSet *charset_list; + int codeset_num, num_charsets; + Conversion ctconv; + unsigned long glyph_index_tmp = 0; + ExtdSegment ctextseg; + + codeset_num = XLC_GENERIC(lcd, codeset_num); + + for (num = 0 ; num < codeset_num; num++) { + *codeset = codeset_list[num]; + ctconv = (*codeset)->ctconv; + ctextseg = (*codeset)->ctextseg; + + num_charsets = (*codeset)->num_charsets; + charset_list = (*codeset)->charset_list; + + glyph_index_tmp = conv_to_source(ctconv, *glyph_index); + + if (charset->source == CSsrcStd) { + + /* Standard Character Set Encoding */ + if (glyph_index_tmp == *glyph_index) { + for (j = 0; j < num_charsets; j++) { + if (charset_list[j] == charset) { + goto end_loop; + } + } + } + + } else { + + /* Non-Standard Character Set Encoding */ + for (j = 0; j < num_charsets; j++) { + if (charset_list[j] == charset) { + goto end_loop; + } + } + + if (glyph_index_tmp != *glyph_index) { + if (ctextseg && ctextseg->charset == charset) { + goto end_loop; + } + } + + } + + } + +end_loop: + if (num < codeset_num) { + *glyph_index = glyph_index_tmp; + return(True); + } + + return(False); +} + +#define check_string_encoding(codeset) (codeset->string_encoding) + +static void +output_ulong_value( + char *outbufptr, + unsigned long code, + int length, + XlcSide side) +{ + int i; + + for (i = (length - 1) * 8; i >= 0; i -= 8) { + *outbufptr = ( code >> i) & 0xff; + + if (side == XlcC0 || side == XlcGL) { + *outbufptr = *outbufptr & GL; + } else if (side == XlcC1 || side == XlcGR) { + *outbufptr = *outbufptr | GR; + } + + outbufptr++; + } +} + +/* -------------------------------------------------------------------------- */ +/* Init */ +/* -------------------------------------------------------------------------- */ + +static XlcCharSet default_GL_charset = 0; +static XlcCharSet default_GR_charset = 0; + +static void +init_state( + XlcConv conv) +{ + State state = (State) conv->state; + + /* for CT */ + state->charset = NULL; + state->GL_charset = default_GL_charset; + state->GR_charset = default_GR_charset; + + /* for MB shift state */ + state->GL_codeset = XLC_GENERIC(state->lcd, initial_state_GL); + state->GR_codeset = XLC_GENERIC(state->lcd, initial_state_GR); +} + +/* -------------------------------------------------------------------------- */ +/* Convert */ +/* -------------------------------------------------------------------------- */ + +static int +mbstowcs_org( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned char ch; + unsigned long mb = 0; + wchar_t wc; + + int length = 0, len_left = 0; + int unconv_num = 0; + int num; + + CodeSet codeset = NULL; + + const char *inbufptr; + wchar_t *outbufptr = (wchar_t *) *to; + int from_size = *from_left; + + unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); + + if (from == NULL || *from == NULL) { + _XlcResetConverter(conv); + return( 0 ); + } + + inbufptr = *from; + + while (*from_left && *to_left) { + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + if (outbufptr) {*outbufptr++ = L'\0';} + (*to_left)--; + + /* error check */ + if (len_left) { + unconv_num += (length - len_left); + len_left = 0; + } + + continue; + } + + /* same mb char data */ + if (len_left) + goto output_one_wc; + + /* next mb char data for single shift ? */ + if (mb_parse_table && (num = mb_parse_table[ch]) ) { + codeset = mb_parse_codeset(state, num, &inbufptr, from_left); + if (codeset != NULL) { + length = len_left = codeset->length; + mb = 0; + continue; + } + } + + /* next mb char data for byteM ? */ + if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) + goto next_mb_char; + + /* next mb char data for GL or GR side ? */ + if ((codeset = GLGR_parse_codeset(ch))) + goto next_mb_char; + + /* can't find codeset for the ch */ + unconv_num++; + continue; + +next_mb_char: + length = len_left = codeset->length; + mb = 0; + +output_one_wc: + mb = (mb << 8) | ch; /* 1 byte left shift */ + len_left--; + + /* last of one mb char data */ + if (!len_left) { + gi_to_wc(lcd, mb_to_gi(mb, codeset), codeset, &wc); + if (outbufptr) {*outbufptr++ = wc;} + (*to_left)--; + } + + } /* end of while */ + + /* error check on last char */ + if (len_left) { + inbufptr -= (length - len_left); + (*from_left) += (length - len_left); + unconv_num += (length - len_left); + } + + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +stdc_mbstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const char *src = *((const 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 int +wcstombs_org( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + char *encoding; + unsigned long mb, glyph_index; + wchar_t wc; + + int length; + int unconv_num = 0; + + CodeSet codeset; + + const wchar_t *inbufptr = (const wchar_t *) *from; + char *outbufptr = *to; + int from_size = *from_left; + + const char *default_string = XLC_PUBLIC(lcd, default_string); + int defstr_len = strlen(default_string); + + + while (*from_left && *to_left) { + + wc = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!wc) { + if (outbufptr) {*outbufptr++ = '\0';} + (*to_left)--; + + continue; + } + + /* convert */ + if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { + + /* output default_string of XDefaultString() */ + if (*to_left < defstr_len) + break; + if (outbufptr) { + strncpy((char *)outbufptr, default_string, defstr_len); + outbufptr += defstr_len; + } + (*to_left) -= defstr_len; + + unconv_num++; + + } else { + mb = gi_to_mb(glyph_index, codeset); + if (codeset->parse_info) { + Bool need_shift = False; + switch (codeset->parse_info->type) { + case E_LSL : + if (codeset != state->GL_codeset) { + need_shift = True; + state->GL_codeset = codeset; + } + break; + case E_LSR : + if (codeset != state->GR_codeset) { + need_shift = True; + state->GR_codeset = codeset; + } + break; + /* case E_SS */ + default: + need_shift = True; + } + + /* output shift sequence */ + if (need_shift) { + encoding = codeset->parse_info->encoding; + length = strlen(encoding); + if (*to_left < length) + break; + if (outbufptr) { + strncpy((char *)outbufptr, encoding, length); + outbufptr += length; + } + (*to_left) -= length; + } + } + + /* output characters */ + length = codeset->length; + if (*to_left < length) + break; + + if (outbufptr) { + output_ulong_value(outbufptr, mb, length, XlcNONE); + outbufptr += length; + } + + (*to_left) -= length; + } + + } /* end of while */ + + *from = (XPointer) ((const wchar_t *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +stdc_wcstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const wchar_t *src = *((const 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 int +wcstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned long glyph_index; + wchar_t wc; + + int total_len, seq_len, name_len; + int unconv_num = 0; + Bool first_flag = True, standard_flag; + XlcSide side; + + CodeSet codeset; + XlcCharSet charset, old_charset = NULL; + const char *ct_sequence; + + const wchar_t *inbufptr = (const wchar_t *) *from; + char *outbufptr = *to; + int from_size = *from_left; + char *ext_seg_len = NULL; + + while (*from_left && *to_left) { + + wc = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!wc) { + if (outbufptr) {*outbufptr++ = '\0';} + (*to_left)--; + + continue; + } + + /* convert */ + if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { + unconv_num++; + continue; + } + + /* parse charset */ + if ( !(charset = gi_parse_charset(glyph_index, codeset)) ) { + unconv_num++; + continue; + } + + /* Standard Character Set Encoding ? */ + standard_flag = charset->source == CSsrcStd ? True : False; + + /* + * Non-Standard Character Set Encoding + * + * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ + * | esc sequence | M | L | encoding name | STX | + * +-----+-----+-----+-----+-----+-----+-----+---- ----+-----+-----+ + * 4bytes 1byte 1byte variable length 1byte + * | | + * +-----------------------------------------+ + * name length = ((M - 128) * 128) + (L - 128) + */ + + /* make encoding data */ + ct_sequence = charset->ct_sequence; + side = charset->side; + seq_len = strlen(ct_sequence); + if (standard_flag) { + name_len = 0; + total_len = seq_len; + } else { + name_len = strlen(charset->encoding_name) + 1; + total_len = seq_len + name_len + 2; + } + + /* output escape sequence of CT */ + if ( (charset != old_charset) && + !(first_flag && charset->string_encoding) ){ + + if ( (ext_seg_len != NULL) && outbufptr) { + int i = (outbufptr - ext_seg_len) - 2; + *ext_seg_len++ = i / 128 + 128; + *ext_seg_len = i % 128 + 128; + ext_seg_len = NULL; + } + + if (*to_left < total_len + 1) { + unconv_num++; + break; + } + + if (outbufptr) { + strcpy((char *)outbufptr, ct_sequence); + outbufptr += seq_len; + + if (!standard_flag) { + const char *i = charset->encoding_name; + ext_seg_len = outbufptr; + outbufptr += 2; + for (; *i ; i++) + *outbufptr++ = ((*i >= 'A') && (*i <= 'Z')) ? + *i - 'A' + 'a' : *i; + *outbufptr++ = STX; + } + } + + (*to_left) -= total_len; + + first_flag = False; + old_charset = charset; + } + + /* output glyph index */ + if (codeset->ctconv) + glyph_index = conv_to_dest(codeset->ctconv, glyph_index); + if (*to_left < charset->char_size) { + unconv_num++; + break; + } + + if (outbufptr) { + output_ulong_value(outbufptr, glyph_index, charset->char_size, side); + outbufptr += charset->char_size; + } + + (*to_left) -= charset->char_size; + + } /* end of while */ + + if ( (ext_seg_len != NULL) && outbufptr) { + int i = (outbufptr - ext_seg_len) - 2; + *ext_seg_len++ = i / 128 + 128; + *ext_seg_len = i % 128 + 128; + } + + *from = (XPointer) ((const wchar_t *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +stdc_wcstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left) * MB_CUR_MAX; + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = stdc_wcstombs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = buf_ptr1 - buf_ptr2; + + unconv_num2 = mbstocts(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +ctstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned char ch; + unsigned long glyph_index = 0; + wchar_t wc; + + int ctr_seq_len = 0, gi_len_left = 0, gi_len = 0; + int unconv_num = 0; + + CodeSet codeset = NULL; + XlcCharSet charset_tmp; + + const char *inbufptr; + wchar_t *outbufptr = (wchar_t *) *to; + int from_size = *from_left; + + _XlcResetConverter(conv); /* ??? */ + + if (from == NULL || *from == NULL) { + _XlcResetConverter(conv); + return( 0 ); + } + inbufptr = *from; + + while (*from_left && *to_left) { + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + if (outbufptr) {*outbufptr++ = L'\0';} + (*to_left)--; + + /* error check */ + if (gi_len_left) { + unconv_num += (gi_len - gi_len_left); + gi_len_left = 0; + } + + continue; + } + + /* same glyph_index data */ + if (gi_len_left) + goto output_one_wc; + + /* control sequence ? */ + if (ch == CSI) { + if ( !ct_parse_csi(inbufptr - 1, &ctr_seq_len) ) + goto skip_the_seg; + + if (*from_left + 1 < ctr_seq_len) { + inbufptr--; + (*from_left)++; + unconv_num += *from_left; + break; + } + + /* skip the control sequence */ + inbufptr += (ctr_seq_len - 1); + *from_left -= (ctr_seq_len - 1); + + continue; + } + + /* escape sequence ? */ + if (ch == ESC) { + if ( !ct_parse_charset(lcd, + inbufptr - 1, &state->charset, &ctr_seq_len) ) + goto skip_the_seg; + + if (state->charset->side == XlcC0 || + state->charset->side == XlcGL) + { + state->GL_charset = state->charset; + } + else if (state->charset->side == XlcC1 || + state->charset->side == XlcGR) + { + state->GR_charset = state->charset; + } + else if (state->charset->side == XlcGLGR) + { + state->GL_charset = state->charset; + state->GR_charset = state->charset; + } + + if (*from_left + 1 < ctr_seq_len) { + inbufptr--; + (*from_left)++; + unconv_num += *from_left; + break; + } + + /* skip the escape sequence */ + inbufptr += (ctr_seq_len - 1); + *from_left -= (ctr_seq_len - 1); + + continue; + } + + /* check current state */ + if (isleftside(ch)) + state->charset = state->GL_charset; + else + state->charset = state->GR_charset; + + gi_len = gi_len_left = state->charset->char_size; + glyph_index = 0; + +output_one_wc: + if (state->charset->side == XlcC1 || state->charset->side == XlcGR) + glyph_index = (glyph_index << 8) | (ch & GL); + else + glyph_index = (glyph_index << 8) | ch; + + gi_len_left--; + + /* last of one glyph_index data */ + if (!gi_len_left) { + + /* segment conversion */ + charset_tmp = state->charset; + segment_conversion(lcd, &charset_tmp, &glyph_index); + + /* get codeset */ + if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, + &codeset, &glyph_index) ) { + unconv_num += gi_len; + continue; + } + + /* convert glyph index to wicd char */ + gi_to_wc(lcd, glyph_index, codeset, &wc); + if (outbufptr) {*outbufptr++ = wc;} + (*to_left)--; + } + + continue; + +skip_the_seg: + /* skip until next escape or control sequence */ + while ( *from_left ) { + ch = *inbufptr++; + (*from_left)--; + unconv_num++; + + if (ch == ESC || ch == CSI) { + inbufptr--; + (*from_left)++; + unconv_num--; + break; + } + } + + if ( !(*from_left) ) + break; + + } /* end of while */ + + /* error check on last char */ + if (gi_len_left) { + inbufptr -= (gi_len - gi_len_left); + (*from_left) += (gi_len - gi_len_left); + unconv_num += (gi_len - gi_len_left); + } + + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +cstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned char ch; + unsigned long glyph_index = 0; + wchar_t wc; + int gi_len_left = 0, gi_len = 0; + + int unconv_num = 0; + + CodeSet codeset = NULL; + XlcCharSet charset, charset_tmp; + + const char *inbufptr; + wchar_t *outbufptr = (wchar_t *) *to; + int from_size = *from_left; + + if (from == NULL || *from == NULL) { + return( 0 ); + } + + inbufptr = *from; + + charset = (XlcCharSet) args[0]; + + while (*from_left && *to_left) { + + if (!gi_len_left) { + gi_len_left = gi_len = charset->char_size; + glyph_index = 0; + } + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + if (outbufptr) {*outbufptr++ = L'\0';} + (*to_left)--; + + /* error check */ + if (gi_len_left) { + unconv_num += (gi_len - gi_len_left); + gi_len_left = 0; + } + continue; + } + + if (charset->side == XlcC1 || charset->side == XlcGR) + glyph_index = (glyph_index << 8) | (ch & GL); + else + glyph_index = (glyph_index << 8) | ch; + + gi_len_left--; + + /* last of one glyph_index data */ + if (!gi_len_left) { + + /* segment conversion */ + charset_tmp = charset; + segment_conversion(lcd, &charset_tmp, &glyph_index); + + /* get codeset */ + if ( !_XlcGetCodeSetFromCharSet(lcd, charset_tmp, + &codeset, &glyph_index) ) { + unconv_num += gi_len; + continue; + } + + /* convert glyph index to wicd char */ + gi_to_wc(lcd, glyph_index, codeset, &wc); + if (outbufptr) {*outbufptr++ = wc;} + (*to_left)--; + } + + } /* end of while */ + + /* error check on last char */ + if (gi_len_left) { + inbufptr -= (gi_len - gi_len_left); + (*from_left) += (gi_len - gi_len_left); + unconv_num += (gi_len - gi_len_left); + } + + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +stdc_ctstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left) * MB_CUR_MAX; + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = ctstombs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = buf_ptr1 - buf_ptr2; + + unconv_num2 = stdc_mbstowcs(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +stdc_cstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left) * MB_CUR_MAX; + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = cstombs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = buf_ptr1 - buf_ptr2; + + unconv_num2 = stdc_mbstowcs(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +mbstocts( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left); + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = mbstowcs_org(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); + + unconv_num2 += wcstocts(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +mbstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned char ch; + unsigned long mb = 0; + + int length = 0, len_left = 0; + int unconv_num = 0; + int num; + + CodeSet codeset = NULL; + + const char *inbufptr; + char *outbufptr = *to; + int from_size = *from_left; + + unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); + + if (from == NULL || *from == NULL) { + _XlcResetConverter(conv); + return( 0 ); + } + + inbufptr = *from; + + while (*from_left && *to_left) { + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + if (outbufptr) {*outbufptr++ = '\0';} + (*to_left)--; + + /* error check */ + if (len_left) { + unconv_num += (length - len_left); + len_left = 0; + } + + continue; + } + + /* same mb char data */ + if (len_left) + goto output_one_mb; + + /* next mb char data for single shift ? */ + if (mb_parse_table && (num = mb_parse_table[ch]) ) { + codeset = mb_parse_codeset(state, num, &inbufptr, from_left); + if (codeset != NULL) { + length = len_left = codeset->length; + mb = 0; + continue; + } + } + + /* next char data : byteM ? */ + if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) + goto next_mb_char; + + /* next char data : GL or GR side ? */ + if ((codeset = GLGR_parse_codeset(ch))) + goto next_mb_char; + + /* can't find codeset for the ch */ + unconv_num++; + continue; + +next_mb_char: + length = len_left = codeset->length; + mb = 0; + +output_one_mb: + mb = (mb << 8) | ch; /* 1 byte left shift */ + len_left--; + + /* last of one mb char data */ + if (!len_left) { + if (check_string_encoding(codeset)) { + if (outbufptr) {*outbufptr++ = mb & 0xff;} + (*to_left)--; + } else { + unconv_num++; + } + } + + } /* end of while */ + + /* error check on last char */ + if (len_left) { + inbufptr -= (length - len_left); + (*from_left) += (length - len_left); + unconv_num += (length - len_left); + } + + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +mbtocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned char ch; + unsigned long mb = 0; + unsigned long glyph_index; + + int length = 0, len_left = 0, char_len; + int unconv_num = 0; + int num; + XlcSide side; + + CodeSet codeset = NULL; + XlcCharSet charset = NULL; + + const char *inbufptr; + char *outbufptr = *to; + int from_size = *from_left; + + unsigned char *mb_parse_table = XLC_GENERIC(lcd, mb_parse_table); + + if (from == NULL || *from == NULL) { + _XlcResetConverter(conv); + return( 0 ); + } + + inbufptr = *from; + + while (*from_left && *to_left) { + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + unconv_num = 1; + if (len_left) + unconv_num += (length - len_left); + break; + } + + /* same mb char data */ + if (len_left) + goto output; + + /* next mb char data for single shift ? */ + if (mb_parse_table && (num = mb_parse_table[ch]) ) { + codeset = mb_parse_codeset(state, num, &inbufptr, from_left); + if (codeset != NULL) { + length = len_left = codeset->length; + mb = 0; + continue; + } + } + + /* next mb char data for byteM ? */ + if ((codeset = byteM_parse_codeset(lcd, (inbufptr - 1)))) + goto next_mb_char; + + /* next mb char data for GL or GR side ? */ + if ((codeset = GLGR_parse_codeset(ch))) + goto next_mb_char; + + /* can't find codeset for the ch */ + unconv_num = 1; + break; + +next_mb_char: + length = len_left = codeset->length; + mb = 0; + +output: + mb = (mb << 8) | ch; /* 1 byte left shift */ + len_left--; + + /* last of one mb char data */ + if (!len_left) { + glyph_index = mb_to_gi(mb, codeset); + if (!(charset = gi_parse_charset(glyph_index, codeset))) { + unconv_num = length; + break; + } + char_len = charset->char_size; + side = charset->side; + + /* output glyph index */ + if (codeset->ctconv) + glyph_index = conv_to_dest(codeset->ctconv, glyph_index); + if (*to_left < char_len) { + unconv_num = length; + break; + } + + if (outbufptr) { + output_ulong_value(outbufptr, glyph_index, char_len, side); + outbufptr += char_len; + } + + (*to_left) -= char_len; + + break; + } + + } /* end of while */ + + /* error end */ + if (unconv_num) { + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + return -1; + } + + /* normal end */ + *from = (XPointer) inbufptr; + *to = (XPointer) outbufptr; + + if (num_args > 0) + *((XlcCharSet *) args[0]) = charset; + + return 0; +} + +static int +mbstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + int ret; + XlcCharSet charset_old, charset = NULL; + XPointer tmp_args[1]; + + const char *inbufptr; + int in_left; + char *outbufptr; + int out_left; + tmp_args[0] = (XPointer) &charset; + + ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); + charset_old = charset; + + while ( ret == 0 && *from_left && *to_left) { + inbufptr = *from; + in_left = *from_left; + outbufptr = *to; + out_left = *to_left; + ret = mbtocs(conv, from, from_left, to, to_left, tmp_args, 1); + if (charset_old != charset) { + *from = (XPointer) inbufptr; + *from_left = in_left; + *to = (XPointer) outbufptr; + *to_left = out_left; + break; + } + } + + if (num_args > 0) + *((XlcCharSet *) args[0]) = charset_old; + + /* error end */ + if (ret != 0) + return( -1 ); + + return(0); +} + +static int +wcstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + char *encoding; + unsigned long mb, glyph_index; + wchar_t wc; + + int length; + int unconv_num = 0; + + CodeSet codeset; + + const wchar_t *inbufptr = (const wchar_t *) *from; + char *outbufptr = *to; + int from_size = *from_left; + + const char *default_string = XLC_PUBLIC(lcd, default_string); + int defstr_len = strlen(default_string); + + while (*from_left && *to_left) { + + wc = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!wc) { + if (outbufptr) {*outbufptr++ = '\0';} + (*to_left)--; + + continue; + } + + /* convert */ + if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { + + /* output default_string of XDefaultString() */ + if (*to_left < defstr_len) + break; + if (outbufptr) { + strncpy((char *)outbufptr, default_string, defstr_len); + outbufptr += defstr_len; + } + (*to_left) -= defstr_len; + + unconv_num++; + + } else { + mb = gi_to_mb(glyph_index, codeset); + + if (check_string_encoding(codeset)) { + if (codeset->parse_info) { + Bool need_shift = False; + switch (codeset->parse_info->type) { + case E_LSL : + if (codeset != state->GL_codeset) { + need_shift = True; + state->GL_codeset = codeset; + } + break; + case E_LSR : + if (codeset != state->GR_codeset) { + need_shift = True; + state->GR_codeset = codeset; + } + break; + /* case E_SS */ + default: + need_shift = True; + } + + /* output shift sequence */ + if (need_shift) { + encoding = codeset->parse_info->encoding; + length = strlen(encoding); + if (*to_left < length) + break; + + if (outbufptr) { + strncpy((char *)outbufptr, encoding, length); + outbufptr += length; + } + (*to_left) -= length; + } + } + + /* output characters */ + length = codeset->length; + if (*to_left < length) + break; + + if (outbufptr) { + output_ulong_value(outbufptr, mb, length, XlcNONE); + outbufptr += length; + } + + (*to_left) -= length; + } else { + unconv_num++; + } + } + + } /* end of while */ + + *from = (XPointer) ((const wchar_t *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +stdc_wcstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left) * MB_CUR_MAX; + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = stdc_wcstombs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = buf_ptr1 - buf_ptr2; + + unconv_num2 = mbstostr(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +wctocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + wchar_t wc; + unsigned long glyph_index; + + int char_len; + int unconv_num = 0; + XlcSide side; + + CodeSet codeset; + XlcCharSet charset = NULL; + + const wchar_t *inbufptr = (const wchar_t *) *from; + char *outbufptr = *to; + int from_size = *from_left; + + if (*from_left && *to_left) { + + wc = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!wc) { + unconv_num = 1; + goto end; + } + + /* convert */ + if ( !wc_to_gi(lcd, wc, &glyph_index, &codeset) ) { + unconv_num = 1; + goto end; + } + + if ( !(charset = gi_parse_charset(glyph_index, codeset)) ) { + unconv_num = 1; + goto end; + } + char_len = charset->char_size; + side = charset->side; + + /* output glyph index */ + if (codeset->ctconv) + glyph_index = conv_to_dest(codeset->ctconv, glyph_index); + if (*to_left < char_len) { + unconv_num++; + goto end; + } + + if (outbufptr) { + output_ulong_value(outbufptr, glyph_index, char_len, side); + outbufptr += char_len; + } + + (*to_left) -= char_len; + + } + +end: + + /* error end */ + if (unconv_num) { + *from = (XPointer) ((const wchar_t *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + return -1; + } + + /* normal end */ + *from = (XPointer) inbufptr; + *to = (XPointer) outbufptr; + + if (num_args > 0) + *((XlcCharSet *) args[0]) = charset; + + return 0; +} + +static int +stdc_wctocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const wchar_t *src = *((const wchar_t **) from); + wchar_t wch; + XPointer tmp_from, save_from = *from; + char tmp[32]; + int length, ret, src_left = *from_left; + int from_size = *from_left; + + if (src_left > 0 && *to_left > 0) { + if ((wch = *src)) { + length = wctomb(tmp, wch); + } else { + goto end; + } + + if (length < 0) + goto end; + + tmp_from = (XPointer) tmp; + ret = mbtocs(conv, &tmp_from, &length, to, to_left, args, num_args); + if (ret < 0) + goto end; + + src++; + src_left--; + } + +end: + /* error end */ + if (save_from == (XPointer) src) { + *from = (XPointer) ((const wchar_t *) *from + from_size); + *from_left = 0; + return -1; + } + + /* normal end */ + *from = (XPointer) src; + *from_left = src_left; + + return 0; +} + +static int +wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + int ret; + XlcCharSet charset_old, charset = NULL; + XPointer tmp_args[1]; + + const wchar_t *inbufptr; + int in_left; + XPointer outbufptr; + int out_left; + tmp_args[0] = (XPointer) &charset; + + ret = wctocs(conv, from, from_left, to, to_left, tmp_args, 1); + charset_old = charset; + + while ( ret == 0 && *from_left && *to_left) { + inbufptr = (const wchar_t *) *from; + in_left = *from_left; + outbufptr = *to; + out_left = *to_left; + ret = wctocs(conv, from, from_left, to, to_left, tmp_args, 1); + if (charset_old != charset) { + *from = (XPointer) inbufptr; + *from_left = in_left; + *to = (XPointer) outbufptr; + *to_left = out_left; + break; + } + } + + if (num_args > 0) + *((XlcCharSet *) args[0]) = charset_old; + + /* error end */ + if (ret != 0) + return( -1 ); + + return(0); +} + +#ifdef STDCVT + +static int +stdc_wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + int ret; + XlcCharSet charset_old, charset = NULL; + XPointer tmp_args[1]; + + const wchar_t *inbufptr; + int in_left; + XPointer outbufptr; + int out_left; + tmp_args[0] = (XPointer) &charset; + + ret = stdc_wctocs(conv, from, from_left, to, to_left, tmp_args, 1); + charset_old = charset; + + while ( ret == 0 && *from_left && *to_left ) { + inbufptr = (const wchar_t *) *from; + in_left = *from_left; + outbufptr = *to; + out_left = *to_left; + ret = stdc_wctocs(conv, from, from_left, to, to_left, tmp_args, 1); + if (charset_old != charset) { + *from = (XPointer) inbufptr; + *from_left = in_left; + *to = (XPointer) outbufptr; + *to_left = out_left; + break; + } + } + + if (num_args > 0) + *((XlcCharSet *) args[0]) = charset_old; + + /* error end */ + if (ret != 0) + return( -1 ); + + return(0); +} + +#endif + +static int +ctstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left); + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = ctstowcs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); + + unconv_num2 += wcstombs_org(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +cstombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * sizeof(wchar_t)); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left); + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = cstowcs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = (buf_ptr1 - buf_ptr2) / sizeof(wchar_t); + + unconv_num2 += wcstombs_org(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +static int +strtombs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + char *encoding; + unsigned long mb, glyph_index; + unsigned char ch; + + int length; + int unconv_num = 0; + + CodeSet codeset; + + const char *inbufptr = *from; + char *outbufptr = *to; + int from_size = *from_left; + + while (*from_left && *to_left) { + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + if (outbufptr) {*outbufptr++ = '\0';} + (*to_left)--; + + continue; + } + + /* convert */ + if (isleftside(ch)) { + glyph_index = ch; + codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GL"); + } else { + glyph_index = ch & GL; + codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GR"); + } + + if (!codeset) { + unconv_num++; + continue; + } + + mb = gi_to_mb(glyph_index, codeset); + if (codeset->parse_info) { + Bool need_shift = False; + switch (codeset->parse_info->type) { + case E_LSL : + if (codeset != state->GL_codeset) { + need_shift = True; + state->GL_codeset = codeset; + } + break; + case E_LSR : + if (codeset != state->GR_codeset) { + need_shift = True; + state->GR_codeset = codeset; + } + break; + /* case E_SS */ + default: + need_shift = True; + } + + /* output shift sequence */ + if (need_shift) { + encoding = codeset->parse_info->encoding; + length = strlen(encoding); + if (*to_left < length) + break; + if (outbufptr) { + strncpy((char *)outbufptr, encoding, length); + outbufptr += length; + } + (*to_left) -= length; + } + } + + /* output characters */ + length = codeset->length; + if (*to_left < length) + break; + + if (outbufptr) { + output_ulong_value(outbufptr, mb, length, XlcNONE); + outbufptr += length; + } + + (*to_left) -= length; + + } /* end of while */ + + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +strtowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XLCd lcd = state->lcd; + + unsigned char ch; + unsigned long glyph_index; + wchar_t wc; + + int unconv_num = 0; + CodeSet codeset; + + const char *inbufptr = *from; + wchar_t *outbufptr = (wchar_t *)*to; + int from_size = *from_left; + + while (*from_left && *to_left) { + + ch = *inbufptr++; + (*from_left)--; + + /* null ? */ + if (!ch) { + if (outbufptr) {*outbufptr++ = L'\0';} + (*to_left)--; + + continue; + } + + /* convert */ + if (isleftside(ch)) { + glyph_index = ch; + codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GL"); + } else { + glyph_index = ch & GL; + codeset = _XlcGetCodeSetFromName(lcd, "ISO8859-1:GR"); + } + + if (!codeset) { + unconv_num++; + continue; + } + + gi_to_wc(lcd, glyph_index, codeset, &wc); + if (outbufptr) {*outbufptr++ = wc;} + (*to_left)--; + + } /* end of while */ + + *from = (XPointer) ((const char *) *from + from_size); + *from_left = 0; + *to = (XPointer) outbufptr; + + return unconv_num; +} + +static int +stdc_strtowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer buf = Xmalloc((*from_left) * MB_CUR_MAX); + char *buf_ptr1 = buf; + int buf_left1 = (*from_left) * MB_CUR_MAX; + char *buf_ptr2 = buf_ptr1; + int buf_left2; + int unconv_num1 = 0, unconv_num2 = 0; + + unconv_num1 = strtombs(conv, + from, from_left, &buf_ptr1, &buf_left1, args, num_args); + if (unconv_num1 < 0) + goto ret; + + buf_left2 = buf_ptr1 - buf_ptr2; + + unconv_num2 = stdc_mbstowcs(conv, + &buf_ptr2, &buf_left2, to, to_left, args, num_args); + if (unconv_num2 < 0) + goto ret; + +ret: + Xfree(buf); + + return (unconv_num1 + unconv_num2); +} + +/* -------------------------------------------------------------------------- */ +/* Close */ +/* -------------------------------------------------------------------------- */ + +static void +close_converter( + XlcConv conv) +{ + Xfree(conv->state); + Xfree(conv->methods); + Xfree(conv); +} + +/* -------------------------------------------------------------------------- */ +/* Open */ +/* -------------------------------------------------------------------------- */ + +static XlcConv +create_conv( + XLCd lcd, + XlcConvMethods methods) +{ + XlcConv conv; + State state; + + conv = Xcalloc(1, sizeof(XlcConvRec)); + if (conv == NULL) + return (XlcConv) NULL; + + conv->methods = Xmalloc(sizeof(XlcConvMethodsRec)); + if (conv->methods == NULL) + goto err; + *conv->methods = *methods; + conv->methods->reset = init_state; + + conv->state = Xcalloc(1, sizeof(StateRec)); + if (conv->state == NULL) + goto err; + + state = (State) conv->state; + state->lcd = lcd; + + _XlcResetConverter(conv); + + return conv; + +err: + close_converter(conv); + + return (XlcConv) NULL; +} + +static XlcConvMethodsRec mbstocts_methods = { + close_converter, + mbstocts, + NULL +}; + +static XlcConv +open_mbstocts( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstocts_methods); +} + +static XlcConvMethodsRec mbstostr_methods = { + close_converter, + mbstostr, + NULL +}; + +static XlcConv +open_mbstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstostr_methods); +} + +static XlcConvMethodsRec mbstocs_methods = { + close_converter, + mbstocs, + NULL +}; + +static XlcConv +open_mbstocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstocs_methods); +} + +static XlcConvMethodsRec mbtocs_methods = { + close_converter, + mbtocs, + NULL +}; + +static XlcConv +open_mbtocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbtocs_methods); +} + +static XlcConvMethodsRec ctstombs_methods = { + close_converter, + ctstombs, + NULL +}; + +static XlcConv +open_ctstombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &ctstombs_methods); +} + +static XlcConvMethodsRec cstombs_methods = { + close_converter, + cstombs, + NULL +}; + +static XlcConv +open_cstombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &cstombs_methods); +} + +static XlcConvMethodsRec strtombs_methods = { + close_converter, + strtombs, + NULL +}; + +static XlcConv +open_strtombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &strtombs_methods); +} + +#ifdef STDCVT + +static XlcConvMethodsRec stdc_mbstowcs_methods = { + close_converter, + stdc_mbstowcs, + NULL +}; + +static XlcConv +open_stdc_mbstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_mbstowcs_methods); +} + +static XlcConvMethodsRec stdc_wcstombs_methods = { + close_converter, + stdc_wcstombs, + NULL +}; + +static XlcConv +open_stdc_wcstombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_wcstombs_methods); +} + +static XlcConvMethodsRec stdc_wcstocts_methods = { + close_converter, + stdc_wcstocts, + NULL +}; + +static XlcConv +open_stdc_wcstocts( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_wcstocts_methods); +} + +static XlcConvMethodsRec stdc_wcstostr_methods = { + close_converter, + stdc_wcstostr, + NULL +}; + +static XlcConv +open_stdc_wcstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_wcstostr_methods); +} + +static XlcConvMethodsRec stdc_wcstocs_methods = { + close_converter, + stdc_wcstocs, + NULL +}; + +static XlcConv +open_stdc_wcstocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_wcstocs_methods); +} + +static XlcConvMethodsRec stdc_wctocs_methods = { + close_converter, + stdc_wctocs, + NULL +}; + +static XlcConv +open_stdc_wctocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_wctocs_methods); +} + +static XlcConvMethodsRec stdc_ctstowcs_methods = { + close_converter, + stdc_ctstowcs, + NULL +}; + +static XlcConv +open_stdc_ctstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_ctstowcs_methods); +} + +static XlcConvMethodsRec stdc_cstowcs_methods = { + close_converter, + stdc_cstowcs, + NULL +}; + +static XlcConv +open_stdc_cstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_cstowcs_methods); +} + +static XlcConvMethodsRec stdc_strtowcs_methods = { + close_converter, + stdc_strtowcs, + NULL +}; + +static XlcConv +open_stdc_strtowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &stdc_strtowcs_methods); +} + +#endif /* STDCVT */ + +static XlcConvMethodsRec mbstowcs_methods = { + close_converter, + mbstowcs_org, + NULL +}; + +static XlcConv +open_mbstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &mbstowcs_methods); +} + +static XlcConvMethodsRec wcstombs_methods = { + close_converter, + wcstombs_org, + NULL +}; + +static XlcConv +open_wcstombs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstombs_methods); +} + +static XlcConvMethodsRec wcstocts_methods = { + close_converter, + wcstocts, + NULL +}; + +static XlcConv +open_wcstocts( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstocts_methods); +} + +static XlcConvMethodsRec wcstostr_methods = { + close_converter, + wcstostr, + NULL +}; + +static XlcConv +open_wcstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstostr_methods); +} + +static XlcConvMethodsRec wcstocs_methods = { + close_converter, + wcstocs, + NULL +}; + +static XlcConv +open_wcstocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wcstocs_methods); +} + +static XlcConvMethodsRec wctocs_methods = { + close_converter, + wctocs, + NULL +}; + +static XlcConv +open_wctocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &wctocs_methods); +} + +static XlcConvMethodsRec ctstowcs_methods = { + close_converter, + ctstowcs, + NULL +}; + +static XlcConv +open_ctstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &ctstowcs_methods); +} + +static XlcConvMethodsRec cstowcs_methods = { + close_converter, + cstowcs, + NULL +}; + +static XlcConv +open_cstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &cstowcs_methods); +} + +static XlcConvMethodsRec strtowcs_methods = { + close_converter, + strtowcs, + NULL +}; + +static XlcConv +open_strtowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &strtowcs_methods); +} + +/* -------------------------------------------------------------------------- */ +/* Loader */ +/* -------------------------------------------------------------------------- */ + +XLCd +_XlcGenericLoader( + const char *name) +{ + XLCd lcd; +#ifdef STDCVT + XLCdGenericPart *gen; +#endif + + lcd = _XlcCreateLC(name, _XlcGenericMethods); + + if (lcd == NULL) + return lcd; + + default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); + default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); + + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCompoundText, open_mbstocts); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_mbstostr); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_mbstocs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_mbtocs); + _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNMultiByte, open_ctstombs); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtombs); + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstombs); + +#ifdef STDCVT + gen = XLC_GENERIC_PART(lcd); + + if (gen->use_stdc_env != True) { +#endif + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_mbstowcs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstombs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_wcstocts); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wctocs); + _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_ctstowcs); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); +#ifdef STDCVT + } +#endif + +#ifdef STDCVT + if (gen->use_stdc_env == True) { + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_stdc_mbstowcs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_stdc_wcstombs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCompoundText, open_stdc_wcstocts); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_stdc_wcstostr); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_stdc_wcstocs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_stdc_wctocs); + _XlcSetConverter(lcd, XlcNCompoundText, lcd, XlcNWideChar, open_stdc_ctstowcs); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_stdc_strtowcs); + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_stdc_cstowcs); + } +#endif + + _XlcAddUtf8Converters(lcd); + + return lcd; +} diff --git a/nx-X11/lib/modules/om/Makefile.am b/nx-X11/lib/modules/om/Makefile.am new file mode 100644 index 000000000..b564eeefd --- /dev/null +++ b/nx-X11/lib/modules/om/Makefile.am @@ -0,0 +1 @@ +SUBDIRS = generic diff --git a/nx-X11/lib/modules/om/generic/Makefile.am b/nx-X11/lib/modules/om/generic/Makefile.am new file mode 100644 index 000000000..5e4bbc2ec --- /dev/null +++ b/nx-X11/lib/modules/om/generic/Makefile.am @@ -0,0 +1,36 @@ +NULL = + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(MALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +noinst_LTLIBRARIES = libxomGeneric.la + +xomGeneric_la_SOURCES = \ + omDefault.c \ + omGeneric.c \ + omImText.c \ + omText.c \ + omTextEsc.c \ + omTextExt.c \ + omTextPer.c \ + omXChar.c \ + $(NULL) + +libxomGeneric_la_SOURCES = $(xomGeneric_la_SOURCES) diff --git a/nx-X11/lib/modules/om/generic/omDefault.c b/nx-X11/lib/modules/om/generic/omDefault.c new file mode 100644 index 000000000..134ef461a --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omDefault.c @@ -0,0 +1,449 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * (c) Copyright 1995 FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" +#include +#include +#include + +#define DefineLocalBuf char local_buf[BUFSIZ] +#define AllocLocalBuf(length) (length > BUFSIZ ? (char *)Xmalloc(length) : local_buf) +#define FreeLocalBuf(ptr) if (ptr != local_buf) Xfree(ptr) + +static Bool +wcs_to_mbs( + XOC oc, + char *to, + _Xconst wchar_t *from, + int length) +{ + XlcConv conv; + int to_left, ret; + + conv = _XomInitConverter(oc, XOMWideChar); + if (conv == NULL) + return False; + + to_left = length; + ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, + &to_left, NULL, 0); + if (ret != 0 || length > 0) + return False; + + return True; +} + +static Bool +utf8_to_mbs( + XOC oc, + char *to, + _Xconst char *from, + int length) +{ + XlcConv conv; + int to_left, ret; + + conv = _XomInitConverter(oc, XOMUtf8String); + if (conv == NULL) + return False; + + to_left = length; + ret = _XlcConvert(conv, (XPointer *) &from, &length, (XPointer *) &to, + &to_left, NULL, 0); + if (ret != 0 || length > 0) + return False; + + return True; +} + +int +_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length) +{ + return XTextWidth(*oc->core.font_info.font_struct_list, text, length); +} + +int +_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + int ret; + + if (buf == NULL) + return 0; + + if (wcs_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultTextEscapement(oc, buf, length); + +err: + FreeLocalBuf(buf); + + return ret; +} + +int +_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + int ret; + + if (buf == NULL) + return 0; + + if (utf8_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultTextEscapement(oc, buf, length); + +err: + FreeLocalBuf(buf); + + return ret; +} + +int +_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical) +{ + int direction, logical_ascent, logical_descent; + XCharStruct overall; + + XTextExtents(*oc->core.font_info.font_struct_list, text, length, &direction, + &logical_ascent, &logical_descent, &overall); + + if (overall_ink) { + overall_ink->x = overall.lbearing; + overall_ink->y = -(overall.ascent); + overall_ink->width = overall.rbearing - overall.lbearing; + overall_ink->height = overall.ascent + overall.descent; + } + + if (overall_logical) { + overall_logical->x = 0; + overall_logical->y = -(logical_ascent); + overall_logical->width = overall.width; + overall_logical->height = logical_ascent + logical_descent; + } + + return overall.width; +} + +int +_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + int ret; + + if (buf == NULL) + return 0; + + if (wcs_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); + +err: + FreeLocalBuf(buf); + + return ret; +} + +int +_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + int ret; + + if (buf == NULL) + return 0; + + if (utf8_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultTextExtents(oc, buf, length, overall_ink, overall_logical); + +err: + FreeLocalBuf(buf); + + return ret; +} + +Status +_XmbDefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + XFontStruct *font = *oc->core.font_info.font_struct_list; + XCharStruct *def, *cs, overall; + Bool first = True; + + if (buf_size < length) + return 0; + + bzero((char *) &overall, sizeof(XCharStruct)); + *num_chars = 0; + + CI_GET_DEFAULT_INFO_1D(font, def) + + while (length-- > 0) { + CI_GET_CHAR_INFO_1D(font, *text, def, cs) + text++; + if (cs == NULL) + continue; + + ink_buf->x = overall.width + cs->lbearing; + ink_buf->y = -(cs->ascent); + ink_buf->width = cs->rbearing - cs->lbearing; + ink_buf->height = cs->ascent + cs->descent; + ink_buf++; + + logical_buf->x = overall.width; + logical_buf->y = -(font->ascent); + logical_buf->width = cs->width; + logical_buf->height = font->ascent + font->descent; + logical_buf++; + + if (first) { + overall = *cs; + first = False; + } else { + overall.ascent = max(overall.ascent, cs->ascent); + overall.descent = max(overall.descent, cs->descent); + overall.lbearing = min(overall.lbearing, overall.width + + cs->lbearing); + overall.rbearing = max(overall.rbearing, overall.width + + cs->rbearing); + overall.width += cs->width; + } + + (*num_chars)++; + } + + if (overall_ink) { + overall_ink->x = overall.lbearing; + overall_ink->y = -(overall.ascent); + overall_ink->width = overall.rbearing - overall.lbearing; + overall_ink->height = overall.ascent + overall.descent; + } + + if (overall_logical) { + overall_logical->x = 0; + overall_logical->y = -(font->ascent); + overall_logical->width = overall.width; + overall_logical->height = font->ascent + font->descent; + } + + return 1; +} + +Status +_XwcDefaultTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + Status ret; + + if (buf == NULL) + return 0; + + if (wcs_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, + buf_size, num_chars, overall_ink, + overall_logical); + +err: + FreeLocalBuf(buf); + + return ret; +} + +Status +_Xutf8DefaultTextPerCharExtents(XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + Status ret; + + if (buf == NULL) + return 0; + + if (utf8_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultTextPerCharExtents(oc, buf, length, ink_buf, logical_buf, + buf_size, num_chars, overall_ink, + overall_logical); + +err: + FreeLocalBuf(buf); + + return ret; +} + +int +_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length) +{ + XFontStruct *font = *oc->core.font_info.font_struct_list; + + XSetFont(dpy, gc, font->fid); + XDrawString(dpy, d, gc, x, y, text, length); + + return XTextWidth(font, text, length); +} + +int +_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst wchar_t *text, int length) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + int ret; + + if (buf == NULL) + return 0; + + if (wcs_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); + +err: + FreeLocalBuf(buf); + + return ret; +} + +int +_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + int ret; + + if (buf == NULL) + return 0; + + if (utf8_to_mbs(oc, buf, text, length) == False) { + ret = 0; + goto err; + } + + ret = _XmbDefaultDrawString(dpy, d, oc, gc, x, y, buf, length); + +err: + FreeLocalBuf(buf); + + return ret; +} + +void +_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length) +{ + XSetFont(dpy, gc, (*oc->core.font_info.font_struct_list)->fid); + XDrawImageString(dpy, d, gc, x, y, text, length); +} + +void +_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst wchar_t *text, int length) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + + if (buf == NULL) + return; + + if (wcs_to_mbs(oc, buf, text, length) == False) + goto err; + + _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); + +err: + FreeLocalBuf(buf); +} + +void +_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length) +{ + DefineLocalBuf; + char *buf = AllocLocalBuf(length); + + if (buf == NULL) + return; + + if (utf8_to_mbs(oc, buf, text, length) == False) + goto err; + + _XmbDefaultDrawImageString(dpy, d, oc, gc, x, y, buf, length); + +err: + FreeLocalBuf(buf); +} diff --git a/nx-X11/lib/modules/om/generic/omGeneric.c b/nx-X11/lib/modules/om/generic/omGeneric.c new file mode 100644 index 000000000..68eec01c0 --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omGeneric.c @@ -0,0 +1,2100 @@ +/* #define FONTDEBUG */ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Takanori Tateno FUJITSU LIMITED + * + */ + +/* + * Fixed the algorithms in parse_fontname() and parse_fontdata() + * to improve the logic for determining which font should be + * returned for a given CharSet. We even added some comments + * so that you can figure out what in the heck we're doing. We + * realize this is a departure from the norm, but hey, we're + * rebels! :-) :-) + * + * Modifiers: Jeff Walls, Paul Anderson: HEWLETT-PACKARD + */ +/* + * Cleaned up mess, removed some blabla + * Egbert Eich, SuSE Linux AG + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" +#include "XlcGeneric.h" +#include +#include +#include +#include +#include + +#define MAXFONTS 100 +#define PIXEL_SIZE_FIELD 7 +#define POINT_SIZE_FIELD 8 +#define CHARSET_ENCODING_FIELD 14 +#define XLFD_MAX_LEN 255 + +/* For VW/UDC start */ + +static FontData +init_fontdata( + FontData font_data, + int font_data_count) +{ + FontData fd; + int i; + + fd = Xcalloc(font_data_count, sizeof(FontDataRec)); + if(fd == (FontData) NULL) + return False; + + for(i = 0 ; i < font_data_count ; i++) + fd[i] = font_data[i]; + + return fd; +} + +static VRotate +init_vrotate( + FontData font_data, + int font_data_count, + int type, + CodeRange code_range, + int code_range_num) +{ + VRotate vrotate; + int i; + + if(type == VROTATE_NONE) + return (VRotate)NULL; + + vrotate = Xcalloc(font_data_count, sizeof(VRotateRec)); + if(vrotate == (VRotate) NULL) + return False; + + for(i = 0 ; i < font_data_count ; i++) { + vrotate[i].charset_name = font_data[i].name; + vrotate[i].side = font_data[i].side; + if(type == VROTATE_PART) { + vrotate[i].num_cr = code_range_num; + vrotate[i].code_range = code_range; + } + } + + return vrotate; +} + +static Bool +init_fontset( + XOC oc) +{ + XOCGenericPart *gen; + FontSet font_set; + OMData data; + int count; + + count = XOM_GENERIC(oc->core.om)->data_num; + data = XOM_GENERIC(oc->core.om)->data; + + font_set = Xcalloc(count, sizeof(FontSetRec)); + if (font_set == NULL) + return False; + + gen = XOC_GENERIC(oc); + gen->font_set_num = count; + gen->font_set = font_set; + + for ( ; count-- > 0; data++, font_set++) { + font_set->charset_count = data->charset_count; + font_set->charset_list = data->charset_list; + + if((font_set->font_data = init_fontdata(data->font_data, + data->font_data_count)) == NULL) + goto err; + font_set->font_data_count = data->font_data_count; + if((font_set->substitute = init_fontdata(data->substitute, + data->substitute_num)) == NULL) + goto err; + font_set->substitute_num = data->substitute_num; + if((font_set->vmap = init_fontdata(data->vmap, + data->vmap_num)) == NULL) + goto err; + font_set->vmap_num = data->vmap_num; + + if(data->vrotate_type != VROTATE_NONE) { + /* A vrotate member is specified primary font data */ + /* as initial value. */ + if((font_set->vrotate = init_vrotate(data->font_data, + data->font_data_count, + data->vrotate_type, + data->vrotate, + data->vrotate_num)) == NULL) + goto err; + font_set->vrotate_num = data->font_data_count; + } + } + return True; + +err: + + Xfree(font_set->font_data); + Xfree(font_set->substitute); + Xfree(font_set->vmap); + Xfree(font_set->vrotate); + Xfree(font_set); + gen->font_set = (FontSet) NULL; + gen->font_set_num = 0; + return False; +} + +/* For VW/UDC end */ + +static char * +get_prop_name( + Display *dpy, + XFontStruct *fs) +{ + unsigned long fp; + + if (XGetFontProperty(fs, XA_FONT, &fp)) + return XGetAtomName(dpy, fp); + + return (char *) NULL; +} + +/* For VW/UDC start */ + +static Bool +load_fontdata( + XOC oc, + FontData font_data, + int font_data_num) +{ + Display *dpy = oc->core.om->core.display; + FontData fd = font_data; + + if(font_data == NULL) return(True); + for( ; font_data_num-- ; fd++) { + if(fd->xlfd_name != (char *) NULL && fd->font == NULL) { + fd->font = XLoadQueryFont(dpy, fd->xlfd_name); + if (fd->font == NULL){ + return False; + } + } + } + return True; +} + +static Bool +load_fontset_data( + XOC oc, + FontSet font_set) +{ + Display *dpy = oc->core.om->core.display; + + if(font_set->font_name == (char *)NULL) return False ; + + /* If font_set->font is not NULL, it contains the *best* + * match font for this FontSet. + * -- jjw/pma (HP) + */ + if(font_set->font == NULL) { + font_set->font = XLoadQueryFont(dpy, font_set->font_name); + if (font_set->font == NULL){ + return False; + } + } + return True; +} + +static Bool +load_font( + XOC oc) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set = gen->font_set; + int num = gen->font_set_num; + + for ( ; num-- > 0; font_set++) { + if (font_set->font_name == NULL) + continue; + + if (load_fontset_data (oc, font_set) != True) + return False; +#ifndef TESTVERSION + if(load_fontdata(oc, font_set->font_data, + font_set->font_data_count) != True) + return False; + + if(load_fontdata(oc, font_set->substitute, + font_set->substitute_num) != True) + return False; +#endif + +/* Add 1996.05.20 */ + if( oc->core.orientation == XOMOrientation_TTB_RTL || + oc->core.orientation == XOMOrientation_TTB_LTR ){ + if (font_set->vpart_initialize == 0) { + load_fontdata(oc, font_set->vmap, font_set->vmap_num); + load_fontdata(oc, (FontData) font_set->vrotate, + font_set->vrotate_num); + font_set->vpart_initialize = 1; + } + } + + if (font_set->font->min_byte1 || font_set->font->max_byte1) + font_set->is_xchar2b = True; + else + font_set->is_xchar2b = False; + } + + return True; +} + +/* For VW/UDC end */ + +static Bool +load_font_info( + XOC oc) +{ + Display *dpy = oc->core.om->core.display; + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set = gen->font_set; + char **fn_list; + int fn_num, num = gen->font_set_num; + + for ( ; num-- > 0; font_set++) { + if (font_set->font_name == NULL) + continue; + + if (font_set->info == NULL) { + fn_list = XListFontsWithInfo(dpy, font_set->font_name, 1, &fn_num, + &font_set->info); + if (font_set->info == NULL) + return False; + + XFreeFontNames(fn_list); + } + } + + return True; +} + +/* For Vertical Writing start */ + +static void +check_fontset_extents( + XCharStruct *overall, + int *logical_ascent, + int *logical_descent, + XFontStruct *font) +{ + overall->lbearing = min(overall->lbearing, font->min_bounds.lbearing); + overall->rbearing = max(overall->rbearing, font->max_bounds.rbearing); + overall->ascent = max(overall->ascent, font->max_bounds.ascent); + overall->descent = max(overall->descent, font->max_bounds.descent); + overall->width = max(overall->width, font->max_bounds.width); + *logical_ascent = max(*logical_ascent, font->ascent); + *logical_descent = max(*logical_descent, font->descent); +} + +/* For Vertical Writing end */ + +static void +set_fontset_extents( + XOC oc) +{ + XRectangle *ink = &oc->core.font_set_extents.max_ink_extent; + XRectangle *logical = &oc->core.font_set_extents.max_logical_extent; + XFontStruct **font_list, *font; + XCharStruct overall; + int logical_ascent, logical_descent; + int num = oc->core.font_info.num_font; + + font_list = oc->core.font_info.font_struct_list; + font = *font_list++; + overall = font->max_bounds; + overall.lbearing = font->min_bounds.lbearing; + logical_ascent = font->ascent; + logical_descent = font->descent; + + /* For Vertical Writing start */ + + while (--num > 0) { + font = *font_list++; + check_fontset_extents(&overall, &logical_ascent, &logical_descent, + font); + } + + { + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set = gen->font_set; + FontData font_data; + int font_set_num = gen->font_set_num; + int font_data_count; + + for( ; font_set_num-- ; font_set++) { + if(font_set->vmap_num > 0) { + font_data = font_set->vmap; + font_data_count = font_set->vmap_num; + for( ; font_data_count-- ; font_data++) { + if(font_data->font != NULL) { + check_fontset_extents(&overall, &logical_ascent, + &logical_descent, + font_data->font); + } + } + } + + if(font_set->vrotate_num > 0 && font_set->vrotate != NULL) { + font_data = (FontData) font_set->vrotate; + font_data_count = font_set->vrotate_num; + for( ; font_data_count-- ; font_data++) { + if(font_data->font != NULL) { + check_fontset_extents(&overall, &logical_ascent, + &logical_descent, + font_data->font); + } + } + } + } + } + + /* For Vertical Writing start */ + + ink->x = overall.lbearing; + ink->y = -(overall.ascent); + ink->width = overall.rbearing - overall.lbearing; + ink->height = overall.ascent + overall.descent; + + logical->x = 0; + logical->y = -(logical_ascent); + logical->width = overall.width; + logical->height = logical_ascent + logical_descent; +} + +static Bool +init_core_part( + XOC oc) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + int font_set_num; + XFontStruct **font_struct_list; + char **font_name_list, *font_name_buf; + int count, length; + + font_set = gen->font_set; + font_set_num = gen->font_set_num; + count = length = 0; + + for ( ; font_set_num-- > 0; font_set++) { + if (font_set->font_name == NULL) + continue; + + length += strlen(font_set->font_name) + 1; + + count++; + } + if (count == 0) + return False; + + font_struct_list = Xmalloc(sizeof(XFontStruct *) * count); + if (font_struct_list == NULL) + return False; + + font_name_list = Xmalloc(sizeof(char *) * count); + if (font_name_list == NULL) + goto err; + + font_name_buf = Xmalloc(length); + if (font_name_buf == NULL) + goto err; + + oc->core.font_info.num_font = count; + oc->core.font_info.font_name_list = font_name_list; + oc->core.font_info.font_struct_list = font_struct_list; + + font_set = gen->font_set; + font_set_num = gen->font_set_num; + + for (count = 0; font_set_num-- > 0; font_set++) { + if (font_set->font_name == NULL) + continue; + + font_set->id = count; + if (font_set->font) + *font_struct_list++ = font_set->font; + else + *font_struct_list++ = font_set->info; + strcpy(font_name_buf, font_set->font_name); + Xfree(font_set->font_name); + *font_name_list++ = font_set->font_name = font_name_buf; + font_name_buf += strlen(font_name_buf) + 1; + + count++; + } + + set_fontset_extents(oc); + + return True; + +err: + + Xfree(font_name_list); + Xfree(font_struct_list); + + return False; +} + +static char * +get_font_name( + XOC oc, + char *pattern) +{ + char **list, *name; + int count = 0; + + list = XListFonts(oc->core.om->core.display, pattern, 1, &count); + if (list == NULL) + return NULL; + + name = strdup(*list); + + XFreeFontNames(list); + + return name; +} + +/* For VW/UDC start*/ + +static char * +get_rotate_fontname( + char *font_name) +{ + char *pattern = NULL, *ptr = NULL; + char *fields[CHARSET_ENCODING_FIELD]; + char str_pixel[32], str_point[4]; + char *rotate_font_ptr = NULL; + int pixel_size = 0; + int field_num = 0, len = 0; + + if(font_name == (char *) NULL || (len = strlen(font_name)) <= 0 + || len > XLFD_MAX_LEN) + return NULL; + + pattern = strdup(font_name); + if(!pattern) + return NULL; + + memset(fields, 0, sizeof(char *) * 14); + ptr = pattern; + while(isspace(*ptr)) { + ptr++; + } + if(*ptr == '-') + ptr++; + + for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && ptr && *ptr ; + ptr++, field_num++) { + fields[field_num] = ptr; + + if((ptr = strchr(ptr, '-'))) { + *ptr = '\0'; + } else { + field_num++; /* Count last field */ + break; + } + } + + if(field_num < CHARSET_ENCODING_FIELD) + goto free_pattern; + + /* Pixel Size field : fields[6] */ + for(ptr = fields[PIXEL_SIZE_FIELD - 1] ; ptr && *ptr; ptr++) { + if(!isdigit(*ptr)) { + if(*ptr == '['){ /* 960730 */ + strcpy(pattern, font_name); + return(pattern); + } + goto free_pattern; + } + } + pixel_size = atoi(fields[PIXEL_SIZE_FIELD - 1]); + snprintf(str_pixel, sizeof(str_pixel), + "[ 0 ~%d %d 0 ]", pixel_size, pixel_size); + fields[6] = str_pixel; + + /* Point Size field : fields[7] */ + strcpy(str_point, "*"); + fields[POINT_SIZE_FIELD - 1] = str_point; + + len = 0; + for (field_num = 0; field_num < CHARSET_ENCODING_FIELD && + fields[field_num]; field_num++) { + len += 1 + strlen(fields[field_num]); + } + + /* Max XLFD length is 255 */ + if (len > XLFD_MAX_LEN) + goto free_pattern; + + rotate_font_ptr = Xmalloc(len + 1); + if(!rotate_font_ptr) + goto free_pattern; + + rotate_font_ptr[0] = '\0'; + + for(field_num = 0 ; field_num < CHARSET_ENCODING_FIELD && + fields[field_num] ; field_num++) { + strcat(rotate_font_ptr, "-"); + strcat(rotate_font_ptr, fields[field_num]); + } + +free_pattern: + Xfree(pattern); + + return rotate_font_ptr; +} + +static Bool +is_match_charset( + FontData font_data, + char *font_name) +{ + char *last; + int length, name_len; + + name_len = strlen(font_name); + last = font_name + name_len; + + length = strlen(font_data->name); + if (length > name_len) + return False; + + if (_XlcCompareISOLatin1(last - length, font_data->name) == 0) + return True; + + return False; +} + +static int +parse_all_name( + XOC oc, + FontData font_data, + char *pattern) +{ + +#ifdef OLDCODE + if(is_match_charset(font_data, pattern) != True) + return False; + + font_data->xlfd_name = strdup(pattern); + if(font_data->xlfd_name == NULL) + return (-1); + + return True; +#else /* OLDCODE */ + Display *dpy = oc->core.om->core.display; + char **fn_list = NULL, *prop_fname = NULL; + int list_num; + XFontStruct *fs_list; + if(is_match_charset(font_data, pattern) != True) { + /* + * pattern should not contain any wildcard (execpt '?') + * this was probably added to make this case insensitive. + */ + if ((fn_list = XListFontsWithInfo(dpy, pattern, + MAXFONTS, + &list_num, &fs_list)) == NULL) { + return False; + } + /* shouldn't we loop here ? */ + else if ((prop_fname = get_prop_name(dpy, fs_list)) == NULL) { + XFreeFontInfo(fn_list, fs_list, list_num); + return False; + } + else if ((is_match_charset(font_data, prop_fname) != True)) { + XFree(prop_fname); + XFreeFontInfo(fn_list, fs_list, list_num); + return False; + } + else { + font_data->xlfd_name = prop_fname; + XFreeFontInfo(fn_list, fs_list, list_num); + return True; + } + } + + font_data->xlfd_name = strdup(pattern); + if(font_data->xlfd_name == NULL) + return (-1); + + return True; +#endif /* OLDCODE */ +} + +static int +parse_omit_name( + XOC oc, + FontData font_data, + char *pattern) +{ + char* last = (char *) NULL; + char* base_name; + char buf[XLFD_MAX_LEN + 1]; + int length = 0; + int num_fields; + /* + * If the font specified by "pattern" is expandable to be + * a member of "font_data"'s FontSet, we've found a match. + */ + if(is_match_charset(font_data, pattern) == True) { + if ((font_data->xlfd_name = get_font_name(oc, pattern)) != NULL) { + return True; + } + } + + length = strlen (pattern); + + if (length > XLFD_MAX_LEN) + return -1; + + strcpy(buf, pattern); + last = buf + length - 1; + + /* Replace the original encoding with the encoding for this FontSet. */ + + /* Figure out how many fields have been specified in this xlfd. */ + for (num_fields = 0, base_name = buf; *base_name != '\0'; base_name++) + if (*base_name == '-') num_fields++; + + switch (num_fields) { + case 12: + /* This is the best way to have specifed the fontset. In this + * case, there is no original encoding. E.g., + * -*-*-*-*-*-*-14-*-*-*-*-* + * To this, we'll append a dash: + * -*-*-*-*-*-*-14-*-*-*-*-*- + * then append the encoding to get: + * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 + */ + /* + * Take care of: + * -*-*-*-*-*-*-14-*-*-*-*- + */ + if (*(last) == '-') + *++last = '*'; + + *++last = '-'; + break; + case 13: + /* Got the charset, not the encoding, zap the charset In this + * case, there is no original encoding, but there is a charset. E.g., + * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990 + * To this, we remove the charset: + * -*-*-*-*-*-*-14-*-*-*-*-*- + * then append the new encoding to get: + * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 + */ + last = strrchr (buf, '-'); + num_fields = 12; + break; + case 14: + /* Both the charset and the encoding are specified. Get rid + * of them so that we can append the new charset encoding. E.g., + * -*-*-*-*-*-*-14-*-*-*-*-*-jisx0212.1990-0 + * To this, we'll remove the encoding and charset to get: + * -*-*-*-*-*-*-14-*-*-*-*-*- + * then append the new encoding to get: + * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 + */ + last = strrchr (buf, '-'); + *last = '\0'; + last = strrchr (buf, '-'); + num_fields = 12; + break; + default: + if (*last != '-') + *++last = '-'; + break; + } + + /* At this point, "last" is pointing to the last "-" in the + * xlfd, and all xlfd's at this point take a form similar to: + * -*-*-*-*-*-*-14-*-*-*-*-*- + * (i.e., no encoding). + * After the strcpy, we'll end up with something similar to: + * -*-*-*-*-*-*-14-*-*-*-*-*-JISX0208.1990-0 + * + * If the modified font is found in the current FontSet, + * we've found a match. + */ + + last++; + + if ((last - buf) + strlen(font_data->name) > XLFD_MAX_LEN) + return -1; + + strcpy(last, font_data->name); + if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) + return True; + + /* This may mot be needed anymore as XListFonts() takes care of this */ + if (num_fields < 12) { + if ((last - buf) > (XLFD_MAX_LEN - 2)) + return -1; + *last = '*'; + *(last + 1) = '-'; + strcpy(last + 2, font_data->name); + num_fields++; + last+=2; + if ((font_data->xlfd_name = get_font_name(oc, buf)) != NULL) + return True; + } + + + return False; +} + + +typedef enum{C_PRIMARY, C_SUBSTITUTE, C_VMAP, C_VROTATE } ClassType; + +static int +parse_fontdata( + XOC oc, + FontSet font_set, + FontData font_data, + int font_data_count, + char **name_list, + int name_list_count, + ClassType class, + FontDataRec *font_data_return) +{ + + char **cur_name_list = name_list; + char *font_name = (char *) NULL; + char *pattern = (char *) NULL; + int found_num = 0, ret = 0; + int count = name_list_count; + + if(name_list == NULL || count <= 0) { + return False; + } + + if(font_data == NULL || font_data_count <= 0) { + return False; + } + + /* Loop through each font encoding defined in the "font_data" FontSet. */ + for ( ; font_data_count-- > 0; font_data++) { + Bool is_found = False; + font_name = (char *) NULL; + count = name_list_count; + cur_name_list = name_list; + + /* + * Loop through each font specified by the user + * in the call to XCreateFontset(). + */ + while (count-- > 0) { + pattern = *cur_name_list++; + if (pattern == NULL || *pattern == '\0') + continue; +#ifdef FONTDEBUG + fprintf(stderr,"Font pattern: %s %s\n", + pattern,font_data->name); +#endif + + /* + * If the current font is fully specified (i.e., the + * xlfd contains no wildcards) and the font exists on + * the X Server, we have a match. + */ + if (strchr(pattern, '*') == NULL && + (font_name = get_font_name(oc, pattern))) { + /* + * Find the full xlfd name for this font. If the font is + * already in xlfd format, it is simply returned. If the + * font is an alias for another font, the xlfd of the + * aliased font is returned. + */ + ret = parse_all_name(oc, font_data, font_name); + Xfree(font_name); + + if (ret == -1) return -1; + if (ret == False) continue; + /* + * Since there was an exact match of a fully-specified font + * or a font alias, we can return now since the desired font + * was found for the current font encoding for this FontSet. + * + * Previous implementations of this algorithm would + * not return here. Instead, they continued searching + * through the font encodings for this FontSet. The side-effect + * of that behavior is you may return a "substitute" match + * instead of an "exact" match. We believe there should be a + * preference on exact matches. Therefore, as soon as we + * find one, we bail. + * + * Also, previous implementations seemed to think it was + * important to find either a primary or substitute font + * for each Font encoding in the FontSet before returning an + * acceptable font. We don't believe this is necessary. + * All the client cares about is finding a reasonable font + * for what was passed in. If we find an exact match, + * there's no reason to look any further. + * + * -- jjw/pma (HP) + */ + if (font_data_return) { + font_data_return->xlfd_name = strdup(font_data->xlfd_name); + if (!font_data_return->xlfd_name) return -1; + + font_data_return->side = font_data->side; + } +#ifdef FONTDEBUG + fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name); +#endif + + return True; + } + /* + * If the font name is not fully specified + * (i.e., it has wildcards), we have more work to do. + * See the comments in parse_omit_name() + * for the list of things to do. + */ + ret = parse_omit_name(oc, font_data, pattern); + + if (ret == -1) return -1; + if (ret == False) continue; + + /* + * A font which matched the wild-carded specification was found. + * Only update the return data if a font has not yet been found. + * This maintains the convention that FontSets listed higher in + * a CodeSet in the Locale Database have higher priority than + * those FontSets listed lower in the CodeSet. In the following + * example: + * + * fs1 { + * charset HP-JIS:GR + * font JISX0208.1990-0:GL;\ + * JISX0208.1990-1:GR;\ + * JISX0208.1983-0:GL;\ + * JISX0208.1983-1:GR + * } + * + * a font found in the JISX0208.1990-0 FontSet will have a + * higher priority than a font found in the JISX0208.1983-0 + * FontSet. + */ + if (font_data_return && font_data_return->xlfd_name == NULL) { + +#ifdef FONTDEBUG + fprintf(stderr,"XLFD name: %s\n",font_data->xlfd_name); +#endif + font_data_return->xlfd_name = strdup(font_data->xlfd_name); + if (!font_data_return->xlfd_name) return -1; + + font_data_return->side = font_data->side; + } + + found_num++; + is_found = True; + + break; + } + + switch(class) { + case C_PRIMARY: + if(is_found == False) { + /* + * Did not find a font for the current FontSet. Check the + * FontSet's "substitute" font for a match. If we find a + * match, we'll keep searching in hopes of finding an exact + * match later down the FontSet list. + * + * when we return and we have found a font font_data_return + * contains the first (ie. best) match no matter if this + * is a C_PRIMARY or a C_SUBSTITUTE font + */ + ret = parse_fontdata(oc, font_set, font_set->substitute, + font_set->substitute_num, name_list, + name_list_count, C_SUBSTITUTE, + font_data_return); + if (ret == -1) return -1; + if (ret == False) continue; + + found_num++; + is_found = True; + } +#ifdef TESTVERSION + else + return True; +#endif + break; + + case C_SUBSTITUTE: + case C_VMAP: + if(is_found == True) + return True; + break; + + case C_VROTATE: + if(is_found == True) { + char *rotate_name; + + if((rotate_name = get_rotate_fontname(font_data->xlfd_name)) + != NULL) { + Xfree(font_data->xlfd_name); + font_data->xlfd_name = rotate_name; + + return True; + } + Xfree(font_data->xlfd_name); + font_data->xlfd_name = NULL; + return False; + } + break; + } + } + + if(class == C_PRIMARY && found_num >= 1) + return True; + + return False; +} + + +static int +parse_vw( + XOC oc, + FontSet font_set, + char **name_list, + int count) +{ + FontData vmap = font_set->vmap; + VRotate vrotate = font_set->vrotate; + int vmap_num = font_set->vmap_num; + int vrotate_num = font_set->vrotate_num; + int ret = 0, i = 0; + + if(vmap_num > 0) { + if(parse_fontdata(oc, font_set, vmap, vmap_num, name_list, + count, C_VMAP,NULL) == -1) + return (-1); + } + + if(vrotate_num > 0) { + ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, + name_list, count, C_VROTATE, NULL); + if(ret == -1) { + return (-1); + } else if(ret == False) { + CodeRange code_range; + int num_cr; + int sub_num = font_set->substitute_num; + + code_range = vrotate[0].code_range; /* ? */ + num_cr = vrotate[0].num_cr; /* ? */ + for(i = 0 ; i < vrotate_num ; i++) { + if(vrotate[i].xlfd_name) + Xfree(vrotate[i].xlfd_name); + } + Xfree(vrotate); + + if(sub_num > 0) { + vrotate = font_set->vrotate = Xcalloc(sub_num, + sizeof(VRotateRec)); + if(font_set->vrotate == (VRotate)NULL) + return (-1); + + for(i = 0 ; i < sub_num ; i++) { + vrotate[i].charset_name = font_set->substitute[i].name; + vrotate[i].side = font_set->substitute[i].side; + vrotate[i].code_range = code_range; + vrotate[i].num_cr = num_cr; + } + vrotate_num = font_set->vrotate_num = sub_num; + } else { + vrotate = font_set->vrotate = (VRotate)NULL; + } + + ret = parse_fontdata(oc, font_set, (FontData) vrotate, vrotate_num, + name_list, count, C_VROTATE, NULL); + if(ret == -1) + return (-1); + } + } + + return True; +} + +static int +parse_fontname( + XOC oc) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + FontDataRec font_data_return; + char *base_name, **name_list; + int font_set_num = 0; + int found_num = 0; + int count = 0; + int ret; + int i; + + name_list = _XParseBaseFontNameList(oc->core.base_name_list, &count); + if (name_list == NULL) + return -1; + + font_set = gen->font_set; + font_set_num = gen->font_set_num; + + /* Loop through all of the CharSets defined in the Locale + * database for the current Locale. + */ + for( ; font_set_num-- > 0 ; font_set++) { + if(font_set->font_name) + continue; + + if(font_set->font_data_count > 0) { + + /* + * If there are a non-zero number of FontSets defined + * for this CharSet. + * Try to find a font for this CharSet. If we find an + * acceptable font, we save the information for return + * to the client. If we do not find an acceptable font, + * a "missing_charset" will be reported to the client + * for this CharSet. + */ + font_data_return.xlfd_name = NULL; + font_data_return.side = XlcUnknown; + + ret = parse_fontdata(oc, font_set, font_set->font_data, + font_set->font_data_count, + name_list, count, C_PRIMARY, + &font_data_return); + if(ret == -1) { + goto err; + } else if(ret == True) { + /* + * We can't just loop thru fontset->font_data to + * find the first (ie. best) match: parse_fontdata + * will try a substitute font if no primary one could + * be matched. It returns the required information in + * font_data_return. + */ + font_set->font_name = strdup(font_data_return.xlfd_name); + if(font_set->font_name == (char *) NULL) + goto err; + + font_set->side = font_data_return.side; + + Xfree (font_data_return.xlfd_name); + font_data_return.xlfd_name = NULL; + + if(parse_vw(oc, font_set, name_list, count) == -1) + goto err; + found_num++; + } + + } else if(font_set->substitute_num > 0) { + /* + * If there are no FontSets defined for this + * CharSet. We can only find "substitute" fonts. + */ + ret = parse_fontdata(oc, font_set, font_set->substitute, + font_set->substitute_num, + name_list, count, C_SUBSTITUTE, NULL); + if(ret == -1) { + goto err; + } else if(ret == True) { + for(i=0;isubstitute_num;i++){ + if(font_set->substitute[i].xlfd_name != NULL){ + break; + } + } + font_set->font_name = strdup(font_set->substitute[i].xlfd_name); + if(font_set->font_name == (char *) NULL) + goto err; + + font_set->side = font_set->substitute[i].side; + if(parse_vw(oc, font_set, name_list, count) == -1) + goto err; + + found_num++; + } + } + } + + base_name = strdup(oc->core.base_name_list); + if (base_name == NULL) + goto err; + + oc->core.base_name_list = base_name; + + XFreeStringList(name_list); + + return found_num; + +err: + XFreeStringList(name_list); + /* Prevent this from being freed twice */ + oc->core.base_name_list = NULL; + + return -1; +} + +/* For VW/UDC end*/ + +static Bool +set_missing_list( + XOC oc) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + char **charset_list, *charset_buf; + int count, length, font_set_num; + int result = 1; + + font_set = gen->font_set; + font_set_num = gen->font_set_num; + count = length = 0; + + for ( ; font_set_num-- > 0; font_set++) { + if (font_set->info || font_set->font) { + continue; + } + + /* Change 1996.01.23 start */ + if(font_set->font_data_count <= 0 || + font_set->font_data == (FontData)NULL) { + if(font_set->substitute_num <= 0 || + font_set->substitute == (FontData)NULL) { + if(font_set->charset_list != NULL){ + length += + strlen(font_set->charset_list[0]->encoding_name) + 1; + } else { + length += 1; + } + } else { + length += strlen(font_set->substitute->name) + 1; + } + } else { + length += strlen(font_set->font_data->name) + 1; + } + /* Change 1996.01.23 end */ + count++; + } + + if (count < 1) { + return True; + } + + charset_list = Xmalloc(sizeof(char *) * count); + if (charset_list == NULL) { + return False; + } + + charset_buf = Xmalloc(length); + if (charset_buf == NULL) { + Xfree(charset_list); + return False; + } + + oc->core.missing_list.charset_list = charset_list; + oc->core.missing_list.charset_count = count; + + font_set = gen->font_set; + font_set_num = gen->font_set_num; + + for ( ; font_set_num-- > 0; font_set++) { + if (font_set->info || font_set->font) { + continue; + } + + /* Change 1996.01.23 start */ + if(font_set->font_data_count <= 0 || + font_set->font_data == (FontData)NULL) { + if(font_set->substitute_num <= 0 || + font_set->substitute == (FontData)NULL) { + if(font_set->charset_list != NULL){ + strcpy(charset_buf, + font_set->charset_list[0]->encoding_name); + } else { + strcpy(charset_buf, ""); + } + result = 0; + } else { + strcpy(charset_buf, font_set->substitute->name); + } + } else { + strcpy(charset_buf, font_set->font_data->name); + } + /* Change 1996.01.23 end */ + *charset_list++ = charset_buf; + charset_buf += strlen(charset_buf) + 1; + } + + if(result == 0) { + return(False); + } + + return True; +} + +static Bool +create_fontset( + XOC oc) +{ + XOMGenericPart *gen = XOM_GENERIC(oc->core.om); + int found_num; + + if (init_fontset(oc) == False) + return False; + + found_num = parse_fontname(oc); + if (found_num <= 0) { + if (found_num == 0) + set_missing_list(oc); + return False; + } + + if (gen->on_demand_loading == True) { + if (load_font_info(oc) == False) + return False; + } else { + if (load_font(oc) == False) + return False; + } + + if (init_core_part(oc) == False) + return False; + + if (set_missing_list(oc) == False) + return False; + + return True; +} + +/* For VW/UDC start */ +static void +free_fontdataOC( + Display *dpy, + FontData font_data, + int font_data_count) +{ + for( ; font_data_count-- ; font_data++) { + if(font_data->xlfd_name){ + Xfree(font_data->xlfd_name); + font_data->xlfd_name = NULL; + } + if(font_data->font){ /* ADD 1996.01.7 */ + if(font_data->font->fid) /* Add 1996.01.23 */ + XFreeFont(dpy,font_data->font); /* ADD 1996.01.7 */ + else /* Add 1996.01.23 */ + XFreeFontInfo(NULL, font_data->font, 1);/* Add 1996.01.23 */ + font_data->font = NULL; + } +/* + * font_data->name and font_data->scopes belong to the OM not OC. + * To save space this data is shared between OM and OC. We are + * not allowed to free it here. + * It has been moved to free_fontdataOM() + */ +/* + if(font_data->scopes){ + Xfree(font_data->scopes); + font_data->scopes = NULL; + } + if(font_data->name){ + Xfree(font_data->name); + font_data->name = NULL; + } +*/ + } +} + +static void destroy_fontdata( + XOCGenericPart *gen, + Display *dpy) +{ + FontSet font_set = (FontSet) NULL; + int font_set_num = 0; + + if (gen->font_set) { + font_set = gen->font_set; + font_set_num = gen->font_set_num; + for( ; font_set_num-- ; font_set++) { + if (font_set->font) { + if(font_set->font->fid) + XFreeFont(dpy,font_set->font); + else + XFreeFontInfo(NULL, font_set->font, 1); + font_set->font = NULL; + } + if(font_set->font_data) { + if (font_set->info) + XFreeFontInfo(NULL, font_set->info, 1); + free_fontdataOC(dpy, + font_set->font_data, font_set->font_data_count); + Xfree(font_set->font_data); + font_set->font_data = NULL; + } + if(font_set->substitute) { + free_fontdataOC(dpy, + font_set->substitute, font_set->substitute_num); + Xfree(font_set->substitute); + font_set->substitute = NULL; + } + if(font_set->vmap) { + free_fontdataOC(dpy, + font_set->vmap, font_set->vmap_num); + Xfree(font_set->vmap); + font_set->vmap = NULL; + } + if(font_set->vrotate) { + free_fontdataOC(dpy, + (FontData)font_set->vrotate, + font_set->vrotate_num); + Xfree(font_set->vrotate); + font_set->vrotate = NULL; + } + } + Xfree(gen->font_set); + gen->font_set = NULL; + } +} +/* For VW/UDC end */ + +static void +destroy_oc( + XOC oc) +{ + Display *dpy = oc->core.om->core.display; + XOCGenericPart *gen = XOC_GENERIC(oc); + + if (gen->mbs_to_cs) + _XlcCloseConverter(gen->mbs_to_cs); + + if (gen->wcs_to_cs) + _XlcCloseConverter(gen->wcs_to_cs); + + if (gen->utf8_to_cs) + _XlcCloseConverter(gen->utf8_to_cs); + +/* For VW/UDC start */ /* Change 1996.01.8 */ + destroy_fontdata(gen,dpy); +/* +*/ +/* For VW/UDC end */ + + Xfree(oc->core.base_name_list); + XFreeStringList(oc->core.font_info.font_name_list); + Xfree(oc->core.font_info.font_struct_list); + XFreeStringList(oc->core.missing_list.charset_list); + +#ifdef notdef + + Xfree(oc->core.res_name); + Xfree(oc->core.res_class); +#endif + + Xfree(oc); +} + +static char * +set_oc_values( + XOC oc, + XlcArgList args, + int num_args) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set = gen->font_set; + char *ret; + int num = gen->font_set_num; + + if (oc->core.resources == NULL) + return NULL; + + ret = _XlcSetValues((XPointer) oc, oc->core.resources, + oc->core.num_resources, args, num_args, XlcSetMask); + if(ret != NULL){ + return(ret); + } else { + for ( ; num-- > 0; font_set++) { + if (font_set->font_name == NULL) + continue; + if (font_set->vpart_initialize != 0) + continue; + if( oc->core.orientation == XOMOrientation_TTB_RTL || + oc->core.orientation == XOMOrientation_TTB_LTR ){ + load_fontdata(oc, font_set->vmap, font_set->vmap_num); + load_fontdata(oc, (FontData) font_set->vrotate, + font_set->vrotate_num); + font_set->vpart_initialize = 1; + } + } + return(NULL); + } +} + +static char * +get_oc_values( + XOC oc, + XlcArgList args, + int num_args) +{ + if (oc->core.resources == NULL) + return NULL; + + return _XlcGetValues((XPointer) oc, oc->core.resources, + oc->core.num_resources, args, num_args, XlcGetMask); +} + +static XOCMethodsRec oc_default_methods = { + destroy_oc, + set_oc_values, + get_oc_values, + _XmbDefaultTextEscapement, + _XmbDefaultTextExtents, + _XmbDefaultTextPerCharExtents, + _XmbDefaultDrawString, + _XmbDefaultDrawImageString, + _XwcDefaultTextEscapement, + _XwcDefaultTextExtents, + _XwcDefaultTextPerCharExtents, + _XwcDefaultDrawString, + _XwcDefaultDrawImageString, + _Xutf8DefaultTextEscapement, + _Xutf8DefaultTextExtents, + _Xutf8DefaultTextPerCharExtents, + _Xutf8DefaultDrawString, + _Xutf8DefaultDrawImageString +}; + +static XOCMethodsRec oc_generic_methods = { + destroy_oc, + set_oc_values, + get_oc_values, + _XmbGenericTextEscapement, + _XmbGenericTextExtents, + _XmbGenericTextPerCharExtents, + _XmbGenericDrawString, + _XmbGenericDrawImageString, + _XwcGenericTextEscapement, + _XwcGenericTextExtents, + _XwcGenericTextPerCharExtents, + _XwcGenericDrawString, + _XwcGenericDrawImageString, + _Xutf8GenericTextEscapement, + _Xutf8GenericTextExtents, + _Xutf8GenericTextPerCharExtents, + _Xutf8GenericDrawString, + _Xutf8GenericDrawImageString +}; + +typedef struct _XOCMethodsListRec { + const char *name; + XOCMethods methods; +} XOCMethodsListRec, *XOCMethodsList; + +static XOCMethodsListRec oc_methods_list[] = { + { "default", &oc_default_methods }, + { "generic", &oc_generic_methods } +}; + +static XlcResource oc_resources[] = { + { XNBaseFontName, NULLQUARK, sizeof(char *), + XOffsetOf(XOCRec, core.base_name_list), XlcCreateMask | XlcGetMask }, + { XNOMAutomatic, NULLQUARK, sizeof(Bool), + XOffsetOf(XOCRec, core.om_automatic), XlcGetMask }, + { XNMissingCharSet, NULLQUARK, sizeof(XOMCharSetList), + XOffsetOf(XOCRec, core.missing_list), XlcGetMask }, + { XNDefaultString, NULLQUARK, sizeof(char *), + XOffsetOf(XOCRec, core.default_string), XlcGetMask }, + { XNOrientation, NULLQUARK, sizeof(XOrientation), + XOffsetOf(XOCRec, core.orientation), XlcDefaultMask | XlcSetMask | XlcGetMask }, + { XNResourceName, NULLQUARK, sizeof(char *), + XOffsetOf(XOCRec, core.res_name), XlcSetMask | XlcGetMask }, + { XNResourceClass, NULLQUARK, sizeof(char *), + XOffsetOf(XOCRec, core.res_class), XlcSetMask | XlcGetMask }, + { XNFontInfo, NULLQUARK, sizeof(XOMFontInfo), + XOffsetOf(XOCRec, core.font_info), XlcGetMask } +}; + +static XOC +create_oc( + XOM om, + XlcArgList args, + int num_args) +{ + XOC oc; + XOMGenericPart *gen = XOM_GENERIC(om); + XOCMethodsList methods_list = oc_methods_list; + int count; + + oc = Xcalloc(1, sizeof(XOCGenericRec)); + if (oc == NULL) + return (XOC) NULL; + + 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; + + if (oc->core.base_name_list == NULL) + goto err; + + oc->core.resources = oc_resources; + oc->core.num_resources = XlcNumber(oc_resources); + + if (create_fontset(oc) == False) + goto err; + + oc->methods = &oc_generic_methods; + + if (gen->object_name) { + count = XlcNumber(oc_methods_list); + + for ( ; count-- > 0; methods_list++) { + if (!_XlcCompareISOLatin1(gen->object_name, methods_list->name)) { + oc->methods = methods_list->methods; + break; + } + } + } + + return oc; + +err: + destroy_oc(oc); + + return (XOC) NULL; +} + +static void +free_fontdataOM( + FontData font_data, + int font_data_count) +{ + for( ; font_data_count-- ; font_data++) { + if(font_data->name){ + Xfree(font_data->name); + font_data->name = NULL; + } + if(font_data->scopes){ + Xfree(font_data->scopes); + font_data->scopes = NULL; + } + } +} + +static Status +close_om( + XOM om) +{ + XOMGenericPart *gen = XOM_GENERIC(om); + OMData data; + int count; + + if ((data = gen->data)) { + for (count = gen->data_num; count-- > 0; data++) { + if (data->charset_list){ + Xfree(data->charset_list); + data->charset_list = NULL; + } + /* free font_data for om */ + if (data->font_data) { + free_fontdataOM(data->font_data,data->font_data_count); + Xfree(data->font_data); + data->font_data = NULL; + } + /* free substitute for om */ + if (data->substitute) { + free_fontdataOM(data->substitute,data->substitute_num); + Xfree(data->substitute); + data->substitute = NULL; + } + /* free vmap for om */ + if (data->vmap) { + free_fontdataOM(data->vmap,data->vmap_num); + Xfree(data->vmap); + data->vmap = NULL; + } + /* free vrotate for om */ + if (data->vrotate) { + Xfree(data->vrotate); + data->vrotate = NULL; + } + } + Xfree(gen->data); + gen->data = NULL; + } + + if (gen->object_name){ + Xfree(gen->object_name); + gen->object_name = NULL; + } + + if (om->core.res_name){ + Xfree(om->core.res_name); + om->core.res_name = NULL; + } + if (om->core.res_class){ + Xfree(om->core.res_class); + om->core.res_class = NULL; + } + if (om->core.required_charset.charset_list && + om->core.required_charset.charset_count > 0){ + XFreeStringList(om->core.required_charset.charset_list); + om->core.required_charset.charset_list = NULL; + } else { + Xfree((char*)om->core.required_charset.charset_list); + om->core.required_charset.charset_list = NULL; + } + if (om->core.orientation_list.orientation){ + Xfree(om->core.orientation_list.orientation); + om->core.orientation_list.orientation = NULL; + } + + Xfree(om); + + return 1; +} + +static char * +set_om_values( + XOM om, + XlcArgList args, + int num_args) +{ + if (om->core.resources == NULL) + return NULL; + + return _XlcSetValues((XPointer) om, om->core.resources, + om->core.num_resources, args, num_args, XlcSetMask); +} + +static char * +get_om_values( + XOM om, + XlcArgList args, + int num_args) +{ + if (om->core.resources == NULL) + return NULL; + + return _XlcGetValues((XPointer) om, om->core.resources, + om->core.num_resources, args, num_args, XlcGetMask); +} + +static XOMMethodsRec methods = { + close_om, + set_om_values, + get_om_values, + create_oc +}; + +static XlcResource om_resources[] = { + { XNRequiredCharSet, NULLQUARK, sizeof(XOMCharSetList), + XOffsetOf(XOMRec, core.required_charset), XlcGetMask }, + { XNQueryOrientation, NULLQUARK, sizeof(XOMOrientation), + XOffsetOf(XOMRec, core.orientation_list), XlcGetMask }, + { XNDirectionalDependentDrawing, NULLQUARK, sizeof(Bool), + XOffsetOf(XOMRec, core.directional_dependent), XlcGetMask }, + { XNContextualDrawing, NULLQUARK, sizeof(Bool), + XOffsetOf(XOMRec, core.contextual_drawing), XlcGetMask } +}; + +static XOM +create_om( + XLCd lcd, + Display *dpy, + XrmDatabase rdb, + _Xconst char *res_name, + _Xconst char *res_class) +{ + XOM om; + + om = Xcalloc(1, sizeof(XOMGenericRec)); + if (om == NULL) + return (XOM) NULL; + + om->methods = &methods; + om->core.lcd = lcd; + om->core.display = dpy; + om->core.rdb = rdb; + if (res_name) { + om->core.res_name = strdup(res_name); + if (om->core.res_name == NULL) + goto err; + } + if (res_class) { + om->core.res_class = strdup(res_class); + if (om->core.res_class == NULL) + goto err; + } + + 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); + + return om; + +err: + close_om(om); + + return (XOM) NULL; +} + +static OMData +add_data( + XOM om) +{ + XOMGenericPart *gen = XOM_GENERIC(om); + OMData new; + int num; + + if ((num = gen->data_num)) + new = Xrealloc(gen->data, (num + 1) * sizeof(OMDataRec)); + else + new = Xmalloc(sizeof(OMDataRec)); + + if (new == NULL) + return NULL; + + gen->data_num = num + 1; + gen->data = new; + + new += num; + bzero((char *) new, sizeof(OMDataRec)); + + return new; +} + +/* For VW/UDC */ + +FontData +read_EncodingInfo( + int count, + char **value) +{ + FontData font_data,ret; + char *buf, *bufptr,*scp; + int len, i; + font_data = Xcalloc(count, sizeof(FontDataRec)); + if (font_data == NULL) + return NULL; + + ret = font_data; + for (i = 0; i < count; i++, font_data++) { +/* + strcpy(buf, *value++); +*/ + buf = *value; value++; + if ((bufptr = strchr(buf, ':'))) { + len = (int)(bufptr - buf); + bufptr++ ; + } else + len = strlen(buf); + font_data->name = Xmalloc(len + 1); + if (font_data->name == NULL) { + free_fontdataOM(ret, i + 1); + Xfree(ret); + return NULL; + } + strncpy(font_data->name, buf,len); + font_data->name[len] = 0; + if (bufptr && _XlcCompareISOLatin1(bufptr, "GL") == 0) + font_data->side = XlcGL; + else if (bufptr && _XlcCompareISOLatin1(bufptr, "GR") == 0) + font_data->side = XlcGR; + else + font_data->side = XlcGLGR; + + if (bufptr && (scp = strchr(bufptr, '['))){ + font_data->scopes = _XlcParse_scopemaps(scp,&(font_data->scopes_num)); + } + } + return(ret); +} + +static CodeRange read_vrotate( + int count, + char **value, + int *type, + int *vrotate_num) +{ + CodeRange range; + if(!strcmp(value[0],"all")){ + *type = VROTATE_ALL ; + *vrotate_num = 0 ; + return (NULL); + } else if(*(value[0]) == '['){ + *type = VROTATE_PART ; + range = (CodeRange) _XlcParse_scopemaps(value[0],vrotate_num); + return (range); + } else { + *type = VROTATE_NONE ; + *vrotate_num = 0 ; + return (NULL); + } +} + +static void read_vw( + XLCd lcd, + OMData font_set, + int num) +{ + char **value, buf[BUFSIZ]; + int count; + + snprintf(buf, sizeof(buf), "fs%d.font.vertical_map", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count > 0){ + _XlcDbg_printValue(buf,value,count); + font_set->vmap_num = count; + font_set->vmap = read_EncodingInfo(count,value); + } + + snprintf(buf, sizeof(buf), "fs%d.font.vertical_rotate", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count > 0){ + _XlcDbg_printValue(buf,value,count); + font_set->vrotate = read_vrotate(count,value,&(font_set->vrotate_type), + &(font_set->vrotate_num)); + } +} +/* VW/UDC end */ +static Bool +init_om( + XOM om) +{ + XLCd lcd = om->core.lcd; + XOMGenericPart *gen = XOM_GENERIC(om); + OMData data; + XlcCharSet *charset_list; + FontData font_data; + char **required_list; + XOrientation *orientation; + char **value, buf[BUFSIZ], *bufptr; + int count = 0, num = 0, length = 0; + + _XlcGetResource(lcd, "XLC_FONTSET", "on_demand_loading", &value, &count); + if (count > 0 && _XlcCompareISOLatin1(*value, "True") == 0) + gen->on_demand_loading = True; + + _XlcGetResource(lcd, "XLC_FONTSET", "object_name", &value, &count); + if (count > 0) { + gen->object_name = strdup(*value); + if (gen->object_name == NULL) + return False; + } + + for (num = 0; ; num++) { + + snprintf(buf, sizeof(buf), "fs%d.charset.name", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + + if( count < 1){ + snprintf(buf, sizeof(buf), "fs%d.charset", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) + break; + } + + data = add_data(om); + if (data == NULL) + return False; + + charset_list = Xmalloc(sizeof(XlcCharSet) * count); + if (charset_list == NULL) + return False; + data->charset_list = charset_list; + data->charset_count = count; + + while (count-- > 0){ + *charset_list++ = _XlcGetCharSet(*value++); + } + snprintf(buf, sizeof(buf), "fs%d.charset.udc_area", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if( count > 0){ + UDCArea udc; + int i,flag = 0; + udc = Xmalloc(count * sizeof(UDCAreaRec)); + if (udc == NULL) + return False; + for(i=0;icharset_count;i++){ + if(data->charset_list[i]->udc_area == NULL){ + data->charset_list[i]->udc_area = udc; + data->charset_list[i]->udc_area_num = count; + flag = 1; + } + } + if(flag == 0){ + Xfree(udc); + } + } + + snprintf(buf, sizeof(buf), "fs%d.font.primary", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1){ + snprintf(buf, sizeof(buf), "fs%d.font", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) + return False; + } + + font_data = read_EncodingInfo(count,value); + if (font_data == NULL) + return False; + + data->font_data = font_data; + data->font_data_count = count; + + snprintf(buf, sizeof(buf), "fs%d.font.substitute", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count > 0){ + font_data = read_EncodingInfo(count,value); + if (font_data == NULL) + return False; + data->substitute = font_data; + data->substitute_num = count; + } else { + snprintf(buf, sizeof(buf), "fs%d.font", num); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) { + data->substitute = NULL; + data->substitute_num = 0; + } else { + font_data = read_EncodingInfo(count,value); + data->substitute = font_data; + data->substitute_num = count; + } + } + read_vw(lcd,data,num); + length += strlen(data->font_data->name) + 1; + } + + /* required charset list */ + required_list = Xmalloc(sizeof(char *) * gen->data_num); + if (required_list == NULL) + return False; + + om->core.required_charset.charset_list = required_list; + om->core.required_charset.charset_count = gen->data_num; + + count = gen->data_num; + data = gen->data; + + if (count > 0) { + bufptr = Xmalloc(length); + if (bufptr == NULL) { + Xfree(required_list); + return False; + } + + for ( ; count-- > 0; data++) { + strcpy(bufptr, data->font_data->name); + *required_list++ = bufptr; + bufptr += strlen(bufptr) + 1; + } + } + + /* orientation list */ + orientation = Xmalloc(sizeof(XOrientation) * 2); + if (orientation == NULL) + return False; + + orientation[0] = XOMOrientation_LTR_TTB; + orientation[1] = XOMOrientation_TTB_RTL; + om->core.orientation_list.orientation = orientation; + om->core.orientation_list.num_orientation = 2; + + /* directional dependent drawing */ + om->core.directional_dependent = False; + + /* contexual drawing */ + om->core.contextual_drawing = False; + + /* context dependent */ + om->core.context_dependent = False; + + return True; +} + +XOM +_XomGenericOpenOM(XLCd lcd, Display *dpy, XrmDatabase rdb, + _Xconst char *res_name, _Xconst char *res_class) +{ + XOM om; + + om = create_om(lcd, dpy, rdb, res_name, res_class); + if (om == NULL) + return (XOM) NULL; + + if (init_om(om) == False) + goto err; + + return om; + +err: + close_om(om); + + return (XOM) NULL; +} + +Bool +_XInitOM( + XLCd lcd) +{ + lcd->methods->open_om = _XomGenericOpenOM; + + return True; +} diff --git a/nx-X11/lib/modules/om/generic/omImText.c b/nx-X11/lib/modules/om/generic/omImText.c new file mode 100644 index 000000000..9cfb5497d --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omImText.c @@ -0,0 +1,86 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" + +#define GET_VALUE_MASK (GCFunction | GCForeground | GCBackground | GCFillStyle) +#define SET_VALUE_MASK (GCFunction | GCForeground | GCFillStyle) + +static void +_XomGenericDrawImageString( + Display *dpy, + Drawable d, + XOC oc, + GC gc, + int x, int y, + XOMTextType type, + XPointer text, + int length) +{ + XGCValues values; + XRectangle extent; + + XGetGCValues(dpy, gc, GET_VALUE_MASK, &values); + + XSetFunction(dpy, gc, GXcopy); + XSetForeground(dpy, gc, values.background); + XSetFillStyle(dpy, gc, FillSolid); + + _XomGenericTextExtents(oc, type, text, length, 0, &extent); + XFillRectangle(dpy, d, gc, x + extent.x, y + extent.y, extent.width, + extent.height); + + XChangeGC(dpy, gc, SET_VALUE_MASK, &values); + + _XomGenericDrawString(dpy, d, oc, gc, x, y, type, text, length); +} + +void +_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length) +{ + _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMMultiByte, + (XPointer) text, length); +} + +void +_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst wchar_t *text, int length) +{ + _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMWideChar, + (XPointer) text, length); +} + +void +_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length) +{ + _XomGenericDrawImageString(dpy, d, oc, gc, x, y, XOMUtf8String, + (XPointer) text, length); +} diff --git a/nx-X11/lib/modules/om/generic/omText.c b/nx-X11/lib/modules/om/generic/omText.c new file mode 100644 index 000000000..bfceca96e --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omText.c @@ -0,0 +1,370 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ +/* + * Modifiers: Jeff Walls, Paul Anderson (HEWLETT-PACKARD) + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" +#include + +/* For VW/UDC */ + +static int +is_rotate( + XOC oc, + XFontStruct *font) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + VRotate vrotate; + int font_set_count; + int vrotate_num; + + font_set = gen->font_set; + font_set_count = gen->font_set_num; + for( ; font_set_count-- ; font_set++) { + if((font_set->vrotate_num > 0) && (font_set->vrotate)) { + vrotate = font_set->vrotate; + vrotate_num = font_set->vrotate_num; + for( ; vrotate_num-- ; vrotate++) + if(vrotate->font == font) + return True; + } + } + return False; +} + +static int +is_codemap( + XOC oc, + XFontStruct *font) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + FontData vmap; + int font_set_count; + int vmap_num; + + font_set = gen->font_set; + font_set_count = gen->font_set_num; + for( ; font_set_count-- ; font_set++) { + if(font_set->vmap_num > 0) { + vmap = font_set->vmap; + vmap_num = font_set->vmap_num; + for( ; vmap_num-- ; vmap++) + if(vmap->font == font) + return True; + } + } + return False; +} + +static int +draw_vertical( + Display *dpy, + Drawable d, + XOC oc, + GC gc, + XFontStruct *font, + Bool is_xchar2b, + int x, int y, + XPointer text, + int length) +{ + XChar2b *buf2b; + char *buf; + int wx = 0, wy = 0; + int direction = 0; + int font_ascent_return = 0, font_descent_return = 0; + int i; + XCharStruct overall; + + wy = y; + if (is_xchar2b) { + for(i = 0, buf2b = (XChar2b *) text ; i < length ; i++, buf2b++) { + if(is_rotate(oc, font) == True) { + XTextExtents16(font, buf2b, 1, + &direction, &font_ascent_return, + &font_descent_return, &overall); + wx = x - (int)((overall.rbearing - overall.lbearing) >> 1) - + (int) overall.lbearing; + wy += overall.ascent; + XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); + wy += overall.descent; + } else { + wx = x - (int)((font->max_bounds.rbearing - + font->min_bounds.lbearing) >> 1) - + (int) font->min_bounds.lbearing; + wy += font->max_bounds.ascent; + XDrawString16(dpy, d, gc, wx, wy, buf2b, 1); + wy += font->max_bounds.descent; + } + } + } else { + for(i = 0, buf = (char *)text ; i < length && *buf ; i++, buf++) { + if(is_rotate(oc, font) == True) { + XTextExtents(font, buf, 1, + &direction, &font_ascent_return, + &font_descent_return, &overall); + wx = x - (int)((overall.rbearing - overall.lbearing) >> 1) - + (int) overall.lbearing; + wy += overall.ascent; + XDrawString(dpy, d, gc, wx, wy, buf, 1); + wy += overall.descent; + } else { + wx = x - (int)((font->max_bounds.rbearing - + font->min_bounds.lbearing) >> 1) - + (int) font->min_bounds.lbearing; + wy += font->max_bounds.ascent; + XDrawString(dpy, d, gc, wx, wy, buf, 1); + wy += font->max_bounds.descent; + } + } + } + return wy; +} + +#define VMAP 0 +#define VROTATE 1 +#define FONTSCOPE 2 + +static int +DrawStringWithFontSet( + Display *dpy, + Drawable d, + XOC oc, + FontSet fs, + GC gc, + int x, int y, + XPointer text, + int length) +{ + XFontStruct *font; + Bool is_xchar2b; + unsigned char *ptr; + int ptr_len, char_len = 0; + FontData fd; + int ret = 0; + + ptr = (unsigned char *)text; + is_xchar2b = fs->is_xchar2b; + + while (length > 0) { + fd = _XomGetFontDataFromFontSet(fs, + ptr,length,&ptr_len,is_xchar2b,FONTSCOPE); + if(ptr_len <= 0) + break; + + /* First, see if the "Best Match" font for the FontSet was set. + * If it was, use that font. If it was not set, then use the + * font defined by font_set->font_data[0] (which is what + * _XomGetFontDataFromFontSet() always seems to return for + * non-VW text). Note that given the new algorithm in + * parse_fontname() and parse_fontdata(), fs->font will + * *always* contain good data. We should probably remove + * the check for "fd->font", but we won't :-) -- jjw/pma (HP) + */ + if((font = fs->font) == (XFontStruct *) NULL){ + + if(fd == (FontData) NULL || + (font = fd->font) == (XFontStruct *) NULL) + break; + } + + switch(oc->core.orientation) { + case XOMOrientation_LTR_TTB: + case XOMOrientation_RTL_TTB: + XSetFont(dpy, gc, font->fid); + + if (is_xchar2b) { + char_len = ptr_len / sizeof(XChar2b); + XDrawString16(dpy, d, gc, x, y, (XChar2b *)ptr, char_len); + x += XTextWidth16(font, (XChar2b *)ptr, char_len); + } else { + char_len = ptr_len; + XDrawString(dpy, d, gc, x, y, (char *)ptr, char_len); + x += XTextWidth(font, (char *)ptr, char_len); + } + break; + case XOMOrientation_TTB_RTL: + case XOMOrientation_TTB_LTR: + if(fs->font == font) { + fd = _XomGetFontDataFromFontSet(fs, + ptr,length,&ptr_len,is_xchar2b,VMAP); + if(ptr_len <= 0) + break; + if(fd == (FontData) NULL || + (font = fd->font) == (XFontStruct *) NULL) + break; + + if(is_codemap(oc, fd->font) == False) { + fd = _XomGetFontDataFromFontSet(fs, + ptr,length,&ptr_len,is_xchar2b,VROTATE); + if(ptr_len <= 0) + break; + if(fd == (FontData) NULL || + (font = fd->font) == (XFontStruct *) NULL) + break; + } + } + + if(is_xchar2b) + char_len = ptr_len / sizeof(XChar2b); + else + char_len = ptr_len; + XSetFont(dpy, gc, font->fid); + y = draw_vertical(dpy, d, oc, gc, font, is_xchar2b, x, y, + (char *)ptr, char_len); + break; + + case XOMOrientation_Context: + /* never used? */ + break; + } + + if(char_len <= 0) + break; + + length -= char_len; + ptr += ptr_len; + } + + switch(oc->core.orientation) { + case XOMOrientation_LTR_TTB: + case XOMOrientation_RTL_TTB: + ret = x; + break; + case XOMOrientation_TTB_RTL: + case XOMOrientation_TTB_LTR: + ret = y; + break; + case XOMOrientation_Context: + /* not used? */ + break; + } + return ret; +} + +/* For VW/UDC */ + +int +_XomGenericDrawString( + Display *dpy, + Drawable d, + XOC oc, + GC gc, + int x, int y, + XOMTextType type, + XPointer text, + int length) +{ + XlcConv conv; + XFontStruct *font; + Bool is_xchar2b; +/* VW/UDC */ + XPointer args[3]; + FontSet fs; +/* VW/UDC */ + XChar2b xchar2b_buf[BUFSIZ], *buf; + int start_x = x; + int start_y = y; + int left = 0, buf_len = 0; + int next = 0; + + conv = _XomInitConverter(oc, type); + if (conv == NULL) + return -1; + + args[0] = (XPointer) &font; + args[1] = (XPointer) &is_xchar2b; + args[2] = (XPointer) &fs; + + while (length > 0) { + buf = xchar2b_buf; + left = buf_len = BUFSIZ; + + if (_XomConvert(oc, conv, (XPointer *) &text, &length, + (XPointer *) &buf, &left, args, 3) < 0) + break; + buf_len -= left; + +/* For VW/UDC */ + next = DrawStringWithFontSet(dpy, d, oc, fs, gc, x, y, + (XPointer)xchar2b_buf, buf_len); + + switch(oc->core.orientation) { + case XOMOrientation_LTR_TTB: + case XOMOrientation_RTL_TTB: + x = next; + break; + case XOMOrientation_TTB_RTL: + case XOMOrientation_TTB_LTR: + y = next; + break; + case XOMOrientation_Context: + /* not used */ + break; + } +/* For VW/UDC */ + } + + x -= start_x; + y -= start_y; + + return x; +} + +int +_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length) +{ + return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMMultiByte, + (XPointer) text, length); +} + +int +_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst wchar_t *text, int length) +{ + return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMWideChar, + (XPointer) text, length); +} + +int +_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length) +{ + return _XomGenericDrawString(dpy, d, oc, gc, x, y, XOMUtf8String, + (XPointer) text, length); +} diff --git a/nx-X11/lib/modules/om/generic/omTextEsc.c b/nx-X11/lib/modules/om/generic/omTextEsc.c new file mode 100644 index 000000000..df1fb10c0 --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omTextEsc.c @@ -0,0 +1,300 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" +#include + +/* For VW/UDC start */ + +#define VMAP 0 +#define VROTATE 1 +#define FONTSCOPE 2 + +static int +is_rotate( + XOC oc, + XFontStruct *font) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + VRotate vrotate; + int font_set_count; + int vrotate_num; + + font_set = gen->font_set; + font_set_count = gen->font_set_num; + for( ; font_set_count-- ; font_set++) { + if((font_set->vrotate_num > 0) && (font_set->vrotate != NULL)) { + vrotate = font_set->vrotate; + vrotate_num = font_set->vrotate_num; + for( ; vrotate_num-- ; vrotate++) + if(vrotate->font == font) + return True; + } + } + return False; +} + +static int +is_codemap( + XOC oc, + XFontStruct *font) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + FontSet font_set; + FontData vmap; + int font_set_count; + int vmap_num; + + font_set = gen->font_set; + font_set_count = gen->font_set_num; + for( ; font_set_count-- ; font_set++) { + if(font_set->vmap_num > 0) { + vmap = font_set->vmap; + vmap_num = font_set->vmap_num; + for( ; vmap_num-- ; vmap++) + if(vmap->font == font) + return True; + } + } + return False; +} + +static int +escapement_vertical( + XOC oc, + XFontStruct *font, + Bool is_xchar2b, + XPointer text, + int length) +{ + XChar2b *buf2b; + char *buf; + int escapement = 0, i; + + if(is_xchar2b) { + for(i = 0, buf2b = (XChar2b *) text ; i < length ; i++, buf2b++) { + if(is_rotate(oc, font) == True) { + escapement += _XTextHeight16(font, buf2b, 1); + } else { + escapement += (int) (font->max_bounds.ascent + + font->max_bounds.descent); + } + } + } else { + for(i = 0, buf = (char *)text ; i < length && *buf ; i++, buf++) { + if(is_rotate(oc, font) == True) { + escapement += _XTextHeight(font, buf, 1); + } else { + escapement += (int) (font->max_bounds.ascent + + font->max_bounds.descent); + } + } + } + return escapement; +} + + +static int +TextWidthWithFontSet( + FontSet font_set, + XOC oc, + XPointer text, + int length) +{ + FontData fd; + XFontStruct *font; + unsigned char *ptr = (unsigned char *)text; + Bool is_xchar2b; + int ptr_len = length; + int escapement = 0, char_len = 0; + + if(font_set == (FontSet) NULL) + return escapement; + + is_xchar2b = font_set->is_xchar2b; + + while(length > 0) { + fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, + is_xchar2b, FONTSCOPE); + if(ptr_len <= 0) + break; + + /* + * First, see if the "Best Match" font for the FontSet was set. + * If it was, use that font. If it was not set, then use the + * font defined by font_set->font_data[0] (which is what + * _XomGetFontDataFromFontSet() always seems to return for + * non-VW text). Note that given the new algorithm in + * parse_fontname() and parse_fontdata(), fs->font will + * *always* contain good data. We should probably remove + * the check for "fd->font", but we won't :-) -- jjw/pma (HP) + * + * Above comment and way this is done propagated from omText.c + * Note that fd->font is junk so using the result of the + * above call /needs/ to be ignored. + * + * Owen Taylor 12 Jul 2000 + * + */ + + if(fd == (FontData) NULL || + (font = font_set->font) == (XFontStruct *) NULL) { + + if((font = fd->font) == (XFontStruct *) NULL) + break; + } + + switch(oc->core.orientation) { + case XOMOrientation_LTR_TTB: + case XOMOrientation_RTL_TTB: + if (is_xchar2b) { + char_len = ptr_len / sizeof(XChar2b); + escapement += XTextWidth16(font, (XChar2b *)ptr, char_len); + } else { + char_len = ptr_len; + escapement += XTextWidth(font, (char *)ptr, char_len); + } + break; + + case XOMOrientation_TTB_LTR: + case XOMOrientation_TTB_RTL: + if(font_set->font == font) { + fd = _XomGetFontDataFromFontSet(font_set, ptr, length, &ptr_len, + is_xchar2b, VMAP); + if(ptr_len <= 0) + break; + if(fd == (FontData) NULL || + (font = fd->font) == (XFontStruct *) NULL) + break; + + if(is_codemap(oc, fd->font) == False) { + fd = _XomGetFontDataFromFontSet(font_set, ptr, length, + &ptr_len, is_xchar2b, + VROTATE); + if(ptr_len <= 0) + break; + if(fd == (FontData) NULL || + (font = fd->font) == (XFontStruct *) NULL) + break; + } + } + + if(is_xchar2b) + char_len = ptr_len / sizeof(XChar2b); + else + char_len = ptr_len; + escapement += escapement_vertical(oc, font, is_xchar2b, + (XPointer) ptr, char_len); + break; + + case XOMOrientation_Context: + /* not used? */ + break; + } + + if(char_len <= 0) + break; + + length -= char_len; + ptr += ptr_len; + } + + return escapement; +} + +/* For VW/UDC end */ + +static int +_XomGenericTextEscapement( + XOC oc, + XOMTextType type, + XPointer text, + int length) +{ + XlcConv conv; + XFontStruct *font; + Bool is_xchar2b; +/* VW/UDC */ + XPointer args[3]; + FontSet font_set; +/* VW/UDC */ + XChar2b xchar2b_buf[BUFSIZ], *buf; + int escapement = 0; + int buf_len = 0, left = 0; + + conv = _XomInitConverter(oc, type); + if (conv == NULL) + return escapement; + + args[0] = (XPointer) &font; + args[1] = (XPointer) &is_xchar2b; + args[2] = (XPointer) &font_set; + + while (length > 0) { + buf = xchar2b_buf; + left = buf_len = BUFSIZ; + + if (_XomConvert(oc, conv, (XPointer *) &text, &length, + (XPointer *) &buf, &left, args, 3) < 0) + break; + buf_len -= left; + +/* VW/UDC */ + escapement += TextWidthWithFontSet(font_set, oc, + (XPointer) xchar2b_buf, buf_len); +/* VW/UDC */ + } + + return escapement; +} + +int +_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length) +{ + return _XomGenericTextEscapement(oc, XOMMultiByte, (XPointer) text, length); +} + +int +_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length) +{ + return _XomGenericTextEscapement(oc, XOMWideChar, (XPointer) text, length); +} + +int +_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length) +{ + return _XomGenericTextEscapement(oc, XOMUtf8String, (XPointer) text, + length); +} diff --git a/nx-X11/lib/modules/om/generic/omTextExt.c b/nx-X11/lib/modules/om/generic/omTextExt.c new file mode 100644 index 000000000..baeadf6b0 --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omTextExt.c @@ -0,0 +1,135 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" +#include + +int +_XomGenericTextExtents( + XOC oc, + XOMTextType type, + XPointer text, + int length, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + XlcConv conv; + XFontStruct *font; + Bool is_xchar2b; + XPointer args[2]; + XChar2b xchar2b_buf[BUFSIZ], *buf; + int direction, logical_ascent, logical_descent, tmp_ascent, tmp_descent; + XCharStruct overall, tmp_overall; + int buf_len, left; + Bool first = True; + + conv = _XomInitConverter(oc, type); + if (conv == NULL) + return 0; + + bzero((char *) &overall, sizeof(XCharStruct)); + logical_ascent = logical_descent = 0; + + args[0] = (XPointer) &font; + args[1] = (XPointer) &is_xchar2b; + + while (length > 0) { + buf = xchar2b_buf; + left = buf_len = BUFSIZ; + + if (_XomConvert(oc, conv, (XPointer *) &text, &length, + (XPointer *) &buf, &left, args, 2) < 0) + break; + buf_len -= left; + + if (is_xchar2b) + XTextExtents16(font, xchar2b_buf, buf_len, &direction, + &tmp_ascent, &tmp_descent, &tmp_overall); + else + XTextExtents(font, (char *) xchar2b_buf, buf_len, &direction, + &tmp_ascent, &tmp_descent, &tmp_overall); + + if (first) { /* initialize overall */ + overall = tmp_overall; + logical_ascent = tmp_ascent; + logical_descent = tmp_descent; + first = False; + } else { + overall.lbearing = min(overall.lbearing, + overall.width + tmp_overall.lbearing); + overall.rbearing = max(overall.rbearing, + overall.width + tmp_overall.rbearing); + overall.ascent = max(overall.ascent, tmp_overall.ascent); + overall.descent = max(overall.descent, tmp_overall.descent); + overall.width += tmp_overall.width; + logical_ascent = max(logical_ascent, tmp_ascent); + logical_descent = max(logical_descent, tmp_descent); + } + } + + if (overall_ink) { + overall_ink->x = overall.lbearing; + overall_ink->y = -(overall.ascent); + overall_ink->width = overall.rbearing - overall.lbearing; + overall_ink->height = overall.ascent + overall.descent; + } + + if (overall_logical) { + overall_logical->x = 0; + overall_logical->y = -(logical_ascent); + overall_logical->width = overall.width; + overall_logical->height = logical_ascent + logical_descent; + } + + return overall.width; +} + +int +_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical) +{ + return _XomGenericTextExtents(oc, XOMMultiByte, (XPointer) text, length, + overall_ink, overall_logical); +} + +int +_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical) +{ + return _XomGenericTextExtents(oc, XOMWideChar, (XPointer) text, length, + overall_ink, overall_logical); +} + +int +_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical) +{ + return _XomGenericTextExtents(oc, XOMUtf8String, (XPointer) text, length, + overall_ink, overall_logical); +} diff --git a/nx-X11/lib/modules/om/generic/omTextPer.c b/nx-X11/lib/modules/om/generic/omTextPer.c new file mode 100644 index 000000000..ae08fe6a4 --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omTextPer.c @@ -0,0 +1,202 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XomGeneric.h" +#include + +static Status +_XomGenericTextPerCharExtents( + XOC oc, + XOMTextType type, + XPointer text, + int length, + XRectangle *ink_buf, + XRectangle *logical_buf, + int buf_size, + int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + XlcConv conv; + XFontStruct *font; + Bool is_xchar2b; + XPointer args[2]; + XChar2b xchar2b_buf[BUFSIZ], *xchar2b_ptr; + char *xchar_ptr = NULL; + XCharStruct *def, *cs, overall; + int buf_len, left, require_num; + int logical_ascent, logical_descent; + Bool first = True; + + conv = _XomInitConverter(oc, type); + if (conv == NULL) + return 0; + + bzero((char *) &overall, sizeof(XCharStruct)); + logical_ascent = logical_descent = require_num = *num_chars = 0; + + args[0] = (XPointer) &font; + args[1] = (XPointer) &is_xchar2b; + + while (length > 0) { + xchar2b_ptr = xchar2b_buf; + left = buf_len = BUFSIZ; + + if (_XomConvert(oc, conv, (XPointer *) &text, &length, + (XPointer *) &xchar2b_ptr, &left, args, 2) < 0) + break; + buf_len -= left; + + if (require_num) { + require_num += buf_len; + continue; + } + if (buf_size < buf_len) { + require_num = *num_chars + buf_len; + continue; + } + buf_size -= buf_len; + + if (first) { + logical_ascent = font->ascent; + logical_descent = font->descent; + } else { + logical_ascent = max(logical_ascent, font->ascent); + logical_descent = max(logical_descent, font->descent); + } + + if (is_xchar2b) { + CI_GET_DEFAULT_INFO_2D(font, def) + xchar2b_ptr = xchar2b_buf; + } else { + CI_GET_DEFAULT_INFO_1D(font, def) + xchar_ptr = (char *) xchar2b_buf; + } + + while (buf_len-- > 0) { + if (is_xchar2b) { + CI_GET_CHAR_INFO_2D(font, xchar2b_ptr->byte1, + xchar2b_ptr->byte2, def, cs) + xchar2b_ptr++; + } else { + CI_GET_CHAR_INFO_1D(font, *xchar_ptr, def, cs) + xchar_ptr++; + } + if (cs == NULL) + continue; + + ink_buf->x = overall.width + cs->lbearing; + ink_buf->y = -(cs->ascent); + ink_buf->width = cs->rbearing - cs->lbearing; + ink_buf->height = cs->ascent + cs->descent; + ink_buf++; + + logical_buf->x = overall.width; + logical_buf->y = -(font->ascent); + logical_buf->width = cs->width; + logical_buf->height = font->ascent + font->descent; + logical_buf++; + + if (first) { + overall = *cs; + first = False; + } else { + overall.ascent = max(overall.ascent, cs->ascent); + overall.descent = max(overall.descent, cs->descent); + overall.lbearing = min(overall.lbearing, + overall.width + cs->lbearing); + overall.rbearing = max(overall.rbearing, + overall.width + cs->rbearing); + overall.width += cs->width; + } + + (*num_chars)++; + } + } + + if (require_num) { + *num_chars = require_num; + return 0; + } else { + if (overall_ink) { + overall_ink->x = overall.lbearing; + overall_ink->y = -(overall.ascent); + overall_ink->width = overall.rbearing - overall.lbearing; + overall_ink->height = overall.ascent + overall.descent; + } + + if (overall_logical) { + overall_logical->x = 0; + overall_logical->y = -(logical_ascent); + overall_logical->width = overall.width; + overall_logical->height = logical_ascent + logical_descent; + } + } + + return 1; +} + +Status +_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + return _XomGenericTextPerCharExtents(oc, XOMMultiByte, (XPointer) text, + length, ink_buf, logical_buf, buf_size, + num_chars, overall_ink, + overall_logical); +} + +Status +_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + return _XomGenericTextPerCharExtents(oc, XOMWideChar, (XPointer) text, + length, ink_buf, logical_buf, buf_size, + num_chars, overall_ink, + overall_logical); +} + +Status +_Xutf8GenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical) +{ + return _XomGenericTextPerCharExtents(oc, XOMUtf8String, (XPointer) text, + length, ink_buf, logical_buf, buf_size, + num_chars, overall_ink, + overall_logical); +} diff --git a/nx-X11/lib/modules/om/generic/omXChar.c b/nx-X11/lib/modules/om/generic/omXChar.c new file mode 100644 index 000000000..c9bbb8e88 --- /dev/null +++ b/nx-X11/lib/modules/om/generic/omXChar.c @@ -0,0 +1,404 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Takanori Tateno FUJITSU LIMITED + * + */ +/* + * Modifiers: Jeff Walls, Paul Anderson (HEWLETT-PACKARD) + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPublic.h" +#include "XomGeneric.h" +#include + +/* for VW/UDC start */ +static Bool +ismatch_scopes( + FontData fontdata, + unsigned long *value, + Bool is_shift) +{ + register int scopes_num = fontdata->scopes_num; + FontScope scopes = fontdata->scopes; + if (!scopes_num) + return False; + + if(fontdata->font == NULL) + return False; + + for(;scopes_num--;scopes++) + if ((scopes->start <= (*value & 0x7f7f)) && + ((scopes->end) >= (*value & 0x7f7f))){ + if(is_shift == True) { + if(scopes->shift){ + if(scopes->shift_direction == '+'){ + *value += scopes->shift ; + } else if( scopes->shift_direction == '-'){ + *value -= scopes->shift ; + } + } + } + return True; + } + + return False; +} + +static int +check_vertical_fonttype( + char *name) +{ + char *ptr; + int type = 0; + + if(name == (char *)NULL || (int) strlen(name) <= 0) + return False; + + /* Obtains the pointer of CHARSET_ENCODING_FIELD. */ + if((ptr = strchr(name, '-')) == (char *) NULL) + return False; + ptr++; + + /* Obtains the pointer of vertical_map font type. */ + if((ptr = strchr(ptr, '.')) == (char *) NULL) + return False; + ptr++; + + switch(*ptr) { + case '1': + type = 1; break; + case '2': + type = 2; break; + case '3': + type = 3; break; + } + return type; +} + +/* +*/ +#define VMAP 0 +#define VROTATE 1 +#define FONTSCOPE 2 + +FontData +_XomGetFontDataFromFontSet( + FontSet fs, + unsigned char *str, + int len, + int *len_ret, + int is2b, + int type) /* VMAP , VROTATE , else */ +{ + unsigned long value; + int num,i,hit,csize; + FontData fontdata; + unsigned char *c; + int vfont_type; + + c = str; + hit = -1; + if(type == VMAP){ + fontdata = fs->vmap; + num = fs->vmap_num; + } else if(type == VROTATE){ + fontdata = (FontData)fs->vrotate; + num = fs->vrotate_num; + } else { + if(fs->font_data_count <= 0 || fs->font_data == (FontData)NULL) { + fontdata = fs->substitute; + num = fs->substitute_num; + }else { + fontdata = fs->font_data; + num = fs->font_data_count; + } + /* CDExc20229 fix */ + if(fontdata == NULL || num == 0){ + return(NULL); + } + } + + + if(is2b){ + csize = 2; + } else { + csize = 1; + } + + for(;len;len--){ + if(is2b){ + value = (((unsigned long)*c) << 8)|(unsigned long)*(c + 1); + } else { + value = (unsigned long)*c; + } + + /* ### NOTE: This routine DOES NOT WORK! + * ### We can work around the problem in the calling routine, + * ### but we really need to understand this better. As it + * ### stands, the algorithm ALWAYS returns "fontdata[0]" + * ### for non-VW text! This is clearly wrong. In fact, + * ### given the new parse_font[name|data]() algorithms, + * ### we may not even need this routine to do anything + * ### for non-VW text (since font_set->font always contains + * ### the best font for this fontset). -- jjw/pma (HP) + */ + for (i=0;ifont_data_count <= 0 || + fs->font_data == (FontData)NULL) + fontdata = fs->substitute; + else + fontdata = fs->font_data; + /* Change 1996.01.23 end */ + } + hit = 0; + c += csize; + break; + } + if( hit == -1 ) hit = i; + if(is2b){ + *c = (unsigned char)(value >> 8); + *(c + 1) = (unsigned char)(value); + } else { + *c = (unsigned char)value; + } + c += csize; + } + *len_ret = (c - str); + return(&(fontdata[hit])); +} +/* for VW/UDC end */ + +static FontSet +_XomGetFontSetFromCharSet( + XOC oc, + XlcCharSet charset) +{ + register FontSet font_set = XOC_GENERIC(oc)->font_set; + register int num = XOC_GENERIC(oc)->font_set_num; + XlcCharSet *charset_list; + int charset_count; + + for ( ; num-- > 0; font_set++) { + charset_count = font_set->charset_count; + charset_list = font_set->charset_list; + for ( ; charset_count-- > 0; charset_list++) + if (*charset_list == charset) + return font_set; + } + + return (FontSet) NULL; +} + +static void +shift_to_gl( + register char *text, + register int length) +{ + while (length-- > 0) + *text++ &= 0x7f; +} + +static void +shift_to_gr( + register char *text, + register int length) +{ + while (length-- > 0) + *text++ |= 0x80; +} + +static Bool +load_font( + XOC oc, + FontSet font_set) +{ + font_set->font = XLoadQueryFont(oc->core.om->core.display, + oc->core.font_info.font_name_list[font_set->id]); + if (font_set->font == NULL) + return False; + + oc->core.font_info.font_struct_list[font_set->id] = font_set->font; + XFreeFontInfo(NULL, font_set->info, 1); + font_set->info = NULL; + + if (font_set->font->min_byte1 || font_set->font->max_byte1) + font_set->is_xchar2b = True; + else + font_set->is_xchar2b = False; + + return True; +} + +int +_XomConvert( + XOC oc, + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XPointer cs, lc_args[1]; + XlcCharSet charset; + int length, cs_left, ret; + FontSet font_set; + + cs = *to; + cs_left = *to_left; + lc_args[0] = (XPointer) &charset; + + ret = _XlcConvert(conv, from, from_left, &cs, &cs_left, lc_args, 1); + if (ret < 0) + return -1; + + font_set = _XomGetFontSetFromCharSet(oc, charset); + if (font_set == NULL) + return -1; + + if (font_set->font == NULL && load_font(oc, font_set) == False) + return -1; + + length = *to_left - cs_left; + + if (font_set->side != charset->side) { + if (font_set->side == XlcGL) + shift_to_gl(*to, length); + else if (font_set->side == XlcGR) + shift_to_gr(*to, length); + } + + if (font_set->is_xchar2b) + length >>= 1; + *to = cs; + *to_left -= length; + + *((XFontStruct **) args[0]) = font_set->font; + *((Bool *) args[1]) = font_set->is_xchar2b; + if(num_args >= 3){ + *((FontSet *) args[2]) = font_set; + } + + return ret; +} + +XlcConv +_XomInitConverter( + XOC oc, + XOMTextType type) +{ + XOCGenericPart *gen = XOC_GENERIC(oc); + XlcConv *convp; + const char *conv_type; + XlcConv conv; + XLCd lcd; + + switch (type) { + case XOMWideChar: + convp = &gen->wcs_to_cs; + conv_type = XlcNWideChar; + break; + case XOMMultiByte: + convp = &gen->mbs_to_cs; + conv_type = XlcNMultiByte; + break; + case XOMUtf8String: + convp = &gen->utf8_to_cs; + conv_type = XlcNUtf8String; + break; + default: + return (XlcConv) NULL; + } + + conv = *convp; + if (conv) { + _XlcResetConverter(conv); + return conv; + } + + lcd = oc->core.om->core.lcd; + + conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNFontCharSet); + if (conv == (XlcConv) NULL) { + conv = _XlcOpenConverter(lcd, conv_type, lcd, XlcNCharSet); + if (conv == (XlcConv) NULL) + return (XlcConv) NULL; + } + + *convp = conv; + return conv; +} diff --git a/nx-X11/lib/nx-x11.pc.in b/nx-X11/lib/nx-x11.pc.in new file mode 100644 index 000000000..a827429b7 --- /dev/null +++ b/nx-X11/lib/nx-x11.pc.in @@ -0,0 +1,18 @@ +prefix=@prefix@ +exec_prefix=@exec_prefix@ +libdir=@libdir@ +includedir=@includedir@ + +xthreadlib=@XTHREADLIB@ + +Name: NX_X11 +Description: NX_X11 Library +Version: @PACKAGE_VERSION@ +# FIXME: we currently build from one source tree... Get back to this +# whenever we take the nx-libs source code apart and split up the +# components +#Requires: nx-xproto @XKBPROTO_REQUIRES@ +#Requires.private: @X11_EXTRA_DEPS@ +Cflags: -I${includedir} @XTHREAD_CFLAGS@ +Libs: -L${libdir} -lNX_X11 +Libs.private: @XTHREADLIB@ diff --git a/nx-X11/lib/src/.gitignore b/nx-X11/lib/src/.gitignore new file mode 100644 index 000000000..8215e21de --- /dev/null +++ b/nx-X11/lib/src/.gitignore @@ -0,0 +1 @@ +ks_tables.h \ No newline at end of file diff --git a/nx-X11/lib/src/AllCells.c b/nx-X11/lib/src/AllCells.c new file mode 100644 index 000000000..6e97e1181 --- /dev/null +++ b/nx-X11/lib/src/AllCells.c @@ -0,0 +1,68 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XAllocColorCells( + register Display *dpy, + Colormap cmap, + Bool contig, + unsigned long *masks, /* LISTofCARD32 */ /* RETURN */ + unsigned int nplanes, /* CARD16 */ + unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ + unsigned int ncolors) /* CARD16 */ +{ + + Status status; + xAllocColorCellsReply rep; + register xAllocColorCellsReq *req; + LockDisplay(dpy); + GetReq(AllocColorCells, req); + + req->cmap = cmap; + req->colors = ncolors; + req->planes = nplanes; + req->contiguous = contig; + + status = _XReply(dpy, (xReply *)&rep, 0, xFalse); + + if (status) { + if ((rep.nPixels > ncolors) || (rep.nMasks > nplanes)) { + _XEatDataWords(dpy, rep.length); + status = 0; /* Failure */ + } else { + _XRead32 (dpy, (long *) pixels, 4L * (long) (rep.nPixels)); + _XRead32 (dpy, (long *) masks, 4L * (long) (rep.nMasks)); + } + } + + UnlockDisplay(dpy); + SyncHandle(); + return(status); +} diff --git a/nx-X11/lib/src/AllPlanes.c b/nx-X11/lib/src/AllPlanes.c new file mode 100644 index 000000000..b2e245387 --- /dev/null +++ b/nx-X11/lib/src/AllPlanes.c @@ -0,0 +1,74 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XAllocColorPlanes( + register Display *dpy, + Colormap cmap, + Bool contig, + unsigned long *pixels, /* LISTofCARD32 */ /* RETURN */ + int ncolors, + int nreds, + int ngreens, + int nblues, + unsigned long *rmask, + unsigned long *gmask, + unsigned long *bmask) /* CARD32 */ /* RETURN */ +{ + xAllocColorPlanesReply rep; + Status status; + register xAllocColorPlanesReq *req; + + LockDisplay(dpy); + GetReq(AllocColorPlanes,req); + + req->cmap = cmap; + req->colors = ncolors; + req->red = nreds; + req->green = ngreens; + req->blue = nblues; + req->contiguous = contig; + + status = _XReply(dpy, (xReply *)&rep, 0, xFalse); + + + if (status) { + *rmask = rep.redMask; + *gmask = rep.greenMask; + *bmask = rep.blueMask; + + /* sizeof(CARD32) = 4 */ + _XRead32 (dpy, (long *) pixels, (long)(ncolors * 4)); + } + + UnlockDisplay(dpy); + SyncHandle(); + return(status); +} diff --git a/nx-X11/lib/src/AllowEv.c b/nx-X11/lib/src/AllowEv.c new file mode 100644 index 000000000..4a17e7b2d --- /dev/null +++ b/nx-X11/lib/src/AllowEv.c @@ -0,0 +1,51 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XAllowEvents( + register Display *dpy, + int mode, + Time time) + +{ + register xAllowEventsReq *req; + + LockDisplay(dpy); + GetReq(AllowEvents,req); + req->mode = mode; + req->time = time; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + + + diff --git a/nx-X11/lib/src/AuDispose.c b/nx-X11/lib/src/AuDispose.c new file mode 100644 index 000000000..bb890201d --- /dev/null +++ b/nx-X11/lib/src/AuDispose.c @@ -0,0 +1,49 @@ + +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +void +XauDisposeAuth (auth) +Xauth *auth; +{ + if (auth) { + if (auth->address) (void) free (auth->address); + if (auth->number) (void) free (auth->number); + if (auth->name) (void) free (auth->name); + if (auth->data) { + (void) bzero (auth->data, auth->data_length); + (void) free (auth->data); + } + free ((char *) auth); + } + return; +} diff --git a/nx-X11/lib/src/AuFileName.c b/nx-X11/lib/src/AuFileName.c new file mode 100644 index 000000000..6c4fb7dc3 --- /dev/null +++ b/nx-X11/lib/src/AuFileName.c @@ -0,0 +1,73 @@ + +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +char * +XauFileName () +{ + char *slashDotXauthority = "/.Xauthority"; + char *name; + static char *buf; + static int bsize; +#ifdef WIN32 + char dir[128]; +#endif + int size; + + if ((name = getenv ("XAUTHORITY"))) + return name; + name = getenv ("HOME"); + if (!name) { +#ifdef WIN32 + (void) strcpy (dir, "/users/"); + if ((name = getenv("USERNAME"))) { + (void) strcat (dir, name); + name = dir; + } + if (!name) +#endif + return 0; + } + size = strlen (name) + strlen(&slashDotXauthority[1]) + 2; + if (size > bsize) { + if (buf) + free (buf); + buf = malloc ((unsigned) size); + if (!buf) + return 0; + bsize = size; + } + strcpy (buf, name); + strcat (buf, slashDotXauthority + (name[1] == '\0' ? 1 : 0)); + return buf; +} diff --git a/nx-X11/lib/src/AuGetBest.c b/nx-X11/lib/src/AuGetBest.c new file mode 100644 index 000000000..2518805cc --- /dev/null +++ b/nx-X11/lib/src/AuGetBest.c @@ -0,0 +1,136 @@ + +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#ifdef XTHREADS +#include +#endif + +static int +binaryEqual (_Xconst char *a, _Xconst char *b, int len) +{ + while (len--) + if (*a++ != *b++) + return 0; + return 1; +} + +Xauth * +XauGetBestAuthByAddr ( +#if NeedWidePrototypes + unsigned int family, + unsigned int address_length, +#else + unsigned short family, + unsigned short address_length, +#endif + _Xconst char* address, +#if NeedWidePrototypes + unsigned int number_length, +#else + unsigned short number_length, +#endif + _Xconst char* number, + int types_length, + char** types, + _Xconst int* type_lengths) +{ + FILE *auth_file; + char *auth_name; + Xauth *entry; + Xauth *best; + int best_type; + int type; + + auth_name = XauFileName (); + if (!auth_name) + return 0; + if (access (auth_name, R_OK) != 0) /* checks REAL id */ + return 0; + auth_file = fopen (auth_name, "rb"); + if (!auth_file) + return 0; + + best = 0; + best_type = types_length; + for (;;) { + entry = XauReadAuth (auth_file); + if (!entry) + break; + /* + * Match when: + * either family or entry->family are FamilyWild or + * family and entry->family are the same and + * address and entry->address are the same + * and + * either number or entry->number are empty or + * number and entry->number are the same + * and + * either name or entry->name are empty or + * name and entry->name are the same + */ + + if ((family == FamilyWild || entry->family == FamilyWild || + (entry->family == family && + ((address_length == entry->address_length && + binaryEqual (entry->address, address, (int)address_length)) + ))) && + (number_length == 0 || entry->number_length == 0 || + (number_length == entry->number_length && + binaryEqual (entry->number, number, (int)number_length)))) + { + if (best_type == 0) + { + best = entry; + break; + } + for (type = 0; type < best_type; type++) + if (type_lengths[type] == entry->name_length && + !(strncmp (types[type], entry->name, entry->name_length))) + { + break; + } + if (type < best_type) + { + if (best) + XauDisposeAuth (best); + best = entry; + best_type = type; + if (type == 0) + break; + continue; + } + } + XauDisposeAuth (entry); + } + (void) fclose (auth_file); + return best; +} diff --git a/nx-X11/lib/src/AuRead.c b/nx-X11/lib/src/AuRead.c new file mode 100644 index 000000000..61814792d --- /dev/null +++ b/nx-X11/lib/src/AuRead.c @@ -0,0 +1,135 @@ + +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +static int +read_short (unsigned short *shortp, FILE *file) +{ + unsigned char file_short[2]; + + /* + * Added a check on EINTR to prevent the fread() call to be + * interrupted by any signal not blocked by OsBlockSignals(). + */ + + for (;;) { + if (fread ((char *) file_short, (int) sizeof (file_short), 1, file) != 1) { + if (errno == EINTR && ferror (file)) { + perror ("Reading from auth file"); + clearerr (file); + continue; + } + return 0; + } + break; + } + *shortp = file_short[0] * 256 + file_short[1]; + return 1; +} + +static int +read_counted_string (unsigned short *countp, char **stringp, FILE *file) +{ + unsigned short len; + char *data; + + if (read_short (&len, file) == 0) + return 0; + if (len == 0) { + data = 0; + } else { + data = malloc ((unsigned) len); + if (!data) + return 0; + for (;;) + { + if (fread (data, (int) sizeof (char), (int) len, file) != len) + { + if (errno == EINTR && ferror (file)) + { + perror ("Reading from auth file"); + clearerr (file); + continue; + } + bzero (data, len); + free (data); + return 0; + } + break; + } + } + *stringp = data; + *countp = len; + return 1; +} + +Xauth * +XauReadAuth (auth_file) +FILE *auth_file; +{ + Xauth local; + Xauth *ret; + + if (read_short (&local.family, auth_file) == 0) + return 0; + if (read_counted_string (&local.address_length, &local.address, auth_file) == 0) + return 0; + if (read_counted_string (&local.number_length, &local.number, auth_file) == 0) { + if (local.address) free (local.address); + return 0; + } + if (read_counted_string (&local.name_length, &local.name, auth_file) == 0) { + if (local.address) free (local.address); + if (local.number) free (local.number); + return 0; + } + if (read_counted_string (&local.data_length, &local.data, auth_file) == 0) { + if (local.address) free (local.address); + if (local.number) free (local.number); + if (local.name) free (local.name); + return 0; + } + ret = (Xauth *) malloc (sizeof (Xauth)); + if (!ret) { + if (local.address) free (local.address); + if (local.number) free (local.number); + if (local.name) free (local.name); + if (local.data) { + bzero (local.data, local.data_length); + free (local.data); + } + return 0; + } + *ret = local; + return ret; +} diff --git a/nx-X11/lib/src/AutoRep.c b/nx-X11/lib/src/AutoRep.c new file mode 100644 index 000000000..66b4097a8 --- /dev/null +++ b/nx-X11/lib/src/AutoRep.c @@ -0,0 +1,50 @@ +/* + +Copyright 1985, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XAutoRepeatOn (register Display *dpy) +{ + XKeyboardControl values; + values.auto_repeat_mode = AutoRepeatModeOn; + XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); + return 1; +} + +int +XAutoRepeatOff (register Display *dpy) +{ + XKeyboardControl values; + values.auto_repeat_mode = AutoRepeatModeOff; + XChangeKeyboardControl (dpy, KBAutoRepeatMode, &values); + return 1; +} + + diff --git a/nx-X11/lib/src/Backgnd.c b/nx-X11/lib/src/Backgnd.c new file mode 100644 index 000000000..bf7d75f8f --- /dev/null +++ b/nx-X11/lib/src/Backgnd.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetWindowBackground( + register Display *dpy, + Window w, + unsigned long pixel) +{ + register xChangeWindowAttributesReq *req; + + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWBackPixel; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/BdrWidth.c b/nx-X11/lib/src/BdrWidth.c new file mode 100644 index 000000000..5da8ce772 --- /dev/null +++ b/nx-X11/lib/src/BdrWidth.c @@ -0,0 +1,53 @@ + +/* + +Copyright 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetWindowBorderWidth( + Display *dpy, + Window w, + unsigned int width) +{ + unsigned long lwidth = width; /* must be CARD32 */ + + register xConfigureWindowReq *req; + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 4, req); + req->window = w; + req->mask = CWBorderWidth; + OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), lwidth); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/Bell.c b/nx-X11/lib/src/Bell.c new file mode 100644 index 000000000..7da8772cf --- /dev/null +++ b/nx-X11/lib/src/Bell.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XBell( + register Display *dpy, + int percent) +{ + register xBellReq *req; + + LockDisplay(dpy); + GetReq(Bell,req); + req->percent = percent; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/Border.c b/nx-X11/lib/src/Border.c new file mode 100644 index 000000000..133043a5b --- /dev/null +++ b/nx-X11/lib/src/Border.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetWindowBorder( + register Display *dpy, + Window w, + unsigned long pixel) +{ + register xChangeWindowAttributesReq *req; + + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWBorderPixel; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixel); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChAccCon.c b/nx-X11/lib/src/ChAccCon.c new file mode 100644 index 000000000..f8d099668 --- /dev/null +++ b/nx-X11/lib/src/ChAccCon.c @@ -0,0 +1,59 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XEnableAccessControl(register Display *dpy) +{ + return XSetAccessControl(dpy, EnableAccess); +} + +int +XDisableAccessControl(register Display *dpy) +{ + return XSetAccessControl(dpy, DisableAccess); +} + +int +XSetAccessControl( + register Display *dpy, + int mode) + +{ + register xSetAccessControlReq *req; + + LockDisplay(dpy); + GetReq(SetAccessControl, req); + req->mode = mode; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChActPGb.c b/nx-X11/lib/src/ChActPGb.c new file mode 100644 index 000000000..bebef2b01 --- /dev/null +++ b/nx-X11/lib/src/ChActPGb.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XChangeActivePointerGrab( + register Display *dpy, + unsigned int event_mask, /* CARD16 */ + Cursor curs, + Time time) +{ + register xChangeActivePointerGrabReq *req; + + LockDisplay(dpy); + GetReq(ChangeActivePointerGrab, req); + req->eventMask = event_mask; + req->cursor = curs; + req->time = time; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/ChClMode.c b/nx-X11/lib/src/ChClMode.c new file mode 100644 index 000000000..5250a80bc --- /dev/null +++ b/nx-X11/lib/src/ChClMode.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetCloseDownMode( + register Display *dpy, + int mode) +{ + register xSetCloseDownModeReq *req; + + LockDisplay(dpy); + GetReq(SetCloseDownMode, req); + req->mode = mode; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChCmap.c b/nx-X11/lib/src/ChCmap.c new file mode 100644 index 000000000..d9372cdf3 --- /dev/null +++ b/nx-X11/lib/src/ChCmap.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetWindowColormap( + register Display *dpy, + Window w, + Colormap colormap) +{ + register xChangeWindowAttributesReq *req; + + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWColormap; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), colormap); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChGC.c b/nx-X11/lib/src/ChGC.c new file mode 100644 index 000000000..8f677dc3a --- /dev/null +++ b/nx-X11/lib/src/ChGC.c @@ -0,0 +1,52 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Cr.h" + +int +XChangeGC ( + register Display *dpy, + GC gc, + unsigned long valuemask, + XGCValues *values) +{ + LockDisplay(dpy); + + valuemask &= (1L << (GCLastBit + 1)) - 1; + if (valuemask) _XUpdateGCCache (gc, valuemask, values); + + /* if any Resource ID changed, must flush */ + if (gc->dirty & (GCFont | GCTile | GCStipple)) + _XFlushGCCache(dpy, gc); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChKeyCon.c b/nx-X11/lib/src/ChKeyCon.c new file mode 100644 index 000000000..bcf522340 --- /dev/null +++ b/nx-X11/lib/src/ChKeyCon.c @@ -0,0 +1,83 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XChangeKeyboardControl( + register Display *dpy, + unsigned long mask, + XKeyboardControl *value_list) +{ + unsigned long values[8]; + register unsigned long *value = values; + long nvalues; + register xChangeKeyboardControlReq *req; + + LockDisplay(dpy); + GetReq(ChangeKeyboardControl, req); + req->mask = mask; + + if (mask & KBKeyClickPercent) + *value++ = value_list->key_click_percent; + + if (mask & KBBellPercent) + *value++ = value_list->bell_percent; + + if (mask & KBBellPitch) + *value++ = value_list->bell_pitch; + + if (mask & KBBellDuration) + *value++ = value_list->bell_duration; + + if (mask & KBLed) + *value++ = value_list->led; + + if (mask & KBLedMode) + *value++ = value_list->led_mode; + + if (mask & KBKey) + *value++ = value_list->key; + + if (mask & KBAutoRepeatMode) + *value++ = value_list->auto_repeat_mode; + + + req->length += (nvalues = value - values); + + /* note: Data is a macro that uses its arguments multiple + times, so "nvalues" is changed in a separate assignment + statement */ + + nvalues <<= 2; + Data32 (dpy, (long *) values, nvalues); + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } diff --git a/nx-X11/lib/src/ChPntCon.c b/nx-X11/lib/src/ChPntCon.c new file mode 100644 index 000000000..c177c0045 --- /dev/null +++ b/nx-X11/lib/src/ChPntCon.c @@ -0,0 +1,55 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XChangePointerControl( + register Display *dpy, + Bool do_acc, + Bool do_thresh, + int acc_numerator, + int acc_denominator, + int threshold) + +{ + register xChangePointerControlReq *req; + + LockDisplay(dpy); + GetReq(ChangePointerControl, req); + req->doAccel = do_acc; + req->doThresh = do_thresh; + req->accelNum = acc_numerator; + req->accelDenum = acc_denominator; + req->threshold = threshold; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChProp.c b/nx-X11/lib/src/ChProp.c new file mode 100644 index 000000000..190a224f8 --- /dev/null +++ b/nx-X11/lib/src/ChProp.c @@ -0,0 +1,99 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XChangeProperty ( + register Display *dpy, + Window w, + Atom property, + Atom type, + int format, /* 8, 16, or 32 */ + int mode, /* PropModeReplace, PropModePrepend, PropModeAppend */ + _Xconst unsigned char *data, + int nelements) + { + register xChangePropertyReq *req; + register long len; + + LockDisplay(dpy); + GetReq (ChangeProperty, req); + req->window = w; + req->property = property; + req->type = type; + req->mode = mode; + if (nelements < 0) { + req->nUnits = 0; + req->format = 0; /* ask for garbage, get garbage */ + } else { + req->nUnits = nelements; + req->format = format; + } + + switch (req->format) { + case 8: + len = ((long)nelements + 3)>>2; + if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { + SetReqLen(req, len, len); + Data (dpy, (_Xconst char *)data, nelements); + } /* else force BadLength */ + break; + + case 16: + len = ((long)nelements + 1)>>1; + if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { + SetReqLen(req, len, len); + len = (long)nelements << 1; + Data16 (dpy, (_Xconst short *) data, len); + } /* else force BadLength */ + break; + + case 32: + len = nelements; + if (dpy->bigreq_size || req->length + len <= (unsigned) 65535) { + SetReqLen(req, len, len); + len = (long)nelements << 2; + Data32 (dpy, (_Xconst long *) data, len); + } /* else force BadLength */ + break; + + default: + /* BadValue will be generated */ ; + } + + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } + + + + + diff --git a/nx-X11/lib/src/ChSaveSet.c b/nx-X11/lib/src/ChSaveSet.c new file mode 100644 index 000000000..068b042d2 --- /dev/null +++ b/nx-X11/lib/src/ChSaveSet.c @@ -0,0 +1,63 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XChangeSaveSet( + register Display *dpy, + Window win, + int mode) +{ + register xChangeSaveSetReq *req; + + LockDisplay(dpy); + GetReq(ChangeSaveSet, req); + req->window = win; + req->mode = mode; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XAddToSaveSet( + register Display *dpy, + Window win) +{ + return XChangeSaveSet(dpy,win,SetModeInsert); +} + +int +XRemoveFromSaveSet ( + register Display *dpy, + Window win) +{ + return XChangeSaveSet(dpy,win,SetModeDelete); +} diff --git a/nx-X11/lib/src/ChWAttrs.c b/nx-X11/lib/src/ChWAttrs.c new file mode 100644 index 000000000..25cbcbd05 --- /dev/null +++ b/nx-X11/lib/src/ChWAttrs.c @@ -0,0 +1,57 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\ + CWBorderPixel|CWBitGravity|CWWinGravity|\ + CWBackingStore|CWBackingPlanes|CWBackingPixel|\ + CWOverrideRedirect|CWSaveUnder|CWEventMask|\ + CWDontPropagate|CWColormap|CWCursor) + +int +XChangeWindowAttributes ( + register Display *dpy, + Window w, + unsigned long valuemask, + XSetWindowAttributes *attributes) +{ + register xChangeWindowAttributesReq *req; + + LockDisplay(dpy); + GetReq(ChangeWindowAttributes,req); + req->window = w; + valuemask &= AllMaskBits; + if ((req->valueMask = valuemask)) + _XProcessWindowAttributes (dpy, req, valuemask, attributes); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ChWindow.c b/nx-X11/lib/src/ChWindow.c new file mode 100644 index 000000000..89a81e12a --- /dev/null +++ b/nx-X11/lib/src/ChWindow.c @@ -0,0 +1,54 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XResizeWindow( + register Display *dpy, + Window w, + unsigned int width, + unsigned int height) +{ + register xConfigureWindowReq *req; + + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 8, req); /* 2 4-byte quantities */ + + req->window = w; + req->mask = CWWidth | CWHeight; + { + CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); + *valuePtr++ = width; + *valuePtr = height; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/ChkIfEv.c b/nx-X11/lib/src/ChkIfEv.c new file mode 100644 index 000000000..313e4395c --- /dev/null +++ b/nx-X11/lib/src/ChkIfEv.c @@ -0,0 +1,138 @@ +/* + +Copyright 1985, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Check existing events in queue to find if any match. If so, return. + * If not, flush buffer and see if any more events are readable. If one + * matches, return. If all else fails, tell the user no events found. + */ + +Bool XCheckIfEvent ( + register Display *dpy, + register XEvent *event, /* XEvent to be filled in. */ + Bool (*predicate)( + Display* /* display */, + XEvent* /* event */, + char* /* arg */ + ), /* function to call */ + char *arg) +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + int n; /* time through count */ + + LockDisplay(dpy); + prev = NULL; + for (n = 3; --n >= 0;) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if(qelt->qserial_num > qe_serial + && (*predicate)(dpy, &qelt->event, arg)) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + _XStoreEventCookie(dpy, event); + UnlockDisplay(dpy); + return True; + } + } + if (prev) + qe_serial = prev->qserial_num; + switch (n) { + case 2: + _XEventsQueued(dpy, QueuedAfterReading); + break; + case 1: + _XFlush(dpy); + break; + } + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } + UnlockDisplay(dpy); + return False; +} + +#ifdef NX_TRANS_SOCKET + +/* + * This is just like XCheckIfEvent() but doesn't + * flush the output buffer if it can't read new + * events. + */ + +Bool XCheckIfEventNoFlush ( + register Display *dpy, + register XEvent *event, /* XEvent to be filled in. */ + Bool (*predicate)( + Display* /* display */, + XEvent* /* event */, + char* /* arg */ + ), /* function to call */ + char *arg) + +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + int n; /* time through count */ + + LockDisplay(dpy); + prev = NULL; + for (n = 2; --n >= 0;) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if(qelt->qserial_num > qe_serial + && (*predicate)(dpy, &qelt->event, arg)) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + _XStoreEventCookie(dpy, event); + UnlockDisplay(dpy); + return True; + } + } + if (prev) + qe_serial = prev->qserial_num; + switch (n) { + case 1: + _XEventsQueued(dpy, QueuedAfterReading); + break; + } + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } + UnlockDisplay(dpy); + return False; +} + +#endif diff --git a/nx-X11/lib/src/ChkMaskEv.c b/nx-X11/lib/src/ChkMaskEv.c new file mode 100644 index 000000000..78928e079 --- /dev/null +++ b/nx-X11/lib/src/ChkMaskEv.c @@ -0,0 +1,90 @@ +/* + +Copyright 1985, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +extern long const _Xevent_to_mask[]; + +#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) +#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ + Button4MotionMask|Button5MotionMask) + +/* + * Check existing events in queue to find if any match. If so, return. + * If not, flush buffer and see if any more events are readable. If one + * matches, return. If all else fails, tell the user no events found. + */ + +Bool XCheckMaskEvent ( + register Display *dpy, + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + int n; /* time through count */ + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + prev = NULL; + for (n = 3; --n >= 0;) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if ((qelt->event.type < GenericEvent) && + (_Xevent_to_mask[qelt->event.type] & mask) && + ((qelt->event.type != MotionNotify) || + (mask & AllPointers) || + (mask & AllButtons & qelt->event.xmotion.state))) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + UnlockDisplay(dpy); + return True; + } + } + if (prev) + qe_serial = prev->qserial_num; + switch (n) { + case 2: + _XEventsQueued(dpy, QueuedAfterReading); + break; + case 1: + _XFlush(dpy); + break; + } + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } + UnlockDisplay(dpy); + return False; +} diff --git a/nx-X11/lib/src/ChkTypEv.c b/nx-X11/lib/src/ChkTypEv.c new file mode 100644 index 000000000..2e9bcdd0a --- /dev/null +++ b/nx-X11/lib/src/ChkTypEv.c @@ -0,0 +1,81 @@ +/* + +Copyright 1985, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Check existing events in queue to find if any match. If so, return. + * If not, flush buffer and see if any more events are readable. If one + * matches, return. If all else fails, tell the user no events found. + */ + +Bool XCheckTypedEvent ( + register Display *dpy, + int type, /* Selected event type. */ + register XEvent *event) /* XEvent to be filled in. */ +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + int n; /* time through count */ + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + prev = NULL; + for (n = 3; --n >= 0;) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if (qelt->event.type == type) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + _XStoreEventCookie(dpy, event); + UnlockDisplay(dpy); + return True; + } + } + if (prev) + qe_serial = prev->qserial_num; + switch (n) { + case 2: + _XEventsQueued(dpy, QueuedAfterReading); + break; + case 1: + _XFlush(dpy); + break; + } + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } + UnlockDisplay(dpy); + return False; +} diff --git a/nx-X11/lib/src/ChkTypWEv.c b/nx-X11/lib/src/ChkTypWEv.c new file mode 100644 index 000000000..2f247be26 --- /dev/null +++ b/nx-X11/lib/src/ChkTypWEv.c @@ -0,0 +1,83 @@ +/* + +Copyright 1985, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Check existing events in queue to find if any match. If so, return. + * If not, flush buffer and see if any more events are readable. If one + * matches, return. If all else fails, tell the user no events found. + */ + +Bool XCheckTypedWindowEvent ( + register Display *dpy, + Window w, /* Selected window. */ + int type, /* Selected event type. */ + register XEvent *event) /* XEvent to be filled in. */ +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + int n; /* time through count */ + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + prev = NULL; + for (n = 3; --n >= 0;) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if ((qelt->event.xany.window == w) && + (qelt->event.type == type)) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + _XStoreEventCookie(dpy, event); + UnlockDisplay(dpy); + return True; + } + } + if (prev) + qe_serial = prev->qserial_num; + switch (n) { + case 2: + _XEventsQueued(dpy, QueuedAfterReading); + break; + case 1: + _XFlush(dpy); + break; + } + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } + UnlockDisplay(dpy); + return False; +} diff --git a/nx-X11/lib/src/ChkWinEv.c b/nx-X11/lib/src/ChkWinEv.c new file mode 100644 index 000000000..9fb7db06a --- /dev/null +++ b/nx-X11/lib/src/ChkWinEv.c @@ -0,0 +1,91 @@ +/* + +Copyright 1985, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +extern long const _Xevent_to_mask[]; +#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) +#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ + Button4MotionMask|Button5MotionMask) + +/* + * Check existing events in queue to find if any match. If so, return. + * If not, flush buffer and see if any more events are readable. If one + * matches, return. If all else fails, tell the user no events found. + */ + +Bool XCheckWindowEvent ( + register Display *dpy, + Window w, /* Selected window. */ + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + int n; /* time through count */ + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + prev = NULL; + for (n = 3; --n >= 0;) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if ((qelt->event.xany.window == w) && + (qelt->event.type < GenericEvent) && + (_Xevent_to_mask[qelt->event.type] & mask) && + ((qelt->event.type != MotionNotify) || + (mask & AllPointers) || + (mask & AllButtons & qelt->event.xmotion.state))) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + UnlockDisplay(dpy); + return True; + } + } + if (prev) + qe_serial = prev->qserial_num; + switch (n) { + case 2: + _XEventsQueued(dpy, QueuedAfterReading); + break; + case 1: + _XFlush(dpy); + break; + } + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; + } + UnlockDisplay(dpy); + return False; +} diff --git a/nx-X11/lib/src/CirWin.c b/nx-X11/lib/src/CirWin.c new file mode 100644 index 000000000..e37a42ade --- /dev/null +++ b/nx-X11/lib/src/CirWin.c @@ -0,0 +1,48 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XCirculateSubwindows( + register Display *dpy, + Window w, + int direction) +{ + register xCirculateWindowReq *req; + + LockDisplay(dpy); + GetReq(CirculateWindow, req); + req->window = w; + req->direction = direction; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/CirWinDn.c b/nx-X11/lib/src/CirWinDn.c new file mode 100644 index 000000000..f2b54852b --- /dev/null +++ b/nx-X11/lib/src/CirWinDn.c @@ -0,0 +1,47 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XCirculateSubwindowsDown( + register Display *dpy, + Window w) +{ + register xCirculateWindowReq *req; + + LockDisplay(dpy); + GetReq(CirculateWindow, req); + req->window = w; + req->direction = LowerHighest; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/CirWinUp.c b/nx-X11/lib/src/CirWinUp.c new file mode 100644 index 000000000..be9f094cd --- /dev/null +++ b/nx-X11/lib/src/CirWinUp.c @@ -0,0 +1,47 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XCirculateSubwindowsUp( + register Display *dpy, + Window w) +{ + register xCirculateWindowReq *req; + + LockDisplay(dpy); + GetReq(CirculateWindow, req); + req->window = w; + req->direction = RaiseLowest; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ClDisplay.c b/nx-X11/lib/src/ClDisplay.c new file mode 100644 index 000000000..898fc9144 --- /dev/null +++ b/nx-X11/lib/src/ClDisplay.c @@ -0,0 +1,82 @@ + +/* + +Copyright 1985, 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#if USE_XCB +#include "Xxcbint.h" +#else /* !USE_XCB */ +#include +#endif /* USE_XCB */ +#include "Xlib.h" +#include "Xlibint.h" +#include "Xintconn.h" + +/* + * XCloseDisplay - XSync the connection to the X Server, close the connection, + * and free all associated storage. Extension close procs should only free + * memory and must be careful about the types of requests they generate. + */ + +int +XCloseDisplay ( + register Display *dpy) +{ + register _XExtension *ext; + register int i; + + if (!(dpy->flags & XlibDisplayClosing)) + { + dpy->flags |= XlibDisplayClosing; + for (i = 0; i < dpy->nscreens; i++) { + register Screen *sp = &dpy->screens[i]; + XFreeGC (dpy, sp->default_gc); + } + if (dpy->cursor_font != None) { + XUnloadFont (dpy, dpy->cursor_font); + } + XSync(dpy, 1); /* throw away pending events, catch errors */ + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->close_display) + (*ext->close_display)(dpy, &ext->codes); + } + /* if the closes generated more protocol, sync them up */ + if (dpy->request != dpy->last_request_read) + XSync(dpy, 1); + } +#if USE_XCB + xcb_disconnect(dpy->xcb->connection); +#else /* !USE_XCB */ + _XDisconnectDisplay(dpy->trans_conn); +#endif /* USE_XCB */ + _XFreeDisplayStructure (dpy); + return 0; +} diff --git a/nx-X11/lib/src/Clear.c b/nx-X11/lib/src/Clear.c new file mode 100644 index 000000000..63dc64045 --- /dev/null +++ b/nx-X11/lib/src/Clear.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XClearWindow( + register Display *dpy, + Window w) +{ + register xClearAreaReq *req; + + LockDisplay(dpy); + GetReq(ClearArea, req); + req->window = w; + req->x = req->y = req->width = req->height = 0; + /* these values mean "clear the entire window" */ + req->exposures = xFalse; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ClearArea.c b/nx-X11/lib/src/ClearArea.c new file mode 100644 index 000000000..41fd17c80 --- /dev/null +++ b/nx-X11/lib/src/ClearArea.c @@ -0,0 +1,56 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XClearArea ( + register Display *dpy, + Window w, + int x, + int y, + unsigned int width, + unsigned int height, + Bool exposures) +{ + register xClearAreaReq *req; + + LockDisplay(dpy); + GetReq(ClearArea, req); + req->window = w; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->exposures = exposures; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/Cmap.h b/nx-X11/lib/src/Cmap.h new file mode 100644 index 000000000..db2de5697 --- /dev/null +++ b/nx-X11/lib/src/Cmap.h @@ -0,0 +1,12 @@ + +#ifndef _CMAP_H_ +#define _CMAP_H_ + +#include + +extern void +_XcmsDeleteCmapRec( + Display *dpy, + Colormap cmap); + +#endif /* _CMAP_H_ */ diff --git a/nx-X11/lib/src/ConfWind.c b/nx-X11/lib/src/ConfWind.c new file mode 100644 index 000000000..eefce4dd5 --- /dev/null +++ b/nx-X11/lib/src/ConfWind.c @@ -0,0 +1,58 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XMoveResizeWindow( + register Display *dpy, + Window w, + int x, + int y, + unsigned int width, + unsigned int height) +{ + register xConfigureWindowReq *req; + + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 16, req); + req->window = w; + req->mask = CWX | CWY | CWWidth | CWHeight; + { + register CARD32 *valuePtr = + (CARD32 *) NEXTPTR(req,xConfigureWindowReq); + *valuePtr++ = x; + *valuePtr++ = y; + *valuePtr++ = width; + *valuePtr = height; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/ConnDis.c b/nx-X11/lib/src/ConnDis.c new file mode 100644 index 000000000..dfc0227fe --- /dev/null +++ b/nx-X11/lib/src/ConnDis.c @@ -0,0 +1,1479 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* nx-X11, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * This file contains operating system dependencies. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#ifdef HASXDMAUTH +#include +#endif +#include +#include +#include + +#if !defined(WIN32) +#include +#else +#include +#endif + +#ifndef X_CONNECTION_RETRIES /* number retries on ECONNREFUSED */ +#define X_CONNECTION_RETRIES 5 +#endif + +#include "Xintconn.h" + +/* prototypes */ +static void GetAuthorization( + XtransConnInfo trans_conn, + int family, + char *saddr, + int saddrlen, + int idisplay, + char **auth_namep, + int *auth_namelenp, + char **auth_datap, + int *auth_datalenp); + +/* functions */ +static char *copystring (const char *src, int len) +{ + char *dst = Xmalloc (len + 1); + + if (dst) { + strncpy (dst, src, len); + dst[len] = '\0'; + } + + return dst; +} + +#define Xstrdup(s) copystring(s, strlen(s)) + +#ifdef TCPCONN +# define TCP_TRANS "tcp" +#endif +#ifdef UNIXCONN +# define UNIX_TRANS "unix" +#endif +#if defined(LOCALCONN) || defined(UNIXCONN) +# define LOCAL_TRANS "local" +#endif + +/* FIXME: This should be handled through Makefile/configure logic. See configure.ac in upstream libX11 */ + +#ifdef UNIXCONN +# ifdef TCPCONN +# define LOCAL_TRANSPORT_LIST LOCAL_TRANS,UNIX_TRANS,TCP_TRANS +# else +# define LOCAL_TRANSPORT_LIST LOCAL_TRANS,UNIX_TRANS +# endif +#else +# ifdef TCPCONN +# define LOCAL_TRANSPORT_LIST TCP_TRANS +# else +# define LOCAL_TRANSPORT_LIST +# endif +#endif + + + + +/* + * Attempts to connect to server, given display name. Returns file descriptor + * (network socket) or -1 if connection fails. Display names may be of the + * following format: + * + * [protocol/] [hostname] : [:] displaynumber [.screennumber] + * + * A string with exactly two colons seperating hostname from the + * display indicates a (now unsupported) DECnet style name. Colons in + * the hostname may occur if an IPv6 numeric address is used as the + * hostname. An IPv6 numeric address may also end in a double colon, + * so three colons in a row indicates an IPv6 address ending in :: + * followed by :display. To make it easier for people to read, an + * IPv6 numeric address hostname may be surrounded by [ ] in a similar + * fashion to the IPv6 numeric address URL syntax defined by IETF RFC + * 2732. + * + * If no hostname and no protocol is specified, the string is interpreted + * as the most efficient local connection to a server on the same machine. + * This is usually: + * + * o shared memory + * o local stream + * o UNIX domain socket + * o TCP to local host + * + * This function will eventually call the X Transport Interface functions + * which expects the hostname in the format: + * + * [protocol/] [hostname] : [:] displaynumber + * + */ +XtransConnInfo +_X11TransConnectDisplay ( + char *display_name, + char **fullnamep, /* RETURN */ + int *dpynump, /* RETURN */ + int *screenp, /* RETURN */ + char **auth_namep, /* RETURN */ + int *auth_namelenp, /* RETURN */ + char **auth_datap, /* RETURN */ + int *auth_datalenp) /* RETURN */ +{ + int family; + int saddrlen; + Xtransaddr *saddr; + char *lastp, *lastc, *p; /* char pointers */ + char *pprotocol = NULL; /* start of protocol name */ + char *phostname = NULL; /* start of host of display */ + char *pdpynum = NULL; /* start of dpynum of display */ + char *pscrnum = NULL; /* start of screen of display */ + int idisplay = 0; /* required display number */ + int iscreen = 0; /* optional screen number */ + /* int (*connfunc)(); */ /* method to create connection */ + int len, hostlen; /* length tmp variable */ + int retry; /* retry counter */ + char addrbuf[128]; /* final address passed to + X Transport Interface */ + char* address = addrbuf; + XtransConnInfo trans_conn = NULL; /* transport connection object */ + int connect_stat; +#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) + Bool reset_hostname = False; /* Reset hostname? */ + char *original_hostname = NULL; + int local_transport_index = -1; + const char *local_transport[] = { LOCAL_TRANSPORT_LIST, NULL }; +#endif + + p = display_name; + + saddrlen = 0; /* set so that we can clear later */ + saddr = NULL; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Called with display_name [%s].\n", display_name); +#endif + +#ifdef NX_TRANS_SOCKET + + /* + * Check if user selected the "nx" + * protocol or an "nx" hostname. + */ + + if (!strncasecmp(p, "nx/", 3) || !strcasecmp(p, "nx") || + !strncasecmp(p, "nx:", 3) || !strncasecmp(p, "nx,", 3)) + { + if (*(display_name + 2) == '/') + { + p += 3; + } + + pprotocol = copystring ("nx", 2); + + if (!pprotocol) goto bad; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_X11TransConnectDisplay: Forced protocol to [%s].\n", pprotocol); +#endif + + } + else + { + +#endif + + /* + * Step 0, find the protocol. This is delimited by the optional + * slash ('/'). + */ + for (lastp = p; *p && *p != ':' && *p != '/'; p++) ; + if (!*p) return NULL; /* must have a colon */ + + if (p != lastp && *p != ':') { /* protocol given? */ + pprotocol = copystring (lastp, p - lastp); + if (!pprotocol) goto bad; /* no memory */ + p++; /* skip the '/' */ + } else + p = display_name; /* reset the pointer in + case no protocol was given */ +#ifdef NX_TRANS_SOCKET + + } /* End of step 0. */ + + /* + * Check if user specified the "nx" protocol or + * hostname is "nx" or in the form "nx,...". + */ + + if (pprotocol && !strcasecmp(pprotocol, "nx")) + { + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_X11TransConnectDisplay: Checking hostname [%s].\n", p); +#endif + + /* + * Options can include a "display=" tuple so + * need to scan right to left. + */ + + lastp = p; + lastc = NULL; + + for (; *p; p++) + if (*p == ':') + lastc = p; + + /* + * Don't complain if no screen was provided. + */ + + if (lastc) + { + phostname = copystring (lastp, lastc - lastp); + + p = lastc; + } + else + { + phostname = copystring (lastp, strlen(lastp)); + } + + if (!phostname) goto bad; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_X11TransConnectDisplay: Forced hostname [%s].\n", phostname); +#endif + + } + else + { + +#endif + + /* + * Step 1, find the hostname. This is delimited by either one colon, + * or two colons in the case of DECnet (DECnet Phase V allows a single + * colon in the hostname). (See note above regarding IPv6 numeric + * addresses with triple colons or [] brackets.) + * FIXME: we do not support DECnet anymore, so maybe remove these checks? + */ + + lastp = p; + lastc = NULL; + for (; *p; p++) + if (*p == ':') + lastc = p; + + if (!lastc) return NULL; /* must have a colon */ + + if ((lastp != lastc) && (*(lastc - 1) == ':') +#if defined(IPv6) && defined(AF_INET6) + && ( ((lastc - 1) == lastp) || (*(lastc - 2) != ':')) +#endif + ) { + /* DECnet display specified */ + + goto bad; + } + else + hostlen = lastc - lastp; + + if (hostlen > 0) { /* hostname given? */ + phostname = copystring (lastp, hostlen); + if (!phostname) goto bad; /* no memory */ + } + + p = lastc; + +#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) + /* check if phostname == localnodename AND protocol not specified */ + if (!pprotocol && phostname) { + char localhostname[256]; + + if ((_XGetHostname (localhostname, sizeof localhostname) > 0) + && (strcmp(phostname, localhostname) == 0)) { + original_hostname = phostname; + phostname = NULL; + reset_hostname = True; + } + } +#endif + +#ifdef NX_TRANS_SOCKET + + } /* End of step 1. */ + + /* + * Check if no display was specified. In this case + * search the "port=n" option in NX host string. + */ + + if (*p) + { + +#endif + + + /* + * Step 2, find the display number. This field is required and is + * delimited either by a nul or a period, depending on whether or not + * a screen number is present. + */ + + for (lastp = ++p; *p && isascii(*p) && isdigit(*p); p++) ; + if ((p == lastp) || /* required field */ + (*p != '\0' && *p != '.') || /* invalid non-digit terminator */ + !(pdpynum = copystring (lastp, p - lastp))) /* no memory */ + goto bad; + idisplay = atoi (pdpynum); + +#ifdef NX_TRANS_SOCKET + + } + else + { + char *host = NULL; + char *name = NULL; + char *value = NULL; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_X11TransConnectDisplay: Searching port in port [%s].\n", phostname); +#endif + + if (!strncasecmp(phostname, "nx,", 3)) + { + host = copystring(phostname + 3, strlen(phostname) - 3); + } + + if (!host) goto bad; + + idisplay = -1; + + name = strtok(host, "="); + + while (name) + { + value = strtok(NULL, ","); + + if (value == NULL || strstr(value, "=") != NULL || + strstr(name, ",") != NULL || strlen(value) >= 128) + { + Xfree(host); + + goto bad; + } + else if (strcasecmp(name, "port") == 0) + { + idisplay = atoi(value); + + pdpynum = copystring(value, strlen(value)); + + if (!pdpynum) goto bad; + + break; + } + + name = strtok(NULL, "="); + } + + Xfree(host); + + if (idisplay == -1) + { + goto bad; + } + + } /* End of step 2. */ + +#endif + + + /* + * Step 3, find the screen number. This field is optional. It is + * present only if the display number was followed by a period (which + * we've already verified is the only non-nul character). + */ + + if (*p) { + for (lastp = ++p; *p && isascii(*p) && isdigit (*p); p++) ; + if (p != lastp) { + if (*p || /* non-digits */ + !(pscrnum = copystring (lastp, p - lastp))) /* no memory */ + goto bad; + iscreen = atoi (lastp); + } + } + + /* + * At this point, we know the following information: + * + * pprotocol protocol string or NULL + * phostname hostname string or NULL + * idisplay display number + * iscreen screen number + * + * We can now decide which transport to use based on the ConnectionFlags + * build parameter the hostname string. If phostname is NULL or equals + * the string "local", then choose the best transport. If phostname + * is "unix", then choose BSD UNIX domain sockets (if configured). + */ + +#ifdef NX_TRANS_SOCKET + + /* + * If user selected the "nx" protocol + * force "local" transport. + */ + + if (pprotocol && !strcasecmp(pprotocol, "nx")) + { + pprotocol = copystring ("local", 5); + + if (!pprotocol) goto bad; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_X11TransConnectDisplay: Converted protocol to [%s].\n", pprotocol); +#endif + + } + +#endif + +#if defined(TCPCONN) || defined(UNIXCONN) || defined(LOCALCONN) || defined(MNX_TCPCONN) + if (!pprotocol) { +#if defined(UNIXCONN) + if (phostname && (strcmp (phostname, "unix") == 0)) { + Xfree(pprotocol); + pprotocol = copystring ("unix", 4); + } else +#endif +#ifdef HAVE_LAUNCHD + if (phostname && phostname[0]=='/') { + pprotocol = copystring ("local", 5); + } +#endif + if (!phostname) + { + if (local_transport[0] != NULL) { + pprotocol = Xstrdup(local_transport[0]); + local_transport_index = 0; + } + } + + if (!pprotocol) { /* if still not found one, tcp is our last resort */ + pprotocol = copystring ("tcp", 3); + } + } +#endif + + + connect: + /* + * This seems kind of backwards, but we need to put the protocol, + * host, and port back together to pass to _X11TransOpenCOTSClient(). + */ + + { + int olen = 3 + (pprotocol ? strlen(pprotocol) : 0) + + (phostname ? strlen(phostname) : 0) + + (pdpynum ? strlen(pdpynum) : 0); + if (olen > sizeof addrbuf) address = Xmalloc (olen); + } + if (!address) goto bad; + + sprintf(address,"%s/%s:%d", + pprotocol ? pprotocol : "", + phostname ? phostname : "", + idisplay ); + + /* + * Make the connection, also need to get the auth address info for + * the connection. Do retries in case server host has hit its + * backlog (which, unfortunately, isn't distinguishable from there not + * being a server listening at all, which is why we have to not retry + * too many times). + */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Entering connection loop.\n"); +#endif + for(retry=X_CONNECTION_RETRIES; retry>=0; retry-- ) + { +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransOpenCOTSClient(address) with address [%s].\n", address); +#endif + if ( (trans_conn = _X11TransOpenCOTSClient(address)) == NULL ) + { + break; + } +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConnect(trans_conn,address).\n"); +#endif + if ((connect_stat = _X11TransConnect(trans_conn,address)) < 0 ) + { +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransClose(trans_conn).\n"); +#endif + _X11TransClose(trans_conn); + trans_conn = NULL; + + if (connect_stat == TRANS_TRY_CONNECT_AGAIN) + continue; + else + break; + } + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr).\n"); +#endif + _X11TransGetPeerAddr(trans_conn, &family, &saddrlen, &saddr); + + /* + * The family is given in a socket format (ie AF_INET). This + * will convert it to the format used by the authorization and + * X protocol (ie FamilyInternet). + */ + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Going to call _X11TransConvertAddress(&family, &saddrlen, &saddr).\n"); +#endif + if( _X11TransConvertAddress(&family, &saddrlen, &saddr) < 0 ) + { + _X11TransClose(trans_conn); + trans_conn = NULL; + if (saddr) + { + free ((char *) saddr); + saddr = NULL; + } + continue; + } + + break; + } + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "_X11TransConnectDisplay: Out of connection loop.\n"); +#endif + if (address != addrbuf) Xfree (address); + address = addrbuf; + + if( trans_conn == NULL ) + goto bad; + + /* + * Set close-on-exec so that programs that fork() doesn't get confused. + */ + + _X11TransSetOption(trans_conn,TRANS_CLOSEONEXEC,1); + + /* + * Build the expanded display name: + * + * [host] : [:] dpy . scr \0 + */ +#if defined(LOCALCONN) || defined(TCPCONN) || defined(UNIXCONN) + /* + * If we computed the host name, get rid of it so that + * XDisplayString() and XDisplayName() agree. + */ + if (reset_hostname && (phostname != original_hostname)) { + Xfree (phostname); + phostname = original_hostname; + original_hostname = NULL; + } +#endif + len = ((phostname ? strlen(phostname) : 0) + 1 + + strlen(pdpynum) + 1 + (pscrnum ? strlen(pscrnum) : 1) + 1); + *fullnamep = (char *) Xmalloc (len); + if (!*fullnamep) goto bad; + +#ifdef HAVE_LAUNCHD + if (phostname && strlen(phostname) > 11 && !strncmp(phostname, "/tmp/launch", 11)) + sprintf (*fullnamep, "%s%s%d", + (phostname ? phostname : ""), + ":", + idisplay); + else +#endif + sprintf (*fullnamep, "%s%s%d.%d", + (phostname ? phostname : ""), + ":", + idisplay, iscreen); + + *dpynump = idisplay; + *screenp = iscreen; + if (pprotocol) Xfree (pprotocol); + if (phostname) Xfree (phostname); + if (pdpynum) Xfree (pdpynum); + if (pscrnum) Xfree (pscrnum); +#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) + if (original_hostname) Xfree (original_hostname); +#endif + + GetAuthorization(trans_conn, family, (char *) saddr, saddrlen, idisplay, + auth_namep, auth_namelenp, auth_datap, auth_datalenp); + return trans_conn; + + + /* + * error return; make sure everything is cleaned up. + */ + bad: + if (trans_conn) (void)_X11TransClose(trans_conn); + if (saddr) free ((char *) saddr); + if (pprotocol) Xfree (pprotocol); + if (phostname) Xfree (phostname); + if (address && address != addrbuf) { Xfree(address); address = addrbuf; } + +#if defined(LOCALCONN) || defined(UNIXCONN) || defined(TCPCONN) + /* If connecting to the local machine, and we failed, try again with + * the next transport type available, if there is one. + */ + if (local_transport_index >= 0) { + if (local_transport[++local_transport_index] != NULL) { + pprotocol = Xstrdup(local_transport[local_transport_index]); +#ifdef TCPCONN + if (strcmp(pprotocol, "tcp") == 0) { + if (original_hostname != NULL) { + phostname = original_hostname; + original_hostname = NULL; + } else { + phostname = copystring("localhost", 9); + } + } else +#endif /* TCPCONN */ + { + if ((phostname != NULL) && (original_hostname == NULL)) { + original_hostname = phostname; + } + phostname = NULL; + } + goto connect; + } + } + + /* No more to try, we've failed all available local transports */ + if (original_hostname) Xfree(original_hostname); +#endif /* LOCALCONN || UNIXCONN || TCPCONN */ + + if (pdpynum) Xfree (pdpynum); + if (pscrnum) Xfree (pscrnum); + return NULL; + +} + +/* + * This is gross, but we need it for compatiblity. + * The test suite relies on the following interface. + * + */ + +int _XConnectDisplay ( + char *display_name, + char **fullnamep, /* RETURN */ + int *dpynump, /* RETURN */ + int *screenp, /* RETURN */ + char **auth_namep, /* RETURN */ + int *auth_namelenp, /* RETURN */ + char **auth_datap, /* RETURN */ + int *auth_datalenp) /* RETURN */ +{ + XtransConnInfo trans_conn; + + trans_conn = _X11TransConnectDisplay ( + display_name, fullnamep, dpynump, screenp, + auth_namep, auth_namelenp, auth_datap, auth_datalenp); + + if (trans_conn) + { + int fd = _X11TransGetConnectionNumber (trans_conn); + _X11TransFreeConnInfo (trans_conn); + return (fd); + } + else + return (-1); +} + + +/***************************************************************************** + * * + * Connection Utility Routines * + * * + *****************************************************************************/ + +/* + * Disconnect from server. + */ + +int _XDisconnectDisplay (XtransConnInfo trans_conn) +{ + _X11TransDisconnect(trans_conn); + _X11TransClose(trans_conn); + return 0; +} + + + +Bool +_XSendClientPrefix( + Display *dpy, + xConnClientPrefix *client, /* contains count for auth_* */ + char *auth_proto, char *auth_string, /* NOT null-terminated */ + xConnSetupPrefix *prefix) /* prefix information */ +{ + int auth_length = client->nbytesAuthProto; + int auth_strlen = client->nbytesAuthString; + static char padbuf[3]; /* for padding to 4x bytes */ + int pad; + struct iovec iovarray[5], *iov = iovarray; + int niov = 0; + int len = 0; + +#define add_to_iov(b,l) \ + { iov->iov_base = (b); iov->iov_len = (l); iov++, niov++; len += (l); } + + add_to_iov ((caddr_t) client, SIZEOF(xConnClientPrefix)); + + /* + * write authorization protocol name and data + */ + if (auth_length > 0) { + add_to_iov (auth_proto, auth_length); + pad = -auth_length & 3; /* pad auth_length to a multiple of 4 */ + if (pad) add_to_iov (padbuf, pad); + } + if (auth_strlen > 0) { + add_to_iov (auth_string, auth_strlen); + pad = -auth_strlen & 3; /* pad auth_strlen to a multiple of 4 */ + if (pad) add_to_iov (padbuf, pad); + } + +#undef add_to_iov + + len -= _X11TransWritev (dpy->trans_conn, iovarray, niov); + + /* + * Set the connection non-blocking since we use select() to block. + */ + + _X11TransSetOption(dpy->trans_conn, TRANS_NONBLOCKING, 1); + + if (len != 0) + return -1; +#ifdef NX_TRANS_SOCKET + if (_NXDisplayWriteFunction != NULL) { + (*_NXDisplayWriteFunction)(dpy, len); + } +#ifdef NX_TRANS_CHANGE + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } +#endif +#endif + +#ifdef K5AUTH + if (auth_length == 14 && + !strncmp(auth_proto, "MIT-KERBEROS-5", 14)) + { + return k5_clientauth(dpy, prefix); + } else +#endif + return 0; +} + + + +#ifdef SECURE_RPC +#include +#ifdef ultrix +#include +#include +#endif +#endif + +#ifdef HASXDMAUTH +#include +#define Time_t time_t +#endif + +/* + * First, a routine for setting authorization data + */ +static int xauth_namelen = 0; +static char *xauth_name = NULL; /* NULL means use default mechanism */ +static int xauth_datalen = 0; +static char *xauth_data = NULL; /* NULL means get default data */ + +/* + * This is a list of the authorization names which Xlib currently supports. + * Xau will choose the file entry which matches the earliest entry in this + * array, allowing us to prioritize these in terms of the most secure first + */ + +static char *default_xauth_names[] = { +#ifdef K5AUTH + "MIT-KERBEROS-5", +#endif +#ifdef SECURE_RPC + "SUN-DES-1", +#endif +#ifdef HASXDMAUTH + "XDM-AUTHORIZATION-1", +#endif + "MIT-MAGIC-COOKIE-1" +}; + +static _Xconst int default_xauth_lengths[] = { +#ifdef K5AUTH + 14, /* strlen ("MIT-KERBEROS-5") */ +#endif +#ifdef SECURE_RPC + 9, /* strlen ("SUN-DES-1") */ +#endif +#ifdef HASXDMAUTH + 19, /* strlen ("XDM-AUTHORIZATION-1") */ +#endif + 18 /* strlen ("MIT-MAGIC-COOKIE-1") */ +}; + +#define NUM_DEFAULT_AUTH (sizeof (default_xauth_names) / sizeof (default_xauth_names[0])) + +static char **xauth_names = default_xauth_names; +static _Xconst int *xauth_lengths = default_xauth_lengths; + +static int xauth_names_length = NUM_DEFAULT_AUTH; + +void XSetAuthorization ( + char *name, int namelen, /* *len are lengths of name and data */ + char *data, int datalen) /* name/data are NULL or arbitrary array of bytes */ +{ + char *tmpname, *tmpdata; + + _XLockMutex(_Xglobal_lock); + if (xauth_name) Xfree (xauth_name); /* free any existing data */ + if (xauth_data) Xfree (xauth_data); + + xauth_name = xauth_data = NULL; /* mark it no longer valid */ + xauth_namelen = xauth_datalen = 0; + _XUnlockMutex(_Xglobal_lock); + + if (namelen < 0) namelen = 0; /* check for bogus inputs */ + if (datalen < 0) datalen = 0; /* maybe should return? */ + + if (namelen > 0) { /* try to allocate space */ + tmpname = Xmalloc ((unsigned) namelen); + if (!tmpname) return; + memcpy (tmpname, name, namelen); + } else { + tmpname = NULL; + } + + if (datalen > 0) { + tmpdata = Xmalloc ((unsigned) datalen); + if (!tmpdata) { + if (tmpname) (void) Xfree (tmpname); + return; + } + memcpy (tmpdata, data, datalen); + } else { + tmpdata = NULL; + } + + _XLockMutex(_Xglobal_lock); + xauth_name = tmpname; /* and store the suckers */ + xauth_namelen = namelen; + if (tmpname) + { + xauth_names = &xauth_name; + xauth_lengths = &xauth_namelen; + xauth_names_length = 1; + } + else + { + xauth_names = default_xauth_names; + xauth_lengths = default_xauth_lengths; + xauth_names_length = NUM_DEFAULT_AUTH; + } + xauth_data = tmpdata; + xauth_datalen = datalen; + _XUnlockMutex(_Xglobal_lock); + return; +} + +#ifdef SECURE_RPC +/* + * Create a credential that we can send to the X server. + */ +static int +auth_ezencode( + char *servername, + int window, + char *cred_out, + int *len) +{ + AUTH *a; + XDR xdr; + +#if defined(SVR4) && defined(sun) + a = authdes_seccreate(servername, window, NULL, NULL); +#else + a = (AUTH *)authdes_create(servername, window, NULL, NULL); +#endif + if (a == (AUTH *)NULL) { + perror("auth_create"); + return 0; + } + xdrmem_create(&xdr, cred_out, *len, XDR_ENCODE); + if (AUTH_MARSHALL(a, &xdr) == FALSE) { + perror("auth_marshall"); + AUTH_DESTROY(a); + return 0; + } + *len = xdr_getpos(&xdr); + AUTH_DESTROY(a); + return 1; +} +#endif + +#ifdef K5AUTH +#include + +extern krb5_flags krb5_kdc_default_options; + +/* + * k5_clientauth + * + * Returns non-zero if the setup prefix has been read, + * so we can tell XOpenDisplay to not bother looking for it by + * itself. + */ +static int k5_clientauth(dpy, sprefix) + Display *dpy; + xConnSetupPrefix *sprefix; +{ + krb5_error_code retval; + xReq prefix; + char *buf; + CARD16 plen, tlen; + krb5_data kbuf; + krb5_ccache cc; + krb5_creds creds; + krb5_principal cprinc, sprinc; + krb5_ap_rep_enc_part *repl; + + krb5_init_ets(); + /* + * stage 0: get encoded principal and tgt from server + */ + _XRead(dpy, (char *)&prefix, sz_xReq); + if (prefix.reqType != 2 && prefix.reqType != 3) + /* not an auth packet... so deal */ + if (prefix.reqType == 0 || prefix.reqType == 1) + { + memcpy((char *)sprefix, (char *)&prefix, sz_xReq); + _XRead(dpy, (char *)sprefix + sz_xReq, + sz_xConnSetupPrefix - sz_xReq); /* ewww... gross */ + return 1; + } + else + { + fprintf(stderr, + "Xlib: Krb5 stage 0: got illegal connection setup success code %d\n", + prefix.reqType); + return -1; + } + if (prefix.data != 0) + { + fprintf(stderr, "Xlib: got out of sequence (%d) packet in Krb5 auth\n", + prefix.data); + return -1; + } + buf = (char *)malloc((prefix.length << 2) - sz_xReq); + if (buf == NULL) /* malloc failed. Run away! */ + { + fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); + return -1; + } + tlen = (prefix.length << 2) - sz_xReq; + _XRead(dpy, buf, tlen); + if (prefix.reqType == 2 && tlen < 6) + { + fprintf(stderr, "Xlib: Krb5 stage 0 reply from server too short\n"); + free(buf); + return -1; + } + if (prefix.reqType == 2) + { + plen = *(CARD16 *)buf; + kbuf.data = buf + 2; + kbuf.length = (plen > tlen) ? tlen : plen; + } + else + { + kbuf.data = buf; + kbuf.length = tlen; + } + if (XauKrb5Decode(kbuf, &sprinc)) + { + free(buf); + fprintf(stderr, "Xlib: XauKrb5Decode bombed\n"); + return -1; + } + if (prefix.reqType == 3) /* do some special stuff here */ + { + char *sname, *hostname = NULL; + + sname = (char *)malloc(krb5_princ_component(sprinc, 0)->length + 1); + if (sname == NULL) + { + free(buf); + krb5_free_principal(sprinc); + fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); + return -1; + } + memcpy(sname, krb5_princ_component(sprinc, 0)->data, + krb5_princ_component(sprinc, 0)->length); + sname[krb5_princ_component(sprinc, 0)->length] = '\0'; + krb5_free_principal(sprinc); + if (dpy->display_name[0] != ':') /* hunt for a hostname */ + { + char *t; + + if ((hostname = (char *)malloc(strlen(dpy->display_name))) + == NULL) + { + free(buf); + free(sname); + fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); + return -1; + } + strcpy(hostname, dpy->display_name); + t = strchr(hostname, ':'); + if (t == NULL) + { + free(buf); + free(sname); + free(hostname); + fprintf(stderr, + "Xlib: shouldn't get here! malformed display name."); + return -1; + } + if ((t - hostname + 1 < strlen(hostname)) && t[1] == ':') + t++; + *t = '\0'; /* truncate the dpy number out */ + } + retval = krb5_sname_to_principal(hostname, sname, + KRB5_NT_SRV_HST, &sprinc); + free(sname); + if (hostname) + free(hostname); + if (retval) + { + free(buf); + fprintf(stderr, "Xlib: krb5_sname_to_principal failed: %s\n", + error_message(retval)); + return -1; + } + } + if (retval = krb5_cc_default(&cc)) + { + free(buf); + krb5_free_principal(sprinc); + fprintf(stderr, "Xlib: krb5_cc_default failed: %s\n", + error_message(retval)); + return -1; + } + if (retval = krb5_cc_get_principal(cc, &cprinc)) + { + free(buf); + krb5_free_principal(sprinc); + fprintf(stderr, "Xlib: cannot get Kerberos principal from \"%s\": %s\n", + krb5_cc_default_name(), error_message(retval)); + return -1; + } + bzero((char *)&creds, sizeof(creds)); + creds.server = sprinc; + creds.client = cprinc; + if (prefix.reqType == 2) + { + creds.second_ticket.length = tlen - plen - 2; + creds.second_ticket.data = buf + 2 + plen; + retval = krb5_get_credentials(KRB5_GC_USER_USER | + krb5_kdc_default_options, + cc, &creds); + } + else + retval = krb5_get_credentials(krb5_kdc_default_options, + cc, &creds); + if (retval) + { + free(buf); + krb5_free_cred_contents(&creds); + fprintf(stderr, "Xlib: cannot get Kerberos credentials: %s\n", + error_message(retval)); + return -1; + } + /* + * now format the ap_req to send to the server + */ + if (prefix.reqType == 2) + retval = krb5_mk_req_extended(AP_OPTS_USE_SESSION_KEY | + AP_OPTS_MUTUAL_REQUIRED, NULL, + 0, 0, NULL, cc, + &creds, NULL, &kbuf); + else + retval = krb5_mk_req_extended(AP_OPTS_MUTUAL_REQUIRED, NULL, + 0, 0, NULL, cc, &creds, NULL, + &kbuf); + free(buf); + if (retval) /* Some manner of Kerberos lossage */ + { + krb5_free_cred_contents(&creds); + fprintf(stderr, "Xlib: krb5_mk_req_extended failed: %s\n", + error_message(retval)); + return -1; + } + prefix.reqType = 1; + prefix.data = 0; + prefix.length = (kbuf.length + sz_xReq + 3) >> 2; + /* + * stage 1: send ap_req to server + */ + _XSend(dpy, (char *)&prefix, sz_xReq); + _XSend(dpy, (char *)kbuf.data, kbuf.length); + free(kbuf.data); + /* + * stage 2: get ap_rep from server to mutually authenticate + */ + _XRead(dpy, (char *)&prefix, sz_xReq); + if (prefix.reqType != 2) + if (prefix.reqType == 0 || prefix.reqType == 1) + { + memcpy((char *)sprefix, (char *)&prefix, sz_xReq); + _XRead(dpy, (char *)sprefix + sz_xReq, + sz_xConnSetupPrefix - sz_xReq); + return 1; + } + else + { + fprintf(stderr, + "Xlib: Krb5 stage 2: got illegal connection setup success code %d\n", + prefix.reqType); + return -1; + } + if (prefix.data != 2) + return -1; + kbuf.length = (prefix.length << 2) - sz_xReq; + kbuf.data = (char *)malloc(kbuf.length); + if (kbuf.data == NULL) + { + fprintf(stderr, "Xlib: malloc bombed in Krb5 auth\n"); + return -1; + } + _XRead(dpy, (char *)kbuf.data, kbuf.length); + retval = krb5_rd_rep(&kbuf, &creds.keyblock, &repl); + if (retval) + { + free(kbuf.data); + fprintf(stderr, "Xlib: krb5_rd_rep failed: %s\n", + error_message(retval)); + return -1; + } + free(kbuf.data); + /* + * stage 3: send a short ack to the server and return + */ + prefix.reqType = 3; + prefix.data = 0; + prefix.length = sz_xReq >> 2; + _XSend(dpy, (char *)&prefix, sz_xReq); + return 0; +} +#endif /* K5AUTH */ + +static void +GetAuthorization( + XtransConnInfo trans_conn, + int family, + char *saddr, + int saddrlen, + int idisplay, + char **auth_namep, /* RETURN */ + int *auth_namelenp, /* RETURN */ + char **auth_datap, /* RETURN */ + int *auth_datalenp) /* RETURN */ +{ +#ifdef SECURE_RPC + char rpc_cred[MAX_AUTH_BYTES]; +#endif +#ifdef HASXDMAUTH + unsigned char xdmcp_data[192/8]; +#endif + char *auth_name; + int auth_namelen; + unsigned char *auth_data; + int auth_datalen; + Xauth *authptr = NULL; + +/* + * Look up the authorization protocol name and data if necessary. + */ + if (xauth_name && xauth_data) { + auth_namelen = xauth_namelen; + auth_name = xauth_name; + auth_datalen = xauth_datalen; + auth_data = (unsigned char *) xauth_data; + } else { + char dpynumbuf[40]; /* big enough to hold 2^64 and more */ + (void) sprintf (dpynumbuf, "%d", idisplay); + + authptr = XauGetBestAuthByAddr ((unsigned short) family, + (unsigned short) saddrlen, + saddr, + (unsigned short) strlen (dpynumbuf), + dpynumbuf, + xauth_names_length, + xauth_names, + xauth_lengths); + if (authptr) { + auth_namelen = authptr->name_length; + auth_name = (char *)authptr->name; + auth_datalen = authptr->data_length; + auth_data = (unsigned char *) authptr->data; + } else { + auth_namelen = 0; + auth_name = NULL; + auth_datalen = 0; + auth_data = NULL; + } + } +#ifdef HASXDMAUTH + /* + * build XDM-AUTHORIZATION-1 data + */ + if (auth_namelen == 19 && !strncmp (auth_name, "XDM-AUTHORIZATION-1", 19)) + { + int i, j; + Time_t now; + int family, addrlen; + Xtransaddr *addr = NULL; + + for (j = 0; j < 8; j++) + xdmcp_data[j] = auth_data[j]; + + _X11TransGetMyAddr(trans_conn, &family, &addrlen, &addr); + + switch( family ) + { +#ifdef AF_INET + case AF_INET: + { + /* + * addr will contain a sockaddr_in with all + * of the members already in network byte order. + */ + + for(i=4; i<8; i++) /* do sin_addr */ + xdmcp_data[j++] = ((char *)addr)[i]; + for(i=2; i<4; i++) /* do sin_port */ + xdmcp_data[j++] = ((char *)addr)[i]; + break; + } +#endif /* AF_INET */ +#if defined(IPv6) && defined(AF_INET6) + case AF_INET6: + /* XXX This should probably never happen */ + { + unsigned char ipv4mappedprefix[] = { + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0xff, 0xff }; + + /* In the case of v4 mapped addresses send the v4 + part of the address - addr is already in network byte order */ + if (memcmp((char*)addr+8, ipv4mappedprefix, 12) == 0) { + for (i = 20 ; i < 24; i++) + xdmcp_data[j++] = ((char *)addr)[i]; + + /* Port number */ + for (i=2; i<4; i++) + xdmcp_data[j++] = ((char *)addr)[i]; + } else { + /* Fake data to keep the data aligned. Otherwise the + the server will bail about incorrect timing data */ + for (i = 0; i < 6; i++) { + xdmcp_data[j++] = 0; + } + } + break; + } +#endif /* AF_INET6 */ +#ifdef AF_UNIX + case AF_UNIX: + { + /* + * We don't use the sockaddr_un for this encoding. + * Instead, we create a sockaddr_in filled with + * a decreasing counter for the address, and the + * pid for the port. + */ + + static unsigned long unix_addr = 0xFFFFFFFF; + unsigned long the_addr; + unsigned short the_port; + unsigned long the_utime; + struct timeval tp; + + X_GETTIMEOFDAY(&tp); + _XLockMutex(_Xglobal_lock); + the_addr = unix_addr--; + _XUnlockMutex(_Xglobal_lock); + the_utime = (unsigned long) tp.tv_usec; + the_port = getpid (); + + xdmcp_data[j++] = (the_utime >> 24) & 0xFF; + xdmcp_data[j++] = (the_utime >> 16) & 0xFF; + xdmcp_data[j++] = ((the_utime >> 8) & 0xF0) + | ((the_addr >> 8) & 0x0F); + xdmcp_data[j++] = (the_addr >> 0) & 0xFF; + xdmcp_data[j++] = (the_port >> 8) & 0xFF; + xdmcp_data[j++] = (the_port >> 0) & 0xFF; + break; + } +#endif /* AF_UNIX */ + default: + /* + * Need to return some kind of errro status here. + * maybe a NULL auth?? + */ + break; + } /* switch */ + + if (addr) + free ((char *) addr); + + time (&now); + xdmcp_data[j++] = (now >> 24) & 0xFF; + xdmcp_data[j++] = (now >> 16) & 0xFF; + xdmcp_data[j++] = (now >> 8) & 0xFF; + xdmcp_data[j++] = (now >> 0) & 0xFF; + while (j < 192 / 8) + xdmcp_data[j++] = 0; + _XLockMutex(_Xglobal_lock); + /* this function might use static data, hence the lock around it */ + XdmcpWrap (xdmcp_data, auth_data + 8, + xdmcp_data, j); + _XUnlockMutex(_Xglobal_lock); + auth_data = xdmcp_data; + auth_datalen = j; + } +#endif /* HASXDMAUTH */ +#ifdef SECURE_RPC + /* + * The SUN-DES-1 authorization protocol uses the + * "secure RPC" mechanism in SunOS 4.0+. + */ + if (auth_namelen == 9 && !strncmp(auth_name, "SUN-DES-1", 9)) { + char servernetname[MAXNETNAMELEN + 1]; + + /* + * Copy over the server's netname from the authorization + * data field filled in by XauGetAuthByAddr(). + */ + if (auth_datalen > MAXNETNAMELEN) { + auth_datalen = 0; + auth_data = NULL; + } else { + memcpy(servernetname, auth_data, auth_datalen); + servernetname[auth_datalen] = '\0'; + + auth_datalen = sizeof (rpc_cred); + if (auth_ezencode(servernetname, 100, rpc_cred, + &auth_datalen)) + auth_data = (unsigned char *) rpc_cred; + else { + auth_datalen = 0; + auth_data = NULL; + } + } + } +#endif + if (saddr) free ((char *) saddr); + if ((*auth_namelenp = auth_namelen)) + { + if ((*auth_namep = Xmalloc(auth_namelen))) + memcpy(*auth_namep, auth_name, auth_namelen); + else + *auth_namelenp = 0; + } + else + *auth_namep = NULL; + if ((*auth_datalenp = auth_datalen)) + { + if ((*auth_datap = Xmalloc(auth_datalen))) + memcpy(*auth_datap, auth_data, auth_datalen); + else + *auth_datalenp = 0; + } + else + *auth_datap = NULL; + if (authptr) XauDisposeAuth (authptr); +} diff --git a/nx-X11/lib/src/Context.c b/nx-X11/lib/src/Context.c new file mode 100644 index 000000000..8a078713a --- /dev/null +++ b/nx-X11/lib/src/Context.c @@ -0,0 +1,302 @@ + +/*********************************************************** +Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, + + All Rights Reserved + +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 +supporting documentation, and that the name Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +/* + +Copyright 1987, 1988, 1990, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* This module implements a simple sparse array. + + XSaveContext(a,b,c,d) will store d in position (a,b,c) of the array. + XFindContext(a,b,c,&d) will set d to be the value in position (a,b,c). + XDeleteContext(a,b,c) will delete the entry in (a,b,c). + + a is a display id, b is a resource id, and c is a Context. d is just an + XPointer. This code will work with any range of parameters, but is geared + to be most efficient with very few (one or two) different a's. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" +#ifdef XTHREADS +#include "locking.h" +#endif + +#define INITHASHMASK 63 /* Number of entries originally in the hash table. */ + +typedef struct _TableEntryRec { /* Stores one entry. */ + XID rid; + XContext context; + XPointer data; + struct _TableEntryRec *next; +} TableEntryRec, *TableEntry; + +typedef struct _XContextDB { /* Stores hash table for one display. */ + TableEntry *table; /* Pointer to array of hash entries. */ + int mask; /* Current size of hash table minus 1. */ + int numentries; /* Number of entries currently in table. */ +#ifdef XTHREADS + LockInfoRec linfo; +#endif +} DBRec, *DB; + +#ifdef MOTIFBC +static DB NullDB = (DB)0; +#endif + +/* Given an XID and a context, returns a value between 0 and HashSize-1. + Currently, this requires that HashSize be a power of 2. +*/ + +#define Hash(db,rid,context) \ + (db)->table[(((rid) << 1) + context) & (db)->mask] + +/* Resize the given db */ + +static void ResizeTable(DB db) +{ + TableEntry *otable; + register TableEntry entry, next, *pold, *head; + register int i, j; + + otable = db->table; + for (i = INITHASHMASK+1; (i + i) < db->numentries; ) + i += i; + db->table = Xcalloc(i, sizeof(TableEntry)); + if (!db->table) { + db->table = otable; + return; + } + j = db->mask + 1; + db->mask = i - 1; + for (pold = otable ; --j >= 0; pold++) { + for (entry = *pold; entry; entry = next) { + next = entry->next; + head = &Hash(db, entry->rid, entry->context); + entry->next = *head; + *head = entry; + } + } + Xfree(otable); +} + +static void _XFreeContextDB(Display *display) +{ + register DB db; + register int i; + register TableEntry *pentry, entry, next; + + db = display->context_db; + if (db) { + for (i = db->mask + 1, pentry = db->table ; --i >= 0; pentry++) { + for (entry = *pentry; entry; entry = next) { + next = entry->next; + Xfree(entry); + } + } + Xfree(db->table); + _XFreeMutex(&db->linfo); + Xfree(db); + } +} + +/* Public routines. */ + +/* Save the given value of data to correspond with the keys XID and context. + Returns nonzero error code if an error has occured, 0 otherwise. + Possible errors are Out-of-memory. +*/ + +int XSaveContext( + Display *display, + register XID rid, + register XContext context, + _Xconst char* data) +{ + DB *pdb; + register DB db; + TableEntry *head; + register TableEntry entry; + +#ifdef MOTIFBC + if (!display) { + pdb = &NullDB; + db = *pdb; + } else +#endif + { + LockDisplay(display); + pdb = &display->context_db; + db = *pdb; + UnlockDisplay(display); + } + if (!db) { + db = Xmalloc(sizeof(DBRec)); + if (!db) + return XCNOMEM; + db->mask = INITHASHMASK; + db->table = Xcalloc(db->mask + 1, sizeof(TableEntry)); + if (!db->table) { + Xfree(db); + return XCNOMEM; + } + db->numentries = 0; + _XCreateMutex(&db->linfo); +#ifdef MOTIFBC + if (!display) *pdb = db; else +#endif + { + LockDisplay(display); + *pdb = db; + display->free_funcs->context_db = _XFreeContextDB; + UnlockDisplay(display); + } + } + _XLockMutex(&db->linfo); + head = &Hash(db, rid, context); + _XUnlockMutex(&db->linfo); + for (entry = *head; entry; entry = entry->next) { + if (entry->rid == rid && entry->context == context) { + entry->data = (XPointer)data; + return 0; + } + } + entry = Xmalloc(sizeof(TableEntryRec)); + if (!entry) + return XCNOMEM; + entry->rid = rid; + entry->context = context; + entry->data = (XPointer)data; + entry->next = *head; + *head = entry; + _XLockMutex(&db->linfo); + db->numentries++; + if (db->numentries > (db->mask << 2)) + ResizeTable(db); + _XUnlockMutex(&db->linfo); + return 0; +} + + + +/* Given an XID and context, returns the associated data. Note that data + here is a pointer since it is a return value. Returns nonzero error code + if an error has occured, 0 otherwise. Possible errors are Entry-not-found. +*/ + +int XFindContext(Display *display, XID rid, XContext context, XPointer *data) +{ + register DB db; + register TableEntry entry; + +#ifdef MOTIFBC + if (!display) db = NullDB; else +#endif + { + LockDisplay(display); + db = display->context_db; + UnlockDisplay(display); + } + if (!db) + return XCNOENT; + _XLockMutex(&db->linfo); + for (entry = Hash(db, rid, context); entry; entry = entry->next) + { + if (entry->rid == rid && entry->context == context) { + *data = (XPointer)entry->data; + _XUnlockMutex(&db->linfo); + return 0; + } + } + _XUnlockMutex(&db->linfo); + return XCNOENT; +} + + + +/* Deletes the entry for the given XID and context from the datastructure. + This returns the same thing that FindContext would have returned if called + with the same arguments. +*/ + +int XDeleteContext(Display *display, XID rid, XContext context) +{ + register DB db; + register TableEntry entry, *prev; + +#ifdef MOTIFBC + if (!display) db = NullDB; else +#endif + { + LockDisplay(display); + db = display->context_db; + UnlockDisplay(display); + } + if (!db) + return XCNOENT; + _XLockMutex(&db->linfo); + for (prev = &Hash(db, rid, context); + (entry = *prev); + prev = &entry->next) { + if (entry->rid == rid && entry->context == context) { + *prev = entry->next; + Xfree(entry); + db->numentries--; + if (db->numentries < db->mask && db->mask > INITHASHMASK) + ResizeTable(db); + _XUnlockMutex(&db->linfo); + return 0; + } + } + _XUnlockMutex(&db->linfo); + return XCNOENT; +} diff --git a/nx-X11/lib/src/ConvSel.c b/nx-X11/lib/src/ConvSel.c new file mode 100644 index 000000000..fb6e8e338 --- /dev/null +++ b/nx-X11/lib/src/ConvSel.c @@ -0,0 +1,53 @@ +/* + +Copyright 1986,1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XConvertSelection( + register Display *dpy, + Atom selection, + Atom target, + Atom property, + Window requestor, + Time time) +{ + register xConvertSelectionReq *req; + + LockDisplay(dpy); + GetReq(ConvertSelection, req); + req->selection = selection; + req->target = target; + req->property = property; + req->requestor = requestor; + req->time = time; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/CopyArea.c b/nx-X11/lib/src/CopyArea.c new file mode 100644 index 000000000..582582120 --- /dev/null +++ b/nx-X11/lib/src/CopyArea.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XCopyArea( + register Display *dpy, + Drawable src_drawable, + Drawable dst_drawable, + GC gc, + int src_x, + int src_y, + unsigned int width, + unsigned int height, + int dst_x, + int dst_y) + +{ + register xCopyAreaReq *req; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq(CopyArea, req); + req->srcDrawable = src_drawable; + req->dstDrawable = dst_drawable; + req->gc = gc->gid; + req->srcX = src_x; + req->srcY = src_y; + req->dstX = dst_x; + req->dstY = dst_y; + req->width = width; + req->height = height; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/CopyCmap.c b/nx-X11/lib/src/CopyCmap.c new file mode 100644 index 000000000..5444550cd --- /dev/null +++ b/nx-X11/lib/src/CopyCmap.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#else +#define XCMS 1 +#endif +#include "Xlibint.h" + +#if XCMS +#include "Xcmsint.h" + +/* cmsCmap.c */ +extern XcmsCmapRec * _XcmsCopyCmapRecAndFree(Display *dpy, + Colormap src_cmap, + Colormap copy_cmap); +#endif + +Colormap XCopyColormapAndFree( + register Display *dpy, + Colormap src_cmap) +{ + Colormap mid; + register xCopyColormapAndFreeReq *req; + + LockDisplay(dpy); + GetReq(CopyColormapAndFree, req); + + mid = req->mid = XAllocID(dpy); + req->srcCmap = src_cmap; + + UnlockDisplay(dpy); + SyncHandle(); + +#if XCMS + _XcmsCopyCmapRecAndFree(dpy, src_cmap, mid); +#endif + + return(mid); +} diff --git a/nx-X11/lib/src/CopyGC.c b/nx-X11/lib/src/CopyGC.c new file mode 100644 index 000000000..9c71249cf --- /dev/null +++ b/nx-X11/lib/src/CopyGC.c @@ -0,0 +1,138 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XCopyGC ( + register Display *dpy, + GC srcGC, + unsigned long mask, /* which ones to set initially */ + GC destGC) +{ + register XGCValues *destgv = &destGC->values, + *srcgv = &srcGC->values; + register xCopyGCReq *req; + register _XExtension *ext; + + LockDisplay(dpy); + + mask &= (1L << (GCLastBit + 1)) - 1; + /* if some of the source values to be copied are "dirty", flush them + out before sending the CopyGC request. */ + if (srcGC->dirty & mask) + _XFlushGCCache(dpy, srcGC); + + /* mark the copied values "not dirty" in the destination. */ + destGC->dirty &= ~mask; + + GetReq(CopyGC, req); + req->srcGC = srcGC->gid; + req->dstGC = destGC->gid; + req->mask = mask; + + if (mask & GCFunction) + destgv->function = srcgv->function; + + if (mask & GCPlaneMask) + destgv->plane_mask = srcgv->plane_mask; + + if (mask & GCForeground) + destgv->foreground = srcgv->foreground; + + if (mask & GCBackground) + destgv->background = srcgv->background; + + if (mask & GCLineWidth) + destgv->line_width = srcgv->line_width; + + if (mask & GCLineStyle) + destgv->line_style = srcgv->line_style; + + if (mask & GCCapStyle) + destgv->cap_style = srcgv->cap_style; + + if (mask & GCJoinStyle) + destgv->join_style = srcgv->join_style; + + if (mask & GCFillStyle) + destgv->fill_style = srcgv->fill_style; + + if (mask & GCFillRule) + destgv->fill_rule = srcgv->fill_rule; + + if (mask & GCArcMode) + destgv->arc_mode = srcgv->arc_mode; + + if (mask & GCTile) + destgv->tile = srcgv->tile; + + if (mask & GCStipple) + destgv->stipple = srcgv->stipple; + + if (mask & GCTileStipXOrigin) + destgv->ts_x_origin = srcgv->ts_x_origin; + + if (mask & GCTileStipYOrigin) + destgv->ts_y_origin = srcgv->ts_y_origin; + + if (mask & GCFont) + destgv->font = srcgv->font; + + if (mask & GCSubwindowMode) + destgv->subwindow_mode = srcgv->subwindow_mode; + + if (mask & GCGraphicsExposures) + destgv->graphics_exposures = srcgv->graphics_exposures; + + if (mask & GCClipXOrigin) + destgv->clip_x_origin = srcgv->clip_x_origin; + + if (mask & GCClipYOrigin) + destgv->clip_y_origin = srcgv->clip_y_origin; + + if (mask & GCClipMask) { + destGC->rects = srcGC->rects; + destgv->clip_mask = srcgv->clip_mask; + } + + if (mask & GCDashOffset) + destgv->dash_offset = srcgv->dash_offset; + + if (mask & GCDashList) { + destGC->dashes = srcGC->dashes; + destgv->dashes = srcgv->dashes; + } + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->copy_GC) (*ext->copy_GC)(dpy, destGC, &ext->codes); + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } diff --git a/nx-X11/lib/src/CopyPlane.c b/nx-X11/lib/src/CopyPlane.c new file mode 100644 index 000000000..818687687 --- /dev/null +++ b/nx-X11/lib/src/CopyPlane.c @@ -0,0 +1,66 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XCopyPlane( + register Display *dpy, + Drawable src_drawable, + Drawable dst_drawable, + GC gc, + int src_x, + int src_y, + unsigned int width, + unsigned int height, + int dst_x, + int dst_y, + unsigned long bit_plane) + +{ + register xCopyPlaneReq *req; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq(CopyPlane, req); + req->srcDrawable = src_drawable; + req->dstDrawable = dst_drawable; + req->gc = gc->gid; + req->srcX = src_x; + req->srcY = src_y; + req->dstX = dst_x; + req->dstY = dst_y; + req->width = width; + req->height = height; + req->bitPlane = bit_plane; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/Cr.h b/nx-X11/lib/src/Cr.h new file mode 100644 index 000000000..e71d86d1c --- /dev/null +++ b/nx-X11/lib/src/Cr.h @@ -0,0 +1,29 @@ + +#ifndef _CR_H_ +#define _CR_H_ + +#include + +extern int _XUpdateGCCache( + register GC gc, + register unsigned long mask, + register XGCValues *attr); +extern void _XNoticeCreateBitmap( + Display *dpy, + Pixmap pid, + unsigned int width, + unsigned int height); +extern void _XNoticePutBitmap( + Display *dpy, + Drawable draw, + XImage *image); +extern Cursor _XTryShapeBitmapCursor( + Display *dpy, + Pixmap source, + Pixmap mask, + XColor *foreground, + XColor *background, + unsigned int x, + unsigned int y); + +#endif /* _CR_H_ */ diff --git a/nx-X11/lib/src/CrBFData.c b/nx-X11/lib/src/CrBFData.c new file mode 100644 index 000000000..6708a9b91 --- /dev/null +++ b/nx-X11/lib/src/CrBFData.c @@ -0,0 +1,80 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlib.h" + +/* + * XCreateBitmapFromData: Routine to make a pixmap of depth 1 from user + * supplied data. + * D is any drawable on the same screen that the pixmap will be used in. + * Data is a pointer to the bit data, and + * width & height give the size in bits of the pixmap. + * + * The following format is assumed for data: + * + * format=XYPixmap + * bit_order=LSBFirst + * byte_order=LSBFirst + * padding=8 + * bitmap_unit=8 + * xoffset=0 + * no extra bytes per line + */ +Pixmap XCreateBitmapFromData( + Display *display, + Drawable d, + _Xconst char *data, + unsigned int width, + unsigned int height) +{ + Pixmap pix = XCreatePixmap(display, d, width, height, 1); + GC gc = XCreateGC(display, pix, (unsigned long) 0, (XGCValues *) 0); + if (gc == NULL) { + XFreePixmap(display, pix); + return (Pixmap) None; + } else { + XImage ximage = { + .height = height, + .width = width, + .depth = 1, + .bits_per_pixel = 1, + .xoffset = 0, + .format = XYPixmap, + .data = (char *) data, + .byte_order = LSBFirst, + .bitmap_unit = 8, + .bitmap_bit_order = LSBFirst, + .bitmap_pad = 8, + .bytes_per_line = (width + 7) / 8, + }; + XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); + XFreeGC(display, gc); + return(pix); + } +} diff --git a/nx-X11/lib/src/CrCmap.c b/nx-X11/lib/src/CrCmap.c new file mode 100644 index 000000000..9904c7dda --- /dev/null +++ b/nx-X11/lib/src/CrCmap.c @@ -0,0 +1,59 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" + + +Colormap XCreateColormap( + register Display *dpy, + Window w, + Visual *visual, + int alloc) +{ + register xCreateColormapReq *req; + Colormap mid; + + LockDisplay(dpy); + GetReq(CreateColormap, req); + req->window = w; + mid = req->mid = XAllocID(dpy); + req->alloc = alloc; + if (visual == CopyFromParent) req->visual = CopyFromParent; + else req->visual = visual->visualid; + + UnlockDisplay(dpy); + SyncHandle(); + +#ifdef XCMS + _XcmsAddCmapRec(dpy, mid, w, visual); +#endif + + return(mid); +} diff --git a/nx-X11/lib/src/CrCursor.c b/nx-X11/lib/src/CrCursor.c new file mode 100644 index 000000000..c8c174e5f --- /dev/null +++ b/nx-X11/lib/src/CrCursor.c @@ -0,0 +1,79 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#ifdef USE_DYNAMIC_XCURSOR +Cursor +_XTryShapeBitmapCursor (Display *dpy, + Pixmap source, + Pixmap mask, + XColor *foreground, + XColor *background, + unsigned int x, + unsigned int y); +#endif + +Cursor XCreatePixmapCursor( + register Display *dpy, + Pixmap source, + Pixmap mask, + XColor *foreground, + XColor *background, + unsigned int x, + unsigned int y) + +{ + register xCreateCursorReq *req; + Cursor cid; + +#ifdef USE_DYNAMIC_XCURSOR + cid = _XTryShapeBitmapCursor (dpy, source, mask, + foreground, background, x, y); + if (cid) + return cid; +#endif + LockDisplay(dpy); + GetReq(CreateCursor, req); + req->cid = cid = XAllocID(dpy); + req->source = source; + req->mask = mask; + req->foreRed = foreground->red; + req->foreGreen = foreground->green; + req->foreBlue = foreground->blue; + req->backRed = background->red; + req->backGreen = background->green; + req->backBlue = background->blue; + req->x = x; + req->y = y; + UnlockDisplay(dpy); + SyncHandle(); + return (cid); +} + diff --git a/nx-X11/lib/src/CrGC.c b/nx-X11/lib/src/CrGC.c new file mode 100644 index 000000000..2d5f17c00 --- /dev/null +++ b/nx-X11/lib/src/CrGC.c @@ -0,0 +1,345 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Cr.h" + +static XGCValues const initial_GC = { + GXcopy, /* function */ + AllPlanes, /* plane_mask */ + 0L, /* foreground */ + 1L, /* background */ + 0, /* line_width */ + LineSolid, /* line_style */ + CapButt, /* cap_style */ + JoinMiter, /* join_style */ + FillSolid, /* fill_style */ + EvenOddRule,/* fill_rule */ + ArcPieSlice,/* arc_mode */ + (Pixmap)~0L,/* tile, impossible (unknown) resource */ + (Pixmap)~0L,/* stipple, impossible (unknown) resource */ + 0, /* ts_x_origin */ + 0, /* ts_y_origin */ + (Font)~0L, /* font, impossible (unknown) resource */ + ClipByChildren, /* subwindow_mode */ + True, /* graphics_exposures */ + 0, /* clip_x_origin */ + 0, /* clip_y_origin */ + None, /* clip_mask */ + 0, /* dash_offset */ + 4 /* dashes (list [4,4]) */ +}; + +static void _XGenerateGCList( + register Display *dpy, + GC gc, + xReq *req); + +GC XCreateGC ( + register Display *dpy, + Drawable d, /* Window or Pixmap for which depth matches */ + unsigned long valuemask, /* which ones to set initially */ + XGCValues *values) /* the values themselves */ +{ + register GC gc; + register xCreateGCReq *req; + register _XExtension *ext; + + LockDisplay(dpy); + if ((gc = Xmalloc (sizeof(struct _XGC))) == NULL) { + UnlockDisplay(dpy); + SyncHandle(); + return (NULL); + } + gc->rects = 0; + gc->dashes = 0; + gc->ext_data = NULL; + gc->values = initial_GC; + gc->dirty = 0L; + + valuemask &= (1L << (GCLastBit + 1)) - 1; + if (valuemask) _XUpdateGCCache (gc, valuemask, values); + + GetReq(CreateGC, req); + req->drawable = d; + req->gc = gc->gid = XAllocID(dpy); + + if ((req->mask = gc->dirty)) + _XGenerateGCList (dpy, gc, (xReq *) req); + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->create_GC) (*ext->create_GC)(dpy, gc, &ext->codes); + gc->dirty = 0L; /* allow extensions to see dirty bits */ + UnlockDisplay(dpy); + SyncHandle(); + return (gc); + } + +/* + * GenerateGCList looks at the GC dirty bits, and appends all the required + * long words to the request being generated. + */ + +static void +_XGenerateGCList ( + register Display *dpy, + GC gc, + xReq *req) + { + unsigned long values[32]; + register unsigned long *value = values; + long nvalues; + register XGCValues *gv = &gc->values; + register unsigned long dirty = gc->dirty; + + /* + * Note: The order of these tests are critical; the order must be the + * same as the GC mask bits in the word. + */ + if (dirty & GCFunction) *value++ = gv->function; + if (dirty & GCPlaneMask) *value++ = gv->plane_mask; + if (dirty & GCForeground) *value++ = gv->foreground; + if (dirty & GCBackground) *value++ = gv->background; + if (dirty & GCLineWidth) *value++ = gv->line_width; + if (dirty & GCLineStyle) *value++ = gv->line_style; + if (dirty & GCCapStyle) *value++ = gv->cap_style; + if (dirty & GCJoinStyle) *value++ = gv->join_style; + if (dirty & GCFillStyle) *value++ = gv->fill_style; + if (dirty & GCFillRule) *value++ = gv->fill_rule; + if (dirty & GCTile) *value++ = gv->tile; + if (dirty & GCStipple) *value++ = gv->stipple; + if (dirty & GCTileStipXOrigin) *value++ = gv->ts_x_origin; + if (dirty & GCTileStipYOrigin) *value++ = gv->ts_y_origin; + if (dirty & GCFont) *value++ = gv->font; + if (dirty & GCSubwindowMode) *value++ = gv->subwindow_mode; + if (dirty & GCGraphicsExposures) *value++ = gv->graphics_exposures; + if (dirty & GCClipXOrigin) *value++ = gv->clip_x_origin; + if (dirty & GCClipYOrigin) *value++ = gv->clip_y_origin; + if (dirty & GCClipMask) *value++ = gv->clip_mask; + if (dirty & GCDashOffset) *value++ = gv->dash_offset; + if (dirty & GCDashList) *value++ = gv->dashes; + if (dirty & GCArcMode) *value++ = gv->arc_mode; + + req->length += (nvalues = value - values); + + /* + * note: Data is a macro that uses its arguments multiple + * times, so "nvalues" is changed in a separate assignment + * statement + */ + + nvalues <<= 2; + Data32 (dpy, (long *) values, nvalues); + + } + + +int +_XUpdateGCCache ( + register GC gc, + register unsigned long mask, + register XGCValues *attr) +{ + register XGCValues *gv = &gc->values; + + if (mask & GCFunction) + if (gv->function != attr->function) { + gv->function = attr->function; + gc->dirty |= GCFunction; + } + + if (mask & GCPlaneMask) + if (gv->plane_mask != attr->plane_mask) { + gv->plane_mask = attr->plane_mask; + gc->dirty |= GCPlaneMask; + } + + if (mask & GCForeground) + if (gv->foreground != attr->foreground) { + gv->foreground = attr->foreground; + gc->dirty |= GCForeground; + } + + if (mask & GCBackground) + if (gv->background != attr->background) { + gv->background = attr->background; + gc->dirty |= GCBackground; + } + + if (mask & GCLineWidth) + if (gv->line_width != attr->line_width) { + gv->line_width = attr->line_width; + gc->dirty |= GCLineWidth; + } + + if (mask & GCLineStyle) + if (gv->line_style != attr->line_style) { + gv->line_style = attr->line_style; + gc->dirty |= GCLineStyle; + } + + if (mask & GCCapStyle) + if (gv->cap_style != attr->cap_style) { + gv->cap_style = attr->cap_style; + gc->dirty |= GCCapStyle; + } + + if (mask & GCJoinStyle) + if (gv->join_style != attr->join_style) { + gv->join_style = attr->join_style; + gc->dirty |= GCJoinStyle; + } + + if (mask & GCFillStyle) + if (gv->fill_style != attr->fill_style) { + gv->fill_style = attr->fill_style; + gc->dirty |= GCFillStyle; + } + + if (mask & GCFillRule) + if (gv->fill_rule != attr->fill_rule) { + gv->fill_rule = attr->fill_rule; + gc->dirty |= GCFillRule; + } + + if (mask & GCArcMode) + if (gv->arc_mode != attr->arc_mode) { + gv->arc_mode = attr->arc_mode; + gc->dirty |= GCArcMode; + } + + /* always write through tile change, since client may have changed pixmap contents */ + if (mask & GCTile) { + gv->tile = attr->tile; + gc->dirty |= GCTile; + } + + /* always write through stipple change, since client may have changed pixmap contents */ + if (mask & GCStipple) { + gv->stipple = attr->stipple; + gc->dirty |= GCStipple; + } + + if (mask & GCTileStipXOrigin) + if (gv->ts_x_origin != attr->ts_x_origin) { + gv->ts_x_origin = attr->ts_x_origin; + gc->dirty |= GCTileStipXOrigin; + } + + if (mask & GCTileStipYOrigin) + if (gv->ts_y_origin != attr->ts_y_origin) { + gv->ts_y_origin = attr->ts_y_origin; + gc->dirty |= GCTileStipYOrigin; + } + + if (mask & GCFont) + if (gv->font != attr->font) { + gv->font = attr->font; + gc->dirty |= GCFont; + } + + if (mask & GCSubwindowMode) + if (gv->subwindow_mode != attr->subwindow_mode) { + gv->subwindow_mode = attr->subwindow_mode; + gc->dirty |= GCSubwindowMode; + } + + if (mask & GCGraphicsExposures) + if (gv->graphics_exposures != attr->graphics_exposures) { + gv->graphics_exposures = attr->graphics_exposures; + gc->dirty |= GCGraphicsExposures; + } + + if (mask & GCClipXOrigin) + if (gv->clip_x_origin != attr->clip_x_origin) { + gv->clip_x_origin = attr->clip_x_origin; + gc->dirty |= GCClipXOrigin; + } + + if (mask & GCClipYOrigin) + if (gv->clip_y_origin != attr->clip_y_origin) { + gv->clip_y_origin = attr->clip_y_origin; + gc->dirty |= GCClipYOrigin; + } + + /* always write through mask change, since client may have changed pixmap contents */ + if (mask & GCClipMask) { + gv->clip_mask = attr->clip_mask; + gc->dirty |= GCClipMask; + gc->rects = 0; + } + + if (mask & GCDashOffset) + if (gv->dash_offset != attr->dash_offset) { + gv->dash_offset = attr->dash_offset; + gc->dirty |= GCDashOffset; + } + + if (mask & GCDashList) + if ((gv->dashes != attr->dashes) || (gc->dashes == True)) { + gv->dashes = attr->dashes; + gc->dirty |= GCDashList; + gc->dashes = 0; + } + return 0; +} + +/* can only call when display is already locked. */ + +void _XFlushGCCache( + Display *dpy, + GC gc) +{ + register xChangeGCReq *req; + register _XExtension *ext; + + if (gc->dirty) { + GetReq(ChangeGC, req); + req->gc = gc->gid; + req->mask = gc->dirty; + _XGenerateGCList (dpy, gc, (xReq *) req); + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); + gc->dirty = 0L; /* allow extensions to see dirty bits */ + } +} + +void +XFlushGC( + Display *dpy, + GC gc) +{ + FlushGC(dpy, gc); +} + +GContext XGContextFromGC(GC gc) +{ + return (gc->gid); +} diff --git a/nx-X11/lib/src/CrGlCur.c b/nx-X11/lib/src/CrGlCur.c new file mode 100644 index 000000000..88133b7f4 --- /dev/null +++ b/nx-X11/lib/src/CrGlCur.c @@ -0,0 +1,225 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#ifdef USE_DYNAMIC_XCURSOR + +#include +#include +#include +#include "Cr.h" + +#ifdef __CYGWIN__ +#define LIBXCURSOR "cygXcursor-1.dll" +#endif + +typedef void *XModuleType; + +#ifndef LIBXCURSOR +#define LIBXCURSOR "libXcursor.so.1" +#endif + +static char libraryName[] = LIBXCURSOR; + +static XModuleType +open_library (void) +{ + char *library = libraryName; + char *dot; + XModuleType module; + for (;;) + { + module = dlopen(library, RTLD_LAZY); + if (module) + return module; + dot = strrchr (library, '.'); + if (!dot) + break; + *dot = '\0'; + } + return NULL; +} + +static void * +fetch_symbol (XModuleType module, const char *under_symbol) +{ + void *result = NULL; + const char *symbol = under_symbol + 1; + result = dlsym (module, symbol); + if (!result) + result = dlsym (module, under_symbol); + return result; +} + +typedef void (*NoticeCreateBitmapFunc) (Display *dpy, + Pixmap pid, + unsigned int width, + unsigned int height); + +typedef void (*NoticePutBitmapFunc) (Display *dpy, + Drawable draw, + XImage *image); + +typedef Cursor (*TryShapeBitmapCursorFunc) (Display *dpy, + Pixmap source, + Pixmap mask, + XColor *foreground, + XColor *background, + unsigned int x, + unsigned int y); + +typedef Cursor (*TryShapeCursorFunc) (Display *dpy, + Font source_font, + Font mask_font, + unsigned int source_char, + unsigned int mask_char, + XColor _Xconst *foreground, + XColor _Xconst *background); + +static XModuleType _XcursorModule; +static Bool _XcursorModuleTried; + +#define GetFunc(type,name,ret) {\ + static Bool been_here; \ + static type staticFunc; \ + \ + _XLockMutex (_Xglobal_lock); \ + if (!been_here) \ + { \ + been_here = True; \ + if (!_XcursorModuleTried) \ + { \ + _XcursorModuleTried = True; \ + _XcursorModule = open_library (); \ + } \ + if (_XcursorModule) \ + staticFunc = (type) fetch_symbol (_XcursorModule, "_" name); \ + } \ + ret = staticFunc; \ + _XUnlockMutex (_Xglobal_lock); \ +} + +static Cursor +_XTryShapeCursor (Display *dpy, + Font source_font, + Font mask_font, + unsigned int source_char, + unsigned int mask_char, + XColor _Xconst *foreground, + XColor _Xconst *background) +{ + TryShapeCursorFunc func; + + GetFunc (TryShapeCursorFunc, "XcursorTryShapeCursor", func); + if (func) + return (*func) (dpy, source_font, mask_font, source_char, mask_char, + foreground, background); + return None; +} + +void +_XNoticeCreateBitmap (Display *dpy, + Pixmap pid, + unsigned int width, + unsigned int height) +{ + NoticeCreateBitmapFunc func; + + GetFunc (NoticeCreateBitmapFunc, "XcursorNoticeCreateBitmap", func); + if (func) + (*func) (dpy, pid, width, height); +} + +void +_XNoticePutBitmap (Display *dpy, + Drawable draw, + XImage *image) +{ + NoticePutBitmapFunc func; + + GetFunc (NoticePutBitmapFunc, "XcursorNoticePutBitmap", func); + if (func) + (*func) (dpy, draw, image); +} + +Cursor +_XTryShapeBitmapCursor (Display *dpy, + Pixmap source, + Pixmap mask, + XColor *foreground, + XColor *background, + unsigned int x, + unsigned int y) +{ + TryShapeBitmapCursorFunc func; + + GetFunc (TryShapeBitmapCursorFunc, "XcursorTryShapeBitmapCursor", func); + if (func) + return (*func) (dpy, source, mask, foreground, background, x, y); + return None; +} +#endif + +Cursor XCreateGlyphCursor( + register Display *dpy, + Font source_font, + Font mask_font, + unsigned int source_char, + unsigned int mask_char, + XColor _Xconst *foreground, + XColor _Xconst *background) +{ + Cursor cid; + register xCreateGlyphCursorReq *req; + +#ifdef USE_DYNAMIC_XCURSOR + cid = _XTryShapeCursor (dpy, source_font, mask_font, + source_char, mask_char, foreground, background); + if (cid) + return cid; +#endif + LockDisplay(dpy); + GetReq(CreateGlyphCursor, req); + cid = req->cid = XAllocID(dpy); + req->source = source_font; + req->mask = mask_font; + req->sourceChar = source_char; + req->maskChar = mask_char; + req->foreRed = foreground->red; + req->foreGreen = foreground->green; + req->foreBlue = foreground->blue; + req->backRed = background->red; + req->backGreen = background->green; + req->backBlue = background->blue; + UnlockDisplay(dpy); + SyncHandle(); + return (cid); +} + diff --git a/nx-X11/lib/src/CrPFBData.c b/nx-X11/lib/src/CrPFBData.c new file mode 100644 index 000000000..17d551bb7 --- /dev/null +++ b/nx-X11/lib/src/CrPFBData.c @@ -0,0 +1,89 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlib.h" +#include + +/* + * XCreatePixmapFromBitmapData: Routine to make a pixmap from user supplied bitmap data. + * D is any drawable on the same screen that the pixmap will be used in. + * Data is a pointer to the bit data, and + * width & height give the size in bits of the pixmap. + * Fg and Bg are the pixel values to use for the two colors. + * Depth is the depth of the pixmap to create. + * + * The following format is assumed for data: + * + * format=XYPixmap + * bit_order=LSBFirst + * byte_order=LSBFirst + * padding=8 + * bitmap_unit=8 + * xoffset=0 + * no extra bytes per line + */ +Pixmap XCreatePixmapFromBitmapData( + Display *display, + Drawable d, + char *data, + unsigned int width, + unsigned int height, + unsigned long fg, + unsigned long bg, + unsigned int depth) +{ + Pixmap pix = XCreatePixmap(display, d, width, height, depth); + XGCValues gcv = { + .foreground = fg, + .background = bg + }; + GC gc = XCreateGC(display, pix, GCForeground|GCBackground, &gcv); + if (gc == NULL) { + XFreePixmap(display, pix); + return (Pixmap) None; + } else { + XImage ximage = { + .height = height, + .width = width, + .depth = 1, + .bits_per_pixel = 1, + .xoffset = 0, + .format = XYBitmap, + .data = data, + .byte_order = LSBFirst, + .bitmap_unit = 8, + .bitmap_bit_order = LSBFirst, + .bitmap_pad = 8, + .bytes_per_line = (width + 7) / 8 + }; + XPutImage(display, pix, gc, &ximage, 0, 0, 0, 0, width, height); + XFreeGC(display, gc); + return(pix); + } +} diff --git a/nx-X11/lib/src/CrPixmap.c b/nx-X11/lib/src/CrPixmap.c new file mode 100644 index 000000000..cdf312076 --- /dev/null +++ b/nx-X11/lib/src/CrPixmap.c @@ -0,0 +1,65 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#ifdef USE_DYNAMIC_XCURSOR +void +_XNoticeCreateBitmap (Display *dpy, + Pixmap pid, + unsigned int width, + unsigned int height); +#endif + +Pixmap XCreatePixmap ( + register Display *dpy, + Drawable d, + unsigned int width, + unsigned int height, + unsigned int depth) +{ + Pixmap pid; + register xCreatePixmapReq *req; + + LockDisplay(dpy); + GetReq(CreatePixmap, req); + req->drawable = d; + req->width = width; + req->height = height; + req->depth = depth; + pid = req->pid = XAllocID(dpy); + UnlockDisplay(dpy); + SyncHandle(); +#ifdef USE_DYNAMIC_XCURSOR + if (depth == 1) + _XNoticeCreateBitmap (dpy, pid, width, height); +#endif + return (pid); +} + diff --git a/nx-X11/lib/src/CrWindow.c b/nx-X11/lib/src/CrWindow.c new file mode 100644 index 000000000..7b5460186 --- /dev/null +++ b/nx-X11/lib/src/CrWindow.c @@ -0,0 +1,69 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Window XCreateSimpleWindow( + register Display *dpy, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int borderWidth, + unsigned long border, + unsigned long background) +{ + Window wid; + register xCreateWindowReq *req; + + LockDisplay(dpy); + GetReqExtra(CreateWindow, 8, req); + req->parent = parent; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->borderWidth = borderWidth; + req->depth = 0; + req->class = CopyFromParent; + req->visual = CopyFromParent; + wid = req->wid = XAllocID(dpy); + req->mask = CWBackPixel | CWBorderPixel; + + { + register CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xCreateWindowReq); + *valuePtr++ = background; + *valuePtr = border; + } + + UnlockDisplay(dpy); + SyncHandle(); + return (wid); + } diff --git a/nx-X11/lib/src/Cursor.c b/nx-X11/lib/src/Cursor.c new file mode 100644 index 000000000..80b91c36d --- /dev/null +++ b/nx-X11/lib/src/Cursor.c @@ -0,0 +1,53 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +static XColor _Xconst foreground = { 0, 0, 0, 0 }; /* black */ +static XColor _Xconst background = { 0, 65535, 65535, 65535 }; /* white */ + +Cursor XCreateFontCursor( + Display *dpy, + unsigned int which) +{ + /* + * the cursor font contains the shape glyph followed by the mask + * glyph; so character position 0 contains a shape, 1 the mask for 0, + * 2 a shape, etc. contains hash define names + * for all of these. + */ + + if (dpy->cursor_font == None) { + dpy->cursor_font = XLoadFont (dpy, CURSORFONT); + if (dpy->cursor_font == None) return None; + } + + return XCreateGlyphCursor (dpy, dpy->cursor_font, dpy->cursor_font, + which, which + 1, &foreground, &background); +} + diff --git a/nx-X11/lib/src/DefCursor.c b/nx-X11/lib/src/DefCursor.c new file mode 100644 index 000000000..e3cee0649 --- /dev/null +++ b/nx-X11/lib/src/DefCursor.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986,1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDefineCursor ( + register Display *dpy, + Window w, + Cursor cursor) +{ + register xChangeWindowAttributesReq *req; + + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWCursor; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), cursor); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/DelProp.c b/nx-X11/lib/src/DelProp.c new file mode 100644 index 000000000..da486b8ef --- /dev/null +++ b/nx-X11/lib/src/DelProp.c @@ -0,0 +1,47 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDeleteProperty( + register Display *dpy, + Window window, + Atom property) +{ + register xDeletePropertyReq *req; + + LockDisplay(dpy); + GetReq(DeleteProperty, req); + req->window = window; + req->property = property; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/Depths.c b/nx-X11/lib/src/Depths.c new file mode 100644 index 000000000..a8b719d00 --- /dev/null +++ b/nx-X11/lib/src/Depths.c @@ -0,0 +1,62 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +/* + * XListDepths - return info from connection setup + */ +int *XListDepths ( + Display *dpy, + int scrnum, + int *countp) +{ + Screen *scr; + int count; + int *depths; + + if (scrnum < 0 || scrnum >= dpy->nscreens) return NULL; + + scr = &dpy->screens[scrnum]; + if ((count = scr->ndepths) > 0) { + register Depth *dp; + register int i; + + depths = Xmalloc (count * sizeof(int)); + if (!depths) return NULL; + for (i = 0, dp = scr->depths; i < count; i++, dp++) + depths[i] = dp->depth; + } else { + /* a screen must have a depth */ + return NULL; + } + *countp = count; + return depths; +} diff --git a/nx-X11/lib/src/DestSubs.c b/nx-X11/lib/src/DestSubs.c new file mode 100644 index 000000000..7c6c428be --- /dev/null +++ b/nx-X11/lib/src/DestSubs.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDestroySubwindows( + register Display *dpy, + Window win) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq (DestroySubwindows,win, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/DestWind.c b/nx-X11/lib/src/DestWind.c new file mode 100644 index 000000000..c1aec893a --- /dev/null +++ b/nx-X11/lib/src/DestWind.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDestroyWindow ( + register Display *dpy, + Window w) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(DestroyWindow, w, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/DisName.c b/nx-X11/lib/src/DisName.c new file mode 100644 index 000000000..87a1e2f0e --- /dev/null +++ b/nx-X11/lib/src/DisName.c @@ -0,0 +1,64 @@ + +/* + +Copyright 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* XDisplayName.c */ +/* + * Returns the name of the display XOpenDisplay would use. This is better + * than just printing the "display" variable in a program because that + * could be NULL and/or there could be an environment variable set. + * This makes it easier for programmers to provide meaningful error + * messages. + * + * + * For example, this is used in XOpenDisplay() as + * strncpy( displaybuf, XDisplayName( display ), sizeof(displaybuf) ); + * if ( *displaybuf == '\0' ) return( NULL ); + * This check is actually unnecessary because the next thing is an index() + * call looking for a ':' which will fail and we'll return(NULL). + */ +/* Written at Waterloo - JMSellens */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlib.h" + +char * +XDisplayName( + _Xconst char *display) +{ + char *d; + if ( display != (char *)NULL && *display != '\0' ) + return( (char *)display ); + if ( (d = getenv( "DISPLAY" )) != (char *)NULL ) + return( d ); + return( "" ); +} diff --git a/nx-X11/lib/src/DrArc.c b/nx-X11/lib/src/DrArc.c new file mode 100644 index 000000000..d72fac9d7 --- /dev/null +++ b/nx-X11/lib/src/DrArc.c @@ -0,0 +1,73 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* Note to future maintainers: XDrawArc does NOT batch successive PolyArc + requests into a single request like XDrawLine, XDrawPoint, etc. + We don't do this because X_PolyArc applies the GC's join-style if + the last point in one arc coincides with the first point in another. + The client wouldn't expect this and would have no easy way to defeat it. */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawArc( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height, /* CARD16 */ + int angle1, + int angle2) /* INT16 */ +{ + register xPolyArcReq *req; + register xArc *arc; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReqExtra (PolyArc, SIZEOF(xArc), req); + + req->drawable = d; + req->gc = gc->gid; + + arc = (xArc *) NEXTPTR(req,xPolyArcReq); + + arc->x = x; + arc->y = y; + arc->width = width; + arc->height = height; + arc->angle1 = angle1; + arc->angle2 = angle2; + + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/DrArcs.c b/nx-X11/lib/src/DrArcs.c new file mode 100644 index 000000000..14405aa3d --- /dev/null +++ b/nx-X11/lib/src/DrArcs.c @@ -0,0 +1,57 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define arc_scale (SIZEOF(xArc) / 4) + +int +XDrawArcs( + register Display *dpy, + Drawable d, + GC gc, + XArc *arcs, + int n_arcs) +{ + register xPolyArcReq *req; + register long len; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq(PolyArc,req); + req->drawable = d; + req->gc = gc->gid; + len = ((long)n_arcs) * arc_scale; + SetReqLen(req, len, 1); + len <<= 2; /* watch out for macros... */ + Data16 (dpy, (short *) arcs, len); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/DrLine.c b/nx-X11/lib/src/DrLine.c new file mode 100644 index 000000000..dc82d5a15 --- /dev/null +++ b/nx-X11/lib/src/DrLine.c @@ -0,0 +1,85 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* precompute the maximum size of batching request allowed */ + +#define wsize (SIZEOF(xPolySegmentReq) + WLNSPERBATCH * SIZEOF(xSegment)) +#define zsize (SIZEOF(xPolySegmentReq) + ZLNSPERBATCH * SIZEOF(xSegment)) + +int +XDrawLine ( + register Display *dpy, + Drawable d, + GC gc, + int x1, + int y1, + int x2, + int y2) +{ + register xSegment *segment; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + { + register xPolySegmentReq *req = (xPolySegmentReq *) dpy->last_req; + + /* if same as previous request, with same drawable, batch requests */ + if ( + (req->reqType == X_PolySegment) + && (req->drawable == d) + && (req->gc == gc->gid) + && ((dpy->bufptr + SIZEOF(xSegment)) <= dpy->bufmax) + && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? + wsize : zsize)) ) { + req->length += SIZEOF(xSegment) >> 2; + segment = (xSegment *) dpy->bufptr; + dpy->bufptr += SIZEOF(xSegment); + } + + else { + GetReqExtra (PolySegment, SIZEOF(xSegment), req); + req->drawable = d; + req->gc = gc->gid; + segment = (xSegment *) NEXTPTR(req,xPolySegmentReq); + } + + segment->x1 = x1; + segment->y1 = y1; + segment->x2 = x2; + segment->y2 = y2; + + UnlockDisplay(dpy); + SyncHandle(); + } + return 1; +} + diff --git a/nx-X11/lib/src/DrLines.c b/nx-X11/lib/src/DrLines.c new file mode 100644 index 000000000..68071b6b4 --- /dev/null +++ b/nx-X11/lib/src/DrLines.c @@ -0,0 +1,57 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawLines ( + register Display *dpy, + Drawable d, + GC gc, + XPoint *points, + int npoints, + int mode) +{ + register xPolyLineReq *req; + register long length; + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq (PolyLine, req); + req->drawable = d; + req->gc = gc->gid; + req->coordMode = mode; + SetReqLen(req, npoints, 65535 - req->length); + /* each point is 2 16-bit integers */ + length = npoints << 2; /* watch out for macros... */ + Data16 (dpy, (short *) points, length); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/DrPoint.c b/nx-X11/lib/src/DrPoint.c new file mode 100644 index 000000000..f0332e853 --- /dev/null +++ b/nx-X11/lib/src/DrPoint.c @@ -0,0 +1,82 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* precompute the maximum size of batching request allowed */ + +#define size (SIZEOF(xPolyPointReq) + PTSPERBATCH * SIZEOF(xPoint)) + +int +XDrawPoint( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y) /* INT16 */ +{ + xPoint *point; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + { + register xPolyPointReq *req = (xPolyPointReq *) dpy->last_req; + + + /* if same as previous request, with same drawable, batch requests */ + if ( + (req->reqType == X_PolyPoint) + && (req->drawable == d) + && (req->gc == gc->gid) + && (req->coordMode == CoordModeOrigin) + && ((dpy->bufptr + SIZEOF(xPoint)) <= dpy->bufmax) + && (((char *)dpy->bufptr - (char *)req) < size) ) { + req->length += SIZEOF(xPoint) >> 2; + point = (xPoint *) dpy->bufptr; + dpy->bufptr += SIZEOF(xPoint); + } + + else { + GetReqExtra(PolyPoint, 4, req); /* 1 point = 4 bytes */ + req->drawable = d; + req->gc = gc->gid; + req->coordMode = CoordModeOrigin; + point = (xPoint *) NEXTPTR(req,xPolyPointReq); + } + + point->x = x; + point->y = y; + + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/DrPoints.c b/nx-X11/lib/src/DrPoints.c new file mode 100644 index 000000000..287fa057d --- /dev/null +++ b/nx-X11/lib/src/DrPoints.c @@ -0,0 +1,85 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawPoints( + register Display *dpy, + Drawable d, + GC gc, + XPoint *points, + int n_points, + int mode) /* CoordMode */ +{ + register xPolyPointReq *req; + register long nbytes; + int n; + int xoff, yoff; + XPoint pt; + + xoff = yoff = 0; + LockDisplay(dpy); + FlushGC(dpy, gc); + while (n_points) { + GetReq(PolyPoint, req); + req->drawable = d; + req->gc = gc->gid; + req->coordMode = mode; + n = n_points; + if (!dpy->bigreq_size && n > (dpy->max_request_size - req->length)) + n = dpy->max_request_size - req->length; + SetReqLen(req, n, n); + nbytes = ((long)n) << 2; /* watch out for macros... */ + if (xoff || yoff) { + pt.x = xoff + points->x; + pt.y = yoff + points->y; + Data16 (dpy, (short *) &pt, 4); + if (nbytes > 4) { + Data16 (dpy, (short *) (points + 1), nbytes - 4); + } + } else { + Data16 (dpy, (short *) points, nbytes); + } + n_points -= n; + if (n_points && (mode == CoordModePrevious)) { + register XPoint *pptr = points; + points += n; + while (pptr != points) { + xoff += pptr->x; + yoff += pptr->y; + pptr++; + } + } else + points += n; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/DrRect.c b/nx-X11/lib/src/DrRect.c new file mode 100644 index 000000000..d9141eef9 --- /dev/null +++ b/nx-X11/lib/src/DrRect.c @@ -0,0 +1,84 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* precompute the maximum size of batching request allowed */ + +#define wsize (SIZEOF(xPolyRectangleReq) + WRCTSPERBATCH * SIZEOF(xRectangle)) +#define zsize (SIZEOF(xPolyRectangleReq) + ZRCTSPERBATCH * SIZEOF(xRectangle)) + +int +XDrawRectangle( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height) /* CARD16 */ +{ + xRectangle *rect; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + { + register xPolyRectangleReq *req = (xPolyRectangleReq *) dpy->last_req; + + /* if same as previous request, with same drawable, batch requests */ + if ( + (req->reqType == X_PolyRectangle) + && (req->drawable == d) + && (req->gc == gc->gid) + && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) + && (((char *)dpy->bufptr - (char *)req) < (gc->values.line_width ? + wsize : zsize)) ) { + req->length += SIZEOF(xRectangle) >> 2; + rect = (xRectangle *) dpy->bufptr; + dpy->bufptr += SIZEOF(xRectangle); + } + + else { + GetReqExtra(PolyRectangle, SIZEOF(xRectangle), req); + req->drawable = d; + req->gc = gc->gid; + rect = (xRectangle *) NEXTPTR(req,xPolyRectangleReq); + } + + rect->x = x; + rect->y = y; + rect->width = width; + rect->height = height; + + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/DrRects.c b/nx-X11/lib/src/DrRects.c new file mode 100644 index 000000000..7827bf18d --- /dev/null +++ b/nx-X11/lib/src/DrRects.c @@ -0,0 +1,65 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawRectangles( + register Display *dpy, + Drawable d, + GC gc, + XRectangle *rects, + int n_rects) +{ + register xPolyRectangleReq *req; + long len; + int n; + + LockDisplay(dpy); + FlushGC(dpy, gc); + while (n_rects) { + GetReq(PolyRectangle, req); + req->drawable = d; + req->gc = gc->gid; + n = n_rects; + len = ((long)n) << 1; + if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { + n = (dpy->max_request_size - req->length) >> 1; + len = ((long)n) << 1; + } + SetReqLen(req, len, len); + len <<= 2; /* watch out for macros... */ + Data16 (dpy, (short *) rects, len); + n_rects -= n; + rects += n; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/DrSegs.c b/nx-X11/lib/src/DrSegs.c new file mode 100644 index 000000000..93eab4d08 --- /dev/null +++ b/nx-X11/lib/src/DrSegs.c @@ -0,0 +1,66 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawSegments ( + register Display *dpy, + Drawable d, + GC gc, + XSegment *segments, + int nsegments) +{ + register xPolySegmentReq *req; + long len; + int n; + + LockDisplay(dpy); + FlushGC(dpy, gc); + while (nsegments) { + GetReq (PolySegment, req); + req->drawable = d; + req->gc = gc->gid; + n = nsegments; + len = ((long)n) << 1; + if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { + n = (dpy->max_request_size - req->length) >> 1; + len = ((long)n) << 1; + } + SetReqLen(req, len, len); + len <<= 2; /* watch out for macros... */ + Data16 (dpy, (short *) segments, len); + nsegments -= n; + segments += n; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ErrDes.c b/nx-X11/lib/src/ErrDes.c new file mode 100644 index 000000000..f13e3dce4 --- /dev/null +++ b/nx-X11/lib/src/ErrDes.c @@ -0,0 +1,212 @@ +/* + */ + +/*********************************************************** + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "Xresource.h" +#include + +#ifndef ERRORDB +#ifndef XERRORDB +#define ERRORDB "/usr/lib/X11/XErrorDB" +#else +#define ERRORDB XERRORDB +#endif +#endif + +/* + * descriptions of errors in Section 4 of Protocol doc (pp. 350-351); more + * verbose descriptions are given in the error database + */ +static const char _XErrorList[] = + /* No error */ "no error\0" + /* BadRequest */ "BadRequest\0" + /* BadValue */ "BadValue\0" + /* BadWindow */ "BadWindow\0" + /* BadPixmap */ "BadPixmap\0" + /* BadAtom */ "BadAtom\0" + /* BadCursor */ "BadCursor\0" + /* BadFont */ "BadFont\0" + /* BadMatch */ "BadMatch\0" + /* BadDrawable */ "BadDrawable\0" + /* BadAccess */ "BadAccess\0" + /* BadAlloc */ "BadAlloc\0" + /* BadColor */ "BadColor\0" + /* BadGC */ "BadGC\0" + /* BadIDChoice */ "BadIDChoice\0" + /* BadName */ "BadName\0" + /* BadLength */ "BadLength\0" + /* BadImplementation */ "BadImplementation" +; + +/* offsets into _XErrorList */ +static const unsigned char _XErrorOffsets[] = { + 0, 9, 20, 29, 39, 49, 57, 67, 75, 84, 96, + 106, 115, 124, 130, 142, 150, 160 +}; + + +int +XGetErrorText( + register Display *dpy, + register int code, + char *buffer, + int nbytes) +{ + char buf[150]; + register _XExtension *ext; + _XExtension *bext = (_XExtension *)NULL; + + if (nbytes == 0) return 0; + if (code <= BadImplementation && code > 0) { + snprintf(buf, sizeof(buf), "%d", code); + (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, + _XErrorList + _XErrorOffsets[code], + buffer, nbytes); + } else + buffer[0] = '\0'; + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->error_string) + (*ext->error_string)(dpy, code, &ext->codes, buffer, nbytes); + if (ext->codes.first_error && + ext->codes.first_error <= code && + (!bext || ext->codes.first_error > bext->codes.first_error)) + bext = ext; + } + if (!buffer[0] && bext) { + snprintf(buf, sizeof(buf), "%s.%d", + bext->name, code - bext->codes.first_error); + (void) XGetErrorDatabaseText(dpy, "XProtoError", buf, "", buffer, nbytes); + } + if (!buffer[0]) + snprintf(buffer, nbytes, "%d", code); + return 0; +} + +int +/*ARGSUSED*/ +XGetErrorDatabaseText( + Display *dpy, + register _Xconst char *name, + register _Xconst char *type, + _Xconst char *defaultp, + char *buffer, + int nbytes) +{ + + static XrmDatabase db = NULL; + XrmString type_str; + XrmValue result; + char temp[BUFSIZ]; + char* tptr; + unsigned long tlen; + + if (nbytes == 0) return 0; + + if (!db) { + /* the Xrm routines expect to be called with the global + mutex unlocked. */ + XrmDatabase temp_db; + int do_destroy; + const char *dbname; + + XrmInitialize(); +#ifdef WIN32 + dbname = getenv("XERRORDB"); + if (!dbname) + dbname = ERRORDB; +#else + dbname = ERRORDB; +#endif + temp_db = XrmGetFileDatabase(dbname); + + _XLockMutex(_Xglobal_lock); + if (!db) { + db = temp_db; + do_destroy = 0; + } else + do_destroy = 1; /* we didn't need to get it after all */ + _XUnlockMutex(_Xglobal_lock); + + if (do_destroy) + XrmDestroyDatabase(temp_db); + } + + if (db) + { + tlen = strlen (name) + strlen (type) + 2; + if (tlen <= sizeof(temp)) + tptr = temp; + else + tptr = Xmalloc (tlen); + if (tptr) { + snprintf(tptr, tlen, "%s.%s", name, type); + XrmGetResource(db, tptr, "ErrorType.ErrorNumber", + &type_str, &result); + if (tptr != temp) + Xfree (tptr); + } else { + result.addr = (XPointer) NULL; + } + } + else + result.addr = (XPointer)NULL; + if (!result.addr) { + result.addr = (XPointer) defaultp; + result.size = strlen(defaultp) + 1; + } + (void) strncpy (buffer, (char *) result.addr, nbytes); + if (result.size > nbytes) buffer[nbytes-1] = '\0'; + return 0; +} diff --git a/nx-X11/lib/src/ErrHndlr.c b/nx-X11/lib/src/ErrHndlr.c new file mode 100644 index 000000000..167a68b1e --- /dev/null +++ b/nx-X11/lib/src/ErrHndlr.c @@ -0,0 +1,86 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * XErrorHandler - This procedure sets the X non-fatal error handler + * (_XErrorFunction) to be the specified routine. If NULL is passed in + * the original error handler is restored. + */ + +XErrorHandler +XSetErrorHandler(XErrorHandler handler) +{ + int (*oldhandler)(Display *dpy, XErrorEvent *event); + + _XLockMutex(_Xglobal_lock); + oldhandler = _XErrorFunction; + + if (!oldhandler) + oldhandler = _XDefaultError; + + if (handler != NULL) { + _XErrorFunction = handler; + } + else { + _XErrorFunction = _XDefaultError; + } + _XUnlockMutex(_Xglobal_lock); + + return (XErrorHandler) oldhandler; +} + +/* + * XIOErrorHandler - This procedure sets the X fatal I/O error handler + * (_XIOErrorFunction) to be the specified routine. If NULL is passed in + * the original error handler is restored. + */ + +XIOErrorHandler +XSetIOErrorHandler(XIOErrorHandler handler) +{ + int (*oldhandler)(Display *dpy); + + _XLockMutex(_Xglobal_lock); + oldhandler = _XIOErrorFunction; + + if (!oldhandler) + oldhandler = _XDefaultIOError; + + if (handler != NULL) { + _XIOErrorFunction = handler; + } + else { + _XIOErrorFunction = _XDefaultIOError; + } + _XUnlockMutex(_Xglobal_lock); + + return (XIOErrorHandler) oldhandler; +} diff --git a/nx-X11/lib/src/EvToWire.c b/nx-X11/lib/src/EvToWire.c new file mode 100644 index 000000000..4aca053ab --- /dev/null +++ b/nx-X11/lib/src/EvToWire.c @@ -0,0 +1,406 @@ + +/* + +Copyright 1985, 1986, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * XEvToWire.c - Internal support routines for the C subroutine + * interface library (Xlib) to the X Window System Protocol V11.0. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Reformat an XEvent structure to a wire event of the right type. + * Return True on success. If the type is unrecognized, return what + * _XUnknownNativeEvent returns (i.e., False). + */ +Status +_XEventToWire( + register Display *dpy, + register XEvent *re, /* in: from */ + register xEvent *event) /* out: to */ +{ + switch (event->u.u.type = re->type) { + case KeyPress: + case KeyRelease: + { + register XKeyEvent *ev = (XKeyEvent*) re; + event->u.keyButtonPointer.root = ev->root; + event->u.keyButtonPointer.event = ev->window; + event->u.keyButtonPointer.child = ev->subwindow; + event->u.keyButtonPointer.time = ev->time; + event->u.keyButtonPointer.eventX = ev->x ; + event->u.keyButtonPointer.eventY = ev->y ; + event->u.keyButtonPointer.rootX = ev->x_root; + event->u.keyButtonPointer.rootY = ev->y_root; + event->u.keyButtonPointer.state = ev->state; + event->u.keyButtonPointer.sameScreen = ev->same_screen; + event->u.u.detail = ev->keycode; + } + break; + case ButtonPress: + case ButtonRelease: + { + register XButtonEvent *ev = (XButtonEvent *) re; + event->u.keyButtonPointer.root = ev->root; + event->u.keyButtonPointer.event = ev->window; + event->u.keyButtonPointer.child = ev->subwindow; + event->u.keyButtonPointer.time = ev->time; + event->u.keyButtonPointer.eventX = ev->x; + event->u.keyButtonPointer.eventY = ev->y; + event->u.keyButtonPointer.rootX = ev->x_root; + event->u.keyButtonPointer.rootY = ev->y_root; + event->u.keyButtonPointer.state = ev->state; + event->u.keyButtonPointer.sameScreen = ev->same_screen; + event->u.u.detail = ev->button; + } + break; + case MotionNotify: + { + register XMotionEvent *ev = (XMotionEvent *)re; + event->u.keyButtonPointer.root = ev->root; + event->u.keyButtonPointer.event = ev->window; + event->u.keyButtonPointer.child = ev->subwindow; + event->u.keyButtonPointer.time = ev->time; + event->u.keyButtonPointer.eventX= ev->x; + event->u.keyButtonPointer.eventY= ev->y; + event->u.keyButtonPointer.rootX = ev->x_root; + event->u.keyButtonPointer.rootY = ev->y_root; + event->u.keyButtonPointer.state = ev->state; + event->u.keyButtonPointer.sameScreen= ev->same_screen; + event->u.u.detail = ev->is_hint; + } + break; + case EnterNotify: + case LeaveNotify: + { + register XCrossingEvent *ev = (XCrossingEvent *) re; + event->u.enterLeave.root = ev->root; + event->u.enterLeave.event = ev->window; + event->u.enterLeave.child = ev->subwindow; + event->u.enterLeave.time = ev->time; + event->u.enterLeave.eventX = ev->x; + event->u.enterLeave.eventY = ev->y; + event->u.enterLeave.rootX = ev->x_root; + event->u.enterLeave.rootY = ev->y_root; + event->u.enterLeave.state = ev->state; + event->u.enterLeave.mode = ev->mode; + event->u.enterLeave.flags = 0; + if (ev->same_screen) { + event->u.enterLeave.flags |= ELFlagSameScreen; + } + if (ev->focus) { + event->u.enterLeave.flags |= ELFlagFocus; + } + event->u.u.detail = ev->detail; + } + break; + case FocusIn: + case FocusOut: + { + register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; + event->u.focus.window = ev->window; + event->u.focus.mode = ev->mode; + event->u.u.detail = ev->detail; + } + break; + case KeymapNotify: + { + register XKeymapEvent *ev = (XKeymapEvent *) re; + memcpy ((char *)(((xKeymapEvent *) event)->map), + &ev->key_vector[1], + sizeof (((xKeymapEvent *) event)->map)); + } + break; + case Expose: + { + register XExposeEvent *ev = (XExposeEvent *) re; + event->u.expose.window = ev->window; + event->u.expose.x = ev->x; + event->u.expose.y = ev->y; + event->u.expose.width = ev->width; + event->u.expose.height = ev->height; + event->u.expose.count = ev->count; + } + break; + case GraphicsExpose: + { + register XGraphicsExposeEvent *ev = + (XGraphicsExposeEvent *) re; + event->u.graphicsExposure.drawable = ev->drawable; + event->u.graphicsExposure.x = ev->x; + event->u.graphicsExposure.y = ev->y; + event->u.graphicsExposure.width = ev->width; + event->u.graphicsExposure.height = ev->height; + event->u.graphicsExposure.count = ev->count; + event->u.graphicsExposure.majorEvent= ev->major_code; + event->u.graphicsExposure.minorEvent= ev->minor_code; + } + break; + case NoExpose: + { + register XNoExposeEvent *ev = (XNoExposeEvent *) re; + event->u.noExposure.drawable = ev->drawable; + event->u.noExposure.majorEvent = ev->major_code; + event->u.noExposure.minorEvent = ev->minor_code; + } + break; + case VisibilityNotify: + { + register XVisibilityEvent *ev = (XVisibilityEvent *) re; + event->u.visibility.window = ev->window; + event->u.visibility.state = ev->state; + } + break; + case CreateNotify: + { + register XCreateWindowEvent *ev = + (XCreateWindowEvent *) re; + event->u.createNotify.window = ev->window; + event->u.createNotify.parent = ev->parent; + event->u.createNotify.x = ev->x; + event->u.createNotify.y = ev->y; + event->u.createNotify.width = ev->width; + event->u.createNotify.height = ev->height; + event->u.createNotify.borderWidth = ev->border_width; + event->u.createNotify.override = ev->override_redirect; + } + break; + case DestroyNotify: + { + register XDestroyWindowEvent *ev = + (XDestroyWindowEvent *) re; + event->u.destroyNotify.window = ev->window; + event->u.destroyNotify.event = ev->event; + } + break; + case UnmapNotify: + { + register XUnmapEvent *ev = (XUnmapEvent *) re; + event->u.unmapNotify.window = ev->window; + event->u.unmapNotify.event = ev->event; + event->u.unmapNotify.fromConfigure = ev->from_configure; + } + break; + case MapNotify: + { + register XMapEvent *ev = (XMapEvent *) re; + event->u.mapNotify.window = ev->window; + event->u.mapNotify.event = ev->event; + event->u.mapNotify.override = ev->override_redirect; + } + break; + case MapRequest: + { + register XMapRequestEvent *ev = (XMapRequestEvent *) re; + event->u.mapRequest.window = ev->window; + event->u.mapRequest.parent = ev->parent; + } + break; + case ReparentNotify: + { + register XReparentEvent *ev = (XReparentEvent *) re; + event->u.reparent.window = ev->window; + event->u.reparent.event = ev->event; + event->u.reparent.parent = ev->parent; + event->u.reparent.x = ev->x; + event->u.reparent.y = ev->y; + event->u.reparent.override = ev->override_redirect; + } + break; + case ConfigureNotify: + { + register XConfigureEvent *ev = (XConfigureEvent *) re; + event->u.configureNotify.window = ev->window; + event->u.configureNotify.event = ev->event; + event->u.configureNotify.aboveSibling = ev->above; + event->u.configureNotify.x = ev->x; + event->u.configureNotify.y = ev->y; + event->u.configureNotify.width = ev->width; + event->u.configureNotify.height = ev->height; + event->u.configureNotify.borderWidth= ev->border_width; + event->u.configureNotify.override = ev->override_redirect; + } + break; + case ConfigureRequest: + { + register XConfigureRequestEvent *ev = + (XConfigureRequestEvent *) re; + event->u.configureRequest.window = ev->window; + event->u.configureRequest.parent = ev->parent; + event->u.configureRequest.sibling = ev->above; + event->u.configureRequest.x = ev->x; + event->u.configureRequest.y = ev->y; + event->u.configureRequest.width = ev->width; + event->u.configureRequest.height = ev->height; + event->u.configureRequest.borderWidth= ev->border_width; + event->u.configureRequest.valueMask= ev->value_mask; + event->u.u.detail = ev->detail; + } + break; + case GravityNotify: + { + register XGravityEvent *ev = (XGravityEvent *) re; + event->u.gravity.window = ev->window; + event->u.gravity.event = ev->event; + event->u.gravity.x = ev->x; + event->u.gravity.y = ev->y; + } + break; + case ResizeRequest: + { + register XResizeRequestEvent *ev = + (XResizeRequestEvent *) re; + event->u.resizeRequest.window = ev->window; + event->u.resizeRequest.width = ev->width; + event->u.resizeRequest.height = ev->height; + } + break; + case CirculateNotify: + { + register XCirculateEvent *ev = (XCirculateEvent *) re; + event->u.circulate.window = ev->window; + event->u.circulate.event = ev->event; + event->u.circulate.place = ev->place; + } + break; + case CirculateRequest: + { + register XCirculateRequestEvent *ev = + (XCirculateRequestEvent *) re; + event->u.circulate.window = ev->window; + event->u.circulate.event = ev->parent; + event->u.circulate.place = ev->place; + } + break; + case PropertyNotify: + { + register XPropertyEvent *ev = (XPropertyEvent *) re; + event->u.property.window = ev->window; + event->u.property.atom = ev->atom; + event->u.property.time = ev->time; + event->u.property.state = ev->state; + } + break; + case SelectionClear: + { + register XSelectionClearEvent *ev = + (XSelectionClearEvent *) re; + event->u.selectionClear.window = ev->window; + event->u.selectionClear.atom = ev->selection; + event->u.selectionClear.time = ev->time; + } + break; + case SelectionRequest: + { + register XSelectionRequestEvent *ev = + (XSelectionRequestEvent *) re; + event->u.selectionRequest.owner = ev->owner; + event->u.selectionRequest.requestor = ev->requestor; + event->u.selectionRequest.selection = ev->selection; + event->u.selectionRequest.target = ev->target; + event->u.selectionRequest.property = ev->property; + event->u.selectionRequest.time = ev->time; + } + break; + case SelectionNotify: + { + register XSelectionEvent *ev = (XSelectionEvent *) re; + event->u.selectionNotify.requestor = ev->requestor; + event->u.selectionNotify.selection = ev->selection; + event->u.selectionNotify.target = ev->target; + event->u.selectionNotify.property = ev->property; + event->u.selectionNotify.time = ev->time; + } + break; + case ColormapNotify: + { + register XColormapEvent *ev = (XColormapEvent *) re; + event->u.colormap.window = ev->window; + event->u.colormap.colormap = ev->colormap; + event->u.colormap.new = ev->new; + event->u.colormap.state = ev->state; + } + break; + case ClientMessage: + { + register int i; + register XClientMessageEvent *ev + = (XClientMessageEvent *) re; + event->u.clientMessage.window = ev->window; + event->u.u.detail = ev->format; + switch (ev->format) { + case 8: + event->u.clientMessage.u.b.type = ev->message_type; + for (i = 0; i < 20; i++) + event->u.clientMessage.u.b.bytes[i] = ev->data.b[i]; + break; + case 16: + event->u.clientMessage.u.s.type = ev->message_type; + event->u.clientMessage.u.s.shorts0 = ev->data.s[0]; + event->u.clientMessage.u.s.shorts1 = ev->data.s[1]; + event->u.clientMessage.u.s.shorts2 = ev->data.s[2]; + event->u.clientMessage.u.s.shorts3 = ev->data.s[3]; + event->u.clientMessage.u.s.shorts4 = ev->data.s[4]; + event->u.clientMessage.u.s.shorts5 = ev->data.s[5]; + event->u.clientMessage.u.s.shorts6 = ev->data.s[6]; + event->u.clientMessage.u.s.shorts7 = ev->data.s[7]; + event->u.clientMessage.u.s.shorts8 = ev->data.s[8]; + event->u.clientMessage.u.s.shorts9 = ev->data.s[9]; + break; + case 32: + event->u.clientMessage.u.l.type = ev->message_type; + event->u.clientMessage.u.l.longs0 = ev->data.l[0]; + event->u.clientMessage.u.l.longs1 = ev->data.l[1]; + event->u.clientMessage.u.l.longs2 = ev->data.l[2]; + event->u.clientMessage.u.l.longs3 = ev->data.l[3]; + event->u.clientMessage.u.l.longs4 = ev->data.l[4]; + break; + default: + /* client passing bogus data, let server complain */ + break; + } + } + break; + case MappingNotify: + { + register XMappingEvent *ev = (XMappingEvent *) re; + event->u.mappingNotify.firstKeyCode = ev->first_keycode; + event->u.mappingNotify.request = ev->request; + event->u.mappingNotify.count = ev->count; + } + break; + + default: + return(_XUnknownNativeEvent(dpy, re, event)); + } + return(1); +} diff --git a/nx-X11/lib/src/FSSaver.c b/nx-X11/lib/src/FSSaver.c new file mode 100644 index 000000000..3df8ae681 --- /dev/null +++ b/nx-X11/lib/src/FSSaver.c @@ -0,0 +1,60 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XActivateScreenSaver(register Display *dpy) +{ + XForceScreenSaver (dpy, ScreenSaverActive); + return 1; +} + +int +XResetScreenSaver(register Display *dpy) +{ + XForceScreenSaver (dpy, ScreenSaverReset); + return 1; +} + +int +XForceScreenSaver( + register Display *dpy, + int mode) +{ + register xForceScreenSaverReq *req; + + LockDisplay(dpy); + GetReq(ForceScreenSaver, req); + req->mode = mode; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/FSWrap.c b/nx-X11/lib/src/FSWrap.c new file mode 100644 index 000000000..015965779 --- /dev/null +++ b/nx-X11/lib/src/FSWrap.c @@ -0,0 +1,262 @@ + +/* + * Copyright 1991 by the Open Software Foundation + * Copyright 1993 by the TOSHIBA Corp. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 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 + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * 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 + * 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 + * + * Katsuhisa Yano TOSHIBA Corp. + */ + +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include +#include + + +#define XMAXLIST 256 + +char ** +_XParseBaseFontNameList( + char *str, + int *num) +{ + char *plist[XMAXLIST]; + char **list; + char *ptr, *psave; + + *num = 0; + if (!str || !*str) { + return (char **)NULL; + } + while (*str && isspace(*str)) + str++; + if (!*str) + return (char **)NULL; + + if (!(ptr = strdup(str))) { + return (char **)NULL; + } + + psave = ptr; + /* somebody who specifies more than XMAXLIST basefontnames will lose */ + while (*num < (sizeof plist / sizeof plist[0])) { + char *back; + + plist[*num] = ptr; + if ((ptr = strchr(ptr, ','))) { + back = ptr; + } else { + back = plist[*num] + strlen(plist[*num]); + } + while (isspace(*(back - 1))) + back--; + *back = '\0'; + (*num)++; + if (!ptr) + break; + ptr++; + while (*ptr && isspace(*ptr)) + ptr++; + if (!*ptr) + break; + } + if (!(list = Xmalloc(sizeof(char *) * (*num + 1)))) { + Xfree(psave); + return (char **)NULL; + } + memcpy((char *)list, (char *)plist, sizeof(char *) * (*num)); + *(list + *num) = NULL; + + return list; +} + +static char ** +copy_string_list( + char **string_list, + int list_count) +{ + char **string_list_ret, **list_src, **list_dst, *dst; + int length, count; + + if (string_list == NULL || list_count <= 0) + return (char **) NULL; + + string_list_ret = Xmalloc(sizeof(char *) * list_count); + if (string_list_ret == NULL) + return (char **) NULL; + + list_src = string_list; + count = list_count; + for (length = 0; count-- > 0; list_src++) + length += strlen(*list_src) + 1; + + dst = Xmalloc(length); + if (dst == NULL) { + Xfree(string_list_ret); + return (char **) NULL; + } + + list_src = string_list; + count = list_count; + list_dst = string_list_ret; + for ( ; count-- > 0; list_src++) { + strcpy(dst, *list_src); + *list_dst++ = dst; + dst += strlen(dst) + 1; + } + + return string_list_ret; +} + +XFontSet +XCreateFontSet ( + Display *dpy, + _Xconst char *base_font_name_list, + char ***missing_charset_list, + int *missing_charset_count, + char **def_string) +{ + XOM om; + XOC oc; + XOMCharSetList *list; + + *missing_charset_list = NULL; + *missing_charset_count = 0; + + om = XOpenOM(dpy, NULL, NULL, NULL); + if (om == NULL) + return (XFontSet) NULL; + + if ((oc = XCreateOC(om, XNBaseFontName, base_font_name_list, NULL))) { + list = &oc->core.missing_list; + oc->core.om_automatic = True; + } else + list = &om->core.required_charset; + + *missing_charset_list = copy_string_list(list->charset_list, + list->charset_count); + *missing_charset_count = list->charset_count; + + if (list->charset_list && *missing_charset_list == NULL) + oc = NULL; + + if (oc && def_string) { + *def_string = oc->core.default_string; + if (!*def_string) + *def_string = ""; + } + + if (oc == NULL) + XCloseOM(om); + + return (XFontSet) oc; +} + +int +XFontsOfFontSet( + XFontSet font_set, + XFontStruct ***font_struct_list, + char ***font_name_list) +{ + *font_name_list = font_set->core.font_info.font_name_list; + *font_struct_list = font_set->core.font_info.font_struct_list; + return font_set->core.font_info.num_font; +} + +char * +XBaseFontNameListOfFontSet(XFontSet font_set) +{ + return font_set->core.base_name_list; +} + +char * +XLocaleOfFontSet(XFontSet font_set) +{ + return font_set->core.om->core.lcd->core->name; +} + +Bool +XContextDependentDrawing(XFontSet font_set) +{ + return font_set->core.om->core.context_dependent; +} + +Bool +XDirectionalDependentDrawing(XFontSet font_set) +{ + return font_set->core.om->core.directional_dependent; +} + +Bool +XContextualDrawing(XFontSet font_set) +{ + return font_set->core.om->core.contextual_drawing; +} + +XFontSetExtents * +XExtentsOfFontSet(XFontSet font_set) +{ + if (!font_set) + return NULL; + return &font_set->core.font_set_extents; +} + +void +XFreeFontSet( + Display *dpy, + XFontSet font_set) +{ + XCloseOM(font_set->core.om); +} diff --git a/nx-X11/lib/src/FetchName.c b/nx-X11/lib/src/FetchName.c new file mode 100644 index 000000000..52c65c52c --- /dev/null +++ b/nx-X11/lib/src/FetchName.c @@ -0,0 +1,95 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include + + +Status XFetchName ( + register Display *dpy, + Window w, + char **name) +{ + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long leftover; + unsigned char *data = NULL; + if (XGetWindowProperty(dpy, w, XA_WM_NAME, 0L, (long)BUFSIZ, False, XA_STRING, + &actual_type, + &actual_format, &nitems, &leftover, &data) != Success) { + *name = NULL; + return (0); + } + if ( (actual_type == XA_STRING) && (actual_format == 8) ) { + + /* The data returned by XGetWindowProperty is guarranteed to + contain one extra byte that is null terminated to make retrieveing + string properties easy. */ + + *name = (char *)data; + return(1); + } + Xfree (data); + *name = NULL; + return(0); +} + +Status XGetIconName ( + register Display *dpy, + Window w, + char **icon_name) +{ + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long leftover; + unsigned char *data = NULL; + if (XGetWindowProperty(dpy, w, XA_WM_ICON_NAME, 0L, (long)BUFSIZ, False, + XA_STRING, + &actual_type, + &actual_format, &nitems, &leftover, &data) != Success) { + *icon_name = NULL; + return (0); + } + if ( (actual_type == XA_STRING) && (actual_format == 8) ) { + + /* The data returned by XGetWindowProperty is guarranteed to + contain one extra byte that is null terminated to make retrieveing + string properties easy. */ + + *icon_name = (char*)data; + return(1); + } + Xfree (data); + *icon_name = NULL; + return(0); +} diff --git a/nx-X11/lib/src/FillArc.c b/nx-X11/lib/src/FillArc.c new file mode 100644 index 000000000..c67f977b7 --- /dev/null +++ b/nx-X11/lib/src/FillArc.c @@ -0,0 +1,86 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* precompute the maximum size of batching request allowed */ + +#define size (SIZEOF(xPolyFillArcReq) + FARCSPERBATCH * SIZEOF(xArc)) + +int +XFillArc( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height, /* CARD16 */ + int angle1, + int angle2) /* INT16 */ +{ + xArc *arc; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + { + register xPolyFillArcReq *req = (xPolyFillArcReq *) dpy->last_req; + + /* if same as previous request, with same drawable, batch requests */ + if ( + (req->reqType == X_PolyFillArc) + && (req->drawable == d) + && (req->gc == gc->gid) + && ((dpy->bufptr + SIZEOF(xArc)) <= dpy->bufmax) + && (((char *)dpy->bufptr - (char *)req) < size) ) { + req->length += SIZEOF(xArc) >> 2; + arc = (xArc *) dpy->bufptr; + dpy->bufptr += SIZEOF(xArc); + } + + else { + GetReqExtra(PolyFillArc, SIZEOF(xArc), req); + + req->drawable = d; + req->gc = gc->gid; + arc = (xArc *) NEXTPTR(req,xPolyFillArcReq); + } + arc->x = x; + arc->y = y; + arc->width = width; + arc->height = height; + arc->angle1 = angle1; + arc->angle2 = angle2; + + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/FillArcs.c b/nx-X11/lib/src/FillArcs.c new file mode 100644 index 000000000..62cfabf8f --- /dev/null +++ b/nx-X11/lib/src/FillArcs.c @@ -0,0 +1,67 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define arc_scale (SIZEOF(xArc) / 4) + +int +XFillArcs( + register Display *dpy, + Drawable d, + GC gc, + XArc *arcs, + int n_arcs) +{ + register xPolyFillArcReq *req; + long len; + int n; + + LockDisplay(dpy); + FlushGC(dpy, gc); + while (n_arcs) { + GetReq(PolyFillArc, req); + req->drawable = d; + req->gc = gc->gid; + n = n_arcs; + len = ((long)n) * arc_scale; + if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { + n = (dpy->max_request_size - req->length) / arc_scale; + len = ((long)n) * arc_scale; + } + SetReqLen(req, len, len); + len <<= 2; /* watch out for macros... */ + Data16 (dpy, (short *) arcs, len); + n_arcs -= n; + arcs += n; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/FillPoly.c b/nx-X11/lib/src/FillPoly.c new file mode 100644 index 000000000..ea162a41e --- /dev/null +++ b/nx-X11/lib/src/FillPoly.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XFillPolygon( + register Display *dpy, + Drawable d, + GC gc, + XPoint *points, + int n_points, + int shape, + int mode) +{ + register xFillPolyReq *req; + register long nbytes; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq(FillPoly, req); + + req->drawable = d; + req->gc = gc->gid; + req->shape = shape; + req->coordMode = mode; + + SetReqLen(req, n_points, 65535 - req->length); + + /* shift (mult. by 4) before passing to the (possible) macro */ + + nbytes = n_points << 2; + + Data16 (dpy, (short *) points, nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/FillRct.c b/nx-X11/lib/src/FillRct.c new file mode 100644 index 000000000..3ca9afe9e --- /dev/null +++ b/nx-X11/lib/src/FillRct.c @@ -0,0 +1,82 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* precompute the maximum size of batching request allowed */ + +#define size (SIZEOF(xPolyFillRectangleReq) + FRCTSPERBATCH * SIZEOF(xRectangle)) + +int +XFillRectangle( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, /* INT16 */ + unsigned int width, + unsigned int height) /* CARD16 */ +{ + xRectangle *rect; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + { + register xPolyFillRectangleReq *req + = (xPolyFillRectangleReq *) dpy->last_req; + + /* if same as previous request, with same drawable, batch requests */ + if ( + (req->reqType == X_PolyFillRectangle) + && (req->drawable == d) + && (req->gc == gc->gid) + && ((dpy->bufptr + SIZEOF(xRectangle)) <= dpy->bufmax) + && (((char *)dpy->bufptr - (char *)req) < size) ) { + req->length += SIZEOF(xRectangle) >> 2; + rect = (xRectangle *) dpy->bufptr; + dpy->bufptr += SIZEOF(xRectangle); + } + + else { + GetReqExtra(PolyFillRectangle, SIZEOF(xRectangle), req); + req->drawable = d; + req->gc = gc->gid; + rect = (xRectangle *) NEXTPTR(req,xPolyFillRectangleReq); + } + rect->x = x; + rect->y = y; + rect->width = width; + rect->height = height; + + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/FillRcts.c b/nx-X11/lib/src/FillRcts.c new file mode 100644 index 000000000..ad334244f --- /dev/null +++ b/nx-X11/lib/src/FillRcts.c @@ -0,0 +1,66 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XFillRectangles( + register Display *dpy, + Drawable d, + GC gc, + XRectangle *rectangles, + int n_rects) +{ + register xPolyFillRectangleReq *req; + long len; + int n; + + LockDisplay(dpy); + FlushGC(dpy, gc); + while (n_rects) { + GetReq(PolyFillRectangle, req); + req->drawable = d; + req->gc = gc->gid; + n = n_rects; + len = ((long)n) << 1; + if (!dpy->bigreq_size && len > (dpy->max_request_size - req->length)) { + n = (dpy->max_request_size - req->length) >> 1; + len = ((long)n) << 1; + } + SetReqLen(req, len, len); + len <<= 2; /* watch out for macros... */ + Data16 (dpy, (short *) rectangles, len); + n_rects -= n; + rectangles += n; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/FilterEv.c b/nx-X11/lib/src/FilterEv.c new file mode 100644 index 000000000..0a48e5486 --- /dev/null +++ b/nx-X11/lib/src/FilterEv.c @@ -0,0 +1,106 @@ + + /* + * Copyright 1990, 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 OMRON not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON 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 + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Seiji Kuwari OMRON Corporation + * kuwa@omron.co.jp + * kuwa%omron.co.jp@uunet.uu.net + */ + +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#else +#define XLOCALE 1 +#endif +#include "Xlibint.h" +#if XLOCALE +#include "Xlcint.h" +#endif + +extern long const _Xevent_to_mask[]; + +/* + * Look up if there is a specified filter for the event. + */ +Bool +XFilterEvent( + XEvent *ev, + Window window) +{ +#if XLOCALE + XFilterEventList p; + Window win; + long mask; + Bool ret; + + if (window) + win = window; + else + win = ev->xany.window; + if (ev->type >= LASTEvent) + mask = 0; + else + mask = _Xevent_to_mask[ev->type]; + + LockDisplay(ev->xany.display); + for (p = ev->xany.display->im_filters; p != NULL; p = p->next) { + if (win == p->window) { + if ((mask & p->event_mask) || + (ev->type >= p->start_type && ev->type <= p->end_type)) { + UnlockDisplay(ev->xany.display); + ret = (*(p->filter))(ev->xany.display, p->window, ev, + p->client_data); + return(ret); + } + } + } + UnlockDisplay(ev->xany.display); +#endif + return(False); +} diff --git a/nx-X11/lib/src/Flush.c b/nx-X11/lib/src/Flush.c new file mode 100644 index 000000000..46168999b --- /dev/null +++ b/nx-X11/lib/src/Flush.c @@ -0,0 +1,42 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* Flush all buffered output requests. */ +/* NOTE: NOT necessary when calling any of the Xlib routines. */ + +int +XFlush (register Display *dpy) +{ + LockDisplay(dpy); + _XFlush (dpy); + UnlockDisplay(dpy); + return 1; + } diff --git a/nx-X11/lib/src/Font.c b/nx-X11/lib/src/Font.c new file mode 100644 index 000000000..6bbab3f19 --- /dev/null +++ b/nx-X11/lib/src/Font.c @@ -0,0 +1,708 @@ +/* + +Copyright 1986, 1998 The Open Group +Copyright (c) 2000 The XFree86 Project, Inc. + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +X CONSORTIUM OR THE XFREE86 PROJECT BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + +Except as contained in this notice, the name of the X Consortium or of the +XFree86 Project shall not be used in advertising or otherwise to promote the +sale, use or other dealings in this Software without prior written +authorization from the X Consortium and the XFree86 Project. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +#if defined(XF86BIGFONT) +#define USE_XF86BIGFONT +#endif +#ifdef USE_XF86BIGFONT +#include +#ifdef HAS_SHM +#include +#include +#endif + +#include +#include +#include +#endif + +#include "Xlcint.h" +#include "XlcPubI.h" + + +static XFontStruct *_XQueryFont( + Display* /* dpy */, + Font /* fid */, + unsigned long /* seq */ +); + +#ifdef USE_XF86BIGFONT + +/* Private data for this extension. */ +typedef struct { + XExtCodes *codes; + CARD32 serverSignature; + CARD32 serverCapabilities; +} XF86BigfontCodes; + +/* Additional bit masks that can be set in serverCapabilities */ +#define CAP_VerifiedLocal 256 + +static XF86BigfontCodes *_XF86BigfontCodes( + Display* /* dpy */ +); + +static XFontStruct *_XF86BigfontQueryFont( + Display* /* dpy */, + XF86BigfontCodes* /* extcodes */, + Font /* fid */, + unsigned long /* seq */ +); + +void _XF86BigfontFreeFontMetrics( + XFontStruct* /* fs */ +); + +#endif /* USE_XF86BIGFONT */ + + +XFontStruct *XLoadQueryFont( + register Display *dpy, + _Xconst char *name) +{ + XFontStruct *font_result; + register long nbytes; + Font fid; + xOpenFontReq *req; + unsigned long seq; +#ifdef USE_XF86BIGFONT + XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy); +#endif + + if (_XF86LoadQueryLocaleFont(dpy, name, &font_result, (Font *)0)) + return font_result; + LockDisplay(dpy); + GetReq(OpenFont, req); + seq = dpy->request; + nbytes = req->nbytes = name ? strlen(name) : 0; + req->fid = fid = XAllocID(dpy); + req->length += (nbytes+3)>>2; + Data (dpy, name, nbytes); + font_result = NULL; +#ifdef USE_XF86BIGFONT + if (extcodes) { + font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, seq); + seq = 0; + } +#endif + if (!font_result) + font_result = _XQueryFont(dpy, fid, seq); + UnlockDisplay(dpy); + SyncHandle(); + return font_result; +} + +XFontStruct *XQueryFont ( + register Display *dpy, + Font fid) +{ + XFontStruct *font_result; +#ifdef USE_XF86BIGFONT + XF86BigfontCodes *extcodes = _XF86BigfontCodes(dpy); +#endif + + LockDisplay(dpy); + font_result = NULL; +#ifdef USE_XF86BIGFONT + if (extcodes) { + font_result = _XF86BigfontQueryFont(dpy, extcodes, fid, 0L); + } +#endif + if (!font_result) + font_result = _XQueryFont(dpy, fid, 0L); + UnlockDisplay(dpy); + SyncHandle(); + return font_result; +} + +int +XFreeFont( + register Display *dpy, + XFontStruct *fs) +{ + register xResourceReq *req; + register _XExtension *ext; + + LockDisplay(dpy); + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->free_Font) (*ext->free_Font)(dpy, fs, &ext->codes); + GetResReq (CloseFont, fs->fid, req); + UnlockDisplay(dpy); + SyncHandle(); + if (fs->per_char) { +#ifdef USE_XF86BIGFONT + _XF86BigfontFreeFontMetrics(fs); +#else + Xfree (fs->per_char); +#endif + } + _XFreeExtData(fs->ext_data); + + Xfree (fs->properties); + Xfree (fs); + return 1; +} + + +static XFontStruct * +_XQueryFont ( + register Display *dpy, + Font fid, + unsigned long seq) +{ + register XFontStruct *fs; + unsigned long nbytes; + unsigned long reply_left; /* unused data words left in reply buffer */ + xQueryFontReply reply; + register xResourceReq *req; + register _XExtension *ext; + _XAsyncHandler async; + _XAsyncErrorState async_state; + + if (seq) { + async_state.min_sequence_number = seq; + async_state.max_sequence_number = seq; + async_state.error_code = BadName; + async_state.major_opcode = X_OpenFont; + async_state.minor_opcode = 0; + async_state.error_count = 0; + async.next = dpy->async_handlers; + async.handler = _XAsyncErrorHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + } + GetResReq(QueryFont, fid, req); + if (!_XReply (dpy, (xReply *) &reply, + ((SIZEOF(xQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) { + if (seq) + DeqAsyncHandler(dpy, &async); + return (XFontStruct *)NULL; + } + if (seq) + DeqAsyncHandler(dpy, &async); + reply_left = reply.length - + ((SIZEOF(xQueryFontReply) - SIZEOF(xReply)) >> 2); + if (! (fs = Xmalloc (sizeof (XFontStruct)))) { + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + fs->ext_data = NULL; + fs->fid = fid; + fs->direction = reply.drawDirection; + fs->min_char_or_byte2 = reply.minCharOrByte2; + fs->max_char_or_byte2 = reply.maxCharOrByte2; + fs->min_byte1 = reply.minByte1; + fs->max_byte1 = reply.maxByte1; + fs->default_char = reply.defaultChar; + fs->all_chars_exist = reply.allCharsExist; + fs->ascent = cvtINT16toInt (reply.fontAscent); + fs->descent = cvtINT16toInt (reply.fontDescent); + + /* XXX the next two statements won't work if short isn't 16 bits */ + fs->min_bounds = * (XCharStruct *) &reply.minBounds; + fs->max_bounds = * (XCharStruct *) &reply.maxBounds; + + fs->n_properties = reply.nFontProps; + /* + * if no properties defined for the font, then it is bad + * font, but shouldn't try to read nothing. + */ + fs->properties = NULL; + if (fs->n_properties > 0) { + /* nFontProps is a CARD16 */ + nbytes = reply.nFontProps * SIZEOF(xFontProp); + if ((nbytes >> 2) <= reply_left) { + size_t pbytes = reply.nFontProps * sizeof(XFontProp); + fs->properties = Xmalloc (pbytes); + } + if (! fs->properties) { + Xfree(fs); + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + _XRead32 (dpy, (long *)fs->properties, nbytes); + reply_left -= (nbytes >> 2); + } + /* + * If no characters in font, then it is a bad font, but + * shouldn't try to read nothing. + */ + fs->per_char = NULL; + if (reply.nCharInfos > 0){ + /* nCharInfos is a CARD32 */ + if (reply.nCharInfos < (INT_MAX / sizeof(XCharStruct))) { + nbytes = reply.nCharInfos * SIZEOF(xCharInfo); + if ((nbytes >> 2) <= reply_left) { + size_t cibytes = reply.nCharInfos * sizeof(XCharStruct); + fs->per_char = Xmalloc (cibytes); + } + } + if (! fs->per_char) { + Xfree(fs->properties); + Xfree(fs); + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + + _XRead16 (dpy, (char *)fs->per_char, nbytes); + } + + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes); + return fs; +} + +#ifdef USE_XF86BIGFONT + +/* Magic cookie for finding the right XExtData structure on the display's + extension list. */ +static int XF86BigfontNumber = 1040697125; + +static int +_XF86BigfontFreeCodes ( + XExtData *extension) +{ + /* Don't Xfree(extension->private_data) because it is on the same malloc + chunk as extension. */ + /* Don't Xfree(extension->private_data->codes) because this is shared with + the display's ext_procs list. */ + return 0; +} + +static XF86BigfontCodes * +_XF86BigfontCodes ( + register Display *dpy) +{ + XEDataObject dpy_union; + XExtData *pData; + XF86BigfontCodes *pCodes; + char *envval; + + dpy_union.display = dpy; + + /* If the server is known to support the XF86Bigfont extension, + * return the extension codes. If the server is known to not support + * the extension, don't bother checking again. + */ + pData = XFindOnExtensionList(XEHeadOfExtensionList(dpy_union), + XF86BigfontNumber); + if (pData) + return (XF86BigfontCodes *) pData->private_data; + + pData = Xmalloc(sizeof(XExtData) + sizeof(XF86BigfontCodes)); + if (!pData) { + /* Out of luck. */ + return (XF86BigfontCodes *) NULL; + } + + /* See if the server supports the XF86Bigfont extension. */ + envval = getenv("XF86BIGFONT_DISABLE"); /* Let the user disable it. */ + if (envval != NULL && envval[0] != '\0') + pCodes = NULL; + else { + XExtCodes *codes = XInitExtension(dpy, XF86BIGFONTNAME); + if (codes == NULL) + pCodes = NULL; + else { + pCodes = (XF86BigfontCodes *) &pData[1]; + pCodes->codes = codes; + } + } + pData->number = XF86BigfontNumber; + pData->private_data = (XPointer) pCodes; + pData->free_private = _XF86BigfontFreeCodes; + XAddToExtensionList(XEHeadOfExtensionList(dpy_union), pData); + if (pCodes) { + int result; + + /* See if the server supports the XF86BigfontQueryFont request. */ + xXF86BigfontQueryVersionReply reply; + register xXF86BigfontQueryVersionReq *req; + + LockDisplay(dpy); + + GetReq(XF86BigfontQueryVersion, req); + req->reqType = pCodes->codes->major_opcode; + req->xf86bigfontReqType = X_XF86BigfontQueryVersion; + + result = _XReply (dpy, (xReply *) &reply, + (SIZEOF(xXF86BigfontQueryVersionReply) - SIZEOF(xReply)) >> 2, + xFalse); + + UnlockDisplay(dpy); + SyncHandle(); + + if(!result) + goto ignore_extension; + + /* No need to provide backward compatibility with version 1.0. It + was never widely distributed. */ + if (!(reply.majorVersion > 1 + || (reply.majorVersion == 1 && reply.minorVersion >= 1))) + goto ignore_extension; + + pCodes->serverSignature = reply.signature; + pCodes->serverCapabilities = reply.capabilities; + } + return pCodes; + + ignore_extension: + /* No need to Xfree(pCodes) or Xfree(pCodes->codes), see + _XF86BigfontFreeCodes comment. */ + pCodes = (XF86BigfontCodes *) NULL; + pData->private_data = (XPointer) pCodes; + return pCodes; +} + +static int +_XF86BigfontFreeNop ( + XExtData *extension) +{ + return 0; +} + +static XFontStruct * +_XF86BigfontQueryFont ( + register Display *dpy, + XF86BigfontCodes *extcodes, + Font fid, + unsigned long seq) +{ + register XFontStruct *fs; + unsigned long nbytes; + unsigned long reply_left; /* unused data left in reply buffer */ + xXF86BigfontQueryFontReply reply; + register xXF86BigfontQueryFontReq *req; + register _XExtension *ext; + _XAsyncHandler async1; + _XAsyncErrorState async1_state; + _XAsyncHandler async2; + _XAsyncErrorState async2_state; + + if (seq) { + async1_state.min_sequence_number = seq; + async1_state.max_sequence_number = seq; + async1_state.error_code = BadName; + async1_state.major_opcode = X_OpenFont; + async1_state.minor_opcode = 0; + async1_state.error_count = 0; + async1.next = dpy->async_handlers; + async1.handler = _XAsyncErrorHandler; + async1.data = (XPointer)&async1_state; + dpy->async_handlers = &async1; + } + + GetReq(XF86BigfontQueryFont, req); + req->reqType = extcodes->codes->major_opcode; + req->xf86bigfontReqType = X_XF86BigfontQueryFont; + req->id = fid; + req->flags = (extcodes->serverCapabilities & XF86Bigfont_CAP_LocalShm + ? XF86Bigfont_FLAGS_Shm : 0); + + /* The function _XQueryFont benefits from a "magic" error handler for + BadFont coming from a X_QueryFont request. (See function _XReply.) + We have to establish an error handler ourselves. */ + async2_state.min_sequence_number = dpy->request; + async2_state.max_sequence_number = dpy->request; + async2_state.error_code = BadFont; + async2_state.major_opcode = extcodes->codes->major_opcode; + async2_state.minor_opcode = X_XF86BigfontQueryFont; + async2_state.error_count = 0; + async2.next = dpy->async_handlers; + async2.handler = _XAsyncErrorHandler; + async2.data = (XPointer)&async2_state; + dpy->async_handlers = &async2; + + if (!_XReply (dpy, (xReply *) &reply, + ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2), xFalse)) { + DeqAsyncHandler(dpy, &async2); + if (seq) + DeqAsyncHandler(dpy, &async1); + return (XFontStruct *)NULL; + } + DeqAsyncHandler(dpy, &async2); + if (seq) + DeqAsyncHandler(dpy, &async1); + reply_left = reply.length - + ((SIZEOF(xXF86BigfontQueryFontReply) - SIZEOF(xReply)) >> 2); + if (! (fs = Xmalloc (sizeof (XFontStruct)))) { + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + fs->ext_data = NULL; + fs->fid = fid; + fs->direction = reply.drawDirection; + fs->min_char_or_byte2 = reply.minCharOrByte2; + fs->max_char_or_byte2 = reply.maxCharOrByte2; + fs->min_byte1 = reply.minByte1; + fs->max_byte1 = reply.maxByte1; + fs->default_char = reply.defaultChar; + fs->all_chars_exist = reply.allCharsExist; + fs->ascent = cvtINT16toInt (reply.fontAscent); + fs->descent = cvtINT16toInt (reply.fontDescent); + + /* XXX the next two statements won't work if short isn't 16 bits */ + fs->min_bounds = * (XCharStruct *) &reply.minBounds; + fs->max_bounds = * (XCharStruct *) &reply.maxBounds; + + fs->n_properties = reply.nFontProps; + /* + * if no properties defined for the font, then it is bad + * font, but shouldn't try to read nothing. + */ + fs->properties = NULL; + if (fs->n_properties > 0) { + /* nFontProps is a CARD16 */ + nbytes = reply.nFontProps * SIZEOF(xFontProp); + if ((nbytes >> 2) <= reply_left) { + size_t pbytes = reply.nFontProps * sizeof(XFontProp); + fs->properties = Xmalloc (pbytes); + } + if (! fs->properties) { + Xfree(fs); + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + _XRead32 (dpy, (long *)fs->properties, nbytes); + reply_left -= (nbytes >> 2); + } + + fs->per_char = NULL; +#ifndef LONG64 + /* compares each part to half the maximum, which should be far more than + any real font needs, so the combined total doesn't overflow either */ + if (reply.nUniqCharInfos > ((ULONG_MAX / 2) / SIZEOF(xCharInfo)) || + reply.nCharInfos > ((ULONG_MAX / 2) / sizeof(CARD16))) { + Xfree(fs->properties); + Xfree(fs); + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } +#endif + if (reply.nCharInfos > 0) { + /* fprintf(stderr, "received font metrics, nCharInfos = %d, nUniqCharInfos = %d, shmid = %d\n", reply.nCharInfos, reply.nUniqCharInfos, reply.shmid); */ + if (reply.shmid == (CARD32)(-1)) { + xCharInfo* pUniqCI; + CARD16* pIndex2UniqIndex; + int i; + + nbytes = reply.nUniqCharInfos * SIZEOF(xCharInfo) + + (reply.nCharInfos+1)/2 * 2 * sizeof(CARD16); + pUniqCI = Xmalloc (nbytes); + if (!pUniqCI) { + Xfree(fs->properties); + Xfree(fs); + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + if (! (fs->per_char = Xmalloc (reply.nCharInfos * sizeof(XCharStruct)))) { + Xfree(pUniqCI); + Xfree(fs->properties); + Xfree(fs); + _XEatDataWords(dpy, reply_left); + return (XFontStruct *)NULL; + } + _XRead16 (dpy, (char *) pUniqCI, nbytes); + pIndex2UniqIndex = (CARD16*) (pUniqCI + reply.nUniqCharInfos); + for (i = 0; i < reply.nCharInfos; i++) { + if (pIndex2UniqIndex[i] >= reply.nUniqCharInfos) { + fprintf(stderr, "_XF86BigfontQueryFont: server returned wrong data\n"); + Xfree(pUniqCI); + Xfree(fs->properties); + Xfree(fs); + return (XFontStruct *)NULL; + } + /* XXX the next statement won't work if short isn't 16 bits */ + fs->per_char[i] = * (XCharStruct *) &pUniqCI[pIndex2UniqIndex[i]]; + } + Xfree(pUniqCI); + } else { +#ifdef HAS_SHM + XExtData *pData; + XEDataObject fs_union; + char *addr; + + pData = Xmalloc(sizeof(XExtData)); + if (!pData) { + Xfree(fs->properties); + Xfree(fs); + return (XFontStruct *)NULL; + } + + /* In some cases (e.g. an ssh daemon forwarding an X session to + a remote machine) it is possible that the X server thinks we + are running on the same machine (because getpeername() and + LocalClient() cannot know about the forwarding) but we are + not really local. Therefore, when we attach the first shared + memory segment, we verify that we are on the same machine as + the X server by checking that 1. shmat() succeeds, 2. the + segment has a sufficient size, 3. it contains the X server's + signature. Then we set the CAP_VerifiedLocal bit to indicate + the verification was successful. */ + + if ((addr = shmat(reply.shmid, NULL, SHM_RDONLY)) == (char *)-1) { + if (extcodes->serverCapabilities & CAP_VerifiedLocal) + fprintf(stderr, "_XF86BigfontQueryFont: could not attach shm segment\n"); + Xfree(pData); + Xfree(fs->properties); + Xfree(fs); + /* Stop requesting shared memory transport from now on. */ + extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; + return (XFontStruct *)NULL; + } + + if (!(extcodes->serverCapabilities & CAP_VerifiedLocal)) { + struct shmid_ds buf; + if (!(shmctl(reply.shmid, IPC_STAT, &buf) >= 0 + && reply.nCharInfos < (INT_MAX / sizeof(XCharStruct)) + && buf.shm_segsz >= reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct) + sizeof(CARD32) + && *(CARD32 *)(addr + reply.shmsegoffset + reply.nCharInfos * sizeof(XCharStruct)) == extcodes->serverSignature)) { + shmdt(addr); + Xfree(pData); + Xfree(fs->properties); + Xfree(fs); + /* Stop requesting shared memory transport from now on. */ + extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; + return (XFontStruct *)NULL; + } + extcodes->serverCapabilities |= CAP_VerifiedLocal; + } + + pData->number = XF86BigfontNumber; + pData->private_data = (XPointer) addr; + pData->free_private = _XF86BigfontFreeNop; + fs_union.font = fs; + XAddToExtensionList(XEHeadOfExtensionList(fs_union), pData); + + fs->per_char = (XCharStruct *) (addr + reply.shmsegoffset); +#else + fprintf(stderr, "_XF86BigfontQueryFont: try recompiling libX11 with HasShm, Xserver has shm support\n"); + if (fs->properties) Xfree(fs->properties); + Xfree(fs); + /* Stop requesting shared memory transport from now on. */ + extcodes->serverCapabilities &= ~ XF86Bigfont_CAP_LocalShm; + return (XFontStruct *)NULL; +#endif + } + } + + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->create_Font) (*ext->create_Font)(dpy, fs, &ext->codes); + return fs; +} + +void +_XF86BigfontFreeFontMetrics (XFontStruct *fs) +{ +#ifdef HAS_SHM + XExtData *pData; + XEDataObject fs_union; + + fs_union.font = fs; + if ((pData = XFindOnExtensionList(XEHeadOfExtensionList(fs_union), + XF86BigfontNumber))) + shmdt ((char *) pData->private_data); + else + Xfree (fs->per_char); +#else + Xfree (fs->per_char); +#endif +} + +#endif /* USE_XF86BIGFONT */ + +int _XF86LoadQueryLocaleFont( + Display *dpy, + _Xconst char *name, + XFontStruct **xfp, + Font *fidp) +{ + int l; + const char *charset, *p; + char buf[256]; + XFontStruct *fs; + XLCd lcd; + + if (!name) + return 0; + l = strlen(name); + if (l < 2 || name[l - 1] != '*' || name[l - 2] != '-') + return 0; + charset = NULL; + /* next three lines stolen from _XkbGetCharset() */ + lcd = _XlcCurrentLC(); + if ((lcd = _XlcCurrentLC()) != 0) + charset = XLC_PUBLIC(lcd, encoding_name); + if (!charset || (p = strrchr(charset, '-')) == 0 || p == charset || p[1] == 0 || (p[1] == '*' && p[2] == 0)) { + /* prefer latin1 if no encoding found */ + charset = "ISO8859-1"; + p = charset + 7; + } + if (l - 2 - (p - charset) < 0) + return 0; + if (_XlcNCompareISOLatin1(name + l - 2 - (p - charset), charset, p - charset)) + return 0; + if (strlen(p + 1) + l - 1 >= sizeof(buf) - 1) + return 0; + strcpy(buf, name); + strcpy(buf + l - 1, p + 1); + fs = XLoadQueryFont(dpy, buf); + if (!fs) + return 0; + if (xfp) { + *xfp = fs; + if (fidp) + *fidp = fs->fid; + } else if (fidp) { + if (fs->per_char) { +#ifdef USE_XF86BIGFONT + _XF86BigfontFreeFontMetrics(fs); +#else + Xfree (fs->per_char); +#endif + } + _XFreeExtData(fs->ext_data); + + Xfree (fs->properties); + *fidp = fs->fid; + Xfree (fs); + } else { + XFreeFont(dpy, fs); + } + return 1; +} diff --git a/nx-X11/lib/src/FontInfo.c b/nx-X11/lib/src/FontInfo.c new file mode 100644 index 000000000..a2d12c2ec --- /dev/null +++ b/nx-X11/lib/src/FontInfo.c @@ -0,0 +1,227 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +#if defined(XF86BIGFONT) +#define USE_XF86BIGFONT +#endif +#ifdef USE_XF86BIGFONT +extern void _XF86BigfontFreeFontMetrics( + XFontStruct* /* fs */ +); +#endif + +char **XListFontsWithInfo( +register Display *dpy, +_Xconst char *pattern, /* null-terminated */ +int maxNames, +int *actualCount, /* RETURN */ +XFontStruct **info) /* RETURN */ +{ + unsigned long nbytes; + unsigned long reply_left; /* unused data left in reply buffer */ + register int i; + register XFontStruct *fs; + unsigned int size = 0; + XFontStruct *finfo = NULL; + char **flist = NULL; + xListFontsWithInfoReply reply; + register xListFontsReq *req; + int j; + + LockDisplay(dpy); + GetReq(ListFontsWithInfo, req); + req->maxNames = maxNames; + nbytes = req->nbytes = pattern ? strlen (pattern) : 0; + req->length += (nbytes + 3) >> 2; + _XSend (dpy, pattern, nbytes); + /* use _XSend instead of Data, since subsequent _XReply will flush buffer */ + + for (i = 0; ; i++) { + if (!_XReply (dpy, (xReply *) &reply, + ((SIZEOF(xListFontsWithInfoReply) - + SIZEOF(xGenericReply)) >> 2), xFalse)) { + reply.nameLength = 0; /* avoid trying to read more replies */ + reply_left = 0; + goto badmem; + } + reply_left = reply.length - + ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) >> 2); + if (reply.nameLength == 0) { + _XEatDataWords(dpy, reply_left); + break; + } + if (reply.nReplies >= (INT_MAX - i)) /* avoid overflowing size */ + goto badmem; + if ((i + reply.nReplies) >= size) { + size = i + reply.nReplies + 1; + + if (size >= (INT_MAX / sizeof(XFontStruct))) + goto badmem; + + if (finfo) { + XFontStruct * tmp_finfo; + char ** tmp_flist; + + tmp_finfo = Xrealloc (finfo, sizeof(XFontStruct) * size); + if (tmp_finfo) + finfo = tmp_finfo; + else + goto badmem; + + tmp_flist = Xrealloc (flist, sizeof(char *) * (size+1)); + if (tmp_flist) + flist = tmp_flist; + else + goto badmem; + } + else { + if (! (finfo = Xmalloc(sizeof(XFontStruct) * size))) + goto clearwire; + if (! (flist = Xmalloc(sizeof(char *) * (size+1)))) { + Xfree(finfo); + goto clearwire; + } + } + } + fs = &finfo[i]; + + fs->ext_data = NULL; + fs->per_char = NULL; + fs->fid = None; + fs->direction = reply.drawDirection; + fs->min_char_or_byte2 = reply.minCharOrByte2; + fs->max_char_or_byte2 = reply.maxCharOrByte2; + fs->min_byte1 = reply.minByte1; + fs->max_byte1 = reply.maxByte1; + fs->default_char = reply.defaultChar; + fs->all_chars_exist = reply.allCharsExist; + fs->ascent = cvtINT16toInt (reply.fontAscent); + fs->descent = cvtINT16toInt (reply.fontDescent); + + /* XXX the next two statements won't work if short isn't 16 bits */ + fs->min_bounds = * (XCharStruct *) &reply.minBounds; + fs->max_bounds = * (XCharStruct *) &reply.maxBounds; + + fs->n_properties = reply.nFontProps; + fs->properties = NULL; + if (fs->n_properties > 0) { + /* nFontProps is a CARD16 */ + nbytes = reply.nFontProps * SIZEOF(xFontProp); + if ((nbytes >> 2) <= reply_left) { + size_t pbytes = reply.nFontProps * sizeof(XFontProp); + fs->properties = Xmalloc (pbytes); + } + if (! fs->properties) + goto badmem; + _XRead32 (dpy, (long *)fs->properties, nbytes); + reply_left -= (nbytes >> 2); + } + + /* nameLength is a CARD8 */ + nbytes = reply.nameLength + 1; + if (!i) + nbytes++; /* make first string 1 byte longer, to match XListFonts */ + flist[i] = Xmalloc (nbytes); + if (! flist[i]) { + if (finfo[i].properties) Xfree(finfo[i].properties); + goto badmem; + } + if (!i) { + *flist[0] = 0; /* zero to distinguish from XListFonts */ + flist[0]++; + } + flist[i][reply.nameLength] = '\0'; + _XReadPad (dpy, flist[i], (long) reply.nameLength); + } + *info = finfo; + *actualCount = i; + if (flist) + flist[i] = NULL; /* required in case XFreeFontNames is called */ + UnlockDisplay(dpy); + SyncHandle(); + return (flist); + + + badmem: + /* Free all memory allocated by this function. */ + for (j=(i-1); (j >= 0); j--) { + if (j == 0) + flist[j]--; /* was incremented above */ + Xfree(flist[j]); + if (finfo[j].properties) Xfree(finfo[j].properties); + } + Xfree(flist); + Xfree(finfo); + + clearwire: + /* Clear the wire. */ + _XEatDataWords(dpy, reply_left); + while ((reply.nameLength != 0) && + _XReply(dpy, (xReply *) &reply, + ((SIZEOF(xListFontsWithInfoReply) - SIZEOF(xGenericReply)) + >> 2), xTrue)); + UnlockDisplay(dpy); + SyncHandle(); + *info = NULL; + *actualCount = 0; + return (char **) NULL; +} + +int +XFreeFontInfo ( + char **names, + XFontStruct *info, + int actualCount) +{ + register int i; + if (names) { + Xfree (names[0]-1); + for (i = 1; i < actualCount; i++) { + Xfree (names[i]); + } + Xfree(names); + } + if (info) { + for (i = 0; i < actualCount; i++) { + if (info[i].per_char) +#ifdef USE_XF86BIGFONT + _XF86BigfontFreeFontMetrics(&info[i]); +#else + Xfree (info[i].per_char); +#endif + if (info[i].properties) + Xfree (info[i].properties); + } + Xfree(info); + } + return 1; +} diff --git a/nx-X11/lib/src/FontNames.c b/nx-X11/lib/src/FontNames.c new file mode 100644 index 000000000..9ffdfd299 --- /dev/null +++ b/nx-X11/lib/src/FontNames.c @@ -0,0 +1,137 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +char ** +XListFonts( +register Display *dpy, +_Xconst char *pattern, /* null-terminated */ +int maxNames, +int *actualCount) /* RETURN */ +{ + register long nbytes; + register unsigned i; + register int length; + char **flist = NULL; + char *ch = NULL; + char *chstart; + char *chend; + int count = 0; + xListFontsReply rep; + register xListFontsReq *req; + unsigned long rlen = 0; + + LockDisplay(dpy); + GetReq(ListFonts, req); + req->maxNames = maxNames; + nbytes = req->nbytes = pattern ? strlen (pattern) : 0; + req->length += (nbytes + 3) >> 2; + _XSend (dpy, pattern, nbytes); + /* use _XSend instead of Data, since following _XReply will flush buffer */ + + if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { + *actualCount = 0; + UnlockDisplay(dpy); + SyncHandle(); + return (char **) NULL; + } + + if (rep.nFonts) { + flist = Xmalloc (rep.nFonts * sizeof(char *)); + if (rep.length > 0 && rep.length < (INT_MAX >> 2)) { + rlen = rep.length << 2; + ch = Xmalloc(rlen + 1); + /* +1 to leave room for last null-terminator */ + } + + if ((! flist) || (! ch)) { + Xfree(flist); + Xfree(ch); + _XEatDataWords(dpy, rep.length); + *actualCount = 0; + UnlockDisplay(dpy); + SyncHandle(); + return (char **) NULL; + } + + _XReadPad (dpy, ch, rlen); + /* + * unpack into null terminated strings. + */ + chstart = ch; + chend = ch + (rlen + 1); + length = *(unsigned char *)ch; + *ch = 1; /* make sure it is non-zero for XFreeFontNames */ + for (i = 0; i < rep.nFonts; i++) { + if (ch + length < chend) { + flist[i] = ch + 1; /* skip over length */ + ch += length + 1; /* find next length ... */ + if (ch <= chend) { + length = *(unsigned char *)ch; + *ch = '\0'; /* and replace with null-termination */ + count++; + } else { + Xfree(chstart); + Xfree(flist); + flist = NULL; + count = 0; + break; + } + } else { + Xfree(chstart); + Xfree(flist); + flist = NULL; + count = 0; + break; + } + } + } + *actualCount = count; + UnlockDisplay(dpy); + SyncHandle(); + return (flist); +} + +int +XFreeFontNames(char **list) +{ + if (list) { + if (!*(list[0]-1)) { /* from ListFontsWithInfo */ + register char **names; + for (names = list+1; *names; names++) + Xfree (*names); + } + Xfree (list[0]-1); + Xfree (list); + } + return 1; +} diff --git a/nx-X11/lib/src/FreeCmap.c b/nx-X11/lib/src/FreeCmap.c new file mode 100644 index 000000000..e2b76fa6f --- /dev/null +++ b/nx-X11/lib/src/FreeCmap.c @@ -0,0 +1,52 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlib.h" +#include "Xlibint.h" +#include "Cmap.h" + +int +XFreeColormap( + register Display *dpy, + Colormap cmap) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(FreeColormap, cmap, req); + + UnlockDisplay(dpy); + SyncHandle(); + +#ifdef XCMS + _XcmsDeleteCmapRec(dpy, cmap); +#endif + + return 1; +} diff --git a/nx-X11/lib/src/FreeCols.c b/nx-X11/lib/src/FreeCols.c new file mode 100644 index 000000000..a8b7f8867 --- /dev/null +++ b/nx-X11/lib/src/FreeCols.c @@ -0,0 +1,57 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XFreeColors( + register Display *dpy, + Colormap cmap, + unsigned long *pixels, /* LISTofCARD32 */ + int npixels, + unsigned long planes) /* CARD32 */ +{ + register xFreeColorsReq *req; + register long nbytes; + + LockDisplay(dpy); + GetReq(FreeColors, req); + req->cmap = cmap; + req->planeMask = planes; + + /* on the VAX, each pixel is a 32-bit (unsigned) integer */ + req->length += npixels; + + nbytes = npixels << 2; /* watch out for macros... */ + Data32 (dpy, (long *) pixels, nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/FreeCurs.c b/nx-X11/lib/src/FreeCurs.c new file mode 100644 index 000000000..89fb577cc --- /dev/null +++ b/nx-X11/lib/src/FreeCurs.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XFreeCursor( + register Display *dpy, + Cursor cursor) +{ + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(FreeCursor, cursor, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/FreeEData.c b/nx-X11/lib/src/FreeEData.c new file mode 100644 index 000000000..ce78467d3 --- /dev/null +++ b/nx-X11/lib/src/FreeEData.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +_XFreeExtData (XExtData *extension) +{ + XExtData *temp; + while (extension) { + if (extension->free_private) + (*extension->free_private)(extension); + else Xfree (extension->private_data); + temp = extension->next; + Xfree (extension); + extension = temp; + } + return 0; +} diff --git a/nx-X11/lib/src/FreeEventData.c b/nx-X11/lib/src/FreeEventData.c new file mode 100644 index 000000000..e2d40b0db --- /dev/null +++ b/nx-X11/lib/src/FreeEventData.c @@ -0,0 +1,42 @@ +/* + * Copyright © 2009 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +void +XFreeEventData(Display *dpy, XGenericEventCookie *event) +{ + + if (_XIsEventCookie(dpy, (XEvent*)event) && event->data) + { + XFree(event->data); + event->data = NULL; + event->cookie = 0; + } + return; +} + diff --git a/nx-X11/lib/src/FreeGC.c b/nx-X11/lib/src/FreeGC.c new file mode 100644 index 000000000..926d50745 --- /dev/null +++ b/nx-X11/lib/src/FreeGC.c @@ -0,0 +1,50 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XFreeGC ( + register Display *dpy, + GC gc) + { + register xResourceReq *req; + register _XExtension *ext; + LockDisplay(dpy); + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->free_GC) (*ext->free_GC)(dpy, gc, &ext->codes); + GetResReq (FreeGC, gc->gid, req); + UnlockDisplay(dpy); + SyncHandle(); + _XFreeExtData(gc->ext_data); + Xfree (gc); + return 1; + } + diff --git a/nx-X11/lib/src/FreePix.c b/nx-X11/lib/src/FreePix.c new file mode 100644 index 000000000..21367978e --- /dev/null +++ b/nx-X11/lib/src/FreePix.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XFreePixmap( + register Display *dpy, + Pixmap pixmap) +{ + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(FreePixmap, pixmap, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/GCMisc.c b/nx-X11/lib/src/GCMisc.c new file mode 100644 index 000000000..751e27dca --- /dev/null +++ b/nx-X11/lib/src/GCMisc.c @@ -0,0 +1,110 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetArcMode ( + register Display *dpy, + register GC gc, + int arc_mode) +{ + LockDisplay(dpy); + if (gc->values.arc_mode != arc_mode) { + gc->values.arc_mode = arc_mode; + gc->dirty |= GCArcMode; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XSetFillRule ( + register Display *dpy, + register GC gc, + int fill_rule) +{ + LockDisplay(dpy); + if (gc->values.fill_rule != fill_rule) { + gc->values.fill_rule = fill_rule; + gc->dirty |= GCFillRule; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XSetFillStyle ( + register Display *dpy, + register GC gc, + int fill_style) +{ + LockDisplay(dpy); + if (gc->values.fill_style != fill_style) { + gc->values.fill_style = fill_style; + gc->dirty |= GCFillStyle; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XSetGraphicsExposures ( + register Display *dpy, + register GC gc, + Bool graphics_exposures) +{ + LockDisplay(dpy); + if (gc->values.graphics_exposures != graphics_exposures) { + gc->values.graphics_exposures = graphics_exposures; + gc->dirty |= GCGraphicsExposures; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XSetSubwindowMode ( + register Display *dpy, + register GC gc, + int subwindow_mode) +{ + LockDisplay(dpy); + if (gc->values.subwindow_mode != subwindow_mode) { + gc->values.subwindow_mode = subwindow_mode; + gc->dirty |= GCSubwindowMode; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/Geom.c b/nx-X11/lib/src/Geom.c new file mode 100644 index 000000000..1da74f1c3 --- /dev/null +++ b/nx-X11/lib/src/Geom.c @@ -0,0 +1,89 @@ + +/* + +Copyright 1985, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" + +/* + * This routine given a user supplied positional argument and a default + * argument (fully qualified) will return the position the window should take + * returns 0 if there was some problem, else the position bitmask. + */ + +int +XGeometry ( + Display *dpy, /* user's display connection */ + int screen, /* screen on which to do computation */ + _Xconst char *pos, /* user provided geometry spec */ + _Xconst char *def, /* default geometry spec for window */ + unsigned int bwidth, /* border width */ + unsigned int fwidth, /* size of position units */ + unsigned int fheight, + int xadd, /* any additional interior space */ + int yadd, + register int *x, /* always set on successful RETURN */ + register int *y, /* always set on successful RETURN */ + register int *width, /* always set on successful RETURN */ + register int *height) /* always set on successful RETURN */ +{ + int px, py; /* returned values from parse */ + unsigned int pwidth, pheight; /* returned values from parse */ + int dx, dy; /* default values from parse */ + unsigned int dwidth, dheight; /* default values from parse */ + int pmask, dmask; /* values back from parse */ + + pmask = XParseGeometry(pos, &px, &py, &pwidth, &pheight); + dmask = XParseGeometry(def, &dx, &dy, &dwidth, &dheight); + + /* set default values */ + *x = (dmask & XNegative) ? + DisplayWidth(dpy, screen) + dx - dwidth * fwidth - + 2 * bwidth - xadd : dx; + *y = (dmask & YNegative) ? + DisplayHeight(dpy, screen) + dy - dheight * fheight - + 2 * bwidth - yadd : dy; + *width = dwidth; + *height = dheight; + + if (pmask & WidthValue) *width = pwidth; + if (pmask & HeightValue) *height = pheight; + + if (pmask & XValue) + *x = (pmask & XNegative) ? + DisplayWidth(dpy, screen) + px - *width * fwidth - + 2 * bwidth - xadd : px; + if (pmask & YValue) + *y = (pmask & YNegative) ? + DisplayHeight(dpy, screen) + py - *height * fheight - + 2 * bwidth - yadd : py; + return (pmask); +} diff --git a/nx-X11/lib/src/GetAtomNm.c b/nx-X11/lib/src/GetAtomNm.c new file mode 100644 index 000000000..32de50d23 --- /dev/null +++ b/nx-X11/lib/src/GetAtomNm.c @@ -0,0 +1,189 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xintatom.h" + +static +char *_XGetAtomName( + Display *dpy, + Atom atom) +{ + xResourceReq *req; + char *name; + register Entry *table; + register int idx; + register Entry e; + + if (dpy->atoms) { + table = dpy->atoms->table; + for (idx = TABLESIZE; --idx >= 0; ) { + if ((e = *table++) && (e->atom == atom)) { + idx = strlen(EntryName(e)) + 1; + if ((name = Xmalloc(idx))) + strcpy(name, EntryName(e)); + return name; + } + } + } + GetResReq(GetAtomName, atom, req); + return (char *)NULL; +} + +char *XGetAtomName( + register Display *dpy, + Atom atom) +{ + xGetAtomNameReply rep; + char *name; + + LockDisplay(dpy); + if ((name = _XGetAtomName(dpy, atom))) { + UnlockDisplay(dpy); + return name; + } + if (_XReply(dpy, (xReply *)&rep, 0, xFalse) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return(NULL); + } + if ((name = Xmalloc(rep.nameLength + 1))) { + _XReadPad(dpy, name, (long)rep.nameLength); + name[rep.nameLength] = '\0'; + _XUpdateAtomCache(dpy, name, atom, 0, -1, 0); + } else { + _XEatDataWords(dpy, rep.length); + name = (char *) NULL; + } + UnlockDisplay(dpy); + SyncHandle(); + return(name); +} + +typedef struct { + unsigned long start_seq; + unsigned long stop_seq; + Atom *atoms; + char **names; + int idx; + int count; + Status status; +} _XGetAtomNameState; + +static +Bool _XGetAtomNameHandler( + register Display *dpy, + register xReply *rep, + char *buf, + int len, + XPointer data) +{ + register _XGetAtomNameState *state; + xGetAtomNameReply replbuf; + register xGetAtomNameReply *repl; + + state = (_XGetAtomNameState *)data; + if (dpy->last_request_read < state->start_seq || + dpy->last_request_read > state->stop_seq) + return False; + while (state->idx < state->count && state->names[state->idx]) + state->idx++; + if (state->idx >= state->count) + return False; + if (rep->generic.type == X_Error) { + state->status = 0; + return False; + } + repl = (xGetAtomNameReply *) + _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, + (SIZEOF(xGetAtomNameReply) - SIZEOF(xReply)) >> 2, + False); + state->names[state->idx] = Xmalloc(repl->nameLength + 1); + _XGetAsyncData(dpy, state->names[state->idx], buf, len, + SIZEOF(xGetAtomNameReply), repl->nameLength, + repl->length << 2); + if (state->names[state->idx]) { + state->names[state->idx][repl->nameLength] = '\0'; + _XUpdateAtomCache(dpy, state->names[state->idx], + state->atoms[state->idx], 0, -1, 0); + } else { + state->status = 0; + } + return True; +} + +Status +XGetAtomNames ( + Display *dpy, + Atom *atoms, + int count, + char **names_return) +{ + _XAsyncHandler async; + _XGetAtomNameState async_state; + xGetAtomNameReply rep; + int i; + int missed = -1; + + LockDisplay(dpy); + async_state.start_seq = dpy->request + 1; + async_state.atoms = atoms; + async_state.names = names_return; + async_state.idx = 0; + async_state.count = count - 1; + async_state.status = 1; + async.next = dpy->async_handlers; + async.handler = _XGetAtomNameHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + for (i = 0; i < count; i++) { + if (!(names_return[i] = _XGetAtomName(dpy, atoms[i]))) { + missed = i; + async_state.stop_seq = dpy->request; + } + } + if (missed >= 0) { + if (_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + if ((names_return[missed] = Xmalloc(rep.nameLength + 1))) { + _XReadPad(dpy, names_return[missed], (long)rep.nameLength); + names_return[missed][rep.nameLength] = '\0'; + _XUpdateAtomCache(dpy, names_return[missed], atoms[missed], + 0, -1, 0); + } else { + _XEatDataWords(dpy, rep.length); + async_state.status = 0; + } + } + } + DeqAsyncHandler(dpy, &async); + UnlockDisplay(dpy); + if (missed >= 0) + SyncHandle(); + return async_state.status; +} diff --git a/nx-X11/lib/src/GetColor.c b/nx-X11/lib/src/GetColor.c new file mode 100644 index 000000000..cd0eb9f63 --- /dev/null +++ b/nx-X11/lib/src/GetColor.c @@ -0,0 +1,111 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" + +Status +XAllocNamedColor( +register Display *dpy, +Colormap cmap, +_Xconst char *colorname, /* STRING8 */ +XColor *hard_def, /* RETURN */ +XColor *exact_def) /* RETURN */ +{ + + long nbytes; + xAllocNamedColorReply rep; + xAllocNamedColorReq *req; + + XcmsCCC ccc; + XcmsColor cmsColor_exact; + Status ret; + +#ifdef XCMS + /* + * Let's Attempt to use Xcms and i18n approach to Parse Color + */ + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { + const char *tmpName = colorname; + + switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, + XcmsRGBFormat)) { + case XcmsSuccess: + case XcmsSuccessWithCompression: + _XcmsRGB_to_XColor(&cmsColor_exact, exact_def, 1); + memcpy((char *)hard_def, (char *)exact_def, sizeof(XColor)); + ret = XAllocColor(dpy, cmap, hard_def); + exact_def->pixel = hard_def->pixel; + return(ret); + case XcmsFailure: + case _XCMS_NEWNAME: + /* + * if the result was _XCMS_NEWNAME tmpName points to + * a string in cmsColNm.c:pairs table, for example, + * gray70 would become tekhvc:0.0/70.0/0.0 + */ + break; + } + } +#endif + + /* + * Xcms and i18n approach failed. + */ + LockDisplay(dpy); + GetReq(AllocNamedColor, req); + + req->cmap = cmap; + nbytes = req->nbytes = strlen(colorname); + req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */ + + _XSend(dpy, colorname, nbytes); + /* _XSend is more efficient that Data, since _XReply follows */ + + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + + exact_def->red = rep.exactRed; + exact_def->green = rep.exactGreen; + exact_def->blue = rep.exactBlue; + + hard_def->red = rep.screenRed; + hard_def->green = rep.screenGreen; + hard_def->blue = rep.screenBlue; + + exact_def->pixel = hard_def->pixel = rep.pixel; + + UnlockDisplay(dpy); + SyncHandle(); + return (1); +} diff --git a/nx-X11/lib/src/GetDflt.c b/nx-X11/lib/src/GetDflt.c new file mode 100644 index 000000000..c2cc1da47 --- /dev/null +++ b/nx-X11/lib/src/GetDflt.c @@ -0,0 +1,223 @@ + +/*********************************************************** + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include +#include "pathmax.h" + +#ifdef XTHREADS +#include +#endif +#ifndef WIN32 +#define X_INCLUDE_PWD_H +#define XOS_USE_XLIB_LOCKING +#include +#endif +#include +#include + + +/*ARGSUSED*/ +static char * +GetHomeDir( + char *dest, + int len) +{ +#ifdef WIN32 + register char *ptr1 = NULL; + register char *ptr2 = NULL; + int len1 = 0, len2 = 0; + + if ((ptr1 = getenv("HOME"))) { /* old, deprecated */ + len1 = strlen (ptr1); + } else if ((ptr1 = getenv("HOMEDRIVE")) && (ptr2 = getenv("HOMEDIR"))) { + len1 = strlen (ptr1); + len2 = strlen (ptr2); + } else if ((ptr2 = getenv("USERNAME"))) { + len1 = strlen (ptr1 = "/users/"); + len2 = strlen (ptr2); + } + if ((len1 + len2 + 1) < len) + snprintf (dest, len, "%s%s", ptr1, (ptr2) ? ptr2 : ""); + else + *dest = '\0'; +#else +#ifdef X_NEEDS_PWPARAMS + _Xgetpwparams pwparams; +#endif + struct passwd *pw; + register char *ptr; + + if (len <= 0 || dest == NULL) + return NULL; + + if ((ptr = getenv("HOME"))) { + (void) strncpy(dest, ptr, len-1); + dest[len-1] = '\0'; + } else { + if ((ptr = getenv("USER"))) + pw = _XGetpwnam(ptr,pwparams); + else + pw = _XGetpwuid(getuid(),pwparams); + if (pw != NULL) { + (void) strncpy(dest, pw->pw_dir, len-1); + dest[len-1] = '\0'; + } else + *dest = '\0'; + } +#endif + return dest; +} + + +static XrmDatabase +InitDefaults( + Display *dpy) /* display for defaults.... */ +{ + XrmDatabase userdb; + XrmDatabase xdb; + char fname[PATH_MAX]; /* longer than any conceivable size */ + char *xenv; + + XrmInitialize(); + + /* + * See lib/Xt/Initialize.c + * + * First, get the defaults from the server; if none, then load from + * ~/.Xdefaults. Next, if there is an XENVIRONMENT environment variable, + * then load that file. + */ + + if (dpy->xdefaults == NULL) { + const char *slashDotXdefaults = "/.Xdefaults"; + + (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaults) - 1); + (void) strcat (fname, slashDotXdefaults); + xdb = XrmGetFileDatabase (fname); + } else { + xdb = XrmGetStringDatabase(dpy->xdefaults); + } + + if (!(xenv = getenv ("XENVIRONMENT"))) { + const char *slashDotXdefaultsDash = "/.Xdefaults-"; + int len; + + (void) GetHomeDir (fname, PATH_MAX - strlen (slashDotXdefaultsDash) - 1); + (void) strcat (fname, slashDotXdefaultsDash); + len = strlen (fname); + (void) _XGetHostname (fname+len, PATH_MAX-len); + xenv = fname; + } + userdb = XrmGetFileDatabase (xenv); + XrmMergeDatabases (userdb, &xdb); + return (xdb); + +#ifdef old + if (fname[0] != '\0') userdb = XrmGetFileDatabase(fname); + xdb = XrmGetStringDatabase(dpy->xdefaults); + XrmMergeDatabases(userdb, &xdb); + return xdb; +#endif +} + +char * +XGetDefault( + Display *dpy, /* display for defaults.... */ + char _Xconst *prog, /* name of program for option */ + register _Xconst char *name) /* name of option program wants */ +{ /* to get, for example, "font" */ + XrmName names[3]; + XrmClass classes[3]; + XrmRepresentation fromType; + XrmValue result; + char *progname; +#ifdef WIN32 + char *progname2; +#endif + + /* + * strip path off of program name (XXX - this is OS specific) + */ + progname = strrchr (prog, '/'); +#ifdef WIN32 + progname2 = strrchr (prog, '\\'); + if (progname2 && (!progname || progname < progname2)) + progname = progname2; +#endif + + if (progname) + progname++; + else + progname = (char *)prog; + + /* + * see if database has ever been initialized. Lookups can be done + * without locks held. + */ + LockDisplay(dpy); + if (dpy->db == NULL) { + dpy->db = InitDefaults(dpy); + dpy->flags |= XlibDisplayDfltRMDB; + } + UnlockDisplay(dpy); + + names[0] = XrmStringToName(progname); + names[1] = XrmStringToName(name); + names[2] = NULLQUARK; + classes[0] = XrmStringToClass("Program"); + classes[1] = XrmStringToClass("Name"); + classes[2] = NULLQUARK; + (void)XrmQGetResource(dpy->db, names, classes, &fromType, &result); + return (result.addr); +} + diff --git a/nx-X11/lib/src/GetEventData.c b/nx-X11/lib/src/GetEventData.c new file mode 100644 index 000000000..b93dee6cd --- /dev/null +++ b/nx-X11/lib/src/GetEventData.c @@ -0,0 +1,42 @@ +/* + * Copyright © 2009 Red Hat, Inc. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Bool +XGetEventData(Display *dpy, XGenericEventCookie *event) +{ + Bool rc; + LockDisplay(dpy); + + rc = _XFetchEventCookie(dpy, event); + + UnlockDisplay(dpy); + + return rc; +} + diff --git a/nx-X11/lib/src/GetFPath.c b/nx-X11/lib/src/GetFPath.c new file mode 100644 index 000000000..3d87e4f64 --- /dev/null +++ b/nx-X11/lib/src/GetFPath.c @@ -0,0 +1,99 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +char **XGetFontPath( + register Display *dpy, + int *npaths) /* RETURN */ +{ + xGetFontPathReply rep; + unsigned long nbytes = 0; + char **flist = NULL; + char *ch = NULL; + char *chend; + int count = 0; + register unsigned i; + register int length; + _X_UNUSED register xReq *req; + + LockDisplay(dpy); + GetEmptyReq (GetFontPath, req); + (void) _XReply (dpy, (xReply *) &rep, 0, xFalse); + + if (rep.nPaths) { + flist = Xmalloc(rep.nPaths * sizeof (char *)); + if (rep.length < (INT_MAX >> 2)) { + nbytes = (unsigned long) rep.length << 2; + ch = Xmalloc (nbytes + 1); + /* +1 to leave room for last null-terminator */ + } + + if ((! flist) || (! ch)) { + Xfree(flist); + Xfree(ch); + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return (char **) NULL; + } + + _XReadPad (dpy, ch, nbytes); + /* + * unpack into null terminated strings. + */ + chend = ch + (nbytes + 1); + length = *ch; + for (i = 0; i < rep.nPaths; i++) { + if (ch + length < chend) { + flist[i] = ch+1; /* skip over length */ + ch += length + 1; /* find next length ... */ + length = *ch; + *ch = '\0'; /* and replace with null-termination */ + count++; + } else + flist[i] = NULL; + } + } + *npaths = count; + UnlockDisplay(dpy); + SyncHandle(); + return (flist); +} + +int +XFreeFontPath (char **list) +{ + if (list != NULL) { + Xfree (list[0]-1); + Xfree (list); + } + return 1; +} diff --git a/nx-X11/lib/src/GetFProp.c b/nx-X11/lib/src/GetFProp.c new file mode 100644 index 000000000..1e0cd3285 --- /dev/null +++ b/nx-X11/lib/src/GetFProp.c @@ -0,0 +1,52 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Bool +XGetFontProperty( + XFontStruct *fs, + register Atom name, + unsigned long *valuePtr) +{ + /* XXX this is a simple linear search for now. If the + protocol is changed to sort the property list, this should + become a binary search. */ + register XFontProp *prop = fs->properties; + register XFontProp *last = prop + fs->n_properties; + + while (prop != last) { + if (prop->name == name) { + *valuePtr = prop->card32; + return (1); + } + prop++; + } + return (0); +} diff --git a/nx-X11/lib/src/GetGCVals.c b/nx-X11/lib/src/GetGCVals.c new file mode 100644 index 000000000..4861739a6 --- /dev/null +++ b/nx-X11/lib/src/GetGCVals.c @@ -0,0 +1,128 @@ + +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * All gc fields except GCClipMask and GCDashList + */ +#define ValidGCValuesBits (GCFunction | GCPlaneMask | GCForeground | \ + GCBackground | GCLineWidth | GCLineStyle | \ + GCCapStyle | GCJoinStyle | GCFillStyle | \ + GCFillRule | GCTile | GCStipple | \ + GCTileStipXOrigin | GCTileStipYOrigin | \ + GCFont | GCSubwindowMode | GCGraphicsExposures | \ + GCClipXOrigin | GCClipYOrigin | GCDashOffset | \ + GCArcMode) + +/*ARGSUSED*/ +Status XGetGCValues ( + Display *dpy, + GC gc, + unsigned long valuemask, + XGCValues *values) +{ + if (valuemask == ValidGCValuesBits) { + char dashes = values->dashes; + Pixmap clip_mask = values->clip_mask; + *values = gc->values; + values->dashes = dashes; + values->clip_mask = clip_mask; + return True; + } + + if (valuemask & ~ValidGCValuesBits) return False; + + if (valuemask & GCFunction) + values->function = gc->values.function; + + if (valuemask & GCPlaneMask) + values->plane_mask = gc->values.plane_mask; + + if (valuemask & GCForeground) + values->foreground = gc->values.foreground; + + if (valuemask & GCBackground) + values->background = gc->values.background; + + if (valuemask & GCLineWidth) + values->line_width = gc->values.line_width; + + if (valuemask & GCLineStyle) + values->line_style = gc->values.line_style; + + if (valuemask & GCCapStyle) + values->cap_style = gc->values.cap_style; + + if (valuemask & GCJoinStyle) + values->join_style = gc->values.join_style; + + if (valuemask & GCFillStyle) + values->fill_style = gc->values.fill_style; + + if (valuemask & GCFillRule) + values->fill_rule = gc->values.fill_rule; + + if (valuemask & GCTile) + values->tile = gc->values.tile; + + if (valuemask & GCStipple) + values->stipple = gc->values.stipple; + + if (valuemask & GCTileStipXOrigin) + values->ts_x_origin = gc->values.ts_x_origin; + + if (valuemask & GCTileStipYOrigin) + values->ts_y_origin = gc->values.ts_y_origin; + + if (valuemask & GCFont) + values->font = gc->values.font; + + if (valuemask & GCSubwindowMode) + values->subwindow_mode = gc->values.subwindow_mode; + + if (valuemask & GCGraphicsExposures) + values->graphics_exposures = gc->values.graphics_exposures; + + if (valuemask & GCClipXOrigin) + values->clip_x_origin = gc->values.clip_x_origin; + + if (valuemask & GCClipYOrigin) + values->clip_y_origin = gc->values.clip_y_origin; + + if (valuemask & GCDashOffset) + + values->dash_offset = gc->values.dash_offset; + + if (valuemask & GCArcMode) + values->arc_mode = gc->values.arc_mode; + + return True; +} diff --git a/nx-X11/lib/src/GetGeom.c b/nx-X11/lib/src/GetGeom.c new file mode 100644 index 000000000..1e1249d81 --- /dev/null +++ b/nx-X11/lib/src/GetGeom.c @@ -0,0 +1,63 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XGetGeometry ( + register Display *dpy, + Drawable d, + Window *root, /* RETURN */ + int *x, + int *y, /* RETURN */ + unsigned int *width, + unsigned int *height, + unsigned int *borderWidth, + unsigned int *depth) /* RETURN */ +{ + xGetGeometryReply rep; + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(GetGeometry, d, req); + if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + *root = rep.root; + *x = cvtINT16toInt (rep.x); + *y = cvtINT16toInt (rep.y); + *width = rep.width; + *height = rep.height; + *borderWidth = rep.borderWidth; + *depth = rep.depth; + UnlockDisplay(dpy); + SyncHandle(); + return (1); +} + diff --git a/nx-X11/lib/src/GetHColor.c b/nx-X11/lib/src/GetHColor.c new file mode 100644 index 000000000..081a2248d --- /dev/null +++ b/nx-X11/lib/src/GetHColor.c @@ -0,0 +1,58 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XAllocColor( + register Display *dpy, + Colormap cmap, + XColor *def) +{ + Status status; + xAllocColorReply rep; + register xAllocColorReq *req; + LockDisplay(dpy); + GetReq(AllocColor, req); + + req->cmap = cmap; + req->red = def->red; + req->green = def->green; + req->blue = def->blue; + + status = _XReply(dpy, (xReply *) &rep, 0, xTrue); + if (status) { + def->pixel = rep.pixel; + def->red = rep.red; + def->green = rep.green; + def->blue = rep.blue; + } + UnlockDisplay(dpy); + SyncHandle(); + return(status); +} diff --git a/nx-X11/lib/src/GetHints.c b/nx-X11/lib/src/GetHints.c new file mode 100644 index 000000000..7bfd35358 --- /dev/null +++ b/nx-X11/lib/src/GetHints.c @@ -0,0 +1,338 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xatomtype.h" +#include +#include + +Status XGetSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + Atom property) +{ + xPropSizeHints *prop = NULL; + Atom actual_type; + int actual_format; + unsigned long leftover; + unsigned long nitems; + if (XGetWindowProperty(dpy, w, property, 0L, + (long) OldNumPropSizeElements, + False, XA_WM_SIZE_HINTS, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **)&prop) + != Success) return (0); + + if ((actual_type != XA_WM_SIZE_HINTS) || + (nitems < OldNumPropSizeElements) || (actual_format != 32)) { + Xfree (prop); + return(0); + } + hints->flags = (prop->flags & (USPosition|USSize|PAllHints)); + hints->x = cvtINT32toInt (prop->x); + hints->y = cvtINT32toInt (prop->y); + hints->width = cvtINT32toInt (prop->width); + hints->height = cvtINT32toInt (prop->height); + hints->min_width = cvtINT32toInt (prop->minWidth); + hints->min_height = cvtINT32toInt (prop->minHeight); + hints->max_width = cvtINT32toInt (prop->maxWidth); + hints->max_height = cvtINT32toInt (prop->maxHeight); + hints->width_inc = cvtINT32toInt (prop->widthInc); + hints->height_inc = cvtINT32toInt (prop->heightInc); + hints->min_aspect.x = cvtINT32toInt (prop->minAspectX); + hints->min_aspect.y = cvtINT32toInt (prop->minAspectY); + hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX); + hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY); + Xfree(prop); + return(1); +} + +/* + * must return a pointer to the hint, in malloc'd memory, or routine is not + * extensible; any use of the caller's memory would cause things to be stepped + * on. + */ + +XWMHints *XGetWMHints ( + Display *dpy, + Window w) +{ + xPropWMHints *prop = NULL; + register XWMHints *hints; + Atom actual_type; + int actual_format; + unsigned long leftover; + unsigned long nitems; + if (XGetWindowProperty(dpy, w, XA_WM_HINTS, + 0L, (long)NumPropWMHintsElements, + False, XA_WM_HINTS, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **)&prop) + != Success) return (NULL); + + /* If the property is undefined on the window, return null pointer. */ + /* pre-R3 bogusly truncated window_group, don't fail on them */ + + if ((actual_type != XA_WM_HINTS) || + (nitems < (NumPropWMHintsElements - 1)) || (actual_format != 32)) { + Xfree (prop); + return(NULL); + } + /* static copies not allowed in library, due to reentrancy constraint*/ + if ((hints = Xcalloc (1, sizeof(XWMHints)))) { + hints->flags = prop->flags; + hints->input = (prop->input ? True : False); + hints->initial_state = cvtINT32toInt (prop->initialState); + hints->icon_pixmap = prop->iconPixmap; + hints->icon_window = prop->iconWindow; + hints->icon_x = cvtINT32toInt (prop->iconX); + hints->icon_y = cvtINT32toInt (prop->iconY); + hints->icon_mask = prop->iconMask; + if (nitems >= NumPropWMHintsElements) + hints->window_group = prop->windowGroup; + else + hints->window_group = 0; + } + Xfree (prop); + return(hints); +} + +Status +XGetZoomHints ( + Display *dpy, + Window w, + XSizeHints *zhints) +{ + return (XGetSizeHints(dpy, w, zhints, XA_WM_ZOOM_HINTS)); +} + +Status +XGetNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints) +{ + return (XGetSizeHints(dpy, w, hints, XA_WM_NORMAL_HINTS)); +} + + +/* + * XGetIconSizes reads the property + * ICONSIZE_ATOM type: ICONSIZE_ATOM format: 32 + */ + +Status XGetIconSizes ( + Display *dpy, + Window w, /* typically, root */ + XIconSize **size_list, /* RETURN */ + int *count) /* RETURN number of items on the list */ +{ + xPropIconSize *prop = NULL; + register xPropIconSize *pp; + register XIconSize *hp, *hints; + Atom actual_type; + int actual_format; + unsigned long leftover; + unsigned long nitems; + register int i; + + if (XGetWindowProperty(dpy, w, XA_WM_ICON_SIZE, 0L, 60L, + False, XA_WM_ICON_SIZE, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **)&prop) + != Success) return (0); + + pp = prop; + + if ((actual_type != XA_WM_ICON_SIZE) || + (nitems < NumPropIconSizeElements) || + (nitems % NumPropIconSizeElements != 0) || + (actual_format != 32)) { + Xfree (prop); + return(0); + } + + /* static copies not allowed in library, due to reentrancy constraint*/ + + nitems /= NumPropIconSizeElements; + if (! (hp = hints = Xcalloc (nitems, sizeof(XIconSize)))) { + Xfree (prop); + return 0; + } + + /* march down array putting things into native form */ + for (i = 0; i < nitems; i++) { + hp->min_width = cvtINT32toInt (pp->minWidth); + hp->min_height = cvtINT32toInt (pp->minHeight); + hp->max_width = cvtINT32toInt (pp->maxWidth); + hp->max_height = cvtINT32toInt (pp->maxHeight); + hp->width_inc = cvtINT32toInt (pp->widthInc); + hp->height_inc = cvtINT32toInt (pp->heightInc); + hp += 1; + pp += 1; + } + *count = nitems; + *size_list = hints; + Xfree (prop); + return(1); +} + + +Status XGetCommand ( + Display *dpy, + Window w, + char ***argvp, + int *argcp) +{ + XTextProperty tp; + int argc; + char **argv; + + if (!XGetTextProperty (dpy, w, &tp, XA_WM_COMMAND)) return 0; + + if (tp.encoding != XA_STRING || tp.format != 8) { + Xfree (tp.value); + return 0; + } + + + /* + * ignore final if present since UNIX WM_COMMAND is nul-terminated + */ + if (tp.nitems && (tp.value[tp.nitems - 1] == '\0')) tp.nitems--; + + + /* + * create a string list and return if successful + */ + if (!XTextPropertyToStringList (&tp, &argv, &argc)) { + Xfree (tp.value); + return (0); + } + + Xfree (tp.value); + *argvp = argv; + *argcp = argc; + return 1; +} + + +Status +XGetTransientForHint( + Display *dpy, + Window w, + Window *propWindow) +{ + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long leftover; + Window *data = NULL; + if (XGetWindowProperty(dpy, w, XA_WM_TRANSIENT_FOR, 0L, 1L, False, + XA_WINDOW, + &actual_type, + &actual_format, &nitems, &leftover, (unsigned char **) &data) + != Success) { + *propWindow = None; + return (0); + } + if ( (actual_type == XA_WINDOW) && (actual_format == 32) && + (nitems != 0) ) { + *propWindow = *data; + Xfree( (char *) data); + return (1); + } + *propWindow = None; + Xfree( (char *) data); + return(0); +} + +Status +XGetClassHint( + Display *dpy, + Window w, + XClassHint *classhint) /* RETURN */ +{ + int len_name, len_class; + + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long leftover; + unsigned char *data = NULL; + if (XGetWindowProperty(dpy, w, XA_WM_CLASS, 0L, (long)BUFSIZ, False, + XA_STRING, + &actual_type, + &actual_format, &nitems, &leftover, &data) != Success) + return (0); + + if ( (actual_type == XA_STRING) && (actual_format == 8) ) { + len_name = strlen((char *) data); + if (! (classhint->res_name = Xmalloc(len_name + 1))) { + Xfree(data); + return (0); + } + strcpy(classhint->res_name, (char *) data); + if (len_name == nitems) len_name--; + len_class = strlen((char *) (data+len_name+1)); + if (! (classhint->res_class = Xmalloc(len_class + 1))) { + Xfree(classhint->res_name); + classhint->res_name = (char *) NULL; + Xfree(data); + return (0); + } + strcpy(classhint->res_class, (char *) (data+len_name+1)); + Xfree( (char *) data); + return(1); + } + Xfree( (char *) data); + return(0); +} diff --git a/nx-X11/lib/src/GetIFocus.c b/nx-X11/lib/src/GetIFocus.c new file mode 100644 index 000000000..0a7f36e8d --- /dev/null +++ b/nx-X11/lib/src/GetIFocus.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGetInputFocus( + register Display *dpy, + Window *focus, + int *revert_to) +{ + xGetInputFocusReply rep; + _X_UNUSED register xReq *req; + LockDisplay(dpy); + GetEmptyReq(GetInputFocus, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + *focus = rep.focus; + *revert_to = rep.revertTo; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/GetImage.c b/nx-X11/lib/src/GetImage.c new file mode 100644 index 000000000..d80f6715f --- /dev/null +++ b/nx-X11/lib/src/GetImage.c @@ -0,0 +1,143 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include /* for XDestroyImage */ +#include "ImUtil.h" +#include + +#define ROUNDUP(nbytes, pad) (((((nbytes) - 1) + (pad)) / (pad)) * (pad)) + +static unsigned int Ones( /* HACKMEM 169 */ + unsigned long mask) +{ + register unsigned long y; + + y = (mask >> 1) &033333333333; + y = mask - y - ((y >>1) & 033333333333); + return ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); +} + +XImage *XGetImage ( + register Display *dpy, + Drawable d, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned long plane_mask, + int format) /* either XYPixmap or ZPixmap */ +{ + xGetImageReply rep; + register xGetImageReq *req; + char *data; + unsigned long nbytes; + XImage *image; + int planes; + LockDisplay(dpy); + GetReq (GetImage, req); + /* + * first set up the standard stuff in the request + */ + req->drawable = d; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->planeMask = plane_mask; + req->format = format; + + if (_XReply (dpy, (xReply *) &rep, 0, xFalse) == 0 || + rep.length == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return (XImage *)NULL; + } + + if (rep.length < (INT_MAX >> 2)) { + nbytes = (unsigned long)rep.length << 2; + data = Xmalloc(nbytes); + } else + data = NULL; + if (! data) { + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return (XImage *) NULL; + } + _XReadPad (dpy, data, nbytes); + if (format == XYPixmap) { + image = XCreateImage(dpy, _XVIDtoVisual(dpy, rep.visual), + Ones (plane_mask & + (((unsigned long)0xFFFFFFFF) >> (32 - rep.depth))), + format, 0, data, width, height, dpy->bitmap_pad, 0); + planes = image->depth; + } else { /* format == ZPixmap */ + image = XCreateImage (dpy, _XVIDtoVisual(dpy, rep.visual), + rep.depth, ZPixmap, 0, data, width, height, + _XGetScanlinePad(dpy, (int) rep.depth), 0); + planes = 1; + } + + if (!image) + Xfree(data); + if (planes < 1 || image->height < 1 || image->bytes_per_line < 1 || + INT_MAX / image->height <= image->bytes_per_line || + INT_MAX / planes <= image->height * image->bytes_per_line || + nbytes < planes * image->height * image->bytes_per_line) { + XDestroyImage(image); + image = NULL; + } + UnlockDisplay(dpy); + SyncHandle(); + return (image); +} + +XImage *XGetSubImage( + register Display *dpy, + Drawable d, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned long plane_mask, + int format, /* either XYPixmap or ZPixmap */ + XImage *dest_image, + int dest_x, + int dest_y) +{ + XImage *temp_image; + temp_image = XGetImage(dpy, d, x, y, width, height, + plane_mask, format); + if (!temp_image) + return (XImage *)NULL; + _XSetImage(temp_image, dest_image, dest_x, dest_y); + XDestroyImage(temp_image); + return (dest_image); +} diff --git a/nx-X11/lib/src/GetKCnt.c b/nx-X11/lib/src/GetKCnt.c new file mode 100644 index 000000000..5829fbeaa --- /dev/null +++ b/nx-X11/lib/src/GetKCnt.c @@ -0,0 +1,55 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGetKeyboardControl ( + register Display *dpy, + register XKeyboardState *state) +{ + xGetKeyboardControlReply rep; + _X_UNUSED register xReq *req; + LockDisplay(dpy); + GetEmptyReq (GetKeyboardControl, req); + (void) _XReply (dpy, (xReply *) &rep, + (SIZEOF(xGetKeyboardControlReply) - SIZEOF(xReply)) >> 2, xTrue); + + state->key_click_percent = rep.keyClickPercent; + state->bell_percent = rep.bellPercent; + state->bell_pitch = rep.bellPitch; + state->bell_duration = rep.bellDuration; + state->led_mask = rep.ledMask; + state->global_auto_repeat = rep.globalAutoRepeat; + memcpy (state->auto_repeats, rep.map, sizeof state->auto_repeats); + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } + diff --git a/nx-X11/lib/src/GetMoEv.c b/nx-X11/lib/src/GetMoEv.c new file mode 100644 index 000000000..ad9c77277 --- /dev/null +++ b/nx-X11/lib/src/GetMoEv.c @@ -0,0 +1,81 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +XTimeCoord *XGetMotionEvents( + register Display *dpy, + Window w, + Time start, + Time stop, + int *nEvents) /* RETURN */ +{ + xGetMotionEventsReply rep; + register xGetMotionEventsReq *req; + XTimeCoord *tc = NULL; + LockDisplay(dpy); + GetReq(GetMotionEvents, req); + req->window = w; +/* XXX is this right for all machines? */ + req->start = start; + req->stop = stop; + if (!_XReply (dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (NULL); + } + + if (rep.nEvents && (rep.nEvents < (INT_MAX / sizeof(XTimeCoord)))) + tc = Xmalloc(rep.nEvents * sizeof(XTimeCoord)); + if (tc == NULL) { + /* server returned either no events or a bad event count */ + *nEvents = 0; + _XEatDataWords (dpy, rep.length); + } + else + { + register XTimeCoord *tcptr; + unsigned int i; + xTimecoord xtc; + + *nEvents = (int) rep.nEvents; + for (i = rep.nEvents, tcptr = tc; i > 0; i--, tcptr++) { + _XRead (dpy, (char *) &xtc, SIZEOF (xTimecoord)); + tcptr->time = xtc.time; + tcptr->x = cvtINT16toShort (xtc.x); + tcptr->y = cvtINT16toShort (xtc.y); + } + } + + UnlockDisplay(dpy); + SyncHandle(); + return (tc); +} + diff --git a/nx-X11/lib/src/GetNrmHint.c b/nx-X11/lib/src/GetNrmHint.c new file mode 100644 index 000000000..cc8fd235e --- /dev/null +++ b/nx-X11/lib/src/GetNrmHint.c @@ -0,0 +1,127 @@ +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL DIGITAL OR WYSE 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. + +******************************************************************/ + +/* + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include +#include + +Status XGetWMSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + long *supplied, + Atom property) +{ + xPropSizeHints *prop = NULL; + Atom actual_type; + int actual_format; + unsigned long leftover; + unsigned long nitems; + + if (XGetWindowProperty (dpy, w, property, 0L, + (long)NumPropSizeElements, + False, XA_WM_SIZE_HINTS, &actual_type, + &actual_format, &nitems, &leftover, + (unsigned char **)&prop) + != Success) + return False; + + if ((actual_type != XA_WM_SIZE_HINTS) || + (nitems < OldNumPropSizeElements) || (actual_format != 32)) { + Xfree (prop); + return False; + } + + hints->flags = prop->flags; + /* XSizeHints misdeclares these as int instead of long */ + hints->x = cvtINT32toInt (prop->x); + hints->y = cvtINT32toInt (prop->y); + hints->width = cvtINT32toInt (prop->width); + hints->height = cvtINT32toInt (prop->height); + hints->min_width = cvtINT32toInt (prop->minWidth); + hints->min_height = cvtINT32toInt (prop->minHeight); + hints->max_width = cvtINT32toInt (prop->maxWidth); + hints->max_height = cvtINT32toInt (prop->maxHeight); + hints->width_inc = cvtINT32toInt (prop->widthInc); + hints->height_inc = cvtINT32toInt (prop->heightInc); + hints->min_aspect.x = cvtINT32toInt (prop->minAspectX); + hints->min_aspect.y = cvtINT32toInt (prop->minAspectY); + hints->max_aspect.x = cvtINT32toInt (prop->maxAspectX); + hints->max_aspect.y = cvtINT32toInt (prop->maxAspectY); + + *supplied = (USPosition | USSize | PAllHints); + if (nitems >= NumPropSizeElements) { + hints->base_width= cvtINT32toInt (prop->baseWidth); + hints->base_height= cvtINT32toInt (prop->baseHeight); + hints->win_gravity= cvtINT32toInt (prop->winGravity); + *supplied |= (PBaseSize | PWinGravity); + } + hints->flags &= (*supplied); /* get rid of unwanted bits */ + Xfree(prop); + return True; +} + + +Status XGetWMNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints, + long *supplied) +{ + return (XGetWMSizeHints (dpy, w, hints, supplied, XA_WM_NORMAL_HINTS)); +} diff --git a/nx-X11/lib/src/GetPCnt.c b/nx-X11/lib/src/GetPCnt.c new file mode 100644 index 000000000..72d9495b5 --- /dev/null +++ b/nx-X11/lib/src/GetPCnt.c @@ -0,0 +1,52 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGetPointerControl( + register Display *dpy, + /* the following are return only vars */ + int *accel_numer, + int *accel_denom, + int *threshold) +{ + xGetPointerControlReply rep; + _X_UNUSED xReq *req; + LockDisplay(dpy); + GetEmptyReq(GetPointerControl, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + *accel_numer = rep.accelNumerator; + *accel_denom = rep.accelDenominator; + *threshold = rep.threshold; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/GetPntMap.c b/nx-X11/lib/src/GetPntMap.c new file mode 100644 index 000000000..07625f8a0 --- /dev/null +++ b/nx-X11/lib/src/GetPntMap.c @@ -0,0 +1,132 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +#ifdef MIN /* some systems define this in */ +#undef MIN +#endif +#define MIN(a, b) ((a) < (b) ? (a) : (b)) + +int XGetPointerMapping ( + register Display *dpy, + unsigned char *map, /* RETURN */ + int nmaps) + +{ + unsigned char mapping[256]; /* known fixed size */ + unsigned long nbytes, remainder = 0; + xGetPointerMappingReply rep; + _X_UNUSED register xReq *req; + + LockDisplay(dpy); + GetEmptyReq(GetPointerMapping, req); + if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + + /* Don't count on the server returning a valid value */ + if (rep.length >= (INT_MAX >> 2)) { + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + + nbytes = (unsigned long) rep.length << 2; + if (nbytes > sizeof mapping) { + remainder = nbytes - sizeof mapping; + nbytes = sizeof mapping; + } + _XRead (dpy, (char *)mapping, nbytes); + /* don't return more data than the user asked for. */ + if (rep.nElts) { + memcpy ((char *) map, (char *) mapping, + MIN((int)rep.nElts, nmaps) ); + } + + if (remainder) + _XEatData(dpy, remainder); + + UnlockDisplay(dpy); + SyncHandle(); + return ((int) rep.nElts); +} + +KeySym * +XGetKeyboardMapping (Display *dpy, +#if NeedWidePrototypes + unsigned int first_keycode, +#else + KeyCode first_keycode, +#endif + int count, + int *keysyms_per_keycode) +{ + unsigned long nbytes; + CARD32 nkeysyms; + register KeySym *mapping = NULL; + xGetKeyboardMappingReply rep; + register xGetKeyboardMappingReq *req; + + LockDisplay(dpy); + GetReq(GetKeyboardMapping, req); + req->firstKeyCode = first_keycode; + req->count = count; + if (! _XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (KeySym *) NULL; + } + + nkeysyms = rep.length; + if (nkeysyms > 0) { + if (nkeysyms < (INT_MAX / sizeof (KeySym))) { + nbytes = nkeysyms * sizeof (KeySym); + mapping = Xmalloc (nbytes); + } + if (! mapping) { + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return (KeySym *) NULL; + } + nbytes = nkeysyms << 2; + _XRead32 (dpy, (long *) mapping, nbytes); + } + *keysyms_per_keycode = rep.keySymsPerKeyCode; + UnlockDisplay(dpy); + SyncHandle(); + return (mapping); +} + diff --git a/nx-X11/lib/src/GetProp.c b/nx-X11/lib/src/GetProp.c new file mode 100644 index 000000000..9eb422ee3 --- /dev/null +++ b/nx-X11/lib/src/GetProp.c @@ -0,0 +1,146 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +int +XGetWindowProperty( + register Display *dpy, + Window w, + Atom property, + long offset, + long length, + Bool delete, + Atom req_type, + Atom *actual_type, /* RETURN */ + int *actual_format, /* RETURN 8, 16, or 32 */ + unsigned long *nitems, /* RETURN # of 8-, 16-, or 32-bit entities */ + unsigned long *bytesafter, /* RETURN */ + unsigned char **prop) /* RETURN */ +{ + xGetPropertyReply reply; + register xGetPropertyReq *req; + xError error = {0}; + + /* Always initialize return values, in case callers fail to initialize + them and fail to check the return code for an error. */ + *actual_type = None; + *actual_format = 0; + *nitems = *bytesafter = 0L; + *prop = (unsigned char *) NULL; + + LockDisplay(dpy); + GetReq (GetProperty, req); + req->window = w; + req->property = property; + req->type = req_type; + req->delete = delete; + req->longOffset = offset; + req->longLength = length; + error.sequenceNumber = dpy->request; + + if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (1); /* not Success */ + } + + if (reply.propertyType != None) { + unsigned long nbytes, netbytes; + int format = reply.format; + + /* + * Protect against both integer overflow and just plain oversized + * memory allocation - no server should ever return this many props. + */ + if (reply.nItems >= (INT_MAX >> 4)) + format = -1; /* fall through to default error case */ + + switch (format) { + /* + * One extra byte is malloced than is needed to contain the property + * data, but this last byte is null terminated and convenient for + * returning string properties, so the client doesn't then have to + * recopy the string to make it null terminated. + */ + case 8: + nbytes = netbytes = reply.nItems; + if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) + _XReadPad (dpy, (char *) *prop, netbytes); + break; + + case 16: + nbytes = reply.nItems * sizeof (short); + netbytes = reply.nItems << 1; + if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) + _XRead16Pad (dpy, (short *) *prop, netbytes); + break; + + case 32: + nbytes = reply.nItems * sizeof (long); + netbytes = reply.nItems << 2; + if (nbytes + 1 > 0 && (*prop = Xmalloc (nbytes + 1))) + _XRead32 (dpy, (long *) *prop, netbytes); + break; + + default: + /* + * This part of the code should never be reached. If it is, + * the server sent back a property with an invalid format. + * This is a BadImplementation error. + */ + { + /* sequence number stored above */ + error.type = X_Error; + error.majorCode = X_GetProperty; + error.minorCode = 0; + error.errorCode = BadImplementation; + _XError(dpy, &error); + } + nbytes = netbytes = 0L; + break; + } + if (! *prop) { + _XEatDataWords(dpy, reply.length); + UnlockDisplay(dpy); + SyncHandle(); + return(BadAlloc); /* not Success */ + } + (*prop)[nbytes] = '\0'; + } + *actual_type = reply.propertyType; + *actual_format = reply.format; + *nitems = reply.nItems; + *bytesafter = reply.bytesAfter; + UnlockDisplay(dpy); + SyncHandle(); + return(Success); +} + diff --git a/nx-X11/lib/src/GetRGBCMap.c b/nx-X11/lib/src/GetRGBCMap.c new file mode 100644 index 000000000..746b53fbf --- /dev/null +++ b/nx-X11/lib/src/GetRGBCMap.c @@ -0,0 +1,134 @@ + +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include + +Status XGetRGBColormaps ( + Display *dpy, + Window w, + XStandardColormap **stdcmap, /* RETURN */ + int *count, /* RETURN */ + Atom property) /* XA_RGB_BEST_MAP, etc. */ +{ + register int i; /* iterator variable */ + xPropStandardColormap *data = NULL; /* data read in from prop */ + Atom actual_type; /* how the prop was actually stored */ + int actual_format; /* ditto */ + unsigned long leftover; /* how much was left over */ + unsigned long nitems; /* number of 32bits read */ + int ncmaps; /* number of structs this makes */ + Bool old_style = False; /* if was too short */ + VisualID def_visual = None; /* visual to use if prop too short */ + XStandardColormap *cmaps; /* return value */ + + + if (XGetWindowProperty (dpy, w, property, 0L, 1000000L, False, + XA_RGB_COLOR_MAP, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **)&data) + != Success) + return False; + + /* if wrong type or format, or too small for us, then punt */ + if ((actual_type != XA_RGB_COLOR_MAP) || (actual_format != 32) || + (nitems < OldNumPropStandardColormapElements)) { + Xfree (data); + return False; + } + + /* + * See how many properties were found; if pre-ICCCM then assume + * default visual and a kill id of 1. + */ + if (nitems < NumPropStandardColormapElements) { + ncmaps = 1; + old_style = True; + if (nitems < (NumPropStandardColormapElements - 1)) { + Screen *sp = _XScreenOfWindow (dpy, w); + + if (!sp) { + Xfree (data); + return False; + } + def_visual = sp->root_visual->visualid; + } + } else { + /* + * make sure we have an integral number of colormaps + */ + ncmaps = (nitems / NumPropStandardColormapElements); + if ((((unsigned long) ncmaps) * NumPropStandardColormapElements) != + nitems) { + Xfree (data); + return False; + } + } + + + /* + * allocate array + */ + cmaps = Xmalloc (ncmaps * sizeof (XStandardColormap)); + if (!cmaps) { + Xfree (data); + return False; + } + + + /* + * and fill it in, handling compatibility with pre-ICCCM short stdcmaps + */ + { + register XStandardColormap *map; + register xPropStandardColormap *prop; + + for (i = ncmaps, map = cmaps, prop = data; i > 0; i--, map++, prop++) { + map->colormap = prop->colormap; + map->red_max = prop->red_max; + map->red_mult = prop->red_mult; + map->green_max = prop->green_max; + map->green_mult = prop->green_mult; + map->blue_max = prop->blue_max; + map->blue_mult = prop->blue_mult; + map->base_pixel = prop->base_pixel; + map->visualid = (def_visual ? def_visual : prop->visualid); + map->killid = (old_style ? None : prop->killid); + } + } + Xfree (data); + *stdcmap = cmaps; + *count = ncmaps; + return True; +} + diff --git a/nx-X11/lib/src/GetSOwner.c b/nx-X11/lib/src/GetSOwner.c new file mode 100644 index 000000000..2258f8ce1 --- /dev/null +++ b/nx-X11/lib/src/GetSOwner.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Window XGetSelectionOwner( + register Display *dpy, + Atom selection) +{ + xGetSelectionOwnerReply rep; + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(GetSelectionOwner, selection, req); + + if (_XReply(dpy, (xReply *)&rep, 0, xTrue) == 0) rep.owner = None; + UnlockDisplay(dpy); + SyncHandle(); + return(rep.owner); +} diff --git a/nx-X11/lib/src/GetSSaver.c b/nx-X11/lib/src/GetSSaver.c new file mode 100644 index 000000000..7c2a3061a --- /dev/null +++ b/nx-X11/lib/src/GetSSaver.c @@ -0,0 +1,56 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGetScreenSaver( + register Display *dpy, + /* the following are return only vars */ + int *timeout, + int *interval, + int *prefer_blanking, + int *allow_exp) /*boolean */ + +{ + xGetScreenSaverReply rep; + _X_UNUSED register xReq *req; + LockDisplay(dpy); + GetEmptyReq(GetScreenSaver, req); + + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + *timeout = rep.timeout; + *interval = rep.interval; + *prefer_blanking = rep.preferBlanking; + *allow_exp = rep.allowExposures; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/GetStCmap.c b/nx-X11/lib/src/GetStCmap.c new file mode 100644 index 000000000..560de67ba --- /dev/null +++ b/nx-X11/lib/src/GetStCmap.c @@ -0,0 +1,117 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include + +/* + * WARNING + * + * This is a pre-ICCCM routine. It must not reference any of the new fields + * in the XStandardColormap structure. + */ + +Status XGetStandardColormap ( + Display *dpy, + Window w, + XStandardColormap *cmap, + Atom property) /* XA_RGB_BEST_MAP, etc. */ +{ + Status stat; /* return value */ + XStandardColormap *stdcmaps; /* will get malloced value */ + int nstdcmaps; /* count of above */ + + stat = XGetRGBColormaps (dpy, w, &stdcmaps, &nstdcmaps, property); + if (stat) { + XStandardColormap *use; + + if (nstdcmaps > 1) { + VisualID vid; + Screen *sp = _XScreenOfWindow (dpy, w); + int i; + + if (!sp) { + Xfree (stdcmaps); + return False; + } + vid = sp->root_visual->visualid; + + for (i = 0; i < nstdcmaps; i++) { + if (stdcmaps[i].visualid == vid) break; + } + + if (i == nstdcmaps) { /* not found */ + Xfree (stdcmaps); + return False; + } + use = &stdcmaps[i]; + } else { + use = stdcmaps; + } + + /* + * assign only those fields which were in the pre-ICCCM version + */ + cmap->colormap = use->colormap; + cmap->red_max = use->red_max; + cmap->red_mult = use->red_mult; + cmap->green_max = use->green_max; + cmap->green_mult = use->green_mult; + cmap->blue_max = use->blue_max; + cmap->blue_mult = use->blue_mult; + cmap->base_pixel = use->base_pixel; + + Xfree (stdcmaps); /* don't need alloced memory */ + } + return stat; +} diff --git a/nx-X11/lib/src/GetTxtProp.c b/nx-X11/lib/src/GetTxtProp.c new file mode 100644 index 000000000..2694b8184 --- /dev/null +++ b/nx-X11/lib/src/GetTxtProp.c @@ -0,0 +1,113 @@ +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., + + All Rights Reserved + +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 +supporting documentation, and that the name Wyse not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +******************************************************************/ +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +Status XGetTextProperty ( + Display *display, + Window window, + XTextProperty *tp, + Atom property) +{ + Atom actual_type; + int actual_format = 0; + unsigned long nitems = 0L, leftover = 0L; + unsigned char *prop = NULL; + + if (XGetWindowProperty (display, window, property, 0L, 1000000L, False, + AnyPropertyType, &actual_type, &actual_format, + &nitems, &leftover, &prop) == Success && + actual_type != None) { + /* okay, fill it in */ + tp->value = prop; + tp->encoding = actual_type; + tp->format = actual_format; + tp->nitems = nitems; + return True; + } + + tp->value = NULL; + tp->encoding = None; + tp->format = 0; + tp->nitems = 0; + return False; +} + +Status XGetWMName ( + Display *dpy, + Window w, + XTextProperty *tp) +{ + return (XGetTextProperty (dpy, w, tp, XA_WM_NAME)); +} + +Status XGetWMIconName ( + Display *dpy, + Window w, + XTextProperty *tp) +{ + return (XGetTextProperty (dpy, w, tp, XA_WM_ICON_NAME)); +} + +Status XGetWMClientMachine ( + Display *dpy, + Window w, + XTextProperty *tp) +{ + return (XGetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE)); +} + diff --git a/nx-X11/lib/src/GetWAttrs.c b/nx-X11/lib/src/GetWAttrs.c new file mode 100644 index 000000000..c10824cf4 --- /dev/null +++ b/nx-X11/lib/src/GetWAttrs.c @@ -0,0 +1,155 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +typedef struct _WAttrsState { + unsigned long attr_seq; + unsigned long geom_seq; + XWindowAttributes *attr; +} _XWAttrsState; + +static Bool +_XWAttrsHandler( + register Display *dpy, + register xReply *rep, + char *buf, + int len, + XPointer data) +{ + register _XWAttrsState *state; + xGetWindowAttributesReply replbuf; + register xGetWindowAttributesReply *repl; + register XWindowAttributes *attr; + + state = (_XWAttrsState *)data; + if (dpy->last_request_read != state->attr_seq) { + if (dpy->last_request_read == state->geom_seq && + !state->attr && + rep->generic.type == X_Error && + rep->error.errorCode == BadDrawable) + return True; + return False; + } + if (rep->generic.type == X_Error) { + state->attr = (XWindowAttributes *)NULL; + return False; + } + repl = (xGetWindowAttributesReply *) + _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, + (SIZEOF(xGetWindowAttributesReply) - SIZEOF(xReply)) >> 2, + True); + attr = state->attr; + attr->class = repl->class; + attr->bit_gravity = repl->bitGravity; + attr->win_gravity = repl->winGravity; + attr->backing_store = repl->backingStore; + attr->backing_planes = repl->backingBitPlanes; + attr->backing_pixel = repl->backingPixel; + attr->save_under = repl->saveUnder; + attr->colormap = repl->colormap; + attr->map_installed = repl->mapInstalled; + attr->map_state = repl->mapState; + attr->all_event_masks = repl->allEventMasks; + attr->your_event_mask = repl->yourEventMask; + attr->do_not_propagate_mask = repl->doNotPropagateMask; + attr->override_redirect = repl->override; + attr->visual = _XVIDtoVisual (dpy, repl->visualID); + return True; +} + +Status +_XGetWindowAttributes( + register Display *dpy, + Window w, + XWindowAttributes *attr) +{ + xGetGeometryReply rep; + register xResourceReq *req; + register int i; + register Screen *sp; + _XAsyncHandler async; + _XWAttrsState async_state; + + GetResReq(GetWindowAttributes, w, req); + + async_state.attr_seq = dpy->request; + async_state.geom_seq = 0; + async_state.attr = attr; + async.next = dpy->async_handlers; + async.handler = _XWAttrsHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + + GetResReq(GetGeometry, w, req); + + async_state.geom_seq = dpy->request; + + if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) { + DeqAsyncHandler(dpy, &async); + return (0); + } + DeqAsyncHandler(dpy, &async); + if (!async_state.attr) { + return (0); + } + attr->x = cvtINT16toInt (rep.x); + attr->y = cvtINT16toInt (rep.y); + attr->width = rep.width; + attr->height = rep.height; + attr->border_width = rep.borderWidth; + attr->depth = rep.depth; + attr->root = rep.root; + /* find correct screen so that applications find it easier.... */ + for (i = 0; i < dpy->nscreens; i++) { + sp = &dpy->screens[i]; + if (sp->root == attr->root) { + attr->screen = sp; + break; + } + } + return(1); +} + +Status +XGetWindowAttributes( + Display *dpy, + Window w, + XWindowAttributes *attr) +{ + Status ret; + + LockDisplay(dpy); + ret = _XGetWindowAttributes(dpy, w, attr); + UnlockDisplay(dpy); + SyncHandle(); + + return ret; +} + diff --git a/nx-X11/lib/src/GetWMCMapW.c b/nx-X11/lib/src/GetWMCMapW.c new file mode 100644 index 000000000..722ec60f8 --- /dev/null +++ b/nx-X11/lib/src/GetWMCMapW.c @@ -0,0 +1,87 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include + +Status XGetWMColormapWindows ( + Display *dpy, + Window w, + Window **colormapWindows, + int *countReturn) +{ + Atom *data = NULL; + Atom actual_type; + Atom prop; + int actual_format; + unsigned long leftover, nitems; + + prop = XInternAtom(dpy, "WM_COLORMAP_WINDOWS", False); + if (prop == None) return False; + + /* get the property */ + if (XGetWindowProperty (dpy, w, prop, + 0L, 1000000L, False, + XA_WINDOW, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **) &data) + != Success) + return False; + + if (actual_type != XA_WINDOW || actual_format != 32) { + Xfree (data); + return False; + } + + *colormapWindows = (Window *) data; + *countReturn = (int) nitems; + return True; +} diff --git a/nx-X11/lib/src/GetWMProto.c b/nx-X11/lib/src/GetWMProto.c new file mode 100644 index 000000000..1ea4f55d5 --- /dev/null +++ b/nx-X11/lib/src/GetWMProto.c @@ -0,0 +1,87 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include + +Status XGetWMProtocols ( + Display *dpy, + Window w, + Atom **protocols, + int *countReturn) +{ + Atom *data = NULL; + Atom actual_type; + Atom prop; + int actual_format; + unsigned long leftover, nitems; + + prop = XInternAtom(dpy, "WM_PROTOCOLS", False); + if (prop == None) return False; + + /* get the property */ + if (XGetWindowProperty (dpy, w, prop, + 0L, 1000000L, False, + XA_ATOM, &actual_type, &actual_format, + &nitems, &leftover, (unsigned char **) &data) + != Success) + return False; + + if (actual_type != XA_ATOM || actual_format != 32) { + Xfree (data); + return False; + } + + *protocols = (Atom *) data; + *countReturn = (int) nitems; + return True; +} diff --git a/nx-X11/lib/src/GrButton.c b/nx-X11/lib/src/GrButton.c new file mode 100644 index 000000000..621f49a5c --- /dev/null +++ b/nx-X11/lib/src/GrButton.c @@ -0,0 +1,60 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGrabButton( + register Display *dpy, + unsigned int button, /* CARD8 */ + unsigned int modifiers, /* CARD16 */ + Window grab_window, + Bool owner_events, + unsigned int event_mask, /* CARD16 */ + int pointer_mode, + int keyboard_mode, + Window confine_to, + Cursor curs) +{ + register xGrabButtonReq *req; + LockDisplay(dpy); + GetReq(GrabButton, req); + req->modifiers = modifiers; + req->button = button; + req->grabWindow = grab_window; + req->ownerEvents = owner_events; + req->eventMask = event_mask; + req->pointerMode = pointer_mode; + req->keyboardMode = keyboard_mode; + req->confineTo = confine_to; + req->cursor = curs; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/GrKey.c b/nx-X11/lib/src/GrKey.c new file mode 100644 index 000000000..d2da5952f --- /dev/null +++ b/nx-X11/lib/src/GrKey.c @@ -0,0 +1,58 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGrabKey( + register Display *dpy, + int key, + unsigned int modifiers, + Window grab_window, + Bool owner_events, + int pointer_mode, + int keyboard_mode) + +{ + register xGrabKeyReq *req; + LockDisplay(dpy); + GetReq(GrabKey, req); + req->ownerEvents = owner_events; + req->grabWindow = grab_window; + req->modifiers = modifiers; + req->key = key; + req->pointerMode = pointer_mode; + req->keyboardMode = keyboard_mode; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + + + diff --git a/nx-X11/lib/src/GrKeybd.c b/nx-X11/lib/src/GrKeybd.c new file mode 100644 index 000000000..07dc84115 --- /dev/null +++ b/nx-X11/lib/src/GrKeybd.c @@ -0,0 +1,58 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +int XGrabKeyboard ( + register Display *dpy, + Window window, + Bool ownerEvents, + int pointerMode, + int keyboardMode, + Time time) +{ + xGrabKeyboardReply rep; + register xGrabKeyboardReq *req; + register int status; + LockDisplay(dpy); + GetReq(GrabKeyboard, req); + req->grabWindow = window; + req->ownerEvents = ownerEvents; + req->pointerMode = pointerMode; + req->keyboardMode = keyboardMode; + req->time = time; + + /* if we ever return, suppress the error */ + if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) + rep.status = GrabSuccess; + status = rep.status; + UnlockDisplay(dpy); + SyncHandle(); + return (status); +} + diff --git a/nx-X11/lib/src/GrPointer.c b/nx-X11/lib/src/GrPointer.c new file mode 100644 index 000000000..a0d98277c --- /dev/null +++ b/nx-X11/lib/src/GrPointer.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int XGrabPointer( + register Display *dpy, + Window grab_window, + Bool owner_events, + unsigned int event_mask, /* CARD16 */ + int pointer_mode, + int keyboard_mode, + Window confine_to, + Cursor curs, + Time time) +{ + xGrabPointerReply rep; + register xGrabPointerReq *req; + register int status; + LockDisplay(dpy); + GetReq(GrabPointer, req); + req->grabWindow = grab_window; + req->ownerEvents = owner_events; + req->eventMask = event_mask; + req->pointerMode = pointer_mode; + req->keyboardMode = keyboard_mode; + req->confineTo = confine_to; + req->cursor = curs; + req->time = time; + + /* if we ever return, suppress the error */ + if (_XReply (dpy, (xReply *) &rep, 0, xTrue) == 0) + rep.status = GrabSuccess; + status = rep.status; + UnlockDisplay(dpy); + SyncHandle(); + return (status); +} diff --git a/nx-X11/lib/src/GrServer.c b/nx-X11/lib/src/GrServer.c new file mode 100644 index 000000000..c4c62bef3 --- /dev/null +++ b/nx-X11/lib/src/GrServer.c @@ -0,0 +1,42 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XGrabServer (register Display *dpy) +{ + _X_UNUSED register xReq *req; + LockDisplay(dpy); + GetEmptyReq(GrabServer, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/Host.c b/nx-X11/lib/src/Host.c new file mode 100644 index 000000000..b07c9c312 --- /dev/null +++ b/nx-X11/lib/src/Host.c @@ -0,0 +1,144 @@ +/* + +Copyright 1986, 1998 The Open Group + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group. + +*/ + +/* + * Copyright 2004 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + + +/* this might be rightly regarded an os dependent file */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +static inline int +changehost (Display *dpy, XHostAddress *host, BYTE mode) +{ + xChangeHostsReq *req; + int length; + XServerInterpretedAddress *siAddr; + int addrlen; + + siAddr = host->family == FamilyServerInterpreted ? + (XServerInterpretedAddress *)host->address : NULL; + addrlen = siAddr ? + siAddr->typelength + siAddr->valuelength + 1 : host->length; + + length = (addrlen + 3) & ~0x3; /* round up */ + + LockDisplay(dpy); + GetReqExtra (ChangeHosts, length, req); + if (!req) { + UnlockDisplay(dpy); + return 0; + } + req->mode = mode; + req->hostFamily = host->family; + req->hostLength = addrlen; + if (siAddr) { + char *dest = (char *) NEXTPTR(req,xChangeHostsReq); + memcpy(dest, siAddr->type, siAddr->typelength); + dest[siAddr->typelength] = '\0'; + memcpy(dest + siAddr->typelength + 1,siAddr->value,siAddr->valuelength); + } else { + memcpy((char *) NEXTPTR(req,xChangeHostsReq), host->address, addrlen); + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XAddHost ( + register Display *dpy, + XHostAddress *host) +{ + return changehost(dpy, host, HostInsert); +} + +int +XRemoveHost ( + register Display *dpy, + XHostAddress *host) +{ + return changehost(dpy, host, HostDelete); +} + +int +XAddHosts ( + register Display *dpy, + XHostAddress *hosts, + int n) +{ + register int i; + for (i = 0; i < n; i++) { + (void) XAddHost(dpy, &hosts[i]); + } + return 1; +} + +int +XRemoveHosts ( + register Display *dpy, + XHostAddress *hosts, + int n) +{ + register int i; + for (i = 0; i < n; i++) { + (void) XRemoveHost(dpy, &hosts[i]); + } + return 1; +} diff --git a/nx-X11/lib/src/Iconify.c b/nx-X11/lib/src/Iconify.c new file mode 100644 index 000000000..542f5885c --- /dev/null +++ b/nx-X11/lib/src/Iconify.c @@ -0,0 +1,89 @@ + +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. + + All Rights Reserved + +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 +supporting documentation, and that the name Wyse not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +******************************************************************/ +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +/* + * This function instructs the window manager to change this window from + * NormalState to IconicState. + */ +Status XIconifyWindow ( + Display *dpy, + Window w, + int screen) +{ + Atom prop; + + prop = XInternAtom (dpy, "WM_CHANGE_STATE", False); + if (prop == None) + return False; + else { + XClientMessageEvent ev = { + .type = ClientMessage, + .window = w, + .message_type = prop, + .format = 32, + .data.l[0] = IconicState + }; + Window root = RootWindow (dpy, screen); + + return (XSendEvent (dpy, root, False, + SubstructureRedirectMask|SubstructureNotifyMask, + (XEvent *)&ev)); + } +} diff --git a/nx-X11/lib/src/IfEvent.c b/nx-X11/lib/src/IfEvent.c new file mode 100644 index 000000000..1a5eef7ce --- /dev/null +++ b/nx-X11/lib/src/IfEvent.c @@ -0,0 +1,79 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Flush output and (wait for and) return the next event matching the + * predicate in the queue. + */ + +int +XIfEvent ( + register Display *dpy, + register XEvent *event, + Bool (*predicate)( + Display* /* display */, + XEvent* /* event */, + char* /* arg */ + ), /* function to call */ + char *arg) +{ + register _XQEvent *qelt, *prev; + unsigned long qe_serial = 0; + + LockDisplay(dpy); + prev = NULL; + while (1) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if(qelt->qserial_num > qe_serial + && (*predicate)(dpy, &qelt->event, arg)) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + _XStoreEventCookie(dpy, event); + UnlockDisplay(dpy); + return 0; + } + } + if (prev) + qe_serial = prev->qserial_num; + _XReadEvents(dpy); + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockDisplay(dpy); + return 0; + } +#endif + } +} diff --git a/nx-X11/lib/src/ImText.c b/nx-X11/lib/src/ImText.c new file mode 100644 index 000000000..c12f26854 --- /dev/null +++ b/nx-X11/lib/src/ImText.c @@ -0,0 +1,101 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawImageString( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + _Xconst char *string, + int length) +{ + register xImageText8Req *req; + char *CharacterOffset = (char *)string; + int FirstTimeThrough = True; + int lastX = 0; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + while (length > 0) + { + int Unit; + + if (length > 255) Unit = 255; + else Unit = length; + + if (FirstTimeThrough) + { + FirstTimeThrough = False; + } + else + { + char buf[512]; + char *ptr, *str; + xQueryTextExtentsReq *qreq; + xQueryTextExtentsReply rep; + int i; + + GetReq(QueryTextExtents, qreq); + qreq->fid = gc->gid; + qreq->length += (510 + 3)>>2; + qreq->oddLength = 1; + str = CharacterOffset - 255; + for (ptr = buf, i = 255; --i >= 0; ) { + *ptr++ = 0; + *ptr++ = *str++; + } + Data (dpy, buf, 510); + if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) + break; + + x = lastX + cvtINT32toInt (rep.overallWidth); + } + + GetReq (ImageText8, req); + req->length += (Unit + 3) >> 2; + req->nChars = Unit; + req->drawable = d; + req->gc = gc->gid; + req->y = y; + + lastX = req->x = x; + Data (dpy, CharacterOffset, (long)Unit); + CharacterOffset += Unit; + length -= Unit; + } + UnlockDisplay(dpy); + SyncHandle(); + return 0; +} + diff --git a/nx-X11/lib/src/ImText16.c b/nx-X11/lib/src/ImText16.c new file mode 100644 index 000000000..b0b60710c --- /dev/null +++ b/nx-X11/lib/src/ImText16.c @@ -0,0 +1,103 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawImageString16( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + _Xconst XChar2b *string, + int length) +{ + register xImageText16Req *req; + XChar2b *CharacterOffset = (XChar2b *)string; + int FirstTimeThrough = True; + int lastX = 0; + + LockDisplay(dpy); + FlushGC(dpy, gc); + + while (length > 0) + { + int Unit, Datalength; + + if (length > 255) Unit = 255; + else Unit = length; + + if (FirstTimeThrough) + { + FirstTimeThrough = False; + } + else + { + char buf[512]; + xQueryTextExtentsReq *qreq; + xQueryTextExtentsReply rep; + unsigned char *ptr; + XChar2b *str; + int i; + + GetReq(QueryTextExtents, qreq); + qreq->fid = gc->gid; + qreq->length += (510 + 3)>>2; + qreq->oddLength = 1; + str = CharacterOffset - 255; + for (ptr = (unsigned char *)buf, i = 255; --i >= 0; str++) { + *ptr++ = str->byte1; + *ptr++ = str->byte2; + } + Data (dpy, buf, 510); + if (!_XReply (dpy, (xReply *)&rep, 0, xTrue)) + break; + + x = lastX + cvtINT32toInt (rep.overallWidth); + } + + GetReq (ImageText16, req); + req->length += ((Unit << 1) + 3) >> 2; + req->nChars = Unit; + req->drawable = d; + req->gc = gc->gid; + req->y = y; + + lastX = req->x = x; + Datalength = Unit << 1; + Data (dpy, (char *)CharacterOffset, (long)Datalength); + CharacterOffset += Unit; + length -= Unit; + } + UnlockDisplay(dpy); + SyncHandle(); + return 0; +} + diff --git a/nx-X11/lib/src/ImUtil.c b/nx-X11/lib/src/ImUtil.c new file mode 100644 index 000000000..79ba80ecc --- /dev/null +++ b/nx-X11/lib/src/ImUtil.c @@ -0,0 +1,1013 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "ImUtil.h" + +static int _XDestroyImage(XImage *); +static unsigned long _XGetPixel(XImage *, int, int); +static unsigned long _XGetPixel1(XImage *, int, int); +static unsigned long _XGetPixel8(XImage *, int, int); +static unsigned long _XGetPixel16(XImage *, int, int); +static unsigned long _XGetPixel32(XImage *, int, int); +static int _XPutPixel(XImage *, int, int, unsigned long); +static int _XPutPixel1(XImage *, int, int, unsigned long); +static int _XPutPixel8(XImage *, int, int, unsigned long); +static int _XPutPixel16(XImage *, int, int, unsigned long); +static int _XPutPixel32(XImage *, int, int, unsigned long); +static XImage *_XSubImage(XImage *, int, int, unsigned int, unsigned int); +static int _XAddPixel(XImage *, long); + +static unsigned char const _lomask[0x09] = { 0x00, 0x01, 0x03, 0x07, 0x0f, 0x1f, 0x3f, 0x7f, 0xff }; +static unsigned char const _himask[0x09] = { 0xff, 0xfe, 0xfc, 0xf8, 0xf0, 0xe0, 0xc0, 0x80, 0x00 }; + +/* These two convenience routines return the scanline_pad and bits_per_pixel + associated with a specific depth of ZPixmap format image for a + display. */ + +int +_XGetScanlinePad( + Display *dpy, + int depth) + { + register ScreenFormat *fmt = dpy->pixmap_format; + register int i; + + for (i = dpy->nformats + 1; --i; ++fmt) + if (fmt->depth == depth) + return(fmt->scanline_pad); + + return(dpy->bitmap_pad); + } + +int +_XGetBitsPerPixel( + Display *dpy, + int depth) + { + register ScreenFormat *fmt = dpy->pixmap_format; + register int i; + + for (i = dpy->nformats + 1; --i; ++fmt) + if (fmt->depth == depth) + return(fmt->bits_per_pixel); + if (depth <= 4) + return 4; + if (depth <= 8) + return 8; + if (depth <= 16) + return 16; + return 32; + } + + +/* + * This module provides rudimentary manipulation routines for image data + * structures. The functions provided are: + * + * XCreateImage Creates a default XImage data structure + * _XDestroyImage Deletes an XImage data structure + * _XGetPixel Reads a pixel from an image data structure + * _XGetPixel32 Reads a pixel from a 32-bit Z image data structure + * _XGetPixel16 Reads a pixel from a 16-bit Z image data structure + * _XGetPixel8 Reads a pixel from an 8-bit Z image data structure + * _XGetPixel1 Reads a pixel from an 1-bit image data structure + * _XPutPixel Writes a pixel into an image data structure + * _XPutPixel32 Writes a pixel into a 32-bit Z image data structure + * _XPutPixel16 Writes a pixel into a 16-bit Z image data structure + * _XPutPixel8 Writes a pixel into an 8-bit Z image data structure + * _XPutPixel1 Writes a pixel into an 1-bit image data structure + * _XSubImage Clones a new (sub)image from an existing one + * _XSetImage Writes an image data pattern into another image + * _XAddPixel Adds a constant value to every pixel in an image + * + * The logic contained in these routines makes several assumptions about + * the image data structures, and at least for current implementations + * these assumptions are believed to be true. They are: + * + * For all formats, bits_per_pixel is less than or equal to 32. + * For XY formats, bitmap_unit is always less than or equal to bitmap_pad. + * For XY formats, bitmap_unit is 8, 16, or 32 bits. + * For Z format, bits_per_pixel is 1, 4, 8, 16, 24, or 32 bits. + */ +static void _xynormalizeimagebits ( + register unsigned char *bp, + register XImage *img) +{ + register unsigned char c; + + if (img->byte_order != img->bitmap_bit_order) { + switch (img->bitmap_unit) { + + case 16: + c = *bp; + *bp = *(bp + 1); + *(bp + 1) = c; + break; + + case 32: + c = *(bp + 3); + *(bp + 3) = *bp; + *bp = c; + c = *(bp + 2); + *(bp + 2) = *(bp + 1); + *(bp + 1) = c; + break; + } + } + if (img->bitmap_bit_order == MSBFirst) + _XReverse_Bytes (bp, img->bitmap_unit >> 3); +} + +static void _znormalizeimagebits ( + register unsigned char *bp, + register XImage *img) +{ + register unsigned char c; + switch (img->bits_per_pixel) { + + case 4: + *bp = ((*bp >> 4) & 0xF) | ((*bp << 4) & ~0xF); + break; + + case 16: + c = *bp; + *bp = *(bp + 1); + *(bp + 1) = c; + break; + + case 24: + c = *(bp + 2); + *(bp + 2) = *bp; + *bp = c; + break; + + case 32: + c = *(bp + 3); + *(bp + 3) = *bp; + *bp = c; + c = *(bp + 2); + *(bp + 2) = *(bp + 1); + *(bp + 1) = c; + break; + } +} + +static void _putbits( + register char *src, /* address of source bit string */ + int dstoffset, /* bit offset into destination; range is 0-31 */ + register int numbits,/* number of bits to copy to destination */ + register char *dst) /* address of destination bit string */ +{ + register unsigned char chlo, chhi; + int hibits; + dst = dst + (dstoffset >> 3); + dstoffset = dstoffset & 7; + hibits = 8 - dstoffset; + chlo = *dst & _lomask[dstoffset]; + for (;;) { + chhi = (*src << dstoffset) & _himask[dstoffset]; + if (numbits <= hibits) { + chhi = chhi & _lomask[dstoffset + numbits]; + *dst = (*dst & _himask[dstoffset + numbits]) | chlo | chhi; + break; + } + *dst = chhi | chlo; + dst++; + numbits = numbits - hibits; + chlo = (unsigned char) (*src & _himask[hibits]) >> hibits; + src++; + if (numbits <= dstoffset) { + chlo = chlo & _lomask[numbits]; + *dst = (*dst & _himask[numbits]) | chlo; + break; + } + numbits = numbits - dstoffset; + } +} + + +/* + * Macros + * + * The ROUNDUP macro rounds up a quantity to the specified boundary, + * then truncates to bytes. + * + * The XYNORMALIZE macro determines whether XY format data requires + * normalization and calls a routine to do so if needed. The logic in + * this module is designed for LSBFirst byte and bit order, so + * normalization is done as required to present the data in this order. + * + * The ZNORMALIZE macro performs byte and nibble order normalization if + * required for Z format data. + * + * The XYINDEX macro computes the index to the starting byte (char) boundary + * for a bitmap_unit containing a pixel with coordinates x and y for image + * data in XY format. + * + * The ZINDEX macro computes the index to the starting byte (char) boundary + * for a pixel with coordinates x and y for image data in ZPixmap format. + * + */ + +#define ROUNDUP(nbytes, pad) ((((nbytes) + ((pad)-1)) / (pad)) * ((pad)>>3)) + +#define XYNORMALIZE(bp, img) \ + if ((img->byte_order == MSBFirst) || (img->bitmap_bit_order == MSBFirst)) \ + _xynormalizeimagebits((unsigned char *)(bp), img) + +#define ZNORMALIZE(bp, img) \ + if (img->byte_order == MSBFirst) \ + _znormalizeimagebits((unsigned char *)(bp), img) + +#define XYINDEX(x, y, img) \ + ((y) * img->bytes_per_line) + \ + (((x) + img->xoffset) / img->bitmap_unit) * (img->bitmap_unit >> 3) + +#define ZINDEX(x, y, img) ((y) * img->bytes_per_line) + \ + (((x) * img->bits_per_pixel) >> 3) + +/* + * This routine initializes the image object function pointers. The + * intent is to provide native (i.e. fast) routines for native format images + * only using the generic (i.e. slow) routines when fast ones don't exist. + * However, with the current rather botched external interface, clients may + * have to mung image attributes after the image gets created, so the fast + * routines always have to check to make sure the optimization is still + * valid, and reinit the functions if not. + */ +void _XInitImageFuncPtrs ( + register XImage *image) +{ + image->f.create_image = XCreateImage; + image->f.destroy_image = _XDestroyImage; + if ((image->format == ZPixmap) && (image->bits_per_pixel == 8)) { + image->f.get_pixel = _XGetPixel8; + image->f.put_pixel = _XPutPixel8; + } else if (((image->bits_per_pixel | image->depth) == 1) && + (image->byte_order == image->bitmap_bit_order)) { + image->f.get_pixel = _XGetPixel1; + image->f.put_pixel = _XPutPixel1; + } else if ((image->format == ZPixmap) && + (image->bits_per_pixel == 32)) { + image->f.get_pixel = _XGetPixel32; + image->f.put_pixel = _XPutPixel32; + } else if ((image->format == ZPixmap) && + (image->bits_per_pixel == 16)) { + image->f.get_pixel = _XGetPixel16; + image->f.put_pixel = _XPutPixel16; + } else { + image->f.get_pixel = _XGetPixel; + image->f.put_pixel = _XPutPixel; + } + image->f.sub_image = _XSubImage; +/* image->f.set_image = _XSetImage;*/ + image->f.add_pixel = _XAddPixel; +} + +/* + * CreateImage + * + * Allocates the memory necessary for an XImage data structure. + * Initializes the structure with "default" values and returns XImage. + * + */ + +XImage *XCreateImage ( + register Display *dpy, + register Visual *visual, + unsigned int depth, + int format, + int offset, /*How many pixels from the start of the data does the + picture to be transmitted start?*/ + + char *data, + unsigned int width, + unsigned int height, + int xpad, + int image_bytes_per_line) + /*How many bytes between a pixel on one line and the pixel with + the same X coordinate on the next line? 0 means + XCreateImage can calculate it.*/ +{ + register XImage *image; + int bits_per_pixel = 1; + int min_bytes_per_line; + + if (depth == 0 || depth > 32 || + (format != XYBitmap && format != XYPixmap && format != ZPixmap) || + (format == XYBitmap && depth != 1) || + (xpad != 8 && xpad != 16 && xpad != 32) || + offset < 0) + return (XImage *) NULL; + if ((image = Xcalloc(1, sizeof(XImage))) == NULL) + return (XImage *) NULL; + + image->width = width; + image->height = height; + image->format = format; + image->byte_order = dpy->byte_order; + image->bitmap_unit = dpy->bitmap_unit; + image->bitmap_bit_order = dpy->bitmap_bit_order; + if (visual != NULL) { + image->red_mask = visual->red_mask; + image->green_mask = visual->green_mask; + image->blue_mask = visual->blue_mask; + } + else { + image->red_mask = image->green_mask = image->blue_mask = 0; + } + if (format == ZPixmap) + { + bits_per_pixel = _XGetBitsPerPixel(dpy, (int) depth); + } + + image->xoffset = offset; + image->bitmap_pad = xpad; + image->depth = depth; + image->data = data; + /* + * compute per line accelerator. + */ + { + if (format == ZPixmap) + min_bytes_per_line = + ROUNDUP((bits_per_pixel * width), image->bitmap_pad); + else + min_bytes_per_line = + ROUNDUP((width + offset), image->bitmap_pad); + } + if (image_bytes_per_line == 0) { + image->bytes_per_line = min_bytes_per_line; + } else if (image_bytes_per_line < min_bytes_per_line) { + Xfree(image); + return NULL; + } else { + image->bytes_per_line = image_bytes_per_line; + } + + image->bits_per_pixel = bits_per_pixel; + image->obdata = NULL; + _XInitImageFuncPtrs (image); + + return image; +} + +Status XInitImage (XImage *image) +{ + int min_bytes_per_line; + + if (image->depth == 0 || image->depth > 32 || + image->bits_per_pixel > 32 || image->bitmap_unit > 32 || + image->bits_per_pixel < 0 || image->bitmap_unit < 0 || + (image->format != XYBitmap && + image->format != XYPixmap && + image->format != ZPixmap) || + (image->format == XYBitmap && image->depth != 1) || + (image->bitmap_pad != 8 && + image->bitmap_pad != 16 && + image->bitmap_pad != 32) || + image->xoffset < 0) + return 0; + + /* + * compute per line accelerator. + */ + if (image->format == ZPixmap) + min_bytes_per_line = + ROUNDUP((image->bits_per_pixel * image->width), + image->bitmap_pad); + else + min_bytes_per_line = + ROUNDUP((image->width + image->xoffset), image->bitmap_pad); + + if (image->bytes_per_line == 0) { + image->bytes_per_line = min_bytes_per_line; + } else if (image->bytes_per_line < min_bytes_per_line) { + return 0; + } + + _XInitImageFuncPtrs (image); + + return 1; +} + +/* + * _DestroyImage + * + * Deallocates the memory associated with the ximage data structure. + * this version handles the case of the image data being malloc'd + * entirely by the library. + */ + +static int _XDestroyImage (XImage *ximage) +{ + Xfree(ximage->data); + Xfree(ximage->obdata); + Xfree(ximage); + return 1; +} + + +/* + * GetPixel + * + * Returns the specified pixel. The X and Y coordinates are relative to + * the origin (upper left [0,0]) of the image. The pixel value is returned + * in normalized format, i.e. the LSB of the long is the LSB of the pixel. + * The algorithm used is: + * + * copy the source bitmap_unit or Zpixel into temp + * normalize temp if needed + * extract the pixel bits into return value + * + */ + +static unsigned long const low_bits_table[] = { + 0x00000000, 0x00000001, 0x00000003, 0x00000007, + 0x0000000f, 0x0000001f, 0x0000003f, 0x0000007f, + 0x000000ff, 0x000001ff, 0x000003ff, 0x000007ff, + 0x00000fff, 0x00001fff, 0x00003fff, 0x00007fff, + 0x0000ffff, 0x0001ffff, 0x0003ffff, 0x0007ffff, + 0x000fffff, 0x001fffff, 0x003fffff, 0x007fffff, + 0x00ffffff, 0x01ffffff, 0x03ffffff, 0x07ffffff, + 0x0fffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, + 0xffffffff +}; + +static unsigned long _XGetPixel ( + register XImage *ximage, + int x, + int y) + +{ + unsigned long pixel, px; + register char *src; + register char *dst; + register int i, j; + int bits, nbytes; + long plane; + + if ((ximage->bits_per_pixel | ximage->depth) == 1) { + src = &ximage->data[XYINDEX(x, y, ximage)]; + dst = (char *)&pixel; + pixel = 0; + for (i = ximage->bitmap_unit >> 3; --i >= 0; ) *dst++ = *src++; + XYNORMALIZE(&pixel, ximage); + bits = (x + ximage->xoffset) % ximage->bitmap_unit; + pixel = ((((char *)&pixel)[bits>>3])>>(bits&7)) & 1; + } else if (ximage->format == XYPixmap) { + pixel = 0; + plane = 0; + nbytes = ximage->bitmap_unit >> 3; + for (i = ximage->depth; --i >= 0; ) { + src = &ximage->data[XYINDEX(x, y, ximage)+ plane]; + dst = (char *)&px; + px = 0; + for (j = nbytes; --j >= 0; ) *dst++ = *src++; + XYNORMALIZE(&px, ximage); + bits = (x + ximage->xoffset) % ximage->bitmap_unit; + pixel = (pixel << 1) | + (((((char *)&px)[bits>>3])>>(bits&7)) & 1); + plane = plane + (ximage->bytes_per_line * ximage->height); + } + } else if (ximage->format == ZPixmap) { + src = &ximage->data[ZINDEX(x, y, ximage)]; + dst = (char *)&px; + px = 0; + for (i = (ximage->bits_per_pixel + 7) >> 3; --i >= 0; ) + *dst++ = *src++; + ZNORMALIZE(&px, ximage); + pixel = 0; + for (i=sizeof(unsigned long); --i >= 0; ) + pixel = (pixel << 8) | ((unsigned char *)&px)[i]; + if (ximage->bits_per_pixel == 4) { + if (x & 1) + pixel >>= 4; + else + pixel &= 0xf; + } + } else { + return 0; /* bad image */ + } + if (ximage->bits_per_pixel == ximage->depth) + return pixel; + else + return (pixel & low_bits_table[ximage->depth]); +} + +static CARD32 const byteorderpixel = MSBFirst << 24; + +static unsigned long _XGetPixel32 ( + register XImage *ximage, + int x, + int y) +{ + register unsigned char *addr; + unsigned long pixel; + + if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { + addr = &((unsigned char *)ximage->data) + [y * ximage->bytes_per_line + (x << 2)]; + if (*((const char *)&byteorderpixel) == ximage->byte_order) + pixel = *((CARD32 *)addr); + else if (ximage->byte_order == MSBFirst) + pixel = ((unsigned long)addr[0] << 24 | + (unsigned long)addr[1] << 16 | + (unsigned long)addr[2] << 8 | + addr[3]); + else + pixel = ((unsigned long)addr[3] << 24 | + (unsigned long)addr[2] << 16 | + (unsigned long)addr[1] << 8 | + addr[0]); + if (ximage->depth != 32) + pixel &= low_bits_table[ximage->depth]; + return pixel; + } else { + _XInitImageFuncPtrs(ximage); + return XGetPixel(ximage, x, y); + } +} + +static unsigned long _XGetPixel16 ( + register XImage *ximage, + int x, + int y) +{ + register unsigned char *addr; + unsigned long pixel; + + if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16)) { + addr = &((unsigned char *)ximage->data) + [y * ximage->bytes_per_line + (x << 1)]; + if (ximage->byte_order == MSBFirst) + pixel = addr[0] << 8 | addr[1]; + else + pixel = addr[1] << 8 | addr[0]; + if (ximage->depth != 16) + pixel &= low_bits_table[ximage->depth]; + return pixel; + } else { + _XInitImageFuncPtrs(ximage); + return XGetPixel(ximage, x, y); + } +} + +static unsigned long _XGetPixel8 ( + register XImage *ximage, + int x, + int y) +{ + unsigned char pixel; + + if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { + pixel = ((unsigned char *)ximage->data) + [y * ximage->bytes_per_line + x]; + if (ximage->depth != 8) + pixel &= low_bits_table[ximage->depth]; + return pixel; + } else { + _XInitImageFuncPtrs(ximage); + return XGetPixel(ximage, x, y); + } +} + +static unsigned long _XGetPixel1 ( + register XImage *ximage, + int x, + int y) +{ + unsigned char bit; + int xoff, yoff; + + if (((ximage->bits_per_pixel | ximage->depth) == 1) && + (ximage->byte_order == ximage->bitmap_bit_order)) { + xoff = x + ximage->xoffset; + yoff = y * ximage->bytes_per_line + (xoff >> 3); + xoff &= 7; + if (ximage->bitmap_bit_order == MSBFirst) + bit = 0x80 >> xoff; + else + bit = 1 << xoff; + return (ximage->data[yoff] & bit) ? 1 : 0; + } else { + _XInitImageFuncPtrs(ximage); + return XGetPixel(ximage, x, y); + } +} + +/* + * PutPixel + * + * Overwrites the specified pixel. The X and Y coordinates are relative to + * the origin (upper left [0,0]) of the image. The input pixel value must be + * in normalized format, i.e. the LSB of the long is the LSB of the pixel. + * The algorithm used is: + * + * copy the destination bitmap_unit or Zpixel to temp + * normalize temp if needed + * copy the pixel bits into the temp + * renormalize temp if needed + * copy the temp back into the destination image data + * + */ + +static int _XPutPixel ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) + +{ + unsigned long px, npixel; + register char *src; + register char *dst; + register int i; + int j, nbytes; + long plane; + + if (ximage->depth == 4) + pixel &= 0xf; + npixel = pixel; + for (i=0, px=pixel; i>=8) + ((unsigned char *)&pixel)[i] = px; + if ((ximage->bits_per_pixel | ximage->depth) == 1) { + src = &ximage->data[XYINDEX(x, y, ximage)]; + dst = (char *)&px; + px = 0; + nbytes = ximage->bitmap_unit >> 3; + for (i = nbytes; --i >= 0; ) *dst++ = *src++; + XYNORMALIZE(&px, ximage); + i = ((x + ximage->xoffset) % ximage->bitmap_unit); + _putbits ((char *)&pixel, i, 1, (char *)&px); + XYNORMALIZE(&px, ximage); + src = (char *) &px; + dst = &ximage->data[XYINDEX(x, y, ximage)]; + for (i = nbytes; --i >= 0; ) *dst++ = *src++; + } else if (ximage->format == XYPixmap) { + plane = (ximage->bytes_per_line * ximage->height) * + (ximage->depth - 1); /* do least signif plane 1st */ + nbytes = ximage->bitmap_unit >> 3; + for (j = ximage->depth; --j >= 0; ) { + src = &ximage->data[XYINDEX(x, y, ximage) + plane]; + dst = (char *) &px; + px = 0; + for (i = nbytes; --i >= 0; ) *dst++ = *src++; + XYNORMALIZE(&px, ximage); + i = ((x + ximage->xoffset) % ximage->bitmap_unit); + _putbits ((char *)&pixel, i, 1, (char *)&px); + XYNORMALIZE(&px, ximage); + src = (char *)&px; + dst = &ximage->data[XYINDEX(x, y, ximage) + plane]; + for (i = nbytes; --i >= 0; ) *dst++ = *src++; + npixel = npixel >> 1; + for (i=0, px=npixel; i>=8) + ((unsigned char *)&pixel)[i] = px; + plane = plane - (ximage->bytes_per_line * ximage->height); + } + } else if (ximage->format == ZPixmap) { + src = &ximage->data[ZINDEX(x, y, ximage)]; + dst = (char *)&px; + px = 0; + nbytes = (ximage->bits_per_pixel + 7) >> 3; + for (i = nbytes; --i >= 0; ) *dst++ = *src++; + ZNORMALIZE(&px, ximage); + _putbits ((char *)&pixel, + (x * ximage->bits_per_pixel) & 7, + ximage->bits_per_pixel, (char *)&px); + ZNORMALIZE(&px, ximage); + src = (char *)&px; + dst = &ximage->data[ZINDEX(x, y, ximage)]; + for (i = nbytes; --i >= 0; ) *dst++ = *src++; + } else { + return 0; /* bad image */ + } + return 1; +} + +static int _XPutPixel32 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) +{ + unsigned char *addr; + + if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 32)) { + addr = &((unsigned char *)ximage->data) + [y * ximage->bytes_per_line + (x << 2)]; + if (*((const char *)&byteorderpixel) == ximage->byte_order) + *((CARD32 *)addr) = pixel; + else if (ximage->byte_order == MSBFirst) { + addr[0] = pixel >> 24; + addr[1] = pixel >> 16; + addr[2] = pixel >> 8; + addr[3] = pixel; + } else { + addr[3] = pixel >> 24; + addr[2] = pixel >> 16; + addr[1] = pixel >> 8; + addr[0] = pixel; + } + return 1; + } else { + _XInitImageFuncPtrs(ximage); + return XPutPixel(ximage, x, y, pixel); + } +} + +static int _XPutPixel16 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) +{ + unsigned char *addr; + + if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 16)) { + addr = &((unsigned char *)ximage->data) + [y * ximage->bytes_per_line + (x << 1)]; + if (ximage->byte_order == MSBFirst) { + addr[0] = pixel >> 8; + addr[1] = pixel; + } else { + addr[1] = pixel >> 8; + addr[0] = pixel; + } + return 1; + } else { + _XInitImageFuncPtrs(ximage); + return XPutPixel(ximage, x, y, pixel); + } +} + +static int _XPutPixel8 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) +{ + if ((ximage->format == ZPixmap) && (ximage->bits_per_pixel == 8)) { + ximage->data[y * ximage->bytes_per_line + x] = pixel; + return 1; + } else { + _XInitImageFuncPtrs(ximage); + return XPutPixel(ximage, x, y, pixel); + } +} + +static int _XPutPixel1 ( + register XImage *ximage, + int x, + int y, + unsigned long pixel) +{ + unsigned char bit; + int xoff, yoff; + + if (((ximage->bits_per_pixel | ximage->depth) == 1) && + (ximage->byte_order == ximage->bitmap_bit_order)) { + xoff = x + ximage->xoffset; + yoff = y * ximage->bytes_per_line + (xoff >> 3); + xoff &= 7; + if (ximage->bitmap_bit_order == MSBFirst) + bit = 0x80 >> xoff; + else + bit = 1 << xoff; + if (pixel & 1) + ximage->data[yoff] |= bit; + else + ximage->data[yoff] &= ~bit; + return 1; + } else { + _XInitImageFuncPtrs(ximage); + return XPutPixel(ximage, x, y, pixel); + } +} + +/* + * SubImage + * + * Creates a new image that is a subsection of an existing one. + * Allocates the memory necessary for the new XImage data structure. + * Pointer to new image is returned. The algorithm used is repetitive + * calls to get and put pixel. + * + */ + +static XImage *_XSubImage ( + XImage *ximage, + register int x, /* starting x coordinate in existing image */ + register int y, /* starting y coordinate in existing image */ + unsigned int width, /* width in pixels of new subimage */ + unsigned int height)/* height in pixels of new subimage */ + +{ + register XImage *subimage; + int dsize; + register int row, col; + register unsigned long pixel; + char *data; + + if ((subimage = Xcalloc (1, sizeof (XImage))) == NULL) + return (XImage *) NULL; + subimage->width = width; + subimage->height = height; + subimage->xoffset = 0; + subimage->format = ximage->format; + subimage->byte_order = ximage->byte_order; + subimage->bitmap_unit = ximage->bitmap_unit; + subimage->bitmap_bit_order = ximage->bitmap_bit_order; + subimage->bitmap_pad = ximage->bitmap_pad; + subimage->bits_per_pixel = ximage->bits_per_pixel; + subimage->depth = ximage->depth; + /* + * compute per line accelerator. + */ + if (subimage->format == ZPixmap) + subimage->bytes_per_line = + ROUNDUP(subimage->bits_per_pixel * width, + subimage->bitmap_pad); + else + subimage->bytes_per_line = + ROUNDUP(width, subimage->bitmap_pad); + subimage->obdata = NULL; + _XInitImageFuncPtrs (subimage); + dsize = subimage->bytes_per_line * height; + if (subimage->format == XYPixmap) dsize = dsize * subimage->depth; + if (((data = Xcalloc (1, dsize)) == NULL) && (dsize > 0)) { + Xfree(subimage); + return (XImage *) NULL; + } + subimage->data = data; + + /* + * Test for cases where the new subimage is larger than the region + * that we are copying from the existing data. In those cases, + * copy the area of the existing image, and allow the "uncovered" + * area of new subimage to remain with zero filled pixels. + */ + if (height > ximage->height - y ) height = ximage->height - y; + if (width > ximage->width - x ) width = ximage->width - x; + + for (row = y; row < (y + height); row++) { + for (col = x; col < (x + width); col++) { + pixel = XGetPixel(ximage, col, row); + XPutPixel(subimage, (col - x), (row - y), pixel); + } + } + return subimage; +} + + +/* + * SetImage + * + * Overwrites a section of one image with all of the data from another. + * If the two images are not of the same format (i.e. XYPixmap and ZPixmap), + * the image data is converted to the destination format. The following + * restrictions apply: + * + * 1. The depths of the source and destination images must be equal. + * + * 2. If the height of the source image is too large to fit between + * the specified y starting point and the bottom of the image, + * then scanlines are truncated on the bottom. + * + * 3. If the width of the source image is too large to fit between + * the specified x starting point and the end of the scanline, + * then pixels are truncated on the right. + * + * The images need not have the same bitmap_bit_order, byte_order, + * bitmap_unit, bits_per_pixel, bitmap_pad, or xoffset. + * + */ + +int _XSetImage( + XImage *srcimg, + register XImage *dstimg, + register int x, + register int y) +{ + register unsigned long pixel; + register int row, col; + int width, height, startrow, startcol; + if (x < 0) { + startcol = -x; + x = 0; + } else + startcol = 0; + if (y < 0) { + startrow = -y; + y = 0; + } else + startrow = 0; + width = dstimg->width - x; + if (srcimg->width < width) + width = srcimg->width; + height = dstimg->height - y; + if (srcimg->height < height) + height = srcimg->height; + + /* this is slow, will do better later */ + for (row = startrow; row < height; row++) { + for (col = startcol; col < width; col++) { + pixel = XGetPixel(srcimg, col, row); + XPutPixel(dstimg, x + col, y + row, pixel); + } + } + return 1; +} + +/* + * AddPixel + * + * Adds a constant value to every pixel in a pixmap. + * + */ + +static int +_XAddPixel ( + register XImage *ximage, + register long value) +{ + register int x; + register int y; + + if (!value) + return 0; + if ((ximage->bits_per_pixel | ximage->depth) == 1) { + /* The only value that we can add here to an XYBitmap + * is one. Since 1 + value = ~value for one bit wide + * data, we do this quickly by taking the ones complement + * of the entire bitmap data (offset and pad included!). + * Note that we don't need to be concerned with bit or + * byte order at all. + */ + register unsigned char *dp = (unsigned char *) ximage->data; + x = ximage->bytes_per_line * ximage->height; + while (--x >= 0) { + *dp = ~*dp; + dp++; + } + } else if ((ximage->format == ZPixmap) && + (ximage->bits_per_pixel == 8)) { + register unsigned char *dp = (unsigned char *) ximage->data; + x = ximage->bytes_per_line * ximage->height; + while (--x >= 0) + *dp++ += value; + } else if ((ximage->format == ZPixmap) && + (ximage->bits_per_pixel == 16) && + (*((const char *)&byteorderpixel) == ximage->byte_order)) { + register unsigned short *dp = (unsigned short *) ximage->data; + x = (ximage->bytes_per_line >> 1) * ximage->height; + while (--x >= 0) + *dp++ += value; + } else if ((ximage->format == ZPixmap) && + (ximage->bits_per_pixel == 32) && + (*((const char *)&byteorderpixel) == ximage->byte_order)) { + register CARD32 *dp = (CARD32 *) ximage->data; + x = (ximage->bytes_per_line >> 2) * ximage->height; + while (--x >= 0) + *dp++ += value; + } else { + for (y = ximage->height; --y >= 0; ) { + for (x = ximage->width; --x >= 0; ) { + register unsigned long pixel = XGetPixel(ximage, x, y); + pixel = pixel + value; + XPutPixel(ximage, x, y, pixel); + } + } + } + return 0; +} + diff --git a/nx-X11/lib/src/InitExt.c b/nx-X11/lib/src/InitExt.c new file mode 100644 index 000000000..d02527d5c --- /dev/null +++ b/nx-X11/lib/src/InitExt.c @@ -0,0 +1,409 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +/* + * This routine is used to link a extension in so it will be called + * at appropriate times. + */ + +XExtCodes *XInitExtension ( + Display *dpy, + _Xconst char *name) +{ + XExtCodes codes; /* temp. place for extension information. */ + register _XExtension *ext;/* need a place to build it all */ + if (!XQueryExtension(dpy, name, + &codes.major_opcode, &codes.first_event, + &codes.first_error)) return (NULL); + + LockDisplay (dpy); + if (! (ext = Xcalloc (1, sizeof (_XExtension))) || + ! (ext->name = strdup(name))) { + Xfree(ext); + UnlockDisplay(dpy); + return (XExtCodes *) NULL; + } + codes.extension = dpy->ext_number++; + ext->codes = codes; + + /* chain it onto the display list */ + ext->next = dpy->ext_procs; + dpy->ext_procs = ext; + UnlockDisplay (dpy); + + return (&ext->codes); /* tell him which extension */ +} + +XExtCodes *XAddExtension (Display *dpy) +{ + register _XExtension *ext; + + LockDisplay (dpy); + if (! (ext = Xcalloc (1, sizeof (_XExtension)))) { + UnlockDisplay(dpy); + return (XExtCodes *) NULL; + } + ext->codes.extension = dpy->ext_number++; + + /* chain it onto the display list */ + ext->next = dpy->ext_procs; + dpy->ext_procs = ext; + UnlockDisplay (dpy); + + return (&ext->codes); /* tell him which extension */ +} + +static _XExtension *XLookupExtension ( + register Display *dpy, /* display */ + register int extension) /* extension number */ +{ + register _XExtension *ext; + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->codes.extension == extension) return (ext); + return (NULL); +} + +XExtData **XEHeadOfExtensionList(XEDataObject object) +{ + return *(XExtData ***)&object; +} + +int +XAddToExtensionList( + XExtData **structure, + XExtData *ext_data) +{ + ext_data->next = *structure; + *structure = ext_data; + return 1; +} + +XExtData *XFindOnExtensionList( + XExtData **structure, + int number) +{ + XExtData *ext; + + ext = *structure; + while (ext && (ext->number != number)) + ext = ext->next; + return ext; +} + +/* + * Routines to hang procs on the extension structure. + */ +CreateGCType XESetCreateGC( + Display *dpy, /* display */ + int extension, /* extension number */ + CreateGCType proc) /* routine to call when GC created */ +{ + register _XExtension *e; /* for lookup of extension */ + register CreateGCType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->create_GC; + e->create_GC = proc; + UnlockDisplay(dpy); + return (CreateGCType)oldproc; +} + +CopyGCType XESetCopyGC( + Display *dpy, /* display */ + int extension, /* extension number */ + CopyGCType proc) /* routine to call when GC copied */ +{ + register _XExtension *e; /* for lookup of extension */ + register CopyGCType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->copy_GC; + e->copy_GC = proc; + UnlockDisplay(dpy); + return (CopyGCType)oldproc; +} + +FlushGCType XESetFlushGC( + Display *dpy, /* display */ + int extension, /* extension number */ + FlushGCType proc) /* routine to call when GC copied */ +{ + register _XExtension *e; /* for lookup of extension */ + register FlushGCType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->flush_GC; + e->flush_GC = proc; + UnlockDisplay(dpy); + return (FlushGCType)oldproc; +} + +FreeGCType XESetFreeGC( + Display *dpy, /* display */ + int extension, /* extension number */ + FreeGCType proc) /* routine to call when GC freed */ +{ + register _XExtension *e; /* for lookup of extension */ + register FreeGCType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->free_GC; + e->free_GC = proc; + UnlockDisplay(dpy); + return (FreeGCType)oldproc; +} + +CreateFontType XESetCreateFont( + Display *dpy, /* display */ + int extension, /* extension number */ + CreateFontType proc) /* routine to call when font created */ +{ + register _XExtension *e; /* for lookup of extension */ + register CreateFontType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->create_Font; + e->create_Font = proc; + UnlockDisplay(dpy); + return (CreateFontType)oldproc; +} + +FreeFontType XESetFreeFont( + Display *dpy, /* display */ + int extension, /* extension number */ + FreeFontType proc) /* routine to call when font freed */ +{ + register _XExtension *e; /* for lookup of extension */ + register FreeFontType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->free_Font; + e->free_Font = proc; + UnlockDisplay(dpy); + return (FreeFontType)oldproc; +} + +CloseDisplayType XESetCloseDisplay( + Display *dpy, /* display */ + int extension, /* extension number */ + CloseDisplayType proc) /* routine to call when display closed */ +{ + register _XExtension *e; /* for lookup of extension */ + register CloseDisplayType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->close_display; + e->close_display = proc; + UnlockDisplay(dpy); + return (CloseDisplayType)oldproc; +} + +typedef Bool (*WireToEventType) ( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + +WireToEventType XESetWireToEvent( + Display *dpy, /* display */ + int event_number, /* event routine to replace */ + WireToEventType proc) /* routine to call when converting event */ +{ + register WireToEventType oldproc; + if (proc == NULL) proc = (WireToEventType)_XUnknownWireEvent; + LockDisplay (dpy); + oldproc = dpy->event_vec[event_number]; + dpy->event_vec[event_number] = proc; + UnlockDisplay (dpy); + return (WireToEventType)oldproc; +} + +typedef Bool (*WireToEventCookieType) ( + Display* /* display */, + XGenericEventCookie* /* re */, + xEvent* /* event */ +); + +WireToEventCookieType XESetWireToEventCookie( + Display *dpy, /* display */ + int extension, /* extension major opcode */ + WireToEventCookieType proc /* routine to call for generic events */ + ) +{ + WireToEventCookieType oldproc; + if (proc == NULL) proc = (WireToEventCookieType)_XUnknownWireEventCookie; + LockDisplay (dpy); + oldproc = dpy->generic_event_vec[extension & 0x7F]; + dpy->generic_event_vec[extension & 0x7F] = proc; + UnlockDisplay (dpy); + return (WireToEventCookieType)oldproc; +} + +typedef Bool (*CopyEventCookieType) ( + Display* /* display */, + XGenericEventCookie* /* in */, + XGenericEventCookie* /* out */ +); + +CopyEventCookieType XESetCopyEventCookie( + Display *dpy, /* display */ + int extension, /* extension major opcode */ + CopyEventCookieType proc /* routine to copy generic events */ + ) +{ + CopyEventCookieType oldproc; + if (proc == NULL) proc = (CopyEventCookieType)_XUnknownCopyEventCookie; + LockDisplay (dpy); + oldproc = dpy->generic_event_copy_vec[extension & 0x7F]; + dpy->generic_event_copy_vec[extension & 0x7F] = proc; + UnlockDisplay (dpy); + return (CopyEventCookieType)oldproc; +} + + +typedef Status (*EventToWireType) ( + Display* /* display */, + XEvent* /* re */, + xEvent* /* event */ +); + +EventToWireType XESetEventToWire( + Display *dpy, /* display */ + int event_number, /* event routine to replace */ + EventToWireType proc) /* routine to call when converting event */ +{ + register EventToWireType oldproc; + if (proc == NULL) proc = (EventToWireType) _XUnknownNativeEvent; + LockDisplay (dpy); + oldproc = dpy->wire_vec[event_number]; + dpy->wire_vec[event_number] = proc; + UnlockDisplay(dpy); + return (EventToWireType)oldproc; +} + +typedef Bool (*WireToErrorType) ( + Display* /* display */, + XErrorEvent* /* he */, + xError* /* we */ +); + +WireToErrorType XESetWireToError( + Display *dpy, /* display */ + int error_number, /* error routine to replace */ + WireToErrorType proc) /* routine to call when converting error */ +{ + register WireToErrorType oldproc = NULL; + if (proc == NULL) proc = (WireToErrorType)_XDefaultWireError; + LockDisplay (dpy); + if (!dpy->error_vec) { + int i; + dpy->error_vec = Xmalloc(256 * sizeof(oldproc)); + for (i = 1; i < 256; i++) + dpy->error_vec[i] = _XDefaultWireError; + } + if (dpy->error_vec) { + oldproc = dpy->error_vec[error_number]; + dpy->error_vec[error_number] = proc; + } + UnlockDisplay (dpy); + return (WireToErrorType)oldproc; +} + +ErrorType XESetError( + Display *dpy, /* display */ + int extension, /* extension number */ + ErrorType proc) /* routine to call when X error happens */ +{ + register _XExtension *e; /* for lookup of extension */ + register ErrorType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->error; + e->error = proc; + UnlockDisplay(dpy); + return (ErrorType)oldproc; +} + +ErrorStringType XESetErrorString( + Display *dpy, /* display */ + int extension, /* extension number */ + ErrorStringType proc) /* routine to call when I/O error happens */ +{ + register _XExtension *e; /* for lookup of extension */ + register ErrorStringType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->error_string; + e->error_string = proc; + UnlockDisplay(dpy); + return (ErrorStringType)oldproc; +} + +PrintErrorType XESetPrintErrorValues( + Display *dpy, /* display */ + int extension, /* extension number */ + PrintErrorType proc) /* routine to call to print */ +{ + register _XExtension *e; /* for lookup of extension */ + register PrintErrorType oldproc; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->error_values; + e->error_values = proc; + UnlockDisplay(dpy); + return (PrintErrorType)oldproc; +} + +BeforeFlushType XESetBeforeFlush( + Display *dpy, /* display */ + int extension, /* extension number */ + BeforeFlushType proc) /* routine to call on flush */ +{ + register _XExtension *e; /* for lookup of extension */ + register BeforeFlushType oldproc; + register _XExtension *ext; + if ((e = XLookupExtension (dpy, extension)) == NULL) return (NULL); + LockDisplay(dpy); + oldproc = e->before_flush; + e->before_flush = proc; + for (ext = dpy->flushes; ext && ext != e; ext = ext->next) + ; + if (!ext) { + e->next_flush = dpy->flushes; + dpy->flushes = e; + } + UnlockDisplay(dpy); + return (BeforeFlushType)oldproc; +} diff --git a/nx-X11/lib/src/InsCmap.c b/nx-X11/lib/src/InsCmap.c new file mode 100644 index 000000000..735ab080e --- /dev/null +++ b/nx-X11/lib/src/InsCmap.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XInstallColormap( + register Display *dpy, + Colormap cmap) +{ + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(InstallColormap, cmap, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/IntAtom.c b/nx-X11/lib/src/IntAtom.c new file mode 100644 index 000000000..3042b65dd --- /dev/null +++ b/nx-X11/lib/src/IntAtom.c @@ -0,0 +1,297 @@ +/* + +Copyright 1986, 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xintatom.h" + +#define HASH(sig) ((sig) & (TABLESIZE-1)) +#define REHASHVAL(sig) ((((sig) % (TABLESIZE-3)) + 2) | 1) +#define REHASH(idx,rehash) ((idx + rehash) & (TABLESIZE-1)) + +void +_XFreeAtomTable(Display *dpy) +{ + register Entry *table; + register int i; + register Entry e; + + if (dpy->atoms) { + table = dpy->atoms->table; + for (i = TABLESIZE; --i >= 0; ) { + if ((e = *table++) && (e != RESERVED)) + Xfree(e); + } + Xfree(dpy->atoms); + } +} + +static +Atom _XInternAtom( + Display *dpy, + _Xconst char *name, + Bool onlyIfExists, + unsigned long *psig, + int *pidx, + int *pn) +{ + register AtomTable *atoms; + register char *s1, c, *s2; + register unsigned long sig; + register int idx = 0, i; + Entry e; + int n, firstidx, rehash = 0; + xInternAtomReq *req; + + /* look in the cache first */ + if (!(atoms = dpy->atoms)) { + dpy->atoms = atoms = Xcalloc(1, sizeof(AtomTable)); + dpy->free_funcs->atoms = _XFreeAtomTable; + } + sig = 0; + for (s1 = (char *)name; (c = *s1++); ) + sig += c; + n = s1 - (char *)name - 1; + if (atoms) { + firstidx = idx = HASH(sig); + while ((e = atoms->table[idx])) { + if (e != RESERVED && e->sig == sig) { + for (i = n, s1 = (char *)name, s2 = EntryName(e); --i >= 0; ) { + if (*s1++ != *s2++) + goto nomatch; + } + if (!*s2) + return e->atom; + } +nomatch: if (idx == firstidx) + rehash = REHASHVAL(sig); + idx = REHASH(idx, rehash); + if (idx == firstidx) + break; + } + } + *psig = sig; + *pidx = idx; + if (atoms && !atoms->table[idx]) + atoms->table[idx] = RESERVED; /* reserve slot */ + *pn = n; + /* not found, go to the server */ + GetReq(InternAtom, req); + req->nbytes = n; + req->onlyIfExists = onlyIfExists; + req->length += (n+3)>>2; + Data(dpy, name, n); + return None; +} + +void +_XUpdateAtomCache( + Display *dpy, + const char *name, + Atom atom, + unsigned long sig, + int idx, + int n) +{ + Entry e, oe; + register char *s1; + register char c; + int firstidx, rehash; + + if (!dpy->atoms) { + if (idx < 0) { + dpy->atoms = Xcalloc(1, sizeof(AtomTable)); + dpy->free_funcs->atoms = _XFreeAtomTable; + } + if (!dpy->atoms) + return; + } + if (!sig) { + for (s1 = (char *)name; (c = *s1++); ) + sig += c; + n = s1 - (char *)name - 1; + if (idx < 0) { + firstidx = idx = HASH(sig); + if (dpy->atoms->table[idx]) { + rehash = REHASHVAL(sig); + do + idx = REHASH(idx, rehash); + while (idx != firstidx && dpy->atoms->table[idx]); + } + } + } + e = Xmalloc(sizeof(EntryRec) + n + 1); + if (e) { + e->sig = sig; + e->atom = atom; + strcpy(EntryName(e), name); + if ((oe = dpy->atoms->table[idx]) && (oe != RESERVED)) + Xfree(oe); + dpy->atoms->table[idx] = e; + } +} + +Atom +XInternAtom ( + Display *dpy, + const char *name, + Bool onlyIfExists) +{ + Atom atom; + unsigned long sig; + int idx, n; + xInternAtomReply rep; + + if (!name) + name = ""; + LockDisplay(dpy); + if ((atom = _XInternAtom(dpy, name, onlyIfExists, &sig, &idx, &n))) { + UnlockDisplay(dpy); + return atom; + } + if (dpy->atoms && dpy->atoms->table[idx] == RESERVED) + dpy->atoms->table[idx] = NULL; /* unreserve slot */ + if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { + if ((atom = rep.atom)) + _XUpdateAtomCache(dpy, name, atom, sig, idx, n); + } + UnlockDisplay(dpy); + SyncHandle(); + return (rep.atom); +} + +typedef struct { + unsigned long start_seq; + unsigned long stop_seq; + char **names; + Atom *atoms; + int count; + Status status; +} _XIntAtomState; + +static +Bool _XIntAtomHandler( + register Display *dpy, + register xReply *rep, + char *buf, + int len, + XPointer data) +{ + register _XIntAtomState *state; + register int i, idx = 0; + xInternAtomReply replbuf; + register xInternAtomReply *repl; + + state = (_XIntAtomState *)data; + if (dpy->last_request_read < state->start_seq || + dpy->last_request_read > state->stop_seq) + return False; + for (i = 0; i < state->count; i++) { + if (state->atoms[i] & 0x80000000) { + idx = ~state->atoms[i]; + state->atoms[i] = None; + break; + } + } + if (i >= state->count) + return False; + if (rep->generic.type == X_Error) { + state->status = 0; + return False; + } + repl = (xInternAtomReply *) + _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, + (SIZEOF(xInternAtomReply) - SIZEOF(xReply)) >> 2, + True); + if ((state->atoms[i] = repl->atom)) + _XUpdateAtomCache(dpy, state->names[i], (Atom) repl->atom, + (unsigned long)0, idx, 0); + return True; +} + +Status +XInternAtoms ( + Display *dpy, + char **names, + int count, + Bool onlyIfExists, + Atom *atoms_return) +{ + int i, idx, n, tidx; + unsigned long sig; + _XAsyncHandler async; + _XIntAtomState async_state; + int missed = -1; + xInternAtomReply rep; + + LockDisplay(dpy); + async_state.start_seq = dpy->request + 1; + async_state.atoms = atoms_return; + async_state.names = names; + async_state.count = count - 1; + async_state.status = 1; + async.next = dpy->async_handlers; + async.handler = _XIntAtomHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + for (i = 0; i < count; i++) { + if (!(atoms_return[i] = _XInternAtom(dpy, names[i], onlyIfExists, + &sig, &idx, &n))) { + missed = i; + atoms_return[i] = ~((Atom)idx); + async_state.stop_seq = dpy->request; + } + } + if (missed >= 0) { + if (dpy->atoms) { + /* unreserve anything we just reserved */ + for (i = 0; i < count; i++) { + if (atoms_return[i] & 0x80000000) { + tidx = ~atoms_return[i]; + if (dpy->atoms->table[tidx] == RESERVED) + dpy->atoms->table[tidx] = NULL; + } + } + } + if (_XReply (dpy, (xReply *)&rep, 0, xTrue)) { + if ((atoms_return[missed] = rep.atom)) + _XUpdateAtomCache(dpy, names[missed], (Atom) rep.atom, + sig, idx, n); + } else { + atoms_return[missed] = None; + async_state.status = 0; + } + } + DeqAsyncHandler(dpy, &async); + UnlockDisplay(dpy); + if (missed >= 0) + SyncHandle(); + return async_state.status; +} diff --git a/nx-X11/lib/src/Key.h b/nx-X11/lib/src/Key.h new file mode 100644 index 000000000..3a1639c5c --- /dev/null +++ b/nx-X11/lib/src/Key.h @@ -0,0 +1,20 @@ + +#ifndef _KEY_H_ +#define _KEY_H_ + +#include +#include + +#ifndef NEEDKTABLE +extern const unsigned char _XkeyTable[]; +#endif + +extern int +_XKeyInitialize( + Display *dpy); + +extern XrmDatabase +_XInitKeysymDB( + void); + +#endif /* _KEY_H_ */ diff --git a/nx-X11/lib/src/KeyBind.c b/nx-X11/lib/src/KeyBind.c new file mode 100644 index 000000000..acaf7fd8f --- /dev/null +++ b/nx-X11/lib/src/KeyBind.c @@ -0,0 +1,1005 @@ +/* + +Copyright 1985, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* Beware, here be monsters (still under construction... - JG */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#define XK_MISCELLANY +#define XK_LATIN1 +#define XK_LATIN2 +#define XK_LATIN3 +#define XK_LATIN4 +#define XK_LATIN8 +#define XK_LATIN9 +#define XK_CYRILLIC +#define XK_GREEK +#define XK_ARMENIAN +#define XK_CAUCASUS +#define XK_VIETNAMESE +#define XK_XKB_KEYS +#define XK_SINHALA +#include +#include + +#include "Xresource.h" +#include "Key.h" + +#ifdef XKB +#include "XKBlib.h" +#include "XKBlibint.h" +#define XKeycodeToKeysym _XKeycodeToKeysym +#define XKeysymToKeycode _XKeysymToKeycode +#define XLookupKeysym _XLookupKeysym +#define XRefreshKeyboardMapping _XRefreshKeyboardMapping +#define XLookupString _XLookupString +/* XKBBind.c */ +#else +#define XkbKeysymToModifiers _XKeysymToModifiers +#endif + +#define AllMods (ShiftMask|LockMask|ControlMask| \ + Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) + +static void +ComputeMaskFromKeytrans( + Display *dpy, + register struct _XKeytrans *p); + +struct _XKeytrans { + struct _XKeytrans *next;/* next on list */ + char *string; /* string to return when the time comes */ + int len; /* length of string (since NULL is legit)*/ + KeySym key; /* keysym rebound */ + unsigned int state; /* modifier state */ + KeySym *modifiers; /* modifier keysyms you want */ + int mlen; /* length of modifier list */ +}; + +static KeySym +KeyCodetoKeySym(register Display *dpy, KeyCode keycode, int col) +{ + register int per = dpy->keysyms_per_keycode; + register KeySym *syms; + KeySym lsym, usym; + + if ((col < 0) || ((col >= per) && (col > 3)) || + ((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) + return NoSymbol; + + syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; + if (col < 4) { + if (col > 1) { + while ((per > 2) && (syms[per - 1] == NoSymbol)) + per--; + if (per < 3) + col -= 2; + } + if ((per <= (col|1)) || (syms[col|1] == NoSymbol)) { + XConvertCase(syms[col&~1], &lsym, &usym); + if (!(col & 1)) + return lsym; + else if (usym == lsym) + return NoSymbol; + else + return usym; + } + } + return syms[col]; +} + +KeySym +XKeycodeToKeysym(Display *dpy, +#if NeedWidePrototypes + unsigned int kc, +#else + KeyCode kc, +#endif + int col) +{ + if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) + return NoSymbol; + return KeyCodetoKeySym(dpy, kc, col); +} + +KeyCode +XKeysymToKeycode( + Display *dpy, + KeySym ks) +{ + register int i, j; + + if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) + return (KeyCode) 0; + for (j = 0; j < dpy->keysyms_per_keycode; j++) { + for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) { + if (KeyCodetoKeySym(dpy, (KeyCode) i, j) == ks) + return i; + } + } + return 0; +} + +KeySym +XLookupKeysym( + register XKeyEvent *event, + int col) +{ + if ((! event->display->keysyms) && (! _XKeyInitialize(event->display))) + return NoSymbol; + return KeyCodetoKeySym(event->display, event->keycode, col); +} + +static void +ResetModMap( + Display *dpy) +{ + register XModifierKeymap *map; + register int i, j, n; + KeySym sym; + register struct _XKeytrans *p; + + map = dpy->modifiermap; + /* If any Lock key contains Caps_Lock, then interpret as Caps_Lock, + * else if any contains Shift_Lock, then interpret as Shift_Lock, + * else ignore Lock altogether. + */ + dpy->lock_meaning = NoSymbol; + /* Lock modifiers are in the second row of the matrix */ + n = 2 * map->max_keypermod; + for (i = map->max_keypermod; i < n; i++) { + for (j = 0; j < dpy->keysyms_per_keycode; j++) { + sym = KeyCodetoKeySym(dpy, map->modifiermap[i], j); + if (sym == XK_Caps_Lock) { + dpy->lock_meaning = XK_Caps_Lock; + break; + } else if (sym == XK_Shift_Lock) { + dpy->lock_meaning = XK_Shift_Lock; + } + else if (sym == XK_ISO_Lock) { + dpy->lock_meaning = XK_Caps_Lock; + break; + } + } + } + /* Now find any Mod modifier acting as the Group or Numlock modifier */ + dpy->mode_switch = 0; + dpy->num_lock = 0; + n *= 4; + for (i = 3*map->max_keypermod; i < n; i++) { + for (j = 0; j < dpy->keysyms_per_keycode; j++) { + sym = KeyCodetoKeySym(dpy, map->modifiermap[i], j); + if (sym == XK_Mode_switch) + dpy->mode_switch |= 1 << (i / map->max_keypermod); + if (sym == XK_Num_Lock) + dpy->num_lock |= 1 << (i / map->max_keypermod); + } + } + for (p = dpy->key_bindings; p; p = p->next) + ComputeMaskFromKeytrans(dpy, p); +} + +static int +InitModMap( + Display *dpy) +{ + register XModifierKeymap *map; + + if (! (map = XGetModifierMapping(dpy))) + return 0; + LockDisplay(dpy); + if (dpy->modifiermap) + XFreeModifiermap(dpy->modifiermap); + dpy->modifiermap = map; + dpy->free_funcs->modifiermap = XFreeModifiermap; + if (dpy->keysyms) + ResetModMap(dpy); + UnlockDisplay(dpy); + return 1; +} + +int +XRefreshKeyboardMapping(register XMappingEvent *event) +{ + + if(event->request == MappingKeyboard) { + /* XXX should really only refresh what is necessary + * for now, make initialize test fail + */ + LockDisplay(event->display); + if (event->display->keysyms) { + Xfree (event->display->keysyms); + event->display->keysyms = NULL; + } + UnlockDisplay(event->display); + } + if(event->request == MappingModifier) { + LockDisplay(event->display); + if (event->display->modifiermap) { + XFreeModifiermap(event->display->modifiermap); + event->display->modifiermap = NULL; + } + UnlockDisplay(event->display); + /* go ahead and get it now, since initialize test may not fail */ + if (event->display->keysyms) + (void) InitModMap(event->display); + } + return 1; +} + +int +_XKeyInitialize( + Display *dpy) +{ + int per, n; + KeySym *keysyms; + + /* + * lets go get the keysyms from the server. + */ + if (!dpy->keysyms) { + n = dpy->max_keycode - dpy->min_keycode + 1; + keysyms = XGetKeyboardMapping (dpy, (KeyCode) dpy->min_keycode, + n, &per); + /* keysyms may be NULL */ + if (! keysyms) return 0; + + LockDisplay(dpy); + + Xfree (dpy->keysyms); + dpy->keysyms = keysyms; + dpy->keysyms_per_keycode = per; + if (dpy->modifiermap) + ResetModMap(dpy); + + UnlockDisplay(dpy); + } + if (!dpy->modifiermap) + return InitModMap(dpy); + return 1; +} + +static void +UCSConvertCase( register unsigned code, + KeySym *lower, + KeySym *upper ) +{ + /* Case conversion for UCS, as in Unicode Data version 4.0.0 */ + /* NB: Only converts simple one-to-one mappings. */ + + /* Tables are used where they take less space than */ + /* the code to work out the mappings. Zero values mean */ + /* undefined code points. */ + + static unsigned short const IPAExt_upper_mapping[] = { /* part only */ + 0x0181, 0x0186, 0x0255, 0x0189, 0x018A, + 0x0258, 0x018F, 0x025A, 0x0190, 0x025C, 0x025D, 0x025E, 0x025F, + 0x0193, 0x0261, 0x0262, 0x0194, 0x0264, 0x0265, 0x0266, 0x0267, + 0x0197, 0x0196, 0x026A, 0x026B, 0x026C, 0x026D, 0x026E, 0x019C, + 0x0270, 0x0271, 0x019D, 0x0273, 0x0274, 0x019F, 0x0276, 0x0277, + 0x0278, 0x0279, 0x027A, 0x027B, 0x027C, 0x027D, 0x027E, 0x027F, + 0x01A6, 0x0281, 0x0282, 0x01A9, 0x0284, 0x0285, 0x0286, 0x0287, + 0x01AE, 0x0289, 0x01B1, 0x01B2, 0x028C, 0x028D, 0x028E, 0x028F, + 0x0290, 0x0291, 0x01B7 + }; + + static unsigned short const LatinExtB_upper_mapping[] = { /* first part only */ + 0x0180, 0x0181, 0x0182, 0x0182, 0x0184, 0x0184, 0x0186, 0x0187, + 0x0187, 0x0189, 0x018A, 0x018B, 0x018B, 0x018D, 0x018E, 0x018F, + 0x0190, 0x0191, 0x0191, 0x0193, 0x0194, 0x01F6, 0x0196, 0x0197, + 0x0198, 0x0198, 0x019A, 0x019B, 0x019C, 0x019D, 0x0220, 0x019F, + 0x01A0, 0x01A0, 0x01A2, 0x01A2, 0x01A4, 0x01A4, 0x01A6, 0x01A7, + 0x01A7, 0x01A9, 0x01AA, 0x01AB, 0x01AC, 0x01AC, 0x01AE, 0x01AF, + 0x01AF, 0x01B1, 0x01B2, 0x01B3, 0x01B3, 0x01B5, 0x01B5, 0x01B7, + 0x01B8, 0x01B8, 0x01BA, 0x01BB, 0x01BC, 0x01BC, 0x01BE, 0x01F7, + 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C4, 0x01C4, 0x01C4, 0x01C7, + 0x01C7, 0x01C7, 0x01CA, 0x01CA, 0x01CA + }; + + static unsigned short const LatinExtB_lower_mapping[] = { /* first part only */ + 0x0180, 0x0253, 0x0183, 0x0183, 0x0185, 0x0185, 0x0254, 0x0188, + 0x0188, 0x0256, 0x0257, 0x018C, 0x018C, 0x018D, 0x01DD, 0x0259, + 0x025B, 0x0192, 0x0192, 0x0260, 0x0263, 0x0195, 0x0269, 0x0268, + 0x0199, 0x0199, 0x019A, 0x019B, 0x026F, 0x0272, 0x019E, 0x0275, + 0x01A1, 0x01A1, 0x01A3, 0x01A3, 0x01A5, 0x01A5, 0x0280, 0x01A8, + 0x01A8, 0x0283, 0x01AA, 0x01AB, 0x01AD, 0x01AD, 0x0288, 0x01B0, + 0x01B0, 0x028A, 0x028B, 0x01B4, 0x01B4, 0x01B6, 0x01B6, 0x0292, + 0x01B9, 0x01B9, 0x01BA, 0x01BB, 0x01BD, 0x01BD, 0x01BE, 0x01BF, + 0x01C0, 0x01C1, 0x01C2, 0x01C3, 0x01C6, 0x01C6, 0x01C6, 0x01C9, + 0x01C9, 0x01C9, 0x01CC, 0x01CC, 0x01CC + }; + + static unsigned short const Greek_upper_mapping[] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, + 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x0386, 0x0387, + 0x0388, 0x0389, 0x038A, 0x0000, 0x038C, 0x0000, 0x038E, 0x038F, + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x0000, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x0386, 0x0388, 0x0389, 0x038A, + 0x03B0, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039A, 0x039B, 0x039C, 0x039D, 0x039E, 0x039F, + 0x03A0, 0x03A1, 0x03A3, 0x03A3, 0x03A4, 0x03A5, 0x03A6, 0x03A7, + 0x03A8, 0x03A9, 0x03AA, 0x03AB, 0x038C, 0x038E, 0x038F, 0x0000, + 0x0392, 0x0398, 0x03D2, 0x03D3, 0x03D4, 0x03A6, 0x03A0, 0x03D7, + 0x03D8, 0x03D8, 0x03DA, 0x03DA, 0x03DC, 0x03DC, 0x03DE, 0x03DE, + 0x03E0, 0x03E0, 0x03E2, 0x03E2, 0x03E4, 0x03E4, 0x03E6, 0x03E6, + 0x03E8, 0x03E8, 0x03EA, 0x03EA, 0x03EC, 0x03EC, 0x03EE, 0x03EE, + 0x039A, 0x03A1, 0x03F9, 0x03F3, 0x03F4, 0x0395, 0x03F6, 0x03F7, + 0x03F7, 0x03F9, 0x03FA, 0x03FA, 0x0000, 0x0000, 0x0000, 0x0000 + }; + + static unsigned short const Greek_lower_mapping[] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0374, 0x0375, 0x0000, 0x0000, + 0x0000, 0x0000, 0x037A, 0x0000, 0x0000, 0x0000, 0x037E, 0x0000, + 0x0000, 0x0000, 0x0000, 0x0000, 0x0384, 0x0385, 0x03AC, 0x0387, + 0x03AD, 0x03AE, 0x03AF, 0x0000, 0x03CC, 0x0000, 0x03CD, 0x03CE, + 0x0390, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x0000, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03AC, 0x03AD, 0x03AE, 0x03AF, + 0x03B0, 0x03B1, 0x03B2, 0x03B3, 0x03B4, 0x03B5, 0x03B6, 0x03B7, + 0x03B8, 0x03B9, 0x03BA, 0x03BB, 0x03BC, 0x03BD, 0x03BE, 0x03BF, + 0x03C0, 0x03C1, 0x03C2, 0x03C3, 0x03C4, 0x03C5, 0x03C6, 0x03C7, + 0x03C8, 0x03C9, 0x03CA, 0x03CB, 0x03CC, 0x03CD, 0x03CE, 0x0000, + 0x03D0, 0x03D1, 0x03D2, 0x03D3, 0x03D4, 0x03D5, 0x03D6, 0x03D7, + 0x03D9, 0x03D9, 0x03DB, 0x03DB, 0x03DD, 0x03DD, 0x03DF, 0x03DF, + 0x03E1, 0x03E1, 0x03E3, 0x03E3, 0x03E5, 0x03E5, 0x03E7, 0x03E7, + 0x03E9, 0x03E9, 0x03EB, 0x03EB, 0x03ED, 0x03ED, 0x03EF, 0x03EF, + 0x03F0, 0x03F1, 0x03F2, 0x03F3, 0x03B8, 0x03F5, 0x03F6, 0x03F8, + 0x03F8, 0x03F2, 0x03FB, 0x03FB, 0x0000, 0x0000, 0x0000, 0x0000 + }; + + static unsigned short const GreekExt_lower_mapping[] = { + 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, + 0x1F00, 0x1F01, 0x1F02, 0x1F03, 0x1F04, 0x1F05, 0x1F06, 0x1F07, + 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, + 0x1F10, 0x1F11, 0x1F12, 0x1F13, 0x1F14, 0x1F15, 0x0000, 0x0000, + 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, + 0x1F20, 0x1F21, 0x1F22, 0x1F23, 0x1F24, 0x1F25, 0x1F26, 0x1F27, + 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, + 0x1F30, 0x1F31, 0x1F32, 0x1F33, 0x1F34, 0x1F35, 0x1F36, 0x1F37, + 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, + 0x1F40, 0x1F41, 0x1F42, 0x1F43, 0x1F44, 0x1F45, 0x0000, 0x0000, + 0x1F50, 0x1F51, 0x1F52, 0x1F53, 0x1F54, 0x1F55, 0x1F56, 0x1F57, + 0x0000, 0x1F51, 0x0000, 0x1F53, 0x0000, 0x1F55, 0x0000, 0x1F57, + 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, + 0x1F60, 0x1F61, 0x1F62, 0x1F63, 0x1F64, 0x1F65, 0x1F66, 0x1F67, + 0x1F70, 0x1F71, 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1F76, 0x1F77, + 0x1F78, 0x1F79, 0x1F7A, 0x1F7B, 0x1F7C, 0x1F7D, 0x0000, 0x0000, + 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, + 0x1F80, 0x1F81, 0x1F82, 0x1F83, 0x1F84, 0x1F85, 0x1F86, 0x1F87, + 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, + 0x1F90, 0x1F91, 0x1F92, 0x1F93, 0x1F94, 0x1F95, 0x1F96, 0x1F97, + 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, + 0x1FA0, 0x1FA1, 0x1FA2, 0x1FA3, 0x1FA4, 0x1FA5, 0x1FA6, 0x1FA7, + 0x1FB0, 0x1FB1, 0x1FB2, 0x1FB3, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, + 0x1FB0, 0x1FB1, 0x1F70, 0x1F71, 0x1FB3, 0x1FBD, 0x1FBE, 0x1FBF, + 0x1FC0, 0x1FC1, 0x1FC2, 0x1FC3, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, + 0x1F72, 0x1F73, 0x1F74, 0x1F75, 0x1FC3, 0x1FCD, 0x1FCE, 0x1FCF, + 0x1FD0, 0x1FD1, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, + 0x1FD0, 0x1FD1, 0x1F76, 0x1F77, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, + 0x1FE0, 0x1FE1, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FE5, 0x1FE6, 0x1FE7, + 0x1FE0, 0x1FE1, 0x1F7A, 0x1F7B, 0x1FE5, 0x1FED, 0x1FEE, 0x1FEF, + 0x0000, 0x0000, 0x1FF2, 0x1FF3, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, + 0x1F78, 0x1F79, 0x1F7C, 0x1F7D, 0x1FF3, 0x1FFD, 0x1FFE, 0x0000 + }; + + static unsigned short const GreekExt_upper_mapping[] = { + 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, + 0x1F08, 0x1F09, 0x1F0A, 0x1F0B, 0x1F0C, 0x1F0D, 0x1F0E, 0x1F0F, + 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, + 0x1F18, 0x1F19, 0x1F1A, 0x1F1B, 0x1F1C, 0x1F1D, 0x0000, 0x0000, + 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, + 0x1F28, 0x1F29, 0x1F2A, 0x1F2B, 0x1F2C, 0x1F2D, 0x1F2E, 0x1F2F, + 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, + 0x1F38, 0x1F39, 0x1F3A, 0x1F3B, 0x1F3C, 0x1F3D, 0x1F3E, 0x1F3F, + 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, + 0x1F48, 0x1F49, 0x1F4A, 0x1F4B, 0x1F4C, 0x1F4D, 0x0000, 0x0000, + 0x1F50, 0x1F59, 0x1F52, 0x1F5B, 0x1F54, 0x1F5D, 0x1F56, 0x1F5F, + 0x0000, 0x1F59, 0x0000, 0x1F5B, 0x0000, 0x1F5D, 0x0000, 0x1F5F, + 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, + 0x1F68, 0x1F69, 0x1F6A, 0x1F6B, 0x1F6C, 0x1F6D, 0x1F6E, 0x1F6F, + 0x1FBA, 0x1FBB, 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FDA, 0x1FDB, + 0x1FF8, 0x1FF9, 0x1FEA, 0x1FEB, 0x1FFA, 0x1FFB, 0x0000, 0x0000, + 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, + 0x1F88, 0x1F89, 0x1F8A, 0x1F8B, 0x1F8C, 0x1F8D, 0x1F8E, 0x1F8F, + 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, + 0x1F98, 0x1F99, 0x1F9A, 0x1F9B, 0x1F9C, 0x1F9D, 0x1F9E, 0x1F9F, + 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, + 0x1FA8, 0x1FA9, 0x1FAA, 0x1FAB, 0x1FAC, 0x1FAD, 0x1FAE, 0x1FAF, + 0x1FB8, 0x1FB9, 0x1FB2, 0x1FBC, 0x1FB4, 0x0000, 0x1FB6, 0x1FB7, + 0x1FB8, 0x1FB9, 0x1FBA, 0x1FBB, 0x1FBC, 0x1FBD, 0x0399, 0x1FBF, + 0x1FC0, 0x1FC1, 0x1FC2, 0x1FCC, 0x1FC4, 0x0000, 0x1FC6, 0x1FC7, + 0x1FC8, 0x1FC9, 0x1FCA, 0x1FCB, 0x1FCC, 0x1FCD, 0x1FCE, 0x1FCF, + 0x1FD8, 0x1FD9, 0x1FD2, 0x1FD3, 0x0000, 0x0000, 0x1FD6, 0x1FD7, + 0x1FD8, 0x1FD9, 0x1FDA, 0x1FDB, 0x0000, 0x1FDD, 0x1FDE, 0x1FDF, + 0x1FE8, 0x1FE9, 0x1FE2, 0x1FE3, 0x1FE4, 0x1FEC, 0x1FE6, 0x1FE7, + 0x1FE8, 0x1FE9, 0x1FEA, 0x1FEB, 0x1FEC, 0x1FED, 0x1FEE, 0x1FEF, + 0x0000, 0x0000, 0x1FF2, 0x1FFC, 0x1FF4, 0x0000, 0x1FF6, 0x1FF7, + 0x1FF8, 0x1FF9, 0x1FFA, 0x1FFB, 0x1FFC, 0x1FFD, 0x1FFE, 0x0000 + }; + + *lower = code; + *upper = code; + + /* Basic Latin and Latin-1 Supplement, U+0000 to U+00FF */ + if (code <= 0x00ff) { + if (code >= 0x0041 && code <= 0x005a) /* A-Z */ + *lower += 0x20; + else if (code >= 0x0061 && code <= 0x007a) /* a-z */ + *upper -= 0x20; + else if ( (code >= 0x00c0 && code <= 0x00d6) || + (code >= 0x00d8 && code <= 0x00de) ) + *lower += 0x20; + else if ( (code >= 0x00e0 && code <= 0x00f6) || + (code >= 0x00f8 && code <= 0x00fe) ) + *upper -= 0x20; + else if (code == 0x00ff) /* y with diaeresis */ + *upper = 0x0178; + else if (code == 0x00b5) /* micro sign */ + *upper = 0x039c; + return; + } + + /* Latin Extended-A, U+0100 to U+017F */ + if (code >= 0x0100 && code <= 0x017f) { + if ( (code >= 0x0100 && code <= 0x012f) || + (code >= 0x0132 && code <= 0x0137) || + (code >= 0x014a && code <= 0x0177) ) { + *upper = code & ~1; + *lower = code | 1; + } + else if ( (code >= 0x0139 && code <= 0x0148) || + (code >= 0x0179 && code <= 0x017e) ) { + if (code & 1) + *lower += 1; + else + *upper -= 1; + } + else if (code == 0x0130) + *lower = 0x0069; + else if (code == 0x0131) + *upper = 0x0049; + else if (code == 0x0178) + *lower = 0x00ff; + else if (code == 0x017f) + *upper = 0x0053; + return; + } + + /* Latin Extended-B, U+0180 to U+024F */ + if (code >= 0x0180 && code <= 0x024f) { + if (code >= 0x01cd && code <= 0x01dc) { + if (code & 1) + *lower += 1; + else + *upper -= 1; + } + else if ( (code >= 0x01de && code <= 0x01ef) || + (code >= 0x01f4 && code <= 0x01f5) || + (code >= 0x01f8 && code <= 0x021f) || + (code >= 0x0222 && code <= 0x0233) ) { + *lower |= 1; + *upper &= ~1; + } + else if (code >= 0x0180 && code <= 0x01cc) { + *lower = LatinExtB_lower_mapping[code - 0x0180]; + *upper = LatinExtB_upper_mapping[code - 0x0180]; + } + else if (code == 0x01dd) + *upper = 0x018e; + else if (code == 0x01f1 || code == 0x01f2) { + *lower = 0x01f3; + *upper = 0x01f1; + } + else if (code == 0x01f3) + *upper = 0x01f1; + else if (code == 0x01f6) + *lower = 0x0195; + else if (code == 0x01f7) + *lower = 0x01bf; + else if (code == 0x0220) + *lower = 0x019e; + return; + } + + /* IPA Extensions, U+0250 to U+02AF */ + if (code >= 0x0253 && code <= 0x0292) { + *upper = IPAExt_upper_mapping[code - 0x0253]; + } + + /* Combining Diacritical Marks, U+0300 to U+036F */ + if (code == 0x0345) { + *upper = 0x0399; + } + + /* Greek and Coptic, U+0370 to U+03FF */ + if (code >= 0x0370 && code <= 0x03ff) { + *lower = Greek_lower_mapping[code - 0x0370]; + *upper = Greek_upper_mapping[code - 0x0370]; + if (*upper == 0) + *upper = code; + if (*lower == 0) + *lower = code; + } + + /* Cyrillic and Cyrillic Supplementary, U+0400 to U+052F */ + if ( (code >= 0x0400 && code <= 0x04ff) || + (code >= 0x0500 && code <= 0x052f) ) { + if (code >= 0x0400 && code <= 0x040f) + *lower += 0x50; + else if (code >= 0x0410 && code <= 0x042f) + *lower += 0x20; + else if (code >= 0x0430 && code <= 0x044f) + *upper -= 0x20; + else if (code >= 0x0450 && code <= 0x045f) + *upper -= 0x50; + else if ( (code >= 0x0460 && code <= 0x0481) || + (code >= 0x048a && code <= 0x04bf) || + (code >= 0x04d0 && code <= 0x04f5) || + (code >= 0x04f8 && code <= 0x04f9) || + (code >= 0x0500 && code <= 0x050f) ) { + *upper &= ~1; + *lower |= 1; + } + else if (code >= 0x04c1 && code <= 0x04ce) { + if (code & 1) + *lower += 1; + else + *upper -= 1; + } + } + + /* Armenian, U+0530 to U+058F */ + if (code >= 0x0530 && code <= 0x058f) { + if (code >= 0x0531 && code <= 0x0556) + *lower += 0x30; + else if (code >=0x0561 && code <= 0x0586) + *upper -= 0x30; + } + + /* Latin Extended Additional, U+1E00 to U+1EFF */ + if (code >= 0x1e00 && code <= 0x1eff) { + if ( (code >= 0x1e00 && code <= 0x1e95) || + (code >= 0x1ea0 && code <= 0x1ef9) ) { + *upper &= ~1; + *lower |= 1; + } + else if (code == 0x1e9b) + *upper = 0x1e60; + } + + /* Greek Extended, U+1F00 to U+1FFF */ + if (code >= 0x1f00 && code <= 0x1fff) { + *lower = GreekExt_lower_mapping[code - 0x1f00]; + *upper = GreekExt_upper_mapping[code - 0x1f00]; + if (*upper == 0) + *upper = code; + if (*lower == 0) + *lower = code; + } + + /* Letterlike Symbols, U+2100 to U+214F */ + if (code >= 0x2100 && code <= 0x214f) { + switch (code) { + case 0x2126: *lower = 0x03c9; break; + case 0x212a: *lower = 0x006b; break; + case 0x212b: *lower = 0x00e5; break; + } + } + /* Number Forms, U+2150 to U+218F */ + else if (code >= 0x2160 && code <= 0x216f) + *lower += 0x10; + else if (code >= 0x2170 && code <= 0x217f) + *upper -= 0x10; + /* Enclosed Alphanumerics, U+2460 to U+24FF */ + else if (code >= 0x24b6 && code <= 0x24cf) + *lower += 0x1a; + else if (code >= 0x24d0 && code <= 0x24e9) + *upper -= 0x1a; + /* Halfwidth and Fullwidth Forms, U+FF00 to U+FFEF */ + else if (code >= 0xff21 && code <= 0xff3a) + *lower += 0x20; + else if (code >= 0xff41 && code <= 0xff5a) + *upper -= 0x20; + /* Deseret, U+10400 to U+104FF */ + else if (code >= 0x10400 && code <= 0x10427) + *lower += 0x28; + else if (code >= 0x10428 && code <= 0x1044f) + *upper -= 0x28; +} + +void +XConvertCase( + register KeySym sym, + KeySym *lower, + KeySym *upper) +{ + /* Latin 1 keysym */ + if (sym < 0x100) { + UCSConvertCase(sym, lower, upper); + return; + } + + /* Unicode keysym */ + if ((sym & 0xff000000) == 0x01000000) { + UCSConvertCase((sym & 0x00ffffff), lower, upper); + *upper |= 0x01000000; + *lower |= 0x01000000; + return; + } + + /* Legacy keysym */ + + *lower = sym; + *upper = sym; + + switch(sym >> 8) { + case 1: /* Latin 2 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym == XK_Aogonek) + *lower = XK_aogonek; + else if (sym >= XK_Lstroke && sym <= XK_Sacute) + *lower += (XK_lstroke - XK_Lstroke); + else if (sym >= XK_Scaron && sym <= XK_Zacute) + *lower += (XK_scaron - XK_Scaron); + else if (sym >= XK_Zcaron && sym <= XK_Zabovedot) + *lower += (XK_zcaron - XK_Zcaron); + else if (sym == XK_aogonek) + *upper = XK_Aogonek; + else if (sym >= XK_lstroke && sym <= XK_sacute) + *upper -= (XK_lstroke - XK_Lstroke); + else if (sym >= XK_scaron && sym <= XK_zacute) + *upper -= (XK_scaron - XK_Scaron); + else if (sym >= XK_zcaron && sym <= XK_zabovedot) + *upper -= (XK_zcaron - XK_Zcaron); + else if (sym >= XK_Racute && sym <= XK_Tcedilla) + *lower += (XK_racute - XK_Racute); + else if (sym >= XK_racute && sym <= XK_tcedilla) + *upper -= (XK_racute - XK_Racute); + break; + case 2: /* Latin 3 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Hstroke && sym <= XK_Hcircumflex) + *lower += (XK_hstroke - XK_Hstroke); + else if (sym >= XK_Gbreve && sym <= XK_Jcircumflex) + *lower += (XK_gbreve - XK_Gbreve); + else if (sym >= XK_hstroke && sym <= XK_hcircumflex) + *upper -= (XK_hstroke - XK_Hstroke); + else if (sym >= XK_gbreve && sym <= XK_jcircumflex) + *upper -= (XK_gbreve - XK_Gbreve); + else if (sym >= XK_Cabovedot && sym <= XK_Scircumflex) + *lower += (XK_cabovedot - XK_Cabovedot); + else if (sym >= XK_cabovedot && sym <= XK_scircumflex) + *upper -= (XK_cabovedot - XK_Cabovedot); + break; + case 3: /* Latin 4 */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Rcedilla && sym <= XK_Tslash) + *lower += (XK_rcedilla - XK_Rcedilla); + else if (sym >= XK_rcedilla && sym <= XK_tslash) + *upper -= (XK_rcedilla - XK_Rcedilla); + else if (sym == XK_ENG) + *lower = XK_eng; + else if (sym == XK_eng) + *upper = XK_ENG; + else if (sym >= XK_Amacron && sym <= XK_Umacron) + *lower += (XK_amacron - XK_Amacron); + else if (sym >= XK_amacron && sym <= XK_umacron) + *upper -= (XK_amacron - XK_Amacron); + break; + case 6: /* Cyrillic */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Serbian_DJE && sym <= XK_Serbian_DZE) + *lower -= (XK_Serbian_DJE - XK_Serbian_dje); + else if (sym >= XK_Serbian_dje && sym <= XK_Serbian_dze) + *upper += (XK_Serbian_DJE - XK_Serbian_dje); + else if (sym >= XK_Cyrillic_YU && sym <= XK_Cyrillic_HARDSIGN) + *lower -= (XK_Cyrillic_YU - XK_Cyrillic_yu); + else if (sym >= XK_Cyrillic_yu && sym <= XK_Cyrillic_hardsign) + *upper += (XK_Cyrillic_YU - XK_Cyrillic_yu); + break; + case 7: /* Greek */ + /* Assume the KeySym is a legal value (ignore discontinuities) */ + if (sym >= XK_Greek_ALPHAaccent && sym <= XK_Greek_OMEGAaccent) + *lower += (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); + else if (sym >= XK_Greek_alphaaccent && sym <= XK_Greek_omegaaccent && + sym != XK_Greek_iotaaccentdieresis && + sym != XK_Greek_upsilonaccentdieresis) + *upper -= (XK_Greek_alphaaccent - XK_Greek_ALPHAaccent); + else if (sym >= XK_Greek_ALPHA && sym <= XK_Greek_OMEGA) + *lower += (XK_Greek_alpha - XK_Greek_ALPHA); + else if (sym >= XK_Greek_alpha && sym <= XK_Greek_omega && + sym != XK_Greek_finalsmallsigma) + *upper -= (XK_Greek_alpha - XK_Greek_ALPHA); + break; + case 0x13: /* Latin 9 */ + if (sym == XK_OE) + *lower = XK_oe; + else if (sym == XK_oe) + *upper = XK_OE; + else if (sym == XK_Ydiaeresis) + *lower = XK_ydiaeresis; + break; + } +} + +int +_XTranslateKey( register Display *dpy, + KeyCode keycode, + register unsigned int modifiers, + unsigned int *modifiers_return, + KeySym *keysym_return) +{ + int per; + register KeySym *syms; + KeySym sym, lsym, usym; + + if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) + return 0; + *modifiers_return = ((ShiftMask|LockMask) + | dpy->mode_switch | dpy->num_lock); + if (((int)keycode < dpy->min_keycode) || ((int)keycode > dpy->max_keycode)) + { + *keysym_return = NoSymbol; + return 1; + } + per = dpy->keysyms_per_keycode; + syms = &dpy->keysyms[(keycode - dpy->min_keycode) * per]; + while ((per > 2) && (syms[per - 1] == NoSymbol)) + per--; + if ((per > 2) && (modifiers & dpy->mode_switch)) { + syms += 2; + per -= 2; + } + if ((modifiers & dpy->num_lock) && + (per > 1 && (IsKeypadKey(syms[1]) || IsPrivateKeypadKey(syms[1])))) { + if ((modifiers & ShiftMask) || + ((modifiers & LockMask) && (dpy->lock_meaning == XK_Shift_Lock))) + *keysym_return = syms[0]; + else + *keysym_return = syms[1]; + } else if (!(modifiers & ShiftMask) && + (!(modifiers & LockMask) || (dpy->lock_meaning == NoSymbol))) { + if ((per == 1) || (syms[1] == NoSymbol)) + XConvertCase(syms[0], keysym_return, &usym); + else + *keysym_return = syms[0]; + } else if (!(modifiers & LockMask) || + (dpy->lock_meaning != XK_Caps_Lock)) { + if ((per == 1) || ((usym = syms[1]) == NoSymbol)) + XConvertCase(syms[0], &lsym, &usym); + *keysym_return = usym; + } else { + if ((per == 1) || ((sym = syms[1]) == NoSymbol)) + sym = syms[0]; + XConvertCase(sym, &lsym, &usym); + if (!(modifiers & ShiftMask) && (sym != syms[0]) && + ((sym != usym) || (lsym == usym))) + XConvertCase(syms[0], &lsym, &usym); + *keysym_return = usym; + } + if (*keysym_return == XK_VoidSymbol) + *keysym_return = NoSymbol; + return 1; +} + +int +_XTranslateKeySym( + Display *dpy, + register KeySym symbol, + unsigned int modifiers, + char *buffer, + int nbytes) +{ + register struct _XKeytrans *p; + int length; + unsigned long hiBytes; + register unsigned char c; + + if (!symbol) + return 0; + /* see if symbol rebound, if so, return that string. */ + for (p = dpy->key_bindings; p; p = p->next) { + if (((modifiers & AllMods) == p->state) && (symbol == p->key)) { + length = p->len; + if (length > nbytes) length = nbytes; + memcpy (buffer, p->string, length); + return length; + } + } + /* try to convert to Latin-1, handling control */ + hiBytes = symbol >> 8; + if (!(nbytes && + ((hiBytes == 0) || + ((hiBytes == 0xFF) && + (((symbol >= XK_BackSpace) && (symbol <= XK_Clear)) || + (symbol == XK_Return) || + (symbol == XK_Escape) || + (symbol == XK_KP_Space) || + (symbol == XK_KP_Tab) || + (symbol == XK_KP_Enter) || + ((symbol >= XK_KP_Multiply) && (symbol <= XK_KP_9)) || + (symbol == XK_KP_Equal) || + (symbol == XK_Delete)))))) + return 0; + + /* if X keysym, convert to ascii by grabbing low 7 bits */ + if (symbol == XK_KP_Space) + c = XK_space & 0x7F; /* patch encoding botch */ + else if (hiBytes == 0xFF) + c = symbol & 0x7F; + else + c = symbol & 0xFF; + /* only apply Control key if it makes sense, else ignore it */ + if (modifiers & ControlMask) { + if ((c >= '@' && c < '\177') || c == ' ') c &= 0x1F; + else if (c == '2') c = '\000'; + else if (c >= '3' && c <= '7') c -= ('3' - '\033'); + else if (c == '8') c = '\177'; + else if (c == '/') c = '_' & 0x1F; + } + buffer[0] = c; + return 1; +} + +/*ARGSUSED*/ +int +XLookupString ( + register XKeyEvent *event, + char *buffer, /* buffer */ + int nbytes, /* space in buffer for characters */ + KeySym *keysym, + XComposeStatus *status) /* not implemented */ +{ + unsigned int modifiers; + KeySym symbol; + + if (! _XTranslateKey(event->display, event->keycode, event->state, + &modifiers, &symbol)) + return 0; + + if (keysym) + *keysym = symbol; + /* arguable whether to use (event->state & ~modifiers) here */ + return _XTranslateKeySym(event->display, symbol, event->state, + buffer, nbytes); +} + +static void +_XFreeKeyBindings( + Display *dpy) +{ + register struct _XKeytrans *p, *np; + + for (p = dpy->key_bindings; p; p = np) { + np = p->next; + Xfree(p->string); + Xfree(p->modifiers); + Xfree(p); + } +} + +int +XRebindKeysym ( + Display *dpy, + KeySym keysym, + KeySym *mlist, + int nm, /* number of modifiers in mlist */ + _Xconst unsigned char *str, + int nbytes) +{ + register struct _XKeytrans *tmp, *p; + int nb; + + if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) + return 0; + LockDisplay(dpy); + tmp = dpy->key_bindings; + nb = sizeof(KeySym) * nm; + + if ((! (p = Xcalloc( 1, sizeof(struct _XKeytrans)))) || + ((! (p->string = Xmalloc(nbytes))) && (nbytes > 0)) || + ((! (p->modifiers = Xmalloc(nb))) && (nb > 0))) { + if (p) { + Xfree(p->string); + Xfree(p->modifiers); + Xfree(p); + } + UnlockDisplay(dpy); + return 0; + } + + dpy->key_bindings = p; + dpy->free_funcs->key_bindings = _XFreeKeyBindings; + p->next = tmp; /* chain onto list */ + memcpy (p->string, str, nbytes); + p->len = nbytes; + memcpy ((char *) p->modifiers, (char *) mlist, nb); + p->key = keysym; + p->mlen = nm; + ComputeMaskFromKeytrans(dpy, p); + UnlockDisplay(dpy); + return 0; +} + +unsigned +_XKeysymToModifiers( + Display *dpy, + KeySym ks) +{ + CARD8 code,mods; + register KeySym *kmax; + register KeySym *k; + register XModifierKeymap *m; + + if ((! dpy->keysyms) && (! _XKeyInitialize(dpy))) + return 0; + kmax = dpy->keysyms + + (dpy->max_keycode - dpy->min_keycode + 1) * dpy->keysyms_per_keycode; + k = dpy->keysyms; + m = dpy->modifiermap; + mods= 0; + while (kmax_keypermod<<3; + + code=(((k-dpy->keysyms)/dpy->keysyms_per_keycode)+dpy->min_keycode); + + while (--j >= 0) { + if (code == m->modifiermap[j]) + mods|= (1<<(j/m->max_keypermod)); + } + } + k++; + } + return mods; +} + +/* + * given a list of modifiers, computes the mask necessary for later matching. + * This routine must lookup the key in the Keymap and then search to see + * what modifier it is bound to, if any. Sets the AnyModifier bit if it + * can't map some keysym to a modifier. + */ +static void +ComputeMaskFromKeytrans( + Display *dpy, + register struct _XKeytrans *p) +{ + register int i; + + p->state = AnyModifier; + for (i = 0; i < p->mlen; i++) { + p->state|= XkbKeysymToModifiers(dpy,p->modifiers[i]); + } + p->state &= AllMods; +} diff --git a/nx-X11/lib/src/KeysymStr.c b/nx-X11/lib/src/KeysymStr.c new file mode 100644 index 000000000..ba6c8450a --- /dev/null +++ b/nx-X11/lib/src/KeysymStr.c @@ -0,0 +1,146 @@ + +/* + +Copyright 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include +#include "Xresinternal.h" + +#include /* sprintf */ + +#define NEEDVTABLE +#include "ks_tables.h" +#include "Key.h" + + +typedef struct _GRNData { + char *name; + XrmRepresentation type; + XrmValuePtr value; +} GRNData; + +/*ARGSUSED*/ +static Bool +SameValue( + XrmDatabase* db, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation* type, + XrmValuePtr value, + XPointer data +) +{ + GRNData *gd = (GRNData *)data; + + if ((*type == gd->type) && (value->size == gd->value->size) && + !strncmp((char *)value->addr, (char *)gd->value->addr, value->size)) + { + gd->name = XrmQuarkToString(*quarks); /* XXX */ + return True; + } + return False; +} + +char *XKeysymToString(KeySym ks) +{ + XrmDatabase keysymdb; + + if (!ks || (ks & ((unsigned long) ~0x1fffffff)) != 0) + return ((char *)NULL); + if (ks == XK_VoidSymbol) + ks = 0; + if (ks <= 0x1fffffff) + { + unsigned char val1 = ks >> 24; + unsigned char val2 = (ks >> 16) & 0xff; + unsigned char val3 = (ks >> 8) & 0xff; + unsigned char val4 = ks & 0xff; + int i = ks % VTABLESIZE; + int h = i + 1; + int n = VMAXHASH; + int idx; + while ((idx = hashKeysym[i])) + { + const unsigned char *entry = &_XkeyTable[idx]; + if ((entry[0] == val1) && (entry[1] == val2) && + (entry[2] == val3) && (entry[3] == val4)) + return ((char *)entry + 4); + if (!--n) + break; + i += h; + if (i >= VTABLESIZE) + i -= VTABLESIZE; + } + } + + if ((keysymdb = _XInitKeysymDB())) + { + char buf[9]; + XrmValue resval; + XrmQuark empty = NULLQUARK; + GRNData data; + + snprintf(buf, sizeof(buf), "%lX", ks); + resval.addr = (XPointer)buf; + resval.size = strlen(buf) + 1; + data.name = (char *)NULL; + data.type = XrmPermStringToQuark("String"); + data.value = &resval; + (void)XrmEnumerateDatabase(keysymdb, &empty, &empty, XrmEnumAllLevels, + SameValue, (XPointer)&data); + if (data.name) + return data.name; + } + if (ks >= 0x01000100 && ks <= 0x0110ffff) { + KeySym val = ks & 0xffffff; + char *s; + int i; + if (val & 0xff0000) + i = 10; + else + i = 6; + s = Xmalloc(i); + if (s == NULL) + return s; + i--; + s[i--] = '\0'; + for (; i; i--){ + unsigned char val1 = val & 0xf; + val >>= 4; + if (val1 < 10) + s[i] = '0'+ val1; + else + s[i] = 'A'+ val1 - 10; + } + s[i] = 'U'; + return s; + } + return ((char *) NULL); +} diff --git a/nx-X11/lib/src/KillCl.c b/nx-X11/lib/src/KillCl.c new file mode 100644 index 000000000..cfd8cb000 --- /dev/null +++ b/nx-X11/lib/src/KillCl.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XKillClient( + register Display *dpy, + XID resource) +{ + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(KillClient, resource, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/LiHosts.c b/nx-X11/lib/src/LiHosts.c new file mode 100644 index 000000000..29c36ffb5 --- /dev/null +++ b/nx-X11/lib/src/LiHosts.c @@ -0,0 +1,157 @@ +/* + +Copyright 1986, 1998 The Open Group + +All rights reserved. + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, and/or sell copies of the Software, and to permit persons +to whom the Software is furnished to do so, provided that the above +copyright notice(s) and this permission notice appear in all copies of +the Software and that both the above copyright notice(s) and this +permission notice appear in supporting documentation. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT +OF THIRD PARTY RIGHTS. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR +HOLDERS INCLUDED IN THIS NOTICE BE LIABLE FOR ANY CLAIM, OR 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. + +Except as contained in this notice, the name of a copyright holder +shall not be used in advertising or otherwise to promote the sale, use +or other dealings in this Software without prior written authorization +of the copyright holder. + +X Window System is a trademark of The Open Group. + +*/ + +/* + * Copyright 2004 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* This can really be considered an os dependent routine */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +/* + * can be freed using XFree. + */ + +XHostAddress *XListHosts ( + register Display *dpy, + int *nhosts, /* RETURN */ + Bool *enabled) /* RETURN */ +{ + register XHostAddress *outbuf = NULL, *op; + xListHostsReply reply; + unsigned char *buf, *bp; + register unsigned i; + _X_UNUSED register xListHostsReq *req; + XServerInterpretedAddress *sip; + + *nhosts = 0; + LockDisplay(dpy); + GetReq (ListHosts, req); + + if (!_XReply (dpy, (xReply *) &reply, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (XHostAddress *) NULL; + } + + if (reply.nHosts) { + unsigned long nbytes = reply.length << 2; /* number of bytes in reply */ + const unsigned long max_hosts = INT_MAX / + (sizeof(XHostAddress) + sizeof(XServerInterpretedAddress)); + + if (reply.nHosts < max_hosts) { + unsigned long hostbytes = reply.nHosts * + (sizeof(XHostAddress) + sizeof(XServerInterpretedAddress)); + + if (reply.length < (INT_MAX >> 2) && + (hostbytes >> 2) < ((INT_MAX >> 2) - reply.length)) + outbuf = Xmalloc(nbytes + hostbytes); + } + + if (! outbuf) { + _XEatDataWords(dpy, reply.length); + UnlockDisplay(dpy); + SyncHandle(); + return (XHostAddress *) NULL; + } + op = outbuf; + sip = (XServerInterpretedAddress *) + (((unsigned char *) outbuf) + (reply.nHosts * sizeof(XHostAddress))); + bp = buf = ((unsigned char *) sip) + + (reply.nHosts * sizeof(XServerInterpretedAddress)); + + _XRead (dpy, (char *) buf, nbytes); + + for (i = 0; i < reply.nHosts; i++) { + op->family = ((xHostEntry *) bp)->family; + op->length =((xHostEntry *) bp)->length; + if (op->family == FamilyServerInterpreted) { + char *tp = (char *) (bp + SIZEOF(xHostEntry)); + char *vp = memchr(tp, 0, op->length); + + if (vp != NULL) { + sip->type = tp; + sip->typelength = vp - tp; + sip->value = vp + 1; + sip->valuelength = op->length - (sip->typelength + 1); + } else { + sip->type = sip->value = NULL; + sip->typelength = sip->valuelength = 0; + } + op->address = (char *) sip; + sip++; + } else { + op->address = (char *) (bp + SIZEOF(xHostEntry)); + } + bp += SIZEOF(xHostEntry) + (((op->length + 3) >> 2) << 2); + op++; + } + } + + *enabled = reply.enabled; + *nhosts = reply.nHosts; + UnlockDisplay(dpy); + SyncHandle(); + return (outbuf); +} + + + + + diff --git a/nx-X11/lib/src/LiICmaps.c b/nx-X11/lib/src/LiICmaps.c new file mode 100644 index 000000000..45a2f2fd3 --- /dev/null +++ b/nx-X11/lib/src/LiICmaps.c @@ -0,0 +1,71 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Colormap *XListInstalledColormaps( + register Display *dpy, + Window win, + int *n) /* RETURN */ +{ + unsigned long nbytes; + Colormap *cmaps; + xListInstalledColormapsReply rep; + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(ListInstalledColormaps, win, req); + + if(_XReply(dpy, (xReply *) &rep, 0, xFalse) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + *n = 0; + return((Colormap *) NULL); + } + + if (rep.nColormaps) { + nbytes = rep.nColormaps * sizeof(Colormap); + cmaps = Xmalloc(nbytes); + if (! cmaps) { + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return((Colormap *) NULL); + } + nbytes = rep.nColormaps << 2; + _XRead32 (dpy, (long *) cmaps, nbytes); + } + else cmaps = (Colormap *) NULL; + + *n = rep.nColormaps; + UnlockDisplay(dpy); + SyncHandle(); + return(cmaps); +} + diff --git a/nx-X11/lib/src/LiProps.c b/nx-X11/lib/src/LiProps.c new file mode 100644 index 000000000..d9c746563 --- /dev/null +++ b/nx-X11/lib/src/LiProps.c @@ -0,0 +1,69 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Atom *XListProperties( + register Display *dpy, + Window window, + int *n_props) /* RETURN */ +{ + unsigned long nbytes; + xListPropertiesReply rep; + Atom *properties; + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(ListProperties, window, req); + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + *n_props = 0; + UnlockDisplay(dpy); + SyncHandle(); + return ((Atom *) NULL); + } + + if (rep.nProperties) { + nbytes = rep.nProperties * sizeof(Atom); + properties = Xmalloc (nbytes); + if (! properties) { + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return (Atom *) NULL; + } + nbytes = rep.nProperties << 2; + _XRead32 (dpy, (long *) properties, nbytes); + } + else properties = (Atom *) NULL; + + *n_props = rep.nProperties; + UnlockDisplay(dpy); + SyncHandle(); + return (properties); +} diff --git a/nx-X11/lib/src/ListExt.c b/nx-X11/lib/src/ListExt.c new file mode 100644 index 000000000..7fdf9932c --- /dev/null +++ b/nx-X11/lib/src/ListExt.c @@ -0,0 +1,109 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +char **XListExtensions( + register Display *dpy, + int *nextensions) /* RETURN */ +{ + xListExtensionsReply rep; + char **list = NULL; + char *ch = NULL; + char *chend; + int count = 0; + register unsigned i; + register int length; + _X_UNUSED register xReq *req; + unsigned long rlen = 0; + + LockDisplay(dpy); + GetEmptyReq (ListExtensions, req); + + if (! _XReply (dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (char **) NULL; + } + + if (rep.nExtensions) { + list = Xmalloc (rep.nExtensions * sizeof (char *)); + if (rep.length > 0 && rep.length < (INT_MAX >> 2)) { + rlen = rep.length << 2; + ch = Xmalloc (rlen + 1); + /* +1 to leave room for last null-terminator */ + } + + if ((!list) || (!ch)) { + Xfree(list); + Xfree(ch); + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return (char **) NULL; + } + + _XReadPad (dpy, ch, rlen); + /* + * unpack into null terminated strings. + */ + chend = ch + (rlen + 1); + length = *ch; + for (i = 0; i < rep.nExtensions; i++) { + if (ch + length < chend) { + list[i] = ch+1; /* skip over length */ + ch += length + 1; /* find next length ... */ + if (ch <= chend) { + length = *ch; + *ch = '\0'; /* and replace with null-termination */ + count++; + } else { + list[i] = NULL; + } + } else + list[i] = NULL; + } + } + + *nextensions = count; + UnlockDisplay(dpy); + SyncHandle(); + return (list); +} + +int +XFreeExtensionList (char **list) +{ + if (list != NULL) { + Xfree (list[0]-1); + Xfree (list); + } + return 1; +} diff --git a/nx-X11/lib/src/LoadFont.c b/nx-X11/lib/src/LoadFont.c new file mode 100644 index 000000000..f547976ba --- /dev/null +++ b/nx-X11/lib/src/LoadFont.c @@ -0,0 +1,55 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Font +XLoadFont ( + register Display *dpy, + _Xconst char *name) +{ + register long nbytes; + Font fid; + register xOpenFontReq *req; + + if (_XF86LoadQueryLocaleFont(dpy, name, (XFontStruct **)0, &fid)) + return fid; + + LockDisplay(dpy); + GetReq(OpenFont, req); + nbytes = req->nbytes = name ? strlen(name) : 0; + req->fid = fid = XAllocID(dpy); + req->length += (nbytes+3)>>2; + Data (dpy, name, nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return (fid); + /* can't return (req->fid) since request may have already been sent */ +} + diff --git a/nx-X11/lib/src/LockDis.c b/nx-X11/lib/src/LockDis.c new file mode 100644 index 000000000..12dd97df0 --- /dev/null +++ b/nx-X11/lib/src/LockDis.c @@ -0,0 +1,84 @@ + +/* + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Stephen Gildea, MIT X Consortium + * + * XLockDis.c - multi-thread application-level locking routines + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#ifdef XTHREADS +#include "locking.h" +#endif + +void +XLockDisplay( + register Display* dpy) +{ +#ifdef XTHREADS + LockDisplay(dpy); + if (dpy->lock) + (*dpy->lock->user_lock_display)(dpy); + /* + * We want the threads in the reply queue to all get out before + * XLockDisplay returns, in case they have any side effects the + * caller of XLockDisplay was trying to protect against. + * XLockDisplay puts itself at the head of the event waiters queue + * to wait for all the replies to come in. + */ + if (dpy->lock && dpy->lock->reply_awaiters) { + struct _XCVList *cvl; + + cvl = (*dpy->lock->create_cvl)(dpy); + + /* stuff ourselves on the head of the queue */ + cvl->next = dpy->lock->event_awaiters; + dpy->lock->event_awaiters = cvl; + + while (dpy->lock->reply_awaiters) + ConditionWait(dpy, cvl->cv); + UnlockNextEventReader(dpy); /* pass the signal on */ + } + UnlockDisplay(dpy); +#endif +} + +void +XUnlockDisplay( + register Display* dpy) +{ +#ifdef XTHREADS + LockDisplay(dpy); + if (dpy->lock) + (*dpy->lock->user_unlock_display)(dpy); + UnlockDisplay(dpy); +#endif +} diff --git a/nx-X11/lib/src/LookupCol.c b/nx-X11/lib/src/LookupCol.c new file mode 100644 index 000000000..f7f969f56 --- /dev/null +++ b/nx-X11/lib/src/LookupCol.c @@ -0,0 +1,104 @@ +/* + +Copyright 1985, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" + + +Status +XLookupColor ( + register Display *dpy, + Colormap cmap, + _Xconst char *spec, + XColor *def, + XColor *scr) +{ + register int n; + xLookupColorReply reply; + register xLookupColorReq *req; + XcmsCCC ccc; + XcmsColor cmsColor_exact; + +#ifdef XCMS + /* + * Let's Attempt to use Xcms and i18n approach to Parse Color + */ + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { + const char *tmpName = spec; + + switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor_exact, + XcmsRGBFormat)) { + case XcmsSuccess: + case XcmsSuccessWithCompression: + _XcmsRGB_to_XColor(&cmsColor_exact, def, 1); + memcpy((char *)scr, (char *)def, sizeof(XColor)); + _XUnresolveColor(ccc, scr); + return(1); + case XcmsFailure: + case _XCMS_NEWNAME: + /* + * if the result was _XCMS_NEWNAME tmpName points to + * a string in cmsColNm.c:pairs table, for example, + * gray70 would become tekhvc:0.0/70.0/0.0 + */ + break; + } + } +#endif + + /* + * Xcms and i18n methods failed, so lets pass it to the server + * for parsing. + */ + + n = strlen (spec); + LockDisplay(dpy); + GetReq (LookupColor, req); + req->cmap = cmap; + req->nbytes = n; + req->length += (n + 3) >> 2; + Data (dpy, spec, (long)n); + if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + def->red = reply.exactRed; + def->green = reply.exactGreen; + def->blue = reply.exactBlue; + + scr->red = reply.screenRed; + scr->green = reply.screenGreen; + scr->blue = reply.screenBlue; + + UnlockDisplay(dpy); + SyncHandle(); + return (1); +} diff --git a/nx-X11/lib/src/LowerWin.c b/nx-X11/lib/src/LowerWin.c new file mode 100644 index 000000000..d430e6fd7 --- /dev/null +++ b/nx-X11/lib/src/LowerWin.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XLowerWindow( + Display *dpy, + Window w) +{ + register xConfigureWindowReq *req; + unsigned long val = Below; /* needed for macro */ + + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 4, req); + req->window = w; + req->mask = CWStackMode; + OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/Macros.c b/nx-X11/lib/src/Macros.c new file mode 100644 index 000000000..e29dcd4e8 --- /dev/null +++ b/nx-X11/lib/src/Macros.c @@ -0,0 +1,303 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#define XUTIL_DEFINE_FUNCTIONS +#include "Xutil.h" +#if USE_XCB +#include "Xxcbint.h" +#endif + +/* + * This file makes full definitions of routines for each macro. + * We do not expect C programs to use these, but other languages may + * need them. + */ + +int XConnectionNumber(Display *dpy) { return (ConnectionNumber(dpy)); } + +Window XRootWindow (Display *dpy, int scr) +{ + return (RootWindow(dpy,scr)); +} + +int XDefaultScreen(Display *dpy) { return (DefaultScreen(dpy)); } + +Window XDefaultRootWindow (Display *dpy) +{ + return (RootWindow(dpy,DefaultScreen(dpy))); +} + +Visual *XDefaultVisual(Display *dpy, int scr) +{ + return (DefaultVisual(dpy, scr)); +} + +GC XDefaultGC(Display *dpy, int scr) +{ + return (DefaultGC(dpy,scr)); +} + +unsigned long XBlackPixel(Display *dpy, int scr) +{ + return (BlackPixel(dpy, scr)); +} + +unsigned long XWhitePixel(Display *dpy, int scr) +{ + return (WhitePixel(dpy,scr)); +} + +unsigned long XAllPlanes(void) { return AllPlanes; } + +int XQLength(Display *dpy) { return (QLength(dpy)); } + +int XDisplayWidth(Display *dpy, int scr) +{ + return (DisplayWidth(dpy,scr)); +} + +int XDisplayHeight(Display *dpy, int scr) +{ + return (DisplayHeight(dpy, scr)); +} + +int XDisplayWidthMM(Display *dpy, int scr) +{ + return (DisplayWidthMM(dpy, scr)); +} + +int XDisplayHeightMM(Display *dpy, int scr) +{ + return (DisplayHeightMM(dpy, scr)); +} + +int XDisplayPlanes(Display *dpy, int scr) +{ + return (DisplayPlanes(dpy, scr)); +} + +int XDisplayCells(Display *dpy, int scr) +{ + return (DisplayCells (dpy, scr)); +} + +int XScreenCount(Display *dpy) { return (ScreenCount(dpy)); } + +char *XServerVendor(Display *dpy) { return (ServerVendor(dpy)); } + +int XProtocolVersion(Display *dpy) { return (ProtocolVersion(dpy)); } + +int XProtocolRevision(Display *dpy) { return (ProtocolRevision(dpy));} + +int XVendorRelease(Display *dpy) { return (VendorRelease(dpy)); } + +char *XDisplayString(Display *dpy) { return (DisplayString(dpy)); } + +int XDefaultDepth(Display *dpy, int scr) +{ + return(DefaultDepth(dpy, scr)); +} + +Colormap XDefaultColormap(Display *dpy, int scr) +{ + return (DefaultColormap(dpy, scr)); +} + +int XBitmapUnit(Display *dpy) { return (BitmapUnit(dpy)); } + +int XBitmapBitOrder(Display *dpy) { return (BitmapBitOrder(dpy)); } + +int XBitmapPad(Display *dpy) { return (BitmapPad(dpy)); } + +int XImageByteOrder(Display *dpy) { return (ImageByteOrder(dpy)); } + +#if !USE_XCB +unsigned long XNextRequest(Display *dpy) +{ + return (NextRequest(dpy)); +} +#else +/* XNextRequest() differs from the rest of the functions here because it is + * no longer a macro wrapper - when libX11 is being used mixed together + * with direct use of xcb, the next request field of the Display structure will + * not be updated. We can't fix the NextRequest() macro in any easy way, + * but we can at least make XNextRequest() do the right thing. + */ +unsigned long XNextRequest(Display *dpy) +{ + unsigned long next_request; + LockDisplay(dpy); + next_request = _XNextRequest(dpy); + UnlockDisplay(dpy); + + return next_request; +} +#endif + +unsigned long XLastKnownRequestProcessed(Display *dpy) +{ + return (LastKnownRequestProcessed(dpy)); +} + +/* screen oriented macros (toolkit) */ +Screen *XScreenOfDisplay(Display *dpy, int scr) +{ + return (ScreenOfDisplay(dpy, scr)); +} + +Screen *XDefaultScreenOfDisplay(Display *dpy) +{ + return (DefaultScreenOfDisplay(dpy)); +} + +Display *XDisplayOfScreen(Screen *s) { return (DisplayOfScreen(s)); } + +Window XRootWindowOfScreen(Screen *s) { return (RootWindowOfScreen(s)); } + +unsigned long XBlackPixelOfScreen(Screen *s) +{ + return (BlackPixelOfScreen(s)); +} + +unsigned long XWhitePixelOfScreen(Screen *s) +{ + return (WhitePixelOfScreen(s)); +} + +Colormap XDefaultColormapOfScreen(Screen *s) +{ + return (DefaultColormapOfScreen(s)); +} + +int XDefaultDepthOfScreen(Screen *s) +{ + return (DefaultDepthOfScreen(s)); +} + +GC XDefaultGCOfScreen(Screen *s) +{ + return (DefaultGCOfScreen(s)); +} + +Visual *XDefaultVisualOfScreen(Screen *s) +{ + return (DefaultVisualOfScreen(s)); +} + +int XWidthOfScreen(Screen *s) { return (WidthOfScreen(s)); } + +int XHeightOfScreen(Screen *s) { return (HeightOfScreen(s)); } + +int XWidthMMOfScreen(Screen *s) { return (WidthMMOfScreen(s)); } + +int XHeightMMOfScreen(Screen *s) { return (HeightMMOfScreen(s)); } + +int XPlanesOfScreen(Screen *s) { return (PlanesOfScreen(s)); } + +int XCellsOfScreen(Screen *s) { return (CellsOfScreen(s)); } + +int XMinCmapsOfScreen(Screen *s) { return (MinCmapsOfScreen(s)); } + +int XMaxCmapsOfScreen(Screen *s) { return (MaxCmapsOfScreen(s)); } + +Bool XDoesSaveUnders(Screen *s) { return (DoesSaveUnders(s)); } + +int XDoesBackingStore(Screen *s) { return (DoesBackingStore(s)); } + +long XEventMaskOfScreen(Screen *s) { return (EventMaskOfScreen(s)); } + +int XScreenNumberOfScreen (register Screen *scr) +{ + register Display *dpy = scr->display; + register Screen *dpyscr = dpy->screens; + register int i; + + for (i = 0; i < dpy->nscreens; i++, dpyscr++) { + if (scr == dpyscr) return i; + } + return -1; +} + +/* + * These macros are used to give some sugar to the image routines so that + * naive people are more comfortable with them. + */ +#undef XDestroyImage +int +XDestroyImage( + XImage *ximage) +{ + return((*((ximage)->f.destroy_image))((ximage))); +} +#undef XGetPixel +unsigned long XGetPixel( + XImage *ximage, + int x, int y) +{ + return ((*((ximage)->f.get_pixel))((ximage), (x), (y))); +} +#undef XPutPixel +int XPutPixel( + XImage *ximage, + int x, int y, + unsigned long pixel) +{ + return((*((ximage)->f.put_pixel))((ximage), (x), (y), (pixel))); +} +#undef XSubImage +XImage *XSubImage( + XImage *ximage, + int x, int y, + unsigned int width, unsigned int height) +{ + return((*((ximage)->f.sub_image))((ximage), (x), + (y), (width), (height))); +} +#undef XAddPixel +int XAddPixel( + XImage *ximage, + long value) +{ + return((*((ximage)->f.add_pixel))((ximage), (value))); +} + + +int +XNoOp (register Display *dpy) +{ + _X_UNUSED register xReq *req; + + LockDisplay(dpy); + GetEmptyReq(NoOperation, req); + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/Makefile.am b/nx-X11/lib/src/Makefile.am new file mode 100644 index 000000000..90011f602 --- /dev/null +++ b/nx-X11/lib/src/Makefile.am @@ -0,0 +1,387 @@ +NULL = + +if XKB +XKB_SUBDIRS = xkb +endif +SUBDIRS = util xcms xlibi18n $(XKB_SUBDIRS) + +lib_LTLIBRARIES = libNX_X11.la + +BUILT_SOURCES=ks_tables.h +CLEANFILES=ks_tables.h ks_tables_h + +AM_CPPFLAGS= \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + -DX11_t \ + -DTRANS_CLIENT \ + -DUSE_XCB=0 \ + $(NULL) + +AM_CFLAGS= \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(XMALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +# +# =============================== I18N ============================= +# + +I18N_LIBS = \ + xlibi18n/libi18n.la \ + $(NULL) + +# +# =============================== XCMS ============================= +# + +XCMS_LIBS = \ + xcms/libxcms.la \ + $(NULL) + +# +# =============================== XKB ============================== +# + +XKB_LIBS = \ + xkb/libxkb.la \ + $(NULL) + +# +# =============================== XLIB ============================= +# + +libNX_X11_la_SOURCES = \ + AllCells.c \ + AllowEv.c \ + AllPlanes.c \ + AuDispose.c \ + AuFileName.c \ + AuGetBest.c \ + AuRead.c \ + AutoRep.c \ + Backgnd.c \ + BdrWidth.c \ + Bell.c \ + Border.c \ + ChAccCon.c \ + ChActPGb.c \ + ChClMode.c \ + ChCmap.c \ + ChGC.c \ + ChKeyCon.c \ + ChkIfEv.c \ + ChkMaskEv.c \ + ChkTypEv.c \ + ChkTypWEv.c \ + ChkWinEv.c \ + ChPntCon.c \ + ChProp.c \ + ChSaveSet.c \ + ChWAttrs.c \ + ChWindow.c \ + CirWin.c \ + CirWinDn.c \ + CirWinUp.c \ + ClDisplay.c \ + ClearArea.c \ + Clear.c \ + ConfWind.c \ + ConnDis.c \ + Context.c \ + ConvSel.c \ + CopyArea.c \ + CopyCmap.c \ + CopyGC.c \ + CopyPlane.c \ + CrBFData.c \ + CrCmap.c \ + CrCursor.c \ + CrGC.c \ + CrGlCur.c \ + CrPFBData.c \ + CrPixmap.c \ + CrWindow.c \ + Cursor.c \ + DefCursor.c \ + DelProp.c \ + Depths.c \ + DestSubs.c \ + DestWind.c \ + DisName.c \ + DrArc.c \ + DrArcs.c \ + DrLine.c \ + DrLines.c \ + DrPoint.c \ + DrPoints.c \ + DrRect.c \ + DrRects.c \ + DrSegs.c \ + ErrDes.c \ + ErrHndlr.c \ + evtomask.c \ + EvToWire.c \ + FetchName.c \ + FillArc.c \ + FillArcs.c \ + FillPoly.c \ + FillRct.c \ + FillRcts.c \ + FilterEv.c \ + Flush.c \ + Font.c \ + FontInfo.c \ + FontNames.c \ + FreeCmap.c \ + FreeCols.c \ + FreeCurs.c \ + FreeEData.c \ + FreeEventData.c \ + FreeGC.c \ + FreePix.c \ + FSSaver.c \ + FSWrap.c \ + GCMisc.c \ + Geom.c \ + GetAtomNm.c \ + GetColor.c \ + GetDflt.c \ + GetEventData.c \ + GetFPath.c \ + GetFProp.c \ + GetGCVals.c \ + GetGeom.c \ + GetHColor.c \ + GetHints.c \ + GetIFocus.c \ + GetImage.c \ + GetKCnt.c \ + GetMoEv.c \ + GetNrmHint.c \ + GetPCnt.c \ + GetPntMap.c \ + GetProp.c \ + GetRGBCMap.c \ + GetSOwner.c \ + GetSSaver.c \ + GetStCmap.c \ + GetTxtProp.c \ + GetWAttrs.c \ + GetWMCMapW.c \ + GetWMProto.c \ + globals.c \ + GrButton.c \ + GrKeybd.c \ + GrKey.c \ + GrPointer.c \ + GrServer.c \ + Host.c \ + Iconify.c \ + IfEvent.c \ + imConv.c \ + ImText16.c \ + ImText.c \ + ImUtil.c \ + InitExt.c \ + InsCmap.c \ + IntAtom.c \ + KeyBind.c \ + KeysymStr.c \ + KillCl.c \ + LiHosts.c \ + LiICmaps.c \ + LiProps.c \ + ListExt.c \ + LoadFont.c \ + LockDis.c \ + locking.c \ + LookupCol.c \ + LowerWin.c \ + Macros.c \ + MapRaised.c \ + MapSubs.c \ + MapWindow.c \ + MaskEvent.c \ + Misc.c \ + ModMap.c \ + MoveWin.c \ + NextEvent.c \ + OCWrap.c \ + OMWrap.c \ + OpenDis.c \ + ParseCmd.c \ + ParseCol.c \ + ParseGeom.c \ + PeekEvent.c \ + PeekIfEv.c \ + Pending.c \ + PixFormats.c \ + PmapBgnd.c \ + PmapBord.c \ + PolyReg.c \ + PolyTxt16.c \ + PolyTxt.c \ + PropAlloc.c \ + PutBEvent.c \ + PutImage.c \ + Quarks.c \ + QuBest.c \ + QuColor.c \ + QuColors.c \ + QuCurShp.c \ + QuExt.c \ + QuKeybd.c \ + QuPntr.c \ + QuStipShp.c \ + QuTextE16.c \ + QuTextExt.c \ + QuTileShp.c \ + QuTree.c \ + RaiseWin.c \ + RdBitF.c \ + RecolorC.c \ + ReconfWin.c \ + ReconfWM.c \ + Region.c \ + RegstFlt.c \ + RepWindow.c \ + RestackWs.c \ + RotProp.c \ + ScrResStr.c \ + SelInput.c \ + SendEvent.c \ + SetBack.c \ + SetClMask.c \ + SetClOrig.c \ + SetCRects.c \ + SetDashes.c \ + SetFont.c \ + SetFore.c \ + SetFPath.c \ + SetFunc.c \ + SetHints.c \ + SetIFocus.c \ + SetLocale.c \ + SetLStyle.c \ + SetNrmHint.c \ + SetPMask.c \ + SetPntMap.c \ + SetRGBCMap.c \ + SetSOwner.c \ + SetSSaver.c \ + SetState.c \ + SetStCmap.c \ + SetStip.c \ + SetTile.c \ + SetTSOrig.c \ + SetTxtProp.c \ + SetWMCMapW.c \ + SetWMProto.c \ + StBytes.c \ + StColor.c \ + StColors.c \ + StName.c \ + StNColor.c \ + StrKeysym.c \ + StrToText.c \ + Sync.c \ + Synchro.c \ + Text16.c \ + Text.c \ + TextExt16.c \ + TextExt.c \ + TextToStr.c \ + TrCoords.c \ + UndefCurs.c \ + UngrabBut.c \ + UngrabKbd.c \ + UngrabKey.c \ + UngrabPtr.c \ + UngrabSvr.c \ + UninsCmap.c \ + UnldFont.c \ + UnmapSubs.c \ + UnmapWin.c \ + VisUtil.c \ + WarpPtr.c \ + Window.c \ + WinEvent.c \ + Withdraw.c \ + WMGeom.c \ + WMProps.c \ + WrBitF.c \ + XlibAsync.c \ + XlibInt.c \ + Xrm.c \ + x11_trans.c \ + $(NULL) + +# +# ========================= Extra stuff ============================ +# + +x11datadir = @X11_DATADIR@ +x11data_DATA = XErrorDB + +EXTRA_DIST = \ + $(x11data_DATA) \ + $(NULL) + +if THRSTUBS +libNX_X11_la_SOURCES+=UIThrStubs.c +else +EXTRA_DIST += \ + UIThrStubs.c \ + $(NULL) +endif + +libNX_X11_la_LDFLAGS = -version-number 6:3:0 -no-undefined + +if XLOCALE +USE_I18N_LIBS = $(I18N_LIBS) +endif + +if XCMS +USE_XCMS_LIBS = $(XCMS_LIBS) +endif + +if XKB +USE_XKB_LIBS = $(XKB_LIBS) +endif + +libNX_X11_la_LIBADD = \ + $(USE_I18N_LIBS) \ + $(USE_XCMS_LIBS) \ + $(USE_XKB_LIBS) \ + $(X11_LIBS) \ + -L$(top_srcdir)/../../nxcomp/src/.libs -lXcomp \ + $(NULL) + +preprocess: $(patsubst %.c,%.ii,$(libX11_la_SOURCES)) +.c.ii: + $(COMPILE) -E -o $@ `test -f '$<' || echo '$(srcdir)/'`$< + +# +# Building ks_tables.h requires the makekeys utility +# + +KEYSYMDEFS=@KEYSYMDEFS@ + +ks_tables.h: $(KEYSYMDEFS) $(top_builddir)/src/util/makekeys$(EXEEXT) + $(top_builddir)/src/util/makekeys $(KEYSYMDEFS) > ks_tables_h + mv ks_tables_h $@ + +$(top_builddir)/src/util/makekeys$(EXEEXT): force + cd util && $(MAKE) + +force: diff --git a/nx-X11/lib/src/MapRaised.c b/nx-X11/lib/src/MapRaised.c new file mode 100644 index 000000000..6ad6aef08 --- /dev/null +++ b/nx-X11/lib/src/MapRaised.c @@ -0,0 +1,51 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XMapRaised ( + register Display *dpy, + Window w) +{ + register xConfigureWindowReq *req; + register xResourceReq *req2; + unsigned long val = Above; /* needed for macro */ + + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 4, req); + req->window = w; + req->mask = CWStackMode; + OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); + GetResReq (MapWindow, w, req2); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/MapSubs.c b/nx-X11/lib/src/MapSubs.c new file mode 100644 index 000000000..14e8b8af5 --- /dev/null +++ b/nx-X11/lib/src/MapSubs.c @@ -0,0 +1,43 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XMapSubwindows( + register Display *dpy, + Window win) +{ + register xResourceReq *req; + LockDisplay(dpy); + GetResReq(MapSubwindows, win, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/MapWindow.c b/nx-X11/lib/src/MapWindow.c new file mode 100644 index 000000000..cc041ff51 --- /dev/null +++ b/nx-X11/lib/src/MapWindow.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XMapWindow ( + register Display *dpy, + Window w) +{ + register xResourceReq *req; + LockDisplay (dpy); + GetResReq(MapWindow, w, req); + UnlockDisplay (dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/MaskEvent.c b/nx-X11/lib/src/MaskEvent.c new file mode 100644 index 000000000..1fadc487e --- /dev/null +++ b/nx-X11/lib/src/MaskEvent.c @@ -0,0 +1,86 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +extern long const _Xevent_to_mask[]; +#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) +#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ + Button4MotionMask|Button5MotionMask) + +/* + * return the next event in the queue matching one of the events in the mask. + * If no event, flush output, and wait until match succeeds. + * Events earlier in the queue are not discarded. + */ + +int +XMaskEvent ( + register Display *dpy, + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + prev = NULL; + while (1) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if ((qelt->event.type < GenericEvent) && + (_Xevent_to_mask[qelt->event.type] & mask) && + ((qelt->event.type != MotionNotify) || + (mask & AllPointers) || + (mask & AllButtons & qelt->event.xmotion.state))) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + UnlockDisplay(dpy); + return 0; + } + } + if (prev) + qe_serial = prev->qserial_num; + _XReadEvents(dpy); + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockDisplay(dpy); + return 0; + } +#endif + } +} diff --git a/nx-X11/lib/src/Misc.c b/nx-X11/lib/src/Misc.c new file mode 100644 index 000000000..c3a028408 --- /dev/null +++ b/nx-X11/lib/src/Misc.c @@ -0,0 +1,66 @@ +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +long XMaxRequestSize(Display *dpy) +{ + return dpy->max_request_size; +} + +char *XResourceManagerString(Display *dpy) +{ + return dpy->xdefaults; +} + +unsigned long XDisplayMotionBufferSize(Display *dpy) +{ + return dpy->motion_buffer; +} + +int +XDisplayKeycodes( + Display *dpy, + int *min_keycode_return, + int *max_keycode_return) +{ + *min_keycode_return = dpy->min_keycode; + *max_keycode_return = dpy->max_keycode; + return 1; +} + +VisualID XVisualIDFromVisual(Visual *visual) +{ + return visual->visualid; +} + +long XExtendedMaxRequestSize(Display *dpy) +{ + return dpy->bigreq_size; +} diff --git a/nx-X11/lib/src/ModMap.c b/nx-X11/lib/src/ModMap.c new file mode 100644 index 000000000..ca15dde25 --- /dev/null +++ b/nx-X11/lib/src/ModMap.c @@ -0,0 +1,184 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +XModifierKeymap * +XGetModifierMapping(register Display *dpy) +{ + xGetModifierMappingReply rep; + _X_UNUSED register xReq *req; + unsigned long nbytes; + XModifierKeymap *res; + + LockDisplay(dpy); + GetEmptyReq(GetModifierMapping, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xFalse); + + if (rep.length < (INT_MAX >> 2) && + (rep.length >> 1) == rep.numKeyPerModifier) { + nbytes = (unsigned long)rep.length << 2; + res = Xmalloc(sizeof (XModifierKeymap)); + if (res) + res->modifiermap = Xmalloc (nbytes); + } else + res = NULL; + if ((! res) || (! res->modifiermap)) { + Xfree(res); + res = (XModifierKeymap *) NULL; + _XEatDataWords(dpy, rep.length); + } else { + _XReadPad(dpy, (char *) res->modifiermap, (long) nbytes); + res->max_keypermod = rep.numKeyPerModifier; + } + + UnlockDisplay(dpy); + SyncHandle(); + return (res); +} + +/* + * Returns: + * MappingSuccess (0) Success + * MappingBusy (1) Busy - one or more old or new modifiers are down + * MappingFailed (2) Failed - one or more new modifiers unacceptable + */ +int +XSetModifierMapping( + register Display *dpy, + register XModifierKeymap *modifier_map) +{ + register xSetModifierMappingReq *req; + xSetModifierMappingReply rep; + int mapSize = modifier_map->max_keypermod << 3; /* 8 modifiers */ + + LockDisplay(dpy); + GetReq(SetModifierMapping, req); + req->length += mapSize >> 2; + req->numKeyPerModifier = modifier_map->max_keypermod; + + Data(dpy, (const char *)modifier_map->modifiermap, mapSize); + + (void) _XReply(dpy, (xReply *) & rep, + (SIZEOF(xSetModifierMappingReply) - SIZEOF(xReply)) >> 2, xTrue); + UnlockDisplay(dpy); + SyncHandle(); + return (rep.success); +} + +XModifierKeymap * +XNewModifiermap(int keyspermodifier) +{ + XModifierKeymap *res = Xmalloc((sizeof (XModifierKeymap))); + if (res) { + res->max_keypermod = keyspermodifier; + res->modifiermap = (keyspermodifier > 0 ? + Xmalloc(8 * keyspermodifier) + : (KeyCode *) NULL); + if (keyspermodifier && (res->modifiermap == NULL)) { + Xfree(res); + return (XModifierKeymap *) NULL; + } + } + return (res); +} + + +int +XFreeModifiermap(XModifierKeymap *map) +{ + if (map) { + Xfree(map->modifiermap); + Xfree(map); + } + return 1; +} + +XModifierKeymap * +XInsertModifiermapEntry(XModifierKeymap *map, +#if NeedWidePrototypes + unsigned int keycode, +#else + KeyCode keycode, +#endif + int modifier) +{ + XModifierKeymap *newmap; + int i, + row = modifier * map->max_keypermod, + newrow, + lastrow; + + for (i=0; imax_keypermod; i++) { + if (map->modifiermap[ row+i ] == keycode) + return(map); /* already in the map */ + if (map->modifiermap[ row+i ] == 0) { + map->modifiermap[ row+i ] = keycode; + return(map); /* we added it without stretching the map */ + } + } + + /* stretch the map */ + if ((newmap = XNewModifiermap(map->max_keypermod+1)) == NULL) + return (XModifierKeymap *) NULL; + newrow = row = 0; + lastrow = newmap->max_keypermod * 8; + while (newrow < lastrow) { + for (i=0; imax_keypermod; i++) + newmap->modifiermap[ newrow+i ] = map->modifiermap[ row+i ]; + newmap->modifiermap[ newrow+i ] = 0; + row += map->max_keypermod; + newrow += newmap->max_keypermod; + } + (void) XFreeModifiermap(map); + newrow = newmap->max_keypermod * modifier + newmap->max_keypermod - 1; + newmap->modifiermap[ newrow ] = keycode; + return(newmap); +} + +XModifierKeymap * +XDeleteModifiermapEntry(XModifierKeymap *map, +#if NeedWidePrototypes + unsigned int keycode, +#else + KeyCode keycode, +#endif + int modifier) +{ + int i, + row = modifier * map->max_keypermod; + + for (i=0; imax_keypermod; i++) { + if (map->modifiermap[ row+i ] == keycode) + map->modifiermap[ row+i ] = 0; + } + /* should we shrink the map?? */ + return (map); +} diff --git a/nx-X11/lib/src/MoveWin.c b/nx-X11/lib/src/MoveWin.c new file mode 100644 index 000000000..2eb2283be --- /dev/null +++ b/nx-X11/lib/src/MoveWin.c @@ -0,0 +1,56 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XMoveWindow ( + register Display *dpy, + Window w, + int x, + int y) +{ + register xConfigureWindowReq *req; + + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 8, req); + + req->window = w; + req->mask = CWX | CWY; + + { + CARD32 *valuePtr = (CARD32 *) NEXTPTR(req,xConfigureWindowReq); + *valuePtr++ = x; + *valuePtr = y; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/NextEvent.c b/nx-X11/lib/src/NextEvent.c new file mode 100644 index 000000000..d3048aee2 --- /dev/null +++ b/nx-X11/lib/src/NextEvent.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Return next event in queue, or if none, flush output and wait for + * events. + */ + +int +XNextEvent ( + register Display *dpy, + register XEvent *event) +{ + register _XQEvent *qelt; + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + if (dpy->head == NULL) + _XReadEvents(dpy); +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockDisplay(dpy); + return 0; + } +#endif + qelt = dpy->head; + *event = qelt->event; + _XDeq(dpy, NULL, qelt); + _XStoreEventCookie(dpy, event); + UnlockDisplay(dpy); + return 0; +} + diff --git a/nx-X11/lib/src/OCWrap.c b/nx-X11/lib/src/OCWrap.c new file mode 100644 index 000000000..fe23a3495 --- /dev/null +++ b/nx-X11/lib/src/OCWrap.c @@ -0,0 +1,140 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +XOC +XCreateOC(XOM om, ...) +{ + va_list var; + XlcArgList args; + XOC oc; + int num_args; + + va_start(var, om); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, om); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (XOC) NULL; + + oc = (*om->methods->create_oc)(om, args, num_args); + + Xfree(args); + + if (oc) { + oc->core.next = om->core.oc_list; + om->core.oc_list = oc; + } + + return oc; +} + +void +XDestroyOC(XOC oc) +{ + XOC prev, oc_list; + + prev = oc_list = oc->core.om->core.oc_list; + if (oc_list == oc) + oc->core.om->core.oc_list = oc_list->core.next; + else { + while ((oc_list = oc_list->core.next)) { + if (oc_list == oc) { + prev->core.next = oc_list->core.next; + break; + } + prev = oc_list; + } + } + + (*oc->methods->destroy)(oc); +} + +XOM +XOMOfOC(XOC oc) +{ + return oc->core.om; +} + +char * +XSetOCValues(XOC oc, ...) +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + + va_start(var, oc); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, oc); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = (*oc->methods->set_values)(oc, args, num_args); + + Xfree(args); + + return ret; +} + +char * +XGetOCValues(XOC oc, ...) +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + + va_start(var, oc); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, oc); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = (*oc->methods->get_values)(oc, args, num_args); + + Xfree(args); + + return ret; +} diff --git a/nx-X11/lib/src/OMWrap.c b/nx-X11/lib/src/OMWrap.c new file mode 100644 index 000000000..045ca16bc --- /dev/null +++ b/nx-X11/lib/src/OMWrap.c @@ -0,0 +1,129 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +XOM +XOpenOM(Display *dpy, XrmDatabase rdb, _Xconst char *res_name, + _Xconst char *res_class) +{ + XLCd lcd = _XOpenLC((char *) NULL); + + if (lcd == NULL) + return (XOM) NULL; + + if (lcd->methods->open_om) + return (*lcd->methods->open_om)(lcd, dpy, rdb, res_name, res_class); + + return (XOM) NULL; +} + +Status +XCloseOM(XOM om) +{ + XOC oc, next; + XLCd lcd = om->core.lcd; + + next = om->core.oc_list; + + while ((oc = next)) { + next = oc->core.next; + (*oc->methods->destroy)(oc); + } + + om->core.oc_list = NULL; + + _XCloseLC(lcd); + + return (*om->methods->close)(om); +} + +char * +XSetOMValues(XOM om, ...) +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + + va_start(var, om); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, om); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = (*om->methods->set_values)(om, args, num_args); + + Xfree(args); + + return ret; +} + +char * +XGetOMValues(XOM om, ...) +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + + va_start(var, om); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, om); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = (*om->methods->get_values)(om, args, num_args); + + Xfree(args); + + return ret; +} + +Display * +XDisplayOfOM(XOM om) +{ + return om->core.display; +} + +char * +XLocaleOfOM(XOM om) +{ + return om->core.lcd->core->name; +} diff --git a/nx-X11/lib/src/OpenDis.c b/nx-X11/lib/src/OpenDis.c new file mode 100644 index 000000000..965924650 --- /dev/null +++ b/nx-X11/lib/src/OpenDis.c @@ -0,0 +1,990 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* nx-X11, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +/* + +Copyright 1985, 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#if USE_XCB +#include "Xxcbint.h" +#else /* !USE_XCB */ +#include +#include +#endif /* USE_XCB */ +#include +#include +#include +#include "Xintconn.h" + +#ifdef XKB +#include "XKBlib.h" +#endif /* XKB */ + +#ifdef NX_TRANS_SOCKET +extern void *_X11TransSocketProxyConnInfo(XtransConnInfo); +#endif + +#if !USE_XCB +#define bignamelen (sizeof(XBigReqExtensionName) - 1) + +typedef struct { + unsigned long seq; + int opcode; +} _XBigReqState; +#endif /* !USE_XCB */ + +#ifdef XTHREADS +#include "locking.h" +int (*_XInitDisplayLock_fn)(Display *dpy) = NULL; +void (*_XFreeDisplayLock_fn)(Display *dpy) = NULL; + +#define InitDisplayLock(d) (_XInitDisplayLock_fn ? (*_XInitDisplayLock_fn)(d) : Success) +#define FreeDisplayLock(d) if (_XFreeDisplayLock_fn) (*_XFreeDisplayLock_fn)(d) +#else +#define InitDisplayLock(dis) Success +#define FreeDisplayLock(dis) +#endif /* XTHREADS */ + +static xReq _dummy_request = { + 0, 0, 0 +}; + +static void OutOfMemory(Display *dpy, char *setup); +#if !USE_XCB +static Bool _XBigReqHandler(Display *dpy, xReply *rep, char *buf, int len, + XPointer data); +#endif /* !USE_XCB */ + +/* + * Connects to a server, creates a Display object and returns a pointer to + * the newly created Display back to the caller. + */ +Display * +XOpenDisplay ( + register _Xconst char *display) +{ + register Display *dpy; /* New Display object being created. */ + register int i; + int j, k; /* random iterator indexes */ + char *display_name; /* pointer to display name */ +#if !USE_XCB + int endian; /* to determine which endian. */ + xConnClientPrefix client; /* client information */ + int idisplay; /* display number */ + int prefixread = 0; /* setup prefix already read? */ + char *conn_auth_name, *conn_auth_data; + int conn_auth_namelen, conn_auth_datalen; +#endif /* !USE_XCB */ + char *setup = NULL; /* memory allocated at startup */ + char *fullname = NULL; /* expanded name of display */ + int iscreen; /* screen number */ + xConnSetupPrefix prefix; /* prefix information */ + int vendorlen; /* length of vendor string */ + union { + xConnSetup *setup; + char *failure; + char *vendor; + xPixmapFormat *sf; + xWindowRoot *rp; + xDepth *dp; + xVisualType *vp; + } u; /* proto data returned from server */ + long setuplength; /* number of bytes in setup message */ + long usedbytes = 0; /* number of bytes we have processed */ + unsigned long mask; + long int conn_buf_size; + char *xlib_buffer_size; + +#if !USE_XCB + bzero((char *) &client, sizeof(client)); + bzero((char *) &prefix, sizeof(prefix)); +#endif /* !USE_XCB */ + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "\nXOpenDisplay: Called with display [%s].\n", display); +#endif + /* + * If the display specifier string supplied as an argument to this + * routine is NULL or a pointer to NULL, read the DISPLAY variable. + */ + if (display == NULL || *display == '\0') { + if ((display_name = getenv("DISPLAY")) == NULL) { + /* Oops! No DISPLAY environment variable - error. */ + return(NULL); + } + } + else { + /* Display is non-NULL, copy the pointer */ + display_name = (char *)display; + } + +/* + * Set the default error handlers. This allows the global variables to + * default to NULL for use with shared libraries. + */ + if (_XErrorFunction == NULL) (void) XSetErrorHandler (NULL); + if (_XIOErrorFunction == NULL) (void) XSetIOErrorHandler (NULL); + +/* + * Attempt to allocate a display structure. Return NULL if allocation fails. + */ + if ((dpy = Xcalloc(1, sizeof(Display))) == NULL) { + return(NULL); + } + +/* + * Call the Connect routine to get the transport connection object. + * If NULL is returned, the connection failed. The connect routine + * will set fullname to point to the expanded name. + */ + +#if USE_XCB + if(!_XConnectXCB(dpy, display, &fullname, &iscreen)) { + /* Try falling back on other transports if no transport specified */ + const char *slash = strrchr(display_name, '/'); + if(slash == NULL) { + const char *protocols[] = {"local", "unix", "tcp", "inet6", "inet", NULL}; + const char **s; + size_t buf_size = strlen(display_name) + 7; // max strlen + 2 (null + /) + char *buf = Xmalloc(buf_size * sizeof(char)); + + if(buf) { + for(s = protocols; buf && *s; s++) { + snprintf(buf, buf_size, "%s/%s", *s, display_name); + if(_XConnectXCB(dpy, buf, &fullname, &iscreen)) + goto fallback_success; + } + Xfree(buf); + } + } + + dpy->display_name = fullname; + OutOfMemory(dpy, NULL); + return NULL; + } +fallback_success: +#else /* !USE_XCB */ + if ((dpy->trans_conn = _X11TransConnectDisplay ( + display_name, &fullname, &idisplay, + &iscreen, &conn_auth_name, + &conn_auth_namelen, &conn_auth_data, + &conn_auth_datalen)) == NULL) { + Xfree ((char *) dpy); + return(NULL); + } + + dpy->fd = _X11TransGetConnectionNumber (dpy->trans_conn); +#endif /* USE_XCB */ + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "\nXOpenDisplay: Connected display with dpy->fd = [%d].\n", dpy->fd); +#endif + /* Initialize as much of the display structure as we can. + * Initialize pointers to NULL so that XFreeDisplayStructure will + * work if we run out of memory before we finish initializing. + */ + dpy->display_name = fullname; + dpy->keysyms = (KeySym *) NULL; + dpy->modifiermap = NULL; + dpy->lock_meaning = NoSymbol; + dpy->keysyms_per_keycode = 0; + dpy->xdefaults = (char *)NULL; + dpy->scratch_length = 0L; + dpy->scratch_buffer = NULL; + dpy->key_bindings = NULL; + dpy->ext_procs = (_XExtension *)NULL; + dpy->ext_data = (XExtData *)NULL; + dpy->ext_number = 0; + dpy->event_vec[X_Error] = _XUnknownWireEvent; + dpy->event_vec[X_Reply] = _XUnknownWireEvent; + dpy->wire_vec[X_Error] = _XUnknownNativeEvent; + dpy->wire_vec[X_Reply] = _XUnknownNativeEvent; + for (i = KeyPress; i < LASTEvent; i++) { + dpy->event_vec[i] = _XWireToEvent; + dpy->wire_vec[i] = NULL; + } + for (i = LASTEvent; i < 128; i++) { + dpy->event_vec[i] = _XUnknownWireEvent; + dpy->wire_vec[i] = _XUnknownNativeEvent; + } + dpy->resource_id = 0; + dpy->db = (struct _XrmHashBucketRec *)NULL; + dpy->cursor_font = None; + dpy->flags = 0; + dpy->async_handlers = NULL; + dpy->screens = NULL; + dpy->vendor = NULL; + dpy->buffer = NULL; + dpy->atoms = NULL; + dpy->error_vec = NULL; + dpy->context_db = NULL; + dpy->free_funcs = NULL; + dpy->pixmap_format = NULL; + dpy->cms.clientCmaps = NULL; + dpy->cms.defaultCCCs = NULL; + dpy->cms.perVisualIntensityMaps = NULL; + dpy->im_filters = NULL; + dpy->bigreq_size = 0; + dpy->lock = NULL; + dpy->lock_fns = NULL; + dpy->qfree = NULL; + dpy->next_event_serial_num = 1; + dpy->im_fd_info = NULL; + dpy->im_fd_length = 0; + dpy->conn_watchers = NULL; + dpy->watcher_count = 0; + dpy->filedes = NULL; + dpy->flushes = NULL; + dpy->xcmisc_opcode = 0; + dpy->xkb_info = NULL; + +/* + * Setup other information in this display structure. + */ + dpy->vnumber = X_PROTOCOL; + dpy->resource_alloc = _XAllocID; + dpy->idlist_alloc = _XAllocIDs; + dpy->synchandler = NULL; + dpy->savedsynchandler = NULL; + dpy->request = 0; + dpy->last_request_read = 0; + dpy->default_screen = iscreen; /* Value returned by ConnectDisplay */ + dpy->last_req = (char *)&_dummy_request; + + /* Initialize the display lock */ + if (InitDisplayLock(dpy) != 0) { + OutOfMemory (dpy, setup); + return(NULL); + } + + if (!_XPollfdCacheInit(dpy)) { + OutOfMemory (dpy, setup); + return(NULL); + } + + /* Set up the output buffers. */ +#ifndef XLIBDEFAULTBUFSIZE +#define XLIBDEFAULTBUFSIZE 16384 /* 16k */ +#endif +#ifndef XLIBMINBUFSIZE +#define XLIBMINBUFSIZE BUFSIZE /* old default buffer size */ +#endif + xlib_buffer_size = getenv("XLIBBUFFERSIZE"); + +#ifdef __sun /* Backwards compatibility for old Solaris libX11 name */ + if (xlib_buffer_size == NULL) + xlib_buffer_size = getenv("XSUNBUFFERSIZE"); +#endif + + if (xlib_buffer_size == NULL) + conn_buf_size = XLIBDEFAULTBUFSIZE; + else + conn_buf_size = 1024 * strtol(xlib_buffer_size, NULL, 10); + if (conn_buf_size < XLIBMINBUFSIZE) + conn_buf_size = XLIBMINBUFSIZE; +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf (stderr, "Xlib: Running with XLIBBUFFERSIZE [%d] XLIBMINBUFSIZE [%d] " + "buffer size [%ld].\n", XLIBDEFAULTBUFSIZE, XLIBMINBUFSIZE, conn_buf_size); +#endif + + if ((dpy->bufptr = dpy->buffer = Xcalloc(1, conn_buf_size)) == NULL) { + OutOfMemory (dpy, setup); + return(NULL); + } + dpy->bufmax = dpy->buffer + conn_buf_size; +#if USE_XCB + dpy->xcb->real_bufmax = dpy->bufmax; + dpy->bufmax = dpy->buffer; +#endif + + /* Set up the input event queue and input event queue parameters. */ + dpy->head = dpy->tail = NULL; + dpy->qlen = 0; + + /* Set up free-function record */ + if ((dpy->free_funcs = Xcalloc(1, sizeof(_XFreeFuncRec))) == NULL) { + OutOfMemory (dpy, setup); + return(NULL); + } + +#if !USE_XCB +/* + * The xConnClientPrefix describes the initial connection setup information + * and is followed by the authorization information. Sites that are interested + * in security are strongly encouraged to use an authentication and + * authorization system such as Kerberos. + */ + endian = 1; + if (*(char *) &endian) + client.byteOrder = '\154'; /* 'l' */ + else + client.byteOrder = '\102'; /* 'B' */ + client.majorVersion = X_PROTOCOL; + client.minorVersion = X_PROTOCOL_REVISION; + client.nbytesAuthProto = conn_auth_namelen; + client.nbytesAuthString = conn_auth_datalen; + prefixread = _XSendClientPrefix(dpy, &client, + conn_auth_name, conn_auth_data, + &prefix); + if (prefixread < 0) + { + _XDisconnectDisplay (dpy->trans_conn); + Xfree ((char *)dpy); + return(NULL); + } + if (conn_auth_name) Xfree(conn_auth_name); + if (conn_auth_data) Xfree(conn_auth_data); +/* + * Now see if connection was accepted... + */ + /* these internal functions expect the display to be locked */ + LockDisplay(dpy); + + if (prefixread == 0) + _XRead (dpy, (char *)&prefix,(long)SIZEOF(xConnSetupPrefix)); + + /* an Authenticate reply we weren't expecting? */ + if (prefix.success != xTrue && prefix.success != xFalse) { + fprintf (stderr, + "Xlib: unexpected connection setup reply from server, type %d.\r\n", + prefix.success); + _XDisconnectDisplay (dpy->trans_conn); + Xfree ((char *)dpy); + return(NULL); + } + + if (prefix.majorVersion != X_PROTOCOL) { + /* XXX - printing messages marks a bad programming interface */ +#ifdef NX_TRANS_SOCKET + if (_X11TransSocketProxyConnInfo(dpy->trans_conn) == NULL) { + fprintf (stderr, "Xlib: client uses different protocol version (%d) " + "than server (%d)!\r\n", X_PROTOCOL, prefix.majorVersion); + } +#else + fprintf (stderr, + "Xlib: client uses different protocol version (%d) than server (%d)!\r\n", + X_PROTOCOL, prefix.majorVersion); +#endif + _XDisconnectDisplay (dpy->trans_conn); + Xfree ((char *)dpy); + return(NULL); + } +#endif /* !USE_XCB */ + +#if USE_XCB + { + const struct xcb_setup_t *xcbsetup = xcb_get_setup(dpy->xcb->connection); + memcpy(&prefix, xcbsetup, sizeof(prefix)); + setuplength = prefix.length << 2; + setup = (char *) xcbsetup; + setup += SIZEOF(xConnSetupPrefix); + u.setup = (xConnSetup *) setup; + } +#else /* !USE_XCB */ + setuplength = prefix.length << 2; + if ( (u.setup = (xConnSetup *) + (setup = Xmalloc ((unsigned) setuplength))) == NULL) { + _XDisconnectDisplay (dpy->trans_conn); + Xfree ((char *)dpy); + return(NULL); + } + _XRead (dpy, (char *)u.setup, setuplength); + +/* + * If the connection was not accepted by the server due to problems, + * give error message to the user.... + */ + if (prefix.success != xTrue) { + /* XXX - printing messages marks a bad programming interface */ + fprintf (stderr, + "Xlib: connection to \"%s\" refused by server\r\nXlib: ", + fullname); + + if (prefix.lengthReason > setuplength) { + fprintf (stderr, "Xlib: Broken initial reply: length of reason > length of packet\r\n"); + }else{ + (void) fwrite (u.failure, (size_t)sizeof(char), + (size_t)prefix.lengthReason, stderr); + (void) fwrite ("\r\n", sizeof(char), 2, stderr); + } + + OutOfMemory(dpy, setup); + return (NULL); + } +#endif /* USE_XCB */ + +/* + * Check if the reply was long enough to get any information out of it. + */ + usedbytes = sz_xConnSetup; + if (setuplength < usedbytes ) { + fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); + OutOfMemory(dpy, setup); + return (NULL); + } + +/* + * We succeeded at authorization, so let us move the data into + * the display structure. + */ + dpy->proto_major_version= prefix.majorVersion; + dpy->proto_minor_version= prefix.minorVersion; + dpy->release = u.setup->release; + dpy->resource_base = u.setup->ridBase; + dpy->resource_mask = u.setup->ridMask; + dpy->min_keycode = u.setup->minKeyCode; + dpy->max_keycode = u.setup->maxKeyCode; + dpy->motion_buffer = u.setup->motionBufferSize; + dpy->nformats = u.setup->numFormats; + dpy->nscreens = u.setup->numRoots; + dpy->byte_order = u.setup->imageByteOrder; + dpy->bitmap_unit = u.setup->bitmapScanlineUnit; + dpy->bitmap_pad = u.setup->bitmapScanlinePad; + dpy->bitmap_bit_order = u.setup->bitmapBitOrder; + dpy->max_request_size = u.setup->maxRequestSize; + mask = dpy->resource_mask; + dpy->resource_shift = 0; + if (!mask) + { + fprintf (stderr, "Xlib: connection to \"%s\" invalid setup\n", + fullname); + OutOfMemory(dpy, setup); + return (NULL); + } + + while (!(mask & 1)) { + dpy->resource_shift++; + mask = mask >> 1; + } + dpy->resource_max = (dpy->resource_mask >> dpy->resource_shift) - 5; +/* + * now extract the vendor string... String must be null terminated, + * padded to multiple of 4 bytes. + */ + /* Check for a sane vendor string length */ + if (u.setup->nbytesVendor > 256) { + OutOfMemory(dpy, setup); + return (NULL); + } + + dpy->vendor = Xmalloc(u.setup->nbytesVendor + 1); + if (dpy->vendor == NULL) { + OutOfMemory(dpy, setup); + return (NULL); + } + vendorlen = u.setup->nbytesVendor; + +/* + * validate setup length + */ + usedbytes += (vendorlen + 3) & ~3; + if (setuplength < usedbytes) { + fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); + OutOfMemory(dpy, setup); + return (NULL); + } + + u.setup = (xConnSetup *) (((char *) u.setup) + sz_xConnSetup); + (void) strncpy(dpy->vendor, u.vendor, vendorlen); + dpy->vendor[vendorlen] = '\0'; + vendorlen = (vendorlen + 3) & ~3; /* round up */ + u.vendor += vendorlen; + +/* + * Now iterate down setup information..... + */ + dpy->pixmap_format = Xcalloc(dpy->nformats, sizeof(ScreenFormat)); + if (dpy->pixmap_format == NULL) { + OutOfMemory (dpy, setup); + return(NULL); + } +/* + * First decode the Z axis Screen format information. + */ + usedbytes += dpy->nformats * sz_xPixmapFormat; + + if (setuplength < usedbytes) { + fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); + OutOfMemory (dpy, setup); + return(NULL); + } + + for (i = 0; i < dpy->nformats; i++) { + register ScreenFormat *fmt = &dpy->pixmap_format[i]; + fmt->depth = u.sf->depth; + fmt->bits_per_pixel = u.sf->bitsPerPixel; + fmt->scanline_pad = u.sf->scanLinePad; + fmt->ext_data = NULL; + u.sf = (xPixmapFormat *) (((char *) u.sf) + sz_xPixmapFormat); + } + +/* + * next the Screen structures. + */ + dpy->screens = Xcalloc(dpy->nscreens, sizeof(Screen)); + if (dpy->screens == NULL) { + OutOfMemory (dpy, setup); + return(NULL); + } + +/* + * Now go deal with each screen structure. + */ + for (i = 0; i < dpy->nscreens; i++) { + register Screen *sp = &dpy->screens[i]; + VisualID root_visualID; + + usedbytes += sz_xWindowRoot; + if (setuplength < usedbytes) { + fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); + OutOfMemory (dpy, setup); + return(NULL); + } + + root_visualID = u.rp->rootVisualID; + sp->display = dpy; + sp->root = u.rp->windowId; + sp->cmap = u.rp->defaultColormap; + sp->white_pixel = u.rp->whitePixel; + sp->black_pixel = u.rp->blackPixel; + sp->root_input_mask = u.rp->currentInputMask; + sp->width = u.rp->pixWidth; + sp->height = u.rp->pixHeight; + sp->mwidth = u.rp->mmWidth; + sp->mheight = u.rp->mmHeight; + sp->min_maps = u.rp->minInstalledMaps; + sp->max_maps = u.rp->maxInstalledMaps; + sp->backing_store= u.rp->backingStore; + sp->save_unders = u.rp->saveUnders; + sp->root_depth = u.rp->rootDepth; + sp->ndepths = u.rp->nDepths; + sp->ext_data = NULL; + u.rp = (xWindowRoot *) (((char *) u.rp) + sz_xWindowRoot); +/* + * lets set up the depth structures. + */ + sp->depths = Xcalloc(sp->ndepths, sizeof(Depth)); + if (sp->depths == NULL) { + OutOfMemory (dpy, setup); + return(NULL); + } + /* + * for all depths on this screen. + */ + for (j = 0; j < sp->ndepths; j++) { + Depth *dp = &sp->depths[j]; + + usedbytes += sz_xDepth; + if (setuplength < usedbytes) { + fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); + OutOfMemory (dpy, setup); + return(NULL); + } + + dp->depth = u.dp->depth; + dp->nvisuals = u.dp->nVisuals; + u.dp = (xDepth *) (((char *) u.dp) + sz_xDepth); + if (dp->nvisuals > 0) { + dp->visuals = Xcalloc(dp->nvisuals, sizeof(Visual)); + if (dp->visuals == NULL) { + OutOfMemory (dpy, setup); + return(NULL); + } + for (k = 0; k < dp->nvisuals; k++) { + register Visual *vp = &dp->visuals[k]; + + usedbytes += sz_xVisualType; + if (setuplength < usedbytes) { + fprintf (stderr, "Xlib: Broken initial reply: Too short (%ld)\n", setuplength); + OutOfMemory (dpy, setup); + return(NULL); + } + + vp->visualid = u.vp->visualID; + vp->class = u.vp->class; + vp->bits_per_rgb= u.vp->bitsPerRGB; + vp->map_entries = u.vp->colormapEntries; + vp->red_mask = u.vp->redMask; + vp->green_mask = u.vp->greenMask; + vp->blue_mask = u.vp->blueMask; + vp->ext_data = NULL; + u.vp = (xVisualType *) (((char *) u.vp) + + sz_xVisualType); + } + if (dp->depth == 32 && getenv ("XLIB_SKIP_ARGB_VISUALS")) + { + Xfree (dp->visuals); + dp->visuals = NULL; + dp->nvisuals = 0; + } + } else { + dp->visuals = (Visual *) NULL; + } + } + sp->root_visual = _XVIDtoVisual(dpy, root_visualID); + } + + if(usedbytes != setuplength){ + /* Sanity check, shouldn't happen. */ + fprintf(stderr, "Xlib: Did not parse entire setup message: " + "parsed: %ld, message: %ld\n", + usedbytes, setuplength); + OutOfMemory(dpy, setup); + return(NULL); + } + +/* + * Now start talking to the server to setup all other information... + */ + +#if !USE_XCB + Xfree (setup); /* all finished with setup information */ +#endif /* !USE_XCB */ + +/* + * Make sure default screen is legal. + */ + if (iscreen >= dpy->nscreens) { + OutOfMemory(dpy, (char *) NULL); + return(NULL); + } + +#if !USE_XCB +/* + * finished calling internal routines, now unlock for external routines + */ + UnlockDisplay(dpy); +#endif /* !USE_XCB */ + +#if USE_XCB +/* + * get availability of large requests + */ + dpy->bigreq_size = xcb_get_maximum_request_length(dpy->xcb->connection); + if(dpy->bigreq_size <= dpy->max_request_size) + dpy->bigreq_size = 0; +#endif /* USE_XCB */ + +/* + * Set up other stuff clients are always going to use. + */ + for (i = 0; i < dpy->nscreens; i++) { + register Screen *sp = &dpy->screens[i]; + XGCValues values; + values.foreground = sp->black_pixel; + values.background = sp->white_pixel; + if ((sp->default_gc = XCreateGC (dpy, sp->root, + GCForeground|GCBackground, + &values)) == NULL) { + OutOfMemory(dpy, (char *) NULL); + return (NULL); + } + } +/* + * call into synchronization routine so that all programs can be + * forced synchronous + */ + (void) XSynchronize(dpy, _Xdebug); + +/* + * get the resource manager database off the root window. + */ + LockDisplay(dpy); + { + xGetPropertyReply reply; + xGetPropertyReq *req; +#if !USE_XCB + _XAsyncHandler async; + _XBigReqState async_state; + xQueryExtensionReq *qreq; + xBigReqEnableReq *breq; + xBigReqEnableReply brep; + + GetReq(QueryExtension, qreq); + async_state.seq = dpy->request; + async_state.opcode = 0; + async.next = dpy->async_handlers; + async.handler = _XBigReqHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + qreq->nbytes = bignamelen; + qreq->length += (bignamelen+3)>>2; + Data(dpy, XBigReqExtensionName, bignamelen); +#endif /* !USE_XCB */ + + GetReq (GetProperty, req); + req->window = RootWindow(dpy, 0); + req->property = XA_RESOURCE_MANAGER; + req->type = XA_STRING; + req->delete = False; + req->longOffset = 0; + req->longLength = 100000000L; + + if (_XReply (dpy, (xReply *) &reply, 0, xFalse)) { + if (reply.format == 8 && reply.propertyType == XA_STRING && + (reply.nItems + 1 > 0) && + (reply.nItems <= req->longLength * 4) && + (dpy->xdefaults = Xmalloc (reply.nItems + 1))) { + _XReadPad (dpy, dpy->xdefaults, reply.nItems); + dpy->xdefaults[reply.nItems] = '\0'; + } + else if (reply.propertyType != None) + _XEatDataWords(dpy, reply.length); + } +#if !USE_XCB + DeqAsyncHandler(dpy, &async); + if (async_state.opcode) { + GetReq(BigReqEnable, breq); + breq->reqType = async_state.opcode; + breq->brReqType = X_BigReqEnable; + if (_XReply(dpy, (xReply *)&brep, 0, xFalse)) + dpy->bigreq_size = brep.max_request_size; + } +#endif /* !USE_XCB */ + } + UnlockDisplay(dpy); + +#ifdef MOTIFBC + { + extern Display *_XHeadOfDisplayList; + _XHeadOfDisplayList = dpy; + } +#endif +#ifdef XKB + XkbUseExtension(dpy,NULL,NULL); +#endif +/* + * and return successfully + */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "XOpenDisplay: Returning display at [%p].\n", dpy); +#endif + return(dpy); +} + +#if !USE_XCB +static Bool +_XBigReqHandler( + register Display *dpy, + register xReply *rep, + char *buf, + int len, + XPointer data) +{ + _XBigReqState *state; + xQueryExtensionReply replbuf; + xQueryExtensionReply *repl; + + state = (_XBigReqState *)data; + if (dpy->last_request_read != state->seq) + return False; + if (rep->generic.type == X_Error) + return True; + repl = (xQueryExtensionReply *) + _XGetAsyncReply(dpy, (char *)&replbuf, rep, buf, len, + (SIZEOF(xQueryExtensionReply) - SIZEOF(xReply)) >> 2, + True); + if (repl->present) + state->opcode = repl->major_opcode; + return True; +} +#endif /* !USE_XCB */ + + +/* XFreeDisplayStructure frees all the storage associated with a + * Display. It is used by XOpenDisplay if it runs out of memory, + * and also by XCloseDisplay. It needs to check whether all pointers + * are non-NULL before dereferencing them, since it may be called + * by XOpenDisplay before the Display structure is fully formed. + * XOpenDisplay must be sure to initialize all the pointers to NULL + * before the first possible call on this. + */ + +void _XFreeDisplayStructure(Display *dpy) +{ + /* move all cookies in the EQ to the jar, then free them. */ + if (dpy->qfree) { + _XQEvent *qelt = dpy->qfree; + while (qelt) { + if (_XIsEventCookie(dpy, &qelt->event)) + _XStoreEventCookie(dpy, &qelt->event); + qelt = qelt->next; + } + } + if (dpy->cookiejar) + _XFreeEventCookies(dpy); + while (dpy->ext_procs) { + _XExtension *ext = dpy->ext_procs; + dpy->ext_procs = ext->next; + Xfree (ext->name); + Xfree (ext); + } + if (dpy->im_filters) + (*dpy->free_funcs->im_filters)(dpy); + if (dpy->cms.clientCmaps) + (*dpy->free_funcs->clientCmaps)(dpy); + if (dpy->cms.defaultCCCs) + (*dpy->free_funcs->defaultCCCs)(dpy); + if (dpy->cms.perVisualIntensityMaps) + (*dpy->free_funcs->intensityMaps)(dpy); + if (dpy->atoms) + (*dpy->free_funcs->atoms)(dpy); + if (dpy->modifiermap) + (*dpy->free_funcs->modifiermap)(dpy->modifiermap); + if (dpy->key_bindings) + (*dpy->free_funcs->key_bindings)(dpy); + if (dpy->context_db) + (*dpy->free_funcs->context_db)(dpy); + if (dpy->xkb_info) + (*dpy->free_funcs->xkb)(dpy); + + /* if RM database was allocated by XGetDefault() free it */ + if (dpy->db && (dpy->flags & XlibDisplayDfltRMDB)) + XrmDestroyDatabase(dpy->db); + + if (dpy->screens) { + register int i; + + for (i = 0; i < dpy->nscreens; i++) { + Screen *sp = &dpy->screens[i]; + + if (sp->depths) { + register int j; + + for (j = 0; j < sp->ndepths; j++) { + Depth *dp = &sp->depths[j]; + + if (dp->visuals) { + register int k; + + for (k = 0; k < dp->nvisuals; k++) + _XFreeExtData (dp->visuals[k].ext_data); + Xfree (dp->visuals); + } + } + + Xfree (sp->depths); + } + + _XFreeExtData (sp->ext_data); + } + + Xfree (dpy->screens); + } + + if (dpy->pixmap_format) { + register int i; + + for (i = 0; i < dpy->nformats; i++) + _XFreeExtData (dpy->pixmap_format[i].ext_data); + Xfree (dpy->pixmap_format); + } + + free(dpy->display_name); + + Xfree (dpy->vendor); + Xfree (dpy->buffer); + Xfree (dpy->keysyms); + Xfree (dpy->xdefaults); + Xfree (dpy->error_vec); + + _XFreeExtData (dpy->ext_data); + + Xfree (dpy->free_funcs); + Xfree (dpy->scratch_buffer); + FreeDisplayLock(dpy); + + if (dpy->qfree) { + register _XQEvent *qelt = dpy->qfree; + + while (qelt) { + register _XQEvent *qnxt = qelt->next; + Xfree (qelt); + qelt = qnxt; + } + } + while (dpy->im_fd_info) { + struct _XConnectionInfo *conni = dpy->im_fd_info; + dpy->im_fd_info = conni->next; + Xfree (conni->watch_data); + Xfree (conni); + } + if (dpy->conn_watchers) { + struct _XConnWatchInfo *watcher = dpy->conn_watchers; + dpy->conn_watchers = watcher->next; + Xfree (watcher); + } + + Xfree (dpy->filedes); + +#if USE_XCB + _XFreeX11XCBStructure(dpy); +#endif /* USE_XCB */ + + Xfree (dpy); +} + +/* OutOfMemory is called if malloc fails. XOpenDisplay returns NULL + after this returns. */ + +static void OutOfMemory(Display *dpy, char *setup) +{ +#if USE_XCB + if(dpy->xcb->connection) + xcb_disconnect(dpy->xcb->connection); +#else /* !USE_XCB */ + _XDisconnectDisplay (dpy->trans_conn); +#endif /* USE_XCB */ + _XFreeDisplayStructure (dpy); +#if !USE_XCB + if (setup) Xfree (setup); +#endif /* !USE_XCB */ +} diff --git a/nx-X11/lib/src/ParseCmd.c b/nx-X11/lib/src/ParseCmd.c new file mode 100644 index 000000000..b4bb97654 --- /dev/null +++ b/nx-X11/lib/src/ParseCmd.c @@ -0,0 +1,225 @@ + +/*********************************************************** + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +/* XrmParseCommand() + + Parse command line and store argument values into resource database + + Allows any un-ambiguous abbreviation for an option name, but requires + that the table be ordered with any options that are prefixes of + other options appearing before the longer version in the table. +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include + + +static void _XReportParseError(XrmOptionDescRec *arg, const char *msg) +{ + (void) fprintf(stderr, "Error parsing argument \"%s\" (%s); %s\n", + arg->option, arg->specifier, msg); + exit(1); +} + +void +XrmParseCommand( + XrmDatabase *pdb, /* data base */ + register XrmOptionDescList options, /* pointer to table of valid options */ + int num_options, /* number of options */ + _Xconst char *prefix, /* name to prefix resources with */ + int *argc, /* address of argument count */ + char **argv) /* argument list (command line) */ +{ + int foundOption; + char **argsave; + register int i, myargc; + XrmBinding bindings[100]; + XrmQuark quarks[100]; + XrmBinding *start_bindings; + XrmQuark *start_quarks; + char *optP, *argP = NULL, optchar, argchar = 0; + int matches; + enum {DontCare, Check, NotSorted, Sorted} table_is_sorted; + char **argend; + +#define PutCommandResource(value_str) \ + { \ + XrmStringToBindingQuarkList( \ + options[i].specifier, start_bindings, start_quarks); \ + XrmQPutStringResource(pdb, bindings, quarks, value_str); \ + } /* PutCommandResource */ + + myargc = (*argc); + argend = argv + myargc; + argsave = ++argv; + + /* Initialize bindings/quark list with prefix (typically app name). */ + quarks[0] = XrmStringToName(prefix); + bindings[0] = XrmBindTightly; + start_quarks = quarks+1; + start_bindings = bindings+1; + + table_is_sorted = (myargc > 2) ? Check : DontCare; + for (--myargc; myargc > 0; --myargc, ++argv) { + foundOption = False; + matches = 0; + for (i=0; i < num_options; ++i) { + /* checking the sort order first insures we don't have to + re-do the check if the arg hits on the last entry in + the table. Useful because usually '=' is the last entry + and users frequently specify geometry early in the command */ + if (table_is_sorted == Check && i > 0 && + strcmp(options[i].option, options[i-1].option) < 0) { + table_is_sorted = NotSorted; + } + for (argP = *argv, optP = options[i].option; + (optchar = *optP++) && + (argchar = *argP++) && + argchar == optchar;); + if (!optchar) { + if (!*argP || + options[i].argKind == XrmoptionStickyArg || + options[i].argKind == XrmoptionIsArg) { + /* give preference to exact matches, StickyArg and IsArg */ + matches = 1; + foundOption = i; + break; + } + } + else if (!argchar) { + /* may be an abbreviation for this option */ + matches++; + foundOption = i; + } + else if (table_is_sorted == Sorted && optchar > argchar) { + break; + } + if (table_is_sorted == Check && i > 0 && + strcmp(options[i].option, options[i-1].option) < 0) { + table_is_sorted = NotSorted; + } + } + if (table_is_sorted == Check && i >= (num_options-1)) + table_is_sorted = Sorted; + if (matches == 1) { + i = foundOption; + switch (options[i].argKind){ + case XrmoptionNoArg: + --(*argc); + PutCommandResource(options[i].value); + break; + + case XrmoptionIsArg: + --(*argc); + PutCommandResource(*argv); + break; + + case XrmoptionStickyArg: + --(*argc); + PutCommandResource(argP); + break; + + case XrmoptionSepArg: + if (myargc > 1) { + ++argv; --myargc; --(*argc); --(*argc); + PutCommandResource(*argv); + } else + (*argsave++) = (*argv); + break; + + case XrmoptionResArg: + if (myargc > 1) { + ++argv; --myargc; --(*argc); --(*argc); + XrmPutLineResource(pdb, *argv); + } else + (*argsave++) = (*argv); + break; + + case XrmoptionSkipArg: + if (myargc > 1) { + --myargc; + (*argsave++) = (*argv++); + } + (*argsave++) = (*argv); + break; + + case XrmoptionSkipLine: + for (; myargc > 0; myargc--) + (*argsave++) = (*argv++); + break; + + case XrmoptionSkipNArgs: + { + register int j = 1 + (long) options[i].value; + + if (j > myargc) j = myargc; + for (; j > 0; j--) { + (*argsave++) = (*argv++); + myargc--; + } + argv--; /* went one too far before */ + myargc++; + } + break; + + default: + _XReportParseError (&options[i], "unknown kind"); + break; + } + } + else + (*argsave++) = (*argv); /*compress arglist*/ + } + + if (argsave < argend) + (*argsave)=NULL; /* put NULL terminator on compressed argv */ +} diff --git a/nx-X11/lib/src/ParseCol.c b/nx-X11/lib/src/ParseCol.c new file mode 100644 index 000000000..e997b1b8c --- /dev/null +++ b/nx-X11/lib/src/ParseCol.c @@ -0,0 +1,138 @@ +/* + +Copyright 1985, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" + + +Status +XParseColor ( + register Display *dpy, + Colormap cmap, + _Xconst char *spec, + XColor *def) +{ + register int n, i; + int r, g, b; + char c; + XcmsCCC ccc; + XcmsColor cmsColor; + + if (!spec) return(0); + n = strlen (spec); + if (*spec == '#') { + /* + * RGB + */ + spec++; + n--; + if (n != 3 && n != 6 && n != 9 && n != 12) + return (0); + n /= 3; + g = b = 0; + do { + r = g; + g = b; + b = 0; + for (i = n; --i >= 0; ) { + c = *spec++; + b <<= 4; + if (c >= '0' && c <= '9') + b |= c - '0'; + else if (c >= 'A' && c <= 'F') + b |= c - ('A' - 10); + else if (c >= 'a' && c <= 'f') + b |= c - ('a' - 10); + else return (0); + } + } while (*spec != '\0'); + n <<= 2; + n = 16 - n; + def->red = r << n; + def->green = g << n; + def->blue = b << n; + def->flags = DoRed | DoGreen | DoBlue; + return (1); + } + + +#ifdef XCMS + /* + * Let's Attempt to use Xcms and i18n approach to Parse Color + */ + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { + const char *tmpName = spec; + + switch (_XcmsResolveColorString(ccc, &tmpName, &cmsColor, + XcmsRGBFormat)) { + case XcmsSuccess: + case XcmsSuccessWithCompression: + cmsColor.pixel = def->pixel; + _XcmsRGB_to_XColor(&cmsColor, def, 1); + return(1); + case XcmsFailure: + case _XCMS_NEWNAME: + /* + * if the result was _XCMS_NEWNAME tmpName points to + * a string in cmsColNm.c:pairs table, for example, + * gray70 would become tekhvc:0.0/70.0/0.0 + */ + break; + } + } +#endif + + /* + * Xcms and i18n methods failed, so lets pass it to the server + * for parsing. + */ + { + xLookupColorReply reply; + register xLookupColorReq *req; + LockDisplay(dpy); + GetReq (LookupColor, req); + req->cmap = cmap; + req->nbytes = n = strlen(spec); + req->length += (n + 3) >> 2; + Data (dpy, spec, (long)n); + if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + def->red = reply.exactRed; + def->green = reply.exactGreen; + def->blue = reply.exactBlue; + def->flags = DoRed | DoGreen | DoBlue; + UnlockDisplay(dpy); + SyncHandle(); + return (1); + } +} diff --git a/nx-X11/lib/src/ParseGeom.c b/nx-X11/lib/src/ParseGeom.c new file mode 100644 index 000000000..dfd812fc9 --- /dev/null +++ b/nx-X11/lib/src/ParseGeom.c @@ -0,0 +1,162 @@ + +/* + +Copyright 1985, 1986, 1987,1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" + +/* + * XParseGeometry parses strings of the form + * "=x{+-}{+-}", where + * width, height, xoffset, and yoffset are unsigned integers. + * Example: "=80x24+300-49" + * The equal sign is optional. + * It returns a bitmask that indicates which of the four values + * were actually found in the string. For each value found, + * the corresponding argument is updated; for each value + * not found, the corresponding argument is left unchanged. + */ + +static int +ReadInteger(char *string, char **NextString) +{ + register int Result = 0; + int Sign = 1; + + if (*string == '+') + string++; + else if (*string == '-') + { + string++; + Sign = -1; + } + for (; (*string >= '0') && (*string <= '9'); string++) + { + Result = (Result * 10) + (*string - '0'); + } + *NextString = string; + if (Sign >= 0) + return (Result); + else + return (-Result); +} + +int +XParseGeometry ( +_Xconst char *string, +int *x, +int *y, +unsigned int *width, /* RETURN */ +unsigned int *height) /* RETURN */ +{ + int mask = NoValue; + register char *strind; + unsigned int tempWidth = 0, tempHeight = 0; + int tempX = 0, tempY = 0; + char *nextCharacter; + + if ( (string == NULL) || (*string == '\0')) return(mask); + if (*string == '=') + string++; /* ignore possible '=' at beg of geometry spec */ + + strind = (char *)string; + if (*strind != '+' && *strind != '-' && *strind != 'x') { + tempWidth = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= WidthValue; + } + + if (*strind == 'x' || *strind == 'X') { + strind++; + tempHeight = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= HeightValue; + } + + if ((*strind == '+') || (*strind == '-')) { + if (*strind == '-') { + strind++; + tempX = -ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return (0); + strind = nextCharacter; + mask |= XNegative; + + } + else + { strind++; + tempX = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + } + mask |= XValue; + if ((*strind == '+') || (*strind == '-')) { + if (*strind == '-') { + strind++; + tempY = -ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + mask |= YNegative; + + } + else + { + strind++; + tempY = ReadInteger(strind, &nextCharacter); + if (strind == nextCharacter) + return(0); + strind = nextCharacter; + } + mask |= YValue; + } + } + + /* If strind isn't at the end of the string the it's an invalid + geometry specification. */ + + if (*strind != '\0') return (0); + + if (mask & XValue) + *x = tempX; + if (mask & YValue) + *y = tempY; + if (mask & WidthValue) + *width = tempWidth; + if (mask & HeightValue) + *height = tempHeight; + return (mask); +} diff --git a/nx-X11/lib/src/PeekEvent.c b/nx-X11/lib/src/PeekEvent.c new file mode 100644 index 000000000..ffbaa05b4 --- /dev/null +++ b/nx-X11/lib/src/PeekEvent.c @@ -0,0 +1,61 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * Return the next event in the queue, + * BUT do not remove it from the queue. + * If none found, flush and wait until there is an event to peek. + */ + +int +XPeekEvent ( + register Display *dpy, + register XEvent *event) +{ + XEvent copy; + LockDisplay(dpy); + if (dpy->head == NULL) + _XReadEvents(dpy); +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockDisplay(dpy); + return 1; + } +#endif + *event = (dpy->head)->event; + if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { + _XStoreEventCookie(dpy, ©); + *event = copy; + } + UnlockDisplay(dpy); + return 1; +} + diff --git a/nx-X11/lib/src/PeekIfEv.c b/nx-X11/lib/src/PeekIfEv.c new file mode 100644 index 000000000..f2f2cede4 --- /dev/null +++ b/nx-X11/lib/src/PeekIfEv.c @@ -0,0 +1,84 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * return the next event in the queue that satisfies the predicate. + * BUT do not remove it from the queue. + * If none found, flush, and then wait until one satisfies the predicate. + */ + +int +XPeekIfEvent ( + register Display *dpy, + register XEvent *event, + Bool (*predicate)( + Display* /* display */, + XEvent* /* event */, + char* /* arg */ + ), + char *arg) +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + + LockDisplay(dpy); + prev = NULL; + while (1) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if(qelt->qserial_num > qe_serial + && (*predicate)(dpy, &qelt->event, arg)) { + XEvent copy; + *event = qelt->event; + if (_XCopyEventCookie(dpy, &event->xcookie, ©.xcookie)) { + _XStoreEventCookie(dpy, ©); + *event = copy; + } + UnlockDisplay(dpy); + return 0; + } + } + if (prev) + qe_serial = prev->qserial_num; + _XReadEvents(dpy); + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockDisplay(dpy); + return 0; + } +#endif + } +} + diff --git a/nx-X11/lib/src/Pending.c b/nx-X11/lib/src/Pending.c new file mode 100644 index 000000000..d3804c629 --- /dev/null +++ b/nx-X11/lib/src/Pending.c @@ -0,0 +1,69 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) +#include +#endif + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* Read in pending events if needed and return the number of queued events. */ + +int XEventsQueued ( + register Display *dpy, + int mode) +{ + int ret_val; +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "\nXEventsQueued: Called with a display at [%p].\n", (void *)dpy); +#endif + + LockDisplay(dpy); + if (dpy->qlen || (mode == QueuedAlready)) + ret_val = dpy->qlen; + else + ret_val = _XEventsQueued (dpy, mode); +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) + fprintf(stderr, "\nXEventsQueued: Going to unlock the display at [%p].\n", (void *)dpy); +#endif + UnlockDisplay(dpy); + return ret_val; +} + +int XPending (register Display *dpy) +{ + int ret_val; + LockDisplay(dpy); + if (dpy->qlen) + ret_val = dpy->qlen; + else + ret_val = _XEventsQueued (dpy, QueuedAfterFlush); + UnlockDisplay(dpy); + return ret_val; +} diff --git a/nx-X11/lib/src/PixFormats.c b/nx-X11/lib/src/PixFormats.c new file mode 100644 index 000000000..6d9f64d2c --- /dev/null +++ b/nx-X11/lib/src/PixFormats.c @@ -0,0 +1,62 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +/* + * XListPixmapFormats - return info from connection setup + */ + +XPixmapFormatValues *XListPixmapFormats ( + Display *dpy, + int *count) /* RETURN */ +{ + XPixmapFormatValues *formats = + Xmalloc(dpy->nformats * sizeof (XPixmapFormatValues)); + + if (formats) { + register int i; + register XPixmapFormatValues *f; + register ScreenFormat *sf; + + /* + * copy data from internal Xlib data structure in display + */ + for (i = dpy->nformats, f = formats, sf = dpy->pixmap_format; i > 0; + i--, f++, sf++) { + f->depth = sf->depth; + f->bits_per_pixel = sf->bits_per_pixel; + f->scanline_pad = sf->scanline_pad; + } + + *count = dpy->nformats; + } + return formats; +} diff --git a/nx-X11/lib/src/PmapBgnd.c b/nx-X11/lib/src/PmapBgnd.c new file mode 100644 index 000000000..9c5155833 --- /dev/null +++ b/nx-X11/lib/src/PmapBgnd.c @@ -0,0 +1,48 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetWindowBackgroundPixmap( + register Display *dpy, + Window w, + Pixmap pixmap) +{ + register xChangeWindowAttributesReq *req; + LockDisplay (dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWBackPixmap; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixmap); + UnlockDisplay (dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/PmapBord.c b/nx-X11/lib/src/PmapBord.c new file mode 100644 index 000000000..7e1be616e --- /dev/null +++ b/nx-X11/lib/src/PmapBord.c @@ -0,0 +1,48 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetWindowBorderPixmap( + register Display *dpy, + Window w, + Pixmap pixmap) +{ + register xChangeWindowAttributesReq *req; + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWBorderPixmap; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), pixmap); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/PolyReg.c b/nx-X11/lib/src/PolyReg.c new file mode 100644 index 000000000..cb30f8422 --- /dev/null +++ b/nx-X11/lib/src/PolyReg.c @@ -0,0 +1,635 @@ +/************************************************************************ + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +************************************************************************/ + +#define LARGE_COORDINATE 1000000 +#define SMALL_COORDINATE -LARGE_COORDINATE + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" +#include +#include "poly.h" + +/* + * InsertEdgeInET + * + * Insert the given edge into the edge table. + * First we must find the correct bucket in the + * Edge table, then find the right slot in the + * bucket. Finally, we can insert it. + * + */ +static void +InsertEdgeInET( + EdgeTable *ET, + EdgeTableEntry *ETE, + int scanline, + ScanLineListBlock **SLLBlock, + int *iSLLBlock) +{ + register EdgeTableEntry *start, *prev; + register ScanLineList *pSLL, *pPrevSLL; + ScanLineListBlock *tmpSLLBlock; + + /* + * find the right bucket to put the edge into + */ + pPrevSLL = &ET->scanlines; + pSLL = pPrevSLL->next; + while (pSLL && (pSLL->scanline < scanline)) + { + pPrevSLL = pSLL; + pSLL = pSLL->next; + } + + /* + * reassign pSLL (pointer to ScanLineList) if necessary + */ + if ((!pSLL) || (pSLL->scanline > scanline)) + { + if (*iSLLBlock > SLLSPERBLOCK-1) + { + tmpSLLBlock = Xmalloc(sizeof(ScanLineListBlock)); + (*SLLBlock)->next = tmpSLLBlock; + tmpSLLBlock->next = (ScanLineListBlock *)NULL; + *SLLBlock = tmpSLLBlock; + *iSLLBlock = 0; + } + pSLL = &((*SLLBlock)->SLLs[(*iSLLBlock)++]); + + pSLL->next = pPrevSLL->next; + pSLL->edgelist = (EdgeTableEntry *)NULL; + pPrevSLL->next = pSLL; + } + pSLL->scanline = scanline; + + /* + * now insert the edge in the right bucket + */ + prev = (EdgeTableEntry *)NULL; + start = pSLL->edgelist; + while (start && (start->bres.minor_axis < ETE->bres.minor_axis)) + { + prev = start; + start = start->next; + } + ETE->next = start; + + if (prev) + prev->next = ETE; + else + pSLL->edgelist = ETE; +} + +/* + * CreateEdgeTable + * + * This routine creates the edge table for + * scan converting polygons. + * The Edge Table (ET) looks like: + * + * EdgeTable + * -------- + * | ymax | ScanLineLists + * |scanline|-->------------>-------------->... + * -------- |scanline| |scanline| + * |edgelist| |edgelist| + * --------- --------- + * | | + * | | + * V V + * list of ETEs list of ETEs + * + * where ETE is an EdgeTableEntry data structure, + * and there is one ScanLineList per scanline at + * which an edge is initially entered. + * + */ + +static void +CreateETandAET( + register int count, + register XPoint *pts, + EdgeTable *ET, + EdgeTableEntry *AET, + register EdgeTableEntry *pETEs, + ScanLineListBlock *pSLLBlock) +{ + register XPoint *top, *bottom; + register XPoint *PrevPt, *CurrPt; + int iSLLBlock = 0; + int dy; + + if (count < 2) return; + + /* + * initialize the Active Edge Table + */ + AET->next = (EdgeTableEntry *)NULL; + AET->back = (EdgeTableEntry *)NULL; + AET->nextWETE = (EdgeTableEntry *)NULL; + AET->bres.minor_axis = SMALL_COORDINATE; + + /* + * initialize the Edge Table. + */ + ET->scanlines.next = (ScanLineList *)NULL; + ET->ymax = SMALL_COORDINATE; + ET->ymin = LARGE_COORDINATE; + pSLLBlock->next = (ScanLineListBlock *)NULL; + + PrevPt = &pts[count-1]; + + /* + * for each vertex in the array of points. + * In this loop we are dealing with two vertices at + * a time -- these make up one edge of the polygon. + */ + while (count--) + { + CurrPt = pts++; + + /* + * find out which point is above and which is below. + */ + if (PrevPt->y > CurrPt->y) + { + bottom = PrevPt, top = CurrPt; + pETEs->ClockWise = 0; + } + else + { + bottom = CurrPt, top = PrevPt; + pETEs->ClockWise = 1; + } + + /* + * don't add horizontal edges to the Edge table. + */ + if (bottom->y != top->y) + { + pETEs->ymax = bottom->y-1; /* -1 so we don't get last scanline */ + + /* + * initialize integer edge algorithm + */ + dy = bottom->y - top->y; + BRESINITPGONSTRUCT(dy, top->x, bottom->x, pETEs->bres); + + InsertEdgeInET(ET, pETEs, top->y, &pSLLBlock, &iSLLBlock); + + if (PrevPt->y > ET->ymax) + ET->ymax = PrevPt->y; + if (PrevPt->y < ET->ymin) + ET->ymin = PrevPt->y; + pETEs++; + } + + PrevPt = CurrPt; + } +} + +/* + * loadAET + * + * This routine moves EdgeTableEntries from the + * EdgeTable into the Active Edge Table, + * leaving them sorted by smaller x coordinate. + * + */ + +static void +loadAET( + register EdgeTableEntry *AET, + register EdgeTableEntry *ETEs) +{ + register EdgeTableEntry *pPrevAET; + register EdgeTableEntry *tmp; + + pPrevAET = AET; + AET = AET->next; + while (ETEs) + { + while (AET && (AET->bres.minor_axis < ETEs->bres.minor_axis)) + { + pPrevAET = AET; + AET = AET->next; + } + tmp = ETEs->next; + ETEs->next = AET; + if (AET) + AET->back = ETEs; + ETEs->back = pPrevAET; + pPrevAET->next = ETEs; + pPrevAET = ETEs; + + ETEs = tmp; + } +} + +/* + * computeWAET + * + * This routine links the AET by the + * nextWETE (winding EdgeTableEntry) link for + * use by the winding number rule. The final + * Active Edge Table (AET) might look something + * like: + * + * AET + * ---------- --------- --------- + * |ymax | |ymax | |ymax | + * | ... | |... | |... | + * |next |->|next |->|next |->... + * |nextWETE| |nextWETE| |nextWETE| + * --------- --------- ^-------- + * | | | + * V-------------------> V---> ... + * + */ +static void +computeWAET( + register EdgeTableEntry *AET) +{ + register EdgeTableEntry *pWETE; + register int inside = 1; + register int isInside = 0; + + AET->nextWETE = (EdgeTableEntry *)NULL; + pWETE = AET; + AET = AET->next; + while (AET) + { + if (AET->ClockWise) + isInside++; + else + isInside--; + + if ((!inside && !isInside) || + ( inside && isInside)) + { + pWETE->nextWETE = AET; + pWETE = AET; + inside = !inside; + } + AET = AET->next; + } + pWETE->nextWETE = (EdgeTableEntry *)NULL; +} + +/* + * InsertionSort + * + * Just a simple insertion sort using + * pointers and back pointers to sort the Active + * Edge Table. + * + */ + +static int +InsertionSort( + register EdgeTableEntry *AET) +{ + register EdgeTableEntry *pETEchase; + register EdgeTableEntry *pETEinsert; + register EdgeTableEntry *pETEchaseBackTMP; + register int changed = 0; + + AET = AET->next; + while (AET) + { + pETEinsert = AET; + pETEchase = AET; + while (pETEchase->back->bres.minor_axis > AET->bres.minor_axis) + pETEchase = pETEchase->back; + + AET = AET->next; + if (pETEchase != pETEinsert) + { + pETEchaseBackTMP = pETEchase->back; + pETEinsert->back->next = AET; + if (AET) + AET->back = pETEinsert->back; + pETEinsert->next = pETEchase; + pETEchase->back->next = pETEinsert; + pETEchase->back = pETEinsert; + pETEinsert->back = pETEchaseBackTMP; + changed = 1; + } + } + return(changed); +} + +/* + * Clean up our act. + */ +static void +FreeStorage( + register ScanLineListBlock *pSLLBlock) +{ + register ScanLineListBlock *tmpSLLBlock; + + while (pSLLBlock) + { + tmpSLLBlock = pSLLBlock->next; + Xfree(pSLLBlock); + pSLLBlock = tmpSLLBlock; + } +} + +/* + * Create an array of rectangles from a list of points. + * If indeed these things (POINTS, RECTS) are the same, + * then this proc is still needed, because it allocates + * storage for the array, which was allocated on the + * stack by the calling procedure. + * + */ +static int PtsToRegion( + register int numFullPtBlocks, + register int iCurPtBlock, + POINTBLOCK *FirstPtBlock, + REGION *reg) +{ + register BOX *rects; + register XPoint *pts; + register POINTBLOCK *CurPtBlock; + register int i; + register BOX *extents; + register int numRects; + BOX *prevRects = reg->rects; + + extents = ®->extents; + + numRects = ((numFullPtBlocks * NUMPTSTOBUFFER) + iCurPtBlock) >> 1; + + if (!(reg->rects = Xrealloc(reg->rects, sizeof(BOX) * numRects))) { + Xfree(prevRects); + return(0); + } + + reg->size = numRects; + CurPtBlock = FirstPtBlock; + rects = reg->rects - 1; + numRects = 0; + extents->x1 = MAXSHORT, extents->x2 = MINSHORT; + + for ( ; numFullPtBlocks >= 0; numFullPtBlocks--) { + /* the loop uses 2 points per iteration */ + i = NUMPTSTOBUFFER >> 1; + if (!numFullPtBlocks) + i = iCurPtBlock >> 1; + for (pts = CurPtBlock->pts; i--; pts += 2) { + if (pts->x == pts[1].x) + continue; + if (numRects && pts->x == rects->x1 && pts->y == rects->y2 && + pts[1].x == rects->x2 && + (numRects == 1 || rects[-1].y1 != rects->y1) && + (i && pts[2].y > pts[1].y)) { + rects->y2 = pts[1].y + 1; + continue; + } + numRects++; + rects++; + rects->x1 = pts->x; rects->y1 = pts->y; + rects->x2 = pts[1].x; rects->y2 = pts[1].y + 1; + if (rects->x1 < extents->x1) + extents->x1 = rects->x1; + if (rects->x2 > extents->x2) + extents->x2 = rects->x2; + } + CurPtBlock = CurPtBlock->next; + } + + if (numRects) { + extents->y1 = reg->rects->y1; + extents->y2 = rects->y2; + } else { + extents->x1 = 0; + extents->y1 = 0; + extents->x2 = 0; + extents->y2 = 0; + } + reg->numRects = numRects; + + return(TRUE); +} + +/* + * polytoregion + * + * Scan converts a polygon by returning a run-length + * encoding of the resultant bitmap -- the run-length + * encoding is in the form of an array of rectangles. + */ +Region +XPolygonRegion( + XPoint *Pts, /* the pts */ + int Count, /* number of pts */ + int rule) /* winding rule */ +{ + Region region; + register EdgeTableEntry *pAET; /* Active Edge Table */ + register int y; /* current scanline */ + register int iPts = 0; /* number of pts in buffer */ + register EdgeTableEntry *pWETE; /* Winding Edge Table Entry*/ + register ScanLineList *pSLL; /* current scanLineList */ + register XPoint *pts; /* output buffer */ + EdgeTableEntry *pPrevAET; /* ptr to previous AET */ + EdgeTable ET; /* header node for ET */ + EdgeTableEntry AET; /* header node for AET */ + EdgeTableEntry *pETEs; /* EdgeTableEntries pool */ + ScanLineListBlock SLLBlock; /* header for scanlinelist */ + int fixWAET = FALSE; + POINTBLOCK FirstPtBlock, *curPtBlock; /* PtBlock buffers */ + POINTBLOCK *tmpPtBlock; + int numFullPtBlocks = 0; + + if (! (region = XCreateRegion())) return (Region) NULL; + + /* special case a rectangle */ + pts = Pts; + if (((Count == 4) || + ((Count == 5) && (pts[4].x == pts[0].x) && (pts[4].y == pts[0].y))) && + (((pts[0].y == pts[1].y) && + (pts[1].x == pts[2].x) && + (pts[2].y == pts[3].y) && + (pts[3].x == pts[0].x)) || + ((pts[0].x == pts[1].x) && + (pts[1].y == pts[2].y) && + (pts[2].x == pts[3].x) && + (pts[3].y == pts[0].y)))) { + region->extents.x1 = min(pts[0].x, pts[2].x); + region->extents.y1 = min(pts[0].y, pts[2].y); + region->extents.x2 = max(pts[0].x, pts[2].x); + region->extents.y2 = max(pts[0].y, pts[2].y); + if ((region->extents.x1 != region->extents.x2) && + (region->extents.y1 != region->extents.y2)) { + region->numRects = 1; + *(region->rects) = region->extents; + } + return(region); + } + + if (Count < 2) return region; + + if (! (pETEs = Xmalloc(sizeof(EdgeTableEntry) * Count))) { + XDestroyRegion(region); + return (Region) NULL; + } + + pts = FirstPtBlock.pts; + CreateETandAET(Count, Pts, &ET, &AET, pETEs, &SLLBlock); + pSLL = ET.scanlines.next; + curPtBlock = &FirstPtBlock; + + if (rule == EvenOddRule) { + /* + * for each scanline + */ + for (y = ET.ymin; y < ET.ymax; y++) { + /* + * Add a new edge to the active edge table when we + * get to the next edge. + */ + if (pSLL != NULL && y == pSLL->scanline) { + loadAET(&AET, pSLL->edgelist); + pSLL = pSLL->next; + } + pPrevAET = &AET; + pAET = AET.next; + + /* + * for each active edge + */ + while (pAET) { + pts->x = pAET->bres.minor_axis, pts->y = y; + pts++, iPts++; + + /* + * send out the buffer + */ + if (iPts == NUMPTSTOBUFFER) { + tmpPtBlock = Xmalloc(sizeof(POINTBLOCK)); + curPtBlock->next = tmpPtBlock; + curPtBlock = tmpPtBlock; + pts = curPtBlock->pts; + numFullPtBlocks++; + iPts = 0; + } + EVALUATEEDGEEVENODD(pAET, pPrevAET, y); + } + (void) InsertionSort(&AET); + } + } + else { + /* + * for each scanline + */ + for (y = ET.ymin; y < ET.ymax; y++) { + /* + * Add a new edge to the active edge table when we + * get to the next edge. + */ + if (pSLL != NULL && y == pSLL->scanline) { + loadAET(&AET, pSLL->edgelist); + computeWAET(&AET); + pSLL = pSLL->next; + } + pPrevAET = &AET; + pAET = AET.next; + pWETE = pAET; + + /* + * for each active edge + */ + while (pAET) { + /* + * add to the buffer only those edges that + * are in the Winding active edge table. + */ + if (pWETE == pAET) { + pts->x = pAET->bres.minor_axis, pts->y = y; + pts++, iPts++; + + /* + * send out the buffer + */ + if (iPts == NUMPTSTOBUFFER) { + tmpPtBlock = Xmalloc(sizeof(POINTBLOCK)); + curPtBlock->next = tmpPtBlock; + curPtBlock = tmpPtBlock; + pts = curPtBlock->pts; + numFullPtBlocks++; iPts = 0; + } + pWETE = pWETE->nextWETE; + } + EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET); + } + + /* + * recompute the winding active edge table if + * we just resorted or have exited an edge. + */ + if (InsertionSort(&AET) || fixWAET) { + computeWAET(&AET); + fixWAET = FALSE; + } + } + } + FreeStorage(SLLBlock.next); + (void) PtsToRegion(numFullPtBlocks, iPts, &FirstPtBlock, region); + for (curPtBlock = FirstPtBlock.next; --numFullPtBlocks >= 0;) { + tmpPtBlock = curPtBlock->next; + Xfree(curPtBlock); + curPtBlock = tmpPtBlock; + } + Xfree(pETEs); + return(region); +} diff --git a/nx-X11/lib/src/PolyTxt.c b/nx-X11/lib/src/PolyTxt.c new file mode 100644 index 000000000..471383b57 --- /dev/null +++ b/nx-X11/lib/src/PolyTxt.c @@ -0,0 +1,234 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawText( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XTextItem *items, + int nitems) +{ + register int i; + register XTextItem *item; + int length = 0; + register xPolyText8Req *req; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq (PolyText8, req); + req->drawable = d; + req->gc = gc->gid; + req->x = x; + req->y = y; + + item = items; + for (i=0; i < nitems; i++) { + if (item->font) + length += 5; /* a 255 byte, plus size of Font id */ + if (item->delta) + { + if (item->delta > 0) + { + length += SIZEOF(xTextElt) * ((item->delta + 126) / 127); + } + else + { + length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128); + } + } + if (item->nchars > 0) + { + length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1); + if (!item->delta) length += SIZEOF(xTextElt); + length += item->nchars; + } + item++; + } + + req->length += (length + 3)>>2; /* convert to number of 32-bit words */ + + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. If the request does fit into the + * empty buffer, then we won't have to flush it at the end to keep + * the buffer 32-bit aligned. + */ + + if (dpy->bufptr + length > dpy->bufmax) + _XFlush (dpy); + + item = items; + for (i=0; i< nitems; i++) { + + if (item->font) { + /* to mark a font shift, write a 255 byte followed by + the 4 bytes of font ID, big-end first */ + register unsigned char *f; + BufAlloc (unsigned char *, f, 5); + + f[0] = 255; + f[1] = (item->font & 0xff000000) >> 24; + f[2] = (item->font & 0x00ff0000) >> 16; + f[3] = (item->font & 0x0000ff00) >> 8; + f[4] = item->font & 0x000000ff; + + /* update GC shadow */ + gc->values.font = item->font; + } + + { + int nbytes = SIZEOF(xTextElt); + int PartialNChars = item->nchars; + int PartialDelta = item->delta; + /* register xTextElt *elt; */ + int FirstTimeThrough = True; + char *CharacterOffset = item->chars; + char *tbuf = NULL; + + while((PartialDelta < -128) || (PartialDelta > 127)) + { + int nb = SIZEOF(xTextElt); + + BufAlloc (char *, tbuf, nb); + *tbuf = 0; /* elt->len */ + if (PartialDelta > 0 ) + { + *(tbuf+1) = 127; /* elt->delta */ + PartialDelta = PartialDelta - 127; + } + else + { + /* -128 = 0x8, need to be careful of signed chars... */ + *((unsigned char *)(tbuf+1)) = 0x80; /* elt->delta */ + PartialDelta = PartialDelta + 128; + } + } + if (PartialDelta) + { + BufAlloc (char *, tbuf , nbytes); + *tbuf = 0; /* elt->len */ + *(tbuf+1) = PartialDelta; /* elt->delta */ + } + while(PartialNChars > 254) + { + nbytes = 254; + if (FirstTimeThrough) + { + FirstTimeThrough = False; + if (!item->delta) + { + nbytes += SIZEOF(xTextElt); + BufAlloc (char *, tbuf, nbytes); + *(tbuf+1) = 0; /* elt->delta */ + } + else + { + char *DummyChar; + BufAlloc(char *, DummyChar, nbytes); + } + } + else + { + nbytes += SIZEOF(xTextElt); + BufAlloc (char *, tbuf, nbytes); + *(tbuf+1) = 0; /* elt->delta */ + } + /* watch out for signs on chars */ + *(unsigned char *)tbuf = 254; /* elt->len */ + memcpy (tbuf+2 , CharacterOffset, 254); + PartialNChars = PartialNChars - 254; + CharacterOffset += 254; + + } + if (PartialNChars) + { + nbytes = PartialNChars; + if (FirstTimeThrough) + { + FirstTimeThrough = False; + if (!item->delta) + { + nbytes += SIZEOF(xTextElt); + BufAlloc (char *, tbuf, nbytes); + *(tbuf+1) = 0; /* elt->delta */ + } + else + { + char *DummyChar; + BufAlloc(char *, DummyChar, nbytes); + } + } + else + { + nbytes += SIZEOF(xTextElt); + BufAlloc (char *, tbuf, nbytes); + *(tbuf+1) = 0; /* elt->delta */ + } + *tbuf = PartialNChars; /* elt->len */ + memcpy (tbuf+2 , CharacterOffset, PartialNChars); + } + } + item++; + } + + /* Pad request out to a 32-bit boundary */ + + if (length &= 3) { + char *pad; + /* + * BufAlloc is a macro that uses its last argument more than + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + */ + length = 4 - length; + BufAlloc (char *, pad, length); + /* + * if there are 3 bytes of padding, the first byte MUST be 0 + * so the pad bytes aren't mistaken for a final xTextElt + */ + *pad = 0; + } + + /* + * If the buffer pointer is not now pointing to a 32-bit boundary, + * we must flush the buffer so that it does point to a 32-bit boundary + * at the end of this routine. + */ + + if ((dpy->bufptr - dpy->buffer) & 3) + _XFlush (dpy); + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } diff --git a/nx-X11/lib/src/PolyTxt16.c b/nx-X11/lib/src/PolyTxt16.c new file mode 100644 index 000000000..2e4be1673 --- /dev/null +++ b/nx-X11/lib/src/PolyTxt16.c @@ -0,0 +1,245 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawText16( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XTextItem16 *items, + int nitems) +{ + register int i; + register XTextItem16 *item; + int length = 0; + register xPolyText16Req *req; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq (PolyText16, req); + req->drawable = d; + req->gc = gc->gid; + req->x = x; + req->y = y; + + item = items; + for (i=0; i < nitems; i++) { + if (item->font) + length += 5; /* a 255 byte, plus size of Font id */ + if (item->delta) + { + if (item->delta > 0) + { + length += SIZEOF(xTextElt) * ((item->delta + 126) / 127); + } + else + { + length += SIZEOF(xTextElt) * ((-item->delta + 127) / 128); + } + } + if (item->nchars > 0) + { + length += SIZEOF(xTextElt) * ((item->nchars + 253) / 254 - 1); + if (!item->delta) length += SIZEOF(xTextElt); + length += item->nchars << 1; + } + item++; + } + + req->length += (length + 3)>>2; /* convert to number of 32-bit words */ + + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. If the request does fit into the + * empty buffer, then we won't have to flush it at the end to keep + * the buffer 32-bit aligned. + */ + + if (dpy->bufptr + length > dpy->bufmax) + _XFlush (dpy); + + item = items; + for (i=0; i< nitems; i++) { + + if (item->font) { + /* to mark a font shift, write a 255 byte followed by + the 4 bytes of font ID, big-end first */ + register unsigned char *f; + BufAlloc (unsigned char *, f, 5); + + f[0] = 255; + f[1] = (item->font & 0xff000000) >> 24; + f[2] = (item->font & 0x00ff0000) >> 16; + f[3] = (item->font & 0x0000ff00) >> 8; + f[4] = item->font & 0x000000ff; + + /* update GC shadow */ + gc->values.font = item->font; + } + + { + int nbytes = SIZEOF(xTextElt); + int PartialNChars = item->nchars; + int PartialDelta = item->delta; + register xTextElt *elt = NULL; + int FirstTimeThrough = True; + XChar2b *CharacterOffset = item->chars; + + while((PartialDelta < -128) || (PartialDelta > 127)) + { + int nb = SIZEOF(xTextElt); + + BufAlloc (xTextElt *, elt, nb); + elt->len = 0; + if (PartialDelta > 0 ) + { + elt->delta = 127; + PartialDelta = PartialDelta - 127; + } + else + { + elt->delta = -128; + PartialDelta = PartialDelta + 128; + } + } + if (PartialDelta) + { + BufAlloc (xTextElt *, elt, nbytes); + elt->len = 0; + elt->delta = PartialDelta; + } + while(PartialNChars > 254) + { + nbytes = 254 * 2; + if (FirstTimeThrough) + { + FirstTimeThrough = False; + if (!item->delta) + { + nbytes += SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + } + else + { + char *DummyChar; + BufAlloc(char *, DummyChar, nbytes); +#ifdef lint + DummyChar = DummyChar; +#endif + } + } + else + { + nbytes += SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + } + elt->len = 254; + + memcpy ((char *) (elt + 1), (char *)CharacterOffset, 254 * 2); + PartialNChars = PartialNChars - 254; + CharacterOffset += 254; + + } + if (PartialNChars) + { + nbytes = PartialNChars * 2; + if (FirstTimeThrough) + { + FirstTimeThrough = False; + if (!item->delta) + { + nbytes += SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + } + else + { + char *DummyChar; + BufAlloc(char *, DummyChar, nbytes); +#ifdef lint + DummyChar = DummyChar; +#endif + } + } + else + { + nbytes += SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + } + elt->len = PartialNChars; + + memcpy ((char *) (elt + 1), (char *)CharacterOffset, + PartialNChars * +2); + } + } + item++; + } + + /* Pad request out to a 32-bit boundary */ + + if (length &= 3) { + char *pad; + /* + * BufAlloc is a macro that uses its last argument more than + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + */ + length = 4 - length; + BufAlloc (char *, pad, length); + /* + * if there are 3 bytes of padding, the first byte MUST be 0 + * so the pad bytes aren't mistaken for a final xTextElt + */ + *pad = 0; + } + + /* + * If the buffer pointer is not now pointing to a 32-bit boundary, + * we must flush the buffer so that it does point to a 32-bit boundary + * at the end of this routine. + */ + + if ((dpy->bufptr - dpy->buffer) & 3) + _XFlush (dpy); + + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } + + + diff --git a/nx-X11/lib/src/PropAlloc.c b/nx-X11/lib/src/PropAlloc.c new file mode 100644 index 000000000..87817d88a --- /dev/null +++ b/nx-X11/lib/src/PropAlloc.c @@ -0,0 +1,69 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" +#include + + +/* + * Routines for allocating space for structures that are expected to get + * longer at some point. + */ + +XSizeHints *XAllocSizeHints (void) +{ + return Xcalloc (1, sizeof (XSizeHints)); +} + + +XStandardColormap *XAllocStandardColormap (void) +{ + return Xcalloc (1, sizeof (XStandardColormap)); +} + + +XWMHints *XAllocWMHints (void) +{ + return Xcalloc (1, sizeof (XWMHints)); +} + + +XClassHint *XAllocClassHint (void) +{ + return Xcalloc (1, sizeof (XClassHint)); +} + + +XIconSize *XAllocIconSize (void) +{ + return Xcalloc (1, sizeof (XIconSize)); +} + + diff --git a/nx-X11/lib/src/PutBEvent.c b/nx-X11/lib/src/PutBEvent.c new file mode 100644 index 000000000..1768e032c --- /dev/null +++ b/nx-X11/lib/src/PutBEvent.c @@ -0,0 +1,87 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* XPutBackEvent puts an event back at the head of the queue. */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +_XPutBackEvent ( + register Display *dpy, + register XEvent *event) + { + register _XQEvent *qelt; + XEvent store = *event; + + if (!dpy->qfree) { + if ((dpy->qfree = Xmalloc (sizeof (_XQEvent))) == NULL) { + return 0; + } + dpy->qfree->next = NULL; + } + + /* unclaimed cookie? */ + if (_XIsEventCookie(dpy, event)) + { + XEvent copy = {0}; + /* if not claimed, then just fetch and store again */ + if (!event->xcookie.data) { + _XFetchEventCookie(dpy, &event->xcookie); + store = *event; + } else { /* if claimed, copy, client must free */ + _XCopyEventCookie(dpy, &event->xcookie, ©.xcookie); + store = copy; + } + } + + qelt = dpy->qfree; + dpy->qfree = qelt->next; + qelt->qserial_num = dpy->next_event_serial_num++; + qelt->next = dpy->head; + qelt->event = store; + dpy->head = qelt; + if (dpy->tail == NULL) + dpy->tail = qelt; + dpy->qlen++; + return 0; + } + +int +XPutBackEvent ( + register Display * dpy, + register XEvent *event) + { + int ret; + + LockDisplay(dpy); + ret = _XPutBackEvent(dpy, event); + UnlockDisplay(dpy); + return ret; + } diff --git a/nx-X11/lib/src/PutImage.c b/nx-X11/lib/src/PutImage.c new file mode 100644 index 000000000..daf172cf0 --- /dev/null +++ b/nx-X11/lib/src/PutImage.c @@ -0,0 +1,1030 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" +#include +#include "Cr.h" +#include "ImUtil.h" + +#if defined(__STDC__) && ((defined(sun) && defined(SVR4)) || defined(WIN32)) +#define RConst /**/ +#else +#define RConst const +#endif + +/* assumes pad is a power of 2 */ +#define ROUNDUP(nbytes, pad) (((nbytes) + ((pad) - 1)) & ~(long)((pad) - 1)) + +static unsigned char const _reverse_byte[0x100] = { + 0x00, 0x80, 0x40, 0xc0, 0x20, 0xa0, 0x60, 0xe0, + 0x10, 0x90, 0x50, 0xd0, 0x30, 0xb0, 0x70, 0xf0, + 0x08, 0x88, 0x48, 0xc8, 0x28, 0xa8, 0x68, 0xe8, + 0x18, 0x98, 0x58, 0xd8, 0x38, 0xb8, 0x78, 0xf8, + 0x04, 0x84, 0x44, 0xc4, 0x24, 0xa4, 0x64, 0xe4, + 0x14, 0x94, 0x54, 0xd4, 0x34, 0xb4, 0x74, 0xf4, + 0x0c, 0x8c, 0x4c, 0xcc, 0x2c, 0xac, 0x6c, 0xec, + 0x1c, 0x9c, 0x5c, 0xdc, 0x3c, 0xbc, 0x7c, 0xfc, + 0x02, 0x82, 0x42, 0xc2, 0x22, 0xa2, 0x62, 0xe2, + 0x12, 0x92, 0x52, 0xd2, 0x32, 0xb2, 0x72, 0xf2, + 0x0a, 0x8a, 0x4a, 0xca, 0x2a, 0xaa, 0x6a, 0xea, + 0x1a, 0x9a, 0x5a, 0xda, 0x3a, 0xba, 0x7a, 0xfa, + 0x06, 0x86, 0x46, 0xc6, 0x26, 0xa6, 0x66, 0xe6, + 0x16, 0x96, 0x56, 0xd6, 0x36, 0xb6, 0x76, 0xf6, + 0x0e, 0x8e, 0x4e, 0xce, 0x2e, 0xae, 0x6e, 0xee, + 0x1e, 0x9e, 0x5e, 0xde, 0x3e, 0xbe, 0x7e, 0xfe, + 0x01, 0x81, 0x41, 0xc1, 0x21, 0xa1, 0x61, 0xe1, + 0x11, 0x91, 0x51, 0xd1, 0x31, 0xb1, 0x71, 0xf1, + 0x09, 0x89, 0x49, 0xc9, 0x29, 0xa9, 0x69, 0xe9, + 0x19, 0x99, 0x59, 0xd9, 0x39, 0xb9, 0x79, 0xf9, + 0x05, 0x85, 0x45, 0xc5, 0x25, 0xa5, 0x65, 0xe5, + 0x15, 0x95, 0x55, 0xd5, 0x35, 0xb5, 0x75, 0xf5, + 0x0d, 0x8d, 0x4d, 0xcd, 0x2d, 0xad, 0x6d, 0xed, + 0x1d, 0x9d, 0x5d, 0xdd, 0x3d, 0xbd, 0x7d, 0xfd, + 0x03, 0x83, 0x43, 0xc3, 0x23, 0xa3, 0x63, 0xe3, + 0x13, 0x93, 0x53, 0xd3, 0x33, 0xb3, 0x73, 0xf3, + 0x0b, 0x8b, 0x4b, 0xcb, 0x2b, 0xab, 0x6b, 0xeb, + 0x1b, 0x9b, 0x5b, 0xdb, 0x3b, 0xbb, 0x7b, 0xfb, + 0x07, 0x87, 0x47, 0xc7, 0x27, 0xa7, 0x67, 0xe7, + 0x17, 0x97, 0x57, 0xd7, 0x37, 0xb7, 0x77, 0xf7, + 0x0f, 0x8f, 0x4f, 0xcf, 0x2f, 0xaf, 0x6f, 0xef, + 0x1f, 0x9f, 0x5f, 0xdf, 0x3f, 0xbf, 0x7f, 0xff +}; + +static unsigned char const _reverse_nibs[0x100] = { + 0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70, + 0x80, 0x90, 0xa0, 0xb0, 0xc0, 0xd0, 0xe0, 0xf0, + 0x01, 0x11, 0x21, 0x31, 0x41, 0x51, 0x61, 0x71, + 0x81, 0x91, 0xa1, 0xb1, 0xc1, 0xd1, 0xe1, 0xf1, + 0x02, 0x12, 0x22, 0x32, 0x42, 0x52, 0x62, 0x72, + 0x82, 0x92, 0xa2, 0xb2, 0xc2, 0xd2, 0xe2, 0xf2, + 0x03, 0x13, 0x23, 0x33, 0x43, 0x53, 0x63, 0x73, + 0x83, 0x93, 0xa3, 0xb3, 0xc3, 0xd3, 0xe3, 0xf3, + 0x04, 0x14, 0x24, 0x34, 0x44, 0x54, 0x64, 0x74, + 0x84, 0x94, 0xa4, 0xb4, 0xc4, 0xd4, 0xe4, 0xf4, + 0x05, 0x15, 0x25, 0x35, 0x45, 0x55, 0x65, 0x75, + 0x85, 0x95, 0xa5, 0xb5, 0xc5, 0xd5, 0xe5, 0xf5, + 0x06, 0x16, 0x26, 0x36, 0x46, 0x56, 0x66, 0x76, + 0x86, 0x96, 0xa6, 0xb6, 0xc6, 0xd6, 0xe6, 0xf6, + 0x07, 0x17, 0x27, 0x37, 0x47, 0x57, 0x67, 0x77, + 0x87, 0x97, 0xa7, 0xb7, 0xc7, 0xd7, 0xe7, 0xf7, + 0x08, 0x18, 0x28, 0x38, 0x48, 0x58, 0x68, 0x78, + 0x88, 0x98, 0xa8, 0xb8, 0xc8, 0xd8, 0xe8, 0xf8, + 0x09, 0x19, 0x29, 0x39, 0x49, 0x59, 0x69, 0x79, + 0x89, 0x99, 0xa9, 0xb9, 0xc9, 0xd9, 0xe9, 0xf9, + 0x0a, 0x1a, 0x2a, 0x3a, 0x4a, 0x5a, 0x6a, 0x7a, + 0x8a, 0x9a, 0xaa, 0xba, 0xca, 0xda, 0xea, 0xfa, + 0x0b, 0x1b, 0x2b, 0x3b, 0x4b, 0x5b, 0x6b, 0x7b, + 0x8b, 0x9b, 0xab, 0xbb, 0xcb, 0xdb, 0xeb, 0xfb, + 0x0c, 0x1c, 0x2c, 0x3c, 0x4c, 0x5c, 0x6c, 0x7c, + 0x8c, 0x9c, 0xac, 0xbc, 0xcc, 0xdc, 0xec, 0xfc, + 0x0d, 0x1d, 0x2d, 0x3d, 0x4d, 0x5d, 0x6d, 0x7d, + 0x8d, 0x9d, 0xad, 0xbd, 0xcd, 0xdd, 0xed, 0xfd, + 0x0e, 0x1e, 0x2e, 0x3e, 0x4e, 0x5e, 0x6e, 0x7e, + 0x8e, 0x9e, 0xae, 0xbe, 0xce, 0xde, 0xee, 0xfe, + 0x0f, 0x1f, 0x2f, 0x3f, 0x4f, 0x5f, 0x6f, 0x7f, + 0x8f, 0x9f, 0xaf, 0xbf, 0xcf, 0xdf, 0xef, 0xff +}; + +int +_XReverse_Bytes( + register unsigned char *bpt, + register int nb) +{ + do { + *bpt = _reverse_byte[*bpt]; + bpt++; + } while (--nb > 0); + return 0; +} + + +/* XXX the following functions are declared int instead of void because various + * compilers and lints complain about later initialization of SwapFunc and/or + * (swapfunc == NoSwap) when void is used. + */ + +/*ARGSUSED*/ +static void +NoSwap ( + register unsigned char *src, + register unsigned char *dest, + long srclen, + long srcinc, + long destinc, + unsigned int height, + int half_order) +{ + long h = height; + + if (srcinc == destinc) + memcpy((char *)dest, (char *)src, (int)(srcinc * (h - 1) + srclen)); + else + for (; --h >= 0; src += srcinc, dest += destinc) + memcpy((char *)dest, (char *)src, (int)srclen); +} + +static void +SwapTwoBytes ( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + long length = ROUNDUP(srclen, 2); + register long h, n; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 2; + if (half_order == MSBFirst) + *(dest + length) = *(src + length + 1); + else + *(dest + length + 1) = *(src + length); + } + for (n = length; n > 0; n -= 2, src += 2) { + *dest++ = *(src + 1); + *dest++ = *src; + } + } +} + +static void +SwapThreeBytes ( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int byte_order) +{ + long length = ((srclen + 2) / 3) * 3; + register long h, n; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 3; + if ((srclen - length) == 2) + *(dest + length + 1) = *(src + length + 1); + if (byte_order == MSBFirst) + *(dest + length) = *(src + length + 2); + else + *(dest + length + 2) = *(src + length); + } + for (n = length; n > 0; n -= 3, src += 3) { + *dest++ = *(src + 2); + *dest++ = *(src + 1); + *dest++ = *src; + } + } +} + +static void +SwapFourBytes ( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + long length = ROUNDUP(srclen, 4); + register long h, n; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 4; + if (half_order == MSBFirst) + *(dest + length) = *(src + length + 3); + if (((half_order == LSBFirst) && ((srclen - length) == 3)) || + ((half_order == MSBFirst) && (srclen & 2))) + *(dest + length + 1) = *(src + length + 2); + if (((half_order == MSBFirst) && ((srclen - length) == 3)) || + ((half_order == LSBFirst) && (srclen & 2))) + *(dest + length + 2) = *(src + length + 1); + if (half_order == LSBFirst) + *(dest + length + 3) = *(src + length); + } + for (n = length; n > 0; n -= 4, src += 4) { + *dest++ = *(src + 3); + *dest++ = *(src + 2); + *dest++ = *(src + 1); + *dest++ = *src; + } + } +} + +static void +SwapWords ( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + long length = ROUNDUP(srclen, 4); + register long h, n; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 4; + if (half_order == MSBFirst) + *(dest + length + 1) = *(src + length + 3); + if (((half_order == LSBFirst) && ((srclen - length) == 3)) || + ((half_order == MSBFirst) && (srclen & 2))) + *(dest + length) = *(src + length + 2); + if (((half_order == MSBFirst) && ((srclen - length) == 3)) || + ((half_order == LSBFirst) && (srclen & 2))) + *(dest + length + 3) = *(src + length + 1); + if (half_order == LSBFirst) + *(dest + length + 2) = *(src + length); + } + for (n = length; n > 0; n -= 4, src += 2) { + *dest++ = *(src + 2); + *dest++ = *(src + 3); + *dest++ = *src++; + *dest++ = *src++; + } + } +} + +static void +SwapNibbles( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height) +{ + register long h, n; + register const unsigned char *rev = _reverse_nibs; + + srcinc -= srclen; + destinc -= srclen; + for (h = height; --h >= 0; src += srcinc, dest += destinc) + for (n = srclen; --n >= 0; ) + *dest++ = rev[*src++]; +} + +static void +ShiftNibblesLeft ( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int nibble_order) +{ + register long h, n; + register unsigned char c1, c2; + + srcinc -= srclen; + destinc -= srclen; + if (nibble_order == MSBFirst) { + for (h = height; --h >= 0; src += srcinc, dest += destinc) + for (n = srclen; --n >= 0; ) { + c1 = *src++; + c2 = *src; + *dest++ = ((c1 & 0x0f) << 4) | ((c2 & (unsigned)0xf0) >> 4); + } + } else { + for (h = height; --h >= 0; src += srcinc, dest += destinc) + for (n = srclen; --n >= 0; ) { + c1 = *src++; + c2 = *src; + *dest++ = ((c2 & 0x0f) << 4) | ((c1 & (unsigned)0xf0) >> 4); + } + } +} + +/*ARGSUSED*/ +static void +SwapBits( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + register long h, n; + register const unsigned char *rev = _reverse_byte; + + srcinc -= srclen; + destinc -= srclen; + for (h = height; --h >= 0; src += srcinc, dest += destinc) + for (n = srclen; --n >= 0; ) + *dest++ = rev[*src++]; +} + +static void +SwapBitsAndTwoBytes( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + long length = ROUNDUP(srclen, 2); + register long h, n; + register const unsigned char *rev = _reverse_byte; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 2; + if (half_order == MSBFirst) + *(dest + length) = rev[*(src + length + 1)]; + else + *(dest + length + 1) = rev[*(src + length)]; + } + for (n = length; n > 0; n -= 2, src += 2) { + *dest++ = rev[*(src + 1)]; + *dest++ = rev[*src]; + } + } +} + +static void +SwapBitsAndFourBytes( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + long length = ROUNDUP(srclen, 4); + register long h, n; + register const unsigned char *rev = _reverse_byte; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 4; + if (half_order == MSBFirst) + *(dest + length) = rev[*(src + length + 3)]; + if (((half_order == LSBFirst) && ((srclen - length) == 3)) || + ((half_order == MSBFirst) && (srclen & 2))) + *(dest + length + 1) = rev[*(src + length + 2)]; + if (((half_order == MSBFirst) && ((srclen - length) == 3)) || + ((half_order == LSBFirst) && (srclen & 2))) + *(dest + length + 2) = rev[*(src + length + 1)]; + if (half_order == LSBFirst) + *(dest + length + 3) = rev[*(src + length)]; + } + for (n = length; n > 0; n -= 4, src += 4) { + *dest++ = rev[*(src + 3)]; + *dest++ = rev[*(src + 2)]; + *dest++ = rev[*(src + 1)]; + *dest++ = rev[*src]; + } + } +} + +static void +SwapBitsAndWords( + register unsigned char *src, + register unsigned char *dest, + long srclen, long srcinc, long destinc, + unsigned int height, + int half_order) +{ + long length = ROUNDUP(srclen, 4); + register long h, n; + register const unsigned char *rev = _reverse_byte; + + srcinc -= length; + destinc -= length; + for (h = height; --h >= 0; src += srcinc, dest += destinc) { + if ((h == 0) && (srclen != length)) { + length -= 4; + if (half_order == MSBFirst) + *(dest + length + 1) = rev[*(src + length + 3)]; + if (((half_order == LSBFirst) && ((srclen - length) == 3)) || + ((half_order == MSBFirst) && (srclen & 2))) + *(dest + length) = rev[*(src + length + 2)]; + if (((half_order == MSBFirst) && ((srclen - length) == 3)) || + ((half_order == LSBFirst) && (srclen & 2))) + *(dest + length + 3) = rev[*(src + length + 1)]; + if (half_order == LSBFirst) + *(dest + length + 2) = rev[*(src + length)]; + } + for (n = length; n > 0; n -= 4, src += 2) { + *dest++ = rev[*(src + 2)]; + *dest++ = rev[*(src + 3)]; + *dest++ = rev[*src++]; + *dest++ = rev[*src++]; + } + } +} + +/* + +The following table gives the bit ordering within bytes (when accessed +sequentially) for a scanline containing 32 bits, with bits numbered 0 to +31, where bit 0 should be leftmost on the display. For a given byte +labelled A-B, A is for the most significant bit of the byte, and B is +for the least significant bit. + +legend: + 1 scanline-unit = 8 + 2 scanline-unit = 16 + 4 scanline-unit = 32 + M byte-order = MostSignificant + L byte-order = LeastSignificant + m bit-order = MostSignificant + l bit-order = LeastSignificant + + +format ordering + +1Mm 00-07 08-15 16-23 24-31 +2Mm 00-07 08-15 16-23 24-31 +4Mm 00-07 08-15 16-23 24-31 +1Ml 07-00 15-08 23-16 31-24 +2Ml 15-08 07-00 31-24 23-16 +4Ml 31-24 23-16 15-08 07-00 +1Lm 00-07 08-15 16-23 24-31 +2Lm 08-15 00-07 24-31 16-23 +4Lm 24-31 16-23 08-15 00-07 +1Ll 07-00 15-08 23-16 31-24 +2Ll 07-00 15-08 23-16 31-24 +4Ll 07-00 15-08 23-16 31-24 + + +The following table gives the required conversion between any two +formats. It is based strictly on the table above. If you believe one, +you should believe the other. + +legend: + n no changes + s reverse 8-bit units within 16-bit units + l reverse 8-bit units within 32-bit units + w reverse 16-bit units within 32-bit units + R reverse bits within 8-bit units + S s+R + L l+R + W w+R + +*/ + +static void (* RConst (SwapFunction[12][12]))( + register unsigned char *src, + register unsigned char *dest, + long srclen, + long srcinc, + long destinc, + unsigned int height, + int half_order) = { +#define n NoSwap, +#define s SwapTwoBytes, +#define l SwapFourBytes, +#define w SwapWords, +#define R SwapBits, +#define S SwapBitsAndTwoBytes, +#define L SwapBitsAndFourBytes, +#define W SwapBitsAndWords, + +/* 1Mm 2Mm 4Mm 1Ml 2Ml 4Ml 1Lm 2Lm 4Lm 1Ll 2Ll 4Ll */ +/* 1Mm */ { n n n R S L n s l R R R }, +/* 2Mm */ { n n n R S L n s l R R R }, +/* 4Mm */ { n n n R S L n s l R R R }, +/* 1Ml */ { R R R n s l R S L n n n }, +/* 2Ml */ { S S S s n w S R W s s s }, +/* 4Ml */ { L L L l w n L W R l l l }, +/* 1Lm */ { n n n R S L n s l R R R }, +/* 2Lm */ { s s s S R W s n w S S S }, +/* 4Lm */ { l l l L W R l w n L L L }, +/* 1Ll */ { R R R n s l R S L n n n }, +/* 2Ll */ { R R R n s l R S L n n n }, +/* 4Ll */ { R R R n s l R S L n n n } + +#undef n +#undef s +#undef l +#undef w +#undef R +#undef S +#undef L +#undef W + +}; + +/* Of course, the table above is a lie. We also need to factor in the + * order of the source data to cope with swapping half of a unit at the + * end of a scanline, since we are trying to avoid de-ref'ing off the + * end of the source. + * + * Defines whether the first half of a unit has the first half of the data + */ +static int const HalfOrder[12] = { + LSBFirst, /* 1Mm */ + LSBFirst, /* 2Mm */ + LSBFirst, /* 4Mm */ + LSBFirst, /* 1Ml */ + MSBFirst, /* 2Ml */ + MSBFirst, /* 4Ml */ + LSBFirst, /* 1Lm */ + MSBFirst, /* 2Lm */ + MSBFirst, /* 4Lm */ + LSBFirst, /* 1Ll */ + LSBFirst, /* 2Ll */ + LSBFirst /* 4Ll */ + }; + +/* Finally, for SwapWords cases, the half order depends not just on the source + * but also on the destination scanline unit. Use of this table changes some + * MSBFirsts to LSBFirsts that are "do not care" (because the function will be + * NoSwap or SwapBits) in addition to changing the desired ones. + */ + +static int const HalfOrderWord[12] = { + MSBFirst, /* 1Mm */ + MSBFirst, /* 2Mm */ + MSBFirst, /* 4Mm */ + MSBFirst, /* 1Ml */ + MSBFirst, /* 2Ml */ + LSBFirst, /* 4Ml */ + MSBFirst, /* 1Lm */ + MSBFirst, /* 2Lm */ + LSBFirst, /* 4Lm */ + MSBFirst, /* 1Ll */ + MSBFirst, /* 2Ll */ + MSBFirst /* 4Ll */ + }; + +/* + * This macro creates a value from 0 to 11 suitable for indexing + * into the table above. + */ +#define ComposeIndex(bitmap_unit, bitmap_bit_order, byte_order) \ + (((bitmap_unit == 32) ? 2 : ((bitmap_unit == 16) ? 1 : 0)) \ + + (((bitmap_bit_order == MSBFirst) ? 0 : 3) \ + + ((byte_order == MSBFirst) ? 0 : 6))) + +/* Cancel a GetReq operation, before doing _XSend or Data */ + +#define UnGetReq(name)\ + dpy->bufptr -= SIZEOF(x##name##Req);\ + dpy->request-- + +static void +SendXYImage( + register Display *dpy, + register xPutImageReq *req, + register XImage *image, + int req_xoffset, int req_yoffset) +{ + register int j; + long total_xoffset, bytes_per_src, bytes_per_dest, length; + long bytes_per_line, bytes_per_src_plane, bytes_per_dest_plane; + char *src, *dest, *buf; + char *extra = (char *)NULL; + register void (*swapfunc)( + register unsigned char *src, + register unsigned char *dest, + long srclen, + long srcinc, + long destinc, + unsigned int height, + int half_order); + int half_order; + + total_xoffset = image->xoffset + req_xoffset; + req->leftPad = total_xoffset & (dpy->bitmap_unit - 1); + total_xoffset = (unsigned)(total_xoffset - req->leftPad) >> 3; + /* The protocol requires left-pad of zero on all ZPixmap, even + * though the 1-bit case is identical to bitmap format. This is a + * bug in the protocol, caused because 1-bit ZPixmap was added late + * in the game. Hairy shifting code compensation isn't worth it, + * just use XYPixmap format instead. + */ + if ((req->leftPad != 0) && (req->format == ZPixmap)) + req->format = XYPixmap; + bytes_per_dest = (unsigned long)ROUNDUP((long)req->width + req->leftPad, + dpy->bitmap_pad) >> 3; + bytes_per_dest_plane = bytes_per_dest * req->height; + length = bytes_per_dest_plane * image->depth; + req->length += (length + 3) >> 2; + + swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, + image->bitmap_bit_order, + image->byte_order)] + [ComposeIndex(dpy->bitmap_unit, + dpy->bitmap_bit_order, + dpy->byte_order)]; + half_order = HalfOrder[ComposeIndex(image->bitmap_unit, + image->bitmap_bit_order, + image->byte_order)]; + if (half_order == MSBFirst) + half_order = HalfOrderWord[ComposeIndex(dpy->bitmap_unit, + dpy->bitmap_bit_order, + dpy->byte_order)]; + + src = image->data + (image->bytes_per_line * req_yoffset) + total_xoffset; + + /* when total_xoffset > 0, we have to worry about stepping off the + * end of image->data. + */ + if ((swapfunc == NoSwap) && + (image->bytes_per_line == bytes_per_dest) && + (((total_xoffset == 0) && + ((image->depth == 1) || (image->height == req->height))) || + ((image->depth == 1) && + ((req_yoffset + req->height) < (unsigned)image->height)))) { + Data(dpy, src, length); + return; + } + + length = ROUNDUP(length, 4); + if ((dpy->bufptr + length) > dpy->bufmax) { + if ((buf = _XAllocScratch(dpy, length)) == NULL) { + UnGetReq(PutImage); + return; + } + } + else + buf = dpy->bufptr; + + bytes_per_src = (req->width + req->leftPad + (unsigned)7) >> 3; + bytes_per_line = image->bytes_per_line; + bytes_per_src_plane = bytes_per_line * image->height; + total_xoffset &= (image->bitmap_unit - 1) >> 3; + + if ((total_xoffset > 0) && + (image->byte_order != image->bitmap_bit_order)) { + char *temp; + long bytes_per_temp_plane, temp_length; + + bytes_per_line = bytes_per_src + total_xoffset; + src -= total_xoffset; + bytes_per_temp_plane = bytes_per_line * req->height; + temp_length = ROUNDUP(bytes_per_temp_plane * image->depth, 4); + if (buf == dpy->bufptr) { + if (! (temp = _XAllocScratch(dpy, temp_length))) { + UnGetReq(PutImage); + return; + } + } + else + if ((extra = temp = Xmalloc(temp_length)) == NULL) { + UnGetReq(PutImage); + return; + } + + swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, + image->bitmap_bit_order, + image->byte_order)] + [ComposeIndex(image->bitmap_unit, + dpy->byte_order, + dpy->byte_order)]; + for (dest = temp, j = image->depth; + --j >= 0; + src += bytes_per_src_plane, dest += bytes_per_temp_plane) + (*swapfunc)((unsigned char *)src, (unsigned char *)dest, + bytes_per_line, (long)image->bytes_per_line, + bytes_per_line, req->height, half_order); + swapfunc = SwapFunction[ComposeIndex(image->bitmap_unit, + dpy->byte_order, + dpy->byte_order)] + [ComposeIndex(dpy->bitmap_unit, + dpy->bitmap_bit_order, + dpy->byte_order)]; + half_order = HalfOrder[ComposeIndex(image->bitmap_unit, + dpy->byte_order, + dpy->byte_order)]; + src = temp + total_xoffset; + bytes_per_src_plane = bytes_per_temp_plane; + } + + for (dest = buf, j = image->depth; + --j >= 0; + src += bytes_per_src_plane, dest += bytes_per_dest_plane) + (*swapfunc)((unsigned char *)src, (unsigned char *)dest, + bytes_per_src, bytes_per_line, + bytes_per_dest, req->height, half_order); + + Xfree(extra); + + if (buf == dpy->bufptr) + dpy->bufptr += length; + else + _XSend(dpy, buf, length); + } + +static void +SendZImage( + register Display *dpy, + register xPutImageReq *req, + register XImage *image, + int req_xoffset, int req_yoffset, + int dest_bits_per_pixel, int dest_scanline_pad) +{ + long bytes_per_src, bytes_per_dest, length; + unsigned char *src, *dest; + unsigned char *shifted_src = NULL; + + req->leftPad = 0; + bytes_per_src = ROUNDUP((long)req->width * image->bits_per_pixel, 8) >> 3; + bytes_per_dest = ROUNDUP((long)req->width * dest_bits_per_pixel, + dest_scanline_pad) >> 3; + length = bytes_per_dest * req->height; + req->length += (length + 3) >> 2; + + src = (unsigned char *)image->data + + (req_yoffset * image->bytes_per_line) + + ((req_xoffset * image->bits_per_pixel) >> 3); + if ((image->bits_per_pixel == 4) && ((unsigned int) req_xoffset & 0x01)) { + if (! (shifted_src = Xmalloc(req->height * image->bytes_per_line))) { + UnGetReq(PutImage); + return; + } + + ShiftNibblesLeft(src, shifted_src, bytes_per_src, + (long) image->bytes_per_line, + (long) image->bytes_per_line, req->height, + image->byte_order); + src = shifted_src; + } + + /* when req_xoffset > 0, we have to worry about stepping off the + * end of image->data. + */ + if (((image->byte_order == dpy->byte_order) || + (image->bits_per_pixel == 8)) && + ((long)image->bytes_per_line == bytes_per_dest) && + ((req_xoffset == 0) || + ((req_yoffset + req->height) < (unsigned)image->height))) { + Data(dpy, (char *)src, length); + Xfree(shifted_src); + return; + } + + length = ROUNDUP(length, 4); + if ((dpy->bufptr + length) <= dpy->bufmax) + dest = (unsigned char *)dpy->bufptr; + else + if ((dest = (unsigned char *) + _XAllocScratch(dpy, length)) == NULL) { + Xfree(shifted_src); + UnGetReq(PutImage); + return; + } + + if ((image->byte_order == dpy->byte_order) || + (image->bits_per_pixel == 8)) + NoSwap(src, dest, bytes_per_src, (long)image->bytes_per_line, + bytes_per_dest, req->height, image->byte_order); + else if (image->bits_per_pixel == 32) + SwapFourBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, + bytes_per_dest, req->height, image->byte_order); + else if (image->bits_per_pixel == 24) + SwapThreeBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, + bytes_per_dest, req->height, image->byte_order); + else if (image->bits_per_pixel == 16) + SwapTwoBytes(src, dest, bytes_per_src, (long)image->bytes_per_line, + bytes_per_dest, req->height, image->byte_order); + else + SwapNibbles(src, dest, bytes_per_src, (long)image->bytes_per_line, + bytes_per_dest, req->height); + + if (dest == (unsigned char *)dpy->bufptr) + dpy->bufptr += length; + else + _XSend(dpy, (char *)dest, length); + + Xfree(shifted_src); +} + +static void +PutImageRequest( + register Display *dpy, + Drawable d, + GC gc, + register XImage *image, + int req_xoffset, int req_yoffset, + int x, int y, + unsigned int req_width, unsigned int req_height, + int dest_bits_per_pixel, int dest_scanline_pad) +{ + register xPutImageReq *req; + + GetReq(PutImage, req); + req->drawable = d; + req->gc = gc->gid; + req->dstX = x; + req->dstY = y; + req->width = req_width; + req->height = req_height; + req->depth = image->depth; + req->format = image->format; + if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) + SendXYImage(dpy, req, image, req_xoffset, req_yoffset); + else + SendZImage(dpy, req, image, req_xoffset, req_yoffset, + dest_bits_per_pixel, dest_scanline_pad); +} + +static void +PutSubImage ( + register Display *dpy, + Drawable d, + GC gc, + register XImage *image, + int req_xoffset, + int req_yoffset, + int x, int y, + unsigned int req_width, + unsigned int req_height, + int dest_bits_per_pixel, + int dest_scanline_pad) +{ + int left_pad, BytesPerRow, Available; + + if ((req_width == 0) || (req_height == 0)) + return; + + Available = ((65536 < dpy->max_request_size) ? (65536 << 2) + : (dpy->max_request_size << 2)) + - SIZEOF(xPutImageReq); + + if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) { + left_pad = (image->xoffset + req_xoffset) & (dpy->bitmap_unit - 1); + BytesPerRow = (ROUNDUP((long)req_width + left_pad, + dpy->bitmap_pad) >> 3) * image->depth; + } else { + left_pad = 0; + BytesPerRow = ROUNDUP((long)req_width * dest_bits_per_pixel, + dest_scanline_pad) >> 3; + } + + if ((BytesPerRow * req_height) <= Available) { + PutImageRequest(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + req_width, req_height, + dest_bits_per_pixel, dest_scanline_pad); + } else if (req_height > 1) { + int SubImageHeight = Available / BytesPerRow; + + if (SubImageHeight == 0) + SubImageHeight = 1; + + PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + req_width, (unsigned int) SubImageHeight, + dest_bits_per_pixel, dest_scanline_pad); + + PutSubImage(dpy, d, gc, image, req_xoffset, + req_yoffset + SubImageHeight, x, y + SubImageHeight, + req_width, req_height - SubImageHeight, + dest_bits_per_pixel, dest_scanline_pad); + } else { + int SubImageWidth = (((Available << 3) / dest_scanline_pad) + * dest_scanline_pad) - left_pad; + + PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + (unsigned int) SubImageWidth, 1, + dest_bits_per_pixel, dest_scanline_pad); + + PutSubImage(dpy, d, gc, image, req_xoffset + SubImageWidth, + req_yoffset, x + SubImageWidth, y, + req_width - SubImageWidth, 1, + dest_bits_per_pixel, dest_scanline_pad); + } +} + + +int +XPutImage ( + register Display *dpy, + Drawable d, + GC gc, + register XImage *image, + int req_xoffset, + int req_yoffset, + int x, + int y, + unsigned int req_width, + unsigned int req_height) + +{ + long width = req_width; + long height = req_height; + int dest_bits_per_pixel, dest_scanline_pad; + + if (req_xoffset < 0) { + width += req_xoffset; + req_xoffset = 0; + } + if (req_yoffset < 0) { + height += req_yoffset; + req_yoffset = 0; + } + if ((req_xoffset + width) > image->width) + width = image->width - req_xoffset; + if ((req_yoffset + height) > image->height) + height = image->height - req_yoffset; + if ((width <= 0) || (height <= 0)) + return 0; + + if ((image->bits_per_pixel == 1) || (image->format != ZPixmap)) { + dest_bits_per_pixel = 1; + dest_scanline_pad = dpy->bitmap_pad; + } else { + register int n; + register ScreenFormat *format; + + dest_bits_per_pixel = image->bits_per_pixel; + dest_scanline_pad = image->bitmap_pad; + for (n = dpy->nformats, format = dpy->pixmap_format; --n >= 0; format++) + if (format->depth == image->depth) { + dest_bits_per_pixel = format->bits_per_pixel; + dest_scanline_pad = format->scanline_pad; + } + if (dest_bits_per_pixel != image->bits_per_pixel) { + XImage img; + register long i, j; + /* XXX slow, but works */ + img.width = width; + img.height = height; + img.xoffset = 0; + img.format = ZPixmap; + img.byte_order = dpy->byte_order; + img.bitmap_unit = dpy->bitmap_unit; + img.bitmap_bit_order = dpy->bitmap_bit_order; + img.bitmap_pad = dest_scanline_pad; + img.depth = image->depth; + img.bits_per_pixel = dest_bits_per_pixel; + img.bytes_per_line = ROUNDUP((dest_bits_per_pixel * width), + dest_scanline_pad) >> 3; + img.data = Xmalloc(img.bytes_per_line * height); + if (img.data == NULL) + return 0; + _XInitImageFuncPtrs(&img); + for (j = height; --j >= 0; ) + for (i = width; --i >= 0; ) + XPutPixel(&img, i, j, XGetPixel(image, req_xoffset + i, + req_yoffset + j)); + LockDisplay(dpy); + FlushGC(dpy, gc); + PutSubImage(dpy, d, gc, &img, 0, 0, x, y, + (unsigned int) width, (unsigned int) height, + dest_bits_per_pixel, dest_scanline_pad); + UnlockDisplay(dpy); + SyncHandle(); + Xfree(img.data); + return 0; + } + } + + LockDisplay(dpy); + FlushGC(dpy, gc); + + PutSubImage(dpy, d, gc, image, req_xoffset, req_yoffset, x, y, + (unsigned int) width, (unsigned int) height, + dest_bits_per_pixel, dest_scanline_pad); + + UnlockDisplay(dpy); + SyncHandle(); +#ifdef USE_DYNAMIC_XCURSOR + if (image->bits_per_pixel == 1 && + x == 0 && y == 0 && + width == image->width && height == image->height && + gc->values.function == GXcopy && + (gc->values.plane_mask & 1)) + { + _XNoticePutBitmap (dpy, d, image); + } +#endif + return 0; +} diff --git a/nx-X11/lib/src/QuBest.c b/nx-X11/lib/src/QuBest.c new file mode 100644 index 000000000..97b1f116b --- /dev/null +++ b/nx-X11/lib/src/QuBest.c @@ -0,0 +1,61 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XQueryBestSize( + register Display *dpy, + int class, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ + xQueryBestSizeReply rep; + register xQueryBestSizeReq *req; + + LockDisplay(dpy); + GetReq(QueryBestSize, req); + req->class = class; + req->drawable = drawable; + req->width = width; + req->height = height; + if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + *ret_width = rep.width; + *ret_height = rep.height; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/QuColor.c b/nx-X11/lib/src/QuColor.c new file mode 100644 index 000000000..4638095c0 --- /dev/null +++ b/nx-X11/lib/src/QuColor.c @@ -0,0 +1,61 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XQueryColor( + register Display *dpy, + Colormap cmap, + XColor *def) /* RETURN */ +{ + xrgb color; + xQueryColorsReply rep; + register xQueryColorsReq *req; + unsigned long val = def->pixel; /* needed for macro below */ + + LockDisplay(dpy); + GetReqExtra(QueryColors, 4, req); /* a pixel (CARD32) is 4 bytes */ + req->cmap = cmap; + + OneDataCard32 (dpy, NEXTPTR(req,xQueryColorsReq), val); + + if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { + + _XRead(dpy, (char *)&color, (long) SIZEOF(xrgb)); + + def->red = color.red; + def->blue = color.blue; + def->green = color.green; + def->flags = DoRed | DoGreen | DoBlue; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/QuColors.c b/nx-X11/lib/src/QuColors.c new file mode 100644 index 000000000..0b9bc508f --- /dev/null +++ b/nx-X11/lib/src/QuColors.c @@ -0,0 +1,99 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +static void +_XQueryColors( + register Display *dpy, + Colormap cmap, + XColor *defs, /* RETURN */ + int ncolors) +{ + register int i; + xQueryColorsReply rep; + register xQueryColorsReq *req; + + GetReq(QueryColors, req); + + req->cmap = cmap; + SetReqLen(req, ncolors, ncolors); /* each pixel is a CARD32 */ + + for (i = 0; i < ncolors; i++) + Data32 (dpy, (long *)&defs[i].pixel, 4L); + /* XXX this isn't very efficient */ + + if (_XReply(dpy, (xReply *) &rep, 0, xFalse) != 0) { + unsigned long nbytes = (long) ncolors * SIZEOF(xrgb); + xrgb *color = Xmalloc(nbytes); + if (color != NULL) { + + _XRead(dpy, (char *) color, nbytes); + + for (i = 0; i < ncolors; i++) { + register XColor *def = &defs[i]; + register xrgb *rgb = &color[i]; + def->red = rgb->red; + def->green = rgb->green; + def->blue = rgb->blue; + def->flags = DoRed | DoGreen | DoBlue; + } + Xfree(color); + } + else + _XEatDataWords(dpy, rep.length); + } +} + +int +XQueryColors( + register Display * const dpy, + const Colormap cmap, + XColor *defs, /* RETURN */ + int ncolors) +{ + int n; + + if (dpy->bigreq_size > 0) + n = dpy->bigreq_size - (sizeof (xQueryColorsReq) >> 2) - 1; + else + n = dpy->max_request_size - (sizeof (xQueryColorsReq) >> 2); + + LockDisplay(dpy); + while (ncolors >= n) { + _XQueryColors(dpy, cmap, defs, n); + defs += n; + ncolors -= n; + } + if (ncolors > 0) + _XQueryColors(dpy, cmap, defs, ncolors); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/QuCurShp.c b/nx-X11/lib/src/QuCurShp.c new file mode 100644 index 000000000..bb17c42fc --- /dev/null +++ b/nx-X11/lib/src/QuCurShp.c @@ -0,0 +1,60 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XQueryBestCursor( + register Display *dpy, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ + xQueryBestSizeReply rep; + register xQueryBestSizeReq *req; + + LockDisplay(dpy); + GetReq(QueryBestSize, req); + req->class = CursorShape; + req->drawable = drawable; + req->width = width; + req->height = height; + if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + *ret_width = rep.width; + *ret_height = rep.height; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/QuExt.c b/nx-X11/lib/src/QuExt.c new file mode 100644 index 000000000..4e230e776 --- /dev/null +++ b/nx-X11/lib/src/QuExt.c @@ -0,0 +1,56 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Bool +XQueryExtension( + register Display *dpy, + _Xconst char *name, + int *major_opcode, /* RETURN */ + int *first_event, /* RETURN */ + int *first_error) /* RETURN */ +{ + xQueryExtensionReply rep; + register xQueryExtensionReq *req; + + LockDisplay(dpy); + GetReq(QueryExtension, req); + req->nbytes = name ? strlen(name) : 0; + req->length += (req->nbytes+(unsigned)3)>>2; + _XSend(dpy, name, (long)req->nbytes); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + *major_opcode = rep.major_opcode; + *first_event = rep.first_event; + *first_error = rep.first_error; + UnlockDisplay(dpy); + SyncHandle(); + return (rep.present); +} + diff --git a/nx-X11/lib/src/QuKeybd.c b/nx-X11/lib/src/QuKeybd.c new file mode 100644 index 000000000..0a2d4d0fc --- /dev/null +++ b/nx-X11/lib/src/QuKeybd.c @@ -0,0 +1,53 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +struct kmap { + char map[32]; +}; + +int +XQueryKeymap( + register Display *dpy, + char keys[32]) +{ + xQueryKeymapReply rep; + _X_UNUSED register xReq *req; + + LockDisplay(dpy); + GetEmptyReq(QueryKeymap, req); + (void) _XReply(dpy, (xReply *)&rep, + (SIZEOF(xQueryKeymapReply) - SIZEOF(xReply)) >> 2, xTrue); + *(struct kmap *) keys = *(struct kmap *)rep.map; /* faster than memcpy */ + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/QuPntr.c b/nx-X11/lib/src/QuPntr.c new file mode 100644 index 000000000..e1379a6f5 --- /dev/null +++ b/nx-X11/lib/src/QuPntr.c @@ -0,0 +1,65 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Bool XQueryPointer( + register Display *dpy, + Window w, + Window *root, + Window *child, + int *root_x, + int *root_y, + int *win_x, + int *win_y, + unsigned int *mask) +{ + xQueryPointerReply rep; + xResourceReq *req; + + LockDisplay(dpy); + GetResReq(QueryPointer, w, req); + if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return(False); + } + + *root = rep.root; + *child = rep.child; + *root_x = cvtINT16toInt (rep.rootX); + *root_y = cvtINT16toInt (rep.rootY); + *win_x = cvtINT16toInt (rep.winX); + *win_y = cvtINT16toInt (rep.winY); + *mask = rep.mask; + UnlockDisplay(dpy); + SyncHandle(); + return (rep.sameScreen); +} + diff --git a/nx-X11/lib/src/QuStipShp.c b/nx-X11/lib/src/QuStipShp.c new file mode 100644 index 000000000..9f612fcb1 --- /dev/null +++ b/nx-X11/lib/src/QuStipShp.c @@ -0,0 +1,60 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XQueryBestStipple( + register Display *dpy, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ + xQueryBestSizeReply rep; + register xQueryBestSizeReq *req; + + LockDisplay(dpy); + GetReq(QueryBestSize, req); + req->class = StippleShape; + req->drawable = drawable; + req->width = width; + req->height = height; + if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + *ret_width = rep.width; + *ret_height = rep.height; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/QuTextE16.c b/nx-X11/lib/src/QuTextE16.c new file mode 100644 index 000000000..e458bc52c --- /dev/null +++ b/nx-X11/lib/src/QuTextE16.c @@ -0,0 +1,81 @@ +/* + +Copyright 1986, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XQueryTextExtents16 ( + register Display *dpy, + Font fid, + _Xconst XChar2b *string, + register int nchars, + int *dir, + int *font_ascent, + int *font_descent, + register XCharStruct *overall) +{ + register long i; + register unsigned char *ptr; + char *buf; + xQueryTextExtentsReply rep; + long nbytes; + register xQueryTextExtentsReq *req; + + LockDisplay(dpy); + nbytes = nchars << 1; + GetReq(QueryTextExtents, req); + req->fid = fid; + if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { + req->length += (nbytes + 3)>>2; + req->oddLength = nchars & 1; + for (ptr = (unsigned char *)buf, i = nchars; --i >= 0; string++) { + *ptr++ = string->byte1; + *ptr++ = string->byte2; + } + Data (dpy, buf, nbytes); + } + if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + *dir = rep.drawDirection; + *font_ascent = cvtINT16toInt (rep.fontAscent); + *font_descent = cvtINT16toInt (rep.fontDescent); + overall->ascent = (short) cvtINT16toShort (rep.overallAscent); + overall->descent = (short) cvtINT16toShort (rep.overallDescent); + /* XXX bogus - we're throwing away information!!! */ + overall->width = (short) cvtINT32toInt (rep.overallWidth); + overall->lbearing = (short) cvtINT32toInt (rep.overallLeft); + overall->rbearing = (short) cvtINT32toInt (rep.overallRight); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/QuTextExt.c b/nx-X11/lib/src/QuTextExt.c new file mode 100644 index 000000000..8a17dbb27 --- /dev/null +++ b/nx-X11/lib/src/QuTextExt.c @@ -0,0 +1,80 @@ +/* + +Copyright 1986, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XQueryTextExtents ( + register Display *dpy, + Font fid, + register _Xconst char *string, + register int nchars, + int *dir, + int *font_ascent, + int *font_descent, + register XCharStruct *overall) +{ + register int i; + register char *ptr; + char *buf; + xQueryTextExtentsReply rep; + long nbytes; + register xQueryTextExtentsReq *req; + + LockDisplay(dpy); + nbytes = nchars << 1; + GetReq(QueryTextExtents, req); + req->fid = fid; + if ((buf = _XAllocScratch (dpy, (unsigned long) nbytes))) { + req->length += (nbytes + 3)>>2; + req->oddLength = nchars & 1; + for (ptr = buf, i = nchars; --i >= 0;) { + *ptr++ = 0; + *ptr++ = *string++; + } + Data (dpy, buf, nbytes); + } + if (!_XReply (dpy, (xReply *)&rep, 0, xTrue) || !buf) { + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + *dir = rep.drawDirection; + *font_ascent = cvtINT16toInt (rep.fontAscent); + *font_descent = cvtINT16toInt (rep.fontDescent); + overall->ascent = (short) cvtINT16toShort (rep.overallAscent); + overall->descent = (short) cvtINT16toShort (rep.overallDescent); + /* XXX bogus - we're throwing away information!!! */ + overall->width = (short) cvtINT32toInt (rep.overallWidth); + overall->lbearing = (short) cvtINT32toInt (rep.overallLeft); + overall->rbearing = (short) cvtINT32toInt (rep.overallRight); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/QuTileShp.c b/nx-X11/lib/src/QuTileShp.c new file mode 100644 index 000000000..f713f4248 --- /dev/null +++ b/nx-X11/lib/src/QuTileShp.c @@ -0,0 +1,61 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XQueryBestTile( + register Display *dpy, + Drawable drawable, + unsigned int width, + unsigned int height, + unsigned int *ret_width, + unsigned int *ret_height) +{ + xQueryBestSizeReply rep; + register xQueryBestSizeReq *req; + + LockDisplay(dpy); + GetReq(QueryBestSize, req); + req->class = TileShape; + req->drawable = drawable; + req->width = width; + req->height = height; + if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return(0); + } + + *ret_width = rep.width; + *ret_height = rep.height; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/QuTree.c b/nx-X11/lib/src/QuTree.c new file mode 100644 index 000000000..8da2ae261 --- /dev/null +++ b/nx-X11/lib/src/QuTree.c @@ -0,0 +1,72 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Status XQueryTree ( + register Display *dpy, + Window w, + Window *root, /* RETURN */ + Window *parent, /* RETURN */ + Window **children, /* RETURN */ + unsigned int *nchildren) /* RETURN */ +{ + unsigned long nbytes; + xQueryTreeReply rep; + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(QueryTree, w, req); + if (!_XReply(dpy, (xReply *)&rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + + *children = (Window *) NULL; + if (rep.nChildren != 0) { + nbytes = rep.nChildren * sizeof(Window); + *children = Xmalloc(nbytes); + if (! *children) { + _XEatDataWords(dpy, rep.length); + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + nbytes = rep.nChildren << 2; + _XRead32 (dpy, (long *) *children, nbytes); + } + *parent = rep.parent; + *root = rep.root; + *nchildren = rep.nChildren; + UnlockDisplay(dpy); + SyncHandle(); + return (1); +} + diff --git a/nx-X11/lib/src/Quarks.c b/nx-X11/lib/src/Quarks.c new file mode 100644 index 000000000..132ec6f67 --- /dev/null +++ b/nx-X11/lib/src/Quarks.c @@ -0,0 +1,408 @@ + +/*********************************************************** +Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard, + + All Rights Reserved + +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 +supporting documentation, and that the name Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ +/* + +Copyright 1987, 1988, 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "Xresinternal.h" + +/* Not cost effective, at least for vanilla MIT clients */ +/* #define PERMQ */ + +#ifdef PERMQ +typedef unsigned char Bits; +#endif +typedef unsigned long Entry; /* dont confuse with EntryRec from Xintatom.h */ + +static XrmQuark nextQuark = 1; /* next available quark number */ +static unsigned long quarkMask = 0; +static Entry zero = 0; +static Entry *quarkTable = &zero; /* crock */ +static unsigned long quarkRehash; +static XrmString **stringTable = NULL; +#ifdef PERMQ +static Bits **permTable = NULL; +#endif +static XrmQuark nextUniq = -1; /* next quark from XrmUniqueQuark */ + +#define QUANTUMSHIFT 8 +#define QUANTUMMASK ((1 << QUANTUMSHIFT) - 1) +#define CHUNKPER 8 +#define CHUNKMASK ((CHUNKPER << QUANTUMSHIFT) - 1) + +#define LARGEQUARK ((Entry)0x80000000L) +#define QUARKSHIFT 18 +#define QUARKMASK ((LARGEQUARK - 1) >> QUARKSHIFT) +#define XSIGMASK ((1L << QUARKSHIFT) - 1) + +#define STRQUANTSIZE (sizeof(XrmString) * (QUANTUMMASK + 1)) +#ifdef PERMQ +#define QUANTSIZE (STRQUANTSIZE + \ + (sizeof(Bits) * ((QUANTUMMASK + 1) >> 3)) +#else +#define QUANTSIZE STRQUANTSIZE +#endif + +#define HASH(sig) ((sig) & quarkMask) +#define REHASHVAL(sig) ((((sig) % quarkRehash) + 2) | 1) +#define REHASH(idx,rehash) ((idx + rehash) & quarkMask) +#define NAME(q) stringTable[(q) >> QUANTUMSHIFT][(q) & QUANTUMMASK] +#ifdef PERMQ +#define BYTEREF(q) permTable[(q) >> QUANTUMSHIFT][((q) & QUANTUMMASK) >> 3] +#define ISPERM(q) (BYTEREF(q) & (1 << ((q) & 7))) +#define SETPERM(q) BYTEREF(q) |= (1 << ((q) & 7)) +#define CLEARPERM(q) BYTEREF(q) &= ~(1 << ((q) & 7)) +#endif + +/* Permanent memory allocation */ + +#define WALIGN sizeof(unsigned long) +#define DALIGN sizeof(double) + +#define NEVERFREETABLESIZE ((8192-12) & ~(DALIGN-1)) +static char *neverFreeTable = NULL; +static int neverFreeTableSize = 0; + +static char *permalloc(unsigned int length) +{ + char *ret; + + if (neverFreeTableSize < length) { + if (length >= NEVERFREETABLESIZE) + return Xmalloc(length); + if (! (ret = Xmalloc(NEVERFREETABLESIZE))) + return (char *) NULL; + neverFreeTableSize = NEVERFREETABLESIZE; + neverFreeTable = ret; + } + ret = neverFreeTable; + neverFreeTable += length; + neverFreeTableSize -= length; + return(ret); +} + +typedef struct {char a; double b;} TestType1; +typedef struct {char a; unsigned long b;} TestType2; + +#ifdef XTHREADS +static char *_Xpermalloc(unsigned int length); + +char *Xpermalloc(unsigned int length) +{ + char *p; + + _XLockMutex(_Xglobal_lock); + p = _Xpermalloc(length); + _XUnlockMutex(_Xglobal_lock); + return p; +} +#define Xpermalloc _Xpermalloc + +static +#endif /* XTHREADS */ +char *Xpermalloc(unsigned int length) +{ + int i; + + if (neverFreeTableSize && length < NEVERFREETABLESIZE) { + if ((sizeof(TestType1) != + (sizeof(TestType2) - sizeof(unsigned long) + sizeof(double))) && + !(length & (DALIGN-1)) && + ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (DALIGN-1)))) { + neverFreeTableSize -= DALIGN - i; + neverFreeTable += DALIGN - i; + } else + if ((i = (NEVERFREETABLESIZE - neverFreeTableSize) & (WALIGN-1))) { + neverFreeTableSize -= WALIGN - i; + neverFreeTable += WALIGN - i; + } + } + return permalloc(length); +} + +static Bool +ExpandQuarkTable(void) +{ + unsigned long oldmask, newmask; + register char c, *s; + register Entry *oldentries, *entries; + register Entry entry; + register int oldidx, newidx, rehash; + Signature sig; + XrmQuark q; + + oldentries = quarkTable; + if ((oldmask = quarkMask)) + newmask = (oldmask << 1) + 1; + else { + if (!stringTable) { + stringTable = Xmalloc(sizeof(XrmString *) * CHUNKPER); + if (!stringTable) + return False; + stringTable[0] = (XrmString *)NULL; + } +#ifdef PERMQ + if (!permTable) + permTable = Xmalloc(sizeof(Bits *) * CHUNKPER); + if (!permTable) + return False; +#endif + stringTable[0] = (XrmString *)Xpermalloc(QUANTSIZE); + if (!stringTable[0]) + return False; +#ifdef PERMQ + permTable[0] = (Bits *)((char *)stringTable[0] + STRQUANTSIZE); +#endif + newmask = 0x1ff; + } + entries = Xcalloc(newmask + 1, sizeof(Entry)); + if (!entries) + return False; + quarkTable = entries; + quarkMask = newmask; + quarkRehash = quarkMask - 2; + for (oldidx = 0; oldidx <= oldmask; oldidx++) { + if ((entry = oldentries[oldidx])) { + if (entry & LARGEQUARK) + q = entry & (LARGEQUARK-1); + else + q = (entry >> QUARKSHIFT) & QUARKMASK; + for (sig = 0, s = NAME(q); (c = *s++); ) + sig = (sig << 1) + c; + newidx = HASH(sig); + if (entries[newidx]) { + rehash = REHASHVAL(sig); + do { + newidx = REHASH(newidx, rehash); + } while (entries[newidx]); + } + entries[newidx] = entry; + } + } + if (oldmask) + Xfree(oldentries); + return True; +} + +XrmQuark +_XrmInternalStringToQuark( + register _Xconst char *name, register int len, register Signature sig, + Bool permstring) +{ + register XrmQuark q; + register Entry entry; + register int idx, rehash; + register int i; + register char *s1, *s2; + char *new; + + rehash = 0; + idx = HASH(sig); + _XLockMutex(_Xglobal_lock); + while ((entry = quarkTable[idx])) { + if (entry & LARGEQUARK) + q = entry & (LARGEQUARK-1); + else { + if ((entry - sig) & XSIGMASK) + goto nomatch; + q = (entry >> QUARKSHIFT) & QUARKMASK; + } + for (i = len, s1 = (char *)name, s2 = NAME(q); --i >= 0; ) { + if (*s1++ != *s2++) + goto nomatch; + } + if (*s2) { +nomatch: if (!rehash) + rehash = REHASHVAL(sig); + idx = REHASH(idx, rehash); + continue; + } +#ifdef PERMQ + if (permstring && !ISPERM(q)) { + Xfree(NAME(q)); + NAME(q) = (char *)name; + SETPERM(q); + } +#endif + _XUnlockMutex(_Xglobal_lock); + return q; + } + if (nextUniq == nextQuark) + goto fail; + if ((nextQuark + (nextQuark >> 2)) > quarkMask) { + if (!ExpandQuarkTable()) + goto fail; + _XUnlockMutex(_Xglobal_lock); + return _XrmInternalStringToQuark(name, len, sig, permstring); + } + q = nextQuark; + if (!(q & QUANTUMMASK)) { + if (!(q & CHUNKMASK)) { + if (!(new = Xrealloc(stringTable, + sizeof(XrmString *) * + ((q >> QUANTUMSHIFT) + CHUNKPER)))) + goto fail; + stringTable = (XrmString **)new; +#ifdef PERMQ + if (!(new = Xrealloc(permTable, + sizeof(Bits *) * + ((q >> QUANTUMSHIFT) + CHUNKPER)))) + goto fail; + permTable = (Bits **)new; +#endif + } + new = Xpermalloc(QUANTSIZE); + if (!new) + goto fail; + stringTable[q >> QUANTUMSHIFT] = (XrmString *)new; +#ifdef PERMQ + permTable[q >> QUANTUMSHIFT] = (Bits *)(new + STRQUANTSIZE); +#endif + } + if (!permstring) { + s2 = (char *)name; +#ifdef PERMQ + name = Xmalloc(len+1); +#else + name = permalloc(len+1); +#endif + if (!name) + goto fail; + for (i = len, s1 = (char *)name; --i >= 0; ) + *s1++ = *s2++; + *s1++ = '\0'; +#ifdef PERMQ + CLEARPERM(q); + } + else { + SETPERM(q); +#endif + } + NAME(q) = (char *)name; + if (q <= QUARKMASK) + entry = (q << QUARKSHIFT) | (sig & XSIGMASK); + else + entry = q | LARGEQUARK; + quarkTable[idx] = entry; + nextQuark++; + _XUnlockMutex(_Xglobal_lock); + return q; + fail: + _XUnlockMutex(_Xglobal_lock); + return NULLQUARK; +} + +XrmQuark +XrmStringToQuark( + _Xconst char *name) +{ + register char c, *tname; + register Signature sig = 0; + + if (!name) + return (NULLQUARK); + + for (tname = (char *)name; (c = *tname++); ) + sig = (sig << 1) + c; + + return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, False); +} + +XrmQuark +XrmPermStringToQuark( + _Xconst char *name) +{ + register char c, *tname; + register Signature sig = 0; + + if (!name) + return (NULLQUARK); + + for (tname = (char *)name; (c = *tname++); ) + sig = (sig << 1) + c; + + return _XrmInternalStringToQuark(name, tname-(char *)name-1, sig, True); +} + +XrmQuark XrmUniqueQuark(void) +{ + XrmQuark q; + + _XLockMutex(_Xglobal_lock); + if (nextUniq == nextQuark) + q = NULLQUARK; + else + q = nextUniq--; + _XUnlockMutex(_Xglobal_lock); + return q; +} + +XrmString XrmQuarkToString(register XrmQuark quark) +{ + XrmString s; + + _XLockMutex(_Xglobal_lock); + if (quark <= 0 || quark >= nextQuark) + s = NULLSTRING; + else { +#ifdef PERMQ + /* We have to mark the quark as permanent, since the caller might hold + * onto the string pointer forver. + */ + SETPERM(quark); +#endif + s = NAME(quark); + } + _XUnlockMutex(_Xglobal_lock); + return s; +} diff --git a/nx-X11/lib/src/RaiseWin.c b/nx-X11/lib/src/RaiseWin.c new file mode 100644 index 000000000..f431db579 --- /dev/null +++ b/nx-X11/lib/src/RaiseWin.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XRaiseWindow ( + register Display *dpy, + Window w) +{ + register xConfigureWindowReq *req; + unsigned long val = Above; /* needed for macro below */ + + LockDisplay(dpy); + GetReqExtra(ConfigureWindow, 4, req); + req->window = w; + req->mask = CWStackMode; + OneDataCard32 (dpy, NEXTPTR(req,xConfigureWindowReq), val); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/RdBitF.c b/nx-X11/lib/src/RdBitF.c new file mode 100644 index 000000000..319a0ee0b --- /dev/null +++ b/nx-X11/lib/src/RdBitF.c @@ -0,0 +1,258 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * Code to read bitmaps from disk files. Interprets + * data from X10 and X11 bitmap files and creates + * Pixmap representations of files. Returns Pixmap + * ID and specifics about image. + * + * Modified for speedup by Jim Becker, changed image + * data parsing logic (removed some fscanf()s). + * Aug 5, 1988 + * + * Note that this file and ../Xmu/RdBitF.c look very similar.... Keep them + * that way (but don't use common source code so that people can have one + * without the other). + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "Xutil.h" +#include +#include + + +#define MAX_SIZE 255 + +/* shared data for the image read/parse logic */ +static const short hexTable[256] = { + ['0'] = 0, ['1'] = 1, + ['2'] = 2, ['3'] = 3, + ['4'] = 4, ['5'] = 5, + ['6'] = 6, ['7'] = 7, + ['8'] = 8, ['9'] = 9, + ['A'] = 10, ['B'] = 11, + ['C'] = 12, ['D'] = 13, + ['E'] = 14, ['F'] = 15, + ['a'] = 10, ['b'] = 11, + ['c'] = 12, ['d'] = 13, + ['e'] = 14, ['f'] = 15, + + [' '] = -1, [','] = -1, + ['}'] = -1, ['\n'] = -1, + ['\t'] = -1 +}; + +/* + * read next hex value in the input stream, return -1 if EOF + */ +static int +NextInt ( + FILE *fstream) +{ + int ch; + int value = 0; + int gotone = 0; + int done = 0; + + /* loop, accumulate hex value until find delimiter */ + /* skip any initial delimiters found in read stream */ + + while (!done) { + ch = getc(fstream); + if (ch == EOF) { + value = -1; + done++; + } else { + /* trim high bits, check type and accumulate */ + ch &= 0xff; + if (isascii(ch) && isxdigit(ch)) { + value = (value << 4) + hexTable[ch]; + gotone++; + } else if ((hexTable[ch]) < 0 && gotone) + done++; + } + } + return value; +} + +int +XReadBitmapFileData ( + _Xconst char *filename, + unsigned int *width, /* RETURNED */ + unsigned int *height, /* RETURNED */ + unsigned char **data, /* RETURNED */ + int *x_hot, /* RETURNED */ + int *y_hot) /* RETURNED */ +{ + FILE *fstream; /* handle on file */ + unsigned char *bits = NULL; /* working variable */ + char line[MAX_SIZE]; /* input line from file */ + int size; /* number of bytes of data */ + char name_and_type[MAX_SIZE]; /* an input line */ + char *type; /* for parsing */ + int value; /* from an input line */ + int version10p; /* boolean, old format */ + int padding; /* to handle alignment */ + int bytes_per_line; /* per scanline of data */ + unsigned int ww = 0; /* width */ + unsigned int hh = 0; /* height */ + int hx = -1; /* x hotspot */ + int hy = -1; /* y hotspot */ + + if (!(fstream = fopen(filename, "r"))) + return BitmapOpenFailed; + + /* error cleanup and return macro */ +#define RETURN(code) \ +{ Xfree (bits); fclose (fstream); return code; } + + while (fgets(line, MAX_SIZE, fstream)) { + if (strlen(line) == MAX_SIZE-1) + RETURN (BitmapFileInvalid); + if (sscanf(line,"#define %s %d",name_and_type,&value) == 2) { + if (!(type = strrchr(name_and_type, '_'))) + type = name_and_type; + else + type++; + + if (!strcmp("width", type)) + ww = (unsigned int) value; + if (!strcmp("height", type)) + hh = (unsigned int) value; + if (!strcmp("hot", type)) { + if (type-- == name_and_type || type-- == name_and_type) + continue; + if (!strcmp("x_hot", type)) + hx = value; + if (!strcmp("y_hot", type)) + hy = value; + } + continue; + } + + if (sscanf(line, "static short %s = {", name_and_type) == 1) + version10p = 1; + else if (sscanf(line,"static unsigned char %s = {",name_and_type) == 1) + version10p = 0; + else if (sscanf(line, "static char %s = {", name_and_type) == 1) + version10p = 0; + else + continue; + + if (!(type = strrchr(name_and_type, '_'))) + type = name_and_type; + else + type++; + + if (strcmp("bits[]", type)) + continue; + + if (!ww || !hh) + RETURN (BitmapFileInvalid); + + if ((ww % 16) && ((ww % 16) < 9) && version10p) + padding = 1; + else + padding = 0; + + bytes_per_line = (ww+7)/8 + padding; + + size = bytes_per_line * hh; + bits = Xmalloc (size); + if (!bits) + RETURN (BitmapNoMemory); + + if (version10p) { + unsigned char *ptr; + int bytes; + + for (bytes=0, ptr=bits; bytes> 8; + } + } else { + unsigned char *ptr; + int bytes; + + for (bytes=0, ptr=bits; bytes +#endif +#include "Xlibint.h" + +int +XRecolorCursor( + register Display *dpy, + Cursor cursor, + XColor *foreground, + XColor *background) +{ + register xRecolorCursorReq *req; + + LockDisplay(dpy); + GetReq(RecolorCursor, req); + req->cursor = cursor; + req->foreRed = foreground->red; + req->foreGreen = foreground->green; + req->foreBlue = foreground->blue; + req->backRed = background->red; + req->backGreen = background->green; + req->backBlue = background->blue; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/ReconfWM.c b/nx-X11/lib/src/ReconfWM.c new file mode 100644 index 000000000..b3d8624cf --- /dev/null +++ b/nx-X11/lib/src/ReconfWM.c @@ -0,0 +1,142 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ + CWBorderWidth|CWSibling|CWStackMode) + +Status XReconfigureWMWindow ( + register Display *dpy, + Window w, + int screen, + unsigned int mask, + XWindowChanges *changes) +{ + Window root = RootWindow (dpy, screen); + _XAsyncHandler async; + _XAsyncErrorState async_state; + + /* + * Only need to go through the trouble if we are actually changing the + * stacking mode. + */ + if (!(mask & CWStackMode)) { + XConfigureWindow (dpy, w, mask, changes); + return True; + } + + + /* + * We need to inline XConfigureWindow and XSync so that everything is done + * while the display is locked. + */ + + LockDisplay(dpy); + + /* + * XConfigureWindow (dpy, w, mask, changes); + */ + { + unsigned long values[7]; + register unsigned long *value = values; + long nvalues; + register xConfigureWindowReq *req; + + GetReq(ConfigureWindow, req); + + async_state.min_sequence_number = dpy->request; + async_state.max_sequence_number = dpy->request; + async_state.error_code = BadMatch; + async_state.major_opcode = X_ConfigureWindow; + async_state.minor_opcode = 0; + async_state.error_count = 0; + async.next = dpy->async_handlers; + async.handler = _XAsyncErrorHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + + req->window = w; + mask &= AllMaskBits; + req->mask = mask; + + if (mask & CWX) *value++ = changes->x; + if (mask & CWY) *value++ = changes->y; + if (mask & CWWidth) *value++ = changes->width; + if (mask & CWHeight) *value++ = changes->height; + if (mask & CWBorderWidth) *value++ = changes->border_width; + if (mask & CWSibling) *value++ = changes->sibling; + if (mask & CWStackMode) *value++ = changes->stack_mode; + req->length += (nvalues = value - values); + nvalues <<= 2; /* watch out for macros... */ + Data32 (dpy, (long *) values, nvalues); + } + + /* + * XSync (dpy, 0) + */ + { + xGetInputFocusReply rep; + _X_UNUSED register xReq *req; + + GetEmptyReq(GetInputFocus, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + } + + DeqAsyncHandler(dpy, &async); + UnlockDisplay(dpy); + SyncHandle(); + + + /* + * If the request succeeded, then everything is okay; otherwise, send event + */ + if (!async_state.error_count) + return True; + else { + XConfigureRequestEvent ev = { + .type = ConfigureRequest, + .window = w, + .parent = root, + .value_mask = (mask & AllMaskBits), + .x = changes->x, + .y = changes->y, + .width = changes->width, + .height = changes->height, + .border_width = changes->border_width, + .above = changes->sibling, + .detail = changes->stack_mode, + }; + return (XSendEvent (dpy, root, False, + SubstructureRedirectMask|SubstructureNotifyMask, + (XEvent *)&ev)); + } +} diff --git a/nx-X11/lib/src/ReconfWin.c b/nx-X11/lib/src/ReconfWin.c new file mode 100644 index 000000000..bfa99f528 --- /dev/null +++ b/nx-X11/lib/src/ReconfWin.c @@ -0,0 +1,81 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define AllMaskBits (CWX|CWY|CWWidth|CWHeight|\ + CWBorderWidth|CWSibling|CWStackMode) + +int +XConfigureWindow( + register Display *dpy, + Window w, + unsigned int mask, + XWindowChanges *changes) +{ + unsigned long values[7]; + register unsigned long *value = values; + long nvalues; + register xConfigureWindowReq *req; + + LockDisplay(dpy); + GetReq(ConfigureWindow, req); + req->window = w; + mask &= AllMaskBits; + req->mask = mask; + + if (mask & CWX) + *value++ = changes->x; + + if (mask & CWY) + *value++ = changes->y; + + if (mask & CWWidth) + *value++ = changes->width; + + if (mask & CWHeight) + *value++ = changes->height; + + if (mask & CWBorderWidth) + *value++ = changes->border_width; + + if (mask & CWSibling) + *value++ = changes->sibling; + + if (mask & CWStackMode) + *value++ = changes->stack_mode; + + req->length += (nvalues = value - values); + + nvalues <<= 2; /* watch out for macros... */ + Data32 (dpy, (long *) values, nvalues); + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } diff --git a/nx-X11/lib/src/Region.c b/nx-X11/lib/src/Region.c new file mode 100644 index 000000000..28fa3e416 --- /dev/null +++ b/nx-X11/lib/src/Region.c @@ -0,0 +1,1605 @@ +/************************************************************************ + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +************************************************************************/ +/* + * The functions in this file implement the Region abstraction, similar to one + * used in the X11 sample server. A Region is simply an area, as the name + * implies, and is implemented as a "y-x-banded" array of rectangles. To + * explain: Each Region is made up of a certain number of rectangles sorted + * by y coordinate first, and then by x coordinate. + * + * Furthermore, the rectangles are banded such that every rectangle with a + * given upper-left y coordinate (y1) will have the same lower-right y + * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it + * will span the entire vertical distance of the band. This means that some + * areas that could be merged into a taller rectangle will be represented as + * several shorter rectangles to account for shorter rectangles to its left + * or right but within its "vertical scope". + * + * An added constraint on the rectangles is that they must cover as much + * horizontal area as possible. E.g. no two rectangles in a band are allowed + * to touch. + * + * Whenever possible, bands will be merged together to cover a greater vertical + * distance (and thus reduce the number of rectangles). Two bands can be merged + * only if the bottom of one touches the top of the other and they have + * rectangles in the same places (of the same width, of course). This maintains + * the y-x-banding that's so nice to have... + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" +#include +#include "poly.h" + +#ifdef DEBUG +#include +#define assert(expr) {if (!(expr)) fprintf(stderr,\ +"Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); } +#else +#define assert(expr) +#endif + +typedef int (*overlapProcp)( + register Region pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2); + +typedef int (*nonOverlapProcp)( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2); + +static void miRegionOp( + register Region newReg, /* Place to store result */ + Region reg1, /* First region in operation */ + Region reg2, /* 2d region in operation */ + int (*overlapFunc)( + register Region pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2), /* Function to call for over- + * lapping bands */ + int (*nonOverlap1Func)( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2), /* Function to call for non- + * overlapping bands in region + * 1 */ + int (*nonOverlap2Func)( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2)); /* Function to call for non- + * overlapping bands in region + * 2 */ + + +/* Create a new empty region */ +Region +XCreateRegion(void) +{ + Region temp; + + if (! (temp = Xmalloc(sizeof( REGION )))) + return (Region) NULL; + if (! (temp->rects = Xmalloc(sizeof( BOX )))) { + Xfree(temp); + return (Region) NULL; + } + temp->numRects = 0; + temp->extents.x1 = 0; + temp->extents.y1 = 0; + temp->extents.x2 = 0; + temp->extents.y2 = 0; + temp->size = 1; + return( temp ); +} + +int +XClipBox( + Region r, + XRectangle *rect) +{ + rect->x = r->extents.x1; + rect->y = r->extents.y1; + rect->width = r->extents.x2 - r->extents.x1; + rect->height = r->extents.y2 - r->extents.y1; + return 1; +} + +int +XUnionRectWithRegion( + register XRectangle *rect, + Region source, Region dest) +{ + REGION region; + + if (!rect->width || !rect->height) + return 0; + region.rects = ®ion.extents; + region.numRects = 1; + region.extents.x1 = rect->x; + region.extents.y1 = rect->y; + region.extents.x2 = rect->x + rect->width; + region.extents.y2 = rect->y + rect->height; + region.size = 1; + + return XUnionRegion(®ion, source, dest); +} + +/*- + *----------------------------------------------------------------------- + * miSetExtents -- + * Reset the extents of a region to what they should be. Called by + * miSubtract and miIntersect b/c they can't figure it out along the + * way or do so easily, as miUnion can. + * + * Results: + * None. + * + * Side Effects: + * The region's 'extents' structure is overwritten. + * + *----------------------------------------------------------------------- + */ +static void +miSetExtents ( + Region pReg) +{ + register BoxPtr pBox, + pBoxEnd, + pExtents; + + if (pReg->numRects == 0) + { + pReg->extents.x1 = 0; + pReg->extents.y1 = 0; + pReg->extents.x2 = 0; + pReg->extents.y2 = 0; + return; + } + + pExtents = &pReg->extents; + pBox = pReg->rects; + pBoxEnd = &pBox[pReg->numRects - 1]; + + /* + * Since pBox is the first rectangle in the region, it must have the + * smallest y1 and since pBoxEnd is the last rectangle in the region, + * it must have the largest y2, because of banding. Initialize x1 and + * x2 from pBox and pBoxEnd, resp., as good things to initialize them + * to... + */ + pExtents->x1 = pBox->x1; + pExtents->y1 = pBox->y1; + pExtents->x2 = pBoxEnd->x2; + pExtents->y2 = pBoxEnd->y2; + + assert(pExtents->y1 < pExtents->y2); + while (pBox <= pBoxEnd) + { + if (pBox->x1 < pExtents->x1) + { + pExtents->x1 = pBox->x1; + } + if (pBox->x2 > pExtents->x2) + { + pExtents->x2 = pBox->x2; + } + pBox++; + } + assert(pExtents->x1 < pExtents->x2); +} + +int +XSetRegion( + Display *dpy, + GC gc, + register Region r) +{ + register int i; + register XRectangle *xr, *pr; + register BOX *pb; + unsigned long total; + + LockDisplay (dpy); + total = r->numRects * sizeof (XRectangle); + if ((xr = (XRectangle *) _XAllocTemp(dpy, total))) { + for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) { + pr->x = pb->x1; + pr->y = pb->y1; + pr->width = pb->x2 - pb->x1; + pr->height = pb->y2 - pb->y1; + } + } + if (xr || !r->numRects) + _XSetClipRectangles(dpy, gc, 0, 0, xr, r->numRects, YXBanded); + if (xr) + _XFreeTemp(dpy, (char *)xr, total); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + +int +XDestroyRegion( + Region r) +{ + Xfree( (char *) r->rects ); + Xfree( (char *) r ); + return 1; +} + + +/* TranslateRegion(pRegion, x, y) + translates in place + added by raymond +*/ + +int +XOffsetRegion( + register Region pRegion, + register int x, + register int y) +{ + register int nbox; + register BOX *pbox; + + pbox = pRegion->rects; + nbox = pRegion->numRects; + + while(nbox--) + { + pbox->x1 += x; + pbox->x2 += x; + pbox->y1 += y; + pbox->y2 += y; + pbox++; + } + pRegion->extents.x1 += x; + pRegion->extents.x2 += x; + pRegion->extents.y1 += y; + pRegion->extents.y2 += y; + return 1; +} + +/* + Utility procedure Compress: + Replace r by the region r', where + p in r' iff (Quantifer m <= dx) (p + m in r), and + Quantifier is Exists if grow is TRUE, For all if grow is FALSE, and + (x,y) + m = (x+m,y) if xdir is TRUE; (x,y+m) if xdir is FALSE. + + Thus, if xdir is TRUE and grow is FALSE, r is replaced by the region + of all points p such that p and the next dx points on the same + horizontal scan line are all in r. We do this using by noting + that p is the head of a run of length 2^i + k iff p is the head + of a run of length 2^i and p+2^i is the head of a run of length + k. Thus, the loop invariant: s contains the region corresponding + to the runs of length shift. r contains the region corresponding + to the runs of length 1 + dxo & (shift-1), where dxo is the original + value of dx. dx = dxo & ~(shift-1). As parameters, s and t are + scratch regions, so that we don't have to allocate them on every + call. +*/ + +#define ZOpRegion(a,b,c) if (grow) XUnionRegion(a,b,c); \ + else XIntersectRegion(a,b,c) +#define ZShiftRegion(a,b) if (xdir) XOffsetRegion(a,b,0); \ + else XOffsetRegion(a,0,b) +#define ZCopyRegion(a,b) XUnionRegion(a,a,b) + +static void +Compress( + Region r, Region s, Region t, + register unsigned dx, + register int xdir, register int grow) +{ + register unsigned shift = 1; + + ZCopyRegion(r, s); + while (dx) { + if (dx & shift) { + ZShiftRegion(r, -(int)shift); + ZOpRegion(r, s, r); + dx -= shift; + if (!dx) break; + } + ZCopyRegion(s, t); + ZShiftRegion(s, -(int)shift); + ZOpRegion(s, t, s); + shift <<= 1; + } +} + +#undef ZOpRegion +#undef ZShiftRegion +#undef ZCopyRegion + +int +XShrinkRegion( + Region r, + int dx, int dy) +{ + Region s, t; + int grow; + + if (!dx && !dy) return 0; + if (! (s = XCreateRegion()) ) + return 0; + if (! (t = XCreateRegion()) ) { + XDestroyRegion(s); + return 0; + } + if ((grow = (dx < 0))) dx = -dx; + if (dx) Compress(r, s, t, (unsigned) 2*dx, TRUE, grow); + if ((grow = (dy < 0))) dy = -dy; + if (dy) Compress(r, s, t, (unsigned) 2*dy, FALSE, grow); + XOffsetRegion(r, dx, dy); + XDestroyRegion(s); + XDestroyRegion(t); + return 0; +} + + +/*====================================================================== + * Region Intersection + *====================================================================*/ +/*- + *----------------------------------------------------------------------- + * miIntersectO -- + * Handle an overlapping band for miIntersect. + * + * Results: + * None. + * + * Side Effects: + * Rectangles may be added to the region. + * + *----------------------------------------------------------------------- + */ +/* static void*/ +static int +miIntersectO ( + register Region pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2) +{ + register short x1; + register short x2; + register BoxPtr pNextRect; + + pNextRect = &pReg->rects[pReg->numRects]; + + while ((r1 != r1End) && (r2 != r2End)) + { + x1 = max(r1->x1,r2->x1); + x2 = min(r1->x2,r2->x2); + + /* + * If there's any overlap between the two rectangles, add that + * overlap to the new region. + * There's no need to check for subsumption because the only way + * such a need could arise is if some region has two rectangles + * right next to each other. Since that should never happen... + */ + if (x1 < x2) + { + assert(y1rects); + pNextRect->x1 = x1; + pNextRect->y1 = y1; + pNextRect->x2 = x2; + pNextRect->y2 = y2; + pReg->numRects += 1; + pNextRect++; + assert(pReg->numRects <= pReg->size); + } + + /* + * Need to advance the pointers. Shift the one that extends + * to the right the least, since the other still has a chance to + * overlap with that region's next rectangle, if you see what I mean. + */ + if (r1->x2 < r2->x2) + { + r1++; + } + else if (r2->x2 < r1->x2) + { + r2++; + } + else + { + r1++; + r2++; + } + } + return 0; /* lint */ +} + +int +XIntersectRegion( + Region reg1, + Region reg2, /* source regions */ + register Region newReg) /* destination Region */ +{ + /* check for trivial reject */ + if ( (!(reg1->numRects)) || (!(reg2->numRects)) || + (!EXTENTCHECK(®1->extents, ®2->extents))) + newReg->numRects = 0; + else + miRegionOp (newReg, reg1, reg2, + miIntersectO, NULL, NULL); + + /* + * Can't alter newReg's extents before we call miRegionOp because + * it might be one of the source regions and miRegionOp depends + * on the extents of those regions being the same. Besides, this + * way there's no checking against rectangles that will be nuked + * due to coalescing, so we have to examine fewer rectangles. + */ + miSetExtents(newReg); + return 1; +} + +static int +miRegionCopy( + register Region dstrgn, + register Region rgn) + +{ + if (dstrgn != rgn) /* don't want to copy to itself */ + { + if (dstrgn->size < rgn->numRects) + { + if (dstrgn->rects) + { + BOX *prevRects = dstrgn->rects; + + dstrgn->rects = Xrealloc(dstrgn->rects, + rgn->numRects * (sizeof(BOX))); + if (! dstrgn->rects) { + Xfree(prevRects); + dstrgn->size = 0; + return 0; + } + } + dstrgn->size = rgn->numRects; + } + dstrgn->numRects = rgn->numRects; + dstrgn->extents.x1 = rgn->extents.x1; + dstrgn->extents.y1 = rgn->extents.y1; + dstrgn->extents.x2 = rgn->extents.x2; + dstrgn->extents.y2 = rgn->extents.y2; + + memcpy((char *) dstrgn->rects, (char *) rgn->rects, + (int) (rgn->numRects * sizeof(BOX))); + } + return 1; +} + +/*====================================================================== + * Generic Region Operator + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * miCoalesce -- + * Attempt to merge the boxes in the current band with those in the + * previous one. Used only by miRegionOp. + * + * Results: + * The new index for the previous band. + * + * Side Effects: + * If coalescing takes place: + * - rectangles in the previous band will have their y2 fields + * altered. + * - pReg->numRects will be decreased. + * + *----------------------------------------------------------------------- + */ +/* static int*/ +static int +miCoalesce( + register Region pReg, /* Region to coalesce */ + int prevStart, /* Index of start of previous band */ + int curStart) /* Index of start of current band */ +{ + register BoxPtr pPrevBox; /* Current box in previous band */ + register BoxPtr pCurBox; /* Current box in current band */ + register BoxPtr pRegEnd; /* End of region */ + int curNumRects; /* Number of rectangles in current + * band */ + int prevNumRects; /* Number of rectangles in previous + * band */ + int bandY1; /* Y1 coordinate for current band */ + + pRegEnd = &pReg->rects[pReg->numRects]; + + pPrevBox = &pReg->rects[prevStart]; + prevNumRects = curStart - prevStart; + + /* + * Figure out how many rectangles are in the current band. Have to do + * this because multiple bands could have been added in miRegionOp + * at the end when one region has been exhausted. + */ + pCurBox = &pReg->rects[curStart]; + bandY1 = pCurBox->y1; + for (curNumRects = 0; + (pCurBox != pRegEnd) && (pCurBox->y1 == bandY1); + curNumRects++) + { + pCurBox++; + } + + if (pCurBox != pRegEnd) + { + /* + * If more than one band was added, we have to find the start + * of the last band added so the next coalescing job can start + * at the right place... (given when multiple bands are added, + * this may be pointless -- see above). + */ + pRegEnd--; + while (pRegEnd[-1].y1 == pRegEnd->y1) + { + pRegEnd--; + } + curStart = pRegEnd - pReg->rects; + pRegEnd = pReg->rects + pReg->numRects; + } + + if ((curNumRects == prevNumRects) && (curNumRects != 0)) { + pCurBox -= curNumRects; + /* + * The bands may only be coalesced if the bottom of the previous + * matches the top scanline of the current. + */ + if (pPrevBox->y2 == pCurBox->y1) + { + /* + * Make sure the bands have boxes in the same places. This + * assumes that boxes have been added in such a way that they + * cover the most area possible. I.e. two boxes in a band must + * have some horizontal space between them. + */ + do + { + if ((pPrevBox->x1 != pCurBox->x1) || + (pPrevBox->x2 != pCurBox->x2)) + { + /* + * The bands don't line up so they can't be coalesced. + */ + return (curStart); + } + pPrevBox++; + pCurBox++; + prevNumRects -= 1; + } while (prevNumRects != 0); + + pReg->numRects -= curNumRects; + pCurBox -= curNumRects; + pPrevBox -= curNumRects; + + /* + * The bands may be merged, so set the bottom y of each box + * in the previous band to that of the corresponding box in + * the current band. + */ + do + { + pPrevBox->y2 = pCurBox->y2; + pPrevBox++; + pCurBox++; + curNumRects -= 1; + } while (curNumRects != 0); + + /* + * If only one band was added to the region, we have to backup + * curStart to the start of the previous band. + * + * If more than one band was added to the region, copy the + * other bands down. The assumption here is that the other bands + * came from the same region as the current one and no further + * coalescing can be done on them since it's all been done + * already... curStart is already in the right place. + */ + if (pCurBox == pRegEnd) + { + curStart = prevStart; + } + else + { + do + { + *pPrevBox++ = *pCurBox++; + } while (pCurBox != pRegEnd); + } + + } + } + return (curStart); +} + +/*- + *----------------------------------------------------------------------- + * miRegionOp -- + * Apply an operation to two regions. Called by miUnion, miInverse, + * miSubtract, miIntersect... + * + * Results: + * None. + * + * Side Effects: + * The new region is overwritten. + * + * Notes: + * The idea behind this function is to view the two regions as sets. + * Together they cover a rectangle of area that this function divides + * into horizontal bands where points are covered only by one region + * or by both. For the first case, the nonOverlapFunc is called with + * each the band and the band's upper and lower extents. For the + * second, the overlapFunc is called to process the entire band. It + * is responsible for clipping the rectangles in the band, though + * this function provides the boundaries. + * At the end of each band, the new region is coalesced, if possible, + * to reduce the number of rectangles in the region. + * + *----------------------------------------------------------------------- + */ +/* static void*/ +static void +miRegionOp( + register Region newReg, /* Place to store result */ + Region reg1, /* First region in operation */ + Region reg2, /* 2d region in operation */ + int (*overlapFunc)( + register Region pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + short y1, + short y2), /* Function to call for over- + * lapping bands */ + int (*nonOverlap1Func)( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2), /* Function to call for non- + * overlapping bands in region + * 1 */ + int (*nonOverlap2Func)( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2)) /* Function to call for non- + * overlapping bands in region + * 2 */ +{ + register BoxPtr r1; /* Pointer into first region */ + register BoxPtr r2; /* Pointer into 2d region */ + BoxPtr r1End; /* End of 1st region */ + BoxPtr r2End; /* End of 2d region */ + register short ybot; /* Bottom of intersection */ + register short ytop; /* Top of intersection */ + BoxPtr oldRects; /* Old rects for newReg */ + int prevBand; /* Index of start of + * previous band in newReg */ + int curBand; /* Index of start of current + * band in newReg */ + register BoxPtr r1BandEnd; /* End of current band in r1 */ + register BoxPtr r2BandEnd; /* End of current band in r2 */ + short top; /* Top of non-overlapping + * band */ + short bot; /* Bottom of non-overlapping + * band */ + + /* + * Initialization: + * set r1, r2, r1End and r2End appropriately, preserve the important + * parts of the destination region until the end in case it's one of + * the two source regions, then mark the "new" region empty, allocating + * another array of rectangles for it to use. + */ + r1 = reg1->rects; + r2 = reg2->rects; + r1End = r1 + reg1->numRects; + r2End = r2 + reg2->numRects; + + oldRects = newReg->rects; + + EMPTY_REGION(newReg); + + /* + * Allocate a reasonable number of rectangles for the new region. The idea + * is to allocate enough so the individual functions don't need to + * reallocate and copy the array, which is time consuming, yet we don't + * have to worry about using too much memory. I hope to be able to + * nuke the Xrealloc() at the end of this function eventually. + */ + newReg->size = max(reg1->numRects,reg2->numRects) * 2; + + if (! (newReg->rects = Xmalloc (sizeof(BoxRec) * newReg->size))) { + newReg->size = 0; + return; + } + + /* + * Initialize ybot and ytop. + * In the upcoming loop, ybot and ytop serve different functions depending + * on whether the band being handled is an overlapping or non-overlapping + * band. + * In the case of a non-overlapping band (only one of the regions + * has points in the band), ybot is the bottom of the most recent + * intersection and thus clips the top of the rectangles in that band. + * ytop is the top of the next intersection between the two regions and + * serves to clip the bottom of the rectangles in the current band. + * For an overlapping band (where the two regions intersect), ytop clips + * the top of the rectangles of both regions and ybot clips the bottoms. + */ + if (reg1->extents.y1 < reg2->extents.y1) + ybot = reg1->extents.y1; + else + ybot = reg2->extents.y1; + + /* + * prevBand serves to mark the start of the previous band so rectangles + * can be coalesced into larger rectangles. qv. miCoalesce, above. + * In the beginning, there is no previous band, so prevBand == curBand + * (curBand is set later on, of course, but the first band will always + * start at index 0). prevBand and curBand must be indices because of + * the possible expansion, and resultant moving, of the new region's + * array of rectangles. + */ + prevBand = 0; + + do + { + curBand = newReg->numRects; + + /* + * This algorithm proceeds one source-band (as opposed to a + * destination band, which is determined by where the two regions + * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the + * rectangle after the last one in the current band for their + * respective regions. + */ + r1BandEnd = r1; + while ((r1BandEnd != r1End) && (r1BandEnd->y1 == r1->y1)) + { + r1BandEnd++; + } + + r2BandEnd = r2; + while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1)) + { + r2BandEnd++; + } + + /* + * First handle the band that doesn't intersect, if any. + * + * Note that attention is restricted to one band in the + * non-intersecting region at once, so if a region has n + * bands between the current position and the next place it overlaps + * the other, this entire loop will be passed through n times. + */ + if (r1->y1 < r2->y1) + { + top = max(r1->y1,ybot); + bot = min(r1->y2,r2->y1); + + if ((top != bot) && (nonOverlap1Func != NULL)) + { + (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot); + } + + ytop = r2->y1; + } + else if (r2->y1 < r1->y1) + { + top = max(r2->y1,ybot); + bot = min(r2->y2,r1->y1); + + if ((top != bot) && (nonOverlap2Func != NULL)) + { + (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot); + } + + ytop = r1->y1; + } + else + { + ytop = r1->y1; + } + + /* + * If any rectangles got added to the region, try and coalesce them + * with rectangles from the previous band. Note we could just do + * this test in miCoalesce, but some machines incur a not + * inconsiderable cost for function calls, so... + */ + if (newReg->numRects != curBand) + { + prevBand = miCoalesce (newReg, prevBand, curBand); + } + + /* + * Now see if we've hit an intersecting band. The two bands only + * intersect if ybot > ytop + */ + ybot = min(r1->y2, r2->y2); + curBand = newReg->numRects; + if (ybot > ytop) + { + (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot); + + } + + if (newReg->numRects != curBand) + { + prevBand = miCoalesce (newReg, prevBand, curBand); + } + + /* + * If we've finished with a band (y2 == ybot) we skip forward + * in the region to the next band. + */ + if (r1->y2 == ybot) + { + r1 = r1BandEnd; + } + if (r2->y2 == ybot) + { + r2 = r2BandEnd; + } + } while ((r1 != r1End) && (r2 != r2End)); + + /* + * Deal with whichever region still has rectangles left. + */ + curBand = newReg->numRects; + if (r1 != r1End) + { + if (nonOverlap1Func != NULL) + { + do + { + r1BandEnd = r1; + while ((r1BandEnd < r1End) && (r1BandEnd->y1 == r1->y1)) + { + r1BandEnd++; + } + (* nonOverlap1Func) (newReg, r1, r1BandEnd, + max(r1->y1,ybot), r1->y2); + r1 = r1BandEnd; + } while (r1 != r1End); + } + } + else if ((r2 != r2End) && (nonOverlap2Func != NULL)) + { + do + { + r2BandEnd = r2; + while ((r2BandEnd < r2End) && (r2BandEnd->y1 == r2->y1)) + { + r2BandEnd++; + } + (* nonOverlap2Func) (newReg, r2, r2BandEnd, + max(r2->y1,ybot), r2->y2); + r2 = r2BandEnd; + } while (r2 != r2End); + } + + if (newReg->numRects != curBand) + { + (void) miCoalesce (newReg, prevBand, curBand); + } + + /* + * A bit of cleanup. To keep regions from growing without bound, + * we shrink the array of rectangles to match the new number of + * rectangles in the region. This never goes to 0, however... + * + * Only do this stuff if the number of rectangles allocated is more than + * twice the number of rectangles in the region (a simple optimization...). + */ + if (newReg->numRects < (newReg->size >> 1)) + { + if (REGION_NOT_EMPTY(newReg)) + { + BoxPtr prev_rects = newReg->rects; + newReg->rects = Xrealloc (newReg->rects, + sizeof(BoxRec) * newReg->numRects); + if (! newReg->rects) + newReg->rects = prev_rects; + else + newReg->size = newReg->numRects; + } + else + { + /* + * No point in doing the extra work involved in an Xrealloc if + * the region is empty + */ + newReg->size = 1; + Xfree(newReg->rects); + newReg->rects = Xmalloc(sizeof(BoxRec)); + } + } + Xfree (oldRects); + return; +} + + +/*====================================================================== + * Region Union + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * miUnionNonO -- + * Handle a non-overlapping band for the union operation. Just + * Adds the rectangles into the region. Doesn't have to check for + * subsumption or anything. + * + * Results: + * None. + * + * Side Effects: + * pReg->numRects is incremented and the final rectangles overwritten + * with the rectangles we're passed. + * + *----------------------------------------------------------------------- + */ +/* static void*/ +static int +miUnionNonO ( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2) +{ + register BoxPtr pNextRect; + + pNextRect = &pReg->rects[pReg->numRects]; + + assert(y1 < y2); + + while (r != rEnd) + { + assert(r->x1 < r->x2); + MEMCHECK(pReg, pNextRect, pReg->rects); + pNextRect->x1 = r->x1; + pNextRect->y1 = y1; + pNextRect->x2 = r->x2; + pNextRect->y2 = y2; + pReg->numRects += 1; + pNextRect++; + + assert(pReg->numRects<=pReg->size); + r++; + } + return 0; /* lint */ +} + + +/*- + *----------------------------------------------------------------------- + * miUnionO -- + * Handle an overlapping band for the union operation. Picks the + * left-most rectangle each time and merges it into the region. + * + * Results: + * None. + * + * Side Effects: + * Rectangles are overwritten in pReg->rects and pReg->numRects will + * be changed. + * + *----------------------------------------------------------------------- + */ + +/* static void*/ +static int +miUnionO ( + register Region pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + register short y1, + register short y2) +{ + register BoxPtr pNextRect; + + pNextRect = &pReg->rects[pReg->numRects]; + +#define MERGERECT(r) \ + if ((pReg->numRects != 0) && \ + (pNextRect[-1].y1 == y1) && \ + (pNextRect[-1].y2 == y2) && \ + (pNextRect[-1].x2 >= r->x1)) \ + { \ + if (pNextRect[-1].x2 < r->x2) \ + { \ + pNextRect[-1].x2 = r->x2; \ + assert(pNextRect[-1].x1rects); \ + pNextRect->y1 = y1; \ + pNextRect->y2 = y2; \ + pNextRect->x1 = r->x1; \ + pNextRect->x2 = r->x2; \ + pReg->numRects += 1; \ + pNextRect += 1; \ + } \ + assert(pReg->numRects<=pReg->size);\ + r++; + + assert (y1x1 < r2->x1) + { + MERGERECT(r1); + } + else + { + MERGERECT(r2); + } + } + + if (r1 != r1End) + { + do + { + MERGERECT(r1); + } while (r1 != r1End); + } + else while (r2 != r2End) + { + MERGERECT(r2); + } + return 0; /* lint */ +} + +int +XUnionRegion( + Region reg1, + Region reg2, /* source regions */ + Region newReg) /* destination Region */ +{ + /* checks all the simple cases */ + + /* + * Region 1 and 2 are the same or region 1 is empty + */ + if ( (reg1 == reg2) || (!(reg1->numRects)) ) + { + if (newReg != reg2) + return miRegionCopy(newReg, reg2); + return 1; + } + + /* + * if nothing to union (region 2 empty) + */ + if (!(reg2->numRects)) + { + if (newReg != reg1) + return miRegionCopy(newReg, reg1); + return 1; + } + + /* + * Region 1 completely subsumes region 2 + */ + if ((reg1->numRects == 1) && + (reg1->extents.x1 <= reg2->extents.x1) && + (reg1->extents.y1 <= reg2->extents.y1) && + (reg1->extents.x2 >= reg2->extents.x2) && + (reg1->extents.y2 >= reg2->extents.y2)) + { + if (newReg != reg1) + return miRegionCopy(newReg, reg1); + return 1; + } + + /* + * Region 2 completely subsumes region 1 + */ + if ((reg2->numRects == 1) && + (reg2->extents.x1 <= reg1->extents.x1) && + (reg2->extents.y1 <= reg1->extents.y1) && + (reg2->extents.x2 >= reg1->extents.x2) && + (reg2->extents.y2 >= reg1->extents.y2)) + { + if (newReg != reg2) + return miRegionCopy(newReg, reg2); + return 1; + } + + miRegionOp (newReg, reg1, reg2, miUnionO, + miUnionNonO, miUnionNonO); + + newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1); + newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1); + newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2); + newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2); + + return 1; +} + + +/*====================================================================== + * Region Subtraction + *====================================================================*/ + +/*- + *----------------------------------------------------------------------- + * miSubtractNonO -- + * Deal with non-overlapping band for subtraction. Any parts from + * region 2 we discard. Anything from region 1 we add to the region. + * + * Results: + * None. + * + * Side Effects: + * pReg may be affected. + * + *----------------------------------------------------------------------- + */ +/* static void*/ +static int +miSubtractNonO1 ( + register Region pReg, + register BoxPtr r, + BoxPtr rEnd, + register short y1, + register short y2) +{ + register BoxPtr pNextRect; + + pNextRect = &pReg->rects[pReg->numRects]; + + assert(y1x1x2); + MEMCHECK(pReg, pNextRect, pReg->rects); + pNextRect->x1 = r->x1; + pNextRect->y1 = y1; + pNextRect->x2 = r->x2; + pNextRect->y2 = y2; + pReg->numRects += 1; + pNextRect++; + + assert(pReg->numRects <= pReg->size); + + r++; + } + return 0; /* lint */ +} + +/*- + *----------------------------------------------------------------------- + * miSubtractO -- + * Overlapping band subtraction. x1 is the left-most point not yet + * checked. + * + * Results: + * None. + * + * Side Effects: + * pReg may have rectangles added to it. + * + *----------------------------------------------------------------------- + */ +/* static void*/ +static int +miSubtractO ( + register Region pReg, + register BoxPtr r1, + BoxPtr r1End, + register BoxPtr r2, + BoxPtr r2End, + register short y1, + register short y2) +{ + register BoxPtr pNextRect; + register int x1; + + x1 = r1->x1; + + assert(y1rects[pReg->numRects]; + + while ((r1 != r1End) && (r2 != r2End)) + { + if (r2->x2 <= x1) + { + /* + * Subtrahend missed the boat: go to next subtrahend. + */ + r2++; + } + else if (r2->x1 <= x1) + { + /* + * Subtrahend preceeds minuend: nuke left edge of minuend. + */ + x1 = r2->x2; + if (x1 >= r1->x2) + { + /* + * Minuend completely covered: advance to next minuend and + * reset left fence to edge of new minuend. + */ + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + else + { + /* + * Subtrahend now used up since it doesn't extend beyond + * minuend + */ + r2++; + } + } + else if (r2->x1 < r1->x2) + { + /* + * Left part of subtrahend covers part of minuend: add uncovered + * part of minuend to region and skip to next subtrahend. + */ + assert(x1x1); + MEMCHECK(pReg, pNextRect, pReg->rects); + pNextRect->x1 = x1; + pNextRect->y1 = y1; + pNextRect->x2 = r2->x1; + pNextRect->y2 = y2; + pReg->numRects += 1; + pNextRect++; + + assert(pReg->numRects<=pReg->size); + + x1 = r2->x2; + if (x1 >= r1->x2) + { + /* + * Minuend used up: advance to new... + */ + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + else + { + /* + * Subtrahend used up + */ + r2++; + } + } + else + { + /* + * Minuend used up: add any remaining piece before advancing. + */ + if (r1->x2 > x1) + { + MEMCHECK(pReg, pNextRect, pReg->rects); + pNextRect->x1 = x1; + pNextRect->y1 = y1; + pNextRect->x2 = r1->x2; + pNextRect->y2 = y2; + pReg->numRects += 1; + pNextRect++; + assert(pReg->numRects<=pReg->size); + } + r1++; + if (r1 != r1End) + x1 = r1->x1; + } + } + + /* + * Add remaining minuend rectangles to region. + */ + while (r1 != r1End) + { + assert(x1x2); + MEMCHECK(pReg, pNextRect, pReg->rects); + pNextRect->x1 = x1; + pNextRect->y1 = y1; + pNextRect->x2 = r1->x2; + pNextRect->y2 = y2; + pReg->numRects += 1; + pNextRect++; + + assert(pReg->numRects<=pReg->size); + + r1++; + if (r1 != r1End) + { + x1 = r1->x1; + } + } + return 0; /* lint */ +} + +/*- + *----------------------------------------------------------------------- + * miSubtract -- + * Subtract regS from regM and leave the result in regD. + * S stands for subtrahend, M for minuend and D for difference. + * + * Results: + * TRUE. + * + * Side Effects: + * regD is overwritten. + * + *----------------------------------------------------------------------- + */ + +int +XSubtractRegion( + Region regM, + Region regS, + register Region regD) +{ + /* check for trivial reject */ + if ( (!(regM->numRects)) || (!(regS->numRects)) || + (!EXTENTCHECK(®M->extents, ®S->extents)) ) + { + return miRegionCopy(regD, regM); + } + + miRegionOp (regD, regM, regS, miSubtractO, + miSubtractNonO1, NULL); + + /* + * Can't alter newReg's extents before we call miRegionOp because + * it might be one of the source regions and miRegionOp depends + * on the extents of those regions being the unaltered. Besides, this + * way there's no checking against rectangles that will be nuked + * due to coalescing, so we have to examine fewer rectangles. + */ + miSetExtents (regD); + return 1; +} + +int +XXorRegion(Region sra, Region srb, Region dr) +{ + Region tra, trb; + + if (! (tra = XCreateRegion()) ) + return 0; + if (! (trb = XCreateRegion()) ) { + XDestroyRegion(tra); + return 0; + } + (void) XSubtractRegion(sra,srb,tra); + (void) XSubtractRegion(srb,sra,trb); + (void) XUnionRegion(tra,trb,dr); + XDestroyRegion(tra); + XDestroyRegion(trb); + return 0; +} + +/* + * Check to see if the region is empty. Assumes a region is passed + * as a parameter + */ +int +XEmptyRegion( + Region r) +{ + if( r->numRects == 0 ) return TRUE; + else return FALSE; +} + +/* + * Check to see if two regions are equal + */ +int +XEqualRegion(Region r1, Region r2) +{ + int i; + + if( r1->numRects != r2->numRects ) return FALSE; + else if( r1->numRects == 0 ) return TRUE; + else if ( r1->extents.x1 != r2->extents.x1 ) return FALSE; + else if ( r1->extents.x2 != r2->extents.x2 ) return FALSE; + else if ( r1->extents.y1 != r2->extents.y1 ) return FALSE; + else if ( r1->extents.y2 != r2->extents.y2 ) return FALSE; + else for( i=0; i < r1->numRects; i++ ) { + if ( r1->rects[i].x1 != r2->rects[i].x1 ) return FALSE; + else if ( r1->rects[i].x2 != r2->rects[i].x2 ) return FALSE; + else if ( r1->rects[i].y1 != r2->rects[i].y1 ) return FALSE; + else if ( r1->rects[i].y2 != r2->rects[i].y2 ) return FALSE; + } + return TRUE; +} + +int +XPointInRegion( + Region pRegion, + int x, int y) +{ + int i; + + if (pRegion->numRects == 0) + return FALSE; + if (!INBOX(pRegion->extents, x, y)) + return FALSE; + for (i=0; inumRects; i++) + { + if (INBOX (pRegion->rects[i], x, y)) + return TRUE; + } + return FALSE; +} + +int +XRectInRegion( + register Region region, + int rx, int ry, + unsigned int rwidth, unsigned int rheight) +{ + register BoxPtr pbox; + register BoxPtr pboxEnd; + Box rect; + register BoxPtr prect = ▭ + int partIn, partOut; + + prect->x1 = rx; + prect->y1 = ry; + prect->x2 = rwidth + rx; + prect->y2 = rheight + ry; + + /* this is (just) a useful optimization */ + if ((region->numRects == 0) || !EXTENTCHECK(®ion->extents, prect)) + return(RectangleOut); + + partOut = FALSE; + partIn = FALSE; + + /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */ + for (pbox = region->rects, pboxEnd = pbox + region->numRects; + pbox < pboxEnd; + pbox++) + { + + if (pbox->y2 <= ry) + continue; /* getting up to speed or skipping remainder of band */ + + if (pbox->y1 > ry) + { + partOut = TRUE; /* missed part of rectangle above */ + if (partIn || (pbox->y1 >= prect->y2)) + break; + ry = pbox->y1; /* x guaranteed to be == prect->x1 */ + } + + if (pbox->x2 <= rx) + continue; /* not far enough over yet */ + + if (pbox->x1 > rx) + { + partOut = TRUE; /* missed part of rectangle to left */ + if (partIn) + break; + } + + if (pbox->x1 < prect->x2) + { + partIn = TRUE; /* definitely overlap */ + if (partOut) + break; + } + + if (pbox->x2 >= prect->x2) + { + ry = pbox->y2; /* finished with this band */ + if (ry >= prect->y2) + break; + rx = prect->x1; /* reset x out to left again */ + } else + { + /* + * Because boxes in a band are maximal width, if the first box + * to overlap the rectangle doesn't completely cover it in that + * band, the rectangle must be partially out, since some of it + * will be uncovered in that band. partIn will have been set true + * by now... + */ + break; + } + + } + + return(partIn ? ((ry < prect->y2) ? RectanglePart : RectangleIn) : + RectangleOut); +} diff --git a/nx-X11/lib/src/RegstFlt.c b/nx-X11/lib/src/RegstFlt.c new file mode 100644 index 000000000..077ea424c --- /dev/null +++ b/nx-X11/lib/src/RegstFlt.c @@ -0,0 +1,155 @@ + + /* + * Copyright 1990, 1991 by OMRON Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 OMRON not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. OMRON makes no representations + * about the suitability of this software for any purpose. It is provided + * "as is" without express or implied warranty. + * + * OMRON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL OMRON 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 + * TORTUOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * Author: Seiji Kuwari OMRON Corporation + * kuwa@omron.co.jp + * kuwa%omron.co.jp@uunet.uu.net + */ +/* + +Copyright 1990, 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +static void +_XFreeIMFilters( + Display *display) +{ + register XFilterEventList fl; + + while ((fl = display->im_filters)) { + display->im_filters = fl->next; + Xfree(fl); + } +} + +/* + * Register a filter with the filter machinery by event mask. + */ +void +_XRegisterFilterByMask( + Display *display, + Window window, + unsigned long event_mask, + Bool (*filter)( + Display*, Window, XEvent*, XPointer + ), + XPointer client_data) +{ + XFilterEventRec *rec; + + rec = Xmalloc(sizeof(XFilterEventRec)); + if (!rec) + return; + rec->window = window; + rec->event_mask = event_mask; + rec->start_type = 0; + rec->end_type = 0; + rec->filter = filter; + rec->client_data = client_data; + LockDisplay(display); + rec->next = display->im_filters; + display->im_filters = rec; + display->free_funcs->im_filters = _XFreeIMFilters; + UnlockDisplay(display); +} + +/* + * Register a filter with the filter machinery by type code. + */ +void +_XRegisterFilterByType( + Display *display, + Window window, + int start_type, + int end_type, + Bool (*filter)( + Display*, Window, XEvent*, XPointer + ), + XPointer client_data) +{ + XFilterEventRec *rec; + + rec = Xmalloc(sizeof(XFilterEventRec)); + if (!rec) + return; + rec->window = window; + rec->event_mask = 0; + rec->start_type = start_type; + rec->end_type = end_type; + rec->filter = filter; + rec->client_data = client_data; + LockDisplay(display); + rec->next = display->im_filters; + display->im_filters = rec; + display->free_funcs->im_filters = _XFreeIMFilters; + UnlockDisplay(display); +} + +void +_XUnregisterFilter( + Display *display, + Window window, + Bool (*filter)( + Display*, Window, XEvent*, XPointer + ), + XPointer client_data) +{ + register XFilterEventList *prev, fl; + + for (prev = &display->im_filters; (fl = *prev); ) { + if (fl->window == window && + fl->filter == filter && fl->client_data == client_data) { + *prev = fl->next; + Xfree(fl); + } else + prev = &fl->next; + } +} diff --git a/nx-X11/lib/src/RepWindow.c b/nx-X11/lib/src/RepWindow.c new file mode 100644 index 000000000..1fde8d80f --- /dev/null +++ b/nx-X11/lib/src/RepWindow.c @@ -0,0 +1,52 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XReparentWindow( + register Display *dpy, + Window w, + Window p, + int x, + int y) +{ + register xReparentWindowReq *req; + + LockDisplay(dpy); + GetReq(ReparentWindow, req); + req->window = w; + req->parent = p; + req->x = x; + req->y = y; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/RestackWs.c b/nx-X11/lib/src/RestackWs.c new file mode 100644 index 000000000..52391ecd2 --- /dev/null +++ b/nx-X11/lib/src/RestackWs.c @@ -0,0 +1,61 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XRestackWindows ( + register Display *dpy, + register Window *windows, + int n) +{ + int i = 0; + + LockDisplay(dpy); + while (windows++, ++i < n) { + register xConfigureWindowReq *req; + + GetReqExtra (ConfigureWindow, 8, req); + req->window = *windows; + req->mask = CWSibling | CWStackMode; + { + register CARD32 *values = (CARD32 *) + NEXTPTR(req,xConfigureWindowReq); + *values++ = *(windows-1); + *values = Below; + } + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } + + + + diff --git a/nx-X11/lib/src/RotProp.c b/nx-X11/lib/src/RotProp.c new file mode 100644 index 000000000..98d7dbd81 --- /dev/null +++ b/nx-X11/lib/src/RotProp.c @@ -0,0 +1,63 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XRotateWindowProperties( + register Display *dpy, + Window w, + Atom *properties, + register int nprops, + int npositions) +{ + register long nbytes; + register xRotatePropertiesReq *req; + + LockDisplay(dpy); + GetReq (RotateProperties, req); + req->window = w; + req->nAtoms = nprops; + req->nPositions = npositions; + + req->length += nprops; + nbytes = nprops << 2; +/* XXX Cray needs packing here.... */ + Data32 (dpy, (long *) properties, nbytes); + + + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } + + + + + diff --git a/nx-X11/lib/src/ScrResStr.c b/nx-X11/lib/src/ScrResStr.c new file mode 100644 index 000000000..1dd04a383 --- /dev/null +++ b/nx-X11/lib/src/ScrResStr.c @@ -0,0 +1,54 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +char *XScreenResourceString(Screen *screen) +{ + Atom prop_name; + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long leftover; + char *val = NULL; + + prop_name = XInternAtom(screen->display, "SCREEN_RESOURCES", True); + if (prop_name && + XGetWindowProperty(screen->display, screen->root, prop_name, + 0L, 100000000L, False, + XA_STRING, &actual_type, &actual_format, + &nitems, &leftover, + (unsigned char **) &val) == Success) { + if ((actual_type == XA_STRING) && (actual_format == 8)) + return val; + Xfree(val); + } + return (char *)NULL; +} diff --git a/nx-X11/lib/src/SelInput.c b/nx-X11/lib/src/SelInput.c new file mode 100644 index 000000000..a3fa294f4 --- /dev/null +++ b/nx-X11/lib/src/SelInput.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSelectInput ( + register Display *dpy, + Window w, + long mask) +{ + register xChangeWindowAttributesReq *req; + + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWEventMask; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), mask); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/SendEvent.c b/nx-X11/lib/src/SendEvent.c new file mode 100644 index 000000000..1de986007 --- /dev/null +++ b/nx-X11/lib/src/SendEvent.c @@ -0,0 +1,76 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* + * In order to avoid all images requiring _XEventToWire, we install the + * event converter here if it has never been installed. + */ +Status +XSendEvent( + register Display *dpy, + Window w, + Bool propagate, + long event_mask, + XEvent *event) +{ + register xSendEventReq *req; + xEvent ev; + register Status (**fp)( + Display * /* dpy */, + XEvent * /* re */, + xEvent * /* event */); + Status status; + + /* initialize all of the event's fields first, before setting + * the meaningful ones later. + */ + memset (&ev, 0, sizeof (ev)); + + LockDisplay (dpy); + + /* call through display to find proper conversion routine */ + + fp = &dpy->wire_vec[event->type & 0177]; + if (*fp == NULL) *fp = _XEventToWire; + status = (**fp)(dpy, event, &ev); + + if (status) { + GetReq(SendEvent, req); + req->destination = w; + req->propagate = propagate; + req->eventMask = event_mask; + req->event = ev; + } + + UnlockDisplay(dpy); + SyncHandle(); + return(status); +} diff --git a/nx-X11/lib/src/SetBack.c b/nx-X11/lib/src/SetBack.c new file mode 100644 index 000000000..269d10cc7 --- /dev/null +++ b/nx-X11/lib/src/SetBack.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetBackground ( + register Display *dpy, + GC gc, + unsigned long background) /* CARD32 */ +{ + LockDisplay(dpy); + if (gc->values.background != background) { + gc->values.background = background; + gc->dirty |= GCBackground; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetCRects.c b/nx-X11/lib/src/SetCRects.c new file mode 100644 index 000000000..c7ad3fcf2 --- /dev/null +++ b/nx-X11/lib/src/SetCRects.c @@ -0,0 +1,81 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* can only call when display is locked. */ +void _XSetClipRectangles ( + register Display *dpy, + GC gc, + int clip_x_origin, int clip_y_origin, + XRectangle *rectangles, + int n, + int ordering) +{ + register xSetClipRectanglesReq *req; + register long len; + unsigned long dirty; + register _XExtension *ext; + + GetReq (SetClipRectangles, req); + req->gc = gc->gid; + req->xOrigin = gc->values.clip_x_origin = clip_x_origin; + req->yOrigin = gc->values.clip_y_origin = clip_y_origin; + req->ordering = ordering; + len = ((long)n) << 1; + SetReqLen(req, len, 1); + len <<= 2; + Data16 (dpy, (short *) rectangles, len); + gc->rects = 1; + dirty = gc->dirty & ~(GCClipMask | GCClipXOrigin | GCClipYOrigin); + gc->dirty = GCClipMask | GCClipXOrigin | GCClipYOrigin; + /* call out to any extensions interested */ + for (ext = dpy->ext_procs; ext; ext = ext->next) + if (ext->flush_GC) (*ext->flush_GC)(dpy, gc, &ext->codes); + gc->dirty = dirty; +} + +int +XSetClipRectangles ( + register Display *dpy, + GC gc, + int clip_x_origin, + int clip_y_origin, + XRectangle *rectangles, + int n, + int ordering) +{ + LockDisplay(dpy); + _XSetClipRectangles (dpy, gc, clip_x_origin, clip_y_origin, rectangles, n, + ordering); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/SetClMask.c b/nx-X11/lib/src/SetClMask.c new file mode 100644 index 000000000..82cdb2cce --- /dev/null +++ b/nx-X11/lib/src/SetClMask.c @@ -0,0 +1,47 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetClipMask ( + register Display *dpy, + GC gc, + Pixmap mask) +{ + LockDisplay(dpy); + /* always update, since client may have changed pixmap contents */ + gc->values.clip_mask = mask; + gc->dirty |= GCClipMask; + gc->rects = 0; + _XFlushGCCache(dpy, gc); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetClOrig.c b/nx-X11/lib/src/SetClOrig.c new file mode 100644 index 000000000..800e1570d --- /dev/null +++ b/nx-X11/lib/src/SetClOrig.c @@ -0,0 +1,53 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetClipOrigin ( + register Display *dpy, + GC gc, + int xorig, + int yorig) +{ + XGCValues *gv = &gc->values; + + LockDisplay(dpy); + if (xorig != gv->clip_x_origin) { + gv->clip_x_origin = xorig; + gc->dirty |= GCClipXOrigin; + } + if (yorig != gv->clip_y_origin) { + gv->clip_y_origin = yorig; + gc->dirty |= GCClipYOrigin; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetDashes.c b/nx-X11/lib/src/SetDashes.c new file mode 100644 index 000000000..ffe4a95ff --- /dev/null +++ b/nx-X11/lib/src/SetDashes.c @@ -0,0 +1,55 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetDashes ( + register Display *dpy, + GC gc, + int dash_offset, + _Xconst char *list, + int n) + { + register xSetDashesReq *req; + + LockDisplay(dpy); + GetReq (SetDashes,req); + req->gc = gc->gid; + req->dashOffset = gc->values.dash_offset = dash_offset; + req->nDashes = n; + req->length += (n+3)>>2; + gc->dashes = 1; + gc->dirty &= ~(GCDashList | GCDashOffset); + Data (dpy, list, (long)n); + UnlockDisplay(dpy); + SyncHandle(); + return 1; + } + diff --git a/nx-X11/lib/src/SetFPath.c b/nx-X11/lib/src/SetFPath.c new file mode 100644 index 000000000..60aaef01e --- /dev/null +++ b/nx-X11/lib/src/SetFPath.c @@ -0,0 +1,77 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define safestrlen(s) ((s) ? strlen(s) : 0) + +int +XSetFontPath ( + register Display *dpy, + char **directories, + int ndirs) +{ + register int n = 0; + register int i; + register int nbytes; + char *p; + register xSetFontPathReq *req; + int retCode; + + LockDisplay(dpy); + GetReq (SetFontPath, req); + req->nFonts = ndirs; + for (i = 0; i < ndirs; i++) { + n += safestrlen (directories[i]) + 1; + } + nbytes = (n + 3) & ~3; + req->length += nbytes >> 2; + if ((p = Xmalloc (nbytes))) { + /* + * pack into counted strings. + */ + char *tmp = p; + + for (i = 0; i < ndirs; i++) { + register int length = safestrlen (directories[i]); + *p = length; + memcpy (p + 1, directories[i], length); + p += length + 1; + } + Data (dpy, tmp, nbytes); + Xfree (tmp); + retCode = 1; + } + else + retCode = 0; + + UnlockDisplay(dpy); + SyncHandle(); + return (retCode); +} diff --git a/nx-X11/lib/src/SetFont.c b/nx-X11/lib/src/SetFont.c new file mode 100644 index 000000000..33ffca02d --- /dev/null +++ b/nx-X11/lib/src/SetFont.c @@ -0,0 +1,47 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetFont ( + register Display *dpy, + GC gc, + Font font) +{ + LockDisplay(dpy); + if (gc->values.font != font) { + gc->values.font = font; + gc->dirty |= GCFont; + _XFlushGCCache(dpy, gc); + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetFore.c b/nx-X11/lib/src/SetFore.c new file mode 100644 index 000000000..50c9f1228 --- /dev/null +++ b/nx-X11/lib/src/SetFore.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetForeground ( + register Display *dpy, + GC gc, + unsigned long foreground) /* CARD32 */ +{ + LockDisplay(dpy); + if (gc->values.foreground != foreground) { + gc->values.foreground = foreground; + gc->dirty |= GCForeground; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetFunc.c b/nx-X11/lib/src/SetFunc.c new file mode 100644 index 000000000..ffe4ec0cc --- /dev/null +++ b/nx-X11/lib/src/SetFunc.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetFunction ( + register Display *dpy, + GC gc, + int function) +{ + LockDisplay(dpy); + if (gc->values.function != function) { + gc->values.function = function; + gc->dirty |= GCFunction; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetHints.c b/nx-X11/lib/src/SetHints.c new file mode 100644 index 000000000..eed360f46 --- /dev/null +++ b/nx-X11/lib/src/SetHints.c @@ -0,0 +1,319 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include +#include + +#define safestrlen(s) ((s) ? strlen(s) : 0) + +int +XSetSizeHints( /* old routine */ + Display *dpy, + Window w, + XSizeHints *hints, + Atom property) +{ + xPropSizeHints prop; + memset(&prop, 0, sizeof(prop)); + prop.flags = (hints->flags & (USPosition|USSize|PAllHints)); + if (hints->flags & (USPosition|PPosition)) { + prop.x = hints->x; + prop.y = hints->y; + } + if (hints->flags & (USSize|PSize)) { + prop.width = hints->width; + prop.height = hints->height; + } + if (hints->flags & PMinSize) { + prop.minWidth = hints->min_width; + prop.minHeight = hints->min_height; + } + if (hints->flags & PMaxSize) { + prop.maxWidth = hints->max_width; + prop.maxHeight = hints->max_height; + } + if (hints->flags & PResizeInc) { + prop.widthInc = hints->width_inc; + prop.heightInc = hints->height_inc; + } + if (hints->flags & PAspect) { + prop.minAspectX = hints->min_aspect.x; + prop.minAspectY = hints->min_aspect.y; + prop.maxAspectX = hints->max_aspect.x; + prop.maxAspectY = hints->max_aspect.y; + } + return XChangeProperty (dpy, w, property, XA_WM_SIZE_HINTS, 32, + PropModeReplace, (unsigned char *) &prop, + OldNumPropSizeElements); +} + +/* + * XSetWMHints sets the property + * WM_HINTS type: WM_HINTS format:32 + */ + +int +XSetWMHints ( + Display *dpy, + Window w, + XWMHints *wmhints) +{ + xPropWMHints prop; + memset(&prop, 0, sizeof(prop)); + prop.flags = wmhints->flags; + if (wmhints->flags & InputHint) + prop.input = (wmhints->input == True ? 1 : 0); + if (wmhints->flags & StateHint) + prop.initialState = wmhints->initial_state; + if (wmhints->flags & IconPixmapHint) + prop.iconPixmap = wmhints->icon_pixmap; + if (wmhints->flags & IconWindowHint) + prop.iconWindow = wmhints->icon_window; + if (wmhints->flags & IconPositionHint) { + prop.iconX = wmhints->icon_x; + prop.iconY = wmhints->icon_y; + } + if (wmhints->flags & IconMaskHint) + prop.iconMask = wmhints->icon_mask; + if (wmhints->flags & WindowGroupHint) + prop.windowGroup = wmhints->window_group; + return XChangeProperty (dpy, w, XA_WM_HINTS, XA_WM_HINTS, 32, + PropModeReplace, (unsigned char *) &prop, + NumPropWMHintsElements); +} + + + +/* + * XSetZoomHints sets the property + * WM_ZOOM_HINTS type: WM_SIZE_HINTS format: 32 + */ + +int +XSetZoomHints ( + Display *dpy, + Window w, + XSizeHints *zhints) +{ + return XSetSizeHints (dpy, w, zhints, XA_WM_ZOOM_HINTS); +} + + +/* + * XSetNormalHints sets the property + * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 + */ + +int +XSetNormalHints ( /* old routine */ + Display *dpy, + Window w, + XSizeHints *hints) +{ + return XSetSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); +} + + + +/* + * Note, the following is one of the few cases were we really do want sizeof + * when examining a protocol structure. This is because the XChangeProperty + * routine will take care of converting to host to network data structures. + */ + +int +XSetIconSizes ( + Display *dpy, + Window w, /* typically, root */ + XIconSize *list, + int count) /* number of items on the list */ +{ + register int i; + xPropIconSize *pp, *prop; +#define size_of_the_real_thing sizeof /* avoid grepping screwups */ + unsigned nbytes = count * size_of_the_real_thing(xPropIconSize); +#undef size_of_the_real_thing + if ((prop = pp = Xmalloc (nbytes))) { + for (i = 0; i < count; i++) { + pp->minWidth = list->min_width; + pp->minHeight = list->min_height; + pp->maxWidth = list->max_width; + pp->maxHeight = list->max_height; + pp->widthInc = list->width_inc; + pp->heightInc = list->height_inc; + pp += 1; + list += 1; + } + XChangeProperty (dpy, w, XA_WM_ICON_SIZE, XA_WM_ICON_SIZE, 32, + PropModeReplace, (unsigned char *) prop, + count * NumPropIconSizeElements); + Xfree (prop); + } + return 1; +} + +int +XSetCommand ( + Display *dpy, + Window w, + char **argv, + int argc) +{ + register int i; + register int nbytes; + register char *buf, *bp; + for (i = 0, nbytes = 0; i < argc; i++) { + nbytes += safestrlen(argv[i]) + 1; + } + if ((bp = buf = Xmalloc(nbytes))) { + /* copy arguments into single buffer */ + for (i = 0; i < argc; i++) { + if (argv[i]) { + (void) strcpy(bp, argv[i]); + bp += strlen(argv[i]) + 1; + } + else + *bp++ = '\0'; + } + XChangeProperty (dpy, w, XA_WM_COMMAND, XA_STRING, 8, + PropModeReplace, (unsigned char *)buf, nbytes); + Xfree(buf); + } + return 1; +} +/* + * XSetStandardProperties sets the following properties: + * WM_NAME type: STRING format: 8 + * WM_ICON_NAME type: STRING format: 8 + * WM_HINTS type: WM_HINTS format: 32 + * WM_COMMAND type: STRING + * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 + */ + +int +XSetStandardProperties ( + Display *dpy, + Window w, /* window to decorate */ + _Xconst char *name, /* name of application */ + _Xconst char *icon_string,/* name string for icon */ + Pixmap icon_pixmap, /* pixmap to use as icon, or None */ + char **argv, /* command to be used to restart application */ + int argc, /* count of arguments */ + XSizeHints *hints) /* size hints for window in its normal state */ +{ + XWMHints phints; + phints.flags = 0; + + if (name != NULL) XStoreName (dpy, w, name); + + if (icon_string != NULL) { + XChangeProperty (dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, + PropModeReplace, + (_Xconst unsigned char *)icon_string, + safestrlen(icon_string)); + } + + if (icon_pixmap != None) { + phints.icon_pixmap = icon_pixmap; + phints.flags |= IconPixmapHint; + } + if (argv != NULL) XSetCommand(dpy, w, argv, argc); + + if (hints != NULL) XSetNormalHints(dpy, w, hints); + + if (phints.flags != 0) XSetWMHints(dpy, w, &phints); + + return 1; +} + +int +XSetTransientForHint( + Display *dpy, + Window w, + Window propWindow) +{ + return XChangeProperty(dpy, w, XA_WM_TRANSIENT_FOR, XA_WINDOW, 32, + PropModeReplace, (unsigned char *) &propWindow, 1); +} + +int +XSetClassHint( + Display *dpy, + Window w, + XClassHint *classhint) +{ + char *class_string; + char *s; + int len_nm, len_cl; + + len_nm = safestrlen(classhint->res_name); + len_cl = safestrlen(classhint->res_class); + if ((class_string = s = Xmalloc(len_nm + len_cl + 2))) { + if (len_nm) { + strcpy(s, classhint->res_name); + s += len_nm + 1; + } + else + *s++ = '\0'; + if (len_cl) + strcpy(s, classhint->res_class); + else + *s = '\0'; + XChangeProperty(dpy, w, XA_WM_CLASS, XA_STRING, 8, + PropModeReplace, (unsigned char *) class_string, + len_nm+len_cl+2); + Xfree(class_string); + } + return 1; +} diff --git a/nx-X11/lib/src/SetIFocus.c b/nx-X11/lib/src/SetIFocus.c new file mode 100644 index 000000000..bee96ca82 --- /dev/null +++ b/nx-X11/lib/src/SetIFocus.c @@ -0,0 +1,50 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetInputFocus( + register Display *dpy, + Window focus, + int revert_to, + Time time) +{ + register xSetInputFocusReq *req; + + LockDisplay(dpy); + GetReq(SetInputFocus, req); + req->focus = focus; + req->revertTo = revert_to; + req->time = time; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/SetLStyle.c b/nx-X11/lib/src/SetLStyle.c new file mode 100644 index 000000000..8b00fae9c --- /dev/null +++ b/nx-X11/lib/src/SetLStyle.c @@ -0,0 +1,63 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetLineAttributes( + register Display *dpy, + GC gc, + unsigned int linewidth, /* CARD16 */ + int linestyle, + int capstyle, + int joinstyle) +{ + XGCValues *gv = &gc->values; + + LockDisplay(dpy); + if (linewidth != gv->line_width) { + gv->line_width = linewidth; + gc->dirty |= GCLineWidth; + } + if (linestyle != gv->line_style) { + gv->line_style = linestyle; + gc->dirty |= GCLineStyle; + } + if (capstyle != gv->cap_style) { + gv->cap_style = capstyle; + gc->dirty |= GCCapStyle; + } + if (joinstyle != gv->join_style) { + gv->join_style = joinstyle; + gc->dirty |= GCJoinStyle; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetLocale.c b/nx-X11/lib/src/SetLocale.c new file mode 100644 index 000000000..3bbfd3ee6 --- /dev/null +++ b/nx-X11/lib/src/SetLocale.c @@ -0,0 +1,188 @@ + +/* + * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, + * and Nippon Telegraph and Telephone Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 names of OMRON, NTT Software, and NTT + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. OMRON, NTT Software, + * and NTT 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, AND NTT, DISCLAIM ALL WARRANTIES WITH REGARD + * TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY + * AND FITNESS, IN NO EVENT SHALL OMRON, NTT SOFTWARE, OR NTT, 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. + * + * Authors: Li Yuhong OMRON Corporation + * Tetsuya Kato NTT Software Corporation + * Hiroshi Kuribayashi OMRON Corporation + * + */ +/* + +Copyright 1987,1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" +#include +#include +#include "XlcPubI.h" + +#define MAXLOCALE 64 /* buffer size of locale name */ + + +#if defined(__DARWIN__) || defined(__APPLE__) || defined(__CYGWIN__) +char * +_Xsetlocale( + int category, + _Xconst char *name +) +{ + return setlocale(category, name); +} +#endif /* __DARWIN__ || __APPLE__ || __CYGWIN__ */ + +/* + * _XlcMapOSLocaleName is an implementation dependent routine that derives + * the LC_CTYPE locale name as used in the sample implementation from that + * returned by setlocale. + * + * Should match the code in Xt ExtractLocaleName. + * + * This function name is a bit of a misnomer. Even the siname parameter + * name is a misnomer. On most modern operating systems this function is + * a no-op, simply returning the osname; but on older operating systems + * like Ultrix, or HPUX 9.x and earlier, when you set LANG=german.88591 + * then the string returned by setlocale(LC_ALL, "") will look something + * like: "german.88591 german.88591 ... german.88591". Then this function + * will pick out the LC_CTYPE component and return a pointer to that. + */ + +char * +_XlcMapOSLocaleName( + char *osname, + char *siname) +{ + +/* FIXME: correct indentation levels after ancient platform clean-up */ + +#if defined(CSRG_BASED) || defined(sun) || defined(SVR4) || defined(ultrix) || defined(WIN32) || defined(linux) +# ifdef ultrix +# define SKIPCOUNT 2 +# define STARTCHAR '\001' +# define ENDCHAR '\001' +# else +# if defined(WIN32) +# define SKIPCOUNT 1 +# define STARTCHAR '=' +# define ENDCHAR ';' +# define WHITEFILL +# else +# if defined(linux) +# define STARTSTR "LC_CTYPE=" +# define ENDCHAR ';' +# else +# if !defined(sun) || defined(SVR4) +# define STARTCHAR '/' +# define ENDCHAR '/' +# endif +# endif +# endif +# endif + + char *start; + char *end; + int len; +# ifdef SKIPCOUNT + int n; +# endif + + start = osname; +# ifdef SKIPCOUNT + for (n = SKIPCOUNT; + --n >= 0 && start && (start = strchr (start, STARTCHAR)); + start++) + ; + if (!start) + start = osname; +# endif +# ifdef STARTCHAR + if (start && (start = strchr (start, STARTCHAR))) +# elif defined (STARTSTR) + if (start && (start = strstr (start,STARTSTR))) +# endif + { +# ifdef STARTCHAR + start++; +# elif defined (STARTSTR) + start += strlen(STARTSTR); +# endif + if ((end = strchr (start, ENDCHAR))) { + len = end - start; + if (len >= MAXLOCALE) + len = MAXLOCALE - 1; + strncpy(siname, start, len); + *(siname + len) = '\0'; +# ifdef WHITEFILL + for (start = siname; start = strchr(start, ' '); ) + *start++ = '-'; +# endif + return siname; + } else /* if no ENDCHAR is found we are at the end of the line */ + return start; + } +# ifdef WHITEFILL + if (strchr(osname, ' ')) { + len = strlen(osname); + if (len >= MAXLOCALE - 1) + len = MAXLOCALE - 1; + strncpy(siname, osname, len); + *(siname + len) = '\0'; + for (start = siname; start = strchr(start, ' '); ) + *start++ = '-'; + return siname; + } +# endif +# undef STARTCHAR +# undef ENDCHAR +# undef WHITEFILL +#endif + return osname; +} + diff --git a/nx-X11/lib/src/SetNrmHint.c b/nx-X11/lib/src/SetNrmHint.c new file mode 100644 index 000000000..937f4eb6b --- /dev/null +++ b/nx-X11/lib/src/SetNrmHint.c @@ -0,0 +1,127 @@ + +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca, +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +DIGITAL AND WYSE DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL DIGITAL OR WYSE 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. + +******************************************************************/ +/* + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include +#include + +void XSetWMSizeHints ( + Display *dpy, + Window w, + XSizeHints *hints, + Atom prop) +{ + xPropSizeHints data; + + memset(&data, 0, sizeof(data)); + data.flags = (hints->flags & + (USPosition|USSize|PPosition|PSize|PMinSize|PMaxSize| + PResizeInc|PAspect|PBaseSize|PWinGravity)); + + /* + * The x, y, width, and height fields are obsolete; but, applications + * that want to work with old window managers might set them. + */ + if (hints->flags & (USPosition|PPosition)) { + data.x = hints->x; + data.y = hints->y; + } + if (hints->flags & (USSize|PSize)) { + data.width = hints->width; + data.height = hints->height; + } + + if (hints->flags & PMinSize) { + data.minWidth = hints->min_width; + data.minHeight = hints->min_height; + } + if (hints->flags & PMaxSize) { + data.maxWidth = hints->max_width; + data.maxHeight = hints->max_height; + } + if (hints->flags & PResizeInc) { + data.widthInc = hints->width_inc; + data.heightInc = hints->height_inc; + } + if (hints->flags & PAspect) { + data.minAspectX = hints->min_aspect.x; + data.minAspectY = hints->min_aspect.y; + data.maxAspectX = hints->max_aspect.x; + data.maxAspectY = hints->max_aspect.y; + } + if (hints->flags & PBaseSize) { + data.baseWidth = hints->base_width; + data.baseHeight = hints->base_height; + } + if (hints->flags & PWinGravity) { + data.winGravity = hints->win_gravity; + } + + XChangeProperty (dpy, w, prop, XA_WM_SIZE_HINTS, 32, + PropModeReplace, (unsigned char *) &data, + NumPropSizeElements); +} + + +void XSetWMNormalHints ( + Display *dpy, + Window w, + XSizeHints *hints) +{ + XSetWMSizeHints (dpy, w, hints, XA_WM_NORMAL_HINTS); +} + diff --git a/nx-X11/lib/src/SetPMask.c b/nx-X11/lib/src/SetPMask.c new file mode 100644 index 000000000..9f236b00b --- /dev/null +++ b/nx-X11/lib/src/SetPMask.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetPlaneMask ( + register Display *dpy, + GC gc, + unsigned long planemask) /* CARD32 */ +{ + LockDisplay(dpy); + if (gc->values.plane_mask != planemask) { + gc->values.plane_mask = planemask; + gc->dirty |= GCPlaneMask; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetPntMap.c b/nx-X11/lib/src/SetPntMap.c new file mode 100644 index 000000000..14e104d6d --- /dev/null +++ b/nx-X11/lib/src/SetPntMap.c @@ -0,0 +1,77 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +/* returns either DeviceMappingSuccess or DeviceMappingBusy */ + +int +XSetPointerMapping ( + register Display *dpy, + _Xconst unsigned char *map, + int nmaps) + { + register xSetPointerMappingReq *req; + xSetPointerMappingReply rep; + + LockDisplay(dpy); + GetReq (SetPointerMapping, req); + req->nElts = nmaps; + req->length += (nmaps + 3)>>2; + Data (dpy, (_Xconst char *)map, (long) nmaps); + if (_XReply (dpy, (xReply *)&rep, 0, xFalse) == 0) + rep.success = MappingSuccess; + UnlockDisplay(dpy); + SyncHandle(); + return ((int) rep.success); + } + +int +XChangeKeyboardMapping ( + register Display *dpy, + int first_keycode, + int keysyms_per_keycode, + KeySym *keysyms, + int nkeycodes) +{ + register long nbytes; + register xChangeKeyboardMappingReq *req; + + LockDisplay(dpy); + GetReq (ChangeKeyboardMapping, req); + req->firstKeyCode = first_keycode; + req->keyCodes = nkeycodes; + req->keySymsPerKeyCode = keysyms_per_keycode; + req->length += nkeycodes * keysyms_per_keycode; + nbytes = keysyms_per_keycode * nkeycodes * 4; + Data32 (dpy, (long *)keysyms, nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return 0; + } + diff --git a/nx-X11/lib/src/SetRGBCMap.c b/nx-X11/lib/src/SetRGBCMap.c new file mode 100644 index 000000000..f413c0d69 --- /dev/null +++ b/nx-X11/lib/src/SetRGBCMap.c @@ -0,0 +1,100 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include + +void XSetRGBColormaps ( + Display *dpy, + Window w, + XStandardColormap *cmaps, + int count, + Atom property) /* XA_RGB_BEST_MAP, etc. */ +{ + register int i; /* iterator variable */ + register xPropStandardColormap *map; /* tmp variable, data in prop */ + register XStandardColormap *cmap; /* tmp variable, user data */ + xPropStandardColormap *data, tmpdata; /* scratch data */ + int mode = PropModeReplace; /* for partial writes */ + Bool alloced_scratch_space; /* do we need to free? */ + + + if (count < 1) return; + + /* + * if doing more than one, allocate scratch space for it + */ + if ((count > 1) && ((data = ((xPropStandardColormap *) + Xmalloc(count*sizeof(xPropStandardColormap)))) + != NULL)) { + alloced_scratch_space = True; + } else { + data = &tmpdata; + alloced_scratch_space = False; + } + + + /* + * Do the iteration. If using temp space put out each part of the prop; + * otherwise, wait until the end and blast it all at once. + */ + for (i = count, map = data, cmap = cmaps; i > 0; i--, cmap++) { + map->colormap = cmap->colormap; + map->red_max = cmap->red_max; + map->red_mult = cmap->red_mult; + map->green_max = cmap->green_max; + map->green_mult = cmap->green_mult; + map->blue_max = cmap->blue_max; + map->blue_mult = cmap->blue_mult; + map->base_pixel = cmap->base_pixel; + map->visualid = cmap->visualid; + map->killid = cmap->killid; + + if (alloced_scratch_space) { + map++; + } else { + XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, mode, + (unsigned char *) data, + NumPropStandardColormapElements); + mode = PropModeAppend; + } + } + + if (alloced_scratch_space) { + XChangeProperty (dpy, w, property, XA_RGB_COLOR_MAP, 32, + PropModeReplace, (unsigned char *) data, + (int) (count * NumPropStandardColormapElements)); + Xfree (data); + } +} diff --git a/nx-X11/lib/src/SetSOwner.c b/nx-X11/lib/src/SetSOwner.c new file mode 100644 index 000000000..bc8f56403 --- /dev/null +++ b/nx-X11/lib/src/SetSOwner.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetSelectionOwner( + register Display *dpy, + Atom selection, + Window owner, + Time time) +{ + register xSetSelectionOwnerReq *req; + + LockDisplay(dpy); + GetReq(SetSelectionOwner,req); + req->selection = selection; + req->window = owner; + req->time = time; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetSSaver.c b/nx-X11/lib/src/SetSSaver.c new file mode 100644 index 000000000..adce749e1 --- /dev/null +++ b/nx-X11/lib/src/SetSSaver.c @@ -0,0 +1,53 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetScreenSaver( + register Display *dpy, + int timeout, + int interval, + int prefer_blank, + int allow_exp) + +{ + register xSetScreenSaverReq *req; + + LockDisplay(dpy); + GetReq(SetScreenSaver, req); + req->timeout = timeout; + req->interval = interval; + req->preferBlank = prefer_blank; + req->allowExpose = allow_exp; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/SetStCmap.c b/nx-X11/lib/src/SetStCmap.c new file mode 100644 index 000000000..7b8aa862d --- /dev/null +++ b/nx-X11/lib/src/SetStCmap.c @@ -0,0 +1,95 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xatomtype.h" +#include + +/* + * WARNING + * + * This is a pre-ICCCM routine. It must not reference any of the new fields + * in the XStandardColormap structure. + */ + +void XSetStandardColormap( + Display *dpy, + Window w, + XStandardColormap *cmap, + Atom property) /* XA_RGB_BEST_MAP, etc. */ +{ + Screen *sp; + XStandardColormap stdcmap; + + sp = _XScreenOfWindow (dpy, w); + if (!sp) { + /* already caught the XGetGeometry error in _XScreenOfWindow */ + return; + } + + stdcmap.colormap = cmap->colormap; + stdcmap.red_max = cmap->red_max; + stdcmap.red_mult = cmap->red_mult; + stdcmap.green_max = cmap->green_max; + stdcmap.green_mult = cmap->green_mult; + stdcmap.blue_max = cmap->blue_max; + stdcmap.blue_mult = cmap->blue_mult; + stdcmap.base_pixel = cmap->base_pixel; + stdcmap.visualid = sp->root_visual->visualid; + stdcmap.killid = None; /* don't know how to kill this one */ + +#ifdef XCMS + XSetRGBColormaps (dpy, w, &stdcmap, 1, property); +#endif + + return; +} diff --git a/nx-X11/lib/src/SetState.c b/nx-X11/lib/src/SetState.c new file mode 100644 index 000000000..e5aa21c05 --- /dev/null +++ b/nx-X11/lib/src/SetState.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetState( + register Display *dpy, + GC gc, + unsigned long foreground, + unsigned long background, + int function, + unsigned long planemask) +{ + XGCValues *gv = &gc->values; + + LockDisplay(dpy); + + if (function != gv->function) { + gv->function = function; + gc->dirty |= GCFunction; + } + if (planemask != gv->plane_mask) { + gv->plane_mask = planemask; + gc->dirty |= GCPlaneMask; + } + if (foreground != gv->foreground) { + gv->foreground = foreground; + gc->dirty |= GCForeground; + } + if (background != gv->background) { + gv->background = background; + gc->dirty |= GCBackground; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetStip.c b/nx-X11/lib/src/SetStip.c new file mode 100644 index 000000000..e95882786 --- /dev/null +++ b/nx-X11/lib/src/SetStip.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetStipple ( + register Display *dpy, + GC gc, + Pixmap stipple) +{ + LockDisplay(dpy); + /* always update, since client may have changed pixmap contents */ + gc->values.stipple = stipple; + gc->dirty |= GCStipple; + _XFlushGCCache(dpy, gc); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetTSOrig.c b/nx-X11/lib/src/SetTSOrig.c new file mode 100644 index 000000000..0117c818b --- /dev/null +++ b/nx-X11/lib/src/SetTSOrig.c @@ -0,0 +1,53 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetTSOrigin ( + register Display *dpy, + GC gc, + int x, + int y) +{ + XGCValues *gv = &gc->values; + + LockDisplay(dpy); + if (x != gv->ts_x_origin) { + gv->ts_x_origin = x; + gc->dirty |= GCTileStipXOrigin; + } + if (y != gv->ts_y_origin) { + gv->ts_y_origin = y; + gc->dirty |= GCTileStipYOrigin; + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetTile.c b/nx-X11/lib/src/SetTile.c new file mode 100644 index 000000000..d32edff06 --- /dev/null +++ b/nx-X11/lib/src/SetTile.c @@ -0,0 +1,46 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XSetTile ( + register Display *dpy, + GC gc, + Pixmap tile) +{ + LockDisplay(dpy); + /* always update, since client may have changed pixmap contents */ + gc->values.tile = tile; + gc->dirty |= GCTile; + _XFlushGCCache(dpy, gc); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/SetTxtProp.c b/nx-X11/lib/src/SetTxtProp.c new file mode 100644 index 000000000..c3f272712 --- /dev/null +++ b/nx-X11/lib/src/SetTxtProp.c @@ -0,0 +1,93 @@ +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca. + + All Rights Reserved + +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 +supporting documentation, and that the name of Wyse not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +******************************************************************/ +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +void XSetTextProperty ( + Display *dpy, + Window w, + XTextProperty *tp, + Atom property) +{ + XChangeProperty (dpy, w, property, tp->encoding, tp->format, + PropModeReplace, tp->value, tp->nitems); +} + +void XSetWMName ( + Display *dpy, + Window w, + XTextProperty *tp) +{ + XSetTextProperty (dpy, w, tp, XA_WM_NAME); +} + +void XSetWMIconName ( + Display *dpy, + Window w, + XTextProperty *tp) +{ + XSetTextProperty (dpy, w, tp, XA_WM_ICON_NAME); +} + +void XSetWMClientMachine ( + Display *dpy, + Window w, + XTextProperty *tp) +{ + XSetTextProperty (dpy, w, tp, XA_WM_CLIENT_MACHINE); +} + diff --git a/nx-X11/lib/src/SetWMCMapW.c b/nx-X11/lib/src/SetWMCMapW.c new file mode 100644 index 000000000..98d6c80b3 --- /dev/null +++ b/nx-X11/lib/src/SetWMCMapW.c @@ -0,0 +1,74 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +/* + * XSetWMProtocols sets the property + * WM_COLORMAP_WINDOWS type: WINDOW format:32 + */ + +Status XSetWMColormapWindows ( + Display *dpy, + Window w, + Window *windows, + int count) +{ + Atom prop; + + prop = XInternAtom (dpy, "WM_COLORMAP_WINDOWS", False); + if (prop == None) return False; + + XChangeProperty (dpy, w, prop, XA_WINDOW, 32, + PropModeReplace, (unsigned char *) windows, count); + return True; +} diff --git a/nx-X11/lib/src/SetWMProto.c b/nx-X11/lib/src/SetWMProto.c new file mode 100644 index 000000000..14067b870 --- /dev/null +++ b/nx-X11/lib/src/SetWMProto.c @@ -0,0 +1,74 @@ + +/*********************************************************** + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include + +/* + * XSetWMProtocols sets the property + * WM_PROTOCOLS type: ATOM format: 32 + */ + +Status XSetWMProtocols ( + Display *dpy, + Window w, + Atom *protocols, + int count) +{ + Atom prop; + + prop = XInternAtom (dpy, "WM_PROTOCOLS", False); + if (prop == None) return False; + + XChangeProperty (dpy, w, prop, XA_ATOM, 32, + PropModeReplace, (unsigned char *) protocols, count); + return True; +} diff --git a/nx-X11/lib/src/StBytes.c b/nx-X11/lib/src/StBytes.c new file mode 100644 index 000000000..f058d354b --- /dev/null +++ b/nx-X11/lib/src/StBytes.c @@ -0,0 +1,107 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +/* insulate predefined atom numbers from cut routines */ +static const Atom n_to_atom[8] = { + XA_CUT_BUFFER0, + XA_CUT_BUFFER1, + XA_CUT_BUFFER2, + XA_CUT_BUFFER3, + XA_CUT_BUFFER4, + XA_CUT_BUFFER5, + XA_CUT_BUFFER6, + XA_CUT_BUFFER7}; + +int +XRotateBuffers ( + register Display *dpy, + int rotate) +{ + /* XRotateWindowProperties wants a non-const Atom*, but it doesn't + * modify it, so this is safe. + */ + return XRotateWindowProperties(dpy, RootWindow(dpy, 0), (Atom *)n_to_atom, 8, rotate); +} + +char *XFetchBuffer ( + register Display *dpy, + int *nbytes, + register int buffer) +{ + Atom actual_type; + int actual_format; + unsigned long nitems; + unsigned long leftover; + unsigned char *data; + *nbytes = 0; + if ((buffer < 0) || (buffer > 7)) return (NULL); +/* XXX should be (sizeof (maxint) - 1)/4 */ + if (XGetWindowProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], + 0L, 10000000L, False, XA_STRING, + &actual_type, &actual_format, &nitems, &leftover, &data) != Success) { + return (NULL); + } + if ( (actual_type == XA_STRING) && (actual_format != 32) ) { + *nbytes = nitems; + return((char *)data); + } + Xfree (data); + return(NULL); +} + +char *XFetchBytes ( + register Display *dpy, + int *nbytes) +{ + return (XFetchBuffer (dpy, nbytes, 0)); +} + +int +XStoreBuffer ( + register Display *dpy, + _Xconst char *bytes, + int nbytes, + register int buffer) +{ + if ((buffer < 0) || (buffer > 7)) return 0; + return XChangeProperty(dpy, RootWindow(dpy, 0), n_to_atom[buffer], + XA_STRING, 8, PropModeReplace, (_Xconst unsigned char *) bytes, nbytes); +} + +int +XStoreBytes ( + register Display *dpy, + _Xconst char *bytes, + int nbytes) +{ + return XStoreBuffer (dpy, bytes, nbytes, 0); +} diff --git a/nx-X11/lib/src/StColor.c b/nx-X11/lib/src/StColor.c new file mode 100644 index 000000000..d5a217fb0 --- /dev/null +++ b/nx-X11/lib/src/StColor.c @@ -0,0 +1,58 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XStoreColor( + register Display *dpy, + Colormap cmap, + XColor *def) +{ + xColorItem *citem; + register xStoreColorsReq *req; + + LockDisplay(dpy); + GetReqExtra(StoreColors, SIZEOF(xColorItem), req); /* assume size is 4*n */ + + req->cmap = cmap; + + citem = (xColorItem *) NEXTPTR(req,xStoreColorsReq); + + citem->pixel = def->pixel; + citem->red = def->red; + citem->green = def->green; + citem->blue = def->blue; + citem->flags = def->flags; /* do_red, do_green, do_blue */ + + + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/StColors.c b/nx-X11/lib/src/StColors.c new file mode 100644 index 000000000..17a215cc0 --- /dev/null +++ b/nx-X11/lib/src/StColors.c @@ -0,0 +1,65 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XStoreColors( + register Display *dpy, + Colormap cmap, + XColor *defs, + int ncolors) +{ + register int i; + xColorItem citem; + register xStoreColorsReq *req; + + LockDisplay(dpy); + GetReq(StoreColors, req); + + req->cmap = cmap; + + req->length += (ncolors * SIZEOF(xColorItem)) >> 2; /* assume size is 4*n */ + + for (i = 0; i < ncolors; i++) { + citem.pixel = defs[i].pixel; + citem.red = defs[i].red; + citem.green = defs[i].green; + citem.blue = defs[i].blue; + citem.flags = defs[i].flags; + + /* note that xColorItem doesn't contain all 16-bit quantities, so + we can't use Data16 */ + Data(dpy, (char *)&citem, (long) SIZEOF(xColorItem)); + /* assume size is 4*n */ + } + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/StNColor.c b/nx-X11/lib/src/StNColor.c new file mode 100644 index 000000000..8b821c3ef --- /dev/null +++ b/nx-X11/lib/src/StNColor.c @@ -0,0 +1,87 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" + + +int +XStoreNamedColor( +register Display *dpy, +Colormap cmap, +_Xconst char *name, /* STRING8 */ +unsigned long pixel, /* CARD32 */ +int flags) /* DoRed, DoGreen, DoBlue */ +{ + unsigned int nbytes; + register xStoreNamedColorReq *req; + XcmsCCC ccc; + XcmsColor cmsColor_exact; + XColor scr_def; + +#ifdef XCMS + /* + * Let's Attempt to use Xcms approach to Parse Color + */ + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) != (XcmsCCC)NULL) { + if (_XcmsResolveColorString(ccc, &name, &cmsColor_exact, + XcmsRGBFormat) >= XcmsSuccess) { + _XcmsRGB_to_XColor(&cmsColor_exact, &scr_def, 1); + scr_def.pixel = pixel; + scr_def.flags = flags; + return XStoreColor(dpy, cmap, &scr_def); + } + /* + * Otherwise we failed; or name was changed with yet another + * name. Thus pass name to the X Server. + */ + } +#endif + + /* + * The Xcms and i18n methods failed, so lets pass it to the server + * for parsing. + */ + + LockDisplay(dpy); + GetReq(StoreNamedColor, req); + + req->cmap = cmap; + req->flags = flags; + req->pixel = pixel; + req->nbytes = nbytes = strlen(name); + req->length += (nbytes + 3) >> 2; /* round up to multiple of 4 */ + Data(dpy, name, (long)nbytes); + UnlockDisplay(dpy); + SyncHandle(); + return 0; +} + + diff --git a/nx-X11/lib/src/StName.c b/nx-X11/lib/src/StName.c new file mode 100644 index 000000000..a003a109e --- /dev/null +++ b/nx-X11/lib/src/StName.c @@ -0,0 +1,53 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +int +XStoreName ( + register Display *dpy, + Window w, + _Xconst char *name) +{ + return XChangeProperty(dpy, w, XA_WM_NAME, XA_STRING, + 8, PropModeReplace, (_Xconst unsigned char *)name, + name ? strlen(name) : 0); +} + +int +XSetIconName ( + register Display *dpy, + Window w, + _Xconst char *icon_name) +{ + return XChangeProperty(dpy, w, XA_WM_ICON_NAME, XA_STRING, 8, + PropModeReplace, (_Xconst unsigned char *)icon_name, + icon_name ? strlen(icon_name) : 0); +} diff --git a/nx-X11/lib/src/StrKeysym.c b/nx-X11/lib/src/StrKeysym.c new file mode 100644 index 000000000..125aceca3 --- /dev/null +++ b/nx-X11/lib/src/StrKeysym.c @@ -0,0 +1,181 @@ +/* + +Copyright 1985, 1987, 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include +#include +#include "Xresinternal.h" + +#define NEEDKTABLE +#include "ks_tables.h" +#include "Key.h" + +#ifndef KEYSYMDB +#ifndef XKEYSYMDB +#define KEYSYMDB "/usr/lib/X11/XKeysymDB" +#else +#define KEYSYMDB XKEYSYMDB +#endif +#endif + +static Bool initialized; +static XrmDatabase keysymdb; +static XrmQuark Qkeysym[2]; + +XrmDatabase +_XInitKeysymDB(void) +{ + if (!initialized) + { + const char *dbname; + + XrmInitialize(); + /* use and name of this env var is not part of the standard */ + /* implementation-dependent feature */ + dbname = getenv("XKEYSYMDB"); + if (!dbname) + dbname = KEYSYMDB; + keysymdb = XrmGetFileDatabase(dbname); + if (keysymdb) + Qkeysym[0] = XrmStringToQuark("Keysym"); + initialized = True; + } + return keysymdb; +} + +KeySym +XStringToKeysym(_Xconst char *s) +{ + register int i, n; + int h; + register Signature sig = 0; + register const char *p = s; + register int c; + register int idx; + const unsigned char *entry; + unsigned char sig1, sig2; + KeySym val; + + while ((c = *p++)) + sig = (sig << 1) + c; + i = sig % KTABLESIZE; + h = i + 1; + sig1 = (sig >> 8) & 0xff; + sig2 = sig & 0xff; + n = KMAXHASH; + while ((idx = hashString[i])) + { + entry = &_XkeyTable[idx]; + if ((entry[0] == sig1) && (entry[1] == sig2) && + !strcmp(s, (const char *)entry + 6)) + { + val = (entry[2] << 24) | (entry[3] << 16) | + (entry[4] << 8) | entry[5]; + if (!val) + val = XK_VoidSymbol; + return val; + } + if (!--n) + break; + i += h; + if (i >= KTABLESIZE) + i -= KTABLESIZE; + } + + if (!initialized) + (void)_XInitKeysymDB(); + if (keysymdb) + { + XrmValue result; + XrmRepresentation from_type; + char c; + XrmQuark names[2]; + + names[0] = _XrmInternalStringToQuark(s, p - s - 1, sig, False); + names[1] = NULLQUARK; + (void)XrmQGetResource(keysymdb, names, Qkeysym, &from_type, &result); + if (result.addr && (result.size > 1)) + { + val = 0; + for (i = 0; i < result.size - 1; i++) + { + c = ((char *)result.addr)[i]; + if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; + else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; + else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; + else return NoSymbol; + } + return val; + } + } + + if (*s == 'U') { + val = 0; + for (p = &s[1]; *p; p++) { + c = *p; + if ('0' <= c && c <= '9') val = (val<<4)+c-'0'; + else if ('a' <= c && c <= 'f') val = (val<<4)+c-'a'+10; + else if ('A' <= c && c <= 'F') val = (val<<4)+c-'A'+10; + else return NoSymbol; + if (val > 0x10ffff) + return NoSymbol; + } + if (val < 0x20 || (val > 0x7e && val < 0xa0)) + return NoSymbol; + if (val < 0x100) + return val; + return val | 0x01000000; + } + + if (strlen(s) > 2 && s[0] == '0' && s[1] == 'x') { + char *tmp = NULL; + val = strtoul(s, &tmp, 16); + if (val == ULONG_MAX || (tmp && *tmp != '\0')) + return NoSymbol; + else + return val; + } + + /* Stupid inconsistency between the headers and XKeysymDB: the former has + * no separating underscore, while some XF86* syms in the latter did. + * As a last ditch effort, try without. */ + if (strncmp(s, "XF86_", 5) == 0) { + KeySym ret; + char *tmp = strdup(s); + if (!tmp) + return NoSymbol; + memmove(&tmp[4], &tmp[5], strlen(s) - 5 + 1); + ret = XStringToKeysym(tmp); + free(tmp); + return ret; + } + + return NoSymbol; +} diff --git a/nx-X11/lib/src/StrToText.c b/nx-X11/lib/src/StrToText.c new file mode 100644 index 000000000..ff33492f2 --- /dev/null +++ b/nx-X11/lib/src/StrToText.c @@ -0,0 +1,90 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +/* + * XStringListToTextProperty - fill in TextProperty structure with + * concatenated list of null-separated strings. Return True if successful + * else False. Allocate room on end for trailing NULL, but don't include in + * count. + */ + +Status XStringListToTextProperty ( + char **argv, + int argc, + XTextProperty *textprop) +{ + register int i; + register unsigned int nbytes; + XTextProperty proto; + + /* figure out how much space we'll need for this list */ + for (i = 0, nbytes = 0; i < argc; i++) { + nbytes += (unsigned) ((argv[i] ? strlen (argv[i]) : 0) + 1); + } + + /* fill in a prototype containing results so far */ + proto.encoding = XA_STRING; + proto.format = 8; + if (nbytes) + proto.nitems = nbytes - 1; /* subtract one for trailing */ + else + proto.nitems = 0; + proto.value = NULL; + + /* build concatenated list of strings */ + if (nbytes > 0) { + register char *buf = Xmalloc (nbytes); + if (!buf) return False; + + proto.value = (unsigned char *) buf; + for (i = 0; i < argc; i++) { + char *arg = argv[i]; + + if (arg) { + (void) strcpy (buf, arg); + buf += (strlen (arg) + 1); + } else { + *buf++ = '\0'; + } + } + } else { + proto.value = Xmalloc (1); /* easier for client */ + if (!proto.value) return False; + + proto.value[0] = '\0'; + } + + /* we were successful, so set return value */ + *textprop = proto; + return True; +} diff --git a/nx-X11/lib/src/Sync.c b/nx-X11/lib/src/Sync.c new file mode 100644 index 000000000..bc768d4f6 --- /dev/null +++ b/nx-X11/lib/src/Sync.c @@ -0,0 +1,60 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +/* Synchronize with errors and events, optionally discarding pending events */ + +int +XSync ( + register Display *dpy, + Bool discard) +{ + xGetInputFocusReply rep; + _X_UNUSED register xReq *req; + + LockDisplay(dpy); + GetEmptyReq(GetInputFocus, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + + if (discard && dpy->head) { + _XQEvent *qelt; + + for (qelt=dpy->head; qelt; qelt=qelt->next) + qelt->qserial_num = 0; + + ((_XQEvent *)dpy->tail)->next = dpy->qfree; + dpy->qfree = (_XQEvent *)dpy->head; + dpy->head = dpy->tail = NULL; + dpy->qlen = 0; + } + UnlockDisplay(dpy); + return 1; +} + diff --git a/nx-X11/lib/src/Synchro.c b/nx-X11/lib/src/Synchro.c new file mode 100644 index 000000000..930448ee9 --- /dev/null +++ b/nx-X11/lib/src/Synchro.c @@ -0,0 +1,79 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + + +static int _XSyncFunction(register Display *dpy) +{ + XSync(dpy,0); + return 0; +} + +int (*XSynchronize(Display *dpy, int onoff))(Display *) +{ + int (*temp)(Display *); + int (*func)(Display *) = NULL; + + if (onoff) + func = _XSyncFunction; + + LockDisplay(dpy); + if (dpy->flags & XlibDisplayPrivSync) { + temp = dpy->savedsynchandler; + dpy->savedsynchandler = func; + } else { + temp = dpy->synchandler; + dpy->synchandler = func; + } + UnlockDisplay(dpy); + return (temp); +} + +int (*XSetAfterFunction( + Display *dpy, + int (*func)( + Display* + ) + ))(Display *) +{ + int (*temp)(Display *); + + LockDisplay(dpy); + if (dpy->flags & XlibDisplayPrivSync) { + temp = dpy->savedsynchandler; + dpy->savedsynchandler = func; + } else { + temp = dpy->synchandler; + dpy->synchandler = func; + } + UnlockDisplay(dpy); + return (temp); +} + diff --git a/nx-X11/lib/src/Text.c b/nx-X11/lib/src/Text.c new file mode 100644 index 000000000..223b1cf8b --- /dev/null +++ b/nx-X11/lib/src/Text.c @@ -0,0 +1,139 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawString( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + _Xconst char *string, + int length) +{ + int Datalength = 0; + register xPolyText8Req *req; + + if (length <= 0) + return 0; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq (PolyText8, req); + req->drawable = d; + req->gc = gc->gid; + req->x = x; + req->y = y; + + + Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + length; + + + req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ + + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. If the request does fit into the + * empty buffer, then we won't have to flush it at the end to keep + * the buffer 32-bit aligned. + */ + + if (dpy->bufptr + Datalength > dpy->bufmax) + _XFlush (dpy); + + { + int nbytes; + int PartialNChars = length; + /* register xTextElt *elt; */ + char *CharacterOffset = (char *)string; + unsigned char *tbuf; + + while(PartialNChars > 254) + { + nbytes = 254 + SIZEOF(xTextElt); + BufAlloc (unsigned char *, tbuf, nbytes); +/* elt->delta = 0; + * elt->len = 254; + */ + *(unsigned char *)tbuf = 254; + *(tbuf+1) = 0; +/* memcpy ((char *) (elt + 1), CharacterOffset, 254); + */ + memcpy ((char *)tbuf+2, CharacterOffset, 254); + PartialNChars = PartialNChars - 254; + CharacterOffset += 254; + } + + if (PartialNChars) + { + nbytes = PartialNChars + SIZEOF(xTextElt); + BufAlloc (unsigned char *, tbuf, nbytes); +/* elt->delta = 0; + * elt->len = PartialNChars; + */ + *(unsigned char *)tbuf = PartialNChars; + *(tbuf+1) = 0; +/* memcpy ((char *) (elt + 1), CharacterOffset, PartialNChars); + */ + memcpy ((char *)tbuf+2, CharacterOffset, PartialNChars); + } + } + + /* Pad request out to a 32-bit boundary */ + + if (Datalength &= 3) { + char *pad; + /* + * BufAlloc is a macro that uses its last argument more than + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + */ + length = 4 - Datalength; + BufAlloc (char *, pad, length); + /* + * if there are 3 bytes of padding, the first byte MUST be 0 + * so the pad bytes aren't mistaken for a final xTextElt + */ + *pad = 0; + } + + /* + * If the buffer pointer is not now pointing to a 32-bit boundary, + * we must flush the buffer so that it does point to a 32-bit boundary + * at the end of this routine. + */ + + if ((dpy->bufptr - dpy->buffer) & 3) + _XFlush (dpy); + UnlockDisplay(dpy); + SyncHandle(); + return 0; +} diff --git a/nx-X11/lib/src/Text16.c b/nx-X11/lib/src/Text16.c new file mode 100644 index 000000000..008a3f7a5 --- /dev/null +++ b/nx-X11/lib/src/Text16.c @@ -0,0 +1,129 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XDrawString16( + register Display *dpy, + Drawable d, + GC gc, + int x, + int y, + _Xconst XChar2b *string, + int length) +{ + int Datalength = 0; + register xPolyText16Req *req; + + if (length <= 0) + return 0; + + LockDisplay(dpy); + FlushGC(dpy, gc); + GetReq (PolyText16, req); + req->drawable = d; + req->gc = gc->gid; + req->x = x; + req->y = y; + + + Datalength += SIZEOF(xTextElt) * ((length + 253) / 254) + (length << 1); + + + req->length += (Datalength + 3)>>2; /* convert to number of 32-bit words */ + + + /* + * If the entire request does not fit into the remaining space in the + * buffer, flush the buffer first. If the request does fit into the + * empty buffer, then we won't have to flush it at the end to keep + * the buffer 32-bit aligned. + */ + + if (dpy->bufptr + Datalength > dpy->bufmax) + _XFlush (dpy); + + { + int nbytes; + int PartialNChars = length; + register xTextElt *elt; + XChar2b *CharacterOffset = (XChar2b *)string; + + while(PartialNChars > 254) + { + nbytes = 254 * 2 + SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + elt->len = 254; + memcpy (((char *) elt) + 2, (char *)CharacterOffset, 254 * 2); + PartialNChars = PartialNChars - 254; + CharacterOffset += 254; + } + + if (PartialNChars) + { + nbytes = PartialNChars * 2 + SIZEOF(xTextElt); + BufAlloc (xTextElt *, elt, nbytes); + elt->delta = 0; + elt->len = PartialNChars; + memcpy(((char *)elt) + 2, (char *)CharacterOffset, PartialNChars * 2); + } + } + + /* Pad request out to a 32-bit boundary */ + + if (Datalength &= 3) { + char *pad; + /* + * BufAlloc is a macro that uses its last argument more than + * once, otherwise I'd write "BufAlloc (char *, pad, 4-length)" + */ + length = 4 - Datalength; + BufAlloc (char *, pad, length); + /* + * if there are 3 bytes of padding, the first byte MUST be 0 + * so the pad bytes aren't mistaken for a final xTextElt + */ + *pad = 0; + } + + /* + * If the buffer pointer is not now pointing to a 32-bit boundary, + * we must flush the buffer so that it does point to a 32-bit boundary + * at the end of this routine. + */ + + if ((dpy->bufptr - dpy->buffer) & 3) + _XFlush (dpy); + UnlockDisplay(dpy); + SyncHandle(); + return 0; +} + diff --git a/nx-X11/lib/src/TextExt.c b/nx-X11/lib/src/TextExt.c new file mode 100644 index 000000000..b883b01b4 --- /dev/null +++ b/nx-X11/lib/src/TextExt.c @@ -0,0 +1,234 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define min_byte2 min_char_or_byte2 +#define max_byte2 max_char_or_byte2 + + +/* + * CI_GET_ROWZERO_CHAR_INFO_2D - do the same thing as CI_GET_CHAR_INFO_1D, + * except that the font has more than one row. This is special case of more + * general version used in XTextExt16.c since row == 0. This is used when + * max_byte2 is not zero. A further optimization would do the check for + * min_byte1 being zero ahead of time. + */ + +#define CI_GET_ROWZERO_CHAR_INFO_2D(fs,col,def,cs) \ +{ \ + cs = def; \ + if (fs->min_byte1 == 0 && \ + col >= fs->min_byte2 && col <= fs->max_byte2) { \ + if (fs->per_char == NULL) { \ + cs = &fs->min_bounds; \ + } else { \ + cs = &fs->per_char[(col - fs->min_byte2)]; \ + if (CI_NONEXISTCHAR(cs)) cs = def; \ + } \ + } \ +} + + +/* + * XTextExtents - compute the extents of string given as a sequences of eight + * bit bytes. Since we know that the input characters will always be from the + * first row of the font (i.e. byte1 == 0), we can do some optimizations beyond + * what is done in XTextExtents16. + */ +int +XTextExtents ( + XFontStruct *fs, + _Xconst char *string, + int nchars, + int *dir, /* RETURN font information */ + int *font_ascent, /* RETURN font information */ + int *font_descent, /* RETURN font information */ + register XCharStruct *overall) /* RETURN character information */ +{ + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + int nfound = 0; /* number of characters found */ + XCharStruct *def; /* info about default char */ + unsigned char *us; /* be 8bit clean */ + + if (singlerow) { /* optimization */ + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + *dir = fs->direction; + *font_ascent = fs->ascent; + *font_descent = fs->descent; + + /* + * Iterate over the input string getting the appropriate * char struct. + * The default (which may be null if there is no def_char) will be returned + * if the character doesn't exist. On the first time * through the loop, + * assign the values to overall; otherwise, compute * the new values. + */ + + for (i = 0, us = (unsigned char *) string; i < nchars; i++, us++) { + register unsigned uc = (unsigned) *us; /* since about to do macro */ + register XCharStruct *cs; + + if (singlerow) { /* optimization */ + CI_GET_CHAR_INFO_1D (fs, uc, def, cs); + } else { + CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); + } + + if (cs) { + if (nfound++ == 0) { + *overall = *cs; + } else { + overall->ascent = max (overall->ascent, cs->ascent); + overall->descent = max (overall->descent, cs->descent); + overall->lbearing = min (overall->lbearing, + overall->width + cs->lbearing); + overall->rbearing = max (overall->rbearing, + overall->width + cs->rbearing); + overall->width += cs->width; + } + } + } + + /* + * if there were no characters, then set everything to 0 + */ + if (nfound == 0) { + overall->width = overall->ascent = overall->descent = + overall->lbearing = overall->rbearing = 0; + } + + return 0; +} + + +/* + * XTextWidth - compute the width of a string of eightbit bytes. This is a + * subset of XTextExtents. + */ +int +XTextWidth ( + XFontStruct *fs, + _Xconst char *string, + int count) +{ + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + XCharStruct *def; /* info about default char */ + unsigned char *us; /* be 8bit clean */ + int width = 0; /* RETURN value */ + + if (singlerow) { /* optimization */ + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + if (def && fs->min_bounds.width == fs->max_bounds.width) + return (fs->min_bounds.width * count); + + /* + * Iterate over all character in the input string; only consider characters + * that exist. + */ + for (i = 0, us = (unsigned char *) string; i < count; i++, us++) { + register unsigned uc = (unsigned) *us; /* since about to do macro */ + register XCharStruct *cs; + + if (singlerow) { /* optimization */ + CI_GET_CHAR_INFO_1D (fs, uc, def, cs); + } else { + CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); + } + + if (cs) width += cs->width; + } + + return width; +} + + + +/* + * _XTextHeight - compute the height of a string of eightbit bytes. + */ +int +_XTextHeight ( + XFontStruct *fs, + _Xconst char *string, + int count) +{ + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + XCharStruct *def; /* info about default char */ + unsigned char *us; /* be 8bit clean */ + int height = 0; /* RETURN value */ + + if (singlerow) { /* optimization */ + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + if (def && (fs->min_bounds.ascent == fs->max_bounds.ascent) + && (fs->min_bounds.descent == fs->max_bounds.descent)) + return ((fs->min_bounds.ascent + fs->min_bounds.descent) * count); + + /* + * Iterate over all character in the input string; only consider characters + * that exist. + */ + for (i = 0, us = (unsigned char *) string; i < count; i++, us++) { + register unsigned uc = (unsigned) *us; /* since about to do macro */ + register XCharStruct *cs; + + if (singlerow) { /* optimization */ + CI_GET_CHAR_INFO_1D (fs, uc, def, cs); + } else { + CI_GET_ROWZERO_CHAR_INFO_2D (fs, uc, def, cs); + } + + if (cs) height += (cs->ascent + cs->descent); + } + + return height; +} + diff --git a/nx-X11/lib/src/TextExt16.c b/nx-X11/lib/src/TextExt16.c new file mode 100644 index 000000000..01a0f32e4 --- /dev/null +++ b/nx-X11/lib/src/TextExt16.c @@ -0,0 +1,210 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +#define min_byte2 min_char_or_byte2 +#define max_byte2 max_char_or_byte2 + +/* + * XTextExtents16 - compute the extents of string given as a sequence of + * XChar2bs. + */ +int +XTextExtents16 ( + XFontStruct *fs, + _Xconst XChar2b *string, + int nchars, + int *dir, /* RETURN font information */ + int *font_ascent, /* RETURN font information */ + int *font_descent, /* RETURN font information */ + register XCharStruct *overall) /* RETURN character information */ +{ + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + int nfound = 0; /* number of characters found */ + XCharStruct *def; /* info about default char */ + + if (singlerow) { + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + *dir = fs->direction; + *font_ascent = fs->ascent; + *font_descent = fs->descent; + + /* + * Iterate over the input string getting the appropriate * char struct. + * The default (which may be null if there is no def_char) will be returned + * if the character doesn't exist. On the first time * through the loop, + * assign the values to overall; otherwise, compute * the new values. + */ + + for (i = 0; i < nchars; i++, string++) { + register XCharStruct *cs; + unsigned int r = (unsigned int) string->byte1; /* watch for macros */ + unsigned int c = (unsigned int) string->byte2; /* watch for macros */ + + if (singlerow) { + unsigned int ind = ((r << 8) | c); /* watch for macros */ + CI_GET_CHAR_INFO_1D (fs, ind, def, cs); + } else { + CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); + } + + if (cs) { + if (nfound++ == 0) { + *overall = *cs; + } else { + overall->ascent = max (overall->ascent, cs->ascent); + overall->descent = max (overall->descent, cs->descent); + overall->lbearing = min (overall->lbearing, + overall->width + cs->lbearing); + overall->rbearing = max (overall->rbearing, + overall->width + cs->rbearing); + overall->width += cs->width; + } + } + } + + /* + * if there were no characters, then set everything to 0 + */ + if (nfound == 0) { + overall->width = overall->ascent = overall->descent = + overall->lbearing = overall->rbearing = 0; + } + + return 0; +} + + +/* + * XTextWidth16 - compute the width of sequence of XChar2bs. This is a + * subset of XTextExtents16. + */ +int +XTextWidth16 ( + XFontStruct *fs, + _Xconst XChar2b *string, + int count) +{ + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + XCharStruct *def; /* info about default char */ + int width = 0; /* RETURN value */ + + if (singlerow) { + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + if (def && fs->min_bounds.width == fs->max_bounds.width) + return (fs->min_bounds.width * count); + + /* + * Iterate over all character in the input string; only consider characters + * that exist. + */ + for (i = 0; i < count; i++, string++) { + register XCharStruct *cs; + unsigned int r = (unsigned int) string->byte1; /* watch for macros */ + unsigned int c = (unsigned int) string->byte2; /* watch for macros */ + + if (singlerow) { + unsigned int ind = ((r << 8) | c); /* watch for macros */ + CI_GET_CHAR_INFO_1D (fs, ind, def, cs); + } else { + CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); + } + + if (cs) width += cs->width; + } + + return width; +} + + +/* + * _XTextHeight16 - compute the height of sequence of XChar2bs. + */ +int +_XTextHeight16 ( + XFontStruct *fs, + _Xconst XChar2b *string, + int count) +{ + int i; /* iterator */ + Bool singlerow = (fs->max_byte1 == 0); /* optimization */ + XCharStruct *def; /* info about default char */ + int height = 0; /* RETURN value */ + + if (singlerow) { + CI_GET_DEFAULT_INFO_1D (fs, def); + } else { + CI_GET_DEFAULT_INFO_2D (fs, def); + } + + if (def && (fs->min_bounds.ascent == fs->max_bounds.ascent) + && (fs->min_bounds.descent == fs->max_bounds.descent)) + return ((fs->min_bounds.ascent + fs->min_bounds.descent) * count); + + /* + * Iterate over all character in the input string; only consider characters + * that exist. + */ + for (i = 0; i < count; i++, string++) { + register XCharStruct *cs; + unsigned int r = (unsigned int) string->byte1; /* watch for macros */ + unsigned int c = (unsigned int) string->byte2; /* watch for macros */ + + if (singlerow) { + unsigned int ind = ((r << 8) | c); /* watch for macros */ + CI_GET_CHAR_INFO_1D (fs, ind, def, cs); + } else { + CI_GET_CHAR_INFO_2D (fs, r, c, def, cs); + } + + if (cs) height += (cs->ascent + cs->descent); + } + + return height; +} + diff --git a/nx-X11/lib/src/TextToStr.c b/nx-X11/lib/src/TextToStr.c new file mode 100644 index 000000000..03f71558b --- /dev/null +++ b/nx-X11/lib/src/TextToStr.c @@ -0,0 +1,118 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + + +/* + * XTextPropertyToStringList - set list and count to contain data stored in + * null-separated STRING property. + */ + +Status XTextPropertyToStringList ( + XTextProperty *tp, + char ***list_return, + int *count_return) +{ + char **list; /* return value */ + int nelements; /* return value */ + register char *cp; /* temp variable */ + char *start; /* start of thing to copy */ + int i, j; /* iterator variables */ + int datalen = (int) tp->nitems; /* for convenience */ + + /* + * make sure we understand how to do it + */ + if (tp->encoding != XA_STRING || tp->format != 8) return False; + + if (datalen == 0) { + *list_return = NULL; + *count_return = 0; + return True; + } + + /* + * walk the list to figure out how many elements there are + */ + nelements = 1; /* since null-separated */ + for (cp = (char *) tp->value, i = datalen; i > 0; cp++, i--) { + if (*cp == '\0') nelements++; + } + + /* + * allocate list and duplicate + */ + list = Xmalloc (nelements * sizeof (char *)); + if (!list) return False; + + start = Xmalloc ((datalen + 1) * sizeof (char)); /* for */ + if (!start) { + Xfree (list); + return False; + } + + /* + * copy data + */ + memcpy (start, (char *) tp->value, tp->nitems); + start[datalen] = '\0'; + + /* + * walk down list setting value + */ + for (cp = start, i = datalen + 1, j = 0; i > 0; cp++, i--) { + if (*cp == '\0') { + list[j] = start; + start = (cp + 1); + j++; + } + } + + /* + * append final null pointer and then return data + */ + *list_return = list; + *count_return = nelements; + return True; +} + + +void XFreeStringList (char **list) +{ + if (list) { + if (list[0]) Xfree (list[0]); + Xfree (list); + list = NULL; + } +} + diff --git a/nx-X11/lib/src/TrCoords.c b/nx-X11/lib/src/TrCoords.c new file mode 100644 index 000000000..77c1f0672 --- /dev/null +++ b/nx-X11/lib/src/TrCoords.c @@ -0,0 +1,64 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +Bool XTranslateCoordinates( + register Display *dpy, + Window src_win, + Window dest_win, + int src_x, + int src_y, + int *dst_x, + int *dst_y, + Window *child) +{ + register xTranslateCoordsReq *req; + xTranslateCoordsReply rep; + + LockDisplay(dpy); + GetReq(TranslateCoords, req); + req->srcWid = src_win; + req->dstWid = dest_win; + req->srcX = src_x; + req->srcY = src_y; + if (_XReply (dpy, (xReply *)&rep, 0, xTrue) == 0) { + UnlockDisplay(dpy); + SyncHandle(); + return(False); + } + + *child = rep.child; + *dst_x = cvtINT16toInt (rep.dstX); + *dst_y = cvtINT16toInt (rep.dstY); + UnlockDisplay(dpy); + SyncHandle(); + return ((int)rep.sameScreen); +} + diff --git a/nx-X11/lib/src/UIThrStubs.c b/nx-X11/lib/src/UIThrStubs.c new file mode 100644 index 000000000..0c913d41f --- /dev/null +++ b/nx-X11/lib/src/UIThrStubs.c @@ -0,0 +1,157 @@ +/* + * + * Copyright (c) 1995 David E. Wexelblat. All rights reserved + * + * Permission is hereby granted, free of charge, to any person obtaining + * a copy of this software and associated documentation files (the + * "Software"), to deal in the Software without restriction, including + * without limitation the rights to use, copy, modify, merge, publish, + * distribute, sublicense, and/or sell copies of the Software, and to + * permit persons to whom the Software is furnished to do so, subject to + * the following conditions: + * + * The above copyright notice and this permission notice shall be included + * in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS + * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF + * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. + * IN NO EVENT SHALL DAVID E. WEXELBLAT BE LIABLE FOR ANY CLAIM, DAMAGES OR + * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, + * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + * + * Except as contained in this notice, the name of David E. Wexelblat shall + * not be used in advertising or otherwise to promote the sale, use or + * other dealings in this Software without prior written authorization + * from David E. Wexelblat. + * + */ + +/* + * Stubs for thread functions needed by the X library. Supports + * UnixWare 2.x threads; may support Solaris 2 threads as well, but not + * tested. Defining things this way removes the dependency of the X + * library on the threads library, but still supports threads if the user + * specificies the thread library on the link line. + */ + +/* + * Modifications by Carlos A M dos Santos, XFree86 Project, November 1999. + * + * Explanation from : + * The structure below is complicated, mostly because P1003.1c (the + * IEEE POSIX Threads spec) went through lots of drafts, and some + * vendors shipped systems based on draft API that were changed later. + * Unfortunately POSIX did not provide a feature-test macro for + * distinguishing each of the drafts. + */ + +#ifdef CTHREADS +#ifdef HAVE_CONFIG_H +#include +#endif +#include +typedef cthread_t xthread_t; +#define xthread_self cthread_self +#pragma weak cthread_self = _Xthr_self_stub_ +#define xmutex_init mutex_init +#pragma weak mutex_init = _Xthr_zero_stub_ +#pragma weak mutex_clear = _Xthr_zero_stub_ +#pragma weak mutex_lock = _Xthr_zero_stub_ +#pragma weak mutex_unlock = _Xthr_zero_stub_ +#pragma weak condition_init = _Xthr_zero_stub_ +#pragma weak condition_clear = _Xthr_zero_stub_ +#pragma weak condition_wait = _Xthr_zero_stub_ +#pragma weak condition_signal = _Xthr_zero_stub_ +#pragma weak condition_broadcast = _Xthr_zero_stub_ +#else /* !CTHREADS */ +#if defined(SVR4) +#include +typedef thread_t xthread_t; +#pragma weak thr_self = _Xthr_self_stub_ +#pragma weak mutex_init = _Xthr_zero_stub_ +#pragma weak mutex_destroy = _Xthr_zero_stub_ +#pragma weak mutex_lock = _Xthr_zero_stub_ +#pragma weak mutex_unlock = _Xthr_zero_stub_ +#pragma weak cond_init = _Xthr_zero_stub_ +#pragma weak cond_destroy = _Xthr_zero_stub_ +#pragma weak cond_wait = _Xthr_zero_stub_ +#pragma weak cond_signal = _Xthr_zero_stub_ +#pragma weak cond_broadcast = _Xthr_zero_stub_ +#else /* !SVR4 */ +#ifdef WIN32 +#include +#else /* !WIN32 */ +#ifdef USE_TIS_SUPPORT +#include +typedef pthread_t xthread_t; +#pragma weak tis_self = _Xthr_self_stub_ +#pragma weak tis_mutex_init = _Xthr_zero_stub_ +#pragma weak tis_mutex_destroy = _Xthr_zero_stub_ +#pragma weak tis_mutex_lock = _Xthr_zero_stub_ +#pragma weak tis_mutex_unlock = _Xthr_zero_stub_ +#pragma weak tis_cond_init = _Xthr_zero_stub_ +#pragma weak tis_cond_destroy = _Xthr_zero_stub_ +#pragma weak tis_cond_wait = _Xthr_zero_stub_ +#pragma weak tis_cond_signal = _Xthr_zero_stub_ +#pragma weak tis_cond_broadcast = _Xthr_zero_stub_ +#else +#include +typedef pthread_t xthread_t; +#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95) +xthread_t pthread_self() __attribute__ ((weak, alias ("_Xthr_self_stub_"))); +int pthread_mutex_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_mutex_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_mutex_lock() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_mutex_unlock() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_cond_init() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_cond_destroy() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_cond_wait() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_cond_signal() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_cond_broadcast() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_key_create() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +void *pthread_getspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +int pthread_setspecific() __attribute__ ((weak, alias ("_Xthr_zero_stub_"))); +#else /* __GNUC__ */ +#pragma weak pthread_self = _Xthr_self_stub_ +#pragma weak pthread_mutex_init = _Xthr_zero_stub_ +#pragma weak pthread_mutex_destroy = _Xthr_zero_stub_ +#pragma weak pthread_mutex_lock = _Xthr_zero_stub_ +#pragma weak pthread_mutex_unlock = _Xthr_zero_stub_ +#pragma weak pthread_cond_init = _Xthr_zero_stub_ +#pragma weak pthread_cond_destroy = _Xthr_zero_stub_ +#pragma weak pthread_cond_wait = _Xthr_zero_stub_ +#pragma weak pthread_cond_signal = _Xthr_zero_stub_ +#pragma weak pthread_cond_broadcast = _Xthr_zero_stub_ +/* These are added for libGL */ +#pragma weak pthread_key_create = _Xthr_zero_stub_ +#pragma weak pthread_getspecific = _Xthr_zero_stub_ +#pragma weak pthread_setspecific = _Xthr_zero_stub_ +#endif /* __GNUC__ */ +#if defined(_DECTHREADS_) || defined(linux) +#pragma weak pthread_equal = _Xthr_equal_stub_ /* See Xthreads.h! */ +int +_Xthr_equal_stub_() +{ + return(1); +} +#endif /* _DECTHREADS_ || linux */ +#endif /* USE_TIS_SUPPORT */ +#endif /* WIN32 */ +#endif /* SVR4 */ +#endif /* CTHREADS */ + +static xthread_t +_Xthr_self_stub_() +{ + static xthread_t _X_no_thread_id; + + return(_X_no_thread_id); /* defined by */ +} + +static int +_Xthr_zero_stub_() +{ + return(0); +} diff --git a/nx-X11/lib/src/UndefCurs.c b/nx-X11/lib/src/UndefCurs.c new file mode 100644 index 000000000..1d46ff946 --- /dev/null +++ b/nx-X11/lib/src/UndefCurs.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUndefineCursor ( + register Display *dpy, + Window w) +{ + register xChangeWindowAttributesReq *req; + unsigned long defcurs = None; + + LockDisplay(dpy); + GetReqExtra (ChangeWindowAttributes, 4, req); + req->window = w; + req->valueMask = CWCursor; + OneDataCard32 (dpy, NEXTPTR(req,xChangeWindowAttributesReq), defcurs); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/UngrabBut.c b/nx-X11/lib/src/UngrabBut.c new file mode 100644 index 000000000..13545ed98 --- /dev/null +++ b/nx-X11/lib/src/UngrabBut.c @@ -0,0 +1,49 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUngrabButton( + register Display *dpy, + unsigned int button, /* CARD8 */ + unsigned int modifiers, /* CARD16 */ + Window grab_window) +{ + register xUngrabButtonReq *req; + + LockDisplay(dpy); + GetReq(UngrabButton, req); + req->button = button; + req->modifiers = modifiers; + req->grabWindow = grab_window; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/UngrabKbd.c b/nx-X11/lib/src/UngrabKbd.c new file mode 100644 index 000000000..974e8a324 --- /dev/null +++ b/nx-X11/lib/src/UngrabKbd.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUngrabKeyboard ( + register Display *dpy, + Time time) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(UngrabKeyboard, time, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/UngrabKey.c b/nx-X11/lib/src/UngrabKey.c new file mode 100644 index 000000000..919c4e76c --- /dev/null +++ b/nx-X11/lib/src/UngrabKey.c @@ -0,0 +1,52 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUngrabKey( + register Display *dpy, + int key, + unsigned int modifiers, + Window grab_window) +{ + register xUngrabKeyReq *req; + + LockDisplay(dpy); + GetReq(UngrabKey, req); + req->grabWindow = grab_window; + req->modifiers = modifiers; + req->key = key; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + + + diff --git a/nx-X11/lib/src/UngrabPtr.c b/nx-X11/lib/src/UngrabPtr.c new file mode 100644 index 000000000..16417921c --- /dev/null +++ b/nx-X11/lib/src/UngrabPtr.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUngrabPointer( + register Display *dpy, + Time time) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(UngrabPointer, time, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/UngrabSvr.c b/nx-X11/lib/src/UngrabSvr.c new file mode 100644 index 000000000..20ad9aa35 --- /dev/null +++ b/nx-X11/lib/src/UngrabSvr.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUngrabServer ( + register Display *dpy) +{ + _X_UNUSED register xReq *req; + + LockDisplay(dpy); + GetEmptyReq(UngrabServer, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/UninsCmap.c b/nx-X11/lib/src/UninsCmap.c new file mode 100644 index 000000000..db574ef7c --- /dev/null +++ b/nx-X11/lib/src/UninsCmap.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUninstallColormap( + register Display *dpy, + Colormap cmap) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(UninstallColormap, cmap, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/UnldFont.c b/nx-X11/lib/src/UnldFont.c new file mode 100644 index 000000000..a4f69fee4 --- /dev/null +++ b/nx-X11/lib/src/UnldFont.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUnloadFont( + register Display *dpy, + Font font) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(CloseFont, font, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/UnmapSubs.c b/nx-X11/lib/src/UnmapSubs.c new file mode 100644 index 000000000..7490a70e9 --- /dev/null +++ b/nx-X11/lib/src/UnmapSubs.c @@ -0,0 +1,44 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUnmapSubwindows( + register Display *dpy, + Window win) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(UnmapSubwindows,win, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} diff --git a/nx-X11/lib/src/UnmapWin.c b/nx-X11/lib/src/UnmapWin.c new file mode 100644 index 000000000..51ae16319 --- /dev/null +++ b/nx-X11/lib/src/UnmapWin.c @@ -0,0 +1,45 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XUnmapWindow ( + register Display *dpy, + Window w) +{ + register xResourceReq *req; + + LockDisplay(dpy); + GetResReq(UnmapWindow, w, req); + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/VisUtil.c b/nx-X11/lib/src/VisUtil.c new file mode 100644 index 000000000..17ca3631f --- /dev/null +++ b/nx-X11/lib/src/VisUtil.c @@ -0,0 +1,252 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" +#include +/* + * This procedure returns a list of visual information structures + * that match the specified attributes given in the visual information + * template. + * + * If no visuals exist that match the specified attributes, a NULL is + * returned. + * + * The choices for visual_info_mask are: + * + * VisualNoMask + * VisualIDMask + * VisualScreenMask + * VisualDepthMask + * VisualClassMask + * VisualRedMaskMask + * VisualGreenMaskMask + * VisualBlueMaskMask + * VisualColormapSizeMask + * VisualBitsPerRGBMask + * VisualAllMask + */ + +XVisualInfo *XGetVisualInfo( + Display *dpy, + register long visual_info_mask, + register XVisualInfo *visual_info_template, + int *nitems) /* RETURN */ +{ + + register Visual *vp; + register Depth *dp; + Screen *sp; + int ii,screen_s,screen_e,total,count; + register XVisualInfo *vip,*vip_base; + + /* NOTE: NO HIGH PERFORMING CODE TO BE FOUND HERE */ + + LockDisplay(dpy); + + /* ALLOCATE THE ORIGINAL BUFFER; REALLOCED LATER IF OVERFLOW OCCURS; + FREED AT END IF NO VISUALS ARE FOUND */ + + count = 0; + total = 10; + if (! (vip_base = vip = Xmalloc(sizeof(XVisualInfo) * total))) { + UnlockDisplay(dpy); + return (XVisualInfo *) NULL; + } + + /* DETERMINE IF WE DO ALL SCREENS OR ONLY ONE */ + + screen_s = 0; + screen_e = dpy->nscreens; + if (visual_info_mask & VisualScreenMask) + { + screen_s = visual_info_template->screen; + if (screen_s < 0 || screen_s >= screen_e) + screen_e = screen_s; + else + screen_e = screen_s + 1; + } + + /* LOOP THROUGH SCREENS */ + + for (ii=screen_s; iiscreens[ii]); + + /* LOOP THROUGH DEPTHS */ + + for (dp=sp->depths; dp < (sp->depths + sp->ndepths); dp++) + { + if ((visual_info_mask & VisualDepthMask) && + (dp->depth != visual_info_template->depth)) continue; + + /* LOOP THROUGH VISUALS */ + + if (dp->visuals) { + for (vp=dp->visuals; vp<(dp->visuals + dp->nvisuals); vp++) { + if ((visual_info_mask & VisualIDMask) && + (vp->visualid != visual_info_template->visualid)) continue; + if ((visual_info_mask & VisualClassMask) && + (vp->class != visual_info_template->class)) continue; + if ((visual_info_mask & VisualRedMaskMask) && + (vp->red_mask != visual_info_template->red_mask)) continue; + if ((visual_info_mask & VisualGreenMaskMask) && + (vp->green_mask != visual_info_template->green_mask)) continue; + if ((visual_info_mask & VisualBlueMaskMask) && + (vp->blue_mask != visual_info_template->blue_mask)) continue; + if ((visual_info_mask & VisualColormapSizeMask) && + (vp->map_entries != visual_info_template->colormap_size)) continue; + if ((visual_info_mask & VisualBitsPerRGBMask) && + (vp->bits_per_rgb != visual_info_template->bits_per_rgb)) continue; + + /* YEA!!! WE FOUND A GOOD ONE */ + + if (count+1 > total) + { + XVisualInfo *old_vip_base = vip_base; + total += 10; + if (! (vip_base = Xrealloc(vip_base, + sizeof(XVisualInfo) * total))) { + Xfree(old_vip_base); + UnlockDisplay(dpy); + return (XVisualInfo *) NULL; + } + vip = &vip_base[count]; + } + + count++; + + vip->visual = _XVIDtoVisual(dpy, vp->visualid); + vip->visualid = vp->visualid; + vip->screen = ii; + vip->depth = dp->depth; + vip->class = vp->class; + vip->red_mask = vp->red_mask; + vip->green_mask = vp->green_mask; + vip->blue_mask = vp->blue_mask; + vip->colormap_size = vp->map_entries; + vip->bits_per_rgb = vp->bits_per_rgb; + + vip++; + + } /* END OF LOOP ON VISUALS */ + } /* END OF IF THERE ARE ANY VISUALS AT THIS DEPTH */ + + } /* END OF LOOP ON DEPTHS */ + + } /* END OF LOOP ON SCREENS */ + + UnlockDisplay(dpy); + + if (count) + { + *nitems = count; + return vip_base; + } + + Xfree(vip_base); + *nitems = 0; + return NULL; +} + + +/* + * This procedure will return the visual information for a visual + * that matches the specified depth and class for a screen. Since + * multiple visuals may exist that match the specified depth and + * class, which visual chosen is undefined. + * + * If a visual is found, True is returned as the function value, + * otherwise False is returned. + */ + +Status XMatchVisualInfo( + Display *dpy, + int screen, + int depth, + int class, + XVisualInfo *visual_info) /* RETURNED */ +{ + + Visual *vp; + Depth *dp; + Screen *sp; + int ii,jj; + + if (screen < 0 || screen >= dpy->nscreens) + return False; + + LockDisplay(dpy); + + sp = (Screen *)(&dpy->screens[screen]); + + dp = sp->depths; + + for (ii=0; ii < sp->ndepths; ii++) + { + + /* LOOK THROUGH DEPTHS FOR THE WANTED DEPTH */ + + if (dp->depth == depth) + { + vp = dp->visuals; + + /* LOOK THROUGH VISUALS FOR THE WANTED CLASS */ + + /* if nvisuals == 0 then vp will be NULL */ + for (jj=0; jjnvisuals; jj++) + { + if (vp->class == class) + { + visual_info->visual = _XVIDtoVisual(dpy, vp->visualid); + visual_info->visualid = vp->visualid; + visual_info->screen = screen; + visual_info->depth = depth; + visual_info->class = vp->class; + visual_info->red_mask = vp->red_mask; + visual_info->green_mask = vp->green_mask; + visual_info->blue_mask = vp->blue_mask; + visual_info->colormap_size = vp->map_entries; + visual_info->bits_per_rgb = vp->bits_per_rgb; + UnlockDisplay(dpy); + return True; + } + vp++; + } + } + + dp++; + + } + + UnlockDisplay(dpy); + + return False; + +} diff --git a/nx-X11/lib/src/WMGeom.c b/nx-X11/lib/src/WMGeom.c new file mode 100644 index 000000000..7947536f5 --- /dev/null +++ b/nx-X11/lib/src/WMGeom.c @@ -0,0 +1,183 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xutil.h" + +static int _GeometryMaskToGravity( + int mask); + +/* + * This routine given a user supplied positional argument and a default + * argument (fully qualified) will return the position the window should take + * as well as the gravity to be set in the WM_NORMAL_HINTS size hints. + * Always sets all return values and returns a mask describing which fields + * were set by the user or'ed with whether or not the x and y values should + * be considered "negative". + */ + +int +XWMGeometry ( + Display *dpy, /* user's display connection */ + int screen, /* screen on which to do computation */ + _Xconst char *user_geom, /* user provided geometry spec */ + _Xconst char *def_geom, /* default geometry spec for window */ + unsigned int bwidth, /* border width */ + XSizeHints *hints, /* usually WM_NORMAL_HINTS */ + int *x_return, /* location of window */ + int *y_return, /* location of window */ + int *width_return, /* size of window */ + int *height_return, /* size of window */ + int *gravity_return) /* gravity of window */ +{ + int ux, uy; /* returned values from parse */ + unsigned int uwidth, uheight; /* returned values from parse */ + int umask; /* parse mask of returned values */ + int dx, dy; /* default values from parse */ + unsigned int dwidth, dheight; /* default values from parse */ + int dmask; /* parse mask of returned values */ + int base_width, base_height; /* valid amounts */ + int min_width, min_height; /* valid amounts */ + int width_inc, height_inc; /* valid amounts */ + int rx, ry, rwidth, rheight; /* return values */ + int rmask; /* return mask */ + + /* + * Get the base sizes and increments. Section 4.1.2.3 of the ICCCM + * states that the base and minimum sizes are defaults for each other. + * If neither is given, then the base sizes should be 0. These parameters + * control the sets of sizes that window managers should allow for the + * window according to the following formulae: + * + * width = base_width + (i * width_inc) + * height = base_height + (j * height_inc) + */ + base_width = ((hints->flags & PBaseSize) ? hints->base_width : + ((hints->flags & PMinSize) ? hints->min_width : 0)); + base_height = ((hints->flags & PBaseSize) ? hints->base_height : + ((hints->flags & PMinSize) ? hints->min_height : 0)); + min_width = ((hints->flags & PMinSize) ? hints->min_width : base_width); + min_height = ((hints->flags & PMinSize) ? hints->min_height : base_height); + width_inc = (hints->flags & PResizeInc) ? hints->width_inc : 1; + height_inc = (hints->flags & PResizeInc) ? hints->height_inc : 1; + + + /* + * parse the two geometry masks + */ + rmask = umask = XParseGeometry (user_geom, &ux, &uy, &uwidth, &uheight); + dmask = XParseGeometry (def_geom, &dx, &dy, &dwidth, &dheight); + + + /* + * get the width and height: + * 1. if user-specified, then take that value + * 2. else, if program-specified, then take that value + * 3. else, take 1 + * 4. multiply by the size increment + * 5. and add to the base size + */ + rwidth = ((((umask & WidthValue) ? uwidth : + ((dmask & WidthValue) ? dwidth : 1)) * width_inc) + + base_width); + rheight = ((((umask & HeightValue) ? uheight : + ((dmask & HeightValue) ? dheight : 1)) * height_inc) + + base_height); + + /* + * Make sure computed size is within limits. Note that we always do the + * lower bounds check since the base size (which defaults to 0) should + * be used if a minimum size isn't specified. + */ + if (rwidth < min_width) rwidth = min_width; + if (rheight < min_height) rheight = min_height; + + if (hints->flags & PMaxSize) { + if (rwidth > hints->max_width) rwidth = hints->max_width; + if (rheight > hints->max_height) rheight = hints->max_height; + } + + + /* + * Compute the location. Set the negative flags in the return mask + * (and watch out for borders), if necessary. + */ + if (umask & XValue) { + rx = ((umask & XNegative) ? + (DisplayWidth (dpy, screen) + ux - rwidth - 2 * bwidth) : ux); + } else if (dmask & XValue) { + if (dmask & XNegative) { + rx = (DisplayWidth (dpy, screen) + dx - rwidth - 2 * bwidth); + rmask |= XNegative; + } else + rx = dx; + } else { + rx = 0; /* gotta choose something... */ + } + + if (umask & YValue) { + ry = ((umask & YNegative) ? + (DisplayHeight(dpy, screen) + uy - rheight - 2 * bwidth) : uy); + } else if (dmask & YValue) { + if (dmask & YNegative) { + ry = (DisplayHeight(dpy, screen) + dy - rheight - 2 * bwidth); + rmask |= YNegative; + } else + ry = dy; + } else { + ry = 0; /* gotta choose something... */ + } + + + /* + * All finished, so set the return variables. + */ + *x_return = rx; + *y_return = ry; + *width_return = rwidth; + *height_return = rheight; + *gravity_return = _GeometryMaskToGravity (rmask); + return rmask; +} + + +static int _GeometryMaskToGravity( + int mask) +{ + switch (mask & (XNegative|YNegative)) { + case 0: + return NorthWestGravity; + case XNegative: + return NorthEastGravity; + case YNegative: + return SouthWestGravity; + default: + return SouthEastGravity; + } +} diff --git a/nx-X11/lib/src/WMProps.c b/nx-X11/lib/src/WMProps.c new file mode 100644 index 000000000..e77f7ba56 --- /dev/null +++ b/nx-X11/lib/src/WMProps.c @@ -0,0 +1,139 @@ +/* + +Copyright 1987, 1988, 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., +Copyright 1987 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, +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 Wyse not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +******************************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + + +/* + * XSetWMProperties sets the following properties: + * WM_NAME type: TEXT format: varies? + * WM_ICON_NAME type: TEXT format: varies? + * WM_HINTS type: WM_HINTS format: 32 + * WM_COMMAND type: TEXT format: varies? + * WM_CLIENT_MACHINE type: TEXT format: varies? + * WM_NORMAL_HINTS type: WM_SIZE_HINTS format: 32 + * WM_CLASS type: STRING/STRING format: 8 + * WM_LOCALE_NAME type: STRING format: 8 + */ + +void XSetWMProperties ( + Display *dpy, + Window w, /* window to decorate */ + XTextProperty *windowName, /* name of application */ + XTextProperty *iconName, /* name string for icon */ + char **argv, /* command line */ + int argc, /* size of command line */ + XSizeHints *sizeHints, /* size hints for window in its normal state */ + XWMHints *wmHints, /* miscelaneous window manager hints */ + XClassHint *classHints) /* resource name and class */ +{ + XTextProperty textprop; + char hostName[256]; + int len = _XGetHostname (hostName, sizeof hostName); + char *locale; + + /* set names of window and icon */ + if (windowName) XSetWMName (dpy, w, windowName); + if (iconName) XSetWMIconName (dpy, w, iconName); + + /* set the command if given */ + if (argv) { + /* + * for UNIX and other operating systems which use nul-terminated + * arrays of STRINGs. + */ + XSetCommand (dpy, w, argv, argc); + } + + /* set the name of the machine on which this application is running */ + textprop.value = (unsigned char *) hostName; + textprop.encoding = XA_STRING; + textprop.format = 8; + textprop.nitems = len; + XSetWMClientMachine (dpy, w, &textprop); + + /* set hints about how geometry and window manager interaction */ + if (sizeHints) XSetWMNormalHints (dpy, w, sizeHints); + if (wmHints) XSetWMHints (dpy, w, wmHints); + if (classHints) { + XClassHint tmp; + + if (!classHints->res_name) { + tmp.res_name = getenv ("RESOURCE_NAME"); + if (!tmp.res_name && argv && argv[0]) { + /* + * UNIX uses /dir/subdir/.../basename; other operating + * systems will have to change this. + */ + char *cp = strrchr (argv[0], '/'); + tmp.res_name = (cp ? cp + 1 : argv[0]); + } + tmp.res_class = classHints->res_class; + classHints = &tmp; + } + XSetClassHint (dpy, w, classHints); + } + + locale = setlocale(LC_CTYPE, (char *)NULL); + if (locale) + XChangeProperty (dpy, w, XInternAtom(dpy, "WM_LOCALE_NAME", False), + XA_STRING, 8, PropModeReplace, + (unsigned char *)locale, strlen(locale)); +} + diff --git a/nx-X11/lib/src/WarpPtr.c b/nx-X11/lib/src/WarpPtr.c new file mode 100644 index 000000000..c88ca4704 --- /dev/null +++ b/nx-X11/lib/src/WarpPtr.c @@ -0,0 +1,60 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +int +XWarpPointer( + register Display *dpy, + Window src_win, + Window dest_win, + int src_x, + int src_y, + unsigned int src_width, + unsigned int src_height, + int dest_x, + int dest_y) +{ + register xWarpPointerReq *req; + + LockDisplay(dpy); + GetReq(WarpPointer, req); + req->srcWid = src_win; + req->dstWid = dest_win; + req->srcX = src_x; + req->srcY = src_y; + req->srcWidth = src_width; + req->srcHeight = src_height; + req->dstX = dest_x; + req->dstY = dest_y; + UnlockDisplay(dpy); + SyncHandle(); + return 1; +} + diff --git a/nx-X11/lib/src/WinEvent.c b/nx-X11/lib/src/WinEvent.c new file mode 100644 index 000000000..48801b739 --- /dev/null +++ b/nx-X11/lib/src/WinEvent.c @@ -0,0 +1,90 @@ +/* + +Copyright 1985, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +extern long const _Xevent_to_mask[]; +#define AllPointers (PointerMotionMask|PointerMotionHintMask|ButtonMotionMask) +#define AllButtons (Button1MotionMask|Button2MotionMask|Button3MotionMask|\ + Button4MotionMask|Button5MotionMask) + +/* + * Return the next event in the queue + * for the given window matching one of the events in the mask. + * Events earlier in the queue are not discarded. + * If none found, flush, and then wait until an event arrives which + * matches. + */ + +int +XWindowEvent ( + register Display *dpy, + Window w, /* Selected window. */ + long mask, /* Selected event mask. */ + register XEvent *event) /* XEvent to be filled in. */ +{ + register _XQEvent *prev, *qelt; + unsigned long qe_serial = 0; + + LockDisplay(dpy); + + /* Delete unclaimed cookies */ + _XFreeEventCookies(dpy); + + prev = NULL; + while (1) { + for (qelt = prev ? prev->next : dpy->head; + qelt; + prev = qelt, qelt = qelt->next) { + if ((qelt->event.xany.window == w) && + (qelt->event.type < GenericEvent) && + (_Xevent_to_mask[qelt->event.type] & mask) && + ((qelt->event.type != MotionNotify) || + (mask & AllPointers) || + (mask & AllButtons & qelt->event.xmotion.state))) { + *event = qelt->event; + _XDeq(dpy, prev, qelt); + UnlockDisplay(dpy); + return 0; + } + } + if (prev) + qe_serial = prev->qserial_num; + _XReadEvents(dpy); + if (prev && prev->qserial_num != qe_serial) + /* another thread has snatched this event */ + prev = NULL; +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockDisplay(dpy); + return 0; + } +#endif + } +} diff --git a/nx-X11/lib/src/Window.c b/nx-X11/lib/src/Window.c new file mode 100644 index 000000000..85a28f372 --- /dev/null +++ b/nx-X11/lib/src/Window.c @@ -0,0 +1,140 @@ +/* + +Copyright 1986, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" + +void _XProcessWindowAttributes ( + register Display *dpy, + xChangeWindowAttributesReq *req, + register unsigned long valuemask, + register XSetWindowAttributes *attributes) +{ + unsigned long values[32]; + register unsigned long *value = values; + unsigned int nvalues; + + if (valuemask & CWBackPixmap) + *value++ = attributes->background_pixmap; + + if (valuemask & CWBackPixel) + *value++ = attributes->background_pixel; + + if (valuemask & CWBorderPixmap) + *value++ = attributes->border_pixmap; + + if (valuemask & CWBorderPixel) + *value++ = attributes->border_pixel; + + if (valuemask & CWBitGravity) + *value++ = attributes->bit_gravity; + + if (valuemask & CWWinGravity) + *value++ = attributes->win_gravity; + + if (valuemask & CWBackingStore) + *value++ = attributes->backing_store; + + if (valuemask & CWBackingPlanes) + *value++ = attributes->backing_planes; + + if (valuemask & CWBackingPixel) + *value++ = attributes->backing_pixel; + + if (valuemask & CWOverrideRedirect) + *value++ = attributes->override_redirect; + + if (valuemask & CWSaveUnder) + *value++ = attributes->save_under; + + if (valuemask & CWEventMask) + *value++ = attributes->event_mask; + + if (valuemask & CWDontPropagate) + *value++ = attributes->do_not_propagate_mask; + + if (valuemask & CWColormap) + *value++ = attributes->colormap; + + if (valuemask & CWCursor) + *value++ = attributes->cursor; + + req->length += (nvalues = value - values); + + nvalues <<= 2; /* watch out for macros... */ + Data32 (dpy, (long *) values, (long)nvalues); + +} + +#define AllMaskBits (CWBackPixmap|CWBackPixel|CWBorderPixmap|\ + CWBorderPixel|CWBitGravity|CWWinGravity|\ + CWBackingStore|CWBackingPlanes|CWBackingPixel|\ + CWOverrideRedirect|CWSaveUnder|CWEventMask|\ + CWDontPropagate|CWColormap|CWCursor) + +Window XCreateWindow( + register Display *dpy, + Window parent, + int x, + int y, + unsigned int width, + unsigned int height, + unsigned int borderWidth, + int depth, + unsigned int class, + Visual *visual, + unsigned long valuemask, + XSetWindowAttributes *attributes) +{ + Window wid; + register xCreateWindowReq *req; + + LockDisplay(dpy); + GetReq(CreateWindow, req); + req->parent = parent; + req->x = x; + req->y = y; + req->width = width; + req->height = height; + req->borderWidth = borderWidth; + req->depth = depth; + req->class = class; + if (visual == CopyFromParent) + req->visual = CopyFromParent; + else + req->visual = visual->visualid; + wid = req->wid = XAllocID(dpy); + valuemask &= AllMaskBits; + if ((req->mask = valuemask)) + _XProcessWindowAttributes (dpy, (xChangeWindowAttributesReq *)req, + valuemask, attributes); + UnlockDisplay(dpy); + SyncHandle(); + return (wid); + } + diff --git a/nx-X11/lib/src/Withdraw.c b/nx-X11/lib/src/Withdraw.c new file mode 100644 index 000000000..9c2280234 --- /dev/null +++ b/nx-X11/lib/src/Withdraw.c @@ -0,0 +1,84 @@ + +/*********************************************************** +Copyright 1988 by Wyse Technology, Inc., San Jose, Ca., + + All Rights Reserved + +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 +supporting documentation, and that the name Wyse not be +used in advertising or publicity pertaining to distribution of the +software without specific, written prior permission. + +WYSE DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING +ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL +DIGITAL 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. + +******************************************************************/ +/* + +Copyright 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include +#include + +/* + * This function instructs the window manager to change this window from + * NormalState or IconicState to Withdrawn. + */ +Status XWithdrawWindow ( + Display *dpy, + Window w, + int screen) +{ + XUnmapWindow (dpy, w); + + { + Window root = RootWindow (dpy, screen); + XUnmapEvent ev = { + .type = UnmapNotify, + .event = root, + .window = w, + .from_configure = False + }; + return (XSendEvent (dpy, root, False, + SubstructureRedirectMask|SubstructureNotifyMask, + (XEvent *)&ev)); + } +} diff --git a/nx-X11/lib/src/WrBitF.c b/nx-X11/lib/src/WrBitF.c new file mode 100644 index 000000000..47b47208f --- /dev/null +++ b/nx-X11/lib/src/WrBitF.c @@ -0,0 +1,153 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "Xutil.h" +#include + +#define ERR_RETURN NULL + +static char *Format_Image( + XImage *image, + int *resultsize) +{ + register int x, c, b; + register char *ptr; + int y; + char *data; + int width, height; + int bytes_per_line; + + width = image->width; + height = image->height; + + bytes_per_line = (width+7)/8; + *resultsize = bytes_per_line * height; /* Calculate size of data */ + + data = Xmalloc( *resultsize ); /* Get space for data */ + if (!data) + return(ERR_RETURN); + + /* + * The slow but robust brute force method of converting the image: + */ + ptr = data; + c = 0; b=1; + for (y=0; y +#include + +/* IntAtom.c */ + +#define TABLESIZE 64 + +typedef struct _Entry { + unsigned long sig; + Atom atom; +} EntryRec, *Entry; + +#define RESERVED ((Entry) 1) + +#define EntryName(e) ((char *)(e+1)) + +typedef struct _XDisplayAtoms { + Entry table[TABLESIZE]; +} AtomTable; + +_XFUNCPROTOBEGIN + +extern void _XUpdateAtomCache(Display *dpy, const char *name, Atom atom, + unsigned long sig, int idx, int n); +extern void _XFreeAtomTable(Display *dpy); + +_XFUNCPROTOEND + +#endif /* _XINTATOM_H_ */ diff --git a/nx-X11/lib/src/Xintconn.h b/nx-X11/lib/src/Xintconn.h new file mode 100644 index 000000000..675f684ac --- /dev/null +++ b/nx-X11/lib/src/Xintconn.h @@ -0,0 +1,38 @@ + +#ifndef _XINTCONN_H_ +#define _XINTCONN_H_ 1 + +#include +#include + +_XFUNCPROTOBEGIN + +#if !USE_XCB +/* ConnDis.c */ + +int _XConnectDisplay ( + char *display_name, + char **fullnamep, /* RETURN */ + int *dpynump, /* RETURN */ + int *screenp, /* RETURN */ + char **auth_namep, /* RETURN */ + int *auth_namelenp, /* RETURN */ + char **auth_datap, /* RETURN */ + int *auth_datalenp); /* RETURN */ +extern int _XDisconnectDisplay(XtransConnInfo trans_conn); +extern Bool _XSendClientPrefix(Display *dpy, xConnClientPrefix *client, + char *auth_proto, char *auth_string, + xConnSetupPrefix *prefix); +extern XtransConnInfo _X11TransConnectDisplay(char *display_name, + char **fullnamep, int *dpynump, + int *screenp, char **auth_namep, + int *auth_namelenp, char **auth_datap, + int *auth_datalenp); +#endif /* !USE_XCB */ + +/* OpenDis.c */ +extern void _XFreeDisplayStructure(Display *dpy); + +_XFUNCPROTOEND + +#endif /* _XINTCONN_H_ */ diff --git a/nx-X11/lib/src/XlibAsync.c b/nx-X11/lib/src/XlibAsync.c new file mode 100644 index 000000000..2e528d8b1 --- /dev/null +++ b/nx-X11/lib/src/XlibAsync.c @@ -0,0 +1,182 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* nx-X11, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include + +/*ARGSUSED*/ +Bool +_XAsyncErrorHandler( + register Display *dpy, + register xReply *rep, + char *buf, + int len, + XPointer data) +{ + register _XAsyncErrorState *state; + + state = (_XAsyncErrorState *)data; + if (rep->generic.type == X_Error && + (!state->error_code || + rep->error.errorCode == state->error_code) && + (!state->major_opcode || + rep->error.majorCode == state->major_opcode) && + (!state->minor_opcode || + rep->error.minorCode == state->minor_opcode) && + (!state->min_sequence_number || + (state->min_sequence_number <= dpy->last_request_read)) && + (!state->max_sequence_number || + (state->max_sequence_number >= dpy->last_request_read))) { + state->last_error_received = rep->error.errorCode; + state->error_count++; + return True; + } + return False; +} + +void _XDeqAsyncHandler( + Display *dpy, + register _XAsyncHandler *handler) +{ + register _XAsyncHandler **prev; + register _XAsyncHandler *async; + + for (prev = &dpy->async_handlers; + (async = *prev) && (async != handler); + prev = &async->next) + ; + if (async) + *prev = async->next; +} + +char * +_XGetAsyncReply( + register Display *dpy, + register char *replbuf, /* data is read into this buffer */ + register xReply *rep, /* value passed to calling handler */ + char *buf, /* value passed to calling handler */ + int len, /* value passed to calling handler */ + int extra, /* extra words to read, ala _XReply */ + Bool discard) /* discard after extra?, ala _XReply */ +{ + if (extra == 0) { + if (discard && (rep->generic.length << 2) > len) + _XEatData (dpy, (rep->generic.length << 2) - len); + return (char *)rep; + } + + if (extra <= rep->generic.length) { + int size = SIZEOF(xReply) + (extra << 2); + if (size > len) { + memcpy(replbuf, buf, len); + _XRead(dpy, replbuf + len, size - len); + buf = replbuf; + len = size; + } + + if (discard && rep->generic.length > extra && + (rep->generic.length << 2) > len) + _XEatData (dpy, (rep->generic.length << 2) - len); + + return buf; + } + /* + *if we get here, then extra > rep->generic.length--meaning we + * read a reply that's shorter than we expected. This is an + * error, but we still need to figure out how to handle it... + */ + if ((rep->generic.length << 2) > len) + _XEatData (dpy, (rep->generic.length << 2) - len); +#ifdef NX_TRANS_SOCKET + + /* + * The original code has provision + * for returning already. + */ + +#endif + _XIOError (dpy); + return (char *)rep; +} + +void +_XGetAsyncData( + Display *dpy, + char *data, /* data is read into this buffer */ + char *buf, /* value passed to calling handler */ + int len, /* value passed to calling handler */ + int skip, /* number of bytes already read in previous + _XGetAsyncReply or _XGetAsyncData calls */ + int datalen, /* size of data buffer in bytes */ + int discardtotal) /* min. bytes to consume (after skip) */ +{ + buf += skip; + len -= skip; + if (!data) { + if (datalen > len) + _XEatData(dpy, datalen - len); + } else if (datalen <= len) { + memcpy(data, buf, datalen); + } else { + memcpy(data, buf, len); + _XRead(dpy, data + len, datalen - len); + } + if (discardtotal > len) { + if (datalen > len) + len = datalen; + _XEatData(dpy, discardtotal - len); + } +} diff --git a/nx-X11/lib/src/XlibInt.c b/nx-X11/lib/src/XlibInt.c new file mode 100644 index 000000000..5afc65149 --- /dev/null +++ b/nx-X11/lib/src/XlibInt.c @@ -0,0 +1,4199 @@ +/**************************************************************************/ +/* */ +/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ +/* Copyright (c) 2008-2014 Oleksandr Shneyder */ +/* Copyright (c) 2011-2016 Mike Gabriel */ +/* Copyright (c) 2014-2016 Mihai Moldovan */ +/* Copyright (c) 2014-2016 Ulrich Sibiller */ +/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ +/* */ +/* nx-X11, NX protocol compression and NX extensions to this software */ +/* are copyright of the aforementioned persons and companies. */ +/* */ +/* Redistribution and use of the present software is allowed according */ +/* to terms specified in the file LICENSE which comes in the source */ +/* distribution. */ +/* */ +/* All rights reserved. */ +/* */ +/* NOTE: This software has received contributions from various other */ +/* contributors, only the core maintainers and supporters are listed as */ +/* copyright holders. Please contact us, if you feel you should be listed */ +/* as copyright holder, as well. */ +/* */ +/**************************************************************************/ + +/* + +Copyright 1985, 1986, 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * XlibInt.c - Internal support routines for the C subroutine + * interface library (Xlib) to the X Window System Protocol V11.0. + */ + +#ifdef WIN32 +#define _XLIBINT_ +#endif +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xprivate.h" +#include +#if !USE_XCB +#include +#include +#endif /* !USE_XCB */ +#include +#include +#ifdef WIN32 +#include +#endif + +#ifdef XTHREADS +#include "locking.h" + +/* these pointers get initialized by XInitThreads */ +LockInfoPtr _Xglobal_lock = NULL; +void (*_XCreateMutex_fn)(LockInfoPtr) = NULL; +/* struct _XCVList *(*_XCreateCVL_fn)() = NULL; */ +void (*_XFreeMutex_fn)(LockInfoPtr) = NULL; +void (*_XLockMutex_fn)( + LockInfoPtr /* lock */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char * /* file */ + , int /* line */ +#endif + ) = NULL; +void (*_XUnlockMutex_fn)( + LockInfoPtr /* lock */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char * /* file */ + , int /* line */ +#endif + ) = NULL; +xthread_t (*_Xthread_self_fn)(void) = NULL; + +#define XThread_Self() ((*_Xthread_self_fn)()) + +#if !USE_XCB +#define UnlockNextReplyReader(d) if ((d)->lock) \ + (*(d)->lock->pop_reader)((d),&(d)->lock->reply_awaiters,&(d)->lock->reply_awaiters_tail) + +#define QueueReplyReaderLock(d) ((d)->lock ? \ + (*(d)->lock->push_reader)(d,&(d)->lock->reply_awaiters_tail) : NULL) +#define QueueEventReaderLock(d) ((d)->lock ? \ + (*(d)->lock->push_reader)(d,&(d)->lock->event_awaiters_tail) : NULL) +#endif /* !USE_XCB */ + +#else /* XTHREADS else */ + +#if !USE_XCB +#define UnlockNextReplyReader(d) +#define UnlockNextEventReader(d) +#endif /* !USE_XCB */ + +#endif /* XTHREADS else */ + +#ifdef NX_TRANS_SOCKET + +#include +#include + +static struct timeval retry; + +/* + * From Xtranssock.c. Presently the congestion state + * is reported by the proxy to the application, by + * invoking the callback directly. The function will + * be possibly used in the future, to be able to track + * the bandwidth usage even when the NX transport is + * not running. Note that in this sample implementation + * the congestion state is checked very often and can + * be surely optimized. + */ + +#ifdef NX_TRANS_CHANGE +extern int _X11TransSocketCongestionChange(XtransConnInfo, int *); +#endif + +#endif /* #ifdef NX_TRANS_SOCKET */ + +/* check for both EAGAIN and EWOULDBLOCK, because some supposedly POSIX + * systems are broken and return EWOULDBLOCK when they should return EAGAIN + */ +#ifdef WIN32 +#define ETEST() (WSAGetLastError() == WSAEWOULDBLOCK) +#else +#ifdef __CYGWIN__ /* Cygwin uses ENOBUFS to signal socket is full */ +#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK || errno == ENOBUFS) +#else +#if defined(EAGAIN) && defined(EWOULDBLOCK) +#define ETEST() (errno == EAGAIN || errno == EWOULDBLOCK) +#else +#ifdef EAGAIN +#define ETEST() (errno == EAGAIN) +#else +#define ETEST() (errno == EWOULDBLOCK) +#endif /* EAGAIN */ +#endif /* EAGAIN && EWOULDBLOCK */ +#endif /* __CYGWIN__ */ +#endif /* WIN32 */ + +#ifdef WIN32 +#define ECHECK(err) (WSAGetLastError() == err) +#define ESET(val) WSASetLastError(val) +#else +#define ECHECK(err) (errno == err) +#define ESET(val) errno = val +#endif + +#if defined(LOCALCONN) || defined(LACHMAN) +#ifdef EMSGSIZE +#define ESZTEST() (ECHECK(EMSGSIZE) || ECHECK(ERANGE)) +#else +#define ESZTEST() ECHECK(ERANGE) +#endif +#else +#ifdef EMSGSIZE +#define ESZTEST() ECHECK(EMSGSIZE) +#endif +#endif + +#if !USE_XCB + +#define STARTITERATE(tpvar,type,start,endcond) \ + for (tpvar = (type *) (start); endcond; ) +#define ITERPTR(tpvar) (char *)tpvar +#define RESETITERPTR(tpvar,type,start) tpvar = (type *) (start) +#define INCITERPTR(tpvar,type) tpvar++ +#define ENDITERATE + + +typedef union { + xReply rep; + char buf[BUFSIZE]; +} _XAlignedBuffer; + +static char *_XAsyncReply( + Display *dpy, + register xReply *rep, + char *buf, + register int *lenp, + Bool discard); +#endif /* !USE_XCB */ + +/* + * The following routines are internal routines used by Xlib for protocol + * packet transmission and reception. + * + * _XIOError(Display *) will be called if any sort of system call error occurs. + * This is assumed to be a fatal condition, i.e., XIOError should not return. + * + * _XError(Display *, xError *) will be called whenever an X_Error event is + * received. This is not assumed to be a fatal condition, i.e., it is + * acceptable for this procedure to return. However, XError should NOT + * perform any operations (directly or indirectly) on the DISPLAY. + * + * Routines declared with a return type of 'Status' return 0 on failure, + * and non 0 on success. Routines with no declared return type don't + * return anything. Whenever possible routines that create objects return + * the object they have created. + */ + +#if !USE_XCB +static xReq _dummy_request = { + 0, 0, 0 +}; + +#ifdef NX_TRANS_SOCKET + +/* + * Replace the standard Select with a version giving NX a + * chance to check its own descriptors. This doesn't cover + * the cases where the system is using poll or when system- + * specific defines override the Select definition (OS/2). + */ + +int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) +{ +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XSelect: Called with [%d][%p][%p][%p][%p].\n", + maxfds, (void *) readfds, (void *) writefds, (void *) exceptfds, + (void *) timeout); +#endif + + if (NXTransRunning(NX_FD_ANY)) + { + fd_set t_readfds, t_writefds; + struct timeval t_timeout; + + int n, r, e; + +#ifdef NX_TRANS_TEST + + if (exceptfds != NULL) + { + fprintf(stderr, "_XSelect: WARNING! Can't handle exception fds in select.\n"); + } + +#endif + + if (readfds == NULL) + { + FD_ZERO(&t_readfds); + + readfds = &t_readfds; + } + + if (writefds == NULL) + { + FD_ZERO(&t_writefds); + + writefds = &t_writefds; + } + + if (timeout == NULL) + { + t_timeout.tv_sec = 10; + t_timeout.tv_usec = 0; + + timeout = &t_timeout; + } + + n = maxfds; + + /* + * If the transport is gone avoid + * sleeping until the timeout. + */ + + if (NXTransPrepare(&n, readfds, writefds, timeout) != 0) + { + NXTransSelect(&r, &e, &n, readfds, writefds, timeout); + + NXTransExecute(&r, &e, &n, readfds, writefds, timeout); + + errno = e; + + return r; + } + else + { + return 0; + } + } + else + { + return select(maxfds, readfds, writefds, exceptfds, timeout); + } +} + +#else /* #ifdef NX_TRANS_SOCKET */ + +int _XSelect(int maxfds, fd_set *readfds, fd_set *writefds, + fd_set *exceptfds, struct timeval *timeout) +{ + return select(maxfds, readfds, writefds, exceptfds, timeout); +} + +#endif /* #ifdef NX_TRANS_SOCKET */ + +/* + * This is an OS dependent routine which: + * 1) returns as soon as the connection can be written on.... + * 2) if the connection can be read, must enqueue events and handle errors, + * until the connection is writable. + */ +static void +_XWaitForWritable( + Display *dpy +#ifdef XTHREADS + , + xcondition_t cv /* our reading condition variable */ +#endif + ) +{ +#ifdef USE_POLL + struct pollfd filedes; +#else + fd_set r_mask; + fd_set w_mask; +#endif + int nfound; + +#ifdef NX_TRANS_SOCKET +#if defined(NX_TRANS_CHANGE) + int congestion; +#endif + if (_XGetIOError(dpy)) { + return; + } +#endif + +#ifdef USE_POLL + filedes.fd = dpy->fd; + filedes.events = 0; +#else + FD_ZERO(&r_mask); + FD_ZERO(&w_mask); +#endif + + for (;;) { +#ifdef XTHREADS + /* We allow only one thread at a time to read, to minimize + passing of read data between threads. + Now, who is it? If there is a non-NULL reply_awaiters and + we (i.e., our cv) are not at the head of it, then whoever + is at the head is the reader, and we don't read. + Otherwise there is no reply_awaiters or we are at the + head, having just appended ourselves. + In this case, if there is a event_awaiters, then whoever + is at the head of it got there before we did, and they are the + reader. + + Last cases: no event_awaiters and we are at the head of + reply_awaiters or reply_awaiters is NULL: we are the reader, + since there is obviously no one else involved. + + XXX - what if cv is NULL and someone else comes along after + us while we are waiting? + */ + + if (!dpy->lock || + (!dpy->lock->event_awaiters && + (!dpy->lock->reply_awaiters || + dpy->lock->reply_awaiters->cv == cv))) +#endif + +#ifndef NX_TRANS_SOCKET +#ifdef USE_POLL + filedes.events = POLLIN; + filedes.events |= POLLOUT; +#else + FD_SET(dpy->fd, &r_mask); + FD_SET(dpy->fd, &w_mask); +#endif +#endif /* #ifndef NX_TRANS_SOCKET */ + + do { +#ifdef NX_TRANS_SOCKET + /* + * Give a chance to the registered client to perform + * any needed operation before entering the select. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XWaitForWritable: WAIT! Waiting for the display to become writable.\n"); +#endif + NXTransFlush(dpy->fd); + + if (_NXDisplayBlockFunction != NULL) { + (*_NXDisplayBlockFunction)(dpy, NXBlockWrite); + } + + /* + * Need to set again the descriptors as we could have + * run multiple selects before having the possibility + * to read or write to the X connection. + */ + +#ifdef USE_POLL + filedes.events = POLLIN; + filedes.events |= POLLOUT; +#else + FD_SET(dpy->fd, &r_mask); + FD_SET(dpy->fd, &w_mask); +#endif +#endif /* #ifdef NX_TRANS_SOCKET */ + UnlockDisplay(dpy); +#ifdef USE_POLL +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XWaitForWritable: Calling poll().\n"); +#endif + nfound = poll (&filedes, 1, -1); +#else /* USE_POLL */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XWaitForWritable: Calling select() after [%ld] ms.\n", + NXTransTime()); +#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ +#ifdef NX_TRANS_SOCKET + /* + * Give a chance to the callback to detect + * the failure of the display even if we + * miss the interrupt inside the select. + */ + + if (_NXDisplayErrorFunction != NULL) { + retry.tv_sec = 5; + retry.tv_usec = 0; + nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, &retry); + } else { + nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); + } +#else /* NX_TRANS_SOCKET */ + nfound = Select (dpy->fd + 1, &r_mask, &w_mask, NULL, NULL); +#endif /* NX_TRANS_SOCKET */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XWaitForWritable: Out of select() with [%d] after [%ld] ms.\n", + nfound, NXTransTime()); + + if (FD_ISSET(dpy->fd, &r_mask)) + { + BytesReadable_t pend; + + _X11TransBytesReadable(dpy->trans_conn, &pend); + + fprintf(stderr, "_XWaitForWritable: Descriptor [%d] is ready with [%ld] bytes to read.\n", + dpy->fd, pend); + } + + if (FD_ISSET(dpy->fd, &w_mask)) + { + fprintf(stderr, "_XWaitForWritable: Descriptor [%d] has become writable.\n\n", + dpy->fd); + } +#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) */ +#endif /* USE_POLL */ + InternalLockDisplay(dpy, cv != NULL); +#ifdef NX_TRANS_SOCKET +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } +#endif /* defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) */ + if (nfound <= 0) { + if ((nfound == -1 && !(ECHECK(EINTR) || ETEST())) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return; + } + } +#else /* NX_TRANS_SOCKET */ + if (nfound < 0 && !(ECHECK(EINTR) || ETEST())) + _XIOError(dpy); +#endif /* NX_TRANS_SOCKET */ + } while (nfound <= 0); + + if ( +#ifdef USE_POLL + filedes.revents & POLLIN +#else /* USE_POLL */ + FD_ISSET(dpy->fd, &r_mask) +#endif /* USE_POLL */ + ) + { + _XAlignedBuffer buf; + BytesReadable_t pend; + register int len; + register xReply *rep; + + /* find out how much data can be read */ + if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) +#ifdef NX_TRANS_SOCKET + { + _XIOError(dpy); + + return; + } +#else /* NX_TRANS_SOCKET */ + _XIOError(dpy); +#endif /* NX_TRANS_SOCKET */ + len = pend; + + /* must read at least one xEvent; if none is pending, then + we'll just block waiting for it */ + if (len < SIZEOF(xReply) +#ifdef XTHREADS + || dpy->async_handlers +#endif + ) + len = SIZEOF(xReply); + + /* but we won't read more than the max buffer size */ + if (len > BUFSIZE) len = BUFSIZE; + + /* round down to an integral number of XReps */ + len = (len / SIZEOF(xReply)) * SIZEOF(xReply); + + (void) _XRead (dpy, buf.buf, (long) len); + + STARTITERATE(rep,xReply,buf.buf,len > 0) { + if (rep->generic.type == X_Reply) { + int tmp = len; + RESETITERPTR(rep,xReply, + _XAsyncReply (dpy, rep, + ITERPTR(rep), &tmp, True)); + len = tmp; + pend = len; + } else { + if (rep->generic.type == X_Error) + _XError (dpy, (xError *)rep); + else /* must be an event packet */ + _XEnq (dpy, (xEvent *)rep); + INCITERPTR(rep,xReply); + len -= SIZEOF(xReply); + } + } ENDITERATE +#ifdef XTHREADS + if (dpy->lock && dpy->lock->event_awaiters) + ConditionSignal(dpy, dpy->lock->event_awaiters->cv); +#endif + } +#ifdef USE_POLL + if (filedes.revents & (POLLOUT|POLLHUP|POLLERR)) +#else + if (FD_ISSET(dpy->fd, &w_mask)) +#endif + { +#ifdef XTHREADS + if (dpy->lock) { + ConditionBroadcast(dpy, dpy->lock->writers); + } +#endif + return; + } + } +} +#endif /* !USE_XCB */ + + +#define POLLFD_CACHE_SIZE 5 + +/* initialize the struct array passed to poll() below */ +Bool _XPollfdCacheInit( + Display *dpy) +{ +#ifdef USE_POLL + struct pollfd *pfp; + + pfp = Xmalloc(POLLFD_CACHE_SIZE * sizeof(struct pollfd)); + if (!pfp) + return False; + pfp[0].fd = dpy->fd; + pfp[0].events = POLLIN; + + dpy->filedes = (XPointer)pfp; +#endif + return True; +} + +void _XPollfdCacheAdd( + Display *dpy, + int fd) +{ +#ifdef USE_POLL + struct pollfd *pfp = (struct pollfd *)dpy->filedes; + + if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) { + pfp[dpy->im_fd_length].fd = fd; + pfp[dpy->im_fd_length].events = POLLIN; + } +#endif +} + +/* ARGSUSED */ +void _XPollfdCacheDel( + Display *dpy, + int fd) /* not used */ +{ +#ifdef USE_POLL + struct pollfd *pfp = (struct pollfd *)dpy->filedes; + struct _XConnectionInfo *conni; + + /* just recalculate whole list */ + if (dpy->im_fd_length <= POLLFD_CACHE_SIZE) { + int loc = 1; + for (conni = dpy->im_fd_info; conni; conni=conni->next) { + pfp[loc].fd = conni->fd; + pfp[loc].events = POLLIN; + loc++; + } + } +#endif +} + +#if !USE_XCB +/* returns True iff there is an event in the queue newer than serial_num */ + +static Bool +_XNewerQueuedEvent( + Display *dpy, + int serial_num) +{ + _XQEvent *qev; + + if (dpy->next_event_serial_num == serial_num) + return False; + + qev = dpy->head; + while (qev) { + if (qev->qserial_num >= serial_num) { + return True; + } + qev = qev->next; + } + return False; +} + +static int +_XWaitForReadable( + Display *dpy) +{ + int result; + int fd = dpy->fd; + struct _XConnectionInfo *ilist; + register int saved_event_serial = 0; + int in_read_events = 0; + register Bool did_proc_conni = False; +#ifdef USE_POLL + struct pollfd *filedes; +#else + fd_set r_mask; + int highest_fd = fd; +#endif + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + int congestion; +#endif +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + return -1; + } +#endif + +#ifdef USE_POLL + if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE + && !(dpy->flags & XlibDisplayProcConni)) { + /* XXX - this fallback is gross */ + int i; + + filedes = (struct pollfd *)Xmalloc(dpy->im_fd_length * sizeof(struct pollfd)); + filedes[0].fd = fd; + filedes[0].events = POLLIN; + for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) { + filedes[i].fd = ilist->fd; + filedes[i].events = POLLIN; + } + } else { + filedes = (struct pollfd *)dpy->filedes; + } +#else /* USE_POLL */ + FD_ZERO(&r_mask); +#endif /* USE_POLL */ + for (;;) { +#ifndef USE_POLL + FD_SET(fd, &r_mask); + if (!(dpy->flags & XlibDisplayProcConni)) + for (ilist=dpy->im_fd_info; ilist; ilist=ilist->next) { + FD_SET(ilist->fd, &r_mask); + if (ilist->fd > highest_fd) + highest_fd = ilist->fd; + } +#endif /* USE_POLL */ + UnlockDisplay(dpy); +#ifdef USE_POLL +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XWaitForReadable: Calling poll().\n"); +#endif + result = poll(filedes, + (dpy->flags & XlibDisplayProcConni) ? 1 : 1+dpy->im_fd_length, + -1); +#else /* USE_POLL */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XWaitForReadable: Calling select().\n"); +#endif +#ifdef NX_TRANS_SOCKET + /* + * Give a chance to the registered application + * to perform any needed operation. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XWaitForReadable: WAIT! Waiting for the display to become readable.\n"); +#endif + NXTransFlush(dpy->fd); + + if (_NXDisplayBlockFunction != NULL) { + (*_NXDisplayBlockFunction)(dpy, NXBlockRead); + } + + if (_NXDisplayErrorFunction != NULL) { + retry.tv_sec = 5; + retry.tv_usec = 0; + result = Select(highest_fd + 1, &r_mask, NULL, NULL, &retry); + } else { + result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); + } +#else /* NX_TRANS_SOCKET */ + result = Select(highest_fd + 1, &r_mask, NULL, NULL, NULL); +#endif /* NX_TRANS_SOCKET */ +#endif /* USE_POLL */ +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XWaitForReadable: Out of select with result [%d] and errno [%d].\n", + result, (result < 0 ? errno : 0)); +#endif + InternalLockDisplay(dpy, dpy->flags & XlibDisplayReply); +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } +#endif +#ifdef NX_TRANS_SOCKET + if (result <= 0) { + if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return -1; + } + continue; + } +#else + if (result == -1 && !(ECHECK(EINTR) || ETEST())) _XIOError(dpy); + if (result <= 0) + continue; +#endif +#ifdef USE_POLL + if (filedes[0].revents & (POLLIN|POLLHUP|POLLERR)) +#else + if (FD_ISSET(fd, &r_mask)) +#endif + break; + if (!(dpy->flags & XlibDisplayProcConni)) { + int i; + + saved_event_serial = dpy->next_event_serial_num; + /* dpy flags can be clobbered by internal connection callback */ + in_read_events = dpy->flags & XlibDisplayReadEvents; + for (ilist=dpy->im_fd_info, i=1; ilist; ilist=ilist->next, i++) { +#ifdef USE_POLL + if (filedes[i].revents & POLLIN) +#else + if (FD_ISSET(ilist->fd, &r_mask)) +#endif + { + _XProcessInternalConnection(dpy, ilist); + did_proc_conni = True; + } + } +#ifdef USE_POLL + if (dpy->im_fd_length + 1 > POLLFD_CACHE_SIZE) + Xfree(filedes); +#endif + } + if (did_proc_conni) { + /* some internal connection callback might have done an + XPutBackEvent. We notice it here and if we needed an event, + we can return all the way. */ + if (_XNewerQueuedEvent(dpy, saved_event_serial) + && (in_read_events +#ifdef XTHREADS + || (dpy->lock && dpy->lock->event_awaiters) +#endif + )) + return -2; + did_proc_conni = False; + } + } +#ifdef XTHREADS +#ifdef XTHREADS_DEBUG + printf("thread %x _XWaitForReadable returning\n", XThread_Self()); +#endif +#endif + return 0; +} +#endif /* !USE_XCB */ + +static int sync_hazard(Display *dpy) +{ + unsigned long span = dpy->request - dpy->last_request_read; + unsigned long hazard = min((dpy->bufmax - dpy->buffer) / SIZEOF(xReq), 65535 - 10); + return span >= 65535 - hazard - 10; +} + +static +void sync_while_locked(Display *dpy) +{ +#ifdef XTHREADS + if (dpy->lock) + (*dpy->lock->user_lock_display)(dpy); +#endif + UnlockDisplay(dpy); + SyncHandle(); + InternalLockDisplay(dpy, /* don't skip user locks */ 0); +#ifdef XTHREADS + if (dpy->lock) + (*dpy->lock->user_unlock_display)(dpy); +#endif +} + +void _XSeqSyncFunction( + register Display *dpy) +{ + xGetInputFocusReply rep; + _X_UNUSED register xReq *req; + +#ifdef NX_TRANS_SOCKET +#ifdef NX_TRANS_DEBUG + fprintf(stderr, "_XSeqSyncFunction: Going to synchronize the display.\n"); +#endif + + if (dpy->flags & XlibDisplayIOError) + { +#ifdef NX_TRANS_DEBUG + fprintf(stderr, "_XSeqSyncFunction: Returning 0 with I/O error detected.\n"); +#endif + return; + } +#endif /* NX_TRANS_SOCKET */ + if ((dpy->request - dpy->last_request_read) >= (65535 - BUFSIZE/SIZEOF(xReq))) { + GetEmptyReq(GetInputFocus, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + sync_while_locked(dpy); + } else if (sync_hazard(dpy)) + _XSetPrivSyncFunction(dpy); +} + +/* NOTE: only called if !XTHREADS, or when XInitThreads wasn't called. */ +static int +_XPrivSyncFunction (Display *dpy) +{ +#ifdef XTHREADS + assert(!dpy->lock_fns); +#endif + assert(dpy->synchandler == _XPrivSyncFunction); + assert((dpy->flags & XlibDisplayPrivSync) != 0); + dpy->synchandler = dpy->savedsynchandler; + dpy->savedsynchandler = NULL; + dpy->flags &= ~XlibDisplayPrivSync; + if(dpy->synchandler) + dpy->synchandler(dpy); + _XIDHandler(dpy); + _XSeqSyncFunction(dpy); + return 0; +} + +void _XSetPrivSyncFunction(Display *dpy) +{ +#ifdef XTHREADS + if (dpy->lock_fns) + return; +#endif + if (!(dpy->flags & XlibDisplayPrivSync)) { + dpy->savedsynchandler = dpy->synchandler; + dpy->synchandler = _XPrivSyncFunction; + dpy->flags |= XlibDisplayPrivSync; + } +} + +void _XSetSeqSyncFunction(Display *dpy) +{ + if (sync_hazard(dpy)) + _XSetPrivSyncFunction (dpy); +} + +#if !USE_XCB +#ifdef XTHREADS +static void _XFlushInt( + register Display *dpy, + register xcondition_t cv); +#endif + +/* + * _XFlush - Flush the X request buffer. If the buffer is empty, no + * action is taken. This routine correctly handles incremental writes. + * This routine may have to be reworked if int < long. + */ +void _XFlush( + register Display *dpy) +{ +#ifdef XTHREADS + /* With multi-threading we introduce an internal routine to which + we can pass a condition variable to do locking correctly. */ + + _XFlushInt(dpy, NULL); +} + +/* _XFlushInt - Internal version of _XFlush used to do multi-threaded + * locking correctly. + */ + +static void _XFlushInt( + register Display *dpy, + register xcondition_t cv) +{ +#endif /* XTHREADS*/ + register long size, todo; + register int write_stat; + register char *bufindex; + _XExtension *ext; +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + int congestion; +#endif + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XFlushInt: Entering flush with [%d] bytes to write.\n", + (dpy->bufptr - dpy->buffer)); +#endif + /* This fix resets the bufptr to the front of the buffer so + * additional appends to the bufptr will not corrupt memory. Since + * the server is down, these appends are no-op's anyway but + * callers of _XFlush() are not verifying this before they call it. + */ + if (dpy->flags & XlibDisplayIOError) + { +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XFlushInt: Returning with I/O error detected.\n"); +#endif + dpy->bufptr = dpy->buffer; + dpy->last_req = (char *)&_dummy_request; + return; + } + +#ifdef XTHREADS +#ifdef NX_TRANS_SOCKET + while (dpy->flags & XlibDisplayWriting) { + if (_XGetIOError(dpy)) { + return; + } +#else + while (dpy->flags & XlibDisplayWriting) { +#endif + if (dpy->lock) { + ConditionWait(dpy, dpy->lock->writers); + } else { + _XWaitForWritable (dpy, cv); + } + } +#endif + size = todo = dpy->bufptr - dpy->buffer; + if (!size) return; +#ifdef XTHREADS + dpy->flags |= XlibDisplayWriting; + /* make sure no one else can put in data */ + dpy->bufptr = dpy->bufmax; +#endif + for (ext = dpy->flushes; ext; ext = ext->next_flush) + (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, size); + bufindex = dpy->buffer; + /* + * While write has not written the entire buffer, keep looping + * until the entire buffer is written. bufindex will be + * incremented and size decremented as buffer is written out. + */ + while (size) { + ESET(0); + write_stat = _X11TransWrite(dpy->trans_conn, + bufindex, (int) todo); + if (write_stat >= 0) { +#ifdef NX_TRANS_SOCKET + if (_NXDisplayWriteFunction != NULL) { + (*_NXDisplayWriteFunction)(dpy, write_stat); + } +#ifdef NX_TRANS_CHANGE + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } +#endif +#endif + size -= write_stat; + todo = size; + bufindex += write_stat; + } else if (ETEST()) { + _XWaitForWritable(dpy +#ifdef XTHREADS + , cv +#endif + ); +#ifdef SUNSYSV + } else if (ECHECK(0)) { + _XWaitForWritable(dpy +#ifdef XTHREADS + , cv +#endif + ); +#endif +#ifdef ESZTEST + } else if (ESZTEST()) { + if (todo > 1) + todo >>= 1; + else { + _XWaitForWritable(dpy +#ifdef XTHREADS + , cv +#endif + ); + } +#endif +#ifdef NX_TRANS_SOCKET + } else if (!ECHECK(EINTR) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return; + } +#else + } else if (!ECHECK(EINTR)) { + /* Write failed! */ + /* errno set by write system call. */ + _XIOError(dpy); + } +#endif +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + return; + } +#endif + } + dpy->last_req = (char *)&_dummy_request; + _XSetSeqSyncFunction(dpy); + dpy->bufptr = dpy->buffer; +#ifdef XTHREADS + dpy->flags &= ~XlibDisplayWriting; +#endif +} + +int +_XEventsQueued( + register Display *dpy, + int mode) +{ + register int len; + BytesReadable_t pend; + _XAlignedBuffer buf; + register xReply *rep; + char *read_buf; +#ifdef XTHREADS + int entry_event_serial_num; + struct _XCVList *cvl = NULL; + xthread_t self; + +#ifdef XTHREADS_DEBUG + printf("_XEventsQueued called in thread %x\n", XThread_Self()); +#endif +#endif /* XTHREADS*/ + + if (mode == QueuedAfterFlush) + { + _XFlush(dpy); + if (dpy->qlen) + return(dpy->qlen); + } +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + if (dpy->flags & XlibDisplayIOError) { + fprintf(stderr, "_XEventsQueued: Returning [%d] after display failure.\n", + dpy->qlen); + } +#endif + if (dpy->flags & XlibDisplayIOError) return(dpy->qlen); + +#ifdef XTHREADS + /* create our condition variable and append to list, + * unless we were called from within XProcessInternalConnection + * or XLockDisplay + */ + xthread_clear_id(self); + if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) + || xthread_have_id (dpy->lock->locking_thread))) + /* some thread is in XProcessInternalConnection or XLockDisplay + so we have to see if we are it */ + self = XThread_Self(); + if (!xthread_have_id(self) + || (!xthread_equal(self, dpy->lock->conni_thread) + && !xthread_equal(self, dpy->lock->locking_thread))) { + /* In the multi-threaded case, if there is someone else + reading events, then there aren't any available, so + we just return. If we waited we would block. + */ + if (dpy->lock && dpy->lock->event_awaiters) + return dpy->qlen; + /* nobody here but us, so lock out any newcomers */ + cvl = QueueEventReaderLock(dpy); + } + + while (dpy->lock && cvl && dpy->lock->reply_first) { + /* note which events we have already seen so we'll know + if _XReply (in another thread) reads one */ + entry_event_serial_num = dpy->next_event_serial_num; + ConditionWait(dpy, cvl->cv); + /* did _XReply read an event we can return? */ + if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) + { + UnlockNextEventReader(dpy); + return 0; + } + } +#endif /* XTHREADS*/ + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XEventsQueued: Checking bytes readable.\n"); +#endif + if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) +#ifdef NX_TRANS_SOCKET + { + _XIOError(dpy); + + return (dpy->qlen); + } +#else + _XIOError(dpy); +#endif +#ifdef XCONN_CHECK_FREQ + /* This is a crock, required because FIONREAD or equivalent is + * not guaranteed to detect a broken connection. + */ + if (!pend && !dpy->qlen && ++dpy->conn_checker >= XCONN_CHECK_FREQ) + { + int result; +#ifdef USE_POLL + struct pollfd filedes; +#else + fd_set r_mask; + static struct timeval zero_time; +#endif + + dpy->conn_checker = 0; +#ifdef USE_POLL +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XEventsQueued: Calling poll().\n"); +#endif + filedes.fd = dpy->fd; + filedes.events = POLLIN; + if ((result = poll(&filedes, 1, 0))) +#else +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XEventsQueued: Calling select().\n"); +#endif + FD_ZERO(&r_mask); + FD_SET(dpy->fd, &r_mask); + if ((result = Select(dpy->fd + 1, &r_mask, NULL, NULL, &zero_time))) +#endif + { + if (result > 0) + { + if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) +#ifdef NX_TRANS_SOCKET + { + _XIOError(dpy); + + return (dpy->qlen); + } +#else + _XIOError(dpy); +#endif + /* we should not get zero, if we do, force a read */ + if (!pend) + pend = SIZEOF(xReply); + } +#ifdef NX_TRANS_SOCKET + if (result <= 0) { + if ((result == -1 && !(ECHECK(EINTR) || ETEST())) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return (dpy->qlen); + } + } +#else + else if (result < 0 && !(ECHECK(EINTR) || ETEST())) +#endif + _XIOError(dpy); + } + } +#endif /* XCONN_CHECK_FREQ */ + if (!(len = pend)) { + /* _XFlush can enqueue events */ +#ifdef XTHREADS + if (cvl) +#endif + { + UnlockNextEventReader(dpy); + } +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XEventsQueued: Returning [%d].\n", dpy->qlen); +#endif + return(dpy->qlen); + } + /* Force a read if there is not enough data. Otherwise, + * a select() loop at a higher-level will spin undesirably, + * and we've seen at least one OS that appears to not update + * the result from FIONREAD once it has returned nonzero. + */ +#ifdef XTHREADS + if (dpy->lock && dpy->lock->reply_awaiters) { + read_buf = (char *)dpy->lock->reply_awaiters->buf; + len = SIZEOF(xReply); + } else +#endif /* XTHREADS*/ + { + read_buf = buf.buf; + + if (len < SIZEOF(xReply) +#ifdef XTHREADS + || dpy->async_handlers +#endif + ) + len = SIZEOF(xReply); + else if (len > BUFSIZE) + len = BUFSIZE; + len = (len / SIZEOF(xReply)) * SIZEOF(xReply); + } +#ifdef XCONN_CHECK_FREQ + dpy->conn_checker = 0; +#endif + + (void) _XRead (dpy, read_buf, (long) len); + +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + return(dpy->qlen); + } +#endif +#ifdef XTHREADS + /* what did we actually read: reply or event? */ + if (dpy->lock && dpy->lock->reply_awaiters) { + if (((xReply *)read_buf)->generic.type == X_Reply || + ((xReply *)read_buf)->generic.type == X_Error) + { + dpy->lock->reply_was_read = True; + dpy->lock->reply_first = True; + if (read_buf != (char *)dpy->lock->reply_awaiters->buf) + memcpy(dpy->lock->reply_awaiters->buf, read_buf, + len); + if (cvl) { + UnlockNextEventReader(dpy); + } + return(dpy->qlen); /* we read, so we can return */ + } else if (read_buf != buf.buf) + memcpy(buf.buf, read_buf, len); + } +#endif /* XTHREADS*/ + + STARTITERATE(rep,xReply,buf.buf,len > 0) { + if (rep->generic.type == X_Reply) { + int tmp = len; + RESETITERPTR(rep,xReply, + _XAsyncReply (dpy, rep, + ITERPTR(rep), &tmp, True)); + len = tmp; + pend = len; + } else { + if (rep->generic.type == X_Error) + _XError (dpy, (xError *)rep); + else /* must be an event packet */ + _XEnq (dpy, (xEvent *)rep); + INCITERPTR(rep,xReply); + len -= SIZEOF(xReply); + } + } ENDITERATE + +#ifdef XTHREADS + if (cvl) +#endif + { + UnlockNextEventReader(dpy); + } + return(dpy->qlen); +} + +/* _XReadEvents - Flush the output queue, + * then read as many events as possible (but at least 1) and enqueue them + */ +void _XReadEvents( + register Display *dpy) +{ + _XAlignedBuffer buf; + BytesReadable_t pend; + int len; + register xReply *rep; + Bool not_yet_flushed = True; + char *read_buf; + int i; + int entry_event_serial_num = dpy->next_event_serial_num; +#ifdef XTHREADS + struct _XCVList *cvl = NULL; + xthread_t self; + +#ifdef XTHREADS_DEBUG + printf("_XReadEvents called in thread %x\n", + XThread_Self()); +#endif + /* create our condition variable and append to list, + * unless we were called from within XProcessInternalConnection + * or XLockDisplay + */ + xthread_clear_id(self); + if (dpy->lock && (xthread_have_id (dpy->lock->conni_thread) + || xthread_have_id (dpy->lock->locking_thread))) + /* some thread is in XProcessInternalConnection or XLockDisplay + so we have to see if we are it */ + self = XThread_Self(); + if (!xthread_have_id(self) + || (!xthread_equal(self, dpy->lock->conni_thread) + && !xthread_equal(self, dpy->lock->locking_thread))) + cvl = QueueEventReaderLock(dpy); +#endif /* XTHREADS */ + + do { +#ifdef XTHREADS + /* if it is not our turn to read an event off the wire, + wait til we're at head of list */ + if (dpy->lock && cvl && + (dpy->lock->event_awaiters != cvl || + dpy->lock->reply_first)) { + ConditionWait(dpy, cvl->cv); + continue; + } +#endif /* XTHREADS */ + /* find out how much data can be read */ + if (_X11TransBytesReadable(dpy->trans_conn, &pend) < 0) + { + _XIOError(dpy); +#ifdef NX_TRANS_SOCKET + return; +#endif + } + len = pend; + + /* must read at least one xEvent; if none is pending, then + we'll just flush and block waiting for it */ + if (len < SIZEOF(xEvent) +#ifdef XTHREADS + || dpy->async_handlers +#endif + ) { + len = SIZEOF(xEvent); + /* don't flush until the first time we would block */ + if (not_yet_flushed) { + _XFlush (dpy); + if (_XNewerQueuedEvent(dpy, entry_event_serial_num)) { + /* _XReply has read an event for us */ + goto got_event; + } + not_yet_flushed = False; + } + } + +#ifdef XTHREADS + /* If someone is waiting for a reply, gamble that + the reply will be the next thing on the wire + and read it into their buffer. */ + if (dpy->lock && dpy->lock->reply_awaiters) { + read_buf = (char *)dpy->lock->reply_awaiters->buf; + len = SIZEOF(xReply); + } else +#endif /* XTHREADS*/ + { + read_buf = buf.buf; + + /* but we won't read more than the max buffer size */ + if (len > BUFSIZE) + len = BUFSIZE; + + /* round down to an integral number of XReps */ + len = (len / SIZEOF(xEvent)) * SIZEOF(xEvent); + } + +#ifdef XTHREADS + if (xthread_have_id(self)) + /* save value we may have to stick in conni_thread */ + dpy->lock->reading_thread = self; +#endif /* XTHREADS */ + dpy->flags |= XlibDisplayReadEvents; + i = _XRead (dpy, read_buf, (long) len); + dpy->flags &= ~XlibDisplayReadEvents; +#ifdef NX_TRANS_SOCKET + if (dpy->flags & XlibDisplayIOError) + { +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XReadEvents: Returning with I/O error detected.\n"); +#endif + return; + } +#endif + if (i == -2) { + /* special flag from _XRead to say that internal connection has + done XPutBackEvent. Which we can use so we're done. */ + got_event: +#ifdef XTHREADS + if (dpy->lock && dpy->lock->lock_wait) { + if (dpy->lock->event_awaiters != cvl) + /* since it is not us, must be user lock thread */ + ConditionSignal(dpy, + dpy->lock->event_awaiters->cv); + (*dpy->lock->lock_wait)(dpy); + continue; + } +#endif + break; + } +#ifdef XTHREADS + if (xthread_have_id(self)) + xthread_clear_id(dpy->lock->reading_thread); + + /* what did we actually read: reply or event? */ + if (dpy->lock && dpy->lock->reply_awaiters) { + if (((xReply *)read_buf)->generic.type == X_Reply || + ((xReply *)read_buf)->generic.type == X_Error) + { + dpy->lock->reply_was_read = True; + dpy->lock->reply_first = True; + if (read_buf != (char *)dpy->lock->reply_awaiters->buf) + memcpy(dpy->lock->reply_awaiters->buf, + read_buf, len); + ConditionSignal(dpy, dpy->lock->reply_awaiters->cv); + continue; + } else if (read_buf != buf.buf) + memcpy(buf.buf, read_buf, len); + } +#endif /* XTHREADS */ + + STARTITERATE(rep,xReply,buf.buf,len > 0) { + if (rep->generic.type == X_Reply) { + RESETITERPTR(rep,xReply, + _XAsyncReply (dpy, rep, + ITERPTR(rep), &len, True)); + pend = len; + } else { + if (rep->generic.type == X_Error) + _XError (dpy, (xError *) rep); + else /* must be an event packet */ + { + if (rep->generic.type == GenericEvent) + { + int evlen; + evlen = (rep->generic.length << 2); + if (_XRead(dpy, &read_buf[len], evlen) == -2) + goto got_event; /* XXX: aargh! */ + } + + _XEnq (dpy, (xEvent *)rep); + } + INCITERPTR(rep,xReply); + len -= SIZEOF(xReply); + } + } ENDITERATE; + } while (!_XNewerQueuedEvent(dpy, entry_event_serial_num)); + + UnlockNextEventReader(dpy); +} + +/* + * _XRead - Read bytes from the socket taking into account incomplete + * reads. This routine may have to be reworked if int < long. + */ +int _XRead( + register Display *dpy, + register char *data, + register long size) +{ + register long bytes_read; +#ifdef XTHREADS + int original_size = size; +#endif +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + int congestion; +#endif + + if ((dpy->flags & XlibDisplayIOError) || size == 0) + return 0; + ESET(0); +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + while (1) { + /* + * Need to check the congestion state + * after the read so split the statement + * in multiple blocks. + */ + + bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size); + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } + if (bytes_read == size) { + break; + } +#else + while ((bytes_read = _X11TransRead(dpy->trans_conn, data, (int)size)) + != size) { +#endif + + if (bytes_read > 0) { + size -= bytes_read; + data += bytes_read; + } + else if (ETEST()) { + if (_XWaitForReadable(dpy) == -2) + return -2; /* internal connection did XPutBackEvent */ + ESET(0); + } +#ifdef SUNSYSV + else if (ECHECK(0)) { + if (_XWaitForReadable(dpy) == -2) + return -2; /* internal connection did XPutBackEvent */ + } +#endif + else if (bytes_read == 0) { + /* Read failed because of end of file! */ + ESET(EPIPE); +#ifdef NX_TRANS_SOCKET + _XIOError(dpy); + + return -1; +#else + _XIOError(dpy); +#endif + } + + else /* bytes_read is less than 0; presumably -1 */ { + /* If it's a system call interrupt, it's not an error. */ +#ifdef NX_TRANS_SOCKET + if (!ECHECK(EINTR) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return -1; + } +#else + if (!ECHECK(EINTR)) + _XIOError(dpy); +#endif + } +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + return -1; + } +#endif + } +#ifdef XTHREADS + if (dpy->lock && dpy->lock->reply_bytes_left > 0) + { + dpy->lock->reply_bytes_left -= original_size; + if (dpy->lock->reply_bytes_left == 0) { + dpy->flags &= ~XlibDisplayReply; + UnlockNextReplyReader(dpy); + } + } +#endif /* XTHREADS*/ + return 0; +} +#endif /* !USE_XCB */ + +#ifdef LONG64 +void _XRead32( + Display *dpy, + register long *data, + long len) +{ + register int *buf; + register long i; + + if (len) { + (void) _XRead(dpy, (char *)data, len); + i = len >> 2; + buf = (int *)data + i; + data += i; + while (--i >= 0) + *--data = *--buf; + } +} +#endif /* LONG64 */ + + + +#if !USE_XCB +/* + * _XReadPad - Read bytes from the socket taking into account incomplete + * reads. If the number of bytes is not 0 mod 4, read additional pad + * bytes. This routine may have to be reworked if int < long. + */ +void _XReadPad( + register Display *dpy, + register char *data, + register long size) +{ + register long bytes_read; + struct iovec iov[2]; + char pad[3]; +#ifdef XTHREADS + int original_size; +#endif +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + int congestion; +#endif + + if ((dpy->flags & XlibDisplayIOError) || size == 0) return; + iov[0].iov_len = (int)size; + iov[0].iov_base = data; + /* + * The following hack is used to provide 32 bit long-word + * aligned padding. The [1] vector is of length 0, 1, 2, or 3, + * whatever is needed. + */ + + iov[1].iov_len = -size & 3; + iov[1].iov_base = pad; + size += iov[1].iov_len; +#ifdef XTHREADS + original_size = size; +#endif + ESET(0); +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + while (1) { + bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2); + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } + if (bytes_read == size) { + break; + } +#else + while ((bytes_read = _X11TransReadv (dpy->trans_conn, iov, 2)) != size) { +#endif + + if (bytes_read > 0) { + size -= bytes_read; + if (iov[0].iov_len < bytes_read) { + int pad_bytes_read = bytes_read - iov[0].iov_len; + iov[1].iov_len -= pad_bytes_read; + iov[1].iov_base = + (char *)iov[1].iov_base + pad_bytes_read; + iov[0].iov_len = 0; + } + else { + iov[0].iov_len -= bytes_read; + iov[0].iov_base = (char *)iov[0].iov_base + bytes_read; + } + } + else if (ETEST()) { + _XWaitForReadable(dpy); + ESET(0); + } +#ifdef SUNSYSV + else if (ECHECK(0)) { + _XWaitForReadable(dpy); + } +#endif + else if (bytes_read == 0) { + /* Read failed because of end of file! */ + ESET(EPIPE); +#ifdef NX_TRANS_SOCKET + _XIOError(dpy); + + return; +#else + _XIOError(dpy); +#endif + } + + else /* bytes_read is less than 0; presumably -1 */ { + /* If it's a system call interrupt, it's not an error. */ +#ifdef NX_TRANS_SOCKET + if (!ECHECK(EINTR) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return; + } +#else + if (!ECHECK(EINTR)) + _XIOError(dpy); +#endif + } +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + return; + } +#endif + } +#ifdef XTHREADS + if (dpy->lock && dpy->lock->reply_bytes_left > 0) + { + dpy->lock->reply_bytes_left -= original_size; + if (dpy->lock->reply_bytes_left == 0) { + dpy->flags &= ~XlibDisplayReply; + UnlockNextReplyReader(dpy); + } + } +#endif /* XTHREADS*/ +} + +/* + * _XSend - Flush the buffer and send the client data. 32 bit word aligned + * transmission is used, if size is not 0 mod 4, extra bytes are transmitted. + * This routine may have to be reworked if int < long; + */ +void +_XSend ( + register Display *dpy, + _Xconst char *data, + register long size) +{ + struct iovec iov[3]; + static char const pad[3] = {0, 0, 0}; + /* XText8 and XText16 require that the padding bytes be zero! */ + + long skip, dbufsize, padsize, total, todo; + _XExtension *ext; +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_CHANGE) + int congestion; +#endif + +#ifdef NX_TRANS_SOCKET +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XSend: Sending data with [%d] bytes to write.\n", + (dpy->bufptr - dpy->buffer)); +#endif + if (!size || (dpy->flags & XlibDisplayIOError)) + { + if (dpy->flags & XlibDisplayIOError) + { +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XSend: Returning with I/O error detected.\n"); +#endif + dpy->bufptr = dpy->buffer; + dpy->last_req = (char *)&_dummy_request; + } + + return; + } +#else + if (!size || (dpy->flags & XlibDisplayIOError)) return; +#endif + dbufsize = dpy->bufptr - dpy->buffer; +#ifdef XTHREADS + dpy->flags |= XlibDisplayWriting; + /* make sure no one else can put in data */ + dpy->bufptr = dpy->bufmax; +#endif + padsize = -size & 3; + for (ext = dpy->flushes; ext; ext = ext->next_flush) { + (*ext->before_flush)(dpy, &ext->codes, dpy->buffer, dbufsize); + (*ext->before_flush)(dpy, &ext->codes, (char *)data, size); + if (padsize) + (*ext->before_flush)(dpy, &ext->codes, pad, padsize); + } + skip = 0; + todo = total = dbufsize + size + padsize; + + /* + * There are 3 pieces that may need to be written out: + * + * o whatever is in the display buffer + * o the data passed in by the user + * o any padding needed to 32bit align the whole mess + * + * This loop looks at all 3 pieces each time through. It uses skip + * to figure out whether or not a given piece is needed. + */ + while (total) { + long before = skip; /* amount of whole thing written */ + long remain = todo; /* amount to try this time, <= total */ + int i = 0; + long len; + + /* You could be very general here and have "in" and "out" iovecs + * and write a loop without using a macro, but what the heck. This + * translates to: + * + * how much of this piece is new? + * if more new then we are trying this time, clamp + * if nothing new + * then bump down amount already written, for next piece + * else put new stuff in iovec, will need all of next piece + * + * Note that todo had better be at least 1 or else we'll end up + * writing 0 iovecs. + */ +#define InsertIOV(pointer, length) \ + len = (length) - before; \ + if (len > remain) \ + len = remain; \ + if (len <= 0) { \ + before = (-len); \ + } else { \ + iov[i].iov_len = len; \ + iov[i].iov_base = (pointer) + before; \ + i++; \ + remain -= len; \ + before = 0; \ + } + + InsertIOV (dpy->buffer, dbufsize) + InsertIOV ((char *)data, size) + InsertIOV ((char *)pad, padsize) + + ESET(0); + if ((len = _X11TransWritev(dpy->trans_conn, iov, i)) >= 0) { +#ifdef NX_TRANS_SOCKET + if (_NXDisplayWriteFunction != NULL) { + (*_NXDisplayWriteFunction)(dpy, len); + } +#ifdef NX_TRANS_CHANGE + if (_NXDisplayCongestionFunction != NULL && + _X11TransSocketCongestionChange(dpy->trans_conn, &congestion) == 1) { + (*_NXDisplayCongestionFunction)(dpy, congestion); + } +#endif +#endif + skip += len; + total -= len; + todo = total; + } else if (ETEST()) { + _XWaitForWritable(dpy +#ifdef XTHREADS + , NULL +#endif + ); +#ifdef SUNSYSV + } else if (ECHECK(0)) { + _XWaitForWritable(dpy +#ifdef XTHREADS + , NULL +#endif + ); +#endif +#ifdef ESZTEST + } else if (ESZTEST()) { + if (todo > 1) + todo >>= 1; + else { + _XWaitForWritable(dpy +#ifdef XTHREADS + , NULL +#endif + ); + } +#endif +#ifdef NX_TRANS_SOCKET + } else if (!ECHECK(EINTR) || + (_NXDisplayErrorFunction != NULL && + (*_NXDisplayErrorFunction)(dpy, _XGetIOError(dpy)))) { + _XIOError(dpy); + return; + } +#else + } else if (!ECHECK(EINTR)) { + _XIOError(dpy); + } +#endif +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + return; + } +#endif + } + dpy->last_req = (char *) & _dummy_request; + _XSetSeqSyncFunction(dpy); + dpy->bufptr = dpy->buffer; +#ifdef XTHREADS + dpy->flags &= ~XlibDisplayWriting; +#endif + return; +} + +static void +_XGetMiscCode( + register Display *dpy) +{ + xQueryExtensionReply qrep; + register xQueryExtensionReq *qreq; + xXCMiscGetVersionReply vrep; + register xXCMiscGetVersionReq *vreq; + + if (dpy->xcmisc_opcode) + return; + GetReq(QueryExtension, qreq); + qreq->nbytes = sizeof(XCMiscExtensionName) - 1; + qreq->length += (qreq->nbytes+(unsigned)3)>>2; + _XSend(dpy, XCMiscExtensionName, (long)qreq->nbytes); + if (!_XReply (dpy, (xReply *)&qrep, 0, xTrue)) + dpy->xcmisc_opcode = -1; + else { + GetReq(XCMiscGetVersion, vreq); + vreq->reqType = qrep.major_opcode; + vreq->miscReqType = X_XCMiscGetVersion; + vreq->majorVersion = XCMiscMajorVersion; + vreq->minorVersion = XCMiscMinorVersion; + if (!_XReply (dpy, (xReply *)&vrep, 0, xTrue)) + dpy->xcmisc_opcode = -1; + else + dpy->xcmisc_opcode = qrep.major_opcode; + } +} + +void +_XIDHandler( + register Display *dpy) +{ + xXCMiscGetXIDRangeReply grep; + register xXCMiscGetXIDRangeReq *greq; + + if (dpy->resource_max == dpy->resource_mask + 1) { + _XGetMiscCode(dpy); + if (dpy->xcmisc_opcode > 0) { + GetReq(XCMiscGetXIDRange, greq); + greq->reqType = dpy->xcmisc_opcode; + greq->miscReqType = X_XCMiscGetXIDRange; + if (_XReply (dpy, (xReply *)&grep, 0, xTrue) && grep.count) { + dpy->resource_id = ((grep.start_id - dpy->resource_base) >> + dpy->resource_shift); + dpy->resource_max = dpy->resource_id; + if (grep.count > 5) + dpy->resource_max += grep.count - 6; + dpy->resource_max <<= dpy->resource_shift; + } + sync_while_locked(dpy); + } + } +} + +/* + * _XAllocID - resource ID allocation routine. + */ +XID _XAllocID( + register Display *dpy) +{ + XID id; + + id = dpy->resource_id << dpy->resource_shift; + if (id >= dpy->resource_max) { + _XSetPrivSyncFunction(dpy); + dpy->resource_max = dpy->resource_mask + 1; + } + if (id <= dpy->resource_mask) { + dpy->resource_id++; + return (dpy->resource_base + id); + } + if (id != 0x10000000) { + (void) fprintf(stderr, + "Xlib: resource ID allocation space exhausted!\n"); + id = 0x10000000; + dpy->resource_id = id >> dpy->resource_shift; + } + return id; +} + +/* + * _XAllocIDs - multiple resource ID allocation routine. + */ +void _XAllocIDs( + register Display *dpy, + XID *ids, + int count) +{ + XID id; + int i; + xXCMiscGetXIDListReply grep; + register xXCMiscGetXIDListReq *greq; + + id = dpy->resource_id << dpy->resource_shift; + if (dpy->resource_max <= dpy->resource_mask && + id <= dpy->resource_mask && + (dpy->resource_max - id) > ((count - 1) << dpy->resource_shift)) { + id += dpy->resource_base; + for (i = 0; i < count; i++) { + ids[i] = id; + id += (1 << dpy->resource_shift); + dpy->resource_id++; + } + return; + } + grep.count = 0; + _XGetMiscCode(dpy); + if (dpy->xcmisc_opcode > 0) { + GetReq(XCMiscGetXIDList, greq); + greq->reqType = dpy->xcmisc_opcode; + greq->miscReqType = X_XCMiscGetXIDList; + greq->count = count; + if (_XReply(dpy, (xReply *)&grep, 0, xFalse) && grep.count) { + _XRead32(dpy, (long *) ids, 4L * (long) (grep.count)); + for (i = 0; i < grep.count; i++) { + id = (ids[i] - dpy->resource_base) >> dpy->resource_shift; + if (id >= dpy->resource_id) + dpy->resource_id = id; + } + if (id >= dpy->resource_max) { + _XSetPrivSyncFunction(dpy); + dpy->resource_max = dpy->resource_mask + 1; + } + } + } + for (i = grep.count; i < count; i++) + ids[i] = XAllocID(dpy); +} +#endif /* !USE_XCB */ + +/* + * The hard part about this is that we only get 16 bits from a reply. + * We have three values that will march along, with the following invariant: + * dpy->last_request_read <= rep->sequenceNumber <= dpy->request + * We have to keep + * dpy->request - dpy->last_request_read < 2^16 + * or else we won't know for sure what value to use in events. We do this + * by forcing syncs when we get close. + */ + +unsigned long +_XSetLastRequestRead( + register Display *dpy, + register xGenericReply *rep) +{ + register unsigned long newseq, lastseq; + + lastseq = dpy->last_request_read; + /* + * KeymapNotify has no sequence number, but is always guaranteed + * to immediately follow another event, except when generated via + * SendEvent (hmmm). + */ + if ((rep->type & 0x7f) == KeymapNotify) + return(lastseq); + + newseq = (lastseq & ~((unsigned long)0xffff)) | rep->sequenceNumber; + + if (newseq < lastseq) { + newseq += 0x10000; + if (newseq > dpy->request) { +#ifdef NX_TRANS_SOCKET + if (_NXLostSequenceFunction != NULL) + { + (*_NXLostSequenceFunction)(dpy, newseq, dpy->request, + (unsigned int) rep->type); + } + else +#endif /* #ifdef NX_TRANS_SOCKET */ + { + (void) fprintf (stderr, + "Xlib: sequence lost (0x%lx > 0x%lx) in reply type 0x%x!\n", + newseq, dpy->request, + (unsigned int) rep->type); + } + newseq -= 0x10000; + } + } + + dpy->last_request_read = newseq; + return(newseq); +} + +#if !USE_XCB +/* + * _XReply - Wait for a reply packet and copy its contents into the + * specified rep. Meanwhile we must handle error and event packets that + * we may encounter. + */ +Status +_XReply ( + register Display *dpy, + register xReply *rep, + int extra, /* number of 32-bit words expected after the reply */ + Bool discard) /* should I discard data following "extra" words? */ +{ + /* Pull out the serial number now, so that (currently illegal) requests + * generated by an error handler don't confuse us. + */ + unsigned long cur_request = dpy->request; +#ifdef XTHREADS + struct _XCVList *cvl; +#endif +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XReply: Going to wait for an X reply.\n"); +#endif + +#ifdef NX_TRANS_SOCKET + if (dpy->flags & XlibDisplayIOError) + { +#ifdef NX_TRANS_DEBUG + fprintf(stderr, "_XReply: Returning 0 with I/O error detected.\n"); +#endif + return 0; + } +#else + if (dpy->flags & XlibDisplayIOError) + return 0; +#endif + +#ifdef XTHREADS + /* create our condition variable and append to list */ + cvl = QueueReplyReaderLock(dpy); + if (cvl) { + cvl->buf = rep; + if (dpy->lock->reply_awaiters == cvl && !dpy->lock->event_awaiters) + dpy->lock->reply_first = True; + } + +#ifdef XTHREADS_DEBUG + printf("_XReply called in thread %x, adding %x to cvl\n", + XThread_Self(), cvl); +#endif + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XReply: Going to flush the display buffer.\n"); +#endif + _XFlushInt(dpy, cvl ? cvl->cv : NULL); + /* if it is not our turn to read a reply off the wire, + * wait til we're at head of list. if there is an event waiter, + * and our reply hasn't been read, they'll be in select and will + * hand control back to us next. + */ + if(dpy->lock && + (dpy->lock->reply_awaiters != cvl || !dpy->lock->reply_first)) { + ConditionWait(dpy, cvl->cv); + } + dpy->flags |= XlibDisplayReply; +#else /* XTHREADS else */ + _XFlush(dpy); +#endif + +#ifdef NX_TRANS_SOCKET + /* + * We are going to block waiting for the remote + * X server. Be sure that the proxy has flushed + * all the data. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XReply: Requesting a flush of the NX transport.\n"); +#endif + NXTransFlush(dpy->fd); +#endif + + for (;;) { +#ifdef XTHREADS + /* Did another thread's _XReadEvents get our reply by accident? */ + if (!dpy->lock || !dpy->lock->reply_was_read) +#endif + (void) _XRead(dpy, (char *)rep, (long)SIZEOF(xReply)); +#ifdef XTHREADS + if (dpy->lock) + dpy->lock->reply_was_read = False; +#endif + + switch ((int)rep->generic.type) { + + case X_Reply: + /* Reply received. Fast update for synchronous replies, + * but deal with multiple outstanding replies. + */ + if (rep->generic.sequenceNumber == (cur_request & 0xffff)) + dpy->last_request_read = cur_request; + else { + int pend = SIZEOF(xReply); + if (_XAsyncReply(dpy, rep, (char *)rep, &pend, False) + != (char *)rep) + continue; + } + if (extra <= rep->generic.length) { + if (extra > 0) + /* + * Read the extra data into storage immediately + * following the GenericReply structure. + */ + (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), + ((long)extra) << 2); + if (discard) { + if (extra < rep->generic.length) + _XEatData(dpy, (rep->generic.length - extra) << 2); + } +#ifdef XTHREADS + if (dpy->lock) { + if (discard) { + dpy->lock->reply_bytes_left = 0; + } else { + dpy->lock->reply_bytes_left = + (rep->generic.length - extra) << 2; + } + if (dpy->lock->reply_bytes_left == 0) { + dpy->flags &= ~XlibDisplayReply; + UnlockNextReplyReader(dpy); + } + } else + dpy->flags &= ~XlibDisplayReply; +#endif + return 1; + } + /* + *if we get here, then extra > rep->generic.length--meaning we + * read a reply that's shorter than we expected. This is an + * error, but we still need to figure out how to handle it... + */ + (void) _XRead (dpy, (char *) (NEXTPTR(rep,xReply)), + ((long) rep->generic.length) << 2); + dpy->flags &= ~XlibDisplayReply; + UnlockNextReplyReader(dpy); +#ifdef NX_TRANS_SOCKET + /* + * The original code has provision + * for returning already. + */ +#endif + _XIOError (dpy); + return (0); + + case X_Error: + { + register _XExtension *ext; + register Bool ret = False; + int ret_code; + xError *err = (xError *) rep; + unsigned long serial; + + dpy->flags &= ~XlibDisplayReply; + serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); + if (serial == cur_request) + /* do not die on "no such font", "can't allocate", + "can't grab" failures */ + switch ((int)err->errorCode) { + case BadName: + switch (err->majorCode) { + case X_LookupColor: + case X_AllocNamedColor: + UnlockNextReplyReader(dpy); + return(0); + } + break; + case BadFont: + if (err->majorCode == X_QueryFont) { + UnlockNextReplyReader(dpy); + return (0); + } + break; + case BadAlloc: + case BadAccess: + UnlockNextReplyReader(dpy); + return (0); + } + /* + * we better see if there is an extension who may + * want to suppress the error. + */ + for (ext = dpy->ext_procs; !ret && ext; ext = ext->next) { + if (ext->error) + ret = (*ext->error)(dpy, err, &ext->codes, &ret_code); + } + if (!ret) { + _XError(dpy, err); + ret_code = 0; + } + if (serial == cur_request) { + UnlockNextReplyReader(dpy); + return(ret_code); + } + + } /* case X_Error */ + break; + default: + _XEnq(dpy, (xEvent *) rep); +#ifdef XTHREADS + if (dpy->lock && dpy->lock->event_awaiters) + ConditionSignal(dpy, dpy->lock->event_awaiters->cv); +#endif + break; + } +#ifdef NX_TRANS_SOCKET + if (_XGetIOError(dpy)) { + UnlockNextReplyReader(dpy); + return 0; + } +#endif + } +} + +static char * +_XAsyncReply( + Display *dpy, + register xReply *rep, + char *buf, + register int *lenp, + Bool discard) +{ + register _XAsyncHandler *async, *next; + register int len; + register Bool consumed = False; + char *nbuf; + + (void) _XSetLastRequestRead(dpy, &rep->generic); + len = SIZEOF(xReply) + (rep->generic.length << 2); + if (len < SIZEOF(xReply)) { +#ifdef NX_TRANS_SOCKET + + /* + * The original code has provision + * for returning already. + */ + +#endif + _XIOError (dpy); + buf += *lenp; + *lenp = 0; + return buf; + } + + for (async = dpy->async_handlers; async; async = next) { + next = async->next; + if ((consumed = (*async->handler)(dpy, rep, buf, *lenp, async->data))) + break; + } + if (!consumed) { + if (!discard) + return buf; + (void) fprintf(stderr, + "Xlib: unexpected async reply (sequence 0x%lx)!\n", + dpy->last_request_read); +#ifdef XTHREADS +#ifdef XTHREADS_DEBUG + printf("thread %x, unexpected async reply\n", XThread_Self()); +#endif +#endif + if (len > *lenp) + _XEatData(dpy, len - *lenp); + } + if (len < SIZEOF(xReply)) + { +#ifdef NX_TRANS_SOCKET + + /* + * The original code has provision + * for returning already. + */ + +#endif + _XIOError (dpy); + buf += *lenp; + *lenp = 0; + return buf; + } + if (len >= *lenp) { + buf += *lenp; + *lenp = 0; + return buf; + } + *lenp -= len; + buf += len; + len = *lenp; + nbuf = buf; + while (len > SIZEOF(xReply)) { + if (*buf == X_Reply) + return nbuf; + buf += SIZEOF(xReply); + len -= SIZEOF(xReply); + } + if (len > 0 && len < SIZEOF(xReply)) { + buf = nbuf; + len = SIZEOF(xReply) - len; + nbuf -= len; + memmove(nbuf, buf, *lenp); + (void) _XRead(dpy, nbuf + *lenp, (long)len); + *lenp += len; + } + return nbuf; +} +#endif /* !USE_XCB */ + +/* + * Support for internal connections, such as an IM might use. + * By Stephen Gildea, X Consortium, September 1993 + */ + +/* _XRegisterInternalConnection + * Each IM (or Xlib extension) that opens a file descriptor that Xlib should + * include in its select/poll mask must call this function to register the + * fd with Xlib. Any XConnectionWatchProc registered by XAddConnectionWatch + * will also be called. + * + * Whenever Xlib detects input available on fd, it will call callback + * with call_data to process it. If non-Xlib code calls select/poll + * and detects input available, it must call XProcessInternalConnection, + * which will call the associated callback. + * + * Non-Xlib code can learn about these additional fds by calling + * XInternalConnectionNumbers or, more typically, by registering + * a XConnectionWatchProc with XAddConnectionWatch + * to be called when fds are registered or unregistered. + * + * Returns True if registration succeeded, False if not, typically + * because could not allocate memory. + * Assumes Display locked when called. + */ +Status +_XRegisterInternalConnection( + Display* dpy, + int fd, + _XInternalConnectionProc callback, + XPointer call_data +) +{ + struct _XConnectionInfo *new_conni, **iptr; + struct _XConnWatchInfo *watchers; + XPointer *wd; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XRegisterInternalConnection: Got called.\n"); +#endif + new_conni = Xmalloc(sizeof(struct _XConnectionInfo)); + if (!new_conni) + return 0; + new_conni->watch_data = Xmalloc(dpy->watcher_count * sizeof(XPointer)); + if (!new_conni->watch_data) { + Xfree(new_conni); + return 0; + } + new_conni->fd = fd; + new_conni->read_callback = callback; + new_conni->call_data = call_data; + new_conni->next = NULL; + /* link new structure onto end of list */ + for (iptr = &dpy->im_fd_info; *iptr; iptr = &(*iptr)->next) + ; + *iptr = new_conni; + dpy->im_fd_length++; + _XPollfdCacheAdd(dpy, fd); + + for (watchers=dpy->conn_watchers, wd=new_conni->watch_data; + watchers; + watchers=watchers->next, wd++) { + *wd = NULL; /* for cleanliness */ + (*watchers->fn) (dpy, watchers->client_data, fd, True, wd); + } + + return 1; +} + +/* _XUnregisterInternalConnection + * Each IM (or Xlib extension) that closes a file descriptor previously + * registered with _XRegisterInternalConnection must call this function. + * Any XConnectionWatchProc registered by XAddConnectionWatch + * will also be called. + * + * Assumes Display locked when called. + */ +void +_XUnregisterInternalConnection( + Display* dpy, + int fd +) +{ + struct _XConnectionInfo *info_list, **prev; + struct _XConnWatchInfo *watch; + XPointer *wd; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XUnregisterInternalConnection: Got called.\n"); +#endif + for (prev = &dpy->im_fd_info; (info_list = *prev); + prev = &info_list->next) { + if (info_list->fd == fd) { + *prev = info_list->next; + dpy->im_fd_length--; + for (watch=dpy->conn_watchers, wd=info_list->watch_data; + watch; + watch=watch->next, wd++) { + (*watch->fn) (dpy, watch->client_data, fd, False, wd); + } + Xfree (info_list->watch_data); + Xfree (info_list); + break; + } + } + _XPollfdCacheDel(dpy, fd); +} + +/* XInternalConnectionNumbers + * Returns an array of fds and an array of corresponding call data. + * Typically a XConnectionWatchProc registered with XAddConnectionWatch + * will be used instead of this function to discover + * additional fds to include in the select/poll mask. + * + * The list is allocated with Xmalloc and should be freed by the caller + * with Xfree; + */ +Status +XInternalConnectionNumbers( + Display *dpy, + int **fd_return, + int *count_return +) +{ + int count; + struct _XConnectionInfo *info_list; + int *fd_list; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "XInternalConnectionNumbers: Got called.\n"); +#endif + LockDisplay(dpy); + count = 0; + for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) + count++; + fd_list = Xmalloc (count * sizeof(int)); + if (!fd_list) { + UnlockDisplay(dpy); + return 0; + } + count = 0; + for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { + fd_list[count] = info_list->fd; + count++; + } + UnlockDisplay(dpy); + + *fd_return = fd_list; + *count_return = count; + return 1; +} + +void _XProcessInternalConnection( + Display *dpy, + struct _XConnectionInfo *conn_info) +{ + dpy->flags |= XlibDisplayProcConni; +#if defined(XTHREADS) && !USE_XCB + if (dpy->lock) { + /* check cache to avoid call to thread_self */ + if (xthread_have_id(dpy->lock->reading_thread)) + dpy->lock->conni_thread = dpy->lock->reading_thread; + else + dpy->lock->conni_thread = XThread_Self(); + } +#endif /* XTHREADS && !USE_XCB */ + UnlockDisplay(dpy); + (*conn_info->read_callback) (dpy, conn_info->fd, conn_info->call_data); + LockDisplay(dpy); +#if defined(XTHREADS) && !USE_XCB + if (dpy->lock) + xthread_clear_id(dpy->lock->conni_thread); +#endif /* XTHREADS && !USE_XCB */ + dpy->flags &= ~XlibDisplayProcConni; +} + +/* XProcessInternalConnection + * Call the _XInternalConnectionProc registered by _XRegisterInternalConnection + * for this fd. + * The Display is NOT locked during the call. + */ +void +XProcessInternalConnection( + Display* dpy, + int fd +) +{ + struct _XConnectionInfo *info_list; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "XProcessInternalConnection: Got called.\n"); +#endif + + LockDisplay(dpy); + for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { + if (info_list->fd == fd) { + _XProcessInternalConnection(dpy, info_list); + break; + } + } + UnlockDisplay(dpy); +} + +/* XAddConnectionWatch + * Register a callback to be called whenever _XRegisterInternalConnection + * or _XUnregisterInternalConnection is called. + * Callbacks are called with the Display locked. + * If any connections are already registered, the callback is immediately + * called for each of them. + */ +Status +XAddConnectionWatch( + Display* dpy, + XConnectionWatchProc callback, + XPointer client_data +) +{ + struct _XConnWatchInfo *new_watcher, **wptr; + struct _XConnectionInfo *info_list; + XPointer *wd_array; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "XAddConnectionWatch: Got called.\n"); +#endif + LockDisplay(dpy); + + /* allocate new watch data */ + for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { + wd_array = Xrealloc(info_list->watch_data, + (dpy->watcher_count + 1) * sizeof(XPointer)); + if (!wd_array) { + UnlockDisplay(dpy); + return 0; + } + info_list->watch_data = wd_array; + wd_array[dpy->watcher_count] = NULL; /* for cleanliness */ + } + + new_watcher = Xmalloc(sizeof(struct _XConnWatchInfo)); + if (!new_watcher) { + UnlockDisplay(dpy); + return 0; + } + new_watcher->fn = callback; + new_watcher->client_data = client_data; + new_watcher->next = NULL; + + /* link new structure onto end of list */ + for (wptr = &dpy->conn_watchers; *wptr; wptr = &(*wptr)->next) + ; + *wptr = new_watcher; + dpy->watcher_count++; + + /* call new watcher on all currently registered fds */ + for (info_list=dpy->im_fd_info; info_list; info_list=info_list->next) { + (*callback) (dpy, client_data, info_list->fd, True, + info_list->watch_data + dpy->watcher_count - 1); + } + + UnlockDisplay(dpy); + return 1; +} + +/* XRemoveConnectionWatch + * Unregister a callback registered by XAddConnectionWatch. + * Both callback and client_data must match what was passed to + * XAddConnectionWatch. + */ +void +XRemoveConnectionWatch( + Display* dpy, + XConnectionWatchProc callback, + XPointer client_data +) +{ + struct _XConnWatchInfo *watch; + struct _XConnWatchInfo *previous = NULL; + struct _XConnectionInfo *conni; + int counter = 0; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "XRemoveConnectionWatch: Got called.\n"); +#endif + LockDisplay(dpy); + for (watch=dpy->conn_watchers; watch; watch=watch->next) { + if (watch->fn == callback && watch->client_data == client_data) { + if (previous) + previous->next = watch->next; + else + dpy->conn_watchers = watch->next; + Xfree (watch); + dpy->watcher_count--; + /* remove our watch_data for each connection */ + for (conni=dpy->im_fd_info; conni; conni=conni->next) { + /* don't bother realloc'ing; these arrays are small anyway */ + /* overlapping */ + memmove(conni->watch_data+counter, + conni->watch_data+counter+1, + dpy->watcher_count - counter); + } + break; + } + previous = watch; + counter++; + } + UnlockDisplay(dpy); +} + +/* end of internal connections support */ + + +#if !USE_XCB +/* Read and discard "n" 8-bit bytes of data */ + +void _XEatData( + Display *dpy, + register unsigned long n) +{ +#define SCRATCHSIZE 2048 + char buf[SCRATCHSIZE]; + +#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_DEBUG) + fprintf(stderr, "_XEatData: Going to eat [%ld] bytes of data from descriptor [%d].\n", + n, dpy->fd); +#endif + while (n > 0) { + register long bytes_read = (n > SCRATCHSIZE) ? SCRATCHSIZE : n; + (void) _XRead (dpy, buf, bytes_read); + n -= bytes_read; + } +#undef SCRATCHSIZE +} + +/* + Port from libXfixes commit + b031e3b60fa1af9e49449f23d4a84395868be3ab We need this here to + enable linking of current libXrender against libNX_X11 instead of + the system's libX11 + + The original implementation of this function (libX11 commit + 9f5d83706543696fc944c1835a403938c06f2cc5) uses xcb stuff which we + do not have in libNX_X11. So we take a workaround from another + lib. This workaround had been implemented temporarily in a couple + of X libs, see e.g. https://lists.x.org/archives/xorg-devel/2013-July/036763.html. +*/ +#include /* for LONG64 on 64-bit platforms */ +#include + +void _XEatDataWords(Display *dpy, unsigned long n) +{ +#ifndef LONG64 + if (n >= (ULONG_MAX >> 2)) + _XIOError(dpy); +#endif + _XEatData (dpy, n << 2); +} +#endif /* !USE_XCB */ + +/* Cookie jar implementation + dpy->cookiejar is a linked list. _XEnq receives the events but leaves + them in the normal EQ. _XStoreEvent returns the cookie event (minus + data pointer) and adds it to the cookiejar. _XDeq just removes + the entry like any other event but resets the data pointer for + cookie events (to avoid double-free, the memory is re-used by Xlib). + + _XFetchEventCookie (called from XGetEventData) removes a cookie from the + jar. _XFreeEventCookies removes all unclaimed cookies from the jar + (called by XNextEvent). + + _XFreeDisplayStructure calls _XFreeEventCookies for each cookie in the + normal EQ. + */ + +#include "utlist.h" +struct stored_event { + XGenericEventCookie ev; + struct stored_event *prev; + struct stored_event *next; +}; + +Bool +_XIsEventCookie(Display *dpy, XEvent *ev) +{ + return (ev->xcookie.type == GenericEvent && + dpy->generic_event_vec[ev->xcookie.extension & 0x7F] != NULL); +} + +/** + * Free all events in the event list. + */ +void +_XFreeEventCookies(Display *dpy) +{ + struct stored_event **head, *e, *tmp; + + if (!dpy->cookiejar) + return; + + head = (struct stored_event**)&dpy->cookiejar; + + DL_FOREACH_SAFE(*head, e, tmp) { + if (dpy->cookiejar == e) + dpy->cookiejar = NULL; + XFree(e->ev.data); + XFree(e); + } +} + +/** + * Add an event to the display's event list. This event must be freed on the + * next call to XNextEvent(). + */ +void +_XStoreEventCookie(Display *dpy, XEvent *event) +{ + XGenericEventCookie* cookie = &event->xcookie; + struct stored_event **head, *add; + + if (!_XIsEventCookie(dpy, event)) + return; + + head = (struct stored_event**)(&dpy->cookiejar); + + add = Xmalloc(sizeof(struct stored_event)); + if (!add) { + ESET(ENOMEM); + _XIOError(dpy); + } + add->ev = *cookie; + DL_APPEND(*head, add); + cookie->data = NULL; /* don't return data yet, must be claimed */ +} + +/** + * Return the event with the given cookie and remove it from the list. + */ +Bool +_XFetchEventCookie(Display *dpy, XGenericEventCookie* ev) +{ + Bool ret = False; + struct stored_event **head, *event; + head = (struct stored_event**)&dpy->cookiejar; + + if (!_XIsEventCookie(dpy, (XEvent*)ev)) + return ret; + + DL_FOREACH(*head, event) { + if (event->ev.cookie == ev->cookie && + event->ev.extension == ev->extension && + event->ev.evtype == ev->evtype) { + *ev = event->ev; + DL_DELETE(*head, event); + Xfree(event); + ret = True; + break; + } + } + + return ret; +} + +Bool +_XCopyEventCookie(Display *dpy, XGenericEventCookie *in, XGenericEventCookie *out) +{ + Bool ret = False; + int extension; + + if (!_XIsEventCookie(dpy, (XEvent*)in) || !out) + return ret; + + extension = in->extension & 0x7F; + + if (!dpy->generic_event_copy_vec[extension]) + return ret; + + ret = ((*dpy->generic_event_copy_vec[extension])(dpy, in, out)); + out->cookie = ret ? ++dpy->next_cookie : 0; + return ret; +} + + +/* + * _XEnq - Place event packets on the display's queue. + * note that no squishing of move events in V11, since there + * is pointer motion hints.... + */ +void _XEnq( + register Display *dpy, + register xEvent *event) +{ + register _XQEvent *qelt; + int type, extension; + + if ((qelt = dpy->qfree)) { + /* If dpy->qfree is non-NULL do this, else malloc a new one. */ + dpy->qfree = qelt->next; + } + else if ((qelt = Xmalloc(sizeof(_XQEvent))) == NULL) { + /* Malloc call failed! */ + ESET(ENOMEM); +#ifdef NX_TRANS_SOCKET + _XIOError(dpy); + + return; +#else + _XIOError(dpy); +#endif + } + qelt->next = NULL; + + type = event->u.u.type & 0177; + extension = ((xGenericEvent*)event)->extension; + + qelt->event.type = type; + /* If an extension has registered a generic_event_vec handler, then + * it can handle event cookies. Otherwise, proceed with the normal + * event handlers. + * + * If the generic_event_vec is called, qelt->event is a event cookie + * with the data pointer and the "free" pointer set. Data pointer is + * some memory allocated by the extension. + */ + if (type == GenericEvent && dpy->generic_event_vec[extension & 0x7F]) { + XGenericEventCookie *cookie = &qelt->event.xcookie; + (*dpy->generic_event_vec[extension & 0x7F])(dpy, cookie, event); + cookie->cookie = ++dpy->next_cookie; + + qelt->qserial_num = dpy->next_event_serial_num++; + if (dpy->tail) dpy->tail->next = qelt; + else dpy->head = qelt; + + dpy->tail = qelt; + dpy->qlen++; + } else if ((*dpy->event_vec[type])(dpy, &qelt->event, event)) { + qelt->qserial_num = dpy->next_event_serial_num++; + if (dpy->tail) dpy->tail->next = qelt; + else dpy->head = qelt; + + dpy->tail = qelt; + dpy->qlen++; + } else { + /* ignored, or stashed away for many-to-one compression */ + qelt->next = dpy->qfree; + dpy->qfree = qelt; + } +} + +/* + * _XDeq - Remove event packet from the display's queue. + */ +void _XDeq( + register Display *dpy, + register _XQEvent *prev, /* element before qelt */ + register _XQEvent *qelt) /* element to be unlinked */ +{ + if (prev) { + if ((prev->next = qelt->next) == NULL) + dpy->tail = prev; + } else { + /* no prev, so removing first elt */ + if ((dpy->head = qelt->next) == NULL) + dpy->tail = NULL; + } + qelt->qserial_num = 0; + qelt->next = dpy->qfree; + dpy->qfree = qelt; + dpy->qlen--; + + if (_XIsEventCookie(dpy, &qelt->event)) { + XGenericEventCookie* cookie = &qelt->event.xcookie; + /* dpy->qfree is re-used, reset memory to avoid double free on + * _XFreeDisplayStructure */ + cookie->data = NULL; + } +} + +/* + * EventToWire in separate file in that often not needed. + */ + +/*ARGSUSED*/ +Bool +_XUnknownWireEvent( + register Display *dpy, /* pointer to display structure */ + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event) /* wire protocol event */ +{ +#ifdef notdef + (void) fprintf(stderr, + "Xlib: unhandled wire event! event number = %d, display = %x\n.", + event->u.u.type, dpy); +#endif + return(False); +} + +Bool +_XUnknownWireEventCookie( + Display *dpy, /* pointer to display structure */ + XGenericEventCookie *re, /* pointer to where event should be reformatted */ + xEvent *event) /* wire protocol event */ +{ +#ifdef notdef + fprintf(stderr, + "Xlib: unhandled wire cookie event! extension number = %d, display = %x\n.", + ((xGenericEvent*)event)->extension, dpy); +#endif + return(False); +} + +Bool +_XUnknownCopyEventCookie( + Display *dpy, /* pointer to display structure */ + XGenericEventCookie *in, /* source */ + XGenericEventCookie *out) /* destination */ +{ +#ifdef notdef + fprintf(stderr, + "Xlib: unhandled cookie event copy! extension number = %d, display = %x\n.", + in->extension, dpy); +#endif + return(False); +} + +/*ARGSUSED*/ +Status +_XUnknownNativeEvent( + register Display *dpy, /* pointer to display structure */ + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event) /* wire protocol event */ +{ +#ifdef notdef + (void) fprintf(stderr, + "Xlib: unhandled native event! event number = %d, display = %x\n.", + re->type, dpy); +#endif + return(0); +} +/* + * reformat a wire event into an XEvent structure of the right type. + */ +Bool +_XWireToEvent( + register Display *dpy, /* pointer to display structure */ + register XEvent *re, /* pointer to where event should be reformatted */ + register xEvent *event) /* wire protocol event */ +{ + + re->type = event->u.u.type & 0x7f; + ((XAnyEvent *)re)->serial = _XSetLastRequestRead(dpy, + (xGenericReply *)event); + ((XAnyEvent *)re)->send_event = ((event->u.u.type & 0x80) != 0); + ((XAnyEvent *)re)->display = dpy; + + /* Ignore the leading bit of the event type since it is set when a + client sends an event rather than the server. */ + + switch (event-> u.u.type & 0177) { + case KeyPress: + case KeyRelease: + { + register XKeyEvent *ev = (XKeyEvent*) re; + ev->root = event->u.keyButtonPointer.root; + ev->window = event->u.keyButtonPointer.event; + ev->subwindow = event->u.keyButtonPointer.child; + ev->time = event->u.keyButtonPointer.time; + ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); + ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); + ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); + ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); + ev->state = event->u.keyButtonPointer.state; + ev->same_screen = event->u.keyButtonPointer.sameScreen; + ev->keycode = event->u.u.detail; + } + break; + case ButtonPress: + case ButtonRelease: + { + register XButtonEvent *ev = (XButtonEvent *) re; + ev->root = event->u.keyButtonPointer.root; + ev->window = event->u.keyButtonPointer.event; + ev->subwindow = event->u.keyButtonPointer.child; + ev->time = event->u.keyButtonPointer.time; + ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); + ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); + ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); + ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); + ev->state = event->u.keyButtonPointer.state; + ev->same_screen = event->u.keyButtonPointer.sameScreen; + ev->button = event->u.u.detail; + } + break; + case MotionNotify: + { + register XMotionEvent *ev = (XMotionEvent *)re; + ev->root = event->u.keyButtonPointer.root; + ev->window = event->u.keyButtonPointer.event; + ev->subwindow = event->u.keyButtonPointer.child; + ev->time = event->u.keyButtonPointer.time; + ev->x = cvtINT16toInt(event->u.keyButtonPointer.eventX); + ev->y = cvtINT16toInt(event->u.keyButtonPointer.eventY); + ev->x_root = cvtINT16toInt(event->u.keyButtonPointer.rootX); + ev->y_root = cvtINT16toInt(event->u.keyButtonPointer.rootY); + ev->state = event->u.keyButtonPointer.state; + ev->same_screen = event->u.keyButtonPointer.sameScreen; + ev->is_hint = event->u.u.detail; + } + break; + case EnterNotify: + case LeaveNotify: + { + register XCrossingEvent *ev = (XCrossingEvent *) re; + ev->root = event->u.enterLeave.root; + ev->window = event->u.enterLeave.event; + ev->subwindow = event->u.enterLeave.child; + ev->time = event->u.enterLeave.time; + ev->x = cvtINT16toInt(event->u.enterLeave.eventX); + ev->y = cvtINT16toInt(event->u.enterLeave.eventY); + ev->x_root = cvtINT16toInt(event->u.enterLeave.rootX); + ev->y_root = cvtINT16toInt(event->u.enterLeave.rootY); + ev->state = event->u.enterLeave.state; + ev->mode = event->u.enterLeave.mode; + ev->same_screen = (event->u.enterLeave.flags & + ELFlagSameScreen) && True; + ev->focus = (event->u.enterLeave.flags & + ELFlagFocus) && True; + ev->detail = event->u.u.detail; + } + break; + case FocusIn: + case FocusOut: + { + register XFocusChangeEvent *ev = (XFocusChangeEvent *) re; + ev->window = event->u.focus.window; + ev->mode = event->u.focus.mode; + ev->detail = event->u.u.detail; + } + break; + case KeymapNotify: + { + register XKeymapEvent *ev = (XKeymapEvent *) re; + ev->window = None; + memcpy(&ev->key_vector[1], + (char *)((xKeymapEvent *) event)->map, + sizeof (((xKeymapEvent *) event)->map)); + } + break; + case Expose: + { + register XExposeEvent *ev = (XExposeEvent *) re; + ev->window = event->u.expose.window; + ev->x = event->u.expose.x; + ev->y = event->u.expose.y; + ev->width = event->u.expose.width; + ev->height = event->u.expose.height; + ev->count = event->u.expose.count; + } + break; + case GraphicsExpose: + { + register XGraphicsExposeEvent *ev = + (XGraphicsExposeEvent *) re; + ev->drawable = event->u.graphicsExposure.drawable; + ev->x = event->u.graphicsExposure.x; + ev->y = event->u.graphicsExposure.y; + ev->width = event->u.graphicsExposure.width; + ev->height = event->u.graphicsExposure.height; + ev->count = event->u.graphicsExposure.count; + ev->major_code = event->u.graphicsExposure.majorEvent; + ev->minor_code = event->u.graphicsExposure.minorEvent; + } + break; + case NoExpose: + { + register XNoExposeEvent *ev = (XNoExposeEvent *) re; + ev->drawable = event->u.noExposure.drawable; + ev->major_code = event->u.noExposure.majorEvent; + ev->minor_code = event->u.noExposure.minorEvent; + } + break; + case VisibilityNotify: + { + register XVisibilityEvent *ev = (XVisibilityEvent *) re; + ev->window = event->u.visibility.window; + ev->state = event->u.visibility.state; + } + break; + case CreateNotify: + { + register XCreateWindowEvent *ev = + (XCreateWindowEvent *) re; + ev->window = event->u.createNotify.window; + ev->parent = event->u.createNotify.parent; + ev->x = cvtINT16toInt(event->u.createNotify.x); + ev->y = cvtINT16toInt(event->u.createNotify.y); + ev->width = event->u.createNotify.width; + ev->height = event->u.createNotify.height; + ev->border_width = event->u.createNotify.borderWidth; + ev->override_redirect = event->u.createNotify.override; + } + break; + case DestroyNotify: + { + register XDestroyWindowEvent *ev = + (XDestroyWindowEvent *) re; + ev->window = event->u.destroyNotify.window; + ev->event = event->u.destroyNotify.event; + } + break; + case UnmapNotify: + { + register XUnmapEvent *ev = (XUnmapEvent *) re; + ev->window = event->u.unmapNotify.window; + ev->event = event->u.unmapNotify.event; + ev->from_configure = event->u.unmapNotify.fromConfigure; + } + break; + case MapNotify: + { + register XMapEvent *ev = (XMapEvent *) re; + ev->window = event->u.mapNotify.window; + ev->event = event->u.mapNotify.event; + ev->override_redirect = event->u.mapNotify.override; + } + break; + case MapRequest: + { + register XMapRequestEvent *ev = (XMapRequestEvent *) re; + ev->window = event->u.mapRequest.window; + ev->parent = event->u.mapRequest.parent; + } + break; + case ReparentNotify: + { + register XReparentEvent *ev = (XReparentEvent *) re; + ev->event = event->u.reparent.event; + ev->window = event->u.reparent.window; + ev->parent = event->u.reparent.parent; + ev->x = cvtINT16toInt(event->u.reparent.x); + ev->y = cvtINT16toInt(event->u.reparent.y); + ev->override_redirect = event->u.reparent.override; + } + break; + case ConfigureNotify: + { + register XConfigureEvent *ev = (XConfigureEvent *) re; + ev->event = event->u.configureNotify.event; + ev->window = event->u.configureNotify.window; + ev->above = event->u.configureNotify.aboveSibling; + ev->x = cvtINT16toInt(event->u.configureNotify.x); + ev->y = cvtINT16toInt(event->u.configureNotify.y); + ev->width = event->u.configureNotify.width; + ev->height = event->u.configureNotify.height; + ev->border_width = event->u.configureNotify.borderWidth; + ev->override_redirect = event->u.configureNotify.override; + } + break; + case ConfigureRequest: + { + register XConfigureRequestEvent *ev = + (XConfigureRequestEvent *) re; + ev->window = event->u.configureRequest.window; + ev->parent = event->u.configureRequest.parent; + ev->above = event->u.configureRequest.sibling; + ev->x = cvtINT16toInt(event->u.configureRequest.x); + ev->y = cvtINT16toInt(event->u.configureRequest.y); + ev->width = event->u.configureRequest.width; + ev->height = event->u.configureRequest.height; + ev->border_width = event->u.configureRequest.borderWidth; + ev->value_mask = event->u.configureRequest.valueMask; + ev->detail = event->u.u.detail; + } + break; + case GravityNotify: + { + register XGravityEvent *ev = (XGravityEvent *) re; + ev->window = event->u.gravity.window; + ev->event = event->u.gravity.event; + ev->x = cvtINT16toInt(event->u.gravity.x); + ev->y = cvtINT16toInt(event->u.gravity.y); + } + break; + case ResizeRequest: + { + register XResizeRequestEvent *ev = + (XResizeRequestEvent *) re; + ev->window = event->u.resizeRequest.window; + ev->width = event->u.resizeRequest.width; + ev->height = event->u.resizeRequest.height; + } + break; + case CirculateNotify: + { + register XCirculateEvent *ev = (XCirculateEvent *) re; + ev->window = event->u.circulate.window; + ev->event = event->u.circulate.event; + ev->place = event->u.circulate.place; + } + break; + case CirculateRequest: + { + register XCirculateRequestEvent *ev = + (XCirculateRequestEvent *) re; + ev->window = event->u.circulate.window; + ev->parent = event->u.circulate.event; + ev->place = event->u.circulate.place; + } + break; + case PropertyNotify: + { + register XPropertyEvent *ev = (XPropertyEvent *) re; + ev->window = event->u.property.window; + ev->atom = event->u.property.atom; + ev->time = event->u.property.time; + ev->state = event->u.property.state; + } + break; + case SelectionClear: + { + register XSelectionClearEvent *ev = + (XSelectionClearEvent *) re; + ev->window = event->u.selectionClear.window; + ev->selection = event->u.selectionClear.atom; + ev->time = event->u.selectionClear.time; + } + break; + case SelectionRequest: + { + register XSelectionRequestEvent *ev = + (XSelectionRequestEvent *) re; + ev->owner = event->u.selectionRequest.owner; + ev->requestor = event->u.selectionRequest.requestor; + ev->selection = event->u.selectionRequest.selection; + ev->target = event->u.selectionRequest.target; + ev->property = event->u.selectionRequest.property; + ev->time = event->u.selectionRequest.time; + } + break; + case SelectionNotify: + { + register XSelectionEvent *ev = (XSelectionEvent *) re; + ev->requestor = event->u.selectionNotify.requestor; + ev->selection = event->u.selectionNotify.selection; + ev->target = event->u.selectionNotify.target; + ev->property = event->u.selectionNotify.property; + ev->time = event->u.selectionNotify.time; + } + break; + case ColormapNotify: + { + register XColormapEvent *ev = (XColormapEvent *) re; + ev->window = event->u.colormap.window; + ev->colormap = event->u.colormap.colormap; + ev->new = event->u.colormap.new; + ev->state = event->u.colormap.state; + } + break; + case ClientMessage: + { + register int i; + register XClientMessageEvent *ev + = (XClientMessageEvent *) re; + ev->window = event->u.clientMessage.window; + ev->format = event->u.u.detail; + switch (ev->format) { + case 8: + ev->message_type = event->u.clientMessage.u.b.type; + for (i = 0; i < 20; i++) + ev->data.b[i] = event->u.clientMessage.u.b.bytes[i]; + break; + case 16: + ev->message_type = event->u.clientMessage.u.s.type; + ev->data.s[0] = cvtINT16toShort(event->u.clientMessage.u.s.shorts0); + ev->data.s[1] = cvtINT16toShort(event->u.clientMessage.u.s.shorts1); + ev->data.s[2] = cvtINT16toShort(event->u.clientMessage.u.s.shorts2); + ev->data.s[3] = cvtINT16toShort(event->u.clientMessage.u.s.shorts3); + ev->data.s[4] = cvtINT16toShort(event->u.clientMessage.u.s.shorts4); + ev->data.s[5] = cvtINT16toShort(event->u.clientMessage.u.s.shorts5); + ev->data.s[6] = cvtINT16toShort(event->u.clientMessage.u.s.shorts6); + ev->data.s[7] = cvtINT16toShort(event->u.clientMessage.u.s.shorts7); + ev->data.s[8] = cvtINT16toShort(event->u.clientMessage.u.s.shorts8); + ev->data.s[9] = cvtINT16toShort(event->u.clientMessage.u.s.shorts9); + break; + case 32: + ev->message_type = event->u.clientMessage.u.l.type; + ev->data.l[0] = cvtINT32toLong(event->u.clientMessage.u.l.longs0); + ev->data.l[1] = cvtINT32toLong(event->u.clientMessage.u.l.longs1); + ev->data.l[2] = cvtINT32toLong(event->u.clientMessage.u.l.longs2); + ev->data.l[3] = cvtINT32toLong(event->u.clientMessage.u.l.longs3); + ev->data.l[4] = cvtINT32toLong(event->u.clientMessage.u.l.longs4); + break; + default: /* XXX should never occur */ + break; + } + } + break; + case MappingNotify: + { + register XMappingEvent *ev = (XMappingEvent *)re; + ev->window = 0; + ev->first_keycode = event->u.mappingNotify.firstKeyCode; + ev->request = event->u.mappingNotify.request; + ev->count = event->u.mappingNotify.count; + } + break; + default: + return(_XUnknownWireEvent(dpy, re, event)); + } + return(True); +} + + +/* + * _XDefaultIOError - Default fatal system error reporting routine. Called + * when an X internal system error is encountered. + */ +int _XDefaultIOError( + Display *dpy) +{ + if (ECHECK(EPIPE)) { + (void) fprintf (stderr, + "X connection to %s broken (explicit kill or server shutdown).\r\n", + DisplayString (dpy)); + } else { + (void) fprintf (stderr, + "XIO: fatal IO error %d (%s) on X server \"%s\"\r\n", +#ifdef WIN32 + WSAGetLastError(), strerror(WSAGetLastError()), +#else + errno, strerror (errno), +#endif + DisplayString (dpy)); + (void) fprintf (stderr, + " after %lu requests (%lu known processed) with %d events remaining.\r\n", + NextRequest(dpy) - 1, LastKnownRequestProcessed(dpy), + QLength(dpy)); + + } +#ifdef NX_TRANS_SOCKET + if (_NXHandleDisplayError == 1) + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XDefaultIOError: Going to return from the error handler.\n"); +#endif + return 0; + } + else + { +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XDefaultIOError: Going to exit from the program.\n"); +#endif +#ifdef NX_TRANS_EXIT + NXTransExit(1); +#else + exit(1); +#endif + } +#else + exit(1); +#endif /* #ifdef NX_TRANS_SOCKET */ + /*NOTREACHED*/ +} + + +static int _XPrintDefaultError( + Display *dpy, + XErrorEvent *event, + FILE *fp) +{ + char buffer[BUFSIZ]; + char mesg[BUFSIZ]; + char number[32]; + const char *mtype = "XlibMessage"; + register _XExtension *ext = (_XExtension *)NULL; + _XExtension *bext = (_XExtension *)NULL; + XGetErrorText(dpy, event->error_code, buffer, BUFSIZ); + XGetErrorDatabaseText(dpy, mtype, "XError", "X Error", mesg, BUFSIZ); + (void) fprintf(fp, "%s: %s\n ", mesg, buffer); + XGetErrorDatabaseText(dpy, mtype, "MajorCode", "Request Major code %d", + mesg, BUFSIZ); + (void) fprintf(fp, mesg, event->request_code); + if (event->request_code < 128) { + snprintf(number, sizeof(number), "%d", event->request_code); + XGetErrorDatabaseText(dpy, "XRequest", number, "", buffer, BUFSIZ); + } else { + for (ext = dpy->ext_procs; + ext && (ext->codes.major_opcode != event->request_code); + ext = ext->next) + ; + if (ext) { + strncpy(buffer, ext->name, BUFSIZ); + buffer[BUFSIZ - 1] = '\0'; + } else + buffer[0] = '\0'; + } + (void) fprintf(fp, " (%s)\n", buffer); + if (event->request_code >= 128) { + XGetErrorDatabaseText(dpy, mtype, "MinorCode", "Request Minor code %d", + mesg, BUFSIZ); + fputs(" ", fp); + (void) fprintf(fp, mesg, event->minor_code); + if (ext) { + snprintf(mesg, sizeof(mesg), "%s.%d", ext->name, event->minor_code); + XGetErrorDatabaseText(dpy, "XRequest", mesg, "", buffer, BUFSIZ); + (void) fprintf(fp, " (%s)", buffer); + } + fputs("\n", fp); + } + if (event->error_code >= 128) { + /* kludge, try to find the extension that caused it */ + buffer[0] = '\0'; + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->error_string) + (*ext->error_string)(dpy, event->error_code, &ext->codes, + buffer, BUFSIZ); + if (buffer[0]) { + bext = ext; + break; + } + if (ext->codes.first_error && + ext->codes.first_error < (int)event->error_code && + (!bext || ext->codes.first_error > bext->codes.first_error)) + bext = ext; + } + if (bext) + snprintf(buffer, sizeof(buffer), "%s.%d", bext->name, + event->error_code - bext->codes.first_error); + else + strcpy(buffer, "Value"); + XGetErrorDatabaseText(dpy, mtype, buffer, "", mesg, BUFSIZ); + if (mesg[0]) { + fputs(" ", fp); + (void) fprintf(fp, mesg, event->resourceid); + fputs("\n", fp); + } + /* let extensions try to print the values */ + for (ext = dpy->ext_procs; ext; ext = ext->next) { + if (ext->error_values) + (*ext->error_values)(dpy, event, fp); + } + } else if ((event->error_code == BadWindow) || + (event->error_code == BadPixmap) || + (event->error_code == BadCursor) || + (event->error_code == BadFont) || + (event->error_code == BadDrawable) || + (event->error_code == BadColor) || + (event->error_code == BadGC) || + (event->error_code == BadIDChoice) || + (event->error_code == BadValue) || + (event->error_code == BadAtom)) { + if (event->error_code == BadValue) + XGetErrorDatabaseText(dpy, mtype, "Value", "Value 0x%x", + mesg, BUFSIZ); + else if (event->error_code == BadAtom) + XGetErrorDatabaseText(dpy, mtype, "AtomID", "AtomID 0x%x", + mesg, BUFSIZ); + else + XGetErrorDatabaseText(dpy, mtype, "ResourceID", "ResourceID 0x%x", + mesg, BUFSIZ); + fputs(" ", fp); + (void) fprintf(fp, mesg, event->resourceid); + fputs("\n", fp); + } + XGetErrorDatabaseText(dpy, mtype, "ErrorSerial", "Error Serial #%d", + mesg, BUFSIZ); + fputs(" ", fp); + (void) fprintf(fp, mesg, event->serial); + XGetErrorDatabaseText(dpy, mtype, "CurrentSerial", "Current Serial #%d", + mesg, BUFSIZ); + fputs("\n ", fp); + (void) fprintf(fp, mesg, dpy->request); + fputs("\n", fp); + if (event->error_code == BadImplementation) return 0; + return 1; +} + +int _XDefaultError( + Display *dpy, + XErrorEvent *event) +{ + if (_XPrintDefaultError (dpy, event, stderr) == 0) return 0; + + /* + * Store in dpy flags that the client is exiting on an unhandled XError + * (pretend it is an IOError, since the application is dying anyway it + * does not make a difference). + * This is useful for _XReply not to hang if the application makes Xlib + * calls in _fini as part of process termination. + */ + dpy->flags |= XlibDisplayIOError; + + exit(1); + /*NOTREACHED*/ +} + +/*ARGSUSED*/ +Bool _XDefaultWireError(Display *display, XErrorEvent *he, xError *we) +{ + return True; +} + +/* + * _XError - upcall internal or user protocol error handler + */ +int _XError ( + Display *dpy, + register xError *rep) +{ + /* + * X_Error packet encountered! We need to unpack the error before + * giving it to the user. + */ + XEvent event; /* make it a large event */ + register _XAsyncHandler *async, *next; + + event.xerror.serial = _XSetLastRequestRead(dpy, (xGenericReply *)rep); + + for (async = dpy->async_handlers; async; async = next) { + next = async->next; + if ((*async->handler)(dpy, (xReply *)rep, + (char *)rep, SIZEOF(xError), async->data)) + return 0; + } + + event.xerror.display = dpy; + event.xerror.type = X_Error; + event.xerror.resourceid = rep->resourceID; + event.xerror.error_code = rep->errorCode; + event.xerror.request_code = rep->majorCode; + event.xerror.minor_code = rep->minorCode; + if (dpy->error_vec && + !(*dpy->error_vec[rep->errorCode])(dpy, &event.xerror, rep)) + return 0; + if (_XErrorFunction != NULL) { + int rtn_val; +#if defined(XTHREADS) && !USE_XCB + if (dpy->lock) + (*dpy->lock->user_lock_display)(dpy); + UnlockDisplay(dpy); +#endif /* XTHREADS && !USE_XCB */ + rtn_val = (*_XErrorFunction)(dpy, (XErrorEvent *)&event); /* upcall */ +#if defined(XTHREADS) && !USE_XCB + LockDisplay(dpy); + if (dpy->lock) + (*dpy->lock->user_unlock_display)(dpy); +#endif /* XTHREADS && !USE_XCB */ + return rtn_val; + } else { + return _XDefaultError(dpy, (XErrorEvent *)&event); + } +} + +/* + * _XIOError - call user connection error handler and exit + */ +int +_XIOError ( + Display *dpy) +{ + dpy->flags |= XlibDisplayIOError; +#ifdef WIN32 + errno = WSAGetLastError(); +#endif + + /* This assumes that the thread calling exit will call any atexit handlers. + * If this does not hold, then an alternate solution would involve + * registering an atexit handler to take over the lock, which would only + * assume that the same thread calls all the atexit handlers. */ +#ifdef XTHREADS + if (dpy->lock) + (*dpy->lock->user_lock_display)(dpy); +#endif + UnlockDisplay(dpy); + + if (_XIOErrorFunction != NULL) + (*_XIOErrorFunction)(dpy); + else + _XDefaultIOError(dpy); +#ifdef NX_TRANS_SOCKET + /* + * Check if we are supposed to return in the case + * of a display failure. The client which originated + * the X operation will have to check the value of + * the XlibDisplayIOError flag and handle appropria- + * tely the display disconnection. + */ + + if (_NXHandleDisplayError == 0) + { +#ifdef NX_TRANS_EXIT + NXTransExit(1); +#else + exit(1); +#endif + } + + /* + * We are going to return. Reset the display + * buffers. Further writes will be discarded. + */ + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XIOError: Resetting the display buffer.\n"); +#endif + + dpy->bufptr = dpy->buffer; + dpy->last_req = (char *) &_dummy_request; + +#ifdef NX_TRANS_TEST + fprintf(stderr, "_XIOError: Resetting the display flags.\n"); +#endif + + dpy->flags &= ~XlibDisplayProcConni; + dpy->flags &= ~XlibDisplayPrivSync; + dpy->flags &= ~XlibDisplayReadEvents; + dpy->flags &= ~XlibDisplayWriting; + dpy->flags &= ~XlibDisplayReply; + /* shut up the compiler by returning something */ + return 0; +#else + exit (1); +#endif + /*NOTREACHED*/ +} + + +/* + * This routine can be used to (cheaply) get some memory within a single + * Xlib routine for scratch space. A single buffer is reused each time + * if possible. To be MT safe, you can only call this between a call to + * GetReq* and a call to Data* or _XSend*, or in a context when the thread + * is guaranteed to not unlock the display. + */ +char *_XAllocScratch( + register Display *dpy, + unsigned long nbytes) +{ + if (nbytes > dpy->scratch_length) { + Xfree (dpy->scratch_buffer); + dpy->scratch_buffer = Xmalloc(nbytes); + if (dpy->scratch_buffer) + dpy->scratch_length = nbytes; + else dpy->scratch_length = 0; + } + return (dpy->scratch_buffer); +} + +/* + * Scratch space allocator you can call any time, multiple times, and be + * MT safe, but you must hand the buffer back with _XFreeTemp. + */ +char *_XAllocTemp( + register Display *dpy, + unsigned long nbytes) +{ + char *buf; + + buf = _XAllocScratch(dpy, nbytes); + dpy->scratch_buffer = NULL; + dpy->scratch_length = 0; + return buf; +} + +void _XFreeTemp( + register Display *dpy, + char *buf, + unsigned long nbytes) +{ + + Xfree(dpy->scratch_buffer); + dpy->scratch_buffer = buf; + dpy->scratch_length = nbytes; +} + +/* + * Given a visual id, find the visual structure for this id on this display. + */ +Visual *_XVIDtoVisual( + Display *dpy, + VisualID id) +{ + register int i, j, k; + register Screen *sp; + register Depth *dp; + register Visual *vp; + for (i = 0; i < dpy->nscreens; i++) { + sp = &dpy->screens[i]; + for (j = 0; j < sp->ndepths; j++) { + dp = &sp->depths[j]; + /* if nvisuals == 0 then visuals will be NULL */ + for (k = 0; k < dp->nvisuals; k++) { + vp = &dp->visuals[k]; + if (vp->visualid == id) return (vp); + } + } + } + return (NULL); +} + +int +XFree (void *data) +{ + Xfree (data); + return 1; +} + +#ifdef _XNEEDBCOPYFUNC +void _Xbcopy(b1, b2, length) + register char *b1, *b2; + register length; +{ + if (b1 < b2) { + b2 += length; + b1 += length; + while (length--) + *--b2 = *--b1; + } else { + while (length--) + *b2++ = *b1++; + } +} +#endif + +#ifdef DataRoutineIsProcedure +void Data( + Display *dpy, + _Xconst char *data, + long len) +{ + if (dpy->bufptr + (len) <= dpy->bufmax) { + memcpy(dpy->bufptr, data, (int)len); + dpy->bufptr += ((len) + 3) & ~3; + } else { + _XSend(dpy, data, len); + } +} +#endif /* DataRoutineIsProcedure */ + + +#ifdef LONG64 +int +_XData32( + Display *dpy, + register _Xconst long *data, + unsigned len) +{ + register int *buf; + register long i; + + while (len) { + buf = (int *)dpy->bufptr; + i = dpy->bufmax - (char *)buf; + if (!i) { + _XFlush(dpy); + continue; + } + if (len < i) + i = len; + dpy->bufptr = (char *)buf + i; + len -= i; + i >>= 2; + while (--i >= 0) + *buf++ = *data++; + } + return 0; +} +#endif /* LONG64 */ + + + +/* Make sure this produces the same string as DefineLocal/DefineSelf in xdm. + * Otherwise, Xau will not be able to find your cookies in the Xauthority file. + * + * Note: POSIX says that the ``nodename'' member of utsname does _not_ have + * to have sufficient information for interfacing to the network, + * and so, you may be better off using gethostname (if it exists). + */ + +#if defined(_POSIX_SOURCE) || defined(SVR4) +#define NEED_UTSNAME +#include +#else +#ifdef HAVE_UNISTD_H +#include +#endif +#endif + +/* + * _XGetHostname - similar to gethostname but allows special processing. + */ +int _XGetHostname ( + char *buf, + int maxlen) +{ + int len; + +#ifdef NEED_UTSNAME + struct utsname name; + + if (maxlen <= 0 || buf == NULL) + return 0; + + uname (&name); + len = strlen (name.nodename); + if (len >= maxlen) len = maxlen - 1; + strncpy (buf, name.nodename, len); + buf[len] = '\0'; +#else + if (maxlen <= 0 || buf == NULL) + return 0; + + buf[0] = '\0'; + (void) gethostname (buf, maxlen); + buf [maxlen - 1] = '\0'; + len = strlen(buf); +#endif /* NEED_UTSNAME */ + return len; +} + + +/* + * _XScreenOfWindow - get the Screen of a given window + */ + +Screen *_XScreenOfWindow(Display *dpy, Window w) +{ + register int i; + Window root; + int x, y; /* dummy variables */ + unsigned int width, height, bw, depth; /* dummy variables */ + + if (XGetGeometry (dpy, w, &root, &x, &y, &width, &height, + &bw, &depth) == False) { + return NULL; + } + for (i = 0; i < ScreenCount (dpy); i++) { /* find root from list */ + if (root == RootWindow (dpy, i)) { + return ScreenOfDisplay (dpy, i); + } + } + return NULL; +} + +/* + * WARNING: This implementation's pre-conditions and post-conditions + * must remain compatible with the old macro-based implementations of + * GetReq, GetReqExtra, GetResReq, and GetEmptyReq. The portions of the + * Display structure affected by those macros are part of libX11's + * ABI. + */ +void *_XGetRequest(Display *dpy, CARD8 type, size_t len) +{ + xReq *req; + + if (dpy->bufptr + len > dpy->bufmax) + _XFlush(dpy); + /* Request still too large, so do not allow it to overflow. */ + if (dpy->bufptr + len > dpy->bufmax) { + fprintf(stderr, + "Xlib: request %d length %zd would exceed buffer size.\n", + type, len); + /* Changes failure condition from overflow to NULL dereference. */ + return NULL; + } + + if (len % 4) + fprintf(stderr, + "Xlib: request %d length %zd not a multiple of 4.\n", + type, len); + + dpy->last_req = dpy->bufptr; + + req = (xReq*)dpy->bufptr; + req->reqType = type; + req->length = len / 4; + dpy->bufptr += len; + dpy->request++; + return req; +} + +#if defined(WIN32) + +/* + * These functions are intended to be used internally to Xlib only. + * These functions will always prefix the path with a DOS drive in the + * form ":". As such, these functions are only suitable + * for use by Xlib function that supply a root-based path to some + * particular file, e.g. /lib/X11/locale/locale.dir will + * be converted to "C:/usr/X11R6.3/lib/X11/locale/locale.dir". + */ + +static int access_file (path, pathbuf, len_pathbuf, pathret) + char* path; + char* pathbuf; + int len_pathbuf; + char** pathret; +{ + if (access (path, F_OK) == 0) { + if (strlen (path) < len_pathbuf) + *pathret = pathbuf; + else + *pathret = Xmalloc (strlen (path) + 1); + if (*pathret) { + strcpy (*pathret, path); + return 1; + } + } + return 0; +} + +static int AccessFile (path, pathbuf, len_pathbuf, pathret) + char* path; + char* pathbuf; + int len_pathbuf; + char** pathret; +{ + unsigned long drives; + int i, len; + char* drive; + char buf[MAX_PATH]; + char* bufp; + + /* just try the "raw" name first and see if it works */ + if (access_file (path, pathbuf, len_pathbuf, pathret)) + return 1; + + /* try the places set in the environment */ + drive = getenv ("_XBASEDRIVE"); + if (!drive) + drive = "C:"; + len = strlen (drive) + strlen (path); + if (len < MAX_PATH) bufp = buf; + else bufp = Xmalloc (len + 1); + strcpy (bufp, drive); + strcat (bufp, path); + if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { + if (bufp != buf) Xfree (bufp); + return 1; + } + + /* one last place to look */ + drive = getenv ("HOMEDRIVE"); + if (drive) { + len = strlen (drive) + strlen (path); + if (len < MAX_PATH) bufp = buf; + else bufp = Xmalloc (len + 1); + strcpy (bufp, drive); + strcat (bufp, path); + if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { + if (bufp != buf) Xfree (bufp); + return 1; + } + } + + /* tried everywhere else, go fishing */ +#define C_DRIVE ('C' - 'A') +#define Z_DRIVE ('Z' - 'A') + /* does OS/2 (with or with gcc-emx) have getdrives? */ + drives = _getdrives (); + for (i = C_DRIVE; i <= Z_DRIVE; i++) { /* don't check on A: or B: */ + if ((1 << i) & drives) { + len = 2 + strlen (path); + if (len < MAX_PATH) bufp = buf; + else bufp = Xmalloc (len + 1); + *bufp = 'A' + i; + *(bufp + 1) = ':'; + *(bufp + 2) = '\0'; + strcat (bufp, path); + if (access_file (bufp, pathbuf, len_pathbuf, pathret)) { + if (bufp != buf) Xfree (bufp); + return 1; + } + } + } + return 0; +} + +int _XOpenFile(path, flags) + _Xconst char* path; + int flags; +{ + char buf[MAX_PATH]; + char* bufp = NULL; + int ret = -1; + UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); + + if (AccessFile (path, buf, MAX_PATH, &bufp)) + ret = open (bufp, flags); + + (void) SetErrorMode (olderror); + + if (bufp != buf) Xfree (bufp); + + return ret; +} + +int _XOpenFileMode(path, flags, mode) + _Xconst char* path; + int flags; + mode_t mode; +{ + char buf[MAX_PATH]; + char* bufp = NULL; + int ret = -1; + UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); + + if (AccessFile (path, buf, MAX_PATH, &bufp)) + ret = open (bufp, flags, mode); + + (void) SetErrorMode (olderror); + + if (bufp != buf) Xfree (bufp); + + return ret; +} + +void* _XFopenFile(path, mode) + _Xconst char* path; + _Xconst char* mode; +{ + char buf[MAX_PATH]; + char* bufp = NULL; + void* ret = NULL; + UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); + + if (AccessFile (path, buf, MAX_PATH, &bufp)) + ret = fopen (bufp, mode); + + (void) SetErrorMode (olderror); + + if (bufp != buf) Xfree (bufp); + + return ret; +} + +int _XAccessFile(path) + _Xconst char* path; +{ + char buf[MAX_PATH]; + char* bufp; + int ret = -1; + UINT olderror = SetErrorMode (SEM_FAILCRITICALERRORS); + + ret = AccessFile (path, buf, MAX_PATH, &bufp); + + (void) SetErrorMode (olderror); + + if (bufp != buf) Xfree (bufp); + + return ret; +} + +#endif + +#ifdef WIN32 +#undef _Xdebug +int _Xdebug = 0; +int *_Xdebug_p = &_Xdebug; +void (**_XCreateMutex_fn_p)(LockInfoPtr) = &_XCreateMutex_fn; +void (**_XFreeMutex_fn_p)(LockInfoPtr) = &_XFreeMutex_fn; +void (**_XLockMutex_fn_p)(LockInfoPtr +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char * /* file */ + , int /* line */ +#endif + ) = &_XLockMutex_fn; +void (**_XUnlockMutex_fn_p)(LockInfoPtr +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char * /* file */ + , int /* line */ +#endif + ) = &_XUnlockMutex_fn; +LockInfoPtr *_Xglobal_lock_p = &_Xglobal_lock; +#endif diff --git a/nx-X11/lib/src/XomGeneric.h b/nx-X11/lib/src/XomGeneric.h new file mode 100644 index 000000000..d6f182d19 --- /dev/null +++ b/nx-X11/lib/src/XomGeneric.h @@ -0,0 +1,316 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Takanori Tateno FUJITSU LIMITED + * + */ + +#ifndef _XOMGENERIC_H_ +#define _XOMGENERIC_H_ + +#include "XlcPublic.h" + +#define XOM_GENERIC(om) (&((XOMGeneric) om)->gen) +#define XOC_GENERIC(font_set) (&((XOCGeneric) font_set)->gen) + +/* For VW/UDC */ +typedef struct _CodeRangeRec { + unsigned long start; + unsigned long end; + unsigned long dmy1; + unsigned long dmy2; +} CodeRangeRec, *CodeRange; + +typedef struct _VRotateRec { + char *charset_name; /* Charset name */ + XlcSide side; /* Encoding side */ + int num_cr; + CodeRange code_range; + char *xlfd_name; + XFontStruct *font; +} VRotateRec, *VRotate; + +typedef enum { + XOMMultiByte, + XOMWideChar, + XOMUtf8String +} XOMTextType; + +typedef struct _FontDataRec { + char *name; + XlcSide side; + /* For VW/UDC */ + int scopes_num; + FontScope scopes; + char *xlfd_name; + XFontStruct *font; +} FontDataRec, *FontData; + +#define VROTATE_NONE 0 +#define VROTATE_PART 1 +#define VROTATE_ALL 2 + +typedef struct _OMDataRec { + int charset_count; + XlcCharSet *charset_list; + int font_data_count; + FontData font_data; + /* For VW/UDC */ + int substitute_num; + FontData substitute; + /* Vertical Writing */ + int vmap_num; + FontData vmap; + int vrotate_type; + int vrotate_num; + CodeRange vrotate; +} OMDataRec, *OMData; + +typedef struct _XOMGenericPart { + int data_num; + OMData data; + Bool on_demand_loading; + char *object_name; +} XOMGenericPart; + +typedef struct _XOMGenericRec { + XOMMethods methods; + XOMCoreRec core; + XOMGenericPart gen; +} XOMGenericRec, *XOMGeneric; + +/* + * XOC dependent data + */ + +typedef struct _FontSetRec { + int id; + int charset_count; + XlcCharSet *charset_list; + int font_data_count; + FontData font_data; + char *font_name; + XFontStruct *info; + XFontStruct *font; + XlcSide side; + Bool is_xchar2b; + /* For VW/UDC */ + int substitute_num; + FontData substitute; + /* Vertical Writing */ + int vpart_initialize; + int vmap_num; + FontData vmap; + int vrotate_num; + VRotate vrotate; +} FontSetRec, *FontSet; + +typedef struct _XOCGenericPart { + XlcConv mbs_to_cs; + XlcConv wcs_to_cs; + XlcConv utf8_to_cs; + int font_set_num; + FontSet font_set; +} XOCGenericPart; + +typedef struct _XOCGenericRec { + XOCMethods methods; + XOCCoreRec core; + XOCGenericPart gen; +} XOCGenericRec, *XOCGeneric; + +_XFUNCPROTOBEGIN + +extern XOM _XomGenericOpenOM( + XLCd /* lcd */, + Display* /* dpy */, + XrmDatabase /* rdb */, + _Xconst char* /* res_name */, + _Xconst char* /* res_class */ +); + +extern XlcConv _XomInitConverter( + XOC /* oc */, + XOMTextType /* type */ +); + +extern int _XomConvert( + XOC /* oc */, + XlcConv /* conv */, + XPointer* /* from */, + int* /* from_left */, + XPointer* /* to */, + int* /* to_left */, + XPointer* /* args */, + int /* num_args */ +); + +extern int +_XmbDefaultTextEscapement(XOC oc, _Xconst char *text, int length); +extern int +_XwcDefaultTextEscapement(XOC oc, _Xconst wchar_t *text, int length); +extern int +_Xutf8DefaultTextEscapement(XOC oc, _Xconst char *text, int length); +extern int +_XmbDefaultTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical); +extern int +_XwcDefaultTextExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical); +extern int +_Xutf8DefaultTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical); +extern Status +_XmbDefaultTextPerCharExtents( + XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical); +extern Status +_XwcDefaultTextPerCharExtents( + XOC oc, _Xconst wchar_t *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical); +extern Status +_Xutf8DefaultTextPerCharExtents( + XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical); +extern int +_XmbDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length); +extern int +_XwcDefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst wchar_t *text, int length); +extern int +_Xutf8DefaultDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length); +extern void +_XmbDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length); +extern void +_XwcDefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst wchar_t *text, int length); +extern void +_Xutf8DefaultDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length); + +extern int +_XmbGenericTextEscapement(XOC oc, _Xconst char *text, int length); +extern int +_XmbGenericTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical); +extern int +_Xutf8GenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length); +extern void +_Xutf8GenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length); +extern Status +_Xutf8GenericTextPerCharExtents( + XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical); +extern int +_Xutf8GenericTextExtents(XOC oc, _Xconst char *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical); +extern int +_Xutf8GenericTextEscapement(XOC oc, _Xconst char *text, int length); +extern void +_XwcGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst wchar_t *text, int length); +extern int +_XwcGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst wchar_t *text, int length); +extern Status +_XwcGenericTextPerCharExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical); +extern int +_XwcGenericTextExtents(XOC oc, _Xconst wchar_t *text, int length, + XRectangle *overall_ink, XRectangle *overall_logical); +extern int +_XwcGenericTextEscapement(XOC oc, _Xconst wchar_t *text, int length); +extern void +_XmbGenericDrawImageString(Display *dpy, Drawable d, XOC oc, GC gc, int x, + int y, _Xconst char *text, int length); +extern int +_XmbGenericDrawString(Display *dpy, Drawable d, XOC oc, GC gc, int x, int y, + _Xconst char *text, int length); +extern Status +_XmbGenericTextPerCharExtents(XOC oc, _Xconst char *text, int length, + XRectangle *ink_buf, XRectangle *logical_buf, + int buf_size, int *num_chars, + XRectangle *overall_ink, + XRectangle *overall_logical); + +extern FontData +read_EncodingInfo( + int count, + char **value); + +extern int +_XomGenericDrawString( + Display *dpy, + Drawable d, + XOC oc, + GC gc, + int x, int y, + XOMTextType type, + XPointer text, + int length); +extern int +_XomGenericTextExtents( + XOC oc, + XOMTextType type, + XPointer text, + int length, + XRectangle *overall_ink, + XRectangle *overall_logical); +extern FontData +_XomGetFontDataFromFontSet( + FontSet fs, + unsigned char *str, + int len, + int *len_ret, + int is2b, + int type); + +_XFUNCPROTOEND + +#endif /* _XOMGENERIC_H_ */ diff --git a/nx-X11/lib/src/Xprivate.h b/nx-X11/lib/src/Xprivate.h new file mode 100644 index 000000000..2dd62ce7d --- /dev/null +++ b/nx-X11/lib/src/Xprivate.h @@ -0,0 +1,30 @@ +/* Copyright (C) 2008 Jamey Sharp, Josh Triplett + * This file is licensed under the MIT license. See the file COPYING. + * + * As Xlibint.h has long become effectively public API, this header exists + * for new private functions that nothing outside of libX11 should call. + */ + +#ifndef XPRIVATE_H +#define XPRIVATE_H + +#include + +extern _X_HIDDEN void _XIDHandler(Display *dpy); +extern _X_HIDDEN void _XSeqSyncFunction(Display *dpy); +extern _X_HIDDEN void _XSetPrivSyncFunction(Display *dpy); +extern _X_HIDDEN void _XSetSeqSyncFunction(Display *dpy); + +#ifdef XTHREADS +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) +#define InternalLockDisplay(d,wskip) if ((d)->lock) \ + (*(d)->lock->internal_lock_display)(d,wskip,__FILE__,__LINE__) +#else +#define InternalLockDisplay(d,wskip) if ((d)->lock) \ + (*(d)->lock->internal_lock_display)(d,wskip) +#endif +#else /* XTHREADS else */ +#define InternalLockDisplay(d,wskip) +#endif /* XTHREADS else */ + +#endif /* XPRIVATE_H */ diff --git a/nx-X11/lib/src/Xresinternal.h b/nx-X11/lib/src/Xresinternal.h new file mode 100644 index 000000000..c740102b6 --- /dev/null +++ b/nx-X11/lib/src/Xresinternal.h @@ -0,0 +1,18 @@ + +#ifndef _XRESINTERNAL_H_ +#define _XRESINTERNAL_H_ + +#include +#include +#include + +/* type defines */ +typedef uint32_t Signature; + +/* prototypes */ +extern XrmQuark _XrmInternalStringToQuark( + register _Xconst char *name, register int len, register Signature sig, + Bool permstring); + +#endif /* _XRESOURCEINTERNAL_H_ */ +/* DON'T ADD STUFF AFTER THIS #endif */ diff --git a/nx-X11/lib/src/Xrm.c b/nx-X11/lib/src/Xrm.c new file mode 100644 index 000000000..e3587d021 --- /dev/null +++ b/nx-X11/lib/src/Xrm.c @@ -0,0 +1,2651 @@ + +/*********************************************************** +Copyright 1987, 1988, 1990 by Digital Equipment Corporation, Maynard + + All Rights Reserved + +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 +supporting documentation, and that the name Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ +/* + +Copyright 1987, 1988, 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlibint.h" +#include +#include "Xlcint.h" +#ifdef XTHREADS +#include "locking.h" +#endif +#include +#include +#include +#include "Xresinternal.h" +#include "Xresource.h" + +/* + +These Xrm routines allow very fast lookup of resources in the resource +database. Several usage patterns are exploited: + +(1) Widgets get a lot of resources at one time. Rather than look up each from +scratch, we can precompute the prioritized list of database levels once, then +search for each resource starting at the beginning of the list. + +(2) Many database levels don't contain any leaf resource nodes. There is no +point in looking for resources on a level that doesn't contain any. This +information is kept on a per-level basis. + +(3) Sometimes the widget instance tree is structured such that you get the same +class name repeated on the fully qualified widget name. This can result in the +same database level occuring multiple times on the search list. The code below +only checks to see if you get two identical search lists in a row, rather than +look back through all database levels, but in practice this removes all +duplicates I've ever observed. + +Joel McCormack + +*/ + +/* + +The Xrm representation has been completely redesigned to substantially reduce +memory and hopefully improve performance. + +The database is structured into two kinds of tables: LTables that contain +only values, and NTables that contain only other tables. + +Some invariants: + +The next pointer of the top-level node table points to the top-level leaf +table, if any. + +Within an LTable, for a given name, the tight value always precedes the +loose value, and if both are present the loose value is always right after +the tight value. + +Within an NTable, all of the entries for a given name are contiguous, +in the order tight NTable, loose NTable, tight LTable, loose LTable. + +Bob Scheifler + +*/ + +static XrmQuark XrmQString, XrmQANY; + +typedef Bool (*DBEnumProc)( + XrmDatabase* /* db */, + XrmBindingList /* bindings */, + XrmQuarkList /* quarks */, + XrmRepresentation* /* type */, + XrmValue* /* value */, + XPointer /* closure */ +); + +typedef struct _VEntry { + struct _VEntry *next; /* next in chain */ + XrmQuark name; /* name of this entry */ + unsigned int tight:1; /* 1 if it is a tight binding */ + unsigned int string:1; /* 1 if type is String */ + unsigned int size:30; /* size of value */ +} VEntryRec, *VEntry; + + +typedef struct _DEntry { + VEntryRec entry; /* entry */ + XrmRepresentation type; /* representation type */ +} DEntryRec, *DEntry; + +/* the value is right after the structure */ +#define StringValue(ve) (XPointer)((ve) + 1) +#define RepType(ve) ((DEntry)(ve))->type +/* the value is right after the structure */ +#define DataValue(ve) (XPointer)(((DEntry)(ve)) + 1) +#define RawValue(ve) (char *)((ve)->string ? StringValue(ve) : DataValue(ve)) + +typedef struct _NTable { + struct _NTable *next; /* next in chain */ + XrmQuark name; /* name of this entry */ + unsigned int tight:1; /* 1 if it is a tight binding */ + unsigned int leaf:1; /* 1 if children are values */ + unsigned int hasloose:1; /* 1 if has loose children */ + unsigned int hasany:1; /* 1 if has ANY entry */ + unsigned int pad:4; /* unused */ + unsigned int mask:8; /* hash size - 1 */ + unsigned int entries:16; /* number of children */ +} NTableRec, *NTable; + +/* the buckets are right after the structure */ +#define NodeBuckets(ne) ((NTable *)((ne) + 1)) +#define NodeHash(ne,q) NodeBuckets(ne)[(q) & (ne)->mask] + +/* leaf tables have an extra level of indirection for the buckets, + * so that resizing can be done without invalidating a search list. + * This is completely ugly, and wastes some memory, but the Xlib + * spec doesn't really specify whether invalidation is OK, and the + * old implementation did not invalidate. + */ +typedef struct _LTable { + NTableRec table; + VEntry *buckets; +} LTableRec, *LTable; + +#define LeafHash(le,q) (le)->buckets[(q) & (le)->table.mask] + +/* An XrmDatabase just holds a pointer to the first top-level table. + * The type name is no longer descriptive, but better to not change + * the Xresource.h header file. This type also gets used to define + * XrmSearchList, which is a complete crock, but we'll just leave it + * and caste types as required. + */ +typedef struct _XrmHashBucketRec { + NTable table; + XPointer mbstate; + XrmMethods methods; +#ifdef XTHREADS + LockInfoRec linfo; +#endif +} XrmHashBucketRec; + +/* closure used in get/put resource */ +typedef struct _VClosure { + XrmRepresentation *type; /* type of value */ + XrmValuePtr value; /* value itself */ +} VClosureRec, *VClosure; + +/* closure used in get search list */ +typedef struct _SClosure { + LTable *list; /* search list */ + int idx; /* index of last filled element */ + int limit; /* maximum index */ +} SClosureRec, *SClosure; + +/* placed in XrmSearchList to indicate next table is loose only */ +#define LOOSESEARCH ((LTable)1) + +/* closure used in enumerate database */ +typedef struct _EClosure { + XrmDatabase db; /* the database */ + DBEnumProc proc; /* the user proc */ + XPointer closure; /* the user closure */ + XrmBindingList bindings; /* binding list */ + XrmQuarkList quarks; /* quark list */ + int mode; /* XrmEnum */ +} EClosureRec, *EClosure; + +/* types for typecasting ETable based functions to NTable based functions */ +typedef Bool (*getNTableSProcp)( + NTable table, + XrmNameList names, + XrmClassList classes, + SClosure closure); +typedef Bool (*getNTableVProcp)( + NTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure); +typedef Bool (*getNTableEProcp)( + NTable table, + XrmNameList names, + XrmClassList classes, + register int level, + EClosure closure); + +/* predicate to determine when to resize a hash table */ +#define GrowthPred(n,m) ((unsigned)(n) > (((m) + 1) << 2)) + +#define GROW(prev) \ + if (GrowthPred((*prev)->entries, (*prev)->mask)) \ + GrowTable(prev) + +/* pick a reasonable value for maximum depth of resource database */ +#define MAXDBDEPTH 100 + +/* macro used in get/search functions */ + +/* find an entry named ename, with leafness given by leaf */ +#define NFIND(ename) \ + q = ename; \ + entry = NodeHash(table, q); \ + while (entry && entry->name != q) \ + entry = entry->next; \ + if (leaf && entry && !entry->leaf) { \ + entry = entry->next; \ + if (entry && !entry->leaf) \ + entry = entry->next; \ + if (entry && entry->name != q) \ + entry = (NTable)NULL; \ + } + +/* resourceQuarks keeps track of what quarks have been associated with values + * in all LTables. If a quark has never been used in an LTable, we don't need + * to bother looking for it. + */ + +static unsigned char *resourceQuarks = (unsigned char *)NULL; +static XrmQuark maxResourceQuark = -1; + +/* determines if a quark has been used for a value in any database */ +#define IsResourceQuark(q) ((q) > 0 && (q) <= maxResourceQuark && \ + resourceQuarks[(q) >> 3] & (1 << ((q) & 7))) + +typedef unsigned char XrmBits; + +#define BSLASH ((XrmBits) (1 << 5)) +#define NORMAL ((XrmBits) (1 << 4)) +#define EOQ ((XrmBits) (1 << 3)) +#define SEP ((XrmBits) (1 << 2)) +#define ENDOF ((XrmBits) (1 << 1)) +#define SPACE (NORMAL|EOQ|SEP|(XrmBits)0) +#define RSEP (NORMAL|EOQ|SEP|(XrmBits)1) +#define EOS (EOQ|SEP|ENDOF|(XrmBits)0) +#define EOL (EOQ|SEP|ENDOF|(XrmBits)1) +#define BINDING (NORMAL|EOQ) +#define ODIGIT (NORMAL|(XrmBits)1) + +#define next_char(ch,str) xrmtypes[(unsigned char)((ch) = *(++(str)))] +#define next_mbchar(ch,len,str) xrmtypes[(unsigned char)(ch = (*db->methods->mbchar)(db->mbstate, str, &len), str += len, ch)] + +#define is_space(bits) ((bits) == SPACE) +#define is_EOQ(bits) ((bits) & EOQ) +#define is_EOF(bits) ((bits) == EOS) +#define is_EOL(bits) ((bits) & ENDOF) +#define is_binding(bits) ((bits) == BINDING) +#define is_odigit(bits) ((bits) == ODIGIT) +#define is_separator(bits) ((bits) & SEP) +#define is_nonpcs(bits) (!(bits)) +#define is_normal(bits) ((bits) & NORMAL) +#define is_simple(bits) ((bits) & (NORMAL|BSLASH)) +#define is_special(bits) ((bits) & (ENDOF|BSLASH)) + +/* parsing types */ +static XrmBits const xrmtypes[256] = { + EOS,0,0,0,0,0,0,0, + 0,SPACE,EOL,0,0, +#if defined(WIN32) + EOL, /* treat CR the same as LF, just in case */ +#else + 0, +#endif + 0,0, + 0,0,0,0,0,0,0,0, + 0,0,0,0,0,0,0,0, + SPACE,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,BINDING,NORMAL,NORMAL,NORMAL,BINDING,NORMAL, + ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT,ODIGIT, + NORMAL,NORMAL,RSEP,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,BSLASH,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL, + NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,NORMAL,0 + /* The rest will be automatically initialized to zero. */ +}; + +void XrmInitialize(void) +{ + XrmQString = XrmPermStringToQuark("String"); + XrmQANY = XrmPermStringToQuark("?"); +} + +XrmDatabase XrmGetDatabase( + Display *display) +{ + XrmDatabase retval; + LockDisplay(display); + retval = display->db; + UnlockDisplay(display); + return retval; +} + +void XrmSetDatabase( + Display *display, + XrmDatabase database) +{ + LockDisplay(display); + /* destroy database if set up implicitly by XGetDefault() */ + if (display->db && (display->flags & XlibDisplayDfltRMDB)) { + XrmDestroyDatabase(display->db); + display->flags &= ~XlibDisplayDfltRMDB; + } + display->db = database; + UnlockDisplay(display); +} + +void +XrmStringToQuarkList( + register _Xconst char *name, + register XrmQuarkList quarks) /* RETURN */ +{ + register XrmBits bits; + register Signature sig = 0; + register char ch, *tname; + register int i = 0; + + if ((tname = (char *)name)) { + tname--; + while (!is_EOF(bits = next_char(ch, tname))) { + if (is_binding (bits)) { + if (i) { + /* Found a complete name */ + *quarks++ = _XrmInternalStringToQuark(name,tname - name, + sig, False); + i = 0; + sig = 0; + } + name = tname+1; + } + else { + sig = (sig << 1) + ch; /* Compute the signature. */ + i++; + } + } + *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); + } + *quarks = NULLQUARK; +} + +void +XrmStringToBindingQuarkList( + register _Xconst char *name, + register XrmBindingList bindings, /* RETURN */ + register XrmQuarkList quarks) /* RETURN */ +{ + register XrmBits bits; + register Signature sig = 0; + register char ch, *tname; + register XrmBinding binding; + register int i = 0; + + if ((tname = (char *)name)) { + tname--; + binding = XrmBindTightly; + while (!is_EOF(bits = next_char(ch, tname))) { + if (is_binding (bits)) { + if (i) { + /* Found a complete name */ + *bindings++ = binding; + *quarks++ = _XrmInternalStringToQuark(name, tname - name, + sig, False); + + i = 0; + sig = 0; + binding = XrmBindTightly; + } + name = tname+1; + + if (ch == '*') + binding = XrmBindLoosely; + } + else { + sig = (sig << 1) + ch; /* Compute the signature. */ + i++; + } + } + *bindings = binding; + *quarks++ = _XrmInternalStringToQuark(name, tname - name, sig, False); + } + *quarks = NULLQUARK; +} + +#ifdef DEBUG + +static void PrintQuarkList( + XrmQuarkList quarks, + FILE *stream) +{ + Bool firstNameSeen; + + for (firstNameSeen = False; *quarks; quarks++) { + if (firstNameSeen) { + (void) fprintf(stream, "."); + } + firstNameSeen = True; + (void) fputs(XrmQuarkToString(*quarks), stream); + } +} /* PrintQuarkList */ + +#endif /* DEBUG */ + + +/* + * Fallback methods for Xrm parsing. + * Simulate a C locale. No state needed here. + */ + +static void +c_mbnoop( + XPointer state) +{ +} + +static char +c_mbchar( + XPointer state, + const char *str, + int *lenp) +{ + *lenp = 1; + return *str; +} + +static const char * +c_lcname( + XPointer state) +{ + return "C"; +} + +static const XrmMethodsRec mb_methods = { + c_mbnoop, /* mbinit */ + c_mbchar, /* mbchar */ + c_mbnoop, /* mbfinish */ + c_lcname, /* lcname */ + c_mbnoop /* destroy */ +}; + + +static XrmDatabase NewDatabase(void) +{ + register XrmDatabase db; + + db = Xmalloc(sizeof(XrmHashBucketRec)); + if (db) { + _XCreateMutex(&db->linfo); + db->table = (NTable)NULL; + db->mbstate = (XPointer)NULL; + db->methods = _XrmInitParseInfo(&db->mbstate); + if (!db->methods) + db->methods = &mb_methods; + } + return db; +} + +/* move all values from ftable to ttable, and free ftable's buckets. + * ttable is guaranteed empty to start with. + */ +static void MoveValues( + LTable ftable, + register LTable ttable) +{ + register VEntry fentry, nfentry; + register VEntry *prev; + register VEntry *bucket; + register VEntry tentry; + register int i; + + for (i = ftable->table.mask, bucket = ftable->buckets; i >= 0; i--) { + for (fentry = *bucket++; fentry; fentry = nfentry) { + prev = &LeafHash(ttable, fentry->name); + tentry = *prev; + *prev = fentry; + /* chain on all with same name, to preserve invariant order */ + while ((nfentry = fentry->next) && nfentry->name == fentry->name) + fentry = nfentry; + fentry->next = tentry; + } + } + Xfree(ftable->buckets); +} + +/* move all tables from ftable to ttable, and free ftable. + * ttable is quaranteed empty to start with. + */ +static void MoveTables( + NTable ftable, + register NTable ttable) +{ + register NTable fentry, nfentry; + register NTable *prev; + register NTable *bucket; + register NTable tentry; + register int i; + + for (i = ftable->mask, bucket = NodeBuckets(ftable); i >= 0; i--) { + for (fentry = *bucket++; fentry; fentry = nfentry) { + prev = &NodeHash(ttable, fentry->name); + tentry = *prev; + *prev = fentry; + /* chain on all with same name, to preserve invariant order */ + while ((nfentry = fentry->next) && nfentry->name == fentry->name) + fentry = nfentry; + fentry->next = tentry; + } + } + Xfree(ftable); +} + +/* grow the table, based on current number of entries */ +static void GrowTable( + NTable *prev) +{ + register NTable table; + register int i; + + table = *prev; + i = table->mask; + if (i == 255) /* biggest it gets */ + return; + while (i < 255 && GrowthPred(table->entries, i)) + i = (i << 1) + 1; + i++; /* i is now the new size */ + if (table->leaf) { + register LTable ltable; + LTableRec otable; + + ltable = (LTable)table; + /* cons up a copy to make MoveValues look symmetric */ + otable = *ltable; + ltable->buckets = Xcalloc(i, sizeof(VEntry)); + if (!ltable->buckets) { + ltable->buckets = otable.buckets; + return; + } + ltable->table.mask = i - 1; + MoveValues(&otable, ltable); + } else { + register NTable ntable; + + ntable = Xcalloc(1, sizeof(NTableRec) + (i * sizeof(NTable))); + if (!ntable) + return; + *ntable = *table; + ntable->mask = i - 1; + *prev = ntable; + MoveTables(table, ntable); + } +} + +/* merge values from ftable into *pprev, destroy ftable in the process */ +static void MergeValues( + LTable ftable, + NTable *pprev, + Bool override) +{ + register VEntry fentry, tentry; + register VEntry *prev; + register LTable ttable; + VEntry *bucket; + int i; + register XrmQuark q; + + ttable = (LTable)*pprev; + if (ftable->table.hasloose) + ttable->table.hasloose = 1; + for (i = ftable->table.mask, bucket = ftable->buckets; + i >= 0; + i--, bucket++) { + for (fentry = *bucket; fentry; ) { + q = fentry->name; + prev = &LeafHash(ttable, q); + tentry = *prev; + while (tentry && tentry->name != q) + tentry = *(prev = &tentry->next); + /* note: test intentionally uses fentry->name instead of q */ + /* permits serendipitous inserts */ + while (tentry && tentry->name == fentry->name) { + /* if tentry is earlier, skip it */ + if (!fentry->tight && tentry->tight) { + tentry = *(prev = &tentry->next); + continue; + } + if (fentry->tight != tentry->tight) { + /* no match, chain in fentry */ + *prev = fentry; + prev = &fentry->next; + fentry = *prev; + *prev = tentry; + ttable->table.entries++; + } else if (override) { + /* match, chain in fentry, splice out and free tentry */ + *prev = fentry; + prev = &fentry->next; + fentry = *prev; + *prev = tentry->next; + /* free the overridden entry */ + Xfree(tentry); + /* get next tentry */ + tentry = *prev; + } else { + /* match, discard fentry */ + prev = &tentry->next; + tentry = fentry; /* use as a temp var */ + fentry = fentry->next; + /* free the overpowered entry */ + Xfree(tentry); + /* get next tentry */ + tentry = *prev; + } + if (!fentry) + break; + } + /* at this point, tentry cannot match any fentry named q */ + /* chain in all bindings together, preserve invariant order */ + while (fentry && fentry->name == q) { + *prev = fentry; + prev = &fentry->next; + fentry = *prev; + *prev = tentry; + ttable->table.entries++; + } + } + } + Xfree(ftable->buckets); + Xfree(ftable); + /* resize if necessary, now that we're all done */ + GROW(pprev); +} + +/* merge tables from ftable into *pprev, destroy ftable in the process */ +static void MergeTables( + NTable ftable, + NTable *pprev, + Bool override) +{ + register NTable fentry, tentry; + NTable nfentry; + register NTable *prev; + register NTable ttable; + NTable *bucket; + int i; + register XrmQuark q; + + ttable = *pprev; + if (ftable->hasloose) + ttable->hasloose = 1; + if (ftable->hasany) + ttable->hasany = 1; + for (i = ftable->mask, bucket = NodeBuckets(ftable); + i >= 0; + i--, bucket++) { + for (fentry = *bucket; fentry; ) { + q = fentry->name; + prev = &NodeHash(ttable, q); + tentry = *prev; + while (tentry && tentry->name != q) + tentry = *(prev = &tentry->next); + /* note: test intentionally uses fentry->name instead of q */ + /* permits serendipitous inserts */ + while (tentry && tentry->name == fentry->name) { + /* if tentry is earlier, skip it */ + if ((fentry->leaf && !tentry->leaf) || + (!fentry->tight && tentry->tight && + (fentry->leaf || !tentry->leaf))) { + tentry = *(prev = &tentry->next); + continue; + } + nfentry = fentry->next; + if (fentry->leaf != tentry->leaf || + fentry->tight != tentry->tight) { + /* no match, just chain in */ + *prev = fentry; + *(prev = &fentry->next) = tentry; + ttable->entries++; + } else { + if (fentry->leaf) + MergeValues((LTable)fentry, prev, override); + else + MergeTables(fentry, prev, override); + /* bump to next tentry */ + tentry = *(prev = &(*prev)->next); + } + /* bump to next fentry */ + fentry = nfentry; + if (!fentry) + break; + } + /* at this point, tentry cannot match any fentry named q */ + /* chain in all bindings together, preserve invariant order */ + while (fentry && fentry->name == q) { + *prev = fentry; + prev = &fentry->next; + fentry = *prev; + *prev = tentry; + ttable->entries++; + } + } + } + Xfree(ftable); + /* resize if necessary, now that we're all done */ + GROW(pprev); +} + +void XrmCombineDatabase( + XrmDatabase from, XrmDatabase *into, + Bool override) +{ + register NTable *prev; + register NTable ftable, ttable, nftable; + + if (!*into) { + *into = from; + } else if (from) { + _XLockMutex(&from->linfo); + _XLockMutex(&(*into)->linfo); + if ((ftable = from->table)) { + prev = &(*into)->table; + ttable = *prev; + if (!ftable->leaf) { + nftable = ftable->next; + if (ttable && !ttable->leaf) { + /* both have node tables, merge them */ + MergeTables(ftable, prev, override); + /* bump to into's leaf table, if any */ + ttable = *(prev = &(*prev)->next); + } else { + /* into has no node table, link from's in */ + *prev = ftable; + *(prev = &ftable->next) = ttable; + } + /* bump to from's leaf table, if any */ + ftable = nftable; + } else { + /* bump to into's leaf table, if any */ + if (ttable && !ttable->leaf) + ttable = *(prev = &ttable->next); + } + if (ftable) { + /* if into has a leaf, merge, else insert */ + if (ttable) + MergeValues((LTable)ftable, prev, override); + else + *prev = ftable; + } + } + (from->methods->destroy)(from->mbstate); + _XUnlockMutex(&from->linfo); + _XFreeMutex(&from->linfo); + Xfree(from); + _XUnlockMutex(&(*into)->linfo); + } +} + +void XrmMergeDatabases( + XrmDatabase from, XrmDatabase *into) +{ + XrmCombineDatabase(from, into, True); +} + +/* store a value in the database, overriding any existing entry */ +static void PutEntry( + XrmDatabase db, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation type, + XrmValuePtr value) +{ + register NTable *pprev, *prev; + register NTable table; + register XrmQuark q; + register VEntry *vprev; + register VEntry entry; + NTable *nprev, *firstpprev; + +#define NEWTABLE(q,i) \ + table = Xmalloc(sizeof(LTableRec)); \ + if (!table) \ + return; \ + table->name = q; \ + table->hasloose = 0; \ + table->hasany = 0; \ + table->mask = 0; \ + table->entries = 0; \ + if (quarks[i]) { \ + table->leaf = 0; \ + nprev = NodeBuckets(table); \ + } else { \ + table->leaf = 1; \ + if (!(nprev = Xmalloc(sizeof(VEntry *)))) {\ + Xfree(table); \ + return; \ + } \ + ((LTable)table)->buckets = (VEntry *)nprev; \ + } \ + *nprev = (NTable)NULL; \ + table->next = *prev; \ + *prev = table + + if (!db || !*quarks) + return; + table = *(prev = &db->table); + /* if already at leaf, bump to the leaf table */ + if (!quarks[1] && table && !table->leaf) + table = *(prev = &table->next); + pprev = prev; + if (!table || (quarks[1] && table->leaf)) { + /* no top-level node table, create one and chain it in */ + NEWTABLE(NULLQUARK,1); + table->tight = 1; /* arbitrary */ + prev = nprev; + } else { + /* search along until we need a value */ + while (quarks[1]) { + q = *quarks; + table = *(prev = &NodeHash(table, q)); + while (table && table->name != q) + table = *(prev = &table->next); + if (!table) + break; /* not found */ + if (quarks[2]) { + if (table->leaf) + break; /* not found */ + } else { + if (!table->leaf) { + /* bump to leaf table, if any */ + table = *(prev = &table->next); + if (!table || table->name != q) + break; /* not found */ + if (!table->leaf) { + /* bump to leaf table, if any */ + table = *(prev = &table->next); + if (!table || table->name != q) + break; /* not found */ + } + } + } + if (*bindings == XrmBindTightly) { + if (!table->tight) + break; /* not found */ + } else { + if (table->tight) { + /* bump to loose table, if any */ + table = *(prev = &table->next); + if (!table || table->name != q || + !quarks[2] != table->leaf) + break; /* not found */ + } + } + /* found that one, bump to next quark */ + pprev = prev; + quarks++; + bindings++; + } + if (!quarks[1]) { + /* found all the way to a leaf */ + q = *quarks; + entry = *(vprev = &LeafHash((LTable)table, q)); + while (entry && entry->name != q) + entry = *(vprev = &entry->next); + /* if want loose and have tight, bump to next entry */ + if (entry && *bindings == XrmBindLoosely && entry->tight) + entry = *(vprev = &entry->next); + if (entry && entry->name == q && + (*bindings == XrmBindTightly) == entry->tight) { + /* match, need to override */ + if ((type == XrmQString) == entry->string && + entry->size == value->size) { + /* update type if not String, can be different */ + if (!entry->string) + RepType(entry) = type; + /* identical size, just overwrite value */ + memcpy(RawValue(entry), (char *)value->addr, value->size); + return; + } + /* splice out and free old entry */ + *vprev = entry->next; + Xfree(entry); + (*pprev)->entries--; + } + /* this is where to insert */ + prev = (NTable *)vprev; + } + } + /* keep the top table, because we may have to grow it */ + firstpprev = pprev; + /* iterate until we get to the leaf */ + while (quarks[1]) { + /* build a new table and chain it in */ + NEWTABLE(*quarks,2); + if (*quarks++ == XrmQANY) + (*pprev)->hasany = 1; + if (*bindings++ == XrmBindTightly) { + table->tight = 1; + } else { + table->tight = 0; + (*pprev)->hasloose = 1; + } + (*pprev)->entries++; + pprev = prev; + prev = nprev; + } + /* now allocate the value entry */ + entry = Xmalloc(((type == XrmQString) ? + sizeof(VEntryRec) : sizeof(DEntryRec)) + value->size); + if (!entry) + return; + entry->name = q = *quarks; + if (*bindings == XrmBindTightly) { + entry->tight = 1; + } else { + entry->tight = 0; + (*pprev)->hasloose = 1; + } + /* chain it in, with a bit of type cast ugliness */ + entry->next = *((VEntry *)prev); + *((VEntry *)prev) = entry; + entry->size = value->size; + if (type == XrmQString) { + entry->string = 1; + } else { + entry->string = 0; + RepType(entry) = type; + } + /* save a copy of the value */ + memcpy(RawValue(entry), (char *)value->addr, value->size); + (*pprev)->entries++; + /* this is a new leaf, need to remember it for search lists */ + if (q > maxResourceQuark) { + unsigned oldsize = (maxResourceQuark + 1) >> 3; + unsigned size = ((q | 0x7f) + 1) >> 3; /* reallocate in chunks */ + if (resourceQuarks) { + unsigned char *prevQuarks = resourceQuarks; + + resourceQuarks = Xrealloc(resourceQuarks, size); + if (!resourceQuarks) { + Xfree(prevQuarks); + } + } else + resourceQuarks = Xmalloc(size); + if (resourceQuarks) { + bzero((char *)&resourceQuarks[oldsize], size - oldsize); + maxResourceQuark = (size << 3) - 1; + } else { + maxResourceQuark = -1; + } + } + if (q > 0 && resourceQuarks) + resourceQuarks[q >> 3] |= 1 << (q & 0x7); + GROW(firstpprev); + +#undef NEWTABLE +} + +void XrmQPutResource( + XrmDatabase *pdb, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation type, + XrmValuePtr value) +{ + if (!*pdb) *pdb = NewDatabase(); + _XLockMutex(&(*pdb)->linfo); + PutEntry(*pdb, bindings, quarks, type, value); + _XUnlockMutex(&(*pdb)->linfo); +} + +void +XrmPutResource( + XrmDatabase *pdb, + _Xconst char *specifier, + _Xconst char *type, + XrmValuePtr value) +{ + XrmBinding bindings[MAXDBDEPTH+1]; + XrmQuark quarks[MAXDBDEPTH+1]; + + if (!*pdb) *pdb = NewDatabase(); + _XLockMutex(&(*pdb)->linfo); + XrmStringToBindingQuarkList(specifier, bindings, quarks); + PutEntry(*pdb, bindings, quarks, XrmStringToQuark(type), value); + _XUnlockMutex(&(*pdb)->linfo); +} + +void +XrmQPutStringResource( + XrmDatabase *pdb, + XrmBindingList bindings, + XrmQuarkList quarks, + _Xconst char *str) +{ + XrmValue value; + + if (!*pdb) *pdb = NewDatabase(); + value.addr = (XPointer) str; + value.size = strlen(str)+1; + _XLockMutex(&(*pdb)->linfo); + PutEntry(*pdb, bindings, quarks, XrmQString, &value); + _XUnlockMutex(&(*pdb)->linfo); +} + +/* Function Name: GetDatabase + * Description: Parses a string and stores it as a database. + * Arguments: db - the database. + * str - a pointer to the string containing the database. + * filename - source filename, if any. + * doall - whether to do all lines or just one + */ + +/* + * This function is highly optimized to inline as much as possible. + * Be very careful with modifications, or simplifications, as they + * may adversely affect the performance. + * + * Chris Peterson, MIT X Consortium 5/17/90. + */ + +/* + * Xlib spec says max 100 quarks in a lookup, will stop and return if + * return if any single production's lhs has more than 100 components. + */ +#define QLIST_SIZE 100 + +/* + * This should be big enough to handle things like the XKeysymDB or biggish + * ~/.Xdefaults or app-defaults files. Anything bigger will be allocated on + * the heap. + */ +#define DEF_BUFF_SIZE 8192 + +static void GetIncludeFile( + XrmDatabase db, + _Xconst char *base, + _Xconst char *fname, + int fnamelen, + int depth); + +static void GetDatabase( + XrmDatabase db, + _Xconst char *str, + _Xconst char *filename, + Bool doall, + int depth) +{ + char *rhs; + char *lhs, lhs_s[DEF_BUFF_SIZE]; + XrmQuark quarks[QLIST_SIZE + 1]; /* allow for a terminal NullQuark */ + XrmBinding bindings[QLIST_SIZE + 1]; + + register char *ptr; + register XrmBits bits = 0; + register char c; + register Signature sig; + register char *ptr_max; + register int num_quarks; + register XrmBindingList t_bindings; + + int len, alloc_chars; + unsigned long str_len; + XrmValue value; + Bool only_pcs; + Bool dolines; + + if (!db) + return; + + /* + * if strlen (str) < DEF_BUFF_SIZE allocate buffers on the stack for + * speed otherwise malloc the buffer. From a buffer overflow standpoint + * we can be sure that neither: a) a component on the lhs, or b) a + * value on the rhs, will be longer than the overall length of str, + * i.e. strlen(str). + * + * This should give good performance when parsing "*foo: bar" type + * databases as might be passed with -xrm command line options; but + * with larger databases, e.g. .Xdefaults, app-defaults, or KeysymDB + * files, the size of the buffers will be overly large. One way + * around this would be to double-parse each production with a resulting + * performance hit. In any event we can be assured that a lhs component + * name or a rhs value won't be longer than str itself. + */ + + str_len = strlen (str); + if (DEF_BUFF_SIZE > str_len) lhs = lhs_s; + else if ((lhs = Xmalloc (str_len)) == NULL) + return; + + alloc_chars = DEF_BUFF_SIZE < str_len ? str_len : DEF_BUFF_SIZE; + if ((rhs = Xmalloc (alloc_chars)) == NULL) { + if (lhs != lhs_s) Xfree (lhs); + return; + } + + (*db->methods->mbinit)(db->mbstate); + str--; + dolines = True; + while (!is_EOF(bits) && dolines) { + dolines = doall; + + /* + * First: Remove extra whitespace. + */ + + do { + bits = next_char(c, str); + } while is_space(bits); + + /* + * Ignore empty lines. + */ + + if (is_EOL(bits)) + continue; /* start a new line. */ + + /* + * Second: check the first character in a line to see if it is + * "!" signifying a comment, or "#" signifying a directive. + */ + + if (c == '!') { /* Comment, spin to next newline */ + while (is_simple(bits = next_char(c, str))) {} + if (is_EOL(bits)) + continue; + while (!is_EOL(bits = next_mbchar(c, len, str))) {} + str--; + continue; /* start a new line. */ + } + + if (c == '#') { /* Directive */ + /* remove extra whitespace */ + only_pcs = True; + while (is_space(bits = next_char(c, str))) {}; + /* only "include" directive is currently defined */ + if (!strncmp(str, "include", 7)) { + str += (7-1); + /* remove extra whitespace */ + while (is_space(bits = next_char(c, str))) {}; + /* must have a starting " */ + if (c == '"') { + _Xconst char *fname = str+1; + len = 0; + do { + if (only_pcs) { + bits = next_char(c, str); + if (is_nonpcs(bits)) + only_pcs = False; + } + if (!only_pcs) + bits = next_mbchar(c, len, str); + } while (c != '"' && !is_EOL(bits)); + /* must have an ending " */ + if (c == '"') + GetIncludeFile(db, filename, fname, str - len - fname, + depth); + } + } + /* spin to next newline */ + if (only_pcs) { + while (is_simple(bits)) + bits = next_char(c, str); + if (is_EOL(bits)) + continue; + } + while (!is_EOL(bits)) + bits = next_mbchar(c, len, str); + str--; + continue; /* start a new line. */ + } + + /* + * Third: loop through the LHS of the resource specification + * storing characters and converting this to a Quark. + */ + + num_quarks = 0; + t_bindings = bindings; + + sig = 0; + ptr = lhs; + *t_bindings = XrmBindTightly; + for(;;) { + if (!is_binding(bits)) { + while (!is_EOQ(bits)) { + *ptr++ = c; + sig = (sig << 1) + c; /* Compute the signature. */ + bits = next_char(c, str); + } + + quarks[num_quarks++] = + _XrmInternalStringToQuark(lhs, ptr - lhs, sig, False); + + if (num_quarks > QLIST_SIZE) { + Xfree(rhs); + if (lhs != lhs_s) Xfree (lhs); + (*db->methods->mbfinish)(db->mbstate); + return; + } + + if (is_separator(bits)) { + if (!is_space(bits)) + break; + + /* Remove white space */ + do { + *ptr++ = c; + sig = (sig << 1) + c; /* Compute the signature. */ + } while (is_space(bits = next_char(c, str))); + + /* + * The spec doesn't permit it, but support spaces + * internal to resource name/class + */ + + if (is_separator(bits)) + break; + num_quarks--; + continue; + } + + if (c == '.') + *(++t_bindings) = XrmBindTightly; + else + *(++t_bindings) = XrmBindLoosely; + + sig = 0; + ptr = lhs; + } + else { + /* + * Magic unspecified feature #254. + * + * If two separators appear with no Text between them then + * ignore them. + * + * If anyone of those separators is a '*' then the binding + * will be loose, otherwise it will be tight. + */ + + if (c == '*') + *t_bindings = XrmBindLoosely; + } + + bits = next_char(c, str); + } + + quarks[num_quarks] = NULLQUARK; + + /* + * Make sure that there is a ':' in this line. + */ + + if (c != ':') { + char oldc; + + /* + * A parsing error has occured, toss everything on the line + * a new_line can still be escaped with a '\'. + */ + + while (is_normal(bits)) + bits = next_char(c, str); + if (is_EOL(bits)) + continue; + bits = next_mbchar(c, len, str); + do { + oldc = c; + bits = next_mbchar(c, len, str); + } while (c && (c != '\n' || oldc == '\\')); + str--; + continue; + } + + /* + * I now have a quark and binding list for the entire left hand + * side. "c" currently points to the ":" separating the left hand + * side for the right hand side. It is time to begin processing + * the right hand side. + */ + + /* + * Fourth: Remove more whitespace + */ + + for(;;) { + if (is_space(bits = next_char(c, str))) + continue; + if (c != '\\') + break; + bits = next_char(c, str); + if (c == '\n') + continue; + str--; + bits = BSLASH; + c = '\\'; + break; + } + + /* + * Fifth: Process the right hand side. + */ + + ptr = rhs; + ptr_max = ptr + alloc_chars - 4; + only_pcs = True; + len = 1; + + for(;;) { + + /* + * Tight loop for the normal case: Non backslash, non-end of value + * character that will fit into the allocated buffer. + */ + + if (only_pcs) { + while (is_normal(bits) && ptr < ptr_max) { + *ptr++ = c; + bits = next_char(c, str); + } + if (is_EOL(bits)) + break; + if (is_nonpcs(bits)) { + only_pcs = False; + bits = next_mbchar(c, len, str); + } + } + while (!is_special(bits) && ptr + len <= ptr_max) { + len = -len; + while (len) + *ptr++ = str[len++]; + if (*str == '\0') { + bits = EOS; + break; + } + bits = next_mbchar(c, len, str); + } + + if (is_EOL(bits)) { + str--; + break; + } + + if (c == '\\') { + /* + * We need to do some magic after a backslash. + */ + Bool read_next = True; + + if (only_pcs) { + bits = next_char(c, str); + if (is_nonpcs(bits)) + only_pcs = False; + } + if (!only_pcs) + bits = next_mbchar(c, len, str); + + if (is_EOL(bits)) { + if (is_EOF(bits)) + continue; + } else if (c == 'n') { + /* + * "\n" means insert a newline. + */ + *ptr++ = '\n'; + } else if (c == '\\') { + /* + * "\\" completes to just one backslash. + */ + *ptr++ = '\\'; + } else { + /* + * pick up to three octal digits after the '\'. + */ + char temp[3]; + int count = 0; + while (is_odigit(bits) && count < 3) { + temp[count++] = c; + if (only_pcs) { + bits = next_char(c, str); + if (is_nonpcs(bits)) + only_pcs = False; + } + if (!only_pcs) + bits = next_mbchar(c, len, str); + } + + /* + * If we found three digits then insert that octal code + * into the value string as a character. + */ + + if (count == 3) { + *ptr++ = (unsigned char) ((temp[0] - '0') * 0100 + + (temp[1] - '0') * 010 + + (temp[2] - '0')); + } + else { + int tcount; + + /* + * Otherwise just insert those characters into the + * string, since no special processing is needed on + * numerics we can skip the special processing. + */ + + for (tcount = 0; tcount < count; tcount++) { + *ptr++ = temp[tcount]; /* print them in + the correct order */ + } + } + read_next = False; + } + if (read_next) { + if (only_pcs) { + bits = next_char(c, str); + if (is_nonpcs(bits)) + only_pcs = False; + } + if (!only_pcs) + bits = next_mbchar(c, len, str); + } + } + + /* + * It is important to make sure that there is room for at least + * four more characters in the buffer, since I can add that + * many characters into the buffer after a backslash has occured. + */ + + if (ptr + len > ptr_max) { + char * temp_str; + + alloc_chars += BUFSIZ/10; + temp_str = Xrealloc(rhs, sizeof(char) * alloc_chars); + + if (!temp_str) { + Xfree(rhs); + if (lhs != lhs_s) Xfree (lhs); + (*db->methods->mbfinish)(db->mbstate); + return; + } + + ptr = temp_str + (ptr - rhs); /* reset pointer. */ + rhs = temp_str; + ptr_max = rhs + alloc_chars - 4; + } + } + + /* + * Lastly: Terminate the value string, and store this entry + * into the database. + */ + + *ptr++ = '\0'; + + /* Store it in database */ + value.size = ptr - rhs; + value.addr = (XPointer) rhs; + + PutEntry(db, bindings, quarks, XrmQString, &value); + } + + if (lhs != lhs_s) Xfree (lhs); + Xfree (rhs); + + (*db->methods->mbfinish)(db->mbstate); +} + +void +XrmPutStringResource( + XrmDatabase *pdb, + _Xconst char*specifier, + _Xconst char*str) +{ + XrmValue value; + XrmBinding bindings[MAXDBDEPTH+1]; + XrmQuark quarks[MAXDBDEPTH+1]; + + if (!*pdb) *pdb = NewDatabase(); + XrmStringToBindingQuarkList(specifier, bindings, quarks); + value.addr = (XPointer) str; + value.size = strlen(str)+1; + _XLockMutex(&(*pdb)->linfo); + PutEntry(*pdb, bindings, quarks, XrmQString, &value); + _XUnlockMutex(&(*pdb)->linfo); +} + + +void +XrmPutLineResource( + XrmDatabase *pdb, + _Xconst char*line) +{ + if (!*pdb) *pdb = NewDatabase(); + _XLockMutex(&(*pdb)->linfo); + GetDatabase(*pdb, line, (char *)NULL, False, 0); + _XUnlockMutex(&(*pdb)->linfo); +} + +XrmDatabase +XrmGetStringDatabase( + _Xconst char *data) +{ + XrmDatabase db; + + db = NewDatabase(); + _XLockMutex(&db->linfo); + GetDatabase(db, data, (char *)NULL, True, 0); + _XUnlockMutex(&db->linfo); + return db; +} + +/* Function Name: ReadInFile + * Description: Reads the file into a buffer. + * Arguments: filename - the name of the file. + * Returns: An allocated string containing the contents of the file. + */ + +static char * +ReadInFile(_Xconst char *filename) +{ + register int fd, size; + char * filebuf; + + /* + * MS-Windows and OS/2 note: Default open mode includes O_TEXT + */ + if ( (fd = _XOpenFile (filename, O_RDONLY)) == -1 ) + return (char *)NULL; + + /* + * MS-Windows and OS/2 note: depending on how the sources are + * untarred, the newlines in resource files may or may not have + * been expanded to CRLF. Either way the size returned by fstat + * is sufficient to read the file into because in text-mode any + * CRLFs in a file will be converted to newlines (LF) with the + * result that the number of bytes actually read with be <= + * to the size returned by fstat. + */ + { + struct stat status_buffer; + if ( ((fstat(fd, &status_buffer)) == -1 ) || + (status_buffer.st_size >= INT_MAX) ) { + close (fd); + return (char *)NULL; + } else + size = (int) status_buffer.st_size; + } + + if (!(filebuf = Xmalloc(size + 1))) { /* leave room for '\0' */ + close(fd); + return (char *)NULL; + } + size = read (fd, filebuf, size); + + if (size < 0) { + close (fd); + Xfree(filebuf); + return (char *)NULL; + } + close (fd); + + filebuf[size] = '\0'; /* NULL terminate it. */ + return filebuf; +} + +static void +GetIncludeFile( + XrmDatabase db, + _Xconst char *base, + _Xconst char *fname, + int fnamelen, + int depth) +{ + int len; + char *str; + char realfname[BUFSIZ]; + + if (fnamelen <= 0 || fnamelen >= BUFSIZ) + return; + if (depth >= MAXDBDEPTH) + return; + if (*fname != '/' && base && (str = strrchr(base, '/'))) { + len = str - base + 1; + if (len + fnamelen >= BUFSIZ) + return; + strncpy(realfname, base, len); + strncpy(realfname + len, fname, fnamelen); + realfname[len + fnamelen] = '\0'; + } else { + strncpy(realfname, fname, fnamelen); + realfname[fnamelen] = '\0'; + } + if (!(str = ReadInFile(realfname))) + return; + GetDatabase(db, str, realfname, True, depth + 1); + Xfree(str); +} + +XrmDatabase +XrmGetFileDatabase( + _Xconst char *filename) +{ + XrmDatabase db; + char *str; + + if (!(str = ReadInFile(filename))) + return (XrmDatabase)NULL; + + db = NewDatabase(); + _XLockMutex(&db->linfo); + GetDatabase(db, str, filename, True, 0); + _XUnlockMutex(&db->linfo); + Xfree(str); + return db; +} + +Status +XrmCombineFileDatabase( + _Xconst char *filename, + XrmDatabase *target, + Bool override) +{ + XrmDatabase db; + char *str; + + if (!(str = ReadInFile(filename))) + return 0; + if (override) { + db = *target; + if (!db) + *target = db = NewDatabase(); + } else + db = NewDatabase(); + _XLockMutex(&db->linfo); + GetDatabase(db, str, filename, True, 0); + _XUnlockMutex(&db->linfo); + Xfree(str); + if (!override) + XrmCombineDatabase(db, target, False); + return 1; +} + +/* call the user proc for every value in the table, arbitrary order. + * stop if user proc returns True. level is current depth in database. + */ +/*ARGSUSED*/ +static Bool EnumLTable( + LTable table, + XrmNameList names, + XrmClassList classes, + register int level, + register EClosure closure) +{ + register VEntry *bucket; + register int i; + register VEntry entry; + XrmValue value; + XrmRepresentation type; + Bool tightOk; + + closure->bindings[level] = (table->table.tight ? + XrmBindTightly : XrmBindLoosely); + closure->quarks[level] = table->table.name; + level++; + tightOk = !*names; + closure->quarks[level + 1] = NULLQUARK; + for (i = table->table.mask, bucket = table->buckets; + i >= 0; + i--, bucket++) { + for (entry = *bucket; entry; entry = entry->next) { + if (entry->tight && !tightOk) + continue; + closure->bindings[level] = (entry->tight ? + XrmBindTightly : XrmBindLoosely); + closure->quarks[level] = entry->name; + value.size = entry->size; + if (entry->string) { + type = XrmQString; + value.addr = StringValue(entry); + } else { + type = RepType(entry); + value.addr = DataValue(entry); + } + if ((*closure->proc)(&closure->db, closure->bindings+1, + closure->quarks+1, &type, &value, + closure->closure)) + return True; + } + } + return False; +} + +static Bool EnumAllNTable( + NTable table, + register int level, + register EClosure closure) +{ + register NTable *bucket; + register int i; + register NTable entry; + XrmQuark empty = NULLQUARK; + + if (level >= MAXDBDEPTH) + return False; + for (i = table->mask, bucket = NodeBuckets(table); + i >= 0; + i--, bucket++) { + for (entry = *bucket; entry; entry = entry->next) { + if (entry->leaf) { + if (EnumLTable((LTable)entry, &empty, &empty, level, closure)) + return True; + } else { + closure->bindings[level] = (entry->tight ? + XrmBindTightly : XrmBindLoosely); + closure->quarks[level] = entry->name; + if (EnumAllNTable(entry, level+1, closure)) + return True; + } + } + } + return False; +} + +/* recurse on every table in the table, arbitrary order. + * stop if user proc returns True. level is current depth in database. + */ +static Bool EnumNTable( + NTable table, + XrmNameList names, + XrmClassList classes, + register int level, + register EClosure closure) +{ + register NTable entry; + register XrmQuark q; + register unsigned int leaf; + Bool (*get)( + NTable table, + XrmNameList names, + XrmClassList classes, + register int level, + EClosure closure); + Bool bilevel; + +/* find entries named ename, leafness leaf, tight or loose, and call get */ +#define ITIGHTLOOSE(ename) \ + NFIND(ename); \ + if (entry) { \ + if (leaf == entry->leaf) { \ + if (!leaf && !entry->tight && entry->next && \ + entry->next->name == q && entry->next->tight && \ + (bilevel || entry->next->hasloose) && \ + EnumLTable((LTable)entry->next, names+1, classes+1, \ + level, closure)) \ + return True; \ + if ((*get)(entry, names+1, classes+1, level, closure)) \ + return True; \ + if (entry->tight && (entry = entry->next) && \ + entry->name == q && leaf == entry->leaf && \ + (*get)(entry, names+1, classes+1, level, closure)) \ + return True; \ + } else if (entry->leaf) { \ + if ((bilevel || entry->hasloose) && \ + EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ + return True; \ + if (entry->tight && (entry = entry->next) && \ + entry->name == q && (bilevel || entry->hasloose) && \ + EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ + return True; \ + } \ + } + +/* find entries named ename, leafness leaf, loose only, and call get */ +#define ILOOSE(ename) \ + NFIND(ename); \ + if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ + entry = (NTable)NULL; \ + if (entry) { \ + if (leaf == entry->leaf) { \ + if ((*get)(entry, names+1, classes+1, level, closure)) \ + return True; \ + } else if (entry->leaf && (bilevel || entry->hasloose)) { \ + if (EnumLTable((LTable)entry, names+1, classes+1, level, closure))\ + return True; \ + } \ + } + + if (level >= MAXDBDEPTH) + return False; + closure->bindings[level] = (table->tight ? + XrmBindTightly : XrmBindLoosely); + closure->quarks[level] = table->name; + level++; + if (!*names) { + if (EnumAllNTable(table, level, closure)) + return True; + } else { + if (names[1] || closure->mode == XrmEnumAllLevels) { + get = EnumNTable; /* recurse */ + leaf = 0; + bilevel = !names[1]; + } else { + get = (getNTableEProcp)EnumLTable; /* bottom of recursion */ + leaf = 1; + bilevel = False; + } + if (table->hasloose && closure->mode == XrmEnumAllLevels) { + NTable *bucket; + int i; + XrmQuark empty = NULLQUARK; + + for (i = table->mask, bucket = NodeBuckets(table); + i >= 0; + i--, bucket++) { + q = NULLQUARK; + for (entry = *bucket; entry; entry = entry->next) { + if (!entry->tight && entry->name != q && + entry->name != *names && entry->name != *classes) { + q = entry->name; + if (entry->leaf) { + if (EnumLTable((LTable)entry, &empty, &empty, + level, closure)) + return True; + } else { + if (EnumNTable(entry, &empty, &empty, + level, closure)) + return True; + } + } + } + } + } + + ITIGHTLOOSE(*names); /* do name, tight and loose */ + ITIGHTLOOSE(*classes); /* do class, tight and loose */ + if (table->hasany) { + ITIGHTLOOSE(XrmQANY); /* do ANY, tight and loose */ + } + if (table->hasloose) { + while (1) { + names++; + classes++; + if (!*names) + break; + if (!names[1] && closure->mode != XrmEnumAllLevels) { + get = (getNTableEProcp)EnumLTable; /* bottom of recursion */ + leaf = 1; + } + ILOOSE(*names); /* loose names */ + ILOOSE(*classes); /* loose classes */ + if (table->hasany) { + ILOOSE(XrmQANY); /* loose ANY */ + } + } + names--; + classes--; + } + } + /* now look for matching leaf nodes */ + entry = table->next; + if (!entry) + return False; + if (entry->leaf) { + if (entry->tight && !table->tight) + entry = entry->next; + } else { + entry = entry->next; + if (!entry || !entry->tight) + return False; + } + if (!entry || entry->name != table->name) + return False; + /* found one */ + level--; + if ((!*names || entry->hasloose) && + EnumLTable((LTable)entry, names, classes, level, closure)) + return True; + if (entry->tight && entry == table->next && (entry = entry->next) && + entry->name == table->name && (!*names || entry->hasloose)) + return EnumLTable((LTable)entry, names, classes, level, closure); + return False; + +#undef ITIGHTLOOSE +#undef ILOOSE +} + +/* call the proc for every value in the database, arbitrary order. + * stop if the proc returns True. + */ +Bool XrmEnumerateDatabase( + XrmDatabase db, + XrmNameList names, + XrmClassList classes, + int mode, + DBEnumProc proc, + XPointer closure) +{ + XrmBinding bindings[MAXDBDEPTH+2]; + XrmQuark quarks[MAXDBDEPTH+2]; + register NTable table; + EClosureRec eclosure; + Bool retval = False; + + if (!db) + return False; + _XLockMutex(&db->linfo); + eclosure.db = db; + eclosure.proc = proc; + eclosure.closure = closure; + eclosure.bindings = bindings; + eclosure.quarks = quarks; + eclosure.mode = mode; + table = db->table; + if (table && !table->leaf && !*names && mode == XrmEnumOneLevel) + table = table->next; + if (table) { + if (!table->leaf) + retval = EnumNTable(table, names, classes, 0, &eclosure); + else + retval = EnumLTable((LTable)table, names, classes, 0, &eclosure); + } + _XUnlockMutex(&db->linfo); + return retval; +} + +static void PrintBindingQuarkList( + XrmBindingList bindings, + XrmQuarkList quarks, + FILE *stream) +{ + Bool firstNameSeen; + + for (firstNameSeen = False; *quarks; bindings++, quarks++) { + if (*bindings == XrmBindLoosely) { + (void) fprintf(stream, "*"); + } else if (firstNameSeen) { + (void) fprintf(stream, "."); + } + firstNameSeen = True; + (void) fputs(XrmQuarkToString(*quarks), stream); + } +} + +/* output out the entry in correct file syntax */ +/*ARGSUSED*/ +static Bool DumpEntry( + XrmDatabase *db, + XrmBindingList bindings, + XrmQuarkList quarks, + XrmRepresentation *type, + XrmValuePtr value, + XPointer data) +{ + FILE *stream = (FILE *)data; + register unsigned int i; + register char *s; + register char c; + + if (*type != XrmQString) + (void) putc('!', stream); + PrintBindingQuarkList(bindings, quarks, stream); + s = value->addr; + i = value->size; + if (*type == XrmQString) { + (void) fputs(":\t", stream); + if (i) + i--; + } + else + (void) fprintf(stream, "=%s:\t", XrmRepresentationToString(*type)); + if (i && (*s == ' ' || *s == '\t')) + (void) putc('\\', stream); /* preserve leading whitespace */ + while (i--) { + c = *s++; + if (c == '\n') { + if (i) + (void) fputs("\\n\\\n", stream); + else + (void) fputs("\\n", stream); + } else if (c == '\\') + (void) fputs("\\\\", stream); + else if ((c < ' ' && c != '\t') || + ((unsigned char)c >= 0x7f && (unsigned char)c < 0xa0)) + (void) fprintf(stream, "\\%03o", (unsigned char)c); + else + (void) putc(c, stream); + } + (void) putc('\n', stream); + return ferror(stream) != 0; +} + +#ifdef DEBUG + +void PrintTable( + NTable table, + FILE *file) +{ + XrmBinding bindings[MAXDBDEPTH+1]; + XrmQuark quarks[MAXDBDEPTH+1]; + EClosureRec closure; + XrmQuark empty = NULLQUARK; + + closure.db = (XrmDatabase)NULL; + closure.proc = DumpEntry; + closure.closure = (XPointer)file; + closure.bindings = bindings; + closure.quarks = quarks; + closure.mode = XrmEnumAllLevels; + if (table->leaf) + EnumLTable((LTable)table, &empty, &empty, 0, &closure); + else + EnumNTable(table, &empty, &empty, 0, &closure); +} + +#endif /* DEBUG */ + +void +XrmPutFileDatabase( + XrmDatabase db, + _Xconst char *fileName) +{ + FILE *file; + XrmQuark empty = NULLQUARK; + + if (!db) return; + if (!(file = fopen(fileName, "w"))) return; + if (XrmEnumerateDatabase(db, &empty, &empty, XrmEnumAllLevels, + DumpEntry, (XPointer) file)) + unlink((char *)fileName); + fclose(file); +} + +/* macros used in get/search functions */ + +/* find entries named ename, leafness leaf, tight or loose, and call get */ +#define GTIGHTLOOSE(ename,looseleaf) \ + NFIND(ename); \ + if (entry) { \ + if (leaf == entry->leaf) { \ + if (!leaf && !entry->tight && entry->next && \ + entry->next->name == q && entry->next->tight && \ + entry->next->hasloose && \ + looseleaf((LTable)entry->next, names+1, classes+1, closure)) \ + return True; \ + if ((*get)(entry, names+1, classes+1, closure)) \ + return True; \ + if (entry->tight && (entry = entry->next) && \ + entry->name == q && leaf == entry->leaf && \ + (*get)(entry, names+1, classes+1, closure)) \ + return True; \ + } else if (entry->leaf) { \ + if (entry->hasloose && \ + looseleaf((LTable)entry, names+1, classes+1, closure)) \ + return True; \ + if (entry->tight && (entry = entry->next) && \ + entry->name == q && entry->hasloose && \ + looseleaf((LTable)entry, names+1, classes+1, closure)) \ + return True; \ + } \ + } + +/* find entries named ename, leafness leaf, loose only, and call get */ +#define GLOOSE(ename,looseleaf) \ + NFIND(ename); \ + if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ + entry = (NTable)NULL; \ + if (entry) { \ + if (leaf == entry->leaf) { \ + if ((*get)(entry, names+1, classes+1, closure)) \ + return True; \ + } else if (entry->leaf && entry->hasloose) { \ + if (looseleaf((LTable)entry, names+1, classes+1, closure)) \ + return True; \ + } \ + } + +/* add tight/loose entry to the search list, return True if list is full */ +/*ARGSUSED*/ +static Bool AppendLEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + register SClosure closure) +{ + /* check for duplicate */ + if (closure->idx >= 0 && closure->list[closure->idx] == table) + return False; + if (closure->idx == closure->limit) + return True; + /* append it */ + closure->idx++; + closure->list[closure->idx] = table; + return False; +} + +/* add loose entry to the search list, return True if list is full */ +/*ARGSUSED*/ +static Bool AppendLooseLEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + register SClosure closure) +{ + /* check for duplicate */ + if (closure->idx >= 0 && closure->list[closure->idx] == table) + return False; + if (closure->idx >= closure->limit - 1) + return True; + /* append it */ + closure->idx++; + closure->list[closure->idx] = LOOSESEARCH; + closure->idx++; + closure->list[closure->idx] = table; + return False; +} + +/* search for a leaf table */ +static Bool SearchNEntry( + NTable table, + XrmNameList names, + XrmClassList classes, + SClosure closure) +{ + register NTable entry; + register XrmQuark q; + register unsigned int leaf; + Bool (*get)( + NTable table, + XrmNameList names, + XrmClassList classes, + SClosure closure); + + if (names[1]) { + get = SearchNEntry; /* recurse */ + leaf = 0; + } else { + get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */ + leaf = 1; + } + GTIGHTLOOSE(*names, AppendLooseLEntry); /* do name, tight and loose */ + GTIGHTLOOSE(*classes, AppendLooseLEntry); /* do class, tight and loose */ + if (table->hasany) { + GTIGHTLOOSE(XrmQANY, AppendLooseLEntry); /* do ANY, tight and loose */ + } + if (table->hasloose) { + while (1) { + names++; + classes++; + if (!*names) + break; + if (!names[1]) { + get = (getNTableSProcp)AppendLEntry; /* bottom of recursion */ + leaf = 1; + } + GLOOSE(*names, AppendLooseLEntry); /* loose names */ + GLOOSE(*classes, AppendLooseLEntry); /* loose classes */ + if (table->hasany) { + GLOOSE(XrmQANY, AppendLooseLEntry); /* loose ANY */ + } + } + } + /* now look for matching leaf nodes */ + entry = table->next; + if (!entry) + return False; + if (entry->leaf) { + if (entry->tight && !table->tight) + entry = entry->next; + } else { + entry = entry->next; + if (!entry || !entry->tight) + return False; + } + if (!entry || entry->name != table->name) + return False; + /* found one */ + if (entry->hasloose && + AppendLooseLEntry((LTable)entry, names, classes, closure)) + return True; + if (entry->tight && entry == table->next && (entry = entry->next) && + entry->name == table->name && entry->hasloose) + return AppendLooseLEntry((LTable)entry, names, classes, closure); + return False; +} + +Bool XrmQGetSearchList( + XrmDatabase db, + XrmNameList names, + XrmClassList classes, + XrmSearchList searchList, /* RETURN */ + int listLength) +{ + register NTable table; + SClosureRec closure; + + if (listLength <= 0) + return False; + closure.list = (LTable *)searchList; + closure.idx = -1; + closure.limit = listLength - 2; + if (db) { + _XLockMutex(&db->linfo); + table = db->table; + if (*names) { + if (table && !table->leaf) { + if (SearchNEntry(table, names, classes, &closure)) { + _XUnlockMutex(&db->linfo); + return False; + } + } else if (table && table->hasloose && + AppendLooseLEntry((LTable)table, names, classes, + &closure)) { + _XUnlockMutex(&db->linfo); + return False; + } + } else { + if (table && !table->leaf) + table = table->next; + if (table && + AppendLEntry((LTable)table, names, classes, &closure)) { + _XUnlockMutex(&db->linfo); + return False; + } + } + _XUnlockMutex(&db->linfo); + } + closure.list[closure.idx + 1] = (LTable)NULL; + return True; +} + +Bool XrmQGetSearchResource( + XrmSearchList searchList, + register XrmName name, + register XrmClass class, + XrmRepresentation *pType, /* RETURN */ + XrmValue *pValue) /* RETURN */ +{ + register LTable *list; + register LTable table; + register VEntry entry = NULL; + int flags; + +/* find tight or loose entry */ +#define VTIGHTLOOSE(q) \ + entry = LeafHash(table, q); \ + while (entry && entry->name != q) \ + entry = entry->next; \ + if (entry) \ + break + +/* find loose entry */ +#define VLOOSE(q) \ + entry = LeafHash(table, q); \ + while (entry && entry->name != q) \ + entry = entry->next; \ + if (entry) { \ + if (!entry->tight) \ + break; \ + if ((entry = entry->next) && entry->name == q) \ + break; \ + } + + list = (LTable *)searchList; + /* figure out which combination of name and class we need to search for */ + flags = 0; + if (IsResourceQuark(name)) + flags = 2; + if (IsResourceQuark(class)) + flags |= 1; + if (!flags) { + /* neither name nor class has ever been used to name a resource */ + table = (LTable)NULL; + } else if (flags == 3) { + /* both name and class */ + while ((table = *list++)) { + if (table != LOOSESEARCH) { + VTIGHTLOOSE(name); /* do name, tight and loose */ + VTIGHTLOOSE(class); /* do class, tight and loose */ + } else { + table = *list++; + VLOOSE(name); /* do name, loose only */ + VLOOSE(class); /* do class, loose only */ + } + } + } else { + /* just one of name or class */ + if (flags == 1) + name = class; + while ((table = *list++)) { + if (table != LOOSESEARCH) { + VTIGHTLOOSE(name); /* tight and loose */ + } else { + table = *list++; + VLOOSE(name); /* loose only */ + } + } + } + if (table) { + /* found a match */ + if (entry->string) { + *pType = XrmQString; + pValue->addr = StringValue(entry); + } else { + *pType = RepType(entry); + pValue->addr = DataValue(entry); + } + pValue->size = entry->size; + return True; + } + *pType = NULLQUARK; + pValue->addr = (XPointer)NULL; + pValue->size = 0; + return False; + +#undef VTIGHTLOOSE +#undef VLOOSE +} + +/* look for a tight/loose value */ +static Bool GetVEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure) +{ + register VEntry entry; + register XrmQuark q; + + /* try name first */ + q = *names; + entry = LeafHash(table, q); + while (entry && entry->name != q) + entry = entry->next; + if (!entry) { + /* not found, try class */ + q = *classes; + entry = LeafHash(table, q); + while (entry && entry->name != q) + entry = entry->next; + if (!entry) + return False; + } + if (entry->string) { + *closure->type = XrmQString; + closure->value->addr = StringValue(entry); + } else { + *closure->type = RepType(entry); + closure->value->addr = DataValue(entry); + } + closure->value->size = entry->size; + return True; +} + +/* look for a loose value */ +static Bool GetLooseVEntry( + LTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure) +{ + register VEntry entry; + register XrmQuark q; + +#define VLOOSE(ename) \ + q = ename; \ + entry = LeafHash(table, q); \ + while (entry && entry->name != q) \ + entry = entry->next; \ + if (entry && entry->tight && (entry = entry->next) && entry->name != q) \ + entry = (VEntry)NULL; + + /* bump to last component */ + while (names[1]) { + names++; + classes++; + } + VLOOSE(*names); /* do name, loose only */ + if (!entry) { + VLOOSE(*classes); /* do class, loose only */ + if (!entry) + return False; + } + if (entry->string) { + *closure->type = XrmQString; + closure->value->addr = StringValue(entry); + } else { + *closure->type = RepType(entry); + closure->value->addr = DataValue(entry); + } + closure->value->size = entry->size; + return True; + +#undef VLOOSE +} + +/* recursive search for a value */ +static Bool GetNEntry( + NTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure) +{ + register NTable entry; + register XrmQuark q; + register unsigned int leaf; + Bool (*get)( + NTable table, + XrmNameList names, + XrmClassList classes, + VClosure closure); + NTable otable; + + if (names[2]) { + get = GetNEntry; /* recurse */ + leaf = 0; + } else { + get = (getNTableVProcp)GetVEntry; /* bottom of recursion */ + leaf = 1; + } + GTIGHTLOOSE(*names, GetLooseVEntry); /* do name, tight and loose */ + GTIGHTLOOSE(*classes, GetLooseVEntry); /* do class, tight and loose */ + if (table->hasany) { + GTIGHTLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, tight and loose */ + } + if (table->hasloose) { + while (1) { + names++; + classes++; + if (!names[1]) + break; + if (!names[2]) { + get = (getNTableVProcp)GetVEntry; /* bottom of recursion */ + leaf = 1; + } + GLOOSE(*names, GetLooseVEntry); /* do name, loose only */ + GLOOSE(*classes, GetLooseVEntry); /* do class, loose only */ + if (table->hasany) { + GLOOSE(XrmQANY, GetLooseVEntry); /* do ANY, loose only */ + } + } + } + /* look for matching leaf tables */ + otable = table; + table = table->next; + if (!table) + return False; + if (table->leaf) { + if (table->tight && !otable->tight) + table = table->next; + } else { + table = table->next; + if (!table || !table->tight) + return False; + } + if (!table || table->name != otable->name) + return False; + /* found one */ + if (table->hasloose && + GetLooseVEntry((LTable)table, names, classes, closure)) + return True; + if (table->tight && table == otable->next) { + table = table->next; + if (table && table->name == otable->name && table->hasloose) + return GetLooseVEntry((LTable)table, names, classes, closure); + } + return False; +} + +Bool XrmQGetResource( + XrmDatabase db, + XrmNameList names, + XrmClassList classes, + XrmRepresentation *pType, /* RETURN */ + XrmValuePtr pValue) /* RETURN */ +{ + register NTable table; + VClosureRec closure; + + if (db && *names) { + _XLockMutex(&db->linfo); + closure.type = pType; + closure.value = pValue; + table = db->table; + if (names[1]) { + if (table && !table->leaf) { + if (GetNEntry(table, names, classes, &closure)) { + _XUnlockMutex(&db->linfo); + return True; + } + } else if (table && table->hasloose && + GetLooseVEntry((LTable)table, names, classes, &closure)) { + _XUnlockMutex (&db->linfo); + return True; + } + } else { + if (table && !table->leaf) + table = table->next; + if (table && GetVEntry((LTable)table, names, classes, &closure)) { + _XUnlockMutex(&db->linfo); + return True; + } + } + _XUnlockMutex(&db->linfo); + } + *pType = NULLQUARK; + pValue->addr = (XPointer)NULL; + pValue->size = 0; + return False; +} + +Bool +XrmGetResource(XrmDatabase db, _Xconst char *name_str, _Xconst char *class_str, + XrmString *pType_str, XrmValuePtr pValue) +{ + XrmName names[MAXDBDEPTH+1]; + XrmClass classes[MAXDBDEPTH+1]; + XrmRepresentation fromType; + Bool result; + + XrmStringToNameList(name_str, names); + XrmStringToClassList(class_str, classes); + result = XrmQGetResource(db, names, classes, &fromType, pValue); + (*pType_str) = XrmQuarkToString(fromType); + return result; +} + +/* destroy all values, plus table itself */ +static void DestroyLTable( + LTable table) +{ + register int i; + register VEntry *buckets; + register VEntry entry, next; + + buckets = table->buckets; + for (i = table->table.mask; i >= 0; i--, buckets++) { + for (next = *buckets; (entry = next); ) { + next = entry->next; + Xfree(entry); + } + } + Xfree(table->buckets); + Xfree(table); +} + +/* destroy all contained tables, plus table itself */ +static void DestroyNTable( + NTable table) +{ + register int i; + register NTable *buckets; + register NTable entry, next; + + buckets = NodeBuckets(table); + for (i = table->mask; i >= 0; i--, buckets++) { + for (next = *buckets; (entry = next); ) { + next = entry->next; + if (entry->leaf) + DestroyLTable((LTable)entry); + else + DestroyNTable(entry); + } + } + Xfree(table); +} + +const char * +XrmLocaleOfDatabase( + XrmDatabase db) +{ + const char* retval; + _XLockMutex(&db->linfo); + retval = (*db->methods->lcname)(db->mbstate); + _XUnlockMutex(&db->linfo); + return retval; +} + +void XrmDestroyDatabase( + XrmDatabase db) +{ + register NTable table, next; + + if (db) { + _XLockMutex(&db->linfo); + for (next = db->table; (table = next); ) { + next = table->next; + if (table->leaf) + DestroyLTable((LTable)table); + else + DestroyNTable(table); + } + _XUnlockMutex(&db->linfo); + _XFreeMutex(&db->linfo); + (*db->methods->destroy)(db->mbstate); + Xfree(db); + } +} diff --git a/nx-X11/lib/src/evtomask.c b/nx-X11/lib/src/evtomask.c new file mode 100644 index 000000000..c5dbad262 --- /dev/null +++ b/nx-X11/lib/src/evtomask.c @@ -0,0 +1,74 @@ +/* + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +/* + * This array can be used given an event type to determine the mask bits + * that could have generated it. + */ +long const _Xevent_to_mask [LASTEvent] = { + 0, /* no event 0 */ + 0, /* no event 1 */ + KeyPressMask, /* KeyPress */ + KeyReleaseMask, /* KeyRelease */ + ButtonPressMask, /* ButtonPress */ + ButtonReleaseMask, /* ButtonRelease */ + PointerMotionMask|PointerMotionHintMask|Button1MotionMask| + Button2MotionMask|Button3MotionMask|Button4MotionMask| + Button5MotionMask|ButtonMotionMask, /* MotionNotify */ + EnterWindowMask, /* EnterNotify */ + LeaveWindowMask, /* LeaveNotify */ + FocusChangeMask, /* FocusIn */ + FocusChangeMask, /* FocusOut */ + KeymapStateMask, /* KeymapNotify */ + ExposureMask, /* Expose */ + ExposureMask, /* GraphicsExpose */ + ExposureMask, /* NoExpose */ + VisibilityChangeMask, /* VisibilityNotify */ + SubstructureNotifyMask, /* CreateNotify */ + StructureNotifyMask|SubstructureNotifyMask, /* DestroyNotify */ + StructureNotifyMask|SubstructureNotifyMask, /* UnmapNotify */ + StructureNotifyMask|SubstructureNotifyMask, /* MapNotify */ + SubstructureRedirectMask, /* MapRequest */ + SubstructureNotifyMask|StructureNotifyMask, /* ReparentNotify */ + StructureNotifyMask|SubstructureNotifyMask, /* ConfigureNotify */ + SubstructureRedirectMask, /* ConfigureRequest */ + SubstructureNotifyMask|StructureNotifyMask, /* GravityNotify */ + ResizeRedirectMask, /* ResizeRequest */ + SubstructureNotifyMask|StructureNotifyMask, /* CirculateNotify */ + SubstructureRedirectMask, /* CirculateRequest */ + PropertyChangeMask, /* PropertyNotify */ + 0, /* SelectionClear */ + 0, /* SelectionRequest */ + 0, /* SelectionNotify */ + ColormapChangeMask, /* ColormapNotify */ + 0, /* ClientMessage */ + 0, /* MappingNotify */ +}; diff --git a/nx-X11/lib/src/globals.c b/nx-X11/lib/src/globals.c new file mode 100644 index 000000000..efae2f8bb --- /dev/null +++ b/nx-X11/lib/src/globals.c @@ -0,0 +1,108 @@ +/* + +Copyright 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * + * Global data + * + * This file should contain only those objects which must be predefined. + */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include + + +/* + * If possible, it is useful to have the global data default to a null value. + * Some shared library implementations are *much* happier if there isn't any + * global initialized data. + */ +#ifdef NULL_NOT_ZERO /* then need to initialize */ +#define SetZero(t,var,z) t var = z +#else +#define SetZero(t,var,z) t var +#endif + +#ifdef USL_SHAREDLIB /* then need extra variables */ +/* + * If we need to define extra variables for each global + */ +#define ZEROINIT(t,var,val) SetZero(t,var,val); \ + SetZero (long, _libX_##var##Flag, 0); \ + SetZero (void *, _libX_##var##Ptr, NULL) + +#else /* else not USL_SHAREDLIB */ +/* + * no extra crud + */ +#define ZEROINIT(t,var,val) SetZero (t, var, val) + +#endif /* USL_SHAREDLIB */ + + +/* + * Error handlers; used to be in XlibInt.c + */ +ZEROINIT (XErrorHandler, _XErrorFunction, NULL); +ZEROINIT (XIOErrorHandler, _XIOErrorFunction, NULL); +ZEROINIT (_XQEvent *, _qfree, NULL); + + +/* + * Debugging information and display list; used to be in XOpenDis.c + */ +ZEROINIT (int, _Xdebug, 0); +ZEROINIT (Display *, _XHeadOfDisplayList, NULL); + + +#ifdef XTEST1 +/* + * Stuff for input synthesis extension: + */ +/* + * Holds the two event type codes for this extension. The event type codes + * for this extension may vary depending on how many extensions are installed + * already, so the initial values given below will be added to the base event + * code that is aquired when this extension is installed. + * + * These two variables must be available to programs that use this extension. + */ +int XTestInputActionType = 0; +int XTestFakeAckType = 1; +#endif + +/* + * NOTE: any additional external definition NEED + * to be inserted BELOW this point!!! + */ + +/* + * NOTE: any additional external definition NEED + * to be inserted ABOVE this point!!! + */ diff --git a/nx-X11/lib/src/imConv.c b/nx-X11/lib/src/imConv.c new file mode 100644 index 000000000..c3c1974de --- /dev/null +++ b/nx-X11/lib/src/imConv.c @@ -0,0 +1,356 @@ +/****************************************************************** + + Copyright 1991, 1992 by Fuji Xerox Co.,Ltd. + Copyright 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 Fuji Xerox Co.,Ltd. +, 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. +Fuji Xerox Co.,Ltd. , and FUJITSU LIMITED makes no representations about +the suitability of this software for any purpose. +It is provided "as is" without express or implied warranty. + +FUJI XEROX CO.,LTD. AND FUJITSU LIMITED DISCLAIMS ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJI XEROX CO.,LTD. +AND FUJITSU LIMITED 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. + + Auther: Kazunori Nishihara, Fuji Xerox Co.,Ltd. + kaz@ssdev.ksp.fujixerox.co.jp + Modifier: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ +/* 2000 Modifier: Ivan Pascal The XFree86 Project. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "Ximint.h" +#include "XlcPubI.h" + +#ifdef XKB +/* + * rather than just call _XLookupString (i.e. the pre-XKB XLookupString) + * do this because with XKB the event may have some funky modifiers that + * _XLookupString doesn't grok. + */ +#include "XKBlib.h" +#define XLOOKUPSTRING lookup_string +#else +#define XLOOKUPSTRING XLookupString +#endif + +typedef unsigned int ucs4_t; + +typedef int (*ucstocsConvProc)( + XPointer, + unsigned char *, + ucs4_t, + int +); + +struct SubstRec { + const char encoding_name[8]; + const char charset_name[12]; +}; + +static const struct SubstRec SubstTable[] = { + {"STRING", "ISO8859-1"}, + {"TIS620", "TIS620-0"}, + {"UTF-8", "ISO10646-1"} +}; +#define num_substitute (sizeof SubstTable / sizeof SubstTable[0]) + +/* + * Given the name of a charset, returns the pointer to convertors + * from UCS char to specified charset char. + * This converter is needed for _XimGetCharCode subroutine. + */ +XPointer +_XimGetLocaleCode ( + _Xconst char* encoding_name) +{ + XPointer cvt = _Utf8GetConvByName(encoding_name); + if (!cvt && encoding_name) { + int i; + for (i = 0; i < num_substitute; i++) + if (!strcmp(encoding_name, SubstTable[i].encoding_name)) + return _Utf8GetConvByName(SubstTable[i].charset_name); + } + return cvt; +} + +/* + * Returns the locale dependent representation of a keysym. + * The locale's encoding is passed in form of pointer to UCS convertor. + * The resulting multi-byte sequence is placed starting at buf (a buffer + * with nbytes bytes, nbytes should be >= 8) and is NUL terminated. + * Returns the length of the resulting multi-byte sequence, excluding the + * terminating NUL byte. Return 0 if the keysym is not representable in the + * locale + */ +/*ARGSUSED*/ +int +_XimGetCharCode ( + XPointer ucs_conv, + KeySym keysym, + unsigned char* buf, + int nbytes) +{ + int count = 0; + ucstocsConvProc cvt = (ucstocsConvProc) ucs_conv; + ucs4_t ucs4; + + if (keysym < 0x80) { + buf[0] = (char) keysym; + count = 1; + } else if (cvt) { + ucs4 = KeySymToUcs4(keysym); + if (ucs4) + count = (*cvt)((XPointer)NULL, buf, ucs4, nbytes); + } + + if (count < 0) + count = 0; + if (count>nbytes) + return nbytes; + if (countdisplay); + XkbSetXlibControls (event->display, + XkbLC_ForceLatin1Lookup, XkbLC_ForceLatin1Lookup); + ret = XLookupString(event, (char *)buffer, nbytes, keysym, status); + XkbSetXlibControls (event->display, + XkbLC_ForceLatin1Lookup, ctrls); + return ret; +} +#endif + +#define BUF_SIZE (20) + +int +_XimLookupMBText( + Xic ic, + XKeyEvent* event, + char* buffer, + int nbytes, + KeySym* keysym, + XComposeStatus* status) +{ + int count; + KeySym symbol; + Status dummy; + Xim im = (Xim)ic->core.im; + XimCommonPrivateRec* private = &im->private.common; + unsigned char look[BUF_SIZE]; + ucs4_t ucs4; + + /* force a latin-1 lookup for compatibility */ + count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status); + if (keysym != NULL) *keysym = symbol; + if ((nbytes == 0) || (symbol == NoSymbol)) return count; + + if (count > 1) { + memcpy(look, (char *)buffer,count); + look[count] = '\0'; + if ((count = im->methods->ctstombs(ic->core.im, + (char*) look, count, + buffer, nbytes, &dummy)) < 0) { + count = 0; + } + } else if ((count == 0) || + (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { + + XPointer from = (XPointer) &ucs4; + XPointer to = (XPointer) look; + int from_len = 1; + int to_len = BUF_SIZE; + XPointer args[1]; + XlcCharSet charset; + args[0] = (XPointer) &charset; + ucs4 = (ucs4_t) KeySymToUcs4(symbol); + if (!ucs4) + return 0; + + if (_XlcConvert(private->ucstoc_conv, + &from, &from_len, &to, &to_len, + args, 1 ) != 0) { + count = 0; + } else { + from = (XPointer) look; + to = (XPointer) buffer; + from_len = BUF_SIZE - to_len; + to_len = nbytes; + args[0] = (XPointer) charset; + if (_XlcConvert(private->cstomb_conv, + &from, &from_len, &to, &to_len, + args, 1 ) != 0) { + count = 0; + } else { + count = nbytes - to_len; + } + } + } + /* FIXME: + * we should make sure that if the character is a Latin1 character + * and it's on the right side, and we're in a non-Latin1 locale + * that this is a valid Latin1 character for this locale. + */ + return count; +} + +int +_XimLookupWCText( + Xic ic, + XKeyEvent* event, + wchar_t* buffer, + int nbytes, + KeySym* keysym, + XComposeStatus* status) +{ + int count; + KeySym symbol; + Status dummy; + Xim im = (Xim)ic->core.im; + XimCommonPrivateRec* private = &im->private.common; + unsigned char look[BUF_SIZE]; + ucs4_t ucs4; + + /* force a latin-1 lookup for compatibility */ + count = XLOOKUPSTRING(event, (char *)look, nbytes, &symbol, status); + if (keysym != NULL) *keysym = symbol; + if ((nbytes == 0) || (symbol == NoSymbol)) return count; + + if (count > 1) { + if ((count = im->methods->ctstowcs(ic->core.im, + (char*) look, count, + buffer, nbytes, &dummy)) < 0) { + count = 0; + } + } else if ((count == 0) || + (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { + + XPointer from = (XPointer) &ucs4; + XPointer to = (XPointer) look; + int from_len = 1; + int to_len = BUF_SIZE; + XPointer args[1]; + XlcCharSet charset; + args[0] = (XPointer) &charset; + ucs4 = (ucs4_t) KeySymToUcs4(symbol); + if (!ucs4) + return 0; + + if (_XlcConvert(private->ucstoc_conv, + &from, &from_len, &to, &to_len, + args, 1 ) != 0) { + count = 0; + } else { + from = (XPointer) look; + to = (XPointer) buffer; + from_len = BUF_SIZE - to_len; + to_len = nbytes; + args[0] = (XPointer) charset; + + if (_XlcConvert(private->cstowc_conv, + &from, &from_len, &to, &to_len, + args, 1 ) != 0) { + count = 0; + } else { + count = nbytes - to_len; + } + } + } else + /* FIXME: + * we should make sure that if the character is a Latin1 character + * and it's on the right side, and we're in a non-Latin1 locale + * that this is a valid Latin1 character for this locale. + */ + buffer[0] = look[0]; + + return count; +} + +int +_XimLookupUTF8Text( + Xic ic, + XKeyEvent* event, + char* buffer, + int nbytes, + KeySym* keysym, + XComposeStatus* status) +{ + int count; + KeySym symbol; + Status dummy; + Xim im = (Xim)ic->core.im; + XimCommonPrivateRec* private = &im->private.common; + unsigned char look[BUF_SIZE]; + ucs4_t ucs4; + + /* force a latin-1 lookup for compatibility */ + count = XLOOKUPSTRING(event, (char *)buffer, nbytes, &symbol, status); + if (keysym != NULL) *keysym = symbol; + if ((nbytes == 0) || (symbol == NoSymbol)) return count; + + if (count > 1) { + memcpy(look, (char *)buffer,count); + look[count] = '\0'; + if ((count = im->methods->ctstoutf8(ic->core.im, + (char*) look, count, + buffer, nbytes, &dummy)) < 0) { + count = 0; + } + } else if ((count == 0) || + (count == 1 && (symbol > 0x7f && symbol < 0xff00))) { + + XPointer from = (XPointer) &ucs4; + int from_len = 1; + XPointer to = (XPointer) buffer; + int to_len = nbytes; + + ucs4 = (ucs4_t) KeySymToUcs4(symbol); + if (!ucs4) + return 0; + + if (_XlcConvert(private->ucstoutf8_conv, + &from, &from_len, &to, &to_len, + NULL, 0) != 0) { + count = 0; + } else { + count = nbytes - to_len; + } + } + /* FIXME: + * we should make sure that if the character is a Latin1 character + * and it's on the right side, and we're in a non-Latin1 locale + * that this is a valid Latin1 character for this locale. + */ + return count; +} diff --git a/nx-X11/lib/src/locking.c b/nx-X11/lib/src/locking.c new file mode 100644 index 000000000..9f4fe0677 --- /dev/null +++ b/nx-X11/lib/src/locking.c @@ -0,0 +1,625 @@ +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Stephen Gildea, MIT X Consortium + * + * locking.c - multi-thread locking routines implemented in C Threads + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#undef _XLockMutex +#undef _XUnlockMutex +#undef _XCreateMutex +#undef _XFreeMutex + +#ifdef XTHREADS + +#ifdef __UNIXWARE__ +#include +#endif + +#include "Xprivate.h" +#include "locking.h" +#ifdef XTHREADS_WARN +#include /* for warn/debug stuff */ +#endif + +/* Additional arguments for source code location lock call was made from */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) +# define XTHREADS_FILE_LINE_ARGS \ + , \ + char* file, /* source file, from macro */ \ + int line +#else +# define XTHREADS_FILE_LINE_ARGS /* None */ +#endif + + +#define NUM_FREE_CVLS 4 + +/* in lcWrap.c */ +extern LockInfoPtr _Xi18n_lock; + +#ifdef WIN32 +static DWORD _X_TlsIndex = (DWORD)-1; + +void _Xthread_init(void) +{ + if (_X_TlsIndex == (DWORD)-1) + _X_TlsIndex = TlsAlloc(); +} + +struct _xthread_waiter * +_Xthread_waiter(void) +{ + struct _xthread_waiter *me; + + if (!(me = TlsGetValue(_X_TlsIndex))) { + me = xmalloc(sizeof(struct _xthread_waiter)); + me->sem = CreateSemaphore(NULL, 0, 1, NULL); + me->next = NULL; + TlsSetValue(_X_TlsIndex, me); + } + return me; +} +#endif /* WIN32 */ + +static xthread_t _Xthread_self(void) +{ + return xthread_self(); +} + +static LockInfoRec global_lock; +static LockInfoRec i18n_lock; + +static void _XLockMutex( + LockInfoPtr lip + XTHREADS_FILE_LINE_ARGS + ) +{ + xmutex_lock(lip->lock); +} + +static void _XUnlockMutex( + LockInfoPtr lip + XTHREADS_FILE_LINE_ARGS + ) +{ + xmutex_unlock(lip->lock); +} + +static void _XCreateMutex( + LockInfoPtr lip) +{ + lip->lock = xmutex_malloc(); + if (lip->lock) { + xmutex_init(lip->lock); + xmutex_set_name(lip->lock, "Xlib"); + } +} + +static void _XFreeMutex( + LockInfoPtr lip) +{ + xmutex_clear(lip->lock); + xmutex_free(lip->lock); +} + +#ifdef XTHREADS_WARN +static char *locking_file; +static int locking_line; +static xthread_t locking_thread; +static Bool xlibint_unlock = False; /* XlibInt.c may Unlock and re-Lock */ + +/* history that is useful to examine in a debugger */ +#define LOCK_HIST_SIZE 21 + +static struct { + Bool lockp; /* True for lock, False for unlock */ + xthread_t thread; + char *file; + int line; +} locking_history[LOCK_HIST_SIZE]; + +int lock_hist_loc = 0; /* next slot to fill */ + +static void _XLockDisplayWarn( + Display *dpy, + char *file, /* source file, from macro */ + int line) +{ + xthread_t self; + xthread_t old_locker; + + self = xthread_self(); + old_locker = locking_thread; + if (xthread_have_id(old_locker)) { + if (xthread_equal(old_locker, self)) + printf("Xlib ERROR: %s line %d thread %x: locking display already locked at %s line %d\n", + file, line, self, locking_file, locking_line); +#ifdef XTHREADS_DEBUG + else + printf("%s line %d: thread %x waiting on lock held by %s line %d thread %x\n", + file, line, self, + locking_file, locking_line, old_locker); +#endif /* XTHREADS_DEBUG */ + } + + xmutex_lock(dpy->lock->mutex); + + if (strcmp(file, "XlibInt.c") == 0) { + if (!xlibint_unlock) + printf("Xlib ERROR: XlibInt.c line %d thread %x locking display it did not unlock\n", + line, self); + xlibint_unlock = False; + } + +#ifdef XTHREADS_DEBUG + /* if (old_locker && old_locker != self) */ + if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ + printf("%s line %d: thread %x got display lock\n", file, line, self); +#endif /* XTHREADS_DEBUG */ + + locking_thread = self; + if (strcmp(file, "XlibInt.c") != 0) { + locking_file = file; + locking_line = line; + } + locking_history[lock_hist_loc].file = file; + locking_history[lock_hist_loc].line = line; + locking_history[lock_hist_loc].thread = self; + locking_history[lock_hist_loc].lockp = True; + lock_hist_loc++; + if (lock_hist_loc >= LOCK_HIST_SIZE) + lock_hist_loc = 0; +} +#endif /* XTHREADS_WARN */ + +static void _XUnlockDisplay( + Display *dpy + XTHREADS_FILE_LINE_ARGS + ) +{ +#ifdef XTHREADS_WARN + xthread_t self = xthread_self(); + +#ifdef XTHREADS_DEBUG + if (strcmp("XClearArea.c", file) && strcmp("XDrSegs.c", file)) /* ico */ + printf("%s line %d: thread %x unlocking display\n", file, line, self); +#endif /* XTHREADS_DEBUG */ + + if (!xthread_have_id(locking_thread)) + printf("Xlib ERROR: %s line %d thread %x: unlocking display that is not locked\n", + file, line, self); + else if (strcmp(file, "XlibInt.c") == 0) + xlibint_unlock = True; +#ifdef XTHREADS_DEBUG + else if (strcmp(file, locking_file) != 0) + /* not always an error because locking_file is not per-thread */ + printf("%s line %d: unlocking display locked from %s line %d (probably okay)\n", + file, line, locking_file, locking_line); +#endif /* XTHREADS_DEBUG */ + xthread_clear_id(locking_thread); + + locking_history[lock_hist_loc].file = file; + locking_history[lock_hist_loc].line = line; + locking_history[lock_hist_loc].thread = self; + locking_history[lock_hist_loc].lockp = False; + lock_hist_loc++; + if (lock_hist_loc >= LOCK_HIST_SIZE) + lock_hist_loc = 0; +#endif /* XTHREADS_WARN */ + xmutex_unlock(dpy->lock->mutex); +} + + +static struct _XCVList *_XCreateCVL( + Display *dpy) +{ + struct _XCVList *cvl; + + if ((cvl = dpy->lock->free_cvls) != NULL) { + dpy->lock->free_cvls = cvl->next; + dpy->lock->num_free_cvls--; + } else { + cvl = Xmalloc(sizeof(struct _XCVList)); + if (!cvl) + return NULL; + cvl->cv = xcondition_malloc(); + if (!cvl->cv) { + Xfree(cvl); + return NULL; + } + xcondition_init(cvl->cv); + xcondition_set_name(cvl->cv, "Xlib read queue"); + } + cvl->next = NULL; + return cvl; +} + +/* Put ourselves on the queue to read the connection. + Allocates and returns a queue element. */ + +static struct _XCVList * +_XPushReader( + Display *dpy, + struct _XCVList ***tail) +{ + struct _XCVList *cvl; + + cvl = _XCreateCVL(dpy); +#ifdef XTHREADS_DEBUG + printf("_XPushReader called in thread %x, pushing %x\n", + xthread_self(), cvl); +#endif + **tail = cvl; + *tail = &cvl->next; + return cvl; +} + +/* signal the next thread waiting to read the connection */ + +static void _XPopReader( + Display *dpy, + struct _XCVList **list, + struct _XCVList ***tail) +{ + register struct _XCVList *front = *list; + +#ifdef XTHREADS_DEBUG + printf("_XPopReader called in thread %x, popping %x\n", + xthread_self(), front); +#endif + + if (dpy->flags & XlibDisplayProcConni) + /* we never added ourself in the first place */ + return; + + if (front) { /* check "front" for paranoia */ + *list = front->next; + if (*tail == &front->next) /* did we free the last elt? */ + *tail = list; + if (dpy->lock->num_free_cvls < NUM_FREE_CVLS) { + front->next = dpy->lock->free_cvls; + dpy->lock->free_cvls = front; + dpy->lock->num_free_cvls++; + } else { + xcondition_clear(front->cv); + Xfree(front->cv); + Xfree(front); + } + } + + /* signal new front after it is in place */ + if ((dpy->lock->reply_first = (dpy->lock->reply_awaiters != NULL))) { + ConditionSignal(dpy, dpy->lock->reply_awaiters->cv); + } else if (dpy->lock->event_awaiters) { + ConditionSignal(dpy, dpy->lock->event_awaiters->cv); + } +} + +static void _XConditionWait( + xcondition_t cv, + xmutex_t mutex + XTHREADS_FILE_LINE_ARGS + ) +{ +#ifdef XTHREADS_WARN + xthread_t self = xthread_self(); + char *old_file = locking_file; + int old_line = locking_line; + +#ifdef XTHREADS_DEBUG + printf("line %d thread %x in condition wait\n", line, self); +#endif + xthread_clear_id(locking_thread); + + locking_history[lock_hist_loc].file = file; + locking_history[lock_hist_loc].line = line; + locking_history[lock_hist_loc].thread = self; + locking_history[lock_hist_loc].lockp = False; + lock_hist_loc++; + if (lock_hist_loc >= LOCK_HIST_SIZE) + lock_hist_loc = 0; +#endif /* XTHREADS_WARN */ + + xcondition_wait(cv, mutex); + +#ifdef XTHREADS_WARN + locking_thread = self; + locking_file = old_file; + locking_line = old_line; + + locking_history[lock_hist_loc].file = file; + locking_history[lock_hist_loc].line = line; + locking_history[lock_hist_loc].thread = self; + locking_history[lock_hist_loc].lockp = True; + lock_hist_loc++; + if (lock_hist_loc >= LOCK_HIST_SIZE) + lock_hist_loc = 0; +#ifdef XTHREADS_DEBUG + printf("line %d thread %x was signaled\n", line, self); +#endif /* XTHREADS_DEBUG */ +#endif /* XTHREADS_WARN */ +} + +static void _XConditionSignal( + xcondition_t cv + XTHREADS_FILE_LINE_ARGS + ) +{ +#ifdef XTHREADS_WARN +#ifdef XTHREADS_DEBUG + printf("line %d thread %x is signalling\n", line, xthread_self()); +#endif +#endif + xcondition_signal(cv); +} + + +static void _XConditionBroadcast( + xcondition_t cv + XTHREADS_FILE_LINE_ARGS + ) +{ +#ifdef XTHREADS_WARN +#ifdef XTHREADS_DEBUG + printf("line %d thread %x is broadcasting\n", line, xthread_self()); +#endif +#endif + xcondition_broadcast(cv); +} + + +static void _XFreeDisplayLock( + Display *dpy) +{ + struct _XCVList *cvl; + + if (dpy->lock != NULL) { + if (dpy->lock->mutex != NULL) { + xmutex_clear(dpy->lock->mutex); + xmutex_free(dpy->lock->mutex); + } + if (dpy->lock->cv != NULL) { + xcondition_clear(dpy->lock->cv); + xcondition_free(dpy->lock->cv); + } + if (dpy->lock->writers != NULL) { + xcondition_clear(dpy->lock->writers); + xcondition_free(dpy->lock->writers); + } + while ((cvl = dpy->lock->free_cvls)) { + dpy->lock->free_cvls = cvl->next; + xcondition_clear(cvl->cv); + Xfree(cvl->cv); + Xfree(cvl); + } + Xfree(dpy->lock); + dpy->lock = NULL; + } + if (dpy->lock_fns != NULL) { + Xfree(dpy->lock_fns); + dpy->lock_fns = NULL; + } +} + +/* + * wait for thread with user-level display lock to release it. + */ + +static void _XDisplayLockWait( + Display *dpy) +{ + xthread_t self; + + while (dpy->lock->locking_level > 0) { + self = xthread_self(); + if (xthread_equal(dpy->lock->locking_thread, self)) + break; + ConditionWait(dpy, dpy->lock->cv); + } +} + +static void _XLockDisplay( + Display *dpy + XTHREADS_FILE_LINE_ARGS + ) +{ +#ifdef XTHREADS_WARN + _XLockDisplayWarn(dpy, file, line); +#else + xmutex_lock(dpy->lock->mutex); +#endif + if (dpy->lock->locking_level > 0) + _XDisplayLockWait(dpy); + _XIDHandler(dpy); + _XSeqSyncFunction(dpy); +} + +/* + * _XReply is allowed to exit from select/poll and clean up even if a + * user-level lock is in force, so it uses this instead of _XFancyLockDisplay. + */ +static void _XInternalLockDisplay( + Display *dpy, + Bool wskip + XTHREADS_FILE_LINE_ARGS + ) +{ +#ifdef XTHREADS_WARN + _XLockDisplayWarn(dpy, file, line); +#else + xmutex_lock(dpy->lock->mutex); +#endif + if (!wskip && dpy->lock->locking_level > 0) + _XDisplayLockWait(dpy); +} + +static void _XUserLockDisplay( + register Display* dpy) +{ + _XDisplayLockWait(dpy); + + if (++dpy->lock->locking_level == 1) { + dpy->lock->lock_wait = _XDisplayLockWait; + dpy->lock->locking_thread = xthread_self(); + } +} + +static +void _XUserUnlockDisplay( + register Display* dpy) +{ + if (dpy->lock->locking_level > 0 && --dpy->lock->locking_level == 0) { + /* signal other threads that might be waiting in XLockDisplay */ + ConditionBroadcast(dpy, dpy->lock->cv); + dpy->lock->lock_wait = NULL; + xthread_clear_id(dpy->lock->locking_thread); + } +} + +/* returns 0 if initialized ok, -1 if unable to allocate + a mutex or other memory */ + +static int _XInitDisplayLock( + Display *dpy) +{ + dpy->lock_fns = Xmalloc(sizeof(struct _XLockPtrs)); + if (dpy->lock_fns == NULL) + return -1; + dpy->lock = Xmalloc(sizeof(struct _XLockInfo)); + if (dpy->lock == NULL) { + _XFreeDisplayLock(dpy); + return -1; + } + dpy->lock->cv = xcondition_malloc(); + dpy->lock->mutex = xmutex_malloc(); + dpy->lock->writers = xcondition_malloc(); + if (!dpy->lock->cv || !dpy->lock->mutex || !dpy->lock->writers) { + _XFreeDisplayLock(dpy); + return -1; + } + + dpy->lock->reply_bytes_left = 0; + dpy->lock->reply_was_read = False; + dpy->lock->reply_awaiters = NULL; + dpy->lock->reply_awaiters_tail = &dpy->lock->reply_awaiters; + dpy->lock->event_awaiters = NULL; + dpy->lock->event_awaiters_tail = &dpy->lock->event_awaiters; + dpy->lock->reply_first = False; + dpy->lock->locking_level = 0; + dpy->lock->num_free_cvls = 0; + dpy->lock->free_cvls = NULL; + xthread_clear_id(dpy->lock->locking_thread); + xthread_clear_id(dpy->lock->reading_thread); + xthread_clear_id(dpy->lock->conni_thread); + xmutex_init(dpy->lock->mutex); + xmutex_set_name(dpy->lock->mutex, "Xlib Display"); + xcondition_init(dpy->lock->cv); + xcondition_set_name(dpy->lock->cv, "XLockDisplay"); + xcondition_init(dpy->lock->writers); + xcondition_set_name(dpy->lock->writers, "Xlib wait for writable"); + dpy->lock_fns->lock_display = _XLockDisplay; + dpy->lock->internal_lock_display = _XInternalLockDisplay; + dpy->lock_fns->unlock_display = _XUnlockDisplay; + dpy->lock->user_lock_display = _XUserLockDisplay; + dpy->lock->user_unlock_display = _XUserUnlockDisplay; + dpy->lock->pop_reader = _XPopReader; + dpy->lock->push_reader = _XPushReader; + dpy->lock->condition_wait = _XConditionWait; + dpy->lock->condition_signal = _XConditionSignal; + dpy->lock->condition_broadcast = _XConditionBroadcast; + dpy->lock->create_cvl = _XCreateCVL; + dpy->lock->lock_wait = NULL; /* filled in by XLockDisplay() */ + + return 0; +} + +#ifdef __UNIXWARE__ +xthread_t __x11_thr_self() { return 0; } +xthread_t (*_x11_thr_self)() = __x11_thr_self; +#endif + + +Status XInitThreads(void) +{ + if (_Xglobal_lock) + return 1; +#ifdef __UNIXWARE__ + else { + void *dl_handle = dlopen(NULL, RTLD_LAZY); + if (!dl_handle || + ((_x11_thr_self = (xthread_t(*)())dlsym(dl_handle,"thr_self")) == 0)) { + _x11_thr_self = __x11_thr_self; + (void) fprintf (stderr, + "XInitThreads called, but no libthread in the calling program!\n" ); + } + } +#endif /* __UNIXWARE__ */ +#ifdef xthread_init + xthread_init(); /* return value? */ +#endif + if (!(global_lock.lock = xmutex_malloc())) + return 0; + if (!(i18n_lock.lock = xmutex_malloc())) { + xmutex_free(global_lock.lock); + global_lock.lock = NULL; + return 0; + } + _Xglobal_lock = &global_lock; + xmutex_init(_Xglobal_lock->lock); + xmutex_set_name(_Xglobal_lock->lock, "Xlib global"); + _Xi18n_lock = &i18n_lock; + xmutex_init(_Xi18n_lock->lock); + xmutex_set_name(_Xi18n_lock->lock, "Xlib i18n"); + _XLockMutex_fn = _XLockMutex; + _XUnlockMutex_fn = _XUnlockMutex; + _XCreateMutex_fn = _XCreateMutex; + _XFreeMutex_fn = _XFreeMutex; + _XInitDisplayLock_fn = _XInitDisplayLock; + _XFreeDisplayLock_fn = _XFreeDisplayLock; + _Xthread_self_fn = _Xthread_self; + +#ifdef XTHREADS_WARN +#ifdef XTHREADS_DEBUG + setlinebuf(stdout); /* for debugging messages */ +#endif +#endif + + return 1; +} + +#else /* XTHREADS */ +Status XInitThreads(void) +{ + return 0; +} +#endif /* XTHREADS */ diff --git a/nx-X11/lib/src/locking.h b/nx-X11/lib/src/locking.h new file mode 100644 index 000000000..277c9afc8 --- /dev/null +++ b/nx-X11/lib/src/locking.h @@ -0,0 +1,156 @@ +/* + +Copyright 1992, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Author: Stephen Gildea, MIT X Consortium + * + * locking.h - data types for C Threads locking. + * Used by XlibInt.c, locking.c, LockDis.c + */ + +#ifndef _X_locking_H_ +#define _X_locking_H_ + +#define xmalloc(s) Xmalloc(s) +#define xfree(s) Xfree(s) +#include +#include +#include + +struct _XCVList { + xcondition_t cv; + xReply *buf; + struct _XCVList *next; +}; + +extern xthread_t (*_Xthread_self_fn)( /* in XlibInt.c */ + void +); + +/* Display->lock is a pointer to one of these */ + +struct _XLockInfo { + xmutex_t mutex; /* mutex for critical sections */ + int reply_bytes_left; /* nbytes of the reply still to read */ + Bool reply_was_read; /* _XReadEvents read a reply for _XReply */ + struct _XCVList *reply_awaiters; /* list of CVs for _XReply */ + struct _XCVList **reply_awaiters_tail; + struct _XCVList *event_awaiters; /* list of CVs for _XReadEvents */ + struct _XCVList **event_awaiters_tail; + Bool reply_first; /* who may read, reply queue or event queue */ + /* for XLockDisplay */ + int locking_level; /* how many times into XLockDisplay we are */ + xthread_t locking_thread; /* thread that did XLockDisplay */ + xcondition_t cv; /* wait if another thread has XLockDisplay */ + xthread_t reading_thread; /* cache */ + xthread_t conni_thread; /* thread in XProcessInternalConnection */ + xcondition_t writers; /* wait for writable */ + int num_free_cvls; + struct _XCVList *free_cvls; + /* used only in XlibInt.c */ + void (*pop_reader)( + Display* /* dpy */, + struct _XCVList** /* list */, + struct _XCVList*** /* tail */ + ); + struct _XCVList *(*push_reader)( + Display * /* dpy */, + struct _XCVList*** /* tail */ + ); + void (*condition_wait)( + xcondition_t /* cv */, + xmutex_t /* mutex */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char* /* file */, + int /* line */ +#endif + ); + void (*internal_lock_display)( + Display* /* dpy */, + Bool /* wskip */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char* /* file */, + int /* line */ +#endif + ); + /* used in XlibInt.c and locking.c */ + void (*condition_signal)( + xcondition_t /* cv */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char* /* file */, + int /* line */ +#endif + ); + void (*condition_broadcast)( + xcondition_t /* cv */ +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) + , char* /* file */, + int /* line */ +#endif + ); + /* used in XlibInt.c and XLockDis.c */ + void (*lock_wait)( + Display* /* dpy */ + ); + void (*user_lock_display)( + Display* /* dpy */ + ); + void (*user_unlock_display)( + Display* /* dpy */ + ); + struct _XCVList *(*create_cvl)( + Display * /* dpy */ + ); +}; + +#define UnlockNextEventReader(d) if ((d)->lock) \ + (*(d)->lock->pop_reader)((d),&(d)->lock->event_awaiters,&(d)->lock->event_awaiters_tail) + +#if defined(XTHREADS_WARN) || defined(XTHREADS_FILE_LINE) +#define ConditionWait(d,c) if ((d)->lock) \ + (*(d)->lock->condition_wait)(c, (d)->lock->mutex,__FILE__,__LINE__) +#define ConditionSignal(d,c) if ((d)->lock) \ + (*(d)->lock->condition_signal)(c,__FILE__,__LINE__) +#define ConditionBroadcast(d,c) if ((d)->lock) \ + (*(d)->lock->condition_broadcast)(c,__FILE__,__LINE__) +#else +#define ConditionWait(d,c) if ((d)->lock) \ + (*(d)->lock->condition_wait)(c, (d)->lock->mutex) +#define ConditionSignal(d,c) if ((d)->lock) \ + (*(d)->lock->condition_signal)(c) +#define ConditionBroadcast(d,c) if ((d)->lock) \ + (*(d)->lock->condition_broadcast)(c) +#endif + +typedef struct _LockInfoRec { + xmutex_t lock; +} LockInfoRec; + +/* XOpenDis.c */ +extern int (*_XInitDisplayLock_fn)(Display *dpy); +extern void (*_XFreeDisplayLock_fn)(Display *dpy); + +#endif /* _X_locking_H_ */ diff --git a/nx-X11/lib/src/pathmax.h b/nx-X11/lib/src/pathmax.h new file mode 100644 index 000000000..86e65fadf --- /dev/null +++ b/nx-X11/lib/src/pathmax.h @@ -0,0 +1,81 @@ + +/*********************************************************** + +Copyright 1987, 1988, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987, 1988 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +/* + * Provides a single definition of PATH_MAX instead of replicating this mess + * in multiple files + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include + +#ifndef X_NOT_POSIX +#ifdef _POSIX_SOURCE +#include +#else +#define _POSIX_SOURCE +#include +#undef _POSIX_SOURCE +#endif +#endif +#ifndef PATH_MAX +#ifdef WIN32 +#define PATH_MAX 512 +#else +#include +#endif +#ifndef PATH_MAX +#ifdef MAXPATHLEN +#define PATH_MAX MAXPATHLEN +#else +#define PATH_MAX 1024 +#endif +#endif +#endif diff --git a/nx-X11/lib/src/poly.h b/nx-X11/lib/src/poly.h new file mode 100644 index 000000000..e064783d7 --- /dev/null +++ b/nx-X11/lib/src/poly.h @@ -0,0 +1,294 @@ +/************************************************************************ + +Copyright 1987, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +Copyright 1987 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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +************************************************************************/ + +/* + * This file contains a few macros to help track + * the edge of a filled object. The object is assumed + * to be filled in scanline order, and thus the + * algorithm used is an extension of Bresenham's line + * drawing algorithm which assumes that y is always the + * major axis. + * Since these pieces of code are the same for any filled shape, + * it is more convenient to gather the library in one + * place, but since these pieces of code are also in + * the inner loops of output primitives, procedure call + * overhead is out of the question. + * See the author for a derivation if needed. + */ + + +/* + * In scan converting polygons, we want to choose those pixels + * which are inside the polygon. Thus, we add .5 to the starting + * x coordinate for both left and right edges. Now we choose the + * first pixel which is inside the pgon for the left edge and the + * first pixel which is outside the pgon for the right edge. + * Draw the left pixel, but not the right. + * + * How to add .5 to the starting x coordinate: + * If the edge is moving to the right, then subtract dy from the + * error term from the general form of the algorithm. + * If the edge is moving to the left, then add dy to the error term. + * + * The reason for the difference between edges moving to the left + * and edges moving to the right is simple: If an edge is moving + * to the right, then we want the algorithm to flip immediately. + * If it is moving to the left, then we don't want it to flip until + * we traverse an entire pixel. + */ +#define BRESINITPGON(dy, x1, x2, xStart, d, m, m1, incr1, incr2) { \ + int dx; /* local storage */ \ +\ + /* \ + * if the edge is horizontal, then it is ignored \ + * and assumed not to be processed. Otherwise, do this stuff. \ + */ \ + if ((dy) != 0) { \ + xStart = (x1); \ + dx = (x2) - xStart; \ + if (dx < 0) { \ + m = dx / (dy); \ + m1 = m - 1; \ + incr1 = -2 * dx + 2 * (dy) * m1; \ + incr2 = -2 * dx + 2 * (dy) * m; \ + d = 2 * m * (dy) - 2 * dx - 2 * (dy); \ + } else { \ + m = dx / (dy); \ + m1 = m + 1; \ + incr1 = 2 * dx - 2 * (dy) * m1; \ + incr2 = 2 * dx - 2 * (dy) * m; \ + d = -2 * m * (dy) + 2 * dx; \ + } \ + } \ +} + +#define BRESINCRPGON(d, minval, m, m1, incr1, incr2) { \ + if (m1 > 0) { \ + if (d > 0) { \ + minval += m1; \ + d += incr1; \ + } \ + else { \ + minval += m; \ + d += incr2; \ + } \ + } else {\ + if (d >= 0) { \ + minval += m1; \ + d += incr1; \ + } \ + else { \ + minval += m; \ + d += incr2; \ + } \ + } \ +} + + +/* + * This structure contains all of the information needed + * to run the bresenham algorithm. + * The variables may be hardcoded into the declarations + * instead of using this structure to make use of + * register declarations. + */ +typedef struct { + int minor_axis; /* minor axis */ + int d; /* decision variable */ + int m, m1; /* slope and slope+1 */ + int incr1, incr2; /* error increments */ +} BRESINFO; + + +#define BRESINITPGONSTRUCT(dmaj, min1, min2, bres) \ + BRESINITPGON(dmaj, min1, min2, bres.minor_axis, bres.d, \ + bres.m, bres.m1, bres.incr1, bres.incr2) + +#define BRESINCRPGONSTRUCT(bres) \ + BRESINCRPGON(bres.d, bres.minor_axis, bres.m, bres.m1, bres.incr1, bres.incr2) + + + +/* + * These are the data structures needed to scan + * convert regions. Two different scan conversion + * methods are available -- the even-odd method, and + * the winding number method. + * The even-odd rule states that a point is inside + * the polygon if a ray drawn from that point in any + * direction will pass through an odd number of + * path segments. + * By the winding number rule, a point is decided + * to be inside the polygon if a ray drawn from that + * point in any direction passes through a different + * number of clockwise and counter-clockwise path + * segments. + * + * These data structures are adapted somewhat from + * the algorithm in (Foley/Van Dam) for scan converting + * polygons. + * The basic algorithm is to start at the top (smallest y) + * of the polygon, stepping down to the bottom of + * the polygon by incrementing the y coordinate. We + * keep a list of edges which the current scanline crosses, + * sorted by x. This list is called the Active Edge Table (AET) + * As we change the y-coordinate, we update each entry in + * in the active edge table to reflect the edges new xcoord. + * This list must be sorted at each scanline in case + * two edges intersect. + * We also keep a data structure known as the Edge Table (ET), + * which keeps track of all the edges which the current + * scanline has not yet reached. The ET is basically a + * list of ScanLineList structures containing a list of + * edges which are entered at a given scanline. There is one + * ScanLineList per scanline at which an edge is entered. + * When we enter a new edge, we move it from the ET to the AET. + * + * From the AET, we can implement the even-odd rule as in + * (Foley/Van Dam). + * The winding number rule is a little trickier. We also + * keep the EdgeTableEntries in the AET linked by the + * nextWETE (winding EdgeTableEntry) link. This allows + * the edges to be linked just as before for updating + * purposes, but only uses the edges linked by the nextWETE + * link as edges representing spans of the polygon to + * drawn (as with the even-odd rule). + */ + +/* + * for the winding number rule + */ +#define CLOCKWISE 1 +#define COUNTERCLOCKWISE -1 + +typedef struct _EdgeTableEntry { + int ymax; /* ycoord at which we exit this edge. */ + BRESINFO bres; /* Bresenham info to run the edge */ + struct _EdgeTableEntry *next; /* next in the list */ + struct _EdgeTableEntry *back; /* for insertion sort */ + struct _EdgeTableEntry *nextWETE; /* for winding num rule */ + int ClockWise; /* flag for winding number rule */ +} EdgeTableEntry; + + +typedef struct _ScanLineList{ + int scanline; /* the scanline represented */ + EdgeTableEntry *edgelist; /* header node */ + struct _ScanLineList *next; /* next in the list */ +} ScanLineList; + + +typedef struct { + int ymax; /* ymax for the polygon */ + int ymin; /* ymin for the polygon */ + ScanLineList scanlines; /* header node */ +} EdgeTable; + + +/* + * Here is a struct to help with storage allocation + * so we can allocate a big chunk at a time, and then take + * pieces from this heap when we need to. + */ +#define SLLSPERBLOCK 25 + +typedef struct _ScanLineListBlock { + ScanLineList SLLs[SLLSPERBLOCK]; + struct _ScanLineListBlock *next; +} ScanLineListBlock; + + + +/* + * + * a few macros for the inner loops of the fill code where + * performance considerations don't allow a procedure call. + * + * Evaluate the given edge at the given scanline. + * If the edge has expired, then we leave it and fix up + * the active edge table; otherwise, we increment the + * x value to be ready for the next scanline. + * The winding number rule is in effect, so we must notify + * the caller when the edge has been removed so he + * can reorder the Winding Active Edge Table. + */ +#define EVALUATEEDGEWINDING(pAET, pPrevAET, y, fixWAET) { \ + if (pAET->ymax == y) { /* leaving this edge */ \ + pPrevAET->next = pAET->next; \ + pAET = pPrevAET->next; \ + fixWAET = 1; \ + if (pAET) \ + pAET->back = pPrevAET; \ + } \ + else { \ + BRESINCRPGONSTRUCT(pAET->bres); \ + pPrevAET = pAET; \ + pAET = pAET->next; \ + } \ +} + + +/* + * Evaluate the given edge at the given scanline. + * If the edge has expired, then we leave it and fix up + * the active edge table; otherwise, we increment the + * x value to be ready for the next scanline. + * The even-odd rule is in effect. + */ +#define EVALUATEEDGEEVENODD(pAET, pPrevAET, y) { \ + if (pAET->ymax == y) { /* leaving this edge */ \ + pPrevAET->next = pAET->next; \ + pAET = pPrevAET->next; \ + if (pAET) \ + pAET->back = pPrevAET; \ + } \ + else { \ + BRESINCRPGONSTRUCT(pAET->bres); \ + pPrevAET = pAET; \ + pAET = pAET->next; \ + } \ +} diff --git a/nx-X11/lib/src/util/Makefile.am b/nx-X11/lib/src/util/Makefile.am new file mode 100644 index 000000000..31847cc1a --- /dev/null +++ b/nx-X11/lib/src/util/Makefile.am @@ -0,0 +1,15 @@ +NULL = + +noinst_PROGRAMS=makekeys + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/../exports/include \ + $(NULL) + +EXTRA_DIST = mkks.sh diff --git a/nx-X11/lib/src/util/makekeys.c b/nx-X11/lib/src/util/makekeys.c new file mode 100644 index 000000000..897b882dc --- /dev/null +++ b/nx-X11/lib/src/util/makekeys.c @@ -0,0 +1,317 @@ +/* + +Copyright 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* Constructs hash tables for XStringToKeysym and XKeysymToString. */ + +#include +#include +#include +#include +#include +#include + +#include "../Xresinternal.h" + +#define KTNUM 4000 + +static struct info { + char *name; + KeySym val; +} info[KTNUM]; + +#define MIN_REHASH 15 +#define MATCHES 10 + +static char tab[KTNUM]; +static unsigned short offsets[KTNUM]; +static unsigned short indexes[KTNUM]; +static KeySym values[KTNUM]; +static int ksnum = 0; + +static int +parse_line(const char *buf, char *key, KeySym *val, char *prefix) +{ + int i; + char alias[128]; + char *tmp, *tmpa; + + /* See if we can catch a straight XK_foo 0x1234-style definition first; + * the trickery around tmp is to account for prefices. */ + i = sscanf(buf, "#define %127s 0x%lx", key, val); + if (i == 2 && (tmp = strstr(key, "XK_"))) { + memcpy(prefix, key, tmp - key); + prefix[tmp - key] = '\0'; + tmp += 3; + memmove(key, tmp, strlen(tmp) + 1); + return 1; + } + + /* Now try to catch alias (XK_foo XK_bar) definitions, and resolve them + * immediately: if the target is in the form XF86XK_foo, we need to + * canonicalise this to XF86foo before we do the lookup. */ + i = sscanf(buf, "#define %127s %127s", key, alias); + if (i == 2 && (tmp = strstr(key, "XK_")) && (tmpa = strstr(alias, "XK_"))) { + memcpy(prefix, key, tmp - key); + prefix[tmp - key] = '\0'; + tmp += 3; + memmove(key, tmp, strlen(tmp) + 1); + memmove(tmpa, tmpa + 3, strlen(tmpa + 3) + 1); + + for (i = ksnum - 1; i >= 0; i--) { + if (strcmp(info[i].name, alias) == 0) { + *val = info[i].val; + return 1; + } + } + + fprintf(stderr, "can't find matching definition %s for keysym %s%s\n", + alias, prefix, key); + } + + return 0; +} + +int +main(int argc, char *argv[]) +{ + int max_rehash; + Signature sig; + int i, j, k, l, z; + FILE *fptr; + char *name; + char c; + int first; + int best_max_rehash; + int best_z = 0; + int num_found; + KeySym val; + char key[128], prefix[128]; + static char buf[1024]; + + for (l = 1; l < argc; l++) { + fptr = fopen(argv[l], "r"); + if (!fptr) { + fprintf(stderr, "couldn't open %s\n", argv[l]); + continue; + } + + while (fgets(buf, sizeof(buf), fptr)) { + if (!parse_line(buf, key, &val, prefix)) + continue; + + if (val == XK_VoidSymbol) + val = 0; + if (val > 0x1fffffff) { + fprintf(stderr, "ignoring illegal keysym (%s, %lx)\n", key, + val); + continue; + } + + name = malloc(strlen(prefix) + strlen(key) + 1); + if (!name) { + fprintf(stderr, "makekeys: out of memory!\n"); + exit(1); + } + sprintf(name, "%s%s", prefix, key); + info[ksnum].name = name; + info[ksnum].val = val; + ksnum++; + if (ksnum == KTNUM) { + fprintf(stderr, "makekeys: too many keysyms!\n"); + exit(1); + } + } + + fclose(fptr); + } + + printf("/* This file is generated from keysymdef.h. */\n"); + printf("/* Do not edit. */\n"); + printf("\n"); + + best_max_rehash = ksnum; + num_found = 0; + for (z = ksnum; z < KTNUM; z++) { + max_rehash = 0; + for (name = tab, i = z; --i >= 0;) + *name++ = 0; + for (i = 0; i < ksnum; i++) { + name = info[i].name; + sig = 0; + while ((c = *name++)) + sig = (sig << 1) + c; + first = j = sig % z; + for (k = 0; tab[j]; k++) { + j += first + 1; + if (j >= z) + j -= z; + if (j == first) + goto next1; + } + tab[j] = 1; + if (k > max_rehash) + max_rehash = k; + } + if (max_rehash < MIN_REHASH) { + if (max_rehash < best_max_rehash) { + best_max_rehash = max_rehash; + best_z = z; + } + num_found++; + if (num_found >= MATCHES) + break; + } +next1: ; + } + + z = best_z; + if (z == 0) { + fprintf(stderr, "makekeys: failed to find small enough hash!\n" + "Try increasing KTNUM in makekeys.c\n"); + exit(1); + } + printf("#ifdef NEEDKTABLE\n"); + printf("const unsigned char _XkeyTable[] = {\n"); + printf("0,\n"); + k = 1; + for (i = 0; i < ksnum; i++) { + name = info[i].name; + sig = 0; + while ((c = *name++)) + sig = (sig << 1) + c; + first = j = sig % z; + while (offsets[j]) { + j += first + 1; + if (j >= z) + j -= z; + } + offsets[j] = k; + indexes[i] = k; + val = info[i].val; + printf("0x%.2"PRIx32", 0x%.2"PRIx32", 0x%.2lx, 0x%.2lx, 0x%.2lx, 0x%.2lx, ", + (sig >> 8) & 0xff, sig & 0xff, + (val >> 24) & 0xff, (val >> 16) & 0xff, + (val >> 8) & 0xff, val & 0xff); + for (name = info[i].name, k += 7; (c = *name++); k++) + printf("'%c',", c); + printf((i == (ksnum-1)) ? "0\n" : "0,\n"); + } + printf("};\n"); + printf("\n"); + printf("#define KTABLESIZE %d\n", z); + printf("#define KMAXHASH %d\n", best_max_rehash + 1); + printf("\n"); + printf("static const unsigned short hashString[KTABLESIZE] = {\n"); + for (i = 0; i < z;) { + printf("0x%.4x", offsets[i]); + i++; + if (i == z) + break; + printf((i & 7) ? ", " : ",\n"); + } + printf("\n"); + printf("};\n"); + printf("#endif /* NEEDKTABLE */\n"); + + best_max_rehash = ksnum; + num_found = 0; + for (z = ksnum; z < KTNUM; z++) { + max_rehash = 0; + for (name = tab, i = z; --i >= 0;) + *name++ = 0; + for (i = 0; i < ksnum; i++) { + val = info[i].val; + first = j = val % z; + for (k = 0; tab[j]; k++) { + if (values[j] == val) + goto skip1; + j += first + 1; + if (j >= z) + j -= z; + if (j == first) + goto next2; + } + tab[j] = 1; + values[j] = val; + if (k > max_rehash) + max_rehash = k; +skip1: ; + } + if (max_rehash < MIN_REHASH) { + if (max_rehash < best_max_rehash) { + best_max_rehash = max_rehash; + best_z = z; + } + num_found++; + if (num_found >= MATCHES) + break; + } +next2: ; + } + + z = best_z; + if (z == 0) { + fprintf(stderr, "makekeys: failed to find small enough hash!\n" + "Try increasing KTNUM in makekeys.c\n"); + exit(1); + } + for (i = z; --i >= 0;) + offsets[i] = 0; + for (i = 0; i < ksnum; i++) { + val = info[i].val; + first = j = val % z; + while (offsets[j]) { + if (values[j] == val) + goto skip2; + j += first + 1; + if (j >= z) + j -= z; + } + offsets[j] = indexes[i] + 2; + values[j] = val; +skip2: ; + } + printf("\n"); + printf("#ifdef NEEDVTABLE\n"); + printf("#define VTABLESIZE %d\n", z); + printf("#define VMAXHASH %d\n", best_max_rehash + 1); + printf("\n"); + printf("static const unsigned short hashKeysym[VTABLESIZE] = {\n"); + for (i = 0; i < z;) { + printf("0x%.4x", offsets[i]); + i++; + if (i == z) + break; + printf((i & 7) ? ", " : ",\n"); + } + printf("\n"); + printf("};\n"); + printf("#endif /* NEEDVTABLE */\n"); + + exit(0); +} diff --git a/nx-X11/lib/src/util/mkks.sh b/nx-X11/lib/src/util/mkks.sh new file mode 100644 index 000000000..ab5ca80c9 --- /dev/null +++ b/nx-X11/lib/src/util/mkks.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +cat $* | awk 'BEGIN { \ + printf "/*\n * This file is generated from %s. Do not edit.\n */\n", \ + "$(INCLUDESRC)/keysymdef.h";\ +} \ +/^#define/ { \ + len = length($2)-3; \ + printf("{ \"%s\", %s },\n", substr($2,4,len), $3); \ +}' diff --git a/nx-X11/lib/src/utlist.h b/nx-X11/lib/src/utlist.h new file mode 100644 index 000000000..215c2c62e --- /dev/null +++ b/nx-X11/lib/src/utlist.h @@ -0,0 +1,116 @@ +/* +Copyright (c) 2007-2009, Troy D. Hanson +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS 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 COPYRIGHT OWNER +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. +*/ + +#ifndef UTLIST_H +#define UTLIST_H + +#define UTLIST_VERSION 1.7 + +/* From: http://uthash.sourceforge.net/utlist.html */ +/* + * This file contains macros to manipulate singly and doubly-linked lists. + * + * 1. LL_ macros: singly-linked lists. + * 2. DL_ macros: doubly-linked lists. + * 3. CDL_ macros: circular doubly-linked lists. + * + * To use singly-linked lists, your structure must have a "next" pointer. + * To use doubly-linked lists, your structure must "prev" and "next" pointers. + * Either way, the pointer to the head of the list must be initialized to NULL. + * + * ----------------.EXAMPLE ------------------------- + * struct item { + * int id; + * struct item *prev, *next; + * } + * + * struct item *list = NULL: + * + * int main() { + * struct item *item; + * ... allocate and populate item ... + * DL_APPEND(list, item); + * } + * -------------------------------------------------- + * + * For doubly-linked lists, the append and delete macros are O(1) + * For singly-linked lists, append and delete are O(n) but prepend is O(1) + * The sort macro is O(n log(n)) for all types of single/double/circular lists. + */ + + +/****************************************************************************** + * doubly linked list macros (non-circular) * + *****************************************************************************/ +#define DL_PREPEND(head,add) \ +do { \ + (add)->next = head; \ + if (head) { \ + (add)->prev = (head)->prev; \ + (head)->prev = (add); \ + } else { \ + (add)->prev = (add); \ + } \ + (head) = (add); \ +} while (0) + +#define DL_APPEND(head,add) \ +do { \ + if (head) { \ + (add)->prev = (head)->prev; \ + (head)->prev->next = (add); \ + (head)->prev = (add); \ + (add)->next = NULL; \ + } else { \ + (head)=(add); \ + (head)->prev = (head); \ + (head)->next = NULL; \ + } \ +} while (0); + +#define DL_DELETE(head,del) \ +do { \ + if ((del)->prev == (del)) { \ + (head)=NULL; \ + } else if ((del)==(head)) { \ + (del)->next->prev = (del)->prev; \ + (head) = (del)->next; \ + } else { \ + (del)->prev->next = (del)->next; \ + if ((del)->next) { \ + (del)->next->prev = (del)->prev; \ + } else { \ + (head)->prev = (del)->prev; \ + } \ + } \ +} while (0); + + +#define DL_FOREACH(head,el) \ + for(el=head;el;el=el->next) + +#define DL_FOREACH_SAFE(head,el,tmp) \ + for(el=head,tmp=el->next;el;el=tmp,tmp=(el) ? (el->next) : NULL) + +#endif /* UTLIST_H */ + diff --git a/nx-X11/lib/src/x11_trans.c b/nx-X11/lib/src/x11_trans.c new file mode 100644 index 000000000..40df7b9b1 --- /dev/null +++ b/nx-X11/lib/src/x11_trans.c @@ -0,0 +1,30 @@ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#define X11_t 1 +#define TRANS_CLIENT 1 +#include + diff --git a/nx-X11/lib/src/xcms/AddDIC.c b/nx-X11/lib/src/xcms/AddDIC.c new file mode 100644 index 000000000..ecc6650ab --- /dev/null +++ b/nx-X11/lib/src/xcms/AddDIC.c @@ -0,0 +1,149 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsAddDIC.c + * + * DESCRIPTION + * Source for XcmsAddColorSpace + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/* + * DEFINES + */ +#define NextUnregDiCsID(lastid) \ + (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DI_ID) +#define MAX(x,y) ((x) < (y) ? (y) : (x)) + + +/* + * NAME + * XcmsAddColorSpace - Add a Device-Independent Color Space + * + * SYNOPSIS + */ +Status +XcmsAddColorSpace(XcmsColorSpace *pCS) +/* + * DESCRIPTION + * DI Color Spaces are managed on a global basis. + * This means that with exception of the provided DI color spaces: + * CIEXYZ, CIExyY, CIELab, CIEuvY, CIELuv, and TekHVC + * DI color spaces may have different XcmsColorFormat IDs between + * clients. So, you must be careful when using XcmsColor + * structures between clients! Use the routines XcmsFormatOfPrefix() + * and XcmsPrefixOfFormat() appropriately. + * + * RETURNS + * XcmsSuccess if succeeded, otherwise XcmsFailure + */ +{ + XcmsColorSpace **papColorSpaces; + XcmsColorSpace *ptmpCS; + XcmsColorFormat lastID = 0; + + if ((pCS->id = _XcmsRegFormatOfPrefix(pCS->prefix)) != 0) { + if (XCMS_DD_ID(pCS->id)) { + /* This is a Device-Dependent Color Space */ + return(XcmsFailure); + } + /* + * REGISTERED DI Color Space + * then see if the color space has already been added to the + * system: + * a. If the same ID/prefix and same XcmsColorSpec is found, + * then its a duplicate, so return success. + * b. If same ID/prefix but different XcmsColorSpec is + * found, then add the color space to the front of the + * list using the same ID. This allows one to override + * an existing DI Color Space. + * c. Otherwise none found so just add the color space. + */ + if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { + while ((ptmpCS = *papColorSpaces++) != NULL) { + if (pCS->id == ptmpCS->id) { + if (pCS == ptmpCS) { + /* a. duplicate*/ + return(XcmsSuccess); + } + /* b. same ID/prefix but different XcmsColorSpace */ + break; + } + } + } + /* c. None found */ + } else { + /* + * UNREGISTERED DI Color Space + * then see if the color space has already been added to the + * system: + * a. If same prefix and XcmsColorSpec, then + * its a duplicate ... return success. + * b. If same prefix but different XcmsColorSpec, then + * add the color space to the front of the list using + * the same ID. This allows one to override an existing + * DI Color Space. + * c. Otherwise none found so, add the color space using the + * next unregistered ID for the connection. + */ + if ((papColorSpaces = _XcmsDIColorSpaces) != NULL) { + while ((ptmpCS = *papColorSpaces++) != NULL) { + lastID = MAX(lastID, ptmpCS->id); + if (strcmp(pCS->prefix, ptmpCS->prefix) == 0) { + if (pCS == ptmpCS) { + /* a. duplicate */ + return(XcmsSuccess); + } + /* b. same prefix but different XcmsColorSpec */ + pCS->id = ptmpCS->id; + goto AddColorSpace; + } + } + } + /* c. None found */ + pCS->id = NextUnregDiCsID(lastID); + } + + +AddColorSpace: + if ((papColorSpaces = (XcmsColorSpace **) + _XcmsPushPointerArray((XPointer *)_XcmsDIColorSpaces, + (XPointer)pCS, + (XPointer *)_XcmsDIColorSpacesInit)) == NULL) { + return(XcmsFailure); + } + _XcmsDIColorSpaces = papColorSpaces; + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/AddSF.c b/nx-X11/lib/src/xcms/AddSF.c new file mode 100644 index 000000000..2e244e73b --- /dev/null +++ b/nx-X11/lib/src/xcms/AddSF.c @@ -0,0 +1,145 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsAddSF.c + * + * DESCRIPTION + * Source for XcmsAddFunctionSet + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + */ +#define NextUnregDdCsID(lastid) \ + (XCMS_UNREG_ID(lastid) ? ++lastid : XCMS_FIRST_UNREG_DD_ID) +#define MIN(x,y) ((x) > (y) ? (y) : (x)) + + +/* + * NAME + * XcmsAddFunctionSet - Add an Screen Color Characterization + * Function Set + * + * SYNOPSIS + */ +Status +XcmsAddFunctionSet(XcmsFunctionSet *pNewFS) +/* + * DESCRIPTION + * Additional Screen Color Characterization Function Sets are + * managed on a global basis. This means that with exception + * of the provided DD color spaces: + * RGB and RGBi + * DD color spaces may have different XcmsColorFormat IDs between + * clients. So, you must be careful when using XcmsColorFormat + * across clients! Use the routines XcmsFormatOfPrefix() + * and XcmsPrefixOfFormat() appropriately. + * + * RETURNS + * XcmsSuccess if succeeded, otherwise XcmsFailure + * + * CAVEATS + * Additional Screen Color Characterization Function Sets + * should be added prior to any use of the routine + * XcmsCreateCCC(). If not, XcmsCCC structures created + * prior to the call of this routines will not have had + * a chance to initialize using the added Screen Color + * Characterization Function Set. + */ +{ + XcmsFunctionSet **papSCCFuncSets = _XcmsSCCFuncSets; + XcmsColorSpace **papNewCSs; + XcmsColorSpace *pNewCS, **paptmpCS; + XcmsColorFormat lastID = 0; + + + if (papSCCFuncSets != NULL) { + if ((papNewCSs = pNewFS->DDColorSpaces) == NULL) { + /* + * Error, new Screen Color Characterization Function Set + * missing color spaces + */ + return(XcmsFailure); + } + while ((pNewCS = *papNewCSs++) != NULL) { + if ((pNewCS->id = _XcmsRegFormatOfPrefix(pNewCS->prefix)) != 0) { + if (XCMS_DI_ID(pNewCS->id)) { + /* This is a Device-Independent Color Space */ + return(XcmsFailure); + } + /* + * REGISTERED DD Color Space + * therefore use the registered ID. + */ + } else { + /* + * UNREGISTERED DD Color Space + * then see if the color space is already in + * _XcmsDDColorSpaces. + * a. If same prefix, then use the same ID. + * b. Otherwise, use a new ID. + */ + for (paptmpCS = _XcmsDDColorSpaces; *paptmpCS != NULL; + paptmpCS++){ + lastID = MIN(lastID, (*paptmpCS)->id); + if (strcmp(pNewCS->prefix, (*paptmpCS)->prefix) == 0) { + pNewCS->id = (*paptmpCS)->id; + break; + } + } + if (pNewCS->id == 0) { + /* still haven't found one */ + pNewCS->id = NextUnregDdCsID(lastID); + if ((paptmpCS = (XcmsColorSpace **)_XcmsPushPointerArray( + (XPointer *) _XcmsDDColorSpaces, + (XPointer) pNewCS, + (XPointer *) _XcmsDDColorSpacesInit)) == NULL) { + return(XcmsFailure); + } + _XcmsDDColorSpaces = paptmpCS; + } + } + } + } + if ((papSCCFuncSets = (XcmsFunctionSet **) + _XcmsPushPointerArray((XPointer *) _XcmsSCCFuncSets, + (XPointer) pNewFS, + (XPointer *)_XcmsSCCFuncSetsInit)) == NULL) { + return(XcmsFailure); + } + _XcmsSCCFuncSets = papSCCFuncSets; + + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/CCC.c b/nx-X11/lib/src/xcms/CCC.c new file mode 100644 index 000000000..de6d6318a --- /dev/null +++ b/nx-X11/lib/src/xcms/CCC.c @@ -0,0 +1,285 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsCCC.c - Color Conversion Context Routines + * + * DESCRIPTION + * Routines to create, access, and free Color Conversion + * Context structures. + * + * + */ + +/* + +Copyright 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCreateCCC + * + * SYNOPSIS + */ + +XcmsCCC +XcmsCreateCCC( + Display *dpy, + int screenNumber, + Visual *visual, + XcmsColor *clientWhitePt, + XcmsCompressionProc gamutCompProc, + XPointer gamutCompClientData, + XcmsWhiteAdjustProc whitePtAdjProc, + XPointer whitePtAdjClientData) +/* + * DESCRIPTION + * Given a Display, Screen, Visual, etc., this routine creates + * an appropriate Color Conversion Context. + * + * RETURNS + * Returns NULL if failed; otherwise address of the newly + * created XcmsCCC. + * + */ +{ + XcmsCCC pDefaultCCC = XcmsDefaultCCC(dpy, screenNumber); + XcmsCCC newccc; + XcmsIntensityMap *pIMap; + XcmsPerScrnInfo *pNewScrnInfo; + + if (pDefaultCCC == NULL || + !(newccc = Xcalloc(1, sizeof(XcmsCCCRec)))) { + return(NULL); + } + + /* + * Should inherit the following as result of a memmove(): + * dpy + * screenNumber + * pPerScrnInfo + */ + memcpy((char *)newccc, (char *)pDefaultCCC, sizeof(XcmsCCCRec)); + if (clientWhitePt) { + memcpy((char *)&newccc->clientWhitePt, (char *)clientWhitePt, + sizeof(XcmsColor)); + } + if (gamutCompProc) { + newccc->gamutCompProc = gamutCompProc; + } + if (gamutCompClientData) { + newccc->gamutCompClientData = gamutCompClientData; + } + if (whitePtAdjProc) { + newccc->whitePtAdjProc = whitePtAdjProc; + } + if (whitePtAdjClientData) { + newccc->whitePtAdjClientData = whitePtAdjClientData; + } + + /* + * Now check our list of per-Visual Intensity tables. + * If one exists replace the pPerScrnInfo. + */ + if ((pIMap = _XcmsGetIntensityMap(dpy, visual)) != NULL) { + if (!(pNewScrnInfo = Xcalloc(1, sizeof(XcmsPerScrnInfo)))) { + Xfree(newccc); + return(NULL); + } + memcpy((char *)pNewScrnInfo, (char *)newccc->pPerScrnInfo, + sizeof(XcmsPerScrnInfo)); + pNewScrnInfo->screenData = pIMap->screenData; + newccc->pPerScrnInfo = pNewScrnInfo; + } + + /* + * Set visual component + */ + newccc->visual = visual; + + return(newccc); +} + + +/* + * NAME + * XcmsDefaultCCC + * + * SYNOPSIS + */ +XcmsCCC +XcmsDefaultCCC( + Display *dpy, + int screenNumber) +/* + * DESCRIPTION + * Given a Display and Screen, this routine creates + * returns the Screen's default Color Conversion Context. + * Note that a Screen's default CCC is built with the + * screen default visual. + * + * RETURNS + * Returns NULL if failed; otherwise address of the + * XcmsCCC for the Screen's default CCC. + * + */ +{ + XcmsCCC ccc; + + + if ((screenNumber < 0) || (screenNumber >= ScreenCount(dpy))) { + return((XcmsCCC)NULL); + } + + /* + * Check if the XcmsCCC's for each screen has been created + */ + if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) { + if (!_XcmsInitDefaultCCCs(dpy)) { + return((XcmsCCC)NULL); + } + } + + ccc = (XcmsCCC)dpy->cms.defaultCCCs + screenNumber; + + if (!ccc->pPerScrnInfo) { + /* + * Need to create the XcmsPerScrnInfo structure. The + * _XcmsInitScrnInfo routine will create the XcmsPerScrnInfo + * structure as well as initialize its functionSet and pScreenData + * components. + */ + if (!_XcmsInitScrnInfo(dpy, screenNumber)) { + return((XcmsCCC)NULL); + } + return(ccc); + } else { + /* + * If ccc->pPerScrnInfo->state == XcmsInitSuccess, + * then the pPerScrnInfo component has already been initialized + * therefore, just return ccc. + * If ccc->pPerScrnInfo->state == XcmsInitFailure, + * then this means that we already attempted to initialize + * the pPerScrnInfo component but failed therefore stuffing + * the pPerScrnInfo component with defaults. Just return ccc. + * If ccc->pPerScrnInfo->state == XcmsInitNone, + * then attempt to initialize the pPerScrnInfo component. + */ + switch (ccc->pPerScrnInfo->state) { + case XcmsInitFailure : + /* fall through */ + case XcmsInitSuccess : + return(ccc); + case XcmsInitNone : + /* XcmsPerScreenInfo has not been initialized */ + if (!_XcmsInitScrnInfo(dpy, screenNumber)) { + return((XcmsCCC)NULL); + } + return(ccc); + default : + return((XcmsCCC)NULL); + } + } +} + + +/* + * NAME + * XcmsFreeCCC + * + * SYNOPSIS + */ +void +XcmsFreeCCC(XcmsCCC ccc) +/* + * DESCRIPTION + * Frees memory associated with a Color Conversion Context + * that was created with XcmsCreateCCC(). + * + * RETURNS + * void + * + */ +{ + if (ccc->dpy->cms.defaultCCCs && + ccc == ((XcmsCCC)ccc->dpy->cms.defaultCCCs) + ccc->screenNumber) { + /* do not allow clients to free DefaultCCC's */ + return; + } + + /* + * Note that XcmsPerScrnInfo sub-structures are freed here only if + * they are for visuals that have per-Visual intensity tables. + * Otherwise the XcmsPerScrnInfo structure is being shared! + * For the latter, there is only one allocated per Screen and it just + * so happens * that we place its initial reference is placed in the + * default CCC. The routine _XcmsFreeDefaultCCCs frees them. + */ + if (_XcmsGetIntensityMap(ccc->dpy, ccc->visual) != NULL) { + Xfree(ccc->pPerScrnInfo); + } + + Xfree(ccc); +} diff --git a/nx-X11/lib/src/xcms/Cv.h b/nx-X11/lib/src/xcms/Cv.h new file mode 100644 index 000000000..0b662811f --- /dev/null +++ b/nx-X11/lib/src/xcms/Cv.h @@ -0,0 +1,189 @@ + +#ifndef _CV_H_ +#define _CV_H_ + +/* variables */ +extern const char _XcmsCIEXYZ_prefix[]; +extern const char _XcmsCIEuvY_prefix[]; +extern const char _XcmsCIExyY_prefix[]; +extern const char _XcmsCIELab_prefix[]; +extern const char _XcmsCIELuv_prefix[]; +extern const char _XcmsTekHVC_prefix[]; +extern const char _XcmsRGBi_prefix[]; +extern const char _XcmsRGB_prefix[]; + +extern XcmsColorSpace XcmsUNDEFINEDColorSpace; +extern XcmsColorSpace XcmsTekHVCColorSpace; +extern XcmsColorSpace XcmsCIEXYZColorSpace; +extern XcmsColorSpace XcmsCIEuvYColorSpace; +extern XcmsColorSpace XcmsCIExyYColorSpace; +extern XcmsColorSpace XcmsCIELabColorSpace; +extern XcmsColorSpace XcmsCIELuvColorSpace; +extern XcmsColorSpace XcmsRGBColorSpace; +extern XcmsColorSpace XcmsRGBiColorSpace; + +extern XcmsColorSpace *_XcmsDIColorSpacesInit[]; +extern XcmsColorSpace **_XcmsDIColorSpaces; + +extern XcmsColorSpace *_XcmsDDColorSpacesInit[]; +extern XcmsColorSpace **_XcmsDDColorSpaces; + +extern XcmsFunctionSet XcmsLinearRGBFunctionSet; + +extern XcmsFunctionSet *_XcmsSCCFuncSetsInit[]; +extern XcmsFunctionSet **_XcmsSCCFuncSets; + +extern XcmsRegColorSpaceEntry _XcmsRegColorSpaces[]; + +/* functions */ +extern XPointer * +_XcmsCopyPointerArray( + XPointer *pap); +extern void +_XcmsFreePointerArray( + XPointer *pap); +extern XPointer * +_XcmsPushPointerArray( + XPointer *pap, + XPointer p, + XPointer *papNoFree); +extern Status +_XcmsCIEXYZ_ValidSpec( + XcmsColor *pColor); +extern Status +_XcmsCIEuvY_ValidSpec( + XcmsColor *pColor); +extern int +_XcmsTekHVC_CheckModify( + XcmsColor *pColor); + +extern Status +_XcmsTekHVCQueryMaxVCRGB( + XcmsCCC ccc, + XcmsFloat hue, + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return); +extern Status +_XcmsCIELabQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return); +extern Status +_XcmsConvertColorsWithWhitePt( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed); + +extern Status +_XcmsDIConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat); +extern Status +_XcmsDDConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed); +extern XcmsColorFormat +_XcmsRegFormatOfPrefix( + _Xconst char *prefix); +extern void +_XColor_to_XcmsRGB( + XcmsCCC ccc, + XColor *pXColors, + XcmsColor *pColors, + unsigned int nColors); +extern Status +_XcmsSetGetColor( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + XcmsColorFormat result_format, + Bool *pCompressed); +extern Status +_XcmsSetGetColors( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */, + int /* nColors */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + int nColors, + XcmsColorFormat result_format, + Bool *pCompressed); +extern Status +_XcmsCIELuvQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return); + +extern XcmsIntensityMap * +_XcmsGetIntensityMap( + Display *dpy, + Visual *visual); +extern int +_XcmsInitDefaultCCCs( + Display *dpy); +extern int +_XcmsInitScrnInfo( + register Display *dpy, + int screenNumber); +extern XcmsCmapRec * +_XcmsCopyCmapRecAndFree( + Display *dpy, + Colormap src_cmap, + Colormap copy_cmap); +extern void +_XcmsCopyISOLatin1Lowered( + char *dst, + const char *src); +extern int +_XcmsEqualWhitePts( + XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2); +extern int +_XcmsLRGB_InitScrnDefault( + Display *dpy, + int screenNumber, + XcmsPerScrnInfo *pPerScrnInfo); +extern void +_XcmsFreeIntensityMaps( + Display *dpy); +extern int +_XcmsGetProperty( + Display *pDpy, + Window w, + Atom property, + int *pFormat, + unsigned long *pNItems, + unsigned long *pNBytes, + char **pValue); +extern unsigned long +_XcmsGetElement( + int format, + char **pValue, + unsigned long *pCount); +extern void +_XcmsUnresolveColor( + XcmsCCC ccc, + XcmsColor *pColor); +extern void +_XcmsResolveColor( + XcmsCCC ccc, + XcmsColor *pXcmsColor); + +#endif /* _CV_H_ */ diff --git a/nx-X11/lib/src/xcms/CvColW.c b/nx-X11/lib/src/xcms/CvColW.c new file mode 100644 index 000000000..4aabded0d --- /dev/null +++ b/nx-X11/lib/src/xcms/CvColW.c @@ -0,0 +1,141 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * XcmsCvColW.c + * + * DESCRIPTION + * + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + + +/* + * NAME + * _XcmsConvertColorsWithWhitePt - Convert XcmsColor structures + * + * SYNOPSIS + */ +Status +_XcmsConvertColorsWithWhitePt( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed) +/* + * DESCRIPTION + * Convert XcmsColor structures between device-independent + * and/or device-dependent formats but allowing the calling + * routine to specify the white point to be associated + * with the color specifications (overriding + * ccc->clientWhitePt). + * + * This routine has been provided for use in white point + * adjustment routines. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression, + * XcmsSuccessWithCompression if succeeded with gamut + * compression. + * + */ +{ + if (ccc == NULL || pColors_in_out == NULL || + pColors_in_out->format == XcmsUndefinedFormat) { + return(XcmsFailure); + } + + if (nColors == 0 || pColors_in_out->format == newFormat) { + /* do nothing */ + return(XcmsSuccess); + } + + if (XCMS_DI_ID(pColors_in_out->format) && XCMS_DI_ID(newFormat)) { + /* + * Device-Independent to Device-Independent Conversion + */ + return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, + newFormat)); + } + if (XCMS_DD_ID(pColors_in_out->format) && XCMS_DD_ID(newFormat)) { + /* + * Device-Dependent to Device-Dependent Conversion + */ + return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, + pCompressed)); + } + + /* + * Otherwise we have: + * 1. Device-Independent to Device-Dependent Conversion + * OR + * 2. Device-Dependent to Device-Independent Conversion + */ + + if (XCMS_DI_ID(pColors_in_out->format)) { + /* + * 1. Device-Independent to Device-Dependent Conversion + */ + /* First convert to CIEXYZ */ + if (_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, + XcmsCIEXYZFormat) == XcmsFailure) { + return(XcmsFailure); + } + /* Then convert to DD Format */ + return(_XcmsDDConvertColors(ccc, pColors_in_out, nColors, newFormat, + pCompressed)); + } else { + /* + * 2. Device-Dependent to Device-Independent Conversion + */ + /* First convert to CIEXYZ */ + if (_XcmsDDConvertColors(ccc, pColors_in_out, nColors, + XcmsCIEXYZFormat, pCompressed) == XcmsFailure) { + return(XcmsFailure); + } + /* Then convert to DI Format */ + return(_XcmsDIConvertColors(ccc, pColors_in_out, pWhitePt, nColors, + newFormat)); + } +} diff --git a/nx-X11/lib/src/xcms/CvCols.c b/nx-X11/lib/src/xcms/CvCols.c new file mode 100644 index 000000000..87d49311c --- /dev/null +++ b/nx-X11/lib/src/xcms/CvCols.c @@ -0,0 +1,1030 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsCvCols.c + * + * DESCRIPTION + * Xcms API routine that converts between the + * device-independent color spaces. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * LOCAL DEFINES + */ +#define DD_FORMAT 0x01 +#define DI_FORMAT 0x02 +#define MIX_FORMAT 0x04 +#ifndef MAX +# define MAX(x,y) ((x) > (y) ? (x) : (y)) +#endif + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * EqualCIEXYZ + * + * SYNOPSIS + */ +static int +EqualCIEXYZ( + XcmsColor *p1, XcmsColor *p2) +/* + * DESCRIPTION + * Compares two XcmsColor structures that are in XcmsCIEXYZFormat + * + * RETURNS + * Returns 1 if equal; 0 otherwise. + * + */ +{ + if (p1->format != XcmsCIEXYZFormat || p2->format != XcmsCIEXYZFormat) { + return(0); + } + if ((p1->spec.CIEXYZ.X != p2->spec.CIEXYZ.X) + || (p1->spec.CIEXYZ.Y != p2->spec.CIEXYZ.Y) + || (p1->spec.CIEXYZ.Z != p2->spec.CIEXYZ.Z)) { + return(0); + } + return(1); +} + + +/* + * NAME + * XcmsColorSpace + * + * SYNOPSIS + */ +static XcmsColorSpace * +ColorSpaceOfID( + XcmsCCC ccc, + XcmsColorFormat id) +/* + * DESCRIPTION + * Returns a pointer to the color space structure + * (XcmsColorSpace) associated with the specified color space + * ID. + * + * RETURNS + * Pointer to matching XcmsColorSpace structure if found; + * otherwise NULL. + */ +{ + XcmsColorSpace **papColorSpaces; + + if (ccc == NULL) { + return(NULL); + } + + /* + * First try Device-Independent color spaces + */ + papColorSpaces = _XcmsDIColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if ((*papColorSpaces)->id == id) { + return(*papColorSpaces); + } + papColorSpaces++; + } + } + + /* + * Next try Device-Dependent color spaces + */ + papColorSpaces = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if ((*papColorSpaces)->id == id) { + return(*papColorSpaces); + } + papColorSpaces++; + } + } + + return(NULL); +} + + +/* + * NAME + * ValidDIColorSpaceID + * + * SYNOPSIS + */ +static int +ValidDIColorSpaceID( + XcmsColorFormat id) +/* + * DESCRIPTION + * Determines if the specified color space ID is a valid + * Device-Independent color space in the specified Color + * Conversion Context. + * + * RETURNS + * Returns zero if not valid; otherwise non-zero. + */ +{ + XcmsColorSpace **papRec; + papRec = _XcmsDIColorSpaces; + if (papRec != NULL) { + while (*papRec != NULL) { + if ((*papRec)->id == id) { + return(1); + } + papRec++; + } + } + return(0); +} + + +/* + * NAME + * ValidDDColorSpaceID + * + * SYNOPSIS + */ +static int +ValidDDColorSpaceID( + XcmsCCC ccc, + XcmsColorFormat id) +/* + * DESCRIPTION + * Determines if the specified color space ID is a valid + * Device-Dependent color space in the specified Color + * Conversion Context. + * + * RETURNS + * Returns zero if not valid; otherwise non-zero. + */ +{ + XcmsColorSpace **papRec; + + if (ccc->pPerScrnInfo->state != XcmsInitNone) { + papRec = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; + while (*papRec != NULL) { + if ((*papRec)->id == id) { + return(1); + } + papRec++; + } + } + return(0); +} + + +/* + * NAME + * ConvertMixedColors - Convert XcmsColor structures + * + * SYNOPSIS + */ +static Status +ConvertMixedColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat targetFormat, + unsigned char format_flag) +/* + * DESCRIPTION + * This routine will only convert the following types of + * batches: + * DI to DI + * DD to DD + * DD to CIEXYZ + * In other words, it will not convert the following types of + * batches: + * DI to DD + * DD to DI(not CIEXYZ) + * + * format_flag: + * 0x01 : convert Device-Dependent only specifications to the + * target format. + * 0x02 : convert Device-Independent only specifications to the + * target format. + * 0x03 : convert all specifications to the target format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if none of the color specifications were + * compressed in the conversion process + * XcmsSuccessWithCompression if at least one of the + * color specifications were compressed in the + * conversion process. + * + */ +{ + XcmsColor *pColor, *pColors_start; + XcmsColorFormat format; + Status retval_tmp; + Status retval = XcmsSuccess; + unsigned int iColors; + unsigned int nBatch; + + /* + * Convert array of mixed color specifications in batches of + * contiguous formats to the target format + */ + iColors = 0; + while (iColors < nColors) { + /* + * Find contiguous array of color specifications with the + * same format + */ + pColor = pColors_start = pColors_in_out + iColors; + format = pColors_start->format; + nBatch = 0; + while (iColors < nColors && pColor->format == format) { + pColor++; + nBatch++; + iColors++; + } + if (format != targetFormat) { + /* + * Need to convert this batch from current format to target format. + */ + if (XCMS_DI_ID(format) && (format_flag & DI_FORMAT) && + XCMS_DI_ID(targetFormat)) { + /* + * DI->DI + * + * Format of interest is Device-Independent, + * This batch contains Device-Independent specifications, and + * the Target format is Device-Independent. + */ + retval_tmp = _XcmsDIConvertColors(ccc, pColors_start, pWhitePt, + nBatch, targetFormat); + } else if (XCMS_DD_ID(format) && (format_flag & DD_FORMAT) && + (targetFormat == XcmsCIEXYZFormat)) { + /* + * DD->CIEXYZ + * + * Format of interest is Device-Dependent, + * This batch contains Device-Dependent specifications, and + * the Target format is CIEXYZ. + * + * Since DD->CIEXYZ we can use NULL instead of pCompressed. + */ + if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, + pWhitePt, ScreenWhitePointOfCCC(ccc))) { + /* + * Need to call WhiteAdjustProc (Screen White Point to + * White Point). + */ + retval_tmp = (*ccc->whitePtAdjProc)(ccc, + ScreenWhitePointOfCCC(ccc), pWhitePt, + XcmsCIEXYZFormat, pColors_start, nBatch, + (Bool *)NULL); + } else { + retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, + nBatch, XcmsCIEXYZFormat, (Bool *)NULL); + } + } else if (XCMS_DD_ID(format) && (format_flag & DD_FORMAT) && + XCMS_DD_ID(targetFormat)) { + /* + * DD->DD(not CIEXYZ) + * + * Format of interest is Device-Dependent, + * This batch contains Device-Dependent specifications, and + * the Target format is Device-Dependent and not CIEXYZ. + */ + retval_tmp = _XcmsDDConvertColors(ccc, pColors_start, nBatch, + targetFormat, (Bool *)NULL); + } else { + /* + * This routine is called for the wrong reason. + */ + return(XcmsFailure); + } + if (retval_tmp == XcmsFailure) { + return(XcmsFailure); + } + retval = MAX(retval, retval_tmp); + } + } + return(retval); +} + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsEqualWhitePts + * + * SYNOPSIS + */ +int +_XcmsEqualWhitePts(XcmsCCC ccc, XcmsColor *pWhitePt1, XcmsColor *pWhitePt2) +/* + * DESCRIPTION + * + * RETURNS + * Returns 0 if not equal; otherwise 1. + * + */ +{ + XcmsColor tmp1, tmp2; + + memcpy((char *)&tmp1, (char *)pWhitePt1, sizeof(XcmsColor)); + memcpy((char *)&tmp2, (char *)pWhitePt2, sizeof(XcmsColor)); + + if (tmp1.format != XcmsCIEXYZFormat) { + if (_XcmsDIConvertColors(ccc, &tmp1, (XcmsColor *) NULL, 1, + XcmsCIEXYZFormat)==0) { + return(0); + } + } + + if (tmp2.format != XcmsCIEXYZFormat) { + if (_XcmsDIConvertColors(ccc, &tmp2, (XcmsColor *) NULL, 1, + XcmsCIEXYZFormat)==0) { + return(0); + } + } + + return (EqualCIEXYZ(&tmp1, &tmp2)); +} + + +/* + * NAME + * _XcmsDIConvertColors - Convert XcmsColor structures + * + * SYNOPSIS + */ +Status +_XcmsDIConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + XcmsColor *pWhitePt, + unsigned int nColors, + XcmsColorFormat newFormat) +/* + * DESCRIPTION + * Convert XcmsColor structures to another Device-Independent + * form. + * + * Here are some assumptions that this routine makes: + * 1. The calling routine has already checked if + * pColors_in_out->format == newFormat, therefore + * there is no need to check again here. + * 2. The calling routine has already checked nColors, + * therefore this routine assumes nColors > 0. + * 3. The calling routine may want to convert only between + * CIExyY <-> CIEXYZ <-> CIEuvY + * therefore, this routine allows pWhitePt to equal NULL. + * + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsColorSpace *pFrom, *pTo; + XcmsDIConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; + XcmsDIConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; + XcmsDIConversionProc *to_CIEXYZ_stop, *from_CIEXYZ_start; + XcmsDIConversionProc *tmp; + + /* + * Allow pWhitePt to equal NULL. This appropriate when converting + * anywhere between: + * CIExyY <-> CIEXYZ <-> CIEuvY + */ + + if (pColors_in_out == NULL || + !ValidDIColorSpaceID(pColors_in_out->format) || + !ValidDIColorSpaceID(newFormat)) { + return(XcmsFailure); + } + + /* + * Get a handle on the function list for the current specification format + */ + if ((pFrom = ColorSpaceOfID(ccc, pColors_in_out->format)) + == NULL) { + return(XcmsFailure); + } + + /* + * Get a handle on the function list for the new specification format + */ + if ((pTo = ColorSpaceOfID(ccc, newFormat)) == NULL) { + return(XcmsFailure); + } + + src_to_CIEXYZ = pFrom->to_CIEXYZ; + src_from_CIEXYZ = pFrom->from_CIEXYZ; + dest_to_CIEXYZ = pTo->to_CIEXYZ; + dest_from_CIEXYZ = pTo->from_CIEXYZ; + + if (pTo->inverse_flag && pFrom->inverse_flag) { + /* + * Find common function pointers + */ + for (to_CIEXYZ_stop = src_to_CIEXYZ; *to_CIEXYZ_stop; to_CIEXYZ_stop++){ + for (tmp = dest_to_CIEXYZ; *tmp; tmp++) { + if (*to_CIEXYZ_stop == *tmp) { + goto Continue; + } + } + } + +Continue: + + /* + * Execute the functions to CIEXYZ, stopping short as necessary + */ + while (src_to_CIEXYZ != to_CIEXYZ_stop) { + if ((*src_to_CIEXYZ++)(ccc, pWhitePt, pColors_in_out, + nColors) == XcmsFailure) { + return(XcmsFailure); + } + } + + /* + * Determine where to start on the from_CIEXYZ path. + */ + from_CIEXYZ_start = dest_from_CIEXYZ; + tmp = src_from_CIEXYZ; + while ((*from_CIEXYZ_start == *tmp) && (*from_CIEXYZ_start != NULL)) { + from_CIEXYZ_start++; + tmp++; + } + + } else { + /* + * The function in at least one of the Color Spaces are not + * complementary, i.e., + * for an i, 0 <= i < n elements + * from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i] + * + * Execute the functions all the way to CIEXYZ + */ + while (*src_to_CIEXYZ) { + if ((*src_to_CIEXYZ++)(ccc, pWhitePt, pColors_in_out, + nColors) == XcmsFailure) { + return(XcmsFailure); + } + } + + /* + * Determine where to start on the from_CIEXYZ path. + */ + from_CIEXYZ_start = dest_from_CIEXYZ; + } + + + /* + * Execute the functions from CIEXYZ. + */ + while (*from_CIEXYZ_start) { + if ((*from_CIEXYZ_start++)(ccc, pWhitePt, pColors_in_out, + nColors) == XcmsFailure) { + return(XcmsFailure); + } + } + + return(XcmsSuccess); +} + + +/* + * NAME + * _XcmsDDConvertColors - Convert XcmsColor structures + * + * SYNOPSIS + */ +Status +_XcmsDDConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + XcmsColorFormat newFormat, + Bool *pCompressed) +/* + * DESCRIPTION + * Convert XcmsColor structures: + * + * 1. From CIEXYZ to Device-Dependent formats (typically RGB and + * RGBi), + * or + * 2. Between Device-Dependent formats (typically RGB and RGBi). + * + * Assumes that these specifications have already been white point + * adjusted if necessary from Client White Point to Screen + * White Point. Therefore, the white point now associated + * with the specifications is the Screen White Point. + * + * pCompressed may be NULL. If so this indicates that the + * calling routine is not interested in knowing exactly which + * color was compressed, if any. + * + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if none of the color specifications were + * compressed in the conversion process + * XcmsSuccessWithCompression if at least one of the + * color specifications were compressed in the + * conversion process. + * + */ +{ + XcmsColorSpace *pFrom, *pTo; + XcmsDDConversionProc *src_to_CIEXYZ, *src_from_CIEXYZ; + XcmsDDConversionProc *dest_to_CIEXYZ, *dest_from_CIEXYZ; + XcmsDDConversionProc *from_CIEXYZ_start, *to_CIEXYZ_stop; + XcmsDDConversionProc *tmp; + int retval; + int hasCompressed = 0; + + if (ccc == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + if (nColors == 0 || pColors_in_out->format == newFormat) { + /* do nothing */ + return(XcmsSuccess); + } + + if (((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet) == NULL) { + return(XcmsFailure); /* hmm, an internal error? */ + } + + /* + * Its ok if pColors_in_out->format == XcmsCIEXYZFormat + * or + * if newFormat == XcmsCIEXYZFormat + */ + if ( !( ValidDDColorSpaceID(ccc, pColors_in_out->format) + || + (pColors_in_out->format == XcmsCIEXYZFormat)) + || + !(ValidDDColorSpaceID(ccc, newFormat) + || + newFormat == XcmsCIEXYZFormat)) { + return(XcmsFailure); + } + + if ((pFrom = ColorSpaceOfID(ccc, pColors_in_out->format)) == NULL){ + return(XcmsFailure); + } + + if ((pTo = ColorSpaceOfID(ccc, newFormat)) == NULL) { + return(XcmsFailure); + } + + src_to_CIEXYZ = (XcmsDDConversionProc *)pFrom->to_CIEXYZ; + src_from_CIEXYZ = (XcmsDDConversionProc *)pFrom->from_CIEXYZ; + dest_to_CIEXYZ = (XcmsDDConversionProc *)pTo->to_CIEXYZ; + dest_from_CIEXYZ = (XcmsDDConversionProc *)pTo->from_CIEXYZ; + + if (pTo->inverse_flag && pFrom->inverse_flag) { + /* + * Find common function pointers + */ + for (to_CIEXYZ_stop = src_to_CIEXYZ; *to_CIEXYZ_stop; to_CIEXYZ_stop++){ + for (tmp = dest_to_CIEXYZ; *tmp; tmp++) { + if (*to_CIEXYZ_stop == *tmp) { + goto Continue; + } + } + } +Continue: + + /* + * Execute the functions + */ + while (src_to_CIEXYZ != to_CIEXYZ_stop) { + retval = (*src_to_CIEXYZ++)(ccc, pColors_in_out, nColors, + pCompressed); + if (retval == XcmsFailure) { + return(XcmsFailure); + } + hasCompressed |= (retval == XcmsSuccessWithCompression); + } + + /* + * Determine where to start on the from_CIEXYZ path. + */ + from_CIEXYZ_start = dest_from_CIEXYZ; + tmp = src_from_CIEXYZ; + while ((*from_CIEXYZ_start == *tmp) && (*from_CIEXYZ_start != NULL)) { + from_CIEXYZ_start++; + tmp++; + } + + } else { + /* + * The function in at least one of the Color Spaces are not + * complementary, i.e., + * for an i, 0 <= i < n elements + * from_CIEXYZ[i] is not the inverse of to_CIEXYZ[i] + * + * Execute the functions all the way to CIEXYZ + */ + while (*src_to_CIEXYZ) { + retval = (*src_to_CIEXYZ++)(ccc, pColors_in_out, nColors, + pCompressed); + if (retval == XcmsFailure) { + return(XcmsFailure); + } + hasCompressed |= (retval == XcmsSuccessWithCompression); + } + + /* + * Determine where to start on the from_CIEXYZ path. + */ + from_CIEXYZ_start = dest_from_CIEXYZ; + } + + while (*from_CIEXYZ_start) { + retval = (*from_CIEXYZ_start++)(ccc, pColors_in_out, nColors, + pCompressed); + if (retval == XcmsFailure) { + return(XcmsFailure); + } + hasCompressed |= (retval == XcmsSuccessWithCompression); + } + + return(hasCompressed ? XcmsSuccessWithCompression : XcmsSuccess); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsConvertColors - Convert XcmsColor structures + * + * SYNOPSIS + */ +Status +XcmsConvertColors( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + XcmsColorFormat targetFormat, + Bool *pCompressed) +/* + * DESCRIPTION + * Convert XcmsColor structures to another format + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression, + * XcmsSuccessWithCompression if succeeded with gamut + * compression. + * + */ +{ + XcmsColor clientWhitePt; + XcmsColor Color1; + XcmsColor *pColors_tmp; + int callWhiteAdjustProc = 0; + XcmsColorFormat format; + Status retval; + unsigned char contents_flag = 0x00; + unsigned int iColors; + + if (ccc == NULL || pColors_in_out == NULL || + !(ValidDIColorSpaceID(targetFormat) || + ValidDDColorSpaceID(ccc, targetFormat))) { + return(XcmsFailure); + } + + /* + * Check formats in color specification array + */ + format = pColors_in_out->format; + for (pColors_tmp = pColors_in_out, iColors = nColors; iColors; pColors_tmp++, iColors--) { + if (!(ValidDIColorSpaceID(pColors_tmp->format) || + ValidDDColorSpaceID(ccc, pColors_tmp->format))) { + return(XcmsFailure); + } + if (XCMS_DI_ID(pColors_tmp->format)) { + contents_flag |= DI_FORMAT; + } else { + contents_flag |= DD_FORMAT; + } + if (pColors_tmp->format != format) { + contents_flag |= MIX_FORMAT; + } + } + + /* + * Check if we need the Client White Point. + */ + if ((contents_flag & DI_FORMAT) || XCMS_DI_ID(targetFormat)) { + /* To proceed, we need to get the Client White Point */ + memcpy((char *)&clientWhitePt, (char *)&ccc->clientWhitePt, + sizeof(XcmsColor)); + if (clientWhitePt.format == XcmsUndefinedFormat) { + /* + * Client White Point is undefined, therefore set to the Screen + * White Point. + * Since Client White Point == Screen White Point, WhiteAdjustProc + * is not called. + */ + memcpy((char *)&clientWhitePt, + (char *)&ccc->pPerScrnInfo->screenWhitePt, + sizeof(XcmsColor)); + } else if ((ccc->whitePtAdjProc != NULL) && !_XcmsEqualWhitePts(ccc, + &clientWhitePt, ScreenWhitePointOfCCC(ccc))) { + /* + * Client White Point != Screen White Point, and WhiteAdjustProc + * is not NULL, therefore, will need to call it when + * converting between DI and DD specifications. + */ + callWhiteAdjustProc = 1; + } + } + + /* + * Make copy of array of color specifications + */ + if (nColors > 1) { + pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); + } else { + pColors_tmp = &Color1; + } + memcpy((char *)pColors_tmp, (char *)pColors_in_out, + nColors * sizeof(XcmsColor)); + + /* + * zero out pCompressed + */ + if (pCompressed) { + bzero((char *)pCompressed, nColors * sizeof(Bool)); + } + + if (contents_flag == DD_FORMAT || contents_flag == DI_FORMAT) { + /* + * ENTIRE ARRAY IS IN ONE FORMAT. + */ + if (XCMS_DI_ID(format) && XCMS_DI_ID(targetFormat)) { + /* + * DI-to-DI only conversion + */ + retval = _XcmsDIConvertColors(ccc, pColors_tmp, + &clientWhitePt, nColors, targetFormat); + } else if (XCMS_DD_ID(format) && XCMS_DD_ID(targetFormat)) { + /* + * DD-to-DD only conversion + * Since DD->DD there will be no compressed thus we can + * pass NULL instead of pCompressed. + */ + retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, + targetFormat, (Bool *)NULL); + } else { + /* + * Otherwise we have: + * 1. Device-Independent to Device-Dependent Conversion + * OR + * 2. Device-Dependent to Device-Independent Conversion + * + * We need to go from oldFormat -> CIEXYZ -> targetFormat + * adjusting for white points as necessary. + */ + + if (XCMS_DI_ID(format)) { + /* + * 1. Device-Independent to Device-Dependent Conversion + */ + if (callWhiteAdjustProc) { + /* + * White Point Adjustment + * Client White Point to Screen White Point + */ + retval = (*ccc->whitePtAdjProc)(ccc, &clientWhitePt, + ScreenWhitePointOfCCC(ccc), targetFormat, + pColors_tmp, nColors, pCompressed); + } else { + if (_XcmsDIConvertColors(ccc, pColors_tmp, + &clientWhitePt, nColors, XcmsCIEXYZFormat) + == XcmsFailure) { + goto Failure; + } + retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, + targetFormat, pCompressed); + } + } else { + /* + * 2. Device-Dependent to Device-Independent Conversion + */ + if (callWhiteAdjustProc) { + /* + * White Point Adjustment + * Screen White Point to Client White Point + */ + retval = (*ccc->whitePtAdjProc)(ccc, + ScreenWhitePointOfCCC(ccc), &clientWhitePt, + targetFormat, pColors_tmp, nColors, pCompressed); + } else { + /* + * Since DD->CIEXYZ, no compression takes place therefore + * we can pass NULL instead of pCompressed. + */ + if (_XcmsDDConvertColors(ccc, pColors_tmp, nColors, + XcmsCIEXYZFormat, (Bool *)NULL) == XcmsFailure) { + goto Failure; + } + retval = _XcmsDIConvertColors(ccc, pColors_tmp, + &clientWhitePt, nColors, targetFormat); + } + } + } + } else { + /* + * ARRAY HAS MIXED FORMATS. + */ + if ((contents_flag == (DI_FORMAT | MIX_FORMAT)) && + XCMS_DI_ID(targetFormat)) { + /* + * Convert from DI to DI in batches of contiguous formats + * + * Because DI->DI, WhiteAdjustProc not called. + */ + retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, + nColors, targetFormat, (unsigned char)DI_FORMAT); + } else if ((contents_flag == (DD_FORMAT | MIX_FORMAT)) && + XCMS_DD_ID(targetFormat)) { + /* + * Convert from DD to DD in batches of contiguous formats + * + * Because DD->DD, WhiteAdjustProc not called. + */ + retval = ConvertMixedColors(ccc, pColors_tmp, + (XcmsColor *)NULL, nColors, targetFormat, + (unsigned char)DD_FORMAT); + } else if (XCMS_DI_ID(targetFormat)) { + /* + * We need to convert from DI-to-DI and DD-to-DI, therefore + * 1. convert DD specifications to CIEXYZ, then + * 2. convert all in batches to the target DI format. + * + * Note that ConvertMixedColors will call WhiteAdjustProc + * as necessary. + */ + + /* + * Convert only DD specifications in batches of contiguous formats + * to CIEXYZ + * + * Since DD->CIEXYZ, ConvertMixedColors will apply WhiteAdjustProc + * if required. + */ + retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, + nColors, XcmsCIEXYZFormat, (unsigned char)DD_FORMAT); + + /* + * Because at this point we may have a mix of DI formats + * (e.g., CIEXYZ, CIELuv) we must convert the specs to the + * target DI format in batches of contiguous source formats. + */ + retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, + nColors, targetFormat, (unsigned char)DI_FORMAT); + } else { + /* + * We need to convert from DI-to-DD and DD-to-DD, therefore + * 1. convert DI specifications to CIEXYZ, then + * 2. convert all to the DD target format. + * + * This allows white point adjustment and gamut compression + * to be applied to all the color specifications in one + * swoop if those functions do in fact modify the entire + * group of color specifications. + */ + + /* + * Convert in batches to CIEXYZ + * + * If DD->CIEXYZ, ConvertMixedColors will apply WhiteAdjustProc + * if required. + */ + if ((retval = ConvertMixedColors(ccc, pColors_tmp, &clientWhitePt, + nColors, XcmsCIEXYZFormat, + (unsigned char)(DI_FORMAT | DD_FORMAT))) == XcmsFailure) { + goto Failure; + } + + /* + * Convert all specifications (now in CIEXYZ format) to + * the target DD format. + * Since CIEXYZ->DD, compression MAY take place therefore + * we must pass pCompressed. + * Note that WhiteAdjustProc must be used if necessary. + */ + if (callWhiteAdjustProc) { + /* + * White Point Adjustment + * Client White Point to Screen White Point + */ + retval = (*ccc->whitePtAdjProc)(ccc, + &clientWhitePt, ScreenWhitePointOfCCC(ccc), + targetFormat, pColors_tmp, nColors, pCompressed); + } else { + retval = _XcmsDDConvertColors(ccc, pColors_tmp, nColors, + targetFormat, pCompressed); + } + } + } + + if (retval != XcmsFailure) { + memcpy((char *)pColors_in_out, (char *)pColors_tmp, + nColors * sizeof(XcmsColor)); + } + if (nColors > 1) { + Xfree(pColors_tmp); + } + return(retval); + +Failure: + if (nColors > 1) { + Xfree(pColors_tmp); + } + return(XcmsFailure); +} + + +/* + * NAME + * XcmsRegFormatOfPrefix + * + * SYNOPSIS + */ +XcmsColorFormat +_XcmsRegFormatOfPrefix( + _Xconst char *prefix) +/* + * DESCRIPTION + * Returns a color space ID associated with the specified + * X Consortium registered color space prefix. + * + * RETURNS + * The color space ID if found; + * otherwise NULL. + */ +{ + XcmsRegColorSpaceEntry *pEntry = _XcmsRegColorSpaces; + + while (pEntry->prefix != NULL) { + if (strcmp(prefix, pEntry->prefix) == 0) { + return(pEntry->id); + } + pEntry++; + } + return(XcmsUndefinedFormat); +} diff --git a/nx-X11/lib/src/xcms/HVC.c b/nx-X11/lib/src/xcms/HVC.c new file mode 100644 index 000000000..98d7142c3 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVC.c @@ -0,0 +1,625 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVC.c + * + * DESCRIPTION + * This file contains routines that support the TekHVC + * color space to include conversions to and from the CIE + * XYZ space. + * + * DOCUMENTATION + * "TekColor Color Management System, System Implementor's Manual" + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include +#include "Cv.h" + +#include + +/* + * DEFINES + */ +#define u_BR 0.7127 /* u' Best Red */ +#define v_BR 0.4931 /* v' Best Red */ +#define EPS 0.001 +#define CHROMA_SCALE_FACTOR 7.50725 +#ifndef PI +# ifdef M_PI +# define PI M_PI +# else +# define PI 3.14159265358979323846264338327950 +# endif +#endif +#ifndef degrees +# define degrees(r) ((XcmsFloat)(r) * 180.0 / PI) +#endif /* degrees */ +#ifndef radians +# define radians(d) ((XcmsFloat)(d) * PI / 180.0) +#endif /* radians */ + +/************************************************************************* + * Note: The DBL_EPSILON for ANSI is 1e-5 so my checks need to take + * this into account. If your DBL_EPSILON is different then + * adjust this define. + * + * Also note that EPS is the error factor in the calculations + * This may need to be the same as XMY_DBL_EPSILON in + * some implementations. + **************************************************************************/ +#ifdef DBL_EPSILON +# define XMY_DBL_EPSILON DBL_EPSILON +#else +# define XMY_DBL_EPSILON 0.00001 +#endif + +/* + * FORWARD DECLARATIONS + */ +static int TekHVC_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsTekHVC_ValidSpec(XcmsColor *pColor); + +/* + * LOCAL VARIABLES + */ + + /* + * NULL terminated list of functions applied to get from TekHVC to CIEXYZ + */ +static XcmsConversionProc Fl_TekHVC_to_CIEXYZ[] = { + XcmsTekHVCToCIEuvY, + XcmsCIEuvYToCIEXYZ, + NULL +}; + + /* + * NULL terminated list of functions applied to get from CIEXYZ to TekHVC + */ +static XcmsConversionProc Fl_CIEXYZ_to_TekHVC[] = { + XcmsCIEXYZToCIEuvY, + XcmsCIEuvYToTekHVC, + NULL +}; + +/* + * GLOBALS + */ + + /* + * TekHVC Color Space + */ +XcmsColorSpace XcmsTekHVCColorSpace = + { + _XcmsTekHVC_prefix, /* prefix */ + XcmsTekHVCFormat, /* id */ + TekHVC_ParseString, /* parseString */ + Fl_TekHVC_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_TekHVC, /* from_CIEXYZ */ + 1 + }; + + + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * TekHVC_ParseString + * + * SYNOPSIS + */ +static int +TekHVC_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsTekHVCFormat. + * The assumed TekHVC string syntax is: + * TekHVC:// + * Where H, V, and C are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + * XcmsFailure if invalid; + * XcmsSuccess if valid. + */ +{ + size_t n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (size_t)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsTekHVC_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.TekHVC.H, + &pColor->spec.TekHVC.V, + &pColor->spec.TekHVC.C) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.TekHVC.H, + &pColor->spec.TekHVC.V, + &pColor->spec.TekHVC.C) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + pColor->format = XcmsTekHVCFormat; + pColor->pixel = 0; + return(XcmsTekHVC_ValidSpec(pColor)); +} + + +/* + * NAME + * ThetaOffset -- compute thetaOffset + * + * SYNOPSIS + */ +static int +ThetaOffset( + XcmsColor *pWhitePt, + XcmsFloat *pThetaOffset) +/* + * DESCRIPTION + * This routine computes the theta offset of a given + * white point, i.e. XcmsColor. It is used in both this + * conversion and the printer conversions. + * + * RETURNS + * 0 if failed. + * 1 if succeeded with no modifications. + * + * ASSUMPTIONS + * Assumes: + * pWhitePt != NULL + * pWhitePt->format == XcmsCIEuvYFormat + * + */ +{ + double div, slopeuv; + + if (pWhitePt == NULL || pWhitePt->format != XcmsCIEuvYFormat) { + return(0); + } + + if ((div = u_BR - pWhitePt->spec.CIEuvY.u_prime) == 0.0) { + return(0); + } + slopeuv = (v_BR - pWhitePt->spec.CIEuvY.v_prime) / div; + *pThetaOffset = degrees(XCMS_ATAN(slopeuv)); + return(1); +} + + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVC_ValidSpec() + * + * SYNOPSIS + */ +static int +XcmsTekHVC_ValidSpec( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks if values in the color specification are valid. + * Also brings hue into the range 0.0 <= Hue < 360.0 + * + * RETURNS + * 0 if not valid. + * 1 if valid. + * + */ +{ + if (pColor->format != XcmsTekHVCFormat) { + return(XcmsFailure); + } + if (pColor->spec.TekHVC.V < (0.0 - XMY_DBL_EPSILON) + || pColor->spec.TekHVC.V > (100.0 + XMY_DBL_EPSILON) + || (pColor->spec.TekHVC.C < 0.0 - XMY_DBL_EPSILON)) { + return(XcmsFailure); + } + + if (pColor->spec.TekHVC.V < 0.0) { + pColor->spec.TekHVC.V = 0.0 + XMY_DBL_EPSILON; + } else if (pColor->spec.TekHVC.V > 100.0) { + pColor->spec.TekHVC.V = 100.0 - XMY_DBL_EPSILON; + } + + if (pColor->spec.TekHVC.C < 0.0) { + pColor->spec.TekHVC.C = 0.0 - XMY_DBL_EPSILON; + } + + while (pColor->spec.TekHVC.H < 0.0) { + pColor->spec.TekHVC.H += 360.0; + } + while (pColor->spec.TekHVC.H >= 360.0) { + pColor->spec.TekHVC.H -= 360.0; + } + return(XcmsSuccess); +} + +/* + * NAME + * XcmsTekHVCToCIEuvY - convert TekHVC to CIEuvY + * + * SYNOPSIS + */ +Status +XcmsTekHVCToCIEuvY( + XcmsCCC ccc, + XcmsColor *pHVC_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Transforms an array of TekHVC color specifications, given + * their associated white point, to CIECIEuvY.color + * specifications. + * + * RETURNS + * XcmsFailure if failed, XcmsSuccess otherwise. + * + */ +{ + XcmsFloat thetaOffset; + XcmsColor *pColor = pColors_in_out; + XcmsColor whitePt; + XcmsCIEuvY uvY_return; + XcmsFloat tempHue, u, v; + XcmsFloat tmpVal; + unsigned int i; + + /* + * Check arguments + */ + if (pHVC_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Make sure white point is in CIEuvY form + */ + if (pHVC_WhitePt->format != XcmsCIEuvYFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pHVC_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, + XcmsCIEuvYFormat)) { + return(XcmsFailure); + } + pHVC_WhitePt = &whitePt; + } + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (pHVC_WhitePt->spec.CIEuvY.Y != 1.0) { + return(XcmsFailure); + } + + /* Get the thetaOffset */ + if (!ThetaOffset(pHVC_WhitePt, &thetaOffset)) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + /* Make sure original format is TekHVC and is valid */ + if (!XcmsTekHVC_ValidSpec(pColor)) { + return(XcmsFailure); + } + + if (pColor->spec.TekHVC.V == 0.0 || pColor->spec.TekHVC.V == 100.0) { + if (pColor->spec.TekHVC.V == 100.0) { + uvY_return.Y = 1.0; + } else { /* pColor->spec.TekHVC.V == 0.0 */ + uvY_return.Y = 0.0; + } + uvY_return.u_prime = pHVC_WhitePt->spec.CIEuvY.u_prime; + uvY_return.v_prime = pHVC_WhitePt->spec.CIEuvY.v_prime; + } else { + + /* Find the hue based on the white point offset */ + tempHue = pColor->spec.TekHVC.H + thetaOffset; + + while (tempHue < 0.0) { + tempHue += 360.0; + } + while (tempHue >= 360.0) { + tempHue -= 360.0; + } + + tempHue = radians(tempHue); + + /* Calculate u'v' for the obtained hue */ + u = (XcmsFloat) ((XCMS_COS(tempHue) * pColor->spec.TekHVC.C) / + (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR)); + v = (XcmsFloat) ((XCMS_SIN(tempHue) * pColor->spec.TekHVC.C) / + (pColor->spec.TekHVC.V * (double)CHROMA_SCALE_FACTOR)); + + /* Based on the white point get the offset from best red */ + uvY_return.u_prime = u + pHVC_WhitePt->spec.CIEuvY.u_prime; + uvY_return.v_prime = v + pHVC_WhitePt->spec.CIEuvY.v_prime; + + /* Calculate the Y value based on the L* = V. */ + if (pColor->spec.TekHVC.V < 7.99953624) { + uvY_return.Y = pColor->spec.TekHVC.V / 903.29; + } else { + tmpVal = (pColor->spec.TekHVC.V + 16.0) / 116.0; + uvY_return.Y = tmpVal * tmpVal * tmpVal; /* tmpVal ** 3 */ + } + } + + /* Copy result to pColor */ + memcpy((char *)&pColor->spec, (char *)&uvY_return, sizeof(XcmsCIEuvY)); + + /* Identify that the format is now CIEuvY */ + pColor->format = XcmsCIEuvYFormat; + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIEuvYToTekHVC - convert CIEuvY to TekHVC + * + * SYNOPSIS + */ +Status +XcmsCIEuvYToTekHVC( + XcmsCCC ccc, + XcmsColor *pHVC_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Transforms an array of CIECIEuvY.color specifications, given + * their assiciated white point, to TekHVC specifications. + * + * RETURNS + * XcmsFailure if failed, XcmsSuccess otherwise. + * + */ +{ + XcmsFloat theta, L2, u, v, nThetaLow, nThetaHigh; + XcmsFloat thetaOffset; + XcmsColor *pColor = pColors_in_out; + XcmsColor whitePt; + XcmsTekHVC HVC_return; + unsigned int i; + + /* + * Check arguments + */ + if (pHVC_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Make sure white point is in CIEuvY form + */ + if (pHVC_WhitePt->format != XcmsCIEuvYFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pHVC_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, + XcmsCIEuvYFormat)) { + return(XcmsFailure); + } + pHVC_WhitePt = &whitePt; + } + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (pHVC_WhitePt->spec.CIEuvY.Y != 1.0) { + return(XcmsFailure); + } + if (!ThetaOffset(pHVC_WhitePt, &thetaOffset)) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + if (!_XcmsCIEuvY_ValidSpec(pColor)) { + return(XcmsFailure); + } + + /* Use the white point offset to determine HVC */ + u = pColor->spec.CIEuvY.u_prime - pHVC_WhitePt->spec.CIEuvY.u_prime; + v = pColor->spec.CIEuvY.v_prime - pHVC_WhitePt->spec.CIEuvY.v_prime; + + /* Calculate the offset */ + if (u == 0.0) { + theta = 0.0; + } else { + theta = v / u; + theta = (XcmsFloat) XCMS_ATAN((double)theta); + theta = degrees(theta); + } + + nThetaLow = 0.0; + nThetaHigh = 360.0; + if (u > 0.0 && v > 0.0) { + nThetaLow = 0.0; + nThetaHigh = 90.0; + } else if (u < 0.0 && v > 0.0) { + nThetaLow = 90.0; + nThetaHigh = 180.0; + } else if (u < 0.0 && v < 0.0) { + nThetaLow = 180.0; + nThetaHigh = 270.0; + } else if (u > 0.0 && v < 0.0) { + nThetaLow = 270.0; + nThetaHigh = 360.0; + } + while (theta < nThetaLow) { + theta += 90.0; + } + while (theta >= nThetaHigh) { + theta -= 90.0; + } + + /* calculate the L value from the given Y */ + L2 = (pColor->spec.CIEuvY.Y < 0.008856) + ? + (pColor->spec.CIEuvY.Y * 903.29) + : + ((XcmsFloat)(XCMS_CUBEROOT(pColor->spec.CIEuvY.Y) * 116.0) - 16.0); + HVC_return.C = L2 * CHROMA_SCALE_FACTOR * XCMS_SQRT((double) ((u * u) + (v * v))); + if (HVC_return.C < 0.0) { + theta = 0.0; + } + HVC_return.V = L2; + HVC_return.H = theta - thetaOffset; + + /* + * If this is within the error margin let some other routine later + * in the chain worry about the slop in the calculations. + */ + while (HVC_return.H < -EPS) { + HVC_return.H += 360.0; + } + while (HVC_return.H >= 360.0 + EPS) { + HVC_return.H -= 360.0; + } + + /* Copy result to pColor */ + memcpy((char *)&pColor->spec, (char *)&HVC_return, sizeof(XcmsTekHVC)); + + /* Identify that the format is now CIEuvY */ + pColor->format = XcmsTekHVCFormat; + } + return(XcmsSuccess); +} + + +/* + * NAME + * _XcmsTekHVC_CheckModify + * + * SYNOPSIS + */ +int +_XcmsTekHVC_CheckModify( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks if values in the color specification are valid. + * If they are not it modifies the values. + * Also brings hue into the range 0.0 <= Hue < 360.0 + * + * RETURNS + * 0 if not valid. + * 1 if valid. + * + */ +{ + int n; + + /* For now only use the TekHVC numbers as inputs */ + if (pColor->format != XcmsTekHVCFormat) { + return(0); + } + + if (pColor->spec.TekHVC.V < 0.0) { + pColor->spec.TekHVC.V = 0.0 + XMY_DBL_EPSILON; + } else if (pColor->spec.TekHVC.V > 100.0) { + pColor->spec.TekHVC.V = 100.0 - XMY_DBL_EPSILON; + } + + if (pColor->spec.TekHVC.C < 0.0) { + pColor->spec.TekHVC.C = 0.0 - XMY_DBL_EPSILON; + } + + if (pColor->spec.TekHVC.H < 0.0) { + n = -pColor->spec.TekHVC.H / 360.0; + pColor->spec.TekHVC.H += (n + 1) * 360.0; + if (pColor->spec.TekHVC.H >= 360.0) + pColor->spec.TekHVC.H -= 360.0; + } else if (pColor->spec.TekHVC.H >= 360.0) { + n = pColor->spec.TekHVC.H / 360.0; + pColor->spec.TekHVC.H -= n * 360.0; + } + return(1); +} diff --git a/nx-X11/lib/src/xcms/HVCGcC.c b/nx-X11/lib/src/xcms/HVCGcC.c new file mode 100644 index 000000000..6d52eac63 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCGcC.c @@ -0,0 +1,149 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCGcC.c + * + * DESCRIPTION + * Source for XcmsTekHVCClipC() gamut compression routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCClipC - Reduce the chroma for a hue and value + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsTekHVCClipC ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * Reduce the Chroma for a specific hue and value to + * to bring the given color into the gamut of the + * specified device. As required of gamut compression + * functions in Xcms, this routine returns pColor_in_out + * in XcmsCIEXYZFormat on successful completion. + * + * Since this routine works with the value within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + Status retval; + XcmsColor *pColor; + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor && + FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { + /* + * GRAY ! + */ + _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, + 1, XcmsTekHVCFormat); + pColor->spec.TekHVC.H = pColor->spec.TekHVC.C = 0.0; + _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, + 1, XcmsCIEXYZFormat); + if (pCompressed) { + *(pCompressed + i) = True; + } + return(XcmsSuccess); + } else { + if (pColor->format != XcmsTekHVCFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsTekHVCQueryMaxC(ccc, + pColor->spec.TekHVC.H, + pColor->spec.TekHVC.V, + pColor) + == XcmsFailure) { + return(XcmsFailure); + } + retval = _XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/HVCGcV.c b/nx-X11/lib/src/xcms/HVCGcV.c new file mode 100644 index 000000000..0752a0724 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCGcV.c @@ -0,0 +1,201 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCGcV.c + * + * DESCRIPTION + * Source for XcmsTekHVCClipV() gamut compression routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCClipV - Return the closest value + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsTekHVCClipV ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * Return the closest value for a specific hue and chroma. + * This routine takes any color as input and outputs + * a CIE XYZ color. + * + * Since this routine works with the value within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsColor *pColor; + XcmsColor hvc_max; + XcmsCCCRec myCCC; + Status retval; + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor && + FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { + /* + * GRAY ! + */ + return(XcmsFailure); + } else { + /* Convert from CIEXYZ to TekHVC format */ + if (_XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) + == XcmsFailure) { + return(XcmsFailure); + } + + /* check to make sure we have a valid TekHVC number */ + if (!_XcmsTekHVC_CheckModify (pColor)) { + return (XcmsFailure); + } + + /* Step 1: compute the maximum value and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + memcpy((char *)&hvc_max, (char *)pColor, sizeof(XcmsColor)); + if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, + (XcmsRGBi *)NULL) == XcmsFailure) { + return (XcmsFailure); + } + + /* Now check and return the appropriate value */ + if (pColor->spec.TekHVC.C == hvc_max.spec.TekHVC.C) { + /* When the chroma input is equal to the maximum chroma */ + /* merely return the value for that chroma. */ + pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; + if (!_XcmsTekHVC_CheckModify (pColor)) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + } else if (pColor->spec.TekHVC.C > hvc_max.spec.TekHVC.C) { + /* When the chroma input is greater than the maximum chroma */ + /* merely return the value and chroma for the given hue. */ + pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; + pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; + return (XcmsFailure); + } else if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) { + /* When the value input is less than the maximum value point */ + /* compute the intersection of the line from 0,0 to max_V, max_C */ + /* using the chroma input. */ + pColor->spec.TekHVC.V = pColor->spec.TekHVC.C * + hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C; + if (pColor->spec.TekHVC.V >= hvc_max.spec.TekHVC.V) { + pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; + pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; + } + if (!_XcmsTekHVC_CheckModify (pColor)) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + } else { + /* When the value input is greater than the maximum value point */ + /* use HvcMaxValue to find the maximum value for the given chroma. */ + if (pColor->format != XcmsTekHVCFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsTekHVCQueryMaxV(&myCCC, + pColor->spec.TekHVC.H, + pColor->spec.TekHVC.C, + pColor) + == XcmsFailure) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + } + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/HVCGcVC.c b/nx-X11/lib/src/xcms/HVCGcVC.c new file mode 100644 index 000000000..7ace5f13f --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCGcVC.c @@ -0,0 +1,262 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCGcVC.c + * + * DESCRIPTION + * Source for XcmsTekHVCClipVC() gamut + * compression function. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * INTERNALS + * Internal defines that need NOT be exported to any package or + * program using this package. + */ +#define MAXBISECTCOUNT 100 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCClipVC - Return the closest value and chroma + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsTekHVCClipVC ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * This routine will find the closest value and chroma + * for a specific hue. The color input is converted to + * HVC format and returned as CIE XYZ format. + * + * Since this routine works with the value within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + Status retval; + XcmsCCCRec myCCC; + XcmsColor *pColor; + XcmsColor hvc_max; + XcmsRGBi rgb_max; + int nCount, nMaxCount, nI, nILast; + XcmsFloat Chroma, Value, bestChroma, bestValue, nT, saveDist, tmpDist; + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white pt */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor && + FunctionSetOfCCC(ccc) != (XPointer) &XcmsLinearRGBFunctionSet) { + /* + * GRAY ! + */ + _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, + 1, XcmsTekHVCFormat); + pColor->spec.TekHVC.H = pColor->spec.TekHVC.C = 0.0; + _XcmsDIConvertColors(ccc, pColor, &ccc->pPerScrnInfo->screenWhitePt, + 1, XcmsCIEXYZFormat); + if (pCompressed) { + *(pCompressed + i) = True; + } + return(XcmsSuccess); + } else { + /* Convert from CIEXYZ to TekHVC format */ + if (_XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat) + == XcmsFailure) { + return(XcmsFailure); + } + + if (!_XcmsTekHVC_CheckModify(pColor)) { + return (XcmsFailure); + } + + /* Step 1: compute the maximum value and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + memcpy((char *)&hvc_max, (char *)pColor, sizeof(XcmsColor)); + if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, hvc_max.spec.TekHVC.H, &hvc_max, + &rgb_max) == XcmsFailure) { + return (XcmsFailure); + } + + /* Now check and return the appropriate value */ + if (pColor->spec.TekHVC.V == hvc_max.spec.TekHVC.V) { + /* When the value input is equal to the maximum value */ + /* merely return the chroma for that value. */ + pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; + retval = _XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + } + + if (pColor->spec.TekHVC.V < hvc_max.spec.TekHVC.V) { + /* return the intersection of the perpindicular line through */ + /* the value and chroma given and the line from 0,0 and hvc_max. */ + Chroma = pColor->spec.TekHVC.C; + Value = pColor->spec.TekHVC.V; + pColor->spec.TekHVC.C = + (Value + (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V * Chroma)) / + ((hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C) + + (hvc_max.spec.TekHVC.C / hvc_max.spec.TekHVC.V)); + if (pColor->spec.TekHVC.C >= hvc_max.spec.TekHVC.C) { + pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; + pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; + } else { + pColor->spec.TekHVC.V = pColor->spec.TekHVC.C * + hvc_max.spec.TekHVC.V / hvc_max.spec.TekHVC.C; + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return (retval); + } + + /* return the closest point on the upper part of the hue leaf. */ + /* must do a bisection here to compute the delta e. */ + nMaxCount = MAXBISECTCOUNT; + nI = nMaxCount / 2; + bestValue = Value = pColor->spec.TekHVC.V; + bestChroma = Chroma = pColor->spec.TekHVC.C; + saveDist = (XcmsFloat) XCMS_SQRT ((double) (((Chroma - hvc_max.spec.TekHVC.C) * + (Chroma - hvc_max.spec.TekHVC.C)) + + ((Value - hvc_max.spec.TekHVC.V) * + (Value - hvc_max.spec.TekHVC.V)))); + for (nCount = 0; nCount < nMaxCount; nCount++) { + nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; + pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; + pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; + pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; + pColor->format = XcmsRGBiFormat; + + /* Convert from RGBi to HVC */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, + (Bool *) NULL) + == XcmsFailure) { + return (XcmsFailure); + } + if (!_XcmsTekHVC_CheckModify(pColor)) { + return (XcmsFailure); + } + tmpDist = (XcmsFloat) XCMS_SQRT ((double) + (((Chroma - pColor->spec.TekHVC.C) * + (Chroma - pColor->spec.TekHVC.C)) + + ((Value - pColor->spec.TekHVC.V) * + (Value - pColor->spec.TekHVC.V)))); + nILast = nI; + if (tmpDist > saveDist) { + nI /= 2; + } else { + nI = (nMaxCount + nI) / 2; + saveDist = tmpDist; + bestValue = pColor->spec.TekHVC.V; + bestChroma = pColor->spec.TekHVC.C; + } + if (nI == nILast || nI == 0) { + break; + } + + } + + if (bestChroma >= hvc_max.spec.TekHVC.C) { + pColor->spec.TekHVC.C = hvc_max.spec.TekHVC.C; + pColor->spec.TekHVC.V = hvc_max.spec.TekHVC.V; + } else { + pColor->spec.TekHVC.C = bestChroma; + pColor->spec.TekHVC.V = bestValue; + } + if (!_XcmsTekHVC_CheckModify(pColor)) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/HVCMnV.c b/nx-X11/lib/src/xcms/HVCMnV.c new file mode 100644 index 000000000..10a9f857a --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCMnV.c @@ -0,0 +1,163 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCMnV.c + * + * DESCRIPTION + * Source for XcmsTekHVCQueryMinV gamut boundary querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + */ +#define EPS 0.001 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCQueryMinV - Compute minimum value for hue and chroma + * + * SYNOPSIS + */ +Status +XcmsTekHVCQueryMinV ( + XcmsCCC ccc, + XcmsFloat hue, + XcmsFloat chroma, + XcmsColor *pColor_return) + +/* + * DESCRIPTION + * Return the minimum value for a specific hue, and the + * corresponding chroma. The input color specification + * may be in any format, however output is in XcmsTekHVCFormat. + * + * Since this routine works with the value within + * pColor_return intermediate results may be returned + * even though it may be invalid. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded with no modifications + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor tmp; + XcmsColor max_vc; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white pt */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ + + tmp.spec.TekHVC.H = hue; + tmp.spec.TekHVC.V = 100.0; + tmp.spec.TekHVC.C = chroma; + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsTekHVCFormat; + + + /* Check for a valid HVC */ + if (!_XcmsTekHVC_CheckModify (&tmp)) { + return(XcmsFailure); + } + + /* Step 1: compute the maximum value and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); + if (_XcmsTekHVCQueryMaxVCRGB (&myCCC, max_vc.spec.TekHVC.H, &max_vc, + (XcmsRGBi *)NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Step 2: find the intersection with the maximum hvc and chroma line. */ + if (tmp.spec.TekHVC.C > max_vc.spec.TekHVC.C + EPS) { + /* If the chroma is to large then return maximum hvc. */ + tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; + tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; + } else { + tmp.spec.TekHVC.V = tmp.spec.TekHVC.C * + max_vc.spec.TekHVC.V / max_vc.spec.TekHVC.C; + if (tmp.spec.TekHVC.V > max_vc.spec.TekHVC.V) { + tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; + } else if (tmp.spec.TekHVC.V < 0.0) { + tmp.spec.TekHVC.V = tmp.spec.TekHVC.C = 0.0; + } + } + if (_XcmsTekHVC_CheckModify (&tmp)) { + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } else { + return(XcmsFailure); + } +} diff --git a/nx-X11/lib/src/xcms/HVCMxC.c b/nx-X11/lib/src/xcms/HVCMxC.c new file mode 100644 index 000000000..074844ccc --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCMxC.c @@ -0,0 +1,243 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCMxC.c + * + * DESCRIPTION + * Source for the XcmsTekHVCQueryMaxC() gamut boudary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS 0.001 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCQueryMaxC - Compute the maximum chroma for a hue and value + * + * SYNOPSIS + */ +Status +XcmsTekHVCQueryMaxC( + XcmsCCC ccc, + XcmsFloat hue, + XcmsFloat value, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum chroma for a specific hue and value. + * The returned format is in XcmsTekHVCFormat. + * + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor tmp; + XcmsColor max_vc; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + XcmsFloat nValue, savedValue, lastValue, lastChroma, prevValue; + XcmsFloat maxDist, nT, rFactor; + XcmsFloat ftmp1, ftmp2; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; /* inherit screen white Pt */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ + + tmp.spec.TekHVC.H = hue; + tmp.spec.TekHVC.V = value; + tmp.spec.TekHVC.C = 100.0; + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsTekHVCFormat; + + /* check to make sure we have a valid TekHVC number */ + if (!_XcmsTekHVC_CheckModify(&tmp)) { + return(XcmsFailure); + } + + /* Step 1: compute the maximum value and chroma for this hue. */ + memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); + if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, hue, &max_vc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + /* Step 2: If the value is less than the value for the maximum */ + /* value, chroma point then the chroma is on the line */ + /* from max_vc to 0,0. */ + if (value <= max_vc.spec.TekHVC.V) { + tmp.spec.TekHVC.C = value + * max_vc.spec.TekHVC.C / max_vc.spec.TekHVC.V; + if (_XcmsTekHVC_CheckModify (&tmp)) { + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); + } else { + return(XcmsFailure); + } + } else { + /* must do a bisection here to compute the maximum chroma */ + /* save the structure input so that any elements that */ + /* are not touched are recopied later in the routine. */ + nValue = savedValue = value; + lastChroma = -1.0; + lastValue = -1.0; + nMaxCount = MAXBISECTCOUNT; + maxDist = 100.0 - max_vc.spec.TekHVC.V; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prevValue = lastValue; + lastValue = tmp.spec.TekHVC.V; + lastChroma = tmp.spec.TekHVC.C; + nT = (nValue - max_vc.spec.TekHVC.V) / maxDist * rFactor; + tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to HVC */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Now check the return against what is expected */ + if (tmp.spec.TekHVC.V <= savedValue + EPS && + tmp.spec.TekHVC.V >= savedValue - EPS) { + /* make sure to return the input hue */ + tmp.spec.TekHVC.H = hue; + if (_XcmsTekHVC_CheckModify (&tmp)) { + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); + } else { + return(XcmsFailure); + } + } + nValue += savedValue - tmp.spec.TekHVC.V; + if (nValue < max_vc.spec.TekHVC.V) { + nValue = max_vc.spec.TekHVC.V; + rFactor *= 0.5; /* selective relaxation employed */ + } else if (nValue > 100.0) { + /* make sure to return the input hue */ + tmp.spec.TekHVC.H = hue; + /* avoid using fabs */ + ftmp1 = lastValue - savedValue; + if (ftmp1 < 0.0) + ftmp1 = -ftmp1; + ftmp2 = tmp.spec.TekHVC.V - savedValue; + if (ftmp2 < 0.0) + ftmp2 = -ftmp2; + if (ftmp1 < ftmp2) { + tmp.spec.TekHVC.V = lastValue; + tmp.spec.TekHVC.C = lastChroma; + } + if (_XcmsTekHVC_CheckModify (&tmp)) { + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); + } else { + return(XcmsFailure); + } + } else if (tmp.spec.TekHVC.V <= prevValue + EPS && + tmp.spec.TekHVC.V >= prevValue - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + } + } + if (nCount >= nMaxCount) { + /* avoid using fabs */ + ftmp1 = lastValue - savedValue; + if (ftmp1 < 0.0) + ftmp1 = -ftmp1; + ftmp2 = tmp.spec.TekHVC.V - savedValue; + if (ftmp2 < 0.0) + ftmp2 = -ftmp2; + if (ftmp1 < ftmp2) { + tmp.spec.TekHVC.V = lastValue; + tmp.spec.TekHVC.C = lastChroma; + } + } + } + /* make sure to return the input hue */ + tmp.spec.TekHVC.H = hue; + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/HVCMxV.c b/nx-X11/lib/src/xcms/HVCMxV.c new file mode 100644 index 000000000..d5ef94ec5 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCMxV.c @@ -0,0 +1,247 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCMxV.c + * + * DESCRIPTION + * Source for the XcmsTekHVCQueryMaxV() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS 0.001 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCQueryMaxV - Compute maximum value for a hue and chroma + * + * SYNOPSIS + */ +Status +XcmsTekHVCQueryMaxV( + XcmsCCC ccc, + XcmsFloat hue, + XcmsFloat chroma, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum value for a specified hue and chroma. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded with no modifications + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor tmp; + XcmsColor max_vc; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + XcmsFloat nT, nChroma, savedChroma, lastValue, lastChroma, prevChroma; + XcmsFloat rFactor; + XcmsFloat ftmp1, ftmp2; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* setup the CCC to use for the conversions. */ + memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc) NULL; + + tmp.spec.TekHVC.H = hue; + tmp.spec.TekHVC.V = 0.0; + tmp.spec.TekHVC.C = chroma; + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsTekHVCFormat; + + if (!_XcmsTekHVC_CheckModify (&tmp)) { + return(XcmsFailure); + } + + /* Step 1: compute the maximum value and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + memcpy((char *)&max_vc, (char *)&tmp, sizeof(XcmsColor)); + hue = max_vc.spec.TekHVC.H; + if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, max_vc.spec.TekHVC.H, &max_vc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + if (max_vc.spec.TekHVC.C < tmp.spec.TekHVC.C) { + /* + * If the chroma is greater than the chroma for the + * maximum value/chroma point then the value is the + * the value for the maximum value, chroma point. + * This is an error but it I return the best approximation I can. + * Thus the inconsistency. + */ + tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; + tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } else if (max_vc.spec.TekHVC.C == tmp.spec.TekHVC.C) { + /* + * If the chroma is equal to the chroma for the + * maximum value/chroma point then the value is the + * the value for the maximum value, chroma point. + */ + tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } else { + /* must do a bisection here to compute the maximum value */ + /* save the structure input so that any elements that */ + /* are not touched are recopied later in the routine. */ + nChroma = savedChroma = tmp.spec.TekHVC.C; + tmp.spec.TekHVC.C = max_vc.spec.TekHVC.C; + tmp.spec.TekHVC.V = max_vc.spec.TekHVC.V; + lastChroma = -1.0; + lastValue = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prevChroma = lastChroma; + lastValue = tmp.spec.TekHVC.V; + lastChroma = tmp.spec.TekHVC.C; + nT = (1.0 - (nChroma / max_vc.spec.TekHVC.C)) * rFactor; + tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to HVC */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Now check the return against what is expected */ + if (tmp.spec.TekHVC.C <= savedChroma + EPS && + tmp.spec.TekHVC.C >= savedChroma - EPS) { + tmp.spec.TekHVC.H = hue; /* use the saved hue */ + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } + nChroma += savedChroma - tmp.spec.TekHVC.C; + if (nChroma > max_vc.spec.TekHVC.C) { + nChroma = max_vc.spec.TekHVC.C; + rFactor *= 0.5; /* selective relaxation employed */ + } else if (nChroma < 0.0) { + /* avoid using fabs */ + ftmp1 = lastChroma - savedChroma; + if (ftmp1 < 0.0) + ftmp1 = -ftmp1; + ftmp2 = tmp.spec.TekHVC.C - savedChroma; + if (ftmp2 < 0.0) + ftmp2 = -ftmp2; + if (ftmp1 < ftmp2) { + tmp.spec.TekHVC.V = lastValue; + tmp.spec.TekHVC.C = lastChroma; + } + /* make sure to return the input hue */ + tmp.spec.TekHVC.H = hue; + if (!_XcmsTekHVC_CheckModify(&tmp)) { + return(XcmsFailure); + } + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } else if (tmp.spec.TekHVC.C <= prevChroma + EPS && + tmp.spec.TekHVC.C >= prevChroma - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + } + } + if (nCount >= nMaxCount) { + /* avoid using fabs */ + ftmp1 = lastChroma - savedChroma; + if (ftmp1 < 0.0) + ftmp1 = -ftmp1; + ftmp2 = tmp.spec.TekHVC.C - savedChroma; + if (ftmp2 < 0.0) + ftmp2 = -ftmp2; + if (ftmp1 < ftmp2) { + tmp.spec.TekHVC.V = lastValue; + tmp.spec.TekHVC.C = lastChroma; + } + } + } + + /* make sure to return the input hue */ + tmp.spec.TekHVC.H = hue; + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/HVCMxVC.c b/nx-X11/lib/src/xcms/HVCMxVC.c new file mode 100644 index 000000000..c7e087866 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCMxVC.c @@ -0,0 +1,235 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCMxVC.c + * + * DESCRIPTION + * Source for the XcmsTekHVCQueryMaxVC() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + */ +#define MIN(x,y) ((x) > (y) ? (y) : (x)) +#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) +#define START_V 40.0 +#define START_C 120.0 + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsTekHVCQueryMaxVCRGB - Compute maximum value/chroma. + * + * SYNOPSIS + */ +Status +_XcmsTekHVCQueryMaxVCRGB( + XcmsCCC ccc, + XcmsFloat hue, + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return) + +/* + * DESCRIPTION + * Return the maximum chroma for a specified hue, and the + * corresponding value. This is computed by a binary search of + * all possible chromas. An assumption is made that there are + * no local maxima. Use the unrounded Max Chroma because + * the difference check can be small. + * + * NOTE: No local CCC is used because this is a private + * routine and all routines that call it are expected + * to behave properly, i.e. send a local CCC with + * no white adjust function and no gamut compression + * function. + * + * This routine only accepts hue as input and outputs + * HVC's and RGBi's. + * + * RETURNS + * XcmsFailure - Failure + * XCMS_SUCCUSS - Succeeded + * + */ +{ + XcmsFloat nSmall, nLarge; + XcmsColor tmp; + + tmp.format = XcmsTekHVCFormat; + tmp.spec.TekHVC.H = hue; + /* Use some unreachable color on the given hue */ + tmp.spec.TekHVC.V = START_V; + tmp.spec.TekHVC.C = START_C; + + + /* + * Convert from HVC to RGB + * + * Note that the CIEXYZ to RGBi conversion routine must stuff the + * out of bounds RGBi values in tmp when the ccc->gamutCompProc + * is NULL. + */ + if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsRGBiFormat, (Bool *) NULL) + == XcmsFailure) && tmp.format != XcmsRGBiFormat) { + return (XcmsFailure); + } + + /* Now pick the smallest RGB */ + nSmall = MIN3(tmp.spec.RGBi.red, + tmp.spec.RGBi.green, + tmp.spec.RGBi.blue); + /* Make the smallest RGB equal to zero */ + tmp.spec.RGBi.red -= nSmall; + tmp.spec.RGBi.green -= nSmall; + tmp.spec.RGBi.blue -= nSmall; + + /* Now pick the largest RGB */ + nLarge = MAX3(tmp.spec.RGBi.red, + tmp.spec.RGBi.green, + tmp.spec.RGBi.blue); + /* Scale the RGB values based on the largest one */ + tmp.spec.RGBi.red /= nLarge; + tmp.spec.RGBi.green /= nLarge; + tmp.spec.RGBi.blue /= nLarge; + tmp.format = XcmsRGBiFormat; + + /* If the calling routine wants RGB value give them the ones used. */ + if (pRGB_return) { + pRGB_return->red = tmp.spec.RGBi.red; + pRGB_return->green = tmp.spec.RGBi.green; + pRGB_return->blue = tmp.spec.RGBi.blue; + } + + /* Convert from RGBi to HVC */ + if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, (Bool *) NULL) + == XcmsFailure) { + return (XcmsFailure); + } + + /* make sure to return the input hue */ + tmp.spec.TekHVC.H = hue; + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return (XcmsSuccess); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCQueryMaxVC - Compute maximum value and chroma. + * + * SYNOPSIS + */ +Status +XcmsTekHVCQueryMaxVC ( + XcmsCCC ccc, + XcmsFloat hue, + XcmsColor *pColor_return) + +/* + * DESCRIPTION + * Return the maximum chroma for the specified hue, and the + * corresponding value. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc)NULL; + + while (hue < 0.0) { + hue += 360.0; + } + while (hue >= 360.0) { + hue -= 360.0; + } + + return(_XcmsTekHVCQueryMaxVCRGB (&myCCC, hue, pColor_return, + (XcmsRGBi *)NULL)); +} diff --git a/nx-X11/lib/src/xcms/HVCMxVs.c b/nx-X11/lib/src/xcms/HVCMxVs.c new file mode 100644 index 000000000..540e5c2f4 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCMxVs.c @@ -0,0 +1,161 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * TekHVCMxVs.c + * + * DESCRIPTION + * Source for the XcmsTekHVCQueryMaxVSamples() gamut boundary + * querying routine. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCQueryMaxVSamples - Compute a set of value/chroma + * pairs. + * + * SYNOPSIS + */ +Status +XcmsTekHVCQueryMaxVSamples( + XcmsCCC ccc, + XcmsFloat hue, + XcmsColor *pColor_in_out, + unsigned int nSamples) + +/* + * DESCRIPTION + * Return a set of values and chromas for the input Hue. + * This routine will take any color as input. + * It returns TekHVC colors. + * + * Since this routine works with the value within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor *pHVC; + XcmsRGBi rgb_saved; + unsigned short nI; + XcmsFloat nT; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_in_out == NULL || nSamples == 0) { + return(XcmsFailure); + } + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* setup the CCC to use for the conversions. */ + memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc) NULL; + + /* Step 1: compute the maximum value and chroma for this hue. */ + + + /* save the Hue for use later. */ + while (hue < 0.0) { + hue += 360.0; + } + while (hue > 360.0) { + hue -= 360.0; + } + pColor_in_out->spec.TekHVC.H = hue; + pColor_in_out->format = XcmsTekHVCFormat; + + /* Get the maximum value and chroma point for this hue */ + if (_XcmsTekHVCQueryMaxVCRGB(&myCCC, pColor_in_out->spec.TekHVC.H, + pColor_in_out, (XcmsRGBi *)&rgb_saved) == XcmsFailure) { + return (XcmsFailure); + } + + /* Step 2: Convert each of the RGBi's to HVC's */ + pHVC = pColor_in_out; + for (nI = 0; nI < nSamples; nI++, pHVC++) { + nT = (XcmsFloat) nI / (XcmsFloat) nSamples; + pHVC->spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + pHVC->spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + pHVC->spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + pHVC->format = XcmsRGBiFormat; + pHVC->pixel = pColor_in_out->pixel; + /* convert from RGB to HVC */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, pHVC, + &myCCC.pPerScrnInfo->screenWhitePt, 1, XcmsTekHVCFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* make sure to return the input hue */ + pHVC->spec.TekHVC.H = hue; + } + + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/HVCWpAj.c b/nx-X11/lib/src/xcms/HVCWpAj.c new file mode 100644 index 000000000..dcefe7535 --- /dev/null +++ b/nx-X11/lib/src/xcms/HVCWpAj.c @@ -0,0 +1,114 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. TekColor is a + * trademark of Tektronix, Inc. The term "TekHVC" designates a particular + * color space that is the subject of U.S. Patent No. 4,985,853 (equivalent + * foreign patents pending). Permission is hereby granted to use, copy, + * modify, sell, and otherwise distribute this software and its + * documentation for any purpose and without fee, provided that: + * + * 1. This copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and any modification thereof and in + * supporting documentation; + * 2. Any color-handling application which displays TekHVC color + * cooordinates identifies these as TekHVC color coordinates in any + * interface that displays these coordinates and in any associated + * documentation; + * 3. The term "TekHVC" is always used, and is only used, in association + * with the mathematical derivations of the TekHVC Color Space, + * including those provided in this file and any equivalent pathways and + * mathematical derivations, regardless of digital (e.g., floating point + * or integer) representation. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * DESCRIPTION + * TekHVCWpAj.c + * + * DESCRIPTION + * This file contains routine(s) that support white point + * adjustment of color specifications in the TekHVC color + * space. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsTekHVCWhiteShiftColors + * + * SYNOPSIS + */ +Status +XcmsTekHVCWhiteShiftColors( + XcmsCCC ccc, + XcmsColor *pWhitePtFrom, + XcmsColor *pWhitePtTo, + XcmsColorFormat destSpecFmt, + XcmsColor *pColors_in_out, + unsigned int nColors, + Bool *pCompressed) +/* + * DESCRIPTION + * Convert color specifications in an array of XcmsColor structures + * for differences in white points. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression, + * XcmsSuccessWithCompression if succeeded with + * gamut compression. + */ +{ + if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Insure TekHVC installed + */ + if (XcmsAddColorSpace(&XcmsTekHVCColorSpace) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Convert to TekHVC using pWhitePtFrom + * We can ignore return value for compression because we are converting + * to XcmsTekHVCFormat which is device-independent, not device-dependent. + */ + if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, + nColors, XcmsTekHVCFormat, pCompressed) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Convert from TekHVC to destSpecFmt using pWhitePtTo + */ + return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, + nColors, destSpecFmt, pCompressed)); +} diff --git a/nx-X11/lib/src/xcms/IdOfPr.c b/nx-X11/lib/src/xcms/IdOfPr.c new file mode 100644 index 000000000..9f43dd387 --- /dev/null +++ b/nx-X11/lib/src/xcms/IdOfPr.c @@ -0,0 +1,106 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsIdOfPr.c + * + * DESCRIPTION + * Source for XcmsFormatOfPrefix() + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/* + * NAME + * XcmsFormatOfPrefix + * + * SYNOPSIS + */ +XcmsColorFormat +XcmsFormatOfPrefix(char *prefix) +/* + * DESCRIPTION + * Returns the Color Space ID for the specified prefix + * if the color space is found in the Color Conversion + * Context. + * + * RETURNS + * Color Space ID if found; zero otherwise. + */ +{ + XcmsColorSpace **papColorSpaces; + char string_buf[64]; + char *string_lowered; + size_t len; + + /* + * While copying prefix to string_lowered, convert to lowercase + */ + if ((len = strlen(prefix)) >= sizeof(string_buf)) { + string_lowered = Xmalloc(len+1); + } else { + string_lowered = string_buf; + } + _XcmsCopyISOLatin1Lowered(string_lowered, prefix); + + /* + * First try Device-Independent color spaces + */ + papColorSpaces = _XcmsDIColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) { + if (len >= sizeof(string_buf)) Xfree(string_lowered); + return((*papColorSpaces)->id); + } + papColorSpaces++; + } + } + + /* + * Next try Device-Dependent color spaces + */ + papColorSpaces = _XcmsDDColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if (strcmp((*papColorSpaces)->prefix, string_lowered) == 0) { + if (len >= sizeof(string_buf)) Xfree(string_lowered); + return((*papColorSpaces)->id); + } + papColorSpaces++; + } + } + + if (len >= sizeof(string_buf)) Xfree(string_lowered); + return(XcmsUndefinedFormat); +} diff --git a/nx-X11/lib/src/xcms/LRGB.c b/nx-X11/lib/src/xcms/LRGB.c new file mode 100644 index 000000000..38cc6cfb4 --- /dev/null +++ b/nx-X11/lib/src/xcms/LRGB.c @@ -0,0 +1,1841 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsLRGB.c + * + * DESCRIPTION + * This file contains the conversion routines: + * 1. CIE XYZ to RGB intensity + * 2. RGB intensity to device RGB + * 3. device RGB to RGB intensity + * 4. RGB intensity to CIE XYZ + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * LOCAL DEFINES + * #define declarations local to this package. + */ +#define EPS 0.001 +#ifndef MIN +#define MIN(x,y) ((x) > (y) ? (y) : (x)) +#endif /* MIN */ +#ifndef MAX +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#endif /* MAX */ +#ifndef MIN3 +#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) +#endif /* MIN3 */ +#ifndef MAX3 +#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) +#endif /* MAX3 */ + +/* + * LOCAL TYPEDEFS + * typedefs local to this package (for use with local vars). + * + */ + +/* + * FORWARD DECLARATIONS + */ +static void LINEAR_RGB_FreeSCCData(XPointer pScreenDataTemp); +static int LINEAR_RGB_InitSCCData(Display *dpy, + int screenNumber, XcmsPerScrnInfo *pPerScrnInfo); +static int XcmsLRGB_RGB_ParseString(register char *spec, XcmsColor *pColor); +static int XcmsLRGB_RGBi_ParseString(register char *spec, XcmsColor *pColor); +static Status +_XcmsGetTableType0( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount); +static Status +_XcmsGetTableType1( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount); + +/* + * LOCALS VARIABLES + * Variables local to this package. + * Usage example: + * static int ExampleLocalVar; + */ + +static unsigned short const MASK[17] = { + 0x0000, /* 0 bitsPerRGB */ + 0x8000, /* 1 bitsPerRGB */ + 0xc000, /* 2 bitsPerRGB */ + 0xe000, /* 3 bitsPerRGB */ + 0xf000, /* 4 bitsPerRGB */ + 0xf800, /* 5 bitsPerRGB */ + 0xfc00, /* 6 bitsPerRGB */ + 0xfe00, /* 7 bitsPerRGB */ + 0xff00, /* 8 bitsPerRGB */ + 0xff80, /* 9 bitsPerRGB */ + 0xffc0, /* 10 bitsPerRGB */ + 0xffe0, /* 11 bitsPerRGB */ + 0xfff0, /* 12 bitsPerRGB */ + 0xfff8, /* 13 bitsPerRGB */ + 0xfffc, /* 14 bitsPerRGB */ + 0xfffe, /* 15 bitsPerRGB */ + 0xffff /* 16 bitsPerRGB */ +}; + + + /* + * A NULL terminated array of function pointers that when applied + * in series will convert an XcmsColor structure from XcmsRGBFormat + * to XcmsCIEXYZFormat. + */ +static XcmsConversionProc Fl_RGB_to_CIEXYZ[] = { + (XcmsConversionProc)XcmsRGBToRGBi, + (XcmsConversionProc)XcmsRGBiToCIEXYZ, + NULL +}; + + /* + * A NULL terminated array of function pointers that when applied + * in series will convert an XcmsColor structure from XcmsCIEXYZFormat + * to XcmsRGBFormat. + */ +static XcmsConversionProc Fl_CIEXYZ_to_RGB[] = { + (XcmsConversionProc)XcmsCIEXYZToRGBi, + (XcmsConversionProc)XcmsRGBiToRGB, + NULL +}; + + /* + * A NULL terminated array of function pointers that when applied + * in series will convert an XcmsColor structure from XcmsRGBiFormat + * to XcmsCIEXYZFormat. + */ +static XcmsConversionProc Fl_RGBi_to_CIEXYZ[] = { + (XcmsConversionProc)XcmsRGBiToCIEXYZ, + NULL +}; + + /* + * A NULL terminated array of function pointers that when applied + * in series will convert an XcmsColor structure from XcmsCIEXYZFormat + * to XcmsRGBiFormat. + */ +static XcmsConversionProc Fl_CIEXYZ_to_RGBi[] = { + (XcmsConversionProc)XcmsCIEXYZToRGBi, + NULL +}; + + /* + * RGBi Color Spaces + */ +XcmsColorSpace XcmsRGBiColorSpace = + { + _XcmsRGBi_prefix, /* prefix */ + XcmsRGBiFormat, /* id */ + XcmsLRGB_RGBi_ParseString, /* parseString */ + Fl_RGBi_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_RGBi, /* from_CIEXYZ */ + 1 + }; + + /* + * RGB Color Spaces + */ +XcmsColorSpace XcmsRGBColorSpace = + { + _XcmsRGB_prefix, /* prefix */ + XcmsRGBFormat, /* id */ + XcmsLRGB_RGB_ParseString, /* parseString */ + Fl_RGB_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_RGB, /* from_CIEXYZ */ + 1 + }; + + /* + * Device-Independent Color Spaces known to the + * LINEAR_RGB Screen Color Characteristics Function Set. + */ +static XcmsColorSpace *DDColorSpaces[] = { + &XcmsRGBColorSpace, + &XcmsRGBiColorSpace, + NULL +}; + + +/* + * GLOBALS + * Variables declared in this package that are allowed + * to be used globally. + */ + + /* + * LINEAR_RGB Screen Color Characteristics Function Set. + */ +XcmsFunctionSet XcmsLinearRGBFunctionSet = + { + &DDColorSpaces[0], /* pDDColorSpaces */ + LINEAR_RGB_InitSCCData, /* pInitScrnFunc */ + LINEAR_RGB_FreeSCCData /* pFreeSCCData */ + }; + +/* + * DESCRIPTION + * Contents of Default SCCData should be replaced if other + * data should be used as default. + * + * + */ + +/* + * NAME Tektronix 19" (Sony) CRT + * PART_NUMBER 119-2451-00 + * MODEL Tek4300, Tek4800 + */ + +static IntensityRec const Default_RGB_RedTuples[] = { + /* {unsigned short value, XcmsFloat intensity} */ + { 0x0000, 0.000000 }, + { 0x0909, 0.000000 }, + { 0x0a0a, 0.000936 }, + { 0x0f0f, 0.001481 }, + { 0x1414, 0.002329 }, + { 0x1919, 0.003529 }, + { 0x1e1e, 0.005127 }, + { 0x2323, 0.007169 }, + { 0x2828, 0.009699 }, + { 0x2d2d, 0.012759 }, + { 0x3232, 0.016392 }, + { 0x3737, 0.020637 }, + { 0x3c3c, 0.025533 }, + { 0x4141, 0.031119 }, + { 0x4646, 0.037431 }, + { 0x4b4b, 0.044504 }, + { 0x5050, 0.052373 }, + { 0x5555, 0.061069 }, + { 0x5a5a, 0.070624 }, + { 0x5f5f, 0.081070 }, + { 0x6464, 0.092433 }, + { 0x6969, 0.104744 }, + { 0x6e6e, 0.118026 }, + { 0x7373, 0.132307 }, + { 0x7878, 0.147610 }, + { 0x7d7d, 0.163958 }, + { 0x8282, 0.181371 }, + { 0x8787, 0.199871 }, + { 0x8c8c, 0.219475 }, + { 0x9191, 0.240202 }, + { 0x9696, 0.262069 }, + { 0x9b9b, 0.285089 }, + { 0xa0a0, 0.309278 }, + { 0xa5a5, 0.334647 }, + { 0xaaaa, 0.361208 }, + { 0xafaf, 0.388971 }, + { 0xb4b4, 0.417945 }, + { 0xb9b9, 0.448138 }, + { 0xbebe, 0.479555 }, + { 0xc3c3, 0.512202 }, + { 0xc8c8, 0.546082 }, + { 0xcdcd, 0.581199 }, + { 0xd2d2, 0.617552 }, + { 0xd7d7, 0.655144 }, + { 0xdcdc, 0.693971 }, + { 0xe1e1, 0.734031 }, + { 0xe6e6, 0.775322 }, + { 0xebeb, 0.817837 }, + { 0xf0f0, 0.861571 }, + { 0xf5f5, 0.906515 }, + { 0xfafa, 0.952662 }, + { 0xffff, 1.000000 } +}; + +static IntensityRec const Default_RGB_GreenTuples[] = { + /* {unsigned short value, XcmsFloat intensity} */ + { 0x0000, 0.000000 }, + { 0x1313, 0.000000 }, + { 0x1414, 0.000832 }, + { 0x1919, 0.001998 }, + { 0x1e1e, 0.003612 }, + { 0x2323, 0.005736 }, + { 0x2828, 0.008428 }, + { 0x2d2d, 0.011745 }, + { 0x3232, 0.015740 }, + { 0x3737, 0.020463 }, + { 0x3c3c, 0.025960 }, + { 0x4141, 0.032275 }, + { 0x4646, 0.039449 }, + { 0x4b4b, 0.047519 }, + { 0x5050, 0.056520 }, + { 0x5555, 0.066484 }, + { 0x5a5a, 0.077439 }, + { 0x5f5f, 0.089409 }, + { 0x6464, 0.102418 }, + { 0x6969, 0.116485 }, + { 0x6e6e, 0.131625 }, + { 0x7373, 0.147853 }, + { 0x7878, 0.165176 }, + { 0x7d7d, 0.183604 }, + { 0x8282, 0.203140 }, + { 0x8787, 0.223783 }, + { 0x8c8c, 0.245533 }, + { 0x9191, 0.268384 }, + { 0x9696, 0.292327 }, + { 0x9b9b, 0.317351 }, + { 0xa0a0, 0.343441 }, + { 0xa5a5, 0.370580 }, + { 0xaaaa, 0.398747 }, + { 0xafaf, 0.427919 }, + { 0xb4b4, 0.458068 }, + { 0xb9b9, 0.489165 }, + { 0xbebe, 0.521176 }, + { 0xc3c3, 0.554067 }, + { 0xc8c8, 0.587797 }, + { 0xcdcd, 0.622324 }, + { 0xd2d2, 0.657604 }, + { 0xd7d7, 0.693588 }, + { 0xdcdc, 0.730225 }, + { 0xe1e1, 0.767459 }, + { 0xe6e6, 0.805235 }, + { 0xebeb, 0.843491 }, + { 0xf0f0, 0.882164 }, + { 0xf5f5, 0.921187 }, + { 0xfafa, 0.960490 }, + { 0xffff, 1.000000 } +}; + +static IntensityRec const Default_RGB_BlueTuples[] = { + /* {unsigned short value, XcmsFloat intensity} */ + { 0x0000, 0.000000 }, + { 0x0e0e, 0.000000 }, + { 0x0f0f, 0.001341 }, + { 0x1414, 0.002080 }, + { 0x1919, 0.003188 }, + { 0x1e1e, 0.004729 }, + { 0x2323, 0.006766 }, + { 0x2828, 0.009357 }, + { 0x2d2d, 0.012559 }, + { 0x3232, 0.016424 }, + { 0x3737, 0.021004 }, + { 0x3c3c, 0.026344 }, + { 0x4141, 0.032489 }, + { 0x4646, 0.039481 }, + { 0x4b4b, 0.047357 }, + { 0x5050, 0.056154 }, + { 0x5555, 0.065903 }, + { 0x5a5a, 0.076634 }, + { 0x5f5f, 0.088373 }, + { 0x6464, 0.101145 }, + { 0x6969, 0.114968 }, + { 0x6e6e, 0.129862 }, + { 0x7373, 0.145841 }, + { 0x7878, 0.162915 }, + { 0x7d7d, 0.181095 }, + { 0x8282, 0.200386 }, + { 0x8787, 0.220791 }, + { 0x8c8c, 0.242309 }, + { 0x9191, 0.264937 }, + { 0x9696, 0.288670 }, + { 0x9b9b, 0.313499 }, + { 0xa0a0, 0.339410 }, + { 0xa5a5, 0.366390 }, + { 0xaaaa, 0.394421 }, + { 0xafaf, 0.423481 }, + { 0xb4b4, 0.453547 }, + { 0xb9b9, 0.484592 }, + { 0xbebe, 0.516587 }, + { 0xc3c3, 0.549498 }, + { 0xc8c8, 0.583291 }, + { 0xcdcd, 0.617925 }, + { 0xd2d2, 0.653361 }, + { 0xd7d7, 0.689553 }, + { 0xdcdc, 0.726454 }, + { 0xe1e1, 0.764013 }, + { 0xe6e6, 0.802178 }, + { 0xebeb, 0.840891 }, + { 0xf0f0, 0.880093 }, + { 0xf5f5, 0.919723 }, + { 0xfafa, 0.959715 }, + { 0xffff, 1.00000 } +}; + +static IntensityTbl Default_RGB_RedTbl = { + /* IntensityRec *pBase */ + (IntensityRec *) Default_RGB_RedTuples, + /* unsigned int nEntries */ + 52 +}; + +static IntensityTbl Default_RGB_GreenTbl = { + /* IntensityRec *pBase */ + (IntensityRec *)Default_RGB_GreenTuples, + /* unsigned int nEntries */ + 50 +}; + +static IntensityTbl Default_RGB_BlueTbl = { + /* IntensityRec *pBase */ + (IntensityRec *)Default_RGB_BlueTuples, + /* unsigned int nEntries */ + 51 +}; + +static LINEAR_RGB_SCCData Default_RGB_SCCData = { + /* XcmsFloat XYZtoRGBmatrix[3][3] */ + { + { 3.48340481253539000, -1.52176374927285200, -0.55923133354049780 }, + {-1.07152751306193600, 1.96593795204372400, 0.03673691339553462 }, + { 0.06351179790497788, -0.20020501000496480, 0.81070942031648220 } + }, + + /* XcmsFloat RGBtoXYZmatrix[3][3] */ + { + { 0.38106149108714790, 0.32025712365352110, 0.24834578525933100 }, + { 0.20729745115140850, 0.68054638776373240, 0.11215616108485920 }, + { 0.02133944350088028, 0.14297193020246480, 1.24172892629665500 } + }, + + /* IntensityTbl *pRedTbl */ + &Default_RGB_RedTbl, + + /* IntensityTbl *pGreenTbl */ + &Default_RGB_GreenTbl, + + /* IntensityTbl *pBlueTbl */ + &Default_RGB_BlueTbl +}; + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * LINEAR_RGB_InitSCCData() + * + * SYNOPSIS + */ +static Status +LINEAR_RGB_InitSCCData( + Display *dpy, + int screenNumber, + XcmsPerScrnInfo *pPerScrnInfo) +/* + * DESCRIPTION + * + * RETURNS + * XcmsFailure if failed. + * XcmsSuccess if succeeded. + * + */ +{ + Atom CorrectAtom = XInternAtom (dpy, XDCCC_CORRECT_ATOM_NAME, True); + Atom MatrixAtom = XInternAtom (dpy, XDCCC_MATRIX_ATOM_NAME, True); + int format_return, count, cType, nTables; + unsigned long nitems, nbytes_return; + char *property_return, *pChar; + XcmsFloat *pValue; +#ifdef ALLDEBUG + IntensityRec *pIRec; +#endif /* ALLDEBUG */ + VisualID visualID; + + LINEAR_RGB_SCCData *pScreenData, *pScreenDefaultData; + XcmsIntensityMap *pNewMap; + + /* + * Allocate memory for pScreenData + */ + if (!(pScreenData = pScreenDefaultData = (LINEAR_RGB_SCCData *) + Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) { + return(XcmsFailure); + } + + /* + * 1. Get the XYZ->RGB and RGB->XYZ matrices + */ + + if (MatrixAtom == None || + !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), MatrixAtom, + &format_return, &nitems, &nbytes_return, &property_return) || + nitems != 18 || format_return != 32) { + /* + * As per the XDCCC, there must be 18 data items and each must be + * in 32 bits ! + */ + goto FreeSCCData; + + } else { + + /* + * RGBtoXYZ and XYZtoRGB matrices + */ + pValue = (XcmsFloat *) pScreenData; + pChar = property_return; + for (count = 0; count < 18; count++) { + *pValue++ = (long)_XcmsGetElement(format_return, &pChar, + &nitems) / (XcmsFloat)XDCCC_NUMBER; + } + Xfree (property_return); + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X = + pScreenData->RGBtoXYZmatrix[0][0] + + pScreenData->RGBtoXYZmatrix[0][1] + + pScreenData->RGBtoXYZmatrix[0][2]; + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = + pScreenData->RGBtoXYZmatrix[1][0] + + pScreenData->RGBtoXYZmatrix[1][1] + + pScreenData->RGBtoXYZmatrix[1][2]; + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z = + pScreenData->RGBtoXYZmatrix[2][0] + + pScreenData->RGBtoXYZmatrix[2][1] + + pScreenData->RGBtoXYZmatrix[2][2]; + + /* + * Compute the Screen White Point + */ + if ((pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y < (1.0 - EPS) ) + || (pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y > (1.0 + EPS))) { + goto FreeSCCData; + } else { + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = 1.0; + } + pPerScrnInfo->screenWhitePt.format = XcmsCIEXYZFormat; + pPerScrnInfo->screenWhitePt.pixel = 0; + +#ifdef PDEBUG + printf ("RGB to XYZ Matrix values:\n"); + printf (" %f %f %f\n %f %f %f\n %f %f %f\n", + pScreenData->RGBtoXYZmatrix[0][0], + pScreenData->RGBtoXYZmatrix[0][1], + pScreenData->RGBtoXYZmatrix[0][2], + pScreenData->RGBtoXYZmatrix[1][0], + pScreenData->RGBtoXYZmatrix[1][1], + pScreenData->RGBtoXYZmatrix[1][2], + pScreenData->RGBtoXYZmatrix[2][0], + pScreenData->RGBtoXYZmatrix[2][1], + pScreenData->RGBtoXYZmatrix[2][2]); + printf ("XYZ to RGB Matrix values:\n"); + printf (" %f %f %f\n %f %f %f\n %f %f %f\n", + pScreenData->XYZtoRGBmatrix[0][0], + pScreenData->XYZtoRGBmatrix[0][1], + pScreenData->XYZtoRGBmatrix[0][2], + pScreenData->XYZtoRGBmatrix[1][0], + pScreenData->XYZtoRGBmatrix[1][1], + pScreenData->XYZtoRGBmatrix[1][2], + pScreenData->XYZtoRGBmatrix[2][0], + pScreenData->XYZtoRGBmatrix[2][1], + pScreenData->XYZtoRGBmatrix[2][2]); + printf ("Screen White Pt value: %f %f %f\n", + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X, + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y, + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z); +#endif /* PDEBUG */ + } + + /* + * 2. Get the Intensity Profile + */ + if (CorrectAtom == None || + !_XcmsGetProperty (dpy, RootWindow(dpy, screenNumber), CorrectAtom, + &format_return, &nitems, &nbytes_return, &property_return)) { + goto FreeSCCData; + } + + pChar = property_return; + + while (nitems) { + switch (format_return) { + case 8: + /* + * Must have at least: + * VisualID0 + * VisualID1 + * VisualID2 + * VisualID3 + * type + * count + * length + * intensity1 + * intensity2 + */ + if (nitems < 9) { + goto Free_property_return; + } + count = 3; + break; + case 16: + /* + * Must have at least: + * VisualID0 + * VisualID3 + * type + * count + * length + * intensity1 + * intensity2 + */ + if (nitems < 7) { + goto Free_property_return; + } + count = 1; + break; + case 32: + /* + * Must have at least: + * VisualID0 + * type + * count + * length + * intensity1 + * intensity2 + */ + if (nitems < 6) { + goto Free_property_return; + } + count = 0; + break; + default: + goto Free_property_return; + } + + /* + * Get VisualID + */ + visualID = _XcmsGetElement(format_return, &pChar, &nitems); + while (count--) { + visualID = visualID << format_return; + visualID |= _XcmsGetElement(format_return, &pChar, &nitems); + } + + if (visualID == 0) { + /* + * This is a shared intensity table + */ + pScreenData = pScreenDefaultData; + } else { + /* + * This is a per-Visual intensity table + */ + if (!(pScreenData = (LINEAR_RGB_SCCData *) + Xcalloc (1, sizeof(LINEAR_RGB_SCCData)))) { + goto Free_property_return; + } + /* copy matrices */ + memcpy((char *)pScreenData, (char *)pScreenDefaultData, + 18 * sizeof(XcmsFloat)); + + /* Create, initialize, and add map */ + if (!(pNewMap = (XcmsIntensityMap *) + Xcalloc (1, sizeof(XcmsIntensityMap)))) { + Xfree(pScreenData); + goto Free_property_return; + } + pNewMap->visualID = visualID; + pNewMap->screenData = (XPointer)pScreenData; + pNewMap->pFreeScreenData = LINEAR_RGB_FreeSCCData; + pNewMap->pNext = + (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; + dpy->cms.perVisualIntensityMaps = (XPointer)pNewMap; + dpy->free_funcs->intensityMaps = _XcmsFreeIntensityMaps; + } + + cType = _XcmsGetElement(format_return, &pChar, &nitems); + nTables = _XcmsGetElement(format_return, &pChar, &nitems); + + if (cType == 0) { + + /* Red Intensity Table */ + if (!(pScreenData->pRedTbl = (IntensityTbl *) + Xcalloc (1, sizeof(IntensityTbl)))) { + goto Free_property_return; + } + if (_XcmsGetTableType0(pScreenData->pRedTbl, format_return, &pChar, + &nitems) == XcmsFailure) { + goto FreeRedTbl; + } + + if (nTables == 1) { + /* Green Intensity Table */ + pScreenData->pGreenTbl = pScreenData->pRedTbl; + /* Blue Intensity Table */ + pScreenData->pBlueTbl = pScreenData->pRedTbl; + } else { + /* Green Intensity Table */ + if (!(pScreenData->pGreenTbl = (IntensityTbl *) + Xcalloc (1, sizeof(IntensityTbl)))) { + goto FreeRedTblElements; + } + if (_XcmsGetTableType0(pScreenData->pGreenTbl, format_return, &pChar, + &nitems) == XcmsFailure) { + goto FreeGreenTbl; + } + + /* Blue Intensity Table */ + if (!(pScreenData->pBlueTbl = (IntensityTbl *) + Xcalloc (1, sizeof(IntensityTbl)))) { + goto FreeGreenTblElements; + } + if (_XcmsGetTableType0(pScreenData->pBlueTbl, format_return, &pChar, + &nitems) == XcmsFailure) { + goto FreeBlueTbl; + } + } + } else if (cType == 1) { + /* Red Intensity Table */ + if (!(pScreenData->pRedTbl = (IntensityTbl *) + Xcalloc (1, sizeof(IntensityTbl)))) { + goto Free_property_return; + } + if (_XcmsGetTableType1(pScreenData->pRedTbl, format_return, &pChar, + &nitems) == XcmsFailure) { + goto FreeRedTbl; + } + + if (nTables == 1) { + + /* Green Intensity Table */ + pScreenData->pGreenTbl = pScreenData->pRedTbl; + /* Blue Intensity Table */ + pScreenData->pBlueTbl = pScreenData->pRedTbl; + + } else { + + /* Green Intensity Table */ + if (!(pScreenData->pGreenTbl = (IntensityTbl *) + Xcalloc (1, sizeof(IntensityTbl)))) { + goto FreeRedTblElements; + } + if (_XcmsGetTableType1(pScreenData->pGreenTbl, format_return, &pChar, + &nitems) == XcmsFailure) { + goto FreeGreenTbl; + } + + /* Blue Intensity Table */ + if (!(pScreenData->pBlueTbl = (IntensityTbl *) + Xcalloc (1, sizeof(IntensityTbl)))) { + goto FreeGreenTblElements; + } + if (_XcmsGetTableType1(pScreenData->pBlueTbl, format_return, &pChar, + &nitems) == XcmsFailure) { + goto FreeBlueTbl; + } + } + } else { + goto Free_property_return; + } + +#ifdef ALLDEBUG + printf ("Intensity Table RED %d\n", pScreenData->pRedTbl->nEntries); + pIRec = (IntensityRec *) pScreenData->pRedTbl->pBase; + for (count = 0; count < pScreenData->pRedTbl->nEntries; count++, pIRec++) { + printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); + } + if (pScreenData->pGreenTbl->pBase != pScreenData->pRedTbl->pBase) { + printf ("Intensity Table GREEN %d\n", pScreenData->pGreenTbl->nEntries); + pIRec = (IntensityRec *)pScreenData->pGreenTbl->pBase; + for (count = 0; count < pScreenData->pGreenTbl->nEntries; count++, pIRec++) { + printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); + } + } + if (pScreenData->pBlueTbl->pBase != pScreenData->pRedTbl->pBase) { + printf ("Intensity Table BLUE %d\n", pScreenData->pBlueTbl->nEntries); + pIRec = (IntensityRec *) pScreenData->pBlueTbl->pBase; + for (count = 0; count < pScreenData->pBlueTbl->nEntries; count++, pIRec++) { + printf ("\t0x%4x\t%f\n", pIRec->value, pIRec->intensity); + } + } +#endif /* ALLDEBUG */ + } + + Xfree (property_return); + + /* Free the old memory and use the new structure created. */ + LINEAR_RGB_FreeSCCData(pPerScrnInfo->screenData); + + pPerScrnInfo->functionSet = (XPointer) &XcmsLinearRGBFunctionSet; + + pPerScrnInfo->screenData = (XPointer) pScreenData; + + pPerScrnInfo->state = XcmsInitSuccess; + + return(XcmsSuccess); + +FreeBlueTbl: + Xfree(pScreenData->pBlueTbl); + +FreeGreenTblElements: + Xfree(pScreenData->pGreenTbl->pBase); + +FreeGreenTbl: + Xfree(pScreenData->pGreenTbl); + +FreeRedTblElements: + Xfree(pScreenData->pRedTbl->pBase); + +FreeRedTbl: + Xfree(pScreenData->pRedTbl); + +Free_property_return: + Xfree (property_return); + +FreeSCCData: + Xfree(pScreenDefaultData); + pPerScrnInfo->state = XcmsInitNone; + return(XcmsFailure); +} + + +/* + * NAME + * LINEAR_RGB_FreeSCCData() + * + * SYNOPSIS + */ +static void +LINEAR_RGB_FreeSCCData( + XPointer pScreenDataTemp) +/* + * DESCRIPTION + * + * RETURNS + * 0 if failed. + * 1 if succeeded with no modifications. + * + */ +{ + LINEAR_RGB_SCCData *pScreenData = (LINEAR_RGB_SCCData *) pScreenDataTemp; + + if (pScreenData && pScreenData != &Default_RGB_SCCData) { + if (pScreenData->pRedTbl) { + if (pScreenData->pGreenTbl) { + if (pScreenData->pRedTbl->pBase != + pScreenData->pGreenTbl->pBase) { + if (pScreenData->pGreenTbl->pBase) { + Xfree (pScreenData->pGreenTbl->pBase); + } + } + if (pScreenData->pGreenTbl != pScreenData->pRedTbl) { + Xfree (pScreenData->pGreenTbl); + } + } + if (pScreenData->pBlueTbl) { + if (pScreenData->pRedTbl->pBase != + pScreenData->pBlueTbl->pBase) { + if (pScreenData->pBlueTbl->pBase) { + Xfree (pScreenData->pBlueTbl->pBase); + } + } + if (pScreenData->pBlueTbl != pScreenData->pRedTbl) { + Xfree (pScreenData->pBlueTbl); + } + } + if (pScreenData->pRedTbl->pBase) { + Xfree (pScreenData->pRedTbl->pBase); + } + Xfree (pScreenData->pRedTbl); + } + Xfree (pScreenData); + } +} + + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsGetTableType0 + * + * SYNOPSIS + */ +static Status +_XcmsGetTableType0( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount) +/* + * DESCRIPTION + * + * RETURNS + * XcmsFailure if failed. + * XcmsSuccess if succeeded. + * + */ +{ + unsigned int nElements; + IntensityRec *pIRec; + + nElements = pTbl->nEntries = + _XcmsGetElement(format, pChar, pCount) + 1; + if (!(pIRec = pTbl->pBase = (IntensityRec *) + Xcalloc (nElements, sizeof(IntensityRec)))) { + return(XcmsFailure); + } + + switch (format) { + case 8: + for (; nElements--; pIRec++) { + /* 0xFFFF/0xFF = 0x101 */ + pIRec->value = _XcmsGetElement (format, pChar, pCount) * 0x101; + pIRec->intensity = + _XcmsGetElement (format, pChar, pCount) / (XcmsFloat)255.0; + } + break; + case 16: + for (; nElements--; pIRec++) { + pIRec->value = _XcmsGetElement (format, pChar, pCount); + pIRec->intensity = _XcmsGetElement (format, pChar, pCount) + / (XcmsFloat)65535.0; + } + break; + case 32: + for (; nElements--; pIRec++) { + pIRec->value = _XcmsGetElement (format, pChar, pCount); + pIRec->intensity = _XcmsGetElement (format, pChar, pCount) + / (XcmsFloat)4294967295.0; + } + break; + default: + return(XcmsFailure); + } + return(XcmsSuccess); +} + + +/* + * NAME + * _XcmsGetTableType1 + * + * SYNOPSIS + */ +static Status +_XcmsGetTableType1( + IntensityTbl *pTbl, + int format, + char **pChar, + unsigned long *pCount) +/* + * DESCRIPTION + * + * RETURNS + * XcmsFailure if failed. + * XcmsSuccess if succeeded. + * + */ +{ + unsigned int count; + unsigned int max_index; + IntensityRec *pIRec; + + max_index = _XcmsGetElement(format, pChar, pCount); + pTbl->nEntries = max_index + 1; + if (!(pIRec = pTbl->pBase = (IntensityRec *) + Xcalloc (max_index+1, sizeof(IntensityRec)))) { + return(XcmsFailure); + } + + switch (format) { + case 8: + for (count = 0; count < max_index+1; count++, pIRec++) { + pIRec->value = (count * 65535) / max_index; + pIRec->intensity = _XcmsGetElement (format, pChar, pCount) + / (XcmsFloat)255.0; + } + break; + case 16: + for (count = 0; count < max_index+1; count++, pIRec++) { + pIRec->value = (count * 65535) / max_index; + pIRec->intensity = _XcmsGetElement (format, pChar, pCount) + / (XcmsFloat)65535.0; + } + break; + case 32: + for (count = 0; count < max_index+1; count++, pIRec++) { + pIRec->value = (count * 65535) / max_index; + pIRec->intensity = _XcmsGetElement (format, pChar, pCount) + / (XcmsFloat)4294967295.0; + } + break; + default: + return(XcmsFailure); + } + + return(XcmsSuccess); +} + + +/* + * NAME + * ValueCmp + * + * SYNOPSIS + */ +static int +_XcmsValueCmp( + IntensityRec *p1, IntensityRec *p2) +/* + * DESCRIPTION + * Compares the value component of two IntensityRec + * structures. + * + * RETURNS + * 0 if p1->value is equal to p2->value + * < 0 if p1->value is less than p2->value + * > 0 if p1->value is greater than p2->value + * + */ +{ + return (p1->value - p2->value); +} + + +/* + * NAME + * IntensityCmp + * + * SYNOPSIS + */ +static int +_XcmsIntensityCmp( + IntensityRec *p1, IntensityRec *p2) +/* + * DESCRIPTION + * Compares the intensity component of two IntensityRec + * structures. + * + * RETURNS + * 0 if equal; + * < 0 if first precedes second + * > 0 if first succeeds second + * + */ +{ + if (p1->intensity < p2->intensity) { + return (-1); + } + if (p1->intensity > p2->intensity) { + return (XcmsSuccess); + } + return (XcmsFailure); +} + +/* + * NAME + * ValueInterpolation + * + * SYNOPSIS + */ +/* ARGSUSED */ +static int +_XcmsValueInterpolation( + IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, + int bitsPerRGB) +/* + * DESCRIPTION + * Based on a given value, performs a linear interpolation + * on the intensities between two IntensityRec structures. + * Note that the bitsPerRGB parameter is ignored. + * + * RETURNS + * Returns 0 if failed; otherwise non-zero. + */ +{ + XcmsFloat ratio; + + ratio = ((XcmsFloat)key->value - (XcmsFloat)lo->value) / + ((XcmsFloat)hi->value - (XcmsFloat)lo->value); + answer->value = key->value; + answer->intensity = (hi->intensity - lo->intensity) * ratio; + answer->intensity += lo->intensity; + return (XcmsSuccess); +} + +/* + * NAME + * IntensityInterpolation + * + * SYNOPSIS + */ +static int +_XcmsIntensityInterpolation( + IntensityRec *key, IntensityRec *lo, IntensityRec *hi, IntensityRec *answer, + int bitsPerRGB) +/* + * DESCRIPTION + * Based on a given intensity, performs a linear interpolation + * on the values between two IntensityRec structures. + * The bitsPerRGB parameter is necessary to perform rounding + * to the correct number of significant bits. + * + * RETURNS + * Returns 0 if failed; otherwise non-zero. + */ +{ + XcmsFloat ratio; + long target, up, down; + int shift = 16 - bitsPerRGB; + int max_color = (1 << bitsPerRGB) - 1; + + ratio = (key->intensity - lo->intensity) / (hi->intensity - lo->intensity); + answer->intensity = key->intensity; + target = hi->value - lo->value; + target *= ratio; + target += lo->value; + + /* + * Ok now, lets find the closest in respects to bits per RGB + */ + up = ((target >> shift) * 0xFFFF) / max_color; + if (up < target) { + down = up; + up = (MIN((down >> shift) + 1, max_color) * 0xFFFF) / max_color; + } else { + down = (MAX((up >> shift) - 1, 0) * 0xFFFF) / max_color; + } + answer->value = ((up - target) < (target - down) ? up : down); + answer->value &= MASK[bitsPerRGB]; + return (XcmsSuccess); +} + + + +typedef int (*comparProcp)( + char *p1, + char *p2); +typedef int (*interpolProcp)( + char *key, + char *lo, + char *hi, + char *answer, + int bitsPerRGB); + +/* + * NAME + * _XcmsTableSearch + * + * SYNOPSIS + */ +static int +_XcmsTableSearch( + char *key, + int bitsPerRGB, + char *base, + unsigned nel, + unsigned nKeyPtrSize, + int (*compar)( + char *p1, + char *p2), + int (*interpol)( + char *key, + char *lo, + char *hi, + char *answer, + int bitsPerRGB), + char *answer) + +/* + * DESCRIPTION + * A binary search through the specificied table. + * + * RETURNS + * Returns 0 if failed; otherwise non-zero. + * + */ +{ + char *hi, *lo, *mid, *last; + int result; + + last = hi = base + ((nel - 1) * nKeyPtrSize); + mid = lo = base; + + /* use only the significants bits, then scale into 16 bits */ + ((IntensityRec *)key)->value = ((unsigned long) + (((IntensityRec *)key)->value >> (16 - bitsPerRGB)) * 0xFFFF) + / ((1 << bitsPerRGB) - 1); + + /* Special case so that zero intensity always maps to zero value */ + if ((*compar) (key,lo) <= 0) { + memcpy (answer, lo, nKeyPtrSize); + ((IntensityRec *)answer)->value &= MASK[bitsPerRGB]; + return XcmsSuccess; + } + while (mid != last) { + last = mid; + mid = lo + (((unsigned)(hi - lo) / nKeyPtrSize) / 2) * nKeyPtrSize; + result = (*compar) (key, mid); + if (result == 0) { + + memcpy(answer, mid, nKeyPtrSize); + ((IntensityRec *)answer)->value &= MASK[bitsPerRGB]; + return (XcmsSuccess); + } else if (result < 0) { + hi = mid; + } else { + lo = mid; + } + } + + /* + * If we got to here, we didn't find a solution, so we + * need to apply interpolation. + */ + return ((*interpol)(key, lo, hi, answer, bitsPerRGB)); +} + + +/* + * NAME + * _XcmsMatVec - multiply a 3 x 3 by a 3 x 1 vector + * + * SYNOPSIS + */ +static void _XcmsMatVec( + XcmsFloat *pMat, XcmsFloat *pIn, XcmsFloat *pOut) +/* + * DESCRIPTION + * Multiply the passed vector by the passed matrix to return a + * vector. Matrix is 3x3, vectors are of length 3. + * + * RETURNS + * void + */ +{ + int i, j; + + for (i = 0; i < 3; i++) { + pOut[i] = 0.0; + for (j = 0; j < 3; j++) + pOut[i] += *(pMat+(i*3)+j) * pIn[j]; + } +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + + +/* + * NAME + * XcmsLRGB_RGB_ParseString + * + * SYNOPSIS + */ +static int +XcmsLRGB_RGB_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsRGBFormat. + * + * RETURNS + * 0 if failed, non-zero otherwise. + */ +{ + register int n, i; + unsigned short r, g, b; + char c; + char *pchar; + unsigned short *pShort; + + /* + * Check for old # format + */ + if (*spec == '#') { + /* + * Attempt to parse the value portion. + */ + spec++; + n = strlen(spec); + if (n != 3 && n != 6 && n != 9 && n != 12) { + return(XcmsFailure); + } + + n /= 3; + g = b = 0; + do { + r = g; + g = b; + b = 0; + for (i = n; --i >= 0; ) { + c = *spec++; + b <<= 4; + if (c >= '0' && c <= '9') + b |= c - '0'; + /* assume string in lowercase + else if (c >= 'A' && c <= 'F') + b |= c - ('A' - 10); + */ + else if (c >= 'a' && c <= 'f') + b |= c - ('a' - 10); + else return (XcmsFailure); + } + } while (*spec != '\0'); + + /* + * Succeeded ! + */ + n <<= 2; + n = 16 - n; + /* shift instead of scale, to match old broken semantics */ + pColor->spec.RGB.red = r << n; + pColor->spec.RGB.green = g << n; + pColor->spec.RGB.blue = b << n; + } else { + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (int)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsRGB_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + spec += (n + 1); + pShort = &pColor->spec.RGB.red; + for (i = 0; i < 3; i++, pShort++, spec++) { + n = 0; + *pShort = 0; + while (*spec != '/' && *spec != '\0') { + if (++n > 4) { + return(XcmsFailure); + } + c = *spec++; + *pShort <<= 4; + if (c >= '0' && c <= '9') + *pShort |= c - '0'; + /* assume string in lowercase + else if (c >= 'A' && c <= 'F') + *pShort |= c - ('A' - 10); + */ + else if (c >= 'a' && c <= 'f') + *pShort |= c - ('a' - 10); + else return (XcmsFailure); + } + if (n == 0) + return (XcmsFailure); + if (n < 4) { + *pShort = ((unsigned long)*pShort * 0xFFFF) / ((1 << n*4) - 1); + } + } + } + pColor->format = XcmsRGBFormat; + pColor->pixel = 0; + return (XcmsSuccess); +} + + +/* + * NAME + * XcmsLRGB_RGBi_ParseString + * + * SYNOPSIS + */ +static int +XcmsLRGB_RGBi_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsRGBiFormat. + * The assumed RGBi string syntax is: + * RGBi:// + * Where r, g, and b are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + * 0 if failed, non-zero otherwise. + */ +{ + size_t n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (size_t)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsRGBi_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.RGBi.red, + &pColor->spec.RGBi.green, + &pColor->spec.RGBi.blue) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.RGBi.red, + &pColor->spec.RGBi.green, + &pColor->spec.RGBi.blue) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + + /* + * Succeeded ! + */ + pColor->format = XcmsRGBiFormat; + pColor->pixel = 0; + return (XcmsSuccess); +} + + +/* + * NAME + * XcmsCIEXYZToRGBi - convert CIE XYZ to RGB + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIEXYZToRGBi( + XcmsCCC ccc, + XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ + unsigned int nColors, /* Number of colors */ + Bool *pCompressed) /* pointer to an array of Bool */ +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from RGB format to RGBi format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression. + * XcmsSuccessWithCompression if succeeded with gamut + * compression. + */ +{ + LINEAR_RGB_SCCData *pScreenData; + XcmsFloat tmp[3]; + int hasCompressed = 0; + unsigned int i; + XcmsColor *pColor = pXcmsColors_in_out; + + if (ccc == NULL) { + return(XcmsFailure); + } + + pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; + + /* + * XcmsColors should be White Point Adjusted, if necessary, by now! + */ + + /* + * NEW!!! for extended gamut compression + * + * 1. Need to zero out pCompressed + * + * 2. Need to save initial address of pColor + * + * 3. Need to save initial address of pCompressed + */ + + for (i = 0; i < nColors; i++) { + + /* Make sure format is XcmsCIEXYZFormat */ + if (pColor->format != XcmsCIEXYZFormat) { + return(XcmsFailure); + } + + /* Multiply [A]-1 * [XYZ] to get RGB intensity */ + _XcmsMatVec((XcmsFloat *) pScreenData->XYZtoRGBmatrix, + (XcmsFloat *) &pColor->spec, tmp); + + if ((MIN3 (tmp[0], tmp[1], tmp[2]) < -EPS) || + (MAX3 (tmp[0], tmp[1], tmp[2]) > (1.0 + EPS))) { + + /* + * RGBi out of screen's gamut + */ + + if (ccc->gamutCompProc == NULL) { + /* + * Aha!! Here's that little trick that will allow + * gamut compression routines to get the out of bound + * RGBi. + */ + memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp)); + pColor->format = XcmsRGBiFormat; + return(XcmsFailure); + } else if ((*ccc->gamutCompProc)(ccc, pXcmsColors_in_out, nColors, + i, pCompressed) == 0) { + return(XcmsFailure); + } + + /* + * The gamut compression function should return colors in CIEXYZ + * Also check again to if the new color is within gamut. + */ + if (pColor->format != XcmsCIEXYZFormat) { + return(XcmsFailure); + } + _XcmsMatVec((XcmsFloat *) pScreenData->XYZtoRGBmatrix, + (XcmsFloat *) &pColor->spec, tmp); + if ((MIN3 (tmp[0], tmp[1], tmp[2]) < -EPS) || + (MAX3 (tmp[0], tmp[1], tmp[2]) > (1.0 + EPS))) { + return(XcmsFailure); + } + hasCompressed++; + } + memcpy((char *)&pColor->spec, (char *)tmp, sizeof(tmp)); + /* These if statements are done to ensure the fudge factor is */ + /* is taken into account. */ + if (pColor->spec.RGBi.red < 0.0) { + pColor->spec.RGBi.red = 0.0; + } else if (pColor->spec.RGBi.red > 1.0) { + pColor->spec.RGBi.red = 1.0; + } + if (pColor->spec.RGBi.green < 0.0) { + pColor->spec.RGBi.green = 0.0; + } else if (pColor->spec.RGBi.green > 1.0) { + pColor->spec.RGBi.green = 1.0; + } + if (pColor->spec.RGBi.blue < 0.0) { + pColor->spec.RGBi.blue = 0.0; + } else if (pColor->spec.RGBi.blue > 1.0) { + pColor->spec.RGBi.blue = 1.0; + } + (pColor++)->format = XcmsRGBiFormat; + } + return (hasCompressed ? XcmsSuccessWithCompression : XcmsSuccess); +} + + +/* + * NAME + * LINEAR_RGBi_to_CIEXYZ - convert RGBi to CIEXYZ + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsRGBiToCIEXYZ( + XcmsCCC ccc, + XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ + unsigned int nColors, /* Number of colors */ + Bool *pCompressed) /* pointer to a bit array */ +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from RGBi format to CIEXYZ format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + */ +{ + LINEAR_RGB_SCCData *pScreenData; + XcmsFloat tmp[3]; + + /* + * pCompressed ignored in this function. + */ + + if (ccc == NULL) { + return(XcmsFailure); + } + + pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; + + /* + * XcmsColors should be White Point Adjusted, if necessary, by now! + */ + + while (nColors--) { + + /* Multiply [A]-1 * [XYZ] to get RGB intensity */ + _XcmsMatVec((XcmsFloat *) pScreenData->RGBtoXYZmatrix, + (XcmsFloat *) &pXcmsColors_in_out->spec, tmp); + + memcpy((char *)&pXcmsColors_in_out->spec, (char *)tmp, sizeof(tmp)); + (pXcmsColors_in_out++)->format = XcmsCIEXYZFormat; + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsRGBiToRGB + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsRGBiToRGB( + XcmsCCC ccc, + XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ + unsigned int nColors, /* Number of colors */ + Bool *pCompressed) /* pointer to a bit array */ +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from RGBi format to RGB format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression. + * XcmsSuccessWithCompression if succeeded with gamut + * compression. + */ +{ + LINEAR_RGB_SCCData *pScreenData; + XcmsRGB tmpRGB; + IntensityRec keyIRec, answerIRec; + + /* + * pCompressed ignored in this function. + */ + + if (ccc == NULL) { + return(XcmsFailure); + } + + pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; + + while (nColors--) { + + /* Make sure format is XcmsRGBiFormat */ + if (pXcmsColors_in_out->format != XcmsRGBiFormat) { + return(XcmsFailure); + } + + keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.red; + if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, + (char *)pScreenData->pRedTbl->pBase, + (unsigned)pScreenData->pRedTbl->nEntries, + (unsigned)sizeof(IntensityRec), + (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { + return(XcmsFailure); + } + tmpRGB.red = answerIRec.value; + + keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.green; + if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, + (char *)pScreenData->pGreenTbl->pBase, + (unsigned)pScreenData->pGreenTbl->nEntries, + (unsigned)sizeof(IntensityRec), + (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { + return(XcmsFailure); + } + tmpRGB.green = answerIRec.value; + + keyIRec.intensity = pXcmsColors_in_out->spec.RGBi.blue; + if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, + (char *)pScreenData->pBlueTbl->pBase, + (unsigned)pScreenData->pBlueTbl->nEntries, + (unsigned)sizeof(IntensityRec), + (comparProcp)_XcmsIntensityCmp, (interpolProcp)_XcmsIntensityInterpolation, (char *)&answerIRec)) { + return(XcmsFailure); + } + tmpRGB.blue = answerIRec.value; + + memcpy((char *)&pXcmsColors_in_out->spec, (char *)&tmpRGB, sizeof(XcmsRGB)); + (pXcmsColors_in_out++)->format = XcmsRGBFormat; + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsRGBToRGBi + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsRGBToRGBi( + XcmsCCC ccc, + XcmsColor *pXcmsColors_in_out,/* pointer to XcmsColors to convert */ + unsigned int nColors, /* Number of colors */ + Bool *pCompressed) /* pointer to a bit array */ +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from RGB format to RGBi format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + */ +{ + LINEAR_RGB_SCCData *pScreenData; + XcmsRGBi tmpRGBi; + IntensityRec keyIRec, answerIRec; + + /* + * pCompressed ignored in this function. + */ + + if (ccc == NULL) { + return(XcmsFailure); + } + + pScreenData = (LINEAR_RGB_SCCData *)ccc->pPerScrnInfo->screenData; + + while (nColors--) { + + /* Make sure format is XcmsRGBFormat */ + if (pXcmsColors_in_out->format != XcmsRGBFormat) { + return(XcmsFailure); + } + + keyIRec.value = pXcmsColors_in_out->spec.RGB.red; + if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, + (char *)pScreenData->pRedTbl->pBase, + (unsigned)pScreenData->pRedTbl->nEntries, + (unsigned)sizeof(IntensityRec), + (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { + return(XcmsFailure); + } + tmpRGBi.red = answerIRec.intensity; + + keyIRec.value = pXcmsColors_in_out->spec.RGB.green; + if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, + (char *)pScreenData->pGreenTbl->pBase, + (unsigned)pScreenData->pGreenTbl->nEntries, + (unsigned)sizeof(IntensityRec), + (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { + return(XcmsFailure); + } + tmpRGBi.green = answerIRec.intensity; + + keyIRec.value = pXcmsColors_in_out->spec.RGB.blue; + if (!_XcmsTableSearch((char *)&keyIRec, ccc->visual->bits_per_rgb, + (char *)pScreenData->pBlueTbl->pBase, + (unsigned)pScreenData->pBlueTbl->nEntries, + (unsigned)sizeof(IntensityRec), + (comparProcp)_XcmsValueCmp, (interpolProcp)_XcmsValueInterpolation, (char *)&answerIRec)) { + return(XcmsFailure); + } + tmpRGBi.blue = answerIRec.intensity; + + memcpy((char *)&pXcmsColors_in_out->spec, (char *)&tmpRGBi, sizeof(XcmsRGBi)); + (pXcmsColors_in_out++)->format = XcmsRGBiFormat; + } + return(XcmsSuccess); +} + +/* + * NAME + * _XcmsInitScrnDefaultInfo + * + * SYNOPSIS + */ +/* ARGSUSED */ +int +_XcmsLRGB_InitScrnDefault( + Display *dpy, + int screenNumber, + XcmsPerScrnInfo *pPerScrnInfo) +/* + * DESCRIPTION + * Given a display and screen number, this routine attempts + * to initialize the Xcms per Screen Info structure + * (XcmsPerScrnInfo) with defaults. + * + * RETURNS + * Returns zero if initialization failed; non-zero otherwise. + */ +{ + pPerScrnInfo->screenData = (XPointer)&Default_RGB_SCCData; + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.X = + Default_RGB_SCCData.RGBtoXYZmatrix[0][0] + + Default_RGB_SCCData.RGBtoXYZmatrix[0][1] + + Default_RGB_SCCData.RGBtoXYZmatrix[0][2]; + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = + Default_RGB_SCCData.RGBtoXYZmatrix[1][0] + + Default_RGB_SCCData.RGBtoXYZmatrix[1][1] + + Default_RGB_SCCData.RGBtoXYZmatrix[1][2]; + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Z = + Default_RGB_SCCData.RGBtoXYZmatrix[2][0] + + Default_RGB_SCCData.RGBtoXYZmatrix[2][1] + + Default_RGB_SCCData.RGBtoXYZmatrix[2][2]; + if ((pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y < (1.0 - EPS) ) + || (pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y > (1.0 + EPS))) { + pPerScrnInfo->screenData = (XPointer)NULL; + pPerScrnInfo->state = XcmsInitNone; + return(0); + } + pPerScrnInfo->screenWhitePt.spec.CIEXYZ.Y = 1.0; + pPerScrnInfo->screenWhitePt.format = XcmsCIEXYZFormat; + pPerScrnInfo->screenWhitePt.pixel = 0; + pPerScrnInfo->functionSet = (XPointer)&XcmsLinearRGBFunctionSet; + pPerScrnInfo->state = XcmsInitFailure; /* default initialization */ + return(1); +} diff --git a/nx-X11/lib/src/xcms/Lab.c b/nx-X11/lib/src/xcms/Lab.c new file mode 100644 index 000000000..6f7075643 --- /dev/null +++ b/nx-X11/lib/src/xcms/Lab.c @@ -0,0 +1,431 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * CIELab.c + * + * DESCRIPTION + * This file contains routines that support the CIE L*a*b* + * color space to include conversions to and from the CIE + * XYZ space. These conversions are from Principles of + * Color Technology Second Edition, Fred W. Billmeyer, Jr. + * and Max Saltzman, John Wiley & Sons, Inc., 1981. + * + * Note that the range for L* is 0 to 1. + */ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include /* sscanf */ +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + * Internal definitions that need NOT be exported to any package + * or program using this package. + */ +#ifdef DBL_EPSILON +# define XMY_DBL_EPSILON DBL_EPSILON +#else +# define XMY_DBL_EPSILON 0.00001 +#endif +#define DIV16BY116 0.137931 + +/* + * FORWARD DECLARATIONS + */ + +static int CIELab_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsCIELab_ValidSpec(XcmsColor *pColor); + + +/* + * LOCAL VARIABLES + */ + + + /* + * NULL terminated list of functions applied to get from CIELab to CIEXYZ + */ +static XcmsConversionProc Fl_CIELab_to_CIEXYZ[] = { + XcmsCIELabToCIEXYZ, + NULL +}; + + /* + * NULL terminated list of functions applied to get from CIEXYZ to CIELab + */ +static XcmsConversionProc Fl_CIEXYZ_to_CIELab[] = { + XcmsCIEXYZToCIELab, + NULL +}; + + +/* + * GLOBALS + */ + /* + * CIE Lab Color Space + */ +XcmsColorSpace XcmsCIELabColorSpace = + { + _XcmsCIELab_prefix, /* prefix */ + XcmsCIELabFormat, /* id */ + CIELab_ParseString, /* parseString */ + Fl_CIELab_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_CIELab, /* from_CIEXYZ */ + 1 + }; + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * CIELab_ParseString + * + * SYNOPSIS + */ +static int +CIELab_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsCIELabFormat. + * The assumed CIELab string syntax is: + * CIELab:// + * Where L, a, and b are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + * 0 if failed, non-zero otherwise. + */ +{ + int n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (int)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsCIELab_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIELab.L_star, + &pColor->spec.CIELab.a_star, + &pColor->spec.CIELab.b_star) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIELab.L_star, + &pColor->spec.CIELab.a_star, + &pColor->spec.CIELab.b_star) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + pColor->format = XcmsCIELabFormat; + pColor->pixel = 0; + + return(XcmsCIELab_ValidSpec(pColor)); +} + + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELab_ValidSpec + * + * SYNOPSIS + */ +static Status +XcmsCIELab_ValidSpec( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks if color specification valid for CIE L*a*b*. + * + * RETURNS + * XcmsFailure if invalid, + * XcmsSuccess if valid. + * + */ +{ + if (pColor->format != XcmsCIELabFormat + || + (pColor->spec.CIELab.L_star < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIELab.L_star > 100.0 + XMY_DBL_EPSILON)) { + return(XcmsFailure); + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIELabToCIEXYZ - convert CIELab to CIEXYZ + * + * SYNOPSIS + */ +Status +XcmsCIELabToCIEXYZ( + XcmsCCC ccc, + XcmsColor *pLab_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIELab format to CIEXYZ format. + * + * WARNING: This routine assumes that Yn = 1.0; + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsCIEXYZ XYZ_return; + XcmsFloat tmpFloat, tmpL; + XcmsColor whitePt; + unsigned int i; + XcmsColor *pColor = pColors_in_out; + + /* + * Check arguments + */ + if (pLab_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Make sure white point is in CIEXYZ form, if not, convert it. + */ + if (pLab_WhitePt->format != XcmsCIEXYZFormat) { + /* Make a copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pLab_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, + (XcmsColor *)NULL, 1, XcmsCIEXYZFormat)) { + return(XcmsFailure); + } + pLab_WhitePt = &whitePt; + } + + /* + * Make sure it is a white point, i.e., Y == 1.0 + */ + if (pLab_WhitePt->spec.CIEXYZ.Y != 1.0) { + return (0); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + /* Make sure original format is CIELab */ + if (!XcmsCIELab_ValidSpec(pColor)) { + return(XcmsFailure); + } + + /* Calculate Y: assume that Yn = 1.0 */ + tmpL = (pColor->spec.CIELab.L_star + 16.0) / 116.0; + XYZ_return.Y = tmpL * tmpL * tmpL; + + if (XYZ_return.Y < 0.008856) { + /* Calculate Y: assume that Yn = 1.0 */ + tmpL = pColor->spec.CIELab.L_star / 9.03292; + + /* Calculate X */ + XYZ_return.X = pLab_WhitePt->spec.CIEXYZ.X * + ((pColor->spec.CIELab.a_star / 3893.5) + tmpL); + /* Calculate Y */ + XYZ_return.Y = tmpL; + /* Calculate Z */ + XYZ_return.Z = pLab_WhitePt->spec.CIEXYZ.Z * + (tmpL - (pColor->spec.CIELab.b_star / 1557.4)); + } else { + /* Calculate X */ + tmpFloat = tmpL + (pColor->spec.CIELab.a_star / 5.0); + XYZ_return.X = pLab_WhitePt->spec.CIEXYZ.X * tmpFloat * tmpFloat * tmpFloat; + + /* Calculate Z */ + tmpFloat = tmpL - (pColor->spec.CIELab.b_star / 2.0); + XYZ_return.Z = pLab_WhitePt->spec.CIEXYZ.Z * tmpFloat * tmpFloat * tmpFloat; + } + + memcpy((char *)&pColor->spec.CIEXYZ, (char *)&XYZ_return, + sizeof(XcmsCIEXYZ)); + pColor->format = XcmsCIEXYZFormat; + } + + return (1); +} + + +/* + * NAME + * XcmsCIEXYZToCIELab - convert CIEXYZ to CIELab + * + * SYNOPSIS + */ +Status +XcmsCIEXYZToCIELab( + XcmsCCC ccc, + XcmsColor *pLab_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIEXYZ format to CIELab format. + * + * WARNING: This routine assumes that Yn = 1.0; + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsCIELab Lab_return; + XcmsFloat fX_Xn, fY_Yn, fZ_Zn; + XcmsColor whitePt; + unsigned int i; + XcmsColor *pColor = pColors_in_out; + + /* + * Check arguments + */ + if (pLab_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Make sure white point is in CIEXYZ form, if not, convert it. + */ + if (pLab_WhitePt->format != XcmsCIEXYZFormat) { + /* Make a copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pLab_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, + 1, XcmsCIEXYZFormat)) { + return(XcmsFailure); + } + pLab_WhitePt = &whitePt; + } + + /* + * Make sure it is a white point, i.e., Y == 1.0 + */ + if (pLab_WhitePt->spec.CIEXYZ.Y != 1.0) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + /* Make sure original format is CIELab */ + if (!_XcmsCIEXYZ_ValidSpec(pColor)) { + return(XcmsFailure); + } + + /* Calculate L*: assume Yn = 1.0 */ + if (pColor->spec.CIEXYZ.Y < 0.008856) { + fY_Yn = (0.07787 * pColor->spec.CIEXYZ.Y) + DIV16BY116; + /* note fY_Yn used to compute Lab_return.a below */ + Lab_return.L_star = 116.0 * (fY_Yn - DIV16BY116); + } else { + fY_Yn = (XcmsFloat)XCMS_CUBEROOT(pColor->spec.CIEXYZ.Y); + /* note fY_Yn used to compute Lab_return.a_star below */ + Lab_return.L_star = (116.0 * fY_Yn) - 16.0; + } + + /* Calculate f(X/Xn) */ + if ((fX_Xn = pColor->spec.CIEXYZ.X / pLab_WhitePt->spec.CIEXYZ.X) < 0.008856) { + fX_Xn = (0.07787 * fX_Xn) + DIV16BY116; + } else { + fX_Xn = (XcmsFloat) XCMS_CUBEROOT(fX_Xn); + } + + /* Calculate f(Z/Zn) */ + if ((fZ_Zn = pColor->spec.CIEXYZ.Z / pLab_WhitePt->spec.CIEXYZ.Z) < 0.008856) { + fZ_Zn = (0.07787 * fZ_Zn) + DIV16BY116; + } else { + fZ_Zn = (XcmsFloat) XCMS_CUBEROOT(fZ_Zn); + } + + Lab_return.a_star = 5.0 * (fX_Xn - fY_Yn); + Lab_return.b_star = 2.0 * (fY_Yn - fZ_Zn); + + memcpy((char *)&pColor->spec.CIELab, (char *)&Lab_return, + sizeof(XcmsCIELab)); + pColor->format = XcmsCIELabFormat; + } + + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LabGcC.c b/nx-X11/lib/src/xcms/LabGcC.c new file mode 100644 index 000000000..a5ec9f457 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabGcC.c @@ -0,0 +1,127 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELabGcC.c + * + * DESCRIPTION + * Source for XcmsCIELabClipuv() gamut compression routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabClipab - Reduce the chroma for a hue and L* + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIELabClipab ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * Reduce the Chroma for a specific hue and chroma to + * to bring the given color into the gamut of the + * specified device. As required of gamut compression + * functions, this routine returns pColor_in_out + * in XcmsCIEXYZFormat on successful completion. + * + * Since this routine works with the L* within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + Status retval; + XcmsColor *pColor; + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < PseudoColor) { + /* + * GRAY ! + */ + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIELabFormat); + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIEXYZFormat); + if (pCompressed) { + *(pCompressed + i) = True; + } + return(XcmsSuccess); + } else { + if (pColor->format != XcmsCIELabFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIELabFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsCIELabQueryMaxC(ccc, + degrees(XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, + pColor->spec.CIELab.b_star)), + pColor->spec.CIELab.L_star, + pColor) == XcmsFailure) { + return(XcmsFailure); + } + retval = _XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/LabGcL.c b/nx-X11/lib/src/xcms/LabGcL.c new file mode 100644 index 000000000..3038b18a8 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabGcL.c @@ -0,0 +1,174 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELabGcL.c + * + * DESCRIPTION + * Source for XcmsCIELabClipL() gamut compression routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabClipL - Return the closest L* + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIELabClipL ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * Return the closest L* for a specific hue and chroma. + * This routine takes any color as input and outputs + * a CIE XYZ color. + * + * Since this routine works with the L* within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor *pColor; + XcmsColor Lab_max; + XcmsFloat hue, chroma, maxChroma; + Status retval; + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor) { + /* + * GRAY ! + */ + return(XcmsFailure); + } else { + /* Convert from CIEXYZ to CIE L*u*v* format */ + if (_XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat) + == XcmsFailure) { + return(XcmsFailure); + } + + hue = XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, + pColor->spec.CIELab.b_star); + chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, + pColor->spec.CIELab.b_star); + /* Step 1: compute the maximum L* and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor)); + if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, + (XcmsRGBi *)NULL) == XcmsFailure) { + return (XcmsFailure); + } + maxChroma = XCMS_CIELAB_PMETRIC_CHROMA(Lab_max.spec.CIELab.a_star, + Lab_max.spec.CIELab.b_star); + + /* Now check and return the appropriate L* */ + if (chroma == maxChroma) { + /* When the chroma input is equal to the maximum chroma */ + /* merely return the L* for that chroma. */ + memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } else if (chroma > maxChroma) { + /* When the chroma input is greater than the maximum chroma */ + /* merely return the L* and chroma for the given hue. */ + memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); + return (XcmsFailure); + } else if (pColor->spec.CIELab.L_star < Lab_max.spec.CIELab.L_star) { + /* Find the minimum lightness for the given chroma. */ + if (pColor->format != XcmsCIELabFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsCIELabQueryMinL(&myCCC, degrees(hue), chroma, pColor) + == XcmsFailure) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } else { + /* Find the maximum lightness for the given chroma. */ + if (pColor->format != XcmsCIELabFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsCIELabQueryMaxL(&myCCC, degrees(hue), chroma, pColor) + == XcmsFailure) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/LabGcLC.c b/nx-X11/lib/src/xcms/LabGcLC.c new file mode 100644 index 000000000..494d34e57 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabGcLC.c @@ -0,0 +1,223 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELabGcLC.c + * + * DESCRIPTION + * Source for XcmsCIELabClipLab() gamut + * compression function. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * INTERNALS + * Internal defines that need NOT be exported to any package or + * program using this package. + */ +#define MAXBISECTCOUNT 100 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabClipLab - Return the closest L* and chroma + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIELabClipLab ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * This routine will find the closest L* and chroma + * for a specific hue. The color input is converted to + * CIE L*u*v* format and returned as CIE XYZ format. + * + * Since this routine works with the L* within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + Status retval; + XcmsCCCRec myCCC; + XcmsColor *pColor; + XcmsColor Lab_max; + XcmsFloat hue, chroma, maxChroma; + XcmsFloat Chroma, bestChroma, Lstar, maxLstar, saveLstar; + XcmsFloat bestLstar, bestastar, bestbstar; + XcmsFloat nT, saveDist, tmpDist; + XcmsRGBi rgb_max; + int nCount, nMaxCount, nI, nILast; + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor) { + /* + * GRAY ! + */ + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIELabFormat); + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIEXYZFormat); + if (pCompressed) { + *(pCompressed + i) = True; + } + return(XcmsSuccess); + } + + /* Convert from CIEXYZ to CIELab format */ + if (_XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat) + == XcmsFailure) { + return(XcmsFailure); + } + + /* Step 1: compute the maximum L* and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + saveLstar = pColor->spec.CIELab.L_star; + hue = XCMS_CIELAB_PMETRIC_HUE(pColor->spec.CIELab.a_star, + pColor->spec.CIELab.b_star); + chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, + pColor->spec.CIELab.b_star); + memcpy((char *)&Lab_max, (char *)pColor, sizeof(XcmsColor)); + if (_XcmsCIELabQueryMaxLCRGB (&myCCC, hue, &Lab_max, &rgb_max) + == XcmsFailure) { + return (XcmsFailure); + } + maxLstar = Lab_max.spec.CIELab.L_star; + + /* Now check and return the appropriate L* */ + if (saveLstar == maxLstar) { + /* When the L* input is equal to the maximum L* */ + /* merely return the maximum Lab point. */ + memcpy((char *)pColor, (char *)&Lab_max, sizeof(XcmsColor)); + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } else { + /* return the closest point on the hue leaf. */ + /* must do a bisection here to compute the delta e. */ + maxChroma = XCMS_CIELAB_PMETRIC_CHROMA(Lab_max.spec.CIELab.a_star, + Lab_max.spec.CIELab.b_star); + nMaxCount = MAXBISECTCOUNT; + nI = nMaxCount / 2; + bestLstar = Lstar = pColor->spec.CIELab.L_star; + bestastar = pColor->spec.CIELab.a_star; + bestbstar = pColor->spec.CIELab.b_star; + bestChroma = Chroma = chroma; + saveDist = XCMS_SQRT(((Chroma - maxChroma) * (Chroma - maxChroma)) + + ((Lstar - maxLstar) * (Lstar - maxLstar))); + for (nCount = 0; nCount < nMaxCount; nCount++) { + nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; + if (saveLstar > maxLstar) { + pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; + pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; + pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; + } else { + pColor->spec.RGBi.red = rgb_max.red - (rgb_max.red * nT); + pColor->spec.RGBi.green = rgb_max.green - (rgb_max.green * nT); + pColor->spec.RGBi.blue = rgb_max.blue - (rgb_max.blue * nT); + } + pColor->format = XcmsRGBiFormat; + + /* Convert from RGBi to CIE Lab */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, + (Bool *) NULL) == XcmsFailure) { + return (XcmsFailure); + } + chroma = XCMS_CIELAB_PMETRIC_CHROMA(pColor->spec.CIELab.a_star, + pColor->spec.CIELab.b_star); + tmpDist = XCMS_SQRT(((Chroma - chroma) * (Chroma - chroma)) + + ((Lstar - pColor->spec.CIELab.L_star) * + (Lstar - pColor->spec.CIELab.L_star))); + nILast = nI; + if (tmpDist > saveDist) { + nI /= 2; + } else { + nI = (nMaxCount + nI) / 2; + saveDist = tmpDist; + bestLstar = pColor->spec.CIELab.L_star; + bestastar = pColor->spec.CIELab.a_star; + bestbstar = pColor->spec.CIELab.b_star; + bestChroma = chroma; + } + if (nI == nILast || nI == 0) { + break; + } + } + if (bestChroma >= maxChroma) { + pColor->spec.CIELab.L_star = maxLstar; + pColor->spec.CIELab.a_star = Lab_max.spec.CIELab.a_star; + pColor->spec.CIELab.b_star = Lab_max.spec.CIELab.b_star; + } else { + pColor->spec.CIELab.L_star = bestLstar; + pColor->spec.CIELab.a_star = bestastar; + pColor->spec.CIELab.b_star = bestbstar; + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + } + return(retval); +} diff --git a/nx-X11/lib/src/xcms/LabMnL.c b/nx-X11/lib/src/xcms/LabMnL.c new file mode 100644 index 000000000..18ff04cd1 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabMnL.c @@ -0,0 +1,216 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELabMnL.c + * + * DESCRIPTION + * Source for the XcmsCIELabQueryMinL() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS (XcmsFloat)0.001 +#define START_L_STAR (XcmsFloat)40.0 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabQueryMinL - Compute max Lstar for a hue and chroma + * + * SYNOPSIS + */ +Status +XcmsCIELabQueryMinL( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue angle in degrees */ + XcmsFloat chroma, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum Lstar for a specified hue_angle and chroma. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded with no modifications + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor max_lc, tmp, prev; + XcmsFloat max_chroma, tmp_chroma; + XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; + XcmsFloat rFactor; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* setup the CCC to use for the conversions. */ + memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc) NULL; + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + hue = radians(hue_angle); + tmp.spec.CIELab.L_star = START_L_STAR; + tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, chroma); + tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma); + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsCIELabFormat; + + /* Step 1: Obtain the maximum L_star and chroma for this hue. */ + if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + max_chroma = XCMS_CIELAB_PMETRIC_CHROMA(max_lc.spec.CIELab.a_star, + max_lc.spec.CIELab.b_star); + + if (max_chroma <= chroma) { + /* + * If the chroma is greater than the chroma for the + * maximum L/chroma point then the L_star is the + * the L_star for the maximum L_star/chroma point. + * This is an error but I return the best approximation I can. + * Thus the inconsistency. + */ + memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + return(XcmsSuccess); + } + + /* + * If the chroma is equal to the chroma for the + * maximum L_star/chroma point then the L_star is the + * the L_star for the maximum L* and chroma point. + */ + /* if (max_chroma == chroma) { + * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + * return(XcmsSuccess); + * } + */ + + /* must do a bisection here to compute the maximum L* */ + /* save the structure input so that any elements that */ + /* are not touched are recopied later in the routine. */ + nChroma = chroma; + tmp_chroma = max_chroma; + lastChroma = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prevChroma = lastChroma; + lastChroma = tmp_chroma; + nT = (nChroma - max_chroma) / max_chroma * rFactor; + memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); + tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); + tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); + tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to CIELab */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Now check the return against what is expected */ + tmp_chroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, + tmp.spec.CIELab.b_star); + if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { + /* Found It! */ + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } + nChroma += chroma - tmp_chroma; + if (nChroma > max_chroma) { + nChroma = max_chroma; + rFactor *= 0.5; /* selective relaxation employed */ + } else if (nChroma < 0.0) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + return(XcmsSuccess); + } else if (tmp_chroma <= prevChroma + EPS && + tmp_chroma >= prevChroma - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + } + } + + if (nCount >= nMaxCount) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + } + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LabMxC.c b/nx-X11/lib/src/xcms/LabMxC.c new file mode 100644 index 000000000..fcadd236a --- /dev/null +++ b/nx-X11/lib/src/xcms/LabMxC.c @@ -0,0 +1,203 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * CIELabMxC.c + * + * DESCRIPTION + * Source for the XcmsCIELabQueryMaxC() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS (XcmsFloat)0.001 +#define START_CHROMA (XcmsFloat)3.6 +#define TOPL (XcmsFloat)100.0 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabQueryMaxC - max chroma for a hue_angle and L_star + * + * SYNOPSIS + */ +Status +XcmsCIELabQueryMaxC( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue angle in degrees */ + XcmsFloat L_star, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum chroma for a specific hue_angle and L_star. + * The returned format is in XcmsCIELabFormat. + * + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor tmp; + XcmsColor max_lc; + XcmsFloat n_L_star, last_L_star, prev_L_star; + XcmsFloat hue, lastaStar, lastbStar, /*lastChroma,*/ maxDist, nT, rFactor; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* Use my own CCC and inherit screen white Pt */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + hue = radians(hue_angle); + tmp.spec.CIELab.L_star = L_star; + tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, START_CHROMA); + tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, START_CHROMA); + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsCIELabFormat; + + /* Step 1: compute the maximum L_star and chroma for this hue. */ + memcpy((char *)&max_lc, (char *)&tmp, sizeof(XcmsColor)); + if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Step 2: Do a bisection here to compute the maximum chroma + * Note the differences between when the point to be found + * is above the maximum LC point and when it is below. + */ + if (L_star <= max_lc.spec.CIELab.L_star) { + maxDist = max_lc.spec.CIELab.L_star; + } else { + maxDist = TOPL - max_lc.spec.CIELab.L_star; + } + + n_L_star = L_star; + last_L_star = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prev_L_star = last_L_star; + last_L_star = tmp.spec.CIELab.L_star; +/* lastChroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, */ +/* tmp.spec.CIELab.b_star); */ + lastaStar = tmp.spec.CIELab.a_star; + lastbStar = tmp.spec.CIELab.b_star; + nT = (n_L_star - max_lc.spec.CIELab.L_star) / maxDist * rFactor; + if (nT > 0) { + tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + } else { + tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); + tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); + tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); + } + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to CIELab */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Now check if we've reached the target L_star + */ + /* printf("result Lstar = %lf\n", tmp.spec.CIELab.L_star); */ + if (tmp.spec.CIELab.L_star <= L_star + EPS && + tmp.spec.CIELab.L_star >= L_star - EPS) { + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); + } + if (nT > 0) { + n_L_star += ((TOPL - n_L_star) * + (L_star - tmp.spec.CIELab.L_star)) / (TOPL - L_star); + } else { + n_L_star *= L_star / tmp.spec.CIELuv.L_star; + } + if (tmp.spec.CIELab.L_star <= prev_L_star + EPS && + tmp.spec.CIELab.L_star >= prev_L_star - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + /* printf("rFactor = %lf\n", rFactor); */ + } + } + if (XCMS_FABS(last_L_star - L_star) < + XCMS_FABS(tmp.spec.CIELab.L_star - L_star)) { + tmp.spec.CIELab.a_star = lastaStar; + tmp.spec.CIELab.b_star = lastbStar; +/* tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, lastChroma); */ +/* tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, lastChroma); */ + } + tmp.spec.CIELab.L_star = L_star; + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LabMxL.c b/nx-X11/lib/src/xcms/LabMxL.c new file mode 100644 index 000000000..66ef48481 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabMxL.c @@ -0,0 +1,216 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELabMxL.c + * + * DESCRIPTION + * Source for the XcmsCIELabQueryMaxL() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS (XcmsFloat)0.001 +#define START_L_STAR (XcmsFloat)40 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabQueryMaxL - Compute max Lstar for a hue and chroma + * + * SYNOPSIS + */ +Status +XcmsCIELabQueryMaxL( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue in degrees */ + XcmsFloat chroma, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum Lstar for a specified hue_angle and chroma. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded with no modifications + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor max_lc, tmp, prev; + XcmsFloat max_chroma, tmp_chroma; + XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; + XcmsFloat rFactor; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* setup the CCC to use for the conversions. */ + memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc) NULL; + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + hue = radians(hue_angle); + tmp.spec.CIELab.L_star = START_L_STAR; + tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, chroma); + tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, chroma); + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsCIELabFormat; + + /* Step 1: Obtain the maximum L_star and chroma for this hue. */ + if (_XcmsCIELabQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + max_chroma = XCMS_CIELAB_PMETRIC_CHROMA(max_lc.spec.CIELab.a_star, + max_lc.spec.CIELab.b_star); + + if (max_chroma <= chroma) { + /* + * If the chroma is greater than the chroma for the + * maximum L/chroma point then the L_star is the + * the L_star for the maximum L_star/chroma point. + * This is an error but I return the best approximation I can. + * Thus the inconsistency. + */ + memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + return(XcmsSuccess); + } + + /* + * If the chroma is equal to the chroma for the + * maximum L_star/chroma point then the L_star is the + * the L_star for the maximum L* and chroma point. + */ + /* if (max_chroma == chroma) { + * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + * return(XcmsSuccess); + * } + */ + + /* must do a bisection here to compute the maximum L* */ + /* save the structure input so that any elements that */ + /* are not touched are recopied later in the routine. */ + nChroma = chroma; + tmp_chroma = max_chroma; + lastChroma = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prevChroma = lastChroma; + lastChroma = tmp_chroma; + nT = (1.0 - (nChroma / max_chroma)) * rFactor; + memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); + tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to CIELab */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELabFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Now check the return against what is expected */ + tmp_chroma = XCMS_CIELAB_PMETRIC_CHROMA(tmp.spec.CIELab.a_star, + tmp.spec.CIELab.b_star); + if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { + /* Found It! */ + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } + nChroma += chroma - tmp_chroma; + if (nChroma > max_chroma) { + nChroma = max_chroma; + rFactor *= 0.5; /* selective relaxation employed */ + } else if (nChroma < 0.0) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + return(XcmsSuccess); + } else if (tmp_chroma <= prevChroma + EPS && + tmp_chroma >= prevChroma - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + } + } + + if (nCount >= nMaxCount) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + } + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LabMxLC.c b/nx-X11/lib/src/xcms/LabMxLC.c new file mode 100644 index 000000000..8cc089a22 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabMxLC.c @@ -0,0 +1,218 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * CIELabMxVC.c + * + * DESCRIPTION + * Source for the XcmsCIELabQueryMaxLC() gamut boundary + * querying routine. + * + * DOCUMENTATION + * "TekColor Color Management System, System Implementor's Manual" + * and + * Fred W. Billmeyer & Max Saltzman, "Principles of Color + * Technology", John Wily & Sons, Inc, 1981. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + */ +#define MIN(x,y) ((x) > (y) ? (y) : (x)) +#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) +#define START_LSTAR (XcmsFloat)40.0 +#define START_CHROMA (XcmsFloat)3.6 + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsCIELabQueryMaxLCRGB - Compute maximum L* and chroma. + * + * SYNOPSIS + */ +Status +_XcmsCIELabQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return) +/* + * DESCRIPTION + * Return the maximum psychometric chroma for a specified + * hue, and the corresponding L*. This is computed + * by a binary search of all possible chromas. An assumption + * is made that there are no local maxima. Use the unrounded + * Max psychometric chroma because the difference check can be + * small. + * + * NOTE: No local CCC is used because this is a private + * routine and all routines that call it are expected + * to behave properly, i.e. send a local CCC with + * no white adjust function and no gamut compression + * function. + * + * This routine only accepts hue in radians as input and outputs + * Lab and RGBi. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsFloat nSmall, nLarge; + XcmsColor tmp; + + tmp.format = XcmsCIELabFormat; + /* Use some unreachable color on the given hue */ + tmp.spec.CIELab.L_star = START_LSTAR; + tmp.spec.CIELab.a_star = XCMS_CIEASTAROFHUE(hue, START_CHROMA); + tmp.spec.CIELab.b_star = XCMS_CIEBSTAROFHUE(hue, START_CHROMA); + /* + * Convert from Lab to RGB + * + * Note that the CIEXYZ to RGBi conversion routine must stuff the + * out of bounds RGBi values in tmp when the ccc->gamutCompProc + * is NULL. + */ + if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), + (unsigned int)1, XcmsRGBiFormat, (Bool *) NULL) + == XcmsFailure) && tmp.format != XcmsRGBiFormat) { + return (XcmsFailure); + } + + /* Now pick the smallest RGB */ + nSmall = MIN3(tmp.spec.RGBi.red, + tmp.spec.RGBi.green, + tmp.spec.RGBi.blue); + /* Make the smallest RGB equal to zero */ + tmp.spec.RGBi.red -= nSmall; + tmp.spec.RGBi.green -= nSmall; + tmp.spec.RGBi.blue -= nSmall; + + /* Now pick the largest RGB */ + nLarge = MAX3(tmp.spec.RGBi.red, + tmp.spec.RGBi.green, + tmp.spec.RGBi.blue); + /* Scale the RGB values based on the largest one */ + tmp.spec.RGBi.red /= nLarge; + tmp.spec.RGBi.green /= nLarge; + tmp.spec.RGBi.blue /= nLarge; + tmp.format = XcmsRGBiFormat; + + /* If the calling routine wants RGB value give them the ones used. */ + if (pRGB_return) { + pRGB_return->red = tmp.spec.RGBi.red; + pRGB_return->green = tmp.spec.RGBi.green; + pRGB_return->blue = tmp.spec.RGBi.blue; + } + + /* Convert from RGBi to Lab */ + if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, + ScreenWhitePointOfCCC(ccc), 1, XcmsCIELabFormat, (Bool *) NULL) + == XcmsFailure) { + return (XcmsFailure); + } + + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return (XcmsSuccess); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabQueryMaxLC - Compute maximum L* and chroma. + * + * SYNOPSIS + */ +Status +XcmsCIELabQueryMaxLC ( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue_angle in degrees */ + XcmsColor *pColor_return) + +/* + * DESCRIPTION + * Return the point of maximum chroma for the specified + * hue_angle. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc)NULL; + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + return(_XcmsCIELabQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, + (XcmsRGBi *)NULL)); +} diff --git a/nx-X11/lib/src/xcms/LabWpAj.c b/nx-X11/lib/src/xcms/LabWpAj.c new file mode 100644 index 000000000..0559fdee3 --- /dev/null +++ b/nx-X11/lib/src/xcms/LabWpAj.c @@ -0,0 +1,97 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * CIELabWpAj.c + * + * DESCRIPTION + * This file contains routine(s) that support white point + * adjustment of color specifications in the CIE L*a*b* color + * space. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * EXTERNS + */ + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELabWhiteShiftColors + * + * SYNOPSIS + */ +Status +XcmsCIELabWhiteShiftColors( + XcmsCCC ccc, + XcmsColor *pWhitePtFrom, + XcmsColor *pWhitePtTo, + XcmsColorFormat destSpecFmt, + XcmsColor *pColors_in_out, + unsigned int nColors, + Bool *pCompressed) +/* + * DESCRIPTION + * Adjust color specifications in XcmsColor structures for + * differences in white points. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression, + * XcmsSuccessWithCompression if succeeded with gamut + * compression. + */ +{ + if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { + return(0); + } + + /* + * Convert to CIELab using pWhitePtFrom + */ + if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, + nColors, XcmsCIELabFormat, pCompressed) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Convert from CIELab to destSpecFmt using pWhitePtTo + */ + return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, + pWhitePtTo, nColors, destSpecFmt, pCompressed)); +} diff --git a/nx-X11/lib/src/xcms/Luv.c b/nx-X11/lib/src/xcms/Luv.c new file mode 100644 index 000000000..2bce977ea --- /dev/null +++ b/nx-X11/lib/src/xcms/Luv.c @@ -0,0 +1,401 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * CIELuv.c + * + * DESCRIPTION + * This file contains routines that support the CIE L*u*v* + * color space to include conversions to and from the CIE + * XYZ space. + * + * DOCUMENTATION + * "TekColor Color Management System, System Implementor's Manual" + * and + * Fred W. Billmeyer & Max Saltzman, "Principles of Color + * Technology", John Wily & Sons, Inc, 1981. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +#include /* sscanf */ + + +/* + * FORWARD DECLARATIONS + */ + +static int CIELuv_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsCIELuv_ValidSpec(XcmsColor *pColor); + +/* + * DEFINES + * Internal definitions that need NOT be exported to any package + * or program using this package. + */ +#ifdef DBL_EPSILON +# define XMY_DBL_EPSILON DBL_EPSILON +#else +# define XMY_DBL_EPSILON 0.00001 +#endif + + +/* + * LOCAL VARIABLES + */ + + /* + * NULL terminated list of functions applied to get from CIELuv to CIEXYZ + */ +static XcmsConversionProc Fl_CIELuv_to_CIEXYZ[] = { + XcmsCIELuvToCIEuvY, + XcmsCIEuvYToCIEXYZ, + NULL +}; + + /* + * NULL terminated list of functions applied to get from CIEXYZ to CIELuv + */ +static XcmsConversionProc Fl_CIEXYZ_to_CIELuv[] = { + XcmsCIEXYZToCIEuvY, + XcmsCIEuvYToCIELuv, + NULL +}; + +/* + * GLOBALS + */ + + /* + * CIE Luv Color Space + */ +XcmsColorSpace XcmsCIELuvColorSpace = + { + _XcmsCIELuv_prefix, /* prefix */ + XcmsCIELuvFormat, /* id */ + CIELuv_ParseString, /* parseString */ + Fl_CIELuv_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_CIELuv, /* from_CIEXYZ */ + 1 + }; + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * CIELuv_ParseString + * + * SYNOPSIS + */ +static int +CIELuv_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsCIELuvFormat. + * The assumed CIELuv string syntax is: + * CIELuv:// + * Where L, u, and v are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + * 0 if failed, non-zero otherwise. + */ +{ + int n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (int)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsCIELuv_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIELuv.L_star, + &pColor->spec.CIELuv.u_star, + &pColor->spec.CIELuv.v_star) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIELuv.L_star, + &pColor->spec.CIELuv.u_star, + &pColor->spec.CIELuv.v_star) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + pColor->format = XcmsCIELuvFormat; + pColor->pixel = 0; + return(XcmsCIELuv_ValidSpec(pColor)); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuv_ValidSpec + * + * SYNOPSIS + */ +static Status +XcmsCIELuv_ValidSpec( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks if color specification valid for CIE L*u*v*. + * + * RETURNS + * XcmsFailure if invalid, + * XcmsSuccess if valid. + * + */ +{ + if (pColor->format != XcmsCIELuvFormat + || + (pColor->spec.CIELuv.L_star < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIELuv.L_star > 100.0 + XMY_DBL_EPSILON)) { + return(XcmsFailure); + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIELuvToCIEuvY - convert CIELuv to CIEuvY + * + * SYNOPSIS + */ +Status +XcmsCIELuvToCIEuvY( + XcmsCCC ccc, + XcmsColor *pLuv_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIELuv format to CIEuvY format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsColor *pColor = pColors_in_out; + XcmsColor whitePt; + XcmsCIEuvY uvY_return; + XcmsFloat tmpVal; + unsigned int i; + + /* + * Check arguments + */ + if (pLuv_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Make sure white point is in CIEuvY form + */ + if (pLuv_WhitePt->format != XcmsCIEuvYFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pLuv_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, + 1, XcmsCIEuvYFormat)) { + return(XcmsFailure); + } + pLuv_WhitePt = &whitePt; + } + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (pLuv_WhitePt->spec.CIEuvY.Y != 1.0) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + /* Make sure original format is CIELuv and is valid */ + if (!XcmsCIELuv_ValidSpec(pColor)) { + return(XcmsFailure); + } + + if (pColor->spec.CIELuv.L_star < 7.99953624) { + uvY_return.Y = pColor->spec.CIELuv.L_star / 903.29; + } else { + tmpVal = (pColor->spec.CIELuv.L_star + 16.0) / 116.0; + uvY_return.Y = tmpVal * tmpVal * tmpVal; /* tmpVal ** 3 */ + } + + + + if (pColor->spec.CIELuv.L_star == 0.0) { + uvY_return.u_prime = pLuv_WhitePt->spec.CIEuvY.u_prime; + uvY_return.v_prime = pLuv_WhitePt->spec.CIEuvY.v_prime; + } else { + tmpVal = 13.0 * (pColor->spec.CIELuv.L_star / 100.0); + uvY_return.u_prime = pColor->spec.CIELuv.u_star/tmpVal + + pLuv_WhitePt->spec.CIEuvY.u_prime; + uvY_return.v_prime = pColor->spec.CIELuv.v_star/tmpVal + + pLuv_WhitePt->spec.CIEuvY.v_prime; + } + /* Copy result to pColor */ + memcpy((char *)&pColor->spec, (char *)&uvY_return, sizeof(XcmsCIEuvY)); + + /* Identify that the format is now CIEuvY */ + pColor->format = XcmsCIEuvYFormat; + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIEuvYToCIELuv - convert CIEuvY to CIELuv + * + * SYNOPSIS + */ +Status +XcmsCIEuvYToCIELuv( + XcmsCCC ccc, + XcmsColor *pLuv_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIEuvY format to CIELab format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsColor *pColor = pColors_in_out; + XcmsColor whitePt; + XcmsCIELuv Luv_return; + XcmsFloat tmpVal; + unsigned int i; + + /* + * Check arguments + */ + if (pLuv_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Make sure white point is in CIEuvY form + */ + if (pLuv_WhitePt->format != XcmsCIEuvYFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pLuv_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, + (XcmsColor *)NULL, 1, XcmsCIEuvYFormat)) { + return(XcmsFailure); + } + pLuv_WhitePt = &whitePt; + } + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (pLuv_WhitePt->spec.CIEuvY.Y != 1.0) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + if (!_XcmsCIEuvY_ValidSpec(pColor)) { + return(XcmsFailure); + } + + /* Now convert the uvY to Luv */ + Luv_return.L_star = + (pColor->spec.CIEuvY.Y < 0.008856) + ? + (pColor->spec.CIEuvY.Y * 903.29) + : + ((XcmsFloat)(XCMS_CUBEROOT(pColor->spec.CIEuvY.Y) * 116.0) - 16.0); + tmpVal = 13.0 * (Luv_return.L_star / 100.0); + Luv_return.u_star = tmpVal * + (pColor->spec.CIEuvY.u_prime - pLuv_WhitePt->spec.CIEuvY.u_prime); + Luv_return.v_star = tmpVal * + (pColor->spec.CIEuvY.v_prime - pLuv_WhitePt->spec.CIEuvY.v_prime); + + /* Copy result to pColor */ + memcpy((char *)&pColor->spec, (char *)&Luv_return, sizeof(XcmsCIELuv)); + + /* Identify that the format is now CIEuvY */ + pColor->format = XcmsCIELuvFormat; + } + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LuvGcC.c b/nx-X11/lib/src/xcms/LuvGcC.c new file mode 100644 index 000000000..cadf4a8b2 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvGcC.c @@ -0,0 +1,127 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELuvGcC.c + * + * DESCRIPTION + * Source for XcmsCIELuvClipuv() gamut compression routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvClipuv - Reduce the chroma for a hue and L* + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIELuvClipuv ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * Reduce the Chroma for a specific hue and chroma to + * to bring the given color into the gamut of the + * specified device. As required of gamut compression + * functions, this routine returns pColor_in_out + * in XcmsCIEXYZFormat on successful completion. + * + * Since this routine works with the L* within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + Status retval; + XcmsColor *pColor; + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < PseudoColor) { + /* + * GRAY ! + */ + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIELuvFormat); + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIEXYZFormat); + if (pCompressed) { + *(pCompressed + i) = True; + } + return(XcmsSuccess); + } else { + if (pColor->format != XcmsCIELuvFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIELuvFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsCIELuvQueryMaxC(ccc, + degrees(XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, + pColor->spec.CIELuv.v_star)), + pColor->spec.CIELuv.L_star, + pColor) == XcmsFailure) { + return(XcmsFailure); + } + retval = _XcmsDIConvertColors(ccc, pColor, + &ccc->pPerScrnInfo->screenWhitePt, 1, XcmsCIEXYZFormat); + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/LuvGcL.c b/nx-X11/lib/src/xcms/LuvGcL.c new file mode 100644 index 000000000..f5b6d99e4 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvGcL.c @@ -0,0 +1,174 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELuvGcL.c + * + * DESCRIPTION + * Source for XcmsCIELuvClipL() gamut compression routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvClipL - Return the closest L* + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIELuvClipL ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * Return the closest L* for a specific hue and chroma. + * This routine takes any color as input and outputs + * a CIE XYZ color. + * + * Since this routine works with the L* within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor *pColor; + XcmsColor Luv_max; + XcmsFloat hue, chroma, maxChroma; + Status retval; + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* Inherit Screen WP */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression */ + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor) { + /* + * GRAY ! + */ + return(XcmsFailure); + } else { + /* Convert from CIEXYZ to CIE L*u*v* format */ + if (_XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat) + == XcmsFailure) { + return(XcmsFailure); + } + + hue = XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, + pColor->spec.CIELuv.v_star); + chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, + pColor->spec.CIELuv.v_star); + /* Step 1: compute the maximum L* and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor)); + if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, + (XcmsRGBi *)NULL) == XcmsFailure) { + return (XcmsFailure); + } + maxChroma = XCMS_CIELUV_PMETRIC_CHROMA(Luv_max.spec.CIELuv.u_star, + Luv_max.spec.CIELuv.v_star); + + /* Now check and return the appropriate L* */ + if (chroma == maxChroma) { + /* When the chroma input is equal to the maximum chroma */ + /* merely return the L* for that chroma. */ + memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } else if (chroma > maxChroma) { + /* When the chroma input is greater than the maximum chroma */ + /* merely return the L* and chroma for the given hue. */ + memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); + return (XcmsFailure); + } else if (pColor->spec.CIELuv.L_star < Luv_max.spec.CIELuv.L_star) { + /* Find the minimum lightness for the given chroma. */ + if (pColor->format != XcmsCIELuvFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsCIELuvQueryMinL(&myCCC, degrees(hue), chroma, pColor) + == XcmsFailure) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } else { + /* Find the maximum lightness for the given chroma. */ + if (pColor->format != XcmsCIELuvFormat) { + if (_XcmsDIConvertColors(ccc, pColor, + ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat) + == XcmsFailure) { + return(XcmsFailure); + } + } + if (XcmsCIELuvQueryMaxL(&myCCC, degrees(hue), chroma, pColor) + == XcmsFailure) { + return (XcmsFailure); + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + return(retval); + } +} diff --git a/nx-X11/lib/src/xcms/LuvGcLC.c b/nx-X11/lib/src/xcms/LuvGcLC.c new file mode 100644 index 000000000..a9f8cbaf1 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvGcLC.c @@ -0,0 +1,223 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELuvGcLC.c + * + * DESCRIPTION + * Source for XcmsCIELuvClipLuv() gamut + * compression function. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * INTERNALS + * Internal defines that need NOT be exported to any package or + * program using this package. + */ +#define MAXBISECTCOUNT 100 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvClipLuv - Return the closest L* and chroma + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIELuvClipLuv ( + XcmsCCC ccc, + XcmsColor *pColors_in_out, + unsigned int nColors, + unsigned int i, + Bool *pCompressed) +/* + * DESCRIPTION + * This routine will find the closest L* and chroma + * for a specific hue. The color input is converted to + * CIE L*u*v* format and returned as CIE XYZ format. + * + * Since this routine works with the L* within + * pColor_in_out intermediate results may be returned + * even though it may be invalid. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + Status retval; + XcmsCCCRec myCCC; + XcmsColor *pColor; + XcmsColor Luv_max; + XcmsFloat hue, chroma, maxChroma; + XcmsFloat Chroma, bestChroma, Lstar, maxLstar, saveLstar; + XcmsFloat bestLstar, bestustar, bestvstar; + XcmsFloat nT, saveDist, tmpDist; + XcmsRGBi rgb_max; + int nCount, nMaxCount, nI, nILast; + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat;/* inherit screen white */ + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut compression func */ + + /* + * Color specification passed as input can be assumed to: + * 1. Be in XcmsCIEXYZFormat + * 2. Already be white point adjusted for the Screen White Point. + * This means that the white point now associated with this + * color spec is the Screen White Point (even if the + * ccc->clientWhitePt differs). + */ + + pColor = pColors_in_out + i; + + if (ccc->visual->class < StaticColor) { + /* + * GRAY ! + */ + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIELuvFormat); + _XcmsDIConvertColors(ccc, pColor, ScreenWhitePointOfCCC(ccc), + 1, XcmsCIEXYZFormat); + if (pCompressed) { + *(pCompressed + i) = True; + } + return(XcmsSuccess); + } + + /* Convert from CIEXYZ to CIELuv format */ + if (_XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat) + == XcmsFailure) { + return(XcmsFailure); + } + + /* Step 1: compute the maximum L* and chroma for this hue. */ + /* This copy may be overkill but it preserves the pixel etc. */ + saveLstar = pColor->spec.CIELuv.L_star; + hue = XCMS_CIELUV_PMETRIC_HUE(pColor->spec.CIELuv.u_star, + pColor->spec.CIELuv.v_star); + chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, + pColor->spec.CIELuv.v_star); + memcpy((char *)&Luv_max, (char *)pColor, sizeof(XcmsColor)); + if (_XcmsCIELuvQueryMaxLCRGB (&myCCC, hue, &Luv_max, &rgb_max) + == XcmsFailure) { + return (XcmsFailure); + } + maxLstar = Luv_max.spec.CIELuv.L_star; + + /* Now check and return the appropriate L* */ + if (saveLstar == maxLstar) { + /* When the L* input is equal to the maximum L* */ + /* merely return the maximum Luv point. */ + memcpy((char *)pColor, (char *)&Luv_max, sizeof(XcmsColor)); + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + } else { + /* return the closest point on the hue leaf. */ + /* must do a bisection here to compute the delta e. */ + maxChroma = XCMS_CIELUV_PMETRIC_CHROMA(Luv_max.spec.CIELuv.u_star, + Luv_max.spec.CIELuv.v_star); + nMaxCount = MAXBISECTCOUNT; + nI = nMaxCount / 2; + bestLstar = Lstar = pColor->spec.CIELuv.L_star; + bestustar = pColor->spec.CIELuv.u_star; + bestvstar = pColor->spec.CIELuv.v_star; + bestChroma = Chroma = chroma; + saveDist = XCMS_SQRT(((Chroma - maxChroma) * (Chroma - maxChroma)) + + ((Lstar - maxLstar) * (Lstar - maxLstar))); + for (nCount = 0; nCount < nMaxCount; nCount++) { + nT = (XcmsFloat) nI / (XcmsFloat) nMaxCount; + if (saveLstar > maxLstar) { + pColor->spec.RGBi.red = rgb_max.red * (1.0 - nT) + nT; + pColor->spec.RGBi.green = rgb_max.green * (1.0 - nT) + nT; + pColor->spec.RGBi.blue = rgb_max.blue * (1.0 - nT) + nT; + } else { + pColor->spec.RGBi.red = rgb_max.red - (rgb_max.red * nT); + pColor->spec.RGBi.green = rgb_max.green - (rgb_max.green * nT); + pColor->spec.RGBi.blue = rgb_max.blue - (rgb_max.blue * nT); + } + pColor->format = XcmsRGBiFormat; + + /* Convert from RGBi to CIE Luv */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, + (Bool *) NULL) == XcmsFailure) { + return (XcmsFailure); + } + chroma = XCMS_CIELUV_PMETRIC_CHROMA(pColor->spec.CIELuv.u_star, + pColor->spec.CIELuv.v_star); + tmpDist = XCMS_SQRT(((Chroma - chroma) * (Chroma - chroma)) + + ((Lstar - pColor->spec.CIELuv.L_star) * + (Lstar - pColor->spec.CIELuv.L_star))); + nILast = nI; + if (tmpDist > saveDist) { + nI /= 2; + } else { + nI = (nMaxCount + nI) / 2; + saveDist = tmpDist; + bestLstar = pColor->spec.CIELuv.L_star; + bestustar = pColor->spec.CIELuv.u_star; + bestvstar = pColor->spec.CIELuv.v_star; + bestChroma = chroma; + } + if (nI == nILast || nI == 0) { + break; + } + } + if (bestChroma >= maxChroma) { + pColor->spec.CIELuv.L_star = maxLstar; + pColor->spec.CIELuv.u_star = Luv_max.spec.CIELuv.u_star; + pColor->spec.CIELuv.v_star = Luv_max.spec.CIELuv.v_star; + } else { + pColor->spec.CIELuv.L_star = bestLstar; + pColor->spec.CIELuv.u_star = bestustar; + pColor->spec.CIELuv.v_star = bestvstar; + } + retval = _XcmsDIConvertColors(&myCCC, pColor, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIEXYZFormat); + + if (retval != XcmsFailure && pCompressed != NULL) { + *(pCompressed + i) = True; + } + } + return(retval); +} diff --git a/nx-X11/lib/src/xcms/LuvMnL.c b/nx-X11/lib/src/xcms/LuvMnL.c new file mode 100644 index 000000000..b873fa652 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvMnL.c @@ -0,0 +1,216 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELuvMnL.c + * + * DESCRIPTION + * Source for the XcmsCIELuvQueryMinL() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS (XcmsFloat)0.001 +#define START_L_STAR (XcmsFloat)40.0 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvQueryMinL - Compute max Lstar for a hue and chroma + * + * SYNOPSIS + */ +Status +XcmsCIELuvQueryMinL( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue angle in degrees */ + XcmsFloat chroma, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum Lstar for a specified hue_angle and chroma. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded with no modifications + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor max_lc, tmp, prev; + XcmsFloat max_chroma, tmp_chroma; + XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; + XcmsFloat rFactor; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* setup the CCC to use for the conversions. */ + memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc) NULL; + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + hue = radians(hue_angle); + tmp.spec.CIELuv.L_star = START_L_STAR; + tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, chroma); + tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma); + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsCIELuvFormat; + + /* Step 1: Obtain the maximum L_star and chroma for this hue. */ + if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + max_chroma = XCMS_CIELUV_PMETRIC_CHROMA(max_lc.spec.CIELuv.u_star, + max_lc.spec.CIELuv.v_star); + + if (max_chroma <= chroma) { + /* + * If the chroma is greater than the chroma for the + * maximum L/chroma point then the L_star is the + * the L_star for the maximum L_star/chroma point. + * This is an error but I return the best approximation I can. + * Thus the inconsistency. + */ + memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + return(XcmsSuccess); + } + + /* + * If the chroma is equal to the chroma for the + * maximum L_star/chroma point then the L_star is the + * the L_star for the maximum L* and chroma point. + */ + /* if (max_chroma == chroma) { + * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + * return(XcmsSuccess); + * } + */ + + /* must do a bisection here to compute the maximum L* */ + /* save the structure input so that any elements that */ + /* are not touched are recopied later in the routine. */ + nChroma = chroma; + tmp_chroma = max_chroma; + lastChroma = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prevChroma = lastChroma; + lastChroma = tmp_chroma; + nT = (nChroma - max_chroma) / max_chroma * rFactor; + memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); + tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); + tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); + tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to CIELuv */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Now check the return against what is expected */ + tmp_chroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, + tmp.spec.CIELuv.v_star); + if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { + /* Found It! */ + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } + nChroma += chroma - tmp_chroma; + if (nChroma > max_chroma) { + nChroma = max_chroma; + rFactor *= 0.5; /* selective relaxation employed */ + } else if (nChroma < 0.0) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + return(XcmsSuccess); + } else if (tmp_chroma <= prevChroma + EPS && + tmp_chroma >= prevChroma - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + } + } + + if (nCount >= nMaxCount) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + } + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LuvMxC.c b/nx-X11/lib/src/xcms/LuvMxC.c new file mode 100644 index 000000000..a67251477 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvMxC.c @@ -0,0 +1,204 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * CIELuvMxC.c + * + * DESCRIPTION + * Source for the XcmsCIELuvQueryMaxC() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS (XcmsFloat)0.001 +#define START_CHROMA (XcmsFloat)2.2 +#define TOPL (XcmsFloat)100.0 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvQueryMaxC - max chroma for a hue_angle and L_star + * + * SYNOPSIS + */ +Status +XcmsCIELuvQueryMaxC( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue angle in degrees */ + XcmsFloat L_star, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum chroma for a specific hue_angle and L_star. + * The returned format is in XcmsCIELuvFormat. + * + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor tmp; + XcmsColor max_lc; + XcmsFloat n_L_star, last_L_star, prev_L_star; + XcmsFloat hue, lastuStar, lastvStar, /*lastChroma,*/ maxDist, nT, rFactor; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* Use my own CCC and inherit screen white Pt */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc)NULL;/* no gamut comp func */ + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + hue = radians(hue_angle); + tmp.spec.CIELuv.L_star = L_star; + tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, START_CHROMA); + tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, START_CHROMA); + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsCIELuvFormat; + + /* Step 1: compute the maximum L_star and chroma for this hue. */ + memcpy((char *)&max_lc, (char *)&tmp, sizeof(XcmsColor)); + if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Step 2: Do a bisection here to compute the maximum chroma + * Note the differences between when the point to be found + * is above the maximum LC point and when it is below. + */ + if (L_star <= max_lc.spec.CIELuv.L_star) { + maxDist = max_lc.spec.CIELuv.L_star; + } else { + maxDist = TOPL - max_lc.spec.CIELuv.L_star; + } + + n_L_star = L_star; + last_L_star = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prev_L_star = last_L_star; + last_L_star = tmp.spec.CIELuv.L_star; +/* lastChroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, */ +/* tmp.spec.CIELuv.v_star); */ + lastuStar = tmp.spec.CIELuv.u_star; + lastvStar = tmp.spec.CIELuv.v_star; + nT = (n_L_star - max_lc.spec.CIELuv.L_star) / maxDist * rFactor; + /* printf("(n_L_star, nT) = %lf %lf ", n_L_star, nT); */ + if (nT > 0) { + tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + } else { + tmp.spec.RGBi.red = rgb_saved.red + (rgb_saved.red * nT); + tmp.spec.RGBi.green = rgb_saved.green + (rgb_saved.green * nT); + tmp.spec.RGBi.blue = rgb_saved.blue + (rgb_saved.blue * nT); + } + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to CIELuv */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Now check if we've reached the target L_star + */ + /* printf("result Lstar = %lf\n", tmp.spec.CIELuv.L_star); */ + if (tmp.spec.CIELuv.L_star <= L_star + EPS && + tmp.spec.CIELuv.L_star >= L_star - EPS) { + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); + } + if (nT > 0) { + n_L_star += ((TOPL - n_L_star) * + (L_star - tmp.spec.CIELuv.L_star)) / (TOPL - L_star); + } else { + n_L_star *= L_star / tmp.spec.CIELuv.L_star; + } + if (tmp.spec.CIELuv.L_star <= prev_L_star + EPS && + tmp.spec.CIELuv.L_star >= prev_L_star - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + /* printf("rFactor = %lf\n", rFactor); */ + } + } + if (XCMS_FABS(last_L_star - L_star) < + XCMS_FABS(tmp.spec.CIELuv.L_star - L_star)) { + tmp.spec.CIELuv.u_star = lastuStar; + tmp.spec.CIELuv.v_star = lastvStar; +/* tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, lastChroma); */ +/* tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, lastChroma); */ + } + tmp.spec.CIELuv.L_star = L_star; + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LuvMxL.c b/nx-X11/lib/src/xcms/LuvMxL.c new file mode 100644 index 000000000..d1d495b08 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvMxL.c @@ -0,0 +1,216 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIELuvMxL.c + * + * DESCRIPTION + * Source for the XcmsCIELuvQueryMaxL() gamut boundary + * querying routine. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include "Cv.h" + +/* + * DEFINES + */ +#define MAXBISECTCOUNT 100 +#define EPS (XcmsFloat)0.001 +#define START_L_STAR (XcmsFloat)40.0 + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvQueryMaxL - Compute max Lstar for a hue and chroma + * + * SYNOPSIS + */ +Status +XcmsCIELuvQueryMaxL( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue angle in degrees */ + XcmsFloat chroma, + XcmsColor *pColor_return) +/* + * DESCRIPTION + * Return the maximum Lstar for a specified hue_angle and chroma. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded with no modifications + * + */ +{ + XcmsCCCRec myCCC; + XcmsColor max_lc, tmp, prev; + XcmsFloat max_chroma, tmp_chroma; + XcmsFloat hue, nT, nChroma, lastChroma, prevChroma; + XcmsFloat rFactor; + XcmsRGBi rgb_saved; + int nCount, nMaxCount; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* setup the CCC to use for the conversions. */ + memcpy ((char *) &myCCC, (char *) ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc) NULL; + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + hue = radians(hue_angle); + tmp.spec.CIELuv.L_star = START_L_STAR; + tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, chroma); + tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, chroma); + tmp.pixel = pColor_return->pixel; + tmp.format = XcmsCIELuvFormat; + + /* Step 1: Obtain the maximum L_star and chroma for this hue. */ + if (_XcmsCIELuvQueryMaxLCRGB(&myCCC, hue, &max_lc, &rgb_saved) + == XcmsFailure) { + return(XcmsFailure); + } + + max_chroma = XCMS_CIELUV_PMETRIC_CHROMA(max_lc.spec.CIELuv.u_star, + max_lc.spec.CIELuv.v_star); + + if (max_chroma <= chroma) { + /* + * If the chroma is greater than the chroma for the + * maximum L/chroma point then the L_star is the + * the L_star for the maximum L_star/chroma point. + * This is an error but I return the best approximation I can. + * Thus the inconsistency. + */ + memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + return(XcmsSuccess); + } + + /* + * If the chroma is equal to the chroma for the + * maximum L_star/chroma point then the L_star is the + * the L_star for the maximum L* and chroma point. + */ + /* if (max_chroma == chroma) { + * memcpy ((char *) pColor_return, (char *) &max_lc, sizeof (XcmsColor)); + * return(XcmsSuccess); + * } + */ + + /* must do a bisection here to compute the maximum L* */ + /* save the structure input so that any elements that */ + /* are not touched are recopied later in the routine. */ + nChroma = chroma; + tmp_chroma = max_chroma; + lastChroma = -1.0; + nMaxCount = MAXBISECTCOUNT; + rFactor = 1.0; + + for (nCount = 0; nCount < nMaxCount; nCount++) { + prevChroma = lastChroma; + lastChroma = tmp_chroma; + nT = (1.0 - (nChroma / max_chroma)) * rFactor; + memcpy ((char *)&prev, (char *)&tmp, sizeof(XcmsColor)); + tmp.spec.RGBi.red = rgb_saved.red * (1.0 - nT) + nT; + tmp.spec.RGBi.green = rgb_saved.green * (1.0 - nT) + nT; + tmp.spec.RGBi.blue = rgb_saved.blue * (1.0 - nT) + nT; + tmp.format = XcmsRGBiFormat; + + /* convert from RGB to CIELuv */ + if (_XcmsConvertColorsWithWhitePt(&myCCC, &tmp, + ScreenWhitePointOfCCC(&myCCC), 1, XcmsCIELuvFormat, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + + /* Now check the return against what is expected */ + tmp_chroma = XCMS_CIELUV_PMETRIC_CHROMA(tmp.spec.CIELuv.u_star, + tmp.spec.CIELuv.v_star); + if (tmp_chroma <= chroma + EPS && tmp_chroma >= chroma - EPS) { + /* Found It! */ + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); + } + nChroma += chroma - tmp_chroma; + if (nChroma > max_chroma) { + nChroma = max_chroma; + rFactor *= 0.5; /* selective relaxation employed */ + } else if (nChroma < 0.0) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + return(XcmsSuccess); + } else if (tmp_chroma <= prevChroma + EPS && + tmp_chroma >= prevChroma - EPS) { + rFactor *= 0.5; /* selective relaxation employed */ + } + } + + if (nCount >= nMaxCount) { + if (XCMS_FABS(lastChroma - chroma) < + XCMS_FABS(tmp_chroma - chroma)) { + memcpy ((char *)pColor_return, (char *)&prev, + sizeof(XcmsColor)); + } else { + memcpy ((char *)pColor_return, (char *)&tmp, + sizeof(XcmsColor)); + } + } + memcpy ((char *) pColor_return, (char *) &tmp, sizeof (XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/LuvMxLC.c b/nx-X11/lib/src/xcms/LuvMxLC.c new file mode 100644 index 000000000..60b954916 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvMxLC.c @@ -0,0 +1,218 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * CIELuvMxVC.c + * + * DESCRIPTION + * Source for the XcmsCIELuvQueryMaxLC() gamut boundary + * querying routine. + * + * DOCUMENTATION + * "TekColor Color Management System, System Implementor's Manual" + * and + * Fred W. Billmeyer & Max Saltzman, "Principles of Color + * Technology", John Wily & Sons, Inc, 1981. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + */ +#define MIN(x,y) ((x) > (y) ? (y) : (x)) +#define MIN3(x,y,z) ((x) > (MIN((y), (z))) ? (MIN((y), (z))) : (x)) +#define MAX(x,y) ((x) > (y) ? (x) : (y)) +#define MAX3(x,y,z) ((x) > (MAX((y), (z))) ? (x) : (MAX((y), (z)))) +#define START_LSTAR (XcmsFloat)40.0 +#define START_CHROMA (XcmsFloat)2.2 + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsCIELuvQueryMaxLCRGB - Compute maximum L* and chroma. + * + * SYNOPSIS + */ +Status +_XcmsCIELuvQueryMaxLCRGB( + XcmsCCC ccc, + XcmsFloat hue, /* hue in radians */ + XcmsColor *pColor_return, + XcmsRGBi *pRGB_return) +/* + * DESCRIPTION + * Return the maximum psychometric chroma for a specified + * hue angle(radians), and the corresponding L*. This is computed + * by a binary search of all possible chromas. An assumption + * is made that there are no local maxima. Use the unrounded + * Max psychometric chroma because the difference check can be + * small. + * + * NOTE: No local CCC is used because this is a private + * routine and all routines that call it are expected + * to behave properly, i.e. send a local CCC with + * no white adjust function and no gamut compression + * function. + * + * This routine only accepts hue as input and outputs + * Luv and RGBi. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsFloat nSmall, nLarge; + XcmsColor tmp; + + tmp.format = XcmsCIELuvFormat; + /* Use some unreachable color on the given hue angle */ + tmp.spec.CIELuv.L_star = START_LSTAR; + tmp.spec.CIELuv.u_star = XCMS_CIEUSTAROFHUE(hue, START_CHROMA); + tmp.spec.CIELuv.v_star = XCMS_CIEVSTAROFHUE(hue, START_CHROMA); + /* + * Convert from Luv to RGB + * + * Note that the CIEXYZ to RGBi conversion routine must stuff the + * out of bounds RGBi values in tmp when the ccc->gamutCompProc + * is NULL. + */ + if ((_XcmsConvertColorsWithWhitePt(ccc, &tmp, ScreenWhitePointOfCCC(ccc), + (unsigned int)1, XcmsRGBiFormat, (Bool *) NULL) + == XcmsFailure) && tmp.format != XcmsRGBiFormat) { + return (XcmsFailure); + } + + /* Now pick the smallest RGB */ + nSmall = MIN3(tmp.spec.RGBi.red, + tmp.spec.RGBi.green, + tmp.spec.RGBi.blue); + /* Make the smallest RGB equal to zero */ + tmp.spec.RGBi.red -= nSmall; + tmp.spec.RGBi.green -= nSmall; + tmp.spec.RGBi.blue -= nSmall; + + /* Now pick the largest RGB */ + nLarge = MAX3(tmp.spec.RGBi.red, + tmp.spec.RGBi.green, + tmp.spec.RGBi.blue); + /* Scale the RGB values based on the largest one */ + tmp.spec.RGBi.red /= nLarge; + tmp.spec.RGBi.green /= nLarge; + tmp.spec.RGBi.blue /= nLarge; + tmp.format = XcmsRGBiFormat; + + /* If the calling routine wants RGB value give them the ones used. */ + if (pRGB_return) { + pRGB_return->red = tmp.spec.RGBi.red; + pRGB_return->green = tmp.spec.RGBi.green; + pRGB_return->blue = tmp.spec.RGBi.blue; + } + + /* Convert from RGBi to Luv */ + if (_XcmsConvertColorsWithWhitePt(ccc, &tmp, + ScreenWhitePointOfCCC(ccc), 1, XcmsCIELuvFormat, (Bool *) NULL) + == XcmsFailure) { + return (XcmsFailure); + } + + memcpy((char *)pColor_return, (char *)&tmp, sizeof(XcmsColor)); + return (XcmsSuccess); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvQueryMaxLC - Compute maximum L* and chroma. + * + * SYNOPSIS + */ +Status +XcmsCIELuvQueryMaxLC ( + XcmsCCC ccc, + XcmsFloat hue_angle, /* hue angle in degrees */ + XcmsColor *pColor_return) + +/* + * DESCRIPTION + * Return the point of maximum chroma for the specified + * hue angle. + * + * ASSUMPTIONS + * This routine assumes that the white point associated with + * the color specification is the Screen White Point. The + * Screen White Point will also be associated with the + * returned color specification. + * + * RETURNS + * XcmsFailure - Failure + * XcmsSuccess - Succeeded + * + */ +{ + XcmsCCCRec myCCC; + + /* + * Check Arguments + */ + if (ccc == NULL || pColor_return == NULL) { + return(XcmsFailure); + } + + /* Use my own CCC */ + memcpy ((char *)&myCCC, (char *)ccc, sizeof(XcmsCCCRec)); + myCCC.clientWhitePt.format = XcmsUndefinedFormat; + myCCC.gamutCompProc = (XcmsCompressionProc)NULL; + + while (hue_angle < 0.0) { + hue_angle += 360.0; + } + while (hue_angle >= 360.0) { + hue_angle -= 360.0; + } + + return(_XcmsCIELuvQueryMaxLCRGB (&myCCC, radians(hue_angle), pColor_return, + (XcmsRGBi *)NULL)); +} diff --git a/nx-X11/lib/src/xcms/LuvWpAj.c b/nx-X11/lib/src/xcms/LuvWpAj.c new file mode 100644 index 000000000..aa2a3f462 --- /dev/null +++ b/nx-X11/lib/src/xcms/LuvWpAj.c @@ -0,0 +1,96 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * CIELuvWpAj.c + * + * DESCRIPTION + * This file contains routine(s) that support white point + * adjustment of color specifications in the CIE CIELuv.color + * space. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELuvWhiteShiftColors + * + * SYNOPSIS + */ +Status +XcmsCIELuvWhiteShiftColors( + XcmsCCC ccc, + XcmsColor *pWhitePtFrom, + XcmsColor *pWhitePtTo, + XcmsColorFormat destSpecFmt, + XcmsColor *pColors_in_out, + unsigned int nColors, + Bool *pCompressed) +/* + * DESCRIPTION + * Adjusts color specifications in an array of XcmsColor + * structures for white point differences. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded without gamut compression, + * XcmsSuccessWithCompression if succeeded with + * gamut compression. + */ +{ + if (pWhitePtFrom == NULL || pWhitePtTo == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Convert to CIELuv using pWhitePtFrom + * We can ignore return value for compression because we are converting + * to XcmsCIELuvFormat which is device-independent, not device-dependent. + */ + if (_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtFrom, + nColors, XcmsCIELuvFormat, pCompressed) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Convert from CIELuv to destSpecFmt using pWhitePtTo + */ + return(_XcmsConvertColorsWithWhitePt(ccc, pColors_in_out, pWhitePtTo, + nColors, destSpecFmt, pCompressed)); +} diff --git a/nx-X11/lib/src/xcms/Makefile.am b/nx-X11/lib/src/xcms/Makefile.am new file mode 100644 index 000000000..ba7ab2403 --- /dev/null +++ b/nx-X11/lib/src/xcms/Makefile.am @@ -0,0 +1,92 @@ +NULL = + +noinst_LTLIBRARIES = libxcms.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + -DXCMSDIR=\"$(X11dir)\" \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(XMALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) + +libxcms_la_SOURCES = \ + AddDIC.c \ + AddSF.c \ + CCC.c \ + CvColW.c \ + CvCols.c \ + HVC.c \ + HVCGcC.c \ + HVCGcV.c \ + HVCGcVC.c \ + HVCMnV.c \ + HVCMxC.c \ + HVCMxV.c \ + HVCMxVC.c \ + HVCMxVs.c \ + HVCWpAj.c \ + IdOfPr.c \ + LRGB.c \ + Lab.c \ + LabGcC.c \ + LabGcL.c \ + LabGcLC.c \ + LabMnL.c \ + LabMxC.c \ + LabMxL.c \ + LabMxLC.c \ + LabWpAj.c \ + Luv.c \ + LuvGcC.c \ + LuvGcL.c \ + LuvGcLC.c \ + LuvMnL.c \ + LuvMxC.c \ + LuvMxL.c \ + LuvMxLC.c \ + LuvWpAj.c \ + OfCCC.c \ + PrOfId.c \ + QBlack.c \ + QBlue.c \ + QGreen.c \ + QRed.c \ + QWhite.c \ + QuCol.c \ + QuCols.c \ + SetCCC.c \ + SetGetCols.c \ + StCol.c \ + StCols.c \ + UNDEFINED.c \ + XRGB.c \ + XYZ.c \ + cmsAllCol.c \ + cmsAllNCol.c \ + cmsCmap.c \ + cmsColNm.c \ + cmsGlobls.c \ + cmsInt.c \ + cmsLkCol.c \ + cmsMath.c \ + cmsProp.c \ + cmsTrig.c \ + uvY.c \ + xyY.c \ + $(NULL) + +X11dir = $(X11_DATADIR) +dist_X11_DATA = Xcms.txt diff --git a/nx-X11/lib/src/xcms/OfCCC.c b/nx-X11/lib/src/xcms/OfCCC.c new file mode 100644 index 000000000..06fc3d7a1 --- /dev/null +++ b/nx-X11/lib/src/xcms/OfCCC.c @@ -0,0 +1,162 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsOfCCC.c - Color Conversion Context Querying Routines + * + * DESCRIPTION + * Routines to query components of a Color Conversion + * Context structure. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlib.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsDisplayOfCCC + * + * SYNOPSIS + */ + +Display * +XcmsDisplayOfCCC( + XcmsCCC ccc) +/* + * DESCRIPTION + * Queries the Display of the specified CCC. + * + * RETURNS + * Pointer to the Display. + * + */ +{ + return(ccc->dpy); +} + + +/* + * NAME + * XcmsVisualOfCCC + * + * SYNOPSIS + */ + +Visual * +XcmsVisualOfCCC( + XcmsCCC ccc) +/* + * DESCRIPTION + * Queries the Visual of the specified CCC. + * + * RETURNS + * Pointer to the Visual. + * + */ +{ + return(ccc->visual); +} + + +/* + * NAME + * XcmsScreenNumberOfCCC + * + * SYNOPSIS + */ + +int +XcmsScreenNumberOfCCC( + XcmsCCC ccc) +/* + * DESCRIPTION + * Queries the screen number of the specified CCC. + * + * RETURNS + * screen number. + * + */ +{ + return(ccc->screenNumber); +} + + +/* + * NAME + * XcmsScreenWhitePointOfCCC + * + * SYNOPSIS + */ + +XcmsColor * +XcmsScreenWhitePointOfCCC( + XcmsCCC ccc) +/* + * DESCRIPTION + * Queries the screen white point of the specified CCC. + * + * RETURNS + * Pointer to the XcmsColor containing the screen white point. + * + */ +{ + return(&ccc->pPerScrnInfo->screenWhitePt); +} + + +/* + * NAME + * XcmsClientWhitePointOfCCC + * + * SYNOPSIS + */ + +XcmsColor * +XcmsClientWhitePointOfCCC( + XcmsCCC ccc) +/* + * DESCRIPTION + * Queries the client white point of the specified CCC. + * + * RETURNS + * Pointer to the XcmsColor containing the client white point. + * + */ +{ + return(&ccc->clientWhitePt); +} diff --git a/nx-X11/lib/src/xcms/PrOfId.c b/nx-X11/lib/src/xcms/PrOfId.c new file mode 100644 index 000000000..a96d28cec --- /dev/null +++ b/nx-X11/lib/src/xcms/PrOfId.c @@ -0,0 +1,97 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsPrOfId.c + * + * DESCRIPTION + * Source for XcmsPrefixOfFormat() + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/* + * NAME + * XcmsPrefixOfId + * + * SYNOPSIS + */ +char * +XcmsPrefixOfFormat( + XcmsColorFormat id) +/* + * DESCRIPTION + * Returns the color space prefix for the specified color + * space ID if the color space is found in the Color + * Conversion Context. + * + * RETURNS + * Returns a color space prefix. + * + * CAVEATS + * Space is allocated for the returned string, therefore, + * the application is responsible for freeing (using XFree) + * the space. + * + */ +{ + XcmsColorSpace **papColorSpaces; + + /* + * First try Device-Independent color spaces + */ + papColorSpaces = _XcmsDIColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if ((*papColorSpaces)->id == id) { + return strdup((*papColorSpaces)->prefix); + } + papColorSpaces++; + } + } + + /* + * Next try Device-Dependent color spaces + */ + papColorSpaces = _XcmsDDColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if ((*papColorSpaces)->id == id) { + return strdup((*papColorSpaces)->prefix); + } + papColorSpaces++; + } + } + + return(NULL); +} diff --git a/nx-X11/lib/src/xcms/QBlack.c b/nx-X11/lib/src/xcms/QBlack.c new file mode 100644 index 000000000..d7a69d399 --- /dev/null +++ b/nx-X11/lib/src/xcms/QBlack.c @@ -0,0 +1,84 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQBlack.c - Query Black + * + * DESCRIPTION + * Routine to obtain a color specification for zero + * red, green, and blue intensities. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsQueryBlack + * + * SYNOPSIS + */ + +Status +XcmsQueryBlack( + XcmsCCC ccc, + XcmsColorFormat target_format, + XcmsColor *pColor_ret) +/* + * DESCRIPTION + * Returns the color specification in the target format for + * zero intensity red, green, and blue. + * + * RETURNS + * Returns XcmsSuccess, if failed; otherwise XcmsFailure + * + */ +{ + XcmsColor tmp; + + tmp.format = XcmsRGBiFormat; + tmp.pixel = 0; + tmp.spec.RGBi.red = 0.0; + tmp.spec.RGBi.green = 0.0; + tmp.spec.RGBi.blue = 0.0; + if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { + return(XcmsFailure); + } + memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/QBlue.c b/nx-X11/lib/src/xcms/QBlue.c new file mode 100644 index 000000000..4555344e6 --- /dev/null +++ b/nx-X11/lib/src/xcms/QBlue.c @@ -0,0 +1,84 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQBlue.c - Query Blue + * + * DESCRIPTION + * Routine to obtain a color specification for full + * blue intensity and zero red and green intensities. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsQueryBlue + * + * SYNOPSIS + */ + +Status +XcmsQueryBlue( + XcmsCCC ccc, + XcmsColorFormat target_format, + XcmsColor *pColor_ret) +/* + * DESCRIPTION + * Returns the color specification in the target format for + * full intensity blue and zero intensity red and green. + * + * RETURNS + * Returns XcmsSuccess, if failed; otherwise XcmsFailure + * + */ +{ + XcmsColor tmp; + + tmp.format = XcmsRGBiFormat; + tmp.pixel = 0; + tmp.spec.RGBi.red = 0.0; + tmp.spec.RGBi.green = 0.0; + tmp.spec.RGBi.blue = 1.0; + if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { + return(XcmsFailure); + } + memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/QGreen.c b/nx-X11/lib/src/xcms/QGreen.c new file mode 100644 index 000000000..0c888358a --- /dev/null +++ b/nx-X11/lib/src/xcms/QGreen.c @@ -0,0 +1,84 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQGreen.c - Query Green + * + * DESCRIPTION + * Routine to obtain a color specification for full + * green intensity and zero red and blue intensities. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsQueryGreen + * + * SYNOPSIS + */ + +Status +XcmsQueryGreen( + XcmsCCC ccc, + XcmsColorFormat target_format, + XcmsColor *pColor_ret) +/* + * DESCRIPTION + * Returns the color specification in the target format for + * full intensity green and zero intensity red and blue. + * + * RETURNS + * Returns XcmsSuccess, if failed; otherwise XcmsFailure + * + */ +{ + XcmsColor tmp; + + tmp.format = XcmsRGBiFormat; + tmp.pixel = 0; + tmp.spec.RGBi.red = 0.0; + tmp.spec.RGBi.green = 1.0; + tmp.spec.RGBi.blue = 0.0; + if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { + return(XcmsFailure); + } + memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/QRed.c b/nx-X11/lib/src/xcms/QRed.c new file mode 100644 index 000000000..357380d60 --- /dev/null +++ b/nx-X11/lib/src/xcms/QRed.c @@ -0,0 +1,84 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQRed.c - Query Red + * + * DESCRIPTION + * Routine to obtain a color specification for full + * red intensity and zero green and blue intensities. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsQueryRed + * + * SYNOPSIS + */ + +Status +XcmsQueryRed( + XcmsCCC ccc, + XcmsColorFormat target_format, + XcmsColor *pColor_ret) +/* + * DESCRIPTION + * Returns the color specification in the target format for + * full intensity red and zero intensity green and blue. + * + * RETURNS + * Returns XcmsSuccess, if failed; otherwise XcmsFailure + * + */ +{ + XcmsColor tmp; + + tmp.format = XcmsRGBiFormat; + tmp.pixel = 0; + tmp.spec.RGBi.red = 1.0; + tmp.spec.RGBi.green = 0.0; + tmp.spec.RGBi.blue = 0.0; + if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { + return(XcmsFailure); + } + memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/QWhite.c b/nx-X11/lib/src/xcms/QWhite.c new file mode 100644 index 000000000..36b764c9d --- /dev/null +++ b/nx-X11/lib/src/xcms/QWhite.c @@ -0,0 +1,84 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQWhite.c - Query White + * + * DESCRIPTION + * Routine to obtain a color specification for full + * red, green, and blue intensities. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsQueryWhite + * + * SYNOPSIS + */ + +Status +XcmsQueryWhite( + XcmsCCC ccc, + XcmsColorFormat target_format, + XcmsColor *pColor_ret) +/* + * DESCRIPTION + * Returns the color specification in the target format for + * full intensity red, green, and blue. + * + * RETURNS + * Returns XcmsSuccess, if failed; otherwise XcmsFailure + * + */ +{ + XcmsColor tmp; + + tmp.format = XcmsRGBiFormat; + tmp.pixel = 0; + tmp.spec.RGBi.red = 1.0; + tmp.spec.RGBi.green = 1.0; + tmp.spec.RGBi.blue = 1.0; + if (XcmsConvertColors(ccc, &tmp, 1, target_format, NULL) != XcmsSuccess) { + return(XcmsFailure); + } + memcpy((char *)pColor_ret, (char *)&tmp, sizeof(XcmsColor)); + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/QuCol.c b/nx-X11/lib/src/xcms/QuCol.c new file mode 100644 index 000000000..b4c1cd33a --- /dev/null +++ b/nx-X11/lib/src/xcms/QuCol.c @@ -0,0 +1,78 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQuCol.c + * + * DESCRIPTION + * Source for XcmsQueryColors + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsQueryColor - Query Color + * + * SYNOPSIS + */ +Status +XcmsQueryColor( + Display *dpy, + Colormap colormap, + XcmsColor *pXcmsColor_in_out, + XcmsColorFormat result_format) +/* + * DESCRIPTION + * This routine uses XQueryColor to obtain the X RGB values + * stored in the specified colormap for the specified pixel. + * The X RGB values are then converted to the target format as + * specified by the format component of the XcmsColor structure. + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded. + * + * Returns a color specification of the color stored in the + * specified pixel. + */ +{ + return(_XcmsSetGetColor(XQueryColor, dpy, colormap, + pXcmsColor_in_out, result_format, (Bool *) NULL)); +} diff --git a/nx-X11/lib/src/xcms/QuCols.c b/nx-X11/lib/src/xcms/QuCols.c new file mode 100644 index 000000000..25a38b818 --- /dev/null +++ b/nx-X11/lib/src/xcms/QuCols.c @@ -0,0 +1,78 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsQuCol.c + * + * DESCRIPTION + * Source for XcmsQueryColors + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ +/* + * NAME + * XcmsQueryColors - Query Colors + * + * SYNOPSIS + */ +Status +XcmsQueryColors( + Display *dpy, + Colormap colormap, + XcmsColor *pXcmsColors_in_out, + unsigned int nColors, + XcmsColorFormat result_format) +/* + * DESCRIPTION + * This routine uses XQueryColors to obtain the X RGB values + * stored in the specified colormap for the specified pixels. + * The X RGB values are then converted to the target format as + * specified by the format component of the XcmsColor structure. + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded. + * + * Returns the color specifications of the colors stored in the + * specified pixels. + */ +{ + return(_XcmsSetGetColors(XQueryColors, dpy, colormap, + pXcmsColors_in_out, nColors, result_format, (Bool *) NULL)); +} diff --git a/nx-X11/lib/src/xcms/SetCCC.c b/nx-X11/lib/src/xcms/SetCCC.c new file mode 100644 index 000000000..e8171b4ea --- /dev/null +++ b/nx-X11/lib/src/xcms/SetCCC.c @@ -0,0 +1,138 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsSetCCC.c - Color Conversion Context Setting Routines + * + * DESCRIPTION + * Routines to set components of a Color Conversion + * Context structure. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcms.h" + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsSetWhitePoint + * + * SYNOPSIS + */ + +Status +XcmsSetWhitePoint( + XcmsCCC ccc, + XcmsColor *pColor) +/* + * DESCRIPTION + * Sets the Client White Point in the specified CCC. + * + * RETURNS + * Returns XcmsSuccess if succeeded; otherwise XcmsFailure. + * + */ +{ + if (pColor == NULL || pColor->format == XcmsUndefinedFormat) { + ccc->clientWhitePt.format = XcmsUndefinedFormat; + } else if (pColor->format != XcmsCIEXYZFormat && + pColor->format != XcmsCIEuvYFormat && + pColor->format != XcmsCIExyYFormat) { + return(XcmsFailure); + } else { + memcpy((char *)&ccc->clientWhitePt, (char *)pColor, sizeof(XcmsColor)); + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsSetCompressionProc + * + * SYNOPSIS + */ + +XcmsCompressionProc +XcmsSetCompressionProc( + XcmsCCC ccc, + XcmsCompressionProc compression_proc, + XPointer client_data) +/* + * DESCRIPTION + * Set the specified CCC's compression function and client data. + * + * RETURNS + * Returns the old compression function. + * + */ +{ + XcmsCompressionProc old = ccc->gamutCompProc; + + ccc->gamutCompProc = compression_proc; + ccc->gamutCompClientData = client_data; + return(old); +} + + +/* + * NAME + * XcmsSetWhiteAdjustProc + * + * SYNOPSIS + */ + +XcmsWhiteAdjustProc +XcmsSetWhiteAdjustProc( + XcmsCCC ccc, + XcmsWhiteAdjustProc white_adjust_proc, + XPointer client_data ) +/* + * DESCRIPTION + * Set the specified CCC's white_adjust function and client data. + * + * RETURNS + * Returns the old white_adjust function. + * + */ +{ + XcmsWhiteAdjustProc old = ccc->whitePtAdjProc; + + ccc->whitePtAdjProc = white_adjust_proc; + ccc->whitePtAdjClientData = client_data; + return(old); +} diff --git a/nx-X11/lib/src/xcms/SetGetCols.c b/nx-X11/lib/src/xcms/SetGetCols.c new file mode 100644 index 000000000..83fa4c200 --- /dev/null +++ b/nx-X11/lib/src/xcms/SetGetCols.c @@ -0,0 +1,301 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsSetGet.c + * + * DESCRIPTION + * Source for _XcmsSetGetColors() + * + * + */ + +/* + * EXTERNAL INCLUDES + * Include files that must be exported to any package or + * program using this package. + */ +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsSetColor - + * + * SYNOPSIS + */ +Status +_XcmsSetGetColor( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + XcmsColorFormat result_format, + Bool *pCompressed) +/* + * DESCRIPTION + * Routine containing code common to: + * XcmsAllocColor + * XcmsQueryColor + * XcmsStoreColor + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded without gamut compression; + * XcmsSuccessWithCompression if it succeeded with gamut + * compression; + */ +{ + XcmsCCC ccc; + XColor XColors_in_out; + Status retval = XcmsSuccess; + + /* + * Argument Checking + * 1. Assume xColorProc is correct + * 2. Insure ccc not NULL + * 3. Assume cmap correct (should be checked by Server) + * 4. Insure pColors_in_out valid + * 5. Assume method_in is valid (should be checked by Server) + */ + + if (dpy == NULL) { + return(XcmsFailure); + } + + if (result_format == XcmsUndefinedFormat) { + return(XcmsFailure); + } + + if ( !((*xColorProc == XAllocColor) || (*xColorProc == XStoreColor) + || (*xColorProc == XQueryColor)) ) { + return(XcmsFailure); + } + + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { + return(XcmsFailure); + } + + if (*xColorProc == XQueryColor) { + goto Query; + } + + /* + * Convert to RGB, adjusting for white point differences if necessary. + */ + if ((retval = XcmsConvertColors(ccc, pColors_in_out, 1, XcmsRGBFormat, + pCompressed)) == XcmsFailure) { + return(XcmsFailure); + } + +Query: + /* + * Convert XcmsColor to XColor structures + */ + _XcmsRGB_to_XColor(pColors_in_out, &XColors_in_out, 1); + + /* + * Now make appropriate X Call + */ + if (*xColorProc == XAllocColor) { + if ((*xColorProc)(ccc->dpy, cmap, &XColors_in_out) == 0) { + return(XcmsFailure); + } + } else if ((*xColorProc == XQueryColor) || (*xColorProc == XStoreColor)) { + /* Note: XQueryColor and XStoreColor do not return any Status */ + (*xColorProc)(ccc->dpy, cmap, &XColors_in_out); + } else { + return(XcmsFailure); + } + + if ((*xColorProc == XStoreColor)) { + return(retval); + } + + /* + * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures + */ + _XColor_to_XcmsRGB(ccc, &XColors_in_out, pColors_in_out, 1); + + /* + * Then, convert XcmsColor structures to the original specification + * format. Note that we must use NULL instead of passing + * pCompressed. + */ + + if (result_format != XcmsRGBFormat) { + if (XcmsConvertColors(ccc, pColors_in_out, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + return(retval); +} + +/* + * NAME + * XcmsSetColors - + * + * SYNOPSIS + */ +Status +_XcmsSetGetColors( + Status (*xColorProc)( + Display* /* display */, + Colormap /* colormap */, + XColor* /* screen_in_out */, + int /* nColors */), + Display *dpy, + Colormap cmap, + XcmsColor *pColors_in_out, + int nColors, + XcmsColorFormat result_format, + Bool *pCompressed) +/* + * DESCRIPTION + * Routine containing code common to: + * XcmsQueryColors + * XcmsStoreColors + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded without gamut compression; + * XcmsSuccessWithCompression if it succeeded with gamut + * compression; + */ +{ + XcmsCCC ccc; + XColor *pXColors_in_out; + Status retval = XcmsSuccess; + + /* + * Argument Checking + * 1. Assume xColorProc is correct + * 2. Insure ccc not NULL + * 3. Assume cmap correct (should be checked by Server) + * 4. Insure pColors_in_out valid + * 5. Assume method_in is valid (should be checked by Server) + * 6. Insure nColors > 0 + */ + + if (dpy == NULL) { + return(XcmsFailure); + } + + if (nColors == 0) { + return(XcmsSuccess); + } + + if (result_format == XcmsUndefinedFormat) { + return(XcmsFailure); + } + + if ( !((*xColorProc == XStoreColors) || (*xColorProc == XQueryColors)) ) { + return(XcmsFailure); + } + + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { + return(XcmsFailure); + } + + /* + * Allocate space for XColors + */ + if ((pXColors_in_out = Xcalloc(nColors, sizeof(XColor))) == + NULL) { + return(XcmsFailure); + } + + if (*xColorProc == XQueryColors) { + goto Query; + } + + /* + * Convert to RGB, adjusting for white point differences if necessary. + */ + if ((retval = XcmsConvertColors(ccc, pColors_in_out, nColors, XcmsRGBFormat, + pCompressed)) == XcmsFailure) { + Xfree(pXColors_in_out); + return(XcmsFailure); + } + +Query: + /* + * Convert XcmsColor to XColor structures + */ + _XcmsRGB_to_XColor(pColors_in_out, pXColors_in_out, nColors); + + /* + * Now make appropriate X Call + */ + if ((*xColorProc == XQueryColors) || (*xColorProc == XStoreColors)){ + /* Note: XQueryColors and XStoreColors do not return any Status */ + (*xColorProc)(ccc->dpy, cmap, pXColors_in_out, nColors); + } else { + Xfree(pXColors_in_out); + return(XcmsFailure); + } + + if (*xColorProc == XStoreColors) { + Xfree(pXColors_in_out); + return(retval); + } + + /* + * Now, convert the returned XColor (i.e., rgb) to XcmsColor structures + */ + _XColor_to_XcmsRGB(ccc, pXColors_in_out, pColors_in_out, nColors); + Xfree(pXColors_in_out); + + /* + * Then, convert XcmsColor structures to the original specification + * format. Note that we must use NULL instead of passing + * pCompressed. + */ + if (result_format != XcmsRGBFormat) { + if (XcmsConvertColors(ccc, pColors_in_out, nColors, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + + return(retval); +} + +/* ### EOF ### */ diff --git a/nx-X11/lib/src/xcms/StCol.c b/nx-X11/lib/src/xcms/StCol.c new file mode 100644 index 000000000..941ad0743 --- /dev/null +++ b/nx-X11/lib/src/xcms/StCol.c @@ -0,0 +1,82 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsStCol.c + * + * DESCRIPTION + * Source for XcmsStoreColor + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsStoreColor - Store Color + * + * SYNOPSIS + */ +Status +XcmsStoreColor( + Display *dpy, + Colormap colormap, + XcmsColor *pColor_in) +/* + * DESCRIPTION + * Given a device-dependent or device-independent color + * specification, this routine will convert it to X RGB + * values then use it in a call to XStoreColor. + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded without gamut compression; + * XcmsSuccessWithCompression if it succeeded with gamut + * compression; + * + * Since XStoreColor has no return value this routine + * does not return the color specification of the color actually + * stored. + */ +{ + XcmsColor tmpColor; + + tmpColor = *pColor_in; + return(_XcmsSetGetColor(XStoreColor, dpy, colormap, + &tmpColor, XcmsRGBFormat, (Bool *) NULL)); +} diff --git a/nx-X11/lib/src/xcms/StCols.c b/nx-X11/lib/src/xcms/StCols.c new file mode 100644 index 000000000..42a29cd7f --- /dev/null +++ b/nx-X11/lib/src/xcms/StCols.c @@ -0,0 +1,112 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsStCols.c + * + * DESCRIPTION + * Source for XcmsStoreColors + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsStoreColors - Store Colors + * + * SYNOPSIS + */ +Status +XcmsStoreColors( + Display *dpy, + Colormap colormap, + XcmsColor *pColors_in, + unsigned int nColors, + Bool *pCompressed) +/* + * DESCRIPTION + * Given device-dependent or device-independent color + * specifications, this routine will convert them to X RGB + * values then use it in a call to XStoreColors. + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded without gamut compression; + * XcmsSuccessWithCompression if it succeeded with gamut + * compression; + * + * Since XStoreColors has no return value, this routine + * does not return color specifications of the colors actually + * stored. + */ +{ + XcmsColor Color1; + XcmsColor *pColors_tmp; + Status retval; + + /* + * Make copy of array of color specifications so we don't + * overwrite the contents. + */ + if (nColors > 1) { + pColors_tmp = Xmalloc(nColors * sizeof(XcmsColor)); + } else { + pColors_tmp = &Color1; + } + memcpy((char *)pColors_tmp, (char *)pColors_in, + nColors * sizeof(XcmsColor)); + + /* + * Call routine to store colors using the copied color structures + */ + retval = _XcmsSetGetColors (XStoreColors, dpy, colormap, + pColors_tmp, nColors, XcmsRGBFormat, pCompressed); + + /* + * Free copies as needed. + */ + if (nColors > 1) { + Xfree(pColors_tmp); + } + + /* + * Ah, finally return. + */ + return(retval); +} diff --git a/nx-X11/lib/src/xcms/UNDEFINED.c b/nx-X11/lib/src/xcms/UNDEFINED.c new file mode 100644 index 000000000..7b1bdb68c --- /dev/null +++ b/nx-X11/lib/src/xcms/UNDEFINED.c @@ -0,0 +1,131 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * UNDEFINED.c + * + * DESCRIPTION + * UNDEFINED Color Space + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" + +/* + * FORWARD DECLARATIONS + */ +static int DummyParseStringProc( + char* /* color_string */, + XcmsColor* /* color_return */ + ); +static Status ReturnZero( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ + ); + + +/* + * LOCALS VARIABLES + */ + +static Status (*(Fl_ReturnZero[]))( + XcmsCCC /* ccc */, + XcmsColor* /* white_point */, + XcmsColor* /* colors */, + unsigned int /* ncolors */ + ) = { + ReturnZero, + NULL +}; + + +/* + * GLOBALS + * Variables declared in this package that are allowed + * to be used globally. + */ + /* + * UNDEFINED Color Space + */ +XcmsColorSpace XcmsUNDEFINEDColorSpace = + { + "undefined", /* prefix */ + XcmsUndefinedFormat, /* id */ + &DummyParseStringProc, /* parseString */ + Fl_ReturnZero, /* to_CIEXYZ */ + Fl_ReturnZero /* from_CIEXYZ */ + }; + + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * ReturnZero + * + * SYNOPSIS + */ +/* ARGSUSED */ +static Status +ReturnZero( + XcmsCCC ccc /* ccc */, + XcmsColor* white /* white_point */, + XcmsColor* colors /* colors */, + unsigned int ncolors /* ncolors */ + ) +/* + * DESCRIPTION + * Does nothing. + * + * RETURNS + * 0 + * + */ +{ + return(0); +} + +static int DummyParseStringProc( + char* color_string /* color_string */, + XcmsColor* color_return /* color_return */ + ) +{ + return(0); +} + +/* ### EOF ### */ diff --git a/nx-X11/lib/src/xcms/XRGB.c b/nx-X11/lib/src/xcms/XRGB.c new file mode 100644 index 000000000..03f980e99 --- /dev/null +++ b/nx-X11/lib/src/xcms/XRGB.c @@ -0,0 +1,242 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsRtoX.c + * + * DESCRIPTION + * Convert color specifications in XcmsRGB format in one array of + * XcmsColor structures to RGB in an array of XColor structures. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * LOCAL VARIABLES + */ + +static unsigned short const MASK[17] = { + 0x0000, /* 0 bitsPerRGB */ + 0x8000, /* 1 bitsPerRGB */ + 0xc000, /* 2 bitsPerRGB */ + 0xe000, /* 3 bitsPerRGB */ + 0xf000, /* 4 bitsPerRGB */ + 0xf800, /* 5 bitsPerRGB */ + 0xfc00, /* 6 bitsPerRGB */ + 0xfe00, /* 7 bitsPerRGB */ + 0xff00, /* 8 bitsPerRGB */ + 0xff80, /* 9 bitsPerRGB */ + 0xffc0, /* 10 bitsPerRGB */ + 0xffe0, /* 11 bitsPerRGB */ + 0xfff0, /* 12 bitsPerRGB */ + 0xfff8, /* 13 bitsPerRGB */ + 0xfffc, /* 14 bitsPerRGB */ + 0xfffe, /* 15 bitsPerRGB */ + 0xffff /* 16 bitsPerRGB */ +}; + + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsRGB_to_XColor - + * + * SYNOPSIS + */ +void +_XcmsRGB_to_XColor( + XcmsColor *pColors, + XColor *pXColors, + unsigned int nColors) +/* + * DESCRIPTION + * Translates a color specification in XcmsRGBFormat in a XcmsColor + * structure to an XColor structure. + * + * RETURNS + * void. + */ +{ + for (; nColors--; pXColors++, pColors++) { + pXColors->pixel = pColors->pixel; + pXColors->red = pColors->spec.RGB.red; + pXColors->green = pColors->spec.RGB.green; + pXColors->blue = pColors->spec.RGB.blue; + pXColors->flags = (DoRed | DoGreen | DoBlue); + } +} + + +/* + * NAME + * _XColor_to_XcmsRGB + * + * SYNOPSIS + */ +void +_XColor_to_XcmsRGB( + XcmsCCC ccc, + XColor *pXColors, + XcmsColor *pColors, + unsigned int nColors) +/* + * DESCRIPTION + * Translates an RGB color specification in an XColor + * structure to an XcmsRGB structure. + * + * IMPORTANT NOTE: Bit replication that may have been caused + * with ResolveColor() routine in the X Server is undone + * here if requested! For example, if red = 0xcaca and the + * bits_per_rgb is 8, then spec.RGB.red will be 0xca00. + * + * RETURNS + * void + */ +{ + int bits_per_rgb = ccc->visual->bits_per_rgb; + + for (; nColors--; pXColors++, pColors++) { + pColors->spec.RGB.red = (pXColors->red & MASK[bits_per_rgb]); + pColors->spec.RGB.green = (pXColors->green & MASK[bits_per_rgb]); + pColors->spec.RGB.blue = (pXColors->blue & MASK[bits_per_rgb]); + pColors->format = XcmsRGBFormat; + pColors->pixel = pXColors->pixel; + } +} + + +/* + * NAME + * _XcmsResolveColor + * + * SYNOPSIS + */ +void +_XcmsResolveColor( + XcmsCCC ccc, + XcmsColor *pXcmsColor) +/* + * DESCRIPTION + * Uses the X Server ResolveColor() algorithm to + * modify values to closest values supported by hardware. + * Old algorithm simply masked low-order bits. The new algorithm + * has the effect of replicating significant bits into lower order + * bits in order to stretch the hardware value into all 16 bits. + * + * On a display with N-bit DACs, the "hardware" color is computed as: + * + * ((unsignedlong)(ClientValue >> (16-N)) * 0xFFFF) / ((1 << N) - 1) + * + * + * RETURNS + * void. + */ +{ + int shift; + int max_color; + + shift = 16 - ccc->visual->bits_per_rgb; + max_color = (1 << ccc->visual->bits_per_rgb) - 1; + + + pXcmsColor->spec.RGB.red = + ((unsigned long)(pXcmsColor->spec.RGB.red >> shift) * 0xFFFF) + / max_color; + pXcmsColor->spec.RGB.green = + ((unsigned long)(pXcmsColor->spec.RGB.green >> shift) * 0xFFFF) + / max_color; + pXcmsColor->spec.RGB.blue = + ((unsigned long)(pXcmsColor->spec.RGB.blue >> shift) * 0xFFFF) + / max_color; +} + + +/* + * NAME + * _XcmsUnresolveColor + * + * SYNOPSIS + */ +void +_XcmsUnresolveColor( + XcmsCCC ccc, + XcmsColor *pColor) +/* + * DESCRIPTION + * Masks out insignificant bits. + * + * RETURNS + * void. + * + * ASSUMPTIONS + * format == XcmsRGBFormat + */ +{ + int bits_per_rgb = ccc->visual->bits_per_rgb; + + pColor->spec.RGB.red &= MASK[bits_per_rgb]; + pColor->spec.RGB.green &= MASK[bits_per_rgb]; + pColor->spec.RGB.blue &= MASK[bits_per_rgb]; +} + + +/* + * NAME + * _XUnresolveColor + * + * SYNOPSIS + */ +void +_XUnresolveColor( + XcmsCCC ccc, + XColor *pXColor) +/* + * DESCRIPTION + * Masks out insignificant bits. + * + * RETURNS + * void. + */ +{ + int bits_per_rgb = ccc->visual->bits_per_rgb; + + pXColor->red &= MASK[bits_per_rgb]; + pXColor->green &= MASK[bits_per_rgb]; + pXColor->blue &= MASK[bits_per_rgb]; +} + diff --git a/nx-X11/lib/src/xcms/XYZ.c b/nx-X11/lib/src/xcms/XYZ.c new file mode 100644 index 000000000..826565773 --- /dev/null +++ b/nx-X11/lib/src/xcms/XYZ.c @@ -0,0 +1,203 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * + * NAME + * CIEXYZ.c + * + * DESCRIPTION + * CIE XYZ Color Space + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +#include /* sscanf */ + +/* + * DEFINES + * Internal definitions that need NOT be exported to any package + * or program using this package. + */ +#ifdef DBL_EPSILON +# define XMY_DBL_EPSILON DBL_EPSILON +#else +# define XMY_DBL_EPSILON 0.00001 +#endif + +/* + * FORWARD DECLARATIONS + */ +static int CIEXYZ_ParseString(register char *spec, XcmsColor *pColor); + +/* + * LOCALS VARIABLES + */ + +static XcmsConversionProc Fl_CIEXYZ_to_CIEXYZ[] = { + NULL +}; + + + +/* + * GLOBALS + * Variables declared in this package that are allowed + * to be used globally. + */ + /* + * CIE XYZ Color Space + */ +XcmsColorSpace XcmsCIEXYZColorSpace = + { + _XcmsCIEXYZ_prefix, /* prefix */ + XcmsCIEXYZFormat, /* id */ + CIEXYZ_ParseString, /* parseString */ + Fl_CIEXYZ_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_CIEXYZ, /* from_CIEXYZ */ + 1 + }; + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * CIEXYZ_ParseString + * + * SYNOPSIS + */ +static int +CIEXYZ_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsCIEXYZFormat. + * The assumed CIEXYZ string syntax is: + * CIEXYZ:// + * Where X, Y, and Z are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + */ +{ + size_t n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (size_t)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsCIEXYZ_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIEXYZ.X, + &pColor->spec.CIEXYZ.Y, + &pColor->spec.CIEXYZ.Z) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIEXYZ.X, + &pColor->spec.CIEXYZ.Y, + &pColor->spec.CIEXYZ.Z) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + pColor->format = XcmsCIEXYZFormat; + pColor->pixel = 0; + return(_XcmsCIEXYZ_ValidSpec(pColor)); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIELab_ValidSpec + * + * SYNOPSIS + */ +Status +_XcmsCIEXYZ_ValidSpec( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks if color specification valid for CIE XYZ + * + * RETURNS + * XcmsFailure if invalid, + * XcmsSuccess if valid. + * + */ +{ + if (pColor->format != XcmsCIEXYZFormat + || + (pColor->spec.CIEXYZ.Y < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIEXYZ.Y > 1.0 + XMY_DBL_EPSILON)) { + return(XcmsFailure); + } + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/Xcms.txt b/nx-X11/lib/src/xcms/Xcms.txt new file mode 100644 index 000000000..1c5b1adec --- /dev/null +++ b/nx-X11/lib/src/xcms/Xcms.txt @@ -0,0 +1,44 @@ +/* + * (c) Copyright 1990 1991 Tektronix Inc. + * All Rights Reserved + * + * 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 + * supporting documentation, and that the name of Tektronix not be used + * in advertising or publicity pertaining to distribution of the software + * without specific, written prior permission. + * + * Tektronix disclaims all warranties with regard to this software, including + * all implied warranties of merchantability and fitness, in no event shall + * Tektronix 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. + * + * + * NAME + * Xcms.txt + * + * DESCRIPTION + * Sample Color Name Database + * + */ + + +This device-independent color name database is provided just as an example. +There are no claims that these color specifications are or should be bound +to the corresponding color name. + +As you can see, the start of the database is indicated by "XCMS_COLORDB_START". +Anything before this is assumed to be comments. The "0.1" indicates the +version number of the format/syntax used in this file. The color name is +delimited from the color specification by one or more tabs. + +XCMS_COLORDB_START 0.1 +cms red CIEXYZ:0.3811/0.2073/0.0213 +cms green CIEXYZ:0.3203/0.6805/0.1430 +cms blue CIEXYZ:0.2483/0.1122/1.2417 +XCMS_COLORDB_END diff --git a/nx-X11/lib/src/xcms/Xcmsint.h b/nx-X11/lib/src/xcms/Xcmsint.h new file mode 100644 index 000000000..8a2decb11 --- /dev/null +++ b/nx-X11/lib/src/xcms/Xcmsint.h @@ -0,0 +1,260 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * DESCRIPTION + * Private include file for Color Management System. + * (i.e., for API internal use only) + * + */ + +#ifndef _XCMSINT_H_ +#define _XCMSINT_H_ + +#include + +/* + * DEFINES + */ + + /* + * Private Status Value + */ +#define _XCMS_NEWNAME -1 + + /* + * Color Space ID's are of XcmsColorFormat type. + * + * bit 31 + * 0 == Device-Independent + * 1 == Device-Dependent + * + * bit 30: + * 0 == Registered with X Consortium + * 1 == Unregistered + */ +#define XCMS_DD_ID(id) ((id) & (XcmsColorFormat)0x80000000) +#define XCMS_DI_ID(id) (!((id) & (XcmsColorFormat)0x80000000)) +#define XCMS_UNREG_ID(id) ((id) & (XcmsColorFormat)0x40000000) +#define XCMS_REG_ID(id) (!((id) & (XcmsColorFormat)0x40000000)) +#define XCMS_FIRST_REG_DI_ID (XcmsColorFormat)0x00000001 +#define XCMS_FIRST_UNREG_DI_ID (XcmsColorFormat)0x40000000 +#define XCMS_FIRST_REG_DD_ID (XcmsColorFormat)0x80000000 +#define XCMS_FIRST_UNREG_DD_ID (XcmsColorFormat)0xc0000000 + +/* + * TYPEDEFS + */ + + /* + * Structure for caching Colormap info. + * This is provided for the Xlib modifications to: + * XAllocNamedColor() + * XLookupColor() + * XParseColor() + * XStoreNamedColor() + */ +typedef struct _XcmsCmapRec { + Colormap cmapID; + Display *dpy; + Window windowID; + Visual *visual; + struct _XcmsCCC *ccc; + struct _XcmsCmapRec *pNext; +} XcmsCmapRec; + + /* + * Intensity Record (i.e., value / intensity tuple) + */ +typedef struct _IntensityRec { + unsigned short value; + XcmsFloat intensity; +} IntensityRec; + + /* + * Intensity Table + */ +typedef struct _IntensityTbl { + IntensityRec *pBase; + unsigned int nEntries; +} IntensityTbl; + + /* + * Structure for storing per-Visual Intensity Tables (aka gamma maps). + */ +typedef struct _XcmsIntensityMap { + VisualID visualID; + XPointer screenData; /* pointer to corresponding Screen Color*/ + /* Characterization Data */ + void (*pFreeScreenData)(XPointer pScreenDataTemp); /* Function that frees a Screen */ + /* structure. */ + struct _XcmsIntensityMap *pNext; +} XcmsIntensityMap; + + + /* + * Structure for storing "registered" color space prefix/ID + */ +typedef struct _XcmsRegColorSpaceEntry { + const char *prefix; /* Color Space prefix (e.g., "CIEXYZ:") */ + XcmsColorFormat id; /* Color Space ID (e.g., XcmsCIEXYZFormat) */ +} XcmsRegColorSpaceEntry; + + + /* + * Xcms Per Display (i.e. connection) related data + */ +typedef struct _XcmsPerDpyInfo { + + XcmsCCC paDefaultCCC; /* based on default visual of screen */ + /* + * Pointer to an array of XcmsCCC structures, one for + * each screen. + */ + XcmsCmapRec *pClientCmaps; /* Pointer to linked list of XcmsCmapRec's */ + +} XcmsPerDpyInfo, *XcmsPerDpyInfoPtr; + +/* + * DEFINES + */ + +#define XDCCC_NUMBER 0x8000000L /* 2**27 per XDCCC */ + +#ifdef GRAY +#define XDCCC_SCREENWHITEPT_ATOM_NAME "XDCCC_GRAY_SCREENWHITEPOINT" +#define XDCCC_GRAY_CORRECT_ATOM_NAME "XDCCC_GRAY_CORRECTION" +#endif /* GRAY */ + +#ifndef _ConversionValues +typedef struct _ConversionValues { + IntensityTbl IntensityTbl; +} ConversionValues; +#endif + +#ifdef GRAY +typedef struct { + IntensityTbl *IntensityTbl; +} GRAY_SCCData; +#endif /* GRAY */ + +/* + * DEFINES + */ + +#define XDCCC_MATRIX_ATOM_NAME "XDCCC_LINEAR_RGB_MATRICES" +#define XDCCC_CORRECT_ATOM_NAME "XDCCC_LINEAR_RGB_CORRECTION" + +typedef struct { + XcmsFloat XYZtoRGBmatrix[3][3]; + XcmsFloat RGBtoXYZmatrix[3][3]; + IntensityTbl *pRedTbl; + IntensityTbl *pGreenTbl; + IntensityTbl *pBlueTbl; +} LINEAR_RGB_SCCData; + +/* function prototypes */ +extern XcmsCmapRec * +_XcmsAddCmapRec( + Display *dpy, + Colormap cmap, + Window windowID, + Visual *visual); +extern void +_XcmsRGB_to_XColor( + XcmsColor *pColors, + XColor *pXColors, + unsigned int nColors); +extern Status +_XcmsResolveColorString ( + XcmsCCC ccc, + const char **color_string, + XcmsColor *pColor_exact_return, + XcmsColorFormat result_format); +extern void +_XUnresolveColor( + XcmsCCC ccc, + XColor *pXColor); +/* + * DESCRIPTION + * Include file for defining the math macros used in the + * XCMS source. Instead of using math library routines + * directly, XCMS uses macros so that based on the + * definitions here, vendors and sites can specify exactly + * what routine will be called (those from libm.a or their + * custom routines). If not defined to math library routines + * (e.g., sqrt in libm.a), then the client is not forced to + * be linked with -lm. + */ + +#define XCMS_ATAN(x) _XcmsArcTangent(x) +#define XCMS_COS(x) _XcmsCosine(x) +#define XCMS_CUBEROOT(x) _XcmsCubeRoot(x) +#define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) +#define XCMS_SIN(x) _XcmsSine(x) +#define XCMS_SQRT(x) _XcmsSquareRoot(x) +#define XCMS_TAN(x) (XCMS_SIN(x) / XCMS_COS(x)) + +double _XcmsArcTangent(double a); +double _XcmsCosine(double a); +double _XcmsCubeRoot(double a); +double _XcmsSine(double a); +double _XcmsSquareRoot(double a); + +/* + * DEFINES FOR GAMUT COMPRESSION AND QUERY ROUTINES + */ +#ifndef PI +# ifdef M_PI +# define PI M_PI +# else +# define PI 3.14159265358979323846264338327950 +# endif /* M_PI */ +#endif /* PI */ +#ifndef degrees +# define degrees(r) ((XcmsFloat)(r) * 180.0 / PI) +#endif /* degrees */ +#ifndef radians +# define radians(d) ((XcmsFloat)(d) * PI / 180.0) +#endif /* radians */ + +#define XCMS_CIEUSTAROFHUE(h,c) \ +((XCMS_COS((h)) == 0.0) ? (XcmsFloat)0.0 : (XcmsFloat) \ +((XcmsFloat)(c) / (XcmsFloat)XCMS_SQRT((XCMS_TAN(h) * XCMS_TAN(h)) + \ +(XcmsFloat)1.0))) +#define XCMS_CIEVSTAROFHUE(h,c) \ +((XCMS_COS((h)) == 0.0) ? (XcmsFloat)0.0 : (XcmsFloat) \ +((XcmsFloat)(c) / (XcmsFloat)XCMS_SQRT(((XcmsFloat)1.0 / \ +(XcmsFloat)(XCMS_TAN(h) * XCMS_TAN(h))) + (XcmsFloat)1.0))) +/* this hue is returned in radians */ +#define XCMS_CIELUV_PMETRIC_HUE(u,v) \ +(((u) != 0.0) ? XCMS_ATAN( (v) / (u)) : ((v >= 0.0) ? PI / 2 : -(PI / 2))) +#define XCMS_CIELUV_PMETRIC_CHROMA(u,v) XCMS_SQRT(((u)*(u)) + ((v)*(v))) + +#define XCMS_CIEASTAROFHUE(h,c) XCMS_CIEUSTAROFHUE((h), (c)) +#define XCMS_CIEBSTAROFHUE(h,c) XCMS_CIEVSTAROFHUE((h), (c)) +#define XCMS_CIELAB_PMETRIC_HUE(a,b) XCMS_CIELUV_PMETRIC_HUE((a), (b)) +#define XCMS_CIELAB_PMETRIC_CHROMA(a,b) XCMS_CIELUV_PMETRIC_CHROMA((a), (b)) + +#endif /* _XCMSINT_H_ */ diff --git a/nx-X11/lib/src/xcms/cmsAllCol.c b/nx-X11/lib/src/xcms/cmsAllCol.c new file mode 100644 index 000000000..aeea46461 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsAllCol.c @@ -0,0 +1,74 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsAllCol.c + * + * DESCRIPTION + * Source for XcmsAllocColor + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/* + * NAME + * XcmsAllocColor - Allocate Color + * + * SYNOPSIS + */ +Status +XcmsAllocColor( + Display *dpy, + Colormap colormap, + XcmsColor *pXcmsColor_in_out, + XcmsColorFormat result_format) +/* + * DESCRIPTION + * Given a device-dependent or device-independent color + * specification, XcmsAllocColor will convert it to X RGB + * values then use it in a call to XAllocColor. + * + * RETURNS + * XcmsFailure if failed; + * XcmsSuccess if it succeeded without gamut compression; + * XcmsSuccessWithCompression if it succeeded with gamut + * compression; + * + * Also returns the pixel value of the color cell and a color + * specification of the color actually stored. + * + */ +{ + return(_XcmsSetGetColor(XAllocColor, dpy, colormap, pXcmsColor_in_out, + result_format, (Bool *)NULL)); +} diff --git a/nx-X11/lib/src/xcms/cmsAllNCol.c b/nx-X11/lib/src/xcms/cmsAllNCol.c new file mode 100644 index 000000000..d39de6cbd --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsAllNCol.c @@ -0,0 +1,198 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsAlNCol.c + * + * DESCRIPTION + * Source for XcmsAllocNamedColor + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/* + * NAME + * XcmsAllocNamedColor - + * + * SYNOPSIS + */ +Status +XcmsAllocNamedColor ( + Display *dpy, + Colormap cmap, + _Xconst char *colorname, + XcmsColor *pColor_scrn_return, + XcmsColor *pColor_exact_return, + XcmsColorFormat result_format) +/* + * DESCRIPTION + * Finds the color specification associated with the color + * name in the Device-Independent Color Name Database, then + * converts that color specification to an RGB format. This + * RGB value is then used in a call to XAllocColor to allocate + * a read-only color cell. + * + * RETURNS + * 0 if failed to parse string or find any entry in the database. + * 1 if succeeded in converting color name to XcmsColor. + * 2 if succeeded in converting color name to another color name. + * + */ +{ + long nbytes; + xAllocNamedColorReply rep; + xAllocNamedColorReq *req; + XColor hard_def; + XColor exact_def; + Status retval1 = 1; + Status retval2 = XcmsSuccess; + XcmsColor tmpColor; + XColor XColor_in_out; + XcmsCCC ccc; + + /* + * 0. Check for invalid arguments. + */ + if (dpy == NULL || colorname[0] == '\0' || pColor_scrn_return == 0 + || pColor_exact_return == NULL) { + return(XcmsFailure); + } + + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { + return(XcmsFailure); + } + + /* + * 1. Convert string to a XcmsColor using Xcms and i18n mechanism + */ + if ((retval1 = _XcmsResolveColorString(ccc, &colorname, + &tmpColor, result_format)) == XcmsFailure) { + return(XcmsFailure); + } + if (retval1 == _XCMS_NEWNAME) { + goto PassToServer; + } + memcpy((char *)pColor_exact_return, (char *)&tmpColor, sizeof(XcmsColor)); + + /* + * 2. Convert tmpColor to RGB + * Assume pColor_exact_return is now adjusted to Client White Point + */ + if ((retval2 = XcmsConvertColors(ccc, &tmpColor, + 1, XcmsRGBFormat, (Bool *) NULL)) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * 3. Convert to XColor and call XAllocColor + */ + _XcmsRGB_to_XColor(&tmpColor, &XColor_in_out, 1); + if (XAllocColor(ccc->dpy, cmap, &XColor_in_out) == 0) { + return(XcmsFailure); + } + + /* + * 4. pColor_scrn_return + * + * Now convert to the target format. + * We can ignore the return value because we're already in a + * device-dependent format. + */ + _XColor_to_XcmsRGB(ccc, &XColor_in_out, pColor_scrn_return, 1); + if (result_format != XcmsRGBFormat) { + if (result_format == XcmsUndefinedFormat) { + result_format = pColor_exact_return->format; + } + if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + + return(retval1 > retval2 ? retval1 : retval2); + +PassToServer: + /* + * All previous methods failed, so lets pass it to the server + * for parsing. + */ + dpy = ccc->dpy; + LockDisplay(dpy); + GetReq(AllocNamedColor, req); + + req->cmap = cmap; + nbytes = req->nbytes = strlen(colorname); + req->length += (nbytes + 3) >> 2; /* round up to mult of 4 */ + + _XSend(dpy, colorname, nbytes); + /* _XSend is more efficient that Data, since _XReply follows */ + + if (!_XReply (dpy, (xReply *) &rep, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return (0); + } + + exact_def.red = rep.exactRed; + exact_def.green = rep.exactGreen; + exact_def.blue = rep.exactBlue; + + hard_def.red = rep.screenRed; + hard_def.green = rep.screenGreen; + hard_def.blue = rep.screenBlue; + + exact_def.pixel = hard_def.pixel = rep.pixel; + + UnlockDisplay(dpy); + SyncHandle(); + + /* + * Now convert to the target format. + */ + _XColor_to_XcmsRGB(ccc, &exact_def, pColor_exact_return, 1); + _XColor_to_XcmsRGB(ccc, &hard_def, pColor_scrn_return, 1); + if (result_format != XcmsRGBFormat + && result_format != XcmsUndefinedFormat) { + if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/cmsCmap.c b/nx-X11/lib/src/xcms/cmsCmap.c new file mode 100644 index 000000000..c7087ecb1 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsCmap.c @@ -0,0 +1,492 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsCmap.c - Client Colormap Management Routines + * + * DESCRIPTION + * Routines that store additional information about + * colormaps being used by the X Client. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Xutil.h" +#include "Cmap.h" +#include "Cv.h" + +/* + * FORWARD DECLARATIONS + */ +static void _XcmsFreeClientCmaps(Display *dpy); + + +/************************************************************************ + * * + * PRIVATE INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * CmapRecForColormap + * + * SYNOPSIS + */ +static XcmsCmapRec * +CmapRecForColormap( + Display *dpy, + Colormap cmap) +/* + * DESCRIPTION + * Find the corresponding XcmsCmapRec for cmap. In not found + * this routines attempts to create one. + * + * RETURNS + * Returns NULL if failed; otherwise the address to + * the corresponding XcmsCmapRec. + * + */ +{ + XcmsCmapRec *pRec; + int nScrn; + int i, j; + XVisualInfo visualTemplate; /* Template of the visual we want */ + XVisualInfo *visualList; /* List for visuals that match */ + int nVisualsMatched; /* Number of visuals that match */ + Window tmpWindow; + Visual *vp; + unsigned long border = 0; + _XAsyncHandler async; + _XAsyncErrorState async_state; + + for (pRec = (XcmsCmapRec *)dpy->cms.clientCmaps; pRec != NULL; + pRec = pRec->pNext) { + if (pRec->cmapID == cmap) { + return(pRec); + } + } + + /* + * Can't find an XcmsCmapRec associated with cmap in our records. + * Let's try to see if its a default colormap + */ + nScrn = ScreenCount(dpy); + for (i = 0; i < nScrn; i++) { + if (cmap == DefaultColormap(dpy, i)) { + /* It is ... lets go ahead and store that info */ + if ((pRec = _XcmsAddCmapRec(dpy, cmap, RootWindow(dpy, i), + DefaultVisual(dpy, i))) == NULL) { + return((XcmsCmapRec *)NULL); + } + pRec->ccc = XcmsCreateCCC( + dpy, + i, /* screenNumber */ + DefaultVisual(dpy, i), + (XcmsColor *)NULL, /* clientWhitePt */ + (XcmsCompressionProc)NULL, /* gamutCompProc */ + (XPointer)NULL, /* gamutCompClientData */ + (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ + (XPointer)NULL /* whitePtAdjClientData */ + ); + return(pRec); + } + } + + /* + * Nope, its not a default colormap, so it's probably a foreign color map + * of which we have no specific details. Let's go through the + * rigorous process of finding this colormap: + * for each screen + * for each screen's visual types + * create a window with cmap specified as the colormap + * if successful + * Add a CmapRec + * Create an XcmsCCC + * return the CmapRec + * else + * continue + */ + + async_state.error_code = 0; /* don't care */ + async_state.major_opcode = X_CreateWindow; + async_state.minor_opcode = 0; + for (i = 0; i < nScrn; i++) { + visualTemplate.screen = i; + visualList = XGetVisualInfo(dpy, VisualScreenMask, &visualTemplate, + &nVisualsMatched); + if (visualList == NULL) { + continue; + } + + /* + * Attempt to create a window with cmap + */ + j = 0; + do { + vp = (visualList+j)->visual; + LockDisplay(dpy); + { + register xCreateWindowReq *req; + + GetReq(CreateWindow, req); + async_state.min_sequence_number = dpy->request; + async_state.max_sequence_number = dpy->request; + async_state.error_count = 0; + async.next = dpy->async_handlers; + async.handler = _XAsyncErrorHandler; + async.data = (XPointer)&async_state; + dpy->async_handlers = &async; + req->parent = RootWindow(dpy, i); + req->x = 0; + req->y = 0; + req->width = 1; + req->height = 1; + req->borderWidth = 0; + req->depth = (visualList+j)->depth; + req->class = CopyFromParent; + req->visual = vp->visualid; + tmpWindow = req->wid = XAllocID(dpy); + req->mask = CWBorderPixel | CWColormap; + req->length += 2; + Data32 (dpy, (long *) &border, 4); + Data32 (dpy, (long *) &cmap, 4); + } + { + xGetInputFocusReply rep; + _X_UNUSED register xReq *req; + + GetEmptyReq(GetInputFocus, req); + (void) _XReply (dpy, (xReply *)&rep, 0, xTrue); + } + DeqAsyncHandler(dpy, &async); + UnlockDisplay(dpy); + SyncHandle(); + } while (async_state.error_count > 0 && ++j < nVisualsMatched); + + Xfree(visualList); + + /* + * if successful + */ + if (j < nVisualsMatched) { + if ((pRec = _XcmsAddCmapRec(dpy, cmap, tmpWindow, vp)) == NULL) + return((XcmsCmapRec *)NULL); + pRec->ccc = XcmsCreateCCC( + dpy, + i, /* screenNumber */ + vp, + (XcmsColor *)NULL, /* clientWhitePt */ + (XcmsCompressionProc)NULL, /* gamutCompProc */ + (XPointer)NULL, /* gamutCompClientData */ + (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ + (XPointer)NULL /* whitePtAdjClientData */ + ); + XDestroyWindow(dpy, tmpWindow); + return(pRec); + } + } + + return(NULL); +} + + + +/************************************************************************ + * * + * API PRIVATE INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsAddCmapRec + * + * SYNOPSIS + */ +XcmsCmapRec * +_XcmsAddCmapRec( + Display *dpy, + Colormap cmap, + Window windowID, + Visual *visual) +/* + * DESCRIPTION + * Create an XcmsCmapRec for the specified cmap, windowID, + * and visual, then adds it to its list of CmapRec's. + * + * RETURNS + * Returns NULL if failed; otherwise the address to + * the added XcmsCmapRec. + * + */ +{ + XcmsCmapRec *pNew; + + if ((pNew = Xcalloc(1, sizeof(XcmsCmapRec))) == NULL) { + return((XcmsCmapRec *)NULL); + } + + pNew->cmapID = cmap; + pNew->dpy = dpy; + pNew->windowID = windowID; + pNew->visual = visual; + pNew->pNext = (XcmsCmapRec *)dpy->cms.clientCmaps; + dpy->cms.clientCmaps = (XPointer)pNew; + dpy->free_funcs->clientCmaps = _XcmsFreeClientCmaps; + + /* + * Note, we don't create the XcmsCCC for pNew->ccc here because + * it may require the use of XGetWindowAttributes (a round trip request) + * to determine the screen. + */ + return(pNew); +} + + +/* + * NAME + * _XcmsCopyCmapRecAndFree + * + * SYNOPSIS + */ +XcmsCmapRec * +_XcmsCopyCmapRecAndFree( + Display *dpy, + Colormap src_cmap, + Colormap copy_cmap) +/* + * DESCRIPTION + * Augments Xlib's XCopyColormapAndFree() to copy + * XcmsCmapRecs. + * + * RETURNS + * Returns NULL if failed; otherwise the address to + * the copy XcmsCmapRec. + * + */ +{ + XcmsCmapRec *pRec_src; + XcmsCmapRec *pRec_copy; + + if ((pRec_src = CmapRecForColormap(dpy, src_cmap)) != NULL) { + pRec_copy =_XcmsAddCmapRec(dpy, copy_cmap, pRec_src->windowID, + pRec_src->visual); + if (pRec_copy != NULL && pRec_src->ccc) { + pRec_copy->ccc = Xcalloc(1, sizeof(XcmsCCCRec)); + memcpy((char *)pRec_copy->ccc, (char *)pRec_src->ccc, + sizeof(XcmsCCCRec)); + } + return(pRec_copy); + } + return((XcmsCmapRec *)NULL); +} + + +/* + * NAME + * _XcmsDeleteCmapRec + * + * SYNOPSIS + */ +void +_XcmsDeleteCmapRec( + Display *dpy, + Colormap cmap) +/* + * DESCRIPTION + * Removes and frees the specified XcmsCmapRec structure + * from the linked list of structures. + * + * RETURNS + * void + * + */ +{ + XcmsCmapRec **pPrevPtr; + XcmsCmapRec *pRec; + int scr; + + /* If it is the default cmap for a screen, do not delete it, + * because the server will not actually free it */ + for (scr = ScreenCount(dpy); --scr >= 0; ) { + if (cmap == DefaultColormap(dpy, scr)) + return; + } + + /* search for it in the list */ + pPrevPtr = (XcmsCmapRec **)&dpy->cms.clientCmaps; + while ((pRec = *pPrevPtr) && (pRec->cmapID != cmap)) { + pPrevPtr = &pRec->pNext; + } + + if (pRec) { + if (pRec->ccc) { + XcmsFreeCCC(pRec->ccc); + } + *pPrevPtr = pRec->pNext; + Xfree(pRec); + } +} + + +/* + * NAME + * _XcmsFreeClientCmaps + * + * SYNOPSIS + */ +static void +_XcmsFreeClientCmaps( + Display *dpy) +/* + * DESCRIPTION + * Frees all XcmsCmapRec structures in the linked list + * and sets dpy->cms.clientCmaps to NULL. + * + * RETURNS + * void + * + */ +{ + XcmsCmapRec *pRecNext, *pRecFree; + + pRecNext = (XcmsCmapRec *)dpy->cms.clientCmaps; + while (pRecNext != NULL) { + pRecFree = pRecNext; + pRecNext = pRecNext->pNext; + if (pRecFree->ccc) { + /* Free the XcmsCCC structure */ + XcmsFreeCCC(pRecFree->ccc); + } + /* Now free the XcmsCmapRec structure */ + Xfree(pRecFree); + } + dpy->cms.clientCmaps = (XPointer)NULL; +} + + + +/************************************************************************ + * * + * PUBLIC INTERFACES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCCCOfColormap + * + * SYNOPSIS + */ +XcmsCCC +XcmsCCCOfColormap( + Display *dpy, + Colormap cmap) +/* + * DESCRIPTION + * Finds the XcmsCCC associated with the specified colormap. + * + * RETURNS + * Returns NULL if failed; otherwise the address to + * the associated XcmsCCC structure. + * + */ +{ + XWindowAttributes windowAttr; + XcmsCmapRec *pRec; + int nScrn = ScreenCount(dpy); + int i; + + if ((pRec = CmapRecForColormap(dpy, cmap)) != NULL) { + if (pRec->ccc) { + /* XcmsCmapRec already has a XcmsCCC */ + return(pRec->ccc); + } + + /* + * The XcmsCmapRec does not have a XcmsCCC yet, so let's create + * one. But first, we need to know the screen associated with + * cmap, so use XGetWindowAttributes() to extract that + * information. Unless, of course there is only one screen!! + */ + if (nScrn == 1) { + /* Assume screenNumber == 0 */ + return(pRec->ccc = XcmsCreateCCC( + dpy, + 0, /* screenNumber */ + pRec->visual, + (XcmsColor *)NULL, /* clientWhitePt */ + (XcmsCompressionProc)NULL, /* gamutCompProc */ + (XPointer)NULL, /* gamutCompClientData */ + (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ + (XPointer)NULL /* whitePtAdjClientData */ + )); + } else { + if (XGetWindowAttributes(dpy, pRec->windowID, &windowAttr)) { + for (i = 0; i < nScrn; i++) { + if (ScreenOfDisplay(dpy, i) == windowAttr.screen) { + return(pRec->ccc = XcmsCreateCCC( + dpy, + i, /* screenNumber */ + pRec->visual, + (XcmsColor *)NULL, /* clientWhitePt */ + (XcmsCompressionProc)NULL, /* gamutCompProc */ + (XPointer)NULL, /* gamutCompClientData */ + (XcmsWhiteAdjustProc)NULL, /* whitePtAdjProc */ + (XPointer)NULL /* whitePtAdjClientData */ + )); + } + } + } + } + } + + /* + * No such cmap + */ + return(NULL); +} + +XcmsCCC XcmsSetCCCOfColormap( + Display *dpy, + Colormap cmap, + XcmsCCC ccc) +{ + XcmsCCC prev_ccc = NULL; + XcmsCmapRec *pRec; + + pRec = CmapRecForColormap(dpy, cmap); + if (pRec) { + prev_ccc = pRec->ccc; + pRec->ccc = ccc; + } + return prev_ccc; +} diff --git a/nx-X11/lib/src/xcms/cmsColNm.c b/nx-X11/lib/src/xcms/cmsColNm.c new file mode 100644 index 000000000..c6f1e0f31 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsColNm.c @@ -0,0 +1,1050 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * XcmsColNm.c + * + * DESCRIPTION + * Source for _XcmsLookupColorName(). + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include +#include +#include +#include +#include +#define XK_LATIN1 +#include +#include "Cv.h" + +/* forwards/locals */ +static Status LoadColornameDB(void); + + +/* + * LOCAL DEFINES + * #define declarations local to this package. + */ +#ifndef XCMSDB +#define XCMSDB XCMSDIR "/Xcms.txt" +#endif + +#ifndef isgraph +# define isgraph(c) (isprint((c)) && !isspace((c))) +#endif + +#ifndef XCMSDB_MAXLINELEN +# define XCMSDB_MAXLINELEN 256 +#endif + +#define FORMAT_VERSION "0.1" +#define START_TOKEN "XCMS_COLORDB_START" +#define END_TOKEN "XCMS_COLORDB_END" +#define DELIM_CHAR '\t' + +#define NOT_VISITED 0x0 +#define VISITED 0x1 +#define CYCLE 0xFFFF +#define XcmsDbInitNone -1 +#define XcmsDbInitFailure 0 +#define XcmsDbInitSuccess 1 + +/* + * LOCAL TYPEDEFS + */ +typedef struct _XcmsPair { + const char *first; + const char *second; + int flag; +} XcmsPair; + +/* + * LOCAL VARIABLES + */ +static int XcmsColorDbState = XcmsDbInitNone; +static int nEntries; +static char *strings; +static XcmsPair *pairs; +static const char whitePtStr[] = "WhitePoint"; + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsColorSpaceOfString + * + * SYNOPSIS + */ +static XcmsColorSpace * +_XcmsColorSpaceOfString( + XcmsCCC ccc, + const char *color_string) +/* + * DESCRIPTION + * Returns a pointer to the color space structure + * (XcmsColorSpace) associated with the specified color string. + * + * RETURNS + * Pointer to matching XcmsColorSpace structure if found; + * otherwise NULL. + * + * CAVEATS + * + */ +{ + XcmsColorSpace **papColorSpaces; + size_t n; + char *pchar; + + if ((pchar = strchr(color_string, ':')) == NULL) { + return(XcmsFailure); + } + n = (size_t)(pchar - color_string); + + if (ccc == NULL) { + return(NULL); + } + + /* + * First try Device-Independent color spaces + */ + papColorSpaces = _XcmsDIColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if (strncmp((*papColorSpaces)->prefix, color_string, n) == 0 && + !((*papColorSpaces)->prefix)[n]) { + return(*papColorSpaces); + } + papColorSpaces++; + } + } + + /* + * Next try Device-Dependent color spaces + */ + papColorSpaces = ((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->DDColorSpaces; + if (papColorSpaces != NULL) { + while (*papColorSpaces != NULL) { + if (strncmp((*papColorSpaces)->prefix, color_string, n) == 0 && + !((*papColorSpaces)->prefix)[n]) { + return(*papColorSpaces); + } + papColorSpaces++; + } + } + + return(NULL); +} + + +/* + * NAME + * _XcmsParseColorString + * + * SYNOPSIS + */ +static int +_XcmsParseColorString( + XcmsCCC ccc, + const char *color_string, + XcmsColor *pColor) +/* + * DESCRIPTION + * Assuming color_string contains a numerical string color + * specification, attempts to parse a string into an + * XcmsColor structure. + * + * RETURNS + * 0 if failed; otherwise non-zero. + * + * CAVEATS + * A color string containing a numerical color specification + * must be in ISO Latin-1 encoding! + */ +{ + XcmsColorSpace *pColorSpace; + char string_buf[64]; + char *string_lowered; + size_t len; + int res; + + if (ccc == NULL) { + return(0); + } + + /* + * While copying color_string to string_lowered, convert to lowercase + */ + if ((len = strlen(color_string)) >= sizeof(string_buf)) { + string_lowered = Xmalloc(len+1); + } else { + string_lowered = string_buf; + } + + _XcmsCopyISOLatin1Lowered(string_lowered, color_string); + + if (*string_lowered == '#') { + if ((pColorSpace = _XcmsColorSpaceOfString(ccc, "rgb:")) != NULL) { + res = (*pColorSpace->parseString)(string_lowered, pColor); + if (len >= sizeof(string_buf)) Xfree(string_lowered); + return res; + } + } + + if ((pColorSpace = _XcmsColorSpaceOfString(ccc, string_lowered)) != NULL) { + res = (*pColorSpace->parseString)(string_lowered, pColor); + if (len >= sizeof(string_buf)) Xfree(string_lowered); + return res; + } + + if (len >= sizeof(string_buf)) Xfree(string_lowered); + return(0); +} + + +/* + * NAME + * FirstCmp - Compare color names of pair recs + * + * SYNOPSIS + */ +static int +FirstCmp(const void *p1, const void *p2) +/* + * DESCRIPTION + * Compares the color names of XcmsColorTuples. + * This routine is public to allow access from qsort???. + * + * RETURNS + * 0 if equal; + * < 0 if first precedes second, + * > 0 if first succeeds second. + * + */ +{ + return(strcmp(((const XcmsPair *)p1)->first, ((const XcmsPair *)p2)->first)); +} + + + +/* + * NAME + * stringSectionSize - determine memory needed for strings + * + * SYNOPSIS + */ +static void +SetNoVisit(void) +/* + * DESCRIPTION + * + * RETURNS + * void + * + */ +{ + int i; + XcmsPair *pair = pairs; + + for (i = 0; i < nEntries; i++, pair++) { + if (pair->flag != CYCLE) { + pair->flag = NOT_VISITED; + } + } +} + + + + +/* + * NAME + * field2 - extract two fields + * + * SYNOPSIS + */ +static int +field2( + char *pBuf, + char delim, /* in: field delimiter */ + char **p1, /* in/out: pointer to pointer to field 1 */ + char **p2) /* in/out: pointer to pointer to field 2 */ +/* + * DESCRIPTION + * Extracts two fields from a "record". + * + * RETURNS + * XcmsSuccess if succeeded, otherwise XcmsFailure. + * + */ +{ + *p1 = *p2 = NULL; + + /* Find Field 1 */ + while (!isgraph(*pBuf)) { + if ((*pBuf != '\n') || (*pBuf != '\0')) { + return(XcmsFailure); + } + if (isspace(*pBuf) || (*pBuf == delim)) { + pBuf++; + } + } + *p1 = pBuf; + + /* Find end of Field 2 */ + while (isprint(*pBuf) && (*pBuf != delim)) { + pBuf++; + } + if ((*pBuf == '\n') || (*pBuf == '\0')) { + return(XcmsFailure); + } + if ((*pBuf == ' ') || (*pBuf == delim)) { + *pBuf++ = '\0'; /* stuff end of string character */ + } else { + return(XcmsFailure); + } + + /* Find Field 2 */ + while (!isgraph(*pBuf)) { + if ((*pBuf == '\n') || (*pBuf == '\0')) { + return(XcmsFailure); + } + if (isspace(*pBuf) || (*pBuf == delim)) { + pBuf++; + } + } + *p2 = pBuf; + + /* Find end of Field 2 */ + while (isprint(*pBuf) && (*pBuf != delim)) { + pBuf++; + } + if (*pBuf != '\0') { + *pBuf = '\0'; /* stuff end of string character */ + } + + return(XcmsSuccess); +} + + +/* + * NAME + * _XcmsLookupColorName - Lookup DB entry for a color name + * + * SYNOPSIS + */ +static Status +_XcmsLookupColorName( + XcmsCCC ccc, + const char **name, + XcmsColor *pColor) +/* + * DESCRIPTION + * Searches for an entry in the Device-Independent Color Name + * Database for the specified string. + * + * RETURNS + * XcmsFailure if failed to find a matching entry in + * the database. + * XcmsSuccess if succeeded in converting color name to + * XcmsColor. + * _XCMS_NEWNAME if succeeded in converting color string (which + * is a color name to yet another color name. Note + * that the new name is passed back via 'name'. + */ + { + Status retval = 0; + char name_lowered_64[64]; + char *name_lowered; + register int i, j, left, right; + int len; + const char *tmpName; + XcmsPair *pair = NULL; + + /* + * Check state of Database: + * XcmsDbInitNone + * XcmsDbInitSuccess + * XcmsDbInitFailure + */ + if (XcmsColorDbState == XcmsDbInitFailure) { + return(XcmsFailure); + } + if (XcmsColorDbState == XcmsDbInitNone) { + if (!LoadColornameDB()) { + return(XcmsFailure); + } + } + + SetNoVisit(); + + /* + * While copying name to name_lowered, convert to lowercase + */ + + tmpName = *name; + +Retry: + if ((len = strlen(tmpName)) > 63) { + name_lowered = Xmalloc(len+1); + } else { + name_lowered = name_lowered_64; + } + + _XcmsCopyISOLatin1Lowered(name_lowered, tmpName); + + /* + * Now, remove spaces. + */ + for (i = 0, j = 0; j < len; j++) { + if (!isspace(name_lowered[j])) { + name_lowered[i++] = name_lowered[j]; + } + } + name_lowered[i] = '\0'; + + left = 0; + right = nEntries - 1; + while (left <= right) { + i = (left + right) >> 1; + pair = &pairs[i]; + j = strcmp(name_lowered, pair->first); + if (j < 0) + right = i - 1; + else if (j > 0) + left = i + 1; + else { + break; + } + } + if (len > 63) Xfree(name_lowered); + + if (left > right) { + if (retval == 2) { + if (*name != tmpName) { + *name = tmpName; + } + return(_XCMS_NEWNAME); + } + return(XcmsFailure); + } + + if (pair->flag == CYCLE) { + return(XcmsFailure); + } + if (pair->flag == VISITED) { + pair->flag = CYCLE; + return(XcmsFailure); + } + + if (_XcmsParseColorString(ccc, pair->second, pColor) == XcmsSuccess) { + /* f2 contains a numerical string specification */ + return(XcmsSuccess); + } else { + /* f2 does not contain a numerical string specification */ + tmpName = pair->second; + pair->flag = VISITED; + retval = 2; + goto Retry; + } +} + + +/* + * NAME + * RemoveSpaces + * + * SYNOPSIS + */ +static int +RemoveSpaces( + char *pString) +/* + * DESCRIPTION + * Removes spaces from string. + * + * RETURNS + * Void + * + */ +{ + int i, count = 0; + char *cptr; + + /* REMOVE SPACES */ + cptr = pString; + for (i = strlen(pString); i; i--, cptr++) { + if (!isspace(*cptr)) { + *pString++ = *cptr; + count++; + } + } + *pString = '\0'; + return(count); +} + + +/* + * NAME + * stringSectionSize - determine memory needed for strings + * + * SYNOPSIS + */ +static int +stringSectionSize( + FILE *stream, + int *pNumEntries, + int *pSectionSize) +/* + * DESCRIPTION + * Determines the amount of memory required to store the + * color name strings and also the number of strings. + * + * RETURNS + * XcmsSuccess if succeeded, otherwise XcmsFailure. + * + */ +{ + char buf[XCMSDB_MAXLINELEN]; + char token[XCMSDB_MAXLINELEN]; + char token2[XCMSDB_MAXLINELEN]; + char *pBuf; + char *f1; + char *f2; + size_t i; + + unsigned int numEntries = 0; + unsigned int sectionSize = 0; + + *pNumEntries = 0; + *pSectionSize = 0; + + /* + * Advance to START_TOKEN + * Anything before is just considered as comments. + */ + + while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { + if ((sscanf(buf, "%s %s", token, token2)) + && (strcmp(token, START_TOKEN) == 0)) { + if (strcmp(token2, FORMAT_VERSION) != 0) { + /* text file not in the right format */ + return(XcmsFailure); + } + break; + } /* else it was just a blank line or comment */ + } + + if (pBuf == NULL) { + return(XcmsFailure); + } + + while((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { + if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) { + break; + } + + if (field2(buf, DELIM_CHAR, &f1, &f2) != XcmsSuccess) { + return(XcmsFailure); + } + + numEntries++; + if (numEntries >= INT_MAX) + return(XcmsFailure); + + i = strlen(f1); + if (i >= INT_MAX - sectionSize) + return(XcmsFailure); + sectionSize += i + 1; + for (; i; i--, f1++) { + /* REMOVE SPACES FROM COUNT */ + if (isspace(*f1)) { + sectionSize--; + } + } + + i = strlen(f2); + if (i >= INT_MAX - sectionSize) + return(XcmsFailure); + sectionSize += i + 1; + for (; i; i--, f2++) { + /* REMOVE SPACES FROM COUNT */ + if (isspace(*f2)) { + sectionSize--; + } + } + + } + + *pNumEntries = (int) numEntries; + *pSectionSize = (int) sectionSize; + + return(XcmsSuccess); +} + + +/* + * NAME + * ReadColornameDB - Read the Color Name Database + * + * SYNOPSIS + */ +static Status +ReadColornameDB( + FILE *stream, + XcmsPair *pRec, + char *pString) +/* + * DESCRIPTION + * Loads the Color Name Database from a text file. + * + * RETURNS + * XcmsSuccess if succeeded, otherwise XcmsFailure. + * + */ +{ + char buf[XCMSDB_MAXLINELEN]; + char token[XCMSDB_MAXLINELEN]; + char token2[XCMSDB_MAXLINELEN]; + char *f1; + char *f2; + char *pBuf; + + /* + * Advance to START_TOKEN + * Anything before is just considered as comments. + */ + + while((pBuf = fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { + if ((sscanf(buf, "%s %s", token, token2)) + && (strcmp(token, START_TOKEN) == 0)) { + if (strcmp(token2, FORMAT_VERSION) != 0) { + /* text file not in the right format */ + return(XcmsFailure); + } + break; + } /* else it was just a blank line or comment */ + } + + if (pBuf == NULL) { + return(XcmsFailure); + } + + /* + * Process lines between START_TOKEN to END_TOKEN + */ + + while ((fgets(buf, XCMSDB_MAXLINELEN, stream)) != NULL) { + if ((sscanf(buf, "%s", token)) && (strcmp(token, END_TOKEN) == 0)) { + /* + * Found END_TOKEN so break out of for loop + */ + break; + } + + /* + * Get pairs + */ + if (field2(buf, DELIM_CHAR, &f1, &f2) != XcmsSuccess) { + /* Invalid line */ + continue; + } + + /* + * Add strings + */ + + /* Left String */ + pRec->first = pString; + _XcmsCopyISOLatin1Lowered(pString, f1); + pString += (1 + RemoveSpaces(pString)); + pRec->second = pString; + /* Right String */ + _XcmsCopyISOLatin1Lowered(pString, f2); + pString += RemoveSpaces(pString) + 1; + pRec++; + + } + + return(XcmsSuccess); +} + + +/* + * NAME + * LoadColornameDB - Load the Color Name Database + * + * SYNOPSIS + */ +static Status +LoadColornameDB(void) +/* + * DESCRIPTION + * Loads the Color Name Database from a text file. + * + * RETURNS + * XcmsSuccess if succeeded, otherwise XcmsFailure. + * + */ +{ + int size; + FILE *stream; + const char *pathname; + struct stat txt; + int length; + + /* use and name of this env var is not part of the standard */ + /* implementation-dependent feature */ + if ((pathname = getenv("XCMSDB")) == NULL) { + pathname = XCMSDB; + } + + length = strlen(pathname); + if ((length == 0) || (length >= (BUFSIZ - 5))){ + XcmsColorDbState = XcmsDbInitFailure; + return(XcmsFailure); + } + + if (stat(pathname, &txt)) { + /* can't stat file */ + XcmsColorDbState = XcmsDbInitFailure; + return(XcmsFailure); + } + + if ((stream = _XFopenFile (pathname, "r")) == NULL) { + /* can't open file */ + XcmsColorDbState = XcmsDbInitFailure; + return(XcmsFailure); + } + + if (stringSectionSize(stream, &nEntries, &size) != XcmsSuccess || + nEntries == 0) { + (void) fclose(stream); + XcmsColorDbState = XcmsDbInitFailure; + return(XcmsFailure); + } + rewind(stream); + + strings = Xmalloc(size); + pairs = Xcalloc(nEntries, sizeof(XcmsPair)); + + ReadColornameDB(stream, pairs, strings); + (void) fclose(stream); + + /* + * sort the pair recs + */ + qsort((char *)pairs, nEntries, sizeof(XcmsPair), FirstCmp); + + XcmsColorDbState = XcmsDbInitSuccess; + return(XcmsSuccess); +} + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsCopyISOLatin1Lowered + * + * SYNOPSIS + */ +void +_XcmsCopyISOLatin1Lowered( + char *dst, + const char *src) +/* + * DESCRIPTION + * ISO Latin-1 case conversion routine + * Identical to XmuCopyISOLatin1Lowered() but provided here + * to eliminate need to link with libXmu.a. + * + * IMPLEMENTORS NOTE: + * This routine is also used in XcmsFormatOfPrefix. + * + * RETURNS + * Void + * + */ +{ + register unsigned char *dest; + register const unsigned char *source; + + for (dest = (unsigned char *)dst, source = (const unsigned char *)src; + *source; + source++, dest++) + { + if ((*source >= XK_A) && (*source <= XK_Z)) + *dest = *source + (XK_a - XK_A); + else if ((*source >= XK_Agrave) && (*source <= XK_Odiaeresis)) + *dest = *source + (XK_agrave - XK_Agrave); + else if ((*source >= XK_Ooblique) && (*source <= XK_Thorn)) + *dest = *source + (XK_oslash - XK_Ooblique); + else + *dest = *source; + } + *dest = '\0'; +} + + +/* + * NAME + * _XcmsResolveColorString - + * + * SYNOPSIS + */ +Status +_XcmsResolveColorString ( + XcmsCCC ccc, + const char **color_string, + XcmsColor *pColor_exact_return, + XcmsColorFormat result_format) +/* + * DESCRIPTION + * The XcmsLookupColor function finds the color specification + * associated with a color name in the Device-Independent Color + * Name Database. + * RETURNS + * XcmsFailure if failed to convert valid color string. + * XcmsSuccess if succeeded in converting color string to + * XcmsColor. + * _XCMS_NEWNAME if failed to parse the string or find it in + * the database, or if succeeded in looking it up and + * found another name which is not in the database. + * Note that the new name is returned in color_string. + * + * This function returns both the color specification found in the + * database (db specification) and the color specification for the + * color displayable by the specified screen (screen + * specification). The calling routine sets the format for these + * returned specifications in the XcmsColor format component. + * If XcmsUndefinedFormat, the specification is returned in the + * format used to store the color in the database. + */ +{ + XcmsColor dbWhitePt; /* whitePt associated with pColor_exact_return*/ + /* the screen's white point */ + XcmsColor *pClientWhitePt; + int retval; + const char *strptr = whitePtStr; + +/* + * 0. Check for invalid arguments. + */ + if (ccc == NULL || (*color_string)[0] == '\0' || pColor_exact_return == NULL) { + return(XcmsFailure); + } + +/* + * 1. First attempt to parse the string + * If successful, then convert the specification to the target format + * and return. + */ + if (_XcmsParseColorString(ccc, *color_string, pColor_exact_return) + == 1) { + if (result_format != XcmsUndefinedFormat + && pColor_exact_return->format != result_format) { + /* need to be converted to the target format */ + return(XcmsConvertColors(ccc, pColor_exact_return, 1, + result_format, (Bool *)NULL)); + } else { + return(XcmsSuccess); + } + } + +/* + * 2. Attempt to find it in the DI Color Name Database + */ + + /* + * a. Convert String into a XcmsColor structure + * Attempt to extract the specification for color_string from the + * DI Database (pColor_exact_return). If the DI Database does not + * have this entry, then return failure. + */ + retval = _XcmsLookupColorName(ccc, color_string, pColor_exact_return); + + if (retval != XcmsSuccess) { + /* color_string replaced with a color name, or not found */ + return(_XCMS_NEWNAME); + } + + if (pColor_exact_return->format == XcmsUndefinedFormat) { + return(XcmsFailure); + } + + /* + * b. If result_format not defined, then assume target format + * is the exact format. + */ + if (result_format == XcmsUndefinedFormat) { + result_format = pColor_exact_return->format; + } + + if ((ClientWhitePointOfCCC(ccc))->format == XcmsUndefinedFormat) { + pClientWhitePt = ScreenWhitePointOfCCC(ccc); + } else { + pClientWhitePt = ClientWhitePointOfCCC(ccc); + } + + /* + * c. Convert to the target format, making adjustments for white + * point differences as necessary. + */ + if (XCMS_DD_ID(pColor_exact_return->format)) { + /* + * The spec format is Device-Dependent, therefore assume the + * its white point is the Screen White Point. + */ + if (XCMS_DD_ID(result_format)) { + /* + * Target format is Device-Dependent + * Therefore, DD --> DD conversion + */ + return(_XcmsDDConvertColors(ccc, pColor_exact_return, + 1, result_format, (Bool *) NULL)); + } else { + /* + * Target format is Device-Independent + * Therefore, DD --> DI conversion + */ + if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, + pClientWhitePt, ScreenWhitePointOfCCC(ccc))) { + return((*ccc->whitePtAdjProc)(ccc, ScreenWhitePointOfCCC(ccc), + pClientWhitePt, result_format, + pColor_exact_return, 1, (Bool *) NULL)); + } else { + if (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, + XcmsCIEXYZFormat, (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + return(_XcmsDIConvertColors(ccc, pColor_exact_return, + pClientWhitePt, 1, result_format)); + } + } + } else { + /* + * The spec format is Device-Independent, therefore attempt + * to find a database white point. + * + * If the Database does not have a white point, then assume the + * database white point is the same as the Screen White Point. + */ + + if (_XcmsLookupColorName(ccc, &strptr, &dbWhitePt) != 1) { + memcpy((char *)&dbWhitePt, + (char *)&ccc->pPerScrnInfo->screenWhitePt, + sizeof(XcmsColor)); + } + if (XCMS_DD_ID(result_format)) { + /* + * Target format is Device-Dependent + * Therefore, DI --> DD conversion + */ + if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, + &dbWhitePt, ScreenWhitePointOfCCC(ccc))) { + return((*ccc->whitePtAdjProc)(ccc, &dbWhitePt, + ScreenWhitePointOfCCC(ccc), result_format, + pColor_exact_return, 1, (Bool *)NULL)); + } else { + if (pColor_exact_return->format != XcmsCIEXYZFormat) { + if (_XcmsDIConvertColors(ccc, pColor_exact_return, + &dbWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { + return(XcmsFailure); + } + } + return (_XcmsDDConvertColors(ccc, pColor_exact_return, 1, + result_format, (Bool *)NULL)); + } + } else { + /* + * Target format is Device-Independent + * Therefore, DI --> DI conversion + */ + if (ccc->whitePtAdjProc && !_XcmsEqualWhitePts(ccc, + &dbWhitePt, pClientWhitePt)) { + /* + * The calling routine wants to resolve this color + * in terms if it's white point (i.e. Client White Point). + * Therefore, apply white adjustment for the displacement + * between dbWhitePt to clientWhitePt. + */ + return((*ccc->whitePtAdjProc)(ccc, &dbWhitePt, + pClientWhitePt, result_format, + pColor_exact_return, 1, (Bool *)NULL)); + } else if (_XcmsEqualWhitePts(ccc, + &dbWhitePt, pClientWhitePt)) { + /* + * Can use either dbWhitePt or pClientWhitePt to + * convert to the result_format. + */ + if (pColor_exact_return->format == result_format) { + return(XcmsSuccess); + } else { + return (_XcmsDIConvertColors(ccc, pColor_exact_return, + &dbWhitePt, 1, result_format)); + } + } else { + /* + * Need to convert to a white point independent color + * space (let's choose CIEXYZ) then convert to the + * target color space. Why? Lets assume that + * pColor_exact_return->format and result format + * are white point dependent format (e.g., CIELUV, CIELAB, + * TekHVC ... same or any combination). If so, we'll + * need to convert the color with dbWhitePt to an absolute + * spec (i.e. non-white point dependent) then convert that + * absolute value with clientWhitePt to the result_format. + */ + if (pColor_exact_return->format != XcmsCIEXYZFormat) { + if (_XcmsDIConvertColors(ccc, pColor_exact_return, + &dbWhitePt, 1, XcmsCIEXYZFormat) == XcmsFailure) { + return(XcmsFailure); + } + } + if (result_format == XcmsCIEXYZFormat) { + return(XcmsSuccess); + } else { + return(_XcmsDIConvertColors(ccc, pColor_exact_return, + pClientWhitePt, 1, result_format)); + } + } + } + } +} diff --git a/nx-X11/lib/src/xcms/cmsGlobls.c b/nx-X11/lib/src/xcms/cmsGlobls.c new file mode 100644 index 000000000..c9e82f242 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsGlobls.c @@ -0,0 +1,126 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsGlobls.c + * + * DESCRIPTION + * Source file containing Xcms globals + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * GLOBALS + * Variables declared in this package that are allowed + * to be used globally. + */ + + /* + * Initial array of Device Independent Color Spaces + */ +XcmsColorSpace *_XcmsDIColorSpacesInit[] = { + &XcmsCIEXYZColorSpace, + &XcmsCIEuvYColorSpace, + &XcmsCIExyYColorSpace, + &XcmsCIELabColorSpace, + &XcmsCIELuvColorSpace, + &XcmsTekHVCColorSpace, + &XcmsUNDEFINEDColorSpace, + NULL +}; + /* + * Pointer to the array of pointers to XcmsColorSpace structures for + * Device-Independent Color Spaces that are currently accessible by + * the color management system. End of list is indicated by a NULL pointer. + */ +XcmsColorSpace **_XcmsDIColorSpaces = _XcmsDIColorSpacesInit; + + /* + * Initial array of Device Dependent Color Spaces + */ +XcmsColorSpace *_XcmsDDColorSpacesInit[] = { + &XcmsRGBColorSpace, + &XcmsRGBiColorSpace, + NULL +}; + /* + * Pointer to the array of pointers to XcmsColorSpace structures for + * Device-Dependent Color Spaces that are currently accessible by + * the color management system. End of list is indicated by a NULL pointer. + */ +XcmsColorSpace **_XcmsDDColorSpaces = &_XcmsDDColorSpacesInit[0]; + + /* + * Initial array of Screen Color Characterization Function Sets + */ +XcmsFunctionSet *_XcmsSCCFuncSetsInit[] = { + &XcmsLinearRGBFunctionSet, +#ifdef GRAY + &XcmsGrayFunctionSet, +#endif /* GRAY */ + NULL}; + /* + * Pointer to the array of pointers to XcmsSCCFuncSet structures + * (Screen Color Characterization Function Sets) that are currently + * accessible by the color management system. End of list is + * indicated by a NULL pointer. + */ +XcmsFunctionSet **_XcmsSCCFuncSets = _XcmsSCCFuncSetsInit; + + /* + * X Consortium Registered Device-Independent Color Spaces + * Note that prefix must be in lowercase. + */ +const char _XcmsCIEXYZ_prefix[] = "ciexyz"; +const char _XcmsCIEuvY_prefix[] = "cieuvy"; +const char _XcmsCIExyY_prefix[] = "ciexyy"; +const char _XcmsCIELab_prefix[] = "cielab"; +const char _XcmsCIELuv_prefix[] = "cieluv"; +const char _XcmsTekHVC_prefix[] = "tekhvc"; + /* + * Registered Device-Dependent Color Spaces + */ +const char _XcmsRGBi_prefix[] = "rgbi"; +const char _XcmsRGB_prefix[] = "rgb"; + +XcmsRegColorSpaceEntry _XcmsRegColorSpaces[] = { + { _XcmsCIEXYZ_prefix, XcmsCIEXYZFormat }, + { _XcmsCIEuvY_prefix, XcmsCIEuvYFormat }, + { _XcmsCIExyY_prefix, XcmsCIExyYFormat }, + { _XcmsCIELab_prefix, XcmsCIELabFormat }, + { _XcmsCIELuv_prefix, XcmsCIELuvFormat }, + { _XcmsTekHVC_prefix, XcmsTekHVCFormat }, + { _XcmsRGB_prefix, XcmsRGBFormat }, + { _XcmsRGBi_prefix, XcmsRGBiFormat }, + { NULL, 0 } +}; diff --git a/nx-X11/lib/src/xcms/cmsInt.c b/nx-X11/lib/src/xcms/cmsInt.c new file mode 100644 index 000000000..f4aef04ff --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsInt.c @@ -0,0 +1,411 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsInt.c - Xcms API utility routines + * + * DESCRIPTION + * Xcms Application Program Interface (API) utility + * routines for hanging information directly onto + * the Display structure. + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +#ifndef XCMSCOMPPROC +# define XCMSCOMPPROC XcmsTekHVCClipC +#endif + +/* forward/static */ +static void _XcmsFreeDefaultCCCs(Display *dpy); + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * _XcmsCopyPointerArray + * + * SYNOPSIS + */ +XPointer * +_XcmsCopyPointerArray( + XPointer *pap) +/* + * DESCRIPTION + * Copies an array of NULL terminated pointers. + * + * RETURNS + * Returns NULL if failed; otherwise the address to + * the copy. + * + */ +{ + XPointer *newArray; + char **tmp; + int n; + + for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); + n++; /* add 1 to include the NULL pointer */ + + if ((newArray = Xmalloc(n * sizeof(XPointer)))) { + memcpy((char *)newArray, (char *)pap, + (unsigned)(n * sizeof(XPointer))); + } + return((XPointer *)newArray); +} + +/* + * NAME + * _XcmsFreePointerArray + * + * SYNOPSIS + */ +void +_XcmsFreePointerArray( + XPointer *pap) +/* + * DESCRIPTION + * Frees an array of NULL terminated pointers. + * + * RETURNS + * void + * + */ +{ + Xfree(pap); +} + +/* + * NAME + * _XcmsPushPointerArray + * + * SYNOPSIS + */ +XPointer * +_XcmsPushPointerArray( + XPointer *pap, + XPointer p, + XPointer *papNoFree) +/* + * DESCRIPTION + * Places the specified pointer at the head of an array of NULL + * terminated pointers. + * + * RETURNS + * Returns NULL if failed; otherwise the address to + * the head of the array. + * + */ +{ + XPointer *newArray; + char **tmp; + int n; + + for (tmp = pap, n = 0; *tmp != NULL; tmp++, n++); + + /* add 2: 1 for the new pointer and another for the NULL pointer */ + n += 2; + + if ((newArray = Xmalloc(n * sizeof(XPointer)))) { + memcpy((char *)(newArray+1),(char *)pap, + (unsigned)((n-1) * sizeof(XPointer))); + *newArray = p; + } + if (pap != papNoFree) { + _XcmsFreePointerArray(pap); + } + return((XPointer *)newArray); +} + +/* + * NAME + * _XcmsInitDefaultCCCs + * + * SYNOPSIS + */ +int +_XcmsInitDefaultCCCs( + Display *dpy) +/* + * DESCRIPTION + * Initializes the Xcms per Display Info structure + * (XcmsPerDpyInfo). + * + * RETURNS + * Returns 0 if failed; otherwise non-zero. + * + */ +{ + int nScrn = ScreenCount(dpy); + int i; + XcmsCCC ccc; + + if (nScrn <= 0) { + return(0); + } + + /* + * Create an array of XcmsCCC structures, one for each screen. + * They serve as the screen's default CCC. + */ + if (!(ccc = Xcalloc((unsigned)nScrn, sizeof(XcmsCCCRec)))) { + return(0); + } + dpy->cms.defaultCCCs = (XPointer)ccc; + dpy->free_funcs->defaultCCCs = _XcmsFreeDefaultCCCs; + + for (i = 0; i < nScrn; i++, ccc++) { + ccc->dpy = dpy; + ccc->screenNumber = i; + ccc->visual = DefaultVisual(dpy, i); + /* + * Used calloc to allocate memory so: + * ccc->clientWhitePt->format == XcmsUndefinedFormat + * ccc->gamutCompProc == NULL + * ccc->whitePtAdjProc == NULL + * ccc->pPerScrnInfo = NULL + * + * Don't need to create XcmsPerScrnInfo and its functionSet and + * pScreenData components until the default CCC is accessed. + * Note that the XcmsDefaultCCC routine calls _XcmsInitScrnInto + * to do this. + */ + ccc->gamutCompProc = XCMSCOMPPROC; + } + + return(1); +} + + +/* + * NAME + * _XcmsFreeDefaultCCCs - Free Default CCCs and its PerScrnInfo + * + * SYNOPSIS + */ +static void +_XcmsFreeDefaultCCCs( + Display *dpy) +/* + * DESCRIPTION + * This routine frees the default XcmsCCC's associated with + * each screen and its associated substructures as neccessary. + * + * RETURNS + * void + * + * + */ +{ + int nScrn = ScreenCount(dpy); + XcmsCCC ccc; + int i; + + /* + * Free Screen data in each DefaultCCC + * Do not use XcmsFreeCCC here because it will not free + * DefaultCCC's. + */ + ccc = (XcmsCCC)dpy->cms.defaultCCCs; + for (i = nScrn; i--; ccc++) { + /* + * Check if XcmsPerScrnInfo exists. + * + * This is the only place where XcmsPerScrnInfo structures + * are freed since there is only one allocated per Screen. + * It just so happens that we place its reference in the + * default CCC. + */ + if (ccc->pPerScrnInfo) { + /* Check if SCCData exists */ + if (ccc->pPerScrnInfo->state != XcmsInitNone + && ccc->pPerScrnInfo->screenData) { + (*((XcmsFunctionSet *)ccc->pPerScrnInfo->functionSet)->screenFreeProc) + (ccc->pPerScrnInfo->screenData); + } + Xfree(ccc->pPerScrnInfo); + } + } + + /* + * Free the array of XcmsCCC structures + */ + Xfree(dpy->cms.defaultCCCs); + dpy->cms.defaultCCCs = (XPointer)NULL; +} + + + +/* + * NAME + * _XcmsInitScrnInfo + * + * SYNOPSIS + */ +int +_XcmsInitScrnInfo( + register Display *dpy, + int screenNumber) +/* + * DESCRIPTION + * Given a display and screen number, this routine attempts + * to initialize the Xcms per Screen Info structure + * (XcmsPerScrnInfo). + * + * RETURNS + * Returns zero if initialization failed; non-zero otherwise. + */ +{ + XcmsFunctionSet **papSCCFuncSet = _XcmsSCCFuncSets; + XcmsCCC defaultccc; + + /* + * Check if the XcmsCCC's for each screen has been created. + * Really dont need to be created until some routine uses the Xcms + * API routines. + */ + if ((XcmsCCC)dpy->cms.defaultCCCs == NULL) { + if (!_XcmsInitDefaultCCCs(dpy)) { + return(0); + } + } + + defaultccc = (XcmsCCC)dpy->cms.defaultCCCs + screenNumber; + + /* + * For each SCCFuncSet, try its pInitScrnFunc. + * If the function succeeds, then we got it! + */ + + if (!defaultccc->pPerScrnInfo) { + /* + * This is one of two places where XcmsPerScrnInfo structures + * are allocated. There is one allocated per Screen that is + * shared among visuals that do not have specific intensity + * tables. Other XcmsPerScrnInfo structures are created + * for the latter (see XcmsCreateCCC). The ones created + * here are referenced by the default CCC. + */ + if (!(defaultccc->pPerScrnInfo = + Xcalloc(1, sizeof(XcmsPerScrnInfo)))) { + return(0); + } + defaultccc->pPerScrnInfo->state = XcmsInitNone; + } + + while (*papSCCFuncSet != NULL) { + if ((*(*papSCCFuncSet)->screenInitProc)(dpy, screenNumber, + defaultccc->pPerScrnInfo)) { + defaultccc->pPerScrnInfo->state = XcmsInitSuccess; + return(1); + } + papSCCFuncSet++; + } + + /* + * Use Default SCCData + */ + return(_XcmsLRGB_InitScrnDefault(dpy, screenNumber, defaultccc->pPerScrnInfo)); +} + + +/* + * NAME + * _XcmsFreeIntensityMaps + * + * SYNOPSIS + */ +void +_XcmsFreeIntensityMaps( + Display *dpy) +/* + * DESCRIPTION + * Frees all XcmsIntensityMap structures in the linked list + * and sets dpy->cms.perVisualIntensityMaps to NULL. + * + * RETURNS + * void + * + */ +{ + XcmsIntensityMap *pNext, *pFree; + + pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; + while (pNext != NULL) { + pFree = pNext; + pNext = pNext->pNext; + (*pFree->pFreeScreenData)(pFree->screenData); + /* Now free the XcmsIntensityMap structure */ + Xfree(pFree); + } + dpy->cms.perVisualIntensityMaps = (XPointer)NULL; +} + + +/* + * NAME + * _XcmsGetIntensityMap + * + * SYNOPSIS + */ +XcmsIntensityMap * +_XcmsGetIntensityMap( + Display *dpy, + Visual *visual) +/* + * DESCRIPTION + * Attempts to return a per-Visual intensity map. + * + * RETURNS + * Pointer to the XcmsIntensityMap structure if found; + * otherwise NULL + * + */ +{ + VisualID targetID = visual->visualid; + XcmsIntensityMap *pNext; + + pNext = (XcmsIntensityMap *)dpy->cms.perVisualIntensityMaps; + while (pNext != NULL) { + if (targetID == pNext->visualID) { + return(pNext); + } + pNext = pNext->pNext; + } + return((XcmsIntensityMap *)NULL); +} diff --git a/nx-X11/lib/src/xcms/cmsLkCol.c b/nx-X11/lib/src/xcms/cmsLkCol.c new file mode 100644 index 000000000..15e987424 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsLkCol.c @@ -0,0 +1,193 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * XcmsLkCol.c + * + * DESCRIPTION + * Source for XcmsLookupColor + * + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/* + * NAME + * XcmsLookupColor - + * + * SYNOPSIS + */ +Status +XcmsLookupColor ( + Display *dpy, + Colormap cmap, + _Xconst char *colorname, + XcmsColor *pColor_exact_return, + XcmsColor *pColor_scrn_return, + XcmsColorFormat result_format) +/* + * DESCRIPTION + * The XcmsLookupColor function finds the color specification + * associated with a color name in the Device-Independent Color + * Name Database. + * RETURNS + * This function returns both the color specification found in the + * database (db specification) and the color specification for the + * color displayable by the specified screen (screen + * specification). The calling routine sets the format for these + * returned specifications in the XcmsColor format component. + * If XcmsUndefinedFormat, the specification is returned in the + * format used to store the color in the database. + */ +{ + Status retval1 = XcmsSuccess; + Status retval2 = XcmsSuccess; + XcmsCCC ccc; + register int n; + xLookupColorReply reply; + register xLookupColorReq *req; + XColor def, scr; + +/* + * 0. Check for invalid arguments. + */ + if (dpy == NULL || colorname[0] == '\0' || pColor_scrn_return == 0 + || pColor_exact_return == NULL) { + return(XcmsFailure); + } + + if ((ccc = XcmsCCCOfColormap(dpy, cmap)) == (XcmsCCC)NULL) { + return(XcmsFailure); + } + +/* + * 1. Convert string to a XcmsColor + */ + if ((retval1 = _XcmsResolveColorString(ccc, &colorname, + pColor_exact_return, result_format)) == XcmsFailure) { + return(XcmsFailure); + } + if (retval1 == _XCMS_NEWNAME) { + goto PassToServer; + } + +/* + * 2. pColor_scrn_return + * Assume the pColor_exact_return has already been adjusted to + * the Client White Point. + * + */ + /* + * Convert to RGB, adjusting for white point differences if necessary. + */ + memcpy((char *)pColor_scrn_return, (char *)pColor_exact_return, + sizeof(XcmsColor)); + if (pColor_scrn_return->format == XcmsRGBFormat) { + retval2 = XcmsSuccess; + } else if ((retval2 = XcmsConvertColors(ccc, pColor_scrn_return, 1, + XcmsRGBFormat, (Bool *)NULL)) == XcmsFailure) { + return(XcmsFailure); + } + + /* + * Then, convert XcmsColor structure to the target specification + * format. Note that we must use NULL instead of passing + * pCompressed. + */ + + if (result_format == XcmsUndefinedFormat) { + result_format = pColor_exact_return->format; + } + if (result_format == XcmsRGBFormat) { + _XcmsUnresolveColor(ccc, pColor_scrn_return); + } else { + _XcmsResolveColor(ccc, pColor_scrn_return); + if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + + return(retval1 > retval2 ? retval1 : retval2); + +PassToServer: + /* + * Xcms and i18n methods failed, so lets pass it to the server + * for parsing. + */ + + LockDisplay(dpy); + GetReq (LookupColor, req); + req->cmap = cmap; + req->nbytes = n = strlen(colorname); + req->length += (n + 3) >> 2; + Data (dpy, colorname, (long)n); + if (!_XReply (dpy, (xReply *) &reply, 0, xTrue)) { + UnlockDisplay(dpy); + SyncHandle(); + return (XcmsFailure); + } + def.red = reply.exactRed; + def.green = reply.exactGreen; + def.blue = reply.exactBlue; + + scr.red = reply.screenRed; + scr.green = reply.screenGreen; + scr.blue = reply.screenBlue; + + UnlockDisplay(dpy); + SyncHandle(); + + _XColor_to_XcmsRGB(ccc, &def, pColor_exact_return, 1); + _XColor_to_XcmsRGB(ccc, &scr, pColor_scrn_return, 1); + + /* + * Then, convert XcmsColor structure to the target specification + * format. Note that we must use NULL instead of passing + * pCompressed. + */ + + if (result_format != XcmsRGBFormat + && result_format != XcmsUndefinedFormat) { + if (XcmsConvertColors(ccc, pColor_exact_return, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + if (XcmsConvertColors(ccc, pColor_scrn_return, 1, result_format, + (Bool *) NULL) == XcmsFailure) { + return(XcmsFailure); + } + } + + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/cmsMath.c b/nx-X11/lib/src/xcms/cmsMath.c new file mode 100644 index 000000000..487eb3f9c --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsMath.c @@ -0,0 +1,140 @@ + +/* + +Copyright 1990, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + +*/ + +/* + * Stephen Gildea, MIT X Consortium, January 1991 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xcmsint.h" + +#ifdef DEBUG +#include +#endif + +#include +#ifndef DBL_EPSILON +#define DBL_EPSILON 1e-6 +#endif + +#ifdef _X_ROOT_STATS +int cbrt_loopcount; +int sqrt_loopcount; +#endif + +/* Newton's Method: x_n+1 = x_n - ( f(x_n) / f'(x_n) ) */ + + +/* for cube roots, x^3 - a = 0, x_new = x - 1/3 (x - a/x^2) */ + +double +_XcmsCubeRoot(double a) +{ + register double abs_a, cur_guess, delta; + +#ifdef DEBUG + printf("_XcmsCubeRoot passed in %g\n", a); +#endif +#ifdef _X_ROOT_STATS + cbrt_loopcount = 0; +#endif + if (a == 0.) + return 0.; + + abs_a = a<0. ? -a : a; /* convert to positive to speed loop tests */ + + /* arbitrary first guess */ + if (abs_a > 1.) + cur_guess = abs_a/8.; + else + cur_guess = abs_a*8.; + + do { +#ifdef _X_ROOT_STATS + cbrt_loopcount++; +#endif + delta = (cur_guess - abs_a/(cur_guess*cur_guess))/3.; + cur_guess -= delta; + if (delta < 0.) delta = -delta; + } while (delta >= cur_guess*DBL_EPSILON); + + if (a < 0.) + cur_guess = -cur_guess; + +#ifdef DEBUG + printf("_XcmsCubeRoot returning %g\n", cur_guess); +#endif + return cur_guess; +} + + + +/* for square roots, x^2 - a = 0, x_new = x - 1/2 (x - a/x) */ + +double +_XcmsSquareRoot(double a) +{ + register double cur_guess, delta; + +#ifdef DEBUG + printf("_XcmsSquareRoot passed in %g\n", a); +#endif +#ifdef _X_ROOT_STATS + sqrt_loopcount = 0; +#endif + if (a == 0.) + return 0.; + + if (a < 0.) { + /* errno = EDOM; */ + return 0.; + } + + /* arbitrary first guess */ + if (a > 1.) + cur_guess = a/4.; + else + cur_guess = a*4.; + + do { +#ifdef _X_ROOT_STATS + sqrt_loopcount++; +#endif + delta = (cur_guess - a/cur_guess)/2.; + cur_guess -= delta; + if (delta < 0.) delta = -delta; + } while (delta >= cur_guess*DBL_EPSILON); + +#ifdef DEBUG + printf("_XcmsSquareRoot returning %g\n", cur_guess); +#endif + return cur_guess; +} + diff --git a/nx-X11/lib/src/xcms/cmsProp.c b/nx-X11/lib/src/xcms/cmsProp.c new file mode 100644 index 000000000..a7aa5b5c5 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsProp.c @@ -0,0 +1,153 @@ + +/* + * + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * XcmsProp.c + * + * DESCRIPTION + * This utility routines for manipulating properties. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + + +/************************************************************************ + * * + * API PRIVATE ROUTINES * + * * + ************************************************************************/ + + +/* + * NAME + * _XcmsGetElement -- get an element value from the property passed + * + * SYNOPSIS + */ +unsigned long +_XcmsGetElement( + int format, + char **pValue, + unsigned long *pCount) +/* + * DESCRIPTION + * Get the next element from the property and return it. + * Also increment the pointer the amount needed. + * + * Returns + * unsigned long + */ +{ + unsigned long value; + + switch (format) { + case 32: + value = *((unsigned long *)(*pValue)) & 0xFFFFFFFF; + *pValue += sizeof(unsigned long); + *pCount -= 1; + break; + case 16: + value = *((unsigned short *)(*pValue)); + *pValue += sizeof(unsigned short); + *pCount -= 1; + break; + case 8: + value = *((unsigned char *) (*pValue)); + *pValue += 1; + *pCount -= 1; + break; + default: + value = 0; + break; + } + return(value); +} + + +/* + * NAME + * _XcmsGetProperty -- Determine the existance of a property + * + * SYNOPSIS + */ +int +_XcmsGetProperty( + Display *pDpy, + Window w, + Atom property, + int *pFormat, + unsigned long *pNItems, + unsigned long *pNBytes, + char **pValue) +/* + * DESCRIPTION + * + * Returns + * 0 if property does not exist. + * 1 if property exists. + */ +{ + char *prop_ret; + int format_ret; + long len = 6516; + #ifdef NXAGENT_SERVER + unsigned long nitems_ret, after_ret = 0; + #else + unsigned long nitems_ret, after_ret; + #endif + Atom atom_ret; + int xgwp_ret; + + while (True) { + xgwp_ret = XGetWindowProperty (pDpy, w, property, 0, len, False, + XA_INTEGER, &atom_ret, &format_ret, + &nitems_ret, &after_ret, + (unsigned char **)&prop_ret); + if (xgwp_ret == Success && after_ret > 0) { + len += nitems_ret * (format_ret >> 3); + XFree (prop_ret); + } else { + break; + } + } + if (xgwp_ret != Success || format_ret == 0 || nitems_ret == 0) { + /* the property does not exist or is of an unexpected type or + getting window property failed */ + return(XcmsFailure); + } + + *pFormat = format_ret; + *pNItems = nitems_ret; + *pNBytes = nitems_ret * (format_ret >> 3); + *pValue = prop_ret; + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/cmsTrig.c b/nx-X11/lib/src/xcms/cmsTrig.c new file mode 100644 index 000000000..b23033aa8 --- /dev/null +++ b/nx-X11/lib/src/xcms/cmsTrig.c @@ -0,0 +1,578 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + */ + +/* + * It should be pointed out that for simplicity's sake, the + * environment parameters are defined as floating point constants, + * rather than octal or hexadecimal initializations of allocated + * storage areas. This means that the range of allowed numbers + * may not exactly match the hardware's capabilities. For example, + * if the maximum positive double precision floating point number + * is EXACTLY 1.11...E100 and the constant "MAXDOUBLE is + * defined to be 1.11E100 then the numbers between 1.11E100 and + * 1.11...E100 are considered to be undefined. For most + * applications, this will cause no problems. + * + * An alternate method is to allocate a global static "double" variable, + * say "maxdouble", and use a union declaration and initialization + * to initialize it with the proper bits for the EXACT maximum value. + * This was not done because the only compilers available to the + * author did not fully support union initialization features. + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xcmsint.h" + +/* forward/static */ +static double _XcmsModulo(double value, double base); +static double _XcmsPolynomial( + register int order, + double const *coeffs, + double x); +static double +_XcmsModuloF( + double val, + register double *dp); + +/* + * DEFINES + */ +#define XCMS_MAXERROR 0.000001 +#define XCMS_MAXITER 10000 +#define XCMS_PI 3.14159265358979323846264338327950 +#define XCMS_TWOPI 6.28318530717958620 +#define XCMS_HALFPI 1.57079632679489660 +#define XCMS_FOURTHPI 0.785398163397448280 +#define XCMS_SIXTHPI 0.523598775598298820 +#define XCMS_RADIANS(d) ((d) * XCMS_PI / 180.0) +#define XCMS_DEGREES(r) ((r) * 180.0 / XCMS_PI) +#define XCMS_X6_UNDERFLOWS (4.209340e-52) /* X**6 almost underflows */ +#define XCMS_X16_UNDERFLOWS (5.421010e-20) /* X**16 almost underflows*/ +#define XCMS_CHAR_BIT 8 +#define XCMS_LONG_MAX 0x7FFFFFFF +#define XCMS_DEXPLEN 11 +#define XCMS_NBITS(type) (XCMS_CHAR_BIT * (int)sizeof(type)) +#define XCMS_FABS(x) ((x) < 0.0 ? -(x) : (x)) + +/* XCMS_DMAXPOWTWO - largest power of two exactly representable as a double */ +#define XCMS_DMAXPOWTWO ((double)(XCMS_LONG_MAX) * \ + (1L << ((XCMS_NBITS(double)-XCMS_DEXPLEN) - XCMS_NBITS(int) + 1))) + +/* + * LOCAL VARIABLES + */ + +static double const cos_pcoeffs[] = { + 0.12905394659037374438e7, + -0.37456703915723204710e6, + 0.13432300986539084285e5, + -0.11231450823340933092e3 +}; + +static double const cos_qcoeffs[] = { + 0.12905394659037373590e7, + 0.23467773107245835052e5, + 0.20969518196726306286e3, + 1.0 +}; + +static double const sin_pcoeffs[] = { + 0.20664343336995858240e7, + -0.18160398797407332550e6, + 0.35999306949636188317e4, + -0.20107483294588615719e2 +}; + +static double const sin_qcoeffs[] = { + 0.26310659102647698963e7, + 0.39270242774649000308e5, + 0.27811919481083844087e3, + 1.0 +}; + +/* + * + * FUNCTION + * + * _XcmsCosine double precision cosine + * + * KEY WORDS + * + * cos + * machine independent routines + * trigonometric functions + * math libraries + * + * DESCRIPTION + * + * Returns double precision cosine of double precision + * floating point argument. + * + * USAGE + * + * double _XcmsCosine (x) + * double x; + * + * REFERENCES + * + * Computer Approximations, J.F. Hart et al, John Wiley & Sons, + * 1968, pp. 112-120. + * + * RESTRICTIONS + * + * The sin and cos routines are interactive in the sense that + * in the process of reducing the argument to the range -PI/4 + * to PI/4, each may call the other. Ultimately one or the + * other uses a polynomial approximation on the reduced + * argument. The sin approximation has a maximum relative error + * of 10**(-17.59) and the cos approximation has a maximum + * relative error of 10**(-16.18). + * + * These error bounds assume exact arithmetic + * in the polynomial evaluation. Additional rounding and + * truncation errors may occur as the argument is reduced + * to the range over which the polynomial approximation + * is valid, and as the polynomial is evaluated using + * finite-precision arithmetic. + * + * PROGRAMMER + * + * Fred Fish + * + * INTERNALS + * + * Computes cos(x) from: + * + * (1) Reduce argument x to range -PI to PI. + * + * (2) If x > PI/2 then call cos recursively + * using relation cos(x) = -cos(x - PI). + * + * (3) If x < -PI/2 then call cos recursively + * using relation cos(x) = -cos(x + PI). + * + * (4) If x > PI/4 then call sin using + * relation cos(x) = sin(PI/2 - x). + * + * (5) If x < -PI/4 then call cos using + * relation cos(x) = sin(PI/2 + x). + * + * (6) If x would cause underflow in approx + * evaluation arithmetic then return + * sqrt(1.0 - x**2). + * + * (7) By now x has been reduced to range + * -PI/4 to PI/4 and the approximation + * from HART pg. 119 can be used: + * + * cos(x) = ( p(y) / q(y) ) + * Where: + * + * y = x * (4/PI) + * + * p(y) = SUM [ Pj * (y**(2*j)) ] + * over j = {0,1,2,3} + * + * q(y) = SUM [ Qj * (y**(2*j)) ] + * over j = {0,1,2,3} + * + * P0 = 0.12905394659037374438571854e+7 + * P1 = -0.3745670391572320471032359e+6 + * P2 = 0.134323009865390842853673e+5 + * P3 = -0.112314508233409330923e+3 + * Q0 = 0.12905394659037373590295914e+7 + * Q1 = 0.234677731072458350524124e+5 + * Q2 = 0.2096951819672630628621e+3 + * Q3 = 1.0000... + * (coefficients from HART table #3843 pg 244) + * + * + * **** NOTE **** The range reduction relations used in + * this routine depend on the final approximation being valid + * over the negative argument range in addition to the positive + * argument range. The particular approximation chosen from + * HART satisfies this requirement, although not explicitly + * stated in the text. This may not be true of other + * approximations given in the reference. + * + */ + +double _XcmsCosine(double x) +{ + auto double y; + auto double yt2; + double retval; + + if (x < -XCMS_PI || x > XCMS_PI) { + x = _XcmsModulo (x, XCMS_TWOPI); + if (x > XCMS_PI) { + x = x - XCMS_TWOPI; + } else if (x < -XCMS_PI) { + x = x + XCMS_TWOPI; + } + } + if (x > XCMS_HALFPI) { + retval = -(_XcmsCosine (x - XCMS_PI)); + } else if (x < -XCMS_HALFPI) { + retval = -(_XcmsCosine (x + XCMS_PI)); + } else if (x > XCMS_FOURTHPI) { + retval = _XcmsSine (XCMS_HALFPI - x); + } else if (x < -XCMS_FOURTHPI) { + retval = _XcmsSine (XCMS_HALFPI + x); + } else if (x < XCMS_X6_UNDERFLOWS && x > -XCMS_X6_UNDERFLOWS) { + retval = _XcmsSquareRoot (1.0 - (x * x)); + } else { + y = x / XCMS_FOURTHPI; + yt2 = y * y; + retval = _XcmsPolynomial (3, cos_pcoeffs, yt2) / _XcmsPolynomial (3, cos_qcoeffs, yt2); + } + return (retval); +} + + +/* + * FUNCTION + * + * _XcmsModulo double precision modulo + * + * KEY WORDS + * + * _XcmsModulo + * machine independent routines + * math libraries + * + * DESCRIPTION + * + * Returns double precision modulo of two double + * precision arguments. + * + * USAGE + * + * double _XcmsModulo (value, base) + * double value; + * double base; + * + * PROGRAMMER + * + * Fred Fish + * + */ +static double _XcmsModulo(double value, double base) +{ + auto double intpart; + + value /= base; + value = _XcmsModuloF (value, &intpart); + value *= base; + return(value); +} + + +/* + * frac = (double) _XcmsModuloF(double val, double *dp) + * return fractional part of 'val' + * set *dp to integer part of 'val' + * + * Note -> only compiled for the CA or KA. For the KB/MC, + * "math.c" instantiates a copy of the inline function + * defined in "math.h". + */ +static double +_XcmsModuloF( + double val, + register double *dp) +{ + register double abs; + /* + * Don't use a register for this. The extra precision this results + * in on some systems causes problems. + */ + double ip; + + /* should check for illegal values here - nan, inf, etc */ + abs = XCMS_FABS(val); + if (abs >= XCMS_DMAXPOWTWO) { + ip = val; + } else { + ip = abs + XCMS_DMAXPOWTWO; /* dump fraction */ + ip -= XCMS_DMAXPOWTWO; /* restore w/o frac */ + if (ip > abs) /* if it rounds up */ + ip -= 1.0; /* fix it */ + ip = XCMS_FABS(ip); + } + *dp = ip; + return (val - ip); /* signed fractional part */ +} + + +/* + * FUNCTION + * + * _XcmsPolynomial double precision polynomial evaluation + * + * KEY WORDS + * + * poly + * machine independent routines + * math libraries + * + * DESCRIPTION + * + * Evaluates a polynomial and returns double precision + * result. Is passed a the order of the polynomial, + * a pointer to an array of double precision polynomial + * coefficients (in ascending order), and the independent + * variable. + * + * USAGE + * + * double _XcmsPolynomial (order, coeffs, x) + * int order; + * double *coeffs; + * double x; + * + * PROGRAMMER + * + * Fred Fish + * + * INTERNALS + * + * Evalates the polynomial using recursion and the form: + * + * P(x) = P0 + x(P1 + x(P2 +...x(Pn))) + * + */ + +static double _XcmsPolynomial( + register int order, + double const *coeffs, + double x) +{ + auto double rtn_value; + + coeffs += order; + rtn_value = *coeffs--; + while(order-- > 0) + rtn_value = *coeffs-- + (x * rtn_value); + + return(rtn_value); +} + + +/* + * FUNCTION + * + * _XcmsSine double precision sine + * + * KEY WORDS + * + * sin + * machine independent routines + * trigonometric functions + * math libraries + * + * DESCRIPTION + * + * Returns double precision sine of double precision + * floating point argument. + * + * USAGE + * + * double _XcmsSine (x) + * double x; + * + * REFERENCES + * + * Computer Approximations, J.F. Hart et al, John Wiley & Sons, + * 1968, pp. 112-120. + * + * RESTRICTIONS + * + * The sin and cos routines are interactive in the sense that + * in the process of reducing the argument to the range -PI/4 + * to PI/4, each may call the other. Ultimately one or the + * other uses a polynomial approximation on the reduced + * argument. The sin approximation has a maximum relative error + * of 10**(-17.59) and the cos approximation has a maximum + * relative error of 10**(-16.18). + * + * These error bounds assume exact arithmetic + * in the polynomial evaluation. Additional rounding and + * truncation errors may occur as the argument is reduced + * to the range over which the polynomial approximation + * is valid, and as the polynomial is evaluated using + * finite-precision arithmetic. + * + * PROGRAMMER + * + * Fred Fish + * + * INTERNALS + * + * Computes sin(x) from: + * + * (1) Reduce argument x to range -PI to PI. + * + * (2) If x > PI/2 then call sin recursively + * using relation sin(x) = -sin(x - PI). + * + * (3) If x < -PI/2 then call sin recursively + * using relation sin(x) = -sin(x + PI). + * + * (4) If x > PI/4 then call cos using + * relation sin(x) = cos(PI/2 - x). + * + * (5) If x < -PI/4 then call cos using + * relation sin(x) = -cos(PI/2 + x). + * + * (6) If x is small enough that polynomial + * evaluation would cause underflow + * then return x, since sin(x) + * approaches x as x approaches zero. + * + * (7) By now x has been reduced to range + * -PI/4 to PI/4 and the approximation + * from HART pg. 118 can be used: + * + * sin(x) = y * ( p(y) / q(y) ) + * Where: + * + * y = x * (4/PI) + * + * p(y) = SUM [ Pj * (y**(2*j)) ] + * over j = {0,1,2,3} + * + * q(y) = SUM [ Qj * (y**(2*j)) ] + * over j = {0,1,2,3} + * + * P0 = 0.206643433369958582409167054e+7 + * P1 = -0.18160398797407332550219213e+6 + * P2 = 0.359993069496361883172836e+4 + * P3 = -0.2010748329458861571949e+2 + * Q0 = 0.263106591026476989637710307e+7 + * Q1 = 0.3927024277464900030883986e+5 + * Q2 = 0.27811919481083844087953e+3 + * Q3 = 1.0000... + * (coefficients from HART table #3063 pg 234) + * + * + * **** NOTE **** The range reduction relations used in + * this routine depend on the final approximation being valid + * over the negative argument range in addition to the positive + * argument range. The particular approximation chosen from + * HART satisfies this requirement, although not explicitly + * stated in the text. This may not be true of other + * approximations given in the reference. + * + */ + +double +_XcmsSine (double x) +{ + double y; + double yt2; + double retval; + + if (x < -XCMS_PI || x > XCMS_PI) { + x = _XcmsModulo (x, XCMS_TWOPI); + if (x > XCMS_PI) { + x = x - XCMS_TWOPI; + } else if (x < -XCMS_PI) { + x = x + XCMS_TWOPI; + } + } + if (x > XCMS_HALFPI) { + retval = -(_XcmsSine (x - XCMS_PI)); + } else if (x < -XCMS_HALFPI) { + retval = -(_XcmsSine (x + XCMS_PI)); + } else if (x > XCMS_FOURTHPI) { + retval = _XcmsCosine (XCMS_HALFPI - x); + } else if (x < -XCMS_FOURTHPI) { + retval = -(_XcmsCosine (XCMS_HALFPI + x)); + } else if (x < XCMS_X6_UNDERFLOWS && x > -XCMS_X6_UNDERFLOWS) { + retval = x; + } else { + y = x / XCMS_FOURTHPI; + yt2 = y * y; + retval = y * (_XcmsPolynomial (3, sin_pcoeffs, yt2) / _XcmsPolynomial(3, sin_qcoeffs, yt2)); + } + return(retval); +} + + +/* + * NAME + * _XcmsArcTangent + * + * SYNOPSIS + */ +double +_XcmsArcTangent(double x) +/* + * DESCRIPTION + * Computes the arctangent. + * This is an implementation of the Gauss algorithm as + * described in: + * Forman S. Acton, Numerical Methods That Work, + * New York, NY, Harper & Row, 1970. + * + * RETURNS + * Returns the arctangent + */ +{ + double ai, a1 = 0.0, bi, b1 = 0.0, l, d; + double maxerror; + int i; + + if (x == 0.0) { + return (0.0); + } + if (x < 1.0) { + maxerror = x * XCMS_MAXERROR; + } else { + maxerror = XCMS_MAXERROR; + } + ai = _XcmsSquareRoot( 1.0 / (1.0 + (x * x)) ); + bi = 1.0; + for (i = 0; i < XCMS_MAXITER; i++) { + a1 = (ai + bi) / 2.0; + b1 = _XcmsSquareRoot((a1 * bi)); + if (a1 == b1) + break; + d = XCMS_FABS(a1 - b1); + if (d < maxerror) + break; + ai = a1; + bi = b1; + } + + l = ((a1 > b1) ? b1 : a1); + + a1 = _XcmsSquareRoot(1 + (x * x)); + return (x / (a1 * l)); +} diff --git a/nx-X11/lib/src/xcms/uvY.c b/nx-X11/lib/src/xcms/uvY.c new file mode 100644 index 000000000..19e6c5232 --- /dev/null +++ b/nx-X11/lib/src/xcms/uvY.c @@ -0,0 +1,423 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of XCMS based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * + * NAME + * CIEuvy.c + * + * DESCRIPTION + * This file contains routines that support the CIE u'v'Y + * color space to include conversions to and from the CIE + * XYZ space. + * + * DOCUMENTATION + * "TekColor Color Management System, System Implementor's Manual" + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +#include + +/* + * FORWARD DECLARATIONS + */ +static int CIEuvY_ParseString(register char *spec, XcmsColor *pColor); + +/* + * DEFINES + * Internal definitions that need NOT be exported to any package + * or program using this package. + */ +#ifdef DBL_EPSILON +# define XMY_DBL_EPSILON DBL_EPSILON +#else +# define XMY_DBL_EPSILON 0.00001 +#endif + + +/* + * LOCAL VARIABLES + */ + + /* + * NULL terminated list of functions applied to get from CIEuvY to CIEXYZ + */ +static XcmsConversionProc Fl_CIEuvY_to_CIEXYZ[] = { + XcmsCIEuvYToCIEXYZ, + NULL +}; + + /* + * NULL terminated list of functions applied to get from CIEXYZ to CIEuvY + */ +static XcmsConversionProc Fl_CIEXYZ_to_CIEuvY[] = { + XcmsCIEXYZToCIEuvY, + NULL +}; + + +/* + * GLOBALS + */ + + /* + * CIE uvY Color Space + */ +XcmsColorSpace XcmsCIEuvYColorSpace = + { + _XcmsCIEuvY_prefix, /* prefix */ + XcmsCIEuvYFormat, /* id */ + CIEuvY_ParseString, /* parseString */ + Fl_CIEuvY_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_CIEuvY, /* from_CIEXYZ */ + 1 + }; + + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * CIEuvY_ParseString + * + * SYNOPSIS + */ +static int +CIEuvY_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsCIEuvYFormat. + * The assumed CIEuvY string syntax is: + * CIEuvY:// + * Where u, v, and Y are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + * 0 if failed, non-zero otherwise. + */ +{ + size_t n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (size_t)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsCIEuvY_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIEuvY.u_prime, + &pColor->spec.CIEuvY.v_prime, + &pColor->spec.CIEuvY.Y) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIEuvY.u_prime, + &pColor->spec.CIEuvY.v_prime, + &pColor->spec.CIEuvY.Y) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + pColor->format = XcmsCIEuvYFormat; + pColor->pixel = 0; + return(_XcmsCIEuvY_ValidSpec(pColor)); +} + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * XcmsCIEuvY_ValidSpec + * + * SYNOPSIS + */ +Status +_XcmsCIEuvY_ValidSpec( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks if color specification valid for CIE u'v'Y. + * + * RETURNS + * XcmsFailure if invalid, + * XcmsSuccess if valid. + * + */ +{ + if (pColor->format != XcmsCIEuvYFormat + || + (pColor->spec.CIEuvY.Y < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIEuvY.Y > 1.0 + XMY_DBL_EPSILON)) { + return(XcmsFailure); + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIEuvYToCIEXYZ - convert CIEuvY to CIEXYZ + * + * SYNOPSIS + */ +Status +XcmsCIEuvYToCIEXYZ( + XcmsCCC ccc, + XcmsColor *puvY_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIEuvY format to CIEXYZ format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsCIEXYZ XYZ_return; + XcmsColor whitePt; + unsigned int i; + XcmsColor *pColor = pColors_in_out; + XcmsFloat div, x, y, z, Y; + + /* + * Check arguments + * Postpone checking puvY_WhitePt until it is actually needed + * otherwise converting between XYZ and uvY will fail. + */ + if (pColors_in_out == NULL) { + return(XcmsFailure); + } + + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + /* Make sure original format is CIEuvY */ + if (!_XcmsCIEuvY_ValidSpec(pColor)) { + return(XcmsFailure); + } + + /* + * Convert to CIEXYZ + */ + + Y = pColor->spec.CIEuvY.Y; + + /* Convert color u'v' to xyz space */ + div = (6.0 * pColor->spec.CIEuvY.u_prime) - (16.0 * pColor->spec.CIEuvY.v_prime) + 12.0; + if (div == 0.0) { + /* use white point since div == 0 */ + if (puvY_WhitePt == NULL ) { + return(XcmsFailure); + } + /* + * Make sure white point is in CIEuvY form + */ + if (puvY_WhitePt->format != XcmsCIEuvYFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)puvY_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, + XcmsCIEuvYFormat)) { + return(XcmsFailure); + } + puvY_WhitePt = &whitePt; + } + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (puvY_WhitePt->spec.CIEuvY.Y != 1.0) { + return(XcmsFailure); + } + div = (6.0 * puvY_WhitePt->spec.CIEuvY.u_prime) - + (16.0 * puvY_WhitePt->spec.CIEuvY.v_prime) + 12.0; + if (div == 0) { + /* internal error */ + return(XcmsFailure); + } + x = 9.0 * puvY_WhitePt->spec.CIEuvY.u_prime / div; + y = 4.0 * puvY_WhitePt->spec.CIEuvY.v_prime / div; + } else { + x = 9.0 * pColor->spec.CIEuvY.u_prime / div; + y = 4.0 * pColor->spec.CIEuvY.v_prime / div; + } + z = 1.0 - x - y; + + /* Convert from xyz to XYZ */ + /* Conversion uses color normalized lightness based on Y */ + if (y != 0.0) { + XYZ_return.X = x * Y / y; + } else { + XYZ_return.X = x; + } + XYZ_return.Y = Y; + if (y != 0.0) { + XYZ_return.Z = z * Y / y; + } else { + XYZ_return.Z = z; + } + + memcpy((char *)&pColor->spec.CIEXYZ, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); + /* Identify that format is now CIEXYZ */ + pColor->format = XcmsCIEXYZFormat; + } + + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIEXYZToCIEuvY - convert CIEXYZ to CIEuvY + * + * SYNOPSIS + */ +Status +XcmsCIEXYZToCIEuvY( + XcmsCCC ccc, + XcmsColor *puvY_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIEXYZ format to CIEuvY format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsCIEuvY uvY_return; + XcmsColor whitePt; + unsigned int i; + XcmsColor *pColor = pColors_in_out; + XcmsFloat div; + + /* + * Check arguments + * Postpone checking puvY_WhitePt until it is actually needed + * otherwise converting between XYZ and uvY will fail. + */ + if (pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEuvY form + */ + for (i = 0; i < nColors; i++, pColor++) { + + /* Make sure original format is CIEXYZ */ + if (!_XcmsCIEXYZ_ValidSpec(pColor)) { + return(XcmsFailure); + } + + /* Convert to CIEuvY */ + div = pColor->spec.CIEXYZ.X + (15.0 * pColor->spec.CIEXYZ.Y) + + (3.0 * pColor->spec.CIEXYZ.Z); + if (div == 0.0) { + /* Use white point since div == 0.0 */ + if (puvY_WhitePt == NULL ) { + return(XcmsFailure); + } + /* + * Make sure white point is in CIEuvY form + */ + if (puvY_WhitePt->format != XcmsCIEuvYFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)puvY_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, + XcmsCIEuvYFormat)) { + return(XcmsFailure); + } + puvY_WhitePt = &whitePt; + } + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (puvY_WhitePt->spec.CIEuvY.Y != 1.0) { + return(XcmsFailure); + } + uvY_return.Y = pColor->spec.CIEXYZ.Y; + uvY_return.u_prime = puvY_WhitePt->spec.CIEuvY.u_prime; + uvY_return.v_prime = puvY_WhitePt->spec.CIEuvY.v_prime; + } else { + uvY_return.u_prime = 4.0 * pColor->spec.CIEXYZ.X / div; + uvY_return.v_prime = 9.0 * pColor->spec.CIEXYZ.Y / div; + uvY_return.Y = pColor->spec.CIEXYZ.Y; + } + + memcpy((char *)&pColor->spec.CIEuvY, (char *)&uvY_return, sizeof(XcmsCIEuvY)); + /* Identify that format is now CIEuvY */ + pColor->format = XcmsCIEuvYFormat; + } + + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xcms/xyY.c b/nx-X11/lib/src/xcms/xyY.c new file mode 100644 index 000000000..e85b8d249 --- /dev/null +++ b/nx-X11/lib/src/xcms/xyY.c @@ -0,0 +1,395 @@ + +/* + * Code and supporting documentation (c) Copyright 1990 1991 Tektronix, Inc. + * All Rights Reserved + * + * This file is a component of an X Window System-specific implementation + * of Xcms based on the TekColor Color Management System. Permission is + * hereby granted to use, copy, modify, sell, and otherwise distribute this + * software and its documentation for any purpose and without fee, provided + * that this copyright, permission, and disclaimer notice is reproduced in + * all copies of this software and in supporting documentation. TekColor + * is a trademark of Tektronix, Inc. + * + * Tektronix makes no representation about the suitability of this software + * for any purpose. It is provided "as is" and with all faults. + * + * TEKTRONIX DISCLAIMS ALL WARRANTIES APPLICABLE TO THIS SOFTWARE, + * INCLUDING THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A + * PARTICULAR PURPOSE. IN NO EVENT SHALL TEKTRONIX 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 THE PERFORMANCE OF THIS SOFTWARE. + * + * NAME + * CIExyY.c + * + * DESCRIPTION + * This file contains routines that support the CIE xyY + * color space to include conversions to and from the CIE + * XYZ space. + * + * DOCUMENTATION + * "TekColor Color Management System, System Implementor's Manual" + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlibint.h" +#include "Xcmsint.h" +#include "Cv.h" + +/* + * DEFINES + */ +#define EPS 0.00001 /* some extremely small number */ +#ifdef DBL_EPSILON +# define XMY_DBL_EPSILON DBL_EPSILON +#else +# define XMY_DBL_EPSILON 0.00001 +#endif + +/* + * FORWARD DECLARATIONS + */ + +static int CIExyY_ParseString(register char *spec, XcmsColor *pColor); +static Status XcmsCIExyY_ValidSpec(XcmsColor *pColor); + + +/* + * LOCAL VARIABLES + */ + + /* + * NULL terminated list of functions applied to get from CIExyY to CIEXYZ + */ +static XcmsConversionProc Fl_CIExyY_to_CIEXYZ[] = { + XcmsCIExyYToCIEXYZ, + NULL +}; + + /* + * NULL terminated list of functions applied to get from CIEXYZ to CIExyY + */ +static XcmsConversionProc Fl_CIEXYZ_to_CIExyY[] = { + XcmsCIEXYZToCIExyY, + NULL +}; + + +/* + * GLOBALS + */ + + /* + * CIE xyY Color Space + */ +XcmsColorSpace XcmsCIExyYColorSpace = + { + _XcmsCIExyY_prefix, /* prefix */ + XcmsCIExyYFormat, /* id */ + CIExyY_ParseString, /* parseString */ + Fl_CIExyY_to_CIEXYZ, /* to_CIEXYZ */ + Fl_CIEXYZ_to_CIExyY, /* from_CIEXYZ */ + 1 + }; + + + +/************************************************************************ + * * + * PRIVATE ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * CIExyY_ParseString + * + * SYNOPSIS + */ +static int +CIExyY_ParseString( + register char *spec, + XcmsColor *pColor) +/* + * DESCRIPTION + * This routines takes a string and attempts to convert + * it into a XcmsColor structure with XcmsCIExyYFormat. + * The assumed CIExyY string syntax is: + * CIExyY:// + * Where x, y, and Y are in string input format for floats + * consisting of: + * a. an optional sign + * b. a string of numbers possibly containing a decimal point, + * c. an optional exponent field containing an 'E' or 'e' + * followed by a possibly signed integer string. + * + * RETURNS + * 0 if failed, non-zero otherwise. + */ +{ + int n; + char *pchar; + + if ((pchar = strchr(spec, ':')) == NULL) { + return(XcmsFailure); + } + n = (int)(pchar - spec); + + /* + * Check for proper prefix. + */ + if (strncmp(spec, _XcmsCIExyY_prefix, n) != 0) { + return(XcmsFailure); + } + + /* + * Attempt to parse the value portion. + */ + if (sscanf(spec + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIExyY.x, + &pColor->spec.CIExyY.y, + &pColor->spec.CIExyY.Y) != 3) { + char *s; /* Maybe failed due to locale */ + int f; + if ((s = strdup(spec))) { + for (f = 0; s[f]; ++f) + if (s[f] == '.') + s[f] = ','; + else if (s[f] == ',') + s[f] = '.'; + if (sscanf(s + n + 1, "%lf/%lf/%lf", + &pColor->spec.CIExyY.x, + &pColor->spec.CIExyY.y, + &pColor->spec.CIExyY.Y) != 3) { + free(s); + return(XcmsFailure); + } + free(s); + } else + return(XcmsFailure); + } + pColor->format = XcmsCIExyYFormat; + pColor->pixel = 0; + return(XcmsCIExyY_ValidSpec(pColor)); +} + + + +/************************************************************************ + * * + * PUBLIC ROUTINES * + * * + ************************************************************************/ + +/* + * NAME + * CIExyY_ValidSpec() + * + * SYNOPSIS + */ +static Status +XcmsCIExyY_ValidSpec( + XcmsColor *pColor) +/* + * DESCRIPTION + * Checks a valid CIExyY color specification. + * + * RETURNS + * XcmsFailure if invalid. + * XcmsSuccess if valid. + * + */ +{ + if (pColor->format != XcmsCIExyYFormat + || + (pColor->spec.CIExyY.x < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIExyY.x > 1.0 + XMY_DBL_EPSILON) + || + (pColor->spec.CIExyY.y < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIExyY.y > 1.0 + XMY_DBL_EPSILON) + || + (pColor->spec.CIExyY.Y < 0.0 - XMY_DBL_EPSILON) + || + (pColor->spec.CIExyY.Y > 1.0 + XMY_DBL_EPSILON)) { + return(XcmsFailure); + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIExyYToCIEXYZ - convert CIExyY to CIEXYZ + * + * SYNOPSIS + */ +Status +XcmsCIExyYToCIEXYZ( + XcmsCCC ccc, + XcmsColor *pxyY_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIExyY format to CIEXYZ format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + */ +{ + XcmsColor *pColor = pColors_in_out; + XcmsColor whitePt; + XcmsCIEXYZ XYZ_return; + XcmsFloat div; /* temporary storage in case divisor is zero */ + XcmsFloat u, v, x, y, z; /* temporary storage */ + unsigned int i; + + /* + * Check arguments + */ + if (pxyY_WhitePt == NULL || pColors_in_out == NULL) { + return(XcmsFailure); + } + + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + /* Make sure original format is CIExyY and valid */ + if (!XcmsCIExyY_ValidSpec(pColor)) { + return(XcmsFailure); + } + + if ((div = (-2 * pColor->spec.CIExyY.x) + (12 * pColor->spec.CIExyY.y) + 3) == 0.0) { + /* Note that the divisor is zero */ + /* This return is abitrary. */ + XYZ_return.X = 0; + XYZ_return.Y = 0; + XYZ_return.Z = 0; + } else { + /* + * Make sure white point is in CIEXYZ form + */ + if (pxyY_WhitePt->format != XcmsCIEXYZFormat) { + /* Make copy of the white point because we're going to modify it */ + memcpy((char *)&whitePt, (char *)pxyY_WhitePt, sizeof(XcmsColor)); + if (!_XcmsDIConvertColors(ccc, &whitePt, (XcmsColor *)NULL, 1, + XcmsCIEXYZFormat)) { + return(XcmsFailure); + } + pxyY_WhitePt = &whitePt; + } + + /* Make sure it is a white point, i.e., Y == 1.0 */ + if (pxyY_WhitePt->spec.CIEXYZ.Y != 1.0) { + return(XcmsFailure); + } + + /* Convert from xyY to uvY to XYZ */ + u = (4 * pColor->spec.CIExyY.x) / div; + v = (9 * pColor->spec.CIExyY.y) / div; + div = (6.0 * u) - (16.0 * v) + 12.0; + if (div == 0.0) { + /* Note that the divisor is zero */ + /* This return is abitrary. */ + if ((div = (6.0 * whitePt.spec.CIEuvY.u_prime) - + (16.0 * whitePt.spec.CIEuvY.v_prime) + 12.0) == 0.0) { + div = EPS; + } + x = 9.0 * whitePt.spec.CIEuvY.u_prime / div; + y = 4.0 * whitePt.spec.CIEuvY.u_prime / div; + } else { + /* convert u, v to small xyz */ + x = 9.0 * u / div; + y = 4.0 * v / div; + } + z = 1.0 - x - y; + if (y == 0.0) y = EPS; /* Have to worry about divide by 0 */ + XYZ_return.Y = pColor->spec.CIExyY.Y; + XYZ_return.X = x * XYZ_return.Y / y; + XYZ_return.Z = z * XYZ_return.Y / y; + } + + /* Copy result to pColor */ + memcpy ((char *)&pColor->spec, (char *)&XYZ_return, sizeof(XcmsCIEXYZ)); + + /* Identify that the format is now CIEXYZ */ + pColor->format = XcmsCIEXYZFormat; + } + return(XcmsSuccess); +} + + +/* + * NAME + * XcmsCIEXYZToCIExyY - convert CIEXYZ to CIExyY + * + * SYNOPSIS + */ +/* ARGSUSED */ +Status +XcmsCIEXYZToCIExyY( + XcmsCCC ccc, + XcmsColor *pxyY_WhitePt, + XcmsColor *pColors_in_out, + unsigned int nColors) +/* + * DESCRIPTION + * Converts color specifications in an array of XcmsColor + * structures from CIEXYZ format to CIExyY format. + * + * RETURNS + * XcmsFailure if failed, + * XcmsSuccess if succeeded. + * + */ +{ + XcmsColor *pColor = pColors_in_out; + XcmsCIExyY xyY_return; + XcmsFloat div; /* temporary storage in case divisor is zero */ + unsigned int i; + + /* + * Check arguments + * pxyY_WhitePt ignored + */ + if (pColors_in_out == NULL) { + return(XcmsFailure); + } + + /* + * Now convert each XcmsColor structure to CIEXYZ form + */ + for (i = 0; i < nColors; i++, pColor++) { + + if (!_XcmsCIEXYZ_ValidSpec(pColor)) { + return(XcmsFailure); + } + /* Now convert for XYZ to xyY */ + if ((div = pColor->spec.CIEXYZ.X + pColor->spec.CIEXYZ.Y + pColor->spec.CIEXYZ.Z) == 0.0) { + div = EPS; + } + xyY_return.x = pColor->spec.CIEXYZ.X / div; + xyY_return.y = pColor->spec.CIEXYZ.Y / div; + xyY_return.Y = pColor->spec.CIEXYZ.Y; + + /* Copy result to pColor */ + memcpy ((char *)&pColor->spec, (char *)&xyY_return, sizeof(XcmsCIExyY)); + + /* Identify that the format is now CIEXYZ */ + pColor->format = XcmsCIExyYFormat; + } + return(XcmsSuccess); +} diff --git a/nx-X11/lib/src/xkb/Makefile.am b/nx-X11/lib/src/xkb/Makefile.am new file mode 100644 index 000000000..b22eb9fad --- /dev/null +++ b/nx-X11/lib/src/xkb/Makefile.am @@ -0,0 +1,46 @@ +NULL = + +noinst_LTLIBRARIES = libxkb.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(XMALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +libxkb_la_SOURCES = \ + XKB.c \ + XKBBind.c \ + XKBCompat.c \ + XKBCtrls.c \ + XKBCvt.c \ + XKBGetMap.c \ + XKBGetByName.c \ + XKBNames.c \ + XKBRdBuf.c \ + XKBSetMap.c \ + XKBUse.c \ + XKBleds.c \ + XKBBell.c \ + XKBGeom.c \ + XKBSetGeom.c \ + XKBExtDev.c \ + XKBList.c \ + XKBMisc.c \ + XKBMAlloc.c \ + XKBGAlloc.c \ + XKBAlloc.c \ + $(NULL) diff --git a/nx-X11/lib/src/xkb/XKB.c b/nx-X11/lib/src/xkb/XKB.c new file mode 100644 index 000000000..6df9c3ebc --- /dev/null +++ b/nx-X11/lib/src/xkb/XKB.c @@ -0,0 +1,771 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +XkbInternAtomFunc _XkbInternAtomFunc = XInternAtom; +XkbGetAtomNameFunc _XkbGetAtomNameFunc = XGetAtomName; + +Bool +XkbQueryExtension(Display *dpy, + int *opcodeReturn, + int *eventBaseReturn, + int *errorBaseReturn, + int *majorReturn, + int *minorReturn) +{ + if (!XkbUseExtension(dpy, majorReturn, minorReturn)) + return False; + if (opcodeReturn) + *opcodeReturn = dpy->xkb_info->codes->major_opcode; + if (eventBaseReturn) + *eventBaseReturn = dpy->xkb_info->codes->first_event; + if (errorBaseReturn) + *errorBaseReturn = dpy->xkb_info->codes->first_error; + if (majorReturn) + *majorReturn = dpy->xkb_info->srv_major; + if (minorReturn) + *minorReturn = dpy->xkb_info->srv_minor; + return True; +} + +Bool +XkbLibraryVersion(int *libMajorRtrn, int *libMinorRtrn) +{ + int supported; + + if (*libMajorRtrn != XkbMajorVersion) { + /* version 0.65 is (almost) compatible with 1.00 */ + if ((XkbMajorVersion == 1) && + (((*libMajorRtrn) == 0) && ((*libMinorRtrn) == 65))) + supported = True; + else + supported = False; + } + else { + supported = True; + } + + *libMajorRtrn = XkbMajorVersion; + *libMinorRtrn = XkbMinorVersion; + return supported; +} + +Bool +XkbSelectEvents(Display *dpy, + unsigned int deviceSpec, + unsigned int affect, + unsigned int selectAll) +{ + register xkbSelectEventsReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + xkbi->selected_events &= ~affect; + xkbi->selected_events |= (affect & selectAll); + GetReq(kbSelectEvents, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSelectEvents; + req->deviceSpec = deviceSpec; + req->affectWhich = (CARD16) affect; + req->clear = affect & (~selectAll); + req->selectAll = affect & selectAll; + if (affect & XkbMapNotifyMask) { + req->affectMap = XkbAllMapComponentsMask; + /* the implicit support needs the client info */ + /* even if the client itself doesn't want it */ + if (selectAll & XkbMapNotifyMask) + req->map = XkbAllMapEventsMask; + else + req->map = XkbAllClientInfoMask; + if (selectAll & XkbMapNotifyMask) + xkbi->selected_map_details = XkbAllMapEventsMask; + else + xkbi->selected_map_details = 0; + } + if (affect & XkbNewKeyboardNotifyMask) { + if (selectAll & XkbNewKeyboardNotifyMask) + xkbi->selected_nkn_details = XkbAllNewKeyboardEventsMask; + else + xkbi->selected_nkn_details = 0; + if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) { + /* we want it, even if the client doesn't. Don't mess */ + /* around with details -- ask for all of them and throw */ + /* away the ones we don't need */ + req->selectAll |= XkbNewKeyboardNotifyMask; + } + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbSelectEventDetails(Display *dpy, + unsigned deviceSpec, + unsigned eventType, + unsigned long int affect, + unsigned long int details) +{ + register xkbSelectEventsReq *req; + XkbInfoPtr xkbi; + int size = 0; + char *out; + union { + CARD8 *c8; + CARD16 *c16; + CARD32 *c32; + } u; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + if (affect & details) + xkbi->selected_events |= (1 << eventType); + else + xkbi->selected_events &= ~(1 << eventType); + GetReq(kbSelectEvents, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSelectEvents; + req->deviceSpec = deviceSpec; + req->clear = req->selectAll = 0; + if (eventType == XkbMapNotify) { + /* we need all of the client info, even if the application */ + /* doesn't. Make sure that we always request the stuff */ + /* that the implicit support needs, and just filter out anything */ + /* the client doesn't want later */ + req->affectMap = (CARD16) affect; + req->map = (CARD16) details | (XkbAllClientInfoMask & affect); + req->affectWhich = XkbMapNotifyMask; + xkbi->selected_map_details &= ~affect; + xkbi->selected_map_details |= (details & affect); + } + else { + req->affectMap = req->map = 0; + req->affectWhich = (1 << eventType); + switch (eventType) { + case XkbNewKeyboardNotify: + xkbi->selected_nkn_details &= ~affect; + xkbi->selected_nkn_details |= (details & affect); + if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) + details = (affect & XkbAllNewKeyboardEventsMask); + case XkbStateNotify: + case XkbNamesNotify: + case XkbAccessXNotify: + case XkbExtensionDeviceNotify: + size = 2; + req->length += 1; + break; + case XkbControlsNotify: + case XkbIndicatorStateNotify: + case XkbIndicatorMapNotify: + size = 4; + req->length += 2; + break; + case XkbBellNotify: + case XkbActionMessage: + case XkbCompatMapNotify: + size = 1; + req->length += 1; + break; + } + BufAlloc(char *, out, (((size * 2) + (unsigned) 3) / 4) * 4); + + u.c8 = (CARD8 *) out; + if (size == 2) { + u.c16[0] = (CARD16) affect; + u.c16[1] = (CARD16) details; + } + else if (size == 4) { + u.c32[0] = (CARD32) affect; + u.c32[1] = (CARD32) details; + } + else { + u.c8[0] = (CARD8) affect; + u.c8[1] = (CARD8) details; + } + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbLockModifiers(Display *dpy, + unsigned int deviceSpec, + unsigned int affect, + unsigned int values) +{ + register xkbLatchLockStateReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbLatchLockState, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbLatchLockState; + req->deviceSpec = deviceSpec; + req->affectModLocks = affect; + req->modLocks = values; + req->lockGroup = False; + req->groupLock = 0; + + req->affectModLatches = req->modLatches = 0; + req->latchGroup = False; + req->groupLatch = 0; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbLatchModifiers(Display *dpy, + unsigned int deviceSpec, + unsigned int affect, + unsigned int values) +{ + register xkbLatchLockStateReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbLatchLockState, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbLatchLockState; + req->deviceSpec = deviceSpec; + + req->affectModLatches = affect; + req->modLatches = values; + req->latchGroup = False; + req->groupLatch = 0; + + req->affectModLocks = req->modLocks = 0; + req->lockGroup = False; + req->groupLock = 0; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbLockGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) +{ + register xkbLatchLockStateReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbLatchLockState, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbLatchLockState; + req->deviceSpec = deviceSpec; + req->affectModLocks = 0; + req->modLocks = 0; + req->lockGroup = True; + req->groupLock = group; + + req->affectModLatches = req->modLatches = 0; + req->latchGroup = False; + req->groupLatch = 0; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbLatchGroup(Display *dpy, unsigned int deviceSpec, unsigned int group) +{ + register xkbLatchLockStateReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbLatchLockState, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbLatchLockState; + req->deviceSpec = deviceSpec; + + req->affectModLatches = 0; + req->modLatches = 0; + req->latchGroup = True; + req->groupLatch = group; + + req->affectModLocks = req->modLocks = 0; + req->lockGroup = False; + req->groupLock = 0; + + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +unsigned +XkbSetXlibControls(Display *dpy, unsigned affect, unsigned values) +{ + if (!dpy->xkb_info) + XkbUseExtension(dpy, NULL, NULL); + if (!dpy->xkb_info) + return 0; + affect &= XkbLC_AllControls; + dpy->xkb_info->xlib_ctrls &= ~affect; + dpy->xkb_info->xlib_ctrls |= (affect & values); + return dpy->xkb_info->xlib_ctrls; +} + +unsigned +XkbGetXlibControls(Display *dpy) +{ + if (!dpy->xkb_info) + XkbUseExtension(dpy, NULL, NULL); + if (!dpy->xkb_info) + return 0; + return dpy->xkb_info->xlib_ctrls; +} + +unsigned int +XkbXlibControlsImplemented(void) +{ + return XkbLC_AllControls & ~XkbLC_AllComposeControls; +} + +Bool +XkbSetDebuggingFlags(Display *dpy, + unsigned int mask, + unsigned int flags, + char *msg, + unsigned int ctrls_mask, + unsigned int ctrls, + unsigned int *rtrn_flags, + unsigned int *rtrn_ctrls) +{ + register xkbSetDebuggingFlagsReq *req; + xkbSetDebuggingFlagsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetDebuggingFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetDebuggingFlags; + req->affectFlags = mask; + req->flags = flags; + req->affectCtrls = ctrls_mask; + req->ctrls = ctrls; + + if (msg) { + char *out; + + req->msgLength = (unsigned short) strlen(msg) + 1; + req->length += (req->msgLength + (unsigned) 3) >> 2; + BufAlloc(char *, out, ((req->msgLength + (unsigned) 3) / 4) * 4); + memcpy(out, msg, req->msgLength); + } + else + req->msgLength = 0; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + if (rtrn_flags) + *rtrn_flags = rep.currentFlags; + if (rtrn_ctrls) + *rtrn_ctrls = rep.currentCtrls; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbComputeEffectiveMap(XkbDescPtr xkb, + XkbKeyTypePtr type, + unsigned char *map_rtrn) +{ + register int i; + unsigned tmp; + XkbKTMapEntryPtr entry = NULL; + + if ((!xkb) || (!type) || (!xkb->server)) + return False; + + if (type->mods.vmods != 0) { + if (!XkbVirtualModsToReal(xkb, type->mods.vmods, &tmp)) + return False; + + type->mods.mask = tmp | type->mods.real_mods; + entry = type->map; + for (i = 0; i < type->map_count; i++, entry++) { + tmp = 0; + if (entry->mods.vmods != 0) { + if (!XkbVirtualModsToReal(xkb, entry->mods.vmods, &tmp)) + return False; + if (tmp == 0) { + entry->active = False; + continue; + } + } + entry->active = True; + entry->mods.mask = (entry->mods.real_mods | tmp) & type->mods.mask; + } + } + else { + type->mods.mask = type->mods.real_mods; + } + if (map_rtrn != NULL) { + bzero(map_rtrn, type->mods.mask + 1); + for (i = 0; i < type->map_count; i++) { + if (entry && entry->active) { + map_rtrn[type->map[i].mods.mask] = type->map[i].level; + } + } + } + return True; +} + +Status +XkbGetState(Display *dpy, unsigned deviceSpec, XkbStatePtr rtrn) +{ + register xkbGetStateReq *req; + xkbGetStateReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbGetState, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetState; + req->deviceSpec = deviceSpec; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadImplementation; + } + rtrn->mods = rep.mods; + rtrn->base_mods = rep.baseMods; + rtrn->latched_mods = rep.latchedMods; + rtrn->locked_mods = rep.lockedMods; + rtrn->group = rep.group; + rtrn->base_group = rep.baseGroup; + rtrn->latched_group = rep.latchedGroup; + rtrn->locked_group = rep.lockedGroup; + rtrn->compat_state = rep.compatState; + rtrn->grab_mods = rep.grabMods; + rtrn->compat_grab_mods = rep.compatGrabMods; + rtrn->lookup_mods = rep.lookupMods; + rtrn->compat_lookup_mods = rep.compatLookupMods; + rtrn->ptr_buttons = rep.ptrBtnState; + UnlockDisplay(dpy); + SyncHandle(); + return Success; +} + +Bool +XkbSetDetectableAutoRepeat(Display *dpy, Bool detectable, Bool *supported) +{ + register xkbPerClientFlagsReq *req; + xkbPerClientFlagsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbPerClientFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbPerClientFlags; + req->deviceSpec = XkbUseCoreKbd; + req->change = XkbPCF_DetectableAutoRepeatMask; + if (detectable) + req->value = XkbPCF_DetectableAutoRepeatMask; + else + req->value = 0; + req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + if (supported != NULL) + *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0); + return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0); +} + +Bool +XkbGetDetectableAutoRepeat(Display *dpy, Bool *supported) +{ + register xkbPerClientFlagsReq *req; + xkbPerClientFlagsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbPerClientFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbPerClientFlags; + req->deviceSpec = XkbUseCoreKbd; + req->change = 0; + req->value = 0; + req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + if (supported != NULL) + *supported = ((rep.supported & XkbPCF_DetectableAutoRepeatMask) != 0); + return ((rep.value & XkbPCF_DetectableAutoRepeatMask) != 0); +} + +Bool +XkbSetAutoResetControls(Display *dpy, + unsigned changes, + unsigned *auto_ctrls, + unsigned *auto_values) +{ + register xkbPerClientFlagsReq *req; + xkbPerClientFlagsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbPerClientFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbPerClientFlags; + req->change = XkbPCF_AutoResetControlsMask; + req->deviceSpec = XkbUseCoreKbd; + req->value = XkbPCF_AutoResetControlsMask; + req->ctrlsToChange = changes; + req->autoCtrls = *auto_ctrls; + req->autoCtrlValues = *auto_values; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + *auto_ctrls = rep.autoCtrls; + *auto_values = rep.autoCtrlValues; + return ((rep.value & XkbPCF_AutoResetControlsMask) != 0); +} + +Bool +XkbGetAutoResetControls(Display *dpy, + unsigned *auto_ctrls, + unsigned *auto_ctrl_values) +{ + register xkbPerClientFlagsReq *req; + xkbPerClientFlagsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbPerClientFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbPerClientFlags; + req->deviceSpec = XkbUseCoreKbd; + req->change = 0; + req->value = 0; + req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + if (auto_ctrls) + *auto_ctrls = rep.autoCtrls; + if (auto_ctrl_values) + *auto_ctrl_values = rep.autoCtrlValues; + return ((rep.value & XkbPCF_AutoResetControlsMask) != 0); +} + +Bool +XkbSetPerClientControls(Display *dpy, unsigned change, unsigned *values) +{ + register xkbPerClientFlagsReq *req; + xkbPerClientFlagsReply rep; + XkbInfoPtr xkbi; + unsigned value_hold = *values; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || + (change & ~(XkbPCF_GrabsUseXKBStateMask | + XkbPCF_LookupStateWhenGrabbed | + XkbPCF_SendEventUsesXKBState))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbPerClientFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbPerClientFlags; + req->change = change; + req->deviceSpec = XkbUseCoreKbd; + req->value = *values; + req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + *values = rep.value; + return ((rep.value & value_hold) != 0); +} + +Bool +XkbGetPerClientControls(Display *dpy, unsigned *ctrls) +{ + register xkbPerClientFlagsReq *req; + xkbPerClientFlagsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || + (ctrls == NULL)) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbPerClientFlags, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbPerClientFlags; + req->deviceSpec = XkbUseCoreKbd; + req->change = 0; + req->value = 0; + req->ctrlsToChange = req->autoCtrls = req->autoCtrlValues = 0; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + *ctrls = (rep.value & (XkbPCF_GrabsUseXKBStateMask | + XkbPCF_LookupStateWhenGrabbed | + XkbPCF_SendEventUsesXKBState)); + return (True); +} + +Display * +XkbOpenDisplay(char *name, + int *ev_rtrn, + int *err_rtrn, + int *major_rtrn, + int *minor_rtrn, + int *reason) +{ + Display *dpy; + int major_num, minor_num; + + if ((major_rtrn != NULL) && (minor_rtrn != NULL)) { + if (!XkbLibraryVersion(major_rtrn, minor_rtrn)) { + if (reason != NULL) + *reason = XkbOD_BadLibraryVersion; + return NULL; + } + } + else { + major_num = XkbMajorVersion; + minor_num = XkbMinorVersion; + major_rtrn = &major_num; + minor_rtrn = &minor_num; + } + dpy = XOpenDisplay(name); + if (dpy == NULL) { + if (reason != NULL) + *reason = XkbOD_ConnectionRefused; + return NULL; + } + if (!XkbQueryExtension(dpy, NULL, ev_rtrn, err_rtrn, + major_rtrn, minor_rtrn)) { + if (reason != NULL) { + if ((*major_rtrn != 0) || (*minor_rtrn != 0)) + *reason = XkbOD_BadServerVersion; + else + *reason = XkbOD_NonXkbServer; + } + XCloseDisplay(dpy); + return NULL; + } + if (reason != NULL) + *reason = XkbOD_Success; + return dpy; +} + +void +XkbSetAtomFuncs(XkbInternAtomFunc getAtom, XkbGetAtomNameFunc getName) +{ + _XkbInternAtomFunc = (getAtom ? getAtom : XInternAtom); + _XkbGetAtomNameFunc = (getName ? getName : XGetAtomName); + return; +} diff --git a/nx-X11/lib/src/xkb/XKBAlloc.c b/nx-X11/lib/src/xkb/XKBAlloc.c new file mode 100644 index 000000000..9c3430c1a --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBAlloc.c @@ -0,0 +1,495 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include "Xlibint.h" +#include "XKBlibint.h" +#include +#include +#include "XKBlibint.h" + + +/***===================================================================***/ + +/*ARGSUSED*/ +Status +XkbAllocCompatMap(XkbDescPtr xkb, unsigned which, unsigned nSI) +{ + XkbCompatMapPtr compat; + XkbSymInterpretRec *prev_interpret; + + if (!xkb) + return BadMatch; + if (xkb->compat) { + if (xkb->compat->size_si >= nSI) + return Success; + compat = xkb->compat; + compat->size_si = nSI; + if (compat->sym_interpret == NULL) + compat->num_si = 0; + prev_interpret = compat->sym_interpret; + compat->sym_interpret = _XkbTypedRealloc(compat->sym_interpret, + nSI, XkbSymInterpretRec); + if (compat->sym_interpret == NULL) { + _XkbFree(prev_interpret); + compat->size_si = compat->num_si = 0; + return BadAlloc; + } + if (compat->num_si != 0) { + _XkbClearElems(compat->sym_interpret, compat->num_si, + compat->size_si - 1, XkbSymInterpretRec); + } + return Success; + } + compat = _XkbTypedCalloc(1, XkbCompatMapRec); + if (compat == NULL) + return BadAlloc; + if (nSI > 0) { + compat->sym_interpret = _XkbTypedCalloc(nSI, XkbSymInterpretRec); + if (!compat->sym_interpret) { + _XkbFree(compat); + return BadAlloc; + } + } + compat->size_si = nSI; + compat->num_si = 0; + bzero((char *) &compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec)); + xkb->compat = compat; + return Success; +} + + +void +XkbFreeCompatMap(XkbDescPtr xkb, unsigned which, Bool freeMap) +{ + register XkbCompatMapPtr compat; + + if ((xkb == NULL) || (xkb->compat == NULL)) + return; + compat = xkb->compat; + if (freeMap) + which = XkbAllCompatMask; + if (which & XkbGroupCompatMask) + bzero(&compat->groups[0], XkbNumKbdGroups * sizeof(XkbModsRec)); + if (which & XkbSymInterpMask) { + if ((compat->sym_interpret) && (compat->size_si > 0)) + _XkbFree(compat->sym_interpret); + compat->size_si = compat->num_si = 0; + compat->sym_interpret = NULL; + } + if (freeMap) { + _XkbFree(compat); + xkb->compat = NULL; + } + return; +} + +/***===================================================================***/ + +Status +XkbAllocNames(XkbDescPtr xkb, unsigned which, int nTotalRG, int nTotalAliases) +{ + XkbNamesPtr names; + + if (xkb == NULL) + return BadMatch; + if (xkb->names == NULL) { + xkb->names = _XkbTypedCalloc(1, XkbNamesRec); + if (xkb->names == NULL) + return BadAlloc; + } + names = xkb->names; + if ((which & XkbKTLevelNamesMask) && (xkb->map != NULL) && + (xkb->map->types != NULL)) { + register int i; + XkbKeyTypePtr type = xkb->map->types; + + for (i = 0; i < xkb->map->num_types; i++, type++) { + if (type->level_names == NULL) { + type->level_names = _XkbTypedCalloc(type->num_levels, Atom); + if (type->level_names == NULL) + return BadAlloc; + } + } + } + if ((which & XkbKeyNamesMask) && (names->keys == NULL)) { + if ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code)) + return BadValue; + names->keys = _XkbTypedCalloc((xkb->max_key_code + 1), XkbKeyNameRec); + if (names->keys == NULL) + return BadAlloc; + } + if ((which & XkbKeyAliasesMask) && (nTotalAliases > 0)) { + if (names->key_aliases == NULL) { + names->key_aliases = _XkbTypedCalloc(nTotalAliases, XkbKeyAliasRec); + } + else if (nTotalAliases > names->num_key_aliases) { + XkbKeyAliasRec *prev_aliases = names->key_aliases; + + names->key_aliases = _XkbTypedRealloc(names->key_aliases, + nTotalAliases, + XkbKeyAliasRec); + if (names->key_aliases != NULL) { + _XkbClearElems(names->key_aliases, names->num_key_aliases, + nTotalAliases - 1, XkbKeyAliasRec); + } + else { + _XkbFree(prev_aliases); + } + } + if (names->key_aliases == NULL) { + names->num_key_aliases = 0; + return BadAlloc; + } + names->num_key_aliases = nTotalAliases; + } + if ((which & XkbRGNamesMask) && (nTotalRG > 0)) { + if (names->radio_groups == NULL) { + names->radio_groups = _XkbTypedCalloc(nTotalRG, Atom); + } + else if (nTotalRG > names->num_rg) { + Atom *prev_radio_groups = names->radio_groups; + + names->radio_groups = + _XkbTypedRealloc(names->radio_groups, nTotalRG, Atom); + if (names->radio_groups != NULL) { + _XkbClearElems(names->radio_groups, names->num_rg, nTotalRG - 1, + Atom); + } + else { + _XkbFree(prev_radio_groups); + } + } + if (names->radio_groups == NULL) + return BadAlloc; + names->num_rg = nTotalRG; + } + return Success; +} + +void +XkbFreeNames(XkbDescPtr xkb, unsigned which, Bool freeMap) +{ + XkbNamesPtr names; + + if ((xkb == NULL) || (xkb->names == NULL)) + return; + names = xkb->names; + if (freeMap) + which = XkbAllNamesMask; + if (which & XkbKTLevelNamesMask) { + XkbClientMapPtr map = xkb->map; + + if ((map != NULL) && (map->types != NULL)) { + register int i; + register XkbKeyTypePtr type; + + type = map->types; + for (i = 0; i < map->num_types; i++, type++) { + if (type->level_names != NULL) { + _XkbFree(type->level_names); + type->level_names = NULL; + } + } + } + } + if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { + _XkbFree(names->keys); + names->keys = NULL; + names->num_keys = 0; + } + if ((which & XkbKeyAliasesMask) && (names->key_aliases)) { + _XkbFree(names->key_aliases); + names->key_aliases = NULL; + names->num_key_aliases = 0; + } + if ((which & XkbRGNamesMask) && (names->radio_groups)) { + _XkbFree(names->radio_groups); + names->radio_groups = NULL; + names->num_rg = 0; + } + if (freeMap) { + _XkbFree(names); + xkb->names = NULL; + } + return; +} + +/***===================================================================***/ + +/*ARGSUSED*/ +Status +XkbAllocControls(XkbDescPtr xkb, unsigned which) +{ + if (xkb == NULL) + return BadMatch; + + if (xkb->ctrls == NULL) { + xkb->ctrls = _XkbTypedCalloc(1, XkbControlsRec); + if (!xkb->ctrls) + return BadAlloc; + } + return Success; +} + +/*ARGSUSED*/ +void +XkbFreeControls(XkbDescPtr xkb, unsigned which, Bool freeMap) +{ + if (freeMap && (xkb != NULL) && (xkb->ctrls != NULL)) { + _XkbFree(xkb->ctrls); + xkb->ctrls = NULL; + } + return; +} + +/***===================================================================***/ + +Status +XkbAllocIndicatorMaps(XkbDescPtr xkb) +{ + if (xkb == NULL) + return BadMatch; + if (xkb->indicators == NULL) { + xkb->indicators = _XkbTypedCalloc(1, XkbIndicatorRec); + if (!xkb->indicators) + return BadAlloc; + } + return Success; +} + +void +XkbFreeIndicatorMaps(XkbDescPtr xkb) +{ + if ((xkb != NULL) && (xkb->indicators != NULL)) { + _XkbFree(xkb->indicators); + xkb->indicators = NULL; + } + return; +} + +/***====================================================================***/ + +XkbDescRec * +XkbAllocKeyboard(void) +{ + XkbDescRec *xkb; + + xkb = _XkbTypedCalloc(1, XkbDescRec); + if (xkb) + xkb->device_spec = XkbUseCoreKbd; + return xkb; +} + +void +XkbFreeKeyboard(XkbDescPtr xkb, unsigned which, Bool freeAll) +{ + if (xkb == NULL) + return; + if (freeAll) + which = XkbAllComponentsMask; + if (which & XkbClientMapMask) + XkbFreeClientMap(xkb, XkbAllClientInfoMask, True); + if (which & XkbServerMapMask) + XkbFreeServerMap(xkb, XkbAllServerInfoMask, True); + if (which & XkbCompatMapMask) + XkbFreeCompatMap(xkb, XkbAllCompatMask, True); + if (which & XkbIndicatorMapMask) + XkbFreeIndicatorMaps(xkb); + if (which & XkbNamesMask) + XkbFreeNames(xkb, XkbAllNamesMask, True); + if ((which & XkbGeometryMask) && (xkb->geom != NULL)) + XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); + if (which & XkbControlsMask) + XkbFreeControls(xkb, XkbAllControlsMask, True); + if (freeAll) + _XkbFree(xkb); + return; +} + +/***====================================================================***/ + +XkbDeviceLedInfoPtr +XkbAddDeviceLedInfo(XkbDeviceInfoPtr devi, unsigned ledClass, unsigned ledId) +{ + XkbDeviceLedInfoPtr devli; + register int i; + + if ((!devi) || (!XkbSingleXIClass(ledClass)) || (!XkbSingleXIId(ledId))) + return NULL; + for (i = 0, devli = devi->leds; i < devi->num_leds; i++, devli++) { + if ((devli->led_class == ledClass) && (devli->led_id == ledId)) + return devli; + } + if (devi->num_leds >= devi->sz_leds) { + XkbDeviceLedInfoRec *prev_leds = devi->leds; + + if (devi->sz_leds > 0) + devi->sz_leds *= 2; + else + devi->sz_leds = 1; + devi->leds = _XkbTypedRealloc(devi->leds, devi->sz_leds, + XkbDeviceLedInfoRec); + if (!devi->leds) { + _XkbFree(prev_leds); + devi->sz_leds = devi->num_leds = 0; + return NULL; + } + i = devi->num_leds; + for (devli = &devi->leds[i]; i < devi->sz_leds; i++, devli++) { + bzero(devli, sizeof(XkbDeviceLedInfoRec)); + devli->led_class = XkbXINone; + devli->led_id = XkbXINone; + } + } + devli = &devi->leds[devi->num_leds++]; + bzero(devli, sizeof(XkbDeviceLedInfoRec)); + devli->led_class = ledClass; + devli->led_id = ledId; + return devli; +} + +Status +XkbResizeDeviceButtonActions(XkbDeviceInfoPtr devi, unsigned newTotal) +{ + XkbAction *prev_btn_acts; + + if ((!devi) || (newTotal > 255)) + return BadValue; + if ((devi->btn_acts != NULL) && (newTotal == devi->num_btns)) + return Success; + if (newTotal == 0) { + if (devi->btn_acts != NULL) { + _XkbFree(devi->btn_acts); + devi->btn_acts = NULL; + } + devi->num_btns = 0; + return Success; + } + prev_btn_acts = devi->btn_acts; + devi->btn_acts = _XkbTypedRealloc(devi->btn_acts, newTotal, XkbAction); + if (devi->btn_acts == NULL) { + _XkbFree(prev_btn_acts); + devi->num_btns = 0; + return BadAlloc; + } + if (newTotal > devi->num_btns) { + XkbAction *act; + + act = &devi->btn_acts[devi->num_btns]; + bzero((char *) act, (newTotal - devi->num_btns) * sizeof(XkbAction)); + } + devi->num_btns = newTotal; + return Success; +} + +/*ARGSUSED*/ +XkbDeviceInfoPtr +XkbAllocDeviceInfo(unsigned deviceSpec, unsigned nButtons, unsigned szLeds) +{ + XkbDeviceInfoPtr devi; + + devi = _XkbTypedCalloc(1, XkbDeviceInfoRec); + if (devi != NULL) { + devi->device_spec = deviceSpec; + devi->has_own_state = False; + devi->num_btns = 0; + devi->btn_acts = NULL; + if (nButtons > 0) { + devi->num_btns = nButtons; + devi->btn_acts = _XkbTypedCalloc(nButtons, XkbAction); + if (!devi->btn_acts) { + _XkbFree(devi); + return NULL; + } + } + devi->dflt_kbd_fb = XkbXINone; + devi->dflt_led_fb = XkbXINone; + devi->num_leds = 0; + devi->sz_leds = 0; + devi->leds = NULL; + if (szLeds > 0) { + devi->sz_leds = szLeds; + devi->leds = _XkbTypedCalloc(szLeds, XkbDeviceLedInfoRec); + if (!devi->leds) { + _XkbFree(devi->btn_acts); + _XkbFree(devi); + return NULL; + } + } + } + return devi; +} + + +void +XkbFreeDeviceInfo(XkbDeviceInfoPtr devi, unsigned which, Bool freeDevI) +{ + if (devi) { + if (freeDevI) { + which = XkbXI_AllDeviceFeaturesMask; + if (devi->name) { + _XkbFree(devi->name); + devi->name = NULL; + } + } + if ((which & XkbXI_ButtonActionsMask) && (devi->btn_acts)) { + _XkbFree(devi->btn_acts); + devi->num_btns = 0; + devi->btn_acts = NULL; + } + if ((which & XkbXI_IndicatorsMask) && (devi->leds)) { + register int i; + + if ((which & XkbXI_IndicatorsMask) == XkbXI_IndicatorsMask) { + _XkbFree(devi->leds); + devi->sz_leds = devi->num_leds = 0; + devi->leds = NULL; + } + else { + XkbDeviceLedInfoPtr devli; + + for (i = 0, devli = devi->leds; i < devi->num_leds; + i++, devli++) { + if (which & XkbXI_IndicatorMapsMask) + bzero((char *) &devli->maps[0], sizeof(devli->maps)); + else + bzero((char *) &devli->names[0], sizeof(devli->names)); + } + } + } + if (freeDevI) + _XkbFree(devi); + } + return; +} diff --git a/nx-X11/lib/src/xkb/XKBBell.c b/nx-X11/lib/src/xkb/XKBBell.c new file mode 100644 index 000000000..d3e3a57ff --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBBell.c @@ -0,0 +1,179 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include +#include "XKBlibint.h" + + +Bool +XkbDeviceBell(Display *dpy, + Window window, + int deviceID, + int bellClass, + int bellID, + int percent, + Atom name) +{ + register xkbBellReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbBell, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbBell; + req->deviceSpec = deviceID; + req->window = (CARD32) window; + req->bellClass = (CARD16) bellClass; + req->bellID = (CARD16) bellID; + req->percent = percent; + req->forceSound = False; + req->eventOnly = False; + req->pitch = 0; + req->duration = 0; + req->name = (CARD32) name; + req->pad1 = 0; + req->pad2 = 0; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbForceDeviceBell(Display *dpy, + int deviceID, + int bellClass, + int bellID, + int percent) +{ + register xkbBellReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbBell, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbBell; + req->deviceSpec = deviceID; + req->window = (CARD32) None; + req->bellClass = (CARD16) bellClass; + req->bellID = (CARD16) bellID; + req->percent = percent; + req->forceSound = True; + req->eventOnly = False; + req->pitch = 0; + req->duration = 0; + req->name = None; + req->pad1 = 0; + req->pad2 = 0; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbDeviceBellEvent(Display *dpy, + Window window, + int deviceID, + int bellClass, + int bellID, + int percent, + Atom name) +{ + register xkbBellReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbBell, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbBell; + req->deviceSpec = deviceID; + req->window = (CARD32) window; + req->bellClass = (CARD16) bellClass; + req->bellID = (CARD16) bellID; + req->percent = percent; + req->forceSound = False; + req->eventOnly = True; + req->pitch = 0; + req->duration = 0; + req->name = (CARD32) name; + req->pad1 = 0; + req->pad2 = 0; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbBell(Display *dpy, Window window, int percent, Atom name) +{ + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { + XBell(dpy, percent); + return False; + } + return XkbDeviceBell(dpy, window, XkbUseCoreKbd, + XkbDfltXIClass, XkbDfltXIId, percent, name); +} + +Bool +XkbForceBell(Display *dpy, int percent) +{ + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { + XBell(dpy, percent); + return False; + } + return XkbForceDeviceBell(dpy, XkbUseCoreKbd, XkbDfltXIClass, XkbDfltXIId, + percent); +} + +Bool +XkbBellEvent(Display *dpy, Window window, int percent, Atom name) +{ + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) { + return False; + } + /* class 0 = KbdFeedbackClass (X Input Extension) */ + return XkbDeviceBellEvent(dpy, window, XkbUseCoreKbd, + XkbDfltXIClass, XkbDfltXIId, percent, name); +} diff --git a/nx-X11/lib/src/xkb/XKBBind.c b/nx-X11/lib/src/xkb/XKBBind.c new file mode 100644 index 000000000..c679dc552 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBBind.c @@ -0,0 +1,784 @@ +/* + +Copyright 1985, 1987, 1994, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + + /* the new monsters ate the old ones */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "XKBlib.h" +#include +#include +#include +#include +#include + +#include +#include "XKBlibint.h" + +#define AllMods (ShiftMask|LockMask|ControlMask| \ + Mod1Mask|Mod2Mask|Mod3Mask|Mod4Mask|Mod5Mask) + +static int _XkbLoadDpy(Display *dpy); + +struct _XKeytrans { + struct _XKeytrans *next; /* next on list */ + char *string; /* string to return when the time comes */ + int len; /* length of string (since NULL is legit) */ + KeySym key; /* keysym rebound */ + unsigned int state; /* modifier state */ + KeySym *modifiers; /* modifier keysyms you want */ + int mlen; /* length of modifier list */ +}; + +KeySym +XkbKeycodeToKeysym(Display *dpy, +#if NeedWidePrototypes + unsigned int kc, +#else + KeyCode kc, +#endif + int group, + int level) +{ + XkbDescRec *xkb; + + if (_XkbUnavailable(dpy)) + return NoSymbol; + + _XkbCheckPendingRefresh(dpy, dpy->xkb_info); + + xkb = dpy->xkb_info->desc; + if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) + return NoSymbol; + + if ((group < 0) || (level < 0) || (group >= XkbKeyNumGroups(xkb, kc))) + return NoSymbol; + if (level >= XkbKeyGroupWidth(xkb, kc, group)) { + /* for compatibility with the core protocol, _always_ allow */ + /* two symbols in the first two groups. If either of the */ + /* two is of type ONE_LEVEL, just replicate the first symbol */ + if ((group > XkbGroup2Index) || (XkbKeyGroupWidth(xkb, kc, group) != 1) + || (level != 1)) { + return NoSymbol; + } + level = 0; + } + return XkbKeySymEntry(xkb, kc, level, group); +} + +KeySym +XKeycodeToKeysym(Display *dpy, +#if NeedWidePrototypes + unsigned int kc, +#else + KeyCode kc, +#endif + int col) +{ + XkbDescRec *xkb; + + if (_XkbUnavailable(dpy)) + return _XKeycodeToKeysym(dpy, kc, col); + + _XkbCheckPendingRefresh(dpy, dpy->xkb_info); + + xkb = dpy->xkb_info->desc; + if ((kc < xkb->min_key_code) || (kc > xkb->max_key_code)) + return NoSymbol; + + if (col > 3) { + int lastSym, tmp, nGrp; + + lastSym = 3; + nGrp = XkbKeyNumGroups(xkb, kc); + if ((nGrp > 0) && + ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup1Index)) > 2)) { + if (col <= (lastSym + tmp - 2)) + return XkbKeycodeToKeysym(dpy, kc, XkbGroup1Index, + col - lastSym + 2); + lastSym += tmp - 2; + } + if ((nGrp > 1) && + ((tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup2Index)) > 2)) { + if (col <= (lastSym + tmp - 2)) + return XkbKeycodeToKeysym(dpy, kc, XkbGroup2Index, + col - lastSym + 2); + lastSym += tmp - 2; + } + if (nGrp > 2) { + tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup3Index); + if (col <= lastSym + tmp) + return XkbKeycodeToKeysym(dpy, kc, XkbGroup3Index, + col - lastSym); + lastSym += tmp; + } + if (nGrp > 3) { + tmp = XkbKeyGroupWidth(xkb, kc, XkbGroup4Index); + if (col <= lastSym + tmp) + return XkbKeycodeToKeysym(dpy, kc, XkbGroup4Index, + col - lastSym); + } + return NoSymbol; + } + return XkbKeycodeToKeysym(dpy, kc, (col >> 1), (col & 1)); +} + +KeyCode +XKeysymToKeycode(Display *dpy, KeySym ks) +{ + register int i, j, gotOne; + + if (_XkbUnavailable(dpy)) + return _XKeysymToKeycode(dpy, ks); + _XkbCheckPendingRefresh(dpy, dpy->xkb_info); + + j = 0; + do { + register XkbDescRec *xkb = dpy->xkb_info->desc; + gotOne = 0; + for (i = dpy->min_keycode; i <= dpy->max_keycode; i++) { + if (j < (int) XkbKeyNumSyms(xkb, i)) { + gotOne = 1; + if ((XkbKeySym(xkb, i, j) == ks)) + return i; + } + } + j++; + } while (gotOne); + return 0; +} + +static int +_XkbComputeModmap(Display *dpy) +{ + register XkbDescPtr xkb; + + xkb = dpy->xkb_info->desc; + if (XkbGetUpdatedMap(dpy, XkbModifierMapMask, xkb) == Success) + return 1; + return 0; +} + +unsigned +XkbKeysymToModifiers(Display *dpy, KeySym ks) +{ + XkbDescRec *xkb; + register int i, j; + register KeySym *pSyms; + CARD8 mods; + + if (_XkbUnavailable(dpy)) + return _XKeysymToModifiers(dpy, ks); + _XkbCheckPendingRefresh(dpy, dpy->xkb_info); + + if (_XkbNeedModmap(dpy->xkb_info) && (!_XkbComputeModmap(dpy))) + return _XKeysymToModifiers(dpy, ks); + + xkb = dpy->xkb_info->desc; + mods = 0; + for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { + pSyms = XkbKeySymsPtr(xkb, i); + for (j = XkbKeyNumSyms(xkb, i) - 1; j >= 0; j--) { + if (pSyms[j] == ks) { + mods |= xkb->map->modmap[i]; + break; + } + } + } + return mods; +} + +KeySym +XLookupKeysym(register XKeyEvent * event, int col) +{ + Display *dpy = event->display; + + if (_XkbUnavailable(dpy)) + return _XLookupKeysym(event, col); + _XkbCheckPendingRefresh(dpy, dpy->xkb_info); + return XKeycodeToKeysym(dpy, event->keycode, col); +} + + /* + * Not a public entry point -- XkbTranslateKey is an obsolete name + * that is preserved here so that functions linked against the old + * version will continue to work in a shared library environment. + */ +int +XkbTranslateKey(register Display *dpy, + KeyCode key, + register unsigned int mods, + unsigned int *mods_rtrn, + KeySym *keysym_rtrn); + +int +XkbTranslateKey(register Display *dpy, + KeyCode key, + register unsigned int mods, + unsigned int *mods_rtrn, + KeySym *keysym_rtrn) +{ + return XkbLookupKeySym(dpy, key, mods, mods_rtrn, keysym_rtrn); +} + +Bool +XkbLookupKeySym(register Display *dpy, + KeyCode key, + register unsigned int mods, + unsigned int *mods_rtrn, + KeySym *keysym_rtrn) +{ + if (_XkbUnavailable(dpy)) + return _XTranslateKey(dpy, key, mods, mods_rtrn, keysym_rtrn); + _XkbCheckPendingRefresh(dpy, dpy->xkb_info); + return XkbTranslateKeyCode(dpy->xkb_info->desc, key, mods, mods_rtrn, + keysym_rtrn); +} + +Bool +XkbTranslateKeyCode(register XkbDescPtr xkb, + KeyCode key, + register unsigned int mods, + unsigned int *mods_rtrn, + KeySym *keysym_rtrn) +{ + XkbKeyTypeRec *type; + int col, nKeyGroups; + unsigned preserve, effectiveGroup; + KeySym *syms; + + if (mods_rtrn != NULL) + *mods_rtrn = 0; + + nKeyGroups = XkbKeyNumGroups(xkb, key); + if ((!XkbKeycodeInRange(xkb, key)) || (nKeyGroups == 0)) { + if (keysym_rtrn != NULL) + *keysym_rtrn = NoSymbol; + return False; + } + + syms = XkbKeySymsPtr(xkb, key); + + /* find the offset of the effective group */ + col = 0; + effectiveGroup = XkbGroupForCoreState(mods); + if (effectiveGroup >= nKeyGroups) { + unsigned groupInfo = XkbKeyGroupInfo(xkb, key); + + switch (XkbOutOfRangeGroupAction(groupInfo)) { + default: + effectiveGroup %= nKeyGroups; + break; + case XkbClampIntoRange: + effectiveGroup = nKeyGroups - 1; + break; + case XkbRedirectIntoRange: + effectiveGroup = XkbOutOfRangeGroupNumber(groupInfo); + if (effectiveGroup >= nKeyGroups) + effectiveGroup = 0; + break; + } + } + col = effectiveGroup * XkbKeyGroupsWidth(xkb, key); + type = XkbKeyKeyType(xkb, key, effectiveGroup); + + preserve = 0; + if (type->map) { /* find the column (shift level) within the group */ + register int i; + register XkbKTMapEntryPtr entry; + + for (i = 0, entry = type->map; i < type->map_count; i++, entry++) { + if ((entry->active) && + ((mods & type->mods.mask) == entry->mods.mask)) { + col += entry->level; + if (type->preserve) + preserve = type->preserve[i].mask; + break; + } + } + } + + if (keysym_rtrn != NULL) + *keysym_rtrn = syms[col]; + if (mods_rtrn) { + *mods_rtrn = type->mods.mask & (~preserve); + /* The Motif VTS doesn't get the help callback called if help + * is bound to Shift+, and it appears as though it + * is XkbTranslateKeyCode that is causing the problem. The + * core X version of XTranslateKey always OR's in ShiftMask + * and LockMask for mods_rtrn, so this "fix" keeps this behavior + * and solves the VTS problem. + */ + if ((xkb->dpy) && (xkb->dpy->xkb_info) && + (xkb->dpy->xkb_info-> + xlib_ctrls & XkbLC_AlwaysConsumeShiftAndLock)) { + *mods_rtrn |= (ShiftMask | LockMask); + } + } + return (syms[col] != NoSymbol); +} + +Status +XkbRefreshKeyboardMapping(register XkbMapNotifyEvent * event) +{ + Display *dpy = event->display; + XkbInfoPtr xkbi; + + if (_XkbUnavailable(dpy)) { + _XRefreshKeyboardMapping((XMappingEvent *) event); + return Success; + } + xkbi = dpy->xkb_info; + + if (((event->type & 0x7f) - xkbi->codes->first_event) != XkbEventCode) + return BadMatch; + if (event->xkb_type == XkbNewKeyboardNotify) { + _XkbReloadDpy(dpy); + return Success; + } + if (event->xkb_type == XkbMapNotify) { + XkbMapChangesRec changes; + Status rtrn; + + if (xkbi->flags & XkbMapPending) + changes = xkbi->changes; + else + bzero(&changes, sizeof(changes)); + XkbNoteMapChanges(&changes, event, XKB_XLIB_MAP_MASK); + if ((rtrn = XkbGetMapChanges(dpy, xkbi->desc, &changes)) != Success) { +#ifdef DEBUG + fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); +#endif + xkbi->changes = changes; + } + else if (xkbi->flags & XkbMapPending) { + xkbi->flags &= ~XkbMapPending; + bzero(&xkbi->changes, sizeof(XkbMapChangesRec)); + } + return rtrn; + } + return BadMatch; +} + +int +XRefreshKeyboardMapping(register XMappingEvent * event) +{ + XkbEvent *xkbevent = (XkbEvent *) event; + Display *dpy = event->display; + XkbMapChangesRec changes; + XkbInfoPtr xkbi; + + /* always do this for input methods, which still use the old keymap */ + (void) _XRefreshKeyboardMapping(event); + + if (_XkbUnavailable(dpy)) + return 1; + + xkbi = dpy->xkb_info; + + if (((event->type & 0x7f) - xkbi->codes->first_event) == XkbEventCode) + return XkbRefreshKeyboardMapping(&xkbevent->map); + + if (xkbi->flags & XkbXlibNewKeyboard) { + _XkbReloadDpy(dpy); + return 1; + } + + if ((xkbi->flags & XkbMapPending) || (event->request == MappingKeyboard)) { + if (xkbi->flags & XkbMapPending) { + changes = xkbi->changes; + _XkbNoteCoreMapChanges(&changes, event, XKB_XLIB_MAP_MASK); + } + else { + bzero(&changes, sizeof(changes)); + changes.changed = XkbKeySymsMask; + if (xkbi->desc->min_key_code < xkbi->desc->max_key_code) { + changes.first_key_sym = xkbi->desc->min_key_code; + changes.num_key_syms = xkbi->desc->max_key_code - + xkbi->desc->min_key_code + 1; + } + else { + changes.first_key_sym = event->first_keycode; + changes.num_key_syms = event->count; + } + } + + if (XkbGetMapChanges(dpy, xkbi->desc, &changes) != Success) { +#ifdef DEBUG + fprintf(stderr, "Internal Error! XkbGetMapChanges failed:\n"); + if (changes.changed & XkbKeyTypesMask) { + int first = changes.first_type; + int last = changes.first_type + changes.num_types - 1; + + fprintf(stderr, " types: %d..%d\n", first, last); + } + if (changes.changed & XkbKeySymsMask) { + int first = changes.first_key_sym; + int last = changes.first_key_sym + changes.num_key_syms - 1; + + fprintf(stderr, " symbols: %d..%d\n", first, last); + } + if (changes.changed & XkbKeyActionsMask) { + int first = changes.first_key_act; + int last = changes.first_key_act + changes.num_key_acts - 1; + + fprintf(stderr, " acts: %d..%d\n", first, last); + } + if (changes.changed & XkbKeyBehaviorsMask) { + int first = changes.first_key_behavior; + int last = first + changes.num_key_behaviors - 1; + + fprintf(stderr, " behaviors: %d..%d\n", first, last); + } + if (changes.changed & XkbVirtualModsMask) { + fprintf(stderr, "virtual mods: 0x%04x\n", changes.vmods); + } + if (changes.changed & XkbExplicitComponentsMask) { + int first = changes.first_key_explicit; + int last = first + changes.num_key_explicit - 1; + + fprintf(stderr, " explicit: %d..%d\n", first, last); + } +#endif + } + LockDisplay(dpy); + if (xkbi->flags & XkbMapPending) { + xkbi->flags &= ~XkbMapPending; + bzero(&xkbi->changes, sizeof(XkbMapChangesRec)); + } + UnlockDisplay(dpy); + } + if (event->request == MappingModifier) { + LockDisplay(dpy); + if (xkbi->desc->map->modmap) { + _XkbFree(xkbi->desc->map->modmap); + xkbi->desc->map->modmap = NULL; + } + if (dpy->key_bindings) { + register struct _XKeytrans *p; + + for (p = dpy->key_bindings; p; p = p->next) { + register int i; + + p->state = 0; + if (p->mlen > 0) { + for (i = 0; i < p->mlen; i++) { + p->state |= XkbKeysymToModifiers(dpy, p->modifiers[i]); + } + if (p->state) + p->state &= AllMods; + else + p->state = AnyModifier; + } + } + } + UnlockDisplay(dpy); + } + return 1; +} + +static int +_XkbLoadDpy(Display *dpy) +{ + XkbInfoPtr xkbi; + unsigned query, oldEvents; + XkbDescRec *desc; + + if (!XkbUseExtension(dpy, NULL, NULL)) + return 0; + + xkbi = dpy->xkb_info; + query = XkbAllClientInfoMask; + desc = XkbGetMap(dpy, query, XkbUseCoreKbd); + if (!desc) { +#ifdef DEBUG + fprintf(stderr, "Warning! XkbGetMap failed!\n"); +#endif + return 0; + } + LockDisplay(dpy); + xkbi->desc = desc; + + UnlockDisplay(dpy); + oldEvents = xkbi->selected_events; + if (!(xkbi->xlib_ctrls & XkbLC_IgnoreNewKeyboards)) { + XkbSelectEventDetails(dpy, xkbi->desc->device_spec, + XkbNewKeyboardNotify, + XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask, + XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask); + } + XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, + XkbAllClientInfoMask, XkbAllClientInfoMask); + LockDisplay(dpy); + xkbi->selected_events = oldEvents; + UnlockDisplay(dpy); + return 1; +} + +void +_XkbReloadDpy(Display *dpy) +{ + XkbInfoPtr xkbi; + XkbDescRec *desc; + unsigned oldDeviceID; + + if (_XkbUnavailable(dpy)) + return; + + xkbi = dpy->xkb_info; + LockDisplay(dpy); + if (xkbi->desc) { + oldDeviceID = xkbi->desc->device_spec; + XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); + xkbi->desc = NULL; + xkbi->flags &= ~(XkbMapPending | XkbXlibNewKeyboard); + xkbi->changes.changed = 0; + } + else + oldDeviceID = XkbUseCoreKbd; + UnlockDisplay(dpy); + desc = XkbGetMap(dpy, XkbAllClientInfoMask, XkbUseCoreKbd); + if (!desc) + return; + LockDisplay(dpy); + xkbi->desc = desc; + UnlockDisplay(dpy); + + if (desc->device_spec != oldDeviceID) { + /* transfer(?) event masks here */ +#ifdef NOTYET + unsigned oldEvents; + + oldEvents = xkbi->selected_events; + XkbSelectEventDetails(dpy, xkbi->desc->device_spec, XkbMapNotify, + XkbAllMapComponentsMask, XkbAllClientInfoMask); + LockDisplay(dpy); + xkbi->selected_events = oldEvents; + UnlockDisplay(dpy); +#endif + } + return; +} + +int +XkbTranslateKeySym(register Display *dpy, + register KeySym *sym_rtrn, + unsigned int mods, + char *buffer, + int nbytes, + int *extra_rtrn) +{ + register XkbInfoPtr xkb; + XkbKSToMBFunc cvtr; + XPointer priv; + char tmp[4]; + int n; + + xkb = dpy->xkb_info; + if (!xkb->cvt.KSToMB) { + _XkbGetConverters(_XkbGetCharset(), &xkb->cvt); + _XkbGetConverters("ISO8859-1", &xkb->latin1cvt); + } + + if (extra_rtrn) + *extra_rtrn = 0; + + if ((buffer == NULL) || (nbytes == 0)) { + buffer = tmp; + nbytes = 4; + } + + /* see if symbol rebound, if so, return that string. */ + n = XkbLookupKeyBinding(dpy, *sym_rtrn, mods, buffer, nbytes, extra_rtrn); + if (n) + return n; + + if (nbytes > 0) + buffer[0] = '\0'; + + if (xkb->cvt.KSToUpper && (mods & LockMask)) { + *sym_rtrn = (*xkb->cvt.KSToUpper) (*sym_rtrn); + } + if (xkb->xlib_ctrls & XkbLC_ForceLatin1Lookup) { + cvtr = xkb->latin1cvt.KSToMB; + priv = xkb->latin1cvt.KSToMBPriv; + } + else { + cvtr = xkb->cvt.KSToMB; + priv = xkb->cvt.KSToMBPriv; + } + + n = (*cvtr) (priv, *sym_rtrn, buffer, nbytes, extra_rtrn); + + if ((!xkb->cvt.KSToUpper) && (mods & LockMask)) { + register int i; + int change; + + for (i = change = 0; i < n; i++) { + char ch = toupper(buffer[i]); + change = (change || (buffer[i] != ch)); + buffer[i] = ch; + } + if (change) { + if (n == 1) + *sym_rtrn = + (*xkb->cvt.MBToKS) (xkb->cvt.MBToKSPriv, buffer, n, NULL); + else + *sym_rtrn = NoSymbol; + } + } + + if (mods & ControlMask) { + if (n == 1) { + buffer[0] = XkbToControl(buffer[0]); + if (nbytes > 1) + buffer[1] = '\0'; + return 1; + } + if (nbytes > 0) + buffer[0] = '\0'; + return 0; + } + return n; +} + +int +XLookupString(register XKeyEvent *event, + char *buffer, + int nbytes, + KeySym *keysym, + XComposeStatus *status) +{ + KeySym dummy; + int rtrnLen; + unsigned int new_mods; + Display *dpy = event->display; + + if (keysym == NULL) + keysym = &dummy; + if (!XkbLookupKeySym(dpy, event->keycode, event->state, &new_mods, keysym)) + return 0; + new_mods = (event->state & (~new_mods)); + + /* find the group where a symbol can be converted to control one */ + if (new_mods & ControlMask && *keysym > 0x7F && + (dpy->xkb_info->xlib_ctrls & XkbLC_ControlFallback)) { + XKeyEvent tmp_ev = *event; + KeySym tmp_keysym; + unsigned int tmp_new_mods; + + if (_XkbUnavailable(dpy)) { + tmp_ev.state = event->state ^ dpy->mode_switch; + if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, + &tmp_new_mods, &tmp_keysym) && + tmp_keysym != NoSymbol && tmp_keysym < 0x80) { + *keysym = tmp_keysym; + } + } + else { + int n = XkbKeyNumGroups(dpy->xkb_info->desc, tmp_ev.keycode); + int i; + + for (i = 0; i < n; i++) { + if (XkbGroupForCoreState(event->state) == i) + continue; + tmp_ev.state = XkbBuildCoreState(tmp_ev.state, i); + if (XkbLookupKeySym(dpy, tmp_ev.keycode, tmp_ev.state, + &tmp_new_mods, &tmp_keysym) && + tmp_keysym != NoSymbol && tmp_keysym < 0x80) { + *keysym = tmp_keysym; + new_mods = (event->state & (~tmp_new_mods)); + break; + } + } + } + } + + /* We *should* use the new_mods (which does not contain any modifiers */ + /* that were used to compute the symbol here, but pre-XKB XLookupString */ + /* did not and we have to remain compatible. Sigh. */ + if (_XkbUnavailable(dpy) || + (dpy->xkb_info->xlib_ctrls & XkbLC_ConsumeLookupMods) == 0) + new_mods = event->state; + + rtrnLen = XkbLookupKeyBinding(dpy, *keysym, new_mods, buffer, nbytes, NULL); + if (rtrnLen > 0) + return rtrnLen; + + return XkbTranslateKeySym(dpy, keysym, new_mods, buffer, nbytes, NULL); +} + + +int +XkbLookupKeyBinding(Display *dpy, + register KeySym sym, + unsigned int mods, + char *buffer, + int nbytes, + int *extra_rtrn) +{ + register struct _XKeytrans *p; + + if (extra_rtrn) + *extra_rtrn = 0; + for (p = dpy->key_bindings; p; p = p->next) { + if (((mods & AllMods) == p->state) && (sym == p->key)) { + int tmp = p->len; + + if (tmp > nbytes) { + if (extra_rtrn) + *extra_rtrn = (tmp - nbytes); + tmp = nbytes; + } + memcpy(buffer, p->string, tmp); + if (tmp < nbytes) + buffer[tmp] = '\0'; + return tmp; + } + } + return 0; +} + +char +XkbToControl(char ch) +{ + register char c = ch; + + if ((c >= '@' && c < '\177') || c == ' ') + c &= 0x1F; + else if (c == '2') + c = '\000'; + else if (c >= '3' && c <= '7') + c -= ('3' - '\033'); + else if (c == '8') + c = '\177'; + else if (c == '/') + c = '_' & 0x1F; + return c; +} diff --git a/nx-X11/lib/src/xkb/XKBCompat.c b/nx-X11/lib/src/xkb/XKBCompat.c new file mode 100644 index 000000000..a5222b56e --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBCompat.c @@ -0,0 +1,252 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#define NEED_MAP_READERS +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +Status +_XkbReadGetCompatMapReply(Display *dpy, + xkbGetCompatMapReply *rep, + XkbDescPtr xkb, + int *nread_rtrn) +{ + register int i; + XkbReadBufferRec buf; + + if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) + return BadAlloc; + + if (nread_rtrn) + *nread_rtrn = (int) rep->length * 4; + + i = rep->firstSI + rep->nSI; + if ((!xkb->compat) && + (XkbAllocCompatMap(xkb, XkbAllCompatMask, i) != Success)) + return BadAlloc; + + if (rep->nSI != 0) { + XkbSymInterpretRec *syms; + xkbSymInterpretWireDesc *wire; + + wire = (xkbSymInterpretWireDesc *) _XkbGetReadBufferPtr(&buf, + rep->nSI * SIZEOF (xkbSymInterpretWireDesc)); + if (wire == NULL) + goto BAILOUT; + syms = &xkb->compat->sym_interpret[rep->firstSI]; + + for (i = 0; i < rep->nSI; i++, syms++, wire++) { + syms->sym = wire->sym; + syms->mods = wire->mods; + syms->match = wire->match; + syms->virtual_mod = wire->virtualMod; + syms->flags = wire->flags; + syms->act = *((XkbAnyAction *) &wire->act); + } + xkb->compat->num_si += rep->nSI; + } + + if (rep->groups & XkbAllGroupsMask) { + register unsigned bit, nGroups; + xkbModsWireDesc *wire; + + for (i = 0, nGroups = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { + if (rep->groups & bit) + nGroups++; + } + wire = (xkbModsWireDesc *) + _XkbGetReadBufferPtr(&buf, nGroups * SIZEOF(xkbModsWireDesc)); + if (wire == NULL) + goto BAILOUT; + for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { + if ((rep->groups & bit) == 0) + continue; + xkb->compat->groups[i].mask = wire->mask; + xkb->compat->groups[i].real_mods = wire->realMods; + xkb->compat->groups[i].vmods = wire->virtualMods; + wire++; + } + } + i = _XkbFreeReadBuffer(&buf); + if (i) + fprintf(stderr, "CompatMapReply! Bad length (%d extra bytes)\n", i); + if (i || buf.error) + return BadLength; + return Success; + BAILOUT: + _XkbFreeReadBuffer(&buf); + return BadLength; +} + +Status +XkbGetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb) +{ + register xkbGetCompatMapReq *req; + xkbGetCompatMapReply rep; + Status status; + XkbInfoPtr xkbi; + + if ((!dpy) || (!xkb) || (dpy->flags & XlibDisplayNoXkb) || + ((xkb->dpy != NULL) && (xkb->dpy != dpy)) || + (!dpy->xkb_info && (!XkbUseExtension(dpy, NULL, NULL)))) + return BadAccess; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbGetCompatMap, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetCompatMap; + req->deviceSpec = xkb->device_spec; + if (which & XkbSymInterpMask) + req->getAllSI = True; + else + req->getAllSI = False; + req->firstSI = req->nSI = 0; + + if (which & XkbGroupCompatMask) + req->groups = XkbAllGroupsMask; + else + req->groups = 0; + + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadLength; + } + if (xkb->dpy == NULL) + xkb->dpy = dpy; + if (xkb->device_spec == XkbUseCoreKbd) + xkb->device_spec = rep.deviceID; + + status = _XkbReadGetCompatMapReply(dpy, &rep, xkb, NULL); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +static Bool +_XkbWriteSetCompatMap(Display *dpy, xkbSetCompatMapReq *req, XkbDescPtr xkb) +{ + CARD16 firstSI; + CARD16 nSI; + int size; + register int i, nGroups; + register unsigned bit; + unsigned groups; + char *buf; + + firstSI = req->firstSI; + nSI = req->nSI; + size = nSI * SIZEOF(xkbSymInterpretWireDesc); + nGroups = 0; + groups = req->groups; + if (groups & XkbAllGroupsMask) { + for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { + if (groups & bit) + nGroups++; + } + size += SIZEOF(xkbModsWireDesc) * nGroups; + } + req->length += size / 4; + BufAlloc(char *, buf, size); + + if (!buf) + return False; + + if (nSI) { + XkbSymInterpretPtr sym = &xkb->compat->sym_interpret[firstSI]; + xkbSymInterpretWireDesc *wire = (xkbSymInterpretWireDesc *) buf; + + for (i = 0; i < nSI; i++, wire++, sym++) { + wire->sym = (CARD32) sym->sym; + wire->mods = sym->mods; + wire->match = sym->match; + wire->flags = sym->flags; + wire->virtualMod = sym->virtual_mod; + memcpy(&wire->act, &sym->act, sz_xkbActionWireDesc); + } + buf += nSI * SIZEOF(xkbSymInterpretWireDesc); + } + if (groups & XkbAllGroupsMask) { + xkbModsWireDesc *out = (xkbModsWireDesc *) buf; + + for (i = 0, bit = 1; i < XkbNumKbdGroups; i++, bit <<= 1) { + if ((groups & bit) != 0) { + out->mask = xkb->compat->groups[i].mask; + out->realMods = xkb->compat->groups[i].real_mods; + out->virtualMods = xkb->compat->groups[i].vmods; + out++; + } + } + buf += nGroups * SIZEOF(xkbModsWireDesc); + } + return True; +} + +Bool +XkbSetCompatMap(Display *dpy, unsigned which, XkbDescPtr xkb, + Bool updateActions) +{ + register xkbSetCompatMapReq *req; + Status ok; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || (dpy != xkb->dpy) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!xkb->compat) || + ((which & XkbSymInterpMask) && (!xkb->compat->sym_interpret))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetCompatMap, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetCompatMap; + req->deviceSpec = xkb->device_spec; + req->recomputeActions = updateActions; + if (which & XkbSymInterpMask) { + req->truncateSI = True; + req->firstSI = 0; + req->nSI = xkb->compat->num_si; + } + else { + req->truncateSI = False; + req->firstSI = 0; + req->nSI = 0; + } + if (which & XkbGroupCompatMask) + req->groups = XkbAllGroupsMask; + else + req->groups = 0; + ok = _XkbWriteSetCompatMap(dpy, req, xkb); + UnlockDisplay(dpy); + SyncHandle(); + return ok; +} diff --git a/nx-X11/lib/src/xkb/XKBCtrls.c b/nx-X11/lib/src/xkb/XKBCtrls.c new file mode 100644 index 000000000..2e8546d92 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBCtrls.c @@ -0,0 +1,351 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include +#include "XKBlibint.h" + + +static xkbSetControlsReq * +_XkbGetSetControlsReq(Display *dpy, XkbInfoPtr xkbi, unsigned int deviceSpec) +{ + xkbSetControlsReq *req; + + GetReq(kbSetControls, req); + bzero(req, SIZEOF(xkbSetControlsReq)); + req->reqType = xkbi->codes->major_opcode; + req->length = (SIZEOF(xkbSetControlsReq) >> 2); + req->xkbReqType = X_kbSetControls; + req->deviceSpec = deviceSpec; + return req; +} + +Bool +XkbSetAutoRepeatRate(Display *dpy, + unsigned int deviceSpec, + unsigned int timeout, + unsigned int interval) +{ + register xkbSetControlsReq *req; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); + req->changeCtrls = XkbRepeatKeysMask; + req->repeatDelay = timeout; + req->repeatInterval = interval; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbGetAutoRepeatRate(Display *dpy, + unsigned int deviceSpec, + unsigned int *timeoutp, + unsigned int *intervalp) +{ + register xkbGetControlsReq *req; + xkbGetControlsReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbGetControls, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetControls; + req->deviceSpec = deviceSpec; + if (!_XReply(dpy, (xReply *) &rep, + (SIZEOF(xkbGetControlsReply) - SIZEOF(xReply)) >> 2, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + *timeoutp = rep.repeatDelay; + *intervalp = rep.repeatInterval; + return True; +} + +Bool +XkbSetServerInternalMods(Display *dpy, + unsigned deviceSpec, + unsigned affectReal, + unsigned realValues, + unsigned affectVirtual, + unsigned virtualValues) +{ + register xkbSetControlsReq *req; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); + req->affectInternalMods = affectReal; + req->internalMods = realValues; + req->affectInternalVMods = affectVirtual; + req->internalVMods = virtualValues; + req->changeCtrls = XkbInternalModsMask; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbSetIgnoreLockMods(Display *dpy, + unsigned int deviceSpec, + unsigned affectReal, + unsigned realValues, + unsigned affectVirtual, + unsigned virtualValues) +{ + register xkbSetControlsReq *req; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); + req->affectIgnoreLockMods = affectReal; + req->ignoreLockMods = realValues; + req->affectIgnoreLockVMods = affectVirtual; + req->ignoreLockVMods = virtualValues; + req->changeCtrls = XkbIgnoreLockModsMask; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbChangeEnabledControls(Display *dpy, + unsigned deviceSpec, + unsigned affect, + unsigned values) +{ + register xkbSetControlsReq *req; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, deviceSpec); + req->affectEnabledCtrls = affect; + req->enabledCtrls = (affect & values); + req->changeCtrls = XkbControlsEnabledMask; + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Status +XkbGetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) +{ + register xkbGetControlsReq *req; + xkbGetControlsReply rep; + XkbControlsPtr ctrls; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + if ((!xkb) || (!which)) + return BadMatch; + + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbGetControls, req); + if (!xkb->ctrls) { + xkb->ctrls = _XkbTypedCalloc(1, XkbControlsRec); + if (!xkb->ctrls) { + UnlockDisplay(dpy); + SyncHandle(); + return BadAlloc; + } + } + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetControls; + req->deviceSpec = xkb->device_spec; + if (!_XReply(dpy, (xReply *) &rep, + (SIZEOF(xkbGetControlsReply) - SIZEOF(xReply)) >> 2, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadImplementation; + } + if (xkb->device_spec == XkbUseCoreKbd) + xkb->device_spec = rep.deviceID; + ctrls = xkb->ctrls; + if (which & XkbControlsEnabledMask) + ctrls->enabled_ctrls = rep.enabledCtrls; + ctrls->num_groups = rep.numGroups; + if (which & XkbGroupsWrapMask) + ctrls->groups_wrap = rep.groupsWrap; + if (which & XkbInternalModsMask) { + ctrls->internal.mask = rep.internalMods; + ctrls->internal.real_mods = rep.internalRealMods; + ctrls->internal.vmods = rep.internalVMods; + } + if (which & XkbIgnoreLockModsMask) { + ctrls->ignore_lock.mask = rep.ignoreLockMods; + ctrls->ignore_lock.real_mods = rep.ignoreLockRealMods; + ctrls->ignore_lock.vmods = rep.ignoreLockVMods; + } + if (which & XkbRepeatKeysMask) { + ctrls->repeat_delay = rep.repeatDelay; + ctrls->repeat_interval = rep.repeatInterval; + } + if (which & XkbSlowKeysMask) + ctrls->slow_keys_delay = rep.slowKeysDelay; + if (which & XkbBounceKeysMask) + ctrls->debounce_delay = rep.debounceDelay; + if (which & XkbMouseKeysMask) { + ctrls->mk_dflt_btn = rep.mkDfltBtn; + } + if (which & XkbMouseKeysAccelMask) { + ctrls->mk_delay = rep.mkDelay; + ctrls->mk_interval = rep.mkInterval; + ctrls->mk_time_to_max = rep.mkTimeToMax; + ctrls->mk_max_speed = rep.mkMaxSpeed; + ctrls->mk_curve = rep.mkCurve; + } + if (which & XkbAccessXKeysMask) + ctrls->ax_options = rep.axOptions; + if (which & XkbStickyKeysMask) { + ctrls->ax_options &= ~XkbAX_SKOptionsMask; + ctrls->ax_options |= rep.axOptions & XkbAX_SKOptionsMask; + } + if (which & XkbAccessXFeedbackMask) { + ctrls->ax_options &= ~XkbAX_FBOptionsMask; + ctrls->ax_options |= rep.axOptions & XkbAX_FBOptionsMask; + } + if (which & XkbAccessXTimeoutMask) { + ctrls->ax_timeout = rep.axTimeout; + ctrls->axt_ctrls_mask = rep.axtCtrlsMask; + ctrls->axt_ctrls_values = rep.axtCtrlsValues; + ctrls->axt_opts_mask = rep.axtOptsMask; + ctrls->axt_opts_values = rep.axtOptsValues; + } + if (which & XkbPerKeyRepeatMask) { + memcpy(ctrls->per_key_repeat, rep.perKeyRepeat, XkbPerKeyBitArraySize); + } + UnlockDisplay(dpy); + SyncHandle(); + return Success; +} + +Bool +XkbSetControls(Display *dpy, unsigned long which, XkbDescPtr xkb) +{ + register xkbSetControlsReq *req; + XkbControlsPtr ctrls; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!xkb) || (!xkb->ctrls)) + return False; + + ctrls = xkb->ctrls; + LockDisplay(dpy); + req = _XkbGetSetControlsReq(dpy, dpy->xkb_info, xkb->device_spec); + req->changeCtrls = (CARD32) which; + if (which & XkbInternalModsMask) { + req->affectInternalMods = ~0; + req->internalMods = ctrls->internal.real_mods; + req->affectInternalVMods = ~0; + req->internalVMods = ctrls->internal.vmods; + } + if (which & XkbIgnoreLockModsMask) { + req->affectIgnoreLockMods = ~0; + req->ignoreLockMods = ctrls->ignore_lock.real_mods; + req->affectIgnoreLockVMods = ~0; + req->ignoreLockVMods = ctrls->ignore_lock.vmods; + } + if (which & XkbControlsEnabledMask) { + req->affectEnabledCtrls = XkbAllBooleanCtrlsMask; + req->enabledCtrls = ctrls->enabled_ctrls; + } + if (which & XkbRepeatKeysMask) { + req->repeatDelay = ctrls->repeat_delay; + req->repeatInterval = ctrls->repeat_interval; + } + if (which & XkbSlowKeysMask) + req->slowKeysDelay = ctrls->slow_keys_delay; + if (which & XkbBounceKeysMask) + req->debounceDelay = ctrls->debounce_delay; + if (which & XkbMouseKeysMask) { + req->mkDfltBtn = ctrls->mk_dflt_btn; + } + if (which & XkbGroupsWrapMask) + req->groupsWrap = ctrls->groups_wrap; + if (which & + (XkbAccessXKeysMask | XkbStickyKeysMask | XkbAccessXFeedbackMask)) + req->axOptions = ctrls->ax_options; + if (which & XkbMouseKeysAccelMask) { + req->mkDelay = ctrls->mk_delay; + req->mkInterval = ctrls->mk_interval; + req->mkTimeToMax = ctrls->mk_time_to_max; + req->mkMaxSpeed = ctrls->mk_max_speed; + req->mkCurve = ctrls->mk_curve; + } + if (which & XkbAccessXTimeoutMask) { + req->axTimeout = ctrls->ax_timeout; + req->axtCtrlsMask = ctrls->axt_ctrls_mask; + req->axtCtrlsValues = ctrls->axt_ctrls_values; + req->axtOptsMask = ctrls->axt_opts_mask; + req->axtOptsValues = ctrls->axt_opts_values; + } + if (which & XkbPerKeyRepeatMask) { + memcpy(req->perKeyRepeat, ctrls->per_key_repeat, XkbPerKeyBitArraySize); + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +/***====================================================================***/ + +void +XkbNoteControlsChanges(XkbControlsChangesPtr old, + XkbControlsNotifyEvent *new, + unsigned int wanted) +{ + old->changed_ctrls |= (new->changed_ctrls & wanted); + if (new->changed_ctrls & XkbControlsEnabledMask & wanted) + old->enabled_ctrls_changes ^= new->enabled_ctrl_changes; + /* num_groups_changed?? */ + return; +} diff --git a/nx-X11/lib/src/xkb/XKBCvt.c b/nx-X11/lib/src/xkb/XKBCvt.c new file mode 100644 index 000000000..c42c3af1c --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBCvt.c @@ -0,0 +1,341 @@ +/* + +Copyright 1988, 1989, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include + +#include +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include "XlcPubI.h" +#include "Ximint.h" +#include +#include +#define XK_LATIN1 +#define XK_PUBLISHING +#include +#include +#include "XKBlibint.h" +#include +#include +#include + +static int +_XkbHandleSpecialSym(KeySym keysym, char *buffer, int nbytes, int *extra_rtrn) +{ + + /* try to convert to Latin-1, handling ctrl */ + if (!(((keysym >= XK_BackSpace) && (keysym <= XK_Clear)) || + (keysym == XK_Return) || (keysym == XK_Escape) || + (keysym == XK_KP_Space) || (keysym == XK_KP_Tab) || + (keysym == XK_KP_Enter) || + ((keysym >= XK_KP_Multiply) && (keysym <= XK_KP_9)) || + (keysym == XK_KP_Equal) || (keysym == XK_Delete))) + return 0; + + if (nbytes < 1) { + if (extra_rtrn) + *extra_rtrn = 1; + return 0; + } + /* if X keysym, convert to ascii by grabbing low 7 bits */ + if (keysym == XK_KP_Space) + buffer[0] = XK_space & 0x7F; /* patch encoding botch */ + else if (keysym == XK_hyphen) + buffer[0] = (char) (XK_minus & 0xFF); /* map to equiv character */ + else + buffer[0] = (char) (keysym & 0x7F); + return 1; +} + +/*ARGSUSED*/ +static int +_XkbKSToKnownSet(XPointer priv, + KeySym keysym, + char *buffer, + int nbytes, + int *extra_rtrn) +{ + char tbuf[8], *buf; + + if (extra_rtrn) + *extra_rtrn = 0; + + /* convert "dead" diacriticals for dumb applications */ + if ((keysym & 0xffffff00) == 0xfe00) { + switch (keysym) { + case XK_dead_grave: keysym = XK_grave; break; + case XK_dead_acute: keysym = XK_acute; break; + case XK_dead_circumflex: keysym = XK_asciicircum; break; + case XK_dead_tilde: keysym = XK_asciitilde; break; + case XK_dead_macron: keysym = XK_macron; break; + case XK_dead_breve: keysym = XK_breve; break; + case XK_dead_abovedot: keysym = XK_abovedot; break; + case XK_dead_diaeresis: keysym = XK_diaeresis; break; + case XK_dead_abovering: keysym = XK_degree; break; + case XK_dead_doubleacute: keysym = XK_doubleacute; break; + case XK_dead_caron: keysym = XK_caron; break; + case XK_dead_cedilla: keysym = XK_cedilla; break; + case XK_dead_ogonek: keysym = XK_ogonek; break; + case XK_dead_iota: keysym = XK_Greek_iota; break; +#ifdef XK_KATAKANA + case XK_dead_voiced_sound: keysym = XK_voicedsound; break; + case XK_dead_semivoiced_sound: keysym = XK_semivoicedsound; break; +#endif + } + } + + if (nbytes < 1) + buf = tbuf; + else + buf = buffer; + + if ((keysym & 0xffffff00) == 0xff00) { + return _XkbHandleSpecialSym(keysym, buf, nbytes, extra_rtrn); + } + return _XimGetCharCode(priv, keysym, (unsigned char *) buf, nbytes); +} + +typedef struct _XkbToKS { + unsigned prefix; + char *map; +} XkbToKS; + +/*ARGSUSED*/ +static KeySym +_XkbKnownSetToKS(XPointer priv, char *buffer, int nbytes, Status *status) +{ + if (nbytes != 1) + return NoSymbol; + if (((buffer[0] & 0x80) == 0) && (buffer[0] >= 32)) + return buffer[0]; + else if ((buffer[0] & 0x7f) >= 32) { + XkbToKS *map = (XkbToKS *) priv; + + if (map) { + if (map->map) + return map->prefix | map->map[buffer[0] & 0x7f]; + else + return map->prefix | buffer[0]; + } + return buffer[0]; + } + return NoSymbol; +} + +static KeySym +__XkbDefaultToUpper(KeySym sym) +{ + KeySym lower, upper; + + XConvertCase(sym, &lower, &upper); + return upper; +} + +#ifdef XKB_EXTEND_LOOKUP_STRING +static int +Strcmp(char *str1, char *str2) +{ + char str[256]; + char c, *s; + + /* + * unchecked strings from the environment can end up here, so check + * the length before copying. + */ + if (strlen(str1) >= sizeof(str)) /* almost certain it's a mismatch */ + return 1; + + for (s = str; (c = *str1++);) { + if (isupper(c)) + c = tolower(c); + *s++ = c; + } + *s = '\0'; + return (strcmp(str, str2)); +} +#endif + +int +_XkbGetConverters(const char *encoding_name, XkbConverters * cvt_rtrn) +{ + if (!cvt_rtrn) + return 0; + + cvt_rtrn->KSToMB = _XkbKSToKnownSet; + cvt_rtrn->KSToMBPriv = _XimGetLocaleCode(encoding_name); + cvt_rtrn->MBToKS = _XkbKnownSetToKS; + cvt_rtrn->MBToKSPriv = NULL; + cvt_rtrn->KSToUpper = __XkbDefaultToUpper; + return 1; +} + +/***====================================================================***/ + +/* + * The function _XkbGetCharset seems to be missnamed as what it seems to + * be used for is to determine the encoding-name for the locale. ??? + */ + +#ifdef XKB_EXTEND_LOOKUP_STRING + +/* + * XKB_EXTEND_LOOKUP_STRING is not used by the SI. It is used by various + * X Consortium/X Project Team members, so we leave it in the source as + * an simplify integration by these companies. + */ + +#define CHARSET_FILE "/usr/lib/X11/input/charsets" +static char *_XkbKnownLanguages = + "c=ascii:da,de,en,es,fr,is,it,nl,no,pt,sv=iso8859-1:hu,pl,cs=iso8859-2:" + "eo=iso8859-3:sp=iso8859-5:ar,ara=iso8859-6:el=iso8859-7:he=iso8859-8:" + "tr=iso8859-9:lt,lv=iso8859-13:et,fi=iso8859-15:ru=koi8-r:uk=koi8-u:" + "th,th_TH,th_TH.iso8859-11=iso8859-11:th_TH.TIS620=tis620:hy=armscii-8:" + "vi=tcvn-5712:ka=georgian-academy:be,bg=microsoft-cp1251"; + +char * +_XkbGetCharset(void) +{ + /* + * PAGE USAGE TUNING: explicitly initialize to move these to data + * instead of bss + */ + static char buf[100] = { 0 }; + char lang[256]; + char *start, *tmp, *end, *next, *set; + char *country, *charset; + char *locale; + + tmp = getenv("_XKB_CHARSET"); + if (tmp) + return tmp; + locale = setlocale(LC_CTYPE, NULL); + + if (locale == NULL) + return NULL; + + if (strlen(locale) >= sizeof(lang)) + return NULL; + + for (tmp = lang; *tmp = *locale++; tmp++) { + if (isupper(*tmp)) + *tmp = tolower(*tmp); + } + country = strchr(lang, '_'); + if (country) { + *country++ = '\0'; + charset = strchr(country, '.'); + if (charset) + *charset++ = '\0'; + if (charset) { + strncpy(buf, charset, 99); + buf[99] = '\0'; + return buf; + } + } + else { + charset = NULL; + } + + if ((tmp = getenv("_XKB_LOCALE_CHARSETS")) != NULL) { + start = _XkbAlloc(strlen(tmp) + 1); + strcpy(start, tmp); + tmp = start; + } + else { + struct stat sbuf; + FILE *file; + char *cf = CHARSET_FILE; + +#ifndef S_ISREG +# define S_ISREG(mode) (((mode) & S_IFMT) == S_IFREG) +#endif + + if ((stat(cf, &sbuf) == 0) && S_ISREG(sbuf.st_mode) && + (file = fopen(cf, "r"))) { + tmp = _XkbAlloc(sbuf.st_size + 1); + if (tmp != NULL) { + sbuf.st_size = (long) fread(tmp, 1, sbuf.st_size, file); + tmp[sbuf.st_size] = '\0'; + } + fclose(file); + } + } + + if (tmp == NULL) { + tmp = _XkbAlloc(strlen(_XkbKnownLanguages) + 1); + if (!tmp) + return NULL; + strcpy(tmp, _XkbKnownLanguages); + } + start = tmp; + do { + if ((set = strchr(tmp, '=')) == NULL) + break; + *set++ = '\0'; + if ((next = strchr(set, ':')) != NULL) + *next++ = '\0'; + while (tmp && *tmp) { + if ((end = strchr(tmp, ',')) != NULL) + *end++ = '\0'; + if (Strcmp(tmp, lang) == 0) { + strncpy(buf, set, 100); + buf[99] = '\0'; + Xfree(start); + return buf; + } + tmp = end; + } + tmp = next; + } while (tmp && *tmp); + Xfree(start); + return NULL; +} +#else +char * +_XkbGetCharset(void) +{ + char *tmp; + XLCd lcd; + + tmp = getenv("_XKB_CHARSET"); + if (tmp) + return tmp; + + lcd = _XlcCurrentLC(); + if (lcd) + return XLC_PUBLIC(lcd, encoding_name); + + return NULL; +} +#endif diff --git a/nx-X11/lib/src/xkb/XKBExtDev.c b/nx-X11/lib/src/xkb/XKBExtDev.c new file mode 100644 index 000000000..cb40ecd04 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBExtDev.c @@ -0,0 +1,843 @@ +/************************************************************ +Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#define NEED_MAP_READERS +#include "Xlibint.h" +#include +#include "XKBlibint.h" +#include + +/***====================================================================***/ + +void +XkbNoteDeviceChanges(XkbDeviceChangesPtr old, + XkbExtensionDeviceNotifyEvent *new, + unsigned int wanted) +{ + if ((!old) || (!new) || (!wanted) || ((new->reason & wanted) == 0)) + return; + if ((wanted & new->reason) & XkbXI_ButtonActionsMask) { + if (old->changed & XkbXI_ButtonActionsMask) { + int first, last, newLast; + + if (new->first_btn < old->first_btn) + first = new->first_btn; + else + first = old->first_btn; + last = old->first_btn + old->num_btns - 1; + newLast = new->first_btn + new->num_btns - 1; + if (newLast > last) + last = newLast; + old->first_btn = first; + old->num_btns = (last - first) + 1; + } + else { + old->changed |= XkbXI_ButtonActionsMask; + old->first_btn = new->first_btn; + old->num_btns = new->num_btns; + } + } + if ((wanted & new->reason) & XkbXI_IndicatorsMask) { + XkbDeviceLedChangesPtr this; + + if (old->changed & XkbXI_IndicatorsMask) { + XkbDeviceLedChangesPtr found = NULL; + + for (this = &old->leds; this && (!found); this = this->next) { + if ((this->led_class == new->led_class) && + (this->led_id == new->led_id)) { + found = this; + } + } + if (!found) { + found = _XkbTypedCalloc(1, XkbDeviceLedChangesRec); + if (!found) + return; + found->next = old->leds.next; + found->led_class = new->led_class; + found->led_id = new->led_id; + old->leds.next = found; + } + if ((wanted & new->reason) & XkbXI_IndicatorNamesMask) + found->defined = new->leds_defined; + } + else { + old->changed |= ((wanted & new->reason) & XkbXI_IndicatorsMask); + old->leds.led_class = new->led_class; + old->leds.led_id = new->led_id; + old->leds.defined = new->leds_defined; + if (old->leds.next) { + XkbDeviceLedChangesPtr next; + + for (this = old->leds.next; this; this = next) { + next = this->next; + _XkbFree(this); + } + old->leds.next = NULL; + } + } + } + return; +} + +/***====================================================================***/ + +static Status +_XkbReadDeviceLedInfo(XkbReadBufferPtr buf, + unsigned present, + XkbDeviceInfoPtr devi) +{ + register unsigned i, bit; + XkbDeviceLedInfoPtr devli; + xkbDeviceLedsWireDesc *wireli; + + wireli = _XkbGetTypedRdBufPtr(buf, 1, xkbDeviceLedsWireDesc); + if (!wireli) + return BadLength; + devli = XkbAddDeviceLedInfo(devi, wireli->ledClass, wireli->ledID); + if (!devli) + return BadAlloc; + devli->phys_indicators = wireli->physIndicators; + + if (present & XkbXI_IndicatorStateMask) + devli->state = wireli->state; + + if (present & XkbXI_IndicatorNamesMask) { + devli->names_present = wireli->namesPresent; + if (devli->names_present) { + for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { + if (wireli->namesPresent & bit) { + if (!_XkbCopyFromReadBuffer(buf, + (char *) &devli->names[i], 4)) + return BadLength; + } + } + } + } + + if (present & XkbXI_IndicatorMapsMask) { + devli->maps_present = wireli->mapsPresent; + if (devli->maps_present) { + XkbIndicatorMapPtr im; + xkbIndicatorMapWireDesc *wireim; + + for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { + if (wireli->mapsPresent & bit) { + wireim = + _XkbGetTypedRdBufPtr(buf, 1, xkbIndicatorMapWireDesc); + if (!wireim) + return BadAlloc; + im = &devli->maps[i]; + im->flags = wireim->flags; + im->which_groups = wireim->whichGroups; + im->groups = wireim->groups; + im->which_mods = wireim->whichMods; + im->mods.mask = wireim->mods; + im->mods.real_mods = wireim->realMods; + im->mods.vmods = wireim->virtualMods; + im->ctrls = wireim->ctrls; + } + } + } + } + return Success; +} + +static Status +_XkbReadGetDeviceInfoReply(Display *dpy, + xkbGetDeviceInfoReply *rep, + XkbDeviceInfoPtr devi) +{ + XkbReadBufferRec buf; + XkbAction *act; + int tmp; + + if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) + return BadAlloc; + + if ((rep->totalBtns > 0) && (rep->totalBtns != devi->num_btns)) { + tmp = XkbResizeDeviceButtonActions(devi, rep->totalBtns); + if (tmp != Success) + return tmp; + } + if (rep->nBtnsWanted > 0) { + if (((unsigned short) rep->firstBtnWanted + rep->nBtnsWanted) + >= devi->num_btns) + goto BAILOUT; + act = &devi->btn_acts[rep->firstBtnWanted]; + bzero((char *) act, (rep->nBtnsWanted * sizeof(XkbAction))); + } + + _XkbFree(devi->name); + if (!_XkbGetReadBufferCountedString(&buf, &devi->name)) + goto BAILOUT; + if (rep->nBtnsRtrn > 0) { + int size; + + if (((unsigned short) rep->firstBtnRtrn + rep->nBtnsRtrn) + >= devi->num_btns) + goto BAILOUT; + act = &devi->btn_acts[rep->firstBtnRtrn]; + size = rep->nBtnsRtrn * SIZEOF(xkbActionWireDesc); + if (!_XkbCopyFromReadBuffer(&buf, (char *) act, size)) + goto BAILOUT; + } + if (rep->nDeviceLedFBs > 0) { + register int i; + + for (i = 0; i < rep->nDeviceLedFBs; i++) { + if ((tmp = _XkbReadDeviceLedInfo(&buf, rep->present, devi)) + != Success) + return tmp; + } + } + tmp = _XkbFreeReadBuffer(&buf); + if (tmp) + fprintf(stderr, "GetDeviceInfo! Bad length (%d extra bytes)\n", tmp); + if (tmp || buf.error) + return BadLength; + return Success; + BAILOUT: + _XkbFreeReadBuffer(&buf); + return BadLength; +} + +XkbDeviceInfoPtr +XkbGetDeviceInfo(Display *dpy, + unsigned which, + unsigned deviceSpec, + unsigned class, + unsigned id) +{ + register xkbGetDeviceInfoReq *req; + xkbGetDeviceInfoReply rep; + Status status; + XkbDeviceInfoPtr devi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return NULL; + LockDisplay(dpy); + GetReq(kbGetDeviceInfo, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetDeviceInfo; + req->deviceSpec = deviceSpec; + req->wanted = which; + req->allBtns = ((which & XkbXI_ButtonActionsMask) != 0); + req->firstBtn = req->nBtns = 0; + req->ledClass = class; + req->ledID = id; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return NULL; + } + devi = XkbAllocDeviceInfo(rep.deviceID, rep.totalBtns, rep.nDeviceLedFBs); + if (devi) { + devi->supported = rep.supported; + devi->unsupported = rep.unsupported; + devi->type = rep.devType; + devi->has_own_state = rep.hasOwnState; + devi->dflt_kbd_fb = rep.dfltKbdFB; + devi->dflt_led_fb = rep.dfltLedFB; + status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); + if (status != Success) { + XkbFreeDeviceInfo(devi, XkbXI_AllDeviceFeaturesMask, True); + devi = NULL; + } + } + UnlockDisplay(dpy); + SyncHandle(); + return devi; +} + +Status +XkbGetDeviceInfoChanges(Display *dpy, + XkbDeviceInfoPtr devi, + XkbDeviceChangesPtr changes) +{ + register xkbGetDeviceInfoReq *req; + xkbGetDeviceInfoReply rep; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadMatch; + if ((changes->changed & XkbXI_AllDeviceFeaturesMask) == 0) + return Success; + changes->changed &= ~XkbXI_AllDeviceFeaturesMask; + status = Success; + LockDisplay(dpy); + while ((changes->changed) && (status == Success)) { + GetReq(kbGetDeviceInfo, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetDeviceInfo; + req->deviceSpec = devi->device_spec; + req->wanted = changes->changed; + req->allBtns = False; + if (changes->changed & XkbXI_ButtonActionsMask) { + req->firstBtn = changes->first_btn; + req->nBtns = changes->num_btns; + changes->changed &= ~XkbXI_ButtonActionsMask; + } + else + req->firstBtn = req->nBtns = 0; + if (changes->changed & XkbXI_IndicatorsMask) { + req->ledClass = changes->leds.led_class; + req->ledID = changes->leds.led_id; + if (changes->leds.next == NULL) + changes->changed &= ~XkbXI_IndicatorsMask; + else { + XkbDeviceLedChangesPtr next; + + next = changes->leds.next; + changes->leds = *next; + _XkbFree(next); + } + } + else { + req->ledClass = XkbDfltXIClass; + req->ledID = XkbDfltXIId; + } + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + status = BadLength; + break; + } + devi->supported |= rep.supported; + devi->unsupported |= rep.unsupported; + devi->type = rep.devType; + status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); + } + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetDeviceButtonActions(Display *dpy, + XkbDeviceInfoPtr devi, + Bool all, + unsigned int first, + unsigned int num) +{ + register xkbGetDeviceInfoReq *req; + xkbGetDeviceInfoReply rep; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadMatch; + if (!devi) + return BadValue; + LockDisplay(dpy); + GetReq(kbGetDeviceInfo, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetDeviceInfo; + req->deviceSpec = devi->device_spec; + req->wanted = XkbXI_ButtonActionsMask; + req->allBtns = all; + req->firstBtn = first; + req->nBtns = num; + req->ledClass = XkbDfltXIClass; + req->ledID = XkbDfltXIId; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadLength; + } + devi->type = rep.devType; + devi->supported = rep.supported; + devi->unsupported = rep.unsupported; + status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetDeviceLedInfo(Display *dpy, + XkbDeviceInfoPtr devi, + unsigned int ledClass, + unsigned int ledId, + unsigned int which) +{ + register xkbGetDeviceInfoReq *req; + xkbGetDeviceInfoReply rep; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadMatch; + if (((which & XkbXI_IndicatorsMask) == 0) || + (which & (~XkbXI_IndicatorsMask))) + return BadMatch; + if (!devi) + return BadValue; + LockDisplay(dpy); + GetReq(kbGetDeviceInfo, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetDeviceInfo; + req->deviceSpec = devi->device_spec; + req->wanted = which; + req->allBtns = False; + req->firstBtn = req->nBtns = 0; + req->ledClass = ledClass; + req->ledID = ledId; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadLength; + } + devi->type = rep.devType; + devi->supported = rep.supported; + devi->unsupported = rep.unsupported; + status = _XkbReadGetDeviceInfoReply(dpy, &rep, devi); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +/***====================================================================***/ + +typedef struct _LedInfoStuff { + Bool used; + XkbDeviceLedInfoPtr devli; +} LedInfoStuff; + +typedef struct _SetLedStuff { + unsigned wanted; + int num_info; + int dflt_class; + LedInfoStuff *dflt_kbd_fb; + LedInfoStuff *dflt_led_fb; + LedInfoStuff *info; +} SetLedStuff; + +static void +_InitLedStuff(SetLedStuff *stuff, unsigned wanted, XkbDeviceInfoPtr devi) +{ + int i; + register XkbDeviceLedInfoPtr devli; + + bzero(stuff, sizeof(SetLedStuff)); + stuff->wanted = wanted; + stuff->dflt_class = XkbXINone; + if ((devi->num_leds < 1) || ((wanted & XkbXI_IndicatorsMask) == 0)) + return; + stuff->info = _XkbTypedCalloc(devi->num_leds, LedInfoStuff); + if (!stuff->info) + return; + stuff->num_info = devi->num_leds; + for (devli = &devi->leds[0], i = 0; i < devi->num_leds; i++, devli++) { + stuff->info[i].devli = devli; + if (devli->led_class == KbdFeedbackClass) { + stuff->dflt_class = KbdFeedbackClass; + if (stuff->dflt_kbd_fb == NULL) + stuff->dflt_kbd_fb = &stuff->info[i]; + } + else if (devli->led_class == LedFeedbackClass) { + if (stuff->dflt_class == XkbXINone) + stuff->dflt_class = LedFeedbackClass; + if (stuff->dflt_led_fb == NULL) + stuff->dflt_led_fb = &stuff->info[i]; + } + } + return; +} + +static void +_FreeLedStuff(SetLedStuff * stuff) +{ + if (stuff->num_info > 0) + _XkbFree(stuff->info); + bzero(stuff, sizeof(SetLedStuff)); + return; +} + +static int +_XkbSizeLedInfo(unsigned changed, XkbDeviceLedInfoPtr devli) +{ + register int i, size; + register unsigned bit, namesNeeded, mapsNeeded; + + size = SIZEOF(xkbDeviceLedsWireDesc); + namesNeeded = mapsNeeded = 0; + if (changed & XkbXI_IndicatorNamesMask) + namesNeeded = devli->names_present; + if (changed & XkbXI_IndicatorMapsMask) + mapsNeeded = devli->maps_present; + if ((namesNeeded) || (mapsNeeded)) { + for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { + if (namesNeeded & bit) + size += 4; /* atoms are 4 bytes on the wire */ + if (mapsNeeded & bit) + size += SIZEOF(xkbIndicatorMapWireDesc); + } + } + return size; +} + +static Bool +_SizeMatches(SetLedStuff *stuff, + XkbDeviceLedChangesPtr changes, + int *sz_rtrn, + int *nleds_rtrn) +{ + int i, nMatch, class, id; + LedInfoStuff *linfo; + Bool match; + + nMatch = 0; + class = changes->led_class; + id = changes->led_id; + if (class == XkbDfltXIClass) + class = stuff->dflt_class; + for (i = 0, linfo = &stuff->info[0]; i < stuff->num_info; i++, linfo++) { + XkbDeviceLedInfoPtr devli; + LedInfoStuff *dflt; + + devli = linfo->devli; + match = ((class == devli->led_class) || (class == XkbAllXIClasses)); + if (devli->led_class == KbdFeedbackClass) + dflt = stuff->dflt_kbd_fb; + else + dflt = stuff->dflt_led_fb; + match = (match && (id == devli->led_id)) || + (id == XkbAllXIIds) || + ((id == XkbDfltXIId) && (linfo == dflt)); + if (match) { + if (!linfo->used) { + *sz_rtrn += _XkbSizeLedInfo(stuff->wanted, devli); + *nleds_rtrn += 1; + linfo->used = True; + if ((class != XkbAllXIClasses) && (id != XkbAllXIIds)) + return True; + } + nMatch++; + linfo->used = True; + } + } + return (nMatch > 0); +} + +/***====================================================================***/ + + +static Status +_XkbSetDeviceInfoSize(XkbDeviceInfoPtr devi, + XkbDeviceChangesPtr changes, + SetLedStuff *stuff, + int *sz_rtrn, + int *num_leds_rtrn) +{ + *sz_rtrn = 0; + if ((changes->changed & XkbXI_ButtonActionsMask) && (changes->num_btns > 0)) { + if (!XkbXI_LegalDevBtn + (devi, (changes->first_btn + changes->num_btns - 1))) + return BadMatch; + *sz_rtrn += changes->num_btns * SIZEOF(xkbActionWireDesc); + } + else { + changes->changed &= ~XkbXI_ButtonActionsMask; + changes->first_btn = changes->num_btns = 0; + } + if ((changes->changed & XkbXI_IndicatorsMask) && + XkbLegalXILedClass(changes->leds.led_class)) { + XkbDeviceLedChangesPtr leds; + + for (leds = &changes->leds; leds != NULL; leds = leds->next) { + if (!_SizeMatches(stuff, leds, sz_rtrn, num_leds_rtrn)) + return BadMatch; + } + } + else { + changes->changed &= ~XkbXI_IndicatorsMask; + *num_leds_rtrn = 0; + } + return Success; +} + +static char * +_XkbWriteLedInfo(char *wire, unsigned changed, XkbDeviceLedInfoPtr devli) +{ + register int i; + register unsigned bit, namesNeeded, mapsNeeded; + xkbDeviceLedsWireDesc *lwire; + + namesNeeded = mapsNeeded = 0; + if (changed & XkbXI_IndicatorNamesMask) + namesNeeded = devli->names_present; + if (changed & XkbXI_IndicatorMapsMask) + mapsNeeded = devli->maps_present; + + lwire = (xkbDeviceLedsWireDesc *) wire; + lwire->ledClass = devli->led_class; + lwire->ledID = devli->led_id; + lwire->namesPresent = namesNeeded; + lwire->mapsPresent = mapsNeeded; + lwire->physIndicators = devli->phys_indicators; + lwire->state = devli->state; + wire = (char *) &lwire[1]; + if (namesNeeded) { + CARD32 *awire = (CARD32 *) wire; + + for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { + if (namesNeeded & bit) { + *awire = (CARD32) devli->names[i]; + awire++; + } + } + wire = (char *) awire; + } + if (mapsNeeded) { + xkbIndicatorMapWireDesc *mwire = (xkbIndicatorMapWireDesc *) wire; + + for (i = 0, bit = 1; i < XkbNumIndicators; i++, bit <<= 1) { + if (mapsNeeded & bit) { + XkbIndicatorMapPtr map = &devli->maps[i]; + + mwire->flags = map->flags; + mwire->whichGroups = map->which_groups; + mwire->groups = map->groups; + mwire->whichMods = map->which_mods; + mwire->mods = map->mods.mask; + mwire->realMods = map->mods.real_mods; + mwire->virtualMods = map->mods.vmods; + mwire->ctrls = map->ctrls; + mwire++; + } + } + wire = (char *) mwire; + } + return wire; +} + + +static int +_XkbWriteSetDeviceInfo(char *wire, + XkbDeviceChangesPtr changes, + SetLedStuff *stuff, + XkbDeviceInfoPtr devi) +{ + char *start = wire; + + if (changes->changed & XkbXI_ButtonActionsMask) { + int size = changes->num_btns * SIZEOF(xkbActionWireDesc); + + memcpy(wire, (char *) &devi->btn_acts[changes->first_btn], size); + wire += size; + } + if (changes->changed & XkbXI_IndicatorsMask) { + register int i; + register LedInfoStuff *linfo; + + for (i = 0, linfo = &stuff->info[0]; i < stuff->num_info; i++, linfo++) { + if (linfo->used) { + register char *new_wire; + + new_wire = _XkbWriteLedInfo(wire, stuff->wanted, linfo->devli); + if (!new_wire) + return wire - start; + wire = new_wire; + } + } + } + return wire - start; +} + +Bool +XkbSetDeviceInfo(Display *dpy, unsigned which, XkbDeviceInfoPtr devi) +{ + register xkbSetDeviceInfoReq *req; + Status ok = 0; + int size, nLeds; + XkbInfoPtr xkbi; + XkbDeviceChangesRec changes; + SetLedStuff lstuff; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!devi) || (which & (~XkbXI_AllDeviceFeaturesMask)) || + ((which & XkbXI_ButtonActionsMask) && (!XkbXI_DevHasBtnActs(devi))) || + ((which & XkbXI_IndicatorsMask) && (!XkbXI_DevHasLeds(devi)))) + return False; + + bzero((char *) &changes, sizeof(XkbDeviceChangesRec)); + changes.changed = which; + changes.first_btn = 0; + changes.num_btns = devi->num_btns; + changes.leds.led_class = XkbAllXIClasses; + changes.leds.led_id = XkbAllXIIds; + changes.leds.defined = 0; + size = nLeds = 0; + _InitLedStuff(&lstuff, changes.changed, devi); + if (_XkbSetDeviceInfoSize(devi, &changes, &lstuff, &size, &nLeds) != + Success) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetDeviceInfo, req); + req->length += size / 4; + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetDeviceInfo; + req->deviceSpec = devi->device_spec; + req->firstBtn = changes.first_btn; + req->nBtns = changes.num_btns; + req->change = changes.changed; + req->nDeviceLedFBs = nLeds; + if (size > 0) { + char *wire; + + BufAlloc(char *, wire, size); + ok = (wire != NULL) && + (_XkbWriteSetDeviceInfo(wire, &changes, &lstuff, devi) == size); + } + UnlockDisplay(dpy); + SyncHandle(); + _FreeLedStuff(&lstuff); + /* 12/11/95 (ef) -- XXX!! should clear changes here */ + return ok; +} + +Bool +XkbChangeDeviceInfo(Display *dpy, + XkbDeviceInfoPtr devi, + XkbDeviceChangesPtr changes) +{ + register xkbSetDeviceInfoReq *req; + Status ok = 0; + int size, nLeds; + XkbInfoPtr xkbi; + SetLedStuff lstuff; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!devi) || (changes->changed & (~XkbXI_AllDeviceFeaturesMask)) || + ((changes->changed & XkbXI_ButtonActionsMask) && + (!XkbXI_DevHasBtnActs(devi))) || + ((changes->changed & XkbXI_IndicatorsMask) && + (!XkbXI_DevHasLeds(devi)))) + return False; + + size = nLeds = 0; + _InitLedStuff(&lstuff, changes->changed, devi); + if (_XkbSetDeviceInfoSize(devi, changes, &lstuff, &size, &nLeds) != Success) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetDeviceInfo, req); + req->length += size / 4; + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetDeviceInfo; + req->deviceSpec = devi->device_spec; + req->firstBtn = changes->first_btn; + req->nBtns = changes->num_btns; + req->change = changes->changed; + req->nDeviceLedFBs = nLeds; + if (size > 0) { + char *wire; + + BufAlloc(char *, wire, size); + ok = (wire != NULL) && + (_XkbWriteSetDeviceInfo(wire, changes, &lstuff, devi) == size); + } + UnlockDisplay(dpy); + SyncHandle(); + _FreeLedStuff(&lstuff); + /* 12/11/95 (ef) -- XXX!! should clear changes here */ + return ok; +} + +Bool +XkbSetDeviceLedInfo(Display *dpy, + XkbDeviceInfoPtr devi, + unsigned ledClass, + unsigned ledID, + unsigned which) +{ + return False; +} + +Bool +XkbSetDeviceButtonActions(Display *dpy, + XkbDeviceInfoPtr devi, + unsigned int first, + unsigned int nBtns) +{ + register xkbSetDeviceInfoReq *req; + Status ok = 0; + int size, nLeds; + XkbInfoPtr xkbi; + XkbDeviceChangesRec changes; + SetLedStuff lstuff; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!devi) || (!XkbXI_DevHasBtnActs(devi)) || + (first + nBtns > devi->num_btns)) + return False; + if (nBtns == 0) + return True; + + bzero((char *) &changes, sizeof(XkbDeviceChangesRec)); + changes.changed = XkbXI_ButtonActionsMask; + changes.first_btn = first; + changes.num_btns = nBtns; + changes.leds.led_class = XkbXINone; + changes.leds.led_id = XkbXINone; + changes.leds.defined = 0; + size = nLeds = 0; + if (_XkbSetDeviceInfoSize(devi, &changes, NULL, &size, &nLeds) != Success) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetDeviceInfo, req); + req->length += size / 4; + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetDeviceInfo; + req->deviceSpec = devi->device_spec; + req->firstBtn = changes.first_btn; + req->nBtns = changes.num_btns; + req->change = changes.changed; + req->nDeviceLedFBs = nLeds; + if (size > 0) { + char *wire; + + BufAlloc(char *, wire, size); + ok = (wire != NULL) && + (_XkbWriteSetDeviceInfo(wire, &changes, &lstuff, devi) == size); + } + UnlockDisplay(dpy); + SyncHandle(); + return ok; +} diff --git a/nx-X11/lib/src/xkb/XKBGAlloc.c b/nx-X11/lib/src/xkb/XKBGAlloc.c new file mode 100644 index 000000000..ab05f8d88 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBGAlloc.c @@ -0,0 +1,994 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include "Xlibint.h" +#include "XKBlibint.h" +#include +#include + +/***====================================================================***/ + +static void +_XkbFreeGeomLeafElems(Bool freeAll, + int first, + int count, + unsigned short *num_inout, + unsigned short *sz_inout, + char **elems, + unsigned int elem_sz) +{ + if ((freeAll) || (*elems == NULL)) { + *num_inout = *sz_inout = 0; + if (*elems != NULL) { + _XkbFree(*elems); + *elems = NULL; + } + return; + } + + if ((first >= (*num_inout)) || (first < 0) || (count < 1)) + return; + + if (first + count >= (*num_inout)) { + /* truncating the array is easy */ + (*num_inout) = first; + } + else { + char *ptr; + int extra; + + ptr = *elems; + extra = ((*num_inout) - (first + count)) * elem_sz; + if (extra > 0) + memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], + extra); + (*num_inout) -= count; + } + return; +} + +typedef void (*ContentsClearFunc) ( + char * /* priv */ +); + +static void +_XkbFreeGeomNonLeafElems(Bool freeAll, + int first, + int count, + unsigned short *num_inout, + unsigned short *sz_inout, + char **elems, + unsigned int elem_sz, + ContentsClearFunc freeFunc) +{ + register int i; + register char *ptr; + + if (freeAll) { + first = 0; + count = (*num_inout); + } + else if ((first >= (*num_inout)) || (first < 0) || (count < 1)) + return; + else if (first + count > (*num_inout)) + count = (*num_inout) - first; + if (*elems == NULL) + return; + + if (freeFunc) { + ptr = *elems; + ptr += first * elem_sz; + for (i = 0; i < count; i++) { + (*freeFunc) (ptr); + ptr += elem_sz; + } + } + if (freeAll) { + (*num_inout) = (*sz_inout) = 0; + if (*elems) { + _XkbFree(*elems); + *elems = NULL; + } + } + else if (first + count >= (*num_inout)) + *num_inout = first; + else { + i = ((*num_inout) - (first + count)) * elem_sz; + ptr = *elems; + memmove(&ptr[first * elem_sz], &ptr[(first + count) * elem_sz], i); + (*num_inout) -= count; + } + return; +} + +/***====================================================================***/ + +static void +_XkbClearProperty(char *prop_in) +{ + XkbPropertyPtr prop = (XkbPropertyPtr) prop_in; + + if (prop->name) { + _XkbFree(prop->name); + prop->name = NULL; + } + if (prop->value) { + _XkbFree(prop->value); + prop->value = NULL; + } + return; +} + +void +XkbFreeGeomProperties(XkbGeometryPtr geom, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + &geom->num_properties, &geom->sz_properties, + (char **) &geom->properties, + sizeof(XkbPropertyRec), _XkbClearProperty); + return; +} + +/***====================================================================***/ + +void +XkbFreeGeomKeyAliases(XkbGeometryPtr geom, int first, int count, Bool freeAll) +{ + _XkbFreeGeomLeafElems(freeAll, first, count, + &geom->num_key_aliases, &geom->sz_key_aliases, + (char **) &geom->key_aliases, + sizeof(XkbKeyAliasRec)); + return; +} + +/***====================================================================***/ + +static void +_XkbClearColor(char *color_in) +{ + XkbColorPtr color = (XkbColorPtr) color_in; + + _XkbFree(color->spec); + return; +} + +void +XkbFreeGeomColors(XkbGeometryPtr geom, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + &geom->num_colors, &geom->sz_colors, + (char **) &geom->colors, + sizeof(XkbColorRec), _XkbClearColor); + return; +} + +/***====================================================================***/ + +void +XkbFreeGeomPoints(XkbOutlinePtr outline, int first, int count, Bool freeAll) +{ + _XkbFreeGeomLeafElems(freeAll, first, count, + &outline->num_points, &outline->sz_points, + (char **) &outline->points, + sizeof(XkbPointRec)); + return; +} + +/***====================================================================***/ + +static void +_XkbClearOutline(char *outline_in) +{ + XkbOutlinePtr outline = (XkbOutlinePtr) outline_in; + + if (outline->points != NULL) + XkbFreeGeomPoints(outline, 0, outline->num_points, True); + return; +} + +void +XkbFreeGeomOutlines(XkbShapePtr shape, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + &shape->num_outlines, &shape->sz_outlines, + (char **) &shape->outlines, + sizeof(XkbOutlineRec), _XkbClearOutline); + + return; +} + +/***====================================================================***/ + +static void +_XkbClearShape(char *shape_in) +{ + XkbShapePtr shape = (XkbShapePtr) shape_in; + + if (shape->outlines) + XkbFreeGeomOutlines(shape, 0, shape->num_outlines, True); + return; +} + +void +XkbFreeGeomShapes(XkbGeometryPtr geom, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + &geom->num_shapes, &geom->sz_shapes, + (char **) &geom->shapes, + sizeof(XkbShapeRec), _XkbClearShape); + return; +} + +/***====================================================================***/ + +void +XkbFreeGeomOverlayKeys(XkbOverlayRowPtr row, int first, int count, Bool freeAll) +{ + _XkbFreeGeomLeafElems(freeAll, first, count, + &row->num_keys, &row->sz_keys, + (char **) &row->keys, + sizeof(XkbOverlayKeyRec)); + return; +} + +/***====================================================================***/ + +static void +_XkbClearOverlayRow(char *row_in) +{ + XkbOverlayRowPtr row = (XkbOverlayRowPtr) row_in; + + if (row->keys != NULL) + XkbFreeGeomOverlayKeys(row, 0, row->num_keys, True); + return; +} + +void +XkbFreeGeomOverlayRows(XkbOverlayPtr overlay, int first, int count, + Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + &overlay->num_rows, &overlay->sz_rows, + (char **) &overlay->rows, + sizeof(XkbOverlayRowRec), _XkbClearOverlayRow); + return; +} + +/***====================================================================***/ + +static void +_XkbClearOverlay(char *overlay_in) +{ + XkbOverlayPtr overlay = (XkbOverlayPtr) overlay_in; + + if (overlay->rows != NULL) + XkbFreeGeomOverlayRows(overlay, 0, overlay->num_rows, True); + return; +} + +void +XkbFreeGeomOverlays(XkbSectionPtr section, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + §ion->num_overlays, §ion->sz_overlays, + (char **) §ion->overlays, + sizeof(XkbOverlayRec), _XkbClearOverlay); + return; +} + +/***====================================================================***/ + +void +XkbFreeGeomKeys(XkbRowPtr row, int first, int count, Bool freeAll) +{ + _XkbFreeGeomLeafElems(freeAll, first, count, + &row->num_keys, &row->sz_keys, + (char **) &row->keys, + sizeof(XkbKeyRec)); + return; +} + +/***====================================================================***/ + +static void +_XkbClearRow(char *row_in) +{ + XkbRowPtr row = (XkbRowPtr) row_in; + + if (row->keys != NULL) + XkbFreeGeomKeys(row, 0, row->num_keys, True); + return; +} + +void +XkbFreeGeomRows(XkbSectionPtr section, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + §ion->num_rows, §ion->sz_rows, + (char **) §ion->rows, + sizeof(XkbRowRec), _XkbClearRow); +} + +/***====================================================================***/ + +static void +_XkbClearSection(char *section_in) +{ + XkbSectionPtr section = (XkbSectionPtr) section_in; + + if (section->rows != NULL) + XkbFreeGeomRows(section, 0, section->num_rows, True); + if (section->doodads != NULL) { + XkbFreeGeomDoodads(section->doodads, section->num_doodads, True); + section->doodads = NULL; + } + return; +} + +void +XkbFreeGeomSections(XkbGeometryPtr geom, int first, int count, Bool freeAll) +{ + _XkbFreeGeomNonLeafElems(freeAll, first, count, + &geom->num_sections, &geom->sz_sections, + (char **) &geom->sections, + sizeof(XkbSectionRec), _XkbClearSection); + return; +} + +/***====================================================================***/ + +static void +_XkbClearDoodad(char *doodad_in) +{ + XkbDoodadPtr doodad = (XkbDoodadPtr) doodad_in; + + switch (doodad->any.type) { + case XkbTextDoodad: + { + if (doodad->text.text != NULL) { + _XkbFree(doodad->text.text); + doodad->text.text = NULL; + } + if (doodad->text.font != NULL) { + _XkbFree(doodad->text.font); + doodad->text.font = NULL; + } + } + break; + case XkbLogoDoodad: + { + if (doodad->logo.logo_name != NULL) { + _XkbFree(doodad->logo.logo_name); + doodad->logo.logo_name = NULL; + } + } + break; + } + return; +} + +void +XkbFreeGeomDoodads(XkbDoodadPtr doodads, int nDoodads, Bool freeAll) +{ + register int i; + register XkbDoodadPtr doodad; + + if (doodads) { + for (i = 0, doodad = doodads; i < nDoodads; i++, doodad++) { + _XkbClearDoodad((char *) doodad); + } + if (freeAll) + _XkbFree(doodads); + } + return; +} + +void +XkbFreeGeometry(XkbGeometryPtr geom, unsigned which, Bool freeMap) +{ + if (geom == NULL) + return; + if (freeMap) + which = XkbGeomAllMask; + if ((which & XkbGeomPropertiesMask) && (geom->properties != NULL)) + XkbFreeGeomProperties(geom, 0, geom->num_properties, True); + if ((which & XkbGeomColorsMask) && (geom->colors != NULL)) + XkbFreeGeomColors(geom, 0, geom->num_colors, True); + if ((which & XkbGeomShapesMask) && (geom->shapes != NULL)) + XkbFreeGeomShapes(geom, 0, geom->num_shapes, True); + if ((which & XkbGeomSectionsMask) && (geom->sections != NULL)) + XkbFreeGeomSections(geom, 0, geom->num_sections, True); + if ((which & XkbGeomDoodadsMask) && (geom->doodads != NULL)) { + XkbFreeGeomDoodads(geom->doodads, geom->num_doodads, True); + geom->doodads = NULL; + geom->num_doodads = geom->sz_doodads = 0; + } + if ((which & XkbGeomKeyAliasesMask) && (geom->key_aliases != NULL)) + XkbFreeGeomKeyAliases(geom, 0, geom->num_key_aliases, True); + if (freeMap) { + if (geom->label_font != NULL) { + _XkbFree(geom->label_font); + geom->label_font = NULL; + } + _XkbFree(geom); + } + return; +} + +/***====================================================================***/ + +static Status +_XkbGeomAlloc(XPointer *old, + unsigned short *num, + unsigned short *total, + int num_new, + size_t sz_elem) +{ + if (num_new < 1) + return Success; + if ((*old) == NULL) + *num = *total = 0; + + if ((*num) + num_new <= (*total)) + return Success; + + *total = (*num) + num_new; + if ((*old) != NULL) + (*old) = (XPointer) _XkbRealloc((*old), (*total) * sz_elem); + else + (*old) = (XPointer) _XkbCalloc((*total), sz_elem); + if ((*old) == NULL) { + *total = *num = 0; + return BadAlloc; + } + + if (*num > 0) { + char *tmp = (char *) (*old); + bzero(&tmp[sz_elem * (*num)], (num_new * sz_elem)); + } + return Success; +} + +#define _XkbAllocProps(g, n) _XkbGeomAlloc((XPointer *)&(g)->properties, \ + &(g)->num_properties, &(g)->sz_properties, \ + (n), sizeof(XkbPropertyRec)) +#define _XkbAllocColors(g, n) _XkbGeomAlloc((XPointer *)&(g)->colors, \ + &(g)->num_colors, &(g)->sz_colors, \ + (n), sizeof(XkbColorRec)) +#define _XkbAllocShapes(g, n) _XkbGeomAlloc((XPointer *)&(g)->shapes, \ + &(g)->num_shapes, &(g)->sz_shapes, \ + (n), sizeof(XkbShapeRec)) +#define _XkbAllocSections(g, n) _XkbGeomAlloc((XPointer *)&(g)->sections, \ + &(g)->num_sections, &(g)->sz_sections, \ + (n), sizeof(XkbSectionRec)) +#define _XkbAllocDoodads(g, n) _XkbGeomAlloc((XPointer *)&(g)->doodads, \ + &(g)->num_doodads, &(g)->sz_doodads, \ + (n), sizeof(XkbDoodadRec)) +#define _XkbAllocKeyAliases(g, n) _XkbGeomAlloc((XPointer *)&(g)->key_aliases, \ + &(g)->num_key_aliases, &(g)->sz_key_aliases, \ + (n), sizeof(XkbKeyAliasRec)) + +#define _XkbAllocOutlines(s, n) _XkbGeomAlloc((XPointer *)&(s)->outlines, \ + &(s)->num_outlines, &(s)->sz_outlines, \ + (n), sizeof(XkbOutlineRec)) +#define _XkbAllocRows(s, n) _XkbGeomAlloc((XPointer *)&(s)->rows, \ + &(s)->num_rows, &(s)->sz_rows, \ + (n), sizeof(XkbRowRec)) +#define _XkbAllocPoints(o, n) _XkbGeomAlloc((XPointer *)&(o)->points, \ + &(o)->num_points, &(o)->sz_points, \ + (n), sizeof(XkbPointRec)) +#define _XkbAllocKeys(r, n) _XkbGeomAlloc((XPointer *)&(r)->keys, \ + &(r)->num_keys, &(r)->sz_keys, \ + (n), sizeof(XkbKeyRec)) +#define _XkbAllocOverlays(s, n) _XkbGeomAlloc((XPointer *)&(s)->overlays, \ + &(s)->num_overlays, &(s)->sz_overlays, \ + (n), sizeof(XkbOverlayRec)) +#define _XkbAllocOverlayRows(o, n) _XkbGeomAlloc((XPointer *)&(o)->rows, \ + &(o)->num_rows, &(o)->sz_rows, \ + (n), sizeof(XkbOverlayRowRec)) +#define _XkbAllocOverlayKeys(r, n) _XkbGeomAlloc((XPointer *)&(r)->keys, \ + &(r)->num_keys, &(r)->sz_keys, \ + (n), sizeof(XkbOverlayKeyRec)) + +Status +XkbAllocGeomProps(XkbGeometryPtr geom, int nProps) +{ + return _XkbAllocProps(geom, nProps); +} + +Status +XkbAllocGeomColors(XkbGeometryPtr geom, int nColors) +{ + return _XkbAllocColors(geom, nColors); +} + +Status +XkbAllocGeomKeyAliases(XkbGeometryPtr geom, int nKeyAliases) +{ + return _XkbAllocKeyAliases(geom, nKeyAliases); +} + +Status +XkbAllocGeomShapes(XkbGeometryPtr geom, int nShapes) +{ + return _XkbAllocShapes(geom, nShapes); +} + +Status +XkbAllocGeomSections(XkbGeometryPtr geom, int nSections) +{ + return _XkbAllocSections(geom, nSections); +} + +Status +XkbAllocGeomOverlays(XkbSectionPtr section, int nOverlays) +{ + return _XkbAllocOverlays(section, nOverlays); +} + +Status +XkbAllocGeomOverlayRows(XkbOverlayPtr overlay, int nRows) +{ + return _XkbAllocOverlayRows(overlay, nRows); +} + +Status +XkbAllocGeomOverlayKeys(XkbOverlayRowPtr row, int nKeys) +{ + return _XkbAllocOverlayKeys(row, nKeys); +} + +Status +XkbAllocGeomDoodads(XkbGeometryPtr geom, int nDoodads) +{ + return _XkbAllocDoodads(geom, nDoodads); +} + +Status +XkbAllocGeomSectionDoodads(XkbSectionPtr section, int nDoodads) +{ + return _XkbAllocDoodads(section, nDoodads); +} + +Status +XkbAllocGeomOutlines(XkbShapePtr shape, int nOL) +{ + return _XkbAllocOutlines(shape, nOL); +} + +Status +XkbAllocGeomRows(XkbSectionPtr section, int nRows) +{ + return _XkbAllocRows(section, nRows); +} + +Status +XkbAllocGeomPoints(XkbOutlinePtr ol, int nPts) +{ + return _XkbAllocPoints(ol, nPts); +} + +Status +XkbAllocGeomKeys(XkbRowPtr row, int nKeys) +{ + return _XkbAllocKeys(row, nKeys); +} + +Status +XkbAllocGeometry(XkbDescPtr xkb, XkbGeometrySizesPtr sizes) +{ + XkbGeometryPtr geom; + Status rtrn; + + if (xkb->geom == NULL) { + xkb->geom = _XkbTypedCalloc(1, XkbGeometryRec); + if (!xkb->geom) + return BadAlloc; + } + geom = xkb->geom; + if ((sizes->which & XkbGeomPropertiesMask) && + ((rtrn = _XkbAllocProps(geom, sizes->num_properties)) != Success)) { + goto BAIL; + } + if ((sizes->which & XkbGeomColorsMask) && + ((rtrn = _XkbAllocColors(geom, sizes->num_colors)) != Success)) { + goto BAIL; + } + if ((sizes->which & XkbGeomShapesMask) && + ((rtrn = _XkbAllocShapes(geom, sizes->num_shapes)) != Success)) { + goto BAIL; + } + if ((sizes->which & XkbGeomSectionsMask) && + ((rtrn = _XkbAllocSections(geom, sizes->num_sections)) != Success)) { + goto BAIL; + } + if ((sizes->which & XkbGeomDoodadsMask) && + ((rtrn = _XkbAllocDoodads(geom, sizes->num_doodads)) != Success)) { + goto BAIL; + } + if ((sizes->which & XkbGeomKeyAliasesMask) && + ((rtrn = _XkbAllocKeyAliases(geom, sizes->num_key_aliases)) + != Success)) { + goto BAIL; + } + return Success; + BAIL: + XkbFreeGeometry(geom, XkbGeomAllMask, True); + xkb->geom = NULL; + return rtrn; +} + +/***====================================================================***/ + +XkbPropertyPtr +XkbAddGeomProperty(XkbGeometryPtr geom, char *name, char *value) +{ + register int i; + register XkbPropertyPtr prop; + + if ((!geom) || (!name) || (!value)) + return NULL; + for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { + if ((prop->name) && (strcmp(name, prop->name) == 0)) { + _XkbFree(prop->value); + prop->value = strdup(value); + return prop; + } + } + if ((geom->num_properties >= geom->sz_properties) && + (_XkbAllocProps(geom, 1) != Success)) { + return NULL; + } + prop = &geom->properties[geom->num_properties]; + prop->name = strdup(name); + if (!prop->name) + return NULL; + prop->value = strdup(value); + if (!prop->value) { + _XkbFree(prop->name); + prop->name = NULL; + return NULL; + } + geom->num_properties++; + return prop; +} + +XkbKeyAliasPtr +XkbAddGeomKeyAlias(XkbGeometryPtr geom, char *aliasStr, char *realStr) +{ + register int i; + register XkbKeyAliasPtr alias; + + if ((!geom) || (!aliasStr) || (!realStr) || (!aliasStr[0]) || (!realStr[0])) + return NULL; + for (i = 0, alias = geom->key_aliases; i < geom->num_key_aliases; + i++, alias++) { + if (strncmp(alias->alias, aliasStr, XkbKeyNameLength) == 0) { + bzero(alias->real, XkbKeyNameLength); + strncpy(alias->real, realStr, XkbKeyNameLength); + return alias; + } + } + if ((geom->num_key_aliases >= geom->sz_key_aliases) && + (_XkbAllocKeyAliases(geom, 1) != Success)) { + return NULL; + } + alias = &geom->key_aliases[geom->num_key_aliases]; + bzero(alias, sizeof(XkbKeyAliasRec)); + strncpy(alias->alias, aliasStr, XkbKeyNameLength); + strncpy(alias->real, realStr, XkbKeyNameLength); + geom->num_key_aliases++; + return alias; +} + +XkbColorPtr +XkbAddGeomColor(XkbGeometryPtr geom, char *spec, unsigned int pixel) +{ + register int i; + register XkbColorPtr color; + + if ((!geom) || (!spec)) + return NULL; + for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { + if ((color->spec) && (strcmp(color->spec, spec) == 0)) { + color->pixel = pixel; + return color; + } + } + if ((geom->num_colors >= geom->sz_colors) && + (_XkbAllocColors(geom, 1) != Success)) { + return NULL; + } + color = &geom->colors[geom->num_colors]; + color->pixel = pixel; + color->spec = strdup(spec); + if (!color->spec) + return NULL; + geom->num_colors++; + return color; +} + +XkbOutlinePtr +XkbAddGeomOutline(XkbShapePtr shape, int sz_points) +{ + XkbOutlinePtr outline; + + if ((!shape) || (sz_points < 0)) + return NULL; + if ((shape->num_outlines >= shape->sz_outlines) && + (_XkbAllocOutlines(shape, 1) != Success)) { + return NULL; + } + outline = &shape->outlines[shape->num_outlines]; + bzero(outline, sizeof(XkbOutlineRec)); + if ((sz_points > 0) && (_XkbAllocPoints(outline, sz_points) != Success)) + return NULL; + shape->num_outlines++; + return outline; +} + +XkbShapePtr +XkbAddGeomShape(XkbGeometryPtr geom, Atom name, int sz_outlines) +{ + XkbShapePtr shape; + register int i; + + if ((!geom) || (!name) || (sz_outlines < 0)) + return NULL; + if (geom->num_shapes > 0) { + for (shape = geom->shapes, i = 0; i < geom->num_shapes; i++, shape++) { + if (name == shape->name) + return shape; + } + } + if ((geom->num_shapes >= geom->sz_shapes) && + (_XkbAllocShapes(geom, 1) != Success)) + return NULL; + shape = &geom->shapes[geom->num_shapes]; + bzero(shape, sizeof(XkbShapeRec)); + if ((sz_outlines > 0) && (_XkbAllocOutlines(shape, sz_outlines) != Success)) + return NULL; + shape->name = name; + shape->primary = shape->approx = NULL; + geom->num_shapes++; + return shape; +} + +XkbKeyPtr +XkbAddGeomKey(XkbRowPtr row) +{ + XkbKeyPtr key; + + if (!row) + return NULL; + if ((row->num_keys >= row->sz_keys) && (_XkbAllocKeys(row, 1) != Success)) + return NULL; + key = &row->keys[row->num_keys++]; + bzero(key, sizeof(XkbKeyRec)); + return key; +} + +XkbRowPtr +XkbAddGeomRow(XkbSectionPtr section, int sz_keys) +{ + XkbRowPtr row; + + if ((!section) || (sz_keys < 0)) + return NULL; + if ((section->num_rows >= section->sz_rows) && + (_XkbAllocRows(section, 1) != Success)) + return NULL; + row = §ion->rows[section->num_rows]; + bzero(row, sizeof(XkbRowRec)); + if ((sz_keys > 0) && (_XkbAllocKeys(row, sz_keys) != Success)) + return NULL; + section->num_rows++; + return row; +} + +XkbSectionPtr +XkbAddGeomSection(XkbGeometryPtr geom, + Atom name, + int sz_rows, + int sz_doodads, + int sz_over) +{ + register int i; + XkbSectionPtr section; + + if ((!geom) || (name == None) || (sz_rows < 0)) + return NULL; + for (i = 0, section = geom->sections; i < geom->num_sections; + i++, section++) { + if (section->name != name) + continue; + if (((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) || + ((sz_doodads > 0) && + (_XkbAllocDoodads(section, sz_doodads) != Success)) || + ((sz_over > 0) && (_XkbAllocOverlays(section, sz_over) != Success))) + return NULL; + return section; + } + if ((geom->num_sections >= geom->sz_sections) && + (_XkbAllocSections(geom, 1) != Success)) + return NULL; + section = &geom->sections[geom->num_sections]; + if ((sz_rows > 0) && (_XkbAllocRows(section, sz_rows) != Success)) + return NULL; + if ((sz_doodads > 0) && (_XkbAllocDoodads(section, sz_doodads) != Success)) { + if (section->rows) { + _XkbFree(section->rows); + section->rows = NULL; + section->sz_rows = section->num_rows = 0; + } + return NULL; + } + section->name = name; + geom->num_sections++; + return section; +} + +XkbDoodadPtr +XkbAddGeomDoodad(XkbGeometryPtr geom, XkbSectionPtr section, Atom name) +{ + XkbDoodadPtr old, doodad; + register int i, nDoodads; + + if ((!geom) || (name == None)) + return NULL; + if ((section != NULL) && (section->num_doodads > 0)) { + old = section->doodads; + nDoodads = section->num_doodads; + } + else { + old = geom->doodads; + nDoodads = geom->num_doodads; + } + for (i = 0, doodad = old; i < nDoodads; i++, doodad++) { + if (doodad->any.name == name) + return doodad; + } + if (section) { + if ((section->num_doodads >= geom->sz_doodads) && + (_XkbAllocDoodads(section, 1) != Success)) { + return NULL; + } + doodad = §ion->doodads[section->num_doodads++]; + } + else { + if ((geom->num_doodads >= geom->sz_doodads) && + (_XkbAllocDoodads(geom, 1) != Success)) + return NULL; + doodad = &geom->doodads[geom->num_doodads++]; + } + bzero(doodad, sizeof(XkbDoodadRec)); + doodad->any.name = name; + return doodad; +} + +XkbOverlayKeyPtr +XkbAddGeomOverlayKey(XkbOverlayPtr overlay, + XkbOverlayRowPtr row, + char *over, + char *under) +{ + register int i; + XkbOverlayKeyPtr key; + XkbSectionPtr section; + XkbRowPtr row_under; + Bool found; + + if ((!overlay) || (!row) || (!over) || (!under)) + return NULL; + section = overlay->section_under; + if (row->row_under >= section->num_rows) + return NULL; + row_under = §ion->rows[row->row_under]; + for (i = 0, found = False; i < row_under->num_keys; i++) { + if (strncmp(under, row_under->keys[i].name.name, XkbKeyNameLength) == 0) { + found = True; + break; + } + } + if (!found) + return NULL; + if ((row->num_keys >= row->sz_keys) && + (_XkbAllocOverlayKeys(row, 1) != Success)) + return NULL; + key = &row->keys[row->num_keys]; + strncpy(key->under.name, under, XkbKeyNameLength); + strncpy(key->over.name, over, XkbKeyNameLength); + row->num_keys++; + return key; +} + +XkbOverlayRowPtr +XkbAddGeomOverlayRow(XkbOverlayPtr overlay, int row_under, int sz_keys) +{ + register int i; + XkbOverlayRowPtr row; + + if ((!overlay) || (sz_keys < 0)) + return NULL; + if (row_under >= overlay->section_under->num_rows) + return NULL; + for (i = 0; i < overlay->num_rows; i++) { + if (overlay->rows[i].row_under == row_under) { + row = &overlay->rows[i]; + if ((row->sz_keys < sz_keys) && + (_XkbAllocOverlayKeys(row, sz_keys) != Success)) { + return NULL; + } + return &overlay->rows[i]; + } + } + if ((overlay->num_rows >= overlay->sz_rows) && + (_XkbAllocOverlayRows(overlay, 1) != Success)) + return NULL; + row = &overlay->rows[overlay->num_rows]; + bzero(row, sizeof(XkbOverlayRowRec)); + if ((sz_keys > 0) && (_XkbAllocOverlayKeys(row, sz_keys) != Success)) + return NULL; + row->row_under = row_under; + overlay->num_rows++; + return row; +} + +XkbOverlayPtr +XkbAddGeomOverlay(XkbSectionPtr section, Atom name, int sz_rows) +{ + register int i; + XkbOverlayPtr overlay; + + if ((!section) || (name == None) || (sz_rows == 0)) + return NULL; + + for (i = 0, overlay = section->overlays; i < section->num_overlays; + i++, overlay++) { + if (overlay->name == name) { + if ((sz_rows > 0) && + (_XkbAllocOverlayRows(overlay, sz_rows) != Success)) + return NULL; + return overlay; + } + } + if ((section->num_overlays >= section->sz_overlays) && + (_XkbAllocOverlays(section, 1) != Success)) + return NULL; + overlay = §ion->overlays[section->num_overlays]; + if ((sz_rows > 0) && (_XkbAllocOverlayRows(overlay, sz_rows) != Success)) + return NULL; + overlay->name = name; + overlay->section_under = section; + section->num_overlays++; + return overlay; +} diff --git a/nx-X11/lib/src/xkb/XKBGeom.c b/nx-X11/lib/src/xkb/XKBGeom.c new file mode 100644 index 000000000..f57fe7cf6 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBGeom.c @@ -0,0 +1,724 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef DEBUG +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#endif + +#define NEED_MAP_READERS +#include "Xlibint.h" +#include +#include +#include "XKBlibint.h" + +#ifndef MINSHORT +#define MINSHORT -32768 +#endif +#ifndef MAXSHORT +#define MAXSHORT 32767 +#endif + +/***====================================================================***/ + +static void +_XkbCheckBounds(XkbBoundsPtr bounds, int x, int y) +{ + if (x < bounds->x1) + bounds->x1 = x; + if (x > bounds->x2) + bounds->x2 = x; + if (y < bounds->y1) + bounds->y1 = y; + if (y > bounds->y2) + bounds->y2 = y; + return; +} + +Bool +XkbComputeShapeBounds(XkbShapePtr shape) +{ + register int o, p; + XkbOutlinePtr outline; + XkbPointPtr pt; + + if ((!shape) || (shape->num_outlines < 1)) + return False; + shape->bounds.x1 = shape->bounds.y1 = MAXSHORT; + shape->bounds.x2 = shape->bounds.y2 = MINSHORT; + for (outline = shape->outlines, o = 0; o < shape->num_outlines; + o++, outline++) { + for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++) { + _XkbCheckBounds(&shape->bounds, pt->x, pt->y); + } + if (outline->num_points < 2) { + _XkbCheckBounds(&shape->bounds, 0, 0); + } + } + return True; +} + +Bool +XkbComputeShapeTop(XkbShapePtr shape, XkbBoundsPtr bounds) +{ + register int p; + XkbOutlinePtr outline; + XkbPointPtr pt; + + if ((!shape) || (shape->num_outlines < 1)) + return False; + if (shape->approx) + outline = shape->approx; + else + outline = &shape->outlines[shape->num_outlines - 1]; + if (outline->num_points < 2) { + bounds->x1 = bounds->y1 = 0; + bounds->x2 = bounds->y2 = 0; + } + else { + bounds->x1 = bounds->y1 = MAXSHORT; + bounds->x2 = bounds->y2 = MINSHORT; + } + for (pt = outline->points, p = 0; p < outline->num_points; p++, pt++) { + _XkbCheckBounds(bounds, pt->x, pt->y); + } + return True; +} + +Bool +XkbComputeRowBounds(XkbGeometryPtr geom, XkbSectionPtr section, XkbRowPtr row) +{ + register int k, pos; + XkbKeyPtr key; + XkbBoundsPtr bounds, sbounds; + + if ((!geom) || (!section) || (!row)) + return False; + bounds = &row->bounds; + bzero(bounds, sizeof(XkbBoundsRec)); + for (key = row->keys, pos = k = 0; k < row->num_keys; k++, key++) { + sbounds = &XkbKeyShape(geom, key)->bounds; + _XkbCheckBounds(bounds, pos, 0); + if (!row->vertical) { + if (key->gap != 0) { + pos += key->gap; + _XkbCheckBounds(bounds, pos, 0); + } + _XkbCheckBounds(bounds, pos + sbounds->x1, sbounds->y1); + _XkbCheckBounds(bounds, pos + sbounds->x2, sbounds->y2); + pos += sbounds->x2; + } + else { + if (key->gap != 0) { + pos += key->gap; + _XkbCheckBounds(bounds, 0, pos); + } + _XkbCheckBounds(bounds, pos + sbounds->x1, sbounds->y1); + _XkbCheckBounds(bounds, pos + sbounds->x2, sbounds->y2); + pos += sbounds->y2; + } + } + return True; +} + +Bool +XkbComputeSectionBounds(XkbGeometryPtr geom, XkbSectionPtr section) +{ + register int i; + XkbShapePtr shape; + XkbRowPtr row; + XkbDoodadPtr doodad; + XkbBoundsPtr bounds, rbounds; + + if ((!geom) || (!section)) + return False; + bounds = §ion->bounds; + bzero(bounds, sizeof(XkbBoundsRec)); + for (i = 0, row = section->rows; i < section->num_rows; i++, row++) { + if (!XkbComputeRowBounds(geom, section, row)) + return False; + rbounds = &row->bounds; + _XkbCheckBounds(bounds, row->left + rbounds->x1, + row->top + rbounds->y1); + _XkbCheckBounds(bounds, row->left + rbounds->x2, + row->top + rbounds->y2); + } + for (i = 0, doodad = section->doodads; i < section->num_doodads; + i++, doodad++) { + static XkbBoundsRec tbounds; + + switch (doodad->any.type) { + case XkbOutlineDoodad: + case XkbSolidDoodad: + shape = XkbShapeDoodadShape(geom, &doodad->shape); + rbounds = &shape->bounds; + break; + case XkbTextDoodad: + tbounds.x1 = doodad->text.left; + tbounds.y1 = doodad->text.top; + tbounds.x2 = tbounds.x1 + doodad->text.width; + tbounds.y2 = tbounds.y1 + doodad->text.height; + rbounds = &tbounds; + break; + case XkbIndicatorDoodad: + shape = XkbIndicatorDoodadShape(geom, &doodad->indicator); + rbounds = &shape->bounds; + break; + case XkbLogoDoodad: + shape = XkbLogoDoodadShape(geom, &doodad->logo); + rbounds = &shape->bounds; + break; + default: + tbounds.x1 = tbounds.x2 = doodad->any.left; + tbounds.y1 = tbounds.y2 = doodad->any.top; + rbounds = &tbounds; + break; + } + _XkbCheckBounds(bounds, rbounds->x1, rbounds->y1); + _XkbCheckBounds(bounds, rbounds->x2, rbounds->y2); + } + return True; +} + +/***====================================================================***/ + +char * +XkbFindOverlayForKey(XkbGeometryPtr geom, XkbSectionPtr wanted, char *under) +{ + int s; + XkbSectionPtr section; + + if ((geom == NULL) || (under == NULL) || (geom->num_sections < 1)) + return NULL; + + if (wanted) + section = wanted; + else + section = geom->sections; + + for (s = 0; s < geom->num_sections; s++, section++) { + XkbOverlayPtr ol; + int o; + + if (section->num_overlays < 1) + continue; + for (o = 0, ol = section->overlays; o < section->num_overlays; + o++, ol++) { + XkbOverlayRowPtr row; + int r; + + for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { + XkbOverlayKeyPtr key; + int k; + + for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { + if (strncmp(under, key->under.name, XkbKeyNameLength) == 0) + return key->over.name; + } + } + } + if (wanted != NULL) + break; + } + return NULL; +} + +/***====================================================================***/ + +static Status +_XkbReadGeomProperties(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + xkbGetGeometryReply *rep) +{ + Status rtrn; + + if (rep->nProperties < 1) + return Success; + if ((rtrn = XkbAllocGeomProps(geom, rep->nProperties)) == Success) { + register int i; + register Bool ok = True; + + for (i = 0; (i < rep->nProperties) && ok; i++) { + char *name = NULL; + char *value = NULL; + ok = _XkbGetReadBufferCountedString(buf, &name) && ok; + ok = _XkbGetReadBufferCountedString(buf, &value) && ok; + ok = ok && (XkbAddGeomProperty(geom, name, value) != NULL); + + _XkbFree(name); + _XkbFree(value); + } + if (ok) + rtrn = Success; + else + rtrn = BadLength; + } + return rtrn; +} + +static Status +_XkbReadGeomKeyAliases(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + xkbGetGeometryReply *rep) +{ + Status rtrn; + + if (rep->nKeyAliases < 1) + return Success; + if ((rtrn = XkbAllocGeomKeyAliases(geom, rep->nKeyAliases)) == Success) { + if (!_XkbCopyFromReadBuffer(buf, (char *) geom->key_aliases, + (rep->nKeyAliases * XkbKeyNameLength * 2))) + return BadLength; + geom->num_key_aliases = rep->nKeyAliases; + return Success; + } + else { /* alloc failed, just skip the aliases */ + _XkbSkipReadBufferData(buf, (rep->nKeyAliases * XkbKeyNameLength * 2)); + } + return rtrn; +} + +static Status +_XkbReadGeomColors(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + xkbGetGeometryReply *rep) +{ + Status rtrn; + + if (rep->nColors < 1) + return Success; + if ((rtrn = XkbAllocGeomColors(geom, rep->nColors)) == Success) { + register int i; + + for (i = 0; i < rep->nColors; i++) { + char *spec = NULL; + if (!_XkbGetReadBufferCountedString(buf, &spec)) + rtrn = BadLength; + else if (XkbAddGeomColor(geom, spec, geom->num_colors) == NULL) + rtrn = BadAlloc; + + _XkbFree(spec); + if (rtrn != Success) + return rtrn; + } + return Success; + } + return rtrn; +} + +static Status +_XkbReadGeomShapes(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + xkbGetGeometryReply *rep) +{ + register int i; + Status rtrn; + + if (rep->nShapes < 1) + return Success; + if ((rtrn = XkbAllocGeomShapes(geom, rep->nShapes)) != Success) + return rtrn; + for (i = 0; i < rep->nShapes; i++) { + xkbShapeWireDesc *shapeWire; + XkbShapePtr shape; + register int o; + + shapeWire = (xkbShapeWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbShapeWireDesc)); + if (!shapeWire) + return BadLength; + shape = XkbAddGeomShape(geom, shapeWire->name, shapeWire->nOutlines); + if (!shape) + return BadAlloc; + for (o = 0; o < shapeWire->nOutlines; o++) { + xkbOutlineWireDesc *olWire; + XkbOutlinePtr ol; + register int p; + XkbPointPtr pt; + + olWire = (xkbOutlineWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbOutlineWireDesc)); + if (!olWire) + return BadLength; + ol = XkbAddGeomOutline(shape, olWire->nPoints); + if (!ol) + return BadAlloc; + ol->corner_radius = olWire->cornerRadius; + for (p = 0, pt = ol->points; p < olWire->nPoints; p++, pt++) { + xkbPointWireDesc *ptWire; + + ptWire = (xkbPointWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbPointWireDesc)); + if (!ptWire) + return BadLength; + pt->x = ptWire->x; + pt->y = ptWire->y; + } + ol->num_points = olWire->nPoints; + } + if ((shapeWire->primaryNdx != XkbNoShape) && + (shapeWire->primaryNdx < shapeWire->nOutlines)) + shape->primary = &shape->outlines[shapeWire->primaryNdx]; + else + shape->primary = NULL; + if ((shapeWire->approxNdx != XkbNoShape) && + (shapeWire->approxNdx < shapeWire->nOutlines)) + shape->approx = &shape->outlines[shapeWire->approxNdx]; + else + shape->approx = NULL; + XkbComputeShapeBounds(shape); + } + return Success; +} + +static Status +_XkbReadGeomDoodad(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + XkbSectionPtr section) +{ + XkbDoodadPtr doodad; + xkbDoodadWireDesc *doodadWire; + + doodadWire = (xkbDoodadWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbDoodadWireDesc)); + if (!doodadWire) + return BadLength; + doodad = XkbAddGeomDoodad(geom, section, doodadWire->any.name); + if (!doodad) + return BadAlloc; + doodad->any.type = doodadWire->any.type; + doodad->any.priority = doodadWire->any.priority; + doodad->any.top = doodadWire->any.top; + doodad->any.left = doodadWire->any.left; + doodad->any.angle = doodadWire->any.angle; + switch (doodad->any.type) { + case XkbOutlineDoodad: + case XkbSolidDoodad: + doodad->shape.color_ndx = doodadWire->shape.colorNdx; + doodad->shape.shape_ndx = doodadWire->shape.shapeNdx; + break; + case XkbTextDoodad: + doodad->text.width = doodadWire->text.width; + doodad->text.height = doodadWire->text.height; + doodad->text.color_ndx = doodadWire->text.colorNdx; + if (!_XkbGetReadBufferCountedString(buf, &doodad->text.text)) + return BadLength; + if (!_XkbGetReadBufferCountedString(buf, &doodad->text.font)) + return BadLength; + break; + case XkbIndicatorDoodad: + doodad->indicator.shape_ndx = doodadWire->indicator.shapeNdx; + doodad->indicator.on_color_ndx = doodadWire->indicator.onColorNdx; + doodad->indicator.off_color_ndx = doodadWire->indicator.offColorNdx; + break; + case XkbLogoDoodad: + doodad->logo.color_ndx = doodadWire->logo.colorNdx; + doodad->logo.shape_ndx = doodadWire->logo.shapeNdx; + if (!_XkbGetReadBufferCountedString(buf, &doodad->logo.logo_name)) + return BadLength; + break; + default: + return BadValue; + } + return Success; +} + +static Status +_XkbReadGeomOverlay(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + XkbSectionPtr section) +{ + XkbOverlayPtr ol; + xkbOverlayWireDesc *olWire; + register int r; + + olWire = (xkbOverlayWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayWireDesc)); + if (olWire == NULL) + return BadLength; + ol = XkbAddGeomOverlay(section, olWire->name, olWire->nRows); + if (ol == NULL) + return BadLength; + for (r = 0; r < olWire->nRows; r++) { + register int k; + XkbOverlayRowPtr row; + xkbOverlayRowWireDesc *rowWire; + xkbOverlayKeyWireDesc *keyWire; + + rowWire = (xkbOverlayRowWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbOverlayRowWireDesc)); + if (rowWire == NULL) + return BadLength; + row = XkbAddGeomOverlayRow(ol, rowWire->rowUnder, rowWire->nKeys); + if (!row) + return BadAlloc; + row->row_under = rowWire->rowUnder; + if (rowWire->nKeys < 1) + continue; + keyWire = (xkbOverlayKeyWireDesc *) + _XkbGetReadBufferPtr(buf, + SIZEOF(xkbOverlayKeyWireDesc) * rowWire->nKeys); + if (keyWire == NULL) + return BadLength; + for (k = 0; k < rowWire->nKeys; k++, keyWire++, row->num_keys++) { + memcpy(row->keys[row->num_keys].over.name, keyWire->over, + XkbKeyNameLength); + memcpy(row->keys[row->num_keys].under.name, keyWire->under, + XkbKeyNameLength); + } + } + return Success; +} + +static Status +_XkbReadGeomSections(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + xkbGetGeometryReply *rep) +{ + register int s; + XkbSectionPtr section; + xkbSectionWireDesc *sectionWire; + Status rtrn; + + if (rep->nSections < 1) + return Success; + if ((rtrn = XkbAllocGeomSections(geom, rep->nSections)) != Success) + return rtrn; + for (s = 0; s < rep->nSections; s++) { + sectionWire = (xkbSectionWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbSectionWireDesc)); + if (!sectionWire) + return BadLength; + section = XkbAddGeomSection(geom, sectionWire->name, sectionWire->nRows, + sectionWire->nDoodads, + sectionWire->nOverlays); + if (!section) + return BadAlloc; + section->top = sectionWire->top; + section->left = sectionWire->left; + section->width = sectionWire->width; + section->height = sectionWire->height; + section->angle = sectionWire->angle; + section->priority = sectionWire->priority; + if (sectionWire->nRows > 0) { + register int r; + + for (r = 0; r < sectionWire->nRows; r++) { + XkbRowPtr row; + xkbRowWireDesc *rowWire; + + rowWire = (xkbRowWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbRowWireDesc)); + if (!rowWire) + return BadLength; + row = XkbAddGeomRow(section, rowWire->nKeys); + if (!row) + return BadAlloc; + row->top = rowWire->top; + row->left = rowWire->left; + row->vertical = rowWire->vertical; + if (rowWire->nKeys > 0) { + register int k; + + for (k = 0; k < rowWire->nKeys; k++) { + XkbKeyPtr key; + xkbKeyWireDesc *keyWire; + + keyWire = (xkbKeyWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyWireDesc)); + if (!keyWire) + return BadLength; + key = XkbAddGeomKey(row); + if (!key) + return BadAlloc; + memcpy(key->name.name, keyWire->name, XkbKeyNameLength); + key->gap = keyWire->gap; + key->shape_ndx = keyWire->shapeNdx; + key->color_ndx = keyWire->colorNdx; + } + } + } + } + if (sectionWire->nDoodads > 0) { + register int d; + + for (d = 0; d < sectionWire->nDoodads; d++) { + if ((rtrn = _XkbReadGeomDoodad(buf, geom, section)) != Success) + return rtrn; + } + } + if (sectionWire->nOverlays > 0) { + register int o; + + for (o = 0; o < sectionWire->nOverlays; o++) { + if ((rtrn = _XkbReadGeomOverlay(buf, geom, section)) != Success) + return rtrn; + } + } + } + return Success; +} + +static Status +_XkbReadGeomDoodads(XkbReadBufferPtr buf, + XkbGeometryPtr geom, + xkbGetGeometryReply *rep) +{ + register int d; + Status rtrn; + + if (rep->nDoodads < 1) + return Success; + if ((rtrn = XkbAllocGeomDoodads(geom, rep->nDoodads)) != Success) + return rtrn; + for (d = 0; d < rep->nDoodads; d++) { + if ((rtrn = _XkbReadGeomDoodad(buf, geom, NULL)) != Success) + return rtrn; + } + return Success; +} + +Status +_XkbReadGetGeometryReply(Display *dpy, + xkbGetGeometryReply *rep, + XkbDescPtr xkb, + int *nread_rtrn) +{ + XkbGeometryPtr geom; + + geom = _XkbTypedCalloc(1, XkbGeometryRec); + if (!geom) + return BadAlloc; + if (xkb->geom) + XkbFreeGeometry(xkb->geom, XkbGeomAllMask, True); + xkb->geom = geom; + + geom->name = rep->name; + geom->width_mm = rep->widthMM; + geom->height_mm = rep->heightMM; + if (rep->length) { + XkbReadBufferRec buf; + int left; + + if (_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) { + Status status = Success; + + if (nread_rtrn) + *nread_rtrn = (int) rep->length * 4; + if (!_XkbGetReadBufferCountedString(&buf, &geom->label_font)) + status = BadLength; + if (status == Success) + status = _XkbReadGeomProperties(&buf, geom, rep); + if (status == Success) + status = _XkbReadGeomColors(&buf, geom, rep); + if (status == Success) + status = _XkbReadGeomShapes(&buf, geom, rep); + if (status == Success) + status = _XkbReadGeomSections(&buf, geom, rep); + if (status == Success) + status = _XkbReadGeomDoodads(&buf, geom, rep); + if (status == Success) + status = _XkbReadGeomKeyAliases(&buf, geom, rep); + left = _XkbFreeReadBuffer(&buf); + if ((rep->baseColorNdx > geom->num_colors) || + (rep->labelColorNdx > geom->num_colors)) + status = BadLength; + if ((status != Success) || left || buf.error) { + if (status == Success) + status = BadLength; + XkbFreeGeometry(geom, XkbGeomAllMask, True); + xkb->geom = NULL; + return status; + } + geom->base_color = &geom->colors[rep->baseColorNdx]; + geom->label_color = &geom->colors[rep->labelColorNdx]; + } + else { + XkbFreeGeometry(geom, XkbGeomAllMask, True); + xkb->geom = NULL; + return BadAlloc; + } + } + return Success; +} + +Status +XkbGetGeometry(Display *dpy, XkbDescPtr xkb) +{ + xkbGetGeometryReq *req; + xkbGetGeometryReply rep; + Status status; + + if ((!xkb) || (dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + LockDisplay(dpy); + GetReq(kbGetGeometry, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetGeometry; + req->deviceSpec = xkb->device_spec; + req->name = None; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) + status = BadImplementation; + else if (!rep.found) + status = BadName; + else + status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetNamedGeometry(Display *dpy, XkbDescPtr xkb, Atom name) +{ + xkbGetGeometryReq *req; + xkbGetGeometryReply rep; + Status status; + + if ((name == None) || (dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + LockDisplay(dpy); + GetReq(kbGetGeometry, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetGeometry; + req->deviceSpec = xkb->device_spec; + req->name = (CARD32) name; + if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.found)) + status = BadImplementation; + else if (!rep.found) + status = BadName; + else + status = _XkbReadGetGeometryReply(dpy, &rep, xkb, NULL); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} diff --git a/nx-X11/lib/src/xkb/XKBGetByName.c b/nx-X11/lib/src/xkb/XKBGetByName.c new file mode 100644 index 000000000..c673781ed --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBGetByName.c @@ -0,0 +1,226 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#define NEED_MAP_READERS +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +/***====================================================================***/ + +XkbDescPtr +XkbGetKeyboardByName(Display *dpy, + unsigned deviceSpec, + XkbComponentNamesPtr names, + unsigned want, + unsigned need, + Bool load) +{ + register xkbGetKbdByNameReq *req; + xkbGetKbdByNameReply rep; + int len, extraLen = 0; + char *str; + XkbDescPtr xkb; + int mapLen, codesLen, typesLen, compatLen; + int symsLen, geomLen; + XkbInfoPtr xkbi; + + if ((dpy == NULL) || (dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return NULL; + + xkbi = dpy->xkb_info; + xkb = (XkbDescRec *) _XkbCalloc(1, sizeof(XkbDescRec)); + if (!xkb) + return NULL; + xkb->device_spec = deviceSpec; + xkb->map = (XkbClientMapRec *) _XkbCalloc(1, sizeof(XkbClientMapRec)); + xkb->dpy = dpy; + + LockDisplay(dpy); + GetReq(kbGetKbdByName, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetKbdByName; + req->deviceSpec = xkb->device_spec; + req->want = want; + req->need = need; + req->load = load; + + mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; + if (names) { + if (names->keymap) + mapLen = (int) strlen(names->keymap); + if (names->keycodes) + codesLen = (int) strlen(names->keycodes); + if (names->types) + typesLen = (int) strlen(names->types); + if (names->compat) + compatLen = (int) strlen(names->compat); + if (names->symbols) + symsLen = (int) strlen(names->symbols); + if (names->geometry) + geomLen = (int) strlen(names->geometry); + if (mapLen > 255) + mapLen = 255; + if (codesLen > 255) + codesLen = 255; + if (typesLen > 255) + typesLen = 255; + if (compatLen > 255) + compatLen = 255; + if (symsLen > 255) + symsLen = 255; + if (geomLen > 255) + geomLen = 255; + } + else + mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; + + len = mapLen + codesLen + typesLen + compatLen + symsLen + geomLen + 6; + len = XkbPaddedSize(len); + req->length += len / 4; + BufAlloc(char *, str, len); + + *str++ = mapLen; + if (mapLen > 0) { + memcpy(str, names->keymap, mapLen); + str += mapLen; + } + *str++ = codesLen; + if (codesLen > 0) { + memcpy(str, names->keycodes, codesLen); + str += codesLen; + } + *str++ = typesLen; + if (typesLen > 0) { + memcpy(str, names->types, typesLen); + str += typesLen; + } + *str++ = compatLen; + if (compatLen > 0) { + memcpy(str, names->compat, compatLen); + str += compatLen; + } + *str++ = symsLen; + if (symsLen > 0) { + memcpy(str, names->symbols, symsLen); + str += symsLen; + } + *str++ = geomLen; + if (geomLen > 0) { + memcpy(str, names->geometry, geomLen); + str += geomLen; + } + if ((!_XReply(dpy, (xReply *) &rep, 0, xFalse)) || (!rep.reported)) + goto BAILOUT; + extraLen = (int) rep.length * 4; + + xkb->device_spec = rep.deviceID; + xkb->min_key_code = rep.minKeyCode; + xkb->max_key_code = rep.maxKeyCode; + if (rep.reported & (XkbGBN_SymbolsMask | XkbGBN_TypesMask)) { + xkbGetMapReply mrep; + Status status; + int nread = 0; + + _XRead(dpy, (char *) &mrep, SIZEOF(xkbGetMapReply)); + extraLen -= SIZEOF(xkbGetMapReply); + status = _XkbReadGetMapReply(dpy, &mrep, xkb, &nread); + extraLen -= nread; + if (status != Success) + goto BAILOUT; + } + if (rep.reported & XkbGBN_CompatMapMask) { + xkbGetCompatMapReply crep; + Status status; + int nread = 0; + + _XRead(dpy, (char *) &crep, SIZEOF(xkbGetCompatMapReply)); + extraLen -= SIZEOF(xkbGetCompatMapReply); + status = _XkbReadGetCompatMapReply(dpy, &crep, xkb, &nread); + extraLen -= nread; + if (status != Success) + goto BAILOUT; + } + if (rep.reported & XkbGBN_IndicatorMapMask) { + xkbGetIndicatorMapReply irep; + Status status; + int nread = 0; + + _XRead(dpy, (char *) &irep, SIZEOF(xkbGetIndicatorMapReply)); + extraLen -= SIZEOF(xkbGetIndicatorMapReply); + status = _XkbReadGetIndicatorMapReply(dpy, &irep, xkb, &nread); + extraLen -= nread; + if (status != Success) + goto BAILOUT; + } + if (rep.reported & (XkbGBN_KeyNamesMask | XkbGBN_OtherNamesMask)) { + xkbGetNamesReply nrep; + Status status; + int nread = 0; + + _XRead(dpy, (char *) &nrep, SIZEOF(xkbGetNamesReply)); + extraLen -= SIZEOF(xkbGetNamesReply); + status = _XkbReadGetNamesReply(dpy, &nrep, xkb, &nread); + extraLen -= nread; + if (status != Success) + goto BAILOUT; + } + if (rep.reported & XkbGBN_GeometryMask) { + xkbGetGeometryReply grep; + Status status; + int nread = 0; + + _XRead(dpy, (char *) &grep, SIZEOF(xkbGetGeometryReply)); + extraLen -= SIZEOF(xkbGetGeometryReply); + status = _XkbReadGetGeometryReply(dpy, &grep, xkb, &nread); + extraLen -= nread; + if (status != Success) + goto BAILOUT; + } + if (extraLen > 0) + goto BAILOUT; + UnlockDisplay(dpy); + SyncHandle(); + return xkb; + BAILOUT: + if (xkb != NULL) + XkbFreeKeyboard(xkb, XkbAllComponentsMask, xTrue); + if (extraLen > 0) + _XEatData(dpy, extraLen); + UnlockDisplay(dpy); + SyncHandle(); + return NULL; +} + +XkbDescPtr +XkbGetKeyboard(Display *dpy, unsigned which, unsigned deviceSpec) +{ + return XkbGetKeyboardByName(dpy, deviceSpec, NULL, which, which, False); +} diff --git a/nx-X11/lib/src/xkb/XKBGetMap.c b/nx-X11/lib/src/xkb/XKBGetMap.c new file mode 100644 index 000000000..6e3c74343 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBGetMap.c @@ -0,0 +1,882 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#define NEED_MAP_READERS +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +static Status +_XkbReadKeyTypes(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) +{ + int i, n, lastMapCount; + XkbKeyTypePtr type; + + if (rep->nTypes > 0) { + n = rep->firstType + rep->nTypes; + if (xkb->map->num_types >= n) + n = xkb->map->num_types; + else if (XkbAllocClientMap(xkb, XkbKeyTypesMask, n) != Success) + return BadAlloc; + + type = &xkb->map->types[rep->firstType]; + for (i = 0; i < (int) rep->nTypes; i++, type++) { + xkbKeyTypeWireDesc *desc; + register int ndx; + + ndx = i + rep->firstType; + if (ndx >= xkb->map->num_types) + xkb->map->num_types = ndx + 1; + + desc = (xkbKeyTypeWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbKeyTypeWireDesc)); + if (desc == NULL) + return BadLength; + + lastMapCount = type->map_count; + if (desc->nMapEntries > 0) { + if ((type->map == NULL) || + (desc->nMapEntries > type->map_count)) { + XkbKTMapEntryRec *prev_map = type->map; + + type->map = _XkbTypedRealloc(type->map, desc->nMapEntries, + XkbKTMapEntryRec); + if (type->map == NULL) { + _XkbFree(prev_map); + return BadAlloc; + } + } + } + else if (type->map != NULL) { + Xfree(type->map); + type->map_count = 0; + type->map = NULL; + } + + if (desc->preserve && (desc->nMapEntries > 0)) { + if ((!type->preserve) || (desc->nMapEntries > lastMapCount)) { + XkbModsRec *prev_preserve = type->preserve; + + type->preserve = _XkbTypedRealloc(type->preserve, + desc->nMapEntries, + XkbModsRec); + if (type->preserve == NULL) { + _XkbFree(prev_preserve); + return BadAlloc; + } + } + } + else if (type->preserve != NULL) { + Xfree(type->preserve); + type->preserve = NULL; + } + + type->mods.mask = desc->mask; + type->mods.real_mods = desc->realMods; + type->mods.vmods = desc->virtualMods; + type->num_levels = desc->numLevels; + type->map_count = desc->nMapEntries; + if (desc->nMapEntries > 0) { + register xkbKTMapEntryWireDesc *wire; + register XkbKTMapEntryPtr entry; + register int size; + + size = type->map_count * SIZEOF(xkbKTMapEntryWireDesc); + wire = + (xkbKTMapEntryWireDesc *) _XkbGetReadBufferPtr(buf, size); + if (wire == NULL) + return BadLength; + entry = type->map; + for (n = 0; n < type->map_count; n++, wire++, entry++) { + entry->active = wire->active; + entry->level = wire->level; + entry->mods.mask = wire->mask; + entry->mods.real_mods = wire->realMods; + entry->mods.vmods = wire->virtualMods; + } + + if (desc->preserve) { + register xkbModsWireDesc *pwire; + register XkbModsPtr preserve; + register int sz; + + sz = desc->nMapEntries * SIZEOF(xkbModsWireDesc); + pwire = (xkbModsWireDesc *) _XkbGetReadBufferPtr(buf, sz); + if (pwire == NULL) + return BadLength; + preserve = type->preserve; + for (n = 0; n < desc->nMapEntries; n++, pwire++, preserve++) { + preserve->mask = pwire->mask; + preserve->vmods = pwire->virtualMods; + preserve->real_mods = pwire->realMods; + } + } + } + } + } + return Success; +} + +static Status +_XkbReadKeySyms(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) +{ + register int i; + XkbClientMapPtr map; + int size = xkb->max_key_code + 1; + + if (((unsigned short) rep->firstKeySym + rep->nKeySyms) > size) + return BadLength; + + map = xkb->map; + if (map->key_sym_map == NULL) { + register int offset; + XkbSymMapPtr oldMap; + xkbSymMapWireDesc *newMap; + + map->key_sym_map = _XkbTypedCalloc(size, XkbSymMapRec); + if (map->key_sym_map == NULL) + return BadAlloc; + if (map->syms == NULL) { + int sz; + + sz = (rep->totalSyms * 12) / 10; + sz = ((sz + (unsigned) 128) / 128) * 128; + map->syms = _XkbTypedCalloc(sz, KeySym); + if (map->syms == NULL) + return BadAlloc; + map->size_syms = sz; + } + offset = 1; + oldMap = &map->key_sym_map[rep->firstKeySym]; + for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { + newMap = (xkbSymMapWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); + if (newMap == NULL) + return BadLength; + oldMap->kt_index[0] = newMap->ktIndex[0]; + oldMap->kt_index[1] = newMap->ktIndex[1]; + oldMap->kt_index[2] = newMap->ktIndex[2]; + oldMap->kt_index[3] = newMap->ktIndex[3]; + oldMap->group_info = newMap->groupInfo; + oldMap->width = newMap->width; + oldMap->offset = offset; + if (offset + newMap->nSyms >= map->size_syms) { + register int sz; + KeySym *prev_syms = map->syms; + + sz = map->size_syms + 128; + map->syms = _XkbTypedRealloc(map->syms, sz, KeySym); + if (map->syms == NULL) { + _XkbFree(prev_syms); + map->size_syms = 0; + return BadAlloc; + } + map->size_syms = sz; + } + if (newMap->nSyms > 0) { + _XkbReadBufferCopyKeySyms(buf, (KeySym *) &map->syms[offset], + newMap->nSyms); + offset += newMap->nSyms; + } + else { + map->syms[offset] = 0; + } + } + map->num_syms = offset; + } + else { + XkbSymMapPtr oldMap = &map->key_sym_map[rep->firstKeySym]; + + for (i = 0; i < (int) rep->nKeySyms; i++, oldMap++) { + xkbSymMapWireDesc *newMap; + KeySym *newSyms; + int tmp; + + newMap = (xkbSymMapWireDesc *) + _XkbGetReadBufferPtr(buf, SIZEOF(xkbSymMapWireDesc)); + if (newMap == NULL) + return BadLength; + + if (newMap->nSyms > 0) + tmp = newMap->nSyms; + else + tmp = 0; + + newSyms = XkbResizeKeySyms(xkb, i + rep->firstKeySym, tmp); + if (newSyms == NULL) + return BadAlloc; + if (newMap->nSyms > 0) + _XkbReadBufferCopyKeySyms(buf, newSyms, newMap->nSyms); + else + newSyms[0] = NoSymbol; + oldMap->kt_index[0] = newMap->ktIndex[0]; + oldMap->kt_index[1] = newMap->ktIndex[1]; + oldMap->kt_index[2] = newMap->ktIndex[2]; + oldMap->kt_index[3] = newMap->ktIndex[3]; + oldMap->group_info = newMap->groupInfo; + oldMap->width = newMap->width; + } + } + return Success; +} + +static Status +_XkbReadKeyActions(XkbReadBufferPtr buf, XkbDescPtr info, xkbGetMapReply *rep) +{ + int i; + CARD8 numDescBuf[248]; + CARD8 *numDesc = NULL; + register int nKeyActs; + Status ret = Success; + + if ((nKeyActs = rep->nKeyActs) > 0) { + XkbSymMapPtr symMap; + + if (nKeyActs < sizeof numDescBuf) + numDesc = numDescBuf; + else + numDesc = Xmalloc(nKeyActs * sizeof(CARD8)); + + if (!_XkbCopyFromReadBuffer(buf, (char *) numDesc, nKeyActs)) { + ret = BadLength; + goto done; + } + i = XkbPaddedSize(nKeyActs) - nKeyActs; + if ((i > 0) && (!_XkbSkipReadBufferData(buf, i))) { + ret = BadLength; + goto done; + } + symMap = &info->map->key_sym_map[rep->firstKeyAct]; + for (i = 0; i < (int) rep->nKeyActs; i++, symMap++) { + if (numDesc[i] == 0) { + if ((i + rep->firstKeyAct) > (info->max_key_code + 1)) { + ret = BadLength; + goto done; + } + info->server->key_acts[i + rep->firstKeyAct] = 0; + } + else { + XkbAction *newActs; + + /* 8/16/93 (ef) -- XXX! Verify size here (numdesc must be */ + /* either zero or XkbKeyNumSyms(info,key) */ + newActs = XkbResizeKeyActions(info, i + rep->firstKeyAct, + numDesc[i]); + if (newActs == NULL) { + ret = BadAlloc; + goto done; + } + if (!_XkbCopyFromReadBuffer(buf, (char *) newActs, + (int) (numDesc[i] * sizeof(XkbAction)))) { + ret = BadLength; + goto done; + } + } + } + } + done: + if (numDesc != NULL && numDesc != numDescBuf) + Xfree(numDesc); + return ret; +} + +static Status +_XkbReadKeyBehaviors(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) +{ + register int i; + + if (rep->totalKeyBehaviors > 0) { + int size = xkb->max_key_code + 1; + + if (((int) rep->firstKeyBehavior + rep->nKeyBehaviors) > size) + return BadLength; + if (xkb->server->behaviors == NULL) { + xkb->server->behaviors = _XkbTypedCalloc(size, XkbBehavior); + if (xkb->server->behaviors == NULL) + return BadAlloc; + } + else { + bzero(&xkb->server->behaviors[rep->firstKeyBehavior], + (rep->nKeyBehaviors * sizeof(XkbBehavior))); + } + for (i = 0; i < rep->totalKeyBehaviors; i++) { + xkbBehaviorWireDesc *wire; + + wire = (xkbBehaviorWireDesc *) _XkbGetReadBufferPtr(buf, + SIZEOF(xkbBehaviorWireDesc)); + if (wire == NULL || wire->key >= size) + return BadLength; + xkb->server->behaviors[wire->key].type = wire->type; + xkb->server->behaviors[wire->key].data = wire->data; + } + } + return Success; +} + +static Status +_XkbReadVirtualMods(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) +{ + if (rep->virtualMods) { + register int i, bit, nVMods; + register char *data; + + for (i = nVMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (rep->virtualMods & bit) + nVMods++; + } + data = _XkbGetReadBufferPtr(buf, XkbPaddedSize(nVMods)); + if (data == NULL) + return BadLength; + for (i = 0, bit = 1; (i < XkbNumVirtualMods) && (nVMods > 0); + i++, bit <<= 1) { + if (rep->virtualMods & bit) { + xkb->server->vmods[i] = *data++; + nVMods--; + } + } + } + return Success; +} + +static Status +_XkbReadExplicitComponents(XkbReadBufferPtr buf, + XkbDescPtr xkb, + xkbGetMapReply *rep) +{ + register int i; + unsigned char *wire; + + if (rep->totalKeyExplicit > 0) { + int size = xkb->max_key_code + 1; + + if (((int) rep->firstKeyExplicit + rep->nKeyExplicit) > size) + return BadLength; + if (xkb->server->explicit == NULL) { + xkb->server->explicit = _XkbTypedCalloc(size, unsigned char); + + if (xkb->server->explicit == NULL) + return BadAlloc; + } + else { + bzero(&xkb->server->explicit[rep->firstKeyExplicit], + rep->nKeyExplicit); + } + i = XkbPaddedSize(2 * rep->totalKeyExplicit); + wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); + if (!wire) + return BadLength; + for (i = 0; i < rep->totalKeyExplicit; i++, wire += 2) { + if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) + return BadLength; + xkb->server->explicit[wire[0]] = wire[1]; + } + } + return Success; +} + +static Status +_XkbReadModifierMap(XkbReadBufferPtr buf, XkbDescPtr xkb, xkbGetMapReply *rep) +{ + register int i; + unsigned char *wire; + + if (rep->totalModMapKeys > 0) { + if (((int) rep->firstModMapKey + rep->nModMapKeys) > + (xkb->max_key_code + 1)) + return BadLength; + if ((xkb->map->modmap == NULL) && + (XkbAllocClientMap(xkb, XkbModifierMapMask, 0) != Success)) { + return BadAlloc; + } + else { + bzero(&xkb->map->modmap[rep->firstModMapKey], rep->nModMapKeys); + } + i = XkbPaddedSize(2 * rep->totalModMapKeys); + wire = (unsigned char *) _XkbGetReadBufferPtr(buf, i); + if (!wire) + return BadLength; + for (i = 0; i < rep->totalModMapKeys; i++, wire += 2) { + if (wire[0] > xkb->max_key_code || wire[1] > xkb->max_key_code) + return BadLength; + xkb->map->modmap[wire[0]] = wire[1]; + } + } + return Success; +} + +static Status +_XkbReadVirtualModMap(XkbReadBufferPtr buf, + XkbDescPtr xkb, + xkbGetMapReply *rep) +{ + register int i; + xkbVModMapWireDesc *wire; + XkbServerMapPtr srv; + + if (rep->totalVModMapKeys > 0) { + if (((int) rep->firstVModMapKey + rep->nVModMapKeys) + > xkb->max_key_code + 1) + return BadLength; + if (((xkb->server == NULL) || (xkb->server->vmodmap == NULL)) && + (XkbAllocServerMap(xkb, XkbVirtualModMapMask, 0) != Success)) { + return BadAlloc; + } + else { + srv = xkb->server; + if (rep->nVModMapKeys > rep->firstVModMapKey) + bzero((char *) &srv->vmodmap[rep->firstVModMapKey], + (rep->nVModMapKeys - rep->firstVModMapKey) * + sizeof(unsigned short)); + } + srv = xkb->server; + i = rep->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); + wire = (xkbVModMapWireDesc *) _XkbGetReadBufferPtr(buf, i); + if (!wire) + return BadLength; + for (i = 0; i < rep->totalVModMapKeys; i++, wire++) { + if ((wire->key >= xkb->min_key_code) && + (wire->key <= xkb->max_key_code)) + srv->vmodmap[wire->key] = wire->vmods; + } + } + return Success; +} + +static xkbGetMapReq * +_XkbGetGetMapReq(Display *dpy, XkbDescPtr xkb) +{ + xkbGetMapReq *req; + + GetReq(kbGetMap, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbGetMap; + req->deviceSpec = xkb->device_spec; + req->full = req->partial = 0; + req->firstType = req->nTypes = 0; + req->firstKeySym = req->nKeySyms = 0; + req->firstKeyAct = req->nKeyActs = 0; + req->firstKeyBehavior = req->nKeyBehaviors = 0; + req->virtualMods = 0; + req->firstKeyExplicit = req->nKeyExplicit = 0; + req->firstModMapKey = req->nModMapKeys = 0; + req->firstVModMapKey = req->nVModMapKeys = 0; + return req; +} + +Status +_XkbReadGetMapReply(Display *dpy, + xkbGetMapReply *rep, + XkbDescPtr xkb, + int *nread_rtrn) +{ + int extraData; + unsigned mask; + + if (xkb->device_spec == XkbUseCoreKbd) + xkb->device_spec = rep->deviceID; + if (rep->maxKeyCode < rep->minKeyCode) + return BadImplementation; + xkb->min_key_code = rep->minKeyCode; + xkb->max_key_code = rep->maxKeyCode; + + if (!xkb->map) { + mask = rep->present & XkbAllClientInfoMask; + if (mask && (XkbAllocClientMap(xkb, mask, rep->nTypes) != Success)) + return BadAlloc; + } + if (!xkb->server) { + mask = rep->present & XkbAllServerInfoMask; + if (mask && (XkbAllocServerMap(xkb, mask, rep->totalActs) != Success)) + return BadAlloc; + } + extraData = (int) (rep->length * 4); + extraData -= (SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)); + if (rep->length) { + XkbReadBufferRec buf; + int left; + + if (_XkbInitReadBuffer(dpy, &buf, extraData)) { + Status status = Success; + + if (nread_rtrn != NULL) + *nread_rtrn = extraData; + if (status == Success) + status = _XkbReadKeyTypes(&buf, xkb, rep); + if (status == Success) + status = _XkbReadKeySyms(&buf, xkb, rep); + if (status == Success) + status = _XkbReadKeyActions(&buf, xkb, rep); + if (status == Success) + status = _XkbReadKeyBehaviors(&buf, xkb, rep); + if (status == Success) + status = _XkbReadVirtualMods(&buf, xkb, rep); + if (status == Success) + status = _XkbReadExplicitComponents(&buf, xkb, rep); + if (status == Success) + status = _XkbReadModifierMap(&buf, xkb, rep); + if (status == Success) + status = _XkbReadVirtualModMap(&buf, xkb, rep); + left = _XkbFreeReadBuffer(&buf); + if (status != Success) + return status; + else if (left || buf.error) + return BadLength; + } + else + return BadAlloc; + } + return Success; +} + +static Status +_XkbHandleGetMapReply(Display *dpy, XkbDescPtr xkb) +{ + xkbGetMapReply rep; + + if (!_XReply(dpy, (xReply *) &rep, + ((SIZEOF(xkbGetMapReply) - SIZEOF(xGenericReply)) >> 2), + xFalse)) { + return BadImplementation; + } + return _XkbReadGetMapReply(dpy, &rep, xkb, NULL); +} + +Status +XkbGetUpdatedMap(Display *dpy, unsigned which, XkbDescPtr xkb) +{ + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + if (which) { + register xkbGetMapReq *req; + Status status; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->full = which; + status = _XkbHandleGetMapReply(dpy, xkb); + + UnlockDisplay(dpy); + SyncHandle(); + return status; + } + return Success; +} + +XkbDescPtr +XkbGetMap(Display *dpy, unsigned which, unsigned deviceSpec) +{ + XkbDescPtr xkb; + + xkb = _XkbTypedCalloc(1, XkbDescRec); + if (xkb) { + xkb->device_spec = deviceSpec; + xkb->map = _XkbTypedCalloc(1, XkbClientMapRec); + if ((xkb->map == NULL) || + ((which) && (XkbGetUpdatedMap(dpy, which, xkb) != Success))) { + if (xkb->map) { + Xfree(xkb->map); + xkb->map = NULL; + } + Xfree(xkb); + return NULL; + } + xkb->dpy = dpy; + } + return xkb; +} + +Status +XkbGetKeyTypes(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + if ((num < 1) || (num > XkbMaxKeyTypes)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstType = first; + req->nTypes = num; + status = _XkbHandleGetMapReply(dpy, xkb); + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetKeyActions(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstKeyAct = first; + req->nKeyActs = num; + status = _XkbHandleGetMapReply(dpy, xkb); + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetKeySyms(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstKeySym = first; + req->nKeySyms = num; + status = _XkbHandleGetMapReply(dpy, xkb); + + UnlockDisplay(dpy); + SyncHandle(); + + return status; +} + +Status +XkbGetKeyBehaviors(Display *dpy, unsigned first, unsigned num, XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstKeyBehavior = first; + req->nKeyBehaviors = num; + status = _XkbHandleGetMapReply(dpy, xkb); + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetVirtualMods(Display *dpy, unsigned which, XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->virtualMods = which; + status = _XkbHandleGetMapReply(dpy, xkb); + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetKeyExplicitComponents(Display *dpy, + unsigned first, + unsigned num, + XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstKeyExplicit = first; + req->nKeyExplicit = num; + if ((xkb != NULL) && (xkb->server != NULL) && + (xkb->server->explicit != NULL)) { + if ((num > 0) && (first >= xkb->min_key_code) && + (first + num <= xkb->max_key_code)) + bzero(&xkb->server->explicit[first], num); + } + if (xkb) + status = _XkbHandleGetMapReply(dpy, xkb); + else + status = BadMatch; + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetKeyModifierMap(Display *dpy, + unsigned first, + unsigned num, + XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstModMapKey = first; + req->nModMapKeys = num; + if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { + if ((num > 0) && (first >= xkb->min_key_code) && + (first + num <= xkb->max_key_code)) + bzero(&xkb->map->modmap[first], num); + } + if (xkb) + status = _XkbHandleGetMapReply(dpy, xkb); + else + status = BadMatch; + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetKeyVirtualModMap(Display *dpy, unsigned first, unsigned num, + XkbDescPtr xkb) +{ + register xkbGetMapReq *req; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + if ((num < 1) || (num > XkbMaxKeyCount)) + return BadValue; + + LockDisplay(dpy); + + req = _XkbGetGetMapReq(dpy, xkb); + req->firstVModMapKey = first; + req->nVModMapKeys = num; + if ((xkb != NULL) && (xkb->map != NULL) && (xkb->map->modmap != NULL)) { + if ((num > 0) && (first >= xkb->min_key_code) && + (first + num <= xkb->max_key_code)) + bzero(&xkb->server->vmodmap[first], num * sizeof(unsigned short)); + } + + if (xkb) + status = _XkbHandleGetMapReply(dpy, xkb); + else + status = BadMatch; + + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Status +XkbGetMapChanges(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) +{ + xkbGetMapReq *req; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + LockDisplay(dpy); + if (changes->changed) { + Status status = Success; + + req = _XkbGetGetMapReq(dpy, xkb); + req->full = 0; + req->partial = changes->changed; + req->firstType = changes->first_type; + req->nTypes = changes->num_types; + req->firstKeySym = changes->first_key_sym; + req->nKeySyms = changes->num_key_syms; + req->firstKeyAct = changes->first_key_act; + req->nKeyActs = changes->num_key_acts; + req->firstKeyBehavior = changes->first_key_behavior; + req->nKeyBehaviors = changes->num_key_behaviors; + req->virtualMods = changes->vmods; + req->firstKeyExplicit = changes->first_key_explicit; + req->nKeyExplicit = changes->num_key_explicit; + req->firstModMapKey = changes->first_modmap_key; + req->nModMapKeys = changes->num_modmap_keys; + req->firstVModMapKey = changes->first_vmodmap_key; + req->nVModMapKeys = changes->num_vmodmap_keys; + status = _XkbHandleGetMapReply(dpy, xkb); + UnlockDisplay(dpy); + SyncHandle(); + return status; + } + UnlockDisplay(dpy); + return Success; +} diff --git a/nx-X11/lib/src/xkb/XKBList.c b/nx-X11/lib/src/xkb/XKBList.c new file mode 100644 index 000000000..d3d29e2a6 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBList.c @@ -0,0 +1,256 @@ +/************************************************************ +Copyright (c) 1995 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#define NEED_MAP_READERS +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +/***====================================================================***/ + +static void +_FreeComponentNames(int num, XkbComponentNamePtr names) +{ + int i; + XkbComponentNamePtr tmp; + + if ((num < 1) || (names == NULL)) + return; + for (i = 0, tmp = names; i < num; i++, tmp++) { + if (tmp->name) { + _XkbFree(tmp->name); + tmp->name = NULL; + } + } + _XkbFree(names); + return; +} + +/***====================================================================***/ + +static XkbComponentNamePtr +_ReadListing(XkbReadBufferPtr buf, int count, Status * status_rtrn) +{ + XkbComponentNamePtr first, this; + register int i; + CARD16 *flags; + int slen, wlen; + char *str; + + if (count < 1) + return NULL; + first = _XkbTypedCalloc(count, XkbComponentNameRec); + if (!first) + return NULL; + for (this = first, i = 0; i < count; i++, this++) { + flags = (CARD16 *) _XkbGetReadBufferPtr(buf, 2 * sizeof(CARD16)); + if (!flags) + goto BAILOUT; + this->flags = flags[0]; + slen = flags[1]; + wlen = ((slen + 1) / 2) * 2; /* pad to 2 byte boundary */ + this->name = _XkbTypedCalloc(slen + 1, char); + + if (!this->name) + goto BAILOUT; + str = (char *) _XkbGetReadBufferPtr(buf, wlen); + if (!str) + goto BAILOUT; + memcpy(this->name, str, slen); + } + return first; + BAILOUT: + *status_rtrn = BadAlloc; + _FreeComponentNames(i, first); + return NULL; +} + +/***====================================================================***/ + +XkbComponentListPtr +XkbListComponents(Display *dpy, + unsigned deviceSpec, + XkbComponentNamesPtr ptrns, + int *max_inout) +{ + register xkbListComponentsReq *req; + xkbListComponentsReply rep; + XkbInfoPtr xkbi; + XkbComponentListPtr list; + XkbReadBufferRec buf; + int left; + char *str; + int extraLen, len, mapLen, codesLen, typesLen, compatLen, symsLen, geomLen; + + if ((dpy == NULL) || (dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || + (ptrns == NULL) || (max_inout == NULL)) + return NULL; + + xkbi = dpy->xkb_info; + LockDisplay(dpy); + GetReq(kbListComponents, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbListComponents; + req->deviceSpec = deviceSpec; + req->maxNames = *max_inout; + + mapLen = codesLen = typesLen = compatLen = symsLen = geomLen = 0; + if (ptrns->keymap) + mapLen = (int) strlen(ptrns->keymap); + if (ptrns->keycodes) + codesLen = (int) strlen(ptrns->keycodes); + if (ptrns->types) + typesLen = (int) strlen(ptrns->types); + if (ptrns->compat) + compatLen = (int) strlen(ptrns->compat); + if (ptrns->symbols) + symsLen = (int) strlen(ptrns->symbols); + if (ptrns->geometry) + geomLen = (int) strlen(ptrns->geometry); + if (mapLen > 255) + mapLen = 255; + if (codesLen > 255) + codesLen = 255; + if (typesLen > 255) + typesLen = 255; + if (compatLen > 255) + compatLen = 255; + if (symsLen > 255) + symsLen = 255; + if (geomLen > 255) + geomLen = 255; + + len = mapLen + codesLen + typesLen + compatLen + symsLen + geomLen + 6; + len = XkbPaddedSize(len); + req->length += len / 4; + BufAlloc(char *, str, len); + + *str++ = mapLen; + if (mapLen > 0) { + memcpy(str, ptrns->keymap, mapLen); + str += mapLen; + } + *str++ = codesLen; + if (codesLen > 0) { + memcpy(str, ptrns->keycodes, codesLen); + str += codesLen; + } + *str++ = typesLen; + if (typesLen > 0) { + memcpy(str, ptrns->types, typesLen); + str += typesLen; + } + *str++ = compatLen; + if (compatLen > 0) { + memcpy(str, ptrns->compat, compatLen); + str += compatLen; + } + *str++ = symsLen; + if (symsLen > 0) { + memcpy(str, ptrns->symbols, symsLen); + str += symsLen; + } + *str++ = geomLen; + if (geomLen > 0) { + memcpy(str, ptrns->geometry, geomLen); + str += geomLen; + } + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) + goto BAILOUT; + extraLen = (int) rep.length * 4; + *max_inout = rep.extra; + if (extraLen == 0) { /* no matches, but we don't want to report a failure */ + list = _XkbTypedCalloc(1, XkbComponentListRec); + UnlockDisplay(dpy); + SyncHandle(); + return list; + } + if (_XkbInitReadBuffer(dpy, &buf, extraLen)) { + Status status = Success; + + list = _XkbTypedCalloc(1, XkbComponentListRec); + if (!list) { + _XkbFreeReadBuffer(&buf); + goto BAILOUT; + } + list->num_keymaps = rep.nKeymaps; + list->num_keycodes = rep.nKeycodes; + list->num_types = rep.nTypes; + list->num_compat = rep.nCompatMaps; + list->num_symbols = rep.nSymbols; + list->num_geometry = rep.nGeometries; + if ((status == Success) && (list->num_keymaps > 0)) + list->keymaps = _ReadListing(&buf, list->num_keymaps, &status); + if ((status == Success) && (list->num_keycodes > 0)) + list->keycodes = _ReadListing(&buf, list->num_keycodes, &status); + if ((status == Success) && (list->num_types > 0)) + list->types = _ReadListing(&buf, list->num_types, &status); + if ((status == Success) && (list->num_compat > 0)) + list->compat = _ReadListing(&buf, list->num_compat, &status); + if ((status == Success) && (list->num_symbols > 0)) + list->symbols = _ReadListing(&buf, list->num_symbols, &status); + if ((status == Success) && (list->num_geometry > 0)) + list->geometry = _ReadListing(&buf, list->num_geometry, &status); + left = _XkbFreeReadBuffer(&buf); + if ((status != Success) || (buf.error) || (left > 2)) { + XkbFreeComponentList(list); + goto BAILOUT; + } + UnlockDisplay(dpy); + SyncHandle(); + return list; + } + BAILOUT: + UnlockDisplay(dpy); + SyncHandle(); + return NULL; +} + +void +XkbFreeComponentList(XkbComponentListPtr list) +{ + if (list) { + if (list->keymaps) + _FreeComponentNames(list->num_keymaps, list->keymaps); + if (list->keycodes) + _FreeComponentNames(list->num_keycodes, list->keycodes); + if (list->types) + _FreeComponentNames(list->num_types, list->types); + if (list->compat) + _FreeComponentNames(list->num_compat, list->compat); + if (list->symbols) + _FreeComponentNames(list->num_symbols, list->symbols); + if (list->geometry) + _FreeComponentNames(list->num_geometry, list->geometry); + bzero((char *) list, sizeof(XkbComponentListRec)); + _XkbFree(list); + } + return; +} diff --git a/nx-X11/lib/src/xkb/XKBMAlloc.c b/nx-X11/lib/src/xkb/XKBMAlloc.c new file mode 100644 index 000000000..2467a2024 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBMAlloc.c @@ -0,0 +1,1016 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include "Xlibint.h" +#include +#include +#include "XKBlibint.h" + + +/***====================================================================***/ + +Status +XkbAllocClientMap(XkbDescPtr xkb, unsigned which, unsigned nTotalTypes) +{ + register int i; + XkbClientMapPtr map; + + if ((xkb == NULL) || + ((nTotalTypes > 0) && (nTotalTypes < XkbNumRequiredTypes))) + return BadValue; + if ((which & XkbKeySymsMask) && + ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code))) { +#ifdef DEBUG + fprintf(stderr, "bad keycode (%d,%d) in XkbAllocClientMap\n", + xkb->min_key_code, xkb->max_key_code); +#endif + return BadValue; + } + + if (xkb->map == NULL) { + map = _XkbTypedCalloc(1, XkbClientMapRec); + if (map == NULL) + return BadAlloc; + xkb->map = map; + } + else + map = xkb->map; + + if ((which & XkbKeyTypesMask) && (nTotalTypes > 0)) { + if (map->types == NULL) { + map->types = _XkbTypedCalloc(nTotalTypes, XkbKeyTypeRec); + if (map->types == NULL) + return BadAlloc; + map->num_types = 0; + map->size_types = nTotalTypes; + } + else if (map->size_types < nTotalTypes) { + XkbKeyTypeRec *prev_types = map->types; + + map->types = + _XkbTypedRealloc(map->types, nTotalTypes, XkbKeyTypeRec); + if (map->types == NULL) { + _XkbFree(prev_types); + map->num_types = map->size_types = 0; + return BadAlloc; + } + map->size_types = nTotalTypes; + bzero(&map->types[map->num_types], + ((map->size_types - map->num_types) * sizeof(XkbKeyTypeRec))); + } + } + if (which & XkbKeySymsMask) { + int nKeys = XkbNumKeys(xkb); + + if (map->syms == NULL) { + map->size_syms = (nKeys * 15) / 10; + map->syms = _XkbTypedCalloc(map->size_syms, KeySym); + if (!map->syms) { + map->size_syms = 0; + return BadAlloc; + } + map->num_syms = 1; + map->syms[0] = NoSymbol; + } + if (map->key_sym_map == NULL) { + i = xkb->max_key_code + 1; + map->key_sym_map = _XkbTypedCalloc(i, XkbSymMapRec); + if (map->key_sym_map == NULL) + return BadAlloc; + } + } + if (which & XkbModifierMapMask) { + if ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code)) + return BadMatch; + if (map->modmap == NULL) { + i = xkb->max_key_code + 1; + map->modmap = _XkbTypedCalloc(i, unsigned char); + if (map->modmap == NULL) + return BadAlloc; + } + } + return Success; +} + +Status +XkbAllocServerMap(XkbDescPtr xkb, unsigned which, unsigned nNewActions) +{ + register int i; + XkbServerMapPtr map; + + if (xkb == NULL) + return BadMatch; + if (xkb->server == NULL) { + map = _XkbTypedCalloc(1, XkbServerMapRec); + if (map == NULL) + return BadAlloc; + for (i = 0; i < XkbNumVirtualMods; i++) { + map->vmods[i] = XkbNoModifierMask; + } + xkb->server = map; + } + else + map = xkb->server; + if (which & XkbExplicitComponentsMask) { + if ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code)) + return BadMatch; + if (map->explicit == NULL) { + i = xkb->max_key_code + 1; + map->explicit = _XkbTypedCalloc(i, unsigned char); + if (map->explicit == NULL) + return BadAlloc; + } + } + if (which & XkbKeyActionsMask) { + if ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code)) + return BadMatch; + if (nNewActions < 1) + nNewActions = 1; + if (map->acts == NULL) { + map->acts = _XkbTypedCalloc((nNewActions + 1), XkbAction); + if (map->acts == NULL) + return BadAlloc; + map->num_acts = 1; + map->size_acts = nNewActions + 1; + } + else if ((map->size_acts - map->num_acts) < nNewActions) { + unsigned need; + XkbAction *prev_acts = map->acts; + + need = map->num_acts + nNewActions; + map->acts = _XkbTypedRealloc(map->acts, need, XkbAction); + if (map->acts == NULL) { + _XkbFree(prev_acts); + map->num_acts = map->size_acts = 0; + return BadAlloc; + } + map->size_acts = need; + bzero(&map->acts[map->num_acts], + ((map->size_acts - map->num_acts) * sizeof(XkbAction))); + } + if (map->key_acts == NULL) { + i = xkb->max_key_code + 1; + map->key_acts = _XkbTypedCalloc(i, unsigned short); + if (map->key_acts == NULL) + return BadAlloc; + } + } + if (which & XkbKeyBehaviorsMask) { + if ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code)) + return BadMatch; + if (map->behaviors == NULL) { + i = xkb->max_key_code + 1; + map->behaviors = _XkbTypedCalloc(i, XkbBehavior); + if (map->behaviors == NULL) + return BadAlloc; + } + } + if (which & XkbVirtualModMapMask) { + if ((!XkbIsLegalKeycode(xkb->min_key_code)) || + (!XkbIsLegalKeycode(xkb->max_key_code)) || + (xkb->max_key_code < xkb->min_key_code)) + return BadMatch; + if (map->vmodmap == NULL) { + i = xkb->max_key_code + 1; + map->vmodmap = _XkbTypedCalloc(i, unsigned short); + if (map->vmodmap == NULL) + return BadAlloc; + } + } + return Success; +} + +/***====================================================================***/ + +Status +XkbCopyKeyType(XkbKeyTypePtr from, XkbKeyTypePtr into) +{ + if ((!from) || (!into)) + return BadMatch; + + _XkbFree(into->map); + into->map = NULL; + + _XkbFree(into->preserve); + into->preserve = NULL; + + _XkbFree(into->level_names); + into->level_names = NULL; + + *into = *from; + if ((from->map) && (into->map_count > 0)) { + into->map = _XkbTypedCalloc(into->map_count, XkbKTMapEntryRec); + if (!into->map) + return BadAlloc; + memcpy(into->map, from->map, + into->map_count * sizeof(XkbKTMapEntryRec)); + } + if ((from->preserve) && (into->map_count > 0)) { + into->preserve = _XkbTypedCalloc(into->map_count, XkbModsRec); + if (!into->preserve) + return BadAlloc; + memcpy(into->preserve, from->preserve, + into->map_count * sizeof(XkbModsRec)); + } + if ((from->level_names) && (into->num_levels > 0)) { + into->level_names = _XkbTypedCalloc(into->num_levels, Atom); + if (!into->level_names) + return BadAlloc; + memcpy(into->level_names, from->level_names, + into->num_levels * sizeof(Atom)); + } + return Success; +} + +Status +XkbCopyKeyTypes(XkbKeyTypePtr from, XkbKeyTypePtr into, int num_types) +{ + register int i, rtrn; + + if ((!from) || (!into) || (num_types < 0)) + return BadMatch; + for (i = 0; i < num_types; i++) { + if ((rtrn = XkbCopyKeyType(from++, into++)) != Success) + return rtrn; + } + return Success; +} + +XkbKeyTypePtr +XkbAddKeyType(XkbDescPtr xkb, + Atom name, + int map_count, + Bool want_preserve, + int num_lvls) +{ + register int i; + unsigned tmp; + XkbKeyTypePtr type; + XkbClientMapPtr map; + + if ((!xkb) || (num_lvls < 1)) + return NULL; + map = xkb->map; + if ((map) && (map->types)) { + for (i = 0; i < map->num_types; i++) { + if (map->types[i].name == name) { + Status status = + XkbResizeKeyType(xkb, i, map_count, want_preserve, + num_lvls); + return (status == Success ? &map->types[i] : NULL); + } + } + } + if ((!map) || (!map->types) || (map->num_types < XkbNumRequiredTypes)) { + tmp = XkbNumRequiredTypes + 1; + if (XkbAllocClientMap(xkb, XkbKeyTypesMask, tmp) != Success) + return NULL; + if (!map) + map = xkb->map; + tmp = 0; + if (map->num_types <= XkbKeypadIndex) + tmp |= XkbKeypadMask; + if (map->num_types <= XkbAlphabeticIndex) + tmp |= XkbAlphabeticMask; + if (map->num_types <= XkbTwoLevelIndex) + tmp |= XkbTwoLevelMask; + if (map->num_types <= XkbOneLevelIndex) + tmp |= XkbOneLevelMask; + if (XkbInitCanonicalKeyTypes(xkb, tmp, XkbNoModifier) == Success) { + for (i = 0; i < map->num_types; i++) { + Status status; + + if (map->types[i].name != name) + continue; + status = XkbResizeKeyType(xkb, i, map_count, want_preserve, + num_lvls); + return (status == Success ? &map->types[i] : NULL); + } + } + } + if ((map->num_types <= map->size_types) && + (XkbAllocClientMap(xkb, XkbKeyTypesMask, map->num_types + 1) != + Success)) { + return NULL; + } + type = &map->types[map->num_types]; + map->num_types++; + bzero((char *) type, sizeof(XkbKeyTypeRec)); + type->num_levels = num_lvls; + type->map_count = map_count; + type->name = name; + if (map_count > 0) { + type->map = _XkbTypedCalloc(map_count, XkbKTMapEntryRec); + if (!type->map) { + map->num_types--; + return NULL; + } + if (want_preserve) { + type->preserve = _XkbTypedCalloc(map_count, XkbModsRec); + if (!type->preserve) { + _XkbFree(type->map); + map->num_types--; + return NULL; + } + } + } + return type; +} + +Status +XkbResizeKeyType(XkbDescPtr xkb, + int type_ndx, + int map_count, + Bool want_preserve, + int new_num_lvls) +{ + XkbKeyTypePtr type; + KeyCode matchingKeys[XkbMaxKeyCount], nMatchingKeys; + + if ((type_ndx < 0) || (type_ndx >= xkb->map->num_types) || (map_count < 0) + || (new_num_lvls < 1)) + return BadValue; + switch (type_ndx) { + case XkbOneLevelIndex: + if (new_num_lvls != 1) + return BadMatch; + break; + case XkbTwoLevelIndex: + case XkbAlphabeticIndex: + case XkbKeypadIndex: + if (new_num_lvls != 2) + return BadMatch; + break; + } + type = &xkb->map->types[type_ndx]; + if (map_count == 0) { + _XkbFree(type->map); + type->map = NULL; + _XkbFree(type->preserve); + type->preserve = NULL; + type->map_count = 0; + } + else { + XkbKTMapEntryRec *prev_map = type->map; + + if ((map_count > type->map_count) || (type->map == NULL)) + type->map = + _XkbTypedRealloc(type->map, map_count, XkbKTMapEntryRec); + if (!type->map) { + _XkbFree(prev_map); + return BadAlloc; + } + if (want_preserve) { + XkbModsRec *prev_preserve = type->preserve; + + if ((map_count > type->map_count) || (type->preserve == NULL)) { + type->preserve = _XkbTypedRealloc(type->preserve, map_count, + XkbModsRec); + } + if (!type->preserve) { + _XkbFree(prev_preserve); + return BadAlloc; + } + } + else { + _XkbFree(type->preserve); + type->preserve = NULL; + } + type->map_count = map_count; + } + + if ((new_num_lvls > type->num_levels) || (type->level_names == NULL)) { + Atom *prev_level_names = type->level_names; + + type->level_names = + _XkbTypedRealloc(type->level_names, new_num_lvls, Atom); + if (!type->level_names) { + _XkbFree(prev_level_names); + return BadAlloc; + } + } + /* + * Here's the theory: + * If the width of the type changed, we might have to resize the symbol + * maps for any keys that use the type for one or more groups. This is + * expensive, so we'll try to cull out any keys that are obviously okay: + * In any case: + * - keys that have a group width <= the old width are okay (because + * they could not possibly have been associated with the old type) + * If the key type increased in size: + * - keys that already have a group width >= to the new width are okay + * + keys that have a group width >= the old width but < the new width + * might have to be enlarged. + * If the key type decreased in size: + * - keys that have a group width > the old width don't have to be + * resized (because they must have some other wider type associated + * with some group). + * + keys that have a group width == the old width might have to be + * shrunk. + * The possibilities marked with '+' require us to examine the key types + * associated with each group for the key. + */ + bzero(matchingKeys, XkbMaxKeyCount * sizeof(KeyCode)); + nMatchingKeys = 0; + if (new_num_lvls > type->num_levels) { + int nTotal; + KeySym *newSyms; + int width, match, nResize; + register int i, g, nSyms; + + nResize = 0; + for (nTotal = 1, i = xkb->min_key_code; i <= xkb->max_key_code; i++) { + width = XkbKeyGroupsWidth(xkb, i); + if (width < type->num_levels) + continue; + for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1; + (g >= 0) && (!match); g--) { + if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) { + matchingKeys[nMatchingKeys++] = i; + match = 1; + } + } + if ((!match) || (width >= new_num_lvls)) + nTotal += XkbKeyNumSyms(xkb, i); + else { + nTotal += XkbKeyNumGroups(xkb, i) * new_num_lvls; + nResize++; + } + } + if (nResize > 0) { + int nextMatch; + + xkb->map->size_syms = (nTotal * 12) / 10; + newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); + if (newSyms == NULL) + return BadAlloc; + nextMatch = 0; + nSyms = 1; + for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { + if (matchingKeys[nextMatch] == i) { + KeySym *pOld; + + nextMatch++; + width = XkbKeyGroupsWidth(xkb, i); + pOld = XkbKeySymsPtr(xkb, i); + for (g = XkbKeyNumGroups(xkb, i) - 1; g >= 0; g--) { + memcpy(&newSyms[nSyms + (new_num_lvls * g)], + &pOld[width * g], width * sizeof(KeySym)); + } + xkb->map->key_sym_map[i].offset = nSyms; + nSyms += XkbKeyNumGroups(xkb, i) * new_num_lvls; + } + else { + memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), + XkbKeyNumSyms(xkb, i) * sizeof(KeySym)); + xkb->map->key_sym_map[i].offset = nSyms; + nSyms += XkbKeyNumSyms(xkb, i); + } + } + type->num_levels = new_num_lvls; + _XkbFree(xkb->map->syms); + xkb->map->syms = newSyms; + xkb->map->num_syms = nSyms; + return Success; + } + } + else if (new_num_lvls < type->num_levels) { + int width, match; + register int g, i; + + for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { + width = XkbKeyGroupsWidth(xkb, i); + if (width < type->num_levels) + continue; + for (match = 0, g = XkbKeyNumGroups(xkb, i) - 1; + (g >= 0) && (!match); g--) { + if (XkbKeyKeyTypeIndex(xkb, i, g) == type_ndx) { + matchingKeys[nMatchingKeys++] = i; + match = 1; + } + } + } + } + if (nMatchingKeys > 0) { + int key, firstClear; + register int i, g; + + if (new_num_lvls > type->num_levels) + firstClear = type->num_levels; + else + firstClear = new_num_lvls; + for (i = 0; i < nMatchingKeys; i++) { + KeySym *pSyms; + int width, nClear; + + key = matchingKeys[i]; + width = XkbKeyGroupsWidth(xkb, key); + nClear = width - firstClear; + pSyms = XkbKeySymsPtr(xkb, key); + for (g = XkbKeyNumGroups(xkb, key) - 1; g >= 0; g--) { + if (XkbKeyKeyTypeIndex(xkb, key, g) == type_ndx) { + if (nClear > 0) + bzero(&pSyms[g * width + firstClear], + nClear * sizeof(KeySym)); + } + } + } + } + type->num_levels = new_num_lvls; + return Success; +} + +KeySym * +XkbResizeKeySyms(XkbDescPtr xkb, int key, int needed) +{ + register int i, nSyms, nKeySyms; + unsigned nOldSyms; + KeySym *newSyms; + + if (needed == 0) { + xkb->map->key_sym_map[key].offset = 0; + return xkb->map->syms; + } + nOldSyms = XkbKeyNumSyms(xkb, key); + if (nOldSyms >= (unsigned) needed) { + return XkbKeySymsPtr(xkb, key); + } + if (xkb->map->size_syms - xkb->map->num_syms >= (unsigned) needed) { + if (nOldSyms > 0) { + memcpy(&xkb->map->syms[xkb->map->num_syms], XkbKeySymsPtr(xkb, key), + nOldSyms * sizeof(KeySym)); + } + if ((needed - nOldSyms) > 0) { + bzero(&xkb->map->syms[xkb->map->num_syms + XkbKeyNumSyms(xkb, key)], + (needed - nOldSyms) * sizeof(KeySym)); + } + xkb->map->key_sym_map[key].offset = xkb->map->num_syms; + xkb->map->num_syms += needed; + return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; + } + xkb->map->size_syms += (needed > 32 ? needed : 32); + newSyms = _XkbTypedCalloc(xkb->map->size_syms, KeySym); + if (newSyms == NULL) + return NULL; + newSyms[0] = NoSymbol; + nSyms = 1; + for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { + int nCopy; + + nCopy = nKeySyms = XkbKeyNumSyms(xkb, i); + if ((nKeySyms == 0) && (i != key)) + continue; + if (i == key) + nKeySyms = needed; + if (nCopy != 0) + memcpy(&newSyms[nSyms], XkbKeySymsPtr(xkb, i), + nCopy * sizeof(KeySym)); + if (nKeySyms > nCopy) + bzero(&newSyms[nSyms + nCopy], (nKeySyms - nCopy) * sizeof(KeySym)); + xkb->map->key_sym_map[i].offset = nSyms; + nSyms += nKeySyms; + } + _XkbFree(xkb->map->syms); + xkb->map->syms = newSyms; + xkb->map->num_syms = nSyms; + return &xkb->map->syms[xkb->map->key_sym_map[key].offset]; +} + +static unsigned +_ExtendRange(unsigned int old_flags, + unsigned int flag, + KeyCode newKC, + KeyCode *old_min, + unsigned char *old_num) +{ + if ((old_flags & flag) == 0) { + old_flags |= flag; + *old_min = newKC; + *old_num = 1; + } + else { + int last = (*old_min) + (*old_num) - 1; + + if (newKC < *old_min) { + *old_min = newKC; + *old_num = (last - newKC) + 1; + } + else if (newKC > last) { + *old_num = (newKC - (*old_min)) + 1; + } + } + return old_flags; +} + +Status +XkbChangeKeycodeRange(XkbDescPtr xkb, + int minKC, + int maxKC, + XkbChangesPtr changes) +{ + int tmp; + + if ((!xkb) || (minKC < XkbMinLegalKeyCode) || (maxKC > XkbMaxLegalKeyCode)) + return BadValue; + if (minKC > maxKC) + return BadMatch; + if (minKC < xkb->min_key_code) { + if (changes) + changes->map.min_key_code = minKC; + tmp = xkb->min_key_code - minKC; + if (xkb->map) { + if (xkb->map->key_sym_map) { + bzero((char *) &xkb->map->key_sym_map[minKC], + tmp * sizeof(XkbSymMapRec)); + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbKeySymsMask, minKC, + &changes->map.first_key_sym, + &changes->map.num_key_syms); + } + } + if (xkb->map->modmap) { + bzero((char *) &xkb->map->modmap[minKC], tmp); + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbModifierMapMask, minKC, + &changes->map.first_modmap_key, + &changes->map.num_modmap_keys); + } + } + } + if (xkb->server) { + if (xkb->server->behaviors) { + bzero((char *) &xkb->server->behaviors[minKC], + tmp * sizeof(XkbBehavior)); + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbKeyBehaviorsMask, minKC, + &changes->map.first_key_behavior, + &changes->map.num_key_behaviors); + } + } + if (xkb->server->key_acts) { + bzero((char *) &xkb->server->key_acts[minKC], + tmp * sizeof(unsigned short)); + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbKeyActionsMask, minKC, + &changes->map.first_key_act, + &changes->map.num_key_acts); + } + } + if (xkb->server->vmodmap) { + bzero((char *) &xkb->server->vmodmap[minKC], + tmp * sizeof(unsigned short)); + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbVirtualModMapMask, minKC, + &changes->map.first_modmap_key, + &changes->map.num_vmodmap_keys); + } + } + } + if ((xkb->names) && (xkb->names->keys)) { + bzero((char *) &xkb->names->keys[minKC], + tmp * sizeof(XkbKeyNameRec)); + if (changes) { + changes->names.changed = _ExtendRange(changes->names.changed, + XkbKeyNamesMask, minKC, + &changes->names.first_key, + &changes->names.num_keys); + } + } + xkb->min_key_code = minKC; + } + if (maxKC > xkb->max_key_code) { + if (changes) + changes->map.max_key_code = maxKC; + tmp = maxKC - xkb->max_key_code; + if (xkb->map) { + if (xkb->map->key_sym_map) { + XkbSymMapRec *prev_key_sym_map = xkb->map->key_sym_map; + + xkb->map->key_sym_map = _XkbTypedRealloc(xkb->map->key_sym_map, + (maxKC + 1), XkbSymMapRec); + if (!xkb->map->key_sym_map) { + _XkbFree(prev_key_sym_map); + return BadAlloc; + } +#ifdef NXAGENT_SERVER + bzero((char *) &xkb->map->key_sym_map[xkb->max_key_code + 1], + tmp * sizeof(XkbSymMapRec)); +#else + bzero((char *) &xkb->map->key_sym_map[xkb->max_key_code], + tmp * sizeof(XkbSymMapRec)); +#endif + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbKeySymsMask, maxKC, + &changes->map.first_key_sym, + &changes->map.num_key_syms); + } + } + if (xkb->map->modmap) { + unsigned char *prev_modmap = xkb->map->modmap; + + xkb->map->modmap = _XkbTypedRealloc(xkb->map->modmap, + (maxKC + 1), unsigned char); + if (!xkb->map->modmap) { + _XkbFree(prev_modmap); + return BadAlloc; + } +#ifdef NXAGENT_SERVER + bzero((char *) &xkb->map->modmap[xkb->max_key_code + 1], tmp); +#else + bzero((char *) &xkb->map->modmap[xkb->max_key_code], tmp); +#endif + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbModifierMapMask, maxKC, + &changes->map.first_modmap_key, + &changes->map.num_modmap_keys); + } + } + } + if (xkb->server) { + if (xkb->server->behaviors) { + XkbBehavior *prev_behaviors = xkb->server->behaviors; + + xkb->server->behaviors = + _XkbTypedRealloc(xkb->server->behaviors, (maxKC + 1), + XkbBehavior); + if (!xkb->server->behaviors) { + _XkbFree(prev_behaviors); + return BadAlloc; + } +#ifdef NXAGENT_SERVER + bzero((char *) &xkb->server->behaviors[xkb->max_key_code + 1], + tmp * sizeof(XkbBehavior)); +#else + bzero((char *) &xkb->server->behaviors[xkb->max_key_code], + tmp * sizeof(XkbBehavior)); +#endif + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbKeyBehaviorsMask, maxKC, + &changes->map.first_key_behavior, + &changes->map.num_key_behaviors); + } + } + if (xkb->server->key_acts) { + unsigned short *prev_key_acts = xkb->server->key_acts; + + xkb->server->key_acts = _XkbTypedRealloc(xkb->server->key_acts, + (maxKC + 1), unsigned short); + if (!xkb->server->key_acts) { + _XkbFree(prev_key_acts); + return BadAlloc; + } +#ifdef NXAGENT_SERVER + bzero((char *) &xkb->server->key_acts[xkb->max_key_code + 1], + tmp * sizeof(unsigned short)); +#else + bzero((char *) &xkb->server->key_acts[xkb->max_key_code], + tmp * sizeof(unsigned short)); +#endif + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbKeyActionsMask, maxKC, + &changes->map.first_key_act, + &changes->map.num_key_acts); + } + } + if (xkb->server->vmodmap) { + unsigned short *prev_vmodmap = xkb->server->vmodmap; + + xkb->server->vmodmap = _XkbTypedRealloc(xkb->server->vmodmap, + (maxKC + 1), unsigned short); + if (!xkb->server->vmodmap) { + _XkbFree(prev_vmodmap); + return BadAlloc; + } +#ifdef NXAGENT_SERVER + bzero((char *) &xkb->server->vmodmap[xkb->max_key_code + 1], + tmp * sizeof(unsigned short)); +#else + bzero((char *) &xkb->server->vmodmap[xkb->max_key_code], + tmp * sizeof(unsigned short)); +#endif + if (changes) { + changes->map.changed = _ExtendRange(changes->map.changed, + XkbVirtualModMapMask, maxKC, + &changes->map.first_modmap_key, + &changes->map.num_vmodmap_keys); + } + } + } + if ((xkb->names) && (xkb->names->keys)) { + XkbKeyNameRec *prev_keys = xkb->names->keys; + + xkb->names->keys = _XkbTypedRealloc(xkb->names->keys, + (maxKC + 1), XkbKeyNameRec); + if (!xkb->names->keys) { + _XkbFree(prev_keys); + return BadAlloc; + } +#ifdef NXAGENT_SERVER + bzero((char *) &xkb->names->keys[xkb->max_key_code + 1], + tmp * sizeof(XkbKeyNameRec)); +#else + bzero((char *) &xkb->names->keys[xkb->max_key_code], + tmp * sizeof(XkbKeyNameRec)); +#endif + if (changes) { + changes->names.changed = _ExtendRange(changes->names.changed, + XkbKeyNamesMask, maxKC, + &changes->names.first_key, + &changes->names.num_keys); + } + } + xkb->max_key_code = maxKC; + } + return Success; +} + +XkbAction * +XkbResizeKeyActions(XkbDescPtr xkb, int key, int needed) +{ + register int i, nActs; + XkbAction *newActs; + + if (needed == 0) { + xkb->server->key_acts[key] = 0; + return NULL; + } + if (XkbKeyHasActions(xkb, key) && + (XkbKeyNumSyms(xkb, key) >= (unsigned) needed)) + return XkbKeyActionsPtr(xkb, key); + if (xkb->server->size_acts - xkb->server->num_acts >= (unsigned) needed) { + xkb->server->key_acts[key] = xkb->server->num_acts; + xkb->server->num_acts += needed; + return &xkb->server->acts[xkb->server->key_acts[key]]; + } + xkb->server->size_acts = xkb->server->num_acts + needed + 8; + newActs = _XkbTypedCalloc(xkb->server->size_acts, XkbAction); + if (newActs == NULL) + return NULL; + newActs[0].type = XkbSA_NoAction; + nActs = 1; + for (i = xkb->min_key_code; i <= (int) xkb->max_key_code; i++) { + int nKeyActs, nCopy; + + if ((xkb->server->key_acts[i] == 0) && (i != key)) + continue; + + nCopy = nKeyActs = XkbKeyNumActions(xkb, i); + if (i == key) { + nKeyActs = needed; + if (needed < nCopy) + nCopy = needed; + } + + if (nCopy > 0) + memcpy(&newActs[nActs], XkbKeyActionsPtr(xkb, i), + nCopy * sizeof(XkbAction)); + if (nCopy < nKeyActs) + bzero(&newActs[nActs + nCopy], + (nKeyActs - nCopy) * sizeof(XkbAction)); + xkb->server->key_acts[i] = nActs; + nActs += nKeyActs; + } + _XkbFree(xkb->server->acts); + xkb->server->acts = newActs; + xkb->server->num_acts = nActs; + return &xkb->server->acts[xkb->server->key_acts[key]]; +} + +void +XkbFreeClientMap(XkbDescPtr xkb, unsigned what, Bool freeMap) +{ + XkbClientMapPtr map; + + if ((xkb == NULL) || (xkb->map == NULL)) + return; + if (freeMap) + what = XkbAllClientInfoMask; + map = xkb->map; + if (what & XkbKeyTypesMask) { + if (map->types != NULL) { + if (map->num_types > 0) { + register int i; + XkbKeyTypePtr type; + + for (i = 0, type = map->types; i < map->num_types; i++, type++) { + _XkbFree(type->map); + type->map = NULL; + + _XkbFree(type->preserve); + type->preserve = NULL; + + type->map_count = 0; + + _XkbFree(type->level_names); + type->level_names = NULL; + } + } + _XkbFree(map->types); + map->num_types = map->size_types = 0; + map->types = NULL; + } + } + if (what & XkbKeySymsMask) { + _XkbFree(map->key_sym_map); + map->key_sym_map = NULL; + + _XkbFree(map->syms); + map->size_syms = map->num_syms = 0; + map->syms = NULL; + } + if (what & XkbModifierMapMask) { + _XkbFree(map->modmap); + map->modmap = NULL; + } + if (freeMap) { + _XkbFree(xkb->map); + xkb->map = NULL; + } + return; +} + +void +XkbFreeServerMap(XkbDescPtr xkb, unsigned what, Bool freeMap) +{ + XkbServerMapPtr map; + + if ((xkb == NULL) || (xkb->server == NULL)) + return; + if (freeMap) + what = XkbAllServerInfoMask; + map = xkb->server; + if (what & XkbExplicitComponentsMask) { + _XkbFree(map->explicit); + map->explicit = NULL; + } + if (what & XkbKeyActionsMask) { + _XkbFree(map->key_acts); + map->key_acts = NULL; + + _XkbFree(map->acts); + map->num_acts = map->size_acts = 0; + map->acts = NULL; + } + if (what & XkbKeyBehaviorsMask) { + _XkbFree(map->behaviors); + map->behaviors = NULL; + } + if (what & XkbVirtualModMapMask) { + _XkbFree(map->vmodmap); + map->vmodmap = NULL; + } + + if (freeMap) { + _XkbFree(xkb->server); + xkb->server = NULL; + } + return; +} diff --git a/nx-X11/lib/src/xkb/XKBMisc.c b/nx-X11/lib/src/xkb/XKBMisc.c new file mode 100644 index 000000000..ab48b6124 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBMisc.c @@ -0,0 +1,1021 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif + + +#include +#include "Xlibint.h" +#include +#include +#include "XKBlibint.h" + + +/***====================================================================***/ + +#define mapSize(m) (sizeof(m)/sizeof(XkbKTMapEntryRec)) +static XkbKTMapEntryRec map2Level[] = { + { True, ShiftMask, {1, ShiftMask, 0} } +}; + +static XkbKTMapEntryRec mapAlpha[] = { + { True, ShiftMask, {1, ShiftMask, 0} }, + { True, LockMask, {0, LockMask, 0} } +}; + +static XkbModsRec preAlpha[] = { + { 0, 0, 0 }, + { LockMask, LockMask, 0 } +}; + +#define NL_VMOD_MASK 0 +static XkbKTMapEntryRec mapKeypad[] = { + { True, ShiftMask, { 1, ShiftMask, 0 } }, + { False, 0, { 1, 0, NL_VMOD_MASK } } +}; + +static XkbKeyTypeRec canonicalTypes[XkbNumRequiredTypes] = { + { { 0, 0, 0 }, + 1, /* num_levels */ + 0, /* map_count */ + NULL, NULL, + None, NULL + }, + { { ShiftMask, ShiftMask, 0 }, + 2, /* num_levels */ + mapSize(map2Level), /* map_count */ + map2Level, NULL, + None, NULL + }, + { { ShiftMask|LockMask, ShiftMask|LockMask, 0 }, + 2, /* num_levels */ + mapSize(mapAlpha), /* map_count */ + mapAlpha, preAlpha, + None, NULL + }, + { { ShiftMask, ShiftMask, NL_VMOD_MASK }, + 2, /* num_levels */ + mapSize(mapKeypad), /* map_count */ + mapKeypad, NULL, + None, NULL + } +}; + +Status +XkbInitCanonicalKeyTypes(XkbDescPtr xkb, unsigned which, int keypadVMod) +{ + XkbClientMapPtr map; + XkbKeyTypePtr from, to; + Status rtrn; + + if (!xkb) + return BadMatch; + rtrn = XkbAllocClientMap(xkb, XkbKeyTypesMask, XkbNumRequiredTypes); + if (rtrn != Success) + return rtrn; + map = xkb->map; + if ((which & XkbAllRequiredTypes) == 0) + return Success; + rtrn = Success; + from = canonicalTypes; + to = map->types; + if (which & XkbOneLevelMask) + rtrn = XkbCopyKeyType(&from[XkbOneLevelIndex], &to[XkbOneLevelIndex]); + if ((which & XkbTwoLevelMask) && (rtrn == Success)) + rtrn = XkbCopyKeyType(&from[XkbTwoLevelIndex], &to[XkbTwoLevelIndex]); + if ((which & XkbAlphabeticMask) && (rtrn == Success)) + rtrn = + XkbCopyKeyType(&from[XkbAlphabeticIndex], &to[XkbAlphabeticIndex]); + if ((which & XkbKeypadMask) && (rtrn == Success)) { + XkbKeyTypePtr type; + + rtrn = XkbCopyKeyType(&from[XkbKeypadIndex], &to[XkbKeypadIndex]); + type = &to[XkbKeypadIndex]; + if ((keypadVMod >= 0) && (keypadVMod < XkbNumVirtualMods) && + (rtrn == Success)) { + type->mods.vmods = (1 << keypadVMod); + type->map[0].active = True; + type->map[0].mods.mask = ShiftMask; + type->map[0].mods.real_mods = ShiftMask; + type->map[0].mods.vmods = 0; + type->map[0].level = 1; + type->map[1].active = False; + type->map[1].mods.mask = 0; + type->map[1].mods.real_mods = 0; + type->map[1].mods.vmods = (1 << keypadVMod); + type->map[1].level = 1; + } + } + return Success; +} + +/***====================================================================***/ + +#define CORE_SYM(i) (imap->num_types)) { + nSyms[i] = xkb->map->types[types_inout[i]].num_levels; + if (nSyms[i] > groupsWidth) + groupsWidth = nSyms[i]; + } + else { + types_inout[i] = XkbTwoLevelIndex; /* don't really know, yet */ + nSyms[i] = 2; + } + } + if (nSyms[XkbGroup1Index] < 2) + nSyms[XkbGroup1Index] = 2; + if (nSyms[XkbGroup2Index] < 2) + nSyms[XkbGroup2Index] = 2; + /* Step 2: Copy the symbols from the core ordering to XKB ordering */ + /* symbols in the core are in the order: */ + /* G1L1 G1L2 G2L1 G2L2 [G1L[3-n]] [G2L[3-n]] [G3L*] [G3L*] */ + xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 0)] = CORE_SYM(0); + xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, 1)] = CORE_SYM(1); + for (i = 2; i < nSyms[XkbGroup1Index]; i++) { + xkb_syms_rtrn[XKB_OFFSET(XkbGroup1Index, i)] = CORE_SYM(2 + i); + } + xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 0)] = CORE_SYM(2); + xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, 1)] = CORE_SYM(3); + tmp = 2 + (nSyms[XkbGroup1Index] - 2); /* offset to extra group2 syms */ + for (i = 2; i < nSyms[XkbGroup2Index]; i++) { + xkb_syms_rtrn[XKB_OFFSET(XkbGroup2Index, i)] = CORE_SYM(tmp + i); + } + tmp = nSyms[XkbGroup1Index] + nSyms[XkbGroup2Index]; + if ((tmp >= map_width) && + ((protected & (XkbExplicitKeyType3Mask | XkbExplicitKeyType4Mask)) == + 0)) { + nSyms[XkbGroup3Index] = 0; + nSyms[XkbGroup4Index] = 0; + nGroups = 2; + } + else { + nGroups = 3; + for (i = 0; i < nSyms[XkbGroup3Index]; i++, tmp++) { + xkb_syms_rtrn[XKB_OFFSET(XkbGroup3Index, i)] = CORE_SYM(tmp); + } + if ((tmp < map_width) || (protected & XkbExplicitKeyType4Mask)) { + nGroups = 4; + for (i = 0; i < nSyms[XkbGroup4Index]; i++, tmp++) { + xkb_syms_rtrn[XKB_OFFSET(XkbGroup4Index, i)] = CORE_SYM(tmp); + } + } + else { + nSyms[XkbGroup4Index] = 0; + } + } + /* steps 3&4: alphanumeric expansion, assign canonical types */ + empty = 0; + for (i = 0; i < nGroups; i++) { + KeySym *syms; + + syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)]; + if ((nSyms[i] > 1) && (syms[1] == NoSymbol) && (syms[0] != NoSymbol)) { + KeySym upper, lower; + + XConvertCase(syms[0], &lower, &upper); + if (upper != lower) { + xkb_syms_rtrn[XKB_OFFSET(i, 0)] = lower; + xkb_syms_rtrn[XKB_OFFSET(i, 1)] = upper; + if ((protected & (1 << i)) == 0) + types_inout[i] = XkbAlphabeticIndex; + } + else if ((protected & (1 << i)) == 0) { + types_inout[i] = XkbOneLevelIndex; + /* nSyms[i]= 1; */ + } + } + if (((protected & (1 << i)) == 0) && + (types_inout[i] == XkbTwoLevelIndex)) { + if (IsKeypadKey(syms[0]) || IsKeypadKey(syms[1])) + types_inout[i] = XkbKeypadIndex; + else { + KeySym upper, lower; + + XConvertCase(syms[0], &lower, &upper); + if ((syms[0] == lower) && (syms[1] == upper)) + types_inout[i] = XkbAlphabeticIndex; + } + } + if (syms[0] == NoSymbol) { + register int n; + Bool found; + + for (n = 1, found = False; (!found) && (n < nSyms[i]); n++) { + found = (syms[n] != NoSymbol); + } + if (!found) + empty |= (1 << i); + } + } + /* step 5: squoosh out empty groups */ + if (empty) { + for (i = nGroups - 1; i >= 0; i--) { + if (((empty & (1 << i)) == 0) || (protected & (1 << i))) + break; + nGroups--; + } + } + if (nGroups < 1) + return 0; + + /* step 6: replicate group 1 into group two, if necessary */ + if ((nGroups > 1) && + ((empty & (XkbGroup1Mask | XkbGroup2Mask)) == XkbGroup2Mask)) { + if ((protected & (XkbExplicitKeyType1Mask | XkbExplicitKeyType2Mask)) == + 0) { + nSyms[XkbGroup2Index] = nSyms[XkbGroup1Index]; + types_inout[XkbGroup2Index] = types_inout[XkbGroup1Index]; + memcpy((char *) &xkb_syms_rtrn[2], (char *) xkb_syms_rtrn, + 2 * sizeof(KeySym)); + } + else if (types_inout[XkbGroup1Index] == types_inout[XkbGroup2Index]) { + memcpy((char *) &xkb_syms_rtrn[nSyms[XkbGroup1Index]], + (char *) xkb_syms_rtrn, + nSyms[XkbGroup1Index] * sizeof(KeySym)); + } + } + + /* step 7: check for all groups identical or all width 1 */ + if (nGroups > 1) { + Bool sameType, allOneLevel; + + allOneLevel = (xkb->map->types[types_inout[0]].num_levels == 1); + for (i = 1, sameType = True; (allOneLevel || sameType) && (i < nGroups); + i++) { + sameType = (sameType && + (types_inout[i] == types_inout[XkbGroup1Index])); + if (allOneLevel) + allOneLevel = (xkb->map->types[types_inout[i]].num_levels == 1); + } + if ((sameType) && + (!(protected & + (XkbExplicitKeyTypesMask & ~XkbExplicitKeyType1Mask)))) { + register int s; + Bool identical; + + for (i = 1, identical = True; identical && (i < nGroups); i++) { + KeySym *syms; + + syms = &xkb_syms_rtrn[XKB_OFFSET(i, 0)]; + for (s = 0; identical && (s < nSyms[i]); s++) { + if (syms[s] != xkb_syms_rtrn[s]) + identical = False; + } + } + if (identical) + nGroups = 1; + } + if (allOneLevel && (nGroups > 1)) { + KeySym *syms; + + syms = &xkb_syms_rtrn[nSyms[XkbGroup1Index]]; + nSyms[XkbGroup1Index] = 1; + for (i = 1; i < nGroups; i++) { + xkb_syms_rtrn[i] = syms[0]; + syms += nSyms[i]; + nSyms[i] = 1; + } + } + } + return nGroups; +} + +static XkbSymInterpretPtr +_XkbFindMatchingInterp(XkbDescPtr xkb, + KeySym sym, + unsigned int real_mods, + unsigned int level) +{ + register unsigned i; + XkbSymInterpretPtr interp, rtrn; + CARD8 mods; + + rtrn = NULL; + interp = xkb->compat->sym_interpret; + for (i = 0; i < xkb->compat->num_si; i++, interp++) { + if ((interp->sym == NoSymbol) || (sym == interp->sym)) { + int match; + + if ((level == 0) || ((interp->match & XkbSI_LevelOneOnly) == 0)) + mods = real_mods; + else + mods = 0; + switch (interp->match & XkbSI_OpMask) { + case XkbSI_NoneOf: + match = ((interp->mods & mods) == 0); + break; + case XkbSI_AnyOfOrNone: + match = ((mods == 0) || ((interp->mods & mods) != 0)); + break; + case XkbSI_AnyOf: + match = ((interp->mods & mods) != 0); + break; + case XkbSI_AllOf: + match = ((interp->mods & mods) == interp->mods); + break; + case XkbSI_Exactly: + match = (interp->mods == mods); + break; + default: + match = 0; + break; + } + if (match) { + if (interp->sym != NoSymbol) { + return interp; + } + else if (rtrn == NULL) { + rtrn = interp; + } + } + } + } + return rtrn; +} + +static void +_XkbAddKeyChange(KeyCode *pFirst, unsigned char *pNum, KeyCode newKey) +{ + KeyCode last; + + last = (*pFirst) + (*pNum); + if (newKey < *pFirst) { + *pFirst = newKey; + *pNum = (last - newKey) + 1; + } + else if (newKey > last) { + *pNum = (last - *pFirst) + 1; + } + return; +} + +static void +_XkbSetActionKeyMods(XkbDescPtr xkb, XkbAction *act, unsigned mods) +{ + unsigned tmp; + + switch (act->type) { + case XkbSA_SetMods: + case XkbSA_LatchMods: + case XkbSA_LockMods: + if (act->mods.flags & XkbSA_UseModMapMods) + act->mods.real_mods = act->mods.mask = mods; + if ((tmp = XkbModActionVMods(&act->mods)) != 0) { + XkbVirtualModsToReal(xkb, tmp, &tmp); + act->mods.mask |= tmp; + } + break; + case XkbSA_ISOLock: + if (act->iso.flags & XkbSA_UseModMapMods) + act->iso.real_mods = act->iso.mask = mods; + if ((tmp = XkbModActionVMods(&act->iso)) != 0) { + XkbVirtualModsToReal(xkb, tmp, &tmp); + act->iso.mask |= tmp; + } + break; + } + return; +} + +#define IBUF_SIZE 8 + +Bool +XkbApplyCompatMapToKey(XkbDescPtr xkb, KeyCode key, XkbChangesPtr changes) +{ + KeySym *syms; + unsigned char explicit, mods; + XkbSymInterpretPtr *interps, ibuf[IBUF_SIZE]; + int n, nSyms, found; + unsigned changed, tmp; + + if ((!xkb) || (!xkb->map) || (!xkb->map->key_sym_map) || + (!xkb->compat) || (!xkb->compat->sym_interpret) || + (key < xkb->min_key_code) || (key > xkb->max_key_code)) { + return False; + } + if (((!xkb->server) || (!xkb->server->key_acts)) && + (XkbAllocServerMap(xkb, XkbAllServerInfoMask, 0) != Success)) { + return False; + } + changed = 0; /* keeps track of what has changed in _this_ call */ + explicit = xkb->server->explicit[key]; + if (explicit & XkbExplicitInterpretMask) /* nothing to do */ + return True; + mods = (xkb->map->modmap ? xkb->map->modmap[key] : 0); + nSyms = XkbKeyNumSyms(xkb, key); + syms = XkbKeySymsPtr(xkb, key); + if (nSyms > IBUF_SIZE) { + interps = _XkbTypedCalloc(nSyms, XkbSymInterpretPtr); + if (interps == NULL) { + interps = ibuf; + nSyms = IBUF_SIZE; + } + } + else { + interps = ibuf; + } + found = 0; + for (n = 0; n < nSyms; n++) { + unsigned level = (n % XkbKeyGroupsWidth(xkb, key)); + + interps[n] = NULL; + if (syms[n] != NoSymbol) { + interps[n] = _XkbFindMatchingInterp(xkb, syms[n], mods, level); + if (interps[n] && interps[n]->act.type != XkbSA_NoAction) + found++; + else + interps[n] = NULL; + } + } + /* 1/28/96 (ef) -- XXX! WORKING HERE */ + if (!found) { + if (xkb->server->key_acts[key] != 0) { + xkb->server->key_acts[key] = 0; + changed |= XkbKeyActionsMask; + } + } + else { + XkbAction *pActs; + unsigned int new_vmodmask; + + changed |= XkbKeyActionsMask; + pActs = XkbResizeKeyActions(xkb, key, nSyms); + if (!pActs) { + if (nSyms > IBUF_SIZE) + Xfree(interps); + return False; + } + new_vmodmask = 0; + for (n = 0; n < nSyms; n++) { + if (interps[n]) { + unsigned effMods; + + pActs[n] = *((XkbAction *) &interps[n]->act); + if ((n == 0) || ((interps[n]->match & XkbSI_LevelOneOnly) == 0)) { + effMods = mods; + if (interps[n]->virtual_mod != XkbNoModifier) + new_vmodmask |= (1 << interps[n]->virtual_mod); + } + else + effMods = 0; + _XkbSetActionKeyMods(xkb, &pActs[n], effMods); + } + else + pActs[n].type = XkbSA_NoAction; + } + if (((explicit & XkbExplicitVModMapMask) == 0) && + (xkb->server->vmodmap[key] != new_vmodmask)) { + changed |= XkbVirtualModMapMask; + xkb->server->vmodmap[key] = new_vmodmask; + } + if (interps[0]) { + if ((interps[0]->flags & XkbSI_LockingKey) && + ((explicit & XkbExplicitBehaviorMask) == 0)) { + xkb->server->behaviors[key].type = XkbKB_Lock; + changed |= XkbKeyBehaviorsMask; + } + if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) { + CARD8 old; + + old = xkb->ctrls->per_key_repeat[key / 8]; + if (interps[0]->flags & XkbSI_AutoRepeat) + xkb->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8)); + else + xkb->ctrls->per_key_repeat[key / 8] &= ~(1 << (key % 8)); + if (changes && (old != xkb->ctrls->per_key_repeat[key / 8])) + changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask; + } + } + } + if ((!found) || (interps[0] == NULL)) { + if (((explicit & XkbExplicitAutoRepeatMask) == 0) && (xkb->ctrls)) { + CARD8 old; + + old = xkb->ctrls->per_key_repeat[key / 8]; +#ifdef RETURN_SHOULD_REPEAT + if (*XkbKeySymsPtr(xkb, key) != XK_Return) +#endif + xkb->ctrls->per_key_repeat[key / 8] |= (1 << (key % 8)); + if (changes && (old != xkb->ctrls->per_key_repeat[key / 8])) + changes->ctrls.changed_ctrls |= XkbPerKeyRepeatMask; + } + if (((explicit & XkbExplicitBehaviorMask) == 0) && + (xkb->server->behaviors[key].type == XkbKB_Lock)) { + xkb->server->behaviors[key].type = XkbKB_Default; + changed |= XkbKeyBehaviorsMask; + } + } + if (changes) { + XkbMapChangesPtr mc; + + mc = &changes->map; + tmp = (changed & mc->changed); + if (tmp & XkbKeyActionsMask) + _XkbAddKeyChange(&mc->first_key_act, &mc->num_key_acts, key); + else if (changed & XkbKeyActionsMask) { + mc->changed |= XkbKeyActionsMask; + mc->first_key_act = key; + mc->num_key_acts = 1; + } + if (tmp & XkbKeyBehaviorsMask) { + _XkbAddKeyChange(&mc->first_key_behavior, &mc->num_key_behaviors, + key); + } + else if (changed & XkbKeyBehaviorsMask) { + mc->changed |= XkbKeyBehaviorsMask; + mc->first_key_behavior = key; + mc->num_key_behaviors = 1; + } + if (tmp & XkbVirtualModMapMask) + _XkbAddKeyChange(&mc->first_vmodmap_key, &mc->num_vmodmap_keys, + key); + else if (changed & XkbVirtualModMapMask) { + mc->changed |= XkbVirtualModMapMask; + mc->first_vmodmap_key = key; + mc->num_vmodmap_keys = 1; + } + mc->changed |= changed; + } + if (interps != ibuf) + _XkbFree(interps); + return True; +} + +Bool +XkbUpdateMapFromCore(XkbDescPtr xkb, + KeyCode first_key, + int num_keys, + int map_width, + KeySym *core_keysyms, + XkbChangesPtr changes) +{ + register int key, last_key; + KeySym *syms; + + syms = &core_keysyms[(first_key - xkb->min_key_code) * map_width]; + if (changes) { + if (changes->map.changed & XkbKeySymsMask) { + _XkbAddKeyChange(&changes->map.first_key_sym, + &changes->map.num_key_syms, first_key); + if (num_keys > 1) { + _XkbAddKeyChange(&changes->map.first_key_sym, + &changes->map.num_key_syms, + first_key + num_keys - 1); + } + } + else { + changes->map.changed |= XkbKeySymsMask; + changes->map.first_key_sym = first_key; + changes->map.num_key_syms = num_keys; + } + } + last_key = first_key + num_keys - 1; + for (key = first_key; key <= last_key; key++, syms += map_width) { + XkbMapChangesPtr mc; + unsigned explicit; + KeySym tsyms[XkbMaxSymsPerKey]; + int types[XkbNumKbdGroups]; + int nG; + + explicit = xkb->server->explicit[key] & XkbExplicitKeyTypesMask; + types[XkbGroup1Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index); + types[XkbGroup2Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup2Index); + types[XkbGroup3Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup3Index); + types[XkbGroup4Index] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup4Index); + nG = XkbKeyTypesForCoreSymbols(xkb, map_width, syms, explicit, types, + tsyms); + if (changes) + mc = &changes->map; + else + mc = NULL; + XkbChangeTypesOfKey(xkb, key, nG, XkbAllGroupsMask, types, mc); + memcpy((char *) XkbKeySymsPtr(xkb, key), (char *) tsyms, + XkbKeyNumSyms(xkb, key) * sizeof(KeySym)); + XkbApplyCompatMapToKey(xkb, key, changes); + } + + if ((xkb->map->modmap != NULL) && (changes) && + (changes->map.changed & (XkbVirtualModMapMask | XkbModifierMapMask))) { + unsigned char newVMods[XkbNumVirtualMods]; + register unsigned bit, i; + unsigned present; + + bzero(newVMods, XkbNumVirtualMods); + present = 0; + for (key = xkb->min_key_code; key <= xkb->max_key_code; key++) { + if (xkb->server->vmodmap[key] == 0) + continue; + for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (bit & xkb->server->vmodmap[key]) { + present |= bit; + newVMods[i] |= xkb->map->modmap[key]; + } + } + } + for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if ((bit & present) && (newVMods[i] != xkb->server->vmods[i])) { + changes->map.changed |= XkbVirtualModsMask; + changes->map.vmods |= bit; + xkb->server->vmods[i] = newVMods[i]; + } + } + } + if (changes && (changes->map.changed & XkbVirtualModsMask)) + XkbApplyVirtualModChanges(xkb, changes->map.vmods, changes); + return True; +} + +Status +XkbChangeTypesOfKey(XkbDescPtr xkb, + int key, + int nGroups, + unsigned groups, + int *newTypesIn, + XkbMapChangesPtr changes) +{ + XkbKeyTypePtr pOldType, pNewType; + register int i; + int width, nOldGroups, oldWidth, newTypes[XkbNumKbdGroups]; + + if ((!xkb) || (!XkbKeycodeInRange(xkb, key)) || (!xkb->map) || + (!xkb->map->types) || ((groups & XkbAllGroupsMask) == 0) || + (nGroups > XkbNumKbdGroups)) { + return BadMatch; + } + if (nGroups == 0) { + for (i = 0; i < XkbNumKbdGroups; i++) { + xkb->map->key_sym_map[key].kt_index[i] = XkbOneLevelIndex; + } + i = xkb->map->key_sym_map[key].group_info; + i = XkbSetNumGroups(i, 0); + xkb->map->key_sym_map[key].group_info = i; + XkbResizeKeySyms(xkb, key, 0); + return Success; + } + + nOldGroups = XkbKeyNumGroups(xkb, key); + oldWidth = XkbKeyGroupsWidth(xkb, key); + for (width = i = 0; i < nGroups; i++) { + if (groups & (1 << i)) + newTypes[i] = newTypesIn[i]; + else if (i < nOldGroups) + newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, i); + else if (nOldGroups > 0) + newTypes[i] = XkbKeyKeyTypeIndex(xkb, key, XkbGroup1Index); + else + newTypes[i] = XkbTwoLevelIndex; + if (newTypes[i] > xkb->map->num_types) + return BadMatch; + pNewType = &xkb->map->types[newTypes[i]]; + if (pNewType->num_levels > width) + width = pNewType->num_levels; + } + if ((xkb->ctrls) && (nGroups > xkb->ctrls->num_groups)) + xkb->ctrls->num_groups = nGroups; + if ((width != oldWidth) || (nGroups != nOldGroups)) { + KeySym oldSyms[XkbMaxSymsPerKey], *pSyms; + int nCopy; + + if (nOldGroups == 0) { + pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); + if (pSyms != NULL) { + i = xkb->map->key_sym_map[key].group_info; + i = XkbSetNumGroups(i, nGroups); + xkb->map->key_sym_map[key].group_info = i; + xkb->map->key_sym_map[key].width = width; + for (i = 0; i < nGroups; i++) { + xkb->map->key_sym_map[key].kt_index[i] = newTypes[i]; + } + return Success; + } + return BadAlloc; + } + pSyms = XkbKeySymsPtr(xkb, key); + memcpy(oldSyms, pSyms, XkbKeyNumSyms(xkb, key) * sizeof(KeySym)); + pSyms = XkbResizeKeySyms(xkb, key, width * nGroups); + if (pSyms == NULL) + return BadAlloc; + bzero(pSyms, width * nGroups * sizeof(KeySym)); + for (i = 0; (i < nGroups) && (i < nOldGroups); i++) { + pOldType = XkbKeyKeyType(xkb, key, i); + pNewType = &xkb->map->types[newTypes[i]]; + if (pNewType->num_levels > pOldType->num_levels) + nCopy = pOldType->num_levels; + else + nCopy = pNewType->num_levels; + memcpy(&pSyms[i * width], &oldSyms[i * oldWidth], + nCopy * sizeof(KeySym)); + } + if (XkbKeyHasActions(xkb, key)) { + XkbAction oldActs[XkbMaxSymsPerKey], *pActs; + + pActs = XkbKeyActionsPtr(xkb, key); + memcpy(oldActs, pActs, XkbKeyNumSyms(xkb, key) * sizeof(XkbAction)); + pActs = XkbResizeKeyActions(xkb, key, width * nGroups); + if (pActs == NULL) + return BadAlloc; + bzero(pActs, width * nGroups * sizeof(XkbAction)); + for (i = 0; (i < nGroups) && (i < nOldGroups); i++) { + pOldType = XkbKeyKeyType(xkb, key, i); + pNewType = &xkb->map->types[newTypes[i]]; + if (pNewType->num_levels > pOldType->num_levels) + nCopy = pOldType->num_levels; + else + nCopy = pNewType->num_levels; + memcpy(&pActs[i * width], &oldActs[i * oldWidth], + nCopy * sizeof(XkbAction)); + } + } + i = xkb->map->key_sym_map[key].group_info; + i = XkbSetNumGroups(i, nGroups); + xkb->map->key_sym_map[key].group_info = i; + xkb->map->key_sym_map[key].width = width; + } + width = 0; + for (i = 0; i < nGroups; i++) { + xkb->map->key_sym_map[key].kt_index[i] = newTypes[i]; + if (xkb->map->types[newTypes[i]].num_levels > width) + width = xkb->map->types[newTypes[i]].num_levels; + } + xkb->map->key_sym_map[key].width = width; + if (changes != NULL) { + if (changes->changed & XkbKeySymsMask) { + _XkbAddKeyChange(&changes->first_key_sym, &changes->num_key_syms, + key); + } + else { + changes->changed |= XkbKeySymsMask; + changes->first_key_sym = key; + changes->num_key_syms = 1; + } + } + return Success; +} + +/***====================================================================***/ + +Bool +XkbVirtualModsToReal(XkbDescPtr xkb, unsigned virtual_mask, unsigned *mask_rtrn) +{ + register int i, bit; + register unsigned mask; + + if (xkb == NULL) + return False; + if (virtual_mask == 0) { + *mask_rtrn = 0; + return True; + } + if (xkb->server == NULL) + return False; + for (i = mask = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (virtual_mask & bit) + mask |= xkb->server->vmods[i]; + } + *mask_rtrn = mask; + return True; +} + +/***====================================================================***/ + +Bool +XkbUpdateActionVirtualMods(XkbDescPtr xkb, XkbAction *act, unsigned changed) +{ + unsigned int tmp; + + switch (act->type) { + case XkbSA_SetMods: + case XkbSA_LatchMods: + case XkbSA_LockMods: + if (((tmp = XkbModActionVMods(&act->mods)) & changed) != 0) { + XkbVirtualModsToReal(xkb, tmp, &tmp); + act->mods.mask = act->mods.real_mods; + act->mods.mask |= tmp; + return True; + } + break; + case XkbSA_ISOLock: + if ((((tmp = XkbModActionVMods(&act->iso)) != 0) & changed) != 0) { + XkbVirtualModsToReal(xkb, tmp, &tmp); + act->iso.mask = act->iso.real_mods; + act->iso.mask |= tmp; + return True; + } + break; + } + return False; +} + +void +XkbUpdateKeyTypeVirtualMods(XkbDescPtr xkb, + XkbKeyTypePtr type, + unsigned int changed, + XkbChangesPtr changes) +{ + register unsigned int i; + unsigned int mask = 0; + + XkbVirtualModsToReal(xkb, type->mods.vmods, &mask); + type->mods.mask = type->mods.real_mods | mask; + if ((type->map_count > 0) && (type->mods.vmods != 0)) { + XkbKTMapEntryPtr entry; + + for (i = 0, entry = type->map; i < type->map_count; i++, entry++) { + if (entry->mods.vmods != 0) { + XkbVirtualModsToReal(xkb, entry->mods.vmods, &mask); + entry->mods.mask = entry->mods.real_mods | mask; + /* entry is active if vmods are bound */ + entry->active = (mask != 0); + } + else + entry->active = 1; + } + } + if (changes) { + int type_ndx; + + type_ndx = type - xkb->map->types; + if ((type_ndx < 0) || (type_ndx > xkb->map->num_types)) + return; + if (changes->map.changed & XkbKeyTypesMask) { + int last; + + last = changes->map.first_type + changes->map.num_types - 1; + if (type_ndx < changes->map.first_type) { + changes->map.first_type = type_ndx; + changes->map.num_types = (last - type_ndx) + 1; + } + else if (type_ndx > last) { + changes->map.num_types = + (type_ndx - changes->map.first_type) + 1; + } + } + else { + changes->map.changed |= XkbKeyTypesMask; + changes->map.first_type = type_ndx; + changes->map.num_types = 1; + } + } + return; +} + +Bool +XkbApplyVirtualModChanges(XkbDescPtr xkb, + unsigned changed, + XkbChangesPtr changes) +{ + register int i; + unsigned int checkState = 0; + + if ((!xkb) || (!xkb->map) || (changed == 0)) + return False; + for (i = 0; i < xkb->map->num_types; i++) { + if (xkb->map->types[i].mods.vmods & changed) + XkbUpdateKeyTypeVirtualMods(xkb, &xkb->map->types[i], changed, + changes); + } + if (changed & xkb->ctrls->internal.vmods) { + unsigned int newMask = 0; + + XkbVirtualModsToReal(xkb, xkb->ctrls->internal.vmods, &newMask); + newMask |= xkb->ctrls->internal.real_mods; + if (xkb->ctrls->internal.mask != newMask) { + xkb->ctrls->internal.mask = newMask; + if (changes) { + changes->ctrls.changed_ctrls |= XkbInternalModsMask; + checkState = True; + } + } + } + if (changed & xkb->ctrls->ignore_lock.vmods) { + unsigned int newMask = 0; + + XkbVirtualModsToReal(xkb, xkb->ctrls->ignore_lock.vmods, &newMask); + newMask |= xkb->ctrls->ignore_lock.real_mods; + if (xkb->ctrls->ignore_lock.mask != newMask) { + xkb->ctrls->ignore_lock.mask = newMask; + if (changes) { + changes->ctrls.changed_ctrls |= XkbIgnoreLockModsMask; + checkState = True; + } + } + } + if (xkb->indicators != NULL) { + XkbIndicatorMapPtr map; + + map = &xkb->indicators->maps[0]; + for (i = 0; i < XkbNumIndicators; i++, map++) { + if (map->mods.vmods & changed) { + unsigned int newMask = 0; + + XkbVirtualModsToReal(xkb, map->mods.vmods, &newMask); + newMask |= map->mods.real_mods; + if (newMask != map->mods.mask) { + map->mods.mask = newMask; + if (changes) { + changes->indicators.map_changes |= (1 << i); + checkState = True; + } + } + } + } + } + if (xkb->compat != NULL) { + XkbCompatMapPtr compat; + + compat = xkb->compat; + for (i = 0; i < XkbNumKbdGroups; i++) { + unsigned int newMask = 0; + + XkbVirtualModsToReal(xkb, compat->groups[i].vmods, &newMask); + newMask |= compat->groups[i].real_mods; + if (compat->groups[i].mask != newMask) { + compat->groups[i].mask = newMask; + if (changes) { + changes->compat.changed_groups |= (1 << i); + checkState = True; + } + } + } + } + if (xkb->map && xkb->server) { + int highChange = 0, lowChange = -1; + + for (i = xkb->min_key_code; i <= xkb->max_key_code; i++) { + if (XkbKeyHasActions(xkb, i)) { + register XkbAction *pAct; + register int n; + + pAct = XkbKeyActionsPtr(xkb, i); + for (n = XkbKeyNumActions(xkb, i); n > 0; n--, pAct++) { + if ((pAct->type != XkbSA_NoAction) && + XkbUpdateActionVirtualMods(xkb, pAct, changed)) { + if (lowChange < 0) + lowChange = i; + highChange = i; + } + } + } + } + if (changes && (lowChange > 0)) { /* something changed */ + if (changes->map.changed & XkbKeyActionsMask) { + int last; + + if (changes->map.first_key_act < lowChange) + lowChange = changes->map.first_key_act; + last = + changes->map.first_key_act + changes->map.num_key_acts - 1; + if (last > highChange) + highChange = last; + } + changes->map.changed |= XkbKeyActionsMask; + changes->map.first_key_act = lowChange; + changes->map.num_key_acts = (highChange - lowChange) + 1; + } + } + return checkState; +} diff --git a/nx-X11/lib/src/xkb/XKBNames.c b/nx-X11/lib/src/xkb/XKBNames.c new file mode 100644 index 000000000..951fd1da8 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBNames.c @@ -0,0 +1,879 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#define NEED_MAP_READERS +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "XKBlibint.h" + + +static Status +_XkbReadAtoms(XkbReadBufferPtr buf, + Atom *atoms, + int maxAtoms, + CARD32 present) +{ + register int i, bit; + + for (i = 0, bit = 1; (i < maxAtoms) && (present); i++, bit <<= 1) { + if (present & bit) { + if (!_XkbReadBufferCopy32(buf, (long *) &atoms[i], 1)) + return BadLength; + present &= ~bit; + } + } + return Success; +} + +Status +_XkbReadGetNamesReply(Display *dpy, + xkbGetNamesReply *rep, + XkbDescPtr xkb, + int *nread_rtrn) +{ + int i, len; + XkbReadBufferRec buf; + register XkbNamesPtr names; + + if (xkb->device_spec == XkbUseCoreKbd) + xkb->device_spec = rep->deviceID; + + if ((xkb->names == NULL) && + (XkbAllocNames(xkb, rep->which, + rep->nRadioGroups, rep->nKeyAliases) != Success)) { + return BadAlloc; + } + names = xkb->names; + if (rep->length == 0) + return Success; + + if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) + return BadAlloc; + if (nread_rtrn) + *nread_rtrn = (int) rep->length * 4; + + if ((rep->which & XkbKeycodesNameMask) && + (!_XkbReadBufferCopy32(&buf, (long *) &names->keycodes, 1))) + goto BAILOUT; + if ((rep->which & XkbGeometryNameMask) && + (!_XkbReadBufferCopy32(&buf, (long *) &names->geometry, 1))) + goto BAILOUT; + if ((rep->which & XkbSymbolsNameMask) && + (!_XkbReadBufferCopy32(&buf, (long *) &names->symbols, 1))) + goto BAILOUT; + if ((rep->which & XkbPhysSymbolsNameMask) && + (!_XkbReadBufferCopy32(&buf, (long *) &names->phys_symbols, 1))) + goto BAILOUT; + if ((rep->which & XkbTypesNameMask) && + (!_XkbReadBufferCopy32(&buf, (long *) &names->types, 1))) + goto BAILOUT; + if ((rep->which & XkbCompatNameMask) && + (!_XkbReadBufferCopy32(&buf, (long *) &names->compat, 1))) + goto BAILOUT; + + if (rep->which & XkbKeyTypeNamesMask) { + XkbClientMapPtr map = xkb->map; + XkbKeyTypePtr type; + + len = rep->nTypes * 4; + if (map != NULL) { + type = map->types; + for (i = 0; (i < map->num_types) && (i < rep->nTypes); i++, type++) { + if (!_XkbReadBufferCopy32(&buf, (long *) &type->name, 1)) + goto BAILOUT; + len -= 4; + } + } + if ((len > 0) && (!_XkbSkipReadBufferData(&buf, len))) + goto BAILOUT; + } + if (rep->which & XkbKTLevelNamesMask) { + CARD8 *nLevels; + XkbClientMapPtr map = xkb->map; + + nLevels = + (CARD8 *) _XkbGetReadBufferPtr(&buf, XkbPaddedSize(rep->nTypes)); + if (nLevels == NULL) + goto BAILOUT; + if (map != NULL) { + XkbKeyTypePtr type = map->types; + + for (i = 0; i < (int) rep->nTypes; i++, type++) { + if (i >= map->num_types) { + if (!_XkbSkipReadBufferData(&buf, nLevels[i] * 4)) + goto BAILOUT; + continue; + } + if ((nLevels[i] > 0) && (nLevels[i] != type->num_levels)) { + goto BAILOUT; + } + + Xfree(type->level_names); + if (nLevels[i] == 0) { + type->level_names = NULL; + continue; + } + type->level_names = _XkbTypedCalloc(nLevels[i], Atom); + if (type->level_names != NULL) { + if (!_XkbReadBufferCopy32(&buf, (long *) type->level_names, + nLevels[i])) + goto BAILOUT; + } + else { + _XkbSkipReadBufferData(&buf, nLevels[i] * 4); + } + } + } + else { + for (i = 0; i < (int) rep->nTypes; i++) { + _XkbSkipReadBufferData(&buf, nLevels[i] * 4); + } + } + } + if (rep->which & XkbIndicatorNamesMask) { + if (_XkbReadAtoms(&buf, names->indicators, XkbNumIndicators, + rep->indicators) != Success) + goto BAILOUT; + } + if (rep->which & XkbVirtualModNamesMask) { + if (_XkbReadAtoms(&buf, names->vmods, XkbNumVirtualMods, + (CARD32) rep->virtualMods) != Success) + goto BAILOUT; + } + if (rep->which & XkbGroupNamesMask) { + if (_XkbReadAtoms(&buf, names->groups, XkbNumKbdGroups, + (CARD32) rep->groupNames) != Success) + goto BAILOUT; + } + if (rep->which & XkbKeyNamesMask) { + if (names->keys == NULL) { + int nKeys; + + if (xkb->max_key_code == 0) { + xkb->min_key_code = rep->minKeyCode; + xkb->max_key_code = rep->maxKeyCode; + } + nKeys = xkb->max_key_code + 1; + names->keys = _XkbTypedCalloc(nKeys, XkbKeyNameRec); + } + if (((int) rep->firstKey + rep->nKeys) > xkb->max_key_code + 1) + goto BAILOUT; + if (names->keys != NULL) { + if (!_XkbCopyFromReadBuffer(&buf, + (char *) &names->keys[rep->firstKey], + rep->nKeys * XkbKeyNameLength)) + goto BAILOUT; + } + else + _XkbSkipReadBufferData(&buf, rep->nKeys * XkbKeyNameLength); + } + if (rep->which & XkbKeyAliasesMask && (rep->nKeyAliases > 0)) { + if (XkbAllocNames(xkb, XkbKeyAliasesMask, 0, rep->nKeyAliases) != + Success) + goto BAILOUT; + if (!_XkbCopyFromReadBuffer(&buf, (char *) names->key_aliases, + rep->nKeyAliases * XkbKeyNameLength * 2)) + goto BAILOUT; + } + if (rep->which & XkbRGNamesMask) { + if (rep->nRadioGroups > 0) { + Atom *rgNames; + + if (names->radio_groups == NULL) + names->radio_groups = _XkbTypedCalloc(rep->nRadioGroups, Atom); + else if (names->num_rg < rep->nRadioGroups) { + names->radio_groups = _XkbTypedRealloc(names->radio_groups, + rep->nRadioGroups, Atom); + } + rgNames = names->radio_groups; + if (!rgNames) { + goto BAILOUT; + } + if (!_XkbReadBufferCopy32 + (&buf, (long *) rgNames, rep->nRadioGroups)) + goto BAILOUT; + names->num_rg = rep->nRadioGroups; + } + else if (names->num_rg > 0) { + names->num_rg = 0; + Xfree(names->radio_groups); + } + } + len = _XkbFreeReadBuffer(&buf); + if (len != 0) + return BadLength; + else + return Success; + BAILOUT: + _XkbFreeReadBuffer(&buf); + return BadLength; +} + +Status +XkbGetNames(Display *dpy, unsigned which, XkbDescPtr xkb) +{ + register xkbGetNamesReq *req; + xkbGetNamesReply rep; + Status status; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + if (!xkb->names) { + xkb->names = _XkbTypedCalloc(1, XkbNamesRec); + if (!xkb->names) { + UnlockDisplay(dpy); + SyncHandle(); + return BadAlloc; + } + } + GetReq(kbGetNames, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetNames; + req->deviceSpec = xkb->device_spec; + req->which = which; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadImplementation; + } + + status = _XkbReadGetNamesReply(dpy, &rep, xkb, NULL); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +/***====================================================================***/ + +static int +_XkbCountBits(int nBitsMax, unsigned long mask) +{ + register unsigned long y, nBits; + + y = (mask >> 1) & 033333333333; + y = mask - y - ((y >> 1) & 033333333333); + nBits = ((unsigned int) (((y + (y >> 3)) & 030707070707) % 077)); + + /* nBitsMax really means max+1 */ + return (nBits < nBitsMax) ? nBits : (nBitsMax - 1); +} + +static CARD32 +_XkbCountAtoms(Atom *atoms, int maxAtoms, int *count) +{ + register unsigned int i, bit, nAtoms; + register CARD32 atomsPresent; + + for (i = nAtoms = atomsPresent = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) { + if (atoms[i] != None) { + atomsPresent |= bit; + nAtoms++; + } + } + if (count) + *count = nAtoms; + return atomsPresent; +} + +static void +_XkbCopyAtoms(Display *dpy, Atom *atoms, CARD32 mask, int maxAtoms) +{ + register unsigned int i, bit; + + for (i = 0, bit = 1; i < maxAtoms; i++, bit <<= 1) { + if (mask & bit) + Data32(dpy, &atoms[i], 4); + } + return; +} + +Bool +XkbSetNames(Display *dpy, + unsigned int which, + unsigned int firstType, + unsigned int nTypes, + XkbDescPtr xkb) +{ + register xkbSetNamesReq *req; + int nLvlNames = 0; + XkbInfoPtr xkbi; + XkbNamesPtr names; + unsigned firstLvlType, nLvlTypes; + int nVMods, nLEDs, nRG, nKA, nGroups; + int nKeys = 0, firstKey = 0, nAtoms; + CARD32 leds, vmods, groups; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!xkb) || (!xkb->names)) + return False; + firstLvlType = firstType; + nLvlTypes = nTypes; + if (nTypes < 1) + which &= ~(XkbKTLevelNamesMask | XkbKeyTypeNamesMask); + else if (firstType <= XkbLastRequiredType) { + int adjust; + + adjust = XkbLastRequiredType - firstType + 1; + firstType += adjust; + nTypes -= adjust; + if (nTypes < 1) + which &= ~XkbKeyTypeNamesMask; + } + names = xkb->names; + if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) { + register int i; + XkbKeyTypePtr type; + + if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) || + (firstType + nTypes > xkb->map->num_types) || + (firstLvlType + nLvlTypes > xkb->map->num_types)) + return False; + if (which & XkbKTLevelNamesMask) { + type = &xkb->map->types[firstLvlType]; + for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) { + if (type->level_names != NULL) + nLvlNames += type->num_levels; + } + } + } + + nVMods = nLEDs = nRG = nKA = nAtoms = nGroups = 0; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetNames, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetNames; + req->deviceSpec = xkb->device_spec; + req->firstType = firstType; + req->nTypes = nTypes; + req->firstKey = xkb->min_key_code; + req->nKeys = xkb->max_key_code - xkb->min_key_code + 1; + + if (which & XkbKeycodesNameMask) + nAtoms++; + if (which & XkbGeometryNameMask) + nAtoms++; + if (which & XkbSymbolsNameMask) + nAtoms++; + if (which & XkbPhysSymbolsNameMask) + nAtoms++; + if (which & XkbTypesNameMask) + nAtoms++; + if (which & XkbCompatNameMask) + nAtoms++; + if (which & XkbKeyTypeNamesMask) + nAtoms += nTypes; + if (which & XkbKTLevelNamesMask) { + req->firstKTLevel = firstLvlType; + req->nKTLevels = nLvlTypes; + req->length += XkbPaddedSize(nLvlTypes) / 4; /* room for group widths */ + nAtoms += nLvlNames; + } + else + req->firstKTLevel = req->nKTLevels = 0; + + if (which & XkbIndicatorNamesMask) { + req->indicators = leds = + _XkbCountAtoms(names->indicators, XkbNumIndicators, &nLEDs); + if (nLEDs > 0) + nAtoms += nLEDs; + else + which &= ~XkbIndicatorNamesMask; + } + else + req->indicators = leds = 0; + + if (which & XkbVirtualModNamesMask) { + vmods = req->virtualMods = (CARD16) + _XkbCountAtoms(names->vmods, XkbNumVirtualMods, &nVMods); + if (nVMods > 0) + nAtoms += nVMods; + else + which &= ~XkbVirtualModNamesMask; + } + else + vmods = req->virtualMods = 0; + + if (which & XkbGroupNamesMask) { + groups = req->groupNames = (CARD8) + _XkbCountAtoms(names->groups, XkbNumKbdGroups, &nGroups); + if (nGroups > 0) + nAtoms += nGroups; + else + which &= ~XkbGroupNamesMask; + } + else + groups = req->groupNames = 0; + + if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { + firstKey = req->firstKey; + nKeys = req->nKeys; + nAtoms += nKeys; /* technically not atoms, but 4 bytes wide */ + } + else + which &= ~XkbKeyNamesMask; + + if (which & XkbKeyAliasesMask) { + nKA = ((names->key_aliases != NULL) ? names->num_key_aliases : 0); + if (nKA > 0) { + req->nKeyAliases = nKA; + nAtoms += nKA * 2; /* not atoms, but 8 bytes on the wire */ + } + else { + which &= ~XkbKeyAliasesMask; + req->nKeyAliases = 0; + } + } + else + req->nKeyAliases = 0; + + if (which & XkbRGNamesMask) { + nRG = names->num_rg; + if (nRG > 0) + nAtoms += nRG; + else + which &= ~XkbRGNamesMask; + } + + req->which = which; + req->nRadioGroups = nRG; + req->length += (nAtoms * 4) / 4; + + if (which & XkbKeycodesNameMask) + Data32(dpy, (long *) &names->keycodes, 4); + if (which & XkbGeometryNameMask) + Data32(dpy, (long *) &names->geometry, 4); + if (which & XkbSymbolsNameMask) + Data32(dpy, (long *) &names->symbols, 4); + if (which & XkbPhysSymbolsNameMask) + Data32(dpy, (long *) &names->phys_symbols, 4); + if (which & XkbTypesNameMask) + Data32(dpy, (long *) &names->types, 4); + if (which & XkbCompatNameMask) + Data32(dpy, (long *) &names->compat, 4); + if (which & XkbKeyTypeNamesMask) { + register int i; + register XkbKeyTypePtr type; + + type = &xkb->map->types[firstType]; + for (i = 0; i < nTypes; i++, type++) { + Data32(dpy, (long *) &type->name, 4); + } + } + if (which & XkbKTLevelNamesMask) { + XkbKeyTypePtr type; + int i; + char *tmp; + + BufAlloc(char *, tmp, XkbPaddedSize(nLvlTypes)); + type = &xkb->map->types[firstLvlType]; + for (i = 0; i < nLvlTypes; i++, type++) { + *tmp++ = type->num_levels; + } + type = &xkb->map->types[firstLvlType]; + for (i = 0; i < nLvlTypes; i++, type++) { + if (type->level_names != NULL) + Data32(dpy, (long *) type->level_names, type->num_levels * 4); + } + } + if (which & XkbIndicatorNamesMask) + _XkbCopyAtoms(dpy, names->indicators, leds, XkbNumIndicators); + if (which & XkbVirtualModNamesMask) + _XkbCopyAtoms(dpy, names->vmods, vmods, XkbNumVirtualMods); + if (which & XkbGroupNamesMask) + _XkbCopyAtoms(dpy, names->groups, groups, XkbNumKbdGroups); + if (which & XkbKeyNamesMask) { + Data(dpy, (char *) &names->keys[firstKey], nKeys * XkbKeyNameLength); + } + if (which & XkbKeyAliasesMask) { + Data(dpy, (char *) names->key_aliases, nKA * XkbKeyNameLength * 2); + } + if (which & XkbRGNamesMask) { + Data32(dpy, (long *) names->radio_groups, nRG * 4); + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbChangeNames(Display *dpy, XkbDescPtr xkb, XkbNameChangesPtr changes) +{ + register xkbSetNamesReq *req; + int nLvlNames = 0; + XkbInfoPtr xkbi; + XkbNamesPtr names; + unsigned which, firstType, nTypes; + unsigned firstLvlType, nLvlTypes; + int nVMods, nLEDs, nRG, nKA, nGroups; + int nKeys = 0, firstKey = 0, nAtoms; + CARD32 leds = 0, vmods = 0, groups = 0; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!xkb) || (!xkb->names) || (!changes)) + return False; + which = changes->changed; + firstType = changes->first_type; + nTypes = changes->num_types; + firstLvlType = changes->first_lvl; + nLvlTypes = changes->num_lvls; + if (which & XkbKeyTypeNamesMask) { + if (nTypes < 1) + which &= ~XkbKeyTypeNamesMask; + else if (firstType <= XkbLastRequiredType) { + int adjust; + + adjust = XkbLastRequiredType - firstType + 1; + firstType += adjust; + nTypes -= adjust; + if (nTypes < 1) + which &= ~XkbKeyTypeNamesMask; + } + } + else + firstType = nTypes = 0; + + if (which & XkbKTLevelNamesMask) { + if (nLvlTypes < 1) + which &= ~XkbKTLevelNamesMask; + } + else + firstLvlType = nLvlTypes = 0; + + names = xkb->names; + if (which & (XkbKTLevelNamesMask | XkbKeyTypeNamesMask)) { + register int i; + + if ((xkb->map == NULL) || (xkb->map->types == NULL) || (nTypes == 0) || + (firstType + nTypes > xkb->map->num_types) || + (firstLvlType + nLvlTypes > xkb->map->num_types)) + return False; + if (which & XkbKTLevelNamesMask) { + XkbKeyTypePtr type = &xkb->map->types[firstLvlType]; + + for (i = nLvlNames = 0; i < nLvlTypes; i++, type++) { + if (type->level_names != NULL) + nLvlNames += type->num_levels; + } + } + } + + if (changes->num_keys < 1) + which &= ~XkbKeyNamesMask; + if ((which & XkbKeyNamesMask) == 0) + changes->first_key = changes->num_keys = 0; + else if ((changes->first_key < xkb->min_key_code) || + (changes->first_key + changes->num_keys > xkb->max_key_code)) { + return False; + } + + if ((which & XkbVirtualModNamesMask) == 0) + changes->changed_vmods = 0; + else if (changes->changed_vmods == 0) + which &= ~XkbVirtualModNamesMask; + + if ((which & XkbIndicatorNamesMask) == 0) + changes->changed_indicators = 0; + else if (changes->changed_indicators == 0) + which &= ~XkbIndicatorNamesMask; + + if ((which & XkbGroupNamesMask) == 0) + changes->changed_groups = 0; + else if (changes->changed_groups == 0) + which &= ~XkbGroupNamesMask; + + nVMods = nLEDs = nRG = nKA = nAtoms = nGroups = 0; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetNames, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetNames; + req->deviceSpec = xkb->device_spec; + req->firstType = firstType; + req->nTypes = nTypes; + req->firstKey = changes->first_key; + req->nKeys = changes->num_keys; + + if (which & XkbKeycodesNameMask) + nAtoms++; + if (which & XkbGeometryNameMask) + nAtoms++; + if (which & XkbSymbolsNameMask) + nAtoms++; + if (which & XkbPhysSymbolsNameMask) + nAtoms++; + if (which & XkbTypesNameMask) + nAtoms++; + if (which & XkbCompatNameMask) + nAtoms++; + if (which & XkbKeyTypeNamesMask) + nAtoms += nTypes; + if (which & XkbKTLevelNamesMask) { + req->firstKTLevel = firstLvlType; + req->nKTLevels = nLvlTypes; + req->length += XkbPaddedSize(nLvlTypes) / 4; /* room for group widths */ + nAtoms += nLvlNames; + } + else + req->firstKTLevel = req->nKTLevels = 0; + + if (which & XkbIndicatorNamesMask) { + leds = req->indicators = (CARD32) changes->changed_indicators; + nLEDs = _XkbCountBits(XkbNumIndicators, changes->changed_indicators); + if (nLEDs > 0) + nAtoms += nLEDs; + else + which &= ~XkbIndicatorNamesMask; + } + else + req->indicators = 0; + + if (which & XkbVirtualModNamesMask) { + vmods = req->virtualMods = changes->changed_vmods; + nVMods = _XkbCountBits(XkbNumVirtualMods, + (unsigned long) changes->changed_vmods); + if (nVMods > 0) + nAtoms += nVMods; + else + which &= ~XkbVirtualModNamesMask; + } + else + req->virtualMods = 0; + + if (which & XkbGroupNamesMask) { + groups = req->groupNames = changes->changed_groups; + nGroups = _XkbCountBits(XkbNumKbdGroups, + (unsigned long) changes->changed_groups); + if (nGroups > 0) + nAtoms += nGroups; + else + which &= ~XkbGroupNamesMask; + } + else + req->groupNames = 0; + + if ((which & XkbKeyNamesMask) && (names->keys != NULL)) { + firstKey = req->firstKey; + nKeys = req->nKeys; + nAtoms += nKeys; /* technically not atoms, but 4 bytes wide */ + } + else + which &= ~XkbKeyNamesMask; + + if (which & XkbKeyAliasesMask) { + nKA = ((names->key_aliases != NULL) ? names->num_key_aliases : 0); + if (nKA > 0) + nAtoms += nKA * 2; /* not atoms, but 8 bytes on the wire */ + else + which &= ~XkbKeyAliasesMask; + } + + if (which & XkbRGNamesMask) { + nRG = names->num_rg; + if (nRG > 0) + nAtoms += nRG; + else + which &= ~XkbRGNamesMask; + } + + req->which = which; + req->nRadioGroups = nRG; + req->length += (nAtoms * 4) / 4; + + if (which & XkbKeycodesNameMask) + Data32(dpy, (long *) &names->keycodes, 4); + if (which & XkbGeometryNameMask) + Data32(dpy, (long *) &names->geometry, 4); + if (which & XkbSymbolsNameMask) + Data32(dpy, (long *) &names->symbols, 4); + if (which & XkbPhysSymbolsNameMask) + Data32(dpy, (long *) &names->phys_symbols, 4); + if (which & XkbTypesNameMask) + Data32(dpy, (long *) &names->types, 4); + if (which & XkbCompatNameMask) + Data32(dpy, (long *) &names->compat, 4); + if (which & XkbKeyTypeNamesMask) { + register int i; + register XkbKeyTypePtr type; + + type = &xkb->map->types[firstType]; + for (i = 0; i < nTypes; i++, type++) { + Data32(dpy, (long *) &type->name, 4); + } + } + if (which & XkbKTLevelNamesMask) { + XkbKeyTypePtr type; + int i; + char *tmp; + + BufAlloc(char *, tmp, XkbPaddedSize(nLvlTypes)); + type = &xkb->map->types[firstLvlType]; + for (i = 0; i < nLvlTypes; i++, type++) { + *tmp++ = type->num_levels; + } + type = &xkb->map->types[firstLvlType]; + for (i = 0; i < nLvlTypes; i++, type++) { + if (type->level_names != NULL) + Data32(dpy, (long *) type->level_names, type->num_levels * 4); + } + } + if (which & XkbIndicatorNamesMask) + _XkbCopyAtoms(dpy, names->indicators, leds, XkbNumIndicators); + if (which & XkbVirtualModNamesMask) + _XkbCopyAtoms(dpy, names->vmods, vmods, XkbNumVirtualMods); + if (which & XkbGroupNamesMask) + _XkbCopyAtoms(dpy, names->groups, groups, XkbNumKbdGroups); + if (which & XkbKeyNamesMask) { + Data(dpy, (char *) &names->keys[firstKey], nKeys * XkbKeyNameLength); + } + if (which & XkbKeyAliasesMask) { + Data(dpy, (char *) names->key_aliases, nKA * XkbKeyNameLength * 2); + } + if (which & XkbRGNamesMask) { + Data32(dpy, (long *) names->radio_groups, nRG * 4); + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +void +XkbNoteNameChanges(XkbNameChangesPtr old, + XkbNamesNotifyEvent *new, + unsigned int wanted) +{ + int first, last, old_last, new_last; + + if ((old == NULL) || (new == NULL)) + return; + + wanted &= new->changed; + + if (wanted == 0) + return; + + if (wanted & XkbKeyTypeNamesMask) { + if (old->changed & XkbKeyTypeNamesMask) { + new_last = (new->first_type + new->num_types - 1); + old_last = (old->first_type + old->num_types - 1); + + if (new->first_type < old->first_type) + first = new->first_type; + else + first = old->first_type; + + if (old_last > new_last) + last = old_last; + else + last = new_last; + + old->first_type = first; + old->num_types = (last - first) + 1; + } + else { + old->first_type = new->first_type; + old->num_types = new->num_types; + } + } + if (wanted & XkbKTLevelNamesMask) { + if (old->changed & XkbKTLevelNamesMask) { + new_last = (new->first_lvl + new->num_lvls - 1); + old_last = (old->first_lvl + old->num_lvls - 1); + + if (new->first_lvl < old->first_lvl) + first = new->first_lvl; + else + first = old->first_lvl; + + if (old_last > new_last) + last = old_last; + else + last = new_last; + + old->first_lvl = first; + old->num_lvls = (last - first) + 1; + } + else { + old->first_lvl = new->first_lvl; + old->num_lvls = new->num_lvls; + } + } + if (wanted & XkbIndicatorNamesMask) { + if (old->changed & XkbIndicatorNamesMask) + old->changed_indicators |= new->changed_indicators; + else + old->changed_indicators = new->changed_indicators; + } + if (wanted & XkbKeyNamesMask) { + if (old->changed & XkbKeyNamesMask) { + new_last = (new->first_key + new->num_keys - 1); + old_last = (old->first_key + old->num_keys - 1); + + first = old->first_key; + + if (new->first_key < old->first_key) + first = new->first_key; + if (old_last > new_last) + new_last = old_last; + + old->first_key = first; + old->num_keys = (new_last - first) + 1; + } + else { + old->first_key = new->first_key; + old->num_keys = new->num_keys; + } + } + if (wanted & XkbVirtualModNamesMask) { + if (old->changed & XkbVirtualModNamesMask) + old->changed_vmods |= new->changed_vmods; + else + old->changed_vmods = new->changed_vmods; + } + if (wanted & XkbGroupNamesMask) { + if (old->changed & XkbGroupNamesMask) + old->changed_groups |= new->changed_groups; + else + old->changed_groups = new->changed_groups; + } + if (wanted & XkbRGNamesMask) + old->num_rg = new->num_radio_groups; + if (wanted & XkbKeyAliasesMask) + old->num_aliases = new->num_aliases; + old->changed |= wanted; + return; +} diff --git a/nx-X11/lib/src/xkb/XKBRdBuf.c b/nx-X11/lib/src/xkb/XKBRdBuf.c new file mode 100644 index 000000000..381f4c900 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBRdBuf.c @@ -0,0 +1,203 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "XKBlibint.h" +#include + +/***====================================================================***/ + +int +_XkbInitReadBuffer(Display *dpy, XkbReadBufferPtr buf, int size) +{ + if ((dpy != NULL) && (buf != NULL) && (size > 0)) { + buf->error = 0; + buf->size = size; + buf->start = buf->data = _XkbAlloc(size); + if (buf->start) { + _XRead(dpy, buf->start, size); + return 1; + } + } + return 0; +} + +#define _XkbReadBufferDataLeft(b) (((b)->size)-((b)->data-(b)->start)) + +int +_XkbSkipReadBufferData(XkbReadBufferPtr from, int size) +{ + if (size == 0) + return 1; + if ((from == NULL) || (from->error) || (size < 1) || + (_XkbReadBufferDataLeft(from) < size)) + return 0; + from->data += size; + return 1; +} + +int +_XkbCopyFromReadBuffer(XkbReadBufferPtr from, char *to, int size) +{ + if (size == 0) + return 1; + if ((from == NULL) || (from->error) || (to == NULL) || (size < 1) || + (_XkbReadBufferDataLeft(from) < size)) + return 0; + memcpy(to, from->data, size); + from->data += size; + return 1; +} + +#ifdef XKB_FORCE_INT_KEYSYM +int +_XkbReadCopyKeySyms(int *wire, KeySym * to, int num_words) +{ + while (num_words-- > 0) { + *to++ = *wire++; + } + return 1; +} + +int +_XkbReadBufferCopyKeySyms(XkbReadBufferPtr from, KeySym * to, int num_words) +{ + if ((unsigned) (num_words * 4) > _XkbReadBufferDataLeft(from)) + return 0; + _XkbReadCopyKeySyms((int *) from->data, to, num_words); + from->data += (4 * num_words); + return True; +} + +int +_XkbWriteCopyKeySyms(register KeySym * from, CARD32 *to, int len) +{ + while (len-- > 0) { + *to++ = (CARD32) *from++; + } + return True; +} +#endif + +#ifdef LONG64 +int +_XkbReadCopyData32(int *wire, long *to, int num_words) +{ + while (num_words-- > 0) { + *to++ = *wire++; + } + return 1; +} + +int +_XkbReadBufferCopy32(XkbReadBufferPtr from, long *to, int num_words) +{ + if ((unsigned) (num_words * 4) > _XkbReadBufferDataLeft(from)) + return 0; + _XkbReadCopyData32((int *) from->data, to, num_words); + from->data += (4 * num_words); + return True; +} + +int +_XkbWriteCopyData32(register unsigned long *from, CARD32 *to, int len) +{ + while (len-- > 0) { + *to++ = (CARD32) *from++; + } + return True; +} +#endif /* LONG64 */ + + +char * +_XkbPeekAtReadBuffer(XkbReadBufferPtr from, int size) +{ + if ((from == NULL) || (from->error) || (size < 1) || + (_XkbReadBufferDataLeft(from) < size)) + return NULL; + return from->data; +} + +char * +_XkbGetReadBufferPtr(XkbReadBufferPtr from, int size) +{ + char *ptr; + + if ((from == NULL) || (from->error) || (size < 1) || + (_XkbReadBufferDataLeft(from) < size)) + return NULL; + ptr = from->data; + from->data += size; + return ptr; +} + + +int +_XkbFreeReadBuffer(XkbReadBufferPtr buf) +{ + if ((buf != NULL) && (buf->start != NULL)) { + int left; + + left = (int) _XkbReadBufferDataLeft(buf); + + Xfree(buf->start); + buf->size = 0; + buf->start = buf->data = NULL; + return left; + } + return 0; +} + +Bool +_XkbGetReadBufferCountedString(XkbReadBufferPtr buf, char **rtrn) +{ + CARD16 len, *pLen; + int left; + char *str = NULL; + + if ((buf == NULL) || (buf->error) || + ((left = (int) _XkbReadBufferDataLeft(buf)) < 4)) + return False; + pLen = (CARD16 *) buf->data; + len = *pLen; + if (len > 0) { + if (XkbPaddedSize(len + 2) > left) + return False; + str = _XkbAlloc(len + 1); + if (str) { + memcpy(str, &buf->data[2], len); + str[len] = '\0'; + } + } + buf->data += XkbPaddedSize(len + 2); + *rtrn = str; + return True; +} diff --git a/nx-X11/lib/src/xkb/XKBSetGeom.c b/nx-X11/lib/src/xkb/XKBSetGeom.c new file mode 100644 index 000000000..ee254e0dc --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBSetGeom.c @@ -0,0 +1,478 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef DEBUG +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#endif + +#include "Xlibint.h" +#include "XKBlibint.h" +#include +#include + +#ifndef MINSHORT +#define MINSHORT -32768 +#endif +#ifndef MAXSHORT +#define MAXSHORT 32767 +#endif + +/***====================================================================***/ + +#define _SizeCountedString(s) ((s)?XkbPaddedSize(2+strlen(s)):4) + +static char * +_WriteCountedString(char *wire, char *str) +{ + CARD16 len, *pLen; + + len = (str ? strlen(str) : 0); + pLen = (CARD16 *) wire; + *pLen = len; + if (len && str) + memcpy(&wire[2], str, len); + wire += XkbPaddedSize(len + 2); + return wire; +} + +static int +_SizeGeomProperties(XkbGeometryPtr geom) +{ + register int i, size; + XkbPropertyPtr prop; + + for (size = i = 0, prop = geom->properties; i < geom->num_properties; + i++, prop++) { + size += _SizeCountedString(prop->name); + size += _SizeCountedString(prop->value); + } + return size; +} + +static int +_SizeGeomColors(XkbGeometryPtr geom) +{ + register int i, size; + register XkbColorPtr color; + + for (i = size = 0, color = geom->colors; i < geom->num_colors; i++, color++) { + size += _SizeCountedString(color->spec); + } + return size; +} + +static int +_SizeGeomShapes(XkbGeometryPtr geom) +{ + register int i, size; + register XkbShapePtr shape; + + for (i = size = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { + register int n; + register XkbOutlinePtr ol; + + size += SIZEOF(xkbShapeWireDesc); + for (n = 0, ol = shape->outlines; n < shape->num_outlines; n++, ol++) { + size += SIZEOF(xkbOutlineWireDesc); + size += ol->num_points * SIZEOF(xkbPointWireDesc); + } + } + return size; +} + +static int +_SizeGeomDoodads(int num_doodads, XkbDoodadPtr doodad) +{ + register int i, size; + + for (i = size = 0; i < num_doodads; i++, doodad++) { + size += SIZEOF(xkbAnyDoodadWireDesc); + if (doodad->any.type == XkbTextDoodad) { + size += _SizeCountedString(doodad->text.text); + size += _SizeCountedString(doodad->text.font); + } + else if (doodad->any.type == XkbLogoDoodad) { + size += _SizeCountedString(doodad->logo.logo_name); + } + } + return size; +} + +static int +_SizeGeomSections(XkbGeometryPtr geom) +{ + register int i, size; + XkbSectionPtr section; + + for (i = size = 0, section = geom->sections; i < geom->num_sections; + i++, section++) { + size += SIZEOF(xkbSectionWireDesc); + if (section->rows) { + int r; + XkbRowPtr row; + + for (r = 0, row = section->rows; r < section->num_rows; row++, r++) { + size += SIZEOF(xkbRowWireDesc); + size += row->num_keys * SIZEOF(xkbKeyWireDesc); + } + } + if (section->doodads) + size += _SizeGeomDoodads(section->num_doodads, section->doodads); + if (section->overlays) { + int o; + XkbOverlayPtr ol; + + for (o = 0, ol = section->overlays; o < section->num_overlays; + o++, ol++) { + int r; + XkbOverlayRowPtr row; + + size += SIZEOF(xkbOverlayWireDesc); + for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { + size += SIZEOF(xkbOverlayRowWireDesc); + size += row->num_keys * SIZEOF(xkbOverlayKeyWireDesc); + } + } + } + } + return size; +} + +static int +_SizeGeomKeyAliases(XkbGeometryPtr geom) +{ + return geom->num_key_aliases * (2 * XkbKeyNameLength); +} + +/***====================================================================***/ + +static char * +_WriteGeomProperties(char *wire, XkbGeometryPtr geom) +{ + register int i; + register XkbPropertyPtr prop; + + for (i = 0, prop = geom->properties; i < geom->num_properties; i++, prop++) { + wire = _WriteCountedString(wire, prop->name); + wire = _WriteCountedString(wire, prop->value); + } + return wire; +} + +static char * +_WriteGeomColors(char *wire, XkbGeometryPtr geom) +{ + register int i; + register XkbColorPtr color; + + for (i = 0, color = geom->colors; i < geom->num_colors; i++, color++) { + wire = _WriteCountedString(wire, color->spec); + } + return wire; +} + +static char * +_WriteGeomShapes(char *wire, XkbGeometryPtr geom) +{ + int i; + XkbShapePtr shape; + xkbShapeWireDesc *shapeWire; + + for (i = 0, shape = geom->shapes; i < geom->num_shapes; i++, shape++) { + register int o; + XkbOutlinePtr ol; + xkbOutlineWireDesc *olWire; + + shapeWire = (xkbShapeWireDesc *) wire; + shapeWire->name = shape->name; + shapeWire->nOutlines = shape->num_outlines; + if (shape->primary != NULL) + shapeWire->primaryNdx = XkbOutlineIndex(shape, shape->primary); + else + shapeWire->primaryNdx = XkbNoShape; + if (shape->approx != NULL) + shapeWire->approxNdx = XkbOutlineIndex(shape, shape->approx); + else + shapeWire->approxNdx = XkbNoShape; + wire = (char *) &shapeWire[1]; + for (o = 0, ol = shape->outlines; o < shape->num_outlines; o++, ol++) { + register int p; + XkbPointPtr pt; + xkbPointWireDesc *ptWire; + + olWire = (xkbOutlineWireDesc *) wire; + olWire->nPoints = ol->num_points; + olWire->cornerRadius = ol->corner_radius; + wire = (char *) &olWire[1]; + ptWire = (xkbPointWireDesc *) wire; + for (p = 0, pt = ol->points; p < ol->num_points; p++, pt++) { + ptWire[p].x = pt->x; + ptWire[p].y = pt->y; + } + wire = (char *) &ptWire[ol->num_points]; + } + } + return wire; +} + +static char * +_WriteGeomDoodads(char *wire, int num_doodads, XkbDoodadPtr doodad) +{ + register int i; + + for (i = 0; i < num_doodads; i++, doodad++) { + xkbDoodadWireDesc *doodadWire = (xkbDoodadWireDesc *) wire; + + wire = (char *) &doodadWire[1]; + bzero(doodadWire, SIZEOF(xkbDoodadWireDesc)); + doodadWire->any.name = doodad->any.name; + doodadWire->any.type = doodad->any.type; + doodadWire->any.priority = doodad->any.priority; + doodadWire->any.top = doodad->any.top; + doodadWire->any.left = doodad->any.left; + doodadWire->any.angle = doodad->any.angle; + switch (doodad->any.type) { + case XkbOutlineDoodad: + case XkbSolidDoodad: + doodadWire->shape.colorNdx = doodad->shape.color_ndx; + doodadWire->shape.shapeNdx = doodad->shape.shape_ndx; + break; + case XkbTextDoodad: + doodadWire->text.width = doodad->text.width; + doodadWire->text.height = doodad->text.height; + doodadWire->text.colorNdx = doodad->text.color_ndx; + wire = _WriteCountedString(wire, doodad->text.text); + wire = _WriteCountedString(wire, doodad->text.font); + break; + case XkbIndicatorDoodad: + doodadWire->indicator.shapeNdx = doodad->indicator.shape_ndx; + doodadWire->indicator.onColorNdx = doodad->indicator.on_color_ndx; + doodadWire->indicator.offColorNdx = doodad->indicator.off_color_ndx; + break; + case XkbLogoDoodad: + doodadWire->logo.colorNdx = doodad->logo.color_ndx; + doodadWire->logo.shapeNdx = doodad->logo.shape_ndx; + wire = _WriteCountedString(wire, doodad->logo.logo_name); + break; + default: + break; + } + } + return wire; +} + +static char * +_WriteGeomOverlay(char *wire, XkbOverlayPtr ol) +{ + register int r; + XkbOverlayRowPtr row; + xkbOverlayWireDesc *olWire = (xkbOverlayWireDesc *) wire; + + olWire->name = ol->name; + olWire->nRows = ol->num_rows; + wire = (char *) &olWire[1]; + for (r = 0, row = ol->rows; r < ol->num_rows; r++, row++) { + unsigned int k; + XkbOverlayKeyPtr key; + xkbOverlayRowWireDesc *rowWire = (xkbOverlayRowWireDesc *) wire; + + rowWire->rowUnder = row->row_under; + rowWire->nKeys = row->num_keys; + wire = (char *) &rowWire[1]; + for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { + xkbOverlayKeyWireDesc *keyWire = (xkbOverlayKeyWireDesc *) wire; + + memcpy(keyWire->over, key->over.name, XkbKeyNameLength); + memcpy(keyWire->under, key->under.name, XkbKeyNameLength); + wire = (char *) &keyWire[1]; + } + } + return wire; +} + +static char * +_WriteGeomSections(char *wire, XkbGeometryPtr geom) +{ + register int i; + XkbSectionPtr section; + + for (i = 0, section = geom->sections; i < geom->num_sections; + i++, section++) { + xkbSectionWireDesc *sectionWire = (xkbSectionWireDesc *) wire; + + sectionWire->name = section->name; + sectionWire->top = section->top; + sectionWire->left = section->left; + sectionWire->width = section->width; + sectionWire->height = section->height; + sectionWire->angle = section->angle; + sectionWire->priority = section->priority; + sectionWire->nRows = section->num_rows; + sectionWire->nDoodads = section->num_doodads; + sectionWire->nOverlays = section->num_overlays; + sectionWire->pad = 0; + wire = (char *) §ionWire[1]; + if (section->rows) { + int r; + XkbRowPtr row; + + for (r = 0, row = section->rows; r < section->num_rows; r++, row++) { + xkbRowWireDesc *rowWire = (xkbRowWireDesc *) wire; + + rowWire->top = row->top; + rowWire->left = row->left; + rowWire->nKeys = row->num_keys; + rowWire->vertical = row->vertical; + rowWire->pad = 0; + wire = (char *) &rowWire[1]; + if (row->keys) { + int k; + XkbKeyPtr key; + xkbKeyWireDesc *keyWire = (xkbKeyWireDesc *) wire; + + for (k = 0, key = row->keys; k < row->num_keys; k++, key++) { + memcpy(keyWire[k].name, key->name.name, + XkbKeyNameLength); + keyWire[k].gap = key->gap; + keyWire[k].shapeNdx = key->shape_ndx; + keyWire[k].colorNdx = key->color_ndx; + } + wire = (char *) &keyWire[row->num_keys]; + } + } + } + if (section->doodads) { + wire = _WriteGeomDoodads(wire, + section->num_doodads, section->doodads); + } + if (section->overlays) { + register int o; + + for (o = 0; o < section->num_overlays; o++) { + wire = _WriteGeomOverlay(wire, §ion->overlays[o]); + } + } + } + return wire; +} + +static char * +_WriteGeomKeyAliases(char *wire, XkbGeometryPtr geom) +{ + register int sz; + + sz = geom->num_key_aliases * (XkbKeyNameLength * 2); + if (sz > 0) { + memcpy(wire, (char *) geom->key_aliases, sz); + wire += sz; + } + return wire; +} + +/***====================================================================***/ + +static Status +_SendSetGeometry(Display *dpy, XkbGeometryPtr geom, xkbSetGeometryReq *req) +{ + int sz; + char *wire, *tbuf; + + sz = 0; + sz += _SizeCountedString(geom->label_font); + sz += _SizeGeomProperties(geom); + sz += _SizeGeomColors(geom); + sz += _SizeGeomShapes(geom); + sz += _SizeGeomSections(geom); + sz += _SizeGeomDoodads(geom->num_doodads, geom->doodads); + sz += _SizeGeomKeyAliases(geom); + req->length += (sz / 4); + if (sz < (dpy->bufmax - dpy->buffer)) { + BufAlloc(char *, wire, sz); + tbuf = NULL; + } + else { + tbuf = _XAllocTemp(dpy, sz); + if (!tbuf) + return BadAlloc; + wire = tbuf; + } + wire = _WriteCountedString(wire, geom->label_font); + if (geom->num_properties > 0) + wire = _WriteGeomProperties(wire, geom); + if (geom->num_colors > 0) + wire = _WriteGeomColors(wire, geom); + if (geom->num_shapes > 0) + wire = _WriteGeomShapes(wire, geom); + if (geom->num_sections > 0) + wire = _WriteGeomSections(wire, geom); + if (geom->num_doodads > 0) + wire = _WriteGeomDoodads(wire, geom->num_doodads, geom->doodads); + if (geom->num_key_aliases > 0) + wire = _WriteGeomKeyAliases(wire, geom); + if (tbuf != NULL) { + Data(dpy, tbuf, sz); + _XFreeTemp(dpy, tbuf, sz); + } + return Success; +} + +/***====================================================================***/ + +Status +XkbSetGeometry(Display *dpy, unsigned deviceSpec, XkbGeometryPtr geom) +{ + xkbSetGeometryReq *req; + Status ret; + + if ((!geom) || (dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + + LockDisplay(dpy); + GetReq(kbSetGeometry, req); + req->reqType = dpy->xkb_info->codes->major_opcode; + req->xkbReqType = X_kbSetGeometry; + req->deviceSpec = deviceSpec; + req->nShapes = geom->num_shapes; + req->nSections = geom->num_sections; + req->name = geom->name; + req->widthMM = geom->width_mm; + req->heightMM = geom->height_mm; + req->nProperties = geom->num_properties; + req->nColors = geom->num_colors; + req->nDoodads = geom->num_doodads; + req->nKeyAliases = geom->num_key_aliases; + req->baseColorNdx = (geom->base_color - geom->colors); + req->labelColorNdx = (geom->label_color - geom->colors); + + ret = _SendSetGeometry(dpy, geom, req); + UnlockDisplay(dpy); + SyncHandle(); + return ret; +} diff --git a/nx-X11/lib/src/xkb/XKBSetMap.c b/nx-X11/lib/src/xkb/XKBSetMap.c new file mode 100644 index 000000000..cb696105c --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBSetMap.c @@ -0,0 +1,598 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +static int +_XkbSizeKeyTypes(XkbDescPtr xkb, xkbSetMapReq *req) +{ + XkbKeyTypePtr map; + int i, len; + + if (((req->present & XkbKeyTypesMask) == 0) || (req->nTypes == 0)) { + req->present &= ~XkbKeyTypesMask; + req->firstType = req->nTypes = 0; + return 0; + } + len = 0; + map = &xkb->map->types[req->firstType]; + for (i = 0; i < req->nTypes; i++, map++) { + len += SIZEOF(xkbKeyTypeWireDesc); + len += map->map_count * SIZEOF(xkbKTSetMapEntryWireDesc); + if (map->preserve) + len += map->map_count * SIZEOF(xkbModsWireDesc); + } + return len; +} + +static void +_XkbWriteKeyTypes(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + char *buf; + XkbKeyTypePtr type; + int i, n; + xkbKeyTypeWireDesc *desc; + + if ((req->present & XkbKeyTypesMask) == 0) + return; + type = &xkb->map->types[req->firstType]; + for (i = 0; i < req->nTypes; i++, type++) { + int sz = SIZEOF(xkbKeyTypeWireDesc); + sz += type->map_count * SIZEOF(xkbKTSetMapEntryWireDesc); + if (type->preserve) + sz += type->map_count * SIZEOF(xkbModsWireDesc); + BufAlloc(xkbKeyTypeWireDesc *, desc, sz); + desc->mask = type->mods.mask; + desc->realMods = type->mods.real_mods; + desc->virtualMods = type->mods.vmods; + desc->numLevels = type->num_levels; + desc->nMapEntries = type->map_count; + desc->preserve = (type->preserve != NULL); + buf = (char *) &desc[1]; + if (desc->nMapEntries > 0) { + xkbKTSetMapEntryWireDesc *wire = (xkbKTSetMapEntryWireDesc *) buf; + + for (n = 0; n < type->map_count; n++, wire++) { + wire->level = type->map[n].level; + wire->realMods = type->map[n].mods.real_mods; + wire->virtualMods = type->map[n].mods.vmods; + } + buf = (char *) wire; + if (type->preserve) { + xkbModsWireDesc *pwire = (xkbModsWireDesc *) buf; + + for (n = 0; n < type->map_count; n++, pwire++) { + pwire->realMods = type->preserve[n].real_mods; + pwire->virtualMods = type->preserve[n].vmods; + } + } + } + } + return; +} + +static int +_XkbSizeKeySyms(XkbDescPtr xkb, xkbSetMapReq *req) +{ + int i, len; + unsigned nSyms; + + if (((req->present & XkbKeySymsMask) == 0) || (req->nKeySyms == 0)) { + req->present &= ~XkbKeySymsMask; + req->firstKeySym = req->nKeySyms = 0; + req->totalSyms = 0; + return 0; + } + len = (int) (req->nKeySyms * sizeof(XkbSymMapRec)); + for (i = nSyms = 0; i < req->nKeySyms; i++) { + nSyms += XkbKeyNumSyms(xkb, i + req->firstKeySym); + } + len += nSyms * sizeof(CARD32); + req->totalSyms = nSyms; + return len; +} + +static void +_XkbWriteKeySyms(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + register KeySym *pSym; + CARD32 *outSym; + XkbSymMapPtr symMap; + xkbSymMapWireDesc *desc; + register int i; + + if ((req->present & XkbKeySymsMask) == 0) + return; + symMap = &xkb->map->key_sym_map[req->firstKeySym]; + for (i = 0; i < req->nKeySyms; i++, symMap++) { + BufAlloc(xkbSymMapWireDesc *, desc, + SIZEOF(xkbSymMapWireDesc) + + (XkbKeyNumSyms(xkb, i + req->firstKeySym) * sizeof(CARD32))); + desc->ktIndex[0] = symMap->kt_index[0]; + desc->ktIndex[1] = symMap->kt_index[1]; + desc->ktIndex[2] = symMap->kt_index[2]; + desc->ktIndex[3] = symMap->kt_index[3]; + desc->groupInfo = symMap->group_info; + desc->width = symMap->width; + desc->nSyms = XkbKeyNumSyms(xkb, i + req->firstKeySym); + outSym = (CARD32 *) &desc[1]; + if (desc->nSyms > 0) { + pSym = XkbKeySymsPtr(xkb, i + req->firstKeySym); + _XkbWriteCopyKeySyms(pSym, outSym, desc->nSyms); + } + } + return; +} + +static int +_XkbSizeKeyActions(XkbDescPtr xkb, xkbSetMapReq *req) +{ + int i, len, nActs; + + if (((req->present & XkbKeyActionsMask) == 0) || (req->nKeyActs == 0)) { + req->present &= ~XkbKeyActionsMask; + req->firstKeyAct = req->nKeyActs = 0; + req->totalActs = 0; + return 0; + } + for (nActs = i = 0; i < req->nKeyActs; i++) { + if (xkb->server->key_acts[i + req->firstKeyAct] != 0) + nActs += XkbKeyNumActions(xkb, i + req->firstKeyAct); + } + len = XkbPaddedSize(req->nKeyActs) + (nActs * SIZEOF(xkbActionWireDesc)); + req->totalActs = nActs; + return len; +} + +static void +_XkbWriteKeyActions(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i; + int n; + CARD8 *numDesc; + XkbAction *actDesc; + + if ((req->present & XkbKeyActionsMask) == 0) + return; + n = XkbPaddedSize(req->nKeyActs); + n += (req->totalActs * SIZEOF(xkbActionWireDesc)); + + BufAlloc(CARD8 *, numDesc, n); + for (i = 0; i < req->nKeyActs; i++) { + if (xkb->server->key_acts[i + req->firstKeyAct] == 0) + numDesc[i] = 0; + else + numDesc[i] = XkbKeyNumActions(xkb, (i + req->firstKeyAct)); + } + actDesc = (XkbAction *) &numDesc[XkbPaddedSize(req->nKeyActs)]; + for (i = 0; i < req->nKeyActs; i++) { + if (xkb->server->key_acts[i + req->firstKeyAct] != 0) { + n = XkbKeyNumActions(xkb, (i + req->firstKeyAct)); + memcpy(actDesc, XkbKeyActionsPtr(xkb, (i + req->firstKeyAct)), + n * SIZEOF(xkbActionWireDesc)); + actDesc += n; + } + } + return; +} + +static int +_XkbSizeKeyBehaviors(XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last, nFound; + + if (((req->present & XkbKeyBehaviorsMask) == 0) || (req->nKeyBehaviors < 1)) { + req->present &= ~XkbKeyBehaviorsMask; + req->firstKeyBehavior = req->nKeyBehaviors = 0; + req->totalKeyBehaviors = 0; + return 0; + } + first = req->firstKeyBehavior; + last = first + req->nKeyBehaviors - 1; + for (i = first, nFound = 0; i <= last; i++) { + if (xkb->server->behaviors[i].type != XkbKB_Default) + nFound++; + } + req->totalKeyBehaviors = nFound; + return (nFound * SIZEOF(xkbBehaviorWireDesc)); +} + +static void +_XkbWriteKeyBehaviors(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last; + xkbBehaviorWireDesc *wire; + char *buf; + + if ((req->present & XkbKeyBehaviorsMask) == 0) + return; + first = req->firstKeyBehavior; + last = first + req->nKeyBehaviors - 1; + + i = req->totalKeyBehaviors * SIZEOF(xkbBehaviorWireDesc); + BufAlloc(char *, buf, i); + wire = (xkbBehaviorWireDesc *) buf; + for (i = first; i <= last; i++) { + if (xkb->server->behaviors[i].type != XkbKB_Default) { + wire->key = i; + wire->type = xkb->server->behaviors[i].type; + wire->data = xkb->server->behaviors[i].data; + buf += SIZEOF(xkbBehaviorWireDesc); + wire = (xkbBehaviorWireDesc *) buf; + } + } + return; +} + +static unsigned +_XkbSizeVirtualMods(xkbSetMapReq *req) +{ + register int i, bit, nMods; + + if (((req->present & XkbVirtualModsMask) == 0) || (req->virtualMods == 0)) { + req->present &= ~XkbVirtualModsMask; + req->virtualMods = 0; + return 0; + } + for (i = nMods = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (req->virtualMods & bit) + nMods++; + } + return XkbPaddedSize(nMods); +} + +static void +_XkbWriteVirtualMods(Display *dpy, + XkbDescPtr xkb, + xkbSetMapReq *req, + unsigned size) +{ + register int i, bit; + CARD8 *vmods; + + /* This was req->present&XkbVirtualModsMask==0, and '==' beats '&' */ + if (((req->present & XkbVirtualModsMask) == 0) || (size < 1)) + return; + BufAlloc(CARD8 *, vmods, size); + for (i = 0, bit = 1; i < XkbNumVirtualMods; i++, bit <<= 1) { + if (req->virtualMods & bit) + *vmods++ = xkb->server->vmods[i]; + } + return; +} + +static int +_XkbSizeKeyExplicit(XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last, nFound; + + if (((req->present & XkbExplicitComponentsMask) == 0) || + (req->nKeyExplicit == 0)) { + req->present &= ~XkbExplicitComponentsMask; + req->firstKeyExplicit = req->nKeyExplicit = 0; + req->totalKeyExplicit = 0; + return 0; + } + first = req->firstKeyExplicit; + last = first + req->nKeyExplicit - 1; + + for (i = first, nFound = 0; i <= last; i++) { + if (xkb->server->explicit[i] != 0) + nFound++; + } + req->totalKeyExplicit = nFound; + return XkbPaddedSize((nFound * 2)); +} + +static void +_XkbWriteKeyExplicit(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last; + CARD8 *wire; + + if ((req->present & XkbExplicitComponentsMask) == 0) + return; + first = req->firstKeyExplicit; + last = first + req->nKeyExplicit - 1; + i = XkbPaddedSize((req->totalKeyExplicit * 2)); + BufAlloc(CARD8 *, wire, i); + for (i = first; i <= last; i++) { + if (xkb->server->explicit[i] != 0) { + wire[0] = i; + wire[1] = xkb->server->explicit[i]; + wire += 2; + } + } + return; +} + +static int +_XkbSizeModifierMap(XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last, nFound; + + if (((req->present & XkbModifierMapMask) == 0) || (req->nModMapKeys == 0)) { + req->present &= ~XkbModifierMapMask; + req->firstModMapKey = req->nModMapKeys = 0; + req->totalModMapKeys = 0; + return 0; + } + first = req->firstModMapKey; + last = first + req->nModMapKeys - 1; + + for (i = first, nFound = 0; i <= last; i++) { + if (xkb->map->modmap[i] != 0) + nFound++; + } + req->totalModMapKeys = nFound; + return XkbPaddedSize((nFound * 2)); +} + +static void +_XkbWriteModifierMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last; + CARD8 *wire; + + if ((req->present & XkbModifierMapMask) == 0) + return; + first = req->firstModMapKey; + last = first + req->nModMapKeys - 1; + if (req->totalModMapKeys > 0) { + i = XkbPaddedSize((req->totalModMapKeys * 2)); + BufAlloc(CARD8 *, wire, i); + + for (i = first; i <= last; i++) { + if (xkb->map->modmap[i] != 0) { + wire[0] = i; + wire[1] = xkb->map->modmap[i]; + wire += 2; + } + } + } + return; +} + +static int +_XkbSizeVirtualModMap(XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last, nFound; + + if (((req->present & XkbVirtualModMapMask) == 0) || + (req->nVModMapKeys == 0)) { + req->present &= ~XkbVirtualModMapMask; + req->firstVModMapKey = req->nVModMapKeys = 0; + req->totalVModMapKeys = 0; + return 0; + } + first = req->firstVModMapKey; + last = first + req->nVModMapKeys - 1; + + for (i = first, nFound = 0; i <= last; i++) { + if (xkb->server->vmodmap[i] != 0) + nFound++; + } + req->totalVModMapKeys = nFound; + return nFound * SIZEOF(xkbVModMapWireDesc); +} + +static void +_XkbWriteVirtualModMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + register int i, first, last; + xkbVModMapWireDesc *wire; + + if ((req->present & XkbVirtualModMapMask) == 0) + return; + first = req->firstVModMapKey; + last = first + req->nVModMapKeys - 1; + if (req->totalVModMapKeys > 0) { + i = req->totalVModMapKeys * SIZEOF(xkbVModMapWireDesc); + BufAlloc(xkbVModMapWireDesc *, wire, i); + for (i = first; i <= last; i++) { + if (xkb->server->vmodmap[i] != 0) { + wire->key = i; + wire->vmods = xkb->server->vmodmap[i]; + wire++; + } + } + } + return; +} + +static void +SendSetMap(Display *dpy, XkbDescPtr xkb, xkbSetMapReq *req) +{ + xkbSetMapReq tmp; + unsigned szMods; + + req->length += _XkbSizeKeyTypes(xkb, req) / 4; + req->length += _XkbSizeKeySyms(xkb, req) / 4; + req->length += _XkbSizeKeyActions(xkb, req) / 4; + req->length += _XkbSizeKeyBehaviors(xkb, req) / 4; + szMods = _XkbSizeVirtualMods(req); + req->length += szMods / 4; + req->length += _XkbSizeKeyExplicit(xkb, req) / 4; + req->length += _XkbSizeModifierMap(xkb, req) / 4; + req->length += _XkbSizeVirtualModMap(xkb, req) / 4; + + tmp = *req; + if (tmp.nTypes > 0) + _XkbWriteKeyTypes(dpy, xkb, &tmp); + if (tmp.nKeySyms > 0) + _XkbWriteKeySyms(dpy, xkb, &tmp); + if (tmp.nKeyActs) + _XkbWriteKeyActions(dpy, xkb, &tmp); + if (tmp.totalKeyBehaviors > 0) + _XkbWriteKeyBehaviors(dpy, xkb, &tmp); + if (tmp.virtualMods) + _XkbWriteVirtualMods(dpy, xkb, &tmp, szMods); + if (tmp.totalKeyExplicit > 0) + _XkbWriteKeyExplicit(dpy, xkb, &tmp); + if (tmp.totalModMapKeys > 0) + _XkbWriteModifierMap(dpy, xkb, &tmp); + if (tmp.totalVModMapKeys > 0) + _XkbWriteVirtualModMap(dpy, xkb, &tmp); + return; +} + +Bool +XkbSetMap(Display *dpy, unsigned which, XkbDescPtr xkb) +{ + register xkbSetMapReq *req; + XkbInfoPtr xkbi; + XkbServerMapPtr srv; + XkbClientMapPtr map; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || (!xkb)) + return False; + map = xkb->map; + srv = xkb->server; + + if (((which & XkbKeyTypesMask) && ((!map) || (!map->types))) || + ((which & XkbKeySymsMask) && + ((!map) || (!map->syms) || (!map->key_sym_map))) || + ((which & XkbKeyActionsMask) && ((!srv) || (!srv->key_acts))) || + ((which & XkbKeyBehaviorsMask) && ((!srv) || (!srv->behaviors))) || + ((which & XkbVirtualModsMask) && (!srv)) || + ((which & XkbExplicitComponentsMask) && ((!srv) || (!srv->explicit))) || + ((which & XkbModifierMapMask) && ((!map) || (!map->modmap))) || + ((which & XkbVirtualModMapMask) && ((!srv) || (!srv->vmodmap)))) + return False; + + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetMap, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetMap; + req->deviceSpec = xkb->device_spec; + req->present = which; + req->flags = XkbSetMapAllFlags; + req->minKeyCode = xkb->min_key_code; + req->maxKeyCode = xkb->max_key_code; + req->firstType = 0; + if (which & XkbKeyTypesMask) + req->nTypes = map->num_types; + else + req->nTypes = 0; + if (which & XkbKeySymsMask) { + req->firstKeySym = xkb->min_key_code; + req->nKeySyms = XkbNumKeys(xkb); + } + if (which & XkbKeyActionsMask) { + req->firstKeyAct = xkb->min_key_code; + req->nKeyActs = XkbNumKeys(xkb); + } + if (which & XkbKeyBehaviorsMask) { + req->firstKeyBehavior = xkb->min_key_code; + req->nKeyBehaviors = XkbNumKeys(xkb); + } + if (which & XkbVirtualModsMask) + req->virtualMods = ~0; + if (which & XkbExplicitComponentsMask) { + req->firstKeyExplicit = xkb->min_key_code; + req->nKeyExplicit = XkbNumKeys(xkb); + } + if (which & XkbModifierMapMask) { + req->firstModMapKey = xkb->min_key_code; + req->nModMapKeys = XkbNumKeys(xkb); + } + if (which & XkbVirtualModMapMask) { + req->firstVModMapKey = xkb->min_key_code; + req->nVModMapKeys = XkbNumKeys(xkb); + } + SendSetMap(dpy, xkb, req); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbChangeMap(Display *dpy, XkbDescPtr xkb, XkbMapChangesPtr changes) +{ + register xkbSetMapReq *req; + XkbInfoPtr xkbi; + XkbServerMapPtr srv; + XkbClientMapPtr map; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL)) || + (!xkb) || (!changes)) + return False; + srv = xkb->server; + map = xkb->map; + + if (((changes->changed & XkbKeyTypesMask) && ((!map) || (!map->types))) || + ((changes->changed & XkbKeySymsMask) && ((!map) || (!map->syms) || + (!map->key_sym_map))) || + ((changes->changed & XkbKeyActionsMask) && ((!srv) || (!srv->key_acts))) + || ((changes->changed & XkbKeyBehaviorsMask) && + ((!srv) || (!srv->behaviors))) || + ((changes->changed & XkbVirtualModsMask) && (!srv)) || + ((changes->changed & XkbExplicitComponentsMask) && + ((!srv) || (!srv->explicit))) || + ((changes->changed & XkbModifierMapMask) && ((!map) || (!map->modmap))) + || ((changes->changed & XkbVirtualModMapMask) && + ((!srv) || (!srv->vmodmap)))) + return False; + + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetMap, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetMap; + req->deviceSpec = xkb->device_spec; + req->present = changes->changed; + req->flags = XkbSetMapRecomputeActions; + req->minKeyCode = xkb->min_key_code; + req->maxKeyCode = xkb->max_key_code; + req->firstType = changes->first_type; + req->nTypes = changes->num_types; + req->firstKeySym = changes->first_key_sym; + req->nKeySyms = changes->num_key_syms; + req->firstKeyAct = changes->first_key_act; + req->nKeyActs = changes->num_key_acts; + req->firstKeyBehavior = changes->first_key_behavior; + req->nKeyBehaviors = changes->num_key_behaviors; + req->virtualMods = changes->vmods; + req->firstKeyExplicit = changes->first_key_explicit; + req->nKeyExplicit = changes->num_key_explicit; + req->firstModMapKey = changes->first_modmap_key; + req->nModMapKeys = changes->num_modmap_keys; + req->firstVModMapKey = changes->first_vmodmap_key; + req->nVModMapKeys = changes->num_vmodmap_keys; + SendSetMap(dpy, xkb, req); + UnlockDisplay(dpy); + SyncHandle(); + return True; +} diff --git a/nx-X11/lib/src/xkb/XKBUse.c b/nx-X11/lib/src/xkb/XKBUse.c new file mode 100644 index 000000000..cf6497551 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBUse.c @@ -0,0 +1,814 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +static Bool _XkbIgnoreExtension = False; + +void +XkbNoteMapChanges(XkbMapChangesPtr old, + XkbMapNotifyEvent *new, + unsigned wanted) +{ + int first, oldLast, newLast; + + wanted &= new->changed; + + if (wanted & XkbKeyTypesMask) { + if (old->changed & XkbKeyTypesMask) { + first = old->first_type; + oldLast = old->first_type + old->num_types - 1; + newLast = new->first_type + new->num_types - 1; + + if (new->first_type < first) + first = new->first_type; + if (oldLast > newLast) + newLast = oldLast; + old->first_type = first; + old->num_types = newLast - first + 1; + } + else { + old->first_type = new->first_type; + old->num_types = new->num_types; + } + } + if (wanted & XkbKeySymsMask) { + if (old->changed & XkbKeySymsMask) { + first = old->first_key_sym; + oldLast = old->first_key_sym + old->num_key_syms - 1; + newLast = new->first_key_sym + new->num_key_syms - 1; + + if (new->first_key_sym < first) + first = new->first_key_sym; + if (oldLast > newLast) + newLast = oldLast; + old->first_key_sym = first; + old->num_key_syms = newLast - first + 1; + } + else { + old->first_key_sym = new->first_key_sym; + old->num_key_syms = new->num_key_syms; + } + } + if (wanted & XkbKeyActionsMask) { + if (old->changed & XkbKeyActionsMask) { + first = old->first_key_act; + oldLast = old->first_key_act + old->num_key_acts - 1; + newLast = new->first_key_act + new->num_key_acts - 1; + + if (new->first_key_act < first) + first = new->first_key_act; + if (oldLast > newLast) + newLast = oldLast; + old->first_key_act = first; + old->num_key_acts = newLast - first + 1; + } + else { + old->first_key_act = new->first_key_act; + old->num_key_acts = new->num_key_acts; + } + } + if (wanted & XkbKeyBehaviorsMask) { + if (old->changed & XkbKeyBehaviorsMask) { + first = old->first_key_behavior; + oldLast = old->first_key_behavior + old->num_key_behaviors - 1; + newLast = new->first_key_behavior + new->num_key_behaviors - 1; + + if (new->first_key_behavior < first) + first = new->first_key_behavior; + if (oldLast > newLast) + newLast = oldLast; + old->first_key_behavior = first; + old->num_key_behaviors = newLast - first + 1; + } + else { + old->first_key_behavior = new->first_key_behavior; + old->num_key_behaviors = new->num_key_behaviors; + } + } + if (wanted & XkbVirtualModsMask) { + old->vmods |= new->vmods; + } + if (wanted & XkbExplicitComponentsMask) { + if (old->changed & XkbExplicitComponentsMask) { + first = old->first_key_explicit; + oldLast = old->first_key_explicit + old->num_key_explicit - 1; + newLast = new->first_key_explicit + new->num_key_explicit - 1; + + if (new->first_key_explicit < first) + first = new->first_key_explicit; + if (oldLast > newLast) + newLast = oldLast; + old->first_key_explicit = first; + old->num_key_explicit = newLast - first + 1; + } + else { + old->first_key_explicit = new->first_key_explicit; + old->num_key_explicit = new->num_key_explicit; + } + } + if (wanted & XkbModifierMapMask) { + if (old->changed & XkbModifierMapMask) { + first = old->first_modmap_key; + oldLast = old->first_modmap_key + old->num_modmap_keys - 1; + newLast = new->first_modmap_key + new->num_modmap_keys - 1; + + if (new->first_modmap_key < first) + first = new->first_modmap_key; + if (oldLast > newLast) + newLast = oldLast; + old->first_modmap_key = first; + old->num_modmap_keys = newLast - first + 1; + } + else { + old->first_modmap_key = new->first_modmap_key; + old->num_modmap_keys = new->num_modmap_keys; + } + } + if (wanted & XkbVirtualModMapMask) { + if (old->changed & XkbVirtualModMapMask) { + first = old->first_vmodmap_key; + oldLast = old->first_vmodmap_key + old->num_vmodmap_keys - 1; + newLast = new->first_vmodmap_key + new->num_vmodmap_keys - 1; + + if (new->first_vmodmap_key < first) + first = new->first_vmodmap_key; + if (oldLast > newLast) + newLast = oldLast; + old->first_vmodmap_key = first; + old->num_vmodmap_keys = newLast - first + 1; + } + else { + old->first_vmodmap_key = new->first_vmodmap_key; + old->num_vmodmap_keys = new->num_vmodmap_keys; + } + } + old->changed |= wanted; + return; +} + +void +_XkbNoteCoreMapChanges(XkbMapChangesPtr old, + XMappingEvent *new, + unsigned int wanted) +{ + int first, oldLast, newLast; + + if ((new->request == MappingKeyboard) && (wanted & XkbKeySymsMask)) { + if (old->changed & XkbKeySymsMask) { + first = old->first_key_sym; + oldLast = old->first_key_sym + old->num_key_syms - 1; + newLast = new->first_keycode + new->count - 1; + + if (new->first_keycode < first) + first = new->first_keycode; + if (oldLast > newLast) + newLast = oldLast; + old->first_key_sym = first; + old->num_key_syms = newLast - first + 1; + } + else { + old->changed |= XkbKeySymsMask; + old->first_key_sym = new->first_keycode; + old->num_key_syms = new->count; + } + } + return; +} + +static Bool +wire_to_event(Display *dpy, XEvent *re, xEvent *event) +{ + xkbEvent *xkbevent = (xkbEvent *) event; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + xkbi = dpy->xkb_info; + if (((event->u.u.type & 0x7f) - xkbi->codes->first_event) != XkbEventCode) + return False; + + switch (xkbevent->u.any.xkbType) { + case XkbStateNotify: + { + xkbStateNotify *sn = (xkbStateNotify *) event; + + if (xkbi->selected_events & XkbStateNotifyMask) { + XkbStateNotifyEvent *sev = (XkbStateNotifyEvent *) re; + + sev->type = XkbEventCode + xkbi->codes->first_event; + sev->xkb_type = XkbStateNotify; + sev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + sev->send_event = ((event->u.u.type & 0x80) != 0); + sev->display = dpy; + sev->time = sn->time; + sev->device = sn->deviceID; + sev->keycode = sn->keycode; + sev->event_type = sn->eventType; + sev->req_major = sn->requestMajor; + sev->req_minor = sn->requestMinor; + sev->changed = sn->changed; + sev->group = sn->group; + sev->base_group = sn->baseGroup; + sev->latched_group = sn->latchedGroup; + sev->locked_group = sn->lockedGroup; + sev->mods = sn->mods; + sev->base_mods = sn->baseMods; + sev->latched_mods = sn->latchedMods; + sev->locked_mods = sn->lockedMods; + sev->compat_state = sn->compatState; + sev->grab_mods = sn->grabMods; + sev->compat_grab_mods = sn->compatGrabMods; + sev->lookup_mods = sn->lookupMods; + sev->compat_lookup_mods = sn->compatLookupMods; + sev->ptr_buttons = sn->ptrBtnState; + return True; + } + } + break; + case XkbMapNotify: + { + xkbMapNotify *mn = (xkbMapNotify *) event; + + if ((xkbi->selected_events & XkbMapNotifyMask) && + (xkbi->selected_map_details & mn->changed)) { + XkbMapNotifyEvent *mev = (XkbMapNotifyEvent *) re; + + mev->type = XkbEventCode + xkbi->codes->first_event; + mev->xkb_type = XkbMapNotify; + mev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + mev->send_event = ((event->u.u.type & 0x80) != 0); + mev->display = dpy; + mev->time = mn->time; + mev->device = mn->deviceID; + mev->changed = mn->changed; + mev->min_key_code = mn->minKeyCode; + mev->max_key_code = mn->maxKeyCode; + mev->first_type = mn->firstType; + mev->num_types = mn->nTypes; + mev->first_key_sym = mn->firstKeySym; + mev->num_key_syms = mn->nKeySyms; + mev->first_key_act = mn->firstKeyAct; + mev->num_key_acts = mn->nKeyActs; + mev->first_key_behavior = mn->firstKeyBehavior; + mev->num_key_behaviors = mn->nKeyBehaviors; + mev->vmods = mn->virtualMods; + mev->first_key_explicit = mn->firstKeyExplicit; + mev->num_key_explicit = mn->nKeyExplicit; + mev->first_modmap_key = mn->firstModMapKey; + mev->num_modmap_keys = mn->nModMapKeys; + mev->first_vmodmap_key = mn->firstVModMapKey; + mev->num_vmodmap_keys = mn->nVModMapKeys; + XkbNoteMapChanges(&xkbi->changes, mev, XKB_XLIB_MAP_MASK); + if (xkbi->changes.changed) + xkbi->flags |= XkbMapPending; + return True; + } + else if (mn->nKeySyms > 0) { + register XMappingEvent *ev = (XMappingEvent *) re; + + ev->type = MappingNotify; + ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + ev->send_event = ((event->u.u.type & 0x80) != 0); + ev->display = dpy; + ev->window = 0; + ev->first_keycode = mn->firstKeySym; + ev->request = MappingKeyboard; + ev->count = mn->nKeySyms; + _XkbNoteCoreMapChanges(&xkbi->changes, ev, XKB_XLIB_MAP_MASK); + if (xkbi->changes.changed) + xkbi->flags |= XkbMapPending; + return True; + } + } + break; + case XkbControlsNotify: + { + if (xkbi->selected_events & XkbControlsNotifyMask) { + xkbControlsNotify *cn = (xkbControlsNotify *) event; + XkbControlsNotifyEvent *cev = (XkbControlsNotifyEvent *) re; + + cev->type = XkbEventCode + xkbi->codes->first_event; + cev->xkb_type = XkbControlsNotify; + cev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + cev->send_event = ((event->u.u.type & 0x80) != 0); + cev->display = dpy; + cev->time = cn->time; + cev->device = cn->deviceID; + cev->changed_ctrls = cn->changedControls; + cev->enabled_ctrls = cn->enabledControls; + cev->enabled_ctrl_changes = cn->enabledControlChanges; + cev->keycode = cn->keycode; + cev->num_groups = cn->numGroups; + cev->event_type = cn->eventType; + cev->req_major = cn->requestMajor; + cev->req_minor = cn->requestMinor; + return True; + } + } + break; + case XkbIndicatorMapNotify: + { + if (xkbi->selected_events & XkbIndicatorMapNotifyMask) { + xkbIndicatorNotify *in = (xkbIndicatorNotify *) event; + XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re; + + iev->type = XkbEventCode + xkbi->codes->first_event; + iev->xkb_type = XkbIndicatorMapNotify; + iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + iev->send_event = ((event->u.u.type & 0x80) != 0); + iev->display = dpy; + iev->time = in->time; + iev->device = in->deviceID; + iev->changed = in->changed; + iev->state = in->state; + return True; + } + } + break; + case XkbIndicatorStateNotify: + { + if (xkbi->selected_events & XkbIndicatorStateNotifyMask) { + xkbIndicatorNotify *in = (xkbIndicatorNotify *) event; + XkbIndicatorNotifyEvent *iev = (XkbIndicatorNotifyEvent *) re; + + iev->type = XkbEventCode + xkbi->codes->first_event; + iev->xkb_type = XkbIndicatorStateNotify; + iev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + iev->send_event = ((event->u.u.type & 0x80) != 0); + iev->display = dpy; + iev->time = in->time; + iev->device = in->deviceID; + iev->changed = in->changed; + iev->state = in->state; + return True; + } + } + break; + case XkbBellNotify: + { + if (xkbi->selected_events & XkbBellNotifyMask) { + xkbBellNotify *bn = (xkbBellNotify *) event; + XkbBellNotifyEvent *bev = (XkbBellNotifyEvent *) re; + + bev->type = XkbEventCode + xkbi->codes->first_event; + bev->xkb_type = XkbBellNotify; + bev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + bev->send_event = ((event->u.u.type & 0x80) != 0); + bev->display = dpy; + bev->time = bn->time; + bev->device = bn->deviceID; + bev->percent = bn->percent; + bev->pitch = bn->pitch; + bev->duration = bn->duration; + bev->bell_class = bn->bellClass; + bev->bell_id = bn->bellID; + bev->name = bn->name; + bev->window = bn->window; + bev->event_only = bn->eventOnly; + return True; + } + } + break; + case XkbAccessXNotify: + { + if (xkbi->selected_events & XkbAccessXNotifyMask) { + xkbAccessXNotify *axn = (xkbAccessXNotify *) event; + XkbAccessXNotifyEvent *axev = (XkbAccessXNotifyEvent *) re; + + axev->type = XkbEventCode + xkbi->codes->first_event; + axev->xkb_type = XkbAccessXNotify; + axev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + axev->send_event = ((event->u.u.type & 0x80) != 0); + axev->display = dpy; + axev->time = axn->time; + axev->device = axn->deviceID; + axev->detail = axn->detail; + axev->keycode = axn->keycode; + axev->sk_delay = axn->slowKeysDelay; + axev->debounce_delay = axn->debounceDelay; + return True; + } + } + break; + case XkbNamesNotify: + { + if (xkbi->selected_events & XkbNamesNotifyMask) { + xkbNamesNotify *nn = (xkbNamesNotify *) event; + XkbNamesNotifyEvent *nev = (XkbNamesNotifyEvent *) re; + + nev->type = XkbEventCode + xkbi->codes->first_event; + nev->xkb_type = XkbNamesNotify; + nev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + nev->send_event = ((event->u.u.type & 0x80) != 0); + nev->display = dpy; + nev->time = nn->time; + nev->device = nn->deviceID; + nev->changed = nn->changed; + nev->first_type = nn->firstType; + nev->num_types = nn->nTypes; + nev->first_lvl = nn->firstLevelName; + nev->num_lvls = nn->nLevelNames; + nev->num_aliases = nn->nAliases; + nev->num_radio_groups = nn->nRadioGroups; + nev->changed_vmods = nn->changedVirtualMods; + nev->changed_groups = nn->changedGroupNames; + nev->changed_indicators = nn->changedIndicators; + nev->first_key = nn->firstKey; + nev->num_keys = nn->nKeys; + return True; + } + } + break; + case XkbCompatMapNotify: + { + if (xkbi->selected_events & XkbCompatMapNotifyMask) { + xkbCompatMapNotify *cmn = (xkbCompatMapNotify *) event; + XkbCompatMapNotifyEvent *cmev = (XkbCompatMapNotifyEvent *) re; + + cmev->type = XkbEventCode + xkbi->codes->first_event; + cmev->xkb_type = XkbCompatMapNotify; + cmev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + cmev->send_event = ((event->u.u.type & 0x80) != 0); + cmev->display = dpy; + cmev->time = cmn->time; + cmev->device = cmn->deviceID; + cmev->changed_groups = cmn->changedGroups; + cmev->first_si = cmn->firstSI; + cmev->num_si = cmn->nSI; + cmev->num_total_si = cmn->nTotalSI; + return True; + } + } + break; + case XkbActionMessage: + { + if (xkbi->selected_events & XkbActionMessageMask) { + xkbActionMessage *am = (xkbActionMessage *) event; + XkbActionMessageEvent *amev = (XkbActionMessageEvent *) re; + + amev->type = XkbEventCode + xkbi->codes->first_event; + amev->xkb_type = XkbActionMessage; + amev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + amev->send_event = ((event->u.u.type & 0x80) != 0); + amev->display = dpy; + amev->time = am->time; + amev->device = am->deviceID; + amev->keycode = am->keycode; + amev->press = am->press; + amev->key_event_follows = am->keyEventFollows; + amev->group = am->group; + amev->mods = am->mods; + memcpy(amev->message, am->message, XkbActionMessageLength); + amev->message[XkbActionMessageLength] = '\0'; + return True; + } + } + break; + case XkbExtensionDeviceNotify: + { + if (xkbi->selected_events & XkbExtensionDeviceNotifyMask) { + xkbExtensionDeviceNotify *ed = (xkbExtensionDeviceNotify *) event; + XkbExtensionDeviceNotifyEvent *edev + = (XkbExtensionDeviceNotifyEvent *) re; + + edev->type = XkbEventCode + xkbi->codes->first_event; + edev->xkb_type = XkbExtensionDeviceNotify; + edev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + edev->send_event = ((event->u.u.type & 0x80) != 0); + edev->display = dpy; + edev->time = ed->time; + edev->device = ed->deviceID; + edev->led_class = ed->ledClass; + edev->led_id = ed->ledID; + edev->reason = ed->reason; + edev->supported = ed->supported; + edev->leds_defined = ed->ledsDefined; + edev->led_state = ed->ledState; + edev->first_btn = ed->firstBtn; + edev->num_btns = ed->nBtns; + edev->unsupported = ed->unsupported; + return True; + } + } + break; + case XkbNewKeyboardNotify: + { + xkbNewKeyboardNotify *nkn = (xkbNewKeyboardNotify *) event; + + if ((xkbi->selected_events & XkbNewKeyboardNotifyMask) && + (xkbi->selected_nkn_details & nkn->changed)) { + XkbNewKeyboardNotifyEvent *nkev = (XkbNewKeyboardNotifyEvent *) re; + + nkev->type = XkbEventCode + xkbi->codes->first_event; + nkev->xkb_type = XkbNewKeyboardNotify; + nkev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + nkev->send_event = ((event->u.u.type & 0x80) != 0); + nkev->display = dpy; + nkev->time = nkn->time; + nkev->device = nkn->deviceID; + nkev->old_device = nkn->oldDeviceID; + nkev->min_key_code = nkn->minKeyCode; + nkev->max_key_code = nkn->maxKeyCode; + nkev->old_min_key_code = nkn->oldMinKeyCode; + nkev->old_max_key_code = nkn->oldMaxKeyCode; + nkev->req_major = nkn->requestMajor; + nkev->req_minor = nkn->requestMinor; + nkev->changed = nkn->changed; + if ((xkbi->desc) && (nkev->send_event == 0) && + ((xkbi->desc->device_spec == nkev->old_device) || + (nkev->device != nkev->old_device))) { + xkbi->flags = XkbMapPending | XkbXlibNewKeyboard; + } + return True; + } + else if (nkn->changed & (XkbNKN_KeycodesMask | XkbNKN_DeviceIDMask)) { + register XMappingEvent *ev = (XMappingEvent *) re; + + ev->type = MappingNotify; + ev->serial = _XSetLastRequestRead(dpy, (xGenericReply *) event); + ev->send_event = ((event->u.u.type & 0x80) != 0); + ev->display = dpy; + ev->window = 0; + ev->first_keycode = dpy->min_keycode; + ev->request = MappingKeyboard; + ev->count = (dpy->max_keycode - dpy->min_keycode) + 1; + if ((xkbi->desc) && (ev->send_event == 0) && + ((xkbi->desc->device_spec == nkn->oldDeviceID) || + (nkn->deviceID != nkn->oldDeviceID))) { + xkbi->flags |= XkbMapPending | XkbXlibNewKeyboard; + } + return True; + } + } + break; + default: +#ifdef DEBUG + fprintf(stderr, "Got unknown XKEYBOARD event (%d, base=%d)\n", + re->type, xkbi->codes->first_event); +#endif + break; + } + return False; +} + +Bool +XkbIgnoreExtension(Bool ignore) +{ + if (getenv("XKB_FORCE") != NULL) { +#ifdef DEBUG + fprintf(stderr, + "Forcing use of XKEYBOARD (overriding an IgnoreExtensions)\n"); +#endif + return False; + } +#ifdef DEBUG + else if (getenv("XKB_DEBUG") != NULL) { + fprintf(stderr, "Explicitly %signoring XKEYBOARD\n", + ignore ? "" : "not "); + } +#endif + _XkbIgnoreExtension = ignore; + return True; +} + +static void +_XkbFreeInfo(Display *dpy) +{ + XkbInfoPtr xkbi = dpy->xkb_info; + + if (xkbi) { + if (xkbi->desc) + XkbFreeKeyboard(xkbi->desc, XkbAllComponentsMask, True); + Xfree(xkbi); + } +} + +Bool +XkbUseExtension(Display *dpy, int *major_rtrn, int *minor_rtrn) +{ + xkbUseExtensionReply rep; + register xkbUseExtensionReq *req; + XExtCodes *codes; + int ev_base, forceIgnore; + XkbInfoPtr xkbi; + char *str; + static int debugMsg; + static int been_here = 0; + + if (dpy->xkb_info && !(dpy->flags & XlibDisplayNoXkb)) { + if (major_rtrn) + *major_rtrn = dpy->xkb_info->srv_major; + if (minor_rtrn) + *minor_rtrn = dpy->xkb_info->srv_minor; + return True; + } + if (!been_here) { + debugMsg = (getenv("XKB_DEBUG") != NULL); + been_here = 1; + } + + if (major_rtrn) + *major_rtrn = 0; + if (minor_rtrn) + *minor_rtrn = 0; + + if (!dpy->xkb_info) { + xkbi = _XkbTypedCalloc(1, XkbInfoRec); + if (!xkbi) + return False; + dpy->xkb_info = xkbi; + dpy->free_funcs->xkb = _XkbFreeInfo; + + xkbi->xlib_ctrls |= (XkbLC_ControlFallback | XkbLC_ConsumeLookupMods); + if ((str = getenv("_XKB_OPTIONS_ENABLE")) != NULL) { + if ((str = getenv("_XKB_LATIN1_LOOKUP")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_ForceLatin1Lookup; + else + xkbi->xlib_ctrls |= XkbLC_ForceLatin1Lookup; + } + if ((str = getenv("_XKB_CONSUME_LOOKUP_MODS")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_ConsumeLookupMods; + else + xkbi->xlib_ctrls |= XkbLC_ConsumeLookupMods; + } + if ((str = getenv("_XKB_CONSUME_SHIFT_AND_LOCK")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_AlwaysConsumeShiftAndLock; + else + xkbi->xlib_ctrls |= XkbLC_AlwaysConsumeShiftAndLock; + } + if ((str = getenv("_XKB_IGNORE_NEW_KEYBOARDS")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_IgnoreNewKeyboards; + else + xkbi->xlib_ctrls |= XkbLC_IgnoreNewKeyboards; + } + if ((str = getenv("_XKB_CONTROL_FALLBACK")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_ControlFallback; + else + xkbi->xlib_ctrls |= XkbLC_ControlFallback; + } + if ((str = getenv("_XKB_COMP_LED")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_ComposeLED; + else { + xkbi->xlib_ctrls |= XkbLC_ComposeLED; + if (strlen(str) > 0) + xkbi->composeLED = XInternAtom(dpy, str, False); + } + } + if ((str = getenv("_XKB_COMP_FAIL_BEEP")) != NULL) { + if ((strcmp(str, "off") == 0) || (strcmp(str, "0") == 0)) + xkbi->xlib_ctrls &= ~XkbLC_BeepOnComposeFail; + else + xkbi->xlib_ctrls |= XkbLC_BeepOnComposeFail; + } + } + if ((xkbi->composeLED == None) && + ((xkbi->xlib_ctrls & XkbLC_ComposeLED) != 0)) + xkbi->composeLED = XInternAtom(dpy, "Compose", False); +#ifdef DEBUG + if (debugMsg) { + register unsigned c = xkbi->xlib_ctrls; + + fprintf(stderr, + "XKEYBOARD compose: beep on failure is %s, LED is %s\n", + ((c & XkbLC_BeepOnComposeFail) ? "on" : "off"), + ((c & XkbLC_ComposeLED) ? "on" : "off")); + fprintf(stderr, + "XKEYBOARD XLookupString: %slatin-1, %s lookup modifiers\n", + ((c & XkbLC_ForceLatin1Lookup) ? "allow non-" : "force "), + ((c & XkbLC_ConsumeLookupMods) ? "consume" : "re-use")); + fprintf(stderr, + "XKEYBOARD XLookupString: %sconsume shift and lock, %scontrol fallback\n", + ((c & XkbLC_AlwaysConsumeShiftAndLock) ? "always " : + "don't "), ((c & XkbLC_ControlFallback) ? "" : "no ")); + + } +#endif + } + else + xkbi = dpy->xkb_info; + + forceIgnore = (dpy->flags & XlibDisplayNoXkb) || dpy->keysyms; + forceIgnore = forceIgnore && (major_rtrn == NULL) && (minor_rtrn == NULL); + if (forceIgnore || _XkbIgnoreExtension || getenv("XKB_DISABLE")) { + LockDisplay(dpy); + dpy->flags |= XlibDisplayNoXkb; + UnlockDisplay(dpy); + if (debugMsg) + fprintf(stderr, "XKEYBOARD extension disabled or missing\n"); + return False; + } + + if ((codes = XInitExtension(dpy, XkbName)) == NULL) { + LockDisplay(dpy); + dpy->flags |= XlibDisplayNoXkb; + UnlockDisplay(dpy); + if (debugMsg) + fprintf(stderr, "XKEYBOARD extension not present\n"); + return False; + } + xkbi->codes = codes; + LockDisplay(dpy); + + GetReq(kbUseExtension, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbUseExtension; + req->wantedMajor = XkbMajorVersion; + req->wantedMinor = XkbMinorVersion; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse) || !rep.supported) { + Bool fail = True; + + if (debugMsg) + fprintf(stderr, + "XKEYBOARD version mismatch (want %d.%02d, got %d.%02d)\n", + XkbMajorVersion, XkbMinorVersion, + rep.serverMajor, rep.serverMinor); + + /* pre-release 0.65 is very close to 1.00 */ + if ((rep.serverMajor == 0) && (rep.serverMinor == 65)) { + if (debugMsg) + fprintf(stderr, "Trying to fall back to version 0.65..."); + GetReq(kbUseExtension, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbUseExtension; + req->wantedMajor = 0; + req->wantedMinor = 65; + if (_XReply(dpy, (xReply *) &rep, 0, xFalse) && rep.supported) { + if (debugMsg) + fprintf(stderr, "succeeded\n"); + fail = False; + } + else if (debugMsg) + fprintf(stderr, "failed\n"); + } + if (fail) { + dpy->flags |= XlibDisplayNoXkb; + UnlockDisplay(dpy); + SyncHandle(); + if (major_rtrn) + *major_rtrn = rep.serverMajor; + if (minor_rtrn) + *minor_rtrn = rep.serverMinor; + return False; + } + } +#ifdef DEBUG + else if (forceIgnore) { + fprintf(stderr, + "Internal Error! XkbUseExtension succeeded with forceIgnore set\n"); + } +#endif + UnlockDisplay(dpy); + xkbi->srv_major = rep.serverMajor; + xkbi->srv_minor = rep.serverMinor; + if (major_rtrn) + *major_rtrn = rep.serverMajor; + if (minor_rtrn) + *minor_rtrn = rep.serverMinor; + if (debugMsg) + fprintf(stderr, "XKEYBOARD (version %d.%02d/%d.%02d) OK!\n", + XkbMajorVersion, XkbMinorVersion, + rep.serverMajor, rep.serverMinor); + + ev_base = codes->first_event; + XESetWireToEvent(dpy, ev_base + XkbEventCode, wire_to_event); + SyncHandle(); + return True; +} diff --git a/nx-X11/lib/src/xkb/XKBleds.c b/nx-X11/lib/src/xkb/XKBleds.c new file mode 100644 index 000000000..c098ee948 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBleds.c @@ -0,0 +1,338 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#define NEED_MAP_READERS +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include +#include "XKBlibint.h" + +Status +XkbGetIndicatorState(Display *dpy, unsigned deviceSpec, unsigned *pStateRtrn) +{ + register xkbGetIndicatorStateReq *req; + xkbGetIndicatorStateReply rep; + XkbInfoPtr xkbi; + Bool ok; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbGetIndicatorState, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetIndicatorState; + req->deviceSpec = deviceSpec; + ok = _XReply(dpy, (xReply *) &rep, 0, xFalse); + if (ok && (pStateRtrn != NULL)) + *pStateRtrn = rep.state; + UnlockDisplay(dpy); + SyncHandle(); + return (ok ? Success : BadImplementation); +} + +Status +_XkbReadGetIndicatorMapReply(Display *dpy, + xkbGetIndicatorMapReply *rep, + XkbDescPtr xkb, + int *nread_rtrn) +{ + XkbIndicatorPtr leds; + XkbReadBufferRec buf; + + if ((!xkb->indicators) && (XkbAllocIndicatorMaps(xkb) != Success)) + return BadAlloc; + leds = xkb->indicators; + + leds->phys_indicators = rep->realIndicators; + if (rep->length > 0) { + register int left; + + if (!_XkbInitReadBuffer(dpy, &buf, (int) rep->length * 4)) + return BadAlloc; + if (nread_rtrn) + *nread_rtrn = (int) rep->length * 4; + if (rep->which) { + register int i, bit; + + left = (int) rep->which; + for (i = 0, bit = 1; (i < XkbNumIndicators) && (left); + i++, bit <<= 1) { + if (left & bit) { + xkbIndicatorMapWireDesc *wire; + + wire = (xkbIndicatorMapWireDesc *) + _XkbGetReadBufferPtr(&buf, + SIZEOF(xkbIndicatorMapWireDesc)); + if (wire == NULL) { + _XkbFreeReadBuffer(&buf); + return BadAlloc; + } + leds->maps[i].flags = wire->flags; + leds->maps[i].which_groups = wire->whichGroups; + leds->maps[i].groups = wire->groups; + leds->maps[i].which_mods = wire->whichMods; + leds->maps[i].mods.mask = wire->mods; + leds->maps[i].mods.real_mods = wire->realMods; + leds->maps[i].mods.vmods = wire->virtualMods; + leds->maps[i].ctrls = wire->ctrls; + left &= ~bit; + } + } + } + left = _XkbFreeReadBuffer(&buf); + } + return Success; +} + +Bool +XkbGetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) +{ + register xkbGetIndicatorMapReq *req; + xkbGetIndicatorMapReply rep; + XkbInfoPtr xkbi; + Status status; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return BadAccess; + if ((!which) || (!xkb)) + return BadValue; + + LockDisplay(dpy); + xkbi = dpy->xkb_info; + if (!xkb->indicators) { + xkb->indicators = _XkbTypedCalloc(1, XkbIndicatorRec); + if (!xkb->indicators) { + UnlockDisplay(dpy); + SyncHandle(); + return BadAlloc; + } + } + GetReq(kbGetIndicatorMap, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetIndicatorMap; + req->deviceSpec = xkb->device_spec; + req->which = (CARD32) which; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return BadValue; + } + status = _XkbReadGetIndicatorMapReply(dpy, &rep, xkb, NULL); + UnlockDisplay(dpy); + SyncHandle(); + return status; +} + +Bool +XkbSetIndicatorMap(Display *dpy, unsigned long which, XkbDescPtr xkb) +{ + register xkbSetIndicatorMapReq *req; + register int i, bit; + int nMaps; + xkbIndicatorMapWireDesc *wire; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + if ((!xkb) || (!which) || (!xkb->indicators)) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetIndicatorMap, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetIndicatorMap; + req->deviceSpec = xkb->device_spec; + req->which = (CARD32) which; + for (i = nMaps = 0, bit = 1; i < 32; i++, bit <<= 1) { + if (which & bit) + nMaps++; + } + req->length += (nMaps * sizeof(XkbIndicatorMapRec)) / 4; + BufAlloc(xkbIndicatorMapWireDesc *, wire, + (nMaps * SIZEOF(xkbIndicatorMapWireDesc))); + for (i = 0, bit = 1; i < 32; i++, bit <<= 1) { + if (which & bit) { + wire->flags = xkb->indicators->maps[i].flags; + wire->whichGroups = xkb->indicators->maps[i].which_groups; + wire->groups = xkb->indicators->maps[i].groups; + wire->whichMods = xkb->indicators->maps[i].which_mods; + wire->mods = xkb->indicators->maps[i].mods.real_mods; + wire->virtualMods = xkb->indicators->maps[i].mods.vmods; + wire->ctrls = xkb->indicators->maps[i].ctrls; + wire++; + } + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbGetNamedDeviceIndicator(Display *dpy, + unsigned device, + unsigned class, + unsigned id, + Atom name, + int *pNdxRtrn, + Bool *pStateRtrn, + XkbIndicatorMapPtr pMapRtrn, + Bool *pRealRtrn) +{ + register xkbGetNamedIndicatorReq *req; + xkbGetNamedIndicatorReply rep; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || (name == None) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbGetNamedIndicator, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbGetNamedIndicator; + req->deviceSpec = device; + req->ledClass = class; + req->ledID = id; + req->indicator = (CARD32) name; + if (!_XReply(dpy, (xReply *) &rep, 0, xFalse)) { + UnlockDisplay(dpy); + SyncHandle(); + return False; + } + UnlockDisplay(dpy); + SyncHandle(); + if ((!rep.found) || (!rep.supported)) + return False; + if (pNdxRtrn != NULL) + *pNdxRtrn = rep.ndx; + if (pStateRtrn != NULL) + *pStateRtrn = rep.on; + if (pMapRtrn != NULL) { + pMapRtrn->flags = rep.flags; + pMapRtrn->which_groups = rep.whichGroups; + pMapRtrn->groups = rep.groups; + pMapRtrn->which_mods = rep.whichMods; + pMapRtrn->mods.mask = rep.mods; + pMapRtrn->mods.real_mods = rep.realMods; + pMapRtrn->mods.vmods = rep.virtualMods; + pMapRtrn->ctrls = rep.ctrls; + } + if (pRealRtrn != NULL) + *pRealRtrn = rep.realIndicator; + return True; +} + +Bool +XkbGetNamedIndicator(Display *dpy, + Atom name, + int *pNdxRtrn, + Bool *pStateRtrn, + XkbIndicatorMapPtr pMapRtrn, + Bool *pRealRtrn) +{ + return XkbGetNamedDeviceIndicator(dpy, XkbUseCoreKbd, + XkbDfltXIClass, XkbDfltXIId, + name, pNdxRtrn, pStateRtrn, + pMapRtrn, pRealRtrn); +} + +Bool +XkbSetNamedDeviceIndicator(Display *dpy, + unsigned device, + unsigned class, + unsigned id, + Atom name, + Bool changeState, + Bool state, + Bool createNewMap, + XkbIndicatorMapPtr pMap) +{ + register xkbSetNamedIndicatorReq *req; + XkbInfoPtr xkbi; + + if ((dpy->flags & XlibDisplayNoXkb) || (name == None) || + (!dpy->xkb_info && !XkbUseExtension(dpy, NULL, NULL))) + return False; + LockDisplay(dpy); + xkbi = dpy->xkb_info; + GetReq(kbSetNamedIndicator, req); + req->reqType = xkbi->codes->major_opcode; + req->xkbReqType = X_kbSetNamedIndicator; + req->deviceSpec = device; + req->ledClass = class; + req->ledID = id; + req->indicator = (CARD32) name; + req->setState = changeState; + if (req->setState) + req->on = state; + else + req->on = False; + if (pMap != NULL) { + req->setMap = True; + req->createMap = createNewMap; + req->flags = pMap->flags; + req->whichGroups = pMap->which_groups; + req->groups = pMap->groups; + req->whichMods = pMap->which_mods; + req->realMods = pMap->mods.real_mods; + req->virtualMods = pMap->mods.vmods; + req->ctrls = pMap->ctrls; + } + else { + req->setMap = False; + req->createMap = False; + req->flags = 0; + req->whichGroups = 0; + req->groups = 0; + req->whichMods = 0; + req->realMods = 0; + req->virtualMods = 0; + req->ctrls = 0; + } + UnlockDisplay(dpy); + SyncHandle(); + return True; +} + +Bool +XkbSetNamedIndicator(Display *dpy, + Atom name, + Bool changeState, + Bool state, + Bool createNewMap, + XkbIndicatorMapPtr pMap) +{ + return XkbSetNamedDeviceIndicator(dpy, XkbUseCoreKbd, + XkbDfltXIClass, XkbDfltXIId, + name, changeState, state, + createNewMap, pMap); +} diff --git a/nx-X11/lib/src/xkb/XKBlibint.h b/nx-X11/lib/src/xkb/XKBlibint.h new file mode 100644 index 000000000..dad48b703 --- /dev/null +++ b/nx-X11/lib/src/xkb/XKBlibint.h @@ -0,0 +1,337 @@ +/************************************************************ +Copyright (c) 1993 by Silicon Graphics Computer Systems, Inc. + +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 supporting +documentation, and that the name of Silicon Graphics not be +used in advertising or publicity pertaining to distribution +of the software without specific prior written permission. +Silicon Graphics makes no representation about the suitability +of this software for any purpose. It is provided "as is" +without any express or implied warranty. + +SILICON GRAPHICS DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS +SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL SILICON +GRAPHICS 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. + +********************************************************/ + +#ifndef _XKBLIBINT_H_ +#define _XKBLIBINT_H_ + +#include +#include + +#define XkbMapPending (1<<0) +#define XkbXlibNewKeyboard (1<<1) + +typedef int (*XkbKSToMBFunc)( + XPointer /* priv */, + KeySym /* sym */, + char * /* buf */, + int /* len */, + int * /* extra_rtrn */ +); + +typedef KeySym (*XkbMBToKSFunc)( + XPointer /* priv */, + char * /* buf */, + int /* len */, + Status * /* status */ +); + +typedef KeySym (*XkbToUpperFunc)( + KeySym /* sym */ +); + +typedef struct _XkbConverters { + XkbKSToMBFunc KSToMB; + XPointer KSToMBPriv; + XkbMBToKSFunc MBToKS; + XPointer MBToKSPriv; + XkbToUpperFunc KSToUpper; +} XkbConverters; + +extern XkbInternAtomFunc _XkbInternAtomFunc; +extern XkbGetAtomNameFunc _XkbGetAtomNameFunc; + +typedef struct _XkbInfoRec { + unsigned flags; + unsigned xlib_ctrls; + XExtCodes *codes; + int srv_major; + int srv_minor; + unsigned selected_events; + unsigned short selected_nkn_details; + unsigned short selected_map_details; + XkbDescRec *desc; + XkbMapChangesRec changes; + Atom composeLED; + XkbConverters cvt; + XkbConverters latin1cvt; +} XkbInfoRec, *XkbInfoPtr; + + +#define _XkbUnavailable(d) \ + (((d)->flags&XlibDisplayNoXkb) || \ + ((!(d)->xkb_info || (!(d)->xkb_info->desc)) && !_XkbLoadDpy(d))) + +#define _XkbCheckPendingRefresh(d,xi) { \ + if ((xi)->flags&XkbXlibNewKeyboard) \ + _XkbReloadDpy((d)); \ + else if ((xi)->flags&XkbMapPending) { \ + if (XkbGetMapChanges((d),(xi)->desc, &(xi)->changes)==Success) { \ + LockDisplay((d)); \ + (xi)->changes.changed= 0; \ + UnlockDisplay((d)); \ + } \ + } \ +} + +#define _XkbNeedModmap(i) ((!(i)->desc->map)||(!(i)->desc->map->modmap)) + + /* + * mask of the events that the "invisible" XKB support in Xlib needs + */ +#define XKB_XLIB_MAP_MASK (XkbAllClientInfoMask) + + /* + * Handy helper macros + */ + +typedef struct _XkbReadBuffer { + int error; + int size; + char *start; + char *data; +} XkbReadBufferRec, *XkbReadBufferPtr; + +#define _XkbAlloc(s) Xmalloc((s)) +#define _XkbCalloc(n,s) Xcalloc((n),(s)) +#define _XkbRealloc(o,s) Xrealloc((o),(s)) +#define _XkbTypedAlloc(t) ((t *)Xmalloc(sizeof(t))) +#define _XkbTypedCalloc(n,t) ((t *)Xcalloc((n),sizeof(t))) +#define _XkbTypedRealloc(o,n,t) \ + ((o) ? (t *)Xrealloc((o), (n)*sizeof(t)) : _XkbTypedCalloc(n,t)) +#define _XkbClearElems(a,f,l,t) bzero(&(a)[f], ((l)-(f)+1) * sizeof(t)) +#define _XkbFree(p) Xfree(p) + +_XFUNCPROTOBEGIN + +extern void _XkbReloadDpy( + Display * /* dpy */ +); + +extern KeySym _XKeycodeToKeysym( + Display * /* display */, +#if NeedWidePrototypes + unsigned int /* keycode */, +#else + KeyCode /* keycode */, +#endif + int /* index */ +); + +extern KeyCode _XKeysymToKeycode( + Display * /* display */, + KeySym /* keysym */ +); + +extern KeySym _XLookupKeysym( + XKeyEvent * /* key_event */, + int /* index */ +); + +extern int _XRefreshKeyboardMapping( + XMappingEvent * /* event_map */ +); + +extern unsigned _XKeysymToModifiers( + Display * /* dpy */, + KeySym /* ks */ +); + +extern int _XTranslateKey( + register Display * /* dpy */, + KeyCode /* keycode */, + register unsigned int /* modifiers */, + unsigned int * /* modifiers_return */, + KeySym * /* keysym_return */ +); + +extern int _XTranslateKeySym( + Display * /* dpy */, + register KeySym /* symbol */, + unsigned int /* modifiers */, + char * /* buffer */, + int /* nbytes */ +); + +extern int _XLookupString( + register XKeyEvent * /* event */, + char * /* buffer */, + int /* nbytes */, + KeySym * /* keysym */, + XComposeStatus * /* status */ +); + +extern void _XkbNoteCoreMapChanges( + XkbMapChangesRec * /* old */, + XMappingEvent * /* new */, + unsigned int /* wanted */ +); + +extern int _XkbInitReadBuffer( + Display * /* dpy */, + XkbReadBufferPtr /* buf */, + int /* size */ +); + +extern int _XkbSkipReadBufferData( + XkbReadBufferPtr /* from */, + int /* size */ +); + +extern int _XkbCopyFromReadBuffer( + XkbReadBufferPtr /* from */, + char * /* to */, + int /* size */ +); + + +#ifdef LONG64 +extern int _XkbReadCopyData32( + int * /* from */, + long * /* to */, + int /* num_words */ +); + +extern int _XkbWriteCopyData32( + unsigned long * /* from */, + CARD32 * /* to */, + int /* num_words */ +); + +extern int _XkbReadBufferCopy32( + XkbReadBufferPtr /* from */, + long * /* to */, + int /* size */ +); +#else +#define _XkbReadCopyData32(f,t,s) memcpy((char *)(t), (char *)(f), (s)*4) +#define _XkbWriteCopyData32(f,t,s) memcpy((char *)(t), (char *)(f), (s)*4) +#define _XkbReadBufferCopy32(f,t,s) _XkbCopyFromReadBuffer(f, (char *)t, (s)*4) +#endif + +#ifndef NO_DEC_BINARY_COMPATIBILITY +#define XKB_FORCE_INT_KEYSYM 1 +#endif + +#ifdef XKB_FORCE_INT_KEYSYM +extern int _XkbReadCopyKeySyms( + int * /* from */, + KeySym * /* to */, + int /* num_words */ +); + +extern int _XkbWriteCopyKeySyms( + KeySym * /* from */, + CARD32 * /* to */, + int /* num_words */ +); + +extern int _XkbReadBufferCopyKeySyms( + XkbReadBufferPtr /* from */, +#ifndef NO_DEC_BUG_FIX + KeySym * /* to */, +#else + long * /* to */, +#endif + int /* size */ +); +#else +#define _XkbReadCopyKeySyms(f,t,n) _XkbReadCopyData32(f,t,n) +#define _XkbWriteCopyKeySyms(f,t,n) _XkbWriteCopyData32(f,t,n) +#define _XkbReadBufferCopyKeySyms(f,t,s) _XkbReadBufferCopy32(f,t,s) +#endif + +extern char *_XkbPeekAtReadBuffer( + XkbReadBufferPtr /* from */, + int /* size */ +); + +extern char *_XkbGetReadBufferPtr( + XkbReadBufferPtr /* from */, + int /* size */ +); +#define _XkbGetTypedRdBufPtr(b,n,t) ((t *)_XkbGetReadBufferPtr(b,(n)*SIZEOF(t))) + +extern int _XkbFreeReadBuffer( + XkbReadBufferPtr /* buf */ +); + +extern Bool +_XkbGetReadBufferCountedString( + XkbReadBufferPtr /* buf */, + char ** /* rtrn */ +); + +extern char *_XkbGetCharset( + void +); + +extern int _XkbGetConverters( + const char * /* encoding_name */, + XkbConverters * /* cvt_rtrn */ +); + +#ifdef NEED_MAP_READERS + +extern Status _XkbReadGetMapReply( + Display * /* dpy */, + xkbGetMapReply * /* rep */, + XkbDescRec * /* xkb */, + int * /* nread_rtrn */ +); + +extern Status _XkbReadGetCompatMapReply( + Display * /* dpy */, + xkbGetCompatMapReply * /* rep */, + XkbDescPtr /* xkb */, + int * /* nread_rtrn */ +); + +extern Status _XkbReadGetIndicatorMapReply( + Display * /* dpy */, + xkbGetIndicatorMapReply * /* rep */, + XkbDescPtr /* xkb */, + int * /* nread_rtrn */ +); + +extern Status _XkbReadGetNamesReply( + Display * /* dpy */, + xkbGetNamesReply * /* rep */, + XkbDescPtr /* xkb */, + int * /* nread_rtrn */ +); + +extern Status _XkbReadGetGeometryReply( + Display * /* dpy */, + xkbGetGeometryReply * /* rep */, + XkbDescPtr /* xkb */, + int * /* nread_rtrn */ +); + +#endif + +_XFUNCPROTOEND + +#endif /* _XKBLIBINT_H_ */ diff --git a/nx-X11/lib/src/xlibi18n/ICWrap.c b/nx-X11/lib/src/xlibi18n/ICWrap.c new file mode 100644 index 000000000..69f080d87 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/ICWrap.c @@ -0,0 +1,432 @@ +/* + * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, + * and Nippon Telegraph and Telephone Corporation + * Copyright 1991 by the Open Software Foundation + * Copyright 1993 by the FUJITSU LIMITED + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 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, + * 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 + * SHALL OMRON, NTT SOFTWARE, NTT, OR OPEN SOFTWARE FOUNDATION 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. + * + * Authors: Li Yuhong OMRON Corporation + * Tatsuya Kato NTT Software Corporation + * Hiroshi Kuribayashi OMRON Coproration + * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. + * + * M. Collins OSF + * Takashi Fujiwara FUJITSU LIMITED + */ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +static int +_XIMNestedListToNestedList( + XIMArg *nlist, /* This is the new list */ + XIMArg *list) /* The original list */ +{ + register XIMArg *ptr = list; + + while (ptr->name) { + if (!strcmp(ptr->name, XNVaNestedList)) { + nlist += _XIMNestedListToNestedList(nlist, (XIMArg *)ptr->value); + } else { + nlist->name = ptr->name; + nlist->value = ptr->value; + ptr++; + nlist++; + } + } + return ptr - list; +} + +static void +_XIMCountNestedList( + XIMArg *args, + int *total_count) +{ + for (; args->name; args++) { + if (!strcmp(args->name, XNVaNestedList)) + _XIMCountNestedList((XIMArg *)args->value, total_count); + else + ++(*total_count); + } +} + +static void +_XIMCountVaList(va_list var, int *total_count) +{ + char *attr; + + *total_count = 0; + + for (attr = va_arg(var, char*); attr; attr = va_arg(var, char*)) { + if (!strcmp(attr, XNVaNestedList)) { + _XIMCountNestedList(va_arg(var, XIMArg*), total_count); + } else { + (void)va_arg(var, XIMArg*); + ++(*total_count); + } + } +} + +static void +_XIMVaToNestedList(va_list var, int max_count, XIMArg **args_return) +{ + XIMArg *args; + char *attr; + + if (max_count <= 0) { + *args_return = (XIMArg *)NULL; + return; + } + + args = Xmalloc(((unsigned)max_count + 1) * sizeof(XIMArg)); + *args_return = args; + if (!args) return; + + for (attr = va_arg(var, char*); attr; attr = va_arg(var, char*)) { + if (!strcmp(attr, XNVaNestedList)) { + args += _XIMNestedListToNestedList(args, va_arg(var, XIMArg*)); + } else { + args->name = attr; + args->value = va_arg(var, XPointer); + args++; + } + } + args->name = (char*)NULL; +} + +/*ARGSUSED*/ +XVaNestedList +XVaCreateNestedList(int dummy, ...) +{ + va_list var; + XIMArg *args = NULL; + int total_count; + + va_start(var, dummy); + _XIMCountVaList(var, &total_count); + va_end(var); + + va_start(var, dummy); + _XIMVaToNestedList(var, total_count, &args); + va_end(var); + + return (XVaNestedList)args; +} + +char * +XSetIMValues(XIM im, ...) +{ + va_list var; + int total_count; + XIMArg *args; + char *ret = NULL; + + /* + * so count the stuff dangling here + */ + va_start(var, im); + _XIMCountVaList(var, &total_count); + va_end(var); + + /* + * now package it up so we can send it along + */ + va_start(var, im); + _XIMVaToNestedList(var, total_count, &args); + va_end(var); + + if (im && im->methods) + ret = (*im->methods->set_values) (im, args); + Xfree(args); + return ret; +} + +char * +XGetIMValues(XIM im, ...) +{ + va_list var; + int total_count; + XIMArg *args; + char *ret = NULL; + + /* + * so count the stuff dangling here + */ + va_start(var, im); + _XIMCountVaList(var, &total_count); + va_end(var); + + /* + * now package it up so we can send it along + */ + va_start(var, im); + _XIMVaToNestedList(var, total_count, &args); + va_end(var); + + if (im && im->methods) + ret = (*im->methods->get_values) (im, args); + Xfree(args); + return ret; +} + +/* + * Create an input context within the input method, + * and return a pointer to the input context. + */ + +XIC +XCreateIC(XIM im, ...) +{ + va_list var; + int total_count; + XIMArg *args; + XIC ic = NULL; + + /* + * so count the stuff dangling here + */ + va_start(var, im); + _XIMCountVaList(var, &total_count); + va_end(var); + + /* + * now package it up so we can send it along + */ + va_start(var, im); + _XIMVaToNestedList(var, total_count, &args); + va_end(var); + + if (im && im->methods) + ic = (XIC) (*im->methods->create_ic) (im, args); + Xfree(args); + if (ic) { + ic->core.next = im->core.ic_chain; + im->core.ic_chain = ic; + } + return ic; +} + +/* + * Free the input context. + */ +void +XDestroyIC(XIC ic) +{ + XIM im = ic->core.im; + XIC *prev; + + (*ic->methods->destroy) (ic); + if (im) { + for (prev = &im->core.ic_chain; *prev; prev = &(*prev)->core.next) { + if (*prev == ic) { + *prev = ic->core.next; + break; + } + } + } + Xfree (ic); +} + +char * +XGetICValues(XIC ic, ...) +{ + va_list var; + int total_count; + XIMArg *args; + char *ret; + + if (!ic->core.im) + return (char *) NULL; + + /* + * so count the stuff dangling here + */ + va_start(var, ic); + _XIMCountVaList(var, &total_count); + va_end(var); + + /* + * now package it up so we can send it along + */ + va_start(var, ic); + _XIMVaToNestedList(var, total_count, &args); + va_end(var); + + ret = (*ic->methods->get_values) (ic, args); + Xfree(args); + return ret; +} + +char * +XSetICValues(XIC ic, ...) +{ + va_list var; + int total_count; + XIMArg *args; + char *ret; + + if (!ic->core.im) + return (char *) NULL; + + /* + * so count the stuff dangling here + */ + va_start(var, ic); + _XIMCountVaList(var, &total_count); + va_end(var); + + /* + * now package it up so we can send it along + */ + va_start(var, ic); + _XIMVaToNestedList(var, total_count, &args); + va_end(var); + + ret = (*ic->methods->set_values) (ic, args); + Xfree(args); + return ret; +} + +/* + * Require the input manager to focus the focus window attached to the ic + * argument. + */ +void +XSetICFocus(XIC ic) +{ + if (ic && ic->core.im) + (*ic->methods->set_focus) (ic); +} + +/* + * Require the input manager to unfocus the focus window attached to the ic + * argument. + */ +void +XUnsetICFocus(XIC ic) +{ + if (ic->core.im) + (*ic->methods->unset_focus) (ic); +} + +/* + * Return the XIM associated with the input context. + */ +XIM +XIMOfIC(XIC ic) +{ + return ic->core.im; +} + +char * +XmbResetIC(XIC ic) +{ + if (ic->core.im) + return (*ic->methods->mb_reset)(ic); + return (char *)NULL; +} + +wchar_t * +XwcResetIC(XIC ic) +{ + if (ic->core.im) + return (*ic->methods->wc_reset)(ic); + return (wchar_t *)NULL; +} + +char * +Xutf8ResetIC(XIC ic) +{ + if (ic->core.im) { + if (ic->methods->utf8_reset) + return (*ic->methods->utf8_reset)(ic); + else if (ic->methods->mb_reset) + return (*ic->methods->mb_reset)(ic); + } + return (char *)NULL; +} + +int +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, + keysym, status); + return XLookupNone; +} + +int +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, + keysym, status); + return XLookupNone; +} + +int +Xutf8LookupString(XIC ic, XKeyEvent *ev, char *buffer, int nbytes, + KeySym *keysym, Status *status) +{ + if (ic->core.im) { + if (ic->methods->utf8_lookup_string) + return (*ic->methods->utf8_lookup_string) (ic, ev, buffer, nbytes, + keysym, status); + else if (ic->methods->mb_lookup_string) + return (*ic->methods->mb_lookup_string) (ic, ev, buffer, nbytes, + keysym, status); + } + return XLookupNone; +} diff --git a/nx-X11/lib/src/xlibi18n/IMWrap.c b/nx-X11/lib/src/xlibi18n/IMWrap.c new file mode 100644 index 000000000..a7c1d98c1 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/IMWrap.c @@ -0,0 +1,204 @@ +/* + * Copyright 1991 by the Open Software Foundation + * Copyright 1993, 1994 by the Sony Corporation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 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. + * It is provided "as is" without express or implied warranty. + * + * 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 OPEN + * SOFTWARE FOUNDATIONN 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 OF OR IN CONNECTION WITH THE USE OR + * PERFORMANCE OF THIS SOFTWARE. + * + * M. Collins OSF + * Makoto Wakamatsu Sony Corporation + */ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +/* + * Compile the resource name. (resource_name ---> xrm_name) + */ +void +_XIMCompileResourceList(XIMResourceList res, unsigned int num_res) +{ + register unsigned int count; + + for (count = 0; count < num_res; res++, count++) { + res->xrm_name = XrmStringToQuark(res->resource_name); + } +} + +void +_XCopyToArg(XPointer src, XPointer *dst, unsigned int size) +{ + if (!*dst) { + union { + long longval; +#ifdef LONG64 + int intval; +#endif + short shortval; + char charval; + char* charptr; + XPointer ptr; + } u; + if (size <= sizeof(XPointer)) { + memcpy((char *)&u, (char *)src, (int)size); + if (size == sizeof(long)) *dst = (XPointer)u.longval; +#ifdef LONG64 + else if (size == sizeof(int)) *dst = (XPointer)(long)u.intval; +#endif + else if (size == sizeof(short)) *dst = (XPointer)(long)u.shortval; + else if (size == sizeof(char)) *dst = (XPointer)(long)u.charval; + else if (size == sizeof(char*)) *dst = (XPointer)u.charptr; + else if (size == sizeof(XPointer)) *dst = (XPointer)u.ptr; + else memcpy( (char*)dst, (char*)src, (int)size ); + } else { + memcpy( (char*)dst, (char*)src, (int)size ); + } + } else { + memcpy( (char*)*dst, (char*)src, (int)size ); + } +} + +/* + * Connects to an input method matching current locale specification, creates + * a XIM object and return a pointer the newly created XIM back to the caller. + */ + +XIM +XOpenIM(Display *display, XrmDatabase rdb, char *res_name, char *res_class) +{ + XLCd lcd = _XOpenLC( (char *)NULL ); + + if( !lcd ) + return( (XIM)NULL ); + return (*lcd->methods->open_im) (lcd, display, rdb, res_name, res_class); +} + +/* + * Close the connection to the input manager, and free the XIM structure + */ +Status +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; + Xfree (im); + _XCloseLC (lcd); + return (s); +} + +/* + * Return the Display associated with the input method. + */ +Display * +XDisplayOfIM(XIM im) +{ + return im->core.display; +} + +/* + * Return the Locale associated with the input method. + */ +char * +XLocaleOfIM(XIM im) +{ + return im->core.lcd->core->name; +} + +/* + * Register to a input method instantiation callback to prepare the + * on-demand input method instantiation. + */ +Bool +XRegisterIMInstantiateCallback( + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data) +{ + XLCd lcd = _XOpenLC( (char *)NULL ); + + if( !lcd ) + return( False ); + return( (*lcd->methods->register_callback)( lcd, display, rdb, res_name, + res_class, callback, + client_data ) ); +} + +/* + * Unregister to a input method instantiation callback. + */ +Bool +XUnregisterIMInstantiateCallback( + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data) +{ + XLCd lcd = _XlcCurrentLC(); + + if( !lcd ) + return( False ); + if( lcd->methods->unregister_callback == NULL ) + return( False ); + return( (*lcd->methods->unregister_callback)( lcd, display, rdb, res_name, + res_class, callback, + client_data ) ); +} + diff --git a/nx-X11/lib/src/xlibi18n/Makefile.am b/nx-X11/lib/src/xlibi18n/Makefile.am new file mode 100644 index 000000000..a6f42baf4 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/Makefile.am @@ -0,0 +1,72 @@ +NULL = + +noinst_LTLIBRARIES = libi18n.la + +AM_CPPFLAGS = \ + -I$(top_srcdir)/include \ + -I$(top_srcdir)/include/X11 \ + -I$(top_builddir)/include \ + -I$(top_builddir)/include/X11 \ + -I$(top_srcdir)/src/xcms \ + -I$(top_srcdir)/src/xkb \ + -I$(top_srcdir)/src/xlibi18n \ + -I$(top_srcdir)/src \ + -I$(top_srcdir)/../exports/include \ + -D_GNU_SOURCE \ + $(NULL) + +AM_CFLAGS = \ + $(X11_CFLAGS) \ + $(BIGFONT_CFLAGS) \ + $(XMALLOC_ZERO_CFLAGS) \ + $(CWARNFLAGS) \ + $(NULL) + +IM_LIBS = \ + ${top_builddir}/modules/im/ximcp/libximcp.la \ + $(NULL) + +LC_LIBS = \ + ${top_builddir}/modules/lc/def/libxlcDef.la \ + ${top_builddir}/modules/lc/gen/libxlibi18n.la \ + ${top_builddir}/modules/lc/Utf8/libxlcUTF8Load.la \ + $(NULL) + +OM_LIBS = \ + ${top_builddir}/modules/om/generic/libxomGeneric.la \ + $(NULL) + +libi18n_la_LIBADD = \ + $(IM_LIBS) \ + $(LC_LIBS) \ + $(OM_LIBS) \ + $(NULL) + +libi18n_la_SOURCES = \ + $(XI18N_DL_SOURCES) \ + xim_trans.c \ + ICWrap.c \ + IMWrap.c \ + imKStoUCS.c \ + lcCT.c \ + lcCharSet.c \ + lcConv.c \ + lcDB.c \ + lcFile.c \ + lcGeneric.c \ + lcInit.c \ + lcPrTxt.c \ + lcPubWrap.c \ + lcPublic.c \ + lcRM.c \ + lcStd.c \ + lcTxtPr.c \ + lcUTF8.c \ + lcUtil.c \ + lcWrap.c \ + mbWMProps.c \ + mbWrap.c \ + utf8WMProps.c \ + utf8Wrap.c \ + wcWrap.c \ + $(NULL) diff --git a/nx-X11/lib/src/xlibi18n/XimImSw.h b/nx-X11/lib/src/xlibi18n/XimImSw.h new file mode 100644 index 000000000..e3a962552 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimImSw.h @@ -0,0 +1,46 @@ +/****************************************************************** + + Copyright 1992, 1993 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifndef _XIMIMSW_H +#define _XIMIMSW_H + +typedef struct { + Bool (*checkprocessing)( + Xim im + ); + Bool (*im_open)( + Xim im + ); + void (*im_free)( + Xim im + ); +} XimImsportSW; + +extern XimImsportSW _XimImSportRec[]; + +#endif /* _XIMIMSW_H */ diff --git a/nx-X11/lib/src/xlibi18n/XimProto.h b/nx-X11/lib/src/xlibi18n/XimProto.h new file mode 100644 index 000000000..6b0096dd6 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimProto.h @@ -0,0 +1,226 @@ +/****************************************************************** + + Copyright 1992, 1993 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifndef _XIMPROTO_H +#define _XIMPROTO_H + +/* + * Default Preconnection selection target + */ +#define XIM_SERVERS "XIM_SERVERS" +#define XIM_LOCALES "LOCALES" +#define XIM_TRANSPORT "TRANSPORT" + +/* + * categories in XIM_SERVERS + */ +#define XIM_SERVER_CATEGORY "@server=" +#define XIM_LOCAL_CATEGORY "@locale=" +#define XIM_TRANSPORT_CATEGORY "@transport=" + +/* + * Xim implementation revision + */ +#define PROTOCOLMAJORVERSION 1 +#define PROTOCOLMINORVERSION 0 + +/* + * Major Protocol number + */ +#define XIM_CONNECT 1 +#define XIM_CONNECT_REPLY 2 +#define XIM_DISCONNECT 3 +#define XIM_DISCONNECT_REPLY 4 + +#define XIM_AUTH_REQUIRED 10 +#define XIM_AUTH_REPLY 11 +#define XIM_AUTH_NEXT 12 +#define XIM_AUTH_SETUP 13 +#define XIM_AUTH_NG 14 + +#define XIM_ERROR 20 + +#define XIM_OPEN 30 +#define XIM_OPEN_REPLY 31 +#define XIM_CLOSE 32 +#define XIM_CLOSE_REPLY 33 +#define XIM_REGISTER_TRIGGERKEYS 34 +#define XIM_TRIGGER_NOTIFY 35 +#define XIM_TRIGGER_NOTIFY_REPLY 36 +#define XIM_SET_EVENT_MASK 37 +#define XIM_ENCODING_NEGOTIATION 38 +#define XIM_ENCODING_NEGOTIATION_REPLY 39 +#define XIM_QUERY_EXTENSION 40 +#define XIM_QUERY_EXTENSION_REPLY 41 +#define XIM_SET_IM_VALUES 42 +#define XIM_SET_IM_VALUES_REPLY 43 +#define XIM_GET_IM_VALUES 44 +#define XIM_GET_IM_VALUES_REPLY 45 + +#define XIM_CREATE_IC 50 +#define XIM_CREATE_IC_REPLY 51 +#define XIM_DESTROY_IC 52 +#define XIM_DESTROY_IC_REPLY 53 +#define XIM_SET_IC_VALUES 54 +#define XIM_SET_IC_VALUES_REPLY 55 +#define XIM_GET_IC_VALUES 56 +#define XIM_GET_IC_VALUES_REPLY 57 +#define XIM_SET_IC_FOCUS 58 +#define XIM_UNSET_IC_FOCUS 59 +#define XIM_FORWARD_EVENT 60 +#define XIM_SYNC 61 +#define XIM_SYNC_REPLY 62 +#define XIM_COMMIT 63 +#define XIM_RESET_IC 64 +#define XIM_RESET_IC_REPLY 65 + +#define XIM_GEOMETRY 70 +#define XIM_STR_CONVERSION 71 +#define XIM_STR_CONVERSION_REPLY 72 +#define XIM_PREEDIT_START 73 +#define XIM_PREEDIT_START_REPLY 74 +#define XIM_PREEDIT_DRAW 75 +#define XIM_PREEDIT_CARET 76 +#define XIM_PREEDIT_CARET_REPLY 77 +#define XIM_PREEDIT_DONE 78 +#define XIM_STATUS_START 79 +#define XIM_STATUS_DRAW 80 +#define XIM_STATUS_DONE 81 +#define XIM_PREEDITSTATE 82 + +/* + * values for the flag of XIM_ERROR + */ +#define XIM_IMID_VALID 0x0001 +#define XIM_ICID_VALID 0x0002 + +/* + * XIM Error Code + */ +#define XIM_BadAlloc 1 +#define XIM_BadStyle 2 +#define XIM_BadClientWindow 3 +#define XIM_BadFocusWindow 4 +#define XIM_BadArea 5 +#define XIM_BadSpotLocation 6 +#define XIM_BadColormap 7 +#define XIM_BadAtom 8 +#define XIM_BadPixel 9 +#define XIM_BadPixmap 10 +#define XIM_BadName 11 +#define XIM_BadCursor 12 +#define XIM_BadProtocol 13 +#define XIM_BadForeground 14 +#define XIM_BadBackground 15 +#define XIM_LocaleNotSupported 16 +#define XIM_BadSomething 999 + +/* + * byte order + */ +#define BIGENDIAN (CARD8)0x42 /* MSB first */ +#define LITTLEENDIAN (CARD8)0x6c /* LSB first */ + +/* + * values for the type of XIMATTR & XICATTR + */ +#define XimType_SeparatorOfNestedList 0 +#define XimType_CARD8 1 +#define XimType_CARD16 2 +#define XimType_CARD32 3 +#define XimType_STRING8 4 +#define XimType_Window 5 +#define XimType_XIMStyles 10 +#define XimType_XRectangle 11 +#define XimType_XPoint 12 +#define XimType_XFontSet 13 +#define XimType_XIMOptions 14 +#define XimType_XIMHotKeyTriggers 15 +#define XimType_XIMHotKeyState 16 +#define XimType_XIMStringConversion 17 +#define XimType_NEST 0x7fff + +/* + * values for the category of XIM_ENCODING_NEGITIATON_REPLY + */ +#define XIM_Encoding_NameCategory 0 +#define XIM_Encoding_DetailCategory 1 + +/* + * value for the index of XIM_ENCODING_NEGITIATON_REPLY + */ +#define XIM_Default_Encoding_IDX -1 + +/* + * value for the flag of XIM_FORWARD_EVENT, XIM_COMMIT + */ +#define XimSYNCHRONUS 0x0001 +#define XimLookupChars 0x0002 +#define XimLookupKeySym 0x0004 +#define XimLookupBoth 0x0006 + +/* + * request packet header size + */ +#define XIM_HEADER_SIZE \ + sizeof(CARD8) /* sizeof mejor-opcode */ \ + + sizeof(CARD8) /* sizeof minor-opcode */ \ + + sizeof(INT16) /* sizeof length */ + +/* + * Client Message data size + */ +#define XIM_CM_DATA_SIZE 20 + +/* + * XIM data structure + */ +typedef CARD16 BITMASK16; +typedef CARD32 BITMASK32; +typedef CARD32 EVENTMASK; + +typedef CARD16 XIMID; /* Input Method ID */ +typedef CARD16 XICID; /* Input Context ID */ + +/* + * Padding macro + */ +#define XIM_PAD(length) ((4 - ((length) % 4)) % 4) + +#define XIM_SET_PAD(ptr, length) \ + { \ + register int Counter = XIM_PAD((int)length); \ + if (Counter) { \ + register char *Ptr = (char *)(ptr) + (length); \ + length += Counter; \ + for (; Counter; --Counter, ++Ptr) \ + *Ptr = '\0'; \ + } \ + } + +#endif /* _XIMPROTO_H */ diff --git a/nx-X11/lib/src/xlibi18n/XimThai.h b/nx-X11/lib/src/xlibi18n/XimThai.h new file mode 100644 index 000000000..7cc238311 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimThai.h @@ -0,0 +1,110 @@ +/*********************************************************** + +Copyright 1993, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +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, +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 Digital not be +used in advertising or publicity pertaining to distribution of the +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 +DIGITAL 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. + +******************************************************************/ + +/* +**++ +** FACILITY: +** +** Xlib +** +** ABSTRACT: +** +** Definition file for Thai specific functions. +** +** MODIFICATION HISTORY: +** +**/ + +#ifndef _XIMTHAI_H_ +#define _XIMTHAI_H_ + +#include + +/* Classification of characters in TIS620 according to WTT */ + +#define CTRL 0 /* control chars */ +#define NON 1 /* non composibles */ +#define CONS 2 /* consonants */ +#define LV 3 /* leading vowels */ +#define FV1 4 /* following vowels */ +#define FV2 5 +#define FV3 6 +#define BV1 7 /* below vowels */ +#define BV2 8 +#define BD 9 /* below diacritics */ +#define TONE 10 /* tonemarks */ +#define AD1 11 /* above diacritics */ +#define AD2 12 +#define AD3 13 +#define AV1 14 /* above vowels */ +#define AV2 15 +#define AV3 16 + + +/* extended classification */ + +#define DEAD 17 /* group of non-spacing characters */ + + +/* display levels in display cell */ + +#define NONDISP 0 /* non displayable */ +#define TOP 1 +#define ABOVE 2 +#define BASE 3 +#define BELOW 4 + + +/* Input Sequence Check modes */ + +#define WTT_ISC1 1 /* WTT default ISC mode */ +#define WTT_ISC2 2 /* WTT strict ISC mode */ +#define THAICAT_ISC 3 /* THAICAT ISC mode */ +#define NOISC 255 /* No ISC */ + + +#endif /* _XIMTHAI_H_ */ diff --git a/nx-X11/lib/src/xlibi18n/XimTrInt.h b/nx-X11/lib/src/xlibi18n/XimTrInt.h new file mode 100644 index 000000000..bceab9886 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimTrInt.h @@ -0,0 +1,85 @@ +/* + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifndef _XIMTRINT_H +#define _XIMTRINT_H + +#include "Ximint.h" + +typedef struct { + const char *transportname; + Bool (*config)( + Xim, + char * + ); +} TransportSW; + +extern TransportSW _XimTransportRec[]; + +/* + * Global symbols + */ + +extern Bool _XimXConf( + Xim im, + char *address +); + +#if defined(TCPCONN) || defined(UNIXCONN) + +extern Bool _XimTransConf( + Xim im, + char *address +); + +#endif + +#endif /* _XIMTRINT_H */ diff --git a/nx-X11/lib/src/xlibi18n/XimTrX.h b/nx-X11/lib/src/xlibi18n/XimTrX.h new file mode 100644 index 000000000..198d5fa5f --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimTrX.h @@ -0,0 +1,85 @@ +/* + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifndef _XIMTRX_H +#define _XIMTRX_H + +typedef struct _XIntrCallbackRec *XIntrCallbackPtr; + +typedef struct _XIntrCallbackRec { + Bool (*func)( + Xim, INT16, XPointer, XPointer +); + XPointer call_data; + XIntrCallbackPtr next; +} XIntrCallbackRec ; + +typedef struct _XSpecRec { + XIntrCallbackPtr intr_cb; + Atom imconnectid; + Atom improtocolid; + Atom immoredataid; + Window lib_connect_wid; + Window ims_connect_wid; + XPointer ev; + CARD32 major_code; + CARD32 minor_code; + CARD32 BoundarySize; +} XSpecRec; + +#define _XIM_PROTOCOL "_XIM_PROTOCOL" +#define _XIM_XCONNECT "_XIM_XCONNECT" +#define _XIM_MOREDATA "_XIM_MOREDATA" + +#define MAJOR_TRANSPORT_VERSION 0 +#define MINOR_TRANSPORT_VERSION 0 + +#endif /* _XIMTRX_H */ diff --git a/nx-X11/lib/src/xlibi18n/XimTrans.h b/nx-X11/lib/src/xlibi18n/XimTrans.h new file mode 100644 index 000000000..8c3aa829a --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimTrans.h @@ -0,0 +1,136 @@ +/* + * Copyright 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + +Permission to use, copy, modify, distribute, and sell this software +and its 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 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. +It is provided "as is" without express or implied warranty. + +FUJITSU LIMITED DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, +INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO +EVENT SHALL FUJITSU LIMITED 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: Hideki Hiura (hhiura@Sun.COM) Sun Microsystems, Inc. + Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + +******************************************************************/ + +#ifndef _XIMTRANS_H +#define _XIMTRANS_H + +typedef struct _TransIntrCallbackRec *TransIntrCallbackPtr; + +typedef struct _TransIntrCallbackRec { + Bool (*func)( + Xim, INT16, XPointer, XPointer + ); + XPointer call_data; + TransIntrCallbackPtr next; +} TransIntrCallbackRec ; + +typedef struct { + TransIntrCallbackPtr intr_cb; + struct _XtransConnInfo *trans_conn; /* transport connection object */ + int fd; + char *address; + Window window; + Bool is_putback; +} TransSpecRec; + + +/* + * Prototypes + */ + +extern Bool _XimTransRegisterDispatcher( + Xim im, + Bool (*callback)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data +); + + +extern Bool _XimTransIntrCallback( + Xim im, + Bool (*callback)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data +); + +extern Bool _XimTransCallDispatcher( + Xim im, + INT16 len, + XPointer data +); + +extern void _XimFreeTransIntrCallback( + Xim im +); + +extern Bool _XimTransFilterWaitEvent( + Display *d, + Window w, + XEvent *ev, + XPointer arg +); + +extern void _XimTransInternalConnection( + Display *d, + int fd, + XPointer arg +); + +extern Bool _XimTransWrite( + Xim im, + INT16 len, + XPointer data +); + +extern Bool _XimTransRead( + Xim im, + XPointer recv_buf, + int buf_len, + int *ret_len +); + +extern void _XimTransFlush( + Xim im +); + +#endif /* _XIMTRANS__H */ diff --git a/nx-X11/lib/src/xlibi18n/Ximint.h b/nx-X11/lib/src/xlibi18n/Ximint.h new file mode 100644 index 000000000..9550c6851 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/Ximint.h @@ -0,0 +1,995 @@ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993, 1994 by Sony Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED and +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. + +FUJITSU LIMITED AND SONY CORPORATION DISCLAIM ALL WARRANTIES WITH +REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL FUJITSU LIMITED AND +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. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Motifier: Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + +******************************************************************/ + +#ifndef _XIMINT_H +#define _XIMINT_H + +#include +#include + +typedef struct _Xim *Xim; +typedef struct _Xic *Xic; + +/* + * Input Method data + */ +#include "XimintP.h" +#include "XimintL.h" + +/* + * XIM dependent data + */ + +typedef struct _XimCommonPrivateRec { + /* This struct is also inlined in XimLocalPrivateRec, XimProtoPrivateRec. */ + XlcConv ctom_conv; + XlcConv ctow_conv; + XlcConv ctoutf8_conv; + XlcConv cstomb_conv; + XlcConv cstowc_conv; + XlcConv cstoutf8_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; +} XimCommonPrivateRec; + +typedef union _XIMPrivateRec { + XimCommonPrivateRec common; + XimLocalPrivateRec local; + XimProtoPrivateRec proto; +} XIMPrivateRec; + +/* + * IM struct + */ +typedef struct _Xim { + XIMMethods methods; + XIMCoreRec core; + XIMPrivateRec private; +} XimRec; + +/* + * IC deprndent data + */ +typedef union _XICPrivateRec { + XicLocalPrivateRec local; + XicProtoPrivateRec proto; +} XICPrivateRec; + +/* + * IC struct + */ +typedef struct _Xic { + XICMethods methods; + XICCoreRec core; + XICPrivateRec private; +} XicRec; + +typedef struct _XimDefIMValues { + XIMValuesList *im_values_list; + XIMValuesList *ic_values_list; + XIMStyles *styles; + XIMCallback destroy_callback; + char *res_name; + char *res_class; + Bool visible_position; +} XimDefIMValues; + +typedef struct _XimDefICValues { + XIMStyle input_style; + Window client_window; + Window focus_window; + unsigned long filter_events; + XICCallback geometry_callback; + char *res_name; + char *res_class; + XICCallback destroy_callback; + XICCallback preedit_state_notify_callback; + XICCallback string_conversion_callback; + XIMStringConversionText string_conversion; + XIMResetState reset_state; + XIMHotKeyTriggers *hotkey; + XIMHotKeyState hotkey_state; + ICPreeditAttributes preedit_attr; + ICStatusAttributes status_attr; +} XimDefICValues; + +#define XIM_MODE_IM_GET (1 << 0) +#define XIM_MODE_IM_SET (1 << 1) +#define XIM_MODE_IM_DEFAULT (1 << 2) + +#define XIM_MODE_PRE_GET (1 << 0) +#define XIM_MODE_PRE_SET (1 << 1) +#define XIM_MODE_PRE_CREATE (1 << 2) +#define XIM_MODE_PRE_ONCE (1 << 3) +#define XIM_MODE_PRE_DEFAULT (1 << 4) + +#define XIM_MODE_STS_GET (1 << 5) +#define XIM_MODE_STS_SET (1 << 6) +#define XIM_MODE_STS_CREATE (1 << 7) +#define XIM_MODE_STS_ONCE (1 << 8) +#define XIM_MODE_STS_DEFAULT (1 << 9) + +#define XIM_MODE_IC_GET (XIM_MODE_PRE_GET | XIM_MODE_STS_GET) +#define XIM_MODE_IC_SET (XIM_MODE_PRE_SET | XIM_MODE_STS_SET) +#define XIM_MODE_IC_CREATE (XIM_MODE_PRE_CREATE | XIM_MODE_STS_CREATE) +#define XIM_MODE_IC_ONCE (XIM_MODE_PRE_ONCE | XIM_MODE_STS_ONCE) +#define XIM_MODE_IC_DEFAULT (XIM_MODE_PRE_DEFAULT | XIM_MODE_STS_DEFAULT) + +#define XIM_MODE_PRE_MASK (XIM_MODE_PRE_GET | XIM_MODE_PRE_SET | \ + XIM_MODE_PRE_CREATE | XIM_MODE_PRE_ONCE | \ + XIM_MODE_PRE_DEFAULT) +#define XIM_MODE_STS_MASK (XIM_MODE_STS_GET | XIM_MODE_STS_SET | \ + XIM_MODE_STS_CREATE | XIM_MODE_STS_ONCE | \ + XIM_MODE_STS_DEFAULT) + +#define XIM_SETIMDEFAULTS (1L << 0) +#define XIM_SETIMVALUES (1L << 1) +#define XIM_GETIMVALUES (1L << 2) + +#define XIM_SETICDEFAULTS (1L << 0) +#define XIM_CREATEIC (1L << 1) +#define XIM_SETICVALUES (1L << 2) +#define XIM_GETICVALUES (1L << 3) +#define XIM_PREEDIT_ATTR (1L << 4) +#define XIM_STATUS_ATTR (1L << 5) + +#define XIM_CHECK_VALID 0 +#define XIM_CHECK_INVALID 1 +#define XIM_CHECK_ERROR 2 + +#define FILTERD True +#define NOTFILTERD False + +#define XIMMODIFIER "@im=" + +#define XIM_TRUE True +#define XIM_FALSE False +#define XIM_OVERFLOW (-1) + +#define BRL_UC_ROW 0x2800 + +/* + * Global symbols + */ + +XPointer _XimGetLocaleCode ( + const char *encoding_name +); + +int _XimGetCharCode ( + XPointer conv, + KeySym keysym, + unsigned char *buf, + int nbytes +); + +unsigned int KeySymToUcs4 ( + KeySym keysym +); + +extern Bool _XimSetIMResourceList( + XIMResourceList *res_list, + unsigned int *list_num +); + +extern Bool _XimSetICResourceList( + XIMResourceList *res_list, + unsigned int *list_num +); + +extern Bool _XimSetInnerIMResourceList( + XIMResourceList *res_list, + unsigned int *list_num +); + +extern Bool _XimSetInnerICResourceList( + XIMResourceList *res_list, + unsigned int *list_num +); + +extern Bool _XimCheckCreateICValues( + XIMResourceList res_list, + unsigned int list_num +); + +extern XIMResourceList _XimGetResourceListRec( + XIMResourceList res_list, + unsigned int list_num, + const char *name +); + +extern void _XimSetIMMode( + XIMResourceList res_list, + unsigned int list_num +); + +extern void _XimSetICMode( + XIMResourceList res_list, + unsigned int list_num, + XIMStyle style +); + +extern int _XimCheckIMMode( + XIMResourceList res_list, + unsigned long mode +); + +extern int _XimCheckICMode( + XIMResourceList res_list, + unsigned long mode +); + +extern Bool _XimSetLocalIMDefaults( + Xim im, + XPointer top, + XIMResourceList res_list, + unsigned int list_num +); + +extern Bool _XimSetICDefaults( + Xic ic, + XPointer top, + unsigned long mode, + XIMResourceList res_list, + unsigned int list_num +); + +extern Bool _XimEncodeLocalIMAttr( + XIMResourceList res, + XPointer top, + XPointer val +); + +extern Bool _XimEncodeLocalICAttr( + Xic ic, + XIMResourceList res, + XPointer top, + XIMArg *arg, + unsigned long mode +); + +extern Bool _XimCheckLocalInputStyle( + Xic ic, + XPointer top, + XIMArg *values, + XIMStyles *styles, + XIMResourceList res_list, + unsigned int list_num +); + +extern Bool _XimDecodeLocalIMAttr( + XIMResourceList res, + XPointer top, + XPointer val +); + +extern Bool _XimDecodeLocalICAttr( + XIMResourceList res, + XPointer top, + XPointer val, + unsigned long mode +); + +extern void _XimGetCurrentIMValues( + Xim im, + XimDefIMValues *im_values +); + +extern void _XimSetCurrentIMValues( + Xim im, + XimDefIMValues *im_values +); + +extern void _XimGetCurrentICValues( + Xic ic, + XimDefICValues *ic_values +); + +extern void _XimSetCurrentICValues( + Xic ic, + XimDefICValues *ic_values +); + +extern void _XimInitialResourceInfo( + void +); + +extern void _XimParseStringFile( + FILE *fp, + Xim im +); + +extern Bool _XimCheckIfLocalProcessing( + Xim im +); + +extern Bool _XimCheckIfThaiProcessing( + Xim im +); + +extern Bool _XimLocalOpenIM( + Xim im +); + +extern Bool _XimThaiOpenIM( + Xim im +); + +extern Bool _XimProtoOpenIM( + Xim im +); + +extern void _XimLocalIMFree( + Xim im +); + +extern void _XimThaiIMFree( + Xim im +); + +extern void _XimProtoIMFree( + Xim im +); + +extern char * _XimSetIMValueData( + Xim im, + XPointer top, + XIMArg *arg, + XIMResourceList res_list, + unsigned int list_num +); + +extern char * _XimGetIMValueData( + Xim im, + XPointer top, + XIMArg *arg, + XIMResourceList res_list, + unsigned int list_num +); + +extern char * _XimSetICValueData( + Xic ic, + XPointer top, + XIMResourceList res_list, + unsigned int list_num, + XIMArg *arg, + unsigned long mode, + Bool flag +); + +extern char * _XimGetICValueData( + Xic ic, + XPointer top, + XIMResourceList res_list, + unsigned int list_num, + XIMArg *arg, + unsigned long mode +); + +extern char * _XimLocalSetIMValues( + XIM im, + XIMArg *arg +); + +extern char * _XimLocalGetIMValues( + XIM im, + XIMArg *arg +); + +extern XIC _XimLocalCreateIC( + XIM im, + XIMArg *arg +); + +extern Bool _XimDispatchInit( + Xim im +); + +extern Bool _XimGetAttributeID( + Xim im, + CARD16 *buf +); + +extern Bool _XimExtension( + Xim im +); + +extern void _XimDestroyIMStructureList( + Xim im +); + +extern char * _XimMakeIMAttrIDList( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + CARD16 *buf, + INT16 *len, + unsigned long mode +); + +extern char * _XimMakeICAttrIDList( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + CARD16 *idList, + INT16 *num, + unsigned long mode +); + +extern char * _XimDecodeIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + CARD16 *buf, + INT16 buf_len, + XIMArg *arg, + BITMASK32 mode +); + +extern char * _XimDecodeICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + CARD16 *buf, + INT16 buf_len, + XIMArg *arg, + BITMASK32 mode +); + +extern Bool _XimRegProtoIntrCallback( + Xim im, + CARD16 major_code, + CARD16 minor_code, + Bool (*proc)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data +); + +extern Bool _XimErrorCallback( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern Bool _XimError( + Xim im, + Xic ic, + CARD16 error_code, + INT16 detail_length, + CARD16 type, + char *detail +); + +extern Bool _XimRegisterTriggerKeysCallback( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern Bool _XimSetEventMaskCallback( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern Bool _XimForwardEventCallback( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern Bool _XimCommitCallback( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern Bool _XimSyncCallback( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern void _XimFreeProtoIntrCallback( + Xim im +); + +extern XIC _XimProtoCreateIC( + XIM im, + XIMArg *arg +); + +extern void _XimRegisterServerFilter( + Xim im +); + +extern void _XimUnregisterServerFilter( + Xim im +); + +extern Bool _XimTriggerNotify( + Xim im, + Xic ic, + int mode, + CARD32 idx +); + +extern Bool _XimProcSyncReply( + Xim im, + Xic ic +); + +extern void _XimSendSetFocus( + Xim im, + Xic ic +); + +extern Bool _XimForwardEvent( + Xic ic, + XEvent *ev, + Bool sync +); + +extern void _XimFreeRemakeArg( + XIMArg *arg +); + +extern void _XimServerDestroy( + Xim im +); + +extern char * _XimEncodeIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + XIMArg **arg_ret, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode +); + +extern char * _XimEncodeICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + XIMArg *arg, + XIMArg **arg_ret, + char *buf, + int size, + int *ret_len, + XPointer top, + BITMASK32 *flag, + unsigned long mode +); + +#ifdef EXT_MOVE +extern Bool _XimExtenMove( + Xim im, + Xic ic, + CARD32 flag, + CARD16 *buf, + INT16 length +); +#endif + +extern int _Ximctstombs( + XIM im, + char *from, + int from_len, + char *to, + int to_len, + Status *state +); + +extern int _Ximctstowcs( + XIM im, + char *from, + int from_len, + wchar_t *to, + int to_len, + Status *state +); + +extern int _Ximctstoutf8( + XIM im, + char *from, + int from_len, + char *to, + int to_len, + Status *state +); + +extern int _XimLcctstombs( + XIM im, + char *from, + int from_len, + char *to, + int to_len, + Status *state +); + +extern int _XimLcctstowcs( + XIM im, + char *from, + int from_len, + wchar_t *to, + int to_len, + Status *state +); + +extern int _XimLcctstoutf8( + XIM im, + char *from, + int from_len, + char *to, + int to_len, + Status *state +); + +extern char _XimGetMyEndian( + void +); + +extern int _XimCheckDataSize( + XPointer buf, + int len +); + +extern void _XimSetHeader( + XPointer buf, + CARD8 major_opcode, + CARD8 minor_opcode, + INT16 *len +); + +extern Bool _XimSync( + Xim im, + Xic ic +); + +extern int _XimProtoMbLookupString( + XIC xic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *state +); + +extern int _XimProtoWcLookupString( + XIC xic, + XKeyEvent *ev, + wchar_t *buffer, + int bytes, + KeySym *keysym, + Status *state +); + +extern int _XimProtoUtf8LookupString( + XIC xic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *state +); + +extern void _XimRegisterFilter( + Xic ic +); + +extern void _XimUnregisterFilter( + Xic ic +); + +extern void _XimReregisterFilter( + Xic ic +); + +extern Status _XimProtoEventToWire( + XEvent *re, + xEvent *event, + Bool sw +); + +extern Bool _XimProtoWireToEvent( + XEvent *re, + xEvent *event, + Bool sw +); + +#ifdef EXT_FORWARD +extern Bool _XimExtForwardKeyEvent( + Xic ic, + XKeyEvent *ev, + Bool sync +); +#endif + +extern int _XimLookupMBText( + Xic ic, + XKeyEvent *event, + char *buffer, + int nbytes, + KeySym *keysym, + XComposeStatus *status +); + +extern int _XimLookupWCText( + Xic ic, + XKeyEvent *event, + wchar_t *buffer, + int nbytes, + KeySym *keysym, + XComposeStatus *status +); + +extern int _XimLookupUTF8Text( + Xic ic, + XKeyEvent *event, + char *buffer, + int nbytes, + KeySym *keysym, + XComposeStatus *status +); + +extern EVENTMASK _XimGetWindowEventmask( + Xic ic +); + +extern Xic _XimICOfXICID( + Xim im, + XICID icid +); + +extern void _XimResetIMInstantiateCallback( + Xim xim +); + +extern Bool _XimRegisterIMInstantiateCallback( + XLCd lcd, + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data +); + +extern Bool _XimUnRegisterIMInstantiateCallback( + XLCd lcd, + Display *display, + XrmDatabase rdb, + char *res_name, + char *res_class, + XIDProc callback, + XPointer client_data +); + +extern void _XimFreeCommitInfo( + Xic ic +); + +extern Bool _XimConnect( + Xim im +); + +extern Bool _XimShutdown( + Xim im +); + +extern Bool _XimWrite( + Xim im, + INT16 len, + XPointer data +); + +extern Bool _XimRead( + Xim im, + INT16 *len, + XPointer data, + int data_len, + Bool (*predicate)( + Xim, INT16, XPointer, XPointer + ), + XPointer arg +); + +extern void _XimFlush( + Xim im +); + +extern Bool _XimFilterWaitEvent( + Xim im +); + +extern void _XimProcError( + Xim im, + Xic ic, + XPointer data +); + +#ifdef EXT_MOVE +extern CARD32 _XimExtenArgCheck( + XIMArg *arg +); +#endif + +extern Bool _XimCbDispatch( + Xim im, + INT16 len, + XPointer data, + XPointer call_data +); + +extern Bool _XimLocalFilter( + Display *d, + Window w, + XEvent *ev, + XPointer client_data +); + +extern XIMResourceList _XimGetResourceListRecByQuark( + XIMResourceList res_list, + unsigned int list_num, + XrmQuark quark +); + +extern Bool _XimReconnectModeCreateIC( + Xic ic +); + +extern char *_XimLocalSetICValues( + XIC ic, + XIMArg *values +); + +extern char * _XimLocalGetICValues( + XIC ic, + XIMArg *values +); + +extern int _XimLocalMbLookupString( + XIC ic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *status +); + +extern int _XimLocalWcLookupString( + XIC ic, + XKeyEvent *ev, + wchar_t *buffer, + int bytes, + KeySym *keysym, + Status *status +); + +extern int _XimLocalUtf8LookupString( + XIC ic, + XKeyEvent *ev, + char *buffer, + int bytes, + KeySym *keysym, + Status *status +); + +extern Bool _XimThaiFilter( + Display *d, + Window w, + XEvent *ev, + XPointer client_data +); + +extern XIC _XimThaiCreateIC( + XIM im, + XIMArg *values +); + +extern Status _XimThaiCloseIM( + XIM xim +); + +#ifdef XIM_CONNECTABLE +extern void _XimSetProtoResource( + Xim im +); + +extern Bool _XimConnectServer( + Xim im +); + +extern Bool _XimDelayModeSetAttr( + Xim im +); + +extern void _XimServerReconectableDestroy( + void +); + +extern Bool _XimReCreateIC( + Xic ic +); + +extern Bool _XimEncodeSavedIMATTRIBUTE( + Xim im, + XIMResourceList res_list, + unsigned int res_num, + int *idx, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode +); + +extern Bool _XimEncodeSavedICATTRIBUTE( + Xic ic, + XIMResourceList res_list, + unsigned int res_num, + int *idx, + char *buf, + int size, + int *ret_len, + XPointer top, + unsigned long mode +); +#endif + +extern Bool +_XimRegisterDispatcher( + Xim im, + Bool (*callback)( + Xim, INT16, XPointer, XPointer + ), + XPointer call_data); + +extern Bool +_XimRespSyncReply( + Xic ic, + BITMASK16 mode); + +#endif /* _XIMINT_H */ diff --git a/nx-X11/lib/src/xlibi18n/XimintL.h b/nx-X11/lib/src/xlibi18n/XimintL.h new file mode 100644 index 000000000..d2d92387f --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimintL.h @@ -0,0 +1,106 @@ +/****************************************************************** + + Copyright 1991, 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993 by Digital Equipment Corporation + +Permission to use, copy, modify, distribute, and sell this software +and its 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 FUJITSU LIMITED and +Digital Equipment Corporation not be used in advertising or publicity +pertaining to distribution of the software without specific, written +prior permission. FUJITSU LIMITED and Digital Equipment Corporation +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 +THIS SOFTWARE. + + Author: Takashi Fujiwara FUJITSU LIMITED + fujiwara@a80.tech.yk.fujitsu.co.jp + Modifier: Franky Ling Digital Equipment Corporation + frankyling@hgrd01.enet.dec.com + +******************************************************************/ + +#ifndef _XIMINTL_H +#define _XIMINTL_H + +#define COMPOSE_FILE "Compose" + +/* + * Data Structures for Local Processing + */ +typedef INT32 DTIndex; +typedef INT32 DTCharIndex; +typedef BITS32 DTModifier; + +typedef struct _DefTree { + DTIndex next; + DTIndex succession; /* successive Key Sequence */ + /* Key definitions */ + DTModifier modifier_mask; + DTModifier modifier; + KeySym keysym; /* leaf only */ + DTCharIndex mb; + DTCharIndex wc; /* make from mb */ + DTCharIndex utf8; /* make from mb */ + KeySym ks; +} DefTree; + +typedef struct _DefTreeBase { + DefTree *tree; + char *mb; + wchar_t *wc; + char *utf8; + DTIndex treeused, treesize; + DTCharIndex mbused, mbsize; + DTCharIndex wcused, wcsize; + DTCharIndex utf8used, utf8size; +} DefTreeBase; + +typedef struct _XimLocalPrivateRec { + /* The first fields are identical with XimCommonPrivateRec. */ + XlcConv ctom_conv; + XlcConv ctow_conv; + XlcConv ctoutf8_conv; + XlcConv cstomb_conv; + XlcConv cstowc_conv; + XlcConv cstoutf8_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; + + XIC current_ic; + DefTreeBase base; + DTIndex top; +} XimLocalPrivateRec; + +typedef struct _XicThaiPart { + int comp_state; + KeySym keysym; + int input_mode; +} XicThaiPart; + +typedef struct _XicLocalPrivateRec { + long value_mask; + DefTreeBase base; + DTIndex context; + DTIndex composed; + XicThaiPart thai; + + XIMResourceList ic_resources; + unsigned int ic_num_resources; + + unsigned char brl_pressed, brl_committing, brl_committed; + Time brl_release_start; +} XicLocalPrivateRec; +#endif /* _XIMINTL_H */ diff --git a/nx-X11/lib/src/xlibi18n/XimintP.h b/nx-X11/lib/src/xlibi18n/XimintP.h new file mode 100644 index 000000000..14a7e6d5a --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XimintP.h @@ -0,0 +1,310 @@ +/* + * Copyright 1991, 1992 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ +/****************************************************************** + + Copyright 1992, 1993, 1994 by FUJITSU LIMITED + Copyright 1993, 1994 by Sony Corporation + +Permission to use, copy, modify, distribute, and sell this software and +its 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 FUJITSU LIMITED and 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. + +FUJITSU LIMITED AND SONY CORPORATION DISCLAIMS ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND +FITNESS, IN NO EVENT SHALL FUJITSU LIMITED 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 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 + fujiwara@a80.tech.yk.fujitsu.co.jp + Makoto Wakamatsu Sony Corporation + makoto@sm.sony.co.jp + Hiroyuki Miyamoto Digital Equipment Corporation + miyamoto@jrd.dec.com + +******************************************************************/ + +#ifndef _XIMINTP_H +#define _XIMINTP_H + +#include "XimProto.h" +#include "XlcPublic.h" + +/* + * for protocol layer callback function + */ +typedef Bool (*XimProtoIntrProc)( + Xim, INT16, XPointer, XPointer +); +typedef struct _XimProtoIntrRec { + XimProtoIntrProc func; + CARD16 major_code; + CARD16 minor_code; + XPointer call_data; + struct _XimProtoIntrRec *next; +} XimProtoIntrRec; + +/* + * for transport layer methods + */ +typedef Bool (*XimTransConnectProc)( + Xim +); +typedef Bool (*XimTransShutdownProc)( + Xim +); +typedef Bool (*XimTransWriteProc)( + Xim, INT16, XPointer +); +typedef Bool (*XimTransReadProc)( + Xim, XPointer, int, int * +); +typedef void (*XimTransFlushProc)( + Xim +); +typedef Bool (*XimTransRegDispatcher)( + Xim, Bool (*)(Xim, INT16, XPointer, XPointer), XPointer +); +typedef Bool (*XimTransCallDispatcher)( + Xim, INT16, XPointer +); + +/* + * private part of IM + */ +typedef struct _XimProtoPrivateRec { + /* The first fields are identical with XimCommonPrivateRec. */ + XlcConv ctom_conv; + XlcConv ctow_conv; + XlcConv ctoutf8_conv; + XlcConv cstomb_conv; + XlcConv cstowc_conv; + XlcConv cstoutf8_conv; + XlcConv ucstoc_conv; + XlcConv ucstoutf8_conv; + + Window im_window; + XIMID imid; + CARD16 unused; + XIMStyles *default_styles; + CARD32 *im_onkeylist; + CARD32 *im_offkeylist; + BITMASK32 flag; + + BITMASK32 registed_filter_event; + EVENTMASK forward_event_mask; + EVENTMASK synchronous_event_mask; + + XimProtoIntrRec *intrproto; + XIMResourceList im_inner_resources; + unsigned int im_num_inner_resources; + XIMResourceList ic_inner_resources; + unsigned int ic_num_inner_resources; + char *hold_data; + int hold_data_len; + char *locale_name; + CARD16 protocol_major_version; + CARD16 protocol_minor_version; + XrmQuark *saved_imvalues; + int num_saved_imvalues; + + /* + * transport specific + */ + XimTransConnectProc connect; + XimTransShutdownProc shutdown; + XimTransWriteProc write; + XimTransReadProc read; + XimTransFlushProc flush; + XimTransRegDispatcher register_dispatcher; + XimTransCallDispatcher call_dispatcher; + XPointer spec; +} XimProtoPrivateRec; + +/* + * bit mask for the flag of XIMPrivateRec + */ +#define SERVER_CONNECTED (1L) +#define DYNAMIC_EVENT_FLOW (1L << 1) +#define USE_AUTHORIZATION_FUNC (1L << 2) +#ifdef XIM_CONNECTABLE +#define DELAYBINDABLE (1L << 3) +#define RECONNECTABLE (1L << 4) +#endif /* XIM_CONNECTABLE */ +#define FABRICATED (1L << 5) +#define NEED_SYNC_REPLY (1L << 6) + +/* + * macro for the flag of XIMPrivateRec + */ +#define IS_SERVER_CONNECTED(im) \ + ((((Xim)im))->private.proto.flag & SERVER_CONNECTED) +#define MARK_SERVER_CONNECTED(im) \ + ((((Xim)im))->private.proto.flag |= SERVER_CONNECTED) +#define UNMARK_SERVER_CONNECTED(im) \ + ((((Xim)im))->private.proto.flag &= ~SERVER_CONNECTED) + +#define IS_DYNAMIC_EVENT_FLOW(im) \ + (((Xim)im)->private.proto.flag & DYNAMIC_EVENT_FLOW) +#define MARK_DYNAMIC_EVENT_FLOW(im) \ + (((Xim)im)->private.proto.flag |= DYNAMIC_EVENT_FLOW) + +#define IS_USE_AUTHORIZATION_FUNC(im) \ + (((Xim)im)->private.proto.flag & USE_AUTHORIZATION_FUNC) +#define MARK_USE_AUTHORIZATION_FUNC(im) \ + (((Xim)im)->private.proto.flag |= USE_AUTHORIZATION_FUNC) + +#ifdef XIM_CONNECTABLE +#define IS_DELAYBINDABLE(im) \ + (((Xim)im)->private.proto.flag & DELAYBINDABLE) +#define MARK_DELAYBINDABLE(im) \ + (((Xim)im)->private.proto.flag |= DELAYBINDABLE) + +#define IS_RECONNECTABLE(im) \ + (((Xim)im)->private.proto.flag & RECONNECTABLE) +#define MARK_RECONNECTABLE(im) \ + (((Xim)im)->private.proto.flag |= RECONNECTABLE) + +#define IS_CONNECTABLE(im) \ + (((Xim)im)->private.proto.flag & (DELAYBINDABLE|RECONNECTABLE)) +#define UNMAKE_CONNECTABLE(im) \ + (((Xim)im)->private.proto.flag &= ~(DELAYBINDABLE|RECONNECTABLE)) +#endif /* XIM_CONNECTABLE */ + +#define IS_FABRICATED(im) \ + (((Xim)im)->private.proto.flag & FABRICATED) +#define MARK_FABRICATED(im) \ + (((Xim)im)->private.proto.flag |= FABRICATED) +#define UNMARK_FABRICATED(im) \ + (((Xim)im)->private.proto.flag &= ~FABRICATED) + +#define IS_NEED_SYNC_REPLY(im) \ + (((Xim)im)->private.proto.flag & NEED_SYNC_REPLY) +#define MARK_NEED_SYNC_REPLY(im) \ + (((Xim)im)->private.proto.flag |= NEED_SYNC_REPLY) +#define UNMARK_NEED_SYNC_REPLY(im) \ + (((Xim)im)->private.proto.flag &= ~NEED_SYNC_REPLY) + +/* + * bit mask for the register_filter_event of XIMPrivateRec/XICPrivateRec + */ +#define KEYPRESS_MASK (1L) +#define KEYRELEASE_MASK (1L << 1) +#define DESTROYNOTIFY_MASK (1L << 2) + +typedef struct _XimCommitInfoRec { + struct _XimCommitInfoRec *next; + char *string; + int string_len; + KeySym *keysym; + int keysym_len; +} XimCommitInfoRec, *XimCommitInfo; + +typedef struct _XimPendingCallback { + int major_opcode; + Xim im; + Xic ic; + char *proto; + int proto_len; + struct _XimPendingCallback *next; +} XimPendingCallbackRec, *XimPendingCallback; + + +/* + * private part of IC + */ +typedef struct _XicProtoPrivateRec { + XICID icid; /* ICID */ + CARD16 dmy; + BITMASK32 flag; /* Input Mode */ + + BITMASK32 registed_filter_event; /* registed filter mask */ + EVENTMASK forward_event_mask; /* forward event mask */ + EVENTMASK synchronous_event_mask;/* sync event mask */ + EVENTMASK filter_event_mask; /* negrect event mask */ + EVENTMASK intercept_event_mask; /* deselect event mask */ + EVENTMASK select_event_mask; /* select event mask */ + + char *preedit_font; /* Base font name list */ + int preedit_font_length; /* length of base font name */ + char *status_font; /* Base font name list */ + int status_font_length; /* length of base font name */ + + XimCommitInfo commit_info; + XIMResourceList ic_resources; + unsigned int ic_num_resources; + XIMResourceList ic_inner_resources; + unsigned int ic_num_inner_resources; + XrmQuark *saved_icvalues; + int num_saved_icvalues; + XimPendingCallback pend_cb_que; + Bool waitCallback; +} XicProtoPrivateRec ; + +/* + * bit mask for the flag of XICPrivateRec + */ +#define IC_CONNECTED (1L) + +/* + * macro for the flag of XICPrivateRec + */ +#define IS_IC_CONNECTED(ic) \ + (((Xic)ic)->private.proto.flag & IC_CONNECTED) +#define MARK_IC_CONNECTED(ic) \ + (((Xic)ic)->private.proto.flag |= IC_CONNECTED) +#define UNMARK_IC_CONNECTED(ic) \ + (((Xic)ic)->private.proto.flag &= ~IC_CONNECTED) + +/* + * macro for the filter_event_mask of XICPrivateRec + */ +#define IS_NEGLECT_EVENT(ic, mask) \ + (((Xic)ic)->private.proto.filter_event_mask & (mask)) + +/* + * macro for the forward_event_mask of XICPrivateRec + */ +#define IS_FORWARD_EVENT(ic, mask) \ + (((Xic)ic)->private.proto.forward_event_mask & (mask)) + +/* + * macro for the synchronous_event_mask of XICPrivateRec + */ +#define IS_SYNCHRONOUS_EVENT(ic, mask) \ + ((((Xic)ic)->private.proto.synchronous_event_mask & (mask)) ? True: False) + +#define XIM_MAXIMNAMELEN 64 +#define XIM_MAXLCNAMELEN 64 + +#endif /* _XIMINTP_H */ diff --git a/nx-X11/lib/src/xlibi18n/XlcGeneric.h b/nx-X11/lib/src/xlibi18n/XlcGeneric.h new file mode 100644 index 000000000..0c008fdaa --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XlcGeneric.h @@ -0,0 +1,162 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Takanori Tateno FUJITSU LIMITED + * + */ + +#ifndef _XLCGENERIC_H_ +#define _XLCGENERIC_H_ + +#include "XlcPubI.h" + +typedef struct _ByteInfo { + unsigned char start,end; +} ByteInfoRec, *ByteInfo; + +typedef struct _ByteInfoList { + int M; /* 1 <= M <= length */ + int byteinfo_num; + ByteInfo byteinfo; +} ByteInfoListRec, *ByteInfoList; + +/* conversion_type values */ +#define LOCALCONV 1 +#define FILECONV 2 +#define FUNCTIONCONV 4 + +typedef struct _Conversion { + unsigned long conversion_type; + int conv_num; + FontScope convlist; + char *cnv_file; + XlcConv cnvfunc; +} ConversionRec, *Conversion; + +typedef struct _ExtdSegment { + char *name; + XlcSide side; + FontScope area; + int area_num; + XlcCharSet charset; +} ExtdSegmentRec, *ExtdSegment; + +typedef struct _SegConvRec { + int length; + char *source_encoding; + XlcCharSet source; + char *destination_encoding; + XlcCharSet dest; + FontScopeRec range; + int conv_num; + FontScope conv; +} SegConvRec, *SegConv; + +typedef struct _ParseInfoRec *ParseInfo; + +typedef struct _CodeSetRec { + XlcCharSet *charset_list; + int num_charsets; + int cs_num; + XlcSide side; + int length; + ByteInfoList byteM; + Conversion mbconv; + Conversion ctconv; + ExtdSegment ctextseg; + ParseInfo parse_info; + unsigned long wc_encoding; + Bool string_encoding; +} CodeSetRec, *CodeSet; + +typedef enum { + E_GL, /* GL encoding */ + E_GR, /* GR encoding */ + E_SS, /* single shift */ + E_LSL, /* locking shift left */ + E_LSR, /* locking shift right */ + E_LAST +} EncodingType; + +typedef struct _ParseInfoRec { + EncodingType type; + char *encoding; + CodeSet codeset; +} ParseInfoRec; + +/* + * XLCd private data + */ + +#define XLC_GENERIC(lcd, x) (((XLCdGeneric) lcd->core)->gen.x) +#define XLC_GENERIC_PART(lcd) (&(((XLCdGeneric) lcd->core)->gen)) + +typedef struct _XLCdGenericPart { + int codeset_num; + CodeSet *codeset_list; + unsigned char *mb_parse_table; + int mb_parse_list_num; + ParseInfo *mb_parse_list; + unsigned long wc_encode_mask; + unsigned long wc_shift_bits; + CodeSet initial_state_GL; + CodeSet initial_state_GR; + int segment_conv_num; /* UDC */ + SegConv segment_conv; /* UDC */ + Bool use_stdc_env; + Bool force_convert_to_mb; +} XLCdGenericPart; + +typedef struct _XLCdGenericRec { + XLCdCoreRec core; + XLCdPublicPart pub; + XLCdGenericPart gen; +} XLCdGenericRec, *XLCdGeneric; + +extern XLCdMethods _XlcGenericMethods; + +extern FontScope +_XlcParse_scopemaps( + const char *str, + int *size); +extern void +_XlcDbg_printValue( + const char *str, + char **value, + int num); + +extern XIM +_XDefaultOpenIM( + XLCd lcd, + Display *dpy, + XrmDatabase rdb, + char *res_name, + char *res_class); + +#endif /* _XLCGENERIC_H_ */ diff --git a/nx-X11/lib/src/xlibi18n/XlcPubI.h b/nx-X11/lib/src/xlibi18n/XlcPubI.h new file mode 100644 index 000000000..c454c7ddd --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XlcPubI.h @@ -0,0 +1,298 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifndef _XLCPUBLICI_H_ +#define _XLCPUBLICI_H_ + +#include "XlcPublic.h" + +#define XLC_PUBLIC(lcd, x) (((XLCdPublic) lcd->core)->pub.x) +#define XLC_PUBLIC_PART(lcd) (&(((XLCdPublic) lcd->core)->pub)) +#define XLC_PUBLIC_METHODS(lcd) (&(((XLCdPublicMethods) lcd->methods)->pub)) + +/* + * XLCd public methods + */ + +typedef struct _XLCdPublicMethodsRec *XLCdPublicMethods; + +typedef XLCd (*XlcPubCreateProc)( + const char* name, + XLCdMethods methods +); + +typedef Bool (*XlcPubInitializeProc)( + XLCd lcd +); + +typedef void (*XlcPubDestroyProc)( + XLCd lcd +); + +typedef char* (*XlcPubGetValuesProc)( + XLCd lcd, + XlcArgList args, + int num_args +); + +typedef void (*XlcPubGetResourceProc)( + XLCd lcd, + const char* category, + const char* _class, + char*** value, + int* count +); + +typedef struct _XLCdPublicMethodsPart { + XLCdPublicMethods superclass; + XlcPubCreateProc create; + XlcPubInitializeProc initialize; + XlcPubDestroyProc destroy; + XlcPubGetValuesProc get_values; + XlcPubGetResourceProc get_resource; +} XLCdPublicMethodsPart; + +typedef struct _XLCdPublicMethodsRec { + XLCdMethodsRec core; + XLCdPublicMethodsPart pub; +} XLCdPublicMethodsRec; + +/* + * XLCd public data + */ + +typedef struct _XLCdPublicPart { + char *siname; /* for _XlcMapOSLocaleName() */ + char *language; /* language part of locale name */ + char *territory; /* territory part of locale name */ + char *codeset; /* codeset part of locale name */ + char *encoding_name; /* encoding name */ + int mb_cur_max; /* ANSI C MB_CUR_MAX */ + Bool is_state_depend; /* state-depend encoding */ + const char *default_string; /* for XDefaultString() */ + XPointer xlocale_db; +} XLCdPublicPart; + +typedef struct _XLCdPublicRec { + XLCdCoreRec core; + XLCdPublicPart pub; +} XLCdPublicRec, *XLCdPublic; + +extern XLCdMethods _XlcPublicMethods; + +_XFUNCPROTOBEGIN + +extern XLCd _XlcCreateLC( + const char* name, + XLCdMethods methods +); + +extern void _XlcDestroyLC( + XLCd lcd +); + +/* Fills into a freshly created XlcCharSet the fields that can be inferred + from the ESC sequence. These are side, char_size, set_size. */ +extern Bool _XlcParseCharSet( + XlcCharSet charset +); + +/* Creates a new XlcCharSet, given its name (including side suffix) and + Compound Text ESC sequence (normally at most 4 bytes). */ +extern XlcCharSet _XlcCreateDefaultCharSet( + const char* name, + const char* ct_sequence +); + +extern XlcCharSet _XlcAddCT( + const char* name, + const char* ct_sequence +); + +extern Bool _XlcInitCTInfo (void); + +extern XrmMethods _XrmDefaultInitParseInfo( + XLCd lcd, + XPointer* state +); + +extern int _XmbTextPropertyToTextList( + XLCd lcd, + Display* dpy, + const XTextProperty* text_prop, + char*** list_ret, + int* count_ret +); + +extern int _XwcTextPropertyToTextList( + XLCd lcd, + Display* dpy, + const XTextProperty* text_prop, + wchar_t*** list_ret, + int* count_ret +); + +extern int _Xutf8TextPropertyToTextList( + XLCd lcd, + Display* dpy, + const XTextProperty* text_prop, + char*** list_ret, + int* count_ret +); + +extern int _XmbTextListToTextProperty( + XLCd /* lcd */, + Display* /* dpy */, + char** /* list */, + int /* count */, + XICCEncodingStyle /* style */, + XTextProperty* /* text_prop */ +); + +extern int _XwcTextListToTextProperty( + XLCd /* lcd */, + Display* /* dpy */, + wchar_t** /* list */, + int /* count */, + XICCEncodingStyle /* style */, + XTextProperty* /* text_prop */ +); + +extern int _Xutf8TextListToTextProperty( + XLCd /* lcd */, + Display* /* dpy */, + char** /* list */, + int /* count */, + XICCEncodingStyle /* style */, + XTextProperty* /* text_prop */ +); + +extern void _XwcFreeStringList( + XLCd /* lcd */, + wchar_t** /* list */ +); + +extern int _XlcResolveLocaleName( + const char* lc_name, + XLCdPublicPart* pub +); + +extern int _XlcResolveI18NPath( + char* buf, + int buf_len +); + +extern char *_XlcLocaleLibDirName( + char* /* dir_name */, + size_t, /* dir_len */ + const char* /* lc_name */ +); + +extern char *_XlcLocaleDirName( + char* /* dir_name */, + size_t, /* dir_len */ + const char* /* lc_name */ +); + +extern XPointer _XlcCreateLocaleDataBase( + XLCd lcd +); + +extern void _XlcDestroyLocaleDataBase( + XLCd lcd +); + +extern void _XlcGetLocaleDataBase( + XLCd /* lcd */, + const char* /* category */, + const char* /* name */, + char*** /* value */, + int* /* count */ +); + +#if defined(__APPLE__) || defined(__DARWIN__) +extern char * +_Xsetlocale( + int category, + _Xconst char *name); +#endif +extern char *_XlcMapOSLocaleName( + char *osname, + char *siname); + +extern int +_Xmbstoutf8( + char *ustr, + const char *str, + int len); +extern int +_Xlcmbstoutf8( + XLCd lcd, + char *ustr, + const char *str, + int len); +extern int +_Xmbstowcs( + wchar_t *wstr, + char *str, + int len); +extern int +_Xlcwcstombs( + XLCd lcd, + char *str, + wchar_t *wstr, + int len); +extern int +_Xlcmbstowcs( + XLCd lcd, + wchar_t *wstr, + char *str, + int len); +extern int +_Xwcstombs( + char *str, + wchar_t *wstr, + int len); +extern int +_Xlcmbtowc( + XLCd lcd, + wchar_t *wstr, + char *str, + int len); +extern int +_Xlcwctomb( + XLCd lcd, + char *str, + wchar_t wc); + + + +extern XPointer +_Utf8GetConvByName( + const char *name); + +_XFUNCPROTOEND + +#endif /* _XLCPUBLICI_H_ */ diff --git a/nx-X11/lib/src/xlibi18n/XlcPublic.h b/nx-X11/lib/src/xlibi18n/XlcPublic.h new file mode 100644 index 000000000..3d94ef37d --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/XlcPublic.h @@ -0,0 +1,324 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Takanori Tateno FUJITSU LIMITED + * + */ +/* + * Most of this API is documented in i18n/Framework.PS + */ + +#ifndef _XLCPUBLIC_H_ +#define _XLCPUBLIC_H_ + +#include "Xlcint.h" + + +/* + * Character sets. + */ + +/* Every character set has a "side". It denotes the range of byte values for + which the character set is responsible. This means that the character + set's encoded characters will only assumes bytes within the range, and + that the character set can be used simultaneously with another character + set responsible for a disjoint range. */ +typedef enum { + XlcUnknown, + XlcC0, /* responsible for values 0x00..0x1F */ + XlcGL, /* responsible for values 0x00..0x7F or 0x20..0x7F */ + XlcC1, /* responsible for values 0x80..0x9F */ + XlcGR, /* responsible for values 0x80..0xFF or 0xA0..0xFF */ + XlcGLGR, /* responsible for values 0x00..0xFF */ + XlcOther, /* unused */ + XlcNONE +} XlcSide; + +/* Data read from XLC_LOCALE files. + XXX Apparently superseded by _XUDCGlyphRegion. */ +typedef struct _UDCArea { + unsigned long start; + unsigned long end; +} UDCAreaRec, *UDCArea; + +/* Where the character set comes from. */ +typedef enum { + CSsrcUndef, /* unused */ + CSsrcStd, /* defined in libX11 */ + CSsrcXLC /* defined in an XLC_LOCALE file */ +} CSSrc; + +/* These are the supported properties of XlcCharSet. */ +#define XlcNCharSize "charSize" +#define XlcNControlSequence "controlSequence" +#define XlcNEncodingName "encodingName" +#define XlcNName "name" +#define XlcNSetSize "setSize" +#define XlcNSide "side" + +/* This is the structure of an XlcCharSet. + Once allocated, they are never freed. */ +typedef struct _XlcCharSetRec { + /* Character set name, including side suffix */ + const char *name; + XrmQuark xrm_name; + + /* XLFD encoding name, no side suffix */ + const char *encoding_name; + XrmQuark xrm_encoding_name; + + /* Range for which the charset is responsible: XlcGL, XlcGR or XlcGLGR */ + XlcSide side; + + /* Number of bytes per character. 0 means a varying number (e.g. UTF-8) */ + int char_size; + /* Classification of the character set according to ISO-2022 */ + int set_size; /* e.g. 94 or 96 */ + const char *ct_sequence; /* control sequence of CT */ + /* (normally at most 4 bytes) */ + + /* for UDC */ + Bool string_encoding; + UDCArea udc_area; + int udc_area_num; + + /* Description source */ + CSSrc source; +} XlcCharSetRec, *XlcCharSet; + +_XFUNCPROTOBEGIN + +/* Returns the charset with the given name (including side suffix). + Returns NULL if not found. */ +extern XlcCharSet _XlcGetCharSet( + const char* name +); + +/* Returns the charset with the given encoding (no side suffix) and + responsible for at least the given side (XlcGL or XlcGR). + Returns NULL if not found. */ +extern XlcCharSet _XlcGetCharSetWithSide( + const char* encoding_name, + XlcSide side +); + +/* Registers an XlcCharSet in the list of character sets. + Returns True if successful. */ +extern Bool _XlcAddCharSet( + XlcCharSet charset +); + +/* Retrieves a number of attributes of an XlcCharSet. + Return NULL if successful, otherwise the name of the first argument + specifiying a nonexistent attribute. */ +extern char *_XlcGetCSValues( + XlcCharSet charset, + ... +); + +_XFUNCPROTOEND + + +#define XlcNCodeset "codeset" +#define XlcNDefaultString "defaultString" +#define XlcNLanguage "language" +#define XlcNMbCurMax "mbCurMax" +#define XlcNStateDependentEncoding "stateDependentEncoding" +#define XlcNTerritory "territory" + +typedef struct _FontScope { + unsigned long start; + unsigned long end; + unsigned long shift; + unsigned long shift_direction; +} FontScopeRec, *FontScope; + +/* + * conversion methods + */ + +typedef struct _XlcConvRec *XlcConv; + +typedef XlcConv (*XlcOpenConverterProc)( + XLCd from_lcd, + const char* from_type, + XLCd to_lcd, + const char* to_type +); + +typedef void (*XlcCloseConverterProc)( + XlcConv /* conv */ +); + +typedef int (*XlcConvertProc)( + XlcConv /* conv */, + XPointer* /* from */, + int* /* from_left */, + XPointer* /* to */, + int* /* to_left */, + XPointer* /* args */, + int /* num_args */ +); + +typedef void (*XlcResetConverterProc)( + XlcConv /* conv */ +); + +typedef struct _XlcConvMethodsRec{ + XlcCloseConverterProc close; + XlcConvertProc convert; + XlcResetConverterProc reset; +} XlcConvMethodsRec, *XlcConvMethods; + +/* + * conversion data + */ + +#define XlcNMultiByte "multiByte" +#define XlcNWideChar "wideChar" +#define XlcNCompoundText "compoundText" +#define XlcNString "string" +#define XlcNUtf8String "utf8String" +#define XlcNCharSet "charSet" +#define XlcNCTCharSet "CTcharSet" +#define XlcNFontCharSet "FontCharSet" +#define XlcNChar "char" +#define XlcNUcsChar "UCSchar" + +typedef struct _XlcConvRec { + XlcConvMethods methods; + XPointer state; +} XlcConvRec; + + +_XFUNCPROTOBEGIN + +extern Bool _XInitOM( + XLCd /* lcd */ +); + +extern Bool _XInitIM( + XLCd /* lcd */ +); + +extern XIM _XimOpenIM( + XLCd /* lcd */, + Display * /* dpy */, + XrmDatabase /* rdb */, + char * /* res_name */, + char * /* res_class */ +); + +extern char *_XGetLCValues( + XLCd /* lcd */, + ... +); + +extern XlcConv _XlcOpenConverter( + XLCd from_lcd, + const char* from_type, + XLCd to_lcd, + const char* to_type +); + +extern void _XlcCloseConverter( + XlcConv conv +); + +extern int _XlcConvert( + XlcConv conv, + XPointer* from, + int* from_left, + XPointer* to, + int* to_left, + XPointer* args, + int num_args +); + +extern void _XlcResetConverter( + XlcConv conv +); + +extern Bool _XlcSetConverter( + XLCd from_lcd, + const char* from_type, + XLCd to_lcd, + const char* to_type, + XlcOpenConverterProc open_converter +); + +extern void _XlcGetResource( + XLCd lcd, + const char* category, + const char* _class, + char*** value, + int* count +); + +extern char *_XlcFileName( + XLCd lcd, + const char* category +); + +extern int _Xwcslen( + wchar_t* /* wstr */ +); + +extern wchar_t *_Xwcscpy( + wchar_t* /* wstr1 */, + wchar_t* /* wstr2 */ +); + +extern wchar_t *_Xwcsncpy(wchar_t *wstr1, wchar_t *wstr2, int len); +extern int _Xwcscmp(wchar_t *wstr1, wchar_t *wstr2); +extern int _Xwcsncmp(wchar_t *wstr1, wchar_t *wstr2, int len); + +/* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. + Like strcasecmp in an ASCII locale. */ +extern int _XlcCompareISOLatin1( + const char* str1, + const char* str2 +); + +/* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring + case of ASCII letters. Like strncasecmp in an ASCII locale. */ +extern int _XlcNCompareISOLatin1( + const char* str1, + const char* str2, + int len +); + +extern XOM +_XDefaultOpenOM( + XLCd lcd, Display *dpy, XrmDatabase rdb, + _Xconst char *res_name, _Xconst char *res_class); + +_XFUNCPROTOEND + +#endif /* _XLCPUBLIC_H_ */ diff --git a/nx-X11/lib/src/xlibi18n/Xlcint.h b/nx-X11/lib/src/xlibi18n/Xlcint.h new file mode 100644 index 000000000..5a6205a1f --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/Xlcint.h @@ -0,0 +1,964 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * Copyright 1990, 1991 by OMRON Corporation, NTT Software Corporation, + * and Nippon Telegraph and Telephone Corporation + * Copyright 1991 by the Open Software Foundation + * Copyright 1993 by the TOSHIBA Corp. + * Copyright 1993, 1994 by Sony Corporation + * Copyright 1993, 1994 by the FUJITSU LIMITED + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 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, + * 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" + * 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 + * 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. + * + * Authors: Li Yuhong OMRON Corporation + * Tatsuya Kato NTT Software Corporation + * Hiroshi Kuribayashi OMRON Coproration + * Muneiyoshi Suzuki Nippon Telegraph and Telephone Co. + * + * M. Collins OSF + * Katsuhisa Yano TOSHIBA Corp. + * Makoto Wakamatsu Sony Corporation + * Takashi Fujiwara FUJITSU LIMITED + */ + + +#ifndef _XLCINT_H_ +#define _XLCINT_H_ + +#ifndef _XP_PRINT_SERVER_ + +#include +#include +#include + +typedef Bool (*XFilterEventProc)( + Display* /* display */, + Window /* window */, + XEvent* /* event */, + XPointer /* client_data */ +); + +typedef struct _XIMFilter { + struct _XIMFilter *next; + Window window; + unsigned long event_mask; + int start_type, end_type; + XFilterEventProc filter; + XPointer client_data; +} XFilterEventRec, *XFilterEventList; + +typedef struct { + char *name; + XPointer value; +} XIMArg; + +#ifdef offsetof +#define XOffsetOf(s_type,field) offsetof(s_type,field) +#else +#define XOffsetOf(s_type,field) ((unsigned int)&(((s_type*)NULL)->field)) +#endif + +#define XIMNumber(arr) ((unsigned int) (sizeof(arr) / sizeof(arr[0]))) + +/* + * define secondary data structs which are part of Input Methods + * and Input Context + */ +typedef struct { + const char *resource_name; /* Resource string */ + XrmQuark xrm_name; /* Resource name quark */ + int resource_size; /* Size in bytes of data */ + long resource_offset; /* Offset from base */ + unsigned short mode; /* Read Write Permission */ + unsigned short id; /* Input Method Protocol */ +} XIMResource, *XIMResourceList; + +/* + * data block describing the visual attributes associated with + * an input context + */ +typedef struct { + XRectangle area; + XRectangle area_needed; + XPoint spot_location; + Colormap colormap; + Atom std_colormap; + unsigned long foreground; + unsigned long background; + Pixmap background_pixmap; + XFontSet fontset; + int line_spacing; + Cursor cursor; + XICCallback start_callback; + XICCallback done_callback; + XICCallback draw_callback; + XICCallback caret_callback; + XIMPreeditState preedit_state; + XICCallback state_notify_callback; +} ICPreeditAttributes, *ICPreeditAttributesPtr; + +typedef struct { + XRectangle area; + XRectangle area_needed; + Colormap colormap; + Atom std_colormap; + unsigned long foreground; + unsigned long background; + Pixmap background_pixmap; + XFontSet fontset; + int line_spacing; + Cursor cursor; + XICCallback start_callback; + XICCallback done_callback; + XICCallback draw_callback; +} ICStatusAttributes, *ICStatusAttributesPtr; + +#endif /* !_XP_PRINT_SERVER_ */ + +/* + * Methods for Xrm parsing + */ + +/* The state is a pointer to an object created by the locale's + init_parse_info function (default: _XrmDefaultInitParseInfo). */ + +/* Sets the state to the initial state. + Initiates a sequence of calls to the XmbCharProc. */ +typedef void (*XmbInitProc)( + XPointer state +); + +/* Transforms one multibyte character, starting at str, and return a 'char' + in the same parsing class (not a wide character!). Returns the number of + consumed bytes in *lenp. */ +typedef char (*XmbCharProc)( + XPointer state, + const char * str, + int* lenp +); + +/* Terminates a sequence of calls to the XmbCharProc. */ +typedef void (*XmbFinishProc)( + XPointer state +); + +/* Returns the name of the state's locale, as a static string. */ +typedef const char* (*XlcNameProc)( + XPointer state +); + +/* Frees the state, which was allocated by the locale's init_parse_info + function. */ +typedef void (*XrmDestroyProc)( + XPointer state +); + +/* Set of methods for Xrm parsing. */ +typedef struct { + XmbInitProc mbinit; + XmbCharProc mbchar; + XmbFinishProc mbfinish; + XlcNameProc lcname; + XrmDestroyProc destroy; +} XrmMethodsRec; +typedef const XrmMethodsRec *XrmMethods; + +#ifndef _XP_PRINT_SERVER_ + +typedef struct _XLCd *XLCd; /* need forward reference */ + +/* + * define an LC, it's methods, and data. + */ + +typedef void (*XCloseLCProc)( + XLCd /* lcd */ +); + +typedef char* (*XlcMapModifiersProc)( + XLCd /* lcd */, + _Xconst char* /* user_mods */, + _Xconst char* /* prog_mods */ +); + +typedef XOM (*XOpenOMProc)( + XLCd /* lcd */, + Display* /* display */, + XrmDatabase /* rdb */, + _Xconst char* /* res_name */, + _Xconst char* /* res_class */ +); + +typedef XIM (*XOpenIMProc)( + XLCd /* lcd */, + Display* /* display */, + XrmDatabase /* rdb */, + char* /* res_name */, + char* /* res_class */ +); + +typedef Bool (*XRegisterIMInstantiateCBProc)( + XLCd /* lcd */, + Display* /* display */, + XrmDatabase /* rdb */, + char* /* res_name */, + char* /* res_class */, + XIDProc /* callback */, + XPointer /* client_data */ +); + +typedef Bool (*XUnregisterIMInstantiateCBProc)( + XLCd /* lcd */, + Display* /* display */, + XrmDatabase /* rdb */, + char* /* res_name */, + char* /* res_class */, + XIDProc /* callback */, + XPointer /* client_data */ +); + +typedef XrmMethods (*XrmInitParseInfoProc)( + XLCd /* lcd */, + XPointer* /* state */ +); + +typedef int (*XmbTextPropertyToTextListProc)( + XLCd lcd, + Display* display, + const XTextProperty* text_prop, + char*** list_return, + int* count_return +); + +typedef int (*XwcTextPropertyToTextListProc)( + XLCd lcd, + Display* display, + const XTextProperty* text_prop, + wchar_t*** list_return, + int* count_return +); + +typedef int (*XmbTextListToTextPropertyProc)( + XLCd lcd, + Display* display, + char** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +typedef int (*XwcTextListToTextPropertyProc)( + XLCd lcd, + Display* display, + wchar_t** list, + int count, + XICCEncodingStyle style, + XTextProperty* text_prop_return +); + +typedef void (*XwcFreeStringListProc)( + XLCd lcd, + wchar_t** list +); + +typedef const char* (*XDefaultStringProc)( + XLCd lcd +); + +typedef struct { + XCloseLCProc close; + XlcMapModifiersProc map_modifiers; + XOpenOMProc open_om; + XOpenIMProc open_im; + XrmInitParseInfoProc init_parse_info; + XmbTextPropertyToTextListProc mb_text_prop_to_list; + XwcTextPropertyToTextListProc wc_text_prop_to_list; + XmbTextPropertyToTextListProc utf8_text_prop_to_list; + XmbTextListToTextPropertyProc mb_text_list_to_prop; + XwcTextListToTextPropertyProc wc_text_list_to_prop; + XmbTextListToTextPropertyProc utf8_text_list_to_prop; + XwcFreeStringListProc wc_free_string_list; + XDefaultStringProc default_string; + XRegisterIMInstantiateCBProc register_callback; + XUnregisterIMInstantiateCBProc unregister_callback; +} XLCdMethodsRec, *XLCdMethods; + + +typedef struct { + char* name; /* name of this LC */ + char* modifiers; /* modifiers of locale */ +} XLCdCoreRec, *XLCdCore; + + +typedef struct _XLCd { + XLCdMethods methods; /* methods of this LC */ + XLCdCore core; /* data of this LC */ + XPointer opaque; /* LDX specific data */ +} XLCdRec; + +typedef int XlcPosition; + +#define XlcHead 0 +#define XlcTail -1 + +typedef struct { + char *name; + XPointer value; +} XlcArg, *XlcArgList; + +typedef struct _XlcResource { + const char *name; + XrmQuark xrm_name; + int size; + int offset; + unsigned long mask; +} XlcResource, *XlcResourceList; + +#define XlcCreateMask (1L<<0) +#define XlcDefaultMask (1L<<1) +#define XlcGetMask (1L<<2) +#define XlcSetMask (1L<<3) +#define XlcIgnoreMask (1L<<4) + +#define XlcNumber(arr) (sizeof(arr) / sizeof(arr[0])) + +typedef Status (*XCloseOMProc)( + XOM /* om */ +); + +typedef char* (*XSetOMValuesProc)( + XOM /* om */, + XlcArgList /* args */, + int /* num_args */ +); + +typedef char* (*XGetOMValuesProc)( + XOM /* om */, + XlcArgList /* args */, + int /* num_args */ +); + +typedef XOC (*XCreateOCProc)( + XOM /* om */, + XlcArgList /* args */, + int /* num_args */ +); + +typedef struct _XOMMethodsRec { + XCloseOMProc close; + XSetOMValuesProc set_values; + XGetOMValuesProc get_values; + XCreateOCProc create_oc; +} XOMMethodsRec, *XOMMethods; + +typedef struct _XOMCoreRec { + XLCd lcd; /* lcd */ + Display *display; /* display */ + XrmDatabase rdb; /* database */ + char *res_name; /* resource name */ + char *res_class; /* resource class */ + XOC oc_list; /* xoc list */ + XlcResourceList resources; /* xom resources */ + int num_resources; /* number of xom resources */ + XOMCharSetList required_charset; /* required charset list */ + XOMOrientation orientation_list; /* orientation list */ + Bool directional_dependent; /* directional-dependent */ + Bool contextual_drawing; /* contextual drawing */ + Bool context_dependent; /* context-dependent drawing */ +} XOMCoreRec, *XOMCore; + +typedef struct _XOM { + XOMMethods methods; + XOMCoreRec core; +} XOMRec; + +typedef void (*XDestroyOCProc)( + XOC /* oc */ +); + +typedef char* (*XSetOCValuesProc)( + XOC /* oc */, + XlcArgList /* args */, + int /* num_args */ +); + +typedef char* (*XGetOCValuesProc)( + XOC /* oc */, + XlcArgList /* args */, + int /* num_args */ +); + +/* + * X Font Sets are an instantiable object, so we define it, the + * object itself, a method list and data + */ + +/* + * XFontSet object method list + */ + +typedef int (*XmbTextEscapementProc)( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* text_len */ +); + +typedef int (*XmbTextExtentsProc)( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* text_len */, + XRectangle* /* overall_ink_extents */, + XRectangle* /* overall_logical_extents */ +); + +typedef Status (*XmbTextPerCharExtentsProc)( + XFontSet /* font_set */, + _Xconst char* /* text */, + int /* text_len */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* max_ink_extents */, + XRectangle* /* max_logical_extents */ +); + +typedef int (*XmbDrawStringProc)( + Display* /* display */, + Drawable /* drawable */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* text */, + int /* text_len */ +); + +typedef void (*XmbDrawImageStringProc)( + Display* /* display */, + Drawable /* drawable */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst char* /* text */, + int /* text_len */ +); + +typedef int (*XwcTextEscapementProc)( + XFontSet /* font_set */, + _Xconst wchar_t* /* text */, + int /* text_len */ +); + +typedef int (*XwcTextExtentsProc)( + XFontSet /* font_set */, + _Xconst wchar_t* /* text */, + int /* text_len */, + XRectangle* /* overall_ink_extents */, + XRectangle* /* overall_logical_extents */ +); + +typedef Status (*XwcTextPerCharExtentsProc)( + XFontSet /* font_set */, + _Xconst wchar_t* /* text */, + int /* text_len */, + XRectangle* /* ink_extents_buffer */, + XRectangle* /* logical_extents_buffer */, + int /* buffer_size */, + int* /* num_chars */, + XRectangle* /* max_ink_extents */, + XRectangle* /* max_logical_extents */ +); + +typedef int (*XwcDrawStringProc)( + Display* /* display */, + Drawable /* drawable */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst wchar_t* /* text */, + int /* text_len */ +); + +typedef void (*XwcDrawImageStringProc)( + Display* /* display */, + Drawable /* drawable */, + XFontSet /* font_set */, + GC /* gc */, + int /* x */, + int /* y */, + _Xconst wchar_t* /* text */, + int /* text_len */ +); + +typedef struct { + XDestroyOCProc destroy; + XSetOCValuesProc set_values; + XGetOCValuesProc get_values; + + /* multi-byte text drawing methods */ + + XmbTextEscapementProc mb_escapement; + XmbTextExtentsProc mb_extents; + XmbTextPerCharExtentsProc mb_extents_per_char; + XmbDrawStringProc mb_draw_string; + XmbDrawImageStringProc mb_draw_image_string; + + /* wide character text drawing methods */ + + XwcTextEscapementProc wc_escapement; + XwcTextExtentsProc wc_extents; + XwcTextPerCharExtentsProc wc_extents_per_char; + XwcDrawStringProc wc_draw_string; + XwcDrawImageStringProc wc_draw_image_string; + + /* UTF-8 text drawing methods */ + + XmbTextEscapementProc utf8_escapement; + XmbTextExtentsProc utf8_extents; + XmbTextPerCharExtentsProc utf8_extents_per_char; + XmbDrawStringProc utf8_draw_string; + XmbDrawImageStringProc utf8_draw_image_string; +} XOCMethodsRec, *XOCMethods; + + +/* + * XOC independent data + */ + +typedef struct { + XOM om; /* XOM */ + XOC next; /* next XOC */ + XlcResourceList resources; /* xoc resources */ + int num_resources; /* number of xoc resources */ + char *base_name_list; /* base font name list */ + Bool om_automatic; /* OM Automatic */ + XOMFontInfo font_info; /* font info */ + XFontSetExtents font_set_extents; /* font set extents */ + char *default_string; /* default string */ + XOMCharSetList missing_list; /* missing charset list */ + XOrientation orientation; /* orientation */ + char *res_name; /* resource name */ + char *res_class; /* resource class */ +} XOCCoreRec, *XOCCore; + +typedef struct _XOC { + XOCMethods methods; + XOCCoreRec core; +} XOCRec; + + +/* + * X Input Managers are an instantiable object, so we define it, the + * object itself, a method list and data. + */ + +/* + * an Input Manager object method list + */ +typedef struct { + Status (*close)( + XIM + ); + char* (*set_values)( + XIM, XIMArg* + ); + char* (*get_values)( + XIM, XIMArg* + ); + XIC (*create_ic)( + XIM, XIMArg* + ); + int (*ctstombs)( + XIM, char*, int, char*, int, Status * + ); + int (*ctstowcs)( + XIM, char*, int, wchar_t*, int, Status * + ); + int (*ctstoutf8)( + XIM, char*, int, char*, int, Status * + ); +} XIMMethodsRec, *XIMMethods; + +/* + * Input Manager LC independent data + */ +typedef struct { + XLCd lcd; /* LC of this input method */ + XIC ic_chain; /* list of ICs for this IM */ + + Display * display; /* display */ + XrmDatabase rdb; + char * res_name; + char * res_class; + + XIMValuesList *im_values_list; + XIMValuesList *ic_values_list; + XIMStyles *styles; + XIMCallback destroy_callback; + char * im_name; /* XIMMODIFIER name */ + XIMResourceList im_resources; /* compiled IM resource list */ + unsigned int im_num_resources; + XIMResourceList ic_resources; /* compiled IC resource list */ + unsigned int ic_num_resources; + Bool visible_position; +} XIMCoreRec, *XIMCore; + + + +/* + * An X Input Manager (IM). Implementations may need to extend this data + * structure to accomodate additional data, state information etc. + */ +typedef struct _XIM { + XIMMethods methods; /* method list of this IM */ + XIMCoreRec core; /* data of this IM */ +} XIMRec; + + + +/* + * 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 + ); + void (*set_focus)( + XIC + ); + void (*unset_focus)( + XIC + ); + char* (*set_values)( + XIC, XIMArg* + ); + char* (*get_values)( + XIC, XIMArg* + ); + char* (*mb_reset)( + XIC + ); + wchar_t* (*wc_reset)( + XIC + ); + char* (*utf8_reset)( + XIC + ); + int (*mb_lookup_string)( + XIC, XKeyEvent*, char*, int, KeySym*, Status* + ); + int (*wc_lookup_string)( + XIC, XKeyEvent*, wchar_t*, int, KeySym*, Status* + ); + int (*utf8_lookup_string)( + XIC, XKeyEvent*, char*, int, KeySym*, Status* + ); +} XICMethodsRec, *XICMethods; + + +/* + * Input Context LC independent data + */ +typedef struct { + XIM im; /* XIM this IC belongs too */ + XIC next; /* linked list of ICs for IM */ + + Window client_window; /* window IM can use for */ + /* display or subwindows */ + XIMStyle input_style; /* IM's input style */ + Window focus_window; /* where key events go */ + unsigned long filter_events; /* event mask from IM */ + XICCallback geometry_callback; /* client callback */ + char * res_name; + char * res_class; + + XICCallback destroy_callback; + XICCallback string_conversion_callback; + XIMStringConversionText string_conversion; + XIMResetState reset_state; + XIMHotKeyTriggers *hotkey; + XIMHotKeyState hotkey_state; + + ICPreeditAttributes preedit_attr; /* visuals of preedit area */ + ICStatusAttributes status_attr; /* visuals of status area */ +} XICCoreRec, *XICCore; + + +/* + * an Input Context. Implementations may need to extend this data + * structure to accomodate additional data, state information etc. + */ +typedef struct _XIC { + XICMethods methods; /* method list of this IC */ + XICCoreRec core; /* data of this IC */ +} XICRec; + + +/* If the argument 'name' is appropriate for this loader, it instantiates an + XLCd object with appropriate locale methods and returns it. May return + NULL; in this case, the remaining loaders are tried. */ +typedef XLCd (*XLCdLoadProc)( + const char* name +); + +_XFUNCPROTOBEGIN + +extern XLCd _XOpenLC( + char* name +); + +extern void _XCloseLC( + XLCd lcd +); + +extern XLCd _XlcCurrentLC (void); + +extern Bool _XlcValidModSyntax( + const char* mods, + const char* const * valid +); + +extern char *_XlcDefaultMapModifiers( + XLCd lcd, + _Xconst char* user_mods, + _Xconst char* prog_mods +); + +extern void _XIMCompileResourceList( + XIMResourceList /* res */, + unsigned int /* num_res */ +); + +extern void _XCopyToArg( + XPointer /* src */, + XPointer* /* dst */, + unsigned int /* size */ +); + +extern char ** _XParseBaseFontNameList( + char* /* str */, + int* /* num */ +); + +extern XrmMethods _XrmInitParseInfo( + XPointer* statep +); + +extern void _XRegisterFilterByMask( + Display* /* dpy */, + Window /* window */, + unsigned long /* event_mask */, + Bool (*)( + Display* /* display */, + Window /* window */, + XEvent* /* event */, + XPointer /* client_data */ + ) /* filter */, + XPointer /* client_data */ +); + +extern void _XRegisterFilterByType( + Display* /* dpy */, + Window /* window */, + int /* start_type */, + int /* end_type */, + Bool (*)( + Display* /* display */, + Window /* window */, + XEvent* /* event */, + XPointer /* client_data */ + ) /* filter */, + XPointer /* client_data */ +); + +extern void _XUnregisterFilter( + Display* /* dpy */, + Window /* window */, + Bool (*)( + Display* /* display */, + Window /* window */, + XEvent* /* event */, + XPointer /* client_data */ + ) /* filter */, + XPointer /* client_data */ +); + +extern void _XlcCountVaList( + va_list var, + int* count_return +); + +extern void _XlcVaToArgList( + va_list var, + int count, + XlcArgList* args_return +); + + +extern void _XlcCopyFromArg( + char * src, + char * dst, + int size +); + +extern void _XlcCopyToArg( + char * src, + char ** dst, + int size +); + +extern void _XlcCompileResourceList( + XlcResourceList resources, + int num_resources +); + +extern char *_XlcGetValues( + XPointer base, + XlcResourceList resources, + int num_resources, + XlcArgList args, + int num_args, + unsigned long mask +); + +extern char *_XlcSetValues( + XPointer base, + XlcResourceList resources, + int num_resources, + XlcArgList args, + int num_args, + unsigned long mask +); + +/* documented in i18n/Framework.PS */ +extern void _XlcInitLoader (void); + +extern void _XlcDeInitLoader (void); + +/* documented in i18n/Framework.PS */ +/* Returns True on success, False on failure. */ +extern Bool _XlcAddLoader( + XLCdLoadProc proc, + XlcPosition position +); + +/* documented in i18n/Framework.PS */ +extern void _XlcRemoveLoader( + XLCdLoadProc proc +); + +/* Registers UTF-8 converters for a non-UTF-8 locale. */ +extern void _XlcAddUtf8Converters( + XLCd lcd +); + +/* Registers UTF-8 converters for a UTF-8 locale. */ +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 +); + +/* The generic locale loader. Suitable for all encodings except UTF-8. + Uses an XLC_LOCALE configuration file. */ +extern XLCd _XlcGenericLoader( + const char* name +); + +/* The UTF-8 locale loader. Suitable for UTF-8 encoding. + Uses an XLC_LOCALE configuration file. */ +extern XLCd _XlcUtf8Loader( + const char* name +); + +extern XLCd _XlcDynamicLoad( + const char* name +); + +/* The old dynamic loader. */ +extern XLCd _XlcDynamicLoader( + const char* name +); + +extern Bool _XInitDefaultIM( + XLCd lcd +); + +extern Bool _XInitDefaultOM( + XLCd lcd +); + +extern Bool _XInitDynamicIM( + XLCd lcd +); + +extern Bool _XInitDynamicOM( + XLCd lcd +); + +_XFUNCPROTOEND + +#endif /* !_XP_PRINT_SERVER_ */ + +#endif /* _XLCINT_H_ */ diff --git a/nx-X11/lib/src/xlibi18n/imKStoUCS.c b/nx-X11/lib/src/xlibi18n/imKStoUCS.c new file mode 100644 index 000000000..640b3516a --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/imKStoUCS.c @@ -0,0 +1,322 @@ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Ximint.h" + +static unsigned short const keysym_to_unicode_1a1_1ff[] = { + 0x0104, 0x02d8, 0x0141, 0x0000, 0x013d, 0x015a, 0x0000, /* 0x01a0-0x01a7 */ + 0x0000, 0x0160, 0x015e, 0x0164, 0x0179, 0x0000, 0x017d, 0x017b, /* 0x01a8-0x01af */ + 0x0000, 0x0105, 0x02db, 0x0142, 0x0000, 0x013e, 0x015b, 0x02c7, /* 0x01b0-0x01b7 */ + 0x0000, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, /* 0x01b8-0x01bf */ + 0x0154, 0x0000, 0x0000, 0x0102, 0x0000, 0x0139, 0x0106, 0x0000, /* 0x01c0-0x01c7 */ + 0x010c, 0x0000, 0x0118, 0x0000, 0x011a, 0x0000, 0x0000, 0x010e, /* 0x01c8-0x01cf */ + 0x0110, 0x0143, 0x0147, 0x0000, 0x0000, 0x0150, 0x0000, 0x0000, /* 0x01d0-0x01d7 */ + 0x0158, 0x016e, 0x0000, 0x0170, 0x0000, 0x0000, 0x0162, 0x0000, /* 0x01d8-0x01df */ + 0x0155, 0x0000, 0x0000, 0x0103, 0x0000, 0x013a, 0x0107, 0x0000, /* 0x01e0-0x01e7 */ + 0x010d, 0x0000, 0x0119, 0x0000, 0x011b, 0x0000, 0x0000, 0x010f, /* 0x01e8-0x01ef */ + 0x0111, 0x0144, 0x0148, 0x0000, 0x0000, 0x0151, 0x0000, 0x0000, /* 0x01f0-0x01f7 */ + 0x0159, 0x016f, 0x0000, 0x0171, 0x0000, 0x0000, 0x0163, 0x02d9 /* 0x01f8-0x01ff */ +}; + +static unsigned short const keysym_to_unicode_2a1_2fe[] = { + 0x0126, 0x0000, 0x0000, 0x0000, 0x0000, 0x0124, 0x0000, /* 0x02a0-0x02a7 */ + 0x0000, 0x0130, 0x0000, 0x011e, 0x0134, 0x0000, 0x0000, 0x0000, /* 0x02a8-0x02af */ + 0x0000, 0x0127, 0x0000, 0x0000, 0x0000, 0x0000, 0x0125, 0x0000, /* 0x02b0-0x02b7 */ + 0x0000, 0x0131, 0x0000, 0x011f, 0x0135, 0x0000, 0x0000, 0x0000, /* 0x02b8-0x02bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010a, 0x0108, 0x0000, /* 0x02c0-0x02c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02c8-0x02cf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0120, 0x0000, 0x0000, /* 0x02d0-0x02d7 */ + 0x011c, 0x0000, 0x0000, 0x0000, 0x0000, 0x016c, 0x015c, 0x0000, /* 0x02d8-0x02df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x010b, 0x0109, 0x0000, /* 0x02e0-0x02e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x02e8-0x02ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0121, 0x0000, 0x0000, /* 0x02f0-0x02f7 */ + 0x011d, 0x0000, 0x0000, 0x0000, 0x0000, 0x016d, 0x015d /* 0x02f8-0x02ff */ +}; + +static unsigned short const keysym_to_unicode_3a2_3fe[] = { + 0x0138, 0x0156, 0x0000, 0x0128, 0x013b, 0x0000, /* 0x03a0-0x03a7 */ + 0x0000, 0x0000, 0x0112, 0x0122, 0x0166, 0x0000, 0x0000, 0x0000, /* 0x03a8-0x03af */ + 0x0000, 0x0000, 0x0000, 0x0157, 0x0000, 0x0129, 0x013c, 0x0000, /* 0x03b0-0x03b7 */ + 0x0000, 0x0000, 0x0113, 0x0123, 0x0167, 0x014a, 0x0000, 0x014b, /* 0x03b8-0x03bf */ + 0x0100, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012e, /* 0x03c0-0x03c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0116, 0x0000, 0x0000, 0x012a, /* 0x03c8-0x03cf */ + 0x0000, 0x0145, 0x014c, 0x0136, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03d0-0x03d7 */ + 0x0000, 0x0172, 0x0000, 0x0000, 0x0000, 0x0168, 0x016a, 0x0000, /* 0x03d8-0x03df */ + 0x0101, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x012f, /* 0x03e0-0x03e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0117, 0x0000, 0x0000, 0x012b, /* 0x03e8-0x03ef */ + 0x0000, 0x0146, 0x014d, 0x0137, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x03f0-0x03f7 */ + 0x0000, 0x0173, 0x0000, 0x0000, 0x0000, 0x0169, 0x016b /* 0x03f8-0x03ff */ +}; + +static unsigned short const keysym_to_unicode_4a1_4df[] = { + 0x3002, 0x3008, 0x3009, 0x3001, 0x30fb, 0x30f2, 0x30a1, /* 0x04a0-0x04a7 */ + 0x30a3, 0x30a5, 0x30a7, 0x30a9, 0x30e3, 0x30e5, 0x30e7, 0x30c3, /* 0x04a8-0x04af */ + 0x30fc, 0x30a2, 0x30a4, 0x30a6, 0x30a8, 0x30aa, 0x30ab, 0x30ad, /* 0x04b0-0x04b7 */ + 0x30af, 0x30b1, 0x30b3, 0x30b5, 0x30b7, 0x30b9, 0x30bb, 0x30bd, /* 0x04b8-0x04bf */ + 0x30bf, 0x30c1, 0x30c4, 0x30c6, 0x30c8, 0x30ca, 0x30cb, 0x30cc, /* 0x04c0-0x04c7 */ + 0x30cd, 0x30ce, 0x30cf, 0x30d2, 0x30d5, 0x30d8, 0x30db, 0x30de, /* 0x04c8-0x04cf */ + 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e4, 0x30e6, 0x30e8, 0x30e9, /* 0x04d0-0x04d7 */ + 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ef, 0x30f3, 0x309b, 0x309c /* 0x04d8-0x04df */ +}; + +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 */ + 0x0000, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, /* 0x05c0-0x05c7 */ + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, /* 0x05c8-0x05cf */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, /* 0x05d0-0x05d7 */ + 0x0638, 0x0639, 0x063a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x05d8-0x05df */ + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, /* 0x05e0-0x05e7 */ + 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, /* 0x05e8-0x05ef */ + 0x0650, 0x0651, 0x0652, 0x0653, 0x0654, 0x0655, 0x0698, 0x06a4, /* 0x05f0-0x05f7 */ + 0x06a9, 0x06af, 0x06ba, 0x06be, 0x06cc, 0x06d2, 0x06c1 /* 0x05f8-0x05fe */ +}; + +static unsigned short keysym_to_unicode_680_6ff[] = { + 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, /* 0x0680-0x0687 */ + 0x04b6, 0x04b8, 0x04ba, 0x0000, 0x04d8, 0x04e2, 0x04e8, 0x04ee, /* 0x0688-0x068f */ + 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, /* 0x0690-0x0697 */ + 0x04b7, 0x04b9, 0x04bb, 0x0000, 0x04d9, 0x04e3, 0x04e9, 0x04ef, /* 0x0698-0x069f */ + 0x0000, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, /* 0x06a0-0x06a7 */ + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, /* 0x06a8-0x06af */ + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, /* 0x06b0-0x06b7 */ + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, /* 0x06b8-0x06bf */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, /* 0x06c0-0x06c7 */ + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, /* 0x06c8-0x06cf */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, /* 0x06d0-0x06d7 */ + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, /* 0x06d8-0x06df */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, /* 0x06e0-0x06e7 */ + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, /* 0x06e8-0x06ef */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, /* 0x06f0-0x06f7 */ + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a /* 0x06f8-0x06ff */ +}; + +static unsigned short const keysym_to_unicode_7a1_7f9[] = { + 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0x0000, 0x038c, /* 0x07a0-0x07a7 */ + 0x038e, 0x03ab, 0x0000, 0x038f, 0x0000, 0x0000, 0x0385, 0x2015, /* 0x07a8-0x07af */ + 0x0000, 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, /* 0x07b0-0x07b7 */ + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07b8-0x07bf */ + 0x0000, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, /* 0x07c0-0x07c7 */ + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, /* 0x07c8-0x07cf */ + 0x03a0, 0x03a1, 0x03a3, 0x0000, 0x03a4, 0x03a5, 0x03a6, 0x03a7, /* 0x07d0-0x07d7 */ + 0x03a8, 0x03a9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x07d8-0x07df */ + 0x0000, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, /* 0x07e0-0x07e7 */ + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, /* 0x07e8-0x07ef */ + 0x03c0, 0x03c1, 0x03c3, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, /* 0x07f0-0x07f7 */ + 0x03c8, 0x03c9 /* 0x07f8-0x07ff */ +}; + +static unsigned short const keysym_to_unicode_8a4_8fe[] = { + 0x2320, 0x2321, 0x0000, 0x231c, /* 0x08a0-0x08a7 */ + 0x231d, 0x231e, 0x231f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x08a8-0x08af */ + 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, 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, 0x2202, /* 0x08e8-0x08ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0192, 0x0000, /* 0x08f0-0x08f7 */ + 0x0000, 0x0000, 0x0000, 0x2190, 0x2191, 0x2192, 0x2193 /* 0x08f8-0x08ff */ +}; + +static unsigned short const keysym_to_unicode_9df_9f8[] = { + 0x2422, /* 0x09d8-0x09df */ + 0x2666, 0x25a6, 0x2409, 0x240c, 0x240d, 0x240a, 0x0000, 0x0000, /* 0x09e0-0x09e7 */ + 0x240a, 0x240b, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c, 0x2500, /* 0x09e8-0x09ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x251c, 0x2524, 0x2534, 0x252c, /* 0x09f0-0x09f7 */ + 0x2502 /* 0x09f8-0x09ff */ +}; + +static unsigned short const keysym_to_unicode_aa1_afe[] = { + 0x2003, 0x2002, 0x2004, 0x2005, 0x2007, 0x2008, 0x2009, /* 0x0aa0-0x0aa7 */ + 0x200a, 0x2014, 0x2013, 0x0000, 0x0000, 0x0000, 0x2026, 0x2025, /* 0x0aa8-0x0aaf */ + 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, 0x215a, /* 0x0ab0-0x0ab7 */ + 0x2105, 0x0000, 0x0000, 0x2012, 0x2039, 0x2024, 0x203a, 0x0000, /* 0x0ab8-0x0abf */ + 0x0000, 0x0000, 0x0000, 0x215b, 0x215c, 0x215d, 0x215e, 0x0000, /* 0x0ac0-0x0ac7 */ + 0x0000, 0x2122, 0x2120, 0x0000, 0x25c1, 0x25b7, 0x25cb, 0x25ad, /* 0x0ac8-0x0acf */ + 0x2018, 0x2019, 0x201c, 0x201d, 0x211e, 0x2030, 0x2032, 0x2033, /* 0x0ad0-0x0ad7 */ + 0x0000, 0x271d, 0x0000, 0x220e, 0x25c2, 0x2023, 0x25cf, 0x25ac, /* 0x0ad8-0x0adf */ + 0x25e6, 0x25ab, 0x25ae, 0x25b5, 0x25bf, 0x2606, 0x2022, 0x25aa, /* 0x0ae0-0x0ae7 */ + 0x25b4, 0x25be, 0x261a, 0x261b, 0x2663, 0x2666, 0x2665, 0x0000, /* 0x0ae8-0x0aef */ + 0x2720, 0x2020, 0x2021, 0x2713, 0x2612, 0x266f, 0x266d, 0x2642, /* 0x0af0-0x0af7 */ + 0x2640, 0x2121, 0x2315, 0x2117, 0x2038, 0x201a, 0x201e /* 0x0af8-0x0aff */ +}; + +/* none of the APL keysyms match the Unicode characters */ + +static unsigned short const keysym_to_unicode_cdf_cfa[] = { + 0x2017, /* 0x0cd8-0x0cdf */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, /* 0x0ce0-0x0ce7 */ + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, /* 0x0ce8-0x0cef */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, /* 0x0cf0-0x0cf7 */ + 0x05e8, 0x05e9, 0x05ea /* 0x0cf8-0x0cff */ +}; + +static unsigned short const keysym_to_unicode_da1_df9[] = { + 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, /* 0x0da0-0x0da7 */ + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, /* 0x0da8-0x0daf */ + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, /* 0x0db0-0x0db7 */ + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, /* 0x0db8-0x0dbf */ + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, /* 0x0dc0-0x0dc7 */ + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, /* 0x0dc8-0x0dcf */ + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, /* 0x0dd0-0x0dd7 */ + 0x0e38, 0x0e39, 0x0e3a, 0x0000, 0x0000, 0x0000, 0x0e3e, 0x0e3f, /* 0x0dd8-0x0ddf */ + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, /* 0x0de0-0x0de7 */ + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0000, 0x0000, /* 0x0de8-0x0def */ + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, /* 0x0df0-0x0df7 */ + 0x0e58, 0x0e59 /* 0x0df8-0x0dff */ +}; + +static unsigned short const keysym_to_unicode_ea0_eff[] = { + 0x0000, 0x1101, 0x1101, 0x11aa, 0x1102, 0x11ac, 0x11ad, 0x1103, /* 0x0ea0-0x0ea7 */ + 0x1104, 0x1105, 0x11b0, 0x11b1, 0x11b2, 0x11b3, 0x11b4, 0x11b5, /* 0x0ea8-0x0eaf */ + 0x11b6, 0x1106, 0x1107, 0x1108, 0x11b9, 0x1109, 0x110a, 0x110b, /* 0x0eb0-0x0eb7 */ + 0x110c, 0x110d, 0x110e, 0x110f, 0x1110, 0x1111, 0x1112, 0x1161, /* 0x0eb8-0x0ebf */ + 0x1162, 0x1163, 0x1164, 0x1165, 0x1166, 0x1167, 0x1168, 0x1169, /* 0x0ec0-0x0ec7 */ + 0x116a, 0x116b, 0x116c, 0x116d, 0x116e, 0x116f, 0x1170, 0x1171, /* 0x0ec8-0x0ecf */ + 0x1172, 0x1173, 0x1174, 0x1175, 0x11a8, 0x11a9, 0x11aa, 0x11ab, /* 0x0ed0-0x0ed7 */ + 0x11ac, 0x11ad, 0x11ae, 0x11af, 0x11b0, 0x11b1, 0x11b2, 0x11b3, /* 0x0ed8-0x0edf */ + 0x11b4, 0x11b5, 0x11b6, 0x11b7, 0x11b8, 0x11b9, 0x11ba, 0x11bb, /* 0x0ee0-0x0ee7 */ + 0x11bc, 0x11bd, 0x11be, 0x11bf, 0x11c0, 0x11c1, 0x11c2, 0x0000, /* 0x0ee8-0x0eef */ + 0x0000, 0x0000, 0x1140, 0x0000, 0x0000, 0x1159, 0x119e, 0x0000, /* 0x0ef0-0x0ef7 */ + 0x11eb, 0x0000, 0x11f9, 0x0000, 0x0000, 0x0000, 0x0000, 0x20a9, /* 0x0ef8-0x0eff */ +}; + +static unsigned short keysym_to_unicode_12a1_12fe[] = { + 0x1e02, 0x1e03, 0x0000, 0x0000, 0x0000, 0x1e0a, 0x0000, /* 0x12a0-0x12a7 */ + 0x1e80, 0x0000, 0x1e82, 0x1e0b, 0x1ef2, 0x0000, 0x0000, 0x0000, /* 0x12a8-0x12af */ + 0x1e1e, 0x1e1f, 0x0000, 0x0000, 0x1e40, 0x1e41, 0x0000, 0x1e56, /* 0x12b0-0x12b7 */ + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, /* 0x12b8-0x12bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c0-0x12c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12c8-0x12cf */ + 0x0174, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x1e6a, /* 0x12d0-0x12d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0176, 0x0000, /* 0x12d8-0x12df */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e0-0x12e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x12e8-0x12ef */ + 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 */ +}; + +static unsigned short keysym_to_unicode_14a1_14ff[] = { + 0x2741, 0x00a7, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, /* 0x14a0-0x14a7 */ + 0x2014, 0x002e, 0x055d, 0x002c, 0x2013, 0x058a, 0x2026, 0x055c, /* 0x14a8-0x14af */ + 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, /* 0x14b0-0x14b7 */ + 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, /* 0x14b8-0x14bf */ + 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, /* 0x14c0-0x14c7 */ + 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, /* 0x14c8-0x14cf */ + 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, /* 0x14d0-0x14d7 */ + 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, /* 0x14d8-0x14df */ + 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, /* 0x14e0-0x14e7 */ + 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, /* 0x14e8-0x14ef */ + 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, /* 0x14f0-0x14f7 */ + 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x2019, 0x0027, /* 0x14f8-0x14ff */ +}; + +static unsigned short keysym_to_unicode_15d0_15f6[] = { + 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10d7, /* 0x15d0-0x15d7 */ + 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10dd, 0x10de, 0x10df, /* 0x15d8-0x15df */ + 0x10e0, 0x10e1, 0x10e2, 0x10e3, 0x10e4, 0x10e5, 0x10e6, 0x10e7, /* 0x15e0-0x15e7 */ + 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, 0x10ed, 0x10ee, 0x10ef, /* 0x15e8-0x15ef */ + 0x10f0, 0x10f1, 0x10f2, 0x10f3, 0x10f4, 0x10f5, 0x10f6 /* 0x15f0-0x15f7 */ +}; + +static unsigned short keysym_to_unicode_16a0_16f6[] = { + 0x0000, 0x0000, 0xf0a2, 0x1e8a, 0x0000, 0xf0a5, 0x012c, 0xf0a7, /* 0x16a0-0x16a7 */ + 0xf0a8, 0x01b5, 0x01e6, 0x0000, 0x0000, 0x0000, 0x0000, 0x019f, /* 0x16a8-0x16af */ + 0x0000, 0x0000, 0xf0b2, 0x1e8b, 0x01d1, 0xf0b5, 0x012d, 0xf0b7, /* 0x16b0-0x16b7 */ + 0xf0b8, 0x01b6, 0x01e7, 0x0000, 0x0000, 0x01d2, 0x0000, 0x0275, /* 0x16b8-0x16bf */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x018f, 0x0000, /* 0x16c0-0x16c7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16c8-0x16cf */ + 0x0000, 0x1e36, 0xf0d2, 0xf0d3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d0-0x16d7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16d8-0x16df */ + 0x0000, 0x1e37, 0xf0e2, 0xf0e3, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e0-0x16e7 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /* 0x16e8-0x16ef */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0259 /* 0x16f0-0x16f6 */ +}; + +static unsigned short const keysym_to_unicode_1e9f_1eff[] = { + 0x0303, + 0x1ea0, 0x1ea1, 0x1ea2, 0x1ea3, 0x1ea4, 0x1ea5, 0x1ea6, 0x1ea7, /* 0x1ea0-0x1ea7 */ + 0x1ea8, 0x1ea9, 0x1eaa, 0x1eab, 0x1eac, 0x1ead, 0x1eae, 0x1eaf, /* 0x1ea8-0x1eaf */ + 0x1eb0, 0x1eb1, 0x1eb2, 0x1eb3, 0x1eb4, 0x1eb5, 0x1eb6, 0x1eb7, /* 0x1eb0-0x1eb7 */ + 0x1eb8, 0x1eb9, 0x1eba, 0x1ebb, 0x1ebc, 0x1ebd, 0x1ebe, 0x1ebf, /* 0x1eb8-0x1ebf */ + 0x1ec0, 0x1ec1, 0x1ec2, 0x1ec3, 0x1ec4, 0x1ec5, 0x1ec6, 0x1ec7, /* 0x1ec0-0x1ec7 */ + 0x1ec8, 0x1ec9, 0x1eca, 0x1ecb, 0x1ecc, 0x1ecd, 0x1ece, 0x1ecf, /* 0x1ec8-0x1ecf */ + 0x1ed0, 0x1ed1, 0x1ed2, 0x1ed3, 0x1ed4, 0x1ed5, 0x1ed6, 0x1ed7, /* 0x1ed0-0x1ed7 */ + 0x1ed8, 0x1ed9, 0x1eda, 0x1edb, 0x1edc, 0x1edd, 0x1ede, 0x1edf, /* 0x1ed8-0x1edf */ + 0x1ee0, 0x1ee1, 0x1ee2, 0x1ee3, 0x1ee4, 0x1ee5, 0x1ee6, 0x1ee7, /* 0x1ee0-0x1ee7 */ + 0x1ee8, 0x1ee9, 0x1eea, 0x1eeb, 0x1eec, 0x1eed, 0x1eee, 0x1eef, /* 0x1ee8-0x1eef */ + 0x1ef0, 0x1ef1, 0x0300, 0x0301, 0x1ef4, 0x1ef5, 0x1ef6, 0x1ef7, /* 0x1ef0-0x1ef7 */ + 0x1ef8, 0x1ef9, 0x01a0, 0x01a1, 0x01af, 0x01b0, 0x0309, 0x0323 /* 0x1ef8-0x1eff */ +}; + +static unsigned short const keysym_to_unicode_20a0_20ac[] = { + 0x20a0, 0x20a1, 0x20a2, 0x20a3, 0x20a4, 0x20a5, 0x20a6, 0x20a7, /* 0x20a0-0x20a7 */ + 0x20a8, 0x20a9, 0x20aa, 0x20ab, 0x20ac /* 0x20a8-0x20af */ +}; + +unsigned int +KeySymToUcs4(KeySym keysym) +{ + /* 'Unicode keysym' */ + if ((keysym & 0xff000000) == 0x01000000) + return (keysym & 0x00ffffff); + + if (keysym > 0 && keysym < 0x100) + return keysym; + else if (keysym > 0x1a0 && keysym < 0x200) + return keysym_to_unicode_1a1_1ff[keysym - 0x1a1]; + else if (keysym > 0x2a0 && keysym < 0x2ff) + return keysym_to_unicode_2a1_2fe[keysym - 0x2a1]; + else if (keysym > 0x3a1 && keysym < 0x3ff) + return keysym_to_unicode_3a2_3fe[keysym - 0x3a2]; + else if (keysym > 0x4a0 && keysym < 0x4e0) + return keysym_to_unicode_4a1_4df[keysym - 0x4a1]; + else if (keysym > 0x589 && keysym < 0x5ff) + return keysym_to_unicode_590_5fe[keysym - 0x590]; + else if (keysym > 0x67f && keysym < 0x700) + return keysym_to_unicode_680_6ff[keysym - 0x680]; + else if (keysym > 0x7a0 && keysym < 0x7fa) + return keysym_to_unicode_7a1_7f9[keysym - 0x7a1]; + else if (keysym > 0x8a3 && keysym < 0x8ff) + return keysym_to_unicode_8a4_8fe[keysym - 0x8a4]; + else if (keysym > 0x9de && keysym < 0x9f9) + return keysym_to_unicode_9df_9f8[keysym - 0x9df]; + else if (keysym > 0xaa0 && keysym < 0xaff) + return keysym_to_unicode_aa1_afe[keysym - 0xaa1]; + else if (keysym > 0xcde && keysym < 0xcfb) + return keysym_to_unicode_cdf_cfa[keysym - 0xcdf]; + else if (keysym > 0xda0 && keysym < 0xdfa) + return keysym_to_unicode_da1_df9[keysym - 0xda1]; + else if (keysym > 0xe9f && keysym < 0xf00) + return keysym_to_unicode_ea0_eff[keysym - 0xea0]; + else if (keysym > 0x12a0 && keysym < 0x12ff) + return keysym_to_unicode_12a1_12fe[keysym - 0x12a1]; + else if (keysym > 0x13bb && keysym < 0x13bf) + return keysym_to_unicode_13bc_13be[keysym - 0x13bc]; + else if (keysym > 0x14a0 && keysym < 0x1500) + return keysym_to_unicode_14a1_14ff[keysym - 0x14a1]; + else if (keysym > 0x15cf && keysym < 0x15f7) + return keysym_to_unicode_15d0_15f6[keysym - 0x15d0]; + else if (keysym > 0x169f && keysym < 0x16f7) + return keysym_to_unicode_16a0_16f6[keysym - 0x16a0]; + else if (keysym > 0x1e9e && keysym < 0x1f00) + return keysym_to_unicode_1e9f_1eff[keysym - 0x1e9f]; + else if (keysym > 0x209f && keysym < 0x20ad) + return keysym_to_unicode_20a0_20ac[keysym - 0x20a0]; + else + return 0; +} diff --git a/nx-X11/lib/src/xlibi18n/lcCT.c b/nx-X11/lib/src/xlibi18n/lcCT.c new file mode 100644 index 000000000..6e3f21e92 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcCT.c @@ -0,0 +1,1303 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * Copyright 1995 by FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Takanori Tateno FUJITSU LIMITED + * + */ +/* + * 2000 + * Modifier: Ivan Pascal The XFree86 Project + * Modifier: Bruno Haible The XFree86 Project + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" +#include +#include + + +/* ====================== Built-in Character Sets ====================== */ + +/* + * Static representation of a character set that can be used in Compound Text. + */ +typedef struct _CTDataRec { + const char name[19]; + const char ct_sequence[5]; /* Compound Text encoding, ESC sequence */ +} CTDataRec, *CTData; + +static const CTDataRec default_ct_data[] = +{ + /* */ + /* X11 registry name MIME name ISO-IR ESC sequence */ + /* */ + + /* Registered character sets with one byte per character */ + { "ISO8859-1:GL", /* US-ASCII 6 */ "\033(B" }, + { "ISO8859-1:GR", /* ISO-8859-1 100 */ "\033-A" }, + { "ISO8859-2:GR", /* ISO-8859-2 101 */ "\033-B" }, + { "ISO8859-3:GR", /* ISO-8859-3 109 */ "\033-C" }, + { "ISO8859-4:GR", /* ISO-8859-4 110 */ "\033-D" }, + { "ISO8859-5:GR", /* ISO-8859-5 144 */ "\033-L" }, + { "ISO8859-6:GR", /* ISO-8859-6 127 */ "\033-G" }, + { "ISO8859-7:GR", /* ISO-8859-7 126 */ "\033-F" }, + { "ISO8859-8:GR", /* ISO-8859-8 138 */ "\033-H" }, + { "ISO8859-9:GR", /* ISO-8859-9 148 */ "\033-M" }, + { "ISO8859-10:GR", /* ISO-8859-10 157 */ "\033-V" }, + { "ISO8859-11:GR", /* ISO-8859-11 166 */ "\033-T" }, + { "ISO8859-13:GR", /* ISO-8859-13 179 */ "\033-Y" }, + { "ISO8859-14:GR", /* ISO-8859-14 199 */ "\033-_" }, + { "ISO8859-15:GR", /* ISO-8859-15 203 */ "\033-b" }, + { "ISO8859-16:GR", /* ISO-8859-16 226 */ "\033-f" }, + { "JISX0201.1976-0:GL", /* ISO-646-JP 14 */ "\033(J" }, + { "JISX0201.1976-0:GR", "\033)I" }, +#if 0 + { "TIS620-0:GR", /* TIS-620 166 */ "\033-T" }, +#endif + + /* Registered character sets with two byte per character */ + { "GB2312.1980-0:GL", /* GB_2312-80 58 */ "\033$(A" }, + { "GB2312.1980-0:GR", /* GB_2312-80 58 */ "\033$)A" }, + { "JISX0208.1983-0:GL", /* JIS_X0208-1983 87 */ "\033$(B" }, + { "JISX0208.1983-0:GR", /* JIS_X0208-1983 87 */ "\033$)B" }, + { "JISX0208.1990-0:GL", /* JIS_X0208-1990 168 */ "\033$(B" }, + { "JISX0208.1990-0:GR", /* JIS_X0208-1990 168 */ "\033$)B" }, + { "JISX0212.1990-0:GL", /* JIS_X0212-1990 159 */ "\033$(D" }, + { "JISX0212.1990-0:GR", /* JIS_X0212-1990 159 */ "\033$)D" }, + { "KSC5601.1987-0:GL", /* KS_C_5601-1987 149 */ "\033$(C" }, + { "KSC5601.1987-0:GR", /* KS_C_5601-1987 149 */ "\033$)C" }, + { "CNS11643.1986-1:GL", /* CNS 11643-1992 pl.1 171 */ "\033$(G" }, + { "CNS11643.1986-1:GR", /* CNS 11643-1992 pl.1 171 */ "\033$)G" }, + { "CNS11643.1986-2:GL", /* CNS 11643-1992 pl.2 172 */ "\033$(H" }, + { "CNS11643.1986-2:GR", /* CNS 11643-1992 pl.2 172 */ "\033$)H" }, + { "CNS11643.1992-3:GL", /* CNS 11643-1992 pl.3 183 */ "\033$(I" }, + { "CNS11643.1992-3:GR", /* CNS 11643-1992 pl.3 183 */ "\033$)I" }, + { "CNS11643.1992-4:GL", /* CNS 11643-1992 pl.4 184 */ "\033$(J" }, + { "CNS11643.1992-4:GR", /* CNS 11643-1992 pl.4 184 */ "\033$)J" }, + { "CNS11643.1992-5:GL", /* CNS 11643-1992 pl.5 185 */ "\033$(K" }, + { "CNS11643.1992-5:GR", /* CNS 11643-1992 pl.5 185 */ "\033$)K" }, + { "CNS11643.1992-6:GL", /* CNS 11643-1992 pl.6 186 */ "\033$(L" }, + { "CNS11643.1992-6:GR", /* CNS 11643-1992 pl.6 186 */ "\033$)L" }, + { "CNS11643.1992-7:GL", /* CNS 11643-1992 pl.7 187 */ "\033$(M" }, + { "CNS11643.1992-7:GR", /* CNS 11643-1992 pl.7 187 */ "\033$)M" }, + + /* Registered encodings with a varying number of bytes per character */ + { "ISO10646-1", /* UTF-8 196 */ "\033%G" }, + + /* Encodings without ISO-IR assigned escape sequence must be + defined in XLC_LOCALE files, using "\033%/1" or "\033%/2". */ + + /* Backward compatibility with XFree86 3.x */ +#if 1 + { "ISO8859-14:GR", "\033%/1" }, + { "ISO8859-15:GR", "\033%/1" }, +#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" }, + { "BIG5-E1:GL", "\033$(1" }, + { "BIG5-E1:GR", "\033$)1" }, + +}; + +/* We represent UTF-8 as an XlcGLGR charset, not in extended segments. */ +#define UTF8_IN_EXTSEQ 0 + +/* ======================= Parsing ESC Sequences ======================= */ + +#define XctC0 0x0000 +#define XctHT 0x0009 +#define XctNL 0x000a +#define XctESC 0x001b +#define XctGL 0x0020 +#define XctC1 0x0080 +#define XctCSI 0x009b +#define XctGR 0x00a0 +#define XctSTX 0x0002 + +#define XctCntrlFunc 0x0023 +#define XctMB 0x0024 +#define XctOtherCoding 0x0025 +#define XctGL94 0x0028 +#define XctGR94 0x0029 +#define XctGR96 0x002d +#define XctNonStandard 0x002f +#define XctIgnoreExt 0x0030 +#define XctNotIgnoreExt 0x0031 +#define XctLeftToRight 0x0031 +#define XctRightToLeft 0x0032 +#define XctDirection 0x005d +#define XctDirectionEnd 0x005d + +#define XctGL94MB 0x2428 +#define XctGR94MB 0x2429 +#define XctExtSeg 0x252f +#define XctReturn 0x2540 + +/* + * Parses the header of a Compound Text segment, i.e. the charset designator. + * The string starts at *text and has *length bytes. + * Return value is one of: + * 0 (no valid charset designator), + * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, + * XctLeftToRight, XctRightToLeft, XctDirectionEnd, + * XctExtSeg, XctOtherCoding, XctReturn, XctIgnoreExt, XctNotIgnoreExt. + * If the return value is not 0, *text is incremented and *length decremented, + * to point past the charset designator. If the return value is one of + * XctGL94, XctGR94, XctGR96, XctGL94MB, XctGR94MB, + * XctExtSeg, XctOtherCoding, XctIgnoreExt, XctNotIgnoreExt, + * *final_byte is set to the "final byte" of the charset designator. + */ +static unsigned int +_XlcParseCT( + const char **text, + int *length, + unsigned char *final_byte) +{ + unsigned int ret = 0; + unsigned char ch; + const unsigned char *str = (const unsigned char *) *text; + + *final_byte = 0; + + if (*length < 1) + return 0; + switch (ch = *str++) { + case XctESC: + if (*length < 2) + return 0; + switch (ch = *str++) { + case XctOtherCoding: /* % */ + if (*length < 3) + return 0; + ch = *str++; + if (ch == XctNonStandard) { /* / */ + if (*length < 4) + return 0; + ret = XctExtSeg; + ch = *str++; + } else if (ch == '@') { + ret = XctReturn; + } else { + ret = XctOtherCoding; + } + *final_byte = ch; + break; + + case XctCntrlFunc: /* # */ + if (*length < 4) + return 0; + *final_byte = *str++; + switch (*str++) { + case XctIgnoreExt: /* 0 */ + ret = XctIgnoreExt; + break; + case XctNotIgnoreExt: /* 1 */ + ret = XctNotIgnoreExt; + break; + default: + ret = 0; + break; + } + break; + + case XctMB: /* $ */ + if (*length < 4) + return 0; + ch = *str++; + switch (ch) { + case XctGL94: /* ( */ + ret = XctGL94MB; + break; + case XctGR94: /* ) */ + ret = XctGR94MB; + break; + default: + ret = 0; + break; + } + *final_byte = *str++; + break; + + case XctGL94: /* ( */ + if (*length < 3) + return 0; + ret = XctGL94; + *final_byte = *str++; + break; + case XctGR94: /* ) */ + if (*length < 3) + return 0; + ret = XctGR94; + *final_byte = *str++; + break; + case XctGR96: /* - */ + if (*length < 3) + return 0; + ret = XctGR96; + *final_byte = *str++; + break; + } + break; + case XctCSI: + /* direction */ + if (*length < 2) + return 0; + switch (*str++) { + case XctLeftToRight: + if (*length < 3) + return 0; + if (*str++ == XctDirection) + ret = XctLeftToRight; + break; + case XctRightToLeft: + if (*length < 3) + return 0; + if (*str++ == XctDirection) + ret = XctRightToLeft; + break; + case XctDirectionEnd: + ret = XctDirectionEnd; + break; + } + break; + } + + if (ret) { + *length -= (const char *) str - *text; + *text = (const char *) str; + } + return ret; +} + +/* + * Fills into a freshly created XlcCharSet the fields that can be inferred + * from the ESC sequence. These are side, char_size, set_size. + * Returns True if the charset can be used with Compound Text. + * + * Used by _XlcCreateDefaultCharSet. + */ +Bool +_XlcParseCharSet( + XlcCharSet charset) +{ + unsigned int type; + unsigned char final_byte; + const char *ptr = charset->ct_sequence; + int length; + int char_size; + + if (*ptr == '\0') + return False; + + length = strlen(ptr); + + type = _XlcParseCT(&ptr, &length, &final_byte); + + /* Check for validity and determine char_size. + char_size = 0 means varying number of bytes per character. */ + switch (type) { + case XctGL94: + case XctGR94: + case XctGR96: + char_size = 1; + break; + case XctGL94MB: + case XctGR94MB: + char_size = (final_byte < 0x60 ? 2 : final_byte < 0x70 ? 3 : 4); + break; + case XctExtSeg: + char_size = final_byte - '0'; + if (!(char_size >= 0 && char_size <= 4)) + return False; + break; + case XctOtherCoding: + char_size = 0; + break; + default: + return False; + } + + charset->char_size = char_size; + + /* Fill in other values. */ + switch (type) { + case XctGL94: + case XctGL94MB: + charset->side = XlcGL; + charset->set_size = 94; + break; + case XctGR94: + case XctGR94MB: + charset->side = XlcGR; + charset->set_size = 94; + break; + case XctGR96: + charset->side = XlcGR; + charset->set_size = 96; + break; + case XctExtSeg: + case XctOtherCoding: + charset->side = XlcGLGR; + charset->set_size = 0; + break; + } + return True; +} + + +/* =============== Management of the List of Character Sets =============== */ + +/* + * Representation of a character set that can be used for Compound Text, + * at run time. + * Note: This information is not contained in the XlcCharSet, because + * multiple ESC sequences may be used for the same XlcCharSet. + */ +typedef struct _CTInfoRec { + XlcCharSet charset; + const char *ct_sequence; /* Compound Text ESC sequence */ + unsigned int type; + unsigned char final_byte; + /* If type == XctExtSeg: */ + const char *ext_segment; /* extended segment name, then '\002' */ + int ext_segment_len; /* length of above, including final '\002' */ + + struct _CTInfoRec *next; +} CTInfoRec, *CTInfo; + +/* + * List of character sets that can be used for Compound Text, + * Includes all that are listed in default_ct_data, but more can be added + * at runtime through _XlcAddCT. + */ +static CTInfo ct_list = NULL; +static CTInfo ct_list_end = NULL; + +/* + * Returns a Compound Text info record for an ESC sequence. + * The first part of the ESC sequence has already been parsed into 'type' + * and 'final_byte'. The remainder starts at 'text', at least 'text_len' + * bytes (only used if type == XctExtSeg). + */ +static CTInfo +_XlcGetCTInfo( + unsigned int type, + unsigned char final_byte, + const char *text, + int text_len) +{ + CTInfo ct_info; + + for (ct_info = ct_list; ct_info; ct_info = ct_info->next) + if (ct_info->type == type + && ct_info->final_byte == final_byte + && (type != XctExtSeg + || (text_len >= ct_info->ext_segment_len + && memcmp(text, ct_info->ext_segment, + ct_info->ext_segment_len) == 0))) + return ct_info; + + return (CTInfo) NULL; +} + +/* Returns the Compound Text info for a given XlcCharSet. + Returns NULL if none is found. */ +static CTInfo +_XlcGetCTInfoFromCharSet( + XlcCharSet charset) +{ + CTInfo ct_info; + + for (ct_info = ct_list; ct_info; ct_info = ct_info->next) + if (ct_info->charset == charset) + return ct_info; + + return (CTInfo) NULL; +} + +/* Creates a new XlcCharSet, given its name (including side suffix) and + Compound Text ESC sequence (normally at most 4 bytes), and makes it + eligible for Compound Text processing. */ +XlcCharSet +_XlcAddCT( + const char *name, + const char *ct_sequence) +{ + CTInfo ct_info, existing_info; + XlcCharSet charset; + const char *ct_ptr; + int length; + unsigned int type; + unsigned char final_byte; + + charset = _XlcGetCharSet(name); + if (charset != NULL) { + /* Even if the charset already exists, it is OK to register a second + Compound Text sequence for it. */ + } else { + /* Attempt to create the charset. */ + charset = _XlcCreateDefaultCharSet(name, ct_sequence); + if (charset == NULL) + return (XlcCharSet) NULL; + _XlcAddCharSet(charset); + } + + /* Allocate a CTinfo record. */ + length = strlen(ct_sequence); + ct_info = Xmalloc(sizeof(CTInfoRec) + length+1); + if (ct_info == NULL) + return charset; + + ct_info->charset = charset; + ct_info->ct_sequence = strcpy((char *) (ct_info + 1), ct_sequence); + + /* Parse the Compound Text sequence. */ + ct_ptr = ct_sequence; + type = _XlcParseCT(&ct_ptr, &length, &final_byte); + + ct_info->type = type; + ct_info->final_byte = final_byte; + + switch (type) { + case XctGL94: + case XctGR94: + case XctGR96: + case XctGL94MB: + case XctGR94MB: + case XctOtherCoding: + ct_info->ext_segment = NULL; + ct_info->ext_segment_len = 0; + break; + case XctExtSeg: { + /* By convention, the extended segment name is the encoding_name + in lowercase. */ + const char *q = charset->encoding_name; + int n = strlen(q); + char *p; + + /* Ensure ct_info->ext_segment_len <= 0x3fff - 6. */ + if (n > 0x3fff - 6 - 1) { + Xfree(ct_info); + return charset; + } + p = Xmalloc(n+1); + if (p == NULL) { + Xfree(ct_info); + return charset; + } + ct_info->ext_segment = p; + ct_info->ext_segment_len = n+1; + for ( ; n > 0; p++, q++, n--) + *p = (*q >= 'A' && *q <= 'Z' ? *q - 'A' + 'a' : *q); + *p = XctSTX; + break; + } + default: + Xfree(ct_info); + return (XlcCharSet) NULL; + } + + /* Insert it into the list, if not already present. */ + existing_info = + _XlcGetCTInfo(type, ct_info->final_byte, + ct_info->ext_segment, ct_info->ext_segment_len); + if (existing_info == NULL) { + /* Insert it at the end. If there are duplicates CTinfo entries + for the same XlcCharSet, we want the first (standard) one to + override the second (user defined) one. */ + ct_info->next = NULL; + if (ct_list_end) + ct_list_end->next = ct_info; + else + ct_list = ct_info; + ct_list_end = ct_info; + } else { + if (existing_info->charset != charset + /* We have a conflict, with one exception: JISX0208.1983-0 and + JISX0208.1990-0 are the same for all practical purposes. */ + && !(strncmp(existing_info->charset->name, "JISX0208", 8) == 0 + && strncmp(charset->name, "JISX0208", 8) == 0)) { + fprintf(stderr, + "Xlib: charsets %s and %s have the same CT sequence\n", + charset->name, existing_info->charset->name); + if (strcmp(charset->ct_sequence, ct_sequence) == 0) + charset->ct_sequence = ""; + } + Xfree(ct_info); + } + + return charset; +} + + +/* ========== Converters String <--> CharSet <--> Compound Text ========== */ + +/* + * Structure representing the parse state of a Compound Text string. + */ +typedef struct _StateRec { + XlcCharSet charset; /* The charset of the current segment */ + XlcCharSet GL_charset; /* The charset responsible for 0x00..0x7F */ + XlcCharSet GR_charset; /* The charset responsible for 0x80..0xFF */ + XlcCharSet Other_charset; /* != NULL if currently in an other segment */ + int ext_seg_left; /* > 0 if currently in an extended segment */ +} StateRec, *State; + + +/* Subroutine for parsing an ESC sequence. */ + +typedef enum { + resOK, /* Charset saved in 'state', sequence skipped */ + resNotInList, /* Charset not found, sequence skipped */ + resNotCTSeq /* EscSeq not recognized, pointers not changed */ +} CheckResult; + +static CheckResult +_XlcCheckCTSequence( + State state, + const char **ctext, + int *ctext_len) +{ + XlcCharSet charset; + CTInfo ct_info; + const char *tmp_ctext = *ctext; + int tmp_ctext_len = *ctext_len; + unsigned int type; + unsigned char final_byte; + int ext_seg_left = 0; + + /* Check for validity. */ + type = _XlcParseCT(&tmp_ctext, &tmp_ctext_len, &final_byte); + + switch (type) { + case XctGL94: + case XctGR94: + case XctGR96: + case XctGL94MB: + case XctGR94MB: + case XctOtherCoding: + *ctext = tmp_ctext; + *ctext_len = tmp_ctext_len; + break; + case XctReturn: + *ctext = tmp_ctext; + *ctext_len = tmp_ctext_len; + state->Other_charset = NULL; + return resOK; + case XctExtSeg: + if (tmp_ctext_len > 2 + && (tmp_ctext[0] & 0x80) && (tmp_ctext[0] & 0x80)) { + unsigned int msb = tmp_ctext[0] & 0x7f; + unsigned int lsb = tmp_ctext[1] & 0x7f; + ext_seg_left = (msb << 7) + lsb; + if (ext_seg_left <= tmp_ctext_len - 2) { + *ctext = tmp_ctext + 2; + *ctext_len = tmp_ctext_len - 2; + break; + } + } + return resNotCTSeq; + default: + return resNotCTSeq; + } + + ct_info = _XlcGetCTInfo(type, final_byte, *ctext, ext_seg_left); + + if (ct_info) { + charset = ct_info->charset; + state->ext_seg_left = ext_seg_left; + if (type == XctExtSeg) { + state->charset = charset; + /* Skip past the extended segment name and the separator. */ + *ctext += ct_info->ext_segment_len; + *ctext_len -= ct_info->ext_segment_len; + state->ext_seg_left -= ct_info->ext_segment_len; + } else if (type == XctOtherCoding) { + state->Other_charset = charset; + } else { + if (charset->side == XlcGL) { + state->GL_charset = charset; + } else if (charset->side == XlcGR) { + state->GR_charset = charset; + } else { + state->GL_charset = charset; + state->GR_charset = charset; + } + } + return resOK; + } else { + state->ext_seg_left = 0; + if (type == XctExtSeg) { + /* Skip the entire extended segment. */ + *ctext += ext_seg_left; + *ctext_len -= ext_seg_left; + } + return resNotInList; + } +} + +static void +init_state( + XlcConv conv) +{ + State state = (State) conv->state; + static XlcCharSet default_GL_charset = NULL; + static XlcCharSet default_GR_charset = NULL; + + if (default_GL_charset == NULL) { + default_GL_charset = _XlcGetCharSet("ISO8859-1:GL"); + default_GR_charset = _XlcGetCharSet("ISO8859-1:GR"); + } + + /* The initial state is ISO-8859-1 on both sides. */ + state->GL_charset = state->charset = default_GL_charset; + state->GR_charset = default_GR_charset; + + state->Other_charset = NULL; + + state->ext_seg_left = 0; +} + +/* from XlcNCompoundText to XlcNCharSet */ + +static int +cttocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XlcCharSet charset = NULL; + const char *ctptr; + char *bufptr; + int ctext_len, buf_len; + int unconv_num = 0; + + ctptr = (const char *) *from; + bufptr = (char *) *to; + ctext_len = *from_left; + buf_len = *to_left; + + while (ctext_len > 0 && buf_len > 0) { + if (state->ext_seg_left == 0) { + /* Not in the middle of an extended segment; look at next byte. */ + unsigned char ch = *ctptr; + XlcCharSet ch_charset; + + if (ch == XctESC) { + CheckResult ret = + _XlcCheckCTSequence(state, &ctptr, &ctext_len); + if (ret == resOK) + /* state has been modified. */ + continue; + if (ret == resNotInList) { + /* XXX Just continue with previous charset. */ + unconv_num++; + continue; + } + } else if (ch == XctCSI) { + /* XXX Simply ignore the XctLeftToRight, XctRightToLeft, + XctDirectionEnd sequences for the moment. */ + unsigned char dummy; + if (_XlcParseCT(&ctptr, &ctext_len, &dummy)) { + unconv_num++; + continue; + } + } + + /* Find the charset which is responsible for this byte. */ + ch_charset = (state->Other_charset != NULL ? state->Other_charset : + (ch & 0x80 ? state->GR_charset : state->GL_charset)); + + /* Set the charset of this run, or continue the current run, + or stop the current run. */ + if (charset) { + if (charset != ch_charset) + break; + } else { + state->charset = charset = ch_charset; + } + + /* We don't want to split a character into multiple pieces. */ + if (buf_len < 6) { + if (charset->char_size > 0) { + if (buf_len < charset->char_size) + break; + } else { + /* char_size == 0 is tricky. The code here is good only + for valid UTF-8 input. */ + if (charset->ct_sequence[0] == XctESC + && charset->ct_sequence[1] == XctOtherCoding + && charset->ct_sequence[2] == 'G') { + int char_size = (ch < 0xc0 ? 1 : + ch < 0xe0 ? 2 : + ch < 0xf0 ? 3 : + ch < 0xf8 ? 4 : + ch < 0xfc ? 5 : + 6); + if (buf_len < char_size) + break; + } + } + } + + *bufptr++ = *ctptr++; + ctext_len--; + buf_len--; + } else { + /* Copy as much as possible from the current extended segment + to the buffer. */ + int char_size; + + /* Set the charset of this run, or continue the current run, + or stop the current run. */ + if (charset) { + if (charset != state->charset) + break; + } else { + charset = state->charset; + } + + char_size = charset->char_size; + + if (state->ext_seg_left <= buf_len || char_size > 0) { + int n = (state->ext_seg_left <= buf_len + ? state->ext_seg_left + : (buf_len / char_size) * char_size); + memcpy(bufptr, ctptr, n); + ctptr += n; ctext_len -= n; + bufptr += n; buf_len -= n; + state->ext_seg_left -= n; + } else { +#if UTF8_IN_EXTSEQ + /* char_size == 0 is tricky. The code here is good only + for valid UTF-8 input. */ + if (strcmp(charset->name, "ISO10646-1") == 0) { + unsigned char ch = *ctptr; + int char_size = (ch < 0xc0 ? 1 : + ch < 0xe0 ? 2 : + ch < 0xf0 ? 3 : + ch < 0xf8 ? 4 : + ch < 0xfc ? 5 : + 6); + int i; + if (buf_len < char_size) + break; + /* A small loop is faster than calling memcpy. */ + for (i = char_size; i > 0; i--) + *bufptr++ = *ctptr++; + ctext_len -= char_size; + buf_len -= char_size; + state->ext_seg_left -= char_size; + } else +#endif + { + /* Here ctext_len >= state->ext_seg_left > buf_len. + We may be splitting a character into multiple pieces. + Oh well. */ + int n = buf_len; + memcpy(bufptr, ctptr, n); + ctptr += n; ctext_len -= n; + bufptr += n; buf_len -= n; + state->ext_seg_left -= n; + } + } + } + } + + /* 'charset' is the charset for the current run. In some cases, + 'state->charset' contains the charset for the next run. Therefore, + return 'charset'. + 'charset' may still be NULL only if no output was produced. */ + if (num_args > 0) + *((XlcCharSet *) args[0]) = charset; + + *from_left -= ctptr - *((const char **) from); + *from = (XPointer) ctptr; + + *to_left -= bufptr - *((char **) to); + *to = (XPointer) bufptr; + + return unconv_num; +} + +/* from XlcNCharSet to XlcNCompoundText */ + +static int +cstoct( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + XlcSide side; + unsigned char min_ch = 0, max_ch = 0; + int length, unconv_num; + CTInfo ct_info; + XlcCharSet charset; + const char *csptr; + char *ctptr; + int csstr_len, ct_len; + char *ext_segment_start; + int char_size; + + /* One argument is required, of type XlcCharSet. */ + if (num_args < 1) + return -1; + + csptr = *((const char **) from); + ctptr = *((char **) to); + csstr_len = *from_left; + ct_len = *to_left; + + charset = (XlcCharSet) args[0]; + + ct_info = _XlcGetCTInfoFromCharSet(charset); + if (ct_info == NULL) + return -1; + + side = charset->side; + length = strlen(ct_info->ct_sequence); + + ext_segment_start = NULL; + + if (ct_info->type == XctOtherCoding) { + /* Output the Escape sequence for switching to the charset, and + reserve room now for the XctReturn sequence at the end. */ + if (ct_len < length + 3) + return -1; + + memcpy(ctptr, ct_info->ct_sequence, length); + ctptr += length; + ct_len -= length + 3; + } else + /* Test whether the charset is already active. */ + if (((side == XlcGR || side == XlcGLGR) + && charset != state->GR_charset) + || ((side == XlcGL || side == XlcGLGR) + && charset != state->GL_charset)) { + + /* Output the Escape sequence for switching to the charset. */ + if (ct_info->type == XctExtSeg) { + if (ct_len < length + 2 + ct_info->ext_segment_len) + return -1; + + memcpy(ctptr, ct_info->ct_sequence, length); + ctptr += length; + ct_len -= length; + + ctptr += 2; + ct_len -= 2; + ext_segment_start = ctptr; + + /* The size of an extended segment must fit in 14 bits. */ + if (ct_len > 0x3fff) + ct_len = 0x3fff; + + memcpy(ctptr, ct_info->ext_segment, ct_info->ext_segment_len); + ctptr += ct_info->ext_segment_len; + ct_len -= ct_info->ext_segment_len; + } else { + if (ct_len < length) + return -1; + + memcpy(ctptr, ct_info->ct_sequence, length); + ctptr += length; + ct_len -= length; + } + } + + /* If the charset has side GL or GR, prepare remapping the characters + to the correct side. */ + if (charset->set_size) { + min_ch = 0x20; + max_ch = 0x7f; + if (charset->set_size == 94) { + max_ch--; + if (charset->char_size > 1 || side == XlcGR) + min_ch++; + } + } + + /* Actually copy the contents. */ + unconv_num = 0; + char_size = charset->char_size; + if (char_size == 1) { + while (csstr_len > 0 && ct_len > 0) { + if (charset->set_size) { + /* The CompoundText specification says that the only + control characters allowed are 0x09, 0x0a, 0x1b, 0x9b. + Therefore here we eliminate other control characters. */ + unsigned char ch = *((const unsigned char *) csptr) & 0x7f; + if (!((ch >= min_ch && ch <= max_ch) + || (side == XlcGL + && (ch == 0x00 || ch == 0x09 || ch == 0x0a)) + || ((side == XlcGL || side == XlcGR) + && (ch == 0x1b)))) { + csptr++; + csstr_len--; + unconv_num++; + continue; + } + } + + if (side == XlcGL) + *ctptr++ = *csptr++ & 0x7f; + else if (side == XlcGR) + *ctptr++ = *csptr++ | 0x80; + else + *ctptr++ = *csptr++; + csstr_len--; + ct_len--; + } + } else if (char_size > 1) { + while (csstr_len >= char_size && ct_len >= char_size) { + if (side == XlcGL) { + int i; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++ & 0x7f; + } else if (side == XlcGR) { + int i; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++ | 0x80; + } else { + int i; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++; + } + csstr_len -= char_size; + ct_len -= char_size; + } + } else { + /* char_size = 0. The code here is good only for valid UTF-8 input. */ + if ((charset->ct_sequence[0] == XctESC + && charset->ct_sequence[1] == XctOtherCoding + && charset->ct_sequence[2] == 'G') +#if UTF8_IN_EXTSEQ + || strcmp(charset->name, "ISO10646-1") == 0 +#endif + ) { + while (csstr_len > 0 && ct_len > 0) { + unsigned char ch = * (const unsigned char *) csptr; + int char_size = (ch < 0xc0 ? 1 : + ch < 0xe0 ? 2 : + ch < 0xf0 ? 3 : + ch < 0xf8 ? 4 : + ch < 0xfc ? 5 : + 6); + int i; + if (!(csstr_len >= char_size && ct_len >= char_size)) + break; + for (i = char_size; i > 0; i--) + *ctptr++ = *csptr++; + csstr_len -= char_size; + ct_len -= char_size; + } + } else { + while (csstr_len > 0 && ct_len > 0) { + *ctptr++ = *csptr++; + csstr_len--; + ct_len--; + } + } + } + + if (ct_info->type == XctOtherCoding) { + /* Terminate with an XctReturn sequence. */ + ctptr[0] = XctESC; + ctptr[1] = XctOtherCoding; + ctptr[2] = '@'; + ctptr += 3; + } else if (ext_segment_start != NULL) { + /* Backpatch the extended segment's length. */ + int ext_segment_length = ctptr - ext_segment_start; + *(ext_segment_start - 2) = (ext_segment_length >> 7) | 0x80; + *(ext_segment_start - 1) = (ext_segment_length & 0x7f) | 0x80; + } else { + if (side == XlcGR || side == XlcGLGR) + state->GR_charset = charset; + if (side == XlcGL || side == XlcGLGR) + state->GL_charset = charset; + } + + *from_left -= csptr - *((const char **) from); + *from = (XPointer) csptr; + + *to_left -= ctptr - *((char **) to); + *to = (XPointer) ctptr; + + return 0; +} + +/* from XlcNString to XlcNCharSet */ + +static int +strtocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + const char *src; + char *dst; + unsigned char side; + int length; + + src = (const char *) *from; + dst = (char *) *to; + + length = min(*from_left, *to_left); + side = *((const unsigned char *) src) & 0x80; + + while (side == (*((const unsigned char *) src) & 0x80) && length-- > 0) + *dst++ = *src++; + + *from_left -= src - (const char *) *from; + *from = (XPointer) src; + *to_left -= dst - (char *) *to; + *to = (XPointer) dst; + + if (num_args > 0) + *((XlcCharSet *)args[0]) = (side ? state->GR_charset : state->GL_charset); + + return 0; +} + +/* from XlcNCharSet to XlcNString */ + +static int +cstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + State state = (State) conv->state; + const char *csptr; + char *string_ptr; + int csstr_len, str_len; + unsigned char ch; + int unconv_num = 0; + + /* This converter can only convert from ISO8859-1:GL and ISO8859-1:GR. */ + if (num_args < 1 + || !((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; + str_len = *to_left; + + while (csstr_len > 0 && str_len > 0) { + ch = *((const unsigned char *) csptr++); + csstr_len--; + /* Citing ICCCM: "STRING as a type specifies the ISO Latin-1 character + set plus the control characters TAB and NEWLINE." */ + if ((ch < 0x20 && ch != 0x00 && ch != 0x09 && ch != 0x0a) + || (ch >= 0x7f && ch < 0xa0)) { + unconv_num++; + continue; + } + *((unsigned char *) string_ptr++) = ch; + str_len--; + } + + *from_left -= csptr - *((const char **) from); + *from = (XPointer) csptr; + + *to_left -= string_ptr - *((char **) to); + *to = (XPointer) string_ptr; + + return unconv_num; +} + + +static XlcConv +create_conv( + XlcConvMethods methods) +{ + XlcConv conv; + + conv = Xmalloc(sizeof(XlcConvRec) + sizeof(StateRec)); + if (conv == NULL) + return (XlcConv) NULL; + + conv->state = (XPointer) &conv[1]; + + conv->methods = methods; + + init_state(conv); + + return conv; +} + +static void +close_converter( + XlcConv conv) +{ + /* conv->state is allocated together with conv, free both at once. */ + Xfree(conv); +} + + +static XlcConvMethodsRec cttocs_methods = { + close_converter, + cttocs, + init_state +}; + +static XlcConv +open_cttocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(&cttocs_methods); +} + + +static XlcConvMethodsRec cstoct_methods = { + close_converter, + cstoct, + init_state +}; + +static XlcConv +open_cstoct( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(&cstoct_methods); +} + + +static XlcConvMethodsRec strtocs_methods = { + close_converter, + strtocs, + init_state +}; + +static XlcConv +open_strtocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(&strtocs_methods); +} + + +static XlcConvMethodsRec cstostr_methods = { + close_converter, + cstostr, + init_state +}; + +static XlcConv +open_cstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(&cstostr_methods); +} + + +/* =========================== Initialization =========================== */ + +Bool +_XlcInitCTInfo(void) +{ + if (ct_list == NULL) { + const CTDataRec *ct_data; + int num; + XlcCharSet charset; + + /* Initialize ct_list. */ + + num = sizeof(default_ct_data) / sizeof(CTDataRec); + for (ct_data = default_ct_data; num > 0; ct_data++, num--) { + charset = _XlcAddCT(ct_data->name, ct_data->ct_sequence); + if (charset == NULL) + continue; + if (strncmp(charset->ct_sequence, "\x1b\x25\x2f", 3) != 0) + charset->source = CSsrcStd; + else + charset->source = CSsrcXLC; + } + + /* Register CompoundText and CharSet converters. */ + + _XlcSetConverter((XLCd) NULL, XlcNCompoundText, + (XLCd) NULL, XlcNCharSet, + open_cttocs); + _XlcSetConverter((XLCd) NULL, XlcNString, + (XLCd) NULL, XlcNCharSet, + open_strtocs); + + _XlcSetConverter((XLCd) NULL, XlcNCharSet, + (XLCd) NULL, XlcNCompoundText, + open_cstoct); + _XlcSetConverter((XLCd) NULL, XlcNCharSet, + (XLCd) NULL, XlcNString, + open_cstostr); + } + + return True; +} diff --git a/nx-X11/lib/src/xlibi18n/lcCharSet.c b/nx-X11/lib/src/xlibi18n/lcCharSet.c new file mode 100644 index 000000000..0adf0adfc --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcCharSet.c @@ -0,0 +1,225 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "XlcPublic.h" +#include "XlcPubI.h" + +/* The list of all known XlcCharSets. They are identified by their name. */ + +typedef struct _XlcCharSetListRec { + XlcCharSet charset; + struct _XlcCharSetListRec *next; +} XlcCharSetListRec, *XlcCharSetList; + +static XlcCharSetList charset_list = NULL; + +/* Returns the charset with the given name (including side suffix). + Returns NULL if not found. */ +XlcCharSet +_XlcGetCharSet( + const char *name) +{ + XlcCharSetList list; + XrmQuark xrm_name; + + xrm_name = XrmStringToQuark(name); + + for (list = charset_list; list; list = list->next) { + if (xrm_name == list->charset->xrm_name) + return (XlcCharSet) list->charset; + } + + return (XlcCharSet) NULL; +} + +/* Returns the charset with the given encoding (no side suffix) and + responsible for at least the given side (XlcGL or XlcGR). + Returns NULL if not found. */ +XlcCharSet +_XlcGetCharSetWithSide( + const char *encoding_name, + XlcSide side) +{ + XlcCharSetList list; + XrmQuark xrm_encoding_name; + + xrm_encoding_name = XrmStringToQuark(encoding_name); + + for (list = charset_list; list; list = list->next) { + if (list->charset->xrm_encoding_name == xrm_encoding_name + && (list->charset->side == XlcGLGR || list->charset->side == side)) + return (XlcCharSet) list->charset; + } + + return (XlcCharSet) NULL; +} + +/* Registers an XlcCharSet in the list of character sets. + Returns True if successful. */ +Bool +_XlcAddCharSet( + XlcCharSet charset) +{ + XlcCharSetList list; + + if (_XlcGetCharSet(charset->name)) + return False; + + list = Xmalloc(sizeof(XlcCharSetListRec)); + if (list == NULL) + return False; + + list->charset = charset; + list->next = charset_list; + charset_list = list; + + return True; +} + +/* List of resources for XlcCharSet. */ +static XlcResource resources[] = { + { XlcNName, NULLQUARK, sizeof(char *), + XOffsetOf(XlcCharSetRec, name), XlcGetMask }, + { XlcNEncodingName, NULLQUARK, sizeof(char *), + XOffsetOf(XlcCharSetRec, encoding_name), XlcGetMask }, + { XlcNSide, NULLQUARK, sizeof(XlcSide), + XOffsetOf(XlcCharSetRec, side), XlcGetMask }, + { XlcNCharSize, NULLQUARK, sizeof(int), + XOffsetOf(XlcCharSetRec, char_size), XlcGetMask }, + { XlcNSetSize, NULLQUARK, sizeof(int), + XOffsetOf(XlcCharSetRec, set_size), XlcGetMask }, + { XlcNControlSequence, NULLQUARK, sizeof(char *), + XOffsetOf(XlcCharSetRec, ct_sequence), XlcGetMask } +}; + +/* Retrieves a number of attributes of an XlcCharSet. + Return NULL if successful, otherwise the name of the first argument + specifiying a nonexistent attribute. */ +static char * +get_values( + XlcCharSet charset, + XlcArgList args, + int num_args) +{ + if (resources[0].xrm_name == NULLQUARK) + _XlcCompileResourceList(resources, XlcNumber(resources)); + + return _XlcGetValues((XPointer) charset, resources, XlcNumber(resources), + args, num_args, XlcGetMask); +} + +/* Retrieves a number of attributes of an XlcCharSet. + Return NULL if successful, otherwise the name of the first argument + specifiying a nonexistent attribute. */ +char * +_XlcGetCSValues(XlcCharSet charset, ...) +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + + va_start(var, charset); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, charset); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = get_values(charset, args, num_args); + + Xfree(args); + + return ret; +} + +/* Creates a new XlcCharSet, given its name (including side suffix) and + Compound Text ESC sequence (normally at most 4 bytes). */ +XlcCharSet +_XlcCreateDefaultCharSet( + const char *name, + const char *ct_sequence) +{ + XlcCharSet charset; + int name_len, ct_sequence_len; + const char *colon; + char *tmp; + + charset = Xcalloc(1, sizeof(XlcCharSetRec)); + if (charset == NULL) + return (XlcCharSet) NULL; + + name_len = strlen(name); + ct_sequence_len = strlen(ct_sequence); + + /* Fill in name and xrm_name. */ + tmp = Xmalloc(name_len + 1 + ct_sequence_len + 1); + if (tmp == NULL) { + Xfree(charset); + return (XlcCharSet) NULL; + } + memcpy(tmp, name, name_len+1); + charset->name = tmp; + charset->xrm_name = XrmStringToQuark(charset->name); + + /* Fill in encoding_name and xrm_encoding_name. */ + if ((colon = strchr(charset->name, ':')) != NULL) { + unsigned int length = colon - charset->name; + char *encoding_tmp = Xmalloc(length + 1); + if (encoding_tmp == NULL) { + Xfree((char *) charset->name); + Xfree(charset); + return (XlcCharSet) NULL; + } + memcpy(encoding_tmp, charset->name, length); + encoding_tmp[length] = '\0'; + charset->encoding_name = encoding_tmp; + charset->xrm_encoding_name = XrmStringToQuark(charset->encoding_name); + } else { + charset->encoding_name = charset->name; + charset->xrm_encoding_name = charset->xrm_name; + } + + /* Fill in ct_sequence. */ + tmp += name_len + 1; + memcpy(tmp, ct_sequence, ct_sequence_len+1); + charset->ct_sequence = tmp; + + /* Fill in side, char_size, set_size. */ + if (!_XlcParseCharSet(charset)) + /* If ct_sequence is not usable in Compound Text, remove it. */ + charset->ct_sequence = ""; + + return (XlcCharSet) charset; +} diff --git a/nx-X11/lib/src/xlibi18n/lcConv.c b/nx-X11/lib/src/xlibi18n/lcConv.c new file mode 100644 index 000000000..7d9a4738c --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcConv.c @@ -0,0 +1,339 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" +#include + +typedef struct _XlcConverterListRec { + XLCd from_lcd; + const char *from; + XrmQuark from_type; + XLCd to_lcd; + const char *to; + XrmQuark to_type; + XlcOpenConverterProc converter; + struct _XlcConverterListRec *next; +} XlcConverterListRec, *XlcConverterList; + +static XlcConverterList conv_list = NULL; + +static void +close_converter( + XlcConv conv) +{ + (*conv->methods->close)(conv); +} + +static XlcConv +get_converter( + XLCd from_lcd, + XrmQuark from_type, + XLCd to_lcd, + XrmQuark to_type) +{ + XlcConverterList list, prev = NULL; + + for (list = conv_list; list; list = list->next) { + 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 */ + prev->next = list->next; + list->next = conv_list; + conv_list = list; + } + + return (*list->converter)(from_lcd, list->from, to_lcd, list->to); + } + + prev = list; + } + + return (XlcConv) NULL; +} + +Bool +_XlcSetConverter( + XLCd from_lcd, + const char *from, + XLCd to_lcd, + const char *to, + XlcOpenConverterProc converter) +{ + XlcConverterList list; + XrmQuark from_type, to_type; + + from_type = XrmStringToQuark(from); + to_type = XrmStringToQuark(to); + + for (list = conv_list; list; list = list->next) { + if (list->from_lcd == from_lcd && list->to_lcd == to_lcd + && list->from_type == from_type && list->to_type == to_type) { + + list->converter = converter; + return True; + } + } + + list = Xmalloc(sizeof(XlcConverterListRec)); + if (list == NULL) + return False; + + list->from_lcd = from_lcd; + list->from = from; + list->from_type = from_type; + list->to_lcd = to_lcd; + list->to = to; + list->to_type = to_type; + list->converter = converter; + list->next = conv_list; + conv_list = list; + + return True; +} + +typedef struct _ConvRec { + XlcConv from_conv; + XlcConv to_conv; +} ConvRec, *Conv; + +static int +indirect_convert( + XlcConv lc_conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + Conv conv = (Conv) lc_conv->state; + XlcConv from_conv = conv->from_conv; + XlcConv to_conv = conv->to_conv; + XlcCharSet charset; + char buf[BUFSIZ], *cs; + XPointer tmp_args[1]; + int cs_left, ret, length, unconv_num = 0; + + if (from == NULL || *from == NULL) { + if (from_conv->methods->reset) + (*from_conv->methods->reset)(from_conv); + + if (to_conv->methods->reset) + (*to_conv->methods->reset)(to_conv); + + return 0; + } + + while (*from_left > 0) { + cs = buf; + cs_left = BUFSIZ; + tmp_args[0] = (XPointer) &charset; + + ret = (*from_conv->methods->convert)(from_conv, from, from_left, &cs, + &cs_left, tmp_args, 1); + if (ret < 0) + break; + + unconv_num += ret; + + length = cs - buf; + if (length > 0) { + cs_left = length; + cs = buf; + + tmp_args[0] = (XPointer) charset; + + ret = (*to_conv->methods->convert)(to_conv, &cs, &cs_left, to, to_left, + tmp_args, 1); + if (ret < 0) { + unconv_num += length / (charset->char_size > 0 ? charset->char_size : 1); + continue; + } + + unconv_num += ret; + + if (*to_left < 1) + break; + } + } + + return unconv_num; +} + +static void +close_indirect_converter( + XlcConv lc_conv) +{ + Conv conv = (Conv) lc_conv->state; + + if (conv) { + if (conv->from_conv) + close_converter(conv->from_conv); + if (conv->to_conv) + close_converter(conv->to_conv); + + Xfree(conv); + } + + Xfree(lc_conv); +} + +static void +reset_indirect_converter( + XlcConv lc_conv) +{ + Conv conv = (Conv) lc_conv->state; + + if (conv) { + if (conv->from_conv && conv->from_conv->methods->reset) + (*conv->from_conv->methods->reset)(conv->from_conv); + if (conv->to_conv && conv->to_conv->methods->reset) + (*conv->to_conv->methods->reset)(conv->to_conv); + } +} + +static XlcConvMethodsRec conv_methods = { + close_indirect_converter, + indirect_convert, + reset_indirect_converter +} ; + +static XlcConv +open_indirect_converter( + XLCd from_lcd, + const char *from, + XLCd to_lcd, + const char *to) +{ + XlcConv lc_conv, from_conv, to_conv; + Conv conv; + XrmQuark from_type, to_type; + static XrmQuark QChar, QCharSet, QCTCharSet = (XrmQuark) 0; + + if (QCTCharSet == (XrmQuark) 0) { + QCTCharSet = XrmStringToQuark(XlcNCTCharSet); + QCharSet = XrmStringToQuark(XlcNCharSet); + QChar = XrmStringToQuark(XlcNChar); + } + + from_type = XrmStringToQuark(from); + to_type = XrmStringToQuark(to); + + if (from_type == QCharSet || from_type == QChar || to_type == QCharSet || + to_type == QChar) + return (XlcConv) NULL; + + lc_conv = Xmalloc(sizeof(XlcConvRec)); + if (lc_conv == NULL) + return (XlcConv) NULL; + + lc_conv->methods = &conv_methods; + + lc_conv->state = Xcalloc(1, sizeof(ConvRec)); + if (lc_conv->state == NULL) + goto err; + + conv = (Conv) lc_conv->state; + + from_conv = get_converter(from_lcd, from_type, from_lcd, QCTCharSet); + if (from_conv == NULL) + from_conv = get_converter(from_lcd, from_type, from_lcd, QCharSet); + if (from_conv == NULL) + from_conv = get_converter((XLCd)NULL, from_type, (XLCd)NULL, QCharSet); + if (from_conv == NULL) + from_conv = get_converter(from_lcd, from_type, from_lcd, QChar); + if (from_conv == NULL) + goto err; + conv->from_conv = from_conv; + + to_conv = get_converter(to_lcd, QCTCharSet, to_lcd, to_type); + if (to_conv == NULL) + to_conv = get_converter(to_lcd, QCharSet, to_lcd, to_type); + if (to_conv == NULL) + to_conv = get_converter((XLCd) NULL, QCharSet, (XLCd) NULL, to_type); + if (to_conv == NULL) + goto err; + conv->to_conv = to_conv; + + return lc_conv; + +err: + close_indirect_converter(lc_conv); + + return (XlcConv) NULL; +} + +XlcConv +_XlcOpenConverter( + XLCd from_lcd, + const char *from, + XLCd to_lcd, + const char *to) +{ + XlcConv conv; + XrmQuark from_type, to_type; + + from_type = XrmStringToQuark(from); + to_type = XrmStringToQuark(to); + + if ((conv = get_converter(from_lcd, from_type, to_lcd, to_type))) + return conv; + + return open_indirect_converter(from_lcd, from, to_lcd, to); +} + +void +_XlcCloseConverter( + XlcConv conv) +{ + close_converter(conv); +} + +int +_XlcConvert( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + return (*conv->methods->convert)(conv, from, from_left, to, to_left, args, + num_args); +} + +void +_XlcResetConverter( + XlcConv conv) +{ + if (conv->methods->reset) + (*conv->methods->reset)(conv); +} diff --git a/nx-X11/lib/src/xlibi18n/lcDB.c b/nx-X11/lib/src/xlibi18n/lcDB.c new file mode 100644 index 000000000..cc14bed72 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcDB.c @@ -0,0 +1,1327 @@ +/* + * + * Copyright IBM Corporation 1993 + * + * All Rights Reserved + * + * License 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 + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * 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, + * 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. + * +*/ +/* + * (c) Copyright 1995 FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ + + + +#ifndef NOT_X_ENV + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include "Xlibint.h" +#include "XlcPubI.h" + +#else /* NOT_X_ENV */ + +#define Xmalloc malloc +#define Xrealloc realloc +#define Xfree free + +#endif /* NOT_X_ENV */ + +/* specifying NOT_X_ENV allows users to just use + the database parsing routine. */ +/* For UDC/VW */ +#ifndef BUFSIZE +#define BUFSIZE 2048 +#endif + +#ifdef COMMENT +#ifdef BUFSIZE +#undef BUFSIZE +#endif +#define BUFSIZE 6144 /* 2048*3 */ +#endif + +#include + +typedef struct _DatabaseRec { + char *category; + char *name; + char **value; + int value_num; + struct _DatabaseRec *next; +} DatabaseRec, *Database; + +typedef enum { + S_NULL, /* outside category */ + S_CATEGORY, /* inside category */ + S_NAME, /* has name, expecting values */ + S_VALUE +} ParseState; + +typedef enum { + T_NEWLINE, + T_COMMENT, + T_SEMICOLON, + T_DOUBLE_QUOTE, + T_LEFT_BRACE, + T_RIGHT_BRACE, + T_SPACE, + T_TAB, + T_BACKSLASH, + T_NUMERIC_HEX, + T_NUMERIC_DEC, + T_NUMERIC_OCT, + T_DEFAULT +} Token; + +typedef struct { + Token token; /* token id */ + int len; /* length of token sequence */ +} TokenTable; + +static int f_newline (const char *str, Token token, Database *db); +static int f_comment (const char *str, Token token, Database *db); +static int f_semicolon (const char *str, Token token, Database *db); +static int f_double_quote (const char *str, Token token, Database *db); +static int f_left_brace (const char *str, Token token, Database *db); +static int f_right_brace (const char *str, Token token, Database *db); +static int f_white (const char *str, Token token, Database *db); +static int f_backslash (const char *str, Token token, Database *db); +static int f_numeric (const char *str, Token token, Database *db); +static int f_default (const char *str, Token token, Database *db); + +static const TokenTable token_tbl[] = { + { T_NEWLINE, 1 }, + { T_COMMENT, 1 }, + { T_SEMICOLON, 1 }, + { T_DOUBLE_QUOTE, 1 }, + { T_LEFT_BRACE, 1 }, + { T_RIGHT_BRACE, 1 }, + { T_SPACE, 1 }, + { T_TAB, 1 }, + { T_BACKSLASH, 1 }, + { T_NUMERIC_HEX, 2 }, + { T_NUMERIC_DEC, 2 }, + { T_NUMERIC_OCT, 2 }, + { T_DEFAULT, 1 } /* any character */ +}; + +#define SYM_CR '\r' +#define SYM_NEWLINE '\n' +#define SYM_COMMENT '#' +#define SYM_SEMICOLON ';' +#define SYM_DOUBLE_QUOTE '"' +#define SYM_LEFT_BRACE '{' +#define SYM_RIGHT_BRACE '}' +#define SYM_SPACE ' ' +#define SYM_TAB '\t' +#define SYM_BACKSLASH '\\' + +/************************************************************************/ + +#define MAX_NAME_NEST 64 + +typedef struct { + ParseState pre_state; + char *category; + char *name[MAX_NAME_NEST]; + int nest_depth; + char **value; + int value_len; + int value_num; + int bufsize; /* bufMaxSize >= bufsize >= 0 */ + int bufMaxSize; /* default : BUFSIZE */ + char *buf; +} DBParseInfo; + +static DBParseInfo parse_info; + +static void +init_parse_info (void) +{ + static int allocated /* = 0 */; + char *ptr; + int size; + if (!allocated) { + bzero(&parse_info, sizeof(DBParseInfo)); + parse_info.buf = Xmalloc(BUFSIZE); + parse_info.bufMaxSize = BUFSIZE; + allocated = 1; + return; + } + ptr = parse_info.buf; + size = parse_info.bufMaxSize; + bzero(&parse_info, sizeof(DBParseInfo)); + parse_info.buf = ptr; + parse_info.bufMaxSize = size; +} + +static void +clear_parse_info (void) +{ + int i; + char *ptr; + int size; + parse_info.pre_state = S_NULL; + if (parse_info.category != NULL) { + Xfree(parse_info.category); + } + for (i = 0; i <= parse_info.nest_depth; ++i) { + if (parse_info.name[i]) { + Xfree(parse_info.name[i]); + } + } + if (parse_info.value) { + if (*parse_info.value) { + Xfree(*parse_info.value); + } + Xfree(parse_info.value); + } + ptr = parse_info.buf; + size = parse_info.bufMaxSize; + bzero(&parse_info, sizeof(DBParseInfo)); + parse_info.buf = ptr; + parse_info.bufMaxSize = size; +} + +static Bool +realloc_parse_info( + int len) +{ + char *p; + int newsize = BUFSIZE * ((parse_info.bufsize + len)/BUFSIZE + 1); + + p = Xrealloc(parse_info.buf, newsize); + if (p == NULL) + return False; + parse_info.bufMaxSize = newsize; + parse_info.buf = p; + + return True; +} + +/************************************************************************/ + +typedef struct _Line { + char *str; + int cursize; + int maxsize; + int seq; +} Line; + +static void +free_line( + Line *line) +{ + if (line->str != NULL) { + Xfree(line->str); + } + bzero(line, sizeof(Line)); +} + +static int +realloc_line( + Line *line, + int size) +{ + char *str = line->str; + + if (str != NULL) { + str = Xrealloc(str, size); + } else { + str = Xmalloc(size); + } + if (str == NULL) { + /* malloc error */ + if (line->str != NULL) { + Xfree(line->str); + } + bzero(line, sizeof(Line)); + return 0; + } + line->str = str; + line->maxsize = size; + return 1; +} + +#define iswhite(ch) ((ch) == SYM_SPACE || (ch) == SYM_TAB) + +static void +zap_comment( + char *str, + int *quoted) +{ + char *p = str; +#ifdef never + *quoted = 0; + if (*p == SYM_COMMENT) { + int len = strlen(str); + if (p[len - 1] == SYM_NEWLINE || p[len - 1] == SYM_CR) { + *p++ = SYM_NEWLINE; + } + *p = '\0'; + } +#else + while (*p) { + if (*p == SYM_DOUBLE_QUOTE) { + if (p == str || p[-1] != SYM_BACKSLASH) { + /* unescaped double quote changes quoted state. */ + *quoted = *quoted ? 0 : 1; + } + } + if (*p == SYM_COMMENT && !*quoted) { + int pos = p - str; + if (pos == 0 || + (iswhite(p[-1]) && (pos == 1 || p[-2] != SYM_BACKSLASH))) { + int len = strlen(p); + if (len > 0 && (p[len - 1] == SYM_NEWLINE || p[len-1] == SYM_CR)) { + /* newline is the identifier for finding end of value. + therefore, it should not be removed. */ + *p++ = SYM_NEWLINE; + } + *p = '\0'; + break; + } + } + ++p; + } +#endif +} + +static int +read_line( + FILE *fd, + Line *line) +{ + char buf[BUFSIZE], *p; + int len; + int quoted = 0; /* quoted by double quote? */ + char *str; + int cur; + + str = line->str; + cur = line->cursize = 0; + + while ((p = fgets(buf, BUFSIZE, fd)) != NULL) { + ++line->seq; + zap_comment(p, "ed); /* remove comment line */ + len = strlen(p); + if (len == 0) { + if (cur > 0) { + break; + } + continue; + } + if (cur + len + 1 > line->maxsize) { + /* need to reallocate buffer. */ + if (! realloc_line(line, line->maxsize + BUFSIZE)) { + return -1; /* realloc error. */ + } + str = line->str; + } + strncpy(str + cur, p, len); + + cur += len; + str[cur] = '\0'; + if (!quoted && cur > 1 && str[cur - 2] == SYM_BACKSLASH && + (str[cur - 1] == SYM_NEWLINE || str[cur-1] == SYM_CR)) { + /* the line is ended backslash followed by newline. + need to concatinate the next line. */ + cur -= 2; + str[cur] = '\0'; + } else if (len < BUFSIZE - 1 || buf[len - 1] == SYM_NEWLINE || + buf[len - 1] == SYM_CR) { + /* the line is shorter than BUFSIZE. */ + break; + } + } + if (quoted) { + /* error. still in quoted state. */ + return -1; + } + return line->cursize = cur; +} + +/************************************************************************/ + +static Token +get_token( + const char *str) +{ + switch (*str) { + case SYM_NEWLINE: + case SYM_CR: return T_NEWLINE; + case SYM_COMMENT: return T_COMMENT; + case SYM_SEMICOLON: return T_SEMICOLON; + case SYM_DOUBLE_QUOTE: return T_DOUBLE_QUOTE; + case SYM_LEFT_BRACE: return T_LEFT_BRACE; + case SYM_RIGHT_BRACE: return T_RIGHT_BRACE; + case SYM_SPACE: return T_SPACE; + case SYM_TAB: return T_TAB; + case SYM_BACKSLASH: + switch (str[1]) { + case 'x': return T_NUMERIC_HEX; + case 'd': return T_NUMERIC_DEC; + case 'o': return T_NUMERIC_OCT; + } + return T_BACKSLASH; + default: + return T_DEFAULT; + } +} + +static int +get_word( + const char *str, + char *word) +{ + const char *p = str; + char *w = word; + Token token; + int token_len; + + while (*p != '\0') { + token = get_token(p); + token_len = token_tbl[token].len; + if (token == T_BACKSLASH) { + p += token_len; + if (*p == '\0') + break; + token = get_token(p); + token_len = token_tbl[token].len; + } else if (token != T_COMMENT && token != T_DEFAULT) { + break; + } + strncpy(w, p, token_len); + p += token_len; w += token_len; + } + *w = '\0'; + return p - str; /* return number of scanned chars */ +} + +static int +get_quoted_word( + const char *str, + char *word) +{ + const char *p = str; + char *w = word; + Token token; + int token_len; + + if (*p == SYM_DOUBLE_QUOTE) { + ++p; + } + while (*p != '\0') { + token = get_token(p); + token_len = token_tbl[token].len; + if (token == T_DOUBLE_QUOTE) { + p += token_len; + goto found; + } + if (token == T_BACKSLASH) { + p += token_len; + if (*p == '\0') { + break; + } + token = get_token(p); + token_len = token_tbl[token].len; + } + strncpy(w, p, token_len); + p += token_len; w += token_len; + } + /* error. cannot detect next double quote */ + return 0; + + found:; + *w = '\0'; + return p - str; +} + +/************************************************************************/ + +static int +append_value_list (void) +{ + char **value_list = parse_info.value; + char *value; + int value_num = parse_info.value_num; + int value_len = parse_info.value_len; + char *str = parse_info.buf; + int len = parse_info.bufsize; + char *p; + + if (len < 1) { + return 1; /* return with no error */ + } + + if (value_list == (char **)NULL) { + value_list = Xmalloc(sizeof(char *) * 2); + *value_list = NULL; + } else { + char **prev_list = value_list; + + value_list = (char **) + Xrealloc(value_list, sizeof(char *) * (value_num + 2)); + if (value_list == NULL) { + Xfree(prev_list); + } + } + if (value_list == (char **)NULL) + goto err2; + + value = *value_list; + if (value == NULL) { + value = Xmalloc(value_len + len + 1); + } else { + char *prev_value = value; + + value = Xrealloc(value, value_len + len + 1); + if (value == NULL) { + Xfree(prev_value); + } + } + if (value == NULL) { + goto err1; + } + if (value != *value_list) { + int i; + ssize_t delta; + delta = value - *value_list; + *value_list = value; + for (i = 1; i < value_num; ++i) { + value_list[i] += delta; + } + } + + value_list[value_num] = p = &value[value_len]; + value_list[value_num + 1] = NULL; + strncpy(p, str, len); + p[len] = 0; + + parse_info.value = value_list; + parse_info.value_num = value_num + 1; + parse_info.value_len = value_len + len + 1; + parse_info.bufsize = 0; + return 1; + + err1: + if (value_list) { + Xfree((char **)value_list); + } + if (value) { + Xfree(value); + } + err2: + parse_info.value = (char **)NULL; + parse_info.value_num = 0; + parse_info.value_len = 0; + parse_info.bufsize = 0; + return 0; +} + +static int +construct_name( + char *name, + int size) +{ + int i; + int len = 0; + char *p = name; + + for (i = 0; i <= parse_info.nest_depth; ++i) { + len += strlen(parse_info.name[i]) + 1; + } + if (len >= size) + return 0; + + strcpy(p, parse_info.name[0]); + p += strlen(parse_info.name[0]); + for (i = 1; i <= parse_info.nest_depth; ++i) { + *p++ = '.'; + strcpy(p, parse_info.name[i]); + p += strlen(parse_info.name[i]); + } + return *name != '\0'; +} + +static int +store_to_database( + Database *db) +{ + Database new = (Database)NULL; + char name[BUFSIZE]; + + if (parse_info.pre_state == S_VALUE) { + if (! append_value_list()) { + goto err; + } + } + + if (parse_info.name[parse_info.nest_depth] == NULL) { + goto err; + } + + new = Xcalloc(1, sizeof(DatabaseRec)); + if (new == (Database)NULL) { + goto err; + } + + new->category = strdup(parse_info.category); + if (new->category == NULL) { + goto err; + } + + if (! construct_name(name, sizeof(name))) { + goto err; + } + new->name = strdup(name); + if (new->name == NULL) { + goto err; + } + new->next = *db; + new->value = parse_info.value; + new->value_num = parse_info.value_num; + *db = new; + + Xfree(parse_info.name[parse_info.nest_depth]); + parse_info.name[parse_info.nest_depth] = NULL; + + parse_info.value = (char **)NULL; + parse_info.value_num = 0; + parse_info.value_len = 0; + + return 1; + + err: + if (new) { + if (new->category) { + Xfree(new->category); + } + if (new->name) { + Xfree(new->name); + } + Xfree(new); + } + if (parse_info.value) { + if (*parse_info.value) { + Xfree(*parse_info.value); + } + Xfree((char **)parse_info.value); + parse_info.value = (char **)NULL; + parse_info.value_num = 0; + parse_info.value_len = 0; + } + return 0; +} + +#define END_MARK "END" +#define END_MARK_LEN 3 /*strlen(END_MARK)*/ + +static int +check_category_end( + const char *str) +{ + const char *p; + int len; + + p = str; + if (strncmp(p, END_MARK, END_MARK_LEN)) { + return 0; + } + p += END_MARK_LEN; + + while (iswhite(*p)) { + ++p; + } + len = strlen(parse_info.category); + if (strncmp(p, parse_info.category, len)) { + return 0; + } + p += len; + return p - str; +} + +/************************************************************************/ + +static int +f_newline( + const char *str, + Token token, + Database *db) +{ + switch (parse_info.pre_state) { + case S_NULL: + case S_CATEGORY: + break; + case S_NAME: + return 0; /* no value */ + case S_VALUE: + if (!store_to_database(db)) + return 0; + parse_info.pre_state = S_CATEGORY; + break; + default: + return 0; + } + return token_tbl[token].len; +} + +static int +f_comment( + const char *str, + Token token, + Database *db) +{ + /* NOTE: comment is already handled in read_line(), + so this function is not necessary. */ + + const char *p = str; + + while (*p != SYM_NEWLINE && *p != SYM_CR && *p != '\0') { + ++p; /* zap to the end of line */ + } + return p - str; +} + +static int +f_white( + const char *str, + Token token, + Database *db) +{ + const char *p = str; + + while (iswhite(*p)) { + ++p; + } + return p - str; +} + +static int +f_semicolon( + const char *str, + Token token, + Database *db) +{ + switch (parse_info.pre_state) { + case S_NULL: + case S_CATEGORY: + case S_NAME: + return 0; + case S_VALUE: + if (! append_value_list()) + return 0; + parse_info.pre_state = S_VALUE; + break; + default: + return 0; + } + return token_tbl[token].len; +} + +static int +f_left_brace( + const char *str, + Token token, + Database *db) +{ + switch (parse_info.pre_state) { + case S_NULL: + case S_CATEGORY: + case S_VALUE: + return 0; + case S_NAME: + if (parse_info.name[parse_info.nest_depth] == NULL + || parse_info.nest_depth + 1 > MAX_NAME_NEST) + return 0; + ++parse_info.nest_depth; + parse_info.pre_state = S_CATEGORY; + break; + default: + return 0; + } + return token_tbl[token].len; +} + +static int +f_right_brace( + const char *str, + Token token, + Database *db) +{ + if (parse_info.nest_depth < 1) + return 0; + + switch (parse_info.pre_state) { + case S_NULL: + case S_NAME: + return 0; + case S_VALUE: + if (! store_to_database(db)) + return 0; + /* fall into next case */ + case S_CATEGORY: + if (parse_info.name[parse_info.nest_depth] != NULL) { + Xfree(parse_info.name[parse_info.nest_depth]); + parse_info.name[parse_info.nest_depth] = NULL; + } + --parse_info.nest_depth; + parse_info.pre_state = S_CATEGORY; + break; + default: + return 0; + } + return token_tbl[token].len; +} + +static int +f_double_quote( + const char *str, + Token token, + Database *db) +{ + char word[BUFSIZE]; + char* wordp; + int len; + + if ((len = strlen (str)) < sizeof word) + wordp = word; + else + wordp = Xmalloc (len + 1); + if (wordp == NULL) + return 0; + + len = 0; + switch (parse_info.pre_state) { + case S_NULL: + case S_CATEGORY: + goto err; + case S_NAME: + case S_VALUE: + len = get_quoted_word(str, wordp); + if (len < 1) + goto err; + if ((parse_info.bufsize + (int)strlen(wordp) + 1) + >= parse_info.bufMaxSize) { + if (realloc_parse_info(strlen(wordp)+1) == False) { + goto err; + } + } + strcpy(&parse_info.buf[parse_info.bufsize], wordp); + parse_info.bufsize += strlen(wordp); + parse_info.pre_state = S_VALUE; + break; + default: + goto err; + } + if (wordp != word) + Xfree (wordp); + return len; /* including length of token */ + +err: + if (wordp != word) + Xfree (wordp); + return 0; +} + +static int +f_backslash( + const char *str, + Token token, + Database *db) +{ + return f_default(str, token, db); +} + +static int +f_numeric( + const char *str, + Token token, + Database *db) +{ + char word[BUFSIZE]; + const char *p; + char* wordp; + int len; + int token_len; + + if ((len = strlen (str)) < sizeof word) + wordp = word; + else + wordp = Xmalloc (len + 1); + if (wordp == NULL) + return 0; + + switch (parse_info.pre_state) { + case S_NULL: + case S_CATEGORY: + goto err; + case S_NAME: + case S_VALUE: + token_len = token_tbl[token].len; + p = str + token_len; + len = get_word(p, wordp); + if (len < 1) + goto err; + 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; + } + strncpy(&parse_info.buf[parse_info.bufsize], str, token_len); + strcpy(&parse_info.buf[parse_info.bufsize + token_len], wordp); + parse_info.bufsize += token_len + strlen(wordp); + parse_info.pre_state = S_VALUE; + break; + default: + goto err; + } + if (wordp != word) + Xfree (wordp); + return len + token_len; + +err: + if (wordp != word) + Xfree (wordp); + return 0; +} + +static int +f_default( + const char *str, + Token token, + Database *db) +{ + char word[BUFSIZE], *p; + char* wordp; + int len; + + if ((len = strlen (str)) < sizeof word) + wordp = word; + else + wordp = Xmalloc (len + 1); + if (wordp == NULL) + return 0; + + len = get_word(str, wordp); + if (len < 1) + goto err; + + switch (parse_info.pre_state) { + case S_NULL: + if (parse_info.category != NULL) + goto err; + p = strdup(wordp); + if (p == NULL) + goto err; + parse_info.category = p; + parse_info.pre_state = S_CATEGORY; + break; + case S_CATEGORY: + if (parse_info.nest_depth == 0) { + if (check_category_end(str)) { + /* end of category is detected. + clear context and zap to end of this line */ + clear_parse_info(); + len = strlen(str); + break; + } + } + p = strdup(wordp); + if (p == NULL) + goto err; + if (parse_info.name[parse_info.nest_depth] != NULL) { + Xfree(parse_info.name[parse_info.nest_depth]); + } + parse_info.name[parse_info.nest_depth] = p; + parse_info.pre_state = S_NAME; + break; + case S_NAME: + case S_VALUE: + if ((parse_info.bufsize + (int)strlen(wordp) + 1) + >= parse_info.bufMaxSize) { + if (realloc_parse_info(strlen(wordp) + 1) == False) + goto err; + } + strcpy(&parse_info.buf[parse_info.bufsize], wordp); + parse_info.bufsize += strlen(wordp); + parse_info.pre_state = S_VALUE; + break; + default: + goto err; + } + if (wordp != word) + Xfree (wordp); + return len; + +err: + if (wordp != word) + Xfree (wordp); + return 0; +} + +/************************************************************************/ + +#ifdef DEBUG +static void +PrintDatabase( + Database db) +{ + Database p = db; + int i = 0, j; + + printf("***\n*** BEGIN Database\n***\n"); + while (p) { + printf("%3d: ", i++); + printf("%s, %s, ", p->category, p->name); + printf("\t[%d: ", p->value_num); + for (j = 0; j < p->value_num; ++j) { + printf("%s, ", p->value[j]); + } + printf("]\n"); + p = p->next; + } + printf("***\n*** END Database\n***\n"); +} +#endif + +static void +DestroyDatabase( + Database db) +{ + Database p = db; + + while (p) { + if (p->category != NULL) { + Xfree(p->category); + } + if (p->name != NULL) { + Xfree(p->name); + } + if (p->value != (char **)NULL) { + if (*p->value != NULL) { + Xfree(*p->value); + } + Xfree(p->value); + } + db = p->next; + Xfree(p); + p = db; + } +} + +static int +CountDatabase( + Database db) +{ + Database p = db; + int cnt = 0; + + while (p) { + ++cnt; + p = p->next; + } + return cnt; +} + +static Database +CreateDatabase( + char *dbfile) +{ + Database db = (Database)NULL; + FILE *fd; + Line line; + char *p; + Token token; + int len; + int error = 0; + + fd = _XFopenFile(dbfile, "r"); + if (fd == (FILE *)NULL) + return NULL; + + bzero(&line, sizeof(Line)); + init_parse_info(); + + do { + int rc = read_line(fd, &line); + if (rc < 0) { + error = 1; + break; + } else if (rc == 0) { + break; + } + p = line.str; + while (*p) { + int (*parse_proc)(const char *str, Token token, Database *db) = NULL; + + token = get_token(p); + + switch (token_tbl[token].token) { + case T_NEWLINE: + parse_proc = f_newline; + break; + case T_COMMENT: + parse_proc = f_comment; + break; + case T_SEMICOLON: + parse_proc = f_semicolon; + break; + case T_DOUBLE_QUOTE: + parse_proc = f_double_quote; + break; + case T_LEFT_BRACE: + parse_proc = f_left_brace; + break; + case T_RIGHT_BRACE: + parse_proc = f_right_brace; + break; + case T_SPACE: + case T_TAB: + parse_proc = f_white; + break; + case T_BACKSLASH: + parse_proc = f_backslash; + break; + case T_NUMERIC_HEX: + case T_NUMERIC_DEC: + case T_NUMERIC_OCT: + parse_proc = f_numeric; + break; + case T_DEFAULT: + parse_proc = f_default; + break; + } + + len = parse_proc(p, token, &db); + + if (len < 1) { + error = 1; + break; + } + p += len; + } + } while (!error); + + if (parse_info.pre_state != S_NULL) { + clear_parse_info(); + error = 1; + } + if (error) { +#ifdef DEBUG + fprintf(stderr, "database format error at line %d.\n", line.seq); +#endif + DestroyDatabase(db); + db = (Database)NULL; + } + + fclose(fd); + free_line(&line); + +#ifdef DEBUG + PrintDatabase(db); +#endif + + return db; +} + +/************************************************************************/ + +#ifndef NOT_X_ENV + +/* locale framework functions */ + +typedef struct _XlcDatabaseRec { + XrmQuark category_q; + XrmQuark name_q; + Database db; + struct _XlcDatabaseRec *next; +} XlcDatabaseRec, *XlcDatabase; + +typedef struct _XlcDatabaseListRec { + XrmQuark name_q; + XlcDatabase lc_db; + Database database; + int ref_count; + struct _XlcDatabaseListRec *next; +} XlcDatabaseListRec, *XlcDatabaseList; + +/* database cache list (per file) */ +static XlcDatabaseList _db_list = (XlcDatabaseList)NULL; + +/************************************************************************/ +/* _XlcGetResource(lcd, category, class, value, count) */ +/*----------------------------------------------------------------------*/ +/* This function retrieves XLocale database information. */ +/************************************************************************/ +void +_XlcGetResource( + XLCd lcd, + const char *category, + const char *class, + char ***value, + int *count) +{ + XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); + + (*methods->get_resource)(lcd, category, class, value, count); + return; +} + +/************************************************************************/ +/* _XlcGetLocaleDataBase(lcd, category, class, value, count) */ +/*----------------------------------------------------------------------*/ +/* This function retrieves XLocale database information. */ +/************************************************************************/ +void +_XlcGetLocaleDataBase( + XLCd lcd, + const char *category, + const char *name, + char ***value, + int *count) +{ + XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); + XrmQuark category_q, name_q; + + category_q = XrmStringToQuark(category); + name_q = XrmStringToQuark(name); + for (; lc_db->db; ++lc_db) { + if (category_q == lc_db->category_q && name_q == lc_db->name_q) { + *value = lc_db->db->value; + *count = lc_db->db->value_num; + return; + } + } + *value = (char **)NULL; + *count = 0; +} + +/************************************************************************/ +/* _XlcDestroyLocaleDataBase(lcd) */ +/*----------------------------------------------------------------------*/ +/* This function destroy the XLocale Database that bound to the */ +/* specified lcd. If the XLocale Database is refered from some */ +/* other lcd, this function just decreases reference count of */ +/* the database. If no locale refers the database, this function */ +/* remove it from the cache list and free work area. */ +/************************************************************************/ +void +_XlcDestroyLocaleDataBase( + XLCd lcd) +{ + XlcDatabase lc_db = (XlcDatabase)XLC_PUBLIC(lcd, xlocale_db); + XlcDatabaseList p, prev; + + for (p = _db_list, prev = (XlcDatabaseList)NULL; p; + prev = p, p = p->next) { + if (p->lc_db == lc_db) { + if ((-- p->ref_count) < 1) { + if (p->lc_db != (XlcDatabase)NULL) { + Xfree(p->lc_db); + } + DestroyDatabase(p->database); + if (prev == (XlcDatabaseList)NULL) { + _db_list = p->next; + } else { + prev->next = p->next; + } + Xfree((char*)p); + } + break; + } + } + XLC_PUBLIC(lcd, xlocale_db) = (XPointer)NULL; +} + +/************************************************************************/ +/* _XlcCreateLocaleDataBase(lcd) */ +/*----------------------------------------------------------------------*/ +/* This function create an XLocale database which correspond to */ +/* the specified XLCd. */ +/************************************************************************/ +XPointer +_XlcCreateLocaleDataBase( + XLCd lcd) +{ + XlcDatabaseList list, new; + Database p, database = (Database)NULL; + XlcDatabase lc_db = (XlcDatabase)NULL; + XrmQuark name_q; + char *name; + int i, n; + + name = _XlcFileName(lcd, "locale"); + if (name == NULL) + return (XPointer)NULL; + + name_q = XrmStringToQuark(name); + for (list = _db_list; list; list = list->next) { + if (name_q == list->name_q) { + list->ref_count++; + Xfree (name); + return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)list->lc_db; + } + } + + database = CreateDatabase(name); + if (database == (Database)NULL) { + Xfree (name); + return (XPointer)NULL; + } + n = CountDatabase(database); + lc_db = Xcalloc(n + 1, sizeof(XlcDatabaseRec)); + if (lc_db == (XlcDatabase)NULL) + goto err; + for (p = database, i = 0; p && i < n; p = p->next, ++i) { + lc_db[i].category_q = XrmStringToQuark(p->category); + lc_db[i].name_q = XrmStringToQuark(p->name); + lc_db[i].db = p; + } + + new = Xmalloc(sizeof(XlcDatabaseListRec)); + if (new == (XlcDatabaseList)NULL) { + goto err; + } + new->name_q = name_q; + new->lc_db = lc_db; + new->database = database; + new->ref_count = 1; + new->next = _db_list; + _db_list = new; + + Xfree (name); + return XLC_PUBLIC(lcd, xlocale_db) = (XPointer)lc_db; + + err: + DestroyDatabase(database); + if (lc_db != (XlcDatabase)NULL) { + Xfree(lc_db); + } + Xfree (name); + return (XPointer)NULL; +} + +#endif /* NOT_X_ENV */ diff --git a/nx-X11/lib/src/xlibi18n/lcFile.c b/nx-X11/lib/src/xlibi18n/lcFile.c new file mode 100644 index 000000000..cf03a90a7 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcFile.c @@ -0,0 +1,711 @@ +/* + * + * Copyright IBM Corporation 1993 + * + * All Rights Reserved + * + * License 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 + * supporting documentation, and that the name of IBM not be + * used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. + * + * IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * 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, + * 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. + * +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include "Xlibint.h" +#include "XlcPubI.h" +#include +#include + +/************************************************************************/ + +#define iscomment(ch) ((ch) == '#' || (ch) == '\0') +#if defined(WIN32) +#define isreadable(f) (_XAccessFile(f)) +#else +#define isreadable(f) ((access((f), R_OK) != -1) ? 1 : 0) +#endif + +#define LC_PATHDELIM ':' + +#define XLC_BUFSIZE 256 + +#include "pathmax.h" + +#define NUM_LOCALEDIR 64 + +/* Splits a NUL terminated line into constituents, at colons and newline + characters. Leading whitespace is removed from constituents. The + constituents are stored at argv[0..argsize-1]. The number of stored + constituents (<= argsize) is returned. The line is destructively + modified. */ +static int +parse_line( + char *line, + char **argv, + int argsize) +{ + int argc = 0; + char *p = line; + + while (argc < argsize) { + while (isspace(*p)) { + ++p; + } + if (*p == '\0') { + break; + } + argv[argc++] = p; + while (*p != ':' && *p != '\n' && *p != '\0') { + ++p; + } + if (*p == '\0') { + break; + } + *p++ = '\0'; + } + + return argc; +} + +#if defined(WIN32) + +/* this is parse_line but skips drive letters at the beginning of the entry */ +static int +parse_line1( + char *line, + char **argv, + int argsize) +{ + int argc = 0; + char *p = line; + + while (argc < argsize) { + while (isspace(*p)) { + ++p; + } + if (*p == '\0') { + break; + } + argv[argc++] = p; + if (isalpha(*p) && p[1] == ':') { + p+= 2; /* skip drive letters */ + } + while (*p != ':' && *p != '\n' && *p != '\0') { + ++p; + } + if (*p == '\0') { + break; + } + *p++ = '\0'; + } + + return argc; +} + +#endif /* WIN32 */ + +/* Splits a colon separated list of directories, and returns the constituent + paths (without trailing slash). At most argsize constituents are stored + at argv[0..argsize-1]. The number of stored constituents is returned. */ +static int +_XlcParsePath( + char *path, + char **argv, + int argsize) +{ + char *p = path; + int n, i; + +#if !defined(WIN32) + n = parse_line(path, argv, argsize); +#else + n = parse_line1(path, argv, argsize); +#endif + for (i = 0; i < n; ++i) { + int len; + p = argv[i]; + len = strlen(p); + if (len > 0 && p[len - 1] == '/') { + /* eliminate trailing slash */ + p[len - 1] = '\0'; + } + } + return n; +} + +#ifndef XLOCALEDIR +#define XLOCALEDIR "/usr/lib/X11/locale" +#endif + +void +xlocaledir( + char *buf, + int buf_len) +{ + char *p = buf; + int len = 0; + +#ifndef NO_XLOCALEDIR + char *dir; + int priv = 1; + + dir = getenv("XLOCALEDIR"); + + if (dir) { +#ifndef WIN32 + /* + * Only use the user-supplied path if the process isn't priviledged. + */ + if (getuid() == geteuid() && getgid() == getegid()) { +#if defined(HASSETUGID) + priv = issetugid(); +#elif defined(HASGETRESUID) + { + uid_t ruid, euid, suid; + gid_t rgid, egid, sgid; + if ((getresuid(&ruid, &euid, &suid) == 0) && + (getresgid(&rgid, &egid, &sgid) == 0)) + priv = (euid != suid) || (egid != sgid); + } +#else + /* + * If there are saved ID's the process might still be priviledged + * even though the above test succeeded. If issetugid() and + * getresgid() aren't available, test this by trying to set + * euid to 0. + * + * Note: this only protects setuid-root clients. It doesn't + * protect other setuid or any setgid clients. If this tradeoff + * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def. + */ + unsigned int oldeuid; + oldeuid = geteuid(); + if (seteuid(0) != 0) { + priv = 0; + } else { + if (seteuid(oldeuid) == -1) { + /* XXX ouch, coudn't get back to original uid + what can we do ??? */ + _exit(127); + } + priv = 1; + } +#endif + } +#else + priv = 0; +#endif + if (!priv) { + len = strlen(dir); + strncpy(p, dir, buf_len); + if (len < buf_len) { + p[len++] = LC_PATHDELIM; + p += len; + } + } + } +#endif /* NO_XLOCALEDIR */ + + if (len < buf_len) + strncpy(p, XLOCALEDIR, buf_len - len); + buf[buf_len-1] = '\0'; +} + +static void +xlocalelibdir( + char *buf, + int buf_len) +{ + char *p = buf; + int len = 0; + +#ifndef NO_XLOCALEDIR + char *dir; + int priv = 1; + + dir = getenv("XLOCALELIBDIR"); + + if (dir) { +#ifndef WIN32 + /* + * Only use the user-supplied path if the process isn't priviledged. + */ + if (getuid() == geteuid() && getgid() == getegid()) { +#if defined(HASSETUGID) + priv = issetugid(); +#elif defined(HASGETRESUID) + { + uid_t ruid, euid, suid; + gid_t rgid, egid, sgid; + if ((getresuid(&ruid, &euid, &suid) == 0) && + (getresgid(&rgid, &egid, &sgid) == 0)) + priv = (euid != suid) || (egid != sgid); + } +#else + /* + * If there are saved ID's the process might still be priviledged + * even though the above test succeeded. If issetugid() and + * getresgid() aren't available, test this by trying to set + * euid to 0. + * + * Note: this only protects setuid-root clients. It doesn't + * protect other setuid or any setgid clients. If this tradeoff + * isn't acceptable, set DisableXLocaleDirEnv to YES in host.def. + */ + unsigned int oldeuid; + oldeuid = geteuid(); + if (seteuid(0) != 0) { + priv = 0; + } else { + if (seteuid(oldeuid) == -1) { + /* XXX ouch, coudn't get back to original uid + what can we do ??? */ + _exit(127); + } + priv = 1; + } +#endif + } +#else + priv = 0; +#endif + if (!priv) { + len = strlen(dir); + strncpy(p, dir, buf_len); + if (len < buf_len) { + p[len++] = LC_PATHDELIM; + p += len; + } + } + } +#endif /* NO_XLOCALEDIR */ + + if (len < buf_len) + strncpy(p, XLOCALELIBDIR, buf_len - len); + buf[buf_len-1] = '\0'; +} + +/* Mapping direction */ +typedef enum { + LtoR, /* Map first field to second field */ + RtoL /* Map second field to first field */ +} MapDirection; + +static char * +resolve_name( + const char *lc_name, + char *file_name, + MapDirection direction) +{ + FILE *fp; + char buf[XLC_BUFSIZE], *name = NULL; + + fp = _XFopenFile (file_name, "r"); + if (fp == NULL) + return NULL; + + while (fgets(buf, XLC_BUFSIZE, fp) != NULL) { + char *p = buf; + int n; + char *args[2], *from, *to; + while (isspace(*p)) { + ++p; + } + if (iscomment(*p)) { + continue; + } + n = parse_line(p, args, 2); /* get first 2 fields */ + if (n != 2) { + continue; + } + if (direction == LtoR) { + from = args[0], to = args[1]; /* left to right */ + } else { + from = args[1], to = args[0]; /* right to left */ + } + if (! strcmp(from, lc_name)) { + name = strdup(to); + break; + } + } + fclose(fp); + return name; +} + +#define c_tolower(ch) ((ch) >= 'A' && (ch) <= 'Z' ? (ch) - 'A' + 'a' : (ch)) + +static char * +lowercase( + char *dst, + const char *src) +{ + const char *s; + char *t; + + for (s = src, t = dst; *s; ++s, ++t) + *t = c_tolower(*s); + *t = '\0'; + return dst; +} + +/* + * normalize_lcname(): remove any '_' and '-' and convert any character + * to lower case after the _ part. If result is identical + * to argument, free result and + * return NULL. + */ +static char * +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++; + while (*tmp) { + if (*tmp != '-') + *p++ = c_tolower(*tmp); + tmp++; + } + } + *p = '\0'; + + if (strcmp(ret, name) == 0) { + Xfree(ret); + return NULL; + } + + return ret; +} + +/************************************************************************/ +char * +_XlcFileName( + XLCd lcd, + const char *category) +{ + char *siname; + char cat[XLC_BUFSIZE], dir[XLC_BUFSIZE]; + int i, n; + char *args[NUM_LOCALEDIR]; + char *file_name = NULL; + + if (lcd == (XLCd)NULL) + return NULL; + + siname = XLC_PUBLIC(lcd, siname); + + 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; + + if (args[i] == NULL) + continue; + + name = NULL; + if (snprintf(buf, PATH_MAX, "%s/%s.dir", args[i], cat) < PATH_MAX) { + name = resolve_name(siname, buf, RtoL); + } + if (name == NULL) { + continue; + } + if (*name == '/') { + /* supposed to be absolute path name */ + file_name = name; + } else { + if (snprintf(buf, PATH_MAX, "%s/%s", args[i], name) < PATH_MAX) + file_name = strdup(buf); + else + file_name = NULL; + Xfree(name); + } + if (file_name && isreadable(file_name)) { + break; + } + Xfree(file_name); + file_name = NULL; + /* Then, try with next dir */ + } + return file_name; +} + +/************************************************************************/ +#ifndef LOCALE_ALIAS +#define LOCALE_ALIAS "locale.alias" +#endif + +int +_XlcResolveLocaleName( + const char* lc_name, + XLCdPublicPart* pub) +{ + char dir[PATH_MAX], buf[PATH_MAX], *name = NULL; + char *dst; + int i, n, sinamelen; + char *args[NUM_LOCALEDIR]; + static const char locale_alias[] = LOCALE_ALIAS; + char *tmp_siname; + char *nlc_name = NULL; + + xlocaledir (dir, PATH_MAX); + n = _XlcParsePath(dir, args, NUM_LOCALEDIR); + for (i = 0; i < n; ++i) { + if (args[i] == NULL) + continue; + + if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) + < PATH_MAX) { + name = resolve_name (lc_name, buf, LtoR); + if (!name) { + if (!nlc_name) + nlc_name = normalize_lcname(lc_name); + if (nlc_name) + name = resolve_name (nlc_name, buf, LtoR); + } + } + if (name != NULL) { + break; + } + } + Xfree(nlc_name); + + if (name == NULL) { + /* vendor locale name == Xlocale name, no expansion of alias */ + pub->siname = strdup (lc_name); + } else { + pub->siname = name; + } + + sinamelen = strlen (pub->siname); + if (sinamelen == 1 && pub->siname[0] == 'C') { + pub->language = pub->siname; + pub->territory = pub->codeset = NULL; + return 1; + } + + /* + * pub->siname is in the format _., 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. + */ + tmp_siname = Xrealloc (pub->siname, 2 * (sinamelen + 1)); + if (tmp_siname == NULL) { + return 0; + } + pub->siname = tmp_siname; + + /* language */ + dst = &pub->siname[sinamelen + 1]; + strcpy (dst, pub->siname); + pub->language = dst; + + /* territory */ + dst = strchr (dst, '_'); + if (dst) { + *dst = '\0'; + pub->territory = ++dst; + } else + dst = &pub->siname[sinamelen + 1]; + + /* codeset */ + dst = strchr (dst, '.'); + if (dst) { + *dst = '\0'; + pub->codeset = ++dst; + } + + return (pub->siname[0] != '\0') ? 1 : 0; +} + +/************************************************************************/ +int +_XlcResolveI18NPath(char *buf, int buf_len) +{ + if (buf != NULL) { + xlocaledir(buf, buf_len); + } + return 1; +} + +char * +_XlcLocaleDirName(char *dir_name, size_t dir_len, const char *lc_name) +{ + char dir[PATH_MAX], buf[PATH_MAX]; + int i, n; + char *args[NUM_LOCALEDIR]; + static char locale_alias[] = LOCALE_ALIAS; + char *target_name = NULL; + char *target_dir = NULL; + char *nlc_name = NULL; + static char* last_dir_name = 0; + static size_t last_dir_len = 0; + static char* last_lc_name = 0; + + if (last_lc_name != 0 && strcmp (last_lc_name, lc_name) == 0 + && dir_len >= last_dir_len) { + strcpy (dir_name, last_dir_name); + return dir_name; + } + + xlocaledir (dir, PATH_MAX); + n = _XlcParsePath(dir, args, NUM_LOCALEDIR); + for (i = 0; i < n; ++i) { + char *name = NULL; + + if (args[i] == NULL) + continue; + + if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) + < PATH_MAX) { + name = resolve_name(lc_name, buf, LtoR); + if (!name) { + if (!nlc_name) + nlc_name = normalize_lcname(lc_name); + if (nlc_name) + name = resolve_name (nlc_name, buf, LtoR); + } + } + + /* look at locale.dir */ + + target_dir = args[i]; + if (snprintf(buf, PATH_MAX, "%s/locale.dir", target_dir) < PATH_MAX) { + /* If name is not an alias, use lc_name for locale.dir search */ + target_name = resolve_name(name ? name : lc_name, buf, RtoL); + } + Xfree(name); + name = NULL; + if (target_name != NULL) { + char *p = 0; + if ((p = strstr(target_name, "/XLC_LOCALE"))) { + *p = '\0'; + break; + } + Xfree(target_name); + target_name = NULL; + } + } + Xfree(nlc_name); + + if (target_name == NULL) + /* vendor locale name == Xlocale name, no expansion of alias */ + snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name); + else + snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name); + + Xfree(target_name); + Xfree (last_dir_name); + Xfree (last_lc_name); + + last_dir_len = strlen (dir_name) + 1; + last_dir_name = Xmalloc (last_dir_len); + strcpy (last_dir_name, dir_name); + last_lc_name = strdup (lc_name); + + return dir_name; +} + +char * +_XlcLocaleLibDirName(char *dir_name, size_t dir_len, const char *lc_name) +{ + char dir[PATH_MAX], buf[PATH_MAX]; + int i, n; + char *args[NUM_LOCALEDIR]; + static char locale_alias[] = LOCALE_ALIAS; + char *target_name = NULL; + char *target_dir = NULL; + char *nlc_name = NULL; + static char* last_dir_name = 0; + static size_t last_dir_len = 0; + static char* last_lc_name = 0; + + if (last_lc_name != 0 && strcmp (last_lc_name, lc_name) == 0 + && dir_len >= last_dir_len) { + strcpy (dir_name, last_dir_name); + return dir_name; + } + + xlocalelibdir (dir, PATH_MAX); + n = _XlcParsePath(dir, args, NUM_LOCALEDIR); + for (i = 0; i < n; ++i) { + char *name = NULL; + + if (args[i] == NULL) + continue; + + if (snprintf (buf, PATH_MAX, "%s/%s", args[i], locale_alias) + < PATH_MAX) { + name = resolve_name(lc_name, buf, LtoR); + if (!name) { + if (!nlc_name) + nlc_name = normalize_lcname(lc_name); + if (nlc_name) + name = resolve_name (nlc_name, buf, LtoR); + } + } + + /* look at locale.dir */ + + target_dir = args[i]; + if (snprintf(buf, PATH_MAX, "%s/locale.dir", target_dir) < PATH_MAX) { + /* If name is not an alias, use lc_name for locale.dir search */ + target_name = resolve_name(name ? name : lc_name, buf, RtoL); + } + Xfree(name); + name = NULL; + if (target_name != NULL) { + char *p = 0; + if ((p = strstr(target_name, "/XLC_LOCALE"))) { + *p = '\0'; + break; + } + Xfree(target_name); + target_name = NULL; + } + } + Xfree(nlc_name); + + if (target_name == NULL) + /* vendor locale name == Xlocale name, no expansion of alias */ + snprintf(dir_name, dir_len, "%s/%s", args[0], lc_name); + else + snprintf(dir_name, dir_len, "%s/%s", target_dir, target_name); + Xfree(target_name); + Xfree (last_dir_name); + Xfree (last_lc_name); + + last_dir_len = strlen (dir_name) + 1; + last_dir_name = Xmalloc (last_dir_len); + strcpy (last_dir_name, dir_name); + last_lc_name = strdup (lc_name); + + return dir_name; +} diff --git a/nx-X11/lib/src/xlibi18n/lcGeneric.c b/nx-X11/lib/src/xlibi18n/lcGeneric.c new file mode 100644 index 000000000..58ee5d27c --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcGeneric.c @@ -0,0 +1,1171 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * (c) Copyright 1995 FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "XlcGeneric.h" + +static XLCd create (const char *name, XLCdMethods methods); +static Bool initialize (XLCd lcd); +static void destroy (XLCd lcd); + +static XLCdPublicMethodsRec genericMethods = { + { NULL }, /* use default methods */ + { + NULL, + create, + initialize, + destroy, + NULL + } +}; + +XLCdMethods _XlcGenericMethods = (XLCdMethods) &genericMethods; + +static XLCd +create( + const char *name, + XLCdMethods methods) +{ + XLCd lcd; + XLCdPublicMethods new; + + lcd = Xcalloc(1, sizeof(XLCdRec)); + if (lcd == NULL) + return (XLCd) NULL; + + lcd->core = Xcalloc(1, sizeof(XLCdGenericRec)); + if (lcd->core == NULL) + goto err; + + new = Xmalloc(sizeof(XLCdPublicMethodsRec)); + if (new == NULL) + goto err; + memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); + lcd->methods = (XLCdMethods) new; + + return lcd; + +err: + Xfree(lcd); + return (XLCd) NULL; +} + +static Bool +string_to_encoding( + const char *str, + char *encoding) +{ + char *next; + long value; + int base; + + while (*str) { + if (*str == '\\') { + switch (*(str + 1)) { + case 'x': + case 'X': + base = 16; + break; + default: + base = 8; + break; + } + value = strtol(str + 2, &next, base); + if (str + 2 != next) { + *((unsigned char *) encoding++) = (unsigned char) value; + str = next; + continue; + } + } + *encoding++ = *str++; + } + + *encoding = '\0'; + + return True; +} + +static Bool +string_to_ulong( + const char *str, + unsigned long *value) +{ + const char *tmp1 = str; + int base; + + if (*tmp1++ != '\\') { + tmp1--; + base = 10; + } else { + switch (*tmp1++) { + case 'x': + base = 16; + break; + case 'o': + base = 8; + break; + case 'd': + base = 10; + break; + default: + return(False); + } + } + *value = (unsigned long) strtol(tmp1, NULL, base); + return(True); +} + + +static Bool +add_charset( + CodeSet codeset, + XlcCharSet charset) +{ + XlcCharSet *new_list; + int num; + + if ((num = codeset->num_charsets)) + new_list = Xrealloc(codeset->charset_list, + (num + 1) * sizeof(XlcCharSet)); + else + new_list = Xmalloc(sizeof(XlcCharSet)); + + if (new_list == NULL) + return False; + + new_list[num] = charset; + codeset->charset_list = new_list; + codeset->num_charsets = num + 1; + + return True; +} + +static CodeSet +add_codeset( + XLCdGenericPart *gen) +{ + CodeSet new, *new_list; + int num; + + new = Xcalloc(1, sizeof(CodeSetRec)); + if (new == NULL) + return NULL; + + if ((num = gen->codeset_num)) + new_list = Xrealloc(gen->codeset_list, + (num + 1) * sizeof(CodeSet)); + else + new_list = Xmalloc(sizeof(CodeSet)); + + if (new_list == NULL) + goto err; + + new_list[num] = new; + gen->codeset_list = new_list; + gen->codeset_num = num + 1; + + return new; + +err: + Xfree(new); + + return NULL; +} + +static Bool +add_parse_list( + XLCdGenericPart *gen, + EncodingType type, + const char *encoding, + CodeSet codeset) +{ + ParseInfo new, *new_list; + char *str; + unsigned char ch; + int num; + + str = strdup(encoding); + if (str == NULL) + return False; + + new = Xcalloc(1, sizeof(ParseInfoRec)); + if (new == NULL) + goto err; + + if (gen->mb_parse_table == NULL) { + gen->mb_parse_table = Xcalloc(1, 256); /* 2^8 */ + if (gen->mb_parse_table == NULL) + goto err; + } + + if ((num = gen->mb_parse_list_num)) + new_list = Xrealloc(gen->mb_parse_list, + (num + 2) * sizeof(ParseInfo)); + else { + new_list = Xmalloc(2 * sizeof(ParseInfo)); + } + + if (new_list == NULL) + goto err; + + new_list[num] = new; + new_list[num + 1] = NULL; + gen->mb_parse_list = new_list; + gen->mb_parse_list_num = num + 1; + + ch = (unsigned char) *str; + if (gen->mb_parse_table[ch] == 0) + gen->mb_parse_table[ch] = num + 1; + + new->type = type; + new->encoding = str; + new->codeset = codeset; + + if (codeset->parse_info == NULL) + codeset->parse_info = new; + + return True; + +err: + Xfree(str); + + Xfree(new); + + return False; +} + +static void +free_charset( + XLCd lcd) +{ + XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); + ParseInfo *parse_info; + int num; + + Xfree(gen->mb_parse_table); + if ((num = gen->mb_parse_list_num) > 0) { + for (parse_info = gen->mb_parse_list; num-- > 0; parse_info++) { + Xfree((*parse_info)->encoding); + Xfree(*parse_info); + } + Xfree(gen->mb_parse_list); + } + + if ((num = gen->codeset_num) > 0) + Xfree(gen->codeset_list); +} + +/* For VW/UDC */ + +#define FORWARD (unsigned long)'+' +#define BACKWARD (unsigned long)'-' + +static const char * +getscope( + const char *str, + FontScope scp) +{ + unsigned long start = 0; + unsigned long end = 0; + unsigned long dest = 0; + unsigned long shift = 0; + unsigned long direction = 0; + sscanf(str,"[\\x%lx,\\x%lx]->\\x%lx", &start, &end, &dest); + if (dest) { + if (dest >= start) { + shift = dest - start; + direction = FORWARD ; + } else { + shift = start - dest; + direction = BACKWARD; + } + } + scp->start = start ; + scp->end = end ; + scp->shift = shift ; + scp->shift_direction + = direction ; + /* .......... */ + while (*str) { + if (*str == ',' && *(str+1) == '[') + break; + str++; + } + return str+1; +} + +static int +count_scopemap( + const char *str) +{ + const char *ptr; + int num=0; + for (ptr=str; *ptr; ptr++) { + if (*ptr == ']') { + num++; + } + } + return num; +} + +FontScope +_XlcParse_scopemaps( + const char *str, + int *size) +{ + int num=0,i; + FontScope scope,sc_ptr; + const char *str_sc; + + num = count_scopemap(str); + scope = Xmalloc(num * sizeof(FontScopeRec)); + if (scope == NULL) + return NULL; + + for (i=0, str_sc=str, sc_ptr=scope; i < num; i++, sc_ptr++) { + str_sc = getscope(str_sc, sc_ptr); + } + *size = num; + return scope; +} + +void +_XlcDbg_printValue( + const char *str, + char **value, + int num) +{ +/* + int i; + for (i = 0; i < num; i++) + fprintf(stderr, "%s value[%d] = %s\n", str, i, value[i]); +*/ +} + +static void +dmpscope( + const char* name, + FontScope sc, + int num) +{ +/* + int i; + fprintf(stderr, "dmpscope %s\n", name); + for (i=0; isource = CSsrcXLC; + } + return charset; +} + +static void +read_charset_define( + XLCd lcd, + XLCdGenericPart *gen) +{ + int i; + char csd[16], cset_name[256]; + char name[BUFSIZ]; + XlcCharSet charsetd; + char **value; + int num, new = 0; + XlcSide side = XlcUnknown; + char *tmp; + + for (i=0; ; i++) { /* loop start */ + charsetd = 0; + snprintf(csd, sizeof(csd), "csd%d", i); + + /* charset_name */ + snprintf(name, sizeof(name), "%s.%s", csd, "charset_name"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + _XlcDbg_printValue(name,value,num); + if (num > 0) { + /* hackers will get truncated -- C'est la vie */ + strncpy(cset_name,value[0], sizeof cset_name - 1); + cset_name[(sizeof cset_name) - 1] = '\0'; + snprintf(name, sizeof(name), "%s.%s", csd , "side"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { + side = XlcGLGR; + } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { + side = XlcGL; + strcat(cset_name,":GL"); + } else { + side = XlcGR; + strcat(cset_name,":GR"); + } + if (charsetd == NULL && + (charsetd = srch_charset_define(cset_name,&new)) == NULL) + return; + } + } else { + if (i == 0) + continue; + else + break; + } + if (new) { + tmp = strdup(cset_name); + if (tmp == NULL) + return; + charsetd->name = tmp; + } + /* side */ + charsetd->side = side ; + /* length */ + snprintf(name, sizeof(name), "%s.%s", csd, "length"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + charsetd->char_size = atoi(value[0]); + } + /* gc_number */ + snprintf(name, sizeof(name), "%s.%s", csd, "gc_number"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + charsetd->set_size = atoi(value[0]); + } + /* string_encoding */ + snprintf(name, sizeof(name), "%s.%s", csd, "string_encoding"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + if (!strcmp("False",value[0])) { + charsetd->string_encoding = False; + } else { + charsetd->string_encoding = True; + } + } + /* sequence */ + snprintf(name, sizeof(name), "%s.%s", csd, "sequence"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); +/* + if (charsetd->ct_sequence) { + Xfree(charsetd->ct_sequence); + } +*/ + tmp = Xmalloc(strlen(value[0])+1); + if (tmp == NULL) + return; + charsetd->ct_sequence = tmp; + string_to_encoding(value[0],tmp); + } + /* encoding_name */ + snprintf(name, sizeof(name), "%s.%s", csd, "encoding_name"); + _XlcGetResource(lcd, "XLC_CHARSET_DEFINE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); +/* + if (charsetd->encoding_name) { + Xfree(charsetd->encoding_name); + } +*/ + tmp = strdup(value[0]); + charsetd->encoding_name = tmp; + charsetd->xrm_encoding_name = XrmStringToQuark(tmp); + } + _XlcAddCT(charsetd->name, charsetd->ct_sequence); + } +} + +static SegConv +add_conversion( + XLCdGenericPart *gen) +{ + SegConv new_list; + int num; + + if ((num = gen->segment_conv_num) > 0) { + new_list = Xrealloc(gen->segment_conv, + (num + 1) * sizeof(SegConvRec)); + } else { + new_list = Xmalloc(sizeof(SegConvRec)); + } + + if (new_list == NULL) + return NULL; + + gen->segment_conv = new_list; + gen->segment_conv_num = num + 1; + + return &new_list[num]; + +} + +static void +read_segmentconversion( + XLCd lcd, + XLCdGenericPart *gen) +{ + int i; + char conv[16]; + char name[BUFSIZ]; + char **value; + int num,new; + SegConv conversion; + for (i=0 ; ; i++) { /* loop start */ + conversion = 0; + snprintf(conv, sizeof(conv), "conv%d", i); + + /* length */ + snprintf(name, sizeof(name), "%s.%s", conv, "length"); + _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); + if (num > 0) { + if (conversion == NULL && + (conversion = add_conversion(gen)) == NULL) { + return; + } + _XlcDbg_printValue(name,value,num); + } else { + if (i == 0) + continue; + else + break; + } + conversion->length = atoi(value[0]); + + /* source_encoding */ + snprintf(name, sizeof(name), "%s.%s", conv, "source_encoding"); + _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); + if (num > 0) { + char *tmp; + _XlcDbg_printValue(name,value,num); + tmp = strdup(value[0]); + if (tmp == NULL) + return; + conversion->source_encoding = tmp; + conversion->source = srch_charset_define(tmp,&new); + } + /* destination_encoding */ + snprintf(name, sizeof(name), "%s.%s", conv, "destination_encoding"); + _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); + if (num > 0) { + char *tmp; + _XlcDbg_printValue(name,value,num); + tmp = strdup(value[0]); + if (tmp == NULL) + return; + conversion->destination_encoding = tmp; + conversion->dest = srch_charset_define(tmp,&new); + } + /* range */ + snprintf(name, sizeof(name), "%s.%s", conv, "range"); + _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + sscanf(value[0],"\\x%lx,\\x%lx", + &(conversion->range.start), &(conversion->range.end)); + } + /* conversion */ + snprintf(name, sizeof(name), "%s.%s", conv, "conversion"); + _XlcGetResource(lcd, "XLC_SEGMENTCONVERSION", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + conversion->conv = + _XlcParse_scopemaps(value[0],&conversion->conv_num); + } + } /* loop end */ +} + +static ExtdSegment +create_ctextseg( + char **value, + int num) +{ + ExtdSegment ret; + char* ptr; + char* cset_name = NULL; + size_t cset_len; + int i,new; + FontScope scope; + ret = Xmalloc(sizeof(ExtdSegmentRec)); + if (ret == NULL) + return NULL; + ret->name = strdup(value[0]); + if (ret->name == NULL) { + Xfree (ret); + return NULL; + } + cset_len = strlen(ret->name) + 1; + cset_name = Xmalloc (cset_len); + if (cset_name == NULL) { + Xfree (ret->name); + Xfree (ret); + return NULL; + } + if (strchr(value[0],':')) { + ptr = strchr(ret->name,':'); + *ptr = '\0'; + ptr++; + if (!_XlcNCompareISOLatin1(ptr, "GL", 2)) { + ret->side = XlcGL; + snprintf(cset_name, cset_len, "%s:%s", ret->name, "GL"); + } else { + ret->side = XlcGR; + snprintf(cset_name, cset_len, "%s:%s", ret->name, "GR"); + } + } else { + ret->side = XlcGLGR; + strcpy(cset_name,ret->name); + } + ret->area = Xmalloc((num - 1)*sizeof(FontScopeRec)); + if (ret->area == NULL) { + Xfree (cset_name); + Xfree (ret->name); + Xfree (ret); + return NULL; + } + ret->area_num = num - 1; + scope = ret->area ; + for (i = 1; i < num; i++) { + sscanf(value[i],"\\x%lx,\\x%lx", + &scope[i-1].start, &scope[i-1].end); + } + ret->charset = srch_charset_define(cset_name,&new); + Xfree (cset_name); + + return ret; +} +/* For VW/UDC end */ + +static Bool +load_generic( + XLCd lcd) +{ + XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); + char **value; + int num; + unsigned long l; + int i; + int M,ii; + XlcCharSet charset; + + gen->codeset_num = 0; + + /***** wc_encoding_mask *****/ + _XlcGetResource(lcd, "XLC_XLOCALE", "wc_encoding_mask", &value, &num); + if (num > 0) { + if (string_to_ulong(value[0], &l) == False) + goto err; + gen->wc_encode_mask = l; + } + /***** wc_shift_bits *****/ + _XlcGetResource(lcd, "XLC_XLOCALE", "wc_shift_bits", &value, &num); + if (num > 0) + gen->wc_shift_bits = atoi(value[0]); + if (gen->wc_shift_bits < 1) + gen->wc_shift_bits = 8; + /***** use_stdc_env *****/ + _XlcGetResource(lcd, "XLC_XLOCALE", "use_stdc_env", &value, &num); + if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) + gen->use_stdc_env = True; + else + gen->use_stdc_env = False; + /***** force_convert_to_mb *****/ + _XlcGetResource(lcd, "XLC_XLOCALE", "force_convert_to_mb", &value, &num); + if (num > 0 && !_XlcCompareISOLatin1(value[0], "True")) + gen->force_convert_to_mb = True; + else + gen->force_convert_to_mb = False; + + for (i = 0; ; i++) { + CodeSetRec *codeset = NULL; + char cs[16]; + char name[BUFSIZ]; + + snprintf(cs, sizeof(cs), "cs%d", i); + + /***** codeset.side *****/ + snprintf(name, sizeof(name), "%s.%s", cs , "side"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + char *tmp; + + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) + goto err; + + /* 3.4.1 side */ + if (!_XlcNCompareISOLatin1(value[0], "none", 4)) { + codeset->side = XlcNONE; + } else if (!_XlcNCompareISOLatin1(value[0], "GL", 2)) { + codeset->side = XlcGL; + } else { + codeset->side = XlcGR; + } + + tmp = strrchr(value[0], ':'); + if (tmp != NULL && !_XlcCompareISOLatin1(tmp + 1, "Default")) { + if (codeset->side == XlcGR) + gen->initial_state_GR = codeset; + else + gen->initial_state_GL = codeset; + } + } + + /***** codeset.length *****/ + snprintf(name, sizeof(name), "%s.%s", cs , "length"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) + goto err; + codeset->length = atoi(value[0]); + if (codeset->length < 1) + codeset->length = 1; + } + + /***** codeset.mb_encoding *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "mb_encoding"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + static struct { + const char *str; + EncodingType type; + } shifts[] = { + {"", E_SS}, + {"", E_LSL}, + {"", E_LSR}, + {0} + }; + int j; + + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) + goto err; + for ( ; num-- > 0; value++) { + char encoding[256]; + char *tmp = *value; + EncodingType type = E_SS; /* for BC */ + for (j = 0; shifts[j].str; j++) { + if (!_XlcNCompareISOLatin1(tmp, shifts[j].str, + strlen(shifts[j].str))) { + type = shifts[j].type; + tmp += strlen(shifts[j].str); + break; + } + } + if (strlen (tmp) > sizeof encoding || + string_to_encoding(tmp, encoding) == False) + goto err; + add_parse_list(gen, type, encoding, codeset); + } + } + + /***** codeset.wc_encoding *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "wc_encoding"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) + goto err; + if (string_to_ulong(value[0], &l) == False) + goto err; + codeset->wc_encoding = l; + } + + /***** codeset.ct_encoding *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "ct_encoding"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + char *encoding; + + if (codeset == NULL && (codeset = add_codeset(gen)) == NULL) + goto err; + for ( ; num-- > 0; value++) { + if (strlen (*value) > sizeof name) + goto err; + string_to_encoding(*value, name); + charset = NULL; + if ((encoding = strchr(name, ':')) && + (encoding = strchr(encoding + 1, ':'))) { + *encoding++ = '\0'; + charset = _XlcAddCT(name, encoding); + } + if (charset == NULL) { + charset = _XlcGetCharSet(name); + if (charset == NULL && + (charset = _XlcCreateDefaultCharSet(name, ""))) { + charset->side = codeset->side; + charset->char_size = codeset->length; + _XlcAddCharSet(charset); + } + } + if (charset) { + if (add_charset(codeset, charset) == False) + goto err; + } + } + } + + if (codeset == NULL) + break; + codeset->cs_num = i; + /* For VW/UDC */ + /***** 3.4.2 byteM (1 <= M <= length)*****/ + for (M=1; M-1 < codeset->length; M++) { + unsigned long start,end; + ByteInfo tmpb; + + snprintf(name, sizeof(name),"%s.%s%d",cs,"byte",M); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + + if (M == 1) { + if (num < 1) { + codeset->byteM = NULL; + break ; + } + codeset->byteM = Xmalloc( + (codeset->length)*sizeof(ByteInfoListRec)); + if (codeset->byteM == NULL) { + goto err; + } + } + + if (num > 0) { + _XlcDbg_printValue(name,value,num); + (codeset->byteM)[M-1].M = M; + (codeset->byteM)[M-1].byteinfo_num = num; + (codeset->byteM)[M-1].byteinfo = + Xmalloc(num * sizeof(ByteInfoRec)); + for (ii = 0 ; ii < num ; ii++) { + tmpb = (codeset->byteM)[M-1].byteinfo ; + /* default 0x00 - 0xff */ + sscanf(value[ii],"\\x%lx,\\x%lx",&start,&end); + tmpb[ii].start = (unsigned char)start; + tmpb[ii].end = (unsigned char)end; + } + } + /* .... */ + } + + + /***** codeset.mb_conversion *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "mb_conversion"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + codeset->mbconv = Xmalloc(sizeof(ConversionRec)); + codeset->mbconv->convlist = + _XlcParse_scopemaps(value[0],&(codeset->mbconv->conv_num)); + dmpscope("mb_conv",codeset->mbconv->convlist, + codeset->mbconv->conv_num); + /* [\x%x,\x%x]->\x%x,... */ + } + /***** codeset.ct_conversion *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + codeset->ctconv = Xmalloc(sizeof(ConversionRec)); + codeset->ctconv->convlist = + _XlcParse_scopemaps(value[0],&(codeset->ctconv->conv_num)); + dmpscope("ctconv",codeset->ctconv->convlist, + codeset->ctconv->conv_num); + /* [\x%x,\x%x]->\x%x,... */ + } + /***** codeset.ct_conversion_file *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "ct_conversion_file"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + /* [\x%x,\x%x]->\x%x,... */ + } + /***** codeset.ct_extended_segment *****/ + snprintf(name, sizeof(name), "%s.%s", cs, "ct_extended_segment"); + _XlcGetResource(lcd, "XLC_XLOCALE", name, &value, &num); + if (num > 0) { + _XlcDbg_printValue(name,value,num); + codeset->ctextseg = create_ctextseg(value,num); + /* [\x%x,\x%x]->\x%x,... */ + } + /* For VW/UDC end */ + + } + + read_charset_define(lcd,gen); /* For VW/UDC */ + read_segmentconversion(lcd,gen); /* For VW/UDC */ + + if (gen->initial_state_GL == NULL) { + CodeSetRec *codeset; + for (i = 0; i < gen->codeset_num; i++) { + codeset = gen->codeset_list[i]; + if (codeset->side == XlcGL) + gen->initial_state_GL = codeset; + } + } + + if (gen->initial_state_GR == NULL) { + CodeSetRec *codeset; + for (i = 0; i < gen->codeset_num; i++) { + codeset = gen->codeset_list[i]; + if (codeset->side == XlcGR) + gen->initial_state_GR = codeset; + } + } + + for (i = 0; i < gen->codeset_num; i++) { + CodeSetRec *codeset = gen->codeset_list[i]; + for (ii = 0; ii < codeset->num_charsets; ii++) { + charset = codeset->charset_list[ii]; + if (! strcmp(charset->encoding_name, "ISO8859-1")) + charset->string_encoding = True; + if ( charset->string_encoding ) + codeset->string_encoding = True; + } + } + return True; + +err: + free_charset(lcd); + + return False; +} + +#ifdef USE_DYNAMIC_LC +/* override the open_om and open_im methods which were set by + super_class's initialize method() */ + +static Bool +initialize_core( + XLCd lcd) +{ + _XInitDynamicOM(lcd); + + _XInitDynamicIM(lcd); + + return True; +} +#endif + +static Bool +initialize(XLCd lcd) +{ + XLCdPublicMethods superclass = (XLCdPublicMethods) _XlcPublicMethods; + + XLC_PUBLIC_METHODS(lcd)->superclass = superclass; + + if (superclass->pub.initialize) { + if ((*superclass->pub.initialize)(lcd) == False) + return False; + } + +#ifdef USE_DYNAMIC_LC + if (initialize_core(lcd) == False) + return False; +#endif + + if (load_generic(lcd) == False) + return False; + + return True; +} + +/* VW/UDC start 95.01.08 */ +static void +freeByteM( + CodeSet codeset) +{ + int i; + ByteInfoList blst; + if (codeset->byteM == NULL) { + return ; + } + blst = codeset->byteM; + for (i = 0; i < codeset->length; i++) { + Xfree(blst[i].byteinfo); + blst[i].byteinfo = NULL; + } + Xfree(codeset->byteM); + codeset->byteM = NULL; +} + +static void +freeConversion( + CodeSet codeset) +{ + Conversion mbconv,ctconv; + if (codeset->mbconv) { + mbconv = codeset->mbconv; + /* ... */ + Xfree(mbconv->convlist); + mbconv->convlist = NULL; + + Xfree(mbconv); + codeset->mbconv = NULL; + } + if (codeset->ctconv) { + ctconv = codeset->ctconv; + /* ... */ + Xfree(ctconv->convlist); + ctconv->convlist = NULL; + + Xfree(ctconv); + codeset->ctconv = NULL; + } +} + +static void +freeExtdSegment( + CodeSet codeset) +{ + ExtdSegment ctextseg; + if (codeset->ctextseg == NULL) { + return; + } + ctextseg = codeset->ctextseg; + Xfree(ctextseg->name); + ctextseg->name = NULL; + + Xfree(ctextseg->area); + ctextseg->area = NULL; + + Xfree(codeset->ctextseg); + codeset->ctextseg = NULL; +} + +static void +freeParseInfo( + CodeSet codeset) +{ + ParseInfo parse_info; + if (codeset->parse_info == NULL) { + return; + } + parse_info = codeset->parse_info; + + Xfree(parse_info->encoding); + parse_info->encoding = NULL; + + Xfree(codeset->parse_info); + codeset->parse_info = NULL; +} + +static void +destroy_CodeSetList( + XLCdGenericPart *gen) +{ + CodeSet *codeset = gen->codeset_list; + int i; + if (gen->codeset_num == 0) { + return; + } + for (i=0;icodeset_num;i++) { + freeByteM(codeset[i]); + freeConversion(codeset[i]); + freeExtdSegment(codeset[i]); + freeParseInfo(codeset[i]); + + Xfree(codeset[i]->charset_list); + codeset[i]->charset_list = NULL; + + Xfree(codeset[i]); codeset[i]=NULL; + } + Xfree(codeset); gen->codeset_list = NULL; +} + +static void +destroy_SegConv( + XLCdGenericPart *gen) +{ + SegConv seg = gen->segment_conv; + int i; + + if (gen->segment_conv_num == 0) { + return; + } + for (i=0;isegment_conv_num;i++) { + + Xfree(seg[i].source_encoding); + seg[i].source_encoding = NULL; + + Xfree(seg[i].destination_encoding); + seg[i].destination_encoding = NULL; + + Xfree(seg[i].conv); + seg[i].conv = NULL; + } + Xfree(seg); gen->segment_conv = NULL; +} + +static void +destroy_gen( + XLCd lcd) +{ + XLCdGenericPart *gen = XLC_GENERIC_PART(lcd); + destroy_SegConv(gen); + destroy_CodeSetList(gen); + + Xfree(gen->mb_parse_table); + gen->mb_parse_table = NULL; + + Xfree(gen->mb_parse_list); + gen->mb_parse_list = NULL; + +} +/* VW/UDC end 95.01.08 */ + +static void +destroy( + XLCd lcd) +{ + XLCdPublicMethods superclass = XLC_PUBLIC_METHODS(lcd)->superclass; + + destroy_gen(lcd); /* ADD 1996.01.08 */ + if (superclass && superclass->pub.destroy) + (*superclass->pub.destroy)(lcd); +} diff --git a/nx-X11/lib/src/xlibi18n/lcInit.c b/nx-X11/lib/src/xlibi18n/lcInit.c new file mode 100644 index 000000000..e3092f77d --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcInit.c @@ -0,0 +1,168 @@ +/* +Copyright 1985, 1986, 1987, 1991, 1998 The Open Group + +Permission is hereby granted, free of charge, to any person obtaining a +copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: The above copyright notice and this +permission notice shall be included in all copies or substantial +portions of the Software. + + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN +AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE +EVEN IF ADVISED IN ADVANCE OF THE POSSIBILITY OF SUCH DAMAGES. + + +Except as contained in this notice, the name of The Open Group shall not be +used in advertising or otherwise to promote the sale, use or other dealings +in this Software without prior written authorization from The Open Group. + + +X Window System is a trademark of The Open Group + +OSF/1, OSF/Motif and Motif are registered trademarks, and OSF, the OSF +logo, LBX, X Window System, and Xinerama are trademarks of the Open +Group. All other trademarks and registered trademarks mentioned herein +are the property of their respective owners. No right, title or +interest in or to any trademark, service mark, logo or trade name of +Sun Microsystems, Inc. or its licensors is granted. + +*/ +/* + * Copyright 2000 Oracle and/or its affiliates. All rights reserved. + * + * Permission is hereby granted, free of charge, to any person obtaining a + * copy of this software and associated documentation files (the "Software"), + * to deal in the Software without restriction, including without limitation + * the rights to use, copy, modify, merge, publish, distribute, sublicense, + * and/or sell copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice (including the next + * paragraph) shall be included in all copies or substantial portions of the + * Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL + * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER + * DEALINGS IN THE SOFTWARE. + */ + +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ +/* + * (c) Copyright 1995 FUJITSU LIMITED + * This is source code modified by FUJITSU LIMITED under the Joint + * Development Agreement for the CDE/Motif PST. + * + * Modifier: Masayoshi Shimamura FUJITSU LIMITED + * + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +#ifdef USE_DYNAMIC_LC +#undef USE_DEFAULT_LOADER +#undef USE_GENERIC_LOADER +#undef USE_UTF8_LOADER +#else +#define USE_GENERIC_LOADER +#define USE_DEFAULT_LOADER +#define USE_UTF8_LOADER +#endif + +/* + * The _XlcInitLoader function initializes the locale object loader list + * with vendor specific manner. + */ + +void +_XlcInitLoader(void) +{ + +#ifdef USE_DYNAMIC_LC + _XlcAddLoader(_XlcDynamicLoad, XlcHead); +#else /* USE_DYNAMIC_LC */ + +#ifdef USE_GENERIC_LOADER + _XlcAddLoader(_XlcGenericLoader, XlcHead); +#endif + +#ifdef USE_DEFAULT_LOADER + _XlcAddLoader(_XlcDefaultLoader, XlcHead); +#endif + +#ifdef USE_UTF8_LOADER + _XlcAddLoader(_XlcUtf8Loader, XlcHead); +#endif + +#ifdef USE_DYNAMIC_LOADER + _XlcAddLoader(_XlcDynamicLoader, XlcHead); +#endif + +#endif /* USE_DYNAMIC_LC */ +} + +void +_XlcDeInitLoader(void) +{ + +#ifdef USE_DYNAMIC_LC + _XlcRemoveLoader(_XlcDynamicLoad); +#else /* USE_DYNAMIC_LC */ + +#ifdef USE_GENERIC_LOADER + _XlcRemoveLoader(_XlcGenericLoader); +#endif + +#ifdef USE_DEFAULT_LOADER + _XlcRemoveLoader(_XlcDefaultLoader); +#endif + +#ifdef USE_UTF8_LOADER + _XlcRemoveLoader(_XlcUtf8Loader); +#endif + +#ifdef USE_DYNAMIC_LOADER + _XlcRemoveLoader(_XlcDynamicLoader); +#endif + +#endif /* USE_DYNAMIC_LC */ +} diff --git a/nx-X11/lib/src/xlibi18n/lcPrTxt.c b/nx-X11/lib/src/xlibi18n/lcPrTxt.c new file mode 100644 index 000000000..e62e94e80 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcPrTxt.c @@ -0,0 +1,289 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" +#include +#include + +static XPointer * +alloc_list( + Bool is_wide_char, + int count, + int nitems) +{ + if (is_wide_char) { + wchar_t **wstr_list; + + wstr_list = Xmalloc(count * sizeof(wchar_t *)); + if (wstr_list == NULL) + return (XPointer *) NULL; + + *wstr_list = Xmalloc(nitems * sizeof(wchar_t)); + if (*wstr_list == NULL) { + Xfree(wstr_list); + return (XPointer *) NULL; + } + + return (XPointer *) wstr_list; + } else { + char **str_list; + + str_list = Xmalloc(count * sizeof(char *)); + if (str_list == NULL) + return (XPointer *) NULL; + + *str_list = Xmalloc(nitems); + if (*str_list == NULL) { + Xfree(str_list); + return (XPointer *) NULL; + } + + return (XPointer *) str_list; + } +} + +static void +copy_list( + Bool is_wide_char, + XPointer text, + XPointer *list, + int count) +{ + int length; + + if (is_wide_char) { + wchar_t *wc_text, *wstr, **wstr_list; + + wc_text = (wchar_t *) text; + wstr_list = (wchar_t **) list; + + for (wstr = *wstr_list; count > 0; count--, wstr_list++) { + _Xwcscpy(wstr, wc_text); + *wstr_list = wstr; + length = _Xwcslen(wstr) + 1; + wstr += length; + wc_text += length; + } + } else { + char *mb_text, *str, **str_list; + + mb_text = (char *) text; + str_list = (char **) list; + + for (str = *str_list; count > 0; count--, str_list++) { + strcpy(str, mb_text); + *str_list = str; + length = strlen(str) + 1; + str += length; + mb_text += length; + } + } +} + +static int +_XTextPropertyToTextList( + XLCd lcd, + Display *dpy, + const XTextProperty *text_prop, + const char *to_type, + XPointer **list_ret, + int *count_ret) +{ + XlcConv conv = NULL; + const char *from_type; + XPointer from, to, buf; + char *str_ptr, *last_ptr; + Atom encoding; + int from_left, to_left, buf_len, ret, len; + int unconv_num, nitems = text_prop->nitems; + Bool is_wide_char = False, do_strcpy = False; + + if (strcmp(XlcNWideChar, to_type) == 0) + is_wide_char = True; + + if (nitems <= 0) { + *list_ret = NULL; + *count_ret = 0; + return Success; + } + + if (text_prop->format != 8) + return XConverterNotFound; + + encoding = text_prop->encoding; + if (encoding == XA_STRING) + from_type = XlcNString; + else if (encoding == XInternAtom(dpy, "UTF8_STRING", False)) + from_type = XlcNUtf8String; + else if (encoding == XInternAtom(dpy, "COMPOUND_TEXT", False)) + from_type = XlcNCompoundText; + else if (encoding == XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False)) + from_type = XlcNMultiByte; + else + return XConverterNotFound; + + if (is_wide_char) { + buf_len = (text_prop->nitems + 1) * sizeof(wchar_t); + } else { + if (strcmp(to_type, XlcNUtf8String) == 0) + buf_len = text_prop->nitems * 6 + 1; + else + buf_len = text_prop->nitems * XLC_PUBLIC(lcd, mb_cur_max) + 1; + } + buf = Xmalloc(buf_len); + if (buf == NULL) + return XNoMemory; + to = buf; + to_left = buf_len; + + /* can be XlcNMultiByte to XlcNMultiByte, + or XlcNUtf8String to XlcNUtf8String */ + if (!strcmp(from_type, to_type)) { + do_strcpy = True; + } else { + conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); + if (conv == NULL) { + Xfree(buf); + return XConverterNotFound; + } + } + + last_ptr = str_ptr = (char *) text_prop->value; + unconv_num = *count_ret = 0; + + while (1) { + if (nitems == 0 || *str_ptr == 0) { + from = (XPointer) last_ptr; + from_left = str_ptr - last_ptr; + last_ptr = str_ptr; + + if (do_strcpy) { + len = min(from_left, to_left); + strncpy(to, from, len); + from += len; + to += len; + from_left -= len; + to_left -= len; + ret = 0; + } else { + ret = _XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0); + } + + if (ret < 0) + continue; + + unconv_num += ret; + (*count_ret)++; + + if (nitems == 0) + break; + last_ptr = ++str_ptr; + if (is_wide_char) { + *((wchar_t *)to) = (wchar_t) 0; + to += sizeof(wchar_t); + to_left -= sizeof(wchar_t); + } else { + *((char *)to) = '\0'; + to++; + to_left--; + } + if (! do_strcpy) + _XlcResetConverter(conv); + } else + str_ptr++; + + nitems--; + } + + if (! do_strcpy) + _XlcCloseConverter(conv); + + if (is_wide_char) { + *((wchar_t *) to) = (wchar_t) 0; + to_left -= sizeof(wchar_t); + } else { + *((char *) to) = '\0'; + to_left--; + } + + *list_ret = alloc_list(is_wide_char, *count_ret, buf_len - to_left); + if (*list_ret) + copy_list(is_wide_char, buf, *list_ret, *count_ret); + + Xfree(buf); + + return unconv_num; +} + +int +_XmbTextPropertyToTextList( + XLCd lcd, + Display *dpy, + const XTextProperty *text_prop, + char ***list_ret, + int *count_ret) +{ + return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNMultiByte, + (XPointer **) list_ret, count_ret); +} + +int +_XwcTextPropertyToTextList( + XLCd lcd, + Display *dpy, + const XTextProperty *text_prop, + wchar_t ***list_ret, + int *count_ret) +{ + return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNWideChar, + (XPointer **) list_ret, count_ret); +} + +int +_Xutf8TextPropertyToTextList( + XLCd lcd, + Display *dpy, + const XTextProperty *text_prop, + char ***list_ret, + int *count_ret) +{ + return _XTextPropertyToTextList(lcd, dpy, text_prop, XlcNUtf8String, + (XPointer **) list_ret, count_ret); +} + +void +_XwcFreeStringList( + XLCd lcd, + wchar_t **list) +{ + if (list) { + Xfree(*list); + Xfree(list); + } +} diff --git a/nx-X11/lib/src/xlibi18n/lcPubWrap.c b/nx-X11/lib/src/xlibi18n/lcPubWrap.c new file mode 100644 index 000000000..3119918c6 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcPubWrap.c @@ -0,0 +1,98 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" + +char * +_XGetLCValues(XLCd lcd, ...) +{ + va_list var; + XlcArgList args; + char *ret; + int num_args; + XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); + + va_start(var, lcd); + _XlcCountVaList(var, &num_args); + va_end(var); + + va_start(var, lcd); + _XlcVaToArgList(var, num_args, &args); + va_end(var); + + if (args == (XlcArgList) NULL) + return (char *) NULL; + + ret = (*methods->get_values)(lcd, args, num_args); + + Xfree(args); + + return ret; +} + +void +_XlcDestroyLC( + XLCd lcd) +{ + XLCdPublicMethods methods = (XLCdPublicMethods) lcd->methods; + + (*methods->pub.destroy)(lcd); +} + +XLCd +_XlcCreateLC( + const char *name, + XLCdMethods methods) +{ + XLCdPublicMethods pub_methods = (XLCdPublicMethods) methods; + XLCd lcd; + + lcd = (*pub_methods->pub.create)(name, methods); + if (lcd == NULL) + return (XLCd) NULL; + + if (lcd->core->name == NULL) { + lcd->core->name = strdup(name); + if (lcd->core->name == NULL) + goto err; + } + + if (lcd->methods == NULL) + lcd->methods = methods; + + if ((*pub_methods->pub.initialize)(lcd) == False) + goto err; + + return lcd; + +err: + _XlcDestroyLC(lcd); + + return (XLCd) NULL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcPublic.c b/nx-X11/lib/src/xlibi18n/lcPublic.c new file mode 100644 index 000000000..98a7435fd --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcPublic.c @@ -0,0 +1,311 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "XlcPubI.h" + +static const char * +default_string( + XLCd lcd) +{ + return XLC_PUBLIC(lcd, default_string); +} + +static XLCd create (const char *name, XLCdMethods methods); +static Bool initialize (XLCd lcd); +static void destroy (XLCd lcd); +static char *get_values (XLCd lcd, XlcArgList args, int num_args); + +static XLCdPublicMethodsRec publicMethods = { + { + destroy, + _XlcDefaultMapModifiers, + NULL, + NULL, + _XrmDefaultInitParseInfo, + _XmbTextPropertyToTextList, + _XwcTextPropertyToTextList, + _Xutf8TextPropertyToTextList, + _XmbTextListToTextProperty, + _XwcTextListToTextProperty, + _Xutf8TextListToTextProperty, + _XwcFreeStringList, + default_string, + NULL, + NULL + }, + { + NULL, + create, + initialize, + destroy, + get_values, + _XlcGetLocaleDataBase + } +}; + +XLCdMethods _XlcPublicMethods = (XLCdMethods) &publicMethods; + +static XLCd +create( + const char *name, + XLCdMethods methods) +{ + XLCd lcd; + XLCdPublicMethods new; + + lcd = Xcalloc(1, sizeof(XLCdRec)); + if (lcd == NULL) + return (XLCd) NULL; + + lcd->core = Xcalloc(1, sizeof(XLCdPublicRec)); + if (lcd->core == NULL) + goto err; + + new = Xmalloc(sizeof(XLCdPublicMethodsRec)); + if (new == NULL) + goto err; + memcpy(new,methods,sizeof(XLCdPublicMethodsRec)); + lcd->methods = (XLCdMethods) new; + + return lcd; + +err: + Xfree(lcd); + return (XLCd) NULL; +} + +static Bool +load_public( + XLCd lcd) +{ + XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); + char **values; + const char *str; + int num; + + if(_XlcCreateLocaleDataBase(lcd) == NULL) + return False; + + _XlcGetResource(lcd, "XLC_XLOCALE", "mb_cur_max", &values, &num); + if (num > 0) { + pub->mb_cur_max = atoi(values[0]); + if (pub->mb_cur_max < 1) + pub->mb_cur_max = 1; + } else + pub->mb_cur_max = 1; + + _XlcGetResource(lcd, "XLC_XLOCALE", "state_depend_encoding", &values, &num); + if (num > 0 && !_XlcCompareISOLatin1(values[0], "True")) + pub->is_state_depend = True; + else + pub->is_state_depend = False; + + _XlcGetResource(lcd, "XLC_XLOCALE", "encoding_name", &values, &num); + str = (num > 0) ? values[0] : "STRING"; + pub->encoding_name = strdup(str); + if (pub->encoding_name == NULL) + return False; + + return True; +} + +static Bool +initialize_core( + XLCd lcd) +{ + XLCdMethods methods = lcd->methods; + XLCdMethods core = &publicMethods.core; + + if (methods->close == NULL) + methods->close = core->close; + + if (methods->map_modifiers == NULL) + methods->map_modifiers = core->map_modifiers; + + if (methods->open_om == NULL) +#ifdef USE_DYNAMIC_LC + _XInitDefaultOM(lcd); +#else + _XInitOM(lcd); +#endif + + if (methods->open_im == NULL) +#ifdef USE_DYNAMIC_LC + _XInitDefaultIM(lcd); +#else + _XInitIM(lcd); +#endif + + if (methods->init_parse_info == NULL) + methods->init_parse_info = core->init_parse_info; + + if (methods->mb_text_prop_to_list == NULL) + methods->mb_text_prop_to_list = core->mb_text_prop_to_list; + + if (methods->wc_text_prop_to_list == NULL) + methods->wc_text_prop_to_list = core->wc_text_prop_to_list; + + if (methods->utf8_text_prop_to_list == NULL) + methods->utf8_text_prop_to_list = core->utf8_text_prop_to_list; + + if (methods->mb_text_list_to_prop == NULL) + methods->mb_text_list_to_prop = core->mb_text_list_to_prop; + + if (methods->wc_text_list_to_prop == NULL) + methods->wc_text_list_to_prop = core->wc_text_list_to_prop; + + if (methods->utf8_text_list_to_prop == NULL) + methods->utf8_text_list_to_prop = core->utf8_text_list_to_prop; + + if (methods->wc_free_string_list == NULL) + methods->wc_free_string_list = core->wc_free_string_list; + + if (methods->default_string == NULL) + methods->default_string = core->default_string; + + return True; +} + +static Bool +initialize( + XLCd lcd) +{ + XLCdPublicMethodsPart *methods = XLC_PUBLIC_METHODS(lcd); + XLCdPublicMethodsPart *pub_methods = &publicMethods.pub; + XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); + char *name; +#if !defined(X_LOCALE) + int len; + char sinamebuf[256]; + char* siname; +#endif + + _XlcInitCTInfo(); + + if (initialize_core(lcd) == False) + return False; + + name = lcd->core->name; +#if !defined(X_LOCALE) + /* + * _XlMapOSLocaleName will return the same string or a substring + * of name, so strlen(name) is okay + */ + if ((len = strlen(name)) < sizeof sinamebuf) + siname = sinamebuf; + else + siname = Xmalloc (len + 1); + if (siname == NULL) + return False; + name = _XlcMapOSLocaleName(name, siname); +#endif + /* _XlcResolveLocaleName will lookup the SI's name for the locale */ + if (_XlcResolveLocaleName(name, pub) == 0) { +#if !defined(X_LOCALE) + if (siname != sinamebuf) Xfree (siname); +#endif + return False; + } +#if !defined(X_LOCALE) + if (siname != sinamebuf) + Xfree (siname); +#endif + + if (pub->default_string == NULL) + pub->default_string = ""; + + if (methods->get_values == NULL) + methods->get_values = pub_methods->get_values; + + if (methods->get_resource == NULL) + methods->get_resource = pub_methods->get_resource; + + return load_public(lcd); +} + +static void +destroy_core( + XLCd lcd) +{ + if (lcd) { + if (lcd->core) { + Xfree(lcd->core->name); + Xfree(lcd->core); + } + Xfree(lcd->methods); + Xfree(lcd); + } +} + +static void +destroy( + XLCd lcd) +{ + XLCdPublicPart *pub = XLC_PUBLIC_PART(lcd); + + _XlcDestroyLocaleDataBase(lcd); + + Xfree(pub->siname); + Xfree(pub->encoding_name); + + destroy_core(lcd); +} + +static XlcResource resources[] = { + { XlcNCodeset, NULLQUARK, sizeof(char *), + XOffsetOf(XLCdPublicRec, pub.codeset), XlcGetMask }, + { XlcNDefaultString, NULLQUARK, sizeof(char *), + XOffsetOf(XLCdPublicRec, pub.default_string), XlcGetMask }, + { XlcNEncodingName, NULLQUARK, sizeof(char *), + XOffsetOf(XLCdPublicRec, pub.encoding_name), XlcGetMask }, + { XlcNLanguage, NULLQUARK, sizeof(char *), + XOffsetOf(XLCdPublicRec, pub.language), XlcGetMask }, + { XlcNMbCurMax, NULLQUARK, sizeof(int), + XOffsetOf(XLCdPublicRec, pub.mb_cur_max), XlcGetMask }, + { XlcNStateDependentEncoding, NULLQUARK, sizeof(Bool), + XOffsetOf(XLCdPublicRec, pub.is_state_depend), XlcGetMask }, + { XlcNTerritory, NULLQUARK, sizeof(char *), + XOffsetOf(XLCdPublicRec, pub.territory), XlcGetMask } +}; + +static char * +get_values( + XLCd lcd, + XlcArgList args, + int num_args) +{ + XLCdPublic pub = (XLCdPublic) lcd->core; + + if (resources[0].xrm_name == NULLQUARK) + _XlcCompileResourceList(resources, XlcNumber(resources)); + + return _XlcGetValues((XPointer) pub, resources, XlcNumber(resources), args, + num_args, XlcGetMask); +} diff --git a/nx-X11/lib/src/xlibi18n/lcRM.c b/nx-X11/lib/src/xlibi18n/lcRM.c new file mode 100644 index 000000000..bdc20f21d --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcRM.c @@ -0,0 +1,224 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + * Bug fixes: Bruno Haible XFree86 Inc. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" +#include + +/* + * Default implementation of methods for Xrm parsing. + */ + +/* ======================= Unibyte implementation ======================= */ + +/* Only for efficiency, to speed up things. */ + +/* This implementation must keep the locale, for lcname. */ +typedef struct _UbStateRec { + XLCd lcd; +} UbStateRec, *UbState; + +/* Sets the state to the initial state. + Initiates a sequence of calls to mbchar. */ +static void +ub_mbinit( + XPointer state) +{ +} + +/* Transforms one multibyte character, and return a 'char' in the same + parsing class. Returns the number of consumed bytes in *lenp. */ +static char +ub_mbchar( + XPointer state, + const char *str, + int *lenp) +{ + *lenp = 1; + return *str; +} + +/* Terminates a sequence of calls to mbchar. */ +static void +ub_mbfinish( + XPointer state) +{ +} + +/* Returns the name of the state's locale, as a static string. */ +static const char * +ub_lcname( + XPointer state) +{ + return ((UbState) state)->lcd->core->name; +} + +/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ +static void +ub_destroy( + XPointer state) +{ + _XCloseLC(((UbState) state)->lcd); + Xfree(state); +} + +static const XrmMethodsRec ub_methods = { + ub_mbinit, + ub_mbchar, + ub_mbfinish, + ub_lcname, + ub_destroy +}; + +/* ======================= Multibyte implementation ======================= */ + +/* This implementation uses an XlcConv from XlcNMultiByte to XlcNWideChar. */ +typedef struct _MbStateRec { + XLCd lcd; + XlcConv conv; +} MbStateRec, *MbState; + +/* Sets the state to the initial state. + Initiates a sequence of calls to mbchar. */ +static void +mb_mbinit( + XPointer state) +{ + _XlcResetConverter(((MbState) state)->conv); +} + +/* Transforms one multibyte character, and return a 'char' in the same + parsing class. Returns the number of consumed bytes in *lenp. */ +static char +mb_mbchar( + XPointer state, + const char *str, + int *lenp) +{ + XlcConv conv = ((MbState) state)->conv; + const char *from; + wchar_t *to, wc; + int cur_max, i, from_left, to_left, ret; + + cur_max = XLC_PUBLIC(((MbState) state)->lcd, mb_cur_max); + + from = str; + /* Determine from_left. Avoid overrun error which could occur if + from_left > strlen(str). */ + from_left = cur_max; + for (i = 0; i < cur_max; i++) + if (str[i] == '\0') { + from_left = i; + break; + } + *lenp = from_left; + + to = &wc; + to_left = 1; + + ret = _XlcConvert(conv, (XPointer *) &from, &from_left, + (XPointer *) &to, &to_left, NULL, 0); + *lenp -= from_left; + + if (ret < 0 || to_left > 0) { + /* Invalid or incomplete multibyte character seen. */ + *lenp = 1; + return 0x7f; + } + /* Return a 'char' equivalent to wc. */ + return (wc >= 0 && wc <= 0x7f ? wc : 0x7f); +} + +/* Terminates a sequence of calls to mbchar. */ +static void +mb_mbfinish( + XPointer state) +{ +} + +/* Returns the name of the state's locale, as a static string. */ +static const char * +mb_lcname( + XPointer state) +{ + return ((MbState) state)->lcd->core->name; +} + +/* Frees the state, which was allocated by _XrmDefaultInitParseInfo. */ +static void +mb_destroy( + XPointer state) +{ + _XlcCloseConverter(((MbState) state)->conv); + _XCloseLC(((MbState) state)->lcd); + Xfree(state); +} + +static const XrmMethodsRec mb_methods = { + mb_mbinit, + mb_mbchar, + mb_mbfinish, + mb_lcname, + mb_destroy +}; + +/* ======================= Exported function ======================= */ + +XrmMethods +_XrmDefaultInitParseInfo( + XLCd lcd, + XPointer *rm_state) +{ + if (XLC_PUBLIC(lcd, mb_cur_max) == 1) { + /* Unibyte case. */ + UbState state = Xmalloc(sizeof(UbStateRec)); + if (state == NULL) + return (XrmMethods) NULL; + + state->lcd = lcd; + + *rm_state = (XPointer) state; + return &ub_methods; + } else { + /* Multibyte case. */ + MbState state = Xmalloc(sizeof(MbStateRec)); + if (state == NULL) + return (XrmMethods) NULL; + + state->lcd = lcd; + state->conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); + if (state->conv == NULL) { + Xfree(state); + return (XrmMethods) NULL; + } + + *rm_state = (XPointer) state; + return &mb_methods; + } +} diff --git a/nx-X11/lib/src/xlibi18n/lcStd.c b/nx-X11/lib/src/xlibi18n/lcStd.c new file mode 100644 index 000000000..9d452bcae --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcStd.c @@ -0,0 +1,358 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" + +int +_Xlcmbtowc( + XLCd lcd, + wchar_t *wstr, + char *str, + int len) +{ + static XLCd last_lcd = NULL; + static XlcConv conv = NULL; + XPointer from, to; + int from_left, to_left; + wchar_t tmp_wc; + + if (lcd == NULL) { + lcd = _XlcCurrentLC(); + if (lcd == NULL) + return -1; + } + if (str == NULL) + return XLC_PUBLIC(lcd, is_state_depend); + + if (conv && lcd != last_lcd) { + _XlcCloseConverter(conv); + conv = NULL; + } + + last_lcd = lcd; + + if (conv == NULL) { + conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); + if (conv == NULL) + return -1; + } + + from = (XPointer) str; + from_left = len; + to = (XPointer) (wstr ? wstr : &tmp_wc); + to_left = 1; + + if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) + return -1; + + return (len - from_left); +} + +int +_Xlcwctomb( + XLCd lcd, + char *str, + wchar_t wc) +{ + static XLCd last_lcd = NULL; + static XlcConv conv = NULL; + XPointer from, to; + int from_left, to_left, length; + + if (lcd == NULL) { + lcd = _XlcCurrentLC(); + if (lcd == NULL) + return -1; + } + if (str == NULL) + return XLC_PUBLIC(lcd, is_state_depend); + + if (conv && lcd != last_lcd) { + _XlcCloseConverter(conv); + conv = NULL; + } + + last_lcd = lcd; + + if (conv == NULL) { + conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); + if (conv == NULL) + return -1; + } + + from = (XPointer) &wc; + from_left = 1; + to = (XPointer) str; + length = to_left = XLC_PUBLIC(lcd, mb_cur_max); + + if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) + return -1; + + return (length - to_left); +} + +int +_Xlcmbstowcs( + XLCd lcd, + wchar_t *wstr, + char *str, + int len) +{ + XlcConv conv; + XPointer from, to; + int from_left, to_left, ret; + + if (lcd == NULL) { + lcd = _XlcCurrentLC(); + if (lcd == NULL) + return -1; + } + + conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar); + if (conv == NULL) + return -1; + + from = (XPointer) str; + from_left = strlen(str); + to = (XPointer) wstr; + to_left = len; + + if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) + ret = -1; + else { + ret = len - to_left; + if (wstr && to_left > 0) + wstr[ret] = (wchar_t) 0; + } + + _XlcCloseConverter(conv); + + return ret; +} + +int +_Xlcwcstombs( + XLCd lcd, + char *str, + wchar_t *wstr, + int len) +{ + XlcConv conv; + XPointer from, to; + int from_left, to_left, ret; + + if (lcd == NULL) { + lcd = _XlcCurrentLC(); + if (lcd == NULL) + return -1; + } + + conv = _XlcOpenConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte); + if (conv == NULL) + return -1; + + from = (XPointer) wstr; + from_left = _Xwcslen(wstr); + to = (XPointer) str; + to_left = len; + + if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) + ret = -1; + else { + ret = len - to_left; + if (str && to_left > 0) + str[ret] = '\0'; + } + + _XlcCloseConverter(conv); + + return ret; +} + + +int +_Xmbtowc( + wchar_t *wstr, + char *str, + int len + ) +{ + return _Xlcmbtowc((XLCd) NULL, wstr, str, len); +} + +int +_Xmblen( + char *str, + int len + ) +{ + return _Xmbtowc((wchar_t *) NULL, str, len); +} + +int +_Xwctomb( + char *str, + wchar_t wc) +{ + return _Xlcwctomb((XLCd) NULL, str, wc); +} + +int +_Xmbstowcs( + wchar_t *wstr, + char *str, + int len) +{ + return _Xlcmbstowcs((XLCd) NULL, wstr, str, len); +} + +int +_Xwcstombs( + char *str, + wchar_t *wstr, + int len) +{ + return _Xlcwcstombs((XLCd) NULL, str, wstr, len); +} + +wchar_t * +_Xwcscpy( + register wchar_t *wstr1, register wchar_t *wstr2) +{ + wchar_t *wstr_tmp = wstr1; + + while ((*wstr1++ = *wstr2++)) + ; + + return wstr_tmp; +} + +wchar_t * +_Xwcsncpy( + register wchar_t *wstr1, register wchar_t *wstr2, + register int len) +{ + wchar_t *wstr_tmp = wstr1; + + while (len-- > 0) + if (!(*wstr1++ = *wstr2++)) + break; + + while (len-- > 0) + *wstr1++ = (wchar_t) 0; + + return wstr_tmp; +} + +int +_Xwcslen( + register wchar_t *wstr) +{ + register wchar_t *wstr_ptr = wstr; + + while (*wstr_ptr) + wstr_ptr++; + + return wstr_ptr - wstr; +} + +int +_Xwcscmp( + register wchar_t *wstr1, register wchar_t *wstr2) +{ + for ( ; *wstr1 && *wstr2; wstr1++, wstr2++) + if (*wstr1 != *wstr2) + break; + + return *wstr1 - *wstr2; +} + +int +_Xwcsncmp( + register wchar_t *wstr1, register wchar_t *wstr2, + register int len) +{ + for ( ; *wstr1 && *wstr2 && len > 0; wstr1++, wstr2++, len--) + if (*wstr1 != *wstr2) + break; + + if (len <= 0) + return 0; + + return *wstr1 - *wstr2; +} + + +int +_Xlcmbstoutf8( + XLCd lcd, + char *ustr, + const char *str, + int len) +{ + XlcConv conv; + XPointer from, to; + int from_left, to_left, ret; + + if (lcd == NULL) { + lcd = _XlcCurrentLC(); + if (lcd == NULL) + return -1; + } + + conv = _XlcOpenConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String); + if (conv == NULL) + return -1; + + from = (XPointer) str; + from_left = strlen(str); + to = (XPointer) ustr; + to_left = len; + + if (_XlcConvert(conv, &from, &from_left, &to, &to_left, NULL, 0) < 0) + ret = -1; + else { + ret = len - to_left; + if (ustr && to_left > 0) + ustr[ret] = '\0'; + } + + _XlcCloseConverter(conv); + + return ret; +} + +int +_Xmbstoutf8( + char *ustr, + const char *str, + int len) +{ + return _Xlcmbstoutf8((XLCd) NULL, ustr, str, len); +} diff --git a/nx-X11/lib/src/xlibi18n/lcTxtPr.c b/nx-X11/lib/src/xlibi18n/lcTxtPr.c new file mode 100644 index 000000000..cf25e3d0e --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcTxtPr.c @@ -0,0 +1,254 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "XlcPubI.h" +#include +#include +#include + +static int +get_buf_size( + Bool is_wide_char, + XPointer list, + int count) +{ + int length = 0; + char **mb_list; + wchar_t **wc_list; + + if (list == NULL) + return 0; + + if (is_wide_char) { + wc_list = (wchar_t **) list; + for ( ; count-- > 0; wc_list++) { + if (*wc_list) + length += _Xwcslen(*wc_list) + 1; + } + length *= 5; /* XXX */ + } else { + mb_list = (char **) list; + for ( ; count-- > 0; mb_list++) { + if (*mb_list) + length += strlen(*mb_list) + 1; + } + length *= 3; /* XXX */ + } + length = (length / BUFSIZ + 1) * BUFSIZ; /* XXX */ + + return length; +} + +static int +_XTextListToTextProperty( + XLCd lcd, + Display *dpy, + const char *from_type, + XPointer list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + Atom encoding; + XlcConv conv; + const char *to_type; + char **mb_list = NULL; + wchar_t **wc_list = NULL; + XPointer from; + char *to, *buf, *value; + int from_left, to_left, buf_len, nitems, unconv_num = 0, ret, i; + Bool is_wide_char = False; + + if (strcmp(XlcNWideChar, from_type) == 0) + is_wide_char = True; + + buf_len = get_buf_size(is_wide_char, list, count); + if ((buf = Xmalloc(buf_len)) == NULL) + return XNoMemory; + + switch (style) { + case XStringStyle: + case XStdICCTextStyle: + encoding = XA_STRING; + to_type = XlcNString; + break; + case XUTF8StringStyle: + encoding = XInternAtom(dpy, "UTF8_STRING", False); + to_type = XlcNUtf8String; + break; + case XCompoundTextStyle: + encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); + to_type = XlcNCompoundText; + break; + case XTextStyle: + encoding = XInternAtom(dpy, XLC_PUBLIC(lcd, encoding_name), False); + to_type = XlcNMultiByte; + if (is_wide_char == False) { + nitems = 0; + mb_list = (char **) list; + to = buf; + for (i = 0; i < count && buf_len > 0; i++) { + if (*mb_list) + strcpy(to, *mb_list); + else + *to = '\0'; + from_left = (*mb_list ? strlen(*mb_list) : 0) + 1; + nitems += from_left; + to += from_left; + mb_list++; + } + unconv_num = 0; + goto done; + } + break; + default: + Xfree(buf); + return XConverterNotFound; + } + + if (count < 1) { + nitems = 0; + goto done; + } + +retry: + conv = _XlcOpenConverter(lcd, from_type, lcd, to_type); + if (conv == NULL) { + Xfree(buf); + return XConverterNotFound; + } + + if (is_wide_char) + wc_list = (wchar_t **) list; + else + mb_list = (char **) list; + + to = buf; + to_left = buf_len; + + unconv_num = 0; + + for (i = 1; to_left > 0; i++) { + if (is_wide_char) { + from = (XPointer) *wc_list; + from_left = _Xwcslen(*wc_list); + wc_list++; + } else { + from = (XPointer) *mb_list; + from_left = (*mb_list ? strlen(*mb_list) : 0); + mb_list++; + } + + ret = _XlcConvert(conv, &from, &from_left, (XPointer *) &to, &to_left, + NULL, 0); + + if (ret < 0) + continue; + + if (ret > 0 && style == XStdICCTextStyle && encoding == XA_STRING) { + _XlcCloseConverter(conv); + encoding = XInternAtom(dpy, "COMPOUND_TEXT", False); + to_type = XlcNCompoundText; + goto retry; + } + + unconv_num += ret; + *to++ = '\0'; + to_left--; + + if (i >= count) + break; + + _XlcResetConverter(conv); + } + + _XlcCloseConverter(conv); + + nitems = to - buf; +done: + if (nitems <= 0) + nitems = 1; + value = Xmalloc(nitems); + if (value == NULL) { + Xfree(buf); + return XNoMemory; + } + if (nitems == 1) + *value = 0; + else + memcpy(value, buf, nitems); + nitems--; + Xfree(buf); + + text_prop->value = (unsigned char *) value; + text_prop->encoding = encoding; + text_prop->format = 8; + text_prop->nitems = nitems; + + return unconv_num; +} + +int +_XmbTextListToTextProperty( + XLCd lcd, + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + return _XTextListToTextProperty(lcd, dpy, XlcNMultiByte, (XPointer) list, + count, style, text_prop); +} + +int +_XwcTextListToTextProperty( + XLCd lcd, + Display *dpy, + wchar_t **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + return _XTextListToTextProperty(lcd, dpy, XlcNWideChar, (XPointer) list, + count, style, text_prop); +} + +int +_Xutf8TextListToTextProperty( + XLCd lcd, + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + return _XTextListToTextProperty(lcd, dpy, XlcNUtf8String, (XPointer) list, + count, style, text_prop); +} diff --git a/nx-X11/lib/src/xlibi18n/lcUTF8.c b/nx-X11/lib/src/xlibi18n/lcUTF8.c new file mode 100644 index 000000000..5899338f1 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUTF8.c @@ -0,0 +1,2389 @@ +/****************************************************************** + + Copyright 1993 by SunSoft, Inc. + Copyright 1999-2000 by Bruno Haible + +Permission to use, copy, modify, distribute, and sell this software +and its 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 names of SunSoft, Inc. and +Bruno Haible not be used in advertising or publicity pertaining to +distribution of the software without specific, written prior +permission. SunSoft, Inc. and Bruno Haible make no representations +about the suitability of this software for any purpose. It is +provided "as is" without express or implied warranty. + +SunSoft Inc. AND Bruno Haible DISCLAIM ALL WARRANTIES WITH REGARD +TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY +AND FITNESS, IN NO EVENT SHALL SunSoft, Inc. OR Bruno Haible 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. + +******************************************************************/ + +/* + * This file contains: + * + * I. Conversion routines CompoundText/CharSet <--> Unicode/UTF-8. + * + * Used for three purposes: + * 1. The UTF-8 locales, see below. + * 2. Unicode aware applications for which the use of 8-bit character + * sets is an anachronism. + * 3. For conversion from keysym to locale encoding. + * + * II. Conversion files for an UTF-8 locale loader. + * Supports: all locales with codeset UTF-8. + * How: Provides converters for UTF-8. + * Platforms: all systems. + * + * The loader itself is located in lcUTF8.c. + */ + +/* + * The conversion from UTF-8 to CompoundText is realized in a very + * conservative way. Recall that CompoundText data is used for inter-client + * communication purposes. We distinguish three classes of clients: + * - Clients which accept only those pieces of CompoundText which belong to + * the character set understood by the current locale. + * (Example: clients which are linked to an older X11 library.) + * - Clients which accept CompoundText with multiple character sets and parse + * it themselves. + * (Example: emacs, xemacs.) + * - Clients which rely entirely on the X{mb,wc}TextPropertyToTextList + * functions for the conversion of CompoundText to their current locale's + * multi-byte/wide-character format. + * For best interoperation, the UTF-8 to CompoundText conversion proceeds as + * follows. For every character, it first tests whether the character is + * representable in the current locale's original (non-UTF-8) character set. + * If not, it goes through the list of predefined character sets for + * CompoundText and tests if the character is representable in that character + * set. If so, it encodes the character using its code within that character + * set. If not, it uses an UTF-8-in-CompoundText encapsulation. Since + * clients of the first and second kind ignore such encapsulated text, + * this encapsulation is kept to a minimum and terminated as early as possible. + * + * In a distant future, when clients of the first and second kind will have + * disappeared, we will be able to stuff UTF-8 data directly in CompoundText + * without first going through the list of predefined character sets. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "XlcPubI.h" +#include "XlcGeneric.h" + +static XlcConv +create_conv( + XLCd lcd, + XlcConvMethods methods) +{ + XlcConv conv; + + conv = Xmalloc(sizeof(XlcConvRec)); + if (conv == (XlcConv) NULL) + return (XlcConv) NULL; + + conv->methods = methods; + conv->state = NULL; + + return conv; +} + +static void +close_converter( + XlcConv conv) +{ + Xfree(conv); +} + +/* Replacement character for invalid multibyte sequence or wide character. */ +#define BAD_WCHAR ((ucs4_t) 0xfffd) +#define BAD_CHAR '?' + +/***************************************************************************/ +/* Part I: Conversion routines CompoundText/CharSet <--> Unicode/UTF-8. + * + * Note that this code works in any locale. We store Unicode values in + * `ucs4_t' variables, but don't pass them to the user. + * + * This code has to support all character sets that are used for CompoundText, + * nothing more, nothing less. See the table in lcCT.c. + * Since the conversion _to_ CompoundText is likely to need the tables for all + * character sets at once, we don't use dynamic loading (of tables or shared + * libraries through iconv()). Use a fixed set of tables instead. + * + * We use statically computed tables, not dynamically allocated arrays, + * because it's more memory efficient: Different processes using the same + * libX11 shared library share the "text" and read-only "data" sections. + */ + +typedef unsigned int ucs4_t; +#define conv_t XlcConv + +typedef struct _Utf8ConvRec { + const char *name; + XrmQuark xrm_name; + int (* cstowc) (XlcConv, ucs4_t *, unsigned char const *, int); + int (* wctocs) (XlcConv, unsigned char *, ucs4_t, int); +} Utf8ConvRec, *Utf8Conv; + +/* + * int xxx_cstowc (XlcConv conv, ucs4_t *pwc, unsigned char const *s, int n) + * converts the byte sequence starting at s to a wide character. Up to n bytes + * are available at s. n is >= 1. + * Result is number of bytes consumed (if a wide character was read), + * or 0 if invalid, or -1 if n too small. + * + * int xxx_wctocs (XlcConv conv, unsigned char *r, ucs4_t wc, int n) + * converts the wide character wc to the character set xxx, and stores the + * result beginning at r. Up to n bytes may be written at r. n is >= 1. + * Result is number of bytes written, or 0 if invalid, or -1 if n too small. + */ + +/* Return code if invalid. (xxx_mbtowc, xxx_wctomb) */ +#define RET_ILSEQ 0 +/* Return code if only a shift sequence of n bytes was read. (xxx_mbtowc) */ +#define RET_TOOFEW(n) (-1-(n)) +/* Return code if output buffer is too small. (xxx_wctomb, xxx_reset) */ +#define RET_TOOSMALL -1 + +/* + * The tables below are bijective. It would be possible to extend the + * xxx_wctocs tables to do some transliteration (e.g. U+201C,U+201D -> 0x22) + * but *only* with characters not contained in any other table, and *only* + * when the current locale is not an UTF-8 locale. + */ + +#include "lcUniConv/utf8.h" +#include "lcUniConv/ucs2be.h" +#include "lcUniConv/iso8859_1.h" +#include "lcUniConv/iso8859_2.h" +#include "lcUniConv/iso8859_3.h" +#include "lcUniConv/iso8859_4.h" +#include "lcUniConv/iso8859_5.h" +#include "lcUniConv/iso8859_6.h" +#include "lcUniConv/iso8859_7.h" +#include "lcUniConv/iso8859_8.h" +#include "lcUniConv/iso8859_9.h" +#include "lcUniConv/iso8859_10.h" +#include "lcUniConv/iso8859_11.h" +#include "lcUniConv/iso8859_13.h" +#include "lcUniConv/iso8859_14.h" +#include "lcUniConv/iso8859_15.h" +#include "lcUniConv/iso8859_16.h" +#include "lcUniConv/iso8859_9e.h" +#include "lcUniConv/jisx0201.h" +#include "lcUniConv/tis620.h" +#include "lcUniConv/koi8_r.h" +#include "lcUniConv/koi8_u.h" +#include "lcUniConv/koi8_c.h" +#include "lcUniConv/armscii_8.h" +#include "lcUniConv/cp1133.h" +#include "lcUniConv/mulelao.h" +#include "lcUniConv/viscii.h" +#include "lcUniConv/tcvn.h" +#include "lcUniConv/georgian_academy.h" +#include "lcUniConv/georgian_ps.h" +#include "lcUniConv/cp1251.h" +#include "lcUniConv/cp1255.h" +#include "lcUniConv/cp1256.h" +#include "lcUniConv/tatar_cyr.h" + +typedef struct { + unsigned short indx; /* index into big table */ + unsigned short used; /* bitmask of used entries */ +} Summary16; + +#include "lcUniConv/gb2312.h" +#include "lcUniConv/jisx0208.h" +#include "lcUniConv/jisx0212.h" +#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 + (for lookup speed), once at the end (as a fallback). */ + { "ISO10646-1", NULLQUARK, + utf8_mbtowc, utf8_wctomb + }, + + { "ISO8859-1", NULLQUARK, + iso8859_1_mbtowc, iso8859_1_wctomb + }, + { "ISO8859-2", NULLQUARK, + iso8859_2_mbtowc, iso8859_2_wctomb + }, + { "ISO8859-3", NULLQUARK, + iso8859_3_mbtowc, iso8859_3_wctomb + }, + { "ISO8859-4", NULLQUARK, + iso8859_4_mbtowc, iso8859_4_wctomb + }, + { "ISO8859-5", NULLQUARK, + iso8859_5_mbtowc, iso8859_5_wctomb + }, + { "ISO8859-6", NULLQUARK, + iso8859_6_mbtowc, iso8859_6_wctomb + }, + { "ISO8859-7", NULLQUARK, + iso8859_7_mbtowc, iso8859_7_wctomb + }, + { "ISO8859-8", NULLQUARK, + iso8859_8_mbtowc, iso8859_8_wctomb + }, + { "ISO8859-9", NULLQUARK, + iso8859_9_mbtowc, iso8859_9_wctomb + }, + { "ISO8859-10", NULLQUARK, + iso8859_10_mbtowc, iso8859_10_wctomb + }, + { "ISO8859-11", NULLQUARK, + iso8859_11_mbtowc, iso8859_11_wctomb + }, + { "ISO8859-13", NULLQUARK, + iso8859_13_mbtowc, iso8859_13_wctomb + }, + { "ISO8859-14", NULLQUARK, + iso8859_14_mbtowc, iso8859_14_wctomb + }, + { "ISO8859-15", NULLQUARK, + iso8859_15_mbtowc, iso8859_15_wctomb + }, + { "ISO8859-16", NULLQUARK, + iso8859_16_mbtowc, iso8859_16_wctomb + }, + { "JISX0201.1976-0", NULLQUARK, + jisx0201_mbtowc, jisx0201_wctomb + }, + { "TIS620-0", NULLQUARK, + tis620_mbtowc, tis620_wctomb + }, + { "GB2312.1980-0", NULLQUARK, + gb2312_mbtowc, gb2312_wctomb + }, + { "JISX0208.1983-0", NULLQUARK, + jisx0208_mbtowc, jisx0208_wctomb + }, + { "JISX0208.1990-0", NULLQUARK, + jisx0208_mbtowc, jisx0208_wctomb + }, + { "JISX0212.1990-0", NULLQUARK, + jisx0212_mbtowc, jisx0212_wctomb + }, + { "KSC5601.1987-0", NULLQUARK, + ksc5601_mbtowc, ksc5601_wctomb + }, + { "KOI8-R", NULLQUARK, + koi8_r_mbtowc, koi8_r_wctomb + }, + { "KOI8-U", NULLQUARK, + koi8_u_mbtowc, koi8_u_wctomb + }, + { "KOI8-C", NULLQUARK, + koi8_c_mbtowc, koi8_c_wctomb + }, + { "TATAR-CYR", NULLQUARK, + tatar_cyr_mbtowc, tatar_cyr_wctomb + }, + { "ARMSCII-8", NULLQUARK, + armscii_8_mbtowc, armscii_8_wctomb + }, + { "IBM-CP1133", NULLQUARK, + cp1133_mbtowc, cp1133_wctomb + }, + { "MULELAO-1", NULLQUARK, + mulelao_mbtowc, mulelao_wctomb + }, + { "VISCII1.1-1", NULLQUARK, + viscii_mbtowc, viscii_wctomb + }, + { "TCVN-5712", NULLQUARK, + tcvn_mbtowc, tcvn_wctomb + }, + { "GEORGIAN-ACADEMY", NULLQUARK, + georgian_academy_mbtowc, georgian_academy_wctomb + }, + { "GEORGIAN-PS", NULLQUARK, + georgian_ps_mbtowc, georgian_ps_wctomb + }, + { "ISO8859-9E", NULLQUARK, + iso8859_9e_mbtowc, iso8859_9e_wctomb + }, + { "MICROSOFT-CP1251", NULLQUARK, + cp1251_mbtowc, cp1251_wctomb + }, + { "MICROSOFT-CP1255", NULLQUARK, + cp1255_mbtowc, cp1255_wctomb + }, + { "MICROSOFT-CP1256", NULLQUARK, + cp1256_mbtowc, cp1256_wctomb + }, + { "BIG5-0", NULLQUARK, + 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). */ + { "ISO10646-1", NULLQUARK, + utf8_mbtowc, utf8_wctomb + }, + + /* Encoding ISO10646-1 for fonts means UCS2-like encoding + so for conversion to FontCharSet we need this record */ + { "ISO10646-1", NULLQUARK, + ucs2be_mbtowc, ucs2be_wctomb + } +}; + +#define charsets_table_size (sizeof(all_charsets)/sizeof(all_charsets[0])) +#define all_charsets_count (charsets_table_size - 1) +#define ucs2_conv_index (charsets_table_size - 1) + +static void +init_all_charsets (void) +{ + Utf8Conv convptr; + int i; + + for (convptr = all_charsets, i = charsets_table_size; i > 0; convptr++, i--) + convptr->xrm_name = XrmStringToQuark(convptr->name); +} + +#define lazy_init_all_charsets() \ + do { \ + if (all_charsets[0].xrm_name == NULLQUARK) \ + init_all_charsets(); \ + } while (0) + +/* from XlcNCharSet to XlcNUtf8String */ + +static int +cstoutf8( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XlcCharSet charset; + const 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; + + count = utf8_wctomb(NULL, dst, wc, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) { + count = utf8_wctomb(NULL, dst, BAD_WCHAR, dstend-dst); + if (count == RET_TOOSMALL) + 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 methods_cstoutf8 = { + close_converter, + cstoutf8, + NULL +}; + +static XlcConv +open_cstoutf8( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + lazy_init_all_charsets(); + return create_conv(from_lcd, &methods_cstoutf8); +} + +/* from XlcNUtf8String to XlcNCharSet */ + +static XlcConv +create_tocs_conv( + XLCd lcd, + XlcConvMethods methods) +{ + XlcConv conv; + CodeSet *codeset_list; + int codeset_num; + int charset_num; + int i, j, k; + Utf8Conv *preferred; + + lazy_init_all_charsets(); + + codeset_list = XLC_GENERIC(lcd, codeset_list); + codeset_num = XLC_GENERIC(lcd, codeset_num); + + charset_num = 0; + for (i = 0; i < codeset_num; i++) + charset_num += codeset_list[i]->num_charsets; + if (charset_num > all_charsets_count-1) + charset_num = all_charsets_count-1; + + conv = Xmalloc(sizeof(XlcConvRec) + + (charset_num + 1) * sizeof(Utf8Conv)); + if (conv == (XlcConv) NULL) + return (XlcConv) NULL; + preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); + + /* Loop through all codesets mentioned in the locale. */ + charset_num = 0; + for (i = 0; i < codeset_num; i++) { + XlcCharSet *charsets = codeset_list[i]->charset_list; + int num_charsets = codeset_list[i]->num_charsets; + for (j = 0; j < num_charsets; j++) { + const char *name = charsets[j]->encoding_name; + /* If it wasn't already encountered... */ + for (k = charset_num-1; k >= 0; k--) + if (!strcmp(preferred[k]->name, name)) + break; + if (k < 0) { + /* Look it up in all_charsets[]. */ + for (k = 0; k < all_charsets_count-1; k++) + if (!strcmp(all_charsets[k].name, name)) { + /* Add it to the preferred set. */ + preferred[charset_num++] = &all_charsets[k]; + break; + } + } + } + } + preferred[charset_num] = (Utf8Conv) NULL; + + conv->methods = methods; + conv->state = (XPointer) preferred; + + return conv; +} + +static void +close_tocs_converter( + XlcConv conv) +{ + /* conv->state is allocated together with conv, free both at once. */ + Xfree(conv); +} + +/* + * Converts a Unicode character to an appropriate character set. The NULL + * terminated array of preferred character sets is passed as first argument. + * If successful, *charsetp is set to the character set that was used, and + * *sidep is set to the character set side (XlcGL or XlcGR). + */ +static int +charset_wctocs( + Utf8Conv *preferred, + Utf8Conv *charsetp, + XlcSide *sidep, + XlcConv conv, + unsigned char *r, + ucs4_t wc, + int n) +{ + int count; + Utf8Conv convptr; + int i; + + for (; *preferred != (Utf8Conv) NULL; preferred++) { + convptr = *preferred; + count = convptr->wctocs(conv, r, wc, n); + if (count == RET_TOOSMALL) + return RET_TOOSMALL; + if (count != RET_ILSEQ) { + *charsetp = convptr; + *sidep = (*r < 0x80 ? XlcGL : XlcGR); + return count; + } + } + for (convptr = all_charsets+1, i = all_charsets_count-1; i > 0; convptr++, i--) { + count = convptr->wctocs(conv, r, wc, n); + if (count == RET_TOOSMALL) + return RET_TOOSMALL; + if (count != RET_ILSEQ) { + *charsetp = convptr; + *sidep = (*r < 0x80 ? XlcGL : XlcGR); + return count; + } + } + return RET_ILSEQ; +} + +static int +utf8tocs( + 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; + ucs4_t wc; + int consumed; + int count; + + consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); + if (consumed == RET_TOOFEW(0)) + break; + if (consumed == RET_ILSEQ) { + 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 methods_utf8tocs = { + close_tocs_converter, + utf8tocs, + NULL +}; + +static XlcConv +open_utf8tocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_tocs_conv(from_lcd, &methods_utf8tocs); +} + +/* from XlcNUtf8String to XlcNChar */ + +static int +utf8tocs1( + 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; + ucs4_t wc; + int consumed; + int count; + + consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); + if (consumed == RET_TOOFEW(0)) + break; + if (consumed == RET_ILSEQ) { + 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; + break; + } + + 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 methods_utf8tocs1 = { + close_tocs_converter, + utf8tocs1, + NULL +}; + +static XlcConv +open_utf8tocs1( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_tocs_conv(from_lcd, &methods_utf8tocs1); +} + +/* from XlcNUtf8String to XlcNString */ + +static int +utf8tostr( + 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; + ucs4_t wc; + int consumed; + + consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); + if (consumed == RET_TOOFEW(0)) + break; + if (dst == dstend) + break; + if (consumed == RET_ILSEQ) { + consumed = 1; + c = BAD_CHAR; + unconv_num++; + } else { + if ((wc & ~(ucs4_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 methods_utf8tostr = { + close_converter, + utf8tostr, + NULL +}; + +static XlcConv +open_utf8tostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_utf8tostr); +} + +/* from XlcNString to XlcNUtf8String */ + +static int +strtoutf8( + 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 = utf8_wctomb(NULL, dst, *src, dstend-dst); + if (count == RET_TOOSMALL) + break; + dst += count; + src++; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return 0; +} + +static XlcConvMethodsRec methods_strtoutf8 = { + close_converter, + strtoutf8, + NULL +}; + +static XlcConv +open_strtoutf8( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_strtoutf8); +} + +/* Support for the input methods. */ + +XPointer +_Utf8GetConvByName( + const char *name) +{ + XrmQuark xrm_name; + Utf8Conv convptr; + int i; + + if (name == NULL) + return (XPointer) NULL; + + lazy_init_all_charsets(); + xrm_name = XrmStringToQuark(name); + + for (convptr = all_charsets, i = all_charsets_count-1; i > 0; convptr++, i--) + if (convptr->xrm_name == xrm_name) + return (XPointer) convptr->wctocs; + return (XPointer) NULL; +} + +/* from XlcNUcsChar to XlcNChar, needed for input methods */ + +static XlcConv +create_ucstocs_conv( + XLCd lcd, + XlcConvMethods methods) +{ + + if (XLC_PUBLIC_PART(lcd)->codeset + && _XlcCompareISOLatin1(XLC_PUBLIC_PART(lcd)->codeset, "UTF-8") == 0) { + XlcConv conv; + Utf8Conv *preferred; + + lazy_init_all_charsets(); + + conv = Xmalloc(sizeof(XlcConvRec) + 2 * sizeof(Utf8Conv)); + if (conv == (XlcConv) NULL) + return (XlcConv) NULL; + preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); + + preferred[0] = &all_charsets[0]; /* ISO10646 */ + preferred[1] = (Utf8Conv) NULL; + + conv->methods = methods; + conv->state = (XPointer) preferred; + + return conv; + } else { + return create_tocs_conv(lcd, methods); + } +} + +static int +charset_wctocs_exactly( + Utf8Conv *preferred, + Utf8Conv *charsetp, + XlcSide *sidep, + XlcConv conv, + unsigned char *r, + ucs4_t wc, + int n) +{ + int count; + Utf8Conv convptr; + + for (; *preferred != (Utf8Conv) NULL; preferred++) { + convptr = *preferred; + count = convptr->wctocs(conv, r, wc, n); + if (count == RET_TOOSMALL) + return RET_TOOSMALL; + if (count != RET_ILSEQ) { + *charsetp = convptr; + *sidep = (*r < 0x80 ? XlcGL : XlcGR); + return count; + } + } + return RET_ILSEQ; +} + +static int +ucstocs1( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + ucs4_t const *src; + unsigned char *dst = (unsigned char *) *to; + int unconv_num = 0; + Utf8Conv *preferred_charsets = (Utf8Conv *) conv->state; + Utf8Conv chosen_charset = NULL; + XlcSide chosen_side = XlcNONE; + XlcCharSet charset = NULL; + int count; + + if (from == NULL || *from == NULL) + return 0; + + src = (ucs4_t const *) *from; + + count = charset_wctocs_exactly(preferred_charsets, &chosen_charset, + &chosen_side, conv, dst, *src, *to_left); + if (count < 1) { + unconv_num++; + count = 0; + } else { + charset = _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); + } + if (charset == NULL) + return -1; + + *from = (XPointer) ++src; + (*from_left)--; + *to = (XPointer) dst; + *to_left -= count; + + if (num_args >= 1) + *((XlcCharSet *)args[0]) = charset; + + return unconv_num; +} + +static XlcConvMethodsRec methods_ucstocs1 = { + close_tocs_converter, + ucstocs1, + NULL +}; + +static XlcConv +open_ucstocs1( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_ucstocs_conv(from_lcd, &methods_ucstocs1); +} + +/* from XlcNUcsChar to XlcNUtf8String, needed for input methods */ + +static int +ucstoutf8( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + const ucs4_t *src; + const ucs4_t *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + src = (const ucs4_t *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend) { + int count = utf8_wctomb(NULL, dst, *src, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) + unconv_num++; + src++; + dst += count; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec methods_ucstoutf8 = { + close_converter, + ucstoutf8, + NULL +}; + +static XlcConv +open_ucstoutf8( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_ucstoutf8); +} + +/* Registers UTF-8 converters for a non-UTF-8 locale. */ +void +_XlcAddUtf8Converters( + XLCd lcd) +{ + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNUtf8String, open_cstoutf8); + _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNCharSet, open_utf8tocs); + _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNChar, open_utf8tocs1); + _XlcSetConverter(lcd, XlcNString, lcd, XlcNUtf8String, open_strtoutf8); + _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNString, open_utf8tostr); + _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNChar, open_ucstocs1); + _XlcSetConverter(lcd, XlcNUcsChar, lcd, XlcNUtf8String, open_ucstoutf8); +} + +/***************************************************************************/ +/* Part II: UTF-8 locale loader conversion files + * + * Here we can assume that "multi-byte" is UTF-8 and that `wchar_t' is Unicode. + */ + +/* from XlcNMultiByte to XlcNWideChar */ + +static int +utf8towcs( + 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; + wchar_t *dst; + wchar_t *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (wchar_t *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend && dst < dstend) { + ucs4_t wc; + int consumed = utf8_mbtowc(NULL, &wc, src, srcend-src); + if (consumed == RET_TOOFEW(0)) + break; + if (consumed == RET_ILSEQ) { + src++; + *dst = BAD_WCHAR; + unconv_num++; + } else { + src += consumed; + *dst = wc; + } + dst++; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec methods_utf8towcs = { + close_converter, + utf8towcs, + NULL +}; + +static XlcConv +open_utf8towcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_utf8towcs); +} + +/* from XlcNWideChar to XlcNMultiByte */ + +static int +wcstoutf8( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + wchar_t const *src; + wchar_t const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + src = (wchar_t const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend) { + int count = utf8_wctomb(NULL, dst, *src, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) { + count = utf8_wctomb(NULL, dst, BAD_WCHAR, dstend-dst); + if (count == RET_TOOSMALL) + break; + unconv_num++; + } + dst += count; + src++; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec methods_wcstoutf8 = { + close_converter, + wcstoutf8, + NULL +}; + +static XlcConv +open_wcstoutf8( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_wcstoutf8); +} + +/* from XlcNString to XlcNWideChar */ + +static int +our_strtowcs( + 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; + wchar_t *dst; + wchar_t *dstend; + + if (from == NULL || *from == NULL) + return 0; + + src = (unsigned char const *) *from; + srcend = src + *from_left; + dst = (wchar_t *) *to; + dstend = dst + *to_left; + + while (src < srcend && dst < dstend) + *dst++ = (wchar_t) *src++; + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return 0; +} + +static XlcConvMethodsRec methods_strtowcs = { + close_converter, + our_strtowcs, + NULL +}; + +static XlcConv +open_strtowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_strtowcs); +} + +/* from XlcNWideChar to XlcNString */ + +static int +our_wcstostr( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + wchar_t const *src; + wchar_t const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + src = (wchar_t const *) *from; + srcend = src + *from_left; + dst = (unsigned char *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend && dst < dstend) { + unsigned int wc = *src++; + if (wc < 0x80) + *dst = wc; + else { + *dst = BAD_CHAR; + unconv_num++; + } + dst++; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec methods_wcstostr = { + close_converter, + our_wcstostr, + NULL +}; + +static XlcConv +open_wcstostr( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_wcstostr); +} + +/* from XlcNCharSet to XlcNWideChar */ + +static int +cstowcs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + XlcCharSet charset; + const char *name; + Utf8Conv convptr; + int i; + unsigned char const *src; + unsigned char const *srcend; + wchar_t *dst; + wchar_t *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 = (wchar_t *) *to; + dstend = dst + *to_left; + unconv_num = 0; + + while (src < srcend && dst < dstend) { + unsigned int wc; + int consumed; + + consumed = convptr->cstowc(conv, &wc, src, srcend-src); + if (consumed == RET_ILSEQ) + return -1; + if (consumed == RET_TOOFEW(0)) + break; + + *dst++ = wc; + src += consumed; + } + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return unconv_num; +} + +static XlcConvMethodsRec methods_cstowcs = { + close_converter, + cstowcs, + NULL +}; + +static XlcConv +open_cstowcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + lazy_init_all_charsets(); + return create_conv(from_lcd, &methods_cstowcs); +} + +/* from XlcNWideChar to XlcNCharSet */ + +static int +wcstocs( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + Utf8Conv *preferred_charsets; + XlcCharSet last_charset = NULL; + wchar_t const *src; + wchar_t const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + preferred_charsets = (Utf8Conv *) conv->state; + src = (wchar_t 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 = *src; + int count; + + count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) { + src++; + unconv_num++; + continue; + } + + if (last_charset == NULL) { + last_charset = + _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); + if (last_charset == NULL) { + src++; + 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++; + 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 methods_wcstocs = { + close_tocs_converter, + wcstocs, + NULL +}; + +static XlcConv +open_wcstocs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_tocs_conv(from_lcd, &methods_wcstocs); +} + +/* from XlcNWideChar to XlcNChar */ + +static int +wcstocs1( + XlcConv conv, + XPointer *from, + int *from_left, + XPointer *to, + int *to_left, + XPointer *args, + int num_args) +{ + Utf8Conv *preferred_charsets; + XlcCharSet last_charset = NULL; + wchar_t const *src; + wchar_t const *srcend; + unsigned char *dst; + unsigned char *dstend; + int unconv_num; + + if (from == NULL || *from == NULL) + return 0; + + preferred_charsets = (Utf8Conv *) conv->state; + src = (wchar_t 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 = *src; + int count; + + count = charset_wctocs(preferred_charsets, &chosen_charset, &chosen_side, conv, dst, wc, dstend-dst); + if (count == RET_TOOSMALL) + break; + if (count == RET_ILSEQ) { + src++; + unconv_num++; + continue; + } + + if (last_charset == NULL) { + last_charset = + _XlcGetCharSetWithSide(chosen_charset->name, chosen_side); + if (last_charset == NULL) { + src++; + 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++; + dst += count; + break; + } + + 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 methods_wcstocs1 = { + close_tocs_converter, + wcstocs1, + NULL +}; + +static XlcConv +open_wcstocs1( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_tocs_conv(from_lcd, &methods_wcstocs1); +} + +/* trivial, no conversion */ + +static int +identity( + 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 && dst < dstend) + *dst++ = *src++; + + *from = (XPointer) src; + *from_left = srcend - src; + *to = (XPointer) dst; + *to_left = dstend - dst; + + return 0; +} + +static XlcConvMethodsRec methods_identity = { + close_converter, + identity, + NULL +}; + +static XlcConv +open_identity( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_conv(from_lcd, &methods_identity); +} + +/* from MultiByte/WideChar to FontCharSet. */ +/* They really use converters to CharSet + * but with different create_conv procedure. */ + +static XlcConv +create_tofontcs_conv( + XLCd lcd, + XlcConvMethods methods) +{ + XlcConv conv; + int i, num, k, count; + char **value, buf[20]; + Utf8Conv *preferred; + + lazy_init_all_charsets(); + + for (i = 0, num = 0;; i++) { + snprintf(buf, sizeof(buf), "fs%d.charset.name", i); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) { + snprintf(buf, sizeof(buf), "fs%d.charset", i); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) + break; + } + num += count; + } + + conv = Xmalloc(sizeof(XlcConvRec) + (num + 1) * sizeof(Utf8Conv)); + if (conv == (XlcConv) NULL) + return (XlcConv) NULL; + preferred = (Utf8Conv *) ((char *) conv + sizeof(XlcConvRec)); + + /* Loop through all fontsets mentioned in the locale. */ + for (i = 0, num = 0;; i++) { + snprintf(buf, sizeof(buf), "fs%d.charset.name", i); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) { + snprintf(buf, sizeof(buf), "fs%d.charset", i); + _XlcGetResource(lcd, "XLC_FONTSET", buf, &value, &count); + if (count < 1) + break; + } + while (count-- > 0) { + XlcCharSet charset = _XlcGetCharSet(*value++); + const char *name; + + if (charset == (XlcCharSet) NULL) + continue; + + name = charset->encoding_name; + /* If it wasn't already encountered... */ + for (k = num - 1; k >= 0; k--) + if (!strcmp(preferred[k]->name, name)) + break; + if (k < 0) { + /* For fonts "ISO10646-1" means ucs2, not utf8.*/ + if (!strcmp("ISO10646-1", name)) { + preferred[num++] = &all_charsets[ucs2_conv_index]; + continue; + } + /* Look it up in all_charsets[]. */ + for (k = 0; k < all_charsets_count-1; k++) + if (!strcmp(all_charsets[k].name, name)) { + /* Add it to the preferred set. */ + preferred[num++] = &all_charsets[k]; + break; + } + } + } + } + preferred[num] = (Utf8Conv) NULL; + + conv->methods = methods; + conv->state = (XPointer) preferred; + + return conv; +} + +static XlcConv +open_wcstofcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + return create_tofontcs_conv(from_lcd, &methods_wcstocs); +} + +static XlcConv +open_utf8tofcs( + XLCd from_lcd, + const char *from_type, + XLCd to_lcd, + const char *to_type) +{ + 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 const *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((char *)dst, wc); + if (count == 0) + break; + if (count == -1) { + count = wctomb((char *)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, const char *from_type, XLCd to_lcd, const 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, (const char *)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, const char *from_type, XLCd to_lcd, const 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, (const char *)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, const char *from_type, XLCd to_lcd, const 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, (const char *)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, const char *from_type, XLCd to_lcd, const 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((char *)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, const char *from_type, XLCd to_lcd, const 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, const char *from_type, XLCd to_lcd, const 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, const char *from_type, XLCd to_lcd, const 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 +_XlcAddUtf8LocaleConverters( + XLCd lcd) +{ + /* Register elementary converters. */ + + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNWideChar, open_utf8towcs); + + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNMultiByte, open_wcstoutf8); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNString, open_wcstostr); + + _XlcSetConverter(lcd, XlcNString, lcd, XlcNWideChar, open_strtowcs); + + /* Register converters for XlcNCharSet. This implicitly provides + * converters from and to XlcNCompoundText. */ + + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNMultiByte, open_cstoutf8); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNCharSet, open_utf8tocs); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNChar, open_utf8tocs1); + + _XlcSetConverter(lcd, XlcNCharSet, lcd, XlcNWideChar, open_cstowcs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNCharSet, open_wcstocs); + _XlcSetConverter(lcd, XlcNWideChar, lcd, XlcNChar, open_wcstocs1); + + _XlcSetConverter(lcd, XlcNString, lcd, XlcNMultiByte, open_strtoutf8); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNString, open_utf8tostr); + _XlcSetConverter(lcd, XlcNUtf8String, lcd, XlcNMultiByte, open_identity); + _XlcSetConverter(lcd, XlcNMultiByte, lcd, XlcNUtf8String, open_identity); + + /* Register converters for XlcNFontCharSet */ + _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/nx-X11/lib/src/xlibi18n/lcUniConv/armscii_8.h b/nx-X11/lib/src/xlibi18n/lcUniConv/armscii_8.h new file mode 100644 index 000000000..567bfeac2 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/armscii_8.h @@ -0,0 +1,97 @@ + +/* + * ARMSCII-8 + */ + +static const unsigned short armscii_8_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0xfffd, 0x0587, 0x0589, 0x0029, 0x0028, 0x00bb, 0x00ab, + 0x2014, 0x002e, 0x055d, 0x002c, 0x002d, 0x058a, 0x2026, 0x055c, + /* 0xb0 */ + 0x055b, 0x055e, 0x0531, 0x0561, 0x0532, 0x0562, 0x0533, 0x0563, + 0x0534, 0x0564, 0x0535, 0x0565, 0x0536, 0x0566, 0x0537, 0x0567, + /* 0xc0 */ + 0x0538, 0x0568, 0x0539, 0x0569, 0x053a, 0x056a, 0x053b, 0x056b, + 0x053c, 0x056c, 0x053d, 0x056d, 0x053e, 0x056e, 0x053f, 0x056f, + /* 0xd0 */ + 0x0540, 0x0570, 0x0541, 0x0571, 0x0542, 0x0572, 0x0543, 0x0573, + 0x0544, 0x0574, 0x0545, 0x0575, 0x0546, 0x0576, 0x0547, 0x0577, + /* 0xe0 */ + 0x0548, 0x0578, 0x0549, 0x0579, 0x054a, 0x057a, 0x054b, 0x057b, + 0x054c, 0x057c, 0x054d, 0x057d, 0x054e, 0x057e, 0x054f, 0x057f, + /* 0xf0 */ + 0x0550, 0x0580, 0x0551, 0x0581, 0x0552, 0x0582, 0x0553, 0x0583, + 0x0554, 0x0584, 0x0555, 0x0585, 0x0556, 0x0586, 0x055a, 0xfffd, +}; + +static int +armscii_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = armscii_8_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char armscii_8_page00[8] = { + 0xa5, 0xa4, 0x2a, 0x2b, 0xab, 0xac, 0xa9, 0x2f, /* 0x28-0x2f */ +}; +static const unsigned char armscii_8_page00_1[32] = { + 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0xa7, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xa6, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ +}; +static const unsigned char armscii_8_page05[96] = { + 0x00, 0xb2, 0xb4, 0xb6, 0xb8, 0xba, 0xbc, 0xbe, /* 0x30-0x37 */ + 0xc0, 0xc2, 0xc4, 0xc6, 0xc8, 0xca, 0xcc, 0xce, /* 0x38-0x3f */ + 0xd0, 0xd2, 0xd4, 0xd6, 0xd8, 0xda, 0xdc, 0xde, /* 0x40-0x47 */ + 0xe0, 0xe2, 0xe4, 0xe6, 0xe8, 0xea, 0xec, 0xee, /* 0x48-0x4f */ + 0xf0, 0xf2, 0xf4, 0xf6, 0xf8, 0xfa, 0xfc, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0xfe, 0xb0, 0xaf, 0xaa, 0xb1, 0x00, /* 0x58-0x5f */ + 0x00, 0xb3, 0xb5, 0xb7, 0xb9, 0xbb, 0xbd, 0xbf, /* 0x60-0x67 */ + 0xc1, 0xc3, 0xc5, 0xc7, 0xc9, 0xcb, 0xcd, 0xcf, /* 0x68-0x6f */ + 0xd1, 0xd3, 0xd5, 0xd7, 0xd9, 0xdb, 0xdd, 0xdf, /* 0x70-0x77 */ + 0xe1, 0xe3, 0xe5, 0xe7, 0xe9, 0xeb, 0xed, 0xef, /* 0x78-0x7f */ + 0xf1, 0xf3, 0xf5, 0xf7, 0xf9, 0xfb, 0xfd, 0xa2, /* 0x80-0x87 */ + 0x00, 0xa3, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ +}; +static const unsigned char armscii_8_page20[24] = { + 0x00, 0x00, 0x00, 0x00, 0xa8, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0x00, /* 0x20-0x27 */ +}; + +static int +armscii_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0028) { + *r = wc; + return 1; + } + else if (wc >= 0x0028 && wc < 0x0030) + c = armscii_8_page00[wc-0x0028]; + else if (wc >= 0x0030 && wc < 0x00a0) + c = wc; + else if (wc >= 0x00a0 && wc < 0x00c0) + c = armscii_8_page00_1[wc-0x00a0]; + else if (wc >= 0x0530 && wc < 0x0590) + c = armscii_8_page05[wc-0x0530]; + else if (wc >= 0x2010 && wc < 0x2028) + c = armscii_8_page20[wc-0x2010]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/big5.h b/nx-X11/lib/src/xlibi18n/lcUniConv/big5.h new file mode 100644 index 000000000..db439088b --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/big5.h @@ -0,0 +1,4141 @@ + +/* + * BIG5 + */ + +static const unsigned short big5_2uni_pagea1[6121] = { + /* 0xa1 */ + 0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2022, 0xff1b, 0xff1a, + 0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xff64, 0xfe52, + 0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2013, 0xfe31, + 0x2014, 0xfe33, 0xfffd, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35, + 0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39, + 0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d, + 0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41, + 0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b, + 0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d, + 0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7, + 0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605, + 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105, + 0x203e, 0xfffd, 0xff3f, 0xfffd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e, + 0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7, + 0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267, + 0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65, + 0xfe66, 0x223c, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf, + 0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642, + 0x2641, 0x2609, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197, + 0x2199, 0x2198, 0x2225, 0x2223, 0xfffd, + /* 0xa2 */ + 0xfffd, 0xff0f, 0xff3c, 0xff04, 0x00a5, 0x3012, 0x00a2, 0x00a3, + 0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5, + 0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4, + 0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7, + 0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, + 0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a, + 0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500, + 0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e, + 0x2570, 0x256f, 0x2550, 0x255e, 0x256a, 0x2561, 0x25e2, 0x25e3, + 0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12, + 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160, + 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, + 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, + 0x3028, 0x3029, 0xfffd, 0x5344, 0xfffd, 0xff21, 0xff22, 0xff23, + 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, + 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, + 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41, + 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, + 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, + 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, + /* 0xa3 */ + 0xff57, 0xff58, 0xff59, 0xff5a, 0x0391, 0x0392, 0x0393, 0x0394, + 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, + 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, + 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, + 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, + 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, + 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x3105, 0x3106, 0x3107, 0x3108, + 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, + 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, + 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, + 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, + 0x3129, 0x02d9, 0x02c9, 0x02ca, 0x02c7, 0x02cb, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa4 */ + 0x4e00, 0x4e59, 0x4e01, 0x4e03, 0x4e43, 0x4e5d, 0x4e86, 0x4e8c, + 0x4eba, 0x513f, 0x5165, 0x516b, 0x51e0, 0x5200, 0x5201, 0x529b, + 0x5315, 0x5341, 0x535c, 0x53c8, 0x4e09, 0x4e0b, 0x4e08, 0x4e0a, + 0x4e2b, 0x4e38, 0x51e1, 0x4e45, 0x4e48, 0x4e5f, 0x4e5e, 0x4e8e, + 0x4ea1, 0x5140, 0x5203, 0x52fa, 0x5343, 0x53c9, 0x53e3, 0x571f, + 0x58eb, 0x5915, 0x5927, 0x5973, 0x5b50, 0x5b51, 0x5b53, 0x5bf8, + 0x5c0f, 0x5c22, 0x5c38, 0x5c71, 0x5ddd, 0x5de5, 0x5df1, 0x5df2, + 0x5df3, 0x5dfe, 0x5e72, 0x5efe, 0x5f0b, 0x5f13, 0x624d, 0x4e11, + 0x4e10, 0x4e0d, 0x4e2d, 0x4e30, 0x4e39, 0x4e4b, 0x5c39, 0x4e88, + 0x4e91, 0x4e95, 0x4e92, 0x4e94, 0x4ea2, 0x4ec1, 0x4ec0, 0x4ec3, + 0x4ec6, 0x4ec7, 0x4ecd, 0x4eca, 0x4ecb, 0x4ec4, 0x5143, 0x5141, + 0x5167, 0x516d, 0x516e, 0x516c, 0x5197, 0x51f6, 0x5206, 0x5207, + 0x5208, 0x52fb, 0x52fe, 0x52ff, 0x5316, 0x5339, 0x5348, 0x5347, + 0x5345, 0x535e, 0x5384, 0x53cb, 0x53ca, 0x53cd, 0x58ec, 0x5929, + 0x592b, 0x592a, 0x592d, 0x5b54, 0x5c11, 0x5c24, 0x5c3a, 0x5c6f, + 0x5df4, 0x5e7b, 0x5eff, 0x5f14, 0x5f15, 0x5fc3, 0x6208, 0x6236, + 0x624b, 0x624e, 0x652f, 0x6587, 0x6597, 0x65a4, 0x65b9, 0x65e5, + 0x66f0, 0x6708, 0x6728, 0x6b20, 0x6b62, 0x6b79, 0x6bcb, 0x6bd4, + 0x6bdb, 0x6c0f, 0x6c34, 0x706b, 0x722a, 0x7236, 0x723b, 0x7247, + 0x7259, 0x725b, 0x72ac, 0x738b, 0x4e19, + /* 0xa5 */ + 0x4e16, 0x4e15, 0x4e14, 0x4e18, 0x4e3b, 0x4e4d, 0x4e4f, 0x4e4e, + 0x4ee5, 0x4ed8, 0x4ed4, 0x4ed5, 0x4ed6, 0x4ed7, 0x4ee3, 0x4ee4, + 0x4ed9, 0x4ede, 0x5145, 0x5144, 0x5189, 0x518a, 0x51ac, 0x51f9, + 0x51fa, 0x51f8, 0x520a, 0x52a0, 0x529f, 0x5305, 0x5306, 0x5317, + 0x531d, 0x4edf, 0x534a, 0x5349, 0x5361, 0x5360, 0x536f, 0x536e, + 0x53bb, 0x53ef, 0x53e4, 0x53f3, 0x53ec, 0x53ee, 0x53e9, 0x53e8, + 0x53fc, 0x53f8, 0x53f5, 0x53eb, 0x53e6, 0x53ea, 0x53f2, 0x53f1, + 0x53f0, 0x53e5, 0x53ed, 0x53fb, 0x56db, 0x56da, 0x5916, 0x592e, + 0x5931, 0x5974, 0x5976, 0x5b55, 0x5b83, 0x5c3c, 0x5de8, 0x5de7, + 0x5de6, 0x5e02, 0x5e03, 0x5e73, 0x5e7c, 0x5f01, 0x5f18, 0x5f17, + 0x5fc5, 0x620a, 0x6253, 0x6254, 0x6252, 0x6251, 0x65a5, 0x65e6, + 0x672e, 0x672c, 0x672a, 0x672b, 0x672d, 0x6b63, 0x6bcd, 0x6c11, + 0x6c10, 0x6c38, 0x6c41, 0x6c40, 0x6c3e, 0x72af, 0x7384, 0x7389, + 0x74dc, 0x74e6, 0x7518, 0x751f, 0x7528, 0x7529, 0x7530, 0x7531, + 0x7532, 0x7533, 0x758b, 0x767d, 0x76ae, 0x76bf, 0x76ee, 0x77db, + 0x77e2, 0x77f3, 0x793a, 0x79be, 0x7a74, 0x7acb, 0x4e1e, 0x4e1f, + 0x4e52, 0x4e53, 0x4e69, 0x4e99, 0x4ea4, 0x4ea6, 0x4ea5, 0x4eff, + 0x4f09, 0x4f19, 0x4f0a, 0x4f15, 0x4f0d, 0x4f10, 0x4f11, 0x4f0f, + 0x4ef2, 0x4ef6, 0x4efb, 0x4ef0, 0x4ef3, 0x4efd, 0x4f01, 0x4f0b, + 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, + /* 0xa6 */ + 0x5171, 0x518d, 0x51b0, 0x5217, 0x5211, 0x5212, 0x520e, 0x5216, + 0x52a3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540f, + 0x540c, 0x540a, 0x5410, 0x5401, 0x540b, 0x5404, 0x5411, 0x540d, + 0x5408, 0x5403, 0x540e, 0x5406, 0x5412, 0x56e0, 0x56de, 0x56dd, + 0x5733, 0x5730, 0x5728, 0x572d, 0x572c, 0x572f, 0x5729, 0x5919, + 0x591a, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597d, 0x5979, + 0x5982, 0x5981, 0x5b57, 0x5b58, 0x5b87, 0x5b88, 0x5b85, 0x5b89, + 0x5bfa, 0x5c16, 0x5c79, 0x5dde, 0x5e06, 0x5e76, 0x5e74, 0x5f0f, + 0x5f1b, 0x5fd9, 0x5fd6, 0x620e, 0x620c, 0x620d, 0x6210, 0x6263, + 0x625b, 0x6258, 0x6536, 0x65e9, 0x65e8, 0x65ec, 0x65ed, 0x66f2, + 0x66f3, 0x6709, 0x673d, 0x6734, 0x6731, 0x6735, 0x6b21, 0x6b64, + 0x6b7b, 0x6c16, 0x6c5d, 0x6c57, 0x6c59, 0x6c5f, 0x6c60, 0x6c50, + 0x6c55, 0x6c61, 0x6c5b, 0x6c4d, 0x6c4e, 0x7070, 0x725f, 0x725d, + 0x767e, 0x7af9, 0x7c73, 0x7cf8, 0x7f36, 0x7f8a, 0x7fbd, 0x8001, + 0x8003, 0x800c, 0x8012, 0x8033, 0x807f, 0x8089, 0x808b, 0x808c, + 0x81e3, 0x81ea, 0x81f3, 0x81fc, 0x820c, 0x821b, 0x821f, 0x826e, + 0x8272, 0x827e, 0x866b, 0x8840, 0x884c, 0x8863, 0x897f, 0x9621, + 0x4e32, 0x4ea8, 0x4f4d, 0x4f4f, 0x4f47, 0x4f57, 0x4f5e, 0x4f34, + 0x4f5b, 0x4f55, 0x4f30, 0x4f50, 0x4f51, 0x4f3d, 0x4f3a, 0x4f38, + 0x4f43, 0x4f54, 0x4f3c, 0x4f46, 0x4f63, + /* 0xa7 */ + 0x4f5c, 0x4f60, 0x4f2f, 0x4f4e, 0x4f36, 0x4f59, 0x4f5d, 0x4f48, + 0x4f5a, 0x514c, 0x514b, 0x514d, 0x5175, 0x51b6, 0x51b7, 0x5225, + 0x5224, 0x5229, 0x522a, 0x5228, 0x52ab, 0x52a9, 0x52aa, 0x52ac, + 0x5323, 0x5373, 0x5375, 0x541d, 0x542d, 0x541e, 0x543e, 0x5426, + 0x544e, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541b, + 0x5429, 0x544a, 0x5439, 0x543b, 0x5438, 0x542e, 0x5435, 0x5436, + 0x5420, 0x543c, 0x5440, 0x5431, 0x542b, 0x541f, 0x542c, 0x56ea, + 0x56f0, 0x56e4, 0x56eb, 0x574a, 0x5751, 0x5740, 0x574d, 0x5747, + 0x574e, 0x573e, 0x5750, 0x574f, 0x573b, 0x58ef, 0x593e, 0x599d, + 0x5992, 0x59a8, 0x599e, 0x59a3, 0x5999, 0x5996, 0x598d, 0x59a4, + 0x5993, 0x598a, 0x59a5, 0x5b5d, 0x5b5c, 0x5b5a, 0x5b5b, 0x5b8c, + 0x5b8b, 0x5b8f, 0x5c2c, 0x5c40, 0x5c41, 0x5c3f, 0x5c3e, 0x5c90, + 0x5c91, 0x5c94, 0x5c8c, 0x5deb, 0x5e0c, 0x5e8f, 0x5e87, 0x5e8a, + 0x5ef7, 0x5f04, 0x5f1f, 0x5f64, 0x5f62, 0x5f77, 0x5f79, 0x5fd8, + 0x5fcc, 0x5fd7, 0x5fcd, 0x5ff1, 0x5feb, 0x5ff8, 0x5fea, 0x6212, + 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, 0x6289, 0x626d, + 0x628a, 0x627c, 0x627e, 0x6279, 0x6273, 0x6292, 0x626f, 0x6298, + 0x626e, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, 0x653b, 0x6538, + 0x65f1, 0x66f4, 0x675f, 0x674e, 0x674f, 0x6750, 0x6751, 0x675c, + 0x6756, 0x675e, 0x6749, 0x6746, 0x6760, + /* 0xa8 */ + 0x6753, 0x6757, 0x6b65, 0x6bcf, 0x6c42, 0x6c5e, 0x6c99, 0x6c81, + 0x6c88, 0x6c89, 0x6c85, 0x6c9b, 0x6c6a, 0x6c7a, 0x6c90, 0x6c70, + 0x6c8c, 0x6c68, 0x6c96, 0x6c92, 0x6c7d, 0x6c83, 0x6c72, 0x6c7e, + 0x6c74, 0x6c86, 0x6c76, 0x6c8d, 0x6c94, 0x6c98, 0x6c82, 0x7076, + 0x707c, 0x707d, 0x7078, 0x7262, 0x7261, 0x7260, 0x72c4, 0x72c2, + 0x7396, 0x752c, 0x752b, 0x7537, 0x7538, 0x7682, 0x76ef, 0x77e3, + 0x79c1, 0x79c0, 0x79bf, 0x7a76, 0x7cfb, 0x7f55, 0x8096, 0x8093, + 0x809d, 0x8098, 0x809b, 0x809a, 0x80b2, 0x826f, 0x8292, 0x828b, + 0x828d, 0x898b, 0x89d2, 0x8a00, 0x8c37, 0x8c46, 0x8c55, 0x8c9d, + 0x8d64, 0x8d70, 0x8db3, 0x8eab, 0x8eca, 0x8f9b, 0x8fb0, 0x8fc2, + 0x8fc6, 0x8fc5, 0x8fc4, 0x5de1, 0x9091, 0x90a2, 0x90aa, 0x90a6, + 0x90a3, 0x9149, 0x91c6, 0x91cc, 0x9632, 0x962e, 0x9631, 0x962a, + 0x962c, 0x4e26, 0x4e56, 0x4e73, 0x4e8b, 0x4e9b, 0x4e9e, 0x4eab, + 0x4eac, 0x4f6f, 0x4f9d, 0x4f8d, 0x4f73, 0x4f7f, 0x4f6c, 0x4f9b, + 0x4f8b, 0x4f86, 0x4f83, 0x4f70, 0x4f75, 0x4f88, 0x4f69, 0x4f7b, + 0x4f96, 0x4f7e, 0x4f8f, 0x4f91, 0x4f7a, 0x5154, 0x5152, 0x5155, + 0x5169, 0x5177, 0x5176, 0x5178, 0x51bd, 0x51fd, 0x523b, 0x5238, + 0x5237, 0x523a, 0x5230, 0x522e, 0x5236, 0x5241, 0x52be, 0x52bb, + 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, 0x5378, 0x5379, + 0x53d6, 0x53d4, 0x53d7, 0x5473, 0x5475, + /* 0xa9 */ + 0x5496, 0x5478, 0x5495, 0x5480, 0x547b, 0x5477, 0x5484, 0x5492, + 0x5486, 0x547c, 0x5490, 0x5471, 0x5476, 0x548c, 0x549a, 0x5462, + 0x5468, 0x548b, 0x547d, 0x548e, 0x56fa, 0x5783, 0x5777, 0x576a, + 0x5769, 0x5761, 0x5766, 0x5764, 0x577c, 0x591c, 0x5949, 0x5947, + 0x5948, 0x5944, 0x5954, 0x59be, 0x59bb, 0x59d4, 0x59b9, 0x59ae, + 0x59d1, 0x59c6, 0x59d0, 0x59cd, 0x59cb, 0x59d3, 0x59ca, 0x59af, + 0x59b3, 0x59d2, 0x59c5, 0x5b5f, 0x5b64, 0x5b63, 0x5b97, 0x5b9a, + 0x5b98, 0x5b9c, 0x5b99, 0x5b9b, 0x5c1a, 0x5c48, 0x5c45, 0x5c46, + 0x5cb7, 0x5ca1, 0x5cb8, 0x5ca9, 0x5cab, 0x5cb1, 0x5cb3, 0x5e18, + 0x5e1a, 0x5e16, 0x5e15, 0x5e1b, 0x5e11, 0x5e78, 0x5e9a, 0x5e97, + 0x5e9c, 0x5e95, 0x5e96, 0x5ef6, 0x5f26, 0x5f27, 0x5f29, 0x5f80, + 0x5f81, 0x5f7f, 0x5f7c, 0x5fdd, 0x5fe0, 0x5ffd, 0x5ff5, 0x5fff, + 0x600f, 0x6014, 0x602f, 0x6035, 0x6016, 0x602a, 0x6015, 0x6021, + 0x6027, 0x6029, 0x602b, 0x601b, 0x6216, 0x6215, 0x623f, 0x623e, + 0x6240, 0x627f, 0x62c9, 0x62cc, 0x62c4, 0x62bf, 0x62c2, 0x62b9, + 0x62d2, 0x62db, 0x62ab, 0x62d3, 0x62d4, 0x62cb, 0x62c8, 0x62a8, + 0x62bd, 0x62bc, 0x62d0, 0x62d9, 0x62c7, 0x62cd, 0x62b5, 0x62da, + 0x62b1, 0x62d8, 0x62d6, 0x62d7, 0x62c6, 0x62ac, 0x62ce, 0x653e, + 0x65a7, 0x65bc, 0x65fa, 0x6614, 0x6613, 0x660c, 0x6606, 0x6602, + 0x660e, 0x6600, 0x660f, 0x6615, 0x660a, + /* 0xaa */ + 0x6607, 0x670d, 0x670b, 0x676d, 0x678b, 0x6795, 0x6771, 0x679c, + 0x6773, 0x6777, 0x6787, 0x679d, 0x6797, 0x676f, 0x6770, 0x677f, + 0x6789, 0x677e, 0x6790, 0x6775, 0x679a, 0x6793, 0x677c, 0x676a, + 0x6772, 0x6b23, 0x6b66, 0x6b67, 0x6b7f, 0x6c13, 0x6c1b, 0x6ce3, + 0x6ce8, 0x6cf3, 0x6cb1, 0x6ccc, 0x6ce5, 0x6cb3, 0x6cbd, 0x6cbe, + 0x6cbc, 0x6ce2, 0x6cab, 0x6cd5, 0x6cd3, 0x6cb8, 0x6cc4, 0x6cb9, + 0x6cc1, 0x6cae, 0x6cd7, 0x6cc5, 0x6cf1, 0x6cbf, 0x6cbb, 0x6ce1, + 0x6cdb, 0x6cca, 0x6cac, 0x6cef, 0x6cdc, 0x6cd6, 0x6ce0, 0x7095, + 0x708e, 0x7092, 0x708a, 0x7099, 0x722c, 0x722d, 0x7238, 0x7248, + 0x7267, 0x7269, 0x72c0, 0x72ce, 0x72d9, 0x72d7, 0x72d0, 0x73a9, + 0x73a8, 0x739f, 0x73ab, 0x73a5, 0x753d, 0x759d, 0x7599, 0x759a, + 0x7684, 0x76c2, 0x76f2, 0x76f4, 0x77e5, 0x77fd, 0x793e, 0x7940, + 0x7941, 0x79c9, 0x79c8, 0x7a7a, 0x7a79, 0x7afa, 0x7cfe, 0x7f54, + 0x7f8c, 0x7f8b, 0x8005, 0x80ba, 0x80a5, 0x80a2, 0x80b1, 0x80a1, + 0x80ab, 0x80a9, 0x80b4, 0x80aa, 0x80af, 0x81e5, 0x81fe, 0x820d, + 0x82b3, 0x829d, 0x8299, 0x82ad, 0x82bd, 0x829f, 0x82b9, 0x82b1, + 0x82ac, 0x82a5, 0x82af, 0x82b8, 0x82a3, 0x82b0, 0x82be, 0x82b7, + 0x864e, 0x8671, 0x521d, 0x8868, 0x8ecb, 0x8fce, 0x8fd4, 0x8fd1, + 0x90b5, 0x90b8, 0x90b1, 0x90b6, 0x91c7, 0x91d1, 0x9577, 0x9580, + 0x961c, 0x9640, 0x963f, 0x963b, 0x9644, + /* 0xab */ + 0x9642, 0x96b9, 0x96e8, 0x9752, 0x975e, 0x4e9f, 0x4ead, 0x4eae, + 0x4fe1, 0x4fb5, 0x4faf, 0x4fbf, 0x4fe0, 0x4fd1, 0x4fcf, 0x4fdd, + 0x4fc3, 0x4fb6, 0x4fd8, 0x4fdf, 0x4fca, 0x4fd7, 0x4fae, 0x4fd0, + 0x4fc4, 0x4fc2, 0x4fda, 0x4fce, 0x4fde, 0x4fb7, 0x5157, 0x5192, + 0x5191, 0x51a0, 0x524e, 0x5243, 0x524a, 0x524d, 0x524c, 0x524b, + 0x5247, 0x52c7, 0x52c9, 0x52c3, 0x52c1, 0x530d, 0x5357, 0x537b, + 0x539a, 0x53db, 0x54ac, 0x54c0, 0x54a8, 0x54ce, 0x54c9, 0x54b8, + 0x54a6, 0x54b3, 0x54c7, 0x54c2, 0x54bd, 0x54aa, 0x54c1, 0x54c4, + 0x54c8, 0x54af, 0x54ab, 0x54b1, 0x54bb, 0x54a9, 0x54a7, 0x54bf, + 0x56ff, 0x5782, 0x578b, 0x57a0, 0x57a3, 0x57a2, 0x57ce, 0x57ae, + 0x5793, 0x5955, 0x5951, 0x594f, 0x594e, 0x5950, 0x59dc, 0x59d8, + 0x59ff, 0x59e3, 0x59e8, 0x5a03, 0x59e5, 0x59ea, 0x59da, 0x59e6, + 0x5a01, 0x59fb, 0x5b69, 0x5ba3, 0x5ba6, 0x5ba4, 0x5ba2, 0x5ba5, + 0x5c01, 0x5c4e, 0x5c4f, 0x5c4d, 0x5c4b, 0x5cd9, 0x5cd2, 0x5df7, + 0x5e1d, 0x5e25, 0x5e1f, 0x5e7d, 0x5ea0, 0x5ea6, 0x5efa, 0x5f08, + 0x5f2d, 0x5f65, 0x5f88, 0x5f85, 0x5f8a, 0x5f8b, 0x5f87, 0x5f8c, + 0x5f89, 0x6012, 0x601d, 0x6020, 0x6025, 0x600e, 0x6028, 0x604d, + 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606c, 0x606b, 0x606a, + 0x6064, 0x6241, 0x62dc, 0x6316, 0x6309, 0x62fc, 0x62ed, 0x6301, + 0x62ee, 0x62fd, 0x6307, 0x62f1, 0x62f7, + /* 0xac */ + 0x62ef, 0x62ec, 0x62fe, 0x62f4, 0x6311, 0x6302, 0x653f, 0x6545, + 0x65ab, 0x65bd, 0x65e2, 0x6625, 0x662d, 0x6620, 0x6627, 0x662f, + 0x661f, 0x6628, 0x6631, 0x6624, 0x66f7, 0x67ff, 0x67d3, 0x67f1, + 0x67d4, 0x67d0, 0x67ec, 0x67b6, 0x67af, 0x67f5, 0x67e9, 0x67ef, + 0x67c4, 0x67d1, 0x67b4, 0x67da, 0x67e5, 0x67b8, 0x67cf, 0x67de, + 0x67f3, 0x67b0, 0x67d9, 0x67e2, 0x67dd, 0x67d2, 0x6b6a, 0x6b83, + 0x6b86, 0x6bb5, 0x6bd2, 0x6bd7, 0x6c1f, 0x6cc9, 0x6d0b, 0x6d32, + 0x6d2a, 0x6d41, 0x6d25, 0x6d0c, 0x6d31, 0x6d1e, 0x6d17, 0x6d3b, + 0x6d3d, 0x6d3e, 0x6d36, 0x6d1b, 0x6cf5, 0x6d39, 0x6d27, 0x6d38, + 0x6d29, 0x6d2e, 0x6d35, 0x6d0e, 0x6d2b, 0x70ab, 0x70ba, 0x70b3, + 0x70ac, 0x70af, 0x70ad, 0x70b8, 0x70ae, 0x70a4, 0x7230, 0x7272, + 0x726f, 0x7274, 0x72e9, 0x72e0, 0x72e1, 0x73b7, 0x73ca, 0x73bb, + 0x73b2, 0x73cd, 0x73c0, 0x73b3, 0x751a, 0x752d, 0x754f, 0x754c, + 0x754e, 0x754b, 0x75ab, 0x75a4, 0x75a5, 0x75a2, 0x75a3, 0x7678, + 0x7686, 0x7687, 0x7688, 0x76c8, 0x76c6, 0x76c3, 0x76c5, 0x7701, + 0x76f9, 0x76f8, 0x7709, 0x770b, 0x76fe, 0x76fc, 0x7707, 0x77dc, + 0x7802, 0x7814, 0x780c, 0x780d, 0x7946, 0x7949, 0x7948, 0x7947, + 0x79b9, 0x79ba, 0x79d1, 0x79d2, 0x79cb, 0x7a7f, 0x7a81, 0x7aff, + 0x7afd, 0x7c7d, 0x7d02, 0x7d05, 0x7d00, 0x7d09, 0x7d07, 0x7d04, + 0x7d06, 0x7f38, 0x7f8e, 0x7fbf, 0x8004, + /* 0xad */ + 0x8010, 0x800d, 0x8011, 0x8036, 0x80d6, 0x80e5, 0x80da, 0x80c3, + 0x80c4, 0x80cc, 0x80e1, 0x80db, 0x80ce, 0x80de, 0x80e4, 0x80dd, + 0x81f4, 0x8222, 0x82e7, 0x8303, 0x8305, 0x82e3, 0x82db, 0x82e6, + 0x8304, 0x82e5, 0x8302, 0x8309, 0x82d2, 0x82d7, 0x82f1, 0x8301, + 0x82dc, 0x82d4, 0x82d1, 0x82de, 0x82d3, 0x82df, 0x82ef, 0x8306, + 0x8650, 0x8679, 0x867b, 0x867a, 0x884d, 0x886b, 0x8981, 0x89d4, + 0x8a08, 0x8a02, 0x8a03, 0x8c9e, 0x8ca0, 0x8d74, 0x8d73, 0x8db4, + 0x8ecd, 0x8ecc, 0x8ff0, 0x8fe6, 0x8fe2, 0x8fea, 0x8fe5, 0x8fed, + 0x8feb, 0x8fe4, 0x8fe8, 0x90ca, 0x90ce, 0x90c1, 0x90c3, 0x914b, + 0x914a, 0x91cd, 0x9582, 0x9650, 0x964b, 0x964c, 0x964d, 0x9762, + 0x9769, 0x97cb, 0x97ed, 0x97f3, 0x9801, 0x98a8, 0x98db, 0x98df, + 0x9996, 0x9999, 0x4e58, 0x4eb3, 0x500c, 0x500d, 0x5023, 0x4fef, + 0x5026, 0x5025, 0x4ff8, 0x5029, 0x5016, 0x5006, 0x503c, 0x501f, + 0x501a, 0x5012, 0x5011, 0x4ffa, 0x5000, 0x5014, 0x5028, 0x4ff1, + 0x5021, 0x500b, 0x5019, 0x5018, 0x4ff3, 0x4fee, 0x502d, 0x502a, + 0x4ffe, 0x502b, 0x5009, 0x517c, 0x51a4, 0x51a5, 0x51a2, 0x51cd, + 0x51cc, 0x51c6, 0x51cb, 0x5256, 0x525c, 0x5254, 0x525b, 0x525d, + 0x532a, 0x537f, 0x539f, 0x539d, 0x53df, 0x54e8, 0x5510, 0x5501, + 0x5537, 0x54fc, 0x54e5, 0x54f2, 0x5506, 0x54fa, 0x5514, 0x54e9, + 0x54ed, 0x54e1, 0x5509, 0x54ee, 0x54ea, + /* 0xae */ + 0x54e6, 0x5527, 0x5507, 0x54fd, 0x550f, 0x5703, 0x5704, 0x57c2, + 0x57d4, 0x57cb, 0x57c3, 0x5809, 0x590f, 0x5957, 0x5958, 0x595a, + 0x5a11, 0x5a18, 0x5a1c, 0x5a1f, 0x5a1b, 0x5a13, 0x59ec, 0x5a20, + 0x5a23, 0x5a29, 0x5a25, 0x5a0c, 0x5a09, 0x5b6b, 0x5c58, 0x5bb0, + 0x5bb3, 0x5bb6, 0x5bb4, 0x5bae, 0x5bb5, 0x5bb9, 0x5bb8, 0x5c04, + 0x5c51, 0x5c55, 0x5c50, 0x5ced, 0x5cfd, 0x5cfb, 0x5cea, 0x5ce8, + 0x5cf0, 0x5cf6, 0x5d01, 0x5cf4, 0x5dee, 0x5e2d, 0x5e2b, 0x5eab, + 0x5ead, 0x5ea7, 0x5f31, 0x5f92, 0x5f91, 0x5f90, 0x6059, 0x6063, + 0x6065, 0x6050, 0x6055, 0x606d, 0x6069, 0x606f, 0x6084, 0x609f, + 0x609a, 0x608d, 0x6094, 0x608c, 0x6085, 0x6096, 0x6247, 0x62f3, + 0x6308, 0x62ff, 0x634e, 0x633e, 0x632f, 0x6355, 0x6342, 0x6346, + 0x634f, 0x6349, 0x633a, 0x6350, 0x633d, 0x632a, 0x632b, 0x6328, + 0x634d, 0x634c, 0x6548, 0x6549, 0x6599, 0x65c1, 0x65c5, 0x6642, + 0x6649, 0x664f, 0x6643, 0x6652, 0x664c, 0x6645, 0x6641, 0x66f8, + 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, 0x6846, 0x6853, + 0x6839, 0x6842, 0x6854, 0x6829, 0x68b3, 0x6817, 0x684c, 0x6851, + 0x683d, 0x67f4, 0x6850, 0x6840, 0x683c, 0x6843, 0x682a, 0x6845, + 0x6813, 0x6818, 0x6841, 0x6b8a, 0x6b89, 0x6bb7, 0x6c23, 0x6c27, + 0x6c28, 0x6c26, 0x6c24, 0x6cf0, 0x6d6a, 0x6d95, 0x6d88, 0x6d87, + 0x6d66, 0x6d78, 0x6d77, 0x6d59, 0x6d93, + /* 0xaf */ + 0x6d6c, 0x6d89, 0x6d6e, 0x6d5a, 0x6d74, 0x6d69, 0x6d8c, 0x6d8a, + 0x6d79, 0x6d85, 0x6d65, 0x6d94, 0x70ca, 0x70d8, 0x70e4, 0x70d9, + 0x70c8, 0x70cf, 0x7239, 0x7279, 0x72fc, 0x72f9, 0x72fd, 0x72f8, + 0x72f7, 0x7386, 0x73ed, 0x7409, 0x73ee, 0x73e0, 0x73ea, 0x73de, + 0x7554, 0x755d, 0x755c, 0x755a, 0x7559, 0x75be, 0x75c5, 0x75c7, + 0x75b2, 0x75b3, 0x75bd, 0x75bc, 0x75b9, 0x75c2, 0x75b8, 0x768b, + 0x76b0, 0x76ca, 0x76cd, 0x76ce, 0x7729, 0x771f, 0x7720, 0x7728, + 0x77e9, 0x7830, 0x7827, 0x7838, 0x781d, 0x7834, 0x7837, 0x7825, + 0x782d, 0x7820, 0x781f, 0x7832, 0x7955, 0x7950, 0x7960, 0x795f, + 0x7956, 0x795e, 0x795d, 0x7957, 0x795a, 0x79e4, 0x79e3, 0x79e7, + 0x79df, 0x79e6, 0x79e9, 0x79d8, 0x7a84, 0x7a88, 0x7ad9, 0x7b06, + 0x7b11, 0x7c89, 0x7d21, 0x7d17, 0x7d0b, 0x7d0a, 0x7d20, 0x7d22, + 0x7d14, 0x7d10, 0x7d15, 0x7d1a, 0x7d1c, 0x7d0d, 0x7d19, 0x7d1b, + 0x7f3a, 0x7f5f, 0x7f94, 0x7fc5, 0x7fc1, 0x8006, 0x8018, 0x8015, + 0x8019, 0x8017, 0x803d, 0x803f, 0x80f1, 0x8102, 0x80f0, 0x8105, + 0x80ed, 0x80f4, 0x8106, 0x80f8, 0x80f3, 0x8108, 0x80fd, 0x810a, + 0x80fc, 0x80ef, 0x81ed, 0x81ec, 0x8200, 0x8210, 0x822a, 0x822b, + 0x8228, 0x822c, 0x82bb, 0x832b, 0x8352, 0x8354, 0x834a, 0x8338, + 0x8350, 0x8349, 0x8335, 0x8334, 0x834f, 0x8332, 0x8339, 0x8336, + 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, + /* 0xb0 */ + 0x8654, 0x868a, 0x86aa, 0x8693, 0x86a4, 0x86a9, 0x868c, 0x86a3, + 0x869c, 0x8870, 0x8877, 0x8881, 0x8882, 0x887d, 0x8879, 0x8a18, + 0x8a10, 0x8a0e, 0x8a0c, 0x8a15, 0x8a0a, 0x8a17, 0x8a13, 0x8a16, + 0x8a0f, 0x8a11, 0x8c48, 0x8c7a, 0x8c79, 0x8ca1, 0x8ca2, 0x8d77, + 0x8eac, 0x8ed2, 0x8ed4, 0x8ecf, 0x8fb1, 0x9001, 0x9006, 0x8ff7, + 0x9000, 0x8ffa, 0x8ff4, 0x9003, 0x8ffd, 0x9005, 0x8ff8, 0x9095, + 0x90e1, 0x90dd, 0x90e2, 0x9152, 0x914d, 0x914c, 0x91d8, 0x91dd, + 0x91d7, 0x91dc, 0x91d9, 0x9583, 0x9662, 0x9663, 0x9661, 0x965b, + 0x965d, 0x9664, 0x9658, 0x965e, 0x96bb, 0x98e2, 0x99ac, 0x9aa8, + 0x9ad8, 0x9b25, 0x9b32, 0x9b3c, 0x4e7e, 0x507a, 0x507d, 0x505c, + 0x5047, 0x5043, 0x504c, 0x505a, 0x5049, 0x5065, 0x5076, 0x504e, + 0x5055, 0x5075, 0x5074, 0x5077, 0x504f, 0x500f, 0x506f, 0x506d, + 0x515c, 0x5195, 0x51f0, 0x526a, 0x526f, 0x52d2, 0x52d9, 0x52d8, + 0x52d5, 0x5310, 0x530f, 0x5319, 0x533f, 0x5340, 0x533e, 0x53c3, + 0x66fc, 0x5546, 0x556a, 0x5566, 0x5544, 0x555e, 0x5561, 0x5543, + 0x554a, 0x5531, 0x5556, 0x554f, 0x5555, 0x552f, 0x5564, 0x5538, + 0x552e, 0x555c, 0x552c, 0x5563, 0x5533, 0x5541, 0x5557, 0x5708, + 0x570b, 0x5709, 0x57df, 0x5805, 0x580a, 0x5806, 0x57e0, 0x57e4, + 0x57fa, 0x5802, 0x5835, 0x57f7, 0x57f9, 0x5920, 0x5962, 0x5a36, + 0x5a41, 0x5a49, 0x5a66, 0x5a6a, 0x5a40, + /* 0xb1 */ + 0x5a3c, 0x5a62, 0x5a5a, 0x5a46, 0x5a4a, 0x5b70, 0x5bc7, 0x5bc5, + 0x5bc4, 0x5bc2, 0x5bbf, 0x5bc6, 0x5c09, 0x5c08, 0x5c07, 0x5c60, + 0x5c5c, 0x5c5d, 0x5d07, 0x5d06, 0x5d0e, 0x5d1b, 0x5d16, 0x5d22, + 0x5d11, 0x5d29, 0x5d14, 0x5d19, 0x5d24, 0x5d27, 0x5d17, 0x5de2, + 0x5e38, 0x5e36, 0x5e33, 0x5e37, 0x5eb7, 0x5eb8, 0x5eb6, 0x5eb5, + 0x5ebe, 0x5f35, 0x5f37, 0x5f57, 0x5f6c, 0x5f69, 0x5f6b, 0x5f97, + 0x5f99, 0x5f9e, 0x5f98, 0x5fa1, 0x5fa0, 0x5f9c, 0x607f, 0x60a3, + 0x6089, 0x60a0, 0x60a8, 0x60cb, 0x60b4, 0x60e6, 0x60bd, 0x60c5, + 0x60bb, 0x60b5, 0x60dc, 0x60bc, 0x60d8, 0x60d5, 0x60c6, 0x60df, + 0x60b8, 0x60da, 0x60c7, 0x621a, 0x621b, 0x6248, 0x63a0, 0x63a7, + 0x6372, 0x6396, 0x63a2, 0x63a5, 0x6377, 0x6367, 0x6398, 0x63aa, + 0x6371, 0x63a9, 0x6389, 0x6383, 0x639b, 0x636b, 0x63a8, 0x6384, + 0x6388, 0x6399, 0x63a1, 0x63ac, 0x6392, 0x638f, 0x6380, 0x637b, + 0x6369, 0x6368, 0x637a, 0x655d, 0x6556, 0x6551, 0x6559, 0x6557, + 0x555f, 0x654f, 0x6558, 0x6555, 0x6554, 0x659c, 0x659b, 0x65ac, + 0x65cf, 0x65cb, 0x65cc, 0x65ce, 0x665d, 0x665a, 0x6664, 0x6668, + 0x6666, 0x665e, 0x66f9, 0x52d7, 0x671b, 0x6881, 0x68af, 0x68a2, + 0x6893, 0x68b5, 0x687f, 0x6876, 0x68b1, 0x68a7, 0x6897, 0x68b0, + 0x6883, 0x68c4, 0x68ad, 0x6886, 0x6885, 0x6894, 0x689d, 0x68a8, + 0x689f, 0x68a1, 0x6882, 0x6b32, 0x6bba, + /* 0xb2 */ + 0x6beb, 0x6bec, 0x6c2b, 0x6d8e, 0x6dbc, 0x6df3, 0x6dd9, 0x6db2, + 0x6de1, 0x6dcc, 0x6de4, 0x6dfb, 0x6dfa, 0x6e05, 0x6dc7, 0x6dcb, + 0x6daf, 0x6dd1, 0x6dae, 0x6dde, 0x6df9, 0x6db8, 0x6df7, 0x6df5, + 0x6dc5, 0x6dd2, 0x6e1a, 0x6db5, 0x6dda, 0x6deb, 0x6dd8, 0x6dea, + 0x6df1, 0x6dee, 0x6de8, 0x6dc6, 0x6dc4, 0x6daa, 0x6dec, 0x6dbf, + 0x6de6, 0x70f9, 0x7109, 0x710a, 0x70fd, 0x70ef, 0x723d, 0x727d, + 0x7281, 0x731c, 0x731b, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, + 0x740a, 0x7403, 0x7406, 0x73fe, 0x740d, 0x74e0, 0x74f6, 0x74f7, + 0x751c, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, 0x758f, 0x75d4, + 0x75d5, 0x75b5, 0x75ca, 0x75cd, 0x768e, 0x76d4, 0x76d2, 0x76db, + 0x7737, 0x773e, 0x773c, 0x7736, 0x7738, 0x773a, 0x786b, 0x7843, + 0x784e, 0x7965, 0x7968, 0x796d, 0x79fb, 0x7a92, 0x7a95, 0x7b20, + 0x7b28, 0x7b1b, 0x7b2c, 0x7b26, 0x7b19, 0x7b1e, 0x7b2e, 0x7c92, + 0x7c97, 0x7c95, 0x7d46, 0x7d43, 0x7d71, 0x7d2e, 0x7d39, 0x7d3c, + 0x7d40, 0x7d30, 0x7d33, 0x7d44, 0x7d2f, 0x7d42, 0x7d32, 0x7d31, + 0x7f3d, 0x7f9e, 0x7f9a, 0x7fcc, 0x7fce, 0x7fd2, 0x801c, 0x804a, + 0x8046, 0x812f, 0x8116, 0x8123, 0x812b, 0x8129, 0x8130, 0x8124, + 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838e, 0x839e, 0x8398, + 0x8378, 0x83a2, 0x8396, 0x83bd, 0x83ab, 0x8392, 0x838a, 0x8393, + 0x8389, 0x83a0, 0x8377, 0x837b, 0x837c, + /* 0xb3 */ + 0x8386, 0x83a7, 0x8655, 0x5f6a, 0x86c7, 0x86c0, 0x86b6, 0x86c4, + 0x86b5, 0x86c6, 0x86cb, 0x86b1, 0x86af, 0x86c9, 0x8853, 0x889e, + 0x8888, 0x88ab, 0x8892, 0x8896, 0x888d, 0x888b, 0x8993, 0x898f, + 0x8a2a, 0x8a1d, 0x8a23, 0x8a25, 0x8a31, 0x8a2d, 0x8a1f, 0x8a1b, + 0x8a22, 0x8c49, 0x8c5a, 0x8ca9, 0x8cac, 0x8cab, 0x8ca8, 0x8caa, + 0x8ca7, 0x8d67, 0x8d66, 0x8dbe, 0x8dba, 0x8edb, 0x8edf, 0x9019, + 0x900d, 0x901a, 0x9017, 0x9023, 0x901f, 0x901d, 0x9010, 0x9015, + 0x901e, 0x9020, 0x900f, 0x9022, 0x9016, 0x901b, 0x9014, 0x90e8, + 0x90ed, 0x90fd, 0x9157, 0x91ce, 0x91f5, 0x91e6, 0x91e3, 0x91e7, + 0x91ed, 0x91e9, 0x9589, 0x966a, 0x9675, 0x9673, 0x9678, 0x9670, + 0x9674, 0x9676, 0x9677, 0x966c, 0x96c0, 0x96ea, 0x96e9, 0x7ae0, + 0x7adf, 0x9802, 0x9803, 0x9b5a, 0x9ce5, 0x9e75, 0x9e7f, 0x9ea5, + 0x9ebb, 0x50a2, 0x508d, 0x5085, 0x5099, 0x5091, 0x5080, 0x5096, + 0x5098, 0x509a, 0x6700, 0x51f1, 0x5272, 0x5274, 0x5275, 0x5269, + 0x52de, 0x52dd, 0x52db, 0x535a, 0x53a5, 0x557b, 0x5580, 0x55a7, + 0x557c, 0x558a, 0x559d, 0x5598, 0x5582, 0x559c, 0x55aa, 0x5594, + 0x5587, 0x558b, 0x5583, 0x55b3, 0x55ae, 0x559f, 0x553e, 0x55b2, + 0x559a, 0x55bb, 0x55ac, 0x55b1, 0x557e, 0x5589, 0x55ab, 0x5599, + 0x570d, 0x582f, 0x582a, 0x5834, 0x5824, 0x5830, 0x5831, 0x5821, + 0x581d, 0x5820, 0x58f9, 0x58fa, 0x5960, + /* 0xb4 */ + 0x5a77, 0x5a9a, 0x5a7f, 0x5a92, 0x5a9b, 0x5aa7, 0x5b73, 0x5b71, + 0x5bd2, 0x5bcc, 0x5bd3, 0x5bd0, 0x5c0a, 0x5c0b, 0x5c31, 0x5d4c, + 0x5d50, 0x5d34, 0x5d47, 0x5dfd, 0x5e45, 0x5e3d, 0x5e40, 0x5e43, + 0x5e7e, 0x5eca, 0x5ec1, 0x5ec2, 0x5ec4, 0x5f3c, 0x5f6d, 0x5fa9, + 0x5faa, 0x5fa8, 0x60d1, 0x60e1, 0x60b2, 0x60b6, 0x60e0, 0x611c, + 0x6123, 0x60fa, 0x6115, 0x60f0, 0x60fb, 0x60f4, 0x6168, 0x60f1, + 0x610e, 0x60f6, 0x6109, 0x6100, 0x6112, 0x621f, 0x6249, 0x63a3, + 0x638c, 0x63cf, 0x63c0, 0x63e9, 0x63c9, 0x63c6, 0x63cd, 0x63d2, + 0x63e3, 0x63d0, 0x63e1, 0x63d6, 0x63ed, 0x63ee, 0x6376, 0x63f4, + 0x63ea, 0x63db, 0x6452, 0x63da, 0x63f9, 0x655e, 0x6566, 0x6562, + 0x6563, 0x6591, 0x6590, 0x65af, 0x666e, 0x6670, 0x6674, 0x6676, + 0x666f, 0x6691, 0x667a, 0x667e, 0x6677, 0x66fe, 0x66ff, 0x671f, + 0x671d, 0x68fa, 0x68d5, 0x68e0, 0x68d8, 0x68d7, 0x6905, 0x68df, + 0x68f5, 0x68ee, 0x68e7, 0x68f9, 0x68d2, 0x68f2, 0x68e3, 0x68cb, + 0x68cd, 0x690d, 0x6912, 0x690e, 0x68c9, 0x68da, 0x696e, 0x68fb, + 0x6b3e, 0x6b3a, 0x6b3d, 0x6b98, 0x6b96, 0x6bbc, 0x6bef, 0x6c2e, + 0x6c2f, 0x6c2c, 0x6e2f, 0x6e38, 0x6e54, 0x6e21, 0x6e32, 0x6e67, + 0x6e4a, 0x6e20, 0x6e25, 0x6e23, 0x6e1b, 0x6e5b, 0x6e58, 0x6e24, + 0x6e56, 0x6e6e, 0x6e2d, 0x6e26, 0x6e6f, 0x6e34, 0x6e4d, 0x6e3a, + 0x6e2c, 0x6e43, 0x6e1d, 0x6e3e, 0x6ecb, + /* 0xb5 */ + 0x6e89, 0x6e19, 0x6e4e, 0x6e63, 0x6e44, 0x6e72, 0x6e69, 0x6e5f, + 0x7119, 0x711a, 0x7126, 0x7130, 0x7121, 0x7136, 0x716e, 0x711c, + 0x724c, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743a, + 0x742a, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742f, + 0x741b, 0x7426, 0x7428, 0x7525, 0x7526, 0x756b, 0x756a, 0x75e2, + 0x75db, 0x75e3, 0x75d9, 0x75d8, 0x75de, 0x75e0, 0x767b, 0x767c, + 0x7696, 0x7693, 0x76b4, 0x76dc, 0x774f, 0x77ed, 0x785d, 0x786c, + 0x786f, 0x7a0d, 0x7a08, 0x7a0b, 0x7a05, 0x7a00, 0x7a98, 0x7a97, + 0x7a96, 0x7ae5, 0x7ae3, 0x7b49, 0x7b56, 0x7b46, 0x7b50, 0x7b52, + 0x7b54, 0x7b4d, 0x7b4b, 0x7b4f, 0x7b51, 0x7c9f, 0x7ca5, 0x7d5e, + 0x7d50, 0x7d68, 0x7d55, 0x7d2b, 0x7d6e, 0x7d72, 0x7d61, 0x7d66, + 0x7d62, 0x7d70, 0x7d73, 0x5584, 0x7fd4, 0x7fd5, 0x800b, 0x8052, + 0x8085, 0x8155, 0x8154, 0x814b, 0x8151, 0x814e, 0x8139, 0x8146, + 0x813e, 0x814c, 0x8153, 0x8174, 0x8212, 0x821c, 0x83e9, 0x8403, + 0x83f8, 0x840d, 0x83e0, 0x83c5, 0x840b, 0x83c1, 0x83ef, 0x83f1, + 0x83f4, 0x8457, 0x840a, 0x83f0, 0x840c, 0x83cc, 0x83fd, 0x83f2, + 0x83ca, 0x8438, 0x840e, 0x8404, 0x83dc, 0x8407, 0x83d4, 0x83df, + 0x865b, 0x86df, 0x86d9, 0x86ed, 0x86d4, 0x86db, 0x86e4, 0x86d0, + 0x86de, 0x8857, 0x88c1, 0x88c2, 0x88b1, 0x8983, 0x8996, 0x8a3b, + 0x8a60, 0x8a55, 0x8a5e, 0x8a3c, 0x8a41, + /* 0xb6 */ + 0x8a54, 0x8a5b, 0x8a50, 0x8a46, 0x8a34, 0x8a3a, 0x8a36, 0x8a56, + 0x8c61, 0x8c82, 0x8caf, 0x8cbc, 0x8cb3, 0x8cbd, 0x8cc1, 0x8cbb, + 0x8cc0, 0x8cb4, 0x8cb7, 0x8cb6, 0x8cbf, 0x8cb8, 0x8d8a, 0x8d85, + 0x8d81, 0x8dce, 0x8ddd, 0x8dcb, 0x8dda, 0x8dd1, 0x8dcc, 0x8ddb, + 0x8dc6, 0x8efb, 0x8ef8, 0x8efc, 0x8f9c, 0x902e, 0x9035, 0x9031, + 0x9038, 0x9032, 0x9036, 0x9102, 0x90f5, 0x9109, 0x90fe, 0x9163, + 0x9165, 0x91cf, 0x9214, 0x9215, 0x9223, 0x9209, 0x921e, 0x920d, + 0x9210, 0x9207, 0x9211, 0x9594, 0x958f, 0x958b, 0x9591, 0x9593, + 0x9592, 0x958e, 0x968a, 0x968e, 0x968b, 0x967d, 0x9685, 0x9686, + 0x968d, 0x9672, 0x9684, 0x96c1, 0x96c5, 0x96c4, 0x96c6, 0x96c7, + 0x96ef, 0x96f2, 0x97cc, 0x9805, 0x9806, 0x9808, 0x98e7, 0x98ea, + 0x98ef, 0x98e9, 0x98f2, 0x98ed, 0x99ae, 0x99ad, 0x9ec3, 0x9ecd, + 0x9ed1, 0x4e82, 0x50ad, 0x50b5, 0x50b2, 0x50b3, 0x50c5, 0x50be, + 0x50ac, 0x50b7, 0x50bb, 0x50af, 0x50c7, 0x527f, 0x5277, 0x527d, + 0x52df, 0x52e6, 0x52e4, 0x52e2, 0x52e3, 0x532f, 0x55df, 0x55e8, + 0x55d3, 0x55e6, 0x55ce, 0x55dc, 0x55c7, 0x55d1, 0x55e3, 0x55e4, + 0x55ef, 0x55da, 0x55e1, 0x55c5, 0x55c6, 0x55e5, 0x55c9, 0x5712, + 0x5713, 0x585e, 0x5851, 0x5858, 0x5857, 0x585a, 0x5854, 0x586b, + 0x584c, 0x586d, 0x584a, 0x5862, 0x5852, 0x584b, 0x5967, 0x5ac1, + 0x5ac9, 0x5acc, 0x5abe, 0x5abd, 0x5abc, + /* 0xb7 */ + 0x5ab3, 0x5ac2, 0x5ab2, 0x5d69, 0x5d6f, 0x5e4c, 0x5e79, 0x5ec9, + 0x5ec8, 0x5f12, 0x5f59, 0x5fac, 0x5fae, 0x611a, 0x610f, 0x6148, + 0x611f, 0x60f3, 0x611b, 0x60f9, 0x6101, 0x6108, 0x614e, 0x614c, + 0x6144, 0x614d, 0x613e, 0x6134, 0x6127, 0x610d, 0x6106, 0x6137, + 0x6221, 0x6222, 0x6413, 0x643e, 0x641e, 0x642a, 0x642d, 0x643d, + 0x642c, 0x640f, 0x641c, 0x6414, 0x640d, 0x6436, 0x6416, 0x6417, + 0x6406, 0x656c, 0x659f, 0x65b0, 0x6697, 0x6689, 0x6687, 0x6688, + 0x6696, 0x6684, 0x6698, 0x668d, 0x6703, 0x6994, 0x696d, 0x695a, + 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, 0x694a, 0x6968, + 0x696b, 0x695e, 0x6953, 0x6979, 0x6986, 0x695d, 0x6963, 0x695b, + 0x6b47, 0x6b72, 0x6bc0, 0x6bbf, 0x6bd3, 0x6bfd, 0x6ea2, 0x6eaf, + 0x6ed3, 0x6eb6, 0x6ec2, 0x6e90, 0x6e9d, 0x6ec7, 0x6ec5, 0x6ea5, + 0x6e98, 0x6ebc, 0x6eba, 0x6eab, 0x6ed1, 0x6e96, 0x6e9c, 0x6ec4, + 0x6ed4, 0x6eaa, 0x6ea7, 0x6eb4, 0x714e, 0x7159, 0x7169, 0x7164, + 0x7149, 0x7167, 0x715c, 0x716c, 0x7166, 0x714c, 0x7165, 0x715e, + 0x7146, 0x7168, 0x7156, 0x723a, 0x7252, 0x7337, 0x7345, 0x733f, + 0x733e, 0x746f, 0x745a, 0x7455, 0x745f, 0x745e, 0x7441, 0x743f, + 0x7459, 0x745b, 0x745c, 0x7576, 0x7578, 0x7600, 0x75f0, 0x7601, + 0x75f2, 0x75f1, 0x75fa, 0x75ff, 0x75f4, 0x75f3, 0x76de, 0x76df, + 0x775b, 0x776b, 0x7766, 0x775e, 0x7763, + /* 0xb8 */ + 0x7779, 0x776a, 0x776c, 0x775c, 0x7765, 0x7768, 0x7762, 0x77ee, + 0x788e, 0x78b0, 0x7897, 0x7898, 0x788c, 0x7889, 0x787c, 0x7891, + 0x7893, 0x787f, 0x797a, 0x797f, 0x7981, 0x842c, 0x79bd, 0x7a1c, + 0x7a1a, 0x7a20, 0x7a14, 0x7a1f, 0x7a1e, 0x7a9f, 0x7aa0, 0x7b77, + 0x7bc0, 0x7b60, 0x7b6e, 0x7b67, 0x7cb1, 0x7cb3, 0x7cb5, 0x7d93, + 0x7d79, 0x7d91, 0x7d81, 0x7d8f, 0x7d5b, 0x7f6e, 0x7f69, 0x7f6a, + 0x7f72, 0x7fa9, 0x7fa8, 0x7fa4, 0x8056, 0x8058, 0x8086, 0x8084, + 0x8171, 0x8170, 0x8178, 0x8165, 0x816e, 0x8173, 0x816b, 0x8179, + 0x817a, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, 0x843d, 0x8431, + 0x8475, 0x8466, 0x846b, 0x8449, 0x846c, 0x845b, 0x843c, 0x8435, + 0x8461, 0x8463, 0x8469, 0x846d, 0x8446, 0x865e, 0x865c, 0x865f, + 0x86f9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86fe, 0x86fb, 0x8702, + 0x8703, 0x8706, 0x870a, 0x8859, 0x88df, 0x88d4, 0x88d9, 0x88dc, + 0x88d8, 0x88dd, 0x88e1, 0x88ca, 0x88d5, 0x88d2, 0x899c, 0x89e3, + 0x8a6b, 0x8a72, 0x8a73, 0x8a66, 0x8a69, 0x8a70, 0x8a87, 0x8a7c, + 0x8a63, 0x8aa0, 0x8a71, 0x8a85, 0x8a6d, 0x8a62, 0x8a6e, 0x8a6c, + 0x8a79, 0x8a7b, 0x8a3e, 0x8a68, 0x8c62, 0x8c8a, 0x8c89, 0x8cca, + 0x8cc7, 0x8cc8, 0x8cc4, 0x8cb2, 0x8cc3, 0x8cc2, 0x8cc5, 0x8de1, + 0x8ddf, 0x8de8, 0x8def, 0x8df3, 0x8dfa, 0x8dea, 0x8de4, 0x8de6, + 0x8eb2, 0x8f03, 0x8f09, 0x8efe, 0x8f0a, + /* 0xb9 */ + 0x8f9f, 0x8fb2, 0x904b, 0x904a, 0x9053, 0x9042, 0x9054, 0x903c, + 0x9055, 0x9050, 0x9047, 0x904f, 0x904e, 0x904d, 0x9051, 0x903e, + 0x9041, 0x9112, 0x9117, 0x916c, 0x916a, 0x9169, 0x91c9, 0x9237, + 0x9257, 0x9238, 0x923d, 0x9240, 0x923e, 0x925b, 0x924b, 0x9264, + 0x9251, 0x9234, 0x9249, 0x924d, 0x9245, 0x9239, 0x923f, 0x925a, + 0x9598, 0x9698, 0x9694, 0x9695, 0x96cd, 0x96cb, 0x96c9, 0x96ca, + 0x96f7, 0x96fb, 0x96f9, 0x96f6, 0x9756, 0x9774, 0x9776, 0x9810, + 0x9811, 0x9813, 0x980a, 0x9812, 0x980c, 0x98fc, 0x98f4, 0x98fd, + 0x98fe, 0x99b3, 0x99b1, 0x99b4, 0x9ae1, 0x9ce9, 0x9e82, 0x9f0e, + 0x9f13, 0x9f20, 0x50e7, 0x50ee, 0x50e5, 0x50d6, 0x50ed, 0x50da, + 0x50d5, 0x50cf, 0x50d1, 0x50f1, 0x50ce, 0x50e9, 0x5162, 0x51f3, + 0x5283, 0x5282, 0x5331, 0x53ad, 0x55fe, 0x5600, 0x561b, 0x5617, + 0x55fd, 0x5614, 0x5606, 0x5609, 0x560d, 0x560e, 0x55f7, 0x5616, + 0x561f, 0x5608, 0x5610, 0x55f6, 0x5718, 0x5716, 0x5875, 0x587e, + 0x5883, 0x5893, 0x588a, 0x5879, 0x5885, 0x587d, 0x58fd, 0x5925, + 0x5922, 0x5924, 0x596a, 0x5969, 0x5ae1, 0x5ae6, 0x5ae9, 0x5ad7, + 0x5ad6, 0x5ad8, 0x5ae3, 0x5b75, 0x5bde, 0x5be7, 0x5be1, 0x5be5, + 0x5be6, 0x5be8, 0x5be2, 0x5be4, 0x5bdf, 0x5c0d, 0x5c62, 0x5d84, + 0x5d87, 0x5e5b, 0x5e63, 0x5e55, 0x5e57, 0x5e54, 0x5ed3, 0x5ed6, + 0x5f0a, 0x5f46, 0x5f70, 0x5fb9, 0x6147, + /* 0xba */ + 0x613f, 0x614b, 0x6177, 0x6162, 0x6163, 0x615f, 0x615a, 0x6158, + 0x6175, 0x622a, 0x6487, 0x6458, 0x6454, 0x64a4, 0x6478, 0x645f, + 0x647a, 0x6451, 0x6467, 0x6434, 0x646d, 0x647b, 0x6572, 0x65a1, + 0x65d7, 0x65d6, 0x66a2, 0x66a8, 0x669d, 0x699c, 0x69a8, 0x6995, + 0x69c1, 0x69ae, 0x69d3, 0x69cb, 0x699b, 0x69b7, 0x69bb, 0x69ab, + 0x69b4, 0x69d0, 0x69cd, 0x69ad, 0x69cc, 0x69a6, 0x69c3, 0x69a3, + 0x6b49, 0x6b4c, 0x6c33, 0x6f33, 0x6f14, 0x6efe, 0x6f13, 0x6ef4, + 0x6f29, 0x6f3e, 0x6f20, 0x6f2c, 0x6f0f, 0x6f02, 0x6f22, 0x6eff, + 0x6eef, 0x6f06, 0x6f31, 0x6f38, 0x6f32, 0x6f23, 0x6f15, 0x6f2b, + 0x6f2f, 0x6f88, 0x6f2a, 0x6eec, 0x6f01, 0x6ef2, 0x6ecc, 0x6ef7, + 0x7194, 0x7199, 0x717d, 0x718a, 0x7184, 0x7192, 0x723e, 0x7292, + 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746a, 0x7470, 0x746d, + 0x7504, 0x7591, 0x7627, 0x760d, 0x760b, 0x7609, 0x7613, 0x76e1, + 0x76e3, 0x7784, 0x777d, 0x777f, 0x7761, 0x78c1, 0x789f, 0x78a7, + 0x78b3, 0x78a9, 0x78a3, 0x798e, 0x798f, 0x798d, 0x7a2e, 0x7a31, + 0x7aaa, 0x7aa9, 0x7aed, 0x7aef, 0x7ba1, 0x7b95, 0x7b8b, 0x7b75, + 0x7b97, 0x7b9d, 0x7b94, 0x7b8f, 0x7bb8, 0x7b87, 0x7b84, 0x7cb9, + 0x7cbd, 0x7cbe, 0x7dbb, 0x7db0, 0x7d9c, 0x7dbd, 0x7dbe, 0x7da0, + 0x7dca, 0x7db4, 0x7db2, 0x7db1, 0x7dba, 0x7da2, 0x7dbf, 0x7db5, + 0x7db8, 0x7dad, 0x7dd2, 0x7dc7, 0x7dac, + /* 0xbb */ + 0x7f70, 0x7fe0, 0x7fe1, 0x7fdf, 0x805e, 0x805a, 0x8087, 0x8150, + 0x8180, 0x818f, 0x8188, 0x818a, 0x817f, 0x8182, 0x81e7, 0x81fa, + 0x8207, 0x8214, 0x821e, 0x824b, 0x84c9, 0x84bf, 0x84c6, 0x84c4, + 0x8499, 0x849e, 0x84b2, 0x849c, 0x84cb, 0x84b8, 0x84c0, 0x84d3, + 0x8490, 0x84bc, 0x84d1, 0x84ca, 0x873f, 0x871c, 0x873b, 0x8722, + 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88f3, 0x8902, + 0x88f4, 0x88f9, 0x88f8, 0x88fd, 0x88e8, 0x891a, 0x88ef, 0x8aa6, + 0x8a8c, 0x8a9e, 0x8aa3, 0x8a8d, 0x8aa1, 0x8a93, 0x8aa4, 0x8aaa, + 0x8aa5, 0x8aa8, 0x8a98, 0x8a91, 0x8a9a, 0x8aa7, 0x8c6a, 0x8c8d, + 0x8c8c, 0x8cd3, 0x8cd1, 0x8cd2, 0x8d6b, 0x8d99, 0x8d95, 0x8dfc, + 0x8f14, 0x8f12, 0x8f15, 0x8f13, 0x8fa3, 0x9060, 0x9058, 0x905c, + 0x9063, 0x9059, 0x905e, 0x9062, 0x905d, 0x905b, 0x9119, 0x9118, + 0x911e, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, 0x9280, 0x9285, + 0x9298, 0x9296, 0x927b, 0x9293, 0x929c, 0x92a8, 0x927c, 0x9291, + 0x95a1, 0x95a8, 0x95a9, 0x95a3, 0x95a5, 0x95a4, 0x9699, 0x969c, + 0x969b, 0x96cc, 0x96d2, 0x9700, 0x977c, 0x9785, 0x97f6, 0x9817, + 0x9818, 0x98af, 0x98b1, 0x9903, 0x9905, 0x990c, 0x9909, 0x99c1, + 0x9aaf, 0x9ab0, 0x9ae6, 0x9b41, 0x9b42, 0x9cf4, 0x9cf6, 0x9cf3, + 0x9ebc, 0x9f3b, 0x9f4a, 0x5104, 0x5100, 0x50fb, 0x50f5, 0x50f9, + 0x5102, 0x5108, 0x5109, 0x5105, 0x51dc, + /* 0xbc */ + 0x5287, 0x5288, 0x5289, 0x528d, 0x528a, 0x52f0, 0x53b2, 0x562e, + 0x563b, 0x5639, 0x5632, 0x563f, 0x5634, 0x5629, 0x5653, 0x564e, + 0x5657, 0x5674, 0x5636, 0x562f, 0x5630, 0x5880, 0x589f, 0x589e, + 0x58b3, 0x589c, 0x58ae, 0x58a9, 0x58a6, 0x596d, 0x5b09, 0x5afb, + 0x5b0b, 0x5af5, 0x5b0c, 0x5b08, 0x5bee, 0x5bec, 0x5be9, 0x5beb, + 0x5c64, 0x5c65, 0x5d9d, 0x5d94, 0x5e62, 0x5e5f, 0x5e61, 0x5ee2, + 0x5eda, 0x5edf, 0x5edd, 0x5ee3, 0x5ee0, 0x5f48, 0x5f71, 0x5fb7, + 0x5fb5, 0x6176, 0x6167, 0x616e, 0x615d, 0x6155, 0x6182, 0x617c, + 0x6170, 0x616b, 0x617e, 0x61a7, 0x6190, 0x61ab, 0x618e, 0x61ac, + 0x619a, 0x61a4, 0x6194, 0x61ae, 0x622e, 0x6469, 0x646f, 0x6479, + 0x649e, 0x64b2, 0x6488, 0x6490, 0x64b0, 0x64a5, 0x6493, 0x6495, + 0x64a9, 0x6492, 0x64ae, 0x64ad, 0x64ab, 0x649a, 0x64ac, 0x6499, + 0x64a2, 0x64b3, 0x6575, 0x6577, 0x6578, 0x66ae, 0x66ab, 0x66b4, + 0x66b1, 0x6a23, 0x6a1f, 0x69e8, 0x6a01, 0x6a1e, 0x6a19, 0x69fd, + 0x6a21, 0x6a13, 0x6a0a, 0x69f3, 0x6a02, 0x6a05, 0x69ed, 0x6a11, + 0x6b50, 0x6b4e, 0x6ba4, 0x6bc5, 0x6bc6, 0x6f3f, 0x6f7c, 0x6f84, + 0x6f51, 0x6f66, 0x6f54, 0x6f86, 0x6f6d, 0x6f5b, 0x6f78, 0x6f6e, + 0x6f8e, 0x6f7a, 0x6f70, 0x6f64, 0x6f97, 0x6f58, 0x6ed5, 0x6f6f, + 0x6f60, 0x6f5f, 0x719f, 0x71ac, 0x71b1, 0x71a8, 0x7256, 0x729b, + 0x734e, 0x7357, 0x7469, 0x748b, 0x7483, + /* 0xbd */ + 0x747e, 0x7480, 0x757f, 0x7620, 0x7629, 0x761f, 0x7624, 0x7626, + 0x7621, 0x7622, 0x769a, 0x76ba, 0x76e4, 0x778e, 0x7787, 0x778c, + 0x7791, 0x778b, 0x78cb, 0x78c5, 0x78ba, 0x78ca, 0x78be, 0x78d5, + 0x78bc, 0x78d0, 0x7a3f, 0x7a3c, 0x7a40, 0x7a3d, 0x7a37, 0x7a3b, + 0x7aaf, 0x7aae, 0x7bad, 0x7bb1, 0x7bc4, 0x7bb4, 0x7bc6, 0x7bc7, + 0x7bc1, 0x7ba0, 0x7bcc, 0x7cca, 0x7de0, 0x7df4, 0x7def, 0x7dfb, + 0x7dd8, 0x7dec, 0x7ddd, 0x7de8, 0x7de3, 0x7dda, 0x7dde, 0x7de9, + 0x7d9e, 0x7dd9, 0x7df2, 0x7df9, 0x7f75, 0x7f77, 0x7faf, 0x7fe9, + 0x8026, 0x819b, 0x819c, 0x819d, 0x81a0, 0x819a, 0x8198, 0x8517, + 0x853d, 0x851a, 0x84ee, 0x852c, 0x852d, 0x8513, 0x8511, 0x8523, + 0x8521, 0x8514, 0x84ec, 0x8525, 0x84ff, 0x8506, 0x8782, 0x8774, + 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, 0x8757, 0x874c, + 0x8753, 0x885b, 0x885d, 0x8910, 0x8907, 0x8912, 0x8913, 0x8915, + 0x890a, 0x8abc, 0x8ad2, 0x8ac7, 0x8ac4, 0x8a95, 0x8acb, 0x8af8, + 0x8ab2, 0x8ac9, 0x8ac2, 0x8abf, 0x8ab0, 0x8ad6, 0x8acd, 0x8ab6, + 0x8ab9, 0x8adb, 0x8c4c, 0x8c4e, 0x8c6c, 0x8ce0, 0x8cde, 0x8ce6, + 0x8ce4, 0x8cec, 0x8ced, 0x8ce2, 0x8ce3, 0x8cdc, 0x8cea, 0x8ce1, + 0x8d6d, 0x8d9f, 0x8da3, 0x8e2b, 0x8e10, 0x8e1d, 0x8e22, 0x8e0f, + 0x8e29, 0x8e1f, 0x8e21, 0x8e1e, 0x8eba, 0x8f1d, 0x8f1b, 0x8f1f, + 0x8f29, 0x8f26, 0x8f2a, 0x8f1c, 0x8f1e, + /* 0xbe */ + 0x8f25, 0x9069, 0x906e, 0x9068, 0x906d, 0x9077, 0x9130, 0x912d, + 0x9127, 0x9131, 0x9187, 0x9189, 0x918b, 0x9183, 0x92c5, 0x92bb, + 0x92b7, 0x92ea, 0x92ac, 0x92e4, 0x92c1, 0x92b3, 0x92bc, 0x92d2, + 0x92c7, 0x92f0, 0x92b2, 0x95ad, 0x95b1, 0x9704, 0x9706, 0x9707, + 0x9709, 0x9760, 0x978d, 0x978b, 0x978f, 0x9821, 0x982b, 0x981c, + 0x98b3, 0x990a, 0x9913, 0x9912, 0x9918, 0x99dd, 0x99d0, 0x99df, + 0x99db, 0x99d1, 0x99d5, 0x99d2, 0x99d9, 0x9ab7, 0x9aee, 0x9aef, + 0x9b27, 0x9b45, 0x9b44, 0x9b77, 0x9b6f, 0x9d06, 0x9d09, 0x9d03, + 0x9ea9, 0x9ebe, 0x9ece, 0x58a8, 0x9f52, 0x5112, 0x5118, 0x5114, + 0x5110, 0x5115, 0x5180, 0x51aa, 0x51dd, 0x5291, 0x5293, 0x52f3, + 0x5659, 0x566b, 0x5679, 0x5669, 0x5664, 0x5678, 0x566a, 0x5668, + 0x5665, 0x5671, 0x566f, 0x566c, 0x5662, 0x5676, 0x58c1, 0x58be, + 0x58c7, 0x58c5, 0x596e, 0x5b1d, 0x5b34, 0x5b78, 0x5bf0, 0x5c0e, + 0x5f4a, 0x61b2, 0x6191, 0x61a9, 0x618a, 0x61cd, 0x61b6, 0x61be, + 0x61ca, 0x61c8, 0x6230, 0x64c5, 0x64c1, 0x64cb, 0x64bb, 0x64bc, + 0x64da, 0x64c4, 0x64c7, 0x64c2, 0x64cd, 0x64bf, 0x64d2, 0x64d4, + 0x64be, 0x6574, 0x66c6, 0x66c9, 0x66b9, 0x66c4, 0x66c7, 0x66b8, + 0x6a3d, 0x6a38, 0x6a3a, 0x6a59, 0x6a6b, 0x6a58, 0x6a39, 0x6a44, + 0x6a62, 0x6a61, 0x6a4b, 0x6a47, 0x6a35, 0x6a5f, 0x6a48, 0x6b59, + 0x6b77, 0x6c05, 0x6fc2, 0x6fb1, 0x6fa1, + /* 0xbf */ + 0x6fc3, 0x6fa4, 0x6fc1, 0x6fa7, 0x6fb3, 0x6fc0, 0x6fb9, 0x6fb6, + 0x6fa6, 0x6fa0, 0x6fb4, 0x71be, 0x71c9, 0x71d0, 0x71d2, 0x71c8, + 0x71d5, 0x71b9, 0x71ce, 0x71d9, 0x71dc, 0x71c3, 0x71c4, 0x7368, + 0x749c, 0x74a3, 0x7498, 0x749f, 0x749e, 0x74e2, 0x750c, 0x750d, + 0x7634, 0x7638, 0x763a, 0x76e7, 0x76e5, 0x77a0, 0x779e, 0x779f, + 0x77a5, 0x78e8, 0x78da, 0x78ec, 0x78e7, 0x79a6, 0x7a4d, 0x7a4e, + 0x7a46, 0x7a4c, 0x7a4b, 0x7aba, 0x7bd9, 0x7c11, 0x7bc9, 0x7be4, + 0x7bdb, 0x7be1, 0x7be9, 0x7be6, 0x7cd5, 0x7cd6, 0x7e0a, 0x7e11, + 0x7e08, 0x7e1b, 0x7e23, 0x7e1e, 0x7e1d, 0x7e09, 0x7e10, 0x7f79, + 0x7fb2, 0x7ff0, 0x7ff1, 0x7fee, 0x8028, 0x81b3, 0x81a9, 0x81a8, + 0x81fb, 0x8208, 0x8258, 0x8259, 0x854a, 0x8559, 0x8548, 0x8568, + 0x8569, 0x8543, 0x8549, 0x856d, 0x856a, 0x855e, 0x8783, 0x879f, + 0x879e, 0x87a2, 0x878d, 0x8861, 0x892a, 0x8932, 0x8925, 0x892b, + 0x8921, 0x89aa, 0x89a6, 0x8ae6, 0x8afa, 0x8aeb, 0x8af1, 0x8b00, + 0x8adc, 0x8ae7, 0x8aee, 0x8afe, 0x8b01, 0x8b02, 0x8af7, 0x8aed, + 0x8af3, 0x8af6, 0x8afc, 0x8c6b, 0x8c6d, 0x8c93, 0x8cf4, 0x8e44, + 0x8e31, 0x8e34, 0x8e42, 0x8e39, 0x8e35, 0x8f3b, 0x8f2f, 0x8f38, + 0x8f33, 0x8fa8, 0x8fa6, 0x9075, 0x9074, 0x9078, 0x9072, 0x907c, + 0x907a, 0x9134, 0x9192, 0x9320, 0x9336, 0x92f8, 0x9333, 0x932f, + 0x9322, 0x92fc, 0x932b, 0x9304, 0x931a, + /* 0xc0 */ + 0x9310, 0x9326, 0x9321, 0x9315, 0x932e, 0x9319, 0x95bb, 0x96a7, + 0x96a8, 0x96aa, 0x96d5, 0x970e, 0x9711, 0x9716, 0x970d, 0x9713, + 0x970f, 0x975b, 0x975c, 0x9766, 0x9798, 0x9830, 0x9838, 0x983b, + 0x9837, 0x982d, 0x9839, 0x9824, 0x9910, 0x9928, 0x991e, 0x991b, + 0x9921, 0x991a, 0x99ed, 0x99e2, 0x99f1, 0x9ab8, 0x9abc, 0x9afb, + 0x9aed, 0x9b28, 0x9b91, 0x9d15, 0x9d23, 0x9d26, 0x9d28, 0x9d12, + 0x9d1b, 0x9ed8, 0x9ed4, 0x9f8d, 0x9f9c, 0x512a, 0x511f, 0x5121, + 0x5132, 0x52f5, 0x568e, 0x5680, 0x5690, 0x5685, 0x5687, 0x568f, + 0x58d5, 0x58d3, 0x58d1, 0x58ce, 0x5b30, 0x5b2a, 0x5b24, 0x5b7a, + 0x5c37, 0x5c68, 0x5dbc, 0x5dba, 0x5dbd, 0x5db8, 0x5e6b, 0x5f4c, + 0x5fbd, 0x61c9, 0x61c2, 0x61c7, 0x61e6, 0x61cb, 0x6232, 0x6234, + 0x64ce, 0x64ca, 0x64d8, 0x64e0, 0x64f0, 0x64e6, 0x64ec, 0x64f1, + 0x64e2, 0x64ed, 0x6582, 0x6583, 0x66d9, 0x66d6, 0x6a80, 0x6a94, + 0x6a84, 0x6aa2, 0x6a9c, 0x6adb, 0x6aa3, 0x6a7e, 0x6a97, 0x6a90, + 0x6aa0, 0x6b5c, 0x6bae, 0x6bda, 0x6c08, 0x6fd8, 0x6ff1, 0x6fdf, + 0x6fe0, 0x6fdb, 0x6fe4, 0x6feb, 0x6fef, 0x6f80, 0x6fec, 0x6fe1, + 0x6fe9, 0x6fd5, 0x6fee, 0x6ff0, 0x71e7, 0x71df, 0x71ee, 0x71e6, + 0x71e5, 0x71ed, 0x71ec, 0x71f4, 0x71e0, 0x7235, 0x7246, 0x7370, + 0x7372, 0x74a9, 0x74b0, 0x74a6, 0x74a8, 0x7646, 0x7642, 0x764c, + 0x76ea, 0x77b3, 0x77aa, 0x77b0, 0x77ac, + /* 0xc1 */ + 0x77a7, 0x77ad, 0x77ef, 0x78f7, 0x78fa, 0x78f4, 0x78ef, 0x7901, + 0x79a7, 0x79aa, 0x7a57, 0x7abf, 0x7c07, 0x7c0d, 0x7bfe, 0x7bf7, + 0x7c0c, 0x7be0, 0x7ce0, 0x7cdc, 0x7cde, 0x7ce2, 0x7cdf, 0x7cd9, + 0x7cdd, 0x7e2e, 0x7e3e, 0x7e46, 0x7e37, 0x7e32, 0x7e43, 0x7e2b, + 0x7e3d, 0x7e31, 0x7e45, 0x7e41, 0x7e34, 0x7e39, 0x7e48, 0x7e35, + 0x7e3f, 0x7e2f, 0x7f44, 0x7ff3, 0x7ffc, 0x8071, 0x8072, 0x8070, + 0x806f, 0x8073, 0x81c6, 0x81c3, 0x81ba, 0x81c2, 0x81c0, 0x81bf, + 0x81bd, 0x81c9, 0x81be, 0x81e8, 0x8209, 0x8271, 0x85aa, 0x8584, + 0x857e, 0x859c, 0x8591, 0x8594, 0x85af, 0x859b, 0x8587, 0x85a8, + 0x858a, 0x8667, 0x87c0, 0x87d1, 0x87b3, 0x87d2, 0x87c6, 0x87ab, + 0x87bb, 0x87ba, 0x87c8, 0x87cb, 0x893b, 0x8936, 0x8944, 0x8938, + 0x893d, 0x89ac, 0x8b0e, 0x8b17, 0x8b19, 0x8b1b, 0x8b0a, 0x8b20, + 0x8b1d, 0x8b04, 0x8b10, 0x8c41, 0x8c3f, 0x8c73, 0x8cfa, 0x8cfd, + 0x8cfc, 0x8cf8, 0x8cfb, 0x8da8, 0x8e49, 0x8e4b, 0x8e48, 0x8e4a, + 0x8f44, 0x8f3e, 0x8f42, 0x8f45, 0x8f3f, 0x907f, 0x907d, 0x9084, + 0x9081, 0x9082, 0x9080, 0x9139, 0x91a3, 0x919e, 0x919c, 0x934d, + 0x9382, 0x9328, 0x9375, 0x934a, 0x9365, 0x934b, 0x9318, 0x937e, + 0x936c, 0x935b, 0x9370, 0x935a, 0x9354, 0x95ca, 0x95cb, 0x95cc, + 0x95c8, 0x95c6, 0x96b1, 0x96b8, 0x96d6, 0x971c, 0x971e, 0x97a0, + 0x97d3, 0x9846, 0x98b6, 0x9935, 0x9a01, + /* 0xc2 */ + 0x99ff, 0x9bae, 0x9bab, 0x9baa, 0x9bad, 0x9d3b, 0x9d3f, 0x9e8b, + 0x9ecf, 0x9ede, 0x9edc, 0x9edd, 0x9edb, 0x9f3e, 0x9f4b, 0x53e2, + 0x5695, 0x56ae, 0x58d9, 0x58d8, 0x5b38, 0x5f5d, 0x61e3, 0x6233, + 0x64f4, 0x64f2, 0x64fe, 0x6506, 0x64fa, 0x64fb, 0x64f7, 0x65b7, + 0x66dc, 0x6726, 0x6ab3, 0x6aac, 0x6ac3, 0x6abb, 0x6ab8, 0x6ac2, + 0x6aae, 0x6aaf, 0x6b5f, 0x6b78, 0x6baf, 0x7009, 0x700b, 0x6ffe, + 0x7006, 0x6ffa, 0x7011, 0x700f, 0x71fb, 0x71fc, 0x71fe, 0x71f8, + 0x7377, 0x7375, 0x74a7, 0x74bf, 0x7515, 0x7656, 0x7658, 0x7652, + 0x77bd, 0x77bf, 0x77bb, 0x77bc, 0x790e, 0x79ae, 0x7a61, 0x7a62, + 0x7a60, 0x7ac4, 0x7ac5, 0x7c2b, 0x7c27, 0x7c2a, 0x7c1e, 0x7c23, + 0x7c21, 0x7ce7, 0x7e54, 0x7e55, 0x7e5e, 0x7e5a, 0x7e61, 0x7e52, + 0x7e59, 0x7f48, 0x7ff9, 0x7ffb, 0x8077, 0x8076, 0x81cd, 0x81cf, + 0x820a, 0x85cf, 0x85a9, 0x85cd, 0x85d0, 0x85c9, 0x85b0, 0x85ba, + 0x85b9, 0x85a6, 0x87ef, 0x87ec, 0x87f2, 0x87e0, 0x8986, 0x89b2, + 0x89f4, 0x8b28, 0x8b39, 0x8b2c, 0x8b2b, 0x8c50, 0x8d05, 0x8e59, + 0x8e63, 0x8e66, 0x8e64, 0x8e5f, 0x8e55, 0x8ec0, 0x8f49, 0x8f4d, + 0x9087, 0x9083, 0x9088, 0x91ab, 0x91ac, 0x91d0, 0x9394, 0x938a, + 0x9396, 0x93a2, 0x93b3, 0x93ae, 0x93ac, 0x93b0, 0x9398, 0x939a, + 0x9397, 0x95d4, 0x95d6, 0x95d0, 0x95d5, 0x96e2, 0x96dc, 0x96d9, + 0x96db, 0x96de, 0x9724, 0x97a3, 0x97a6, + /* 0xc3 */ + 0x97ad, 0x97f9, 0x984d, 0x984f, 0x984c, 0x984e, 0x9853, 0x98ba, + 0x993e, 0x993f, 0x993d, 0x992e, 0x99a5, 0x9a0e, 0x9ac1, 0x9b03, + 0x9b06, 0x9b4f, 0x9b4e, 0x9b4d, 0x9bca, 0x9bc9, 0x9bfd, 0x9bc8, + 0x9bc0, 0x9d51, 0x9d5d, 0x9d60, 0x9ee0, 0x9f15, 0x9f2c, 0x5133, + 0x56a5, 0x58de, 0x58df, 0x58e2, 0x5bf5, 0x9f90, 0x5eec, 0x61f2, + 0x61f7, 0x61f6, 0x61f5, 0x6500, 0x650f, 0x66e0, 0x66dd, 0x6ae5, + 0x6add, 0x6ada, 0x6ad3, 0x701b, 0x701f, 0x7028, 0x701a, 0x701d, + 0x7015, 0x7018, 0x7206, 0x720d, 0x7258, 0x72a2, 0x7378, 0x737a, + 0x74bd, 0x74ca, 0x74e3, 0x7587, 0x7586, 0x765f, 0x7661, 0x77c7, + 0x7919, 0x79b1, 0x7a6b, 0x7a69, 0x7c3e, 0x7c3f, 0x7c38, 0x7c3d, + 0x7c37, 0x7c40, 0x7e6b, 0x7e6d, 0x7e79, 0x7e69, 0x7e6a, 0x7f85, + 0x7e73, 0x7fb6, 0x7fb9, 0x7fb8, 0x81d8, 0x85e9, 0x85dd, 0x85ea, + 0x85d5, 0x85e4, 0x85e5, 0x85f7, 0x87fb, 0x8805, 0x880d, 0x87f9, + 0x87fe, 0x8960, 0x895f, 0x8956, 0x895e, 0x8b41, 0x8b5c, 0x8b58, + 0x8b49, 0x8b5a, 0x8b4e, 0x8b4f, 0x8b46, 0x8b59, 0x8d08, 0x8d0a, + 0x8e7c, 0x8e72, 0x8e87, 0x8e76, 0x8e6c, 0x8e7a, 0x8e74, 0x8f54, + 0x8f4e, 0x8fad, 0x908a, 0x908b, 0x91b1, 0x91ae, 0x93e1, 0x93d1, + 0x93df, 0x93c3, 0x93c8, 0x93dc, 0x93dd, 0x93d6, 0x93e2, 0x93cd, + 0x93d8, 0x93e4, 0x93d7, 0x93e8, 0x95dc, 0x96b4, 0x96e3, 0x972a, + 0x9727, 0x9761, 0x97dc, 0x97fb, 0x985e, + /* 0xc4 */ + 0x9858, 0x985b, 0x98bc, 0x9945, 0x9949, 0x9a16, 0x9a19, 0x9b0d, + 0x9be8, 0x9be7, 0x9bd6, 0x9bdb, 0x9d89, 0x9d61, 0x9d72, 0x9d6a, + 0x9d6c, 0x9e92, 0x9e97, 0x9e93, 0x9eb4, 0x52f8, 0x56a8, 0x56b7, + 0x56b6, 0x56b4, 0x56bc, 0x58e4, 0x5b40, 0x5b43, 0x5b7d, 0x5bf6, + 0x5dc9, 0x61f8, 0x61fa, 0x6518, 0x6514, 0x6519, 0x66e6, 0x6727, + 0x6aec, 0x703e, 0x7030, 0x7032, 0x7210, 0x737b, 0x74cf, 0x7662, + 0x7665, 0x7926, 0x792a, 0x792c, 0x792b, 0x7ac7, 0x7af6, 0x7c4c, + 0x7c43, 0x7c4d, 0x7cef, 0x7cf0, 0x8fae, 0x7e7d, 0x7e7c, 0x7e82, + 0x7f4c, 0x8000, 0x81da, 0x8266, 0x85fb, 0x85f9, 0x8611, 0x85fa, + 0x8606, 0x860b, 0x8607, 0x860a, 0x8814, 0x8815, 0x8964, 0x89ba, + 0x89f8, 0x8b70, 0x8b6c, 0x8b66, 0x8b6f, 0x8b5f, 0x8b6b, 0x8d0f, + 0x8d0d, 0x8e89, 0x8e81, 0x8e85, 0x8e82, 0x91b4, 0x91cb, 0x9418, + 0x9403, 0x93fd, 0x95e1, 0x9730, 0x98c4, 0x9952, 0x9951, 0x99a8, + 0x9a2b, 0x9a30, 0x9a37, 0x9a35, 0x9c13, 0x9c0d, 0x9e79, 0x9eb5, + 0x9ee8, 0x9f2f, 0x9f5f, 0x9f63, 0x9f61, 0x5137, 0x5138, 0x56c1, + 0x56c0, 0x56c2, 0x5914, 0x5c6c, 0x5dcd, 0x61fc, 0x61fe, 0x651d, + 0x651c, 0x6595, 0x66e9, 0x6afb, 0x6b04, 0x6afa, 0x6bb2, 0x704c, + 0x721b, 0x72a7, 0x74d6, 0x74d4, 0x7669, 0x77d3, 0x7c50, 0x7e8f, + 0x7e8c, 0x7fbc, 0x8617, 0x862d, 0x861a, 0x8823, 0x8822, 0x8821, + 0x881f, 0x896a, 0x896c, 0x89bd, 0x8b74, + /* 0xc5 */ + 0x8b77, 0x8b7d, 0x8d13, 0x8e8a, 0x8e8d, 0x8e8b, 0x8f5f, 0x8faf, + 0x91ba, 0x942e, 0x9433, 0x9435, 0x943a, 0x9438, 0x9432, 0x942b, + 0x95e2, 0x9738, 0x9739, 0x9732, 0x97ff, 0x9867, 0x9865, 0x9957, + 0x9a45, 0x9a43, 0x9a40, 0x9a3e, 0x9acf, 0x9b54, 0x9b51, 0x9c2d, + 0x9c25, 0x9daf, 0x9db4, 0x9dc2, 0x9db8, 0x9e9d, 0x9eef, 0x9f19, + 0x9f5c, 0x9f66, 0x9f67, 0x513c, 0x513b, 0x56c8, 0x56ca, 0x56c9, + 0x5b7f, 0x5dd4, 0x5dd2, 0x5f4e, 0x61ff, 0x6524, 0x6b0a, 0x6b61, + 0x7051, 0x7058, 0x7380, 0x74e4, 0x758a, 0x766e, 0x766c, 0x79b3, + 0x7c60, 0x7c5f, 0x807e, 0x807d, 0x81df, 0x8972, 0x896f, 0x89fc, + 0x8b80, 0x8d16, 0x8d17, 0x8e91, 0x8e93, 0x8f61, 0x9148, 0x9444, + 0x9451, 0x9452, 0x973d, 0x973e, 0x97c3, 0x97c1, 0x986b, 0x9955, + 0x9a55, 0x9a4d, 0x9ad2, 0x9b1a, 0x9c49, 0x9c31, 0x9c3e, 0x9c3b, + 0x9dd3, 0x9dd7, 0x9f34, 0x9f6c, 0x9f6a, 0x9f94, 0x56cc, 0x5dd6, + 0x6200, 0x6523, 0x652b, 0x652a, 0x66ec, 0x6b10, 0x74da, 0x7aca, + 0x7c64, 0x7c63, 0x7c65, 0x7e93, 0x7e96, 0x7e94, 0x81e2, 0x8638, + 0x863f, 0x8831, 0x8b8a, 0x9090, 0x908f, 0x9463, 0x9460, 0x9464, + 0x9768, 0x986f, 0x995c, 0x9a5a, 0x9a5b, 0x9a57, 0x9ad3, 0x9ad4, + 0x9ad1, 0x9c54, 0x9c57, 0x9c56, 0x9de5, 0x9e9f, 0x9ef4, 0x56d1, + 0x58e9, 0x652c, 0x705e, 0x7671, 0x7672, 0x77d7, 0x7f50, 0x7f88, + 0x8836, 0x8839, 0x8862, 0x8b93, 0x8b92, + /* 0xc6 */ + 0x8b96, 0x8277, 0x8d1b, 0x91c0, 0x946a, 0x9742, 0x9748, 0x9744, + 0x97c6, 0x9870, 0x9a5f, 0x9b22, 0x9b58, 0x9c5f, 0x9df9, 0x9dfa, + 0x9e7c, 0x9e7d, 0x9f07, 0x9f77, 0x9f72, 0x5ef3, 0x6b16, 0x7063, + 0x7c6c, 0x7c6e, 0x883b, 0x89c0, 0x8ea1, 0x91c1, 0x9472, 0x9470, + 0x9871, 0x995e, 0x9ad6, 0x9b23, 0x9ecc, 0x7064, 0x77da, 0x8b9a, + 0x9477, 0x97c9, 0x9a62, 0x9a65, 0x7e9c, 0x8b9c, 0x8eaa, 0x91c5, + 0x947d, 0x947e, 0x947c, 0x9c77, 0x9c78, 0x9ef7, 0x8c54, 0x947f, + 0x9e1a, 0x7228, 0x9a6a, 0x9b31, 0x9e1b, 0x9e1e, 0x7c72, 0x30fe, + 0x309d, 0x309e, 0x3005, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, + 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, + 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, + 0x3056, 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, + 0x305e, 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, + 0x3066, 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, + 0x306e, 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, + 0x3076, 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, + 0x307e, 0x307f, 0x3080, 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, + 0x3086, 0x3087, 0x3088, 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, + 0x308e, 0x308f, 0x3090, 0x3091, 0x3092, 0x3093, 0x30a1, 0x30a2, + 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, + /* 0xc7 */ + 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, + 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, + 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, + 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, + 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, + 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, + 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, + 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, + 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, + 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0x0414, + 0x0415, 0x0401, 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, + 0x041c, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, + 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, + 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, + 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, + 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, + 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x2460, + 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, + 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, + 0x247b, 0x247c, 0x247d, +}; +static const unsigned short big5_2uni_pagec9[7652] = { + /* 0xc9 */ + 0x4e42, 0x4e5c, 0x51f5, 0x531a, 0x5382, 0x4e07, 0x4e0c, 0x4e47, + 0x4e8d, 0x56d7, 0xfa0c, 0x5c6e, 0x5f73, 0x4e0f, 0x5187, 0x4e0e, + 0x4e2e, 0x4e93, 0x4ec2, 0x4ec9, 0x4ec8, 0x5198, 0x52fc, 0x536c, + 0x53b9, 0x5720, 0x5903, 0x592c, 0x5c10, 0x5dff, 0x65e1, 0x6bb3, + 0x6bcc, 0x6c14, 0x723f, 0x4e31, 0x4e3c, 0x4ee8, 0x4edc, 0x4ee9, + 0x4ee1, 0x4edd, 0x4eda, 0x520c, 0x531c, 0x534c, 0x5722, 0x5723, + 0x5917, 0x592f, 0x5b81, 0x5b84, 0x5c12, 0x5c3b, 0x5c74, 0x5c73, + 0x5e04, 0x5e80, 0x5e82, 0x5fc9, 0x6209, 0x6250, 0x6c15, 0x6c36, + 0x6c43, 0x6c3f, 0x6c3b, 0x72ae, 0x72b0, 0x738a, 0x79b8, 0x808a, + 0x961e, 0x4f0e, 0x4f18, 0x4f2c, 0x4ef5, 0x4f14, 0x4ef1, 0x4f00, + 0x4ef7, 0x4f08, 0x4f1d, 0x4f02, 0x4f05, 0x4f22, 0x4f13, 0x4f04, + 0x4ef4, 0x4f12, 0x51b1, 0x5213, 0x5209, 0x5210, 0x52a6, 0x5322, + 0x531f, 0x534d, 0x538a, 0x5407, 0x56e1, 0x56df, 0x572e, 0x572a, + 0x5734, 0x593c, 0x5980, 0x597c, 0x5985, 0x597b, 0x597e, 0x5977, + 0x597f, 0x5b56, 0x5c15, 0x5c25, 0x5c7c, 0x5c7a, 0x5c7b, 0x5c7e, + 0x5ddf, 0x5e75, 0x5e84, 0x5f02, 0x5f1a, 0x5f74, 0x5fd5, 0x5fd4, + 0x5fcf, 0x625c, 0x625e, 0x6264, 0x6261, 0x6266, 0x6262, 0x6259, + 0x6260, 0x625a, 0x6265, 0x65ef, 0x65ee, 0x673e, 0x6739, 0x6738, + 0x673b, 0x673a, 0x673f, 0x673c, 0x6733, 0x6c18, 0x6c46, 0x6c52, + 0x6c5c, 0x6c4f, 0x6c4a, 0x6c54, 0x6c4b, + /* 0xca */ + 0x6c4c, 0x7071, 0x725e, 0x72b4, 0x72b5, 0x738e, 0x752a, 0x767f, + 0x7a75, 0x7f51, 0x8278, 0x827c, 0x8280, 0x827d, 0x827f, 0x864d, + 0x897e, 0x9099, 0x9097, 0x9098, 0x909b, 0x9094, 0x9622, 0x9624, + 0x9620, 0x9623, 0x4f56, 0x4f3b, 0x4f62, 0x4f49, 0x4f53, 0x4f64, + 0x4f3e, 0x4f67, 0x4f52, 0x4f5f, 0x4f41, 0x4f58, 0x4f2d, 0x4f33, + 0x4f3f, 0x4f61, 0x518f, 0x51b9, 0x521c, 0x521e, 0x5221, 0x52ad, + 0x52ae, 0x5309, 0x5363, 0x5372, 0x538e, 0x538f, 0x5430, 0x5437, + 0x542a, 0x5454, 0x5445, 0x5419, 0x541c, 0x5425, 0x5418, 0x543d, + 0x544f, 0x5441, 0x5428, 0x5424, 0x5447, 0x56ee, 0x56e7, 0x56e5, + 0x5741, 0x5745, 0x574c, 0x5749, 0x574b, 0x5752, 0x5906, 0x5940, + 0x59a6, 0x5998, 0x59a0, 0x5997, 0x598e, 0x59a2, 0x5990, 0x598f, + 0x59a7, 0x59a1, 0x5b8e, 0x5b92, 0x5c28, 0x5c2a, 0x5c8d, 0x5c8f, + 0x5c88, 0x5c8b, 0x5c89, 0x5c92, 0x5c8a, 0x5c86, 0x5c93, 0x5c95, + 0x5de0, 0x5e0a, 0x5e0e, 0x5e8b, 0x5e89, 0x5e8c, 0x5e88, 0x5e8d, + 0x5f05, 0x5f1d, 0x5f78, 0x5f76, 0x5fd2, 0x5fd1, 0x5fd0, 0x5fed, + 0x5fe8, 0x5fee, 0x5ff3, 0x5fe1, 0x5fe4, 0x5fe3, 0x5ffa, 0x5fef, + 0x5ff7, 0x5ffb, 0x6000, 0x5ff4, 0x623a, 0x6283, 0x628c, 0x628e, + 0x628f, 0x6294, 0x6287, 0x6271, 0x627b, 0x627a, 0x6270, 0x6281, + 0x6288, 0x6277, 0x627d, 0x6272, 0x6274, 0x6537, 0x65f0, 0x65f4, + 0x65f3, 0x65f2, 0x65f5, 0x6745, 0x6747, + /* 0xcb */ + 0x6759, 0x6755, 0x674c, 0x6748, 0x675d, 0x674d, 0x675a, 0x674b, + 0x6bd0, 0x6c19, 0x6c1a, 0x6c78, 0x6c67, 0x6c6b, 0x6c84, 0x6c8b, + 0x6c8f, 0x6c71, 0x6c6f, 0x6c69, 0x6c9a, 0x6c6d, 0x6c87, 0x6c95, + 0x6c9c, 0x6c66, 0x6c73, 0x6c65, 0x6c7b, 0x6c8e, 0x7074, 0x707a, + 0x7263, 0x72bf, 0x72bd, 0x72c3, 0x72c6, 0x72c1, 0x72ba, 0x72c5, + 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753a, 0x7539, 0x7594, + 0x7595, 0x7681, 0x793d, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, + 0x809c, 0x8290, 0x828f, 0x8285, 0x828e, 0x8291, 0x8293, 0x828a, + 0x8283, 0x8284, 0x8c78, 0x8fc9, 0x8fbf, 0x909f, 0x90a1, 0x90a5, + 0x909e, 0x90a7, 0x90a0, 0x9630, 0x9628, 0x962f, 0x962d, 0x4e33, + 0x4f98, 0x4f7c, 0x4f85, 0x4f7d, 0x4f80, 0x4f87, 0x4f76, 0x4f74, + 0x4f89, 0x4f84, 0x4f77, 0x4f4c, 0x4f97, 0x4f6a, 0x4f9a, 0x4f79, + 0x4f81, 0x4f78, 0x4f90, 0x4f9c, 0x4f94, 0x4f9e, 0x4f92, 0x4f82, + 0x4f95, 0x4f6b, 0x4f6e, 0x519e, 0x51bc, 0x51be, 0x5235, 0x5232, + 0x5233, 0x5246, 0x5231, 0x52bc, 0x530a, 0x530b, 0x533c, 0x5392, + 0x5394, 0x5487, 0x547f, 0x5481, 0x5491, 0x5482, 0x5488, 0x546b, + 0x547a, 0x547e, 0x5465, 0x546c, 0x5474, 0x5466, 0x548d, 0x546f, + 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, 0x56f7, 0x56f9, + 0x576f, 0x5772, 0x576d, 0x576b, 0x5771, 0x5770, 0x5776, 0x5780, + 0x5775, 0x577b, 0x5773, 0x5774, 0x5762, + /* 0xcc */ + 0x5768, 0x577d, 0x590c, 0x5945, 0x59b5, 0x59ba, 0x59cf, 0x59ce, + 0x59b2, 0x59cc, 0x59c1, 0x59b6, 0x59bc, 0x59c3, 0x59d6, 0x59b1, + 0x59bd, 0x59c0, 0x59c8, 0x59b4, 0x59c7, 0x5b62, 0x5b65, 0x5b93, + 0x5b95, 0x5c44, 0x5c47, 0x5cae, 0x5ca4, 0x5ca0, 0x5cb5, 0x5caf, + 0x5ca8, 0x5cac, 0x5c9f, 0x5ca3, 0x5cad, 0x5ca2, 0x5caa, 0x5ca7, + 0x5c9d, 0x5ca5, 0x5cb6, 0x5cb0, 0x5ca6, 0x5e17, 0x5e14, 0x5e19, + 0x5f28, 0x5f22, 0x5f23, 0x5f24, 0x5f54, 0x5f82, 0x5f7e, 0x5f7d, + 0x5fde, 0x5fe5, 0x602d, 0x6026, 0x6019, 0x6032, 0x600b, 0x6034, + 0x600a, 0x6017, 0x6033, 0x601a, 0x601e, 0x602c, 0x6022, 0x600d, + 0x6010, 0x602e, 0x6013, 0x6011, 0x600c, 0x6009, 0x601c, 0x6214, + 0x623d, 0x62ad, 0x62b4, 0x62d1, 0x62be, 0x62aa, 0x62b6, 0x62ca, + 0x62ae, 0x62b3, 0x62af, 0x62bb, 0x62a9, 0x62b0, 0x62b8, 0x653d, + 0x65a8, 0x65bb, 0x6609, 0x65fc, 0x6604, 0x6612, 0x6608, 0x65fb, + 0x6603, 0x660b, 0x660d, 0x6605, 0x65fd, 0x6611, 0x6610, 0x66f6, + 0x670a, 0x6785, 0x676c, 0x678e, 0x6792, 0x6776, 0x677b, 0x6798, + 0x6786, 0x6784, 0x6774, 0x678d, 0x678c, 0x677a, 0x679f, 0x6791, + 0x6799, 0x6783, 0x677d, 0x6781, 0x6778, 0x6779, 0x6794, 0x6b25, + 0x6b80, 0x6b7e, 0x6bde, 0x6c1d, 0x6c93, 0x6cec, 0x6ceb, 0x6cee, + 0x6cd9, 0x6cb6, 0x6cd4, 0x6cad, 0x6ce7, 0x6cb7, 0x6cd0, 0x6cc2, + 0x6cba, 0x6cc3, 0x6cc6, 0x6ced, 0x6cf2, + /* 0xcd */ + 0x6cd2, 0x6cdd, 0x6cb4, 0x6c8a, 0x6c9d, 0x6c80, 0x6cde, 0x6cc0, + 0x6d30, 0x6ccd, 0x6cc7, 0x6cb0, 0x6cf9, 0x6ccf, 0x6ce9, 0x6cd1, + 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, + 0x7082, 0x709a, 0x7083, 0x726a, 0x72d6, 0x72cb, 0x72d8, 0x72c9, + 0x72dc, 0x72d2, 0x72d4, 0x72da, 0x72cc, 0x72d1, 0x73a4, 0x73a1, + 0x73ad, 0x73a6, 0x73a2, 0x73a0, 0x73ac, 0x739d, 0x74dd, 0x74e8, + 0x753f, 0x7540, 0x753e, 0x758c, 0x7598, 0x76af, 0x76f3, 0x76f1, + 0x76f0, 0x76f5, 0x77f8, 0x77fc, 0x77f9, 0x77fb, 0x77fa, 0x77f7, + 0x7942, 0x793f, 0x79c5, 0x7a78, 0x7a7b, 0x7afb, 0x7c75, 0x7cfd, + 0x8035, 0x808f, 0x80ae, 0x80a3, 0x80b8, 0x80b5, 0x80ad, 0x8220, + 0x82a0, 0x82c0, 0x82ab, 0x829a, 0x8298, 0x829b, 0x82b5, 0x82a7, + 0x82ae, 0x82bc, 0x829e, 0x82ba, 0x82b4, 0x82a8, 0x82a1, 0x82a9, + 0x82c2, 0x82a4, 0x82c3, 0x82b6, 0x82a2, 0x8670, 0x866f, 0x866d, + 0x866e, 0x8c56, 0x8fd2, 0x8fcb, 0x8fd3, 0x8fcd, 0x8fd6, 0x8fd5, + 0x8fd7, 0x90b2, 0x90b4, 0x90af, 0x90b3, 0x90b0, 0x9639, 0x963d, + 0x963c, 0x963a, 0x9643, 0x4fcd, 0x4fc5, 0x4fd3, 0x4fb2, 0x4fc9, + 0x4fcb, 0x4fc1, 0x4fd4, 0x4fdc, 0x4fd9, 0x4fbb, 0x4fb3, 0x4fdb, + 0x4fc7, 0x4fd6, 0x4fba, 0x4fc0, 0x4fb9, 0x4fec, 0x5244, 0x5249, + 0x52c0, 0x52c2, 0x533d, 0x537c, 0x5397, 0x5396, 0x5399, 0x5398, + 0x54ba, 0x54a1, 0x54ad, 0x54a5, 0x54cf, + /* 0xce */ + 0x54c3, 0x830d, 0x54b7, 0x54ae, 0x54d6, 0x54b6, 0x54c5, 0x54c6, + 0x54a0, 0x5470, 0x54bc, 0x54a2, 0x54be, 0x5472, 0x54de, 0x54b0, + 0x57b5, 0x579e, 0x579f, 0x57a4, 0x578c, 0x5797, 0x579d, 0x579b, + 0x5794, 0x5798, 0x578f, 0x5799, 0x57a5, 0x579a, 0x5795, 0x58f4, + 0x590d, 0x5953, 0x59e1, 0x59de, 0x59ee, 0x5a00, 0x59f1, 0x59dd, + 0x59fa, 0x59fd, 0x59fc, 0x59f6, 0x59e4, 0x59f2, 0x59f7, 0x59db, + 0x59e9, 0x59f3, 0x59f5, 0x59e0, 0x59fe, 0x59f4, 0x59ed, 0x5ba8, + 0x5c4c, 0x5cd0, 0x5cd8, 0x5ccc, 0x5cd7, 0x5ccb, 0x5cdb, 0x5cde, + 0x5cda, 0x5cc9, 0x5cc7, 0x5cca, 0x5cd6, 0x5cd3, 0x5cd4, 0x5ccf, + 0x5cc8, 0x5cc6, 0x5cce, 0x5cdf, 0x5cf8, 0x5df9, 0x5e21, 0x5e22, + 0x5e23, 0x5e20, 0x5e24, 0x5eb0, 0x5ea4, 0x5ea2, 0x5e9b, 0x5ea3, + 0x5ea5, 0x5f07, 0x5f2e, 0x5f56, 0x5f86, 0x6037, 0x6039, 0x6054, + 0x6072, 0x605e, 0x6045, 0x6053, 0x6047, 0x6049, 0x605b, 0x604c, + 0x6040, 0x6042, 0x605f, 0x6024, 0x6044, 0x6058, 0x6066, 0x606e, + 0x6242, 0x6243, 0x62cf, 0x630d, 0x630b, 0x62f5, 0x630e, 0x6303, + 0x62eb, 0x62f9, 0x630f, 0x630c, 0x62f8, 0x62f6, 0x6300, 0x6313, + 0x6314, 0x62fa, 0x6315, 0x62fb, 0x62f0, 0x6541, 0x6543, 0x65aa, + 0x65bf, 0x6636, 0x6621, 0x6632, 0x6635, 0x661c, 0x6626, 0x6622, + 0x6633, 0x662b, 0x663a, 0x661d, 0x6634, 0x6639, 0x662e, 0x670f, + 0x6710, 0x67c1, 0x67f2, 0x67c8, 0x67ba, + /* 0xcf */ + 0x67dc, 0x67bb, 0x67f8, 0x67d8, 0x67c0, 0x67b7, 0x67c5, 0x67eb, + 0x67e4, 0x67df, 0x67b5, 0x67cd, 0x67b3, 0x67f7, 0x67f6, 0x67ee, + 0x67e3, 0x67c2, 0x67b9, 0x67ce, 0x67e7, 0x67f0, 0x67b2, 0x67fc, + 0x67c6, 0x67ed, 0x67cc, 0x67ae, 0x67e6, 0x67db, 0x67fa, 0x67c9, + 0x67ca, 0x67c3, 0x67ea, 0x67cb, 0x6b28, 0x6b82, 0x6b84, 0x6bb6, + 0x6bd6, 0x6bd8, 0x6be0, 0x6c20, 0x6c21, 0x6d28, 0x6d34, 0x6d2d, + 0x6d1f, 0x6d3c, 0x6d3f, 0x6d12, 0x6d0a, 0x6cda, 0x6d33, 0x6d04, + 0x6d19, 0x6d3a, 0x6d1a, 0x6d11, 0x6d00, 0x6d1d, 0x6d42, 0x6d01, + 0x6d18, 0x6d37, 0x6d03, 0x6d0f, 0x6d40, 0x6d07, 0x6d20, 0x6d2c, + 0x6d08, 0x6d22, 0x6d09, 0x6d10, 0x70b7, 0x709f, 0x70be, 0x70b1, + 0x70b0, 0x70a1, 0x70b4, 0x70b5, 0x70a9, 0x7241, 0x7249, 0x724a, + 0x726c, 0x7270, 0x7273, 0x726e, 0x72ca, 0x72e4, 0x72e8, 0x72eb, + 0x72df, 0x72ea, 0x72e6, 0x72e3, 0x7385, 0x73cc, 0x73c2, 0x73c8, + 0x73c5, 0x73b9, 0x73b6, 0x73b5, 0x73b4, 0x73eb, 0x73bf, 0x73c7, + 0x73be, 0x73c3, 0x73c6, 0x73b8, 0x73cb, 0x74ec, 0x74ee, 0x752e, + 0x7547, 0x7548, 0x75a7, 0x75aa, 0x7679, 0x76c4, 0x7708, 0x7703, + 0x7704, 0x7705, 0x770a, 0x76f7, 0x76fb, 0x76fa, 0x77e7, 0x77e8, + 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780f, 0x780e, 0x7809, + 0x7803, 0x7813, 0x794a, 0x794c, 0x794b, 0x7945, 0x7944, 0x79d5, + 0x79cd, 0x79cf, 0x79d6, 0x79ce, 0x7a80, + /* 0xd0 */ + 0x7a7e, 0x7ad1, 0x7b00, 0x7b01, 0x7c7a, 0x7c78, 0x7c79, 0x7c7f, + 0x7c80, 0x7c81, 0x7d03, 0x7d08, 0x7d01, 0x7f58, 0x7f91, 0x7f8d, + 0x7fbe, 0x8007, 0x800e, 0x800f, 0x8014, 0x8037, 0x80d8, 0x80c7, + 0x80e0, 0x80d1, 0x80c8, 0x80c2, 0x80d0, 0x80c5, 0x80e3, 0x80d9, + 0x80dc, 0x80ca, 0x80d5, 0x80c9, 0x80cf, 0x80d7, 0x80e6, 0x80cd, + 0x81ff, 0x8221, 0x8294, 0x82d9, 0x82fe, 0x82f9, 0x8307, 0x82e8, + 0x8300, 0x82d5, 0x833a, 0x82eb, 0x82d6, 0x82f4, 0x82ec, 0x82e1, + 0x82f2, 0x82f5, 0x830c, 0x82fb, 0x82f6, 0x82f0, 0x82ea, 0x82e4, + 0x82e0, 0x82fa, 0x82f3, 0x82ed, 0x8677, 0x8674, 0x867c, 0x8673, + 0x8841, 0x884e, 0x8867, 0x886a, 0x8869, 0x89d3, 0x8a04, 0x8a07, + 0x8d72, 0x8fe3, 0x8fe1, 0x8fee, 0x8fe0, 0x90f1, 0x90bd, 0x90bf, + 0x90d5, 0x90c5, 0x90be, 0x90c7, 0x90cb, 0x90c8, 0x91d4, 0x91d3, + 0x9654, 0x964f, 0x9651, 0x9653, 0x964a, 0x964e, 0x501e, 0x5005, + 0x5007, 0x5013, 0x5022, 0x5030, 0x501b, 0x4ff5, 0x4ff4, 0x5033, + 0x5037, 0x502c, 0x4ff6, 0x4ff7, 0x5017, 0x501c, 0x5020, 0x5027, + 0x5035, 0x502f, 0x5031, 0x500e, 0x515a, 0x5194, 0x5193, 0x51ca, + 0x51c4, 0x51c5, 0x51c8, 0x51ce, 0x5261, 0x525a, 0x5252, 0x525e, + 0x525f, 0x5255, 0x5262, 0x52cd, 0x530e, 0x539e, 0x5526, 0x54e2, + 0x5517, 0x5512, 0x54e7, 0x54f3, 0x54e4, 0x551a, 0x54ff, 0x5504, + 0x5508, 0x54eb, 0x5511, 0x5505, 0x54f1, + /* 0xd1 */ + 0x550a, 0x54fb, 0x54f7, 0x54f8, 0x54e0, 0x550e, 0x5503, 0x550b, + 0x5701, 0x5702, 0x57cc, 0x5832, 0x57d5, 0x57d2, 0x57ba, 0x57c6, + 0x57bd, 0x57bc, 0x57b8, 0x57b6, 0x57bf, 0x57c7, 0x57d0, 0x57b9, + 0x57c1, 0x590e, 0x594a, 0x5a19, 0x5a16, 0x5a2d, 0x5a2e, 0x5a15, + 0x5a0f, 0x5a17, 0x5a0a, 0x5a1e, 0x5a33, 0x5b6c, 0x5ba7, 0x5bad, + 0x5bac, 0x5c03, 0x5c56, 0x5c54, 0x5cec, 0x5cff, 0x5cee, 0x5cf1, + 0x5cf7, 0x5d00, 0x5cf9, 0x5e29, 0x5e28, 0x5ea8, 0x5eae, 0x5eaa, + 0x5eac, 0x5f33, 0x5f30, 0x5f67, 0x605d, 0x605a, 0x6067, 0x6041, + 0x60a2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609d, 0x6083, 0x6095, + 0x609b, 0x6097, 0x6087, 0x609c, 0x608e, 0x6219, 0x6246, 0x62f2, + 0x6310, 0x6356, 0x632c, 0x6344, 0x6345, 0x6336, 0x6343, 0x63e4, + 0x6339, 0x634b, 0x634a, 0x633c, 0x6329, 0x6341, 0x6334, 0x6358, + 0x6354, 0x6359, 0x632d, 0x6347, 0x6333, 0x635a, 0x6351, 0x6338, + 0x6357, 0x6340, 0x6348, 0x654a, 0x6546, 0x65c6, 0x65c3, 0x65c4, + 0x65c2, 0x664a, 0x665f, 0x6647, 0x6651, 0x6712, 0x6713, 0x681f, + 0x681a, 0x6849, 0x6832, 0x6833, 0x683b, 0x684b, 0x684f, 0x6816, + 0x6831, 0x681c, 0x6835, 0x682b, 0x682d, 0x682f, 0x684e, 0x6844, + 0x6834, 0x681d, 0x6812, 0x6814, 0x6826, 0x6828, 0x682e, 0x684d, + 0x683a, 0x6825, 0x6820, 0x6b2c, 0x6b2f, 0x6b2d, 0x6b31, 0x6b34, + 0x6b6d, 0x8082, 0x6b88, 0x6be6, 0x6be4, + /* 0xd2 */ + 0x6be8, 0x6be3, 0x6be2, 0x6be7, 0x6c25, 0x6d7a, 0x6d63, 0x6d64, + 0x6d76, 0x6d0d, 0x6d61, 0x6d92, 0x6d58, 0x6d62, 0x6d6d, 0x6d6f, + 0x6d91, 0x6d8d, 0x6def, 0x6d7f, 0x6d86, 0x6d5e, 0x6d67, 0x6d60, + 0x6d97, 0x6d70, 0x6d7c, 0x6d5f, 0x6d82, 0x6d98, 0x6d2f, 0x6d68, + 0x6d8b, 0x6d7e, 0x6d80, 0x6d84, 0x6d16, 0x6d83, 0x6d7b, 0x6d7d, + 0x6d75, 0x6d90, 0x70dc, 0x70d3, 0x70d1, 0x70dd, 0x70cb, 0x7f39, + 0x70e2, 0x70d7, 0x70d2, 0x70de, 0x70e0, 0x70d4, 0x70cd, 0x70c5, + 0x70c6, 0x70c7, 0x70da, 0x70ce, 0x70e1, 0x7242, 0x7278, 0x7277, + 0x7276, 0x7300, 0x72fa, 0x72f4, 0x72fe, 0x72f6, 0x72f3, 0x72fb, + 0x7301, 0x73d3, 0x73d9, 0x73e5, 0x73d6, 0x73bc, 0x73e7, 0x73e3, + 0x73e9, 0x73dc, 0x73d2, 0x73db, 0x73d4, 0x73dd, 0x73da, 0x73d7, + 0x73d8, 0x73e8, 0x74de, 0x74df, 0x74f4, 0x74f5, 0x7521, 0x755b, + 0x755f, 0x75b0, 0x75c1, 0x75bb, 0x75c4, 0x75c0, 0x75bf, 0x75b6, + 0x75ba, 0x768a, 0x76c9, 0x771d, 0x771b, 0x7710, 0x7713, 0x7712, + 0x7723, 0x7711, 0x7715, 0x7719, 0x771a, 0x7722, 0x7727, 0x7823, + 0x782c, 0x7822, 0x7835, 0x782f, 0x7828, 0x782e, 0x782b, 0x7821, + 0x7829, 0x7833, 0x782a, 0x7831, 0x7954, 0x795b, 0x794f, 0x795c, + 0x7953, 0x7952, 0x7951, 0x79eb, 0x79ec, 0x79e0, 0x79ee, 0x79ed, + 0x79ea, 0x79dc, 0x79de, 0x79dd, 0x7a86, 0x7a89, 0x7a85, 0x7a8b, + 0x7a8c, 0x7a8a, 0x7a87, 0x7ad8, 0x7b10, + /* 0xd3 */ + 0x7b04, 0x7b13, 0x7b05, 0x7b0f, 0x7b08, 0x7b0a, 0x7b0e, 0x7b09, + 0x7b12, 0x7c84, 0x7c91, 0x7c8a, 0x7c8c, 0x7c88, 0x7c8d, 0x7c85, + 0x7d1e, 0x7d1d, 0x7d11, 0x7d0e, 0x7d18, 0x7d16, 0x7d13, 0x7d1f, + 0x7d12, 0x7d0f, 0x7d0c, 0x7f5c, 0x7f61, 0x7f5e, 0x7f60, 0x7f5d, + 0x7f5b, 0x7f96, 0x7f92, 0x7fc3, 0x7fc2, 0x7fc0, 0x8016, 0x803e, + 0x8039, 0x80fa, 0x80f2, 0x80f9, 0x80f5, 0x8101, 0x80fb, 0x8100, + 0x8201, 0x822f, 0x8225, 0x8333, 0x832d, 0x8344, 0x8319, 0x8351, + 0x8325, 0x8356, 0x833f, 0x8341, 0x8326, 0x831c, 0x8322, 0x8342, + 0x834e, 0x831b, 0x832a, 0x8308, 0x833c, 0x834d, 0x8316, 0x8324, + 0x8320, 0x8337, 0x832f, 0x8329, 0x8347, 0x8345, 0x834c, 0x8353, + 0x831e, 0x832c, 0x834b, 0x8327, 0x8348, 0x8653, 0x8652, 0x86a2, + 0x86a8, 0x8696, 0x868d, 0x8691, 0x869e, 0x8687, 0x8697, 0x8686, + 0x868b, 0x869a, 0x8685, 0x86a5, 0x8699, 0x86a1, 0x86a7, 0x8695, + 0x8698, 0x868e, 0x869d, 0x8690, 0x8694, 0x8843, 0x8844, 0x886d, + 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887f, 0x886f, 0x8883, + 0x887e, 0x8874, 0x887c, 0x8a12, 0x8c47, 0x8c57, 0x8c7b, 0x8ca4, + 0x8ca3, 0x8d76, 0x8d78, 0x8db5, 0x8db7, 0x8db6, 0x8ed1, 0x8ed3, + 0x8ffe, 0x8ff5, 0x9002, 0x8fff, 0x8ffb, 0x9004, 0x8ffc, 0x8ff6, + 0x90d6, 0x90e0, 0x90d9, 0x90da, 0x90e3, 0x90df, 0x90e5, 0x90d8, + 0x90db, 0x90d7, 0x90dc, 0x90e4, 0x9150, + /* 0xd4 */ + 0x914e, 0x914f, 0x91d5, 0x91e2, 0x91da, 0x965c, 0x965f, 0x96bc, + 0x98e3, 0x9adf, 0x9b2f, 0x4e7f, 0x5070, 0x506a, 0x5061, 0x505e, + 0x5060, 0x5053, 0x504b, 0x505d, 0x5072, 0x5048, 0x504d, 0x5041, + 0x505b, 0x504a, 0x5062, 0x5015, 0x5045, 0x505f, 0x5069, 0x506b, + 0x5063, 0x5064, 0x5046, 0x5040, 0x506e, 0x5073, 0x5057, 0x5051, + 0x51d0, 0x526b, 0x526d, 0x526c, 0x526e, 0x52d6, 0x52d3, 0x532d, + 0x539c, 0x5575, 0x5576, 0x553c, 0x554d, 0x5550, 0x5534, 0x552a, + 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, 0x550c, + 0x5532, 0x5565, 0x554e, 0x5539, 0x5548, 0x552d, 0x553b, 0x5540, + 0x554b, 0x570a, 0x5707, 0x57fb, 0x5814, 0x57e2, 0x57f6, 0x57dc, + 0x57f4, 0x5800, 0x57ed, 0x57fd, 0x5808, 0x57f8, 0x580b, 0x57f3, + 0x57cf, 0x5807, 0x57ee, 0x57e3, 0x57f2, 0x57e5, 0x57ec, 0x57e1, + 0x580e, 0x57fc, 0x5810, 0x57e7, 0x5801, 0x580c, 0x57f1, 0x57e9, + 0x57f0, 0x580d, 0x5804, 0x595c, 0x5a60, 0x5a58, 0x5a55, 0x5a67, + 0x5a5e, 0x5a38, 0x5a35, 0x5a6d, 0x5a50, 0x5a5f, 0x5a65, 0x5a6c, + 0x5a53, 0x5a64, 0x5a57, 0x5a43, 0x5a5d, 0x5a52, 0x5a44, 0x5a5b, + 0x5a48, 0x5a8e, 0x5a3e, 0x5a4d, 0x5a39, 0x5a4c, 0x5a70, 0x5a69, + 0x5a47, 0x5a51, 0x5a56, 0x5a42, 0x5a5c, 0x5b72, 0x5b6e, 0x5bc1, + 0x5bc0, 0x5c59, 0x5d1e, 0x5d0b, 0x5d1d, 0x5d1a, 0x5d20, 0x5d0c, + 0x5d28, 0x5d0d, 0x5d26, 0x5d25, 0x5d0f, + /* 0xd5 */ + 0x5d30, 0x5d12, 0x5d23, 0x5d1f, 0x5d2e, 0x5e3e, 0x5e34, 0x5eb1, + 0x5eb4, 0x5eb9, 0x5eb2, 0x5eb3, 0x5f36, 0x5f38, 0x5f9b, 0x5f96, + 0x5f9f, 0x608a, 0x6090, 0x6086, 0x60be, 0x60b0, 0x60ba, 0x60d3, + 0x60d4, 0x60cf, 0x60e4, 0x60d9, 0x60dd, 0x60c8, 0x60b1, 0x60db, + 0x60b7, 0x60ca, 0x60bf, 0x60c3, 0x60cd, 0x60c0, 0x6332, 0x6365, + 0x638a, 0x6382, 0x637d, 0x63bd, 0x639e, 0x63ad, 0x639d, 0x6397, + 0x63ab, 0x638e, 0x636f, 0x6387, 0x6390, 0x636e, 0x63af, 0x6375, + 0x639c, 0x636d, 0x63ae, 0x637c, 0x63a4, 0x633b, 0x639f, 0x6378, + 0x6385, 0x6381, 0x6391, 0x638d, 0x6370, 0x6553, 0x65cd, 0x6665, + 0x6661, 0x665b, 0x6659, 0x665c, 0x6662, 0x6718, 0x6879, 0x6887, + 0x6890, 0x689c, 0x686d, 0x686e, 0x68ae, 0x68ab, 0x6956, 0x686f, + 0x68a3, 0x68ac, 0x68a9, 0x6875, 0x6874, 0x68b2, 0x688f, 0x6877, + 0x6892, 0x687c, 0x686b, 0x6872, 0x68aa, 0x6880, 0x6871, 0x687e, + 0x689b, 0x6896, 0x688b, 0x68a0, 0x6889, 0x68a4, 0x6878, 0x687b, + 0x6891, 0x688c, 0x688a, 0x687d, 0x6b36, 0x6b33, 0x6b37, 0x6b38, + 0x6b91, 0x6b8f, 0x6b8d, 0x6b8e, 0x6b8c, 0x6c2a, 0x6dc0, 0x6dab, + 0x6db4, 0x6db3, 0x6e74, 0x6dac, 0x6de9, 0x6de2, 0x6db7, 0x6df6, + 0x6dd4, 0x6e00, 0x6dc8, 0x6de0, 0x6ddf, 0x6dd6, 0x6dbe, 0x6de5, + 0x6ddc, 0x6ddd, 0x6ddb, 0x6df4, 0x6dca, 0x6dbd, 0x6ded, 0x6df0, + 0x6dba, 0x6dd5, 0x6dc2, 0x6dcf, 0x6dc9, + /* 0xd6 */ + 0x6dd0, 0x6df2, 0x6dd3, 0x6dfd, 0x6dd7, 0x6dcd, 0x6de3, 0x6dbb, + 0x70fa, 0x710d, 0x70f7, 0x7117, 0x70f4, 0x710c, 0x70f0, 0x7104, + 0x70f3, 0x7110, 0x70fc, 0x70ff, 0x7106, 0x7113, 0x7100, 0x70f8, + 0x70f6, 0x710b, 0x7102, 0x710e, 0x727e, 0x727b, 0x727c, 0x727f, + 0x731d, 0x7317, 0x7307, 0x7311, 0x7318, 0x730a, 0x7308, 0x72ff, + 0x730f, 0x731e, 0x7388, 0x73f6, 0x73f8, 0x73f5, 0x7404, 0x7401, + 0x73fd, 0x7407, 0x7400, 0x73fa, 0x73fc, 0x73ff, 0x740c, 0x740b, + 0x73f4, 0x7408, 0x7564, 0x7563, 0x75ce, 0x75d2, 0x75cf, 0x75cb, + 0x75cc, 0x75d1, 0x75d0, 0x768f, 0x7689, 0x76d3, 0x7739, 0x772f, + 0x772d, 0x7731, 0x7732, 0x7734, 0x7733, 0x773d, 0x7725, 0x773b, + 0x7735, 0x7848, 0x7852, 0x7849, 0x784d, 0x784a, 0x784c, 0x7826, + 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796a, 0x7963, 0x796b, + 0x7961, 0x79bb, 0x79fa, 0x79f8, 0x79f6, 0x79f7, 0x7a8f, 0x7a94, + 0x7a90, 0x7b35, 0x7b47, 0x7b34, 0x7b25, 0x7b30, 0x7b22, 0x7b24, + 0x7b33, 0x7b18, 0x7b2a, 0x7b1d, 0x7b31, 0x7b2b, 0x7b2d, 0x7b2f, + 0x7b32, 0x7b38, 0x7b1a, 0x7b23, 0x7c94, 0x7c98, 0x7c96, 0x7ca3, + 0x7d35, 0x7d3d, 0x7d38, 0x7d36, 0x7d3a, 0x7d45, 0x7d2c, 0x7d29, + 0x7d41, 0x7d47, 0x7d3e, 0x7d3f, 0x7d4a, 0x7d3b, 0x7d28, 0x7f63, + 0x7f95, 0x7f9c, 0x7f9d, 0x7f9b, 0x7fca, 0x7fcb, 0x7fcd, 0x7fd0, + 0x7fd1, 0x7fc7, 0x7fcf, 0x7fc9, 0x801f, + /* 0xd7 */ + 0x801e, 0x801b, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, + 0x811b, 0x812d, 0x811f, 0x812c, 0x811e, 0x8121, 0x8115, 0x8127, + 0x811d, 0x8122, 0x8211, 0x8238, 0x8233, 0x823a, 0x8234, 0x8232, + 0x8274, 0x8390, 0x83a3, 0x83a8, 0x838d, 0x837a, 0x8373, 0x83a4, + 0x8374, 0x838f, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83a9, + 0x837d, 0x8383, 0x838c, 0x839d, 0x839b, 0x83aa, 0x838b, 0x837e, + 0x83a5, 0x83af, 0x8388, 0x8397, 0x83b0, 0x837f, 0x83a6, 0x8387, + 0x83ae, 0x8376, 0x839a, 0x8659, 0x8656, 0x86bf, 0x86b7, 0x86c2, + 0x86c1, 0x86c5, 0x86ba, 0x86b0, 0x86c8, 0x86b9, 0x86b3, 0x86b8, + 0x86cc, 0x86b4, 0x86bb, 0x86bc, 0x86c3, 0x86bd, 0x86be, 0x8852, + 0x8889, 0x8895, 0x88a8, 0x88a2, 0x88aa, 0x889a, 0x8891, 0x88a1, + 0x889f, 0x8898, 0x88a7, 0x8899, 0x889b, 0x8897, 0x88a4, 0x88ac, + 0x888c, 0x8893, 0x888e, 0x8982, 0x89d6, 0x89d9, 0x89d5, 0x8a30, + 0x8a27, 0x8a2c, 0x8a1e, 0x8c39, 0x8c3b, 0x8c5c, 0x8c5d, 0x8c7d, + 0x8ca5, 0x8d7d, 0x8d7b, 0x8d79, 0x8dbc, 0x8dc2, 0x8db9, 0x8dbf, + 0x8dc1, 0x8ed8, 0x8ede, 0x8edd, 0x8edc, 0x8ed7, 0x8ee0, 0x8ee1, + 0x9024, 0x900b, 0x9011, 0x901c, 0x900c, 0x9021, 0x90ef, 0x90ea, + 0x90f0, 0x90f4, 0x90f2, 0x90f3, 0x90d4, 0x90eb, 0x90ec, 0x90e9, + 0x9156, 0x9158, 0x915a, 0x9153, 0x9155, 0x91ec, 0x91f4, 0x91f1, + 0x91f3, 0x91f8, 0x91e4, 0x91f9, 0x91ea, + /* 0xd8 */ + 0x91eb, 0x91f7, 0x91e8, 0x91ee, 0x957a, 0x9586, 0x9588, 0x967c, + 0x966d, 0x966b, 0x9671, 0x966f, 0x96bf, 0x976a, 0x9804, 0x98e5, + 0x9997, 0x509b, 0x5095, 0x5094, 0x509e, 0x508b, 0x50a3, 0x5083, + 0x508c, 0x508e, 0x509d, 0x5068, 0x509c, 0x5092, 0x5082, 0x5087, + 0x515f, 0x51d4, 0x5312, 0x5311, 0x53a4, 0x53a7, 0x5591, 0x55a8, + 0x55a5, 0x55ad, 0x5577, 0x5645, 0x55a2, 0x5593, 0x5588, 0x558f, + 0x55b5, 0x5581, 0x55a3, 0x5592, 0x55a4, 0x557d, 0x558c, 0x55a6, + 0x557f, 0x5595, 0x55a1, 0x558e, 0x570c, 0x5829, 0x5837, 0x5819, + 0x581e, 0x5827, 0x5823, 0x5828, 0x57f5, 0x5848, 0x5825, 0x581c, + 0x581b, 0x5833, 0x583f, 0x5836, 0x582e, 0x5839, 0x5838, 0x582d, + 0x582c, 0x583b, 0x5961, 0x5aaf, 0x5a94, 0x5a9f, 0x5a7a, 0x5aa2, + 0x5a9e, 0x5a78, 0x5aa6, 0x5a7c, 0x5aa5, 0x5aac, 0x5a95, 0x5aae, + 0x5a37, 0x5a84, 0x5a8a, 0x5a97, 0x5a83, 0x5a8b, 0x5aa9, 0x5a7b, + 0x5a7d, 0x5a8c, 0x5a9c, 0x5a8f, 0x5a93, 0x5a9d, 0x5bea, 0x5bcd, + 0x5bcb, 0x5bd4, 0x5bd1, 0x5bca, 0x5bce, 0x5c0c, 0x5c30, 0x5d37, + 0x5d43, 0x5d6b, 0x5d41, 0x5d4b, 0x5d3f, 0x5d35, 0x5d51, 0x5d4e, + 0x5d55, 0x5d33, 0x5d3a, 0x5d52, 0x5d3d, 0x5d31, 0x5d59, 0x5d42, + 0x5d39, 0x5d49, 0x5d38, 0x5d3c, 0x5d32, 0x5d36, 0x5d40, 0x5d45, + 0x5e44, 0x5e41, 0x5f58, 0x5fa6, 0x5fa5, 0x5fab, 0x60c9, 0x60b9, + 0x60cc, 0x60e2, 0x60ce, 0x60c4, 0x6114, + /* 0xd9 */ + 0x60f2, 0x610a, 0x6116, 0x6105, 0x60f5, 0x6113, 0x60f8, 0x60fc, + 0x60fe, 0x60c1, 0x6103, 0x6118, 0x611d, 0x6110, 0x60ff, 0x6104, + 0x610b, 0x624a, 0x6394, 0x63b1, 0x63b0, 0x63ce, 0x63e5, 0x63e8, + 0x63ef, 0x63c3, 0x649d, 0x63f3, 0x63ca, 0x63e0, 0x63f6, 0x63d5, + 0x63f2, 0x63f5, 0x6461, 0x63df, 0x63be, 0x63dd, 0x63dc, 0x63c4, + 0x63d8, 0x63d3, 0x63c2, 0x63c7, 0x63cc, 0x63cb, 0x63c8, 0x63f0, + 0x63d7, 0x63d9, 0x6532, 0x6567, 0x656a, 0x6564, 0x655c, 0x6568, + 0x6565, 0x658c, 0x659d, 0x659e, 0x65ae, 0x65d0, 0x65d2, 0x667c, + 0x666c, 0x667b, 0x6680, 0x6671, 0x6679, 0x666a, 0x6672, 0x6701, + 0x690c, 0x68d3, 0x6904, 0x68dc, 0x692a, 0x68ec, 0x68ea, 0x68f1, + 0x690f, 0x68d6, 0x68f7, 0x68eb, 0x68e4, 0x68f6, 0x6913, 0x6910, + 0x68f3, 0x68e1, 0x6907, 0x68cc, 0x6908, 0x6970, 0x68b4, 0x6911, + 0x68ef, 0x68c6, 0x6914, 0x68f8, 0x68d0, 0x68fd, 0x68fc, 0x68e8, + 0x690b, 0x690a, 0x6917, 0x68ce, 0x68c8, 0x68dd, 0x68de, 0x68e6, + 0x68f4, 0x68d1, 0x6906, 0x68d4, 0x68e9, 0x6915, 0x6925, 0x68c7, + 0x6b39, 0x6b3b, 0x6b3f, 0x6b3c, 0x6b94, 0x6b97, 0x6b99, 0x6b95, + 0x6bbd, 0x6bf0, 0x6bf2, 0x6bf3, 0x6c30, 0x6dfc, 0x6e46, 0x6e47, + 0x6e1f, 0x6e49, 0x6e88, 0x6e3c, 0x6e3d, 0x6e45, 0x6e62, 0x6e2b, + 0x6e3f, 0x6e41, 0x6e5d, 0x6e73, 0x6e1c, 0x6e33, 0x6e4b, 0x6e40, + 0x6e51, 0x6e3b, 0x6e03, 0x6e2e, 0x6e5e, + /* 0xda */ + 0x6e68, 0x6e5c, 0x6e61, 0x6e31, 0x6e28, 0x6e60, 0x6e71, 0x6e6b, + 0x6e39, 0x6e22, 0x6e30, 0x6e53, 0x6e65, 0x6e27, 0x6e78, 0x6e64, + 0x6e77, 0x6e55, 0x6e79, 0x6e52, 0x6e66, 0x6e35, 0x6e36, 0x6e5a, + 0x7120, 0x711e, 0x712f, 0x70fb, 0x712e, 0x7131, 0x7123, 0x7125, + 0x7122, 0x7132, 0x711f, 0x7128, 0x713a, 0x711b, 0x724b, 0x725a, + 0x7288, 0x7289, 0x7286, 0x7285, 0x728b, 0x7312, 0x730b, 0x7330, + 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732d, 0x7326, 0x7323, + 0x7335, 0x730c, 0x742e, 0x742c, 0x7430, 0x742b, 0x7416, 0x741a, + 0x7421, 0x742d, 0x7431, 0x7424, 0x7423, 0x741d, 0x7429, 0x7420, + 0x7432, 0x74fb, 0x752f, 0x756f, 0x756c, 0x75e7, 0x75da, 0x75e1, + 0x75e6, 0x75dd, 0x75df, 0x75e4, 0x75d7, 0x7695, 0x7692, 0x76da, + 0x7746, 0x7747, 0x7744, 0x774d, 0x7745, 0x774a, 0x774e, 0x774b, + 0x774c, 0x77de, 0x77ec, 0x7860, 0x7864, 0x7865, 0x785c, 0x786d, + 0x7871, 0x786a, 0x786e, 0x7870, 0x7869, 0x7868, 0x785e, 0x7862, + 0x7974, 0x7973, 0x7972, 0x7970, 0x7a02, 0x7a0a, 0x7a03, 0x7a0c, + 0x7a04, 0x7a99, 0x7ae6, 0x7ae4, 0x7b4a, 0x7b3b, 0x7b44, 0x7b48, + 0x7b4c, 0x7b4e, 0x7b40, 0x7b58, 0x7b45, 0x7ca2, 0x7c9e, 0x7ca8, + 0x7ca1, 0x7d58, 0x7d6f, 0x7d63, 0x7d53, 0x7d56, 0x7d67, 0x7d6a, + 0x7d4f, 0x7d6d, 0x7d5c, 0x7d6b, 0x7d52, 0x7d54, 0x7d69, 0x7d51, + 0x7d5f, 0x7d4e, 0x7f3e, 0x7f3f, 0x7f65, + /* 0xdb */ + 0x7f66, 0x7fa2, 0x7fa0, 0x7fa1, 0x7fd7, 0x8051, 0x804f, 0x8050, + 0x80fe, 0x80d4, 0x8143, 0x814a, 0x8152, 0x814f, 0x8147, 0x813d, + 0x814d, 0x813a, 0x81e6, 0x81ee, 0x81f7, 0x81f8, 0x81f9, 0x8204, + 0x823c, 0x823d, 0x823f, 0x8275, 0x833b, 0x83cf, 0x83f9, 0x8423, + 0x83c0, 0x83e8, 0x8412, 0x83e7, 0x83e4, 0x83fc, 0x83f6, 0x8410, + 0x83c6, 0x83c8, 0x83eb, 0x83e3, 0x83bf, 0x8401, 0x83dd, 0x83e5, + 0x83d8, 0x83ff, 0x83e1, 0x83cb, 0x83ce, 0x83d6, 0x83f5, 0x83c9, + 0x8409, 0x840f, 0x83de, 0x8411, 0x8406, 0x83c2, 0x83f3, 0x83d5, + 0x83fa, 0x83c7, 0x83d1, 0x83ea, 0x8413, 0x83c3, 0x83ec, 0x83ee, + 0x83c4, 0x83fb, 0x83d7, 0x83e2, 0x841b, 0x83db, 0x83fe, 0x86d8, + 0x86e2, 0x86e6, 0x86d3, 0x86e3, 0x86da, 0x86ea, 0x86dd, 0x86eb, + 0x86dc, 0x86ec, 0x86e9, 0x86d7, 0x86e8, 0x86d1, 0x8848, 0x8856, + 0x8855, 0x88ba, 0x88d7, 0x88b9, 0x88b8, 0x88c0, 0x88be, 0x88b6, + 0x88bc, 0x88b7, 0x88bd, 0x88b2, 0x8901, 0x88c9, 0x8995, 0x8998, + 0x8997, 0x89dd, 0x89da, 0x89db, 0x8a4e, 0x8a4d, 0x8a39, 0x8a59, + 0x8a40, 0x8a57, 0x8a58, 0x8a44, 0x8a45, 0x8a52, 0x8a48, 0x8a51, + 0x8a4a, 0x8a4c, 0x8a4f, 0x8c5f, 0x8c81, 0x8c80, 0x8cba, 0x8cbe, + 0x8cb0, 0x8cb9, 0x8cb5, 0x8d84, 0x8d80, 0x8d89, 0x8dd8, 0x8dd3, + 0x8dcd, 0x8dc7, 0x8dd6, 0x8ddc, 0x8dcf, 0x8dd5, 0x8dd9, 0x8dc8, + 0x8dd7, 0x8dc5, 0x8eef, 0x8ef7, 0x8efa, + /* 0xdc */ + 0x8ef9, 0x8ee6, 0x8eee, 0x8ee5, 0x8ef5, 0x8ee7, 0x8ee8, 0x8ef6, + 0x8eeb, 0x8ef1, 0x8eec, 0x8ef4, 0x8ee9, 0x902d, 0x9034, 0x902f, + 0x9106, 0x912c, 0x9104, 0x90ff, 0x90fc, 0x9108, 0x90f9, 0x90fb, + 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915f, + 0x9162, 0x9160, 0x9201, 0x920a, 0x9225, 0x9203, 0x921a, 0x9226, + 0x920f, 0x920c, 0x9200, 0x9212, 0x91ff, 0x91fd, 0x9206, 0x9204, + 0x9227, 0x9202, 0x921c, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, + 0x957b, 0x958d, 0x958c, 0x9590, 0x9687, 0x967e, 0x9688, 0x9689, + 0x9683, 0x9680, 0x96c2, 0x96c8, 0x96c3, 0x96f1, 0x96f0, 0x976c, + 0x9770, 0x976e, 0x9807, 0x98a9, 0x98eb, 0x9ce6, 0x9ef9, 0x4e83, + 0x4e84, 0x4eb6, 0x50bd, 0x50bf, 0x50c6, 0x50ae, 0x50c4, 0x50ca, + 0x50b4, 0x50c8, 0x50c2, 0x50b0, 0x50c1, 0x50ba, 0x50b1, 0x50cb, + 0x50c9, 0x50b6, 0x50b8, 0x51d7, 0x527a, 0x5278, 0x527b, 0x527c, + 0x55c3, 0x55db, 0x55cc, 0x55d0, 0x55cb, 0x55ca, 0x55dd, 0x55c0, + 0x55d4, 0x55c4, 0x55e9, 0x55bf, 0x55d2, 0x558d, 0x55cf, 0x55d5, + 0x55e2, 0x55d6, 0x55c8, 0x55f2, 0x55cd, 0x55d9, 0x55c2, 0x5714, + 0x5853, 0x5868, 0x5864, 0x584f, 0x584d, 0x5849, 0x586f, 0x5855, + 0x584e, 0x585d, 0x5859, 0x5865, 0x585b, 0x583d, 0x5863, 0x5871, + 0x58fc, 0x5ac7, 0x5ac4, 0x5acb, 0x5aba, 0x5ab8, 0x5ab1, 0x5ab5, + 0x5ab0, 0x5abf, 0x5ac8, 0x5abb, 0x5ac6, + /* 0xdd */ + 0x5ab7, 0x5ac0, 0x5aca, 0x5ab4, 0x5ab6, 0x5acd, 0x5ab9, 0x5a90, + 0x5bd6, 0x5bd8, 0x5bd9, 0x5c1f, 0x5c33, 0x5d71, 0x5d63, 0x5d4a, + 0x5d65, 0x5d72, 0x5d6c, 0x5d5e, 0x5d68, 0x5d67, 0x5d62, 0x5df0, + 0x5e4f, 0x5e4e, 0x5e4a, 0x5e4d, 0x5e4b, 0x5ec5, 0x5ecc, 0x5ec6, + 0x5ecb, 0x5ec7, 0x5f40, 0x5faf, 0x5fad, 0x60f7, 0x6149, 0x614a, + 0x612b, 0x6145, 0x6136, 0x6132, 0x612e, 0x6146, 0x612f, 0x614f, + 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63c5, + 0x63f1, 0x63eb, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, 0x6433, + 0x6443, 0x641f, 0x6415, 0x6418, 0x6439, 0x6437, 0x6422, 0x6423, + 0x640c, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, 0x642f, 0x640a, + 0x641a, 0x6440, 0x6425, 0x6427, 0x640b, 0x63e7, 0x641b, 0x642e, + 0x6421, 0x640e, 0x656f, 0x6592, 0x65d3, 0x6686, 0x668c, 0x6695, + 0x6690, 0x668b, 0x668a, 0x6699, 0x6694, 0x6678, 0x6720, 0x6966, + 0x695f, 0x6938, 0x694e, 0x6962, 0x6971, 0x693f, 0x6945, 0x696a, + 0x6939, 0x6942, 0x6957, 0x6959, 0x697a, 0x6948, 0x6949, 0x6935, + 0x696c, 0x6933, 0x693d, 0x6965, 0x68f0, 0x6978, 0x6934, 0x6969, + 0x6940, 0x696f, 0x6944, 0x6976, 0x6958, 0x6941, 0x6974, 0x694c, + 0x693b, 0x694b, 0x6937, 0x695c, 0x694f, 0x6951, 0x6932, 0x6952, + 0x692f, 0x697b, 0x693c, 0x6b46, 0x6b45, 0x6b43, 0x6b42, 0x6b48, + 0x6b41, 0x6b9b, 0xfa0d, 0x6bfb, 0x6bfc, + /* 0xde */ + 0x6bf9, 0x6bf7, 0x6bf8, 0x6e9b, 0x6ed6, 0x6ec8, 0x6e8f, 0x6ec0, + 0x6e9f, 0x6e93, 0x6e94, 0x6ea0, 0x6eb1, 0x6eb9, 0x6ec6, 0x6ed2, + 0x6ebd, 0x6ec1, 0x6e9e, 0x6ec9, 0x6eb7, 0x6eb0, 0x6ecd, 0x6ea6, + 0x6ecf, 0x6eb2, 0x6ebe, 0x6ec3, 0x6edc, 0x6ed8, 0x6e99, 0x6e92, + 0x6e8e, 0x6e8d, 0x6ea4, 0x6ea1, 0x6ebf, 0x6eb3, 0x6ed0, 0x6eca, + 0x6e97, 0x6eae, 0x6ea3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, + 0x7141, 0x715d, 0x7162, 0x7172, 0x7178, 0x716a, 0x7161, 0x7142, + 0x7158, 0x7143, 0x714b, 0x7170, 0x715f, 0x7150, 0x7153, 0x7144, + 0x714d, 0x715a, 0x724f, 0x728d, 0x728c, 0x7291, 0x7290, 0x728e, + 0x733c, 0x7342, 0x733b, 0x733a, 0x7340, 0x734a, 0x7349, 0x7444, + 0x744a, 0x744b, 0x7452, 0x7451, 0x7457, 0x7440, 0x744f, 0x7450, + 0x744e, 0x7442, 0x7446, 0x744d, 0x7454, 0x74e1, 0x74ff, 0x74fe, + 0x74fd, 0x751d, 0x7579, 0x7577, 0x6983, 0x75ef, 0x760f, 0x7603, + 0x75f7, 0x75fe, 0x75fc, 0x75f9, 0x75f8, 0x7610, 0x75fb, 0x75f6, + 0x75ed, 0x75f5, 0x75fd, 0x7699, 0x76b5, 0x76dd, 0x7755, 0x775f, + 0x7760, 0x7752, 0x7756, 0x775a, 0x7769, 0x7767, 0x7754, 0x7759, + 0x776d, 0x77e0, 0x7887, 0x789a, 0x7894, 0x788f, 0x7884, 0x7895, + 0x7885, 0x7886, 0x78a1, 0x7883, 0x7879, 0x7899, 0x7880, 0x7896, + 0x787b, 0x797c, 0x7982, 0x797d, 0x7979, 0x7a11, 0x7a18, 0x7a19, + 0x7a12, 0x7a17, 0x7a15, 0x7a22, 0x7a13, + /* 0xdf */ + 0x7a1b, 0x7a10, 0x7aa3, 0x7aa2, 0x7a9e, 0x7aeb, 0x7b66, 0x7b64, + 0x7b6d, 0x7b74, 0x7b69, 0x7b72, 0x7b65, 0x7b73, 0x7b71, 0x7b70, + 0x7b61, 0x7b78, 0x7b76, 0x7b63, 0x7cb2, 0x7cb4, 0x7caf, 0x7d88, + 0x7d86, 0x7d80, 0x7d8d, 0x7d7f, 0x7d85, 0x7d7a, 0x7d8e, 0x7d7b, + 0x7d83, 0x7d7c, 0x7d8c, 0x7d94, 0x7d84, 0x7d7d, 0x7d92, 0x7f6d, + 0x7f6b, 0x7f67, 0x7f68, 0x7f6c, 0x7fa6, 0x7fa5, 0x7fa7, 0x7fdb, + 0x7fdc, 0x8021, 0x8164, 0x8160, 0x8177, 0x815c, 0x8169, 0x815b, + 0x8162, 0x8172, 0x6721, 0x815e, 0x8176, 0x8167, 0x816f, 0x8144, + 0x8161, 0x821d, 0x8249, 0x8244, 0x8240, 0x8242, 0x8245, 0x84f1, + 0x843f, 0x8456, 0x8476, 0x8479, 0x848f, 0x848d, 0x8465, 0x8451, + 0x8440, 0x8486, 0x8467, 0x8430, 0x844d, 0x847d, 0x845a, 0x8459, + 0x8474, 0x8473, 0x845d, 0x8507, 0x845e, 0x8437, 0x843a, 0x8434, + 0x847a, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, 0x83d9, 0x844b, + 0x842f, 0x8442, 0x842d, 0x845f, 0x8470, 0x8439, 0x844e, 0x844c, + 0x8452, 0x846f, 0x84c5, 0x848e, 0x843b, 0x8447, 0x8436, 0x8433, + 0x8468, 0x847e, 0x8444, 0x842b, 0x8460, 0x8454, 0x846e, 0x8450, + 0x870b, 0x8704, 0x86f7, 0x870c, 0x86fa, 0x86d6, 0x86f5, 0x874d, + 0x86f8, 0x870e, 0x8709, 0x8701, 0x86f6, 0x870d, 0x8705, 0x88d6, + 0x88cb, 0x88cd, 0x88ce, 0x88de, 0x88db, 0x88da, 0x88cc, 0x88d0, + 0x8985, 0x899b, 0x89df, 0x89e5, 0x89e4, + /* 0xe0 */ + 0x89e1, 0x89e0, 0x89e2, 0x89dc, 0x89e6, 0x8a76, 0x8a86, 0x8a7f, + 0x8a61, 0x8a3f, 0x8a77, 0x8a82, 0x8a84, 0x8a75, 0x8a83, 0x8a81, + 0x8a74, 0x8a7a, 0x8c3c, 0x8c4b, 0x8c4a, 0x8c65, 0x8c64, 0x8c66, + 0x8c86, 0x8c84, 0x8c85, 0x8ccc, 0x8d68, 0x8d69, 0x8d91, 0x8d8c, + 0x8d8e, 0x8d8f, 0x8d8d, 0x8d93, 0x8d94, 0x8d90, 0x8d92, 0x8df0, + 0x8de0, 0x8dec, 0x8df1, 0x8dee, 0x8dd0, 0x8de9, 0x8de3, 0x8de2, + 0x8de7, 0x8df2, 0x8deb, 0x8df4, 0x8f06, 0x8eff, 0x8f01, 0x8f00, + 0x8f05, 0x8f07, 0x8f08, 0x8f02, 0x8f0b, 0x9052, 0x903f, 0x9044, + 0x9049, 0x903d, 0x9110, 0x910d, 0x910f, 0x9111, 0x9116, 0x9114, + 0x910b, 0x910e, 0x916e, 0x916f, 0x9248, 0x9252, 0x9230, 0x923a, + 0x9266, 0x9233, 0x9265, 0x925e, 0x9283, 0x922e, 0x924a, 0x9246, + 0x926d, 0x926c, 0x924f, 0x9260, 0x9267, 0x926f, 0x9236, 0x9261, + 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, 0x924e, 0x9253, + 0x924c, 0x9256, 0x9232, 0x959f, 0x959c, 0x959e, 0x959b, 0x9692, + 0x9693, 0x9691, 0x9697, 0x96ce, 0x96fa, 0x96fd, 0x96f8, 0x96f5, + 0x9773, 0x9777, 0x9778, 0x9772, 0x980f, 0x980d, 0x980e, 0x98ac, + 0x98f6, 0x98f9, 0x99af, 0x99b2, 0x99b0, 0x99b5, 0x9aad, 0x9aab, + 0x9b5b, 0x9cea, 0x9ced, 0x9ce7, 0x9e80, 0x9efd, 0x50e6, 0x50d4, + 0x50d7, 0x50e8, 0x50f3, 0x50db, 0x50ea, 0x50dd, 0x50e4, 0x50d3, + 0x50ec, 0x50f0, 0x50ef, 0x50e3, 0x50e0, + /* 0xe1 */ + 0x51d8, 0x5280, 0x5281, 0x52e9, 0x52eb, 0x5330, 0x53ac, 0x5627, + 0x5615, 0x560c, 0x5612, 0x55fc, 0x560f, 0x561c, 0x5601, 0x5613, + 0x5602, 0x55fa, 0x561d, 0x5604, 0x55ff, 0x55f9, 0x5889, 0x587c, + 0x5890, 0x5898, 0x5886, 0x5881, 0x587f, 0x5874, 0x588b, 0x587a, + 0x5887, 0x5891, 0x588e, 0x5876, 0x5882, 0x5888, 0x587b, 0x5894, + 0x588f, 0x58fe, 0x596b, 0x5adc, 0x5aee, 0x5ae5, 0x5ad5, 0x5aea, + 0x5ada, 0x5aed, 0x5aeb, 0x5af3, 0x5ae2, 0x5ae0, 0x5adb, 0x5aec, + 0x5ade, 0x5add, 0x5ad9, 0x5ae8, 0x5adf, 0x5b77, 0x5be0, 0x5be3, + 0x5c63, 0x5d82, 0x5d80, 0x5d7d, 0x5d86, 0x5d7a, 0x5d81, 0x5d77, + 0x5d8a, 0x5d89, 0x5d88, 0x5d7e, 0x5d7c, 0x5d8d, 0x5d79, 0x5d7f, + 0x5e58, 0x5e59, 0x5e53, 0x5ed8, 0x5ed1, 0x5ed7, 0x5ece, 0x5edc, + 0x5ed5, 0x5ed9, 0x5ed2, 0x5ed4, 0x5f44, 0x5f43, 0x5f6f, 0x5fb6, + 0x612c, 0x6128, 0x6141, 0x615e, 0x6171, 0x6173, 0x6152, 0x6153, + 0x6172, 0x616c, 0x6180, 0x6174, 0x6154, 0x617a, 0x615b, 0x6165, + 0x613b, 0x616a, 0x6161, 0x6156, 0x6229, 0x6227, 0x622b, 0x642b, + 0x644d, 0x645b, 0x645d, 0x6474, 0x6476, 0x6472, 0x6473, 0x647d, + 0x6475, 0x6466, 0x64a6, 0x644e, 0x6482, 0x645e, 0x645c, 0x644b, + 0x6453, 0x6460, 0x6450, 0x647f, 0x643f, 0x646c, 0x646b, 0x6459, + 0x6465, 0x6477, 0x6573, 0x65a0, 0x66a1, 0x66a0, 0x669f, 0x6705, + 0x6704, 0x6722, 0x69b1, 0x69b6, 0x69c9, + /* 0xe2 */ + 0x69a0, 0x69ce, 0x6996, 0x69b0, 0x69ac, 0x69bc, 0x6991, 0x6999, + 0x698e, 0x69a7, 0x698d, 0x69a9, 0x69be, 0x69af, 0x69bf, 0x69c4, + 0x69bd, 0x69a4, 0x69d4, 0x69b9, 0x69ca, 0x699a, 0x69cf, 0x69b3, + 0x6993, 0x69aa, 0x69a1, 0x699e, 0x69d9, 0x6997, 0x6990, 0x69c2, + 0x69b5, 0x69a5, 0x69c6, 0x6b4a, 0x6b4d, 0x6b4b, 0x6b9e, 0x6b9f, + 0x6ba0, 0x6bc3, 0x6bc4, 0x6bfe, 0x6ece, 0x6ef5, 0x6ef1, 0x6f03, + 0x6f25, 0x6ef8, 0x6f37, 0x6efb, 0x6f2e, 0x6f09, 0x6f4e, 0x6f19, + 0x6f1a, 0x6f27, 0x6f18, 0x6f3b, 0x6f12, 0x6eed, 0x6f0a, 0x6f36, + 0x6f73, 0x6ef9, 0x6eee, 0x6f2d, 0x6f40, 0x6f30, 0x6f3c, 0x6f35, + 0x6eeb, 0x6f07, 0x6f0e, 0x6f43, 0x6f05, 0x6efd, 0x6ef6, 0x6f39, + 0x6f1c, 0x6efc, 0x6f3a, 0x6f1f, 0x6f0d, 0x6f1e, 0x6f08, 0x6f21, + 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, 0x718f, 0x717b, + 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, 0x7295, 0x7293, + 0x7343, 0x734d, 0x7351, 0x734c, 0x7462, 0x7473, 0x7471, 0x7475, + 0x7472, 0x7467, 0x746e, 0x7500, 0x7502, 0x7503, 0x757d, 0x7590, + 0x7616, 0x7608, 0x760c, 0x7615, 0x7611, 0x760a, 0x7614, 0x76b8, + 0x7781, 0x777c, 0x7785, 0x7782, 0x776e, 0x7780, 0x776f, 0x777e, + 0x7783, 0x78b2, 0x78aa, 0x78b4, 0x78ad, 0x78a8, 0x787e, 0x78ab, + 0x789e, 0x78a5, 0x78a0, 0x78ac, 0x78a2, 0x78a4, 0x7998, 0x798a, + 0x798b, 0x7996, 0x7995, 0x7994, 0x7993, + /* 0xe3 */ + 0x7997, 0x7988, 0x7992, 0x7990, 0x7a2b, 0x7a4a, 0x7a30, 0x7a2f, + 0x7a28, 0x7a26, 0x7aa8, 0x7aab, 0x7aac, 0x7aee, 0x7b88, 0x7b9c, + 0x7b8a, 0x7b91, 0x7b90, 0x7b96, 0x7b8d, 0x7b8c, 0x7b9b, 0x7b8e, + 0x7b85, 0x7b98, 0x5284, 0x7b99, 0x7ba4, 0x7b82, 0x7cbb, 0x7cbf, + 0x7cbc, 0x7cba, 0x7da7, 0x7db7, 0x7dc2, 0x7da3, 0x7daa, 0x7dc1, + 0x7dc0, 0x7dc5, 0x7d9d, 0x7dce, 0x7dc4, 0x7dc6, 0x7dcb, 0x7dcc, + 0x7daf, 0x7db9, 0x7d96, 0x7dbc, 0x7d9f, 0x7da6, 0x7dae, 0x7da9, + 0x7da1, 0x7dc9, 0x7f73, 0x7fe2, 0x7fe3, 0x7fe5, 0x7fde, 0x8024, + 0x805d, 0x805c, 0x8189, 0x8186, 0x8183, 0x8187, 0x818d, 0x818c, + 0x818b, 0x8215, 0x8497, 0x84a4, 0x84a1, 0x849f, 0x84ba, 0x84ce, + 0x84c2, 0x84ac, 0x84ae, 0x84ab, 0x84b9, 0x84b4, 0x84c1, 0x84cd, + 0x84aa, 0x849a, 0x84b1, 0x84d0, 0x849d, 0x84a7, 0x84bb, 0x84a2, + 0x8494, 0x84c7, 0x84cc, 0x849b, 0x84a9, 0x84af, 0x84a8, 0x84d6, + 0x8498, 0x84b6, 0x84cf, 0x84a0, 0x84d7, 0x84d4, 0x84d2, 0x84db, + 0x84b0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, 0x876b, 0x8740, + 0x872e, 0x871e, 0x8721, 0x8719, 0x871b, 0x8743, 0x872c, 0x8741, + 0x873e, 0x8746, 0x8720, 0x8732, 0x872a, 0x872d, 0x873c, 0x8712, + 0x873a, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, 0x8738, 0x8724, + 0x871a, 0x8730, 0x8711, 0x88f7, 0x88e7, 0x88f1, 0x88f2, 0x88fa, + 0x88fe, 0x88ee, 0x88fc, 0x88f6, 0x88fb, + /* 0xe4 */ + 0x88f0, 0x88ec, 0x88eb, 0x899d, 0x89a1, 0x899f, 0x899e, 0x89e9, + 0x89eb, 0x89e8, 0x8aab, 0x8a99, 0x8a8b, 0x8a92, 0x8a8f, 0x8a96, + 0x8c3d, 0x8c68, 0x8c69, 0x8cd5, 0x8ccf, 0x8cd7, 0x8d96, 0x8e09, + 0x8e02, 0x8dff, 0x8e0d, 0x8dfd, 0x8e0a, 0x8e03, 0x8e07, 0x8e06, + 0x8e05, 0x8dfe, 0x8e00, 0x8e04, 0x8f10, 0x8f11, 0x8f0e, 0x8f0d, + 0x9123, 0x911c, 0x9120, 0x9122, 0x911f, 0x911d, 0x911a, 0x9124, + 0x9121, 0x911b, 0x917a, 0x9172, 0x9179, 0x9173, 0x92a5, 0x92a4, + 0x9276, 0x929b, 0x927a, 0x92a0, 0x9294, 0x92aa, 0x928d, 0x92a6, + 0x929a, 0x92ab, 0x9279, 0x9297, 0x927f, 0x92a3, 0x92ee, 0x928e, + 0x9282, 0x9295, 0x92a2, 0x927d, 0x9288, 0x92a1, 0x928a, 0x9286, + 0x928c, 0x9299, 0x92a7, 0x927e, 0x9287, 0x92a9, 0x929d, 0x928b, + 0x922d, 0x969e, 0x96a1, 0x96ff, 0x9758, 0x977d, 0x977a, 0x977e, + 0x9783, 0x9780, 0x9782, 0x977b, 0x9784, 0x9781, 0x977f, 0x97ce, + 0x97cd, 0x9816, 0x98ad, 0x98ae, 0x9902, 0x9900, 0x9907, 0x999d, + 0x999c, 0x99c3, 0x99b9, 0x99bb, 0x99ba, 0x99c2, 0x99bd, 0x99c7, + 0x9ab1, 0x9ae3, 0x9ae7, 0x9b3e, 0x9b3f, 0x9b60, 0x9b61, 0x9b5f, + 0x9cf1, 0x9cf2, 0x9cf5, 0x9ea7, 0x50ff, 0x5103, 0x5130, 0x50f8, + 0x5106, 0x5107, 0x50f6, 0x50fe, 0x510b, 0x510c, 0x50fd, 0x510a, + 0x528b, 0x528c, 0x52f1, 0x52ef, 0x5648, 0x5642, 0x564c, 0x5635, + 0x5641, 0x564a, 0x5649, 0x5646, 0x5658, + /* 0xe5 */ + 0x565a, 0x5640, 0x5633, 0x563d, 0x562c, 0x563e, 0x5638, 0x562a, + 0x563a, 0x571a, 0x58ab, 0x589d, 0x58b1, 0x58a0, 0x58a3, 0x58af, + 0x58ac, 0x58a5, 0x58a1, 0x58ff, 0x5aff, 0x5af4, 0x5afd, 0x5af7, + 0x5af6, 0x5b03, 0x5af8, 0x5b02, 0x5af9, 0x5b01, 0x5b07, 0x5b05, + 0x5b0f, 0x5c67, 0x5d99, 0x5d97, 0x5d9f, 0x5d92, 0x5da2, 0x5d93, + 0x5d95, 0x5da0, 0x5d9c, 0x5da1, 0x5d9a, 0x5d9e, 0x5e69, 0x5e5d, + 0x5e60, 0x5e5c, 0x7df3, 0x5edb, 0x5ede, 0x5ee1, 0x5f49, 0x5fb2, + 0x618b, 0x6183, 0x6179, 0x61b1, 0x61b0, 0x61a2, 0x6189, 0x619b, + 0x6193, 0x61af, 0x61ad, 0x619f, 0x6192, 0x61aa, 0x61a1, 0x618d, + 0x6166, 0x61b3, 0x622d, 0x646e, 0x6470, 0x6496, 0x64a0, 0x6485, + 0x6497, 0x649c, 0x648f, 0x648b, 0x648a, 0x648c, 0x64a3, 0x649f, + 0x6468, 0x64b1, 0x6498, 0x6576, 0x657a, 0x6579, 0x657b, 0x65b2, + 0x65b3, 0x66b5, 0x66b0, 0x66a9, 0x66b2, 0x66b7, 0x66aa, 0x66af, + 0x6a00, 0x6a06, 0x6a17, 0x69e5, 0x69f8, 0x6a15, 0x69f1, 0x69e4, + 0x6a20, 0x69ff, 0x69ec, 0x69e2, 0x6a1b, 0x6a1d, 0x69fe, 0x6a27, + 0x69f2, 0x69ee, 0x6a14, 0x69f7, 0x69e7, 0x6a40, 0x6a08, 0x69e6, + 0x69fb, 0x6a0d, 0x69fc, 0x69eb, 0x6a09, 0x6a04, 0x6a18, 0x6a25, + 0x6a0f, 0x69f6, 0x6a26, 0x6a07, 0x69f4, 0x6a16, 0x6b51, 0x6ba5, + 0x6ba3, 0x6ba2, 0x6ba6, 0x6c01, 0x6c00, 0x6bff, 0x6c02, 0x6f41, + 0x6f26, 0x6f7e, 0x6f87, 0x6fc6, 0x6f92, + /* 0xe6 */ + 0x6f8d, 0x6f89, 0x6f8c, 0x6f62, 0x6f4f, 0x6f85, 0x6f5a, 0x6f96, + 0x6f76, 0x6f6c, 0x6f82, 0x6f55, 0x6f72, 0x6f52, 0x6f50, 0x6f57, + 0x6f94, 0x6f93, 0x6f5d, 0x6f00, 0x6f61, 0x6f6b, 0x6f7d, 0x6f67, + 0x6f90, 0x6f53, 0x6f8b, 0x6f69, 0x6f7f, 0x6f95, 0x6f63, 0x6f77, + 0x6f6a, 0x6f7b, 0x71b2, 0x71af, 0x719b, 0x71b0, 0x71a0, 0x719a, + 0x71a9, 0x71b5, 0x719d, 0x71a5, 0x719e, 0x71a4, 0x71a1, 0x71aa, + 0x719c, 0x71a7, 0x71b3, 0x7298, 0x729a, 0x7358, 0x7352, 0x735e, + 0x735f, 0x7360, 0x735d, 0x735b, 0x7361, 0x735a, 0x7359, 0x7362, + 0x7487, 0x7489, 0x748a, 0x7486, 0x7481, 0x747d, 0x7485, 0x7488, + 0x747c, 0x7479, 0x7508, 0x7507, 0x757e, 0x7625, 0x761e, 0x7619, + 0x761d, 0x761c, 0x7623, 0x761a, 0x7628, 0x761b, 0x769c, 0x769d, + 0x769e, 0x769b, 0x778d, 0x778f, 0x7789, 0x7788, 0x78cd, 0x78bb, + 0x78cf, 0x78cc, 0x78d1, 0x78ce, 0x78d4, 0x78c8, 0x78c3, 0x78c4, + 0x78c9, 0x799a, 0x79a1, 0x79a0, 0x799c, 0x79a2, 0x799b, 0x6b76, + 0x7a39, 0x7ab2, 0x7ab4, 0x7ab3, 0x7bb7, 0x7bcb, 0x7bbe, 0x7bac, + 0x7bce, 0x7baf, 0x7bb9, 0x7bca, 0x7bb5, 0x7cc5, 0x7cc8, 0x7ccc, + 0x7ccb, 0x7df7, 0x7ddb, 0x7dea, 0x7de7, 0x7dd7, 0x7de1, 0x7e03, + 0x7dfa, 0x7de6, 0x7df6, 0x7df1, 0x7df0, 0x7dee, 0x7ddf, 0x7f76, + 0x7fac, 0x7fb0, 0x7fad, 0x7fed, 0x7feb, 0x7fea, 0x7fec, 0x7fe6, + 0x7fe8, 0x8064, 0x8067, 0x81a3, 0x819f, + /* 0xe7 */ + 0x819e, 0x8195, 0x81a2, 0x8199, 0x8197, 0x8216, 0x824f, 0x8253, + 0x8252, 0x8250, 0x824e, 0x8251, 0x8524, 0x853b, 0x850f, 0x8500, + 0x8529, 0x850e, 0x8509, 0x850d, 0x851f, 0x850a, 0x8527, 0x851c, + 0x84fb, 0x852b, 0x84fa, 0x8508, 0x850c, 0x84f4, 0x852a, 0x84f2, + 0x8515, 0x84f7, 0x84eb, 0x84f3, 0x84fc, 0x8512, 0x84ea, 0x84e9, + 0x8516, 0x84fe, 0x8528, 0x851d, 0x852e, 0x8502, 0x84fd, 0x851e, + 0x84f6, 0x8531, 0x8526, 0x84e7, 0x84e8, 0x84f0, 0x84ef, 0x84f9, + 0x8518, 0x8520, 0x8530, 0x850b, 0x8519, 0x852f, 0x8662, 0x8756, + 0x8763, 0x8764, 0x8777, 0x87e1, 0x8773, 0x8758, 0x8754, 0x875b, + 0x8752, 0x8761, 0x875a, 0x8751, 0x875e, 0x876d, 0x876a, 0x8750, + 0x874e, 0x875f, 0x875d, 0x876f, 0x876c, 0x877a, 0x876e, 0x875c, + 0x8765, 0x874f, 0x877b, 0x8775, 0x8762, 0x8767, 0x8769, 0x885a, + 0x8905, 0x890c, 0x8914, 0x890b, 0x8917, 0x8918, 0x8919, 0x8906, + 0x8916, 0x8911, 0x890e, 0x8909, 0x89a2, 0x89a4, 0x89a3, 0x89ed, + 0x89f0, 0x89ec, 0x8acf, 0x8ac6, 0x8ab8, 0x8ad3, 0x8ad1, 0x8ad4, + 0x8ad5, 0x8abb, 0x8ad7, 0x8abe, 0x8ac0, 0x8ac5, 0x8ad8, 0x8ac3, + 0x8aba, 0x8abd, 0x8ad9, 0x8c3e, 0x8c4d, 0x8c8f, 0x8ce5, 0x8cdf, + 0x8cd9, 0x8ce8, 0x8cda, 0x8cdd, 0x8ce7, 0x8da0, 0x8d9c, 0x8da1, + 0x8d9b, 0x8e20, 0x8e23, 0x8e25, 0x8e24, 0x8e2e, 0x8e15, 0x8e1b, + 0x8e16, 0x8e11, 0x8e19, 0x8e26, 0x8e27, + /* 0xe8 */ + 0x8e14, 0x8e12, 0x8e18, 0x8e13, 0x8e1c, 0x8e17, 0x8e1a, 0x8f2c, + 0x8f24, 0x8f18, 0x8f1a, 0x8f20, 0x8f23, 0x8f16, 0x8f17, 0x9073, + 0x9070, 0x906f, 0x9067, 0x906b, 0x912f, 0x912b, 0x9129, 0x912a, + 0x9132, 0x9126, 0x912e, 0x9185, 0x9186, 0x918a, 0x9181, 0x9182, + 0x9184, 0x9180, 0x92d0, 0x92c3, 0x92c4, 0x92c0, 0x92d9, 0x92b6, + 0x92cf, 0x92f1, 0x92df, 0x92d8, 0x92e9, 0x92d7, 0x92dd, 0x92cc, + 0x92ef, 0x92c2, 0x92e8, 0x92ca, 0x92c8, 0x92ce, 0x92e6, 0x92cd, + 0x92d5, 0x92c9, 0x92e0, 0x92de, 0x92e7, 0x92d1, 0x92d3, 0x92b5, + 0x92e1, 0x92c6, 0x92b4, 0x957c, 0x95ac, 0x95ab, 0x95ae, 0x95b0, + 0x96a4, 0x96a2, 0x96d3, 0x9705, 0x9708, 0x9702, 0x975a, 0x978a, + 0x978e, 0x9788, 0x97d0, 0x97cf, 0x981e, 0x981d, 0x9826, 0x9829, + 0x9828, 0x9820, 0x981b, 0x9827, 0x98b2, 0x9908, 0x98fa, 0x9911, + 0x9914, 0x9916, 0x9917, 0x9915, 0x99dc, 0x99cd, 0x99cf, 0x99d3, + 0x99d4, 0x99ce, 0x99c9, 0x99d6, 0x99d8, 0x99cb, 0x99d7, 0x99cc, + 0x9ab3, 0x9aec, 0x9aeb, 0x9af3, 0x9af2, 0x9af1, 0x9b46, 0x9b43, + 0x9b67, 0x9b74, 0x9b71, 0x9b66, 0x9b76, 0x9b75, 0x9b70, 0x9b68, + 0x9b64, 0x9b6c, 0x9cfc, 0x9cfa, 0x9cfd, 0x9cff, 0x9cf7, 0x9d07, + 0x9d00, 0x9cf9, 0x9cfb, 0x9d08, 0x9d05, 0x9d04, 0x9e83, 0x9ed3, + 0x9f0f, 0x9f10, 0x511c, 0x5113, 0x5117, 0x511a, 0x5111, 0x51de, + 0x5334, 0x53e1, 0x5670, 0x5660, 0x566e, + /* 0xe9 */ + 0x5673, 0x5666, 0x5663, 0x566d, 0x5672, 0x565e, 0x5677, 0x571c, + 0x571b, 0x58c8, 0x58bd, 0x58c9, 0x58bf, 0x58ba, 0x58c2, 0x58bc, + 0x58c6, 0x5b17, 0x5b19, 0x5b1b, 0x5b21, 0x5b14, 0x5b13, 0x5b10, + 0x5b16, 0x5b28, 0x5b1a, 0x5b20, 0x5b1e, 0x5bef, 0x5dac, 0x5db1, + 0x5da9, 0x5da7, 0x5db5, 0x5db0, 0x5dae, 0x5daa, 0x5da8, 0x5db2, + 0x5dad, 0x5daf, 0x5db4, 0x5e67, 0x5e68, 0x5e66, 0x5e6f, 0x5ee9, + 0x5ee7, 0x5ee6, 0x5ee8, 0x5ee5, 0x5f4b, 0x5fbc, 0x619d, 0x61a8, + 0x6196, 0x61c5, 0x61b4, 0x61c6, 0x61c1, 0x61cc, 0x61ba, 0x61bf, + 0x61b8, 0x618c, 0x64d7, 0x64d6, 0x64d0, 0x64cf, 0x64c9, 0x64bd, + 0x6489, 0x64c3, 0x64db, 0x64f3, 0x64d9, 0x6533, 0x657f, 0x657c, + 0x65a2, 0x66c8, 0x66be, 0x66c0, 0x66ca, 0x66cb, 0x66cf, 0x66bd, + 0x66bb, 0x66ba, 0x66cc, 0x6723, 0x6a34, 0x6a66, 0x6a49, 0x6a67, + 0x6a32, 0x6a68, 0x6a3e, 0x6a5d, 0x6a6d, 0x6a76, 0x6a5b, 0x6a51, + 0x6a28, 0x6a5a, 0x6a3b, 0x6a3f, 0x6a41, 0x6a6a, 0x6a64, 0x6a50, + 0x6a4f, 0x6a54, 0x6a6f, 0x6a69, 0x6a60, 0x6a3c, 0x6a5e, 0x6a56, + 0x6a55, 0x6a4d, 0x6a4e, 0x6a46, 0x6b55, 0x6b54, 0x6b56, 0x6ba7, + 0x6baa, 0x6bab, 0x6bc8, 0x6bc7, 0x6c04, 0x6c03, 0x6c06, 0x6fad, + 0x6fcb, 0x6fa3, 0x6fc7, 0x6fbc, 0x6fce, 0x6fc8, 0x6f5e, 0x6fc4, + 0x6fbd, 0x6f9e, 0x6fca, 0x6fa8, 0x7004, 0x6fa5, 0x6fae, 0x6fba, + 0x6fac, 0x6faa, 0x6fcf, 0x6fbf, 0x6fb8, + /* 0xea */ + 0x6fa2, 0x6fc9, 0x6fab, 0x6fcd, 0x6faf, 0x6fb2, 0x6fb0, 0x71c5, + 0x71c2, 0x71bf, 0x71b8, 0x71d6, 0x71c0, 0x71c1, 0x71cb, 0x71d4, + 0x71ca, 0x71c7, 0x71cf, 0x71bd, 0x71d8, 0x71bc, 0x71c6, 0x71da, + 0x71db, 0x729d, 0x729e, 0x7369, 0x7366, 0x7367, 0x736c, 0x7365, + 0x736b, 0x736a, 0x747f, 0x749a, 0x74a0, 0x7494, 0x7492, 0x7495, + 0x74a1, 0x750b, 0x7580, 0x762f, 0x762d, 0x7631, 0x763d, 0x7633, + 0x763c, 0x7635, 0x7632, 0x7630, 0x76bb, 0x76e6, 0x779a, 0x779d, + 0x77a1, 0x779c, 0x779b, 0x77a2, 0x77a3, 0x7795, 0x7799, 0x7797, + 0x78dd, 0x78e9, 0x78e5, 0x78ea, 0x78de, 0x78e3, 0x78db, 0x78e1, + 0x78e2, 0x78ed, 0x78df, 0x78e0, 0x79a4, 0x7a44, 0x7a48, 0x7a47, + 0x7ab6, 0x7ab8, 0x7ab5, 0x7ab1, 0x7ab7, 0x7bde, 0x7be3, 0x7be7, + 0x7bdd, 0x7bd5, 0x7be5, 0x7bda, 0x7be8, 0x7bf9, 0x7bd4, 0x7bea, + 0x7be2, 0x7bdc, 0x7beb, 0x7bd8, 0x7bdf, 0x7cd2, 0x7cd4, 0x7cd7, + 0x7cd0, 0x7cd1, 0x7e12, 0x7e21, 0x7e17, 0x7e0c, 0x7e1f, 0x7e20, + 0x7e13, 0x7e0e, 0x7e1c, 0x7e15, 0x7e1a, 0x7e22, 0x7e0b, 0x7e0f, + 0x7e16, 0x7e0d, 0x7e14, 0x7e25, 0x7e24, 0x7f43, 0x7f7b, 0x7f7c, + 0x7f7a, 0x7fb1, 0x7fef, 0x802a, 0x8029, 0x806c, 0x81b1, 0x81a6, + 0x81ae, 0x81b9, 0x81b5, 0x81ab, 0x81b0, 0x81ac, 0x81b4, 0x81b2, + 0x81b7, 0x81a7, 0x81f2, 0x8255, 0x8256, 0x8257, 0x8556, 0x8545, + 0x856b, 0x854d, 0x8553, 0x8561, 0x8558, + /* 0xeb */ + 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, + 0x8563, 0x853e, 0x855b, 0x8571, 0x854e, 0x856e, 0x8575, 0x8555, + 0x8567, 0x8560, 0x858c, 0x8566, 0x855d, 0x8554, 0x8565, 0x856c, + 0x8663, 0x8665, 0x8664, 0x879b, 0x878f, 0x8797, 0x8793, 0x8792, + 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87a3, 0x8785, + 0x8790, 0x8791, 0x879d, 0x8784, 0x8794, 0x879c, 0x879a, 0x8789, + 0x891e, 0x8926, 0x8930, 0x892d, 0x892e, 0x8927, 0x8931, 0x8922, + 0x8929, 0x8923, 0x892f, 0x892c, 0x891f, 0x89f1, 0x8ae0, 0x8ae2, + 0x8af2, 0x8af4, 0x8af5, 0x8add, 0x8b14, 0x8ae4, 0x8adf, 0x8af0, + 0x8ac8, 0x8ade, 0x8ae1, 0x8ae8, 0x8aff, 0x8aef, 0x8afb, 0x8c91, + 0x8c92, 0x8c90, 0x8cf5, 0x8cee, 0x8cf1, 0x8cf0, 0x8cf3, 0x8d6c, + 0x8d6e, 0x8da5, 0x8da7, 0x8e33, 0x8e3e, 0x8e38, 0x8e40, 0x8e45, + 0x8e36, 0x8e3c, 0x8e3d, 0x8e41, 0x8e30, 0x8e3f, 0x8ebd, 0x8f36, + 0x8f2e, 0x8f35, 0x8f32, 0x8f39, 0x8f37, 0x8f34, 0x9076, 0x9079, + 0x907b, 0x9086, 0x90fa, 0x9133, 0x9135, 0x9136, 0x9193, 0x9190, + 0x9191, 0x918d, 0x918f, 0x9327, 0x931e, 0x9308, 0x931f, 0x9306, + 0x930f, 0x937a, 0x9338, 0x933c, 0x931b, 0x9323, 0x9312, 0x9301, + 0x9346, 0x932d, 0x930e, 0x930d, 0x92cb, 0x931d, 0x92fa, 0x9325, + 0x9313, 0x92f9, 0x92f7, 0x9334, 0x9302, 0x9324, 0x92ff, 0x9329, + 0x9339, 0x9335, 0x932a, 0x9314, 0x930c, + /* 0xec */ + 0x930b, 0x92fe, 0x9309, 0x9300, 0x92fb, 0x9316, 0x95bc, 0x95cd, + 0x95be, 0x95b9, 0x95ba, 0x95b6, 0x95bf, 0x95b5, 0x95bd, 0x96a9, + 0x96d4, 0x970b, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97f0, + 0x97f8, 0x9835, 0x982f, 0x9832, 0x9924, 0x991f, 0x9927, 0x9929, + 0x999e, 0x99ee, 0x99ec, 0x99e5, 0x99e4, 0x99f0, 0x99e3, 0x99ea, + 0x99e9, 0x99e7, 0x9ab9, 0x9abf, 0x9ab4, 0x9abb, 0x9af6, 0x9afa, + 0x9af9, 0x9af7, 0x9b33, 0x9b80, 0x9b85, 0x9b87, 0x9b7c, 0x9b7e, + 0x9b7b, 0x9b82, 0x9b93, 0x9b92, 0x9b90, 0x9b7a, 0x9b95, 0x9b7d, + 0x9b88, 0x9d25, 0x9d17, 0x9d20, 0x9d1e, 0x9d14, 0x9d29, 0x9d1d, + 0x9d18, 0x9d22, 0x9d10, 0x9d19, 0x9d1f, 0x9e88, 0x9e86, 0x9e87, + 0x9eae, 0x9ead, 0x9ed5, 0x9ed6, 0x9efa, 0x9f12, 0x9f3d, 0x5126, + 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52f4, 0x5693, 0x568c, + 0x568d, 0x5686, 0x5684, 0x5683, 0x567e, 0x5682, 0x567f, 0x5681, + 0x58d6, 0x58d4, 0x58cf, 0x58d2, 0x5b2d, 0x5b25, 0x5b32, 0x5b23, + 0x5b2c, 0x5b27, 0x5b26, 0x5b2f, 0x5b2e, 0x5b7b, 0x5bf1, 0x5bf2, + 0x5db7, 0x5e6c, 0x5e6a, 0x5fbe, 0x5fbb, 0x61c3, 0x61b5, 0x61bc, + 0x61e7, 0x61e0, 0x61e5, 0x61e4, 0x61e8, 0x61de, 0x64ef, 0x64e9, + 0x64e3, 0x64eb, 0x64e4, 0x64e8, 0x6581, 0x6580, 0x65b6, 0x65da, + 0x66d2, 0x6a8d, 0x6a96, 0x6a81, 0x6aa5, 0x6a89, 0x6a9f, 0x6a9b, + 0x6aa1, 0x6a9e, 0x6a87, 0x6a93, 0x6a8e, + /* 0xed */ + 0x6a95, 0x6a83, 0x6aa8, 0x6aa4, 0x6a91, 0x6a7f, 0x6aa6, 0x6a9a, + 0x6a85, 0x6a8c, 0x6a92, 0x6b5b, 0x6bad, 0x6c09, 0x6fcc, 0x6fa9, + 0x6ff4, 0x6fd4, 0x6fe3, 0x6fdc, 0x6fed, 0x6fe7, 0x6fe6, 0x6fde, + 0x6ff2, 0x6fdd, 0x6fe2, 0x6fe8, 0x71e1, 0x71f1, 0x71e8, 0x71f2, + 0x71e4, 0x71f0, 0x71e2, 0x7373, 0x736e, 0x736f, 0x7497, 0x74b2, + 0x74ab, 0x7490, 0x74aa, 0x74ad, 0x74b1, 0x74a5, 0x74af, 0x7510, + 0x7511, 0x7512, 0x750f, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, + 0x76a4, 0x76e9, 0x77b5, 0x77ab, 0x77b2, 0x77b7, 0x77b6, 0x77b4, + 0x77b1, 0x77a8, 0x77f0, 0x78f3, 0x78fd, 0x7902, 0x78fb, 0x78fc, + 0x78f2, 0x7905, 0x78f9, 0x78fe, 0x7904, 0x79ab, 0x79a8, 0x7a5c, + 0x7a5b, 0x7a56, 0x7a58, 0x7a54, 0x7a5a, 0x7abe, 0x7ac0, 0x7ac1, + 0x7c05, 0x7c0f, 0x7bf2, 0x7c00, 0x7bff, 0x7bfb, 0x7c0e, 0x7bf4, + 0x7c0b, 0x7bf3, 0x7c02, 0x7c09, 0x7c03, 0x7c01, 0x7bf8, 0x7bfd, + 0x7c06, 0x7bf0, 0x7bf1, 0x7c10, 0x7c0a, 0x7ce8, 0x7e2d, 0x7e3c, + 0x7e42, 0x7e33, 0x9848, 0x7e38, 0x7e2a, 0x7e49, 0x7e40, 0x7e47, + 0x7e29, 0x7e4c, 0x7e30, 0x7e3b, 0x7e36, 0x7e44, 0x7e3a, 0x7f45, + 0x7f7f, 0x7f7e, 0x7f7d, 0x7ff4, 0x7ff2, 0x802c, 0x81bb, 0x81c4, + 0x81cc, 0x81ca, 0x81c5, 0x81c7, 0x81bc, 0x81e9, 0x825b, 0x825a, + 0x825c, 0x8583, 0x8580, 0x858f, 0x85a7, 0x8595, 0x85a0, 0x858b, + 0x85a3, 0x857b, 0x85a4, 0x859a, 0x859e, + /* 0xee */ + 0x8577, 0x857c, 0x8589, 0x85a1, 0x857a, 0x8578, 0x8557, 0x858e, + 0x8596, 0x8586, 0x858d, 0x8599, 0x859d, 0x8581, 0x85a2, 0x8582, + 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859f, 0x8668, + 0x87be, 0x87aa, 0x87ad, 0x87c5, 0x87b0, 0x87ac, 0x87b9, 0x87b5, + 0x87bc, 0x87ae, 0x87c9, 0x87c3, 0x87c2, 0x87cc, 0x87b7, 0x87af, + 0x87c4, 0x87ca, 0x87b4, 0x87b6, 0x87bf, 0x87b8, 0x87bd, 0x87de, + 0x87b2, 0x8935, 0x8933, 0x893c, 0x893e, 0x8941, 0x8952, 0x8937, + 0x8942, 0x89ad, 0x89af, 0x89ae, 0x89f2, 0x89f3, 0x8b1e, 0x8b18, + 0x8b16, 0x8b11, 0x8b05, 0x8b0b, 0x8b22, 0x8b0f, 0x8b12, 0x8b15, + 0x8b07, 0x8b0d, 0x8b08, 0x8b06, 0x8b1c, 0x8b13, 0x8b1a, 0x8c4f, + 0x8c70, 0x8c72, 0x8c71, 0x8c6f, 0x8c95, 0x8c94, 0x8cf9, 0x8d6f, + 0x8e4e, 0x8e4d, 0x8e53, 0x8e50, 0x8e4c, 0x8e47, 0x8f43, 0x8f40, + 0x9085, 0x907e, 0x9138, 0x919a, 0x91a2, 0x919b, 0x9199, 0x919f, + 0x91a1, 0x919d, 0x91a0, 0x93a1, 0x9383, 0x93af, 0x9364, 0x9356, + 0x9347, 0x937c, 0x9358, 0x935c, 0x9376, 0x9349, 0x9350, 0x9351, + 0x9360, 0x936d, 0x938f, 0x934c, 0x936a, 0x9379, 0x9357, 0x9355, + 0x9352, 0x934f, 0x9371, 0x9377, 0x937b, 0x9361, 0x935e, 0x9363, + 0x9367, 0x9380, 0x934e, 0x9359, 0x95c7, 0x95c0, 0x95c9, 0x95c3, + 0x95c5, 0x95b7, 0x96ae, 0x96b0, 0x96ac, 0x9720, 0x971f, 0x9718, + 0x971d, 0x9719, 0x979a, 0x97a1, 0x979c, + /* 0xef */ + 0x979e, 0x979d, 0x97d5, 0x97d4, 0x97f1, 0x9841, 0x9844, 0x984a, + 0x9849, 0x9845, 0x9843, 0x9925, 0x992b, 0x992c, 0x992a, 0x9933, + 0x9932, 0x992f, 0x992d, 0x9931, 0x9930, 0x9998, 0x99a3, 0x99a1, + 0x9a02, 0x99fa, 0x99f4, 0x99f7, 0x99f9, 0x99f8, 0x99f6, 0x99fb, + 0x99fd, 0x99fe, 0x99fc, 0x9a03, 0x9abe, 0x9afe, 0x9afd, 0x9b01, + 0x9afc, 0x9b48, 0x9b9a, 0x9ba8, 0x9b9e, 0x9b9b, 0x9ba6, 0x9ba1, + 0x9ba5, 0x9ba4, 0x9b86, 0x9ba2, 0x9ba0, 0x9baf, 0x9d33, 0x9d41, + 0x9d67, 0x9d36, 0x9d2e, 0x9d2f, 0x9d31, 0x9d38, 0x9d30, 0x9d45, + 0x9d42, 0x9d43, 0x9d3e, 0x9d37, 0x9d40, 0x9d3d, 0x7ff5, 0x9d2d, + 0x9e8a, 0x9e89, 0x9e8d, 0x9eb0, 0x9ec8, 0x9eda, 0x9efb, 0x9eff, + 0x9f24, 0x9f23, 0x9f22, 0x9f54, 0x9fa0, 0x5131, 0x512d, 0x512e, + 0x5698, 0x569c, 0x5697, 0x569a, 0x569d, 0x5699, 0x5970, 0x5b3c, + 0x5c69, 0x5c6a, 0x5dc0, 0x5e6d, 0x5e6e, 0x61d8, 0x61df, 0x61ed, + 0x61ee, 0x61f1, 0x61ea, 0x61f0, 0x61eb, 0x61d6, 0x61e9, 0x64ff, + 0x6504, 0x64fd, 0x64f8, 0x6501, 0x6503, 0x64fc, 0x6594, 0x65db, + 0x66da, 0x66db, 0x66d8, 0x6ac5, 0x6ab9, 0x6abd, 0x6ae1, 0x6ac6, + 0x6aba, 0x6ab6, 0x6ab7, 0x6ac7, 0x6ab4, 0x6aad, 0x6b5e, 0x6bc9, + 0x6c0b, 0x7007, 0x700c, 0x700d, 0x7001, 0x7005, 0x7014, 0x700e, + 0x6fff, 0x7000, 0x6ffb, 0x7026, 0x6ffc, 0x6ff7, 0x700a, 0x7201, + 0x71ff, 0x71f9, 0x7203, 0x71fd, 0x7376, + /* 0xf0 */ + 0x74b8, 0x74c0, 0x74b5, 0x74c1, 0x74be, 0x74b6, 0x74bb, 0x74c2, + 0x7514, 0x7513, 0x765c, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, + 0x765a, 0x76a6, 0x76bd, 0x76ec, 0x77c2, 0x77ba, 0x78ff, 0x790c, + 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79ad, 0x79ac, + 0x7a5f, 0x7c1c, 0x7c29, 0x7c19, 0x7c20, 0x7c1f, 0x7c2d, 0x7c1d, + 0x7c26, 0x7c28, 0x7c22, 0x7c25, 0x7c30, 0x7e5c, 0x7e50, 0x7e56, + 0x7e63, 0x7e58, 0x7e62, 0x7e5f, 0x7e51, 0x7e60, 0x7e57, 0x7e53, + 0x7fb5, 0x7fb3, 0x7ff7, 0x7ff8, 0x8075, 0x81d1, 0x81d2, 0x81d0, + 0x825f, 0x825e, 0x85b4, 0x85c6, 0x85c0, 0x85c3, 0x85c2, 0x85b3, + 0x85b5, 0x85bd, 0x85c7, 0x85c4, 0x85bf, 0x85cb, 0x85ce, 0x85c8, + 0x85c5, 0x85b1, 0x85b6, 0x85d2, 0x8624, 0x85b8, 0x85b7, 0x85be, + 0x8669, 0x87e7, 0x87e6, 0x87e2, 0x87db, 0x87eb, 0x87ea, 0x87e5, + 0x87df, 0x87f3, 0x87e4, 0x87d4, 0x87dc, 0x87d3, 0x87ed, 0x87d8, + 0x87e3, 0x87a4, 0x87d7, 0x87d9, 0x8801, 0x87f4, 0x87e8, 0x87dd, + 0x8953, 0x894b, 0x894f, 0x894c, 0x8946, 0x8950, 0x8951, 0x8949, + 0x8b2a, 0x8b27, 0x8b23, 0x8b33, 0x8b30, 0x8b35, 0x8b47, 0x8b2f, + 0x8b3c, 0x8b3e, 0x8b31, 0x8b25, 0x8b37, 0x8b26, 0x8b36, 0x8b2e, + 0x8b24, 0x8b3b, 0x8b3d, 0x8b3a, 0x8c42, 0x8c75, 0x8c99, 0x8c98, + 0x8c97, 0x8cfe, 0x8d04, 0x8d02, 0x8d00, 0x8e5c, 0x8e62, 0x8e60, + 0x8e57, 0x8e56, 0x8e5e, 0x8e65, 0x8e67, + /* 0xf1 */ + 0x8e5b, 0x8e5a, 0x8e61, 0x8e5d, 0x8e69, 0x8e54, 0x8f46, 0x8f47, + 0x8f48, 0x8f4b, 0x9128, 0x913a, 0x913b, 0x913e, 0x91a8, 0x91a5, + 0x91a7, 0x91af, 0x91aa, 0x93b5, 0x938c, 0x9392, 0x93b7, 0x939b, + 0x939d, 0x9389, 0x93a7, 0x938e, 0x93aa, 0x939e, 0x93a6, 0x9395, + 0x9388, 0x9399, 0x939f, 0x938d, 0x93b1, 0x9391, 0x93b2, 0x93a4, + 0x93a8, 0x93b4, 0x93a3, 0x93a5, 0x95d2, 0x95d3, 0x95d1, 0x96b3, + 0x96d7, 0x96da, 0x5dc2, 0x96df, 0x96d8, 0x96dd, 0x9723, 0x9722, + 0x9725, 0x97ac, 0x97ae, 0x97a8, 0x97ab, 0x97a4, 0x97aa, 0x97a2, + 0x97a5, 0x97d7, 0x97d9, 0x97d6, 0x97d8, 0x97fa, 0x9850, 0x9851, + 0x9852, 0x98b8, 0x9941, 0x993c, 0x993a, 0x9a0f, 0x9a0b, 0x9a09, + 0x9a0d, 0x9a04, 0x9a11, 0x9a0a, 0x9a05, 0x9a07, 0x9a06, 0x9ac0, + 0x9adc, 0x9b08, 0x9b04, 0x9b05, 0x9b29, 0x9b35, 0x9b4a, 0x9b4c, + 0x9b4b, 0x9bc7, 0x9bc6, 0x9bc3, 0x9bbf, 0x9bc1, 0x9bb5, 0x9bb8, + 0x9bd3, 0x9bb6, 0x9bc4, 0x9bb9, 0x9bbd, 0x9d5c, 0x9d53, 0x9d4f, + 0x9d4a, 0x9d5b, 0x9d4b, 0x9d59, 0x9d56, 0x9d4c, 0x9d57, 0x9d52, + 0x9d54, 0x9d5f, 0x9d58, 0x9d5a, 0x9e8e, 0x9e8c, 0x9edf, 0x9f01, + 0x9f00, 0x9f16, 0x9f25, 0x9f2b, 0x9f2a, 0x9f29, 0x9f28, 0x9f4c, + 0x9f55, 0x5134, 0x5135, 0x5296, 0x52f7, 0x53b4, 0x56ab, 0x56ad, + 0x56a6, 0x56a7, 0x56aa, 0x56ac, 0x58da, 0x58dd, 0x58db, 0x5912, + 0x5b3d, 0x5b3e, 0x5b3f, 0x5dc3, 0x5e70, + /* 0xf2 */ + 0x5fbf, 0x61fb, 0x6507, 0x6510, 0x650d, 0x6509, 0x650c, 0x650e, + 0x6584, 0x65de, 0x65dd, 0x66de, 0x6ae7, 0x6ae0, 0x6acc, 0x6ad1, + 0x6ad9, 0x6acb, 0x6adf, 0x6adc, 0x6ad0, 0x6aeb, 0x6acf, 0x6acd, + 0x6ade, 0x6b60, 0x6bb0, 0x6c0c, 0x7019, 0x7027, 0x7020, 0x7016, + 0x702b, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701c, + 0x702a, 0x720c, 0x720a, 0x7207, 0x7202, 0x7205, 0x72a5, 0x72a6, + 0x72a4, 0x72a3, 0x72a1, 0x74cb, 0x74c5, 0x74b7, 0x74c3, 0x7516, + 0x7660, 0x77c9, 0x77ca, 0x77c4, 0x77f1, 0x791d, 0x791b, 0x7921, + 0x791c, 0x7917, 0x791e, 0x79b0, 0x7a67, 0x7a68, 0x7c33, 0x7c3c, + 0x7c39, 0x7c2c, 0x7c3b, 0x7cec, 0x7cea, 0x7e76, 0x7e75, 0x7e78, + 0x7e70, 0x7e77, 0x7e6f, 0x7e7a, 0x7e72, 0x7e74, 0x7e68, 0x7f4b, + 0x7f4a, 0x7f83, 0x7f86, 0x7fb7, 0x7ffd, 0x7ffe, 0x8078, 0x81d7, + 0x81d5, 0x8264, 0x8261, 0x8263, 0x85eb, 0x85f1, 0x85ed, 0x85d9, + 0x85e1, 0x85e8, 0x85da, 0x85d7, 0x85ec, 0x85f2, 0x85f8, 0x85d8, + 0x85df, 0x85e3, 0x85dc, 0x85d1, 0x85f0, 0x85e6, 0x85ef, 0x85de, + 0x85e2, 0x8800, 0x87fa, 0x8803, 0x87f6, 0x87f7, 0x8809, 0x880c, + 0x880b, 0x8806, 0x87fc, 0x8808, 0x87ff, 0x880a, 0x8802, 0x8962, + 0x895a, 0x895b, 0x8957, 0x8961, 0x895c, 0x8958, 0x895d, 0x8959, + 0x8988, 0x89b7, 0x89b6, 0x89f6, 0x8b50, 0x8b48, 0x8b4a, 0x8b40, + 0x8b53, 0x8b56, 0x8b54, 0x8b4b, 0x8b55, + /* 0xf3 */ + 0x8b51, 0x8b42, 0x8b52, 0x8b57, 0x8c43, 0x8c77, 0x8c76, 0x8c9a, + 0x8d06, 0x8d07, 0x8d09, 0x8dac, 0x8daa, 0x8dad, 0x8dab, 0x8e6d, + 0x8e78, 0x8e73, 0x8e6a, 0x8e6f, 0x8e7b, 0x8ec2, 0x8f52, 0x8f51, + 0x8f4f, 0x8f50, 0x8f53, 0x8fb4, 0x9140, 0x913f, 0x91b0, 0x91ad, + 0x93de, 0x93c7, 0x93cf, 0x93c2, 0x93da, 0x93d0, 0x93f9, 0x93ec, + 0x93cc, 0x93d9, 0x93a9, 0x93e6, 0x93ca, 0x93d4, 0x93ee, 0x93e3, + 0x93d5, 0x93c4, 0x93ce, 0x93c0, 0x93d2, 0x93e7, 0x957d, 0x95da, + 0x95db, 0x96e1, 0x9729, 0x972b, 0x972c, 0x9728, 0x9726, 0x97b3, + 0x97b7, 0x97b6, 0x97dd, 0x97de, 0x97df, 0x985c, 0x9859, 0x985d, + 0x9857, 0x98bf, 0x98bd, 0x98bb, 0x98be, 0x9948, 0x9947, 0x9943, + 0x99a6, 0x99a7, 0x9a1a, 0x9a15, 0x9a25, 0x9a1d, 0x9a24, 0x9a1b, + 0x9a22, 0x9a20, 0x9a27, 0x9a23, 0x9a1e, 0x9a1c, 0x9a14, 0x9ac2, + 0x9b0b, 0x9b0a, 0x9b0e, 0x9b0c, 0x9b37, 0x9bea, 0x9beb, 0x9be0, + 0x9bde, 0x9be4, 0x9be6, 0x9be2, 0x9bf0, 0x9bd4, 0x9bd7, 0x9bec, + 0x9bdc, 0x9bd9, 0x9be5, 0x9bd5, 0x9be1, 0x9bda, 0x9d77, 0x9d81, + 0x9d8a, 0x9d84, 0x9d88, 0x9d71, 0x9d80, 0x9d78, 0x9d86, 0x9d8b, + 0x9d8c, 0x9d7d, 0x9d6b, 0x9d74, 0x9d75, 0x9d70, 0x9d69, 0x9d85, + 0x9d73, 0x9d7b, 0x9d82, 0x9d6f, 0x9d79, 0x9d7f, 0x9d87, 0x9d68, + 0x9e94, 0x9e91, 0x9ec0, 0x9efc, 0x9f2d, 0x9f40, 0x9f41, 0x9f4d, + 0x9f56, 0x9f57, 0x9f58, 0x5337, 0x56b2, + /* 0xf4 */ + 0x56b5, 0x56b3, 0x58e3, 0x5b45, 0x5dc6, 0x5dc7, 0x5eee, 0x5eef, + 0x5fc0, 0x5fc1, 0x61f9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65df, + 0x66e8, 0x66e3, 0x66e4, 0x6af3, 0x6af0, 0x6aea, 0x6ae8, 0x6af9, + 0x6af1, 0x6aee, 0x6aef, 0x703c, 0x7035, 0x702f, 0x7037, 0x7034, + 0x7031, 0x7042, 0x7038, 0x703f, 0x703a, 0x7039, 0x7040, 0x703b, + 0x7033, 0x7041, 0x7213, 0x7214, 0x72a8, 0x737d, 0x737c, 0x74ba, + 0x76ab, 0x76aa, 0x76be, 0x76ed, 0x77cc, 0x77ce, 0x77cf, 0x77cd, + 0x77f2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, 0x79b2, + 0x7a6e, 0x7a6c, 0x7a6d, 0x7af7, 0x7c49, 0x7c48, 0x7c4a, 0x7c47, + 0x7c45, 0x7cee, 0x7e7b, 0x7e7e, 0x7e81, 0x7e80, 0x7fba, 0x7fff, + 0x8079, 0x81db, 0x81d9, 0x820b, 0x8268, 0x8269, 0x8622, 0x85ff, + 0x8601, 0x85fe, 0x861b, 0x8600, 0x85f6, 0x8604, 0x8609, 0x8605, + 0x860c, 0x85fd, 0x8819, 0x8810, 0x8811, 0x8817, 0x8813, 0x8816, + 0x8963, 0x8966, 0x89b9, 0x89f7, 0x8b60, 0x8b6a, 0x8b5d, 0x8b68, + 0x8b63, 0x8b65, 0x8b67, 0x8b6d, 0x8dae, 0x8e86, 0x8e88, 0x8e84, + 0x8f59, 0x8f56, 0x8f57, 0x8f55, 0x8f58, 0x8f5a, 0x908d, 0x9143, + 0x9141, 0x91b7, 0x91b5, 0x91b2, 0x91b3, 0x940b, 0x9413, 0x93fb, + 0x9420, 0x940f, 0x9414, 0x93fe, 0x9415, 0x9410, 0x9428, 0x9419, + 0x940d, 0x93f5, 0x9400, 0x93f7, 0x9407, 0x940e, 0x9416, 0x9412, + 0x93fa, 0x9409, 0x93f8, 0x940a, 0x93ff, + /* 0xf5 */ + 0x93fc, 0x940c, 0x93f6, 0x9411, 0x9406, 0x95de, 0x95e0, 0x95df, + 0x972e, 0x972f, 0x97b9, 0x97bb, 0x97fd, 0x97fe, 0x9860, 0x9862, + 0x9863, 0x985f, 0x98c1, 0x98c2, 0x9950, 0x994e, 0x9959, 0x994c, + 0x994b, 0x9953, 0x9a32, 0x9a34, 0x9a31, 0x9a2c, 0x9a2a, 0x9a36, + 0x9a29, 0x9a2e, 0x9a38, 0x9a2d, 0x9ac7, 0x9aca, 0x9ac6, 0x9b10, + 0x9b12, 0x9b11, 0x9c0b, 0x9c08, 0x9bf7, 0x9c05, 0x9c12, 0x9bf8, + 0x9c40, 0x9c07, 0x9c0e, 0x9c06, 0x9c17, 0x9c14, 0x9c09, 0x9d9f, + 0x9d99, 0x9da4, 0x9d9d, 0x9d92, 0x9d98, 0x9d90, 0x9d9b, 0x9da0, + 0x9d94, 0x9d9c, 0x9daa, 0x9d97, 0x9da1, 0x9d9a, 0x9da2, 0x9da8, + 0x9d9e, 0x9da3, 0x9dbf, 0x9da9, 0x9d96, 0x9da6, 0x9da7, 0x9e99, + 0x9e9b, 0x9e9a, 0x9ee5, 0x9ee4, 0x9ee7, 0x9ee6, 0x9f30, 0x9f2e, + 0x9f5b, 0x9f60, 0x9f5e, 0x9f5d, 0x9f59, 0x9f91, 0x513a, 0x5139, + 0x5298, 0x5297, 0x56c3, 0x56bd, 0x56be, 0x5b48, 0x5b47, 0x5dcb, + 0x5dcf, 0x5ef1, 0x61fd, 0x651b, 0x6b02, 0x6afc, 0x6b03, 0x6af8, + 0x6b00, 0x7043, 0x7044, 0x704a, 0x7048, 0x7049, 0x7045, 0x7046, + 0x721d, 0x721a, 0x7219, 0x737e, 0x7517, 0x766a, 0x77d0, 0x792d, + 0x7931, 0x792f, 0x7c54, 0x7c53, 0x7cf2, 0x7e8a, 0x7e87, 0x7e88, + 0x7e8b, 0x7e86, 0x7e8d, 0x7f4d, 0x7fbb, 0x8030, 0x81dd, 0x8618, + 0x862a, 0x8626, 0x861f, 0x8623, 0x861c, 0x8619, 0x8627, 0x862e, + 0x8621, 0x8620, 0x8629, 0x861e, 0x8625, + /* 0xf6 */ + 0x8829, 0x881d, 0x881b, 0x8820, 0x8824, 0x881c, 0x882b, 0x884a, + 0x896d, 0x8969, 0x896e, 0x896b, 0x89fa, 0x8b79, 0x8b78, 0x8b45, + 0x8b7a, 0x8b7b, 0x8d10, 0x8d14, 0x8daf, 0x8e8e, 0x8e8c, 0x8f5e, + 0x8f5b, 0x8f5d, 0x9146, 0x9144, 0x9145, 0x91b9, 0x943f, 0x943b, + 0x9436, 0x9429, 0x943d, 0x943c, 0x9430, 0x9439, 0x942a, 0x9437, + 0x942c, 0x9440, 0x9431, 0x95e5, 0x95e4, 0x95e3, 0x9735, 0x973a, + 0x97bf, 0x97e1, 0x9864, 0x98c9, 0x98c6, 0x98c0, 0x9958, 0x9956, + 0x9a39, 0x9a3d, 0x9a46, 0x9a44, 0x9a42, 0x9a41, 0x9a3a, 0x9a3f, + 0x9acd, 0x9b15, 0x9b17, 0x9b18, 0x9b16, 0x9b3a, 0x9b52, 0x9c2b, + 0x9c1d, 0x9c1c, 0x9c2c, 0x9c23, 0x9c28, 0x9c29, 0x9c24, 0x9c21, + 0x9db7, 0x9db6, 0x9dbc, 0x9dc1, 0x9dc7, 0x9dca, 0x9dcf, 0x9dbe, + 0x9dc5, 0x9dc3, 0x9dbb, 0x9db5, 0x9dce, 0x9db9, 0x9dba, 0x9dac, + 0x9dc8, 0x9db1, 0x9dad, 0x9dcc, 0x9db3, 0x9dcd, 0x9db2, 0x9e7a, + 0x9e9c, 0x9eeb, 0x9eee, 0x9eed, 0x9f1b, 0x9f18, 0x9f1a, 0x9f31, + 0x9f4e, 0x9f65, 0x9f64, 0x9f92, 0x4eb9, 0x56c6, 0x56c5, 0x56cb, + 0x5971, 0x5b4b, 0x5b4c, 0x5dd5, 0x5dd1, 0x5ef2, 0x6521, 0x6520, + 0x6526, 0x6522, 0x6b0b, 0x6b08, 0x6b09, 0x6c0d, 0x7055, 0x7056, + 0x7057, 0x7052, 0x721e, 0x721f, 0x72a9, 0x737f, 0x74d8, 0x74d5, + 0x74d9, 0x74d7, 0x766d, 0x76ad, 0x7935, 0x79b4, 0x7a70, 0x7a71, + 0x7c57, 0x7c5c, 0x7c59, 0x7c5b, 0x7c5a, + /* 0xf7 */ + 0x7cf4, 0x7cf1, 0x7e91, 0x7f4f, 0x7f87, 0x81de, 0x826b, 0x8634, + 0x8635, 0x8633, 0x862c, 0x8632, 0x8636, 0x882c, 0x8828, 0x8826, + 0x882a, 0x8825, 0x8971, 0x89bf, 0x89be, 0x89fb, 0x8b7e, 0x8b84, + 0x8b82, 0x8b86, 0x8b85, 0x8b7f, 0x8d15, 0x8e95, 0x8e94, 0x8e9a, + 0x8e92, 0x8e90, 0x8e96, 0x8e97, 0x8f60, 0x8f62, 0x9147, 0x944c, + 0x9450, 0x944a, 0x944b, 0x944f, 0x9447, 0x9445, 0x9448, 0x9449, + 0x9446, 0x973f, 0x97e3, 0x986a, 0x9869, 0x98cb, 0x9954, 0x995b, + 0x9a4e, 0x9a53, 0x9a54, 0x9a4c, 0x9a4f, 0x9a48, 0x9a4a, 0x9a49, + 0x9a52, 0x9a50, 0x9ad0, 0x9b19, 0x9b2b, 0x9b3b, 0x9b56, 0x9b55, + 0x9c46, 0x9c48, 0x9c3f, 0x9c44, 0x9c39, 0x9c33, 0x9c41, 0x9c3c, + 0x9c37, 0x9c34, 0x9c32, 0x9c3d, 0x9c36, 0x9ddb, 0x9dd2, 0x9dde, + 0x9dda, 0x9dcb, 0x9dd0, 0x9ddc, 0x9dd1, 0x9ddf, 0x9de9, 0x9dd9, + 0x9dd8, 0x9dd6, 0x9df5, 0x9dd5, 0x9ddd, 0x9eb6, 0x9ef0, 0x9f35, + 0x9f33, 0x9f32, 0x9f42, 0x9f6b, 0x9f95, 0x9fa2, 0x513d, 0x5299, + 0x58e8, 0x58e7, 0x5972, 0x5b4d, 0x5dd8, 0x882f, 0x5f4f, 0x6201, + 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66eb, 0x6b11, 0x6b12, + 0x6b0f, 0x6bca, 0x705b, 0x705a, 0x7222, 0x7382, 0x7381, 0x7383, + 0x7670, 0x77d4, 0x7c67, 0x7c66, 0x7e95, 0x826c, 0x863a, 0x8640, + 0x8639, 0x863c, 0x8631, 0x863b, 0x863e, 0x8830, 0x8832, 0x882e, + 0x8833, 0x8976, 0x8974, 0x8973, 0x89fe, + /* 0xf8 */ + 0x8b8c, 0x8b8e, 0x8b8b, 0x8b88, 0x8c45, 0x8d19, 0x8e98, 0x8f64, + 0x8f63, 0x91bc, 0x9462, 0x9455, 0x945d, 0x9457, 0x945e, 0x97c4, + 0x97c5, 0x9800, 0x9a56, 0x9a59, 0x9b1e, 0x9b1f, 0x9b20, 0x9c52, + 0x9c58, 0x9c50, 0x9c4a, 0x9c4d, 0x9c4b, 0x9c55, 0x9c59, 0x9c4c, + 0x9c4e, 0x9dfb, 0x9df7, 0x9def, 0x9de3, 0x9deb, 0x9df8, 0x9de4, + 0x9df6, 0x9de1, 0x9dee, 0x9de6, 0x9df2, 0x9df0, 0x9de2, 0x9dec, + 0x9df4, 0x9df3, 0x9de8, 0x9ded, 0x9ec2, 0x9ed0, 0x9ef2, 0x9ef3, + 0x9f06, 0x9f1c, 0x9f38, 0x9f37, 0x9f36, 0x9f43, 0x9f4f, 0x9f71, + 0x9f70, 0x9f6e, 0x9f6f, 0x56d3, 0x56cd, 0x5b4e, 0x5c6d, 0x652d, + 0x66ed, 0x66ee, 0x6b13, 0x705f, 0x7061, 0x705d, 0x7060, 0x7223, + 0x74db, 0x74e5, 0x77d5, 0x7938, 0x79b7, 0x79b6, 0x7c6a, 0x7e97, + 0x7f89, 0x826d, 0x8643, 0x8838, 0x8837, 0x8835, 0x884b, 0x8b94, + 0x8b95, 0x8e9e, 0x8e9f, 0x8ea0, 0x8e9d, 0x91be, 0x91bd, 0x91c2, + 0x946b, 0x9468, 0x9469, 0x96e5, 0x9746, 0x9743, 0x9747, 0x97c7, + 0x97e5, 0x9a5e, 0x9ad5, 0x9b59, 0x9c63, 0x9c67, 0x9c66, 0x9c62, + 0x9c5e, 0x9c60, 0x9e02, 0x9dfe, 0x9e07, 0x9e03, 0x9e06, 0x9e05, + 0x9e00, 0x9e01, 0x9e09, 0x9dff, 0x9dfd, 0x9e04, 0x9ea0, 0x9f1e, + 0x9f46, 0x9f74, 0x9f75, 0x9f76, 0x56d4, 0x652e, 0x65b8, 0x6b18, + 0x6b19, 0x6b17, 0x6b1a, 0x7062, 0x7226, 0x72aa, 0x77d8, 0x77d9, + 0x7939, 0x7c69, 0x7c6b, 0x7cf6, 0x7e9a, + /* 0xf9 */ + 0x7e98, 0x7e9b, 0x7e99, 0x81e0, 0x81e1, 0x8646, 0x8647, 0x8648, + 0x8979, 0x897a, 0x897c, 0x897b, 0x89ff, 0x8b98, 0x8b99, 0x8ea5, + 0x8ea4, 0x8ea3, 0x946e, 0x946d, 0x946f, 0x9471, 0x9473, 0x9749, + 0x9872, 0x995f, 0x9c68, 0x9c6e, 0x9c6d, 0x9e0b, 0x9e0d, 0x9e10, + 0x9e0f, 0x9e12, 0x9e11, 0x9ea1, 0x9ef5, 0x9f09, 0x9f47, 0x9f78, + 0x9f7b, 0x9f7a, 0x9f79, 0x571e, 0x7066, 0x7c6f, 0x883c, 0x8db2, + 0x8ea6, 0x91c3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9a60, 0x9c74, + 0x9c73, 0x9c71, 0x9c75, 0x9e14, 0x9e13, 0x9ef6, 0x9f0a, 0x9fa4, + 0x7068, 0x7065, 0x7cf7, 0x866a, 0x883e, 0x883d, 0x883f, 0x8b9e, + 0x8c9c, 0x8ea9, 0x8ec9, 0x974b, 0x9873, 0x9874, 0x98cc, 0x9961, + 0x99ab, 0x9a64, 0x9a66, 0x9a67, 0x9b24, 0x9e15, 0x9e17, 0x9f48, + 0x6207, 0x6b1e, 0x7227, 0x864c, 0x8ea8, 0x9482, 0x9480, 0x9481, + 0x9a69, 0x9a68, 0x9b2e, 0x9e19, 0x7229, 0x864b, 0x8b9f, 0x9483, + 0x9c79, 0x9eb7, 0x7675, 0x9a6b, 0x9c7a, 0x9e1d, 0x7069, 0x706a, + 0x9ea4, 0x9f7e, 0x9f49, 0x9f98, +}; + +static int +big5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = s[0]; + if ((c1 >= 0xa1 && c1 <= 0xc7) || (c1 >= 0xc9 && c1 <= 0xf9)) { + if (n >= 2) { + unsigned char c2 = s[1]; + if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { + unsigned int i = 157 * (c1 - 0xa1) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); + unsigned short wc = 0xfffd; + if (i < 6280) { + if (i < 6121) + wc = big5_2uni_pagea1[i]; + } else { + if (i < 13932) + wc = big5_2uni_pagec9[i-6280]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short big5_2charset[13703] = { + 0xa246, 0xa247, 0xa244, 0xa1b1, 0xa258, 0xa1d3, 0xa150, 0xa1d1, + 0xa1d2, 0xa3be, 0xa3bc, 0xa3bd, 0xa3bf, 0xa3bb, 0xa344, 0xa345, + 0xa346, 0xa347, 0xa348, 0xa349, 0xa34a, 0xa34b, 0xa34c, 0xa34d, + 0xa34e, 0xa34f, 0xa350, 0xa351, 0xa352, 0xa353, 0xa354, 0xa355, + 0xa356, 0xa357, 0xa358, 0xa359, 0xa35a, 0xa35b, 0xa35c, 0xa35d, + 0xa35e, 0xa35f, 0xa360, 0xa361, 0xa362, 0xa363, 0xa364, 0xa365, + 0xa366, 0xa367, 0xa368, 0xa369, 0xa36a, 0xa36b, 0xa36c, 0xa36d, + 0xa36e, 0xa36f, 0xa370, 0xa371, 0xa372, 0xa373, 0xc7b3, 0xc7b1, + 0xc7b2, 0xc7b4, 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, + 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, + 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, + 0xc7cb, 0xc7cc, 0xc7cd, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, + 0xc7d4, 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, + 0xc7dc, 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, + 0xc7e4, 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7ce, 0xa156, 0xa158, + 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, 0xa145, 0xa14c, 0xa14b, 0xa1ac, + 0xa1ab, 0xa1b0, 0xa1c2, 0xa24a, 0xa1c1, 0xa24b, 0xa2b9, 0xa2ba, + 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, 0xa2c1, 0xa2c2, + 0xa1f6, 0xa1f4, 0xa1f7, 0xa1f5, 0xa1f8, 0xa1f9, 0xa1fb, 0xa1fa, + 0xa1d4, 0xa1db, 0xa1e8, 0xa1e7, 0xa1fd, 0xa1fc, 0xa1e4, 0xa1e5, + 0xa1ec, 0xa1ed, 0xa1ef, 0xa1ee, 0xa1e3, 0xa1dc, 0xa1da, 0xa1dd, + 0xa1d8, 0xa1d9, 0xa1e6, 0xa1e9, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, + 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc7f3, 0xc7f4, + 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, 0xc7f9, 0xc7fa, 0xc7fb, 0xc7fc, + 0xa277, 0xa278, 0xa27a, 0xa27b, 0xa27c, 0xa27d, 0xa275, 0xa274, + 0xa273, 0xa272, 0xa271, 0xa2a4, 0xa2a5, 0xa2a7, 0xa2a6, 0xa27e, + 0xa2a1, 0xa2a3, 0xa2a2, 0xa2ac, 0xa2ad, 0xa2ae, 0xa262, 0xa263, + 0xa264, 0xa265, 0xa266, 0xa267, 0xa268, 0xa269, 0xa270, 0xa26f, + 0xa26e, 0xa26d, 0xa26c, 0xa26b, 0xa26a, 0xa276, 0xa279, 0xa1bd, + 0xa1bc, 0xa1b6, 0xa1b5, 0xa1bf, 0xa1be, 0xa1bb, 0xa1ba, 0xa1b3, + 0xa1b7, 0xa1b4, 0xa2a8, 0xa2a9, 0xa2ab, 0xa2aa, 0xa1b9, 0xa1b8, + 0xa1f3, 0xa1f0, 0xa1f2, 0xa1f1, 0xa140, 0xa142, 0xa143, 0xa1b2, + 0xc6a4, 0xa171, 0xa172, 0xa16d, 0xa16e, 0xa175, 0xa176, 0xa179, + 0xa17a, 0xa169, 0xa16a, 0xa245, 0xa165, 0xa166, 0xa1a9, 0xa1aa, + 0xa2c3, 0xa2c4, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, 0xa2c9, 0xa2ca, + 0xa2cb, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, + 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, + 0xc6b4, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, + 0xc6bc, 0xc6bd, 0xc6be, 0xc6bf, 0xc6c0, 0xc6c1, 0xc6c2, 0xc6c3, + 0xc6c4, 0xc6c5, 0xc6c6, 0xc6c7, 0xc6c8, 0xc6c9, 0xc6ca, 0xc6cb, + 0xc6cc, 0xc6cd, 0xc6ce, 0xc6cf, 0xc6d0, 0xc6d1, 0xc6d2, 0xc6d3, + 0xc6d4, 0xc6d5, 0xc6d6, 0xc6d7, 0xc6d8, 0xc6d9, 0xc6da, 0xc6db, + 0xc6dc, 0xc6dd, 0xc6de, 0xc6df, 0xc6e0, 0xc6e1, 0xc6e2, 0xc6e3, + 0xc6e4, 0xc6e5, 0xc6e6, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, + 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, + 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6a2, 0xc6a3, 0xc6f8, 0xc6f9, + 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, + 0xc743, 0xc744, 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, + 0xc74b, 0xc74c, 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, + 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, + 0xc75b, 0xc75c, 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, + 0xc763, 0xc764, 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, + 0xc76b, 0xc76c, 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, + 0xc773, 0xc774, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, + 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, + 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, + 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc6a1, 0xa374, 0xa375, 0xa376, + 0xa377, 0xa378, 0xa379, 0xa37a, 0xa37b, 0xa37c, 0xa37d, 0xa37e, + 0xa3a1, 0xa3a2, 0xa3a3, 0xa3a4, 0xa3a5, 0xa3a6, 0xa3a7, 0xa3a8, + 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, 0xa3b0, + 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, 0xa3b8, + 0xa3b9, 0xa3ba, 0xa1c0, 0xa255, 0xa256, 0xa250, 0xa251, 0xa252, + 0xa254, 0xa257, 0xa253, 0xa1eb, 0xa1ea, 0xa24f, 0xa440, 0xa442, + 0xa443, 0xc945, 0xa456, 0xa454, 0xa457, 0xa455, 0xc946, 0xa4a3, + 0xc94f, 0xc94d, 0xa4a2, 0xa4a1, 0xa542, 0xa541, 0xa540, 0xa543, + 0xa4fe, 0xa5e0, 0xa5e1, 0xa8c3, 0xa458, 0xa4a4, 0xc950, 0xa4a5, + 0xc963, 0xa6ea, 0xcbb1, 0xa459, 0xa4a6, 0xa544, 0xc964, 0xc940, + 0xa444, 0xa45b, 0xc947, 0xa45c, 0xa4a7, 0xa545, 0xa547, 0xa546, + 0xa5e2, 0xa5e3, 0xa8c4, 0xadbc, 0xa441, 0xc941, 0xa445, 0xa45e, + 0xa45d, 0xa5e4, 0xa8c5, 0xb0ae, 0xd44b, 0xb6c3, 0xdcb1, 0xdcb2, + 0xa446, 0xa4a9, 0xa8c6, 0xa447, 0xc948, 0xa45f, 0xa4aa, 0xa4ac, + 0xc951, 0xa4ad, 0xa4ab, 0xa5e5, 0xa8c7, 0xa8c8, 0xab45, 0xa460, + 0xa4ae, 0xa5e6, 0xa5e8, 0xa5e7, 0xa6eb, 0xa8c9, 0xa8ca, 0xab46, + 0xab47, 0xadbd, 0xdcb3, 0xf6d6, 0xa448, 0xa4b0, 0xa4af, 0xc952, + 0xa4b1, 0xa4b7, 0xa4b2, 0xa4b3, 0xc954, 0xc953, 0xa4b5, 0xa4b6, + 0xa4b4, 0xa54a, 0xa54b, 0xa54c, 0xa54d, 0xa549, 0xa550, 0xc96a, + 0xc966, 0xc969, 0xa551, 0xa561, 0xc968, 0xa54e, 0xa54f, 0xa548, + 0xc965, 0xc967, 0xa5f5, 0xc9b0, 0xa5f2, 0xa5f6, 0xc9ba, 0xc9ae, + 0xa5f3, 0xc9b2, 0xa5f4, 0xa5f7, 0xa5e9, 0xc9b1, 0xa5f8, 0xc9b5, + 0xc9b9, 0xc9b6, 0xc9b3, 0xa5ea, 0xa5ec, 0xa5f9, 0xa5ee, 0xc9ab, + 0xa5f1, 0xa5ef, 0xa5f0, 0xc9bb, 0xc9b8, 0xc9af, 0xa5ed, 0xc9ac, + 0xa5eb, 0xc9b4, 0xc9b7, 0xc9ad, 0xca66, 0xa742, 0xa6f4, 0xca67, + 0xa6f1, 0xa744, 0xa6f9, 0xa6f8, 0xca5b, 0xa6fc, 0xa6f7, 0xca60, + 0xca68, 0xca64, 0xa6fa, 0xa6fd, 0xa6ee, 0xa747, 0xca5d, 0xcbbd, + 0xa6ec, 0xa743, 0xa6ed, 0xa6f5, 0xa6f6, 0xca62, 0xca5e, 0xa6fb, + 0xa6f3, 0xca5a, 0xa6ef, 0xca65, 0xa745, 0xa748, 0xa6f2, 0xa740, + 0xa746, 0xa6f0, 0xca63, 0xa741, 0xca69, 0xca5c, 0xa6fe, 0xca5f, + 0xca61, 0xa8d8, 0xcbbf, 0xcbcb, 0xa8d0, 0xcbcc, 0xa8cb, 0xa8d5, + 0xa8ce, 0xcbb9, 0xa8d6, 0xcbb8, 0xcbbc, 0xcbc3, 0xcbc1, 0xa8de, + 0xa8d9, 0xcbb3, 0xcbb5, 0xa8db, 0xa8cf, 0xcbb6, 0xcbc2, 0xcbc9, + 0xa8d4, 0xcbbb, 0xcbb4, 0xa8d3, 0xcbb7, 0xa8d7, 0xcbba, 0xa8d2, + 0xa8cd, 0xa8dc, 0xcbc4, 0xa8dd, 0xcbc8, 0xcbc6, 0xcbca, 0xa8da, + 0xcbbe, 0xcbb2, 0xcbc0, 0xa8d1, 0xcbc5, 0xa8cc, 0xcbc7, 0xab56, + 0xab4a, 0xcde0, 0xcde8, 0xab49, 0xab51, 0xab5d, 0xcdee, 0xcdec, + 0xcde7, 0xab4b, 0xcded, 0xcde3, 0xab59, 0xab50, 0xab58, 0xcdde, + 0xcdea, 0xcde1, 0xab54, 0xcde2, 0xcddd, 0xab5b, 0xab4e, 0xab57, + 0xab4d, 0xcddf, 0xcde4, 0xcdeb, 0xab55, 0xab52, 0xcde6, 0xab5a, + 0xcde9, 0xcde5, 0xab4f, 0xab5c, 0xab53, 0xab4c, 0xab48, 0xcdef, + 0xadd7, 0xadc1, 0xadd1, 0xadd6, 0xd0d0, 0xd0cf, 0xd0d4, 0xd0d5, + 0xadc4, 0xadcd, 0xadda, 0xadce, 0xd0c9, 0xadc7, 0xd0ca, 0xaddc, + 0xadd3, 0xadbe, 0xadbf, 0xd0dd, 0xb0bf, 0xadcc, 0xadcb, 0xd0cb, + 0xadcf, 0xd45b, 0xadc6, 0xd0d6, 0xadd5, 0xadd4, 0xadca, 0xd0ce, + 0xd0d7, 0xd0c8, 0xadc9, 0xd0d8, 0xadd2, 0xd0cc, 0xadc0, 0xadc3, + 0xadc2, 0xd0d9, 0xadd0, 0xadc5, 0xadd9, 0xaddb, 0xd0d3, 0xadd8, + 0xd0db, 0xd0cd, 0xd0dc, 0xd0d1, 0xd0da, 0xd0d2, 0xadc8, 0xd463, + 0xd457, 0xb0b3, 0xd45c, 0xd462, 0xb0b2, 0xd455, 0xb0b6, 0xd459, + 0xd452, 0xb0b4, 0xd456, 0xb0b9, 0xb0be, 0xd467, 0xd451, 0xb0ba, + 0xd466, 0xb0b5, 0xd458, 0xb0b1, 0xd453, 0xd44f, 0xd45d, 0xd450, + 0xd44e, 0xd45a, 0xd460, 0xd461, 0xb0b7, 0xd85b, 0xd45e, 0xd44d, + 0xd45f, 0xb0c1, 0xd464, 0xb0c0, 0xd44c, 0xd454, 0xd465, 0xb0bc, + 0xb0bb, 0xb0b8, 0xb0bd, 0xb0af, 0xb0b0, 0xb3c8, 0xd85e, 0xd857, + 0xb3c5, 0xd85f, 0xd855, 0xd858, 0xb3c4, 0xd859, 0xb3c7, 0xd85d, + 0xd853, 0xd852, 0xb3c9, 0xb3ca, 0xb3c6, 0xb3cb, 0xd851, 0xd85c, + 0xd85a, 0xd854, 0xb3c3, 0xd856, 0xb6ca, 0xb6c4, 0xdcb7, 0xb6cd, + 0xdcbd, 0xdcc0, 0xb6c6, 0xb6c7, 0xdcba, 0xb6c5, 0xdcc3, 0xb6cb, + 0xdcc4, 0xdcbf, 0xb6cc, 0xdcb4, 0xb6c9, 0xdcb5, 0xdcbe, 0xdcbc, + 0xdcb8, 0xb6c8, 0xdcb6, 0xb6ce, 0xdcbb, 0xdcc2, 0xdcb9, 0xdcc1, + 0xb9b6, 0xb9b3, 0xb9b4, 0xe0f9, 0xe0f1, 0xb9b2, 0xb9af, 0xe0f2, + 0xb9b1, 0xe0f5, 0xe0f7, 0xe0fe, 0xe0fd, 0xe0f8, 0xb9ae, 0xe0f0, + 0xb9ac, 0xe0f3, 0xb9b7, 0xe0f6, 0xe0fa, 0xb9b0, 0xb9ad, 0xe0fc, + 0xe0fb, 0xb9b5, 0xe0f4, 0xbbf8, 0xe4ec, 0xe4e9, 0xbbf9, 0xbbf7, + 0xe4f0, 0xe4ed, 0xe4e6, 0xbbf6, 0xbbfa, 0xe4e7, 0xbbf5, 0xbbfd, + 0xe4ea, 0xe4eb, 0xbbfb, 0xbbfc, 0xe4f1, 0xe4ee, 0xe4ef, 0xbeaa, + 0xe8f8, 0xbea7, 0xe8f5, 0xbea9, 0xbeab, 0xe8f6, 0xbea8, 0xe8f7, + 0xe8f4, 0xc076, 0xecbd, 0xc077, 0xecbb, 0xecbc, 0xecba, 0xecb9, + 0xecbe, 0xc075, 0xefb8, 0xefb9, 0xe4e8, 0xefb7, 0xc078, 0xc35f, + 0xf1eb, 0xf1ec, 0xc4d7, 0xc4d8, 0xf5c1, 0xf5c0, 0xc56c, 0xc56b, + 0xf7d0, 0xa449, 0xa461, 0xa4b9, 0xa4b8, 0xa553, 0xa552, 0xa5fc, + 0xa5fb, 0xa5fd, 0xa5fa, 0xa74a, 0xa749, 0xa74b, 0xa8e0, 0xa8df, + 0xa8e1, 0xab5e, 0xa259, 0xd0de, 0xa25a, 0xb0c2, 0xa25c, 0xa25b, + 0xd860, 0xa25d, 0xb9b8, 0xa25e, 0xa44a, 0xa4ba, 0xa5fe, 0xa8e2, + 0xa44b, 0xa4bd, 0xa4bb, 0xa4bc, 0xa640, 0xa74c, 0xa8e4, 0xa8e3, + 0xa8e5, 0xaddd, 0xbeac, 0xc94e, 0xa554, 0xa555, 0xa641, 0xca6a, + 0xab60, 0xab5f, 0xd0e0, 0xd0df, 0xb0c3, 0xa4be, 0xc955, 0xcbcd, + 0xab61, 0xade0, 0xadde, 0xaddf, 0xbead, 0xa556, 0xa642, 0xc9bc, + 0xa74d, 0xa74e, 0xca6b, 0xcbce, 0xa8e6, 0xcbcf, 0xd0e2, 0xd0e3, + 0xade3, 0xd0e4, 0xd0e1, 0xade4, 0xade2, 0xade1, 0xd0e5, 0xd468, + 0xd861, 0xdcc5, 0xe140, 0xbbfe, 0xbeae, 0xe8f9, 0xa44c, 0xa45a, + 0xb0c4, 0xb3cd, 0xb9b9, 0xc942, 0xa4bf, 0xa559, 0xa557, 0xa558, + 0xa8e7, 0xa44d, 0xa44e, 0xa462, 0xa4c0, 0xa4c1, 0xa4c2, 0xc9be, + 0xa55a, 0xc96b, 0xa646, 0xc9bf, 0xa644, 0xa645, 0xc9bd, 0xa647, + 0xa643, 0xca6c, 0xaaec, 0xca6d, 0xca6e, 0xa750, 0xa74f, 0xa753, + 0xa751, 0xa752, 0xa8ed, 0xa8ec, 0xcbd4, 0xcbd1, 0xcbd2, 0xcbd0, + 0xa8ee, 0xa8ea, 0xa8e9, 0xa8eb, 0xa8e8, 0xa8ef, 0xab63, 0xcdf0, + 0xcbd3, 0xab68, 0xcdf1, 0xab64, 0xab67, 0xab66, 0xab65, 0xab62, + 0xd0e8, 0xade7, 0xd0eb, 0xade5, 0xd0e7, 0xade8, 0xade6, 0xade9, + 0xd0e9, 0xd0ea, 0xd0e6, 0xd0ec, 0xb3d1, 0xb0c5, 0xd469, 0xd46b, + 0xd46a, 0xd46c, 0xb0c6, 0xb3ce, 0xb3cf, 0xb3d0, 0xb6d0, 0xdcc7, + 0xdcc6, 0xdcc8, 0xdcc9, 0xb6d1, 0xb6cf, 0xe141, 0xe142, 0xb9bb, + 0xb9ba, 0xe35a, 0xbc40, 0xbc41, 0xbc42, 0xbc44, 0xe4f2, 0xe4f3, + 0xbc43, 0xbeaf, 0xbeb0, 0xf1ed, 0xf5c3, 0xf5c2, 0xf7d1, 0xa44f, + 0xa55c, 0xa55b, 0xa648, 0xc9c0, 0xa755, 0xa756, 0xa754, 0xa757, + 0xca6f, 0xca70, 0xa8f1, 0xcbd5, 0xa8f0, 0xcdf2, 0xab6c, 0xcdf3, + 0xab6b, 0xab69, 0xab6a, 0xd0ed, 0xb0c7, 0xd46e, 0xb0ca, 0xd46d, + 0xb1e5, 0xb0c9, 0xb0c8, 0xb3d4, 0xb3d3, 0xb3d2, 0xb6d2, 0xb6d5, + 0xb6d6, 0xb6d4, 0xb6d3, 0xe143, 0xe144, 0xe4f5, 0xbc45, 0xe4f4, + 0xbeb1, 0xecbf, 0xc079, 0xf1ee, 0xc455, 0xa463, 0xa4c3, 0xc956, + 0xa4c4, 0xa4c5, 0xa55d, 0xa55e, 0xa649, 0xca71, 0xcbd6, 0xcbd7, + 0xab6d, 0xd0ee, 0xb0cc, 0xb0cb, 0xd863, 0xd862, 0xa450, 0xa4c6, + 0xa55f, 0xb0cd, 0xc943, 0xc96c, 0xa560, 0xc9c2, 0xa64b, 0xa64a, + 0xc9c1, 0xa758, 0xadea, 0xd46f, 0xb6d7, 0xe145, 0xb9bc, 0xe8fa, + 0xf3fd, 0xa4c7, 0xcbd8, 0xcdf4, 0xb0d0, 0xb0ce, 0xb0cf, 0xa451, + 0xa464, 0xa2cd, 0xa4ca, 0xa4c9, 0xa4c8, 0xa563, 0xa562, 0xc96d, + 0xc9c3, 0xa8f5, 0xa8f2, 0xa8f4, 0xa8f3, 0xab6e, 0xb3d5, 0xa452, + 0xa4cb, 0xa565, 0xa564, 0xca72, 0xa8f6, 0xc957, 0xa567, 0xa566, + 0xa64c, 0xa64d, 0xca73, 0xa759, 0xa75a, 0xa8f7, 0xa8f8, 0xa8f9, + 0xab6f, 0xcdf5, 0xadeb, 0xc944, 0xa4cc, 0xc9c4, 0xca74, 0xca75, + 0xcbd9, 0xcbda, 0xcdf7, 0xcdf6, 0xcdf9, 0xcdf8, 0xab70, 0xd470, + 0xaded, 0xd0ef, 0xadec, 0xd864, 0xb3d6, 0xd865, 0xe146, 0xb9bd, + 0xbc46, 0xf1ef, 0xc958, 0xa568, 0xb0d1, 0xa453, 0xa465, 0xa4ce, + 0xa4cd, 0xa4cf, 0xa8fb, 0xa8fa, 0xa8fc, 0xab71, 0xadee, 0xe8fb, + 0xc24f, 0xa466, 0xa56a, 0xa579, 0xa574, 0xa56f, 0xa56e, 0xa575, + 0xa573, 0xa56c, 0xa57a, 0xa56d, 0xa569, 0xa578, 0xa577, 0xa576, + 0xa56b, 0xa572, 0xa571, 0xa57b, 0xa570, 0xa653, 0xa659, 0xa655, + 0xa65b, 0xc9c5, 0xa658, 0xa64e, 0xa651, 0xa654, 0xa650, 0xa657, + 0xa65a, 0xa64f, 0xa652, 0xa656, 0xa65c, 0xca7e, 0xca7b, 0xa767, + 0xca7c, 0xa75b, 0xa75d, 0xa775, 0xa770, 0xcaa5, 0xca7d, 0xa75f, + 0xa761, 0xcaa4, 0xa768, 0xca78, 0xa774, 0xa776, 0xa75c, 0xa76d, + 0xca76, 0xa773, 0xa764, 0xa76e, 0xa76f, 0xca77, 0xa76c, 0xa76a, + 0xa76b, 0xa771, 0xcaa1, 0xa75e, 0xa772, 0xcaa3, 0xa766, 0xa763, + 0xca7a, 0xa762, 0xcaa6, 0xa765, 0xa769, 0xa760, 0xcaa2, 0xca79, + 0xcbeb, 0xcbea, 0xa94f, 0xcbed, 0xcbef, 0xcbe4, 0xcbe7, 0xcbee, + 0xa950, 0xcbe1, 0xcbe5, 0xcbe9, 0xce49, 0xa94b, 0xce4d, 0xa8fd, + 0xcbe6, 0xa8fe, 0xa94c, 0xa945, 0xa941, 0xcbe2, 0xa944, 0xa949, + 0xa952, 0xcbe3, 0xcbdc, 0xa943, 0xcbdd, 0xcbdf, 0xa946, 0xa948, + 0xcbdb, 0xcbe0, 0xa951, 0xa94d, 0xcbe8, 0xa953, 0xa94a, 0xcbde, + 0xa947, 0xa942, 0xa940, 0xcbec, 0xa94e, 0xce48, 0xcdfb, 0xce4b, + 0xcdfd, 0xab78, 0xaba8, 0xab74, 0xaba7, 0xab7d, 0xaba4, 0xab72, + 0xcdfc, 0xce43, 0xaba3, 0xce4f, 0xaba5, 0xab79, 0xce45, 0xce42, + 0xab77, 0xcdfa, 0xaba6, 0xce4a, 0xab7c, 0xce4c, 0xaba9, 0xab73, + 0xab7e, 0xab7b, 0xce40, 0xaba1, 0xce46, 0xce47, 0xab7a, 0xaba2, + 0xab76, 0xab75, 0xcdfe, 0xce44, 0xce4e, 0xd144, 0xadfb, 0xd0f1, + 0xd0f6, 0xadf4, 0xae40, 0xd0f4, 0xadef, 0xadf9, 0xadfe, 0xd0fb, + 0xadfa, 0xadfd, 0xd0fe, 0xadf5, 0xd0f5, 0xd142, 0xd143, 0xadf7, + 0xd141, 0xadf3, 0xae43, 0xd0f8, 0xadf1, 0xd146, 0xd0f9, 0xd0fd, + 0xadf6, 0xae42, 0xd0fa, 0xadfc, 0xd140, 0xd147, 0xd4a1, 0xd145, + 0xae44, 0xadf0, 0xd0fc, 0xd0f3, 0xadf8, 0xd0f2, 0xd0f7, 0xd0f0, + 0xae41, 0xd477, 0xb0e4, 0xd4a7, 0xb0e2, 0xb0df, 0xd47c, 0xb0db, + 0xd4a2, 0xb0e6, 0xd476, 0xd47b, 0xd47a, 0xadf2, 0xb0e1, 0xd4a5, + 0xd4a8, 0xd473, 0xb3e8, 0xd4a9, 0xb0e7, 0xb0d9, 0xb0d6, 0xd47e, + 0xb0d3, 0xd4a6, 0xb0da, 0xd4aa, 0xd474, 0xd4a4, 0xb0dd, 0xd475, + 0xd478, 0xd47d, 0xb0de, 0xb0dc, 0xb0e8, 0xb0e3, 0xb0d7, 0xb1d2, + 0xb0d8, 0xd479, 0xb0e5, 0xb0e0, 0xd4a3, 0xb0d5, 0xb0d4, 0xd471, + 0xd472, 0xd86a, 0xb3d7, 0xb3da, 0xd875, 0xb3ee, 0xd878, 0xb3d8, + 0xd871, 0xb3de, 0xb3e4, 0xb5bd, 0xb3e2, 0xd86e, 0xb3ef, 0xb3db, + 0xb3e3, 0xd876, 0xdcd7, 0xd87b, 0xd86f, 0xd866, 0xd873, 0xd86d, + 0xb3e1, 0xd879, 0xb3dd, 0xb3f1, 0xb3ea, 0xb3df, 0xb3dc, 0xb3e7, + 0xd87a, 0xd86c, 0xd872, 0xd874, 0xd868, 0xd877, 0xb3d9, 0xd867, + 0xb3e0, 0xb3f0, 0xb3ec, 0xd869, 0xb3e6, 0xb3ed, 0xb3e9, 0xb3e5, + 0xd870, 0xb3eb, 0xdcd5, 0xdcd1, 0xdce0, 0xdcca, 0xdcd3, 0xb6e5, + 0xb6e6, 0xb6de, 0xdcdc, 0xb6e8, 0xdccf, 0xdcce, 0xdccc, 0xdcde, + 0xb6dc, 0xdcd8, 0xdccd, 0xb6df, 0xdcd6, 0xb6da, 0xdcd2, 0xdcd9, + 0xdcdb, 0xdcdf, 0xb6e3, 0xdccb, 0xb6dd, 0xdcd0, 0xb6d8, 0xb6e4, + 0xdcda, 0xb6e0, 0xb6e1, 0xb6e7, 0xb6db, 0xa25f, 0xb6d9, 0xdcd4, + 0xb6e2, 0xdcdd, 0xb9cd, 0xb9c8, 0xe155, 0xe151, 0xe14b, 0xb9c2, + 0xb9be, 0xe154, 0xb9bf, 0xe14e, 0xe150, 0xe153, 0xb9c4, 0xb9cb, + 0xb9c5, 0xe149, 0xb9c6, 0xb9c7, 0xe14c, 0xb9cc, 0xe14a, 0xe14f, + 0xb9c3, 0xe148, 0xb9c9, 0xb9c1, 0xb9c0, 0xe14d, 0xe152, 0xb9ca, + 0xe147, 0xbc4d, 0xe547, 0xe544, 0xbc47, 0xbc53, 0xbc54, 0xbc4a, + 0xe542, 0xbc4c, 0xe4f9, 0xbc52, 0xe546, 0xbc49, 0xe548, 0xbc48, + 0xe543, 0xe545, 0xbc4b, 0xe541, 0xe4fa, 0xe4f7, 0xd86b, 0xe4fd, + 0xe4f6, 0xe4fc, 0xe4fb, 0xe4f8, 0xbc4f, 0xbc4e, 0xbc50, 0xe4fe, + 0xbeb2, 0xe540, 0xe945, 0xe8fd, 0xbebe, 0xe942, 0xbeb6, 0xbeba, + 0xe941, 0xbeb9, 0xbeb5, 0xbeb8, 0xbeb3, 0xbebd, 0xe943, 0xe8fe, + 0xbebc, 0xe8fc, 0xbebb, 0xe944, 0xe940, 0xbc51, 0xbebf, 0xe946, + 0xbeb7, 0xbeb4, 0xecc6, 0xecc8, 0xc07b, 0xecc9, 0xecc7, 0xecc5, + 0xecc4, 0xc07d, 0xecc3, 0xc07e, 0xecc1, 0xecc2, 0xc07a, 0xc0a1, + 0xc07c, 0xecc0, 0xc250, 0xefbc, 0xefba, 0xefbf, 0xefbd, 0xefbb, + 0xefbe, 0xc360, 0xf1f2, 0xf1f3, 0xc456, 0xf1f4, 0xf1f0, 0xf1f5, + 0xf1f1, 0xc251, 0xf3fe, 0xf441, 0xc459, 0xf440, 0xc458, 0xc457, + 0xc45a, 0xf5c5, 0xf5c6, 0xc4da, 0xc4d9, 0xc4db, 0xf5c4, 0xf6d8, + 0xf6d7, 0xc56d, 0xc56f, 0xc56e, 0xf6d9, 0xc5c8, 0xf8a6, 0xc5f1, + 0xf8a5, 0xf8ee, 0xc949, 0xa57d, 0xa57c, 0xa65f, 0xa65e, 0xc9c7, + 0xa65d, 0xc9c6, 0xa779, 0xcaa9, 0xcaa8, 0xa777, 0xa77a, 0xcaa7, + 0xa778, 0xcbf0, 0xcbf1, 0xa954, 0xabaa, 0xd148, 0xd149, 0xae45, + 0xae46, 0xd4ac, 0xb0e9, 0xb0eb, 0xd4ab, 0xb0ea, 0xd87c, 0xb3f2, + 0xb6e9, 0xb6ea, 0xdce1, 0xb9cf, 0xb9ce, 0xe549, 0xe948, 0xe947, + 0xf96b, 0xa467, 0xc959, 0xc96e, 0xc96f, 0xa662, 0xa666, 0xc9c9, + 0xa664, 0xa663, 0xc9c8, 0xa665, 0xa661, 0xa660, 0xc9ca, 0xa7a6, + 0xa7a3, 0xa77d, 0xcaaa, 0xcaab, 0xa7a1, 0xcaad, 0xa77b, 0xcaae, + 0xcaac, 0xa77e, 0xa7a2, 0xa7a5, 0xa7a4, 0xa77c, 0xcaaf, 0xa959, + 0xcbfe, 0xa95b, 0xa95a, 0xcc40, 0xa958, 0xa957, 0xcbf5, 0xcbf4, + 0xcbf2, 0xcbf7, 0xcbf6, 0xcbf3, 0xcbfc, 0xcbfd, 0xcbfa, 0xcbf8, + 0xa956, 0xcbfb, 0xa95c, 0xcc41, 0xcbf9, 0xabab, 0xa955, 0xabac, + 0xce54, 0xce5a, 0xabb2, 0xce58, 0xce5e, 0xce55, 0xce59, 0xce5b, + 0xce5d, 0xce57, 0xce56, 0xce51, 0xce52, 0xabad, 0xabaf, 0xabae, + 0xce53, 0xce5c, 0xabb1, 0xce50, 0xd153, 0xd152, 0xd157, 0xd14e, + 0xd151, 0xd150, 0xd154, 0xd158, 0xae47, 0xae4a, 0xd14f, 0xd155, + 0xae49, 0xd14a, 0xabb0, 0xd4ba, 0xd156, 0xd14d, 0xae48, 0xd14c, + 0xd4b1, 0xb0ec, 0xb0f0, 0xd4c1, 0xd4af, 0xd4bd, 0xb0f1, 0xd4bf, + 0xd4c5, 0xd4c9, 0xd4c0, 0xd4b4, 0xd4bc, 0xd4ca, 0xd4c8, 0xd4be, + 0xd4b9, 0xd4b2, 0xd8a6, 0xd4b0, 0xb0f5, 0xd4b7, 0xb0f6, 0xb0f2, + 0xd4ad, 0xd4c3, 0xd4b5, 0xd4b3, 0xd4c6, 0xb0f3, 0xd4cc, 0xb0ed, + 0xb0ef, 0xd4bb, 0xd4b6, 0xae4b, 0xb0ee, 0xd4b8, 0xd4c7, 0xd4cb, + 0xd4c2, 0xd4c4, 0xd4ae, 0xd8a1, 0xd8aa, 0xd8a9, 0xb3fa, 0xd8a2, + 0xb3fb, 0xb3f9, 0xd8a4, 0xb3f6, 0xd8a8, 0xd8a3, 0xd8a5, 0xd87d, + 0xb3f4, 0xd8b2, 0xd8b1, 0xd8ae, 0xb3f3, 0xb3f7, 0xb3f8, 0xd14b, + 0xd8ab, 0xb3f5, 0xb0f4, 0xd8ad, 0xd87e, 0xd8b0, 0xd8af, 0xd8b3, + 0xdcef, 0xd8ac, 0xd8a7, 0xdce7, 0xb6f4, 0xb6f7, 0xb6f2, 0xdce6, + 0xdcea, 0xdce5, 0xb6ec, 0xb6f6, 0xdce2, 0xb6f0, 0xdce9, 0xb6ee, + 0xb6ed, 0xdcec, 0xb6ef, 0xdcee, 0xdceb, 0xb6eb, 0xb6f5, 0xdcf0, + 0xdce4, 0xdced, 0xdce3, 0xb6f1, 0xb6f3, 0xdce8, 0xdcf1, 0xe15d, + 0xb9d0, 0xe163, 0xb9d5, 0xe15f, 0xe166, 0xe157, 0xb9d7, 0xb9d1, + 0xe15c, 0xbc55, 0xe15b, 0xe164, 0xb9d2, 0xb9d6, 0xe15a, 0xe160, + 0xe165, 0xe156, 0xb9d4, 0xe15e, 0xe162, 0xe168, 0xe158, 0xe161, + 0xb9d3, 0xe167, 0xe159, 0xbc59, 0xe54b, 0xbc57, 0xbc56, 0xe54d, + 0xe552, 0xe54e, 0xe551, 0xbc5c, 0xbea5, 0xbc5b, 0xe54a, 0xe550, + 0xbc5a, 0xe54f, 0xe54c, 0xbc58, 0xe94d, 0xe94f, 0xe94a, 0xbec1, + 0xe94c, 0xbec0, 0xe94e, 0xbec3, 0xe950, 0xbec2, 0xe949, 0xe94b, + 0xc0a5, 0xeccc, 0xc0a4, 0xeccd, 0xc0a3, 0xeccb, 0xc0a2, 0xecca, + 0xc253, 0xc252, 0xf1f6, 0xf1f8, 0xf1f7, 0xc361, 0xc362, 0xc363, + 0xf442, 0xc45b, 0xf7d3, 0xf7d2, 0xc5f2, 0xa468, 0xa4d0, 0xa7a7, + 0xce5f, 0xb3fc, 0xb3fd, 0xdcf2, 0xb9d8, 0xe169, 0xe553, 0xc95a, + 0xcab0, 0xcc42, 0xce60, 0xd159, 0xae4c, 0xf1f9, 0xc4dc, 0xa469, + 0xa57e, 0xc970, 0xa667, 0xa668, 0xa95d, 0xb0f7, 0xb9da, 0xb9db, + 0xb9d9, 0xa46a, 0xa4d1, 0xa4d3, 0xa4d2, 0xc95b, 0xa4d4, 0xa5a1, + 0xc971, 0xa5a2, 0xa669, 0xa66a, 0xc9cb, 0xa7a8, 0xcab1, 0xa961, + 0xcc43, 0xa95f, 0xa960, 0xa95e, 0xd15a, 0xabb6, 0xabb5, 0xabb7, + 0xabb4, 0xce61, 0xa962, 0xabb3, 0xae4d, 0xae4e, 0xae4f, 0xd4cd, + 0xb3fe, 0xd8b4, 0xb0f8, 0xb6f8, 0xb9dd, 0xb9dc, 0xe16a, 0xbc5d, + 0xbec4, 0xefc0, 0xf6da, 0xf7d4, 0xa46b, 0xa5a3, 0xa5a4, 0xc9d1, + 0xa66c, 0xa66f, 0xc9cf, 0xc9cd, 0xa66e, 0xc9d0, 0xc9d2, 0xc9cc, + 0xa671, 0xa670, 0xa66d, 0xa66b, 0xc9ce, 0xa7b3, 0xa7b0, 0xcab6, + 0xcab9, 0xcab8, 0xa7aa, 0xa7b2, 0xa7af, 0xcab5, 0xcab3, 0xa7ae, + 0xa7a9, 0xa7ac, 0xcab4, 0xcabb, 0xcab7, 0xa7ad, 0xa7b1, 0xa7b4, + 0xcab2, 0xcaba, 0xa7ab, 0xa967, 0xa96f, 0xcc4f, 0xcc48, 0xa970, + 0xcc53, 0xcc44, 0xcc4b, 0xa966, 0xcc45, 0xa964, 0xcc4c, 0xcc50, + 0xa963, 0xcc51, 0xcc4a, 0xcc4d, 0xa972, 0xa969, 0xcc54, 0xcc52, + 0xa96e, 0xa96c, 0xcc49, 0xa96b, 0xcc47, 0xcc46, 0xa96a, 0xa968, + 0xa971, 0xa96d, 0xa965, 0xcc4e, 0xabb9, 0xabc0, 0xce6f, 0xabb8, + 0xce67, 0xce63, 0xce73, 0xce62, 0xabbb, 0xce6c, 0xabbe, 0xabc1, + 0xabbc, 0xce70, 0xabbf, 0xae56, 0xce76, 0xce64, 0xce66, 0xce6d, + 0xce71, 0xce75, 0xce72, 0xce6b, 0xce6e, 0xce68, 0xabc3, 0xce6a, + 0xce69, 0xce74, 0xabba, 0xce65, 0xabc2, 0xabbd, 0xae5c, 0xd162, + 0xae5b, 0xd160, 0xae50, 0xae55, 0xd15f, 0xd15c, 0xd161, 0xae51, + 0xd15b, 0xae54, 0xae52, 0xd163, 0xae53, 0xae57, 0xae58, 0xae5a, + 0xae59, 0xd15d, 0xd15e, 0xd164, 0xd4d4, 0xb0f9, 0xd8c2, 0xd4d3, + 0xd4e6, 0xb140, 0xd4e4, 0xb0fe, 0xb0fa, 0xd4ed, 0xd4dd, 0xd4e0, + 0xb143, 0xd4ea, 0xd4e2, 0xb0fb, 0xb144, 0xd4e7, 0xd4e5, 0xd4d6, + 0xd4eb, 0xd4df, 0xd4da, 0xd4d0, 0xd4ec, 0xd4dc, 0xd4cf, 0xb142, + 0xd4e1, 0xd4ee, 0xd4de, 0xd4d2, 0xd4d7, 0xd4ce, 0xb141, 0xd4db, + 0xd4d8, 0xb0fc, 0xd4d1, 0xd4e9, 0xb0fd, 0xd4d9, 0xd4d5, 0xd4e8, + 0xb440, 0xd8bb, 0xd8b8, 0xd8c9, 0xd8bd, 0xd8ca, 0xb442, 0xd8c6, + 0xd8c3, 0xd8c4, 0xd8c7, 0xd8cb, 0xd4e3, 0xd8cd, 0xdd47, 0xb443, + 0xd8ce, 0xd8b6, 0xd8c0, 0xd8c5, 0xb441, 0xb444, 0xd8cc, 0xd8cf, + 0xd8ba, 0xd8b7, 0xd8b9, 0xd8be, 0xd8bc, 0xb445, 0xd8c8, 0xd8bf, + 0xd8c1, 0xd8b5, 0xdcfa, 0xdcf8, 0xb742, 0xb740, 0xdd43, 0xdcf9, + 0xdd44, 0xdd40, 0xdcf7, 0xdd46, 0xdcf6, 0xdcfd, 0xb6fe, 0xb6fd, + 0xb6fc, 0xdcfb, 0xdd41, 0xb6f9, 0xb741, 0xdcf4, 0xdcfe, 0xdcf3, + 0xdcfc, 0xb6fa, 0xdd42, 0xdcf5, 0xb6fb, 0xdd45, 0xe16e, 0xb9e2, + 0xb9e1, 0xb9e3, 0xe17a, 0xe170, 0xe176, 0xe16b, 0xe179, 0xe178, + 0xe17c, 0xe175, 0xb9de, 0xe174, 0xb9e4, 0xe16d, 0xb9df, 0xe17b, + 0xb9e0, 0xe16f, 0xe172, 0xe177, 0xe171, 0xe16c, 0xe173, 0xe555, + 0xbc61, 0xe558, 0xe557, 0xe55a, 0xe55c, 0xbc5f, 0xe556, 0xe554, + 0xe55d, 0xe55b, 0xe559, 0xe55f, 0xe55e, 0xbc63, 0xbc5e, 0xbc60, + 0xbc62, 0xe560, 0xe957, 0xe956, 0xe955, 0xe958, 0xe951, 0xe952, + 0xe95a, 0xe953, 0xbec5, 0xe95c, 0xe95b, 0xe954, 0xecd1, 0xc0a8, + 0xeccf, 0xecd4, 0xecd3, 0xe959, 0xc0a7, 0xecd2, 0xecce, 0xecd6, + 0xecd5, 0xc0a6, 0xecd0, 0xbec6, 0xc254, 0xefc1, 0xf1fa, 0xf1fb, + 0xf1fc, 0xc45c, 0xc45d, 0xf443, 0xf5c8, 0xf5c7, 0xf6db, 0xf6dc, + 0xf7d5, 0xf8a7, 0xa46c, 0xa46d, 0xa46e, 0xa4d5, 0xa5a5, 0xc9d3, + 0xa672, 0xa673, 0xa7b7, 0xa7b8, 0xa7b6, 0xa7b5, 0xa973, 0xcc55, + 0xa975, 0xa974, 0xcc56, 0xabc4, 0xae5d, 0xd165, 0xd4f0, 0xb145, + 0xb447, 0xd4ef, 0xb446, 0xb9e5, 0xe17d, 0xbec7, 0xc0a9, 0xecd7, + 0xc45e, 0xc570, 0xc972, 0xa5a6, 0xc973, 0xa676, 0xa674, 0xa675, + 0xa677, 0xa7ba, 0xa7b9, 0xcabc, 0xa7bb, 0xcabd, 0xcc57, 0xcc58, + 0xa976, 0xa978, 0xa97a, 0xa977, 0xa97b, 0xa979, 0xabc8, 0xabc5, + 0xabc7, 0xabc9, 0xabc6, 0xd166, 0xce77, 0xd168, 0xd167, 0xae63, + 0xae5f, 0xae60, 0xae62, 0xae64, 0xae61, 0xae66, 0xae65, 0xb14a, + 0xd4f2, 0xd4f1, 0xb149, 0xb148, 0xb147, 0xb14b, 0xb146, 0xd8d5, + 0xd8d2, 0xb449, 0xd8d1, 0xd8d6, 0xb44b, 0xd8d4, 0xb448, 0xb44a, + 0xd8d3, 0xdd48, 0xdd49, 0xdd4a, 0xb9e6, 0xb9ee, 0xe17e, 0xb9e8, + 0xb9ec, 0xe1a1, 0xb9ed, 0xb9e9, 0xb9ea, 0xb9e7, 0xb9eb, 0xbc66, + 0xd8d0, 0xbc67, 0xbc65, 0xbc64, 0xe95d, 0xbec8, 0xecd8, 0xecd9, + 0xc364, 0xc45f, 0xa46f, 0xa678, 0xabca, 0xd169, 0xae67, 0xb14e, + 0xb14d, 0xb14c, 0xb44c, 0xb44d, 0xd8d7, 0xb9ef, 0xbec9, 0xa470, + 0xc95c, 0xa4d6, 0xc974, 0xc9d4, 0xa679, 0xa97c, 0xdd4b, 0xa471, + 0xa4d7, 0xc9d5, 0xcabe, 0xcabf, 0xa7bc, 0xd8d8, 0xb44e, 0xdd4c, + 0xc0aa, 0xa472, 0xa4a8, 0xa4d8, 0xc975, 0xa5a7, 0xa7c0, 0xa7bf, + 0xa7bd, 0xa7be, 0xcc59, 0xa97e, 0xa9a1, 0xcc5a, 0xa97d, 0xabce, + 0xce78, 0xabcd, 0xabcb, 0xabcc, 0xae6a, 0xae68, 0xd16b, 0xae69, + 0xd16a, 0xae5e, 0xd4f3, 0xb150, 0xb151, 0xb14f, 0xb9f0, 0xe1a2, + 0xbc68, 0xbc69, 0xe561, 0xc0ab, 0xefc2, 0xefc3, 0xc4dd, 0xf8a8, + 0xc94b, 0xa4d9, 0xa473, 0xc977, 0xc976, 0xa67a, 0xc9d7, 0xc9d8, + 0xc9d6, 0xc9d9, 0xcac7, 0xcac2, 0xcac4, 0xcac6, 0xcac3, 0xa7c4, + 0xcac0, 0xcac1, 0xa7c1, 0xa7c2, 0xcac5, 0xcac8, 0xa7c3, 0xcac9, + 0xcc68, 0xcc62, 0xcc5d, 0xa9a3, 0xcc65, 0xcc63, 0xcc5c, 0xcc69, + 0xcc6c, 0xcc67, 0xcc60, 0xa9a5, 0xcc66, 0xa9a6, 0xcc61, 0xcc64, + 0xcc5b, 0xcc5f, 0xcc6b, 0xa9a7, 0xa9a8, 0xcc5e, 0xcc6a, 0xa9a2, + 0xa9a4, 0xceab, 0xcea4, 0xceaa, 0xcea3, 0xcea5, 0xce7d, 0xce7b, + 0xceac, 0xcea9, 0xce79, 0xabd0, 0xcea7, 0xcea8, 0xcea6, 0xce7c, + 0xce7a, 0xabcf, 0xcea2, 0xce7e, 0xcea1, 0xcead, 0xae6f, 0xae6e, + 0xd16c, 0xae6b, 0xd16e, 0xae70, 0xd16f, 0xae73, 0xae71, 0xd170, + 0xceae, 0xd172, 0xae6d, 0xae6c, 0xd16d, 0xd171, 0xae72, 0xb153, + 0xb152, 0xd4f5, 0xd4f9, 0xd4fb, 0xb154, 0xd4fe, 0xb158, 0xd541, + 0xb15a, 0xb156, 0xb15e, 0xb15b, 0xd4f7, 0xb155, 0xd4f6, 0xd4f4, + 0xd543, 0xd4f8, 0xb157, 0xd542, 0xb15c, 0xd4fd, 0xd4fc, 0xb15d, + 0xd4fa, 0xb159, 0xd544, 0xd540, 0xd8e7, 0xd8ee, 0xd8e3, 0xb451, + 0xd8df, 0xd8ef, 0xd8d9, 0xd8ec, 0xd8ea, 0xd8e4, 0xd8ed, 0xd8e6, + 0xd8de, 0xd8f0, 0xd8dc, 0xd8e9, 0xd8da, 0xd8f1, 0xb452, 0xd8eb, + 0xdd4f, 0xd8dd, 0xb44f, 0xd8e1, 0xb450, 0xd8e0, 0xd8e5, 0xd8e2, + 0xd8e8, 0xdd53, 0xdd56, 0xdd4e, 0xdd50, 0xdd55, 0xdd54, 0xb743, + 0xd8db, 0xdd52, 0xb744, 0xdd4d, 0xdd51, 0xe1a9, 0xe1b0, 0xe1a7, + 0xe1ae, 0xe1a5, 0xe1ad, 0xe1b1, 0xe1a4, 0xe1a8, 0xe1a3, 0xb9f1, + 0xe1a6, 0xb9f2, 0xe1ac, 0xe1ab, 0xe1aa, 0xe1af, 0xe565, 0xe567, + 0xbc6b, 0xe568, 0xe563, 0xe562, 0xe56c, 0xe56a, 0xbc6a, 0xe56d, + 0xe564, 0xe569, 0xe56b, 0xe566, 0xe961, 0xe966, 0xe960, 0xe965, + 0xe95e, 0xe968, 0xe964, 0xe969, 0xe963, 0xe95f, 0xe967, 0xe96a, + 0xe962, 0xecda, 0xc0af, 0xc0ad, 0xc0ac, 0xc0ae, 0xefc4, 0xf172, + 0xf1fd, 0xf444, 0xf445, 0xc460, 0xf5c9, 0xc4de, 0xf5ca, 0xf6de, + 0xc572, 0xc571, 0xf6dd, 0xc5c9, 0xf7d6, 0xa474, 0xa67b, 0xc9da, + 0xcaca, 0xa8b5, 0xb15f, 0xa475, 0xa5aa, 0xa5a9, 0xa5a8, 0xa7c5, + 0xae74, 0xdd57, 0xa476, 0xa477, 0xa478, 0xa4da, 0xabd1, 0xceaf, + 0xb453, 0xa479, 0xc95d, 0xa5ab, 0xa5ac, 0xc978, 0xa67c, 0xcacb, + 0xa7c6, 0xcacc, 0xa9ae, 0xcc6e, 0xa9ac, 0xa9ab, 0xcc6d, 0xa9a9, + 0xcc6f, 0xa9aa, 0xa9ad, 0xabd2, 0xabd4, 0xceb3, 0xceb0, 0xceb1, + 0xceb2, 0xceb4, 0xabd3, 0xd174, 0xd173, 0xae76, 0xae75, 0xb162, + 0xd546, 0xb161, 0xb163, 0xb160, 0xb455, 0xd545, 0xb456, 0xd8f3, + 0xb457, 0xd8f2, 0xb454, 0xdd5a, 0xdd5c, 0xb745, 0xdd5b, 0xdd59, + 0xdd58, 0xe1b4, 0xb9f7, 0xb9f5, 0xb9f6, 0xe1b2, 0xe1b3, 0xb9f3, + 0xe571, 0xe56f, 0xbc6d, 0xe570, 0xbc6e, 0xbc6c, 0xb9f4, 0xe96d, + 0xe96b, 0xe96c, 0xe56e, 0xecdc, 0xc0b0, 0xecdb, 0xefc5, 0xefc6, + 0xe96e, 0xf1fe, 0xa47a, 0xa5ad, 0xa67e, 0xc9db, 0xa67d, 0xa9af, + 0xb746, 0xa4db, 0xa5ae, 0xabd5, 0xb458, 0xc979, 0xc97a, 0xc9dc, + 0xa7c8, 0xcad0, 0xcace, 0xa7c9, 0xcacd, 0xcacf, 0xcad1, 0xa7c7, + 0xa9b3, 0xa9b4, 0xa9b1, 0xa9b0, 0xceb8, 0xa9b2, 0xabd6, 0xceb7, + 0xceb9, 0xceb6, 0xceba, 0xabd7, 0xae79, 0xd175, 0xd177, 0xae77, + 0xd178, 0xae78, 0xd176, 0xceb5, 0xd547, 0xd54a, 0xd54b, 0xd548, + 0xb167, 0xb166, 0xb164, 0xb165, 0xd549, 0xb168, 0xb45a, 0xb45b, + 0xb45c, 0xdd5d, 0xdd5f, 0xdd61, 0xb748, 0xb747, 0xb459, 0xdd60, + 0xdd5e, 0xe1b8, 0xe1b6, 0xe1bc, 0xb9f8, 0xe1bd, 0xe1ba, 0xb9f9, + 0xe1b7, 0xe1b5, 0xe1bb, 0xbc70, 0xe573, 0xe1b9, 0xbc72, 0xe574, + 0xbc71, 0xbc74, 0xe575, 0xbc6f, 0xbc73, 0xe973, 0xe971, 0xe970, + 0xe972, 0xe96f, 0xc366, 0xf446, 0xf447, 0xf5cb, 0xf6df, 0xc655, + 0xa9b5, 0xa7ca, 0xabd8, 0xa47b, 0xa4dc, 0xa5af, 0xc9dd, 0xa7cb, + 0xcad2, 0xcebb, 0xabd9, 0xb9fa, 0xa47c, 0xa6a1, 0xb749, 0xa47d, + 0xa4dd, 0xa4de, 0xa5b1, 0xa5b0, 0xc9de, 0xa6a2, 0xcad3, 0xa7cc, + 0xcc71, 0xcc72, 0xcc73, 0xa9b6, 0xa9b7, 0xcc70, 0xa9b8, 0xabda, + 0xcebc, 0xd17a, 0xae7a, 0xd179, 0xb169, 0xd54c, 0xb16a, 0xd54d, + 0xb45d, 0xdd62, 0xe1bf, 0xe1be, 0xb9fb, 0xbc75, 0xe576, 0xbeca, + 0xe974, 0xc0b1, 0xc573, 0xf7d8, 0xcc74, 0xcebd, 0xb16b, 0xd8f4, + 0xb74a, 0xc255, 0xa7ce, 0xa7cd, 0xabdb, 0xd17b, 0xb16d, 0xb343, + 0xb16e, 0xb16c, 0xb45e, 0xe1c0, 0xb9fc, 0xbc76, 0xc94c, 0xc9df, + 0xcad5, 0xa7cf, 0xcad4, 0xa7d0, 0xa9bc, 0xcc77, 0xcc76, 0xa9bb, + 0xa9b9, 0xa9ba, 0xcc75, 0xabdd, 0xcebe, 0xabe0, 0xabdc, 0xabe2, + 0xabde, 0xabdf, 0xabe1, 0xae7d, 0xae7c, 0xae7b, 0xd54f, 0xb16f, + 0xb172, 0xb170, 0xd54e, 0xb175, 0xb171, 0xd550, 0xb174, 0xb173, + 0xd8f6, 0xd8f5, 0xb461, 0xb45f, 0xb460, 0xd8f7, 0xb74b, 0xdd64, + 0xb74c, 0xdd63, 0xe577, 0xbc78, 0xe1c1, 0xbc77, 0xb9fd, 0xecde, + 0xe975, 0xc0b2, 0xecdd, 0xf240, 0xf448, 0xf449, 0xa4df, 0xa5b2, + 0xc97b, 0xa7d2, 0xa7d4, 0xc9e2, 0xcad8, 0xcad7, 0xcad6, 0xc9e1, + 0xc9e0, 0xa6a4, 0xa7d3, 0xa7d1, 0xa6a3, 0xa9bd, 0xcc78, 0xa9be, + 0xcadd, 0xcadf, 0xcade, 0xcc79, 0xcada, 0xa7d8, 0xa7d6, 0xcad9, + 0xcadb, 0xcae1, 0xa7d5, 0xcadc, 0xcae5, 0xa9c0, 0xcae2, 0xa7d7, + 0xcae0, 0xcae3, 0xa9bf, 0xa9c1, 0xcae4, 0xccaf, 0xcca2, 0xcc7e, + 0xccae, 0xcca9, 0xabe7, 0xa9c2, 0xccaa, 0xccad, 0xabe3, 0xccac, + 0xa9c3, 0xa9c8, 0xa9c6, 0xcca3, 0xcc7c, 0xcca5, 0xa9cd, 0xccb0, + 0xabe4, 0xcca6, 0xabe5, 0xa9c9, 0xcca8, 0xcecd, 0xabe6, 0xcc7b, + 0xa9ca, 0xabe8, 0xa9cb, 0xa9c7, 0xa9cc, 0xcca7, 0xcc7a, 0xccab, + 0xa9c4, 0xcc7d, 0xcca4, 0xcca1, 0xa9c5, 0xcebf, 0xcec0, 0xceca, + 0xd1a1, 0xcecb, 0xabee, 0xcece, 0xcec4, 0xabed, 0xcec6, 0xcec7, + 0xcec9, 0xabe9, 0xaea3, 0xcec5, 0xcec1, 0xaea4, 0xcecf, 0xae7e, + 0xd17d, 0xcec8, 0xd17c, 0xcec3, 0xcecc, 0xabec, 0xaea1, 0xabf2, + 0xaea2, 0xced0, 0xd17e, 0xabeb, 0xaea6, 0xabf1, 0xabf0, 0xabef, + 0xaea5, 0xced1, 0xaea7, 0xabea, 0xcec2, 0xb176, 0xd1a4, 0xd1a6, + 0xd1a8, 0xaea8, 0xaeae, 0xd553, 0xd1ac, 0xd1a3, 0xb178, 0xd551, + 0xaead, 0xaeab, 0xd1ae, 0xd552, 0xd1a5, 0xaeac, 0xd1a9, 0xaeaf, + 0xd1ab, 0xaeaa, 0xd1aa, 0xd1ad, 0xd1a7, 0xaea9, 0xb179, 0xd1a2, + 0xb177, 0xb17a, 0xd555, 0xd55e, 0xb464, 0xb17c, 0xb1a3, 0xb465, + 0xd560, 0xb1aa, 0xd8f9, 0xd556, 0xb1a2, 0xb1a5, 0xb17e, 0xd554, + 0xd562, 0xd565, 0xd949, 0xd563, 0xd8fd, 0xb1a1, 0xb1a8, 0xb1ac, + 0xd55d, 0xd8f8, 0xd561, 0xb17b, 0xd8fa, 0xd564, 0xd8fc, 0xd559, + 0xb462, 0xd557, 0xd558, 0xb1a7, 0xb1a6, 0xd55b, 0xb1ab, 0xd55f, + 0xb1a4, 0xd55c, 0xb1a9, 0xb466, 0xb463, 0xd8fb, 0xd55a, 0xb17d, + 0xb46b, 0xb46f, 0xd940, 0xb751, 0xb46d, 0xd944, 0xb471, 0xdd65, + 0xd946, 0xb753, 0xb469, 0xb46c, 0xd947, 0xd948, 0xd94e, 0xb473, + 0xb754, 0xd94a, 0xd94f, 0xd943, 0xb75e, 0xb755, 0xb472, 0xd941, + 0xd950, 0xb75d, 0xb470, 0xb74e, 0xd94d, 0xb474, 0xd945, 0xd8fe, + 0xb46a, 0xd942, 0xd94b, 0xb74d, 0xb752, 0xb467, 0xd94c, 0xb750, + 0xb468, 0xb75c, 0xe1c3, 0xdd70, 0xdd68, 0xe1c2, 0xdd6c, 0xdd6e, + 0xdd6b, 0xb75b, 0xdd6a, 0xb75f, 0xe1d2, 0xb75a, 0xba40, 0xdd71, + 0xe1c4, 0xb758, 0xdd69, 0xdd6d, 0xb9fe, 0xb74f, 0xdd66, 0xdd67, + 0xba41, 0xb757, 0xb759, 0xb756, 0xdd6f, 0xe1c8, 0xe1c9, 0xe1ce, + 0xbc7d, 0xe1d5, 0xba47, 0xba46, 0xe1d0, 0xbc7c, 0xe1c5, 0xba45, + 0xe1d4, 0xba43, 0xba44, 0xe1d1, 0xe5aa, 0xbc7a, 0xb46e, 0xe1d3, + 0xbca3, 0xe1cb, 0xbc7b, 0xbca2, 0xe1c6, 0xe1ca, 0xe1c7, 0xe1cd, + 0xba48, 0xbc79, 0xba42, 0xe57a, 0xe1cf, 0xbca1, 0xbca4, 0xe1cc, + 0xbc7e, 0xe579, 0xe57e, 0xbece, 0xe578, 0xe9a3, 0xe5a9, 0xbca8, + 0xbca6, 0xbecc, 0xe5a6, 0xe5a2, 0xbcac, 0xe978, 0xbcaa, 0xe5a1, + 0xe976, 0xe5a5, 0xe5a8, 0xe57d, 0xbcab, 0xbca5, 0xe977, 0xbecd, + 0xe5a7, 0xbca7, 0xbca9, 0xe5a4, 0xbcad, 0xe5a3, 0xe57c, 0xe57b, + 0xbecb, 0xe5ab, 0xe97a, 0xece0, 0xbed0, 0xe9a2, 0xe97e, 0xece1, + 0xbed1, 0xe9a1, 0xe97c, 0xc0b4, 0xecdf, 0xe979, 0xe97b, 0xc0b5, + 0xbed3, 0xc0b3, 0xbed2, 0xc0b7, 0xe97d, 0xbecf, 0xefcf, 0xefc7, + 0xece7, 0xefc8, 0xece3, 0xc256, 0xece5, 0xece4, 0xc0b6, 0xece2, + 0xece6, 0xefd0, 0xefcc, 0xefce, 0xefc9, 0xefca, 0xefcd, 0xefcb, + 0xc367, 0xc36a, 0xc369, 0xc368, 0xc461, 0xf44a, 0xc462, 0xf241, + 0xc4df, 0xf5cc, 0xc4e0, 0xc574, 0xc5ca, 0xf7d9, 0xf7da, 0xf7db, + 0xf9ba, 0xa4e0, 0xc97c, 0xa5b3, 0xa6a6, 0xa6a7, 0xa6a5, 0xa6a8, + 0xa7da, 0xa7d9, 0xccb1, 0xa9cf, 0xa9ce, 0xd1af, 0xb1ad, 0xb1ae, + 0xb475, 0xdd72, 0xb760, 0xb761, 0xdd74, 0xdd76, 0xdd75, 0xe1d7, + 0xe1d6, 0xba49, 0xe1d8, 0xe5ac, 0xbcae, 0xbed4, 0xc0b8, 0xc257, + 0xc0b9, 0xa4e1, 0xcae6, 0xccb2, 0xa9d1, 0xa9d0, 0xa9d2, 0xabf3, + 0xced2, 0xced3, 0xd1b0, 0xaeb0, 0xb1af, 0xb476, 0xd951, 0xa4e2, + 0xa47e, 0xa4e3, 0xc97d, 0xa5b7, 0xa5b6, 0xa5b4, 0xa5b5, 0xa6ab, + 0xc9e9, 0xc9eb, 0xa6aa, 0xc9e3, 0xc9e4, 0xc9ea, 0xc9e6, 0xc9e8, + 0xa6a9, 0xc9e5, 0xc9ec, 0xc9e7, 0xa7e1, 0xa7ea, 0xa7e8, 0xcaf0, + 0xcaed, 0xcaf5, 0xa7e6, 0xcaf6, 0xa7df, 0xcaf3, 0xa7e5, 0xcaef, + 0xcaee, 0xa7e3, 0xcaf4, 0xa7e4, 0xa9d3, 0xa7de, 0xcaf1, 0xcae7, + 0xa7db, 0xa7ee, 0xcaec, 0xcaf2, 0xa7e0, 0xa7e2, 0xcae8, 0xcae9, + 0xcaea, 0xa7ed, 0xa7e7, 0xa7ec, 0xcaeb, 0xa7eb, 0xa7dd, 0xa7dc, + 0xa7e9, 0xa9e1, 0xccbe, 0xccb7, 0xa9dc, 0xa9ef, 0xccb3, 0xccba, + 0xccbc, 0xccbf, 0xa9ea, 0xccbb, 0xccb4, 0xa9e8, 0xccb8, 0xccc0, + 0xa9d9, 0xccbd, 0xa9e3, 0xa9e2, 0xccb6, 0xa9d7, 0xa9d8, 0xa9d6, + 0xa9ee, 0xa9e6, 0xa9e0, 0xa9d4, 0xccb9, 0xa9df, 0xa9d5, 0xa9e7, + 0xa9f0, 0xced4, 0xa9e4, 0xccb5, 0xa9da, 0xa9dd, 0xa9de, 0xa9ec, + 0xa9ed, 0xa9eb, 0xa9e5, 0xa9e9, 0xa9db, 0xabf4, 0xceda, 0xac41, + 0xabf8, 0xabfa, 0xac40, 0xcee6, 0xabfd, 0xd1b1, 0xaeb1, 0xac43, + 0xced7, 0xcedf, 0xabfe, 0xcede, 0xcedb, 0xcee3, 0xcee5, 0xabf7, + 0xabfb, 0xac42, 0xaeb3, 0xcee0, 0xabf9, 0xac45, 0xced9, 0xabfc, + 0xaeb2, 0xabf6, 0xced6, 0xcedd, 0xced5, 0xced8, 0xcedc, 0xd1b2, + 0xac44, 0xcee1, 0xcee2, 0xcee4, 0xabf5, 0xaec1, 0xd1be, 0xaebf, + 0xaec0, 0xd1b4, 0xd1c4, 0xaeb6, 0xd566, 0xd1c6, 0xd1c0, 0xd1b7, + 0xd1c9, 0xd1ba, 0xaebc, 0xd57d, 0xd1bd, 0xaebe, 0xaeb5, 0xd1cb, + 0xd1bf, 0xaeb8, 0xd1b8, 0xd1b5, 0xd1b6, 0xaeb9, 0xd1c5, 0xd1cc, + 0xaebb, 0xd1bc, 0xd1bb, 0xaec3, 0xaec2, 0xaeb4, 0xaeba, 0xaebd, + 0xd1c8, 0xd1c2, 0xaeb7, 0xd1b3, 0xd1ca, 0xd1c1, 0xd1c3, 0xd1c7, + 0xd567, 0xb1b7, 0xb1cb, 0xb1ca, 0xb1bf, 0xd579, 0xd575, 0xd572, + 0xd5a6, 0xb1ba, 0xb1b2, 0xd577, 0xb4a8, 0xb1b6, 0xd5a1, 0xb1cc, + 0xb1c9, 0xd57b, 0xd56a, 0xb1c8, 0xd5a3, 0xd569, 0xb1bd, 0xb1c1, + 0xd5a2, 0xd573, 0xb1c2, 0xb1bc, 0xd568, 0xb478, 0xd5a5, 0xd571, + 0xb1c7, 0xd574, 0xd5a4, 0xb1c6, 0xd952, 0xb1b3, 0xd56f, 0xb1b8, + 0xb1c3, 0xb1be, 0xd578, 0xd56e, 0xd56c, 0xd57e, 0xb1b0, 0xb1c4, + 0xb1b4, 0xb477, 0xd57c, 0xb1b5, 0xb1b1, 0xb1c0, 0xb1bb, 0xb1b9, + 0xd570, 0xb1c5, 0xd56d, 0xd57a, 0xd576, 0xd954, 0xd953, 0xd56b, + 0xd964, 0xb47a, 0xd96a, 0xd959, 0xd967, 0xdd77, 0xb47d, 0xd96b, + 0xd96e, 0xb47c, 0xd95c, 0xd96d, 0xd96c, 0xb47e, 0xd955, 0xb479, + 0xb4a3, 0xb4a1, 0xd969, 0xd95f, 0xb4a5, 0xd970, 0xd968, 0xd971, + 0xb4ad, 0xb4ab, 0xd966, 0xd965, 0xd963, 0xd95d, 0xb4a4, 0xb4a2, + 0xd1b9, 0xd956, 0xddb7, 0xd957, 0xb47b, 0xb4aa, 0xdd79, 0xb4a6, + 0xb4a7, 0xd958, 0xd96f, 0xdd78, 0xd960, 0xd95b, 0xb4a9, 0xd961, + 0xd95e, 0xb4ae, 0xb770, 0xdd7c, 0xddb1, 0xddb6, 0xddaa, 0xb76c, + 0xddbb, 0xb769, 0xdd7a, 0xdd7b, 0xb762, 0xb76b, 0xdda4, 0xb76e, + 0xb76f, 0xdda5, 0xddb2, 0xddb8, 0xb76a, 0xb764, 0xdda3, 0xdd7d, + 0xddba, 0xdda8, 0xdda9, 0xdd7e, 0xddb4, 0xddab, 0xddb5, 0xddad, + 0xb765, 0xe1d9, 0xb768, 0xb766, 0xddb9, 0xddb0, 0xddac, 0xdda1, + 0xba53, 0xddaf, 0xb76d, 0xdda7, 0xdda6, 0xb767, 0xb763, 0xe1ee, + 0xddb3, 0xddae, 0xdda2, 0xe1e9, 0xe1da, 0xe1e5, 0xe1ec, 0xba51, + 0xb4ac, 0xe1ea, 0xba4c, 0xba4b, 0xe1f1, 0xe1db, 0xe1e8, 0xe1dc, + 0xe1e7, 0xba4f, 0xe1eb, 0xd962, 0xe1f2, 0xe1e3, 0xba52, 0xe5ba, + 0xbcaf, 0xe1f0, 0xe1ef, 0xba54, 0xe5ad, 0xbcb0, 0xe5ae, 0xe1df, + 0xe1e0, 0xe1dd, 0xe1e2, 0xe1de, 0xe1f3, 0xba4e, 0xbcb1, 0xba50, + 0xba55, 0xe1e1, 0xe1ed, 0xe1e6, 0xe5b1, 0xba4a, 0xbcb4, 0xe9aa, + 0xe5b6, 0xe5b5, 0xe5b7, 0xe5b4, 0xbcb5, 0xbcbb, 0xbcb8, 0xbcb9, + 0xe5af, 0xe5b2, 0xe5bc, 0xbcc1, 0xbcbf, 0xe5b3, 0xd95a, 0xbcb2, + 0xe5b9, 0xe5b0, 0xbcc2, 0xe5b8, 0xba4d, 0xbcb7, 0xe1e4, 0xbcba, + 0xbcbe, 0xbcc0, 0xbcbd, 0xbcbc, 0xbcb6, 0xe5bb, 0xbcb3, 0xbcc3, + 0xbed8, 0xbed9, 0xe9a9, 0xbee2, 0xbedf, 0xbed6, 0xbedd, 0xe9ab, + 0xbedb, 0xbed5, 0xbedc, 0xe9a8, 0xc0bb, 0xbed7, 0xbede, 0xc0ba, + 0xe9a7, 0xe9a6, 0xbee0, 0xbee1, 0xe9a5, 0xe9a4, 0xc0bc, 0xe9ae, + 0xbeda, 0xe9ac, 0xc0bd, 0xc0c2, 0xecea, 0xecec, 0xc0bf, 0xeced, + 0xece9, 0xeceb, 0xc0c0, 0xc0c3, 0xece8, 0xc0be, 0xc0c1, 0xc259, + 0xe9ad, 0xc258, 0xc25e, 0xefd4, 0xc25c, 0xc25d, 0xefd7, 0xefd3, + 0xc25a, 0xefd1, 0xc36b, 0xefd5, 0xefd6, 0xefd2, 0xc25b, 0xf242, + 0xf245, 0xf246, 0xf244, 0xf247, 0xc36c, 0xf243, 0xf44e, 0xc464, + 0xf44d, 0xf44c, 0xf44b, 0xc463, 0xc465, 0xf5cd, 0xc4e2, 0xc4e1, + 0xf6e1, 0xf6e0, 0xf6e3, 0xc5cb, 0xc575, 0xf7dd, 0xf6e2, 0xf7dc, + 0xc5cd, 0xc5cc, 0xc5f3, 0xf8a9, 0xf8ef, 0xa4e4, 0xd972, 0xe9af, + 0xa6ac, 0xcaf7, 0xa7f1, 0xa7ef, 0xa7f0, 0xccc1, 0xa9f1, 0xac46, + 0xcee7, 0xcee8, 0xac47, 0xd1ce, 0xaec4, 0xaec5, 0xd1cd, 0xb1d3, + 0xb1cf, 0xd5a7, 0xb1d6, 0xb1d5, 0xb1ce, 0xb1d1, 0xb1d4, 0xb1d0, + 0xd976, 0xb1cd, 0xb4af, 0xb4b1, 0xb4b2, 0xd975, 0xd978, 0xb4b0, + 0xd973, 0xd977, 0xd974, 0xb771, 0xddbc, 0xba56, 0xe1f4, 0xbee3, + 0xbcc4, 0xe5bd, 0xbcc5, 0xbcc6, 0xe5bf, 0xe5be, 0xe5c0, 0xe9b1, + 0xe9b0, 0xecef, 0xecee, 0xc0c4, 0xc0c5, 0xf248, 0xa4e5, 0xd979, + 0xb4b4, 0xb4b3, 0xddbd, 0xefd8, 0xc4e3, 0xf7de, 0xa4e6, 0xaec6, + 0xb1d8, 0xb1d7, 0xd97a, 0xd97b, 0xb772, 0xe1f5, 0xba57, 0xe9b2, + 0xa4e7, 0xa5b8, 0xa9f2, 0xccc2, 0xcee9, 0xac48, 0xb1d9, 0xd97c, + 0xb4b5, 0xb773, 0xe5c1, 0xe5c2, 0xecf0, 0xc25f, 0xf8f0, 0xa4e8, + 0xccc3, 0xa9f3, 0xac49, 0xceea, 0xaec7, 0xd1d2, 0xd1d0, 0xd1d1, + 0xaec8, 0xd1cf, 0xb1db, 0xb1dc, 0xd5a8, 0xb1dd, 0xb1da, 0xd97d, + 0xd97e, 0xddbe, 0xba59, 0xba58, 0xecf1, 0xefd9, 0xf24a, 0xf249, + 0xf44f, 0xc95e, 0xac4a, 0xa4e9, 0xa5b9, 0xa6ae, 0xa6ad, 0xa6af, + 0xa6b0, 0xc9ee, 0xc9ed, 0xcaf8, 0xa7f2, 0xcafb, 0xcafa, 0xcaf9, + 0xcafc, 0xa9f4, 0xccc9, 0xccc5, 0xccce, 0xa9fb, 0xa9f9, 0xccca, + 0xccc6, 0xcccd, 0xa9f8, 0xaa40, 0xccc8, 0xccc4, 0xa9fe, 0xcccb, + 0xa9f7, 0xcccc, 0xa9fa, 0xa9fc, 0xccd0, 0xcccf, 0xccc7, 0xa9f6, + 0xa9f5, 0xa9fd, 0xceef, 0xcef5, 0xac50, 0xac4d, 0xceec, 0xcef1, + 0xac53, 0xac4b, 0xcef0, 0xac4e, 0xac51, 0xcef3, 0xac4c, 0xcef8, + 0xac4f, 0xac52, 0xceed, 0xcef2, 0xcef6, 0xceee, 0xceeb, 0xcef7, + 0xcef4, 0xaed0, 0xaec9, 0xaecc, 0xaecf, 0xd1d5, 0xaeca, 0xd1d3, + 0xaece, 0xaecb, 0xd1d6, 0xaecd, 0xd5ac, 0xb1df, 0xd5ab, 0xd5ad, + 0xb1de, 0xb1e3, 0xd1d4, 0xd5aa, 0xd5ae, 0xb1e0, 0xd5a9, 0xb1e2, + 0xb1e1, 0xd9a7, 0xd9a2, 0xb4b6, 0xb4ba, 0xb4b7, 0xd9a5, 0xd9a8, + 0xb4b8, 0xb4b9, 0xb4be, 0xddc7, 0xd9a6, 0xb4bc, 0xd9a3, 0xd9a1, + 0xb4bd, 0xd9a4, 0xb779, 0xddbf, 0xb776, 0xb777, 0xb775, 0xddc4, + 0xddc3, 0xddc0, 0xb77b, 0xddc2, 0xb4bb, 0xddc6, 0xddc1, 0xb778, + 0xb774, 0xb77a, 0xddc5, 0xba5c, 0xe1f8, 0xe1f7, 0xe1f6, 0xba5a, + 0xba5b, 0xe5c5, 0xe5c8, 0xbcc8, 0xbcc7, 0xe5c9, 0xe5c4, 0xbcca, + 0xe5c6, 0xbcc9, 0xe5c3, 0xe5c7, 0xbee9, 0xbee6, 0xe9bb, 0xe9ba, + 0xe9b9, 0xe9b4, 0xe9b5, 0xbee7, 0xbee4, 0xbee8, 0xe9b3, 0xbee5, + 0xe9b6, 0xe9b7, 0xe9bc, 0xe9b8, 0xecf2, 0xc0c7, 0xefdc, 0xc0c6, + 0xefda, 0xefdb, 0xc260, 0xc36e, 0xf24b, 0xc36d, 0xf451, 0xf452, + 0xc466, 0xf450, 0xc4e4, 0xf7df, 0xc5ce, 0xf8aa, 0xf8ab, 0xa4ea, + 0xa6b1, 0xa6b2, 0xa7f3, 0xccd1, 0xac54, 0xaed1, 0xb1e4, 0xb0d2, + 0xb4bf, 0xb4c0, 0xb3cc, 0xd9a9, 0xb77c, 0xe1fa, 0xe1f9, 0xa4eb, + 0xa6b3, 0xccd2, 0xaa42, 0xaa41, 0xcef9, 0xcefa, 0xd1d7, 0xd1d8, + 0xaed2, 0xaed3, 0xaed4, 0xd5af, 0xb1e6, 0xb4c2, 0xb4c1, 0xddc8, + 0xdf7a, 0xe1fb, 0xe9bd, 0xc261, 0xc467, 0xa4ec, 0xa5bc, 0xa5bd, + 0xa5bb, 0xa5be, 0xa5ba, 0xa6b6, 0xc9f6, 0xa6b5, 0xa6b7, 0xc9f1, + 0xc9f0, 0xc9f3, 0xc9f2, 0xc9f5, 0xa6b4, 0xc9ef, 0xc9f4, 0xcafd, + 0xa7fd, 0xcafe, 0xcb43, 0xa7fc, 0xcb47, 0xcb42, 0xcb45, 0xa7f5, + 0xa7f6, 0xa7f7, 0xa7f8, 0xa840, 0xcb41, 0xa7fa, 0xa841, 0xcb40, + 0xcb46, 0xa7f9, 0xcb44, 0xa7fb, 0xa7f4, 0xa7fe, 0xaa57, 0xccd4, + 0xaa43, 0xaa4d, 0xaa4e, 0xaa46, 0xaa58, 0xaa48, 0xccdc, 0xaa53, + 0xccd7, 0xaa49, 0xcce6, 0xcce7, 0xccdf, 0xccd8, 0xaa56, 0xcce4, + 0xaa51, 0xaa4f, 0xcce5, 0xcce3, 0xccdb, 0xccd3, 0xccda, 0xaa4a, + 0xaa50, 0xaa44, 0xccde, 0xccdd, 0xccd5, 0xaa52, 0xcce1, 0xccd6, + 0xaa55, 0xcce8, 0xaa45, 0xaa4c, 0xccd9, 0xcce2, 0xaa54, 0xaa47, + 0xaa4b, 0xcce0, 0xcf5b, 0xac5c, 0xac69, 0xcf56, 0xcf4c, 0xac62, + 0xcf4a, 0xac5b, 0xcf45, 0xac65, 0xcf52, 0xcefe, 0xcf41, 0xcf44, + 0xcefb, 0xcf51, 0xcf61, 0xac60, 0xcf46, 0xcf58, 0xcefd, 0xcf5f, + 0xcf60, 0xcf63, 0xcf5a, 0xcf4b, 0xcf53, 0xac66, 0xac59, 0xac61, + 0xac6d, 0xac56, 0xac58, 0xcf43, 0xac6a, 0xac63, 0xcf5d, 0xcf40, + 0xac6c, 0xac67, 0xcf49, 0xac6b, 0xcf50, 0xcf48, 0xac64, 0xcf5c, + 0xcf54, 0xac5e, 0xcf62, 0xcf47, 0xac5a, 0xcf59, 0xcf4f, 0xac5f, + 0xcf55, 0xac57, 0xcefc, 0xac68, 0xaee3, 0xac5d, 0xcf4e, 0xcf4d, + 0xcf42, 0xcf5e, 0xcf57, 0xac55, 0xd1ec, 0xaeea, 0xd1ed, 0xd1e1, + 0xaedf, 0xaeeb, 0xd1da, 0xd1e3, 0xd1eb, 0xd1d9, 0xd1f4, 0xaed5, + 0xd1f3, 0xd1ee, 0xd1ef, 0xaedd, 0xaee8, 0xd1e5, 0xd1e6, 0xd1f0, + 0xd1e7, 0xd1e2, 0xd1dc, 0xd1dd, 0xd1ea, 0xd1e4, 0xaed6, 0xaeda, + 0xd1f2, 0xd1de, 0xaee6, 0xaee2, 0xaee5, 0xaeec, 0xaedb, 0xaee7, + 0xd1e9, 0xaee9, 0xaed8, 0xaed7, 0xd1db, 0xd1df, 0xaee0, 0xd1f1, + 0xd1e8, 0xd1e0, 0xaee4, 0xaee1, 0xaed9, 0xaedc, 0xd5c4, 0xd5b4, + 0xd5b5, 0xd5b9, 0xd5c8, 0xd5c5, 0xd5be, 0xd5bd, 0xb1ed, 0xd5c1, + 0xd5d0, 0xd5b0, 0xd5d1, 0xd5c3, 0xd5d5, 0xd5c9, 0xb1ec, 0xd5c7, + 0xb1e7, 0xb1fc, 0xb1f2, 0xb1f6, 0xb1f5, 0xd5b1, 0xd5ce, 0xd5d4, + 0xd5cc, 0xd5d3, 0xd5c0, 0xd5b2, 0xd5d2, 0xd5c2, 0xb1ea, 0xb1f7, + 0xd5cb, 0xb1f0, 0xd5ca, 0xd5b3, 0xb1f8, 0xb1fa, 0xd5cd, 0xb1fb, + 0xb1e9, 0xd5ba, 0xd5cf, 0xb1ef, 0xb1f9, 0xd5bc, 0xd5c6, 0xd5b7, + 0xd5bb, 0xb1f4, 0xd5b6, 0xb1e8, 0xb1f1, 0xb1ee, 0xd5bf, 0xaede, + 0xd9c0, 0xb1eb, 0xb1f3, 0xd9c3, 0xd9d9, 0xd9ce, 0xb4d6, 0xb4d1, + 0xd9bd, 0xb4d2, 0xd9cd, 0xd9c6, 0xd9d3, 0xb4ce, 0xd9ab, 0xd9d5, + 0xb4c4, 0xd9b3, 0xb4c7, 0xb4c6, 0xb4d7, 0xd9ad, 0xd9cf, 0xd9d0, + 0xb4c9, 0xb4c5, 0xd9bb, 0xb4d0, 0xd9b6, 0xd9d1, 0xb4cc, 0xd9c9, + 0xd9d6, 0xd9b0, 0xd9b5, 0xd9af, 0xb4cb, 0xd9c2, 0xddde, 0xd9b1, + 0xb4cf, 0xd9ba, 0xd9d2, 0xb4ca, 0xd9b7, 0xd9b4, 0xd9c5, 0xb4cd, + 0xb4c3, 0xb4d9, 0xd9c8, 0xd9c7, 0xd9ac, 0xb4c8, 0xd9d4, 0xd9bc, + 0xd9be, 0xd9cb, 0xd9ca, 0xd9aa, 0xb4d3, 0xb4d5, 0xd9b2, 0xd9b9, + 0xd9c1, 0xb4d4, 0xd9b8, 0xd9c4, 0xd9d7, 0xd9cc, 0xd9d8, 0xd9ae, + 0xddf2, 0xb7a6, 0xddf0, 0xdddb, 0xdde0, 0xddd9, 0xddec, 0xddcb, + 0xddd2, 0xddea, 0xddf4, 0xdddc, 0xddcf, 0xdde2, 0xdde7, 0xddd3, + 0xdde4, 0xddd0, 0xddd7, 0xddd8, 0xb7a8, 0xddeb, 0xdde9, 0xddcc, + 0xddee, 0xddef, 0xddf1, 0xb7ac, 0xb7a4, 0xd5b8, 0xddd4, 0xdde6, + 0xddd5, 0xb7a1, 0xb7b1, 0xdded, 0xb7af, 0xb7ab, 0xddca, 0xb7a3, + 0xddcd, 0xb7b0, 0xdddd, 0xddc9, 0xb7a9, 0xdde1, 0xddd1, 0xb7aa, + 0xddda, 0xb77e, 0xb4d8, 0xdde3, 0xd9bf, 0xddce, 0xdde8, 0xb7a5, + 0xdde5, 0xb7a2, 0xdddf, 0xb7ad, 0xddd6, 0xddf3, 0xb7a7, 0xdec6, + 0xb7ae, 0xe24a, 0xe248, 0xe25e, 0xe246, 0xe258, 0xb77d, 0xba5f, + 0xe242, 0xe25d, 0xe247, 0xe255, 0xba64, 0xba5d, 0xe25b, 0xe240, + 0xe25a, 0xba6f, 0xe251, 0xe261, 0xba6d, 0xe249, 0xba5e, 0xe24b, + 0xe259, 0xba67, 0xe244, 0xba6b, 0xba61, 0xe24d, 0xe243, 0xe1fc, + 0xe257, 0xba68, 0xe260, 0xe1fd, 0xba65, 0xe253, 0xba66, 0xe245, + 0xe250, 0xe24c, 0xe24e, 0xba60, 0xe25f, 0xba6e, 0xe24f, 0xe262, + 0xe1fe, 0xe254, 0xba63, 0xba6c, 0xba6a, 0xe241, 0xe256, 0xba69, + 0xba62, 0xe252, 0xe25c, 0xe5d5, 0xe5d1, 0xe5cd, 0xe5e1, 0xe5de, + 0xbccd, 0xe5e5, 0xe5d4, 0xbcd8, 0xe5db, 0xe5d0, 0xe5da, 0xbcd5, + 0xe5ee, 0xe5eb, 0xe5dd, 0xe5ce, 0xe5e2, 0xe5e4, 0xbcd1, 0xe5d8, + 0xe5d3, 0xe5ca, 0xbcce, 0xbcd6, 0xe5e7, 0xbcd7, 0xe5cb, 0xe5ed, + 0xe5e0, 0xe5e6, 0xbcd4, 0xe5e3, 0xe5ea, 0xbcd9, 0xbcd3, 0xe5dc, + 0xe5cf, 0xe5ef, 0xe5cc, 0xe5e8, 0xbcd0, 0xe5d6, 0xe5d7, 0xbccf, + 0xbccc, 0xe5d2, 0xbcd2, 0xbccb, 0xe5e9, 0xe5ec, 0xe5d9, 0xe9ca, + 0xe9c2, 0xe9be, 0xbef6, 0xbeeb, 0xbef0, 0xbeec, 0xe9cc, 0xe9d7, + 0xbeea, 0xe9c4, 0xe9cd, 0xe5df, 0xe9ce, 0xbef1, 0xe9dd, 0xbef5, + 0xbef8, 0xe9c0, 0xbef4, 0xe9db, 0xe9dc, 0xe9d2, 0xe9d1, 0xe9c9, + 0xe9d3, 0xe9da, 0xe9d9, 0xbeef, 0xbeed, 0xe9cb, 0xe9c8, 0xe9c5, + 0xe9d8, 0xbef7, 0xe9d6, 0xbef3, 0xbef2, 0xe9d0, 0xe9bf, 0xe9c1, + 0xe9c3, 0xe9d5, 0xe9cf, 0xbeee, 0xe9c6, 0xe9d4, 0xe9c7, 0xc0cf, + 0xed45, 0xc0c8, 0xecf5, 0xed41, 0xc0ca, 0xed48, 0xecfc, 0xecf7, + 0xed49, 0xecf3, 0xecfe, 0xc0d1, 0xed44, 0xed4a, 0xecfd, 0xc0c9, + 0xed40, 0xecf4, 0xc0d0, 0xed47, 0xecf9, 0xc0cc, 0xecfb, 0xecf8, + 0xc0d2, 0xecfa, 0xc0cb, 0xc0ce, 0xed43, 0xecf6, 0xed46, 0xed42, + 0xc263, 0xefe7, 0xc268, 0xc269, 0xc262, 0xefe6, 0xefe3, 0xefe4, + 0xc266, 0xefde, 0xefe2, 0xc265, 0xefdf, 0xc267, 0xc264, 0xefdd, + 0xefe1, 0xefe5, 0xf251, 0xf24e, 0xf257, 0xf256, 0xf254, 0xf24f, + 0xc372, 0xf250, 0xc371, 0xc0cd, 0xf253, 0xc370, 0xf258, 0xf252, + 0xf24d, 0xefe0, 0xc36f, 0xf24c, 0xf456, 0xf455, 0xf255, 0xc468, + 0xf459, 0xf45a, 0xf454, 0xf458, 0xf453, 0xf5d1, 0xf457, 0xc4e7, + 0xc4e5, 0xf5cf, 0xf5d2, 0xf5ce, 0xf5d0, 0xc4e6, 0xf6e5, 0xf6e6, + 0xc576, 0xf6e4, 0xf7e2, 0xc5cf, 0xf7e0, 0xf7e1, 0xf8ac, 0xc656, + 0xf8f3, 0xf8f1, 0xf8f2, 0xf8f4, 0xf9bb, 0xa4ed, 0xa6b8, 0xaa59, + 0xcce9, 0xcf64, 0xd1f5, 0xd1f7, 0xd1f6, 0xd1f8, 0xb1fd, 0xd5d7, + 0xd1f9, 0xd5d6, 0xd5d8, 0xd5d9, 0xd9da, 0xb4db, 0xd9db, 0xd9dd, + 0xb4dc, 0xb4da, 0xd9dc, 0xddfa, 0xddf8, 0xddf7, 0xddf6, 0xddf5, + 0xb7b2, 0xddf9, 0xba70, 0xe263, 0xe265, 0xba71, 0xe264, 0xbcdb, + 0xbcda, 0xe5f0, 0xe9df, 0xe9de, 0xe9e0, 0xbef9, 0xed4b, 0xc0d3, + 0xefe8, 0xc26a, 0xf259, 0xc577, 0xa4ee, 0xa5bf, 0xa6b9, 0xa842, + 0xaa5a, 0xaa5b, 0xac6e, 0xd1fa, 0xb7b3, 0xe6d1, 0xbefa, 0xc26b, + 0xa4ef, 0xa6ba, 0xcceb, 0xaa5c, 0xccea, 0xcf65, 0xac6f, 0xcf66, + 0xac70, 0xd1fc, 0xaeee, 0xaeed, 0xd5de, 0xd5dc, 0xd5dd, 0xd5db, + 0xd5da, 0xd9de, 0xd9e1, 0xb4de, 0xd9df, 0xb4dd, 0xd9e0, 0xddfb, + 0xe266, 0xe267, 0xe268, 0xe5f3, 0xe5f2, 0xbcdc, 0xe5f1, 0xe5f4, + 0xe9e1, 0xe9e2, 0xe9e3, 0xed4c, 0xc0d4, 0xc26c, 0xf25a, 0xc4e8, + 0xc95f, 0xac71, 0xcf67, 0xaeef, 0xb1fe, 0xb4df, 0xd9e2, 0xb7b5, + 0xb7b4, 0xe269, 0xe26a, 0xbcdd, 0xbcde, 0xe9e5, 0xe9e4, 0xefe9, + 0xf7e3, 0xa4f0, 0xc960, 0xa5c0, 0xa843, 0xcb48, 0xac72, 0xb7b6, + 0xa4f1, 0xcf68, 0xac73, 0xcf69, 0xc0d5, 0xa4f2, 0xccec, 0xcf6a, + 0xd242, 0xd241, 0xd1fe, 0xd1fd, 0xd243, 0xd240, 0xb240, 0xb241, + 0xb4e0, 0xd9e3, 0xd9e4, 0xd9e5, 0xde41, 0xde42, 0xde40, 0xddfd, + 0xddfe, 0xb7b7, 0xe26b, 0xe5f7, 0xe5f6, 0xe5f5, 0xe5f8, 0xe9e7, + 0xe9e6, 0xbefb, 0xe9e8, 0xc0d6, 0xed4d, 0xefea, 0xf25b, 0xf6e7, + 0xa4f3, 0xa5c2, 0xa5c1, 0xaa5d, 0xc961, 0xc97e, 0xa6bb, 0xc9f7, + 0xcb49, 0xcb4a, 0xaa5e, 0xcced, 0xac74, 0xcf6b, 0xcf6c, 0xaef0, + 0xaef4, 0xd244, 0xaef3, 0xaef1, 0xaef2, 0xd5df, 0xb242, 0xb4e3, + 0xb4e1, 0xb4e2, 0xd9e6, 0xba72, 0xa4f4, 0xc9a1, 0xa5c3, 0xc9a4, + 0xa5c6, 0xc9a3, 0xa5c5, 0xa5c4, 0xa844, 0xc9a2, 0xc9f8, 0xc9fc, + 0xc9fe, 0xca40, 0xa6c5, 0xa6c6, 0xc9fb, 0xa6c1, 0xc9f9, 0xc9fd, + 0xa6c2, 0xa6bd, 0xa6be, 0xa6c4, 0xc9fa, 0xa6bc, 0xa845, 0xa6bf, + 0xa6c0, 0xa6c3, 0xcb5b, 0xcb59, 0xcb4c, 0xa851, 0xcb53, 0xa84c, + 0xcb4d, 0xcb55, 0xcb52, 0xa84f, 0xcb51, 0xa856, 0xcb5a, 0xa858, + 0xa85a, 0xcb4b, 0xa84d, 0xcb5c, 0xa854, 0xa857, 0xcd45, 0xa847, + 0xa85e, 0xa855, 0xcb4e, 0xa84a, 0xa859, 0xcb56, 0xa848, 0xa849, + 0xcd43, 0xcb4f, 0xa850, 0xa85b, 0xcb5d, 0xcb50, 0xa84e, 0xa853, + 0xccee, 0xa85c, 0xcb57, 0xa852, 0xa85d, 0xa846, 0xcb54, 0xa84b, + 0xcb58, 0xcd44, 0xaa6a, 0xaa7a, 0xccf5, 0xaa71, 0xcd4b, 0xaa62, + 0xaa65, 0xcd42, 0xccf3, 0xccf7, 0xaa6d, 0xaa6f, 0xccfa, 0xaa76, + 0xaa68, 0xaa66, 0xaa67, 0xaa75, 0xcd47, 0xaa70, 0xccf9, 0xccfb, + 0xaa6e, 0xaa73, 0xccfc, 0xcd4a, 0xac75, 0xaa79, 0xaa63, 0xcd49, + 0xcd4d, 0xccf8, 0xcd4f, 0xcd40, 0xaa6c, 0xccf4, 0xaa6b, 0xaa7d, + 0xaa72, 0xccf2, 0xcf75, 0xaa78, 0xaa7c, 0xcd41, 0xcd46, 0xaa7e, + 0xaa77, 0xaa69, 0xaa5f, 0xaa64, 0xccf6, 0xaa60, 0xcd4e, 0xccf0, + 0xccef, 0xccfd, 0xccf1, 0xaa7b, 0xaef5, 0xaa74, 0xccfe, 0xaa61, + 0xaca6, 0xcd4c, 0xcf7c, 0xcfa1, 0xcfa4, 0xcf77, 0xcfa7, 0xcfaa, + 0xcfac, 0xcf74, 0xac76, 0xac7b, 0xd249, 0xacad, 0xcfa5, 0xcfad, + 0xcf7b, 0xcf73, 0xd264, 0xac7e, 0xcfa2, 0xcf78, 0xcf7a, 0xaca5, + 0xcf7d, 0xac7d, 0xcf70, 0xcfa8, 0xcfab, 0xac7a, 0xaca8, 0xcf6d, + 0xacaa, 0xac78, 0xacae, 0xcfa9, 0xcf6f, 0xacab, 0xd25e, 0xcd48, + 0xac7c, 0xac77, 0xcf76, 0xcf6e, 0xacac, 0xaca4, 0xcfa3, 0xaca9, + 0xaca7, 0xcf79, 0xaca1, 0xcf71, 0xaca2, 0xaca3, 0xcf72, 0xcfa6, + 0xac79, 0xcf7e, 0xd24c, 0xaefd, 0xaf43, 0xd255, 0xd25b, 0xd257, + 0xd24a, 0xd24d, 0xd246, 0xd247, 0xaf4a, 0xaefa, 0xd256, 0xd25f, + 0xaf45, 0xaef6, 0xaf40, 0xd24e, 0xaf42, 0xd24f, 0xd259, 0xaf44, + 0xd268, 0xd248, 0xaefc, 0xaefb, 0xaf48, 0xd245, 0xd266, 0xd25a, + 0xd267, 0xd261, 0xd253, 0xd262, 0xd25c, 0xd265, 0xd263, 0xaf49, + 0xd254, 0xaef9, 0xaef8, 0xaf41, 0xaf47, 0xd260, 0xaf46, 0xd251, + 0xb243, 0xd269, 0xd250, 0xd24b, 0xaefe, 0xaf4b, 0xaef7, 0xd258, + 0xd25d, 0xb265, 0xd5e1, 0xd5e5, 0xb252, 0xb250, 0xb247, 0xd5e3, + 0xd5e2, 0xb25b, 0xd5e8, 0xb255, 0xd5fa, 0xd647, 0xb244, 0xd5f7, + 0xd5f0, 0xb267, 0xd5e0, 0xd5fc, 0xb264, 0xb258, 0xb263, 0xb24e, + 0xd5ec, 0xd5fe, 0xd5f6, 0xb24f, 0xb249, 0xd645, 0xd5fd, 0xd640, + 0xb251, 0xb259, 0xd642, 0xd5ea, 0xd5fb, 0xd5ef, 0xd644, 0xb25e, + 0xb246, 0xb25c, 0xd5f4, 0xd5f2, 0xd5f3, 0xb253, 0xd5ee, 0xd5ed, + 0xb248, 0xd5e7, 0xd646, 0xb24a, 0xd5f1, 0xb268, 0xb262, 0xd5e6, + 0xb25f, 0xb25d, 0xb266, 0xd5f8, 0xb261, 0xd252, 0xd5f9, 0xb260, + 0xd641, 0xb245, 0xd5f5, 0xb257, 0xd5e9, 0xb256, 0xb254, 0xb24c, + 0xb24b, 0xd9e7, 0xd643, 0xd5eb, 0xd9fc, 0xb24d, 0xb541, 0xb25a, + 0xb4ee, 0xd9f6, 0xb4fc, 0xd9ea, 0xb4eb, 0xb4e7, 0xda49, 0xb4ed, + 0xb4f1, 0xb4ec, 0xb4f5, 0xda4d, 0xda44, 0xd9f1, 0xb4fa, 0xb4f4, + 0xd9fd, 0xb4e4, 0xda4a, 0xda43, 0xb4e8, 0xd9f7, 0xb4f7, 0xda55, + 0xda56, 0xb4e5, 0xda48, 0xb4f9, 0xd9fb, 0xd9ed, 0xd9ee, 0xb4fd, + 0xd9f2, 0xd9f9, 0xd9f3, 0xb4fb, 0xb544, 0xd9ef, 0xd9e8, 0xd9e9, + 0xd9eb, 0xb4ea, 0xd9f8, 0xb4f8, 0xb542, 0xd9fa, 0xda53, 0xda4b, + 0xb4e6, 0xda51, 0xb4f2, 0xb4f0, 0xda57, 0xb4ef, 0xda41, 0xd9f4, + 0xd9fe, 0xb547, 0xda45, 0xda42, 0xd9f0, 0xb543, 0xda4f, 0xda4c, + 0xda54, 0xb4e9, 0xda40, 0xb546, 0xda47, 0xb4f3, 0xb4f6, 0xda46, + 0xb545, 0xd9f5, 0xd5e4, 0xda50, 0xda4e, 0xda52, 0xd9ec, 0xb540, + 0xde61, 0xde60, 0xde46, 0xb7bd, 0xde5f, 0xde49, 0xde4a, 0xb7c7, + 0xde68, 0xb7c2, 0xde5e, 0xde43, 0xb7c8, 0xb7be, 0xde52, 0xde48, + 0xde4b, 0xde63, 0xb7b8, 0xde6a, 0xde62, 0xb7c1, 0xde57, 0xb7cc, + 0xb7cb, 0xb7c5, 0xde69, 0xb7b9, 0xde55, 0xde4c, 0xde59, 0xde65, + 0xb7cd, 0xb7bb, 0xde54, 0xde4d, 0xb7c4, 0xb7c3, 0xde50, 0xde5a, + 0xde64, 0xde47, 0xde51, 0xb7bc, 0xde5b, 0xb7c9, 0xb7c0, 0xde4e, + 0xb7bf, 0xde45, 0xde53, 0xde67, 0xb4fe, 0xbab0, 0xde56, 0xe26c, + 0xde58, 0xde66, 0xb7c6, 0xde4f, 0xb7ba, 0xb7ca, 0xbcf0, 0xde44, + 0xde5d, 0xde5c, 0xe2aa, 0xbaad, 0xe27d, 0xe2a4, 0xbaa2, 0xe26e, + 0xbaaf, 0xba77, 0xe26d, 0xe2b0, 0xbab1, 0xe271, 0xe2a3, 0xe273, + 0xe2b3, 0xe2af, 0xba75, 0xbaa1, 0xe653, 0xbaae, 0xba7d, 0xe26f, + 0xe2ae, 0xbaa3, 0xe2ab, 0xe2b8, 0xe275, 0xe27e, 0xe2b6, 0xe2ac, + 0xba7c, 0xe27c, 0xba76, 0xba74, 0xbaa8, 0xe27a, 0xe277, 0xe278, + 0xe2b2, 0xe2b7, 0xe2b5, 0xba7a, 0xe2b9, 0xba7e, 0xbaa7, 0xe270, + 0xe5fa, 0xe279, 0xba78, 0xbaac, 0xbaa9, 0xba7b, 0xe2a5, 0xe274, + 0xbaaa, 0xe2a7, 0xbaa4, 0xbaa6, 0xba73, 0xe2a9, 0xe2a1, 0xe272, + 0xbaa5, 0xe2b1, 0xe2b4, 0xe27b, 0xe2a8, 0xba79, 0xbcdf, 0xe2a6, + 0xe5f9, 0xe2ad, 0xe276, 0xe644, 0xe64e, 0xbce2, 0xe64d, 0xe659, + 0xbce4, 0xe64b, 0xe64f, 0xbcef, 0xe646, 0xbce7, 0xe652, 0xe9f0, + 0xbcf3, 0xbcf2, 0xe654, 0xe643, 0xe65e, 0xbced, 0xbce3, 0xe657, + 0xe65b, 0xe660, 0xe655, 0xe649, 0xbce6, 0xbce9, 0xbcf1, 0xbcec, + 0xe64c, 0xe2a2, 0xe648, 0xe65f, 0xbce8, 0xbceb, 0xe661, 0xbce0, + 0xe656, 0xe5fb, 0xe65c, 0xc0df, 0xe64a, 0xbce1, 0xe645, 0xbce5, + 0xe5fc, 0xbaab, 0xe641, 0xe65a, 0xe642, 0xe640, 0xbcea, 0xe658, + 0xe5fe, 0xe651, 0xe650, 0xe65d, 0xe647, 0xbcee, 0xe9f3, 0xbf49, + 0xbefe, 0xea40, 0xe9eb, 0xbf41, 0xe9f7, 0xbf48, 0xbf43, 0xe9f5, + 0xed4f, 0xe9fb, 0xea42, 0xe9fa, 0xe9e9, 0xe9f8, 0xea44, 0xea46, + 0xbefd, 0xea45, 0xbf44, 0xbf4a, 0xbf47, 0xe9fe, 0xbf46, 0xe9f9, + 0xe9ed, 0xe9f2, 0xe9fd, 0xbf45, 0xbf42, 0xbefc, 0xbf40, 0xe9f1, + 0xe5fd, 0xe9ec, 0xe9ef, 0xea41, 0xe9f4, 0xe9ea, 0xed4e, 0xea43, + 0xe9ee, 0xe9fc, 0xed51, 0xc0e3, 0xc0d7, 0xc0db, 0xed53, 0xed59, + 0xed57, 0xc0d9, 0xc0da, 0xc0e1, 0xed5a, 0xed52, 0xc0dc, 0xed56, + 0xed55, 0xed5b, 0xc0e2, 0xc0dd, 0xc0e0, 0xed54, 0xc0e4, 0xc0de, + 0xc0e5, 0xc0d8, 0xed58, 0xed50, 0xeff7, 0xc271, 0xeff4, 0xeff6, + 0xc26f, 0xeff2, 0xeff3, 0xefee, 0xe9f6, 0xefef, 0xc270, 0xefeb, + 0xc26d, 0xeff8, 0xc26e, 0xefec, 0xefed, 0xeff1, 0xc273, 0xc272, + 0xeff0, 0xc378, 0xf25f, 0xf265, 0xc379, 0xf25c, 0xc376, 0xc373, + 0xf267, 0xc377, 0xc374, 0xf25e, 0xf261, 0xf262, 0xf263, 0xf266, + 0xeff5, 0xf25d, 0xc375, 0xf264, 0xf268, 0xf260, 0xf45d, 0xc46a, + 0xf460, 0xc46b, 0xf468, 0xf45f, 0xf45c, 0xf45e, 0xf462, 0xf465, + 0xf464, 0xf467, 0xf45b, 0xc469, 0xf463, 0xf466, 0xf469, 0xf461, + 0xf5d3, 0xf5d4, 0xf5d8, 0xf5d9, 0xf5d6, 0xf5d7, 0xf5d5, 0xc4e9, + 0xc578, 0xf6eb, 0xf6e8, 0xf6e9, 0xf6ea, 0xc579, 0xf7e5, 0xf7e4, + 0xf8af, 0xc5f4, 0xf8ad, 0xf8b0, 0xf8ae, 0xf8f5, 0xc657, 0xc665, + 0xf9a3, 0xf96c, 0xf9a2, 0xf9d0, 0xf9d1, 0xa4f5, 0xa6c7, 0xca41, + 0xcb5e, 0xa85f, 0xa862, 0xcb5f, 0xa860, 0xa861, 0xcd58, 0xcd5a, + 0xcd55, 0xcd52, 0xcd54, 0xaaa4, 0xaaa2, 0xcd56, 0xaaa3, 0xcd53, + 0xcd50, 0xaaa1, 0xcd57, 0xcd51, 0xaaa5, 0xcd59, 0xcfaf, 0xcfb3, + 0xacb7, 0xcfb6, 0xacaf, 0xacb2, 0xacb4, 0xacb6, 0xacb3, 0xcfb2, + 0xcfb1, 0xacb1, 0xcfb4, 0xcfb5, 0xcfae, 0xacb5, 0xacb0, 0xcfb0, + 0xd277, 0xd278, 0xd279, 0xaf50, 0xaf4c, 0xd26e, 0xd276, 0xd27b, + 0xaf51, 0xd26c, 0xd272, 0xd26b, 0xd275, 0xd271, 0xaf4d, 0xaf4f, + 0xd27a, 0xd26a, 0xd26d, 0xd273, 0xd274, 0xd27c, 0xd270, 0xaf4e, + 0xb26d, 0xd64e, 0xd650, 0xd64c, 0xd658, 0xd64a, 0xd657, 0xb269, + 0xd648, 0xda5b, 0xd652, 0xb26c, 0xd653, 0xd656, 0xd65a, 0xd64f, + 0xd654, 0xb26a, 0xb26b, 0xd659, 0xd64d, 0xd649, 0xd65b, 0xd651, + 0xd655, 0xd64b, 0xb548, 0xb549, 0xda65, 0xb54f, 0xda59, 0xda62, + 0xda58, 0xb54c, 0xda60, 0xda5e, 0xda5f, 0xb54a, 0xda63, 0xda5c, + 0xda5a, 0xb54b, 0xda5d, 0xda61, 0xb54d, 0xda64, 0xde70, 0xde77, + 0xde79, 0xdea1, 0xb7da, 0xde6b, 0xb7d2, 0xde7a, 0xb7d7, 0xdea2, + 0xb7ce, 0xde7d, 0xde6d, 0xde7e, 0xde6c, 0xb7dc, 0xde78, 0xb7cf, + 0xdea3, 0xb7d4, 0xde71, 0xb7d9, 0xde7c, 0xde6f, 0xde76, 0xde72, + 0xde6e, 0xb7d1, 0xb7d8, 0xb7d6, 0xb7d3, 0xb7db, 0xb7d0, 0xde75, + 0xb7d5, 0xb54e, 0xde7b, 0xde73, 0xde74, 0xe2c1, 0xbab4, 0xe2bd, + 0xe2c3, 0xe2bf, 0xbab6, 0xe2be, 0xe2c2, 0xe2ba, 0xe2bc, 0xbab5, + 0xe2c0, 0xe2bb, 0xbab7, 0xbab2, 0xe2c4, 0xbab3, 0xe667, 0xe664, + 0xe670, 0xe66a, 0xe66c, 0xbcf4, 0xe666, 0xe66e, 0xe66d, 0xe66b, + 0xe671, 0xbcf7, 0xe668, 0xe66f, 0xbcf5, 0xe663, 0xe665, 0xbcf6, + 0xe662, 0xe672, 0xe669, 0xea4a, 0xbf51, 0xea55, 0xea53, 0xbf4b, + 0xea49, 0xea4c, 0xea4d, 0xea48, 0xbf55, 0xbf56, 0xea47, 0xea56, + 0xea51, 0xbf4f, 0xbf4c, 0xea50, 0xea4e, 0xbf52, 0xea52, 0xbf4d, + 0xbf4e, 0xea4f, 0xbf50, 0xea4b, 0xea54, 0xbf53, 0xea57, 0xea58, + 0xbf54, 0xc0e7, 0xc0ee, 0xed5c, 0xed62, 0xed60, 0xc0ea, 0xc0e9, + 0xc0e6, 0xed5e, 0xc0ec, 0xc0eb, 0xc0e8, 0xed61, 0xed5d, 0xed5f, + 0xc0ed, 0xc277, 0xeffb, 0xc274, 0xc275, 0xeffd, 0xc276, 0xeffa, + 0xeff9, 0xf26c, 0xeffc, 0xf26d, 0xc37a, 0xf26b, 0xf26a, 0xf269, + 0xc37b, 0xc46c, 0xf46a, 0xf46b, 0xf5dc, 0xf5db, 0xc4ea, 0xf5da, + 0xf6ec, 0xf6ed, 0xf7e6, 0xf8b1, 0xf8f6, 0xf9bc, 0xc679, 0xf9c6, + 0xa4f6, 0xaaa6, 0xaaa7, 0xacb8, 0xc0ef, 0xa4f7, 0xaaa8, 0xaf52, + 0xb7dd, 0xa4f8, 0xb26e, 0xbab8, 0xc962, 0xcfb7, 0xd27d, 0xe2c5, + 0xc0f0, 0xa4f9, 0xaaa9, 0xcfb8, 0xcfb9, 0xda66, 0xb550, 0xdea4, + 0xb7de, 0xe2c6, 0xbcf8, 0xc37c, 0xa4fa, 0xda67, 0xa4fb, 0xa6c9, + 0xca42, 0xa6c8, 0xa865, 0xa864, 0xa863, 0xcb60, 0xaaaa, 0xaaab, + 0xcd5b, 0xcfba, 0xcfbd, 0xacba, 0xcfbb, 0xacb9, 0xcfbc, 0xacbb, + 0xd2a2, 0xd2a1, 0xd27e, 0xaf53, 0xd65d, 0xd65e, 0xb26f, 0xd65c, + 0xd65f, 0xb552, 0xb270, 0xb551, 0xda6b, 0xda6a, 0xda68, 0xda69, + 0xda6c, 0xdea6, 0xdea5, 0xdea9, 0xdea8, 0xdea7, 0xbab9, 0xe2c9, + 0xe2c8, 0xbaba, 0xe2c7, 0xe673, 0xe674, 0xbcf9, 0xea59, 0xea5a, + 0xf272, 0xc37d, 0xf271, 0xf270, 0xf26e, 0xf26f, 0xc4eb, 0xf46c, + 0xf6ee, 0xf8f7, 0xa4fc, 0xc9a5, 0xa5c7, 0xc9a6, 0xca43, 0xca44, + 0xcb66, 0xcb62, 0xcb61, 0xaaac, 0xcb65, 0xa867, 0xcb63, 0xa866, + 0xcb67, 0xcb64, 0xcd5f, 0xcfbe, 0xcd5d, 0xcd64, 0xaaad, 0xaab0, + 0xcd65, 0xcd61, 0xcd62, 0xcd5c, 0xaaaf, 0xcd5e, 0xaaae, 0xcd63, + 0xcd60, 0xcfc2, 0xacbd, 0xacbe, 0xcfc5, 0xcfbf, 0xcfc4, 0xcfc0, + 0xacbc, 0xcfc3, 0xcfc1, 0xd2a8, 0xd2a5, 0xd2a7, 0xaf58, 0xaf57, + 0xaf55, 0xd2a4, 0xd2a9, 0xaf54, 0xaf56, 0xd2a6, 0xd667, 0xd2a3, + 0xd2aa, 0xd662, 0xd666, 0xd665, 0xda6e, 0xda79, 0xd668, 0xd663, + 0xda6d, 0xb274, 0xb273, 0xd661, 0xd664, 0xb275, 0xb272, 0xb271, + 0xd660, 0xd669, 0xda70, 0xda77, 0xb554, 0xda76, 0xda73, 0xb556, + 0xda75, 0xda6f, 0xda71, 0xda74, 0xda72, 0xb555, 0xda78, 0xb553, + 0xb7df, 0xdead, 0xdeac, 0xdeaa, 0xb7e2, 0xb7e1, 0xdeae, 0xdeab, + 0xe2ca, 0xbabb, 0xb7e0, 0xdeb0, 0xdeaf, 0xe2cd, 0xe2cb, 0xbcfa, + 0xbabc, 0xe2cc, 0xe676, 0xbcfb, 0xe675, 0xe67e, 0xe67d, 0xe67b, + 0xe67a, 0xe677, 0xe678, 0xe679, 0xe67c, 0xe6a1, 0xea5f, 0xea5c, + 0xea5d, 0xbf57, 0xea5b, 0xea61, 0xea60, 0xea5e, 0xed64, 0xed65, + 0xc0f1, 0xc0f2, 0xed63, 0xc279, 0xeffe, 0xc278, 0xc37e, 0xc3a1, + 0xc46d, 0xf46e, 0xf46d, 0xf5dd, 0xf6ef, 0xc57a, 0xf7e8, 0xf7e7, + 0xf7e9, 0xa5c8, 0xcfc6, 0xaf59, 0xb276, 0xd66a, 0xa5c9, 0xc9a7, + 0xa4fd, 0xca45, 0xcb6c, 0xcb6a, 0xcb6b, 0xcb68, 0xa868, 0xcb69, + 0xcd6d, 0xaab3, 0xcd6b, 0xcd67, 0xcd6a, 0xcd66, 0xaab5, 0xcd69, + 0xaab2, 0xaab1, 0xaab4, 0xcd6c, 0xcd68, 0xacc2, 0xacc5, 0xcfce, + 0xcfcd, 0xcfcc, 0xacbf, 0xcfd5, 0xcfcb, 0xacc1, 0xd2af, 0xcfd2, + 0xcfd0, 0xacc4, 0xcfc8, 0xcfd3, 0xcfca, 0xcfd4, 0xcfd1, 0xcfc9, + 0xacc0, 0xcfd6, 0xcfc7, 0xacc3, 0xd2b4, 0xd2ab, 0xd2b6, 0xd2ae, + 0xd2b9, 0xd2ba, 0xd2ac, 0xd2b8, 0xd2b5, 0xd2b3, 0xd2b7, 0xaf5f, + 0xaf5d, 0xd2b1, 0xd2ad, 0xd2b0, 0xd2bb, 0xd2b2, 0xaf5e, 0xcfcf, + 0xaf5a, 0xaf5c, 0xd678, 0xd66d, 0xd66b, 0xd66c, 0xd673, 0xd674, + 0xd670, 0xb27b, 0xd675, 0xd672, 0xd66f, 0xb279, 0xd66e, 0xb277, + 0xb27a, 0xd671, 0xd679, 0xaf5b, 0xb278, 0xd677, 0xd676, 0xb27c, + 0xda7e, 0xdaa1, 0xb560, 0xdaa7, 0xdaa9, 0xdaa2, 0xb55a, 0xdaa6, + 0xdaa5, 0xb55b, 0xb561, 0xb562, 0xdaa8, 0xb558, 0xda7d, 0xda7b, + 0xdaa3, 0xda7a, 0xb55f, 0xda7c, 0xdaa4, 0xdaaa, 0xb559, 0xb55e, + 0xb55c, 0xb55d, 0xb557, 0xb7e9, 0xdeb7, 0xb7e8, 0xdebb, 0xdeb1, + 0xdebc, 0xdeb2, 0xdeb3, 0xdebd, 0xdeba, 0xdeb8, 0xdeb9, 0xdeb5, + 0xdeb4, 0xdebe, 0xb7e5, 0xdeb6, 0xb7ea, 0xb7e4, 0xb7eb, 0xb7ec, + 0xb7e7, 0xb7e6, 0xe2ce, 0xbabe, 0xbabd, 0xe2d3, 0xbcfc, 0xbabf, + 0xbac1, 0xe2d4, 0xb7e3, 0xbac0, 0xe2d0, 0xe2d2, 0xe2cf, 0xe2d1, + 0xe6ab, 0xe6aa, 0xe6a7, 0xbd40, 0xea62, 0xbd41, 0xe6a6, 0xbcfe, + 0xe6a8, 0xe6a5, 0xe6a2, 0xe6a9, 0xe6a3, 0xe6a4, 0xbcfd, 0xed69, + 0xea66, 0xea65, 0xea67, 0xed66, 0xbf5a, 0xea63, 0xbf58, 0xbf5c, + 0xbf5b, 0xea64, 0xea68, 0xbf59, 0xed6d, 0xc0f5, 0xc27a, 0xc0f6, + 0xc0f3, 0xed6a, 0xed68, 0xed6b, 0xed6e, 0xc0f4, 0xed6c, 0xed67, + 0xf042, 0xf045, 0xf275, 0xf040, 0xf46f, 0xf046, 0xc3a2, 0xf044, + 0xc27b, 0xf041, 0xf043, 0xf047, 0xf276, 0xf274, 0xc3a3, 0xf273, + 0xc46e, 0xc4ed, 0xf6f1, 0xc4ec, 0xf6f3, 0xf6f0, 0xf6f2, 0xc5d0, + 0xf8b2, 0xa5ca, 0xcd6e, 0xd2bc, 0xd2bd, 0xb27d, 0xdebf, 0xbf5d, + 0xc3a4, 0xc57b, 0xf8b3, 0xa5cb, 0xcd6f, 0xa260, 0xcfd7, 0xcfd8, + 0xd2be, 0xd2bf, 0xb27e, 0xb2a1, 0xdaab, 0xdec2, 0xdec1, 0xdec0, + 0xe2d5, 0xe2d6, 0xe2d7, 0xbac2, 0xe6ad, 0xe6ac, 0xea69, 0xbf5e, + 0xbf5f, 0xed72, 0xed6f, 0xed70, 0xed71, 0xf049, 0xf048, 0xc27c, + 0xf277, 0xf5de, 0xa5cc, 0xacc6, 0xb2a2, 0xdec3, 0xa5cd, 0xd2c0, + 0xb2a3, 0xb563, 0xb564, 0xa5ce, 0xa5cf, 0xca46, 0xa86a, 0xa869, + 0xacc7, 0xcfd9, 0xdaac, 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0xa86b, + 0xa86c, 0xcb6e, 0xcb6d, 0xaab6, 0xcd72, 0xcd70, 0xcd71, 0xcfda, + 0xcfdb, 0xaccb, 0xacc9, 0xacca, 0xacc8, 0xaf60, 0xaf64, 0xaf63, + 0xd2c1, 0xaf62, 0xaf61, 0xd2c2, 0xb2a6, 0xd67b, 0xd67a, 0xb2a4, + 0xb2a5, 0xb566, 0xb565, 0xdaae, 0xdaad, 0xb2a7, 0xb7ed, 0xdec5, + 0xb7ee, 0xdec4, 0xe2d8, 0xe6ae, 0xbd42, 0xea6a, 0xed73, 0xc3a6, + 0xc3a5, 0xc57c, 0xa5d4, 0xcd73, 0xb2a8, 0xe2d9, 0xbac3, 0xcb6f, + 0xcb70, 0xcd74, 0xaab8, 0xaab9, 0xaab7, 0xaccf, 0xacd0, 0xaccd, + 0xacce, 0xcfdc, 0xcfdd, 0xaccc, 0xd2c3, 0xaf68, 0xaf69, 0xb2ab, + 0xd2c9, 0xaf6e, 0xaf6c, 0xd2ca, 0xd2c5, 0xaf6b, 0xaf6a, 0xaf65, + 0xd2c8, 0xd2c7, 0xd2c4, 0xaf6d, 0xd2c6, 0xaf66, 0xaf67, 0xb2ac, + 0xd6a1, 0xd6a2, 0xb2ad, 0xd67c, 0xd67e, 0xd6a4, 0xd6a3, 0xd67d, + 0xb2a9, 0xb2aa, 0xdab6, 0xb56b, 0xb56a, 0xdab0, 0xb568, 0xdab3, + 0xb56c, 0xdab4, 0xb56d, 0xdab1, 0xb567, 0xb569, 0xdab5, 0xdab2, + 0xdaaf, 0xded2, 0xdec7, 0xb7f0, 0xb7f3, 0xb7f2, 0xb7f7, 0xb7f6, + 0xded3, 0xded1, 0xdeca, 0xdece, 0xdecd, 0xb7f4, 0xded0, 0xdecc, + 0xded4, 0xdecb, 0xb7f5, 0xb7ef, 0xb7f1, 0xdec9, 0xe2db, 0xbac7, + 0xe2df, 0xbac6, 0xe2dc, 0xbac5, 0xdec8, 0xdecf, 0xe2de, 0xbac8, + 0xe2e0, 0xe2dd, 0xe2da, 0xe6b1, 0xe6b5, 0xe6b7, 0xe6b3, 0xe6b2, + 0xe6b0, 0xbd45, 0xbd43, 0xbd48, 0xbd49, 0xe6b4, 0xbd46, 0xe6af, + 0xbd47, 0xbac4, 0xe6b6, 0xbd44, 0xea6c, 0xea6b, 0xea73, 0xea6d, + 0xea72, 0xea6f, 0xbf60, 0xea71, 0xbf61, 0xbf62, 0xea70, 0xea6e, + 0xc0f8, 0xed74, 0xc0f7, 0xed77, 0xed75, 0xed76, 0xc0f9, 0xf04d, + 0xc2a1, 0xf04e, 0xc27d, 0xf04f, 0xc27e, 0xf04c, 0xf050, 0xf04a, + 0xc3a7, 0xf278, 0xc3a8, 0xc46f, 0xf04b, 0xc470, 0xc4ee, 0xf5df, + 0xc57e, 0xf6f4, 0xc57d, 0xf7ea, 0xc5f5, 0xc5f6, 0xf9cc, 0xacd1, + 0xcfde, 0xb56e, 0xb56f, 0xa5d5, 0xa6ca, 0xca47, 0xcb71, 0xa86d, + 0xaaba, 0xacd2, 0xacd3, 0xacd4, 0xd6a6, 0xd2cb, 0xaf6f, 0xb2ae, + 0xd6a5, 0xdab8, 0xb571, 0xdab7, 0xb570, 0xded5, 0xbd4a, 0xe6bb, + 0xe6b8, 0xe6b9, 0xe6ba, 0xed78, 0xf051, 0xf471, 0xf470, 0xf6f5, + 0xa5d6, 0xcd75, 0xaf70, 0xb572, 0xded6, 0xe2e1, 0xbd4b, 0xea74, + 0xf052, 0xf472, 0xa5d7, 0xaabb, 0xacd7, 0xcfdf, 0xacd8, 0xacd6, + 0xacd5, 0xd2cc, 0xaf71, 0xaf72, 0xaf73, 0xb2b0, 0xd6a7, 0xb2af, + 0xdab9, 0xb2b1, 0xb573, 0xded7, 0xb7f8, 0xb7f9, 0xbac9, 0xbaca, + 0xbd4c, 0xbf64, 0xea75, 0xbf63, 0xed79, 0xc0fa, 0xf053, 0xf473, + 0xa5d8, 0xa86e, 0xcd78, 0xcd77, 0xaabc, 0xcd76, 0xaabd, 0xcd79, + 0xcfe5, 0xacdb, 0xacda, 0xcfe7, 0xcfe6, 0xacdf, 0xacde, 0xacd9, + 0xcfe1, 0xcfe2, 0xcfe3, 0xace0, 0xcfe0, 0xacdc, 0xcfe4, 0xacdd, + 0xd2cf, 0xd2d3, 0xd2d1, 0xd2d0, 0xd2d4, 0xd2d5, 0xd2d6, 0xd2ce, + 0xd2cd, 0xaf75, 0xaf76, 0xd2d7, 0xd2d2, 0xd6b0, 0xd2d8, 0xaf77, + 0xaf74, 0xd6aa, 0xd6a9, 0xd6ab, 0xd6ac, 0xd6ae, 0xd6ad, 0xd6b2, + 0xb2b5, 0xb2b2, 0xb2b6, 0xd6a8, 0xb2b7, 0xd6b1, 0xb2b4, 0xd6af, + 0xb2b3, 0xdabc, 0xdabe, 0xdaba, 0xdabb, 0xdabf, 0xdac1, 0xdac2, + 0xdabd, 0xdac0, 0xb574, 0xdedb, 0xdee0, 0xded8, 0xdedc, 0xdee1, + 0xdedd, 0xb7fa, 0xb843, 0xb7fd, 0xded9, 0xdeda, 0xbace, 0xb846, + 0xb7fe, 0xb844, 0xb7fc, 0xdedf, 0xb845, 0xdede, 0xb841, 0xb7fb, + 0xb842, 0xdee2, 0xe2e6, 0xe2e8, 0xb840, 0xe2e3, 0xbacc, 0xe2e9, + 0xbacd, 0xe2e7, 0xe2e2, 0xe2e5, 0xe2ea, 0xbacb, 0xe2e4, 0xbd4e, + 0xe6bf, 0xe6be, 0xbd51, 0xbd4f, 0xe6bc, 0xbd4d, 0xe6bd, 0xbd50, + 0xea7d, 0xeaa1, 0xea7e, 0xea76, 0xea7a, 0xea79, 0xea77, 0xbf66, + 0xbf67, 0xbf65, 0xea78, 0xea7b, 0xea7c, 0xbf68, 0xc140, 0xeda3, + 0xc0fc, 0xed7b, 0xc0fe, 0xc141, 0xc0fd, 0xeda2, 0xed7c, 0xc0fb, + 0xeda1, 0xed7a, 0xed7e, 0xed7d, 0xf055, 0xc2a4, 0xc2a5, 0xc2a2, + 0xc2a3, 0xf054, 0xf27b, 0xc3a9, 0xf279, 0xf27a, 0xf474, 0xf477, + 0xf475, 0xf476, 0xf5e0, 0xc4ef, 0xf7eb, 0xf8b4, 0xc5f7, 0xf8f8, + 0xf8f9, 0xc666, 0xa5d9, 0xace1, 0xdac3, 0xdee3, 0xa5da, 0xa86f, + 0xaabe, 0xcfe8, 0xcfe9, 0xaf78, 0xdac4, 0xb575, 0xb847, 0xc142, + 0xeda4, 0xf27c, 0xf478, 0xa5db, 0xcda1, 0xcd7a, 0xcd7c, 0xcd7e, + 0xcd7d, 0xcd7b, 0xaabf, 0xace2, 0xcff2, 0xcfed, 0xcfea, 0xcff1, + 0xace4, 0xace5, 0xcff0, 0xcfef, 0xcfee, 0xcfeb, 0xcfec, 0xcff3, + 0xace3, 0xaf7c, 0xafa4, 0xafa3, 0xd2e1, 0xd2db, 0xd2d9, 0xafa1, + 0xd6b9, 0xaf7a, 0xd2de, 0xd2e2, 0xd2e4, 0xd2e0, 0xd2da, 0xafa2, + 0xd2df, 0xd2dd, 0xaf79, 0xd2e5, 0xafa5, 0xd2e3, 0xaf7d, 0xd2dc, + 0xaf7e, 0xaf7b, 0xb2b9, 0xd6ba, 0xd6b3, 0xd6b5, 0xd6b7, 0xd6b8, + 0xd6b6, 0xb2ba, 0xd6bb, 0xd6b4, 0xdac8, 0xb576, 0xdad0, 0xdac5, + 0xdad1, 0xdac6, 0xdac7, 0xdacf, 0xdace, 0xdacb, 0xb2b8, 0xb577, + 0xdac9, 0xdacc, 0xb578, 0xdacd, 0xdaca, 0xdeee, 0xdef2, 0xb84e, + 0xe2f0, 0xb851, 0xdef0, 0xdeed, 0xdee8, 0xdeea, 0xdeeb, 0xdee4, + 0xb84d, 0xb84c, 0xb848, 0xdee7, 0xb84f, 0xb850, 0xdee6, 0xdee9, + 0xdef1, 0xb84a, 0xb84b, 0xdeef, 0xdee5, 0xe2f2, 0xbad0, 0xe2f4, + 0xdeec, 0xe2f6, 0xbad4, 0xe2f7, 0xe2f3, 0xbad1, 0xe2ef, 0xbad3, + 0xe2ec, 0xe2f1, 0xe2f5, 0xe2ee, 0xb849, 0xe2eb, 0xbad2, 0xe2ed, + 0xbd54, 0xe6c1, 0xbd58, 0xbd56, 0xbacf, 0xe6c8, 0xe6c9, 0xbd53, + 0xe6c7, 0xe6ca, 0xbd55, 0xbd52, 0xe6c3, 0xe6c0, 0xe6c5, 0xe6c2, + 0xbd59, 0xe6c4, 0xe6c6, 0xbd57, 0xbf6a, 0xeaa8, 0xeaa2, 0xeaa6, + 0xeaac, 0xeaad, 0xeaa9, 0xeaaa, 0xeaa7, 0xeaa4, 0xbf6c, 0xbf69, + 0xeaa3, 0xeaa5, 0xbf6b, 0xeaab, 0xc146, 0xedaa, 0xeda5, 0xc145, + 0xc143, 0xedac, 0xc144, 0xeda8, 0xeda9, 0xeda6, 0xedad, 0xf056, + 0xc147, 0xeda7, 0xedae, 0xedab, 0xf05a, 0xf057, 0xc2a6, 0xf05b, + 0xf05d, 0xf05c, 0xf058, 0xf059, 0xf2a3, 0xc3aa, 0xf27e, 0xf2a2, + 0xf27d, 0xf2a4, 0xf2a1, 0xf47a, 0xf47d, 0xf479, 0xc471, 0xf47b, + 0xf47c, 0xf47e, 0xc472, 0xc474, 0xc473, 0xf5e1, 0xf5e3, 0xf5e2, + 0xf6f6, 0xf8b5, 0xf8fa, 0xa5dc, 0xcb72, 0xaac0, 0xcda3, 0xaac1, + 0xaac2, 0xcda2, 0xcff8, 0xcff7, 0xace6, 0xace9, 0xace8, 0xace7, + 0xcff4, 0xcff6, 0xcff5, 0xd2e8, 0xafa7, 0xd2ec, 0xd2eb, 0xd2ea, + 0xd2e6, 0xafa6, 0xafaa, 0xafad, 0xafae, 0xd2e7, 0xd2e9, 0xafac, + 0xafab, 0xafa9, 0xafa8, 0xd6c2, 0xd6c0, 0xd6bc, 0xb2bb, 0xd6bd, + 0xb2bc, 0xd6be, 0xd6bf, 0xd6c1, 0xb2bd, 0xdad5, 0xdad4, 0xdad3, + 0xdad2, 0xdef6, 0xb852, 0xdef3, 0xdef5, 0xb853, 0xb854, 0xdef4, + 0xe341, 0xe2f9, 0xe2fa, 0xbad7, 0xbad5, 0xbad6, 0xe343, 0xe342, + 0xe2fe, 0xe2fd, 0xe2fc, 0xe2fb, 0xe340, 0xe2f8, 0xe6cb, 0xe6d0, + 0xe6ce, 0xe6cd, 0xe6cc, 0xe6cf, 0xeaae, 0xbf6d, 0xc148, 0xedb0, + 0xc149, 0xedaf, 0xf05f, 0xf05e, 0xc2a7, 0xf2a5, 0xc3ab, 0xf4a1, + 0xc5a1, 0xf6f7, 0xf8b7, 0xf8b6, 0xc9a8, 0xacea, 0xaceb, 0xd6c3, + 0xb856, 0xa5dd, 0xa872, 0xa871, 0xa870, 0xcda4, 0xaac4, 0xaac3, + 0xacee, 0xcffa, 0xcffd, 0xcffb, 0xacec, 0xaced, 0xcff9, 0xcffc, + 0xafb5, 0xd2f3, 0xd2f5, 0xd2f4, 0xafb2, 0xd2ef, 0xafb0, 0xafaf, + 0xafb3, 0xafb1, 0xafb4, 0xd2f2, 0xd2ed, 0xd2ee, 0xd2f1, 0xd2f0, + 0xd6c6, 0xd6c7, 0xd6c5, 0xd6c4, 0xb2be, 0xb57d, 0xdad6, 0xdad8, + 0xdada, 0xb57c, 0xb57a, 0xdad7, 0xb57b, 0xdad9, 0xb579, 0xdf41, + 0xdef7, 0xdefa, 0xdefe, 0xb85a, 0xdefc, 0xdefb, 0xdef8, 0xdef9, + 0xb858, 0xdf40, 0xb857, 0xb85c, 0xb85b, 0xb859, 0xdefd, 0xe349, + 0xe348, 0xe344, 0xbad8, 0xe347, 0xe346, 0xbad9, 0xbd5e, 0xe6d2, + 0xbd5f, 0xbd5b, 0xbd5d, 0xbd5a, 0xbd5c, 0xeaaf, 0xbf70, 0xeab1, + 0xeab0, 0xe345, 0xbf72, 0xbf71, 0xbf6e, 0xbf6f, 0xedb5, 0xedb3, + 0xc14a, 0xedb4, 0xedb6, 0xedb2, 0xedb1, 0xf060, 0xc2aa, 0xc2a8, + 0xc2a9, 0xf2a6, 0xf2a7, 0xc3ad, 0xc3ac, 0xf4a3, 0xf4a4, 0xf4a2, + 0xf6f8, 0xf6f9, 0xa5de, 0xca48, 0xa873, 0xcda5, 0xaac6, 0xaac5, + 0xcda6, 0xd040, 0xacef, 0xcffe, 0xacf0, 0xafb6, 0xd2f8, 0xd2f6, + 0xd2fc, 0xafb7, 0xd2f7, 0xd2fb, 0xd2f9, 0xd2fa, 0xd6c8, 0xd6ca, + 0xb2bf, 0xd6c9, 0xb2c0, 0xb5a2, 0xb5a1, 0xb57e, 0xdadb, 0xdf44, + 0xb85d, 0xb85e, 0xdf43, 0xdf42, 0xe34a, 0xbadb, 0xbada, 0xe34b, + 0xe34c, 0xbd61, 0xbd60, 0xeab5, 0xe6d3, 0xe6d5, 0xe6d4, 0xeab4, + 0xeab2, 0xeab6, 0xeab3, 0xbf73, 0xedb7, 0xc14b, 0xedb8, 0xedb9, + 0xc2ab, 0xc2ac, 0xc475, 0xc5d1, 0xa5df, 0xd041, 0xd2fd, 0xafb8, + 0xb3ba, 0xb3b9, 0xb5a4, 0xdadd, 0xb5a3, 0xdadc, 0xdf45, 0xbadc, + 0xe34d, 0xbadd, 0xc476, 0xf4a5, 0xa6cb, 0xaac7, 0xcda7, 0xacf2, + 0xacf1, 0xd042, 0xd043, 0xd340, 0xd342, 0xafb9, 0xd344, 0xd347, + 0xd345, 0xd346, 0xd343, 0xd2fe, 0xafba, 0xd348, 0xd341, 0xd6d3, + 0xb2c6, 0xd6dc, 0xb2c3, 0xd6d5, 0xb2c7, 0xb2c1, 0xd6d0, 0xd6dd, + 0xd6d1, 0xd6ce, 0xb2c5, 0xb2c2, 0xd6d4, 0xd6d7, 0xb2c4, 0xd6d8, + 0xb2c8, 0xd6d9, 0xd6cf, 0xd6d6, 0xd6da, 0xd6d2, 0xd6cd, 0xd6cb, + 0xd6db, 0xdadf, 0xdae4, 0xdae0, 0xdae6, 0xb5a7, 0xd6cc, 0xdae1, + 0xb5a5, 0xdade, 0xb5ac, 0xdae2, 0xb5ab, 0xdae3, 0xb5ad, 0xb5a8, + 0xb5ae, 0xb5a9, 0xb5aa, 0xb5a6, 0xdae5, 0xb861, 0xdf50, 0xdf53, + 0xdf47, 0xdf4c, 0xdf46, 0xb863, 0xdf4a, 0xdf48, 0xb862, 0xdf4f, + 0xdf4e, 0xdf4b, 0xdf4d, 0xdf49, 0xbae1, 0xdf52, 0xb85f, 0xdf51, + 0xe35d, 0xbae8, 0xe358, 0xbae7, 0xe34e, 0xe350, 0xbae0, 0xe355, + 0xe354, 0xe357, 0xbae5, 0xe352, 0xe351, 0xbae4, 0xbadf, 0xe353, + 0xbae2, 0xe359, 0xe35b, 0xe356, 0xe34f, 0xbae3, 0xbd69, 0xbade, + 0xe35c, 0xe6d9, 0xbd62, 0xe6db, 0xbd63, 0xbd65, 0xe6de, 0xe6d6, + 0xbae6, 0xe6dc, 0xe6d8, 0xb860, 0xbd68, 0xbd64, 0xbd66, 0xbd67, + 0xbf76, 0xe6dd, 0xe6d7, 0xbd6a, 0xe6da, 0xeac0, 0xeabb, 0xeac5, + 0xbf74, 0xeabd, 0xbf78, 0xeac3, 0xeaba, 0xeab7, 0xeac6, 0xc151, + 0xbf79, 0xeac2, 0xeab8, 0xbf77, 0xeabc, 0xbf7b, 0xeab9, 0xeabe, + 0xbf7a, 0xeac1, 0xeac4, 0xedcb, 0xedcc, 0xedbc, 0xedc3, 0xedc1, + 0xc14f, 0xedc8, 0xeabf, 0xedbf, 0xedc9, 0xc14e, 0xedbe, 0xedbd, + 0xedc7, 0xedc4, 0xedc6, 0xedba, 0xedca, 0xc14c, 0xedc5, 0xedce, + 0xedc2, 0xc150, 0xc14d, 0xedc0, 0xedbb, 0xedcd, 0xbf75, 0xf063, + 0xf061, 0xf067, 0xc2b0, 0xf065, 0xf064, 0xc2b2, 0xf06a, 0xc2b1, + 0xf06b, 0xf068, 0xc2ae, 0xf069, 0xf062, 0xc2af, 0xc2ad, 0xf2ab, + 0xf066, 0xf06c, 0xf2a8, 0xc3b2, 0xc3b0, 0xf2aa, 0xf2ac, 0xf2a9, + 0xc3b1, 0xc3ae, 0xc3af, 0xc3b3, 0xc478, 0xf4aa, 0xf4a9, 0xf4a7, + 0xf4a6, 0xf4a8, 0xc477, 0xc479, 0xc4f0, 0xf5e5, 0xf5e4, 0xf6fa, + 0xf6fc, 0xf6fe, 0xf6fd, 0xf6fb, 0xc5a3, 0xc5a2, 0xc5d3, 0xc5d2, + 0xc5d4, 0xf7ed, 0xf7ec, 0xf8fb, 0xf8b8, 0xf8fc, 0xc658, 0xc659, + 0xf96d, 0xc67e, 0xa6cc, 0xcda8, 0xd045, 0xd046, 0xd044, 0xacf3, + 0xd047, 0xd048, 0xd049, 0xd349, 0xd34f, 0xd34d, 0xafbb, 0xd34b, + 0xd34c, 0xd34e, 0xd34a, 0xb2c9, 0xd6de, 0xb2cb, 0xd6e0, 0xb2ca, + 0xd6df, 0xdae8, 0xb5af, 0xdaea, 0xdae7, 0xd6e1, 0xb5b0, 0xdae9, + 0xdf56, 0xb864, 0xdf54, 0xb865, 0xdf55, 0xb866, 0xbae9, 0xe361, + 0xe35e, 0xe360, 0xbaea, 0xbaeb, 0xe35f, 0xe6df, 0xe6e0, 0xbd6b, + 0xe6e2, 0xe6e1, 0xa261, 0xeaca, 0xeacb, 0xeac7, 0xeac8, 0xbf7c, + 0xbf7d, 0xeac9, 0xc157, 0xc153, 0xc158, 0xc154, 0xc156, 0xc152, + 0xc155, 0xc2b3, 0xedcf, 0xf2ae, 0xf2ad, 0xf4ab, 0xc47a, 0xc47b, + 0xf741, 0xf5e6, 0xf740, 0xf8fd, 0xf9a4, 0xa6cd, 0xa874, 0xcda9, + 0xaac8, 0xacf6, 0xd04c, 0xacf4, 0xd04a, 0xacf9, 0xacf5, 0xacfa, + 0xacf8, 0xd04b, 0xacf7, 0xafbf, 0xafbe, 0xd35a, 0xafc7, 0xd353, + 0xd359, 0xafc3, 0xd352, 0xd358, 0xd356, 0xafc2, 0xafc4, 0xd355, + 0xafbd, 0xd354, 0xafc8, 0xafc5, 0xafc9, 0xafc6, 0xd351, 0xd350, + 0xd357, 0xafc0, 0xafbc, 0xafc1, 0xd6f0, 0xd6e9, 0xb5b5, 0xd6e8, + 0xb2cf, 0xb2d6, 0xb2d3, 0xb2d9, 0xb2d8, 0xb2d4, 0xd6e2, 0xd6e5, + 0xd6e4, 0xb2d0, 0xd6e6, 0xd6ef, 0xb2d1, 0xd6e3, 0xd6ec, 0xd6ed, + 0xb2d2, 0xd6ea, 0xb2d7, 0xb2cd, 0xb2d5, 0xd6e7, 0xb2cc, 0xd6eb, + 0xd6ee, 0xdafb, 0xdaf2, 0xb5b2, 0xdaf9, 0xdaf6, 0xdaee, 0xdaf7, + 0xb5b4, 0xdaef, 0xdaeb, 0xb86c, 0xdaf4, 0xb5b1, 0xdafa, 0xb5b8, + 0xb5ba, 0xdaed, 0xb5b9, 0xdaf0, 0xb5b3, 0xdaf8, 0xdaf1, 0xdaf5, + 0xdaf3, 0xb5b6, 0xdaec, 0xb5bb, 0xb2ce, 0xb5b7, 0xb5bc, 0xb868, + 0xdf5d, 0xdf5f, 0xdf61, 0xdf65, 0xdf5b, 0xdf59, 0xb86a, 0xdf60, + 0xdf64, 0xdf5c, 0xdf58, 0xdf57, 0xdf62, 0xdf5a, 0xdf5e, 0xb86b, + 0xb869, 0xdf66, 0xb867, 0xdf63, 0xe372, 0xbaee, 0xe36a, 0xbd78, + 0xe374, 0xbaf1, 0xe378, 0xbaf7, 0xe365, 0xe375, 0xe362, 0xe377, + 0xe366, 0xbafe, 0xbafb, 0xe376, 0xe370, 0xbaed, 0xbaf5, 0xbaf4, + 0xbaf3, 0xbaf9, 0xe363, 0xbafa, 0xe371, 0xbaf6, 0xbaec, 0xe373, + 0xbaef, 0xbaf0, 0xbaf8, 0xe368, 0xe367, 0xe364, 0xe36c, 0xe369, + 0xe36d, 0xbafd, 0xe379, 0xbaf2, 0xe36e, 0xe36f, 0xe36b, 0xbafc, + 0xe6e7, 0xbd70, 0xbd79, 0xbd75, 0xe6e4, 0xbd72, 0xbd76, 0xe6f0, + 0xbd6c, 0xe6e8, 0xbd74, 0xe6eb, 0xe6e6, 0xbd73, 0xbd77, 0xe6e5, + 0xbd71, 0xe6ef, 0xbd6e, 0xe6ee, 0xe6ed, 0xbd7a, 0xe572, 0xbd6d, + 0xe6ec, 0xe6e3, 0xbd7b, 0xe6ea, 0xbd6f, 0xe6e9, 0xbfa2, 0xbfa7, + 0xbf7e, 0xead8, 0xeacf, 0xeadb, 0xead3, 0xead9, 0xbfa8, 0xbfa1, + 0xeacc, 0xead2, 0xeadc, 0xead5, 0xeada, 0xeace, 0xead6, 0xbfa3, + 0xead4, 0xbfa6, 0xbfa5, 0xead0, 0xead1, 0xeacd, 0xead7, 0xbfa4, + 0xeade, 0xeadd, 0xedda, 0xedd6, 0xc15f, 0xedd0, 0xc159, 0xc169, + 0xeddc, 0xc161, 0xc15d, 0xedd3, 0xc164, 0xc167, 0xedde, 0xc15c, + 0xedd5, 0xc165, 0xede0, 0xeddd, 0xedd1, 0xc160, 0xc15a, 0xc168, + 0xedd8, 0xc163, 0xedd2, 0xc15e, 0xeddf, 0xc162, 0xc15b, 0xedd9, + 0xc166, 0xedd7, 0xeddb, 0xf06e, 0xf074, 0xc2b9, 0xf077, 0xc2b4, + 0xc2b5, 0xf06f, 0xf076, 0xf071, 0xc2ba, 0xc2b7, 0xf06d, 0xc2b6, + 0xf073, 0xf075, 0xc2b8, 0xf072, 0xf070, 0xf2b8, 0xc3b7, 0xc3b8, + 0xc3b4, 0xc3b5, 0xf2b4, 0xf2b2, 0xf2b6, 0xc3ba, 0xf2b7, 0xf2b0, + 0xf2af, 0xf2b3, 0xf2b1, 0xc3b6, 0xf2b5, 0xf4ac, 0xc47e, 0xc47d, + 0xf4ad, 0xf4af, 0xf4ae, 0xc4a1, 0xf5eb, 0xf5e8, 0xf5e9, 0xf5e7, + 0xf5ea, 0xc4f2, 0xf5ec, 0xc4f1, 0xf742, 0xc5d5, 0xc5d7, 0xf7ee, + 0xc5d6, 0xf8b9, 0xf940, 0xf942, 0xf8fe, 0xf941, 0xc66c, 0xa6ce, + 0xacfb, 0xd26f, 0xafca, 0xb2da, 0xdafc, 0xdafd, 0xeadf, 0xc16a, + 0xede1, 0xc2bb, 0xf2ba, 0xf2b9, 0xc4a2, 0xf5ed, 0xf743, 0xc5f8, + 0xca49, 0xaac9, 0xa875, 0xd04d, 0xd360, 0xd35b, 0xd35f, 0xd35d, + 0xafcb, 0xd35e, 0xd35c, 0xd6f1, 0xdafe, 0xdb40, 0xdf69, 0xdf6a, + 0xb86e, 0xb86f, 0xdf68, 0xdf6b, 0xdf67, 0xb86d, 0xbb40, 0xb870, + 0xe37a, 0xbd7c, 0xe6f1, 0xbd7d, 0xbfa9, 0xeae2, 0xeae0, 0xeae1, + 0xede4, 0xede3, 0xede2, 0xf2bb, 0xc3b9, 0xf2bc, 0xf744, 0xc5f9, + 0xf8ba, 0xa6cf, 0xaacb, 0xaaca, 0xd04f, 0xacfc, 0xd04e, 0xd362, + 0xafcc, 0xd6f2, 0xd361, 0xb2dc, 0xd6f5, 0xd6f3, 0xd6f4, 0xb2db, + 0xdb42, 0xdb43, 0xdb41, 0xb873, 0xdf6d, 0xdf6c, 0xdf6e, 0xb872, + 0xb871, 0xe6f2, 0xe6f4, 0xbd7e, 0xe6f3, 0xeae3, 0xbfaa, 0xf079, + 0xf078, 0xc3bb, 0xf2bd, 0xc3bd, 0xc3bc, 0xf4b0, 0xf5ee, 0xc4f3, + 0xa6d0, 0xd050, 0xacfd, 0xd365, 0xafce, 0xd364, 0xd363, 0xafcd, + 0xd6fb, 0xd6fd, 0xd6f6, 0xd6f7, 0xb2dd, 0xd6f8, 0xb2de, 0xd6fc, + 0xd6f9, 0xd6fa, 0xb2df, 0xb5be, 0xb5bf, 0xdb44, 0xdf6f, 0xdf70, + 0xe37e, 0xbb43, 0xbb41, 0xbb42, 0xe37b, 0xe37c, 0xe37d, 0xe6f9, + 0xe6fa, 0xbda1, 0xe6f7, 0xe6f6, 0xe6f8, 0xe6f5, 0xbfad, 0xeae4, + 0xbfab, 0xbfac, 0xede6, 0xc16b, 0xede5, 0xefa8, 0xf07a, 0xf07b, + 0xc2bc, 0xc2bd, 0xc16c, 0xf2be, 0xf2bf, 0xf4b1, 0xc4a3, 0xa6d1, + 0xa6d2, 0xacfe, 0xaacc, 0xafcf, 0xd051, 0xb5c0, 0xa6d3, 0xad41, + 0xd052, 0xd053, 0xad40, 0xad42, 0xa6d4, 0xd054, 0xafd1, 0xd366, + 0xafd3, 0xafd0, 0xafd2, 0xd741, 0xb2e0, 0xd740, 0xd6fe, 0xdf71, + 0xe3a1, 0xbda2, 0xbfae, 0xeae6, 0xeae5, 0xede7, 0xf5ef, 0xa6d5, + 0xcb73, 0xcdaa, 0xad43, 0xd055, 0xd368, 0xafd4, 0xd367, 0xafd5, + 0xd743, 0xb2e2, 0xd742, 0xd744, 0xb2e1, 0xdb46, 0xdb47, 0xdb45, + 0xb5c1, 0xb874, 0xb875, 0xbb45, 0xe3a3, 0xe3a2, 0xbb44, 0xe6fb, + 0xe6fc, 0xeae7, 0xc170, 0xc16f, 0xc16d, 0xc16e, 0xc171, 0xf07c, + 0xc2bf, 0xc2be, 0xf2c0, 0xf4b2, 0xc5a5, 0xc5a4, 0xa6d6, 0xd1fb, + 0xb877, 0xb5c2, 0xb876, 0xbb46, 0xa6d7, 0xc9a9, 0xa6d8, 0xa6d9, + 0xcdab, 0xcb76, 0xcb77, 0xa877, 0xcb74, 0xa876, 0xa879, 0xcb75, + 0xa87b, 0xa87a, 0xcb78, 0xa878, 0xaad1, 0xaacf, 0xcdad, 0xaace, + 0xaad3, 0xaad5, 0xaad2, 0xcdb0, 0xcdac, 0xaad6, 0xaad0, 0xa87c, + 0xaad4, 0xcdaf, 0xcdae, 0xaacd, 0xd05b, 0xad47, 0xad48, 0xd05d, + 0xd057, 0xd05a, 0xd063, 0xd061, 0xad49, 0xd067, 0xad4c, 0xd064, + 0xd05c, 0xd059, 0xdb49, 0xd062, 0xad44, 0xd065, 0xd056, 0xd05f, + 0xad46, 0xad4b, 0xd060, 0xad4f, 0xad4d, 0xd058, 0xad4a, 0xd05e, + 0xad4e, 0xad45, 0xd066, 0xafda, 0xafe3, 0xafd8, 0xafd6, 0xd36a, + 0xafde, 0xafdb, 0xd36c, 0xafdd, 0xd36b, 0xd369, 0xd36e, 0xafe2, + 0xafe0, 0xdb48, 0xd36f, 0xd36d, 0xafd7, 0xafd9, 0xafdc, 0xafdf, + 0xafe1, 0xd74e, 0xb2e4, 0xd745, 0xd747, 0xd748, 0xd750, 0xd74c, + 0xd74a, 0xd74d, 0xd751, 0xb2e5, 0xb2e9, 0xd746, 0xd74f, 0xb2e7, + 0xb2e6, 0xd74b, 0xd749, 0xb2e3, 0xb2e8, 0xb5c8, 0xdb51, 0xdb4f, + 0xb5ca, 0xdb4a, 0xdfa1, 0xb5c9, 0xdb4e, 0xdb4b, 0xb5c5, 0xb5cb, + 0xdb50, 0xb5c7, 0xdb4d, 0xbb47, 0xb5c6, 0xdb4c, 0xb5cc, 0xb5c4, + 0xb5c3, 0xdf77, 0xdf75, 0xdf7b, 0xdf73, 0xdfa2, 0xdf78, 0xdf72, + 0xb87b, 0xb8a3, 0xdf7d, 0xdf76, 0xb87e, 0xb87c, 0xdf7e, 0xb879, + 0xb878, 0xdf79, 0xb87d, 0xb5cd, 0xdf7c, 0xdf74, 0xb87a, 0xb8a1, + 0xb8a2, 0xbb4c, 0xbb48, 0xbb4d, 0xe3a6, 0xe3a5, 0xe3a7, 0xbb4a, + 0xe3a4, 0xbb4b, 0xe3aa, 0xe3a9, 0xe3a8, 0xbb49, 0xe741, 0xe744, + 0xbda8, 0xe743, 0xbda7, 0xbda3, 0xbda4, 0xbda5, 0xe740, 0xe6fe, + 0xbda6, 0xe742, 0xe6fd, 0xeae9, 0xeaf3, 0xbfb1, 0xbfb0, 0xeaed, + 0xeaef, 0xeaea, 0xeaee, 0xeae8, 0xeaf1, 0xbfaf, 0xeaf0, 0xeaec, + 0xeaf2, 0xeaeb, 0xc174, 0xede8, 0xedee, 0xc178, 0xc17a, 0xc177, + 0xc176, 0xc175, 0xc173, 0xede9, 0xedec, 0xc172, 0xeded, 0xc179, + 0xedeb, 0xedea, 0xc2c0, 0xc2c1, 0xf0a1, 0xf07d, 0xf07e, 0xf2c2, + 0xf2c1, 0xc3be, 0xf4b4, 0xc4a4, 0xf4b3, 0xf5f0, 0xf745, 0xc5a6, + 0xf943, 0xf944, 0xc5d8, 0xa6da, 0xaad7, 0xdb52, 0xbb4e, 0xc17b, + 0xedef, 0xa6db, 0xafe5, 0xafe4, 0xdb53, 0xeaf4, 0xa6dc, 0xad50, + 0xdb54, 0xdb55, 0xdb56, 0xbb4f, 0xbfb2, 0xa6dd, 0xaad8, 0xd068, + 0xafe6, 0xd370, 0xb2ea, 0xdb57, 0xb8a4, 0xbb50, 0xbfb3, 0xc17c, + 0xc2c2, 0xf4b5, 0xa6de, 0xaad9, 0xafe7, 0xd752, 0xb5ce, 0xbb51, + 0xe3ab, 0xe745, 0xa6df, 0xb5cf, 0xdfa3, 0xbb52, 0xa6e0, 0xcdb1, + 0xd069, 0xad51, 0xd372, 0xafea, 0xafe8, 0xafe9, 0xafeb, 0xd371, + 0xd757, 0xd754, 0xd756, 0xb2eb, 0xb2ed, 0xb2ec, 0xd753, 0xb2ee, + 0xd755, 0xdb58, 0xdb59, 0xdb5a, 0xdfa6, 0xdfa7, 0xdfa5, 0xdfa8, + 0xb8a5, 0xdfa4, 0xbb53, 0xe74a, 0xe746, 0xe749, 0xe74b, 0xe748, + 0xe747, 0xeaf5, 0xeaf6, 0xeaf7, 0xbfb4, 0xbfb5, 0xedf1, 0xedf0, + 0xedf2, 0xf0a3, 0xf0a2, 0xf2c4, 0xf2c5, 0xf2c3, 0xc4a5, 0xf4b6, + 0xf4b7, 0xf746, 0xf7ef, 0xf8bb, 0xa6e1, 0xa87d, 0xc17d, 0xa6e2, + 0xd758, 0xdb5b, 0xc641, 0xca4a, 0xca4b, 0xca4d, 0xa6e3, 0xca4e, + 0xca4c, 0xcba2, 0xcba3, 0xcb7b, 0xcba1, 0xa8a1, 0xa8a2, 0xcb7c, + 0xcb7a, 0xcb79, 0xcb7d, 0xa87e, 0xcb7e, 0xd06a, 0xcdb6, 0xaadc, + 0xcdb5, 0xcdb7, 0xaadb, 0xcdbc, 0xaadf, 0xcdb2, 0xcdc0, 0xcdc6, + 0xaae6, 0xcdc3, 0xaae3, 0xcdb9, 0xcdbf, 0xcdc1, 0xcdb4, 0xaae2, + 0xaadd, 0xcdba, 0xaae4, 0xaae7, 0xaae1, 0xaada, 0xcdbe, 0xcdb8, + 0xcdc5, 0xaae9, 0xaae5, 0xaae0, 0xcdbd, 0xafec, 0xcdbb, 0xaade, + 0xaae8, 0xcdb3, 0xcdc2, 0xcdc4, 0xad62, 0xad5c, 0xad64, 0xad61, + 0xd071, 0xd074, 0xad5d, 0xd06b, 0xad56, 0xad60, 0xad63, 0xad65, + 0xd0a2, 0xd077, 0xad55, 0xd0a1, 0xad59, 0xad57, 0xad52, 0xd06f, + 0xd07e, 0xd073, 0xd076, 0xd0a5, 0xad66, 0xd07d, 0xad5e, 0xd078, + 0xd0a4, 0xd075, 0xd079, 0xd07c, 0xd06d, 0xd0a3, 0xd07b, 0xd06c, + 0xd070, 0xad5f, 0xad5a, 0xad53, 0xad58, 0xad54, 0xad67, 0xd06e, + 0xd3a5, 0xad5b, 0xd07a, 0xce41, 0xd3a8, 0xaffa, 0xd376, 0xd3a3, + 0xd37d, 0xd3b2, 0xd3aa, 0xd37e, 0xd3a9, 0xd378, 0xd37c, 0xd3b5, + 0xaffd, 0xd3ad, 0xd3a4, 0xafed, 0xd3b3, 0xd374, 0xd3ac, 0xaffc, + 0xaff7, 0xd373, 0xaff5, 0xaff4, 0xaff9, 0xd3ab, 0xaff1, 0xaff8, + 0xd072, 0xdb5c, 0xd3a6, 0xd37a, 0xaffb, 0xd37b, 0xd3a1, 0xaffe, + 0xd375, 0xd3af, 0xd3ae, 0xd3b6, 0xaff3, 0xaff0, 0xd3b4, 0xd3b0, + 0xd3a7, 0xd3a2, 0xaff6, 0xaff2, 0xd377, 0xafee, 0xd3b1, 0xafef, + 0xd379, 0xd75e, 0xd760, 0xd765, 0xd779, 0xb2fc, 0xb2f2, 0xd75d, + 0xb2fd, 0xb2fe, 0xd768, 0xd76f, 0xd775, 0xd762, 0xd769, 0xb340, + 0xd777, 0xd772, 0xb2fa, 0xb2f8, 0xd76e, 0xd76a, 0xd75c, 0xb2ef, + 0xd761, 0xd759, 0xb2f7, 0xb2f9, 0xd766, 0xd763, 0xb2f4, 0xd773, + 0xb2f1, 0xd764, 0xd77a, 0xd76c, 0xd76b, 0xb2f0, 0xb2fb, 0xb2f3, + 0xd75a, 0xd75f, 0xd770, 0xd776, 0xb341, 0xd75b, 0xd767, 0xd76d, + 0xb2f6, 0xd778, 0xd771, 0xd774, 0xb2f5, 0xdb6c, 0xdb60, 0xb5d7, + 0xdb7d, 0xdba7, 0xdbaa, 0xb5d5, 0xdb68, 0xdba3, 0xdb69, 0xdb77, + 0xb5e2, 0xdb73, 0xb5df, 0xdb74, 0xdb5d, 0xdba4, 0xb5e8, 0xdba1, + 0xdb75, 0xdbac, 0xdb70, 0xdfc8, 0xdbaf, 0xb5e6, 0xdb6e, 0xdb7a, + 0xb5e9, 0xb5d4, 0xdb72, 0xdbad, 0xdb6b, 0xdb64, 0xdb6f, 0xdb63, + 0xdb61, 0xb5d0, 0xdba5, 0xdb6a, 0xdba8, 0xdba9, 0xb5d8, 0xb5dd, + 0xb5d9, 0xb5e1, 0xdb7e, 0xb5da, 0xdb76, 0xdb66, 0xb5d2, 0xdb5e, + 0xdba2, 0xdbab, 0xdb65, 0xb5e0, 0xdbb0, 0xdb71, 0xdb6d, 0xb5d1, + 0xb5e5, 0xdb7c, 0xb5e7, 0xdb78, 0xb5dc, 0xb5d6, 0xb5de, 0xb5d3, + 0xb5e4, 0xdb79, 0xdb67, 0xdb7b, 0xdb62, 0xdba6, 0xdbae, 0xdb5f, + 0xdfc7, 0xdfdd, 0xb855, 0xdfcc, 0xdfca, 0xdfb5, 0xb8a9, 0xdfc5, + 0xdfd9, 0xdfc1, 0xb8b1, 0xdfd8, 0xdfbf, 0xb5e3, 0xdfcf, 0xdfc0, + 0xdfd6, 0xb8b0, 0xb8a8, 0xdfaa, 0xdfb2, 0xdfcb, 0xdfc3, 0xdfdc, + 0xdfc6, 0xb8b6, 0xdfd7, 0xb8ad, 0xdfc9, 0xdfd1, 0xdfb6, 0xdfd0, + 0xdfe1, 0xdfb1, 0xdfd2, 0xdfdf, 0xdfab, 0xb5db, 0xdfb9, 0xdfb8, + 0xb8af, 0xdfbc, 0xdfbe, 0xdfcd, 0xdfde, 0xb8b2, 0xb8b3, 0xdfb0, + 0xb8ab, 0xdfb4, 0xdfda, 0xb8b4, 0xb8ac, 0xb8ae, 0xb8b5, 0xdfe0, + 0xdfd3, 0xdfce, 0xdfbb, 0xdfba, 0xb8aa, 0xdfac, 0xb8a7, 0xdfc4, + 0xdfad, 0xdfc2, 0xdfb7, 0xdfdb, 0xb8a6, 0xdfb3, 0xdfaf, 0xdfd5, + 0xdfae, 0xbb60, 0xe3d3, 0xe3c2, 0xe3ac, 0xe3ca, 0xbb58, 0xe3bb, + 0xe3c5, 0xbb5b, 0xe3be, 0xbb59, 0xe3af, 0xe3cd, 0xe3ae, 0xe3c1, + 0xe3ad, 0xe3bf, 0xe3c8, 0xe3c6, 0xe3ba, 0xe3b5, 0xe3b3, 0xe3b4, + 0xe3c7, 0xe3d2, 0xe3bc, 0xbb5a, 0xe3b7, 0xe3cb, 0xbb5d, 0xe3b6, + 0xe3b0, 0xe3c0, 0xbb61, 0xbb55, 0xbb5e, 0xe3b8, 0xe3b2, 0xbb57, + 0xdfd4, 0xbb56, 0xe3c3, 0xbb54, 0xbb63, 0xbb5c, 0xe3c4, 0xe3b9, + 0xe3b1, 0xe3cc, 0xe3bd, 0xbb62, 0xe3d0, 0xbb5f, 0xe3cf, 0xe3c9, + 0xe3ce, 0xe3d1, 0xe773, 0xe774, 0xe767, 0xe766, 0xe762, 0xbdb4, + 0xbdac, 0xe776, 0xe775, 0xdfa9, 0xe75f, 0xe763, 0xe75d, 0xe770, + 0xe761, 0xe777, 0xe75a, 0xe758, 0xe764, 0xe76e, 0xe769, 0xbdb6, + 0xe74f, 0xe76d, 0xbdb7, 0xdfbd, 0xe75b, 0xe752, 0xe755, 0xe77b, + 0xe75c, 0xe753, 0xe751, 0xe74e, 0xbdb0, 0xe765, 0xbdaf, 0xbdb3, + 0xe760, 0xe768, 0xbda9, 0xe778, 0xe77c, 0xbdab, 0xe757, 0xe76b, + 0xe76f, 0xe754, 0xe779, 0xbdb2, 0xbdb1, 0xe74c, 0xbdb5, 0xe772, + 0xe756, 0xe76a, 0xe750, 0xe75e, 0xe759, 0xbdad, 0xbdae, 0xe76c, + 0xe77d, 0xe77a, 0xe771, 0xe74d, 0xbdaa, 0xeb49, 0xeb40, 0xeb43, + 0xbfbb, 0xeb45, 0xeaf9, 0xeb41, 0xeb47, 0xbfb8, 0xbfbc, 0xbfb6, + 0xeafb, 0xeb4c, 0xeb46, 0xeafc, 0xeb55, 0xeb4f, 0xeaf8, 0xee46, + 0xeafe, 0xbfb7, 0xeb4a, 0xeb54, 0xbfbf, 0xeb51, 0xeafd, 0xeb44, + 0xeb48, 0xeb42, 0xeb56, 0xeb53, 0xeb50, 0xbfb9, 0xbfba, 0xbfbe, + 0xeafa, 0xeb57, 0xbfbd, 0xeb4d, 0xeb4b, 0xeb4e, 0xee53, 0xee40, + 0xee45, 0xee52, 0xee44, 0xedfb, 0xee41, 0xc1a2, 0xedf4, 0xee4d, + 0xee4f, 0xedf3, 0xc1a1, 0xee51, 0xee49, 0xc1a8, 0xee50, 0xee42, + 0xc1aa, 0xedf9, 0xeb52, 0xee4a, 0xee47, 0xedf5, 0xee55, 0xc1a4, + 0xc1a5, 0xedf7, 0xee48, 0xee54, 0xee4b, 0xedfd, 0xc1a7, 0xc1a3, + 0xee4c, 0xedfe, 0xee56, 0xedf8, 0xee43, 0xee4e, 0xedfa, 0xedfc, + 0xc2cb, 0xedf6, 0xc1a9, 0xc2c4, 0xc17e, 0xc1a6, 0xc2c8, 0xf0b3, + 0xf0a9, 0xf0a4, 0xf0aa, 0xf0b4, 0xf0b8, 0xf0b7, 0xc2ca, 0xc2c9, + 0xf0ab, 0xf0b9, 0xf0ae, 0xf0a6, 0xf0a8, 0xf0a7, 0xf0ad, 0xf0b2, + 0xf0a5, 0xf0ac, 0xf0b1, 0xc2c7, 0xf0af, 0xc2c5, 0xf0b0, 0xc2c3, + 0xc2c6, 0xf2d5, 0xf0b5, 0xc3c2, 0xf2cd, 0xf2d1, 0xf2c9, 0xf2cc, + 0xf2d4, 0xc3c0, 0xf2d9, 0xf2d2, 0xf2ca, 0xf2da, 0xf2d3, 0xc3c3, + 0xc3c4, 0xf2d7, 0xf2cb, 0xc3bf, 0xc3c1, 0xf2c6, 0xf2ce, 0xf2c8, + 0xf2d8, 0xf2d6, 0xf2c7, 0xf2cf, 0xf4be, 0xc3c5, 0xf2d0, 0xc4a7, + 0xc4a9, 0xc4a6, 0xf4c3, 0xf4bb, 0xf4b9, 0xf4bd, 0xf4ba, 0xf4bf, + 0xf4c1, 0xc4aa, 0xc4ac, 0xf4c0, 0xc4ad, 0xc4ab, 0xf4c2, 0xc4a8, + 0xc4f4, 0xf5f1, 0xf5f7, 0xc4f6, 0xf4bc, 0xf5f6, 0xf5fd, 0xf5f4, + 0xf5fb, 0xf5fa, 0xf4b8, 0xf5f5, 0xf0b6, 0xf5fe, 0xf5f3, 0xf5f8, + 0xf5fc, 0xf5f2, 0xf74a, 0xc4f5, 0xf5f9, 0xf7f4, 0xf74b, 0xf749, + 0xf747, 0xf748, 0xf74c, 0xc5d9, 0xf7f2, 0xf7f0, 0xf7f5, 0xf7f3, + 0xf7f6, 0xc5da, 0xf7f1, 0xf8bc, 0xf945, 0xf946, 0xf947, 0xf9c7, + 0xf9bd, 0xca4f, 0xaaea, 0xad68, 0xd3b8, 0xd3b7, 0xb040, 0xb342, + 0xd77c, 0xd77b, 0xb5ea, 0xb8b8, 0xb8b7, 0xb8b9, 0xe3d4, 0xe77e, + 0xeb58, 0xeb5a, 0xeb59, 0xc1ab, 0xee57, 0xf0ba, 0xf9a5, 0xa6e4, + 0xcdc9, 0xcdca, 0xcdc8, 0xcdc7, 0xaaeb, 0xd0a9, 0xd0a7, 0xd0a6, + 0xad69, 0xad6b, 0xad6a, 0xd0a8, 0xd3c4, 0xd3c1, 0xd3bf, 0xb041, + 0xd3c2, 0xb046, 0xd3bc, 0xd3cb, 0xd3cd, 0xd3bd, 0xb043, 0xd3ce, + 0xd3c9, 0xd3bb, 0xd3c0, 0xd3ca, 0xd3c6, 0xd3c3, 0xb048, 0xd3cc, + 0xd3be, 0xd3c7, 0xd3b9, 0xb047, 0xb044, 0xd3c5, 0xd3c8, 0xd3ba, + 0xb045, 0xb042, 0xb34c, 0xd7a5, 0xb34b, 0xd7a8, 0xd7ab, 0xb348, + 0xb346, 0xd77e, 0xd7a9, 0xd7a7, 0xd7a4, 0xd7ac, 0xd7ad, 0xd7af, + 0xd7b0, 0xd77d, 0xb345, 0xd7a2, 0xd7a1, 0xd7ae, 0xb347, 0xd7a3, + 0xb349, 0xb344, 0xd7a6, 0xb34d, 0xb34a, 0xd7aa, 0xb5f1, 0xdbbf, + 0xdbb4, 0xb5ee, 0xdfe7, 0xdbbd, 0xdbb1, 0xb5ec, 0xdbb6, 0xb5ef, + 0xdbba, 0xdbb8, 0xb5f2, 0xb5eb, 0xdbb2, 0xdbb5, 0xb5f0, 0xdbb3, + 0xdbbe, 0xdbbc, 0xdbb7, 0xdbb9, 0xdbbb, 0xb5ed, 0xdfe8, 0xdfee, + 0xdfe4, 0xdfea, 0xb8ba, 0xdfe6, 0xb8c0, 0xb8bf, 0xb8be, 0xdfed, + 0xb8c1, 0xb8c2, 0xdfe3, 0xdff0, 0xb8c3, 0xb8bd, 0xb8bc, 0xdfec, + 0xb8c4, 0xdfe2, 0xdfe5, 0xdfef, 0xdfeb, 0xe3f4, 0xe3e9, 0xb8bb, + 0xbb6a, 0xe3dd, 0xe3f2, 0xe3de, 0xbb65, 0xe3db, 0xe3e4, 0xe3dc, + 0xbb67, 0xe3d6, 0xe3f1, 0xbb68, 0xe3ee, 0xe3ef, 0xe3d7, 0xbb6d, + 0xe3e6, 0xe3e0, 0xe3e7, 0xe3da, 0xe3f3, 0xe3eb, 0xe3e5, 0xe3d5, + 0xbb69, 0xe3ec, 0xbb6c, 0xe3f0, 0xe3ea, 0xbb66, 0xe3e8, 0xe3e2, + 0xbb64, 0xe3d9, 0xe3e1, 0xe3ed, 0xe3df, 0xe3e3, 0xbdc1, 0xdfe9, + 0xe7b2, 0xe7bb, 0xe7b1, 0xe7ad, 0xe7aa, 0xbdc2, 0xe7a8, 0xbb6b, + 0xe7a1, 0xbdc0, 0xe7a7, 0xbdbf, 0xe7ac, 0xe7a9, 0xe7b9, 0xe7b4, + 0xe7ae, 0xe7b3, 0xbdbb, 0xe7ab, 0xe7be, 0xe7a2, 0xe7a3, 0xe7ba, + 0xbdbc, 0xe7bf, 0xbdbe, 0xe7c0, 0xe7b0, 0xe3d8, 0xe7b6, 0xe7af, + 0xe7b8, 0xe7b5, 0xe7a6, 0xbdb9, 0xe7bd, 0xbdba, 0xe7a4, 0xbdbd, + 0xeb64, 0xe7b7, 0xe7bc, 0xeb61, 0xbdb8, 0xbfc0, 0xeb6b, 0xeb67, + 0xeb65, 0xeb60, 0xeb6f, 0xbfc4, 0xeb5c, 0xeb68, 0xeb69, 0xeb5f, + 0xeb5e, 0xeb6c, 0xeb62, 0xeb5d, 0xeb63, 0xeb6e, 0xeb5b, 0xeb6d, + 0xeb6a, 0xbfc2, 0xbfc1, 0xbfc3, 0xeb66, 0xf0cb, 0xee59, 0xc1b1, + 0xee5d, 0xee5a, 0xee61, 0xee67, 0xee5c, 0xee70, 0xc1ae, 0xee6a, + 0xee5f, 0xee6b, 0xee66, 0xee6d, 0xee5e, 0xc1b3, 0xc1b2, 0xee60, + 0xee6e, 0xee58, 0xee6c, 0xc1ac, 0xee64, 0xee63, 0xee68, 0xee5b, + 0xc1b0, 0xc1b4, 0xee62, 0xee69, 0xc1b5, 0xee65, 0xc1ad, 0xc1af, + 0xf0c7, 0xf0c5, 0xf0cc, 0xf0c9, 0xf0cd, 0xf0be, 0xf0c6, 0xf0d1, + 0xee6f, 0xf0c2, 0xc2cf, 0xe7a5, 0xf0bd, 0xf0ca, 0xf0c4, 0xf0c1, + 0xf0bc, 0xf0bb, 0xf0d0, 0xf0c0, 0xf0bf, 0xc2cd, 0xf0c8, 0xc2cc, + 0xc2ce, 0xf0c3, 0xf0cf, 0xf2de, 0xf2df, 0xc3c9, 0xf2dc, 0xc3c6, + 0xf2e4, 0xc3ca, 0xf2e6, 0xf2db, 0xf0ce, 0xf2e8, 0xf2dd, 0xc3c7, + 0xf2e3, 0xf2e5, 0xf2e0, 0xf2e7, 0xf2e2, 0xf2e1, 0xc3c8, 0xf4c5, + 0xf4c6, 0xf4c8, 0xc4ae, 0xc4af, 0xf4c9, 0xf4c7, 0xf4c4, 0xf642, + 0xf645, 0xf641, 0xc4fa, 0xf643, 0xc4f9, 0xc4f8, 0xc4f7, 0xf644, + 0xf751, 0xf74f, 0xf74e, 0xf640, 0xf750, 0xf646, 0xf74d, 0xf7f9, + 0xf7d7, 0xf7f7, 0xc5db, 0xf7f8, 0xf7fa, 0xf8bf, 0xc5fa, 0xf8be, + 0xf8bd, 0xc5fb, 0xc65a, 0xf96e, 0xf9a7, 0xf9a6, 0xf9a8, 0xa6e5, + 0xd0aa, 0xd3cf, 0xd3d0, 0xdbc0, 0xf647, 0xf8c0, 0xa6e6, 0xad6c, + 0xd0ab, 0xd7b1, 0xb34e, 0xdbc2, 0xdbc1, 0xb5f3, 0xb8c5, 0xe7c1, + 0xbdc3, 0xbdc4, 0xbfc5, 0xc5fc, 0xa6e7, 0xd0ac, 0xaaed, 0xd0ae, + 0xd0ad, 0xad6d, 0xd3d1, 0xd3d8, 0xb049, 0xd3d6, 0xd3d4, 0xd3db, + 0xd3d2, 0xd3d3, 0xb04a, 0xb04e, 0xd3dc, 0xb04d, 0xd3da, 0xd3d7, + 0xd3d5, 0xb04b, 0xb04c, 0xd3d9, 0xb350, 0xd7b2, 0xb355, 0xd7c2, + 0xb354, 0xd7c4, 0xd7b8, 0xb352, 0xd7c3, 0xd7b3, 0xb353, 0xd7bf, + 0xd7bb, 0xd7bd, 0xd7b7, 0xd7be, 0xb34f, 0xd7ba, 0xd7b9, 0xd7b5, + 0xd7c0, 0xd7bc, 0xd7b4, 0xd7b6, 0xb351, 0xd7c1, 0xb5f6, 0xdbcd, + 0xdbc9, 0xdbcb, 0xdbc6, 0xdbc5, 0xdbc3, 0xdbca, 0xdbcc, 0xdbc8, + 0xdbc7, 0xb5f4, 0xb5f5, 0xdbcf, 0xb8cd, 0xdff2, 0xdff8, 0xdff3, + 0xdff4, 0xdff9, 0xb8cf, 0xb8c7, 0xb8ce, 0xdff1, 0xdbc4, 0xb8ca, + 0xb8c8, 0xdff7, 0xdff6, 0xb8c9, 0xb8cb, 0xdff5, 0xb8c6, 0xb8cc, + 0xe3f6, 0xbb74, 0xe442, 0xe441, 0xe3fb, 0xbb76, 0xe440, 0xe3f7, + 0xe3f8, 0xbb6e, 0xbb70, 0xe3fd, 0xe3f5, 0xbb72, 0xbb71, 0xe3f9, + 0xe3fe, 0xe3fc, 0xbb73, 0xe3fa, 0xdbce, 0xbb6f, 0xe7c2, 0xe7c9, + 0xbdc6, 0xe7cd, 0xbdca, 0xe7c5, 0xe7c3, 0xe7cc, 0xbdc5, 0xe7cb, + 0xbdc7, 0xbdc8, 0xe7c4, 0xbdc9, 0xe7ca, 0xe7c6, 0xe7c7, 0xe7c8, + 0xbb75, 0xeb70, 0xeb7c, 0xbfca, 0xeb77, 0xeb79, 0xbfc8, 0xeb71, + 0xeb75, 0xeb78, 0xbfc6, 0xbfc9, 0xeb7b, 0xeb73, 0xeb74, 0xeb7a, + 0xeb72, 0xeb76, 0xbfc7, 0xee72, 0xee71, 0xc1b7, 0xee77, 0xc1b9, + 0xc1b6, 0xee73, 0xc1ba, 0xee74, 0xee75, 0xee78, 0xc1b8, 0xf0d6, + 0xf0d9, 0xf0d3, 0xf0d5, 0xf0d4, 0xf0d7, 0xf0d8, 0xee76, 0xf0d2, + 0xc3cd, 0xf2ec, 0xf2ef, 0xf2f1, 0xf2ea, 0xf2eb, 0xf2ee, 0xf2f0, + 0xc3ce, 0xc3cc, 0xc3cb, 0xf2ed, 0xf2e9, 0xf4ca, 0xc4b0, 0xf4cb, + 0xf649, 0xc4fb, 0xf64b, 0xc4fc, 0xf648, 0xf64a, 0xc5a8, 0xf752, + 0xc5a7, 0xf7fd, 0xf7fc, 0xf7fb, 0xf948, 0xf949, 0xf94b, 0xf94a, + 0xca50, 0xa6e8, 0xad6e, 0xd7c5, 0xb5f7, 0xdffa, 0xc2d0, 0xf2f2, + 0xa8a3, 0xb357, 0xb356, 0xdbd0, 0xb5f8, 0xdbd2, 0xdbd1, 0xdffb, + 0xb8d0, 0xe443, 0xe446, 0xe445, 0xe444, 0xe7ce, 0xe7d0, 0xe7cf, + 0xbfcc, 0xbfcb, 0xc1bb, 0xee79, 0xee7b, 0xee7a, 0xc2d1, 0xf2f4, + 0xf2f3, 0xf4cc, 0xc4b1, 0xc4fd, 0xf754, 0xf753, 0xc65b, 0xa8a4, + 0xd0af, 0xad6f, 0xd7c8, 0xd7c6, 0xd7c7, 0xdbd4, 0xdbd5, 0xe043, + 0xdbd3, 0xdffc, 0xe041, 0xe040, 0xe042, 0xb8d1, 0xdffe, 0xdffd, + 0xe044, 0xe449, 0xe447, 0xe448, 0xe7d3, 0xe7d1, 0xe7d2, 0xeb7d, + 0xee7c, 0xee7d, 0xc2d2, 0xf2f5, 0xf4cd, 0xc4b2, 0xf64c, 0xf755, + 0xc5a9, 0xf7fe, 0xf94c, 0xa8a5, 0xad71, 0xad72, 0xd0b0, 0xd0b1, + 0xad70, 0xb054, 0xb052, 0xb051, 0xb058, 0xb050, 0xb059, 0xd3dd, + 0xb056, 0xb053, 0xb057, 0xb055, 0xb04f, 0xb35f, 0xb359, 0xd7cc, + 0xb35e, 0xb360, 0xb35a, 0xb35b, 0xd7ca, 0xb358, 0xd7cb, 0xb35d, + 0xd7c9, 0xb35c, 0xb644, 0xb646, 0xdbd8, 0xb645, 0xb5f9, 0xb5fd, + 0xb8e4, 0xe049, 0xdbda, 0xb5fe, 0xdbdd, 0xdbde, 0xb643, 0xdbe0, + 0xdbe2, 0xdbe3, 0xdbd7, 0xdbd6, 0xdbe4, 0xb642, 0xdbe1, 0xdbdf, + 0xb640, 0xb5fb, 0xb647, 0xdbdb, 0xdbdc, 0xdbd9, 0xb641, 0xb5fc, + 0xb5fa, 0xe048, 0xb8df, 0xb8da, 0xb8d5, 0xb8e5, 0xb8d6, 0xb8d2, + 0xb8e1, 0xb8de, 0xb8e0, 0xb8d7, 0xb8dc, 0xb8d3, 0xb8d4, 0xe050, + 0xe04d, 0xe045, 0xe04a, 0xb8e2, 0xe051, 0xb8e3, 0xb8d9, 0xe047, + 0xe04f, 0xe04b, 0xe04e, 0xe04c, 0xb8dd, 0xe046, 0xb8d8, 0xe44c, + 0xbb78, 0xbb7b, 0xe44e, 0xbba5, 0xe44d, 0xbb7d, 0xbdcf, 0xe44f, + 0xbba4, 0xe44b, 0xbba6, 0xbb79, 0xb8db, 0xbb7c, 0xbb7a, 0xbb7e, + 0xbba2, 0xbb77, 0xbba7, 0xbba3, 0xbba1, 0xe44a, 0xbdd6, 0xbdd2, + 0xbdd9, 0xe7d6, 0xbdda, 0xe7e2, 0xe7db, 0xbdcb, 0xe7e3, 0xe7dd, + 0xbdd5, 0xe7de, 0xbdd4, 0xe7e1, 0xbdce, 0xe7df, 0xe7d5, 0xbdcd, + 0xebaa, 0xbdd3, 0xbdd0, 0xbdd8, 0xe7d4, 0xe7d8, 0xbdcc, 0xe7d7, + 0xe7d9, 0xe7da, 0xbdd7, 0xe7dc, 0xe7e0, 0xe7e4, 0xbddb, 0xbfd2, + 0xeba5, 0xebab, 0xeba8, 0xeb7e, 0xebac, 0xeba1, 0xeba7, 0xbfcd, + 0xbfd3, 0xebad, 0xbfcf, 0xbfd9, 0xbfd4, 0xebaf, 0xeba9, 0xbfd0, + 0xeba2, 0xbfda, 0xeba3, 0xeba4, 0xbfdb, 0xbfd8, 0xbdd1, 0xbfce, + 0xebb0, 0xbfdc, 0xbfd5, 0xebae, 0xbfd1, 0xbfd6, 0xbfd7, 0xc1c3, + 0xeea4, 0xeead, 0xeeaa, 0xeeac, 0xc1c0, 0xeea5, 0xeeab, 0xc1bc, + 0xeea7, 0xc1c4, 0xeea3, 0xeea8, 0xeeaf, 0xeba6, 0xeea9, 0xeea2, + 0xc1bd, 0xeea1, 0xc1be, 0xeeb0, 0xc1bf, 0xeeae, 0xc1c2, 0xee7e, + 0xc1c1, 0xeea6, 0xf0dc, 0xf0ea, 0xf0e5, 0xf0e7, 0xf0db, 0xc2d3, + 0xf0da, 0xc2d6, 0xc2d5, 0xf0e9, 0xf0e1, 0xf0de, 0xf0e4, 0xf0dd, + 0xf0df, 0xf0e8, 0xf0e6, 0xc2d4, 0xf0ed, 0xf0eb, 0xf0e2, 0xf0ec, + 0xf0e3, 0xf2f9, 0xc3cf, 0xf341, 0xf64f, 0xc3d6, 0xf0e0, 0xf2f7, + 0xc3d2, 0xf2f8, 0xf2fd, 0xc3d4, 0xc3d5, 0xf2f6, 0xf340, 0xf342, + 0xf2fa, 0xf2fc, 0xf2fe, 0xf2fb, 0xf343, 0xc3d1, 0xc3d7, 0xc3d3, + 0xc3d0, 0xf4d0, 0xc4b7, 0xf4ce, 0xf4d2, 0xf4d3, 0xc4b5, 0xf4d4, + 0xf4d1, 0xf4cf, 0xc4b8, 0xc4b4, 0xf4d5, 0xc4b6, 0xc4b3, 0xc4fe, + 0xc540, 0xf64e, 0xf64d, 0xf650, 0xf651, 0xc541, 0xf756, 0xf75b, + 0xc5aa, 0xf758, 0xf757, 0xf75a, 0xf759, 0xf843, 0xc5dc, 0xf842, + 0xf840, 0xf841, 0xc5fe, 0xc5fd, 0xf8c1, 0xf8c2, 0xc640, 0xf94d, + 0xf94e, 0xc667, 0xc66d, 0xf9a9, 0xf9c8, 0xa8a6, 0xd7cd, 0xd7ce, + 0xe052, 0xe450, 0xe7e5, 0xc1c6, 0xc1c5, 0xf0ee, 0xf344, 0xf844, + 0xa8a7, 0xd3de, 0xb05a, 0xb361, 0xe054, 0xe053, 0xbddc, 0xe7e6, + 0xbddd, 0xeeb1, 0xc2d7, 0xc676, 0xa8a8, 0xcdcb, 0xd3df, 0xb362, + 0xd7cf, 0xd7d0, 0xdbe5, 0xb648, 0xb8e6, 0xe056, 0xe055, 0xe057, + 0xe451, 0xe452, 0xbba8, 0xbfdd, 0xbdde, 0xbfde, 0xeeb5, 0xeeb2, + 0xeeb4, 0xeeb3, 0xc1c7, 0xf0ef, 0xf346, 0xf345, 0xcba4, 0xb05c, + 0xb05b, 0xd3e0, 0xd7d1, 0xdbe7, 0xdbe6, 0xb649, 0xe059, 0xe05a, + 0xe058, 0xb8e8, 0xb8e7, 0xbbaa, 0xbba9, 0xe7e7, 0xebb3, 0xebb1, + 0xebb2, 0xbfdf, 0xeeb7, 0xeeb6, 0xf0f2, 0xf0f1, 0xf0f0, 0xf347, + 0xf9aa, 0xa8a9, 0xad73, 0xad74, 0xb05d, 0xb05e, 0xd3e2, 0xd3e1, + 0xd7d2, 0xb368, 0xb366, 0xb363, 0xb367, 0xb365, 0xb364, 0xb64a, + 0xdbea, 0xb8ed, 0xb64c, 0xb651, 0xdbec, 0xb653, 0xb652, 0xb655, + 0xdbeb, 0xdbe8, 0xb64f, 0xb64b, 0xb64d, 0xdbe9, 0xb654, 0xb650, + 0xb64e, 0xb8ef, 0xb8ee, 0xb8ec, 0xb8f0, 0xb8ea, 0xb8eb, 0xb8e9, + 0xe05b, 0xe454, 0xbbac, 0xbbad, 0xbbab, 0xe453, 0xe455, 0xe7ea, + 0xe7ec, 0xbde7, 0xe7ed, 0xbde0, 0xe7e9, 0xbddf, 0xbde9, 0xbde5, + 0xbde6, 0xbde2, 0xe7e8, 0xbde1, 0xe7ee, 0xe7eb, 0xbde8, 0xbde3, + 0xbde4, 0xebb5, 0xebb7, 0xebb6, 0xebb8, 0xbfe0, 0xebb4, 0xc1cb, + 0xeeb8, 0xc1c8, 0xc1cc, 0xc1ca, 0xc1c9, 0xf0f3, 0xf0f6, 0xf0f5, + 0xf0f4, 0xc2d8, 0xf348, 0xf349, 0xc3d8, 0xf34a, 0xc3d9, 0xc4ba, + 0xc4b9, 0xf652, 0xc542, 0xf653, 0xf75c, 0xc5ab, 0xc5ac, 0xf845, + 0xc642, 0xa8aa, 0xb36a, 0xb369, 0xe05c, 0xe05d, 0xbbae, 0xebb9, + 0xbdea, 0xebba, 0xeeb9, 0xa8ab, 0xd0b2, 0xad76, 0xad75, 0xd3e3, + 0xb05f, 0xd3e4, 0xd7d5, 0xd7d4, 0xd7d3, 0xdbee, 0xb658, 0xdbed, + 0xb657, 0xdbef, 0xb656, 0xe05f, 0xe062, 0xe060, 0xe061, 0xe065, + 0xe05e, 0xe066, 0xe063, 0xe064, 0xbbb0, 0xe456, 0xbbaf, 0xe7f2, + 0xe7f0, 0xbdeb, 0xe7ef, 0xe7f1, 0xbdec, 0xebbb, 0xebbc, 0xc1cd, + 0xf34c, 0xf34e, 0xf34b, 0xf34d, 0xf4d6, 0xf654, 0xf96f, 0xa8ac, + 0xad77, 0xd3e5, 0xd3e7, 0xd3e6, 0xd7d8, 0xb36c, 0xd7d6, 0xb36b, + 0xd7d9, 0xd7da, 0xd7d7, 0xdbfb, 0xb660, 0xdbf3, 0xdbf9, 0xb65b, + 0xb65e, 0xdbf2, 0xb659, 0xdbf6, 0xe06c, 0xb65d, 0xdbf1, 0xdbf7, + 0xdbf4, 0xdbfa, 0xdbf0, 0xdbf8, 0xb65c, 0xb65f, 0xdbf5, 0xb65a, + 0xb8f2, 0xe068, 0xb8f1, 0xe06f, 0xe06e, 0xb8f8, 0xb8f9, 0xe070, + 0xb8f3, 0xe06d, 0xb8f7, 0xe072, 0xe069, 0xe06b, 0xb8f4, 0xe067, + 0xe06a, 0xe071, 0xb8f5, 0xe073, 0xb8f6, 0xbbb1, 0xe45b, 0xe461, + 0xe459, 0xe462, 0xe458, 0xe45d, 0xe463, 0xe460, 0xe45f, 0xe45e, + 0xe457, 0xe45c, 0xe45a, 0xbdf1, 0xbdee, 0xe7fb, 0xe841, 0xe843, + 0xe840, 0xe7f8, 0xe7fa, 0xe845, 0xe842, 0xe7fc, 0xe846, 0xe7f9, + 0xe844, 0xbdef, 0xbdf5, 0xbdf3, 0xe7f3, 0xbdf4, 0xbdf0, 0xe7f4, + 0xe7f6, 0xe7f5, 0xe7fd, 0xe7fe, 0xbdf2, 0xbded, 0xe7f7, 0xebc6, + 0xbfe2, 0xebbd, 0xbfe3, 0xbfe6, 0xebc2, 0xebbf, 0xbfe5, 0xebc3, + 0xebc4, 0xebbe, 0xebc7, 0xebc0, 0xebc5, 0xbfe4, 0xbfe1, 0xebc1, + 0xeebf, 0xc1d0, 0xc1ce, 0xc1d1, 0xc1cf, 0xeebe, 0xeebb, 0xeeba, + 0xeebd, 0xeebc, 0xf145, 0xc2de, 0xf0fb, 0xf0fa, 0xc2d9, 0xf141, + 0xf140, 0xf0f7, 0xf143, 0xf0fc, 0xc2dd, 0xf0f9, 0xf142, 0xf0f8, + 0xc2da, 0xc2dc, 0xf0fd, 0xc2db, 0xf0fe, 0xf144, 0xf352, 0xc3de, + 0xf34f, 0xf353, 0xc3db, 0xf351, 0xc3e0, 0xc3dd, 0xf350, 0xc3df, + 0xf354, 0xc3da, 0xc4bc, 0xc4be, 0xf4d9, 0xc4bd, 0xf4d7, 0xc3dc, + 0xf4d8, 0xc4bb, 0xc543, 0xc545, 0xf656, 0xc544, 0xf655, 0xf761, + 0xc5ad, 0xf760, 0xc5ae, 0xf75e, 0xf75d, 0xf762, 0xf763, 0xf846, + 0xf75f, 0xf8c6, 0xf8c3, 0xf8c4, 0xf8c5, 0xc65c, 0xf951, 0xf950, + 0xf94f, 0xf970, 0xf9be, 0xf9ab, 0xc66e, 0xa8ad, 0xb060, 0xb8fa, + 0xbdf6, 0xebc8, 0xc2df, 0xf355, 0xf9ac, 0xa8ae, 0xaaee, 0xad79, + 0xad78, 0xb063, 0xd3e8, 0xb061, 0xd3e9, 0xb062, 0xd7df, 0xd7db, + 0xb36d, 0xd7de, 0xd7dd, 0xd7dc, 0xb36e, 0xd7e0, 0xd7e1, 0xdc43, + 0xdc41, 0xdc45, 0xdc46, 0xdc4c, 0xdc48, 0xdc4a, 0xdc42, 0xdbfc, + 0xdc49, 0xdc4b, 0xdc44, 0xdc47, 0xdbfd, 0xb662, 0xdc40, 0xdbfe, + 0xb661, 0xb663, 0xb8fd, 0xe075, 0xe077, 0xe076, 0xe07b, 0xb8fb, + 0xe078, 0xe074, 0xe079, 0xe07a, 0xb8fc, 0xb8fe, 0xe07c, 0xe467, + 0xe466, 0xe464, 0xe465, 0xbbb3, 0xbbb5, 0xbbb2, 0xbbb4, 0xe84d, + 0xe84e, 0xe849, 0xe84a, 0xbdf8, 0xbdfd, 0xbdf7, 0xbdfe, 0xbdf9, + 0xe84b, 0xe84c, 0xe848, 0xbe40, 0xbdfb, 0xbdfa, 0xbdfc, 0xe847, + 0xebca, 0xbfe8, 0xebcc, 0xbfea, 0xebcf, 0xebcb, 0xebc9, 0xebce, + 0xbfe9, 0xebcd, 0xbfe7, 0xc1d3, 0xc1d6, 0xeec1, 0xc1d4, 0xeec0, + 0xc1d2, 0xc1d5, 0xf146, 0xf147, 0xf148, 0xc2e0, 0xf149, 0xc2e1, + 0xc3e2, 0xf358, 0xf359, 0xf357, 0xf356, 0xf35a, 0xc3e1, 0xf4dd, + 0xf4db, 0xf4dc, 0xf4de, 0xf4da, 0xf4df, 0xf658, 0xf659, 0xf657, + 0xc546, 0xf764, 0xc5af, 0xf765, 0xf848, 0xf847, 0xa8af, 0xb664, + 0xb940, 0xbbb6, 0xbfec, 0xbfeb, 0xc3e3, 0xc47c, 0xc547, 0xa8b0, + 0xb064, 0xb941, 0xf35b, 0xcba6, 0xa8b1, 0xa8b4, 0xa8b3, 0xa8b2, + 0xcba5, 0xcdcd, 0xcdcf, 0xaaef, 0xaaf1, 0xcdcc, 0xcdce, 0xaaf0, + 0xcdd1, 0xcdd0, 0xcdd2, 0xd0b6, 0xd0b4, 0xad7c, 0xd0b3, 0xada3, + 0xad7e, 0xad7b, 0xada4, 0xad7d, 0xada2, 0xada1, 0xd0b5, 0xad7a, + 0xb06a, 0xd3eb, 0xd3f1, 0xb067, 0xb06e, 0xb069, 0xd3ee, 0xd3f0, + 0xb06c, 0xd3ea, 0xd3ed, 0xb068, 0xb065, 0xd3ec, 0xb06b, 0xd3ef, + 0xb06d, 0xb066, 0xd7e3, 0xd7e6, 0xb370, 0xb37a, 0xb376, 0xd7e4, + 0xb37e, 0xb377, 0xb37c, 0xb372, 0xb36f, 0xb371, 0xb37d, 0xd7e5, + 0xb375, 0xb378, 0xb374, 0xb379, 0xd7e7, 0xb37b, 0xb373, 0xd7e2, + 0xdc4d, 0xb665, 0xdc4f, 0xb667, 0xb669, 0xdc4e, 0xb666, 0xb66a, + 0xb668, 0xb947, 0xe0a3, 0xb94f, 0xe07e, 0xb950, 0xb945, 0xe0a1, + 0xb94a, 0xe0a2, 0xb943, 0xb942, 0xb94d, 0xb94c, 0xb94b, 0xb949, + 0xb94e, 0xe07d, 0xb944, 0xb946, 0xb948, 0xbbb8, 0xbbbb, 0xbbbf, + 0xbbb9, 0xbbbe, 0xbbbc, 0xbbb7, 0xbbbd, 0xbbba, 0xe852, 0xbe43, + 0xbe41, 0xe853, 0xbe44, 0xbe42, 0xe851, 0xe850, 0xbff0, 0xe84f, + 0xbfee, 0xbfed, 0xebd0, 0xbe45, 0xbfef, 0xebd1, 0xbff2, 0xebd2, + 0xbff1, 0xc1d8, 0xeec3, 0xc1d7, 0xc1dc, 0xc1da, 0xc1db, 0xc2e3, + 0xc1d9, 0xeec2, 0xebd3, 0xc2e2, 0xc2e4, 0xc3e4, 0xc3e5, 0xf4e0, + 0xc5de, 0xc5dd, 0xa8b6, 0xca55, 0xb06f, 0xca52, 0xca53, 0xca51, + 0xca54, 0xcbaa, 0xcba7, 0xcbac, 0xcba8, 0xa8b7, 0xa8ba, 0xcba9, + 0xa8b9, 0xcbab, 0xa8b8, 0xcdd5, 0xcdd7, 0xaaf4, 0xcdd3, 0xcdd6, + 0xcdd4, 0xaaf2, 0xaaf5, 0xaaf3, 0xd0b8, 0xd0bc, 0xd0b9, 0xada7, + 0xada8, 0xd0bb, 0xd0bd, 0xd0bf, 0xada5, 0xd0be, 0xada6, 0xd7ee, + 0xd0ba, 0xd3f2, 0xd3fb, 0xd3f9, 0xd3f4, 0xd3f5, 0xd3fa, 0xd3fc, + 0xb071, 0xd3f7, 0xd3f3, 0xb070, 0xb072, 0xd3f6, 0xd3fd, 0xd3f8, + 0xb3a1, 0xd7f1, 0xd7e9, 0xd7ef, 0xd7f0, 0xb3a2, 0xd7e8, 0xd7ea, + 0xd0b7, 0xd7ec, 0xd7ed, 0xd7eb, 0xb66c, 0xdc56, 0xebd4, 0xdc57, + 0xdc54, 0xb3a3, 0xb66e, 0xdc53, 0xdc59, 0xdc58, 0xb66b, 0xdc5c, + 0xdc52, 0xdc5b, 0xdc50, 0xdc5a, 0xdc55, 0xb66d, 0xe0aa, 0xe0a5, + 0xe0ab, 0xe0a6, 0xe0a4, 0xe0a7, 0xb951, 0xe0a9, 0xe0a8, 0xb952, + 0xbbc1, 0xbbc0, 0xe46e, 0xe471, 0xe469, 0xe46d, 0xbbc2, 0xe46c, + 0xe46a, 0xe470, 0xe46b, 0xe468, 0xe46f, 0xe859, 0xbe48, 0xf14a, + 0xe856, 0xe857, 0xe855, 0xdc51, 0xbe47, 0xe85a, 0xe854, 0xbe46, + 0xbe49, 0xe858, 0xebd5, 0xbff3, 0xebd6, 0xebd7, 0xeec4, 0xc1dd, + 0xf14b, 0xf14c, 0xf14d, 0xf35d, 0xf35c, 0xf4e2, 0xf4e1, 0xf65b, + 0xf65c, 0xf65a, 0xf766, 0xc5b0, 0xa8bb, 0xadaa, 0xada9, 0xb075, + 0xb074, 0xd440, 0xd441, 0xd3fe, 0xb073, 0xd7f5, 0xd7f6, 0xd7f2, + 0xb3a4, 0xd7f3, 0xd7f4, 0xdc5f, 0xdc61, 0xdc5d, 0xdc60, 0xb66f, + 0xdc5e, 0xb670, 0xdd73, 0xb955, 0xb954, 0xb953, 0xe0ac, 0xe0ad, + 0xe473, 0xe475, 0xbbc6, 0xbbc3, 0xbbc5, 0xbbc4, 0xe474, 0xe472, + 0xe861, 0xe85e, 0xe85f, 0xbe4d, 0xe860, 0xe85b, 0xe85c, 0xbe4a, + 0xbe4b, 0xe85d, 0xbe4c, 0xebdb, 0xebdc, 0xebd9, 0xebda, 0xbff4, + 0xebd8, 0xeec8, 0xeec5, 0xeec7, 0xc1e0, 0xeecb, 0xc1df, 0xeec9, + 0xeecc, 0xeeca, 0xeec6, 0xc1de, 0xf14f, 0xf150, 0xf14e, 0xf152, + 0xc2e5, 0xc2e6, 0xf35f, 0xc3e7, 0xf151, 0xf35e, 0xc3e6, 0xf4e5, + 0xf4e6, 0xc4bf, 0xf4e4, 0xf4e3, 0xf65d, 0xc548, 0xf849, 0xf8c8, + 0xf8c7, 0xc643, 0xc65d, 0xf8c9, 0xf971, 0xc66f, 0xa8bc, 0xaaf6, + 0xb956, 0xc4c0, 0xa8bd, 0xadab, 0xb3a5, 0xb671, 0xc2e7, 0xaaf7, + 0xd0c1, 0xd0c0, 0xd442, 0xb078, 0xb076, 0xb07a, 0xd444, 0xb079, + 0xb077, 0xd443, 0xb3a8, 0xd7fc, 0xb3a7, 0xb3a9, 0xd842, 0xb3ab, + 0xd7fe, 0xd840, 0xd7f7, 0xb3aa, 0xd843, 0xd7f9, 0xd7fa, 0xd7f8, + 0xb3a6, 0xd841, 0xd7fb, 0xd7fd, 0xdc6d, 0xdc6c, 0xdc6a, 0xdc62, + 0xdc71, 0xdc65, 0xdc6f, 0xdc76, 0xdc6e, 0xb679, 0xb675, 0xdc63, + 0xdc69, 0xb677, 0xdc68, 0xb678, 0xb67a, 0xdc6b, 0xb672, 0xb673, + 0xdc77, 0xdc75, 0xdc74, 0xdc66, 0xdc72, 0xb676, 0xb674, 0xdc73, + 0xdc64, 0xdc67, 0xdc70, 0xe4ba, 0xe0b7, 0xe0b0, 0xe0c3, 0xe0cc, + 0xe0b3, 0xb961, 0xe0c0, 0xb957, 0xb959, 0xb965, 0xe0b1, 0xb95a, + 0xb95c, 0xb966, 0xb95b, 0xb964, 0xe0b9, 0xe0ae, 0xb962, 0xe0b8, + 0xb95e, 0xe0ca, 0xb963, 0xe0c8, 0xe0bc, 0xe0c6, 0xb960, 0xe0af, + 0xe0c9, 0xe0c4, 0xe0cb, 0xb958, 0xb967, 0xb95d, 0xe0b5, 0xe0bd, + 0xe0c1, 0xe0c5, 0xb95f, 0xe0b4, 0xe0b2, 0xe0be, 0xe0bb, 0xe0ba, + 0xe0bf, 0xe0c2, 0xe0c7, 0xe478, 0xbbc7, 0xe4a4, 0xe47a, 0xbbcc, + 0xbbd0, 0xe4ad, 0xe4b5, 0xe4a6, 0xbbc8, 0xe4aa, 0xe0b6, 0xbbc9, + 0xe4b1, 0xe4b6, 0xe4ae, 0xe4b0, 0xe4b9, 0xe4b2, 0xe47e, 0xe4a9, + 0xbbd1, 0xbbcd, 0xe47c, 0xe4ab, 0xbbcb, 0xe4a5, 0xbbca, 0xe4b3, + 0xe4a2, 0xe479, 0xbbce, 0xe4b8, 0xe47b, 0xe4af, 0xe4ac, 0xe4a7, + 0xe477, 0xe476, 0xe4a1, 0xe4b4, 0xbbcf, 0xe4b7, 0xe47d, 0xe4a3, + 0xbe52, 0xbe5a, 0xbe55, 0xe8a4, 0xe8a1, 0xe867, 0xbe50, 0xbe4f, + 0xbe56, 0xe865, 0xbe54, 0xe871, 0xe863, 0xe864, 0xbe4e, 0xe8a3, + 0xbe58, 0xe874, 0xe879, 0xe873, 0xebee, 0xe86f, 0xe877, 0xe875, + 0xe868, 0xe862, 0xe87d, 0xbe57, 0xe87e, 0xe878, 0xe86d, 0xe86b, + 0xe866, 0xe86e, 0xe87b, 0xe86a, 0xe87a, 0xe8a2, 0xbe53, 0xe876, + 0xe87c, 0xe872, 0xe86c, 0xbe51, 0xe4a8, 0xe870, 0xbe59, 0xe869, + 0xebf4, 0xbff7, 0xebf3, 0xebf0, 0xec44, 0xbffb, 0xec41, 0xebf8, + 0xec43, 0xebe9, 0xebf6, 0xbffd, 0xebe1, 0xebdf, 0xec42, 0xec40, + 0xebfe, 0xebed, 0xebec, 0xebe2, 0xc040, 0xebe8, 0xebf2, 0xebfd, + 0xc043, 0xec45, 0xc1e8, 0xc045, 0xbffe, 0xebe6, 0xebef, 0xebde, + 0xebe0, 0xbff5, 0xc042, 0xbffa, 0xebe7, 0xebf7, 0xebf1, 0xc041, + 0xebdd, 0xc1e3, 0xebf9, 0xebfc, 0xbffc, 0xebeb, 0xc044, 0xbff9, + 0xbff8, 0xebf5, 0xebfb, 0xbff6, 0xebe4, 0xebfa, 0xebe5, 0xebea, + 0xeed2, 0xeed7, 0xc1e5, 0xc1e7, 0xeedd, 0xc1e1, 0xeeec, 0xeee3, + 0xeed8, 0xeed9, 0xeee2, 0xc1ee, 0xeee1, 0xeed1, 0xeee0, 0xeed4, + 0xeeed, 0xc1ed, 0xc1eb, 0xeed5, 0xeee8, 0xeeda, 0xeee7, 0xeee9, + 0xeed0, 0xc1e6, 0xeeea, 0xeede, 0xc1ea, 0xeedb, 0xc1ec, 0xeee4, + 0xc1e4, 0xeed6, 0xeee5, 0xeedf, 0xebe3, 0xeee6, 0xeed3, 0xc1e9, + 0xeeeb, 0xc1e2, 0xeece, 0xf160, 0xf159, 0xc2e9, 0xf154, 0xf163, + 0xf15b, 0xeedc, 0xf165, 0xf155, 0xc2e8, 0xf15f, 0xc2ea, 0xc2f2, + 0xc2f0, 0xf161, 0xc2f1, 0xf157, 0xf158, 0xf15d, 0xf162, 0xeecd, + 0xc2eb, 0xf16a, 0xf167, 0xf16b, 0xf15e, 0xf15a, 0xf168, 0xf36a, + 0xf15c, 0xc2ee, 0xc2ed, 0xeecf, 0xc2ef, 0xf164, 0xf166, 0xc2ec, + 0xf169, 0xf153, 0xf156, 0xf373, 0xf363, 0xc3eb, 0xf371, 0xf361, + 0xc3ec, 0xf36c, 0xf368, 0xc3f1, 0xf372, 0xf362, 0xf365, 0xc3e9, + 0xf374, 0xf36d, 0xf370, 0xc3ef, 0xc3f4, 0xc3f2, 0xf369, 0xf364, + 0xc3ed, 0xc3ee, 0xf360, 0xc3ea, 0xc3e8, 0xc3f0, 0xf36f, 0xc3f3, + 0xf36b, 0xf375, 0xc3f5, 0xf367, 0xf36e, 0xf4f3, 0xf542, 0xf4f5, + 0xf4fc, 0xf366, 0xf4fa, 0xf4e9, 0xf540, 0xc4c3, 0xf4ed, 0xf4fe, + 0xf4f4, 0xc4c2, 0xf544, 0xf4f6, 0xf4fb, 0xf4fd, 0xf4e7, 0xf541, + 0xf4f2, 0xf4f7, 0xf4eb, 0xf4ef, 0xf543, 0xf4f9, 0xf4e8, 0xf4ec, + 0xf4ee, 0xf4f8, 0xc4c1, 0xf4f1, 0xf4ea, 0xf4f0, 0xf661, 0xf666, + 0xc54f, 0xf668, 0xc549, 0xf664, 0xf66a, 0xc54e, 0xc54a, 0xc54b, + 0xf660, 0xf667, 0xc54d, 0xf665, 0xc54c, 0xf65f, 0xf663, 0xf662, + 0xf65e, 0xf669, 0xc5b1, 0xf76d, 0xf770, 0xf76c, 0xf76e, 0xf76f, + 0xf769, 0xf76a, 0xf767, 0xf76b, 0xf768, 0xc5b2, 0xc5b3, 0xf84b, + 0xf84d, 0xf84c, 0xf84e, 0xc5e0, 0xf84a, 0xc5df, 0xc5e1, 0xf8cb, + 0xf8cc, 0xc644, 0xf8ca, 0xf953, 0xf952, 0xf954, 0xc65f, 0xf955, + 0xc65e, 0xf956, 0xf972, 0xf975, 0xf974, 0xc668, 0xf973, 0xc672, + 0xc670, 0xc671, 0xc677, 0xf9c0, 0xf9c1, 0xf9bf, 0xf9c9, 0xaaf8, + 0xd844, 0xdc78, 0xe8a5, 0xf376, 0xaaf9, 0xadac, 0xb07b, 0xd845, + 0xd846, 0xb3ac, 0xb67d, 0xdc7a, 0xdc79, 0xb6a3, 0xb67c, 0xdc7b, + 0xb67e, 0xb6a2, 0xb6a1, 0xb67b, 0xb968, 0xe0d0, 0xe0ce, 0xe0cf, + 0xe0cd, 0xbbd2, 0xbbd5, 0xbbd7, 0xbbd6, 0xbbd3, 0xbbd4, 0xe8a7, + 0xe8a6, 0xbe5b, 0xe8a8, 0xe8a9, 0xbe5c, 0xec4d, 0xec4b, 0xeef3, + 0xec49, 0xec4a, 0xc046, 0xec46, 0xec4e, 0xec48, 0xec4c, 0xeeef, + 0xeef1, 0xeef2, 0xc1f3, 0xeeee, 0xc1f2, 0xeef0, 0xc1ef, 0xc1f0, + 0xc1f1, 0xec47, 0xc2f5, 0xf16e, 0xf16c, 0xf16d, 0xc2f3, 0xc2f6, + 0xc2f4, 0xf377, 0xf378, 0xc3f6, 0xf545, 0xf547, 0xf546, 0xc4c4, + 0xc550, 0xf66d, 0xf66c, 0xf66b, 0xaafa, 0xc9aa, 0xca58, 0xa6e9, + 0xca56, 0xca59, 0xca57, 0xcbae, 0xa8c1, 0xa8c2, 0xcbb0, 0xa8bf, + 0xcbaf, 0xcbad, 0xa8c0, 0xa8be, 0xcdd8, 0xcddb, 0xaafd, 0xcdda, + 0xcdd9, 0xaafc, 0xaafb, 0xab40, 0xcddc, 0xaafe, 0xd0c6, 0xadae, + 0xadaf, 0xadb0, 0xd0c7, 0xd0c3, 0xadad, 0xd0c4, 0xd0c5, 0xd0c2, + 0xb0a4, 0xb0a1, 0xd445, 0xb0a2, 0xb0a5, 0xd446, 0xb07e, 0xb07c, + 0xb07d, 0xb0a3, 0xb3ad, 0xd849, 0xb3b5, 0xd848, 0xd84b, 0xb3b1, + 0xd84a, 0xb6ab, 0xb3af, 0xb3b2, 0xb3ae, 0xb3b3, 0xb3b4, 0xb3b0, + 0xd847, 0xb6a7, 0xdc7d, 0xdca3, 0xdca2, 0xb6ac, 0xb6a8, 0xb6a9, + 0xdc7c, 0xdc7e, 0xdca1, 0xb6a4, 0xb6a6, 0xb6aa, 0xb6a5, 0xe0d3, + 0xe0d1, 0xe0d2, 0xb96a, 0xb96b, 0xe0d4, 0xb969, 0xbbd8, 0xbbda, + 0xbbd9, 0xe4bb, 0xe4bc, 0xe8ab, 0xe8aa, 0xc047, 0xc048, 0xec4f, + 0xc049, 0xeef6, 0xeef4, 0xeef5, 0xc1f4, 0xf16f, 0xc3f7, 0xc1f5, + 0xab41, 0xb0a6, 0xd447, 0xd84c, 0xb3b6, 0xb6ad, 0xdca4, 0xdca6, + 0xb6af, 0xb6ae, 0xb6b0, 0xb6b1, 0xdca5, 0xb96e, 0xb96f, 0xb96d, + 0xbbdb, 0xb96c, 0xe0d5, 0xbbdc, 0xe8ac, 0xec50, 0xc04a, 0xc1f6, + 0xf170, 0xf174, 0xc2f9, 0xf171, 0xc2fa, 0xc2f8, 0xf175, 0xc2fb, + 0xf173, 0xf379, 0xc2f7, 0xc3f8, 0xf8cd, 0xab42, 0xb3b8, 0xb3b7, + 0xb6b2, 0xdca8, 0xdca7, 0xb6b3, 0xe0d9, 0xb973, 0xb970, 0xe0d8, + 0xb972, 0xe0d6, 0xb971, 0xe0d7, 0xe4bd, 0xbbdd, 0xe8af, 0xbe5d, + 0xe8ad, 0xbe5e, 0xbe5f, 0xe8ae, 0xbe60, 0xec51, 0xc04e, 0xc04b, + 0xc050, 0xec53, 0xc04c, 0xec52, 0xc04f, 0xc04d, 0xeef9, 0xeefb, + 0xc1f7, 0xeefa, 0xc1f8, 0xeef8, 0xeef7, 0xf177, 0xf176, 0xc2fc, + 0xf178, 0xf37e, 0xc3fa, 0xf37d, 0xf37a, 0xc3f9, 0xf37b, 0xf37c, + 0xf548, 0xf549, 0xc4c5, 0xc553, 0xf66e, 0xc551, 0xc552, 0xf66f, + 0xc5b4, 0xc5b5, 0xf771, 0xc645, 0xf8cf, 0xc647, 0xf8ce, 0xf8d0, + 0xc646, 0xf957, 0xf9ad, 0xab43, 0xb974, 0xe4be, 0xe8b0, 0xc051, + 0xc052, 0xab44, 0xbe61, 0xc3fb, 0xadb1, 0xc053, 0xc5e2, 0xadb2, + 0xd84d, 0xdca9, 0xdcab, 0xdcaa, 0xe0dd, 0xe0da, 0xb975, 0xb976, + 0xe0db, 0xe0dc, 0xe4c0, 0xe4c5, 0xbbde, 0xe4bf, 0xe4c1, 0xe4c8, + 0xe4c3, 0xe4c7, 0xe4c4, 0xe4c2, 0xe4c6, 0xbbdf, 0xe8b3, 0xe8b1, + 0xbe63, 0xbe62, 0xe8b2, 0xbe64, 0xec56, 0xec55, 0xc054, 0xec54, + 0xeefc, 0xeefe, 0xef41, 0xef40, 0xc1f9, 0xeefd, 0xf1a1, 0xc2fd, + 0xf17d, 0xf1a2, 0xc2fe, 0xf17b, 0xf17e, 0xf17c, 0xf179, 0xc340, + 0xf17a, 0xf3a1, 0xf3a3, 0xf3a2, 0xf54a, 0xf54b, 0xf670, 0xc5b7, + 0xc5b6, 0xf84f, 0xf850, 0xc648, 0xf8d1, 0xc669, 0xadb3, 0xb6b4, + 0xe4ca, 0xe4c9, 0xe8b5, 0xe8b4, 0xc1fa, 0xef43, 0xef42, 0xf1a5, + 0xf1a3, 0xf1a6, 0xf1a4, 0xc3fc, 0xf3a4, 0xf3a5, 0xf3a6, 0xf671, + 0xf772, 0xf8d2, 0xadb4, 0xec57, 0xef44, 0xadb5, 0xbbe0, 0xec58, + 0xc341, 0xf1a7, 0xc3fd, 0xf54c, 0xf54d, 0xc554, 0xf851, 0xadb6, + 0xb3bb, 0xb3bc, 0xd84e, 0xb6b5, 0xb6b6, 0xdcac, 0xb6b7, 0xb97a, + 0xb97c, 0xe0df, 0xe0e0, 0xe0de, 0xb977, 0xb978, 0xb97b, 0xb979, + 0xe4cb, 0xbbe1, 0xbbe2, 0xe8bc, 0xbe67, 0xe8b7, 0xe8b6, 0xe8bb, + 0xbe65, 0xc05b, 0xe8b8, 0xe8bd, 0xe8ba, 0xe8b9, 0xbe66, 0xc059, + 0xec5a, 0xc055, 0xec5b, 0xec59, 0xc058, 0xc056, 0xc05a, 0xc057, + 0xef45, 0xef4a, 0xef46, 0xef49, 0xc1fb, 0xedd4, 0xef48, 0xef47, + 0xc344, 0xc342, 0xc345, 0xc343, 0xf1a8, 0xf1a9, 0xf1aa, 0xc346, + 0xf3aa, 0xc440, 0xf3a8, 0xc441, 0xf3a7, 0xf3a9, 0xc3fe, 0xf551, + 0xf54e, 0xf54f, 0xf550, 0xf672, 0xc556, 0xc555, 0xf774, 0xf773, + 0xc5b8, 0xc5e3, 0xc649, 0xc660, 0xf958, 0xf9ae, 0xf9af, 0xadb7, + 0xdcad, 0xe0e1, 0xe4cc, 0xe4cd, 0xbbe3, 0xbbe4, 0xe8be, 0xbe68, + 0xc1fc, 0xf1ab, 0xc347, 0xf3ad, 0xc442, 0xf3ac, 0xf3ae, 0xf3ab, + 0xf675, 0xf552, 0xf553, 0xc4c6, 0xf674, 0xf673, 0xf775, 0xf9b0, + 0xadb8, 0xadb9, 0xb0a7, 0xd448, 0xd84f, 0xb6b8, 0xb6bb, 0xb6b9, + 0xdcae, 0xb6bd, 0xb6ba, 0xb6bc, 0xb97e, 0xe0e2, 0xe0e3, 0xe8c0, + 0xb97d, 0xb9a1, 0xb9a2, 0xe4cf, 0xe4ce, 0xbbe5, 0xbbe6, 0xe4d0, + 0xe8bf, 0xbbe8, 0xbe69, 0xbbe7, 0xc05c, 0xe8c1, 0xbe6b, 0xbe6a, + 0xe8c2, 0xe8c5, 0xe8c3, 0xe8c4, 0xbe6c, 0xc061, 0xc05f, 0xc05e, + 0xec5d, 0xc060, 0xec5c, 0xef4b, 0xec5e, 0xc05d, 0xec5f, 0xef4e, + 0xef4c, 0xef4d, 0xef52, 0xc34b, 0xef51, 0xef54, 0xef53, 0xef50, + 0xef4f, 0xc1fd, 0xf1ae, 0xf1ad, 0xc34a, 0xc348, 0xc349, 0xf1ac, + 0xf3b1, 0xc443, 0xf3b0, 0xf3af, 0xc444, 0xf558, 0xf557, 0xf555, + 0xf554, 0xc4c8, 0xc4c7, 0xf559, 0xf776, 0xc5b9, 0xf677, 0xc557, + 0xf676, 0xf556, 0xf777, 0xc5e4, 0xc661, 0xf959, 0xf9b1, 0xadba, + 0xd850, 0xef55, 0xadbb, 0xe4d2, 0xe4d1, 0xec60, 0xef57, 0xef56, + 0xc34c, 0xf3b2, 0xf3b3, 0xc4c9, 0xf9b2, 0xb0a8, 0xb6bf, 0xb6be, + 0xe0e4, 0xe0e6, 0xb9a4, 0xe0e5, 0xb9a3, 0xb9a5, 0xe0e7, 0xe4d4, + 0xe4d6, 0xe4d5, 0xe4d8, 0xbbe9, 0xe4d7, 0xe4d3, 0xe4d9, 0xe8cc, + 0xe8cf, 0xe8d1, 0xe8c7, 0xe8cb, 0xe8c8, 0xbe6e, 0xbe71, 0xbe73, + 0xe8c9, 0xe8ca, 0xbe72, 0xe8cd, 0xe8d0, 0xe8ce, 0xbe74, 0xbe70, + 0xe8c6, 0xbe6d, 0xbe6f, 0xc063, 0xec66, 0xec64, 0xec63, 0xec69, + 0xec68, 0xec67, 0xec62, 0xc062, 0xec61, 0xec65, 0xc064, 0xef5a, + 0xef5e, 0xef5b, 0xef5d, 0xef5c, 0xef59, 0xef5f, 0xef62, 0xef60, + 0xef61, 0xc240, 0xc1fe, 0xef58, 0xef63, 0xf1b3, 0xf1b6, 0xf1b8, + 0xf1b7, 0xf1b1, 0xf1b5, 0xf1b0, 0xf1b2, 0xc34d, 0xf1af, 0xf1b4, + 0xf3c0, 0xf3b5, 0xc445, 0xc446, 0xf3b4, 0xf3b9, 0xf3bf, 0xf3b7, + 0xf3be, 0xf3bb, 0xf3ba, 0xf3bd, 0xf3b8, 0xf3b6, 0xf3bc, 0xf560, + 0xf55e, 0xc4ca, 0xf55d, 0xf563, 0xf561, 0xc4cb, 0xf55c, 0xf55a, + 0xf55b, 0xc4cd, 0xf55f, 0xc4cc, 0xf562, 0xf678, 0xf67e, 0xf679, + 0xc55b, 0xf6a1, 0xc55a, 0xf67d, 0xf67c, 0xc559, 0xf67b, 0xc558, + 0xf67a, 0xf77d, 0xf7a1, 0xf77e, 0xf77b, 0xc5bb, 0xf778, 0xf77c, + 0xf7a3, 0xf7a2, 0xf779, 0xf77a, 0xc5ba, 0xf852, 0xc5e7, 0xf853, + 0xc5e5, 0xc5e6, 0xf8d3, 0xc64a, 0xf976, 0xc66a, 0xf9b3, 0xc66b, + 0xf9b4, 0xf9b5, 0xf9c3, 0xf9c2, 0xc67a, 0xf9cd, 0xb0a9, 0xe0e9, + 0xe0e8, 0xbbea, 0xbbeb, 0xe4da, 0xe8d2, 0xec6c, 0xbe75, 0xc065, + 0xec6a, 0xec6d, 0xc066, 0xef64, 0xec6b, 0xf1b9, 0xc34e, 0xf3c1, + 0xf566, 0xf564, 0xf565, 0xf6a2, 0xc55c, 0xf7a4, 0xc5ea, 0xc5bc, + 0xc5e8, 0xc5e9, 0xf8d4, 0xc662, 0xb0aa, 0xf1ba, 0xd449, 0xb9a6, + 0xe4db, 0xbbec, 0xe4dc, 0xe8d4, 0xe8d3, 0xc068, 0xbe76, 0xbe77, + 0xe8d7, 0xe8d6, 0xe8d5, 0xec6e, 0xec71, 0xec70, 0xec6f, 0xc067, + 0xef68, 0xef66, 0xef65, 0xef67, 0xc34f, 0xf1bc, 0xf1bd, 0xc350, + 0xf1bb, 0xf3c3, 0xf3c2, 0xf3c5, 0xc447, 0xf3c4, 0xf567, 0xf569, + 0xf568, 0xf6a3, 0xf6a6, 0xf6a4, 0xf6a5, 0xf7a5, 0xc5bd, 0xf854, + 0xf855, 0xf856, 0xc64b, 0xc663, 0xf9b6, 0xb0ab, 0xbe78, 0xc069, + 0xf1be, 0xf7a6, 0xf9c4, 0xd44a, 0xc67b, 0xb0ac, 0xec72, 0xf1bf, + 0xf3c6, 0xf6a7, 0xf7a7, 0xb0ad, 0xe4dd, 0xe4de, 0xbbed, 0xbbee, + 0xe8d9, 0xbe7a, 0xbe79, 0xe8d8, 0xef69, 0xf1c0, 0xf1c2, 0xf1c1, + 0xc353, 0xc352, 0xc351, 0xc55e, 0xf6a8, 0xc55d, 0xf7a9, 0xf7a8, + 0xc64c, 0xf8d5, 0xb3bd, 0xe0ea, 0xe4e1, 0xe4df, 0xe4e0, 0xe8e2, + 0xe8dd, 0xe8da, 0xe8e1, 0xe8e3, 0xbe7c, 0xe8e0, 0xe8dc, 0xe8db, + 0xe8df, 0xe8de, 0xbe7b, 0xec7d, 0xec78, 0xec76, 0xeca1, 0xec77, + 0xec73, 0xec79, 0xec74, 0xef72, 0xec75, 0xeca2, 0xec7c, 0xc06a, + 0xec7b, 0xec7a, 0xec7e, 0xef6a, 0xef6d, 0xef6c, 0xef74, 0xef6f, + 0xef73, 0xef71, 0xef70, 0xef6e, 0xef6b, 0xc243, 0xc242, 0xc244, + 0xc241, 0xef75, 0xf1c8, 0xf1cb, 0xf1c9, 0xf1cd, 0xf1ce, 0xf1c6, + 0xc358, 0xf1c7, 0xf1c5, 0xf1cc, 0xf1c4, 0xf1c3, 0xc357, 0xc355, + 0xc354, 0xf1ca, 0xf3cf, 0xf3d5, 0xc44a, 0xf3d0, 0xf3d3, 0xf3d7, + 0xc44b, 0xf3d2, 0xf3ca, 0xf3c9, 0xf3d6, 0xf3cd, 0xf3cb, 0xf3d4, + 0xf3cc, 0xc449, 0xc448, 0xf3c7, 0xf3c8, 0xf3d1, 0xf3ce, 0xf56c, + 0xf56f, 0xc356, 0xf56d, 0xf573, 0xf571, 0xf56b, 0xf576, 0xf56a, + 0xc4cf, 0xf572, 0xf56e, 0xc4ce, 0xf575, 0xf574, 0xf6ab, 0xf6aa, + 0xf6b1, 0xf6ad, 0xf6b0, 0xc560, 0xf6ae, 0xf6af, 0xf6a9, 0xf6ac, + 0xc55f, 0xc5bf, 0xf7b4, 0xf7af, 0xf7b3, 0xf7b6, 0xf7b2, 0xf7ae, + 0xc5c1, 0xf7b1, 0xf7b5, 0xc5c0, 0xf7ac, 0xf570, 0xf7b0, 0xf7ad, + 0xf7aa, 0xf7ab, 0xc5be, 0xf85a, 0xf85c, 0xf85f, 0xf85b, 0xf860, + 0xf859, 0xf857, 0xc5eb, 0xf85d, 0xc5ed, 0xc5ec, 0xf858, 0xf85e, + 0xf8da, 0xc64d, 0xf8db, 0xf8d9, 0xf8d6, 0xf8d8, 0xf8d7, 0xf95a, + 0xf95c, 0xf95b, 0xf979, 0xf978, 0xf977, 0xf97a, 0xc673, 0xc674, + 0xf9ca, 0xf9ce, 0xb3be, 0xdcaf, 0xe0ed, 0xb9a7, 0xe0eb, 0xe0ec, + 0xe4e2, 0xe4e3, 0xbbf1, 0xbbef, 0xe4e4, 0xbbf0, 0xe8e8, 0xe8eb, + 0xe8e5, 0xe8ec, 0xe8e4, 0xe8e6, 0xe8e7, 0xe8ea, 0xbea1, 0xe8ef, + 0xe8ee, 0xbe7d, 0xe8e9, 0xe8ed, 0xbe7e, 0xecac, 0xc06f, 0xeca7, + 0xc06b, 0xeca4, 0xecaa, 0xecad, 0xc070, 0xeca9, 0xeca6, 0xecae, + 0xeca5, 0xecab, 0xc06c, 0xeca3, 0xc06d, 0xc06e, 0xeca8, 0xefa9, + 0xef7a, 0xef7b, 0xef7e, 0xef7c, 0xef76, 0xef79, 0xefa5, 0xef7d, + 0xc245, 0xefa7, 0xefa4, 0xc246, 0xefa6, 0xef77, 0xefa2, 0xefa3, + 0xefa1, 0xf1d2, 0xf1d4, 0xf1d7, 0xf1d1, 0xc359, 0xf1d9, 0xf1d0, + 0xf1da, 0xf1d6, 0xf1d8, 0xf1dc, 0xf1d5, 0xf1dd, 0xf1d3, 0xf1cf, + 0xc35a, 0xf1db, 0xc35b, 0xc44d, 0xef78, 0xf3f1, 0xf3e8, 0xc44f, + 0xf3e4, 0xc450, 0xf3ed, 0xf3e7, 0xf3dd, 0xc44e, 0xf3ea, 0xf3e5, + 0xf3e6, 0xf3d8, 0xf3df, 0xf3ee, 0xf3eb, 0xf3e3, 0xf3ef, 0xf3de, + 0xf3d9, 0xf3ec, 0xf3db, 0xf3e9, 0xf3e0, 0xf3f0, 0xf3dc, 0xc44c, + 0xf3da, 0xf3e1, 0xf3e2, 0xf57d, 0xf57b, 0xf5a2, 0xf5ae, 0xf5a5, + 0xf57c, 0xf578, 0xf5a7, 0xf57e, 0xf5a3, 0xf57a, 0xf5aa, 0xf577, + 0xf5a1, 0xf5a6, 0xf5a8, 0xf5ab, 0xf579, 0xf5af, 0xf5b0, 0xf5a9, + 0xf5ad, 0xf5a4, 0xf6c1, 0xf6c4, 0xc561, 0xf6c3, 0xf6c8, 0xf6c6, + 0xc562, 0xf6bd, 0xf6b3, 0xf6b2, 0xc564, 0xf6bf, 0xf6c0, 0xf6bc, + 0xf6b4, 0xf6b9, 0xf5ac, 0xf6b5, 0xc563, 0xf6bb, 0xf6ba, 0xf6b6, + 0xf6c2, 0xf6b7, 0xf7bb, 0xf6c5, 0xf6c7, 0xf6be, 0xf6b8, 0xf7bc, + 0xf7be, 0xf7b8, 0xc5c2, 0xf7c5, 0xf7c3, 0xc5c3, 0xf7c2, 0xf7c1, + 0xf7ba, 0xf7b7, 0xf7bd, 0xf7c6, 0xf7b9, 0xf7bf, 0xf869, 0xf86e, + 0xf864, 0xf867, 0xc5ee, 0xf86b, 0xf872, 0xf7c0, 0xf865, 0xf86f, + 0xf873, 0xf86a, 0xf863, 0xf86d, 0xf86c, 0xf871, 0xf870, 0xf7c4, + 0xf868, 0xf862, 0xf866, 0xc64e, 0xc64f, 0xf861, 0xf8e6, 0xf8dd, + 0xf8e5, 0xf8e2, 0xf8e3, 0xf8dc, 0xf8df, 0xf8e7, 0xf8e1, 0xf8e0, + 0xf8de, 0xf8e4, 0xf95d, 0xf95e, 0xf960, 0xf95f, 0xf962, 0xf961, + 0xf97c, 0xf97b, 0xf9b7, 0xf9b8, 0xf9c5, 0xc678, 0xc67c, 0xf9cf, + 0xc67d, 0xb3bf, 0xc4d0, 0xf6c9, 0xc650, 0xc651, 0xb3c0, 0xe0ee, + 0xb9a8, 0xe8f0, 0xecb0, 0xecb1, 0xecaf, 0xefab, 0xefaa, 0xc247, + 0xf1df, 0xefac, 0xf1de, 0xf3f3, 0xc451, 0xc453, 0xf3f2, 0xc452, + 0xf5b1, 0xf5b3, 0xf5b2, 0xf6ca, 0xc565, 0xc5ef, 0xf8e8, 0xf963, + 0xf9d2, 0xb3c1, 0xe4e5, 0xbea2, 0xecb3, 0xecb2, 0xefad, 0xc454, + 0xc4d1, 0xf7c7, 0xf9cb, 0xb3c2, 0xbbf2, 0xbea3, 0xf3f4, 0xf874, + 0xb6c0, 0xefae, 0xc664, 0xb6c1, 0xbea4, 0xc248, 0xf875, 0xb6c2, + 0xe8f1, 0xc072, 0xecb4, 0xecb5, 0xc071, 0xefaf, 0xc24c, 0xc24a, + 0xc24b, 0xc249, 0xf1e0, 0xc35c, 0xf5b5, 0xf5b4, 0xf5b7, 0xf5b6, + 0xc4d2, 0xf6cb, 0xf6cd, 0xf6cc, 0xc566, 0xf7c8, 0xf876, 0xf877, + 0xc5f0, 0xf964, 0xf97d, 0xc675, 0xdcb0, 0xecb6, 0xefb0, 0xf3f5, + 0xe0ef, 0xefb1, 0xf1e2, 0xf1e1, 0xf878, 0xc652, 0xf965, 0xf97e, + 0xb9a9, 0xe8f2, 0xe8f3, 0xecb7, 0xb9aa, 0xc35d, 0xf1e3, 0xf6cf, + 0xc567, 0xf6d0, 0xf6ce, 0xf879, 0xf8e9, 0xb9ab, 0xefb4, 0xefb3, + 0xefb2, 0xf1e4, 0xf1e8, 0xf1e7, 0xf1e6, 0xf1e5, 0xc35e, 0xf3f6, + 0xf5b9, 0xc4d3, 0xf5b8, 0xf6d1, 0xf7cb, 0xf7ca, 0xc5c4, 0xf7c9, + 0xf87c, 0xf87b, 0xf87a, 0xbbf3, 0xecb8, 0xc24d, 0xf3f7, 0xf3f8, + 0xf7cc, 0xf87d, 0xf8ea, 0xf966, 0xf9b9, 0xf9d4, 0xbbf4, 0xc24e, + 0xf1e9, 0xf3f9, 0xf6d2, 0xf87e, 0xbea6, 0xefb5, 0xf1ea, 0xf3fa, + 0xf3fb, 0xf3fc, 0xf5be, 0xf5ba, 0xc568, 0xf5bd, 0xf5bc, 0xc4d4, + 0xf5bb, 0xc4d6, 0xc4d5, 0xf6d4, 0xf6d3, 0xc569, 0xc56a, 0xc5c6, + 0xf7cd, 0xc5c5, 0xf8a3, 0xf8a4, 0xf8a2, 0xf8a1, 0xc654, 0xf8eb, + 0xf8ec, 0xf8ed, 0xc653, 0xf967, 0xf96a, 0xf969, 0xf968, 0xf9d3, + 0xc073, 0xc365, 0xf5bf, 0xf6d5, 0xc5c7, 0xf7ce, 0xf9d5, 0xc074, + 0xefb6, 0xf7cf, 0xf9a1, 0xc94a, 0xddfc, 0xa14a, 0xa157, 0xa159, + 0xa15b, 0xa15f, 0xa160, 0xa163, 0xa164, 0xa167, 0xa168, 0xa16b, + 0xa16c, 0xa16f, 0xa170, 0xa173, 0xa174, 0xa177, 0xa178, 0xa17b, + 0xa17c, 0xa1c6, 0xa1c7, 0xa1ca, 0xa1cb, 0xa1c8, 0xa1c9, 0xa15c, + 0xa14d, 0xa14f, 0xa151, 0xa152, 0xa153, 0xa154, 0xa17d, 0xa17e, + 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, 0xa1cc, 0xa1cd, 0xa1ce, 0xa1de, + 0xa1df, 0xa1e0, 0xa1e1, 0xa1e2, 0xa24c, 0xa24d, 0xa24e, 0xa149, + 0xa1ad, 0xa243, 0xa248, 0xa1ae, 0xa15d, 0xa15e, 0xa1af, 0xa1cf, + 0xa141, 0xa1d0, 0xa144, 0xa241, 0xa2af, 0xa2b0, 0xa2b1, 0xa2b2, + 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, 0xa147, 0xa146, + 0xa1d5, 0xa1d7, 0xa1d6, 0xa148, 0xa249, 0xa2cf, 0xa2d0, 0xa2d1, + 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, 0xa2d9, + 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, 0xa2e1, + 0xa2e2, 0xa2e3, 0xa2e4, 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xa242, + 0xa1c4, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, 0xa2ed, 0xa2ee, 0xa2ef, + 0xa2f0, 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, + 0xa2f8, 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0xa2fd, 0xa2fe, 0xa340, + 0xa341, 0xa342, 0xa343, 0xa161, 0xa155, 0xa162, 0xa14e, +}; + +static const Summary16 big5_uni2indx_page00[16] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x00ac }, { 4, 0x0083 }, + { 7, 0x0000 }, { 7, 0x0080 }, { 8, 0x0000 }, { 8, 0x0080 }, +}; +static const Summary16 big5_uni2indx_page02[38] = { + /* 0x0200 */ + { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, + { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, + { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, { 9, 0x0000 }, + { 9, 0x0e80 }, { 13, 0x0200 }, { 14, 0x0000 }, { 14, 0x0000 }, + /* 0x0300 */ + { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, + { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, { 14, 0x0000 }, + { 14, 0x0000 }, { 14, 0xfffe }, { 29, 0x03fb }, { 38, 0xfffe }, + { 53, 0x03fb }, { 62, 0x0000 }, { 62, 0x0000 }, { 62, 0x0000 }, + /* 0x0400 */ + { 62, 0x0002 }, { 63, 0x1ff0 }, { 72, 0xfff8 }, { 85, 0xffff }, + { 101, 0xffff }, { 117, 0x0002 }, +}; +static const Summary16 big5_uni2indx_page20[44] = { + /* 0x2000 */ + { 118, 0x0000 }, { 118, 0x3318 }, { 124, 0x0064 }, { 127, 0x4824 }, + { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, + { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, + { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, { 131, 0x0000 }, + /* 0x2100 */ + { 131, 0x0228 }, { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x0000 }, + { 134, 0x0000 }, { 134, 0x0000 }, { 134, 0x03ff }, { 144, 0x0000 }, + { 144, 0x0000 }, { 144, 0x03cf }, { 152, 0x0000 }, { 152, 0x0000 }, + { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, { 152, 0x0000 }, + /* 0x2200 */ + { 152, 0x0000 }, { 152, 0xc400 }, { 155, 0x4e29 }, { 162, 0x1030 }, + { 165, 0x0000 }, { 165, 0x0004 }, { 166, 0x00c3 }, { 170, 0x0000 }, + { 170, 0x0000 }, { 170, 0x0000 }, { 170, 0x0020 }, { 171, 0x8000 }, +}; +static const Summary16 big5_uni2indx_page24[37] = { + /* 0x2400 */ + { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x0000 }, + { 172, 0x0000 }, { 172, 0x0000 }, { 172, 0x03ff }, { 182, 0x3ff0 }, + { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, + { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, + /* 0x2500 */ + { 192, 0x1005 }, { 195, 0x1111 }, { 199, 0x1010 }, { 201, 0x1010 }, + { 203, 0x0000 }, { 203, 0x4001 }, { 205, 0xe402 }, { 210, 0x000f }, + { 214, 0xfffe }, { 229, 0x0030 }, { 231, 0x0003 }, { 233, 0x300c }, + { 237, 0xc8c0 }, { 242, 0x0000 }, { 242, 0x003c }, { 246, 0x0000 }, + /* 0x2600 */ + { 246, 0x0260 }, { 249, 0x0000 }, { 249, 0x0000 }, { 249, 0x0000 }, + { 249, 0x0007 }, +}; +static const Summary16 big5_uni2indx_page30[62] = { + /* 0x3000 */ + { 252, 0xff2f }, { 265, 0x6037 }, { 272, 0x03fe }, { 281, 0x0000 }, + { 281, 0xfffe }, { 296, 0xffff }, { 312, 0xffff }, { 328, 0xffff }, + { 344, 0xffff }, { 360, 0x600f }, { 366, 0xfffe }, { 381, 0xffff }, + { 397, 0xffff }, { 413, 0xffff }, { 429, 0xffff }, { 445, 0x407f }, + /* 0x3100 */ + { 453, 0xffe0 }, { 464, 0xffff }, { 480, 0x03ff }, { 490, 0x0000 }, + { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, + { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, + { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, + /* 0x3200 */ + { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, + { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0000 }, + { 490, 0x0000 }, { 490, 0x0000 }, { 490, 0x0008 }, { 491, 0x0000 }, + { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, + /* 0x3300 */ + { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, + { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, { 491, 0x0000 }, + { 491, 0xc000 }, { 493, 0x7000 }, { 496, 0x0002 }, { 497, 0x0000 }, + { 497, 0x4010 }, { 499, 0x0026 }, +}; +static const Summary16 big5_uni2indx_page4e[1307] = { + /* 0x4e00 */ + { 502, 0xff8b }, { 514, 0xc373 }, { 523, 0x6840 }, { 527, 0x1b0f }, + { 535, 0xe9ac }, { 544, 0xf34c }, { 553, 0x0200 }, { 554, 0xc008 }, + { 557, 0x795c }, { 566, 0xca3e }, { 575, 0x7976 }, { 585, 0x0648 }, + { 589, 0x2fdf }, { 601, 0xf7f0 }, { 612, 0x033a }, { 618, 0xa8ff }, + /* 0x4f00 */ + { 629, 0xef37 }, { 641, 0x233f }, { 650, 0xb004 }, { 654, 0xfd59 }, + { 665, 0xf3ca }, { 675, 0xffff }, { 691, 0xde9f }, { 703, 0xfff9 }, + { 717, 0xabff }, { 730, 0x7df7 }, { 743, 0xc000 }, { 745, 0x8eec }, + { 754, 0xeebf }, { 767, 0xffdb }, { 781, 0xd003 }, { 786, 0x45fa }, + /* 0x5000 */ + { 795, 0xfae1 }, { 805, 0xdffe }, { 819, 0xbfef }, { 833, 0x10ab }, + { 839, 0xffeb }, { 853, 0xfcaa }, { 863, 0xef3f }, { 876, 0x24fd }, + { 885, 0x78ad }, { 894, 0x7f76 }, { 906, 0xf00c }, { 912, 0xedff }, + { 926, 0xcff6 }, { 938, 0x2cfa }, { 947, 0xf7f9 }, { 960, 0xeb6b }, + /* 0x5100 */ + { 971, 0x1ffd }, { 983, 0x95bf }, { 994, 0x6677 }, { 1004, 0xbfbf }, + { 1018, 0x3bfb }, { 1030, 0xfeb4 }, { 1041, 0x7bae }, { 1052, 0x11e2 }, + { 1058, 0xa681 }, { 1064, 0x41be }, { 1072, 0x1435 }, { 1078, 0x72c3 }, + { 1086, 0x7d70 }, { 1095, 0x7191 }, { 1102, 0x0003 }, { 1104, 0x276b }, + /* 0x5200 */ + { 1113, 0x57cb }, { 1123, 0x70cf }, { 1132, 0x4732 }, { 1139, 0x0def }, + { 1149, 0x7eda }, { 1160, 0xfc74 }, { 1170, 0xfe06 }, { 1179, 0xbdb4 }, + { 1189, 0x3f9f }, { 1201, 0x8bca }, { 1209, 0x7e49 }, { 1218, 0x5800 }, + { 1221, 0x228f }, { 1228, 0xebec }, { 1239, 0x8a5c }, { 1246, 0xddbb }, + /* 0x5300 */ + { 1258, 0xef60 }, { 1267, 0xb6e7 }, { 1278, 0xa40f }, { 1285, 0xf293 }, + { 1294, 0x37bb }, { 1305, 0x549e }, { 1313, 0xd04b }, { 1320, 0x9baf }, + { 1331, 0xc414 }, { 1336, 0xf7d4 }, { 1347, 0x30b0 }, { 1352, 0x0a14 }, + { 1356, 0x2f08 }, { 1362, 0x88d0 }, { 1367, 0xff7e }, { 1381, 0x192f }, + /* 0x5400 */ + { 1389, 0xffda }, { 1402, 0xfb07 }, { 1412, 0x7ff1 }, { 1424, 0x7beb }, + { 1436, 0xc5ef }, { 1447, 0x0010 }, { 1448, 0x99ff }, { 1460, 0xfdff }, + { 1475, 0x79d7 }, { 1486, 0x0567 }, { 1493, 0xffe7 }, { 1507, 0xfdcb }, + { 1519, 0xc3ff }, { 1531, 0x4040 }, { 1533, 0x6ff7 }, { 1546, 0xbd8e }, + /* 0x5500 */ + { 1556, 0xdffa }, { 1569, 0x0497 }, { 1575, 0xf4c0 }, { 1582, 0x5bff }, + { 1595, 0xed7b }, { 1607, 0xd0e7 }, { 1616, 0x047e }, { 1623, 0xf8e0 }, + { 1631, 0xff9f }, { 1645, 0xb73e }, { 1656, 0x7dfe }, { 1669, 0x882e }, + { 1675, 0xfffd }, { 1690, 0xbe7f }, { 1703, 0x83fe }, { 1713, 0xf6c4 }, + /* 0x5600 */ + { 1722, 0xf357 }, { 1733, 0xb8fd }, { 1744, 0xd680 }, { 1750, 0xef7d }, + { 1763, 0x5767 }, { 1773, 0x4788 }, { 1779, 0xff7d }, { 1793, 0xc3df }, + { 1804, 0xf0ff }, { 1816, 0x37a9 }, { 1825, 0x7de0 }, { 1834, 0x70fc }, + { 1843, 0x3f6f }, { 1855, 0xec9a }, { 1864, 0x4cb3 }, { 1872, 0x8681 }, + /* 0x5700 */ + { 1877, 0x3f9e }, { 1888, 0xdd5c }, { 1898, 0xf70d }, { 1908, 0x4819 }, + { 1913, 0xfea3 }, { 1924, 0x0007 }, { 1927, 0xaf56 }, { 1937, 0x38ff }, + { 1948, 0x980d }, { 1954, 0xefb8 }, { 1965, 0x403d }, { 1971, 0xb760 }, + { 1979, 0xd8ce }, { 1988, 0x9035 }, { 1994, 0x72bf }, { 2005, 0x3fff }, + /* 0x5800 */ + { 2019, 0x7ff7 }, { 2033, 0x7a11 }, { 2040, 0xf7bb }, { 2053, 0xabff }, + { 2066, 0xff00 }, { 2074, 0x6fbe }, { 2086, 0xa93c }, { 2094, 0xfe72 }, + { 2105, 0xcfef }, { 2118, 0xf11b }, { 2127, 0xdb6b }, { 2138, 0xf40a }, + { 2145, 0xc3e6 }, { 2154, 0xef7e }, { 2167, 0x9b9c }, { 2176, 0xf610 }, + /* 0x5900 */ + { 2183, 0xf048 }, { 2189, 0x16f4 }, { 2197, 0xfeb5 }, { 2209, 0x5182 }, + { 2214, 0xc7b1 }, { 2223, 0x15bb }, { 2232, 0x6e87 }, { 2241, 0xfbdf }, + { 2255, 0xe43f }, { 2265, 0x63cd }, { 2274, 0xc1ff }, { 2285, 0x7e7e }, + { 2297, 0xfdeb }, { 2310, 0x7d5f }, { 2322, 0x777b }, { 2334, 0xfcfe }, + /* 0x5a00 */ + { 2347, 0x960b }, { 2354, 0xdbea }, { 2365, 0x6229 }, { 2371, 0x53e8 }, + { 2379, 0x37df }, { 2391, 0xfdef }, { 2405, 0x36f5 }, { 2415, 0xbd81 }, + { 2423, 0xdc18 }, { 2430, 0xfcbd }, { 2442, 0xd2e4 }, { 2450, 0xffff }, + { 2466, 0x3fd7 }, { 2478, 0xffe0 }, { 2489, 0x7f6f }, { 2502, 0xabf8 }, + /* 0x5b00 */ + { 2512, 0x9bae }, { 2522, 0x6ed9 }, { 2532, 0xf5fb }, { 2545, 0xf115 }, + { 2553, 0x79a9 }, { 2562, 0xbdfb }, { 2575, 0x5a3c }, { 2583, 0xadaf }, + { 2594, 0xdbba }, { 2605, 0x1fac }, { 2614, 0x71fc }, { 2624, 0x8379 }, + { 2632, 0x7cf7 }, { 2644, 0xc35f }, { 2654, 0xdfff }, { 2669, 0x0567 }, + /* 0x5c00 */ + { 2676, 0xff9a }, { 2688, 0x8467 }, { 2695, 0x1534 }, { 2701, 0xdf8b }, + { 2712, 0xf9f3 }, { 2724, 0x3373 }, { 2733, 0xf7bd }, { 2746, 0x5e1a }, + { 2754, 0xbf40 }, { 2762, 0xa03f }, { 2770, 0xffff }, { 2786, 0x01eb }, + { 2793, 0xdfc0 }, { 2802, 0xcfdd }, { 2814, 0x7500 }, { 2819, 0xabd3 }, + /* 0x5d00 */ + { 2829, 0xf8c3 }, { 2838, 0xeed6 }, { 2849, 0x43fd }, { 2859, 0xb7ff }, + { 2873, 0x5eaf }, { 2884, 0x4227 }, { 2890, 0x9bac }, { 2899, 0xf686 }, + { 2908, 0x27d7 }, { 2918, 0xf6bc }, { 2929, 0xf787 }, { 2940, 0x35b7 }, + { 2950, 0xaacd }, { 2959, 0xe176 }, { 2968, 0x49e7 }, { 2977, 0xe29f }, + /* 0x5e00 */ + { 2987, 0x545c }, { 2994, 0xaff2 }, { 3005, 0x2b3f }, { 3015, 0x61d8 }, + { 3022, 0xfc3b }, { 3033, 0xbbb8 }, { 3043, 0xffcf }, { 3057, 0x7b7d }, + { 3069, 0xbf95 }, { 3080, 0x1ce0 }, { 3086, 0x7dfd }, { 3099, 0x43ff }, + { 3110, 0x5ff6 }, { 3122, 0xfffe }, { 3137, 0xd3ef }, { 3149, 0xc4ce }, + /* 0x5f00 */ + { 3157, 0x8db6 }, { 3166, 0xadbc }, { 3176, 0x63dc }, { 3185, 0x11eb }, + { 3193, 0xdf59 }, { 3204, 0x23d0 }, { 3210, 0xbeb4 }, { 3220, 0xf3db }, + { 3232, 0x1fe7 }, { 3243, 0xdbc7 }, { 3254, 0xff63 }, { 3266, 0xfae4 }, + { 3276, 0xb22b }, { 3284, 0x63f7 }, { 3295, 0xed3b }, { 3306, 0xadba }, + /* 0x6000 */ + { 3316, 0xfe01 }, { 3324, 0x7eff }, { 3338, 0xfff7 }, { 3353, 0x02bc }, + { 3359, 0x32ff }, { 3370, 0xef39 }, { 3381, 0xfffc }, { 3395, 0x8005 }, + { 3398, 0x77fb }, { 3411, 0xbcf5 }, { 3422, 0x010d }, { 3426, 0xfff7 }, + { 3441, 0xfffb }, { 3456, 0xbf3a }, { 3467, 0x0057 }, { 3472, 0xdfff }, + /* 0x6100 */ + { 3487, 0xef7b }, { 3500, 0xbd7d }, { 3512, 0xdb88 }, { 3520, 0xc8d4 }, + { 3527, 0xfff3 }, { 3541, 0xed7c }, { 3552, 0x5dee }, { 3563, 0x56ff }, + { 3575, 0x7e0d }, { 3584, 0xac5f }, { 3594, 0xff96 }, { 3606, 0xd57f }, + { 3618, 0x3fee }, { 3630, 0xc140 }, { 3634, 0x6ff9 }, { 3646, 0xffe7 }, + /* 0x6200 */ + { 3660, 0x779b }, { 3671, 0x8e77 }, { 3681, 0x6ebf }, { 3693, 0xe45d }, + { 3702, 0x6fcf }, { 3714, 0x5f1f }, { 3725, 0xe07f }, { 3735, 0xfedf }, + { 3749, 0xd7db }, { 3761, 0x01fe }, { 3769, 0xff00 }, { 3777, 0xfb7b }, + { 3790, 0xffd4 }, { 3802, 0x1fdf }, { 3814, 0xf800 }, { 3819, 0xffff }, + /* 0x6300 */ + { 3835, 0xfb8f }, { 3847, 0x007b }, { 3853, 0xbf00 }, { 3860, 0x7f5c }, + { 3871, 0xffff }, { 3887, 0x07f3 }, { 3896, 0xeba0 }, { 3904, 0x3de7 }, + { 3915, 0xf7bf }, { 3929, 0xfbd7 }, { 3942, 0xffbf }, { 3957, 0x6003 }, + { 3961, 0xfffd }, { 3976, 0xbfed }, { 3989, 0xefbb }, { 4002, 0x027f }, + /* 0x6400 */ + { 4010, 0xfe40 }, { 4018, 0xddfd }, { 4031, 0xfdff }, { 4046, 0xe2f9 }, + { 4056, 0x680b }, { 4062, 0xfb1f }, { 4074, 0xfbe3 }, { 4086, 0xaffd }, + { 4099, 0x9fa4 }, { 4108, 0xf7ed }, { 4121, 0x7a7d }, { 4132, 0xf80f }, + { 4141, 0xeebe }, { 4153, 0x0fd5 }, { 4162, 0xbb5d }, { 4173, 0xfd9f }, + /* 0x6500 */ + { 4186, 0xf2db }, { 4197, 0x3bf9 }, { 4208, 0xfe7f }, { 4222, 0xebcc }, + { 4232, 0x876a }, { 4240, 0x73fa }, { 4251, 0x95fc }, { 4261, 0x9ffc }, + { 4273, 0x109f }, { 4280, 0xfaf7 }, { 4293, 0xddb7 }, { 4305, 0xbbcd }, + { 4316, 0xf87e }, { 4327, 0xeccd }, { 4337, 0xf366 }, { 4347, 0x3c3f }, + /* 0x6600 */ + { 4357, 0xfffd }, { 4372, 0xb03f }, { 4381, 0xe9f7 }, { 4393, 0x067e }, + { 4401, 0x96ae }, { 4410, 0xfe06 }, { 4419, 0xd576 }, { 4429, 0x5fd7 }, + { 4441, 0x3fd1 }, { 4451, 0xa3f3 }, { 4461, 0xcf07 }, { 4470, 0x6fb7 }, + { 4482, 0x9fd1 }, { 4492, 0x7f44 }, { 4501, 0x7b59 }, { 4511, 0xd3dd }, + /* 0x6700 */ + { 4522, 0xaf3b }, { 4533, 0xa9bd }, { 4543, 0x7dcf }, { 4555, 0xff3a }, + { 4567, 0xfbe0 }, { 4577, 0xf6eb }, { 4589, 0xb401 }, { 4594, 0xffff }, + { 4610, 0x7afa }, { 4621, 0xb7bf }, { 4634, 0xc000 }, { 4636, 0x0ffd }, + { 4647, 0xff7f }, { 4662, 0xff1f }, { 4675, 0xfefc }, { 4688, 0x95ff }, + /* 0x6800 */ + { 4700, 0x0000 }, { 4700, 0xb5dc }, { 4710, 0xef63 }, { 4721, 0x3f3e }, + { 4732, 0xfb7f }, { 4746, 0x001b }, { 4750, 0xe800 }, { 4754, 0xfbf6 }, + { 4767, 0x9eef }, { 4779, 0xb8df }, { 4790, 0xff9f }, { 4804, 0x003f }, + { 4810, 0x7bd0 }, { 4819, 0xf5ff }, { 4833, 0xdfdb }, { 4846, 0x3fff }, + /* 0x6900 */ + { 4860, 0xfdf0 }, { 4871, 0x00bf }, { 4878, 0x8420 }, { 4881, 0xbbbd }, + { 4893, 0xdf37 }, { 4905, 0xffde }, { 4919, 0xff6d }, { 4932, 0x0ff3 }, + { 4942, 0x604c }, { 4947, 0x5efb }, { 4959, 0xfffb }, { 4974, 0xfafb }, + { 4987, 0xfe5e }, { 4999, 0x0219 }, { 5003, 0x79f4 }, { 5013, 0xf9de }, + /* 0x6a00 */ + { 5025, 0xa7f7 }, { 5037, 0xebfa }, { 5049, 0x01eb }, { 5056, 0xff34 }, + { 5067, 0xebd3 }, { 5078, 0xef73 }, { 5090, 0xafd7 }, { 5102, 0xc040 }, + { 5105, 0x72bb }, { 5115, 0xdcff }, { 5128, 0xf17f }, { 5140, 0x2fd8 }, + { 5149, 0xb8ec }, { 5158, 0xfe0b }, { 5168, 0xdda3 }, { 5178, 0x1f0b }, + /* 0x6b00 */ + { 5186, 0x8f1d }, { 5195, 0x47cf }, { 5205, 0xb12b }, { 5213, 0xffde }, + { 5227, 0x7fee }, { 5240, 0xda73 }, { 5250, 0x24ff }, { 5260, 0xcbc4 }, + { 5268, 0xf75d }, { 5280, 0xcbf2 }, { 5290, 0xecfd }, { 5302, 0xb4ed }, + { 5312, 0xbff9 }, { 5325, 0x4ddd }, { 5335, 0x99dd }, { 5345, 0xfb8d }, + /* 0x6c00 */ + { 5356, 0xbb7f }, { 5369, 0xaf7b }, { 5381, 0xddfb }, { 5394, 0xc959 }, + { 5402, 0xfc4f }, { 5413, 0xfab5 }, { 5424, 0xafe3 }, { 5435, 0x6d5f }, + { 5446, 0xffff }, { 5462, 0x3f7d }, { 5474, 0x7800 }, { 5478, 0xffdb }, + { 5492, 0xb6ff }, { 5505, 0x7eff }, { 5519, 0xfbaf }, { 5532, 0x022f }, + /* 0x6d00 */ + { 5538, 0xff9b }, { 5551, 0xefc7 }, { 5563, 0xffa5 }, { 5575, 0xffff }, + { 5591, 0x0007 }, { 5594, 0xc700 }, { 5599, 0xf7ff }, { 5614, 0xfff1 }, + { 5627, 0x7ffd }, { 5641, 0x01bf }, { 5649, 0xdc00 }, { 5654, 0xfdbc }, + { 5666, 0xbff5 }, { 5679, 0xffff }, { 5695, 0xff7f }, { 5710, 0x3eff }, + /* 0x6e00 */ + { 5723, 0x0029 }, { 5726, 0xbe00 }, { 5732, 0xf9ff }, { 5746, 0xff7f }, + { 5761, 0x6efb }, { 5773, 0xfd7e }, { 5786, 0xcbff }, { 5799, 0x039e }, + { 5806, 0xe300 }, { 5811, 0xfbdd }, { 5824, 0xccff }, { 5836, 0xf6df }, + { 5849, 0xffff }, { 5865, 0x117f }, { 5874, 0xf800 }, { 5879, 0xfbf6 }, + /* 0x6f00 */ + { 5892, 0xe7ef }, { 5905, 0xd73c }, { 5915, 0xfeef }, { 5929, 0xdfef }, + { 5943, 0xc00b }, { 5948, 0xedbf }, { 5961, 0xfedf }, { 5975, 0xfdcd }, + { 5987, 0x7bf5 }, { 5999, 0x40fd }, { 6007, 0xffff }, { 6023, 0xb75f }, + { 6035, 0xffdf }, { 6050, 0xf930 }, { 6058, 0xfbdf }, { 6072, 0xdc97 }, + /* 0x7000 */ + { 6082, 0xfef3 }, { 6095, 0xbff2 }, { 6107, 0x8fdf }, { 6119, 0xdfbf }, + { 6133, 0x177f }, { 6144, 0xede6 }, { 6155, 0x0f7f }, { 6166, 0x3553 }, + { 6174, 0x447c }, { 6181, 0x877e }, { 6191, 0xfa12 }, { 6199, 0x45bb }, + { 6208, 0xede0 }, { 6217, 0x779e }, { 6228, 0x8017 }, { 6233, 0xbfd9 }, + /* 0x7100 */ + { 6245, 0x7e55 }, { 6255, 0xde89 }, { 6264, 0xc16f }, { 6273, 0x0447 }, + { 6278, 0x7ade }, { 6289, 0xf75d }, { 6301, 0x57ff }, { 6314, 0x2905 }, + { 6319, 0x86f7 }, { 6329, 0xfe95 }, { 6340, 0x97b3 }, { 6350, 0xf32f }, + { 6361, 0xcfff }, { 6375, 0x9f75 }, { 6386, 0x71f7 }, { 6397, 0xfb17 }, + /* 0x7200 */ + { 6408, 0x34ee }, { 6417, 0xee19 }, { 6426, 0x37cc }, { 6435, 0xef61 }, + { 6445, 0x9fd6 }, { 6456, 0xef4c }, { 6466, 0xd68f }, { 6476, 0xfbdd }, + { 6489, 0x7b73 }, { 6500, 0x6def }, { 6512, 0xd7fe }, { 6525, 0xa431 }, + { 6531, 0x5e7f }, { 6543, 0x97d7 }, { 6554, 0x0f5b }, { 6563, 0xffd8 }, + /* 0x7300 */ + { 6575, 0x9d83 }, { 6583, 0x7bce }, { 6594, 0x22ec }, { 6601, 0xdcff }, + { 6614, 0x763d }, { 6624, 0xef87 }, { 6635, 0xdfe7 }, { 6648, 0xfded }, + { 6661, 0x4fff }, { 6674, 0xa0fc }, { 6682, 0x3b77 }, { 6693, 0xdbfc }, + { 6705, 0x3ded }, { 6716, 0x7fdc }, { 6728, 0x6fa9 }, { 6738, 0xf570 }, + /* 0x7400 */ + { 6747, 0x3ffb }, { 6760, 0x2c40 }, { 6764, 0xff7f }, { 6779, 0x847f }, + { 6788, 0xec57 }, { 6798, 0xdeb7 }, { 6810, 0xe69c }, { 6819, 0xf22f }, + { 6829, 0x0feb }, { 6839, 0xd5b5 }, { 6849, 0xafeb }, { 6861, 0xede7 }, + { 6873, 0x8c2f }, { 6881, 0xfff0 }, { 6893, 0x537f }, { 6904, 0xe8f0 }, + /* 0x7500 */ + { 6912, 0xb99d }, { 6922, 0xb5ff }, { 6935, 0xff66 }, { 6947, 0xe78f }, + { 6958, 0xd981 }, { 6965, 0xbe10 }, { 6972, 0x9c7c }, { 6981, 0xe3c1 }, + { 6989, 0x9cd1 }, { 6997, 0x2733 }, { 7005, 0x0cbc }, { 7012, 0xff6d }, + { 7025, 0xfcb7 }, { 7037, 0xefb7 }, { 7050, 0xa0df }, { 7059, 0xffff }, + /* 0x7600 */ + { 7075, 0xbf0b }, { 7085, 0xfe7b }, { 7098, 0xa3ff }, { 7110, 0x353f }, + { 7120, 0x13cc }, { 7127, 0x97cd }, { 7137, 0x7637 }, { 7147, 0xfb27 }, + { 7158, 0xcfd6 }, { 7169, 0x7e6c }, { 7179, 0xec50 }, { 7186, 0xed31 }, + { 7195, 0x677c }, { 7205, 0xfc1c }, { 7214, 0xf6fa }, { 7226, 0x5fbf }, + /* 0x7700 */ + { 7239, 0x0fba }, { 7248, 0xae2f }, { 7258, 0xa3ad }, { 7267, 0x7ffe }, + { 7281, 0xfcf0 }, { 7291, 0xde74 }, { 7301, 0xffef }, { 7316, 0xf200 }, + { 7321, 0xfbbf }, { 7335, 0xfea2 }, { 7345, 0x3daf }, { 7356, 0xbcff }, + { 7369, 0xf694 }, { 7378, 0x5fb9 }, { 7389, 0xf3ad }, { 7400, 0x3f8f }, + /* 0x7800 */ + { 7411, 0xf26c }, { 7420, 0xa01f }, { 7427, 0xffef }, { 7442, 0x01bf }, + { 7450, 0x7728 }, { 7458, 0x7005 }, { 7463, 0xff35 }, { 7475, 0xda03 }, + { 7482, 0xd2f9 }, { 7492, 0xc7fa }, { 7503, 0x3fbf }, { 7516, 0x5c1d }, + { 7524, 0xff3a }, { 7536, 0xec33 }, { 7545, 0xb7af }, { 7557, 0xfe9c }, + /* 0x7900 */ + { 7568, 0x5236 }, { 7575, 0x7a9f }, { 7586, 0xbffa }, { 7599, 0xe722 }, + { 7607, 0x9ff7 }, { 7620, 0xfcff }, { 7634, 0x2fbb }, { 7645, 0xb61d }, + { 7654, 0xed06 }, { 7662, 0x1dfd }, { 7673, 0x7dd7 }, { 7685, 0xefdf }, + { 7699, 0xeb23 }, { 7708, 0xf166 }, { 7717, 0x7ed9 }, { 7728, 0x0dc0 }, + /* 0x7a00 */ + { 7733, 0x3d3d }, { 7743, 0xdfbf }, { 7757, 0xc945 }, { 7764, 0xba83 }, + { 7772, 0x7dd1 }, { 7782, 0x9dd0 }, { 7790, 0x7b87 }, { 7800, 0xcf73 }, + { 7811, 0x9ff3 }, { 7823, 0xc3f5 }, { 7833, 0xdf0d }, { 7843, 0xc5fe }, + { 7854, 0x0cb3 }, { 7861, 0x8302 }, { 7865, 0xe879 }, { 7874, 0xaec0 }, + /* 0x7b00 */ + { 7881, 0xc773 }, { 7891, 0x6f0f }, { 7901, 0xfd7d }, { 7914, 0x093f }, + { 7922, 0xfff1 }, { 7935, 0x0157 }, { 7941, 0x62fb }, { 7951, 0x01ff }, + { 7960, 0xfdb4 }, { 7971, 0x3bf3 }, { 7982, 0xb013 }, { 7988, 0x43b2 }, + { 7995, 0x5ed3 }, { 8005, 0xff30 }, { 8015, 0x0fff }, { 8027, 0xeb9f }, + /* 0x7c00 */ + { 8039, 0xfeef }, { 8053, 0xf203 }, { 8060, 0x3fef }, { 8073, 0xfb89 }, + { 8083, 0x37a9 }, { 8092, 0x9e99 }, { 8101, 0xdef9 }, { 8113, 0xa72c }, + { 8121, 0x3733 }, { 8130, 0xc1f6 }, { 8139, 0x812e }, { 8145, 0xfe3e }, + { 8157, 0x5d20 }, { 8163, 0xf2f7 }, { 8175, 0xd585 }, { 8183, 0x69d7 }, + /* 0x7d00 */ + { 8193, 0xffff }, { 8209, 0xffff }, { 8225, 0xdb07 }, { 8234, 0xff6f }, + { 8248, 0xc4ff }, { 8259, 0xd97f }, { 8271, 0xefce }, { 8283, 0xbe0f }, + { 8293, 0xf17b }, { 8304, 0xf05e }, { 8313, 0xf6cf }, { 8325, 0xffb7 }, + { 8339, 0x5ef7 }, { 8351, 0xef84 }, { 8360, 0xd7cb }, { 8371, 0x0edf }, + /* 0x7e00 */ + { 8381, 0xff08 }, { 8390, 0xfcff }, { 8404, 0xee3f }, { 8416, 0xffff }, + { 8432, 0x13ff }, { 8443, 0xd7ff }, { 8457, 0xaf0f }, { 8467, 0x7ffd }, + { 8481, 0xbdc7 }, { 8492, 0x1ffa }, { 8503, 0x0000 }, { 8503, 0x0000 }, + { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, + /* 0x7f00 */ + { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0x0000 }, { 8503, 0xe740 }, + { 8510, 0xbd38 }, { 8519, 0xf933 }, { 8529, 0x7feb }, { 8542, 0xfeed }, + { 8555, 0x7fe8 }, { 8566, 0x7c76 }, { 8576, 0xb3f7 }, { 8588, 0xffef }, + { 8603, 0xfeaf }, { 8616, 0xd8b7 }, { 8626, 0xff6f }, { 8640, 0xfbbf }, + /* 0x8000 */ + { 8654, 0xf8fb }, { 8666, 0xdbf7 }, { 8679, 0x1752 }, { 8686, 0xe2f9 }, + { 8696, 0x85c8 }, { 8702, 0x7547 }, { 8711, 0x9090 }, { 8715, 0xe3ef }, + { 8727, 0x9ef4 }, { 8737, 0x3f6d }, { 8748, 0xee2e }, { 8758, 0x0536 }, + { 8764, 0xf7bc }, { 8776, 0x7ff3 }, { 8789, 0xa07b }, { 8797, 0x7f3f }, + /* 0x8100 */ + { 8810, 0x0567 }, { 8817, 0xeb60 }, { 8825, 0xbabe }, { 8836, 0x6601 }, + { 8841, 0xfcd8 }, { 8851, 0x583f }, { 8860, 0xcaf7 }, { 8871, 0x87df }, + { 8882, 0xbfcd }, { 8894, 0xffa0 }, { 8904, 0x5bcd }, { 8914, 0xfebf }, + { 8928, 0xb6fd }, { 8940, 0xefa7 }, { 8952, 0x77ef }, { 8965, 0xdf9c }, + /* 0x8200 */ + { 8976, 0x3fb7 }, { 8988, 0xf877 }, { 8999, 0x9d27 }, { 9008, 0xb7fc }, + { 9020, 0xcab5 }, { 9029, 0xdfef }, { 9043, 0xfb5a }, { 9054, 0xf1b6 }, + { 9064, 0xec39 }, { 9073, 0xef1f }, { 9085, 0xfbbf }, { 9099, 0x7ffb }, + { 9113, 0x000d }, { 9116, 0xdafe }, { 9128, 0xbdfb }, { 9141, 0x4e7f }, + /* 0x8300 */ + { 9152, 0x33ff }, { 9164, 0x5ac0 }, { 9170, 0xbff5 }, { 9183, 0x9ffe }, + { 9196, 0xffbf }, { 9211, 0x005f }, { 9217, 0x0000 }, { 9217, 0xfdf8 }, + { 9229, 0xffca }, { 9241, 0x6ffd }, { 9254, 0xcffd }, { 9267, 0xa001 }, + { 9270, 0xdfff }, { 9285, 0xfbf2 }, { 9297, 0xdfbf }, { 9311, 0xff7f }, + /* 0x8400 */ + { 9326, 0xfeda }, { 9338, 0x080f }, { 9343, 0xba08 }, { 9349, 0xbfff }, + { 9364, 0x7afd }, { 9376, 0xeed7 }, { 9388, 0xfbeb }, { 9401, 0x67f9 }, + { 9412, 0xe044 }, { 9417, 0xff93 }, { 9429, 0xdf97 }, { 9441, 0x9f57 }, + { 9452, 0xfef7 }, { 9466, 0x08df }, { 9474, 0xdf80 }, { 9482, 0xfedf }, + /* 0x8500 */ + { 9496, 0xffc5 }, { 9508, 0xf7fe }, { 9522, 0xfffb }, { 9537, 0x6803 }, + { 9542, 0x67fb }, { 9554, 0x6bfa }, { 9565, 0x7fff }, { 9580, 0x5fe2 }, + { 9590, 0xffff }, { 9606, 0xff73 }, { 9619, 0x87df }, { 9630, 0xe7fb }, + { 9643, 0xebfd }, { 9656, 0xf7a7 }, { 9668, 0xbf7e }, { 9681, 0xefc7 }, + /* 0x8600 */ + { 9693, 0x1ef3 }, { 9703, 0xdf82 }, { 9712, 0x76ff }, { 9725, 0xdf7e }, + { 9738, 0x79c9 }, { 9747, 0xda7d }, { 9758, 0xefbe }, { 9771, 0x1e9b }, + { 9780, 0x7ce0 }, { 9788, 0x77fb }, { 9801, 0x87be }, { 9811, 0xfffb }, + { 9826, 0x1bff }, { 9838, 0xffdb }, { 9852, 0x3f5c }, { 9862, 0x4fe0 }, + /* 0x8700 */ + { 9870, 0x7fff }, { 9885, 0x5f0e }, { 9894, 0x77ff }, { 9908, 0xddbf }, + { 9921, 0xf04f }, { 9930, 0xffff }, { 9946, 0xffff }, { 9962, 0x0ff8 }, + { 9971, 0xa3be }, { 9981, 0xfddf }, { 9995, 0xfc1c }, { 10004, 0xfffd }, + { 10019, 0x1f7d }, { 10030, 0xfb9e }, { 10042, 0xbdff }, { 10056, 0xdedc }, + /* 0x8800 */ + { 10067, 0x3f6f }, { 10079, 0xbafb }, { 10091, 0xdf7f }, { 10105, 0xfbef }, + { 10119, 0x7d1b }, { 10129, 0x2eec }, { 10138, 0xaf8e }, { 10148, 0xf2f7 }, + { 10160, 0x7b0f }, { 10170, 0xcfee }, { 10182, 0x1d96 }, { 10190, 0x77c6 }, + { 10200, 0x7e07 }, { 10209, 0xfff5 }, { 10223, 0xd982 }, { 10230, 0x7fdf }, + /* 0x8900 */ + { 10244, 0x5ee6 }, { 10254, 0xc7ff }, { 10267, 0xfeee }, { 10280, 0x79ef }, + { 10292, 0x9a56 }, { 10300, 0xffcf }, { 10314, 0xfe5f }, { 10327, 0xde5e }, + { 10338, 0x896e }, { 10346, 0xf9e8 }, { 10356, 0xf45e }, { 10366, 0xe6c4 }, + { 10374, 0x0001 }, { 10375, 0xbe7c }, { 10386, 0x3b7f }, { 10398, 0xdddf }, + /* 0x8a00 */ + { 10411, 0xd59d }, { 10421, 0xe9ef }, { 10433, 0x34ac }, { 10440, 0xde53 }, + { 10450, 0xf573 }, { 10461, 0x4bf7 }, { 10472, 0x7b4f }, { 10483, 0x9eff }, + { 10496, 0xb8fe }, { 10507, 0x476e }, { 10516, 0x0dfb }, { 10526, 0xff45 }, + { 10537, 0xabfd }, { 10549, 0xfbfe }, { 10563, 0xe9d7 }, { 10574, 0xddff }, + /* 0x8b00 */ + { 10588, 0xedf7 }, { 10601, 0x7fff }, { 10616, 0xddfd }, { 10629, 0x7eeb }, + { 10641, 0xcfe7 }, { 10653, 0xb7ff }, { 10667, 0xbde9 }, { 10678, 0xef91 }, + { 10688, 0x5d75 }, { 10698, 0xd77c }, { 10709, 0x0000 }, { 10709, 0x0000 }, + { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, + /* 0x8c00 */ + { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0x0000 }, { 10709, 0xfa80 }, + { 10716, 0xffee }, { 10730, 0xb4f1 }, { 10739, 0xbf76 }, { 10751, 0x2fef }, + { 10763, 0xb677 }, { 10774, 0x77bf }, { 10787, 0x9fbf }, { 10800, 0xfffd }, + { 10815, 0x95bf }, { 10826, 0xf6ae }, { 10837, 0x75ff }, { 10850, 0x7f3b }, + /* 0x8d00 */ + { 10862, 0xa7f5 }, { 10873, 0x0af9 }, { 10881, 0x0000 }, { 10881, 0x0000 }, + { 10881, 0x0000 }, { 10881, 0x0000 }, { 10881, 0xfbd0 }, { 10891, 0x2bdd }, + { 10901, 0xf633 }, { 10911, 0x9a7f }, { 10922, 0xfdab }, { 10934, 0xd6fc }, + { 10945, 0xf9e6 }, { 10956, 0xbfeb }, { 10969, 0xdfdf }, { 10983, 0xf41f }, + /* 0x8e00 */ + { 10993, 0xa6fd }, { 11004, 0xffff }, { 11020, 0x4aff }, { 11031, 0xf37b }, + { 11043, 0x7fb7 }, { 11056, 0xfef9 }, { 11069, 0xb6ff }, { 11082, 0x1d5c }, + { 11090, 0x7ff6 }, { 11103, 0xe5ff }, { 11116, 0x1f7b }, { 11127, 0x2404 }, + { 11130, 0xbe05 }, { 11138, 0xf99e }, { 11149, 0xdbe3 }, { 11160, 0xdff2 }, + /* 0x8f00 */ + { 11172, 0x6fef }, { 11185, 0xfdff }, { 11200, 0xd679 }, { 11210, 0xcbfc }, + { 11221, 0xebfd }, { 11234, 0xefff }, { 11249, 0x001f }, { 11254, 0x0000 }, + { 11254, 0x0000 }, { 11254, 0x9800 }, { 11257, 0xe148 }, { 11263, 0x8017 }, + { 11268, 0x6a74 }, { 11276, 0x00fe }, { 11283, 0x6d7f }, { 11295, 0xfdf1 }, + /* 0x9000 */ + { 11307, 0xb87f }, { 11318, 0xfef3 }, { 11331, 0xe01f }, { 11339, 0xf176 }, + { 11349, 0xee96 }, { 11359, 0x7b3f }, { 11371, 0xeb8d }, { 11381, 0xfffd }, + { 11396, 0xadff }, { 11409, 0xcbb3 }, { 11419, 0x84ef }, { 11428, 0xe17f }, + { 11439, 0x4daa }, { 11447, 0xbff0 }, { 11458, 0xbf3f }, { 11471, 0xfe3f }, + /* 0x9100 */ + { 11484, 0xebff }, { 11498, 0xffd7 }, { 11512, 0xffdf }, { 11527, 0xcf7f }, + { 11540, 0xfffb }, { 11555, 0x85ed }, { 11564, 0xd73f }, { 11576, 0x07bc }, + { 11584, 0xaeff }, { 11597, 0xfe0f }, { 11608, 0xfdaf }, { 11621, 0x76bf }, + { 11633, 0xfaef }, { 11646, 0x37bb }, { 11657, 0x7fdc }, { 11669, 0xa3ba }, + /* 0x9200 */ + { 11678, 0xb6ff }, { 11691, 0x56f7 }, { 11702, 0x60f8 }, { 11709, 0xe7df }, + { 11722, 0xff61 }, { 11733, 0x4cdf }, { 11743, 0xb0fb }, { 11753, 0xff45 }, + { 11764, 0x7ded }, { 11776, 0x3ffa }, { 11788, 0x1fff }, { 11801, 0x18fc }, + { 11809, 0xffff }, { 11825, 0xe3af }, { 11836, 0xc7d3 }, { 11846, 0xdf83 }, + /* 0x9300 */ + { 11856, 0xfb57 }, { 11868, 0xef7d }, { 11881, 0xefff }, { 11896, 0x1378 }, + { 11903, 0xfec0 }, { 11912, 0x5ff7 }, { 11925, 0x34bb }, { 11934, 0x5ee3 }, + { 11944, 0xf70d }, { 11954, 0xeff6 }, { 11967, 0xd7fe }, { 11980, 0x00bf }, + { 11987, 0xf59d }, { 11998, 0xf7f7 }, { 12012, 0x51de }, { 12021, 0xffe0 }, + /* 0x9400 */ + { 12032, 0xfec9 }, { 12043, 0x037f }, { 12052, 0x5f01 }, { 12059, 0xbfef }, + { 12073, 0x9ff1 }, { 12084, 0x60a7 }, { 12091, 0xef1d }, { 12102, 0xf1ff }, + { 12115, 0x000f }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, + { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, + /* 0x9500 */ + { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, + { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x0000 }, { 12119, 0x3c80 }, + { 12124, 0xfb4d }, { 12135, 0xd91f }, { 12145, 0x7b3a }, { 12155, 0xfee3 }, + { 12167, 0x3fe9 }, { 12178, 0xdc7f }, { 12190, 0x003f }, { 12196, 0x0000 }, + /* 0x9600 */ + { 12196, 0x0000 }, { 12196, 0x5000 }, { 12198, 0xf51f }, { 12209, 0xbe07 }, + { 12218, 0xfc1d }, { 12228, 0xf91b }, { 12238, 0xbc1e }, { 12247, 0x71ff }, + { 12259, 0x6ff9 }, { 12271, 0x5bbe }, { 12282, 0x5796 }, { 12291, 0x9b1b }, + { 12300, 0x7fff }, { 12315, 0xfffc }, { 12329, 0x872e }, { 12337, 0xafe7 }, + /* 0x9700 */ + { 12349, 0xebf5 }, { 12361, 0xf34f }, { 12372, 0xdffd }, { 12386, 0xe725 }, + { 12395, 0x0bdc }, { 12403, 0x5d44 }, { 12410, 0x5747 }, { 12419, 0xfddd }, + { 12432, 0xed3f }, { 12444, 0x7790 }, { 12452, 0x7d7f }, { 12465, 0x8ac8 }, + { 12471, 0xfafa }, { 12483, 0xf3f9 }, { 12495, 0x202a }, { 12499, 0xef4b }, + /* 0x9800 */ + { 12510, 0xf5ff }, { 12524, 0x79cf }, { 12535, 0xabd3 }, { 12545, 0x0ba5 }, + { 12552, 0xf77a }, { 12564, 0xfb8f }, { 12576, 0x8ebd }, { 12586, 0x001f }, + { 12591, 0x0000 }, { 12591, 0x0000 }, { 12591, 0xf300 }, { 12597, 0xfd4e }, + { 12608, 0x1a57 }, { 12616, 0x8800 }, { 12618, 0xaeac }, { 12627, 0x7654 }, + /* 0x9900 */ + { 12635, 0x17ad }, { 12644, 0xcdff }, { 12657, 0xffb2 }, { 12669, 0xf42f }, + { 12679, 0x5baa }, { 12688, 0xdbff }, { 12702, 0x0002 }, { 12703, 0x0000 }, + { 12703, 0x0000 }, { 12703, 0x73c0 }, { 12710, 0xf9ea }, { 12721, 0x2e3f }, + { 12731, 0xfa8e }, { 12741, 0xbbff }, { 12755, 0x76bc }, { 12765, 0xffd3 }, + /* 0x9a00 */ + { 12778, 0xeefe }, { 12791, 0x7e72 }, { 12801, 0x7ebd }, { 12813, 0xe7f7 }, + { 12826, 0xf77f }, { 12840, 0xcefd }, { 12852, 0x0ff5 }, { 12862, 0x0000 }, + { 12862, 0x0000 }, { 12862, 0x0000 }, { 12862, 0xa900 }, { 12866, 0xdb9b }, + { 12877, 0xa4c7 }, { 12885, 0x917f }, { 12895, 0xf8ca }, { 12904, 0x7ece }, + /* 0x9b00 */ + { 12915, 0x7d7a }, { 12926, 0xc7e7 }, { 12937, 0xcbbd }, { 12948, 0xdcae }, + { 12958, 0xfd7e }, { 12971, 0x8f76 }, { 12981, 0x91d3 }, { 12989, 0x7cf3 }, + { 13000, 0x01e5 }, { 13006, 0x4c2f }, { 13014, 0xed77 }, { 13026, 0xa360 }, + { 13032, 0x07db }, { 13041, 0x5ef8 }, { 13051, 0x1df7 }, { 13062, 0x2181 }, + /* 0x9c00 */ + { 13066, 0x6be0 }, { 13074, 0x309c }, { 13080, 0x3b3a }, { 13089, 0xfade }, + { 13101, 0x7f53 }, { 13112, 0xc3f5 }, { 13122, 0x61cd }, { 13130, 0x07ba }, + { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x0000 }, + { 13138, 0x0000 }, { 13138, 0x0000 }, { 13138, 0x26e0 }, { 13144, 0xbefe }, + /* 0x9d00 */ + { 13157, 0x03f9 }, { 13165, 0xebb5 }, { 13176, 0xe36d }, { 13186, 0xe9cb }, + { 13196, 0x9c2f }, { 13205, 0xbfde }, { 13218, 0x9f83 }, { 13227, 0xabbf }, + { 13239, 0x1ff7 }, { 13251, 0xffd5 }, { 13264, 0xb7df }, { 13277, 0xdffe }, + { 13291, 0xfdae }, { 13303, 0xffef }, { 13318, 0xfb7e }, { 13331, 0xeffd }, + /* 0x9e00 */ + { 13345, 0xaaff }, { 13357, 0x6ebf }, { 13369, 0x0000 }, { 13369, 0x0000 }, + { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0x0000 }, { 13369, 0xb620 }, + { 13375, 0x7fcd }, { 13387, 0xbe9e }, { 13398, 0x62b3 }, { 13406, 0x58f1 }, + { 13414, 0xf10d }, { 13422, 0xfd7b }, { 13435, 0xe9f1 }, { 13445, 0xbefd }, + /* 0x9f00 */ + { 13458, 0xc6c3 }, { 13466, 0x5f6d }, { 13477, 0xff3d }, { 13490, 0x69ff }, + { 13502, 0xffcf }, { 13516, 0xfbf4 }, { 13528, 0xdcfb }, { 13540, 0x4ff7 }, + { 13552, 0x2000 }, { 13553, 0x1137 }, { 13560, 0x0015 }, +}; +static const Summary16 big5_uni2indx_pagefa[1] = { + /* 0xfa00 */ + { 13563, 0x3000 }, +}; +static const Summary16 big5_uni2indx_pagefe[23] = { + /* 0xfe00 */ + { 13565, 0x0000 }, { 13565, 0x0000 }, { 13565, 0x0000 }, { 13565, 0xfffb }, + { 13580, 0xfe1f }, { 13592, 0xfef5 }, { 13605, 0x0e7f }, { 13615, 0x0000 }, + { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, + { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, { 13615, 0x0000 }, + /* 0xff00 */ + { 13615, 0xff7a }, { 13628, 0xffff }, { 13644, 0xffff }, { 13660, 0x97ff }, + { 13673, 0xfffe }, { 13688, 0x3fff }, { 13702, 0x0010 }, +}; + +static int +big5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc < 0x0100) + summary = &big5_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x0200 && wc < 0x0460) + summary = &big5_uni2indx_page02[(wc>>4)-0x020]; + else if (wc >= 0x2000 && wc < 0x22c0) + summary = &big5_uni2indx_page20[(wc>>4)-0x200]; + else if (wc >= 0x2400 && wc < 0x2650) + summary = &big5_uni2indx_page24[(wc>>4)-0x240]; + else if (wc >= 0x3000 && wc < 0x33e0) + summary = &big5_uni2indx_page30[(wc>>4)-0x300]; + else if (wc >= 0x4e00 && wc < 0x9fb0) + summary = &big5_uni2indx_page4e[(wc>>4)-0x4e0]; + else if (wc >= 0xfa00 && wc < 0xfa10) + summary = &big5_uni2indx_pagefa[(wc>>4)-0xfa0]; + else if (wc >= 0xfe00 && wc < 0xff70) + summary = &big5_uni2indx_pagefe[(wc>>4)-0xfe0]; + if (summary) { + unsigned short used = summary->used; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = big5_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/big5_emacs.h b/nx-X11/lib/src/xlibi18n/lcUniConv/big5_emacs.h new file mode 100644 index 000000000..246aebeb4 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/big5_emacs.h @@ -0,0 +1,163 @@ + +/* + * BIG5-0 and BIG5-1 + */ + +/* + BIG5 with its 13494 characters doesn't fit in a single 94x94 or 96x96 + block. Therefore Emacs/Mule developers, in a typically Japanese way of + thinking, have developed an alternative encoding of BIG5 in two 94x94 + planes, very similar to the SHIFT_JIS encoding for JISX0208. + + Conversion between BIG5 codes (s1,s2) and BIG5-0 codes (c1,c2): + Example. (s1,s2) = 0xA140, (c1,c2) = 0x2121. + 0xA1 <= s1 <= 0xC7, 0x40 <= s2 <= 0x7E || 0xA1 <= s2 <= 0xFE, + 0x21 <= c1 <= 0x62, 0x21 <= c2 <= 0x7E. + Invariant: + 157*(s1-0xA1) + (s2 < 0x80 ? s2-0x40 : s2-0x62) + = 94*(c1-0x21)+(c2-0x21) + Conversion (s1,s2) -> (c1,c2): + t := 157*(s1-0xA1) + (s2 < 0x80 ? s2-0x40 : s2-0x62) + c1 := (t div 94) + 0x21 + c2 := (t mod 94) + 0x21 + Conversion (c1,c2) -> (s1,s2): + t := 94*(c1-0x21)+(c2-0x21) + t2 := t mod 157 + s1 := (t div 157) + 0xA1 + s2 := (t2 < 0x3F ? t2+0x40 : t2+0x62) + + Conversion between BIG5 codes (s1,s2) and BIG5-1 codes (c1,c2): + Example. (s1,s2) = 0xC940, (c1,c2) = 0x2121. + 0xC9 <= s1 <= 0xF9, 0x40 <= s2 <= 0x7E || 0xA1 <= s2 <= 0xFE, + 0x21 <= c1 <= 0x72, 0x21 <= c2 <= 0x7E. + Invariant: + 157*(s1-0xC9) + (s2 < 0x80 ? s2-0x40 : s2-0x62) + = 94*(c1-0x21)+(c2-0x21) + Conversion (s1,s2) -> (c1,c2): + t := 157*(s1-0xC9) + (s2 < 0x80 ? s2-0x40 : s2-0x62) + c1 := (t div 94) + 0x21 + c2 := (t mod 94) + 0x21 + Conversion (c1,c2) -> (s1,s2): + t := 94*(c1-0x21)+(c2-0x21) + t2 := t mod 157 + s1 := (t div 157) + 0xC9 + s2 := (t2 < 0x3F ? t2+0x40 : t2+0x62) + */ + +static int +big5_0_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = s[0]; + if (c1 >= 0x21 && c1 <= 0x62) { + if (n >= 2) { + unsigned char c2 = s[1]; + if (c2 >= 0x21 && c2 <= 0x7e) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + if (0) { + /* Unoptimized. */ + unsigned char buf[2]; + buf[0] = (i / 157) + 0xa1; + i = i % 157; + buf[1] = i + (i < 0x3f ? 0x40 : 0x62); + return big5_mbtowc(conv,pwc,buf,2); + } else { + /* Inline the implementation of big5_mbtowc. */ + if (i < 6121) { + unsigned short wc = big5_2uni_pagea1[i]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static int +big5_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = s[0]; + if (c1 >= 0x21 && c1 <= 0x72) { + if (n >= 2) { + unsigned char c2 = s[1]; + if (c2 >= 0x21 && c2 <= 0x7e) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + if (0) { + /* Unoptimized. */ + unsigned char buf[2]; + buf[0] = (i / 157) + 0xc9; + i = i % 157; + buf[1] = i + (i < 0x3f ? 0x40 : 0x62); + return big5_mbtowc(conv,pwc,buf,2); + } else { + /* Inline the implementation of big5_mbtowc. */ + if (i < 7652) { + unsigned short wc = big5_2uni_pagec9[i]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static int +big5_0_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + unsigned char buf[2]; + int ret = big5_wctomb(conv,buf,wc,2); + if (ret != RET_ILSEQ) { + unsigned char s1, s2; + if (ret != 2) abort(); + s1 = buf[0]; + s2 = buf[1]; + if (!(s1 >= 0xa1)) abort(); + if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort(); + if (s1 < 0xc9) { + unsigned int t = 157 * (s1 - 0xa1) + s2 - (s2 < 0x80 ? 0x40 : 0x62); + r[0] = (t / 94) + 0x21; + r[1] = (t % 94) + 0x21; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} + +static int +big5_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + unsigned char buf[2]; + int ret = big5_wctomb(conv,buf,wc,2); + if (ret != RET_ILSEQ) { + unsigned char s1, s2; + if (ret != 2) abort(); + s1 = buf[0]; + s2 = buf[1]; + if (!(s1 <= 0xf9)) abort(); + if (!((s2 >= 0x40 && s2 <= 0x7e) || (s2 >= 0xa1 && s2 <= 0xfe))) abort(); + if (s1 >= 0xc9) { + unsigned int t = 157 * (s1 - 0xc9) + s2 - (s2 < 0x80 ? 0x40 : 0x62); + r[0] = (t / 94) + 0x21; + r[1] = (t % 94) + 0x21; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/big5hkscs.h b/nx-X11/lib/src/xlibi18n/lcUniConv/big5hkscs.h new file mode 100644 index 000000000..721d1228e --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/big5hkscs.h @@ -0,0 +1,6252 @@ + +/* + * BIG5-HKSCS + */ + +static const unsigned short big5hkscs_2uni_page81[19782] = { + /* 0x81 */ + 0xeeb8, 0xeeb9, 0xeeba, 0xeebb, 0xeebc, 0xeebd, 0xeebe, 0xeebf, + 0xeec0, 0xeec1, 0xeec2, 0xeec3, 0xeec4, 0xeec5, 0xeec6, 0xeec7, + 0xeec8, 0xeec9, 0xeeca, 0xeecb, 0xeecc, 0xeecd, 0xeece, 0xeecf, + 0xeed0, 0xeed1, 0xeed2, 0xeed3, 0xeed4, 0xeed5, 0xeed6, 0xeed7, + 0xeed8, 0xeed9, 0xeeda, 0xeedb, 0xeedc, 0xeedd, 0xeede, 0xeedf, + 0xeee0, 0xeee1, 0xeee2, 0xeee3, 0xeee4, 0xeee5, 0xeee6, 0xeee7, + 0xeee8, 0xeee9, 0xeeea, 0xeeeb, 0xeeec, 0xeeed, 0xeeee, 0xeeef, + 0xeef0, 0xeef1, 0xeef2, 0xeef3, 0xeef4, 0xeef5, 0xeef6, 0xeef7, + 0xeef8, 0xeef9, 0xeefa, 0xeefb, 0xeefc, 0xeefd, 0xeefe, 0xeeff, + 0xef00, 0xef01, 0xef02, 0xef03, 0xef04, 0xef05, 0xef06, 0xef07, + 0xef08, 0xef09, 0xef0a, 0xef0b, 0xef0c, 0xef0d, 0xef0e, 0xef0f, + 0xef10, 0xef11, 0xef12, 0xef13, 0xef14, 0xef15, 0xef16, 0xef17, + 0xef18, 0xef19, 0xef1a, 0xef1b, 0xef1c, 0xef1d, 0xef1e, 0xef1f, + 0xef20, 0xef21, 0xef22, 0xef23, 0xef24, 0xef25, 0xef26, 0xef27, + 0xef28, 0xef29, 0xef2a, 0xef2b, 0xef2c, 0xef2d, 0xef2e, 0xef2f, + 0xef30, 0xef31, 0xef32, 0xef33, 0xef34, 0xef35, 0xef36, 0xef37, + 0xef38, 0xef39, 0xef3a, 0xef3b, 0xef3c, 0xef3d, 0xef3e, 0xef3f, + 0xef40, 0xef41, 0xef42, 0xef43, 0xef44, 0xef45, 0xef46, 0xef47, + 0xef48, 0xef49, 0xef4a, 0xef4b, 0xef4c, 0xef4d, 0xef4e, 0xef4f, + 0xef50, 0xef51, 0xef52, 0xef53, 0xef54, + /* 0x82 */ + 0xef55, 0xef56, 0xef57, 0xef58, 0xef59, 0xef5a, 0xef5b, 0xef5c, + 0xef5d, 0xef5e, 0xef5f, 0xef60, 0xef61, 0xef62, 0xef63, 0xef64, + 0xef65, 0xef66, 0xef67, 0xef68, 0xef69, 0xef6a, 0xef6b, 0xef6c, + 0xef6d, 0xef6e, 0xef6f, 0xef70, 0xef71, 0xef72, 0xef73, 0xef74, + 0xef75, 0xef76, 0xef77, 0xef78, 0xef79, 0xef7a, 0xef7b, 0xef7c, + 0xef7d, 0xef7e, 0xef7f, 0xef80, 0xef81, 0xef82, 0xef83, 0xef84, + 0xef85, 0xef86, 0xef87, 0xef88, 0xef89, 0xef8a, 0xef8b, 0xef8c, + 0xef8d, 0xef8e, 0xef8f, 0xef90, 0xef91, 0xef92, 0xef93, 0xef94, + 0xef95, 0xef96, 0xef97, 0xef98, 0xef99, 0xef9a, 0xef9b, 0xef9c, + 0xef9d, 0xef9e, 0xef9f, 0xefa0, 0xefa1, 0xefa2, 0xefa3, 0xefa4, + 0xefa5, 0xefa6, 0xefa7, 0xefa8, 0xefa9, 0xefaa, 0xefab, 0xefac, + 0xefad, 0xefae, 0xefaf, 0xefb0, 0xefb1, 0xefb2, 0xefb3, 0xefb4, + 0xefb5, 0xefb6, 0xefb7, 0xefb8, 0xefb9, 0xefba, 0xefbb, 0xefbc, + 0xefbd, 0xefbe, 0xefbf, 0xefc0, 0xefc1, 0xefc2, 0xefc3, 0xefc4, + 0xefc5, 0xefc6, 0xefc7, 0xefc8, 0xefc9, 0xefca, 0xefcb, 0xefcc, + 0xefcd, 0xefce, 0xefcf, 0xefd0, 0xefd1, 0xefd2, 0xefd3, 0xefd4, + 0xefd5, 0xefd6, 0xefd7, 0xefd8, 0xefd9, 0xefda, 0xefdb, 0xefdc, + 0xefdd, 0xefde, 0xefdf, 0xefe0, 0xefe1, 0xefe2, 0xefe3, 0xefe4, + 0xefe5, 0xefe6, 0xefe7, 0xefe8, 0xefe9, 0xefea, 0xefeb, 0xefec, + 0xefed, 0xefee, 0xefef, 0xeff0, 0xeff1, + /* 0x83 */ + 0xeff2, 0xeff3, 0xeff4, 0xeff5, 0xeff6, 0xeff7, 0xeff8, 0xeff9, + 0xeffa, 0xeffb, 0xeffc, 0xeffd, 0xeffe, 0xefff, 0xf000, 0xf001, + 0xf002, 0xf003, 0xf004, 0xf005, 0xf006, 0xf007, 0xf008, 0xf009, + 0xf00a, 0xf00b, 0xf00c, 0xf00d, 0xf00e, 0xf00f, 0xf010, 0xf011, + 0xf012, 0xf013, 0xf014, 0xf015, 0xf016, 0xf017, 0xf018, 0xf019, + 0xf01a, 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf020, 0xf021, + 0xf022, 0xf023, 0xf024, 0xf025, 0xf026, 0xf027, 0xf028, 0xf029, + 0xf02a, 0xf02b, 0xf02c, 0xf02d, 0xf02e, 0xf02f, 0xf030, 0xf031, + 0xf032, 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, + 0xf03a, 0xf03b, 0xf03c, 0xf03d, 0xf03e, 0xf03f, 0xf040, 0xf041, + 0xf042, 0xf043, 0xf044, 0xf045, 0xf046, 0xf047, 0xf048, 0xf049, + 0xf04a, 0xf04b, 0xf04c, 0xf04d, 0xf04e, 0xf04f, 0xf050, 0xf051, + 0xf052, 0xf053, 0xf054, 0xf055, 0xf056, 0xf057, 0xf058, 0xf059, + 0xf05a, 0xf05b, 0xf05c, 0xf05d, 0xf05e, 0xf05f, 0xf060, 0xf061, + 0xf062, 0xf063, 0xf064, 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, + 0xf06a, 0xf06b, 0xf06c, 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, + 0xf072, 0xf073, 0xf074, 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, + 0xf07a, 0xf07b, 0xf07c, 0xf07d, 0xf07e, 0xf07f, 0xf080, 0xf081, + 0xf082, 0xf083, 0xf084, 0xf085, 0xf086, 0xf087, 0xf088, 0xf089, + 0xf08a, 0xf08b, 0xf08c, 0xf08d, 0xf08e, + /* 0x84 */ + 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, 0xf094, 0xf095, 0xf096, + 0xf097, 0xf098, 0xf099, 0xf09a, 0xf09b, 0xf09c, 0xf09d, 0xf09e, + 0xf09f, 0xf0a0, 0xf0a1, 0xf0a2, 0xf0a3, 0xf0a4, 0xf0a5, 0xf0a6, + 0xf0a7, 0xf0a8, 0xf0a9, 0xf0aa, 0xf0ab, 0xf0ac, 0xf0ad, 0xf0ae, + 0xf0af, 0xf0b0, 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xf0b6, + 0xf0b7, 0xf0b8, 0xf0b9, 0xf0ba, 0xf0bb, 0xf0bc, 0xf0bd, 0xf0be, + 0xf0bf, 0xf0c0, 0xf0c1, 0xf0c2, 0xf0c3, 0xf0c4, 0xf0c5, 0xf0c6, + 0xf0c7, 0xf0c8, 0xf0c9, 0xf0ca, 0xf0cb, 0xf0cc, 0xf0cd, 0xf0ce, + 0xf0cf, 0xf0d0, 0xf0d1, 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, + 0xf0d7, 0xf0d8, 0xf0d9, 0xf0da, 0xf0db, 0xf0dc, 0xf0dd, 0xf0de, + 0xf0df, 0xf0e0, 0xf0e1, 0xf0e2, 0xf0e3, 0xf0e4, 0xf0e5, 0xf0e6, + 0xf0e7, 0xf0e8, 0xf0e9, 0xf0ea, 0xf0eb, 0xf0ec, 0xf0ed, 0xf0ee, + 0xf0ef, 0xf0f0, 0xf0f1, 0xf0f2, 0xf0f3, 0xf0f4, 0xf0f5, 0xf0f6, + 0xf0f7, 0xf0f8, 0xf0f9, 0xf0fa, 0xf0fb, 0xf0fc, 0xf0fd, 0xf0fe, + 0xf0ff, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, + 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e, + 0xf10f, 0xf110, 0xf111, 0xf112, 0xf113, 0xf114, 0xf115, 0xf116, + 0xf117, 0xf118, 0xf119, 0xf11a, 0xf11b, 0xf11c, 0xf11d, 0xf11e, + 0xf11f, 0xf120, 0xf121, 0xf122, 0xf123, 0xf124, 0xf125, 0xf126, + 0xf127, 0xf128, 0xf129, 0xf12a, 0xf12b, + /* 0x85 */ + 0xf12c, 0xf12d, 0xf12e, 0xf12f, 0xf130, 0xf131, 0xf132, 0xf133, + 0xf134, 0xf135, 0xf136, 0xf137, 0xf138, 0xf139, 0xf13a, 0xf13b, + 0xf13c, 0xf13d, 0xf13e, 0xf13f, 0xf140, 0xf141, 0xf142, 0xf143, + 0xf144, 0xf145, 0xf146, 0xf147, 0xf148, 0xf149, 0xf14a, 0xf14b, + 0xf14c, 0xf14d, 0xf14e, 0xf14f, 0xf150, 0xf151, 0xf152, 0xf153, + 0xf154, 0xf155, 0xf156, 0xf157, 0xf158, 0xf159, 0xf15a, 0xf15b, + 0xf15c, 0xf15d, 0xf15e, 0xf15f, 0xf160, 0xf161, 0xf162, 0xf163, + 0xf164, 0xf165, 0xf166, 0xf167, 0xf168, 0xf169, 0xf16a, 0xf16b, + 0xf16c, 0xf16d, 0xf16e, 0xf16f, 0xf170, 0xf171, 0xf172, 0xf173, + 0xf174, 0xf175, 0xf176, 0xf177, 0xf178, 0xf179, 0xf17a, 0xf17b, + 0xf17c, 0xf17d, 0xf17e, 0xf17f, 0xf180, 0xf181, 0xf182, 0xf183, + 0xf184, 0xf185, 0xf186, 0xf187, 0xf188, 0xf189, 0xf18a, 0xf18b, + 0xf18c, 0xf18d, 0xf18e, 0xf18f, 0xf190, 0xf191, 0xf192, 0xf193, + 0xf194, 0xf195, 0xf196, 0xf197, 0xf198, 0xf199, 0xf19a, 0xf19b, + 0xf19c, 0xf19d, 0xf19e, 0xf19f, 0xf1a0, 0xf1a1, 0xf1a2, 0xf1a3, + 0xf1a4, 0xf1a5, 0xf1a6, 0xf1a7, 0xf1a8, 0xf1a9, 0xf1aa, 0xf1ab, + 0xf1ac, 0xf1ad, 0xf1ae, 0xf1af, 0xf1b0, 0xf1b1, 0xf1b2, 0xf1b3, + 0xf1b4, 0xf1b5, 0xf1b6, 0xf1b7, 0xf1b8, 0xf1b9, 0xf1ba, 0xf1bb, + 0xf1bc, 0xf1bd, 0xf1be, 0xf1bf, 0xf1c0, 0xf1c1, 0xf1c2, 0xf1c3, + 0xf1c4, 0xf1c5, 0xf1c6, 0xf1c7, 0xf1c8, + /* 0x86 */ + 0xf1c9, 0xf1ca, 0xf1cb, 0xf1cc, 0xf1cd, 0xf1ce, 0xf1cf, 0xf1d0, + 0xf1d1, 0xf1d2, 0xf1d3, 0xf1d4, 0xf1d5, 0xf1d6, 0xf1d7, 0xf1d8, + 0xf1d9, 0xf1da, 0xf1db, 0xf1dc, 0xf1dd, 0xf1de, 0xf1df, 0xf1e0, + 0xf1e1, 0xf1e2, 0xf1e3, 0xf1e4, 0xf1e5, 0xf1e6, 0xf1e7, 0xf1e8, + 0xf1e9, 0xf1ea, 0xf1eb, 0xf1ec, 0xf1ed, 0xf1ee, 0xf1ef, 0xf1f0, + 0xf1f1, 0xf1f2, 0xf1f3, 0xf1f4, 0xf1f5, 0xf1f6, 0xf1f7, 0xf1f8, + 0xf1f9, 0xf1fa, 0xf1fb, 0xf1fc, 0xf1fd, 0xf1fe, 0xf1ff, 0xf200, + 0xf201, 0xf202, 0xf203, 0xf204, 0xf205, 0xf206, 0xf207, 0xf208, + 0xf209, 0xf20a, 0xf20b, 0xf20c, 0xf20d, 0xf20e, 0xf20f, 0xf210, + 0xf211, 0xf212, 0xf213, 0xf214, 0xf215, 0xf216, 0xf217, 0xf218, + 0xf219, 0xf21a, 0xf21b, 0xf21c, 0xf21d, 0xf21e, 0xf21f, 0xf220, + 0xf221, 0xf222, 0xf223, 0xf224, 0xf225, 0xf226, 0xf227, 0xf228, + 0xf229, 0xf22a, 0xf22b, 0xf22c, 0xf22d, 0xf22e, 0xf22f, 0xf230, + 0xf231, 0xf232, 0xf233, 0xf234, 0xf235, 0xf236, 0xf237, 0xf238, + 0xf239, 0xf23a, 0xf23b, 0xf23c, 0xf23d, 0xf23e, 0xf23f, 0xf240, + 0xf241, 0xf242, 0xf243, 0xf244, 0xf245, 0xf246, 0xf247, 0xf248, + 0xf249, 0xf24a, 0xf24b, 0xf24c, 0xf24d, 0xf24e, 0xf24f, 0xf250, + 0xf251, 0xf252, 0xf253, 0xf254, 0xf255, 0xf256, 0xf257, 0xf258, + 0xf259, 0xf25a, 0xf25b, 0xf25c, 0xf25d, 0xf25e, 0xf25f, 0xf260, + 0xf261, 0xf262, 0xf263, 0xf264, 0xf265, + /* 0x87 */ + 0xf266, 0xf267, 0xf268, 0xf269, 0xf26a, 0xf26b, 0xf26c, 0xf26d, + 0xf26e, 0xf26f, 0xf270, 0xf271, 0xf272, 0xf273, 0xf274, 0xf275, + 0xf276, 0xf277, 0xf278, 0xf279, 0xf27a, 0xf27b, 0xf27c, 0xf27d, + 0xf27e, 0xf27f, 0xf280, 0xf281, 0xf282, 0xf283, 0xf284, 0xf285, + 0xf286, 0xf287, 0xf288, 0xf289, 0xf28a, 0xf28b, 0xf28c, 0xf28d, + 0xf28e, 0xf28f, 0xf290, 0xf291, 0xf292, 0xf293, 0xf294, 0xf295, + 0xf296, 0xf297, 0xf298, 0xf299, 0xf29a, 0xf29b, 0xf29c, 0xf29d, + 0xf29e, 0xf29f, 0xf2a0, 0xf2a1, 0xf2a2, 0xf2a3, 0xf2a4, 0xf2a5, + 0xf2a6, 0xf2a7, 0xf2a8, 0xf2a9, 0xf2aa, 0xf2ab, 0xf2ac, 0xf2ad, + 0xf2ae, 0xf2af, 0xf2b0, 0xf2b1, 0xf2b2, 0xf2b3, 0xf2b4, 0xf2b5, + 0xf2b6, 0xf2b7, 0xf2b8, 0xf2b9, 0xf2ba, 0xf2bb, 0xf2bc, 0xf2bd, + 0xf2be, 0xf2bf, 0xf2c0, 0xf2c1, 0xf2c2, 0xf2c3, 0xf2c4, 0xf2c5, + 0xf2c6, 0xf2c7, 0xf2c8, 0xf2c9, 0xf2ca, 0xf2cb, 0xf2cc, 0xf2cd, + 0xf2ce, 0xf2cf, 0xf2d0, 0xf2d1, 0xf2d2, 0xf2d3, 0xf2d4, 0xf2d5, + 0xf2d6, 0xf2d7, 0xf2d8, 0xf2d9, 0xf2da, 0xf2db, 0xf2dc, 0xf2dd, + 0xf2de, 0xf2df, 0xf2e0, 0xf2e1, 0xf2e2, 0xf2e3, 0xf2e4, 0xf2e5, + 0xf2e6, 0xf2e7, 0xf2e8, 0xf2e9, 0xf2ea, 0xf2eb, 0xf2ec, 0xf2ed, + 0xf2ee, 0xf2ef, 0xf2f0, 0xf2f1, 0xf2f2, 0xf2f3, 0xf2f4, 0xf2f5, + 0xf2f6, 0xf2f7, 0xf2f8, 0xf2f9, 0xf2fa, 0xf2fb, 0xf2fc, 0xf2fd, + 0xf2fe, 0xf2ff, 0xf300, 0xf301, 0xf302, + /* 0x88 */ + 0xf303, 0xf304, 0xf305, 0xf306, 0xf307, 0xf308, 0xf309, 0xf30a, + 0xf30b, 0xf30c, 0xf30d, 0xf30e, 0xf30f, 0xf310, 0xf311, 0xf312, + 0xf313, 0xf314, 0xf315, 0xf316, 0xf317, 0xf318, 0x0100, 0x00c1, + 0x01cd, 0x00c0, 0x0112, 0x00c9, 0x011a, 0x00c8, 0x014c, 0x00d3, + 0x01d1, 0x00d2, 0xf325, 0x1ebe, 0xf327, 0x1ec0, 0x00ca, 0x0101, + 0x00e1, 0x01ce, 0x00e0, 0x0251, 0x0113, 0x00e9, 0x011b, 0x00e8, + 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, + 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, + 0x00fc, 0xf344, 0x1ebf, 0xf346, 0x1ec1, 0x00ea, 0x0261, 0xf34a, + 0xf34b, 0xf34c, 0xf34d, 0xf34e, 0xf34f, 0xf350, 0xf351, 0xf352, + 0xf353, 0xf354, 0xf355, 0xf356, 0xf357, 0xf358, 0xf359, 0xf35a, + 0xf35b, 0xf35c, 0xf35d, 0xf35e, 0xf35f, 0xf360, 0xf361, 0xf362, + 0xf363, 0xf364, 0xf365, 0xf366, 0xf367, 0xf368, 0xf369, 0xf36a, + 0xf36b, 0xf36c, 0xf36d, 0xf36e, 0xf36f, 0xf370, 0xf371, 0xf372, + 0xf373, 0xf374, 0xf375, 0xf376, 0xf377, 0xf378, 0xf379, 0xf37a, + 0xf37b, 0xf37c, 0xf37d, 0xf37e, 0xf37f, 0xf380, 0xf381, 0xf382, + 0xf383, 0xf384, 0xf385, 0xf386, 0xf387, 0xf388, 0xf389, 0xf38a, + 0xf38b, 0xf38c, 0xf38d, 0xf38e, 0xf38f, 0xf390, 0xf391, 0xf392, + 0xf393, 0xf394, 0xf395, 0xf396, 0xf397, 0xf398, 0xf399, 0xf39a, + 0xf39b, 0xf39c, 0xf39d, 0xf39e, 0xf39f, + /* 0x89 */ + 0xf3a0, 0xf3a1, 0xf3a2, 0x650a, 0xf3a4, 0xf3a5, 0x4e3d, 0x6edd, + 0x9d4e, 0x91df, 0xf3aa, 0xf3ab, 0xf3ac, 0x6491, 0x4f1a, 0x4f28, + 0x4fa8, 0x5156, 0x5174, 0x519c, 0x51e4, 0x52a1, 0x52a8, 0x533b, + 0x534e, 0x53d1, 0x53d8, 0x56e2, 0x58f0, 0x5904, 0x5907, 0x5932, + 0x5934, 0x5b66, 0x5b9e, 0x5b9f, 0x5c9a, 0x5e86, 0x603b, 0x6589, + 0x67fe, 0x6804, 0x6865, 0x6d4e, 0x70bc, 0x7535, 0x7ea4, 0x7eac, + 0x7eba, 0x7ec7, 0x7ecf, 0x7edf, 0x7f06, 0x7f37, 0x827a, 0x82cf, + 0x836f, 0x89c6, 0x8bbe, 0x8be2, 0x8f66, 0x8f67, 0x8f6e, 0x7411, + 0x7cfc, 0x7dcd, 0x6946, 0x7ac9, 0x5227, 0xf3e5, 0xf3e6, 0xf3e7, + 0xf3e8, 0x918c, 0x78b8, 0x915e, 0x80bc, 0xf3ed, 0x8d0b, 0x80f6, + 0xf3f0, 0xf3f1, 0xf3f2, 0x809f, 0x9ec7, 0x4ccd, 0x9dc9, 0x9e0c, + 0x4c3e, 0xf3f9, 0xf3fa, 0x9e0a, 0xf3fc, 0x35c1, 0xf3fe, 0x6e9a, + 0x823e, 0x7519, 0xf402, 0x4911, 0x9a6c, 0x9a8f, 0x9f99, 0x7987, + 0xf408, 0xf409, 0xf40a, 0xf40b, 0x4e24, 0x4e81, 0x4e80, 0x4e87, + 0x4ebf, 0x4eeb, 0x4f37, 0x344c, 0x4fbd, 0x3e48, 0x5003, 0x5088, + 0x347d, 0x3493, 0x34a5, 0x5186, 0x5905, 0x51db, 0x51fc, 0x5205, + 0x4e89, 0x5279, 0x5290, 0x5327, 0x35c7, 0x53a9, 0x3551, 0x53b0, + 0x3553, 0x53c2, 0x5423, 0x356d, 0x3572, 0x3681, 0x5493, 0x54a3, + 0x54b4, 0x54b9, 0x54d0, 0x54ef, 0x5518, 0x5523, 0x5528, 0x3598, + 0x553f, 0x35a5, 0x35bf, 0x55d7, 0x35c5, + /* 0x8a */ + 0xf43d, 0x5525, 0xf43f, 0xf440, 0xf441, 0xf442, 0x5590, 0xf444, + 0x39ec, 0xf446, 0x8e46, 0xf448, 0xf449, 0x4053, 0xf44b, 0x777a, + 0xf44d, 0x3a34, 0x47d5, 0xf450, 0xf451, 0xf452, 0x64dd, 0xf454, + 0xf455, 0xf456, 0xf457, 0x648d, 0x8e7e, 0xf45a, 0xf45b, 0xf45c, + 0xf45d, 0xf45e, 0xf45f, 0xf460, 0xf461, 0xf462, 0xf463, 0x47f4, + 0xf465, 0xf466, 0x9ab2, 0x3a67, 0xf469, 0x3fed, 0x3506, 0xf46c, + 0xf46d, 0xf46e, 0xf46f, 0x9d6e, 0x9815, 0xf472, 0x43d9, 0xf474, + 0x64b4, 0x54e3, 0xf477, 0xf478, 0xf479, 0x39fb, 0xf47b, 0xf47c, + 0xf47d, 0xf47e, 0x64ea, 0xf480, 0xf481, 0x8e68, 0xf483, 0xf484, + 0xf485, 0xf486, 0x480b, 0xf488, 0x3ffa, 0x5873, 0xf48b, 0xf48c, + 0xf48d, 0xf48e, 0xf48f, 0xf490, 0xf491, 0x5579, 0x40bb, 0x43ba, + 0xf495, 0x4ab4, 0xf497, 0xf498, 0x81aa, 0x98f5, 0xf49b, 0x6379, + 0x39fe, 0xf49e, 0x8dc0, 0x56a1, 0x647c, 0x3e43, 0xf4a3, 0xf4a4, + 0xf4a5, 0xf4a6, 0xf4a7, 0xf4a8, 0xf4a9, 0xf4aa, 0x3992, 0x3a06, + 0xf4ad, 0x3578, 0xf4af, 0xf4b0, 0x5652, 0xf4b2, 0xf4b3, 0xf4b4, + 0x34bc, 0x6c3d, 0xf4b7, 0xf4b8, 0xf4b9, 0xf4ba, 0xf4bb, 0xf4bc, + 0xf4bd, 0xf4be, 0xf4bf, 0xf4c0, 0xf4c1, 0x7f93, 0xf4c3, 0xf4c4, + 0xf4c5, 0x35fb, 0xf4c7, 0xf4c8, 0xf4c9, 0xf4ca, 0x3f93, 0xf4cc, + 0xf4cd, 0xf4ce, 0xf4cf, 0xf4d0, 0xf4d1, 0xf4d2, 0xf4d3, 0xf4d4, + 0xf4d5, 0x3ff9, 0xf4d7, 0x6432, 0xf4d9, + /* 0x8b */ + 0xf4da, 0xf4db, 0xf4dc, 0xf4dd, 0xf4de, 0xf4df, 0xf4e0, 0x3a18, + 0xf4e2, 0xf4e3, 0xf4e4, 0xf4e5, 0xf4e6, 0xf4e7, 0xf4e8, 0xf4e9, + 0x95aa, 0x54cc, 0x82c4, 0x55b9, 0xf4ee, 0xf4ef, 0x9c26, 0x9ab6, + 0xf4f2, 0xf4f3, 0x7140, 0x816d, 0x80ec, 0x5c1c, 0xf4f8, 0x8134, + 0x3797, 0x535f, 0xf4fc, 0x91b6, 0xf4fe, 0xf4ff, 0xf500, 0xf501, + 0x35dd, 0xf503, 0x3609, 0xf505, 0x56af, 0xf507, 0xf508, 0xf509, + 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, + 0x5a54, 0xf513, 0xf514, 0xf515, 0xf516, 0x579c, 0xf518, 0xf519, + 0xf51a, 0xf51b, 0xf51c, 0xf51d, 0x3703, 0xf51f, 0xf520, 0xf521, + 0xf522, 0xf523, 0xf524, 0xf525, 0xf526, 0x5899, 0x5268, 0x361a, + 0xf52a, 0x7bb2, 0x5b68, 0x4800, 0x4b2c, 0x9f27, 0x49e7, 0x9c1f, + 0x9b8d, 0xf533, 0xf534, 0x55fb, 0x35f2, 0x5689, 0x4e28, 0x5902, + 0xf53a, 0xf53b, 0x9751, 0xf53d, 0x4e5b, 0x4ebb, 0x353e, 0x5c23, + 0x5f51, 0x5fc4, 0x38fa, 0x624c, 0x6535, 0x6b7a, 0x6c35, 0x6c3a, + 0x706c, 0x722b, 0x4e2c, 0x72ad, 0xf54e, 0x7f52, 0x793b, 0x7cf9, + 0x7f53, 0xf553, 0x34c1, 0xf555, 0xf556, 0x8002, 0x8080, 0xf559, + 0xf55a, 0x535d, 0x8864, 0x89c1, 0xf55e, 0x8ba0, 0x8d1d, 0x9485, + 0x9578, 0x957f, 0x95e8, 0xf565, 0x97e6, 0x9875, 0x98ce, 0x98de, + 0x9963, 0xf56b, 0x9c7c, 0x9e1f, 0x9ec4, 0x6b6f, 0xf907, 0x4e37, + 0xf572, 0x961d, 0x6237, 0x94a2, 0xf576, + /* 0x8c */ + 0x503b, 0x6dfe, 0xf579, 0xf57a, 0x3dc9, 0x888f, 0xf57d, 0x7077, + 0x5cf5, 0x4b20, 0xf581, 0x3559, 0xf583, 0x6122, 0xf585, 0x8fa7, + 0x91f6, 0x7191, 0x6719, 0x73ba, 0xf58b, 0xf58c, 0x3c8b, 0xf58e, + 0x4b10, 0x78e4, 0x7402, 0x51ae, 0xf593, 0x4009, 0x6a63, 0xf596, + 0x4223, 0x860f, 0xf599, 0x7a2a, 0xf59b, 0xf59c, 0x9755, 0x704d, + 0x5324, 0xf5a0, 0x93f4, 0x76d9, 0xf5a3, 0xf5a4, 0x77dd, 0x4ea3, + 0x4ff0, 0x50bc, 0x4e2f, 0x4f17, 0xf5ab, 0x5434, 0x7d8b, 0x5892, + 0x58d0, 0xf5b0, 0x5e92, 0x5e99, 0x5fc2, 0xf5b4, 0x658b, 0xf5b6, + 0x6919, 0x6a43, 0xf5b9, 0x6cff, 0xf5bb, 0x7200, 0xf5bd, 0x738c, + 0x3edb, 0xf5c0, 0x5b15, 0x74b9, 0x8b83, 0xf5c4, 0xf5c5, 0x7a93, + 0x7bec, 0x7cc3, 0x7e6c, 0x82f8, 0x8597, 0xf5cc, 0x8890, 0xf5ce, + 0x8eb9, 0xf5d0, 0x8fcf, 0x855f, 0x99e0, 0x9221, 0xf5d5, 0xf5d6, + 0xf5d7, 0x4071, 0x42a2, 0x5a1a, 0xf5db, 0xf5dc, 0xf5dd, 0x9868, + 0x676b, 0x4276, 0x573d, 0xf5e2, 0x85d6, 0xf5e4, 0x82bf, 0xf5e6, + 0x4c81, 0xf5e8, 0x5d7b, 0xf5ea, 0xf5eb, 0xf5ec, 0xf5ed, 0x5b96, + 0xf5ef, 0xf5f0, 0x7e5b, 0xf5f2, 0xf5f3, 0xf5f4, 0xf5f5, 0xf5f6, + 0xf5f7, 0xf5f8, 0xf5f9, 0xf5fa, 0xf5fb, 0xf5fc, 0xf5fd, 0xf5fe, + 0xf5ff, 0xf600, 0xf601, 0xf602, 0xf603, 0xf604, 0xf605, 0xf606, + 0xf607, 0xf608, 0xf609, 0xf60a, 0xf60b, 0xf60c, 0xf60d, 0xf60e, + 0xf60f, 0xf610, 0xf611, 0xf612, 0xf613, + /* 0x8d */ + 0xf614, 0xf615, 0xf616, 0xf617, 0xf618, 0xf619, 0xf61a, 0xf61b, + 0xf61c, 0xf61d, 0xf61e, 0xf61f, 0xf620, 0xf621, 0xf622, 0xf623, + 0xf624, 0xf625, 0xf626, 0xf627, 0xf628, 0xf629, 0xf62a, 0xf62b, + 0xf62c, 0xf62d, 0xf62e, 0xf62f, 0xf630, 0xf631, 0xf632, 0xf633, + 0x5d3e, 0x5d48, 0x5d56, 0x3dfc, 0x380f, 0x5da4, 0x5db9, 0x3820, + 0x3838, 0x5e42, 0x5ebd, 0x5f25, 0x5f83, 0x3908, 0x3914, 0x393f, + 0x394d, 0x60d7, 0x613d, 0x5ce5, 0x3989, 0x61b7, 0x61b9, 0x61cf, + 0x39b8, 0x622c, 0x6290, 0x62e5, 0x6318, 0x39f8, 0x56b1, 0x3a03, + 0x63e2, 0x63fb, 0x6407, 0x645a, 0x3a4b, 0x64c0, 0x5d15, 0x5621, + 0x9f9f, 0x3a97, 0x6586, 0x3abd, 0x65ff, 0x6653, 0x3af2, 0x6692, + 0x3b22, 0x6716, 0x3b42, 0x67a4, 0x6800, 0x3b58, 0x684a, 0x6884, + 0x3b72, 0x3b71, 0x3b7b, 0x6909, 0x6943, 0x725c, 0x6964, 0x699f, + 0x6985, 0x3bbc, 0x69d6, 0x3bdd, 0x6a65, 0x6a74, 0x6a71, 0x6a82, + 0x3bec, 0x6a99, 0x3bf2, 0x6aab, 0x6ab5, 0x6ad4, 0x6af6, 0x6b81, + 0x6bc1, 0x6bea, 0x6c75, 0x6caa, 0x3ccb, 0x6d02, 0x6d06, 0x6d26, + 0x6d81, 0x3cef, 0x6da4, 0x6db1, 0x6e15, 0x6e18, 0x6e29, 0x6e86, + 0xf694, 0x6ebb, 0x6ee2, 0x6eda, 0x9f7f, 0x6ee8, 0x6ee9, 0x6f24, + 0x6f34, 0x3d46, 0xf69e, 0x6f81, 0x6fbe, 0x3d6a, 0x3d75, 0x71b7, + 0x5c99, 0x3d8a, 0x702c, 0x3d91, 0x7050, 0x7054, 0x706f, 0x707f, + 0x7089, 0xf6ad, 0x43c1, 0x35f1, 0xf6b0, + /* 0x8e */ + 0xe311, 0x57be, 0xe313, 0x713e, 0xe315, 0x364e, 0x69a2, 0xe318, + 0x5b74, 0x7a49, 0xe31b, 0xe31c, 0x7a65, 0x7a7d, 0xe31f, 0x7abb, + 0x7ab0, 0x7ac2, 0x7ac3, 0x71d1, 0xe325, 0x41ca, 0x7ada, 0x7add, + 0x7aea, 0x41ef, 0x54b2, 0xe32c, 0x7b0b, 0x7b55, 0x7b29, 0xe330, + 0xe331, 0x7ba2, 0x7b6f, 0x839c, 0xe335, 0xe336, 0x7bd0, 0x8421, + 0x7b92, 0x7bb8, 0xe33b, 0x3dad, 0xe33d, 0x8492, 0x7bfa, 0x7c06, + 0x7c35, 0xe342, 0x7c44, 0x7c83, 0xe345, 0x7ca6, 0x667d, 0xe348, + 0x7cc9, 0x7cc7, 0x7ce6, 0x7c74, 0x7cf3, 0x7cf5, 0x7cce, 0x7e67, + 0x451d, 0xe352, 0x7d5d, 0xe354, 0x748d, 0x7d89, 0x7dab, 0x7135, + 0x7db3, 0x7dd2, 0xe35b, 0xe35c, 0x7de4, 0x3d13, 0x7df5, 0xe360, + 0x7de5, 0xe362, 0x7e1d, 0xe364, 0xe365, 0x7e6e, 0x7e92, 0x432b, + 0x946c, 0x7e27, 0x7f40, 0x7f41, 0x7f47, 0x7936, 0xe36f, 0x99e1, + 0x7f97, 0xe372, 0x7fa3, 0xe374, 0xe375, 0x455c, 0xe377, 0x4503, + 0xe379, 0x7ffa, 0xe37b, 0x8005, 0x8008, 0x801d, 0x8028, 0x802f, + 0xe381, 0xe382, 0x803b, 0x803c, 0x8061, 0xe386, 0x4989, 0xe388, + 0xe389, 0xe38a, 0x6725, 0x80a7, 0xe38d, 0x8107, 0x811a, 0x58b0, + 0xe391, 0x6c7f, 0xe393, 0xe394, 0x64e7, 0xe396, 0x8218, 0xe398, + 0x6a53, 0xe39a, 0xe39b, 0x447a, 0x8229, 0xe39e, 0xe39f, 0xe3a0, + 0x4ff9, 0xe3a2, 0x84e2, 0x8362, 0xe3a5, 0xe3a6, 0xe3a7, 0xe3a8, + 0xe3a9, 0x82aa, 0x691b, 0xe3ac, 0x41db, + /* 0x8f */ + 0x854b, 0x82d0, 0x831a, 0xe3b1, 0xe3b2, 0x36c1, 0xe3b4, 0xe3b5, + 0x827b, 0x82e2, 0x8318, 0xe3b9, 0xe3ba, 0xe3bb, 0xe3bc, 0xe3bd, + 0x3dbf, 0x831d, 0x55ec, 0x8385, 0x450b, 0xe3c3, 0x83ac, 0x83c1, + 0x83d3, 0x347e, 0xe3c8, 0x6a57, 0x855a, 0x3496, 0xe3cc, 0xe3cd, + 0x8458, 0xe3cf, 0x8471, 0x3dd3, 0x44e4, 0x6aa7, 0x844a, 0xe3d5, + 0x7958, 0x84a8, 0xe3d8, 0xe3d9, 0xe3da, 0x84de, 0x840f, 0x8391, + 0x44a0, 0x8493, 0x84e4, 0xe3e1, 0x4240, 0xe3e3, 0x4543, 0x8534, + 0x5af2, 0xe3e7, 0x4527, 0x8573, 0x4516, 0x67bf, 0x8616, 0xe3ed, + 0xe3ee, 0x85c1, 0xe3f0, 0x8602, 0xe3f2, 0xe3f3, 0xe3f4, 0x456a, + 0x8628, 0x3648, 0xe3f8, 0x53f7, 0xe3fa, 0x867e, 0x8771, 0xe3fd, + 0x87ee, 0xe3ff, 0x87b1, 0x87da, 0x880f, 0x5661, 0x866c, 0x6856, + 0x460f, 0x8845, 0x8846, 0xe409, 0xe40a, 0xe40b, 0x885e, 0x889c, + 0x465b, 0x88b4, 0x88b5, 0x63c1, 0x88c5, 0x7777, 0xe414, 0x8987, + 0x898a, 0x89a6, 0x89a9, 0x89a7, 0x89bc, 0xe41b, 0x89e7, 0xe41d, + 0xe41e, 0x8a9c, 0x7793, 0x91fe, 0x8a90, 0xe423, 0x7ae9, 0xe425, + 0xe426, 0x4713, 0xe428, 0x717c, 0x8b0c, 0x8b1f, 0xe42c, 0xe42d, + 0x8b3f, 0x8b4c, 0x8b4d, 0x8aa9, 0xe432, 0x8b90, 0x8b9b, 0x8aaf, + 0xe436, 0x4615, 0x884f, 0x8c9b, 0xe43a, 0xe43b, 0xe43c, 0x3725, + 0xe43e, 0x8cd6, 0xe440, 0xe441, 0x8d12, 0x8d03, 0xe444, 0x8cdb, + 0x705c, 0x8d11, 0xe448, 0x3ed0, 0x8d77, + /* 0x90 */ + 0x8da9, 0xe44c, 0xe44d, 0xe44e, 0x3b7c, 0xe450, 0xe451, 0x7ae7, + 0x8ead, 0x8eb6, 0x8ec3, 0x92d4, 0x8f19, 0x8f2d, 0xe459, 0xe45a, + 0x8fa5, 0x9303, 0xe45d, 0xe45e, 0x8fb3, 0x492a, 0xe461, 0xe462, + 0xe463, 0x5ef8, 0xe465, 0x8ff9, 0xe467, 0xe468, 0xe469, 0xe46a, + 0x3980, 0xe46c, 0x9037, 0xe46e, 0xe46f, 0x9061, 0xe471, 0xe472, + 0x90a8, 0xe474, 0x90c4, 0xe476, 0x90ae, 0x90fd, 0x9167, 0x3af0, + 0x91a9, 0x91c4, 0x7cac, 0xe47e, 0xe47f, 0x920e, 0x6c9f, 0x9241, + 0x9262, 0xe484, 0x92b9, 0xe486, 0xe487, 0xe488, 0xe489, 0xe48a, + 0x932c, 0x936b, 0xe48d, 0xe48e, 0x708f, 0x5ac3, 0xe491, 0xe492, + 0x4965, 0x9244, 0xe495, 0xe496, 0xe497, 0x9373, 0x945b, 0x8ebc, + 0x9585, 0x95a6, 0x9426, 0x95a0, 0x6ff6, 0x42b9, 0xe4a1, 0xe4a2, + 0xe4a3, 0xe4a4, 0x49df, 0x6c1c, 0x967b, 0x9696, 0x416c, 0x96a3, + 0xe4ab, 0x61da, 0x96b6, 0x78f5, 0xe4af, 0x96bd, 0x53cc, 0x49a1, + 0xe4b3, 0xe4b4, 0xe4b5, 0xe4b6, 0xe4b7, 0xe4b8, 0xe4b9, 0xe4ba, + 0x9731, 0x8642, 0x9736, 0x4a0f, 0x453d, 0x4585, 0xe4c1, 0x7075, + 0x5b41, 0x971b, 0x975c, 0xe4c6, 0x9757, 0x5b4a, 0xe4c9, 0x975f, + 0x9425, 0x50d0, 0xe4cd, 0xe4ce, 0x9789, 0x979f, 0x97b1, 0x97be, + 0x97c0, 0x97d2, 0x97e0, 0xe4d6, 0x97ee, 0x741c, 0xe4d9, 0x97ff, + 0x97f5, 0xe4dc, 0xe4dd, 0x4ad1, 0x9834, 0x9833, 0x984b, 0x9866, + 0x3b0e, 0xe4e4, 0x3d51, 0xe4e6, 0xe4e7, + /* 0x91 */ + 0xe4e8, 0x98ca, 0x98b7, 0x98c8, 0x98c7, 0x4aff, 0xe4ee, 0xe4ef, + 0x55b0, 0x98e1, 0x98e6, 0x98ec, 0x9378, 0x9939, 0xe4f6, 0x4b72, + 0xe4f8, 0xe4f9, 0x99f5, 0x9a0c, 0x9a3b, 0x9a10, 0x9a58, 0xe4ff, + 0x36c4, 0xe501, 0xe502, 0x9ae0, 0x9ae2, 0xe505, 0x9af4, 0x4c0e, + 0x9b14, 0x9b2d, 0xe50a, 0x5034, 0x9b34, 0xe50d, 0x38c3, 0xe50f, + 0x9b50, 0x9b40, 0xe512, 0x5a45, 0xe514, 0x9b8e, 0xe516, 0x9c02, + 0x9bff, 0x9c0c, 0xe51a, 0x9dd4, 0xe51c, 0xe51d, 0xe51e, 0xe51f, + 0xe520, 0xe521, 0x9d7e, 0x9d83, 0xe524, 0x9e0e, 0x6888, 0x9dc4, + 0xe528, 0xe529, 0xe52a, 0xe52b, 0xe52c, 0x9d39, 0xe52e, 0xe52f, + 0x9e90, 0x9e95, 0x9e9e, 0x9ea2, 0x4d34, 0x9eaa, 0x9eaf, 0xe537, + 0x9ec1, 0x3b60, 0x39e5, 0x3d1d, 0x4f32, 0x37be, 0xe53e, 0x9f02, + 0x9f08, 0x4b96, 0x9424, 0xe543, 0x9f17, 0x9f16, 0x9f39, 0x569f, + 0x568a, 0x9f45, 0x99b8, 0xe54b, 0x97f2, 0x847f, 0x9f62, 0x9f69, + 0x7adc, 0x9f8e, 0x7216, 0x4bbe, 0xe554, 0xe555, 0x7177, 0xe557, + 0xe558, 0xe559, 0x739e, 0xe55b, 0xe55c, 0x799f, 0xe55e, 0xe55f, + 0x9369, 0x93f3, 0xe562, 0x92ec, 0x9381, 0x93cb, 0xe566, 0xe567, + 0x7217, 0x3eeb, 0x7772, 0x7a43, 0x70d0, 0xe56d, 0xe56e, 0x717e, + 0xe570, 0x70a3, 0xe572, 0xe573, 0x3ec7, 0xe575, 0xe576, 0xe577, + 0x3722, 0xe579, 0xe57a, 0x36e1, 0xe57c, 0xe57d, 0xe57e, 0x3723, + 0xe580, 0x575b, 0xe582, 0xe583, 0xe584, + /* 0x92 */ + 0xe585, 0xe586, 0x8503, 0xe588, 0x8503, 0x8455, 0xe58b, 0xe58c, + 0xe58d, 0xe58e, 0xe58f, 0xe590, 0x44f4, 0xe592, 0xe593, 0xe594, + 0x67f9, 0x3733, 0x3c15, 0x3de7, 0x586c, 0xe59a, 0x6810, 0x4057, + 0xe59d, 0xe59e, 0xe59f, 0xe5a0, 0xe5a1, 0x54cb, 0x569e, 0xe5a4, + 0x5692, 0xe5a6, 0xe5a7, 0xe5a8, 0x93c6, 0xe5aa, 0x939c, 0x4ef8, + 0x512b, 0x3819, 0xe5af, 0x4ebc, 0xe5b1, 0xe5b2, 0x4f4b, 0x4f8a, + 0xe5b5, 0x5a68, 0xe5b7, 0xe5b8, 0x3999, 0xe5ba, 0xe5bb, 0x3435, + 0x4f29, 0xe5be, 0xe5bf, 0xe5c0, 0x8ada, 0xe5c2, 0x4e98, 0x50cd, + 0x510d, 0x4fa2, 0x4f03, 0xe5c8, 0xe5c9, 0x4f42, 0x502e, 0x506c, + 0x5081, 0x4fcc, 0x4fe5, 0x5058, 0x50fc, 0x5159, 0x515b, 0x515d, + 0x515e, 0x6e76, 0xe5d7, 0xe5d8, 0xe5d9, 0x6d72, 0xe5db, 0xe5dc, + 0x51a8, 0x51c3, 0xe5df, 0x44dd, 0xe5e1, 0xe5e2, 0xe5e3, 0x8d7a, + 0xe5e5, 0xe5e6, 0x5259, 0x52a4, 0xe5e9, 0x52e1, 0x936e, 0x467a, + 0x718c, 0xe5ee, 0xe5ef, 0xe5f0, 0xe5f1, 0x69d1, 0xe5f3, 0x7479, + 0x3ede, 0x7499, 0x7414, 0x7456, 0x7398, 0x4b8e, 0xe5fb, 0xe5fc, + 0x53d0, 0x3584, 0x720f, 0xe600, 0x55b4, 0xe602, 0x54cd, 0xe604, + 0x571d, 0x925d, 0x96f4, 0x9366, 0x57dd, 0x578d, 0x577f, 0x363e, + 0x58cb, 0x5a99, 0xe60f, 0xe610, 0xe611, 0xe612, 0x5a2c, 0x59b8, + 0x928f, 0x5a7e, 0x5acf, 0x5a12, 0xe619, 0xe61a, 0xe61b, 0xe61c, + 0x36f5, 0x6d05, 0x7443, 0x5a21, 0xe621, + /* 0x93 */ + 0x5a81, 0xe623, 0xe624, 0x93e0, 0x748c, 0xe627, 0x7105, 0x4972, + 0x9408, 0xe62b, 0x93bd, 0x37a0, 0x5c1e, 0x5c9e, 0x5e5e, 0x5e48, + 0xe632, 0xe633, 0xe634, 0x5ecd, 0x5b4f, 0xe637, 0xe638, 0x3701, + 0xe63a, 0x36dd, 0xe63c, 0x36d3, 0x812a, 0xe63f, 0xe640, 0xe641, + 0xe642, 0x5f0c, 0x5f0e, 0xe645, 0xe646, 0x5a6b, 0xe648, 0x5b44, + 0x8614, 0xe64b, 0x8860, 0x607e, 0xe64e, 0xe64f, 0x5fdb, 0x3eb8, + 0xe652, 0xe653, 0xe654, 0xe655, 0x61c0, 0xe657, 0xe658, 0xe659, + 0x6199, 0x6198, 0x6075, 0xe65d, 0xe65e, 0xe65f, 0xe660, 0x6471, + 0xe662, 0xe663, 0x3a29, 0xe665, 0xe666, 0xe667, 0xe668, 0x6337, + 0xe66a, 0x64b6, 0x6331, 0x63d1, 0xe66e, 0xe66f, 0x62a4, 0xe671, + 0x643b, 0x656b, 0x6972, 0x3bf4, 0xe676, 0xe677, 0xe678, 0xe679, + 0x550d, 0xe67b, 0xe67c, 0xe67d, 0x66ce, 0xe67f, 0xe680, 0x3ae0, + 0x4190, 0xe683, 0xe684, 0xe685, 0xe686, 0xe687, 0xe688, 0x78ee, + 0xe68a, 0xe68b, 0xe68c, 0x3464, 0xe68e, 0xe68f, 0xe690, 0x668e, + 0xe692, 0x666b, 0x4b93, 0x6630, 0xe696, 0xe697, 0x6663, 0xe699, + 0xe69a, 0x661e, 0xe69c, 0x38d1, 0xe69e, 0xe69f, 0x3b99, 0xe6a1, + 0xe6a2, 0x74d0, 0x3b96, 0x678f, 0xe6a6, 0x68b6, 0x681e, 0x3bc4, + 0x6abe, 0x3863, 0xe6ac, 0xe6ad, 0x6a33, 0x6a52, 0x6ac9, 0x6b05, + 0xe6b2, 0x6511, 0x6898, 0x6a4c, 0x3bd7, 0x6a7a, 0x6b57, 0xe6b9, + 0xe6ba, 0x93a0, 0x92f2, 0xe6bd, 0xe6be, + /* 0x94 */ + 0x9289, 0xe6c0, 0xe6c1, 0x9467, 0x6da5, 0x6f0b, 0xe6c5, 0x6d67, + 0xe6c7, 0x3d8f, 0x6e04, 0xe6ca, 0x5a3d, 0x6e0a, 0x5847, 0x6d24, + 0x7842, 0x713b, 0xe6d1, 0xe6d2, 0x70f1, 0x7250, 0x7287, 0x7294, + 0xe6d7, 0xe6d8, 0x5179, 0xe6da, 0xe6db, 0x747a, 0xe6dd, 0xe6de, + 0xe6df, 0xe6e0, 0xe6e1, 0x3f06, 0x3eb1, 0xe6e4, 0xe6e5, 0xe6e6, + 0x60a7, 0x3ef3, 0x74cc, 0x743c, 0x9387, 0x7437, 0x449f, 0xe6ee, + 0x4551, 0x7583, 0x3f63, 0xe6f2, 0xe6f3, 0x3f58, 0x7555, 0x7673, + 0xe6f7, 0x3b19, 0x7468, 0xe6fa, 0xe6fb, 0xe6fc, 0x3afb, 0x3dcd, + 0xe6ff, 0x3eff, 0xe701, 0xe702, 0x91fa, 0x5732, 0x9342, 0xe706, + 0xe707, 0x50df, 0xe709, 0xe70a, 0x7778, 0xe70c, 0x770e, 0x770f, + 0x777b, 0xe710, 0xe711, 0x3a5e, 0xe713, 0x7438, 0x749b, 0x3ebf, + 0xe717, 0xe718, 0x40c8, 0xe71a, 0xe71b, 0x9307, 0xe71d, 0x781e, + 0x788d, 0x7888, 0x78d2, 0x73d0, 0x7959, 0xe724, 0xe725, 0x410e, + 0x799b, 0x8496, 0x79a5, 0x6a2d, 0xe72b, 0x7a3a, 0x79f4, 0x416e, + 0xe72f, 0x4132, 0x9235, 0x79f1, 0xe733, 0xe734, 0xe735, 0xe736, + 0xe737, 0x3597, 0x556b, 0x3570, 0x36aa, 0xe73c, 0xe73d, 0x7ae2, + 0x5a59, 0xe740, 0xe741, 0xe742, 0x5a0d, 0xe744, 0x78f0, 0x5a2a, + 0xe747, 0x7afe, 0x41f9, 0x7c5d, 0x7c6d, 0x4211, 0xe74d, 0xe74e, + 0xe74f, 0x7ccd, 0xe751, 0xe752, 0x7c8e, 0x7c7c, 0x7cae, 0x6ab2, + 0x7ddc, 0x7e07, 0x7dd3, 0x7f4e, 0xe75b, + /* 0x95 */ + 0xe75c, 0xe75d, 0x7d97, 0xe75f, 0x426a, 0xe761, 0xe762, 0x67d6, + 0xe764, 0xe765, 0x57c4, 0xe767, 0xe768, 0xe769, 0x7fdd, 0x7b27, + 0xe76c, 0xe76d, 0xe76e, 0x7b0c, 0xe770, 0x99e6, 0x8645, 0x9a63, + 0x6a1c, 0xe775, 0x39e2, 0xe777, 0xe778, 0x9a1f, 0xe77a, 0x8480, + 0xe77c, 0xe77d, 0x44ea, 0x8137, 0x4402, 0x80c6, 0x8109, 0x8142, + 0xe784, 0x98c3, 0xe786, 0x8262, 0x8265, 0xe789, 0x8453, 0xe78b, + 0x8610, 0xe78d, 0x5a86, 0x417f, 0xe790, 0x5b2b, 0xe792, 0x5ae4, + 0xe794, 0x86a0, 0xe796, 0xe797, 0x882d, 0xe799, 0x5a02, 0x886e, + 0x4f45, 0x8887, 0x88bf, 0x88e6, 0x8965, 0x894d, 0xe7a2, 0x8954, + 0xe7a4, 0xe7a5, 0xe7a6, 0xe7a7, 0xe7a8, 0xe7a9, 0x3ead, 0x84a3, + 0x46f5, 0x46cf, 0x37f2, 0x8a3d, 0x8a1c, 0xe7b1, 0x5f4d, 0x922b, + 0xe7b4, 0x65d4, 0x7129, 0x70c4, 0xe7b8, 0x9d6d, 0x8c9f, 0x8ce9, + 0xe7bc, 0x599a, 0x77c3, 0x59f0, 0x436e, 0x36d4, 0x8e2a, 0x8ea7, + 0xe7c4, 0x8f30, 0x8f4a, 0x42f4, 0x6c58, 0x6fbb, 0xe7ca, 0x489b, + 0x6f79, 0x6e8b, 0xe7ce, 0x9be9, 0x36b5, 0xe7d1, 0x90bb, 0x9097, + 0x5571, 0x4906, 0x91bb, 0x9404, 0xe7d8, 0x4062, 0xe7da, 0x9427, + 0xe7dc, 0xe7dd, 0x84e5, 0x8a2b, 0x9599, 0x95a7, 0x9597, 0x9596, + 0xe7e4, 0x7445, 0x3ec2, 0xe7e7, 0xe7e8, 0xe7e9, 0x3ee7, 0xe7eb, + 0x968f, 0xe7ed, 0xe7ee, 0xe7ef, 0x3ecc, 0xe7f1, 0xe7f2, 0xe7f3, + 0x7412, 0x746b, 0x3efc, 0x9741, 0xe7f8, + /* 0x96 */ + 0x6847, 0x4a1d, 0xe7fb, 0xe7fc, 0x975d, 0x9368, 0xe7ff, 0xe800, + 0xe801, 0xe802, 0x92ba, 0x5b11, 0x8b69, 0x493c, 0x73f9, 0xe808, + 0x979b, 0x9771, 0x9938, 0xe80c, 0x5dc1, 0xe80e, 0xe80f, 0x981f, + 0xe811, 0x92f6, 0xe813, 0x91e5, 0x44c0, 0xe816, 0xe817, 0xe818, + 0x98dc, 0xe81a, 0x3f00, 0x922a, 0x4925, 0x8414, 0x993b, 0x994d, + 0xe821, 0x3dfd, 0x999b, 0x4b6f, 0x99aa, 0x9a5c, 0xe827, 0xe828, + 0x6a8f, 0x9a21, 0x5afe, 0x9a2f, 0xe82d, 0x4b90, 0xe82f, 0x99bc, + 0x4bbd, 0x4b97, 0x937d, 0x5872, 0xe835, 0x5822, 0xe837, 0xe838, + 0x7844, 0xe83a, 0xe83b, 0x68c5, 0x3d7d, 0x9458, 0x3927, 0x6150, + 0xe841, 0xe842, 0x6107, 0x9c4f, 0x9c53, 0x9c7b, 0x9c35, 0x9c10, + 0x9b7f, 0x9bcf, 0xe84b, 0x9b9f, 0xe84d, 0xe84e, 0x9d21, 0x4cae, + 0xe851, 0x9e18, 0x4cb0, 0x9d0c, 0xe855, 0xe856, 0xe857, 0xe858, + 0x9da5, 0x84bd, 0xe85b, 0xe85c, 0xe85d, 0x85fc, 0x4533, 0xe860, + 0xe861, 0xe862, 0x8420, 0x85ee, 0xe865, 0xe866, 0xe867, 0x79e2, + 0xe869, 0xe86a, 0x492d, 0xe86c, 0x3d62, 0x93db, 0x92be, 0x9348, + 0xe871, 0x78b9, 0x9277, 0x944d, 0x4fe4, 0x3440, 0x9064, 0xe878, + 0x783d, 0x7854, 0x78b6, 0x784b, 0xe87d, 0xe87e, 0xe87f, 0x369a, + 0x4f72, 0x6fda, 0x6fd9, 0x701e, 0x701e, 0x5414, 0xe887, 0x57bb, + 0x58f3, 0x578a, 0x9d16, 0x57d7, 0x7134, 0x34af, 0xe88f, 0x71eb, + 0xe891, 0xe892, 0x5b28, 0xe894, 0xe895, + /* 0x97 */ + 0x610c, 0x5ace, 0x5a0b, 0x42bc, 0xe89a, 0x372c, 0x4b7b, 0xe89d, + 0x93bb, 0x93b8, 0xe8a0, 0xe8a1, 0x8472, 0xe8a3, 0xe8a4, 0xe8a5, + 0xe8a6, 0xe8a7, 0x5994, 0xe8a9, 0xe8aa, 0x7da8, 0xe8ac, 0xe8ad, + 0xe8ae, 0xe8af, 0xe8b0, 0x92e5, 0x73e2, 0x3ee9, 0x74b4, 0xe8b5, + 0xe8b6, 0x3ee1, 0xe8b8, 0x6ad8, 0x73f3, 0x73fb, 0x3ed6, 0xe8bd, + 0xe8be, 0xe8bf, 0xe8c0, 0xe8c1, 0xe8c2, 0xe8c3, 0x7448, 0xe8c5, + 0x70a5, 0xe8c7, 0x9284, 0x73e6, 0x935f, 0xe8cb, 0x9331, 0xe8cd, + 0xe8ce, 0x9386, 0xe8d0, 0xe8d1, 0x4935, 0xe8d3, 0x716b, 0xe8d5, + 0xe8d6, 0x56a4, 0xe8d8, 0xe8d9, 0xe8da, 0x5502, 0x79c4, 0xe8dd, + 0x7dfe, 0xe8df, 0xe8e0, 0xe8e1, 0x452e, 0x9401, 0x370a, 0xe8e5, + 0xe8e6, 0x59b0, 0xe8e8, 0xe8e9, 0xe8ea, 0x5aa1, 0x36e2, 0xe8ed, + 0x36b0, 0x925f, 0x5a79, 0xe8f1, 0xe8f2, 0x9374, 0x3ccd, 0xe8f5, + 0x4a96, 0x398a, 0x50f4, 0x3d69, 0x3d4c, 0xe8fb, 0x7175, 0x42fb, + 0xe8fe, 0x6e0f, 0xe900, 0x44eb, 0x6d57, 0xe903, 0x7067, 0x6caf, + 0x3cd6, 0xe907, 0xe908, 0x6e02, 0x6f0c, 0x3d6f, 0xe90c, 0x7551, + 0x36bc, 0x34c8, 0x4680, 0x3eda, 0x4871, 0x59c4, 0x926e, 0x493e, + 0x8f41, 0xe917, 0xe918, 0x5812, 0x57c8, 0x36d6, 0xe91c, 0x70fe, + 0xe91e, 0xe91f, 0xe920, 0xe921, 0xe922, 0x68b9, 0x6967, 0xe925, + 0xe926, 0xe927, 0xe928, 0xe929, 0xe92a, 0xe92b, 0xe92c, 0x6a1a, + 0xe92e, 0xe92f, 0x843e, 0x44df, 0x44ce, + /* 0x98 */ + 0xe933, 0xe934, 0xe935, 0xe936, 0x6f17, 0xe938, 0x833d, 0xe93a, + 0x83ed, 0xe93c, 0xe93d, 0xe93e, 0x5989, 0x5a82, 0xe941, 0x5a61, + 0x5a71, 0xe944, 0xe945, 0x372d, 0x59ef, 0xe948, 0x36c7, 0x718e, + 0x9390, 0x669a, 0xe94d, 0x5a6e, 0x5a2b, 0xe950, 0x6a2b, 0xe952, + 0xe953, 0xe954, 0xe955, 0x711d, 0xe957, 0xe958, 0x4fb0, 0xe95a, + 0x5cc2, 0xe95c, 0xe95d, 0xe95e, 0x6a0c, 0xe960, 0xe961, 0x70a6, + 0x7133, 0xe964, 0x3da5, 0x6cdf, 0xe967, 0xe968, 0x7e65, 0x59eb, + 0x5d2f, 0x3df3, 0x5f5c, 0xe96e, 0xe96f, 0x7da4, 0x8426, 0x5485, + 0xe973, 0xe974, 0xe975, 0x577e, 0xe977, 0xe978, 0x3fe5, 0xe97a, + 0xe97b, 0x7003, 0xe97d, 0x5d70, 0x738f, 0x7cd3, 0xe981, 0xe982, + 0x4fc8, 0x7fe7, 0x72cd, 0x7310, 0xe987, 0x7338, 0x7339, 0xe98a, + 0x7341, 0x7348, 0x3ea9, 0xe98e, 0x906c, 0x71f5, 0xe991, 0x73e1, + 0x81f6, 0x3eca, 0x770c, 0x3ed1, 0x6ca2, 0x56fd, 0x7419, 0x741e, + 0x741f, 0x3ee2, 0x3ef0, 0x3ef4, 0x3efa, 0x74d3, 0x3f0e, 0x3f53, + 0x7542, 0x756d, 0x7572, 0x758d, 0x3f7c, 0x75c8, 0x75dc, 0x3fc0, + 0x764d, 0x3fd7, 0x7674, 0x3fdc, 0x767a, 0xe9b0, 0x7188, 0x5623, + 0x8980, 0x5869, 0x401d, 0x7743, 0x4039, 0x6761, 0x4045, 0x35db, + 0x7798, 0x406a, 0x406f, 0x5c5e, 0x77be, 0x77cb, 0x58f2, 0x7818, + 0x70b9, 0x781c, 0x40a8, 0x7839, 0x7847, 0x7851, 0x7866, 0x8448, + 0xe9cb, 0x7933, 0x6803, 0x7932, 0x4103, + /* 0x99 */ + 0x4109, 0x7991, 0x7999, 0x8fbb, 0x7a06, 0x8fbc, 0x4167, 0x7a91, + 0x41b2, 0x7abc, 0x8279, 0x41c4, 0x7acf, 0x7adb, 0x41cf, 0x4e21, + 0x7b62, 0x7b6c, 0x7b7b, 0x7c12, 0x7c1b, 0x4260, 0x427a, 0x7c7b, + 0x7c9c, 0x428c, 0x7cb8, 0x4294, 0x7ced, 0x8f93, 0x70c0, 0xe9ef, + 0x7dcf, 0x7dd4, 0x7dd0, 0x7dfd, 0x7fae, 0x7fb4, 0x729f, 0x4397, + 0x8020, 0x8025, 0x7b39, 0x802e, 0x8031, 0x8054, 0x3dcc, 0x57b4, + 0x70a0, 0x80b7, 0x80e9, 0x43ed, 0x810c, 0x732a, 0x810e, 0x8112, + 0x7560, 0x8114, 0x4401, 0x3b39, 0x8156, 0x8159, 0x815a, 0x4413, + 0x583a, 0x817c, 0x8184, 0x4425, 0x8193, 0x442d, 0x81a5, 0x57ef, + 0x81c1, 0x81e4, 0x8254, 0x448f, 0x82a6, 0x8276, 0x82ca, 0x82d8, + 0x82ff, 0x44b0, 0x8357, 0x9669, 0x698a, 0x8405, 0x70f5, 0x8464, + 0x60e3, 0x8488, 0x4504, 0x84be, 0x84e1, 0x84f8, 0x8510, 0x8538, + 0x8552, 0x453b, 0x856f, 0x8570, 0x85e0, 0x4577, 0x8672, 0x8692, + 0x86b2, 0x86ef, 0x9645, 0x878b, 0x4606, 0x4617, 0x88ae, 0x88ff, + 0x8924, 0x8947, 0x8991, 0xea43, 0x8a29, 0x8a38, 0x8a94, 0x8ab4, + 0x8c51, 0x8cd4, 0x8cf2, 0x8d1c, 0x4798, 0x585f, 0x8dc3, 0x47ed, + 0x4eee, 0x8e3a, 0x55d8, 0x5754, 0x8e71, 0x55f5, 0x8eb0, 0x4837, + 0x8ece, 0x8ee2, 0x8ee4, 0x8eed, 0x8ef2, 0x8fb7, 0x8fc1, 0x8fca, + 0x8fcc, 0x9033, 0x99c4, 0x48ad, 0x98e0, 0x9213, 0x491e, 0x9228, + 0x9258, 0x926b, 0x92b1, 0x92ae, 0x92bf, + /* 0x9a */ + 0x92e3, 0x92eb, 0x92f3, 0x92f4, 0x92fd, 0x9343, 0x9384, 0x93ad, + 0x4945, 0x4951, 0x9ebf, 0x9417, 0x5301, 0x941d, 0x942d, 0x943e, + 0x496a, 0x9454, 0x9479, 0x952d, 0x95a2, 0x49a7, 0x95f4, 0x9633, + 0x49e5, 0x67a0, 0x4a24, 0x9740, 0x4a35, 0x97b2, 0x97c2, 0x5654, + 0x4ae4, 0x60e8, 0x98b9, 0x4b19, 0x98f1, 0x5844, 0x990e, 0x9919, + 0x51b4, 0x991c, 0x9937, 0x9942, 0x995d, 0x9962, 0x4b70, 0x99c5, + 0x4b9d, 0x9a3c, 0x9b0f, 0x7a83, 0x9b69, 0x9b81, 0x9bdd, 0x9bf1, + 0x9bf4, 0x4c6d, 0x9c20, 0x376f, 0xeaa9, 0x9d49, 0x9c3a, 0x9efe, + 0x5650, 0x9d93, 0x9dbd, 0x9dc0, 0x9dfc, 0x94f6, 0x8fb6, 0x9e7b, + 0x9eac, 0x9eb1, 0x9ebd, 0x9ec6, 0x94dc, 0x9ee2, 0x9ef1, 0x9ef8, + 0x7ac8, 0x9f44, 0xeabf, 0xeac0, 0xeac1, 0x691a, 0x94c3, 0x59ac, + 0xeac5, 0x5840, 0x94c1, 0x37b9, 0xeac9, 0xeaca, 0xeacb, 0xeacc, + 0x5757, 0x7173, 0xeacf, 0xead0, 0xead1, 0x546a, 0xead3, 0xead4, + 0x549e, 0xead6, 0xead7, 0xead8, 0xead9, 0xeada, 0x60e7, 0xeadc, + 0x567a, 0xeade, 0xeadf, 0xeae0, 0xeae1, 0xeae2, 0xeae3, 0x6955, + 0x9c2f, 0x87a5, 0xeae7, 0xeae8, 0xeae9, 0xeaea, 0xeaeb, 0xeaec, + 0x5c20, 0xeaee, 0x5e0b, 0xeaf0, 0xeaf1, 0xeaf2, 0x671e, 0xeaf4, + 0xeaf5, 0xeaf6, 0x3647, 0xeaf8, 0xeaf9, 0xeafa, 0xeafb, 0x5364, + 0x84ad, 0xeafe, 0xeaff, 0xeb00, 0x8b81, 0xeb02, 0xeb03, 0xeb04, + 0xeb05, 0x4e78, 0x70bb, 0xeb08, 0xeb09, + /* 0x9b */ + 0xeb0a, 0xeb0b, 0xeb0c, 0xeb0d, 0xeb0e, 0xeb0f, 0x62c3, 0xeb11, + 0xeb12, 0x7198, 0x6855, 0xeb15, 0x69e9, 0x36c8, 0xeb18, 0xeb19, + 0xeb1a, 0xeb1b, 0xeb1c, 0xeb1d, 0x82fd, 0xeb1f, 0xeb20, 0xeb21, + 0x89a5, 0xeb23, 0x8fa0, 0xeb25, 0x97b8, 0xeb27, 0x9847, 0x9abd, + 0xeb2a, 0xeb2b, 0xeb2c, 0xeb2d, 0xeb2e, 0xeb2f, 0xeb30, 0xeb31, + 0xeb32, 0xeb33, 0xeb34, 0xeb35, 0xeb36, 0xeb37, 0xeb38, 0xeb39, + 0x5fb1, 0x6648, 0x66bf, 0xeb3d, 0xeb3e, 0xeb3f, 0x7201, 0xeb41, + 0x77d7, 0xeb43, 0xeb44, 0x7e87, 0xeb46, 0x58b5, 0x670e, 0x6918, + 0xeb4a, 0xeb4b, 0xeb4c, 0xeb4d, 0xeb4e, 0xeb4f, 0xeb50, 0x48d0, + 0x4ab8, 0xeb53, 0xeb54, 0xeb55, 0xeb56, 0xeb57, 0xeb58, 0xeb59, + 0xeb5a, 0xeb5b, 0x51d2, 0xeb5d, 0x599f, 0xeb5f, 0x3bbe, 0xeb61, + 0xeb62, 0xeb63, 0x5788, 0xeb65, 0x399b, 0xeb67, 0xeb68, 0xeb69, + 0x3762, 0xeb6b, 0x8b5e, 0xeb6d, 0x99d6, 0xeb6f, 0xeb70, 0xeb71, + 0x7209, 0xeb73, 0xeb74, 0x5965, 0xeb76, 0xeb77, 0xeb78, 0x8eda, + 0xeb7a, 0x528f, 0x573f, 0x7171, 0xeb7e, 0xeb7f, 0xeb80, 0xeb81, + 0x55bc, 0xeb83, 0xeb84, 0xeb85, 0x91d4, 0x3473, 0xeb88, 0xeb89, + 0xeb8a, 0x4718, 0xeb8c, 0xeb8d, 0xeb8e, 0xeb8f, 0xeb90, 0x5066, + 0x34fb, 0xeb93, 0x60de, 0xeb95, 0x477c, 0xeb97, 0xeb98, 0xeb99, + 0xeb9a, 0xeb9b, 0x57a1, 0x7151, 0x6fb6, 0xeb9f, 0xeba0, 0x9056, + 0xeba2, 0xeba3, 0x8b62, 0xeba5, 0xeba6, + /* 0x9c */ + 0x5d5b, 0xeba8, 0x8f36, 0xebaa, 0xebab, 0x8aea, 0xebad, 0xebae, + 0xebaf, 0xebb0, 0x4bc0, 0xebb2, 0xebb3, 0xebb4, 0x9465, 0xebb6, + 0x6195, 0x5a27, 0xebb9, 0x4fbb, 0x56b9, 0xebbc, 0xebbd, 0x4e6a, + 0xebbf, 0x9656, 0x6d8f, 0xebc2, 0x3618, 0x8977, 0xebc5, 0xebc6, + 0xebc7, 0xebc8, 0x71df, 0xebca, 0x7b42, 0xebcc, 0xebcd, 0xebce, + 0x9104, 0xebd0, 0x7a45, 0x9df0, 0xebd3, 0x9a26, 0xebd5, 0x365f, + 0xebd7, 0xebd8, 0x7983, 0xebda, 0xebdb, 0x5d2c, 0xebdd, 0x83cf, + 0xebdf, 0x46d0, 0xebe1, 0x753b, 0x8865, 0xebe4, 0x58b6, 0x371c, + 0xebe7, 0xebe8, 0xebe9, 0x3c54, 0xebeb, 0xebec, 0x9281, 0xebee, + 0xebef, 0x9330, 0xebf1, 0xebf2, 0x6c39, 0x949f, 0xebf5, 0xebf6, + 0x8827, 0x88f5, 0xebf9, 0xebfa, 0xebfb, 0x6eb8, 0xebfd, 0xebfe, + 0x39a4, 0x36b9, 0x5c10, 0x79e3, 0x453f, 0x66b6, 0xec05, 0xec06, + 0x8943, 0xec08, 0xec09, 0x56d6, 0x40df, 0xec0c, 0x39a1, 0xec0e, + 0xec0f, 0xec10, 0x71ad, 0x8366, 0xec13, 0xec14, 0x5a67, 0x4cb7, + 0xec17, 0xec18, 0xec19, 0xec1a, 0xec1b, 0xec1c, 0xec1d, 0x7b43, + 0x797e, 0xec20, 0x6fb5, 0xec22, 0x6a03, 0xec24, 0x53a2, 0xec26, + 0x93bf, 0x6836, 0x975d, 0xec2a, 0xec2b, 0xec2c, 0xec2d, 0xec2e, + 0xec2f, 0x5d85, 0xec31, 0xec32, 0x5715, 0x9823, 0xec35, 0x5dab, + 0xec37, 0x65be, 0x69d5, 0x53d2, 0xec3b, 0xec3c, 0x3c11, 0x6736, + 0xec3f, 0xec40, 0xec41, 0xec42, 0xec43, + /* 0x9d */ + 0xec44, 0xec45, 0xec46, 0xec47, 0xec48, 0xec49, 0x35ca, 0xec4b, + 0xec4c, 0x48fa, 0x63e6, 0xec4f, 0x7808, 0x9255, 0xec52, 0x43f2, + 0xec54, 0x43df, 0xec56, 0xec57, 0xec58, 0x59f8, 0xec5a, 0x8f0b, + 0xec5c, 0xec5d, 0x7b51, 0xec5f, 0xec60, 0x3df7, 0xec62, 0xec63, + 0x8fd0, 0x728f, 0x568b, 0xec67, 0xec68, 0xec69, 0xec6a, 0xec6b, + 0xec6c, 0xec6d, 0xec6e, 0xec6f, 0xec70, 0xec71, 0xec72, 0xec73, + 0x7e9f, 0xec75, 0xec76, 0x4ca4, 0x9547, 0xec79, 0x71a2, 0xec7b, + 0x4d91, 0x9012, 0xec7e, 0x4d9c, 0xec80, 0x8fbe, 0x55c1, 0x8fba, + 0xec84, 0x8fb9, 0xec86, 0x4509, 0x7e7f, 0x6f56, 0x6ab1, 0x4eea, + 0x34e4, 0xec8d, 0xec8e, 0x373a, 0x8e80, 0xec91, 0xec92, 0xec93, + 0xec94, 0xec95, 0xec96, 0x3deb, 0xec98, 0xec99, 0xec9a, 0xec9b, + 0x4e9a, 0xec9d, 0xec9e, 0x56bf, 0xeca0, 0x8e0e, 0x5b6d, 0xeca3, + 0xeca4, 0x63de, 0x62d0, 0xeca7, 0xeca8, 0x6530, 0x562d, 0xecab, + 0x541a, 0xecad, 0x3dc6, 0xecaf, 0x4c7d, 0x5622, 0x561e, 0x7f49, + 0xecb4, 0x5975, 0xecb6, 0x8770, 0x4e1c, 0xecb9, 0xecba, 0xecbb, + 0x8117, 0x9d5e, 0x8d18, 0x763b, 0x9c45, 0x764e, 0x77b9, 0x9345, + 0x5432, 0x8148, 0x82f7, 0x5625, 0x8132, 0x8418, 0x80bd, 0x55ea, + 0x7962, 0x5643, 0x5416, 0xeccf, 0x35ce, 0x5605, 0x55f1, 0x66f1, + 0xecd4, 0x362d, 0x7534, 0x55f0, 0x55ba, 0x5497, 0x5572, 0xecdb, + 0xecdc, 0x5ed0, 0xecde, 0xecdf, 0xece0, + /* 0x9e */ + 0xece1, 0x9eab, 0x7d5a, 0x55de, 0xece5, 0x629d, 0x976d, 0x5494, + 0x8ccd, 0x71f6, 0x9176, 0x63fc, 0x63b9, 0x63fe, 0x5569, 0xecf0, + 0x9c72, 0xecf2, 0x519a, 0x34df, 0xecf5, 0x51a7, 0x544d, 0x551e, + 0x5513, 0x7666, 0x8e2d, 0xecfc, 0x75b1, 0x80b6, 0x8804, 0x8786, + 0x88c7, 0x81b6, 0x841c, 0xed04, 0x44ec, 0x7304, 0xed07, 0x5b90, + 0x830b, 0xed0a, 0x567b, 0xed0c, 0xed0d, 0xed0e, 0xed0f, 0xed10, + 0xed11, 0x9170, 0xed13, 0x9208, 0xed15, 0xed16, 0xed17, 0xed18, + 0x7266, 0xed1a, 0x474e, 0xed1c, 0xed1d, 0xed1e, 0x40fa, 0x9c5d, + 0x651f, 0xed22, 0x48f3, 0xed24, 0xed25, 0xed26, 0xed27, 0x6062, + 0xed29, 0xed2a, 0xed2b, 0xed2c, 0xed2d, 0x71a3, 0x7e8e, 0x9d50, + 0x4e1a, 0x4e04, 0x3577, 0x5b0d, 0x6cb2, 0x5367, 0x36ac, 0x39dc, + 0x537d, 0x36a5, 0xed3b, 0x589a, 0xed3d, 0x822d, 0x544b, 0x57aa, + 0xed41, 0xed42, 0xed43, 0x3a52, 0xed45, 0x7374, 0xed47, 0x4d09, + 0x9bed, 0xed4a, 0xed4b, 0x4c5b, 0xed4d, 0xed4e, 0xed4f, 0x845c, + 0xed51, 0xed52, 0xed53, 0xed54, 0x632e, 0x7d25, 0xed57, 0xed58, + 0x3a2a, 0x9008, 0x52cc, 0x3e74, 0x367a, 0x45e9, 0xed5f, 0x7640, + 0x5af0, 0xed62, 0x787a, 0x47b6, 0x58a7, 0x40bf, 0x567c, 0x9b8b, + 0x5d74, 0x7654, 0xed6b, 0x9e85, 0x4ce1, 0x75f9, 0x37fb, 0x6119, + 0xed71, 0xed72, 0xed73, 0x565d, 0xed75, 0x57a7, 0xed77, 0xed78, + 0x5234, 0xed7a, 0x35ad, 0x6c4a, 0x9d7c, + /* 0x9f */ + 0x7c56, 0x9b39, 0x57de, 0xed81, 0x5c53, 0x64d3, 0xed84, 0xed85, + 0xed86, 0x86ad, 0xed88, 0xed89, 0xed8a, 0xed8b, 0xed8c, 0x51fe, + 0xed8e, 0x5d8e, 0x9703, 0xed91, 0x9e81, 0x904c, 0x7b1f, 0x9b02, + 0x5cd1, 0x7ba3, 0x6268, 0x6335, 0x9aff, 0x7bcf, 0x9b2a, 0x7c7e, + 0x9b2e, 0x7c42, 0x7c86, 0x9c15, 0x7bfc, 0x9b09, 0x9f17, 0x9c1b, + 0xeda6, 0x9f5a, 0x5573, 0x5bc3, 0x4ffd, 0x9e98, 0x4ff2, 0x5260, + 0x3e06, 0x52d1, 0x5767, 0x5056, 0x59b7, 0x5e12, 0x97c8, 0x9dab, + 0x8f5c, 0x5469, 0x97b4, 0x9940, 0x97ba, 0x532c, 0x6130, 0x692c, + 0x53da, 0x9c0a, 0x9d02, 0x4c3b, 0x9641, 0x6980, 0x50a6, 0x7546, + 0xedc6, 0x99da, 0x5273, 0xedc9, 0x9159, 0x9681, 0x915c, 0xedcd, + 0x9151, 0xedcf, 0x637f, 0xedd1, 0x6aca, 0x5611, 0x918e, 0x757a, + 0x6285, 0xedd7, 0x734f, 0x7c70, 0xedda, 0xeddb, 0xeddc, 0xeddd, + 0x76d6, 0x9b9d, 0x4e2a, 0xede1, 0x83be, 0x8842, 0xede4, 0x5c4a, + 0x69c0, 0x50ed, 0x577a, 0x521f, 0x5df5, 0x4ece, 0x6c31, 0xeded, + 0x4f39, 0x549c, 0x54da, 0x529a, 0x8d82, 0x35fe, 0x5f0c, 0x35f3, + 0xedf6, 0x6b52, 0x917c, 0x9fa5, 0x9b97, 0x982e, 0x98b4, 0x9aba, + 0x9ea8, 0x9e84, 0x717a, 0x7b14, 0xee02, 0x6bfa, 0x8818, 0x7f78, + 0xee06, 0x5620, 0xee08, 0x8e77, 0x9f53, 0xee0b, 0x8dd4, 0x8e4f, + 0x9e1c, 0x8e01, 0x6282, 0xee11, 0x8e28, 0x8e75, 0x7ad3, 0xee15, + 0x7a3e, 0x78d8, 0x6cea, 0x8a67, 0x7607, + /* 0xa0 */ + 0xee1b, 0x9f26, 0x6cce, 0x87d6, 0x75c3, 0xee20, 0x7853, 0xee22, + 0x8d0c, 0x72e2, 0x7371, 0x8b2d, 0x7302, 0x74f1, 0x8ceb, 0xee2a, + 0x862f, 0x5fba, 0x88a0, 0x44b7, 0xee2f, 0xee30, 0xee31, 0xee32, + 0x8a7e, 0xee34, 0xee35, 0x60fd, 0x7667, 0x9ad7, 0x9d44, 0x936e, + 0x9b8f, 0x87f5, 0xee3d, 0x880f, 0x8cf7, 0x732c, 0x9721, 0x9bb0, + 0x35d6, 0x72b2, 0x4c07, 0x7c51, 0x994a, 0xee48, 0x6159, 0x4c04, + 0x9e96, 0x617d, 0xee4d, 0x575f, 0x616f, 0x62a6, 0x6239, 0x62ce, + 0x3a5c, 0x61e2, 0x53aa, 0xee56, 0x6364, 0x6802, 0x35d2, 0x5d57, + 0xee5b, 0x8fda, 0xee5d, 0xee5e, 0x50d9, 0xee60, 0x7906, 0x5332, + 0x9638, 0xee64, 0x4065, 0xee66, 0x77fe, 0xee68, 0x7cc2, 0xee6a, + 0x7cda, 0x7a2d, 0x8066, 0x8063, 0x7d4d, 0x7505, 0x74f2, 0x8994, + 0x821a, 0x670c, 0x8062, 0xee76, 0x805b, 0x74f0, 0x8103, 0x7724, + 0x8989, 0xee7c, 0x7553, 0xee7e, 0x87a9, 0x87ce, 0x81c8, 0x878c, + 0x8a49, 0x8cad, 0x8b43, 0x772b, 0x74f8, 0x84da, 0x3635, 0x69b2, + 0x8da6, 0xee8c, 0x89a9, 0x7468, 0x6db9, 0x87c1, 0xee91, 0x74e7, + 0x3ddb, 0x7176, 0x60a4, 0x619c, 0x3cd1, 0x7162, 0x6077, 0xee9a, + 0x7f71, 0xee9c, 0x7250, 0x60e9, 0x4b7e, 0x5220, 0x3c18, 0xeea2, + 0xeea3, 0xeea4, 0xeea5, 0xeea6, 0xeea7, 0xeea8, 0xeea9, 0xeeaa, + 0x5cc1, 0xeeac, 0xeead, 0xeeae, 0xeeaf, 0xeeb0, 0xeeb1, 0x4562, + 0x5b1f, 0xeeb4, 0x9f50, 0x9ea6, 0xeeb7, + /* 0xa1 */ + 0x3000, 0xff0c, 0x3001, 0x3002, 0xff0e, 0x2027, 0xff1b, 0xff1a, + 0xff1f, 0xff01, 0xfe30, 0x2026, 0x2025, 0xfe50, 0xfe51, 0xfe52, + 0x00b7, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xff5c, 0x2013, 0xfe31, + 0x2014, 0xfe33, 0x2574, 0xfe34, 0xfe4f, 0xff08, 0xff09, 0xfe35, + 0xfe36, 0xff5b, 0xff5d, 0xfe37, 0xfe38, 0x3014, 0x3015, 0xfe39, + 0xfe3a, 0x3010, 0x3011, 0xfe3b, 0xfe3c, 0x300a, 0x300b, 0xfe3d, + 0xfe3e, 0x3008, 0x3009, 0xfe3f, 0xfe40, 0x300c, 0x300d, 0xfe41, + 0xfe42, 0x300e, 0x300f, 0xfe43, 0xfe44, 0xfe59, 0xfe5a, 0xfe5b, + 0xfe5c, 0xfe5d, 0xfe5e, 0x2018, 0x2019, 0x201c, 0x201d, 0x301d, + 0x301e, 0x2035, 0x2032, 0xff03, 0xff06, 0xff0a, 0x203b, 0x00a7, + 0x3003, 0x25cb, 0x25cf, 0x25b3, 0x25b2, 0x25ce, 0x2606, 0x2605, + 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25bd, 0x25bc, 0x32a3, 0x2105, + 0x00af, 0xffe3, 0xff3f, 0x02cd, 0xfe49, 0xfe4a, 0xfe4d, 0xfe4e, + 0xfe4b, 0xfe4c, 0xfe5f, 0xfe60, 0xfe61, 0xff0b, 0xff0d, 0x00d7, + 0x00f7, 0x00b1, 0x221a, 0xff1c, 0xff1e, 0xff1d, 0x2266, 0x2267, + 0x2260, 0x221e, 0x2252, 0x2261, 0xfe62, 0xfe63, 0xfe64, 0xfe65, + 0xfe66, 0xff5e, 0x2229, 0x222a, 0x22a5, 0x2220, 0x221f, 0x22bf, + 0x33d2, 0x33d1, 0x222b, 0x222e, 0x2235, 0x2234, 0x2640, 0x2642, + 0x2295, 0x2299, 0x2191, 0x2193, 0x2190, 0x2192, 0x2196, 0x2197, + 0x2199, 0x2198, 0x2225, 0x2223, 0xff0f, + /* 0xa2 */ + 0xff3c, 0x2215, 0xfe68, 0xff04, 0xffe5, 0x3012, 0xffe0, 0xffe1, + 0xff05, 0xff20, 0x2103, 0x2109, 0xfe69, 0xfe6a, 0xfe6b, 0x33d5, + 0x339c, 0x339d, 0x339e, 0x33ce, 0x33a1, 0x338e, 0x338f, 0x33c4, + 0x00b0, 0x5159, 0x515b, 0x515e, 0x515d, 0x5161, 0x5163, 0x55e7, + 0x74e9, 0x7cce, 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, + 0x2587, 0x2588, 0x258f, 0x258e, 0x258d, 0x258c, 0x258b, 0x258a, + 0x2589, 0x253c, 0x2534, 0x252c, 0x2524, 0x251c, 0x2594, 0x2500, + 0x2502, 0x2595, 0x250c, 0x2510, 0x2514, 0x2518, 0x256d, 0x256e, + 0x2570, 0x256f, 0x2550, 0x255e, 0x256a, 0x2561, 0x25e2, 0x25e3, + 0x25e5, 0x25e4, 0x2571, 0x2572, 0x2573, 0xff10, 0xff11, 0xff12, + 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, 0xff19, 0x2160, + 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, + 0x2169, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, + 0x3028, 0x3029, 0x5341, 0x5344, 0x5345, 0xff21, 0xff22, 0xff23, + 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, 0xff29, 0xff2a, 0xff2b, + 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, 0xff31, 0xff32, 0xff33, + 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, 0xff39, 0xff3a, 0xff41, + 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, 0xff49, + 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, 0xff51, + 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, + /* 0xa3 */ + 0xff57, 0xff58, 0xff59, 0xff5a, 0x0391, 0x0392, 0x0393, 0x0394, + 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, + 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x03a4, 0x03a5, + 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03b1, 0x03b2, 0x03b3, 0x03b4, + 0x03b5, 0x03b6, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, + 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x03c4, 0x03c5, + 0x03c6, 0x03c7, 0x03c8, 0x03c9, 0x3105, 0x3106, 0x3107, 0x3108, + 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, + 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, + 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, + 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, + 0x3129, 0x02d9, 0x02c9, 0x02ca, 0x02c7, 0x02cb, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa4 */ + 0x4e00, 0x4e59, 0x4e01, 0x4e03, 0x4e43, 0x4e5d, 0x4e86, 0x4e8c, + 0x4eba, 0x513f, 0x5165, 0x516b, 0x51e0, 0x5200, 0x5201, 0x529b, + 0x5315, 0x5341, 0x535c, 0x53c8, 0x4e09, 0x4e0b, 0x4e08, 0x4e0a, + 0x4e2b, 0x4e38, 0x51e1, 0x4e45, 0x4e48, 0x4e5f, 0x4e5e, 0x4e8e, + 0x4ea1, 0x5140, 0x5203, 0x52fa, 0x5343, 0x53c9, 0x53e3, 0x571f, + 0x58eb, 0x5915, 0x5927, 0x5973, 0x5b50, 0x5b51, 0x5b53, 0x5bf8, + 0x5c0f, 0x5c22, 0x5c38, 0x5c71, 0x5ddd, 0x5de5, 0x5df1, 0x5df2, + 0x5df3, 0x5dfe, 0x5e72, 0x5efe, 0x5f0b, 0x5f13, 0x624d, 0x4e11, + 0x4e10, 0x4e0d, 0x4e2d, 0x4e30, 0x4e39, 0x4e4b, 0x5c39, 0x4e88, + 0x4e91, 0x4e95, 0x4e92, 0x4e94, 0x4ea2, 0x4ec1, 0x4ec0, 0x4ec3, + 0x4ec6, 0x4ec7, 0x4ecd, 0x4eca, 0x4ecb, 0x4ec4, 0x5143, 0x5141, + 0x5167, 0x516d, 0x516e, 0x516c, 0x5197, 0x51f6, 0x5206, 0x5207, + 0x5208, 0x52fb, 0x52fe, 0x52ff, 0x5316, 0x5339, 0x5348, 0x5347, + 0x5345, 0x535e, 0x5384, 0x53cb, 0x53ca, 0x53cd, 0x58ec, 0x5929, + 0x592b, 0x592a, 0x592d, 0x5b54, 0x5c11, 0x5c24, 0x5c3a, 0x5c6f, + 0x5df4, 0x5e7b, 0x5eff, 0x5f14, 0x5f15, 0x5fc3, 0x6208, 0x6236, + 0x624b, 0x624e, 0x652f, 0x6587, 0x6597, 0x65a4, 0x65b9, 0x65e5, + 0x66f0, 0x6708, 0x6728, 0x6b20, 0x6b62, 0x6b79, 0x6bcb, 0x6bd4, + 0x6bdb, 0x6c0f, 0x6c34, 0x706b, 0x722a, 0x7236, 0x723b, 0x7247, + 0x7259, 0x725b, 0x72ac, 0x738b, 0x4e19, + /* 0xa5 */ + 0x4e16, 0x4e15, 0x4e14, 0x4e18, 0x4e3b, 0x4e4d, 0x4e4f, 0x4e4e, + 0x4ee5, 0x4ed8, 0x4ed4, 0x4ed5, 0x4ed6, 0x4ed7, 0x4ee3, 0x4ee4, + 0x4ed9, 0x4ede, 0x5145, 0x5144, 0x5189, 0x518a, 0x51ac, 0x51f9, + 0x51fa, 0x51f8, 0x520a, 0x52a0, 0x529f, 0x5305, 0x5306, 0x5317, + 0x531d, 0x4edf, 0x534a, 0x5349, 0x5361, 0x5360, 0x536f, 0x536e, + 0x53bb, 0x53ef, 0x53e4, 0x53f3, 0x53ec, 0x53ee, 0x53e9, 0x53e8, + 0x53fc, 0x53f8, 0x53f5, 0x53eb, 0x53e6, 0x53ea, 0x53f2, 0x53f1, + 0x53f0, 0x53e5, 0x53ed, 0x53fb, 0x56db, 0x56da, 0x5916, 0x592e, + 0x5931, 0x5974, 0x5976, 0x5b55, 0x5b83, 0x5c3c, 0x5de8, 0x5de7, + 0x5de6, 0x5e02, 0x5e03, 0x5e73, 0x5e7c, 0x5f01, 0x5f18, 0x5f17, + 0x5fc5, 0x620a, 0x6253, 0x6254, 0x6252, 0x6251, 0x65a5, 0x65e6, + 0x672e, 0x672c, 0x672a, 0x672b, 0x672d, 0x6b63, 0x6bcd, 0x6c11, + 0x6c10, 0x6c38, 0x6c41, 0x6c40, 0x6c3e, 0x72af, 0x7384, 0x7389, + 0x74dc, 0x74e6, 0x7518, 0x751f, 0x7528, 0x7529, 0x7530, 0x7531, + 0x7532, 0x7533, 0x758b, 0x767d, 0x76ae, 0x76bf, 0x76ee, 0x77db, + 0x77e2, 0x77f3, 0x793a, 0x79be, 0x7a74, 0x7acb, 0x4e1e, 0x4e1f, + 0x4e52, 0x4e53, 0x4e69, 0x4e99, 0x4ea4, 0x4ea6, 0x4ea5, 0x4eff, + 0x4f09, 0x4f19, 0x4f0a, 0x4f15, 0x4f0d, 0x4f10, 0x4f11, 0x4f0f, + 0x4ef2, 0x4ef6, 0x4efb, 0x4ef0, 0x4ef3, 0x4efd, 0x4f01, 0x4f0b, + 0x5149, 0x5147, 0x5146, 0x5148, 0x5168, + /* 0xa6 */ + 0x5171, 0x518d, 0x51b0, 0x5217, 0x5211, 0x5212, 0x520e, 0x5216, + 0x52a3, 0x5308, 0x5321, 0x5320, 0x5370, 0x5371, 0x5409, 0x540f, + 0x540c, 0x540a, 0x5410, 0x5401, 0x540b, 0x5404, 0x5411, 0x540d, + 0x5408, 0x5403, 0x540e, 0x5406, 0x5412, 0x56e0, 0x56de, 0x56dd, + 0x5733, 0x5730, 0x5728, 0x572d, 0x572c, 0x572f, 0x5729, 0x5919, + 0x591a, 0x5937, 0x5938, 0x5984, 0x5978, 0x5983, 0x597d, 0x5979, + 0x5982, 0x5981, 0x5b57, 0x5b58, 0x5b87, 0x5b88, 0x5b85, 0x5b89, + 0x5bfa, 0x5c16, 0x5c79, 0x5dde, 0x5e06, 0x5e76, 0x5e74, 0x5f0f, + 0x5f1b, 0x5fd9, 0x5fd6, 0x620e, 0x620c, 0x620d, 0x6210, 0x6263, + 0x625b, 0x6258, 0x6536, 0x65e9, 0x65e8, 0x65ec, 0x65ed, 0x66f2, + 0x66f3, 0x6709, 0x673d, 0x6734, 0x6731, 0x6735, 0x6b21, 0x6b64, + 0x6b7b, 0x6c16, 0x6c5d, 0x6c57, 0x6c59, 0x6c5f, 0x6c60, 0x6c50, + 0x6c55, 0x6c61, 0x6c5b, 0x6c4d, 0x6c4e, 0x7070, 0x725f, 0x725d, + 0x767e, 0x7af9, 0x7c73, 0x7cf8, 0x7f36, 0x7f8a, 0x7fbd, 0x8001, + 0x8003, 0x800c, 0x8012, 0x8033, 0x807f, 0x8089, 0x808b, 0x808c, + 0x81e3, 0x81ea, 0x81f3, 0x81fc, 0x820c, 0x821b, 0x821f, 0x826e, + 0x8272, 0x827e, 0x866b, 0x8840, 0x884c, 0x8863, 0x897f, 0x9621, + 0x4e32, 0x4ea8, 0x4f4d, 0x4f4f, 0x4f47, 0x4f57, 0x4f5e, 0x4f34, + 0x4f5b, 0x4f55, 0x4f30, 0x4f50, 0x4f51, 0x4f3d, 0x4f3a, 0x4f38, + 0x4f43, 0x4f54, 0x4f3c, 0x4f46, 0x4f63, + /* 0xa7 */ + 0x4f5c, 0x4f60, 0x4f2f, 0x4f4e, 0x4f36, 0x4f59, 0x4f5d, 0x4f48, + 0x4f5a, 0x514c, 0x514b, 0x514d, 0x5175, 0x51b6, 0x51b7, 0x5225, + 0x5224, 0x5229, 0x522a, 0x5228, 0x52ab, 0x52a9, 0x52aa, 0x52ac, + 0x5323, 0x5373, 0x5375, 0x541d, 0x542d, 0x541e, 0x543e, 0x5426, + 0x544e, 0x5427, 0x5446, 0x5443, 0x5433, 0x5448, 0x5442, 0x541b, + 0x5429, 0x544a, 0x5439, 0x543b, 0x5438, 0x542e, 0x5435, 0x5436, + 0x5420, 0x543c, 0x5440, 0x5431, 0x542b, 0x541f, 0x542c, 0x56ea, + 0x56f0, 0x56e4, 0x56eb, 0x574a, 0x5751, 0x5740, 0x574d, 0x5747, + 0x574e, 0x573e, 0x5750, 0x574f, 0x573b, 0x58ef, 0x593e, 0x599d, + 0x5992, 0x59a8, 0x599e, 0x59a3, 0x5999, 0x5996, 0x598d, 0x59a4, + 0x5993, 0x598a, 0x59a5, 0x5b5d, 0x5b5c, 0x5b5a, 0x5b5b, 0x5b8c, + 0x5b8b, 0x5b8f, 0x5c2c, 0x5c40, 0x5c41, 0x5c3f, 0x5c3e, 0x5c90, + 0x5c91, 0x5c94, 0x5c8c, 0x5deb, 0x5e0c, 0x5e8f, 0x5e87, 0x5e8a, + 0x5ef7, 0x5f04, 0x5f1f, 0x5f64, 0x5f62, 0x5f77, 0x5f79, 0x5fd8, + 0x5fcc, 0x5fd7, 0x5fcd, 0x5ff1, 0x5feb, 0x5ff8, 0x5fea, 0x6212, + 0x6211, 0x6284, 0x6297, 0x6296, 0x6280, 0x6276, 0x6289, 0x626d, + 0x628a, 0x627c, 0x627e, 0x6279, 0x6273, 0x6292, 0x626f, 0x6298, + 0x626e, 0x6295, 0x6293, 0x6291, 0x6286, 0x6539, 0x653b, 0x6538, + 0x65f1, 0x66f4, 0x675f, 0x674e, 0x674f, 0x6750, 0x6751, 0x675c, + 0x6756, 0x675e, 0x6749, 0x6746, 0x6760, + /* 0xa8 */ + 0x6753, 0x6757, 0x6b65, 0x6bcf, 0x6c42, 0x6c5e, 0x6c99, 0x6c81, + 0x6c88, 0x6c89, 0x6c85, 0x6c9b, 0x6c6a, 0x6c7a, 0x6c90, 0x6c70, + 0x6c8c, 0x6c68, 0x6c96, 0x6c92, 0x6c7d, 0x6c83, 0x6c72, 0x6c7e, + 0x6c74, 0x6c86, 0x6c76, 0x6c8d, 0x6c94, 0x6c98, 0x6c82, 0x7076, + 0x707c, 0x707d, 0x7078, 0x7262, 0x7261, 0x7260, 0x72c4, 0x72c2, + 0x7396, 0x752c, 0x752b, 0x7537, 0x7538, 0x7682, 0x76ef, 0x77e3, + 0x79c1, 0x79c0, 0x79bf, 0x7a76, 0x7cfb, 0x7f55, 0x8096, 0x8093, + 0x809d, 0x8098, 0x809b, 0x809a, 0x80b2, 0x826f, 0x8292, 0x828b, + 0x828d, 0x898b, 0x89d2, 0x8a00, 0x8c37, 0x8c46, 0x8c55, 0x8c9d, + 0x8d64, 0x8d70, 0x8db3, 0x8eab, 0x8eca, 0x8f9b, 0x8fb0, 0x8fc2, + 0x8fc6, 0x8fc5, 0x8fc4, 0x5de1, 0x9091, 0x90a2, 0x90aa, 0x90a6, + 0x90a3, 0x9149, 0x91c6, 0x91cc, 0x9632, 0x962e, 0x9631, 0x962a, + 0x962c, 0x4e26, 0x4e56, 0x4e73, 0x4e8b, 0x4e9b, 0x4e9e, 0x4eab, + 0x4eac, 0x4f6f, 0x4f9d, 0x4f8d, 0x4f73, 0x4f7f, 0x4f6c, 0x4f9b, + 0x4f8b, 0x4f86, 0x4f83, 0x4f70, 0x4f75, 0x4f88, 0x4f69, 0x4f7b, + 0x4f96, 0x4f7e, 0x4f8f, 0x4f91, 0x4f7a, 0x5154, 0x5152, 0x5155, + 0x5169, 0x5177, 0x5176, 0x5178, 0x51bd, 0x51fd, 0x523b, 0x5238, + 0x5237, 0x523a, 0x5230, 0x522e, 0x5236, 0x5241, 0x52be, 0x52bb, + 0x5352, 0x5354, 0x5353, 0x5351, 0x5366, 0x5377, 0x5378, 0x5379, + 0x53d6, 0x53d4, 0x53d7, 0x5473, 0x5475, + /* 0xa9 */ + 0x5496, 0x5478, 0x5495, 0x5480, 0x547b, 0x5477, 0x5484, 0x5492, + 0x5486, 0x547c, 0x5490, 0x5471, 0x5476, 0x548c, 0x549a, 0x5462, + 0x5468, 0x548b, 0x547d, 0x548e, 0x56fa, 0x5783, 0x5777, 0x576a, + 0x5769, 0x5761, 0x5766, 0x5764, 0x577c, 0x591c, 0x5949, 0x5947, + 0x5948, 0x5944, 0x5954, 0x59be, 0x59bb, 0x59d4, 0x59b9, 0x59ae, + 0x59d1, 0x59c6, 0x59d0, 0x59cd, 0x59cb, 0x59d3, 0x59ca, 0x59af, + 0x59b3, 0x59d2, 0x59c5, 0x5b5f, 0x5b64, 0x5b63, 0x5b97, 0x5b9a, + 0x5b98, 0x5b9c, 0x5b99, 0x5b9b, 0x5c1a, 0x5c48, 0x5c45, 0x5c46, + 0x5cb7, 0x5ca1, 0x5cb8, 0x5ca9, 0x5cab, 0x5cb1, 0x5cb3, 0x5e18, + 0x5e1a, 0x5e16, 0x5e15, 0x5e1b, 0x5e11, 0x5e78, 0x5e9a, 0x5e97, + 0x5e9c, 0x5e95, 0x5e96, 0x5ef6, 0x5f26, 0x5f27, 0x5f29, 0x5f80, + 0x5f81, 0x5f7f, 0x5f7c, 0x5fdd, 0x5fe0, 0x5ffd, 0x5ff5, 0x5fff, + 0x600f, 0x6014, 0x602f, 0x6035, 0x6016, 0x602a, 0x6015, 0x6021, + 0x6027, 0x6029, 0x602b, 0x601b, 0x6216, 0x6215, 0x623f, 0x623e, + 0x6240, 0x627f, 0x62c9, 0x62cc, 0x62c4, 0x62bf, 0x62c2, 0x62b9, + 0x62d2, 0x62db, 0x62ab, 0x62d3, 0x62d4, 0x62cb, 0x62c8, 0x62a8, + 0x62bd, 0x62bc, 0x62d0, 0x62d9, 0x62c7, 0x62cd, 0x62b5, 0x62da, + 0x62b1, 0x62d8, 0x62d6, 0x62d7, 0x62c6, 0x62ac, 0x62ce, 0x653e, + 0x65a7, 0x65bc, 0x65fa, 0x6614, 0x6613, 0x660c, 0x6606, 0x6602, + 0x660e, 0x6600, 0x660f, 0x6615, 0x660a, + /* 0xaa */ + 0x6607, 0x670d, 0x670b, 0x676d, 0x678b, 0x6795, 0x6771, 0x679c, + 0x6773, 0x6777, 0x6787, 0x679d, 0x6797, 0x676f, 0x6770, 0x677f, + 0x6789, 0x677e, 0x6790, 0x6775, 0x679a, 0x6793, 0x677c, 0x676a, + 0x6772, 0x6b23, 0x6b66, 0x6b67, 0x6b7f, 0x6c13, 0x6c1b, 0x6ce3, + 0x6ce8, 0x6cf3, 0x6cb1, 0x6ccc, 0x6ce5, 0x6cb3, 0x6cbd, 0x6cbe, + 0x6cbc, 0x6ce2, 0x6cab, 0x6cd5, 0x6cd3, 0x6cb8, 0x6cc4, 0x6cb9, + 0x6cc1, 0x6cae, 0x6cd7, 0x6cc5, 0x6cf1, 0x6cbf, 0x6cbb, 0x6ce1, + 0x6cdb, 0x6cca, 0x6cac, 0x6cef, 0x6cdc, 0x6cd6, 0x6ce0, 0x7095, + 0x708e, 0x7092, 0x708a, 0x7099, 0x722c, 0x722d, 0x7238, 0x7248, + 0x7267, 0x7269, 0x72c0, 0x72ce, 0x72d9, 0x72d7, 0x72d0, 0x73a9, + 0x73a8, 0x739f, 0x73ab, 0x73a5, 0x753d, 0x759d, 0x7599, 0x759a, + 0x7684, 0x76c2, 0x76f2, 0x76f4, 0x77e5, 0x77fd, 0x793e, 0x7940, + 0x7941, 0x79c9, 0x79c8, 0x7a7a, 0x7a79, 0x7afa, 0x7cfe, 0x7f54, + 0x7f8c, 0x7f8b, 0x8005, 0x80ba, 0x80a5, 0x80a2, 0x80b1, 0x80a1, + 0x80ab, 0x80a9, 0x80b4, 0x80aa, 0x80af, 0x81e5, 0x81fe, 0x820d, + 0x82b3, 0x829d, 0x8299, 0x82ad, 0x82bd, 0x829f, 0x82b9, 0x82b1, + 0x82ac, 0x82a5, 0x82af, 0x82b8, 0x82a3, 0x82b0, 0x82be, 0x82b7, + 0x864e, 0x8671, 0x521d, 0x8868, 0x8ecb, 0x8fce, 0x8fd4, 0x8fd1, + 0x90b5, 0x90b8, 0x90b1, 0x90b6, 0x91c7, 0x91d1, 0x9577, 0x9580, + 0x961c, 0x9640, 0x963f, 0x963b, 0x9644, + /* 0xab */ + 0x9642, 0x96b9, 0x96e8, 0x9752, 0x975e, 0x4e9f, 0x4ead, 0x4eae, + 0x4fe1, 0x4fb5, 0x4faf, 0x4fbf, 0x4fe0, 0x4fd1, 0x4fcf, 0x4fdd, + 0x4fc3, 0x4fb6, 0x4fd8, 0x4fdf, 0x4fca, 0x4fd7, 0x4fae, 0x4fd0, + 0x4fc4, 0x4fc2, 0x4fda, 0x4fce, 0x4fde, 0x4fb7, 0x5157, 0x5192, + 0x5191, 0x51a0, 0x524e, 0x5243, 0x524a, 0x524d, 0x524c, 0x524b, + 0x5247, 0x52c7, 0x52c9, 0x52c3, 0x52c1, 0x530d, 0x5357, 0x537b, + 0x539a, 0x53db, 0x54ac, 0x54c0, 0x54a8, 0x54ce, 0x54c9, 0x54b8, + 0x54a6, 0x54b3, 0x54c7, 0x54c2, 0x54bd, 0x54aa, 0x54c1, 0x54c4, + 0x54c8, 0x54af, 0x54ab, 0x54b1, 0x54bb, 0x54a9, 0x54a7, 0x54bf, + 0x56ff, 0x5782, 0x578b, 0x57a0, 0x57a3, 0x57a2, 0x57ce, 0x57ae, + 0x5793, 0x5955, 0x5951, 0x594f, 0x594e, 0x5950, 0x59dc, 0x59d8, + 0x59ff, 0x59e3, 0x59e8, 0x5a03, 0x59e5, 0x59ea, 0x59da, 0x59e6, + 0x5a01, 0x59fb, 0x5b69, 0x5ba3, 0x5ba6, 0x5ba4, 0x5ba2, 0x5ba5, + 0x5c01, 0x5c4e, 0x5c4f, 0x5c4d, 0x5c4b, 0x5cd9, 0x5cd2, 0x5df7, + 0x5e1d, 0x5e25, 0x5e1f, 0x5e7d, 0x5ea0, 0x5ea6, 0x5efa, 0x5f08, + 0x5f2d, 0x5f65, 0x5f88, 0x5f85, 0x5f8a, 0x5f8b, 0x5f87, 0x5f8c, + 0x5f89, 0x6012, 0x601d, 0x6020, 0x6025, 0x600e, 0x6028, 0x604d, + 0x6070, 0x6068, 0x6062, 0x6046, 0x6043, 0x606c, 0x606b, 0x606a, + 0x6064, 0x6241, 0x62dc, 0x6316, 0x6309, 0x62fc, 0x62ed, 0x6301, + 0x62ee, 0x62fd, 0x6307, 0x62f1, 0x62f7, + /* 0xac */ + 0x62ef, 0x62ec, 0x62fe, 0x62f4, 0x6311, 0x6302, 0x653f, 0x6545, + 0x65ab, 0x65bd, 0x65e2, 0x6625, 0x662d, 0x6620, 0x6627, 0x662f, + 0x661f, 0x6628, 0x6631, 0x6624, 0x66f7, 0x67ff, 0x67d3, 0x67f1, + 0x67d4, 0x67d0, 0x67ec, 0x67b6, 0x67af, 0x67f5, 0x67e9, 0x67ef, + 0x67c4, 0x67d1, 0x67b4, 0x67da, 0x67e5, 0x67b8, 0x67cf, 0x67de, + 0x67f3, 0x67b0, 0x67d9, 0x67e2, 0x67dd, 0x67d2, 0x6b6a, 0x6b83, + 0x6b86, 0x6bb5, 0x6bd2, 0x6bd7, 0x6c1f, 0x6cc9, 0x6d0b, 0x6d32, + 0x6d2a, 0x6d41, 0x6d25, 0x6d0c, 0x6d31, 0x6d1e, 0x6d17, 0x6d3b, + 0x6d3d, 0x6d3e, 0x6d36, 0x6d1b, 0x6cf5, 0x6d39, 0x6d27, 0x6d38, + 0x6d29, 0x6d2e, 0x6d35, 0x6d0e, 0x6d2b, 0x70ab, 0x70ba, 0x70b3, + 0x70ac, 0x70af, 0x70ad, 0x70b8, 0x70ae, 0x70a4, 0x7230, 0x7272, + 0x726f, 0x7274, 0x72e9, 0x72e0, 0x72e1, 0x73b7, 0x73ca, 0x73bb, + 0x73b2, 0x73cd, 0x73c0, 0x73b3, 0x751a, 0x752d, 0x754f, 0x754c, + 0x754e, 0x754b, 0x75ab, 0x75a4, 0x75a5, 0x75a2, 0x75a3, 0x7678, + 0x7686, 0x7687, 0x7688, 0x76c8, 0x76c6, 0x76c3, 0x76c5, 0x7701, + 0x76f9, 0x76f8, 0x7709, 0x770b, 0x76fe, 0x76fc, 0x7707, 0x77dc, + 0x7802, 0x7814, 0x780c, 0x780d, 0x7946, 0x7949, 0x7948, 0x7947, + 0x79b9, 0x79ba, 0x79d1, 0x79d2, 0x79cb, 0x7a7f, 0x7a81, 0x7aff, + 0x7afd, 0x7c7d, 0x7d02, 0x7d05, 0x7d00, 0x7d09, 0x7d07, 0x7d04, + 0x7d06, 0x7f38, 0x7f8e, 0x7fbf, 0x8004, + /* 0xad */ + 0x8010, 0x800d, 0x8011, 0x8036, 0x80d6, 0x80e5, 0x80da, 0x80c3, + 0x80c4, 0x80cc, 0x80e1, 0x80db, 0x80ce, 0x80de, 0x80e4, 0x80dd, + 0x81f4, 0x8222, 0x82e7, 0x8303, 0x8305, 0x82e3, 0x82db, 0x82e6, + 0x8304, 0x82e5, 0x8302, 0x8309, 0x82d2, 0x82d7, 0x82f1, 0x8301, + 0x82dc, 0x82d4, 0x82d1, 0x82de, 0x82d3, 0x82df, 0x82ef, 0x8306, + 0x8650, 0x8679, 0x867b, 0x867a, 0x884d, 0x886b, 0x8981, 0x89d4, + 0x8a08, 0x8a02, 0x8a03, 0x8c9e, 0x8ca0, 0x8d74, 0x8d73, 0x8db4, + 0x8ecd, 0x8ecc, 0x8ff0, 0x8fe6, 0x8fe2, 0x8fea, 0x8fe5, 0x8fed, + 0x8feb, 0x8fe4, 0x8fe8, 0x90ca, 0x90ce, 0x90c1, 0x90c3, 0x914b, + 0x914a, 0x91cd, 0x9582, 0x9650, 0x964b, 0x964c, 0x964d, 0x9762, + 0x9769, 0x97cb, 0x97ed, 0x97f3, 0x9801, 0x98a8, 0x98db, 0x98df, + 0x9996, 0x9999, 0x4e58, 0x4eb3, 0x500c, 0x500d, 0x5023, 0x4fef, + 0x5026, 0x5025, 0x4ff8, 0x5029, 0x5016, 0x5006, 0x503c, 0x501f, + 0x501a, 0x5012, 0x5011, 0x4ffa, 0x5000, 0x5014, 0x5028, 0x4ff1, + 0x5021, 0x500b, 0x5019, 0x5018, 0x4ff3, 0x4fee, 0x502d, 0x502a, + 0x4ffe, 0x502b, 0x5009, 0x517c, 0x51a4, 0x51a5, 0x51a2, 0x51cd, + 0x51cc, 0x51c6, 0x51cb, 0x5256, 0x525c, 0x5254, 0x525b, 0x525d, + 0x532a, 0x537f, 0x539f, 0x539d, 0x53df, 0x54e8, 0x5510, 0x5501, + 0x5537, 0x54fc, 0x54e5, 0x54f2, 0x5506, 0x54fa, 0x5514, 0x54e9, + 0x54ed, 0x54e1, 0x5509, 0x54ee, 0x54ea, + /* 0xae */ + 0x54e6, 0x5527, 0x5507, 0x54fd, 0x550f, 0x5703, 0x5704, 0x57c2, + 0x57d4, 0x57cb, 0x57c3, 0x5809, 0x590f, 0x5957, 0x5958, 0x595a, + 0x5a11, 0x5a18, 0x5a1c, 0x5a1f, 0x5a1b, 0x5a13, 0x59ec, 0x5a20, + 0x5a23, 0x5a29, 0x5a25, 0x5a0c, 0x5a09, 0x5b6b, 0x5c58, 0x5bb0, + 0x5bb3, 0x5bb6, 0x5bb4, 0x5bae, 0x5bb5, 0x5bb9, 0x5bb8, 0x5c04, + 0x5c51, 0x5c55, 0x5c50, 0x5ced, 0x5cfd, 0x5cfb, 0x5cea, 0x5ce8, + 0x5cf0, 0x5cf6, 0x5d01, 0x5cf4, 0x5dee, 0x5e2d, 0x5e2b, 0x5eab, + 0x5ead, 0x5ea7, 0x5f31, 0x5f92, 0x5f91, 0x5f90, 0x6059, 0x6063, + 0x6065, 0x6050, 0x6055, 0x606d, 0x6069, 0x606f, 0x6084, 0x609f, + 0x609a, 0x608d, 0x6094, 0x608c, 0x6085, 0x6096, 0x6247, 0x62f3, + 0x6308, 0x62ff, 0x634e, 0x633e, 0x632f, 0x6355, 0x6342, 0x6346, + 0x634f, 0x6349, 0x633a, 0x6350, 0x633d, 0x632a, 0x632b, 0x6328, + 0x634d, 0x634c, 0x6548, 0x6549, 0x6599, 0x65c1, 0x65c5, 0x6642, + 0x6649, 0x664f, 0x6643, 0x6652, 0x664c, 0x6645, 0x6641, 0x66f8, + 0x6714, 0x6715, 0x6717, 0x6821, 0x6838, 0x6848, 0x6846, 0x6853, + 0x6839, 0x6842, 0x6854, 0x6829, 0x68b3, 0x6817, 0x684c, 0x6851, + 0x683d, 0x67f4, 0x6850, 0x6840, 0x683c, 0x6843, 0x682a, 0x6845, + 0x6813, 0x6818, 0x6841, 0x6b8a, 0x6b89, 0x6bb7, 0x6c23, 0x6c27, + 0x6c28, 0x6c26, 0x6c24, 0x6cf0, 0x6d6a, 0x6d95, 0x6d88, 0x6d87, + 0x6d66, 0x6d78, 0x6d77, 0x6d59, 0x6d93, + /* 0xaf */ + 0x6d6c, 0x6d89, 0x6d6e, 0x6d5a, 0x6d74, 0x6d69, 0x6d8c, 0x6d8a, + 0x6d79, 0x6d85, 0x6d65, 0x6d94, 0x70ca, 0x70d8, 0x70e4, 0x70d9, + 0x70c8, 0x70cf, 0x7239, 0x7279, 0x72fc, 0x72f9, 0x72fd, 0x72f8, + 0x72f7, 0x7386, 0x73ed, 0x7409, 0x73ee, 0x73e0, 0x73ea, 0x73de, + 0x7554, 0x755d, 0x755c, 0x755a, 0x7559, 0x75be, 0x75c5, 0x75c7, + 0x75b2, 0x75b3, 0x75bd, 0x75bc, 0x75b9, 0x75c2, 0x75b8, 0x768b, + 0x76b0, 0x76ca, 0x76cd, 0x76ce, 0x7729, 0x771f, 0x7720, 0x7728, + 0x77e9, 0x7830, 0x7827, 0x7838, 0x781d, 0x7834, 0x7837, 0x7825, + 0x782d, 0x7820, 0x781f, 0x7832, 0x7955, 0x7950, 0x7960, 0x795f, + 0x7956, 0x795e, 0x795d, 0x7957, 0x795a, 0x79e4, 0x79e3, 0x79e7, + 0x79df, 0x79e6, 0x79e9, 0x79d8, 0x7a84, 0x7a88, 0x7ad9, 0x7b06, + 0x7b11, 0x7c89, 0x7d21, 0x7d17, 0x7d0b, 0x7d0a, 0x7d20, 0x7d22, + 0x7d14, 0x7d10, 0x7d15, 0x7d1a, 0x7d1c, 0x7d0d, 0x7d19, 0x7d1b, + 0x7f3a, 0x7f5f, 0x7f94, 0x7fc5, 0x7fc1, 0x8006, 0x8018, 0x8015, + 0x8019, 0x8017, 0x803d, 0x803f, 0x80f1, 0x8102, 0x80f0, 0x8105, + 0x80ed, 0x80f4, 0x8106, 0x80f8, 0x80f3, 0x8108, 0x80fd, 0x810a, + 0x80fc, 0x80ef, 0x81ed, 0x81ec, 0x8200, 0x8210, 0x822a, 0x822b, + 0x8228, 0x822c, 0x82bb, 0x832b, 0x8352, 0x8354, 0x834a, 0x8338, + 0x8350, 0x8349, 0x8335, 0x8334, 0x834f, 0x8332, 0x8339, 0x8336, + 0x8317, 0x8340, 0x8331, 0x8328, 0x8343, + /* 0xb0 */ + 0x8654, 0x868a, 0x86aa, 0x8693, 0x86a4, 0x86a9, 0x868c, 0x86a3, + 0x869c, 0x8870, 0x8877, 0x8881, 0x8882, 0x887d, 0x8879, 0x8a18, + 0x8a10, 0x8a0e, 0x8a0c, 0x8a15, 0x8a0a, 0x8a17, 0x8a13, 0x8a16, + 0x8a0f, 0x8a11, 0x8c48, 0x8c7a, 0x8c79, 0x8ca1, 0x8ca2, 0x8d77, + 0x8eac, 0x8ed2, 0x8ed4, 0x8ecf, 0x8fb1, 0x9001, 0x9006, 0x8ff7, + 0x9000, 0x8ffa, 0x8ff4, 0x9003, 0x8ffd, 0x9005, 0x8ff8, 0x9095, + 0x90e1, 0x90dd, 0x90e2, 0x9152, 0x914d, 0x914c, 0x91d8, 0x91dd, + 0x91d7, 0x91dc, 0x91d9, 0x9583, 0x9662, 0x9663, 0x9661, 0x965b, + 0x965d, 0x9664, 0x9658, 0x965e, 0x96bb, 0x98e2, 0x99ac, 0x9aa8, + 0x9ad8, 0x9b25, 0x9b32, 0x9b3c, 0x4e7e, 0x507a, 0x507d, 0x505c, + 0x5047, 0x5043, 0x504c, 0x505a, 0x5049, 0x5065, 0x5076, 0x504e, + 0x5055, 0x5075, 0x5074, 0x5077, 0x504f, 0x500f, 0x506f, 0x506d, + 0x515c, 0x5195, 0x51f0, 0x526a, 0x526f, 0x52d2, 0x52d9, 0x52d8, + 0x52d5, 0x5310, 0x530f, 0x5319, 0x533f, 0x5340, 0x533e, 0x53c3, + 0x66fc, 0x5546, 0x556a, 0x5566, 0x5544, 0x555e, 0x5561, 0x5543, + 0x554a, 0x5531, 0x5556, 0x554f, 0x5555, 0x552f, 0x5564, 0x5538, + 0x552e, 0x555c, 0x552c, 0x5563, 0x5533, 0x5541, 0x5557, 0x5708, + 0x570b, 0x5709, 0x57df, 0x5805, 0x580a, 0x5806, 0x57e0, 0x57e4, + 0x57fa, 0x5802, 0x5835, 0x57f7, 0x57f9, 0x5920, 0x5962, 0x5a36, + 0x5a41, 0x5a49, 0x5a66, 0x5a6a, 0x5a40, + /* 0xb1 */ + 0x5a3c, 0x5a62, 0x5a5a, 0x5a46, 0x5a4a, 0x5b70, 0x5bc7, 0x5bc5, + 0x5bc4, 0x5bc2, 0x5bbf, 0x5bc6, 0x5c09, 0x5c08, 0x5c07, 0x5c60, + 0x5c5c, 0x5c5d, 0x5d07, 0x5d06, 0x5d0e, 0x5d1b, 0x5d16, 0x5d22, + 0x5d11, 0x5d29, 0x5d14, 0x5d19, 0x5d24, 0x5d27, 0x5d17, 0x5de2, + 0x5e38, 0x5e36, 0x5e33, 0x5e37, 0x5eb7, 0x5eb8, 0x5eb6, 0x5eb5, + 0x5ebe, 0x5f35, 0x5f37, 0x5f57, 0x5f6c, 0x5f69, 0x5f6b, 0x5f97, + 0x5f99, 0x5f9e, 0x5f98, 0x5fa1, 0x5fa0, 0x5f9c, 0x607f, 0x60a3, + 0x6089, 0x60a0, 0x60a8, 0x60cb, 0x60b4, 0x60e6, 0x60bd, 0x60c5, + 0x60bb, 0x60b5, 0x60dc, 0x60bc, 0x60d8, 0x60d5, 0x60c6, 0x60df, + 0x60b8, 0x60da, 0x60c7, 0x621a, 0x621b, 0x6248, 0x63a0, 0x63a7, + 0x6372, 0x6396, 0x63a2, 0x63a5, 0x6377, 0x6367, 0x6398, 0x63aa, + 0x6371, 0x63a9, 0x6389, 0x6383, 0x639b, 0x636b, 0x63a8, 0x6384, + 0x6388, 0x6399, 0x63a1, 0x63ac, 0x6392, 0x638f, 0x6380, 0x637b, + 0x6369, 0x6368, 0x637a, 0x655d, 0x6556, 0x6551, 0x6559, 0x6557, + 0x555f, 0x654f, 0x6558, 0x6555, 0x6554, 0x659c, 0x659b, 0x65ac, + 0x65cf, 0x65cb, 0x65cc, 0x65ce, 0x665d, 0x665a, 0x6664, 0x6668, + 0x6666, 0x665e, 0x66f9, 0x52d7, 0x671b, 0x6881, 0x68af, 0x68a2, + 0x6893, 0x68b5, 0x687f, 0x6876, 0x68b1, 0x68a7, 0x6897, 0x68b0, + 0x6883, 0x68c4, 0x68ad, 0x6886, 0x6885, 0x6894, 0x689d, 0x68a8, + 0x689f, 0x68a1, 0x6882, 0x6b32, 0x6bba, + /* 0xb2 */ + 0x6beb, 0x6bec, 0x6c2b, 0x6d8e, 0x6dbc, 0x6df3, 0x6dd9, 0x6db2, + 0x6de1, 0x6dcc, 0x6de4, 0x6dfb, 0x6dfa, 0x6e05, 0x6dc7, 0x6dcb, + 0x6daf, 0x6dd1, 0x6dae, 0x6dde, 0x6df9, 0x6db8, 0x6df7, 0x6df5, + 0x6dc5, 0x6dd2, 0x6e1a, 0x6db5, 0x6dda, 0x6deb, 0x6dd8, 0x6dea, + 0x6df1, 0x6dee, 0x6de8, 0x6dc6, 0x6dc4, 0x6daa, 0x6dec, 0x6dbf, + 0x6de6, 0x70f9, 0x7109, 0x710a, 0x70fd, 0x70ef, 0x723d, 0x727d, + 0x7281, 0x731c, 0x731b, 0x7316, 0x7313, 0x7319, 0x7387, 0x7405, + 0x740a, 0x7403, 0x7406, 0x73fe, 0x740d, 0x74e0, 0x74f6, 0x74f7, + 0x751c, 0x7522, 0x7565, 0x7566, 0x7562, 0x7570, 0x758f, 0x75d4, + 0x75d5, 0x75b5, 0x75ca, 0x75cd, 0x768e, 0x76d4, 0x76d2, 0x76db, + 0x7737, 0x773e, 0x773c, 0x7736, 0x7738, 0x773a, 0x786b, 0x7843, + 0x784e, 0x7965, 0x7968, 0x796d, 0x79fb, 0x7a92, 0x7a95, 0x7b20, + 0x7b28, 0x7b1b, 0x7b2c, 0x7b26, 0x7b19, 0x7b1e, 0x7b2e, 0x7c92, + 0x7c97, 0x7c95, 0x7d46, 0x7d43, 0x7d71, 0x7d2e, 0x7d39, 0x7d3c, + 0x7d40, 0x7d30, 0x7d33, 0x7d44, 0x7d2f, 0x7d42, 0x7d32, 0x7d31, + 0x7f3d, 0x7f9e, 0x7f9a, 0x7fcc, 0x7fce, 0x7fd2, 0x801c, 0x804a, + 0x8046, 0x812f, 0x8116, 0x8123, 0x812b, 0x8129, 0x8130, 0x8124, + 0x8202, 0x8235, 0x8237, 0x8236, 0x8239, 0x838e, 0x839e, 0x8398, + 0x8378, 0x83a2, 0x8396, 0x83bd, 0x83ab, 0x8392, 0x838a, 0x8393, + 0x8389, 0x83a0, 0x8377, 0x837b, 0x837c, + /* 0xb3 */ + 0x8386, 0x83a7, 0x8655, 0x5f6a, 0x86c7, 0x86c0, 0x86b6, 0x86c4, + 0x86b5, 0x86c6, 0x86cb, 0x86b1, 0x86af, 0x86c9, 0x8853, 0x889e, + 0x8888, 0x88ab, 0x8892, 0x8896, 0x888d, 0x888b, 0x8993, 0x898f, + 0x8a2a, 0x8a1d, 0x8a23, 0x8a25, 0x8a31, 0x8a2d, 0x8a1f, 0x8a1b, + 0x8a22, 0x8c49, 0x8c5a, 0x8ca9, 0x8cac, 0x8cab, 0x8ca8, 0x8caa, + 0x8ca7, 0x8d67, 0x8d66, 0x8dbe, 0x8dba, 0x8edb, 0x8edf, 0x9019, + 0x900d, 0x901a, 0x9017, 0x9023, 0x901f, 0x901d, 0x9010, 0x9015, + 0x901e, 0x9020, 0x900f, 0x9022, 0x9016, 0x901b, 0x9014, 0x90e8, + 0x90ed, 0x90fd, 0x9157, 0x91ce, 0x91f5, 0x91e6, 0x91e3, 0x91e7, + 0x91ed, 0x91e9, 0x9589, 0x966a, 0x9675, 0x9673, 0x9678, 0x9670, + 0x9674, 0x9676, 0x9677, 0x966c, 0x96c0, 0x96ea, 0x96e9, 0x7ae0, + 0x7adf, 0x9802, 0x9803, 0x9b5a, 0x9ce5, 0x9e75, 0x9e7f, 0x9ea5, + 0x9ebb, 0x50a2, 0x508d, 0x5085, 0x5099, 0x5091, 0x5080, 0x5096, + 0x5098, 0x509a, 0x6700, 0x51f1, 0x5272, 0x5274, 0x5275, 0x5269, + 0x52de, 0x52dd, 0x52db, 0x535a, 0x53a5, 0x557b, 0x5580, 0x55a7, + 0x557c, 0x558a, 0x559d, 0x5598, 0x5582, 0x559c, 0x55aa, 0x5594, + 0x5587, 0x558b, 0x5583, 0x55b3, 0x55ae, 0x559f, 0x553e, 0x55b2, + 0x559a, 0x55bb, 0x55ac, 0x55b1, 0x557e, 0x5589, 0x55ab, 0x5599, + 0x570d, 0x582f, 0x582a, 0x5834, 0x5824, 0x5830, 0x5831, 0x5821, + 0x581d, 0x5820, 0x58f9, 0x58fa, 0x5960, + /* 0xb4 */ + 0x5a77, 0x5a9a, 0x5a7f, 0x5a92, 0x5a9b, 0x5aa7, 0x5b73, 0x5b71, + 0x5bd2, 0x5bcc, 0x5bd3, 0x5bd0, 0x5c0a, 0x5c0b, 0x5c31, 0x5d4c, + 0x5d50, 0x5d34, 0x5d47, 0x5dfd, 0x5e45, 0x5e3d, 0x5e40, 0x5e43, + 0x5e7e, 0x5eca, 0x5ec1, 0x5ec2, 0x5ec4, 0x5f3c, 0x5f6d, 0x5fa9, + 0x5faa, 0x5fa8, 0x60d1, 0x60e1, 0x60b2, 0x60b6, 0x60e0, 0x611c, + 0x6123, 0x60fa, 0x6115, 0x60f0, 0x60fb, 0x60f4, 0x6168, 0x60f1, + 0x610e, 0x60f6, 0x6109, 0x6100, 0x6112, 0x621f, 0x6249, 0x63a3, + 0x638c, 0x63cf, 0x63c0, 0x63e9, 0x63c9, 0x63c6, 0x63cd, 0x63d2, + 0x63e3, 0x63d0, 0x63e1, 0x63d6, 0x63ed, 0x63ee, 0x6376, 0x63f4, + 0x63ea, 0x63db, 0x6452, 0x63da, 0x63f9, 0x655e, 0x6566, 0x6562, + 0x6563, 0x6591, 0x6590, 0x65af, 0x666e, 0x6670, 0x6674, 0x6676, + 0x666f, 0x6691, 0x667a, 0x667e, 0x6677, 0x66fe, 0x66ff, 0x671f, + 0x671d, 0x68fa, 0x68d5, 0x68e0, 0x68d8, 0x68d7, 0x6905, 0x68df, + 0x68f5, 0x68ee, 0x68e7, 0x68f9, 0x68d2, 0x68f2, 0x68e3, 0x68cb, + 0x68cd, 0x690d, 0x6912, 0x690e, 0x68c9, 0x68da, 0x696e, 0x68fb, + 0x6b3e, 0x6b3a, 0x6b3d, 0x6b98, 0x6b96, 0x6bbc, 0x6bef, 0x6c2e, + 0x6c2f, 0x6c2c, 0x6e2f, 0x6e38, 0x6e54, 0x6e21, 0x6e32, 0x6e67, + 0x6e4a, 0x6e20, 0x6e25, 0x6e23, 0x6e1b, 0x6e5b, 0x6e58, 0x6e24, + 0x6e56, 0x6e6e, 0x6e2d, 0x6e26, 0x6e6f, 0x6e34, 0x6e4d, 0x6e3a, + 0x6e2c, 0x6e43, 0x6e1d, 0x6e3e, 0x6ecb, + /* 0xb5 */ + 0x6e89, 0x6e19, 0x6e4e, 0x6e63, 0x6e44, 0x6e72, 0x6e69, 0x6e5f, + 0x7119, 0x711a, 0x7126, 0x7130, 0x7121, 0x7136, 0x716e, 0x711c, + 0x724c, 0x7284, 0x7280, 0x7336, 0x7325, 0x7334, 0x7329, 0x743a, + 0x742a, 0x7433, 0x7422, 0x7425, 0x7435, 0x7436, 0x7434, 0x742f, + 0x741b, 0x7426, 0x7428, 0x7525, 0x7526, 0x756b, 0x756a, 0x75e2, + 0x75db, 0x75e3, 0x75d9, 0x75d8, 0x75de, 0x75e0, 0x767b, 0x767c, + 0x7696, 0x7693, 0x76b4, 0x76dc, 0x774f, 0x77ed, 0x785d, 0x786c, + 0x786f, 0x7a0d, 0x7a08, 0x7a0b, 0x7a05, 0x7a00, 0x7a98, 0x7a97, + 0x7a96, 0x7ae5, 0x7ae3, 0x7b49, 0x7b56, 0x7b46, 0x7b50, 0x7b52, + 0x7b54, 0x7b4d, 0x7b4b, 0x7b4f, 0x7b51, 0x7c9f, 0x7ca5, 0x7d5e, + 0x7d50, 0x7d68, 0x7d55, 0x7d2b, 0x7d6e, 0x7d72, 0x7d61, 0x7d66, + 0x7d62, 0x7d70, 0x7d73, 0x5584, 0x7fd4, 0x7fd5, 0x800b, 0x8052, + 0x8085, 0x8155, 0x8154, 0x814b, 0x8151, 0x814e, 0x8139, 0x8146, + 0x813e, 0x814c, 0x8153, 0x8174, 0x8212, 0x821c, 0x83e9, 0x8403, + 0x83f8, 0x840d, 0x83e0, 0x83c5, 0x840b, 0x83c1, 0x83ef, 0x83f1, + 0x83f4, 0x8457, 0x840a, 0x83f0, 0x840c, 0x83cc, 0x83fd, 0x83f2, + 0x83ca, 0x8438, 0x840e, 0x8404, 0x83dc, 0x8407, 0x83d4, 0x83df, + 0x865b, 0x86df, 0x86d9, 0x86ed, 0x86d4, 0x86db, 0x86e4, 0x86d0, + 0x86de, 0x8857, 0x88c1, 0x88c2, 0x88b1, 0x8983, 0x8996, 0x8a3b, + 0x8a60, 0x8a55, 0x8a5e, 0x8a3c, 0x8a41, + /* 0xb6 */ + 0x8a54, 0x8a5b, 0x8a50, 0x8a46, 0x8a34, 0x8a3a, 0x8a36, 0x8a56, + 0x8c61, 0x8c82, 0x8caf, 0x8cbc, 0x8cb3, 0x8cbd, 0x8cc1, 0x8cbb, + 0x8cc0, 0x8cb4, 0x8cb7, 0x8cb6, 0x8cbf, 0x8cb8, 0x8d8a, 0x8d85, + 0x8d81, 0x8dce, 0x8ddd, 0x8dcb, 0x8dda, 0x8dd1, 0x8dcc, 0x8ddb, + 0x8dc6, 0x8efb, 0x8ef8, 0x8efc, 0x8f9c, 0x902e, 0x9035, 0x9031, + 0x9038, 0x9032, 0x9036, 0x9102, 0x90f5, 0x9109, 0x90fe, 0x9163, + 0x9165, 0x91cf, 0x9214, 0x9215, 0x9223, 0x9209, 0x921e, 0x920d, + 0x9210, 0x9207, 0x9211, 0x9594, 0x958f, 0x958b, 0x9591, 0x9593, + 0x9592, 0x958e, 0x968a, 0x968e, 0x968b, 0x967d, 0x9685, 0x9686, + 0x968d, 0x9672, 0x9684, 0x96c1, 0x96c5, 0x96c4, 0x96c6, 0x96c7, + 0x96ef, 0x96f2, 0x97cc, 0x9805, 0x9806, 0x9808, 0x98e7, 0x98ea, + 0x98ef, 0x98e9, 0x98f2, 0x98ed, 0x99ae, 0x99ad, 0x9ec3, 0x9ecd, + 0x9ed1, 0x4e82, 0x50ad, 0x50b5, 0x50b2, 0x50b3, 0x50c5, 0x50be, + 0x50ac, 0x50b7, 0x50bb, 0x50af, 0x50c7, 0x527f, 0x5277, 0x527d, + 0x52df, 0x52e6, 0x52e4, 0x52e2, 0x52e3, 0x532f, 0x55df, 0x55e8, + 0x55d3, 0x55e6, 0x55ce, 0x55dc, 0x55c7, 0x55d1, 0x55e3, 0x55e4, + 0x55ef, 0x55da, 0x55e1, 0x55c5, 0x55c6, 0x55e5, 0x55c9, 0x5712, + 0x5713, 0x585e, 0x5851, 0x5858, 0x5857, 0x585a, 0x5854, 0x586b, + 0x584c, 0x586d, 0x584a, 0x5862, 0x5852, 0x584b, 0x5967, 0x5ac1, + 0x5ac9, 0x5acc, 0x5abe, 0x5abd, 0x5abc, + /* 0xb7 */ + 0x5ab3, 0x5ac2, 0x5ab2, 0x5d69, 0x5d6f, 0x5e4c, 0x5e79, 0x5ec9, + 0x5ec8, 0x5f12, 0x5f59, 0x5fac, 0x5fae, 0x611a, 0x610f, 0x6148, + 0x611f, 0x60f3, 0x611b, 0x60f9, 0x6101, 0x6108, 0x614e, 0x614c, + 0x6144, 0x614d, 0x613e, 0x6134, 0x6127, 0x610d, 0x6106, 0x6137, + 0x6221, 0x6222, 0x6413, 0x643e, 0x641e, 0x642a, 0x642d, 0x643d, + 0x642c, 0x640f, 0x641c, 0x6414, 0x640d, 0x6436, 0x6416, 0x6417, + 0x6406, 0x656c, 0x659f, 0x65b0, 0x6697, 0x6689, 0x6687, 0x6688, + 0x6696, 0x6684, 0x6698, 0x668d, 0x6703, 0x6994, 0x696d, 0x695a, + 0x6977, 0x6960, 0x6954, 0x6975, 0x6930, 0x6982, 0x694a, 0x6968, + 0x696b, 0x695e, 0x6953, 0x6979, 0x6986, 0x695d, 0x6963, 0x695b, + 0x6b47, 0x6b72, 0x6bc0, 0x6bbf, 0x6bd3, 0x6bfd, 0x6ea2, 0x6eaf, + 0x6ed3, 0x6eb6, 0x6ec2, 0x6e90, 0x6e9d, 0x6ec7, 0x6ec5, 0x6ea5, + 0x6e98, 0x6ebc, 0x6eba, 0x6eab, 0x6ed1, 0x6e96, 0x6e9c, 0x6ec4, + 0x6ed4, 0x6eaa, 0x6ea7, 0x6eb4, 0x714e, 0x7159, 0x7169, 0x7164, + 0x7149, 0x7167, 0x715c, 0x716c, 0x7166, 0x714c, 0x7165, 0x715e, + 0x7146, 0x7168, 0x7156, 0x723a, 0x7252, 0x7337, 0x7345, 0x733f, + 0x733e, 0x746f, 0x745a, 0x7455, 0x745f, 0x745e, 0x7441, 0x743f, + 0x7459, 0x745b, 0x745c, 0x7576, 0x7578, 0x7600, 0x75f0, 0x7601, + 0x75f2, 0x75f1, 0x75fa, 0x75ff, 0x75f4, 0x75f3, 0x76de, 0x76df, + 0x775b, 0x776b, 0x7766, 0x775e, 0x7763, + /* 0xb8 */ + 0x7779, 0x776a, 0x776c, 0x775c, 0x7765, 0x7768, 0x7762, 0x77ee, + 0x788e, 0x78b0, 0x7897, 0x7898, 0x788c, 0x7889, 0x787c, 0x7891, + 0x7893, 0x787f, 0x797a, 0x797f, 0x7981, 0x842c, 0x79bd, 0x7a1c, + 0x7a1a, 0x7a20, 0x7a14, 0x7a1f, 0x7a1e, 0x7a9f, 0x7aa0, 0x7b77, + 0x7bc0, 0x7b60, 0x7b6e, 0x7b67, 0x7cb1, 0x7cb3, 0x7cb5, 0x7d93, + 0x7d79, 0x7d91, 0x7d81, 0x7d8f, 0x7d5b, 0x7f6e, 0x7f69, 0x7f6a, + 0x7f72, 0x7fa9, 0x7fa8, 0x7fa4, 0x8056, 0x8058, 0x8086, 0x8084, + 0x8171, 0x8170, 0x8178, 0x8165, 0x816e, 0x8173, 0x816b, 0x8179, + 0x817a, 0x8166, 0x8205, 0x8247, 0x8482, 0x8477, 0x843d, 0x8431, + 0x8475, 0x8466, 0x846b, 0x8449, 0x846c, 0x845b, 0x843c, 0x8435, + 0x8461, 0x8463, 0x8469, 0x846d, 0x8446, 0x865e, 0x865c, 0x865f, + 0x86f9, 0x8713, 0x8708, 0x8707, 0x8700, 0x86fe, 0x86fb, 0x8702, + 0x8703, 0x8706, 0x870a, 0x8859, 0x88df, 0x88d4, 0x88d9, 0x88dc, + 0x88d8, 0x88dd, 0x88e1, 0x88ca, 0x88d5, 0x88d2, 0x899c, 0x89e3, + 0x8a6b, 0x8a72, 0x8a73, 0x8a66, 0x8a69, 0x8a70, 0x8a87, 0x8a7c, + 0x8a63, 0x8aa0, 0x8a71, 0x8a85, 0x8a6d, 0x8a62, 0x8a6e, 0x8a6c, + 0x8a79, 0x8a7b, 0x8a3e, 0x8a68, 0x8c62, 0x8c8a, 0x8c89, 0x8cca, + 0x8cc7, 0x8cc8, 0x8cc4, 0x8cb2, 0x8cc3, 0x8cc2, 0x8cc5, 0x8de1, + 0x8ddf, 0x8de8, 0x8def, 0x8df3, 0x8dfa, 0x8dea, 0x8de4, 0x8de6, + 0x8eb2, 0x8f03, 0x8f09, 0x8efe, 0x8f0a, + /* 0xb9 */ + 0x8f9f, 0x8fb2, 0x904b, 0x904a, 0x9053, 0x9042, 0x9054, 0x903c, + 0x9055, 0x9050, 0x9047, 0x904f, 0x904e, 0x904d, 0x9051, 0x903e, + 0x9041, 0x9112, 0x9117, 0x916c, 0x916a, 0x9169, 0x91c9, 0x9237, + 0x9257, 0x9238, 0x923d, 0x9240, 0x923e, 0x925b, 0x924b, 0x9264, + 0x9251, 0x9234, 0x9249, 0x924d, 0x9245, 0x9239, 0x923f, 0x925a, + 0x9598, 0x9698, 0x9694, 0x9695, 0x96cd, 0x96cb, 0x96c9, 0x96ca, + 0x96f7, 0x96fb, 0x96f9, 0x96f6, 0x9756, 0x9774, 0x9776, 0x9810, + 0x9811, 0x9813, 0x980a, 0x9812, 0x980c, 0x98fc, 0x98f4, 0x98fd, + 0x98fe, 0x99b3, 0x99b1, 0x99b4, 0x9ae1, 0x9ce9, 0x9e82, 0x9f0e, + 0x9f13, 0x9f20, 0x50e7, 0x50ee, 0x50e5, 0x50d6, 0x50ed, 0x50da, + 0x50d5, 0x50cf, 0x50d1, 0x50f1, 0x50ce, 0x50e9, 0x5162, 0x51f3, + 0x5283, 0x5282, 0x5331, 0x53ad, 0x55fe, 0x5600, 0x561b, 0x5617, + 0x55fd, 0x5614, 0x5606, 0x5609, 0x560d, 0x560e, 0x55f7, 0x5616, + 0x561f, 0x5608, 0x5610, 0x55f6, 0x5718, 0x5716, 0x5875, 0x587e, + 0x5883, 0x5893, 0x588a, 0x5879, 0x5885, 0x587d, 0x58fd, 0x5925, + 0x5922, 0x5924, 0x596a, 0x5969, 0x5ae1, 0x5ae6, 0x5ae9, 0x5ad7, + 0x5ad6, 0x5ad8, 0x5ae3, 0x5b75, 0x5bde, 0x5be7, 0x5be1, 0x5be5, + 0x5be6, 0x5be8, 0x5be2, 0x5be4, 0x5bdf, 0x5c0d, 0x5c62, 0x5d84, + 0x5d87, 0x5e5b, 0x5e63, 0x5e55, 0x5e57, 0x5e54, 0x5ed3, 0x5ed6, + 0x5f0a, 0x5f46, 0x5f70, 0x5fb9, 0x6147, + /* 0xba */ + 0x613f, 0x614b, 0x6177, 0x6162, 0x6163, 0x615f, 0x615a, 0x6158, + 0x6175, 0x622a, 0x6487, 0x6458, 0x6454, 0x64a4, 0x6478, 0x645f, + 0x647a, 0x6451, 0x6467, 0x6434, 0x646d, 0x647b, 0x6572, 0x65a1, + 0x65d7, 0x65d6, 0x66a2, 0x66a8, 0x669d, 0x699c, 0x69a8, 0x6995, + 0x69c1, 0x69ae, 0x69d3, 0x69cb, 0x699b, 0x69b7, 0x69bb, 0x69ab, + 0x69b4, 0x69d0, 0x69cd, 0x69ad, 0x69cc, 0x69a6, 0x69c3, 0x69a3, + 0x6b49, 0x6b4c, 0x6c33, 0x6f33, 0x6f14, 0x6efe, 0x6f13, 0x6ef4, + 0x6f29, 0x6f3e, 0x6f20, 0x6f2c, 0x6f0f, 0x6f02, 0x6f22, 0x6eff, + 0x6eef, 0x6f06, 0x6f31, 0x6f38, 0x6f32, 0x6f23, 0x6f15, 0x6f2b, + 0x6f2f, 0x6f88, 0x6f2a, 0x6eec, 0x6f01, 0x6ef2, 0x6ecc, 0x6ef7, + 0x7194, 0x7199, 0x717d, 0x718a, 0x7184, 0x7192, 0x723e, 0x7292, + 0x7296, 0x7344, 0x7350, 0x7464, 0x7463, 0x746a, 0x7470, 0x746d, + 0x7504, 0x7591, 0x7627, 0x760d, 0x760b, 0x7609, 0x7613, 0x76e1, + 0x76e3, 0x7784, 0x777d, 0x777f, 0x7761, 0x78c1, 0x789f, 0x78a7, + 0x78b3, 0x78a9, 0x78a3, 0x798e, 0x798f, 0x798d, 0x7a2e, 0x7a31, + 0x7aaa, 0x7aa9, 0x7aed, 0x7aef, 0x7ba1, 0x7b95, 0x7b8b, 0x7b75, + 0x7b97, 0x7b9d, 0x7b94, 0x7b8f, 0x7bb8, 0x7b87, 0x7b84, 0x7cb9, + 0x7cbd, 0x7cbe, 0x7dbb, 0x7db0, 0x7d9c, 0x7dbd, 0x7dbe, 0x7da0, + 0x7dca, 0x7db4, 0x7db2, 0x7db1, 0x7dba, 0x7da2, 0x7dbf, 0x7db5, + 0x7db8, 0x7dad, 0x7dd2, 0x7dc7, 0x7dac, + /* 0xbb */ + 0x7f70, 0x7fe0, 0x7fe1, 0x7fdf, 0x805e, 0x805a, 0x8087, 0x8150, + 0x8180, 0x818f, 0x8188, 0x818a, 0x817f, 0x8182, 0x81e7, 0x81fa, + 0x8207, 0x8214, 0x821e, 0x824b, 0x84c9, 0x84bf, 0x84c6, 0x84c4, + 0x8499, 0x849e, 0x84b2, 0x849c, 0x84cb, 0x84b8, 0x84c0, 0x84d3, + 0x8490, 0x84bc, 0x84d1, 0x84ca, 0x873f, 0x871c, 0x873b, 0x8722, + 0x8725, 0x8734, 0x8718, 0x8755, 0x8737, 0x8729, 0x88f3, 0x8902, + 0x88f4, 0x88f9, 0x88f8, 0x88fd, 0x88e8, 0x891a, 0x88ef, 0x8aa6, + 0x8a8c, 0x8a9e, 0x8aa3, 0x8a8d, 0x8aa1, 0x8a93, 0x8aa4, 0x8aaa, + 0x8aa5, 0x8aa8, 0x8a98, 0x8a91, 0x8a9a, 0x8aa7, 0x8c6a, 0x8c8d, + 0x8c8c, 0x8cd3, 0x8cd1, 0x8cd2, 0x8d6b, 0x8d99, 0x8d95, 0x8dfc, + 0x8f14, 0x8f12, 0x8f15, 0x8f13, 0x8fa3, 0x9060, 0x9058, 0x905c, + 0x9063, 0x9059, 0x905e, 0x9062, 0x905d, 0x905b, 0x9119, 0x9118, + 0x911e, 0x9175, 0x9178, 0x9177, 0x9174, 0x9278, 0x9280, 0x9285, + 0x9298, 0x9296, 0x927b, 0x9293, 0x929c, 0x92a8, 0x927c, 0x9291, + 0x95a1, 0x95a8, 0x95a9, 0x95a3, 0x95a5, 0x95a4, 0x9699, 0x969c, + 0x969b, 0x96cc, 0x96d2, 0x9700, 0x977c, 0x9785, 0x97f6, 0x9817, + 0x9818, 0x98af, 0x98b1, 0x9903, 0x9905, 0x990c, 0x9909, 0x99c1, + 0x9aaf, 0x9ab0, 0x9ae6, 0x9b41, 0x9b42, 0x9cf4, 0x9cf6, 0x9cf3, + 0x9ebc, 0x9f3b, 0x9f4a, 0x5104, 0x5100, 0x50fb, 0x50f5, 0x50f9, + 0x5102, 0x5108, 0x5109, 0x5105, 0x51dc, + /* 0xbc */ + 0x5287, 0x5288, 0x5289, 0x528d, 0x528a, 0x52f0, 0x53b2, 0x562e, + 0x563b, 0x5639, 0x5632, 0x563f, 0x5634, 0x5629, 0x5653, 0x564e, + 0x5657, 0x5674, 0x5636, 0x562f, 0x5630, 0x5880, 0x589f, 0x589e, + 0x58b3, 0x589c, 0x58ae, 0x58a9, 0x58a6, 0x596d, 0x5b09, 0x5afb, + 0x5b0b, 0x5af5, 0x5b0c, 0x5b08, 0x5bee, 0x5bec, 0x5be9, 0x5beb, + 0x5c64, 0x5c65, 0x5d9d, 0x5d94, 0x5e62, 0x5e5f, 0x5e61, 0x5ee2, + 0x5eda, 0x5edf, 0x5edd, 0x5ee3, 0x5ee0, 0x5f48, 0x5f71, 0x5fb7, + 0x5fb5, 0x6176, 0x6167, 0x616e, 0x615d, 0x6155, 0x6182, 0x617c, + 0x6170, 0x616b, 0x617e, 0x61a7, 0x6190, 0x61ab, 0x618e, 0x61ac, + 0x619a, 0x61a4, 0x6194, 0x61ae, 0x622e, 0x6469, 0x646f, 0x6479, + 0x649e, 0x64b2, 0x6488, 0x6490, 0x64b0, 0x64a5, 0x6493, 0x6495, + 0x64a9, 0x6492, 0x64ae, 0x64ad, 0x64ab, 0x649a, 0x64ac, 0x6499, + 0x64a2, 0x64b3, 0x6575, 0x6577, 0x6578, 0x66ae, 0x66ab, 0x66b4, + 0x66b1, 0x6a23, 0x6a1f, 0x69e8, 0x6a01, 0x6a1e, 0x6a19, 0x69fd, + 0x6a21, 0x6a13, 0x6a0a, 0x69f3, 0x6a02, 0x6a05, 0x69ed, 0x6a11, + 0x6b50, 0x6b4e, 0x6ba4, 0x6bc5, 0x6bc6, 0x6f3f, 0x6f7c, 0x6f84, + 0x6f51, 0x6f66, 0x6f54, 0x6f86, 0x6f6d, 0x6f5b, 0x6f78, 0x6f6e, + 0x6f8e, 0x6f7a, 0x6f70, 0x6f64, 0x6f97, 0x6f58, 0x6ed5, 0x6f6f, + 0x6f60, 0x6f5f, 0x719f, 0x71ac, 0x71b1, 0x71a8, 0x7256, 0x729b, + 0x734e, 0x7357, 0x7469, 0x748b, 0x7483, + /* 0xbd */ + 0x747e, 0x7480, 0x757f, 0x7620, 0x7629, 0x761f, 0x7624, 0x7626, + 0x7621, 0x7622, 0x769a, 0x76ba, 0x76e4, 0x778e, 0x7787, 0x778c, + 0x7791, 0x778b, 0x78cb, 0x78c5, 0x78ba, 0x78ca, 0x78be, 0x78d5, + 0x78bc, 0x78d0, 0x7a3f, 0x7a3c, 0x7a40, 0x7a3d, 0x7a37, 0x7a3b, + 0x7aaf, 0x7aae, 0x7bad, 0x7bb1, 0x7bc4, 0x7bb4, 0x7bc6, 0x7bc7, + 0x7bc1, 0x7ba0, 0x7bcc, 0x7cca, 0x7de0, 0x7df4, 0x7def, 0x7dfb, + 0x7dd8, 0x7dec, 0x7ddd, 0x7de8, 0x7de3, 0x7dda, 0x7dde, 0x7de9, + 0x7d9e, 0x7dd9, 0x7df2, 0x7df9, 0x7f75, 0x7f77, 0x7faf, 0x7fe9, + 0x8026, 0x819b, 0x819c, 0x819d, 0x81a0, 0x819a, 0x8198, 0x8517, + 0x853d, 0x851a, 0x84ee, 0x852c, 0x852d, 0x8513, 0x8511, 0x8523, + 0x8521, 0x8514, 0x84ec, 0x8525, 0x84ff, 0x8506, 0x8782, 0x8774, + 0x8776, 0x8760, 0x8766, 0x8778, 0x8768, 0x8759, 0x8757, 0x874c, + 0x8753, 0x885b, 0x885d, 0x8910, 0x8907, 0x8912, 0x8913, 0x8915, + 0x890a, 0x8abc, 0x8ad2, 0x8ac7, 0x8ac4, 0x8a95, 0x8acb, 0x8af8, + 0x8ab2, 0x8ac9, 0x8ac2, 0x8abf, 0x8ab0, 0x8ad6, 0x8acd, 0x8ab6, + 0x8ab9, 0x8adb, 0x8c4c, 0x8c4e, 0x8c6c, 0x8ce0, 0x8cde, 0x8ce6, + 0x8ce4, 0x8cec, 0x8ced, 0x8ce2, 0x8ce3, 0x8cdc, 0x8cea, 0x8ce1, + 0x8d6d, 0x8d9f, 0x8da3, 0x8e2b, 0x8e10, 0x8e1d, 0x8e22, 0x8e0f, + 0x8e29, 0x8e1f, 0x8e21, 0x8e1e, 0x8eba, 0x8f1d, 0x8f1b, 0x8f1f, + 0x8f29, 0x8f26, 0x8f2a, 0x8f1c, 0x8f1e, + /* 0xbe */ + 0x8f25, 0x9069, 0x906e, 0x9068, 0x906d, 0x9077, 0x9130, 0x912d, + 0x9127, 0x9131, 0x9187, 0x9189, 0x918b, 0x9183, 0x92c5, 0x92bb, + 0x92b7, 0x92ea, 0x92ac, 0x92e4, 0x92c1, 0x92b3, 0x92bc, 0x92d2, + 0x92c7, 0x92f0, 0x92b2, 0x95ad, 0x95b1, 0x9704, 0x9706, 0x9707, + 0x9709, 0x9760, 0x978d, 0x978b, 0x978f, 0x9821, 0x982b, 0x981c, + 0x98b3, 0x990a, 0x9913, 0x9912, 0x9918, 0x99dd, 0x99d0, 0x99df, + 0x99db, 0x99d1, 0x99d5, 0x99d2, 0x99d9, 0x9ab7, 0x9aee, 0x9aef, + 0x9b27, 0x9b45, 0x9b44, 0x9b77, 0x9b6f, 0x9d06, 0x9d09, 0x9d03, + 0x9ea9, 0x9ebe, 0x9ece, 0x58a8, 0x9f52, 0x5112, 0x5118, 0x5114, + 0x5110, 0x5115, 0x5180, 0x51aa, 0x51dd, 0x5291, 0x5293, 0x52f3, + 0x5659, 0x566b, 0x5679, 0x5669, 0x5664, 0x5678, 0x566a, 0x5668, + 0x5665, 0x5671, 0x566f, 0x566c, 0x5662, 0x5676, 0x58c1, 0x58be, + 0x58c7, 0x58c5, 0x596e, 0x5b1d, 0x5b34, 0x5b78, 0x5bf0, 0x5c0e, + 0x5f4a, 0x61b2, 0x6191, 0x61a9, 0x618a, 0x61cd, 0x61b6, 0x61be, + 0x61ca, 0x61c8, 0x6230, 0x64c5, 0x64c1, 0x64cb, 0x64bb, 0x64bc, + 0x64da, 0x64c4, 0x64c7, 0x64c2, 0x64cd, 0x64bf, 0x64d2, 0x64d4, + 0x64be, 0x6574, 0x66c6, 0x66c9, 0x66b9, 0x66c4, 0x66c7, 0x66b8, + 0x6a3d, 0x6a38, 0x6a3a, 0x6a59, 0x6a6b, 0x6a58, 0x6a39, 0x6a44, + 0x6a62, 0x6a61, 0x6a4b, 0x6a47, 0x6a35, 0x6a5f, 0x6a48, 0x6b59, + 0x6b77, 0x6c05, 0x6fc2, 0x6fb1, 0x6fa1, + /* 0xbf */ + 0x6fc3, 0x6fa4, 0x6fc1, 0x6fa7, 0x6fb3, 0x6fc0, 0x6fb9, 0x6fb6, + 0x6fa6, 0x6fa0, 0x6fb4, 0x71be, 0x71c9, 0x71d0, 0x71d2, 0x71c8, + 0x71d5, 0x71b9, 0x71ce, 0x71d9, 0x71dc, 0x71c3, 0x71c4, 0x7368, + 0x749c, 0x74a3, 0x7498, 0x749f, 0x749e, 0x74e2, 0x750c, 0x750d, + 0x7634, 0x7638, 0x763a, 0x76e7, 0x76e5, 0x77a0, 0x779e, 0x779f, + 0x77a5, 0x78e8, 0x78da, 0x78ec, 0x78e7, 0x79a6, 0x7a4d, 0x7a4e, + 0x7a46, 0x7a4c, 0x7a4b, 0x7aba, 0x7bd9, 0x7c11, 0x7bc9, 0x7be4, + 0x7bdb, 0x7be1, 0x7be9, 0x7be6, 0x7cd5, 0x7cd6, 0x7e0a, 0x7e11, + 0x7e08, 0x7e1b, 0x7e23, 0x7e1e, 0x7e1d, 0x7e09, 0x7e10, 0x7f79, + 0x7fb2, 0x7ff0, 0x7ff1, 0x7fee, 0x8028, 0x81b3, 0x81a9, 0x81a8, + 0x81fb, 0x8208, 0x8258, 0x8259, 0x854a, 0x8559, 0x8548, 0x8568, + 0x8569, 0x8543, 0x8549, 0x856d, 0x856a, 0x855e, 0x8783, 0x879f, + 0x879e, 0x87a2, 0x878d, 0x8861, 0x892a, 0x8932, 0x8925, 0x892b, + 0x8921, 0x89aa, 0x89a6, 0x8ae6, 0x8afa, 0x8aeb, 0x8af1, 0x8b00, + 0x8adc, 0x8ae7, 0x8aee, 0x8afe, 0x8b01, 0x8b02, 0x8af7, 0x8aed, + 0x8af3, 0x8af6, 0x8afc, 0x8c6b, 0x8c6d, 0x8c93, 0x8cf4, 0x8e44, + 0x8e31, 0x8e34, 0x8e42, 0x8e39, 0x8e35, 0x8f3b, 0x8f2f, 0x8f38, + 0x8f33, 0x8fa8, 0x8fa6, 0x9075, 0x9074, 0x9078, 0x9072, 0x907c, + 0x907a, 0x9134, 0x9192, 0x9320, 0x9336, 0x92f8, 0x9333, 0x932f, + 0x9322, 0x92fc, 0x932b, 0x9304, 0x931a, + /* 0xc0 */ + 0x9310, 0x9326, 0x9321, 0x9315, 0x932e, 0x9319, 0x95bb, 0x96a7, + 0x96a8, 0x96aa, 0x96d5, 0x970e, 0x9711, 0x9716, 0x970d, 0x9713, + 0x970f, 0x975b, 0x975c, 0x9766, 0x9798, 0x9830, 0x9838, 0x983b, + 0x9837, 0x982d, 0x9839, 0x9824, 0x9910, 0x9928, 0x991e, 0x991b, + 0x9921, 0x991a, 0x99ed, 0x99e2, 0x99f1, 0x9ab8, 0x9abc, 0x9afb, + 0x9aed, 0x9b28, 0x9b91, 0x9d15, 0x9d23, 0x9d26, 0x9d28, 0x9d12, + 0x9d1b, 0x9ed8, 0x9ed4, 0x9f8d, 0x9f9c, 0x512a, 0x511f, 0x5121, + 0x5132, 0x52f5, 0x568e, 0x5680, 0x5690, 0x5685, 0x5687, 0x568f, + 0x58d5, 0x58d3, 0x58d1, 0x58ce, 0x5b30, 0x5b2a, 0x5b24, 0x5b7a, + 0x5c37, 0x5c68, 0x5dbc, 0x5dba, 0x5dbd, 0x5db8, 0x5e6b, 0x5f4c, + 0x5fbd, 0x61c9, 0x61c2, 0x61c7, 0x61e6, 0x61cb, 0x6232, 0x6234, + 0x64ce, 0x64ca, 0x64d8, 0x64e0, 0x64f0, 0x64e6, 0x64ec, 0x64f1, + 0x64e2, 0x64ed, 0x6582, 0x6583, 0x66d9, 0x66d6, 0x6a80, 0x6a94, + 0x6a84, 0x6aa2, 0x6a9c, 0x6adb, 0x6aa3, 0x6a7e, 0x6a97, 0x6a90, + 0x6aa0, 0x6b5c, 0x6bae, 0x6bda, 0x6c08, 0x6fd8, 0x6ff1, 0x6fdf, + 0x6fe0, 0x6fdb, 0x6fe4, 0x6feb, 0x6fef, 0x6f80, 0x6fec, 0x6fe1, + 0x6fe9, 0x6fd5, 0x6fee, 0x6ff0, 0x71e7, 0x71df, 0x71ee, 0x71e6, + 0x71e5, 0x71ed, 0x71ec, 0x71f4, 0x71e0, 0x7235, 0x7246, 0x7370, + 0x7372, 0x74a9, 0x74b0, 0x74a6, 0x74a8, 0x7646, 0x7642, 0x764c, + 0x76ea, 0x77b3, 0x77aa, 0x77b0, 0x77ac, + /* 0xc1 */ + 0x77a7, 0x77ad, 0x77ef, 0x78f7, 0x78fa, 0x78f4, 0x78ef, 0x7901, + 0x79a7, 0x79aa, 0x7a57, 0x7abf, 0x7c07, 0x7c0d, 0x7bfe, 0x7bf7, + 0x7c0c, 0x7be0, 0x7ce0, 0x7cdc, 0x7cde, 0x7ce2, 0x7cdf, 0x7cd9, + 0x7cdd, 0x7e2e, 0x7e3e, 0x7e46, 0x7e37, 0x7e32, 0x7e43, 0x7e2b, + 0x7e3d, 0x7e31, 0x7e45, 0x7e41, 0x7e34, 0x7e39, 0x7e48, 0x7e35, + 0x7e3f, 0x7e2f, 0x7f44, 0x7ff3, 0x7ffc, 0x8071, 0x8072, 0x8070, + 0x806f, 0x8073, 0x81c6, 0x81c3, 0x81ba, 0x81c2, 0x81c0, 0x81bf, + 0x81bd, 0x81c9, 0x81be, 0x81e8, 0x8209, 0x8271, 0x85aa, 0x8584, + 0x857e, 0x859c, 0x8591, 0x8594, 0x85af, 0x859b, 0x8587, 0x85a8, + 0x858a, 0x8667, 0x87c0, 0x87d1, 0x87b3, 0x87d2, 0x87c6, 0x87ab, + 0x87bb, 0x87ba, 0x87c8, 0x87cb, 0x893b, 0x8936, 0x8944, 0x8938, + 0x893d, 0x89ac, 0x8b0e, 0x8b17, 0x8b19, 0x8b1b, 0x8b0a, 0x8b20, + 0x8b1d, 0x8b04, 0x8b10, 0x8c41, 0x8c3f, 0x8c73, 0x8cfa, 0x8cfd, + 0x8cfc, 0x8cf8, 0x8cfb, 0x8da8, 0x8e49, 0x8e4b, 0x8e48, 0x8e4a, + 0x8f44, 0x8f3e, 0x8f42, 0x8f45, 0x8f3f, 0x907f, 0x907d, 0x9084, + 0x9081, 0x9082, 0x9080, 0x9139, 0x91a3, 0x919e, 0x919c, 0x934d, + 0x9382, 0x9328, 0x9375, 0x934a, 0x9365, 0x934b, 0x9318, 0x937e, + 0x936c, 0x935b, 0x9370, 0x935a, 0x9354, 0x95ca, 0x95cb, 0x95cc, + 0x95c8, 0x95c6, 0x96b1, 0x96b8, 0x96d6, 0x971c, 0x971e, 0x97a0, + 0x97d3, 0x9846, 0x98b6, 0x9935, 0x9a01, + /* 0xc2 */ + 0x99ff, 0x9bae, 0x9bab, 0x9baa, 0x9bad, 0x9d3b, 0x9d3f, 0x9e8b, + 0x9ecf, 0x9ede, 0x9edc, 0x9edd, 0x9edb, 0x9f3e, 0x9f4b, 0x53e2, + 0x5695, 0x56ae, 0x58d9, 0x58d8, 0x5b38, 0x5f5d, 0x61e3, 0x6233, + 0x64f4, 0x64f2, 0x64fe, 0x6506, 0x64fa, 0x64fb, 0x64f7, 0x65b7, + 0x66dc, 0x6726, 0x6ab3, 0x6aac, 0x6ac3, 0x6abb, 0x6ab8, 0x6ac2, + 0x6aae, 0x6aaf, 0x6b5f, 0x6b78, 0x6baf, 0x7009, 0x700b, 0x6ffe, + 0x7006, 0x6ffa, 0x7011, 0x700f, 0x71fb, 0x71fc, 0x71fe, 0x71f8, + 0x7377, 0x7375, 0x74a7, 0x74bf, 0x7515, 0x7656, 0x7658, 0x7652, + 0x77bd, 0x77bf, 0x77bb, 0x77bc, 0x790e, 0x79ae, 0x7a61, 0x7a62, + 0x7a60, 0x7ac4, 0x7ac5, 0x7c2b, 0x7c27, 0x7c2a, 0x7c1e, 0x7c23, + 0x7c21, 0x7ce7, 0x7e54, 0x7e55, 0x7e5e, 0x7e5a, 0x7e61, 0x7e52, + 0x7e59, 0x7f48, 0x7ff9, 0x7ffb, 0x8077, 0x8076, 0x81cd, 0x81cf, + 0x820a, 0x85cf, 0x85a9, 0x85cd, 0x85d0, 0x85c9, 0x85b0, 0x85ba, + 0x85b9, 0x85a6, 0x87ef, 0x87ec, 0x87f2, 0x87e0, 0x8986, 0x89b2, + 0x89f4, 0x8b28, 0x8b39, 0x8b2c, 0x8b2b, 0x8c50, 0x8d05, 0x8e59, + 0x8e63, 0x8e66, 0x8e64, 0x8e5f, 0x8e55, 0x8ec0, 0x8f49, 0x8f4d, + 0x9087, 0x9083, 0x9088, 0x91ab, 0x91ac, 0x91d0, 0x9394, 0x938a, + 0x9396, 0x93a2, 0x93b3, 0x93ae, 0x93ac, 0x93b0, 0x9398, 0x939a, + 0x9397, 0x95d4, 0x95d6, 0x95d0, 0x95d5, 0x96e2, 0x96dc, 0x96d9, + 0x96db, 0x96de, 0x9724, 0x97a3, 0x97a6, + /* 0xc3 */ + 0x97ad, 0x97f9, 0x984d, 0x984f, 0x984c, 0x984e, 0x9853, 0x98ba, + 0x993e, 0x993f, 0x993d, 0x992e, 0x99a5, 0x9a0e, 0x9ac1, 0x9b03, + 0x9b06, 0x9b4f, 0x9b4e, 0x9b4d, 0x9bca, 0x9bc9, 0x9bfd, 0x9bc8, + 0x9bc0, 0x9d51, 0x9d5d, 0x9d60, 0x9ee0, 0x9f15, 0x9f2c, 0x5133, + 0x56a5, 0x58de, 0x58df, 0x58e2, 0x5bf5, 0x9f90, 0x5eec, 0x61f2, + 0x61f7, 0x61f6, 0x61f5, 0x6500, 0x650f, 0x66e0, 0x66dd, 0x6ae5, + 0x6add, 0x6ada, 0x6ad3, 0x701b, 0x701f, 0x7028, 0x701a, 0x701d, + 0x7015, 0x7018, 0x7206, 0x720d, 0x7258, 0x72a2, 0x7378, 0x737a, + 0x74bd, 0x74ca, 0x74e3, 0x7587, 0x7586, 0x765f, 0x7661, 0x77c7, + 0x7919, 0x79b1, 0x7a6b, 0x7a69, 0x7c3e, 0x7c3f, 0x7c38, 0x7c3d, + 0x7c37, 0x7c40, 0x7e6b, 0x7e6d, 0x7e79, 0x7e69, 0x7e6a, 0x7f85, + 0x7e73, 0x7fb6, 0x7fb9, 0x7fb8, 0x81d8, 0x85e9, 0x85dd, 0x85ea, + 0x85d5, 0x85e4, 0x85e5, 0x85f7, 0x87fb, 0x8805, 0x880d, 0x87f9, + 0x87fe, 0x8960, 0x895f, 0x8956, 0x895e, 0x8b41, 0x8b5c, 0x8b58, + 0x8b49, 0x8b5a, 0x8b4e, 0x8b4f, 0x8b46, 0x8b59, 0x8d08, 0x8d0a, + 0x8e7c, 0x8e72, 0x8e87, 0x8e76, 0x8e6c, 0x8e7a, 0x8e74, 0x8f54, + 0x8f4e, 0x8fad, 0x908a, 0x908b, 0x91b1, 0x91ae, 0x93e1, 0x93d1, + 0x93df, 0x93c3, 0x93c8, 0x93dc, 0x93dd, 0x93d6, 0x93e2, 0x93cd, + 0x93d8, 0x93e4, 0x93d7, 0x93e8, 0x95dc, 0x96b4, 0x96e3, 0x972a, + 0x9727, 0x9761, 0x97dc, 0x97fb, 0x985e, + /* 0xc4 */ + 0x9858, 0x985b, 0x98bc, 0x9945, 0x9949, 0x9a16, 0x9a19, 0x9b0d, + 0x9be8, 0x9be7, 0x9bd6, 0x9bdb, 0x9d89, 0x9d61, 0x9d72, 0x9d6a, + 0x9d6c, 0x9e92, 0x9e97, 0x9e93, 0x9eb4, 0x52f8, 0x56a8, 0x56b7, + 0x56b6, 0x56b4, 0x56bc, 0x58e4, 0x5b40, 0x5b43, 0x5b7d, 0x5bf6, + 0x5dc9, 0x61f8, 0x61fa, 0x6518, 0x6514, 0x6519, 0x66e6, 0x6727, + 0x6aec, 0x703e, 0x7030, 0x7032, 0x7210, 0x737b, 0x74cf, 0x7662, + 0x7665, 0x7926, 0x792a, 0x792c, 0x792b, 0x7ac7, 0x7af6, 0x7c4c, + 0x7c43, 0x7c4d, 0x7cef, 0x7cf0, 0x8fae, 0x7e7d, 0x7e7c, 0x7e82, + 0x7f4c, 0x8000, 0x81da, 0x8266, 0x85fb, 0x85f9, 0x8611, 0x85fa, + 0x8606, 0x860b, 0x8607, 0x860a, 0x8814, 0x8815, 0x8964, 0x89ba, + 0x89f8, 0x8b70, 0x8b6c, 0x8b66, 0x8b6f, 0x8b5f, 0x8b6b, 0x8d0f, + 0x8d0d, 0x8e89, 0x8e81, 0x8e85, 0x8e82, 0x91b4, 0x91cb, 0x9418, + 0x9403, 0x93fd, 0x95e1, 0x9730, 0x98c4, 0x9952, 0x9951, 0x99a8, + 0x9a2b, 0x9a30, 0x9a37, 0x9a35, 0x9c13, 0x9c0d, 0x9e79, 0x9eb5, + 0x9ee8, 0x9f2f, 0x9f5f, 0x9f63, 0x9f61, 0x5137, 0x5138, 0x56c1, + 0x56c0, 0x56c2, 0x5914, 0x5c6c, 0x5dcd, 0x61fc, 0x61fe, 0x651d, + 0x651c, 0x6595, 0x66e9, 0x6afb, 0x6b04, 0x6afa, 0x6bb2, 0x704c, + 0x721b, 0x72a7, 0x74d6, 0x74d4, 0x7669, 0x77d3, 0x7c50, 0x7e8f, + 0x7e8c, 0x7fbc, 0x8617, 0x862d, 0x861a, 0x8823, 0x8822, 0x8821, + 0x881f, 0x896a, 0x896c, 0x89bd, 0x8b74, + /* 0xc5 */ + 0x8b77, 0x8b7d, 0x8d13, 0x8e8a, 0x8e8d, 0x8e8b, 0x8f5f, 0x8faf, + 0x91ba, 0x942e, 0x9433, 0x9435, 0x943a, 0x9438, 0x9432, 0x942b, + 0x95e2, 0x9738, 0x9739, 0x9732, 0x97ff, 0x9867, 0x9865, 0x9957, + 0x9a45, 0x9a43, 0x9a40, 0x9a3e, 0x9acf, 0x9b54, 0x9b51, 0x9c2d, + 0x9c25, 0x9daf, 0x9db4, 0x9dc2, 0x9db8, 0x9e9d, 0x9eef, 0x9f19, + 0x9f5c, 0x9f66, 0x9f67, 0x513c, 0x513b, 0x56c8, 0x56ca, 0x56c9, + 0x5b7f, 0x5dd4, 0x5dd2, 0x5f4e, 0x61ff, 0x6524, 0x6b0a, 0x6b61, + 0x7051, 0x7058, 0x7380, 0x74e4, 0x758a, 0x766e, 0x766c, 0x79b3, + 0x7c60, 0x7c5f, 0x807e, 0x807d, 0x81df, 0x8972, 0x896f, 0x89fc, + 0x8b80, 0x8d16, 0x8d17, 0x8e91, 0x8e93, 0x8f61, 0x9148, 0x9444, + 0x9451, 0x9452, 0x973d, 0x973e, 0x97c3, 0x97c1, 0x986b, 0x9955, + 0x9a55, 0x9a4d, 0x9ad2, 0x9b1a, 0x9c49, 0x9c31, 0x9c3e, 0x9c3b, + 0x9dd3, 0x9dd7, 0x9f34, 0x9f6c, 0x9f6a, 0x9f94, 0x56cc, 0x5dd6, + 0x6200, 0x6523, 0x652b, 0x652a, 0x66ec, 0x6b10, 0x74da, 0x7aca, + 0x7c64, 0x7c63, 0x7c65, 0x7e93, 0x7e96, 0x7e94, 0x81e2, 0x8638, + 0x863f, 0x8831, 0x8b8a, 0x9090, 0x908f, 0x9463, 0x9460, 0x9464, + 0x9768, 0x986f, 0x995c, 0x9a5a, 0x9a5b, 0x9a57, 0x9ad3, 0x9ad4, + 0x9ad1, 0x9c54, 0x9c57, 0x9c56, 0x9de5, 0x9e9f, 0x9ef4, 0x56d1, + 0x58e9, 0x652c, 0x705e, 0x7671, 0x7672, 0x77d7, 0x7f50, 0x7f88, + 0x8836, 0x8839, 0x8862, 0x8b93, 0x8b92, + /* 0xc6 */ + 0x8b96, 0x8277, 0x8d1b, 0x91c0, 0x946a, 0x9742, 0x9748, 0x9744, + 0x97c6, 0x9870, 0x9a5f, 0x9b22, 0x9b58, 0x9c5f, 0x9df9, 0x9dfa, + 0x9e7c, 0x9e7d, 0x9f07, 0x9f77, 0x9f72, 0x5ef3, 0x6b16, 0x7063, + 0x7c6c, 0x7c6e, 0x883b, 0x89c0, 0x8ea1, 0x91c1, 0x9472, 0x9470, + 0x9871, 0x995e, 0x9ad6, 0x9b23, 0x9ecc, 0x7064, 0x77da, 0x8b9a, + 0x9477, 0x97c9, 0x9a62, 0x9a65, 0x7e9c, 0x8b9c, 0x8eaa, 0x91c5, + 0x947d, 0x947e, 0x947c, 0x9c77, 0x9c78, 0x9ef7, 0x8c54, 0x947f, + 0x9e1a, 0x7228, 0x9a6a, 0x9b31, 0x9e1b, 0x9e1e, 0x7c72, 0x2460, + 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, + 0x2469, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, + 0x247b, 0x247c, 0x247d, 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, + 0x2175, 0x2176, 0x2177, 0x2178, 0x2179, 0x4e36, 0x4e3f, 0x4e85, + 0x4ea0, 0x5182, 0x5196, 0x51ab, 0x52f9, 0x5338, 0x5369, 0x53b6, + 0x590a, 0x5b80, 0x5ddb, 0x2f33, 0x5e7f, 0xf6df, 0x5f50, 0x5f61, + 0x6534, 0xf6e3, 0x7592, 0xf6e5, 0x8fb5, 0xf6e7, 0x00a8, 0x02c6, + 0x30fd, 0x30fe, 0x309d, 0x309e, 0xf6ee, 0xf6ef, 0x3005, 0x3006, + 0x3007, 0x30fc, 0xff3b, 0xff3d, 0x273d, 0x3041, 0x3042, 0x3043, + 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, + 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, + 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, + /* 0xc7 */ + 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, + 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, + 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, + 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, + 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, + 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, + 0x3091, 0x3092, 0x3093, 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, + 0x30a6, 0x30a7, 0x30a8, 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, + 0x30ae, 0x30af, 0x30b0, 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, + 0x30b6, 0x30b7, 0x30b8, 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, + 0x30be, 0x30bf, 0x30c0, 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, + 0x30c6, 0x30c7, 0x30c8, 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, + 0x30ce, 0x30cf, 0x30d0, 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, + 0x30d6, 0x30d7, 0x30d8, 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, + 0x30de, 0x30df, 0x30e0, 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, + 0x30e6, 0x30e7, 0x30e8, 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, + 0x30ee, 0x30ef, 0x30f0, 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, + 0x30f6, 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, + 0x0416, 0x0417, 0x0418, 0x0419, 0x041a, + /* 0xc8 */ + 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, 0x0420, 0x0421, 0x0422, + 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, 0x0428, 0x0429, 0x042a, + 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, 0x0430, 0x0431, 0x0432, + 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, 0x0437, 0x0438, 0x0439, + 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x0440, 0x0441, + 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, 0x0448, 0x0449, + 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, 0x21e7, 0x21b8, + 0x21b9, 0xf7e5, 0xf7e6, 0x4e5a, 0xf7e8, 0x5202, 0xf7ea, 0xf7eb, + 0x5188, 0xf7ed, 0xf7ee, 0xf7ef, 0xf7f0, 0xf7f1, 0xf7f2, 0xf7f3, + 0xf7f4, 0xf7f5, 0xf7f6, 0xf7f7, 0xf7f8, 0xf7f9, 0xf7fa, 0xf7fb, + 0xf7fc, 0xf7fd, 0xf7fe, 0xf7ff, 0xf800, 0xf801, 0xf802, 0xf803, + 0xf804, 0xf805, 0xf806, 0xf807, 0xf808, 0xf809, 0xf80a, 0xf80b, + 0xf80c, 0xf80d, 0xf80e, 0xf80f, 0xf810, 0xf811, 0xf812, 0xf813, + 0xf814, 0xf815, 0xf816, 0xffe2, 0xffe4, 0xff07, 0xff02, 0x3231, + 0x2116, 0x2121, 0x309b, 0x309c, 0x2e80, 0x2e84, 0x2e86, 0x2e87, + 0x2e88, 0x2e8a, 0x2e8c, 0x2e8d, 0x2e95, 0x2e9c, 0x2e9d, 0x2ea5, + 0x2ea7, 0x2eaa, 0x2eac, 0x2eae, 0x2eb6, 0x2ebc, 0x2ebe, 0x2ec6, + 0x2eca, 0x2ecc, 0x2ecd, 0x2ecf, 0x2ed6, 0x2ed7, 0x2ede, 0x2ee3, + 0xf83c, 0xf83d, 0xf83e, 0x0283, 0x0250, 0x025b, 0x0254, 0x0275, + 0x0153, 0x00f8, 0x014b, 0x028a, 0x026a, + /* 0xc9 */ + 0x4e42, 0x4e5c, 0x51f5, 0x531a, 0x5382, 0x4e07, 0x4e0c, 0x4e47, + 0x4e8d, 0x56d7, 0xfa0c, 0x5c6e, 0x5f73, 0x4e0f, 0x5187, 0x4e0e, + 0x4e2e, 0x4e93, 0x4ec2, 0x4ec9, 0x4ec8, 0x5198, 0x52fc, 0x536c, + 0x53b9, 0x5720, 0x5903, 0x592c, 0x5c10, 0x5dff, 0x65e1, 0x6bb3, + 0x6bcc, 0x6c14, 0x723f, 0x4e31, 0x4e3c, 0x4ee8, 0x4edc, 0x4ee9, + 0x4ee1, 0x4edd, 0x4eda, 0x520c, 0x531c, 0x534c, 0x5722, 0x5723, + 0x5917, 0x592f, 0x5b81, 0x5b84, 0x5c12, 0x5c3b, 0x5c74, 0x5c73, + 0x5e04, 0x5e80, 0x5e82, 0x5fc9, 0x6209, 0x6250, 0x6c15, 0x6c36, + 0x6c43, 0x6c3f, 0x6c3b, 0x72ae, 0x72b0, 0x738a, 0x79b8, 0x808a, + 0x961e, 0x4f0e, 0x4f18, 0x4f2c, 0x4ef5, 0x4f14, 0x4ef1, 0x4f00, + 0x4ef7, 0x4f08, 0x4f1d, 0x4f02, 0x4f05, 0x4f22, 0x4f13, 0x4f04, + 0x4ef4, 0x4f12, 0x51b1, 0x5213, 0x5209, 0x5210, 0x52a6, 0x5322, + 0x531f, 0x534d, 0x538a, 0x5407, 0x56e1, 0x56df, 0x572e, 0x572a, + 0x5734, 0x593c, 0x5980, 0x597c, 0x5985, 0x597b, 0x597e, 0x5977, + 0x597f, 0x5b56, 0x5c15, 0x5c25, 0x5c7c, 0x5c7a, 0x5c7b, 0x5c7e, + 0x5ddf, 0x5e75, 0x5e84, 0x5f02, 0x5f1a, 0x5f74, 0x5fd5, 0x5fd4, + 0x5fcf, 0x625c, 0x625e, 0x6264, 0x6261, 0x6266, 0x6262, 0x6259, + 0x6260, 0x625a, 0x6265, 0x65ef, 0x65ee, 0x673e, 0x6739, 0x6738, + 0x673b, 0x673a, 0x673f, 0x673c, 0x6733, 0x6c18, 0x6c46, 0x6c52, + 0x6c5c, 0x6c4f, 0x6c4a, 0x6c54, 0x6c4b, + /* 0xca */ + 0x6c4c, 0x7071, 0x725e, 0x72b4, 0x72b5, 0x738e, 0x752a, 0x767f, + 0x7a75, 0x7f51, 0x8278, 0x827c, 0x8280, 0x827d, 0x827f, 0x864d, + 0x897e, 0x9099, 0x9097, 0x9098, 0x909b, 0x9094, 0x9622, 0x9624, + 0x9620, 0x9623, 0x4f56, 0x4f3b, 0x4f62, 0x4f49, 0x4f53, 0x4f64, + 0x4f3e, 0x4f67, 0x4f52, 0x4f5f, 0x4f41, 0x4f58, 0x4f2d, 0x4f33, + 0x4f3f, 0x4f61, 0x518f, 0x51b9, 0x521c, 0x521e, 0x5221, 0x52ad, + 0x52ae, 0x5309, 0x5363, 0x5372, 0x538e, 0x538f, 0x5430, 0x5437, + 0x542a, 0x5454, 0x5445, 0x5419, 0x541c, 0x5425, 0x5418, 0x543d, + 0x544f, 0x5441, 0x5428, 0x5424, 0x5447, 0x56ee, 0x56e7, 0x56e5, + 0x5741, 0x5745, 0x574c, 0x5749, 0x574b, 0x5752, 0x5906, 0x5940, + 0x59a6, 0x5998, 0x59a0, 0x5997, 0x598e, 0x59a2, 0x5990, 0x598f, + 0x59a7, 0x59a1, 0x5b8e, 0x5b92, 0x5c28, 0x5c2a, 0x5c8d, 0x5c8f, + 0x5c88, 0x5c8b, 0x5c89, 0x5c92, 0x5c8a, 0x5c86, 0x5c93, 0x5c95, + 0x5de0, 0x5e0a, 0x5e0e, 0x5e8b, 0x5e89, 0x5e8c, 0x5e88, 0x5e8d, + 0x5f05, 0x5f1d, 0x5f78, 0x5f76, 0x5fd2, 0x5fd1, 0x5fd0, 0x5fed, + 0x5fe8, 0x5fee, 0x5ff3, 0x5fe1, 0x5fe4, 0x5fe3, 0x5ffa, 0x5fef, + 0x5ff7, 0x5ffb, 0x6000, 0x5ff4, 0x623a, 0x6283, 0x628c, 0x628e, + 0x628f, 0x6294, 0x6287, 0x6271, 0x627b, 0x627a, 0x6270, 0x6281, + 0x6288, 0x6277, 0x627d, 0x6272, 0x6274, 0x6537, 0x65f0, 0x65f4, + 0x65f3, 0x65f2, 0x65f5, 0x6745, 0x6747, + /* 0xcb */ + 0x6759, 0x6755, 0x674c, 0x6748, 0x675d, 0x674d, 0x675a, 0x674b, + 0x6bd0, 0x6c19, 0x6c1a, 0x6c78, 0x6c67, 0x6c6b, 0x6c84, 0x6c8b, + 0x6c8f, 0x6c71, 0x6c6f, 0x6c69, 0x6c9a, 0x6c6d, 0x6c87, 0x6c95, + 0x6c9c, 0x6c66, 0x6c73, 0x6c65, 0x6c7b, 0x6c8e, 0x7074, 0x707a, + 0x7263, 0x72bf, 0x72bd, 0x72c3, 0x72c6, 0x72c1, 0x72ba, 0x72c5, + 0x7395, 0x7397, 0x7393, 0x7394, 0x7392, 0x753a, 0x7539, 0x7594, + 0x7595, 0x7681, 0x793d, 0x8034, 0x8095, 0x8099, 0x8090, 0x8092, + 0x809c, 0x8290, 0x828f, 0x8285, 0x828e, 0x8291, 0x8293, 0x828a, + 0x8283, 0x8284, 0x8c78, 0x8fc9, 0x8fbf, 0x909f, 0x90a1, 0x90a5, + 0x909e, 0x90a7, 0x90a0, 0x9630, 0x9628, 0x962f, 0x962d, 0x4e33, + 0x4f98, 0x4f7c, 0x4f85, 0x4f7d, 0x4f80, 0x4f87, 0x4f76, 0x4f74, + 0x4f89, 0x4f84, 0x4f77, 0x4f4c, 0x4f97, 0x4f6a, 0x4f9a, 0x4f79, + 0x4f81, 0x4f78, 0x4f90, 0x4f9c, 0x4f94, 0x4f9e, 0x4f92, 0x4f82, + 0x4f95, 0x4f6b, 0x4f6e, 0x519e, 0x51bc, 0x51be, 0x5235, 0x5232, + 0x5233, 0x5246, 0x5231, 0x52bc, 0x530a, 0x530b, 0x533c, 0x5392, + 0x5394, 0x5487, 0x547f, 0x5481, 0x5491, 0x5482, 0x5488, 0x546b, + 0x547a, 0x547e, 0x5465, 0x546c, 0x5474, 0x5466, 0x548d, 0x546f, + 0x5461, 0x5460, 0x5498, 0x5463, 0x5467, 0x5464, 0x56f7, 0x56f9, + 0x576f, 0x5772, 0x576d, 0x576b, 0x5771, 0x5770, 0x5776, 0x5780, + 0x5775, 0x577b, 0x5773, 0x5774, 0x5762, + /* 0xcc */ + 0x5768, 0x577d, 0x590c, 0x5945, 0x59b5, 0x59ba, 0x59cf, 0x59ce, + 0x59b2, 0x59cc, 0x59c1, 0x59b6, 0x59bc, 0x59c3, 0x59d6, 0x59b1, + 0x59bd, 0x59c0, 0x59c8, 0x59b4, 0x59c7, 0x5b62, 0x5b65, 0x5b93, + 0x5b95, 0x5c44, 0x5c47, 0x5cae, 0x5ca4, 0x5ca0, 0x5cb5, 0x5caf, + 0x5ca8, 0x5cac, 0x5c9f, 0x5ca3, 0x5cad, 0x5ca2, 0x5caa, 0x5ca7, + 0x5c9d, 0x5ca5, 0x5cb6, 0x5cb0, 0x5ca6, 0x5e17, 0x5e14, 0x5e19, + 0x5f28, 0x5f22, 0x5f23, 0x5f24, 0x5f54, 0x5f82, 0x5f7e, 0x5f7d, + 0x5fde, 0x5fe5, 0x602d, 0x6026, 0x6019, 0x6032, 0x600b, 0x6034, + 0x600a, 0x6017, 0x6033, 0x601a, 0x601e, 0x602c, 0x6022, 0x600d, + 0x6010, 0x602e, 0x6013, 0x6011, 0x600c, 0x6009, 0x601c, 0x6214, + 0x623d, 0x62ad, 0x62b4, 0x62d1, 0x62be, 0x62aa, 0x62b6, 0x62ca, + 0x62ae, 0x62b3, 0x62af, 0x62bb, 0x62a9, 0x62b0, 0x62b8, 0x653d, + 0x65a8, 0x65bb, 0x6609, 0x65fc, 0x6604, 0x6612, 0x6608, 0x65fb, + 0x6603, 0x660b, 0x660d, 0x6605, 0x65fd, 0x6611, 0x6610, 0x66f6, + 0x670a, 0x6785, 0x676c, 0x678e, 0x6792, 0x6776, 0x677b, 0x6798, + 0x6786, 0x6784, 0x6774, 0x678d, 0x678c, 0x677a, 0x679f, 0x6791, + 0x6799, 0x6783, 0x677d, 0x6781, 0x6778, 0x6779, 0x6794, 0x6b25, + 0x6b80, 0x6b7e, 0x6bde, 0x6c1d, 0x6c93, 0x6cec, 0x6ceb, 0x6cee, + 0x6cd9, 0x6cb6, 0x6cd4, 0x6cad, 0x6ce7, 0x6cb7, 0x6cd0, 0x6cc2, + 0x6cba, 0x6cc3, 0x6cc6, 0x6ced, 0x6cf2, + /* 0xcd */ + 0x6cd2, 0x6cdd, 0x6cb4, 0x6c8a, 0x6c9d, 0x6c80, 0x6cde, 0x6cc0, + 0x6d30, 0x6ccd, 0x6cc7, 0x6cb0, 0x6cf9, 0x6ccf, 0x6ce9, 0x6cd1, + 0x7094, 0x7098, 0x7085, 0x7093, 0x7086, 0x7084, 0x7091, 0x7096, + 0x7082, 0x709a, 0x7083, 0x726a, 0x72d6, 0x72cb, 0x72d8, 0x72c9, + 0x72dc, 0x72d2, 0x72d4, 0x72da, 0x72cc, 0x72d1, 0x73a4, 0x73a1, + 0x73ad, 0x73a6, 0x73a2, 0x73a0, 0x73ac, 0x739d, 0x74dd, 0x74e8, + 0x753f, 0x7540, 0x753e, 0x758c, 0x7598, 0x76af, 0x76f3, 0x76f1, + 0x76f0, 0x76f5, 0x77f8, 0x77fc, 0x77f9, 0x77fb, 0x77fa, 0x77f7, + 0x7942, 0x793f, 0x79c5, 0x7a78, 0x7a7b, 0x7afb, 0x7c75, 0x7cfd, + 0x8035, 0x808f, 0x80ae, 0x80a3, 0x80b8, 0x80b5, 0x80ad, 0x8220, + 0x82a0, 0x82c0, 0x82ab, 0x829a, 0x8298, 0x829b, 0x82b5, 0x82a7, + 0x82ae, 0x82bc, 0x829e, 0x82ba, 0x82b4, 0x82a8, 0x82a1, 0x82a9, + 0x82c2, 0x82a4, 0x82c3, 0x82b6, 0x82a2, 0x8670, 0x866f, 0x866d, + 0x866e, 0x8c56, 0x8fd2, 0x8fcb, 0x8fd3, 0x8fcd, 0x8fd6, 0x8fd5, + 0x8fd7, 0x90b2, 0x90b4, 0x90af, 0x90b3, 0x90b0, 0x9639, 0x963d, + 0x963c, 0x963a, 0x9643, 0x4fcd, 0x4fc5, 0x4fd3, 0x4fb2, 0x4fc9, + 0x4fcb, 0x4fc1, 0x4fd4, 0x4fdc, 0x4fd9, 0x4fbb, 0x4fb3, 0x4fdb, + 0x4fc7, 0x4fd6, 0x4fba, 0x4fc0, 0x4fb9, 0x4fec, 0x5244, 0x5249, + 0x52c0, 0x52c2, 0x533d, 0x537c, 0x5397, 0x5396, 0x5399, 0x5398, + 0x54ba, 0x54a1, 0x54ad, 0x54a5, 0x54cf, + /* 0xce */ + 0x54c3, 0x830d, 0x54b7, 0x54ae, 0x54d6, 0x54b6, 0x54c5, 0x54c6, + 0x54a0, 0x5470, 0x54bc, 0x54a2, 0x54be, 0x5472, 0x54de, 0x54b0, + 0x57b5, 0x579e, 0x579f, 0x57a4, 0x578c, 0x5797, 0x579d, 0x579b, + 0x5794, 0x5798, 0x578f, 0x5799, 0x57a5, 0x579a, 0x5795, 0x58f4, + 0x590d, 0x5953, 0x59e1, 0x59de, 0x59ee, 0x5a00, 0x59f1, 0x59dd, + 0x59fa, 0x59fd, 0x59fc, 0x59f6, 0x59e4, 0x59f2, 0x59f7, 0x59db, + 0x59e9, 0x59f3, 0x59f5, 0x59e0, 0x59fe, 0x59f4, 0x59ed, 0x5ba8, + 0x5c4c, 0x5cd0, 0x5cd8, 0x5ccc, 0x5cd7, 0x5ccb, 0x5cdb, 0x5cde, + 0x5cda, 0x5cc9, 0x5cc7, 0x5cca, 0x5cd6, 0x5cd3, 0x5cd4, 0x5ccf, + 0x5cc8, 0x5cc6, 0x5cce, 0x5cdf, 0x5cf8, 0x5df9, 0x5e21, 0x5e22, + 0x5e23, 0x5e20, 0x5e24, 0x5eb0, 0x5ea4, 0x5ea2, 0x5e9b, 0x5ea3, + 0x5ea5, 0x5f07, 0x5f2e, 0x5f56, 0x5f86, 0x6037, 0x6039, 0x6054, + 0x6072, 0x605e, 0x6045, 0x6053, 0x6047, 0x6049, 0x605b, 0x604c, + 0x6040, 0x6042, 0x605f, 0x6024, 0x6044, 0x6058, 0x6066, 0x606e, + 0x6242, 0x6243, 0x62cf, 0x630d, 0x630b, 0x62f5, 0x630e, 0x6303, + 0x62eb, 0x62f9, 0x630f, 0x630c, 0x62f8, 0x62f6, 0x6300, 0x6313, + 0x6314, 0x62fa, 0x6315, 0x62fb, 0x62f0, 0x6541, 0x6543, 0x65aa, + 0x65bf, 0x6636, 0x6621, 0x6632, 0x6635, 0x661c, 0x6626, 0x6622, + 0x6633, 0x662b, 0x663a, 0x661d, 0x6634, 0x6639, 0x662e, 0x670f, + 0x6710, 0x67c1, 0x67f2, 0x67c8, 0x67ba, + /* 0xcf */ + 0x67dc, 0x67bb, 0x67f8, 0x67d8, 0x67c0, 0x67b7, 0x67c5, 0x67eb, + 0x67e4, 0x67df, 0x67b5, 0x67cd, 0x67b3, 0x67f7, 0x67f6, 0x67ee, + 0x67e3, 0x67c2, 0x67b9, 0x67ce, 0x67e7, 0x67f0, 0x67b2, 0x67fc, + 0x67c6, 0x67ed, 0x67cc, 0x67ae, 0x67e6, 0x67db, 0x67fa, 0x67c9, + 0x67ca, 0x67c3, 0x67ea, 0x67cb, 0x6b28, 0x6b82, 0x6b84, 0x6bb6, + 0x6bd6, 0x6bd8, 0x6be0, 0x6c20, 0x6c21, 0x6d28, 0x6d34, 0x6d2d, + 0x6d1f, 0x6d3c, 0x6d3f, 0x6d12, 0x6d0a, 0x6cda, 0x6d33, 0x6d04, + 0x6d19, 0x6d3a, 0x6d1a, 0x6d11, 0x6d00, 0x6d1d, 0x6d42, 0x6d01, + 0x6d18, 0x6d37, 0x6d03, 0x6d0f, 0x6d40, 0x6d07, 0x6d20, 0x6d2c, + 0x6d08, 0x6d22, 0x6d09, 0x6d10, 0x70b7, 0x709f, 0x70be, 0x70b1, + 0x70b0, 0x70a1, 0x70b4, 0x70b5, 0x70a9, 0x7241, 0x7249, 0x724a, + 0x726c, 0x7270, 0x7273, 0x726e, 0x72ca, 0x72e4, 0x72e8, 0x72eb, + 0x72df, 0x72ea, 0x72e6, 0x72e3, 0x7385, 0x73cc, 0x73c2, 0x73c8, + 0x73c5, 0x73b9, 0x73b6, 0x73b5, 0x73b4, 0x73eb, 0x73bf, 0x73c7, + 0x73be, 0x73c3, 0x73c6, 0x73b8, 0x73cb, 0x74ec, 0x74ee, 0x752e, + 0x7547, 0x7548, 0x75a7, 0x75aa, 0x7679, 0x76c4, 0x7708, 0x7703, + 0x7704, 0x7705, 0x770a, 0x76f7, 0x76fb, 0x76fa, 0x77e7, 0x77e8, + 0x7806, 0x7811, 0x7812, 0x7805, 0x7810, 0x780f, 0x780e, 0x7809, + 0x7803, 0x7813, 0x794a, 0x794c, 0x794b, 0x7945, 0x7944, 0x79d5, + 0x79cd, 0x79cf, 0x79d6, 0x79ce, 0x7a80, + /* 0xd0 */ + 0x7a7e, 0x7ad1, 0x7b00, 0x7b01, 0x7c7a, 0x7c78, 0x7c79, 0x7c7f, + 0x7c80, 0x7c81, 0x7d03, 0x7d08, 0x7d01, 0x7f58, 0x7f91, 0x7f8d, + 0x7fbe, 0x8007, 0x800e, 0x800f, 0x8014, 0x8037, 0x80d8, 0x80c7, + 0x80e0, 0x80d1, 0x80c8, 0x80c2, 0x80d0, 0x80c5, 0x80e3, 0x80d9, + 0x80dc, 0x80ca, 0x80d5, 0x80c9, 0x80cf, 0x80d7, 0x80e6, 0x80cd, + 0x81ff, 0x8221, 0x8294, 0x82d9, 0x82fe, 0x82f9, 0x8307, 0x82e8, + 0x8300, 0x82d5, 0x833a, 0x82eb, 0x82d6, 0x82f4, 0x82ec, 0x82e1, + 0x82f2, 0x82f5, 0x830c, 0x82fb, 0x82f6, 0x82f0, 0x82ea, 0x82e4, + 0x82e0, 0x82fa, 0x82f3, 0x82ed, 0x8677, 0x8674, 0x867c, 0x8673, + 0x8841, 0x884e, 0x8867, 0x886a, 0x8869, 0x89d3, 0x8a04, 0x8a07, + 0x8d72, 0x8fe3, 0x8fe1, 0x8fee, 0x8fe0, 0x90f1, 0x90bd, 0x90bf, + 0x90d5, 0x90c5, 0x90be, 0x90c7, 0x90cb, 0x90c8, 0x91d4, 0x91d3, + 0x9654, 0x964f, 0x9651, 0x9653, 0x964a, 0x964e, 0x501e, 0x5005, + 0x5007, 0x5013, 0x5022, 0x5030, 0x501b, 0x4ff5, 0x4ff4, 0x5033, + 0x5037, 0x502c, 0x4ff6, 0x4ff7, 0x5017, 0x501c, 0x5020, 0x5027, + 0x5035, 0x502f, 0x5031, 0x500e, 0x515a, 0x5194, 0x5193, 0x51ca, + 0x51c4, 0x51c5, 0x51c8, 0x51ce, 0x5261, 0x525a, 0x5252, 0x525e, + 0x525f, 0x5255, 0x5262, 0x52cd, 0x530e, 0x539e, 0x5526, 0x54e2, + 0x5517, 0x5512, 0x54e7, 0x54f3, 0x54e4, 0x551a, 0x54ff, 0x5504, + 0x5508, 0x54eb, 0x5511, 0x5505, 0x54f1, + /* 0xd1 */ + 0x550a, 0x54fb, 0x54f7, 0x54f8, 0x54e0, 0x550e, 0x5503, 0x550b, + 0x5701, 0x5702, 0x57cc, 0x5832, 0x57d5, 0x57d2, 0x57ba, 0x57c6, + 0x57bd, 0x57bc, 0x57b8, 0x57b6, 0x57bf, 0x57c7, 0x57d0, 0x57b9, + 0x57c1, 0x590e, 0x594a, 0x5a19, 0x5a16, 0x5a2d, 0x5a2e, 0x5a15, + 0x5a0f, 0x5a17, 0x5a0a, 0x5a1e, 0x5a33, 0x5b6c, 0x5ba7, 0x5bad, + 0x5bac, 0x5c03, 0x5c56, 0x5c54, 0x5cec, 0x5cff, 0x5cee, 0x5cf1, + 0x5cf7, 0x5d00, 0x5cf9, 0x5e29, 0x5e28, 0x5ea8, 0x5eae, 0x5eaa, + 0x5eac, 0x5f33, 0x5f30, 0x5f67, 0x605d, 0x605a, 0x6067, 0x6041, + 0x60a2, 0x6088, 0x6080, 0x6092, 0x6081, 0x609d, 0x6083, 0x6095, + 0x609b, 0x6097, 0x6087, 0x609c, 0x608e, 0x6219, 0x6246, 0x62f2, + 0x6310, 0x6356, 0x632c, 0x6344, 0x6345, 0x6336, 0x6343, 0x63e4, + 0x6339, 0x634b, 0x634a, 0x633c, 0x6329, 0x6341, 0x6334, 0x6358, + 0x6354, 0x6359, 0x632d, 0x6347, 0x6333, 0x635a, 0x6351, 0x6338, + 0x6357, 0x6340, 0x6348, 0x654a, 0x6546, 0x65c6, 0x65c3, 0x65c4, + 0x65c2, 0x664a, 0x665f, 0x6647, 0x6651, 0x6712, 0x6713, 0x681f, + 0x681a, 0x6849, 0x6832, 0x6833, 0x683b, 0x684b, 0x684f, 0x6816, + 0x6831, 0x681c, 0x6835, 0x682b, 0x682d, 0x682f, 0x684e, 0x6844, + 0x6834, 0x681d, 0x6812, 0x6814, 0x6826, 0x6828, 0x682e, 0x684d, + 0x683a, 0x6825, 0x6820, 0x6b2c, 0x6b2f, 0x6b2d, 0x6b31, 0x6b34, + 0x6b6d, 0x8082, 0x6b88, 0x6be6, 0x6be4, + /* 0xd2 */ + 0x6be8, 0x6be3, 0x6be2, 0x6be7, 0x6c25, 0x6d7a, 0x6d63, 0x6d64, + 0x6d76, 0x6d0d, 0x6d61, 0x6d92, 0x6d58, 0x6d62, 0x6d6d, 0x6d6f, + 0x6d91, 0x6d8d, 0x6def, 0x6d7f, 0x6d86, 0x6d5e, 0x6d67, 0x6d60, + 0x6d97, 0x6d70, 0x6d7c, 0x6d5f, 0x6d82, 0x6d98, 0x6d2f, 0x6d68, + 0x6d8b, 0x6d7e, 0x6d80, 0x6d84, 0x6d16, 0x6d83, 0x6d7b, 0x6d7d, + 0x6d75, 0x6d90, 0x70dc, 0x70d3, 0x70d1, 0x70dd, 0x70cb, 0x7f39, + 0x70e2, 0x70d7, 0x70d2, 0x70de, 0x70e0, 0x70d4, 0x70cd, 0x70c5, + 0x70c6, 0x70c7, 0x70da, 0x70ce, 0x70e1, 0x7242, 0x7278, 0x7277, + 0x7276, 0x7300, 0x72fa, 0x72f4, 0x72fe, 0x72f6, 0x72f3, 0x72fb, + 0x7301, 0x73d3, 0x73d9, 0x73e5, 0x73d6, 0x73bc, 0x73e7, 0x73e3, + 0x73e9, 0x73dc, 0x73d2, 0x73db, 0x73d4, 0x73dd, 0x73da, 0x73d7, + 0x73d8, 0x73e8, 0x74de, 0x74df, 0x74f4, 0x74f5, 0x7521, 0x755b, + 0x755f, 0x75b0, 0x75c1, 0x75bb, 0x75c4, 0x75c0, 0x75bf, 0x75b6, + 0x75ba, 0x768a, 0x76c9, 0x771d, 0x771b, 0x7710, 0x7713, 0x7712, + 0x7723, 0x7711, 0x7715, 0x7719, 0x771a, 0x7722, 0x7727, 0x7823, + 0x782c, 0x7822, 0x7835, 0x782f, 0x7828, 0x782e, 0x782b, 0x7821, + 0x7829, 0x7833, 0x782a, 0x7831, 0x7954, 0x795b, 0x794f, 0x795c, + 0x7953, 0x7952, 0x7951, 0x79eb, 0x79ec, 0x79e0, 0x79ee, 0x79ed, + 0x79ea, 0x79dc, 0x79de, 0x79dd, 0x7a86, 0x7a89, 0x7a85, 0x7a8b, + 0x7a8c, 0x7a8a, 0x7a87, 0x7ad8, 0x7b10, + /* 0xd3 */ + 0x7b04, 0x7b13, 0x7b05, 0x7b0f, 0x7b08, 0x7b0a, 0x7b0e, 0x7b09, + 0x7b12, 0x7c84, 0x7c91, 0x7c8a, 0x7c8c, 0x7c88, 0x7c8d, 0x7c85, + 0x7d1e, 0x7d1d, 0x7d11, 0x7d0e, 0x7d18, 0x7d16, 0x7d13, 0x7d1f, + 0x7d12, 0x7d0f, 0x7d0c, 0x7f5c, 0x7f61, 0x7f5e, 0x7f60, 0x7f5d, + 0x7f5b, 0x7f96, 0x7f92, 0x7fc3, 0x7fc2, 0x7fc0, 0x8016, 0x803e, + 0x8039, 0x80fa, 0x80f2, 0x80f9, 0x80f5, 0x8101, 0x80fb, 0x8100, + 0x8201, 0x822f, 0x8225, 0x8333, 0x832d, 0x8344, 0x8319, 0x8351, + 0x8325, 0x8356, 0x833f, 0x8341, 0x8326, 0x831c, 0x8322, 0x8342, + 0x834e, 0x831b, 0x832a, 0x8308, 0x833c, 0x834d, 0x8316, 0x8324, + 0x8320, 0x8337, 0x832f, 0x8329, 0x8347, 0x8345, 0x834c, 0x8353, + 0x831e, 0x832c, 0x834b, 0x8327, 0x8348, 0x8653, 0x8652, 0x86a2, + 0x86a8, 0x8696, 0x868d, 0x8691, 0x869e, 0x8687, 0x8697, 0x8686, + 0x868b, 0x869a, 0x8685, 0x86a5, 0x8699, 0x86a1, 0x86a7, 0x8695, + 0x8698, 0x868e, 0x869d, 0x8690, 0x8694, 0x8843, 0x8844, 0x886d, + 0x8875, 0x8876, 0x8872, 0x8880, 0x8871, 0x887f, 0x886f, 0x8883, + 0x887e, 0x8874, 0x887c, 0x8a12, 0x8c47, 0x8c57, 0x8c7b, 0x8ca4, + 0x8ca3, 0x8d76, 0x8d78, 0x8db5, 0x8db7, 0x8db6, 0x8ed1, 0x8ed3, + 0x8ffe, 0x8ff5, 0x9002, 0x8fff, 0x8ffb, 0x9004, 0x8ffc, 0x8ff6, + 0x90d6, 0x90e0, 0x90d9, 0x90da, 0x90e3, 0x90df, 0x90e5, 0x90d8, + 0x90db, 0x90d7, 0x90dc, 0x90e4, 0x9150, + /* 0xd4 */ + 0x914e, 0x914f, 0x91d5, 0x91e2, 0x91da, 0x965c, 0x965f, 0x96bc, + 0x98e3, 0x9adf, 0x9b2f, 0x4e7f, 0x5070, 0x506a, 0x5061, 0x505e, + 0x5060, 0x5053, 0x504b, 0x505d, 0x5072, 0x5048, 0x504d, 0x5041, + 0x505b, 0x504a, 0x5062, 0x5015, 0x5045, 0x505f, 0x5069, 0x506b, + 0x5063, 0x5064, 0x5046, 0x5040, 0x506e, 0x5073, 0x5057, 0x5051, + 0x51d0, 0x526b, 0x526d, 0x526c, 0x526e, 0x52d6, 0x52d3, 0x532d, + 0x539c, 0x5575, 0x5576, 0x553c, 0x554d, 0x5550, 0x5534, 0x552a, + 0x5551, 0x5562, 0x5536, 0x5535, 0x5530, 0x5552, 0x5545, 0x550c, + 0x5532, 0x5565, 0x554e, 0x5539, 0x5548, 0x552d, 0x553b, 0x5540, + 0x554b, 0x570a, 0x5707, 0x57fb, 0x5814, 0x57e2, 0x57f6, 0x57dc, + 0x57f4, 0x5800, 0x57ed, 0x57fd, 0x5808, 0x57f8, 0x580b, 0x57f3, + 0x57cf, 0x5807, 0x57ee, 0x57e3, 0x57f2, 0x57e5, 0x57ec, 0x57e1, + 0x580e, 0x57fc, 0x5810, 0x57e7, 0x5801, 0x580c, 0x57f1, 0x57e9, + 0x57f0, 0x580d, 0x5804, 0x595c, 0x5a60, 0x5a58, 0x5a55, 0x5a67, + 0x5a5e, 0x5a38, 0x5a35, 0x5a6d, 0x5a50, 0x5a5f, 0x5a65, 0x5a6c, + 0x5a53, 0x5a64, 0x5a57, 0x5a43, 0x5a5d, 0x5a52, 0x5a44, 0x5a5b, + 0x5a48, 0x5a8e, 0x5a3e, 0x5a4d, 0x5a39, 0x5a4c, 0x5a70, 0x5a69, + 0x5a47, 0x5a51, 0x5a56, 0x5a42, 0x5a5c, 0x5b72, 0x5b6e, 0x5bc1, + 0x5bc0, 0x5c59, 0x5d1e, 0x5d0b, 0x5d1d, 0x5d1a, 0x5d20, 0x5d0c, + 0x5d28, 0x5d0d, 0x5d26, 0x5d25, 0x5d0f, + /* 0xd5 */ + 0x5d30, 0x5d12, 0x5d23, 0x5d1f, 0x5d2e, 0x5e3e, 0x5e34, 0x5eb1, + 0x5eb4, 0x5eb9, 0x5eb2, 0x5eb3, 0x5f36, 0x5f38, 0x5f9b, 0x5f96, + 0x5f9f, 0x608a, 0x6090, 0x6086, 0x60be, 0x60b0, 0x60ba, 0x60d3, + 0x60d4, 0x60cf, 0x60e4, 0x60d9, 0x60dd, 0x60c8, 0x60b1, 0x60db, + 0x60b7, 0x60ca, 0x60bf, 0x60c3, 0x60cd, 0x60c0, 0x6332, 0x6365, + 0x638a, 0x6382, 0x637d, 0x63bd, 0x639e, 0x63ad, 0x639d, 0x6397, + 0x63ab, 0x638e, 0x636f, 0x6387, 0x6390, 0x636e, 0x63af, 0x6375, + 0x639c, 0x636d, 0x63ae, 0x637c, 0x63a4, 0x633b, 0x639f, 0x6378, + 0x6385, 0x6381, 0x6391, 0x638d, 0x6370, 0x6553, 0x65cd, 0x6665, + 0x6661, 0x665b, 0x6659, 0x665c, 0x6662, 0x6718, 0x6879, 0x6887, + 0x6890, 0x689c, 0x686d, 0x686e, 0x68ae, 0x68ab, 0x6956, 0x686f, + 0x68a3, 0x68ac, 0x68a9, 0x6875, 0x6874, 0x68b2, 0x688f, 0x6877, + 0x6892, 0x687c, 0x686b, 0x6872, 0x68aa, 0x6880, 0x6871, 0x687e, + 0x689b, 0x6896, 0x688b, 0x68a0, 0x6889, 0x68a4, 0x6878, 0x687b, + 0x6891, 0x688c, 0x688a, 0x687d, 0x6b36, 0x6b33, 0x6b37, 0x6b38, + 0x6b91, 0x6b8f, 0x6b8d, 0x6b8e, 0x6b8c, 0x6c2a, 0x6dc0, 0x6dab, + 0x6db4, 0x6db3, 0x6e74, 0x6dac, 0x6de9, 0x6de2, 0x6db7, 0x6df6, + 0x6dd4, 0x6e00, 0x6dc8, 0x6de0, 0x6ddf, 0x6dd6, 0x6dbe, 0x6de5, + 0x6ddc, 0x6ddd, 0x6ddb, 0x6df4, 0x6dca, 0x6dbd, 0x6ded, 0x6df0, + 0x6dba, 0x6dd5, 0x6dc2, 0x6dcf, 0x6dc9, + /* 0xd6 */ + 0x6dd0, 0x6df2, 0x6dd3, 0x6dfd, 0x6dd7, 0x6dcd, 0x6de3, 0x6dbb, + 0x70fa, 0x710d, 0x70f7, 0x7117, 0x70f4, 0x710c, 0x70f0, 0x7104, + 0x70f3, 0x7110, 0x70fc, 0x70ff, 0x7106, 0x7113, 0x7100, 0x70f8, + 0x70f6, 0x710b, 0x7102, 0x710e, 0x727e, 0x727b, 0x727c, 0x727f, + 0x731d, 0x7317, 0x7307, 0x7311, 0x7318, 0x730a, 0x7308, 0x72ff, + 0x730f, 0x731e, 0x7388, 0x73f6, 0x73f8, 0x73f5, 0x7404, 0x7401, + 0x73fd, 0x7407, 0x7400, 0x73fa, 0x73fc, 0x73ff, 0x740c, 0x740b, + 0x73f4, 0x7408, 0x7564, 0x7563, 0x75ce, 0x75d2, 0x75cf, 0x75cb, + 0x75cc, 0x75d1, 0x75d0, 0x768f, 0x7689, 0x76d3, 0x7739, 0x772f, + 0x772d, 0x7731, 0x7732, 0x7734, 0x7733, 0x773d, 0x7725, 0x773b, + 0x7735, 0x7848, 0x7852, 0x7849, 0x784d, 0x784a, 0x784c, 0x7826, + 0x7845, 0x7850, 0x7964, 0x7967, 0x7969, 0x796a, 0x7963, 0x796b, + 0x7961, 0x79bb, 0x79fa, 0x79f8, 0x79f6, 0x79f7, 0x7a8f, 0x7a94, + 0x7a90, 0x7b35, 0x7b47, 0x7b34, 0x7b25, 0x7b30, 0x7b22, 0x7b24, + 0x7b33, 0x7b18, 0x7b2a, 0x7b1d, 0x7b31, 0x7b2b, 0x7b2d, 0x7b2f, + 0x7b32, 0x7b38, 0x7b1a, 0x7b23, 0x7c94, 0x7c98, 0x7c96, 0x7ca3, + 0x7d35, 0x7d3d, 0x7d38, 0x7d36, 0x7d3a, 0x7d45, 0x7d2c, 0x7d29, + 0x7d41, 0x7d47, 0x7d3e, 0x7d3f, 0x7d4a, 0x7d3b, 0x7d28, 0x7f63, + 0x7f95, 0x7f9c, 0x7f9d, 0x7f9b, 0x7fca, 0x7fcb, 0x7fcd, 0x7fd0, + 0x7fd1, 0x7fc7, 0x7fcf, 0x7fc9, 0x801f, + /* 0xd7 */ + 0x801e, 0x801b, 0x8047, 0x8043, 0x8048, 0x8118, 0x8125, 0x8119, + 0x811b, 0x812d, 0x811f, 0x812c, 0x811e, 0x8121, 0x8115, 0x8127, + 0x811d, 0x8122, 0x8211, 0x8238, 0x8233, 0x823a, 0x8234, 0x8232, + 0x8274, 0x8390, 0x83a3, 0x83a8, 0x838d, 0x837a, 0x8373, 0x83a4, + 0x8374, 0x838f, 0x8381, 0x8395, 0x8399, 0x8375, 0x8394, 0x83a9, + 0x837d, 0x8383, 0x838c, 0x839d, 0x839b, 0x83aa, 0x838b, 0x837e, + 0x83a5, 0x83af, 0x8388, 0x8397, 0x83b0, 0x837f, 0x83a6, 0x8387, + 0x83ae, 0x8376, 0x839a, 0x8659, 0x8656, 0x86bf, 0x86b7, 0x86c2, + 0x86c1, 0x86c5, 0x86ba, 0x86b0, 0x86c8, 0x86b9, 0x86b3, 0x86b8, + 0x86cc, 0x86b4, 0x86bb, 0x86bc, 0x86c3, 0x86bd, 0x86be, 0x8852, + 0x8889, 0x8895, 0x88a8, 0x88a2, 0x88aa, 0x889a, 0x8891, 0x88a1, + 0x889f, 0x8898, 0x88a7, 0x8899, 0x889b, 0x8897, 0x88a4, 0x88ac, + 0x888c, 0x8893, 0x888e, 0x8982, 0x89d6, 0x89d9, 0x89d5, 0x8a30, + 0x8a27, 0x8a2c, 0x8a1e, 0x8c39, 0x8c3b, 0x8c5c, 0x8c5d, 0x8c7d, + 0x8ca5, 0x8d7d, 0x8d7b, 0x8d79, 0x8dbc, 0x8dc2, 0x8db9, 0x8dbf, + 0x8dc1, 0x8ed8, 0x8ede, 0x8edd, 0x8edc, 0x8ed7, 0x8ee0, 0x8ee1, + 0x9024, 0x900b, 0x9011, 0x901c, 0x900c, 0x9021, 0x90ef, 0x90ea, + 0x90f0, 0x90f4, 0x90f2, 0x90f3, 0x90d4, 0x90eb, 0x90ec, 0x90e9, + 0x9156, 0x9158, 0x915a, 0x9153, 0x9155, 0x91ec, 0x91f4, 0x91f1, + 0x91f3, 0x91f8, 0x91e4, 0x91f9, 0x91ea, + /* 0xd8 */ + 0x91eb, 0x91f7, 0x91e8, 0x91ee, 0x957a, 0x9586, 0x9588, 0x967c, + 0x966d, 0x966b, 0x9671, 0x966f, 0x96bf, 0x976a, 0x9804, 0x98e5, + 0x9997, 0x509b, 0x5095, 0x5094, 0x509e, 0x508b, 0x50a3, 0x5083, + 0x508c, 0x508e, 0x509d, 0x5068, 0x509c, 0x5092, 0x5082, 0x5087, + 0x515f, 0x51d4, 0x5312, 0x5311, 0x53a4, 0x53a7, 0x5591, 0x55a8, + 0x55a5, 0x55ad, 0x5577, 0x5645, 0x55a2, 0x5593, 0x5588, 0x558f, + 0x55b5, 0x5581, 0x55a3, 0x5592, 0x55a4, 0x557d, 0x558c, 0x55a6, + 0x557f, 0x5595, 0x55a1, 0x558e, 0x570c, 0x5829, 0x5837, 0x5819, + 0x581e, 0x5827, 0x5823, 0x5828, 0x57f5, 0x5848, 0x5825, 0x581c, + 0x581b, 0x5833, 0x583f, 0x5836, 0x582e, 0x5839, 0x5838, 0x582d, + 0x582c, 0x583b, 0x5961, 0x5aaf, 0x5a94, 0x5a9f, 0x5a7a, 0x5aa2, + 0x5a9e, 0x5a78, 0x5aa6, 0x5a7c, 0x5aa5, 0x5aac, 0x5a95, 0x5aae, + 0x5a37, 0x5a84, 0x5a8a, 0x5a97, 0x5a83, 0x5a8b, 0x5aa9, 0x5a7b, + 0x5a7d, 0x5a8c, 0x5a9c, 0x5a8f, 0x5a93, 0x5a9d, 0x5bea, 0x5bcd, + 0x5bcb, 0x5bd4, 0x5bd1, 0x5bca, 0x5bce, 0x5c0c, 0x5c30, 0x5d37, + 0x5d43, 0x5d6b, 0x5d41, 0x5d4b, 0x5d3f, 0x5d35, 0x5d51, 0x5d4e, + 0x5d55, 0x5d33, 0x5d3a, 0x5d52, 0x5d3d, 0x5d31, 0x5d59, 0x5d42, + 0x5d39, 0x5d49, 0x5d38, 0x5d3c, 0x5d32, 0x5d36, 0x5d40, 0x5d45, + 0x5e44, 0x5e41, 0x5f58, 0x5fa6, 0x5fa5, 0x5fab, 0x60c9, 0x60b9, + 0x60cc, 0x60e2, 0x60ce, 0x60c4, 0x6114, + /* 0xd9 */ + 0x60f2, 0x610a, 0x6116, 0x6105, 0x60f5, 0x6113, 0x60f8, 0x60fc, + 0x60fe, 0x60c1, 0x6103, 0x6118, 0x611d, 0x6110, 0x60ff, 0x6104, + 0x610b, 0x624a, 0x6394, 0x63b1, 0x63b0, 0x63ce, 0x63e5, 0x63e8, + 0x63ef, 0x63c3, 0x649d, 0x63f3, 0x63ca, 0x63e0, 0x63f6, 0x63d5, + 0x63f2, 0x63f5, 0x6461, 0x63df, 0x63be, 0x63dd, 0x63dc, 0x63c4, + 0x63d8, 0x63d3, 0x63c2, 0x63c7, 0x63cc, 0x63cb, 0x63c8, 0x63f0, + 0x63d7, 0x63d9, 0x6532, 0x6567, 0x656a, 0x6564, 0x655c, 0x6568, + 0x6565, 0x658c, 0x659d, 0x659e, 0x65ae, 0x65d0, 0x65d2, 0x667c, + 0x666c, 0x667b, 0x6680, 0x6671, 0x6679, 0x666a, 0x6672, 0x6701, + 0x690c, 0x68d3, 0x6904, 0x68dc, 0x692a, 0x68ec, 0x68ea, 0x68f1, + 0x690f, 0x68d6, 0x68f7, 0x68eb, 0x68e4, 0x68f6, 0x6913, 0x6910, + 0x68f3, 0x68e1, 0x6907, 0x68cc, 0x6908, 0x6970, 0x68b4, 0x6911, + 0x68ef, 0x68c6, 0x6914, 0x68f8, 0x68d0, 0x68fd, 0x68fc, 0x68e8, + 0x690b, 0x690a, 0x6917, 0x68ce, 0x68c8, 0x68dd, 0x68de, 0x68e6, + 0x68f4, 0x68d1, 0x6906, 0x68d4, 0x68e9, 0x6915, 0x6925, 0x68c7, + 0x6b39, 0x6b3b, 0x6b3f, 0x6b3c, 0x6b94, 0x6b97, 0x6b99, 0x6b95, + 0x6bbd, 0x6bf0, 0x6bf2, 0x6bf3, 0x6c30, 0x6dfc, 0x6e46, 0x6e47, + 0x6e1f, 0x6e49, 0x6e88, 0x6e3c, 0x6e3d, 0x6e45, 0x6e62, 0x6e2b, + 0x6e3f, 0x6e41, 0x6e5d, 0x6e73, 0x6e1c, 0x6e33, 0x6e4b, 0x6e40, + 0x6e51, 0x6e3b, 0x6e03, 0x6e2e, 0x6e5e, + /* 0xda */ + 0x6e68, 0x6e5c, 0x6e61, 0x6e31, 0x6e28, 0x6e60, 0x6e71, 0x6e6b, + 0x6e39, 0x6e22, 0x6e30, 0x6e53, 0x6e65, 0x6e27, 0x6e78, 0x6e64, + 0x6e77, 0x6e55, 0x6e79, 0x6e52, 0x6e66, 0x6e35, 0x6e36, 0x6e5a, + 0x7120, 0x711e, 0x712f, 0x70fb, 0x712e, 0x7131, 0x7123, 0x7125, + 0x7122, 0x7132, 0x711f, 0x7128, 0x713a, 0x711b, 0x724b, 0x725a, + 0x7288, 0x7289, 0x7286, 0x7285, 0x728b, 0x7312, 0x730b, 0x7330, + 0x7322, 0x7331, 0x7333, 0x7327, 0x7332, 0x732d, 0x7326, 0x7323, + 0x7335, 0x730c, 0x742e, 0x742c, 0x7430, 0x742b, 0x7416, 0x741a, + 0x7421, 0x742d, 0x7431, 0x7424, 0x7423, 0x741d, 0x7429, 0x7420, + 0x7432, 0x74fb, 0x752f, 0x756f, 0x756c, 0x75e7, 0x75da, 0x75e1, + 0x75e6, 0x75dd, 0x75df, 0x75e4, 0x75d7, 0x7695, 0x7692, 0x76da, + 0x7746, 0x7747, 0x7744, 0x774d, 0x7745, 0x774a, 0x774e, 0x774b, + 0x774c, 0x77de, 0x77ec, 0x7860, 0x7864, 0x7865, 0x785c, 0x786d, + 0x7871, 0x786a, 0x786e, 0x7870, 0x7869, 0x7868, 0x785e, 0x7862, + 0x7974, 0x7973, 0x7972, 0x7970, 0x7a02, 0x7a0a, 0x7a03, 0x7a0c, + 0x7a04, 0x7a99, 0x7ae6, 0x7ae4, 0x7b4a, 0x7b3b, 0x7b44, 0x7b48, + 0x7b4c, 0x7b4e, 0x7b40, 0x7b58, 0x7b45, 0x7ca2, 0x7c9e, 0x7ca8, + 0x7ca1, 0x7d58, 0x7d6f, 0x7d63, 0x7d53, 0x7d56, 0x7d67, 0x7d6a, + 0x7d4f, 0x7d6d, 0x7d5c, 0x7d6b, 0x7d52, 0x7d54, 0x7d69, 0x7d51, + 0x7d5f, 0x7d4e, 0x7f3e, 0x7f3f, 0x7f65, + /* 0xdb */ + 0x7f66, 0x7fa2, 0x7fa0, 0x7fa1, 0x7fd7, 0x8051, 0x804f, 0x8050, + 0x80fe, 0x80d4, 0x8143, 0x814a, 0x8152, 0x814f, 0x8147, 0x813d, + 0x814d, 0x813a, 0x81e6, 0x81ee, 0x81f7, 0x81f8, 0x81f9, 0x8204, + 0x823c, 0x823d, 0x823f, 0x8275, 0x833b, 0x83cf, 0x83f9, 0x8423, + 0x83c0, 0x83e8, 0x8412, 0x83e7, 0x83e4, 0x83fc, 0x83f6, 0x8410, + 0x83c6, 0x83c8, 0x83eb, 0x83e3, 0x83bf, 0x8401, 0x83dd, 0x83e5, + 0x83d8, 0x83ff, 0x83e1, 0x83cb, 0x83ce, 0x83d6, 0x83f5, 0x83c9, + 0x8409, 0x840f, 0x83de, 0x8411, 0x8406, 0x83c2, 0x83f3, 0x83d5, + 0x83fa, 0x83c7, 0x83d1, 0x83ea, 0x8413, 0x83c3, 0x83ec, 0x83ee, + 0x83c4, 0x83fb, 0x83d7, 0x83e2, 0x841b, 0x83db, 0x83fe, 0x86d8, + 0x86e2, 0x86e6, 0x86d3, 0x86e3, 0x86da, 0x86ea, 0x86dd, 0x86eb, + 0x86dc, 0x86ec, 0x86e9, 0x86d7, 0x86e8, 0x86d1, 0x8848, 0x8856, + 0x8855, 0x88ba, 0x88d7, 0x88b9, 0x88b8, 0x88c0, 0x88be, 0x88b6, + 0x88bc, 0x88b7, 0x88bd, 0x88b2, 0x8901, 0x88c9, 0x8995, 0x8998, + 0x8997, 0x89dd, 0x89da, 0x89db, 0x8a4e, 0x8a4d, 0x8a39, 0x8a59, + 0x8a40, 0x8a57, 0x8a58, 0x8a44, 0x8a45, 0x8a52, 0x8a48, 0x8a51, + 0x8a4a, 0x8a4c, 0x8a4f, 0x8c5f, 0x8c81, 0x8c80, 0x8cba, 0x8cbe, + 0x8cb0, 0x8cb9, 0x8cb5, 0x8d84, 0x8d80, 0x8d89, 0x8dd8, 0x8dd3, + 0x8dcd, 0x8dc7, 0x8dd6, 0x8ddc, 0x8dcf, 0x8dd5, 0x8dd9, 0x8dc8, + 0x8dd7, 0x8dc5, 0x8eef, 0x8ef7, 0x8efa, + /* 0xdc */ + 0x8ef9, 0x8ee6, 0x8eee, 0x8ee5, 0x8ef5, 0x8ee7, 0x8ee8, 0x8ef6, + 0x8eeb, 0x8ef1, 0x8eec, 0x8ef4, 0x8ee9, 0x902d, 0x9034, 0x902f, + 0x9106, 0x912c, 0x9104, 0x90ff, 0x90fc, 0x9108, 0x90f9, 0x90fb, + 0x9101, 0x9100, 0x9107, 0x9105, 0x9103, 0x9161, 0x9164, 0x915f, + 0x9162, 0x9160, 0x9201, 0x920a, 0x9225, 0x9203, 0x921a, 0x9226, + 0x920f, 0x920c, 0x9200, 0x9212, 0x91ff, 0x91fd, 0x9206, 0x9204, + 0x9227, 0x9202, 0x921c, 0x9224, 0x9219, 0x9217, 0x9205, 0x9216, + 0x957b, 0x958d, 0x958c, 0x9590, 0x9687, 0x967e, 0x9688, 0x9689, + 0x9683, 0x9680, 0x96c2, 0x96c8, 0x96c3, 0x96f1, 0x96f0, 0x976c, + 0x9770, 0x976e, 0x9807, 0x98a9, 0x98eb, 0x9ce6, 0x9ef9, 0x4e83, + 0x4e84, 0x4eb6, 0x50bd, 0x50bf, 0x50c6, 0x50ae, 0x50c4, 0x50ca, + 0x50b4, 0x50c8, 0x50c2, 0x50b0, 0x50c1, 0x50ba, 0x50b1, 0x50cb, + 0x50c9, 0x50b6, 0x50b8, 0x51d7, 0x527a, 0x5278, 0x527b, 0x527c, + 0x55c3, 0x55db, 0x55cc, 0x55d0, 0x55cb, 0x55ca, 0x55dd, 0x55c0, + 0x55d4, 0x55c4, 0x55e9, 0x55bf, 0x55d2, 0x558d, 0x55cf, 0x55d5, + 0x55e2, 0x55d6, 0x55c8, 0x55f2, 0x55cd, 0x55d9, 0x55c2, 0x5714, + 0x5853, 0x5868, 0x5864, 0x584f, 0x584d, 0x5849, 0x586f, 0x5855, + 0x584e, 0x585d, 0x5859, 0x5865, 0x585b, 0x583d, 0x5863, 0x5871, + 0x58fc, 0x5ac7, 0x5ac4, 0x5acb, 0x5aba, 0x5ab8, 0x5ab1, 0x5ab5, + 0x5ab0, 0x5abf, 0x5ac8, 0x5abb, 0x5ac6, + /* 0xdd */ + 0x5ab7, 0x5ac0, 0x5aca, 0x5ab4, 0x5ab6, 0x5acd, 0x5ab9, 0x5a90, + 0x5bd6, 0x5bd8, 0x5bd9, 0x5c1f, 0x5c33, 0x5d71, 0x5d63, 0x5d4a, + 0x5d65, 0x5d72, 0x5d6c, 0x5d5e, 0x5d68, 0x5d67, 0x5d62, 0x5df0, + 0x5e4f, 0x5e4e, 0x5e4a, 0x5e4d, 0x5e4b, 0x5ec5, 0x5ecc, 0x5ec6, + 0x5ecb, 0x5ec7, 0x5f40, 0x5faf, 0x5fad, 0x60f7, 0x6149, 0x614a, + 0x612b, 0x6145, 0x6136, 0x6132, 0x612e, 0x6146, 0x612f, 0x614f, + 0x6129, 0x6140, 0x6220, 0x9168, 0x6223, 0x6225, 0x6224, 0x63c5, + 0x63f1, 0x63eb, 0x6410, 0x6412, 0x6409, 0x6420, 0x6424, 0x6433, + 0x6443, 0x641f, 0x6415, 0x6418, 0x6439, 0x6437, 0x6422, 0x6423, + 0x640c, 0x6426, 0x6430, 0x6428, 0x6441, 0x6435, 0x642f, 0x640a, + 0x641a, 0x6440, 0x6425, 0x6427, 0x640b, 0x63e7, 0x641b, 0x642e, + 0x6421, 0x640e, 0x656f, 0x6592, 0x65d3, 0x6686, 0x668c, 0x6695, + 0x6690, 0x668b, 0x668a, 0x6699, 0x6694, 0x6678, 0x6720, 0x6966, + 0x695f, 0x6938, 0x694e, 0x6962, 0x6971, 0x693f, 0x6945, 0x696a, + 0x6939, 0x6942, 0x6957, 0x6959, 0x697a, 0x6948, 0x6949, 0x6935, + 0x696c, 0x6933, 0x693d, 0x6965, 0x68f0, 0x6978, 0x6934, 0x6969, + 0x6940, 0x696f, 0x6944, 0x6976, 0x6958, 0x6941, 0x6974, 0x694c, + 0x693b, 0x694b, 0x6937, 0x695c, 0x694f, 0x6951, 0x6932, 0x6952, + 0x692f, 0x697b, 0x693c, 0x6b46, 0x6b45, 0x6b43, 0x6b42, 0x6b48, + 0x6b41, 0x6b9b, 0xfa0d, 0x6bfb, 0x6bfc, + /* 0xde */ + 0x6bf9, 0x6bf7, 0x6bf8, 0x6e9b, 0x6ed6, 0x6ec8, 0x6e8f, 0x6ec0, + 0x6e9f, 0x6e93, 0x6e94, 0x6ea0, 0x6eb1, 0x6eb9, 0x6ec6, 0x6ed2, + 0x6ebd, 0x6ec1, 0x6e9e, 0x6ec9, 0x6eb7, 0x6eb0, 0x6ecd, 0x6ea6, + 0x6ecf, 0x6eb2, 0x6ebe, 0x6ec3, 0x6edc, 0x6ed8, 0x6e99, 0x6e92, + 0x6e8e, 0x6e8d, 0x6ea4, 0x6ea1, 0x6ebf, 0x6eb3, 0x6ed0, 0x6eca, + 0x6e97, 0x6eae, 0x6ea3, 0x7147, 0x7154, 0x7152, 0x7163, 0x7160, + 0x7141, 0x715d, 0x7162, 0x7172, 0x7178, 0x716a, 0x7161, 0x7142, + 0x7158, 0x7143, 0x714b, 0x7170, 0x715f, 0x7150, 0x7153, 0x7144, + 0x714d, 0x715a, 0x724f, 0x728d, 0x728c, 0x7291, 0x7290, 0x728e, + 0x733c, 0x7342, 0x733b, 0x733a, 0x7340, 0x734a, 0x7349, 0x7444, + 0x744a, 0x744b, 0x7452, 0x7451, 0x7457, 0x7440, 0x744f, 0x7450, + 0x744e, 0x7442, 0x7446, 0x744d, 0x7454, 0x74e1, 0x74ff, 0x74fe, + 0x74fd, 0x751d, 0x7579, 0x7577, 0x6983, 0x75ef, 0x760f, 0x7603, + 0x75f7, 0x75fe, 0x75fc, 0x75f9, 0x75f8, 0x7610, 0x75fb, 0x75f6, + 0x75ed, 0x75f5, 0x75fd, 0x7699, 0x76b5, 0x76dd, 0x7755, 0x775f, + 0x7760, 0x7752, 0x7756, 0x775a, 0x7769, 0x7767, 0x7754, 0x7759, + 0x776d, 0x77e0, 0x7887, 0x789a, 0x7894, 0x788f, 0x7884, 0x7895, + 0x7885, 0x7886, 0x78a1, 0x7883, 0x7879, 0x7899, 0x7880, 0x7896, + 0x787b, 0x797c, 0x7982, 0x797d, 0x7979, 0x7a11, 0x7a18, 0x7a19, + 0x7a12, 0x7a17, 0x7a15, 0x7a22, 0x7a13, + /* 0xdf */ + 0x7a1b, 0x7a10, 0x7aa3, 0x7aa2, 0x7a9e, 0x7aeb, 0x7b66, 0x7b64, + 0x7b6d, 0x7b74, 0x7b69, 0x7b72, 0x7b65, 0x7b73, 0x7b71, 0x7b70, + 0x7b61, 0x7b78, 0x7b76, 0x7b63, 0x7cb2, 0x7cb4, 0x7caf, 0x7d88, + 0x7d86, 0x7d80, 0x7d8d, 0x7d7f, 0x7d85, 0x7d7a, 0x7d8e, 0x7d7b, + 0x7d83, 0x7d7c, 0x7d8c, 0x7d94, 0x7d84, 0x7d7d, 0x7d92, 0x7f6d, + 0x7f6b, 0x7f67, 0x7f68, 0x7f6c, 0x7fa6, 0x7fa5, 0x7fa7, 0x7fdb, + 0x7fdc, 0x8021, 0x8164, 0x8160, 0x8177, 0x815c, 0x8169, 0x815b, + 0x8162, 0x8172, 0x6721, 0x815e, 0x8176, 0x8167, 0x816f, 0x8144, + 0x8161, 0x821d, 0x8249, 0x8244, 0x8240, 0x8242, 0x8245, 0x84f1, + 0x843f, 0x8456, 0x8476, 0x8479, 0x848f, 0x848d, 0x8465, 0x8451, + 0x8440, 0x8486, 0x8467, 0x8430, 0x844d, 0x847d, 0x845a, 0x8459, + 0x8474, 0x8473, 0x845d, 0x8507, 0x845e, 0x8437, 0x843a, 0x8434, + 0x847a, 0x8443, 0x8478, 0x8432, 0x8445, 0x8429, 0x83d9, 0x844b, + 0x842f, 0x8442, 0x842d, 0x845f, 0x8470, 0x8439, 0x844e, 0x844c, + 0x8452, 0x846f, 0x84c5, 0x848e, 0x843b, 0x8447, 0x8436, 0x8433, + 0x8468, 0x847e, 0x8444, 0x842b, 0x8460, 0x8454, 0x846e, 0x8450, + 0x870b, 0x8704, 0x86f7, 0x870c, 0x86fa, 0x86d6, 0x86f5, 0x874d, + 0x86f8, 0x870e, 0x8709, 0x8701, 0x86f6, 0x870d, 0x8705, 0x88d6, + 0x88cb, 0x88cd, 0x88ce, 0x88de, 0x88db, 0x88da, 0x88cc, 0x88d0, + 0x8985, 0x899b, 0x89df, 0x89e5, 0x89e4, + /* 0xe0 */ + 0x89e1, 0x89e0, 0x89e2, 0x89dc, 0x89e6, 0x8a76, 0x8a86, 0x8a7f, + 0x8a61, 0x8a3f, 0x8a77, 0x8a82, 0x8a84, 0x8a75, 0x8a83, 0x8a81, + 0x8a74, 0x8a7a, 0x8c3c, 0x8c4b, 0x8c4a, 0x8c65, 0x8c64, 0x8c66, + 0x8c86, 0x8c84, 0x8c85, 0x8ccc, 0x8d68, 0x8d69, 0x8d91, 0x8d8c, + 0x8d8e, 0x8d8f, 0x8d8d, 0x8d93, 0x8d94, 0x8d90, 0x8d92, 0x8df0, + 0x8de0, 0x8dec, 0x8df1, 0x8dee, 0x8dd0, 0x8de9, 0x8de3, 0x8de2, + 0x8de7, 0x8df2, 0x8deb, 0x8df4, 0x8f06, 0x8eff, 0x8f01, 0x8f00, + 0x8f05, 0x8f07, 0x8f08, 0x8f02, 0x8f0b, 0x9052, 0x903f, 0x9044, + 0x9049, 0x903d, 0x9110, 0x910d, 0x910f, 0x9111, 0x9116, 0x9114, + 0x910b, 0x910e, 0x916e, 0x916f, 0x9248, 0x9252, 0x9230, 0x923a, + 0x9266, 0x9233, 0x9265, 0x925e, 0x9283, 0x922e, 0x924a, 0x9246, + 0x926d, 0x926c, 0x924f, 0x9260, 0x9267, 0x926f, 0x9236, 0x9261, + 0x9270, 0x9231, 0x9254, 0x9263, 0x9250, 0x9272, 0x924e, 0x9253, + 0x924c, 0x9256, 0x9232, 0x959f, 0x959c, 0x959e, 0x959b, 0x9692, + 0x9693, 0x9691, 0x9697, 0x96ce, 0x96fa, 0x96fd, 0x96f8, 0x96f5, + 0x9773, 0x9777, 0x9778, 0x9772, 0x980f, 0x980d, 0x980e, 0x98ac, + 0x98f6, 0x98f9, 0x99af, 0x99b2, 0x99b0, 0x99b5, 0x9aad, 0x9aab, + 0x9b5b, 0x9cea, 0x9ced, 0x9ce7, 0x9e80, 0x9efd, 0x50e6, 0x50d4, + 0x50d7, 0x50e8, 0x50f3, 0x50db, 0x50ea, 0x50dd, 0x50e4, 0x50d3, + 0x50ec, 0x50f0, 0x50ef, 0x50e3, 0x50e0, + /* 0xe1 */ + 0x51d8, 0x5280, 0x5281, 0x52e9, 0x52eb, 0x5330, 0x53ac, 0x5627, + 0x5615, 0x560c, 0x5612, 0x55fc, 0x560f, 0x561c, 0x5601, 0x5613, + 0x5602, 0x55fa, 0x561d, 0x5604, 0x55ff, 0x55f9, 0x5889, 0x587c, + 0x5890, 0x5898, 0x5886, 0x5881, 0x587f, 0x5874, 0x588b, 0x587a, + 0x5887, 0x5891, 0x588e, 0x5876, 0x5882, 0x5888, 0x587b, 0x5894, + 0x588f, 0x58fe, 0x596b, 0x5adc, 0x5aee, 0x5ae5, 0x5ad5, 0x5aea, + 0x5ada, 0x5aed, 0x5aeb, 0x5af3, 0x5ae2, 0x5ae0, 0x5adb, 0x5aec, + 0x5ade, 0x5add, 0x5ad9, 0x5ae8, 0x5adf, 0x5b77, 0x5be0, 0x5be3, + 0x5c63, 0x5d82, 0x5d80, 0x5d7d, 0x5d86, 0x5d7a, 0x5d81, 0x5d77, + 0x5d8a, 0x5d89, 0x5d88, 0x5d7e, 0x5d7c, 0x5d8d, 0x5d79, 0x5d7f, + 0x5e58, 0x5e59, 0x5e53, 0x5ed8, 0x5ed1, 0x5ed7, 0x5ece, 0x5edc, + 0x5ed5, 0x5ed9, 0x5ed2, 0x5ed4, 0x5f44, 0x5f43, 0x5f6f, 0x5fb6, + 0x612c, 0x6128, 0x6141, 0x615e, 0x6171, 0x6173, 0x6152, 0x6153, + 0x6172, 0x616c, 0x6180, 0x6174, 0x6154, 0x617a, 0x615b, 0x6165, + 0x613b, 0x616a, 0x6161, 0x6156, 0x6229, 0x6227, 0x622b, 0x642b, + 0x644d, 0x645b, 0x645d, 0x6474, 0x6476, 0x6472, 0x6473, 0x647d, + 0x6475, 0x6466, 0x64a6, 0x644e, 0x6482, 0x645e, 0x645c, 0x644b, + 0x6453, 0x6460, 0x6450, 0x647f, 0x643f, 0x646c, 0x646b, 0x6459, + 0x6465, 0x6477, 0x6573, 0x65a0, 0x66a1, 0x66a0, 0x669f, 0x6705, + 0x6704, 0x6722, 0x69b1, 0x69b6, 0x69c9, + /* 0xe2 */ + 0x69a0, 0x69ce, 0x6996, 0x69b0, 0x69ac, 0x69bc, 0x6991, 0x6999, + 0x698e, 0x69a7, 0x698d, 0x69a9, 0x69be, 0x69af, 0x69bf, 0x69c4, + 0x69bd, 0x69a4, 0x69d4, 0x69b9, 0x69ca, 0x699a, 0x69cf, 0x69b3, + 0x6993, 0x69aa, 0x69a1, 0x699e, 0x69d9, 0x6997, 0x6990, 0x69c2, + 0x69b5, 0x69a5, 0x69c6, 0x6b4a, 0x6b4d, 0x6b4b, 0x6b9e, 0x6b9f, + 0x6ba0, 0x6bc3, 0x6bc4, 0x6bfe, 0x6ece, 0x6ef5, 0x6ef1, 0x6f03, + 0x6f25, 0x6ef8, 0x6f37, 0x6efb, 0x6f2e, 0x6f09, 0x6f4e, 0x6f19, + 0x6f1a, 0x6f27, 0x6f18, 0x6f3b, 0x6f12, 0x6eed, 0x6f0a, 0x6f36, + 0x6f73, 0x6ef9, 0x6eee, 0x6f2d, 0x6f40, 0x6f30, 0x6f3c, 0x6f35, + 0x6eeb, 0x6f07, 0x6f0e, 0x6f43, 0x6f05, 0x6efd, 0x6ef6, 0x6f39, + 0x6f1c, 0x6efc, 0x6f3a, 0x6f1f, 0x6f0d, 0x6f1e, 0x6f08, 0x6f21, + 0x7187, 0x7190, 0x7189, 0x7180, 0x7185, 0x7182, 0x718f, 0x717b, + 0x7186, 0x7181, 0x7197, 0x7244, 0x7253, 0x7297, 0x7295, 0x7293, + 0x7343, 0x734d, 0x7351, 0x734c, 0x7462, 0x7473, 0x7471, 0x7475, + 0x7472, 0x7467, 0x746e, 0x7500, 0x7502, 0x7503, 0x757d, 0x7590, + 0x7616, 0x7608, 0x760c, 0x7615, 0x7611, 0x760a, 0x7614, 0x76b8, + 0x7781, 0x777c, 0x7785, 0x7782, 0x776e, 0x7780, 0x776f, 0x777e, + 0x7783, 0x78b2, 0x78aa, 0x78b4, 0x78ad, 0x78a8, 0x787e, 0x78ab, + 0x789e, 0x78a5, 0x78a0, 0x78ac, 0x78a2, 0x78a4, 0x7998, 0x798a, + 0x798b, 0x7996, 0x7995, 0x7994, 0x7993, + /* 0xe3 */ + 0x7997, 0x7988, 0x7992, 0x7990, 0x7a2b, 0x7a4a, 0x7a30, 0x7a2f, + 0x7a28, 0x7a26, 0x7aa8, 0x7aab, 0x7aac, 0x7aee, 0x7b88, 0x7b9c, + 0x7b8a, 0x7b91, 0x7b90, 0x7b96, 0x7b8d, 0x7b8c, 0x7b9b, 0x7b8e, + 0x7b85, 0x7b98, 0x5284, 0x7b99, 0x7ba4, 0x7b82, 0x7cbb, 0x7cbf, + 0x7cbc, 0x7cba, 0x7da7, 0x7db7, 0x7dc2, 0x7da3, 0x7daa, 0x7dc1, + 0x7dc0, 0x7dc5, 0x7d9d, 0x7dce, 0x7dc4, 0x7dc6, 0x7dcb, 0x7dcc, + 0x7daf, 0x7db9, 0x7d96, 0x7dbc, 0x7d9f, 0x7da6, 0x7dae, 0x7da9, + 0x7da1, 0x7dc9, 0x7f73, 0x7fe2, 0x7fe3, 0x7fe5, 0x7fde, 0x8024, + 0x805d, 0x805c, 0x8189, 0x8186, 0x8183, 0x8187, 0x818d, 0x818c, + 0x818b, 0x8215, 0x8497, 0x84a4, 0x84a1, 0x849f, 0x84ba, 0x84ce, + 0x84c2, 0x84ac, 0x84ae, 0x84ab, 0x84b9, 0x84b4, 0x84c1, 0x84cd, + 0x84aa, 0x849a, 0x84b1, 0x84d0, 0x849d, 0x84a7, 0x84bb, 0x84a2, + 0x8494, 0x84c7, 0x84cc, 0x849b, 0x84a9, 0x84af, 0x84a8, 0x84d6, + 0x8498, 0x84b6, 0x84cf, 0x84a0, 0x84d7, 0x84d4, 0x84d2, 0x84db, + 0x84b0, 0x8491, 0x8661, 0x8733, 0x8723, 0x8728, 0x876b, 0x8740, + 0x872e, 0x871e, 0x8721, 0x8719, 0x871b, 0x8743, 0x872c, 0x8741, + 0x873e, 0x8746, 0x8720, 0x8732, 0x872a, 0x872d, 0x873c, 0x8712, + 0x873a, 0x8731, 0x8735, 0x8742, 0x8726, 0x8727, 0x8738, 0x8724, + 0x871a, 0x8730, 0x8711, 0x88f7, 0x88e7, 0x88f1, 0x88f2, 0x88fa, + 0x88fe, 0x88ee, 0x88fc, 0x88f6, 0x88fb, + /* 0xe4 */ + 0x88f0, 0x88ec, 0x88eb, 0x899d, 0x89a1, 0x899f, 0x899e, 0x89e9, + 0x89eb, 0x89e8, 0x8aab, 0x8a99, 0x8a8b, 0x8a92, 0x8a8f, 0x8a96, + 0x8c3d, 0x8c68, 0x8c69, 0x8cd5, 0x8ccf, 0x8cd7, 0x8d96, 0x8e09, + 0x8e02, 0x8dff, 0x8e0d, 0x8dfd, 0x8e0a, 0x8e03, 0x8e07, 0x8e06, + 0x8e05, 0x8dfe, 0x8e00, 0x8e04, 0x8f10, 0x8f11, 0x8f0e, 0x8f0d, + 0x9123, 0x911c, 0x9120, 0x9122, 0x911f, 0x911d, 0x911a, 0x9124, + 0x9121, 0x911b, 0x917a, 0x9172, 0x9179, 0x9173, 0x92a5, 0x92a4, + 0x9276, 0x929b, 0x927a, 0x92a0, 0x9294, 0x92aa, 0x928d, 0x92a6, + 0x929a, 0x92ab, 0x9279, 0x9297, 0x927f, 0x92a3, 0x92ee, 0x928e, + 0x9282, 0x9295, 0x92a2, 0x927d, 0x9288, 0x92a1, 0x928a, 0x9286, + 0x928c, 0x9299, 0x92a7, 0x927e, 0x9287, 0x92a9, 0x929d, 0x928b, + 0x922d, 0x969e, 0x96a1, 0x96ff, 0x9758, 0x977d, 0x977a, 0x977e, + 0x9783, 0x9780, 0x9782, 0x977b, 0x9784, 0x9781, 0x977f, 0x97ce, + 0x97cd, 0x9816, 0x98ad, 0x98ae, 0x9902, 0x9900, 0x9907, 0x999d, + 0x999c, 0x99c3, 0x99b9, 0x99bb, 0x99ba, 0x99c2, 0x99bd, 0x99c7, + 0x9ab1, 0x9ae3, 0x9ae7, 0x9b3e, 0x9b3f, 0x9b60, 0x9b61, 0x9b5f, + 0x9cf1, 0x9cf2, 0x9cf5, 0x9ea7, 0x50ff, 0x5103, 0x5130, 0x50f8, + 0x5106, 0x5107, 0x50f6, 0x50fe, 0x510b, 0x510c, 0x50fd, 0x510a, + 0x528b, 0x528c, 0x52f1, 0x52ef, 0x5648, 0x5642, 0x564c, 0x5635, + 0x5641, 0x564a, 0x5649, 0x5646, 0x5658, + /* 0xe5 */ + 0x565a, 0x5640, 0x5633, 0x563d, 0x562c, 0x563e, 0x5638, 0x562a, + 0x563a, 0x571a, 0x58ab, 0x589d, 0x58b1, 0x58a0, 0x58a3, 0x58af, + 0x58ac, 0x58a5, 0x58a1, 0x58ff, 0x5aff, 0x5af4, 0x5afd, 0x5af7, + 0x5af6, 0x5b03, 0x5af8, 0x5b02, 0x5af9, 0x5b01, 0x5b07, 0x5b05, + 0x5b0f, 0x5c67, 0x5d99, 0x5d97, 0x5d9f, 0x5d92, 0x5da2, 0x5d93, + 0x5d95, 0x5da0, 0x5d9c, 0x5da1, 0x5d9a, 0x5d9e, 0x5e69, 0x5e5d, + 0x5e60, 0x5e5c, 0x7df3, 0x5edb, 0x5ede, 0x5ee1, 0x5f49, 0x5fb2, + 0x618b, 0x6183, 0x6179, 0x61b1, 0x61b0, 0x61a2, 0x6189, 0x619b, + 0x6193, 0x61af, 0x61ad, 0x619f, 0x6192, 0x61aa, 0x61a1, 0x618d, + 0x6166, 0x61b3, 0x622d, 0x646e, 0x6470, 0x6496, 0x64a0, 0x6485, + 0x6497, 0x649c, 0x648f, 0x648b, 0x648a, 0x648c, 0x64a3, 0x649f, + 0x6468, 0x64b1, 0x6498, 0x6576, 0x657a, 0x6579, 0x657b, 0x65b2, + 0x65b3, 0x66b5, 0x66b0, 0x66a9, 0x66b2, 0x66b7, 0x66aa, 0x66af, + 0x6a00, 0x6a06, 0x6a17, 0x69e5, 0x69f8, 0x6a15, 0x69f1, 0x69e4, + 0x6a20, 0x69ff, 0x69ec, 0x69e2, 0x6a1b, 0x6a1d, 0x69fe, 0x6a27, + 0x69f2, 0x69ee, 0x6a14, 0x69f7, 0x69e7, 0x6a40, 0x6a08, 0x69e6, + 0x69fb, 0x6a0d, 0x69fc, 0x69eb, 0x6a09, 0x6a04, 0x6a18, 0x6a25, + 0x6a0f, 0x69f6, 0x6a26, 0x6a07, 0x69f4, 0x6a16, 0x6b51, 0x6ba5, + 0x6ba3, 0x6ba2, 0x6ba6, 0x6c01, 0x6c00, 0x6bff, 0x6c02, 0x6f41, + 0x6f26, 0x6f7e, 0x6f87, 0x6fc6, 0x6f92, + /* 0xe6 */ + 0x6f8d, 0x6f89, 0x6f8c, 0x6f62, 0x6f4f, 0x6f85, 0x6f5a, 0x6f96, + 0x6f76, 0x6f6c, 0x6f82, 0x6f55, 0x6f72, 0x6f52, 0x6f50, 0x6f57, + 0x6f94, 0x6f93, 0x6f5d, 0x6f00, 0x6f61, 0x6f6b, 0x6f7d, 0x6f67, + 0x6f90, 0x6f53, 0x6f8b, 0x6f69, 0x6f7f, 0x6f95, 0x6f63, 0x6f77, + 0x6f6a, 0x6f7b, 0x71b2, 0x71af, 0x719b, 0x71b0, 0x71a0, 0x719a, + 0x71a9, 0x71b5, 0x719d, 0x71a5, 0x719e, 0x71a4, 0x71a1, 0x71aa, + 0x719c, 0x71a7, 0x71b3, 0x7298, 0x729a, 0x7358, 0x7352, 0x735e, + 0x735f, 0x7360, 0x735d, 0x735b, 0x7361, 0x735a, 0x7359, 0x7362, + 0x7487, 0x7489, 0x748a, 0x7486, 0x7481, 0x747d, 0x7485, 0x7488, + 0x747c, 0x7479, 0x7508, 0x7507, 0x757e, 0x7625, 0x761e, 0x7619, + 0x761d, 0x761c, 0x7623, 0x761a, 0x7628, 0x761b, 0x769c, 0x769d, + 0x769e, 0x769b, 0x778d, 0x778f, 0x7789, 0x7788, 0x78cd, 0x78bb, + 0x78cf, 0x78cc, 0x78d1, 0x78ce, 0x78d4, 0x78c8, 0x78c3, 0x78c4, + 0x78c9, 0x799a, 0x79a1, 0x79a0, 0x799c, 0x79a2, 0x799b, 0x6b76, + 0x7a39, 0x7ab2, 0x7ab4, 0x7ab3, 0x7bb7, 0x7bcb, 0x7bbe, 0x7bac, + 0x7bce, 0x7baf, 0x7bb9, 0x7bca, 0x7bb5, 0x7cc5, 0x7cc8, 0x7ccc, + 0x7ccb, 0x7df7, 0x7ddb, 0x7dea, 0x7de7, 0x7dd7, 0x7de1, 0x7e03, + 0x7dfa, 0x7de6, 0x7df6, 0x7df1, 0x7df0, 0x7dee, 0x7ddf, 0x7f76, + 0x7fac, 0x7fb0, 0x7fad, 0x7fed, 0x7feb, 0x7fea, 0x7fec, 0x7fe6, + 0x7fe8, 0x8064, 0x8067, 0x81a3, 0x819f, + /* 0xe7 */ + 0x819e, 0x8195, 0x81a2, 0x8199, 0x8197, 0x8216, 0x824f, 0x8253, + 0x8252, 0x8250, 0x824e, 0x8251, 0x8524, 0x853b, 0x850f, 0x8500, + 0x8529, 0x850e, 0x8509, 0x850d, 0x851f, 0x850a, 0x8527, 0x851c, + 0x84fb, 0x852b, 0x84fa, 0x8508, 0x850c, 0x84f4, 0x852a, 0x84f2, + 0x8515, 0x84f7, 0x84eb, 0x84f3, 0x84fc, 0x8512, 0x84ea, 0x84e9, + 0x8516, 0x84fe, 0x8528, 0x851d, 0x852e, 0x8502, 0x84fd, 0x851e, + 0x84f6, 0x8531, 0x8526, 0x84e7, 0x84e8, 0x84f0, 0x84ef, 0x84f9, + 0x8518, 0x8520, 0x8530, 0x850b, 0x8519, 0x852f, 0x8662, 0x8756, + 0x8763, 0x8764, 0x8777, 0x87e1, 0x8773, 0x8758, 0x8754, 0x875b, + 0x8752, 0x8761, 0x875a, 0x8751, 0x875e, 0x876d, 0x876a, 0x8750, + 0x874e, 0x875f, 0x875d, 0x876f, 0x876c, 0x877a, 0x876e, 0x875c, + 0x8765, 0x874f, 0x877b, 0x8775, 0x8762, 0x8767, 0x8769, 0x885a, + 0x8905, 0x890c, 0x8914, 0x890b, 0x8917, 0x8918, 0x8919, 0x8906, + 0x8916, 0x8911, 0x890e, 0x8909, 0x89a2, 0x89a4, 0x89a3, 0x89ed, + 0x89f0, 0x89ec, 0x8acf, 0x8ac6, 0x8ab8, 0x8ad3, 0x8ad1, 0x8ad4, + 0x8ad5, 0x8abb, 0x8ad7, 0x8abe, 0x8ac0, 0x8ac5, 0x8ad8, 0x8ac3, + 0x8aba, 0x8abd, 0x8ad9, 0x8c3e, 0x8c4d, 0x8c8f, 0x8ce5, 0x8cdf, + 0x8cd9, 0x8ce8, 0x8cda, 0x8cdd, 0x8ce7, 0x8da0, 0x8d9c, 0x8da1, + 0x8d9b, 0x8e20, 0x8e23, 0x8e25, 0x8e24, 0x8e2e, 0x8e15, 0x8e1b, + 0x8e16, 0x8e11, 0x8e19, 0x8e26, 0x8e27, + /* 0xe8 */ + 0x8e14, 0x8e12, 0x8e18, 0x8e13, 0x8e1c, 0x8e17, 0x8e1a, 0x8f2c, + 0x8f24, 0x8f18, 0x8f1a, 0x8f20, 0x8f23, 0x8f16, 0x8f17, 0x9073, + 0x9070, 0x906f, 0x9067, 0x906b, 0x912f, 0x912b, 0x9129, 0x912a, + 0x9132, 0x9126, 0x912e, 0x9185, 0x9186, 0x918a, 0x9181, 0x9182, + 0x9184, 0x9180, 0x92d0, 0x92c3, 0x92c4, 0x92c0, 0x92d9, 0x92b6, + 0x92cf, 0x92f1, 0x92df, 0x92d8, 0x92e9, 0x92d7, 0x92dd, 0x92cc, + 0x92ef, 0x92c2, 0x92e8, 0x92ca, 0x92c8, 0x92ce, 0x92e6, 0x92cd, + 0x92d5, 0x92c9, 0x92e0, 0x92de, 0x92e7, 0x92d1, 0x92d3, 0x92b5, + 0x92e1, 0x92c6, 0x92b4, 0x957c, 0x95ac, 0x95ab, 0x95ae, 0x95b0, + 0x96a4, 0x96a2, 0x96d3, 0x9705, 0x9708, 0x9702, 0x975a, 0x978a, + 0x978e, 0x9788, 0x97d0, 0x97cf, 0x981e, 0x981d, 0x9826, 0x9829, + 0x9828, 0x9820, 0x981b, 0x9827, 0x98b2, 0x9908, 0x98fa, 0x9911, + 0x9914, 0x9916, 0x9917, 0x9915, 0x99dc, 0x99cd, 0x99cf, 0x99d3, + 0x99d4, 0x99ce, 0x99c9, 0x99d6, 0x99d8, 0x99cb, 0x99d7, 0x99cc, + 0x9ab3, 0x9aec, 0x9aeb, 0x9af3, 0x9af2, 0x9af1, 0x9b46, 0x9b43, + 0x9b67, 0x9b74, 0x9b71, 0x9b66, 0x9b76, 0x9b75, 0x9b70, 0x9b68, + 0x9b64, 0x9b6c, 0x9cfc, 0x9cfa, 0x9cfd, 0x9cff, 0x9cf7, 0x9d07, + 0x9d00, 0x9cf9, 0x9cfb, 0x9d08, 0x9d05, 0x9d04, 0x9e83, 0x9ed3, + 0x9f0f, 0x9f10, 0x511c, 0x5113, 0x5117, 0x511a, 0x5111, 0x51de, + 0x5334, 0x53e1, 0x5670, 0x5660, 0x566e, + /* 0xe9 */ + 0x5673, 0x5666, 0x5663, 0x566d, 0x5672, 0x565e, 0x5677, 0x571c, + 0x571b, 0x58c8, 0x58bd, 0x58c9, 0x58bf, 0x58ba, 0x58c2, 0x58bc, + 0x58c6, 0x5b17, 0x5b19, 0x5b1b, 0x5b21, 0x5b14, 0x5b13, 0x5b10, + 0x5b16, 0x5b28, 0x5b1a, 0x5b20, 0x5b1e, 0x5bef, 0x5dac, 0x5db1, + 0x5da9, 0x5da7, 0x5db5, 0x5db0, 0x5dae, 0x5daa, 0x5da8, 0x5db2, + 0x5dad, 0x5daf, 0x5db4, 0x5e67, 0x5e68, 0x5e66, 0x5e6f, 0x5ee9, + 0x5ee7, 0x5ee6, 0x5ee8, 0x5ee5, 0x5f4b, 0x5fbc, 0x619d, 0x61a8, + 0x6196, 0x61c5, 0x61b4, 0x61c6, 0x61c1, 0x61cc, 0x61ba, 0x61bf, + 0x61b8, 0x618c, 0x64d7, 0x64d6, 0x64d0, 0x64cf, 0x64c9, 0x64bd, + 0x6489, 0x64c3, 0x64db, 0x64f3, 0x64d9, 0x6533, 0x657f, 0x657c, + 0x65a2, 0x66c8, 0x66be, 0x66c0, 0x66ca, 0x66cb, 0x66cf, 0x66bd, + 0x66bb, 0x66ba, 0x66cc, 0x6723, 0x6a34, 0x6a66, 0x6a49, 0x6a67, + 0x6a32, 0x6a68, 0x6a3e, 0x6a5d, 0x6a6d, 0x6a76, 0x6a5b, 0x6a51, + 0x6a28, 0x6a5a, 0x6a3b, 0x6a3f, 0x6a41, 0x6a6a, 0x6a64, 0x6a50, + 0x6a4f, 0x6a54, 0x6a6f, 0x6a69, 0x6a60, 0x6a3c, 0x6a5e, 0x6a56, + 0x6a55, 0x6a4d, 0x6a4e, 0x6a46, 0x6b55, 0x6b54, 0x6b56, 0x6ba7, + 0x6baa, 0x6bab, 0x6bc8, 0x6bc7, 0x6c04, 0x6c03, 0x6c06, 0x6fad, + 0x6fcb, 0x6fa3, 0x6fc7, 0x6fbc, 0x6fce, 0x6fc8, 0x6f5e, 0x6fc4, + 0x6fbd, 0x6f9e, 0x6fca, 0x6fa8, 0x7004, 0x6fa5, 0x6fae, 0x6fba, + 0x6fac, 0x6faa, 0x6fcf, 0x6fbf, 0x6fb8, + /* 0xea */ + 0x6fa2, 0x6fc9, 0x6fab, 0x6fcd, 0x6faf, 0x6fb2, 0x6fb0, 0x71c5, + 0x71c2, 0x71bf, 0x71b8, 0x71d6, 0x71c0, 0x71c1, 0x71cb, 0x71d4, + 0x71ca, 0x71c7, 0x71cf, 0x71bd, 0x71d8, 0x71bc, 0x71c6, 0x71da, + 0x71db, 0x729d, 0x729e, 0x7369, 0x7366, 0x7367, 0x736c, 0x7365, + 0x736b, 0x736a, 0x747f, 0x749a, 0x74a0, 0x7494, 0x7492, 0x7495, + 0x74a1, 0x750b, 0x7580, 0x762f, 0x762d, 0x7631, 0x763d, 0x7633, + 0x763c, 0x7635, 0x7632, 0x7630, 0x76bb, 0x76e6, 0x779a, 0x779d, + 0x77a1, 0x779c, 0x779b, 0x77a2, 0x77a3, 0x7795, 0x7799, 0x7797, + 0x78dd, 0x78e9, 0x78e5, 0x78ea, 0x78de, 0x78e3, 0x78db, 0x78e1, + 0x78e2, 0x78ed, 0x78df, 0x78e0, 0x79a4, 0x7a44, 0x7a48, 0x7a47, + 0x7ab6, 0x7ab8, 0x7ab5, 0x7ab1, 0x7ab7, 0x7bde, 0x7be3, 0x7be7, + 0x7bdd, 0x7bd5, 0x7be5, 0x7bda, 0x7be8, 0x7bf9, 0x7bd4, 0x7bea, + 0x7be2, 0x7bdc, 0x7beb, 0x7bd8, 0x7bdf, 0x7cd2, 0x7cd4, 0x7cd7, + 0x7cd0, 0x7cd1, 0x7e12, 0x7e21, 0x7e17, 0x7e0c, 0x7e1f, 0x7e20, + 0x7e13, 0x7e0e, 0x7e1c, 0x7e15, 0x7e1a, 0x7e22, 0x7e0b, 0x7e0f, + 0x7e16, 0x7e0d, 0x7e14, 0x7e25, 0x7e24, 0x7f43, 0x7f7b, 0x7f7c, + 0x7f7a, 0x7fb1, 0x7fef, 0x802a, 0x8029, 0x806c, 0x81b1, 0x81a6, + 0x81ae, 0x81b9, 0x81b5, 0x81ab, 0x81b0, 0x81ac, 0x81b4, 0x81b2, + 0x81b7, 0x81a7, 0x81f2, 0x8255, 0x8256, 0x8257, 0x8556, 0x8545, + 0x856b, 0x854d, 0x8553, 0x8561, 0x8558, + /* 0xeb */ + 0x8540, 0x8546, 0x8564, 0x8541, 0x8562, 0x8544, 0x8551, 0x8547, + 0x8563, 0x853e, 0x855b, 0x8571, 0x854e, 0x856e, 0x8575, 0x8555, + 0x8567, 0x8560, 0x858c, 0x8566, 0x855d, 0x8554, 0x8565, 0x856c, + 0x8663, 0x8665, 0x8664, 0x879b, 0x878f, 0x8797, 0x8793, 0x8792, + 0x8788, 0x8781, 0x8796, 0x8798, 0x8779, 0x8787, 0x87a3, 0x8785, + 0x8790, 0x8791, 0x879d, 0x8784, 0x8794, 0x879c, 0x879a, 0x8789, + 0x891e, 0x8926, 0x8930, 0x892d, 0x892e, 0x8927, 0x8931, 0x8922, + 0x8929, 0x8923, 0x892f, 0x892c, 0x891f, 0x89f1, 0x8ae0, 0x8ae2, + 0x8af2, 0x8af4, 0x8af5, 0x8add, 0x8b14, 0x8ae4, 0x8adf, 0x8af0, + 0x8ac8, 0x8ade, 0x8ae1, 0x8ae8, 0x8aff, 0x8aef, 0x8afb, 0x8c91, + 0x8c92, 0x8c90, 0x8cf5, 0x8cee, 0x8cf1, 0x8cf0, 0x8cf3, 0x8d6c, + 0x8d6e, 0x8da5, 0x8da7, 0x8e33, 0x8e3e, 0x8e38, 0x8e40, 0x8e45, + 0x8e36, 0x8e3c, 0x8e3d, 0x8e41, 0x8e30, 0x8e3f, 0x8ebd, 0x8f36, + 0x8f2e, 0x8f35, 0x8f32, 0x8f39, 0x8f37, 0x8f34, 0x9076, 0x9079, + 0x907b, 0x9086, 0x90fa, 0x9133, 0x9135, 0x9136, 0x9193, 0x9190, + 0x9191, 0x918d, 0x918f, 0x9327, 0x931e, 0x9308, 0x931f, 0x9306, + 0x930f, 0x937a, 0x9338, 0x933c, 0x931b, 0x9323, 0x9312, 0x9301, + 0x9346, 0x932d, 0x930e, 0x930d, 0x92cb, 0x931d, 0x92fa, 0x9325, + 0x9313, 0x92f9, 0x92f7, 0x9334, 0x9302, 0x9324, 0x92ff, 0x9329, + 0x9339, 0x9335, 0x932a, 0x9314, 0x930c, + /* 0xec */ + 0x930b, 0x92fe, 0x9309, 0x9300, 0x92fb, 0x9316, 0x95bc, 0x95cd, + 0x95be, 0x95b9, 0x95ba, 0x95b6, 0x95bf, 0x95b5, 0x95bd, 0x96a9, + 0x96d4, 0x970b, 0x9712, 0x9710, 0x9799, 0x9797, 0x9794, 0x97f0, + 0x97f8, 0x9835, 0x982f, 0x9832, 0x9924, 0x991f, 0x9927, 0x9929, + 0x999e, 0x99ee, 0x99ec, 0x99e5, 0x99e4, 0x99f0, 0x99e3, 0x99ea, + 0x99e9, 0x99e7, 0x9ab9, 0x9abf, 0x9ab4, 0x9abb, 0x9af6, 0x9afa, + 0x9af9, 0x9af7, 0x9b33, 0x9b80, 0x9b85, 0x9b87, 0x9b7c, 0x9b7e, + 0x9b7b, 0x9b82, 0x9b93, 0x9b92, 0x9b90, 0x9b7a, 0x9b95, 0x9b7d, + 0x9b88, 0x9d25, 0x9d17, 0x9d20, 0x9d1e, 0x9d14, 0x9d29, 0x9d1d, + 0x9d18, 0x9d22, 0x9d10, 0x9d19, 0x9d1f, 0x9e88, 0x9e86, 0x9e87, + 0x9eae, 0x9ead, 0x9ed5, 0x9ed6, 0x9efa, 0x9f12, 0x9f3d, 0x5126, + 0x5125, 0x5122, 0x5124, 0x5120, 0x5129, 0x52f4, 0x5693, 0x568c, + 0x568d, 0x5686, 0x5684, 0x5683, 0x567e, 0x5682, 0x567f, 0x5681, + 0x58d6, 0x58d4, 0x58cf, 0x58d2, 0x5b2d, 0x5b25, 0x5b32, 0x5b23, + 0x5b2c, 0x5b27, 0x5b26, 0x5b2f, 0x5b2e, 0x5b7b, 0x5bf1, 0x5bf2, + 0x5db7, 0x5e6c, 0x5e6a, 0x5fbe, 0x5fbb, 0x61c3, 0x61b5, 0x61bc, + 0x61e7, 0x61e0, 0x61e5, 0x61e4, 0x61e8, 0x61de, 0x64ef, 0x64e9, + 0x64e3, 0x64eb, 0x64e4, 0x64e8, 0x6581, 0x6580, 0x65b6, 0x65da, + 0x66d2, 0x6a8d, 0x6a96, 0x6a81, 0x6aa5, 0x6a89, 0x6a9f, 0x6a9b, + 0x6aa1, 0x6a9e, 0x6a87, 0x6a93, 0x6a8e, + /* 0xed */ + 0x6a95, 0x6a83, 0x6aa8, 0x6aa4, 0x6a91, 0x6a7f, 0x6aa6, 0x6a9a, + 0x6a85, 0x6a8c, 0x6a92, 0x6b5b, 0x6bad, 0x6c09, 0x6fcc, 0x6fa9, + 0x6ff4, 0x6fd4, 0x6fe3, 0x6fdc, 0x6fed, 0x6fe7, 0x6fe6, 0x6fde, + 0x6ff2, 0x6fdd, 0x6fe2, 0x6fe8, 0x71e1, 0x71f1, 0x71e8, 0x71f2, + 0x71e4, 0x71f0, 0x71e2, 0x7373, 0x736e, 0x736f, 0x7497, 0x74b2, + 0x74ab, 0x7490, 0x74aa, 0x74ad, 0x74b1, 0x74a5, 0x74af, 0x7510, + 0x7511, 0x7512, 0x750f, 0x7584, 0x7643, 0x7648, 0x7649, 0x7647, + 0x76a4, 0x76e9, 0x77b5, 0x77ab, 0x77b2, 0x77b7, 0x77b6, 0x77b4, + 0x77b1, 0x77a8, 0x77f0, 0x78f3, 0x78fd, 0x7902, 0x78fb, 0x78fc, + 0x78f2, 0x7905, 0x78f9, 0x78fe, 0x7904, 0x79ab, 0x79a8, 0x7a5c, + 0x7a5b, 0x7a56, 0x7a58, 0x7a54, 0x7a5a, 0x7abe, 0x7ac0, 0x7ac1, + 0x7c05, 0x7c0f, 0x7bf2, 0x7c00, 0x7bff, 0x7bfb, 0x7c0e, 0x7bf4, + 0x7c0b, 0x7bf3, 0x7c02, 0x7c09, 0x7c03, 0x7c01, 0x7bf8, 0x7bfd, + 0x7c06, 0x7bf0, 0x7bf1, 0x7c10, 0x7c0a, 0x7ce8, 0x7e2d, 0x7e3c, + 0x7e42, 0x7e33, 0x9848, 0x7e38, 0x7e2a, 0x7e49, 0x7e40, 0x7e47, + 0x7e29, 0x7e4c, 0x7e30, 0x7e3b, 0x7e36, 0x7e44, 0x7e3a, 0x7f45, + 0x7f7f, 0x7f7e, 0x7f7d, 0x7ff4, 0x7ff2, 0x802c, 0x81bb, 0x81c4, + 0x81cc, 0x81ca, 0x81c5, 0x81c7, 0x81bc, 0x81e9, 0x825b, 0x825a, + 0x825c, 0x8583, 0x8580, 0x858f, 0x85a7, 0x8595, 0x85a0, 0x858b, + 0x85a3, 0x857b, 0x85a4, 0x859a, 0x859e, + /* 0xee */ + 0x8577, 0x857c, 0x8589, 0x85a1, 0x857a, 0x8578, 0x8557, 0x858e, + 0x8596, 0x8586, 0x858d, 0x8599, 0x859d, 0x8581, 0x85a2, 0x8582, + 0x8588, 0x8585, 0x8579, 0x8576, 0x8598, 0x8590, 0x859f, 0x8668, + 0x87be, 0x87aa, 0x87ad, 0x87c5, 0x87b0, 0x87ac, 0x87b9, 0x87b5, + 0x87bc, 0x87ae, 0x87c9, 0x87c3, 0x87c2, 0x87cc, 0x87b7, 0x87af, + 0x87c4, 0x87ca, 0x87b4, 0x87b6, 0x87bf, 0x87b8, 0x87bd, 0x87de, + 0x87b2, 0x8935, 0x8933, 0x893c, 0x893e, 0x8941, 0x8952, 0x8937, + 0x8942, 0x89ad, 0x89af, 0x89ae, 0x89f2, 0x89f3, 0x8b1e, 0x8b18, + 0x8b16, 0x8b11, 0x8b05, 0x8b0b, 0x8b22, 0x8b0f, 0x8b12, 0x8b15, + 0x8b07, 0x8b0d, 0x8b08, 0x8b06, 0x8b1c, 0x8b13, 0x8b1a, 0x8c4f, + 0x8c70, 0x8c72, 0x8c71, 0x8c6f, 0x8c95, 0x8c94, 0x8cf9, 0x8d6f, + 0x8e4e, 0x8e4d, 0x8e53, 0x8e50, 0x8e4c, 0x8e47, 0x8f43, 0x8f40, + 0x9085, 0x907e, 0x9138, 0x919a, 0x91a2, 0x919b, 0x9199, 0x919f, + 0x91a1, 0x919d, 0x91a0, 0x93a1, 0x9383, 0x93af, 0x9364, 0x9356, + 0x9347, 0x937c, 0x9358, 0x935c, 0x9376, 0x9349, 0x9350, 0x9351, + 0x9360, 0x936d, 0x938f, 0x934c, 0x936a, 0x9379, 0x9357, 0x9355, + 0x9352, 0x934f, 0x9371, 0x9377, 0x937b, 0x9361, 0x935e, 0x9363, + 0x9367, 0x9380, 0x934e, 0x9359, 0x95c7, 0x95c0, 0x95c9, 0x95c3, + 0x95c5, 0x95b7, 0x96ae, 0x96b0, 0x96ac, 0x9720, 0x971f, 0x9718, + 0x971d, 0x9719, 0x979a, 0x97a1, 0x979c, + /* 0xef */ + 0x979e, 0x979d, 0x97d5, 0x97d4, 0x97f1, 0x9841, 0x9844, 0x984a, + 0x9849, 0x9845, 0x9843, 0x9925, 0x992b, 0x992c, 0x992a, 0x9933, + 0x9932, 0x992f, 0x992d, 0x9931, 0x9930, 0x9998, 0x99a3, 0x99a1, + 0x9a02, 0x99fa, 0x99f4, 0x99f7, 0x99f9, 0x99f8, 0x99f6, 0x99fb, + 0x99fd, 0x99fe, 0x99fc, 0x9a03, 0x9abe, 0x9afe, 0x9afd, 0x9b01, + 0x9afc, 0x9b48, 0x9b9a, 0x9ba8, 0x9b9e, 0x9b9b, 0x9ba6, 0x9ba1, + 0x9ba5, 0x9ba4, 0x9b86, 0x9ba2, 0x9ba0, 0x9baf, 0x9d33, 0x9d41, + 0x9d67, 0x9d36, 0x9d2e, 0x9d2f, 0x9d31, 0x9d38, 0x9d30, 0x9d45, + 0x9d42, 0x9d43, 0x9d3e, 0x9d37, 0x9d40, 0x9d3d, 0x7ff5, 0x9d2d, + 0x9e8a, 0x9e89, 0x9e8d, 0x9eb0, 0x9ec8, 0x9eda, 0x9efb, 0x9eff, + 0x9f24, 0x9f23, 0x9f22, 0x9f54, 0x9fa0, 0x5131, 0x512d, 0x512e, + 0x5698, 0x569c, 0x5697, 0x569a, 0x569d, 0x5699, 0x5970, 0x5b3c, + 0x5c69, 0x5c6a, 0x5dc0, 0x5e6d, 0x5e6e, 0x61d8, 0x61df, 0x61ed, + 0x61ee, 0x61f1, 0x61ea, 0x61f0, 0x61eb, 0x61d6, 0x61e9, 0x64ff, + 0x6504, 0x64fd, 0x64f8, 0x6501, 0x6503, 0x64fc, 0x6594, 0x65db, + 0x66da, 0x66db, 0x66d8, 0x6ac5, 0x6ab9, 0x6abd, 0x6ae1, 0x6ac6, + 0x6aba, 0x6ab6, 0x6ab7, 0x6ac7, 0x6ab4, 0x6aad, 0x6b5e, 0x6bc9, + 0x6c0b, 0x7007, 0x700c, 0x700d, 0x7001, 0x7005, 0x7014, 0x700e, + 0x6fff, 0x7000, 0x6ffb, 0x7026, 0x6ffc, 0x6ff7, 0x700a, 0x7201, + 0x71ff, 0x71f9, 0x7203, 0x71fd, 0x7376, + /* 0xf0 */ + 0x74b8, 0x74c0, 0x74b5, 0x74c1, 0x74be, 0x74b6, 0x74bb, 0x74c2, + 0x7514, 0x7513, 0x765c, 0x7664, 0x7659, 0x7650, 0x7653, 0x7657, + 0x765a, 0x76a6, 0x76bd, 0x76ec, 0x77c2, 0x77ba, 0x78ff, 0x790c, + 0x7913, 0x7914, 0x7909, 0x7910, 0x7912, 0x7911, 0x79ad, 0x79ac, + 0x7a5f, 0x7c1c, 0x7c29, 0x7c19, 0x7c20, 0x7c1f, 0x7c2d, 0x7c1d, + 0x7c26, 0x7c28, 0x7c22, 0x7c25, 0x7c30, 0x7e5c, 0x7e50, 0x7e56, + 0x7e63, 0x7e58, 0x7e62, 0x7e5f, 0x7e51, 0x7e60, 0x7e57, 0x7e53, + 0x7fb5, 0x7fb3, 0x7ff7, 0x7ff8, 0x8075, 0x81d1, 0x81d2, 0x81d0, + 0x825f, 0x825e, 0x85b4, 0x85c6, 0x85c0, 0x85c3, 0x85c2, 0x85b3, + 0x85b5, 0x85bd, 0x85c7, 0x85c4, 0x85bf, 0x85cb, 0x85ce, 0x85c8, + 0x85c5, 0x85b1, 0x85b6, 0x85d2, 0x8624, 0x85b8, 0x85b7, 0x85be, + 0x8669, 0x87e7, 0x87e6, 0x87e2, 0x87db, 0x87eb, 0x87ea, 0x87e5, + 0x87df, 0x87f3, 0x87e4, 0x87d4, 0x87dc, 0x87d3, 0x87ed, 0x87d8, + 0x87e3, 0x87a4, 0x87d7, 0x87d9, 0x8801, 0x87f4, 0x87e8, 0x87dd, + 0x8953, 0x894b, 0x894f, 0x894c, 0x8946, 0x8950, 0x8951, 0x8949, + 0x8b2a, 0x8b27, 0x8b23, 0x8b33, 0x8b30, 0x8b35, 0x8b47, 0x8b2f, + 0x8b3c, 0x8b3e, 0x8b31, 0x8b25, 0x8b37, 0x8b26, 0x8b36, 0x8b2e, + 0x8b24, 0x8b3b, 0x8b3d, 0x8b3a, 0x8c42, 0x8c75, 0x8c99, 0x8c98, + 0x8c97, 0x8cfe, 0x8d04, 0x8d02, 0x8d00, 0x8e5c, 0x8e62, 0x8e60, + 0x8e57, 0x8e56, 0x8e5e, 0x8e65, 0x8e67, + /* 0xf1 */ + 0x8e5b, 0x8e5a, 0x8e61, 0x8e5d, 0x8e69, 0x8e54, 0x8f46, 0x8f47, + 0x8f48, 0x8f4b, 0x9128, 0x913a, 0x913b, 0x913e, 0x91a8, 0x91a5, + 0x91a7, 0x91af, 0x91aa, 0x93b5, 0x938c, 0x9392, 0x93b7, 0x939b, + 0x939d, 0x9389, 0x93a7, 0x938e, 0x93aa, 0x939e, 0x93a6, 0x9395, + 0x9388, 0x9399, 0x939f, 0x938d, 0x93b1, 0x9391, 0x93b2, 0x93a4, + 0x93a8, 0x93b4, 0x93a3, 0x93a5, 0x95d2, 0x95d3, 0x95d1, 0x96b3, + 0x96d7, 0x96da, 0x5dc2, 0x96df, 0x96d8, 0x96dd, 0x9723, 0x9722, + 0x9725, 0x97ac, 0x97ae, 0x97a8, 0x97ab, 0x97a4, 0x97aa, 0x97a2, + 0x97a5, 0x97d7, 0x97d9, 0x97d6, 0x97d8, 0x97fa, 0x9850, 0x9851, + 0x9852, 0x98b8, 0x9941, 0x993c, 0x993a, 0x9a0f, 0x9a0b, 0x9a09, + 0x9a0d, 0x9a04, 0x9a11, 0x9a0a, 0x9a05, 0x9a07, 0x9a06, 0x9ac0, + 0x9adc, 0x9b08, 0x9b04, 0x9b05, 0x9b29, 0x9b35, 0x9b4a, 0x9b4c, + 0x9b4b, 0x9bc7, 0x9bc6, 0x9bc3, 0x9bbf, 0x9bc1, 0x9bb5, 0x9bb8, + 0x9bd3, 0x9bb6, 0x9bc4, 0x9bb9, 0x9bbd, 0x9d5c, 0x9d53, 0x9d4f, + 0x9d4a, 0x9d5b, 0x9d4b, 0x9d59, 0x9d56, 0x9d4c, 0x9d57, 0x9d52, + 0x9d54, 0x9d5f, 0x9d58, 0x9d5a, 0x9e8e, 0x9e8c, 0x9edf, 0x9f01, + 0x9f00, 0x9f16, 0x9f25, 0x9f2b, 0x9f2a, 0x9f29, 0x9f28, 0x9f4c, + 0x9f55, 0x5134, 0x5135, 0x5296, 0x52f7, 0x53b4, 0x56ab, 0x56ad, + 0x56a6, 0x56a7, 0x56aa, 0x56ac, 0x58da, 0x58dd, 0x58db, 0x5912, + 0x5b3d, 0x5b3e, 0x5b3f, 0x5dc3, 0x5e70, + /* 0xf2 */ + 0x5fbf, 0x61fb, 0x6507, 0x6510, 0x650d, 0x6509, 0x650c, 0x650e, + 0x6584, 0x65de, 0x65dd, 0x66de, 0x6ae7, 0x6ae0, 0x6acc, 0x6ad1, + 0x6ad9, 0x6acb, 0x6adf, 0x6adc, 0x6ad0, 0x6aeb, 0x6acf, 0x6acd, + 0x6ade, 0x6b60, 0x6bb0, 0x6c0c, 0x7019, 0x7027, 0x7020, 0x7016, + 0x702b, 0x7021, 0x7022, 0x7023, 0x7029, 0x7017, 0x7024, 0x701c, + 0x702a, 0x720c, 0x720a, 0x7207, 0x7202, 0x7205, 0x72a5, 0x72a6, + 0x72a4, 0x72a3, 0x72a1, 0x74cb, 0x74c5, 0x74b7, 0x74c3, 0x7516, + 0x7660, 0x77c9, 0x77ca, 0x77c4, 0x77f1, 0x791d, 0x791b, 0x7921, + 0x791c, 0x7917, 0x791e, 0x79b0, 0x7a67, 0x7a68, 0x7c33, 0x7c3c, + 0x7c39, 0x7c2c, 0x7c3b, 0x7cec, 0x7cea, 0x7e76, 0x7e75, 0x7e78, + 0x7e70, 0x7e77, 0x7e6f, 0x7e7a, 0x7e72, 0x7e74, 0x7e68, 0x7f4b, + 0x7f4a, 0x7f83, 0x7f86, 0x7fb7, 0x7ffd, 0x7ffe, 0x8078, 0x81d7, + 0x81d5, 0x8264, 0x8261, 0x8263, 0x85eb, 0x85f1, 0x85ed, 0x85d9, + 0x85e1, 0x85e8, 0x85da, 0x85d7, 0x85ec, 0x85f2, 0x85f8, 0x85d8, + 0x85df, 0x85e3, 0x85dc, 0x85d1, 0x85f0, 0x85e6, 0x85ef, 0x85de, + 0x85e2, 0x8800, 0x87fa, 0x8803, 0x87f6, 0x87f7, 0x8809, 0x880c, + 0x880b, 0x8806, 0x87fc, 0x8808, 0x87ff, 0x880a, 0x8802, 0x8962, + 0x895a, 0x895b, 0x8957, 0x8961, 0x895c, 0x8958, 0x895d, 0x8959, + 0x8988, 0x89b7, 0x89b6, 0x89f6, 0x8b50, 0x8b48, 0x8b4a, 0x8b40, + 0x8b53, 0x8b56, 0x8b54, 0x8b4b, 0x8b55, + /* 0xf3 */ + 0x8b51, 0x8b42, 0x8b52, 0x8b57, 0x8c43, 0x8c77, 0x8c76, 0x8c9a, + 0x8d06, 0x8d07, 0x8d09, 0x8dac, 0x8daa, 0x8dad, 0x8dab, 0x8e6d, + 0x8e78, 0x8e73, 0x8e6a, 0x8e6f, 0x8e7b, 0x8ec2, 0x8f52, 0x8f51, + 0x8f4f, 0x8f50, 0x8f53, 0x8fb4, 0x9140, 0x913f, 0x91b0, 0x91ad, + 0x93de, 0x93c7, 0x93cf, 0x93c2, 0x93da, 0x93d0, 0x93f9, 0x93ec, + 0x93cc, 0x93d9, 0x93a9, 0x93e6, 0x93ca, 0x93d4, 0x93ee, 0x93e3, + 0x93d5, 0x93c4, 0x93ce, 0x93c0, 0x93d2, 0x93e7, 0x957d, 0x95da, + 0x95db, 0x96e1, 0x9729, 0x972b, 0x972c, 0x9728, 0x9726, 0x97b3, + 0x97b7, 0x97b6, 0x97dd, 0x97de, 0x97df, 0x985c, 0x9859, 0x985d, + 0x9857, 0x98bf, 0x98bd, 0x98bb, 0x98be, 0x9948, 0x9947, 0x9943, + 0x99a6, 0x99a7, 0x9a1a, 0x9a15, 0x9a25, 0x9a1d, 0x9a24, 0x9a1b, + 0x9a22, 0x9a20, 0x9a27, 0x9a23, 0x9a1e, 0x9a1c, 0x9a14, 0x9ac2, + 0x9b0b, 0x9b0a, 0x9b0e, 0x9b0c, 0x9b37, 0x9bea, 0x9beb, 0x9be0, + 0x9bde, 0x9be4, 0x9be6, 0x9be2, 0x9bf0, 0x9bd4, 0x9bd7, 0x9bec, + 0x9bdc, 0x9bd9, 0x9be5, 0x9bd5, 0x9be1, 0x9bda, 0x9d77, 0x9d81, + 0x9d8a, 0x9d84, 0x9d88, 0x9d71, 0x9d80, 0x9d78, 0x9d86, 0x9d8b, + 0x9d8c, 0x9d7d, 0x9d6b, 0x9d74, 0x9d75, 0x9d70, 0x9d69, 0x9d85, + 0x9d73, 0x9d7b, 0x9d82, 0x9d6f, 0x9d79, 0x9d7f, 0x9d87, 0x9d68, + 0x9e94, 0x9e91, 0x9ec0, 0x9efc, 0x9f2d, 0x9f40, 0x9f41, 0x9f4d, + 0x9f56, 0x9f57, 0x9f58, 0x5337, 0x56b2, + /* 0xf4 */ + 0x56b5, 0x56b3, 0x58e3, 0x5b45, 0x5dc6, 0x5dc7, 0x5eee, 0x5eef, + 0x5fc0, 0x5fc1, 0x61f9, 0x6517, 0x6516, 0x6515, 0x6513, 0x65df, + 0x66e8, 0x66e3, 0x66e4, 0x6af3, 0x6af0, 0x6aea, 0x6ae8, 0x6af9, + 0x6af1, 0x6aee, 0x6aef, 0x703c, 0x7035, 0x702f, 0x7037, 0x7034, + 0x7031, 0x7042, 0x7038, 0x703f, 0x703a, 0x7039, 0x7040, 0x703b, + 0x7033, 0x7041, 0x7213, 0x7214, 0x72a8, 0x737d, 0x737c, 0x74ba, + 0x76ab, 0x76aa, 0x76be, 0x76ed, 0x77cc, 0x77ce, 0x77cf, 0x77cd, + 0x77f2, 0x7925, 0x7923, 0x7927, 0x7928, 0x7924, 0x7929, 0x79b2, + 0x7a6e, 0x7a6c, 0x7a6d, 0x7af7, 0x7c49, 0x7c48, 0x7c4a, 0x7c47, + 0x7c45, 0x7cee, 0x7e7b, 0x7e7e, 0x7e81, 0x7e80, 0x7fba, 0x7fff, + 0x8079, 0x81db, 0x81d9, 0x820b, 0x8268, 0x8269, 0x8622, 0x85ff, + 0x8601, 0x85fe, 0x861b, 0x8600, 0x85f6, 0x8604, 0x8609, 0x8605, + 0x860c, 0x85fd, 0x8819, 0x8810, 0x8811, 0x8817, 0x8813, 0x8816, + 0x8963, 0x8966, 0x89b9, 0x89f7, 0x8b60, 0x8b6a, 0x8b5d, 0x8b68, + 0x8b63, 0x8b65, 0x8b67, 0x8b6d, 0x8dae, 0x8e86, 0x8e88, 0x8e84, + 0x8f59, 0x8f56, 0x8f57, 0x8f55, 0x8f58, 0x8f5a, 0x908d, 0x9143, + 0x9141, 0x91b7, 0x91b5, 0x91b2, 0x91b3, 0x940b, 0x9413, 0x93fb, + 0x9420, 0x940f, 0x9414, 0x93fe, 0x9415, 0x9410, 0x9428, 0x9419, + 0x940d, 0x93f5, 0x9400, 0x93f7, 0x9407, 0x940e, 0x9416, 0x9412, + 0x93fa, 0x9409, 0x93f8, 0x940a, 0x93ff, + /* 0xf5 */ + 0x93fc, 0x940c, 0x93f6, 0x9411, 0x9406, 0x95de, 0x95e0, 0x95df, + 0x972e, 0x972f, 0x97b9, 0x97bb, 0x97fd, 0x97fe, 0x9860, 0x9862, + 0x9863, 0x985f, 0x98c1, 0x98c2, 0x9950, 0x994e, 0x9959, 0x994c, + 0x994b, 0x9953, 0x9a32, 0x9a34, 0x9a31, 0x9a2c, 0x9a2a, 0x9a36, + 0x9a29, 0x9a2e, 0x9a38, 0x9a2d, 0x9ac7, 0x9aca, 0x9ac6, 0x9b10, + 0x9b12, 0x9b11, 0x9c0b, 0x9c08, 0x9bf7, 0x9c05, 0x9c12, 0x9bf8, + 0x9c40, 0x9c07, 0x9c0e, 0x9c06, 0x9c17, 0x9c14, 0x9c09, 0x9d9f, + 0x9d99, 0x9da4, 0x9d9d, 0x9d92, 0x9d98, 0x9d90, 0x9d9b, 0x9da0, + 0x9d94, 0x9d9c, 0x9daa, 0x9d97, 0x9da1, 0x9d9a, 0x9da2, 0x9da8, + 0x9d9e, 0x9da3, 0x9dbf, 0x9da9, 0x9d96, 0x9da6, 0x9da7, 0x9e99, + 0x9e9b, 0x9e9a, 0x9ee5, 0x9ee4, 0x9ee7, 0x9ee6, 0x9f30, 0x9f2e, + 0x9f5b, 0x9f60, 0x9f5e, 0x9f5d, 0x9f59, 0x9f91, 0x513a, 0x5139, + 0x5298, 0x5297, 0x56c3, 0x56bd, 0x56be, 0x5b48, 0x5b47, 0x5dcb, + 0x5dcf, 0x5ef1, 0x61fd, 0x651b, 0x6b02, 0x6afc, 0x6b03, 0x6af8, + 0x6b00, 0x7043, 0x7044, 0x704a, 0x7048, 0x7049, 0x7045, 0x7046, + 0x721d, 0x721a, 0x7219, 0x737e, 0x7517, 0x766a, 0x77d0, 0x792d, + 0x7931, 0x792f, 0x7c54, 0x7c53, 0x7cf2, 0x7e8a, 0x7e87, 0x7e88, + 0x7e8b, 0x7e86, 0x7e8d, 0x7f4d, 0x7fbb, 0x8030, 0x81dd, 0x8618, + 0x862a, 0x8626, 0x861f, 0x8623, 0x861c, 0x8619, 0x8627, 0x862e, + 0x8621, 0x8620, 0x8629, 0x861e, 0x8625, + /* 0xf6 */ + 0x8829, 0x881d, 0x881b, 0x8820, 0x8824, 0x881c, 0x882b, 0x884a, + 0x896d, 0x8969, 0x896e, 0x896b, 0x89fa, 0x8b79, 0x8b78, 0x8b45, + 0x8b7a, 0x8b7b, 0x8d10, 0x8d14, 0x8daf, 0x8e8e, 0x8e8c, 0x8f5e, + 0x8f5b, 0x8f5d, 0x9146, 0x9144, 0x9145, 0x91b9, 0x943f, 0x943b, + 0x9436, 0x9429, 0x943d, 0x943c, 0x9430, 0x9439, 0x942a, 0x9437, + 0x942c, 0x9440, 0x9431, 0x95e5, 0x95e4, 0x95e3, 0x9735, 0x973a, + 0x97bf, 0x97e1, 0x9864, 0x98c9, 0x98c6, 0x98c0, 0x9958, 0x9956, + 0x9a39, 0x9a3d, 0x9a46, 0x9a44, 0x9a42, 0x9a41, 0x9a3a, 0x9a3f, + 0x9acd, 0x9b15, 0x9b17, 0x9b18, 0x9b16, 0x9b3a, 0x9b52, 0x9c2b, + 0x9c1d, 0x9c1c, 0x9c2c, 0x9c23, 0x9c28, 0x9c29, 0x9c24, 0x9c21, + 0x9db7, 0x9db6, 0x9dbc, 0x9dc1, 0x9dc7, 0x9dca, 0x9dcf, 0x9dbe, + 0x9dc5, 0x9dc3, 0x9dbb, 0x9db5, 0x9dce, 0x9db9, 0x9dba, 0x9dac, + 0x9dc8, 0x9db1, 0x9dad, 0x9dcc, 0x9db3, 0x9dcd, 0x9db2, 0x9e7a, + 0x9e9c, 0x9eeb, 0x9eee, 0x9eed, 0x9f1b, 0x9f18, 0x9f1a, 0x9f31, + 0x9f4e, 0x9f65, 0x9f64, 0x9f92, 0x4eb9, 0x56c6, 0x56c5, 0x56cb, + 0x5971, 0x5b4b, 0x5b4c, 0x5dd5, 0x5dd1, 0x5ef2, 0x6521, 0x6520, + 0x6526, 0x6522, 0x6b0b, 0x6b08, 0x6b09, 0x6c0d, 0x7055, 0x7056, + 0x7057, 0x7052, 0x721e, 0x721f, 0x72a9, 0x737f, 0x74d8, 0x74d5, + 0x74d9, 0x74d7, 0x766d, 0x76ad, 0x7935, 0x79b4, 0x7a70, 0x7a71, + 0x7c57, 0x7c5c, 0x7c59, 0x7c5b, 0x7c5a, + /* 0xf7 */ + 0x7cf4, 0x7cf1, 0x7e91, 0x7f4f, 0x7f87, 0x81de, 0x826b, 0x8634, + 0x8635, 0x8633, 0x862c, 0x8632, 0x8636, 0x882c, 0x8828, 0x8826, + 0x882a, 0x8825, 0x8971, 0x89bf, 0x89be, 0x89fb, 0x8b7e, 0x8b84, + 0x8b82, 0x8b86, 0x8b85, 0x8b7f, 0x8d15, 0x8e95, 0x8e94, 0x8e9a, + 0x8e92, 0x8e90, 0x8e96, 0x8e97, 0x8f60, 0x8f62, 0x9147, 0x944c, + 0x9450, 0x944a, 0x944b, 0x944f, 0x9447, 0x9445, 0x9448, 0x9449, + 0x9446, 0x973f, 0x97e3, 0x986a, 0x9869, 0x98cb, 0x9954, 0x995b, + 0x9a4e, 0x9a53, 0x9a54, 0x9a4c, 0x9a4f, 0x9a48, 0x9a4a, 0x9a49, + 0x9a52, 0x9a50, 0x9ad0, 0x9b19, 0x9b2b, 0x9b3b, 0x9b56, 0x9b55, + 0x9c46, 0x9c48, 0x9c3f, 0x9c44, 0x9c39, 0x9c33, 0x9c41, 0x9c3c, + 0x9c37, 0x9c34, 0x9c32, 0x9c3d, 0x9c36, 0x9ddb, 0x9dd2, 0x9dde, + 0x9dda, 0x9dcb, 0x9dd0, 0x9ddc, 0x9dd1, 0x9ddf, 0x9de9, 0x9dd9, + 0x9dd8, 0x9dd6, 0x9df5, 0x9dd5, 0x9ddd, 0x9eb6, 0x9ef0, 0x9f35, + 0x9f33, 0x9f32, 0x9f42, 0x9f6b, 0x9f95, 0x9fa2, 0x513d, 0x5299, + 0x58e8, 0x58e7, 0x5972, 0x5b4d, 0x5dd8, 0x882f, 0x5f4f, 0x6201, + 0x6203, 0x6204, 0x6529, 0x6525, 0x6596, 0x66eb, 0x6b11, 0x6b12, + 0x6b0f, 0x6bca, 0x705b, 0x705a, 0x7222, 0x7382, 0x7381, 0x7383, + 0x7670, 0x77d4, 0x7c67, 0x7c66, 0x7e95, 0x826c, 0x863a, 0x8640, + 0x8639, 0x863c, 0x8631, 0x863b, 0x863e, 0x8830, 0x8832, 0x882e, + 0x8833, 0x8976, 0x8974, 0x8973, 0x89fe, + /* 0xf8 */ + 0x8b8c, 0x8b8e, 0x8b8b, 0x8b88, 0x8c45, 0x8d19, 0x8e98, 0x8f64, + 0x8f63, 0x91bc, 0x9462, 0x9455, 0x945d, 0x9457, 0x945e, 0x97c4, + 0x97c5, 0x9800, 0x9a56, 0x9a59, 0x9b1e, 0x9b1f, 0x9b20, 0x9c52, + 0x9c58, 0x9c50, 0x9c4a, 0x9c4d, 0x9c4b, 0x9c55, 0x9c59, 0x9c4c, + 0x9c4e, 0x9dfb, 0x9df7, 0x9def, 0x9de3, 0x9deb, 0x9df8, 0x9de4, + 0x9df6, 0x9de1, 0x9dee, 0x9de6, 0x9df2, 0x9df0, 0x9de2, 0x9dec, + 0x9df4, 0x9df3, 0x9de8, 0x9ded, 0x9ec2, 0x9ed0, 0x9ef2, 0x9ef3, + 0x9f06, 0x9f1c, 0x9f38, 0x9f37, 0x9f36, 0x9f43, 0x9f4f, 0x9f71, + 0x9f70, 0x9f6e, 0x9f6f, 0x56d3, 0x56cd, 0x5b4e, 0x5c6d, 0x652d, + 0x66ed, 0x66ee, 0x6b13, 0x705f, 0x7061, 0x705d, 0x7060, 0x7223, + 0x74db, 0x74e5, 0x77d5, 0x7938, 0x79b7, 0x79b6, 0x7c6a, 0x7e97, + 0x7f89, 0x826d, 0x8643, 0x8838, 0x8837, 0x8835, 0x884b, 0x8b94, + 0x8b95, 0x8e9e, 0x8e9f, 0x8ea0, 0x8e9d, 0x91be, 0x91bd, 0x91c2, + 0x946b, 0x9468, 0x9469, 0x96e5, 0x9746, 0x9743, 0x9747, 0x97c7, + 0x97e5, 0x9a5e, 0x9ad5, 0x9b59, 0x9c63, 0x9c67, 0x9c66, 0x9c62, + 0x9c5e, 0x9c60, 0x9e02, 0x9dfe, 0x9e07, 0x9e03, 0x9e06, 0x9e05, + 0x9e00, 0x9e01, 0x9e09, 0x9dff, 0x9dfd, 0x9e04, 0x9ea0, 0x9f1e, + 0x9f46, 0x9f74, 0x9f75, 0x9f76, 0x56d4, 0x652e, 0x65b8, 0x6b18, + 0x6b19, 0x6b17, 0x6b1a, 0x7062, 0x7226, 0x72aa, 0x77d8, 0x77d9, + 0x7939, 0x7c69, 0x7c6b, 0x7cf6, 0x7e9a, + /* 0xf9 */ + 0x7e98, 0x7e9b, 0x7e99, 0x81e0, 0x81e1, 0x8646, 0x8647, 0x8648, + 0x8979, 0x897a, 0x897c, 0x897b, 0x89ff, 0x8b98, 0x8b99, 0x8ea5, + 0x8ea4, 0x8ea3, 0x946e, 0x946d, 0x946f, 0x9471, 0x9473, 0x9749, + 0x9872, 0x995f, 0x9c68, 0x9c6e, 0x9c6d, 0x9e0b, 0x9e0d, 0x9e10, + 0x9e0f, 0x9e12, 0x9e11, 0x9ea1, 0x9ef5, 0x9f09, 0x9f47, 0x9f78, + 0x9f7b, 0x9f7a, 0x9f79, 0x571e, 0x7066, 0x7c6f, 0x883c, 0x8db2, + 0x8ea6, 0x91c3, 0x9474, 0x9478, 0x9476, 0x9475, 0x9a60, 0x9c74, + 0x9c73, 0x9c71, 0x9c75, 0x9e14, 0x9e13, 0x9ef6, 0x9f0a, 0x9fa4, + 0x7068, 0x7065, 0x7cf7, 0x866a, 0x883e, 0x883d, 0x883f, 0x8b9e, + 0x8c9c, 0x8ea9, 0x8ec9, 0x974b, 0x9873, 0x9874, 0x98cc, 0x9961, + 0x99ab, 0x9a64, 0x9a66, 0x9a67, 0x9b24, 0x9e15, 0x9e17, 0x9f48, + 0x6207, 0x6b1e, 0x7227, 0x864c, 0x8ea8, 0x9482, 0x9480, 0x9481, + 0x9a69, 0x9a68, 0x9b2e, 0x9e19, 0x7229, 0x864b, 0x8b9f, 0x9483, + 0x9c79, 0x9eb7, 0x7675, 0x9a6b, 0x9c7a, 0x9e1d, 0x7069, 0x706a, + 0x9ea4, 0x9f7e, 0x9f49, 0x9f98, 0x7881, 0x92b9, 0x88cf, 0x58bb, + 0x6052, 0x7ca7, 0x5afa, 0x2554, 0x2566, 0x2557, 0x2560, 0x256c, + 0x2563, 0x255a, 0x2569, 0x255d, 0x2552, 0x2564, 0x2555, 0x255e, + 0x256a, 0x2561, 0x2558, 0x2567, 0x255b, 0x2553, 0x2565, 0x2556, + 0x255f, 0x256b, 0x2562, 0x2559, 0x2568, 0x255c, 0x2551, 0x2550, + 0x256d, 0x256e, 0x2570, 0x256f, 0xffed, + /* 0xfa */ + 0xe000, 0x92db, 0xe002, 0xe003, 0x854c, 0x42b5, 0x73ef, 0x51b5, + 0x3649, 0xe009, 0xe00a, 0x9344, 0xe00c, 0x82ee, 0xe00e, 0x783c, + 0x6744, 0x62df, 0xe012, 0xe013, 0xe014, 0xe015, 0xe016, 0x4fab, + 0xe018, 0x5008, 0xe01a, 0xe01b, 0xe01c, 0xe01d, 0xe01e, 0x5029, + 0xe020, 0x5fa4, 0xe022, 0xe023, 0x6edb, 0xe025, 0x507d, 0x5101, + 0x347a, 0x510e, 0x986c, 0x3743, 0x8416, 0xe02d, 0xe02e, 0x5160, + 0xe030, 0x516a, 0xe032, 0xe033, 0xe034, 0xe035, 0xe036, 0xe037, + 0xe038, 0x5b82, 0x877d, 0xe03b, 0xe03c, 0x51b2, 0x51b8, 0x9d34, + 0x51c9, 0x51cf, 0x51d1, 0x3cdc, 0x51d3, 0xe045, 0x51b3, 0x51e2, + 0x5342, 0x51ed, 0x83cd, 0x693e, 0xe04c, 0x5f7b, 0x520b, 0x5226, + 0x523c, 0x52b5, 0x5257, 0x5294, 0x52b9, 0x52c5, 0x7c15, 0x8542, + 0x52e0, 0x860d, 0xe05a, 0x5305, 0xe05c, 0x5549, 0x6ed9, 0xe05f, + 0xe060, 0xe061, 0x5333, 0x5344, 0xe064, 0x6ccb, 0xe066, 0x681b, + 0x73d5, 0x604a, 0x3eaa, 0x38cc, 0xe06c, 0x71dd, 0x44a2, 0x536d, + 0x5374, 0xe071, 0x537e, 0x537f, 0xe074, 0xe075, 0x77e6, 0x5393, + 0xe078, 0x53a0, 0x53ab, 0x53ae, 0x73a7, 0xe07d, 0x3f59, 0x739c, + 0x53c1, 0x53c5, 0x6c49, 0x4e49, 0x57fe, 0x53d9, 0x3aab, 0xe087, + 0x53e0, 0xe089, 0xe08a, 0x53f6, 0xe08c, 0x5413, 0x7079, 0x552b, + 0x6657, 0x6d5b, 0x546d, 0xe093, 0xe094, 0x555d, 0x548f, 0x54a4, + 0x47a6, 0xe099, 0xe09a, 0x3db4, 0xe09c, + /* 0xfb */ + 0xe09d, 0xe09e, 0x5547, 0x4ced, 0x542f, 0x7417, 0x5586, 0x55a9, + 0x5605, 0xe0a6, 0xe0a7, 0x4552, 0xe0a9, 0x66b3, 0xe0ab, 0x5637, + 0x66cd, 0xe0ae, 0x66a4, 0x66ad, 0x564d, 0x564f, 0x78f1, 0x56f1, + 0x9787, 0x53fe, 0x5700, 0x56ef, 0x56ed, 0xe0ba, 0x3623, 0xe0bc, + 0x5746, 0xe0be, 0x6c6e, 0x708b, 0x5742, 0x36b1, 0xe0c3, 0x57e6, + 0xe0c5, 0x5803, 0xe0c7, 0xe0c8, 0x5826, 0xe0ca, 0x585c, 0x58aa, + 0x3561, 0x58e0, 0x58dc, 0xe0d0, 0x58fb, 0x5bff, 0x5743, 0xe0d4, + 0xe0d5, 0x93d3, 0x35a1, 0x591f, 0x68a6, 0x36c3, 0x6e59, 0xe0dc, + 0x5a24, 0x5553, 0xe0df, 0x8505, 0x59c9, 0xe0e2, 0xe0e3, 0xe0e4, + 0xe0e5, 0x59d9, 0xe0e7, 0xe0e8, 0xe0e9, 0x6d71, 0xe0eb, 0xe0ec, + 0x59f9, 0xe0ee, 0x5aab, 0x5a63, 0x36e6, 0xe0f2, 0x5a77, 0x3708, + 0x5a96, 0x7465, 0x5ad3, 0xe0f8, 0xe0f9, 0x3d85, 0xe0fb, 0x3732, + 0xe0fd, 0x5e83, 0x52d0, 0x5b76, 0x6588, 0x5b7c, 0xe103, 0x4004, + 0x485d, 0xe106, 0x5bd5, 0x6160, 0xe109, 0xe10a, 0xe10b, 0x5bf3, + 0x5b9d, 0x4d10, 0x5c05, 0xe110, 0x5c13, 0x73ce, 0x5c14, 0xe114, + 0xe115, 0x5c49, 0x48dd, 0x5c85, 0x5ce9, 0x5cef, 0x5d8b, 0xe11c, + 0xe11d, 0x5d10, 0x5d18, 0x5d46, 0xe121, 0x5cba, 0x5dd7, 0x82fc, + 0x382d, 0xe126, 0xe127, 0xe128, 0x8287, 0x3836, 0x3bc2, 0x5e2e, + 0x6a8a, 0x5e75, 0x5e7a, 0xe130, 0xe131, 0x53a6, 0x4eb7, 0x5ed0, + 0x53a8, 0xe136, 0x5e09, 0x5ef4, 0xe139, + /* 0xfc */ + 0x5ef9, 0x5efb, 0x38a0, 0x5efc, 0x683e, 0x941b, 0x5f0d, 0xe141, + 0xe142, 0x3ade, 0x48ae, 0xe145, 0x5f3a, 0xe147, 0xe148, 0x5f58, + 0xe14a, 0x5f63, 0x97bd, 0xe14d, 0x5f72, 0x9340, 0xe150, 0x5fa7, + 0x5db6, 0x3d5f, 0xe154, 0xe155, 0xe156, 0xe157, 0x91d6, 0xe159, + 0xe15a, 0x6031, 0x6685, 0xe15d, 0x3963, 0x3dc7, 0x3639, 0x5790, + 0xe162, 0x7971, 0x3e40, 0x609e, 0x60a4, 0x60b3, 0xe168, 0xe169, + 0xe16a, 0x74a4, 0x50e1, 0x5aa0, 0x6164, 0x8424, 0x6142, 0xe171, + 0xe172, 0x6181, 0x51f4, 0xe175, 0x6187, 0x5baa, 0xe178, 0xe179, + 0x61d3, 0xe17b, 0xe17c, 0x61d0, 0x3932, 0xe17f, 0xe180, 0x6023, + 0x615c, 0x651e, 0x638b, 0xe185, 0x62c5, 0xe187, 0x62d5, 0xe189, + 0x636c, 0xe18b, 0x3a17, 0x6438, 0x63f8, 0xe18f, 0xe190, 0x6490, + 0x6f8a, 0xe193, 0x9814, 0xe195, 0xe196, 0x64e1, 0x64e5, 0x947b, + 0x3a66, 0x643a, 0x3a57, 0x654d, 0x6f16, 0xe19f, 0xe1a0, 0x6585, + 0x656d, 0x655f, 0xe1a4, 0x65b5, 0xe1a6, 0x4b37, 0x65d1, 0x40d8, + 0xe1aa, 0x65e0, 0x65e3, 0x5fdf, 0xe1ae, 0x6618, 0xe1b0, 0xe1b1, + 0x6644, 0xe1b3, 0xe1b4, 0x664b, 0xe1b6, 0x6667, 0xe1b8, 0x6673, + 0x6674, 0xe1bb, 0xe1bc, 0xe1bd, 0xe1be, 0xe1bf, 0x77c5, 0xe1c1, + 0x99a4, 0x6702, 0xe1c4, 0xe1c5, 0x3b2b, 0x69fa, 0xe1c8, 0x675e, + 0x6767, 0x6762, 0xe1cc, 0xe1cd, 0x67d7, 0x44e9, 0x6822, 0x6e50, + 0x923c, 0x6801, 0xe1d4, 0xe1d5, 0x685d, + /* 0xfd */ + 0xe1d7, 0x69e1, 0x6a0b, 0xe1da, 0x6973, 0x68c3, 0xe1dd, 0x6901, + 0x6900, 0x3d32, 0x3a01, 0xe1e2, 0x3b80, 0x67ac, 0x6961, 0xe1e6, + 0x42fc, 0x6936, 0x6998, 0x3ba1, 0xe1eb, 0x8363, 0x5090, 0x69f9, + 0xe1ef, 0xe1f0, 0x6a45, 0xe1f2, 0x6a9d, 0x3bf3, 0x67b1, 0x6ac8, + 0xe1f7, 0x3c0d, 0x6b1d, 0xe1fa, 0x60de, 0x6b35, 0x6b74, 0xe1fe, + 0x6eb5, 0xe200, 0xe201, 0xe202, 0x3740, 0x5421, 0xe205, 0x6be1, + 0xe207, 0x6bdc, 0x6c37, 0xe20a, 0xe20b, 0xe20c, 0x6c5a, 0x8226, + 0x6c79, 0xe210, 0x44c5, 0xe212, 0xe213, 0xe214, 0xe215, 0xe216, + 0x36e5, 0x3ceb, 0xe219, 0x9b83, 0xe21b, 0xe21c, 0x7f8f, 0x6837, + 0xe21f, 0xe220, 0xe221, 0x6d96, 0x6d5c, 0x6e7c, 0x6f04, 0xe226, + 0xe227, 0xe228, 0x8533, 0xe22a, 0x51c7, 0x6c9c, 0x6e1d, 0x842e, + 0xe22f, 0x6e2f, 0xe231, 0x7453, 0xe233, 0x79cc, 0x6e4f, 0x5a91, + 0xe237, 0x6ff8, 0x370d, 0x6f9d, 0xe23b, 0x6efa, 0xe23d, 0xe23e, + 0x4555, 0x93f0, 0x6f44, 0x6f5c, 0x3d4e, 0x6f74, 0xe245, 0x3d3b, + 0x6f9f, 0xe248, 0x6fd3, 0xe24a, 0xe24b, 0xe24c, 0xe24d, 0xe24e, + 0xe24f, 0x51df, 0xe251, 0xe252, 0xe253, 0xe254, 0x704b, 0x707e, + 0x70a7, 0x7081, 0x70cc, 0x70d5, 0x70d6, 0x70df, 0x4104, 0x3de8, + 0x71b4, 0x7196, 0xe261, 0x712b, 0x7145, 0x5a88, 0x714a, 0x716e, + 0x5c9c, 0xe268, 0x714f, 0x9362, 0xe26b, 0x712c, 0xe26d, 0xe26e, + 0xe26f, 0x71ba, 0xe271, 0x70bd, 0x720e, + /* 0xfe */ + 0x9442, 0x7215, 0x5911, 0x9443, 0x7224, 0x9341, 0xe27a, 0x722e, + 0x7240, 0xe27d, 0x68bd, 0x7255, 0x7257, 0x3e55, 0xe282, 0x680d, + 0x6f3d, 0x7282, 0x732a, 0x732b, 0xe288, 0xe289, 0x48ed, 0xe28b, + 0x7328, 0x732e, 0x73cf, 0x73aa, 0xe290, 0xe291, 0x73c9, 0x7449, + 0xe294, 0xe295, 0xe296, 0x6623, 0x36c5, 0xe299, 0xe29a, 0xe29b, + 0x73f7, 0x7415, 0x6903, 0xe29f, 0x7439, 0xe2a1, 0x3ed7, 0x745c, + 0xe2a4, 0x7460, 0xe2a6, 0x7447, 0x73e4, 0x7476, 0x83b9, 0x746c, + 0x3730, 0x7474, 0x93f1, 0x6a2c, 0x7482, 0x4953, 0xe2b2, 0xe2b3, + 0xe2b4, 0xe2b5, 0x5b46, 0xe2b7, 0xe2b8, 0x74c8, 0xe2ba, 0x750e, + 0x74e9, 0x751e, 0xe2be, 0xe2bf, 0x5bd7, 0xe2c1, 0x9385, 0x754d, + 0x754a, 0x7567, 0x756e, 0xe2c7, 0x3f04, 0xe2c9, 0x758e, 0x745d, + 0x759e, 0x75b4, 0x7602, 0x762c, 0x7651, 0x764f, 0x766f, 0x7676, + 0xe2d4, 0x7690, 0x81ef, 0x37f8, 0xe2d8, 0xe2d9, 0x76a1, 0x76a5, + 0x76b7, 0x76cc, 0xe2de, 0x8462, 0xe2e0, 0xe2e1, 0xe2e2, 0x771e, + 0x7726, 0x7740, 0x64af, 0xe2e7, 0x7758, 0xe2e9, 0x77af, 0xe2eb, + 0xe2ec, 0xe2ed, 0x77f4, 0x7809, 0xe2f0, 0xe2f1, 0x68ca, 0x78af, + 0x78c7, 0x78d3, 0x96a5, 0x792e, 0xe2f8, 0x78d7, 0x7934, 0x78b1, + 0xe2fc, 0x8fb8, 0x8884, 0xe2ff, 0xe300, 0xe301, 0x7986, 0x8900, + 0x6902, 0x7980, 0xe306, 0x799d, 0xe308, 0x793c, 0x79a9, 0x6e2a, + 0xe30c, 0x3ea8, 0x79c6, 0xe30f, 0x79d4, +}; + +static int +big5hkscs_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = s[0]; + if ((c1 >= 0x81 && c1 <= 0xfe)) { + if (n >= 2) { + unsigned char c2 = s[1]; + if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0xa1 && c2 < 0xff)) { + unsigned int i = 157 * (c1 - 0x81) + (c2 - (c2 >= 0xa1 ? 0x62 : 0x40)); + unsigned short wc = 0xfffd; + { + if (i < 19782) + wc = big5hkscs_2uni_page81[i]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short big5hkscs_2charset[23202] = { + 0xa246, 0xa247, 0xa244, 0xa1b1, 0xc6d8, 0xa1c2, 0xa258, 0xa1d3, + 0xa1a6, 0xa367, 0xa150, 0xa14d, 0x8859, 0x8857, 0x885d, 0x885b, + 0x8866, 0x8861, 0x885f, 0xa1d1, 0x886a, 0x8868, 0x886f, 0x886d, + 0x88a7, 0x8873, 0x8871, 0x8877, 0x8875, 0xa1d2, 0xc8fb, 0x887b, + 0x8879, 0x88a2, 0x8856, 0x8867, 0x885a, 0x886c, 0x885c, 0x886e, + 0x8870, 0xc8fc, 0x885e, 0x8874, 0xc8fa, 0x8878, 0x8858, 0x8869, + 0x8872, 0x8860, 0x8876, 0x887a, 0x887c, 0x887d, 0x887e, 0x88a1, + 0xc8f6, 0x886b, 0xc8f8, 0xc8f7, 0x88a8, 0xc8fe, 0xc8f9, 0xc8f5, + 0xc8fd, 0xc6d9, 0xa3be, 0xa3bc, 0xa3bd, 0xa3bf, 0xa1c5, 0xa3bb, + 0xa1c2, 0xa344, 0xa345, 0xa346, 0xa347, 0xa348, 0xa349, 0xa34a, + 0xa34b, 0xa34c, 0xa34d, 0xa34e, 0xa34f, 0xa350, 0xa351, 0xa352, + 0xa353, 0xa354, 0xa355, 0xa356, 0xa357, 0xa358, 0xa359, 0xa35a, + 0xa35b, 0xa35c, 0xa35d, 0xa35e, 0xa35f, 0xa360, 0xa361, 0xa362, + 0xa363, 0xa364, 0xa365, 0xa366, 0xa367, 0xa368, 0xa369, 0xa36a, + 0xa36b, 0xa36c, 0xa36d, 0xa36e, 0xa36f, 0xa370, 0xa371, 0xa372, + 0xa373, 0xc7f9, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, 0xc7f7, 0xc7f8, + 0xc7fa, 0xc7fb, 0xc7fc, 0xc7fd, 0xc7fe, 0xc840, 0xc841, 0xc842, + 0xc843, 0xc844, 0xc845, 0xc846, 0xc847, 0xc848, 0xc849, 0xc84a, + 0xc84b, 0xc84c, 0xc84d, 0xc84e, 0xc84f, 0xc850, 0xc851, 0xc852, + 0xc853, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, 0xc85a, + 0xc85c, 0xc85d, 0xc85e, 0xc85f, 0xc860, 0xc861, 0xc862, 0xc863, + 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, 0xc86a, 0xc86b, + 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, 0xc871, 0xc872, 0xc873, + 0xc874, 0xc875, 0xc85b, 0x8863, 0x88a4, 0x8865, 0x88a6, 0xa156, + 0xa158, 0xa277, 0xa1fc, 0xa1a5, 0xa1a6, 0xa1a7, 0xa1a8, 0xa145, + 0xa3bb, 0xa14c, 0xa14b, 0xa145, 0xa1ac, 0xa1b2, 0xa1ab, 0xa1b0, + 0xa1c3, 0xa24a, 0xa1c1, 0xa24b, 0xc8d2, 0xc8d3, 0xa2b9, 0xa2ba, + 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, 0xa2c1, 0xa2c2, + 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, 0xc6bc, + 0xc6bd, 0xc6be, 0xa1f6, 0xa1f4, 0xa1f7, 0xa1f5, 0xa1f8, 0xa1f9, + 0xa1fb, 0xa1fa, 0xc877, 0xc878, 0xc876, 0xa241, 0xa242, 0xa258, + 0xa1d4, 0xa1db, 0xa1e8, 0xa1e7, 0xa1fd, 0xa1fc, 0xa1e4, 0xa1e5, + 0xa1ec, 0xa1ed, 0xa1ef, 0xa1ee, 0xa1dc, 0xa1da, 0xa1dd, 0xa1dd, + 0xa1d8, 0xa1d9, 0xa1f2, 0xa1f3, 0xa1e6, 0xa1e9, 0xa15b, 0xc6a1, + 0xc6a2, 0xc6a3, 0xc6a4, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, + 0xc6aa, 0xc6ab, 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, + 0xc6b2, 0xc6b3, 0xc6b4, 0xa277, 0xa278, 0xa27a, 0xa27b, 0xa27c, + 0xa27d, 0xa275, 0xa274, 0xa273, 0xa272, 0xa271, 0xf9f9, 0xf9f8, + 0xf9e6, 0xf9ef, 0xf9dd, 0xf9e8, 0xf9f1, 0xf9df, 0xf9ec, 0xf9f5, + 0xf9e3, 0xf9ee, 0xf9f7, 0xf9e5, 0xf9e9, 0xf9f2, 0xf9e0, 0xf9eb, + 0xf9f4, 0xf9e2, 0xf9e7, 0xf9f0, 0xf9de, 0xf9ed, 0xf9f6, 0xf9e4, + 0xf9ea, 0xf9f3, 0xf9e1, 0xf9fa, 0xf9fb, 0xf9fd, 0xf9fc, 0xa2ac, + 0xa2ad, 0xa2ae, 0xa15a, 0xa262, 0xa263, 0xa264, 0xa265, 0xa266, + 0xa267, 0xa268, 0xa269, 0xa270, 0xa26f, 0xa26e, 0xa26d, 0xa26c, + 0xa26b, 0xa26a, 0xf9fe, 0xa276, 0xa279, 0xa1bd, 0xa1bc, 0xa1b6, + 0xa1b5, 0xa1bf, 0xa1be, 0xa1bb, 0xa1ba, 0xa1b3, 0xa1b7, 0xa1b4, + 0xa2a8, 0xa2a9, 0xa2ab, 0xa2aa, 0xa1b9, 0xa1b8, 0xa1f3, 0xa1f0, + 0xa1f2, 0xa1f1, 0xc6e6, 0xc8d6, 0xc8d7, 0xc8d8, 0xc8d9, 0xc8da, + 0xc8db, 0xc8dc, 0xc8dd, 0xc8de, 0xc8df, 0xc8e0, 0xc8e1, 0xc8e2, + 0xc8e3, 0xc8e4, 0xc8e5, 0xc8e6, 0xc8e7, 0xc8e8, 0xc8e9, 0xc8ea, + 0xc8eb, 0xc8ec, 0xc8ed, 0xc8ee, 0xc8ef, 0xc8f0, 0xc8f1, 0xc6cd, + 0xa140, 0xa142, 0xa143, 0xa1b2, 0xc6e0, 0xc6e1, 0xc6e2, 0xa171, + 0xa172, 0xa16d, 0xa16e, 0xa175, 0xa176, 0xa179, 0xa17a, 0xa169, + 0xa16a, 0xa245, 0xa165, 0xa166, 0xa1e3, 0xa1a9, 0xa1aa, 0xa2c3, + 0xa2c4, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, 0xa2c9, 0xa2ca, 0xa2cb, + 0xa1ca, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, 0xc6ec, 0xc6ed, + 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, 0xc6f4, 0xc6f5, + 0xc6f6, 0xc6f7, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, 0xc6fc, 0xc6fd, + 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, 0xc745, 0xc746, + 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, 0xc74d, 0xc74e, + 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, + 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, 0xc75d, 0xc75e, + 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, 0xc765, 0xc766, + 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, 0xc76d, 0xc76e, + 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, 0xc775, 0xc776, + 0xc777, 0xc778, 0xc779, 0xc77a, 0xc8d4, 0xc8d5, 0xc6dc, 0xc6dd, + 0xc77b, 0xc77c, 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, + 0xc7a5, 0xc7a6, 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, + 0xc7ad, 0xc7ae, 0xc7af, 0xc7b0, 0xc7b1, 0xc7b2, 0xc7b3, 0xc7b4, + 0xc7b5, 0xc7b6, 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, + 0xc7bd, 0xc7be, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, + 0xc7c5, 0xc7c6, 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, + 0xc7cd, 0xc7ce, 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, + 0xc7d5, 0xc7d6, 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, + 0xc7dd, 0xc7de, 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, + 0xc7e5, 0xc7e6, 0xc7e7, 0xc7e8, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, + 0xc7ed, 0xc7ee, 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc6e3, 0xc6da, + 0xc6db, 0xa374, 0xa375, 0xa376, 0xa377, 0xa378, 0xa379, 0xa37a, + 0xa37b, 0xa37c, 0xa37d, 0xa37e, 0xa3a1, 0xa3a2, 0xa3a3, 0xa3a4, + 0xa3a5, 0xa3a6, 0xa3a7, 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, + 0xa3ad, 0xa3ae, 0xa3af, 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, + 0xa3b5, 0xa3b6, 0xa3b7, 0xa3b8, 0xa3b9, 0xa3ba, 0xa440, 0xa447, + 0xa454, 0xa57c, 0xa457, 0xa4a4, 0xa455, 0xa5d2, 0xa441, 0xa4fe, + 0xa442, 0xa4d1, 0xa661, 0xa448, 0xa440, 0xa447, 0xa454, 0xa57c, + 0xa4ad, 0xa4bb, 0xa443, 0xa44b, 0xa445, 0xa451, 0xa4eb, 0xa4f5, + 0xa4f4, 0xa4ec, 0xaaf7, 0xa467, 0xa4e9, 0xc8d1, 0xa6b3, 0xaac0, + 0xa657, 0xaf53, 0xb05d, 0xafac, 0xb3d2, 0xa54e, 0xa949, 0xbec7, + 0xbaca, 0xa5f8, 0xb8ea, 0xa8f3, 0xb2bd, 0xa5f0, 0xa6db, 0xa6dc, + 0xa440, 0xa447, 0xa454, 0xa57c, 0xa4ad, 0xa4bb, 0xa443, 0xa44b, + 0xa445, 0xa451, 0xa4eb, 0xa4f5, 0xa4f4, 0xa4ec, 0xaaf7, 0xa467, + 0xa4e9, 0xaee8, 0xa6b3, 0xaac0, 0xa657, 0xaf53, 0xb05d, 0xafac, + 0xb3d2, 0xafb5, 0xa86b, 0xa46b, 0xbe41, 0xc075, 0xa64c, 0xaa60, + 0xb6b5, 0xa5f0, 0xbc67, 0xa1c0, 0xa457, 0xa4a4, 0xa455, 0xa5aa, + 0xa56b, 0xc2e5, 0xa976, 0xbec7, 0xbaca, 0xa5f8, 0xb8ea, 0xa8f3, + 0xa95d, 0xa255, 0xa256, 0xa250, 0xa251, 0xa252, 0xa254, 0xa257, + 0xa253, 0xa1eb, 0xa1ea, 0xa24f, 0x9277, 0x96df, 0x89d5, 0x93cd, + 0x9bdf, 0xfa68, 0x89da, 0x8f59, 0x89db, 0x8f5d, 0x89dc, 0x96f7, + 0x8ada, 0x8bdc, 0x97db, 0x9e53, 0x9daa, 0x9bea, 0x8a6e, 0x8bc8, + 0x89e8, 0x89ea, 0x8c4b, 0xfb70, 0x89ed, 0x94dd, 0x89ee, 0x9eb4, + 0x8ad3, 0x92db, 0x94db, 0x89f9, 0xfb7a, 0x89fb, 0x9efc, 0x89fc, + 0x89bf, 0x89fe, 0x89e6, 0x9d46, 0x9dee, 0xa07e, 0xa068, 0x98e9, + 0x8b68, 0x8dfd, 0x8bbe, 0x9fd9, 0x8aeb, 0x9fd7, 0x8b6a, 0x9c5c, + 0x8bb1, 0xfb5e, 0x9df3, 0xa0d0, 0xfc66, 0x92e9, 0x9aec, 0x8fab, + 0xfa48, 0x8e45, 0x9c6f, 0x9ede, 0x89ef, 0x96e9, 0x9ebb, 0x94de, + 0x9eb8, 0x97ba, 0xfb65, 0x95d6, 0x9cbb, 0x97da, 0x8f45, 0xfb7d, + 0x9158, 0xfe64, 0x9856, 0x9b4d, 0x935b, 0x95c7, 0x97e7, 0x9359, + 0x91f5, 0x97b8, 0xfda2, 0xfbb6, 0x92fa, 0x9357, 0x8ba6, 0xfbb9, + 0x97b0, 0xfdc4, 0x9ca1, 0x91f2, 0x91f9, 0x8ff1, 0x9745, 0x9853, + 0xfe78, 0xfbc1, 0x9251, 0x9dad, 0xfd6c, 0xfa6b, 0x9bc2, 0x9a7b, + 0x8b60, 0x934b, 0x9abd, 0x91b7, 0x95b4, 0xfec5, 0x9ef0, 0x8d64, + 0x9269, 0x8d67, 0xfbea, 0xfbef, 0x8d68, 0x93eb, 0xfc42, 0x9166, + 0xfacd, 0x93dd, 0x8bcc, 0x8d6d, 0x8d6e, 0x96a8, 0xfca6, 0x8d6f, + 0x8d70, 0xfc64, 0x9060, 0x8d74, 0x97c3, 0x8ad0, 0x9274, 0x9bbe, + 0x9cc8, 0x9cba, 0x8d78, 0x9eb9, 0x955a, 0x91b4, 0x8a48, 0x8d7d, + 0x8a7d, 0x8ac2, 0xfd4a, 0x8da1, 0x8ad1, 0xfcb4, 0x8b47, 0x93a4, + 0x9eda, 0x8a51, 0x8da6, 0x9ec5, 0xfcc4, 0xa078, 0x94b5, 0xfcc2, + 0x8a6b, 0x8dab, 0xfae8, 0x8dad, 0xfc49, 0x93c1, 0x906f, 0x8db0, + 0x947e, 0x90fa, 0x9479, 0x8db2, 0xfcee, 0x997b, 0x8db4, 0x8db7, + 0x91b3, 0x8dbb, 0x8dba, 0x8dbc, 0x9044, 0xfd4c, 0x93e4, 0x93e0, + 0xfd53, 0x8dc3, 0x9bb8, 0xfbf0, 0x93e9, 0x93f6, 0x8dc5, 0x8dca, + 0x8dcc, 0xfd5d, 0x93b5, 0xfd61, 0x9cf8, 0x9252, 0xa0e8, 0x9ca5, + 0x8c56, 0x8dd6, 0x97c0, 0xa0de, 0x97d2, 0xfaa5, 0xfda3, 0x8ddb, + 0x8eaf, 0x91b5, 0xfd49, 0xfdd1, 0x8deb, 0x97c6, 0xfdce, 0x90fc, + 0xfc59, 0x96d6, 0x97c5, 0x8def, 0x97d7, 0x8df0, 0x96a6, 0xfbbf, + 0x8df3, 0x9449, 0x8df5, 0x9872, 0x8e6b, 0xfafd, 0x8f50, 0x9dcc, + 0xfc65, 0x8c44, 0x996e, 0x94a1, 0x8f63, 0xa0da, 0x9253, 0xfde9, + 0x9db5, 0x9879, 0x9d5d, 0x8d63, 0x9669, 0x9f70, 0xfc6a, 0x8ac7, + 0x89d7, 0xfe4d, 0x9edd, 0xfefb, 0x98bc, 0xfacc, 0x95b0, 0x9464, + 0x936f, 0x94b9, 0x95ec, 0x91ee, 0x98c3, 0x95f6, 0x8ffd, 0x98c5, + 0x9766, 0xfe6e, 0x97dd, 0x8caa, 0x92d2, 0x9761, 0x98cb, 0x95f0, + 0x975d, 0x91e3, 0x98cc, 0x9469, 0x98cd, 0x98ce, 0x95fc, 0x94a3, + 0x9662, 0xfeb6, 0x9463, 0x98d0, 0x98d1, 0x9475, 0xfae0, 0x9472, + 0x98d6, 0x8af0, 0x98d9, 0x98db, 0x98dd, 0x98a8, 0x8a6d, 0x8afb, + 0x8aae, 0xfbc9, 0x8c5d, 0x98e4, 0x98e6, 0x98e8, 0x8a4d, 0x9257, + 0x95df, 0xa0ac, 0x98eb, 0x98ec, 0x8cc3, 0x98f4, 0x8ab8, 0x9ee7, + 0x94bc, 0xfcd1, 0x9cc6, 0x9e7e, 0x98fe, 0xfde8, 0x9940, 0x94c9, + 0x94d3, 0x9946, 0x90c0, 0x94d1, 0x9573, 0x93c2, 0x9948, 0x994b, + 0x8e55, 0x994e, 0x8efe, 0x8e59, 0x94ec, 0x94ef, 0x8c60, 0x8f74, + 0x9955, 0x9544, 0x8ccb, 0x9956, 0x9959, 0x995b, 0x8cc4, 0xfa45, + 0x90b7, 0x9743, 0x95cd, 0x97c9, 0xfd50, 0x8eb9, 0x95c6, 0x9967, + 0x8ab9, 0x8dfc, 0x8a76, 0x9d51, 0x9973, 0x9d4f, 0x997a, 0x9564, + 0x99a1, 0x99a5, 0x99a7, 0x8eed, 0x99ad, 0x946e, 0x8f70, 0xfad0, + 0x99b3, 0xa053, 0x965c, 0xfd7a, 0x97fe, 0x92bd, 0x97fd, 0x8f64, + 0xfcf7, 0x9562, 0x97cd, 0x9e64, 0x924c, 0x8ec9, 0x99bc, 0x9da5, + 0x8f54, 0x8f7c, 0x8ea2, 0x8f7a, 0x97ae, 0x96c8, 0x99c3, 0x90d6, + 0x9cbe, 0x8f76, 0x9470, 0xfb4b, 0xfdca, 0x8ec7, 0xa0f9, 0x8fa9, + 0x99c7, 0x90d7, 0x9edf, 0x99ce, 0x8fba, 0x8feb, 0x99cf, 0x8fc2, + 0x92c9, 0x97dc, 0x95b3, 0x9c79, 0x95b2, 0x8fdb, 0x9be3, 0x9e7a, + 0x9bee, 0x99de, 0xfafa, 0x9ee5, 0x8a52, 0x99e1, 0x8a67, 0x8bb5, + 0x8aac, 0x99e9, 0xfbca, 0x97de, 0x95d1, 0x99f5, 0xfc4a, 0x9ba9, + 0xfbdc, 0xfe56, 0x9ea4, 0x9d49, 0x95db, 0x89c5, 0x99f8, 0x9664, + 0x9055, 0x96d4, 0x977c, 0x964d, 0x97e1, 0x9a48, 0x9a49, 0xfe7d, + 0x90aa, 0x9a50, 0x9347, 0x8ed8, 0x90c9, 0x9a55, 0x90bc, 0x9a58, + 0x8bb8, 0x90d5, 0x9641, 0x9a5a, 0x9a5c, 0x97c2, 0x8abb, 0x9baa, + 0x90f5, 0x9a60, 0x9145, 0x8c58, 0x9a63, 0x8c49, 0x8bb6, 0xfccf, + 0x966b, 0x9a6e, 0x914f, 0x9746, 0xa0e6, 0x92d7, 0x9675, 0x93d4, + 0x91bb, 0x9679, 0x9a70, 0x9678, 0x91cd, 0x9c4a, 0xa06f, 0xa06a, + 0x915f, 0x9fa5, 0x89ba, 0x9ecd, 0x9a79, 0x9dce, 0x8cd2, 0x9d73, + 0x96b9, 0x96bc, 0x9cd1, 0x89b7, 0x9eee, 0xfb43, 0x9ec9, 0xfbd3, + 0x91ae, 0x9d78, 0x9d7b, 0xa440, 0xa442, 0xa443, 0x9eb3, 0xc945, + 0xa456, 0xa454, 0xa457, 0xa455, 0xc946, 0xa4a3, 0xc94f, 0xc94d, + 0xa4a2, 0xa4a1, 0xa542, 0xa541, 0xa540, 0xa543, 0xa4fe, 0x9eb2, + 0x9dd6, 0xa5e0, 0xa5e1, 0x994f, 0x89ce, 0xa8c3, 0x8bc0, 0x9fc4, + 0xa458, 0x8bd4, 0xa4a4, 0xc950, 0x8c72, 0xa4a5, 0xc963, 0xa6ea, + 0xcbb1, 0xc6bf, 0x8bf9, 0xa459, 0xa4a6, 0xa544, 0xc964, 0x8946, + 0xc6c0, 0xc940, 0xa444, 0xa45b, 0xc947, 0xa45c, 0xfae5, 0xa4a7, + 0xa545, 0xa547, 0xa546, 0xa5e2, 0xa5e3, 0xa8c4, 0xadbc, 0xa441, + 0xc87b, 0x8bc6, 0xc941, 0xa445, 0xa45e, 0xa45d, 0xa5e4, 0x9c57, + 0xa8c5, 0x9afb, 0xb0ae, 0xd44b, 0x89d0, 0x89cf, 0xb6c3, 0xdcb1, + 0xdcb2, 0xc6c1, 0xa446, 0x89d1, 0xa4a9, 0x89e2, 0xa8c6, 0xa447, + 0xc948, 0xa45f, 0xa4aa, 0xa4ac, 0xc951, 0xa4ad, 0xa4ab, 0x927e, + 0xa5e5, 0x9dba, 0xa8c7, 0xa8c8, 0xab45, 0xc6c2, 0xa460, 0xa4ae, + 0x8c6f, 0xa5e6, 0xa5e8, 0xa5e7, 0xa6eb, 0xa8c9, 0xa8ca, 0xab46, + 0xab47, 0xadbd, 0xdcb3, 0xfbf8, 0xf6d6, 0xa448, 0x8bc7, 0x926b, + 0x89d2, 0xa4b0, 0xa4af, 0xc952, 0xa4b1, 0xa4b7, 0xa4b2, 0xa4b3, + 0xc954, 0xc953, 0xa4b5, 0xa4b6, 0xa4b4, 0x9fcf, 0xa54a, 0xa54b, + 0xa54c, 0xa54d, 0xa549, 0xa550, 0xc96a, 0xc966, 0xc969, 0xa551, + 0xa561, 0xc968, 0xa54e, 0xa54f, 0xa548, 0xc965, 0xc967, 0x9da9, + 0x89d3, 0x99e2, 0xa5f5, 0xc9b0, 0xa5f2, 0xa5f6, 0xc9ba, 0xc9ae, + 0xa5f3, 0xc9b2, 0x9267, 0xa5f4, 0xa5f7, 0xa5e9, 0xc9b1, 0xa5f8, + 0xc9b5, 0x92a4, 0xc9b9, 0xc9b6, 0xc9b3, 0xa5ea, 0xa5ec, 0xa5f9, + 0xa5ee, 0xc9ab, 0xa5f1, 0xa5ef, 0xa5f0, 0xc9bb, 0xc9b8, 0xc9af, + 0xa5ed, 0x8c73, 0xc9ac, 0xa5eb, 0x894e, 0xc9b4, 0xc9b7, 0x894f, + 0x9278, 0xc9ad, 0xca66, 0xa742, 0xa6f4, 0x91b6, 0xca67, 0xa6f1, + 0xa744, 0x89d4, 0xa6f9, 0x9fd2, 0xa6f8, 0xca5b, 0xa6fc, 0xa6f7, + 0xca60, 0xca68, 0xca64, 0x92a7, 0xa6fa, 0x95a2, 0xa6fd, 0xa6ee, + 0xa747, 0xca5d, 0x926e, 0xcbbd, 0xa6ec, 0xa743, 0xa6ed, 0xa6f5, + 0xa6f6, 0xca62, 0xca5e, 0xa6fb, 0xa6f3, 0xca5a, 0xa6ef, 0xca65, + 0xa745, 0xa748, 0xa6f2, 0xa740, 0xa746, 0xa6f0, 0xca63, 0xa741, + 0xca69, 0xca5c, 0xa6fe, 0xca5f, 0xca61, 0xa8d8, 0xcbbf, 0xcbcb, + 0xa8d0, 0xcbcc, 0xa8cb, 0xa8d5, 0x96ea, 0xa8ce, 0xcbb9, 0xa8d6, + 0xcbb8, 0xcbbc, 0xcbc3, 0xcbc1, 0xa8de, 0xa8d9, 0xcbb3, 0xcbb5, + 0xa8db, 0xa8cf, 0xcbb6, 0xcbc2, 0xcbc9, 0xa8d4, 0xcbbb, 0xcbb4, + 0xa8d3, 0xcbb7, 0xa8d7, 0xcbba, 0x926f, 0xa8d2, 0xa8cd, 0xa8dc, + 0xcbc4, 0xa8dd, 0xcbc8, 0xcbc6, 0xcbca, 0xa8da, 0xcbbe, 0xcbb2, + 0xcbc0, 0xa8d1, 0xcbc5, 0xa8cc, 0xcbc7, 0x92a3, 0x8950, 0xfa57, + 0xab56, 0xab4a, 0x9866, 0xcde0, 0xcde8, 0xab49, 0xab51, 0xab5d, + 0xcdee, 0xcdec, 0xcde7, 0x89d6, 0xab4b, 0xcded, 0xcde3, 0xab59, + 0xab50, 0xab58, 0xcdde, 0xcdea, 0x98b2, 0xcde1, 0xab54, 0xcde2, + 0x92ab, 0xcddd, 0xab5b, 0xab4e, 0xab57, 0xab4d, 0xcddf, 0xcde4, + 0xcdeb, 0xab55, 0xab52, 0xcde6, 0xab5a, 0xcde9, 0xcde5, 0xab4f, + 0xab5c, 0xab53, 0xab4c, 0xab48, 0x96de, 0x92ac, 0xcdef, 0xadd7, + 0xadc1, 0x8c70, 0xadd1, 0x9f6e, 0xadd6, 0xd0d0, 0xd0cf, 0xd0d4, + 0xd0d5, 0xadc4, 0x8ef2, 0xadcd, 0x9f6c, 0xadda, 0xadce, 0x89d8, + 0xd0c9, 0xadc7, 0xd0ca, 0xfa59, 0xaddc, 0xadd3, 0xadbe, 0xadbf, + 0xd0dd, 0xb0bf, 0xadcc, 0xadcb, 0xd0cb, 0xadcf, 0xd45b, 0xadc6, + 0xd0d6, 0xadd5, 0xadd4, 0xadca, 0xd0ce, 0xd0d7, 0xd0c8, 0xadc9, + 0xd0d8, 0xadd2, 0xd0cc, 0xadc0, 0xadc3, 0xadc2, 0xd0d9, 0xadd0, + 0xadc5, 0xadd9, 0xaddb, 0xd0d3, 0xadd8, 0x92a8, 0xd0db, 0xd0cd, + 0xd0dc, 0xd0d1, 0x9163, 0xd0da, 0xd0d2, 0x8c40, 0xadc8, 0xd463, + 0xd457, 0xb0b3, 0xd45c, 0xd462, 0xb0b2, 0xd455, 0xb0b6, 0xd459, + 0xd452, 0xb0b4, 0xd456, 0xb0b9, 0xb0be, 0xd467, 0xd451, 0xb0ba, + 0x9f73, 0xd466, 0x92ad, 0xb0b5, 0xd458, 0xb0b1, 0xd453, 0xd44f, + 0xd45d, 0xd450, 0xd44e, 0xd45a, 0xd460, 0xd461, 0xb0b7, 0x9be9, + 0xd85b, 0xd45e, 0xd44d, 0xd45f, 0x92a9, 0xb0c1, 0xd464, 0xb0c0, + 0xd44c, 0xd454, 0xd465, 0xb0bc, 0xb0bb, 0xb0b8, 0xb0bd, 0xb0af, + 0xb0b0, 0xb3c8, 0x92aa, 0xd85e, 0xd857, 0xb3c5, 0xd85f, 0x89d9, + 0xd855, 0xd858, 0xb3c4, 0xd859, 0xfd56, 0xb3c7, 0xd85d, 0xd853, + 0xd852, 0xb3c9, 0xb3ca, 0xb3c6, 0xb3cb, 0xd851, 0xd85c, 0xd85a, + 0xd854, 0xb3c3, 0xd856, 0x9fa8, 0xb6ca, 0xb6c4, 0xdcb7, 0xb6cd, + 0xdcbd, 0xdcc0, 0xb6c6, 0xb6c7, 0xdcba, 0xb6c5, 0xdcc3, 0xb6cb, + 0xdcc4, 0xdcbf, 0xb6cc, 0x8c71, 0xdcb4, 0xb6c9, 0xdcb5, 0xdcbe, + 0xdcbc, 0xdcb8, 0xb6c8, 0xdcb6, 0xb6ce, 0xdcbb, 0xdcc2, 0xdcb9, + 0xdcc1, 0x92a1, 0xb9b6, 0xb9b3, 0x90e3, 0xb9b4, 0xe0f9, 0xe0f1, + 0xb9b2, 0xb9af, 0xe0f2, 0xa0a6, 0xb9b1, 0xe0f5, 0xe0f7, 0x94ab, + 0xe0fe, 0xfc72, 0xe0fd, 0xe0f8, 0xb9ae, 0xe0f0, 0xb9ac, 0xe0f3, + 0xb9b7, 0xe0f6, 0xe0fa, 0xb9b0, 0xb9ad, 0xe0fc, 0xe0fb, 0xb9b5, + 0xe0f4, 0x97c4, 0xbbf8, 0xe4ec, 0xe4e9, 0xbbf9, 0xbbf7, 0x92ae, + 0xe4f0, 0xe4ed, 0xe4e6, 0xbbf6, 0xfa67, 0xbbfa, 0xe4e7, 0xbbf5, + 0xbbfd, 0xe4ea, 0xe4eb, 0xbbfb, 0xbbfc, 0xe4f1, 0xe4ee, 0xe4ef, + 0x92a2, 0xfa69, 0xbeaa, 0xe8f8, 0xbea7, 0xe8f5, 0xbea9, 0xbeab, + 0xe8f6, 0xbea8, 0xe8f7, 0xe8f4, 0xc076, 0xecbd, 0xc077, 0xecbb, + 0xecbc, 0xecba, 0xecb9, 0xecbe, 0xc075, 0x9268, 0xefb8, 0xefb9, + 0xe4e8, 0xefb7, 0xc078, 0xc35f, 0xf1eb, 0xf1ec, 0xc4d7, 0xc4d8, + 0xf5c1, 0xf5c0, 0xc56c, 0xc56b, 0xf7d0, 0xa449, 0xa461, 0xa4b9, + 0xa4b8, 0xa553, 0xa552, 0xa5fc, 0xa5fb, 0xa5fd, 0xa5fa, 0xa74a, + 0xa749, 0xa74b, 0xa8e0, 0xa8df, 0xa8e1, 0x8951, 0xab5e, 0xa259, + 0xd0de, 0xa25a, 0xb0c2, 0xa25c, 0xa25b, 0xd860, 0xfa6f, 0xa25d, + 0xb9b8, 0xa25e, 0xa44a, 0xa4ba, 0xa5fe, 0xa8e2, 0xfa71, 0xa44b, + 0xa4bd, 0xa4bb, 0xa4bc, 0xa640, 0x8952, 0xa74c, 0xa8e4, 0xa8e3, + 0xa8e5, 0x945a, 0xaddd, 0xbeac, 0xc6c3, 0x89dd, 0xc94e, 0xc8a2, + 0xa554, 0xa555, 0xa641, 0xca6a, 0xab60, 0xab5f, 0xd0e0, 0xd0df, + 0xb0c3, 0xc6c4, 0xa4be, 0xc955, 0x9e52, 0x8953, 0xcbcd, 0xab61, + 0xade0, 0xadde, 0xaddf, 0x9e55, 0x92ba, 0xbead, 0xc6c5, 0xa556, + 0x8c5b, 0xa642, 0xc9bc, 0xfa7d, 0xfaa8, 0x9a68, 0xfa47, 0xa74d, + 0xa74e, 0xfa7e, 0xca6b, 0xcbce, 0xa8e6, 0xcbcf, 0x92bb, 0xd0e2, + 0xd0e3, 0xade3, 0xfdb6, 0xd0e4, 0xfaa2, 0xd0e1, 0xade4, 0xade2, + 0xade1, 0xd0e5, 0xfaa3, 0xd468, 0xfaa4, 0x9bb4, 0xfaa6, 0xd861, + 0xdcc5, 0xe140, 0x89df, 0xbbfe, 0xbeae, 0xe8f9, 0xfddb, 0xa44c, + 0xa45a, 0xfaa9, 0x8954, 0xfaab, 0xb0c4, 0xb3cd, 0xb9b9, 0xfc7a, + 0xc942, 0xa4bf, 0xa559, 0xa557, 0xa558, 0x89e0, 0xa8e7, 0x9f4f, + 0xa44d, 0xa44e, 0xc87d, 0xa462, 0x89e1, 0xa4c0, 0xa4c1, 0xa4c2, + 0xc9be, 0xa55a, 0xfab0, 0xc96b, 0xa646, 0xc9bf, 0xa644, 0xa645, + 0xc9bd, 0xa647, 0xa643, 0xca6c, 0xaaec, 0xca6d, 0x9fcd, 0xa0e7, + 0xca6e, 0xa750, 0xa74f, 0xfab1, 0x89a6, 0xa753, 0xa751, 0xa752, + 0xa8ed, 0xa8ec, 0xcbd4, 0xcbd1, 0xcbd2, 0x9efa, 0xcbd0, 0xa8ee, + 0xa8ea, 0xa8e9, 0xa8eb, 0xa8e8, 0xfab2, 0xa8ef, 0xab63, 0xcdf0, + 0xcbd3, 0xab68, 0xcdf1, 0xab64, 0xab67, 0xab66, 0xab65, 0xab62, + 0xd0e8, 0xade7, 0xd0eb, 0xade5, 0xfab4, 0x92c4, 0xd0e7, 0xade8, + 0xade6, 0xade9, 0xd0e9, 0xd0ea, 0x9f6f, 0xd0e6, 0xd0ec, 0x8bb0, + 0xb3d1, 0xb0c5, 0xd469, 0xd46b, 0xd46a, 0xd46c, 0xb0c6, 0xb3ce, + 0x9fac, 0xb3cf, 0xb3d0, 0xb6d0, 0xdcc7, 0x89e3, 0xdcc6, 0xdcc8, + 0xdcc9, 0xb6d1, 0xb6cf, 0xe141, 0xe142, 0xb9bb, 0xb9ba, 0xe35a, + 0xbc40, 0xbc41, 0xbc42, 0xbc44, 0xe4f2, 0xe4f3, 0xbc43, 0x9bd3, + 0x89e4, 0xbeaf, 0xbeb0, 0xfab5, 0xf1ed, 0xf5c3, 0xf5c2, 0xf7d1, + 0x9fd5, 0xa44f, 0xa55c, 0xa55b, 0x8955, 0xa648, 0x92c5, 0xc9c0, + 0x8956, 0xa755, 0xa756, 0xa754, 0xa757, 0xca6f, 0xca70, 0xfab3, + 0xfab6, 0xa8f1, 0xcbd5, 0xa8f0, 0xcdf2, 0xab6c, 0xcdf3, 0xab6b, + 0xfab7, 0xab69, 0xab6a, 0x9edc, 0xd0ed, 0xfbc4, 0x9f71, 0xb0c7, + 0xd46e, 0xb0ca, 0xd46d, 0xb1e5, 0xb0c9, 0xb0c8, 0xb3d4, 0xb3d3, + 0xb3d2, 0xb6d2, 0xfaba, 0x92c7, 0xb6d5, 0xb6d6, 0xb6d4, 0xb6d3, + 0xe143, 0xe144, 0xe4f5, 0xbc45, 0xe4f4, 0xbeb1, 0xecbf, 0xc079, + 0xf1ee, 0xc455, 0xc6c6, 0xa463, 0xa4c3, 0xc956, 0xa4c4, 0xa4c5, + 0x9a4c, 0xa55d, 0xa55e, 0xa649, 0xca71, 0xcbd6, 0xcbd7, 0xab6d, + 0xd0ee, 0xb0cc, 0xb0cb, 0xd863, 0xd862, 0xa450, 0xa4c6, 0xa55f, + 0xb0cd, 0xc943, 0xc96c, 0xa560, 0xc9c2, 0xa64b, 0xa64a, 0xc9c1, + 0xa758, 0x8c68, 0x89e5, 0xadea, 0x9f7d, 0xd46f, 0xb6d7, 0xe145, + 0xb9bc, 0xa0a9, 0xfac4, 0xe8fa, 0xf3fd, 0xc6c7, 0xa4c7, 0x8957, + 0xcbd8, 0xcdf4, 0xb0d0, 0xb0ce, 0xb0cf, 0xa451, 0xfaaa, 0xa464, + 0xa2cd, 0xa4ca, 0xa4c9, 0xa4c8, 0xa563, 0xa562, 0xc96d, 0xc9c3, + 0x8958, 0xa8f5, 0xa8f2, 0xa8f4, 0xa8f3, 0xab6e, 0xb3d5, 0xa452, + 0x8be3, 0xa4cb, 0x8b61, 0xa565, 0xa564, 0xca72, 0x9af1, 0xa8f6, + 0x9eb7, 0xc6c8, 0xc957, 0xfad1, 0xa567, 0xa566, 0xa64c, 0xa64d, + 0xca73, 0xa759, 0xfad2, 0xa75a, 0xa8f7, 0xa8f8, 0xa8f9, 0xab6f, + 0xcdf5, 0x9eba, 0xfad4, 0xadeb, 0xc944, 0xa4cc, 0xc9c4, 0xca74, + 0xca75, 0xcbd9, 0xfad9, 0xcbda, 0xcdf7, 0xcdf6, 0xcdf9, 0xcdf8, + 0xab70, 0xd470, 0xaded, 0xd0ef, 0xadec, 0xfadb, 0x9ce0, 0xd864, + 0xb3d6, 0xfbf7, 0xd865, 0xfbfa, 0x89e7, 0xa07a, 0xfadc, 0xe146, + 0xb9bd, 0xfadd, 0x89e9, 0xbc46, 0xf1ef, 0xc6c9, 0xc958, 0xa568, + 0xfae2, 0x89eb, 0xb0d1, 0xfae3, 0xa453, 0xa465, 0xa4ce, 0xa4cd, + 0x90c8, 0xa4cf, 0x92da, 0x8959, 0x9cf5, 0xa8fb, 0xa8fa, 0xa8fc, + 0x895a, 0xfae7, 0x9fa2, 0xab71, 0xadee, 0xfaea, 0xe8fb, 0xc24f, + 0xa466, 0xa56a, 0xa579, 0xa574, 0xa56f, 0xa56e, 0xa575, 0xa573, + 0xa56c, 0xa57a, 0xa56d, 0xa569, 0xa578, 0xa577, 0xa576, 0xa56b, + 0xa572, 0xfaed, 0x8fad, 0xa571, 0xa57b, 0xa570, 0xfb59, 0xa653, + 0xa659, 0xa655, 0xa65b, 0xc9c5, 0xa658, 0xa64e, 0xa651, 0xa654, + 0xa650, 0xa657, 0xa65a, 0xa64f, 0xa652, 0xa656, 0xa65c, 0xfaef, + 0x96ef, 0x9dec, 0xca7e, 0xca7b, 0x9dca, 0xa767, 0xca7c, 0xa75b, + 0xa75d, 0xa775, 0xa770, 0xfd6d, 0x89ec, 0xcaa5, 0xca7d, 0xa75f, + 0xa761, 0xcaa4, 0xa768, 0xca78, 0xa774, 0xa776, 0xa75c, 0xa76d, + 0xfb44, 0xca76, 0xa773, 0x9de2, 0xa764, 0x8c75, 0xa76e, 0xa76f, + 0xca77, 0xa76c, 0xa76a, 0xa76b, 0xa771, 0xcaa1, 0xa75e, 0xa772, + 0xcaa3, 0xa766, 0xa763, 0xca7a, 0xa762, 0xcaa6, 0xa765, 0xa769, + 0x9ec0, 0x9e56, 0xa760, 0xcaa2, 0xca79, 0xcbeb, 0xcbea, 0xa94f, + 0xcbed, 0xcbef, 0xcbe4, 0xcbe7, 0xcbee, 0xa950, 0x9f79, 0x9ac7, + 0xcbe1, 0xcbe5, 0xfaf4, 0xcbe9, 0xce49, 0xa94b, 0xce4d, 0xa8fd, + 0xcbe6, 0xa8fe, 0xa94c, 0xa945, 0xa941, 0xcbe2, 0xa944, 0xa949, + 0xa952, 0xcbe3, 0xcbdc, 0xa943, 0xcbdd, 0xcbdf, 0xa946, 0x98a1, + 0xa948, 0xcbdb, 0xcbe0, 0xa951, 0xa94d, 0xcbe8, 0xa953, 0xfaf8, + 0xa94a, 0xcbde, 0xa947, 0x89f0, 0x9e47, 0xa942, 0xa940, 0x9df7, + 0xcbec, 0xa94e, 0x9fd3, 0x9aca, 0xce48, 0xcdfb, 0xce4b, 0x89f1, + 0xfaf9, 0xcdfd, 0xab78, 0xaba8, 0xab74, 0xaba7, 0xab7d, 0xaba4, + 0xab72, 0xcdfc, 0xce43, 0xaba3, 0xce4f, 0xaba5, 0x8e5a, 0xab79, + 0x89f2, 0xce45, 0xce42, 0xab77, 0x89f3, 0xcdfa, 0xaba6, 0xce4a, + 0xab7c, 0xce4c, 0xaba9, 0xab73, 0xab7e, 0xab7b, 0xce40, 0xaba1, + 0xce46, 0xce47, 0xab7a, 0xaba2, 0xab76, 0x925d, 0x8b51, 0x92e0, + 0xab75, 0xcdfe, 0x89f4, 0xce44, 0x9fd4, 0xce4e, 0xd144, 0xadfb, + 0xd0f1, 0x8a79, 0xd0f6, 0xadf4, 0xae40, 0xd0f4, 0xadef, 0xadf9, + 0xadfe, 0xd0fb, 0xadfa, 0xadfd, 0x89f5, 0xd0fe, 0xadf5, 0xd0f5, + 0xd142, 0xd143, 0xadf7, 0xd141, 0xadf3, 0xae43, 0xd0f8, 0xadf1, + 0x97a7, 0xd146, 0xd0f9, 0xd0fd, 0xadf6, 0xae42, 0xd0fa, 0xadfc, + 0xd140, 0xd147, 0xd4a1, 0x93ba, 0xd145, 0xae44, 0xadf0, 0xd0fc, + 0xd0f3, 0x9e58, 0xadf8, 0xd0f2, 0x89f6, 0xd0f7, 0x9e57, 0x89f7, + 0x8a41, 0xd0f0, 0xae41, 0x89f8, 0xd477, 0xfaf1, 0xb0e4, 0xd4a7, + 0xb0e2, 0xb0df, 0xd47c, 0xb0db, 0xd4a2, 0xb0e6, 0xd476, 0xd47b, + 0xd47a, 0xadf2, 0xb0e1, 0xd4a5, 0xd4a8, 0xd473, 0xb3e8, 0x89fa, + 0xd4a9, 0xb0e7, 0xb0d9, 0xb0d6, 0xd47e, 0xb0d3, 0xfb42, 0xd4a6, + 0xfabf, 0xb0da, 0xd4aa, 0xd474, 0xd4a4, 0xb0dd, 0xd475, 0xd478, + 0xd47d, 0xfba3, 0xb0de, 0xb0dc, 0xb0e8, 0xb0e3, 0xfaf7, 0xb0d7, + 0xb1d2, 0xb0d8, 0xd479, 0xb0e5, 0xb0e0, 0xd4a3, 0xb0d5, 0x9e4e, + 0xb0d4, 0x94dc, 0x95da, 0x9df8, 0x9f6a, 0xd471, 0xd472, 0xd86a, + 0x8ab7, 0xb3d7, 0xb3da, 0xd875, 0xb3ee, 0xd878, 0xb3d8, 0xd871, + 0xb3de, 0xb3e4, 0xb5bd, 0xfb46, 0xb3e2, 0xd86e, 0xb3ef, 0xb3db, + 0xb3e3, 0xd876, 0xdcd7, 0xd87b, 0xd86f, 0x8a46, 0xd866, 0xd873, + 0xd86d, 0xb3e1, 0xd879, 0xb3dd, 0xb3f1, 0xb3ea, 0xb3df, 0xb3dc, + 0xb3e7, 0xd87a, 0xd86c, 0xd872, 0xd874, 0xd868, 0xd877, 0xb3d9, + 0xd867, 0xfb47, 0xb3e0, 0xb3f0, 0xb3ec, 0xd869, 0xb3e6, 0x9148, + 0xb3ed, 0xb3e9, 0xb3e5, 0x92de, 0xd870, 0x8b53, 0x9df6, 0xb3eb, + 0x9bda, 0xdcd5, 0xdcd1, 0x9d7e, 0xdce0, 0xdcca, 0xdcd3, 0xb6e5, + 0xb6e6, 0xb6de, 0xdcdc, 0xb6e8, 0xdccf, 0xdcce, 0xdccc, 0xdcde, + 0xb6dc, 0xdcd8, 0xdccd, 0xb6df, 0xdcd6, 0xb6da, 0xdcd2, 0xdcd9, + 0xdcdb, 0x89fd, 0x99e4, 0xdcdf, 0xb6e3, 0xdccb, 0xb6dd, 0xdcd0, + 0x9e43, 0xb6d8, 0xb6e4, 0xdcda, 0xb6e0, 0xb6e1, 0xb6e7, 0xb6db, + 0xa25f, 0xb6d9, 0xdcd4, 0x9de9, 0x8f52, 0xb6e2, 0x9df5, 0x9df0, + 0xdcdd, 0x99e7, 0xb9cd, 0xb9c8, 0xe155, 0xe151, 0x8bbd, 0xe14b, + 0xb9c2, 0xb9be, 0xe154, 0xb9bf, 0xe14e, 0xe150, 0xe153, 0x9def, + 0xb9c4, 0xb9cb, 0xb9c5, 0xe149, 0xb9c6, 0xb9c7, 0xe14c, 0xb9cc, + 0x9fb7, 0xe14a, 0xe14f, 0xb9c3, 0xe148, 0xb9c9, 0xb9c1, 0xb9c0, + 0xe14d, 0xe152, 0x9dd0, 0xb9ca, 0x9feb, 0x8da9, 0x9dcf, 0x98e1, + 0x9de5, 0xe147, 0xbc4d, 0xe547, 0xe544, 0x9dc8, 0xbc47, 0xbc53, + 0xbc54, 0xbc4a, 0xe542, 0xbc4c, 0xe4f9, 0xbc52, 0xfb4f, 0xe546, + 0xbc49, 0xe548, 0xbc48, 0xe543, 0xe545, 0xbc4b, 0xe541, 0xe4fa, + 0xe4f7, 0x9deb, 0xd86b, 0xe4fd, 0xe4f6, 0xe4fc, 0xe4fb, 0xe4f8, + 0xfb54, 0xbc4f, 0xfb55, 0x9aa2, 0x8ad6, 0xbc4e, 0x9a5f, 0xbc50, + 0xe4fe, 0xbeb2, 0xe540, 0x9ef5, 0xe945, 0xe8fd, 0x8fb7, 0xbebe, + 0xe942, 0xbeb6, 0xbeba, 0xe941, 0xbeb9, 0xbeb5, 0xbeb8, 0xbeb3, + 0xbebd, 0xe943, 0xe8fe, 0xbebc, 0xe8fc, 0xbebb, 0xe944, 0xe940, + 0xbc51, 0xbebf, 0xe946, 0xbeb7, 0xbeb4, 0x9ad2, 0x9e6a, 0x9ee8, + 0xecc6, 0xecc8, 0xc07b, 0xecc9, 0xecc7, 0xecc5, 0xecc4, 0xc07d, + 0xecc3, 0xc07e, 0x8bbf, 0x91c2, 0x9d62, 0xecc1, 0xecc2, 0xc07a, + 0xc0a1, 0xc07c, 0x9260, 0xecc0, 0xc250, 0xefbc, 0xefba, 0xefbf, + 0xefbd, 0xefbb, 0xefbe, 0x925e, 0x91c1, 0x8ac5, 0x97a3, 0xc360, + 0xf1f2, 0xf1f3, 0xc456, 0xf1f4, 0xf1f0, 0xf1f5, 0xf1f1, 0xc251, + 0x8b6c, 0x8d7e, 0xf3fe, 0xf441, 0xc459, 0xf440, 0xc458, 0xc457, + 0x9c54, 0xc45a, 0xf5c5, 0xf5c6, 0x9dbd, 0xc4da, 0xc4d9, 0xc4db, + 0xf5c4, 0xf6d8, 0xf6d7, 0xc56d, 0xc56f, 0xc56e, 0xf6d9, 0xc5c8, + 0xf8a6, 0xc5f1, 0xf8a5, 0xf8ee, 0x9cc5, 0xc949, 0xa57d, 0xa57c, + 0xa65f, 0xa65e, 0xc9c7, 0xa65d, 0xc9c6, 0x895b, 0xa779, 0xcaa9, + 0xcaa8, 0xa777, 0xa77a, 0xfb5c, 0xcaa7, 0xfb5b, 0xa778, 0xfb57, + 0xcbf0, 0xcbf1, 0xa954, 0x98c7, 0xabaa, 0xfb5a, 0xd148, 0xd149, + 0xae45, 0xae46, 0xd4ac, 0xb0e9, 0xb0eb, 0xd4ab, 0xb0ea, 0xd87c, + 0xb3f2, 0xb6e9, 0xb6ea, 0xdce1, 0x9cee, 0xb9cf, 0xb9ce, 0xe549, + 0xe948, 0xe947, 0x92e2, 0xf96b, 0xa467, 0xc959, 0xc96e, 0xc96f, + 0xa662, 0xa666, 0xc9c9, 0xa664, 0xa663, 0xc9c8, 0xa665, 0xa661, + 0x94a7, 0xa660, 0xc9ca, 0xa7a6, 0x8ccc, 0xa7a3, 0x9bd4, 0xa77d, + 0xcaaa, 0xfb64, 0xfb76, 0xcaab, 0xfb60, 0xa7a1, 0xcaad, 0xa77b, + 0xcaae, 0xcaac, 0xa77e, 0xa7a2, 0xa7a5, 0xa7a4, 0xa77c, 0xcaaf, + 0x99e5, 0x9ac2, 0x91fb, 0xa073, 0xa959, 0xcbfe, 0xa95b, 0xa95a, + 0x9f72, 0xcc40, 0xa958, 0xa957, 0xcbf5, 0xcbf4, 0xcbf2, 0xcbf7, + 0xcbf6, 0xcbf3, 0xcbfc, 0xcbfd, 0xcbfa, 0xcbf8, 0xa956, 0x9fcc, + 0xcbfb, 0xa95c, 0xcc41, 0x98a5, 0x92e8, 0xcbf9, 0xabab, 0xa955, + 0x9bbc, 0x96f3, 0xabac, 0xce54, 0x92e7, 0xce5a, 0xfc67, 0xabb2, + 0xce58, 0xce5e, 0xce55, 0xce59, 0xce5b, 0xce5d, 0xce57, 0x8b7d, + 0xce56, 0xce51, 0xce52, 0xabad, 0x9bf4, 0xabaf, 0xabae, 0xce53, + 0xce5c, 0x9ef7, 0x9ec1, 0xabb1, 0x996f, 0xce50, 0xd153, 0xd152, + 0xd157, 0xd14e, 0x96f1, 0xd151, 0xd150, 0x8e41, 0xd154, 0xd158, + 0xae47, 0xae4a, 0x954a, 0xd14f, 0xd155, 0x97e6, 0xae49, 0xd14a, + 0xabb0, 0xd4ba, 0xd156, 0xd14d, 0xae48, 0xd14c, 0x96f5, 0xd4b1, + 0x92e6, 0x9f42, 0xb0ec, 0xb0f0, 0xd4c1, 0xd4af, 0xd4bd, 0xb0f1, + 0xd4bf, 0xfb67, 0xd4c5, 0xd4c9, 0xd4c0, 0xd4b4, 0xd4bc, 0x99a9, + 0xd4ca, 0xd4c8, 0xd4be, 0xd4b9, 0xd4b2, 0xd8a6, 0xd4b0, 0xb0f5, + 0xd4b7, 0xb0f6, 0xb0f2, 0xd4ad, 0xd4c3, 0xd4b5, 0xfae6, 0xd4b3, + 0xd4c6, 0xb0f3, 0xfb69, 0xd4cc, 0xb0ed, 0xb0ef, 0xd4bb, 0xd4b6, + 0xae4b, 0xb0ee, 0xd4b8, 0xd4c7, 0xd4cb, 0xd4c2, 0xd4c4, 0x97e5, + 0xd4ae, 0xd8a1, 0xd8aa, 0xd8a9, 0xb3fa, 0xd8a2, 0xb3fb, 0xb3f9, + 0x967d, 0xd8a4, 0xb3f6, 0xd8a8, 0xfb6c, 0xd8a3, 0xd8a5, 0xd87d, + 0xb3f4, 0xd8b2, 0xd8b1, 0xd8ae, 0xb3f3, 0xb3f7, 0xb3f8, 0xd14b, + 0xd8ab, 0xb3f5, 0xb0f4, 0xd8ad, 0xd87e, 0xd8b0, 0xd8af, 0x99a2, + 0xd8b3, 0xdcef, 0xd8ac, 0x9abb, 0x9a65, 0x944e, 0xd8a7, 0xdce7, + 0xb6f4, 0xb6f7, 0xb6f2, 0xdce6, 0xdcea, 0xdce5, 0xb6ec, 0xb6f6, + 0xdce2, 0xb6f0, 0xdce9, 0xb6ee, 0xb6ed, 0xdcec, 0xb6ef, 0xdcee, + 0xfb6e, 0xdceb, 0xb6eb, 0x99df, 0xb6f5, 0xdcf0, 0xdce4, 0xdced, + 0xdce3, 0x98e3, 0xb6f1, 0x9254, 0xb6f3, 0xdce8, 0xdcf1, 0x967b, + 0x8aaf, 0xe15d, 0xb9d0, 0xe163, 0xb9d5, 0xe15f, 0xe166, 0xe157, + 0xb9d7, 0xb9d1, 0xe15c, 0xbc55, 0xe15b, 0xe164, 0xb9d2, 0xb9d6, + 0xe15a, 0xe160, 0xe165, 0xe156, 0xb9d4, 0xe15e, 0xe162, 0xe168, + 0xe158, 0xe161, 0x8c77, 0xb9d3, 0xe167, 0xe159, 0x8baf, 0x9ebd, + 0xbc59, 0xe54b, 0xbc57, 0xbc56, 0xe54d, 0xe552, 0xe54e, 0xe551, + 0xbc5c, 0x9ee6, 0xbea5, 0xbc5b, 0xfb6f, 0xe54a, 0xe550, 0xbc5a, + 0xe54f, 0x8ee1, 0xe54c, 0xbc58, 0x9b7d, 0x9c7e, 0xe94d, 0xf9d9, + 0xe94f, 0xe94a, 0xbec1, 0xe94c, 0xbec0, 0xe94e, 0xbec3, 0xe950, + 0xbec2, 0xe949, 0xe94b, 0x92ea, 0xc0a5, 0xeccc, 0x8c78, 0xc0a4, + 0xeccd, 0xc0a3, 0xeccb, 0xc0a2, 0xecca, 0xc253, 0xc252, 0xf1f6, + 0xf1f8, 0xfb72, 0xf1f7, 0xc361, 0xc362, 0xfb71, 0xc363, 0xf442, + 0xc45b, 0xf7d3, 0xf7d2, 0xc5f2, 0xa468, 0xa4d0, 0xa7a7, 0x895c, + 0x98f0, 0x96f2, 0xce5f, 0xb3fc, 0xb3fd, 0xfb74, 0xdcf2, 0xb9d8, + 0xe169, 0xe553, 0x8bc1, 0xc95a, 0x895d, 0x89de, 0xcab0, 0x895e, + 0xc6ca, 0xcc42, 0xce60, 0xd159, 0xae4c, 0xfe42, 0xf1f9, 0xc4dc, + 0xa469, 0xa57e, 0xc970, 0xa667, 0xa668, 0xa95d, 0xfb7b, 0xb0f7, + 0xb9da, 0xb9db, 0xb9d9, 0xa46a, 0xa4d1, 0xa4d3, 0xa4d2, 0xc95b, + 0xa4d4, 0xa5a1, 0xc971, 0xa5a2, 0x895f, 0x8960, 0xa669, 0xa66a, + 0xc9cb, 0xa7a8, 0xcab1, 0xa961, 0xcc43, 0xa95f, 0xa960, 0xa95e, + 0xd15a, 0xabb6, 0xabb5, 0xabb7, 0xabb4, 0xce61, 0xa962, 0xabb3, + 0xae4d, 0xae4e, 0xae4f, 0xd4cd, 0xb3fe, 0xd8b4, 0xb0f8, 0x9bcd, + 0xb6f8, 0xb9dd, 0xb9dc, 0xe16a, 0xbc5d, 0xbec4, 0xefc0, 0xf6da, + 0xf7d4, 0xa46b, 0xa5a3, 0x9dd3, 0xa5a4, 0xc9d1, 0xa66c, 0xa66f, + 0xc9cf, 0xc9cd, 0xa66e, 0xc9d0, 0xc9d2, 0xc9cc, 0xa671, 0xa670, + 0xa66d, 0xa66b, 0xc9ce, 0x984c, 0xa7b3, 0xa7b0, 0xcab6, 0xcab9, + 0xcab8, 0xa7aa, 0xa7b2, 0x9752, 0xa7af, 0xcab5, 0xcab3, 0xa7ae, + 0x95c3, 0xa7a9, 0xa7ac, 0x9bb6, 0xcab4, 0xcabb, 0xcab7, 0xa7ad, + 0xa7b1, 0xa7b4, 0xcab2, 0xcaba, 0xa7ab, 0x9ab9, 0xa967, 0xa96f, + 0x97b3, 0xcc4f, 0xcc48, 0xa970, 0xcc53, 0xcc44, 0xcc4b, 0x9f74, + 0x92f1, 0xa966, 0xcc45, 0xa964, 0xcc4c, 0xcc50, 0xa963, 0xcc51, + 0xcc4a, 0xcc4d, 0x97df, 0xa972, 0xa969, 0xcc54, 0xcc52, 0xfba6, + 0xa96e, 0xa96c, 0xcc49, 0xa96b, 0xcc47, 0xcc46, 0xa96a, 0xa968, + 0xa971, 0xa96d, 0xa965, 0xcc4e, 0xabb9, 0xfbab, 0xabc0, 0xce6f, + 0xabb8, 0xce67, 0xce63, 0xce73, 0xce62, 0xabbb, 0xce6c, 0xabbe, + 0xabc1, 0xabbc, 0xce70, 0xabbf, 0x9877, 0xae56, 0xce76, 0xce64, + 0x9854, 0x95c5, 0xce66, 0xce6d, 0xce71, 0xce75, 0xce72, 0xce6b, + 0xce6e, 0x9d55, 0xfbb2, 0xce68, 0xabc3, 0xce6a, 0xce69, 0xce74, + 0xabba, 0xce65, 0xabc2, 0x957e, 0xabbd, 0xae5c, 0xd162, 0x9742, + 0xae5b, 0x94e6, 0xd160, 0xae50, 0x92f5, 0xae55, 0xd15f, 0xd15c, + 0xd161, 0xae51, 0xd15b, 0x8cc5, 0xae54, 0xae52, 0xd163, 0xae53, + 0xae57, 0x92fd, 0xae58, 0xfba2, 0xae5a, 0x9c51, 0xae59, 0x94e9, + 0x985c, 0x92f0, 0xd15d, 0xd15e, 0xd164, 0xd4d4, 0xb0f9, 0xd8c2, + 0xd4d3, 0xd4e6, 0xb140, 0x944c, 0xd4e4, 0xb0fe, 0xb0fa, 0xd4ed, + 0xd4dd, 0xd4e0, 0x916b, 0xb143, 0xd4ea, 0xd4e2, 0xb0fb, 0xb144, + 0xd4e7, 0xd4e5, 0xd4d6, 0xd4eb, 0xd4df, 0xd4da, 0x8b78, 0xd4d0, + 0xd4ec, 0xd4dc, 0xd4cf, 0x94e2, 0xb142, 0xd4e1, 0xd4ee, 0xd4de, + 0xd4d2, 0xd4d7, 0xd4ce, 0x984f, 0xb141, 0xfbb5, 0xd4db, 0xd4d8, + 0xb0fc, 0xd4d1, 0x9271, 0xd4e9, 0xb0fd, 0x9365, 0xd4d9, 0xd4d5, + 0x985b, 0xd4e8, 0x9850, 0xb440, 0xd8bb, 0x97bc, 0xd8b8, 0xd8c9, + 0xd8bd, 0xd8ca, 0x92f3, 0xb442, 0x9340, 0x984d, 0xd8c6, 0xd8c3, + 0x9572, 0xfdef, 0xd8c4, 0xd8c7, 0xd8cb, 0xd4e3, 0xd8cd, 0xdd47, + 0xfdc1, 0xb443, 0xd8ce, 0xd8b6, 0xd8c0, 0xfbba, 0xd8c5, 0x92eb, + 0xb441, 0xb444, 0xd8cc, 0xd8cf, 0xd8ba, 0xd8b7, 0xfc73, 0x97b7, + 0xd8b9, 0xd8be, 0xd8bc, 0xb445, 0xd8c8, 0xfbb4, 0xd8bf, 0xd8c1, + 0xd8b5, 0xdcfa, 0xdcf8, 0xb742, 0xb740, 0xdd43, 0xdcf9, 0xdd44, + 0xdd40, 0xdcf7, 0xdd46, 0xdcf6, 0xdcfd, 0xb6fe, 0xb6fd, 0xb6fc, + 0xdcfb, 0xdd41, 0xb6f9, 0xb741, 0x90a7, 0xdcf4, 0xdcfe, 0xdcf3, + 0xdcfc, 0xb6fa, 0xdd42, 0xdcf5, 0xb6fb, 0xdd45, 0x9741, 0x92f4, + 0xfbbc, 0xe16e, 0xb9e2, 0xb9e1, 0xb9e3, 0xe17a, 0xe170, 0xe176, + 0xe16b, 0xe179, 0xe178, 0xe17c, 0xe175, 0xb9de, 0xe174, 0xb9e4, + 0x9577, 0xe16d, 0xb9df, 0xe17b, 0xb9e0, 0xe16f, 0xe172, 0xe177, + 0xe171, 0xe16c, 0x9ee2, 0x8f78, 0xe173, 0xe555, 0xbc61, 0xe558, + 0xe557, 0xe55a, 0xe55c, 0xf9dc, 0xbc5f, 0xe556, 0x9672, 0xe554, + 0xe55d, 0xe55b, 0xe559, 0xe55f, 0xe55e, 0xbc63, 0xbc5e, 0xbc60, + 0xbc62, 0x9eb5, 0xe560, 0xe957, 0x964b, 0xe956, 0xe955, 0x8cac, + 0xe958, 0xe951, 0xe952, 0xe95a, 0xe953, 0xbec5, 0xe95c, 0xa0fa, + 0xe95b, 0xe954, 0xecd1, 0xc0a8, 0xeccf, 0xecd4, 0xecd3, 0xe959, + 0xc0a7, 0x9575, 0xecd2, 0xecce, 0xecd6, 0xecd5, 0xc0a6, 0xecd0, + 0xbec6, 0xc254, 0xefc1, 0xf1fa, 0xf1fb, 0xf1fc, 0xc45c, 0x90da, + 0xc45d, 0x9367, 0xf443, 0xfea4, 0xf5c8, 0xf5c7, 0x90df, 0xf6db, + 0xf6dc, 0xf7d5, 0xf8a7, 0x9354, 0xa46c, 0xa46d, 0xa46e, 0xa4d5, + 0xa5a5, 0xc9d3, 0xa672, 0xa673, 0xa7b7, 0xa7b8, 0xa7b6, 0xa7b5, + 0xa973, 0xcc55, 0xa975, 0xa974, 0xcc56, 0x8961, 0x8bb4, 0xabc4, + 0xae5d, 0xd165, 0x9dc0, 0xd4f0, 0xb145, 0xb447, 0xd4ef, 0xb446, + 0x8e48, 0xb9e5, 0xfbc5, 0xe17d, 0xbec7, 0xc0a9, 0xecd7, 0xfbc7, + 0xc45e, 0xc570, 0xc6cb, 0xc972, 0xfa79, 0xa5a6, 0xc973, 0xa676, + 0xa674, 0xa675, 0xa677, 0xa7ba, 0xa7b9, 0xcabc, 0xa7bb, 0x9e67, + 0xcabd, 0xcc57, 0xcc58, 0x8cd9, 0xa976, 0xa978, 0xa97a, 0xa977, + 0xa97b, 0xa979, 0xfbd2, 0x8962, 0x8963, 0xabc8, 0xabc5, 0xabc7, + 0xabc9, 0xabc6, 0xd166, 0xce77, 0xfc7d, 0xd168, 0xd167, 0xae63, + 0xae5f, 0xae60, 0xae62, 0xae64, 0xae61, 0xae66, 0xae65, 0xb14a, + 0xd4f2, 0xd4f1, 0xb149, 0x9f6b, 0xb148, 0xb147, 0xb14b, 0xb146, + 0xd8d5, 0xd8d2, 0xb449, 0xd8d1, 0xd8d6, 0xb44b, 0xd8d4, 0xb448, + 0xb44a, 0xd8d3, 0xfbcc, 0xdd48, 0xfeae, 0xdd49, 0xdd4a, 0xb9e6, + 0xb9ee, 0xe17e, 0xb9e8, 0xb9ec, 0xe1a1, 0xb9ed, 0xb9e9, 0xb9ea, + 0xb9e7, 0xb9eb, 0xbc66, 0xd8d0, 0xbc67, 0xbc65, 0xbc64, 0xe95d, + 0xbec8, 0xecd8, 0xecd9, 0xfbd1, 0xc364, 0xc45f, 0xa46f, 0xa678, + 0xfb75, 0xabca, 0xd169, 0xae67, 0xfbd4, 0xb14e, 0xb14d, 0xb14c, + 0xb44c, 0xb44d, 0xd8d7, 0xb9ef, 0xbec9, 0xa470, 0xc95c, 0xa4d6, + 0xc974, 0xfbd6, 0xfbd8, 0xc9d4, 0xa679, 0xa97c, 0x8b5d, 0x934c, + 0xdd4b, 0x9ae2, 0xa471, 0x8bc9, 0xa4d7, 0xc9d5, 0xcabe, 0xcabf, + 0xa7bc, 0xd8d8, 0xb44e, 0xdd4c, 0xc0aa, 0xa472, 0xa4a8, 0xa4d8, + 0xc975, 0xa5a7, 0xa7c0, 0xa7bf, 0xa7bd, 0xa7be, 0xcc59, 0xa97e, + 0xa9a1, 0xcc5a, 0xa97d, 0xfbdb, 0x9fc9, 0xabce, 0xce78, 0xabcd, + 0xabcb, 0xabcc, 0xae6a, 0xae68, 0x9f44, 0xd16b, 0xae69, 0xd16a, + 0xae5e, 0xd4f3, 0xb150, 0xb151, 0x98ed, 0xb14f, 0xb9f0, 0xe1a2, + 0xbc68, 0xbc69, 0xe561, 0xc0ab, 0xefc2, 0xefc3, 0xc4dd, 0xf8a8, + 0xc94b, 0xa4d9, 0xa473, 0xc977, 0xc976, 0xa67a, 0xc9d7, 0xc9d8, + 0xc9d6, 0xc9d9, 0xfbdd, 0xcac7, 0xcac2, 0xcac4, 0xcac6, 0xcac3, + 0xa7c4, 0xcac0, 0xcac1, 0xa7c1, 0xa7c2, 0xcac5, 0xcac8, 0xa7c3, + 0xcac9, 0x8df2, 0x8964, 0xfdf2, 0xcc68, 0x934d, 0xcc62, 0xcc5d, + 0xa9a3, 0xcc65, 0xcc63, 0xcc5c, 0xcc69, 0xcc6c, 0xcc67, 0xcc60, + 0xa9a5, 0xcc66, 0xa9a6, 0xcc61, 0xcc64, 0xcc5b, 0xcc5f, 0xcc6b, + 0xa9a7, 0xa9a8, 0xcc5e, 0xcc6a, 0xa9a2, 0xa9a4, 0xfbe7, 0xa0f2, + 0x9868, 0xceab, 0xcea4, 0xceaa, 0xcea3, 0xcea5, 0xce7d, 0xce7b, + 0xceac, 0xcea9, 0xce79, 0x9f58, 0xabd0, 0xcea7, 0xcea8, 0xcea6, + 0xce7c, 0xce7a, 0xabcf, 0xcea2, 0xce7e, 0xcea1, 0xcead, 0x8d73, + 0xae6f, 0xfbde, 0xae6e, 0xd16c, 0xae6b, 0xd16e, 0xfbdf, 0xae70, + 0xd16f, 0xae73, 0x8c48, 0xae71, 0xd170, 0xceae, 0xd172, 0xae6d, + 0xae6c, 0xd16d, 0xd171, 0xae72, 0xb153, 0xb152, 0xd4f5, 0xd4f9, + 0xd4fb, 0xb154, 0xd4fe, 0xfbe3, 0xb158, 0xd541, 0xb15a, 0x8da8, + 0xb156, 0xb15e, 0xfbe4, 0xb15b, 0xd4f7, 0xb155, 0xd4f6, 0xd4f4, + 0xd543, 0xd4f8, 0xb157, 0xd542, 0xb15c, 0xd4fd, 0xd4fc, 0xb15d, + 0xd4fa, 0xb159, 0x9c75, 0xd544, 0x9878, 0xd540, 0xd8e7, 0xd8ee, + 0xd8e3, 0xb451, 0xd8df, 0xd8ef, 0xd8d9, 0xd8ec, 0xd8ea, 0xd8e4, + 0xd8ed, 0xd8e6, 0x8d60, 0xd8de, 0xd8f0, 0xd8dc, 0xd8e9, 0xd8da, + 0xd8f1, 0xfbe5, 0xb452, 0x8d61, 0xd8eb, 0xdd4f, 0xd8dd, 0xb44f, + 0xd8e1, 0xb450, 0xd8e0, 0xd8e5, 0xd8e2, 0x8d62, 0xa0a1, 0xd8e8, + 0x9c40, 0xdd53, 0xdd56, 0xdd4e, 0xdd50, 0xdd55, 0xdd54, 0xb743, + 0xd8db, 0xdd52, 0xb744, 0x98ad, 0xdd4d, 0xdd51, 0x9eea, 0xe1a9, + 0xe1b0, 0xe1a7, 0x8cd4, 0xe1ae, 0xe1a5, 0xe1ad, 0xe1b1, 0xe1a4, + 0xe1a8, 0xe1a3, 0xb9f1, 0x9ceb, 0xe1a6, 0xb9f2, 0xe1ac, 0xe1ab, + 0xe1aa, 0xfbe0, 0xe1af, 0x9f51, 0xe565, 0xe567, 0xbc6b, 0xe568, + 0xe563, 0xe562, 0xe56c, 0xe56a, 0xbc6a, 0xe56d, 0xe564, 0xe569, + 0xe56b, 0xe566, 0x8d65, 0xe961, 0xe966, 0xe960, 0xe965, 0x9cf1, + 0xe95e, 0xe968, 0xe964, 0xe969, 0xe963, 0xe95f, 0xe967, 0xe96a, + 0xe962, 0xfc58, 0xecda, 0xc0af, 0x8d66, 0xc0ad, 0xc0ac, 0xc0ae, + 0xefc4, 0x9654, 0xf172, 0xf1fd, 0xf444, 0xf445, 0xc460, 0xf5c9, + 0xc4de, 0xf5ca, 0xf6de, 0xc572, 0xc571, 0xf6dd, 0xc5c9, 0xfbe8, + 0xf7d6, 0xc6cc, 0xa474, 0xa67b, 0xc9da, 0xcaca, 0xa8b5, 0xb15f, + 0xa475, 0xa5aa, 0xa5a9, 0xa5a8, 0xa7c5, 0xae74, 0xdd57, 0xa476, + 0xa477, 0xa478, 0xa4da, 0x9fce, 0xabd1, 0xceaf, 0xb453, 0xa479, + 0xc95d, 0xa5ab, 0xa5ac, 0xc978, 0xa67c, 0xfbfc, 0xcacb, 0x9ae4, + 0xa7c6, 0xcacc, 0xa9ae, 0x9f75, 0xcc6e, 0xa9ac, 0xa9ab, 0xcc6d, + 0xa9a9, 0xcc6f, 0xa9aa, 0xa9ad, 0xabd2, 0xabd4, 0xceb3, 0xceb0, + 0xceb1, 0xceb2, 0xceb4, 0xabd3, 0xd174, 0xd173, 0xae76, 0xae75, + 0xfbf1, 0xb162, 0xd546, 0xb161, 0xb163, 0xb160, 0xb455, 0xd545, + 0xb456, 0xd8f3, 0x8d69, 0xb457, 0xd8f2, 0xb454, 0x934f, 0xdd5a, + 0xdd5c, 0xb745, 0xdd5b, 0xdd59, 0xdd58, 0xe1b4, 0xb9f7, 0xb9f5, + 0xb9f6, 0xe1b2, 0xe1b3, 0xb9f3, 0xe571, 0xe56f, 0x934e, 0xbc6d, + 0xe570, 0xbc6e, 0xbc6c, 0xb9f4, 0xe96d, 0xe96b, 0xe96c, 0xe56e, + 0xecdc, 0xc0b0, 0xecdb, 0xefc5, 0xefc6, 0xe96e, 0xf1fe, 0xa47a, + 0xa5ad, 0xa67e, 0xc9db, 0xa67d, 0xa9af, 0xb746, 0xfbf4, 0xa4db, + 0xa5ae, 0xabd5, 0xb458, 0xc6ce, 0xc979, 0xc97a, 0xfbc3, 0xc9dc, + 0x8965, 0xa7c8, 0xcad0, 0xcace, 0xa7c9, 0xcacd, 0xcacf, 0xcad1, + 0xa7c7, 0x8c7a, 0xa9b3, 0xa9b4, 0xa9b1, 0x8c7b, 0xa9b0, 0xceb8, + 0xa9b2, 0xabd6, 0xceb7, 0xceb9, 0xceb6, 0xceba, 0xabd7, 0xae79, + 0xd175, 0xd177, 0xae77, 0xd178, 0xae78, 0xd176, 0xceb5, 0xd547, + 0xd54a, 0xd54b, 0xd548, 0xb167, 0xb166, 0xb164, 0xb165, 0xd549, + 0x8d6a, 0xb168, 0xb45a, 0xb45b, 0xb45c, 0xdd5d, 0xdd5f, 0xdd61, + 0xb748, 0xb747, 0xb459, 0xdd60, 0xdd5e, 0x9353, 0xe1b8, 0x9dfb, + 0xe1b6, 0xe1bc, 0xb9f8, 0xe1bd, 0xe1ba, 0xb9f9, 0xe1b7, 0xe1b5, + 0xe1bb, 0xbc70, 0xe573, 0xe1b9, 0xbc72, 0xe574, 0xbc71, 0xbc74, + 0xe575, 0xbc6f, 0xbc73, 0xe973, 0xe971, 0xe970, 0xe972, 0xe96f, + 0xc366, 0xf446, 0xf447, 0xf5cb, 0xf6df, 0xc655, 0xfbfd, 0xa9b5, + 0xa7ca, 0x9059, 0xfc40, 0xabd8, 0xfc41, 0xfc43, 0xa47b, 0xa4dc, + 0xa5af, 0xc9dd, 0xa7cb, 0xcad2, 0xcebb, 0xabd9, 0xb9fa, 0xa47c, + 0x9361, 0xfc46, 0x9362, 0xa6a1, 0xb749, 0xa47d, 0xa4dd, 0xa4de, + 0xa5b1, 0xa5b0, 0xc9de, 0xa6a2, 0xcad3, 0xa7cc, 0xcc71, 0xcc72, + 0xcc73, 0x8d6b, 0xa9b6, 0xa9b7, 0xcc70, 0xa9b8, 0xabda, 0xcebc, + 0xd17a, 0xae7a, 0xd179, 0xb169, 0xd54c, 0xb16a, 0xd54d, 0xfc4c, + 0xb45d, 0xdd62, 0xe1bf, 0xe1be, 0xb9fb, 0xbc75, 0xe576, 0xbeca, + 0xe974, 0xc0b1, 0x95b8, 0xc573, 0xf7d8, 0xc6d0, 0x8bca, 0xcc74, + 0xcebd, 0xb16b, 0xd8f4, 0xb74a, 0x987a, 0xc255, 0xc6d1, 0xa7ce, + 0xfc51, 0xa7cd, 0xabdb, 0xd17b, 0xb16d, 0xb343, 0xb16e, 0xb16c, + 0xb45e, 0xe1c0, 0xb9fc, 0xbc76, 0xfc54, 0xc94c, 0xc9df, 0xcad5, + 0xa7cf, 0xcad4, 0xa7d0, 0xfaaf, 0xa9bc, 0xcc77, 0xcc76, 0xa9bb, + 0xa9b9, 0xa9ba, 0xcc75, 0x8d6c, 0xabdd, 0xcebe, 0xabe0, 0xabdc, + 0xabe2, 0xabde, 0xabdf, 0xabe1, 0xae7d, 0xae7c, 0xae7b, 0xd54f, + 0xb16f, 0xb172, 0xb170, 0xd54e, 0xb175, 0xb171, 0xd550, 0xb174, + 0xb173, 0xfa61, 0xd8f6, 0xd8f5, 0xfc57, 0xb461, 0xb45f, 0xb460, + 0xd8f7, 0xb74b, 0xdd64, 0xb74c, 0xdd63, 0x9b70, 0xe577, 0xbc78, + 0xe1c1, 0xbc77, 0xb9fd, 0xa051, 0xecde, 0xe975, 0xc0b2, 0xecdd, + 0xf240, 0xf448, 0xf449, 0x8c7c, 0xa4df, 0x8bcb, 0xa5b2, 0xc97b, + 0xa7d2, 0xa7d4, 0xc9e2, 0xcad8, 0xcad7, 0xcad6, 0xc9e1, 0xc9e0, + 0xa6a4, 0xa7d3, 0xa7d1, 0xa6a3, 0x936e, 0xa9bd, 0xcc78, 0xfcd5, + 0xa9be, 0xcadd, 0xcadf, 0xcade, 0xcc79, 0xcada, 0xa7d8, 0xa7d6, + 0xcad9, 0xcadb, 0xcae1, 0xa7d5, 0xcadc, 0xcae5, 0xa9c0, 0xcae2, + 0xa7d7, 0xcae0, 0xcae3, 0xa9bf, 0xa9c1, 0xcae4, 0xccaf, 0xcca2, + 0xcc7e, 0xccae, 0xcca9, 0xabe7, 0xa9c2, 0xccaa, 0xccad, 0xabe3, + 0xccac, 0xa9c3, 0xa9c8, 0xa9c6, 0xcca3, 0xcc7c, 0xcca5, 0xa9cd, + 0xccb0, 0xabe4, 0xcca6, 0xabe5, 0xa9c9, 0xcca8, 0xfca9, 0xcecd, + 0xabe6, 0xcc7b, 0xa9ca, 0xabe8, 0xa9cb, 0xa9c7, 0xa9cc, 0xcca7, + 0xcc7a, 0xccab, 0xa9c4, 0xfc61, 0xcc7d, 0xcca4, 0xcca1, 0xa9c5, + 0xcebf, 0xcec0, 0x8966, 0xceca, 0xd1a1, 0xcecb, 0xabee, 0xcece, + 0xcec4, 0xabed, 0xcec6, 0xcec7, 0xfacb, 0xcec9, 0xabe9, 0xaea3, + 0xf9da, 0xcec5, 0xcec1, 0xaea4, 0xcecf, 0xae7e, 0xd17d, 0xcec8, + 0xd17c, 0xcec3, 0xcecc, 0xabec, 0xaea1, 0xabf2, 0xaea2, 0xced0, + 0xd17e, 0xabeb, 0xaea6, 0xabf1, 0xabf0, 0xabef, 0xaea5, 0xced1, + 0xaea7, 0xabea, 0xcec2, 0x937a, 0xa0e0, 0x936b, 0xb176, 0xd1a4, + 0xd1a6, 0xd1a8, 0xaea8, 0xaeae, 0xd553, 0xd1ac, 0xd1a3, 0xb178, + 0xd551, 0xaead, 0xaeab, 0xd1ae, 0xd552, 0xd1a5, 0xaeac, 0xd1a9, + 0xaeaf, 0xd1ab, 0xaeaa, 0xd1aa, 0xd1ad, 0xd1a7, 0xfc6b, 0xaea9, + 0xb179, 0xd1a2, 0xb177, 0xa0dc, 0x9468, 0xb17a, 0xd555, 0xd55e, + 0xb464, 0xfc6d, 0xb17c, 0xb1a3, 0xb465, 0xd560, 0xb1aa, 0xd8f9, + 0xd556, 0xb1a2, 0xb1a5, 0xb17e, 0xd554, 0xd562, 0xd565, 0xd949, + 0xd563, 0xd8fd, 0xb1a1, 0xb1a8, 0xb1ac, 0xd55d, 0xd8f8, 0xd561, + 0xb17b, 0xd8fa, 0xd564, 0xd8fc, 0xd559, 0xb462, 0xd557, 0xd558, + 0xb1a7, 0x8d71, 0xb1a6, 0xd55b, 0xb1ab, 0xd55f, 0xb1a4, 0xd55c, + 0xfd64, 0xb1a9, 0xb466, 0xb463, 0xd8fb, 0x99ba, 0xd55a, 0xb17d, + 0x9ad0, 0x9a61, 0xa0e5, 0xb46b, 0xb46f, 0xd940, 0xb751, 0xb46d, + 0xd944, 0xb471, 0xdd65, 0xd946, 0xb753, 0xb469, 0xb46c, 0xd947, + 0xa05b, 0xd948, 0xd94e, 0xb473, 0xb754, 0xd94a, 0xd94f, 0xd943, + 0xb75e, 0x96ac, 0xb755, 0xb472, 0xd941, 0xd950, 0x9740, 0xb75d, + 0xb470, 0xb74e, 0xd94d, 0xb474, 0xd945, 0xd8fe, 0xb46a, 0xd942, + 0xd94b, 0x9ef1, 0xb74d, 0xb752, 0xb467, 0xd94c, 0xb750, 0x8c4d, + 0xb468, 0xb75c, 0xe1c3, 0xdd70, 0xdd68, 0xe1c2, 0xdd6c, 0xdd6e, + 0x9f7e, 0xdd6b, 0xb75b, 0xdd6a, 0xb75f, 0xe1d2, 0x8d72, 0xb75a, + 0xba40, 0xdd71, 0xe1c4, 0xfc76, 0xb758, 0xdd69, 0xdd6d, 0xb9fe, + 0xb74f, 0xdd66, 0xdd67, 0xba41, 0xb757, 0xb759, 0xb756, 0xdd6f, + 0x96a9, 0xe1c8, 0xe1c9, 0xe1ce, 0xbc7d, 0xe1d5, 0xba47, 0xa06e, + 0xba46, 0xe1d0, 0xfcaa, 0xbc7c, 0xe1c5, 0xba45, 0xfbcd, 0xe1d4, + 0xba43, 0xba44, 0xfc74, 0xe1d1, 0xe5aa, 0xbc7a, 0xb46e, 0xe1d3, + 0xbca3, 0xe1cb, 0xbc7b, 0xa074, 0xbca2, 0xe1c6, 0xe1ca, 0xe1c7, + 0xe1cd, 0xba48, 0xbc79, 0xba42, 0xe57a, 0xe1cf, 0xbca1, 0xa071, + 0xbca4, 0xe1cc, 0xfc79, 0xbc7e, 0xe579, 0xfc7c, 0xe57e, 0xbece, + 0xe578, 0xe9a3, 0xe5a9, 0xbca8, 0xbca6, 0xbecc, 0xe5a6, 0xe5a2, + 0xbcac, 0x9c50, 0xe978, 0x9379, 0x9378, 0xbcaa, 0xe5a1, 0xa0dd, + 0xe976, 0xe5a5, 0xe5a8, 0xe57d, 0xbcab, 0xbca5, 0xe977, 0xbecd, + 0xe5a7, 0xbca7, 0xbca9, 0xe5a4, 0xbcad, 0xe5a3, 0xe57c, 0xe57b, + 0xbecb, 0xe5ab, 0xe97a, 0xece0, 0xbed0, 0x8d75, 0xe9a2, 0x8d76, + 0xe97e, 0xece1, 0xbed1, 0xe9a1, 0x9374, 0xe97c, 0xc0b4, 0xecdf, + 0xe979, 0xe97b, 0xc0b5, 0xbed3, 0xc0b3, 0xbed2, 0xc0b7, 0xe97d, + 0xbecf, 0x8d77, 0xfca5, 0xfca2, 0xefcf, 0xefc7, 0x90c3, 0xece7, + 0xefc8, 0xece3, 0xa079, 0xc256, 0xece5, 0xece4, 0xc0b6, 0xece2, + 0xece6, 0xefd0, 0xefcc, 0xefce, 0xefc9, 0xefca, 0xefcd, 0xefcb, + 0xc367, 0xc36a, 0xc369, 0xc368, 0xc461, 0xf44a, 0xc462, 0xf241, + 0xc4df, 0xf5cc, 0xc4e0, 0xc574, 0xc5ca, 0xf7d9, 0xf7da, 0xf7db, + 0xf9ba, 0xa4e0, 0xc97c, 0xa5b3, 0xa6a6, 0xa6a7, 0xa6a5, 0xa6a8, + 0xa7da, 0xa7d9, 0xccb1, 0xa9cf, 0xa9ce, 0xd1af, 0xb1ad, 0xb1ae, + 0xb475, 0xdd72, 0xb760, 0xb761, 0xdd74, 0xdd76, 0xdd75, 0xe1d7, + 0xe1d6, 0xba49, 0xe1d8, 0x8d79, 0xe5ac, 0xbcae, 0xbed4, 0xc0b8, + 0xc257, 0xc0b9, 0xa4e1, 0x8bfc, 0xa076, 0xcae6, 0xccb2, 0xa9d1, + 0xa9d0, 0xa9d2, 0xabf3, 0xced2, 0xced3, 0xd1b0, 0xaeb0, 0xb1af, + 0xb476, 0xd951, 0xa4e2, 0x8bcd, 0xa47e, 0xa4e3, 0xc97d, 0xa5b7, + 0xa5b6, 0xa5b4, 0xa5b5, 0xa6ab, 0xc9e9, 0xc9eb, 0xa6aa, 0xc9e3, + 0xc9e4, 0xc9ea, 0xc9e6, 0xc9e8, 0xa6a9, 0xc9e5, 0xc9ec, 0xc9e7, + 0x9f5a, 0xa7e1, 0xa7ea, 0xa7e8, 0xcaf0, 0xcaed, 0xcaf5, 0xa7e6, + 0xcaf6, 0xa7df, 0xcaf3, 0xa7e5, 0xcaef, 0xcaee, 0xa7e3, 0xcaf4, + 0xa7e4, 0xa9d3, 0xa7de, 0xcaf1, 0x9ff4, 0xcae7, 0xa7db, 0x9fba, + 0xa7ee, 0xcaec, 0xcaf2, 0xa7e0, 0xa7e2, 0xcae8, 0xcae9, 0xcaea, + 0x8d7a, 0xa7ed, 0xa7e7, 0xa7ec, 0xcaeb, 0xa7eb, 0xa7dd, 0xa7dc, + 0xa7e9, 0x9e45, 0x93b0, 0xa075, 0xa9e1, 0xccbe, 0xccb7, 0xa9dc, + 0xa9ef, 0xccb3, 0xccba, 0xccbc, 0xccbf, 0xa9ea, 0xccbb, 0xccb4, + 0xa9e8, 0xccb8, 0xccc0, 0xa9d9, 0xccbd, 0xa9e3, 0xa9e2, 0xccb6, + 0xa9d7, 0xa9d8, 0x9b46, 0xa9d6, 0xfcae, 0xa9ee, 0xa9e6, 0xa9e0, + 0xa9d4, 0xccb9, 0xa9df, 0xa9d5, 0xa9e7, 0xa9f0, 0xced4, 0xa9e4, + 0xccb5, 0xa9da, 0xa9dd, 0xa9de, 0xfcb0, 0xa9ec, 0xa9ed, 0xa9eb, + 0xa9e5, 0xa9e9, 0xa9db, 0xabf4, 0xfa51, 0x8d7b, 0xceda, 0xac41, + 0xabf8, 0xabfa, 0xac40, 0xcee6, 0xabfd, 0xd1b1, 0xaeb1, 0xac43, + 0xced7, 0xcedf, 0xabfe, 0xcede, 0xcedb, 0xcee3, 0xcee5, 0xabf7, + 0xabfb, 0xac42, 0xaeb3, 0xcee0, 0xabf9, 0xac45, 0xced9, 0xabfc, + 0xaeb2, 0xabf6, 0xced6, 0xcedd, 0xced5, 0xced8, 0xcedc, 0xd1b2, + 0xac44, 0xcee1, 0xcee2, 0xcee4, 0xabf5, 0x8d7c, 0xaec1, 0xd1be, + 0xaebf, 0xaec0, 0xd1b4, 0xd1c4, 0x9ed6, 0xaeb6, 0x93ac, 0xd566, + 0xd1c6, 0xd1c0, 0x9f5b, 0xd1b7, 0x93a9, 0xd1c9, 0xd1ba, 0xaebc, + 0xd57d, 0xd1bd, 0xaebe, 0xaeb5, 0xd1cb, 0xd1bf, 0xaeb8, 0xd1b8, + 0xd1b5, 0xd1b6, 0xaeb9, 0xd1c5, 0xd1cc, 0xaebb, 0xd1bc, 0xd1bb, + 0xaec3, 0xaec2, 0xaeb4, 0xaeba, 0xaebd, 0xd1c8, 0xd1c2, 0xaeb7, + 0xd1b3, 0xd1ca, 0xd1c1, 0xd1c3, 0xd1c7, 0xa07c, 0xd567, 0xb1b7, + 0xb1cb, 0xb1ca, 0xb1bf, 0xfcb2, 0xd579, 0xd575, 0xd572, 0xd5a6, + 0xb1ba, 0xb1b2, 0xd577, 0xb4a8, 0xb1b6, 0xd5a1, 0x8ac1, 0xb1cc, + 0xb1c9, 0xd57b, 0xd56a, 0x9fb4, 0xb1c8, 0xd5a3, 0xd569, 0xb1bd, + 0xb1c1, 0xd5a2, 0xd573, 0xb1c2, 0xb1bc, 0xd568, 0xfcac, 0xb478, + 0xd5a5, 0xd571, 0xb1c7, 0xd574, 0xd5a4, 0xb1c6, 0xd952, 0xb1b3, + 0xd56f, 0xb1b8, 0xb1c3, 0xb1be, 0xd578, 0xd56e, 0xd56c, 0xd57e, + 0xb1b0, 0xb1c4, 0xb1b4, 0xb477, 0xd57c, 0xb1b5, 0xb1b1, 0xb1c0, + 0xb1bb, 0xb1b9, 0xd570, 0xb1c5, 0xd56d, 0xd57a, 0xd576, 0xd954, + 0xd953, 0x9e4c, 0xd56b, 0xd964, 0xb47a, 0x8fc5, 0xd96a, 0xd959, + 0xd967, 0xdd77, 0xb47d, 0xd96b, 0xd96e, 0xb47c, 0xd95c, 0xd96d, + 0xd96c, 0xb47e, 0xd955, 0xb479, 0xb4a3, 0x93ad, 0xb4a1, 0xd969, + 0xd95f, 0xb4a5, 0xd970, 0xd968, 0xd971, 0xb4ad, 0xb4ab, 0xd966, + 0xd965, 0x9dc3, 0xd963, 0xd95d, 0xb4a4, 0x8da2, 0xb4a2, 0xd1b9, + 0xd956, 0x9d4a, 0xddb7, 0xd957, 0xb47b, 0xb4aa, 0xdd79, 0xb4a6, + 0xb4a7, 0xd958, 0xd96f, 0xdd78, 0xd960, 0xd95b, 0xb4a9, 0xd961, + 0xd95e, 0xfcb6, 0xb4ae, 0x8da3, 0x9e4b, 0x9e4d, 0xb770, 0x8da4, + 0xdd7c, 0xddb1, 0xddb6, 0xddaa, 0xb76c, 0xddbb, 0xb769, 0xdd7a, + 0xdd7b, 0xb762, 0xb76b, 0xdda4, 0xb76e, 0xb76f, 0xdda5, 0xddb2, + 0xddb8, 0xb76a, 0xb764, 0xdda3, 0xdd7d, 0xddba, 0xdda8, 0xdda9, + 0xdd7e, 0xddb4, 0xddab, 0xddb5, 0xddad, 0xb765, 0xe1d9, 0xb768, + 0xb766, 0xddb9, 0xddb0, 0xddac, 0x8afd, 0xdda1, 0xba53, 0xddaf, + 0xb76d, 0xdda7, 0xfcb5, 0xdda6, 0xfcc3, 0x93b2, 0xb767, 0xb763, + 0xe1ee, 0xddb3, 0xddae, 0xdda2, 0xe1e9, 0xe1da, 0xe1e5, 0xe1ec, + 0xba51, 0xb4ac, 0xe1ea, 0xba4c, 0xba4b, 0xe1f1, 0x8da5, 0xe1db, + 0xe1e8, 0xe1dc, 0xe1e7, 0xba4f, 0xe1eb, 0xd962, 0xe1f2, 0xe1e3, + 0xba52, 0xe5ba, 0xbcaf, 0xe1f0, 0xe1ef, 0xba54, 0xe5ad, 0xbcb0, + 0xe5ae, 0x93a1, 0xe1df, 0xe1e0, 0xe1dd, 0xe1e2, 0xe1de, 0xe1f3, + 0xba4e, 0xbcb1, 0xba50, 0xba55, 0x8ac6, 0xe1e1, 0xe1ed, 0xe1e6, + 0xe5b1, 0xba4a, 0xbcb4, 0xe9aa, 0xe5b6, 0xe5b5, 0xe5b7, 0x8a5b, + 0xe5b4, 0xbcb5, 0x894d, 0xbcbb, 0xbcb8, 0xbcb9, 0xe5af, 0xe5b2, + 0xe5bc, 0xbcc1, 0xbcbf, 0xe5b3, 0xd95a, 0xbcb2, 0xe5b9, 0xe5b0, + 0xbcc2, 0xe5b8, 0xba4d, 0xbcb7, 0xe1e4, 0xbcba, 0xbcbe, 0xbcc0, + 0xbcbd, 0xbcbc, 0xfed4, 0xbcb6, 0xe5bb, 0xbcb3, 0xbcc3, 0x8a78, + 0x93ab, 0xbed8, 0xbed9, 0xe9a9, 0xbee2, 0xbedf, 0x8da7, 0xbed6, + 0xbedd, 0xe9ab, 0xbedb, 0xbed5, 0xbedc, 0xe9a8, 0xc0bb, 0xbed7, + 0xbede, 0xc0ba, 0xe9a7, 0xe9a6, 0xbee0, 0x9f45, 0xbee1, 0xe9a5, + 0xe9a4, 0xc0bc, 0xe9ae, 0xbeda, 0xe9ac, 0x8a56, 0xc0bd, 0xfcbf, + 0xc0c2, 0xecea, 0xecec, 0xfcc0, 0xc0bf, 0x8ee6, 0xeced, 0xece9, + 0x8aa4, 0xeceb, 0xc0c0, 0xc0c3, 0xece8, 0xc0be, 0xc0c1, 0xc259, + 0xe9ad, 0xc258, 0xc25e, 0xefd4, 0xc25c, 0xc25d, 0xefd7, 0xefd3, + 0xc25a, 0xefd1, 0xc36b, 0xefd5, 0xefd6, 0xefd2, 0xc25b, 0xf242, + 0xf245, 0x8943, 0xf246, 0xf244, 0xf247, 0xc36c, 0xf243, 0x93f3, + 0xf44e, 0xc464, 0xf44d, 0xf44c, 0xf44b, 0xc463, 0xc465, 0xf5cd, + 0xc4e2, 0xc4e1, 0xfcab, 0x9ea2, 0xf6e1, 0xf6e0, 0xf6e3, 0xc5cb, + 0xc575, 0xf7dd, 0xf6e2, 0xf7dc, 0xc5cd, 0xc5cc, 0xc5f3, 0xf8a9, + 0xf8ef, 0xa4e4, 0x9dc7, 0xd972, 0xe9af, 0xc6d2, 0x8bce, 0xa6ac, + 0xcaf7, 0xa7f1, 0xa7ef, 0xa7f0, 0xccc1, 0xa9f1, 0xac46, 0xcee7, + 0xcee8, 0xac47, 0xd1ce, 0xaec4, 0xaec5, 0xd1cd, 0xfcc5, 0xb1d3, + 0xb1cf, 0xd5a7, 0xb1d6, 0xb1d5, 0xb1ce, 0xb1d1, 0xb1d4, 0xb1d0, + 0xd976, 0xb1cd, 0xb4af, 0xfccb, 0xb4b1, 0xb4b2, 0xd975, 0xd978, + 0xb4b0, 0xd973, 0xd977, 0xd974, 0x93b3, 0xb771, 0xfcca, 0xddbc, + 0xba56, 0xe1f4, 0xbee3, 0xbcc4, 0xe5bd, 0xbcc5, 0xbcc6, 0xe5bf, + 0xe5be, 0xe5c0, 0xe9b1, 0xe9b0, 0xecef, 0xecee, 0xc0c4, 0xc0c5, + 0xf248, 0xfcc9, 0x8dac, 0xa4e5, 0xfbc6, 0x8967, 0x8c7e, 0xd979, + 0xb4b4, 0xb4b3, 0xddbd, 0xefd8, 0xc4e3, 0xf7de, 0xa4e6, 0xaec6, + 0xb1d8, 0xb1d7, 0xd97a, 0xd97b, 0xb772, 0xe1f5, 0xba57, 0xe9b2, + 0xa4e7, 0xa5b8, 0xa9f2, 0xccc2, 0xcee9, 0xac48, 0xb1d9, 0xd97c, + 0xb4b5, 0xb773, 0xe5c1, 0xe5c2, 0xfccd, 0xecf0, 0xc25f, 0xf8f0, + 0xa4e8, 0xccc3, 0xa9f3, 0xac49, 0x9cf3, 0xceea, 0xaec7, 0xd1d2, + 0xd1d0, 0xd1d1, 0xaec8, 0xd1cf, 0xb1db, 0xb1dc, 0xd5a8, 0xb1dd, + 0xb1da, 0xd97d, 0xfcd0, 0xd97e, 0xddbe, 0x95bb, 0xba59, 0xba58, + 0xecf1, 0xefd9, 0xf24a, 0xf249, 0xf44f, 0xfcd3, 0xc95e, 0xac4a, + 0xfcd4, 0xa4e9, 0xa5b9, 0xa6ae, 0xa6ad, 0xa6af, 0xa6b0, 0xc9ee, + 0xc9ed, 0xcaf8, 0xa7f2, 0xcafb, 0xcafa, 0xcaf9, 0xcafc, 0xa9f4, + 0xccc9, 0xccc5, 0xccce, 0x8dae, 0xa9fb, 0xa9f9, 0xccca, 0xccc6, + 0xcccd, 0xa9f8, 0xaa40, 0xccc8, 0xccc4, 0xa9fe, 0xcccb, 0xa9f7, + 0xcccc, 0xa9fa, 0xa9fc, 0xccd0, 0xcccf, 0xccc7, 0xa9f6, 0xa9f5, + 0xa9fd, 0xfcd7, 0xceef, 0xcef5, 0x93db, 0xac50, 0xac4d, 0xceec, + 0xcef1, 0xfe63, 0xac53, 0xac4b, 0xcef0, 0xac4e, 0xac51, 0xcef3, + 0xac4c, 0xcef8, 0xac4f, 0x93d5, 0xac52, 0xceed, 0xcef2, 0xcef6, + 0xceee, 0xceeb, 0xcef7, 0xcef4, 0xaed0, 0xaec9, 0xaecc, 0xfcda, + 0xaecf, 0xd1d5, 0x9b71, 0xaeca, 0xd1d3, 0xfcdd, 0xaece, 0xaecb, + 0xd1d6, 0xaecd, 0x8daf, 0xfaf2, 0xd5ac, 0xb1df, 0xd5ab, 0xd5ad, + 0xb1de, 0xb1e3, 0xd1d4, 0xd5aa, 0xd5ae, 0x93d8, 0xb1e0, 0xd5a9, + 0xb1e2, 0xfcdf, 0xb1e1, 0xd9a7, 0x93d3, 0xd9a2, 0xb4b6, 0xb4ba, + 0xb4b7, 0xd9a5, 0xd9a8, 0xfce1, 0xb4b8, 0xb4b9, 0xb4be, 0xddc7, + 0xd9a6, 0xb4bc, 0xd9a3, 0xd9a1, 0x8e76, 0xb4bd, 0xd9a4, 0xb779, + 0xfc62, 0xddbf, 0xb776, 0xb777, 0xb775, 0xddc4, 0xddc3, 0xddc0, + 0xb77b, 0x93d1, 0xddc2, 0xb4bb, 0x8db1, 0xddc6, 0xddc1, 0xb778, + 0xb774, 0xb77a, 0xddc5, 0x9859, 0xba5c, 0xe1f8, 0xe1f7, 0xe1f6, + 0xba5a, 0xfb52, 0xba5b, 0xe5c5, 0xe5c8, 0xbcc8, 0xfb53, 0xbcc7, + 0xe5c9, 0xe5c4, 0xbcca, 0xe5c6, 0xfb4d, 0xbcc9, 0xe5c3, 0x9cbf, + 0xe5c7, 0xbee9, 0xbee6, 0xe9bb, 0xe9ba, 0xe9b9, 0xe9b4, 0x9b72, + 0xe9b5, 0xbee7, 0xbee4, 0xbee8, 0xe9b3, 0xbee5, 0xe9b6, 0xe9b7, + 0xe9bc, 0xfb50, 0x93be, 0xe9b8, 0xecf2, 0xc0c7, 0xefdc, 0xc0c6, + 0xefda, 0xefdb, 0xc260, 0xc36e, 0xf24b, 0xc36d, 0xf451, 0xf452, + 0xc466, 0xf450, 0xc4e4, 0xf7df, 0xc5ce, 0xf8aa, 0xf8ab, 0xa4ea, + 0x9df1, 0xa6b1, 0xa6b2, 0xa7f3, 0xccd1, 0xac54, 0xaed1, 0xb1e4, + 0xb0d2, 0xb4bf, 0xb4c0, 0xb3cc, 0xd9a9, 0xfceb, 0xb77c, 0xe1fa, + 0xe1f9, 0xa4eb, 0xa6b3, 0xccd2, 0xaa42, 0xa0bb, 0xaa41, 0x9b7e, + 0xcef9, 0xcefa, 0xd1d7, 0xd1d8, 0xaed2, 0xaed3, 0x8db3, 0xaed4, + 0xd5af, 0x8c52, 0xb1e6, 0xb4c2, 0x9ae8, 0xb4c1, 0xddc8, 0xdf7a, + 0xe1fb, 0xe9bd, 0x8edc, 0xc261, 0xc467, 0xa4ec, 0xa5bc, 0xa5bd, + 0xa5bb, 0xa5be, 0xa5ba, 0xa6b6, 0xc9f6, 0xa6b5, 0xa6b7, 0x9cf9, + 0xc9f1, 0xc9f0, 0xc9f3, 0xc9f2, 0xc9f5, 0xa6b4, 0xc9ef, 0xc9f4, + 0xfa50, 0xcafd, 0xa7fd, 0xcafe, 0xcb43, 0xa7fc, 0xcb47, 0xcb42, + 0xcb45, 0xa7f5, 0xa7f6, 0xa7f7, 0xa7f8, 0xa840, 0xcb41, 0xa7fa, + 0xa841, 0xcb40, 0xcb46, 0xa7f9, 0xcb44, 0xa7fb, 0xa7f4, 0xa7fe, + 0x98e7, 0xfcf3, 0xfcf2, 0xaa57, 0x8cca, 0xccd4, 0xaa43, 0xaa4d, + 0xaa4e, 0xaa46, 0xaa58, 0xaa48, 0xccdc, 0xaa53, 0xccd7, 0xaa49, + 0xcce6, 0xcce7, 0xccdf, 0xccd8, 0xaa56, 0xcce4, 0xaa51, 0xaa4f, + 0xcce5, 0xcce3, 0xccdb, 0xccd3, 0xccda, 0xaa4a, 0xaa50, 0xaa44, + 0xccde, 0xccdd, 0xccd5, 0x93e5, 0xaa52, 0xcce1, 0xccd6, 0xaa55, + 0xcce8, 0xaa45, 0xaa4c, 0xccd9, 0xcce2, 0xaa54, 0xaa47, 0xaa4b, + 0xcce0, 0x9a59, 0x8db5, 0xfd4d, 0xcf5b, 0xac5c, 0xac69, 0xfd5e, + 0xcf56, 0xcf4c, 0xac62, 0xcf4a, 0xac5b, 0xcf45, 0xac65, 0xcf52, + 0xcefe, 0xcf41, 0x8f7d, 0xcf44, 0xcefb, 0xcf51, 0xcf61, 0xac60, + 0xcf46, 0xcf58, 0xcefd, 0xcf5f, 0xcf60, 0xcf63, 0xcf5a, 0xcf4b, + 0xcf53, 0xac66, 0xac59, 0xac61, 0xac6d, 0xac56, 0xac58, 0x9547, + 0xfcf6, 0xcf43, 0xac6a, 0xac63, 0xcf5d, 0xcf40, 0xac6c, 0xac67, + 0xcf49, 0xac6b, 0xcf50, 0xcf48, 0xac64, 0xcf5c, 0xcf54, 0xac5e, + 0xcf62, 0xcf47, 0xac5a, 0xcf59, 0xcf4f, 0xac5f, 0xcf55, 0xac57, + 0xcefc, 0xac68, 0xaee3, 0xac5d, 0xcf4e, 0xcf4d, 0xcf42, 0x9250, + 0xcf5e, 0xcf57, 0x8968, 0xac55, 0x8db6, 0xfcfb, 0xa07d, 0x98fc, + 0x8969, 0xfe4f, 0x9256, 0xd1ec, 0xaeea, 0xd1ed, 0xd1e1, 0xaedf, + 0xaeeb, 0xd1da, 0xfac9, 0xd1e3, 0xd1eb, 0x93e8, 0xd1d9, 0xd1f4, + 0xaed5, 0xfcf8, 0xd1f3, 0xd1ee, 0xd1ef, 0xaedd, 0xaee8, 0xd1e5, + 0xd1e6, 0xd1f0, 0xd1e7, 0xd1e2, 0xd1dc, 0xd1dd, 0xd1ea, 0xd1e4, + 0x9ce3, 0xfda9, 0xaed6, 0xaeda, 0xd1f2, 0xd1de, 0xaee6, 0xaee2, + 0xfc44, 0xaee5, 0xaeec, 0xaedb, 0xaee7, 0xd1e9, 0xaee9, 0xaed8, + 0x9640, 0xaed7, 0xd1db, 0x8db8, 0xd1df, 0xaee0, 0xd1f1, 0xd1e8, + 0xd1e0, 0xaee4, 0xaee1, 0xaed9, 0xaedc, 0x9b4a, 0x8fb9, 0xfcfe, + 0x896a, 0xd5c4, 0xd5b4, 0xd5b5, 0xd5b9, 0xd5c8, 0xd5c5, 0xd5be, + 0xd5bd, 0xb1ed, 0xd5c1, 0xd5d0, 0xd5b0, 0xd5d1, 0xd5c3, 0xd5d5, + 0xd5c9, 0xb1ec, 0xd5c7, 0xb1e7, 0xb1fc, 0xb1f2, 0x8db9, 0xb1f6, + 0xb1f5, 0xd5b1, 0x917e, 0xd5ce, 0xd5d4, 0xd5cc, 0xd5d3, 0xd5c0, + 0xd5b2, 0xd5d2, 0xd5c2, 0xb1ea, 0xb1f7, 0xd5cb, 0xb1f0, 0x93f4, + 0xd5ca, 0xd5b3, 0xb1f8, 0xb1fa, 0xd5cd, 0xb1fb, 0xb1e9, 0xd5ba, + 0xd5cf, 0xfb7c, 0xb1ef, 0xb1f9, 0xd5bc, 0xd5c6, 0xd5b7, 0xd5bb, + 0xb1f4, 0xd5b6, 0xb1e8, 0xb1f1, 0xb1ee, 0xd5bf, 0xaede, 0xd9c0, + 0xb1eb, 0x93e7, 0x97ef, 0xfe4a, 0xfd45, 0xb1f3, 0x96a5, 0xd9c3, + 0xd9d9, 0xd9ce, 0xb4d6, 0xfee0, 0xb4d1, 0xd9bd, 0xb4d2, 0xd9cd, + 0xd9c6, 0xd9d3, 0xb4ce, 0xd9ab, 0xd9d5, 0xb4c4, 0xd9b3, 0xb4c7, + 0xb4c6, 0xb4d7, 0xd9ad, 0xd9cf, 0xd9d0, 0xb4c9, 0xb4c5, 0xd9bb, + 0xb4d0, 0xd9b6, 0xd9d1, 0xb4cc, 0xd9c9, 0xd9d6, 0xd9b0, 0xd9b5, + 0xd9af, 0xb4cb, 0xd9c2, 0xddde, 0xd9b1, 0xb4cf, 0xd9ba, 0xd9d2, + 0xb4ca, 0xd9b7, 0xd9b4, 0xd9c5, 0xb4cd, 0xb4c3, 0xb4d9, 0xd9c8, + 0xd9c7, 0xfd48, 0xfd47, 0xfef2, 0xfe6a, 0xd9ac, 0xb4c8, 0xd9d4, + 0xd9bc, 0xd9be, 0x8dbd, 0xd9cb, 0xd9ca, 0xd9aa, 0xb4d3, 0xb4d5, + 0xd9b2, 0xd9b9, 0xd9c1, 0xb4d4, 0xd9b8, 0xd9c4, 0xd9d7, 0xd9cc, + 0x9ba1, 0x8ca2, 0x9ab7, 0x8efc, 0xd9d8, 0xd9ae, 0x9fa1, 0xddf2, + 0xb7a6, 0xddf0, 0xdddb, 0xdde0, 0xddd9, 0xfd51, 0xddec, 0xddcb, + 0xddd2, 0xddea, 0xddf4, 0xdddc, 0xfaad, 0xddcf, 0xdde2, 0xdde7, + 0xddd3, 0x8dbe, 0xdde4, 0xddd0, 0x89a4, 0xddd7, 0xddd8, 0xb7a8, + 0xddeb, 0xdde9, 0xddcc, 0xddee, 0xddef, 0xddf1, 0xb7ac, 0xb7a4, + 0x9ad9, 0xd5b8, 0xddd4, 0xdde6, 0xddd5, 0xb7a1, 0xb7b1, 0xdded, + 0xb7af, 0xb7ab, 0xddca, 0xb7a3, 0xfd4e, 0xddcd, 0xb7b0, 0x8dc0, + 0xdddd, 0xddc9, 0x97f0, 0xb7a9, 0xdde1, 0xddd1, 0xb7aa, 0xddda, + 0xb77e, 0xb4d8, 0xdde3, 0xd9bf, 0xddce, 0x93b4, 0xfd44, 0xdde8, + 0xb7a5, 0xdde5, 0xb7a2, 0xdddf, 0xb7ad, 0xddd6, 0xddf3, 0x9fa7, + 0xb7a7, 0xdec6, 0x8dc2, 0xb7ae, 0x99b6, 0xe24a, 0xe248, 0xe25e, + 0xe246, 0xe258, 0xb77d, 0xba5f, 0xe242, 0xe25d, 0xfd52, 0xe247, + 0xe255, 0xba64, 0xba5d, 0xe25b, 0x8dc1, 0xe240, 0xe25a, 0x8e46, + 0xba6f, 0xe251, 0xe261, 0xba6d, 0xe249, 0xba5e, 0xe24b, 0xe259, + 0xba67, 0xe244, 0xba6b, 0xba61, 0xe24d, 0xe243, 0xe1fc, 0xa0d1, + 0xe257, 0xba68, 0xe260, 0xe1fd, 0xba65, 0xe253, 0xba66, 0xe245, + 0xe250, 0xe24c, 0xe24e, 0x9fca, 0xba60, 0xe25f, 0xba6e, 0xe24f, + 0xe262, 0xe1fe, 0xe254, 0xba63, 0xba6c, 0xba6a, 0xe241, 0xe256, + 0xba69, 0x92cf, 0xba62, 0xe252, 0x9cf4, 0x8dc4, 0xe25c, 0xfd41, + 0xe5d5, 0xe5d1, 0xe5cd, 0xe5e1, 0xe5de, 0xbccd, 0x9b4c, 0xe5e5, + 0xe5d4, 0xbcd8, 0xe5db, 0xe5d0, 0xe5da, 0xbcd5, 0xe5ee, 0xe5eb, + 0xe5dd, 0xe5ce, 0xfd57, 0xfcef, 0xe5e2, 0xe5e4, 0xbcd1, 0xe5d8, + 0xe5d3, 0xe5ca, 0xbcce, 0xbcd6, 0x9cde, 0xe5e7, 0xbcd7, 0xe5cb, + 0xe5ed, 0xe5e0, 0xe5e6, 0xbcd4, 0xfd42, 0x986c, 0xe5e3, 0xe5ea, + 0xbcd9, 0xbcd3, 0xe5dc, 0xe5cf, 0xe5ef, 0xe5cc, 0xe5e8, 0xbcd0, + 0x97f9, 0xe5d6, 0x9558, 0xe5d7, 0xbccf, 0xbccc, 0xe5d2, 0xbcd2, + 0xbccb, 0xe5e9, 0xe5ec, 0xe5d9, 0xe9ca, 0x985e, 0xfe7b, 0x94cd, + 0xe9c2, 0x93ee, 0xe9be, 0xbef6, 0xbeeb, 0xbef0, 0xbeec, 0xe9cc, + 0xe9d7, 0xbeea, 0xe9c4, 0xe9cd, 0xe5df, 0xe9ce, 0x8ca3, 0xbef1, + 0xfd5a, 0xe9dd, 0xbef5, 0xbef8, 0xe9c0, 0xbef4, 0x93f5, 0xe9db, + 0xe9dc, 0xe9d2, 0xe9d1, 0xe9c9, 0x93ef, 0x8eea, 0xe9d3, 0xe9da, + 0xe9d9, 0x8f5b, 0xbeef, 0xbeed, 0xe9cb, 0xe9c8, 0xe9c5, 0xe9d8, + 0xbef7, 0xe9d6, 0xbef3, 0xbef2, 0x8c5e, 0xe9d0, 0x8dc6, 0xe9bf, + 0xe9c1, 0xe9c3, 0xe9d5, 0xe9cf, 0xbeee, 0xe9c6, 0xe9d4, 0x8dc8, + 0x8dc7, 0xe9c7, 0x93f7, 0xc0cf, 0xed45, 0xc0c8, 0xecf5, 0x8dc9, + 0xed41, 0xc0ca, 0xed48, 0xecfc, 0xecf7, 0xfbf2, 0xed49, 0xecf3, + 0xecfe, 0x9670, 0xc0d1, 0xed44, 0xed4a, 0xecfd, 0xc0c9, 0xed40, + 0xecf4, 0xc0d0, 0x8dcb, 0xed47, 0xecf9, 0xc0cc, 0xfd5c, 0xecfb, + 0xecf8, 0xc0d2, 0xecfa, 0xc0cb, 0xc0ce, 0xed43, 0xecf6, 0xed46, + 0x8f65, 0xed42, 0x8dcd, 0xc263, 0xefe7, 0xc268, 0xc269, 0x9da8, + 0x94f9, 0xc262, 0xefe6, 0x8dce, 0xefe3, 0xefe4, 0xc266, 0xefde, + 0xefe2, 0xc265, 0xefdf, 0x93ea, 0xc267, 0xc264, 0xefdd, 0xefe1, + 0xefe5, 0xfd5f, 0x93f0, 0x9fb6, 0xf251, 0xf24e, 0xf257, 0xf256, + 0xf254, 0xf24f, 0xc372, 0x8dcf, 0x9763, 0xf250, 0xc371, 0xc0cd, + 0xf253, 0xc370, 0xf258, 0xf252, 0xf24d, 0xefe0, 0xc36f, 0xf24c, + 0xf456, 0xf455, 0xf255, 0xc468, 0xf459, 0xf45a, 0xf454, 0xf458, + 0xf453, 0x8dd0, 0xf5d1, 0xf457, 0xc4e7, 0xc4e5, 0xf5cf, 0xf5d2, + 0xf5ce, 0xf5d0, 0xc4e6, 0x93f1, 0xf6e5, 0xf6e6, 0xc576, 0xf6e4, + 0xf7e2, 0xc5cf, 0xf7e0, 0xf7e1, 0xf8ac, 0xc656, 0xf8f3, 0xf8f1, + 0xf8f2, 0xf8f4, 0xfd62, 0xf9bb, 0xa4ed, 0xa6b8, 0xaa59, 0xcce9, + 0xcf64, 0xd1f5, 0xd1f7, 0xd1f6, 0xd1f8, 0xb1fd, 0xd5d7, 0xd1f9, + 0xfd65, 0xd5d6, 0xd5d8, 0xd5d9, 0xd9da, 0xb4db, 0xd9db, 0xd9dd, + 0xb4dc, 0xb4da, 0xd9dc, 0xddfa, 0xddf8, 0xddf7, 0xddf6, 0xddf5, + 0xb7b2, 0xddf9, 0xba70, 0xe263, 0xe265, 0xba71, 0xe264, 0xbcdb, + 0xbcda, 0xe5f0, 0x9fdb, 0xe9df, 0xe9de, 0xe9e0, 0x93f8, 0xbef9, + 0xed4b, 0xc0d3, 0xefe8, 0xc26a, 0xf259, 0xc577, 0xa4ee, 0xa5bf, + 0xa6b9, 0xa842, 0xaa5a, 0xaa5b, 0xac6e, 0xd1fa, 0x8bf7, 0xb7b3, + 0xfd66, 0xe6d1, 0xbefa, 0xc26b, 0xa4ef, 0x8bcf, 0xa6ba, 0xcceb, + 0xaa5c, 0xccea, 0x8dd1, 0xcf65, 0xac6f, 0xcf66, 0xac70, 0xd1fc, + 0xaeee, 0xaeed, 0xd5de, 0xd5dc, 0xd5dd, 0xd5db, 0xd5da, 0xd9de, + 0xd9e1, 0xb4de, 0xd9df, 0xb4dd, 0xd9e0, 0xddfb, 0xe266, 0xe267, + 0xe268, 0xe5f3, 0xe5f2, 0xbcdc, 0xe5f1, 0xe5f4, 0xe9e1, 0xe9e2, + 0xe9e3, 0xed4c, 0xc0d4, 0xc26c, 0xf25a, 0xc4e8, 0xc95f, 0xac71, + 0xcf67, 0xaeef, 0xb1fe, 0xb4df, 0xd9e2, 0xb7b5, 0xb7b4, 0x8dd2, + 0xe269, 0xe26a, 0xbcdd, 0xbcde, 0xe9e5, 0xe9e4, 0xefe9, 0xf7e3, + 0xa4f0, 0xc960, 0xa5c0, 0xa843, 0xcb48, 0xac72, 0xb7b6, 0xa4f1, + 0xcf68, 0xac73, 0xcf69, 0xc0d5, 0xa4f2, 0xfd71, 0xccec, 0xcf6a, + 0xfd6f, 0xd242, 0xd241, 0xd1fe, 0xd1fd, 0xd243, 0xd240, 0x8dd3, + 0xb240, 0xb241, 0xb4e0, 0xd9e3, 0xd9e4, 0xd9e5, 0xde41, 0xde42, + 0xde40, 0x9fe7, 0xddfd, 0xddfe, 0xb7b7, 0xe26b, 0xe5f7, 0xe5f6, + 0xe5f5, 0xe5f8, 0xe9e7, 0xe9e6, 0xbefb, 0xe9e8, 0xc0d6, 0xed4d, + 0xefea, 0xf25b, 0xf6e7, 0xa4f3, 0xa5c2, 0xa5c1, 0xaa5d, 0xc961, + 0xc97e, 0xa6bb, 0xc9f7, 0xcb49, 0xcb4a, 0xaa5e, 0x90bd, 0xcced, + 0xac74, 0xcf6b, 0xcf6c, 0xaef0, 0xaef4, 0xd244, 0xaef3, 0xaef1, + 0xaef2, 0xd5df, 0xb242, 0xb4e3, 0xb4e1, 0xb4e2, 0xd9e6, 0x9fd0, + 0xba72, 0xa4f4, 0x8bd0, 0xc9a1, 0xfd72, 0xa5c3, 0x9cae, 0x8bd1, + 0xc9a4, 0x8adb, 0xa5c6, 0xc9a3, 0xa5c5, 0xa5c4, 0xa844, 0xc9a2, + 0xc9f8, 0xfae4, 0xc9fc, 0xc9fe, 0xca40, 0xa6c5, 0xa6c6, 0xc9fb, + 0xa6c1, 0xc9f9, 0xc9fd, 0xa6c2, 0xa6bd, 0x95ce, 0xa6be, 0xfd76, + 0xa6c4, 0xc9fa, 0xa6bc, 0xa845, 0xa6bf, 0xa6c0, 0xa6c3, 0xcb5b, + 0xcb59, 0xcb4c, 0xa851, 0xcb53, 0xa84c, 0xcb4d, 0xcb55, 0xfb62, + 0xcb52, 0xa84f, 0xcb51, 0xa856, 0xcb5a, 0xa858, 0x8dd4, 0xa85a, + 0xcb4b, 0xfd78, 0xa84d, 0xcb5c, 0xa854, 0xa857, 0x8ee3, 0xcd45, + 0xa847, 0xa85e, 0xa855, 0xcb4e, 0xa84a, 0xa859, 0xcb56, 0xa848, + 0xa849, 0xcd43, 0xcb4f, 0xa850, 0xa85b, 0xcb5d, 0xcb50, 0xa84e, + 0xa853, 0xccee, 0xa85c, 0xcb57, 0xa852, 0xa85d, 0xa846, 0xcb54, + 0xa84b, 0xcb58, 0xcd44, 0x9076, 0x98c6, 0x8dd5, 0xaa6a, 0xaa7a, + 0xccf5, 0xaa71, 0x97d1, 0xcd4b, 0xaa62, 0x9eb6, 0xaa65, 0xcd42, + 0xccf3, 0xccf7, 0xaa6d, 0xaa6f, 0xccfa, 0xaa76, 0xaa68, 0xaa66, + 0xaa67, 0xaa75, 0xcd47, 0xaa70, 0xccf9, 0xccfb, 0xaa6e, 0xaa73, + 0xccfc, 0xcd4a, 0xac75, 0xaa79, 0xfac7, 0xaa63, 0xcd49, 0xa042, + 0xcd4d, 0xccf8, 0xcd4f, 0xcd40, 0xaa6c, 0xccf4, 0xaa6b, 0xaa7d, + 0xaa72, 0xccf2, 0xcf75, 0xaa78, 0xaa7c, 0xcd41, 0xcd46, 0x9873, + 0xaa7e, 0xaa77, 0xaa69, 0xaa5f, 0xaa64, 0xccf6, 0xaa60, 0xcd4e, + 0x9ffc, 0xccf0, 0xccef, 0xccfd, 0xccf1, 0xaa7b, 0xaef5, 0xaa74, + 0xccfe, 0xaa61, 0xaca6, 0xcd4c, 0x8ca5, 0xcf7c, 0xcfa1, 0x8dd7, + 0xcfa4, 0xcf77, 0x92fb, 0x8dd8, 0xcfa7, 0xcfaa, 0xcfac, 0xcf74, + 0xac76, 0xac7b, 0xd249, 0xacad, 0xcfa5, 0xcfad, 0xcf7b, 0xcf73, + 0xd264, 0xac7e, 0xcfa2, 0xcf78, 0xcf7a, 0xaca5, 0xcf7d, 0xac7d, + 0xcf70, 0xcfa8, 0xcfab, 0x944f, 0xac7a, 0x8dd9, 0xaca8, 0xcf6d, + 0xacaa, 0xac78, 0xacae, 0xcfa9, 0xcf6f, 0xacab, 0xd25e, 0xcd48, + 0xac7c, 0xac77, 0xcf76, 0xcf6e, 0xacac, 0xaca4, 0xcfa3, 0xaca9, + 0xaca7, 0xcf79, 0xaca1, 0xcf71, 0xaca2, 0xaca3, 0xcf72, 0xcfa6, + 0xac79, 0xcf7e, 0x896b, 0x97ce, 0xd24c, 0xaefd, 0xaf43, 0xfaf3, + 0xfdae, 0xd255, 0xd25b, 0xd257, 0xd24a, 0xd24d, 0xd246, 0xd247, + 0xaf4a, 0xaefa, 0xd256, 0xd25f, 0xaf45, 0xaef6, 0xaf40, 0xd24e, + 0xaf42, 0xd24f, 0xd259, 0xfbaf, 0x92b7, 0xaf44, 0xd268, 0xd248, + 0xaefc, 0xaefb, 0xaf48, 0xd245, 0xd266, 0xd25a, 0xd267, 0xd261, + 0xd253, 0xd262, 0x8dda, 0xd25c, 0xd265, 0xd263, 0xaf49, 0xd254, + 0xaef9, 0xaef8, 0xaf41, 0xaf47, 0xd260, 0xaf46, 0xd251, 0xb243, + 0x9c5a, 0xd269, 0xd250, 0xd24b, 0xaefe, 0xaf4b, 0xaef7, 0xfdad, + 0xd258, 0xd25d, 0x8ddc, 0x9444, 0xb265, 0xd5e1, 0xd5e5, 0xb252, + 0xb250, 0x8ddd, 0xb247, 0xd5e3, 0xd5e2, 0xb25b, 0xd5e8, 0xb255, + 0xa0d6, 0xd5fa, 0xd647, 0xb244, 0xd5f7, 0xd5f0, 0xb267, 0xd5e0, + 0xd5fc, 0xb264, 0xb258, 0xb263, 0xb24e, 0xd5ec, 0xd5fe, 0xd5f6, + 0xb24f, 0xb249, 0xd645, 0xd5fd, 0xd640, 0xb251, 0xb259, 0xd642, + 0xd5ea, 0xd5fb, 0xd5ef, 0xd644, 0xb25e, 0xb246, 0xb25c, 0xd5f4, + 0xd5f2, 0xd5f3, 0xb253, 0xd5ee, 0xd5ed, 0xb248, 0xd5e7, 0xd646, + 0xb24a, 0xd5f1, 0xb268, 0xb262, 0xd5e6, 0xb25f, 0xb25d, 0xb266, + 0xd5f8, 0xb261, 0xd252, 0xd5f9, 0xb260, 0xd641, 0xb245, 0xd5f5, + 0xb257, 0xd5e9, 0xb256, 0xb254, 0xb24c, 0xb24b, 0xd9e7, 0xd643, + 0x8c41, 0xd5eb, 0x97d5, 0xd9fc, 0x944a, 0xb24d, 0x944d, 0x97cb, + 0x8dde, 0x8ddf, 0xb541, 0xb25a, 0xb4ee, 0xd9f6, 0xb4fc, 0xd9ea, + 0xb4eb, 0xb4e7, 0xda49, 0xb4ed, 0xb4f1, 0xb4ec, 0xb4f5, 0xda4d, + 0xda44, 0x8de0, 0xfef9, 0xd9f1, 0xb4fa, 0xb4f4, 0xd9fd, 0xb4e4, + 0xda4a, 0xda43, 0xb4e8, 0xd9f7, 0xb4f7, 0xda55, 0xda56, 0xb4e5, + 0xda48, 0xb4f9, 0xd9fb, 0xd9ed, 0xd9ee, 0xb4fd, 0xd9f2, 0xd9f9, + 0xd9f3, 0xb4fb, 0xb544, 0xd9ef, 0xd9e8, 0xd9e9, 0xd9eb, 0xb4ea, + 0xd9f8, 0xb4f8, 0xb542, 0xfdc0, 0xfcf9, 0xd9fa, 0xda53, 0xda4b, + 0xb4e6, 0xda51, 0xb4f2, 0xb4f0, 0xfb7e, 0xda57, 0xb4ef, 0xda41, + 0xd9f4, 0xd9fe, 0xb547, 0xda45, 0xda42, 0xd9f0, 0xb543, 0xda4f, + 0xda4c, 0xda54, 0xb4e9, 0xda40, 0xb546, 0xda47, 0xb4f3, 0xb4f6, + 0xda46, 0xb545, 0xd9f5, 0xd5e4, 0x92b3, 0xda50, 0xda4e, 0xda52, + 0xfdaf, 0x8de1, 0xd9ec, 0xb540, 0x95d3, 0xde61, 0xde60, 0xde46, + 0xb7bd, 0xde5f, 0xde49, 0xde4a, 0xb7c7, 0xde68, 0xb7c2, 0xde5e, + 0x89c1, 0xde43, 0xb7c8, 0xb7be, 0xde52, 0xde48, 0xde4b, 0xde63, + 0xb7b8, 0xde6a, 0xde62, 0xb7c1, 0xde57, 0xb7cc, 0xb7cb, 0xb7c5, + 0xde69, 0xb7b9, 0xde55, 0xde4c, 0xde59, 0xde65, 0xb7cd, 0xfd68, + 0xb7bb, 0xde54, 0x9cb7, 0xde4d, 0xb7c4, 0x8de3, 0xb7c3, 0xde50, + 0xde5a, 0xde64, 0xde47, 0xde51, 0xb7bc, 0xde5b, 0xb7c9, 0xb7c0, + 0xde4e, 0xb7bf, 0xde45, 0xde53, 0xde67, 0xb4fe, 0xbab0, 0xde56, + 0xe26c, 0xde58, 0xde66, 0xb7c6, 0xde4f, 0xb7ba, 0xb7ca, 0xbcf0, + 0xde44, 0xde5d, 0xfac0, 0x8de5, 0xfa64, 0xde5c, 0x8947, 0x8de4, + 0x8de7, 0x8de8, 0xe2aa, 0xbaad, 0xe27d, 0xe2a4, 0xbaa2, 0xe26e, + 0xbaaf, 0xba77, 0xe26d, 0xe2b0, 0xbab1, 0xe271, 0xe2a3, 0xfdc7, + 0xe273, 0xe2b3, 0xe2af, 0xba75, 0xbaa1, 0xe653, 0xbaae, 0xba7d, + 0xe26f, 0xfdb0, 0xe2ae, 0xbaa3, 0xe2ab, 0xe2b8, 0xe275, 0xe27e, + 0x9445, 0x97d6, 0xe2b6, 0xe2ac, 0xba7c, 0xe27c, 0xba76, 0xba74, + 0xbaa8, 0xfcc6, 0x9844, 0xe27a, 0xe277, 0xe278, 0xe2b2, 0xe2b7, + 0xe2b5, 0xba7a, 0xe2b9, 0xba7e, 0xbaa7, 0x8de9, 0xe270, 0xe5fa, + 0xe279, 0xba78, 0xbaac, 0xbaa9, 0xba7b, 0xe2a5, 0xe274, 0xbaaa, + 0xe2a7, 0xbaa4, 0xbaa6, 0xba73, 0x8dea, 0xe2a9, 0xe2a1, 0xe272, + 0xbaa5, 0xe2b1, 0xe2b4, 0xe27b, 0xe2a8, 0xfe50, 0xba79, 0xbcdf, + 0xe2a6, 0xe5f9, 0xe2ad, 0xfdcc, 0xe276, 0xe644, 0xe64e, 0xbce2, + 0xe64d, 0xe659, 0xbce4, 0xe64b, 0x9da7, 0xe64f, 0xbcef, 0xe646, + 0xbce7, 0xfdcd, 0xe652, 0xe9f0, 0xbcf3, 0xbcf2, 0xe654, 0xe643, + 0xe65e, 0xbced, 0xbce3, 0xe657, 0xe65b, 0xe660, 0xe655, 0xe649, + 0xbce6, 0xbce9, 0xbcf1, 0xbcec, 0xe64c, 0xe2a2, 0xfdcf, 0xe648, + 0xe65f, 0xbce8, 0x95d2, 0xbceb, 0xe661, 0xbce0, 0xe656, 0xe5fb, + 0xe65c, 0xc0df, 0x8ded, 0xe64a, 0xbce1, 0xe645, 0xbce5, 0xe5fc, + 0xbaab, 0xe641, 0xfcba, 0xe65a, 0xe642, 0xe640, 0xbcea, 0xe658, + 0xe5fe, 0xe651, 0xe650, 0xe65d, 0xe647, 0xbcee, 0xfdc5, 0xe9f3, + 0xfdd2, 0xbf49, 0xbefe, 0xea40, 0xe9eb, 0xbf41, 0xe9f7, 0xbf48, + 0xbf43, 0xe9f5, 0xed4f, 0xe9fb, 0xea42, 0xe9fa, 0xe9e9, 0xe9f8, + 0xea44, 0xea46, 0xbefd, 0xea45, 0xbf44, 0xbf4a, 0x9cdc, 0xbf47, + 0xe9fe, 0xbf46, 0xe9f9, 0x95cf, 0xe9ed, 0xe9f2, 0x8dee, 0xe9fd, + 0xbf45, 0xbf42, 0xbefc, 0xbf40, 0xe9f1, 0xe5fd, 0xe9ec, 0xe9ef, + 0xea41, 0xe9f4, 0xe9ea, 0xed4e, 0xea43, 0xe9ee, 0xe9fc, 0xfdd4, + 0xed51, 0xc0e3, 0xc0d7, 0x96ec, 0x96eb, 0xc0db, 0xed53, 0xed59, + 0xed57, 0xc0d9, 0xc0da, 0xc0e1, 0xed5a, 0xed52, 0xc0dc, 0xed56, + 0xed55, 0xed5b, 0xc0e2, 0xc0dd, 0xc0e0, 0xed54, 0xc0e4, 0xc0de, + 0xc0e5, 0xc0d8, 0xed58, 0xed50, 0x90b6, 0xeff7, 0xfdc3, 0xc271, + 0xeff4, 0xeff6, 0xc26f, 0xeff2, 0xeff3, 0xefee, 0x98ab, 0xe9f6, + 0xefef, 0xc270, 0xefeb, 0xc26d, 0xeff8, 0xc26e, 0xefec, 0xefed, + 0xeff1, 0xc273, 0xc272, 0xeff0, 0xc378, 0xf25f, 0xf265, 0xc379, + 0xf25c, 0xc376, 0xc373, 0xf267, 0xc377, 0x96ee, 0xc374, 0xf25e, + 0xf261, 0xf262, 0xf263, 0xf266, 0xeff5, 0xf25d, 0xc375, 0xf264, + 0xf268, 0xf260, 0x8df4, 0xf45d, 0xc46a, 0xf460, 0xc46b, 0xf468, + 0xf45f, 0xf45c, 0xf45e, 0xf462, 0xf465, 0xf464, 0xf467, 0xf45b, + 0xc469, 0xf463, 0xf466, 0xf469, 0xf461, 0xf5d3, 0xf5d4, 0xf5d8, + 0xf5d9, 0xf5d6, 0xf5d7, 0xf5d5, 0xfde0, 0xc4e9, 0x8c67, 0x8df6, + 0xc578, 0xf6eb, 0x8df7, 0xf6e8, 0xf6e9, 0xf6ea, 0xc579, 0xf7e5, + 0xf7e4, 0x8ffa, 0xf8af, 0xc5f4, 0xf8ad, 0xf8b0, 0xf8ae, 0xf8f5, + 0xc657, 0xc665, 0xf9a3, 0xf96c, 0x97d0, 0xf9a2, 0xf9d0, 0xf9d1, + 0xa4f5, 0x8bd2, 0x8df8, 0xa6c7, 0xca41, 0xcb5e, 0x90d9, 0xa85f, + 0x8c47, 0xa862, 0xfaf0, 0xcb5f, 0xa860, 0xa861, 0xfde1, 0x8df9, + 0xfde3, 0xcd58, 0xcd5a, 0xcd55, 0xcd52, 0xcd54, 0x8dfa, 0xaaa4, + 0xfb63, 0xaaa2, 0x90a6, 0xcd56, 0xaaa3, 0xcd53, 0xcd50, 0xaaa1, + 0xcd57, 0xcd51, 0xaaa5, 0xcd59, 0xcfaf, 0x9970, 0xcfb3, 0x91eb, + 0xacb7, 0x9770, 0x986f, 0xfde2, 0xcfb6, 0xacaf, 0xacb2, 0xacb4, + 0xacb6, 0xacb3, 0xcfb2, 0xcfb1, 0xacb1, 0xcfb4, 0xcfb5, 0xcfae, + 0xacb5, 0x98f2, 0xacb0, 0x9afc, 0x896c, 0xfdfd, 0xcfb0, 0x995e, + 0x95bd, 0xd277, 0xd278, 0xd279, 0xaf50, 0xaf4c, 0xd26e, 0xfde4, + 0xd276, 0xd27b, 0xaf51, 0x91e6, 0xd26c, 0xd272, 0xd26b, 0xd275, + 0xfde5, 0xfde6, 0xd271, 0xaf4d, 0xaf4f, 0xd27a, 0xd26a, 0xd26d, + 0xd273, 0xfde7, 0xd274, 0xd27c, 0xd270, 0xaf4e, 0xb26d, 0xd64e, + 0x9454, 0xd650, 0xd64c, 0x99b8, 0xd658, 0xd64a, 0xd657, 0xb269, + 0xd648, 0xda5b, 0xd652, 0xb26c, 0x97e9, 0xd653, 0xd656, 0xd65a, + 0xd64f, 0x9346, 0xd654, 0xb26a, 0xb26b, 0xd659, 0xd64d, 0xd649, + 0xd65b, 0xd651, 0xd655, 0xd64b, 0xb548, 0xb549, 0xda65, 0xb54f, + 0x9863, 0xda59, 0xda62, 0xda58, 0xb54c, 0xda60, 0xda5e, 0xda5f, + 0xb54a, 0xda63, 0x95bc, 0xfded, 0xfdf7, 0xda5c, 0xda5a, 0xb54b, + 0xda5d, 0xda61, 0x9870, 0x96f6, 0x8ea9, 0xb54d, 0xda64, 0x9451, + 0x8e43, 0x8b5a, 0xde70, 0xde77, 0xde79, 0xdea1, 0xfdee, 0xb7da, + 0xde6b, 0xb7d2, 0xfdf0, 0xde7a, 0xb7d7, 0xdea2, 0xb7ce, 0xfdf4, + 0xde7d, 0x9bf5, 0xde6d, 0xde7e, 0xde6c, 0xb7dc, 0xde78, 0xb7cf, + 0xdea3, 0xb7d4, 0xde71, 0xb7d9, 0xde7c, 0xde6f, 0xde76, 0xde72, + 0xde6e, 0xb7d1, 0xb7d8, 0xb7d6, 0xb7d3, 0xb7db, 0xb7d0, 0xde75, + 0x977e, 0xb7d5, 0xb54e, 0xde7b, 0x9bd5, 0xde73, 0x9ac3, 0x97c8, + 0xa0db, 0x91d0, 0xde74, 0x9fe4, 0xe2c1, 0x8fdd, 0xbab4, 0x91e9, + 0xe2bd, 0xe2c3, 0xe2bf, 0xbab6, 0xe2be, 0xe2c2, 0xe2ba, 0x98e0, + 0xe2bc, 0xbab5, 0x92ca, 0x9857, 0xe2c0, 0xe2bb, 0x8c51, 0xbab7, + 0xbab2, 0xfdeb, 0xe2c4, 0x9b49, 0xbab3, 0xe667, 0xe664, 0xe670, + 0xe66a, 0xe66c, 0xbcf4, 0xe666, 0xe66e, 0x9d76, 0x9eaf, 0xe66d, + 0xe66b, 0xe671, 0xbcf7, 0xe668, 0xe66f, 0xbcf5, 0x9ccc, 0xe663, + 0xe665, 0xbcf6, 0xe662, 0xe672, 0xfdea, 0xe669, 0x8df1, 0xea4a, + 0xbf51, 0xfdfb, 0xea55, 0xea53, 0xbf4b, 0xea49, 0xea4c, 0xea4d, + 0xea48, 0xbf55, 0xbf56, 0xea47, 0xea56, 0xea51, 0xbf4f, 0xbf4c, + 0xea50, 0xea4e, 0xbf52, 0xea52, 0xbf4d, 0x8e53, 0xbf4e, 0xea4f, + 0xbf50, 0xea4b, 0xea54, 0xbf53, 0xea57, 0xea58, 0xbf54, 0xfacf, + 0xc0e7, 0xc0ee, 0xed5c, 0xed62, 0xed60, 0xc0ea, 0xc0e9, 0xc0e6, + 0xed5e, 0x96f9, 0xc0ec, 0xc0eb, 0xc0e8, 0xed61, 0xed5d, 0xed5f, + 0xc0ed, 0x98bf, 0x9e49, 0xc277, 0xeffb, 0xc274, 0xc275, 0xeffd, + 0xc276, 0xeffa, 0x8ca7, 0xeff9, 0xf26c, 0xeffc, 0xf26d, 0xc37a, + 0xf26b, 0x9bca, 0xf26a, 0xf269, 0xc37b, 0xfdfe, 0x92dc, 0xc46c, + 0xf46a, 0xf46b, 0xfe41, 0x91cc, 0x91e2, 0xf5dc, 0xf5db, 0xc4ea, + 0xf5da, 0xf6ec, 0xf6ed, 0xf7e6, 0xf8b1, 0xfe44, 0xf8f6, 0xf9bc, + 0xc679, 0xf9c6, 0xa4f6, 0x8bd3, 0xaaa6, 0xaaa7, 0xfe47, 0xacb8, + 0xc0ef, 0xa4f7, 0xaaa8, 0xaf52, 0xb7dd, 0xa4f8, 0xb26e, 0xbab8, + 0xc962, 0xfe48, 0xcfb7, 0xd27d, 0xe2c5, 0xc0f0, 0xa4f9, 0xaaa9, + 0xcfb8, 0xcfb9, 0xda66, 0xb550, 0xdea4, 0x9455, 0xb7de, 0xe2c6, + 0xfe4b, 0xbcf8, 0xfe4c, 0xc37c, 0xa4fa, 0xda67, 0xa4fb, 0x8dbf, + 0xa6c9, 0xca42, 0xa6c8, 0xa865, 0xa864, 0xa863, 0xcb60, 0x9e78, + 0xaaaa, 0xaaab, 0xcd5b, 0xcfba, 0xcfbd, 0xacba, 0xcfbb, 0xacb9, + 0xcfbc, 0xacbb, 0xd2a2, 0xd2a1, 0xd27e, 0xaf53, 0xd65d, 0xd65e, + 0xb26f, 0xd65c, 0xd65f, 0xb552, 0xb270, 0xfe51, 0xb551, 0xda6b, + 0xda6a, 0x9456, 0xda68, 0xda69, 0xda6c, 0xdea6, 0xdea5, 0xdea9, + 0x9d61, 0xdea8, 0xdea7, 0xbab9, 0xe2c9, 0x9457, 0xe2c8, 0xbaba, + 0xe2c7, 0xe673, 0xe674, 0xbcf9, 0xea59, 0xea5a, 0x9966, 0xf272, + 0xc37d, 0xf271, 0xf270, 0xf26e, 0xf26f, 0xc4eb, 0xf46c, 0xf6ee, + 0xf8f7, 0xa4fc, 0x8bd5, 0xc9a5, 0xa5c7, 0xc9a6, 0xa069, 0xca43, + 0xca44, 0xcb66, 0xcb62, 0xcb61, 0xaaac, 0xcb65, 0xa867, 0xcb63, + 0xa866, 0xcb67, 0xcb64, 0xcd5f, 0xcfbe, 0xcd5d, 0xcd64, 0x98b4, + 0xaaad, 0xaab0, 0xcd65, 0xcd61, 0xcd62, 0xcd5c, 0xaaaf, 0xcd5e, + 0xaaae, 0xcd63, 0xcd60, 0xcfc2, 0xacbd, 0xacbe, 0xa049, 0xcfc5, + 0xcfbf, 0xcfc4, 0xcfc0, 0xacbc, 0xcfc3, 0xcfc1, 0xd2a8, 0xd2a5, + 0xd2a7, 0xaf58, 0xaf57, 0xaf55, 0xd2a4, 0xd2a9, 0xaf54, 0xaf56, + 0xd2a6, 0xd667, 0xd2a3, 0xd2aa, 0xa04c, 0x9e65, 0xd662, 0xd666, + 0xd665, 0xda6e, 0xda79, 0xd668, 0x98b5, 0xd663, 0xda6d, 0xb274, + 0xb273, 0xd661, 0xd664, 0xb275, 0xb272, 0xb271, 0xd660, 0xd669, + 0xda70, 0xda77, 0xb554, 0xda76, 0xda73, 0xfe58, 0xb556, 0x9975, + 0xfe53, 0xa065, 0xda75, 0xfe59, 0xda6f, 0xda71, 0xda74, 0xda72, + 0xb555, 0xda78, 0xb553, 0xb7df, 0x98b7, 0x98b8, 0xdead, 0xdeac, + 0xdeaa, 0xb7e2, 0xb7e1, 0xdeae, 0x98ba, 0xdeab, 0xe2ca, 0xbabb, + 0xb7e0, 0x98bb, 0xdeb0, 0xdeaf, 0xe2cd, 0xe2cb, 0xbcfa, 0x9fbc, + 0xbabc, 0xe2cc, 0xe676, 0xbcfb, 0xe675, 0xe67e, 0xe67d, 0xe67b, + 0xe67a, 0xe677, 0xe678, 0xe679, 0xe67c, 0xe6a1, 0xea5f, 0xea5c, + 0xea5d, 0xbf57, 0xea5b, 0xea61, 0xea60, 0xea5e, 0xed64, 0xed65, + 0xc0f1, 0xa04a, 0xc0f2, 0xed63, 0x9ec7, 0xc279, 0xeffe, 0xc278, + 0xc37e, 0xc3a1, 0xc46d, 0xf46e, 0xf46d, 0xf5dd, 0xf6ef, 0xc57a, + 0xf7e8, 0xf7e7, 0xf7e9, 0xa5c8, 0xcfc6, 0xaf59, 0xb276, 0xd66a, + 0xa5c9, 0xc9a7, 0xa4fd, 0x8ca9, 0xca45, 0x98ae, 0xcb6c, 0xcb6a, + 0xcb6b, 0xcb68, 0xa868, 0xcb69, 0x92d6, 0xfae1, 0xcd6d, 0x91d4, + 0xaab3, 0xcd6b, 0xcd67, 0xcd6a, 0xcd66, 0xaab5, 0xcd69, 0xfade, + 0xaab2, 0xaab1, 0xfe5b, 0xaab4, 0xcd6c, 0xcd68, 0xacc2, 0xacc5, + 0xcfce, 0xcfcd, 0xcfcc, 0xacbf, 0xcfd5, 0xcfcb, 0x8c53, 0xacc1, + 0xd2af, 0xcfd2, 0xcfd0, 0xacc4, 0xcfc8, 0xcfd3, 0xcfca, 0xcfd4, + 0xcfd1, 0xcfc9, 0xfe5e, 0xacc0, 0xcfd6, 0xcfc7, 0xacc3, 0xfbd7, + 0xfe5a, 0x94c5, 0xd2b4, 0xd2ab, 0xd2b6, 0xfaca, 0xd2ae, 0xd2b9, + 0xd2ba, 0xd2ac, 0xd2b8, 0xd2b5, 0xd2b3, 0xd2b7, 0xaf5f, 0xaf5d, + 0x98c1, 0x975c, 0xd2b1, 0xfe74, 0xd2ad, 0x9773, 0xd2b0, 0xd2bb, + 0xd2b2, 0xaf5e, 0xcfcf, 0xaf5a, 0xaf5c, 0xfa46, 0x9764, 0xd678, + 0xd66d, 0xd66b, 0xfe68, 0xd66c, 0x964e, 0xd673, 0x9765, 0xd674, + 0xd670, 0xb27b, 0xd675, 0xd672, 0xd66f, 0x8c5a, 0xb279, 0xd66e, + 0xb277, 0xb27a, 0xd671, 0xd679, 0xaf5b, 0xb278, 0xd677, 0xd676, + 0xb27c, 0x89a1, 0x95fa, 0x92d4, 0xfe69, 0xda7e, 0xfb45, 0x98c8, + 0xdaa1, 0xb560, 0x90ef, 0xdaa7, 0x98c9, 0x98ca, 0xdaa9, 0xdaa2, + 0xb55a, 0xdaa6, 0xdaa5, 0xb55b, 0xb561, 0xb562, 0xdaa8, 0xb558, + 0xda7d, 0xda7b, 0xdaa3, 0xda7a, 0xb55f, 0xda7c, 0xdaa4, 0xdaaa, + 0xb559, 0xb55e, 0xb55c, 0xb55d, 0x946d, 0x94b7, 0xfe6c, 0xb557, + 0x946b, 0xb7e9, 0xdeb7, 0xb7e8, 0xdebb, 0x92fc, 0xdeb1, 0x95eb, + 0xdebc, 0xfe73, 0x976e, 0xfe5f, 0xdeb2, 0xdeb3, 0xdebd, 0xdeba, + 0xdeb8, 0xdeb9, 0xdeb5, 0xdeb4, 0xfdbd, 0xdebe, 0xb7e5, 0x92d5, + 0xdeb6, 0xb7ea, 0xb7e4, 0xb7eb, 0xb7ec, 0xfeb9, 0xb7e7, 0xb7e6, + 0xfe71, 0xe2ce, 0xbabe, 0xbabd, 0xfbbb, 0xe2d3, 0x947a, 0xbcfc, + 0xbabf, 0x95fb, 0xfe77, 0xbac1, 0xe2d4, 0xb7e3, 0xbac0, 0xe2d0, + 0xe2d2, 0xe2cf, 0xfe79, 0xe2d1, 0xfe75, 0xe6ab, 0x945d, 0xe6aa, + 0xe6a7, 0xbd40, 0xea62, 0xbd41, 0xe6a6, 0xfe7c, 0xbcfe, 0xe6a8, + 0xe6a5, 0xe6a2, 0xe6a9, 0xe6a3, 0xe6a4, 0xbcfd, 0x9344, 0x8ea6, + 0xed69, 0xea66, 0xea65, 0xea67, 0xed66, 0xbf5a, 0x92d3, 0xea63, + 0x94b8, 0xbf58, 0xbf5c, 0xbf5b, 0xea64, 0xea68, 0xbf59, 0xfc71, + 0xed6d, 0xc0f5, 0xc27a, 0xc0f6, 0xc0f3, 0xed6a, 0xed68, 0xed6b, + 0xed6e, 0xc0f4, 0xed6c, 0xed67, 0x975e, 0xf042, 0xf045, 0xf275, + 0xf040, 0x8cad, 0xf46f, 0xf046, 0xc3a2, 0xf044, 0xc27b, 0xf041, + 0xf043, 0xf047, 0xf276, 0xf274, 0xfea7, 0xc3a3, 0xf273, 0x946a, + 0xc46e, 0x93e3, 0x98cf, 0xc4ed, 0xf6f1, 0xc4ec, 0xf6f3, 0xf6f0, + 0xf6f2, 0xc5d0, 0xf8b2, 0xa5ca, 0xcd6e, 0xd2bc, 0xd2bd, 0xb27d, + 0xdebf, 0xbf5d, 0xc3a4, 0xc57b, 0xf8b3, 0xa5cb, 0xa0d9, 0xcd6f, + 0xa260, 0xcfd7, 0xcfd8, 0xa0bf, 0xa04d, 0xa0b8, 0xd2be, 0xd2bf, + 0xb27e, 0xb2a1, 0xa0ce, 0xdaab, 0xdec2, 0xdec1, 0xdec0, 0xe2d5, + 0xe2d6, 0xe2d7, 0xbac2, 0xa0b7, 0xe6ad, 0xe6ac, 0xea69, 0xbf5e, + 0xbf5f, 0xfea9, 0xed72, 0xed6f, 0xed70, 0xed71, 0xf049, 0xf048, + 0xc27c, 0xf277, 0xf5de, 0xa5cc, 0x89c3, 0xacc6, 0xb2a2, 0xdec3, + 0xfeab, 0xa5cd, 0xd2c0, 0xb2a3, 0xb563, 0xb564, 0xa5ce, 0xa5cf, + 0xca46, 0xa86a, 0xa869, 0xacc7, 0xcfd9, 0xdaac, 0xa5d0, 0xa5d1, + 0xa5d2, 0xa5d3, 0x9df4, 0x896d, 0xa86b, 0xa86c, 0xcb6e, 0xcb6d, + 0x9c7b, 0xaab6, 0xcd72, 0xcd70, 0xcd71, 0x98d2, 0x9fa9, 0xcfda, + 0xcfdb, 0xfeb2, 0xaccb, 0xacc9, 0xfeb1, 0xacca, 0xacc8, 0x97d9, + 0xa0c4, 0xaf60, 0x9476, 0xaf64, 0xaf63, 0xd2c1, 0xaf62, 0xaf61, + 0xd2c2, 0x9978, 0xb2a6, 0xd67b, 0xd67a, 0xb2a4, 0xb2a5, 0xfeb3, + 0xb566, 0xb565, 0xdaae, 0x98d3, 0xfeb4, 0xdaad, 0xb2a7, 0x98d4, + 0xb7ed, 0xdec5, 0xb7ee, 0xdec4, 0x9fb9, 0xe2d8, 0xe6ae, 0xbd42, + 0xea6a, 0x9471, 0xed73, 0xc3a6, 0xc3a5, 0xc57c, 0xa5d4, 0xcd73, + 0x98d5, 0xfeb8, 0xb2a8, 0xe2d9, 0xbac3, 0xc6d4, 0xcb6f, 0xcb70, + 0xcd74, 0xaab8, 0xaab9, 0xaab7, 0xfeba, 0xaccf, 0xacd0, 0xaccd, + 0xacce, 0xcfdc, 0xcfdd, 0xaccc, 0xd2c3, 0x9e5c, 0xaf68, 0xaf69, + 0xfebb, 0xb2ab, 0xd2c9, 0xaf6e, 0xaf6c, 0xd2ca, 0xd2c5, 0xaf6b, + 0xaf6a, 0xaf65, 0xd2c8, 0xd2c7, 0xd2c4, 0xaf6d, 0xa044, 0xd2c6, + 0xaf66, 0xaf67, 0x98d7, 0xb2ac, 0xd6a1, 0xd6a2, 0xb2ad, 0xd67c, + 0xd67e, 0xd6a4, 0xd6a3, 0xd67d, 0xb2a9, 0xb2aa, 0xdab6, 0xb56b, + 0xb56a, 0xdab0, 0xb568, 0x98d8, 0xdab3, 0xb56c, 0xdab4, 0xb56d, + 0xdab1, 0xb567, 0xb569, 0xdab5, 0xdab2, 0xdaaf, 0xded2, 0xdec7, + 0xb7f0, 0xb7f3, 0xb7f2, 0xb7f7, 0xb7f6, 0xded3, 0xded1, 0xdeca, + 0xdece, 0xdecd, 0xb7f4, 0xded0, 0xdecc, 0xded4, 0xdecb, 0xb7f5, + 0xb7ef, 0xb7f1, 0xfebc, 0xdec9, 0x9ffe, 0xe2db, 0xbac7, 0xe2df, + 0xbac6, 0xe2dc, 0xbac5, 0xdec8, 0xdecf, 0xe2de, 0xbac8, 0xe2e0, + 0xe2dd, 0xe2da, 0xe6b1, 0xe6b5, 0xe6b7, 0xe6b3, 0xe6b2, 0xe6b0, + 0xbd45, 0xbd43, 0xbd48, 0xbd49, 0xe6b4, 0xbd46, 0xe6af, 0xbd47, + 0xbac4, 0xe6b6, 0xbd44, 0xfebd, 0xea6c, 0xea6b, 0xea73, 0xea6d, + 0xea72, 0xea6f, 0xbf60, 0xea71, 0xbf61, 0xbf62, 0x9ddd, 0xea70, + 0xea6e, 0x9ee1, 0xc0f8, 0xed74, 0xc0f7, 0xed77, 0xed75, 0xed76, + 0xc0f9, 0x98da, 0x9ddf, 0xfebf, 0xf04d, 0xfebe, 0xc2a1, 0xf04e, + 0x9eeb, 0xc27d, 0xf04f, 0xc27e, 0xf04c, 0xf050, 0xf04a, 0xc3a7, + 0xf278, 0xc3a8, 0xc46f, 0xf04b, 0xc470, 0x9e59, 0xa05c, 0xc4ee, + 0xf5df, 0xc57e, 0xf6f4, 0xc57d, 0xfec0, 0xf7ea, 0xc5f5, 0xc5f6, + 0x9477, 0x98dc, 0xf9cc, 0xfec1, 0xacd1, 0xcfde, 0x98de, 0xb56e, + 0xb56f, 0xa5d5, 0xa6ca, 0xca47, 0xcb71, 0xa86d, 0xaaba, 0xacd2, + 0xacd3, 0xacd4, 0xd6a6, 0xd2cb, 0xaf6f, 0xb2ae, 0xd6a5, 0xfec3, + 0xdab8, 0xb571, 0xdab7, 0xb570, 0xded5, 0xbd4a, 0xe6bb, 0xe6b8, + 0xe6b9, 0xe6ba, 0xfec8, 0xed78, 0xfec9, 0xf051, 0xf471, 0xf470, + 0xf6f5, 0xa5d6, 0xcd75, 0xaf70, 0xb572, 0xded6, 0xfeca, 0xe2e1, + 0xbd4b, 0xea74, 0xf052, 0xf472, 0xa5d7, 0xaabb, 0xacd7, 0xcfdf, + 0xacd8, 0xacd6, 0xacd5, 0xd2cc, 0xaf71, 0xfecb, 0xaf72, 0xaf73, + 0xb2b0, 0xd6a7, 0xb2af, 0x9fc2, 0x8c6b, 0xdab9, 0xb2b1, 0xb573, + 0xded7, 0xb7f8, 0xb7f9, 0xbac9, 0xbaca, 0xbd4c, 0xbf64, 0xea75, + 0xbf63, 0xed79, 0xc0fa, 0xf053, 0xf473, 0xa5d8, 0xa86e, 0xcd78, + 0xcd77, 0xaabc, 0xcd76, 0xaabd, 0xcd79, 0xcfe5, 0xacdb, 0xacda, + 0xcfe7, 0xcfe6, 0xacdf, 0xacde, 0xacd9, 0xcfe1, 0xcfe2, 0xcfe3, + 0xace0, 0xcfe0, 0xacdc, 0xcfe4, 0xacdd, 0x98c4, 0x94b0, 0x94b1, + 0xd2cf, 0xd2d3, 0xd2d1, 0xd2d0, 0xd2d4, 0xd2d5, 0xd2d6, 0xd2ce, + 0xd2cd, 0xfed1, 0xaf75, 0xaf76, 0xd2d7, 0xd2d2, 0xa0c1, 0xd6b0, + 0xfed2, 0xd2d8, 0xaf77, 0xaf74, 0xa0cd, 0xd6aa, 0xd6a9, 0xd6ab, + 0xd6ac, 0xd6ae, 0xd6ad, 0xd6b2, 0xb2b5, 0xb2b2, 0xb2b6, 0xd6a8, + 0xb2b7, 0xd6b1, 0xb2b4, 0xd6af, 0xb2b3, 0xfed3, 0x98e5, 0xdabc, + 0xdabe, 0xdaba, 0xdabb, 0xdabf, 0xdac1, 0xdac2, 0xdabd, 0xdac0, + 0xb574, 0xdedb, 0xdee0, 0xded8, 0xdedc, 0xfed6, 0xdee1, 0xdedd, + 0xb7fa, 0xb843, 0xb7fd, 0xded9, 0xdeda, 0xbace, 0xb846, 0xb7fe, + 0xb844, 0xb7fc, 0xdedf, 0xb845, 0xdede, 0xb841, 0xb7fb, 0xb842, + 0xdee2, 0xe2e6, 0xe2e8, 0x91e4, 0x8fc7, 0x94ae, 0xb840, 0x8a4f, + 0x94b2, 0xe2e3, 0xbacc, 0xe2e9, 0xbacd, 0xe2e7, 0xe2e2, 0xe2e5, + 0xe2ea, 0xbacb, 0xe2e4, 0xbd4e, 0xe6bf, 0xe6be, 0xbd51, 0xbd4f, + 0xe6bc, 0xbd4d, 0xe6bd, 0xbd50, 0x8fd4, 0xea7d, 0xeaa1, 0x98ea, + 0xea7e, 0xea76, 0xea7a, 0xea79, 0xea77, 0xbf66, 0xbf67, 0xbf65, + 0xea78, 0xea7b, 0xea7c, 0xbf68, 0xc140, 0xeda3, 0xc0fc, 0xed7b, + 0xc0fe, 0xc141, 0xfed8, 0xc0fd, 0xeda2, 0xed7c, 0xc0fb, 0xeda1, + 0xed7a, 0xed7e, 0xed7d, 0x9de0, 0xf055, 0xc2a4, 0xc2a5, 0xc2a2, + 0x98ee, 0xc2a3, 0xf054, 0x95c4, 0xf27b, 0xfce8, 0xc3a9, 0xf279, + 0xf27a, 0x98ef, 0xf474, 0xf477, 0xf475, 0xf476, 0xf5e0, 0xc4ef, + 0xf7eb, 0xf8b4, 0xc5f7, 0xf8f8, 0xf8f9, 0xc666, 0xa5d9, 0xace1, + 0x8c6e, 0xdac3, 0xdee3, 0xa5da, 0xa86f, 0xaabe, 0xfad8, 0xcfe8, + 0xcfe9, 0xaf78, 0xdac4, 0xb575, 0xb847, 0xc142, 0xeda4, 0xf27c, + 0xf478, 0xa5db, 0xfedc, 0xcda1, 0xcd7a, 0xcd7c, 0xcd7e, 0xcd7d, + 0xcd7b, 0xaabf, 0xa0ae, 0xace2, 0xcff2, 0xcfed, 0xcfea, 0x9d4c, + 0xcff1, 0xace4, 0xace5, 0xcff0, 0xcfef, 0xcfee, 0xcfeb, 0xcfec, + 0xcff3, 0xace3, 0x98f1, 0x98f3, 0xaf7c, 0x94c1, 0xafa4, 0xafa3, + 0xd2e1, 0xd2db, 0xd2d9, 0xafa1, 0xd6b9, 0xaf7a, 0xd2de, 0xd2e2, + 0xd2e4, 0xd2e0, 0xd2da, 0xafa2, 0xd2df, 0xd2dd, 0xaf79, 0xd2e5, + 0xafa5, 0xd2e3, 0xaf7d, 0xd2dc, 0xaf7e, 0xaf7b, 0x98f5, 0xfa4f, + 0x96e2, 0x9450, 0xb2b9, 0x96a2, 0xd6ba, 0x98f6, 0xd6b3, 0xd6b5, + 0xd6b7, 0x96e5, 0xd6b8, 0xd6b6, 0xb2ba, 0xd6bb, 0x98f7, 0xd6b4, + 0xa046, 0x96e3, 0xdac8, 0xb576, 0xdad0, 0xdac5, 0xdad1, 0xdac6, + 0xdac7, 0x98f8, 0xdacf, 0xdace, 0xdacb, 0xb2b8, 0xb577, 0xdac9, + 0xdacc, 0xb578, 0xdacd, 0xdaca, 0xdeee, 0x9ee4, 0xdef2, 0xb84e, + 0xe2f0, 0xb851, 0xdef0, 0xf9d6, 0xdeed, 0xdee8, 0xdeea, 0xdeeb, + 0xdee4, 0x94c3, 0xb84d, 0xb84c, 0x94c2, 0xb848, 0xdee7, 0xb84f, + 0xb850, 0xdee6, 0xdee9, 0xdef1, 0xb84a, 0xb84b, 0xdeef, 0xdee5, + 0xe2f2, 0xbad0, 0xe2f4, 0xdeec, 0xe2f6, 0xbad4, 0xe2f7, 0xe2f3, + 0xbad1, 0xe2ef, 0xbad3, 0xe2ec, 0xe2f1, 0xe2f5, 0xe2ee, 0xfee1, + 0xb849, 0xfee9, 0xe2eb, 0xbad2, 0xe2ed, 0x96e4, 0x89ac, 0x96db, + 0xbd54, 0xe6c1, 0xbd58, 0xbd56, 0xbacf, 0xe6c8, 0xe6c9, 0xbd53, + 0xfee2, 0xe6c7, 0xe6ca, 0xbd55, 0xbd52, 0xe6c3, 0xe6c0, 0xe6c5, + 0xe6c2, 0xbd59, 0xe6c4, 0x94c4, 0xfee3, 0xe6c6, 0xbd57, 0xfee7, + 0x9ffb, 0xbf6a, 0xeaa8, 0xeaa2, 0xeaa6, 0xeaac, 0xeaad, 0xeaa9, + 0xeaaa, 0xeaa7, 0x8c59, 0xeaa4, 0xbf6c, 0xbf69, 0xeaa3, 0xeaa5, + 0xbf6b, 0xeaab, 0x93c9, 0xc146, 0x94e8, 0xfb56, 0xedaa, 0xeda5, + 0xc145, 0x90c5, 0xc143, 0xedac, 0xc144, 0xeda8, 0xeda9, 0xeda6, + 0xedad, 0xf056, 0xc147, 0xeda7, 0xedae, 0xedab, 0xa0a8, 0xf05a, + 0xf057, 0xc2a6, 0xf05b, 0xf05d, 0xf05c, 0xf058, 0xf059, 0xf2a3, + 0xc3aa, 0xf27e, 0xf2a2, 0xf27d, 0xf2a4, 0xf2a1, 0xf47a, 0xf47d, + 0xf479, 0xc471, 0xf47b, 0xf47c, 0xf47e, 0xc472, 0xc474, 0xc473, + 0xf5e1, 0xfee5, 0xf5e3, 0xf5e2, 0x98fd, 0x98fb, 0xfee8, 0xf6f6, + 0x8ebf, 0xf8b5, 0xf8fa, 0xa5dc, 0x8bd8, 0xfef7, 0xcb72, 0xaac0, + 0xcda3, 0xaac1, 0xaac2, 0xcda2, 0xcff8, 0xcff7, 0xace6, 0xace9, + 0xace8, 0xace7, 0xcff4, 0xcff6, 0xcff5, 0xd2e8, 0xafa7, 0xd2ec, + 0xd2eb, 0xd2ea, 0xd2e6, 0xafa6, 0xafaa, 0xafad, 0x8f68, 0x94c6, + 0xafae, 0xd2e7, 0xd2e9, 0xafac, 0xafab, 0xafa9, 0xafa8, 0xd6c2, + 0x9dea, 0xd6c0, 0xd6bc, 0xb2bb, 0xd6bd, 0xb2bc, 0xd6be, 0xd6bf, + 0xd6c1, 0xb2bd, 0xdad5, 0xfc69, 0xdad4, 0xdad3, 0xdad2, 0xdef6, + 0xb852, 0xdef3, 0xdef5, 0x9cda, 0xb853, 0xfef3, 0xb854, 0xdef4, + 0x9c72, 0xfef0, 0x89c9, 0xe341, 0xe2f9, 0xe2fa, 0xbad7, 0xbad5, + 0xbad6, 0xe343, 0x9941, 0xe342, 0xe2fe, 0xe2fd, 0xe2fc, 0xe2fb, + 0xe340, 0xe2f8, 0x9942, 0xe6cb, 0xe6d0, 0xe6ce, 0xfef5, 0x91d7, + 0xe6cd, 0xe6cc, 0xe6cf, 0xeaae, 0x94cc, 0xbf6d, 0xc148, 0xedb0, + 0xfef8, 0xc149, 0xedaf, 0xf05f, 0xf05e, 0xc2a7, 0xf2a5, 0xc3ab, + 0xf4a1, 0xc5a1, 0xf6f7, 0xf8b7, 0xf8b6, 0xc9a8, 0xacea, 0xaceb, + 0xd6c3, 0xb856, 0xa5dd, 0xa872, 0xa871, 0xa870, 0x97a8, 0xcda4, + 0xfefc, 0xaac4, 0xaac3, 0xacee, 0xfdbf, 0xcffa, 0xcffd, 0xcffb, + 0xacec, 0xaced, 0xfefe, 0xcff9, 0xcffc, 0xafb5, 0xd2f3, 0xd2f5, + 0xd2f4, 0xafb2, 0xd2ef, 0x96d1, 0xafb0, 0xafaf, 0xafb3, 0xafb1, + 0xafb4, 0xd2f2, 0xd2ed, 0xd2ee, 0xd2f1, 0xd2f0, 0x94d5, 0x94d0, + 0xd6c6, 0xd6c7, 0xd6c5, 0xd6c4, 0xb2be, 0xb57d, 0xdad6, 0xdad8, + 0xdada, 0xb57c, 0x9944, 0xb57a, 0xdad7, 0xb57b, 0xdad9, 0xb579, + 0xdf41, 0xdef7, 0xdefa, 0xdefe, 0xb85a, 0xdefc, 0xdefb, 0xdef8, + 0xdef9, 0xb858, 0xdf40, 0xb857, 0xb85c, 0xb85b, 0xb859, 0xdefd, + 0xe349, 0xe348, 0x8c63, 0xe344, 0xa0b3, 0xbad8, 0xe347, 0xe346, + 0xbad9, 0xbd5e, 0xe6d2, 0x94cf, 0xbd5f, 0xbd5b, 0xbd5d, 0x9ffa, + 0xbd5a, 0xbd5c, 0x91e5, 0xeaaf, 0x9c6a, 0xbf70, 0xeab1, 0xeab0, + 0x8e49, 0xe345, 0xbf72, 0xbf71, 0xbf6e, 0xbf6f, 0xedb5, 0xedb3, + 0xc14a, 0xedb4, 0xedb6, 0xedb2, 0xedb1, 0xf060, 0xc2aa, 0xc2a8, + 0xc2a9, 0x8e4c, 0xf2a6, 0xf2a7, 0xc3ad, 0xc3ac, 0xf4a3, 0xf4a4, + 0xf4a2, 0xf6f8, 0xf6f9, 0xa5de, 0xca48, 0xa873, 0xcda5, 0xaac6, + 0xaac5, 0xcda6, 0x8e4d, 0xd040, 0xacef, 0xcffe, 0xacf0, 0x9a73, + 0xafb6, 0xd2f8, 0xd2f6, 0xd2fc, 0xafb7, 0xd2f7, 0xd2fb, 0xd2f9, + 0xd2fa, 0xd6c8, 0xd6ca, 0x9947, 0xb2bf, 0x8cb1, 0xd6c9, 0xb2c0, + 0xb5a2, 0xb5a1, 0xb57e, 0xdadb, 0xdf44, 0xb85d, 0xb85e, 0xdf43, + 0xdf42, 0xe34a, 0xbadb, 0xbada, 0xe34b, 0xe34c, 0xbd61, 0xbd60, + 0x8e50, 0xeab5, 0xe6d3, 0xe6d5, 0xe6d4, 0xeab4, 0xeab2, 0xeab6, + 0xeab3, 0xbf73, 0x8e4f, 0x9949, 0xedb7, 0xc14b, 0xedb8, 0xedb9, + 0x8e51, 0x8e52, 0xc2ab, 0xc2ac, 0xc475, 0x9ab2, 0x89a5, 0xc5d1, + 0xa5df, 0x994c, 0xd041, 0x9ff8, 0xd2fd, 0xafb8, 0x8e56, 0x994d, + 0x91ca, 0x8e57, 0xb3ba, 0xb3b9, 0x94e1, 0xb5a4, 0xdadd, 0xb5a3, + 0xdadc, 0x9047, 0x8fd8, 0x8e58, 0xdf45, 0xbadc, 0xe34d, 0xbadd, + 0xc476, 0xf4a5, 0xa6cb, 0xaac7, 0xcda7, 0xacf2, 0x94eb, 0xacf1, + 0xd042, 0xd043, 0xd340, 0xd342, 0xafb9, 0xd344, 0xd347, 0xd345, + 0x8e5c, 0x9553, 0xd346, 0xd343, 0xd2fe, 0xafba, 0xd348, 0xd341, + 0x9fe5, 0xd6d3, 0xb2c6, 0xd6dc, 0xb2c3, 0xd6d5, 0xb2c7, 0x9f56, + 0xb2c1, 0xd6d0, 0xd6dd, 0xd6d1, 0xd6ce, 0xb2c5, 0x954f, 0xb2c2, + 0x8e5e, 0xd6d4, 0xd6d7, 0xb2c4, 0xd6d8, 0xb2c8, 0xd6d9, 0xd6cf, + 0xd6d6, 0xd6da, 0xd6d2, 0xd6cd, 0xd6cb, 0xd6db, 0x996a, 0xdadf, + 0xdae4, 0x9c64, 0x9cd9, 0xdae0, 0xdae6, 0xb5a7, 0xd6cc, 0xdae1, + 0xb5a5, 0xdade, 0xb5ac, 0xdae2, 0xb5ab, 0xdae3, 0xb5ad, 0xb5a8, + 0xb5ae, 0xb5a9, 0xb5aa, 0x8e5d, 0xb5a6, 0xdae5, 0xb861, 0xdf50, + 0x9950, 0xdf53, 0xdf47, 0xdf4c, 0xdf46, 0xb863, 0xdf4a, 0x9951, + 0xdf48, 0xb862, 0x8e62, 0xdf4f, 0xdf4e, 0xdf4b, 0xdf4d, 0xdf49, + 0xbae1, 0xdf52, 0xb85f, 0xdf51, 0x9952, 0xe35d, 0xbae8, 0xe358, + 0xbae7, 0xe34e, 0xe350, 0xbae0, 0xe355, 0xe354, 0xe357, 0xbae5, + 0xe352, 0xe351, 0x8e68, 0xbae4, 0xbadf, 0xe353, 0xbae2, 0xe359, + 0xe35b, 0xe356, 0xe34f, 0xbae3, 0xbd69, 0xbade, 0x8e61, 0x9f59, + 0xe35c, 0xe6d9, 0xbd62, 0xe6db, 0xbd63, 0x8bb3, 0xbd65, 0xe6de, + 0xe6d6, 0xbae6, 0xe6dc, 0xe6d8, 0xb860, 0xbd68, 0xbd64, 0xbd66, + 0xbd67, 0xbf76, 0xe6dd, 0xe6d7, 0xbd6a, 0xe6da, 0x9f5d, 0x8e66, + 0xeac0, 0xeabb, 0xeac5, 0xbf74, 0xeabd, 0xbf78, 0xeac3, 0xeaba, + 0xeab7, 0xeac6, 0xc151, 0xbf79, 0xeac2, 0xeab8, 0xbf77, 0xeabc, + 0xbf7b, 0xeab9, 0xeabe, 0xbf7a, 0xeac1, 0xeac4, 0x8cb2, 0xedcb, + 0xedcc, 0xedbc, 0xedc3, 0xedc1, 0xc14f, 0xedc8, 0xeabf, 0x8e6e, + 0xedbf, 0x9f64, 0xedc9, 0xc14e, 0xedbe, 0xedbd, 0xedc7, 0xedc4, + 0xedc6, 0xedba, 0xedca, 0xc14c, 0xedc5, 0xedce, 0xedc2, 0xc150, + 0xc14d, 0xedc0, 0xedbb, 0xedcd, 0xbf75, 0x9953, 0xfab8, 0xf063, + 0x9954, 0xf061, 0xf067, 0xc2b0, 0xf065, 0xf064, 0xc2b2, 0xf06a, + 0xc2b1, 0xf06b, 0xf068, 0xc2ae, 0xf069, 0xf062, 0xc2af, 0xc2ad, + 0xf2ab, 0xf066, 0xf06c, 0xf2a8, 0x8e70, 0xc3b2, 0xc3b0, 0xf2aa, + 0xf2ac, 0xf2a9, 0xc3b1, 0xc3ae, 0xc3af, 0xc3b3, 0x9f61, 0xc478, + 0x8e72, 0xf4aa, 0xf4a9, 0xf4a7, 0xf4a6, 0xf4a8, 0xc477, 0xc479, + 0xc4f0, 0xa06b, 0xf5e5, 0xf5e4, 0x9f40, 0xf6fa, 0xf6fc, 0xf6fe, + 0xf6fd, 0xf6fb, 0x94ed, 0xc5a3, 0xc5a2, 0xc5d3, 0xc5d2, 0xc5d4, + 0xf7ed, 0xf7ec, 0xf8fb, 0xf8b8, 0xf8fc, 0xc658, 0x94ee, 0xc659, + 0xf96d, 0x9fbd, 0xc67e, 0xa6cc, 0x8e7b, 0xcda8, 0xd045, 0xd046, + 0xd044, 0x9957, 0x94f7, 0xacf3, 0x9f5f, 0xd047, 0xd048, 0xd049, + 0x8e73, 0xd349, 0xd34f, 0x9f62, 0xd34d, 0xafbb, 0xd34b, 0xd34c, + 0xd34e, 0x94f6, 0xd34a, 0xb2c9, 0xd6de, 0xb2cb, 0xd6e0, 0xb2ca, + 0xd6df, 0x9958, 0xdae8, 0xb5af, 0xdaea, 0xdae7, 0xd6e1, 0xb5b0, + 0x8e75, 0xf9db, 0xdae9, 0x9072, 0x94f8, 0xdf56, 0xb864, 0xdf54, + 0xb865, 0xdf55, 0xb866, 0x995a, 0xbae9, 0xe361, 0xe35e, 0xe360, + 0xbaea, 0xbaeb, 0xe35f, 0xa0b0, 0x8cb3, 0xe6df, 0x8e79, 0xe6e0, + 0x8e78, 0xbd6b, 0xe6e2, 0xe6e1, 0x94f3, 0xa261, 0xeaca, 0xeacb, + 0xeac7, 0x98af, 0xeac8, 0xbf7c, 0xbf7d, 0xeac9, 0xc157, 0xa0b2, + 0xc153, 0xc158, 0xc154, 0xc156, 0xc152, 0xc155, 0x8e7a, 0xc2b3, + 0xedcf, 0xf2ae, 0xf2ad, 0x995c, 0xf4ab, 0xc47a, 0xc47b, 0xf741, + 0xf5e6, 0x8e7c, 0xf740, 0x8e7d, 0xf8fd, 0xf9a4, 0xa6cd, 0x8bd9, + 0xa874, 0x89a2, 0xcda9, 0xaac8, 0xacf6, 0xd04c, 0xacf4, 0xd04a, + 0xacf9, 0xacf5, 0xacfa, 0xacf8, 0xd04b, 0xacf7, 0xafbf, 0xafbe, + 0xd35a, 0xafc7, 0xd353, 0xd359, 0xafc3, 0xd352, 0xd358, 0xd356, + 0xafc2, 0xafc4, 0xd355, 0xafbd, 0xd354, 0xafc8, 0xafc5, 0xafc9, + 0xafc6, 0xd351, 0xd350, 0xd357, 0xafc0, 0xafbc, 0xafc1, 0x9ed7, + 0xd6f0, 0xd6e9, 0xb5b5, 0xd6e8, 0xb2cf, 0xb2d6, 0xb2d3, 0xb2d9, + 0xb2d8, 0xb2d4, 0xd6e2, 0xd6e5, 0xd6e4, 0xb2d0, 0xd6e6, 0xd6ef, + 0xb2d1, 0xd6e3, 0xd6ec, 0xd6ed, 0xb2d2, 0xd6ea, 0xb2d7, 0xb2cd, + 0xb2d5, 0xd6e7, 0xb2cc, 0xd6eb, 0xd6ee, 0xa0b6, 0xdafb, 0xdaf2, + 0xb5b2, 0xdaf9, 0xdaf6, 0xdaee, 0xdaf7, 0xb5b4, 0xdaef, 0xdaeb, + 0x9e42, 0xb86c, 0xdaf4, 0x8ea4, 0xb5b1, 0xdafa, 0xb5b8, 0xb5ba, + 0xdaed, 0xb5b9, 0xdaf0, 0xb5b3, 0xdaf8, 0xdaf1, 0xdaf5, 0xdaf3, + 0xb5b6, 0xdaec, 0xb5bb, 0xb2ce, 0xb5b7, 0xb5bc, 0xb868, 0xdf5d, + 0xdf5f, 0xdf61, 0xdf65, 0xdf5b, 0xdf59, 0xb86a, 0xdf60, 0xdf64, + 0xdf5c, 0xdf58, 0xdf57, 0x8ea7, 0x8c76, 0xdf62, 0xdf5a, 0xdf5e, + 0xb86b, 0xb869, 0xdf66, 0xb867, 0xdf63, 0xe372, 0x9542, 0xbaee, + 0xe36a, 0xbd78, 0xe374, 0xbaf1, 0xe378, 0xbaf7, 0xe365, 0x987d, + 0xe375, 0xe362, 0x9755, 0xe377, 0xe366, 0x8ea8, 0xbafe, 0xbafb, + 0xe376, 0xe370, 0xbaed, 0xbaf5, 0xbaf4, 0x8eaa, 0xbaf3, 0xbaf9, + 0xe363, 0xbafa, 0xe371, 0xbaf6, 0xbaec, 0xe373, 0xbaef, 0xbaf0, + 0xbaf8, 0xe368, 0xe367, 0xe364, 0xe36c, 0xe369, 0xe36d, 0xbafd, + 0xe379, 0xbaf2, 0xe36e, 0xe36f, 0x89a3, 0xe36b, 0x9960, 0x9962, + 0xbafc, 0x94fc, 0x9961, 0xe6e7, 0xbd70, 0xbd79, 0xbd75, 0xe6e4, + 0x94fa, 0xbd72, 0xbd76, 0xe6f0, 0xbd6c, 0xe6e8, 0xbd74, 0x8eae, + 0x8eb2, 0xe6eb, 0xe6e6, 0xbd73, 0xbd77, 0xe6e5, 0xbd71, 0xe6ef, + 0xbd6e, 0xe6ee, 0xe6ed, 0xbd7a, 0xe572, 0xbd6d, 0x8eb0, 0xe6ec, + 0xe6e3, 0xbd7b, 0xe6ea, 0xbd6f, 0x9963, 0x97aa, 0xe6e9, 0x94fb, + 0xbfa2, 0xbfa7, 0xbf7e, 0xead8, 0xeacf, 0xeadb, 0xead3, 0xead9, + 0xbfa8, 0xbfa1, 0xeacc, 0xead2, 0xeadc, 0xead5, 0xeada, 0xeace, + 0xead6, 0xbfa3, 0xead4, 0xbfa6, 0xbfa5, 0xead0, 0xead1, 0xeacd, + 0xead7, 0xbfa4, 0xeade, 0xeadd, 0x8ebb, 0xedda, 0xedd6, 0xc15f, + 0xedd0, 0xc159, 0xc169, 0xeddc, 0xc161, 0xc15d, 0xedd3, 0xc164, + 0xc167, 0xedde, 0xc15c, 0xedd5, 0xc165, 0xede0, 0xeddd, 0xedd1, + 0xc160, 0xc15a, 0xc168, 0xedd8, 0xc163, 0xedd2, 0xc15e, 0xeddf, + 0xc162, 0xc15b, 0xedd9, 0xc166, 0xedd7, 0xeddb, 0xf06e, 0xf074, + 0xc2b9, 0xf077, 0xc2b4, 0xc2b5, 0xf06f, 0xf076, 0xf071, 0xc2ba, + 0xc2b7, 0x8cdc, 0xf06d, 0xc2b6, 0xf073, 0xf075, 0xc2b8, 0xf072, + 0xf070, 0x9876, 0x8ea1, 0xf2b8, 0xc3b7, 0xc3b8, 0xc3b4, 0x8cb4, + 0xc3b5, 0x8eb7, 0xf2b4, 0xf2b2, 0xf2b6, 0xc3ba, 0xf2b7, 0xf2b0, + 0xf2af, 0xf2b3, 0xf2b1, 0xc3b6, 0xf2b5, 0xf4ac, 0xc47e, 0xc47d, + 0xf4ad, 0x9da6, 0xf4af, 0xf4ae, 0xc4a1, 0xf5eb, 0xf5e8, 0xf5e9, + 0xf5e7, 0xf5ea, 0xc4f2, 0xf5ec, 0x9eb0, 0xc4f1, 0xf742, 0x8eb8, + 0xc5d5, 0xc5d7, 0xf7ee, 0xc5d6, 0xf8b9, 0xf940, 0xf942, 0xf8fe, + 0xf941, 0xc66c, 0x9d70, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, + 0x8973, 0x8974, 0xa6ce, 0x8975, 0xacfb, 0xd26f, 0xafca, 0xb2da, + 0xdafc, 0xdafd, 0x8ebc, 0x8ebd, 0xeadf, 0xc16a, 0xede1, 0x8ebe, + 0xc2bb, 0x9dd1, 0xf2ba, 0xf2b9, 0xc4a2, 0xf5ed, 0x94fd, 0xf743, + 0xc5f8, 0xca49, 0x8bd7, 0x8bda, 0xaac9, 0xa875, 0xd04d, 0xd360, + 0xd35b, 0xd35f, 0xd35d, 0xafcb, 0xd35e, 0xd35c, 0xd6f1, 0xdafe, + 0xdb40, 0xdf69, 0xdf6a, 0xb86e, 0xb86f, 0xdf68, 0xdf6b, 0xdf67, + 0xb86d, 0xbb40, 0xa0e2, 0xb870, 0xe37a, 0xbd7c, 0xe6f1, 0xbd7d, + 0x9fe9, 0xbfa9, 0xeae2, 0xeae0, 0xeae1, 0xede4, 0xede3, 0xede2, + 0xf2bb, 0xc3b9, 0xf2bc, 0xf744, 0xc5f9, 0xf8ba, 0xa6cf, 0xaacb, + 0xaaca, 0xd04f, 0xacfc, 0xfda8, 0xd04e, 0xd362, 0x8ae7, 0xafcc, + 0xd6f2, 0xd361, 0x8ec2, 0xb2dc, 0xd6f5, 0xd6f3, 0xd6f4, 0xb2db, + 0xdb42, 0xdb43, 0xdb41, 0x8ec4, 0xb873, 0xdf6d, 0xdf6c, 0xdf6e, + 0xb872, 0xb871, 0xe6f2, 0xe6f4, 0x9964, 0xbd7e, 0xe6f3, 0xeae3, + 0xbfaa, 0xf079, 0x9965, 0xf078, 0xc3bb, 0xf2bd, 0xc3bd, 0xc3bc, + 0xf4b0, 0xf5ee, 0xc4f3, 0xa6d0, 0xd050, 0xacfd, 0xd365, 0xafce, + 0xd364, 0xd363, 0xafcd, 0xd6fb, 0xd6fd, 0xd6f6, 0xd6f7, 0xb2dd, + 0xd6f8, 0xb2de, 0xd6fc, 0xd6f9, 0xd6fa, 0xb2df, 0xb5be, 0xb5bf, + 0xdb44, 0xdf6f, 0xdf70, 0x954e, 0xe37e, 0xbb43, 0xbb41, 0xbb42, + 0xe37b, 0xe37c, 0xe37d, 0xe6f9, 0x98b3, 0xe6fa, 0xbda1, 0xe6f7, + 0xe6f6, 0xe6f8, 0xe6f5, 0xbfad, 0xeae4, 0xbfab, 0xbfac, 0xede6, + 0xc16b, 0xede5, 0xefa8, 0xf07a, 0xf07b, 0xc2bc, 0x8ecb, 0xc2bd, + 0xc16c, 0xf2be, 0xf2bf, 0xf4b1, 0xc4a3, 0xa6d1, 0x8bdf, 0xa6d2, + 0xacfe, 0xaacc, 0xafcf, 0xd051, 0x8ece, 0xb5c0, 0xa6d3, 0xad41, + 0xd052, 0xd053, 0xad40, 0xad42, 0xa6d4, 0xd054, 0xafd1, 0xd366, + 0xafd3, 0xafd0, 0xafd2, 0xd741, 0xb2e0, 0x8ecf, 0xd740, 0xd6fe, + 0x9968, 0xdf71, 0xe3a1, 0x9969, 0xbda2, 0xbfae, 0xeae6, 0xeae5, + 0xede7, 0x996b, 0x8ed1, 0xf5ef, 0x996c, 0xa6d5, 0xcb73, 0xcdaa, + 0xad43, 0xd055, 0xd368, 0x8ed4, 0x8ed5, 0xafd4, 0xd367, 0xafd5, + 0xd743, 0xb2e2, 0xd742, 0xd744, 0xb2e1, 0xdb46, 0xdb47, 0xdb45, + 0xb5c1, 0x996d, 0xb874, 0xb875, 0xbb45, 0xa0be, 0xe3a3, 0xe3a2, + 0xbb44, 0x8ed6, 0xa0bc, 0xa0b5, 0xe6fb, 0xa0b4, 0xe6fc, 0xeae7, + 0xc170, 0xc16f, 0xc16d, 0xc16e, 0xc171, 0xf07c, 0xc2bf, 0xc2be, + 0xf2c0, 0xf4b2, 0xc5a5, 0xc5a4, 0xa6d6, 0x8be0, 0xd1fb, 0xb877, + 0xb5c2, 0xb876, 0xbb46, 0xa6d7, 0xc9a9, 0xa6d8, 0xa6d9, 0xcdab, + 0xcb76, 0xcb77, 0xa877, 0xcb74, 0xa876, 0xa879, 0xcb75, 0xa87b, + 0xa87a, 0xcb78, 0xa878, 0x89b5, 0xaad1, 0xaacf, 0xcdad, 0xaace, + 0x8edd, 0xaad3, 0xaad5, 0xaad2, 0xcdb0, 0xcdac, 0xaad6, 0xaad0, + 0xa87c, 0xaad4, 0xcdaf, 0x9e5d, 0x9971, 0xcdae, 0xaacd, 0x89ae, + 0x9de8, 0xd05b, 0xad47, 0xad48, 0xd05d, 0x9565, 0xd057, 0xd05a, + 0xd063, 0xd061, 0xad49, 0xd067, 0xad4c, 0xd064, 0xd05c, 0xd059, + 0xdb49, 0xd062, 0xad44, 0xd065, 0xd056, 0xd05f, 0xad46, 0xad4b, + 0xd060, 0xad4f, 0xad4d, 0xd058, 0xad4a, 0xd05e, 0xad4e, 0xad45, + 0xd066, 0x9972, 0x8b5c, 0xafda, 0xafe3, 0xafd8, 0xafd6, 0xd36a, + 0xafde, 0xafdb, 0xd36c, 0x89b1, 0xafdd, 0xd36b, 0xd369, 0xd36e, + 0xafe2, 0xafe0, 0xdb48, 0xd36f, 0xd36d, 0xafd7, 0xa0c0, 0xafd9, + 0xafdc, 0x8edf, 0xafdf, 0x9566, 0xafe1, 0x9974, 0x9976, 0x9977, + 0x9979, 0xd74e, 0xb2e4, 0x9dda, 0xd745, 0xd747, 0x8ee0, 0xd748, + 0xd750, 0xd74c, 0xd74a, 0xd74d, 0xd751, 0xb2e5, 0xb2e9, 0xd746, + 0xd74f, 0xb2e7, 0x935c, 0xb2e6, 0xd74b, 0xd749, 0xb2e3, 0xb2e8, + 0x9de6, 0x8b5f, 0x9563, 0xb5c8, 0xdb51, 0xdb4f, 0xb5ca, 0x9567, + 0xdb4a, 0xdfa1, 0xb5c9, 0xdb4e, 0x9de3, 0xdb4b, 0xb5c5, 0xb5cb, + 0xdb50, 0xb5c7, 0xdb4d, 0xbb47, 0xb5c6, 0xdb4c, 0xb5cc, 0xb5c4, + 0xb5c3, 0x997c, 0x997d, 0x997e, 0xdf77, 0xdf75, 0xdf7b, 0xdf73, + 0xdfa2, 0xdf78, 0xdf72, 0xb87b, 0xb8a3, 0xdf7d, 0xdf76, 0xb87e, + 0x8b5b, 0xb87c, 0xdf7e, 0xb879, 0xb878, 0xdf79, 0xb87d, 0xb5cd, + 0xdf7c, 0xdf74, 0xb87a, 0xb8a1, 0xb8a2, 0x99a3, 0xbb4c, 0xbb48, + 0xbb4d, 0xe3a6, 0x99a4, 0xe3a5, 0xe3a7, 0xbb4a, 0xe3a4, 0xbb4b, + 0xe3aa, 0xe3a9, 0xe3a8, 0xbb49, 0x99a6, 0xe741, 0xe744, 0xbda8, + 0xe743, 0xbda7, 0xbda3, 0xbda4, 0xbda5, 0xe740, 0xe6fe, 0xbda6, + 0xe742, 0xe6fd, 0x99a8, 0xeae9, 0xeaf3, 0xbfb1, 0xbfb0, 0x8abe, + 0xeaed, 0xeaef, 0xeaea, 0xeaee, 0xeae8, 0xeaf1, 0xbfaf, 0xeaf0, + 0xeaec, 0x9e61, 0xeaf2, 0xeaeb, 0xc174, 0xede8, 0xedee, 0xc178, + 0xc17a, 0xc177, 0xc176, 0x99aa, 0xc175, 0xc173, 0xede9, 0xedec, + 0xc172, 0xeded, 0xa0c8, 0xc179, 0xedeb, 0xedea, 0xc2c0, 0xc2c1, + 0xf0a1, 0xf07d, 0xf07e, 0xf2c2, 0xf2c1, 0xc3be, 0xf4b4, 0xc4a4, + 0xf4b3, 0xf5f0, 0xf745, 0xc5a6, 0xf943, 0xf944, 0xc5d8, 0xa6da, + 0x99ab, 0xaad7, 0xdb52, 0xbb4e, 0xc17b, 0xedef, 0xa6db, 0xafe5, + 0xafe4, 0xdb53, 0xfec4, 0xeaf4, 0xa6dc, 0xad50, 0x98c2, 0xdb54, + 0xdb55, 0xdb56, 0xbb4f, 0xbfb2, 0xa6dd, 0xaad8, 0xd068, 0xafe6, + 0xd370, 0xb2ea, 0xdb57, 0xb8a4, 0xbb50, 0xbfb3, 0xc17c, 0xc2c2, + 0xf4b5, 0xa6de, 0xaad9, 0xafe7, 0xd752, 0xb5ce, 0xbb51, 0xe3ab, + 0xe745, 0x8ee8, 0xa0ba, 0xa6df, 0xb5cf, 0xdfa3, 0xbb52, 0xa6e0, + 0xcdb1, 0xd069, 0xad51, 0xd372, 0xfd77, 0xafea, 0x8eee, 0xafe8, + 0xafe9, 0xafeb, 0x9ebf, 0xd371, 0xd757, 0xd754, 0xd756, 0xb2eb, + 0xb2ed, 0xb2ec, 0xd753, 0xb2ee, 0xd755, 0xdb58, 0xdb59, 0x89c2, + 0xdb5a, 0xdfa6, 0xdfa7, 0xdfa5, 0xdfa8, 0xb8a5, 0xdfa4, 0xbb53, + 0xe74a, 0xe746, 0xe749, 0xe74b, 0xe748, 0xe747, 0x99ac, 0xeaf5, + 0xeaf6, 0xeaf7, 0xbfb4, 0xbfb5, 0xedf1, 0xedf0, 0xedf2, 0xf0a3, + 0xf0a2, 0xf2c4, 0x956b, 0xf2c5, 0xf2c3, 0x956c, 0xc4a5, 0xf4b6, + 0xf4b7, 0xf746, 0xf7ef, 0xf8bb, 0xa6e1, 0xa87d, 0xc17d, 0xa6e2, + 0xd758, 0xdb5b, 0x99af, 0xc641, 0xca4a, 0x994a, 0x8976, 0x8f48, + 0xca4b, 0xca4d, 0xa6e3, 0xca4e, 0xca4c, 0xcba2, 0xcba3, 0xcb7b, + 0xfbee, 0xcba1, 0xa8a1, 0xa8a2, 0xcb7c, 0xcb7a, 0xcb79, 0xcb7d, + 0xa87e, 0xcb7e, 0xd06a, 0xcdb6, 0xaadc, 0xcdb5, 0xcdb7, 0xaadb, + 0xcdbc, 0xaadf, 0xcdb2, 0xcdc0, 0xcdc6, 0xaae6, 0xcdc3, 0xaae3, + 0x99ae, 0xcdb9, 0xcdbf, 0xcdc1, 0x8efb, 0xcdb4, 0xaae2, 0xaadd, + 0xcdba, 0xaae4, 0xaae7, 0xaae1, 0xaada, 0xcdbe, 0xcdb8, 0xcdc5, + 0xaae9, 0xaae5, 0xaae0, 0xcdbd, 0xafec, 0xcdbb, 0xaade, 0xaae8, + 0x8cd0, 0xcdb3, 0xcdc2, 0xcdc4, 0x8b52, 0x99b0, 0x8977, 0x8f41, + 0xad62, 0xad5c, 0xad64, 0xad61, 0xd071, 0xd074, 0xad5d, 0x99b1, + 0xd06b, 0xad56, 0xad60, 0xad63, 0xad65, 0xd0a2, 0xd077, 0x8f49, + 0xad55, 0xd0a1, 0xad59, 0xad57, 0xad52, 0xd06f, 0xd07e, 0xd073, + 0xd076, 0xd0a5, 0xfa4d, 0xad66, 0xd07d, 0xad5e, 0xd078, 0xd0a4, + 0xd075, 0xd079, 0xd07c, 0x9de4, 0x8cb5, 0xd06d, 0xd0a3, 0xd07b, + 0xfbe9, 0x9b54, 0xd06c, 0x99b2, 0xd070, 0xad5f, 0xad5a, 0xad53, + 0xad58, 0xad54, 0xad67, 0xd06e, 0xd3a5, 0xad5b, 0x9e68, 0xd07a, + 0xce41, 0xd3a8, 0xaffa, 0x8f4a, 0xd376, 0x8f42, 0xd3a3, 0xd37d, + 0x8f51, 0xd3b2, 0xd3aa, 0xd37e, 0xd3a9, 0xd378, 0xd37c, 0xd3b5, + 0xaffd, 0xd3ad, 0xd3a4, 0xafed, 0xd3b3, 0xd374, 0xd3ac, 0xaffc, + 0xaff7, 0xd373, 0xaff5, 0xaff4, 0xaff9, 0xd3ab, 0xaff1, 0xaff8, + 0xd072, 0xdb5c, 0xd3a6, 0x9846, 0xd37a, 0xaffb, 0xd37b, 0xd3a1, + 0xaffe, 0xd375, 0xd3af, 0xd3ae, 0xd3b6, 0xaff3, 0xaff0, 0xd3b4, + 0xd3b0, 0xd3a7, 0xd3a2, 0xaff6, 0xaff2, 0xd377, 0xafee, 0xd3b1, + 0xafef, 0xd379, 0x99b4, 0x8ef5, 0xfd55, 0x9ccd, 0x8978, 0xd75e, + 0xd760, 0xd765, 0xd779, 0xb2fc, 0xb2f2, 0xd75d, 0xb2fd, 0xb2fe, + 0xd768, 0xd76f, 0xd775, 0xd762, 0xd769, 0x8f53, 0xb340, 0xd777, + 0xd772, 0xb2fa, 0xb2f8, 0xd76e, 0xd76a, 0xd75c, 0xb2ef, 0xd761, + 0xd759, 0x8f6f, 0xb2f7, 0xb2f9, 0xd766, 0xd763, 0xb2f4, 0xd773, + 0xb2f1, 0xd764, 0xd77a, 0xd76c, 0x8e63, 0xd76b, 0xb2f0, 0xb2fb, + 0xb2f3, 0xd75a, 0xd75f, 0xd770, 0xd776, 0xb341, 0xd75b, 0xd767, + 0xd76d, 0xb2f6, 0x8f56, 0xd778, 0xd771, 0xd774, 0xfe76, 0xb2f5, + 0x9fc6, 0xdb6c, 0xdb60, 0xb5d7, 0xdb7d, 0xdba7, 0xdbaa, 0xb5d5, + 0xdb68, 0xdba3, 0xdb69, 0xdb77, 0xb5e2, 0xdb73, 0xb5df, 0xfaac, + 0xdb74, 0xdb5d, 0xdba4, 0x8f58, 0xb5e8, 0xdba1, 0xdb75, 0xdbac, + 0xdb70, 0xdfc8, 0xdbaf, 0xb5e6, 0xdb6e, 0xdb7a, 0xb5e9, 0xb5d4, + 0xdb72, 0xdbad, 0xdb6b, 0xdb64, 0xdb6f, 0xdb63, 0xdb61, 0xb5d0, + 0xdba5, 0xdb6a, 0xdba8, 0x9848, 0xdba9, 0xb5d8, 0xb5dd, 0xb5d9, + 0xb5e1, 0xdb7e, 0xb5da, 0xdb76, 0xdb66, 0xb5d2, 0xdb5e, 0xdba2, + 0xdbab, 0xdb65, 0xb5e0, 0xdbb0, 0xdb71, 0xdb6d, 0xb5d1, 0xb5e5, + 0x99b7, 0xdb7c, 0xb5e7, 0xdb78, 0xb5dc, 0xb5d6, 0xb5de, 0xb5d3, + 0xb5e4, 0xdb79, 0xdb67, 0xdb7b, 0xdb62, 0xdba6, 0x9665, 0xfa6c, + 0x9de7, 0xdbae, 0x9e62, 0x96cc, 0x8e67, 0xdb5f, 0xfc75, 0x987e, + 0xdfc7, 0xdfdd, 0xb855, 0xdfcc, 0xfdb9, 0xdfca, 0xdfb5, 0xb8a9, + 0xdfc5, 0xdfd9, 0xdfc1, 0xb8b1, 0xdfd8, 0xdfbf, 0xb5e3, 0xdfcf, + 0xdfc0, 0xdfd6, 0xb8b0, 0xb8a8, 0x97fc, 0xdfaa, 0xdfb2, 0xdfcb, + 0xdfc3, 0xdfdc, 0xdfc6, 0xb8b6, 0xdfd7, 0x98f9, 0xb8ad, 0x8f66, + 0xdfc9, 0xdfd1, 0xdfb6, 0xdfd0, 0xdfe1, 0xdfb1, 0xdfd2, 0x956e, + 0xdfdf, 0x9245, 0xdfab, 0xb5db, 0x8f60, 0xdfb9, 0xdfb8, 0xb8af, + 0x9ed1, 0xdfbc, 0xdfbe, 0xdfcd, 0xdfde, 0xb8b2, 0xfecd, 0xb8b3, + 0x99b9, 0xdfb0, 0xb8ab, 0xdfb4, 0xdfda, 0xb8b4, 0xb8ac, 0xb8ae, + 0xb8b5, 0xdfe0, 0xdfd3, 0xdfce, 0x8f62, 0x974c, 0xdfbb, 0xdfba, + 0xb8aa, 0xdfac, 0xb8a7, 0xdfc4, 0xdfad, 0xdfc2, 0xdfb7, 0xdfdb, + 0x91c7, 0x955f, 0xb8a6, 0xdfb3, 0x99bb, 0xdfaf, 0xdfd5, 0xdfae, + 0xbb60, 0xe3d3, 0x8e6d, 0x8f71, 0xe3c2, 0x94cb, 0xe3ac, 0xe3ca, + 0xbb58, 0xe3bb, 0xe3c5, 0xbb5b, 0xe3be, 0xbb59, 0xe3af, 0xe3cd, + 0xe3ae, 0xe3c1, 0x95b1, 0xe3ad, 0xe3bf, 0xe3c8, 0xe3c6, 0xe3ba, + 0xe3b5, 0xe3b3, 0x9af2, 0xe3b4, 0xe3c7, 0xe3d2, 0xe3bc, 0xbb5a, + 0xe3b7, 0xe3cb, 0xbb5d, 0xe3b6, 0xe3b0, 0xe3c0, 0xbb61, 0x96c3, + 0x99bd, 0xbb55, 0xbb5e, 0xe3b8, 0xe3b2, 0xbb57, 0xdfd4, 0xbb56, + 0xe3c3, 0xbb54, 0xbb63, 0xbb5c, 0xe3c4, 0xe3b9, 0xe3b1, 0xe3cc, + 0xe3bd, 0xbb62, 0xe3d0, 0xbb5f, 0xe3cf, 0xe3c9, 0xe3ce, 0xa0cf, + 0xe3d1, 0x8f6d, 0x99be, 0x8ef4, 0x8f72, 0x95e4, 0xe773, 0xe774, + 0xe767, 0xe766, 0xe762, 0xbdb4, 0xbdac, 0xe776, 0xe775, 0xdfa9, + 0xe75f, 0xe763, 0xe75d, 0xe770, 0xe761, 0x99bf, 0xe777, 0xe75a, + 0xe758, 0xe764, 0xe76e, 0xe769, 0xbdb6, 0xe74f, 0xe76d, 0x9242, + 0xfba5, 0xbdb7, 0xdfbd, 0xe75b, 0xe752, 0xe755, 0xe77b, 0xe75c, + 0xe753, 0xe751, 0xe74e, 0x99c0, 0xbdb0, 0xe765, 0xbdaf, 0xbdb3, + 0xe760, 0xe768, 0xbda9, 0xe778, 0xe77c, 0xbdab, 0xe757, 0xe76b, + 0xe76f, 0xe754, 0xe779, 0xbdb2, 0xbdb1, 0xe74c, 0xbdb5, 0xe772, + 0xe756, 0xe76a, 0xe750, 0xe75e, 0xe759, 0xbdad, 0xbdae, 0xe76c, + 0xe77d, 0xe77a, 0xe771, 0xfdb4, 0x8f77, 0x99c1, 0xe74d, 0xbdaa, + 0xeb49, 0xeb40, 0xeb43, 0xfab9, 0xbfbb, 0xeb45, 0xeaf9, 0xeb41, + 0xeb47, 0xbfb8, 0xbfbc, 0xbfb6, 0x8f40, 0xfa44, 0xeafb, 0xeb4c, + 0xeb46, 0x99c2, 0xeafc, 0xeb55, 0xeb4f, 0xeaf8, 0xee46, 0xeafe, + 0xbfb7, 0x8f5c, 0xeb4a, 0xeb54, 0xbfbf, 0x8cbd, 0xeb51, 0xeafd, + 0xeb44, 0xeb48, 0xeb42, 0xeb56, 0xeb53, 0xeb50, 0xbfb9, 0xbfba, + 0xbfbe, 0xeafa, 0xeb57, 0xbfbd, 0xeb4d, 0x99c4, 0x99c5, 0xeb4b, + 0x8f7b, 0xeb4e, 0xee53, 0xee40, 0xee45, 0xee52, 0xee44, 0xedfb, + 0xee41, 0xc1a2, 0xedf4, 0xee4d, 0xee4f, 0xedf3, 0xc1a1, 0xee51, + 0xee49, 0xc1a8, 0xee50, 0xee42, 0xc1aa, 0xedf9, 0xeb52, 0xee4a, + 0xee47, 0xedf5, 0xee55, 0xc1a4, 0xc1a5, 0xedf7, 0xee48, 0x8cb6, + 0xee54, 0xee4b, 0xedfd, 0xc1a7, 0xc1a3, 0xee4c, 0xedfe, 0xee56, + 0xedf8, 0xee43, 0xee4e, 0xedfa, 0xedfc, 0xc2cb, 0xedf6, 0xc1a9, + 0xc2c4, 0xc17e, 0xc1a6, 0xc2c8, 0xf0b3, 0xf0a9, 0xf0a4, 0xf0aa, + 0xf0b4, 0xf0b8, 0xf0b7, 0xc2ca, 0xc2c9, 0xf0ab, 0xf0b9, 0xf0ae, + 0xf0a6, 0x8fa3, 0xf0a8, 0xf0a7, 0xf0ad, 0xf0b2, 0xf0a5, 0xf0ac, + 0xf0b1, 0xc2c7, 0xf0af, 0xc2c5, 0xf0b0, 0xc2c3, 0xc2c6, 0xf2d5, + 0xf0b5, 0xc3c2, 0x8cce, 0xf2cd, 0xf2d1, 0xf2c9, 0xf2cc, 0xf2d4, + 0xc3c0, 0xf2d9, 0xf2d2, 0x99c6, 0xf2ca, 0xf2da, 0xf2d3, 0xc3c3, + 0xc3c4, 0xf2d7, 0xf2cb, 0xc3bf, 0xc3c1, 0xf2c6, 0xf2ce, 0xf2c8, + 0x96cd, 0xf2d8, 0xf2d6, 0xf2c7, 0xf2cf, 0xf4be, 0xc3c5, 0xf2d0, + 0xc4a7, 0xc4a9, 0xc4a6, 0x96c7, 0xf4c3, 0xf4bb, 0xf4b9, 0xf4bd, + 0xf4ba, 0x8fa5, 0xf4bf, 0xf4c1, 0xc4aa, 0xc4ac, 0xf4c0, 0xc4ad, + 0xc4ab, 0xf4c2, 0xfabb, 0x8c61, 0x9570, 0xc4a8, 0x9368, 0x8f7e, + 0xc4f4, 0xf5f1, 0xf5f7, 0xc4f6, 0xf4bc, 0xf5f6, 0xf5fd, 0xf5f4, + 0xf5fb, 0xf5fa, 0xf4b8, 0xf5f5, 0xf0b6, 0xf5fe, 0xf5f3, 0xf5f8, + 0x8faa, 0xf5fc, 0xf5f2, 0xf74a, 0xc4f5, 0xf5f9, 0xa050, 0xf7f4, + 0xf74b, 0xf749, 0xf747, 0xf748, 0xf74c, 0xc5d9, 0xf7f2, 0xf7f0, + 0xf7f5, 0xf7f3, 0xf7f6, 0xc5da, 0xf7f1, 0x90d3, 0xf8bc, 0x9556, + 0xf945, 0xf946, 0xf947, 0xf9c7, 0xf9bd, 0xca4f, 0xaaea, 0xad68, + 0xd3b8, 0xd3b7, 0xb040, 0xb342, 0xd77c, 0xd77b, 0xb5ea, 0xb8b8, + 0xb8b7, 0xb8b9, 0xe3d4, 0xe77e, 0xeb58, 0xeb5a, 0xeb59, 0xc1ab, + 0xee57, 0xf0ba, 0xf9a5, 0xa6e4, 0x8fb8, 0xcdc9, 0xcdca, 0xcdc8, + 0xcdc7, 0xaaeb, 0x99c8, 0xd0a9, 0xd0a7, 0xd0a6, 0xad69, 0xad6b, + 0xad6a, 0xd0a8, 0x8faf, 0xd3c4, 0xd3c1, 0xd3bf, 0xb041, 0xd3c2, + 0xb046, 0xd3bc, 0xd3cb, 0xd3cd, 0xd3bd, 0x99c9, 0xb043, 0xd3ce, + 0xd3c9, 0xd3bb, 0xd3c0, 0xd3ca, 0xd3c6, 0xd3c3, 0xb048, 0xd3cc, + 0xd3be, 0x9579, 0xd3c7, 0xd3b9, 0xb047, 0xb044, 0xd3c5, 0xd3c8, + 0xd3ba, 0xb045, 0xb042, 0x9f49, 0xb34c, 0xd7a5, 0xb34b, 0x99ca, + 0xd7a8, 0xd7ab, 0xb348, 0xb346, 0xd77e, 0xd7a9, 0xd7a7, 0xd7a4, + 0xd7ac, 0xd7ad, 0xd7af, 0xd7b0, 0xd77d, 0xb345, 0xd7a2, 0xd7a1, + 0xd7ae, 0xb347, 0xd7a3, 0xb349, 0xb344, 0xd7a6, 0xb34d, 0xb34a, + 0xd7aa, 0xb5f1, 0xdbbf, 0xdbb4, 0xb5ee, 0xdfe7, 0xdbbd, 0xdbb1, + 0xb5ec, 0xdbb6, 0xb5ef, 0xdbba, 0xdbb8, 0xb5f2, 0xb5eb, 0xdbb2, + 0xdbb5, 0xb5f0, 0xdbb3, 0xdbbe, 0xdbbc, 0xdbb7, 0xdbb9, 0xdbbb, + 0xb5ed, 0x99cb, 0xdfe8, 0xdfee, 0xdfe4, 0xdfea, 0xb8ba, 0xdfe6, + 0xb8c0, 0xb8bf, 0xb8be, 0xdfed, 0xb8c1, 0xb8c2, 0xdfe3, 0xdff0, + 0xb8c3, 0xb8bd, 0xb8bc, 0xdfec, 0xb8c4, 0xdfe2, 0xdfe5, 0xdfef, + 0xdfeb, 0xe3f4, 0xe3e9, 0xb8bb, 0xbb6a, 0xe3dd, 0xe3f2, 0xe3de, + 0xbb65, 0xe3db, 0xe3e4, 0xe3dc, 0xbb67, 0xe3d6, 0xe3f1, 0xbb68, + 0xe3ee, 0xe3ef, 0xe3d7, 0xbb6d, 0xe3e6, 0xe3e0, 0xe3e7, 0xe3da, + 0xe3f3, 0xe3eb, 0xe3e5, 0xe3d5, 0xbb69, 0xe3ec, 0xbb6c, 0xe3f0, + 0xe3ea, 0xbb66, 0xe3e8, 0xe3e2, 0xbb64, 0xe3d9, 0xe3e1, 0xe3ed, + 0xe3df, 0xe3e3, 0xbdc1, 0xdfe9, 0xe7b2, 0xe7bb, 0xe7b1, 0xe7ad, + 0xe7aa, 0xbdc2, 0xe7a8, 0xbb6b, 0xe7a1, 0xbdc0, 0xe7a7, 0xbdbf, + 0xe7ac, 0xe7a9, 0xe7b9, 0xe7b4, 0xe7ae, 0xe7b3, 0xbdbb, 0xe7ab, + 0xe7be, 0xe7a2, 0xe7a3, 0xe7ba, 0xbdbc, 0xe7bf, 0xbdbe, 0xe7c0, + 0xe7b0, 0xe3d8, 0xe7b6, 0xe7af, 0xe7b8, 0xe7b5, 0x9dd5, 0x8fb0, + 0xe7a6, 0xbdb9, 0xe7bd, 0xbdba, 0xe7a4, 0xbdbd, 0xeb64, 0xe7b7, + 0xe7bc, 0xfa7a, 0xeb61, 0xbdb8, 0xbfc0, 0xeb6b, 0xeb67, 0x9e5f, + 0xeb65, 0xeb60, 0xeb6f, 0x99cd, 0xa0c9, 0xbfc4, 0xeb5c, 0xeb68, + 0xeb69, 0xeb5f, 0xeb5e, 0xeb6c, 0xeb62, 0xeb5d, 0xeb63, 0xeb6e, + 0xeb5b, 0xeb6d, 0xeb6a, 0xbfc2, 0xbfc1, 0xbfc3, 0xeb66, 0xf0cb, + 0x9adb, 0xa0c6, 0xee59, 0xc1b1, 0xee5d, 0xee5a, 0xee61, 0xee67, + 0xee5c, 0x8fb4, 0xee70, 0xc1ae, 0xee6a, 0xee5f, 0xee6b, 0xee66, + 0xee6d, 0xee5e, 0xc1b3, 0xc1b2, 0xee60, 0xee6e, 0xee58, 0xee6c, + 0xc1ac, 0xa0d7, 0xee64, 0xee63, 0xee68, 0xee5b, 0xc1b0, 0xc1b4, + 0xee62, 0xee69, 0xc1b5, 0xee65, 0xa0c7, 0xc1ad, 0xc1af, 0xf0c7, + 0xf0c5, 0xa043, 0xf0cc, 0xf0c9, 0xf0cd, 0x8fb5, 0xf0be, 0xf0c6, + 0xf0d1, 0xee6f, 0xf0c2, 0xc2cf, 0xe7a5, 0xf0bd, 0xf0ca, 0xf0c4, + 0xf0c1, 0xf0bc, 0xf0bb, 0xf0d0, 0xf0c0, 0xf0bf, 0xc2cd, 0xf0c8, + 0x8fb2, 0xc2cc, 0xc2ce, 0xf0c3, 0xf0cf, 0xa061, 0xf2de, 0xf2df, + 0xc3c9, 0xf2dc, 0xc3c6, 0xf2e4, 0xc3ca, 0xf2e6, 0xf2db, 0xf0ce, + 0xf2e8, 0xf2dd, 0x9e5e, 0xc3c7, 0xf2e3, 0xf2e5, 0xf2e0, 0xf2e7, + 0xf2e2, 0xf2e1, 0xc3c8, 0x8fb6, 0xf4c5, 0xf4c6, 0xf4c8, 0xc4ae, + 0xc4af, 0xf4c9, 0xf4c7, 0x9fe8, 0xf4c4, 0xf642, 0xf645, 0xf641, + 0xc4fa, 0xf643, 0xc4f9, 0xc4f8, 0xc4f7, 0xf644, 0xf751, 0xf74f, + 0x9cb2, 0xf74e, 0xf640, 0xf750, 0xf646, 0xf74d, 0x957c, 0xf7f9, + 0xf7d7, 0xf7f7, 0xc5db, 0xf7f8, 0xf7fa, 0xf8bf, 0xc5fa, 0xf8be, + 0xf8bd, 0xc5fb, 0xc65a, 0xf96e, 0xf9a7, 0xf9a6, 0xf9a8, 0xa6e5, + 0xd0aa, 0x9fc7, 0xd3cf, 0xd3d0, 0x8fbb, 0x8fbc, 0xdbc0, 0xf647, + 0xf8c0, 0xa6e6, 0xad6c, 0xd0ab, 0x8fec, 0xd7b1, 0xb34e, 0xdbc2, + 0xdbc1, 0xb5f3, 0xb8c5, 0xe7c1, 0xbdc3, 0xbdc4, 0x8fc0, 0x936a, + 0xbfc5, 0xc5fc, 0xa6e7, 0x8be4, 0x9c7c, 0xd0ac, 0xaaed, 0xd0ae, + 0xd0ad, 0xad6d, 0xd3d1, 0x95a1, 0xd3d8, 0xb049, 0xd3d6, 0xd3d4, + 0xd3db, 0xd3d2, 0xd3d3, 0xb04a, 0xb04e, 0xd3dc, 0xb04d, 0xd3da, + 0xd3d7, 0xd3d5, 0xb04b, 0xb04c, 0xd3d9, 0xfeec, 0x95a3, 0xb350, + 0xd7b2, 0xb355, 0xd7c2, 0xb354, 0xd7c4, 0x8c45, 0x8cb8, 0xd7b8, + 0xb352, 0xd7c3, 0xd7b3, 0xb353, 0xd7bf, 0xd7bb, 0xd7bd, 0xd7b7, + 0xd7be, 0x8fc1, 0xb34f, 0xd7ba, 0xa052, 0xd7b9, 0xd7b5, 0xd7c0, + 0xd7bc, 0xd7b4, 0xd7b6, 0xb351, 0xd7c1, 0x99d0, 0xb5f6, 0xdbcd, + 0x8fc3, 0x8fc4, 0xdbc9, 0xdbcb, 0xdbc6, 0xdbc5, 0xdbc3, 0xdbca, + 0xdbcc, 0xdbc8, 0x95a4, 0xdbc7, 0xb5f4, 0xb5f5, 0x8fc6, 0x9e60, + 0xdbcf, 0xb8cd, 0xdff2, 0xdff8, 0xdff3, 0xdff4, 0xf9d8, 0xdff9, + 0xb8cf, 0xb8c7, 0xb8ce, 0xdff1, 0xdbc4, 0xb8ca, 0xb8c8, 0xdff7, + 0xdff6, 0xb8c9, 0xb8cb, 0xdff5, 0xb8c6, 0xb8cc, 0x95a5, 0xe3f6, + 0xbb74, 0xe442, 0xe441, 0xe3fb, 0xbb76, 0xe440, 0xe3f7, 0xe3f8, + 0xbb6e, 0xbb70, 0x9cb3, 0xe3fd, 0xe3f5, 0xbb72, 0xbb71, 0xe3f9, + 0xe3fe, 0xe3fc, 0xbb73, 0xe3fa, 0x99d1, 0xfef1, 0xdbce, 0xbb6f, + 0xe7c2, 0xe7c9, 0xbdc6, 0xe7cd, 0xbdca, 0xe7c5, 0xe7c3, 0xe7cc, + 0xbdc5, 0xe7cb, 0xbdc7, 0xbdc8, 0xe7c4, 0xbdc9, 0xe7ca, 0xe7c6, + 0xe7c7, 0xe7c8, 0xbb75, 0xeb70, 0xeb7c, 0xbfca, 0xeb77, 0xeb79, + 0x99d2, 0xbfc8, 0xeb71, 0xeb75, 0xeb78, 0xbfc6, 0xbfc9, 0xeb7b, + 0xeb73, 0xeb74, 0xeb7a, 0xeb72, 0xeb76, 0xbfc7, 0xee72, 0xee71, + 0xc1b7, 0xee77, 0xc1b9, 0xc1b6, 0xee73, 0xc1ba, 0xee74, 0xee75, + 0xee78, 0x9cc2, 0xc1b8, 0xf0d6, 0x99d3, 0xf0d9, 0xf0d3, 0xf0d5, + 0x95a7, 0xf0d4, 0xf0d7, 0xf0d8, 0xee76, 0xf0d2, 0x95a9, 0xc3cd, + 0xf2ec, 0xf2ef, 0xf2f1, 0xf2ea, 0xf2eb, 0xf2ee, 0xf2f0, 0xc3ce, + 0xc3cc, 0xc3cb, 0xf2ed, 0xf2e9, 0xf4ca, 0xc4b0, 0x95a6, 0xf4cb, + 0xf649, 0xc4fb, 0xf64b, 0xc4fc, 0xf648, 0xf64a, 0xc5a8, 0xf752, + 0xc5a7, 0xf7fd, 0xf7fc, 0xf7fb, 0x9c5d, 0xf948, 0xf949, 0xf94b, + 0xf94a, 0xca50, 0xa6e8, 0x98e2, 0xad6e, 0xd7c5, 0xb5f7, 0xdffa, + 0xc2d0, 0x8fc9, 0xf2f2, 0xa0c2, 0x8fca, 0xa8a3, 0xb357, 0x99d4, + 0xb356, 0xa0b9, 0xdbd0, 0xb5f8, 0xdbd2, 0xdbd1, 0xdffb, 0xb8d0, + 0xe443, 0xe446, 0xe445, 0xe444, 0xe7ce, 0xe7d0, 0xe7cf, 0x9b58, + 0xbfcc, 0x8fcd, 0xa0d4, 0xbfcb, 0xc1bb, 0xee79, 0xee7b, 0xee7a, + 0xc2d1, 0xf2f4, 0xf2f3, 0xf4cc, 0xc4b1, 0x8fce, 0xc4fd, 0xf754, + 0xf753, 0xc65b, 0x8be5, 0x8979, 0xa8a4, 0xd0af, 0xad6f, 0xd7c8, + 0xd7c6, 0xd7c7, 0xdbd4, 0xdbd5, 0xe043, 0xdbd3, 0xdffc, 0xe041, + 0xe040, 0xe042, 0xb8d1, 0xdffe, 0xdffd, 0xe044, 0x8fd0, 0xe449, + 0xe447, 0xe448, 0xe7d3, 0xe7d1, 0xe7d2, 0xeb7d, 0xee7c, 0xee7d, + 0xc2d2, 0xf2f5, 0xf4cd, 0xc4b2, 0xf64c, 0xf755, 0xc5a9, 0xf7fe, + 0xf94c, 0xa8a5, 0xad71, 0xad72, 0xd0b0, 0xd0b1, 0xad70, 0xb054, + 0xb052, 0xb051, 0xb058, 0xb050, 0xb059, 0xd3dd, 0xb056, 0xb053, + 0xb057, 0xb055, 0xb04f, 0xb35f, 0x95b6, 0xb359, 0xd7cc, 0xb35e, + 0xb360, 0xb35a, 0xb35b, 0xd7ca, 0x99d6, 0xb358, 0x95e5, 0xd7cb, + 0xb35d, 0xd7c9, 0xb35c, 0xb644, 0xb646, 0x99d7, 0xdbd8, 0xb645, + 0xb5f9, 0xb5fd, 0x95b5, 0xb8e4, 0xe049, 0xdbda, 0xb5fe, 0xdbdd, + 0xdbde, 0xb643, 0xdbe0, 0xa0ca, 0xdbe2, 0xdbe3, 0xdbd7, 0xdbd6, + 0xdbe4, 0xb642, 0xdbe1, 0xdbdf, 0xb640, 0xb5fb, 0xb647, 0xdbdb, + 0xdbdc, 0xdbd9, 0xb641, 0xb5fc, 0xb5fa, 0xe048, 0xb8df, 0xb8da, + 0xb8d5, 0x9ffd, 0xb8e5, 0xb8d6, 0xb8d2, 0xb8e1, 0xb8de, 0xb8e0, + 0xb8d7, 0xb8dc, 0xb8d3, 0xb8d4, 0xe050, 0xe04d, 0xe045, 0xe04a, + 0xb8e2, 0xe051, 0xb8e3, 0xb8d9, 0xa058, 0xe047, 0xe04f, 0xe04b, + 0xe04e, 0xe04c, 0xb8dd, 0xe046, 0xb8d8, 0xe44c, 0xbb78, 0xbb7b, + 0xe44e, 0x8fd6, 0xbba5, 0xe44d, 0xbb7d, 0x99d8, 0xbdcf, 0xe44f, + 0xbba4, 0xe44b, 0xbba6, 0x8fd3, 0xbb79, 0xb8db, 0xbb7c, 0xbb7a, + 0xbb7e, 0xbba2, 0xbb77, 0xbba7, 0xbba3, 0x8fe5, 0xbba1, 0xe44a, + 0x8fe9, 0xbdd6, 0xbdd2, 0x99d9, 0xbdd9, 0xe7d6, 0xbdda, 0xe7e2, + 0xe7db, 0xbdcb, 0xe7e3, 0xe7dd, 0xbdd5, 0xe7de, 0xbdd4, 0xe7e1, + 0xbdce, 0xe7df, 0xe7d5, 0xbdcd, 0xebaa, 0xbdd3, 0xbdd0, 0xbdd8, + 0xe7d4, 0xe7d8, 0xbdcc, 0xe7d7, 0xe7d9, 0xe7da, 0xbdd7, 0xe7dc, + 0xe7e0, 0xe7e4, 0x927c, 0xbddb, 0xbfd2, 0xeba5, 0xebab, 0xeba8, + 0xeb7e, 0xebac, 0xeba1, 0xeba7, 0xbfcd, 0xbfd3, 0xebad, 0x9c45, + 0xbfcf, 0xbfd9, 0xbfd4, 0xebaf, 0xeba9, 0xbfd0, 0xeba2, 0xbfda, + 0xeba3, 0xeba4, 0xbfdb, 0xbfd8, 0xbdd1, 0xbfce, 0xebb0, 0xbfdc, + 0xbfd5, 0xebae, 0xbfd1, 0xbfd6, 0xbfd7, 0xc1c3, 0xeea4, 0xeead, + 0xeeaa, 0xeeac, 0xc1c0, 0xeea5, 0x8fde, 0xeeab, 0xc1bc, 0xeea7, + 0xc1c4, 0xeea3, 0xeea8, 0xeeaf, 0xeba6, 0xeea9, 0xeea2, 0xc1bd, + 0xeea1, 0xc1be, 0xeeb0, 0xc1bf, 0xeeae, 0xc1c2, 0xee7e, 0x8fdf, + 0xc1c1, 0xeea6, 0xf0dc, 0xf0ea, 0xf0e5, 0xf0e7, 0xf0db, 0xc2d3, + 0xf0da, 0xc2d6, 0xc2d5, 0xa04b, 0xf0e9, 0xf0e1, 0xf0de, 0xf0e4, + 0xf0dd, 0xf0df, 0xf0e8, 0xf0e6, 0xc2d4, 0xf0ed, 0xf0eb, 0xf0e2, + 0xf0ec, 0xf0e3, 0x8fe2, 0xf2f9, 0xc3cf, 0xf341, 0xa0cc, 0xf64f, + 0xc3d6, 0xf0e0, 0xf2f7, 0xc3d2, 0xf2f8, 0xf2fd, 0x8fe3, 0x8fe4, + 0xc3d4, 0xc3d5, 0xf2f6, 0xf340, 0xf342, 0xf2fa, 0xf2fc, 0xf2fe, + 0xf2fb, 0xf343, 0xc3d1, 0xc3d7, 0xc3d3, 0xc3d0, 0xf4d0, 0x9bc4, + 0xc4b7, 0xf4ce, 0x9bfc, 0xf4d2, 0xf4d3, 0xc4b5, 0xf4d4, 0xf4d1, + 0x964c, 0xf4cf, 0xc4b8, 0xc4b4, 0xf4d5, 0xc4b6, 0xc4b3, 0xc4fe, + 0xc540, 0xf64e, 0xf64d, 0xf650, 0xf651, 0xc541, 0xf756, 0xf75b, + 0xc5aa, 0x9af6, 0xf758, 0x8cae, 0xf757, 0xf75a, 0xf759, 0xf843, + 0xc5dc, 0xf842, 0xf840, 0xf841, 0x8fe7, 0xc5fe, 0xc5fd, 0xf8c1, + 0xf8c2, 0xc640, 0xf94d, 0xf94e, 0xc667, 0x8fe8, 0xc66d, 0xf9a9, + 0xf9c8, 0x8be7, 0x897a, 0x897b, 0xa8a6, 0xd7cd, 0xd7ce, 0xe052, + 0xe450, 0xe7e5, 0xc1c6, 0xc1c5, 0xf0ee, 0xf344, 0xf844, 0xa8a7, + 0xd3de, 0xb05a, 0xb361, 0xe054, 0xe053, 0xbddc, 0xe7e6, 0xbddd, + 0xeeb1, 0xc2d7, 0x99da, 0xc676, 0xa8a8, 0xcdcb, 0xd3df, 0xb362, + 0xd7cf, 0xd7d0, 0xdbe5, 0xb648, 0xb8e6, 0xe056, 0xe055, 0xe057, + 0xe451, 0xe452, 0xbba8, 0xbfdd, 0xbdde, 0xbfde, 0xeeb5, 0xeeb2, + 0xeeb4, 0xeeb3, 0xc1c7, 0xf0ef, 0xf346, 0xf345, 0xcba4, 0xb05c, + 0xb05b, 0xd3e0, 0xd7d1, 0xdbe7, 0xdbe6, 0xb649, 0xe059, 0xe05a, + 0xe058, 0xb8e8, 0xb8e7, 0xbbaa, 0xbba9, 0xe7e7, 0xebb3, 0xebb1, + 0xebb2, 0xbfdf, 0xeeb7, 0xeeb6, 0xf0f2, 0xf0f1, 0xf0f0, 0xf347, + 0x8fed, 0xf9aa, 0xa8a9, 0xad73, 0x95c0, 0xad74, 0xb05d, 0xb05e, + 0xd3e2, 0xd3e1, 0xd7d2, 0xb368, 0xb366, 0xb363, 0xb367, 0xb365, + 0xb364, 0xa0cb, 0xb64a, 0xdbea, 0xb8ed, 0xb64c, 0xb651, 0xdbec, + 0xb653, 0xb652, 0xb655, 0xdbeb, 0xdbe8, 0xb64f, 0xb64b, 0xb64d, + 0xdbe9, 0xb654, 0xb650, 0xb64e, 0xb8ef, 0xb8ee, 0xb8ec, 0xb8f0, + 0xb8ea, 0xb8eb, 0xb8e9, 0xe05b, 0x9e48, 0xe454, 0xbbac, 0xbbad, + 0xbbab, 0x99db, 0xe453, 0x8ff3, 0xe455, 0xe7ea, 0xe7ec, 0x8ff9, + 0xbde7, 0xe7ed, 0xbde0, 0xe7e9, 0xbddf, 0xbde9, 0xbde5, 0xbde6, + 0xbde2, 0xe7e8, 0xbde1, 0xe7ee, 0xe7eb, 0x95c1, 0xbde8, 0xa04e, + 0xbde3, 0xbde4, 0xebb5, 0xebb7, 0xebb6, 0x99dc, 0xebb8, 0xbfe0, + 0xebb4, 0xa064, 0xc1cb, 0xeeb8, 0xc1c8, 0xc1cc, 0xc1ca, 0xc1c9, + 0xf0f3, 0xf0f6, 0xf0f5, 0x8ff7, 0xf0f4, 0xc2d8, 0xf348, 0xf349, + 0xc3d8, 0xf34a, 0xc3d9, 0x89b0, 0xa048, 0xc4ba, 0xc4b9, 0xf652, + 0x8ffb, 0x8ff6, 0xc542, 0xf653, 0xf75c, 0xc5ab, 0xc5ac, 0x9ddc, + 0xf845, 0xc642, 0x99dd, 0x8be8, 0xa8aa, 0xb36a, 0xb369, 0xe05c, + 0xe05d, 0xbbae, 0xebb9, 0xbdea, 0xebba, 0xeeb9, 0xa8ab, 0xd0b2, + 0xad76, 0xad75, 0xd3e3, 0xb05f, 0xd3e4, 0xd7d5, 0x92c1, 0xd7d4, + 0xd7d3, 0xdbee, 0xb658, 0x9fd6, 0xdbed, 0xb657, 0xdbef, 0xb656, + 0xe05f, 0xe062, 0xe060, 0xe061, 0xe065, 0xe05e, 0xe066, 0xe063, + 0xe064, 0xbbb0, 0xe456, 0xbbaf, 0xe7f2, 0xe7f0, 0xbdeb, 0xe7ef, + 0xe7f1, 0xbdec, 0xebbb, 0xa0d2, 0xebbc, 0xc1cd, 0x9040, 0xf34c, + 0xf34e, 0xf34b, 0xf34d, 0xf4d6, 0xf654, 0xf96f, 0xa8ac, 0xad77, + 0xd3e5, 0xd3e7, 0xd3e6, 0xd7d8, 0xb36c, 0xd7d6, 0xb36b, 0xd7d9, + 0x8ac4, 0xd7da, 0xd7d7, 0x99e0, 0xdbfb, 0xb660, 0xdbf3, 0xdbf9, + 0xb65b, 0xb65e, 0xdbf2, 0xb659, 0xdbf6, 0xe06c, 0xb65d, 0xdbf1, + 0x9ff0, 0xdbf7, 0xdbf4, 0xdbfa, 0xdbf0, 0xdbf8, 0xb65c, 0xb65f, + 0xdbf5, 0xb65a, 0xb8f2, 0xe068, 0xb8f1, 0xe06f, 0xe06e, 0xb8f8, + 0xb8f9, 0xe070, 0xb8f3, 0xe06d, 0xb8f7, 0xe072, 0xe069, 0xe06b, + 0xb8f4, 0xe067, 0xe06a, 0xe071, 0xb8f5, 0xe073, 0xb8f6, 0xbbb1, + 0xe45b, 0xe461, 0xe459, 0xe462, 0x9ff3, 0xe458, 0xe45d, 0xe463, + 0xe460, 0xe45f, 0xe45e, 0xe457, 0xe45c, 0xe45a, 0x9dbf, 0xbdf1, + 0xbdee, 0xe7fb, 0xe841, 0xe843, 0xe840, 0xe7f8, 0xe7fa, 0xe845, + 0xe842, 0xe7fc, 0xe846, 0xe7f9, 0xe844, 0xbdef, 0xbdf5, 0xbdf3, + 0xe7f3, 0xbdf4, 0xbdf0, 0xe7f4, 0xe7f6, 0xe7f5, 0xe7fd, 0xe7fe, + 0x9ff6, 0xbdf2, 0x95c8, 0xbded, 0x9e5a, 0xe7f7, 0xebc6, 0xbfe2, + 0xebbd, 0xbfe3, 0xbfe6, 0xebc2, 0xebbf, 0xbfe5, 0x99e3, 0xebc3, + 0xebc4, 0xebbe, 0xebc7, 0xebc0, 0xebc5, 0xbfe4, 0xbfe1, 0xebc1, + 0x8a4a, 0xeebf, 0xc1d0, 0xc1ce, 0xc1d1, 0xc1cf, 0xeebe, 0xeebb, + 0xeeba, 0x9ff1, 0xeebd, 0xeebc, 0xf145, 0xc2de, 0xf0fb, 0xf0fa, + 0xc2d9, 0xf141, 0xf140, 0xf0f7, 0xf143, 0xf0fc, 0xc2dd, 0xf0f9, + 0xf142, 0xf0f8, 0xc2da, 0xc2dc, 0xf0fd, 0xc2db, 0xf0fe, 0x8aa7, + 0xf144, 0xf352, 0xc3de, 0xf34f, 0xf353, 0x99e6, 0xc3db, 0xf351, + 0xc3e0, 0x9ff7, 0xc3dd, 0x9fed, 0xf350, 0xc3df, 0xf354, 0xc3da, + 0x8a5c, 0x9dae, 0xc4bc, 0xc4be, 0xf4d9, 0xc4bd, 0xf4d7, 0xc3dc, + 0xf4d8, 0xc4bb, 0xc543, 0xc545, 0xf656, 0xc544, 0xf655, 0xf761, + 0xc5ad, 0xf760, 0xc5ae, 0xf75e, 0xf75d, 0xf762, 0xf763, 0xf846, + 0xf75f, 0xf8c6, 0xf8c3, 0xf8c4, 0xf8c5, 0xc65c, 0xf951, 0xf950, + 0xf94f, 0xf970, 0x95c9, 0xf9be, 0xf9ab, 0xc66e, 0xa8ad, 0xb060, + 0x9048, 0x99e8, 0xb8fa, 0x9049, 0x8cba, 0xbdf6, 0x90b1, 0xebc8, + 0xc2df, 0xf355, 0x904a, 0xf9ac, 0xa8ae, 0xaaee, 0xad79, 0xad78, + 0x99ea, 0xb063, 0xd3e8, 0xb061, 0xd3e9, 0xb062, 0xd7df, 0xd7db, + 0x9bd1, 0xb36d, 0xd7de, 0xd7dd, 0xd7dc, 0xb36e, 0xd7e0, 0xd7e1, + 0x99eb, 0x99ec, 0xdc43, 0xdc41, 0xdc45, 0xdc46, 0xdc4c, 0xdc48, + 0xdc4a, 0x99ed, 0xdc42, 0xdbfc, 0xdc49, 0x99ee, 0xdc4b, 0xdc44, + 0xdc47, 0xdbfd, 0xb662, 0xdc40, 0xdbfe, 0xb661, 0xb663, 0xb8fd, + 0xe075, 0xe077, 0xe076, 0xe07b, 0xb8fb, 0xe078, 0xe074, 0xe079, + 0xe07a, 0xb8fc, 0xb8fe, 0xe07c, 0xe467, 0xe466, 0xe464, 0xe465, + 0xbbb3, 0xbbb5, 0xbbb2, 0xbbb4, 0xe84d, 0xe84e, 0xe849, 0x904c, + 0xe84a, 0xbdf8, 0xbdfd, 0xbdf7, 0xbdfe, 0xbdf9, 0xe84b, 0xe84c, + 0xe848, 0xbe40, 0xbdfb, 0xbdfa, 0xbdfc, 0xe847, 0x904d, 0xebca, + 0xbfe8, 0x95cb, 0xebcc, 0xbfea, 0xebcf, 0xebcb, 0xebc9, 0xebce, + 0xbfe9, 0xebcd, 0xbfe7, 0xc1d3, 0xc1d6, 0xeec1, 0x97e2, 0xc1d4, + 0xeec0, 0xc1d2, 0xc1d5, 0xf146, 0xf147, 0xf148, 0xc2e0, 0x95cc, + 0xf149, 0xc2e1, 0xc3e2, 0xf358, 0xf359, 0xf357, 0xf356, 0xf35a, + 0xc3e1, 0xf4dd, 0xf4db, 0xf4dc, 0xf4de, 0xf4da, 0xf4df, 0xf658, + 0x9f78, 0xf659, 0xf657, 0xc546, 0xf764, 0xc5af, 0xf765, 0xf848, + 0xf847, 0x897c, 0x897d, 0x897e, 0x995d, 0xa8af, 0xb664, 0xb940, + 0x9b5a, 0xbbb6, 0x9050, 0xbfec, 0x8c4f, 0xbfeb, 0xc3e3, 0xc47c, + 0xc547, 0xa8b0, 0xb064, 0xb941, 0x9054, 0xf35b, 0xc6d6, 0x9aa8, + 0x99ef, 0xfeeb, 0x9da3, 0x9da1, 0x9943, 0x9945, 0x9d7d, 0xcba6, + 0x99f0, 0xa8b1, 0xa8b4, 0xa8b3, 0xa8b2, 0xcba5, 0x99f1, 0xcdcd, + 0x99f2, 0xcdcf, 0xaaef, 0x8cbc, 0x9d60, 0xaaf1, 0xcdcc, 0xcdce, + 0xaaf0, 0xcdd1, 0xcdd0, 0xcdd2, 0xa0a3, 0xd0b6, 0xd0b4, 0xad7c, + 0xd0b3, 0xada3, 0xad7e, 0xad7b, 0xada4, 0xad7d, 0xada2, 0xada1, + 0xd0b5, 0xad7a, 0xb06a, 0xd3eb, 0xd3f1, 0xb067, 0xb06e, 0x905b, + 0xb069, 0xd3ee, 0xd3f0, 0xb06c, 0xd3ea, 0xd3ed, 0xb068, 0xb065, + 0xd3ec, 0xb06b, 0xd3ef, 0xb06d, 0xb066, 0x9edb, 0xd7e3, 0xd7e6, + 0xb370, 0xb37a, 0xb376, 0xd7e4, 0x9d79, 0xb37e, 0xb377, 0xb37c, + 0xb372, 0xb36f, 0xb371, 0xb37d, 0xd7e5, 0xb375, 0xb378, 0xb374, + 0xb379, 0xd7e7, 0xb37b, 0xb373, 0xd7e2, 0xdc4d, 0xb665, 0xdc4f, + 0xb667, 0xb669, 0x99f3, 0xdc4e, 0xb666, 0xb66a, 0x9062, 0xb668, + 0xb947, 0xe0a3, 0xb94f, 0xe07e, 0xb950, 0xb945, 0xe0a1, 0xb94a, + 0xe0a2, 0xb943, 0xb942, 0x9f55, 0xb94d, 0xb94c, 0xb94b, 0xb949, + 0xb94e, 0xe07d, 0xb944, 0xb946, 0xb948, 0x9bf9, 0xbbb8, 0xbbbb, + 0xbbbf, 0xbbb9, 0xbbbe, 0xbbbc, 0xbbb7, 0x9065, 0xbbbd, 0xbbba, + 0x96e0, 0xe852, 0xbe43, 0xbe41, 0xe853, 0x98be, 0xbe44, 0xbe42, + 0xe851, 0xe850, 0xbff0, 0xe84f, 0xbfee, 0xbfed, 0xebd0, 0xbe45, + 0xbfef, 0xebd1, 0xbff2, 0xebd2, 0xbff1, 0xc1d8, 0xeec3, 0xc1d7, + 0xc1dc, 0xc1da, 0xc1db, 0xc2e3, 0xc1d9, 0xeec2, 0xebd3, 0xc2e2, + 0xc2e4, 0xc3e4, 0xc3e5, 0xf4e0, 0xc5de, 0xc5dd, 0xa8b6, 0xca55, + 0xb06f, 0xca52, 0xca53, 0xca51, 0xca54, 0xcbaa, 0xcba7, 0xcbac, + 0xcba8, 0xa8b7, 0xa8ba, 0xcba9, 0xa8b9, 0xcbab, 0x9068, 0xa8b8, + 0x906c, 0xcdd5, 0xcdd7, 0xaaf4, 0xcdd3, 0xcdd6, 0xcdd4, 0xaaf2, + 0xaaf5, 0xaaf3, 0x95d8, 0xd0b8, 0xd0bc, 0xd0b9, 0xada7, 0xada8, + 0x906a, 0xd0bb, 0xd0bd, 0xd0bf, 0xada5, 0xd0be, 0xada6, 0xd7ee, + 0xd0ba, 0xd3f2, 0xd3fb, 0xd3f9, 0xd3f4, 0xd3f5, 0xd3fa, 0xd3fc, + 0xb071, 0xd3f7, 0xd3f3, 0xb070, 0xb072, 0xd3f6, 0xd3fd, 0xd3f8, + 0xb3a1, 0xd7f1, 0xd7e9, 0xd7ef, 0xd7f0, 0xb3a2, 0xd7e8, 0xd7ea, + 0xd0b7, 0xd7ec, 0xd7ed, 0xd7eb, 0xb66c, 0xdc56, 0xebd4, 0xdc57, + 0xdc54, 0xb3a3, 0xb66e, 0xdc53, 0xdc59, 0xdc58, 0xb66b, 0xdc5c, + 0xdc52, 0xdc5b, 0xdc50, 0xdc5a, 0xdc55, 0xb66d, 0xe0aa, 0xe0a5, + 0xe0ab, 0xe0a6, 0xe0a4, 0xe0a7, 0xb951, 0xe0a9, 0xe0a8, 0xb952, + 0xbbc1, 0xbbc0, 0xe46e, 0xe471, 0xe469, 0xe46d, 0xbbc2, 0xe46c, + 0xe46a, 0xe470, 0xe46b, 0xe468, 0xe46f, 0xe859, 0xbe48, 0xf14a, + 0xe856, 0xe857, 0xe855, 0xdc51, 0xbe47, 0xe85a, 0xe854, 0xbe46, + 0xbe49, 0xe858, 0xebd5, 0xbff3, 0xebd6, 0xebd7, 0xeec4, 0xc1dd, + 0xf14b, 0xf14c, 0xf14d, 0xf35d, 0xf35c, 0xf4e2, 0xf4e1, 0xf65b, + 0xf65c, 0xf65a, 0xf766, 0xc5b0, 0xa8bb, 0xadaa, 0xada9, 0xb075, + 0xb074, 0xd440, 0xd441, 0xd3fe, 0x9fb2, 0xb073, 0xd7f5, 0xd7f6, + 0xd7f2, 0xb3a4, 0xd7f3, 0x9fae, 0xd7f4, 0x9fb0, 0x89ad, 0xdc5f, + 0xdc61, 0xdc5d, 0xdc60, 0xb66f, 0xdc5e, 0xb670, 0x906e, 0xdd73, + 0xb955, 0xb954, 0xb953, 0xe0ac, 0xe0ad, 0x9e71, 0xe473, 0xe475, + 0xbbc6, 0xbbc3, 0x9e4a, 0xbbc5, 0xbbc4, 0xe474, 0xe472, 0x9fdc, + 0xe861, 0xe85e, 0xe85f, 0xbe4d, 0xe860, 0xe85b, 0xe85c, 0xbe4a, + 0xbe4b, 0xe85d, 0xbe4c, 0x89ab, 0xebdb, 0x9fb8, 0xebdc, 0xebd9, + 0xebda, 0xbff4, 0xebd8, 0xeec8, 0xeec5, 0xeec7, 0xc1e0, 0xeecb, + 0xc1df, 0xeec9, 0xeecc, 0xeeca, 0xeec6, 0xc1de, 0xf14f, 0xf150, + 0xf14e, 0x9070, 0xf152, 0xc2e5, 0xc2e6, 0xf35f, 0xc3e7, 0xf151, + 0xf35e, 0xc3e6, 0xf4e5, 0xf4e6, 0xc4bf, 0xf4e4, 0x8b63, 0xf4e3, + 0xf65d, 0xc548, 0x95dc, 0xf849, 0xf8c8, 0xf8c7, 0xc643, 0xc65d, + 0xf8c9, 0xf971, 0x9071, 0xc66f, 0xa8bc, 0xaaf6, 0xb956, 0xc4c0, + 0xa8bd, 0xadab, 0xb3a5, 0xb671, 0xc2e7, 0xaaf7, 0xd0c1, 0xd0c0, + 0xd442, 0xfc5e, 0xb078, 0xb076, 0xb07a, 0xd444, 0xb079, 0xb077, + 0x8949, 0xd443, 0xb3a8, 0xd7fc, 0x965b, 0xb3a7, 0xb3a9, 0xd842, + 0xb3ab, 0xd7fe, 0xd840, 0xd7f7, 0xb3aa, 0xd843, 0xd7f9, 0xd7fa, + 0xd7f8, 0xb3a6, 0x8c50, 0xd841, 0xd7fb, 0xd7fd, 0x94a6, 0xdc6d, + 0x8fd5, 0xdc6c, 0xdc6a, 0xdc62, 0xdc71, 0xdc65, 0xdc6f, 0xdc76, + 0xdc6e, 0xb679, 0x9e73, 0xb675, 0xdc63, 0xdc69, 0xb677, 0x9075, + 0xdc68, 0xb678, 0xb67a, 0xdc6b, 0x99f7, 0xb672, 0xb673, 0xdc77, + 0xdc75, 0xdc74, 0xdc66, 0xdc72, 0xb676, 0x8cbf, 0xb674, 0xdc73, + 0xdc64, 0xdc67, 0xdc70, 0x99f9, 0x9663, 0x95b9, 0xe4ba, 0xe0b7, + 0xe0b0, 0xe0c3, 0xe0cc, 0xe0b3, 0xb961, 0x94d4, 0xe0c0, 0xb957, + 0xb959, 0xb965, 0xe0b1, 0xfcfa, 0xb95a, 0xb95c, 0xb966, 0xb95b, + 0x9077, 0x90ab, 0xb964, 0xe0b9, 0xe0ae, 0xb962, 0xe0b8, 0xb95e, + 0xe0ca, 0xb963, 0xe0c8, 0xe0bc, 0xe0c6, 0xb960, 0xe0af, 0xe0c9, + 0xe0c4, 0x9d4d, 0xe0cb, 0xb958, 0x99fa, 0xb967, 0xb95d, 0x92e3, + 0xe0b5, 0x97bb, 0xe0bd, 0xe0c1, 0x9078, 0xe0c5, 0xb95f, 0xe0b4, + 0xe0b2, 0xe0be, 0x99fb, 0xe0bb, 0xe0ba, 0x97e0, 0xe0bf, 0xe0c2, + 0xe0c7, 0xe478, 0x96dc, 0xbbc7, 0xe4a4, 0xe47a, 0xbbcc, 0xbbd0, + 0xe4ad, 0xe4b5, 0xe4a6, 0xbbc8, 0x9ca8, 0xe4aa, 0xe0b6, 0x9772, + 0xbbc9, 0xe4b1, 0xe4b6, 0xe4ae, 0x9440, 0xe4b0, 0xe4b9, 0xe4b2, + 0xe47e, 0xe4a9, 0x92f2, 0xbbd1, 0xbbcd, 0xe47c, 0xe4ab, 0xbbcb, + 0xe4a5, 0xbbca, 0xe4b3, 0xe4a2, 0xe479, 0xbbce, 0xe4b8, 0xe47b, + 0xe4af, 0xe4ac, 0xe4a7, 0xe477, 0xe476, 0xe4a1, 0xe4b4, 0xbbcf, + 0xe4b7, 0xe47d, 0xe4a3, 0xbe52, 0x99fd, 0x99fc, 0xbe5a, 0xbe55, + 0xe8a4, 0xe8a1, 0xe867, 0xbe50, 0xf9d7, 0x964a, 0xbe4f, 0xbe56, + 0x96d8, 0x99fe, 0xe865, 0xbe54, 0xe871, 0xe863, 0xe864, 0xbe4e, + 0xe8a3, 0xbe58, 0xe874, 0xe879, 0xe873, 0xebee, 0xe86f, 0xe877, + 0xe875, 0xe868, 0xe862, 0xe87d, 0xbe57, 0xe87e, 0x904b, 0xe878, + 0xe86d, 0xe86b, 0xe866, 0xfa41, 0xe86e, 0xe87b, 0xe86a, 0xe87a, + 0xe8a2, 0x9a40, 0xbe53, 0x975b, 0xe876, 0xe87c, 0xe872, 0xe86c, + 0xbe51, 0x9a41, 0x91dd, 0xe4a8, 0xe870, 0xbe59, 0xe869, 0x93fc, + 0x9a42, 0x9a43, 0x9659, 0xebf4, 0xbff7, 0xebf3, 0xebf0, 0xec44, + 0xbffb, 0x9a44, 0xec41, 0xebf8, 0xec43, 0xebe9, 0xebf6, 0x9051, + 0xbffd, 0xebe1, 0x94bf, 0xebdf, 0xec42, 0xec40, 0xebfe, 0xebed, + 0xebec, 0xebe2, 0xc040, 0xebe8, 0xebf2, 0xebfd, 0xc043, 0xec45, + 0xc1e8, 0xc045, 0xbffe, 0xebe6, 0xebef, 0xebde, 0xebe0, 0xbff5, + 0xc042, 0xbffa, 0xebe7, 0xebf7, 0xebf1, 0xc041, 0xebdd, 0xc1e3, + 0xebf9, 0xebfc, 0xbffc, 0x90a2, 0xebeb, 0xc044, 0xbff9, 0x9cab, + 0x9776, 0xbff8, 0xebf5, 0xebfb, 0xbff6, 0xebe4, 0xebfa, 0xebe5, + 0xfc55, 0xfe45, 0x94a8, 0x9a45, 0xfa4b, 0x9de1, 0xebea, 0xeed2, + 0x96d9, 0xeed7, 0xc1e5, 0xc1e7, 0xeedd, 0xc1e1, 0xeeec, 0xeee3, + 0xeed8, 0xeed9, 0xeee2, 0xc1ee, 0xeee1, 0xeed1, 0xeee0, 0xeed4, + 0xeeed, 0xc1ed, 0xc1eb, 0xeed5, 0xeee8, 0x9774, 0xeeda, 0xeee7, + 0xfdf5, 0xeee9, 0xeed0, 0xc1e6, 0x92e5, 0xeeea, 0x9645, 0x91da, + 0xeede, 0x90a3, 0xc1ea, 0xeedb, 0xa05f, 0xc1ec, 0xeee4, 0x90af, + 0x97bf, 0xc1e4, 0xeed6, 0xeee5, 0x914c, 0xeedf, 0xebe3, 0xeee6, + 0xeed3, 0x967a, 0xc1e9, 0xeeeb, 0x91de, 0xc1e2, 0xeece, 0x9a46, + 0xfeb0, 0x9779, 0x946c, 0xf160, 0xf159, 0xc2e9, 0xf154, 0xf163, + 0xf15b, 0xeedc, 0x9858, 0xf165, 0xf155, 0xc2e8, 0xf15f, 0xc2ea, + 0xc2f2, 0xc2f0, 0xf161, 0xc2f1, 0xf157, 0x9266, 0xf158, 0xf15d, + 0xf162, 0x93fb, 0xeecd, 0xc2eb, 0xf16a, 0xf167, 0xf16b, 0xf15e, + 0xf15a, 0xf168, 0xf36a, 0xf15c, 0xc2ee, 0x9a47, 0xc2ed, 0xeecf, + 0xc2ef, 0xf164, 0xf166, 0xc2ec, 0xf169, 0xf153, 0xf156, 0x9749, + 0x9748, 0x934a, 0x9ce2, 0xf373, 0xf363, 0xc3eb, 0xf371, 0x9264, + 0xf361, 0xc3ec, 0xf36c, 0x91df, 0xf368, 0xc3f1, 0xf372, 0xf362, + 0xf365, 0xc3e9, 0xf374, 0xfb79, 0xf36d, 0xf370, 0xc3ef, 0xc3f4, + 0xc3f2, 0xf369, 0xf364, 0x96d7, 0xc3ed, 0xc3ee, 0xf360, 0xc3ea, + 0x9343, 0xc3e8, 0xc3f0, 0xf36f, 0xc3f3, 0xf36b, 0xf375, 0xc3f5, + 0xf367, 0xf36e, 0xfdcb, 0xfe7a, 0x91db, 0x8c6a, 0xf4f3, 0xf542, + 0xf4f5, 0xf4fc, 0xf366, 0xf4fa, 0xf4e9, 0xf540, 0xc4c3, 0xf4ed, + 0xf4fe, 0xf4f4, 0x97af, 0xc4c2, 0x95dd, 0xf544, 0xf4f6, 0x9348, + 0xf4fb, 0xf4fd, 0xf4e7, 0xf541, 0xf4f2, 0xf4f7, 0xf4eb, 0xf4ef, + 0xf543, 0xf4f9, 0xf4e8, 0xf4ec, 0xf4ee, 0xf4f8, 0x9a4b, 0xc4c1, + 0xf4f1, 0xfc45, 0x9a4d, 0xf4ea, 0x91bc, 0x90e2, 0x90b4, 0x95e1, + 0xf4f0, 0xf661, 0xf666, 0xc54f, 0xf668, 0x9a4e, 0xc549, 0xf664, + 0xf66a, 0xc54e, 0xc54a, 0xc54b, 0xf660, 0xf667, 0xc54d, 0xf665, + 0xc54c, 0xf65f, 0xf663, 0xf662, 0x9a4f, 0xf65e, 0xf669, 0xfe40, + 0xfe43, 0xc5b1, 0xf76d, 0xf770, 0xf76c, 0xf76e, 0xf76f, 0xf769, + 0xf76a, 0xf767, 0x96dd, 0xf76b, 0xf768, 0xc5b2, 0xc5b3, 0x9a51, + 0xf84b, 0xf84d, 0x96a7, 0x90b0, 0xf84c, 0xf84e, 0xc5e0, 0xf84a, + 0xc5df, 0xc5e1, 0x9c4e, 0x9443, 0xf8cb, 0xf8cc, 0xc644, 0xf8ca, + 0x8eba, 0xf953, 0xf952, 0xf954, 0xc65f, 0xf955, 0xc65e, 0xf956, + 0xf972, 0xf975, 0xf974, 0xc668, 0xf973, 0x9a52, 0xfcc1, 0xc672, + 0xc670, 0xc671, 0xc677, 0xf9c0, 0xf9c1, 0xf9bf, 0xf9c9, 0x8be9, + 0x9caf, 0x8bfd, 0x9abc, 0x9ab8, 0x9aae, 0x9aa7, 0x9a53, 0x9d74, + 0xaaf8, 0x8bea, 0xd844, 0xdc78, 0xe8a5, 0xf376, 0x8beb, 0xaaf9, + 0xadac, 0xb07b, 0x90b2, 0xd845, 0xd846, 0xb3ac, 0xb67d, 0xdc7a, + 0xdc79, 0xb6a3, 0xb67c, 0xdc7b, 0xb67e, 0xb6a2, 0xb6a1, 0xb67b, + 0x95e9, 0x95e8, 0xb968, 0x95e6, 0xe0d0, 0xe0ce, 0xe0cf, 0xe0cd, + 0x90b5, 0xbbd2, 0x9a54, 0xbbd5, 0xbbd7, 0xbbd6, 0x90b3, 0x95e7, + 0xbbd3, 0xbbd4, 0x8b50, 0xe8a7, 0xe8a6, 0xbe5b, 0xe8a8, 0xe8a9, + 0xbe5c, 0xec4d, 0xec4b, 0xeef3, 0xec49, 0xec4a, 0xc046, 0xec46, + 0xec4e, 0xec48, 0xec4c, 0xeeef, 0xeef1, 0xeef2, 0xc1f3, 0xeeee, + 0xc1f2, 0xeef0, 0xc1ef, 0xc1f0, 0xc1f1, 0xec47, 0xc2f5, 0xf16e, + 0xf16c, 0xf16d, 0xc2f3, 0xc2f6, 0xc2f4, 0xf377, 0xf378, 0xc3f6, + 0xf545, 0xf547, 0xf546, 0xc4c4, 0xc550, 0xf66d, 0xf66c, 0xf66b, + 0x8bec, 0x9a56, 0xaafa, 0x8bfb, 0xc9aa, 0xca58, 0xa6e9, 0xca56, + 0xca59, 0xca57, 0xcbae, 0xa8c1, 0xa8c2, 0xcbb0, 0xa8bf, 0xcbaf, + 0xcbad, 0xa8c0, 0xa8be, 0x9a57, 0xa0aa, 0xcdd8, 0xcddb, 0xaafd, + 0xcdda, 0xcdd9, 0xaafc, 0xaafb, 0x9fa6, 0xab40, 0xcddc, 0xaafe, + 0x99cc, 0xd0c6, 0xadae, 0xadaf, 0xadb0, 0xd0c7, 0xd0c3, 0xadad, + 0xd0c4, 0xd0c5, 0xd0c2, 0x9c59, 0xb0a4, 0xb0a1, 0xd445, 0xb0a2, + 0xb0a5, 0xd446, 0xb07e, 0xb07c, 0xb07d, 0xb0a3, 0x99b5, 0xb3ad, + 0xd849, 0xb3b5, 0xd848, 0xd84b, 0xb3b1, 0xd84a, 0xb6ab, 0xb3af, + 0xb3b2, 0xb3ae, 0xb3b3, 0xb3b4, 0xb3b0, 0x90be, 0xd847, 0xb6a7, + 0xdc7d, 0xdca3, 0x9faf, 0xdca2, 0xb6ac, 0xb6a8, 0xb6a9, 0xdc7c, + 0xdc7e, 0xdca1, 0xb6a4, 0xb6a6, 0xb6aa, 0xb6a5, 0x95f2, 0xe0d3, + 0xe0d1, 0xe0d2, 0xb96a, 0xb96b, 0x90bf, 0xe0d4, 0xb969, 0xbbd8, + 0xbbda, 0xbbd9, 0xe4bb, 0xe4bc, 0xe8ab, 0x90c1, 0xe8aa, 0xfee4, + 0xc047, 0xc048, 0xec4f, 0xc049, 0xeef6, 0xeef4, 0xeef5, 0xc1f4, + 0xf16f, 0xc3f7, 0x90c4, 0xc1f5, 0xab41, 0xb0a6, 0xd447, 0x90c7, + 0xd84c, 0xb3b6, 0xb6ad, 0xdca4, 0xdca6, 0xb6af, 0xb6ae, 0xb6b0, + 0xb6b1, 0xdca5, 0xb96e, 0xb96f, 0xb96d, 0xbbdb, 0xb96c, 0xe0d5, + 0xbbdc, 0xe8ac, 0xec50, 0xc04a, 0xc1f6, 0xf170, 0xf174, 0xc2f9, + 0xf171, 0xc2fa, 0xc2f8, 0xf175, 0xc2fb, 0xf173, 0xf379, 0xc2f7, + 0xc3f8, 0xf8cd, 0xab42, 0xb3b8, 0xb3b7, 0xb6b2, 0xdca8, 0xdca7, + 0xb6b3, 0x92e4, 0xe0d9, 0xb973, 0xb970, 0xe0d8, 0xb972, 0xe0d6, + 0xb971, 0xe0d7, 0xe4bd, 0xbbdd, 0xe8af, 0x9f52, 0xbe5d, 0xe8ad, + 0xbe5e, 0xbe5f, 0xe8ae, 0xbe60, 0xec51, 0xc04e, 0xc04b, 0xc050, + 0xec53, 0xc04c, 0xec52, 0xc04f, 0xc04d, 0xeef9, 0xeefb, 0x90db, + 0xc1f7, 0xeefa, 0xc1f8, 0xeef8, 0xeef7, 0xa066, 0xf177, 0xf176, + 0xc2fc, 0xf178, 0xf37e, 0xc3fa, 0xf37d, 0xf37a, 0xc3f9, 0xf37b, + 0xf37c, 0xf548, 0xf549, 0xc4c5, 0x90d2, 0xc553, 0xf66e, 0x90d4, + 0xc551, 0xc552, 0xf66f, 0xc5b4, 0xc5b5, 0xf771, 0x9a5b, 0x95fd, + 0xc645, 0xf8cf, 0xc647, 0xf8ce, 0xf8d0, 0xc646, 0xf957, 0xf9ad, + 0x8bc4, 0xab43, 0x8c66, 0xb974, 0x90de, 0xe4be, 0xe8b0, 0xc051, + 0xc052, 0x9ce4, 0xab44, 0x90e1, 0xbe61, 0xc3fb, 0xadb1, 0xc053, + 0xc5e2, 0xadb2, 0xd84d, 0xdca9, 0x9e46, 0xdcab, 0xdcaa, 0x9651, + 0xe0dd, 0xe0da, 0xb975, 0xb976, 0xe0db, 0xe0dc, 0xe4c0, 0xe4c5, + 0xbbde, 0xe4bf, 0xe4c1, 0xe4c8, 0xe4c3, 0xe4c7, 0xe4c4, 0xe4c2, + 0xe4c6, 0xbbdf, 0xfb58, 0xe8b3, 0x90e6, 0xe8b1, 0xbe63, 0xbe62, + 0xe8b2, 0xbe64, 0xec56, 0xec55, 0xc054, 0xec54, 0xeefc, 0x9650, + 0xeefe, 0xef41, 0xef40, 0x90e7, 0xc1f9, 0xeefd, 0xf1a1, 0xc2fd, + 0xf17d, 0xf1a2, 0xc2fe, 0xf17b, 0xf17e, 0xf17c, 0xf179, 0xc340, + 0xf17a, 0x90e8, 0x9a5d, 0xf3a1, 0x9f7a, 0xf3a3, 0xf3a2, 0x9b5c, + 0xf54a, 0x9f7c, 0xf54b, 0xfc52, 0x90e9, 0xf670, 0x90ea, 0xc5b7, + 0x9a5e, 0xc5b6, 0xf84f, 0xf850, 0xc648, 0xf8d1, 0x9f76, 0xc669, + 0xadb3, 0xb6b4, 0xe4ca, 0xe4c9, 0xe8b5, 0xe8b4, 0x90eb, 0xc1fa, + 0xef43, 0xef42, 0xf1a5, 0xf1a3, 0xf1a6, 0xf1a4, 0xc3fc, 0xf3a4, + 0xf3a5, 0xf3a6, 0x90ec, 0xf671, 0xf772, 0xf8d2, 0x8bee, 0xadb4, + 0x90ee, 0xec57, 0xef44, 0x91c6, 0xadb5, 0x90f2, 0xbbe0, 0xec58, + 0xc341, 0xf1a7, 0xc3fd, 0xf54c, 0xf54d, 0xc554, 0xf851, 0xadb6, + 0xb3bb, 0xb3bc, 0xd84e, 0xb6b5, 0xb6b6, 0xdcac, 0xb6b7, 0xb97a, + 0xb97c, 0xe0df, 0xe0e0, 0xe0de, 0xb977, 0xb978, 0xb97b, 0xb979, + 0xfcbc, 0x8a74, 0xe4cb, 0xbbe1, 0xbbe2, 0xe8bc, 0xbe67, 0xe8b7, + 0xe8b6, 0x9657, 0xe8bb, 0xbe65, 0x9cef, 0xc05b, 0xe8b8, 0xe8bd, + 0xe8ba, 0xe8b9, 0xbe66, 0xc059, 0x9fdf, 0xec5a, 0xc055, 0xec5b, + 0x90f7, 0x90f6, 0xec59, 0xc058, 0xc056, 0xc05a, 0xc057, 0xef45, + 0xef4a, 0xef46, 0xef49, 0xc1fb, 0x9b5e, 0xedd4, 0xef48, 0xef47, + 0x90f8, 0xc344, 0xc342, 0xc345, 0xc343, 0xf1a8, 0xf1a9, 0xf1aa, + 0xc346, 0xf3aa, 0xc440, 0xf3a8, 0xc441, 0xf3a7, 0xf3a9, 0xc3fe, + 0xf551, 0xf54e, 0xf54f, 0xf550, 0xf672, 0xc556, 0x90f9, 0xc555, + 0x8cc9, 0xf774, 0xf773, 0xc5b8, 0xfa6a, 0xc5e3, 0xc649, 0xc660, + 0xf958, 0xf9ae, 0xf9af, 0x8bef, 0xadb7, 0xdcad, 0xe0e1, 0xe4cc, + 0xe4cd, 0xbbe3, 0xbbe4, 0xe8be, 0xbe68, 0x9fe0, 0xc1fc, 0x9142, + 0xf1ab, 0x9a62, 0xc347, 0xf3ad, 0xc442, 0xf3ac, 0xf3ae, 0xf3ab, + 0xf675, 0xf552, 0xf553, 0x9569, 0xc4c6, 0xf674, 0x9144, 0x9143, + 0xf673, 0x9141, 0xf775, 0xf9b0, 0x8bf0, 0xadb8, 0x9660, 0x8bf1, + 0xadb9, 0x99f6, 0x9149, 0xb0a7, 0xd448, 0xd84f, 0x914a, 0xb6b8, + 0xb6bb, 0xb6b9, 0xdcae, 0x914b, 0xb6bd, 0xb6ba, 0x9a64, 0xb6bc, + 0xb97e, 0x8abf, 0xe0e2, 0xe0e3, 0xe8c0, 0xb97d, 0xb9a1, 0xb9a2, + 0xe4cf, 0xe4ce, 0xbbe5, 0xbbe6, 0xe4d0, 0xe8bf, 0xbbe8, 0xbe69, + 0xbbe7, 0x9a66, 0xc05c, 0xe8c1, 0xbe6b, 0xbe6a, 0xe8c2, 0xe8c5, + 0xe8c3, 0xe8c4, 0xbe6c, 0x9a67, 0xc061, 0xc05f, 0x9a69, 0xc05e, + 0xec5d, 0xc060, 0xec5c, 0xef4b, 0xec5e, 0xc05d, 0xec5f, 0xef4e, + 0xef4c, 0xef4d, 0xef52, 0xc34b, 0xef51, 0xef54, 0xef53, 0xef50, + 0xef4f, 0xc1fd, 0x9a6a, 0x9652, 0x914d, 0xf1ae, 0x9666, 0xf1ad, + 0xc34a, 0xc348, 0xc349, 0x9f7b, 0xf1ac, 0x9a6b, 0xf3b1, 0xc443, + 0xf3b0, 0xf3af, 0xc444, 0xa06c, 0xf558, 0xf557, 0x9667, 0xf555, + 0xf554, 0xc4c8, 0xc4c7, 0xf559, 0xf776, 0xc5b9, 0xf677, 0xc557, + 0xf676, 0xf556, 0xf777, 0xc5e4, 0x9a6c, 0xc661, 0xf959, 0xf9b1, + 0x9a6d, 0x8bf2, 0xadba, 0xd850, 0xef55, 0xadbb, 0x966a, 0xe4d2, + 0xe4d1, 0xec60, 0xef57, 0xef56, 0xfcea, 0xc34c, 0xf3b2, 0xf3b3, + 0xc4c9, 0x966c, 0xf9b2, 0xb0a8, 0xb6bf, 0xb6be, 0xe0e4, 0xe0e6, + 0xb9a4, 0xe0e5, 0xb9a3, 0xb9a5, 0xe0e7, 0x91c4, 0xe4d4, 0xe4d6, + 0xe4d5, 0x9677, 0xe4d8, 0xbbe9, 0xe4d7, 0xe4d3, 0x99f4, 0x9a6f, + 0xe4d9, 0xe8cc, 0xe8cf, 0xe8d1, 0xe8c7, 0xe8cb, 0xe8c8, 0xbe6e, + 0xbe71, 0xbe73, 0xe8c9, 0xe8ca, 0xbe72, 0xe8cd, 0xe8d0, 0xe8ce, + 0xbe74, 0x9fab, 0xbe70, 0xe8c6, 0xbe6d, 0xbe6f, 0x8cbe, 0x8ec1, + 0xc063, 0xec66, 0xec64, 0xec63, 0x9555, 0xec69, 0xec68, 0xec67, + 0xec62, 0xc062, 0xec61, 0xec65, 0xc064, 0xef5a, 0x9152, 0xef5e, + 0xef5b, 0xef5d, 0xef5c, 0xef59, 0xef5f, 0xef62, 0xef60, 0xef61, + 0xc240, 0xc1fe, 0xef58, 0xef63, 0xf1b3, 0xf1b6, 0xf1b8, 0xf1b7, + 0xf1b1, 0xf1b5, 0xf1b0, 0x9153, 0xf1b2, 0xc34d, 0xf1af, 0x9155, + 0xf1b4, 0xf3c0, 0xf3b5, 0xc445, 0xc446, 0xf3b4, 0xf3b9, 0xf3bf, + 0xf3b7, 0xf3be, 0x955d, 0xf3bb, 0x9671, 0xf3ba, 0xf3bd, 0xf3b8, + 0xf3b6, 0x9c6d, 0xf3bc, 0xf560, 0xf55e, 0xc4ca, 0xf55d, 0xf563, + 0xf561, 0x9673, 0xc4cb, 0xf55c, 0xf55a, 0xf55b, 0xc4cd, 0xf55f, + 0xc4cc, 0xf562, 0xf678, 0xf67e, 0x9154, 0x9a71, 0xf679, 0xc55b, + 0xf6a1, 0xc55a, 0xf67d, 0xf67c, 0xc559, 0xf67b, 0xc558, 0xf67a, + 0xf77d, 0xf7a1, 0xf77e, 0xf77b, 0xc5bb, 0xf778, 0xf77c, 0xf7a3, + 0xf7a2, 0xf779, 0xf77a, 0xc5ba, 0xf852, 0xc5e7, 0x9156, 0xf853, + 0xc5e5, 0xc5e6, 0x966d, 0xf8d3, 0xc64a, 0xf976, 0xc66a, 0x9557, + 0xf9b3, 0xc66b, 0xf9b4, 0xf9b5, 0xf9c3, 0xf9c2, 0xc67a, 0xf9cd, + 0x89c6, 0x89c7, 0xb0a9, 0xe0e9, 0xe0e8, 0xbbea, 0xbbeb, 0xe4da, + 0x8a6a, 0xe8d2, 0xec6c, 0x8b57, 0xbe75, 0xc065, 0xec6a, 0x9fe1, + 0xec6d, 0xc066, 0x9b5f, 0xef64, 0xec6b, 0xf1b9, 0xc34e, 0xf3c1, + 0xf566, 0xf564, 0xf565, 0xf6a2, 0xc55c, 0xf7a4, 0xc5ea, 0xc5bc, + 0xc5e8, 0xc5e9, 0xf8d4, 0xc662, 0xa05d, 0xb0aa, 0xf1ba, 0xd449, + 0x915b, 0xb9a6, 0x915c, 0xe4db, 0xbbec, 0xe4dc, 0xe8d4, 0xe8d3, + 0xc068, 0xbe76, 0xbe77, 0xe8d7, 0xe8d6, 0xe8d5, 0x915e, 0xec6e, + 0xec71, 0xec70, 0xec6f, 0xc067, 0xef68, 0xef66, 0xef65, 0x9f5c, + 0xef67, 0x9f57, 0xc34f, 0xf1bc, 0xf1bd, 0xc350, 0xf1bb, 0x9f65, + 0xf3c3, 0xf3c2, 0xf3c5, 0xc447, 0xf3c4, 0x9a72, 0xf567, 0xf569, + 0xf568, 0x9160, 0xf6a3, 0xf6a6, 0xf6a4, 0xf6a5, 0xf7a5, 0xc5bd, + 0xf854, 0xf855, 0xf856, 0xc64b, 0xc663, 0xf9b6, 0xb0ab, 0xbe78, + 0xc069, 0xf1be, 0x9f5e, 0xf7a6, 0x9161, 0xf9c4, 0xd44a, 0xc67b, + 0xb0ac, 0xec72, 0x9164, 0xf1bf, 0xf3c6, 0x9f41, 0xf6a7, 0xf7a7, + 0xb0ad, 0xe4dd, 0xe4de, 0x9169, 0xbbed, 0xbbee, 0xe8d9, 0xbe7a, + 0xbe79, 0xe8d8, 0xef69, 0xf1c0, 0xf1c2, 0xf1c1, 0xc353, 0xc352, + 0xc351, 0x9168, 0xc55e, 0xf6a8, 0xc55d, 0xf7a9, 0xf7a8, 0xc64c, + 0xf8d5, 0xb3bd, 0xe0ea, 0xe4e1, 0xe4df, 0xe4e0, 0xe8e2, 0xe8dd, + 0xe8da, 0xe8e1, 0x9a74, 0xe8e3, 0xbe7c, 0xe8e0, 0xe8dc, 0xe8db, + 0xe8df, 0xe8de, 0xbe7b, 0xec7d, 0xec78, 0xec76, 0xeca1, 0xec77, + 0x96b2, 0xec73, 0x9a75, 0xec79, 0xfda5, 0xec74, 0xef72, 0xec75, + 0xeca2, 0x9ee9, 0x8bba, 0x916d, 0xa060, 0xec7c, 0xc06a, 0xec7b, + 0xec7a, 0xec7e, 0x9fde, 0xef6a, 0xef6d, 0x9fc3, 0xef6c, 0x96b5, + 0xef74, 0xef6f, 0xef73, 0xef71, 0xef70, 0xef6e, 0xef6b, 0xc243, + 0xc242, 0xc244, 0xc241, 0xef75, 0xa067, 0xf1c8, 0xf1cb, 0xf1c9, + 0xf1cd, 0xf1ce, 0xf1c6, 0xc358, 0xf1c7, 0xf1c5, 0xf1cc, 0xf1c4, + 0xf1c3, 0xc357, 0xc355, 0xc354, 0x96b3, 0xf1ca, 0xf3cf, 0xf3d5, + 0xc44a, 0xf3d0, 0xf3d3, 0xf3d7, 0xc44b, 0xf3d2, 0x9a76, 0xf3ca, + 0xf3c9, 0xf3d6, 0xf3cd, 0xf3cb, 0xf3d4, 0xf3cc, 0xc449, 0xc448, + 0x95d5, 0xf3c7, 0xf3c8, 0xf3d1, 0x9eca, 0xf3ce, 0x9a77, 0x9a78, + 0xf56c, 0xf56f, 0xc356, 0x9170, 0x916f, 0xf56d, 0xf573, 0xf571, + 0xf56b, 0xf576, 0x9fa3, 0xf56a, 0x9171, 0xc4cf, 0xf572, 0x96b1, + 0xf56e, 0xc4ce, 0xf575, 0x9f63, 0xf574, 0x9f67, 0xf6ab, 0xf6aa, + 0x8bb9, 0x9a7a, 0xf6b1, 0xf6ad, 0xf6b0, 0xc560, 0x8b56, 0xf6ae, + 0xf6af, 0xf6a9, 0xf6ac, 0xc55f, 0x9ada, 0xc5bf, 0xf7b4, 0xf7af, + 0xf7b3, 0x96b0, 0xf7b6, 0xf7b2, 0xf7ae, 0x9a7e, 0xc5c1, 0xf7b1, + 0xf7b5, 0xc5c0, 0xf7ac, 0xf570, 0xf7b0, 0xf7ad, 0x9dde, 0xf7aa, + 0xf7ab, 0xc5be, 0xf85a, 0xf85c, 0xf85f, 0xf85b, 0xf860, 0x96ad, + 0xf859, 0xf857, 0x96ae, 0xc5eb, 0xf85d, 0xc5ed, 0xc5ec, 0xf858, + 0xf85e, 0x9ea1, 0xf8da, 0xc64d, 0xf8db, 0xf8d9, 0xf8d6, 0xf8d8, + 0xf8d7, 0xf95a, 0xf95c, 0xf95b, 0xf979, 0x9e50, 0xf978, 0xf977, + 0xf97a, 0xc673, 0xc674, 0xf9ca, 0xf9ce, 0x96af, 0x8bf4, 0xb3be, + 0xdcaf, 0xe0ed, 0xb9a7, 0xe0eb, 0xe0ec, 0xe4e2, 0xe4e3, 0xbbf1, + 0xbbef, 0xe4e4, 0xbbf0, 0xe8e8, 0xe8eb, 0xe8e5, 0xe8ec, 0xe8e4, + 0xe8e6, 0xe8e7, 0xe8ea, 0x9fa4, 0xbea1, 0xe8ef, 0xe8ee, 0xbe7d, + 0xe8e9, 0xe8ed, 0xbe7e, 0x96bd, 0xecac, 0xc06f, 0xeca7, 0xc06b, + 0x96f4, 0xeca4, 0xecaa, 0xecad, 0xc070, 0xeca9, 0xeca6, 0xecae, + 0xeca5, 0x96b8, 0xecab, 0xc06c, 0xeca3, 0xc06d, 0xc06e, 0xeca8, + 0xefa9, 0xef7a, 0xef7b, 0xef7e, 0xef7c, 0xef76, 0xfaa1, 0xef79, + 0xefa5, 0xef7d, 0x91a7, 0xc245, 0xefa7, 0xefa4, 0xc246, 0xefa6, + 0xef77, 0xefa2, 0xefa3, 0xa05e, 0xefa1, 0x9a7d, 0xf1d2, 0xf1d4, + 0xf1d7, 0x8948, 0xf1d1, 0x9eb1, 0xc359, 0xf1d9, 0xf1d0, 0xf1da, + 0xf1d6, 0xf1d8, 0xf1dc, 0xf1d5, 0xf1dd, 0xf1d3, 0xf1cf, 0xc35a, + 0x9ddb, 0xf1db, 0xc35b, 0xc44d, 0xef78, 0xf3f1, 0xf3e8, 0xc44f, + 0xf3e4, 0xc450, 0x95bf, 0x8a73, 0xf3ed, 0xf3e7, 0xf3dd, 0xc44e, + 0xf3ea, 0xf3e5, 0xf3e6, 0xf3d8, 0xf3df, 0xf3ee, 0xf3eb, 0x9efe, + 0xf3e3, 0x917a, 0xf3ef, 0xf3de, 0xf3d9, 0xf3ec, 0x917b, 0xf3db, + 0xf3e9, 0xf3e0, 0xf3f0, 0xf3dc, 0xc44c, 0xf3da, 0xf3e1, 0xf3e2, + 0xf57d, 0xf57b, 0x9aa3, 0xf5a2, 0xf5ae, 0xf5a5, 0xf57c, 0xf578, + 0xf5a7, 0xf57e, 0xf5a3, 0xf57a, 0xf5aa, 0xf577, 0xf5a1, 0xf5a6, + 0xf5a8, 0xf5ab, 0xf579, 0x96c2, 0xf5af, 0xf5b0, 0xf5a9, 0xf5ad, + 0xf5a4, 0x9f77, 0xf6c1, 0xf6c4, 0xc561, 0xf6c3, 0xf6c8, 0xf6c6, + 0xc562, 0xf6bd, 0xf6b3, 0xf6b2, 0xc564, 0xf6bf, 0xf6c0, 0xf6bc, + 0xf6b4, 0x9aa4, 0xf6b9, 0xf5ac, 0x9aa5, 0xf6b5, 0xc563, 0xf6bb, + 0x91a1, 0xf6ba, 0xf6b6, 0xf6c2, 0x89b8, 0xf6b7, 0xf7bb, 0xf6c5, + 0xf6c7, 0xf6be, 0xf6b8, 0xf7bc, 0xf7be, 0xf7b8, 0xc5c2, 0x9173, + 0xf7c5, 0xf7c3, 0xc5c3, 0xf7c2, 0xf7c1, 0xf7ba, 0xf7b7, 0xf7bd, + 0xf7c6, 0xf7b9, 0xf7bf, 0xf869, 0xf86e, 0xf864, 0xf867, 0xc5ee, + 0xf86b, 0xf872, 0xf7c0, 0xf865, 0xf86f, 0xf873, 0xf86a, 0xf863, + 0xf86d, 0xf86c, 0xf871, 0xf870, 0xf7c4, 0xf868, 0xf862, 0xf866, + 0xc64e, 0xc64f, 0xf861, 0x9aa6, 0xf8e6, 0xf8dd, 0xf8e5, 0xf8e2, + 0xf8e3, 0xf8dc, 0xf8df, 0xf8e7, 0xf8e1, 0xf8e0, 0xf8de, 0xf8e4, + 0x89bd, 0xf95d, 0x89b9, 0xf95e, 0x917d, 0xf960, 0xf95f, 0xf962, + 0xf961, 0xf97c, 0xf97b, 0xf9b7, 0xf9b8, 0x96bb, 0xf9c5, 0xc678, + 0xc67c, 0x9ff2, 0xf9cf, 0xc67d, 0x8bf5, 0xb3bf, 0xc4d0, 0xf6c9, + 0x9aa9, 0xc650, 0xc651, 0xb3c0, 0xe0ee, 0x9f54, 0xb9a8, 0xe8f0, + 0x9fe3, 0x9eed, 0xecb0, 0xecb1, 0xecaf, 0xefab, 0xefaa, 0xc247, + 0xf1df, 0xefac, 0xf1de, 0x91aa, 0xf3f3, 0xc451, 0xc453, 0xf3f2, + 0x91ab, 0xa070, 0xc452, 0x9f6d, 0xf5b1, 0xf5b3, 0xf5b2, 0xf6ca, + 0xc565, 0x91ac, 0xc5ef, 0xf8e8, 0xf963, 0x91ad, 0xf9d2, 0xb3c1, + 0xa0fd, 0xe4e5, 0x9fe2, 0xbea2, 0x91af, 0x9e41, 0x9aaa, 0xecb3, + 0xecb2, 0x91b0, 0xefad, 0x9aab, 0xc454, 0xc4d1, 0xf7c7, 0xf9cb, + 0xb3c2, 0xbbf2, 0x9aac, 0xbea3, 0x9a4a, 0xf3f4, 0x91b2, 0xf874, + 0xb6c0, 0x8bf6, 0x9aad, 0x89b6, 0xefae, 0xc664, 0xb6c1, 0xbea4, + 0xc248, 0xf875, 0xb6c2, 0xe8f1, 0xc072, 0xecb4, 0xecb5, 0xc071, + 0xefaf, 0xc24c, 0xc24a, 0xc24b, 0xc249, 0xf1e0, 0xc35c, 0x9aaf, + 0xf5b5, 0xf5b4, 0xf5b7, 0xf5b6, 0xc4d2, 0xf6cb, 0xf6cd, 0xf6cc, + 0xc566, 0xf7c8, 0x9ab0, 0xf876, 0xf877, 0xc5f0, 0xf964, 0xf97d, + 0xc675, 0x9ab1, 0xdcb0, 0xecb6, 0xefb0, 0xf3f5, 0xe0ef, 0x9aa1, + 0xefb1, 0xf1e2, 0xf1e1, 0x91b9, 0xf878, 0xc652, 0x91ba, 0xf965, + 0xf97e, 0xb9a9, 0xe8f2, 0xe8f3, 0xecb7, 0xb9aa, 0xc35d, 0xf1e3, + 0x91be, 0xf6cf, 0xc567, 0xf6d0, 0xf6ce, 0xf879, 0xf8e9, 0xb9ab, + 0xefb4, 0xefb3, 0xefb2, 0xf1e4, 0xa041, 0x8bb7, 0xf1e8, 0xf1e7, + 0xf1e6, 0xf1e5, 0xc35e, 0xf3f6, 0xf5b9, 0xc4d3, 0xf5b8, 0xf6d1, + 0xf7cb, 0xf7ca, 0xc5c4, 0xf7c9, 0xf87c, 0xf87b, 0xf87a, 0x91c0, + 0xbbf3, 0xecb8, 0xc24d, 0xf3f7, 0xf3f8, 0xf7cc, 0xf87d, 0x9ab3, + 0x91c3, 0xf8ea, 0xf966, 0xf9b9, 0xf9d4, 0xbbf4, 0xc24e, 0xf1e9, + 0xf3f9, 0xf6d2, 0xf87e, 0xa0fc, 0xbea6, 0x9fee, 0xefb5, 0xf1ea, + 0xf3fa, 0xf3fb, 0xf3fc, 0xf5be, 0x9f69, 0xf5ba, 0xc568, 0xf5bd, + 0xf5bc, 0xc4d4, 0xf5bb, 0xc4d6, 0x91c8, 0xc4d5, 0xf6d4, 0xf6d3, + 0xc569, 0xc56a, 0x91c9, 0xc5c6, 0xf7cd, 0xc5c5, 0xf8a3, 0xf8a4, + 0xf8a2, 0xf8a1, 0xc654, 0xf8eb, 0xf8ec, 0xf8ed, 0xc653, 0xf967, + 0xf96a, 0xf969, 0xf968, 0xf9d3, 0x8de6, 0xc073, 0x91cb, 0xc365, + 0xf5bf, 0xf6d5, 0xc5c7, 0xf7ce, 0xf9d5, 0x89c8, 0xc074, 0x8daa, + 0xefb6, 0xf7cf, 0xf9a1, 0x9fdd, 0xfa40, 0xfa41, 0xfa42, 0xfa43, + 0xfa44, 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0xfa4a, 0xfa4b, + 0xfa4c, 0xfa4d, 0xfa4e, 0xfa4f, 0xfa50, 0xfa51, 0xfa52, 0xfa53, + 0xfa54, 0xfa55, 0xfa56, 0xfa57, 0xfa58, 0xfa59, 0xfa5a, 0xfa5b, + 0xfa5c, 0xfa5d, 0xfa5e, 0xadc5, 0xfa60, 0xfa61, 0xfa62, 0xfa63, + 0xfa64, 0xfa65, 0xb0b0, 0xfa67, 0xfa68, 0xfa69, 0xfa6a, 0xfa6b, + 0xfa6c, 0xfa6d, 0xfa6e, 0xfa6f, 0xfa70, 0xfa71, 0xfa72, 0xfa73, + 0xfa74, 0xfa75, 0xfa76, 0xfa77, 0xfa78, 0xfa79, 0xfa7a, 0xfa7b, + 0xfa7c, 0xfa7d, 0xfa7e, 0xfaa1, 0xfaa2, 0xfaa3, 0xfaa4, 0xfaa5, + 0xfaa6, 0xfaa7, 0xfaa8, 0xfaa9, 0xfaaa, 0xfaab, 0xfaac, 0xfaad, + 0xfaae, 0xfaaf, 0xfab0, 0xfab1, 0xfab2, 0xfab3, 0xfab4, 0xfab5, + 0xfab6, 0xfab7, 0xfab8, 0xfab9, 0xfaba, 0xfabb, 0xfabc, 0xa55d, + 0xfabe, 0xfabf, 0xfac0, 0xfac1, 0xfac2, 0xfac3, 0xfac4, 0xa2cd, + 0xfac6, 0xfac7, 0xfac8, 0xfac9, 0xfaca, 0xfacb, 0xfacc, 0xfacd, + 0xface, 0xfacf, 0xfad0, 0xfad1, 0xfad2, 0xfad3, 0xfad4, 0xadeb, + 0xfad6, 0xfad7, 0xfad8, 0xfad9, 0xfada, 0xfadb, 0xfadc, 0xfadd, + 0xfade, 0xfadf, 0xfae0, 0xfae1, 0xfae2, 0xfae3, 0xfae4, 0xfae5, + 0xfae6, 0xfae7, 0xfae8, 0xfae9, 0xfaea, 0xfaeb, 0xfaec, 0xfaed, + 0xfaee, 0xfaef, 0xfaf0, 0xfaf1, 0xfaf2, 0xfaf3, 0xfaf4, 0xfaf5, + 0xfaf6, 0xfaf7, 0xfaf8, 0xfaf9, 0xfafa, 0xfafb, 0xfafc, 0xfafd, + 0xfafe, 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, 0xfb45, 0xfb46, + 0xfb47, 0x9def, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, 0xfb4d, 0xfb4e, + 0xfb4f, 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, 0xfb55, 0xfb56, + 0xfb57, 0xfb58, 0xfb59, 0xfb5a, 0xfb5b, 0xfb5c, 0xfb5d, 0xfb5e, + 0xfb5f, 0xfb60, 0xfb61, 0xfb62, 0xfb63, 0xfb64, 0xfb65, 0xfb66, + 0xfb67, 0xfb68, 0xfb69, 0xfb6a, 0xfb6b, 0xfb6c, 0xfb6d, 0xfb6e, + 0xfb6f, 0xfb70, 0xfb71, 0xfb72, 0xfb73, 0xfb74, 0xfb75, 0xfb76, + 0xfb77, 0xfb78, 0xfb79, 0xfb7a, 0xfb7b, 0xfb7c, 0xfb7d, 0xfb7e, + 0xfba1, 0xfba2, 0xfba3, 0xfba4, 0xfba5, 0xfba6, 0xfba7, 0xfba8, + 0xfba9, 0xfbaa, 0xfbab, 0xfbac, 0xfbad, 0xfbae, 0xfbaf, 0xfbb0, + 0xfbb1, 0xfbb2, 0xfbb3, 0xfbb4, 0xfbb5, 0xfbb6, 0xfbb7, 0xb440, + 0xfbb9, 0xfbba, 0xfbbb, 0xfbbc, 0xfbbd, 0xfbbe, 0xfbbf, 0xfbc0, + 0xfbc1, 0xfbc2, 0xfbc3, 0xfbc4, 0xfbc5, 0xfbc6, 0xfbc7, 0xfbc8, + 0xfbc9, 0xfbca, 0xfbcb, 0xfbcc, 0xfbcd, 0xfbce, 0xfbcf, 0xfbd0, + 0xfbd1, 0xfbd2, 0xfbd3, 0xfbd4, 0xfbd5, 0xfbd6, 0xfbd7, 0xfbd8, + 0xfbd9, 0xfbda, 0xfbdb, 0xfbdc, 0xfbdd, 0xfbde, 0xfbdf, 0xfbe0, + 0xfbe1, 0xfbe2, 0xfbe3, 0xfbe4, 0xfbe5, 0xfbe6, 0xfbe7, 0xfbe8, + 0xfbe9, 0xfbea, 0xfbeb, 0xfbec, 0xfbed, 0xfbee, 0xfbef, 0xfbf0, + 0xfbf1, 0xfbf2, 0xc9db, 0xfbf4, 0xfbf5, 0xfbf6, 0xfbf7, 0xfbf8, + 0x9dfb, 0xfbfa, 0xfbfb, 0xfbfc, 0xfbfd, 0xfbfe, 0xfc40, 0xfc41, + 0xfc42, 0xfc43, 0xfc44, 0xfc45, 0xfc46, 0xfc47, 0xfc48, 0xfc49, + 0xfc4a, 0xfc4b, 0xfc4c, 0xfc4d, 0xfc4e, 0xd8f4, 0xfc50, 0xfc51, + 0xfc52, 0xfc53, 0xfc54, 0xfc55, 0xfc56, 0xfc57, 0xfc58, 0xfc59, + 0xfc5a, 0xfc5b, 0xfc5c, 0xfc5d, 0xfc5e, 0xfc5f, 0xfc60, 0xfc61, + 0xfc62, 0xfc63, 0xfc64, 0xfc65, 0xfc66, 0xfc67, 0xfc68, 0xfc69, + 0xfc6a, 0xfc6b, 0xa0dc, 0xfc6d, 0xfc6e, 0xfc6f, 0xfc70, 0xfc71, + 0xfc72, 0xfc73, 0xfc74, 0xfc75, 0xfc76, 0xfc77, 0xfc78, 0xfc79, + 0xfc7a, 0xfc7b, 0xfc7c, 0xfc7d, 0xfc7e, 0xfca1, 0xfca2, 0xfca3, + 0xfca4, 0xfca5, 0xfca6, 0xfca7, 0xfca8, 0xfca9, 0xfcaa, 0xfcab, + 0xfcac, 0xfcad, 0xfcae, 0xfcaf, 0xfcb0, 0xfcb1, 0xfcb2, 0xfcb3, + 0xfcb4, 0xfcb5, 0xfcb6, 0xfcb7, 0xfcb8, 0xbcb5, 0xfcba, 0xfcbb, + 0xfcbc, 0xfcbd, 0xfcbe, 0xfcbf, 0xfcc0, 0xfcc1, 0xfcc2, 0xfcc3, + 0xfcc4, 0xfcc5, 0xfcc6, 0xfcc7, 0xfcc8, 0xfcc9, 0xfcca, 0xfccb, + 0xfccc, 0xfccd, 0xfcce, 0xfccf, 0xfcd0, 0xfcd1, 0xfcd2, 0xfcd3, + 0xfcd4, 0xfcd5, 0xfcd6, 0xfcd7, 0xfcd8, 0xfcd9, 0xfcda, 0xfcdb, + 0xfcdc, 0xfcdd, 0xfcde, 0xfcdf, 0xfce0, 0xfce1, 0xb4b8, 0xfce3, + 0xfce4, 0xfce5, 0xfce6, 0xfce7, 0xfce8, 0xfce9, 0xfcea, 0xfceb, + 0xfcec, 0xfced, 0xfcee, 0xfcef, 0xfcf0, 0xa7fb, 0xfcf2, 0xfcf3, + 0xfcf4, 0xfcf5, 0xfcf6, 0xfcf7, 0xfcf8, 0xfcf9, 0xfcfa, 0xfcfb, + 0xfcfc, 0xfcfd, 0xfcfe, 0xfd40, 0xfd41, 0xfd42, 0xfd43, 0xfd44, + 0xfd45, 0xfd46, 0xfd47, 0xfd48, 0xfd49, 0xfd4a, 0xfd4b, 0xfd4c, + 0xfd4d, 0xfd4e, 0xfd4f, 0xfd50, 0xfd51, 0xfd52, 0xfd53, 0xfd54, + 0xfd55, 0xfd56, 0xfd57, 0xfd58, 0xfd59, 0xfd5a, 0xfd5b, 0xfd5c, + 0xfd5d, 0xfd5e, 0xfd5f, 0xfd60, 0xfd61, 0xfd62, 0xfd63, 0xfd64, + 0xfd65, 0xfd66, 0xfd67, 0xfd68, 0xfd69, 0xfd6a, 0xfd6b, 0xfd6c, + 0xfd6d, 0xfd6e, 0xfd6f, 0xfd70, 0xfd71, 0xfd72, 0xfd73, 0xfd74, + 0xfd75, 0xfd76, 0xfd77, 0xfd78, 0xfd79, 0xfd7a, 0xfd7b, 0xfd7c, + 0xfd7d, 0xfd7e, 0xfda1, 0xfda2, 0xfda3, 0xfda4, 0xfda5, 0xfda6, + 0xfda7, 0xfda8, 0xfda9, 0xfdaa, 0xfdab, 0xfdac, 0xfdad, 0xfdae, + 0xfdaf, 0xfdb0, 0xfdb1, 0xfdb2, 0xfdb3, 0xfdb4, 0xfdb5, 0xfdb6, + 0xcb58, 0xb4fc, 0xfdb9, 0xfdba, 0xb4e4, 0xfdbc, 0xfdbd, 0xfdbe, + 0xfdbf, 0xfdc0, 0xfdc1, 0xfdc2, 0xfdc3, 0xfdc4, 0xfdc5, 0xfdc6, + 0xfdc7, 0xfdc8, 0xfdc9, 0xfdca, 0xfdcb, 0xfdcc, 0xfdcd, 0xfdce, + 0xfdcf, 0xfdd0, 0xfdd1, 0xfdd2, 0xfdd3, 0xfdd4, 0xfdd5, 0xfdd6, + 0xfdd7, 0xfdd8, 0xfdd9, 0xfdda, 0xfddb, 0xfddc, 0xfddd, 0xfdde, + 0xfddf, 0xfde0, 0xfde1, 0xfde2, 0xfde3, 0xfde4, 0xfde5, 0xfde6, + 0xfde7, 0xfde8, 0xfde9, 0xfdea, 0xfdeb, 0xfdec, 0xfded, 0xfdee, + 0xfdef, 0xfdf0, 0xb54e, 0xfdf2, 0xfdf3, 0xfdf4, 0xfdf5, 0xfdf6, + 0xfdf7, 0xfdf8, 0xfdf9, 0xfdfa, 0xfdfb, 0xfdfc, 0xfdfd, 0xfdfe, + 0xfe40, 0xfe41, 0xfe42, 0xfe43, 0xfe44, 0xfe45, 0xfe46, 0xfe47, + 0xfe48, 0xfe49, 0xfe4a, 0xfe4b, 0xfe4c, 0xfe4d, 0xfe4e, 0xfe4f, + 0xfe50, 0xfe51, 0x9975, 0xfe53, 0xfe54, 0xfe55, 0xfe56, 0xfe57, + 0xfe58, 0xfe59, 0xfe5a, 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xfe5f, + 0xfe60, 0xfe61, 0xfe62, 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xfe67, + 0xfe68, 0xfe69, 0xfe6a, 0xfe6b, 0xfe6c, 0xfe6d, 0xfe6e, 0xb7ec, + 0xfe70, 0xfe71, 0xfe72, 0xfe73, 0xfe74, 0xfe75, 0xfe76, 0xfe77, + 0xfe78, 0xfe79, 0xfe7a, 0xfe7b, 0xfe7c, 0xfe7d, 0xfe7e, 0xfea1, + 0xfea2, 0xfea3, 0xfea4, 0xfea5, 0xfea6, 0xfea7, 0xfea8, 0xfea9, + 0xa260, 0xfeab, 0xfeac, 0xfead, 0xfeae, 0xfeaf, 0xfeb0, 0xfeb1, + 0xfeb2, 0xfeb3, 0xfeb4, 0xfeb5, 0xfeb6, 0xfeb7, 0xfeb8, 0xfeb9, + 0xfeba, 0xfebb, 0xfebc, 0xfebd, 0xfebe, 0xfebf, 0xfec0, 0xfec1, + 0xfec2, 0xfec3, 0xfec4, 0xfec5, 0xfec6, 0xfec7, 0xfec8, 0xfec9, + 0xfeca, 0xfecb, 0xfecc, 0xfecd, 0xfece, 0xfecf, 0xfed0, 0xfed1, + 0xfed2, 0xfed3, 0xfed4, 0xfed5, 0xfed6, 0xfed7, 0xfed8, 0xfed9, + 0xfeda, 0xfedb, 0xfedc, 0xcff1, 0xfede, 0xfedf, 0xfee0, 0xfee1, + 0xfee2, 0xfee3, 0xfee4, 0xfee5, 0xfee6, 0xfee7, 0xfee8, 0xfee9, + 0xfeea, 0xfeeb, 0xfeec, 0xfeed, 0xfeee, 0xfeef, 0xfef0, 0xfef1, + 0xfef2, 0xfef3, 0xfef4, 0xfef5, 0xfef6, 0xfef7, 0xfef8, 0xfef9, + 0xfefa, 0xfefb, 0xfefc, 0xfefd, 0xfefe, 0x8e40, 0x8e41, 0x8e42, + 0x8e43, 0x8e44, 0x8e45, 0x8e46, 0x8e47, 0x8e48, 0x8e49, 0x8e4a, + 0x8e4b, 0x8e4c, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e50, 0x8e51, 0x8e52, + 0x8e53, 0x8e54, 0x8e55, 0x8e56, 0x8e57, 0x8e58, 0x8e59, 0x8e5a, + 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, + 0x8e63, 0x8e64, 0x8e65, 0x8e66, 0x8e67, 0x8e68, 0xbae6, 0x8e6a, + 0x8e6b, 0x8e6c, 0x8e6d, 0x8e6e, 0xedca, 0x8e70, 0x8e71, 0x8e72, + 0x8e73, 0x8e74, 0x8e75, 0x8e76, 0x8e77, 0x8e78, 0x8e79, 0x8e7a, + 0x8e7b, 0x8e7c, 0x8e7d, 0xa261, 0x8ea1, 0x8ea2, 0x8ea3, 0x8ea4, + 0x8ea5, 0x8ea6, 0x8ea7, 0x8ea8, 0x8ea9, 0x8eaa, 0xbafc, 0x8eac, + 0x8ead, 0x8eae, 0x8eaf, 0x8eb0, 0x8eb1, 0x8eb2, 0x8eb3, 0xbfa6, + 0x8eb5, 0x8eb6, 0x8eb7, 0x8eb8, 0x8eb9, 0x8eba, 0x8ebb, 0x8ebc, + 0x8ebd, 0x8ebe, 0x8ebf, 0x8ec0, 0x8ec1, 0x8ec2, 0x8ec3, 0x8ec4, + 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, 0x8eca, 0x8ecb, 0x8ecc, + 0xaacc, 0x8ece, 0x8ecf, 0xbfae, 0x8ed1, 0x8ed2, 0x8ed3, 0x8ed4, + 0x8ed5, 0x8ed6, 0x8ed7, 0x8ed8, 0x8ed9, 0x8eda, 0x8edb, 0x8edc, + 0x8edd, 0x8ede, 0x8edf, 0x8ee0, 0x8ee1, 0x8ee2, 0x8ee3, 0x8ee4, + 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, + 0x8eed, 0x8eee, 0x8eef, 0x8ef0, 0x8ef1, 0x8ef2, 0x8ef3, 0x8ef4, + 0x8ef5, 0x8ef6, 0x8ef7, 0x8ef8, 0x8ef9, 0x8efa, 0x8efb, 0x8efc, + 0x8efd, 0x8efe, 0x8f40, 0x8f41, 0x8f42, 0x8f43, 0x8f44, 0x8f45, + 0x8f46, 0x8f47, 0x8f48, 0x8f49, 0x8f4a, 0x8f4b, 0x8f4c, 0x8f4d, + 0x8f4e, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, + 0x8f56, 0xb5d7, 0x8f58, 0x8f59, 0x8f5a, 0x8f5b, 0x8f5c, 0x8f5d, + 0x8f5e, 0x8f5f, 0x8f60, 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0x8f65, + 0x8f66, 0x8f67, 0x8f68, 0xe3c8, 0x8f6a, 0x8f6b, 0x8f6c, 0x8f6d, + 0xdb79, 0x8f6f, 0x8f70, 0x8f71, 0x8f72, 0x8f73, 0x8f74, 0x8f75, + 0x8f76, 0x8f77, 0x8f78, 0x8f79, 0x8f7a, 0x8f7b, 0x8f7c, 0x8f7d, + 0x8f7e, 0x8fa1, 0x8fa2, 0x8fa3, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fa7, + 0x8fa8, 0x8fa9, 0x8faa, 0x8fab, 0x8fac, 0x8fad, 0x8fae, 0x8faf, + 0x8fb0, 0x8fb1, 0x8fb2, 0x8fb3, 0x8fb4, 0x8fb5, 0x8fb6, 0x8fb7, + 0x8fb8, 0x8fb9, 0x8fba, 0x8fbb, 0x8fbc, 0x8fbd, 0x8fbe, 0x8fbf, + 0x8fc0, 0x8fc1, 0x8fc2, 0x8fc3, 0x8fc4, 0x8fc5, 0x8fc6, 0x8fc7, + 0x8fc8, 0x8fc9, 0x8fca, 0xbfcc, 0xa0d4, 0x8fcd, 0x8fce, 0x8fcf, + 0x8fd0, 0x8fd1, 0x8fd2, 0x8fd3, 0x8fd4, 0x8fd5, 0x8fd6, 0x8fd7, + 0x8fd8, 0x8fd9, 0x8fda, 0x8fdb, 0x8fdc, 0x8fdd, 0x8fde, 0x8fdf, + 0x8fe0, 0x8fe1, 0x8fe2, 0x8fe3, 0x8fe4, 0x8fe5, 0x8fe6, 0x8fe7, + 0x8fe8, 0x8fe9, 0x8fea, 0x8feb, 0x8fec, 0x8fed, 0x8fee, 0x8fef, + 0x8ff0, 0x8ff1, 0x8ff2, 0x8ff3, 0x8ff4, 0x8ff5, 0x8ff6, 0x8ff7, + 0x8ff8, 0x8ff9, 0x8ffa, 0x8ffb, 0x8ffc, 0x8ffd, 0xb05f, 0x9040, + 0x9041, 0x9042, 0x9043, 0x9044, 0x9045, 0x9046, 0x9047, 0x9048, + 0x9049, 0x904a, 0x904b, 0x904c, 0x904d, 0x904e, 0x904f, 0x9050, + 0x9051, 0x9052, 0x9053, 0x9054, 0x9055, 0x9056, 0x9057, 0x9058, + 0x9059, 0x905a, 0x905b, 0x905c, 0x905d, 0x905e, 0x905f, 0x9060, + 0x9061, 0x9062, 0x9063, 0x9064, 0x9065, 0x9066, 0x9067, 0x9068, + 0x9069, 0x906a, 0x906b, 0x906c, 0xb3a3, 0x906e, 0x906f, 0x9070, + 0x9071, 0x9072, 0x9073, 0x9074, 0x9075, 0x9076, 0x9077, 0x9078, + 0x9079, 0xf9d7, 0x907b, 0x907c, 0x907d, 0x907e, 0x90a1, 0x90a2, + 0x90a3, 0x90a4, 0x90a5, 0x90a6, 0x90a7, 0x90a8, 0x90a9, 0x90aa, + 0x90ab, 0x90ac, 0x90ad, 0x90ae, 0x90af, 0x90b0, 0x90b1, 0x90b2, + 0x90b3, 0x90b4, 0x90b5, 0x90b6, 0x90b7, 0x90b8, 0x90b9, 0x90ba, + 0x90bb, 0x90bc, 0x90bd, 0x90be, 0x90bf, 0x90c0, 0x90c1, 0x90c2, + 0x90c3, 0x90c4, 0x90c5, 0x90c6, 0x90c7, 0x90c8, 0x90c9, 0x90ca, + 0x90cb, 0x90cc, 0x90cd, 0x90ce, 0x90cf, 0x90d0, 0x90d1, 0x90d2, + 0x90d3, 0x90d4, 0x90d5, 0x90d6, 0x90d7, 0x90d8, 0x90d9, 0x90da, + 0x90db, 0xc052, 0x90dd, 0x90de, 0x90df, 0x90e0, 0x90e1, 0x90e2, + 0x90e3, 0x90e4, 0x90e5, 0x90e6, 0x90e7, 0x90e8, 0x90e9, 0x90ea, + 0x90eb, 0x90ec, 0x90ed, 0x90ee, 0x90ef, 0x90f0, 0xc554, 0x90f2, + 0x90f3, 0x90f4, 0x90f5, 0x90f6, 0x90f7, 0x90f8, 0x90f9, 0x90fa, + 0x90fb, 0x90fc, 0x90fd, 0x90fe, 0x9140, 0x9141, 0x9142, 0x9143, + 0x9144, 0x9145, 0x9146, 0x9147, 0x9148, 0x9149, 0x914a, 0x914b, + 0x914c, 0x914d, 0x914e, 0x914f, 0x9150, 0x9151, 0x9152, 0x9153, + 0x9154, 0x9155, 0x9156, 0x9157, 0x9158, 0x9159, 0x915a, 0x915b, + 0x915c, 0x915d, 0x915e, 0x915f, 0x9160, 0x9161, 0x9162, 0x9163, + 0x9164, 0x9165, 0x9166, 0x9167, 0x9168, 0x9169, 0x916a, 0x916b, + 0x916c, 0x916d, 0x916e, 0x916f, 0x9170, 0x9171, 0x9172, 0x9173, + 0x9174, 0x9175, 0x9176, 0x9177, 0x9178, 0x9179, 0x917a, 0x917b, + 0x917c, 0x917d, 0x917e, 0x91a1, 0x91a2, 0x91a3, 0x91a4, 0x91a5, + 0x91a6, 0x91a7, 0x91a8, 0x91a9, 0x91aa, 0x91ab, 0x91ac, 0x91ad, + 0x91ae, 0x91af, 0x91b0, 0x91b1, 0x91b2, 0x91b3, 0x91b4, 0x91b5, + 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91ba, 0x91bb, 0x91bc, 0x91bd, + 0x91be, 0xf1e3, 0x91c0, 0x91c1, 0x91c2, 0x91c3, 0x91c4, 0x91c5, + 0x91c6, 0x91c7, 0x91c8, 0x91c9, 0x91ca, 0x91cb, 0x91cc, 0x91cd, + 0x91ce, 0x91cf, 0x91d0, 0x91d1, 0x91d2, 0x91d3, 0x91d4, 0x91d5, + 0x91d6, 0x91d7, 0x91d8, 0x91d9, 0x91da, 0x91db, 0x91dc, 0x91dd, + 0x91de, 0x91df, 0x91e0, 0x91e1, 0x91e2, 0x91e3, 0x91e4, 0x91e5, + 0x91e6, 0x91e7, 0x91e8, 0x91e9, 0x91ea, 0x91eb, 0x91ec, 0x91ed, + 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f2, 0x91f3, 0x91f4, 0x91f5, + 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0x91fa, 0x91fb, 0x91fc, 0x91fd, + 0x91fe, 0x9240, 0x9241, 0x9242, 0x9243, 0x9242, 0x9245, 0x9246, + 0x9247, 0x9248, 0x9249, 0x924a, 0x924b, 0x924c, 0x924d, 0x924e, + 0x924f, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, 0x9256, + 0x9257, 0x9258, 0x9259, 0x925a, 0x925b, 0x925c, 0x925d, 0x925e, + 0x925f, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, 0x9266, + 0x9267, 0x9268, 0x9269, 0x926a, 0x926b, 0x926c, 0x926d, 0x926e, + 0x926f, 0x9270, 0x9271, 0x9272, 0x9273, 0x9274, 0x9275, 0x9276, + 0x9277, 0x9278, 0x9279, 0x927a, 0x927b, 0x927c, 0x927d, 0x927e, + 0x92a1, 0x92a2, 0x92a3, 0x92a4, 0x92a5, 0x92a6, 0x92a7, 0x92a8, + 0x92a9, 0x92aa, 0x92ab, 0x92ac, 0x92ad, 0x92ae, 0xa259, 0xa25a, + 0xa25c, 0xa25b, 0x92b3, 0x92b4, 0x92b5, 0x92b6, 0x92b7, 0x92b8, + 0x92b9, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92be, 0x92bf, 0x92c0, + 0x92c1, 0x92c2, 0x92c3, 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0xa05f, + 0x92c9, 0x92ca, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92cf, 0x92d0, + 0xe6ab, 0x92d2, 0x92d3, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0x92d8, + 0x92d9, 0x92da, 0x92db, 0x92dc, 0x92dd, 0x92de, 0x92df, 0x92e0, + 0x92e1, 0x92e2, 0x92e3, 0x92e4, 0x92e5, 0x92e6, 0x92e7, 0x92e8, + 0x92e9, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, + 0x92f1, 0x92f2, 0x92f3, 0x92f4, 0x92f5, 0x92f6, 0x92f7, 0x92f8, + 0x92f9, 0x92fa, 0x92fb, 0x92fc, 0x92fd, 0x92fe, 0x9340, 0x9341, + 0x9342, 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, + 0x934a, 0x934b, 0x934c, 0x934d, 0x934e, 0x934f, 0x9350, 0x9351, + 0x9352, 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, + 0x935a, 0x935b, 0x935c, 0x935d, 0x935e, 0x935f, 0x9360, 0x9361, + 0x9362, 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, + 0x936a, 0x936b, 0x936c, 0x936d, 0x936e, 0x936f, 0x9370, 0x9371, + 0x9372, 0x9373, 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, + 0x937a, 0x937b, 0x937c, 0x937d, 0x937e, 0x93a1, 0x93a2, 0x93a3, + 0x93a4, 0x93a5, 0x93a6, 0x93a7, 0x93a8, 0x93a9, 0x93aa, 0x93ab, + 0x93ac, 0x93ad, 0x93ae, 0x93af, 0x93b0, 0x93b1, 0x93b2, 0x93b3, + 0x93b4, 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, + 0x93bc, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, 0x93c2, 0x93c3, + 0x93c4, 0x93c5, 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93ca, 0x93cb, + 0x93cc, 0x93cd, 0x93ce, 0x93cf, 0x93d0, 0x93d1, 0x93d2, 0x93d3, + 0x93d4, 0x93d5, 0x93d6, 0x93d7, 0x93d8, 0x93d9, 0x93da, 0x93db, + 0x93dc, 0x93dd, 0x93de, 0x93df, 0x93e0, 0x93e1, 0x93e2, 0x93e3, + 0x93e4, 0x93e5, 0x93e6, 0x93e7, 0x93e8, 0x93e9, 0x93ea, 0x93eb, + 0x93ec, 0x93ed, 0x93ee, 0x93ef, 0x93f0, 0x93f1, 0x93f2, 0x93f3, + 0x93f4, 0x93f5, 0x93f6, 0x93f7, 0x93f8, 0x93f9, 0x93fa, 0x93fb, + 0x93fc, 0x93fd, 0x93fe, 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, + 0x9445, 0x9446, 0xd256, 0x9448, 0x9449, 0x944a, 0x944b, 0x944c, + 0x944d, 0x944e, 0x944f, 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, + 0x9455, 0x9456, 0x9457, 0x9458, 0x9459, 0x945a, 0x945b, 0x945c, + 0x945d, 0x945e, 0x945f, 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, + 0x9465, 0x9466, 0x9467, 0x9468, 0x9469, 0x946a, 0x946b, 0x946c, + 0x946d, 0x946e, 0x946f, 0x9470, 0x9471, 0x9472, 0x9473, 0x9474, + 0x9475, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, + 0x947d, 0x947e, 0x94a1, 0x94a2, 0x94a3, 0x94a4, 0x94a5, 0x94a6, + 0x94a7, 0x94a8, 0x94a9, 0x94aa, 0x94ab, 0x94ac, 0x94ad, 0x94ae, + 0x94af, 0x94b0, 0x94b1, 0x94b2, 0x94b3, 0x94b4, 0x94b5, 0x94b6, + 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bb, 0x94bc, 0x94bd, 0x94be, + 0x94bf, 0x94c0, 0x94c1, 0x94c2, 0x94c3, 0x94c4, 0x94c5, 0x94c6, + 0x94c7, 0x94c8, 0x94c9, 0xe6d0, 0x94cb, 0x94cc, 0x94cd, 0x94ce, + 0x94cf, 0x94d0, 0x94d1, 0x94d2, 0x94d3, 0x94d4, 0x94d5, 0x94d6, + 0x94d7, 0x94d8, 0x94d9, 0x94da, 0x94db, 0x94dc, 0x94dd, 0x94de, + 0x94df, 0x94e0, 0x94e1, 0x94e2, 0x94e3, 0x94e4, 0x94e5, 0x94e6, + 0x94e7, 0x94e8, 0x94e9, 0x94ea, 0x94eb, 0x94ec, 0x94ed, 0x94ee, + 0x94ef, 0x94f0, 0x94f1, 0x94f2, 0x94f3, 0x94f4, 0x94f5, 0x94f6, + 0x94f7, 0x94f8, 0x94f9, 0x94fa, 0x94fb, 0x94fc, 0x94fd, 0x94fe, + 0x9540, 0x9541, 0x9542, 0x9543, 0x9544, 0x9545, 0x9546, 0x9547, + 0x9548, 0x9549, 0x954a, 0x954b, 0x954c, 0x954d, 0x954e, 0x954f, + 0x9550, 0x9551, 0x9552, 0x9553, 0x9554, 0x9555, 0x9556, 0x9557, + 0x9558, 0x9559, 0x955a, 0x955b, 0x955c, 0x955d, 0x955e, 0x955f, + 0x9560, 0x9561, 0x9562, 0x9563, 0x9564, 0x9565, 0x9566, 0x9567, + 0x9568, 0x9569, 0x956a, 0x956b, 0x956c, 0x956d, 0x956e, 0x956f, + 0x9570, 0x9571, 0x9572, 0x9573, 0x9574, 0x9575, 0x9576, 0x9577, + 0x9578, 0x9579, 0x957a, 0x957b, 0x957c, 0x957d, 0x957e, 0x95a1, + 0x95a2, 0x95a3, 0x95a4, 0x95a5, 0x95a6, 0x95a7, 0x95a8, 0x95a9, + 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0x95af, 0x95b0, 0x95b1, + 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0x95b8, 0x95b9, + 0x95ba, 0x95bb, 0x95bc, 0x95bd, 0x95be, 0x95bf, 0x95c0, 0x95c1, + 0x95c2, 0x95c3, 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c8, 0x95c9, + 0x95ca, 0x95cb, 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, + 0x95d2, 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0xca52, + 0x95da, 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, + 0x95e2, 0x95e3, 0x95e4, 0x95e5, 0x95e6, 0x95e7, 0x95e8, 0x95e9, + 0x95ea, 0x95eb, 0x95ec, 0x95ed, 0x95ee, 0x95ef, 0x95f0, 0x95f1, + 0x95f2, 0x95f3, 0x95f4, 0x95f5, 0x95f6, 0x95f7, 0x95f8, 0x95f9, + 0x95fa, 0x95fb, 0x95fc, 0x95fd, 0x95fe, 0x9640, 0x9641, 0x9642, + 0x9643, 0x9ce4, 0x9645, 0x9646, 0x9647, 0x9648, 0x9649, 0x964a, + 0x964b, 0x964c, 0x964d, 0x964e, 0x964f, 0x9650, 0x9651, 0x9652, + 0x9653, 0x9654, 0x9655, 0x9656, 0x9657, 0x9658, 0x9659, 0x965a, + 0x965b, 0x965c, 0x965d, 0x965e, 0x965f, 0x9660, 0x9661, 0x9662, + 0x9663, 0x9664, 0x9665, 0x9666, 0x9667, 0x9668, 0x9669, 0x966a, + 0x966b, 0x966c, 0x966d, 0x966e, 0x966f, 0x9670, 0x9671, 0x9672, + 0x9673, 0x9674, 0x9675, 0x9676, 0x9677, 0x9678, 0x9679, 0x967a, + 0x967b, 0x967c, 0x967d, 0x967e, 0x96a1, 0x96a2, 0x96a3, 0x96a4, + 0x96a5, 0x96a6, 0x96a7, 0x96a8, 0x96a9, 0x96aa, 0x96ab, 0x96ac, + 0x96ad, 0x96ae, 0x96af, 0x96b0, 0x96b1, 0x96b2, 0x96b3, 0x96b4, + 0x96b5, 0x96b6, 0x96b7, 0x96b8, 0x96b9, 0x96ba, 0x96bb, 0x96bc, + 0x96bd, 0x96be, 0x96bf, 0x96c0, 0x96c1, 0x96c2, 0x96c3, 0x96c4, + 0x96c5, 0x96c6, 0x96c7, 0x96c8, 0x96c9, 0x96ca, 0x96cb, 0x96cc, + 0x96cd, 0x96ce, 0x96cf, 0x96d0, 0x96d1, 0x96d2, 0x96d3, 0x96d4, + 0x96d5, 0x96d6, 0x96d7, 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, + 0x96dd, 0x96de, 0x96df, 0x96e0, 0x96e1, 0x96e2, 0x96e3, 0x96e4, + 0x96e5, 0x96e6, 0x96e7, 0x96e8, 0x96e9, 0x96ea, 0x96eb, 0x96ec, + 0x96ee, 0x96ee, 0x96ef, 0x96f0, 0x96f1, 0x96f2, 0x96f3, 0x96f4, + 0x96f5, 0x96f6, 0x96f7, 0x96f8, 0x96f9, 0x96fa, 0x96fb, 0xe959, + 0x96fd, 0x96fe, 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, + 0x9746, 0x9747, 0x9748, 0x9749, 0x974a, 0x974b, 0x974c, 0x974d, + 0x974e, 0x974f, 0x9750, 0x9751, 0x9752, 0x9753, 0x9754, 0x9755, + 0x9756, 0x9757, 0x9758, 0x9759, 0x975a, 0x975b, 0x975c, 0x975d, + 0x975e, 0x975f, 0x9760, 0x9761, 0x9762, 0x9763, 0x9764, 0x9765, + 0x9766, 0x9767, 0x9768, 0x9769, 0x976a, 0x976b, 0x976c, 0x976d, + 0x976e, 0x976f, 0x9770, 0x9771, 0x9772, 0x9773, 0x9774, 0x9775, + 0x9776, 0x9777, 0x9778, 0x9779, 0x977a, 0x977b, 0x977c, 0x977d, + 0x977e, 0x97a1, 0x97a2, 0x97a3, 0x97a4, 0x97a5, 0x97a6, 0x97a7, + 0x97a8, 0x97a9, 0x97aa, 0x97ab, 0x97ac, 0x97ad, 0x97ae, 0x97af, + 0x97b0, 0x97b1, 0x97b2, 0x97b3, 0x97b4, 0x97b5, 0x97b6, 0x97b7, + 0x97b8, 0x97b9, 0x97ba, 0x97bb, 0x97bc, 0x97bd, 0x97be, 0x97bf, + 0x97c0, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, 0x97c6, 0x97c7, + 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0x97cd, 0x97ce, 0x97cf, + 0x97d0, 0x97d1, 0x97d2, 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, + 0x97d8, 0x97d9, 0x97da, 0x97db, 0x97dc, 0x97dd, 0x97de, 0x97df, + 0x97e0, 0x97e1, 0x97e2, 0x97e3, 0x97e4, 0x97e5, 0x97e6, 0x97e7, + 0x97e8, 0x97e9, 0x97ea, 0x97eb, 0x97ec, 0x97ed, 0x97ee, 0x97ef, + 0x97f0, 0x97f1, 0x97f2, 0x97f3, 0x97f4, 0x97f5, 0x97f6, 0x97f7, + 0x97f8, 0x97f9, 0x97fa, 0x97fb, 0x97fc, 0x97fd, 0x97fe, 0x9840, + 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, 0x9847, 0x9848, + 0x9849, 0x984a, 0x984b, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, + 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, 0x9856, 0x9857, 0x9858, + 0x9859, 0x985a, 0x985b, 0x985c, 0x985d, 0x985e, 0x985f, 0x9860, + 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, 0x9866, 0x9867, 0x9868, + 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x986f, 0x9870, + 0x9871, 0x9872, 0x9873, 0x9874, 0x9875, 0x9876, 0x9877, 0x9878, + 0x9879, 0x987a, 0x987b, 0x987c, 0x987d, 0x987e, 0x98a1, 0x98a2, + 0x98a3, 0x98a4, 0x98a5, 0x98a6, 0x98a7, 0x98a8, 0x98a9, 0x98aa, + 0x98ab, 0x98ac, 0x98ad, 0x98ae, 0x98af, 0x98b0, 0x98b1, 0x98b2, + 0x98b3, 0x98b4, 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, + 0x98bb, 0x98bc, 0x98bd, 0x98be, 0x98bf, 0x98c0, 0x98c1, 0x98c2, + 0x98c3, 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, + 0x98cb, 0x98cc, 0x98cd, 0x98ce, 0x98cf, 0x98d0, 0x98d1, 0x98d2, + 0x98d3, 0x98d4, 0x98d5, 0x98d6, 0x98d7, 0x98d8, 0x98d9, 0x98da, + 0x98db, 0x98dc, 0x98dd, 0x98de, 0x98df, 0x98e0, 0x98e1, 0x98e2, + 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e7, 0x98e8, 0x98e9, 0x98ea, + 0x98eb, 0x98ec, 0x98ed, 0x98ee, 0x98ef, 0x98f0, 0x98f1, 0x98f2, + 0x98f3, 0x98f4, 0x98f5, 0x98f6, 0x98f7, 0x98f8, 0x98f9, 0x98fa, + 0x98fb, 0x98fc, 0x98fd, 0x98fe, 0x9940, 0x9941, 0x9942, 0x9943, + 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, 0x994a, 0x994b, + 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, 0x9952, 0x9953, + 0x9954, 0x9955, 0x9956, 0x9957, 0x9958, 0x9959, 0x995a, 0x995b, + 0x995c, 0x995d, 0x995e, 0x995f, 0x9960, 0x9961, 0x9962, 0x9963, + 0x9964, 0x9965, 0x9966, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, + 0x996c, 0x996d, 0x996e, 0x996f, 0x9970, 0x9971, 0x9972, 0x9973, + 0x9974, 0x9975, 0x9976, 0x9977, 0x9978, 0x9979, 0x997a, 0x997b, + 0x997c, 0x997d, 0x997e, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a5, + 0x99a6, 0x99a7, 0x99a8, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, + 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, + 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, + 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, + 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, + 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, + 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, + 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, + 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, + 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, + 0x99f6, 0x99f7, 0x99f8, 0x99f9, 0x99fa, 0x99fb, 0x99fc, 0x99fd, + 0x99fe, 0x9a40, 0x9a41, 0x9a42, 0x9a43, 0x9a44, 0x9a45, 0x9a46, + 0x9a47, 0x9a48, 0x9a49, 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4d, 0x9a4e, + 0x9a4f, 0x9a50, 0x9a51, 0x9a52, 0x9a53, 0x9a54, 0x9a55, 0x9a56, + 0x9a57, 0x9a58, 0x9a59, 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, + 0x9a5f, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, 0x9a66, + 0x9a67, 0x9a68, 0x9a69, 0x9a6a, 0x9a6b, 0x9a6c, 0x9a6d, 0x9a6e, + 0x9a6f, 0x9a70, 0x9a71, 0x9a72, 0x9a73, 0x9a74, 0x9a75, 0x9a76, + 0x9a77, 0x9a78, 0x9a79, 0x9a7a, 0x9a7b, 0x9a7c, 0x9a7d, 0x9a7e, + 0x9aa1, 0x9aa2, 0x9aa3, 0x9aa4, 0x9aa5, 0x9aa6, 0x9aa7, 0x9aa8, + 0x9aa9, 0x9aaa, 0x9aab, 0x9aac, 0x9aad, 0x9aae, 0x9aaf, 0x9ab0, + 0x9ab1, 0x9ab2, 0x9ab3, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab7, 0x9ab8, + 0x9ab9, 0x9aba, 0x9abb, 0x9abc, 0x9abd, 0x9abe, 0x9abf, 0x9ac0, + 0x9ac1, 0x9ac2, 0x9ac3, 0x9ac4, 0x9ac5, 0x9ac6, 0x9ac7, 0x9ac8, + 0x9ac9, 0x9aca, 0x9acb, 0x9acc, 0x9acd, 0x9ace, 0x9acf, 0x9ad0, + 0x9ad1, 0x9ad2, 0x9ad3, 0x9ad4, 0x9ad5, 0x9ad6, 0x9ad7, 0x9ad8, + 0x9ad9, 0x9ada, 0x9adb, 0x9adc, 0x9add, 0x9ade, 0x9adf, 0x9ae0, + 0x9ae1, 0x9ae2, 0x9ae3, 0x9ae4, 0x9ae5, 0x9ae6, 0x9ae7, 0x9ae8, + 0x9ae9, 0x9aea, 0x9aeb, 0x9aec, 0x9aed, 0x9aee, 0x9aef, 0x9af0, + 0x9af1, 0x9af2, 0x9af3, 0x9af4, 0x9af5, 0x9af6, 0x9af7, 0x9af8, + 0x9af9, 0x9afa, 0x9afb, 0x9afc, 0x9afd, 0x9afe, 0x9b40, 0x9b41, + 0x9b42, 0x9b43, 0x9b44, 0x9b45, 0x9b46, 0x9b47, 0x9b48, 0x9b49, + 0x9b4a, 0x9b4b, 0x9b4c, 0x9b4d, 0x9b4e, 0x9b4f, 0x9b50, 0x9b51, + 0x9b52, 0x9b53, 0x9b54, 0x9b55, 0x9b56, 0x9b57, 0x9b58, 0x9b59, + 0x9b5a, 0x9b5b, 0x9b5c, 0x9b5d, 0x9b5e, 0x9b5f, 0x9b60, 0x9b61, + 0x9b62, 0x9b63, 0x9b64, 0x9b65, 0x9b66, 0x9b67, 0x9b68, 0x9b69, + 0x9b6a, 0x9b6b, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, 0x9b70, 0x9b71, + 0x9b72, 0x9b73, 0x9b74, 0x9b75, 0xeff9, 0x9b77, 0xc5f7, 0x9b79, + 0x9b7a, 0xf5e8, 0x9b7c, 0x9b7d, 0x9b7e, 0x9ba1, 0x9ba2, 0x9ba3, + 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0x9ba8, 0x9ba9, 0x9baa, 0x9bab, + 0x9bac, 0x9bad, 0x9bae, 0x9baf, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb3, + 0x9bb4, 0x9bb5, 0x9bb6, 0x9bb7, 0x9bb8, 0x9bb9, 0x9bba, 0x9bbb, + 0x9bbc, 0x9bbd, 0x9bbe, 0x9bbf, 0x9bc0, 0x9bc1, 0x9bc2, 0x9bc3, + 0x9bc4, 0x9bc5, 0xe8cd, 0x9bc7, 0x9bc8, 0x9bc9, 0x9bca, 0x9bcb, + 0x9bcc, 0x9bcd, 0x9bce, 0x9bcf, 0x9bd0, 0x9bd1, 0x9bd2, 0x9bd3, + 0x9bd4, 0x9bd5, 0x9bd6, 0x9bd7, 0x9bd8, 0x9bd9, 0x9bda, 0x9bdb, + 0x9bdc, 0x9bdd, 0xd0c0, 0x9bdf, 0x9be0, 0x9be1, 0x9be2, 0x9be3, + 0x9be4, 0x9be5, 0x9be6, 0x9be7, 0x9be8, 0x9be9, 0x9bea, 0x9beb, + 0xfd64, 0x9bed, 0x9bee, 0x9bef, 0x9bf0, 0x9bf1, 0x9bf2, 0x9bf3, + 0x9bf4, 0x9bf5, 0xbf47, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfb, + 0x9bfc, 0x9bfd, 0x9bfe, 0x9c40, 0x9c41, 0xebc9, 0x9c43, 0x9c44, + 0x9c45, 0x9c46, 0x9c47, 0x9c48, 0x9c49, 0x9c4a, 0x9c4b, 0x9c4c, + 0x9c4d, 0x9c4e, 0x9c4f, 0x9c50, 0x9c51, 0x9c52, 0xcde7, 0x9c54, + 0x9c55, 0x9c56, 0x9c57, 0x9c58, 0x9c59, 0x9c5a, 0x9c5b, 0x9c5c, + 0x9c5d, 0x9c5e, 0x9c5f, 0x9c60, 0x9c61, 0xc0e7, 0x9c63, 0x9c64, + 0x9c65, 0x9c66, 0x9c67, 0xdc52, 0x9c69, 0x9c6a, 0xf86d, 0x9c6c, + 0x9c6d, 0x9c6e, 0x9c6f, 0x9c70, 0x9c71, 0x9c72, 0x9c73, 0x9c74, + 0x9c75, 0x9c76, 0xdb5d, 0x9c78, 0x9c79, 0x9c7a, 0x9c7b, 0x9c7c, + 0x9c7d, 0x9c7e, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca4, 0x9ca5, 0x9ca6, + 0x9ca7, 0x9ca8, 0x9ca9, 0x9caa, 0x9cab, 0x9cac, 0x9cad, 0x9cae, + 0x9caf, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, 0x9cb4, 0x9cb5, 0x9cb6, + 0x9cb7, 0x9cb8, 0x9cb9, 0x9cba, 0x9cbb, 0xc95c, 0xafb0, 0x9cbe, + 0x9cbf, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc3, 0x9cc4, 0x9cc5, 0x9cc6, + 0x9cc7, 0x9cc8, 0x9cc9, 0x9cca, 0x9ccb, 0x9ccc, 0x9ccd, 0x9cce, + 0x9ccf, 0xd4d1, 0x9cd1, 0x9cd2, 0x9cd3, 0x9cd4, 0x9cd5, 0x9cd6, + 0x9cd7, 0x9cd8, 0x9cd9, 0x9cda, 0x9cdb, 0x9cdc, 0x9cdd, 0x9cde, + 0x9cdf, 0x9ce0, 0x9ce1, 0x9ce2, 0x9ce3, 0x9ce4, 0x9ce5, 0x9ce6, + 0x9ce7, 0x9ce8, 0x9ce9, 0x9cea, 0x9ceb, 0x9cec, 0x9ced, 0x9cee, + 0x9cef, 0x9cf0, 0x9cf1, 0x9cf2, 0x9cf3, 0x9cf4, 0x9cf5, 0x9cf6, + 0x9cf7, 0x9cf8, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, + 0x9d40, 0x9d41, 0x9d42, 0x9d43, 0x9d44, 0x9d45, 0x9d46, 0x9d47, + 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, 0x9d4e, 0x9d4f, + 0x9d50, 0x9d51, 0x9d52, 0x9d53, 0x9d54, 0x9d55, 0x9d56, 0xe07c, + 0x9d58, 0x9d59, 0xb5ae, 0x9d5b, 0x9d5c, 0x9d5d, 0x9d5e, 0x9d5f, + 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, 0x9d67, + 0x9d68, 0x9d69, 0x9d6a, 0x9d6b, 0x9d6c, 0x9d6d, 0x9d6e, 0x9d6f, + 0x9d70, 0x9d71, 0x9d72, 0x9d73, 0x9d74, 0x9d75, 0x9d76, 0x9d77, + 0x9d78, 0x9d79, 0x9d7a, 0x9d7b, 0x9d7c, 0x9d7d, 0x9d7e, 0x9da1, + 0x9da2, 0x9da3, 0x9da4, 0x9da5, 0x9da6, 0x9da7, 0x9da8, 0x9da9, + 0x9daa, 0x9dab, 0x9dac, 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0x9db1, + 0x9db2, 0x9db3, 0x9db4, 0x9db5, 0x9db6, 0x9db7, 0x9db8, 0x9db9, + 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, 0x9dbf, 0x9dc0, 0x9dc1, + 0x9dc2, 0x9dc3, 0xa9e4, 0x9dc5, 0x9dc6, 0x9dc7, 0x9dc8, 0x9dc9, + 0x9dca, 0x9dcb, 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, + 0x9dd2, 0x9dd3, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dd8, 0x9dd9, + 0x9dda, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, 0x9de1, + 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, 0x9de7, 0x9de8, 0x9de9, + 0x9dea, 0x9deb, 0x9dec, 0x9ded, 0x9dee, 0x9def, 0x9df0, 0x9df1, + 0x9df2, 0x9df3, 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, + 0x9dfa, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9e40, 0x9e41, 0x9e42, + 0x9e43, 0x9e44, 0x9e45, 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4a, + 0x9e4b, 0x9e4c, 0x9e4d, 0x9e4e, 0x9e4f, 0x9e50, 0x9e51, 0x9e52, + 0x9e53, 0x9e54, 0x9e55, 0x9e56, 0x9e57, 0x9e58, 0x9e59, 0x9e5a, + 0x9e5b, 0x9e5c, 0x9e5d, 0x9e5e, 0x9e5f, 0x9e60, 0x9e61, 0x9e62, + 0x9e63, 0x9e64, 0x9e65, 0x9e66, 0x9e67, 0x9e68, 0x9e69, 0x9e6a, + 0x9e6b, 0x9e6c, 0x9e6d, 0x9e6e, 0x9e6f, 0x9e70, 0x9e71, 0x9e72, + 0x9e73, 0x9e74, 0x9e75, 0x9e76, 0x9e77, 0x9e78, 0x9e79, 0x9e7a, + 0x9e7b, 0x9e7c, 0x9e7d, 0x9e7e, 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, + 0x9ea5, 0x9ea6, 0x9ea7, 0x9ea8, 0xabec, 0x9eaa, 0x9eab, 0x9eac, + 0x9ead, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb4, + 0x9eb5, 0x9eb6, 0x9eb7, 0x9eb8, 0x9eb9, 0x9eba, 0x9ebb, 0x9ebc, + 0x9ebd, 0x9ebe, 0x9ebf, 0x9ec0, 0x9ec1, 0x9ec2, 0x9ec3, 0x9ec4, + 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0x9ec9, 0x9eca, 0x9ecb, 0x9ecc, + 0x9ecd, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed1, 0x9ed2, 0x9ed3, 0x9ed4, + 0x9ed5, 0x9ed6, 0x9ed7, 0x9ed8, 0x9ed9, 0x9eda, 0x9edb, 0x9edc, + 0x9edd, 0x9ede, 0x9edf, 0x9ee0, 0x9ee1, 0x9ee2, 0x9ee3, 0x9ee4, + 0x9ee5, 0x9ee6, 0x9ee7, 0x9ee8, 0x9ee9, 0x9eea, 0x9eeb, 0x9eec, + 0x9eed, 0x9eee, 0xdecd, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, + 0x9ef5, 0x9ef6, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa, 0x9efb, 0x9efc, + 0xc9fc, 0x9efe, 0x9f40, 0x9f41, 0x9f42, 0x9f43, 0x9f44, 0x9f45, + 0x9f46, 0x9f47, 0x9f48, 0x9f49, 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, + 0x9f4e, 0x9f4f, 0x9f50, 0x9f51, 0x9f52, 0x9f53, 0x9f54, 0x9f55, + 0x9f56, 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, + 0x9f5e, 0x9f5f, 0xf9c4, 0x9f61, 0x9f62, 0x9f63, 0x9f64, 0x9f65, + 0x91be, 0x9f67, 0x9f68, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, + 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0x9f74, 0x9f75, + 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0x9f7c, 0x9f7d, + 0x9f7e, 0x9fa1, 0x9fa2, 0x9fa3, 0x9fa4, 0x9fa5, 0x9fa6, 0x9fa7, + 0x9fa8, 0x9fa9, 0x9faa, 0x9fab, 0x9fac, 0x9fad, 0x9fae, 0x9faf, + 0x9fb0, 0x9fb1, 0x9fb2, 0x9fb3, 0x9fb4, 0x9fb5, 0x9fb6, 0x9fb7, + 0x9fb8, 0x9fb9, 0x9fba, 0x9fbb, 0x9fbc, 0x9fbd, 0x9fbe, 0x9fbf, + 0x9fc0, 0x9fc1, 0x9fc2, 0x9fc3, 0x9fc4, 0x9fc5, 0x9fc6, 0x9fc7, + 0x9fc8, 0x9fc9, 0x9fca, 0xb9b0, 0x9fcc, 0x9fcd, 0x9fce, 0x9fcf, + 0x9fd0, 0x9fd1, 0x9fd2, 0x9fd3, 0x9fd4, 0x9fd5, 0x9fd6, 0x9fd7, + 0x9361, 0x9fd9, 0x9fda, 0x9fdb, 0x9fdc, 0x9fdd, 0x9fde, 0x9fdf, + 0x9fe0, 0x9fe1, 0x9fe2, 0x9fe3, 0x9fe4, 0x9fe5, 0x9fe6, 0x9fe7, + 0x9fe8, 0x9fe9, 0x9fea, 0x9feb, 0x9fec, 0x9fed, 0x9fee, 0x9fef, + 0x9ff0, 0x9ff1, 0x9ff2, 0x9ff3, 0x9ff4, 0x9ff5, 0x9ff6, 0x9ff7, + 0x9ff8, 0x9ff9, 0x9ffa, 0x9ffb, 0x9ffc, 0x9ffd, 0x9ffe, 0xa040, + 0xa041, 0xa042, 0xa043, 0xa044, 0xa045, 0xa046, 0xa047, 0xa048, + 0xa049, 0xa04a, 0xa04b, 0xa04c, 0xa04d, 0xa04e, 0xa04f, 0xa050, + 0xa051, 0xa052, 0xa053, 0xa054, 0xa055, 0xa056, 0xa057, 0xa058, + 0xa059, 0xa05a, 0xa05b, 0xa05c, 0xa05d, 0xa05e, 0xa05f, 0xa060, + 0xa061, 0xa062, 0x8fb6, 0xa064, 0xa065, 0xa066, 0xa067, 0xa068, + 0xa069, 0xa06a, 0xa06b, 0xa06c, 0xa06d, 0xa06e, 0xa06f, 0xa070, + 0xa071, 0xa072, 0xa073, 0xa074, 0xa075, 0xa076, 0xa9f0, 0xa078, + 0xa079, 0xa07a, 0xa07b, 0xa07c, 0xa07d, 0xa07e, 0xa0a1, 0xa0a2, + 0xa0a3, 0xa0a4, 0xa0a5, 0xa0a6, 0xa0a7, 0xa0a8, 0xa0a9, 0xa0aa, + 0xa0ab, 0xa0ac, 0xa0ad, 0xa0ae, 0xa0af, 0xa0b0, 0xa0b1, 0xa0b2, + 0xa0b3, 0xa0b4, 0xa0b5, 0xa0b6, 0xa0b7, 0xa0b8, 0xa0b9, 0xa0ba, + 0xa0bb, 0xa0bc, 0xa0bd, 0xa0be, 0xa0bf, 0xa0c0, 0xa0c1, 0xa0c2, + 0xa0c3, 0xa0c4, 0xa0c5, 0xa0c6, 0xa0c7, 0xa0c8, 0xa0c9, 0xa0ca, + 0xa0cb, 0xa0cc, 0xa0cd, 0xa0ce, 0xa0cf, 0xa0d0, 0xa0d1, 0xa0d2, + 0xa0d3, 0xa0d4, 0x947a, 0xa0d6, 0xa0d7, 0xa0d8, 0xa0d9, 0xa0da, + 0xa0db, 0xa0dc, 0xa0dd, 0xa0de, 0xde72, 0xa0e0, 0xa0e1, 0xa0e2, + 0xa0e3, 0x9455, 0xa0e5, 0xa0e6, 0xa0e7, 0xa0e8, 0xa0e9, 0xa0ea, + 0xa0eb, 0xa0ec, 0xa0ed, 0xa0ee, 0xa0ef, 0xa0f0, 0xa0f1, 0xa0f2, + 0xa0f3, 0xa0f4, 0xa0f5, 0xa0f6, 0xa0f7, 0xa0f8, 0xa0f9, 0xa0fa, + 0xa0fb, 0xa0fc, 0xa0fd, 0xa0fe, 0x8140, 0x8141, 0x8142, 0x8143, + 0x8144, 0x8145, 0x8146, 0x8147, 0x8148, 0x8149, 0x814a, 0x814b, + 0x814c, 0x814d, 0x814e, 0x814f, 0x8150, 0x8151, 0x8152, 0x8153, + 0x8154, 0x8155, 0x8156, 0x8157, 0x8158, 0x8159, 0x815a, 0x815b, + 0x815c, 0x815d, 0x815e, 0x815f, 0x8160, 0x8161, 0x8162, 0x8163, + 0x8164, 0x8165, 0x8166, 0x8167, 0x8168, 0x8169, 0x816a, 0x816b, + 0x816c, 0x816d, 0x816e, 0x816f, 0x8170, 0x8171, 0x8172, 0x8173, + 0x8174, 0x8175, 0x8176, 0x8177, 0x8178, 0x8179, 0x817a, 0x817b, + 0x817c, 0x817d, 0x817e, 0x81a1, 0x81a2, 0x81a3, 0x81a4, 0x81a5, + 0x81a6, 0x81a7, 0x81a8, 0x81a9, 0x81aa, 0x81ab, 0x81ac, 0x81ad, + 0x81ae, 0x81af, 0x81b0, 0x81b1, 0x81b2, 0x81b3, 0x81b4, 0x81b5, + 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0x81ba, 0x81bb, 0x81bc, 0x81bd, + 0x81be, 0x81bf, 0x81c0, 0x81c1, 0x81c2, 0x81c3, 0x81c4, 0x81c5, + 0x81c6, 0x81c7, 0x81c8, 0x81c9, 0x81ca, 0x81cb, 0x81cc, 0x81cd, + 0x81ce, 0x81cf, 0x81d0, 0x81d1, 0x81d2, 0x81d3, 0x81d4, 0x81d5, + 0x81d6, 0x81d7, 0x81d8, 0x81d9, 0x81da, 0x81db, 0x81dc, 0x81dd, + 0x81de, 0x81df, 0x81e0, 0x81e1, 0x81e2, 0x81e3, 0x81e4, 0x81e5, + 0x81e6, 0x81e7, 0x81e8, 0x81e9, 0x81ea, 0x81eb, 0x81ec, 0x81ed, + 0x81ee, 0x81ef, 0x81f0, 0x81f1, 0x81f2, 0x81f3, 0x81f4, 0x81f5, + 0x81f6, 0x81f7, 0x81f8, 0x81f9, 0x81fa, 0x81fb, 0x81fc, 0x81fd, + 0x81fe, 0x8240, 0x8241, 0x8242, 0x8243, 0x8244, 0x8245, 0x8246, + 0x8247, 0x8248, 0x8249, 0x824a, 0x824b, 0x824c, 0x824d, 0x824e, + 0x824f, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, 0x8256, + 0x8257, 0x8258, 0x8259, 0x825a, 0x825b, 0x825c, 0x825d, 0x825e, + 0x825f, 0x8260, 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, + 0x8267, 0x8268, 0x8269, 0x826a, 0x826b, 0x826c, 0x826d, 0x826e, + 0x826f, 0x8270, 0x8271, 0x8272, 0x8273, 0x8274, 0x8275, 0x8276, + 0x8277, 0x8278, 0x8279, 0x827a, 0x827b, 0x827c, 0x827d, 0x827e, + 0x82a1, 0x82a2, 0x82a3, 0x82a4, 0x82a5, 0x82a6, 0x82a7, 0x82a8, + 0x82a9, 0x82aa, 0x82ab, 0x82ac, 0x82ad, 0x82ae, 0x82af, 0x82b0, + 0x82b1, 0x82b2, 0x82b3, 0x82b4, 0x82b5, 0x82b6, 0x82b7, 0x82b8, + 0x82b9, 0x82ba, 0x82bb, 0x82bc, 0x82bd, 0x82be, 0x82bf, 0x82c0, + 0x82c1, 0x82c2, 0x82c3, 0x82c4, 0x82c5, 0x82c6, 0x82c7, 0x82c8, + 0x82c9, 0x82ca, 0x82cb, 0x82cc, 0x82cd, 0x82ce, 0x82cf, 0x82d0, + 0x82d1, 0x82d2, 0x82d3, 0x82d4, 0x82d5, 0x82d6, 0x82d7, 0x82d8, + 0x82d9, 0x82da, 0x82db, 0x82dc, 0x82dd, 0x82de, 0x82df, 0x82e0, + 0x82e1, 0x82e2, 0x82e3, 0x82e4, 0x82e5, 0x82e6, 0x82e7, 0x82e8, + 0x82e9, 0x82ea, 0x82eb, 0x82ec, 0x82ed, 0x82ee, 0x82ef, 0x82f0, + 0x82f1, 0x82f2, 0x82f3, 0x82f4, 0x82f5, 0x82f6, 0x82f7, 0x82f8, + 0x82f9, 0x82fa, 0x82fb, 0x82fc, 0x82fd, 0x82fe, 0x8340, 0x8341, + 0x8342, 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, + 0x834a, 0x834b, 0x834c, 0x834d, 0x834e, 0x834f, 0x8350, 0x8351, + 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0x8358, 0x8359, + 0x835a, 0x835b, 0x835c, 0x835d, 0x835e, 0x835f, 0x8360, 0x8361, + 0x8362, 0x8363, 0x8364, 0x8365, 0x8366, 0x8367, 0x8368, 0x8369, + 0x836a, 0x836b, 0x836c, 0x836d, 0x836e, 0x836f, 0x8370, 0x8371, + 0x8372, 0x8373, 0x8374, 0x8375, 0x8376, 0x8377, 0x8378, 0x8379, + 0x837a, 0x837b, 0x837c, 0x837d, 0x837e, 0x83a1, 0x83a2, 0x83a3, + 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83a8, 0x83a9, 0x83aa, 0x83ab, + 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b0, 0x83b1, 0x83b2, 0x83b3, + 0x83b4, 0x83b5, 0x83b6, 0x83b7, 0x83b8, 0x83b9, 0x83ba, 0x83bb, + 0x83bc, 0x83bd, 0x83be, 0x83bf, 0x83c0, 0x83c1, 0x83c2, 0x83c3, + 0x83c4, 0x83c5, 0x83c6, 0x83c7, 0x83c8, 0x83c9, 0x83ca, 0x83cb, + 0x83cc, 0x83cd, 0x83ce, 0x83cf, 0x83d0, 0x83d1, 0x83d2, 0x83d3, + 0x83d4, 0x83d5, 0x83d6, 0x83d7, 0x83d8, 0x83d9, 0x83da, 0x83db, + 0x83dc, 0x83dd, 0x83de, 0x83df, 0x83e0, 0x83e1, 0x83e2, 0x83e3, + 0x83e4, 0x83e5, 0x83e6, 0x83e7, 0x83e8, 0x83e9, 0x83ea, 0x83eb, + 0x83ec, 0x83ed, 0x83ee, 0x83ef, 0x83f0, 0x83f1, 0x83f2, 0x83f3, + 0x83f4, 0x83f5, 0x83f6, 0x83f7, 0x83f8, 0x83f9, 0x83fa, 0x83fb, + 0x83fc, 0x83fd, 0x83fe, 0x8440, 0x8441, 0x8442, 0x8443, 0x8444, + 0x8445, 0x8446, 0x8447, 0x8448, 0x8449, 0x844a, 0x844b, 0x844c, + 0x844d, 0x844e, 0x844f, 0x8450, 0x8451, 0x8452, 0x8453, 0x8454, + 0x8455, 0x8456, 0x8457, 0x8458, 0x8459, 0x845a, 0x845b, 0x845c, + 0x845d, 0x845e, 0x845f, 0x8460, 0x8461, 0x8462, 0x8463, 0x8464, + 0x8465, 0x8466, 0x8467, 0x8468, 0x8469, 0x846a, 0x846b, 0x846c, + 0x846d, 0x846e, 0x846f, 0x8470, 0x8471, 0x8472, 0x8473, 0x8474, + 0x8475, 0x8476, 0x8477, 0x8478, 0x8479, 0x847a, 0x847b, 0x847c, + 0x847d, 0x847e, 0x84a1, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, + 0x84a7, 0x84a8, 0x84a9, 0x84aa, 0x84ab, 0x84ac, 0x84ad, 0x84ae, + 0x84af, 0x84b0, 0x84b1, 0x84b2, 0x84b3, 0x84b4, 0x84b5, 0x84b6, + 0x84b7, 0x84b8, 0x84b9, 0x84ba, 0x84bb, 0x84bc, 0x84bd, 0x84be, + 0x84bf, 0x84c0, 0x84c1, 0x84c2, 0x84c3, 0x84c4, 0x84c5, 0x84c6, + 0x84c7, 0x84c8, 0x84c9, 0x84ca, 0x84cb, 0x84cc, 0x84cd, 0x84ce, + 0x84cf, 0x84d0, 0x84d1, 0x84d2, 0x84d3, 0x84d4, 0x84d5, 0x84d6, + 0x84d7, 0x84d8, 0x84d9, 0x84da, 0x84db, 0x84dc, 0x84dd, 0x84de, + 0x84df, 0x84e0, 0x84e1, 0x84e2, 0x84e3, 0x84e4, 0x84e5, 0x84e6, + 0x84e7, 0x84e8, 0x84e9, 0x84ea, 0x84eb, 0x84ec, 0x84ed, 0x84ee, + 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f3, 0x84f4, 0x84f5, 0x84f6, + 0x84f7, 0x84f8, 0x84f9, 0x84fa, 0x84fb, 0x84fc, 0x84fd, 0x84fe, + 0x8540, 0x8541, 0x8542, 0x8543, 0x8544, 0x8545, 0x8546, 0x8547, + 0x8548, 0x8549, 0x854a, 0x854b, 0x854c, 0x854d, 0x854e, 0x854f, + 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, 0x8556, 0x8557, + 0x8558, 0x8559, 0x855a, 0x855b, 0x855c, 0x855d, 0x855e, 0x855f, + 0x8560, 0x8561, 0x8562, 0x8563, 0x8564, 0x8565, 0x8566, 0x8567, + 0x8568, 0x8569, 0x856a, 0x856b, 0x856c, 0x856d, 0x856e, 0x856f, + 0x8570, 0x8571, 0x8572, 0x8573, 0x8574, 0x8575, 0x8576, 0x8577, + 0x8578, 0x8579, 0x857a, 0x857b, 0x857c, 0x857d, 0x857e, 0x85a1, + 0x85a2, 0x85a3, 0x85a4, 0x85a5, 0x85a6, 0x85a7, 0x85a8, 0x85a9, + 0x85aa, 0x85ab, 0x85ac, 0x85ad, 0x85ae, 0x85af, 0x85b0, 0x85b1, + 0x85b2, 0x85b3, 0x85b4, 0x85b5, 0x85b6, 0x85b7, 0x85b8, 0x85b9, + 0x85ba, 0x85bb, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c0, 0x85c1, + 0x85c2, 0x85c3, 0x85c4, 0x85c5, 0x85c6, 0x85c7, 0x85c8, 0x85c9, + 0x85ca, 0x85cb, 0x85cc, 0x85cd, 0x85ce, 0x85cf, 0x85d0, 0x85d1, + 0x85d2, 0x85d3, 0x85d4, 0x85d5, 0x85d6, 0x85d7, 0x85d8, 0x85d9, + 0x85da, 0x85db, 0x85dc, 0x85dd, 0x85de, 0x85df, 0x85e0, 0x85e1, + 0x85e2, 0x85e3, 0x85e4, 0x85e5, 0x85e6, 0x85e7, 0x85e8, 0x85e9, + 0x85ea, 0x85eb, 0x85ec, 0x85ed, 0x85ee, 0x85ef, 0x85f0, 0x85f1, + 0x85f2, 0x85f3, 0x85f4, 0x85f5, 0x85f6, 0x85f7, 0x85f8, 0x85f9, + 0x85fa, 0x85fb, 0x85fc, 0x85fd, 0x85fe, 0x8640, 0x8641, 0x8642, + 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, 0x8649, 0x864a, + 0x864b, 0x864c, 0x864d, 0x864e, 0x864f, 0x8650, 0x8651, 0x8652, + 0x8653, 0x8654, 0x8655, 0x8656, 0x8657, 0x8658, 0x8659, 0x865a, + 0x865b, 0x865c, 0x865d, 0x865e, 0x865f, 0x8660, 0x8661, 0x8662, + 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, 0x866a, + 0x866b, 0x866c, 0x866d, 0x866e, 0x866f, 0x8670, 0x8671, 0x8672, + 0x8673, 0x8674, 0x8675, 0x8676, 0x8677, 0x8678, 0x8679, 0x867a, + 0x867b, 0x867c, 0x867d, 0x867e, 0x86a1, 0x86a2, 0x86a3, 0x86a4, + 0x86a5, 0x86a6, 0x86a7, 0x86a8, 0x86a9, 0x86aa, 0x86ab, 0x86ac, + 0x86ad, 0x86ae, 0x86af, 0x86b0, 0x86b1, 0x86b2, 0x86b3, 0x86b4, + 0x86b5, 0x86b6, 0x86b7, 0x86b8, 0x86b9, 0x86ba, 0x86bb, 0x86bc, + 0x86bd, 0x86be, 0x86bf, 0x86c0, 0x86c1, 0x86c2, 0x86c3, 0x86c4, + 0x86c5, 0x86c6, 0x86c7, 0x86c8, 0x86c9, 0x86ca, 0x86cb, 0x86cc, + 0x86cd, 0x86ce, 0x86cf, 0x86d0, 0x86d1, 0x86d2, 0x86d3, 0x86d4, + 0x86d5, 0x86d6, 0x86d7, 0x86d8, 0x86d9, 0x86da, 0x86db, 0x86dc, + 0x86dd, 0x86de, 0x86df, 0x86e0, 0x86e1, 0x86e2, 0x86e3, 0x86e4, + 0x86e5, 0x86e6, 0x86e7, 0x86e8, 0x86e9, 0x86ea, 0x86eb, 0x86ec, + 0x86ed, 0x86ee, 0x86ef, 0x86f0, 0x86f1, 0x86f2, 0x86f3, 0x86f4, + 0x86f5, 0x86f6, 0x86f7, 0x86f8, 0x86f9, 0x86fa, 0x86fb, 0x86fc, + 0x86fd, 0x86fe, 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, + 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c, 0x874d, + 0x874e, 0x874f, 0x8750, 0x8751, 0x8752, 0x8753, 0x8754, 0x8755, + 0x8756, 0x8757, 0x8758, 0x8759, 0x875a, 0x875b, 0x875c, 0x875d, + 0x875e, 0x875f, 0x8760, 0x8761, 0x8762, 0x8763, 0x8764, 0x8765, + 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, 0x876d, + 0x876e, 0x876f, 0x8770, 0x8771, 0x8772, 0x8773, 0x8774, 0x8775, + 0x8776, 0x8777, 0x8778, 0x8779, 0x877a, 0x877b, 0x877c, 0x877d, + 0x877e, 0x87a1, 0x87a2, 0x87a3, 0x87a4, 0x87a5, 0x87a6, 0x87a7, + 0x87a8, 0x87a9, 0x87aa, 0x87ab, 0x87ac, 0x87ad, 0x87ae, 0x87af, + 0x87b0, 0x87b1, 0x87b2, 0x87b3, 0x87b4, 0x87b5, 0x87b6, 0x87b7, + 0x87b8, 0x87b9, 0x87ba, 0x87bb, 0x87bc, 0x87bd, 0x87be, 0x87bf, + 0x87c0, 0x87c1, 0x87c2, 0x87c3, 0x87c4, 0x87c5, 0x87c6, 0x87c7, + 0x87c8, 0x87c9, 0x87ca, 0x87cb, 0x87cc, 0x87cd, 0x87ce, 0x87cf, + 0x87d0, 0x87d1, 0x87d2, 0x87d3, 0x87d4, 0x87d5, 0x87d6, 0x87d7, + 0x87d8, 0x87d9, 0x87da, 0x87db, 0x87dc, 0x87dd, 0x87de, 0x87df, + 0x87e0, 0x87e1, 0x87e2, 0x87e3, 0x87e4, 0x87e5, 0x87e6, 0x87e7, + 0x87e8, 0x87e9, 0x87ea, 0x87eb, 0x87ec, 0x87ed, 0x87ee, 0x87ef, + 0x87f0, 0x87f1, 0x87f2, 0x87f3, 0x87f4, 0x87f5, 0x87f6, 0x87f7, + 0x87f8, 0x87f9, 0x87fa, 0x87fb, 0x87fc, 0x87fd, 0x87fe, 0x8840, + 0x8841, 0x8842, 0x8843, 0x8844, 0x8845, 0x8846, 0x8847, 0x8848, + 0x8849, 0x884a, 0x884b, 0x884c, 0x884d, 0x884e, 0x884f, 0x8850, + 0x8851, 0x8852, 0x8853, 0x8854, 0x8855, 0x8856, 0x8857, 0x8858, + 0x8859, 0x885a, 0x885b, 0x885c, 0x885d, 0x885e, 0x885f, 0x8860, + 0x8861, 0x8862, 0x8863, 0x8864, 0x8865, 0x8866, 0x8867, 0x8868, + 0x8869, 0x886a, 0x886b, 0x886c, 0x886d, 0x886e, 0x886f, 0x8870, + 0x8871, 0x8872, 0x8873, 0x8874, 0x8875, 0x8876, 0x8877, 0x8878, + 0x8879, 0x887a, 0x887b, 0x887c, 0x887d, 0x887e, 0x88a1, 0x88a2, + 0x88a3, 0x88a4, 0x88a5, 0x88a6, 0x88a7, 0x88a8, 0x88a9, 0x88aa, + 0x88ab, 0x88ac, 0x88ad, 0x88ae, 0x88af, 0x88b0, 0x88b1, 0x88b2, + 0x88b3, 0x88b4, 0x88b5, 0x88b6, 0x88b7, 0x88b8, 0x88b9, 0x88ba, + 0x88bb, 0x88bc, 0x88bd, 0x88be, 0x88bf, 0x88c0, 0x88c1, 0x88c2, + 0x88c3, 0x88c4, 0x88c5, 0x88c6, 0x88c7, 0x88c8, 0x88c9, 0x88ca, + 0x88cb, 0x88cc, 0x88cd, 0x88ce, 0x88cf, 0x88d0, 0x88d1, 0x88d2, + 0x88d3, 0x88d4, 0x88d5, 0x88d6, 0x88d7, 0x88d8, 0x88d9, 0x88da, + 0x88db, 0x88dc, 0x88dd, 0x88de, 0x88df, 0x88e0, 0x88e1, 0x88e2, + 0x88e3, 0x88e4, 0x88e5, 0x88e6, 0x88e7, 0x88e8, 0x88e9, 0x88ea, + 0x88eb, 0x88ec, 0x88ed, 0x88ee, 0x88ef, 0x88f0, 0x88f1, 0x88f2, + 0x88f3, 0x88f4, 0x88f5, 0x88f6, 0x88f7, 0x88f8, 0x88f9, 0x88fa, + 0x88fb, 0x88fc, 0x88fd, 0x88fe, 0x8940, 0x8941, 0x8942, 0x8943, + 0x8944, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, 0x894a, 0x894b, + 0x894c, 0x894d, 0x894e, 0x894f, 0x8950, 0x8951, 0x8952, 0x8953, + 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0x895a, 0x895b, + 0x895c, 0x895d, 0x895e, 0x895f, 0x8960, 0x8961, 0x8962, 0x8963, + 0x8964, 0x8965, 0x8966, 0x8967, 0x8968, 0x8969, 0x896a, 0x896b, + 0x896c, 0x896d, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, + 0x8974, 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897a, 0x897b, + 0x897c, 0x897d, 0x897e, 0x89a1, 0x89a2, 0x89a3, 0x89a4, 0x89a5, + 0x89a6, 0x89a7, 0x89a8, 0x89a9, 0x89aa, 0x89ab, 0x89ac, 0x89ad, + 0x89ae, 0x89af, 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, + 0x89b6, 0x89b7, 0x89b8, 0x89b9, 0x89ba, 0x89bb, 0x89bc, 0x89bd, + 0x89be, 0x89bf, 0x89c0, 0x89c1, 0x89c2, 0x89c3, 0x89c4, 0x89c5, + 0x89c6, 0x89c7, 0x89c8, 0x89c9, 0x89ca, 0x89cb, 0x89cc, 0x89cd, + 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x89d2, 0x89d3, 0x89d4, 0x89d5, + 0x89d6, 0x89d7, 0x89d8, 0x89d9, 0x89da, 0x89db, 0x89dc, 0x89dd, + 0x89de, 0x89df, 0x89e0, 0x89e1, 0x89e2, 0x89e3, 0x89e4, 0x89e5, + 0x89e6, 0x89e7, 0x89e8, 0x89e9, 0x89ea, 0x89eb, 0x89ec, 0x89ed, + 0x89ee, 0x89ef, 0x89f0, 0x89f1, 0x89f2, 0x89f3, 0x89f4, 0x89f5, + 0x89f6, 0x89f7, 0x89f8, 0x89f9, 0x89fa, 0x89fb, 0x89fc, 0x89fd, + 0x89fe, 0x8a40, 0x8a41, 0x8a42, 0x8a43, 0x8a44, 0x8a45, 0x8a46, + 0x8a47, 0x8a48, 0x8a49, 0x8a4a, 0x8a4b, 0x8a4c, 0x8a4d, 0x8a4e, + 0x8a4f, 0x8a50, 0x8a51, 0x8a52, 0x8a53, 0x8a54, 0x8a55, 0x8a56, + 0x8a57, 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, + 0x8a5f, 0x8a60, 0x8a61, 0x8a62, 0x8a63, 0x8a64, 0x8a65, 0x8a66, + 0x8a67, 0x8a68, 0x8a69, 0x8a6a, 0x8a6b, 0x8a6c, 0x8a6d, 0x8a6e, + 0x8a6f, 0x8a70, 0x8a71, 0x8a72, 0x8a73, 0x8a74, 0x8a75, 0x8a76, + 0x8a77, 0x8a78, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7c, 0x8a7d, 0x8a7e, + 0x8aa1, 0x8aa2, 0x8aa3, 0x8aa4, 0x8aa5, 0x8aa6, 0x8aa7, 0x8aa8, + 0x8aa9, 0x8aaa, 0x8aab, 0x8aac, 0x8aad, 0x8aae, 0x8aaf, 0x8ab0, + 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, 0x8ab6, 0x8ab7, 0x8ab8, + 0x8ab9, 0x8aba, 0x8abb, 0x8abc, 0x8abd, 0x8abe, 0x8abf, 0x8ac0, + 0x8ac1, 0x8ac2, 0x8ac3, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, 0x8ac8, + 0x8ac9, 0x8aca, 0x8acb, 0x8acc, 0x8acd, 0x8ace, 0x8acf, 0x8ad0, + 0x8ad1, 0x8ad2, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, + 0x8ad9, 0x8ada, 0x8adb, 0x8adc, 0x8add, 0x8ade, 0x8adf, 0x8ae0, + 0x8ae1, 0x8ae2, 0x8ae3, 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, + 0x8ae9, 0x8aea, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, 0x8af0, + 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0x8af5, 0x8af6, 0x8af7, 0x8af8, + 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, 0x8afe, 0x8b40, 0x8b41, + 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, 0x8b47, 0x8b48, 0x8b49, + 0x8b4a, 0x8b4b, 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0x8b50, 0x8b51, + 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0x8b56, 0x8b57, 0x8b58, 0x8b59, + 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, + 0x8b62, 0x8b63, 0x8b64, 0x8b65, 0x8b66, 0x8b67, 0x8b68, 0x8b69, + 0x8b6a, 0x8b6b, 0x8b6c, 0x8b6d, 0x8b6e, 0x8b6f, 0x8b70, 0x8b71, + 0x8b72, 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, + 0x8b7a, 0x8b7b, 0x8b7c, 0x8b7d, 0x8b7e, 0x8ba1, 0x8ba2, 0x8ba3, + 0x8ba4, 0x8ba5, 0x8ba6, 0x8ba7, 0x8ba8, 0x8ba9, 0x8baa, 0x8bab, + 0x8bac, 0x8bad, 0x8bae, 0x8baf, 0x8bb0, 0x8bb1, 0x8bb2, 0x8bb3, + 0x8bb4, 0x8bb5, 0x8bb6, 0x8bb7, 0x8bb8, 0x8bb9, 0x8bba, 0x8bbb, + 0x8bbc, 0x8bbd, 0x8bbe, 0x8bbf, 0x8bc0, 0x8bc1, 0x8bc2, 0x8bc3, + 0x8bc4, 0x8bc5, 0x8bc6, 0x8bc7, 0x8bc8, 0x8bc9, 0x8bca, 0x8bcb, + 0x8bcc, 0x8bcd, 0x8bce, 0x8bcf, 0x8bd0, 0x8bd1, 0x8bd2, 0x8bd3, + 0x8bd4, 0x8bd5, 0x8bd6, 0x8bd7, 0x8bd8, 0x8bd9, 0x8bda, 0x8bdb, + 0x8bdc, 0x8bdd, 0x8bde, 0x8bdf, 0x8be0, 0x8be1, 0x8be2, 0x8be3, + 0x8be4, 0x8be5, 0x8be6, 0x8be7, 0x8be8, 0x8be9, 0x8bea, 0x8beb, + 0x8bec, 0x8bed, 0x8bee, 0x8bef, 0x8bf0, 0x8bf1, 0x8bf2, 0x8bf3, + 0x8bf4, 0x8bf5, 0x8bf6, 0x8bf7, 0x8bf8, 0x8bf9, 0x8bfa, 0x8bfb, + 0x8bfc, 0x8bfd, 0x8bfe, 0x8c40, 0x8c41, 0x8c42, 0x8c43, 0x8c44, + 0x8c45, 0x8c46, 0x8c47, 0x8c48, 0x8c49, 0x8c4a, 0x8c4b, 0x8c4c, + 0x8c4d, 0x8c4e, 0x8c4f, 0x8c50, 0x8c51, 0x8c52, 0x8c53, 0x8c54, + 0x8c55, 0x8c56, 0x8c57, 0x8c58, 0x8c59, 0x8c5a, 0x8c5b, 0x8c5c, + 0x8c5d, 0x8c5e, 0x8c5f, 0x8c60, 0x8c61, 0x8c62, 0x8c63, 0x8c64, + 0x8c65, 0x8c66, 0x8c67, 0x8c68, 0x8c69, 0x8c6a, 0x8c6b, 0x8c6c, + 0x8c6d, 0x8c6e, 0x8c6f, 0x8c70, 0x8c71, 0x8c72, 0x8c73, 0x8c74, + 0x8c75, 0x8c76, 0x8c77, 0x8c78, 0x8c79, 0x8c7a, 0x8c7b, 0x8c7c, + 0x8c7d, 0x8c7e, 0x8ca1, 0x8ca2, 0x8ca3, 0x8ca4, 0x8ca5, 0x8ca6, + 0x8ca7, 0x8ca8, 0x8ca9, 0x8caa, 0x8cab, 0x8cac, 0x8cad, 0x8cae, + 0x8caf, 0x8cb0, 0x8cb1, 0x8cb2, 0x8cb3, 0x8cb4, 0x8cb5, 0x8cb6, + 0x8cb7, 0x8cb8, 0x8cb9, 0x8cba, 0x8cbb, 0x8cbc, 0x8cbd, 0x8cbe, + 0x8cbf, 0x8cc0, 0x8cc1, 0x8cc2, 0x8cc3, 0x8cc4, 0x8cc5, 0x8cc6, + 0x8cc7, 0x8cc8, 0x8cc9, 0x8cca, 0x8ccb, 0x8ccc, 0x8ccd, 0x8cce, + 0x8ccf, 0x8cd0, 0x8cd1, 0x8cd2, 0x8cd3, 0x8cd4, 0x8cd5, 0x8cd6, + 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0x8cdb, 0x8cdc, 0x8cdd, 0x8cde, + 0x8cdf, 0x8ce0, 0x8ce1, 0x8ce2, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, + 0x8ce7, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, 0x8ced, 0x8cee, + 0x8cef, 0x8cf0, 0x8cf1, 0x8cf2, 0x8cf3, 0x8cf4, 0x8cf5, 0x8cf6, + 0x8cf7, 0x8cf8, 0x8cf9, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, 0x8cfe, + 0x8d40, 0x8d41, 0x8d42, 0x8d43, 0x8d44, 0x8d45, 0x8d46, 0x8d47, + 0x8d48, 0x8d49, 0x8d4a, 0x8d4b, 0x8d4c, 0x8d4d, 0x8d4e, 0x8d4f, + 0x8d50, 0x8d51, 0x8d52, 0x8d53, 0x8d54, 0x8d55, 0x8d56, 0x8d57, + 0x8d58, 0x8d59, 0x8d5a, 0x8d5b, 0x8d5c, 0x8d5d, 0x8d5e, 0x8d5f, + 0x8d60, 0x8d61, 0x8d62, 0x8d63, 0x8d64, 0x8d65, 0x8d66, 0x8d67, + 0x8d68, 0x8d69, 0x8d6a, 0x8d6b, 0x8d6c, 0x8d6d, 0x8d6e, 0x8d6f, + 0x8d70, 0x8d71, 0x8d72, 0x8d73, 0x8d74, 0x8d75, 0x8d76, 0x8d77, + 0x8d78, 0x8d79, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, 0x8d7e, 0x8da1, + 0x8da2, 0x8da3, 0x8da4, 0x8da5, 0x8da6, 0x8da7, 0x8da8, 0x8da9, + 0x8daa, 0x8dab, 0x8dac, 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db1, + 0x8db2, 0x8db3, 0x8db4, 0x8db5, 0x8db6, 0x8db7, 0x8db8, 0x8db9, + 0x8dba, 0x8dbb, 0x8dbc, 0x8dbd, 0x8dbe, 0x8dbf, 0x8dc0, 0x8dc1, + 0x8dc2, 0x8dc3, 0x8dc4, 0x8dc5, 0x8dc6, 0x8dc7, 0x8dc8, 0x8dc9, + 0x8dca, 0x8dcb, 0x8dcc, 0x8dcd, 0x8dce, 0x8dcf, 0x8dd0, 0x8dd1, + 0x8dd2, 0x8dd3, 0x8dd4, 0x8dd5, 0x8dd6, 0x8dd7, 0x8dd8, 0x8dd9, + 0x8dda, 0x8ddb, 0x8ddc, 0x8ddd, 0x8dde, 0x8ddf, 0x8de0, 0x8de1, + 0x8de2, 0x8de3, 0x8de4, 0x8de5, 0x8de6, 0x8de7, 0x8de8, 0x8de9, + 0x8dea, 0x8deb, 0x8dec, 0x8ded, 0x8dee, 0x8def, 0x8df0, 0x8df1, + 0x8df2, 0x8df3, 0x8df4, 0x8df5, 0x8df6, 0x8df7, 0x8df8, 0x8df9, + 0x8dfa, 0x8dfb, 0x8dfc, 0x8dfd, 0x8dfe, 0xc6a1, 0xc6a2, 0xc6a3, + 0xc6a4, 0xc6a5, 0xc6a6, 0xc6a7, 0xc6a8, 0xc6a9, 0xc6aa, 0xc6ab, + 0xc6ac, 0xc6ad, 0xc6ae, 0xc6af, 0xc6b0, 0xc6b1, 0xc6b2, 0xc6b3, + 0xc6b4, 0xc6b5, 0xc6b6, 0xc6b7, 0xc6b8, 0xc6b9, 0xc6ba, 0xc6bb, + 0xc6bc, 0xc6bd, 0xc6be, 0xc6bf, 0xc6c0, 0xc6c1, 0xc6c2, 0xc6c3, + 0xc6c4, 0xc6c5, 0xc6c6, 0xc6c7, 0xc6c8, 0xc6c9, 0xc6ca, 0xc6cb, + 0xc6cc, 0xc6cd, 0xc6ce, 0xc6cf, 0xc6d0, 0xc6d1, 0xc6d2, 0xc6d3, + 0xc6d4, 0xc6d5, 0xc6d6, 0xc6d7, 0xc6d8, 0xc6d9, 0xc6da, 0xc6db, + 0xc6dc, 0xc6dd, 0xc6de, 0xc6df, 0xc6e0, 0xc6e1, 0xc6e2, 0xc6e3, + 0xc6e4, 0xc6e5, 0xc6e6, 0xc6e7, 0xc6e8, 0xc6e9, 0xc6ea, 0xc6eb, + 0xc6ec, 0xc6ed, 0xc6ee, 0xc6ef, 0xc6f0, 0xc6f1, 0xc6f2, 0xc6f3, + 0xc6f4, 0xc6f5, 0xc6f6, 0xc6f7, 0xc6f8, 0xc6f9, 0xc6fa, 0xc6fb, + 0xc6fc, 0xc6fd, 0xc6fe, 0xc740, 0xc741, 0xc742, 0xc743, 0xc744, + 0xc745, 0xc746, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xc74c, + 0xc74d, 0xc74e, 0xc74f, 0xc750, 0xc751, 0xc752, 0xc753, 0xc754, + 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xc75b, 0xc75c, + 0xc75d, 0xc75e, 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xc764, + 0xc765, 0xc766, 0xc767, 0xc768, 0xc769, 0xc76a, 0xc76b, 0xc76c, + 0xc76d, 0xc76e, 0xc76f, 0xc770, 0xc771, 0xc772, 0xc773, 0xc774, + 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, 0xc77c, + 0xc77d, 0xc77e, 0xc7a1, 0xc7a2, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, + 0xc7a7, 0xc7a8, 0xc7a9, 0xc7aa, 0xc7ab, 0xc7ac, 0xc7ad, 0xc7ae, + 0xc7af, 0xc7b0, 0xc7b1, 0xc7b2, 0xc7b3, 0xc7b4, 0xc7b5, 0xc7b6, + 0xc7b7, 0xc7b8, 0xc7b9, 0xc7ba, 0xc7bb, 0xc7bc, 0xc7bd, 0xc7be, + 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c2, 0xc7c3, 0xc7c4, 0xc7c5, 0xc7c6, + 0xc7c7, 0xc7c8, 0xc7c9, 0xc7ca, 0xc7cb, 0xc7cc, 0xc7cd, 0xc7ce, + 0xc7cf, 0xc7d0, 0xc7d1, 0xc7d2, 0xc7d3, 0xc7d4, 0xc7d5, 0xc7d6, + 0xc7d7, 0xc7d8, 0xc7d9, 0xc7da, 0xc7db, 0xc7dc, 0xc7dd, 0xc7de, + 0xc7df, 0xc7e0, 0xc7e1, 0xc7e2, 0xc7e3, 0xc7e4, 0xc7e5, 0xc7e6, + 0xc7e7, 0xc7e8, 0xc7e9, 0xc7ea, 0xc7eb, 0xc7ec, 0xc7ed, 0xc7ee, + 0xc7ef, 0xc7f0, 0xc7f1, 0xc7f2, 0xc7f3, 0xc7f4, 0xc7f5, 0xc7f6, + 0xc7f7, 0xc7f8, 0xc7f9, 0xc7fa, 0xc7fb, 0xc7fc, 0xc7fd, 0xc7fe, + 0xc840, 0xc841, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, 0xc847, + 0xc848, 0xc849, 0xc84a, 0xc84b, 0xc84c, 0xc84d, 0xc84e, 0xc84f, + 0xc850, 0xc851, 0xc852, 0xc853, 0xc854, 0xc855, 0xc856, 0xc857, + 0xc858, 0xc859, 0xc85a, 0xc85b, 0xc85c, 0xc85d, 0xc85e, 0xc85f, + 0xc860, 0xc861, 0xc862, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, + 0xc868, 0xc869, 0xc86a, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, + 0xc870, 0xc871, 0xc872, 0xc873, 0xc874, 0xc875, 0xc876, 0xc877, + 0xc878, 0xc879, 0xc87a, 0xc87b, 0xc87c, 0xc87d, 0xc87e, 0xc8a1, + 0xc8a2, 0xc8a3, 0xc8a4, 0xc8a5, 0xc8a6, 0xc8a7, 0xc8a8, 0xc8a9, + 0xc8aa, 0xc8ab, 0xc8ac, 0xc8ad, 0xc8ae, 0xc8af, 0xc8b0, 0xc8b1, + 0xc8b2, 0xc8b3, 0xc8b4, 0xc8b5, 0xc8b6, 0xc8b7, 0xc8b8, 0xc8b9, + 0xc8ba, 0xc8bb, 0xc8bc, 0xc8bd, 0xc8be, 0xc8bf, 0xc8c0, 0xc8c1, + 0xc8c2, 0xc8c3, 0xc8c4, 0xc8c5, 0xc8c6, 0xc8c7, 0xc8c8, 0xc8c9, + 0xc8ca, 0xc8cb, 0xc8cc, 0xc8cd, 0xc8ce, 0xc8cf, 0xc8d0, 0xc8d1, + 0xc8d2, 0xc8d3, 0xc8d4, 0xc8d5, 0xc8d6, 0xc8d7, 0xc8d8, 0xc8d9, + 0xc8da, 0xc8db, 0xc8dc, 0xc8dd, 0xc8de, 0xc8df, 0xc8e0, 0xc8e1, + 0xc8e2, 0xc8e3, 0xc8e4, 0xc8e5, 0xc8e6, 0xc8e7, 0xc8e8, 0xc8e9, + 0xc8ea, 0xc8eb, 0xc8ec, 0xc8ed, 0xc8ee, 0xc8ef, 0xc8f0, 0xc8f1, + 0xc8f2, 0xc8f3, 0xc8f4, 0xc8f5, 0xc8f6, 0xc8f7, 0xc8f8, 0xc8f9, + 0xc8fa, 0xc8fb, 0xc8fc, 0xc8fd, 0xc8fe, 0xb05a, 0xa7f3, 0xa8ae, + 0xb8eb, 0xb7c6, 0xa6ea, 0xa579, 0x8bf8, 0xc074, 0xabb4, 0xaaf7, + 0xb3e2, 0xa960, 0xc369, 0xc4ee, 0xc3b9, 0xc5da, 0xc1b3, 0xbb72, + 0xc5de, 0xbcd6, 0xaca5, 0xaf4f, 0xaf5f, 0xb8a8, 0xb954, 0xc064, + 0xb6c3, 0xa75a, 0xc4e6, 0xc4ea, 0xc4f5, 0xc67d, 0xb450, 0xc0dd, + 0xc2c5, 0xc4b0, 0xa9d4, 0xc3be, 0xc4fa, 0xb459, 0xaed4, 0xaef6, + 0xaf54, 0xa8d3, 0xa74e, 0xb3d2, 0xbedb, 0xc372, 0xc46c, 0xbf63, + 0xa6d1, 0xc4aa, 0xb8b8, 0xb8f4, 0xc553, 0xbe7c, 0xc64f, 0xb84c, + 0xb853, 0xbaf1, 0xdb77, 0xbffd, 0xb3c0, 0xbdd7, 0xc362, 0xa7cb, + 0xc5a2, 0xc5a4, 0xa863, 0xbd55, 0xb8ef, 0xb970, 0xc253, 0xb9f0, + 0xbcd3, 0xb25c, 0xba7c, 0xb2d6, 0xc15c, 0xadae, 0xb0c7, 0xa6d8, + 0xbbfe, 0xade2, 0xb857, 0xbaf0, 0xb5d9, 0xb3ae, 0xc5aa, 0xced4, + 0xbcd6, 0xbfd5, 0xa4a6, 0xb9e7, 0xabe3, 0xb276, 0xb2a7, 0xa55f, + 0xeda8, 0xab4b, 0xb45f, 0xa4a3, 0xaa63, 0xbcc6, 0xafc1, 0xb0d1, + 0xb6eb, 0xacd9, 0xb8ad, 0xbba1, 0xb1fe, 0xa8b0, 0xa848, 0xac42, + 0xad59, 0xb1b0, 0xb2a4, 0xab47, 0xa8e2, 0xb1e7, 0xc2b3, 0xa87d, + 0xbdcc, 0xb671, 0xc079, 0xa766, 0xa46b, 0xc366, 0xaec8, 0xc26f, + 0xc472, 0xbe5b, 0xc67a, 0xc452, 0xbea4, 0xa44f, 0xbee4, 0xbefa, + 0xf765, 0xa67e, 0xbca6, 0xc5ca, 0xbcbf, 0xbaa7, 0xb7d2, 0xe6a3, + 0xbd6d, 0xc170, 0xbdfb, 0xbdac, 0xb373, 0xc1e5, 0xa643, 0xa648, + 0xab7c, 0xaf50, 0xb5f5, 0xbba1, 0xb747, 0xa9c0, 0xb1c9, 0xc0d4, + 0xc3ae, 0xc279, 0xa54f, 0xcbf1, 0xb9e7, 0xc0ad, 0xccb0, 0xacc2, + 0xbcfc, 0xb2dc, 0xb2e2, 0xb961, 0xb973, 0xc646, 0xbbe2, 0xa8d2, + 0xc2a7, 0xc4bf, 0xc1f5, 0xb463, 0xa446, 0xb9b1, 0xbc64, 0xa7bf, + 0xaec6, 0xbcd6, 0xbf52, 0xc0f8, 0xe764, 0xbff1, 0xc073, 0xb777, + 0xa8bf, 0xbc42, 0xccd8, 0xac68, 0xac79, 0xb7c8, 0xaf5b, 0xaf64, + 0xb2b8, 0xafc3, 0xc3fe, 0xa4bb, 0xbcae, 0xb3b0, 0xaddb, 0xb15b, + 0xb25f, 0xbdfc, 0xabdf, 0xb758, 0xaedf, 0xb276, 0xb6a9, 0xa751, + 0xa64f, 0xbc69, 0xa9f6, 0xa7f5, 0xb1f9, 0xaa64, 0xb27a, 0xb567, + 0xbfa9, 0xb8cc, 0xa8bd, 0xc2f7, 0xb0ce, 0xb7c4, 0xa75b, 0xbf4d, + 0xbf5a, 0xc4a9, 0xc5ec, 0xc5ef, 0xaa4c, 0xb24f, 0xc17b, 0xa5df, + 0xb2c1, 0xb2c9, 0xaaac, 0xaaa5, 0xc3d1, 0xa4b0, 0xaff9, 0xa8eb, + 0xa4c1, 0xabd7, 0xa9dd, 0xbf7d, 0xa676, 0xac7d, 0xbcc9, 0xbfe7, + 0xa6e6, 0xadb0, 0xa8a3, 0xb9f8, 0xc94a, 0xddfc, 0xb6ef, 0xb4b8, + 0xe8f9, 0xbdde, 0xaf71, 0xafab, 0xb2bb, 0xbad6, 0xb974, 0xbaeb, + 0xa6d0, 0xbdd1, 0xb668, 0xb3a3, 0xb6ba, 0xb97d, 0xc05d, 0xc562, + 0xa14a, 0xa157, 0xa159, 0xa15b, 0xa15f, 0xa160, 0xa163, 0xa164, + 0xa167, 0xa168, 0xa16b, 0xa16c, 0xa16f, 0xa170, 0xa173, 0xa174, + 0xa177, 0xa178, 0xa17b, 0xa17c, 0xa1c6, 0xa1c7, 0xa1ca, 0xa1cb, + 0xa1c8, 0xa1c9, 0xa15c, 0xa14d, 0xa14e, 0xa14f, 0xa151, 0xa152, + 0xa153, 0xa154, 0xa17d, 0xa17e, 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a4, + 0xa1cc, 0xa1cd, 0xa1ce, 0xa1de, 0xa1df, 0xa1e0, 0xa1e1, 0xa1e2, + 0xa242, 0xa24c, 0xa24d, 0xa24e, 0xa149, 0xc8d0, 0xa1ad, 0xa243, + 0xa248, 0xa1ae, 0xc8cf, 0xa15d, 0xa15e, 0xa1af, 0xa1cf, 0xa141, + 0xa1d0, 0xa144, 0xa1fe, 0xa2af, 0xa2b0, 0xa2b1, 0xa2b2, 0xa2b3, + 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, 0xa147, 0xa146, 0xa1d5, + 0xa1d7, 0xa1d6, 0xa148, 0xa249, 0xa2cf, 0xa2d0, 0xa2d1, 0xa2d2, + 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, 0xa2d9, 0xa2da, + 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, 0xa2e1, 0xa2e2, + 0xa2e3, 0xa2e4, 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xc6e4, 0xa240, + 0xc6e5, 0xa173, 0xa1c4, 0xa1a5, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, + 0xa2ed, 0xa2ee, 0xa2ef, 0xa2f0, 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, + 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, + 0xa2fd, 0xa2fe, 0xa340, 0xa341, 0xa342, 0xa343, 0xa161, 0xa155, + 0xa162, 0xa1e3, 0xa14e, 0xa246, 0xa247, 0xc8cd, 0xa1c3, 0xc8ce, + 0xa244, 0xf9fe, +}; + +static const Summary16 big5hkscs_uni2indx_page00[16] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x81ac }, { 6, 0x01b3 }, + { 12, 0x0703 }, { 17, 0x008c }, { 20, 0x3703 }, { 27, 0x178c }, +}; +static const Summary16 big5hkscs_uni2indx_page02[29] = { + /* 0x0200 */ + { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, + { 56, 0x0000 }, { 56, 0x0813 }, { 60, 0x0402 }, { 62, 0x0020 }, + { 63, 0x0408 }, { 65, 0x0000 }, { 65, 0x0000 }, { 65, 0x0000 }, + { 65, 0x2ec0 }, { 71, 0x0200 }, { 72, 0x0000 }, { 72, 0x0000 }, + /* 0x0300 */ + { 72, 0x0020 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, + { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, { 73, 0x0000 }, + { 73, 0x0000 }, { 73, 0xfffe }, { 88, 0x03fb }, { 97, 0xfffe }, + { 112, 0x03fb }, +}; +static const Summary16 big5hkscs_uni2indx_page20[44] = { + /* 0x2000 */ + { 191, 0x0000 }, { 191, 0x3378 }, { 199, 0x00f4 }, { 204, 0x482c }, + { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, + { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, + { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, + /* 0x2100 */ + { 209, 0x0228 }, { 212, 0x0040 }, { 213, 0x0002 }, { 214, 0x0000 }, + { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x03ff }, { 224, 0x03ff }, + { 234, 0x0000 }, { 234, 0x03cf }, { 242, 0x0000 }, { 242, 0x0300 }, + { 244, 0x0000 }, { 244, 0x0000 }, { 244, 0x0080 }, { 245, 0x0000 }, + /* 0x2200 */ + { 245, 0x0000 }, { 245, 0xc560 }, { 251, 0x4e29 }, { 258, 0x0030 }, + { 260, 0x0000 }, { 260, 0x0004 }, { 261, 0x00cb }, { 266, 0x0000 }, + { 266, 0x0000 }, { 266, 0x0220 }, { 268, 0x0020 }, { 269, 0x8000 }, +}; +static const Summary16 big5hkscs_uni2indx_page25[21] = { + /* 0x2500 */ + { 291, 0x1005 }, { 294, 0x1111 }, { 298, 0x1010 }, { 300, 0x1010 }, + { 302, 0x0000 }, { 302, 0xffff }, { 318, 0xffff }, { 334, 0x001f }, + { 339, 0xfffe }, { 354, 0x0038 }, { 357, 0x0003 }, { 359, 0x300c }, + { 363, 0xc8c0 }, { 368, 0x0000 }, { 368, 0x003c }, { 372, 0x0000 }, + /* 0x2600 */ + { 372, 0x0260 }, { 375, 0x0000 }, { 375, 0x0000 }, { 375, 0x0000 }, + { 375, 0x0007 }, +}; +static const Summary16 big5hkscs_uni2indx_page30[62] = { + /* 0x3000 */ + { 408, 0xffef }, { 423, 0x7037 }, { 431, 0x03fe }, { 440, 0x0001 }, + { 441, 0xfffe }, { 456, 0xffff }, { 472, 0xffff }, { 488, 0xffff }, + { 504, 0xffff }, { 520, 0x780f }, { 528, 0xfffe }, { 543, 0xffff }, + { 559, 0xffff }, { 575, 0xffff }, { 591, 0xffff }, { 607, 0x707f }, + /* 0x3100 */ + { 617, 0xffe0 }, { 628, 0xffff }, { 644, 0x03ff }, { 654, 0x0000 }, + { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, + { 654, 0x0000 }, { 654, 0xfffc }, { 668, 0x0000 }, { 668, 0x0000 }, + { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0x0000 }, + /* 0x3200 */ + { 668, 0x0000 }, { 668, 0x0000 }, { 668, 0xffff }, { 684, 0xffff }, + { 700, 0x000f }, { 704, 0x0000 }, { 704, 0x0000 }, { 704, 0x0000 }, + { 704, 0xffff }, { 720, 0xffff }, { 736, 0xffff }, { 752, 0x0001 }, + { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, + /* 0x3300 */ + { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, + { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, { 753, 0x0000 }, + { 753, 0xc000 }, { 755, 0x7000 }, { 758, 0x0002 }, { 759, 0x0000 }, + { 759, 0x4010 }, { 761, 0x0026 }, +}; +static const Summary16 big5hkscs_uni2indx_page4e[1307] = { + /* 0x4e00 */ + { 1275, 0xff9b }, { 1288, 0xd773 }, { 1299, 0xfd52 }, { 1309, 0xbbcf }, + { 1321, 0xebac }, { 1331, 0xff4c }, { 1342, 0x0600 }, { 1344, 0xc108 }, + { 1348, 0x7bff }, { 1362, 0xcf3e }, { 1373, 0x797f }, { 1385, 0x9ec8 }, + { 1393, 0x6fdf }, { 1406, 0xf7f0 }, { 1417, 0x4f3a }, { 1426, 0xa9ff }, + /* 0x4f00 */ + { 1438, 0xef3f }, { 1451, 0x27bf }, { 1462, 0xb304 }, { 1468, 0xffdd }, + { 1482, 0xfbee }, { 1495, 0xffff }, { 1511, 0xde9f }, { 1523, 0xfffd }, + { 1538, 0xafff }, { 1552, 0x7df7 }, { 1565, 0xc904 }, { 1570, 0xaeed }, + { 1581, 0xffbf }, { 1596, 0xffdb }, { 1610, 0xd033 }, { 1617, 0x67ff }, + /* 0x5000 */ + { 1630, 0xfbe9 }, { 1642, 0xdffe }, { 1656, 0xffef }, { 1671, 0x18bb }, + { 1679, 0xffeb }, { 1693, 0xfdea }, { 1705, 0xff7f }, { 1720, 0x24fd }, + { 1729, 0x79af }, { 1740, 0x7f77 }, { 1753, 0xf04c }, { 1760, 0xfdff }, + { 1775, 0xeff6 }, { 1788, 0xaefb }, { 1800, 0xf7fb }, { 1814, 0xfb7b }, + /* 0x5100 */ + { 1827, 0x7fff }, { 1842, 0x95bf }, { 1853, 0x6e77 }, { 1864, 0xbfbf }, + { 1878, 0x3bfb }, { 1890, 0xfef4 }, { 1902, 0x7faf }, { 1915, 0x13f2 }, + { 1923, 0xa7c5 }, { 1932, 0x55fe }, { 1943, 0x5db5 }, { 1953, 0x73ff }, + { 1966, 0xfff8 }, { 1979, 0xf99f }, { 1991, 0x2017 }, { 1996, 0x777b }, + /* 0x5200 */ + { 2008, 0x5fef }, { 2021, 0xf0cf }, { 2031, 0x47f3 }, { 2041, 0x1dff }, + { 2053, 0x7eda }, { 2064, 0xfef4 }, { 2076, 0xff07 }, { 2087, 0xbfbc }, + { 2099, 0xbf9f }, { 2112, 0x8fdb }, { 2123, 0x7f5b }, { 2135, 0x5a20 }, + { 2140, 0x32af }, { 2149, 0xebef }, { 2162, 0x8a5f }, { 2171, 0xdfbb }, + /* 0x5300 */ + { 2184, 0xef62 }, { 2194, 0xb6e7 }, { 2205, 0xb49f }, { 2215, 0xfb9f }, + { 2228, 0x77bf }, { 2241, 0xf49e }, { 2251, 0xf2db }, { 2262, 0xfbbf }, + { 2276, 0xc414 }, { 2281, 0xf7dc }, { 2293, 0x7ff5 }, { 2306, 0x0a55 }, + { 2312, 0x3f2e }, { 2322, 0x8fd7 }, { 2333, 0xff7f }, { 2348, 0x59ef }, + /* 0x5400 */ + { 2359, 0xffda }, { 2372, 0xff5f }, { 2386, 0xfffb }, { 2401, 0x7bff }, + { 2415, 0xedef }, { 2428, 0x0010 }, { 2429, 0xbfff }, { 2444, 0xfdff }, + { 2459, 0xf9f7 }, { 2472, 0x55ff }, { 2484, 0xffff }, { 2500, 0xffdf }, + { 2515, 0xfbff }, { 2530, 0x4441 }, { 2534, 0xefff }, { 2549, 0xbd8e }, + /* 0x5500 */ + { 2559, 0xfffe }, { 2574, 0x459f }, { 2583, 0xfde8 }, { 2594, 0xdbff }, + { 2608, 0xeffb }, { 2622, 0xf0ef }, { 2633, 0x0e7e }, { 2642, 0xfaee }, + { 2654, 0xffdf }, { 2669, 0xb73f }, { 2681, 0x7ffe }, { 2695, 0x9e3f }, + { 2706, 0xffff }, { 2722, 0xffff }, { 2738, 0x97fe }, { 2750, 0xfee7 }, + /* 0x5600 */ + { 2763, 0xf377 }, { 2775, 0xf8ff }, { 2788, 0xf6af }, { 2800, 0xeffd }, + { 2814, 0xf76f }, { 2827, 0x679d }, { 2837, 0xff7f }, { 2852, 0xdfdf }, + { 2866, 0xfeff }, { 2881, 0xf7ad }, { 2893, 0xfdf2 }, { 2905, 0xf2fe }, + { 2917, 0x3f6f }, { 2929, 0xecda }, { 2939, 0xecb7 }, { 2950, 0xa683 }, + /* 0x5700 */ + { 2957, 0x3f9f }, { 2969, 0xfd7c }, { 2981, 0xf70d }, { 2991, 0xe81d }, + { 2999, 0xfeef }, { 3013, 0x8897 }, { 3020, 0xafd6 }, { 3031, 0xfcff }, + { 3045, 0xbd0d }, { 3054, 0xffb9 }, { 3067, 0x44bf }, { 3076, 0xff70 }, + { 3087, 0xd9de }, { 3098, 0xf0b5 }, { 3107, 0xf2ff }, { 3120, 0x7fff }, + /* 0x5800 */ + { 3135, 0x7fff }, { 3150, 0x7a15 }, { 3158, 0xf7ff }, { 3173, 0xafff }, + { 3187, 0xff91 }, { 3198, 0xffbe }, { 3212, 0xbb3c }, { 3222, 0xfe7e }, + { 3235, 0xcfef }, { 3248, 0xf71f }, { 3260, 0xdfeb }, { 3273, 0xfc6b }, + { 3284, 0xcbe6 }, { 3294, 0xff7f }, { 3309, 0x9b9d }, { 3319, 0xfe1d }, + /* 0x5900 */ + { 3330, 0xf4fc }, { 3341, 0x96f6 }, { 3351, 0xfeb5 }, { 3363, 0x5196 }, + { 3370, 0xc7b1 }, { 3379, 0x15bb }, { 3388, 0x6ea7 }, { 3398, 0xfbff }, + { 3413, 0xe63f }, { 3424, 0xe7dd }, { 3436, 0xd1ff }, { 3448, 0x7fff }, + { 3463, 0xfffb }, { 3478, 0x7f5f }, { 3491, 0xff7b }, { 3505, 0xffff }, + /* 0x5a00 */ + { 3521, 0xbe0f }, { 3531, 0xdfee }, { 3544, 0x7ebb }, { 3556, 0x73e8 }, + { 3565, 0x37ff }, { 3578, 0xffff }, { 3594, 0x7fff }, { 3609, 0xff83 }, + { 3620, 0xdd5e }, { 3631, 0xfeff }, { 3646, 0xdae7 }, { 3657, 0xffff }, + { 3673, 0xffdf }, { 3688, 0xffe8 }, { 3700, 0x7f7f }, { 3714, 0xeffd }, + /* 0x5b00 */ + { 3728, 0xbbae }, { 3739, 0xeefb }, { 3752, 0xfdfb }, { 3766, 0xf115 }, + { 3774, 0xfdfb }, { 3788, 0xbdfb }, { 3801, 0x7b7c }, { 3812, 0xbdff }, + { 3826, 0xdbbf }, { 3839, 0xffed }, { 3853, 0x75fc }, { 3864, 0x8379 }, + { 3872, 0x7cff }, { 3885, 0xc3ff }, { 3897, 0xdfff }, { 3912, 0x856f }, + /* 0x5c00 */ + { 3921, 0xffba }, { 3934, 0xd47f }, { 3945, 0x153d }, { 3953, 0xdf8b }, + { 3964, 0xfff3 }, { 3978, 0x737b }, { 3989, 0xf7bd }, { 4002, 0x5e1a }, + { 4010, 0xbf60 }, { 4019, 0xf63f }, { 4031, 0xffff }, { 4047, 0x05eb }, + { 4055, 0xdfc6 }, { 4066, 0xcfdf }, { 4079, 0xf720 }, { 4087, 0xabf3 }, + /* 0x5d00 */ + { 4098, 0xf8c3 }, { 4107, 0xeff7 }, { 4121, 0xd3fd }, { 4133, 0xf7ff }, + { 4148, 0x5fef }, { 4161, 0x4ae7 }, { 4170, 0x9bac }, { 4179, 0xfe97 }, + { 4191, 0x6ff7 }, { 4204, 0xf6bc }, { 4215, 0xff97 }, { 4228, 0x37f7 }, + { 4240, 0xaacf }, { 4250, 0xe9f6 }, { 4261, 0x49e7 }, { 4270, 0xe2bf }, + /* 0x5e00 */ + { 4281, 0x5e5c }, { 4290, 0xaff6 }, { 4302, 0x6b3f }, { 4313, 0x61d8 }, + { 4320, 0xfd3f }, { 4333, 0xfbb8 }, { 4344, 0xffcf }, { 4358, 0xff7d }, + { 4372, 0xbfdd }, { 4385, 0x1ee4 }, { 4393, 0x7dfd }, { 4406, 0x63ff }, + { 4418, 0x7ff6 }, { 4431, 0xffff }, { 4447, 0xd3ef }, { 4459, 0xdfde }, + /* 0x5f00 */ + { 4472, 0xfdb6 }, { 4484, 0xadbc }, { 4494, 0x63fc }, { 4504, 0x15eb }, + { 4513, 0xff59 }, { 4525, 0x33d3 }, { 4534, 0xbebe }, { 4546, 0xfbdf }, + { 4560, 0x1fef }, { 4572, 0xdbc7 }, { 4583, 0xfff3 }, { 4597, 0xfee6 }, + { 4609, 0xb23f }, { 4619, 0xebf7 }, { 4632, 0xed3b }, { 4643, 0xadba }, + /* 0x6000 */ + { 4653, 0xfe01 }, { 4661, 0x7eff }, { 4675, 0xffff }, { 4691, 0x0abe }, + { 4699, 0x36ff }, { 4711, 0xef3d }, { 4723, 0xfffc }, { 4737, 0xc0a5 }, + { 4743, 0x77fb }, { 4756, 0xfcf5 }, { 4768, 0x019d }, { 4774, 0xffff }, + { 4790, 0xfffb }, { 4805, 0xffba }, { 4818, 0x03df }, { 4827, 0xffff }, + /* 0x6100 */ + { 4843, 0xfffb }, { 4858, 0xbf7d }, { 4871, 0xdb8c }, { 4880, 0xe8d5 }, + { 4889, 0xfff7 }, { 4904, 0xff7d }, { 4918, 0xddff }, { 4932, 0x76ff }, + { 4945, 0x7e8f }, { 4956, 0xbf7f }, { 4970, 0xff96 }, { 4982, 0xd7ff }, + { 4996, 0xbfef }, { 5010, 0xc549 }, { 5017, 0x6ffd }, { 5030, 0xffe7 }, + /* 0x6200 */ + { 5044, 0x779b }, { 5055, 0x8e77 }, { 5065, 0x7ebf }, { 5078, 0xe6dd }, + { 5089, 0x7fcf }, { 5102, 0x5f1f }, { 5113, 0xe17f }, { 5124, 0xfedf }, + { 5138, 0xd7ff }, { 5152, 0x21ff }, { 5162, 0xff50 }, { 5172, 0xfb7b }, + { 5185, 0xfffc }, { 5199, 0x9fff }, { 5213, 0xf820 }, { 5219, 0xffff }, + /* 0x6300 */ + { 5235, 0xfb8f }, { 5247, 0x017b }, { 5254, 0xff00 }, { 5262, 0x7ffe }, + { 5276, 0xffff }, { 5292, 0x07f3 }, { 5301, 0xfbb0 }, { 5311, 0xbfe7 }, + { 5324, 0xffbf }, { 5339, 0xfbd7 }, { 5352, 0xffbf }, { 5367, 0x6203 }, + { 5372, 0xffff }, { 5388, 0xffef }, { 5403, 0xefff }, { 5418, 0x5b7f }, + /* 0x6400 */ + { 5430, 0xfec0 }, { 5439, 0xddfd }, { 5452, 0xfdff }, { 5467, 0xeffd }, + { 5481, 0x680b }, { 5487, 0xff1f }, { 5500, 0xfbe3 }, { 5512, 0xbfff }, + { 5527, 0xbfa4 }, { 5537, 0xf7ef }, { 5551, 0xfa7d }, { 5563, 0xf85f }, + { 5574, 0xeebf }, { 5587, 0x2fdd }, { 5598, 0xbfff }, { 5613, 0xfd9f }, + /* 0x6500 */ + { 5626, 0xf6db }, { 5638, 0xfbfb }, { 5652, 0xfe7f }, { 5666, 0xebfd }, + { 5679, 0xa76a }, { 5688, 0xf3fa }, { 5700, 0xbdfc }, { 5712, 0x9ffc }, + { 5724, 0x1bff }, { 5736, 0xfaf7 }, { 5749, 0xddb7 }, { 5761, 0xfbed }, + { 5774, 0xf87e }, { 5785, 0xecdf }, { 5797, 0xf36f }, { 5809, 0xbc3f }, + /* 0x6600 */ + { 5820, 0xfffd }, { 5835, 0xf13f }, { 5846, 0xe9ff }, { 5859, 0x067f }, + { 5868, 0x9fbe }, { 5880, 0xfe8e }, { 5891, 0xddfe }, { 5904, 0x7fdf }, + { 5918, 0x7ff1 }, { 5930, 0xa7f7 }, { 5942, 0xef17 }, { 5953, 0xefff }, + { 5968, 0xffd1 }, { 5980, 0x7f44 }, { 5989, 0x7b59 }, { 5999, 0xd3df }, + /* 0x6700 */ + { 6011, 0xff3f }, { 6025, 0xebfd }, { 6038, 0x7def }, { 6051, 0xff7a }, + { 6064, 0xfbf0 }, { 6075, 0xf6eb }, { 6087, 0xbc87 }, { 6096, 0xffff }, + { 6112, 0xfafa }, { 6124, 0xb7bf }, { 6137, 0xd011 }, { 6142, 0x8fff }, + { 6155, 0xff7f }, { 6170, 0xffdf }, { 6185, 0xfefc }, { 6198, 0xd7ff }, + /* 0x6800 */ + { 6212, 0x201f }, { 6218, 0xfddd }, { 6231, 0xef67 }, { 6243, 0x7ffe }, + { 6257, 0xffff }, { 6273, 0x207b }, { 6280, 0xe820 }, { 6285, 0xfbf6 }, + { 6298, 0x9fff }, { 6312, 0xb9df }, { 6324, 0xffdf }, { 6339, 0x227f }, + { 6348, 0x7ff8 }, { 6360, 0xf5ff }, { 6374, 0xdfdb }, { 6387, 0x3fff }, + /* 0x6900 */ + { 6401, 0xffff }, { 6417, 0x0fbf }, { 6428, 0x9420 }, { 6432, 0xfbfd }, + { 6446, 0xdf7f }, { 6460, 0xfffe }, { 6475, 0xffff }, { 6491, 0x0fff }, + { 6503, 0x646d }, { 6511, 0xdffb }, { 6525, 0xffff }, { 6541, 0xfaff }, + { 6555, 0xfe5f }, { 6568, 0x027b }, { 6575, 0x7bf6 }, { 6587, 0xffde }, + /* 0x6a00 */ + { 6601, 0xbfff }, { 6616, 0xfffa }, { 6630, 0x39eb }, { 6640, 0xff3c }, + { 6652, 0xfbfb }, { 6666, 0xefff }, { 6681, 0xafff }, { 6695, 0xc452 }, + { 6701, 0xf6bf }, { 6714, 0xfeff }, { 6729, 0xf9ff }, { 6743, 0x6ffe }, + { 6756, 0xbfec }, { 6768, 0xff1b }, { 6780, 0xdda3 }, { 6790, 0x1f4b }, + /* 0x6b00 */ + { 6799, 0x8f3d }, { 6809, 0x67cf }, { 6820, 0xb12b }, { 6828, 0xfffe }, + { 6843, 0x7fee }, { 6856, 0xdaf7 }, { 6868, 0xa4ff }, { 6879, 0xcfd4 }, + { 6889, 0xf75f }, { 6902, 0xcbf2 }, { 6912, 0xecfd }, { 6924, 0xb4ed }, + { 6934, 0xbffb }, { 6948, 0x5ddd }, { 6959, 0x9ddf }, { 6971, 0xff8d }, + /* 0x6c00 */ + { 6983, 0xbb7f }, { 6996, 0xbf7b }, { 7009, 0xddfb }, { 7022, 0xeffb }, + { 7036, 0xfe4f }, { 7048, 0xffb5 }, { 7061, 0xefe3 }, { 7073, 0xef7f }, + { 7087, 0xffff }, { 7103, 0xbf7d }, { 7116, 0xfc04 }, { 7123, 0xffdf }, + { 7138, 0xfeff }, { 7153, 0xfeff }, { 7168, 0xffaf }, { 7182, 0x822f }, + /* 0x6d00 */ + { 7189, 0xffff }, { 7205, 0xefc7 }, { 7217, 0xfff5 }, { 7231, 0xffff }, + { 7247, 0x4007 }, { 7251, 0xdf80 }, { 7259, 0xf7ff }, { 7274, 0xfff7 }, + { 7289, 0xffff }, { 7305, 0x01ff }, { 7314, 0xdc30 }, { 7321, 0xffbe }, + { 7335, 0xbff5 }, { 7348, 0xffff }, { 7364, 0xff7f }, { 7379, 0x7eff }, + /* 0x6e00 */ + { 7393, 0x843d }, { 7400, 0xbf20 }, { 7408, 0xffff }, { 7424, 0xff7f }, + { 7439, 0xeefb }, { 7452, 0xff7f }, { 7467, 0xcbff }, { 7480, 0x13de }, + { 7489, 0xeb40 }, { 7496, 0xffdd }, { 7510, 0xccff }, { 7522, 0xffff }, + { 7538, 0xffff }, { 7554, 0x3f7f }, { 7567, 0xfb04 }, { 7575, 0xfff6 }, + /* 0x6f00 */ + { 7589, 0xffff }, { 7605, 0xd7fc }, { 7617, 0xfeff }, { 7632, 0xffff }, + { 7648, 0xc01b }, { 7654, 0xfdff }, { 7669, 0xfedf }, { 7683, 0xffdd }, + { 7697, 0x7ff7 }, { 7711, 0xe0fd }, { 7721, 0xffff }, { 7737, 0xff7f }, + { 7752, 0xffdf }, { 7767, 0xff38 }, { 7778, 0xfbdf }, { 7792, 0xddd7 }, + /* 0x7000 */ + { 7804, 0xfefb }, { 7818, 0xfff2 }, { 7831, 0x9fdf }, { 7844, 0xdfbf }, + { 7858, 0x3f7f }, { 7871, 0xfdf7 }, { 7885, 0x9fff }, { 7899, 0xf7f3 }, + { 7912, 0xce7e }, { 7923, 0x877e }, { 7933, 0xfafb }, { 7946, 0x7fbb }, + { 7959, 0xfdf1 }, { 7971, 0xf7ff }, { 7986, 0x8017 }, { 7991, 0xfffb }, + /* 0x7100 */ + { 8006, 0x7e75 }, { 8017, 0xfe89 }, { 8027, 0xdb6f }, { 8039, 0x4c7f }, + { 8049, 0xfeff }, { 8064, 0xf75f }, { 8077, 0x5fff }, { 8091, 0x7def }, + { 8104, 0xd7f7 }, { 8117, 0xffd7 }, { 8131, 0xb7bf }, { 8144, 0xf7bf }, + { 8158, 0xcfff }, { 8172, 0xbf77 }, { 8185, 0x79f7 }, { 8197, 0xfb77 }, + /* 0x7200 */ + { 8210, 0xf6ef }, { 8223, 0xeef9 }, { 8235, 0x7fdc }, { 8247, 0xef61 }, + { 8257, 0x9fd7 }, { 8269, 0xffed }, { 8283, 0xd6cf }, { 8294, 0xfbdd }, + { 8307, 0xfbf7 }, { 8321, 0xedff }, { 8335, 0xf7fe }, { 8349, 0xa435 }, + { 8356, 0x7e7f }, { 8369, 0x97d7 }, { 8380, 0x0f5f }, { 8390, 0xffd8 }, + /* 0x7300 */ + { 8402, 0x9d97 }, { 8412, 0x7bcf }, { 8424, 0x7fec }, { 8436, 0xdfff }, + { 8451, 0xf73f }, { 8464, 0xef87 }, { 8475, 0xdfe7 }, { 8488, 0xfdff }, + { 8503, 0xdfff }, { 8518, 0xf1fc }, { 8529, 0x3ff7 }, { 8542, 0xdffc }, + { 8555, 0xffed }, { 8569, 0x7ffd }, { 8583, 0xefff }, { 8598, 0xfff8 }, + /* 0x7400 */ + { 8611, 0x3fff }, { 8625, 0xfef6 }, { 8638, 0xff7f }, { 8653, 0x97ff }, + { 8666, 0xefff }, { 8681, 0xfeff }, { 8696, 0xffbd }, { 8710, 0xf67f }, + { 8723, 0x3fef }, { 8736, 0xdfb5 }, { 8748, 0xaffb }, { 8761, 0xeff7 }, + { 8775, 0x9d2f }, { 8785, 0xfff9 }, { 8799, 0x53ff }, { 8811, 0xe9f7 }, + /* 0x7500 */ + { 8823, 0xf9bd }, { 8835, 0xf7ff }, { 8850, 0xff66 }, { 8862, 0xefbf }, + { 8876, 0xfdc5 }, { 8887, 0xbe3a }, { 8897, 0xfcfd }, { 8910, 0xe7c5 }, + { 8920, 0xfcd9 }, { 8931, 0x6737 }, { 8941, 0x0cbc }, { 8948, 0xff7f }, + { 8963, 0xfdbf }, { 8977, 0xffb7 }, { 8991, 0xa0df }, { 9000, 0xffff }, + /* 0x7600 */ + { 9016, 0xbf8f }, { 9028, 0xfe7b }, { 9041, 0xb3ff }, { 9054, 0x3d3f }, + { 9065, 0xf3cd }, { 9076, 0x97df }, { 9088, 0xf6f7 }, { 9101, 0xff7f }, + { 9116, 0xcfd6 }, { 9127, 0x7e6d }, { 9138, 0xec72 }, { 9147, 0xedb1 }, + { 9157, 0x777c }, { 9168, 0xfe5c }, { 9179, 0xf6fa }, { 9191, 0x5fbf }, + /* 0x7700 */ + { 9204, 0xdfba }, { 9216, 0xee2f }, { 9227, 0xabfd }, { 9239, 0x7ffe }, + { 9253, 0xfcf9 }, { 9265, 0xdf74 }, { 9276, 0xffef }, { 9291, 0xff84 }, + { 9301, 0xfbbf }, { 9315, 0xffaa }, { 9327, 0xbdaf }, { 9339, 0xfeff }, + { 9354, 0xfebc }, { 9366, 0x7fb9 }, { 9378, 0xf3ed }, { 9390, 0x7f9f }, + /* 0x7800 */ + { 9403, 0xf36c }, { 9413, 0xf11f }, { 9423, 0xffef }, { 9438, 0x33bf }, + { 9449, 0x7fbc }, { 9461, 0x701f }, { 9469, 0xff75 }, { 9482, 0xde03 }, + { 9490, 0xf3fb }, { 9503, 0xc7fa }, { 9514, 0xbfbf }, { 9528, 0x5f5f }, + { 9540, 0xffba }, { 9553, 0xedbf }, { 9566, 0xf7bf }, { 9580, 0xfebf }, + /* 0x7900 */ + { 9594, 0x5276 }, { 9602, 0x7a9f }, { 9613, 0xfffa }, { 9627, 0xff7e }, + { 9641, 0x9ff7 }, { 9654, 0xffff }, { 9670, 0x2fbf }, { 9682, 0xf61f }, + { 9693, 0xedcf }, { 9705, 0xbfff }, { 9720, 0x7ff7 }, { 9734, 0xefdf }, + { 9748, 0xfb73 }, { 9760, 0xf176 }, { 9770, 0x7edd }, { 9782, 0x0dd2 }, + /* 0x7a00 */ + { 9789, 0x3d7d }, { 9800, 0xdfbf }, { 9814, 0xed45 }, { 9823, 0xfe83 }, + { 9833, 0x7ff9 }, { 9846, 0x9dd0 }, { 9854, 0x7ba7 }, { 9865, 0xef73 }, + { 9877, 0x9ffb }, { 9890, 0xc3ff }, { 9902, 0xdf0d }, { 9912, 0xddff }, + { 9926, 0x8fbf }, { 9938, 0xbf0a }, { 9947, 0xeefd }, { 9960, 0xeec0 }, + /* 0x7b00 */ + { 9968, 0xdf73 }, { 9980, 0xef1f }, { 9992, 0xfffd }, { 10007, 0x0b3f }, + { 10016, 0xfffd }, { 10031, 0x0177 }, { 10038, 0xf2ff }, { 10051, 0x09ff }, + { 10061, 0xfdb4 }, { 10072, 0x3bf7 }, { 10084, 0xb01f }, { 10092, 0x43b6 }, + { 10100, 0xded3 }, { 10111, 0xff31 }, { 10122, 0x1fff }, { 10135, 0xff9f }, + /* 0x7c00 */ + { 10149, 0xfeef }, { 10163, 0xfa27 }, { 10173, 0x3fef }, { 10186, 0xfba9 }, + { 10197, 0x37bd }, { 10208, 0xbedb }, { 10220, 0xfef9 }, { 10233, 0xff3d }, + { 10246, 0x777b }, { 10258, 0xd1f6 }, { 10268, 0xd1ee }, { 10278, 0xff3e }, + { 10291, 0x7fac }, { 10302, 0xf6ff }, { 10316, 0xf5c5 }, { 10326, 0x7bff }, + /* 0x7d00 */ + { 10340, 0xffff }, { 10356, 0xffff }, { 10372, 0xdb27 }, { 10382, 0xff6f }, + { 10396, 0xe4ff }, { 10408, 0xfd7f }, { 10422, 0xefce }, { 10434, 0xbe0f }, + { 10444, 0xfb7b }, { 10457, 0xf0de }, { 10467, 0xffdf }, { 10482, 0xffbf }, + { 10497, 0xfef7 }, { 10511, 0xff9d }, { 10524, 0xd7fb }, { 10537, 0x6eff }, + /* 0x7e00 */ + { 10550, 0xff88 }, { 10560, 0xfcff }, { 10574, 0xeebf }, { 10587, 0xffff }, + { 10603, 0x13ff }, { 10614, 0xdfff }, { 10629, 0xffaf }, { 10643, 0xfffd }, + { 10658, 0xfdc7 }, { 10670, 0x9ffe }, { 10683, 0x1010 }, { 10685, 0x0400 }, + { 10686, 0x8080 }, { 10688, 0x8000 }, { 10689, 0x0000 }, { 10689, 0x0000 }, + /* 0x7f00 */ + { 10689, 0x0040 }, { 10690, 0x0000 }, { 10690, 0x0000 }, { 10690, 0xe7c0 }, + { 10698, 0xffbb }, { 10712, 0xf93f }, { 10724, 0x7feb }, { 10737, 0xffef }, + { 10752, 0xffe8 }, { 10764, 0x7cfe }, { 10776, 0xf3ff }, { 10790, 0xffff }, + { 10806, 0xfeaf }, { 10819, 0xf8b7 }, { 10830, 0xffef }, { 10845, 0xffbf }, + /* 0x8000 */ + { 10860, 0xf9ff }, { 10874, 0xfbf7 }, { 10888, 0xd773 }, { 10899, 0xfafb }, + { 10912, 0x85c8 }, { 10918, 0x7d57 }, { 10929, 0x90de }, { 10937, 0xe3ef }, + { 10949, 0x9ef5 }, { 10960, 0xbf6d }, { 10972, 0xeeae }, { 10983, 0x35f6 }, + { 10993, 0xf7fc }, { 11006, 0x7ff3 }, { 11019, 0xb27b }, { 11029, 0x7f7f }, + /* 0x8100 */ + { 11043, 0x57ef }, { 11055, 0xeff4 }, { 11067, 0xbebe }, { 11079, 0x6695 }, + { 11087, 0xfddc }, { 11099, 0x5e7f }, { 11111, 0xeaf7 }, { 11123, 0x97df }, + { 11135, 0xbfdd }, { 11148, 0xffa8 }, { 11159, 0x5fed }, { 11171, 0xfeff }, + { 11186, 0xb7ff }, { 11200, 0xefa7 }, { 11212, 0xf7ff }, { 11227, 0xdfdc }, + /* 0x8200 */ + { 11239, 0x3fb7 }, { 11251, 0xfd77 }, { 11264, 0xbf67 }, { 11276, 0xf7fc }, + { 11289, 0xcab5 }, { 11298, 0xdfff }, { 11313, 0xfb7e }, { 11326, 0xfff6 }, + { 11340, 0xecb9 }, { 11350, 0xef1f }, { 11362, 0xffff }, { 11378, 0xfffb }, + { 11393, 0x841d }, { 11399, 0xdbff }, { 11413, 0xfdff }, { 11428, 0xffff }, + /* 0x8300 */ + { 11444, 0x3bff }, { 11457, 0x7fc0 }, { 11466, 0xbff5 }, { 11479, 0xbffe }, + { 11493, 0xffbf }, { 11508, 0x00df }, { 11515, 0x804c }, { 11519, 0xfdf8 }, + { 11531, 0xffea }, { 11544, 0x7fff }, { 11559, 0xdffd }, { 11573, 0xe201 }, + { 11578, 0xffff }, { 11594, 0xfbfa }, { 11607, 0xffbf }, { 11622, 0xff7f }, + /* 0x8400 */ + { 11637, 0xfefa }, { 11650, 0x195f }, { 11659, 0xfa5b }, { 11670, 0xffff }, + { 11686, 0x7ffd }, { 11700, 0xffff }, { 11716, 0xfbff }, { 11731, 0xe7ff }, + { 11745, 0xe145 }, { 11752, 0xffdf }, { 11767, 0xff9f }, { 11781, 0xff57 }, + { 11794, 0xfef7 }, { 11808, 0x4cdf }, { 11818, 0xdfb6 }, { 11830, 0xffdf }, + /* 0x8500 */ + { 11845, 0xffed }, { 11859, 0xf7ff }, { 11874, 0xfffb }, { 11889, 0x691b }, + { 11897, 0x7fff }, { 11912, 0xeffe }, { 11926, 0xffff }, { 11942, 0x5feb }, + { 11954, 0xffff }, { 11970, 0xfff3 }, { 11984, 0x87df }, { 11995, 0xe7fb }, + { 12008, 0xebff }, { 12022, 0xf7e7 }, { 12035, 0xff7f }, { 12050, 0xffc7 }, + /* 0x8600 */ + { 12063, 0xbef7 }, { 12076, 0xdfd3 }, { 12088, 0xf7ff }, { 12103, 0xdf7e }, + { 12116, 0x79ed }, { 12127, 0xda7d }, { 12138, 0xffbe }, { 12152, 0x5e9f }, + { 12163, 0x7ce0 }, { 12171, 0x77ff }, { 12185, 0xa7bf }, { 12197, 0xffff }, + { 12213, 0x1bff }, { 12225, 0xffdb }, { 12239, 0xbf5c }, { 12250, 0x4fe0 }, + /* 0x8700 */ + { 12258, 0x7fff }, { 12273, 0x5f0e }, { 12282, 0x77ff }, { 12296, 0xddbf }, + { 12309, 0xf04f }, { 12318, 0xffff }, { 12334, 0xffff }, { 12350, 0x2ffb }, + { 12362, 0xbbfe }, { 12375, 0xfddf }, { 12389, 0xfe3c }, { 12400, 0xffff }, + { 12416, 0x5f7f }, { 12429, 0xffde }, { 12443, 0xfdff }, { 12458, 0xdefc }, + /* 0x8800 */ + { 12470, 0xbf7f }, { 12484, 0xbbfb }, { 12497, 0xffff }, { 12513, 0xfbef }, + { 12527, 0xfd7f }, { 12541, 0x6eec }, { 12551, 0xefbf }, { 12565, 0xf2f7 }, + { 12577, 0xfb9f }, { 12590, 0xdfef }, { 12604, 0x5d97 }, { 12614, 0xf7f6 }, + { 12627, 0xfea7 }, { 12639, 0xfff5 }, { 12653, 0xd9c2 }, { 12661, 0xffff }, + /* 0x8900 */ + { 12677, 0x5ee7 }, { 12688, 0xc7ff }, { 12701, 0xfefe }, { 12715, 0x79ef }, + { 12727, 0xbade }, { 12738, 0xffdf }, { 12753, 0xfe7f }, { 12767, 0xdede }, + { 12779, 0x8fef }, { 12791, 0xf9fa }, { 12803, 0xf6fe }, { 12816, 0xf6c4 }, + { 12825, 0x0043 }, { 12828, 0xbe7c }, { 12839, 0x3bff }, { 12852, 0xdddf }, + /* 0x8a00 */ + { 12865, 0xd59d }, { 12875, 0xf9ef }, { 12888, 0x3eac }, { 12897, 0xff53 }, + { 12909, 0xf773 }, { 12921, 0x4bf7 }, { 12932, 0x7bcf }, { 12944, 0xdeff }, + { 12958, 0xb8fe }, { 12969, 0x577f }, { 12981, 0x8ffb }, { 12993, 0xff55 }, + { 13005, 0xabfd }, { 13017, 0xfffe }, { 13032, 0xedd7 }, { 13044, 0xddff }, + /* 0x8b00 */ + { 13058, 0xfdf7 }, { 13072, 0xffff }, { 13088, 0xfdfd }, { 13102, 0xfeeb }, + { 13115, 0xffef }, { 13130, 0xf7ff }, { 13145, 0xbfed }, { 13158, 0xef91 }, + { 13168, 0x5d7f }, { 13180, 0xdf7d }, { 13193, 0x0001 }, { 13194, 0x4000 }, + { 13195, 0x0000 }, { 13195, 0x0000 }, { 13195, 0x0004 }, { 13196, 0x0000 }, + /* 0x8c00 */ + { 13196, 0x0000 }, { 13196, 0x0000 }, { 13196, 0x0000 }, { 13196, 0xfa80 }, + { 13203, 0xffee }, { 13217, 0xb4f3 }, { 13227, 0xbf76 }, { 13239, 0x2fef }, + { 13251, 0xb677 }, { 13262, 0xffbf }, { 13277, 0xbfbf }, { 13291, 0xfffd }, + { 13306, 0xb5bf }, { 13318, 0xfefe }, { 13332, 0x7fff }, { 13347, 0x7fbf }, + /* 0x8d00 */ + { 13361, 0xbffd }, { 13375, 0x3bff }, { 13388, 0x0000 }, { 13388, 0x0000 }, + { 13388, 0x0000 }, { 13388, 0x0000 }, { 13388, 0xfbd0 }, { 13398, 0x2fdd }, + { 13409, 0xf637 }, { 13420, 0x9a7f }, { 13431, 0xffeb }, { 13445, 0xd6fc }, + { 13456, 0xf9ef }, { 13469, 0xbffb }, { 13483, 0xdfdf }, { 13497, 0xf41f }, + /* 0x8e00 */ + { 13507, 0xe6ff }, { 13520, 0xffff }, { 13536, 0x6fff }, { 13550, 0xf77b }, + { 13563, 0xfff7 }, { 13578, 0xfef9 }, { 13591, 0xb7ff }, { 13605, 0x5dfe }, + { 13617, 0x7ff7 }, { 13631, 0xe5ff }, { 13644, 0x3ffb }, { 13657, 0x3645 }, + { 13664, 0xfe0d }, { 13674, 0xfd9e }, { 13686, 0xfbf7 }, { 13700, 0xdff6 }, + /* 0x8f00 */ + { 13713, 0x6fef }, { 13726, 0xffff }, { 13742, 0xf679 }, { 13753, 0xcbfd }, + { 13765, 0xefff }, { 13780, 0xffff }, { 13796, 0x40df }, { 13804, 0x0000 }, + { 13804, 0x0000 }, { 13804, 0x9808 }, { 13808, 0xe1e9 }, { 13817, 0xdfff }, + { 13832, 0xfe76 }, { 13844, 0x04ff }, { 13853, 0x6d7f }, { 13865, 0xfff1 }, + /* 0x9000 */ + { 13878, 0xb97f }, { 13890, 0xfef7 }, { 13904, 0xe01f }, { 13912, 0xf1fe }, + { 13924, 0xfe96 }, { 13935, 0x7b7f }, { 13948, 0xfb9f }, { 13961, 0xfffd }, + { 13976, 0xadff }, { 13989, 0xcbb3 }, { 13999, 0xc5ef }, { 14010, 0xe97f }, + { 14022, 0x4dba }, { 14031, 0xbff0 }, { 14042, 0xbf3f }, { 14055, 0xfe3f }, + /* 0x9100 */ + { 14068, 0xebff }, { 14082, 0xffd7 }, { 14096, 0xffdf }, { 14111, 0xcf7f }, + { 14124, 0xfffb }, { 14139, 0xd7ef }, { 14152, 0xd7bf }, { 14165, 0x17fd }, + { 14176, 0xfeff }, { 14191, 0xfe0f }, { 14202, 0xffaf }, { 14216, 0x7eff }, + { 14230, 0xfaff }, { 14244, 0xb7fb }, { 14257, 0x7ffc }, { 14270, 0xe7fa }, + /* 0x9200 */ + { 14282, 0xf7ff }, { 14297, 0x56ff }, { 14309, 0x6dfa }, { 14320, 0xf7ff }, + { 14335, 0xff73 }, { 14348, 0xedff }, { 14362, 0xf8ff }, { 14375, 0xffc5 }, + { 14387, 0xffff }, { 14403, 0x3ffa }, { 14415, 0x5fff }, { 14429, 0xdefe }, + { 14442, 0xffff }, { 14458, 0xebbf }, { 14471, 0xdffb }, { 14485, 0xffdf }, + /* 0x9300 */ + { 14500, 0xfbdf }, { 14514, 0xef7d }, { 14527, 0xffff }, { 14543, 0x137b }, + { 14552, 0xffff }, { 14568, 0xdff7 }, { 14582, 0x7fff }, { 14597, 0x7ffb }, + { 14611, 0xf7ff }, { 14626, 0xfff7 }, { 14641, 0xf7ff }, { 14656, 0xa9bf }, + { 14667, 0xfddd }, { 14680, 0xffff }, { 14696, 0x51df }, { 14706, 0xfffb }, + /* 0x9400 */ + { 14721, 0xffdb }, { 14735, 0x2bff }, { 14747, 0x7ff1 }, { 14759, 0xffef }, + { 14774, 0xbffd }, { 14788, 0x69b7 }, { 14798, 0xffbd }, { 14812, 0xfbff }, + { 14827, 0x002f }, { 14832, 0x8000 }, { 14833, 0x0004 }, { 14834, 0x0000 }, + { 14834, 0x000a }, { 14836, 0x1000 }, { 14837, 0x0000 }, { 14837, 0x0040 }, + /* 0x9500 */ + { 14838, 0x0000 }, { 14838, 0x0000 }, { 14838, 0x2000 }, { 14839, 0x0000 }, + { 14839, 0x0080 }, { 14840, 0x0000 }, { 14840, 0x0000 }, { 14840, 0xbd80 }, + { 14847, 0xfb6d }, { 14859, 0xdbdf }, { 14872, 0x7fff }, { 14887, 0xfee3 }, + { 14899, 0x3fe9 }, { 14910, 0xdc7f }, { 14922, 0x013f }, { 14929, 0x0010 }, + /* 0x9600 */ + { 14930, 0x0000 }, { 14930, 0x7000 }, { 14933, 0xf51f }, { 14944, 0xbf0f }, + { 14955, 0xfc3f }, { 14967, 0xf95b }, { 14978, 0xbe1e }, { 14988, 0x79ff }, + { 15001, 0xeffb }, { 15015, 0x5bfe }, { 15027, 0x57be }, { 15038, 0xbb5b }, + { 15049, 0x7fff }, { 15064, 0xfffc }, { 15078, 0x872e }, { 15086, 0xaff7 }, + /* 0x9700 */ + { 15099, 0xebfd }, { 15112, 0xfb4f }, { 15124, 0xdfff }, { 15139, 0xe767 }, + { 15150, 0x0bdf }, { 15160, 0xfde6 }, { 15172, 0x7747 }, { 15182, 0xfddf }, + { 15196, 0xefbf }, { 15210, 0xff90 }, { 15220, 0x7d7f }, { 15233, 0xefde }, + { 15246, 0xfbff }, { 15261, 0xf3fd }, { 15274, 0x606b }, { 15281, 0xef6f }, + /* 0x9800 */ + { 15294, 0xf5ff }, { 15308, 0xf9ff }, { 15322, 0xebdb }, { 15334, 0x0bbd }, + { 15343, 0xfffa }, { 15357, 0xfb8f }, { 15369, 0x9ffd }, { 15382, 0x003f }, + { 15388, 0x0000 }, { 15388, 0x0000 }, { 15388, 0xf300 }, { 15394, 0xffde }, + { 15408, 0x5fdf }, { 15421, 0xd800 }, { 15425, 0xbeef }, { 15438, 0x7676 }, + /* 0x9900 */ + { 15448, 0x57ad }, { 15458, 0xdfff }, { 15473, 0xffb2 }, { 15485, 0xffaf }, + { 15499, 0x7faf }, { 15512, 0xfbff }, { 15527, 0x000e }, { 15530, 0x0000 }, + { 15530, 0x0000 }, { 15530, 0x7bc0 }, { 15538, 0xfdfa }, { 15551, 0x3f3f }, + { 15563, 0xfabe }, { 15575, 0xbfff }, { 15590, 0x76ff }, { 15603, 0xfff3 }, + /* 0x9a00 */ + { 15617, 0xfefe }, { 15631, 0xfe73 }, { 15643, 0xfeff }, { 15658, 0xfff7 }, + { 15673, 0xf77f }, { 15687, 0xdffd }, { 15701, 0x1ffd }, { 15713, 0x0000 }, + { 15713, 0x8000 }, { 15714, 0x0000 }, { 15714, 0xa900 }, { 15718, 0xffdf }, + { 15733, 0xa4c7 }, { 15741, 0x91ff }, { 15752, 0xf8cf }, { 15763, 0xfede }, + /* 0x9b00 */ + { 15776, 0xff7e }, { 15790, 0xc7f7 }, { 15802, 0xefbd }, { 15815, 0xdebe }, + { 15827, 0xfd7f }, { 15841, 0x8f77 }, { 15852, 0x93d3 }, { 15861, 0xfcf3 }, + { 15873, 0xe9ef }, { 15885, 0xecaf }, { 15896, 0xed77 }, { 15908, 0xa361 }, + { 15915, 0x87db }, { 15925, 0x7ef8 }, { 15936, 0x3ff7 }, { 15949, 0xa193 }, + /* 0x9c00 */ + { 15956, 0x7fe4 }, { 15967, 0xb8bd }, { 15977, 0xbb7b }, { 15989, 0xfefe }, + { 16003, 0xff73 }, { 16016, 0xe3fd }, { 16028, 0x61cd }, { 16036, 0x1fbe }, + { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x0000 }, + { 16047, 0x0000 }, { 16047, 0x0000 }, { 16047, 0x26e0 }, { 16053, 0xbefe }, + /* 0x9d00 */ + { 16066, 0x13fd }, { 16076, 0xebf5 }, { 16088, 0xe36f }, { 16099, 0xebdb }, + { 16111, 0xde3f }, { 16123, 0xffdf }, { 16138, 0xff83 }, { 16149, 0xfbbf }, + { 16163, 0x1fff }, { 16176, 0xffdd }, { 16190, 0xbfff }, { 16205, 0xfffe }, + { 16220, 0xffbf }, { 16235, 0xffff }, { 16251, 0xfb7e }, { 16264, 0xfffd }, + /* 0x9e00 */ + { 16279, 0xfeff }, { 16294, 0xffbf }, { 16309, 0x0000 }, { 16309, 0x0000 }, + { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0x0000 }, { 16309, 0xbe20 }, + { 16316, 0x7fff }, { 16331, 0xffff }, { 16347, 0xfff7 }, { 16362, 0xf8f3 }, + { 16373, 0xf1df }, { 16385, 0xfd7b }, { 16398, 0xe9f5 }, { 16409, 0xffff }, + /* 0x9f00 */ + { 16425, 0xc7c7 }, { 16435, 0x5fed }, { 16447, 0xfffd }, { 16462, 0x6bff }, + { 16475, 0xffff }, { 16491, 0xfffd }, { 16506, 0xdeff }, { 16520, 0xcff7 }, + { 16533, 0x6000 }, { 16535, 0x9337 }, { 16544, 0x0035 }, +}; +static const Summary16 big5hkscs_uni2indx_pagee0[419] = { + /* 0xe000 */ + { 16548, 0xffff }, { 16564, 0xffff }, { 16580, 0xffff }, { 16596, 0xffff }, + { 16612, 0xffff }, { 16628, 0xffff }, { 16644, 0xffff }, { 16660, 0xffff }, + { 16676, 0xffff }, { 16692, 0xffff }, { 16708, 0xffff }, { 16724, 0xffff }, + { 16740, 0xffff }, { 16756, 0xffff }, { 16772, 0xffff }, { 16788, 0xffff }, + /* 0xe100 */ + { 16804, 0xffff }, { 16820, 0xffff }, { 16836, 0xffff }, { 16852, 0xffff }, + { 16868, 0xffff }, { 16884, 0xffff }, { 16900, 0xffff }, { 16916, 0xffff }, + { 16932, 0xffff }, { 16948, 0xffff }, { 16964, 0xffff }, { 16980, 0xffff }, + { 16996, 0xffff }, { 17012, 0xffff }, { 17028, 0xffff }, { 17044, 0xffff }, + /* 0xe200 */ + { 17060, 0xffff }, { 17076, 0xffff }, { 17092, 0xffff }, { 17108, 0xffff }, + { 17124, 0xffff }, { 17140, 0xffff }, { 17156, 0xffff }, { 17172, 0xffff }, + { 17188, 0xffff }, { 17204, 0xffff }, { 17220, 0xffff }, { 17236, 0xffff }, + { 17252, 0xffff }, { 17268, 0xffff }, { 17284, 0xffff }, { 17300, 0xffff }, + /* 0xe300 */ + { 17316, 0xffff }, { 17332, 0xffff }, { 17348, 0xffff }, { 17364, 0xffff }, + { 17380, 0xffff }, { 17396, 0xffff }, { 17412, 0xffff }, { 17428, 0xffff }, + { 17444, 0xffff }, { 17460, 0xffff }, { 17476, 0xffff }, { 17492, 0xffff }, + { 17508, 0xffff }, { 17524, 0xffff }, { 17540, 0xffff }, { 17556, 0xffff }, + /* 0xe400 */ + { 17572, 0xffff }, { 17588, 0xffff }, { 17604, 0xffff }, { 17620, 0xffff }, + { 17636, 0xffff }, { 17652, 0xffff }, { 17668, 0xffff }, { 17684, 0xffff }, + { 17700, 0xffff }, { 17716, 0xffff }, { 17732, 0xffff }, { 17748, 0xffff }, + { 17764, 0xffff }, { 17780, 0xffff }, { 17796, 0xffff }, { 17812, 0xffff }, + /* 0xe500 */ + { 17828, 0xffff }, { 17844, 0xffff }, { 17860, 0xffff }, { 17876, 0xffff }, + { 17892, 0xffff }, { 17908, 0xffff }, { 17924, 0xffff }, { 17940, 0xffff }, + { 17956, 0xffff }, { 17972, 0xffff }, { 17988, 0xffff }, { 18004, 0xffff }, + { 18020, 0xffff }, { 18036, 0xffff }, { 18052, 0xffff }, { 18068, 0xffff }, + /* 0xe600 */ + { 18084, 0xffff }, { 18100, 0xffff }, { 18116, 0xffff }, { 18132, 0xffff }, + { 18148, 0xffff }, { 18164, 0xffff }, { 18180, 0xffff }, { 18196, 0xffff }, + { 18212, 0xffff }, { 18228, 0xffff }, { 18244, 0xffff }, { 18260, 0xffff }, + { 18276, 0xffff }, { 18292, 0xffff }, { 18308, 0xffff }, { 18324, 0xffff }, + /* 0xe700 */ + { 18340, 0xffff }, { 18356, 0xffff }, { 18372, 0xffff }, { 18388, 0xffff }, + { 18404, 0xffff }, { 18420, 0xffff }, { 18436, 0xffff }, { 18452, 0xffff }, + { 18468, 0xffff }, { 18484, 0xffff }, { 18500, 0xffff }, { 18516, 0xffff }, + { 18532, 0xffff }, { 18548, 0xffff }, { 18564, 0xffff }, { 18580, 0xffff }, + /* 0xe800 */ + { 18596, 0xffff }, { 18612, 0xffff }, { 18628, 0xffff }, { 18644, 0xffff }, + { 18660, 0xffff }, { 18676, 0xffff }, { 18692, 0xffff }, { 18708, 0xffff }, + { 18724, 0xffff }, { 18740, 0xffff }, { 18756, 0xffff }, { 18772, 0xffff }, + { 18788, 0xffff }, { 18804, 0xffff }, { 18820, 0xffff }, { 18836, 0xffff }, + /* 0xe900 */ + { 18852, 0xffff }, { 18868, 0xffff }, { 18884, 0xffff }, { 18900, 0xffff }, + { 18916, 0xffff }, { 18932, 0xffff }, { 18948, 0xffff }, { 18964, 0xffff }, + { 18980, 0xffff }, { 18996, 0xffff }, { 19012, 0xffff }, { 19028, 0xffff }, + { 19044, 0xffff }, { 19060, 0xffff }, { 19076, 0xffff }, { 19092, 0xffff }, + /* 0xea00 */ + { 19108, 0xffff }, { 19124, 0xffff }, { 19140, 0xffff }, { 19156, 0xffff }, + { 19172, 0xffff }, { 19188, 0xffff }, { 19204, 0xffff }, { 19220, 0xffff }, + { 19236, 0xffff }, { 19252, 0xffff }, { 19268, 0xffff }, { 19284, 0xffff }, + { 19300, 0xffff }, { 19316, 0xffff }, { 19332, 0xffff }, { 19348, 0xffff }, + /* 0xeb00 */ + { 19364, 0xffff }, { 19380, 0xffff }, { 19396, 0xffff }, { 19412, 0xffff }, + { 19428, 0xffff }, { 19444, 0xffff }, { 19460, 0xffff }, { 19476, 0xffff }, + { 19492, 0xffff }, { 19508, 0xffff }, { 19524, 0xffff }, { 19540, 0xffff }, + { 19556, 0xffff }, { 19572, 0xffff }, { 19588, 0xffff }, { 19604, 0xffff }, + /* 0xec00 */ + { 19620, 0xffff }, { 19636, 0xffff }, { 19652, 0xffff }, { 19668, 0xffff }, + { 19684, 0xffff }, { 19700, 0xffff }, { 19716, 0xffff }, { 19732, 0xffff }, + { 19748, 0xffff }, { 19764, 0xffff }, { 19780, 0xffff }, { 19796, 0xffff }, + { 19812, 0xffff }, { 19828, 0xffff }, { 19844, 0xffff }, { 19860, 0xffff }, + /* 0xed00 */ + { 19876, 0xffff }, { 19892, 0xffff }, { 19908, 0xffff }, { 19924, 0xffff }, + { 19940, 0xffff }, { 19956, 0xffff }, { 19972, 0xffff }, { 19988, 0xffff }, + { 20004, 0xffff }, { 20020, 0xffff }, { 20036, 0xffff }, { 20052, 0xffff }, + { 20068, 0xffff }, { 20084, 0xffff }, { 20100, 0xffff }, { 20116, 0xffff }, + /* 0xee00 */ + { 20132, 0xffff }, { 20148, 0xffff }, { 20164, 0xffff }, { 20180, 0xffff }, + { 20196, 0xffff }, { 20212, 0xffff }, { 20228, 0xffff }, { 20244, 0xffff }, + { 20260, 0xffff }, { 20276, 0xffff }, { 20292, 0xffff }, { 20308, 0xffff }, + { 20324, 0xffff }, { 20340, 0xffff }, { 20356, 0xffff }, { 20372, 0xffff }, + /* 0xef00 */ + { 20388, 0xffff }, { 20404, 0xffff }, { 20420, 0xffff }, { 20436, 0xffff }, + { 20452, 0xffff }, { 20468, 0xffff }, { 20484, 0xffff }, { 20500, 0xffff }, + { 20516, 0xffff }, { 20532, 0xffff }, { 20548, 0xffff }, { 20564, 0xffff }, + { 20580, 0xffff }, { 20596, 0xffff }, { 20612, 0xffff }, { 20628, 0xffff }, + /* 0xf000 */ + { 20644, 0xffff }, { 20660, 0xffff }, { 20676, 0xffff }, { 20692, 0xffff }, + { 20708, 0xffff }, { 20724, 0xffff }, { 20740, 0xffff }, { 20756, 0xffff }, + { 20772, 0xffff }, { 20788, 0xffff }, { 20804, 0xffff }, { 20820, 0xffff }, + { 20836, 0xffff }, { 20852, 0xffff }, { 20868, 0xffff }, { 20884, 0xffff }, + /* 0xf100 */ + { 20900, 0xffff }, { 20916, 0xffff }, { 20932, 0xffff }, { 20948, 0xffff }, + { 20964, 0xffff }, { 20980, 0xffff }, { 20996, 0xffff }, { 21012, 0xffff }, + { 21028, 0xffff }, { 21044, 0xffff }, { 21060, 0xffff }, { 21076, 0xffff }, + { 21092, 0xffff }, { 21108, 0xffff }, { 21124, 0xffff }, { 21140, 0xffff }, + /* 0xf200 */ + { 21156, 0xffff }, { 21172, 0xffff }, { 21188, 0xffff }, { 21204, 0xffff }, + { 21220, 0xffff }, { 21236, 0xffff }, { 21252, 0xffff }, { 21268, 0xffff }, + { 21284, 0xffff }, { 21300, 0xffff }, { 21316, 0xffff }, { 21332, 0xffff }, + { 21348, 0xffff }, { 21364, 0xffff }, { 21380, 0xffff }, { 21396, 0xffff }, + /* 0xf300 */ + { 21412, 0xffff }, { 21428, 0xffff }, { 21444, 0xffff }, { 21460, 0xffff }, + { 21476, 0xffff }, { 21492, 0xffff }, { 21508, 0xffff }, { 21524, 0xffff }, + { 21540, 0xffff }, { 21556, 0xffff }, { 21572, 0xffff }, { 21588, 0xffff }, + { 21604, 0xffff }, { 21620, 0xffff }, { 21636, 0xffff }, { 21652, 0xffff }, + /* 0xf400 */ + { 21668, 0xffff }, { 21684, 0xffff }, { 21700, 0xffff }, { 21716, 0xffff }, + { 21732, 0xffff }, { 21748, 0xffff }, { 21764, 0xffff }, { 21780, 0xffff }, + { 21796, 0xffff }, { 21812, 0xffff }, { 21828, 0xffff }, { 21844, 0xffff }, + { 21860, 0xffff }, { 21876, 0xffff }, { 21892, 0xffff }, { 21908, 0xffff }, + /* 0xf500 */ + { 21924, 0xffff }, { 21940, 0xffff }, { 21956, 0xffff }, { 21972, 0xffff }, + { 21988, 0xffff }, { 22004, 0xffff }, { 22020, 0xffff }, { 22036, 0xffff }, + { 22052, 0xffff }, { 22068, 0xffff }, { 22084, 0xffff }, { 22100, 0xffff }, + { 22116, 0xffff }, { 22132, 0xffff }, { 22148, 0xffff }, { 22164, 0xffff }, + /* 0xf600 */ + { 22180, 0xffff }, { 22196, 0xffff }, { 22212, 0xffff }, { 22228, 0xffff }, + { 22244, 0xffff }, { 22260, 0xffff }, { 22276, 0xffff }, { 22292, 0xffff }, + { 22308, 0xffff }, { 22324, 0xffff }, { 22340, 0xffff }, { 22356, 0xffff }, + { 22372, 0xffff }, { 22388, 0xffff }, { 22404, 0xffff }, { 22420, 0xffff }, + /* 0xf700 */ + { 22436, 0xffff }, { 22452, 0xffff }, { 22468, 0xffff }, { 22484, 0xffff }, + { 22500, 0xffff }, { 22516, 0xffff }, { 22532, 0xffff }, { 22548, 0xffff }, + { 22564, 0xffff }, { 22580, 0xffff }, { 22596, 0xffff }, { 22612, 0xffff }, + { 22628, 0xffff }, { 22644, 0xffff }, { 22660, 0xffff }, { 22676, 0xffff }, + /* 0xf800 */ + { 22692, 0xffff }, { 22708, 0xffff }, { 22724, 0xffff }, { 22740, 0xffff }, + { 22756, 0x01ff }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, + { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, + { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, { 22765, 0x0000 }, + /* 0xf900 */ + { 22765, 0xffff }, { 22781, 0xffff }, { 22797, 0xefff }, { 22812, 0xffff }, + { 22828, 0xffff }, { 22844, 0xffff }, { 22860, 0xffff }, { 22876, 0xfdff }, + { 22891, 0xffff }, { 22907, 0xffdf }, { 22922, 0xffff }, { 22938, 0xffff }, + { 22954, 0xffff }, { 22970, 0xffff }, { 22986, 0xff7f }, { 23001, 0xfffd }, + /* 0xfa00 */ + { 23016, 0x3fff }, { 23030, 0x7ee5 }, { 23041, 0x3c64 }, +}; +static const Summary16 big5hkscs_uni2indx_pagefe[31] = { + /* 0xfe00 */ + { 23048, 0x0000 }, { 23048, 0x0000 }, { 23048, 0x0000 }, { 23048, 0xfffb }, + { 23063, 0xfe1f }, { 23075, 0xfef7 }, { 23089, 0x0f7f }, { 23100, 0x0000 }, + { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, + { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, { 23100, 0x0000 }, + /* 0xff00 */ + { 23100, 0xfffe }, { 23115, 0xffff }, { 23131, 0xffff }, { 23147, 0xffff }, + { 23163, 0xffff }, { 23179, 0x7fff }, { 23194, 0x0010 }, { 23195, 0x0000 }, + { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x0000 }, + { 23195, 0x0000 }, { 23195, 0x0000 }, { 23195, 0x203f }, +}; + +static int +big5hkscs_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc >= 0x0000 && wc < 0x0100) + summary = &big5hkscs_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x0200 && wc < 0x03d0) + summary = &big5hkscs_uni2indx_page02[(wc>>4)-0x020]; + else if (wc >= 0x2000 && wc < 0x22c0) + summary = &big5hkscs_uni2indx_page20[(wc>>4)-0x200]; + else if (wc >= 0x2500 && wc < 0x2650) + summary = &big5hkscs_uni2indx_page25[(wc>>4)-0x250]; + else if (wc >= 0x3000 && wc < 0x33e0) + summary = &big5hkscs_uni2indx_page30[(wc>>4)-0x300]; + else if (wc >= 0x4e00 && wc < 0x9fb0) + summary = &big5hkscs_uni2indx_page4e[(wc>>4)-0x4e0]; + else if (wc >= 0xe000 && wc < 0xfa30) + summary = &big5hkscs_uni2indx_pagee0[(wc>>4)-0xe00]; + else if (wc >= 0xfe00 && wc < 0xfff0) + summary = &big5hkscs_uni2indx_pagefe[(wc>>4)-0xfe0]; + if (summary) { + unsigned short used = summary->used; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = big5hkscs_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} + diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/cp1133.h b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1133.h new file mode 100644 index 000000000..cf79b7aa1 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1133.h @@ -0,0 +1,91 @@ + +/* + * IBM-CP1133 + */ + +static const unsigned short cp1133_2uni_1[64] = { + /* 0xa0 */ + 0x00a0, 0x0e81, 0x0e82, 0x0e84, 0x0e87, 0x0e88, 0x0eaa, 0x0e8a, + 0x0e8d, 0x0e94, 0x0e95, 0x0e96, 0x0e97, 0x0e99, 0x0e9a, 0x0e9b, + /* 0xb0 */ + 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, 0x0ea1, 0x0ea2, 0x0ea3, 0x0ea5, + 0x0ea7, 0x0eab, 0x0ead, 0x0eae, 0xfffd, 0xfffd, 0xfffd, 0x0eaf, + /* 0xc0 */ + 0x0eb0, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, 0x0eb8, + 0x0eb9, 0x0ebc, 0x0eb1, 0x0ebb, 0x0ebd, 0xfffd, 0xfffd, 0xfffd, + /* 0xd0 */ + 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0x0ec8, 0x0ec9, 0x0eca, + 0x0ecb, 0x0ecc, 0x0ecd, 0x0ec6, 0xfffd, 0x0edc, 0x0edd, 0x20ad, +}; +static const unsigned short cp1133_2uni_2[16] = { + /* 0xf0 */ + 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, + 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x00a2, 0x00ac, 0x00a6, 0xfffd, +}; + +static int +cp1133_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) { + *pwc = (ucs4_t) c; + return 1; + } + else if (c < 0xe0) { + unsigned short wc = cp1133_2uni_1[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + else if (c < 0xf0) { + } + else { + unsigned short wc = cp1133_2uni_2[c-0xf0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char cp1133_page00[16] = { + 0xa0, 0x00, 0xfc, 0x00, 0x00, 0x00, 0xfe, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ +}; +static const unsigned char cp1133_page0e[96] = { + 0x00, 0xa1, 0xa2, 0x00, 0xa3, 0x00, 0x00, 0xa4, /* 0x80-0x87 */ + 0xa5, 0x00, 0xa7, 0x00, 0x00, 0xa8, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0xa9, 0xaa, 0xab, 0xac, /* 0x90-0x97 */ + 0x00, 0xad, 0xae, 0xaf, 0xb0, 0xb1, 0xb2, 0xb3, /* 0x98-0x9f */ + 0x00, 0xb4, 0xb5, 0xb6, 0x00, 0xb7, 0x00, 0xb8, /* 0xa0-0xa7 */ + 0x00, 0x00, 0xa6, 0xb9, 0x00, 0xba, 0xbb, 0xbf, /* 0xa8-0xaf */ + 0xc0, 0xca, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, /* 0xb0-0xb7 */ + 0xc7, 0xc8, 0x00, 0xcb, 0xc9, 0xcc, 0x00, 0x00, /* 0xb8-0xbf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xdb, 0x00, /* 0xc0-0xc7 */ + 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0x00, 0x00, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0x00, 0x00, 0xdd, 0xde, 0x00, 0x00, /* 0xd8-0xdf */ +}; + +static int +cp1133_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00b0) + c = cp1133_page00[wc-0x00a0]; + else if (wc >= 0x0e80 && wc < 0x0ee0) + c = cp1133_page0e[wc-0x0e80]; + else if (wc == 0x20ad) + c = 0xdf; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/cp1251.h b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1251.h new file mode 100644 index 000000000..8c0847a0c --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1251.h @@ -0,0 +1,112 @@ + +/* + * CP1251 + */ + +static const unsigned short cp1251_2uni[128] = { + /* 0x80 */ + 0x0402, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, + 0x20ac, 0x2030, 0x0409, 0x2039, 0x040a, 0x040c, 0x040b, 0x040f, + /* 0x90 */ + 0x0452, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0xfffd, 0x2122, 0x0459, 0x203a, 0x045a, 0x045c, 0x045b, 0x045f, + /* 0xa0 */ + 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, + 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, + 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, + /* 0xc0 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + /* 0xd0 */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + /* 0xe0 */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + /* 0xf0 */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, +}; + +static int +cp1251_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = cp1251_2uni[c-0x80]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char cp1251_page00[32] = { + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ +}; +static const unsigned char cp1251_page04[152] = { + 0x00, 0xa8, 0x80, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ + 0xa3, 0x8a, 0x8c, 0x8e, 0x8d, 0x00, 0xa1, 0x8f, /* 0x08-0x0f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ + 0x00, 0xb8, 0x90, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ + 0xbc, 0x9a, 0x9c, 0x9e, 0x9d, 0x00, 0xa2, 0x9f, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char cp1251_page20[48] = { + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +cp1251_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00c0) + c = cp1251_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x0498) + c = cp1251_page04[wc-0x0400]; + else if (wc >= 0x2010 && wc < 0x2040) + c = cp1251_page20[wc-0x2010]; + else if (wc == 0x20ac) + c = 0x88; + else if (wc == 0x2116) + c = 0xb9; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/cp1255.h b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1255.h new file mode 100644 index 000000000..61b2b59d7 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1255.h @@ -0,0 +1,120 @@ + +/* + * CP1255 + */ + +static const unsigned short cp1255_2uni[128] = { + /* 0x80 */ + 0x20ac, 0xfffd, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0xfffd, 0x2039, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x90 */ + 0xfffd, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0xfffd, 0x203a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa0 */ + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20aa, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00bf, + /* 0xc0 */ + 0x05b0, 0x05b1, 0x05b2, 0x05b3, 0x05b4, 0x05b5, 0x05b6, 0x05b7, + 0x05b8, 0x05b9, 0xfffd, 0x05bb, 0x05bc, 0x05bd, 0x05be, 0x05bf, + /* 0xd0 */ + 0x05c0, 0x05c1, 0x05c2, 0x05c3, 0x05f0, 0x05f1, 0x05f2, 0x05f3, + 0x05f4, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xe0 */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, + /* 0xf0 */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, + 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, +}; + +static int +cp1255_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = cp1255_2uni[c-0x80]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char cp1255_page00[88] = { + 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ +}; +static const unsigned char cp1255_page02[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ +}; +static const unsigned char cp1255_page05[72] = { + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xb0-0xb7 */ + 0xc8, 0xc9, 0x00, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xb8-0xbf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ + 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0xd4, 0xd5, 0xd6, 0xd7, 0xd8, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ +}; +static const unsigned char cp1255_page20[56] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +cp1255_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00f8) + c = cp1255_page00[wc-0x00a0]; + else if (wc == 0x0192) + c = 0x83; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = cp1255_page02[wc-0x02c0]; + else if (wc >= 0x05b0 && wc < 0x05f8) + c = cp1255_page05[wc-0x05b0]; + else if (wc >= 0x2008 && wc < 0x2040) + c = cp1255_page20[wc-0x2008]; + else if (wc == 0x20aa) + c = 0xa4; + else if (wc == 0x20ac) + c = 0x80; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/cp1256.h b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1256.h new file mode 100644 index 000000000..72284f4c1 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/cp1256.h @@ -0,0 +1,134 @@ + +/* + * CP1256 + */ + +static const unsigned short cp1256_2uni[128] = { + /* 0x80 */ + 0x20ac, 0x067e, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0679, 0x2039, 0x0152, 0x0686, 0x0698, 0x0688, + /* 0x90 */ + 0x06af, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x06a9, 0x2122, 0x0691, 0x203a, 0x0153, 0x200c, 0x200d, 0x06ba, + /* 0xa0 */ + 0x00a0, 0x060c, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x06be, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x061b, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x061f, + /* 0xc0 */ + 0x06c1, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, + /* 0xd0 */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x00d7, + 0x0637, 0x0638, 0x0639, 0x063a, 0x0640, 0x0641, 0x0642, 0x0643, + /* 0xe0 */ + 0x00e0, 0x0644, 0x00e2, 0x0645, 0x0646, 0x0647, 0x0648, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x0649, 0x064a, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x064b, 0x064c, 0x064d, 0x064e, 0x00f4, 0x064f, 0x0650, 0x00f7, + 0x0651, 0x00f9, 0x0652, 0x00fb, 0x00fc, 0x200e, 0x200f, 0x06d2, +}; + +static int +cp1256_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) cp1256_2uni[c-0x80]; + return 1; +} + +static const unsigned char cp1256_page00[96] = { + 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd7, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0xe0, 0x00, 0xe2, 0x00, 0x00, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0x00, 0x00, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0xf4, 0x00, 0x00, 0xf7, /* 0xf0-0xf7 */ + 0x00, 0xf9, 0x00, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; +static const unsigned char cp1256_page01[72] = { + 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char cp1256_page06[208] = { + 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0xba, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd8, /* 0x30-0x37 */ + 0xd9, 0xda, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0xdc, 0xdd, 0xde, 0xdf, 0xe1, 0xe3, 0xe4, 0xe5, /* 0x40-0x47 */ + 0xe6, 0xec, 0xed, 0xf0, 0xf1, 0xf2, 0xf3, 0xf5, /* 0x48-0x4f */ + 0xf6, 0xf8, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x8a, 0x00, 0x00, 0x00, 0x00, 0x81, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x00, /* 0x80-0x87 */ + 0x8f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x8e, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x98, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x9f, 0x00, 0x00, 0x00, 0xaa, 0x00, /* 0xb8-0xbf */ + 0x00, 0xc0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ +}; +static const unsigned char cp1256_page20[56] = { + 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0xfd, 0xfe, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +cp1256_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0100) + c = cp1256_page00[wc-0x00a0]; + else if (wc >= 0x0150 && wc < 0x0198) + c = cp1256_page01[wc-0x0150]; + else if (wc == 0x02c6) + c = 0x88; + else if (wc >= 0x0608 && wc < 0x06d8) + c = cp1256_page06[wc-0x0608]; + else if (wc >= 0x2008 && wc < 0x2040) + c = cp1256_page20[wc-0x2008]; + else if (wc == 0x20ac) + c = 0x80; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/gb2312.h b/nx-X11/lib/src/xlibi18n/lcUniConv/gb2312.h new file mode 100644 index 000000000..2eec308d2 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/gb2312.h @@ -0,0 +1,2552 @@ + +/* + * GB2312.1980-0 + */ + +static const unsigned short gb2312_2uni_page21[831] = { + /* 0x21 */ + 0x3000, 0x3001, 0x3002, 0x30fb, 0x02c9, 0x02c7, 0x00a8, 0x3003, + 0x3005, 0x2015, 0xff5e, 0x2016, 0x2026, 0x2018, 0x2019, 0x201c, + 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, + 0x300d, 0x300e, 0x300f, 0x3016, 0x3017, 0x3010, 0x3011, 0x00b1, + 0x00d7, 0x00f7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220f, 0x222a, + 0x2229, 0x2208, 0x2237, 0x221a, 0x22a5, 0x2225, 0x2220, 0x2312, + 0x2299, 0x222b, 0x222e, 0x2261, 0x224c, 0x2248, 0x223d, 0x221d, + 0x2260, 0x226e, 0x226f, 0x2264, 0x2265, 0x221e, 0x2235, 0x2234, + 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xff04, 0x00a4, + 0xffe0, 0xffe1, 0x2030, 0x00a7, 0x2116, 0x2606, 0x2605, 0x25cb, + 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, + 0x203b, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, + /* 0x22 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f, + 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, 0x2497, + 0x2498, 0x2499, 0x249a, 0x249b, 0x2474, 0x2475, 0x2476, 0x2477, + 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, + 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, 0x2487, + 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, + 0x2468, 0x2469, 0xfffd, 0xfffd, 0x3220, 0x3221, 0x3222, 0x3223, + 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0xfffd, 0xfffd, + 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, + 0x2168, 0x2169, 0x216a, 0x216b, 0xfffd, 0xfffd, + /* 0x23 */ + 0xff01, 0xff02, 0xff03, 0xffe5, 0xff05, 0xff06, 0xff07, 0xff08, + 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, + 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, + 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, + 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, + 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, + 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, + 0xff39, 0xff3a, 0xff3b, 0xff3c, 0xff3d, 0xff3e, 0xff3f, 0xff40, + 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, + 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, + 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, + 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, + /* 0x24 */ + 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, + 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, + 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, + 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, + 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, + 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, + 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, + 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, + 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, + 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x25 */ + 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, + 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, + 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, + 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, + 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, + 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, + 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, + 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, + 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, + 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, + 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x26 */ + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, + 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, + 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, + 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, + 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x27 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, + 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, + 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, + 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, + 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, + 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, + 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x28 */ + 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0113, 0x00e9, 0x011b, 0x00e8, + 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, + 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, + 0x00fc, 0x00ea, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3105, 0x3106, 0x3107, 0x3108, + 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, + 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, + 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, + 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, + 0x3129, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x29 */ + 0xfffd, 0xfffd, 0xfffd, 0x2500, 0x2501, 0x2502, 0x2503, 0x2504, + 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250a, 0x250b, 0x250c, + 0x250d, 0x250e, 0x250f, 0x2510, 0x2511, 0x2512, 0x2513, 0x2514, + 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251a, 0x251b, 0x251c, + 0x251d, 0x251e, 0x251f, 0x2520, 0x2521, 0x2522, 0x2523, 0x2524, + 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, + 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, + 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, + 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, + 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, +}; +static const unsigned short gb2312_2uni_page30[6768] = { + /* 0x30 */ + 0x554a, 0x963f, 0x57c3, 0x6328, 0x54ce, 0x5509, 0x54c0, 0x7691, + 0x764c, 0x853c, 0x77ee, 0x827e, 0x788d, 0x7231, 0x9698, 0x978d, + 0x6c28, 0x5b89, 0x4ffa, 0x6309, 0x6697, 0x5cb8, 0x80fa, 0x6848, + 0x80ae, 0x6602, 0x76ce, 0x51f9, 0x6556, 0x71ac, 0x7ff1, 0x8884, + 0x50b2, 0x5965, 0x61ca, 0x6fb3, 0x82ad, 0x634c, 0x6252, 0x53ed, + 0x5427, 0x7b06, 0x516b, 0x75a4, 0x5df4, 0x62d4, 0x8dcb, 0x9776, + 0x628a, 0x8019, 0x575d, 0x9738, 0x7f62, 0x7238, 0x767d, 0x67cf, + 0x767e, 0x6446, 0x4f70, 0x8d25, 0x62dc, 0x7a17, 0x6591, 0x73ed, + 0x642c, 0x6273, 0x822c, 0x9881, 0x677f, 0x7248, 0x626e, 0x62cc, + 0x4f34, 0x74e3, 0x534a, 0x529e, 0x7eca, 0x90a6, 0x5e2e, 0x6886, + 0x699c, 0x8180, 0x7ed1, 0x68d2, 0x78c5, 0x868c, 0x9551, 0x508d, + 0x8c24, 0x82de, 0x80de, 0x5305, 0x8912, 0x5265, + /* 0x31 */ + 0x8584, 0x96f9, 0x4fdd, 0x5821, 0x9971, 0x5b9d, 0x62b1, 0x62a5, + 0x66b4, 0x8c79, 0x9c8d, 0x7206, 0x676f, 0x7891, 0x60b2, 0x5351, + 0x5317, 0x8f88, 0x80cc, 0x8d1d, 0x94a1, 0x500d, 0x72c8, 0x5907, + 0x60eb, 0x7119, 0x88ab, 0x5954, 0x82ef, 0x672c, 0x7b28, 0x5d29, + 0x7ef7, 0x752d, 0x6cf5, 0x8e66, 0x8ff8, 0x903c, 0x9f3b, 0x6bd4, + 0x9119, 0x7b14, 0x5f7c, 0x78a7, 0x84d6, 0x853d, 0x6bd5, 0x6bd9, + 0x6bd6, 0x5e01, 0x5e87, 0x75f9, 0x95ed, 0x655d, 0x5f0a, 0x5fc5, + 0x8f9f, 0x58c1, 0x81c2, 0x907f, 0x965b, 0x97ad, 0x8fb9, 0x7f16, + 0x8d2c, 0x6241, 0x4fbf, 0x53d8, 0x535e, 0x8fa8, 0x8fa9, 0x8fab, + 0x904d, 0x6807, 0x5f6a, 0x8198, 0x8868, 0x9cd6, 0x618b, 0x522b, + 0x762a, 0x5f6c, 0x658c, 0x6fd2, 0x6ee8, 0x5bbe, 0x6448, 0x5175, + 0x51b0, 0x67c4, 0x4e19, 0x79c9, 0x997c, 0x70b3, + /* 0x32 */ + 0x75c5, 0x5e76, 0x73bb, 0x83e0, 0x64ad, 0x62e8, 0x94b5, 0x6ce2, + 0x535a, 0x52c3, 0x640f, 0x94c2, 0x7b94, 0x4f2f, 0x5e1b, 0x8236, + 0x8116, 0x818a, 0x6e24, 0x6cca, 0x9a73, 0x6355, 0x535c, 0x54fa, + 0x8865, 0x57e0, 0x4e0d, 0x5e03, 0x6b65, 0x7c3f, 0x90e8, 0x6016, + 0x64e6, 0x731c, 0x88c1, 0x6750, 0x624d, 0x8d22, 0x776c, 0x8e29, + 0x91c7, 0x5f69, 0x83dc, 0x8521, 0x9910, 0x53c2, 0x8695, 0x6b8b, + 0x60ed, 0x60e8, 0x707f, 0x82cd, 0x8231, 0x4ed3, 0x6ca7, 0x85cf, + 0x64cd, 0x7cd9, 0x69fd, 0x66f9, 0x8349, 0x5395, 0x7b56, 0x4fa7, + 0x518c, 0x6d4b, 0x5c42, 0x8e6d, 0x63d2, 0x53c9, 0x832c, 0x8336, + 0x67e5, 0x78b4, 0x643d, 0x5bdf, 0x5c94, 0x5dee, 0x8be7, 0x62c6, + 0x67f4, 0x8c7a, 0x6400, 0x63ba, 0x8749, 0x998b, 0x8c17, 0x7f20, + 0x94f2, 0x4ea7, 0x9610, 0x98a4, 0x660c, 0x7316, + /* 0x33 */ + 0x573a, 0x5c1d, 0x5e38, 0x957f, 0x507f, 0x80a0, 0x5382, 0x655e, + 0x7545, 0x5531, 0x5021, 0x8d85, 0x6284, 0x949e, 0x671d, 0x5632, + 0x6f6e, 0x5de2, 0x5435, 0x7092, 0x8f66, 0x626f, 0x64a4, 0x63a3, + 0x5f7b, 0x6f88, 0x90f4, 0x81e3, 0x8fb0, 0x5c18, 0x6668, 0x5ff1, + 0x6c89, 0x9648, 0x8d81, 0x886c, 0x6491, 0x79f0, 0x57ce, 0x6a59, + 0x6210, 0x5448, 0x4e58, 0x7a0b, 0x60e9, 0x6f84, 0x8bda, 0x627f, + 0x901e, 0x9a8b, 0x79e4, 0x5403, 0x75f4, 0x6301, 0x5319, 0x6c60, + 0x8fdf, 0x5f1b, 0x9a70, 0x803b, 0x9f7f, 0x4f88, 0x5c3a, 0x8d64, + 0x7fc5, 0x65a5, 0x70bd, 0x5145, 0x51b2, 0x866b, 0x5d07, 0x5ba0, + 0x62bd, 0x916c, 0x7574, 0x8e0c, 0x7a20, 0x6101, 0x7b79, 0x4ec7, + 0x7ef8, 0x7785, 0x4e11, 0x81ed, 0x521d, 0x51fa, 0x6a71, 0x53a8, + 0x8e87, 0x9504, 0x96cf, 0x6ec1, 0x9664, 0x695a, + /* 0x34 */ + 0x7840, 0x50a8, 0x77d7, 0x6410, 0x89e6, 0x5904, 0x63e3, 0x5ddd, + 0x7a7f, 0x693d, 0x4f20, 0x8239, 0x5598, 0x4e32, 0x75ae, 0x7a97, + 0x5e62, 0x5e8a, 0x95ef, 0x521b, 0x5439, 0x708a, 0x6376, 0x9524, + 0x5782, 0x6625, 0x693f, 0x9187, 0x5507, 0x6df3, 0x7eaf, 0x8822, + 0x6233, 0x7ef0, 0x75b5, 0x8328, 0x78c1, 0x96cc, 0x8f9e, 0x6148, + 0x74f7, 0x8bcd, 0x6b64, 0x523a, 0x8d50, 0x6b21, 0x806a, 0x8471, + 0x56f1, 0x5306, 0x4ece, 0x4e1b, 0x51d1, 0x7c97, 0x918b, 0x7c07, + 0x4fc3, 0x8e7f, 0x7be1, 0x7a9c, 0x6467, 0x5d14, 0x50ac, 0x8106, + 0x7601, 0x7cb9, 0x6dec, 0x7fe0, 0x6751, 0x5b58, 0x5bf8, 0x78cb, + 0x64ae, 0x6413, 0x63aa, 0x632b, 0x9519, 0x642d, 0x8fbe, 0x7b54, + 0x7629, 0x6253, 0x5927, 0x5446, 0x6b79, 0x50a3, 0x6234, 0x5e26, + 0x6b86, 0x4ee3, 0x8d37, 0x888b, 0x5f85, 0x902e, + /* 0x35 */ + 0x6020, 0x803d, 0x62c5, 0x4e39, 0x5355, 0x90f8, 0x63b8, 0x80c6, + 0x65e6, 0x6c2e, 0x4f46, 0x60ee, 0x6de1, 0x8bde, 0x5f39, 0x86cb, + 0x5f53, 0x6321, 0x515a, 0x8361, 0x6863, 0x5200, 0x6363, 0x8e48, + 0x5012, 0x5c9b, 0x7977, 0x5bfc, 0x5230, 0x7a3b, 0x60bc, 0x9053, + 0x76d7, 0x5fb7, 0x5f97, 0x7684, 0x8e6c, 0x706f, 0x767b, 0x7b49, + 0x77aa, 0x51f3, 0x9093, 0x5824, 0x4f4e, 0x6ef4, 0x8fea, 0x654c, + 0x7b1b, 0x72c4, 0x6da4, 0x7fdf, 0x5ae1, 0x62b5, 0x5e95, 0x5730, + 0x8482, 0x7b2c, 0x5e1d, 0x5f1f, 0x9012, 0x7f14, 0x98a0, 0x6382, + 0x6ec7, 0x7898, 0x70b9, 0x5178, 0x975b, 0x57ab, 0x7535, 0x4f43, + 0x7538, 0x5e97, 0x60e6, 0x5960, 0x6dc0, 0x6bbf, 0x7889, 0x53fc, + 0x96d5, 0x51cb, 0x5201, 0x6389, 0x540a, 0x9493, 0x8c03, 0x8dcc, + 0x7239, 0x789f, 0x8776, 0x8fed, 0x8c0d, 0x53e0, + /* 0x36 */ + 0x4e01, 0x76ef, 0x53ee, 0x9489, 0x9876, 0x9f0e, 0x952d, 0x5b9a, + 0x8ba2, 0x4e22, 0x4e1c, 0x51ac, 0x8463, 0x61c2, 0x52a8, 0x680b, + 0x4f97, 0x606b, 0x51bb, 0x6d1e, 0x515c, 0x6296, 0x6597, 0x9661, + 0x8c46, 0x9017, 0x75d8, 0x90fd, 0x7763, 0x6bd2, 0x728a, 0x72ec, + 0x8bfb, 0x5835, 0x7779, 0x8d4c, 0x675c, 0x9540, 0x809a, 0x5ea6, + 0x6e21, 0x5992, 0x7aef, 0x77ed, 0x953b, 0x6bb5, 0x65ad, 0x7f0e, + 0x5806, 0x5151, 0x961f, 0x5bf9, 0x58a9, 0x5428, 0x8e72, 0x6566, + 0x987f, 0x56e4, 0x949d, 0x76fe, 0x9041, 0x6387, 0x54c6, 0x591a, + 0x593a, 0x579b, 0x8eb2, 0x6735, 0x8dfa, 0x8235, 0x5241, 0x60f0, + 0x5815, 0x86fe, 0x5ce8, 0x9e45, 0x4fc4, 0x989d, 0x8bb9, 0x5a25, + 0x6076, 0x5384, 0x627c, 0x904f, 0x9102, 0x997f, 0x6069, 0x800c, + 0x513f, 0x8033, 0x5c14, 0x9975, 0x6d31, 0x4e8c, + /* 0x37 */ + 0x8d30, 0x53d1, 0x7f5a, 0x7b4f, 0x4f10, 0x4e4f, 0x9600, 0x6cd5, + 0x73d0, 0x85e9, 0x5e06, 0x756a, 0x7ffb, 0x6a0a, 0x77fe, 0x9492, + 0x7e41, 0x51e1, 0x70e6, 0x53cd, 0x8fd4, 0x8303, 0x8d29, 0x72af, + 0x996d, 0x6cdb, 0x574a, 0x82b3, 0x65b9, 0x80aa, 0x623f, 0x9632, + 0x59a8, 0x4eff, 0x8bbf, 0x7eba, 0x653e, 0x83f2, 0x975e, 0x5561, + 0x98de, 0x80a5, 0x532a, 0x8bfd, 0x5420, 0x80ba, 0x5e9f, 0x6cb8, + 0x8d39, 0x82ac, 0x915a, 0x5429, 0x6c1b, 0x5206, 0x7eb7, 0x575f, + 0x711a, 0x6c7e, 0x7c89, 0x594b, 0x4efd, 0x5fff, 0x6124, 0x7caa, + 0x4e30, 0x5c01, 0x67ab, 0x8702, 0x5cf0, 0x950b, 0x98ce, 0x75af, + 0x70fd, 0x9022, 0x51af, 0x7f1d, 0x8bbd, 0x5949, 0x51e4, 0x4f5b, + 0x5426, 0x592b, 0x6577, 0x80a4, 0x5b75, 0x6276, 0x62c2, 0x8f90, + 0x5e45, 0x6c1f, 0x7b26, 0x4f0f, 0x4fd8, 0x670d, + /* 0x38 */ + 0x6d6e, 0x6daa, 0x798f, 0x88b1, 0x5f17, 0x752b, 0x629a, 0x8f85, + 0x4fef, 0x91dc, 0x65a7, 0x812f, 0x8151, 0x5e9c, 0x8150, 0x8d74, + 0x526f, 0x8986, 0x8d4b, 0x590d, 0x5085, 0x4ed8, 0x961c, 0x7236, + 0x8179, 0x8d1f, 0x5bcc, 0x8ba3, 0x9644, 0x5987, 0x7f1a, 0x5490, + 0x5676, 0x560e, 0x8be5, 0x6539, 0x6982, 0x9499, 0x76d6, 0x6e89, + 0x5e72, 0x7518, 0x6746, 0x67d1, 0x7aff, 0x809d, 0x8d76, 0x611f, + 0x79c6, 0x6562, 0x8d63, 0x5188, 0x521a, 0x94a2, 0x7f38, 0x809b, + 0x7eb2, 0x5c97, 0x6e2f, 0x6760, 0x7bd9, 0x768b, 0x9ad8, 0x818f, + 0x7f94, 0x7cd5, 0x641e, 0x9550, 0x7a3f, 0x544a, 0x54e5, 0x6b4c, + 0x6401, 0x6208, 0x9e3d, 0x80f3, 0x7599, 0x5272, 0x9769, 0x845b, + 0x683c, 0x86e4, 0x9601, 0x9694, 0x94ec, 0x4e2a, 0x5404, 0x7ed9, + 0x6839, 0x8ddf, 0x8015, 0x66f4, 0x5e9a, 0x7fb9, + /* 0x39 */ + 0x57c2, 0x803f, 0x6897, 0x5de5, 0x653b, 0x529f, 0x606d, 0x9f9a, + 0x4f9b, 0x8eac, 0x516c, 0x5bab, 0x5f13, 0x5de9, 0x6c5e, 0x62f1, + 0x8d21, 0x5171, 0x94a9, 0x52fe, 0x6c9f, 0x82df, 0x72d7, 0x57a2, + 0x6784, 0x8d2d, 0x591f, 0x8f9c, 0x83c7, 0x5495, 0x7b8d, 0x4f30, + 0x6cbd, 0x5b64, 0x59d1, 0x9f13, 0x53e4, 0x86ca, 0x9aa8, 0x8c37, + 0x80a1, 0x6545, 0x987e, 0x56fa, 0x96c7, 0x522e, 0x74dc, 0x5250, + 0x5be1, 0x6302, 0x8902, 0x4e56, 0x62d0, 0x602a, 0x68fa, 0x5173, + 0x5b98, 0x51a0, 0x89c2, 0x7ba1, 0x9986, 0x7f50, 0x60ef, 0x704c, + 0x8d2f, 0x5149, 0x5e7f, 0x901b, 0x7470, 0x89c4, 0x572d, 0x7845, + 0x5f52, 0x9f9f, 0x95fa, 0x8f68, 0x9b3c, 0x8be1, 0x7678, 0x6842, + 0x67dc, 0x8dea, 0x8d35, 0x523d, 0x8f8a, 0x6eda, 0x68cd, 0x9505, + 0x90ed, 0x56fd, 0x679c, 0x88f9, 0x8fc7, 0x54c8, + /* 0x3a */ + 0x9ab8, 0x5b69, 0x6d77, 0x6c26, 0x4ea5, 0x5bb3, 0x9a87, 0x9163, + 0x61a8, 0x90af, 0x97e9, 0x542b, 0x6db5, 0x5bd2, 0x51fd, 0x558a, + 0x7f55, 0x7ff0, 0x64bc, 0x634d, 0x65f1, 0x61be, 0x608d, 0x710a, + 0x6c57, 0x6c49, 0x592f, 0x676d, 0x822a, 0x58d5, 0x568e, 0x8c6a, + 0x6beb, 0x90dd, 0x597d, 0x8017, 0x53f7, 0x6d69, 0x5475, 0x559d, + 0x8377, 0x83cf, 0x6838, 0x79be, 0x548c, 0x4f55, 0x5408, 0x76d2, + 0x8c89, 0x9602, 0x6cb3, 0x6db8, 0x8d6b, 0x8910, 0x9e64, 0x8d3a, + 0x563f, 0x9ed1, 0x75d5, 0x5f88, 0x72e0, 0x6068, 0x54fc, 0x4ea8, + 0x6a2a, 0x8861, 0x6052, 0x8f70, 0x54c4, 0x70d8, 0x8679, 0x9e3f, + 0x6d2a, 0x5b8f, 0x5f18, 0x7ea2, 0x5589, 0x4faf, 0x7334, 0x543c, + 0x539a, 0x5019, 0x540e, 0x547c, 0x4e4e, 0x5ffd, 0x745a, 0x58f6, + 0x846b, 0x80e1, 0x8774, 0x72d0, 0x7cca, 0x6e56, + /* 0x3b */ + 0x5f27, 0x864e, 0x552c, 0x62a4, 0x4e92, 0x6caa, 0x6237, 0x82b1, + 0x54d7, 0x534e, 0x733e, 0x6ed1, 0x753b, 0x5212, 0x5316, 0x8bdd, + 0x69d0, 0x5f8a, 0x6000, 0x6dee, 0x574f, 0x6b22, 0x73af, 0x6853, + 0x8fd8, 0x7f13, 0x6362, 0x60a3, 0x5524, 0x75ea, 0x8c62, 0x7115, + 0x6da3, 0x5ba6, 0x5e7b, 0x8352, 0x614c, 0x9ec4, 0x78fa, 0x8757, + 0x7c27, 0x7687, 0x51f0, 0x60f6, 0x714c, 0x6643, 0x5e4c, 0x604d, + 0x8c0e, 0x7070, 0x6325, 0x8f89, 0x5fbd, 0x6062, 0x86d4, 0x56de, + 0x6bc1, 0x6094, 0x6167, 0x5349, 0x60e0, 0x6666, 0x8d3f, 0x79fd, + 0x4f1a, 0x70e9, 0x6c47, 0x8bb3, 0x8bf2, 0x7ed8, 0x8364, 0x660f, + 0x5a5a, 0x9b42, 0x6d51, 0x6df7, 0x8c41, 0x6d3b, 0x4f19, 0x706b, + 0x83b7, 0x6216, 0x60d1, 0x970d, 0x8d27, 0x7978, 0x51fb, 0x573e, + 0x57fa, 0x673a, 0x7578, 0x7a3d, 0x79ef, 0x7b95, + /* 0x3c */ + 0x808c, 0x9965, 0x8ff9, 0x6fc0, 0x8ba5, 0x9e21, 0x59ec, 0x7ee9, + 0x7f09, 0x5409, 0x6781, 0x68d8, 0x8f91, 0x7c4d, 0x96c6, 0x53ca, + 0x6025, 0x75be, 0x6c72, 0x5373, 0x5ac9, 0x7ea7, 0x6324, 0x51e0, + 0x810a, 0x5df1, 0x84df, 0x6280, 0x5180, 0x5b63, 0x4f0e, 0x796d, + 0x5242, 0x60b8, 0x6d4e, 0x5bc4, 0x5bc2, 0x8ba1, 0x8bb0, 0x65e2, + 0x5fcc, 0x9645, 0x5993, 0x7ee7, 0x7eaa, 0x5609, 0x67b7, 0x5939, + 0x4f73, 0x5bb6, 0x52a0, 0x835a, 0x988a, 0x8d3e, 0x7532, 0x94be, + 0x5047, 0x7a3c, 0x4ef7, 0x67b6, 0x9a7e, 0x5ac1, 0x6b7c, 0x76d1, + 0x575a, 0x5c16, 0x7b3a, 0x95f4, 0x714e, 0x517c, 0x80a9, 0x8270, + 0x5978, 0x7f04, 0x8327, 0x68c0, 0x67ec, 0x78b1, 0x7877, 0x62e3, + 0x6361, 0x7b80, 0x4fed, 0x526a, 0x51cf, 0x8350, 0x69db, 0x9274, + 0x8df5, 0x8d31, 0x89c1, 0x952e, 0x7bad, 0x4ef6, + /* 0x3d */ + 0x5065, 0x8230, 0x5251, 0x996f, 0x6e10, 0x6e85, 0x6da7, 0x5efa, + 0x50f5, 0x59dc, 0x5c06, 0x6d46, 0x6c5f, 0x7586, 0x848b, 0x6868, + 0x5956, 0x8bb2, 0x5320, 0x9171, 0x964d, 0x8549, 0x6912, 0x7901, + 0x7126, 0x80f6, 0x4ea4, 0x90ca, 0x6d47, 0x9a84, 0x5a07, 0x56bc, + 0x6405, 0x94f0, 0x77eb, 0x4fa5, 0x811a, 0x72e1, 0x89d2, 0x997a, + 0x7f34, 0x7ede, 0x527f, 0x6559, 0x9175, 0x8f7f, 0x8f83, 0x53eb, + 0x7a96, 0x63ed, 0x63a5, 0x7686, 0x79f8, 0x8857, 0x9636, 0x622a, + 0x52ab, 0x8282, 0x6854, 0x6770, 0x6377, 0x776b, 0x7aed, 0x6d01, + 0x7ed3, 0x89e3, 0x59d0, 0x6212, 0x85c9, 0x82a5, 0x754c, 0x501f, + 0x4ecb, 0x75a5, 0x8beb, 0x5c4a, 0x5dfe, 0x7b4b, 0x65a4, 0x91d1, + 0x4eca, 0x6d25, 0x895f, 0x7d27, 0x9526, 0x4ec5, 0x8c28, 0x8fdb, + 0x9773, 0x664b, 0x7981, 0x8fd1, 0x70ec, 0x6d78, + /* 0x3e */ + 0x5c3d, 0x52b2, 0x8346, 0x5162, 0x830e, 0x775b, 0x6676, 0x9cb8, + 0x4eac, 0x60ca, 0x7cbe, 0x7cb3, 0x7ecf, 0x4e95, 0x8b66, 0x666f, + 0x9888, 0x9759, 0x5883, 0x656c, 0x955c, 0x5f84, 0x75c9, 0x9756, + 0x7adf, 0x7ade, 0x51c0, 0x70af, 0x7a98, 0x63ea, 0x7a76, 0x7ea0, + 0x7396, 0x97ed, 0x4e45, 0x7078, 0x4e5d, 0x9152, 0x53a9, 0x6551, + 0x65e7, 0x81fc, 0x8205, 0x548e, 0x5c31, 0x759a, 0x97a0, 0x62d8, + 0x72d9, 0x75bd, 0x5c45, 0x9a79, 0x83ca, 0x5c40, 0x5480, 0x77e9, + 0x4e3e, 0x6cae, 0x805a, 0x62d2, 0x636e, 0x5de8, 0x5177, 0x8ddd, + 0x8e1e, 0x952f, 0x4ff1, 0x53e5, 0x60e7, 0x70ac, 0x5267, 0x6350, + 0x9e43, 0x5a1f, 0x5026, 0x7737, 0x5377, 0x7ee2, 0x6485, 0x652b, + 0x6289, 0x6398, 0x5014, 0x7235, 0x89c9, 0x51b3, 0x8bc0, 0x7edd, + 0x5747, 0x83cc, 0x94a7, 0x519b, 0x541b, 0x5cfb, + /* 0x3f */ + 0x4fca, 0x7ae3, 0x6d5a, 0x90e1, 0x9a8f, 0x5580, 0x5496, 0x5361, + 0x54af, 0x5f00, 0x63e9, 0x6977, 0x51ef, 0x6168, 0x520a, 0x582a, + 0x52d8, 0x574e, 0x780d, 0x770b, 0x5eb7, 0x6177, 0x7ce0, 0x625b, + 0x6297, 0x4ea2, 0x7095, 0x8003, 0x62f7, 0x70e4, 0x9760, 0x5777, + 0x82db, 0x67ef, 0x68f5, 0x78d5, 0x9897, 0x79d1, 0x58f3, 0x54b3, + 0x53ef, 0x6e34, 0x514b, 0x523b, 0x5ba2, 0x8bfe, 0x80af, 0x5543, + 0x57a6, 0x6073, 0x5751, 0x542d, 0x7a7a, 0x6050, 0x5b54, 0x63a7, + 0x62a0, 0x53e3, 0x6263, 0x5bc7, 0x67af, 0x54ed, 0x7a9f, 0x82e6, + 0x9177, 0x5e93, 0x88e4, 0x5938, 0x57ae, 0x630e, 0x8de8, 0x80ef, + 0x5757, 0x7b77, 0x4fa9, 0x5feb, 0x5bbd, 0x6b3e, 0x5321, 0x7b50, + 0x72c2, 0x6846, 0x77ff, 0x7736, 0x65f7, 0x51b5, 0x4e8f, 0x76d4, + 0x5cbf, 0x7aa5, 0x8475, 0x594e, 0x9b41, 0x5080, + /* 0x40 */ + 0x9988, 0x6127, 0x6e83, 0x5764, 0x6606, 0x6346, 0x56f0, 0x62ec, + 0x6269, 0x5ed3, 0x9614, 0x5783, 0x62c9, 0x5587, 0x8721, 0x814a, + 0x8fa3, 0x5566, 0x83b1, 0x6765, 0x8d56, 0x84dd, 0x5a6a, 0x680f, + 0x62e6, 0x7bee, 0x9611, 0x5170, 0x6f9c, 0x8c30, 0x63fd, 0x89c8, + 0x61d2, 0x7f06, 0x70c2, 0x6ee5, 0x7405, 0x6994, 0x72fc, 0x5eca, + 0x90ce, 0x6717, 0x6d6a, 0x635e, 0x52b3, 0x7262, 0x8001, 0x4f6c, + 0x59e5, 0x916a, 0x70d9, 0x6d9d, 0x52d2, 0x4e50, 0x96f7, 0x956d, + 0x857e, 0x78ca, 0x7d2f, 0x5121, 0x5792, 0x64c2, 0x808b, 0x7c7b, + 0x6cea, 0x68f1, 0x695e, 0x51b7, 0x5398, 0x68a8, 0x7281, 0x9ece, + 0x7bf1, 0x72f8, 0x79bb, 0x6f13, 0x7406, 0x674e, 0x91cc, 0x9ca4, + 0x793c, 0x8389, 0x8354, 0x540f, 0x6817, 0x4e3d, 0x5389, 0x52b1, + 0x783e, 0x5386, 0x5229, 0x5088, 0x4f8b, 0x4fd0, + /* 0x41 */ + 0x75e2, 0x7acb, 0x7c92, 0x6ca5, 0x96b6, 0x529b, 0x7483, 0x54e9, + 0x4fe9, 0x8054, 0x83b2, 0x8fde, 0x9570, 0x5ec9, 0x601c, 0x6d9f, + 0x5e18, 0x655b, 0x8138, 0x94fe, 0x604b, 0x70bc, 0x7ec3, 0x7cae, + 0x51c9, 0x6881, 0x7cb1, 0x826f, 0x4e24, 0x8f86, 0x91cf, 0x667e, + 0x4eae, 0x8c05, 0x64a9, 0x804a, 0x50da, 0x7597, 0x71ce, 0x5be5, + 0x8fbd, 0x6f66, 0x4e86, 0x6482, 0x9563, 0x5ed6, 0x6599, 0x5217, + 0x88c2, 0x70c8, 0x52a3, 0x730e, 0x7433, 0x6797, 0x78f7, 0x9716, + 0x4e34, 0x90bb, 0x9cde, 0x6dcb, 0x51db, 0x8d41, 0x541d, 0x62ce, + 0x73b2, 0x83f1, 0x96f6, 0x9f84, 0x94c3, 0x4f36, 0x7f9a, 0x51cc, + 0x7075, 0x9675, 0x5cad, 0x9886, 0x53e6, 0x4ee4, 0x6e9c, 0x7409, + 0x69b4, 0x786b, 0x998f, 0x7559, 0x5218, 0x7624, 0x6d41, 0x67f3, + 0x516d, 0x9f99, 0x804b, 0x5499, 0x7b3c, 0x7abf, + /* 0x42 */ + 0x9686, 0x5784, 0x62e2, 0x9647, 0x697c, 0x5a04, 0x6402, 0x7bd3, + 0x6f0f, 0x964b, 0x82a6, 0x5362, 0x9885, 0x5e90, 0x7089, 0x63b3, + 0x5364, 0x864f, 0x9c81, 0x9e93, 0x788c, 0x9732, 0x8def, 0x8d42, + 0x9e7f, 0x6f5e, 0x7984, 0x5f55, 0x9646, 0x622e, 0x9a74, 0x5415, + 0x94dd, 0x4fa3, 0x65c5, 0x5c65, 0x5c61, 0x7f15, 0x8651, 0x6c2f, + 0x5f8b, 0x7387, 0x6ee4, 0x7eff, 0x5ce6, 0x631b, 0x5b6a, 0x6ee6, + 0x5375, 0x4e71, 0x63a0, 0x7565, 0x62a1, 0x8f6e, 0x4f26, 0x4ed1, + 0x6ca6, 0x7eb6, 0x8bba, 0x841d, 0x87ba, 0x7f57, 0x903b, 0x9523, + 0x7ba9, 0x9aa1, 0x88f8, 0x843d, 0x6d1b, 0x9a86, 0x7edc, 0x5988, + 0x9ebb, 0x739b, 0x7801, 0x8682, 0x9a6c, 0x9a82, 0x561b, 0x5417, + 0x57cb, 0x4e70, 0x9ea6, 0x5356, 0x8fc8, 0x8109, 0x7792, 0x9992, + 0x86ee, 0x6ee1, 0x8513, 0x66fc, 0x6162, 0x6f2b, + /* 0x43 */ + 0x8c29, 0x8292, 0x832b, 0x76f2, 0x6c13, 0x5fd9, 0x83bd, 0x732b, + 0x8305, 0x951a, 0x6bdb, 0x77db, 0x94c6, 0x536f, 0x8302, 0x5192, + 0x5e3d, 0x8c8c, 0x8d38, 0x4e48, 0x73ab, 0x679a, 0x6885, 0x9176, + 0x9709, 0x7164, 0x6ca1, 0x7709, 0x5a92, 0x9541, 0x6bcf, 0x7f8e, + 0x6627, 0x5bd0, 0x59b9, 0x5a9a, 0x95e8, 0x95f7, 0x4eec, 0x840c, + 0x8499, 0x6aac, 0x76df, 0x9530, 0x731b, 0x68a6, 0x5b5f, 0x772f, + 0x919a, 0x9761, 0x7cdc, 0x8ff7, 0x8c1c, 0x5f25, 0x7c73, 0x79d8, + 0x89c5, 0x6ccc, 0x871c, 0x5bc6, 0x5e42, 0x68c9, 0x7720, 0x7ef5, + 0x5195, 0x514d, 0x52c9, 0x5a29, 0x7f05, 0x9762, 0x82d7, 0x63cf, + 0x7784, 0x85d0, 0x79d2, 0x6e3a, 0x5e99, 0x5999, 0x8511, 0x706d, + 0x6c11, 0x62bf, 0x76bf, 0x654f, 0x60af, 0x95fd, 0x660e, 0x879f, + 0x9e23, 0x94ed, 0x540d, 0x547d, 0x8c2c, 0x6478, + /* 0x44 */ + 0x6479, 0x8611, 0x6a21, 0x819c, 0x78e8, 0x6469, 0x9b54, 0x62b9, + 0x672b, 0x83ab, 0x58a8, 0x9ed8, 0x6cab, 0x6f20, 0x5bde, 0x964c, + 0x8c0b, 0x725f, 0x67d0, 0x62c7, 0x7261, 0x4ea9, 0x59c6, 0x6bcd, + 0x5893, 0x66ae, 0x5e55, 0x52df, 0x6155, 0x6728, 0x76ee, 0x7766, + 0x7267, 0x7a46, 0x62ff, 0x54ea, 0x5450, 0x94a0, 0x90a3, 0x5a1c, + 0x7eb3, 0x6c16, 0x4e43, 0x5976, 0x8010, 0x5948, 0x5357, 0x7537, + 0x96be, 0x56ca, 0x6320, 0x8111, 0x607c, 0x95f9, 0x6dd6, 0x5462, + 0x9981, 0x5185, 0x5ae9, 0x80fd, 0x59ae, 0x9713, 0x502a, 0x6ce5, + 0x5c3c, 0x62df, 0x4f60, 0x533f, 0x817b, 0x9006, 0x6eba, 0x852b, + 0x62c8, 0x5e74, 0x78be, 0x64b5, 0x637b, 0x5ff5, 0x5a18, 0x917f, + 0x9e1f, 0x5c3f, 0x634f, 0x8042, 0x5b7d, 0x556e, 0x954a, 0x954d, + 0x6d85, 0x60a8, 0x67e0, 0x72de, 0x51dd, 0x5b81, + /* 0x45 */ + 0x62e7, 0x6cde, 0x725b, 0x626d, 0x94ae, 0x7ebd, 0x8113, 0x6d53, + 0x519c, 0x5f04, 0x5974, 0x52aa, 0x6012, 0x5973, 0x6696, 0x8650, + 0x759f, 0x632a, 0x61e6, 0x7cef, 0x8bfa, 0x54e6, 0x6b27, 0x9e25, + 0x6bb4, 0x85d5, 0x5455, 0x5076, 0x6ca4, 0x556a, 0x8db4, 0x722c, + 0x5e15, 0x6015, 0x7436, 0x62cd, 0x6392, 0x724c, 0x5f98, 0x6e43, + 0x6d3e, 0x6500, 0x6f58, 0x76d8, 0x78d0, 0x76fc, 0x7554, 0x5224, + 0x53db, 0x4e53, 0x5e9e, 0x65c1, 0x802a, 0x80d6, 0x629b, 0x5486, + 0x5228, 0x70ae, 0x888d, 0x8dd1, 0x6ce1, 0x5478, 0x80da, 0x57f9, + 0x88f4, 0x8d54, 0x966a, 0x914d, 0x4f69, 0x6c9b, 0x55b7, 0x76c6, + 0x7830, 0x62a8, 0x70f9, 0x6f8e, 0x5f6d, 0x84ec, 0x68da, 0x787c, + 0x7bf7, 0x81a8, 0x670b, 0x9e4f, 0x6367, 0x78b0, 0x576f, 0x7812, + 0x9739, 0x6279, 0x62ab, 0x5288, 0x7435, 0x6bd7, + /* 0x46 */ + 0x5564, 0x813e, 0x75b2, 0x76ae, 0x5339, 0x75de, 0x50fb, 0x5c41, + 0x8b6c, 0x7bc7, 0x504f, 0x7247, 0x9a97, 0x98d8, 0x6f02, 0x74e2, + 0x7968, 0x6487, 0x77a5, 0x62fc, 0x9891, 0x8d2b, 0x54c1, 0x8058, + 0x4e52, 0x576a, 0x82f9, 0x840d, 0x5e73, 0x51ed, 0x74f6, 0x8bc4, + 0x5c4f, 0x5761, 0x6cfc, 0x9887, 0x5a46, 0x7834, 0x9b44, 0x8feb, + 0x7c95, 0x5256, 0x6251, 0x94fa, 0x4ec6, 0x8386, 0x8461, 0x83e9, + 0x84b2, 0x57d4, 0x6734, 0x5703, 0x666e, 0x6d66, 0x8c31, 0x66dd, + 0x7011, 0x671f, 0x6b3a, 0x6816, 0x621a, 0x59bb, 0x4e03, 0x51c4, + 0x6f06, 0x67d2, 0x6c8f, 0x5176, 0x68cb, 0x5947, 0x6b67, 0x7566, + 0x5d0e, 0x8110, 0x9f50, 0x65d7, 0x7948, 0x7941, 0x9a91, 0x8d77, + 0x5c82, 0x4e5e, 0x4f01, 0x542f, 0x5951, 0x780c, 0x5668, 0x6c14, + 0x8fc4, 0x5f03, 0x6c7d, 0x6ce3, 0x8bab, 0x6390, + /* 0x47 */ + 0x6070, 0x6d3d, 0x7275, 0x6266, 0x948e, 0x94c5, 0x5343, 0x8fc1, + 0x7b7e, 0x4edf, 0x8c26, 0x4e7e, 0x9ed4, 0x94b1, 0x94b3, 0x524d, + 0x6f5c, 0x9063, 0x6d45, 0x8c34, 0x5811, 0x5d4c, 0x6b20, 0x6b49, + 0x67aa, 0x545b, 0x8154, 0x7f8c, 0x5899, 0x8537, 0x5f3a, 0x62a2, + 0x6a47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77a7, 0x4e54, 0x4fa8, + 0x5de7, 0x9798, 0x64ac, 0x7fd8, 0x5ced, 0x4fcf, 0x7a8d, 0x5207, + 0x8304, 0x4e14, 0x602f, 0x7a83, 0x94a6, 0x4fb5, 0x4eb2, 0x79e6, + 0x7434, 0x52e4, 0x82b9, 0x64d2, 0x79bd, 0x5bdd, 0x6c81, 0x9752, + 0x8f7b, 0x6c22, 0x503e, 0x537f, 0x6e05, 0x64ce, 0x6674, 0x6c30, + 0x60c5, 0x9877, 0x8bf7, 0x5e86, 0x743c, 0x7a77, 0x79cb, 0x4e18, + 0x90b1, 0x7403, 0x6c42, 0x56da, 0x914b, 0x6cc5, 0x8d8b, 0x533a, + 0x86c6, 0x66f2, 0x8eaf, 0x5c48, 0x9a71, 0x6e20, + /* 0x48 */ + 0x53d6, 0x5a36, 0x9f8b, 0x8da3, 0x53bb, 0x5708, 0x98a7, 0x6743, + 0x919b, 0x6cc9, 0x5168, 0x75ca, 0x62f3, 0x72ac, 0x5238, 0x529d, + 0x7f3a, 0x7094, 0x7638, 0x5374, 0x9e4a, 0x69b7, 0x786e, 0x96c0, + 0x88d9, 0x7fa4, 0x7136, 0x71c3, 0x5189, 0x67d3, 0x74e4, 0x58e4, + 0x6518, 0x56b7, 0x8ba9, 0x9976, 0x6270, 0x7ed5, 0x60f9, 0x70ed, + 0x58ec, 0x4ec1, 0x4eba, 0x5fcd, 0x97e7, 0x4efb, 0x8ba4, 0x5203, + 0x598a, 0x7eab, 0x6254, 0x4ecd, 0x65e5, 0x620e, 0x8338, 0x84c9, + 0x8363, 0x878d, 0x7194, 0x6eb6, 0x5bb9, 0x7ed2, 0x5197, 0x63c9, + 0x67d4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5b7a, 0x5982, 0x8fb1, + 0x4e73, 0x6c5d, 0x5165, 0x8925, 0x8f6f, 0x962e, 0x854a, 0x745e, + 0x9510, 0x95f0, 0x6da6, 0x82e5, 0x5f31, 0x6492, 0x6d12, 0x8428, + 0x816e, 0x9cc3, 0x585e, 0x8d5b, 0x4e09, 0x53c1, + /* 0x49 */ + 0x4f1e, 0x6563, 0x6851, 0x55d3, 0x4e27, 0x6414, 0x9a9a, 0x626b, + 0x5ac2, 0x745f, 0x8272, 0x6da9, 0x68ee, 0x50e7, 0x838e, 0x7802, + 0x6740, 0x5239, 0x6c99, 0x7eb1, 0x50bb, 0x5565, 0x715e, 0x7b5b, + 0x6652, 0x73ca, 0x82eb, 0x6749, 0x5c71, 0x5220, 0x717d, 0x886b, + 0x95ea, 0x9655, 0x64c5, 0x8d61, 0x81b3, 0x5584, 0x6c55, 0x6247, + 0x7f2e, 0x5892, 0x4f24, 0x5546, 0x8d4f, 0x664c, 0x4e0a, 0x5c1a, + 0x88f3, 0x68a2, 0x634e, 0x7a0d, 0x70e7, 0x828d, 0x52fa, 0x97f6, + 0x5c11, 0x54e8, 0x90b5, 0x7ecd, 0x5962, 0x8d4a, 0x86c7, 0x820c, + 0x820d, 0x8d66, 0x6444, 0x5c04, 0x6151, 0x6d89, 0x793e, 0x8bbe, + 0x7837, 0x7533, 0x547b, 0x4f38, 0x8eab, 0x6df1, 0x5a20, 0x7ec5, + 0x795e, 0x6c88, 0x5ba1, 0x5a76, 0x751a, 0x80be, 0x614e, 0x6e17, + 0x58f0, 0x751f, 0x7525, 0x7272, 0x5347, 0x7ef3, + /* 0x4a */ + 0x7701, 0x76db, 0x5269, 0x80dc, 0x5723, 0x5e08, 0x5931, 0x72ee, + 0x65bd, 0x6e7f, 0x8bd7, 0x5c38, 0x8671, 0x5341, 0x77f3, 0x62fe, + 0x65f6, 0x4ec0, 0x98df, 0x8680, 0x5b9e, 0x8bc6, 0x53f2, 0x77e2, + 0x4f7f, 0x5c4e, 0x9a76, 0x59cb, 0x5f0f, 0x793a, 0x58eb, 0x4e16, + 0x67ff, 0x4e8b, 0x62ed, 0x8a93, 0x901d, 0x52bf, 0x662f, 0x55dc, + 0x566c, 0x9002, 0x4ed5, 0x4f8d, 0x91ca, 0x9970, 0x6c0f, 0x5e02, + 0x6043, 0x5ba4, 0x89c6, 0x8bd5, 0x6536, 0x624b, 0x9996, 0x5b88, + 0x5bff, 0x6388, 0x552e, 0x53d7, 0x7626, 0x517d, 0x852c, 0x67a2, + 0x68b3, 0x6b8a, 0x6292, 0x8f93, 0x53d4, 0x8212, 0x6dd1, 0x758f, + 0x4e66, 0x8d4e, 0x5b70, 0x719f, 0x85af, 0x6691, 0x66d9, 0x7f72, + 0x8700, 0x9ecd, 0x9f20, 0x5c5e, 0x672f, 0x8ff0, 0x6811, 0x675f, + 0x620d, 0x7ad6, 0x5885, 0x5eb6, 0x6570, 0x6f31, + /* 0x4b */ + 0x6055, 0x5237, 0x800d, 0x6454, 0x8870, 0x7529, 0x5e05, 0x6813, + 0x62f4, 0x971c, 0x53cc, 0x723d, 0x8c01, 0x6c34, 0x7761, 0x7a0e, + 0x542e, 0x77ac, 0x987a, 0x821c, 0x8bf4, 0x7855, 0x6714, 0x70c1, + 0x65af, 0x6495, 0x5636, 0x601d, 0x79c1, 0x53f8, 0x4e1d, 0x6b7b, + 0x8086, 0x5bfa, 0x55e3, 0x56db, 0x4f3a, 0x4f3c, 0x9972, 0x5df3, + 0x677e, 0x8038, 0x6002, 0x9882, 0x9001, 0x5b8b, 0x8bbc, 0x8bf5, + 0x641c, 0x8258, 0x64de, 0x55fd, 0x82cf, 0x9165, 0x4fd7, 0x7d20, + 0x901f, 0x7c9f, 0x50f3, 0x5851, 0x6eaf, 0x5bbf, 0x8bc9, 0x8083, + 0x9178, 0x849c, 0x7b97, 0x867d, 0x968b, 0x968f, 0x7ee5, 0x9ad3, + 0x788e, 0x5c81, 0x7a57, 0x9042, 0x96a7, 0x795f, 0x5b59, 0x635f, + 0x7b0b, 0x84d1, 0x68ad, 0x5506, 0x7f29, 0x7410, 0x7d22, 0x9501, + 0x6240, 0x584c, 0x4ed6, 0x5b83, 0x5979, 0x5854, + /* 0x4c */ + 0x736d, 0x631e, 0x8e4b, 0x8e0f, 0x80ce, 0x82d4, 0x62ac, 0x53f0, + 0x6cf0, 0x915e, 0x592a, 0x6001, 0x6c70, 0x574d, 0x644a, 0x8d2a, + 0x762b, 0x6ee9, 0x575b, 0x6a80, 0x75f0, 0x6f6d, 0x8c2d, 0x8c08, + 0x5766, 0x6bef, 0x8892, 0x78b3, 0x63a2, 0x53f9, 0x70ad, 0x6c64, + 0x5858, 0x642a, 0x5802, 0x68e0, 0x819b, 0x5510, 0x7cd6, 0x5018, + 0x8eba, 0x6dcc, 0x8d9f, 0x70eb, 0x638f, 0x6d9b, 0x6ed4, 0x7ee6, + 0x8404, 0x6843, 0x9003, 0x6dd8, 0x9676, 0x8ba8, 0x5957, 0x7279, + 0x85e4, 0x817e, 0x75bc, 0x8a8a, 0x68af, 0x5254, 0x8e22, 0x9511, + 0x63d0, 0x9898, 0x8e44, 0x557c, 0x4f53, 0x66ff, 0x568f, 0x60d5, + 0x6d95, 0x5243, 0x5c49, 0x5929, 0x6dfb, 0x586b, 0x7530, 0x751c, + 0x606c, 0x8214, 0x8146, 0x6311, 0x6761, 0x8fe2, 0x773a, 0x8df3, + 0x8d34, 0x94c1, 0x5e16, 0x5385, 0x542c, 0x70c3, + /* 0x4d */ + 0x6c40, 0x5ef7, 0x505c, 0x4ead, 0x5ead, 0x633a, 0x8247, 0x901a, + 0x6850, 0x916e, 0x77b3, 0x540c, 0x94dc, 0x5f64, 0x7ae5, 0x6876, + 0x6345, 0x7b52, 0x7edf, 0x75db, 0x5077, 0x6295, 0x5934, 0x900f, + 0x51f8, 0x79c3, 0x7a81, 0x56fe, 0x5f92, 0x9014, 0x6d82, 0x5c60, + 0x571f, 0x5410, 0x5154, 0x6e4d, 0x56e2, 0x63a8, 0x9893, 0x817f, + 0x8715, 0x892a, 0x9000, 0x541e, 0x5c6f, 0x81c0, 0x62d6, 0x6258, + 0x8131, 0x9e35, 0x9640, 0x9a6e, 0x9a7c, 0x692d, 0x59a5, 0x62d3, + 0x553e, 0x6316, 0x54c7, 0x86d9, 0x6d3c, 0x5a03, 0x74e6, 0x889c, + 0x6b6a, 0x5916, 0x8c4c, 0x5f2f, 0x6e7e, 0x73a9, 0x987d, 0x4e38, + 0x70f7, 0x5b8c, 0x7897, 0x633d, 0x665a, 0x7696, 0x60cb, 0x5b9b, + 0x5a49, 0x4e07, 0x8155, 0x6c6a, 0x738b, 0x4ea1, 0x6789, 0x7f51, + 0x5f80, 0x65fa, 0x671b, 0x5fd8, 0x5984, 0x5a01, + /* 0x4e */ + 0x5dcd, 0x5fae, 0x5371, 0x97e6, 0x8fdd, 0x6845, 0x56f4, 0x552f, + 0x60df, 0x4e3a, 0x6f4d, 0x7ef4, 0x82c7, 0x840e, 0x59d4, 0x4f1f, + 0x4f2a, 0x5c3e, 0x7eac, 0x672a, 0x851a, 0x5473, 0x754f, 0x80c3, + 0x5582, 0x9b4f, 0x4f4d, 0x6e2d, 0x8c13, 0x5c09, 0x6170, 0x536b, + 0x761f, 0x6e29, 0x868a, 0x6587, 0x95fb, 0x7eb9, 0x543b, 0x7a33, + 0x7d0a, 0x95ee, 0x55e1, 0x7fc1, 0x74ee, 0x631d, 0x8717, 0x6da1, + 0x7a9d, 0x6211, 0x65a1, 0x5367, 0x63e1, 0x6c83, 0x5deb, 0x545c, + 0x94a8, 0x4e4c, 0x6c61, 0x8bec, 0x5c4b, 0x65e0, 0x829c, 0x68a7, + 0x543e, 0x5434, 0x6bcb, 0x6b66, 0x4e94, 0x6342, 0x5348, 0x821e, + 0x4f0d, 0x4fae, 0x575e, 0x620a, 0x96fe, 0x6664, 0x7269, 0x52ff, + 0x52a1, 0x609f, 0x8bef, 0x6614, 0x7199, 0x6790, 0x897f, 0x7852, + 0x77fd, 0x6670, 0x563b, 0x5438, 0x9521, 0x727a, + /* 0x4f */ + 0x7a00, 0x606f, 0x5e0c, 0x6089, 0x819d, 0x5915, 0x60dc, 0x7184, + 0x70ef, 0x6eaa, 0x6c50, 0x7280, 0x6a84, 0x88ad, 0x5e2d, 0x4e60, + 0x5ab3, 0x559c, 0x94e3, 0x6d17, 0x7cfb, 0x9699, 0x620f, 0x7ec6, + 0x778e, 0x867e, 0x5323, 0x971e, 0x8f96, 0x6687, 0x5ce1, 0x4fa0, + 0x72ed, 0x4e0b, 0x53a6, 0x590f, 0x5413, 0x6380, 0x9528, 0x5148, + 0x4ed9, 0x9c9c, 0x7ea4, 0x54b8, 0x8d24, 0x8854, 0x8237, 0x95f2, + 0x6d8e, 0x5f26, 0x5acc, 0x663e, 0x9669, 0x73b0, 0x732e, 0x53bf, + 0x817a, 0x9985, 0x7fa1, 0x5baa, 0x9677, 0x9650, 0x7ebf, 0x76f8, + 0x53a2, 0x9576, 0x9999, 0x7bb1, 0x8944, 0x6e58, 0x4e61, 0x7fd4, + 0x7965, 0x8be6, 0x60f3, 0x54cd, 0x4eab, 0x9879, 0x5df7, 0x6a61, + 0x50cf, 0x5411, 0x8c61, 0x8427, 0x785d, 0x9704, 0x524a, 0x54ee, + 0x56a3, 0x9500, 0x6d88, 0x5bb5, 0x6dc6, 0x6653, + /* 0x50 */ + 0x5c0f, 0x5b5d, 0x6821, 0x8096, 0x5578, 0x7b11, 0x6548, 0x6954, + 0x4e9b, 0x6b47, 0x874e, 0x978b, 0x534f, 0x631f, 0x643a, 0x90aa, + 0x659c, 0x80c1, 0x8c10, 0x5199, 0x68b0, 0x5378, 0x87f9, 0x61c8, + 0x6cc4, 0x6cfb, 0x8c22, 0x5c51, 0x85aa, 0x82af, 0x950c, 0x6b23, + 0x8f9b, 0x65b0, 0x5ffb, 0x5fc3, 0x4fe1, 0x8845, 0x661f, 0x8165, + 0x7329, 0x60fa, 0x5174, 0x5211, 0x578b, 0x5f62, 0x90a2, 0x884c, + 0x9192, 0x5e78, 0x674f, 0x6027, 0x59d3, 0x5144, 0x51f6, 0x80f8, + 0x5308, 0x6c79, 0x96c4, 0x718a, 0x4f11, 0x4fee, 0x7f9e, 0x673d, + 0x55c5, 0x9508, 0x79c0, 0x8896, 0x7ee3, 0x589f, 0x620c, 0x9700, + 0x865a, 0x5618, 0x987b, 0x5f90, 0x8bb8, 0x84c4, 0x9157, 0x53d9, + 0x65ed, 0x5e8f, 0x755c, 0x6064, 0x7d6e, 0x5a7f, 0x7eea, 0x7eed, + 0x8f69, 0x55a7, 0x5ba3, 0x60ac, 0x65cb, 0x7384, + /* 0x51 */ + 0x9009, 0x7663, 0x7729, 0x7eda, 0x9774, 0x859b, 0x5b66, 0x7a74, + 0x96ea, 0x8840, 0x52cb, 0x718f, 0x5faa, 0x65ec, 0x8be2, 0x5bfb, + 0x9a6f, 0x5de1, 0x6b89, 0x6c5b, 0x8bad, 0x8baf, 0x900a, 0x8fc5, + 0x538b, 0x62bc, 0x9e26, 0x9e2d, 0x5440, 0x4e2b, 0x82bd, 0x7259, + 0x869c, 0x5d16, 0x8859, 0x6daf, 0x96c5, 0x54d1, 0x4e9a, 0x8bb6, + 0x7109, 0x54bd, 0x9609, 0x70df, 0x6df9, 0x76d0, 0x4e25, 0x7814, + 0x8712, 0x5ca9, 0x5ef6, 0x8a00, 0x989c, 0x960e, 0x708e, 0x6cbf, + 0x5944, 0x63a9, 0x773c, 0x884d, 0x6f14, 0x8273, 0x5830, 0x71d5, + 0x538c, 0x781a, 0x96c1, 0x5501, 0x5f66, 0x7130, 0x5bb4, 0x8c1a, + 0x9a8c, 0x6b83, 0x592e, 0x9e2f, 0x79e7, 0x6768, 0x626c, 0x4f6f, + 0x75a1, 0x7f8a, 0x6d0b, 0x9633, 0x6c27, 0x4ef0, 0x75d2, 0x517b, + 0x6837, 0x6f3e, 0x9080, 0x8170, 0x5996, 0x7476, + /* 0x52 */ + 0x6447, 0x5c27, 0x9065, 0x7a91, 0x8c23, 0x59da, 0x54ac, 0x8200, + 0x836f, 0x8981, 0x8000, 0x6930, 0x564e, 0x8036, 0x7237, 0x91ce, + 0x51b6, 0x4e5f, 0x9875, 0x6396, 0x4e1a, 0x53f6, 0x66f3, 0x814b, + 0x591c, 0x6db2, 0x4e00, 0x58f9, 0x533b, 0x63d6, 0x94f1, 0x4f9d, + 0x4f0a, 0x8863, 0x9890, 0x5937, 0x9057, 0x79fb, 0x4eea, 0x80f0, + 0x7591, 0x6c82, 0x5b9c, 0x59e8, 0x5f5d, 0x6905, 0x8681, 0x501a, + 0x5df2, 0x4e59, 0x77e3, 0x4ee5, 0x827a, 0x6291, 0x6613, 0x9091, + 0x5c79, 0x4ebf, 0x5f79, 0x81c6, 0x9038, 0x8084, 0x75ab, 0x4ea6, + 0x88d4, 0x610f, 0x6bc5, 0x5fc6, 0x4e49, 0x76ca, 0x6ea2, 0x8be3, + 0x8bae, 0x8c0a, 0x8bd1, 0x5f02, 0x7ffc, 0x7fcc, 0x7ece, 0x8335, + 0x836b, 0x56e0, 0x6bb7, 0x97f3, 0x9634, 0x59fb, 0x541f, 0x94f6, + 0x6deb, 0x5bc5, 0x996e, 0x5c39, 0x5f15, 0x9690, + /* 0x53 */ + 0x5370, 0x82f1, 0x6a31, 0x5a74, 0x9e70, 0x5e94, 0x7f28, 0x83b9, + 0x8424, 0x8425, 0x8367, 0x8747, 0x8fce, 0x8d62, 0x76c8, 0x5f71, + 0x9896, 0x786c, 0x6620, 0x54df, 0x62e5, 0x4f63, 0x81c3, 0x75c8, + 0x5eb8, 0x96cd, 0x8e0a, 0x86f9, 0x548f, 0x6cf3, 0x6d8c, 0x6c38, + 0x607f, 0x52c7, 0x7528, 0x5e7d, 0x4f18, 0x60a0, 0x5fe7, 0x5c24, + 0x7531, 0x90ae, 0x94c0, 0x72b9, 0x6cb9, 0x6e38, 0x9149, 0x6709, + 0x53cb, 0x53f3, 0x4f51, 0x91c9, 0x8bf1, 0x53c8, 0x5e7c, 0x8fc2, + 0x6de4, 0x4e8e, 0x76c2, 0x6986, 0x865e, 0x611a, 0x8206, 0x4f59, + 0x4fde, 0x903e, 0x9c7c, 0x6109, 0x6e1d, 0x6e14, 0x9685, 0x4e88, + 0x5a31, 0x96e8, 0x4e0e, 0x5c7f, 0x79b9, 0x5b87, 0x8bed, 0x7fbd, + 0x7389, 0x57df, 0x828b, 0x90c1, 0x5401, 0x9047, 0x55bb, 0x5cea, + 0x5fa1, 0x6108, 0x6b32, 0x72f1, 0x80b2, 0x8a89, + /* 0x54 */ + 0x6d74, 0x5bd3, 0x88d5, 0x9884, 0x8c6b, 0x9a6d, 0x9e33, 0x6e0a, + 0x51a4, 0x5143, 0x57a3, 0x8881, 0x539f, 0x63f4, 0x8f95, 0x56ed, + 0x5458, 0x5706, 0x733f, 0x6e90, 0x7f18, 0x8fdc, 0x82d1, 0x613f, + 0x6028, 0x9662, 0x66f0, 0x7ea6, 0x8d8a, 0x8dc3, 0x94a5, 0x5cb3, + 0x7ca4, 0x6708, 0x60a6, 0x9605, 0x8018, 0x4e91, 0x90e7, 0x5300, + 0x9668, 0x5141, 0x8fd0, 0x8574, 0x915d, 0x6655, 0x97f5, 0x5b55, + 0x531d, 0x7838, 0x6742, 0x683d, 0x54c9, 0x707e, 0x5bb0, 0x8f7d, + 0x518d, 0x5728, 0x54b1, 0x6512, 0x6682, 0x8d5e, 0x8d43, 0x810f, + 0x846c, 0x906d, 0x7cdf, 0x51ff, 0x85fb, 0x67a3, 0x65e9, 0x6fa1, + 0x86a4, 0x8e81, 0x566a, 0x9020, 0x7682, 0x7076, 0x71e5, 0x8d23, + 0x62e9, 0x5219, 0x6cfd, 0x8d3c, 0x600e, 0x589e, 0x618e, 0x66fe, + 0x8d60, 0x624e, 0x55b3, 0x6e23, 0x672d, 0x8f67, + /* 0x55 */ + 0x94e1, 0x95f8, 0x7728, 0x6805, 0x69a8, 0x548b, 0x4e4d, 0x70b8, + 0x8bc8, 0x6458, 0x658b, 0x5b85, 0x7a84, 0x503a, 0x5be8, 0x77bb, + 0x6be1, 0x8a79, 0x7c98, 0x6cbe, 0x76cf, 0x65a9, 0x8f97, 0x5d2d, + 0x5c55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7ad9, 0x6e5b, 0x7efd, + 0x6a1f, 0x7ae0, 0x5f70, 0x6f33, 0x5f20, 0x638c, 0x6da8, 0x6756, + 0x4e08, 0x5e10, 0x8d26, 0x4ed7, 0x80c0, 0x7634, 0x969c, 0x62db, + 0x662d, 0x627e, 0x6cbc, 0x8d75, 0x7167, 0x7f69, 0x5146, 0x8087, + 0x53ec, 0x906e, 0x6298, 0x54f2, 0x86f0, 0x8f99, 0x8005, 0x9517, + 0x8517, 0x8fd9, 0x6d59, 0x73cd, 0x659f, 0x771f, 0x7504, 0x7827, + 0x81fb, 0x8d1e, 0x9488, 0x4fa6, 0x6795, 0x75b9, 0x8bca, 0x9707, + 0x632f, 0x9547, 0x9635, 0x84b8, 0x6323, 0x7741, 0x5f81, 0x72f0, + 0x4e89, 0x6014, 0x6574, 0x62ef, 0x6b63, 0x653f, + /* 0x56 */ + 0x5e27, 0x75c7, 0x90d1, 0x8bc1, 0x829d, 0x679d, 0x652f, 0x5431, + 0x8718, 0x77e5, 0x80a2, 0x8102, 0x6c41, 0x4e4b, 0x7ec7, 0x804c, + 0x76f4, 0x690d, 0x6b96, 0x6267, 0x503c, 0x4f84, 0x5740, 0x6307, + 0x6b62, 0x8dbe, 0x53ea, 0x65e8, 0x7eb8, 0x5fd7, 0x631a, 0x63b7, + 0x81f3, 0x81f4, 0x7f6e, 0x5e1c, 0x5cd9, 0x5236, 0x667a, 0x79e9, + 0x7a1a, 0x8d28, 0x7099, 0x75d4, 0x6ede, 0x6cbb, 0x7a92, 0x4e2d, + 0x76c5, 0x5fe0, 0x949f, 0x8877, 0x7ec8, 0x79cd, 0x80bf, 0x91cd, + 0x4ef2, 0x4f17, 0x821f, 0x5468, 0x5dde, 0x6d32, 0x8bcc, 0x7ca5, + 0x8f74, 0x8098, 0x5e1a, 0x5492, 0x76b1, 0x5b99, 0x663c, 0x9aa4, + 0x73e0, 0x682a, 0x86db, 0x6731, 0x732a, 0x8bf8, 0x8bdb, 0x9010, + 0x7af9, 0x70db, 0x716e, 0x62c4, 0x77a9, 0x5631, 0x4e3b, 0x8457, + 0x67f1, 0x52a9, 0x86c0, 0x8d2e, 0x94f8, 0x7b51, + /* 0x57 */ + 0x4f4f, 0x6ce8, 0x795d, 0x9a7b, 0x6293, 0x722a, 0x62fd, 0x4e13, + 0x7816, 0x8f6c, 0x64b0, 0x8d5a, 0x7bc6, 0x6869, 0x5e84, 0x88c5, + 0x5986, 0x649e, 0x58ee, 0x72b6, 0x690e, 0x9525, 0x8ffd, 0x8d58, + 0x5760, 0x7f00, 0x8c06, 0x51c6, 0x6349, 0x62d9, 0x5353, 0x684c, + 0x7422, 0x8301, 0x914c, 0x5544, 0x7740, 0x707c, 0x6d4a, 0x5179, + 0x54a8, 0x8d44, 0x59ff, 0x6ecb, 0x6dc4, 0x5b5c, 0x7d2b, 0x4ed4, + 0x7c7d, 0x6ed3, 0x5b50, 0x81ea, 0x6e0d, 0x5b57, 0x9b03, 0x68d5, + 0x8e2a, 0x5b97, 0x7efc, 0x603b, 0x7eb5, 0x90b9, 0x8d70, 0x594f, + 0x63cd, 0x79df, 0x8db3, 0x5352, 0x65cf, 0x7956, 0x8bc5, 0x963b, + 0x7ec4, 0x94bb, 0x7e82, 0x5634, 0x9189, 0x6700, 0x7f6a, 0x5c0a, + 0x9075, 0x6628, 0x5de6, 0x4f50, 0x67de, 0x505a, 0x4f5c, 0x5750, + 0x5ea7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x58 */ + 0x4e8d, 0x4e0c, 0x5140, 0x4e10, 0x5eff, 0x5345, 0x4e15, 0x4e98, + 0x4e1e, 0x9b32, 0x5b6c, 0x5669, 0x4e28, 0x79ba, 0x4e3f, 0x5315, + 0x4e47, 0x592d, 0x723b, 0x536e, 0x6c10, 0x56df, 0x80e4, 0x9997, + 0x6bd3, 0x777e, 0x9f17, 0x4e36, 0x4e9f, 0x9f10, 0x4e5c, 0x4e69, + 0x4e93, 0x8288, 0x5b5b, 0x556c, 0x560f, 0x4ec4, 0x538d, 0x539d, + 0x53a3, 0x53a5, 0x53ae, 0x9765, 0x8d5d, 0x531a, 0x53f5, 0x5326, + 0x532e, 0x533e, 0x8d5c, 0x5366, 0x5363, 0x5202, 0x5208, 0x520e, + 0x522d, 0x5233, 0x523f, 0x5240, 0x524c, 0x525e, 0x5261, 0x525c, + 0x84af, 0x527d, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, 0x7f54, + 0x4ebb, 0x4ec3, 0x4ec9, 0x4ec2, 0x4ee8, 0x4ee1, 0x4eeb, 0x4ede, + 0x4f1b, 0x4ef3, 0x4f22, 0x4f64, 0x4ef5, 0x4f25, 0x4f27, 0x4f09, + 0x4f2b, 0x4f5e, 0x4f67, 0x6538, 0x4f5a, 0x4f5d, + /* 0x59 */ + 0x4f5f, 0x4f57, 0x4f32, 0x4f3d, 0x4f76, 0x4f74, 0x4f91, 0x4f89, + 0x4f83, 0x4f8f, 0x4f7e, 0x4f7b, 0x4faa, 0x4f7c, 0x4fac, 0x4f94, + 0x4fe6, 0x4fe8, 0x4fea, 0x4fc5, 0x4fda, 0x4fe3, 0x4fdc, 0x4fd1, + 0x4fdf, 0x4ff8, 0x5029, 0x504c, 0x4ff3, 0x502c, 0x500f, 0x502e, + 0x502d, 0x4ffe, 0x501c, 0x500c, 0x5025, 0x5028, 0x507e, 0x5043, + 0x5055, 0x5048, 0x504e, 0x506c, 0x507b, 0x50a5, 0x50a7, 0x50a9, + 0x50ba, 0x50d6, 0x5106, 0x50ed, 0x50ec, 0x50e6, 0x50ee, 0x5107, + 0x510b, 0x4edd, 0x6c3d, 0x4f58, 0x4f65, 0x4fce, 0x9fa0, 0x6c46, + 0x7c74, 0x516e, 0x5dfd, 0x9ec9, 0x9998, 0x5181, 0x5914, 0x52f9, + 0x530d, 0x8a07, 0x5310, 0x51eb, 0x5919, 0x5155, 0x4ea0, 0x5156, + 0x4eb3, 0x886e, 0x88a4, 0x4eb5, 0x8114, 0x88d2, 0x7980, 0x5b34, + 0x8803, 0x7fb8, 0x51ab, 0x51b1, 0x51bd, 0x51bc, + /* 0x5a */ + 0x51c7, 0x5196, 0x51a2, 0x51a5, 0x8ba0, 0x8ba6, 0x8ba7, 0x8baa, + 0x8bb4, 0x8bb5, 0x8bb7, 0x8bc2, 0x8bc3, 0x8bcb, 0x8bcf, 0x8bce, + 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd6, 0x8bd8, 0x8bd9, 0x8bdc, 0x8bdf, + 0x8be0, 0x8be4, 0x8be8, 0x8be9, 0x8bee, 0x8bf0, 0x8bf3, 0x8bf6, + 0x8bf9, 0x8bfc, 0x8bff, 0x8c00, 0x8c02, 0x8c04, 0x8c07, 0x8c0c, + 0x8c0f, 0x8c11, 0x8c12, 0x8c14, 0x8c15, 0x8c16, 0x8c19, 0x8c1b, + 0x8c18, 0x8c1d, 0x8c1f, 0x8c20, 0x8c21, 0x8c25, 0x8c27, 0x8c2a, + 0x8c2b, 0x8c2e, 0x8c2f, 0x8c32, 0x8c33, 0x8c35, 0x8c36, 0x5369, + 0x537a, 0x961d, 0x9622, 0x9621, 0x9631, 0x962a, 0x963d, 0x963c, + 0x9642, 0x9649, 0x9654, 0x965f, 0x9667, 0x966c, 0x9672, 0x9674, + 0x9688, 0x968d, 0x9697, 0x96b0, 0x9097, 0x909b, 0x909d, 0x9099, + 0x90ac, 0x90a1, 0x90b4, 0x90b3, 0x90b6, 0x90ba, + /* 0x5b */ + 0x90b8, 0x90b0, 0x90cf, 0x90c5, 0x90be, 0x90d0, 0x90c4, 0x90c7, + 0x90d3, 0x90e6, 0x90e2, 0x90dc, 0x90d7, 0x90db, 0x90eb, 0x90ef, + 0x90fe, 0x9104, 0x9122, 0x911e, 0x9123, 0x9131, 0x912f, 0x9139, + 0x9143, 0x9146, 0x520d, 0x5942, 0x52a2, 0x52ac, 0x52ad, 0x52be, + 0x54ff, 0x52d0, 0x52d6, 0x52f0, 0x53df, 0x71ee, 0x77cd, 0x5ef4, + 0x51f5, 0x51fc, 0x9b2f, 0x53b6, 0x5f01, 0x755a, 0x5def, 0x574c, + 0x57a9, 0x57a1, 0x587e, 0x58bc, 0x58c5, 0x58d1, 0x5729, 0x572c, + 0x572a, 0x5733, 0x5739, 0x572e, 0x572f, 0x575c, 0x573b, 0x5742, + 0x5769, 0x5785, 0x576b, 0x5786, 0x577c, 0x577b, 0x5768, 0x576d, + 0x5776, 0x5773, 0x57ad, 0x57a4, 0x578c, 0x57b2, 0x57cf, 0x57a7, + 0x57b4, 0x5793, 0x57a0, 0x57d5, 0x57d8, 0x57da, 0x57d9, 0x57d2, + 0x57b8, 0x57f4, 0x57ef, 0x57f8, 0x57e4, 0x57dd, + /* 0x5c */ + 0x580b, 0x580d, 0x57fd, 0x57ed, 0x5800, 0x581e, 0x5819, 0x5844, + 0x5820, 0x5865, 0x586c, 0x5881, 0x5889, 0x589a, 0x5880, 0x99a8, + 0x9f19, 0x61ff, 0x8279, 0x827d, 0x827f, 0x828f, 0x828a, 0x82a8, + 0x8284, 0x828e, 0x8291, 0x8297, 0x8299, 0x82ab, 0x82b8, 0x82be, + 0x82b0, 0x82c8, 0x82ca, 0x82e3, 0x8298, 0x82b7, 0x82ae, 0x82cb, + 0x82cc, 0x82c1, 0x82a9, 0x82b4, 0x82a1, 0x82aa, 0x829f, 0x82c4, + 0x82ce, 0x82a4, 0x82e1, 0x8309, 0x82f7, 0x82e4, 0x830f, 0x8307, + 0x82dc, 0x82f4, 0x82d2, 0x82d8, 0x830c, 0x82fb, 0x82d3, 0x8311, + 0x831a, 0x8306, 0x8314, 0x8315, 0x82e0, 0x82d5, 0x831c, 0x8351, + 0x835b, 0x835c, 0x8308, 0x8392, 0x833c, 0x8334, 0x8331, 0x839b, + 0x835e, 0x832f, 0x834f, 0x8347, 0x8343, 0x835f, 0x8340, 0x8317, + 0x8360, 0x832d, 0x833a, 0x8333, 0x8366, 0x8365, + /* 0x5d */ + 0x8368, 0x831b, 0x8369, 0x836c, 0x836a, 0x836d, 0x836e, 0x83b0, + 0x8378, 0x83b3, 0x83b4, 0x83a0, 0x83aa, 0x8393, 0x839c, 0x8385, + 0x837c, 0x83b6, 0x83a9, 0x837d, 0x83b8, 0x837b, 0x8398, 0x839e, + 0x83a8, 0x83ba, 0x83bc, 0x83c1, 0x8401, 0x83e5, 0x83d8, 0x5807, + 0x8418, 0x840b, 0x83dd, 0x83fd, 0x83d6, 0x841c, 0x8438, 0x8411, + 0x8406, 0x83d4, 0x83df, 0x840f, 0x8403, 0x83f8, 0x83f9, 0x83ea, + 0x83c5, 0x83c0, 0x8426, 0x83f0, 0x83e1, 0x845c, 0x8451, 0x845a, + 0x8459, 0x8473, 0x8487, 0x8488, 0x847a, 0x8489, 0x8478, 0x843c, + 0x8446, 0x8469, 0x8476, 0x848c, 0x848e, 0x8431, 0x846d, 0x84c1, + 0x84cd, 0x84d0, 0x84e6, 0x84bd, 0x84d3, 0x84ca, 0x84bf, 0x84ba, + 0x84e0, 0x84a1, 0x84b9, 0x84b4, 0x8497, 0x84e5, 0x84e3, 0x850c, + 0x750d, 0x8538, 0x84f0, 0x8539, 0x851f, 0x853a, + /* 0x5e */ + 0x8556, 0x853b, 0x84ff, 0x84fc, 0x8559, 0x8548, 0x8568, 0x8564, + 0x855e, 0x857a, 0x77a2, 0x8543, 0x8572, 0x857b, 0x85a4, 0x85a8, + 0x8587, 0x858f, 0x8579, 0x85ae, 0x859c, 0x8585, 0x85b9, 0x85b7, + 0x85b0, 0x85d3, 0x85c1, 0x85dc, 0x85ff, 0x8627, 0x8605, 0x8629, + 0x8616, 0x863c, 0x5efe, 0x5f08, 0x593c, 0x5941, 0x8037, 0x5955, + 0x595a, 0x5958, 0x530f, 0x5c22, 0x5c25, 0x5c2c, 0x5c34, 0x624c, + 0x626a, 0x629f, 0x62bb, 0x62ca, 0x62da, 0x62d7, 0x62ee, 0x6322, + 0x62f6, 0x6339, 0x634b, 0x6343, 0x63ad, 0x63f6, 0x6371, 0x637a, + 0x638e, 0x63b4, 0x636d, 0x63ac, 0x638a, 0x6369, 0x63ae, 0x63bc, + 0x63f2, 0x63f8, 0x63e0, 0x63ff, 0x63c4, 0x63de, 0x63ce, 0x6452, + 0x63c6, 0x63be, 0x6445, 0x6441, 0x640b, 0x641b, 0x6420, 0x640c, + 0x6426, 0x6421, 0x645e, 0x6484, 0x646d, 0x6496, + /* 0x5f */ + 0x647a, 0x64b7, 0x64b8, 0x6499, 0x64ba, 0x64c0, 0x64d0, 0x64d7, + 0x64e4, 0x64e2, 0x6509, 0x6525, 0x652e, 0x5f0b, 0x5fd2, 0x7519, + 0x5f11, 0x535f, 0x53f1, 0x53fd, 0x53e9, 0x53e8, 0x53fb, 0x5412, + 0x5416, 0x5406, 0x544b, 0x5452, 0x5453, 0x5454, 0x5456, 0x5443, + 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, 0x5477, + 0x5471, 0x5464, 0x549a, 0x549b, 0x5484, 0x5476, 0x5466, 0x549d, + 0x54d0, 0x54ad, 0x54c2, 0x54b4, 0x54d2, 0x54a7, 0x54a6, 0x54d3, + 0x54d4, 0x5472, 0x54a3, 0x54d5, 0x54bb, 0x54bf, 0x54cc, 0x54d9, + 0x54da, 0x54dc, 0x54a9, 0x54aa, 0x54a4, 0x54dd, 0x54cf, 0x54de, + 0x551b, 0x54e7, 0x5520, 0x54fd, 0x5514, 0x54f3, 0x5522, 0x5523, + 0x550f, 0x5511, 0x5527, 0x552a, 0x5567, 0x558f, 0x55b5, 0x5549, + 0x556d, 0x5541, 0x5555, 0x553f, 0x5550, 0x553c, + /* 0x60 */ + 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, 0x555c, + 0x558b, 0x55d2, 0x5583, 0x55b1, 0x55b9, 0x5588, 0x5581, 0x559f, + 0x557e, 0x55d6, 0x5591, 0x557b, 0x55df, 0x55bd, 0x55be, 0x5594, + 0x5599, 0x55ea, 0x55f7, 0x55c9, 0x561f, 0x55d1, 0x55eb, 0x55ec, + 0x55d4, 0x55e6, 0x55dd, 0x55c4, 0x55ef, 0x55e5, 0x55f2, 0x55f3, + 0x55cc, 0x55cd, 0x55e8, 0x55f5, 0x55e4, 0x8f94, 0x561e, 0x5608, + 0x560c, 0x5601, 0x5624, 0x5623, 0x55fe, 0x5600, 0x5627, 0x562d, + 0x5658, 0x5639, 0x5657, 0x562c, 0x564d, 0x5662, 0x5659, 0x565c, + 0x564c, 0x5654, 0x5686, 0x5664, 0x5671, 0x566b, 0x567b, 0x567c, + 0x5685, 0x5693, 0x56af, 0x56d4, 0x56d7, 0x56dd, 0x56e1, 0x56f5, + 0x56eb, 0x56f9, 0x56ff, 0x5704, 0x570a, 0x5709, 0x571c, 0x5e0f, + 0x5e19, 0x5e14, 0x5e11, 0x5e31, 0x5e3b, 0x5e3c, + /* 0x61 */ + 0x5e37, 0x5e44, 0x5e54, 0x5e5b, 0x5e5e, 0x5e61, 0x5c8c, 0x5c7a, + 0x5c8d, 0x5c90, 0x5c96, 0x5c88, 0x5c98, 0x5c99, 0x5c91, 0x5c9a, + 0x5c9c, 0x5cb5, 0x5ca2, 0x5cbd, 0x5cac, 0x5cab, 0x5cb1, 0x5ca3, + 0x5cc1, 0x5cb7, 0x5cc4, 0x5cd2, 0x5ce4, 0x5ccb, 0x5ce5, 0x5d02, + 0x5d03, 0x5d27, 0x5d26, 0x5d2e, 0x5d24, 0x5d1e, 0x5d06, 0x5d1b, + 0x5d58, 0x5d3e, 0x5d34, 0x5d3d, 0x5d6c, 0x5d5b, 0x5d6f, 0x5d5d, + 0x5d6b, 0x5d4b, 0x5d4a, 0x5d69, 0x5d74, 0x5d82, 0x5d99, 0x5d9d, + 0x8c73, 0x5db7, 0x5dc5, 0x5f73, 0x5f77, 0x5f82, 0x5f87, 0x5f89, + 0x5f8c, 0x5f95, 0x5f99, 0x5f9c, 0x5fa8, 0x5fad, 0x5fb5, 0x5fbc, + 0x8862, 0x5f61, 0x72ad, 0x72b0, 0x72b4, 0x72b7, 0x72b8, 0x72c3, + 0x72c1, 0x72ce, 0x72cd, 0x72d2, 0x72e8, 0x72ef, 0x72e9, 0x72f2, + 0x72f4, 0x72f7, 0x7301, 0x72f3, 0x7303, 0x72fa, + /* 0x62 */ + 0x72fb, 0x7317, 0x7313, 0x7321, 0x730a, 0x731e, 0x731d, 0x7315, + 0x7322, 0x7339, 0x7325, 0x732c, 0x7338, 0x7331, 0x7350, 0x734d, + 0x7357, 0x7360, 0x736c, 0x736f, 0x737e, 0x821b, 0x5925, 0x98e7, + 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, + 0x996c, 0x9974, 0x9977, 0x997d, 0x9980, 0x9984, 0x9987, 0x998a, + 0x998d, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5e80, 0x5e91, + 0x5e8b, 0x5e96, 0x5ea5, 0x5ea0, 0x5eb9, 0x5eb5, 0x5ebe, 0x5eb3, + 0x8d53, 0x5ed2, 0x5ed1, 0x5edb, 0x5ee8, 0x5eea, 0x81ba, 0x5fc4, + 0x5fc9, 0x5fd6, 0x5fcf, 0x6003, 0x5fee, 0x6004, 0x5fe1, 0x5fe4, + 0x5ffe, 0x6005, 0x6006, 0x5fea, 0x5fed, 0x5ff8, 0x6019, 0x6035, + 0x6026, 0x601b, 0x600f, 0x600d, 0x6029, 0x602b, 0x600a, 0x603f, + 0x6021, 0x6078, 0x6079, 0x607b, 0x607a, 0x6042, + /* 0x63 */ + 0x606a, 0x607d, 0x6096, 0x609a, 0x60ad, 0x609d, 0x6083, 0x6092, + 0x608c, 0x609b, 0x60ec, 0x60bb, 0x60b1, 0x60dd, 0x60d8, 0x60c6, + 0x60da, 0x60b4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60f4, 0x6100, + 0x610e, 0x612b, 0x614a, 0x6175, 0x61ac, 0x6194, 0x61a7, 0x61b7, + 0x61d4, 0x61f5, 0x5fdd, 0x96b3, 0x95e9, 0x95eb, 0x95f1, 0x95f3, + 0x95f5, 0x95f6, 0x95fc, 0x95fe, 0x9603, 0x9604, 0x9606, 0x9608, + 0x960a, 0x960b, 0x960c, 0x960d, 0x960f, 0x9612, 0x9615, 0x9616, + 0x9617, 0x9619, 0x961a, 0x4e2c, 0x723f, 0x6215, 0x6c35, 0x6c54, + 0x6c5c, 0x6c4a, 0x6ca3, 0x6c85, 0x6c90, 0x6c94, 0x6c8c, 0x6c68, + 0x6c69, 0x6c74, 0x6c76, 0x6c86, 0x6ca9, 0x6cd0, 0x6cd4, 0x6cad, + 0x6cf7, 0x6cf8, 0x6cf1, 0x6cd7, 0x6cb2, 0x6ce0, 0x6cd6, 0x6cfa, + 0x6ceb, 0x6cee, 0x6cb1, 0x6cd3, 0x6cef, 0x6cfe, + /* 0x64 */ + 0x6d39, 0x6d27, 0x6d0c, 0x6d43, 0x6d48, 0x6d07, 0x6d04, 0x6d19, + 0x6d0e, 0x6d2b, 0x6d4d, 0x6d2e, 0x6d35, 0x6d1a, 0x6d4f, 0x6d52, + 0x6d54, 0x6d33, 0x6d91, 0x6d6f, 0x6d9e, 0x6da0, 0x6d5e, 0x6d93, + 0x6d94, 0x6d5c, 0x6d60, 0x6d7c, 0x6d63, 0x6e1a, 0x6dc7, 0x6dc5, + 0x6dde, 0x6e0e, 0x6dbf, 0x6de0, 0x6e11, 0x6de6, 0x6ddd, 0x6dd9, + 0x6e16, 0x6dab, 0x6e0c, 0x6dae, 0x6e2b, 0x6e6e, 0x6e4e, 0x6e6b, + 0x6eb2, 0x6e5f, 0x6e86, 0x6e53, 0x6e54, 0x6e32, 0x6e25, 0x6e44, + 0x6edf, 0x6eb1, 0x6e98, 0x6ee0, 0x6f2d, 0x6ee2, 0x6ea5, 0x6ea7, + 0x6ebd, 0x6ebb, 0x6eb7, 0x6ed7, 0x6eb4, 0x6ecf, 0x6e8f, 0x6ec2, + 0x6e9f, 0x6f62, 0x6f46, 0x6f47, 0x6f24, 0x6f15, 0x6ef9, 0x6f2f, + 0x6f36, 0x6f4b, 0x6f74, 0x6f2a, 0x6f09, 0x6f29, 0x6f89, 0x6f8d, + 0x6f8c, 0x6f78, 0x6f72, 0x6f7c, 0x6f7a, 0x6fd1, + /* 0x65 */ + 0x6fc9, 0x6fa7, 0x6fb9, 0x6fb6, 0x6fc2, 0x6fe1, 0x6fee, 0x6fde, + 0x6fe0, 0x6fef, 0x701a, 0x7023, 0x701b, 0x7039, 0x7035, 0x704f, + 0x705e, 0x5b80, 0x5b84, 0x5b95, 0x5b93, 0x5ba5, 0x5bb8, 0x752f, + 0x9a9e, 0x6434, 0x5be4, 0x5bee, 0x8930, 0x5bf0, 0x8e47, 0x8b07, + 0x8fb6, 0x8fd3, 0x8fd5, 0x8fe5, 0x8fee, 0x8fe4, 0x8fe9, 0x8fe6, + 0x8ff3, 0x8fe8, 0x9005, 0x9004, 0x900b, 0x9026, 0x9011, 0x900d, + 0x9016, 0x9021, 0x9035, 0x9036, 0x902d, 0x902f, 0x9044, 0x9051, + 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905b, 0x66b9, 0x9074, + 0x907d, 0x9082, 0x9088, 0x9083, 0x908b, 0x5f50, 0x5f57, 0x5f56, + 0x5f58, 0x5c3b, 0x54ab, 0x5c50, 0x5c59, 0x5b71, 0x5c63, 0x5c66, + 0x7fbc, 0x5f2a, 0x5f29, 0x5f2d, 0x8274, 0x5f3c, 0x9b3b, 0x5c6e, + 0x5981, 0x5983, 0x598d, 0x59a9, 0x59aa, 0x59a3, + /* 0x66 */ + 0x5997, 0x59ca, 0x59ab, 0x599e, 0x59a4, 0x59d2, 0x59b2, 0x59af, + 0x59d7, 0x59be, 0x5a05, 0x5a06, 0x59dd, 0x5a08, 0x59e3, 0x59d8, + 0x59f9, 0x5a0c, 0x5a09, 0x5a32, 0x5a34, 0x5a11, 0x5a23, 0x5a13, + 0x5a40, 0x5a67, 0x5a4a, 0x5a55, 0x5a3c, 0x5a62, 0x5a75, 0x80ec, + 0x5aaa, 0x5a9b, 0x5a77, 0x5a7a, 0x5abe, 0x5aeb, 0x5ab2, 0x5ad2, + 0x5ad4, 0x5ab8, 0x5ae0, 0x5ae3, 0x5af1, 0x5ad6, 0x5ae6, 0x5ad8, + 0x5adc, 0x5b09, 0x5b17, 0x5b16, 0x5b32, 0x5b37, 0x5b40, 0x5c15, + 0x5c1c, 0x5b5a, 0x5b65, 0x5b73, 0x5b51, 0x5b53, 0x5b62, 0x9a75, + 0x9a77, 0x9a78, 0x9a7a, 0x9a7f, 0x9a7d, 0x9a80, 0x9a81, 0x9a85, + 0x9a88, 0x9a8a, 0x9a90, 0x9a92, 0x9a93, 0x9a96, 0x9a98, 0x9a9b, + 0x9a9c, 0x9a9d, 0x9a9f, 0x9aa0, 0x9aa2, 0x9aa3, 0x9aa5, 0x9aa7, + 0x7e9f, 0x7ea1, 0x7ea3, 0x7ea5, 0x7ea8, 0x7ea9, + /* 0x67 */ + 0x7ead, 0x7eb0, 0x7ebe, 0x7ec0, 0x7ec1, 0x7ec2, 0x7ec9, 0x7ecb, + 0x7ecc, 0x7ed0, 0x7ed4, 0x7ed7, 0x7edb, 0x7ee0, 0x7ee1, 0x7ee8, + 0x7eeb, 0x7eee, 0x7eef, 0x7ef1, 0x7ef2, 0x7f0d, 0x7ef6, 0x7efa, + 0x7efb, 0x7efe, 0x7f01, 0x7f02, 0x7f03, 0x7f07, 0x7f08, 0x7f0b, + 0x7f0c, 0x7f0f, 0x7f11, 0x7f12, 0x7f17, 0x7f19, 0x7f1c, 0x7f1b, + 0x7f1f, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27, + 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2f, 0x7f30, 0x7f31, 0x7f32, + 0x7f33, 0x7f35, 0x5e7a, 0x757f, 0x5ddb, 0x753e, 0x9095, 0x738e, + 0x7391, 0x73ae, 0x73a2, 0x739f, 0x73cf, 0x73c2, 0x73d1, 0x73b7, + 0x73b3, 0x73c0, 0x73c9, 0x73c8, 0x73e5, 0x73d9, 0x987c, 0x740a, + 0x73e9, 0x73e7, 0x73de, 0x73ba, 0x73f2, 0x740f, 0x742a, 0x745b, + 0x7426, 0x7425, 0x7428, 0x7430, 0x742e, 0x742c, + /* 0x68 */ + 0x741b, 0x741a, 0x7441, 0x745c, 0x7457, 0x7455, 0x7459, 0x7477, + 0x746d, 0x747e, 0x749c, 0x748e, 0x7480, 0x7481, 0x7487, 0x748b, + 0x749e, 0x74a8, 0x74a9, 0x7490, 0x74a7, 0x74d2, 0x74ba, 0x97ea, + 0x97eb, 0x97ec, 0x674c, 0x6753, 0x675e, 0x6748, 0x6769, 0x67a5, + 0x6787, 0x676a, 0x6773, 0x6798, 0x67a7, 0x6775, 0x67a8, 0x679e, + 0x67ad, 0x678b, 0x6777, 0x677c, 0x67f0, 0x6809, 0x67d8, 0x680a, + 0x67e9, 0x67b0, 0x680c, 0x67d9, 0x67b5, 0x67da, 0x67b3, 0x67dd, + 0x6800, 0x67c3, 0x67b8, 0x67e2, 0x680e, 0x67c1, 0x67fd, 0x6832, + 0x6833, 0x6860, 0x6861, 0x684e, 0x6862, 0x6844, 0x6864, 0x6883, + 0x681d, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683e, 0x684a, + 0x6849, 0x6829, 0x68b5, 0x688f, 0x6874, 0x6877, 0x6893, 0x686b, + 0x68c2, 0x696e, 0x68fc, 0x691f, 0x6920, 0x68f9, + /* 0x69 */ + 0x6924, 0x68f0, 0x690b, 0x6901, 0x6957, 0x68e3, 0x6910, 0x6971, + 0x6939, 0x6960, 0x6942, 0x695d, 0x6984, 0x696b, 0x6980, 0x6998, + 0x6978, 0x6934, 0x69cc, 0x6987, 0x6988, 0x69ce, 0x6989, 0x6966, + 0x6963, 0x6979, 0x699b, 0x69a7, 0x69bb, 0x69ab, 0x69ad, 0x69d4, + 0x69b1, 0x69c1, 0x69ca, 0x69df, 0x6995, 0x69e0, 0x698d, 0x69ff, + 0x6a2f, 0x69ed, 0x6a17, 0x6a18, 0x6a65, 0x69f2, 0x6a44, 0x6a3e, + 0x6aa0, 0x6a50, 0x6a5b, 0x6a35, 0x6a8e, 0x6a79, 0x6a3d, 0x6a28, + 0x6a58, 0x6a7c, 0x6a91, 0x6a90, 0x6aa9, 0x6a97, 0x6aab, 0x7337, + 0x7352, 0x6b81, 0x6b82, 0x6b87, 0x6b84, 0x6b92, 0x6b93, 0x6b8d, + 0x6b9a, 0x6b9b, 0x6ba1, 0x6baa, 0x8f6b, 0x8f6d, 0x8f71, 0x8f72, + 0x8f73, 0x8f75, 0x8f76, 0x8f78, 0x8f77, 0x8f79, 0x8f7a, 0x8f7c, + 0x8f7e, 0x8f81, 0x8f82, 0x8f84, 0x8f87, 0x8f8b, + /* 0x6a */ + 0x8f8d, 0x8f8e, 0x8f8f, 0x8f98, 0x8f9a, 0x8ece, 0x620b, 0x6217, + 0x621b, 0x621f, 0x6222, 0x6221, 0x6225, 0x6224, 0x622c, 0x81e7, + 0x74ef, 0x74f4, 0x74ff, 0x750f, 0x7511, 0x7513, 0x6534, 0x65ee, + 0x65ef, 0x65f0, 0x660a, 0x6619, 0x6772, 0x6603, 0x6615, 0x6600, + 0x7085, 0x66f7, 0x661d, 0x6634, 0x6631, 0x6636, 0x6635, 0x8006, + 0x665f, 0x6654, 0x6641, 0x664f, 0x6656, 0x6661, 0x6657, 0x6677, + 0x6684, 0x668c, 0x66a7, 0x669d, 0x66be, 0x66db, 0x66dc, 0x66e6, + 0x66e9, 0x8d32, 0x8d33, 0x8d36, 0x8d3b, 0x8d3d, 0x8d40, 0x8d45, + 0x8d46, 0x8d48, 0x8d49, 0x8d47, 0x8d4d, 0x8d55, 0x8d59, 0x89c7, + 0x89ca, 0x89cb, 0x89cc, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x726e, + 0x729f, 0x725d, 0x7266, 0x726f, 0x727e, 0x727f, 0x7284, 0x728b, + 0x728d, 0x728f, 0x7292, 0x6308, 0x6332, 0x63b0, + /* 0x6b */ + 0x643f, 0x64d8, 0x8004, 0x6bea, 0x6bf3, 0x6bfd, 0x6bf5, 0x6bf9, + 0x6c05, 0x6c07, 0x6c06, 0x6c0d, 0x6c15, 0x6c18, 0x6c19, 0x6c1a, + 0x6c21, 0x6c29, 0x6c24, 0x6c2a, 0x6c32, 0x6535, 0x6555, 0x656b, + 0x724d, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809f, 0x809c, + 0x8093, 0x80bc, 0x670a, 0x80bd, 0x80b1, 0x80ab, 0x80ad, 0x80b4, + 0x80b7, 0x80e7, 0x80e8, 0x80e9, 0x80ea, 0x80db, 0x80c2, 0x80c4, + 0x80d9, 0x80cd, 0x80d7, 0x6710, 0x80dd, 0x80eb, 0x80f1, 0x80f4, + 0x80ed, 0x810d, 0x810e, 0x80f2, 0x80fc, 0x6715, 0x8112, 0x8c5a, + 0x8136, 0x811e, 0x812c, 0x8118, 0x8132, 0x8148, 0x814c, 0x8153, + 0x8174, 0x8159, 0x815a, 0x8171, 0x8160, 0x8169, 0x817c, 0x817d, + 0x816d, 0x8167, 0x584d, 0x5ab5, 0x8188, 0x8182, 0x8191, 0x6ed5, + 0x81a3, 0x81aa, 0x81cc, 0x6726, 0x81ca, 0x81bb, + /* 0x6c */ + 0x81c1, 0x81a6, 0x6b24, 0x6b37, 0x6b39, 0x6b43, 0x6b46, 0x6b59, + 0x98d1, 0x98d2, 0x98d3, 0x98d5, 0x98d9, 0x98da, 0x6bb3, 0x5f40, + 0x6bc2, 0x89f3, 0x6590, 0x9f51, 0x6593, 0x65bc, 0x65c6, 0x65c4, + 0x65c3, 0x65cc, 0x65ce, 0x65d2, 0x65d6, 0x7080, 0x709c, 0x7096, + 0x709d, 0x70bb, 0x70c0, 0x70b7, 0x70ab, 0x70b1, 0x70e8, 0x70ca, + 0x7110, 0x7113, 0x7116, 0x712f, 0x7131, 0x7173, 0x715c, 0x7168, + 0x7145, 0x7172, 0x714a, 0x7178, 0x717a, 0x7198, 0x71b3, 0x71b5, + 0x71a8, 0x71a0, 0x71e0, 0x71d4, 0x71e7, 0x71f9, 0x721d, 0x7228, + 0x706c, 0x7118, 0x7166, 0x71b9, 0x623e, 0x623d, 0x6243, 0x6248, + 0x6249, 0x793b, 0x7940, 0x7946, 0x7949, 0x795b, 0x795c, 0x7953, + 0x795a, 0x7962, 0x7957, 0x7960, 0x796f, 0x7967, 0x797a, 0x7985, + 0x798a, 0x799a, 0x79a7, 0x79b3, 0x5fd1, 0x5fd0, + /* 0x6d */ + 0x603c, 0x605d, 0x605a, 0x6067, 0x6041, 0x6059, 0x6063, 0x60ab, + 0x6106, 0x610d, 0x615d, 0x61a9, 0x619d, 0x61cb, 0x61d1, 0x6206, + 0x8080, 0x807f, 0x6c93, 0x6cf6, 0x6dfc, 0x77f6, 0x77f8, 0x7800, + 0x7809, 0x7817, 0x7818, 0x7811, 0x65ab, 0x782d, 0x781c, 0x781d, + 0x7839, 0x783a, 0x783b, 0x781f, 0x783c, 0x7825, 0x782c, 0x7823, + 0x7829, 0x784e, 0x786d, 0x7856, 0x7857, 0x7826, 0x7850, 0x7847, + 0x784c, 0x786a, 0x789b, 0x7893, 0x789a, 0x7887, 0x789c, 0x78a1, + 0x78a3, 0x78b2, 0x78b9, 0x78a5, 0x78d4, 0x78d9, 0x78c9, 0x78ec, + 0x78f2, 0x7905, 0x78f4, 0x7913, 0x7924, 0x791e, 0x7934, 0x9f9b, + 0x9ef9, 0x9efb, 0x9efc, 0x76f1, 0x7704, 0x770d, 0x76f9, 0x7707, + 0x7708, 0x771a, 0x7722, 0x7719, 0x772d, 0x7726, 0x7735, 0x7738, + 0x7750, 0x7751, 0x7747, 0x7743, 0x775a, 0x7768, + /* 0x6e */ + 0x7762, 0x7765, 0x777f, 0x778d, 0x777d, 0x7780, 0x778c, 0x7791, + 0x779f, 0x77a0, 0x77b0, 0x77b5, 0x77bd, 0x753a, 0x7540, 0x754e, + 0x754b, 0x7548, 0x755b, 0x7572, 0x7579, 0x7583, 0x7f58, 0x7f61, + 0x7f5f, 0x8a48, 0x7f68, 0x7f74, 0x7f71, 0x7f79, 0x7f81, 0x7f7e, + 0x76cd, 0x76e5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948b, 0x948a, + 0x948c, 0x948d, 0x948f, 0x9490, 0x9494, 0x9497, 0x9495, 0x949a, + 0x949b, 0x949c, 0x94a3, 0x94a4, 0x94ab, 0x94aa, 0x94ad, 0x94ac, + 0x94af, 0x94b0, 0x94b2, 0x94b4, 0x94b6, 0x94b7, 0x94b8, 0x94b9, + 0x94ba, 0x94bc, 0x94bd, 0x94bf, 0x94c4, 0x94c8, 0x94c9, 0x94ca, + 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94d0, 0x94d1, 0x94d2, 0x94d5, + 0x94d6, 0x94d7, 0x94d9, 0x94d8, 0x94db, 0x94de, 0x94df, 0x94e0, + 0x94e2, 0x94e4, 0x94e5, 0x94e7, 0x94e8, 0x94ea, + /* 0x6f */ + 0x94e9, 0x94eb, 0x94ee, 0x94ef, 0x94f3, 0x94f4, 0x94f5, 0x94f7, + 0x94f9, 0x94fc, 0x94fd, 0x94ff, 0x9503, 0x9502, 0x9506, 0x9507, + 0x9509, 0x950a, 0x950d, 0x950e, 0x950f, 0x9512, 0x9513, 0x9514, + 0x9515, 0x9516, 0x9518, 0x951b, 0x951d, 0x951e, 0x951f, 0x9522, + 0x952a, 0x952b, 0x9529, 0x952c, 0x9531, 0x9532, 0x9534, 0x9536, + 0x9537, 0x9538, 0x953c, 0x953e, 0x953f, 0x9542, 0x9535, 0x9544, + 0x9545, 0x9546, 0x9549, 0x954c, 0x954e, 0x954f, 0x9552, 0x9553, + 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955b, 0x955e, 0x955f, + 0x955d, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, + 0x9569, 0x956a, 0x956b, 0x956c, 0x956f, 0x9571, 0x9572, 0x9573, + 0x953a, 0x77e7, 0x77ec, 0x96c9, 0x79d5, 0x79ed, 0x79e3, 0x79eb, + 0x7a06, 0x5d47, 0x7a03, 0x7a02, 0x7a1e, 0x7a14, + /* 0x70 */ + 0x7a39, 0x7a37, 0x7a51, 0x9ecf, 0x99a5, 0x7a70, 0x7688, 0x768e, + 0x7693, 0x7699, 0x76a4, 0x74de, 0x74e0, 0x752c, 0x9e20, 0x9e22, + 0x9e28, 0x9e29, 0x9e2a, 0x9e2b, 0x9e2c, 0x9e32, 0x9e31, 0x9e36, + 0x9e38, 0x9e37, 0x9e39, 0x9e3a, 0x9e3e, 0x9e41, 0x9e42, 0x9e44, + 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4b, 0x9e4c, 0x9e4e, 0x9e51, + 0x9e55, 0x9e57, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5e, 0x9e63, 0x9e66, + 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e71, 0x9e6d, + 0x9e73, 0x7592, 0x7594, 0x7596, 0x75a0, 0x759d, 0x75ac, 0x75a3, + 0x75b3, 0x75b4, 0x75b8, 0x75c4, 0x75b1, 0x75b0, 0x75c3, 0x75c2, + 0x75d6, 0x75cd, 0x75e3, 0x75e8, 0x75e6, 0x75e4, 0x75eb, 0x75e7, + 0x7603, 0x75f1, 0x75fc, 0x75ff, 0x7610, 0x7600, 0x7605, 0x760c, + 0x7617, 0x760a, 0x7625, 0x7618, 0x7615, 0x7619, + /* 0x71 */ + 0x761b, 0x763c, 0x7622, 0x7620, 0x7640, 0x762d, 0x7630, 0x763f, + 0x7635, 0x7643, 0x763e, 0x7633, 0x764d, 0x765e, 0x7654, 0x765c, + 0x7656, 0x766b, 0x766f, 0x7fca, 0x7ae6, 0x7a78, 0x7a79, 0x7a80, + 0x7a86, 0x7a88, 0x7a95, 0x7aa6, 0x7aa0, 0x7aac, 0x7aa8, 0x7aad, + 0x7ab3, 0x8864, 0x8869, 0x8872, 0x887d, 0x887f, 0x8882, 0x88a2, + 0x88c6, 0x88b7, 0x88bc, 0x88c9, 0x88e2, 0x88ce, 0x88e3, 0x88e5, + 0x88f1, 0x891a, 0x88fc, 0x88e8, 0x88fe, 0x88f0, 0x8921, 0x8919, + 0x8913, 0x891b, 0x890a, 0x8934, 0x892b, 0x8936, 0x8941, 0x8966, + 0x897b, 0x758b, 0x80e5, 0x76b2, 0x76b4, 0x77dc, 0x8012, 0x8014, + 0x8016, 0x801c, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, 0x8029, + 0x8028, 0x8031, 0x800b, 0x8035, 0x8043, 0x8046, 0x804d, 0x8052, + 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, + /* 0x72 */ + 0x9889, 0x988c, 0x988d, 0x988f, 0x9894, 0x989a, 0x989b, 0x989e, + 0x989f, 0x98a1, 0x98a2, 0x98a5, 0x98a6, 0x864d, 0x8654, 0x866c, + 0x866e, 0x867f, 0x867a, 0x867c, 0x867b, 0x86a8, 0x868d, 0x868b, + 0x86ac, 0x869d, 0x86a7, 0x86a3, 0x86aa, 0x8693, 0x86a9, 0x86b6, + 0x86c4, 0x86b5, 0x86ce, 0x86b0, 0x86ba, 0x86b1, 0x86af, 0x86c9, + 0x86cf, 0x86b4, 0x86e9, 0x86f1, 0x86f2, 0x86ed, 0x86f3, 0x86d0, + 0x8713, 0x86de, 0x86f4, 0x86df, 0x86d8, 0x86d1, 0x8703, 0x8707, + 0x86f8, 0x8708, 0x870a, 0x870d, 0x8709, 0x8723, 0x873b, 0x871e, + 0x8725, 0x872e, 0x871a, 0x873e, 0x8748, 0x8734, 0x8731, 0x8729, + 0x8737, 0x873f, 0x8782, 0x8722, 0x877d, 0x877e, 0x877b, 0x8760, + 0x8770, 0x874c, 0x876e, 0x878b, 0x8753, 0x8763, 0x877c, 0x8764, + 0x8759, 0x8765, 0x8793, 0x87af, 0x87a8, 0x87d2, + /* 0x73 */ + 0x87c6, 0x8788, 0x8785, 0x87ad, 0x8797, 0x8783, 0x87ab, 0x87e5, + 0x87ac, 0x87b5, 0x87b3, 0x87cb, 0x87d3, 0x87bd, 0x87d1, 0x87c0, + 0x87ca, 0x87db, 0x87ea, 0x87e0, 0x87ee, 0x8816, 0x8813, 0x87fe, + 0x880a, 0x881b, 0x8821, 0x8839, 0x883c, 0x7f36, 0x7f42, 0x7f44, + 0x7f45, 0x8210, 0x7afa, 0x7afd, 0x7b08, 0x7b03, 0x7b04, 0x7b15, + 0x7b0a, 0x7b2b, 0x7b0f, 0x7b47, 0x7b38, 0x7b2a, 0x7b19, 0x7b2e, + 0x7b31, 0x7b20, 0x7b25, 0x7b24, 0x7b33, 0x7b3e, 0x7b1e, 0x7b58, + 0x7b5a, 0x7b45, 0x7b75, 0x7b4c, 0x7b5d, 0x7b60, 0x7b6e, 0x7b7b, + 0x7b62, 0x7b72, 0x7b71, 0x7b90, 0x7ba6, 0x7ba7, 0x7bb8, 0x7bac, + 0x7b9d, 0x7ba8, 0x7b85, 0x7baa, 0x7b9c, 0x7ba2, 0x7bab, 0x7bb4, + 0x7bd1, 0x7bc1, 0x7bcc, 0x7bdd, 0x7bda, 0x7be5, 0x7be6, 0x7bea, + 0x7c0c, 0x7bfe, 0x7bfc, 0x7c0f, 0x7c16, 0x7c0b, + /* 0x74 */ + 0x7c1f, 0x7c2a, 0x7c26, 0x7c38, 0x7c41, 0x7c40, 0x81fe, 0x8201, + 0x8202, 0x8204, 0x81ec, 0x8844, 0x8221, 0x8222, 0x8223, 0x822d, + 0x822f, 0x8228, 0x822b, 0x8238, 0x823b, 0x8233, 0x8234, 0x823e, + 0x8244, 0x8249, 0x824b, 0x824f, 0x825a, 0x825f, 0x8268, 0x887e, + 0x8885, 0x8888, 0x88d8, 0x88df, 0x895e, 0x7f9d, 0x7f9f, 0x7fa7, + 0x7faf, 0x7fb0, 0x7fb2, 0x7c7c, 0x6549, 0x7c91, 0x7c9d, 0x7c9c, + 0x7c9e, 0x7ca2, 0x7cb2, 0x7cbc, 0x7cbd, 0x7cc1, 0x7cc7, 0x7ccc, + 0x7ccd, 0x7cc8, 0x7cc5, 0x7cd7, 0x7ce8, 0x826e, 0x66a8, 0x7fbf, + 0x7fce, 0x7fd5, 0x7fe5, 0x7fe1, 0x7fe6, 0x7fe9, 0x7fee, 0x7ff3, + 0x7cf8, 0x7d77, 0x7da6, 0x7dae, 0x7e47, 0x7e9b, 0x9eb8, 0x9eb4, + 0x8d73, 0x8d84, 0x8d94, 0x8d91, 0x8db1, 0x8d67, 0x8d6d, 0x8c47, + 0x8c49, 0x914a, 0x9150, 0x914e, 0x914f, 0x9164, + /* 0x75 */ + 0x9162, 0x9161, 0x9170, 0x9169, 0x916f, 0x917d, 0x917e, 0x9172, + 0x9174, 0x9179, 0x918c, 0x9185, 0x9190, 0x918d, 0x9191, 0x91a2, + 0x91a3, 0x91aa, 0x91ad, 0x91ae, 0x91af, 0x91b5, 0x91b4, 0x91ba, + 0x8c55, 0x9e7e, 0x8db8, 0x8deb, 0x8e05, 0x8e59, 0x8e69, 0x8db5, + 0x8dbf, 0x8dbc, 0x8dba, 0x8dc4, 0x8dd6, 0x8dd7, 0x8dda, 0x8dde, + 0x8dce, 0x8dcf, 0x8ddb, 0x8dc6, 0x8dec, 0x8df7, 0x8df8, 0x8de3, + 0x8df9, 0x8dfb, 0x8de4, 0x8e09, 0x8dfd, 0x8e14, 0x8e1d, 0x8e1f, + 0x8e2c, 0x8e2e, 0x8e23, 0x8e2f, 0x8e3a, 0x8e40, 0x8e39, 0x8e35, + 0x8e3d, 0x8e31, 0x8e49, 0x8e41, 0x8e42, 0x8e51, 0x8e52, 0x8e4a, + 0x8e70, 0x8e76, 0x8e7c, 0x8e6f, 0x8e74, 0x8e85, 0x8e8f, 0x8e94, + 0x8e90, 0x8e9c, 0x8e9e, 0x8c78, 0x8c82, 0x8c8a, 0x8c85, 0x8c98, + 0x8c94, 0x659b, 0x89d6, 0x89de, 0x89da, 0x89dc, + /* 0x76 */ + 0x89e5, 0x89eb, 0x89ef, 0x8a3e, 0x8b26, 0x9753, 0x96e9, 0x96f3, + 0x96ef, 0x9706, 0x9701, 0x9708, 0x970f, 0x970e, 0x972a, 0x972d, + 0x9730, 0x973e, 0x9f80, 0x9f83, 0x9f85, 0x9f86, 0x9f87, 0x9f88, + 0x9f89, 0x9f8a, 0x9f8c, 0x9efe, 0x9f0b, 0x9f0d, 0x96b9, 0x96bc, + 0x96bd, 0x96ce, 0x96d2, 0x77bf, 0x96e0, 0x928e, 0x92ae, 0x92c8, + 0x933e, 0x936a, 0x93ca, 0x938f, 0x943e, 0x946b, 0x9c7f, 0x9c82, + 0x9c85, 0x9c86, 0x9c87, 0x9c88, 0x7a23, 0x9c8b, 0x9c8e, 0x9c90, + 0x9c91, 0x9c92, 0x9c94, 0x9c95, 0x9c9a, 0x9c9b, 0x9c9e, 0x9c9f, + 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, + 0x9ca9, 0x9cab, 0x9cad, 0x9cae, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, + 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cba, 0x9cbb, 0x9cbc, 0x9cbd, + 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cca, 0x9ccb, + /* 0x77 */ + 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0x9cd0, 0x9cd3, 0x9cd4, 0x9cd5, + 0x9cd7, 0x9cd8, 0x9cd9, 0x9cdc, 0x9cdd, 0x9cdf, 0x9ce2, 0x977c, + 0x9785, 0x9791, 0x9792, 0x9794, 0x97af, 0x97ab, 0x97a3, 0x97b2, + 0x97b4, 0x9ab1, 0x9ab0, 0x9ab7, 0x9e58, 0x9ab6, 0x9aba, 0x9abc, + 0x9ac1, 0x9ac0, 0x9ac5, 0x9ac2, 0x9acb, 0x9acc, 0x9ad1, 0x9b45, + 0x9b43, 0x9b47, 0x9b49, 0x9b48, 0x9b4d, 0x9b51, 0x98e8, 0x990d, + 0x992e, 0x9955, 0x9954, 0x9adf, 0x9ae1, 0x9ae6, 0x9aef, 0x9aeb, + 0x9afb, 0x9aed, 0x9af9, 0x9b08, 0x9b0f, 0x9b13, 0x9b1f, 0x9b23, + 0x9ebd, 0x9ebe, 0x7e3b, 0x9e82, 0x9e87, 0x9e88, 0x9e8b, 0x9e92, + 0x93d6, 0x9e9d, 0x9e9f, 0x9edb, 0x9edc, 0x9edd, 0x9ee0, 0x9edf, + 0x9ee2, 0x9ee9, 0x9ee7, 0x9ee5, 0x9eea, 0x9eef, 0x9f22, 0x9f2c, + 0x9f2f, 0x9f39, 0x9f37, 0x9f3d, 0x9f3e, 0x9f44, +}; + +static int +gb2312_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = (s[0] & 0x7F); + if ((c1 >= 0x21 && c1 <= 0x29) || (c1 >= 0x30 && c1 <= 0x77)) { + if (n >= 2) { + unsigned char c2 = (s[1] & 0x7F); + if (c2 >= 0x21 && c2 < 0x7f) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + unsigned short wc = 0xfffd; + if (i < 1410) { + if (i < 831) + wc = gb2312_2uni_page21[i]; + } else { + if (i < 8178) + wc = gb2312_2uni_page30[i-1410]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short gb2312_2charset[7445] = { + 0x2168, 0x216c, 0x2127, 0x2163, 0x2140, 0x2141, 0x2824, 0x2822, + 0x2828, 0x2826, 0x283a, 0x282c, 0x282a, 0x2830, 0x282e, 0x2142, + 0x2834, 0x2832, 0x2839, 0x2821, 0x2825, 0x2827, 0x2829, 0x282d, + 0x2831, 0x2823, 0x282b, 0x282f, 0x2833, 0x2835, 0x2836, 0x2837, + 0x2838, 0x2126, 0x2125, 0x2621, 0x2622, 0x2623, 0x2624, 0x2625, + 0x2626, 0x2627, 0x2628, 0x2629, 0x262a, 0x262b, 0x262c, 0x262d, + 0x262e, 0x262f, 0x2630, 0x2631, 0x2632, 0x2633, 0x2634, 0x2635, + 0x2636, 0x2637, 0x2638, 0x2641, 0x2642, 0x2643, 0x2644, 0x2645, + 0x2646, 0x2647, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, 0x264d, + 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x2654, 0x2655, + 0x2656, 0x2657, 0x2658, 0x2727, 0x2721, 0x2722, 0x2723, 0x2724, + 0x2725, 0x2726, 0x2728, 0x2729, 0x272a, 0x272b, 0x272c, 0x272d, + 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2735, + 0x2736, 0x2737, 0x2738, 0x2739, 0x273a, 0x273b, 0x273c, 0x273d, + 0x273e, 0x273f, 0x2740, 0x2741, 0x2751, 0x2752, 0x2753, 0x2754, + 0x2755, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, 0x275d, + 0x275e, 0x275f, 0x2760, 0x2761, 0x2762, 0x2763, 0x2764, 0x2765, + 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, 0x276d, + 0x276e, 0x276f, 0x2770, 0x2771, 0x2757, 0x212a, 0x212c, 0x212e, + 0x212f, 0x2130, 0x2131, 0x212d, 0x216b, 0x2164, 0x2165, 0x2179, + 0x2166, 0x216d, 0x2271, 0x2272, 0x2273, 0x2274, 0x2275, 0x2276, + 0x2277, 0x2278, 0x2279, 0x227a, 0x227b, 0x227c, 0x217b, 0x217c, + 0x217a, 0x217d, 0x214a, 0x2147, 0x2146, 0x214c, 0x2158, 0x215e, + 0x214f, 0x214e, 0x2144, 0x2145, 0x2149, 0x2148, 0x2152, 0x2153, + 0x2160, 0x215f, 0x2143, 0x214b, 0x2157, 0x2156, 0x2155, 0x2159, + 0x2154, 0x215c, 0x215d, 0x215a, 0x215b, 0x2151, 0x214d, 0x2150, + 0x2259, 0x225a, 0x225b, 0x225c, 0x225d, 0x225e, 0x225f, 0x2260, + 0x2261, 0x2262, 0x2245, 0x2246, 0x2247, 0x2248, 0x2249, 0x224a, + 0x224b, 0x224c, 0x224d, 0x224e, 0x224f, 0x2250, 0x2251, 0x2252, + 0x2253, 0x2254, 0x2255, 0x2256, 0x2257, 0x2258, 0x2231, 0x2232, + 0x2233, 0x2234, 0x2235, 0x2236, 0x2237, 0x2238, 0x2239, 0x223a, + 0x223b, 0x223c, 0x223d, 0x223e, 0x223f, 0x2240, 0x2241, 0x2242, + 0x2243, 0x2244, 0x2924, 0x2925, 0x2926, 0x2927, 0x2928, 0x2929, + 0x292a, 0x292b, 0x292c, 0x292d, 0x292e, 0x292f, 0x2930, 0x2931, + 0x2932, 0x2933, 0x2934, 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, + 0x293a, 0x293b, 0x293c, 0x293d, 0x293e, 0x293f, 0x2940, 0x2941, + 0x2942, 0x2943, 0x2944, 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, + 0x294a, 0x294b, 0x294c, 0x294d, 0x294e, 0x294f, 0x2950, 0x2951, + 0x2952, 0x2953, 0x2954, 0x2955, 0x2956, 0x2957, 0x2958, 0x2959, + 0x295a, 0x295b, 0x295c, 0x295d, 0x295e, 0x295f, 0x2960, 0x2961, + 0x2962, 0x2963, 0x2964, 0x2965, 0x2966, 0x2967, 0x2968, 0x2969, + 0x296a, 0x296b, 0x296c, 0x296d, 0x296e, 0x296f, 0x2176, 0x2175, + 0x2178, 0x2177, 0x2174, 0x2173, 0x2170, 0x2172, 0x2171, 0x216f, + 0x216e, 0x2162, 0x2161, 0x2121, 0x2122, 0x2123, 0x2128, 0x2129, + 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213a, 0x213b, + 0x213e, 0x213f, 0x217e, 0x2132, 0x2133, 0x213c, 0x213d, 0x2421, + 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, + 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, + 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, + 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, + 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, + 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, + 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, + 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, + 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, + 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, + 0x2472, 0x2473, 0x2521, 0x2522, 0x2523, 0x2524, 0x2525, 0x2526, + 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, 0x252d, 0x252e, + 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, 0x2535, 0x2536, + 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, 0x253d, 0x253e, + 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, + 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, + 0x254f, 0x2550, 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, + 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, + 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, + 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, + 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, + 0x2124, 0x2845, 0x2846, 0x2847, 0x2848, 0x2849, 0x284a, 0x284b, + 0x284c, 0x284d, 0x284e, 0x284f, 0x2850, 0x2851, 0x2852, 0x2853, + 0x2854, 0x2855, 0x2856, 0x2857, 0x2858, 0x2859, 0x285a, 0x285b, + 0x285c, 0x285d, 0x285e, 0x285f, 0x2860, 0x2861, 0x2862, 0x2863, + 0x2864, 0x2865, 0x2866, 0x2867, 0x2868, 0x2869, 0x2265, 0x2266, + 0x2267, 0x2268, 0x2269, 0x226a, 0x226b, 0x226c, 0x226d, 0x226e, + 0x523b, 0x3621, 0x465f, 0x4d72, 0x5549, 0x487d, 0x494f, 0x4f42, + 0x5822, 0x323b, 0x536b, 0x5824, 0x3373, 0x5728, 0x4752, 0x5827, + 0x4a40, 0x4770, 0x317b, 0x5235, 0x3454, 0x362b, 0x4b3f, 0x5829, + 0x362a, 0x413d, 0x514f, 0x4925, 0x582d, 0x3876, 0x513e, 0x635c, + 0x5650, 0x3761, 0x342e, 0x4159, 0x583c, 0x4d68, 0x3524, 0x4e2a, + 0x5677, 0x4076, 0x3e59, 0x582f, 0x444b, 0x3e43, 0x5831, 0x4334, + 0x5265, 0x562e, 0x4e5a, 0x5527, 0x3a75, 0x3726, 0x4056, 0x4639, + 0x4552, 0x4747, 0x3954, 0x334b, 0x5252, 0x583f, 0x3e45, 0x4672, + 0x5232, 0x4f30, 0x4f67, 0x4a69, 0x5840, 0x4272, 0x4252, 0x4869, + 0x472c, 0x414b, 0x5368, 0x5579, 0x4a42, 0x367e, 0x5821, 0x535a, + 0x3f77, 0x5446, 0x3b25, 0x5841, 0x4e65, 0x3e2e, 0x5828, 0x5147, + 0x5029, 0x583d, 0x596f, 0x4d76, 0x3f3a, 0x3d3b, 0x3a25, 0x5260, + 0x327a, 0x3a60, 0x4436, 0x4f6d, 0x3e29, 0x4d24, 0x4141, 0x4757, + 0x5971, 0x5974, 0x484b, 0x5869, 0x525a, 0x4a32, 0x484a, 0x586c, + 0x586a, 0x5846, 0x3d76, 0x464d, 0x3370, 0x586b, 0x3d71, 0x3d69, + 0x4854, 0x3453, 0x4258, 0x3256, 0x5750, 0x4a4b, 0x4b7b, 0x554c, + 0x3836, 0x4f49, 0x595a, 0x5870, 0x472a, 0x586e, 0x347a, 0x416e, + 0x5254, 0x586d, 0x5247, 0x586f, 0x4347, 0x5176, 0x5659, 0x5872, + 0x5875, 0x3c7e, 0x3c5b, 0x484e, 0x375d, 0x3742, 0x4673, 0x5878, + 0x5241, 0x4e69, 0x3c3f, 0x377c, 0x3725, 0x505d, 0x565a, 0x5345, + 0x3b6f, 0x3b61, 0x5871, 0x4921, 0x4e30, 0x342b, 0x5873, 0x494b, + 0x5876, 0x4257, 0x5877, 0x4e31, 0x5879, 0x322e, 0x3940, 0x5923, + 0x3069, 0x4166, 0x496c, 0x4b45, 0x4b46, 0x5924, 0x3568, 0x352b, + 0x4e3b, 0x354d, 0x5721, 0x5774, 0x5353, 0x4c65, 0x3a4e, 0x5922, + 0x595c, 0x5360, 0x587d, 0x3770, 0x5777, 0x587e, 0x587a, 0x5921, + 0x4463, 0x5336, 0x5874, 0x595d, 0x587b, 0x4565, 0x4050, 0x5170, + 0x305b, 0x3c51, 0x5926, 0x5925, 0x592c, 0x592e, 0x592b, 0x4a39, + 0x5929, 0x5636, 0x335e, 0x5928, 0x407d, 0x4a4c, 0x592a, 0x5927, + 0x5930, 0x3631, 0x3929, 0x5240, 0x4f40, 0x4242, 0x3d44, 0x556c, + 0x3260, 0x4748, 0x3f6b, 0x592d, 0x592f, 0x4e6a, 0x3a6e, 0x4756, + 0x3163, 0x3459, 0x366d, 0x5934, 0x3f21, 0x595e, 0x474e, 0x407e, + 0x5938, 0x4b57, 0x377d, 0x5935, 0x5937, 0x3123, 0x5361, 0x5939, + 0x5045, 0x5936, 0x5931, 0x5932, 0x4129, 0x5933, 0x3c73, 0x505e, + 0x3829, 0x3e63, 0x593d, 0x593a, 0x3033, 0x5942, 0x5944, 0x3136, + 0x593f, 0x3539, 0x3e73, 0x4c48, 0x3a72, 0x5250, 0x5943, 0x3d68, + 0x332b, 0x5945, 0x3e6b, 0x5946, 0x593b, 0x445f, 0x593e, 0x5941, + 0x5940, 0x552e, 0x5635, 0x4763, 0x5948, 0x3c59, 0x594a, 0x593c, + 0x594b, 0x462b, 0x5949, 0x5776, 0x4d23, 0x3d21, 0x594c, 0x453c, + 0x4d35, 0x594d, 0x5947, 0x3325, 0x3f7e, 0x3835, 0x407c, 0x3078, + 0x3476, 0x594e, 0x594f, 0x3422, 0x5950, 0x345f, 0x3041, 0x5951, + 0x4935, 0x4f71, 0x5952, 0x4145, 0x5956, 0x492e, 0x5955, 0x5954, + 0x5957, 0x4b5b, 0x3d29, 0x4627, 0x5953, 0x5958, 0x5959, 0x4865, + 0x405c, 0x3679, 0x5823, 0x544a, 0x542a, 0x5056, 0x3364, 0x5557, + 0x4f48, 0x3962, 0x3f4b, 0x4362, 0x3652, 0x4d43, 0x596e, 0x5970, + 0x3533, 0x3635, 0x3e24, 0x486b, 0x482b, 0x304b, 0x392b, 0x4179, + 0x5962, 0x403c, 0x3932, 0x3958, 0x504b, 0x3178, 0x4664, 0x3e5f, + 0x3564, 0x5748, 0x5178, 0x3c66, 0x4a5e, 0x3c3d, 0x5966, 0x5867, + 0x445a, 0x3854, 0x483d, 0x3261, 0x5459, 0x4330, 0x4361, 0x5a22, + 0x485f, 0x5034, 0x3e7c, 0x4529, 0x395a, 0x5a23, 0x5429, 0x5a24, + 0x597b, 0x362c, 0x376b, 0x3179, 0x597c, 0x3365, 0x3e76, 0x3f76, + 0x5231, 0x4064, 0x3633, 0x597e, 0x597d, 0x3e3b, 0x4660, 0x573c, + 0x5a21, 0x4139, 0x3572, 0x4168, 0x3c75, 0x3455, 0x415d, 0x447d, + 0x3c38, 0x3732, 0x376f, 0x596c, 0x463e, 0x3f2d, 0x3b4b, 0x354a, + 0x5b49, 0x5057, 0x4d39, 0x303c, 0x3376, 0x3b77, 0x5b4a, 0x3a2f, + 0x5464, 0x3536, 0x3573, 0x5856, 0x4850, 0x3756, 0x4750, 0x5857, + 0x3f2f, 0x5b3b, 0x5858, 0x504c, 0x3b2e, 0x6b3e, 0x4150, 0x4175, + 0x5472, 0x3855, 0x3434, 0x3375, 0x493e, 0x4550, 0x4559, 0x407b, + 0x3170, 0x5859, 0x394e, 0x353d, 0x585a, 0x5646, 0x4b22, 0x482f, + 0x4932, 0x344c, 0x3f4c, 0x3974, 0x585b, 0x585c, 0x3667, 0x3c41, + 0x4c6a, 0x4f77, 0x585d, 0x4730, 0x3950, 0x3d23, 0x4c5e, 0x464a, + 0x5860, 0x585e, 0x585f, 0x307e, 0x3e67, 0x4a23, 0x3c74, 0x3831, + 0x386e, 0x5862, 0x3d4b, 0x5864, 0x5863, 0x457c, 0x5865, 0x5866, + 0x4126, 0x4830, 0x306c, 0x3926, 0x3c53, 0x4e71, 0x5b3d, 0x4153, + 0x362f, 0x567a, 0x452c, 0x3d59, 0x5b3e, 0x5b3f, 0x4078, 0x3e22, + 0x404d, 0x5b40, 0x4a46, 0x322a, 0x5342, 0x4363, 0x512b, 0x5b42, + 0x4055, 0x5b43, 0x3f31, 0x443c, 0x475a, 0x5b44, 0x5968, 0x4957, + 0x3934, 0x4e70, 0x5448, 0x307c, 0x3452, 0x5059, 0x5969, 0x5e4b, + 0x596b, 0x5830, 0x3b2f, 0x3131, 0x3357, 0x584e, 0x5451, 0x3d33, + 0x3f6f, 0x4f3b, 0x5850, 0x374b, 0x5851, 0x4625, 0x4778, 0x523d, + 0x5852, 0x4464, 0x4a2e, 0x4727, 0x5826, 0x497d, 0x4e67, 0x3b5c, + 0x306b, 0x3b2a, 0x502d, 0x3130, 0x5764, 0x573f, 0x3525, 0x4274, + 0x444f, 0x3229, 0x3237, 0x3165, 0x5f32, 0x553c, 0x3f28, 0x422c, + 0x5855, 0x4231, 0x5854, 0x4e54, 0x5a60, 0x4e40, 0x5834, 0x432e, + 0x5321, 0x4e23, 0x3c34, 0x4834, 0x4251, 0x3e6d, 0x5036, 0x5a61, + 0x4764, 0x3327, 0x3672, 0x4c7c, 0x407a, 0x4077, 0x5139, 0x5161, + 0x5847, 0x325e, 0x4065, 0x3a71, 0x5848, 0x542d, 0x4f61, 0x5849, + 0x584a, 0x4f43, 0x3378, 0x3e47, 0x584b, 0x5b4c, 0x4825, 0x4f58, + 0x487e, 0x324e, 0x5356, 0x3266, 0x3c30, 0x5351, 0x4b2b, 0x3734, + 0x3722, 0x4a65, 0x4821, 0x4a5c, 0x3164, 0x5070, 0x4551, 0x5b45, + 0x357e, 0x3f5a, 0x3945, 0x3e64, 0x416d, 0x5f36, 0x5f35, 0x563b, + 0x3d50, 0x5559, 0x3048, 0x3623, 0x3f49, 0x4c28, 0x5f33, 0x4a37, + 0x5352, 0x584f, 0x5236, 0x3a45, 0x4b3e, 0x4c3e, 0x5f37, 0x3570, + 0x5f34, 0x5375, 0x3354, 0x3877, 0x5f3a, 0x3a4f, 0x3c2a, 0x3575, + 0x4d2c, 0x437b, 0x3a73, 0x4074, 0x4d42, 0x4f72, 0x5f38, 0x4f45, + 0x4240, 0x5f39, 0x4270, 0x3e7d, 0x415f, 0x4d4c, 0x5277, 0x374d, + 0x5f41, 0x5f44, 0x3771, 0x3049, 0x3656, 0x3754, 0x3a2c, 0x4c7d, + 0x3f54, 0x4b31, 0x4674, 0x5628, 0x5f45, 0x4e62, 0x3333, 0x4e7c, + 0x3435, 0x4e47, 0x3a70, 0x4e61, 0x513d, 0x5f40, 0x3474, 0x334a, + 0x3866, 0x5f3b, 0x4445, 0x5f3c, 0x5f3d, 0x5f3e, 0x453b, 0x5f3f, + 0x5f42, 0x5431, 0x5f43, 0x473a, 0x4e58, 0x4458, 0x5f4a, 0x5f4f, + 0x565c, 0x5f49, 0x5f5a, 0x4e36, 0x3a47, 0x5f4e, 0x5f48, 0x455e, + 0x496b, 0x3a74, 0x437c, 0x3e57, 0x5f46, 0x5f4d, 0x4558, 0x5526, + 0x3a4d, 0x3e4c, 0x533d, 0x3840, 0x5664, 0x5f47, 0x393e, 0x3f27, + 0x417c, 0x5f4b, 0x5f4c, 0x5f50, 0x5f5b, 0x5f65, 0x5f57, 0x5f56, + 0x5749, 0x5f63, 0x5f64, 0x656b, 0x5227, 0x5f52, 0x3f29, 0x545b, + 0x3f48, 0x5f54, 0x4f4c, 0x5f5d, 0x514a, 0x5f5e, 0x3027, 0x4637, + 0x5f53, 0x3a65, 0x365f, 0x4d5b, 0x397e, 0x5455, 0x5f5f, 0x4f6c, + 0x3025, 0x5f67, 0x5f51, 0x5146, 0x5f55, 0x5f58, 0x5f59, 0x5f5c, + 0x3b29, 0x5f60, 0x5f61, 0x5f62, 0x5f66, 0x5f68, 0x5334, 0x3867, + 0x4536, 0x5f6a, 0x495a, 0x4128, 0x4444, 0x3f5e, 0x4f78, 0x555c, + 0x5f6e, 0x3238, 0x3a5f, 0x5f6c, 0x5b41, 0x5164, 0x4b74, 0x343d, + 0x3026, 0x5f71, 0x4c46, 0x5f72, 0x5f6d, 0x5f69, 0x5f6b, 0x5f6f, + 0x5f70, 0x3b3d, 0x5f73, 0x5f74, 0x3b23, 0x4a5b, 0x4e28, 0x6027, + 0x332a, 0x6026, 0x6021, 0x5f7e, 0x4d59, 0x5f7c, 0x5f7a, 0x3f50, + 0x5744, 0x494c, 0x5f78, 0x3021, 0x5f7d, 0x5f7b, 0x6022, 0x6028, + 0x3748, 0x4621, 0x4936, 0x4032, 0x5f75, 0x453e, 0x5844, 0x5f79, + 0x4476, 0x6023, 0x6024, 0x6025, 0x5025, 0x6034, 0x4c64, 0x6031, + 0x3f26, 0x602f, 0x4e39, 0x602b, 0x4946, 0x402e, 0x602e, 0x3a6d, + 0x3a30, 0x6029, 0x5f76, 0x6033, 0x6038, 0x342d, 0x6039, 0x4f32, + 0x3a48, 0x6030, 0x507a, 0x602c, 0x547b, 0x5f77, 0x4567, 0x602d, + 0x5377, 0x6036, 0x6037, 0x6044, 0x5061, 0x603c, 0x6049, 0x604a, + 0x603e, 0x602a, 0x4924, 0x6041, 0x6032, 0x4a48, 0x6043, 0x6035, + 0x4e4b, 0x4b43, 0x604d, 0x6046, 0x6042, 0x604b, 0x603a, 0x603f, + 0x6040, 0x6045, 0x6047, 0x6048, 0x604c, 0x603b, 0x4b54, 0x6055, + 0x6056, 0x6052, 0x6050, 0x3c4e, 0x6051, 0x3842, 0x5845, 0x506a, + 0x426f, 0x604f, 0x603d, 0x6054, 0x6053, 0x6057, 0x605c, 0x6058, + 0x5676, 0x3330, 0x576c, 0x4b3b, 0x605a, 0x4e7b, 0x3a59, 0x6061, + 0x605d, 0x522d, 0x6062, 0x605b, 0x6059, 0x605f, 0x6060, 0x605e, + 0x6064, 0x4677, 0x582c, 0x546b, 0x6066, 0x4a49, 0x6065, 0x3841, + 0x6067, 0x6068, 0x6069, 0x6063, 0x3a3f, 0x4c67, 0x606a, 0x4f79, + 0x606b, 0x4842, 0x3d40, 0x4452, 0x606c, 0x606d, 0x4774, 0x4b44, + 0x606e, 0x3b58, 0x5836, 0x5272, 0x606f, 0x4d45, 0x365a, 0x6071, + 0x5430, 0x4027, 0x3451, 0x4e27, 0x6070, 0x6072, 0x394c, 0x397a, + 0x4d3c, 0x6073, 0x4654, 0x6074, 0x5432, 0x4826, 0x6076, 0x6075, + 0x6077, 0x4d41, 0x4a25, 0x545a, 0x5b57, 0x5b59, 0x5b58, 0x3967, + 0x5b5c, 0x5b5d, 0x3558, 0x5b5a, 0x5b5b, 0x3321, 0x5b5f, 0x3b78, + 0x5637, 0x5b60, 0x3e79, 0x373b, 0x5b50, 0x4c2e, 0x3f32, 0x3b35, + 0x5778, 0x3f53, 0x3f69, 0x3c61, 0x4c33, 0x5b5e, 0x3053, 0x4e6b, + 0x3758, 0x5739, 0x4642, 0x4024, 0x4c39, 0x5b67, 0x5b61, 0x463a, + 0x5b63, 0x5b68, 0x4577, 0x5b6a, 0x5b69, 0x3f40, 0x5b66, 0x5b65, + 0x3439, 0x402c, 0x4222, 0x5b62, 0x5b64, 0x504d, 0x5b6d, 0x405d, + 0x5b72, 0x3662, 0x5b73, 0x5b52, 0x3938, 0x542b, 0x5b6c, 0x3f51, + 0x5b70, 0x5b51, 0x3566, 0x5b6b, 0x3f65, 0x5b6e, 0x5b71, 0x5b79, + 0x3921, 0x3023, 0x4271, 0x3347, 0x5b6f, 0x5b78, 0x4652, 0x5b74, + 0x5b75, 0x5b77, 0x5b76, 0x5b7e, 0x5372, 0x323a, 0x5b7d, 0x5c24, + 0x5b7b, 0x5b7a, 0x5b7c, 0x4560, 0x3b79, 0x5c23, 0x5c25, 0x4c43, + 0x3651, 0x5d40, 0x5c21, 0x5c22, 0x4735, 0x3669, 0x5c27, 0x5c26, + 0x5c29, 0x3124, 0x354c, 0x3f30, 0x515f, 0x3642, 0x5c28, 0x4b7a, + 0x6b73, 0x4b5c, 0x4b7e, 0x4c41, 0x487b, 0x5c2a, 0x4c6e, 0x5c2b, + 0x5b53, 0x5c2f, 0x5c2c, 0x3e33, 0x4a7b, 0x5c2d, 0x494a, 0x4439, + 0x473d, 0x5c2e, 0x5476, 0x5066, 0x442b, 0x3655, 0x5b54, 0x315a, + 0x5b55, 0x5b56, 0x3a3e, 0x4840, 0x4a3f, 0x4849, 0x5733, 0x4979, + 0x3f47, 0x3a78, 0x523c, 0x623a, 0x3426, 0x3138, 0x3834, 0x4f44, + 0x5967, 0x4f26, 0x4d62, 0x596d, 0x3660, 0x5239, 0x393b, 0x6239, + 0x6237, 0x3473, 0x4c6c, 0x4c2b, 0x3772, 0x5832, 0x516b, 0x3a3b, + 0x4a27, 0x4d37, 0x5244, 0x3f64, 0x3c50, 0x3661, 0x5e45, 0x5e46, + 0x5b3c, 0x5159, 0x4666, 0x444e, 0x376e, 0x375c, 0x3f7c, 0x5760, + 0x4675, 0x313c, 0x5e48, 0x3d31, 0x4c57, 0x5e4a, 0x5e49, 0x356c, + 0x495d, 0x3042, 0x452e, 0x452b, 0x444c, 0x3c69, 0x4b7d, 0x3a43, + 0x6579, 0x4867, 0x657a, 0x4d7d, 0x5731, 0x383e, 0x4268, 0x4851, + 0x657b, 0x364a, 0x3c4b, 0x517d, 0x6621, 0x436e, 0x6624, 0x657e, + 0x6625, 0x4d57, 0x3741, 0x657c, 0x657d, 0x6623, 0x445d, 0x6628, + 0x6627, 0x4343, 0x465e, 0x662a, 0x4437, 0x6622, 0x4a3c, 0x3d63, + 0x3943, 0x6626, 0x5055, 0x4e2f, 0x6629, 0x6630, 0x5226, 0x3d2a, + 0x662d, 0x662f, 0x4051, 0x524c, 0x3c27, 0x6631, 0x5276, 0x574b, + 0x4d7e, 0x4d5e, 0x4226, 0x662b, 0x662c, 0x3d3f, 0x662e, 0x6633, + 0x6632, 0x6636, 0x6638, 0x446f, 0x4448, 0x3e6a, 0x496f, 0x6637, + 0x3670, 0x4364, 0x5369, 0x6634, 0x6635, 0x4822, 0x663d, 0x6639, + 0x4645, 0x4d71, 0x663b, 0x663c, 0x3b69, 0x663e, 0x663a, 0x4037, + 0x5324, 0x663f, 0x4974, 0x6643, 0x6644, 0x5076, 0x433d, 0x4344, + 0x6642, 0x6641, 0x6647, 0x4f31, 0x6b74, 0x664a, 0x6645, 0x3c5e, + 0x4929, 0x3c35, 0x4f53, 0x6648, 0x6649, 0x664e, 0x6650, 0x6651, + 0x664b, 0x3555, 0x664c, 0x664f, 0x445b, 0x6646, 0x664d, 0x6652, + 0x6654, 0x6653, 0x6655, 0x5978, 0x6656, 0x6657, 0x5753, 0x665d, + 0x665e, 0x3f57, 0x5450, 0x5756, 0x3466, 0x4b6f, 0x665a, 0x5843, + 0x574e, 0x5022, 0x434f, 0x665f, 0x3c3e, 0x3942, 0x665b, 0x5127, + 0x3a22, 0x424f, 0x582b, 0x4a6b, 0x656e, 0x665c, 0x3775, 0x4866, + 0x4475, 0x6532, 0x447e, 0x4b7c, 0x6533, 0x552c, 0x536e, 0x4a58, + 0x3032, 0x4b4e, 0x4d6a, 0x3a6a, 0x6535, 0x6534, 0x575a, 0x3959, + 0x5666, 0x3628, 0x4d70, 0x524b, 0x3126, 0x4a35, 0x3368, 0x4973, + 0x3f4d, 0x507b, 0x4a52, 0x6536, 0x3b42, 0x4f5c, 0x392c, 0x5457, + 0x3a26, 0x5167, 0x4f7c, 0x3c52, 0x6537, 0x485d, 0x3f6d, 0x3176, + 0x4b5e, 0x3c45, 0x3c44, 0x527a, 0x435c, 0x3f5c, 0x383b, 0x4342, + 0x3a2e, 0x5422, 0x475e, 0x442f, 0x326c, 0x3951, 0x653b, 0x4148, + 0x552f, 0x653c, 0x653e, 0x3467, 0x3654, 0x4b42, 0x5130, 0x353c, + 0x4a59, 0x3762, 0x4964, 0x3d2b, 0x4e3e, 0x5770, 0x5021, 0x4959, + 0x367b, 0x6658, 0x3c62, 0x333e, 0x4950, 0x6659, 0x3322, 0x5e4c, + 0x5348, 0x5e4d, 0x5222, 0x5e4e, 0x3e4d, 0x5e4f, 0x4a2c, 0x527c, + 0x335f, 0x656a, 0x4461, 0x3e21, 0x4e32, 0x4472, 0x3e56, 0x4628, + 0x3263, 0x3e53, 0x477c, 0x4c6b, 0x3d6c, 0x4e5d, 0x4a3a, 0x4641, + 0x656c, 0x503c, 0x5539, 0x656d, 0x4a74, 0x4d40, 0x4245, 0x656f, + 0x4244, 0x6570, 0x6578, 0x4d4d, 0x493d, 0x5259, 0x6128, 0x536c, + 0x4b6a, 0x4671, 0x612c, 0x6127, 0x6129, 0x612a, 0x612f, 0x326d, + 0x612b, 0x385a, 0x612d, 0x612e, 0x6130, 0x353a, 0x6131, 0x6133, + 0x6138, 0x5152, 0x6136, 0x6135, 0x416b, 0x6137, 0x5440, 0x6132, + 0x613a, 0x3036, 0x6134, 0x3f79, 0x6139, 0x613b, 0x613e, 0x613c, + 0x5645, 0x4f3f, 0x613d, 0x613f, 0x424d, 0x366b, 0x5378, 0x474d, + 0x3765, 0x3e7e, 0x6140, 0x6141, 0x6147, 0x3367, 0x4669, 0x345e, + 0x5142, 0x6148, 0x6146, 0x6145, 0x6143, 0x6142, 0x3140, 0x5538, + 0x6144, 0x614b, 0x614c, 0x614a, 0x6f7a, 0x6153, 0x6152, 0x4736, + 0x6149, 0x614e, 0x6150, 0x6154, 0x6151, 0x614d, 0x614f, 0x6155, + 0x6156, 0x6157, 0x6158, 0x615a, 0x615b, 0x4e21, 0x675d, 0x3428, + 0x565d, 0x5132, 0x3332, 0x3924, 0x5773, 0x4749, 0x3e5e, 0x392e, + 0x4e57, 0x326e, 0x5b4f, 0x3c3a, 0x5251, 0x4b48, 0x304d, 0x4f6f, + 0x5963, 0x3d6d, 0x3152, 0x4a50, 0x323c, 0x4b27, 0x372b, 0x4a26, + 0x4f23, 0x6078, 0x554a, 0x607b, 0x607a, 0x4541, 0x4c7b, 0x4131, + 0x6079, 0x5663, 0x322f, 0x5644, 0x355b, 0x3478, 0x5621, 0x4f2f, + 0x306f, 0x607c, 0x6121, 0x3323, 0x607d, 0x607e, 0x4331, 0x435d, + 0x6122, 0x3779, 0x3b4f, 0x6123, 0x443b, 0x6124, 0x6125, 0x6126, + 0x3431, 0x3849, 0x463d, 0x446a, 0x3222, 0x5052, 0x675b, 0x3b43, + 0x5357, 0x5344, 0x3963, 0x624f, 0x572f, 0x476c, 0x3153, 0x3432, + 0x6251, 0x5072, 0x422e, 0x6250, 0x3f62, 0x5326, 0x3557, 0x6252, + 0x356a, 0x436d, 0x387d, 0x382e, 0x4553, 0x374f, 0x6254, 0x6253, + 0x3648, 0x5779, 0x4d25, 0x6258, 0x6256, 0x4a7c, 0x3f35, 0x5339, + 0x6255, 0x6257, 0x412e, 0x4048, 0x625b, 0x625a, 0x402a, 0x414e, + 0x625c, 0x625d, 0x625e, 0x5b48, 0x5153, 0x4d22, 0x3d28, 0x5e43, + 0x5825, 0x3f2a, 0x5b4d, 0x526c, 0x467a, 0x452a, 0x5e44, 0x3157, + 0x5f2e, 0x4a3d, 0x5f31, 0x392d, 0x527d, 0x3825, 0x3a6b, 0x335a, + 0x355c, 0x5545, 0x4356, 0x4f52, 0x3b21, 0x6573, 0x6572, 0x6574, + 0x4d64, 0x4875, 0x352f, 0x473f, 0x6576, 0x6c30, 0x6566, 0x3969, + 0x3531, 0x423c, 0x6568, 0x6567, 0x6569, 0x524d, 0x616a, 0x504e, + 0x4d2e, 0x5165, 0x324a, 0x316b, 0x3172, 0x456d, 0x5543, 0x5330, + 0x615c, 0x615d, 0x525b, 0x3339, 0x314b, 0x4d79, 0x5577, 0x615e, + 0x3e36, 0x347d, 0x615f, 0x3a5c, 0x6160, 0x3b32, 0x4249, 0x6161, + 0x506c, 0x4d3d, 0x6162, 0x3543, 0x4547, 0x6163, 0x6164, 0x5379, + 0x6165, 0x512d, 0x6166, 0x4e22, 0x6167, 0x3542, 0x6168, 0x3b55, + 0x5044, 0x6260, 0x3158, 0x5264, 0x6261, 0x3c49, 0x484c, 0x6263, + 0x6c7e, 0x6c7d, 0x5f2f, 0x6262, 0x563e, 0x4d7c, 0x4326, 0x6343, + 0x5652, 0x6267, 0x6268, 0x5347, 0x626c, 0x3f6c, 0x626d, 0x6265, + 0x3340, 0x446e, 0x626e, 0x5043, 0x3a76, 0x6269, 0x375e, 0x3b33, + 0x4c2c, 0x4b4b, 0x6264, 0x6266, 0x626a, 0x626b, 0x6277, 0x6274, + 0x5475, 0x6273, 0x452d, 0x557a, 0x4542, 0x3240, 0x626f, 0x6272, + 0x412f, 0x4b3c, 0x3521, 0x6279, 0x3c31, 0x6271, 0x5054, 0x5439, + 0x6275, 0x3956, 0x6276, 0x4753, 0x6270, 0x575c, 0x6d21, 0x6278, + 0x6d25, 0x627e, 0x4a51, 0x4135, 0x3b50, 0x3f56, 0x3a63, 0x4b21, + 0x6d26, 0x6d23, 0x6d22, 0x3b56, 0x6d27, 0x5074, 0x6d24, 0x3a5e, + 0x3677, 0x6321, 0x3632, 0x4c71, 0x3927, 0x4f22, 0x4721, 0x3f52, + 0x3671, 0x627a, 0x627b, 0x627d, 0x627c, 0x4455, 0x6322, 0x5341, + 0x6327, 0x4744, 0x4f24, 0x6329, 0x3a37, 0x6328, 0x3b5a, 0x6323, + 0x6324, 0x632a, 0x6326, 0x4e72, 0x5346, 0x3b3c, 0x5443, 0x447a, + 0x6d28, 0x507c, 0x6325, 0x4375, 0x632d, 0x312f, 0x6332, 0x3c42, + 0x632c, 0x353f, 0x4769, 0x6330, 0x3e2a, 0x4d6f, 0x3b73, 0x4c68, + 0x632f, 0x6331, 0x4f27, 0x632e, 0x4e29, 0x3b5d, 0x356b, 0x3e65, + 0x3252, 0x334d, 0x3139, 0x632b, 0x3251, 0x352c, 0x395f, 0x3668, + 0x4f6b, 0x6337, 0x3b4c, 0x4847, 0x504a, 0x6338, 0x336e, 0x6d29, + 0x537a, 0x5364, 0x6d2a, 0x6339, 0x5262, 0x6335, 0x535e, 0x3850, + 0x6333, 0x6336, 0x375f, 0x6334, 0x4022, 0x633a, 0x5438, 0x3448, + 0x633b, 0x3b45, 0x4977, 0x4965, 0x443d, 0x6d2b, 0x427d, 0x3b5b, + 0x3f2e, 0x4e3f, 0x633c, 0x3f36, 0x316f, 0x5477, 0x633e, 0x6d2d, + 0x633f, 0x3a29, 0x6d2c, 0x633d, 0x6340, 0x3a36, 0x362e, 0x5038, + 0x3043, 0x6d2e, 0x6d2f, 0x4041, 0x6341, 0x4533, 0x6342, 0x5c32, + 0x6d30, 0x386a, 0x4e6c, 0x6a27, 0x5067, 0x4a79, 0x4856, 0x4f37, + 0x3349, 0x4e52, 0x3d64, 0x635e, 0x3b72, 0x6a28, 0x553d, 0x465d, + 0x6a29, 0x6a2a, 0x6a2c, 0x6a2b, 0x6a2e, 0x6a2d, 0x3d58, 0x6a2f, + 0x423e, 0x3441, 0x3477, 0x3b27, 0x6c66, 0x6c65, 0x373f, 0x4b79, + 0x3162, 0x6c67, 0x4948, 0x6c68, 0x6c69, 0x4a56, 0x5e50, 0x3245, + 0x547a, 0x464b, 0x3047, 0x3472, 0x4853, 0x4d50, 0x3f38, 0x3f5b, + 0x4724, 0x5634, 0x4029, 0x5e51, 0x4928, 0x516f, 0x4524, 0x3067, + 0x3336, 0x4845, 0x3062, 0x3776, 0x457a, 0x3673, 0x5552, 0x3350, + 0x3c3c, 0x332d, 0x3e71, 0x3051, 0x5256, 0x4a63, 0x5725, 0x4d36, + 0x3636, 0x3f39, 0x555b, 0x3827, 0x4557, 0x5e52, 0x3f59, 0x4255, + 0x4740, 0x3b24, 0x3128, 0x456a, 0x457b, 0x4c27, 0x3127, 0x3556, + 0x4428, 0x5e53, 0x513a, 0x3369, 0x4372, 0x3777, 0x5674, 0x3523, + 0x3270, 0x4434, 0x4469, 0x402d, 0x5e54, 0x3068, 0x4544, 0x4160, + 0x3955, 0x3e5c, 0x4d58, 0x304e, 0x4d4f, 0x5e56, 0x3e50, 0x573e, + 0x5e55, 0x5550, 0x305d, 0x4462, 0x4223, 0x3c70, 0x5335, 0x4039, + 0x4521, 0x3226, 0x5471, 0x4028, 0x4a43, 0x5e57, 0x557c, 0x3930, + 0x482d, 0x4b29, 0x5e59, 0x3f3d, 0x4634, 0x5727, 0x4a30, 0x4443, + 0x3356, 0x3952, 0x5638, 0x6a7c, 0x3034, 0x3f66, 0x4c74, 0x4d5a, + 0x563f, 0x424e, 0x4e4e, 0x4c22, 0x502e, 0x4453, 0x3532, 0x5e58, + 0x5575, 0x3c37, 0x3b53, 0x3024, 0x4532, 0x346c, 0x5571, 0x6a7d, + 0x5e5a, 0x4d26, 0x4d6c, 0x4e66, 0x5e5c, 0x4d31, 0x4026, 0x573d, + 0x5e5b, 0x3046, 0x3a34, 0x4953, 0x4473, 0x3e68, 0x3236, 0x404c, + 0x4b70, 0x3c71, 0x3b3b, 0x3537, 0x4575, 0x5e66, 0x5e63, 0x3e5d, + 0x5e5f, 0x3437, 0x3d5d, 0x5e60, 0x446d, 0x4f46, 0x3560, 0x365e, + 0x4a5a, 0x3574, 0x5e65, 0x5546, 0x5e61, 0x4c4d, 0x467e, 0x4545, + 0x5234, 0x3e72, 0x4253, 0x4c3d, 0x3338, 0x3d53, 0x3f58, 0x4d46, + 0x515a, 0x346b, 0x5e64, 0x5e5d, 0x5e67, 0x6a7e, 0x4230, 0x5e62, + 0x5640, 0x3527, 0x3274, 0x5e68, 0x5e72, 0x5e6d, 0x5e71, 0x4860, + 0x5761, 0x5e6f, 0x4368, 0x4c61, 0x3265, 0x523e, 0x5e6e, 0x5e6b, + 0x4e55, 0x3427, 0x3f2b, 0x3e3e, 0x3d52, 0x5e69, 0x542e, 0x5e5e, + 0x5e6a, 0x403f, 0x5e6c, 0x3273, 0x3869, 0x4227, 0x3d41, 0x5e75, + 0x5e78, 0x322b, 0x3424, 0x346a, 0x4926, 0x5e76, 0x4b51, 0x3863, + 0x5e77, 0x5e7a, 0x5e79, 0x4c42, 0x3061, 0x346e, 0x653a, 0x502f, + 0x326b, 0x6b21, 0x5e74, 0x4963, 0x5e73, 0x305a, 0x5221, 0x3177, + 0x4c2f, 0x5e70, 0x4b24, 0x552a, 0x5e7b, 0x345d, 0x4426, 0x5e7d, + 0x437e, 0x4421, 0x5f21, 0x414c, 0x5e7c, 0x3e6f, 0x4632, 0x3345, + 0x4876, 0x4b3a, 0x5e7e, 0x5f24, 0x5732, 0x3337, 0x4143, 0x474b, + 0x3225, 0x3469, 0x572b, 0x446c, 0x5f22, 0x5f23, 0x5f25, 0x3a33, + 0x5f26, 0x405e, 0x4943, 0x3259, 0x4766, 0x5f27, 0x475c, 0x5f28, + 0x6b22, 0x4b53, 0x5f2a, 0x5f29, 0x3241, 0x454a, 0x5f2b, 0x545c, + 0x4841, 0x5f2c, 0x3e70, 0x5f2d, 0x5627, 0x6a37, 0x6b36, 0x4a55, + 0x587c, 0x3844, 0x3925, 0x3745, 0x557e, 0x394a, 0x5027, 0x744d, + 0x3550, 0x4374, 0x3e48, 0x6b37, 0x303d, 0x3d4c, 0x4132, 0x3156, + 0x3328, 0x3852, 0x4922, 0x3658, 0x6b38, 0x3e34, 0x4a7d, 0x4743, + 0x557b, 0x3773, 0x4e44, 0x552b, 0x3173, 0x6c33, 0x305f, 0x6c35, + 0x3637, 0x414f, 0x757a, 0x5031, 0x5565, 0x4e53, 0x3d6f, 0x3362, + 0x382b, 0x5536, 0x6d3d, 0x364f, 0x4b39, 0x5042, 0x373d, 0x6c36, + 0x4a29, 0x4554, 0x6c39, 0x6c38, 0x4243, 0x6c37, 0x507d, 0x6c3a, + 0x6c3b, 0x5765, 0x6c3c, 0x6c3d, 0x466c, 0x4e5e, 0x3c48, 0x4855, + 0x3529, 0x3e49, 0x563c, 0x5467, 0x512e, 0x5071, 0x6a38, 0x6a39, + 0x6a3a, 0x3a35, 0x4a31, 0x3f75, 0x4d7a, 0x6a40, 0x303a, 0x6a3e, + 0x4025, 0x6a3b, 0x327d, 0x4377, 0x3b68, 0x5257, 0x4e74, 0x6a3f, + 0x6a3c, 0x6a43, 0x5047, 0x5333, 0x343a, 0x4341, 0x5772, 0x5551, + 0x4a47, 0x6a45, 0x6a44, 0x6a47, 0x6a46, 0x5667, 0x4f54, 0x6a4b, + 0x3b4e, 0x3d7a, 0x494e, 0x6a4c, 0x4939, 0x4f7e, 0x6a4a, 0x544e, + 0x6a4d, 0x6a4f, 0x4d6d, 0x6a49, 0x6a4e, 0x4e6e, 0x3b5e, 0x333f, + 0x4655, 0x3e30, 0x4e7a, 0x4767, 0x3e27, 0x6a50, 0x5647, 0x4140, + 0x545d, 0x6a51, 0x4f3e, 0x6a52, 0x4a6e, 0x452f, 0x3035, 0x6a54, + 0x6a53, 0x745f, 0x443a, 0x3129, 0x655f, 0x6a55, 0x4a6f, 0x6a56, + 0x6a57, 0x4658, 0x6a58, 0x6a59, 0x543b, 0x477a, 0x5237, 0x387c, + 0x6a42, 0x325c, 0x427c, 0x5478, 0x4c66, 0x576e, 0x5442, 0x5350, + 0x6b43, 0x4573, 0x377e, 0x6b54, 0x4b37, 0x6b5e, 0x404a, 0x4d7b, + 0x332f, 0x465a, 0x6b7c, 0x443e, 0x4e34, 0x4429, 0x313e, 0x547d, + 0x4a75, 0x566c, 0x4653, 0x3664, 0x3b7a, 0x5060, 0x4931, 0x5453, + 0x4828, 0x384b, 0x683e, 0x493c, 0x683b, 0x406e, 0x5053, 0x3244, + 0x3465, 0x683c, 0x5548, 0x3645, 0x683d, 0x4a78, 0x385c, 0x4c75, + 0x4034, 0x516e, 0x683f, 0x6842, 0x3a3c, 0x312d, 0x3d5c, 0x6a3d, + 0x6843, 0x6846, 0x684b, 0x684c, 0x4b49, 0x3065, 0x3c2b, 0x3939, + 0x6841, 0x4d77, 0x684a, 0x4e76, 0x556d, 0x4156, 0x6844, 0x4336, + 0x397b, 0x5626, 0x6848, 0x4a60, 0x5466, 0x6840, 0x6845, 0x6847, + 0x4739, 0x3763, 0x6849, 0x3f5d, 0x6852, 0x6857, 0x6855, 0x3c5c, + 0x3c4f, 0x685b, 0x685e, 0x685a, 0x317a, 0x3058, 0x4433, 0x384c, + 0x4662, 0x483e, 0x4861, 0x684f, 0x6854, 0x6856, 0x3971, 0x6858, + 0x5775, 0x447b, 0x685c, 0x3269, 0x6851, 0x3c6d, 0x3f42, 0x684d, + 0x5679, 0x4178, 0x3271, 0x685f, 0x4a41, 0x6859, 0x5524, 0x316a, + 0x553b, 0x684e, 0x6850, 0x3630, 0x6853, 0x685d, 0x4038, 0x4a77, + 0x4b28, 0x465c, 0x4075, 0x6869, 0x5023, 0x6872, 0x566a, 0x6860, + 0x6861, 0x5179, 0x3a4b, 0x3879, 0x3871, 0x5454, 0x686f, 0x686e, + 0x686c, 0x3970, 0x4c52, 0x6866, 0x4e26, 0x3f72, 0x3038, 0x6871, + 0x6870, 0x5740, 0x6864, 0x4d29, 0x4923, 0x3b38, 0x3d5b, 0x686a, + 0x6862, 0x6863, 0x6865, 0x3535, 0x6867, 0x4745, 0x686b, 0x686d, + 0x3d30, 0x572e, 0x6878, 0x6875, 0x4d30, 0x6876, 0x413a, 0x6868, + 0x4337, 0x3070, 0x6874, 0x6877, 0x3923, 0x4952, 0x434e, 0x4e60, + 0x4066, 0x4b73, 0x4c5d, 0x5035, 0x4a61, 0x6873, 0x3c6c, 0x6879, + 0x435e, 0x4665, 0x3977, 0x3074, 0x5758, 0x3c2c, 0x456f, 0x4c44, + 0x6926, 0x492d, 0x6922, 0x4062, 0x3f43, 0x687e, 0x3957, 0x687b, + 0x6924, 0x524e, 0x6923, 0x5632, 0x5735, 0x6927, 0x3d37, 0x687c, + 0x687d, 0x6921, 0x4d56, 0x522c, 0x6932, 0x6929, 0x342a, 0x343b, + 0x692b, 0x5028, 0x6925, 0x337e, 0x692c, 0x4063, 0x692a, 0x6939, + 0x6938, 0x692e, 0x687a, 0x6928, 0x3f2c, 0x6931, 0x693a, 0x4225, + 0x692f, 0x3845, 0x692d, 0x535c, 0x6934, 0x6935, 0x6937, 0x6947, + 0x4046, 0x6945, 0x6930, 0x693b, 0x3071, 0x693c, 0x5525, 0x693e, + 0x693f, 0x6941, 0x4171, 0x4836, 0x693d, 0x6942, 0x6943, 0x6933, + 0x6936, 0x3b31, 0x6940, 0x3c77, 0x6944, 0x6946, 0x694a, 0x694e, + 0x325b, 0x6948, 0x372e, 0x694b, 0x694c, 0x5541, 0x4423, 0x6958, + 0x3a61, 0x6949, 0x5323, 0x6954, 0x6957, 0x6950, 0x694f, 0x4741, + 0x6952, 0x6959, 0x3348, 0x6953, 0x4f70, 0x694d, 0x3377, 0x6956, + 0x695a, 0x4c34, 0x4f2d, 0x6955, 0x695c, 0x695b, 0x695e, 0x6951, + 0x695d, 0x695f, 0x434a, 0x4737, 0x344e, 0x3b36, 0x5040, 0x6c23, + 0x4537, 0x537b, 0x6c24, 0x6c25, 0x465b, 0x3f6e, 0x6c26, 0x6c27, + 0x502a, 0x4738, 0x3868, 0x6c28, 0x5639, 0x557d, 0x344b, 0x323d, + 0x4e64, 0x4667, 0x4d61, 0x3475, 0x4b40, 0x3c5f, 0x6962, 0x6963, + 0x516a, 0x6965, 0x3479, 0x6964, 0x5133, 0x4a62, 0x3250, 0x6968, + 0x6966, 0x6967, 0x5633, 0x6969, 0x696a, 0x696b, 0x696c, 0x6c2f, + 0x4539, 0x364e, 0x5273, 0x356e, 0x3b59, 0x6c31, 0x5263, 0x4e63, + 0x4438, 0x433f, 0x363e, 0x5839, 0x3148, 0x314f, 0x3151, 0x457e, + 0x3150, 0x432b, 0x5531, 0x6b24, 0x3a41, 0x4c3a, 0x6b25, 0x6b27, + 0x6b28, 0x6b26, 0x6b29, 0x6b2b, 0x6b2a, 0x6b2c, 0x4a4f, 0x5835, + 0x4371, 0x4325, 0x4678, 0x6b2d, 0x444a, 0x6b2e, 0x6b2f, 0x6b30, + 0x3755, 0x377a, 0x6b31, 0x4762, 0x6b33, 0x3a24, 0x5175, 0x3031, + 0x6b32, 0x6b34, 0x352a, 0x4248, 0x4768, 0x6b35, 0x4b2e, 0x635f, + 0x5340, 0x595b, 0x4d21, 0x562d, 0x4773, 0x5960, 0x3b63, 0x3a3a, + 0x6362, 0x4f2b, 0x6360, 0x4947, 0x3a39, 0x5134, 0x6361, 0x486a, + 0x392f, 0x3d2d, 0x3358, 0x4e5b, 0x4c40, 0x6368, 0x6369, 0x4d74, + 0x4c2d, 0x3c33, 0x636a, 0x636b, 0x505a, 0x467b, 0x375a, 0x475f, + 0x524a, 0x4e56, 0x6364, 0x636c, 0x4972, 0x3341, 0x6367, 0x4663, + 0x6365, 0x6d33, 0x6366, 0x4933, 0x4566, 0x3935, 0x433b, 0x6363, + 0x453d, 0x4124, 0x4259, 0x3257, 0x636d, 0x3b26, 0x442d, 0x6370, + 0x3e5a, 0x637b, 0x6375, 0x3a53, 0x3750, 0x534d, 0x564e, 0x5553, + 0x3941, 0x5534, 0x5158, 0x5039, 0x4776, 0x482a, 0x3234, 0x435a, + 0x636e, 0x637c, 0x636f, 0x3728, 0x6377, 0x6374, 0x373a, 0x4522, + 0x6376, 0x455d, 0x3228, 0x467c, 0x4460, 0x5722, 0x4061, 0x6379, + 0x637a, 0x637d, 0x4c29, 0x6373, 0x533e, 0x3143, 0x6d34, 0x6371, + 0x6372, 0x6378, 0x503a, 0x4643, 0x5473, 0x637e, 0x3d60, 0x6427, + 0x6426, 0x5173, 0x6423, 0x6429, 0x4877, 0x4f34, 0x6428, 0x642e, + 0x4265, 0x3634, 0x3d72, 0x6422, 0x3a69, 0x642a, 0x642c, 0x367d, + 0x565e, 0x6432, 0x642d, 0x6421, 0x3b6e, 0x4d5d, 0x4722, 0x4549, + 0x4177, 0x6424, 0x4733, 0x3d2c, 0x3d3d, 0x6425, 0x5747, 0x3262, + 0x642b, 0x3c43, 0x642f, 0x3b6b, 0x6430, 0x4528, 0x6431, 0x5563, + 0x3f23, 0x643a, 0x6437, 0x643b, 0x643d, 0x4656, 0x3a46, 0x404b, + 0x3821, 0x6434, 0x5421, 0x3a23, 0x3d7e, 0x643c, 0x4d3f, 0x4479, + 0x4f7b, 0x4966, 0x533f, 0x4f51, 0x6433, 0x6438, 0x6439, 0x4c69, + 0x4c4e, 0x4054, 0x6435, 0x4130, 0x6436, 0x4e50, 0x3b41, 0x3553, + 0x4873, 0x3d27, 0x5547, 0x492c, 0x3822, 0x644a, 0x644c, 0x5144, + 0x523a, 0x3a2d, 0x3a54, 0x6443, 0x356d, 0x574d, 0x6440, 0x4f7d, + 0x643f, 0x415c, 0x4c4a, 0x4a67, 0x4457, 0x4c54, 0x6448, 0x6447, + 0x6441, 0x6444, 0x352d, 0x5359, 0x6446, 0x5279, 0x3463, 0x3b34, + 0x496e, 0x343e, 0x3b6c, 0x514d, 0x4c6d, 0x6d35, 0x4765, 0x5428, + 0x644b, 0x5755, 0x6442, 0x3d25, 0x6445, 0x5366, 0x6449, 0x4978, + 0x643e, 0x5365, 0x477e, 0x3649, 0x547c, 0x3233, 0x6457, 0x4e42, + 0x644d, 0x4e3c, 0x385b, 0x6456, 0x3f4a, 0x534e, 0x436c, 0x4548, + 0x6458, 0x4d44, 0x644f, 0x6454, 0x6455, 0x3a7e, 0x4f66, 0x553f, + 0x6452, 0x6450, 0x644e, 0x4d65, 0x4a2a, 0x4023, 0x3d26, 0x6453, + 0x3848, 0x6467, 0x5434, 0x645b, 0x416f, 0x6469, 0x5267, 0x645f, + 0x6460, 0x4f2a, 0x4b5d, 0x645a, 0x6451, 0x6465, 0x485c, 0x6463, + 0x4467, 0x6462, 0x6461, 0x337c, 0x6468, 0x3561, 0x574c, 0x6466, + 0x3b2c, 0x5752, 0x4c4f, 0x6b78, 0x6464, 0x3976, 0x564d, 0x6459, + 0x645c, 0x427a, 0x645e, 0x424b, 0x4044, 0x4250, 0x3175, 0x4c32, + 0x354e, 0x646f, 0x462f, 0x4661, 0x6475, 0x4229, 0x406c, 0x515d, + 0x646e, 0x442e, 0x646d, 0x6476, 0x6474, 0x427e, 0x645d, 0x6470, + 0x4a7e, 0x5544, 0x6471, 0x517a, 0x646b, 0x646c, 0x6472, 0x4e2b, + 0x454b, 0x4731, 0x423a, 0x646a, 0x414a, 0x4c36, 0x3331, 0x647b, + 0x6473, 0x647a, 0x647d, 0x647c, 0x334e, 0x333a, 0x6477, 0x6479, + 0x6478, 0x456c, 0x403d, 0x5468, 0x6522, 0x3044, 0x6524, 0x6523, + 0x3c24, 0x6525, 0x6521, 0x647e, 0x3174, 0x6528, 0x6529, 0x6526, + 0x6527, 0x652a, 0x4659, 0x652b, 0x652d, 0x652c, 0x652f, 0x652e, + 0x3960, 0x6530, 0x6531, 0x3b70, 0x6c61, 0x4370, 0x3546, 0x3b52, + 0x4169, 0x546e, 0x3e44, 0x5746, 0x5456, 0x3253, 0x6c3e, 0x6a41, + 0x422f, 0x3436, 0x5157, 0x3334, 0x4832, 0x3f3b, 0x6c40, 0x564b, + 0x6c3f, 0x6c41, 0x6c45, 0x3e66, 0x4c3f, 0x455a, 0x3e3c, 0x6c46, + 0x317e, 0x6c44, 0x5528, 0x3563, 0x6c42, 0x4136, 0x3363, 0x6c43, + 0x4b38, 0x4043, 0x4c7e, 0x4152, 0x6c48, 0x3a66, 0x4053, 0x5672, + 0x514c, 0x3f3e, 0x3733, 0x4955, 0x6c47, 0x3b62, 0x4c4c, 0x3d7d, + 0x4848, 0x4f29, 0x4d69, 0x456b, 0x3769, 0x5149, 0x3a38, 0x6c49, + 0x6c4a, 0x3b40, 0x6c4b, 0x6c62, 0x313a, 0x3759, 0x3d39, 0x6c4c, + 0x5166, 0x6c4d, 0x483b, 0x6c51, 0x6c53, 0x3b4d, 0x3c65, 0x6c4f, + 0x4937, 0x433a, 0x6c63, 0x5555, 0x6c50, 0x5673, 0x6c52, 0x6c4e, + 0x6c54, 0x6c55, 0x493f, 0x4f28, 0x505c, 0x512c, 0x485b, 0x6c56, + 0x4e75, 0x4a6c, 0x6c5a, 0x6c59, 0x303e, 0x6c57, 0x6c58, 0x6c64, + 0x483c, 0x4147, 0x6c5c, 0x5160, 0x6c5b, 0x546f, 0x6c5d, 0x5b46, + 0x6c5e, 0x312c, 0x6c5f, 0x6c60, 0x5726, 0x4540, 0x6b3c, 0x302e, + 0x3e74, 0x3838, 0x522f, 0x3056, 0x3579, 0x5833, 0x4b2c, 0x635d, + 0x462c, 0x3066, 0x4546, 0x6b39, 0x6b3a, 0x6b3b, 0x5140, 0x4523, + 0x6a72, 0x4432, 0x4435, 0x404e, 0x6a73, 0x4441, 0x4e6f, 0x6a70, + 0x6a74, 0x497c, 0x4723, 0x4c58, 0x4e7e, 0x6a75, 0x6a76, 0x4f2c, + 0x4067, 0x6a77, 0x363f, 0x6a78, 0x6a79, 0x6a7a, 0x6a7b, 0x6a71, + 0x482e, 0x616b, 0x3738, 0x616c, 0x616d, 0x5734, 0x616e, 0x616f, + 0x534c, 0x6171, 0x3f71, 0x6170, 0x3552, 0x3137, 0x6173, 0x6172, + 0x3a7c, 0x6174, 0x3937, 0x3e51, 0x447c, 0x3a5d, 0x3d46, 0x6175, + 0x6177, 0x3640, 0x4f41, 0x4a28, 0x6176, 0x5578, 0x537c, 0x6178, + 0x617c, 0x6179, 0x617a, 0x406a, 0x617e, 0x6221, 0x4047, 0x617b, + 0x617d, 0x6225, 0x4154, 0x6223, 0x6228, 0x327e, 0x6222, 0x434d, + 0x3242, 0x6227, 0x6226, 0x6224, 0x6229, 0x622b, 0x5049, 0x566d, + 0x4328, 0x622c, 0x4f57, 0x622e, 0x3a6f, 0x6960, 0x622d, 0x622a, + 0x3b2b, 0x5433, 0x6230, 0x622f, 0x6961, 0x6231, 0x6232, 0x6233, + 0x4c21, 0x6234, 0x6235, 0x507e, 0x424a, 0x5371, 0x4d75, 0x6760, + 0x6761, 0x3e41, 0x426a, 0x6764, 0x6763, 0x4d66, 0x4335, 0x6762, + 0x3b37, 0x4f56, 0x4161, 0x6769, 0x6768, 0x6774, 0x3223, 0x676a, + 0x6766, 0x676c, 0x676b, 0x493a, 0x5564, 0x6765, 0x3729, 0x6767, + 0x676e, 0x6773, 0x5669, 0x676d, 0x6772, 0x6771, 0x3060, 0x6775, + 0x4772, 0x4045, 0x406d, 0x4170, 0x6770, 0x6776, 0x4b76, 0x6822, + 0x6821, 0x5741, 0x677a, 0x6779, 0x677b, 0x6777, 0x677e, 0x677d, + 0x677c, 0x4155, 0x4759, 0x457d, 0x4543, 0x476d, 0x6823, 0x6826, + 0x6825, 0x6827, 0x3a77, 0x6778, 0x6824, 0x4870, 0x492a, 0x6829, + 0x3965, 0x517e, 0x6828, 0x682a, 0x682d, 0x682e, 0x4127, 0x682f, + 0x6830, 0x682c, 0x6834, 0x682b, 0x6831, 0x6835, 0x6832, 0x6833, + 0x6837, 0x6836, 0x394f, 0x702c, 0x702d, 0x4630, 0x306a, 0x483f, + 0x4d5f, 0x4e4d, 0x6a31, 0x6a32, 0x463f, 0x3449, 0x6a33, 0x5567, + 0x5d79, 0x6a34, 0x6a35, 0x6a36, 0x384a, 0x5f30, 0x4975, 0x4c70, + 0x497a, 0x497b, 0x5343, 0x4b26, 0x3826, 0x702e, 0x3142, 0x6538, + 0x4c6f, 0x5349, 0x3c57, 0x496a, 0x3567, 0x4450, 0x3569, 0x6e2e, + 0x3b2d, 0x675e, 0x6e2f, 0x3329, 0x6e32, 0x6e31, 0x3d67, 0x6e30, + 0x4e37, 0x454f, 0x4174, 0x5b4e, 0x6e33, 0x5073, 0x4254, 0x4668, + 0x372c, 0x6e34, 0x336b, 0x3b7b, 0x6e35, 0x675c, 0x6e36, 0x3d2e, + 0x7162, 0x4a68, 0x5249, 0x705a, 0x705b, 0x705c, 0x4146, 0x386d, + 0x3e4e, 0x705e, 0x4531, 0x705d, 0x5171, 0x7060, 0x304c, 0x3d6a, + 0x525f, 0x705f, 0x342f, 0x3768, 0x7066, 0x7065, 0x4623, 0x7061, + 0x7062, 0x3443, 0x7063, 0x556e, 0x4c5b, 0x3e52, 0x3c32, 0x7068, + 0x7067, 0x7064, 0x3221, 0x5622, 0x5338, 0x3e37, 0x482c, 0x706a, + 0x5177, 0x564c, 0x3a5b, 0x7069, 0x363b, 0x4d34, 0x4626, 0x4121, + 0x706b, 0x706e, 0x706d, 0x7070, 0x706c, 0x3b3e, 0x706f, 0x4c35, + 0x7072, 0x3355, 0x3154, 0x7073, 0x7074, 0x7076, 0x3461, 0x7071, + 0x7077, 0x707a, 0x7078, 0x7075, 0x707d, 0x7079, 0x707c, 0x707e, + 0x7121, 0x4e41, 0x7124, 0x7123, 0x4176, 0x707b, 0x4a5d, 0x3471, + 0x3171, 0x4c31, 0x7126, 0x7127, 0x712c, 0x554e, 0x7129, 0x4833, + 0x7122, 0x712b, 0x7128, 0x7125, 0x712a, 0x3029, 0x712d, 0x712f, + 0x7131, 0x7130, 0x712e, 0x5122, 0x7132, 0x7133, 0x396f, 0x3547, + 0x3057, 0x3059, 0x546d, 0x3544, 0x3d54, 0x3b4a, 0x7027, 0x385e, + 0x7028, 0x3028, 0x7029, 0x4d6e, 0x702a, 0x702b, 0x4624, 0x5665, + 0x7164, 0x7165, 0x4373, 0x535b, 0x5651, 0x4568, 0x532f, 0x5266, + 0x6e41, 0x303b, 0x5535, 0x514e, 0x3c60, 0x3a50, 0x3f78, 0x3847, + 0x3541, 0x454c, 0x4a22, 0x434b, 0x6e42, 0x443f, 0x3622, 0x6d6c, + 0x4324, 0x5631, 0x4f60, 0x6d6f, 0x454e, 0x365c, 0x4a21, 0x6d6d, + 0x6d70, 0x6d71, 0x433c, 0x3f34, 0x6d6e, 0x6d74, 0x6d72, 0x5566, + 0x435f, 0x6d73, 0x6d76, 0x5523, 0x5123, 0x6d75, 0x4350, 0x6d77, + 0x3f74, 0x3e6c, 0x6d78, 0x4c77, 0x515b, 0x5745, 0x5576, 0x6d7c, + 0x6d7b, 0x6d79, 0x6d7a, 0x6d7d, 0x3e26, 0x4b2f, 0x6e21, 0x363d, + 0x6e22, 0x4440, 0x6d7e, 0x3d5e, 0x3247, 0x3643, 0x6e25, 0x583a, + 0x6e23, 0x6e26, 0x4369, 0x3372, 0x6e27, 0x6e24, 0x4f39, 0x6e28, + 0x4277, 0x6e29, 0x6e2a, 0x5e2b, 0x4633, 0x4746, 0x5675, 0x3549, + 0x4b32, 0x6e2b, 0x4d2b, 0x6e2c, 0x5530, 0x6e2d, 0x7644, 0x5b47, + 0x3423, 0x432c, 0x7166, 0x4a38, 0x5253, 0x562a, 0x6f72, 0x3e58, + 0x3d43, 0x6f73, 0x364c, 0x302b, 0x4a2f, 0x6d36, 0x6d37, 0x4e79, + 0x372f, 0x3f73, 0x6d38, 0x426b, 0x4930, 0x6d39, 0x4676, 0x3f33, + 0x6d3c, 0x4578, 0x5150, 0x5729, 0x6d3a, 0x6d3b, 0x5162, 0x6d3f, + 0x6d40, 0x6d44, 0x6d48, 0x6d46, 0x6d4e, 0x5568, 0x6d49, 0x6d47, + 0x6d3e, 0x4569, 0x4646, 0x4969, 0x5452, 0x6d41, 0x6d42, 0x6d43, + 0x6d45, 0x4079, 0x3421, 0x3968, 0x6d50, 0x6d51, 0x6d4a, 0x6d4f, + 0x4e78, 0x4b36, 0x6d4c, 0x6d4d, 0x4f75, 0x6d52, 0x4172, 0x5332, + 0x6d4b, 0x4837, 0x3c6f, 0x4570, 0x6d56, 0x356f, 0x4235, 0x302d, + 0x4b69, 0x312e, 0x6d54, 0x4d6b, 0x3562, 0x6d55, 0x6d53, 0x6d57, + 0x357a, 0x6d58, 0x6d59, 0x6d5c, 0x314c, 0x4576, 0x3c6e, 0x6d5a, + 0x4c3c, 0x326a, 0x6d5b, 0x446b, 0x3445, 0x3075, 0x6d5f, 0x405a, + 0x3468, 0x454d, 0x6d5d, 0x3f44, 0x6d5e, 0x4425, 0x6d60, 0x6d61, + 0x6d63, 0x4157, 0x3b47, 0x3d38, 0x6d62, 0x6d64, 0x6d66, 0x6d65, + 0x6d67, 0x4a3e, 0x6c6a, 0x4071, 0x4967, 0x6c6b, 0x466e, 0x6c6c, + 0x466d, 0x6c6d, 0x6c70, 0x5766, 0x6c73, 0x6c71, 0x6c6e, 0x6c6f, + 0x5723, 0x4971, 0x4b6e, 0x6c74, 0x6c72, 0x4f69, 0x6c76, 0x4631, + 0x3c40, 0x6c75, 0x353b, 0x3b76, 0x6c77, 0x5977, 0x3d7b, 0x423b, + 0x6c78, 0x6c79, 0x3823, 0x6c7a, 0x6c7b, 0x6c7c, 0x536d, 0x582e, + 0x406b, 0x475d, 0x3a4c, 0x5063, 0x4b3d, 0x4d3a, 0x3851, 0x317c, + 0x476f, 0x5656, 0x3f46, 0x436b, 0x6f75, 0x4358, 0x5762, 0x6f77, + 0x3353, 0x4758, 0x516d, 0x5648, 0x6f78, 0x6f76, 0x3b7d, 0x3346, + 0x3d55, 0x5246, 0x3b60, 0x4f21, 0x6f7c, 0x6f7b, 0x6f79, 0x334c, + 0x4954, 0x4b30, 0x6f7e, 0x305e, 0x5649, 0x6f7d, 0x336d, 0x7655, + 0x4e48, 0x7022, 0x7021, 0x353e, 0x3c5a, 0x3b7c, 0x3865, 0x4442, + 0x7023, 0x4b6b, 0x7026, 0x5128, 0x3e3f, 0x476e, 0x7136, 0x7137, + 0x3f55, 0x3429, 0x7138, 0x4d3b, 0x4754, 0x552d, 0x7139, 0x713a, + 0x474f, 0x5224, 0x564f, 0x713b, 0x3d51, 0x3430, 0x3e3d, 0x345c, + 0x4e51, 0x3f5f, 0x713d, 0x3f7a, 0x713c, 0x713f, 0x713e, 0x7140, + 0x7141, 0x417e, 0x4122, 0x4a7a, 0x553e, 0x3e3a, 0x3e39, 0x5542, + 0x3f22, 0x4d2f, 0x7135, 0x3d5f, 0x364b, 0x5671, 0x7343, 0x7344, + 0x384d, 0x7346, 0x7347, 0x304a, 0x7345, 0x7349, 0x4b71, 0x734b, + 0x5026, 0x314a, 0x7348, 0x734f, 0x3551, 0x7357, 0x7352, 0x7354, + 0x7353, 0x377b, 0x313f, 0x734e, 0x734a, 0x355a, 0x7350, 0x7351, + 0x7355, 0x734d, 0x3c63, 0x417d, 0x7356, 0x735a, 0x734c, 0x3548, + 0x3d6e, 0x735c, 0x3724, 0x3f70, 0x567e, 0x4d32, 0x3470, 0x325f, + 0x7358, 0x7359, 0x4938, 0x735d, 0x735e, 0x7361, 0x735f, 0x7363, + 0x7362, 0x735b, 0x3f6a, 0x336f, 0x7360, 0x4729, 0x3c72, 0x736b, + 0x393f, 0x7364, 0x322d, 0x3b7e, 0x4b63, 0x736d, 0x7369, 0x395c, + 0x736e, 0x7365, 0x7366, 0x736a, 0x4261, 0x736c, 0x736f, 0x7368, + 0x3c7d, 0x4f64, 0x7370, 0x7367, 0x7372, 0x572d, 0x462a, 0x7373, + 0x7371, 0x4228, 0x385d, 0x7375, 0x7374, 0x345b, 0x7376, 0x7377, + 0x7378, 0x403a, 0x4069, 0x4571, 0x737b, 0x737a, 0x3458, 0x737e, + 0x7379, 0x737c, 0x737d, 0x7421, 0x7423, 0x3b49, 0x7422, 0x7424, + 0x323e, 0x7426, 0x7425, 0x3c2e, 0x4357, 0x5961, 0x4060, 0x744c, + 0x5751, 0x375b, 0x744e, 0x4123, 0x4649, 0x3456, 0x5533, 0x7450, + 0x744f, 0x7451, 0x4b5a, 0x7452, 0x5441, 0x5660, 0x3760, 0x4138, + 0x413b, 0x7453, 0x3e2c, 0x3462, 0x7454, 0x7455, 0x3e2b, 0x7456, + 0x745b, 0x7457, 0x745a, 0x3a7d, 0x7458, 0x7459, 0x3862, 0x4c47, + 0x745c, 0x325a, 0x4353, 0x5463, 0x3f37, 0x745d, 0x4534, 0x7469, + 0x4f35, 0x4e49, 0x4b58, 0x4b77, 0x3d74, 0x574f, 0x405b, 0x5075, + 0x746a, 0x746b, 0x746c, 0x7763, 0x3731, 0x746d, 0x576b, 0x746e, + 0x6679, 0x3e40, 0x667a, 0x3a6c, 0x667b, 0x4f4b, 0x667c, 0x543c, + 0x3c36, 0x667d, 0x667e, 0x3c4d, 0x4852, 0x4e33, 0x6721, 0x343f, + 0x6722, 0x4934, 0x3859, 0x4449, 0x575d, 0x425a, 0x3757, 0x563d, + 0x4e46, 0x3744, 0x4526, 0x6723, 0x4f5f, 0x6724, 0x6725, 0x6726, + 0x4137, 0x5769, 0x4970, 0x4f38, 0x562f, 0x5655, 0x6727, 0x306d, + 0x6728, 0x6729, 0x495c, 0x526f, 0x3e2d, 0x672a, 0x3073, 0x485e, + 0x3d61, 0x672b, 0x4846, 0x672c, 0x3b66, 0x3878, 0x5124, 0x672d, + 0x4267, 0x3e78, 0x3d4a, 0x4d33, 0x672e, 0x672f, 0x3e6e, 0x5065, + 0x4b67, 0x4c50, 0x3c4c, 0x6730, 0x3c28, 0x5077, 0x6731, 0x5078, + 0x6732, 0x6733, 0x3442, 0x6734, 0x6735, 0x497e, 0x4e2c, 0x4360, + 0x6737, 0x3141, 0x3371, 0x6738, 0x6739, 0x575b, 0x5540, 0x673a, + 0x424c, 0x573a, 0x673b, 0x673c, 0x673d, 0x3c6a, 0x4365, 0x4042, + 0x673e, 0x673f, 0x3c29, 0x6740, 0x6741, 0x6736, 0x3650, 0x6742, + 0x6743, 0x6744, 0x3b3a, 0x355e, 0x4246, 0x3160, 0x6745, 0x5435, + 0x6746, 0x383f, 0x6748, 0x6747, 0x376c, 0x6749, 0x3278, 0x674a, + 0x674b, 0x674c, 0x674d, 0x674e, 0x674f, 0x6750, 0x5327, 0x4b75, + 0x6751, 0x6752, 0x6753, 0x6754, 0x4949, 0x6755, 0x6756, 0x6757, + 0x6758, 0x6759, 0x3d49, 0x675a, 0x733e, 0x3857, 0x4831, 0x733f, + 0x7340, 0x7341, 0x395e, 0x4d78, 0x5868, 0x3a31, 0x425e, 0x6e37, + 0x3723, 0x6e39, 0x6e38, 0x3055, 0x6e3b, 0x5556, 0x576f, 0x5643, + 0x6e3d, 0x4a70, 0x6e3c, 0x6e3e, 0x6e40, 0x6e3f, 0x5172, 0x473c, + 0x4340, 0x3861, 0x4167, 0x7446, 0x505f, 0x7447, 0x4f5b, 0x483a, + 0x7448, 0x7449, 0x744a, 0x744b, 0x597a, 0x387e, 0x6571, 0x5370, + 0x7460, 0x4e4c, 0x3361, 0x7134, 0x526e, 0x7461, 0x4f68, 0x7462, + 0x474c, 0x3554, 0x3464, 0x7464, 0x7463, 0x7465, 0x7466, 0x7467, + 0x3a32, 0x303f, 0x7468, 0x372d, 0x526d, 0x522b, 0x404f, 0x3f3c, + 0x6b23, 0x555f, 0x6a48, 0x7173, 0x3678, 0x4b23, 0x444d, 0x7167, + 0x7168, 0x387b, 0x7169, 0x3a44, 0x5445, 0x3052, 0x716a, 0x716b, + 0x716c, 0x716d, 0x716e, 0x716f, 0x7171, 0x7170, 0x4555, 0x7172, + 0x367a, 0x7174, 0x522e, 0x5e47, 0x4b4a, 0x335c, 0x3522, 0x3922, + 0x4474, 0x7175, 0x7176, 0x4144, 0x417b, 0x5630, 0x7177, 0x7178, + 0x412a, 0x4638, 0x3e5b, 0x7179, 0x344f, 0x717a, 0x6d32, 0x6d31, + 0x4b60, 0x525e, 0x4b41, 0x5558, 0x4862, 0x405f, 0x3c21, 0x6b41, + 0x5024, 0x5662, 0x3647, 0x3858, 0x6b40, 0x384e, 0x6b3f, 0x3326, + 0x3949, 0x562b, 0x3774, 0x374a, 0x3c67, 0x373e, 0x6b46, 0x6b47, + 0x3039, 0x3f4f, 0x6b45, 0x537d, 0x6b48, 0x6b49, 0x374e, 0x6b42, + 0x6b44, 0x4976, 0x5657, 0x554d, 0x5032, 0x6b4f, 0x4e38, 0x6b50, + 0x3528, 0x3133, 0x6b52, 0x4c25, 0x4556, 0x6b53, 0x6b51, 0x455f, + 0x6b4e, 0x4a24, 0x6b55, 0x307b, 0x3a7a, 0x5837, 0x7163, 0x6b4a, + 0x6b4b, 0x6b4c, 0x6b4d, 0x6b56, 0x6640, 0x6b59, 0x3f68, 0x5248, + 0x6b57, 0x6b5c, 0x386c, 0x6b58, 0x3d3a, 0x5058, 0x3037, 0x6b5d, + 0x445c, 0x562c, 0x3460, 0x4276, 0x3c39, 0x6b5a, 0x6b5b, 0x5460, + 0x466a, 0x4454, 0x6b5f, 0x4527, 0x5975, 0x3231, 0x6b64, 0x3d45, + 0x6b62, 0x6b63, 0x382c, 0x4d51, 0x6b65, 0x6b61, 0x4133, 0x4622, + 0x4c73, 0x6b66, 0x4030, 0x5238, 0x6b67, 0x382f, 0x382d, 0x6b68, + 0x473b, 0x4d73, 0x6b6a, 0x6b6b, 0x6b6d, 0x5048, 0x6b72, 0x6b6e, + 0x6b71, 0x4879, 0x517c, 0x6b6c, 0x6b69, 0x3839, 0x4f59, 0x4465, + 0x6b6f, 0x6b70, 0x4c5a, 0x4d48, 0x3072, 0x6b76, 0x6b75, 0x3232, + 0x3860, 0x6b77, 0x316c, 0x4c45, 0x4424, 0x4f25, 0x6b79, 0x6c22, + 0x4572, 0x6b7a, 0x4945, 0x625f, 0x6b7e, 0x4d4e, 0x6c21, 0x315b, + 0x5337, 0x525c, 0x6b7d, 0x6b7b, 0x333c, 0x6a30, 0x5754, 0x742b, + 0x3374, 0x5641, 0x5642, 0x5569, 0x3e4a, 0x7427, 0x5228, 0x7428, + 0x7429, 0x742a, 0x3e4b, 0x535f, 0x4960, 0x4961, 0x7342, 0x4a66, + 0x4c72, 0x6236, 0x4b34, 0x4e68, 0x565b, 0x742d, 0x742e, 0x742f, + 0x7432, 0x3a3d, 0x7433, 0x3063, 0x7430, 0x7431, 0x3d22, 0x3255, + 0x7436, 0x7437, 0x3666, 0x3230, 0x4f4f, 0x7434, 0x342c, 0x7435, + 0x7438, 0x7439, 0x4d27, 0x743a, 0x743b, 0x743c, 0x4b52, 0x743d, + 0x743e, 0x743f, 0x745e, 0x413c, 0x3c68, 0x492b, 0x515e, 0x6575, + 0x5c33, 0x5255, 0x5c34, 0x302c, 0x5c35, 0x3d5a, 0x5c39, 0x5842, + 0x5c37, 0x5373, 0x4956, 0x5c3a, 0x5c36, 0x5c3b, 0x4322, 0x5c3c, + 0x5c45, 0x5c3d, 0x4e5f, 0x5625, 0x5c4f, 0x5c4d, 0x5c52, 0x3d66, + 0x422b, 0x5c38, 0x5c4b, 0x5c4e, 0x5c3e, 0x3752, 0x3045, 0x5c47, + 0x503e, 0x5c41, 0x3b28, 0x373c, 0x5c4c, 0x5c46, 0x5c3f, 0x475b, + 0x513f, 0x5c40, 0x5c4a, 0x5c50, 0x4e2d, 0x5c42, 0x5c43, 0x5c48, + 0x5c49, 0x3254, 0x5c51, 0x4b55, 0x5437, 0x5c5b, 0x5c5f, 0x4c26, + 0x5c66, 0x4367, 0x5c5c, 0x3f41, 0x5c59, 0x307a, 0x3936, 0x5c65, + 0x5c53, 0x5c44, 0x5c56, 0x4874, 0x3f60, 0x493b, 0x313d, 0x5322, + 0x5c5a, 0x5c55, 0x463b, 0x5c5e, 0x5742, 0x432f, 0x3736, 0x4751, + 0x4329, 0x5c62, 0x5c58, 0x5c6b, 0x5c54, 0x5c5d, 0x3e25, 0x5c57, + 0x5c60, 0x5c63, 0x5c64, 0x5c78, 0x5c61, 0x5d22, 0x5c67, 0x3c6b, + 0x3444, 0x4323, 0x3267, 0x5c7a, 0x5c72, 0x5c6f, 0x5c7c, 0x5c6e, + 0x5270, 0x3268, 0x4857, 0x4863, 0x5c7b, 0x5c6d, 0x5c77, 0x5c75, + 0x3e23, 0x5c74, 0x325d, 0x5c73, 0x3c76, 0x5c68, 0x3b44, 0x4073, + 0x3c54, 0x5c69, 0x5c6a, 0x5c71, 0x5c76, 0x5c79, 0x3534, 0x4859, + 0x3b67, 0x5c7e, 0x5c7d, 0x532b, 0x5d21, 0x5d23, 0x5d25, 0x5271, + 0x5d24, 0x5d26, 0x5d27, 0x5229, 0x3a49, 0x5d29, 0x5d36, 0x5d31, + 0x5d34, 0x5d30, 0x464e, 0x4072, 0x492f, 0x5c6c, 0x5d2e, 0x5d37, + 0x5c70, 0x5d2f, 0x5d38, 0x5d2c, 0x5d39, 0x5d33, 0x5d2d, 0x442a, + 0x5d28, 0x4033, 0x412b, 0x5d2a, 0x5d2b, 0x5d32, 0x3b71, 0x5d35, + 0x5328, 0x5d3a, 0x5d3b, 0x4327, 0x5d52, 0x5d3c, 0x5d51, 0x393d, + 0x3e55, 0x3e7a, 0x3a4a, 0x5d4a, 0x5d45, 0x5d3f, 0x324b, 0x5d43, + 0x5d4b, 0x3224, 0x5d55, 0x5d3e, 0x4650, 0x5d50, 0x5d54, 0x4162, + 0x3746, 0x5d4e, 0x5d4f, 0x5d44, 0x5d3d, 0x5d4d, 0x4c51, 0x5d49, + 0x5d42, 0x4348, 0x463c, 0x4e2e, 0x5d4c, 0x5d48, 0x5d41, 0x5d46, + 0x425c, 0x5329, 0x532a, 0x5d53, 0x4f74, 0x4878, 0x5d66, 0x5d47, + 0x5d60, 0x4264, 0x5d61, 0x5d57, 0x5678, 0x5d59, 0x5d58, 0x3870, + 0x5d56, 0x464f, 0x362d, 0x5d62, 0x3a79, 0x5461, 0x5d67, 0x3450, + 0x5d5a, 0x3f7b, 0x5d63, 0x5d5f, 0x5d5d, 0x3559, 0x5d5b, 0x5d5c, + 0x5d5e, 0x3d2f, 0x5d64, 0x5d65, 0x5d75, 0x4349, 0x4b62, 0x5d72, + 0x5861, 0x4651, 0x5d74, 0x5574, 0x5d73, 0x5d70, 0x5d6c, 0x5d6f, + 0x5d68, 0x506e, 0x4858, 0x5d6e, 0x5d69, 0x5d6a, 0x4b72, 0x5d6d, + 0x314d, 0x4036, 0x3c3b, 0x5d71, 0x5d77, 0x5d76, 0x5d6b, 0x456e, + 0x5d7b, 0x5e24, 0x5e23, 0x5d78, 0x436f, 0x427b, 0x5561, 0x4e35, + 0x5d7d, 0x324c, 0x4468, 0x4a5f, 0x473e, 0x5d7a, 0x5d7c, 0x5d7e, + 0x5e22, 0x302a, 0x314e, 0x5e2c, 0x5e26, 0x3d36, 0x486f, 0x5e21, + 0x5e25, 0x5e29, 0x5e28, 0x5e27, 0x5e2d, 0x544c, 0x5e33, 0x5e2a, + 0x5e2e, 0x4059, 0x3121, 0x5e36, 0x5e31, 0x5e32, 0x5126, 0x5e35, + 0x5e2f, 0x5e30, 0x503d, 0x5e34, 0x4a6d, 0x5e39, 0x5e38, 0x5e37, + 0x5e3b, 0x3d65, 0x3258, 0x436a, 0x5e3a, 0x453a, 0x5e3c, 0x4c59, + 0x372a, 0x5465, 0x5e3d, 0x5e3f, 0x4422, 0x5e41, 0x5e3e, 0x5e40, + 0x553a, 0x5e42, 0x722e, 0x3b22, 0x4232, 0x4530, 0x4247, 0x722f, + 0x5069, 0x535d, 0x6b3d, 0x3366, 0x7230, 0x7231, 0x4a2d, 0x3a67, + 0x7233, 0x7235, 0x7234, 0x4b64, 0x4f3a, 0x7232, 0x4a34, 0x524f, + 0x426c, 0x4e43, 0x7238, 0x3076, 0x7237, 0x723e, 0x324f, 0x5141, + 0x723a, 0x723c, 0x5469, 0x723b, 0x7236, 0x723f, 0x723d, 0x7239, + 0x7247, 0x7244, 0x7246, 0x724a, 0x7242, 0x7240, 0x7245, 0x567b, + 0x7241, 0x4779, 0x495f, 0x7248, 0x3946, 0x3530, 0x7243, 0x7249, + 0x7250, 0x7256, 0x3b57, 0x7255, 0x4d5c, 0x566b, 0x7252, 0x7254, + 0x3872, 0x724b, 0x724e, 0x4279, 0x555d, 0x724c, 0x724d, 0x724f, + 0x7253, 0x7259, 0x533c, 0x366a, 0x4a71, 0x3764, 0x7257, 0x7258, + 0x725a, 0x725d, 0x725b, 0x725c, 0x5151, 0x7251, 0x4d49, 0x4e4f, + 0x5629, 0x7263, 0x435b, 0x7260, 0x402f, 0x726c, 0x725e, 0x7261, + 0x7268, 0x7262, 0x7267, 0x7266, 0x7269, 0x725f, 0x7264, 0x726a, + 0x532c, 0x7265, 0x3275, 0x7272, 0x502b, 0x7275, 0x3b48, 0x7279, + 0x7270, 0x7276, 0x7278, 0x727a, 0x7273, 0x7271, 0x3a7b, 0x357b, + 0x726f, 0x7277, 0x726d, 0x726e, 0x726b, 0x7326, 0x7323, 0x7322, + 0x7274, 0x485a, 0x727b, 0x7325, 0x4378, 0x727d, 0x7327, 0x7329, + 0x7324, 0x727c, 0x732b, 0x732a, 0x425d, 0x732e, 0x7330, 0x7321, + 0x7331, 0x732c, 0x732f, 0x727e, 0x732d, 0x7332, 0x7334, 0x7328, + 0x7333, 0x7335, 0x5037, 0x7338, 0x5979, 0x7339, 0x7337, 0x4864, + 0x7336, 0x733a, 0x733b, 0x3440, 0x6e43, 0x733c, 0x733d, 0x512a, + 0x742c, 0x5046, 0x5050, 0x515c, 0x4f4e, 0x3d56, 0x5143, 0x3a62, + 0x6169, 0x5242, 0x7142, 0x3239, 0x316d, 0x7143, 0x4940, 0x3344, + 0x5972, 0x4b25, 0x7144, 0x5654, 0x7145, 0x7440, 0x7146, 0x542c, + 0x7147, 0x3040, 0x7441, 0x7442, 0x347c, 0x455b, 0x4c3b, 0x5064, + 0x4d60, 0x7148, 0x5973, 0x313b, 0x4f2e, 0x3824, 0x714a, 0x714b, + 0x3243, 0x4151, 0x5730, 0x7149, 0x714c, 0x714e, 0x5976, 0x5261, + 0x5423, 0x7443, 0x4839, 0x7444, 0x714d, 0x714f, 0x3f63, 0x7150, + 0x7154, 0x7156, 0x7151, 0x4951, 0x4561, 0x4263, 0x397c, 0x7153, + 0x7155, 0x3953, 0x715b, 0x3a56, 0x307d, 0x7159, 0x7158, 0x7152, + 0x715a, 0x7157, 0x486c, 0x4d4a, 0x715d, 0x653d, 0x715c, 0x715e, + 0x715f, 0x4f65, 0x7445, 0x3d73, 0x7160, 0x7161, 0x4e77, 0x522a, + 0x717b, 0x3832, 0x3c7b, 0x395b, 0x3966, 0x4359, 0x4a53, 0x6a68, + 0x4040, 0x3e75, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, + 0x6a6f, 0x3d47, 0x757b, 0x757d, 0x757e, 0x757c, 0x3d62, 0x7621, + 0x3425, 0x7622, 0x7623, 0x6c32, 0x5154, 0x596a, 0x7624, 0x6e3a, + 0x5532, 0x537e, 0x4c5c, 0x4a44, 0x6540, 0x7625, 0x3e2f, 0x4629, + 0x5a25, 0x3c46, 0x3629, 0x383c, 0x484f, 0x3c25, 0x5a26, 0x5a27, + 0x4c56, 0x4843, 0x5a28, 0x467d, 0x5135, 0x5269, 0x5136, 0x3c47, + 0x3d32, 0x3b64, 0x5a29, 0x5a2a, 0x5148, 0x5a2b, 0x506d, 0x366f, + 0x425b, 0x4b4f, 0x376d, 0x4968, 0x3743, 0x3e77, 0x5624, 0x5a2c, + 0x5a2d, 0x4640, 0x5767, 0x4a36, 0x5529, 0x4b5f, 0x556f, 0x5a2e, + 0x565f, 0x344a, 0x5a30, 0x5a2f, 0x526b, 0x5a31, 0x5a32, 0x5a33, + 0x4a54, 0x5a34, 0x4a2b, 0x5a35, 0x5a36, 0x334f, 0x566f, 0x5a37, + 0x3b30, 0x352e, 0x5a38, 0x5a39, 0x396e, 0x512f, 0x5268, 0x5a3a, + 0x3843, 0x4f6a, 0x326f, 0x5a3b, 0x5a3c, 0x3d6b, 0x4e5c, 0x536f, + 0x5a3d, 0x4e73, 0x5a3e, 0x5355, 0x3b65, 0x5a3f, 0x4b35, 0x4b50, + 0x5a40, 0x476b, 0x566e, 0x5a41, 0x4535, 0x3641, 0x5a42, 0x374c, + 0x3f4e, 0x5a43, 0x5a44, 0x4b2d, 0x5a45, 0x3577, 0x5a46, 0x4142, + 0x573b, 0x5a47, 0x4c38, 0x526a, 0x4431, 0x5a48, 0x357d, 0x3b51, + 0x5a49, 0x5033, 0x5a4a, 0x5a4b, 0x4e3d, 0x5a4c, 0x5a4d, 0x5a4e, + 0x3277, 0x5a51, 0x5a4f, 0x5168, 0x5a50, 0x4355, 0x5a52, 0x5a53, + 0x5a54, 0x5a55, 0x503b, 0x5225, 0x3079, 0x5a56, 0x472b, 0x5a57, + 0x3d77, 0x4321, 0x5a58, 0x5a59, 0x437d, 0x4c37, 0x5a5a, 0x5a5b, + 0x403e, 0x4657, 0x5a5c, 0x5a5d, 0x4734, 0x5a5e, 0x5a5f, 0x3948, + 0x3b6d, 0x3639, 0x7478, 0x7479, 0x4d63, 0x7539, 0x6b60, 0x4f73, + 0x3b3f, 0x3a40, 0x5425, 0x6159, 0x7574, 0x312a, 0x3272, 0x7575, + 0x7577, 0x3a51, 0x7576, 0x4332, 0x7579, 0x7578, 0x3134, 0x556a, + 0x383a, 0x3931, 0x3246, 0x5470, 0x4f4d, 0x305c, 0x554b, 0x3b75, + 0x564a, 0x3737, 0x4c30, 0x4636, 0x3161, 0x393a, 0x567c, 0x3961, + 0x3721, 0x3c7a, 0x6a5a, 0x6a5b, 0x4c79, 0x3973, 0x6a5c, 0x347b, + 0x4333, 0x3751, 0x3a58, 0x6a5d, 0x5474, 0x6a5e, 0x3c56, 0x3b5f, + 0x6a5f, 0x415e, 0x4238, 0x545f, 0x574a, 0x6a60, 0x6a61, 0x6a64, + 0x6a62, 0x6a63, 0x495e, 0x3833, 0x3644, 0x6a65, 0x4a6a, 0x494d, + 0x344d, 0x6259, 0x4562, 0x6a66, 0x4035, 0x5738, 0x6a67, 0x572c, + 0x487c, 0x5853, 0x584d, 0x545e, 0x5479, 0x4944, 0x532e, 0x3853, + 0x3360, 0x4962, 0x7476, 0x3a55, 0x7477, 0x575f, 0x7471, 0x3830, + 0x5554, 0x384f, 0x4670, 0x3343, 0x7472, 0x332c, 0x543d, 0x4777, + 0x7474, 0x7473, 0x4c4b, 0x4824, 0x7475, 0x5763, 0x453f, 0x7540, + 0x753b, 0x7543, 0x7542, 0x563a, 0x7541, 0x543e, 0x7544, 0x754c, + 0x304f, 0x3578, 0x7549, 0x754a, 0x455c, 0x7545, 0x7546, 0x7547, + 0x754b, 0x3e60, 0x7548, 0x387a, 0x7550, 0x7553, 0x3f67, 0x3972, + 0x753c, 0x754d, 0x4237, 0x4c78, 0x3c79, 0x754e, 0x754f, 0x7551, + 0x3665, 0x7552, 0x7555, 0x753d, 0x7554, 0x533b, 0x336c, 0x4c24, + 0x7556, 0x7557, 0x3e61, 0x7558, 0x4c5f, 0x755b, 0x3248, 0x5759, + 0x7559, 0x755a, 0x755c, 0x7562, 0x7560, 0x755f, 0x755d, 0x7561, + 0x755e, 0x7564, 0x7565, 0x4c63, 0x653f, 0x3538, 0x7563, 0x7568, + 0x4c23, 0x7566, 0x7567, 0x753e, 0x3144, 0x753f, 0x3545, 0x3264, + 0x756c, 0x7569, 0x3657, 0x756d, 0x756a, 0x756b, 0x345a, 0x546a, + 0x756e, 0x3379, 0x756f, 0x7571, 0x7570, 0x7572, 0x7573, 0x496d, + 0x392a, 0x477b, 0x3663, 0x4c49, 0x6a26, 0x3335, 0x547e, 0x396c, + 0x5079, 0x696d, 0x572a, 0x696e, 0x4256, 0x486d, 0x3a64, 0x696f, + 0x6970, 0x6971, 0x5661, 0x6972, 0x6973, 0x6975, 0x6974, 0x6976, + 0x6977, 0x4761, 0x6978, 0x5458, 0x6979, 0x3d4e, 0x697a, 0x697b, + 0x3d4f, 0x697c, 0x3828, 0x413e, 0x697d, 0x3132, 0x3b54, 0x3975, + 0x697e, 0x6a21, 0x6a22, 0x6a23, 0x3778, 0x3c2d, 0x4a64, 0x604e, + 0x542f, 0x4f3d, 0x5537, 0x6a24, 0x555e, 0x6a25, 0x5041, 0x393c, + 0x3447, 0x3159, 0x4031, 0x3166, 0x3167, 0x3168, 0x333d, 0x4868, + 0x6541, 0x315f, 0x4149, 0x346f, 0x4728, 0x5358, 0x4679, 0x5138, + 0x397d, 0x4275, 0x532d, 0x544b, 0x3d7c, 0x6542, 0x3735, 0x6543, + 0x3b39, 0x5562, 0x3d78, 0x5436, 0x4e25, 0x412c, 0x3359, 0x4c76, + 0x6546, 0x6544, 0x6548, 0x654a, 0x6547, 0x354f, 0x4648, 0x357c, + 0x6545, 0x4a76, 0x6549, 0x4354, 0x3145, 0x3c23, 0x5737, 0x4d4b, + 0x4b4d, 0x4a4a, 0x4c53, 0x654c, 0x654b, 0x4466, 0x5121, 0x5137, + 0x654d, 0x6550, 0x4d38, 0x5670, 0x654f, 0x355d, 0x4d3e, 0x6551, + 0x363a, 0x4d28, 0x3964, 0x4a45, 0x3351, 0x4b59, 0x546c, 0x6552, + 0x376a, 0x654e, 0x6555, 0x347e, 0x6556, 0x6553, 0x6554, 0x525d, + 0x425f, 0x3146, 0x5362, 0x365d, 0x4b6c, 0x6557, 0x5376, 0x3169, + 0x3674, 0x655a, 0x6558, 0x6559, 0x3540, 0x5245, 0x655c, 0x655e, + 0x655d, 0x4732, 0x5223, 0x655b, 0x5462, 0x555a, 0x6560, 0x5771, + 0x6561, 0x315c, 0x517b, 0x6562, 0x6564, 0x6563, 0x6565, 0x5258, + 0x354b, 0x675f, 0x5a75, 0x5a78, 0x5a76, 0x5a77, 0x5a7a, 0x504f, + 0x4447, 0x306e, 0x5030, 0x5a79, 0x534a, 0x3a2a, 0x5b22, 0x4771, + 0x5a7c, 0x5a7b, 0x495b, 0x5a7d, 0x5b21, 0x575e, 0x5a7e, 0x415a, + 0x5b25, 0x5374, 0x5b27, 0x5b24, 0x5b28, 0x3d3c, 0x4049, 0x5b23, + 0x5b26, 0x5623, 0x5b29, 0x5b2d, 0x5b2e, 0x5b2c, 0x3a42, 0x3f24, + 0x5b2b, 0x5b2a, 0x5447, 0x323f, 0x5b2f, 0x3979, 0x5b30, 0x333b, + 0x3526, 0x363c, 0x5b31, 0x3675, 0x5b32, 0x3149, 0x5b34, 0x5b33, + 0x5b35, 0x5b37, 0x5b36, 0x5b38, 0x5b39, 0x5b3a, 0x534f, 0x747a, + 0x4775, 0x5743, 0x4564, 0x747c, 0x747d, 0x747b, 0x3e46, 0x506f, + 0x3753, 0x544d, 0x4c2a, 0x7522, 0x7521, 0x3a28, 0x747e, 0x4b56, + 0x7524, 0x4052, 0x336a, 0x4d2a, 0x7525, 0x7523, 0x3d34, 0x7528, + 0x7529, 0x3d4d, 0x4338, 0x3f61, 0x4b61, 0x752a, 0x7526, 0x7527, + 0x4470, 0x752c, 0x343c, 0x576d, 0x3457, 0x752b, 0x752e, 0x752d, + 0x752f, 0x5051, 0x4351, 0x4829, 0x7530, 0x7531, 0x7532, 0x7533, + 0x7534, 0x7535, 0x7537, 0x7536, 0x7538, 0x3249, 0x5354, 0x4a4d, + 0x406f, 0x5658, 0x5230, 0x413f, 0x3d70, 0x382a, 0x3c78, 0x7646, + 0x7647, 0x7648, 0x7649, 0x764a, 0x764c, 0x764b, 0x7769, 0x764d, + 0x764e, 0x6e44, 0x6e45, 0x6e46, 0x556b, 0x3624, 0x6e48, 0x6e47, + 0x6e49, 0x6e4a, 0x4725, 0x6e4b, 0x6e4c, 0x3730, 0x3576, 0x6e4d, + 0x6e4f, 0x6e4e, 0x3846, 0x6e50, 0x6e51, 0x6e52, 0x365b, 0x332e, + 0x5653, 0x4446, 0x3135, 0x3856, 0x6e53, 0x6e54, 0x543f, 0x4755, + 0x3e7b, 0x4e59, 0x3933, 0x6e56, 0x6e55, 0x6e58, 0x6e57, 0x4525, + 0x6e59, 0x6e5a, 0x472e, 0x6e5b, 0x472f, 0x6e5c, 0x3227, 0x6e5d, + 0x6e5e, 0x6e5f, 0x6e60, 0x6e61, 0x576a, 0x6e62, 0x6e63, 0x3c58, + 0x6e64, 0x534b, 0x4c7a, 0x322c, 0x4165, 0x6e65, 0x4726, 0x432d, + 0x6e66, 0x6e67, 0x6e68, 0x6e69, 0x6e6a, 0x6e6b, 0x6e6c, 0x6e6d, + 0x6e6e, 0x6e6f, 0x6e70, 0x6e71, 0x6e72, 0x6e74, 0x6e73, 0x6e75, + 0x4d2d, 0x4241, 0x6e76, 0x6e77, 0x6e78, 0x5521, 0x6e79, 0x4f33, + 0x6e7a, 0x6e7b, 0x6e7c, 0x6e7d, 0x6f21, 0x6e7e, 0x6f22, 0x3875, + 0x437a, 0x6f23, 0x6f24, 0x3d42, 0x523f, 0x3279, 0x6f25, 0x6f26, + 0x6f27, 0x5278, 0x6f28, 0x567d, 0x6f29, 0x464c, 0x6f2a, 0x6f2b, + 0x4134, 0x6f2c, 0x4f7a, 0x4b78, 0x6f2e, 0x6f2d, 0x337a, 0x3978, + 0x6f2f, 0x6f30, 0x5062, 0x6f31, 0x6f32, 0x3766, 0x503f, 0x6f33, + 0x6f34, 0x6f35, 0x4871, 0x4c60, 0x6f36, 0x6f37, 0x6f38, 0x6f39, + 0x6f3a, 0x5560, 0x6f3b, 0x346d, 0x432a, 0x6f3c, 0x6f3d, 0x6f3e, + 0x6f3f, 0x4e7d, 0x6f40, 0x4260, 0x3438, 0x5736, 0x3d75, 0x4f47, + 0x6f43, 0x6f41, 0x6f42, 0x6f44, 0x3627, 0x3c7c, 0x3e62, 0x434c, + 0x6f45, 0x6f46, 0x6f47, 0x6f4f, 0x6f48, 0x6f49, 0x6f4a, 0x4742, + 0x6f71, 0x364d, 0x6f4b, 0x6f4c, 0x6f4d, 0x3646, 0x433e, 0x6f4e, + 0x6f50, 0x6f51, 0x6f52, 0x5572, 0x6f53, 0x4477, 0x6f54, 0x4478, + 0x6f55, 0x6f56, 0x3864, 0x3077, 0x6f57, 0x6f58, 0x6f59, 0x6f5a, + 0x6f5b, 0x6f5c, 0x6f5d, 0x6f5e, 0x3e35, 0x6f61, 0x6f5f, 0x6f60, + 0x6f62, 0x6f63, 0x414d, 0x6f64, 0x6f65, 0x6f66, 0x6f67, 0x6f68, + 0x6f69, 0x6f6a, 0x6f6b, 0x6f6c, 0x4058, 0x6f6d, 0x412d, 0x6f6e, + 0x6f6f, 0x6f70, 0x4f62, 0x3324, 0x4345, 0x6345, 0x4941, 0x6346, + 0x3155, 0x4e4a, 0x3433, 0x4872, 0x6347, 0x4f50, 0x6348, 0x3c64, + 0x6349, 0x634a, 0x4346, 0x5522, 0x4456, 0x396b, 0x4e45, 0x634b, + 0x4376, 0x634c, 0x3727, 0x3873, 0x3a52, 0x634d, 0x634e, 0x5444, + 0x634f, 0x6350, 0x514b, 0x6351, 0x6352, 0x6353, 0x6354, 0x5156, + 0x6355, 0x327b, 0x403b, 0x6356, 0x402b, 0x6357, 0x6358, 0x6359, + 0x635a, 0x635b, 0x3837, 0x5a62, 0x3653, 0x5a64, 0x5a63, 0x5a66, + 0x486e, 0x5a65, 0x3740, 0x5174, 0x5275, 0x5573, 0x3d57, 0x5768, + 0x5a68, 0x5a67, 0x3022, 0x4d53, 0x5a69, 0x383d, 0x3c4a, 0x423d, + 0x4224, 0x3342, 0x5a6a, 0x422a, 0x4430, 0x3d35, 0x4f5e, 0x5a6b, + 0x4942, 0x315d, 0x5a6c, 0x3638, 0x543a, 0x337d, 0x5a6d, 0x5449, + 0x4f55, 0x4563, 0x5a6e, 0x5a6f, 0x5a70, 0x416a, 0x4c55, 0x4f5d, + 0x5367, 0x4221, 0x5a71, 0x4b65, 0x5a72, 0x4b66, 0x527e, 0x3874, + 0x5a73, 0x302f, 0x4f36, 0x554f, 0x4b6d, 0x5a74, 0x6344, 0x4125, + 0x763f, 0x7640, 0x7641, 0x4451, 0x4838, 0x5163, 0x505b, 0x5145, + 0x3c2f, 0x394d, 0x6f74, 0x3446, 0x533a, 0x7642, 0x337b, 0x7643, + 0x3571, 0x7645, 0x536a, 0x7627, 0x5129, 0x7629, 0x7628, 0x4163, + 0x4057, 0x3122, 0x4e6d, 0x5068, 0x762b, 0x4f76, 0x762a, 0x5570, + 0x762c, 0x4339, 0x3b74, 0x762e, 0x762d, 0x445e, 0x4158, 0x4b2a, + 0x4f3c, 0x762f, 0x7630, 0x7631, 0x4236, 0x3054, 0x4579, 0x7632, + 0x4760, 0x7626, 0x3e38, 0x3e32, 0x3565, 0x3747, 0x3f3f, 0x4352, + 0x4366, 0x584c, 0x386f, 0x3d79, 0x5125, 0x3050, 0x7730, 0x7731, + 0x502c, 0x3030, 0x7732, 0x7733, 0x7734, 0x474a, 0x3e4f, 0x7737, + 0x7736, 0x315e, 0x7735, 0x7738, 0x7739, 0x4e24, 0x484d, 0x3a2b, + 0x6838, 0x6839, 0x683a, 0x3e42, 0x5274, 0x544f, 0x4958, 0x5233, + 0x3625, 0x476a, 0x717c, 0x4f6e, 0x4b33, 0x506b, 0x676f, 0x4d67, + 0x394b, 0x3659, 0x717d, 0x3064, 0x4b4c, 0x717e, 0x5424, 0x422d, + 0x416c, 0x4644, 0x3e31, 0x7221, 0x3c55, 0x7222, 0x7223, 0x7224, + 0x5243, 0x4635, 0x4d47, 0x7225, 0x5331, 0x3f45, 0x4c62, 0x7226, + 0x7227, 0x5155, 0x366e, 0x7228, 0x7229, 0x355f, 0x722a, 0x722b, + 0x327c, 0x722c, 0x722d, 0x4827, 0x3767, 0x6c29, 0x6c2a, 0x6c2b, + 0x6c2c, 0x462e, 0x6c2d, 0x6c2e, 0x3749, 0x4a33, 0x6238, 0x774f, + 0x7750, 0x324d, 0x7751, 0x7753, 0x7752, 0x623b, 0x3c22, 0x623c, + 0x623d, 0x623e, 0x623f, 0x6240, 0x6241, 0x3739, 0x527b, 0x3d24, + 0x4a4e, 0x3125, 0x4b47, 0x6242, 0x367c, 0x4844, 0x6243, 0x3d48, + 0x317d, 0x6244, 0x3676, 0x6245, 0x4459, 0x6246, 0x4f5a, 0x395d, + 0x6247, 0x4021, 0x6248, 0x3276, 0x6249, 0x4173, 0x624a, 0x624b, + 0x4278, 0x624c, 0x624d, 0x624e, 0x4a57, 0x5838, 0x5965, 0x4f63, + 0x7025, 0x5c30, 0x426d, 0x5426, 0x4d54, 0x5131, 0x335b, 0x477d, + 0x3235, 0x423f, 0x6660, 0x4a3b, 0x6661, 0x6662, 0x3e54, 0x6663, + 0x5724, 0x4d55, 0x6665, 0x3c5d, 0x6664, 0x6666, 0x6667, 0x426e, + 0x3d3e, 0x6668, 0x4266, 0x3a27, 0x6669, 0x666a, 0x3352, 0x5169, + 0x3f25, 0x666b, 0x466f, 0x666c, 0x666d, 0x666e, 0x462d, 0x666f, + 0x4927, 0x6670, 0x6671, 0x6672, 0x6539, 0x6673, 0x6674, 0x4262, + 0x6675, 0x6676, 0x5668, 0x6677, 0x6678, 0x3947, 0x773b, 0x773a, + 0x773e, 0x773c, 0x3a21, 0x773f, 0x7740, 0x7742, 0x7741, 0x7744, + 0x7743, 0x7745, 0x7746, 0x7747, 0x4b68, 0x385f, 0x7754, 0x7755, + 0x7756, 0x7758, 0x775a, 0x7757, 0x775b, 0x7759, 0x5757, 0x775c, + 0x775d, 0x775e, 0x775f, 0x7760, 0x5b4b, 0x582a, 0x6577, 0x396d, + 0x3f7d, 0x3b6a, 0x7749, 0x4647, 0x7748, 0x774a, 0x774c, 0x774b, + 0x774d, 0x4e3a, 0x774e, 0x4427, 0x5363, 0x764f, 0x4233, 0x7650, + 0x7651, 0x7652, 0x7653, 0x7654, 0x7656, 0x312b, 0x7657, 0x7658, + 0x7659, 0x765a, 0x765b, 0x765c, 0x765d, 0x765e, 0x4f4a, 0x765f, + 0x7660, 0x7661, 0x7662, 0x7663, 0x7664, 0x4070, 0x7665, 0x7666, + 0x7667, 0x7668, 0x7669, 0x766a, 0x766b, 0x766c, 0x766d, 0x766e, + 0x766f, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x3e28, 0x7675, + 0x7676, 0x7677, 0x7678, 0x487a, 0x7679, 0x767a, 0x767b, 0x767c, + 0x767d, 0x767e, 0x7721, 0x7722, 0x7723, 0x7724, 0x7725, 0x7726, + 0x7727, 0x7728, 0x316e, 0x7729, 0x772a, 0x772b, 0x772c, 0x772d, + 0x415b, 0x772e, 0x772f, 0x4471, 0x702f, 0x3c26, 0x7030, 0x4379, + 0x4538, 0x513b, 0x7031, 0x7032, 0x7033, 0x7034, 0x7035, 0x513c, + 0x516c, 0x7037, 0x7036, 0x5427, 0x4d52, 0x7038, 0x703a, 0x7039, + 0x703b, 0x703c, 0x386b, 0x703d, 0x3a68, 0x703e, 0x703f, 0x3e69, + 0x7040, 0x366c, 0x7041, 0x7042, 0x7043, 0x7044, 0x4835, 0x7045, + 0x7046, 0x7047, 0x4574, 0x7048, 0x7049, 0x704a, 0x773d, 0x704b, + 0x704c, 0x704d, 0x704e, 0x704f, 0x3a57, 0x7050, 0x7051, 0x7052, + 0x7053, 0x7054, 0x7055, 0x7056, 0x7058, 0x5325, 0x7057, 0x7059, + 0x753a, 0x4239, 0x7764, 0x7765, 0x7766, 0x7767, 0x7768, 0x4234, + 0x776a, 0x776b, 0x4273, 0x7470, 0x746f, 0x4269, 0x7761, 0x7762, + 0x3b46, 0x5964, 0x4a72, 0x4068, 0x7024, 0x3a5a, 0x472d, 0x442c, + 0x776c, 0x776d, 0x776e, 0x7770, 0x776f, 0x7771, 0x7774, 0x7773, + 0x7772, 0x7775, 0x7776, 0x6d69, 0x6d6a, 0x6d6b, 0x763c, 0x763d, + 0x763e, 0x3626, 0x583e, 0x3944, 0x583b, 0x5c31, 0x4a73, 0x7777, + 0x7778, 0x7779, 0x777b, 0x777a, 0x3147, 0x777c, 0x777d, 0x777e, + 0x466b, 0x6c34, 0x335d, 0x7633, 0x7634, 0x4164, 0x7635, 0x7636, + 0x7637, 0x7638, 0x7639, 0x763a, 0x4823, 0x763b, 0x417a, 0x3928, + 0x6d68, 0x396a, 0x595f, 0x2321, 0x2322, 0x2323, 0x2167, 0x2325, + 0x2326, 0x2327, 0x2328, 0x2329, 0x232a, 0x232b, 0x232c, 0x232d, + 0x232e, 0x232f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, + 0x2336, 0x2337, 0x2338, 0x2339, 0x233a, 0x233b, 0x233c, 0x233d, + 0x233e, 0x233f, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, + 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, + 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, + 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x235b, 0x235c, 0x235d, + 0x235e, 0x235f, 0x2360, 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, + 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, + 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, + 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x237b, 0x237c, 0x237d, + 0x212b, 0x2169, 0x216a, 0x237e, 0x2324, +}; + +static const Summary16 gb2312_uni2indx_page00[70] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0190 }, { 3, 0x0003 }, + { 5, 0x0000 }, { 5, 0x0080 }, { 6, 0x3703 }, { 13, 0x168c }, + /* 0x0100 */ + { 19, 0x0002 }, { 20, 0x0808 }, { 22, 0x0800 }, { 23, 0x0000 }, + { 23, 0x2000 }, { 24, 0x0000 }, { 24, 0x0800 }, { 25, 0x0000 }, + { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, { 25, 0x0000 }, + { 25, 0x4000 }, { 26, 0x1555 }, { 33, 0x0000 }, { 33, 0x0000 }, + /* 0x0200 */ + { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, + { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, + { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, { 33, 0x0000 }, + { 33, 0x0280 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, + /* 0x0300 */ + { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, + { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, { 35, 0x0000 }, + { 35, 0x0000 }, { 35, 0xfffe }, { 50, 0x03fb }, { 59, 0xfffe }, + { 74, 0x03fb }, { 83, 0x0000 }, { 83, 0x0000 }, { 83, 0x0000 }, + /* 0x0400 */ + { 83, 0x0002 }, { 84, 0xffff }, { 100, 0xffff }, { 116, 0xffff }, + { 132, 0xffff }, { 148, 0x0002 }, +}; +static const Summary16 gb2312_uni2indx_page20[101] = { + /* 0x2000 */ + { 149, 0x0000 }, { 149, 0x3360 }, { 155, 0x0040 }, { 156, 0x080d }, + { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, + { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, + { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, { 160, 0x0000 }, + /* 0x2100 */ + { 160, 0x0008 }, { 161, 0x0040 }, { 162, 0x0000 }, { 162, 0x0000 }, + { 162, 0x0000 }, { 162, 0x0000 }, { 162, 0x0fff }, { 174, 0x0000 }, + { 174, 0x0000 }, { 174, 0x000f }, { 178, 0x0000 }, { 178, 0x0000 }, + { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, { 178, 0x0000 }, + /* 0x2200 */ + { 178, 0x8100 }, { 180, 0x6402 }, { 184, 0x4fa1 }, { 192, 0x20f0 }, + { 197, 0x1100 }, { 199, 0x0000 }, { 199, 0xc033 }, { 205, 0x0000 }, + { 205, 0x0000 }, { 205, 0x0200 }, { 206, 0x0020 }, { 207, 0x0000 }, + { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, { 207, 0x0000 }, + /* 0x2300 */ + { 207, 0x0000 }, { 207, 0x0004 }, { 208, 0x0000 }, { 208, 0x0000 }, + { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, + { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, + { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, + /* 0x2400 */ + { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x0000 }, + { 208, 0x0000 }, { 208, 0x0000 }, { 208, 0x03ff }, { 218, 0xfff0 }, + { 230, 0xffff }, { 246, 0x0fff }, { 258, 0x0000 }, { 258, 0x0000 }, + { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, { 258, 0x0000 }, + /* 0x2500 */ + { 258, 0xffff }, { 274, 0xffff }, { 290, 0xffff }, { 306, 0xffff }, + { 322, 0x0fff }, { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0000 }, + { 334, 0x0000 }, { 334, 0x0000 }, { 334, 0x0003 }, { 336, 0x000c }, + { 338, 0xc8c0 }, { 343, 0x0000 }, { 343, 0x0000 }, { 343, 0x0000 }, + /* 0x2600 */ + { 343, 0x0060 }, { 345, 0x0000 }, { 345, 0x0000 }, { 345, 0x0000 }, + { 345, 0x0005 }, +}; +static const Summary16 gb2312_uni2indx_page30[35] = { + /* 0x3000 */ + { 347, 0xff2f }, { 360, 0x00fb }, { 367, 0x0000 }, { 367, 0x0000 }, + { 367, 0xfffe }, { 382, 0xffff }, { 398, 0xffff }, { 414, 0xffff }, + { 430, 0xffff }, { 446, 0x000f }, { 450, 0xfffe }, { 465, 0xffff }, + { 481, 0xffff }, { 497, 0xffff }, { 513, 0xffff }, { 529, 0x087f }, + /* 0x3100 */ + { 537, 0xffe0 }, { 548, 0xffff }, { 564, 0x03ff }, { 574, 0x0000 }, + { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, + { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, + { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x0000 }, + /* 0x3200 */ + { 574, 0x0000 }, { 574, 0x0000 }, { 574, 0x03ff }, +}; +static const Summary16 gb2312_uni2indx_page4e[1263] = { + /* 0x4e00 */ + { 584, 0x7f8b }, { 595, 0x7f7b }, { 608, 0x3db4 }, { 617, 0xef55 }, + { 628, 0xfba8 }, { 638, 0xf35d }, { 649, 0x0243 }, { 653, 0x400b }, + { 657, 0xfb40 }, { 665, 0x8d3e }, { 674, 0x7bf7 }, { 687, 0x8c2c }, + { 693, 0x6eff }, { 706, 0xe3fa }, { 717, 0x1d3a }, { 725, 0xa8ed }, + /* 0x4f00 */ + { 734, 0xe602 }, { 740, 0xcf83 }, { 749, 0x8cf5 }, { 758, 0x3555 }, + { 766, 0xe048 }, { 771, 0xffab }, { 784, 0x92b9 }, { 792, 0xd859 }, + { 800, 0xab18 }, { 807, 0x2892 }, { 812, 0xd7e9 }, { 823, 0x8020 }, + { 825, 0xc438 }, { 831, 0xf583 }, { 840, 0xe74a }, { 849, 0x450a }, + /* 0x5000 */ + { 854, 0xb000 }, { 857, 0x9714 }, { 864, 0x7762 }, { 873, 0x5400 }, + { 876, 0xd188 }, { 882, 0x1420 }, { 885, 0x1020 }, { 887, 0xc8c0 }, + { 892, 0x2121 }, { 896, 0x0000 }, { 896, 0x13a8 }, { 902, 0x0c04 }, + { 905, 0x8000 }, { 906, 0x0440 }, { 908, 0x70c0 }, { 913, 0x0828 }, + /* 0x5100 */ + { 916, 0x08c0 }, { 919, 0x0004 }, { 920, 0x0002 }, { 921, 0x8000 }, + { 922, 0x2b7b }, { 932, 0x1472 }, { 938, 0x7924 }, { 945, 0x3bfb }, + { 957, 0x3327 }, { 965, 0x1ae4 }, { 972, 0x9835 }, { 979, 0x38ef }, + { 989, 0x9ad1 }, { 997, 0x2802 }, { 1000, 0xa813 }, { 1006, 0xbf69 }, + /* 0x5200 */ + { 1017, 0x65cf }, { 1027, 0x2fc6 }, { 1036, 0x6b11 }, { 1043, 0xafc9 }, + { 1053, 0x340f }, { 1060, 0x5053 }, { 1066, 0x86a2 }, { 1072, 0xa004 }, + { 1075, 0x0106 }, { 1078, 0xe809 }, { 1084, 0x3f0f }, { 1094, 0xc00e }, + { 1099, 0x0a88 }, { 1103, 0x8145 }, { 1108, 0x0010 }, { 1109, 0xc601 }, + /* 0x5300 */ + { 1114, 0xa161 }, { 1120, 0x26e1 }, { 1127, 0x444b }, { 1133, 0xce00 }, + { 1138, 0xc7aa }, { 1147, 0xd4ee }, { 1157, 0xcadf }, { 1168, 0x85bb }, + { 1177, 0x3a74 }, { 1185, 0xa520 }, { 1190, 0x436c }, { 1197, 0x8840 }, + { 1200, 0x3f06 }, { 1208, 0x8bd2 }, { 1216, 0xff79 }, { 1229, 0x3bef }, + /* 0x5400 */ + { 1241, 0xf75a }, { 1252, 0xe8ef }, { 1263, 0xfbcb }, { 1275, 0x5b36 }, + { 1284, 0x0d49 }, { 1290, 0x1bfd }, { 1301, 0x0154 }, { 1305, 0x39ee }, + { 1315, 0xd855 }, { 1323, 0x2e75 }, { 1332, 0xbfd8 }, { 1343, 0xa91a }, + { 1350, 0xf3d7 }, { 1362, 0xf6bf }, { 1375, 0x67e0 }, { 1383, 0xb40c }, + /* 0x5500 */ + { 1389, 0x82c2 }, { 1394, 0x0813 }, { 1398, 0xd49d }, { 1407, 0xd08b }, + { 1414, 0x065a }, { 1420, 0x1061 }, { 1424, 0x74f2 }, { 1433, 0x59e0 }, + { 1440, 0x8f9f }, { 1451, 0xb312 }, { 1458, 0x0080 }, { 1459, 0x6aaa }, + { 1467, 0x3230 }, { 1472, 0xb05e }, { 1480, 0x9d7a }, { 1490, 0x60ac }, + /* 0x5600 */ + { 1496, 0xd303 }, { 1503, 0xc900 }, { 1507, 0x3098 }, { 1512, 0x8a56 }, + { 1519, 0x7000 }, { 1522, 0x1390 }, { 1527, 0x1f14 }, { 1534, 0x1842 }, + { 1538, 0xc060 }, { 1542, 0x0008 }, { 1543, 0x8008 }, { 1545, 0x1080 }, + { 1547, 0x0400 }, { 1548, 0xec90 }, { 1555, 0x2817 }, { 1561, 0xe633 }, + /* 0x5700 */ + { 1570, 0x0758 }, { 1576, 0x9000 }, { 1578, 0xf708 }, { 1586, 0x4e09 }, + { 1592, 0xf485 }, { 1600, 0xfc83 }, { 1609, 0xaf53 }, { 1619, 0x18c8 }, + { 1624, 0x187c }, { 1631, 0x080c }, { 1634, 0x6adf }, { 1645, 0x0114 }, + { 1648, 0xc80c }, { 1653, 0xa734 }, { 1661, 0xa011 }, { 1665, 0x2710 }, + /* 0x5800 */ + { 1670, 0x28c5 }, { 1676, 0x4222 }, { 1680, 0x0413 }, { 1684, 0x0021 }, + { 1686, 0x3010 }, { 1689, 0x4112 }, { 1693, 0x1820 }, { 1696, 0x4000 }, + { 1697, 0x022b }, { 1702, 0xc60c }, { 1708, 0x0300 }, { 1710, 0x1000 }, + { 1711, 0x0022 }, { 1713, 0x0022 }, { 1715, 0x5810 }, { 1719, 0x0249 }, + /* 0x5900 */ + { 1723, 0xa094 }, { 1728, 0x9670 }, { 1735, 0xeeb0 }, { 1744, 0x1792 }, + { 1751, 0xcb96 }, { 1760, 0x05f2 }, { 1767, 0x0025 }, { 1770, 0x2358 }, + { 1776, 0x25de }, { 1785, 0x42cc }, { 1791, 0xcf38 }, { 1800, 0x4a04 }, + { 1804, 0x0c40 }, { 1807, 0x359f }, { 1817, 0x1128 }, { 1821, 0x8a00 }, + /* 0x5a00 */ + { 1824, 0x13fa }, { 1833, 0x910a }, { 1838, 0x0229 }, { 1842, 0x1056 }, + { 1847, 0x0641 }, { 1851, 0x0420 }, { 1853, 0x0484 }, { 1856, 0x84f0 }, + { 1862, 0x0000 }, { 1862, 0x0c04 }, { 1865, 0x0400 }, { 1866, 0x412c }, + { 1871, 0x1206 }, { 1875, 0x1154 }, { 1880, 0x0a4b }, { 1886, 0x0002 }, + /* 0x5b00 */ + { 1887, 0x0200 }, { 1888, 0x00c0 }, { 1890, 0x0000 }, { 1890, 0x0094 }, + { 1893, 0x0001 }, { 1894, 0xbfbb }, { 1907, 0x167c }, { 1915, 0x242b }, + { 1921, 0x9bbb }, { 1932, 0x7fa8 }, { 1942, 0x0c7f }, { 1951, 0xe379 }, + { 1961, 0x10f4 }, { 1967, 0xe00d }, { 1973, 0x4132 }, { 1978, 0x9f01 }, + /* 0x5c00 */ + { 1985, 0x8652 }, { 1991, 0x3572 }, { 1999, 0x10b4 }, { 2004, 0xff12 }, + { 2014, 0xcf27 }, { 2024, 0x4223 }, { 2029, 0xc06b }, { 2036, 0x8602 }, + { 2040, 0x3106 }, { 2045, 0x1fd3 }, { 2055, 0x3a0c }, { 2061, 0xa1aa }, + { 2068, 0x0812 }, { 2071, 0x0204 }, { 2073, 0x2572 }, { 2080, 0x0801 }, + /* 0x5d00 */ + { 2082, 0x40cc }, { 2087, 0x4850 }, { 2091, 0x62d0 }, { 2097, 0x6010 }, + { 2100, 0x1c80 }, { 2104, 0x2900 }, { 2107, 0x9a00 }, { 2111, 0x0010 }, + { 2112, 0x0004 }, { 2113, 0x2200 }, { 2115, 0x0000 }, { 2115, 0x0080 }, + { 2116, 0x2020 }, { 2118, 0x6800 }, { 2121, 0xcbe6 }, { 2131, 0x609e }, + /* 0x5e00 */ + { 2138, 0x916e }, { 2146, 0x3f73 }, { 2157, 0x60c0 }, { 2161, 0x3982 }, + { 2167, 0x1034 }, { 2171, 0x4830 }, { 2175, 0x0006 }, { 2177, 0xbd5c }, + { 2187, 0x8cd1 }, { 2194, 0xd6fb }, { 2206, 0x20e1 }, { 2211, 0x43e8 }, + { 2218, 0x0600 }, { 2220, 0x084e }, { 2225, 0x0500 }, { 2227, 0xc4d0 }, + /* 0x5f00 */ + { 2233, 0x8d1f }, { 2242, 0x89aa }, { 2249, 0xa6e1 }, { 2257, 0x1602 }, + { 2261, 0x0001 }, { 2262, 0x21ed }, { 2270, 0x3656 }, { 2278, 0x1a8b }, + { 2285, 0x1fb7 }, { 2296, 0x13a5 }, { 2303, 0x6502 }, { 2308, 0x30a0 }, + { 2312, 0xb278 }, { 2320, 0x23c7 }, { 2328, 0x6c93 }, { 2336, 0xe922 }, + /* 0x6000 */ + { 2343, 0xe47f }, { 2354, 0x3a74 }, { 2362, 0x8fe3 }, { 2372, 0x9820 }, + { 2376, 0x280e }, { 2381, 0x2625 }, { 2387, 0xbf9c }, { 2398, 0xbf49 }, + { 2408, 0x3218 }, { 2413, 0xac54 }, { 2420, 0xb949 }, { 2428, 0x1916 }, + { 2434, 0x0c60 }, { 2438, 0xb522 }, { 2445, 0xfbc1 }, { 2455, 0x0659 }, + /* 0x6100 */ + { 2461, 0xe343 }, { 2469, 0x8420 }, { 2472, 0x08d9 }, { 2478, 0x8000 }, + { 2479, 0x5500 }, { 2483, 0x2022 }, { 2486, 0x0184 }, { 2489, 0x00a1 }, + { 2492, 0x4800 }, { 2494, 0x2010 }, { 2496, 0x1380 }, { 2500, 0x4080 }, + { 2502, 0x0d04 }, { 2506, 0x0016 }, { 2509, 0x0040 }, { 2510, 0x8020 }, + /* 0x6200 */ + { 2512, 0xfd40 }, { 2520, 0x8de7 }, { 2530, 0x5436 }, { 2537, 0xe098 }, + { 2543, 0x7b8b }, { 2553, 0x091e }, { 2559, 0xfec8 }, { 2569, 0xd249 }, + { 2576, 0x0611 }, { 2580, 0x8dee }, { 2590, 0x1937 }, { 2598, 0xba22 }, + { 2605, 0x77f4 }, { 2616, 0x9fdd }, { 2628, 0xf3ec }, { 2639, 0xf0da }, + /* 0x6300 */ + { 2648, 0x4386 }, { 2654, 0xec42 }, { 2661, 0x8d3f }, { 2671, 0x2604 }, + { 2675, 0xfa6c }, { 2685, 0xc021 }, { 2689, 0x628e }, { 2696, 0x0cc2 }, + { 2701, 0xd785 }, { 2710, 0x0145 }, { 2714, 0x77ad }, { 2725, 0x5599 }, + { 2733, 0xe250 }, { 2739, 0x4045 }, { 2743, 0x260b }, { 2749, 0xa154 }, + /* 0x6400 */ + { 2755, 0x9827 }, { 2762, 0x5819 }, { 2768, 0x3443 }, { 2774, 0xa410 }, + { 2778, 0x05f2 }, { 2785, 0x4114 }, { 2789, 0x2280 }, { 2792, 0x0700 }, + { 2795, 0x00b4 }, { 2799, 0x4266 }, { 2805, 0x7210 }, { 2810, 0x15a1 }, + { 2816, 0x6025 }, { 2821, 0x4185 }, { 2826, 0x0054 }, { 2829, 0x0000 }, + /* 0x6500 */ + { 2829, 0x0201 }, { 2831, 0x0104 }, { 2833, 0xc820 }, { 2837, 0xcb70 }, + { 2845, 0x9320 }, { 2850, 0x6a62 }, { 2857, 0x184c }, { 2862, 0x0095 }, + { 2866, 0x1880 }, { 2869, 0x9a8b }, { 2877, 0xaab2 }, { 2885, 0x3201 }, + { 2889, 0xd87a }, { 2898, 0x00c4 }, { 2901, 0xf3e5 }, { 2912, 0x04c3 }, + /* 0x6600 */ + { 2917, 0xd44d }, { 2925, 0xa238 }, { 2931, 0xa1a1 }, { 2937, 0x5072 }, + { 2943, 0x980a }, { 2948, 0x84fc }, { 2956, 0xc152 }, { 2962, 0x44d1 }, + { 2968, 0x1094 }, { 2972, 0x20c2 }, { 2976, 0x4180 }, { 2979, 0x4210 }, + { 2982, 0x0000 }, { 2982, 0x3a00 }, { 2986, 0x0240 }, { 2988, 0xd29d }, + /* 0x6700 */ + { 2997, 0x2f01 }, { 3003, 0xa8b1 }, { 3010, 0xbd40 }, { 3017, 0x2432 }, + { 3022, 0xd34d }, { 3031, 0xd04b }, { 3038, 0xa723 }, { 3046, 0xd0ad }, + { 3054, 0x0a92 }, { 3059, 0x75a1 }, { 3067, 0xadac }, { 3076, 0x01e9 }, + { 3082, 0x801a }, { 3086, 0x771f }, { 3097, 0x9225 }, { 3103, 0xa01b }, + /* 0x6800 */ + { 3109, 0xdfa1 }, { 3119, 0x20ca }, { 3124, 0x0602 }, { 3127, 0x738c }, + { 3135, 0x577f }, { 3147, 0x003b }, { 3152, 0x0bff }, { 3163, 0x00d0 }, + { 3166, 0x806a }, { 3171, 0x0088 }, { 3173, 0xa1c4 }, { 3179, 0x0029 }, + { 3182, 0x2a05 }, { 3187, 0x0524 }, { 3191, 0x4009 }, { 3194, 0x1623 }, + /* 0x6900 */ + { 3200, 0x6822 }, { 3205, 0x8005 }, { 3208, 0x2011 }, { 3211, 0xa211 }, + { 3216, 0x0004 }, { 3217, 0x6490 }, { 3222, 0x4849 }, { 3227, 0x1382 }, + { 3232, 0x23d5 }, { 3240, 0x1930 }, { 3245, 0x2980 }, { 3249, 0x0892 }, + { 3253, 0x5402 }, { 3257, 0x8811 }, { 3261, 0x2001 }, { 3263, 0xa004 }, + /* 0x6a00 */ + { 3266, 0x0400 }, { 3267, 0x8180 }, { 3270, 0x8502 }, { 3274, 0x6022 }, + { 3278, 0x0090 }, { 3280, 0x0b01 }, { 3284, 0x0022 }, { 3286, 0x1202 }, + { 3289, 0x4011 }, { 3292, 0x0083 }, { 3295, 0x1a01 }, { 3299, 0x0000 }, + { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x0000 }, + /* 0x6b00 */ + { 3299, 0x0000 }, { 3299, 0x0000 }, { 3299, 0x009f }, { 3305, 0x4684 }, + { 3310, 0x12c8 }, { 3315, 0x0200 }, { 3316, 0x04fc }, { 3323, 0x1a00 }, + { 3326, 0x2ede }, { 3336, 0x0c4c }, { 3341, 0x0402 }, { 3343, 0x80b8 }, + { 3348, 0xa826 }, { 3354, 0x0afc }, { 3362, 0x8c02 }, { 3366, 0x2228 }, + /* 0x6c00 */ + { 3370, 0xa0e0 }, { 3375, 0x8f7b }, { 3386, 0xc7d6 }, { 3396, 0x2135 }, + { 3402, 0x06c7 }, { 3409, 0xf8b1 }, { 3418, 0x0713 }, { 3424, 0x6255 }, + { 3431, 0x936e }, { 3440, 0x8a19 }, { 3446, 0x6efa }, { 3457, 0xfb0e }, + { 3467, 0x1630 }, { 3472, 0x48f9 }, { 3480, 0xcd2f }, { 3490, 0x7deb }, + /* 0x6d00 */ + { 3502, 0x5892 }, { 3508, 0x4e84 }, { 3514, 0x4ca0 }, { 3519, 0x7a2e }, + { 3528, 0xedea }, { 3539, 0x561e }, { 3547, 0xc649 }, { 3554, 0x1190 }, + { 3558, 0x5324 }, { 3564, 0xe83a }, { 3572, 0xcfdb }, { 3584, 0x8124 }, + { 3588, 0x18f1 }, { 3595, 0x6342 }, { 3601, 0x5853 }, { 3608, 0x1a8a }, + /* 0x6e00 */ + { 3614, 0x7420 }, { 3619, 0x24d3 }, { 3626, 0xaa3b }, { 3635, 0x0514 }, + { 3639, 0x6018 }, { 3643, 0x8958 }, { 3649, 0x4800 }, { 3651, 0xc000 }, + { 3653, 0x8268 }, { 3658, 0x9101 }, { 3662, 0x84a4 }, { 3667, 0x2cd6 }, + { 3675, 0x8886 }, { 3680, 0xc4ba }, { 3688, 0x0377 }, { 3696, 0x0210 }, + /* 0x6f00 */ + { 3698, 0x8244 }, { 3702, 0x0038 }, { 3705, 0xae11 }, { 3712, 0x404a }, + { 3716, 0x28c0 }, { 3720, 0x5100 }, { 3723, 0x6044 }, { 3727, 0x1514 }, + { 3732, 0x7310 }, { 3738, 0x1000 }, { 3739, 0x0082 }, { 3741, 0x0248 }, + { 3744, 0x0205 }, { 3747, 0x4006 }, { 3750, 0xc003 }, { 3754, 0x0000 }, + /* 0x7000 */ + { 3754, 0x0000 }, { 3754, 0x0c02 }, { 3757, 0x0008 }, { 3758, 0x0220 }, + { 3760, 0x9000 }, { 3762, 0x4000 }, { 3763, 0xb800 }, { 3767, 0xd161 }, + { 3774, 0x4621 }, { 3779, 0x3274 }, { 3786, 0xf800 }, { 3791, 0x3b8a }, + { 3799, 0x050f }, { 3805, 0x8b00 }, { 3809, 0xbbd0 }, { 3818, 0x2280 }, + /* 0x7100 */ + { 3821, 0x0600 }, { 3823, 0x0769 }, { 3830, 0x8040 }, { 3832, 0x0043 }, + { 3835, 0x5420 }, { 3839, 0x5000 }, { 3841, 0x41d0 }, { 3846, 0x250c }, + { 3851, 0x8410 }, { 3854, 0x8310 }, { 3858, 0x1101 }, { 3861, 0x0228 }, + { 3864, 0x4008 }, { 3866, 0x0030 }, { 3868, 0x40a1 }, { 3872, 0x0200 }, + /* 0x7200 */ + { 3873, 0x0040 }, { 3874, 0x2000 }, { 3875, 0x1500 }, { 3878, 0xabe3 }, + { 3888, 0x3180 }, { 3892, 0xaa44 }, { 3898, 0xc2c6 }, { 3905, 0xc624 }, + { 3911, 0xac13 }, { 3918, 0x8004 }, { 3920, 0xb000 }, { 3923, 0x03d1 }, + { 3929, 0x611e }, { 3936, 0x4285 }, { 3941, 0xf303 }, { 3949, 0x1d9f }, + /* 0x7300 */ + { 3959, 0x440a }, { 3963, 0x78e8 }, { 3971, 0x5e26 }, { 3979, 0xc392 }, + { 3986, 0x2000 }, { 3987, 0x0085 }, { 3990, 0xb001 }, { 3994, 0x4000 }, + { 3995, 0x4a90 }, { 4000, 0x8842 }, { 4004, 0xca04 }, { 4009, 0x0c8d }, + { 4015, 0xa705 }, { 4022, 0x4203 }, { 4026, 0x22a1 }, { 4031, 0x0004 }, + /* 0x7400 */ + { 4032, 0x8668 }, { 4038, 0x0c01 }, { 4041, 0x5564 }, { 4048, 0x1079 }, + { 4054, 0x0002 }, { 4055, 0xdea0 }, { 4063, 0x2000 }, { 4064, 0x40c1 }, + { 4068, 0x488b }, { 4074, 0x5001 }, { 4077, 0x0380 }, { 4080, 0x0400 }, + { 4081, 0x0000 }, { 4081, 0x5004 }, { 4084, 0xc05d }, { 4091, 0x80d0 }, + /* 0x7500 */ + { 4095, 0xa010 }, { 4098, 0x970a }, { 4105, 0xbb20 }, { 4112, 0x4daf }, + { 4122, 0xd921 }, { 4129, 0x1e10 }, { 4134, 0x0460 }, { 4137, 0x8314 }, + { 4142, 0x8848 }, { 4146, 0xa6d6 }, { 4155, 0xd83b }, { 4164, 0x733f }, + { 4175, 0x27bc }, { 4184, 0x4974 }, { 4191, 0x0ddc }, { 4199, 0x9213 }, + /* 0x7600 */ + { 4205, 0x142b }, { 4211, 0x8ba1 }, { 4218, 0x2e75 }, { 4227, 0xd139 }, + { 4235, 0x3009 }, { 4239, 0x5050 }, { 4243, 0x8808 }, { 4246, 0x6900 }, + { 4250, 0x49d4 }, { 4257, 0x024a }, { 4261, 0x4010 }, { 4263, 0x8016 }, + { 4267, 0xe564 }, { 4275, 0x89d7 }, { 4284, 0xc020 }, { 4287, 0x5316 }, + /* 0x7700 */ + { 4294, 0x2b92 }, { 4301, 0x8600 }, { 4304, 0xa345 }, { 4311, 0x15e0 }, + { 4317, 0x008b }, { 4321, 0x0c03 }, { 4325, 0x196e }, { 4333, 0xe200 }, + { 4337, 0x7031 }, { 4343, 0x8006 }, { 4346, 0x16a5 }, { 4353, 0xa829 }, + { 4359, 0x2000 }, { 4360, 0x1880 }, { 4363, 0x7aac }, { 4372, 0xe148 }, + /* 0x7800 */ + { 4378, 0x3207 }, { 4384, 0xb5d6 }, { 4394, 0x32e8 }, { 4401, 0x5f91 }, + { 4410, 0x50a1 }, { 4415, 0x20e5 }, { 4421, 0x7c00 }, { 4426, 0x1080 }, + { 4428, 0x7280 }, { 4433, 0x9d8a }, { 4441, 0x00aa }, { 4445, 0x421f }, + { 4452, 0x0e22 }, { 4457, 0x0231 }, { 4461, 0x1100 }, { 4463, 0x0494 }, + /* 0x7900 */ + { 4467, 0x0022 }, { 4469, 0x4008 }, { 4471, 0x0010 }, { 4472, 0x5c10 }, + { 4477, 0x0343 }, { 4482, 0xfcc8 }, { 4491, 0xa1a5 }, { 4498, 0x0580 }, + { 4501, 0x8433 }, { 4507, 0x0400 }, { 4508, 0x0080 }, { 4509, 0x6e08 }, + { 4515, 0x2a4b }, { 4522, 0x8126 }, { 4527, 0xaad8 }, { 4535, 0x2901 }, + /* 0x7a00 */ + { 4539, 0x684d }, { 4546, 0x4490 }, { 4550, 0x0009 }, { 4552, 0xba88 }, + { 4559, 0x0040 }, { 4560, 0x0082 }, { 4562, 0x0000 }, { 4562, 0x87d1 }, + { 4570, 0x215b }, { 4577, 0xb1e6 }, { 4586, 0x3161 }, { 4592, 0x8008 }, + { 4594, 0x0800 }, { 4595, 0xc240 }, { 4599, 0xa069 }, { 4605, 0xa600 }, + /* 0x7b00 */ + { 4609, 0x8d58 }, { 4616, 0x4a32 }, { 4622, 0x5d71 }, { 4631, 0x550a }, + { 4637, 0x9aa0 }, { 4643, 0x2d57 }, { 4652, 0x4005 }, { 4655, 0x4aa6 }, + { 4662, 0x2021 }, { 4665, 0x30b1 }, { 4671, 0x3fc6 }, { 4681, 0x0112 }, + { 4684, 0x10c2 }, { 4688, 0x260a }, { 4693, 0x4462 }, { 4698, 0x5082 }, + /* 0x7c00 */ + { 4702, 0x9880 }, { 4706, 0x8040 }, { 4708, 0x04c0 }, { 4711, 0x8100 }, + { 4713, 0x2003 }, { 4716, 0x0000 }, { 4716, 0x0000 }, { 4716, 0x3818 }, + { 4721, 0x0200 }, { 4722, 0xf1a6 }, { 4731, 0x4434 }, { 4736, 0x720e }, + { 4743, 0x35a2 }, { 4750, 0x92e0 }, { 4756, 0x8101 }, { 4759, 0x0900 }, + /* 0x7d00 */ + { 4761, 0x0400 }, { 4762, 0x0000 }, { 4762, 0x8885 }, { 4767, 0x0000 }, + { 4767, 0x0000 }, { 4767, 0x0000 }, { 4767, 0x4000 }, { 4768, 0x0080 }, + { 4769, 0x0000 }, { 4769, 0x0000 }, { 4769, 0x4040 }, { 4771, 0x0000 }, + { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, + /* 0x7e00 */ + { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0000 }, { 4771, 0x0800 }, + { 4772, 0x0082 }, { 4774, 0x0000 }, { 4774, 0x0000 }, { 4774, 0x0000 }, + { 4774, 0x0004 }, { 4775, 0x8800 }, { 4777, 0xbfff }, { 4792, 0xe7ef }, + { 4805, 0xffff }, { 4821, 0xffbf }, { 4836, 0xefef }, { 4850, 0xfdff }, + /* 0x7f00 */ + { 4865, 0xfbff }, { 4880, 0xbffe }, { 4894, 0xffff }, { 4910, 0x057f }, + { 4919, 0x0034 }, { 4922, 0x85b3 }, { 4930, 0x4706 }, { 4936, 0x4216 }, + { 4941, 0x5402 }, { 4945, 0xe410 }, { 4950, 0x8092 }, { 4954, 0xb305 }, + { 4961, 0x5422 }, { 4966, 0x8130 }, { 4970, 0x4263 }, { 4976, 0x180b }, + /* 0x8000 */ + { 4981, 0x387b }, { 4990, 0x13f5 }, { 4999, 0x07e5 }, { 5007, 0xa9ea }, + { 5016, 0x3c4c }, { 5023, 0x0514 }, { 5027, 0x0600 }, { 5029, 0x8002 }, + { 5031, 0x1ad9 }, { 5039, 0xbd48 }, { 5047, 0xee37 }, { 5058, 0xf496 }, + { 5067, 0x705f }, { 5076, 0x7ec0 }, { 5084, 0xbfb2 }, { 5095, 0x355f }, + /* 0x8100 */ + { 5105, 0xe644 }, { 5112, 0x455f }, { 5121, 0x9000 }, { 5123, 0x4146 }, + { 5128, 0x1d40 }, { 5133, 0x063b }, { 5140, 0x62a1 }, { 5146, 0xfe13 }, + { 5156, 0x8505 }, { 5161, 0x3902 }, { 5166, 0x0548 }, { 5170, 0x0c08 }, + { 5173, 0x144f }, { 5180, 0x0000 }, { 5180, 0x3488 }, { 5185, 0x5818 }, + /* 0x8200 */ + { 5190, 0x3077 }, { 5198, 0xd815 }, { 5205, 0xbd0e }, { 5214, 0x4bfb }, + { 5225, 0x8a90 }, { 5230, 0x8500 }, { 5233, 0xc100 }, { 5236, 0xe61d }, + { 5245, 0xed14 }, { 5253, 0xb386 }, { 5261, 0xff72 }, { 5273, 0x639b }, + { 5282, 0xfd92 }, { 5292, 0xd9be }, { 5303, 0x887b }, { 5311, 0x0a92 }, + /* 0x8300 */ + { 5316, 0xd3fe }, { 5328, 0x1cb2 }, { 5335, 0xb980 }, { 5341, 0x177a }, + { 5350, 0x82c9 }, { 5356, 0xdc17 }, { 5365, 0xfffb }, { 5380, 0x3980 }, + { 5385, 0x4260 }, { 5389, 0x590c }, { 5395, 0x0f01 }, { 5400, 0x37df }, + { 5412, 0x94a3 }, { 5419, 0xb150 }, { 5425, 0x0623 }, { 5430, 0x2307 }, + /* 0x8400 */ + { 5436, 0xf85a }, { 5445, 0x3102 }, { 5449, 0x01f0 }, { 5454, 0x3102 }, + { 5458, 0x0040 }, { 5459, 0x1e82 }, { 5465, 0x3a0a }, { 5471, 0x056a }, + { 5477, 0x5b84 }, { 5484, 0x1280 }, { 5487, 0x8002 }, { 5489, 0xa714 }, + { 5496, 0x2612 }, { 5501, 0xa04b }, { 5507, 0x1069 }, { 5512, 0x9001 }, + /* 0x8500 */ + { 5515, 0x1000 }, { 5516, 0x848a }, { 5521, 0x1802 }, { 5524, 0x3f80 }, + { 5531, 0x0708 }, { 5535, 0x4240 }, { 5538, 0x0110 }, { 5540, 0x4e14 }, + { 5546, 0x80b0 }, { 5550, 0x1800 }, { 5552, 0xc510 }, { 5557, 0x0281 }, + { 5560, 0x8202 }, { 5563, 0x1029 }, { 5567, 0x0210 }, { 5569, 0x8800 }, + /* 0x8600 */ + { 5571, 0x0020 }, { 5572, 0x0042 }, { 5574, 0x0280 }, { 5576, 0x1100 }, + { 5578, 0xe000 }, { 5581, 0x4413 }, { 5586, 0x5804 }, { 5590, 0xfe02 }, + { 5598, 0x3c07 }, { 5605, 0x3028 }, { 5609, 0x9798 }, { 5617, 0x0473 }, + { 5623, 0xced1 }, { 5632, 0xcb13 }, { 5640, 0x6210 }, { 5644, 0x431f }, + /* 0x8700 */ + { 5652, 0x278d }, { 5660, 0x55ac }, { 5668, 0x422e }, { 5674, 0xc892 }, + { 5680, 0x5380 }, { 5685, 0x0288 }, { 5688, 0x4039 }, { 5693, 0x7851 }, + { 5700, 0x292c }, { 5706, 0x8088 }, { 5709, 0xb900 }, { 5714, 0x2428 }, + { 5718, 0x0c41 }, { 5722, 0x080e }, { 5726, 0x4421 }, { 5730, 0x4200 }, + /* 0x8800 */ + { 5732, 0x0408 }, { 5734, 0x0868 }, { 5738, 0x0006 }, { 5740, 0x1204 }, + { 5743, 0x3031 }, { 5748, 0x0290 }, { 5751, 0x5b3e }, { 5761, 0xe085 }, + { 5767, 0x2936 }, { 5774, 0x1044 }, { 5777, 0x2814 }, { 5781, 0x1082 }, + { 5784, 0x4266 }, { 5790, 0x8334 }, { 5796, 0x013c }, { 5801, 0x531b }, + /* 0x8900 */ + { 5809, 0x0404 }, { 5811, 0x0e0d }, { 5817, 0x0c22 }, { 5821, 0x0051 }, + { 5824, 0x0012 }, { 5826, 0xc000 }, { 5828, 0x0040 }, { 5829, 0x8800 }, + { 5831, 0x004a }, { 5834, 0x0000 }, { 5834, 0x0000 }, { 5834, 0x0000 }, + { 5834, 0xdff6 }, { 5847, 0x5447 }, { 5854, 0x8868 }, { 5859, 0x0008 }, + /* 0x8a00 */ + { 5860, 0x0081 }, { 5862, 0x0000 }, { 5862, 0x0000 }, { 5862, 0x4000 }, + { 5863, 0x0100 }, { 5864, 0x0000 }, { 5864, 0x0000 }, { 5864, 0x0200 }, + { 5865, 0x0600 }, { 5867, 0x0008 }, { 5868, 0x0000 }, { 5868, 0x0000 }, + { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, + /* 0x8b00 */ + { 5868, 0x0080 }, { 5869, 0x0000 }, { 5869, 0x0040 }, { 5870, 0x0000 }, + { 5870, 0x0000 }, { 5870, 0x0000 }, { 5870, 0x1040 }, { 5872, 0x0000 }, + { 5872, 0x0000 }, { 5872, 0x0000 }, { 5872, 0xefff }, { 5887, 0xf7fd }, + { 5901, 0xff7f }, { 5916, 0xfffe }, { 5931, 0xfbff }, { 5946, 0xffff }, + /* 0x8c00 */ + { 5962, 0xfdff }, { 5977, 0xbfff }, { 5992, 0xffff }, { 6008, 0x00ff }, + { 6016, 0x12c2 }, { 6021, 0x0420 }, { 6023, 0x0c06 }, { 6027, 0x0708 }, + { 6031, 0x1624 }, { 6036, 0x0110 }, { 6038, 0x0000 }, { 6038, 0x0000 }, + { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, { 6038, 0x0000 }, + /* 0x8d00 */ + { 6038, 0x0000 }, { 6038, 0xe000 }, { 6041, 0xfffe }, { 6056, 0xffff }, + { 6072, 0xffff }, { 6088, 0x7f79 }, { 6100, 0x28df }, { 6109, 0x00f9 }, + { 6115, 0x0c32 }, { 6120, 0x8012 }, { 6123, 0x0008 }, { 6124, 0xd53a }, + { 6133, 0xd858 }, { 6140, 0xecc2 }, { 6148, 0x9d18 }, { 6155, 0x2fa8 }, + /* 0x8e00 */ + { 6163, 0x9620 }, { 6168, 0xe010 }, { 6172, 0xd60c }, { 6179, 0x2622 }, + { 6184, 0x0f97 }, { 6193, 0x0206 }, { 6196, 0xb240 }, { 6201, 0x9055 }, + { 6207, 0x80a2 }, { 6211, 0x5011 }, { 6215, 0x9800 }, { 6218, 0x0404 }, + { 6220, 0x4000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, + /* 0x8f00 */ + { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0x0000 }, + { 6221, 0x0000 }, { 6221, 0x0000 }, { 6221, 0xfbc0 }, { 6230, 0xffff }, + { 6246, 0xeffe }, { 6260, 0xdffb }, { 6274, 0x0b08 }, { 6278, 0x6243 }, + { 6284, 0x41b6 }, { 6291, 0xfb3b }, { 6303, 0x6f74 }, { 6313, 0x2389 }, + /* 0x9000 */ + { 6319, 0xae7f }, { 6331, 0xecd7 }, { 6342, 0xe047 }, { 6349, 0x5960 }, + { 6355, 0xa096 }, { 6361, 0x098f }, { 6368, 0x612c }, { 6374, 0xa030 }, + { 6378, 0x090d }, { 6383, 0x2aaa }, { 6390, 0xd44e }, { 6398, 0x4f7b }, + { 6409, 0xc4b2 }, { 6416, 0x388b }, { 6423, 0xa9c6 }, { 6431, 0x6110 }, + /* 0x9100 */ + { 6435, 0x0014 }, { 6437, 0x4200 }, { 6439, 0x800c }, { 6442, 0x0202 }, + { 6444, 0xfe48 }, { 6453, 0x6485 }, { 6459, 0xd63e }, { 6469, 0xe3f7 }, + { 6481, 0x3aa0 }, { 6487, 0x0c07 }, { 6492, 0xe40c }, { 6498, 0x0430 }, + { 6501, 0xf680 }, { 6508, 0x1002 }, { 6510, 0x0000 }, { 6510, 0x0000 }, + /* 0x9200 */ + { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, + { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0000 }, { 6510, 0x0010 }, + { 6511, 0x4000 }, { 6512, 0x0000 }, { 6512, 0x4000 }, { 6513, 0x0000 }, + { 6513, 0x0100 }, { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x0000 }, + /* 0x9300 */ + { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x0000 }, { 6514, 0x4000 }, + { 6515, 0x0000 }, { 6515, 0x0000 }, { 6515, 0x0400 }, { 6516, 0x0000 }, + { 6516, 0x8000 }, { 6517, 0x0000 }, { 6517, 0x0000 }, { 6517, 0x0000 }, + { 6517, 0x0400 }, { 6518, 0x0040 }, { 6519, 0x0000 }, { 6519, 0x0000 }, + /* 0x9400 */ + { 6519, 0x0000 }, { 6519, 0x0000 }, { 6519, 0x0000 }, { 6519, 0x4000 }, + { 6520, 0x0000 }, { 6520, 0x0000 }, { 6520, 0x0800 }, { 6521, 0x0000 }, + { 6521, 0xffe0 }, { 6532, 0xfebd }, { 6545, 0xffff }, { 6561, 0xffff }, + { 6577, 0x7f7f }, { 6591, 0xfbe7 }, { 6604, 0xffbf }, { 6619, 0xf7ff }, + /* 0x9500 */ + { 6634, 0xffff }, { 6650, 0xefff }, { 6665, 0xff7e }, { 6679, 0xdff7 }, + { 6693, 0xf6f7 }, { 6706, 0xfbdf }, { 6720, 0xbffe }, { 6734, 0x804f }, + { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0x0000 }, + { 6740, 0x0000 }, { 6740, 0x0000 }, { 6740, 0xef00 }, { 6747, 0x7fff }, + /* 0x9600 */ + { 6762, 0xff7f }, { 6777, 0xb6f7 }, { 6789, 0x4406 }, { 6793, 0xb87e }, + { 6803, 0x3bf5 }, { 6814, 0x8831 }, { 6819, 0x1796 }, { 6827, 0x00f4 }, + { 6832, 0xa960 }, { 6838, 0x1391 }, { 6844, 0x0080 }, { 6845, 0x7249 }, + { 6852, 0xf2f3 }, { 6863, 0x0024 }, { 6865, 0x8701 }, { 6870, 0x42c8 }, + /* 0x9700 */ + { 6875, 0xe3d3 }, { 6885, 0x5048 }, { 6889, 0x2400 }, { 6891, 0x4305 }, + { 6896, 0x0000 }, { 6896, 0x4a4c }, { 6902, 0x0227 }, { 6907, 0x1058 }, + { 6911, 0x2820 }, { 6914, 0x0116 }, { 6918, 0xa809 }, { 6923, 0x0014 }, + { 6925, 0x0000 }, { 6925, 0x0000 }, { 6925, 0x3ec0 }, { 6932, 0x0068 }, + /* 0x9800 */ + { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, + { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0x0000 }, { 6935, 0xffe0 }, + { 6946, 0xb7ff }, { 6960, 0xfddb }, { 6973, 0x00f7 }, { 6980, 0x0000 }, + { 6980, 0x4000 }, { 6981, 0xc72e }, { 6990, 0x0180 }, { 6992, 0x0000 }, + /* 0x9900 */ + { 6992, 0x2000 }, { 6993, 0x0001 }, { 6994, 0x4000 }, { 6995, 0x0000 }, + { 6995, 0x0000 }, { 6995, 0x0030 }, { 6997, 0xffa8 }, { 7008, 0xb4f7 }, + { 7019, 0xadf3 }, { 7030, 0x03ff }, { 7040, 0x0120 }, { 7042, 0x0000 }, + { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, + /* 0x9a00 */ + { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0x0000 }, + { 7042, 0x0000 }, { 7042, 0x0000 }, { 7042, 0xf000 }, { 7046, 0xfffb }, + { 7061, 0x9df7 }, { 7073, 0xfdcf }, { 7086, 0x01bf }, { 7094, 0x15c3 }, + { 7101, 0x1827 }, { 7107, 0x810a }, { 7111, 0xa842 }, { 7116, 0x0a00 }, + /* 0x9b00 */ + { 7118, 0x8108 }, { 7121, 0x8008 }, { 7123, 0x8008 }, { 7125, 0x1804 }, + { 7128, 0xa3be }, { 7138, 0x0012 }, { 7140, 0x0000 }, { 7140, 0x0000 }, + { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, + { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, + /* 0x9c00 */ + { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, + { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x0000 }, { 7140, 0x9000 }, + { 7142, 0x69e6 }, { 7151, 0xdc37 }, { 7161, 0x6bff }, { 7174, 0x3dff }, + { 7187, 0xfcf8 }, { 7198, 0xf3f9 }, { 7210, 0x0004 }, +}; +static const Summary16 gb2312_uni2indx_page9e[27] = { + /* 0x9e00 */ + { 7211, 0x0000 }, { 7211, 0x8000 }, { 7212, 0xbf6f }, { 7225, 0xe7ee }, + { 7237, 0xdffe }, { 7251, 0x5da2 }, { 7259, 0x3fd8 }, { 7269, 0xc00b }, + { 7274, 0x0984 }, { 7278, 0xa00c }, { 7282, 0x0040 }, { 7283, 0x6910 }, + { 7288, 0xe210 }, { 7293, 0xb912 }, { 7300, 0x86a5 }, { 7307, 0x5a00 }, + /* 0x9f00 */ + { 7311, 0x6800 }, { 7314, 0x0289 }, { 7318, 0x9005 }, { 7322, 0x6a80 }, + { 7327, 0x0010 }, { 7328, 0x0003 }, { 7330, 0x0000 }, { 7330, 0x8000 }, + { 7331, 0x1ff9 }, { 7342, 0x8e00 }, { 7346, 0x0001 }, +}; +static const Summary16 gb2312_uni2indx_pageff[15] = { + /* 0xff00 */ + { 7347, 0xfffe }, { 7362, 0xffff }, { 7378, 0xffff }, { 7394, 0xffff }, + { 7410, 0xffff }, { 7426, 0x7fff }, { 7441, 0x0000 }, { 7441, 0x0000 }, + { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x0000 }, + { 7441, 0x0000 }, { 7441, 0x0000 }, { 7441, 0x002b }, +}; + +static int +gb2312_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc < 0x0460) + summary = &gb2312_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x2000 && wc < 0x2650) + summary = &gb2312_uni2indx_page20[(wc>>4)-0x200]; + else if (wc >= 0x3000 && wc < 0x3230) + summary = &gb2312_uni2indx_page30[(wc>>4)-0x300]; + else if (wc >= 0x4e00 && wc < 0x9cf0) + summary = &gb2312_uni2indx_page4e[(wc>>4)-0x4e0]; + else if (wc >= 0x9e00 && wc < 0x9fb0) + summary = &gb2312_uni2indx_page9e[(wc>>4)-0x9e0]; + else if (wc >= 0xff00 && wc < 0xfff0) + summary = &gb2312_uni2indx_pageff[(wc>>4)-0xff0]; + if (summary) { + unsigned short used = summary->used; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = gb2312_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/gbk.h b/nx-X11/lib/src/xlibi18n/lcUniConv/gbk.h new file mode 100644 index 000000000..09c2e63ee --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/gbk.h @@ -0,0 +1,6200 @@ + +/* + * GBK-0 + */ + +static const unsigned short gbk_2uni_page81[23766] = { + /* 0x81 */ + 0x4e02, 0x4e04, 0x4e05, 0x4e06, 0x4e0f, 0x4e12, 0x4e17, 0x4e1f, + 0x4e20, 0x4e21, 0x4e23, 0x4e26, 0x4e29, 0x4e2e, 0x4e2f, 0x4e31, + 0x4e33, 0x4e35, 0x4e37, 0x4e3c, 0x4e40, 0x4e41, 0x4e42, 0x4e44, + 0x4e46, 0x4e4a, 0x4e51, 0x4e55, 0x4e57, 0x4e5a, 0x4e5b, 0x4e62, + 0x4e63, 0x4e64, 0x4e65, 0x4e67, 0x4e68, 0x4e6a, 0x4e6b, 0x4e6c, + 0x4e6d, 0x4e6e, 0x4e6f, 0x4e72, 0x4e74, 0x4e75, 0x4e76, 0x4e77, + 0x4e78, 0x4e79, 0x4e7a, 0x4e7b, 0x4e7c, 0x4e7d, 0x4e7f, 0x4e80, + 0x4e81, 0x4e82, 0x4e83, 0x4e84, 0x4e85, 0x4e87, 0x4e8a, 0x4e90, + 0x4e96, 0x4e97, 0x4e99, 0x4e9c, 0x4e9d, 0x4e9e, 0x4ea3, 0x4eaa, + 0x4eaf, 0x4eb0, 0x4eb1, 0x4eb4, 0x4eb6, 0x4eb7, 0x4eb8, 0x4eb9, + 0x4ebc, 0x4ebd, 0x4ebe, 0x4ec8, 0x4ecc, 0x4ecf, 0x4ed0, 0x4ed2, + 0x4eda, 0x4edb, 0x4edc, 0x4ee0, 0x4ee2, 0x4ee6, 0x4ee7, 0x4ee9, + 0x4eed, 0x4eee, 0x4eef, 0x4ef1, 0x4ef4, 0x4ef8, 0x4ef9, 0x4efa, + 0x4efc, 0x4efe, 0x4f00, 0x4f02, 0x4f03, 0x4f04, 0x4f05, 0x4f06, + 0x4f07, 0x4f08, 0x4f0b, 0x4f0c, 0x4f12, 0x4f13, 0x4f14, 0x4f15, + 0x4f16, 0x4f1c, 0x4f1d, 0x4f21, 0x4f23, 0x4f28, 0x4f29, 0x4f2c, + 0x4f2d, 0x4f2e, 0x4f31, 0x4f33, 0x4f35, 0x4f37, 0x4f39, 0x4f3b, + 0x4f3e, 0x4f3f, 0x4f40, 0x4f41, 0x4f42, 0x4f44, 0x4f45, 0x4f47, + 0x4f48, 0x4f49, 0x4f4a, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, + 0x4f61, 0x4f62, 0x4f66, 0x4f68, 0x4f6a, 0x4f6b, 0x4f6d, 0x4f6e, + 0x4f71, 0x4f72, 0x4f75, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7d, + 0x4f80, 0x4f81, 0x4f82, 0x4f85, 0x4f86, 0x4f87, 0x4f8a, 0x4f8c, + 0x4f8e, 0x4f90, 0x4f92, 0x4f93, 0x4f95, 0x4f96, 0x4f98, 0x4f99, + 0x4f9a, 0x4f9c, 0x4f9e, 0x4f9f, 0x4fa1, 0x4fa2, + /* 0x82 */ + 0x4fa4, 0x4fab, 0x4fad, 0x4fb0, 0x4fb1, 0x4fb2, 0x4fb3, 0x4fb4, + 0x4fb6, 0x4fb7, 0x4fb8, 0x4fb9, 0x4fba, 0x4fbb, 0x4fbc, 0x4fbd, + 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc2, 0x4fc6, 0x4fc7, 0x4fc8, 0x4fc9, + 0x4fcb, 0x4fcc, 0x4fcd, 0x4fd2, 0x4fd3, 0x4fd4, 0x4fd5, 0x4fd6, + 0x4fd9, 0x4fdb, 0x4fe0, 0x4fe2, 0x4fe4, 0x4fe5, 0x4fe7, 0x4feb, + 0x4fec, 0x4ff0, 0x4ff2, 0x4ff4, 0x4ff5, 0x4ff6, 0x4ff7, 0x4ff9, + 0x4ffb, 0x4ffc, 0x4ffd, 0x4fff, 0x5000, 0x5001, 0x5002, 0x5003, + 0x5004, 0x5005, 0x5006, 0x5007, 0x5008, 0x5009, 0x500a, 0x500b, + 0x500e, 0x5010, 0x5011, 0x5013, 0x5015, 0x5016, 0x5017, 0x501b, + 0x501d, 0x501e, 0x5020, 0x5022, 0x5023, 0x5024, 0x5027, 0x502b, + 0x502f, 0x5030, 0x5031, 0x5032, 0x5033, 0x5034, 0x5035, 0x5036, + 0x5037, 0x5038, 0x5039, 0x503b, 0x503d, 0x503f, 0x5040, 0x5041, + 0x5042, 0x5044, 0x5045, 0x5046, 0x5049, 0x504a, 0x504b, 0x504d, + 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5056, 0x5057, 0x5058, + 0x5059, 0x505b, 0x505d, 0x505e, 0x505f, 0x5060, 0x5061, 0x5062, + 0x5063, 0x5064, 0x5066, 0x5067, 0x5068, 0x5069, 0x506a, 0x506b, + 0x506d, 0x506e, 0x506f, 0x5070, 0x5071, 0x5072, 0x5073, 0x5074, + 0x5075, 0x5078, 0x5079, 0x507a, 0x507c, 0x507d, 0x5081, 0x5082, + 0x5083, 0x5084, 0x5086, 0x5087, 0x5089, 0x508a, 0x508b, 0x508c, + 0x508e, 0x508f, 0x5090, 0x5091, 0x5092, 0x5093, 0x5094, 0x5095, + 0x5096, 0x5097, 0x5098, 0x5099, 0x509a, 0x509b, 0x509c, 0x509d, + 0x509e, 0x509f, 0x50a0, 0x50a1, 0x50a2, 0x50a4, 0x50a6, 0x50aa, + 0x50ab, 0x50ad, 0x50ae, 0x50af, 0x50b0, 0x50b1, 0x50b3, 0x50b4, + 0x50b5, 0x50b6, 0x50b7, 0x50b8, 0x50b9, 0x50bc, + /* 0x83 */ + 0x50bd, 0x50be, 0x50bf, 0x50c0, 0x50c1, 0x50c2, 0x50c3, 0x50c4, + 0x50c5, 0x50c6, 0x50c7, 0x50c8, 0x50c9, 0x50ca, 0x50cb, 0x50cc, + 0x50cd, 0x50ce, 0x50d0, 0x50d1, 0x50d2, 0x50d3, 0x50d4, 0x50d5, + 0x50d7, 0x50d8, 0x50d9, 0x50db, 0x50dc, 0x50dd, 0x50de, 0x50df, + 0x50e0, 0x50e1, 0x50e2, 0x50e3, 0x50e4, 0x50e5, 0x50e8, 0x50e9, + 0x50ea, 0x50eb, 0x50ef, 0x50f0, 0x50f1, 0x50f2, 0x50f4, 0x50f6, + 0x50f7, 0x50f8, 0x50f9, 0x50fa, 0x50fc, 0x50fd, 0x50fe, 0x50ff, + 0x5100, 0x5101, 0x5102, 0x5103, 0x5104, 0x5105, 0x5108, 0x5109, + 0x510a, 0x510c, 0x510d, 0x510e, 0x510f, 0x5110, 0x5111, 0x5113, + 0x5114, 0x5115, 0x5116, 0x5117, 0x5118, 0x5119, 0x511a, 0x511b, + 0x511c, 0x511d, 0x511e, 0x511f, 0x5120, 0x5122, 0x5123, 0x5124, + 0x5125, 0x5126, 0x5127, 0x5128, 0x5129, 0x512a, 0x512b, 0x512c, + 0x512d, 0x512e, 0x512f, 0x5130, 0x5131, 0x5132, 0x5133, 0x5134, + 0x5135, 0x5136, 0x5137, 0x5138, 0x5139, 0x513a, 0x513b, 0x513c, + 0x513d, 0x513e, 0x5142, 0x5147, 0x514a, 0x514c, 0x514e, 0x514f, + 0x5150, 0x5152, 0x5153, 0x5157, 0x5158, 0x5159, 0x515b, 0x515d, + 0x515e, 0x515f, 0x5160, 0x5161, 0x5163, 0x5164, 0x5166, 0x5167, + 0x5169, 0x516a, 0x516f, 0x5172, 0x517a, 0x517e, 0x517f, 0x5183, + 0x5184, 0x5186, 0x5187, 0x518a, 0x518b, 0x518e, 0x518f, 0x5190, + 0x5191, 0x5193, 0x5194, 0x5198, 0x519a, 0x519d, 0x519e, 0x519f, + 0x51a1, 0x51a3, 0x51a6, 0x51a7, 0x51a8, 0x51a9, 0x51aa, 0x51ad, + 0x51ae, 0x51b4, 0x51b8, 0x51b9, 0x51ba, 0x51be, 0x51bf, 0x51c1, + 0x51c2, 0x51c3, 0x51c5, 0x51c8, 0x51ca, 0x51cd, 0x51ce, 0x51d0, + 0x51d2, 0x51d3, 0x51d4, 0x51d5, 0x51d6, 0x51d7, + /* 0x84 */ + 0x51d8, 0x51d9, 0x51da, 0x51dc, 0x51de, 0x51df, 0x51e2, 0x51e3, + 0x51e5, 0x51e6, 0x51e7, 0x51e8, 0x51e9, 0x51ea, 0x51ec, 0x51ee, + 0x51f1, 0x51f2, 0x51f4, 0x51f7, 0x51fe, 0x5204, 0x5205, 0x5209, + 0x520b, 0x520c, 0x520f, 0x5210, 0x5213, 0x5214, 0x5215, 0x521c, + 0x521e, 0x521f, 0x5221, 0x5222, 0x5223, 0x5225, 0x5226, 0x5227, + 0x522a, 0x522c, 0x522f, 0x5231, 0x5232, 0x5234, 0x5235, 0x523c, + 0x523e, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524b, + 0x524e, 0x524f, 0x5252, 0x5253, 0x5255, 0x5257, 0x5258, 0x5259, + 0x525a, 0x525b, 0x525d, 0x525f, 0x5260, 0x5262, 0x5263, 0x5264, + 0x5266, 0x5268, 0x526b, 0x526c, 0x526d, 0x526e, 0x5270, 0x5271, + 0x5273, 0x5274, 0x5275, 0x5276, 0x5277, 0x5278, 0x5279, 0x527a, + 0x527b, 0x527c, 0x527e, 0x5280, 0x5283, 0x5284, 0x5285, 0x5286, + 0x5287, 0x5289, 0x528a, 0x528b, 0x528c, 0x528d, 0x528e, 0x528f, + 0x5291, 0x5292, 0x5294, 0x5295, 0x5296, 0x5297, 0x5298, 0x5299, + 0x529a, 0x529c, 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52ae, 0x52af, + 0x52b0, 0x52b4, 0x52b5, 0x52b6, 0x52b7, 0x52b8, 0x52b9, 0x52ba, + 0x52bb, 0x52bc, 0x52bd, 0x52c0, 0x52c1, 0x52c2, 0x52c4, 0x52c5, + 0x52c6, 0x52c8, 0x52ca, 0x52cc, 0x52cd, 0x52ce, 0x52cf, 0x52d1, + 0x52d3, 0x52d4, 0x52d5, 0x52d7, 0x52d9, 0x52da, 0x52db, 0x52dc, + 0x52dd, 0x52de, 0x52e0, 0x52e1, 0x52e2, 0x52e3, 0x52e5, 0x52e6, + 0x52e7, 0x52e8, 0x52e9, 0x52ea, 0x52eb, 0x52ec, 0x52ed, 0x52ee, + 0x52ef, 0x52f1, 0x52f2, 0x52f3, 0x52f4, 0x52f5, 0x52f6, 0x52f7, + 0x52f8, 0x52fb, 0x52fc, 0x52fd, 0x5301, 0x5302, 0x5303, 0x5304, + 0x5307, 0x5309, 0x530a, 0x530b, 0x530c, 0x530e, + /* 0x85 */ + 0x5311, 0x5312, 0x5313, 0x5314, 0x5318, 0x531b, 0x531c, 0x531e, + 0x531f, 0x5322, 0x5324, 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, + 0x532c, 0x532d, 0x532f, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, + 0x5335, 0x5336, 0x5337, 0x5338, 0x533c, 0x533d, 0x5340, 0x5342, + 0x5344, 0x5346, 0x534b, 0x534c, 0x534d, 0x5350, 0x5354, 0x5358, + 0x5359, 0x535b, 0x535d, 0x5365, 0x5368, 0x536a, 0x536c, 0x536d, + 0x5372, 0x5376, 0x5379, 0x537b, 0x537c, 0x537d, 0x537e, 0x5380, + 0x5381, 0x5383, 0x5387, 0x5388, 0x538a, 0x538e, 0x538f, 0x5390, + 0x5391, 0x5392, 0x5393, 0x5394, 0x5396, 0x5397, 0x5399, 0x539b, + 0x539c, 0x539e, 0x53a0, 0x53a1, 0x53a4, 0x53a7, 0x53aa, 0x53ab, + 0x53ac, 0x53ad, 0x53af, 0x53b0, 0x53b1, 0x53b2, 0x53b3, 0x53b4, + 0x53b5, 0x53b7, 0x53b8, 0x53b9, 0x53ba, 0x53bc, 0x53bd, 0x53be, + 0x53c0, 0x53c3, 0x53c4, 0x53c5, 0x53c6, 0x53c7, 0x53ce, 0x53cf, + 0x53d0, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dc, 0x53dd, 0x53de, + 0x53e1, 0x53e2, 0x53e7, 0x53f4, 0x53fa, 0x53fe, 0x53ff, 0x5400, + 0x5402, 0x5405, 0x5407, 0x540b, 0x5414, 0x5418, 0x5419, 0x541a, + 0x541c, 0x5422, 0x5424, 0x5425, 0x542a, 0x5430, 0x5433, 0x5436, + 0x5437, 0x543a, 0x543d, 0x543f, 0x5441, 0x5442, 0x5444, 0x5445, + 0x5447, 0x5449, 0x544c, 0x544d, 0x544e, 0x544f, 0x5451, 0x545a, + 0x545d, 0x545e, 0x545f, 0x5460, 0x5461, 0x5463, 0x5465, 0x5467, + 0x5469, 0x546a, 0x546b, 0x546c, 0x546d, 0x546e, 0x546f, 0x5470, + 0x5474, 0x5479, 0x547a, 0x547e, 0x547f, 0x5481, 0x5483, 0x5485, + 0x5487, 0x5488, 0x5489, 0x548a, 0x548d, 0x5491, 0x5493, 0x5497, + 0x5498, 0x549c, 0x549e, 0x549f, 0x54a0, 0x54a1, + /* 0x86 */ + 0x54a2, 0x54a5, 0x54ae, 0x54b0, 0x54b2, 0x54b5, 0x54b6, 0x54b7, + 0x54b9, 0x54ba, 0x54bc, 0x54be, 0x54c3, 0x54c5, 0x54ca, 0x54cb, + 0x54d6, 0x54d8, 0x54db, 0x54e0, 0x54e1, 0x54e2, 0x54e3, 0x54e4, + 0x54eb, 0x54ec, 0x54ef, 0x54f0, 0x54f1, 0x54f4, 0x54f5, 0x54f6, + 0x54f7, 0x54f8, 0x54f9, 0x54fb, 0x54fe, 0x5500, 0x5502, 0x5503, + 0x5504, 0x5505, 0x5508, 0x550a, 0x550b, 0x550c, 0x550d, 0x550e, + 0x5512, 0x5513, 0x5515, 0x5516, 0x5517, 0x5518, 0x5519, 0x551a, + 0x551c, 0x551d, 0x551e, 0x551f, 0x5521, 0x5525, 0x5526, 0x5528, + 0x5529, 0x552b, 0x552d, 0x5532, 0x5534, 0x5535, 0x5536, 0x5538, + 0x5539, 0x553a, 0x553b, 0x553d, 0x5540, 0x5542, 0x5545, 0x5547, + 0x5548, 0x554b, 0x554c, 0x554d, 0x554e, 0x554f, 0x5551, 0x5552, + 0x5553, 0x5554, 0x5557, 0x5558, 0x5559, 0x555a, 0x555b, 0x555d, + 0x555e, 0x555f, 0x5560, 0x5562, 0x5563, 0x5568, 0x5569, 0x556b, + 0x556f, 0x5570, 0x5571, 0x5572, 0x5573, 0x5574, 0x5579, 0x557a, + 0x557d, 0x557f, 0x5585, 0x5586, 0x558c, 0x558d, 0x558e, 0x5590, + 0x5592, 0x5593, 0x5595, 0x5596, 0x5597, 0x559a, 0x559b, 0x559e, + 0x55a0, 0x55a1, 0x55a2, 0x55a3, 0x55a4, 0x55a5, 0x55a6, 0x55a8, + 0x55a9, 0x55aa, 0x55ab, 0x55ac, 0x55ad, 0x55ae, 0x55af, 0x55b0, + 0x55b2, 0x55b4, 0x55b6, 0x55b8, 0x55ba, 0x55bc, 0x55bf, 0x55c0, + 0x55c1, 0x55c2, 0x55c3, 0x55c6, 0x55c7, 0x55c8, 0x55ca, 0x55cb, + 0x55ce, 0x55cf, 0x55d0, 0x55d5, 0x55d7, 0x55d8, 0x55d9, 0x55da, + 0x55db, 0x55de, 0x55e0, 0x55e2, 0x55e7, 0x55e9, 0x55ed, 0x55ee, + 0x55f0, 0x55f1, 0x55f4, 0x55f6, 0x55f8, 0x55f9, 0x55fa, 0x55fb, + 0x55fc, 0x55ff, 0x5602, 0x5603, 0x5604, 0x5605, + /* 0x87 */ + 0x5606, 0x5607, 0x560a, 0x560b, 0x560d, 0x5610, 0x5611, 0x5612, + 0x5613, 0x5614, 0x5615, 0x5616, 0x5617, 0x5619, 0x561a, 0x561c, + 0x561d, 0x5620, 0x5621, 0x5622, 0x5625, 0x5626, 0x5628, 0x5629, + 0x562a, 0x562b, 0x562e, 0x562f, 0x5630, 0x5633, 0x5635, 0x5637, + 0x5638, 0x563a, 0x563c, 0x563d, 0x563e, 0x5640, 0x5641, 0x5642, + 0x5643, 0x5644, 0x5645, 0x5646, 0x5647, 0x5648, 0x5649, 0x564a, + 0x564b, 0x564f, 0x5650, 0x5651, 0x5652, 0x5653, 0x5655, 0x5656, + 0x565a, 0x565b, 0x565d, 0x565e, 0x565f, 0x5660, 0x5661, 0x5663, + 0x5665, 0x5666, 0x5667, 0x566d, 0x566e, 0x566f, 0x5670, 0x5672, + 0x5673, 0x5674, 0x5675, 0x5677, 0x5678, 0x5679, 0x567a, 0x567d, + 0x567e, 0x567f, 0x5680, 0x5681, 0x5682, 0x5683, 0x5684, 0x5687, + 0x5688, 0x5689, 0x568a, 0x568b, 0x568c, 0x568d, 0x5690, 0x5691, + 0x5692, 0x5694, 0x5695, 0x5696, 0x5697, 0x5698, 0x5699, 0x569a, + 0x569b, 0x569c, 0x569d, 0x569e, 0x569f, 0x56a0, 0x56a1, 0x56a2, + 0x56a4, 0x56a5, 0x56a6, 0x56a7, 0x56a8, 0x56a9, 0x56aa, 0x56ab, + 0x56ac, 0x56ad, 0x56ae, 0x56b0, 0x56b1, 0x56b2, 0x56b3, 0x56b4, + 0x56b5, 0x56b6, 0x56b8, 0x56b9, 0x56ba, 0x56bb, 0x56bd, 0x56be, + 0x56bf, 0x56c0, 0x56c1, 0x56c2, 0x56c3, 0x56c4, 0x56c5, 0x56c6, + 0x56c7, 0x56c8, 0x56c9, 0x56cb, 0x56cc, 0x56cd, 0x56ce, 0x56cf, + 0x56d0, 0x56d1, 0x56d2, 0x56d3, 0x56d5, 0x56d6, 0x56d8, 0x56d9, + 0x56dc, 0x56e3, 0x56e5, 0x56e6, 0x56e7, 0x56e8, 0x56e9, 0x56ea, + 0x56ec, 0x56ee, 0x56ef, 0x56f2, 0x56f3, 0x56f6, 0x56f7, 0x56f8, + 0x56fb, 0x56fc, 0x5700, 0x5701, 0x5702, 0x5705, 0x5707, 0x570b, + 0x570c, 0x570d, 0x570e, 0x570f, 0x5710, 0x5711, + /* 0x88 */ + 0x5712, 0x5713, 0x5714, 0x5715, 0x5716, 0x5717, 0x5718, 0x5719, + 0x571a, 0x571b, 0x571d, 0x571e, 0x5720, 0x5721, 0x5722, 0x5724, + 0x5725, 0x5726, 0x5727, 0x572b, 0x5731, 0x5732, 0x5734, 0x5735, + 0x5736, 0x5737, 0x5738, 0x573c, 0x573d, 0x573f, 0x5741, 0x5743, + 0x5744, 0x5745, 0x5746, 0x5748, 0x5749, 0x574b, 0x5752, 0x5753, + 0x5754, 0x5755, 0x5756, 0x5758, 0x5759, 0x5762, 0x5763, 0x5765, + 0x5767, 0x576c, 0x576e, 0x5770, 0x5771, 0x5772, 0x5774, 0x5775, + 0x5778, 0x5779, 0x577a, 0x577d, 0x577e, 0x577f, 0x5780, 0x5781, + 0x5787, 0x5788, 0x5789, 0x578a, 0x578d, 0x578e, 0x578f, 0x5790, + 0x5791, 0x5794, 0x5795, 0x5796, 0x5797, 0x5798, 0x5799, 0x579a, + 0x579c, 0x579d, 0x579e, 0x579f, 0x57a5, 0x57a8, 0x57aa, 0x57ac, + 0x57af, 0x57b0, 0x57b1, 0x57b3, 0x57b5, 0x57b6, 0x57b7, 0x57b9, + 0x57ba, 0x57bb, 0x57bc, 0x57bd, 0x57be, 0x57bf, 0x57c0, 0x57c1, + 0x57c4, 0x57c5, 0x57c6, 0x57c7, 0x57c8, 0x57c9, 0x57ca, 0x57cc, + 0x57cd, 0x57d0, 0x57d1, 0x57d3, 0x57d6, 0x57d7, 0x57db, 0x57dc, + 0x57de, 0x57e1, 0x57e2, 0x57e3, 0x57e5, 0x57e6, 0x57e7, 0x57e8, + 0x57e9, 0x57ea, 0x57eb, 0x57ec, 0x57ee, 0x57f0, 0x57f1, 0x57f2, + 0x57f3, 0x57f5, 0x57f6, 0x57f7, 0x57fb, 0x57fc, 0x57fe, 0x57ff, + 0x5801, 0x5803, 0x5804, 0x5805, 0x5808, 0x5809, 0x580a, 0x580c, + 0x580e, 0x580f, 0x5810, 0x5812, 0x5813, 0x5814, 0x5816, 0x5817, + 0x5818, 0x581a, 0x581b, 0x581c, 0x581d, 0x581f, 0x5822, 0x5823, + 0x5825, 0x5826, 0x5827, 0x5828, 0x5829, 0x582b, 0x582c, 0x582d, + 0x582e, 0x582f, 0x5831, 0x5832, 0x5833, 0x5834, 0x5836, 0x5837, + 0x5838, 0x5839, 0x583a, 0x583b, 0x583c, 0x583d, + /* 0x89 */ + 0x583e, 0x583f, 0x5840, 0x5841, 0x5842, 0x5843, 0x5845, 0x5846, + 0x5847, 0x5848, 0x5849, 0x584a, 0x584b, 0x584e, 0x584f, 0x5850, + 0x5852, 0x5853, 0x5855, 0x5856, 0x5857, 0x5859, 0x585a, 0x585b, + 0x585c, 0x585d, 0x585f, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, + 0x5866, 0x5867, 0x5868, 0x5869, 0x586a, 0x586d, 0x586e, 0x586f, + 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, 0x5877, + 0x5878, 0x5879, 0x587a, 0x587b, 0x587c, 0x587d, 0x587f, 0x5882, + 0x5884, 0x5886, 0x5887, 0x5888, 0x588a, 0x588b, 0x588c, 0x588d, + 0x588e, 0x588f, 0x5890, 0x5891, 0x5894, 0x5895, 0x5896, 0x5897, + 0x5898, 0x589b, 0x589c, 0x589d, 0x58a0, 0x58a1, 0x58a2, 0x58a3, + 0x58a4, 0x58a5, 0x58a6, 0x58a7, 0x58aa, 0x58ab, 0x58ac, 0x58ad, + 0x58ae, 0x58af, 0x58b0, 0x58b1, 0x58b2, 0x58b3, 0x58b4, 0x58b5, + 0x58b6, 0x58b7, 0x58b8, 0x58b9, 0x58ba, 0x58bb, 0x58bd, 0x58be, + 0x58bf, 0x58c0, 0x58c2, 0x58c3, 0x58c4, 0x58c6, 0x58c7, 0x58c8, + 0x58c9, 0x58ca, 0x58cb, 0x58cc, 0x58cd, 0x58ce, 0x58cf, 0x58d0, + 0x58d2, 0x58d3, 0x58d4, 0x58d6, 0x58d7, 0x58d8, 0x58d9, 0x58da, + 0x58db, 0x58dc, 0x58dd, 0x58de, 0x58df, 0x58e0, 0x58e1, 0x58e2, + 0x58e3, 0x58e5, 0x58e6, 0x58e7, 0x58e8, 0x58e9, 0x58ea, 0x58ed, + 0x58ef, 0x58f1, 0x58f2, 0x58f4, 0x58f5, 0x58f7, 0x58f8, 0x58fa, + 0x58fb, 0x58fc, 0x58fd, 0x58fe, 0x58ff, 0x5900, 0x5901, 0x5903, + 0x5905, 0x5906, 0x5908, 0x5909, 0x590a, 0x590b, 0x590c, 0x590e, + 0x5910, 0x5911, 0x5912, 0x5913, 0x5917, 0x5918, 0x591b, 0x591d, + 0x591e, 0x5920, 0x5921, 0x5922, 0x5923, 0x5926, 0x5928, 0x592c, + 0x5930, 0x5932, 0x5933, 0x5935, 0x5936, 0x593b, + /* 0x8a */ + 0x593d, 0x593e, 0x593f, 0x5940, 0x5943, 0x5945, 0x5946, 0x594a, + 0x594c, 0x594d, 0x5950, 0x5952, 0x5953, 0x5959, 0x595b, 0x595c, + 0x595d, 0x595e, 0x595f, 0x5961, 0x5963, 0x5964, 0x5966, 0x5967, + 0x5968, 0x5969, 0x596a, 0x596b, 0x596c, 0x596d, 0x596e, 0x596f, + 0x5970, 0x5971, 0x5972, 0x5975, 0x5977, 0x597a, 0x597b, 0x597c, + 0x597e, 0x597f, 0x5980, 0x5985, 0x5989, 0x598b, 0x598c, 0x598e, + 0x598f, 0x5990, 0x5991, 0x5994, 0x5995, 0x5998, 0x599a, 0x599b, + 0x599c, 0x599d, 0x599f, 0x59a0, 0x59a1, 0x59a2, 0x59a6, 0x59a7, + 0x59ac, 0x59ad, 0x59b0, 0x59b1, 0x59b3, 0x59b4, 0x59b5, 0x59b6, + 0x59b7, 0x59b8, 0x59ba, 0x59bc, 0x59bd, 0x59bf, 0x59c0, 0x59c1, + 0x59c2, 0x59c3, 0x59c4, 0x59c5, 0x59c7, 0x59c8, 0x59c9, 0x59cc, + 0x59cd, 0x59ce, 0x59cf, 0x59d5, 0x59d6, 0x59d9, 0x59db, 0x59de, + 0x59df, 0x59e0, 0x59e1, 0x59e2, 0x59e4, 0x59e6, 0x59e7, 0x59e9, + 0x59ea, 0x59eb, 0x59ed, 0x59ee, 0x59ef, 0x59f0, 0x59f1, 0x59f2, + 0x59f3, 0x59f4, 0x59f5, 0x59f6, 0x59f7, 0x59f8, 0x59fa, 0x59fc, + 0x59fd, 0x59fe, 0x5a00, 0x5a02, 0x5a0a, 0x5a0b, 0x5a0d, 0x5a0e, + 0x5a0f, 0x5a10, 0x5a12, 0x5a14, 0x5a15, 0x5a16, 0x5a17, 0x5a19, + 0x5a1a, 0x5a1b, 0x5a1d, 0x5a1e, 0x5a21, 0x5a22, 0x5a24, 0x5a26, + 0x5a27, 0x5a28, 0x5a2a, 0x5a2b, 0x5a2c, 0x5a2d, 0x5a2e, 0x5a2f, + 0x5a30, 0x5a33, 0x5a35, 0x5a37, 0x5a38, 0x5a39, 0x5a3a, 0x5a3b, + 0x5a3d, 0x5a3e, 0x5a3f, 0x5a41, 0x5a42, 0x5a43, 0x5a44, 0x5a45, + 0x5a47, 0x5a48, 0x5a4b, 0x5a4c, 0x5a4d, 0x5a4e, 0x5a4f, 0x5a50, + 0x5a51, 0x5a52, 0x5a53, 0x5a54, 0x5a56, 0x5a57, 0x5a58, 0x5a59, + 0x5a5b, 0x5a5c, 0x5a5d, 0x5a5e, 0x5a5f, 0x5a60, + /* 0x8b */ + 0x5a61, 0x5a63, 0x5a64, 0x5a65, 0x5a66, 0x5a68, 0x5a69, 0x5a6b, + 0x5a6c, 0x5a6d, 0x5a6e, 0x5a6f, 0x5a70, 0x5a71, 0x5a72, 0x5a73, + 0x5a78, 0x5a79, 0x5a7b, 0x5a7c, 0x5a7d, 0x5a7e, 0x5a80, 0x5a81, + 0x5a82, 0x5a83, 0x5a84, 0x5a85, 0x5a86, 0x5a87, 0x5a88, 0x5a89, + 0x5a8a, 0x5a8b, 0x5a8c, 0x5a8d, 0x5a8e, 0x5a8f, 0x5a90, 0x5a91, + 0x5a93, 0x5a94, 0x5a95, 0x5a96, 0x5a97, 0x5a98, 0x5a99, 0x5a9c, + 0x5a9d, 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa1, 0x5aa2, 0x5aa3, 0x5aa4, + 0x5aa5, 0x5aa6, 0x5aa7, 0x5aa8, 0x5aa9, 0x5aab, 0x5aac, 0x5aad, + 0x5aae, 0x5aaf, 0x5ab0, 0x5ab1, 0x5ab4, 0x5ab6, 0x5ab7, 0x5ab9, + 0x5aba, 0x5abb, 0x5abc, 0x5abd, 0x5abf, 0x5ac0, 0x5ac3, 0x5ac4, + 0x5ac5, 0x5ac6, 0x5ac7, 0x5ac8, 0x5aca, 0x5acb, 0x5acd, 0x5ace, + 0x5acf, 0x5ad0, 0x5ad1, 0x5ad3, 0x5ad5, 0x5ad7, 0x5ad9, 0x5ada, + 0x5adb, 0x5add, 0x5ade, 0x5adf, 0x5ae2, 0x5ae4, 0x5ae5, 0x5ae7, + 0x5ae8, 0x5aea, 0x5aec, 0x5aed, 0x5aee, 0x5aef, 0x5af0, 0x5af2, + 0x5af3, 0x5af4, 0x5af5, 0x5af6, 0x5af7, 0x5af8, 0x5af9, 0x5afa, + 0x5afb, 0x5afc, 0x5afd, 0x5afe, 0x5aff, 0x5b00, 0x5b01, 0x5b02, + 0x5b03, 0x5b04, 0x5b05, 0x5b06, 0x5b07, 0x5b08, 0x5b0a, 0x5b0b, + 0x5b0c, 0x5b0d, 0x5b0e, 0x5b0f, 0x5b10, 0x5b11, 0x5b12, 0x5b13, + 0x5b14, 0x5b15, 0x5b18, 0x5b19, 0x5b1a, 0x5b1b, 0x5b1c, 0x5b1d, + 0x5b1e, 0x5b1f, 0x5b20, 0x5b21, 0x5b22, 0x5b23, 0x5b24, 0x5b25, + 0x5b26, 0x5b27, 0x5b28, 0x5b29, 0x5b2a, 0x5b2b, 0x5b2c, 0x5b2d, + 0x5b2e, 0x5b2f, 0x5b30, 0x5b31, 0x5b33, 0x5b35, 0x5b36, 0x5b38, + 0x5b39, 0x5b3a, 0x5b3b, 0x5b3c, 0x5b3d, 0x5b3e, 0x5b3f, 0x5b41, + 0x5b42, 0x5b43, 0x5b44, 0x5b45, 0x5b46, 0x5b47, + /* 0x8c */ + 0x5b48, 0x5b49, 0x5b4a, 0x5b4b, 0x5b4c, 0x5b4d, 0x5b4e, 0x5b4f, + 0x5b52, 0x5b56, 0x5b5e, 0x5b60, 0x5b61, 0x5b67, 0x5b68, 0x5b6b, + 0x5b6d, 0x5b6e, 0x5b6f, 0x5b72, 0x5b74, 0x5b76, 0x5b77, 0x5b78, + 0x5b79, 0x5b7b, 0x5b7c, 0x5b7e, 0x5b7f, 0x5b82, 0x5b86, 0x5b8a, + 0x5b8d, 0x5b8e, 0x5b90, 0x5b91, 0x5b92, 0x5b94, 0x5b96, 0x5b9f, + 0x5ba7, 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5bae, 0x5baf, 0x5bb1, + 0x5bb2, 0x5bb7, 0x5bba, 0x5bbb, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bc3, + 0x5bc8, 0x5bc9, 0x5bca, 0x5bcb, 0x5bcd, 0x5bce, 0x5bcf, 0x5bd1, + 0x5bd4, 0x5bd5, 0x5bd6, 0x5bd7, 0x5bd8, 0x5bd9, 0x5bda, 0x5bdb, + 0x5bdc, 0x5be0, 0x5be2, 0x5be3, 0x5be6, 0x5be7, 0x5be9, 0x5bea, + 0x5beb, 0x5bec, 0x5bed, 0x5bef, 0x5bf1, 0x5bf2, 0x5bf3, 0x5bf4, + 0x5bf5, 0x5bf6, 0x5bf7, 0x5bfd, 0x5bfe, 0x5c00, 0x5c02, 0x5c03, + 0x5c05, 0x5c07, 0x5c08, 0x5c0b, 0x5c0c, 0x5c0d, 0x5c0e, 0x5c10, + 0x5c12, 0x5c13, 0x5c17, 0x5c19, 0x5c1b, 0x5c1e, 0x5c1f, 0x5c20, + 0x5c21, 0x5c23, 0x5c26, 0x5c28, 0x5c29, 0x5c2a, 0x5c2b, 0x5c2d, + 0x5c2e, 0x5c2f, 0x5c30, 0x5c32, 0x5c33, 0x5c35, 0x5c36, 0x5c37, + 0x5c43, 0x5c44, 0x5c46, 0x5c47, 0x5c4c, 0x5c4d, 0x5c52, 0x5c53, + 0x5c54, 0x5c56, 0x5c57, 0x5c58, 0x5c5a, 0x5c5b, 0x5c5c, 0x5c5d, + 0x5c5f, 0x5c62, 0x5c64, 0x5c67, 0x5c68, 0x5c69, 0x5c6a, 0x5c6b, + 0x5c6c, 0x5c6d, 0x5c70, 0x5c72, 0x5c73, 0x5c74, 0x5c75, 0x5c76, + 0x5c77, 0x5c78, 0x5c7b, 0x5c7c, 0x5c7d, 0x5c7e, 0x5c80, 0x5c83, + 0x5c84, 0x5c85, 0x5c86, 0x5c87, 0x5c89, 0x5c8a, 0x5c8b, 0x5c8e, + 0x5c8f, 0x5c92, 0x5c93, 0x5c95, 0x5c9d, 0x5c9e, 0x5c9f, 0x5ca0, + 0x5ca1, 0x5ca4, 0x5ca5, 0x5ca6, 0x5ca7, 0x5ca8, + /* 0x8d */ + 0x5caa, 0x5cae, 0x5caf, 0x5cb0, 0x5cb2, 0x5cb4, 0x5cb6, 0x5cb9, + 0x5cba, 0x5cbb, 0x5cbc, 0x5cbe, 0x5cc0, 0x5cc2, 0x5cc3, 0x5cc5, + 0x5cc6, 0x5cc7, 0x5cc8, 0x5cc9, 0x5cca, 0x5ccc, 0x5ccd, 0x5cce, + 0x5ccf, 0x5cd0, 0x5cd1, 0x5cd3, 0x5cd4, 0x5cd5, 0x5cd6, 0x5cd7, + 0x5cd8, 0x5cda, 0x5cdb, 0x5cdc, 0x5cdd, 0x5cde, 0x5cdf, 0x5ce0, + 0x5ce2, 0x5ce3, 0x5ce7, 0x5ce9, 0x5ceb, 0x5cec, 0x5cee, 0x5cef, + 0x5cf1, 0x5cf2, 0x5cf3, 0x5cf4, 0x5cf5, 0x5cf6, 0x5cf7, 0x5cf8, + 0x5cf9, 0x5cfa, 0x5cfc, 0x5cfd, 0x5cfe, 0x5cff, 0x5d00, 0x5d01, + 0x5d04, 0x5d05, 0x5d08, 0x5d09, 0x5d0a, 0x5d0b, 0x5d0c, 0x5d0d, + 0x5d0f, 0x5d10, 0x5d11, 0x5d12, 0x5d13, 0x5d15, 0x5d17, 0x5d18, + 0x5d19, 0x5d1a, 0x5d1c, 0x5d1d, 0x5d1f, 0x5d20, 0x5d21, 0x5d22, + 0x5d23, 0x5d25, 0x5d28, 0x5d2a, 0x5d2b, 0x5d2c, 0x5d2f, 0x5d30, + 0x5d31, 0x5d32, 0x5d33, 0x5d35, 0x5d36, 0x5d37, 0x5d38, 0x5d39, + 0x5d3a, 0x5d3b, 0x5d3c, 0x5d3f, 0x5d40, 0x5d41, 0x5d42, 0x5d43, + 0x5d44, 0x5d45, 0x5d46, 0x5d48, 0x5d49, 0x5d4d, 0x5d4e, 0x5d4f, + 0x5d50, 0x5d51, 0x5d52, 0x5d53, 0x5d54, 0x5d55, 0x5d56, 0x5d57, + 0x5d59, 0x5d5a, 0x5d5c, 0x5d5e, 0x5d5f, 0x5d60, 0x5d61, 0x5d62, + 0x5d63, 0x5d64, 0x5d65, 0x5d66, 0x5d67, 0x5d68, 0x5d6a, 0x5d6d, + 0x5d6e, 0x5d70, 0x5d71, 0x5d72, 0x5d73, 0x5d75, 0x5d76, 0x5d77, + 0x5d78, 0x5d79, 0x5d7a, 0x5d7b, 0x5d7c, 0x5d7d, 0x5d7e, 0x5d7f, + 0x5d80, 0x5d81, 0x5d83, 0x5d84, 0x5d85, 0x5d86, 0x5d87, 0x5d88, + 0x5d89, 0x5d8a, 0x5d8b, 0x5d8c, 0x5d8d, 0x5d8e, 0x5d8f, 0x5d90, + 0x5d91, 0x5d92, 0x5d93, 0x5d94, 0x5d95, 0x5d96, 0x5d97, 0x5d98, + 0x5d9a, 0x5d9b, 0x5d9c, 0x5d9e, 0x5d9f, 0x5da0, + /* 0x8e */ + 0x5da1, 0x5da2, 0x5da3, 0x5da4, 0x5da5, 0x5da6, 0x5da7, 0x5da8, + 0x5da9, 0x5daa, 0x5dab, 0x5dac, 0x5dad, 0x5dae, 0x5daf, 0x5db0, + 0x5db1, 0x5db2, 0x5db3, 0x5db4, 0x5db5, 0x5db6, 0x5db8, 0x5db9, + 0x5dba, 0x5dbb, 0x5dbc, 0x5dbd, 0x5dbe, 0x5dbf, 0x5dc0, 0x5dc1, + 0x5dc2, 0x5dc3, 0x5dc4, 0x5dc6, 0x5dc7, 0x5dc8, 0x5dc9, 0x5dca, + 0x5dcb, 0x5dcc, 0x5dce, 0x5dcf, 0x5dd0, 0x5dd1, 0x5dd2, 0x5dd3, + 0x5dd4, 0x5dd5, 0x5dd6, 0x5dd7, 0x5dd8, 0x5dd9, 0x5dda, 0x5ddc, + 0x5ddf, 0x5de0, 0x5de3, 0x5de4, 0x5dea, 0x5dec, 0x5ded, 0x5df0, + 0x5df5, 0x5df6, 0x5df8, 0x5df9, 0x5dfa, 0x5dfb, 0x5dfc, 0x5dff, + 0x5e00, 0x5e04, 0x5e07, 0x5e09, 0x5e0a, 0x5e0b, 0x5e0d, 0x5e0e, + 0x5e12, 0x5e13, 0x5e17, 0x5e1e, 0x5e1f, 0x5e20, 0x5e21, 0x5e22, + 0x5e23, 0x5e24, 0x5e25, 0x5e28, 0x5e29, 0x5e2a, 0x5e2b, 0x5e2c, + 0x5e2f, 0x5e30, 0x5e32, 0x5e33, 0x5e34, 0x5e35, 0x5e36, 0x5e39, + 0x5e3a, 0x5e3e, 0x5e3f, 0x5e40, 0x5e41, 0x5e43, 0x5e46, 0x5e47, + 0x5e48, 0x5e49, 0x5e4a, 0x5e4b, 0x5e4d, 0x5e4e, 0x5e4f, 0x5e50, + 0x5e51, 0x5e52, 0x5e53, 0x5e56, 0x5e57, 0x5e58, 0x5e59, 0x5e5a, + 0x5e5c, 0x5e5d, 0x5e5f, 0x5e60, 0x5e63, 0x5e64, 0x5e65, 0x5e66, + 0x5e67, 0x5e68, 0x5e69, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, + 0x5e6f, 0x5e70, 0x5e71, 0x5e75, 0x5e77, 0x5e79, 0x5e7e, 0x5e81, + 0x5e82, 0x5e83, 0x5e85, 0x5e88, 0x5e89, 0x5e8c, 0x5e8d, 0x5e8e, + 0x5e92, 0x5e98, 0x5e9b, 0x5e9d, 0x5ea1, 0x5ea2, 0x5ea3, 0x5ea4, + 0x5ea8, 0x5ea9, 0x5eaa, 0x5eab, 0x5eac, 0x5eae, 0x5eaf, 0x5eb0, + 0x5eb1, 0x5eb2, 0x5eb4, 0x5eba, 0x5ebb, 0x5ebc, 0x5ebd, 0x5ebf, + 0x5ec0, 0x5ec1, 0x5ec2, 0x5ec3, 0x5ec4, 0x5ec5, + /* 0x8f */ + 0x5ec6, 0x5ec7, 0x5ec8, 0x5ecb, 0x5ecc, 0x5ecd, 0x5ece, 0x5ecf, + 0x5ed0, 0x5ed4, 0x5ed5, 0x5ed7, 0x5ed8, 0x5ed9, 0x5eda, 0x5edc, + 0x5edd, 0x5ede, 0x5edf, 0x5ee0, 0x5ee1, 0x5ee2, 0x5ee3, 0x5ee4, + 0x5ee5, 0x5ee6, 0x5ee7, 0x5ee9, 0x5eeb, 0x5eec, 0x5eed, 0x5eee, + 0x5eef, 0x5ef0, 0x5ef1, 0x5ef2, 0x5ef3, 0x5ef5, 0x5ef8, 0x5ef9, + 0x5efb, 0x5efc, 0x5efd, 0x5f05, 0x5f06, 0x5f07, 0x5f09, 0x5f0c, + 0x5f0d, 0x5f0e, 0x5f10, 0x5f12, 0x5f14, 0x5f16, 0x5f19, 0x5f1a, + 0x5f1c, 0x5f1d, 0x5f1e, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f28, + 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f32, 0x5f33, 0x5f34, 0x5f35, + 0x5f36, 0x5f37, 0x5f38, 0x5f3b, 0x5f3d, 0x5f3e, 0x5f3f, 0x5f41, + 0x5f42, 0x5f43, 0x5f44, 0x5f45, 0x5f46, 0x5f47, 0x5f48, 0x5f49, + 0x5f4a, 0x5f4b, 0x5f4c, 0x5f4d, 0x5f4e, 0x5f4f, 0x5f51, 0x5f54, + 0x5f59, 0x5f5a, 0x5f5b, 0x5f5c, 0x5f5e, 0x5f5f, 0x5f60, 0x5f63, + 0x5f65, 0x5f67, 0x5f68, 0x5f6b, 0x5f6e, 0x5f6f, 0x5f72, 0x5f74, + 0x5f75, 0x5f76, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, 0x5f7f, 0x5f83, + 0x5f86, 0x5f8d, 0x5f8e, 0x5f8f, 0x5f91, 0x5f93, 0x5f94, 0x5f96, + 0x5f9a, 0x5f9b, 0x5f9d, 0x5f9e, 0x5f9f, 0x5fa0, 0x5fa2, 0x5fa3, + 0x5fa4, 0x5fa5, 0x5fa6, 0x5fa7, 0x5fa9, 0x5fab, 0x5fac, 0x5faf, + 0x5fb0, 0x5fb1, 0x5fb2, 0x5fb3, 0x5fb4, 0x5fb6, 0x5fb8, 0x5fb9, + 0x5fba, 0x5fbb, 0x5fbe, 0x5fbf, 0x5fc0, 0x5fc1, 0x5fc2, 0x5fc7, + 0x5fc8, 0x5fca, 0x5fcb, 0x5fce, 0x5fd3, 0x5fd4, 0x5fd5, 0x5fda, + 0x5fdb, 0x5fdc, 0x5fde, 0x5fdf, 0x5fe2, 0x5fe3, 0x5fe5, 0x5fe6, + 0x5fe8, 0x5fe9, 0x5fec, 0x5fef, 0x5ff0, 0x5ff2, 0x5ff3, 0x5ff4, + 0x5ff6, 0x5ff7, 0x5ff9, 0x5ffa, 0x5ffc, 0x6007, + /* 0x90 */ + 0x6008, 0x6009, 0x600b, 0x600c, 0x6010, 0x6011, 0x6013, 0x6017, + 0x6018, 0x601a, 0x601e, 0x601f, 0x6022, 0x6023, 0x6024, 0x602c, + 0x602d, 0x602e, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6036, + 0x6037, 0x6038, 0x6039, 0x603a, 0x603d, 0x603e, 0x6040, 0x6044, + 0x6045, 0x6046, 0x6047, 0x6048, 0x6049, 0x604a, 0x604c, 0x604e, + 0x604f, 0x6051, 0x6053, 0x6054, 0x6056, 0x6057, 0x6058, 0x605b, + 0x605c, 0x605e, 0x605f, 0x6060, 0x6061, 0x6065, 0x6066, 0x606e, + 0x6071, 0x6072, 0x6074, 0x6075, 0x6077, 0x607e, 0x6080, 0x6081, + 0x6082, 0x6085, 0x6086, 0x6087, 0x6088, 0x608a, 0x608b, 0x608e, + 0x608f, 0x6090, 0x6091, 0x6093, 0x6095, 0x6097, 0x6098, 0x6099, + 0x609c, 0x609e, 0x60a1, 0x60a2, 0x60a4, 0x60a5, 0x60a7, 0x60a9, + 0x60aa, 0x60ae, 0x60b0, 0x60b3, 0x60b5, 0x60b6, 0x60b7, 0x60b9, + 0x60ba, 0x60bd, 0x60be, 0x60bf, 0x60c0, 0x60c1, 0x60c2, 0x60c3, + 0x60c4, 0x60c7, 0x60c8, 0x60c9, 0x60cc, 0x60cd, 0x60ce, 0x60cf, + 0x60d0, 0x60d2, 0x60d3, 0x60d4, 0x60d6, 0x60d7, 0x60d9, 0x60db, + 0x60de, 0x60e1, 0x60e2, 0x60e3, 0x60e4, 0x60e5, 0x60ea, 0x60f1, + 0x60f2, 0x60f5, 0x60f7, 0x60f8, 0x60fb, 0x60fc, 0x60fd, 0x60fe, + 0x60ff, 0x6102, 0x6103, 0x6104, 0x6105, 0x6107, 0x610a, 0x610b, + 0x610c, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, 0x6116, 0x6117, + 0x6118, 0x6119, 0x611b, 0x611c, 0x611d, 0x611e, 0x6121, 0x6122, + 0x6125, 0x6128, 0x6129, 0x612a, 0x612c, 0x612d, 0x612e, 0x612f, + 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, 0x6137, + 0x6138, 0x6139, 0x613a, 0x613b, 0x613c, 0x613d, 0x613e, 0x6140, + 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, + /* 0x91 */ + 0x6147, 0x6149, 0x614b, 0x614d, 0x614f, 0x6150, 0x6152, 0x6153, + 0x6154, 0x6156, 0x6157, 0x6158, 0x6159, 0x615a, 0x615b, 0x615c, + 0x615e, 0x615f, 0x6160, 0x6161, 0x6163, 0x6164, 0x6165, 0x6166, + 0x6169, 0x616a, 0x616b, 0x616c, 0x616d, 0x616e, 0x616f, 0x6171, + 0x6172, 0x6173, 0x6174, 0x6176, 0x6178, 0x6179, 0x617a, 0x617b, + 0x617c, 0x617d, 0x617e, 0x617f, 0x6180, 0x6181, 0x6182, 0x6183, + 0x6184, 0x6185, 0x6186, 0x6187, 0x6188, 0x6189, 0x618a, 0x618c, + 0x618d, 0x618f, 0x6190, 0x6191, 0x6192, 0x6193, 0x6195, 0x6196, + 0x6197, 0x6198, 0x6199, 0x619a, 0x619b, 0x619c, 0x619e, 0x619f, + 0x61a0, 0x61a1, 0x61a2, 0x61a3, 0x61a4, 0x61a5, 0x61a6, 0x61aa, + 0x61ab, 0x61ad, 0x61ae, 0x61af, 0x61b0, 0x61b1, 0x61b2, 0x61b3, + 0x61b4, 0x61b5, 0x61b6, 0x61b8, 0x61b9, 0x61ba, 0x61bb, 0x61bc, + 0x61bd, 0x61bf, 0x61c0, 0x61c1, 0x61c3, 0x61c4, 0x61c5, 0x61c6, + 0x61c7, 0x61c9, 0x61cc, 0x61cd, 0x61ce, 0x61cf, 0x61d0, 0x61d3, + 0x61d5, 0x61d6, 0x61d7, 0x61d8, 0x61d9, 0x61da, 0x61db, 0x61dc, + 0x61dd, 0x61de, 0x61df, 0x61e0, 0x61e1, 0x61e2, 0x61e3, 0x61e4, + 0x61e5, 0x61e7, 0x61e8, 0x61e9, 0x61ea, 0x61eb, 0x61ec, 0x61ed, + 0x61ee, 0x61ef, 0x61f0, 0x61f1, 0x61f2, 0x61f3, 0x61f4, 0x61f6, + 0x61f7, 0x61f8, 0x61f9, 0x61fa, 0x61fb, 0x61fc, 0x61fd, 0x61fe, + 0x6200, 0x6201, 0x6202, 0x6203, 0x6204, 0x6205, 0x6207, 0x6209, + 0x6213, 0x6214, 0x6219, 0x621c, 0x621d, 0x621e, 0x6220, 0x6223, + 0x6226, 0x6227, 0x6228, 0x6229, 0x622b, 0x622d, 0x622f, 0x6230, + 0x6231, 0x6232, 0x6235, 0x6236, 0x6238, 0x6239, 0x623a, 0x623b, + 0x623c, 0x6242, 0x6244, 0x6245, 0x6246, 0x624a, + /* 0x92 */ + 0x624f, 0x6250, 0x6255, 0x6256, 0x6257, 0x6259, 0x625a, 0x625c, + 0x625d, 0x625e, 0x625f, 0x6260, 0x6261, 0x6262, 0x6264, 0x6265, + 0x6268, 0x6271, 0x6272, 0x6274, 0x6275, 0x6277, 0x6278, 0x627a, + 0x627b, 0x627d, 0x6281, 0x6282, 0x6283, 0x6285, 0x6286, 0x6287, + 0x6288, 0x628b, 0x628c, 0x628d, 0x628e, 0x628f, 0x6290, 0x6294, + 0x6299, 0x629c, 0x629d, 0x629e, 0x62a3, 0x62a6, 0x62a7, 0x62a9, + 0x62aa, 0x62ad, 0x62ae, 0x62af, 0x62b0, 0x62b2, 0x62b3, 0x62b4, + 0x62b6, 0x62b7, 0x62b8, 0x62ba, 0x62be, 0x62c0, 0x62c1, 0x62c3, + 0x62cb, 0x62cf, 0x62d1, 0x62d5, 0x62dd, 0x62de, 0x62e0, 0x62e1, + 0x62e4, 0x62ea, 0x62eb, 0x62f0, 0x62f2, 0x62f5, 0x62f8, 0x62f9, + 0x62fa, 0x62fb, 0x6300, 0x6303, 0x6304, 0x6305, 0x6306, 0x630a, + 0x630b, 0x630c, 0x630d, 0x630f, 0x6310, 0x6312, 0x6313, 0x6314, + 0x6315, 0x6317, 0x6318, 0x6319, 0x631c, 0x6326, 0x6327, 0x6329, + 0x632c, 0x632d, 0x632e, 0x6330, 0x6331, 0x6333, 0x6334, 0x6335, + 0x6336, 0x6337, 0x6338, 0x633b, 0x633c, 0x633e, 0x633f, 0x6340, + 0x6341, 0x6344, 0x6347, 0x6348, 0x634a, 0x6351, 0x6352, 0x6353, + 0x6354, 0x6356, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, 0x635c, + 0x635d, 0x6360, 0x6364, 0x6365, 0x6366, 0x6368, 0x636a, 0x636b, + 0x636c, 0x636f, 0x6370, 0x6372, 0x6373, 0x6374, 0x6375, 0x6378, + 0x6379, 0x637c, 0x637d, 0x637e, 0x637f, 0x6381, 0x6383, 0x6384, + 0x6385, 0x6386, 0x638b, 0x638d, 0x6391, 0x6393, 0x6394, 0x6395, + 0x6397, 0x6399, 0x639a, 0x639b, 0x639c, 0x639d, 0x639e, 0x639f, + 0x63a1, 0x63a4, 0x63a6, 0x63ab, 0x63af, 0x63b1, 0x63b2, 0x63b5, + 0x63b6, 0x63b9, 0x63bb, 0x63bd, 0x63bf, 0x63c0, + /* 0x93 */ + 0x63c1, 0x63c2, 0x63c3, 0x63c5, 0x63c7, 0x63c8, 0x63ca, 0x63cb, + 0x63cc, 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63d7, 0x63d8, 0x63d9, + 0x63da, 0x63db, 0x63dc, 0x63dd, 0x63df, 0x63e2, 0x63e4, 0x63e5, + 0x63e6, 0x63e7, 0x63e8, 0x63eb, 0x63ec, 0x63ee, 0x63ef, 0x63f0, + 0x63f1, 0x63f3, 0x63f5, 0x63f7, 0x63f9, 0x63fa, 0x63fb, 0x63fc, + 0x63fe, 0x6403, 0x6404, 0x6406, 0x6407, 0x6408, 0x6409, 0x640a, + 0x640d, 0x640e, 0x6411, 0x6412, 0x6415, 0x6416, 0x6417, 0x6418, + 0x6419, 0x641a, 0x641d, 0x641f, 0x6422, 0x6423, 0x6424, 0x6425, + 0x6427, 0x6428, 0x6429, 0x642b, 0x642e, 0x642f, 0x6430, 0x6431, + 0x6432, 0x6433, 0x6435, 0x6436, 0x6437, 0x6438, 0x6439, 0x643b, + 0x643c, 0x643e, 0x6440, 0x6442, 0x6443, 0x6449, 0x644b, 0x644c, + 0x644d, 0x644e, 0x644f, 0x6450, 0x6451, 0x6453, 0x6455, 0x6456, + 0x6457, 0x6459, 0x645a, 0x645b, 0x645c, 0x645d, 0x645f, 0x6460, + 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, 0x6466, 0x6468, 0x646a, + 0x646b, 0x646c, 0x646e, 0x646f, 0x6470, 0x6471, 0x6472, 0x6473, + 0x6474, 0x6475, 0x6476, 0x6477, 0x647b, 0x647c, 0x647d, 0x647e, + 0x647f, 0x6480, 0x6481, 0x6483, 0x6486, 0x6488, 0x6489, 0x648a, + 0x648b, 0x648c, 0x648d, 0x648e, 0x648f, 0x6490, 0x6493, 0x6494, + 0x6497, 0x6498, 0x649a, 0x649b, 0x649c, 0x649d, 0x649f, 0x64a0, + 0x64a1, 0x64a2, 0x64a3, 0x64a5, 0x64a6, 0x64a7, 0x64a8, 0x64aa, + 0x64ab, 0x64af, 0x64b1, 0x64b2, 0x64b3, 0x64b4, 0x64b6, 0x64b9, + 0x64bb, 0x64bd, 0x64be, 0x64bf, 0x64c1, 0x64c3, 0x64c4, 0x64c6, + 0x64c7, 0x64c8, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64cf, 0x64d1, + 0x64d3, 0x64d4, 0x64d5, 0x64d6, 0x64d9, 0x64da, + /* 0x94 */ + 0x64db, 0x64dc, 0x64dd, 0x64df, 0x64e0, 0x64e1, 0x64e3, 0x64e5, + 0x64e7, 0x64e8, 0x64e9, 0x64ea, 0x64eb, 0x64ec, 0x64ed, 0x64ee, + 0x64ef, 0x64f0, 0x64f1, 0x64f2, 0x64f3, 0x64f4, 0x64f5, 0x64f6, + 0x64f7, 0x64f8, 0x64f9, 0x64fa, 0x64fb, 0x64fc, 0x64fd, 0x64fe, + 0x64ff, 0x6501, 0x6502, 0x6503, 0x6504, 0x6505, 0x6506, 0x6507, + 0x6508, 0x650a, 0x650b, 0x650c, 0x650d, 0x650e, 0x650f, 0x6510, + 0x6511, 0x6513, 0x6514, 0x6515, 0x6516, 0x6517, 0x6519, 0x651a, + 0x651b, 0x651c, 0x651d, 0x651e, 0x651f, 0x6520, 0x6521, 0x6522, + 0x6523, 0x6524, 0x6526, 0x6527, 0x6528, 0x6529, 0x652a, 0x652c, + 0x652d, 0x6530, 0x6531, 0x6532, 0x6533, 0x6537, 0x653a, 0x653c, + 0x653d, 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6546, 0x6547, + 0x654a, 0x654b, 0x654d, 0x654e, 0x6550, 0x6552, 0x6553, 0x6554, + 0x6557, 0x6558, 0x655a, 0x655c, 0x655f, 0x6560, 0x6561, 0x6564, + 0x6565, 0x6567, 0x6568, 0x6569, 0x656a, 0x656d, 0x656e, 0x656f, + 0x6571, 0x6573, 0x6575, 0x6576, 0x6578, 0x6579, 0x657a, 0x657b, + 0x657c, 0x657d, 0x657e, 0x657f, 0x6580, 0x6581, 0x6582, 0x6583, + 0x6584, 0x6585, 0x6586, 0x6588, 0x6589, 0x658a, 0x658d, 0x658e, + 0x658f, 0x6592, 0x6594, 0x6595, 0x6596, 0x6598, 0x659a, 0x659d, + 0x659e, 0x65a0, 0x65a2, 0x65a3, 0x65a6, 0x65a8, 0x65aa, 0x65ac, + 0x65ae, 0x65b1, 0x65b2, 0x65b3, 0x65b4, 0x65b5, 0x65b6, 0x65b7, + 0x65b8, 0x65ba, 0x65bb, 0x65be, 0x65bf, 0x65c0, 0x65c2, 0x65c7, + 0x65c8, 0x65c9, 0x65ca, 0x65cd, 0x65d0, 0x65d1, 0x65d3, 0x65d4, + 0x65d5, 0x65d8, 0x65d9, 0x65da, 0x65db, 0x65dc, 0x65dd, 0x65de, + 0x65df, 0x65e1, 0x65e3, 0x65e4, 0x65ea, 0x65eb, + /* 0x95 */ + 0x65f2, 0x65f3, 0x65f4, 0x65f5, 0x65f8, 0x65f9, 0x65fb, 0x65fc, + 0x65fd, 0x65fe, 0x65ff, 0x6601, 0x6604, 0x6605, 0x6607, 0x6608, + 0x6609, 0x660b, 0x660d, 0x6610, 0x6611, 0x6612, 0x6616, 0x6617, + 0x6618, 0x661a, 0x661b, 0x661c, 0x661e, 0x6621, 0x6622, 0x6623, + 0x6624, 0x6626, 0x6629, 0x662a, 0x662b, 0x662c, 0x662e, 0x6630, + 0x6632, 0x6633, 0x6637, 0x6638, 0x6639, 0x663a, 0x663b, 0x663d, + 0x663f, 0x6640, 0x6642, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, + 0x6649, 0x664a, 0x664d, 0x664e, 0x6650, 0x6651, 0x6658, 0x6659, + 0x665b, 0x665c, 0x665d, 0x665e, 0x6660, 0x6662, 0x6663, 0x6665, + 0x6667, 0x6669, 0x666a, 0x666b, 0x666c, 0x666d, 0x6671, 0x6672, + 0x6673, 0x6675, 0x6678, 0x6679, 0x667b, 0x667c, 0x667d, 0x667f, + 0x6680, 0x6681, 0x6683, 0x6685, 0x6686, 0x6688, 0x6689, 0x668a, + 0x668b, 0x668d, 0x668e, 0x668f, 0x6690, 0x6692, 0x6693, 0x6694, + 0x6695, 0x6698, 0x6699, 0x669a, 0x669b, 0x669c, 0x669e, 0x669f, + 0x66a0, 0x66a1, 0x66a2, 0x66a3, 0x66a4, 0x66a5, 0x66a6, 0x66a9, + 0x66aa, 0x66ab, 0x66ac, 0x66ad, 0x66af, 0x66b0, 0x66b1, 0x66b2, + 0x66b3, 0x66b5, 0x66b6, 0x66b7, 0x66b8, 0x66ba, 0x66bb, 0x66bc, + 0x66bd, 0x66bf, 0x66c0, 0x66c1, 0x66c2, 0x66c3, 0x66c4, 0x66c5, + 0x66c6, 0x66c7, 0x66c8, 0x66c9, 0x66ca, 0x66cb, 0x66cc, 0x66cd, + 0x66ce, 0x66cf, 0x66d0, 0x66d1, 0x66d2, 0x66d3, 0x66d4, 0x66d5, + 0x66d6, 0x66d7, 0x66d8, 0x66da, 0x66de, 0x66df, 0x66e0, 0x66e1, + 0x66e2, 0x66e3, 0x66e4, 0x66e5, 0x66e7, 0x66e8, 0x66ea, 0x66eb, + 0x66ec, 0x66ed, 0x66ee, 0x66ef, 0x66f1, 0x66f5, 0x66f6, 0x66f8, + 0x66fa, 0x66fb, 0x66fd, 0x6701, 0x6702, 0x6703, + /* 0x96 */ + 0x6704, 0x6705, 0x6706, 0x6707, 0x670c, 0x670e, 0x670f, 0x6711, + 0x6712, 0x6713, 0x6716, 0x6718, 0x6719, 0x671a, 0x671c, 0x671e, + 0x6720, 0x6721, 0x6722, 0x6723, 0x6724, 0x6725, 0x6727, 0x6729, + 0x672e, 0x6730, 0x6732, 0x6733, 0x6736, 0x6737, 0x6738, 0x6739, + 0x673b, 0x673c, 0x673e, 0x673f, 0x6741, 0x6744, 0x6745, 0x6747, + 0x674a, 0x674b, 0x674d, 0x6752, 0x6754, 0x6755, 0x6757, 0x6758, + 0x6759, 0x675a, 0x675b, 0x675d, 0x6762, 0x6763, 0x6764, 0x6766, + 0x6767, 0x676b, 0x676c, 0x676e, 0x6771, 0x6774, 0x6776, 0x6778, + 0x6779, 0x677a, 0x677b, 0x677d, 0x6780, 0x6782, 0x6783, 0x6785, + 0x6786, 0x6788, 0x678a, 0x678c, 0x678d, 0x678e, 0x678f, 0x6791, + 0x6792, 0x6793, 0x6794, 0x6796, 0x6799, 0x679b, 0x679f, 0x67a0, + 0x67a1, 0x67a4, 0x67a6, 0x67a9, 0x67ac, 0x67ae, 0x67b1, 0x67b2, + 0x67b4, 0x67b9, 0x67ba, 0x67bb, 0x67bc, 0x67bd, 0x67be, 0x67bf, + 0x67c0, 0x67c2, 0x67c5, 0x67c6, 0x67c7, 0x67c8, 0x67c9, 0x67ca, + 0x67cb, 0x67cc, 0x67cd, 0x67ce, 0x67d5, 0x67d6, 0x67d7, 0x67db, + 0x67df, 0x67e1, 0x67e3, 0x67e4, 0x67e6, 0x67e7, 0x67e8, 0x67ea, + 0x67eb, 0x67ed, 0x67ee, 0x67f2, 0x67f5, 0x67f6, 0x67f7, 0x67f8, + 0x67f9, 0x67fa, 0x67fb, 0x67fc, 0x67fe, 0x6801, 0x6802, 0x6803, + 0x6804, 0x6806, 0x680d, 0x6810, 0x6812, 0x6814, 0x6815, 0x6818, + 0x6819, 0x681a, 0x681b, 0x681c, 0x681e, 0x681f, 0x6820, 0x6822, + 0x6823, 0x6824, 0x6825, 0x6826, 0x6827, 0x6828, 0x682b, 0x682c, + 0x682d, 0x682e, 0x682f, 0x6830, 0x6831, 0x6834, 0x6835, 0x6836, + 0x683a, 0x683b, 0x683f, 0x6847, 0x684b, 0x684d, 0x684f, 0x6852, + 0x6856, 0x6857, 0x6858, 0x6859, 0x685a, 0x685b, + /* 0x97 */ + 0x685c, 0x685d, 0x685e, 0x685f, 0x686a, 0x686c, 0x686d, 0x686e, + 0x686f, 0x6870, 0x6871, 0x6872, 0x6873, 0x6875, 0x6878, 0x6879, + 0x687a, 0x687b, 0x687c, 0x687d, 0x687e, 0x687f, 0x6880, 0x6882, + 0x6884, 0x6887, 0x6888, 0x6889, 0x688a, 0x688b, 0x688c, 0x688d, + 0x688e, 0x6890, 0x6891, 0x6892, 0x6894, 0x6895, 0x6896, 0x6898, + 0x6899, 0x689a, 0x689b, 0x689c, 0x689d, 0x689e, 0x689f, 0x68a0, + 0x68a1, 0x68a3, 0x68a4, 0x68a5, 0x68a9, 0x68aa, 0x68ab, 0x68ac, + 0x68ae, 0x68b1, 0x68b2, 0x68b4, 0x68b6, 0x68b7, 0x68b8, 0x68b9, + 0x68ba, 0x68bb, 0x68bc, 0x68bd, 0x68be, 0x68bf, 0x68c1, 0x68c3, + 0x68c4, 0x68c5, 0x68c6, 0x68c7, 0x68c8, 0x68ca, 0x68cc, 0x68ce, + 0x68cf, 0x68d0, 0x68d1, 0x68d3, 0x68d4, 0x68d6, 0x68d7, 0x68d9, + 0x68db, 0x68dc, 0x68dd, 0x68de, 0x68df, 0x68e1, 0x68e2, 0x68e4, + 0x68e5, 0x68e6, 0x68e7, 0x68e8, 0x68e9, 0x68ea, 0x68eb, 0x68ec, + 0x68ed, 0x68ef, 0x68f2, 0x68f3, 0x68f4, 0x68f6, 0x68f7, 0x68f8, + 0x68fb, 0x68fd, 0x68fe, 0x68ff, 0x6900, 0x6902, 0x6903, 0x6904, + 0x6906, 0x6907, 0x6908, 0x6909, 0x690a, 0x690c, 0x690f, 0x6911, + 0x6913, 0x6914, 0x6915, 0x6916, 0x6917, 0x6918, 0x6919, 0x691a, + 0x691b, 0x691c, 0x691d, 0x691e, 0x6921, 0x6922, 0x6923, 0x6925, + 0x6926, 0x6927, 0x6928, 0x6929, 0x692a, 0x692b, 0x692c, 0x692e, + 0x692f, 0x6931, 0x6932, 0x6933, 0x6935, 0x6936, 0x6937, 0x6938, + 0x693a, 0x693b, 0x693c, 0x693e, 0x6940, 0x6941, 0x6943, 0x6944, + 0x6945, 0x6946, 0x6947, 0x6948, 0x6949, 0x694a, 0x694b, 0x694c, + 0x694d, 0x694e, 0x694f, 0x6950, 0x6951, 0x6952, 0x6953, 0x6955, + 0x6956, 0x6958, 0x6959, 0x695b, 0x695c, 0x695f, + /* 0x98 */ + 0x6961, 0x6962, 0x6964, 0x6965, 0x6967, 0x6968, 0x6969, 0x696a, + 0x696c, 0x696d, 0x696f, 0x6970, 0x6972, 0x6973, 0x6974, 0x6975, + 0x6976, 0x697a, 0x697b, 0x697d, 0x697e, 0x697f, 0x6981, 0x6983, + 0x6985, 0x698a, 0x698b, 0x698c, 0x698e, 0x698f, 0x6990, 0x6991, + 0x6992, 0x6993, 0x6996, 0x6997, 0x6999, 0x699a, 0x699d, 0x699e, + 0x699f, 0x69a0, 0x69a1, 0x69a2, 0x69a3, 0x69a4, 0x69a5, 0x69a6, + 0x69a9, 0x69aa, 0x69ac, 0x69ae, 0x69af, 0x69b0, 0x69b2, 0x69b3, + 0x69b5, 0x69b6, 0x69b8, 0x69b9, 0x69ba, 0x69bc, 0x69bd, 0x69be, + 0x69bf, 0x69c0, 0x69c2, 0x69c3, 0x69c4, 0x69c5, 0x69c6, 0x69c7, + 0x69c8, 0x69c9, 0x69cb, 0x69cd, 0x69cf, 0x69d1, 0x69d2, 0x69d3, + 0x69d5, 0x69d6, 0x69d7, 0x69d8, 0x69d9, 0x69da, 0x69dc, 0x69dd, + 0x69de, 0x69e1, 0x69e2, 0x69e3, 0x69e4, 0x69e5, 0x69e6, 0x69e7, + 0x69e8, 0x69e9, 0x69ea, 0x69eb, 0x69ec, 0x69ee, 0x69ef, 0x69f0, + 0x69f1, 0x69f3, 0x69f4, 0x69f5, 0x69f6, 0x69f7, 0x69f8, 0x69f9, + 0x69fa, 0x69fb, 0x69fc, 0x69fe, 0x6a00, 0x6a01, 0x6a02, 0x6a03, + 0x6a04, 0x6a05, 0x6a06, 0x6a07, 0x6a08, 0x6a09, 0x6a0b, 0x6a0c, + 0x6a0d, 0x6a0e, 0x6a0f, 0x6a10, 0x6a11, 0x6a12, 0x6a13, 0x6a14, + 0x6a15, 0x6a16, 0x6a19, 0x6a1a, 0x6a1b, 0x6a1c, 0x6a1d, 0x6a1e, + 0x6a20, 0x6a22, 0x6a23, 0x6a24, 0x6a25, 0x6a26, 0x6a27, 0x6a29, + 0x6a2b, 0x6a2c, 0x6a2d, 0x6a2e, 0x6a30, 0x6a32, 0x6a33, 0x6a34, + 0x6a36, 0x6a37, 0x6a38, 0x6a39, 0x6a3a, 0x6a3b, 0x6a3c, 0x6a3f, + 0x6a40, 0x6a41, 0x6a42, 0x6a43, 0x6a45, 0x6a46, 0x6a48, 0x6a49, + 0x6a4a, 0x6a4b, 0x6a4c, 0x6a4d, 0x6a4e, 0x6a4f, 0x6a51, 0x6a52, + 0x6a53, 0x6a54, 0x6a55, 0x6a56, 0x6a57, 0x6a5a, + /* 0x99 */ + 0x6a5c, 0x6a5d, 0x6a5e, 0x6a5f, 0x6a60, 0x6a62, 0x6a63, 0x6a64, + 0x6a66, 0x6a67, 0x6a68, 0x6a69, 0x6a6a, 0x6a6b, 0x6a6c, 0x6a6d, + 0x6a6e, 0x6a6f, 0x6a70, 0x6a72, 0x6a73, 0x6a74, 0x6a75, 0x6a76, + 0x6a77, 0x6a78, 0x6a7a, 0x6a7b, 0x6a7d, 0x6a7e, 0x6a7f, 0x6a81, + 0x6a82, 0x6a83, 0x6a85, 0x6a86, 0x6a87, 0x6a88, 0x6a89, 0x6a8a, + 0x6a8b, 0x6a8c, 0x6a8d, 0x6a8f, 0x6a92, 0x6a93, 0x6a94, 0x6a95, + 0x6a96, 0x6a98, 0x6a99, 0x6a9a, 0x6a9b, 0x6a9c, 0x6a9d, 0x6a9e, + 0x6a9f, 0x6aa1, 0x6aa2, 0x6aa3, 0x6aa4, 0x6aa5, 0x6aa6, 0x6aa7, + 0x6aa8, 0x6aaa, 0x6aad, 0x6aae, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab2, + 0x6ab3, 0x6ab4, 0x6ab5, 0x6ab6, 0x6ab7, 0x6ab8, 0x6ab9, 0x6aba, + 0x6abb, 0x6abc, 0x6abd, 0x6abe, 0x6abf, 0x6ac0, 0x6ac1, 0x6ac2, + 0x6ac3, 0x6ac4, 0x6ac5, 0x6ac6, 0x6ac7, 0x6ac8, 0x6ac9, 0x6aca, + 0x6acb, 0x6acc, 0x6acd, 0x6ace, 0x6acf, 0x6ad0, 0x6ad1, 0x6ad2, + 0x6ad3, 0x6ad4, 0x6ad5, 0x6ad6, 0x6ad7, 0x6ad8, 0x6ad9, 0x6ada, + 0x6adb, 0x6adc, 0x6add, 0x6ade, 0x6adf, 0x6ae0, 0x6ae1, 0x6ae2, + 0x6ae3, 0x6ae4, 0x6ae5, 0x6ae6, 0x6ae7, 0x6ae8, 0x6ae9, 0x6aea, + 0x6aeb, 0x6aec, 0x6aed, 0x6aee, 0x6aef, 0x6af0, 0x6af1, 0x6af2, + 0x6af3, 0x6af4, 0x6af5, 0x6af6, 0x6af7, 0x6af8, 0x6af9, 0x6afa, + 0x6afb, 0x6afc, 0x6afd, 0x6afe, 0x6aff, 0x6b00, 0x6b01, 0x6b02, + 0x6b03, 0x6b04, 0x6b05, 0x6b06, 0x6b07, 0x6b08, 0x6b09, 0x6b0a, + 0x6b0b, 0x6b0c, 0x6b0d, 0x6b0e, 0x6b0f, 0x6b10, 0x6b11, 0x6b12, + 0x6b13, 0x6b14, 0x6b15, 0x6b16, 0x6b17, 0x6b18, 0x6b19, 0x6b1a, + 0x6b1b, 0x6b1c, 0x6b1d, 0x6b1e, 0x6b1f, 0x6b25, 0x6b26, 0x6b28, + 0x6b29, 0x6b2a, 0x6b2b, 0x6b2c, 0x6b2d, 0x6b2e, + /* 0x9a */ + 0x6b2f, 0x6b30, 0x6b31, 0x6b33, 0x6b34, 0x6b35, 0x6b36, 0x6b38, + 0x6b3b, 0x6b3c, 0x6b3d, 0x6b3f, 0x6b40, 0x6b41, 0x6b42, 0x6b44, + 0x6b45, 0x6b48, 0x6b4a, 0x6b4b, 0x6b4d, 0x6b4e, 0x6b4f, 0x6b50, + 0x6b51, 0x6b52, 0x6b53, 0x6b54, 0x6b55, 0x6b56, 0x6b57, 0x6b58, + 0x6b5a, 0x6b5b, 0x6b5c, 0x6b5d, 0x6b5e, 0x6b5f, 0x6b60, 0x6b61, + 0x6b68, 0x6b69, 0x6b6b, 0x6b6c, 0x6b6d, 0x6b6e, 0x6b6f, 0x6b70, + 0x6b71, 0x6b72, 0x6b73, 0x6b74, 0x6b75, 0x6b76, 0x6b77, 0x6b78, + 0x6b7a, 0x6b7d, 0x6b7e, 0x6b7f, 0x6b80, 0x6b85, 0x6b88, 0x6b8c, + 0x6b8e, 0x6b8f, 0x6b90, 0x6b91, 0x6b94, 0x6b95, 0x6b97, 0x6b98, + 0x6b99, 0x6b9c, 0x6b9d, 0x6b9e, 0x6b9f, 0x6ba0, 0x6ba2, 0x6ba3, + 0x6ba4, 0x6ba5, 0x6ba6, 0x6ba7, 0x6ba8, 0x6ba9, 0x6bab, 0x6bac, + 0x6bad, 0x6bae, 0x6baf, 0x6bb0, 0x6bb1, 0x6bb2, 0x6bb6, 0x6bb8, + 0x6bb9, 0x6bba, 0x6bbb, 0x6bbc, 0x6bbd, 0x6bbe, 0x6bc0, 0x6bc3, + 0x6bc4, 0x6bc6, 0x6bc7, 0x6bc8, 0x6bc9, 0x6bca, 0x6bcc, 0x6bce, + 0x6bd0, 0x6bd1, 0x6bd8, 0x6bda, 0x6bdc, 0x6bdd, 0x6bde, 0x6bdf, + 0x6be0, 0x6be2, 0x6be3, 0x6be4, 0x6be5, 0x6be6, 0x6be7, 0x6be8, + 0x6be9, 0x6bec, 0x6bed, 0x6bee, 0x6bf0, 0x6bf1, 0x6bf2, 0x6bf4, + 0x6bf6, 0x6bf7, 0x6bf8, 0x6bfa, 0x6bfb, 0x6bfc, 0x6bfe, 0x6bff, + 0x6c00, 0x6c01, 0x6c02, 0x6c03, 0x6c04, 0x6c08, 0x6c09, 0x6c0a, + 0x6c0b, 0x6c0c, 0x6c0e, 0x6c12, 0x6c17, 0x6c1c, 0x6c1d, 0x6c1e, + 0x6c20, 0x6c23, 0x6c25, 0x6c2b, 0x6c2c, 0x6c2d, 0x6c31, 0x6c33, + 0x6c36, 0x6c37, 0x6c39, 0x6c3a, 0x6c3b, 0x6c3c, 0x6c3e, 0x6c3f, + 0x6c43, 0x6c44, 0x6c45, 0x6c48, 0x6c4b, 0x6c4c, 0x6c4d, 0x6c4e, + 0x6c4f, 0x6c51, 0x6c52, 0x6c53, 0x6c56, 0x6c58, + /* 0x9b */ + 0x6c59, 0x6c5a, 0x6c62, 0x6c63, 0x6c65, 0x6c66, 0x6c67, 0x6c6b, + 0x6c6c, 0x6c6d, 0x6c6e, 0x6c6f, 0x6c71, 0x6c73, 0x6c75, 0x6c77, + 0x6c78, 0x6c7a, 0x6c7b, 0x6c7c, 0x6c7f, 0x6c80, 0x6c84, 0x6c87, + 0x6c8a, 0x6c8b, 0x6c8d, 0x6c8e, 0x6c91, 0x6c92, 0x6c95, 0x6c96, + 0x6c97, 0x6c98, 0x6c9a, 0x6c9c, 0x6c9d, 0x6c9e, 0x6ca0, 0x6ca2, + 0x6ca8, 0x6cac, 0x6caf, 0x6cb0, 0x6cb4, 0x6cb5, 0x6cb6, 0x6cb7, + 0x6cba, 0x6cc0, 0x6cc1, 0x6cc2, 0x6cc3, 0x6cc6, 0x6cc7, 0x6cc8, + 0x6ccb, 0x6ccd, 0x6cce, 0x6ccf, 0x6cd1, 0x6cd2, 0x6cd8, 0x6cd9, + 0x6cda, 0x6cdc, 0x6cdd, 0x6cdf, 0x6ce4, 0x6ce6, 0x6ce7, 0x6ce9, + 0x6cec, 0x6ced, 0x6cf2, 0x6cf4, 0x6cf9, 0x6cff, 0x6d00, 0x6d02, + 0x6d03, 0x6d05, 0x6d06, 0x6d08, 0x6d09, 0x6d0a, 0x6d0d, 0x6d0f, + 0x6d10, 0x6d11, 0x6d13, 0x6d14, 0x6d15, 0x6d16, 0x6d18, 0x6d1c, + 0x6d1d, 0x6d1f, 0x6d20, 0x6d21, 0x6d22, 0x6d23, 0x6d24, 0x6d26, + 0x6d28, 0x6d29, 0x6d2c, 0x6d2d, 0x6d2f, 0x6d30, 0x6d34, 0x6d36, + 0x6d37, 0x6d38, 0x6d3a, 0x6d3f, 0x6d40, 0x6d42, 0x6d44, 0x6d49, + 0x6d4c, 0x6d50, 0x6d55, 0x6d56, 0x6d57, 0x6d58, 0x6d5b, 0x6d5d, + 0x6d5f, 0x6d61, 0x6d62, 0x6d64, 0x6d65, 0x6d67, 0x6d68, 0x6d6b, + 0x6d6c, 0x6d6d, 0x6d70, 0x6d71, 0x6d72, 0x6d73, 0x6d75, 0x6d76, + 0x6d79, 0x6d7a, 0x6d7b, 0x6d7d, 0x6d7e, 0x6d7f, 0x6d80, 0x6d81, + 0x6d83, 0x6d84, 0x6d86, 0x6d87, 0x6d8a, 0x6d8b, 0x6d8d, 0x6d8f, + 0x6d90, 0x6d92, 0x6d96, 0x6d97, 0x6d98, 0x6d99, 0x6d9a, 0x6d9c, + 0x6da2, 0x6da5, 0x6dac, 0x6dad, 0x6db0, 0x6db1, 0x6db3, 0x6db4, + 0x6db6, 0x6db7, 0x6db9, 0x6dba, 0x6dbb, 0x6dbc, 0x6dbd, 0x6dbe, + 0x6dc1, 0x6dc2, 0x6dc3, 0x6dc8, 0x6dc9, 0x6dca, + /* 0x9c */ + 0x6dcd, 0x6dce, 0x6dcf, 0x6dd0, 0x6dd2, 0x6dd3, 0x6dd4, 0x6dd5, + 0x6dd7, 0x6dda, 0x6ddb, 0x6ddc, 0x6ddf, 0x6de2, 0x6de3, 0x6de5, + 0x6de7, 0x6de8, 0x6de9, 0x6dea, 0x6ded, 0x6def, 0x6df0, 0x6df2, + 0x6df4, 0x6df5, 0x6df6, 0x6df8, 0x6dfa, 0x6dfd, 0x6dfe, 0x6dff, + 0x6e00, 0x6e01, 0x6e02, 0x6e03, 0x6e04, 0x6e06, 0x6e07, 0x6e08, + 0x6e09, 0x6e0b, 0x6e0f, 0x6e12, 0x6e13, 0x6e15, 0x6e18, 0x6e19, + 0x6e1b, 0x6e1c, 0x6e1e, 0x6e1f, 0x6e22, 0x6e26, 0x6e27, 0x6e28, + 0x6e2a, 0x6e2c, 0x6e2e, 0x6e30, 0x6e31, 0x6e33, 0x6e35, 0x6e36, + 0x6e37, 0x6e39, 0x6e3b, 0x6e3c, 0x6e3d, 0x6e3e, 0x6e3f, 0x6e40, + 0x6e41, 0x6e42, 0x6e45, 0x6e46, 0x6e47, 0x6e48, 0x6e49, 0x6e4a, + 0x6e4b, 0x6e4c, 0x6e4f, 0x6e50, 0x6e51, 0x6e52, 0x6e55, 0x6e57, + 0x6e59, 0x6e5a, 0x6e5c, 0x6e5d, 0x6e5e, 0x6e60, 0x6e61, 0x6e62, + 0x6e63, 0x6e64, 0x6e65, 0x6e66, 0x6e67, 0x6e68, 0x6e69, 0x6e6a, + 0x6e6c, 0x6e6d, 0x6e6f, 0x6e70, 0x6e71, 0x6e72, 0x6e73, 0x6e74, + 0x6e75, 0x6e76, 0x6e77, 0x6e78, 0x6e79, 0x6e7a, 0x6e7b, 0x6e7c, + 0x6e7d, 0x6e80, 0x6e81, 0x6e82, 0x6e84, 0x6e87, 0x6e88, 0x6e8a, + 0x6e8b, 0x6e8c, 0x6e8d, 0x6e8e, 0x6e91, 0x6e92, 0x6e93, 0x6e94, + 0x6e95, 0x6e96, 0x6e97, 0x6e99, 0x6e9a, 0x6e9b, 0x6e9d, 0x6e9e, + 0x6ea0, 0x6ea1, 0x6ea3, 0x6ea4, 0x6ea6, 0x6ea8, 0x6ea9, 0x6eab, + 0x6eac, 0x6ead, 0x6eae, 0x6eb0, 0x6eb3, 0x6eb5, 0x6eb8, 0x6eb9, + 0x6ebc, 0x6ebe, 0x6ebf, 0x6ec0, 0x6ec3, 0x6ec4, 0x6ec5, 0x6ec6, + 0x6ec8, 0x6ec9, 0x6eca, 0x6ecc, 0x6ecd, 0x6ece, 0x6ed0, 0x6ed2, + 0x6ed6, 0x6ed8, 0x6ed9, 0x6edb, 0x6edc, 0x6edd, 0x6ee3, 0x6ee7, + 0x6eea, 0x6eeb, 0x6eec, 0x6eed, 0x6eee, 0x6eef, + /* 0x9d */ + 0x6ef0, 0x6ef1, 0x6ef2, 0x6ef3, 0x6ef5, 0x6ef6, 0x6ef7, 0x6ef8, + 0x6efa, 0x6efb, 0x6efc, 0x6efd, 0x6efe, 0x6eff, 0x6f00, 0x6f01, + 0x6f03, 0x6f04, 0x6f05, 0x6f07, 0x6f08, 0x6f0a, 0x6f0b, 0x6f0c, + 0x6f0d, 0x6f0e, 0x6f10, 0x6f11, 0x6f12, 0x6f16, 0x6f17, 0x6f18, + 0x6f19, 0x6f1a, 0x6f1b, 0x6f1c, 0x6f1d, 0x6f1e, 0x6f1f, 0x6f21, + 0x6f22, 0x6f23, 0x6f25, 0x6f26, 0x6f27, 0x6f28, 0x6f2c, 0x6f2e, + 0x6f30, 0x6f32, 0x6f34, 0x6f35, 0x6f37, 0x6f38, 0x6f39, 0x6f3a, + 0x6f3b, 0x6f3c, 0x6f3d, 0x6f3f, 0x6f40, 0x6f41, 0x6f42, 0x6f43, + 0x6f44, 0x6f45, 0x6f48, 0x6f49, 0x6f4a, 0x6f4c, 0x6f4e, 0x6f4f, + 0x6f50, 0x6f51, 0x6f52, 0x6f53, 0x6f54, 0x6f55, 0x6f56, 0x6f57, + 0x6f59, 0x6f5a, 0x6f5b, 0x6f5d, 0x6f5f, 0x6f60, 0x6f61, 0x6f63, + 0x6f64, 0x6f65, 0x6f67, 0x6f68, 0x6f69, 0x6f6a, 0x6f6b, 0x6f6c, + 0x6f6f, 0x6f70, 0x6f71, 0x6f73, 0x6f75, 0x6f76, 0x6f77, 0x6f79, + 0x6f7b, 0x6f7d, 0x6f7e, 0x6f7f, 0x6f80, 0x6f81, 0x6f82, 0x6f83, + 0x6f85, 0x6f86, 0x6f87, 0x6f8a, 0x6f8b, 0x6f8f, 0x6f90, 0x6f91, + 0x6f92, 0x6f93, 0x6f94, 0x6f95, 0x6f96, 0x6f97, 0x6f98, 0x6f99, + 0x6f9a, 0x6f9b, 0x6f9d, 0x6f9e, 0x6f9f, 0x6fa0, 0x6fa2, 0x6fa3, + 0x6fa4, 0x6fa5, 0x6fa6, 0x6fa8, 0x6fa9, 0x6faa, 0x6fab, 0x6fac, + 0x6fad, 0x6fae, 0x6faf, 0x6fb0, 0x6fb1, 0x6fb2, 0x6fb4, 0x6fb5, + 0x6fb7, 0x6fb8, 0x6fba, 0x6fbb, 0x6fbc, 0x6fbd, 0x6fbe, 0x6fbf, + 0x6fc1, 0x6fc3, 0x6fc4, 0x6fc5, 0x6fc6, 0x6fc7, 0x6fc8, 0x6fca, + 0x6fcb, 0x6fcc, 0x6fcd, 0x6fce, 0x6fcf, 0x6fd0, 0x6fd3, 0x6fd4, + 0x6fd5, 0x6fd6, 0x6fd7, 0x6fd8, 0x6fd9, 0x6fda, 0x6fdb, 0x6fdc, + 0x6fdd, 0x6fdf, 0x6fe2, 0x6fe3, 0x6fe4, 0x6fe5, + /* 0x9e */ + 0x6fe6, 0x6fe7, 0x6fe8, 0x6fe9, 0x6fea, 0x6feb, 0x6fec, 0x6fed, + 0x6ff0, 0x6ff1, 0x6ff2, 0x6ff3, 0x6ff4, 0x6ff5, 0x6ff6, 0x6ff7, + 0x6ff8, 0x6ff9, 0x6ffa, 0x6ffb, 0x6ffc, 0x6ffd, 0x6ffe, 0x6fff, + 0x7000, 0x7001, 0x7002, 0x7003, 0x7004, 0x7005, 0x7006, 0x7007, + 0x7008, 0x7009, 0x700a, 0x700b, 0x700c, 0x700d, 0x700e, 0x700f, + 0x7010, 0x7012, 0x7013, 0x7014, 0x7015, 0x7016, 0x7017, 0x7018, + 0x7019, 0x701c, 0x701d, 0x701e, 0x701f, 0x7020, 0x7021, 0x7022, + 0x7024, 0x7025, 0x7026, 0x7027, 0x7028, 0x7029, 0x702a, 0x702b, + 0x702c, 0x702d, 0x702e, 0x702f, 0x7030, 0x7031, 0x7032, 0x7033, + 0x7034, 0x7036, 0x7037, 0x7038, 0x703a, 0x703b, 0x703c, 0x703d, + 0x703e, 0x703f, 0x7040, 0x7041, 0x7042, 0x7043, 0x7044, 0x7045, + 0x7046, 0x7047, 0x7048, 0x7049, 0x704a, 0x704b, 0x704d, 0x704e, + 0x7050, 0x7051, 0x7052, 0x7053, 0x7054, 0x7055, 0x7056, 0x7057, + 0x7058, 0x7059, 0x705a, 0x705b, 0x705c, 0x705d, 0x705f, 0x7060, + 0x7061, 0x7062, 0x7063, 0x7064, 0x7065, 0x7066, 0x7067, 0x7068, + 0x7069, 0x706a, 0x706e, 0x7071, 0x7072, 0x7073, 0x7074, 0x7077, + 0x7079, 0x707a, 0x707b, 0x707d, 0x7081, 0x7082, 0x7083, 0x7084, + 0x7086, 0x7087, 0x7088, 0x708b, 0x708c, 0x708d, 0x708f, 0x7090, + 0x7091, 0x7093, 0x7097, 0x7098, 0x709a, 0x709b, 0x709e, 0x709f, + 0x70a0, 0x70a1, 0x70a2, 0x70a3, 0x70a4, 0x70a5, 0x70a6, 0x70a7, + 0x70a8, 0x70a9, 0x70aa, 0x70b0, 0x70b2, 0x70b4, 0x70b5, 0x70b6, + 0x70ba, 0x70be, 0x70bf, 0x70c4, 0x70c5, 0x70c6, 0x70c7, 0x70c9, + 0x70cb, 0x70cc, 0x70cd, 0x70ce, 0x70cf, 0x70d0, 0x70d1, 0x70d2, + 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d7, 0x70da, + /* 0x9f */ + 0x70dc, 0x70dd, 0x70de, 0x70e0, 0x70e1, 0x70e2, 0x70e3, 0x70e5, + 0x70ea, 0x70ee, 0x70f0, 0x70f1, 0x70f2, 0x70f3, 0x70f4, 0x70f5, + 0x70f6, 0x70f8, 0x70fa, 0x70fb, 0x70fc, 0x70fe, 0x70ff, 0x7100, + 0x7101, 0x7102, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x7108, + 0x710b, 0x710c, 0x710d, 0x710e, 0x710f, 0x7111, 0x7112, 0x7114, + 0x7117, 0x711b, 0x711c, 0x711d, 0x711e, 0x711f, 0x7120, 0x7121, + 0x7122, 0x7123, 0x7124, 0x7125, 0x7127, 0x7128, 0x7129, 0x712a, + 0x712b, 0x712c, 0x712d, 0x712e, 0x7132, 0x7133, 0x7134, 0x7135, + 0x7137, 0x7138, 0x7139, 0x713a, 0x713b, 0x713c, 0x713d, 0x713e, + 0x713f, 0x7140, 0x7141, 0x7142, 0x7143, 0x7144, 0x7146, 0x7147, + 0x7148, 0x7149, 0x714b, 0x714d, 0x714f, 0x7150, 0x7151, 0x7152, + 0x7153, 0x7154, 0x7155, 0x7156, 0x7157, 0x7158, 0x7159, 0x715a, + 0x715b, 0x715d, 0x715f, 0x7160, 0x7161, 0x7162, 0x7163, 0x7165, + 0x7169, 0x716a, 0x716b, 0x716c, 0x716d, 0x716f, 0x7170, 0x7171, + 0x7174, 0x7175, 0x7176, 0x7177, 0x7179, 0x717b, 0x717c, 0x717e, + 0x717f, 0x7180, 0x7181, 0x7182, 0x7183, 0x7185, 0x7186, 0x7187, + 0x7188, 0x7189, 0x718b, 0x718c, 0x718d, 0x718e, 0x7190, 0x7191, + 0x7192, 0x7193, 0x7195, 0x7196, 0x7197, 0x719a, 0x719b, 0x719c, + 0x719d, 0x719e, 0x71a1, 0x71a2, 0x71a3, 0x71a4, 0x71a5, 0x71a6, + 0x71a7, 0x71a9, 0x71aa, 0x71ab, 0x71ad, 0x71ae, 0x71af, 0x71b0, + 0x71b1, 0x71b2, 0x71b4, 0x71b6, 0x71b7, 0x71b8, 0x71ba, 0x71bb, + 0x71bc, 0x71bd, 0x71be, 0x71bf, 0x71c0, 0x71c1, 0x71c2, 0x71c4, + 0x71c5, 0x71c6, 0x71c7, 0x71c8, 0x71c9, 0x71ca, 0x71cb, 0x71cc, + 0x71cd, 0x71cf, 0x71d0, 0x71d1, 0x71d2, 0x71d3, + /* 0xa0 */ + 0x71d6, 0x71d7, 0x71d8, 0x71d9, 0x71da, 0x71db, 0x71dc, 0x71dd, + 0x71de, 0x71df, 0x71e1, 0x71e2, 0x71e3, 0x71e4, 0x71e6, 0x71e8, + 0x71e9, 0x71ea, 0x71eb, 0x71ec, 0x71ed, 0x71ef, 0x71f0, 0x71f1, + 0x71f2, 0x71f3, 0x71f4, 0x71f5, 0x71f6, 0x71f7, 0x71f8, 0x71fa, + 0x71fb, 0x71fc, 0x71fd, 0x71fe, 0x71ff, 0x7200, 0x7201, 0x7202, + 0x7203, 0x7204, 0x7205, 0x7207, 0x7208, 0x7209, 0x720a, 0x720b, + 0x720c, 0x720d, 0x720e, 0x720f, 0x7210, 0x7211, 0x7212, 0x7213, + 0x7214, 0x7215, 0x7216, 0x7217, 0x7218, 0x7219, 0x721a, 0x721b, + 0x721c, 0x721e, 0x721f, 0x7220, 0x7221, 0x7222, 0x7223, 0x7224, + 0x7225, 0x7226, 0x7227, 0x7229, 0x722b, 0x722d, 0x722e, 0x722f, + 0x7232, 0x7233, 0x7234, 0x723a, 0x723c, 0x723e, 0x7240, 0x7241, + 0x7242, 0x7243, 0x7244, 0x7245, 0x7246, 0x7249, 0x724a, 0x724b, + 0x724e, 0x724f, 0x7250, 0x7251, 0x7253, 0x7254, 0x7255, 0x7257, + 0x7258, 0x725a, 0x725c, 0x725e, 0x7260, 0x7263, 0x7264, 0x7265, + 0x7268, 0x726a, 0x726b, 0x726c, 0x726d, 0x7270, 0x7271, 0x7273, + 0x7274, 0x7276, 0x7277, 0x7278, 0x727b, 0x727c, 0x727d, 0x7282, + 0x7283, 0x7285, 0x7286, 0x7287, 0x7288, 0x7289, 0x728c, 0x728e, + 0x7290, 0x7291, 0x7293, 0x7294, 0x7295, 0x7296, 0x7297, 0x7298, + 0x7299, 0x729a, 0x729b, 0x729c, 0x729d, 0x729e, 0x72a0, 0x72a1, + 0x72a2, 0x72a3, 0x72a4, 0x72a5, 0x72a6, 0x72a7, 0x72a8, 0x72a9, + 0x72aa, 0x72ab, 0x72ae, 0x72b1, 0x72b2, 0x72b3, 0x72b5, 0x72ba, + 0x72bb, 0x72bc, 0x72bd, 0x72be, 0x72bf, 0x72c0, 0x72c5, 0x72c6, + 0x72c7, 0x72c9, 0x72ca, 0x72cb, 0x72cc, 0x72cf, 0x72d1, 0x72d3, + 0x72d4, 0x72d5, 0x72d6, 0x72d8, 0x72da, 0x72db, + /* 0xa1 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x3000, 0x3001, 0x3002, 0x00b7, 0x02c9, 0x02c7, 0x00a8, 0x3003, + 0x3005, 0x2014, 0xff5e, 0x2016, 0x2026, 0x2018, 0x2019, 0x201c, + 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, + 0x300d, 0x300e, 0x300f, 0x3016, 0x3017, 0x3010, 0x3011, 0x00b1, + 0x00d7, 0x00f7, 0x2236, 0x2227, 0x2228, 0x2211, 0x220f, 0x222a, + 0x2229, 0x2208, 0x2237, 0x221a, 0x22a5, 0x2225, 0x2220, 0x2312, + 0x2299, 0x222b, 0x222e, 0x2261, 0x224c, 0x2248, 0x223d, 0x221d, + 0x2260, 0x226e, 0x226f, 0x2264, 0x2265, 0x221e, 0x2235, 0x2234, + 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xff04, 0x00a4, + 0xffe0, 0xffe1, 0x2030, 0x00a7, 0x2116, 0x2606, 0x2605, 0x25cb, + 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, + 0x203b, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, + /* 0xa2 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, + 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x2488, 0x2489, 0x248a, 0x248b, 0x248c, 0x248d, 0x248e, 0x248f, + 0x2490, 0x2491, 0x2492, 0x2493, 0x2494, 0x2495, 0x2496, 0x2497, + 0x2498, 0x2499, 0x249a, 0x249b, 0x2474, 0x2475, 0x2476, 0x2477, + 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, 0x247e, 0x247f, + 0x2480, 0x2481, 0x2482, 0x2483, 0x2484, 0x2485, 0x2486, 0x2487, + 0x2460, 0x2461, 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, + 0x2468, 0x2469, 0xfffd, 0xfffd, 0x3220, 0x3221, 0x3222, 0x3223, + 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0xfffd, 0xfffd, + 0x2160, 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, + 0x2168, 0x2169, 0x216a, 0x216b, 0xfffd, 0xfffd, + /* 0xa3 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xff01, 0xff02, 0xff03, 0xffe5, 0xff05, 0xff06, 0xff07, 0xff08, + 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, + 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, + 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, + 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, + 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, + 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, + 0xff39, 0xff3a, 0xff3b, 0xff3c, 0xff3d, 0xff3e, 0xff3f, 0xff40, + 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, + 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, + 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, + 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, + /* 0xa4 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, + 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, + 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, + 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, + 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, + 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, + 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, + 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, + 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, + 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa5 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, + 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, + 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, + 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, + 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, + 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, + 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, + 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, + 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, + 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, + 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa6 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, + 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, + 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, + 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, + 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfe35, + 0xfe36, 0xfe39, 0xfe3a, 0xfe3f, 0xfe40, 0xfe3d, 0xfe3e, 0xfe41, + 0xfe42, 0xfe43, 0xfe44, 0xfffd, 0xfffd, 0xfe3b, 0xfe3c, 0xfe37, + 0xfe38, 0xfe31, 0xfffd, 0xfe33, 0xfe34, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa7 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, + 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, + 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, + 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, + 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, + 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, + 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa8 */ + 0x02ca, 0x02cb, 0x02d9, 0x2013, 0x2015, 0x2025, 0x2035, 0x2105, + 0x2109, 0x2196, 0x2197, 0x2198, 0x2199, 0x2215, 0x221f, 0x2223, + 0x2252, 0x2266, 0x2267, 0x22bf, 0x2550, 0x2551, 0x2552, 0x2553, + 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, + 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, 0x2563, + 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, + 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, 0x2573, + 0x2581, 0x2582, 0x2583, 0x2584, 0x2585, 0x2586, 0x2587, 0x2588, + 0x2589, 0x258a, 0x258b, 0x258c, 0x258d, 0x258e, 0x258f, 0x2593, + 0x2594, 0x2595, 0x25bc, 0x25bd, 0x25e2, 0x25e3, 0x25e4, 0x25e5, + 0x2609, 0x2295, 0x3012, 0x301d, 0x301e, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0101, 0x00e1, 0x01ce, 0x00e0, 0x0113, 0x00e9, 0x011b, 0x00e8, + 0x012b, 0x00ed, 0x01d0, 0x00ec, 0x014d, 0x00f3, 0x01d2, 0x00f2, + 0x016b, 0x00fa, 0x01d4, 0x00f9, 0x01d6, 0x01d8, 0x01da, 0x01dc, + 0x00fc, 0x00ea, 0x0251, 0xfffd, 0x0144, 0x0148, 0xfffd, 0x0261, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3105, 0x3106, 0x3107, 0x3108, + 0x3109, 0x310a, 0x310b, 0x310c, 0x310d, 0x310e, 0x310f, 0x3110, + 0x3111, 0x3112, 0x3113, 0x3114, 0x3115, 0x3116, 0x3117, 0x3118, + 0x3119, 0x311a, 0x311b, 0x311c, 0x311d, 0x311e, 0x311f, 0x3120, + 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, + 0x3129, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xa9 */ + 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, 0x3027, 0x3028, + 0x3029, 0x32a3, 0x338e, 0x338f, 0x339c, 0x339d, 0x339e, 0x33a1, + 0x33c4, 0x33ce, 0x33d1, 0x33d2, 0x33d5, 0xfe30, 0xffe2, 0xffe4, + 0xfffd, 0x2121, 0x3231, 0xfffd, 0x2010, 0xfffd, 0xfffd, 0xfffd, + 0x30fc, 0x309b, 0x309c, 0x30fd, 0x30fe, 0x3006, 0x309d, 0x309e, + 0xfe49, 0xfe4a, 0xfe4b, 0xfe4c, 0xfe4d, 0xfe4e, 0xfe4f, 0xfe50, + 0xfe51, 0xfe52, 0xfe54, 0xfe55, 0xfe56, 0xfe57, 0xfe59, 0xfe5a, + 0xfe5b, 0xfe5c, 0xfe5d, 0xfe5e, 0xfe5f, 0xfe60, 0xfe61, 0xfe62, + 0xfe63, 0xfe64, 0xfe65, 0xfe66, 0xfe68, 0xfe69, 0xfe6a, 0xfe6b, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x3007, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0x2500, 0x2501, 0x2502, 0x2503, 0x2504, + 0x2505, 0x2506, 0x2507, 0x2508, 0x2509, 0x250a, 0x250b, 0x250c, + 0x250d, 0x250e, 0x250f, 0x2510, 0x2511, 0x2512, 0x2513, 0x2514, + 0x2515, 0x2516, 0x2517, 0x2518, 0x2519, 0x251a, 0x251b, 0x251c, + 0x251d, 0x251e, 0x251f, 0x2520, 0x2521, 0x2522, 0x2523, 0x2524, + 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x252b, 0x252c, + 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, + 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, 0x253b, 0x253c, + 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, 0x2543, 0x2544, + 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, 0x254b, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xaa */ + 0x72dc, 0x72dd, 0x72df, 0x72e2, 0x72e3, 0x72e4, 0x72e5, 0x72e6, + 0x72e7, 0x72ea, 0x72eb, 0x72f5, 0x72f6, 0x72f9, 0x72fd, 0x72fe, + 0x72ff, 0x7300, 0x7302, 0x7304, 0x7305, 0x7306, 0x7307, 0x7308, + 0x7309, 0x730b, 0x730c, 0x730d, 0x730f, 0x7310, 0x7311, 0x7312, + 0x7314, 0x7318, 0x7319, 0x731a, 0x731f, 0x7320, 0x7323, 0x7324, + 0x7326, 0x7327, 0x7328, 0x732d, 0x732f, 0x7330, 0x7332, 0x7333, + 0x7335, 0x7336, 0x733a, 0x733b, 0x733c, 0x733d, 0x7340, 0x7341, + 0x7342, 0x7343, 0x7344, 0x7345, 0x7346, 0x7347, 0x7348, 0x7349, + 0x734a, 0x734b, 0x734c, 0x734e, 0x734f, 0x7351, 0x7353, 0x7354, + 0x7355, 0x7356, 0x7358, 0x7359, 0x735a, 0x735b, 0x735c, 0x735d, + 0x735e, 0x735f, 0x7361, 0x7362, 0x7363, 0x7364, 0x7365, 0x7366, + 0x7367, 0x7368, 0x7369, 0x736a, 0x736b, 0x736e, 0x7370, 0x7371, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xab */ + 0x7372, 0x7373, 0x7374, 0x7375, 0x7376, 0x7377, 0x7378, 0x7379, + 0x737a, 0x737b, 0x737c, 0x737d, 0x737f, 0x7380, 0x7381, 0x7382, + 0x7383, 0x7385, 0x7386, 0x7388, 0x738a, 0x738c, 0x738d, 0x738f, + 0x7390, 0x7392, 0x7393, 0x7394, 0x7395, 0x7397, 0x7398, 0x7399, + 0x739a, 0x739c, 0x739d, 0x739e, 0x73a0, 0x73a1, 0x73a3, 0x73a4, + 0x73a5, 0x73a6, 0x73a7, 0x73a8, 0x73aa, 0x73ac, 0x73ad, 0x73b1, + 0x73b4, 0x73b5, 0x73b6, 0x73b8, 0x73b9, 0x73bc, 0x73bd, 0x73be, + 0x73bf, 0x73c1, 0x73c3, 0x73c4, 0x73c5, 0x73c6, 0x73c7, 0x73cb, + 0x73cc, 0x73ce, 0x73d2, 0x73d3, 0x73d4, 0x73d5, 0x73d6, 0x73d7, + 0x73d8, 0x73da, 0x73db, 0x73dc, 0x73dd, 0x73df, 0x73e1, 0x73e2, + 0x73e3, 0x73e4, 0x73e6, 0x73e8, 0x73ea, 0x73eb, 0x73ec, 0x73ee, + 0x73ef, 0x73f0, 0x73f1, 0x73f3, 0x73f4, 0x73f5, 0x73f6, 0x73f7, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xac */ + 0x73f8, 0x73f9, 0x73fa, 0x73fb, 0x73fc, 0x73fd, 0x73fe, 0x73ff, + 0x7400, 0x7401, 0x7402, 0x7404, 0x7407, 0x7408, 0x740b, 0x740c, + 0x740d, 0x740e, 0x7411, 0x7412, 0x7413, 0x7414, 0x7415, 0x7416, + 0x7417, 0x7418, 0x7419, 0x741c, 0x741d, 0x741e, 0x741f, 0x7420, + 0x7421, 0x7423, 0x7424, 0x7427, 0x7429, 0x742b, 0x742d, 0x742f, + 0x7431, 0x7432, 0x7437, 0x7438, 0x7439, 0x743a, 0x743b, 0x743d, + 0x743e, 0x743f, 0x7440, 0x7442, 0x7443, 0x7444, 0x7445, 0x7446, + 0x7447, 0x7448, 0x7449, 0x744a, 0x744b, 0x744c, 0x744d, 0x744e, + 0x744f, 0x7450, 0x7451, 0x7452, 0x7453, 0x7454, 0x7456, 0x7458, + 0x745d, 0x7460, 0x7461, 0x7462, 0x7463, 0x7464, 0x7465, 0x7466, + 0x7467, 0x7468, 0x7469, 0x746a, 0x746b, 0x746c, 0x746e, 0x746f, + 0x7471, 0x7472, 0x7473, 0x7474, 0x7475, 0x7478, 0x7479, 0x747a, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xad */ + 0x747b, 0x747c, 0x747d, 0x747f, 0x7482, 0x7484, 0x7485, 0x7486, + 0x7488, 0x7489, 0x748a, 0x748c, 0x748d, 0x748f, 0x7491, 0x7492, + 0x7493, 0x7494, 0x7495, 0x7496, 0x7497, 0x7498, 0x7499, 0x749a, + 0x749b, 0x749d, 0x749f, 0x74a0, 0x74a1, 0x74a2, 0x74a3, 0x74a4, + 0x74a5, 0x74a6, 0x74aa, 0x74ab, 0x74ac, 0x74ad, 0x74ae, 0x74af, + 0x74b0, 0x74b1, 0x74b2, 0x74b3, 0x74b4, 0x74b5, 0x74b6, 0x74b7, + 0x74b8, 0x74b9, 0x74bb, 0x74bc, 0x74bd, 0x74be, 0x74bf, 0x74c0, + 0x74c1, 0x74c2, 0x74c3, 0x74c4, 0x74c5, 0x74c6, 0x74c7, 0x74c8, + 0x74c9, 0x74ca, 0x74cb, 0x74cc, 0x74cd, 0x74ce, 0x74cf, 0x74d0, + 0x74d1, 0x74d3, 0x74d4, 0x74d5, 0x74d6, 0x74d7, 0x74d8, 0x74d9, + 0x74da, 0x74db, 0x74dd, 0x74df, 0x74e1, 0x74e5, 0x74e7, 0x74e8, + 0x74e9, 0x74ea, 0x74eb, 0x74ec, 0x74ed, 0x74f0, 0x74f1, 0x74f2, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xae */ + 0x74f3, 0x74f5, 0x74f8, 0x74f9, 0x74fa, 0x74fb, 0x74fc, 0x74fd, + 0x74fe, 0x7500, 0x7501, 0x7502, 0x7503, 0x7505, 0x7506, 0x7507, + 0x7508, 0x7509, 0x750a, 0x750b, 0x750c, 0x750e, 0x7510, 0x7512, + 0x7514, 0x7515, 0x7516, 0x7517, 0x751b, 0x751d, 0x751e, 0x7520, + 0x7521, 0x7522, 0x7523, 0x7524, 0x7526, 0x7527, 0x752a, 0x752e, + 0x7534, 0x7536, 0x7539, 0x753c, 0x753d, 0x753f, 0x7541, 0x7542, + 0x7543, 0x7544, 0x7546, 0x7547, 0x7549, 0x754a, 0x754d, 0x7550, + 0x7551, 0x7552, 0x7553, 0x7555, 0x7556, 0x7557, 0x7558, 0x755d, + 0x755e, 0x755f, 0x7560, 0x7561, 0x7562, 0x7563, 0x7564, 0x7567, + 0x7568, 0x7569, 0x756b, 0x756c, 0x756d, 0x756e, 0x756f, 0x7570, + 0x7571, 0x7573, 0x7575, 0x7576, 0x7577, 0x757a, 0x757b, 0x757c, + 0x757d, 0x757e, 0x7580, 0x7581, 0x7582, 0x7584, 0x7585, 0x7587, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xaf */ + 0x7588, 0x7589, 0x758a, 0x758c, 0x758d, 0x758e, 0x7590, 0x7593, + 0x7595, 0x7598, 0x759b, 0x759c, 0x759e, 0x75a2, 0x75a6, 0x75a7, + 0x75a8, 0x75a9, 0x75aa, 0x75ad, 0x75b6, 0x75b7, 0x75ba, 0x75bb, + 0x75bf, 0x75c0, 0x75c1, 0x75c6, 0x75cb, 0x75cc, 0x75ce, 0x75cf, + 0x75d0, 0x75d1, 0x75d3, 0x75d7, 0x75d9, 0x75da, 0x75dc, 0x75dd, + 0x75df, 0x75e0, 0x75e1, 0x75e5, 0x75e9, 0x75ec, 0x75ed, 0x75ee, + 0x75ef, 0x75f2, 0x75f3, 0x75f5, 0x75f6, 0x75f7, 0x75f8, 0x75fa, + 0x75fb, 0x75fd, 0x75fe, 0x7602, 0x7604, 0x7606, 0x7607, 0x7608, + 0x7609, 0x760b, 0x760d, 0x760e, 0x760f, 0x7611, 0x7612, 0x7613, + 0x7614, 0x7616, 0x761a, 0x761c, 0x761d, 0x761e, 0x7621, 0x7623, + 0x7627, 0x7628, 0x762c, 0x762e, 0x762f, 0x7631, 0x7632, 0x7636, + 0x7637, 0x7639, 0x763a, 0x763b, 0x763d, 0x7641, 0x7642, 0x7644, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xb0 */ + 0x7645, 0x7646, 0x7647, 0x7648, 0x7649, 0x764a, 0x764b, 0x764e, + 0x764f, 0x7650, 0x7651, 0x7652, 0x7653, 0x7655, 0x7657, 0x7658, + 0x7659, 0x765a, 0x765b, 0x765d, 0x765f, 0x7660, 0x7661, 0x7662, + 0x7664, 0x7665, 0x7666, 0x7667, 0x7668, 0x7669, 0x766a, 0x766c, + 0x766d, 0x766e, 0x7670, 0x7671, 0x7672, 0x7673, 0x7674, 0x7675, + 0x7676, 0x7677, 0x7679, 0x767a, 0x767c, 0x767f, 0x7680, 0x7681, + 0x7683, 0x7685, 0x7689, 0x768a, 0x768c, 0x768d, 0x768f, 0x7690, + 0x7692, 0x7694, 0x7695, 0x7697, 0x7698, 0x769a, 0x769b, 0x769c, + 0x769d, 0x769e, 0x769f, 0x76a0, 0x76a1, 0x76a2, 0x76a3, 0x76a5, + 0x76a6, 0x76a7, 0x76a8, 0x76a9, 0x76aa, 0x76ab, 0x76ac, 0x76ad, + 0x76af, 0x76b0, 0x76b3, 0x76b5, 0x76b6, 0x76b7, 0x76b8, 0x76b9, + 0x76ba, 0x76bb, 0x76bc, 0x76bd, 0x76be, 0x76c0, 0x76c1, 0x76c3, + 0x554a, 0x963f, 0x57c3, 0x6328, 0x54ce, 0x5509, 0x54c0, 0x7691, + 0x764c, 0x853c, 0x77ee, 0x827e, 0x788d, 0x7231, 0x9698, 0x978d, + 0x6c28, 0x5b89, 0x4ffa, 0x6309, 0x6697, 0x5cb8, 0x80fa, 0x6848, + 0x80ae, 0x6602, 0x76ce, 0x51f9, 0x6556, 0x71ac, 0x7ff1, 0x8884, + 0x50b2, 0x5965, 0x61ca, 0x6fb3, 0x82ad, 0x634c, 0x6252, 0x53ed, + 0x5427, 0x7b06, 0x516b, 0x75a4, 0x5df4, 0x62d4, 0x8dcb, 0x9776, + 0x628a, 0x8019, 0x575d, 0x9738, 0x7f62, 0x7238, 0x767d, 0x67cf, + 0x767e, 0x6446, 0x4f70, 0x8d25, 0x62dc, 0x7a17, 0x6591, 0x73ed, + 0x642c, 0x6273, 0x822c, 0x9881, 0x677f, 0x7248, 0x626e, 0x62cc, + 0x4f34, 0x74e3, 0x534a, 0x529e, 0x7eca, 0x90a6, 0x5e2e, 0x6886, + 0x699c, 0x8180, 0x7ed1, 0x68d2, 0x78c5, 0x868c, 0x9551, 0x508d, + 0x8c24, 0x82de, 0x80de, 0x5305, 0x8912, 0x5265, + /* 0xb1 */ + 0x76c4, 0x76c7, 0x76c9, 0x76cb, 0x76cc, 0x76d3, 0x76d5, 0x76d9, + 0x76da, 0x76dc, 0x76dd, 0x76de, 0x76e0, 0x76e1, 0x76e2, 0x76e3, + 0x76e4, 0x76e6, 0x76e7, 0x76e8, 0x76e9, 0x76ea, 0x76eb, 0x76ec, + 0x76ed, 0x76f0, 0x76f3, 0x76f5, 0x76f6, 0x76f7, 0x76fa, 0x76fb, + 0x76fd, 0x76ff, 0x7700, 0x7702, 0x7703, 0x7705, 0x7706, 0x770a, + 0x770c, 0x770e, 0x770f, 0x7710, 0x7711, 0x7712, 0x7713, 0x7714, + 0x7715, 0x7716, 0x7717, 0x7718, 0x771b, 0x771c, 0x771d, 0x771e, + 0x7721, 0x7723, 0x7724, 0x7725, 0x7727, 0x772a, 0x772b, 0x772c, + 0x772e, 0x7730, 0x7731, 0x7732, 0x7733, 0x7734, 0x7739, 0x773b, + 0x773d, 0x773e, 0x773f, 0x7742, 0x7744, 0x7745, 0x7746, 0x7748, + 0x7749, 0x774a, 0x774b, 0x774c, 0x774d, 0x774e, 0x774f, 0x7752, + 0x7753, 0x7754, 0x7755, 0x7756, 0x7757, 0x7758, 0x7759, 0x775c, + 0x8584, 0x96f9, 0x4fdd, 0x5821, 0x9971, 0x5b9d, 0x62b1, 0x62a5, + 0x66b4, 0x8c79, 0x9c8d, 0x7206, 0x676f, 0x7891, 0x60b2, 0x5351, + 0x5317, 0x8f88, 0x80cc, 0x8d1d, 0x94a1, 0x500d, 0x72c8, 0x5907, + 0x60eb, 0x7119, 0x88ab, 0x5954, 0x82ef, 0x672c, 0x7b28, 0x5d29, + 0x7ef7, 0x752d, 0x6cf5, 0x8e66, 0x8ff8, 0x903c, 0x9f3b, 0x6bd4, + 0x9119, 0x7b14, 0x5f7c, 0x78a7, 0x84d6, 0x853d, 0x6bd5, 0x6bd9, + 0x6bd6, 0x5e01, 0x5e87, 0x75f9, 0x95ed, 0x655d, 0x5f0a, 0x5fc5, + 0x8f9f, 0x58c1, 0x81c2, 0x907f, 0x965b, 0x97ad, 0x8fb9, 0x7f16, + 0x8d2c, 0x6241, 0x4fbf, 0x53d8, 0x535e, 0x8fa8, 0x8fa9, 0x8fab, + 0x904d, 0x6807, 0x5f6a, 0x8198, 0x8868, 0x9cd6, 0x618b, 0x522b, + 0x762a, 0x5f6c, 0x658c, 0x6fd2, 0x6ee8, 0x5bbe, 0x6448, 0x5175, + 0x51b0, 0x67c4, 0x4e19, 0x79c9, 0x997c, 0x70b3, + /* 0xb2 */ + 0x775d, 0x775e, 0x775f, 0x7760, 0x7764, 0x7767, 0x7769, 0x776a, + 0x776d, 0x776e, 0x776f, 0x7770, 0x7771, 0x7772, 0x7773, 0x7774, + 0x7775, 0x7776, 0x7777, 0x7778, 0x777a, 0x777b, 0x777c, 0x7781, + 0x7782, 0x7783, 0x7786, 0x7787, 0x7788, 0x7789, 0x778a, 0x778b, + 0x778f, 0x7790, 0x7793, 0x7794, 0x7795, 0x7796, 0x7797, 0x7798, + 0x7799, 0x779a, 0x779b, 0x779c, 0x779d, 0x779e, 0x77a1, 0x77a3, + 0x77a4, 0x77a6, 0x77a8, 0x77ab, 0x77ad, 0x77ae, 0x77af, 0x77b1, + 0x77b2, 0x77b4, 0x77b6, 0x77b7, 0x77b8, 0x77b9, 0x77ba, 0x77bc, + 0x77be, 0x77c0, 0x77c1, 0x77c2, 0x77c3, 0x77c4, 0x77c5, 0x77c6, + 0x77c7, 0x77c8, 0x77c9, 0x77ca, 0x77cb, 0x77cc, 0x77ce, 0x77cf, + 0x77d0, 0x77d1, 0x77d2, 0x77d3, 0x77d4, 0x77d5, 0x77d6, 0x77d8, + 0x77d9, 0x77da, 0x77dd, 0x77de, 0x77df, 0x77e0, 0x77e1, 0x77e4, + 0x75c5, 0x5e76, 0x73bb, 0x83e0, 0x64ad, 0x62e8, 0x94b5, 0x6ce2, + 0x535a, 0x52c3, 0x640f, 0x94c2, 0x7b94, 0x4f2f, 0x5e1b, 0x8236, + 0x8116, 0x818a, 0x6e24, 0x6cca, 0x9a73, 0x6355, 0x535c, 0x54fa, + 0x8865, 0x57e0, 0x4e0d, 0x5e03, 0x6b65, 0x7c3f, 0x90e8, 0x6016, + 0x64e6, 0x731c, 0x88c1, 0x6750, 0x624d, 0x8d22, 0x776c, 0x8e29, + 0x91c7, 0x5f69, 0x83dc, 0x8521, 0x9910, 0x53c2, 0x8695, 0x6b8b, + 0x60ed, 0x60e8, 0x707f, 0x82cd, 0x8231, 0x4ed3, 0x6ca7, 0x85cf, + 0x64cd, 0x7cd9, 0x69fd, 0x66f9, 0x8349, 0x5395, 0x7b56, 0x4fa7, + 0x518c, 0x6d4b, 0x5c42, 0x8e6d, 0x63d2, 0x53c9, 0x832c, 0x8336, + 0x67e5, 0x78b4, 0x643d, 0x5bdf, 0x5c94, 0x5dee, 0x8be7, 0x62c6, + 0x67f4, 0x8c7a, 0x6400, 0x63ba, 0x8749, 0x998b, 0x8c17, 0x7f20, + 0x94f2, 0x4ea7, 0x9610, 0x98a4, 0x660c, 0x7316, + /* 0xb3 */ + 0x77e6, 0x77e8, 0x77ea, 0x77ef, 0x77f0, 0x77f1, 0x77f2, 0x77f4, + 0x77f5, 0x77f7, 0x77f9, 0x77fa, 0x77fb, 0x77fc, 0x7803, 0x7804, + 0x7805, 0x7806, 0x7807, 0x7808, 0x780a, 0x780b, 0x780e, 0x780f, + 0x7810, 0x7813, 0x7815, 0x7819, 0x781b, 0x781e, 0x7820, 0x7821, + 0x7822, 0x7824, 0x7828, 0x782a, 0x782b, 0x782e, 0x782f, 0x7831, + 0x7832, 0x7833, 0x7835, 0x7836, 0x783d, 0x783f, 0x7841, 0x7842, + 0x7843, 0x7844, 0x7846, 0x7848, 0x7849, 0x784a, 0x784b, 0x784d, + 0x784f, 0x7851, 0x7853, 0x7854, 0x7858, 0x7859, 0x785a, 0x785b, + 0x785c, 0x785e, 0x785f, 0x7860, 0x7861, 0x7862, 0x7863, 0x7864, + 0x7865, 0x7866, 0x7867, 0x7868, 0x7869, 0x786f, 0x7870, 0x7871, + 0x7872, 0x7873, 0x7874, 0x7875, 0x7876, 0x7878, 0x7879, 0x787a, + 0x787b, 0x787d, 0x787e, 0x787f, 0x7880, 0x7881, 0x7882, 0x7883, + 0x573a, 0x5c1d, 0x5e38, 0x957f, 0x507f, 0x80a0, 0x5382, 0x655e, + 0x7545, 0x5531, 0x5021, 0x8d85, 0x6284, 0x949e, 0x671d, 0x5632, + 0x6f6e, 0x5de2, 0x5435, 0x7092, 0x8f66, 0x626f, 0x64a4, 0x63a3, + 0x5f7b, 0x6f88, 0x90f4, 0x81e3, 0x8fb0, 0x5c18, 0x6668, 0x5ff1, + 0x6c89, 0x9648, 0x8d81, 0x886c, 0x6491, 0x79f0, 0x57ce, 0x6a59, + 0x6210, 0x5448, 0x4e58, 0x7a0b, 0x60e9, 0x6f84, 0x8bda, 0x627f, + 0x901e, 0x9a8b, 0x79e4, 0x5403, 0x75f4, 0x6301, 0x5319, 0x6c60, + 0x8fdf, 0x5f1b, 0x9a70, 0x803b, 0x9f7f, 0x4f88, 0x5c3a, 0x8d64, + 0x7fc5, 0x65a5, 0x70bd, 0x5145, 0x51b2, 0x866b, 0x5d07, 0x5ba0, + 0x62bd, 0x916c, 0x7574, 0x8e0c, 0x7a20, 0x6101, 0x7b79, 0x4ec7, + 0x7ef8, 0x7785, 0x4e11, 0x81ed, 0x521d, 0x51fa, 0x6a71, 0x53a8, + 0x8e87, 0x9504, 0x96cf, 0x6ec1, 0x9664, 0x695a, + /* 0xb4 */ + 0x7884, 0x7885, 0x7886, 0x7888, 0x788a, 0x788b, 0x788f, 0x7890, + 0x7892, 0x7894, 0x7895, 0x7896, 0x7899, 0x789d, 0x789e, 0x78a0, + 0x78a2, 0x78a4, 0x78a6, 0x78a8, 0x78a9, 0x78aa, 0x78ab, 0x78ac, + 0x78ad, 0x78ae, 0x78af, 0x78b5, 0x78b6, 0x78b7, 0x78b8, 0x78ba, + 0x78bb, 0x78bc, 0x78bd, 0x78bf, 0x78c0, 0x78c2, 0x78c3, 0x78c4, + 0x78c6, 0x78c7, 0x78c8, 0x78cc, 0x78cd, 0x78ce, 0x78cf, 0x78d1, + 0x78d2, 0x78d3, 0x78d6, 0x78d7, 0x78d8, 0x78da, 0x78db, 0x78dc, + 0x78dd, 0x78de, 0x78df, 0x78e0, 0x78e1, 0x78e2, 0x78e3, 0x78e4, + 0x78e5, 0x78e6, 0x78e7, 0x78e9, 0x78ea, 0x78eb, 0x78ed, 0x78ee, + 0x78ef, 0x78f0, 0x78f1, 0x78f3, 0x78f5, 0x78f6, 0x78f8, 0x78f9, + 0x78fb, 0x78fc, 0x78fd, 0x78fe, 0x78ff, 0x7900, 0x7902, 0x7903, + 0x7904, 0x7906, 0x7907, 0x7908, 0x7909, 0x790a, 0x790b, 0x790c, + 0x7840, 0x50a8, 0x77d7, 0x6410, 0x89e6, 0x5904, 0x63e3, 0x5ddd, + 0x7a7f, 0x693d, 0x4f20, 0x8239, 0x5598, 0x4e32, 0x75ae, 0x7a97, + 0x5e62, 0x5e8a, 0x95ef, 0x521b, 0x5439, 0x708a, 0x6376, 0x9524, + 0x5782, 0x6625, 0x693f, 0x9187, 0x5507, 0x6df3, 0x7eaf, 0x8822, + 0x6233, 0x7ef0, 0x75b5, 0x8328, 0x78c1, 0x96cc, 0x8f9e, 0x6148, + 0x74f7, 0x8bcd, 0x6b64, 0x523a, 0x8d50, 0x6b21, 0x806a, 0x8471, + 0x56f1, 0x5306, 0x4ece, 0x4e1b, 0x51d1, 0x7c97, 0x918b, 0x7c07, + 0x4fc3, 0x8e7f, 0x7be1, 0x7a9c, 0x6467, 0x5d14, 0x50ac, 0x8106, + 0x7601, 0x7cb9, 0x6dec, 0x7fe0, 0x6751, 0x5b58, 0x5bf8, 0x78cb, + 0x64ae, 0x6413, 0x63aa, 0x632b, 0x9519, 0x642d, 0x8fbe, 0x7b54, + 0x7629, 0x6253, 0x5927, 0x5446, 0x6b79, 0x50a3, 0x6234, 0x5e26, + 0x6b86, 0x4ee3, 0x8d37, 0x888b, 0x5f85, 0x902e, + /* 0xb5 */ + 0x790d, 0x790e, 0x790f, 0x7910, 0x7911, 0x7912, 0x7914, 0x7915, + 0x7916, 0x7917, 0x7918, 0x7919, 0x791a, 0x791b, 0x791c, 0x791d, + 0x791f, 0x7920, 0x7921, 0x7922, 0x7923, 0x7925, 0x7926, 0x7927, + 0x7928, 0x7929, 0x792a, 0x792b, 0x792c, 0x792d, 0x792e, 0x792f, + 0x7930, 0x7931, 0x7932, 0x7933, 0x7935, 0x7936, 0x7937, 0x7938, + 0x7939, 0x793d, 0x793f, 0x7942, 0x7943, 0x7944, 0x7945, 0x7947, + 0x794a, 0x794b, 0x794c, 0x794d, 0x794e, 0x794f, 0x7950, 0x7951, + 0x7952, 0x7954, 0x7955, 0x7958, 0x7959, 0x7961, 0x7963, 0x7964, + 0x7966, 0x7969, 0x796a, 0x796b, 0x796c, 0x796e, 0x7970, 0x7971, + 0x7972, 0x7973, 0x7974, 0x7975, 0x7976, 0x7979, 0x797b, 0x797c, + 0x797d, 0x797e, 0x797f, 0x7982, 0x7983, 0x7986, 0x7987, 0x7988, + 0x7989, 0x798b, 0x798c, 0x798d, 0x798e, 0x7990, 0x7991, 0x7992, + 0x6020, 0x803d, 0x62c5, 0x4e39, 0x5355, 0x90f8, 0x63b8, 0x80c6, + 0x65e6, 0x6c2e, 0x4f46, 0x60ee, 0x6de1, 0x8bde, 0x5f39, 0x86cb, + 0x5f53, 0x6321, 0x515a, 0x8361, 0x6863, 0x5200, 0x6363, 0x8e48, + 0x5012, 0x5c9b, 0x7977, 0x5bfc, 0x5230, 0x7a3b, 0x60bc, 0x9053, + 0x76d7, 0x5fb7, 0x5f97, 0x7684, 0x8e6c, 0x706f, 0x767b, 0x7b49, + 0x77aa, 0x51f3, 0x9093, 0x5824, 0x4f4e, 0x6ef4, 0x8fea, 0x654c, + 0x7b1b, 0x72c4, 0x6da4, 0x7fdf, 0x5ae1, 0x62b5, 0x5e95, 0x5730, + 0x8482, 0x7b2c, 0x5e1d, 0x5f1f, 0x9012, 0x7f14, 0x98a0, 0x6382, + 0x6ec7, 0x7898, 0x70b9, 0x5178, 0x975b, 0x57ab, 0x7535, 0x4f43, + 0x7538, 0x5e97, 0x60e6, 0x5960, 0x6dc0, 0x6bbf, 0x7889, 0x53fc, + 0x96d5, 0x51cb, 0x5201, 0x6389, 0x540a, 0x9493, 0x8c03, 0x8dcc, + 0x7239, 0x789f, 0x8776, 0x8fed, 0x8c0d, 0x53e0, + /* 0xb6 */ + 0x7993, 0x7994, 0x7995, 0x7996, 0x7997, 0x7998, 0x7999, 0x799b, + 0x799c, 0x799d, 0x799e, 0x799f, 0x79a0, 0x79a1, 0x79a2, 0x79a3, + 0x79a4, 0x79a5, 0x79a6, 0x79a8, 0x79a9, 0x79aa, 0x79ab, 0x79ac, + 0x79ad, 0x79ae, 0x79af, 0x79b0, 0x79b1, 0x79b2, 0x79b4, 0x79b5, + 0x79b6, 0x79b7, 0x79b8, 0x79bc, 0x79bf, 0x79c2, 0x79c4, 0x79c5, + 0x79c7, 0x79c8, 0x79ca, 0x79cc, 0x79ce, 0x79cf, 0x79d0, 0x79d3, + 0x79d4, 0x79d6, 0x79d7, 0x79d9, 0x79da, 0x79db, 0x79dc, 0x79dd, + 0x79de, 0x79e0, 0x79e1, 0x79e2, 0x79e5, 0x79e8, 0x79ea, 0x79ec, + 0x79ee, 0x79f1, 0x79f2, 0x79f3, 0x79f4, 0x79f5, 0x79f6, 0x79f7, + 0x79f9, 0x79fa, 0x79fc, 0x79fe, 0x79ff, 0x7a01, 0x7a04, 0x7a05, + 0x7a07, 0x7a08, 0x7a09, 0x7a0a, 0x7a0c, 0x7a0f, 0x7a10, 0x7a11, + 0x7a12, 0x7a13, 0x7a15, 0x7a16, 0x7a18, 0x7a19, 0x7a1b, 0x7a1c, + 0x4e01, 0x76ef, 0x53ee, 0x9489, 0x9876, 0x9f0e, 0x952d, 0x5b9a, + 0x8ba2, 0x4e22, 0x4e1c, 0x51ac, 0x8463, 0x61c2, 0x52a8, 0x680b, + 0x4f97, 0x606b, 0x51bb, 0x6d1e, 0x515c, 0x6296, 0x6597, 0x9661, + 0x8c46, 0x9017, 0x75d8, 0x90fd, 0x7763, 0x6bd2, 0x728a, 0x72ec, + 0x8bfb, 0x5835, 0x7779, 0x8d4c, 0x675c, 0x9540, 0x809a, 0x5ea6, + 0x6e21, 0x5992, 0x7aef, 0x77ed, 0x953b, 0x6bb5, 0x65ad, 0x7f0e, + 0x5806, 0x5151, 0x961f, 0x5bf9, 0x58a9, 0x5428, 0x8e72, 0x6566, + 0x987f, 0x56e4, 0x949d, 0x76fe, 0x9041, 0x6387, 0x54c6, 0x591a, + 0x593a, 0x579b, 0x8eb2, 0x6735, 0x8dfa, 0x8235, 0x5241, 0x60f0, + 0x5815, 0x86fe, 0x5ce8, 0x9e45, 0x4fc4, 0x989d, 0x8bb9, 0x5a25, + 0x6076, 0x5384, 0x627c, 0x904f, 0x9102, 0x997f, 0x6069, 0x800c, + 0x513f, 0x8033, 0x5c14, 0x9975, 0x6d31, 0x4e8c, + /* 0xb7 */ + 0x7a1d, 0x7a1f, 0x7a21, 0x7a22, 0x7a24, 0x7a25, 0x7a26, 0x7a27, + 0x7a28, 0x7a29, 0x7a2a, 0x7a2b, 0x7a2c, 0x7a2d, 0x7a2e, 0x7a2f, + 0x7a30, 0x7a31, 0x7a32, 0x7a34, 0x7a35, 0x7a36, 0x7a38, 0x7a3a, + 0x7a3e, 0x7a40, 0x7a41, 0x7a42, 0x7a43, 0x7a44, 0x7a45, 0x7a47, + 0x7a48, 0x7a49, 0x7a4a, 0x7a4b, 0x7a4c, 0x7a4d, 0x7a4e, 0x7a4f, + 0x7a50, 0x7a52, 0x7a53, 0x7a54, 0x7a55, 0x7a56, 0x7a58, 0x7a59, + 0x7a5a, 0x7a5b, 0x7a5c, 0x7a5d, 0x7a5e, 0x7a5f, 0x7a60, 0x7a61, + 0x7a62, 0x7a63, 0x7a64, 0x7a65, 0x7a66, 0x7a67, 0x7a68, 0x7a69, + 0x7a6a, 0x7a6b, 0x7a6c, 0x7a6d, 0x7a6e, 0x7a6f, 0x7a71, 0x7a72, + 0x7a73, 0x7a75, 0x7a7b, 0x7a7c, 0x7a7d, 0x7a7e, 0x7a82, 0x7a85, + 0x7a87, 0x7a89, 0x7a8a, 0x7a8b, 0x7a8c, 0x7a8e, 0x7a8f, 0x7a90, + 0x7a93, 0x7a94, 0x7a99, 0x7a9a, 0x7a9b, 0x7a9e, 0x7aa1, 0x7aa2, + 0x8d30, 0x53d1, 0x7f5a, 0x7b4f, 0x4f10, 0x4e4f, 0x9600, 0x6cd5, + 0x73d0, 0x85e9, 0x5e06, 0x756a, 0x7ffb, 0x6a0a, 0x77fe, 0x9492, + 0x7e41, 0x51e1, 0x70e6, 0x53cd, 0x8fd4, 0x8303, 0x8d29, 0x72af, + 0x996d, 0x6cdb, 0x574a, 0x82b3, 0x65b9, 0x80aa, 0x623f, 0x9632, + 0x59a8, 0x4eff, 0x8bbf, 0x7eba, 0x653e, 0x83f2, 0x975e, 0x5561, + 0x98de, 0x80a5, 0x532a, 0x8bfd, 0x5420, 0x80ba, 0x5e9f, 0x6cb8, + 0x8d39, 0x82ac, 0x915a, 0x5429, 0x6c1b, 0x5206, 0x7eb7, 0x575f, + 0x711a, 0x6c7e, 0x7c89, 0x594b, 0x4efd, 0x5fff, 0x6124, 0x7caa, + 0x4e30, 0x5c01, 0x67ab, 0x8702, 0x5cf0, 0x950b, 0x98ce, 0x75af, + 0x70fd, 0x9022, 0x51af, 0x7f1d, 0x8bbd, 0x5949, 0x51e4, 0x4f5b, + 0x5426, 0x592b, 0x6577, 0x80a4, 0x5b75, 0x6276, 0x62c2, 0x8f90, + 0x5e45, 0x6c1f, 0x7b26, 0x4f0f, 0x4fd8, 0x670d, + /* 0xb8 */ + 0x7aa3, 0x7aa4, 0x7aa7, 0x7aa9, 0x7aaa, 0x7aab, 0x7aae, 0x7aaf, + 0x7ab0, 0x7ab1, 0x7ab2, 0x7ab4, 0x7ab5, 0x7ab6, 0x7ab7, 0x7ab8, + 0x7ab9, 0x7aba, 0x7abb, 0x7abc, 0x7abd, 0x7abe, 0x7ac0, 0x7ac1, + 0x7ac2, 0x7ac3, 0x7ac4, 0x7ac5, 0x7ac6, 0x7ac7, 0x7ac8, 0x7ac9, + 0x7aca, 0x7acc, 0x7acd, 0x7ace, 0x7acf, 0x7ad0, 0x7ad1, 0x7ad2, + 0x7ad3, 0x7ad4, 0x7ad5, 0x7ad7, 0x7ad8, 0x7ada, 0x7adb, 0x7adc, + 0x7add, 0x7ae1, 0x7ae2, 0x7ae4, 0x7ae7, 0x7ae8, 0x7ae9, 0x7aea, + 0x7aeb, 0x7aec, 0x7aee, 0x7af0, 0x7af1, 0x7af2, 0x7af3, 0x7af4, + 0x7af5, 0x7af6, 0x7af7, 0x7af8, 0x7afb, 0x7afc, 0x7afe, 0x7b00, + 0x7b01, 0x7b02, 0x7b05, 0x7b07, 0x7b09, 0x7b0c, 0x7b0d, 0x7b0e, + 0x7b10, 0x7b12, 0x7b13, 0x7b16, 0x7b17, 0x7b18, 0x7b1a, 0x7b1c, + 0x7b1d, 0x7b1f, 0x7b21, 0x7b22, 0x7b23, 0x7b27, 0x7b29, 0x7b2d, + 0x6d6e, 0x6daa, 0x798f, 0x88b1, 0x5f17, 0x752b, 0x629a, 0x8f85, + 0x4fef, 0x91dc, 0x65a7, 0x812f, 0x8151, 0x5e9c, 0x8150, 0x8d74, + 0x526f, 0x8986, 0x8d4b, 0x590d, 0x5085, 0x4ed8, 0x961c, 0x7236, + 0x8179, 0x8d1f, 0x5bcc, 0x8ba3, 0x9644, 0x5987, 0x7f1a, 0x5490, + 0x5676, 0x560e, 0x8be5, 0x6539, 0x6982, 0x9499, 0x76d6, 0x6e89, + 0x5e72, 0x7518, 0x6746, 0x67d1, 0x7aff, 0x809d, 0x8d76, 0x611f, + 0x79c6, 0x6562, 0x8d63, 0x5188, 0x521a, 0x94a2, 0x7f38, 0x809b, + 0x7eb2, 0x5c97, 0x6e2f, 0x6760, 0x7bd9, 0x768b, 0x9ad8, 0x818f, + 0x7f94, 0x7cd5, 0x641e, 0x9550, 0x7a3f, 0x544a, 0x54e5, 0x6b4c, + 0x6401, 0x6208, 0x9e3d, 0x80f3, 0x7599, 0x5272, 0x9769, 0x845b, + 0x683c, 0x86e4, 0x9601, 0x9694, 0x94ec, 0x4e2a, 0x5404, 0x7ed9, + 0x6839, 0x8ddf, 0x8015, 0x66f4, 0x5e9a, 0x7fb9, + /* 0xb9 */ + 0x7b2f, 0x7b30, 0x7b32, 0x7b34, 0x7b35, 0x7b36, 0x7b37, 0x7b39, + 0x7b3b, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b42, 0x7b43, 0x7b44, + 0x7b46, 0x7b48, 0x7b4a, 0x7b4d, 0x7b4e, 0x7b53, 0x7b55, 0x7b57, + 0x7b59, 0x7b5c, 0x7b5e, 0x7b5f, 0x7b61, 0x7b63, 0x7b64, 0x7b65, + 0x7b66, 0x7b67, 0x7b68, 0x7b69, 0x7b6a, 0x7b6b, 0x7b6c, 0x7b6d, + 0x7b6f, 0x7b70, 0x7b73, 0x7b74, 0x7b76, 0x7b78, 0x7b7a, 0x7b7c, + 0x7b7d, 0x7b7f, 0x7b81, 0x7b82, 0x7b83, 0x7b84, 0x7b86, 0x7b87, + 0x7b88, 0x7b89, 0x7b8a, 0x7b8b, 0x7b8c, 0x7b8e, 0x7b8f, 0x7b91, + 0x7b92, 0x7b93, 0x7b96, 0x7b98, 0x7b99, 0x7b9a, 0x7b9b, 0x7b9e, + 0x7b9f, 0x7ba0, 0x7ba3, 0x7ba4, 0x7ba5, 0x7bae, 0x7baf, 0x7bb0, + 0x7bb2, 0x7bb3, 0x7bb5, 0x7bb6, 0x7bb7, 0x7bb9, 0x7bba, 0x7bbb, + 0x7bbc, 0x7bbd, 0x7bbe, 0x7bbf, 0x7bc0, 0x7bc2, 0x7bc3, 0x7bc4, + 0x57c2, 0x803f, 0x6897, 0x5de5, 0x653b, 0x529f, 0x606d, 0x9f9a, + 0x4f9b, 0x8eac, 0x516c, 0x5bab, 0x5f13, 0x5de9, 0x6c5e, 0x62f1, + 0x8d21, 0x5171, 0x94a9, 0x52fe, 0x6c9f, 0x82df, 0x72d7, 0x57a2, + 0x6784, 0x8d2d, 0x591f, 0x8f9c, 0x83c7, 0x5495, 0x7b8d, 0x4f30, + 0x6cbd, 0x5b64, 0x59d1, 0x9f13, 0x53e4, 0x86ca, 0x9aa8, 0x8c37, + 0x80a1, 0x6545, 0x987e, 0x56fa, 0x96c7, 0x522e, 0x74dc, 0x5250, + 0x5be1, 0x6302, 0x8902, 0x4e56, 0x62d0, 0x602a, 0x68fa, 0x5173, + 0x5b98, 0x51a0, 0x89c2, 0x7ba1, 0x9986, 0x7f50, 0x60ef, 0x704c, + 0x8d2f, 0x5149, 0x5e7f, 0x901b, 0x7470, 0x89c4, 0x572d, 0x7845, + 0x5f52, 0x9f9f, 0x95fa, 0x8f68, 0x9b3c, 0x8be1, 0x7678, 0x6842, + 0x67dc, 0x8dea, 0x8d35, 0x523d, 0x8f8a, 0x6eda, 0x68cd, 0x9505, + 0x90ed, 0x56fd, 0x679c, 0x88f9, 0x8fc7, 0x54c8, + /* 0xba */ + 0x7bc5, 0x7bc8, 0x7bc9, 0x7bca, 0x7bcb, 0x7bcd, 0x7bce, 0x7bcf, + 0x7bd0, 0x7bd2, 0x7bd4, 0x7bd5, 0x7bd6, 0x7bd7, 0x7bd8, 0x7bdb, + 0x7bdc, 0x7bde, 0x7bdf, 0x7be0, 0x7be2, 0x7be3, 0x7be4, 0x7be7, + 0x7be8, 0x7be9, 0x7beb, 0x7bec, 0x7bed, 0x7bef, 0x7bf0, 0x7bf2, + 0x7bf3, 0x7bf4, 0x7bf5, 0x7bf6, 0x7bf8, 0x7bf9, 0x7bfa, 0x7bfb, + 0x7bfd, 0x7bff, 0x7c00, 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c05, + 0x7c06, 0x7c08, 0x7c09, 0x7c0a, 0x7c0d, 0x7c0e, 0x7c10, 0x7c11, + 0x7c12, 0x7c13, 0x7c14, 0x7c15, 0x7c17, 0x7c18, 0x7c19, 0x7c1a, + 0x7c1b, 0x7c1c, 0x7c1d, 0x7c1e, 0x7c20, 0x7c21, 0x7c22, 0x7c23, + 0x7c24, 0x7c25, 0x7c28, 0x7c29, 0x7c2b, 0x7c2c, 0x7c2d, 0x7c2e, + 0x7c2f, 0x7c30, 0x7c31, 0x7c32, 0x7c33, 0x7c34, 0x7c35, 0x7c36, + 0x7c37, 0x7c39, 0x7c3a, 0x7c3b, 0x7c3c, 0x7c3d, 0x7c3e, 0x7c42, + 0x9ab8, 0x5b69, 0x6d77, 0x6c26, 0x4ea5, 0x5bb3, 0x9a87, 0x9163, + 0x61a8, 0x90af, 0x97e9, 0x542b, 0x6db5, 0x5bd2, 0x51fd, 0x558a, + 0x7f55, 0x7ff0, 0x64bc, 0x634d, 0x65f1, 0x61be, 0x608d, 0x710a, + 0x6c57, 0x6c49, 0x592f, 0x676d, 0x822a, 0x58d5, 0x568e, 0x8c6a, + 0x6beb, 0x90dd, 0x597d, 0x8017, 0x53f7, 0x6d69, 0x5475, 0x559d, + 0x8377, 0x83cf, 0x6838, 0x79be, 0x548c, 0x4f55, 0x5408, 0x76d2, + 0x8c89, 0x9602, 0x6cb3, 0x6db8, 0x8d6b, 0x8910, 0x9e64, 0x8d3a, + 0x563f, 0x9ed1, 0x75d5, 0x5f88, 0x72e0, 0x6068, 0x54fc, 0x4ea8, + 0x6a2a, 0x8861, 0x6052, 0x8f70, 0x54c4, 0x70d8, 0x8679, 0x9e3f, + 0x6d2a, 0x5b8f, 0x5f18, 0x7ea2, 0x5589, 0x4faf, 0x7334, 0x543c, + 0x539a, 0x5019, 0x540e, 0x547c, 0x4e4e, 0x5ffd, 0x745a, 0x58f6, + 0x846b, 0x80e1, 0x8774, 0x72d0, 0x7cca, 0x6e56, + /* 0xbb */ + 0x7c43, 0x7c44, 0x7c45, 0x7c46, 0x7c47, 0x7c48, 0x7c49, 0x7c4a, + 0x7c4b, 0x7c4c, 0x7c4e, 0x7c4f, 0x7c50, 0x7c51, 0x7c52, 0x7c53, + 0x7c54, 0x7c55, 0x7c56, 0x7c57, 0x7c58, 0x7c59, 0x7c5a, 0x7c5b, + 0x7c5c, 0x7c5d, 0x7c5e, 0x7c5f, 0x7c60, 0x7c61, 0x7c62, 0x7c63, + 0x7c64, 0x7c65, 0x7c66, 0x7c67, 0x7c68, 0x7c69, 0x7c6a, 0x7c6b, + 0x7c6c, 0x7c6d, 0x7c6e, 0x7c6f, 0x7c70, 0x7c71, 0x7c72, 0x7c75, + 0x7c76, 0x7c77, 0x7c78, 0x7c79, 0x7c7a, 0x7c7e, 0x7c7f, 0x7c80, + 0x7c81, 0x7c82, 0x7c83, 0x7c84, 0x7c85, 0x7c86, 0x7c87, 0x7c88, + 0x7c8a, 0x7c8b, 0x7c8c, 0x7c8d, 0x7c8e, 0x7c8f, 0x7c90, 0x7c93, + 0x7c94, 0x7c96, 0x7c99, 0x7c9a, 0x7c9b, 0x7ca0, 0x7ca1, 0x7ca3, + 0x7ca6, 0x7ca7, 0x7ca8, 0x7ca9, 0x7cab, 0x7cac, 0x7cad, 0x7caf, + 0x7cb0, 0x7cb4, 0x7cb5, 0x7cb6, 0x7cb7, 0x7cb8, 0x7cba, 0x7cbb, + 0x5f27, 0x864e, 0x552c, 0x62a4, 0x4e92, 0x6caa, 0x6237, 0x82b1, + 0x54d7, 0x534e, 0x733e, 0x6ed1, 0x753b, 0x5212, 0x5316, 0x8bdd, + 0x69d0, 0x5f8a, 0x6000, 0x6dee, 0x574f, 0x6b22, 0x73af, 0x6853, + 0x8fd8, 0x7f13, 0x6362, 0x60a3, 0x5524, 0x75ea, 0x8c62, 0x7115, + 0x6da3, 0x5ba6, 0x5e7b, 0x8352, 0x614c, 0x9ec4, 0x78fa, 0x8757, + 0x7c27, 0x7687, 0x51f0, 0x60f6, 0x714c, 0x6643, 0x5e4c, 0x604d, + 0x8c0e, 0x7070, 0x6325, 0x8f89, 0x5fbd, 0x6062, 0x86d4, 0x56de, + 0x6bc1, 0x6094, 0x6167, 0x5349, 0x60e0, 0x6666, 0x8d3f, 0x79fd, + 0x4f1a, 0x70e9, 0x6c47, 0x8bb3, 0x8bf2, 0x7ed8, 0x8364, 0x660f, + 0x5a5a, 0x9b42, 0x6d51, 0x6df7, 0x8c41, 0x6d3b, 0x4f19, 0x706b, + 0x83b7, 0x6216, 0x60d1, 0x970d, 0x8d27, 0x7978, 0x51fb, 0x573e, + 0x57fa, 0x673a, 0x7578, 0x7a3d, 0x79ef, 0x7b95, + /* 0xbc */ + 0x7cbf, 0x7cc0, 0x7cc2, 0x7cc3, 0x7cc4, 0x7cc6, 0x7cc9, 0x7ccb, + 0x7cce, 0x7ccf, 0x7cd0, 0x7cd1, 0x7cd2, 0x7cd3, 0x7cd4, 0x7cd8, + 0x7cda, 0x7cdb, 0x7cdd, 0x7cde, 0x7ce1, 0x7ce2, 0x7ce3, 0x7ce4, + 0x7ce5, 0x7ce6, 0x7ce7, 0x7ce9, 0x7cea, 0x7ceb, 0x7cec, 0x7ced, + 0x7cee, 0x7cf0, 0x7cf1, 0x7cf2, 0x7cf3, 0x7cf4, 0x7cf5, 0x7cf6, + 0x7cf7, 0x7cf9, 0x7cfa, 0x7cfc, 0x7cfd, 0x7cfe, 0x7cff, 0x7d00, + 0x7d01, 0x7d02, 0x7d03, 0x7d04, 0x7d05, 0x7d06, 0x7d07, 0x7d08, + 0x7d09, 0x7d0b, 0x7d0c, 0x7d0d, 0x7d0e, 0x7d0f, 0x7d10, 0x7d11, + 0x7d12, 0x7d13, 0x7d14, 0x7d15, 0x7d16, 0x7d17, 0x7d18, 0x7d19, + 0x7d1a, 0x7d1b, 0x7d1c, 0x7d1d, 0x7d1e, 0x7d1f, 0x7d21, 0x7d23, + 0x7d24, 0x7d25, 0x7d26, 0x7d28, 0x7d29, 0x7d2a, 0x7d2c, 0x7d2d, + 0x7d2e, 0x7d30, 0x7d31, 0x7d32, 0x7d33, 0x7d34, 0x7d35, 0x7d36, + 0x808c, 0x9965, 0x8ff9, 0x6fc0, 0x8ba5, 0x9e21, 0x59ec, 0x7ee9, + 0x7f09, 0x5409, 0x6781, 0x68d8, 0x8f91, 0x7c4d, 0x96c6, 0x53ca, + 0x6025, 0x75be, 0x6c72, 0x5373, 0x5ac9, 0x7ea7, 0x6324, 0x51e0, + 0x810a, 0x5df1, 0x84df, 0x6280, 0x5180, 0x5b63, 0x4f0e, 0x796d, + 0x5242, 0x60b8, 0x6d4e, 0x5bc4, 0x5bc2, 0x8ba1, 0x8bb0, 0x65e2, + 0x5fcc, 0x9645, 0x5993, 0x7ee7, 0x7eaa, 0x5609, 0x67b7, 0x5939, + 0x4f73, 0x5bb6, 0x52a0, 0x835a, 0x988a, 0x8d3e, 0x7532, 0x94be, + 0x5047, 0x7a3c, 0x4ef7, 0x67b6, 0x9a7e, 0x5ac1, 0x6b7c, 0x76d1, + 0x575a, 0x5c16, 0x7b3a, 0x95f4, 0x714e, 0x517c, 0x80a9, 0x8270, + 0x5978, 0x7f04, 0x8327, 0x68c0, 0x67ec, 0x78b1, 0x7877, 0x62e3, + 0x6361, 0x7b80, 0x4fed, 0x526a, 0x51cf, 0x8350, 0x69db, 0x9274, + 0x8df5, 0x8d31, 0x89c1, 0x952e, 0x7bad, 0x4ef6, + /* 0xbd */ + 0x7d37, 0x7d38, 0x7d39, 0x7d3a, 0x7d3b, 0x7d3c, 0x7d3d, 0x7d3e, + 0x7d3f, 0x7d40, 0x7d41, 0x7d42, 0x7d43, 0x7d44, 0x7d45, 0x7d46, + 0x7d47, 0x7d48, 0x7d49, 0x7d4a, 0x7d4b, 0x7d4c, 0x7d4d, 0x7d4e, + 0x7d4f, 0x7d50, 0x7d51, 0x7d52, 0x7d53, 0x7d54, 0x7d55, 0x7d56, + 0x7d57, 0x7d58, 0x7d59, 0x7d5a, 0x7d5b, 0x7d5c, 0x7d5d, 0x7d5e, + 0x7d5f, 0x7d60, 0x7d61, 0x7d62, 0x7d63, 0x7d64, 0x7d65, 0x7d66, + 0x7d67, 0x7d68, 0x7d69, 0x7d6a, 0x7d6b, 0x7d6c, 0x7d6d, 0x7d6f, + 0x7d70, 0x7d71, 0x7d72, 0x7d73, 0x7d74, 0x7d75, 0x7d76, 0x7d78, + 0x7d79, 0x7d7a, 0x7d7b, 0x7d7c, 0x7d7d, 0x7d7e, 0x7d7f, 0x7d80, + 0x7d81, 0x7d82, 0x7d83, 0x7d84, 0x7d85, 0x7d86, 0x7d87, 0x7d88, + 0x7d89, 0x7d8a, 0x7d8b, 0x7d8c, 0x7d8d, 0x7d8e, 0x7d8f, 0x7d90, + 0x7d91, 0x7d92, 0x7d93, 0x7d94, 0x7d95, 0x7d96, 0x7d97, 0x7d98, + 0x5065, 0x8230, 0x5251, 0x996f, 0x6e10, 0x6e85, 0x6da7, 0x5efa, + 0x50f5, 0x59dc, 0x5c06, 0x6d46, 0x6c5f, 0x7586, 0x848b, 0x6868, + 0x5956, 0x8bb2, 0x5320, 0x9171, 0x964d, 0x8549, 0x6912, 0x7901, + 0x7126, 0x80f6, 0x4ea4, 0x90ca, 0x6d47, 0x9a84, 0x5a07, 0x56bc, + 0x6405, 0x94f0, 0x77eb, 0x4fa5, 0x811a, 0x72e1, 0x89d2, 0x997a, + 0x7f34, 0x7ede, 0x527f, 0x6559, 0x9175, 0x8f7f, 0x8f83, 0x53eb, + 0x7a96, 0x63ed, 0x63a5, 0x7686, 0x79f8, 0x8857, 0x9636, 0x622a, + 0x52ab, 0x8282, 0x6854, 0x6770, 0x6377, 0x776b, 0x7aed, 0x6d01, + 0x7ed3, 0x89e3, 0x59d0, 0x6212, 0x85c9, 0x82a5, 0x754c, 0x501f, + 0x4ecb, 0x75a5, 0x8beb, 0x5c4a, 0x5dfe, 0x7b4b, 0x65a4, 0x91d1, + 0x4eca, 0x6d25, 0x895f, 0x7d27, 0x9526, 0x4ec5, 0x8c28, 0x8fdb, + 0x9773, 0x664b, 0x7981, 0x8fd1, 0x70ec, 0x6d78, + /* 0xbe */ + 0x7d99, 0x7d9a, 0x7d9b, 0x7d9c, 0x7d9d, 0x7d9e, 0x7d9f, 0x7da0, + 0x7da1, 0x7da2, 0x7da3, 0x7da4, 0x7da5, 0x7da7, 0x7da8, 0x7da9, + 0x7daa, 0x7dab, 0x7dac, 0x7dad, 0x7daf, 0x7db0, 0x7db1, 0x7db2, + 0x7db3, 0x7db4, 0x7db5, 0x7db6, 0x7db7, 0x7db8, 0x7db9, 0x7dba, + 0x7dbb, 0x7dbc, 0x7dbd, 0x7dbe, 0x7dbf, 0x7dc0, 0x7dc1, 0x7dc2, + 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dc7, 0x7dc8, 0x7dc9, 0x7dca, + 0x7dcb, 0x7dcc, 0x7dcd, 0x7dce, 0x7dcf, 0x7dd0, 0x7dd1, 0x7dd2, + 0x7dd3, 0x7dd4, 0x7dd5, 0x7dd6, 0x7dd7, 0x7dd8, 0x7dd9, 0x7dda, + 0x7ddb, 0x7ddc, 0x7ddd, 0x7dde, 0x7ddf, 0x7de0, 0x7de1, 0x7de2, + 0x7de3, 0x7de4, 0x7de5, 0x7de6, 0x7de7, 0x7de8, 0x7de9, 0x7dea, + 0x7deb, 0x7dec, 0x7ded, 0x7dee, 0x7def, 0x7df0, 0x7df1, 0x7df2, + 0x7df3, 0x7df4, 0x7df5, 0x7df6, 0x7df7, 0x7df8, 0x7df9, 0x7dfa, + 0x5c3d, 0x52b2, 0x8346, 0x5162, 0x830e, 0x775b, 0x6676, 0x9cb8, + 0x4eac, 0x60ca, 0x7cbe, 0x7cb3, 0x7ecf, 0x4e95, 0x8b66, 0x666f, + 0x9888, 0x9759, 0x5883, 0x656c, 0x955c, 0x5f84, 0x75c9, 0x9756, + 0x7adf, 0x7ade, 0x51c0, 0x70af, 0x7a98, 0x63ea, 0x7a76, 0x7ea0, + 0x7396, 0x97ed, 0x4e45, 0x7078, 0x4e5d, 0x9152, 0x53a9, 0x6551, + 0x65e7, 0x81fc, 0x8205, 0x548e, 0x5c31, 0x759a, 0x97a0, 0x62d8, + 0x72d9, 0x75bd, 0x5c45, 0x9a79, 0x83ca, 0x5c40, 0x5480, 0x77e9, + 0x4e3e, 0x6cae, 0x805a, 0x62d2, 0x636e, 0x5de8, 0x5177, 0x8ddd, + 0x8e1e, 0x952f, 0x4ff1, 0x53e5, 0x60e7, 0x70ac, 0x5267, 0x6350, + 0x9e43, 0x5a1f, 0x5026, 0x7737, 0x5377, 0x7ee2, 0x6485, 0x652b, + 0x6289, 0x6398, 0x5014, 0x7235, 0x89c9, 0x51b3, 0x8bc0, 0x7edd, + 0x5747, 0x83cc, 0x94a7, 0x519b, 0x541b, 0x5cfb, + /* 0xbf */ + 0x7dfb, 0x7dfc, 0x7dfd, 0x7dfe, 0x7dff, 0x7e00, 0x7e01, 0x7e02, + 0x7e03, 0x7e04, 0x7e05, 0x7e06, 0x7e07, 0x7e08, 0x7e09, 0x7e0a, + 0x7e0b, 0x7e0c, 0x7e0d, 0x7e0e, 0x7e0f, 0x7e10, 0x7e11, 0x7e12, + 0x7e13, 0x7e14, 0x7e15, 0x7e16, 0x7e17, 0x7e18, 0x7e19, 0x7e1a, + 0x7e1b, 0x7e1c, 0x7e1d, 0x7e1e, 0x7e1f, 0x7e20, 0x7e21, 0x7e22, + 0x7e23, 0x7e24, 0x7e25, 0x7e26, 0x7e27, 0x7e28, 0x7e29, 0x7e2a, + 0x7e2b, 0x7e2c, 0x7e2d, 0x7e2e, 0x7e2f, 0x7e30, 0x7e31, 0x7e32, + 0x7e33, 0x7e34, 0x7e35, 0x7e36, 0x7e37, 0x7e38, 0x7e39, 0x7e3a, + 0x7e3c, 0x7e3d, 0x7e3e, 0x7e3f, 0x7e40, 0x7e42, 0x7e43, 0x7e44, + 0x7e45, 0x7e46, 0x7e48, 0x7e49, 0x7e4a, 0x7e4b, 0x7e4c, 0x7e4d, + 0x7e4e, 0x7e4f, 0x7e50, 0x7e51, 0x7e52, 0x7e53, 0x7e54, 0x7e55, + 0x7e56, 0x7e57, 0x7e58, 0x7e59, 0x7e5a, 0x7e5b, 0x7e5c, 0x7e5d, + 0x4fca, 0x7ae3, 0x6d5a, 0x90e1, 0x9a8f, 0x5580, 0x5496, 0x5361, + 0x54af, 0x5f00, 0x63e9, 0x6977, 0x51ef, 0x6168, 0x520a, 0x582a, + 0x52d8, 0x574e, 0x780d, 0x770b, 0x5eb7, 0x6177, 0x7ce0, 0x625b, + 0x6297, 0x4ea2, 0x7095, 0x8003, 0x62f7, 0x70e4, 0x9760, 0x5777, + 0x82db, 0x67ef, 0x68f5, 0x78d5, 0x9897, 0x79d1, 0x58f3, 0x54b3, + 0x53ef, 0x6e34, 0x514b, 0x523b, 0x5ba2, 0x8bfe, 0x80af, 0x5543, + 0x57a6, 0x6073, 0x5751, 0x542d, 0x7a7a, 0x6050, 0x5b54, 0x63a7, + 0x62a0, 0x53e3, 0x6263, 0x5bc7, 0x67af, 0x54ed, 0x7a9f, 0x82e6, + 0x9177, 0x5e93, 0x88e4, 0x5938, 0x57ae, 0x630e, 0x8de8, 0x80ef, + 0x5757, 0x7b77, 0x4fa9, 0x5feb, 0x5bbd, 0x6b3e, 0x5321, 0x7b50, + 0x72c2, 0x6846, 0x77ff, 0x7736, 0x65f7, 0x51b5, 0x4e8f, 0x76d4, + 0x5cbf, 0x7aa5, 0x8475, 0x594e, 0x9b41, 0x5080, + /* 0xc0 */ + 0x7e5e, 0x7e5f, 0x7e60, 0x7e61, 0x7e62, 0x7e63, 0x7e64, 0x7e65, + 0x7e66, 0x7e67, 0x7e68, 0x7e69, 0x7e6a, 0x7e6b, 0x7e6c, 0x7e6d, + 0x7e6e, 0x7e6f, 0x7e70, 0x7e71, 0x7e72, 0x7e73, 0x7e74, 0x7e75, + 0x7e76, 0x7e77, 0x7e78, 0x7e79, 0x7e7a, 0x7e7b, 0x7e7c, 0x7e7d, + 0x7e7e, 0x7e7f, 0x7e80, 0x7e81, 0x7e83, 0x7e84, 0x7e85, 0x7e86, + 0x7e87, 0x7e88, 0x7e89, 0x7e8a, 0x7e8b, 0x7e8c, 0x7e8d, 0x7e8e, + 0x7e8f, 0x7e90, 0x7e91, 0x7e92, 0x7e93, 0x7e94, 0x7e95, 0x7e96, + 0x7e97, 0x7e98, 0x7e99, 0x7e9a, 0x7e9c, 0x7e9d, 0x7e9e, 0x7eae, + 0x7eb4, 0x7ebb, 0x7ebc, 0x7ed6, 0x7ee4, 0x7eec, 0x7ef9, 0x7f0a, + 0x7f10, 0x7f1e, 0x7f37, 0x7f39, 0x7f3b, 0x7f3c, 0x7f3d, 0x7f3e, + 0x7f3f, 0x7f40, 0x7f41, 0x7f43, 0x7f46, 0x7f47, 0x7f48, 0x7f49, + 0x7f4a, 0x7f4b, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f4f, 0x7f52, 0x7f53, + 0x9988, 0x6127, 0x6e83, 0x5764, 0x6606, 0x6346, 0x56f0, 0x62ec, + 0x6269, 0x5ed3, 0x9614, 0x5783, 0x62c9, 0x5587, 0x8721, 0x814a, + 0x8fa3, 0x5566, 0x83b1, 0x6765, 0x8d56, 0x84dd, 0x5a6a, 0x680f, + 0x62e6, 0x7bee, 0x9611, 0x5170, 0x6f9c, 0x8c30, 0x63fd, 0x89c8, + 0x61d2, 0x7f06, 0x70c2, 0x6ee5, 0x7405, 0x6994, 0x72fc, 0x5eca, + 0x90ce, 0x6717, 0x6d6a, 0x635e, 0x52b3, 0x7262, 0x8001, 0x4f6c, + 0x59e5, 0x916a, 0x70d9, 0x6d9d, 0x52d2, 0x4e50, 0x96f7, 0x956d, + 0x857e, 0x78ca, 0x7d2f, 0x5121, 0x5792, 0x64c2, 0x808b, 0x7c7b, + 0x6cea, 0x68f1, 0x695e, 0x51b7, 0x5398, 0x68a8, 0x7281, 0x9ece, + 0x7bf1, 0x72f8, 0x79bb, 0x6f13, 0x7406, 0x674e, 0x91cc, 0x9ca4, + 0x793c, 0x8389, 0x8354, 0x540f, 0x6817, 0x4e3d, 0x5389, 0x52b1, + 0x783e, 0x5386, 0x5229, 0x5088, 0x4f8b, 0x4fd0, + /* 0xc1 */ + 0x7f56, 0x7f59, 0x7f5b, 0x7f5c, 0x7f5d, 0x7f5e, 0x7f60, 0x7f63, + 0x7f64, 0x7f65, 0x7f66, 0x7f67, 0x7f6b, 0x7f6c, 0x7f6d, 0x7f6f, + 0x7f70, 0x7f73, 0x7f75, 0x7f76, 0x7f77, 0x7f78, 0x7f7a, 0x7f7b, + 0x7f7c, 0x7f7d, 0x7f7f, 0x7f80, 0x7f82, 0x7f83, 0x7f84, 0x7f85, + 0x7f86, 0x7f87, 0x7f88, 0x7f89, 0x7f8b, 0x7f8d, 0x7f8f, 0x7f90, + 0x7f91, 0x7f92, 0x7f93, 0x7f95, 0x7f96, 0x7f97, 0x7f98, 0x7f99, + 0x7f9b, 0x7f9c, 0x7fa0, 0x7fa2, 0x7fa3, 0x7fa5, 0x7fa6, 0x7fa8, + 0x7fa9, 0x7faa, 0x7fab, 0x7fac, 0x7fad, 0x7fae, 0x7fb1, 0x7fb3, + 0x7fb4, 0x7fb5, 0x7fb6, 0x7fb7, 0x7fba, 0x7fbb, 0x7fbe, 0x7fc0, + 0x7fc2, 0x7fc3, 0x7fc4, 0x7fc6, 0x7fc7, 0x7fc8, 0x7fc9, 0x7fcb, + 0x7fcd, 0x7fcf, 0x7fd0, 0x7fd1, 0x7fd2, 0x7fd3, 0x7fd6, 0x7fd7, + 0x7fd9, 0x7fda, 0x7fdb, 0x7fdc, 0x7fdd, 0x7fde, 0x7fe2, 0x7fe3, + 0x75e2, 0x7acb, 0x7c92, 0x6ca5, 0x96b6, 0x529b, 0x7483, 0x54e9, + 0x4fe9, 0x8054, 0x83b2, 0x8fde, 0x9570, 0x5ec9, 0x601c, 0x6d9f, + 0x5e18, 0x655b, 0x8138, 0x94fe, 0x604b, 0x70bc, 0x7ec3, 0x7cae, + 0x51c9, 0x6881, 0x7cb1, 0x826f, 0x4e24, 0x8f86, 0x91cf, 0x667e, + 0x4eae, 0x8c05, 0x64a9, 0x804a, 0x50da, 0x7597, 0x71ce, 0x5be5, + 0x8fbd, 0x6f66, 0x4e86, 0x6482, 0x9563, 0x5ed6, 0x6599, 0x5217, + 0x88c2, 0x70c8, 0x52a3, 0x730e, 0x7433, 0x6797, 0x78f7, 0x9716, + 0x4e34, 0x90bb, 0x9cde, 0x6dcb, 0x51db, 0x8d41, 0x541d, 0x62ce, + 0x73b2, 0x83f1, 0x96f6, 0x9f84, 0x94c3, 0x4f36, 0x7f9a, 0x51cc, + 0x7075, 0x9675, 0x5cad, 0x9886, 0x53e6, 0x4ee4, 0x6e9c, 0x7409, + 0x69b4, 0x786b, 0x998f, 0x7559, 0x5218, 0x7624, 0x6d41, 0x67f3, + 0x516d, 0x9f99, 0x804b, 0x5499, 0x7b3c, 0x7abf, + /* 0xc2 */ + 0x7fe4, 0x7fe7, 0x7fe8, 0x7fea, 0x7feb, 0x7fec, 0x7fed, 0x7fef, + 0x7ff2, 0x7ff4, 0x7ff5, 0x7ff6, 0x7ff7, 0x7ff8, 0x7ff9, 0x7ffa, + 0x7ffd, 0x7ffe, 0x7fff, 0x8002, 0x8007, 0x8008, 0x8009, 0x800a, + 0x800e, 0x800f, 0x8011, 0x8013, 0x801a, 0x801b, 0x801d, 0x801e, + 0x801f, 0x8021, 0x8023, 0x8024, 0x802b, 0x802c, 0x802d, 0x802e, + 0x802f, 0x8030, 0x8032, 0x8034, 0x8039, 0x803a, 0x803c, 0x803e, + 0x8040, 0x8041, 0x8044, 0x8045, 0x8047, 0x8048, 0x8049, 0x804e, + 0x804f, 0x8050, 0x8051, 0x8053, 0x8055, 0x8056, 0x8057, 0x8059, + 0x805b, 0x805c, 0x805d, 0x805e, 0x805f, 0x8060, 0x8061, 0x8062, + 0x8063, 0x8064, 0x8065, 0x8066, 0x8067, 0x8068, 0x806b, 0x806c, + 0x806d, 0x806e, 0x806f, 0x8070, 0x8072, 0x8073, 0x8074, 0x8075, + 0x8076, 0x8077, 0x8078, 0x8079, 0x807a, 0x807b, 0x807c, 0x807d, + 0x9686, 0x5784, 0x62e2, 0x9647, 0x697c, 0x5a04, 0x6402, 0x7bd3, + 0x6f0f, 0x964b, 0x82a6, 0x5362, 0x9885, 0x5e90, 0x7089, 0x63b3, + 0x5364, 0x864f, 0x9c81, 0x9e93, 0x788c, 0x9732, 0x8def, 0x8d42, + 0x9e7f, 0x6f5e, 0x7984, 0x5f55, 0x9646, 0x622e, 0x9a74, 0x5415, + 0x94dd, 0x4fa3, 0x65c5, 0x5c65, 0x5c61, 0x7f15, 0x8651, 0x6c2f, + 0x5f8b, 0x7387, 0x6ee4, 0x7eff, 0x5ce6, 0x631b, 0x5b6a, 0x6ee6, + 0x5375, 0x4e71, 0x63a0, 0x7565, 0x62a1, 0x8f6e, 0x4f26, 0x4ed1, + 0x6ca6, 0x7eb6, 0x8bba, 0x841d, 0x87ba, 0x7f57, 0x903b, 0x9523, + 0x7ba9, 0x9aa1, 0x88f8, 0x843d, 0x6d1b, 0x9a86, 0x7edc, 0x5988, + 0x9ebb, 0x739b, 0x7801, 0x8682, 0x9a6c, 0x9a82, 0x561b, 0x5417, + 0x57cb, 0x4e70, 0x9ea6, 0x5356, 0x8fc8, 0x8109, 0x7792, 0x9992, + 0x86ee, 0x6ee1, 0x8513, 0x66fc, 0x6162, 0x6f2b, + /* 0xc3 */ + 0x807e, 0x8081, 0x8082, 0x8085, 0x8088, 0x808a, 0x808d, 0x808e, + 0x808f, 0x8090, 0x8091, 0x8092, 0x8094, 0x8095, 0x8097, 0x8099, + 0x809e, 0x80a3, 0x80a6, 0x80a7, 0x80a8, 0x80ac, 0x80b0, 0x80b3, + 0x80b5, 0x80b6, 0x80b8, 0x80b9, 0x80bb, 0x80c5, 0x80c7, 0x80c8, + 0x80c9, 0x80ca, 0x80cb, 0x80cf, 0x80d0, 0x80d1, 0x80d2, 0x80d3, + 0x80d4, 0x80d5, 0x80d8, 0x80df, 0x80e0, 0x80e2, 0x80e3, 0x80e6, + 0x80ee, 0x80f5, 0x80f7, 0x80f9, 0x80fb, 0x80fe, 0x80ff, 0x8100, + 0x8101, 0x8103, 0x8104, 0x8105, 0x8107, 0x8108, 0x810b, 0x810c, + 0x8115, 0x8117, 0x8119, 0x811b, 0x811c, 0x811d, 0x811f, 0x8120, + 0x8121, 0x8122, 0x8123, 0x8124, 0x8125, 0x8126, 0x8127, 0x8128, + 0x8129, 0x812a, 0x812b, 0x812d, 0x812e, 0x8130, 0x8133, 0x8134, + 0x8135, 0x8137, 0x8139, 0x813a, 0x813b, 0x813c, 0x813d, 0x813f, + 0x8c29, 0x8292, 0x832b, 0x76f2, 0x6c13, 0x5fd9, 0x83bd, 0x732b, + 0x8305, 0x951a, 0x6bdb, 0x77db, 0x94c6, 0x536f, 0x8302, 0x5192, + 0x5e3d, 0x8c8c, 0x8d38, 0x4e48, 0x73ab, 0x679a, 0x6885, 0x9176, + 0x9709, 0x7164, 0x6ca1, 0x7709, 0x5a92, 0x9541, 0x6bcf, 0x7f8e, + 0x6627, 0x5bd0, 0x59b9, 0x5a9a, 0x95e8, 0x95f7, 0x4eec, 0x840c, + 0x8499, 0x6aac, 0x76df, 0x9530, 0x731b, 0x68a6, 0x5b5f, 0x772f, + 0x919a, 0x9761, 0x7cdc, 0x8ff7, 0x8c1c, 0x5f25, 0x7c73, 0x79d8, + 0x89c5, 0x6ccc, 0x871c, 0x5bc6, 0x5e42, 0x68c9, 0x7720, 0x7ef5, + 0x5195, 0x514d, 0x52c9, 0x5a29, 0x7f05, 0x9762, 0x82d7, 0x63cf, + 0x7784, 0x85d0, 0x79d2, 0x6e3a, 0x5e99, 0x5999, 0x8511, 0x706d, + 0x6c11, 0x62bf, 0x76bf, 0x654f, 0x60af, 0x95fd, 0x660e, 0x879f, + 0x9e23, 0x94ed, 0x540d, 0x547d, 0x8c2c, 0x6478, + /* 0xc4 */ + 0x8140, 0x8141, 0x8142, 0x8143, 0x8144, 0x8145, 0x8147, 0x8149, + 0x814d, 0x814e, 0x814f, 0x8152, 0x8156, 0x8157, 0x8158, 0x815b, + 0x815c, 0x815d, 0x815e, 0x815f, 0x8161, 0x8162, 0x8163, 0x8164, + 0x8166, 0x8168, 0x816a, 0x816b, 0x816c, 0x816f, 0x8172, 0x8173, + 0x8175, 0x8176, 0x8177, 0x8178, 0x8181, 0x8183, 0x8184, 0x8185, + 0x8186, 0x8187, 0x8189, 0x818b, 0x818c, 0x818d, 0x818e, 0x8190, + 0x8192, 0x8193, 0x8194, 0x8195, 0x8196, 0x8197, 0x8199, 0x819a, + 0x819e, 0x819f, 0x81a0, 0x81a1, 0x81a2, 0x81a4, 0x81a5, 0x81a7, + 0x81a9, 0x81ab, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, + 0x81b2, 0x81b4, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0x81bc, + 0x81bd, 0x81be, 0x81bf, 0x81c4, 0x81c5, 0x81c7, 0x81c8, 0x81c9, + 0x81cb, 0x81cd, 0x81ce, 0x81cf, 0x81d0, 0x81d1, 0x81d2, 0x81d3, + 0x6479, 0x8611, 0x6a21, 0x819c, 0x78e8, 0x6469, 0x9b54, 0x62b9, + 0x672b, 0x83ab, 0x58a8, 0x9ed8, 0x6cab, 0x6f20, 0x5bde, 0x964c, + 0x8c0b, 0x725f, 0x67d0, 0x62c7, 0x7261, 0x4ea9, 0x59c6, 0x6bcd, + 0x5893, 0x66ae, 0x5e55, 0x52df, 0x6155, 0x6728, 0x76ee, 0x7766, + 0x7267, 0x7a46, 0x62ff, 0x54ea, 0x5450, 0x94a0, 0x90a3, 0x5a1c, + 0x7eb3, 0x6c16, 0x4e43, 0x5976, 0x8010, 0x5948, 0x5357, 0x7537, + 0x96be, 0x56ca, 0x6320, 0x8111, 0x607c, 0x95f9, 0x6dd6, 0x5462, + 0x9981, 0x5185, 0x5ae9, 0x80fd, 0x59ae, 0x9713, 0x502a, 0x6ce5, + 0x5c3c, 0x62df, 0x4f60, 0x533f, 0x817b, 0x9006, 0x6eba, 0x852b, + 0x62c8, 0x5e74, 0x78be, 0x64b5, 0x637b, 0x5ff5, 0x5a18, 0x917f, + 0x9e1f, 0x5c3f, 0x634f, 0x8042, 0x5b7d, 0x556e, 0x954a, 0x954d, + 0x6d85, 0x60a8, 0x67e0, 0x72de, 0x51dd, 0x5b81, + /* 0xc5 */ + 0x81d4, 0x81d5, 0x81d6, 0x81d7, 0x81d8, 0x81d9, 0x81da, 0x81db, + 0x81dc, 0x81dd, 0x81de, 0x81df, 0x81e0, 0x81e1, 0x81e2, 0x81e4, + 0x81e5, 0x81e6, 0x81e8, 0x81e9, 0x81eb, 0x81ee, 0x81ef, 0x81f0, + 0x81f1, 0x81f2, 0x81f5, 0x81f6, 0x81f7, 0x81f8, 0x81f9, 0x81fa, + 0x81fd, 0x81ff, 0x8203, 0x8207, 0x8208, 0x8209, 0x820a, 0x820b, + 0x820e, 0x820f, 0x8211, 0x8213, 0x8215, 0x8216, 0x8217, 0x8218, + 0x8219, 0x821a, 0x821d, 0x8220, 0x8224, 0x8225, 0x8226, 0x8227, + 0x8229, 0x822e, 0x8232, 0x823a, 0x823c, 0x823d, 0x823f, 0x8240, + 0x8241, 0x8242, 0x8243, 0x8245, 0x8246, 0x8248, 0x824a, 0x824c, + 0x824d, 0x824e, 0x8250, 0x8251, 0x8252, 0x8253, 0x8254, 0x8255, + 0x8256, 0x8257, 0x8259, 0x825b, 0x825c, 0x825d, 0x825e, 0x8260, + 0x8261, 0x8262, 0x8263, 0x8264, 0x8265, 0x8266, 0x8267, 0x8269, + 0x62e7, 0x6cde, 0x725b, 0x626d, 0x94ae, 0x7ebd, 0x8113, 0x6d53, + 0x519c, 0x5f04, 0x5974, 0x52aa, 0x6012, 0x5973, 0x6696, 0x8650, + 0x759f, 0x632a, 0x61e6, 0x7cef, 0x8bfa, 0x54e6, 0x6b27, 0x9e25, + 0x6bb4, 0x85d5, 0x5455, 0x5076, 0x6ca4, 0x556a, 0x8db4, 0x722c, + 0x5e15, 0x6015, 0x7436, 0x62cd, 0x6392, 0x724c, 0x5f98, 0x6e43, + 0x6d3e, 0x6500, 0x6f58, 0x76d8, 0x78d0, 0x76fc, 0x7554, 0x5224, + 0x53db, 0x4e53, 0x5e9e, 0x65c1, 0x802a, 0x80d6, 0x629b, 0x5486, + 0x5228, 0x70ae, 0x888d, 0x8dd1, 0x6ce1, 0x5478, 0x80da, 0x57f9, + 0x88f4, 0x8d54, 0x966a, 0x914d, 0x4f69, 0x6c9b, 0x55b7, 0x76c6, + 0x7830, 0x62a8, 0x70f9, 0x6f8e, 0x5f6d, 0x84ec, 0x68da, 0x787c, + 0x7bf7, 0x81a8, 0x670b, 0x9e4f, 0x6367, 0x78b0, 0x576f, 0x7812, + 0x9739, 0x6279, 0x62ab, 0x5288, 0x7435, 0x6bd7, + /* 0xc6 */ + 0x826a, 0x826b, 0x826c, 0x826d, 0x8271, 0x8275, 0x8276, 0x8277, + 0x8278, 0x827b, 0x827c, 0x8280, 0x8281, 0x8283, 0x8285, 0x8286, + 0x8287, 0x8289, 0x828c, 0x8290, 0x8293, 0x8294, 0x8295, 0x8296, + 0x829a, 0x829b, 0x829e, 0x82a0, 0x82a2, 0x82a3, 0x82a7, 0x82b2, + 0x82b5, 0x82b6, 0x82ba, 0x82bb, 0x82bc, 0x82bf, 0x82c0, 0x82c2, + 0x82c3, 0x82c5, 0x82c6, 0x82c9, 0x82d0, 0x82d6, 0x82d9, 0x82da, + 0x82dd, 0x82e2, 0x82e7, 0x82e8, 0x82e9, 0x82ea, 0x82ec, 0x82ed, + 0x82ee, 0x82f0, 0x82f2, 0x82f3, 0x82f5, 0x82f6, 0x82f8, 0x82fa, + 0x82fc, 0x82fd, 0x82fe, 0x82ff, 0x8300, 0x830a, 0x830b, 0x830d, + 0x8310, 0x8312, 0x8313, 0x8316, 0x8318, 0x8319, 0x831d, 0x831e, + 0x831f, 0x8320, 0x8321, 0x8322, 0x8323, 0x8324, 0x8325, 0x8326, + 0x8329, 0x832a, 0x832e, 0x8330, 0x8332, 0x8337, 0x833b, 0x833d, + 0x5564, 0x813e, 0x75b2, 0x76ae, 0x5339, 0x75de, 0x50fb, 0x5c41, + 0x8b6c, 0x7bc7, 0x504f, 0x7247, 0x9a97, 0x98d8, 0x6f02, 0x74e2, + 0x7968, 0x6487, 0x77a5, 0x62fc, 0x9891, 0x8d2b, 0x54c1, 0x8058, + 0x4e52, 0x576a, 0x82f9, 0x840d, 0x5e73, 0x51ed, 0x74f6, 0x8bc4, + 0x5c4f, 0x5761, 0x6cfc, 0x9887, 0x5a46, 0x7834, 0x9b44, 0x8feb, + 0x7c95, 0x5256, 0x6251, 0x94fa, 0x4ec6, 0x8386, 0x8461, 0x83e9, + 0x84b2, 0x57d4, 0x6734, 0x5703, 0x666e, 0x6d66, 0x8c31, 0x66dd, + 0x7011, 0x671f, 0x6b3a, 0x6816, 0x621a, 0x59bb, 0x4e03, 0x51c4, + 0x6f06, 0x67d2, 0x6c8f, 0x5176, 0x68cb, 0x5947, 0x6b67, 0x7566, + 0x5d0e, 0x8110, 0x9f50, 0x65d7, 0x7948, 0x7941, 0x9a91, 0x8d77, + 0x5c82, 0x4e5e, 0x4f01, 0x542f, 0x5951, 0x780c, 0x5668, 0x6c14, + 0x8fc4, 0x5f03, 0x6c7d, 0x6ce3, 0x8bab, 0x6390, + /* 0xc7 */ + 0x833e, 0x833f, 0x8341, 0x8342, 0x8344, 0x8345, 0x8348, 0x834a, + 0x834b, 0x834c, 0x834d, 0x834e, 0x8353, 0x8355, 0x8356, 0x8357, + 0x8358, 0x8359, 0x835d, 0x8362, 0x8370, 0x8371, 0x8372, 0x8373, + 0x8374, 0x8375, 0x8376, 0x8379, 0x837a, 0x837e, 0x837f, 0x8380, + 0x8381, 0x8382, 0x8383, 0x8384, 0x8387, 0x8388, 0x838a, 0x838b, + 0x838c, 0x838d, 0x838f, 0x8390, 0x8391, 0x8394, 0x8395, 0x8396, + 0x8397, 0x8399, 0x839a, 0x839d, 0x839f, 0x83a1, 0x83a2, 0x83a3, + 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83ac, 0x83ad, 0x83ae, 0x83af, + 0x83b5, 0x83bb, 0x83be, 0x83bf, 0x83c2, 0x83c3, 0x83c4, 0x83c6, + 0x83c8, 0x83c9, 0x83cb, 0x83cd, 0x83ce, 0x83d0, 0x83d1, 0x83d2, + 0x83d3, 0x83d5, 0x83d7, 0x83d9, 0x83da, 0x83db, 0x83de, 0x83e2, + 0x83e3, 0x83e4, 0x83e6, 0x83e7, 0x83e8, 0x83eb, 0x83ec, 0x83ed, + 0x6070, 0x6d3d, 0x7275, 0x6266, 0x948e, 0x94c5, 0x5343, 0x8fc1, + 0x7b7e, 0x4edf, 0x8c26, 0x4e7e, 0x9ed4, 0x94b1, 0x94b3, 0x524d, + 0x6f5c, 0x9063, 0x6d45, 0x8c34, 0x5811, 0x5d4c, 0x6b20, 0x6b49, + 0x67aa, 0x545b, 0x8154, 0x7f8c, 0x5899, 0x8537, 0x5f3a, 0x62a2, + 0x6a47, 0x9539, 0x6572, 0x6084, 0x6865, 0x77a7, 0x4e54, 0x4fa8, + 0x5de7, 0x9798, 0x64ac, 0x7fd8, 0x5ced, 0x4fcf, 0x7a8d, 0x5207, + 0x8304, 0x4e14, 0x602f, 0x7a83, 0x94a6, 0x4fb5, 0x4eb2, 0x79e6, + 0x7434, 0x52e4, 0x82b9, 0x64d2, 0x79bd, 0x5bdd, 0x6c81, 0x9752, + 0x8f7b, 0x6c22, 0x503e, 0x537f, 0x6e05, 0x64ce, 0x6674, 0x6c30, + 0x60c5, 0x9877, 0x8bf7, 0x5e86, 0x743c, 0x7a77, 0x79cb, 0x4e18, + 0x90b1, 0x7403, 0x6c42, 0x56da, 0x914b, 0x6cc5, 0x8d8b, 0x533a, + 0x86c6, 0x66f2, 0x8eaf, 0x5c48, 0x9a71, 0x6e20, + /* 0xc8 */ + 0x83ee, 0x83ef, 0x83f3, 0x83f4, 0x83f5, 0x83f6, 0x83f7, 0x83fa, + 0x83fb, 0x83fc, 0x83fe, 0x83ff, 0x8400, 0x8402, 0x8405, 0x8407, + 0x8408, 0x8409, 0x840a, 0x8410, 0x8412, 0x8413, 0x8414, 0x8415, + 0x8416, 0x8417, 0x8419, 0x841a, 0x841b, 0x841e, 0x841f, 0x8420, + 0x8421, 0x8422, 0x8423, 0x8429, 0x842a, 0x842b, 0x842c, 0x842d, + 0x842e, 0x842f, 0x8430, 0x8432, 0x8433, 0x8434, 0x8435, 0x8436, + 0x8437, 0x8439, 0x843a, 0x843b, 0x843e, 0x843f, 0x8440, 0x8441, + 0x8442, 0x8443, 0x8444, 0x8445, 0x8447, 0x8448, 0x8449, 0x844a, + 0x844b, 0x844c, 0x844d, 0x844e, 0x844f, 0x8450, 0x8452, 0x8453, + 0x8454, 0x8455, 0x8456, 0x8458, 0x845d, 0x845e, 0x845f, 0x8460, + 0x8462, 0x8464, 0x8465, 0x8466, 0x8467, 0x8468, 0x846a, 0x846e, + 0x846f, 0x8470, 0x8472, 0x8474, 0x8477, 0x8479, 0x847b, 0x847c, + 0x53d6, 0x5a36, 0x9f8b, 0x8da3, 0x53bb, 0x5708, 0x98a7, 0x6743, + 0x919b, 0x6cc9, 0x5168, 0x75ca, 0x62f3, 0x72ac, 0x5238, 0x529d, + 0x7f3a, 0x7094, 0x7638, 0x5374, 0x9e4a, 0x69b7, 0x786e, 0x96c0, + 0x88d9, 0x7fa4, 0x7136, 0x71c3, 0x5189, 0x67d3, 0x74e4, 0x58e4, + 0x6518, 0x56b7, 0x8ba9, 0x9976, 0x6270, 0x7ed5, 0x60f9, 0x70ed, + 0x58ec, 0x4ec1, 0x4eba, 0x5fcd, 0x97e7, 0x4efb, 0x8ba4, 0x5203, + 0x598a, 0x7eab, 0x6254, 0x4ecd, 0x65e5, 0x620e, 0x8338, 0x84c9, + 0x8363, 0x878d, 0x7194, 0x6eb6, 0x5bb9, 0x7ed2, 0x5197, 0x63c9, + 0x67d4, 0x8089, 0x8339, 0x8815, 0x5112, 0x5b7a, 0x5982, 0x8fb1, + 0x4e73, 0x6c5d, 0x5165, 0x8925, 0x8f6f, 0x962e, 0x854a, 0x745e, + 0x9510, 0x95f0, 0x6da6, 0x82e5, 0x5f31, 0x6492, 0x6d12, 0x8428, + 0x816e, 0x9cc3, 0x585e, 0x8d5b, 0x4e09, 0x53c1, + /* 0xc9 */ + 0x847d, 0x847e, 0x847f, 0x8480, 0x8481, 0x8483, 0x8484, 0x8485, + 0x8486, 0x848a, 0x848d, 0x848f, 0x8490, 0x8491, 0x8492, 0x8493, + 0x8494, 0x8495, 0x8496, 0x8498, 0x849a, 0x849b, 0x849d, 0x849e, + 0x849f, 0x84a0, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, + 0x84a8, 0x84a9, 0x84aa, 0x84ab, 0x84ac, 0x84ad, 0x84ae, 0x84b0, + 0x84b1, 0x84b3, 0x84b5, 0x84b6, 0x84b7, 0x84bb, 0x84bc, 0x84be, + 0x84c0, 0x84c2, 0x84c3, 0x84c5, 0x84c6, 0x84c7, 0x84c8, 0x84cb, + 0x84cc, 0x84ce, 0x84cf, 0x84d2, 0x84d4, 0x84d5, 0x84d7, 0x84d8, + 0x84d9, 0x84da, 0x84db, 0x84dc, 0x84de, 0x84e1, 0x84e2, 0x84e4, + 0x84e7, 0x84e8, 0x84e9, 0x84ea, 0x84eb, 0x84ed, 0x84ee, 0x84ef, + 0x84f1, 0x84f2, 0x84f3, 0x84f4, 0x84f5, 0x84f6, 0x84f7, 0x84f8, + 0x84f9, 0x84fa, 0x84fb, 0x84fd, 0x84fe, 0x8500, 0x8501, 0x8502, + 0x4f1e, 0x6563, 0x6851, 0x55d3, 0x4e27, 0x6414, 0x9a9a, 0x626b, + 0x5ac2, 0x745f, 0x8272, 0x6da9, 0x68ee, 0x50e7, 0x838e, 0x7802, + 0x6740, 0x5239, 0x6c99, 0x7eb1, 0x50bb, 0x5565, 0x715e, 0x7b5b, + 0x6652, 0x73ca, 0x82eb, 0x6749, 0x5c71, 0x5220, 0x717d, 0x886b, + 0x95ea, 0x9655, 0x64c5, 0x8d61, 0x81b3, 0x5584, 0x6c55, 0x6247, + 0x7f2e, 0x5892, 0x4f24, 0x5546, 0x8d4f, 0x664c, 0x4e0a, 0x5c1a, + 0x88f3, 0x68a2, 0x634e, 0x7a0d, 0x70e7, 0x828d, 0x52fa, 0x97f6, + 0x5c11, 0x54e8, 0x90b5, 0x7ecd, 0x5962, 0x8d4a, 0x86c7, 0x820c, + 0x820d, 0x8d66, 0x6444, 0x5c04, 0x6151, 0x6d89, 0x793e, 0x8bbe, + 0x7837, 0x7533, 0x547b, 0x4f38, 0x8eab, 0x6df1, 0x5a20, 0x7ec5, + 0x795e, 0x6c88, 0x5ba1, 0x5a76, 0x751a, 0x80be, 0x614e, 0x6e17, + 0x58f0, 0x751f, 0x7525, 0x7272, 0x5347, 0x7ef3, + /* 0xca */ + 0x8503, 0x8504, 0x8505, 0x8506, 0x8507, 0x8508, 0x8509, 0x850a, + 0x850b, 0x850d, 0x850e, 0x850f, 0x8510, 0x8512, 0x8514, 0x8515, + 0x8516, 0x8518, 0x8519, 0x851b, 0x851c, 0x851d, 0x851e, 0x8520, + 0x8522, 0x8523, 0x8524, 0x8525, 0x8526, 0x8527, 0x8528, 0x8529, + 0x852a, 0x852d, 0x852e, 0x852f, 0x8530, 0x8531, 0x8532, 0x8533, + 0x8534, 0x8535, 0x8536, 0x853e, 0x853f, 0x8540, 0x8541, 0x8542, + 0x8544, 0x8545, 0x8546, 0x8547, 0x854b, 0x854c, 0x854d, 0x854e, + 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8554, 0x8555, 0x8557, + 0x8558, 0x855a, 0x855b, 0x855c, 0x855d, 0x855f, 0x8560, 0x8561, + 0x8562, 0x8563, 0x8565, 0x8566, 0x8567, 0x8569, 0x856a, 0x856b, + 0x856c, 0x856d, 0x856e, 0x856f, 0x8570, 0x8571, 0x8573, 0x8575, + 0x8576, 0x8577, 0x8578, 0x857c, 0x857d, 0x857f, 0x8580, 0x8581, + 0x7701, 0x76db, 0x5269, 0x80dc, 0x5723, 0x5e08, 0x5931, 0x72ee, + 0x65bd, 0x6e7f, 0x8bd7, 0x5c38, 0x8671, 0x5341, 0x77f3, 0x62fe, + 0x65f6, 0x4ec0, 0x98df, 0x8680, 0x5b9e, 0x8bc6, 0x53f2, 0x77e2, + 0x4f7f, 0x5c4e, 0x9a76, 0x59cb, 0x5f0f, 0x793a, 0x58eb, 0x4e16, + 0x67ff, 0x4e8b, 0x62ed, 0x8a93, 0x901d, 0x52bf, 0x662f, 0x55dc, + 0x566c, 0x9002, 0x4ed5, 0x4f8d, 0x91ca, 0x9970, 0x6c0f, 0x5e02, + 0x6043, 0x5ba4, 0x89c6, 0x8bd5, 0x6536, 0x624b, 0x9996, 0x5b88, + 0x5bff, 0x6388, 0x552e, 0x53d7, 0x7626, 0x517d, 0x852c, 0x67a2, + 0x68b3, 0x6b8a, 0x6292, 0x8f93, 0x53d4, 0x8212, 0x6dd1, 0x758f, + 0x4e66, 0x8d4e, 0x5b70, 0x719f, 0x85af, 0x6691, 0x66d9, 0x7f72, + 0x8700, 0x9ecd, 0x9f20, 0x5c5e, 0x672f, 0x8ff0, 0x6811, 0x675f, + 0x620d, 0x7ad6, 0x5885, 0x5eb6, 0x6570, 0x6f31, + /* 0xcb */ + 0x8582, 0x8583, 0x8586, 0x8588, 0x8589, 0x858a, 0x858b, 0x858c, + 0x858d, 0x858e, 0x8590, 0x8591, 0x8592, 0x8593, 0x8594, 0x8595, + 0x8596, 0x8597, 0x8598, 0x8599, 0x859a, 0x859d, 0x859e, 0x859f, + 0x85a0, 0x85a1, 0x85a2, 0x85a3, 0x85a5, 0x85a6, 0x85a7, 0x85a9, + 0x85ab, 0x85ac, 0x85ad, 0x85b1, 0x85b2, 0x85b3, 0x85b4, 0x85b5, + 0x85b6, 0x85b8, 0x85ba, 0x85bb, 0x85bc, 0x85bd, 0x85be, 0x85bf, + 0x85c0, 0x85c2, 0x85c3, 0x85c4, 0x85c5, 0x85c6, 0x85c7, 0x85c8, + 0x85ca, 0x85cb, 0x85cc, 0x85cd, 0x85ce, 0x85d1, 0x85d2, 0x85d4, + 0x85d6, 0x85d7, 0x85d8, 0x85d9, 0x85da, 0x85db, 0x85dd, 0x85de, + 0x85df, 0x85e0, 0x85e1, 0x85e2, 0x85e3, 0x85e5, 0x85e6, 0x85e7, + 0x85e8, 0x85ea, 0x85eb, 0x85ec, 0x85ed, 0x85ee, 0x85ef, 0x85f0, + 0x85f1, 0x85f2, 0x85f3, 0x85f4, 0x85f5, 0x85f6, 0x85f7, 0x85f8, + 0x6055, 0x5237, 0x800d, 0x6454, 0x8870, 0x7529, 0x5e05, 0x6813, + 0x62f4, 0x971c, 0x53cc, 0x723d, 0x8c01, 0x6c34, 0x7761, 0x7a0e, + 0x542e, 0x77ac, 0x987a, 0x821c, 0x8bf4, 0x7855, 0x6714, 0x70c1, + 0x65af, 0x6495, 0x5636, 0x601d, 0x79c1, 0x53f8, 0x4e1d, 0x6b7b, + 0x8086, 0x5bfa, 0x55e3, 0x56db, 0x4f3a, 0x4f3c, 0x9972, 0x5df3, + 0x677e, 0x8038, 0x6002, 0x9882, 0x9001, 0x5b8b, 0x8bbc, 0x8bf5, + 0x641c, 0x8258, 0x64de, 0x55fd, 0x82cf, 0x9165, 0x4fd7, 0x7d20, + 0x901f, 0x7c9f, 0x50f3, 0x5851, 0x6eaf, 0x5bbf, 0x8bc9, 0x8083, + 0x9178, 0x849c, 0x7b97, 0x867d, 0x968b, 0x968f, 0x7ee5, 0x9ad3, + 0x788e, 0x5c81, 0x7a57, 0x9042, 0x96a7, 0x795f, 0x5b59, 0x635f, + 0x7b0b, 0x84d1, 0x68ad, 0x5506, 0x7f29, 0x7410, 0x7d22, 0x9501, + 0x6240, 0x584c, 0x4ed6, 0x5b83, 0x5979, 0x5854, + /* 0xcc */ + 0x85f9, 0x85fa, 0x85fc, 0x85fd, 0x85fe, 0x8600, 0x8601, 0x8602, + 0x8603, 0x8604, 0x8606, 0x8607, 0x8608, 0x8609, 0x860a, 0x860b, + 0x860c, 0x860d, 0x860e, 0x860f, 0x8610, 0x8612, 0x8613, 0x8614, + 0x8615, 0x8617, 0x8618, 0x8619, 0x861a, 0x861b, 0x861c, 0x861d, + 0x861e, 0x861f, 0x8620, 0x8621, 0x8622, 0x8623, 0x8624, 0x8625, + 0x8626, 0x8628, 0x862a, 0x862b, 0x862c, 0x862d, 0x862e, 0x862f, + 0x8630, 0x8631, 0x8632, 0x8633, 0x8634, 0x8635, 0x8636, 0x8637, + 0x8639, 0x863a, 0x863b, 0x863d, 0x863e, 0x863f, 0x8640, 0x8641, + 0x8642, 0x8643, 0x8644, 0x8645, 0x8646, 0x8647, 0x8648, 0x8649, + 0x864a, 0x864b, 0x864c, 0x8652, 0x8653, 0x8655, 0x8656, 0x8657, + 0x8658, 0x8659, 0x865b, 0x865c, 0x865d, 0x865f, 0x8660, 0x8661, + 0x8663, 0x8664, 0x8665, 0x8666, 0x8667, 0x8668, 0x8669, 0x866a, + 0x736d, 0x631e, 0x8e4b, 0x8e0f, 0x80ce, 0x82d4, 0x62ac, 0x53f0, + 0x6cf0, 0x915e, 0x592a, 0x6001, 0x6c70, 0x574d, 0x644a, 0x8d2a, + 0x762b, 0x6ee9, 0x575b, 0x6a80, 0x75f0, 0x6f6d, 0x8c2d, 0x8c08, + 0x5766, 0x6bef, 0x8892, 0x78b3, 0x63a2, 0x53f9, 0x70ad, 0x6c64, + 0x5858, 0x642a, 0x5802, 0x68e0, 0x819b, 0x5510, 0x7cd6, 0x5018, + 0x8eba, 0x6dcc, 0x8d9f, 0x70eb, 0x638f, 0x6d9b, 0x6ed4, 0x7ee6, + 0x8404, 0x6843, 0x9003, 0x6dd8, 0x9676, 0x8ba8, 0x5957, 0x7279, + 0x85e4, 0x817e, 0x75bc, 0x8a8a, 0x68af, 0x5254, 0x8e22, 0x9511, + 0x63d0, 0x9898, 0x8e44, 0x557c, 0x4f53, 0x66ff, 0x568f, 0x60d5, + 0x6d95, 0x5243, 0x5c49, 0x5929, 0x6dfb, 0x586b, 0x7530, 0x751c, + 0x606c, 0x8214, 0x8146, 0x6311, 0x6761, 0x8fe2, 0x773a, 0x8df3, + 0x8d34, 0x94c1, 0x5e16, 0x5385, 0x542c, 0x70c3, + /* 0xcd */ + 0x866d, 0x866f, 0x8670, 0x8672, 0x8673, 0x8674, 0x8675, 0x8676, + 0x8677, 0x8678, 0x8683, 0x8684, 0x8685, 0x8686, 0x8687, 0x8688, + 0x8689, 0x868e, 0x868f, 0x8690, 0x8691, 0x8692, 0x8694, 0x8696, + 0x8697, 0x8698, 0x8699, 0x869a, 0x869b, 0x869e, 0x869f, 0x86a0, + 0x86a1, 0x86a2, 0x86a5, 0x86a6, 0x86ab, 0x86ad, 0x86ae, 0x86b2, + 0x86b3, 0x86b7, 0x86b8, 0x86b9, 0x86bb, 0x86bc, 0x86bd, 0x86be, + 0x86bf, 0x86c1, 0x86c2, 0x86c3, 0x86c5, 0x86c8, 0x86cc, 0x86cd, + 0x86d2, 0x86d3, 0x86d5, 0x86d6, 0x86d7, 0x86da, 0x86dc, 0x86dd, + 0x86e0, 0x86e1, 0x86e2, 0x86e3, 0x86e5, 0x86e6, 0x86e7, 0x86e8, + 0x86ea, 0x86eb, 0x86ec, 0x86ef, 0x86f5, 0x86f6, 0x86f7, 0x86fa, + 0x86fb, 0x86fc, 0x86fd, 0x86ff, 0x8701, 0x8704, 0x8705, 0x8706, + 0x870b, 0x870c, 0x870e, 0x870f, 0x8710, 0x8711, 0x8714, 0x8716, + 0x6c40, 0x5ef7, 0x505c, 0x4ead, 0x5ead, 0x633a, 0x8247, 0x901a, + 0x6850, 0x916e, 0x77b3, 0x540c, 0x94dc, 0x5f64, 0x7ae5, 0x6876, + 0x6345, 0x7b52, 0x7edf, 0x75db, 0x5077, 0x6295, 0x5934, 0x900f, + 0x51f8, 0x79c3, 0x7a81, 0x56fe, 0x5f92, 0x9014, 0x6d82, 0x5c60, + 0x571f, 0x5410, 0x5154, 0x6e4d, 0x56e2, 0x63a8, 0x9893, 0x817f, + 0x8715, 0x892a, 0x9000, 0x541e, 0x5c6f, 0x81c0, 0x62d6, 0x6258, + 0x8131, 0x9e35, 0x9640, 0x9a6e, 0x9a7c, 0x692d, 0x59a5, 0x62d3, + 0x553e, 0x6316, 0x54c7, 0x86d9, 0x6d3c, 0x5a03, 0x74e6, 0x889c, + 0x6b6a, 0x5916, 0x8c4c, 0x5f2f, 0x6e7e, 0x73a9, 0x987d, 0x4e38, + 0x70f7, 0x5b8c, 0x7897, 0x633d, 0x665a, 0x7696, 0x60cb, 0x5b9b, + 0x5a49, 0x4e07, 0x8155, 0x6c6a, 0x738b, 0x4ea1, 0x6789, 0x7f51, + 0x5f80, 0x65fa, 0x671b, 0x5fd8, 0x5984, 0x5a01, + /* 0xce */ + 0x8719, 0x871b, 0x871d, 0x871f, 0x8720, 0x8724, 0x8726, 0x8727, + 0x8728, 0x872a, 0x872b, 0x872c, 0x872d, 0x872f, 0x8730, 0x8732, + 0x8733, 0x8735, 0x8736, 0x8738, 0x8739, 0x873a, 0x873c, 0x873d, + 0x8740, 0x8741, 0x8742, 0x8743, 0x8744, 0x8745, 0x8746, 0x874a, + 0x874b, 0x874d, 0x874f, 0x8750, 0x8751, 0x8752, 0x8754, 0x8755, + 0x8756, 0x8758, 0x875a, 0x875b, 0x875c, 0x875d, 0x875e, 0x875f, + 0x8761, 0x8762, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, + 0x876c, 0x876d, 0x876f, 0x8771, 0x8772, 0x8773, 0x8775, 0x8777, + 0x8778, 0x8779, 0x877a, 0x877f, 0x8780, 0x8781, 0x8784, 0x8786, + 0x8787, 0x8789, 0x878a, 0x878c, 0x878e, 0x878f, 0x8790, 0x8791, + 0x8792, 0x8794, 0x8795, 0x8796, 0x8798, 0x8799, 0x879a, 0x879b, + 0x879c, 0x879d, 0x879e, 0x87a0, 0x87a1, 0x87a2, 0x87a3, 0x87a4, + 0x5dcd, 0x5fae, 0x5371, 0x97e6, 0x8fdd, 0x6845, 0x56f4, 0x552f, + 0x60df, 0x4e3a, 0x6f4d, 0x7ef4, 0x82c7, 0x840e, 0x59d4, 0x4f1f, + 0x4f2a, 0x5c3e, 0x7eac, 0x672a, 0x851a, 0x5473, 0x754f, 0x80c3, + 0x5582, 0x9b4f, 0x4f4d, 0x6e2d, 0x8c13, 0x5c09, 0x6170, 0x536b, + 0x761f, 0x6e29, 0x868a, 0x6587, 0x95fb, 0x7eb9, 0x543b, 0x7a33, + 0x7d0a, 0x95ee, 0x55e1, 0x7fc1, 0x74ee, 0x631d, 0x8717, 0x6da1, + 0x7a9d, 0x6211, 0x65a1, 0x5367, 0x63e1, 0x6c83, 0x5deb, 0x545c, + 0x94a8, 0x4e4c, 0x6c61, 0x8bec, 0x5c4b, 0x65e0, 0x829c, 0x68a7, + 0x543e, 0x5434, 0x6bcb, 0x6b66, 0x4e94, 0x6342, 0x5348, 0x821e, + 0x4f0d, 0x4fae, 0x575e, 0x620a, 0x96fe, 0x6664, 0x7269, 0x52ff, + 0x52a1, 0x609f, 0x8bef, 0x6614, 0x7199, 0x6790, 0x897f, 0x7852, + 0x77fd, 0x6670, 0x563b, 0x5438, 0x9521, 0x727a, + /* 0xcf */ + 0x87a5, 0x87a6, 0x87a7, 0x87a9, 0x87aa, 0x87ae, 0x87b0, 0x87b1, + 0x87b2, 0x87b4, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87bb, 0x87bc, + 0x87be, 0x87bf, 0x87c1, 0x87c2, 0x87c3, 0x87c4, 0x87c5, 0x87c7, + 0x87c8, 0x87c9, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d4, + 0x87d5, 0x87d6, 0x87d7, 0x87d8, 0x87d9, 0x87da, 0x87dc, 0x87dd, + 0x87de, 0x87df, 0x87e1, 0x87e2, 0x87e3, 0x87e4, 0x87e6, 0x87e7, + 0x87e8, 0x87e9, 0x87eb, 0x87ec, 0x87ed, 0x87ef, 0x87f0, 0x87f1, + 0x87f2, 0x87f3, 0x87f4, 0x87f5, 0x87f6, 0x87f7, 0x87f8, 0x87fa, + 0x87fb, 0x87fc, 0x87fd, 0x87ff, 0x8800, 0x8801, 0x8802, 0x8804, + 0x8805, 0x8806, 0x8807, 0x8808, 0x8809, 0x880b, 0x880c, 0x880d, + 0x880e, 0x880f, 0x8810, 0x8811, 0x8812, 0x8814, 0x8817, 0x8818, + 0x8819, 0x881a, 0x881c, 0x881d, 0x881e, 0x881f, 0x8820, 0x8823, + 0x7a00, 0x606f, 0x5e0c, 0x6089, 0x819d, 0x5915, 0x60dc, 0x7184, + 0x70ef, 0x6eaa, 0x6c50, 0x7280, 0x6a84, 0x88ad, 0x5e2d, 0x4e60, + 0x5ab3, 0x559c, 0x94e3, 0x6d17, 0x7cfb, 0x9699, 0x620f, 0x7ec6, + 0x778e, 0x867e, 0x5323, 0x971e, 0x8f96, 0x6687, 0x5ce1, 0x4fa0, + 0x72ed, 0x4e0b, 0x53a6, 0x590f, 0x5413, 0x6380, 0x9528, 0x5148, + 0x4ed9, 0x9c9c, 0x7ea4, 0x54b8, 0x8d24, 0x8854, 0x8237, 0x95f2, + 0x6d8e, 0x5f26, 0x5acc, 0x663e, 0x9669, 0x73b0, 0x732e, 0x53bf, + 0x817a, 0x9985, 0x7fa1, 0x5baa, 0x9677, 0x9650, 0x7ebf, 0x76f8, + 0x53a2, 0x9576, 0x9999, 0x7bb1, 0x8944, 0x6e58, 0x4e61, 0x7fd4, + 0x7965, 0x8be6, 0x60f3, 0x54cd, 0x4eab, 0x9879, 0x5df7, 0x6a61, + 0x50cf, 0x5411, 0x8c61, 0x8427, 0x785d, 0x9704, 0x524a, 0x54ee, + 0x56a3, 0x9500, 0x6d88, 0x5bb5, 0x6dc6, 0x6653, + /* 0xd0 */ + 0x8824, 0x8825, 0x8826, 0x8827, 0x8828, 0x8829, 0x882a, 0x882b, + 0x882c, 0x882d, 0x882e, 0x882f, 0x8830, 0x8831, 0x8833, 0x8834, + 0x8835, 0x8836, 0x8837, 0x8838, 0x883a, 0x883b, 0x883d, 0x883e, + 0x883f, 0x8841, 0x8842, 0x8843, 0x8846, 0x8847, 0x8848, 0x8849, + 0x884a, 0x884b, 0x884e, 0x884f, 0x8850, 0x8851, 0x8852, 0x8853, + 0x8855, 0x8856, 0x8858, 0x885a, 0x885b, 0x885c, 0x885d, 0x885e, + 0x885f, 0x8860, 0x8866, 0x8867, 0x886a, 0x886d, 0x886f, 0x8871, + 0x8873, 0x8874, 0x8875, 0x8876, 0x8878, 0x8879, 0x887a, 0x887b, + 0x887c, 0x8880, 0x8883, 0x8886, 0x8887, 0x8889, 0x888a, 0x888c, + 0x888e, 0x888f, 0x8890, 0x8891, 0x8893, 0x8894, 0x8895, 0x8897, + 0x8898, 0x8899, 0x889a, 0x889b, 0x889d, 0x889e, 0x889f, 0x88a0, + 0x88a1, 0x88a3, 0x88a5, 0x88a6, 0x88a7, 0x88a8, 0x88a9, 0x88aa, + 0x5c0f, 0x5b5d, 0x6821, 0x8096, 0x5578, 0x7b11, 0x6548, 0x6954, + 0x4e9b, 0x6b47, 0x874e, 0x978b, 0x534f, 0x631f, 0x643a, 0x90aa, + 0x659c, 0x80c1, 0x8c10, 0x5199, 0x68b0, 0x5378, 0x87f9, 0x61c8, + 0x6cc4, 0x6cfb, 0x8c22, 0x5c51, 0x85aa, 0x82af, 0x950c, 0x6b23, + 0x8f9b, 0x65b0, 0x5ffb, 0x5fc3, 0x4fe1, 0x8845, 0x661f, 0x8165, + 0x7329, 0x60fa, 0x5174, 0x5211, 0x578b, 0x5f62, 0x90a2, 0x884c, + 0x9192, 0x5e78, 0x674f, 0x6027, 0x59d3, 0x5144, 0x51f6, 0x80f8, + 0x5308, 0x6c79, 0x96c4, 0x718a, 0x4f11, 0x4fee, 0x7f9e, 0x673d, + 0x55c5, 0x9508, 0x79c0, 0x8896, 0x7ee3, 0x589f, 0x620c, 0x9700, + 0x865a, 0x5618, 0x987b, 0x5f90, 0x8bb8, 0x84c4, 0x9157, 0x53d9, + 0x65ed, 0x5e8f, 0x755c, 0x6064, 0x7d6e, 0x5a7f, 0x7eea, 0x7eed, + 0x8f69, 0x55a7, 0x5ba3, 0x60ac, 0x65cb, 0x7384, + /* 0xd1 */ + 0x88ac, 0x88ae, 0x88af, 0x88b0, 0x88b2, 0x88b3, 0x88b4, 0x88b5, + 0x88b6, 0x88b8, 0x88b9, 0x88ba, 0x88bb, 0x88bd, 0x88be, 0x88bf, + 0x88c0, 0x88c3, 0x88c4, 0x88c7, 0x88c8, 0x88ca, 0x88cb, 0x88cc, + 0x88cd, 0x88cf, 0x88d0, 0x88d1, 0x88d3, 0x88d6, 0x88d7, 0x88da, + 0x88db, 0x88dc, 0x88dd, 0x88de, 0x88e0, 0x88e1, 0x88e6, 0x88e7, + 0x88e9, 0x88ea, 0x88eb, 0x88ec, 0x88ed, 0x88ee, 0x88ef, 0x88f2, + 0x88f5, 0x88f6, 0x88f7, 0x88fa, 0x88fb, 0x88fd, 0x88ff, 0x8900, + 0x8901, 0x8903, 0x8904, 0x8905, 0x8906, 0x8907, 0x8908, 0x8909, + 0x890b, 0x890c, 0x890d, 0x890e, 0x890f, 0x8911, 0x8914, 0x8915, + 0x8916, 0x8917, 0x8918, 0x891c, 0x891d, 0x891e, 0x891f, 0x8920, + 0x8922, 0x8923, 0x8924, 0x8926, 0x8927, 0x8928, 0x8929, 0x892c, + 0x892d, 0x892e, 0x892f, 0x8931, 0x8932, 0x8933, 0x8935, 0x8937, + 0x9009, 0x7663, 0x7729, 0x7eda, 0x9774, 0x859b, 0x5b66, 0x7a74, + 0x96ea, 0x8840, 0x52cb, 0x718f, 0x5faa, 0x65ec, 0x8be2, 0x5bfb, + 0x9a6f, 0x5de1, 0x6b89, 0x6c5b, 0x8bad, 0x8baf, 0x900a, 0x8fc5, + 0x538b, 0x62bc, 0x9e26, 0x9e2d, 0x5440, 0x4e2b, 0x82bd, 0x7259, + 0x869c, 0x5d16, 0x8859, 0x6daf, 0x96c5, 0x54d1, 0x4e9a, 0x8bb6, + 0x7109, 0x54bd, 0x9609, 0x70df, 0x6df9, 0x76d0, 0x4e25, 0x7814, + 0x8712, 0x5ca9, 0x5ef6, 0x8a00, 0x989c, 0x960e, 0x708e, 0x6cbf, + 0x5944, 0x63a9, 0x773c, 0x884d, 0x6f14, 0x8273, 0x5830, 0x71d5, + 0x538c, 0x781a, 0x96c1, 0x5501, 0x5f66, 0x7130, 0x5bb4, 0x8c1a, + 0x9a8c, 0x6b83, 0x592e, 0x9e2f, 0x79e7, 0x6768, 0x626c, 0x4f6f, + 0x75a1, 0x7f8a, 0x6d0b, 0x9633, 0x6c27, 0x4ef0, 0x75d2, 0x517b, + 0x6837, 0x6f3e, 0x9080, 0x8170, 0x5996, 0x7476, + /* 0xd2 */ + 0x8938, 0x8939, 0x893a, 0x893b, 0x893c, 0x893d, 0x893e, 0x893f, + 0x8940, 0x8942, 0x8943, 0x8945, 0x8946, 0x8947, 0x8948, 0x8949, + 0x894a, 0x894b, 0x894c, 0x894d, 0x894e, 0x894f, 0x8950, 0x8951, + 0x8952, 0x8953, 0x8954, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, + 0x895a, 0x895b, 0x895c, 0x895d, 0x8960, 0x8961, 0x8962, 0x8963, + 0x8964, 0x8965, 0x8967, 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, + 0x896d, 0x896e, 0x896f, 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, + 0x8975, 0x8976, 0x8977, 0x8978, 0x8979, 0x897a, 0x897c, 0x897d, + 0x897e, 0x8980, 0x8982, 0x8984, 0x8985, 0x8987, 0x8988, 0x8989, + 0x898a, 0x898b, 0x898c, 0x898d, 0x898e, 0x898f, 0x8990, 0x8991, + 0x8992, 0x8993, 0x8994, 0x8995, 0x8996, 0x8997, 0x8998, 0x8999, + 0x899a, 0x899b, 0x899c, 0x899d, 0x899e, 0x899f, 0x89a0, 0x89a1, + 0x6447, 0x5c27, 0x9065, 0x7a91, 0x8c23, 0x59da, 0x54ac, 0x8200, + 0x836f, 0x8981, 0x8000, 0x6930, 0x564e, 0x8036, 0x7237, 0x91ce, + 0x51b6, 0x4e5f, 0x9875, 0x6396, 0x4e1a, 0x53f6, 0x66f3, 0x814b, + 0x591c, 0x6db2, 0x4e00, 0x58f9, 0x533b, 0x63d6, 0x94f1, 0x4f9d, + 0x4f0a, 0x8863, 0x9890, 0x5937, 0x9057, 0x79fb, 0x4eea, 0x80f0, + 0x7591, 0x6c82, 0x5b9c, 0x59e8, 0x5f5d, 0x6905, 0x8681, 0x501a, + 0x5df2, 0x4e59, 0x77e3, 0x4ee5, 0x827a, 0x6291, 0x6613, 0x9091, + 0x5c79, 0x4ebf, 0x5f79, 0x81c6, 0x9038, 0x8084, 0x75ab, 0x4ea6, + 0x88d4, 0x610f, 0x6bc5, 0x5fc6, 0x4e49, 0x76ca, 0x6ea2, 0x8be3, + 0x8bae, 0x8c0a, 0x8bd1, 0x5f02, 0x7ffc, 0x7fcc, 0x7ece, 0x8335, + 0x836b, 0x56e0, 0x6bb7, 0x97f3, 0x9634, 0x59fb, 0x541f, 0x94f6, + 0x6deb, 0x5bc5, 0x996e, 0x5c39, 0x5f15, 0x9690, + /* 0xd3 */ + 0x89a2, 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0x89a7, 0x89a8, 0x89a9, + 0x89aa, 0x89ab, 0x89ac, 0x89ad, 0x89ae, 0x89af, 0x89b0, 0x89b1, + 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, 0x89b8, 0x89b9, + 0x89ba, 0x89bb, 0x89bc, 0x89bd, 0x89be, 0x89bf, 0x89c0, 0x89c3, + 0x89cd, 0x89d3, 0x89d4, 0x89d5, 0x89d7, 0x89d8, 0x89d9, 0x89db, + 0x89dd, 0x89df, 0x89e0, 0x89e1, 0x89e2, 0x89e4, 0x89e7, 0x89e8, + 0x89e9, 0x89ea, 0x89ec, 0x89ed, 0x89ee, 0x89f0, 0x89f1, 0x89f2, + 0x89f4, 0x89f5, 0x89f6, 0x89f7, 0x89f8, 0x89f9, 0x89fa, 0x89fb, + 0x89fc, 0x89fd, 0x89fe, 0x89ff, 0x8a01, 0x8a02, 0x8a03, 0x8a04, + 0x8a05, 0x8a06, 0x8a08, 0x8a09, 0x8a0a, 0x8a0b, 0x8a0c, 0x8a0d, + 0x8a0e, 0x8a0f, 0x8a10, 0x8a11, 0x8a12, 0x8a13, 0x8a14, 0x8a15, + 0x8a16, 0x8a17, 0x8a18, 0x8a19, 0x8a1a, 0x8a1b, 0x8a1c, 0x8a1d, + 0x5370, 0x82f1, 0x6a31, 0x5a74, 0x9e70, 0x5e94, 0x7f28, 0x83b9, + 0x8424, 0x8425, 0x8367, 0x8747, 0x8fce, 0x8d62, 0x76c8, 0x5f71, + 0x9896, 0x786c, 0x6620, 0x54df, 0x62e5, 0x4f63, 0x81c3, 0x75c8, + 0x5eb8, 0x96cd, 0x8e0a, 0x86f9, 0x548f, 0x6cf3, 0x6d8c, 0x6c38, + 0x607f, 0x52c7, 0x7528, 0x5e7d, 0x4f18, 0x60a0, 0x5fe7, 0x5c24, + 0x7531, 0x90ae, 0x94c0, 0x72b9, 0x6cb9, 0x6e38, 0x9149, 0x6709, + 0x53cb, 0x53f3, 0x4f51, 0x91c9, 0x8bf1, 0x53c8, 0x5e7c, 0x8fc2, + 0x6de4, 0x4e8e, 0x76c2, 0x6986, 0x865e, 0x611a, 0x8206, 0x4f59, + 0x4fde, 0x903e, 0x9c7c, 0x6109, 0x6e1d, 0x6e14, 0x9685, 0x4e88, + 0x5a31, 0x96e8, 0x4e0e, 0x5c7f, 0x79b9, 0x5b87, 0x8bed, 0x7fbd, + 0x7389, 0x57df, 0x828b, 0x90c1, 0x5401, 0x9047, 0x55bb, 0x5cea, + 0x5fa1, 0x6108, 0x6b32, 0x72f1, 0x80b2, 0x8a89, + /* 0xd4 */ + 0x8a1e, 0x8a1f, 0x8a20, 0x8a21, 0x8a22, 0x8a23, 0x8a24, 0x8a25, + 0x8a26, 0x8a27, 0x8a28, 0x8a29, 0x8a2a, 0x8a2b, 0x8a2c, 0x8a2d, + 0x8a2e, 0x8a2f, 0x8a30, 0x8a31, 0x8a32, 0x8a33, 0x8a34, 0x8a35, + 0x8a36, 0x8a37, 0x8a38, 0x8a39, 0x8a3a, 0x8a3b, 0x8a3c, 0x8a3d, + 0x8a3f, 0x8a40, 0x8a41, 0x8a42, 0x8a43, 0x8a44, 0x8a45, 0x8a46, + 0x8a47, 0x8a49, 0x8a4a, 0x8a4b, 0x8a4c, 0x8a4d, 0x8a4e, 0x8a4f, + 0x8a50, 0x8a51, 0x8a52, 0x8a53, 0x8a54, 0x8a55, 0x8a56, 0x8a57, + 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, + 0x8a60, 0x8a61, 0x8a62, 0x8a63, 0x8a64, 0x8a65, 0x8a66, 0x8a67, + 0x8a68, 0x8a69, 0x8a6a, 0x8a6b, 0x8a6c, 0x8a6d, 0x8a6e, 0x8a6f, + 0x8a70, 0x8a71, 0x8a72, 0x8a73, 0x8a74, 0x8a75, 0x8a76, 0x8a77, + 0x8a78, 0x8a7a, 0x8a7b, 0x8a7c, 0x8a7d, 0x8a7e, 0x8a7f, 0x8a80, + 0x6d74, 0x5bd3, 0x88d5, 0x9884, 0x8c6b, 0x9a6d, 0x9e33, 0x6e0a, + 0x51a4, 0x5143, 0x57a3, 0x8881, 0x539f, 0x63f4, 0x8f95, 0x56ed, + 0x5458, 0x5706, 0x733f, 0x6e90, 0x7f18, 0x8fdc, 0x82d1, 0x613f, + 0x6028, 0x9662, 0x66f0, 0x7ea6, 0x8d8a, 0x8dc3, 0x94a5, 0x5cb3, + 0x7ca4, 0x6708, 0x60a6, 0x9605, 0x8018, 0x4e91, 0x90e7, 0x5300, + 0x9668, 0x5141, 0x8fd0, 0x8574, 0x915d, 0x6655, 0x97f5, 0x5b55, + 0x531d, 0x7838, 0x6742, 0x683d, 0x54c9, 0x707e, 0x5bb0, 0x8f7d, + 0x518d, 0x5728, 0x54b1, 0x6512, 0x6682, 0x8d5e, 0x8d43, 0x810f, + 0x846c, 0x906d, 0x7cdf, 0x51ff, 0x85fb, 0x67a3, 0x65e9, 0x6fa1, + 0x86a4, 0x8e81, 0x566a, 0x9020, 0x7682, 0x7076, 0x71e5, 0x8d23, + 0x62e9, 0x5219, 0x6cfd, 0x8d3c, 0x600e, 0x589e, 0x618e, 0x66fe, + 0x8d60, 0x624e, 0x55b3, 0x6e23, 0x672d, 0x8f67, + /* 0xd5 */ + 0x8a81, 0x8a82, 0x8a83, 0x8a84, 0x8a85, 0x8a86, 0x8a87, 0x8a88, + 0x8a8b, 0x8a8c, 0x8a8d, 0x8a8e, 0x8a8f, 0x8a90, 0x8a91, 0x8a92, + 0x8a94, 0x8a95, 0x8a96, 0x8a97, 0x8a98, 0x8a99, 0x8a9a, 0x8a9b, + 0x8a9c, 0x8a9d, 0x8a9e, 0x8a9f, 0x8aa0, 0x8aa1, 0x8aa2, 0x8aa3, + 0x8aa4, 0x8aa5, 0x8aa6, 0x8aa7, 0x8aa8, 0x8aa9, 0x8aaa, 0x8aab, + 0x8aac, 0x8aad, 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, + 0x8ab4, 0x8ab5, 0x8ab6, 0x8ab7, 0x8ab8, 0x8ab9, 0x8aba, 0x8abb, + 0x8abc, 0x8abd, 0x8abe, 0x8abf, 0x8ac0, 0x8ac1, 0x8ac2, 0x8ac3, + 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, 0x8ac8, 0x8ac9, 0x8aca, 0x8acb, + 0x8acc, 0x8acd, 0x8ace, 0x8acf, 0x8ad0, 0x8ad1, 0x8ad2, 0x8ad3, + 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, 0x8ad9, 0x8ada, 0x8adb, + 0x8adc, 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0x8ae1, 0x8ae2, 0x8ae3, + 0x94e1, 0x95f8, 0x7728, 0x6805, 0x69a8, 0x548b, 0x4e4d, 0x70b8, + 0x8bc8, 0x6458, 0x658b, 0x5b85, 0x7a84, 0x503a, 0x5be8, 0x77bb, + 0x6be1, 0x8a79, 0x7c98, 0x6cbe, 0x76cf, 0x65a9, 0x8f97, 0x5d2d, + 0x5c55, 0x8638, 0x6808, 0x5360, 0x6218, 0x7ad9, 0x6e5b, 0x7efd, + 0x6a1f, 0x7ae0, 0x5f70, 0x6f33, 0x5f20, 0x638c, 0x6da8, 0x6756, + 0x4e08, 0x5e10, 0x8d26, 0x4ed7, 0x80c0, 0x7634, 0x969c, 0x62db, + 0x662d, 0x627e, 0x6cbc, 0x8d75, 0x7167, 0x7f69, 0x5146, 0x8087, + 0x53ec, 0x906e, 0x6298, 0x54f2, 0x86f0, 0x8f99, 0x8005, 0x9517, + 0x8517, 0x8fd9, 0x6d59, 0x73cd, 0x659f, 0x771f, 0x7504, 0x7827, + 0x81fb, 0x8d1e, 0x9488, 0x4fa6, 0x6795, 0x75b9, 0x8bca, 0x9707, + 0x632f, 0x9547, 0x9635, 0x84b8, 0x6323, 0x7741, 0x5f81, 0x72f0, + 0x4e89, 0x6014, 0x6574, 0x62ef, 0x6b63, 0x653f, + /* 0xd6 */ + 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0x8ae9, 0x8aea, 0x8aeb, + 0x8aec, 0x8aed, 0x8aee, 0x8aef, 0x8af0, 0x8af1, 0x8af2, 0x8af3, + 0x8af4, 0x8af5, 0x8af6, 0x8af7, 0x8af8, 0x8af9, 0x8afa, 0x8afb, + 0x8afc, 0x8afd, 0x8afe, 0x8aff, 0x8b00, 0x8b01, 0x8b02, 0x8b03, + 0x8b04, 0x8b05, 0x8b06, 0x8b08, 0x8b09, 0x8b0a, 0x8b0b, 0x8b0c, + 0x8b0d, 0x8b0e, 0x8b0f, 0x8b10, 0x8b11, 0x8b12, 0x8b13, 0x8b14, + 0x8b15, 0x8b16, 0x8b17, 0x8b18, 0x8b19, 0x8b1a, 0x8b1b, 0x8b1c, + 0x8b1d, 0x8b1e, 0x8b1f, 0x8b20, 0x8b21, 0x8b22, 0x8b23, 0x8b24, + 0x8b25, 0x8b27, 0x8b28, 0x8b29, 0x8b2a, 0x8b2b, 0x8b2c, 0x8b2d, + 0x8b2e, 0x8b2f, 0x8b30, 0x8b31, 0x8b32, 0x8b33, 0x8b34, 0x8b35, + 0x8b36, 0x8b37, 0x8b38, 0x8b39, 0x8b3a, 0x8b3b, 0x8b3c, 0x8b3d, + 0x8b3e, 0x8b3f, 0x8b40, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0x8b45, + 0x5e27, 0x75c7, 0x90d1, 0x8bc1, 0x829d, 0x679d, 0x652f, 0x5431, + 0x8718, 0x77e5, 0x80a2, 0x8102, 0x6c41, 0x4e4b, 0x7ec7, 0x804c, + 0x76f4, 0x690d, 0x6b96, 0x6267, 0x503c, 0x4f84, 0x5740, 0x6307, + 0x6b62, 0x8dbe, 0x53ea, 0x65e8, 0x7eb8, 0x5fd7, 0x631a, 0x63b7, + 0x81f3, 0x81f4, 0x7f6e, 0x5e1c, 0x5cd9, 0x5236, 0x667a, 0x79e9, + 0x7a1a, 0x8d28, 0x7099, 0x75d4, 0x6ede, 0x6cbb, 0x7a92, 0x4e2d, + 0x76c5, 0x5fe0, 0x949f, 0x8877, 0x7ec8, 0x79cd, 0x80bf, 0x91cd, + 0x4ef2, 0x4f17, 0x821f, 0x5468, 0x5dde, 0x6d32, 0x8bcc, 0x7ca5, + 0x8f74, 0x8098, 0x5e1a, 0x5492, 0x76b1, 0x5b99, 0x663c, 0x9aa4, + 0x73e0, 0x682a, 0x86db, 0x6731, 0x732a, 0x8bf8, 0x8bdb, 0x9010, + 0x7af9, 0x70db, 0x716e, 0x62c4, 0x77a9, 0x5631, 0x4e3b, 0x8457, + 0x67f1, 0x52a9, 0x86c0, 0x8d2e, 0x94f8, 0x7b51, + /* 0xd7 */ + 0x8b46, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, 0x8b4c, 0x8b4d, + 0x8b4e, 0x8b4f, 0x8b50, 0x8b51, 0x8b52, 0x8b53, 0x8b54, 0x8b55, + 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, + 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, + 0x8b67, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6d, 0x8b6e, 0x8b6f, + 0x8b70, 0x8b71, 0x8b72, 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, + 0x8b78, 0x8b79, 0x8b7a, 0x8b7b, 0x8b7c, 0x8b7d, 0x8b7e, 0x8b7f, + 0x8b80, 0x8b81, 0x8b82, 0x8b83, 0x8b84, 0x8b85, 0x8b86, 0x8b87, + 0x8b88, 0x8b89, 0x8b8a, 0x8b8b, 0x8b8c, 0x8b8d, 0x8b8e, 0x8b8f, + 0x8b90, 0x8b91, 0x8b92, 0x8b93, 0x8b94, 0x8b95, 0x8b96, 0x8b97, + 0x8b98, 0x8b99, 0x8b9a, 0x8b9b, 0x8b9c, 0x8b9d, 0x8b9e, 0x8b9f, + 0x8bac, 0x8bb1, 0x8bbb, 0x8bc7, 0x8bd0, 0x8bea, 0x8c09, 0x8c1e, + 0x4f4f, 0x6ce8, 0x795d, 0x9a7b, 0x6293, 0x722a, 0x62fd, 0x4e13, + 0x7816, 0x8f6c, 0x64b0, 0x8d5a, 0x7bc6, 0x6869, 0x5e84, 0x88c5, + 0x5986, 0x649e, 0x58ee, 0x72b6, 0x690e, 0x9525, 0x8ffd, 0x8d58, + 0x5760, 0x7f00, 0x8c06, 0x51c6, 0x6349, 0x62d9, 0x5353, 0x684c, + 0x7422, 0x8301, 0x914c, 0x5544, 0x7740, 0x707c, 0x6d4a, 0x5179, + 0x54a8, 0x8d44, 0x59ff, 0x6ecb, 0x6dc4, 0x5b5c, 0x7d2b, 0x4ed4, + 0x7c7d, 0x6ed3, 0x5b50, 0x81ea, 0x6e0d, 0x5b57, 0x9b03, 0x68d5, + 0x8e2a, 0x5b97, 0x7efc, 0x603b, 0x7eb5, 0x90b9, 0x8d70, 0x594f, + 0x63cd, 0x79df, 0x8db3, 0x5352, 0x65cf, 0x7956, 0x8bc5, 0x963b, + 0x7ec4, 0x94bb, 0x7e82, 0x5634, 0x9189, 0x6700, 0x7f6a, 0x5c0a, + 0x9075, 0x6628, 0x5de6, 0x4f50, 0x67de, 0x505a, 0x4f5c, 0x5750, + 0x5ea7, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xd8 */ + 0x8c38, 0x8c39, 0x8c3a, 0x8c3b, 0x8c3c, 0x8c3d, 0x8c3e, 0x8c3f, + 0x8c40, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c48, 0x8c4a, 0x8c4b, + 0x8c4d, 0x8c4e, 0x8c4f, 0x8c50, 0x8c51, 0x8c52, 0x8c53, 0x8c54, + 0x8c56, 0x8c57, 0x8c58, 0x8c59, 0x8c5b, 0x8c5c, 0x8c5d, 0x8c5e, + 0x8c5f, 0x8c60, 0x8c63, 0x8c64, 0x8c65, 0x8c66, 0x8c67, 0x8c68, + 0x8c69, 0x8c6c, 0x8c6d, 0x8c6e, 0x8c6f, 0x8c70, 0x8c71, 0x8c72, + 0x8c74, 0x8c75, 0x8c76, 0x8c77, 0x8c7b, 0x8c7c, 0x8c7d, 0x8c7e, + 0x8c7f, 0x8c80, 0x8c81, 0x8c83, 0x8c84, 0x8c86, 0x8c87, 0x8c88, + 0x8c8b, 0x8c8d, 0x8c8e, 0x8c8f, 0x8c90, 0x8c91, 0x8c92, 0x8c93, + 0x8c95, 0x8c96, 0x8c97, 0x8c99, 0x8c9a, 0x8c9b, 0x8c9c, 0x8c9d, + 0x8c9e, 0x8c9f, 0x8ca0, 0x8ca1, 0x8ca2, 0x8ca3, 0x8ca4, 0x8ca5, + 0x8ca6, 0x8ca7, 0x8ca8, 0x8ca9, 0x8caa, 0x8cab, 0x8cac, 0x8cad, + 0x4e8d, 0x4e0c, 0x5140, 0x4e10, 0x5eff, 0x5345, 0x4e15, 0x4e98, + 0x4e1e, 0x9b32, 0x5b6c, 0x5669, 0x4e28, 0x79ba, 0x4e3f, 0x5315, + 0x4e47, 0x592d, 0x723b, 0x536e, 0x6c10, 0x56df, 0x80e4, 0x9997, + 0x6bd3, 0x777e, 0x9f17, 0x4e36, 0x4e9f, 0x9f10, 0x4e5c, 0x4e69, + 0x4e93, 0x8288, 0x5b5b, 0x556c, 0x560f, 0x4ec4, 0x538d, 0x539d, + 0x53a3, 0x53a5, 0x53ae, 0x9765, 0x8d5d, 0x531a, 0x53f5, 0x5326, + 0x532e, 0x533e, 0x8d5c, 0x5366, 0x5363, 0x5202, 0x5208, 0x520e, + 0x522d, 0x5233, 0x523f, 0x5240, 0x524c, 0x525e, 0x5261, 0x525c, + 0x84af, 0x527d, 0x5282, 0x5281, 0x5290, 0x5293, 0x5182, 0x7f54, + 0x4ebb, 0x4ec3, 0x4ec9, 0x4ec2, 0x4ee8, 0x4ee1, 0x4eeb, 0x4ede, + 0x4f1b, 0x4ef3, 0x4f22, 0x4f64, 0x4ef5, 0x4f25, 0x4f27, 0x4f09, + 0x4f2b, 0x4f5e, 0x4f67, 0x6538, 0x4f5a, 0x4f5d, + /* 0xd9 */ + 0x8cae, 0x8caf, 0x8cb0, 0x8cb1, 0x8cb2, 0x8cb3, 0x8cb4, 0x8cb5, + 0x8cb6, 0x8cb7, 0x8cb8, 0x8cb9, 0x8cba, 0x8cbb, 0x8cbc, 0x8cbd, + 0x8cbe, 0x8cbf, 0x8cc0, 0x8cc1, 0x8cc2, 0x8cc3, 0x8cc4, 0x8cc5, + 0x8cc6, 0x8cc7, 0x8cc8, 0x8cc9, 0x8cca, 0x8ccb, 0x8ccc, 0x8ccd, + 0x8cce, 0x8ccf, 0x8cd0, 0x8cd1, 0x8cd2, 0x8cd3, 0x8cd4, 0x8cd5, + 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0x8cdb, 0x8cdc, 0x8cdd, + 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, 0x8ce2, 0x8ce3, 0x8ce4, 0x8ce5, + 0x8ce6, 0x8ce7, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, 0x8ced, + 0x8cee, 0x8cef, 0x8cf0, 0x8cf1, 0x8cf2, 0x8cf3, 0x8cf4, 0x8cf5, + 0x8cf6, 0x8cf7, 0x8cf8, 0x8cf9, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, + 0x8cfe, 0x8cff, 0x8d00, 0x8d01, 0x8d02, 0x8d03, 0x8d04, 0x8d05, + 0x8d06, 0x8d07, 0x8d08, 0x8d09, 0x8d0a, 0x8d0b, 0x8d0c, 0x8d0d, + 0x4f5f, 0x4f57, 0x4f32, 0x4f3d, 0x4f76, 0x4f74, 0x4f91, 0x4f89, + 0x4f83, 0x4f8f, 0x4f7e, 0x4f7b, 0x4faa, 0x4f7c, 0x4fac, 0x4f94, + 0x4fe6, 0x4fe8, 0x4fea, 0x4fc5, 0x4fda, 0x4fe3, 0x4fdc, 0x4fd1, + 0x4fdf, 0x4ff8, 0x5029, 0x504c, 0x4ff3, 0x502c, 0x500f, 0x502e, + 0x502d, 0x4ffe, 0x501c, 0x500c, 0x5025, 0x5028, 0x507e, 0x5043, + 0x5055, 0x5048, 0x504e, 0x506c, 0x507b, 0x50a5, 0x50a7, 0x50a9, + 0x50ba, 0x50d6, 0x5106, 0x50ed, 0x50ec, 0x50e6, 0x50ee, 0x5107, + 0x510b, 0x4edd, 0x6c3d, 0x4f58, 0x4f65, 0x4fce, 0x9fa0, 0x6c46, + 0x7c74, 0x516e, 0x5dfd, 0x9ec9, 0x9998, 0x5181, 0x5914, 0x52f9, + 0x530d, 0x8a07, 0x5310, 0x51eb, 0x5919, 0x5155, 0x4ea0, 0x5156, + 0x4eb3, 0x886e, 0x88a4, 0x4eb5, 0x8114, 0x88d2, 0x7980, 0x5b34, + 0x8803, 0x7fb8, 0x51ab, 0x51b1, 0x51bd, 0x51bc, + /* 0xda */ + 0x8d0e, 0x8d0f, 0x8d10, 0x8d11, 0x8d12, 0x8d13, 0x8d14, 0x8d15, + 0x8d16, 0x8d17, 0x8d18, 0x8d19, 0x8d1a, 0x8d1b, 0x8d1c, 0x8d20, + 0x8d51, 0x8d52, 0x8d57, 0x8d5f, 0x8d65, 0x8d68, 0x8d69, 0x8d6a, + 0x8d6c, 0x8d6e, 0x8d6f, 0x8d71, 0x8d72, 0x8d78, 0x8d79, 0x8d7a, + 0x8d7b, 0x8d7c, 0x8d7d, 0x8d7e, 0x8d7f, 0x8d80, 0x8d82, 0x8d83, + 0x8d86, 0x8d87, 0x8d88, 0x8d89, 0x8d8c, 0x8d8d, 0x8d8e, 0x8d8f, + 0x8d90, 0x8d92, 0x8d93, 0x8d95, 0x8d96, 0x8d97, 0x8d98, 0x8d99, + 0x8d9a, 0x8d9b, 0x8d9c, 0x8d9d, 0x8d9e, 0x8da0, 0x8da1, 0x8da2, + 0x8da4, 0x8da5, 0x8da6, 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, + 0x8dac, 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db2, 0x8db6, 0x8db7, + 0x8db9, 0x8dbb, 0x8dbd, 0x8dc0, 0x8dc1, 0x8dc2, 0x8dc5, 0x8dc7, + 0x8dc8, 0x8dc9, 0x8dca, 0x8dcd, 0x8dd0, 0x8dd2, 0x8dd3, 0x8dd4, + 0x51c7, 0x5196, 0x51a2, 0x51a5, 0x8ba0, 0x8ba6, 0x8ba7, 0x8baa, + 0x8bb4, 0x8bb5, 0x8bb7, 0x8bc2, 0x8bc3, 0x8bcb, 0x8bcf, 0x8bce, + 0x8bd2, 0x8bd3, 0x8bd4, 0x8bd6, 0x8bd8, 0x8bd9, 0x8bdc, 0x8bdf, + 0x8be0, 0x8be4, 0x8be8, 0x8be9, 0x8bee, 0x8bf0, 0x8bf3, 0x8bf6, + 0x8bf9, 0x8bfc, 0x8bff, 0x8c00, 0x8c02, 0x8c04, 0x8c07, 0x8c0c, + 0x8c0f, 0x8c11, 0x8c12, 0x8c14, 0x8c15, 0x8c16, 0x8c19, 0x8c1b, + 0x8c18, 0x8c1d, 0x8c1f, 0x8c20, 0x8c21, 0x8c25, 0x8c27, 0x8c2a, + 0x8c2b, 0x8c2e, 0x8c2f, 0x8c32, 0x8c33, 0x8c35, 0x8c36, 0x5369, + 0x537a, 0x961d, 0x9622, 0x9621, 0x9631, 0x962a, 0x963d, 0x963c, + 0x9642, 0x9649, 0x9654, 0x965f, 0x9667, 0x966c, 0x9672, 0x9674, + 0x9688, 0x968d, 0x9697, 0x96b0, 0x9097, 0x909b, 0x909d, 0x9099, + 0x90ac, 0x90a1, 0x90b4, 0x90b3, 0x90b6, 0x90ba, + /* 0xdb */ + 0x8dd5, 0x8dd8, 0x8dd9, 0x8ddc, 0x8de0, 0x8de1, 0x8de2, 0x8de5, + 0x8de6, 0x8de7, 0x8de9, 0x8ded, 0x8dee, 0x8df0, 0x8df1, 0x8df2, + 0x8df4, 0x8df6, 0x8dfc, 0x8dfe, 0x8dff, 0x8e00, 0x8e01, 0x8e02, + 0x8e03, 0x8e04, 0x8e06, 0x8e07, 0x8e08, 0x8e0b, 0x8e0d, 0x8e0e, + 0x8e10, 0x8e11, 0x8e12, 0x8e13, 0x8e15, 0x8e16, 0x8e17, 0x8e18, + 0x8e19, 0x8e1a, 0x8e1b, 0x8e1c, 0x8e20, 0x8e21, 0x8e24, 0x8e25, + 0x8e26, 0x8e27, 0x8e28, 0x8e2b, 0x8e2d, 0x8e30, 0x8e32, 0x8e33, + 0x8e34, 0x8e36, 0x8e37, 0x8e38, 0x8e3b, 0x8e3c, 0x8e3e, 0x8e3f, + 0x8e43, 0x8e45, 0x8e46, 0x8e4c, 0x8e4d, 0x8e4e, 0x8e4f, 0x8e50, + 0x8e53, 0x8e54, 0x8e55, 0x8e56, 0x8e57, 0x8e58, 0x8e5a, 0x8e5b, + 0x8e5c, 0x8e5d, 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0x8e63, + 0x8e64, 0x8e65, 0x8e67, 0x8e68, 0x8e6a, 0x8e6b, 0x8e6e, 0x8e71, + 0x90b8, 0x90b0, 0x90cf, 0x90c5, 0x90be, 0x90d0, 0x90c4, 0x90c7, + 0x90d3, 0x90e6, 0x90e2, 0x90dc, 0x90d7, 0x90db, 0x90eb, 0x90ef, + 0x90fe, 0x9104, 0x9122, 0x911e, 0x9123, 0x9131, 0x912f, 0x9139, + 0x9143, 0x9146, 0x520d, 0x5942, 0x52a2, 0x52ac, 0x52ad, 0x52be, + 0x54ff, 0x52d0, 0x52d6, 0x52f0, 0x53df, 0x71ee, 0x77cd, 0x5ef4, + 0x51f5, 0x51fc, 0x9b2f, 0x53b6, 0x5f01, 0x755a, 0x5def, 0x574c, + 0x57a9, 0x57a1, 0x587e, 0x58bc, 0x58c5, 0x58d1, 0x5729, 0x572c, + 0x572a, 0x5733, 0x5739, 0x572e, 0x572f, 0x575c, 0x573b, 0x5742, + 0x5769, 0x5785, 0x576b, 0x5786, 0x577c, 0x577b, 0x5768, 0x576d, + 0x5776, 0x5773, 0x57ad, 0x57a4, 0x578c, 0x57b2, 0x57cf, 0x57a7, + 0x57b4, 0x5793, 0x57a0, 0x57d5, 0x57d8, 0x57da, 0x57d9, 0x57d2, + 0x57b8, 0x57f4, 0x57ef, 0x57f8, 0x57e4, 0x57dd, + /* 0xdc */ + 0x8e73, 0x8e75, 0x8e77, 0x8e78, 0x8e79, 0x8e7a, 0x8e7b, 0x8e7d, + 0x8e7e, 0x8e80, 0x8e82, 0x8e83, 0x8e84, 0x8e86, 0x8e88, 0x8e89, + 0x8e8a, 0x8e8b, 0x8e8c, 0x8e8d, 0x8e8e, 0x8e91, 0x8e92, 0x8e93, + 0x8e95, 0x8e96, 0x8e97, 0x8e98, 0x8e99, 0x8e9a, 0x8e9b, 0x8e9d, + 0x8e9f, 0x8ea0, 0x8ea1, 0x8ea2, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, + 0x8ea7, 0x8ea8, 0x8ea9, 0x8eaa, 0x8ead, 0x8eae, 0x8eb0, 0x8eb1, + 0x8eb3, 0x8eb4, 0x8eb5, 0x8eb6, 0x8eb7, 0x8eb8, 0x8eb9, 0x8ebb, + 0x8ebc, 0x8ebd, 0x8ebe, 0x8ebf, 0x8ec0, 0x8ec1, 0x8ec2, 0x8ec3, + 0x8ec4, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, 0x8eca, 0x8ecb, + 0x8ecc, 0x8ecd, 0x8ecf, 0x8ed0, 0x8ed1, 0x8ed2, 0x8ed3, 0x8ed4, + 0x8ed5, 0x8ed6, 0x8ed7, 0x8ed8, 0x8ed9, 0x8eda, 0x8edb, 0x8edc, + 0x8edd, 0x8ede, 0x8edf, 0x8ee0, 0x8ee1, 0x8ee2, 0x8ee3, 0x8ee4, + 0x580b, 0x580d, 0x57fd, 0x57ed, 0x5800, 0x581e, 0x5819, 0x5844, + 0x5820, 0x5865, 0x586c, 0x5881, 0x5889, 0x589a, 0x5880, 0x99a8, + 0x9f19, 0x61ff, 0x8279, 0x827d, 0x827f, 0x828f, 0x828a, 0x82a8, + 0x8284, 0x828e, 0x8291, 0x8297, 0x8299, 0x82ab, 0x82b8, 0x82be, + 0x82b0, 0x82c8, 0x82ca, 0x82e3, 0x8298, 0x82b7, 0x82ae, 0x82cb, + 0x82cc, 0x82c1, 0x82a9, 0x82b4, 0x82a1, 0x82aa, 0x829f, 0x82c4, + 0x82ce, 0x82a4, 0x82e1, 0x8309, 0x82f7, 0x82e4, 0x830f, 0x8307, + 0x82dc, 0x82f4, 0x82d2, 0x82d8, 0x830c, 0x82fb, 0x82d3, 0x8311, + 0x831a, 0x8306, 0x8314, 0x8315, 0x82e0, 0x82d5, 0x831c, 0x8351, + 0x835b, 0x835c, 0x8308, 0x8392, 0x833c, 0x8334, 0x8331, 0x839b, + 0x835e, 0x832f, 0x834f, 0x8347, 0x8343, 0x835f, 0x8340, 0x8317, + 0x8360, 0x832d, 0x833a, 0x8333, 0x8366, 0x8365, + /* 0xdd */ + 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, + 0x8eed, 0x8eee, 0x8eef, 0x8ef0, 0x8ef1, 0x8ef2, 0x8ef3, 0x8ef4, + 0x8ef5, 0x8ef6, 0x8ef7, 0x8ef8, 0x8ef9, 0x8efa, 0x8efb, 0x8efc, + 0x8efd, 0x8efe, 0x8eff, 0x8f00, 0x8f01, 0x8f02, 0x8f03, 0x8f04, + 0x8f05, 0x8f06, 0x8f07, 0x8f08, 0x8f09, 0x8f0a, 0x8f0b, 0x8f0c, + 0x8f0d, 0x8f0e, 0x8f0f, 0x8f10, 0x8f11, 0x8f12, 0x8f13, 0x8f14, + 0x8f15, 0x8f16, 0x8f17, 0x8f18, 0x8f19, 0x8f1a, 0x8f1b, 0x8f1c, + 0x8f1d, 0x8f1e, 0x8f1f, 0x8f20, 0x8f21, 0x8f22, 0x8f23, 0x8f24, + 0x8f25, 0x8f26, 0x8f27, 0x8f28, 0x8f29, 0x8f2a, 0x8f2b, 0x8f2c, + 0x8f2d, 0x8f2e, 0x8f2f, 0x8f30, 0x8f31, 0x8f32, 0x8f33, 0x8f34, + 0x8f35, 0x8f36, 0x8f37, 0x8f38, 0x8f39, 0x8f3a, 0x8f3b, 0x8f3c, + 0x8f3d, 0x8f3e, 0x8f3f, 0x8f40, 0x8f41, 0x8f42, 0x8f43, 0x8f44, + 0x8368, 0x831b, 0x8369, 0x836c, 0x836a, 0x836d, 0x836e, 0x83b0, + 0x8378, 0x83b3, 0x83b4, 0x83a0, 0x83aa, 0x8393, 0x839c, 0x8385, + 0x837c, 0x83b6, 0x83a9, 0x837d, 0x83b8, 0x837b, 0x8398, 0x839e, + 0x83a8, 0x83ba, 0x83bc, 0x83c1, 0x8401, 0x83e5, 0x83d8, 0x5807, + 0x8418, 0x840b, 0x83dd, 0x83fd, 0x83d6, 0x841c, 0x8438, 0x8411, + 0x8406, 0x83d4, 0x83df, 0x840f, 0x8403, 0x83f8, 0x83f9, 0x83ea, + 0x83c5, 0x83c0, 0x8426, 0x83f0, 0x83e1, 0x845c, 0x8451, 0x845a, + 0x8459, 0x8473, 0x8487, 0x8488, 0x847a, 0x8489, 0x8478, 0x843c, + 0x8446, 0x8469, 0x8476, 0x848c, 0x848e, 0x8431, 0x846d, 0x84c1, + 0x84cd, 0x84d0, 0x84e6, 0x84bd, 0x84d3, 0x84ca, 0x84bf, 0x84ba, + 0x84e0, 0x84a1, 0x84b9, 0x84b4, 0x8497, 0x84e5, 0x84e3, 0x850c, + 0x750d, 0x8538, 0x84f0, 0x8539, 0x851f, 0x853a, + /* 0xde */ + 0x8f45, 0x8f46, 0x8f47, 0x8f48, 0x8f49, 0x8f4a, 0x8f4b, 0x8f4c, + 0x8f4d, 0x8f4e, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, 0x8f53, 0x8f54, + 0x8f55, 0x8f56, 0x8f57, 0x8f58, 0x8f59, 0x8f5a, 0x8f5b, 0x8f5c, + 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, 0x8f61, 0x8f62, 0x8f63, 0x8f64, + 0x8f65, 0x8f6a, 0x8f80, 0x8f8c, 0x8f92, 0x8f9d, 0x8fa0, 0x8fa1, + 0x8fa2, 0x8fa4, 0x8fa5, 0x8fa6, 0x8fa7, 0x8faa, 0x8fac, 0x8fad, + 0x8fae, 0x8faf, 0x8fb2, 0x8fb3, 0x8fb4, 0x8fb5, 0x8fb7, 0x8fb8, + 0x8fba, 0x8fbb, 0x8fbc, 0x8fbf, 0x8fc0, 0x8fc3, 0x8fc6, 0x8fc9, + 0x8fca, 0x8fcb, 0x8fcc, 0x8fcd, 0x8fcf, 0x8fd2, 0x8fd6, 0x8fd7, + 0x8fda, 0x8fe0, 0x8fe1, 0x8fe3, 0x8fe7, 0x8fec, 0x8fef, 0x8ff1, + 0x8ff2, 0x8ff4, 0x8ff5, 0x8ff6, 0x8ffa, 0x8ffb, 0x8ffc, 0x8ffe, + 0x8fff, 0x9007, 0x9008, 0x900c, 0x900e, 0x9013, 0x9015, 0x9018, + 0x8556, 0x853b, 0x84ff, 0x84fc, 0x8559, 0x8548, 0x8568, 0x8564, + 0x855e, 0x857a, 0x77a2, 0x8543, 0x8572, 0x857b, 0x85a4, 0x85a8, + 0x8587, 0x858f, 0x8579, 0x85ae, 0x859c, 0x8585, 0x85b9, 0x85b7, + 0x85b0, 0x85d3, 0x85c1, 0x85dc, 0x85ff, 0x8627, 0x8605, 0x8629, + 0x8616, 0x863c, 0x5efe, 0x5f08, 0x593c, 0x5941, 0x8037, 0x5955, + 0x595a, 0x5958, 0x530f, 0x5c22, 0x5c25, 0x5c2c, 0x5c34, 0x624c, + 0x626a, 0x629f, 0x62bb, 0x62ca, 0x62da, 0x62d7, 0x62ee, 0x6322, + 0x62f6, 0x6339, 0x634b, 0x6343, 0x63ad, 0x63f6, 0x6371, 0x637a, + 0x638e, 0x63b4, 0x636d, 0x63ac, 0x638a, 0x6369, 0x63ae, 0x63bc, + 0x63f2, 0x63f8, 0x63e0, 0x63ff, 0x63c4, 0x63de, 0x63ce, 0x6452, + 0x63c6, 0x63be, 0x6445, 0x6441, 0x640b, 0x641b, 0x6420, 0x640c, + 0x6426, 0x6421, 0x645e, 0x6484, 0x646d, 0x6496, + /* 0xdf */ + 0x9019, 0x901c, 0x9023, 0x9024, 0x9025, 0x9027, 0x9028, 0x9029, + 0x902a, 0x902b, 0x902c, 0x9030, 0x9031, 0x9032, 0x9033, 0x9034, + 0x9037, 0x9039, 0x903a, 0x903d, 0x903f, 0x9040, 0x9043, 0x9045, + 0x9046, 0x9048, 0x9049, 0x904a, 0x904b, 0x904c, 0x904e, 0x9054, + 0x9055, 0x9056, 0x9059, 0x905a, 0x905c, 0x905d, 0x905e, 0x905f, + 0x9060, 0x9061, 0x9064, 0x9066, 0x9067, 0x9069, 0x906a, 0x906b, + 0x906c, 0x906f, 0x9070, 0x9071, 0x9072, 0x9073, 0x9076, 0x9077, + 0x9078, 0x9079, 0x907a, 0x907b, 0x907c, 0x907e, 0x9081, 0x9084, + 0x9085, 0x9086, 0x9087, 0x9089, 0x908a, 0x908c, 0x908d, 0x908e, + 0x908f, 0x9090, 0x9092, 0x9094, 0x9096, 0x9098, 0x909a, 0x909c, + 0x909e, 0x909f, 0x90a0, 0x90a4, 0x90a5, 0x90a7, 0x90a8, 0x90a9, + 0x90ab, 0x90ad, 0x90b2, 0x90b7, 0x90bc, 0x90bd, 0x90bf, 0x90c0, + 0x647a, 0x64b7, 0x64b8, 0x6499, 0x64ba, 0x64c0, 0x64d0, 0x64d7, + 0x64e4, 0x64e2, 0x6509, 0x6525, 0x652e, 0x5f0b, 0x5fd2, 0x7519, + 0x5f11, 0x535f, 0x53f1, 0x53fd, 0x53e9, 0x53e8, 0x53fb, 0x5412, + 0x5416, 0x5406, 0x544b, 0x5452, 0x5453, 0x5454, 0x5456, 0x5443, + 0x5421, 0x5457, 0x5459, 0x5423, 0x5432, 0x5482, 0x5494, 0x5477, + 0x5471, 0x5464, 0x549a, 0x549b, 0x5484, 0x5476, 0x5466, 0x549d, + 0x54d0, 0x54ad, 0x54c2, 0x54b4, 0x54d2, 0x54a7, 0x54a6, 0x54d3, + 0x54d4, 0x5472, 0x54a3, 0x54d5, 0x54bb, 0x54bf, 0x54cc, 0x54d9, + 0x54da, 0x54dc, 0x54a9, 0x54aa, 0x54a4, 0x54dd, 0x54cf, 0x54de, + 0x551b, 0x54e7, 0x5520, 0x54fd, 0x5514, 0x54f3, 0x5522, 0x5523, + 0x550f, 0x5511, 0x5527, 0x552a, 0x5567, 0x558f, 0x55b5, 0x5549, + 0x556d, 0x5541, 0x5555, 0x553f, 0x5550, 0x553c, + /* 0xe0 */ + 0x90c2, 0x90c3, 0x90c6, 0x90c8, 0x90c9, 0x90cb, 0x90cc, 0x90cd, + 0x90d2, 0x90d4, 0x90d5, 0x90d6, 0x90d8, 0x90d9, 0x90da, 0x90de, + 0x90df, 0x90e0, 0x90e3, 0x90e4, 0x90e5, 0x90e9, 0x90ea, 0x90ec, + 0x90ee, 0x90f0, 0x90f1, 0x90f2, 0x90f3, 0x90f5, 0x90f6, 0x90f7, + 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90ff, 0x9100, 0x9101, 0x9103, + 0x9105, 0x9106, 0x9107, 0x9108, 0x9109, 0x910a, 0x910b, 0x910c, + 0x910d, 0x910e, 0x910f, 0x9110, 0x9111, 0x9112, 0x9113, 0x9114, + 0x9115, 0x9116, 0x9117, 0x9118, 0x911a, 0x911b, 0x911c, 0x911d, + 0x911f, 0x9120, 0x9121, 0x9124, 0x9125, 0x9126, 0x9127, 0x9128, + 0x9129, 0x912a, 0x912b, 0x912c, 0x912d, 0x912e, 0x9130, 0x9132, + 0x9133, 0x9134, 0x9135, 0x9136, 0x9137, 0x9138, 0x913a, 0x913b, + 0x913c, 0x913d, 0x913e, 0x913f, 0x9140, 0x9141, 0x9142, 0x9144, + 0x5537, 0x5556, 0x5575, 0x5576, 0x5577, 0x5533, 0x5530, 0x555c, + 0x558b, 0x55d2, 0x5583, 0x55b1, 0x55b9, 0x5588, 0x5581, 0x559f, + 0x557e, 0x55d6, 0x5591, 0x557b, 0x55df, 0x55bd, 0x55be, 0x5594, + 0x5599, 0x55ea, 0x55f7, 0x55c9, 0x561f, 0x55d1, 0x55eb, 0x55ec, + 0x55d4, 0x55e6, 0x55dd, 0x55c4, 0x55ef, 0x55e5, 0x55f2, 0x55f3, + 0x55cc, 0x55cd, 0x55e8, 0x55f5, 0x55e4, 0x8f94, 0x561e, 0x5608, + 0x560c, 0x5601, 0x5624, 0x5623, 0x55fe, 0x5600, 0x5627, 0x562d, + 0x5658, 0x5639, 0x5657, 0x562c, 0x564d, 0x5662, 0x5659, 0x565c, + 0x564c, 0x5654, 0x5686, 0x5664, 0x5671, 0x566b, 0x567b, 0x567c, + 0x5685, 0x5693, 0x56af, 0x56d4, 0x56d7, 0x56dd, 0x56e1, 0x56f5, + 0x56eb, 0x56f9, 0x56ff, 0x5704, 0x570a, 0x5709, 0x571c, 0x5e0f, + 0x5e19, 0x5e14, 0x5e11, 0x5e31, 0x5e3b, 0x5e3c, + /* 0xe1 */ + 0x9145, 0x9147, 0x9148, 0x9151, 0x9153, 0x9154, 0x9155, 0x9156, + 0x9158, 0x9159, 0x915b, 0x915c, 0x915f, 0x9160, 0x9166, 0x9167, + 0x9168, 0x916b, 0x916d, 0x9173, 0x917a, 0x917b, 0x917c, 0x9180, + 0x9181, 0x9182, 0x9183, 0x9184, 0x9186, 0x9188, 0x918a, 0x918e, + 0x918f, 0x9193, 0x9194, 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, + 0x919c, 0x919d, 0x919e, 0x919f, 0x91a0, 0x91a1, 0x91a4, 0x91a5, + 0x91a6, 0x91a7, 0x91a8, 0x91a9, 0x91ab, 0x91ac, 0x91b0, 0x91b1, + 0x91b2, 0x91b3, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91bb, 0x91bc, + 0x91bd, 0x91be, 0x91bf, 0x91c0, 0x91c1, 0x91c2, 0x91c3, 0x91c4, + 0x91c5, 0x91c6, 0x91c8, 0x91cb, 0x91d0, 0x91d2, 0x91d3, 0x91d4, + 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0x91d9, 0x91da, 0x91db, 0x91dd, + 0x91de, 0x91df, 0x91e0, 0x91e1, 0x91e2, 0x91e3, 0x91e4, 0x91e5, + 0x5e37, 0x5e44, 0x5e54, 0x5e5b, 0x5e5e, 0x5e61, 0x5c8c, 0x5c7a, + 0x5c8d, 0x5c90, 0x5c96, 0x5c88, 0x5c98, 0x5c99, 0x5c91, 0x5c9a, + 0x5c9c, 0x5cb5, 0x5ca2, 0x5cbd, 0x5cac, 0x5cab, 0x5cb1, 0x5ca3, + 0x5cc1, 0x5cb7, 0x5cc4, 0x5cd2, 0x5ce4, 0x5ccb, 0x5ce5, 0x5d02, + 0x5d03, 0x5d27, 0x5d26, 0x5d2e, 0x5d24, 0x5d1e, 0x5d06, 0x5d1b, + 0x5d58, 0x5d3e, 0x5d34, 0x5d3d, 0x5d6c, 0x5d5b, 0x5d6f, 0x5d5d, + 0x5d6b, 0x5d4b, 0x5d4a, 0x5d69, 0x5d74, 0x5d82, 0x5d99, 0x5d9d, + 0x8c73, 0x5db7, 0x5dc5, 0x5f73, 0x5f77, 0x5f82, 0x5f87, 0x5f89, + 0x5f8c, 0x5f95, 0x5f99, 0x5f9c, 0x5fa8, 0x5fad, 0x5fb5, 0x5fbc, + 0x8862, 0x5f61, 0x72ad, 0x72b0, 0x72b4, 0x72b7, 0x72b8, 0x72c3, + 0x72c1, 0x72ce, 0x72cd, 0x72d2, 0x72e8, 0x72ef, 0x72e9, 0x72f2, + 0x72f4, 0x72f7, 0x7301, 0x72f3, 0x7303, 0x72fa, + /* 0xe2 */ + 0x91e6, 0x91e7, 0x91e8, 0x91e9, 0x91ea, 0x91eb, 0x91ec, 0x91ed, + 0x91ee, 0x91ef, 0x91f0, 0x91f1, 0x91f2, 0x91f3, 0x91f4, 0x91f5, + 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0x91fa, 0x91fb, 0x91fc, 0x91fd, + 0x91fe, 0x91ff, 0x9200, 0x9201, 0x9202, 0x9203, 0x9204, 0x9205, + 0x9206, 0x9207, 0x9208, 0x9209, 0x920a, 0x920b, 0x920c, 0x920d, + 0x920e, 0x920f, 0x9210, 0x9211, 0x9212, 0x9213, 0x9214, 0x9215, + 0x9216, 0x9217, 0x9218, 0x9219, 0x921a, 0x921b, 0x921c, 0x921d, + 0x921e, 0x921f, 0x9220, 0x9221, 0x9222, 0x9223, 0x9224, 0x9225, + 0x9226, 0x9227, 0x9228, 0x9229, 0x922a, 0x922b, 0x922c, 0x922d, + 0x922e, 0x922f, 0x9230, 0x9231, 0x9232, 0x9233, 0x9234, 0x9235, + 0x9236, 0x9237, 0x9238, 0x9239, 0x923a, 0x923b, 0x923c, 0x923d, + 0x923e, 0x923f, 0x9240, 0x9241, 0x9242, 0x9243, 0x9244, 0x9245, + 0x72fb, 0x7317, 0x7313, 0x7321, 0x730a, 0x731e, 0x731d, 0x7315, + 0x7322, 0x7339, 0x7325, 0x732c, 0x7338, 0x7331, 0x7350, 0x734d, + 0x7357, 0x7360, 0x736c, 0x736f, 0x737e, 0x821b, 0x5925, 0x98e7, + 0x5924, 0x5902, 0x9963, 0x9967, 0x9968, 0x9969, 0x996a, 0x996b, + 0x996c, 0x9974, 0x9977, 0x997d, 0x9980, 0x9984, 0x9987, 0x998a, + 0x998d, 0x9990, 0x9991, 0x9993, 0x9994, 0x9995, 0x5e80, 0x5e91, + 0x5e8b, 0x5e96, 0x5ea5, 0x5ea0, 0x5eb9, 0x5eb5, 0x5ebe, 0x5eb3, + 0x8d53, 0x5ed2, 0x5ed1, 0x5edb, 0x5ee8, 0x5eea, 0x81ba, 0x5fc4, + 0x5fc9, 0x5fd6, 0x5fcf, 0x6003, 0x5fee, 0x6004, 0x5fe1, 0x5fe4, + 0x5ffe, 0x6005, 0x6006, 0x5fea, 0x5fed, 0x5ff8, 0x6019, 0x6035, + 0x6026, 0x601b, 0x600f, 0x600d, 0x6029, 0x602b, 0x600a, 0x603f, + 0x6021, 0x6078, 0x6079, 0x607b, 0x607a, 0x6042, + /* 0xe3 */ + 0x9246, 0x9247, 0x9248, 0x9249, 0x924a, 0x924b, 0x924c, 0x924d, + 0x924e, 0x924f, 0x9250, 0x9251, 0x9252, 0x9253, 0x9254, 0x9255, + 0x9256, 0x9257, 0x9258, 0x9259, 0x925a, 0x925b, 0x925c, 0x925d, + 0x925e, 0x925f, 0x9260, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, + 0x9266, 0x9267, 0x9268, 0x9269, 0x926a, 0x926b, 0x926c, 0x926d, + 0x926e, 0x926f, 0x9270, 0x9271, 0x9272, 0x9273, 0x9275, 0x9276, + 0x9277, 0x9278, 0x9279, 0x927a, 0x927b, 0x927c, 0x927d, 0x927e, + 0x927f, 0x9280, 0x9281, 0x9282, 0x9283, 0x9284, 0x9285, 0x9286, + 0x9287, 0x9288, 0x9289, 0x928a, 0x928b, 0x928c, 0x928d, 0x928f, + 0x9290, 0x9291, 0x9292, 0x9293, 0x9294, 0x9295, 0x9296, 0x9297, + 0x9298, 0x9299, 0x929a, 0x929b, 0x929c, 0x929d, 0x929e, 0x929f, + 0x92a0, 0x92a1, 0x92a2, 0x92a3, 0x92a4, 0x92a5, 0x92a6, 0x92a7, + 0x606a, 0x607d, 0x6096, 0x609a, 0x60ad, 0x609d, 0x6083, 0x6092, + 0x608c, 0x609b, 0x60ec, 0x60bb, 0x60b1, 0x60dd, 0x60d8, 0x60c6, + 0x60da, 0x60b4, 0x6120, 0x6126, 0x6115, 0x6123, 0x60f4, 0x6100, + 0x610e, 0x612b, 0x614a, 0x6175, 0x61ac, 0x6194, 0x61a7, 0x61b7, + 0x61d4, 0x61f5, 0x5fdd, 0x96b3, 0x95e9, 0x95eb, 0x95f1, 0x95f3, + 0x95f5, 0x95f6, 0x95fc, 0x95fe, 0x9603, 0x9604, 0x9606, 0x9608, + 0x960a, 0x960b, 0x960c, 0x960d, 0x960f, 0x9612, 0x9615, 0x9616, + 0x9617, 0x9619, 0x961a, 0x4e2c, 0x723f, 0x6215, 0x6c35, 0x6c54, + 0x6c5c, 0x6c4a, 0x6ca3, 0x6c85, 0x6c90, 0x6c94, 0x6c8c, 0x6c68, + 0x6c69, 0x6c74, 0x6c76, 0x6c86, 0x6ca9, 0x6cd0, 0x6cd4, 0x6cad, + 0x6cf7, 0x6cf8, 0x6cf1, 0x6cd7, 0x6cb2, 0x6ce0, 0x6cd6, 0x6cfa, + 0x6ceb, 0x6cee, 0x6cb1, 0x6cd3, 0x6cef, 0x6cfe, + /* 0xe4 */ + 0x92a8, 0x92a9, 0x92aa, 0x92ab, 0x92ac, 0x92ad, 0x92af, 0x92b0, + 0x92b1, 0x92b2, 0x92b3, 0x92b4, 0x92b5, 0x92b6, 0x92b7, 0x92b8, + 0x92b9, 0x92ba, 0x92bb, 0x92bc, 0x92bd, 0x92be, 0x92bf, 0x92c0, + 0x92c1, 0x92c2, 0x92c3, 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0x92c9, + 0x92ca, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92cf, 0x92d0, 0x92d1, + 0x92d2, 0x92d3, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0x92d8, 0x92d9, + 0x92da, 0x92db, 0x92dc, 0x92dd, 0x92de, 0x92df, 0x92e0, 0x92e1, + 0x92e2, 0x92e3, 0x92e4, 0x92e5, 0x92e6, 0x92e7, 0x92e8, 0x92e9, + 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, 0x92f1, + 0x92f2, 0x92f3, 0x92f4, 0x92f5, 0x92f6, 0x92f7, 0x92f8, 0x92f9, + 0x92fa, 0x92fb, 0x92fc, 0x92fd, 0x92fe, 0x92ff, 0x9300, 0x9301, + 0x9302, 0x9303, 0x9304, 0x9305, 0x9306, 0x9307, 0x9308, 0x9309, + 0x6d39, 0x6d27, 0x6d0c, 0x6d43, 0x6d48, 0x6d07, 0x6d04, 0x6d19, + 0x6d0e, 0x6d2b, 0x6d4d, 0x6d2e, 0x6d35, 0x6d1a, 0x6d4f, 0x6d52, + 0x6d54, 0x6d33, 0x6d91, 0x6d6f, 0x6d9e, 0x6da0, 0x6d5e, 0x6d93, + 0x6d94, 0x6d5c, 0x6d60, 0x6d7c, 0x6d63, 0x6e1a, 0x6dc7, 0x6dc5, + 0x6dde, 0x6e0e, 0x6dbf, 0x6de0, 0x6e11, 0x6de6, 0x6ddd, 0x6dd9, + 0x6e16, 0x6dab, 0x6e0c, 0x6dae, 0x6e2b, 0x6e6e, 0x6e4e, 0x6e6b, + 0x6eb2, 0x6e5f, 0x6e86, 0x6e53, 0x6e54, 0x6e32, 0x6e25, 0x6e44, + 0x6edf, 0x6eb1, 0x6e98, 0x6ee0, 0x6f2d, 0x6ee2, 0x6ea5, 0x6ea7, + 0x6ebd, 0x6ebb, 0x6eb7, 0x6ed7, 0x6eb4, 0x6ecf, 0x6e8f, 0x6ec2, + 0x6e9f, 0x6f62, 0x6f46, 0x6f47, 0x6f24, 0x6f15, 0x6ef9, 0x6f2f, + 0x6f36, 0x6f4b, 0x6f74, 0x6f2a, 0x6f09, 0x6f29, 0x6f89, 0x6f8d, + 0x6f8c, 0x6f78, 0x6f72, 0x6f7c, 0x6f7a, 0x6fd1, + /* 0xe5 */ + 0x930a, 0x930b, 0x930c, 0x930d, 0x930e, 0x930f, 0x9310, 0x9311, + 0x9312, 0x9313, 0x9314, 0x9315, 0x9316, 0x9317, 0x9318, 0x9319, + 0x931a, 0x931b, 0x931c, 0x931d, 0x931e, 0x931f, 0x9320, 0x9321, + 0x9322, 0x9323, 0x9324, 0x9325, 0x9326, 0x9327, 0x9328, 0x9329, + 0x932a, 0x932b, 0x932c, 0x932d, 0x932e, 0x932f, 0x9330, 0x9331, + 0x9332, 0x9333, 0x9334, 0x9335, 0x9336, 0x9337, 0x9338, 0x9339, + 0x933a, 0x933b, 0x933c, 0x933d, 0x933f, 0x9340, 0x9341, 0x9342, + 0x9343, 0x9344, 0x9345, 0x9346, 0x9347, 0x9348, 0x9349, 0x934a, + 0x934b, 0x934c, 0x934d, 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, + 0x9353, 0x9354, 0x9355, 0x9356, 0x9357, 0x9358, 0x9359, 0x935a, + 0x935b, 0x935c, 0x935d, 0x935e, 0x935f, 0x9360, 0x9361, 0x9362, + 0x9363, 0x9364, 0x9365, 0x9366, 0x9367, 0x9368, 0x9369, 0x936b, + 0x6fc9, 0x6fa7, 0x6fb9, 0x6fb6, 0x6fc2, 0x6fe1, 0x6fee, 0x6fde, + 0x6fe0, 0x6fef, 0x701a, 0x7023, 0x701b, 0x7039, 0x7035, 0x704f, + 0x705e, 0x5b80, 0x5b84, 0x5b95, 0x5b93, 0x5ba5, 0x5bb8, 0x752f, + 0x9a9e, 0x6434, 0x5be4, 0x5bee, 0x8930, 0x5bf0, 0x8e47, 0x8b07, + 0x8fb6, 0x8fd3, 0x8fd5, 0x8fe5, 0x8fee, 0x8fe4, 0x8fe9, 0x8fe6, + 0x8ff3, 0x8fe8, 0x9005, 0x9004, 0x900b, 0x9026, 0x9011, 0x900d, + 0x9016, 0x9021, 0x9035, 0x9036, 0x902d, 0x902f, 0x9044, 0x9051, + 0x9052, 0x9050, 0x9068, 0x9058, 0x9062, 0x905b, 0x66b9, 0x9074, + 0x907d, 0x9082, 0x9088, 0x9083, 0x908b, 0x5f50, 0x5f57, 0x5f56, + 0x5f58, 0x5c3b, 0x54ab, 0x5c50, 0x5c59, 0x5b71, 0x5c63, 0x5c66, + 0x7fbc, 0x5f2a, 0x5f29, 0x5f2d, 0x8274, 0x5f3c, 0x9b3b, 0x5c6e, + 0x5981, 0x5983, 0x598d, 0x59a9, 0x59aa, 0x59a3, + /* 0xe6 */ + 0x936c, 0x936d, 0x936e, 0x936f, 0x9370, 0x9371, 0x9372, 0x9373, + 0x9374, 0x9375, 0x9376, 0x9377, 0x9378, 0x9379, 0x937a, 0x937b, + 0x937c, 0x937d, 0x937e, 0x937f, 0x9380, 0x9381, 0x9382, 0x9383, + 0x9384, 0x9385, 0x9386, 0x9387, 0x9388, 0x9389, 0x938a, 0x938b, + 0x938c, 0x938d, 0x938e, 0x9390, 0x9391, 0x9392, 0x9393, 0x9394, + 0x9395, 0x9396, 0x9397, 0x9398, 0x9399, 0x939a, 0x939b, 0x939c, + 0x939d, 0x939e, 0x939f, 0x93a0, 0x93a1, 0x93a2, 0x93a3, 0x93a4, + 0x93a5, 0x93a6, 0x93a7, 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, + 0x93ad, 0x93ae, 0x93af, 0x93b0, 0x93b1, 0x93b2, 0x93b3, 0x93b4, + 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, + 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, 0x93c2, 0x93c3, 0x93c4, + 0x93c5, 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93cb, 0x93cc, 0x93cd, + 0x5997, 0x59ca, 0x59ab, 0x599e, 0x59a4, 0x59d2, 0x59b2, 0x59af, + 0x59d7, 0x59be, 0x5a05, 0x5a06, 0x59dd, 0x5a08, 0x59e3, 0x59d8, + 0x59f9, 0x5a0c, 0x5a09, 0x5a32, 0x5a34, 0x5a11, 0x5a23, 0x5a13, + 0x5a40, 0x5a67, 0x5a4a, 0x5a55, 0x5a3c, 0x5a62, 0x5a75, 0x80ec, + 0x5aaa, 0x5a9b, 0x5a77, 0x5a7a, 0x5abe, 0x5aeb, 0x5ab2, 0x5ad2, + 0x5ad4, 0x5ab8, 0x5ae0, 0x5ae3, 0x5af1, 0x5ad6, 0x5ae6, 0x5ad8, + 0x5adc, 0x5b09, 0x5b17, 0x5b16, 0x5b32, 0x5b37, 0x5b40, 0x5c15, + 0x5c1c, 0x5b5a, 0x5b65, 0x5b73, 0x5b51, 0x5b53, 0x5b62, 0x9a75, + 0x9a77, 0x9a78, 0x9a7a, 0x9a7f, 0x9a7d, 0x9a80, 0x9a81, 0x9a85, + 0x9a88, 0x9a8a, 0x9a90, 0x9a92, 0x9a93, 0x9a96, 0x9a98, 0x9a9b, + 0x9a9c, 0x9a9d, 0x9a9f, 0x9aa0, 0x9aa2, 0x9aa3, 0x9aa5, 0x9aa7, + 0x7e9f, 0x7ea1, 0x7ea3, 0x7ea5, 0x7ea8, 0x7ea9, + /* 0xe7 */ + 0x93ce, 0x93cf, 0x93d0, 0x93d1, 0x93d2, 0x93d3, 0x93d4, 0x93d5, + 0x93d7, 0x93d8, 0x93d9, 0x93da, 0x93db, 0x93dc, 0x93dd, 0x93de, + 0x93df, 0x93e0, 0x93e1, 0x93e2, 0x93e3, 0x93e4, 0x93e5, 0x93e6, + 0x93e7, 0x93e8, 0x93e9, 0x93ea, 0x93eb, 0x93ec, 0x93ed, 0x93ee, + 0x93ef, 0x93f0, 0x93f1, 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, + 0x93f7, 0x93f8, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0x93fd, 0x93fe, + 0x93ff, 0x9400, 0x9401, 0x9402, 0x9403, 0x9404, 0x9405, 0x9406, + 0x9407, 0x9408, 0x9409, 0x940a, 0x940b, 0x940c, 0x940d, 0x940e, + 0x940f, 0x9410, 0x9411, 0x9412, 0x9413, 0x9414, 0x9415, 0x9416, + 0x9417, 0x9418, 0x9419, 0x941a, 0x941b, 0x941c, 0x941d, 0x941e, + 0x941f, 0x9420, 0x9421, 0x9422, 0x9423, 0x9424, 0x9425, 0x9426, + 0x9427, 0x9428, 0x9429, 0x942a, 0x942b, 0x942c, 0x942d, 0x942e, + 0x7ead, 0x7eb0, 0x7ebe, 0x7ec0, 0x7ec1, 0x7ec2, 0x7ec9, 0x7ecb, + 0x7ecc, 0x7ed0, 0x7ed4, 0x7ed7, 0x7edb, 0x7ee0, 0x7ee1, 0x7ee8, + 0x7eeb, 0x7eee, 0x7eef, 0x7ef1, 0x7ef2, 0x7f0d, 0x7ef6, 0x7efa, + 0x7efb, 0x7efe, 0x7f01, 0x7f02, 0x7f03, 0x7f07, 0x7f08, 0x7f0b, + 0x7f0c, 0x7f0f, 0x7f11, 0x7f12, 0x7f17, 0x7f19, 0x7f1c, 0x7f1b, + 0x7f1f, 0x7f21, 0x7f22, 0x7f23, 0x7f24, 0x7f25, 0x7f26, 0x7f27, + 0x7f2a, 0x7f2b, 0x7f2c, 0x7f2d, 0x7f2f, 0x7f30, 0x7f31, 0x7f32, + 0x7f33, 0x7f35, 0x5e7a, 0x757f, 0x5ddb, 0x753e, 0x9095, 0x738e, + 0x7391, 0x73ae, 0x73a2, 0x739f, 0x73cf, 0x73c2, 0x73d1, 0x73b7, + 0x73b3, 0x73c0, 0x73c9, 0x73c8, 0x73e5, 0x73d9, 0x987c, 0x740a, + 0x73e9, 0x73e7, 0x73de, 0x73ba, 0x73f2, 0x740f, 0x742a, 0x745b, + 0x7426, 0x7425, 0x7428, 0x7430, 0x742e, 0x742c, + /* 0xe8 */ + 0x942f, 0x9430, 0x9431, 0x9432, 0x9433, 0x9434, 0x9435, 0x9436, + 0x9437, 0x9438, 0x9439, 0x943a, 0x943b, 0x943c, 0x943d, 0x943f, + 0x9440, 0x9441, 0x9442, 0x9443, 0x9444, 0x9445, 0x9446, 0x9447, + 0x9448, 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, + 0x9450, 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, + 0x9458, 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, + 0x9460, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, + 0x9468, 0x9469, 0x946a, 0x946c, 0x946d, 0x946e, 0x946f, 0x9470, + 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, 0x9476, 0x9477, 0x9478, + 0x9479, 0x947a, 0x947b, 0x947c, 0x947d, 0x947e, 0x947f, 0x9480, + 0x9481, 0x9482, 0x9483, 0x9484, 0x9491, 0x9496, 0x9498, 0x94c7, + 0x94cf, 0x94d3, 0x94d4, 0x94da, 0x94e6, 0x94fb, 0x951c, 0x9520, + 0x741b, 0x741a, 0x7441, 0x745c, 0x7457, 0x7455, 0x7459, 0x7477, + 0x746d, 0x747e, 0x749c, 0x748e, 0x7480, 0x7481, 0x7487, 0x748b, + 0x749e, 0x74a8, 0x74a9, 0x7490, 0x74a7, 0x74d2, 0x74ba, 0x97ea, + 0x97eb, 0x97ec, 0x674c, 0x6753, 0x675e, 0x6748, 0x6769, 0x67a5, + 0x6787, 0x676a, 0x6773, 0x6798, 0x67a7, 0x6775, 0x67a8, 0x679e, + 0x67ad, 0x678b, 0x6777, 0x677c, 0x67f0, 0x6809, 0x67d8, 0x680a, + 0x67e9, 0x67b0, 0x680c, 0x67d9, 0x67b5, 0x67da, 0x67b3, 0x67dd, + 0x6800, 0x67c3, 0x67b8, 0x67e2, 0x680e, 0x67c1, 0x67fd, 0x6832, + 0x6833, 0x6860, 0x6861, 0x684e, 0x6862, 0x6844, 0x6864, 0x6883, + 0x681d, 0x6855, 0x6866, 0x6841, 0x6867, 0x6840, 0x683e, 0x684a, + 0x6849, 0x6829, 0x68b5, 0x688f, 0x6874, 0x6877, 0x6893, 0x686b, + 0x68c2, 0x696e, 0x68fc, 0x691f, 0x6920, 0x68f9, + /* 0xe9 */ + 0x9527, 0x9533, 0x953d, 0x9543, 0x9548, 0x954b, 0x9555, 0x955a, + 0x9560, 0x956e, 0x9574, 0x9575, 0x9577, 0x9578, 0x9579, 0x957a, + 0x957b, 0x957c, 0x957d, 0x957e, 0x9580, 0x9581, 0x9582, 0x9583, + 0x9584, 0x9585, 0x9586, 0x9587, 0x9588, 0x9589, 0x958a, 0x958b, + 0x958c, 0x958d, 0x958e, 0x958f, 0x9590, 0x9591, 0x9592, 0x9593, + 0x9594, 0x9595, 0x9596, 0x9597, 0x9598, 0x9599, 0x959a, 0x959b, + 0x959c, 0x959d, 0x959e, 0x959f, 0x95a0, 0x95a1, 0x95a2, 0x95a3, + 0x95a4, 0x95a5, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0x95aa, 0x95ab, + 0x95ac, 0x95ad, 0x95ae, 0x95af, 0x95b0, 0x95b1, 0x95b2, 0x95b3, + 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0x95b8, 0x95b9, 0x95ba, 0x95bb, + 0x95bc, 0x95bd, 0x95be, 0x95bf, 0x95c0, 0x95c1, 0x95c2, 0x95c3, + 0x95c4, 0x95c5, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0x95ca, 0x95cb, + 0x6924, 0x68f0, 0x690b, 0x6901, 0x6957, 0x68e3, 0x6910, 0x6971, + 0x6939, 0x6960, 0x6942, 0x695d, 0x6984, 0x696b, 0x6980, 0x6998, + 0x6978, 0x6934, 0x69cc, 0x6987, 0x6988, 0x69ce, 0x6989, 0x6966, + 0x6963, 0x6979, 0x699b, 0x69a7, 0x69bb, 0x69ab, 0x69ad, 0x69d4, + 0x69b1, 0x69c1, 0x69ca, 0x69df, 0x6995, 0x69e0, 0x698d, 0x69ff, + 0x6a2f, 0x69ed, 0x6a17, 0x6a18, 0x6a65, 0x69f2, 0x6a44, 0x6a3e, + 0x6aa0, 0x6a50, 0x6a5b, 0x6a35, 0x6a8e, 0x6a79, 0x6a3d, 0x6a28, + 0x6a58, 0x6a7c, 0x6a91, 0x6a90, 0x6aa9, 0x6a97, 0x6aab, 0x7337, + 0x7352, 0x6b81, 0x6b82, 0x6b87, 0x6b84, 0x6b92, 0x6b93, 0x6b8d, + 0x6b9a, 0x6b9b, 0x6ba1, 0x6baa, 0x8f6b, 0x8f6d, 0x8f71, 0x8f72, + 0x8f73, 0x8f75, 0x8f76, 0x8f78, 0x8f77, 0x8f79, 0x8f7a, 0x8f7c, + 0x8f7e, 0x8f81, 0x8f82, 0x8f84, 0x8f87, 0x8f8b, + /* 0xea */ + 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, 0x95d3, + 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0x95d9, 0x95da, 0x95db, + 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, 0x95e3, + 0x95e4, 0x95e5, 0x95e6, 0x95e7, 0x95ec, 0x95ff, 0x9607, 0x9613, + 0x9618, 0x961b, 0x961e, 0x9620, 0x9623, 0x9624, 0x9625, 0x9626, + 0x9627, 0x9628, 0x9629, 0x962b, 0x962c, 0x962d, 0x962f, 0x9630, + 0x9637, 0x9638, 0x9639, 0x963a, 0x963e, 0x9641, 0x9643, 0x964a, + 0x964e, 0x964f, 0x9651, 0x9652, 0x9653, 0x9656, 0x9657, 0x9658, + 0x9659, 0x965a, 0x965c, 0x965d, 0x965e, 0x9660, 0x9663, 0x9665, + 0x9666, 0x966b, 0x966d, 0x966e, 0x966f, 0x9670, 0x9671, 0x9673, + 0x9678, 0x9679, 0x967a, 0x967b, 0x967c, 0x967d, 0x967e, 0x967f, + 0x9680, 0x9681, 0x9682, 0x9683, 0x9684, 0x9687, 0x9689, 0x968a, + 0x8f8d, 0x8f8e, 0x8f8f, 0x8f98, 0x8f9a, 0x8ece, 0x620b, 0x6217, + 0x621b, 0x621f, 0x6222, 0x6221, 0x6225, 0x6224, 0x622c, 0x81e7, + 0x74ef, 0x74f4, 0x74ff, 0x750f, 0x7511, 0x7513, 0x6534, 0x65ee, + 0x65ef, 0x65f0, 0x660a, 0x6619, 0x6772, 0x6603, 0x6615, 0x6600, + 0x7085, 0x66f7, 0x661d, 0x6634, 0x6631, 0x6636, 0x6635, 0x8006, + 0x665f, 0x6654, 0x6641, 0x664f, 0x6656, 0x6661, 0x6657, 0x6677, + 0x6684, 0x668c, 0x66a7, 0x669d, 0x66be, 0x66db, 0x66dc, 0x66e6, + 0x66e9, 0x8d32, 0x8d33, 0x8d36, 0x8d3b, 0x8d3d, 0x8d40, 0x8d45, + 0x8d46, 0x8d48, 0x8d49, 0x8d47, 0x8d4d, 0x8d55, 0x8d59, 0x89c7, + 0x89ca, 0x89cb, 0x89cc, 0x89ce, 0x89cf, 0x89d0, 0x89d1, 0x726e, + 0x729f, 0x725d, 0x7266, 0x726f, 0x727e, 0x727f, 0x7284, 0x728b, + 0x728d, 0x728f, 0x7292, 0x6308, 0x6332, 0x63b0, + /* 0xeb */ + 0x968c, 0x968e, 0x9691, 0x9692, 0x9693, 0x9695, 0x9696, 0x969a, + 0x969b, 0x969d, 0x969e, 0x969f, 0x96a0, 0x96a1, 0x96a2, 0x96a3, + 0x96a4, 0x96a5, 0x96a6, 0x96a8, 0x96a9, 0x96aa, 0x96ab, 0x96ac, + 0x96ad, 0x96ae, 0x96af, 0x96b1, 0x96b2, 0x96b4, 0x96b5, 0x96b7, + 0x96b8, 0x96ba, 0x96bb, 0x96bf, 0x96c2, 0x96c3, 0x96c8, 0x96ca, + 0x96cb, 0x96d0, 0x96d1, 0x96d3, 0x96d4, 0x96d6, 0x96d7, 0x96d8, + 0x96d9, 0x96da, 0x96db, 0x96dc, 0x96dd, 0x96de, 0x96df, 0x96e1, + 0x96e2, 0x96e3, 0x96e4, 0x96e5, 0x96e6, 0x96e7, 0x96eb, 0x96ec, + 0x96ed, 0x96ee, 0x96f0, 0x96f1, 0x96f2, 0x96f4, 0x96f5, 0x96f8, + 0x96fa, 0x96fb, 0x96fc, 0x96fd, 0x96ff, 0x9702, 0x9703, 0x9705, + 0x970a, 0x970b, 0x970c, 0x9710, 0x9711, 0x9712, 0x9714, 0x9715, + 0x9717, 0x9718, 0x9719, 0x971a, 0x971b, 0x971d, 0x971f, 0x9720, + 0x643f, 0x64d8, 0x8004, 0x6bea, 0x6bf3, 0x6bfd, 0x6bf5, 0x6bf9, + 0x6c05, 0x6c07, 0x6c06, 0x6c0d, 0x6c15, 0x6c18, 0x6c19, 0x6c1a, + 0x6c21, 0x6c29, 0x6c24, 0x6c2a, 0x6c32, 0x6535, 0x6555, 0x656b, + 0x724d, 0x7252, 0x7256, 0x7230, 0x8662, 0x5216, 0x809f, 0x809c, + 0x8093, 0x80bc, 0x670a, 0x80bd, 0x80b1, 0x80ab, 0x80ad, 0x80b4, + 0x80b7, 0x80e7, 0x80e8, 0x80e9, 0x80ea, 0x80db, 0x80c2, 0x80c4, + 0x80d9, 0x80cd, 0x80d7, 0x6710, 0x80dd, 0x80eb, 0x80f1, 0x80f4, + 0x80ed, 0x810d, 0x810e, 0x80f2, 0x80fc, 0x6715, 0x8112, 0x8c5a, + 0x8136, 0x811e, 0x812c, 0x8118, 0x8132, 0x8148, 0x814c, 0x8153, + 0x8174, 0x8159, 0x815a, 0x8171, 0x8160, 0x8169, 0x817c, 0x817d, + 0x816d, 0x8167, 0x584d, 0x5ab5, 0x8188, 0x8182, 0x8191, 0x6ed5, + 0x81a3, 0x81aa, 0x81cc, 0x6726, 0x81ca, 0x81bb, + /* 0xec */ + 0x9721, 0x9722, 0x9723, 0x9724, 0x9725, 0x9726, 0x9727, 0x9728, + 0x9729, 0x972b, 0x972c, 0x972e, 0x972f, 0x9731, 0x9733, 0x9734, + 0x9735, 0x9736, 0x9737, 0x973a, 0x973b, 0x973c, 0x973d, 0x973f, + 0x9740, 0x9741, 0x9742, 0x9743, 0x9744, 0x9745, 0x9746, 0x9747, + 0x9748, 0x9749, 0x974a, 0x974b, 0x974c, 0x974d, 0x974e, 0x974f, + 0x9750, 0x9751, 0x9754, 0x9755, 0x9757, 0x9758, 0x975a, 0x975c, + 0x975d, 0x975f, 0x9763, 0x9764, 0x9766, 0x9767, 0x9768, 0x976a, + 0x976b, 0x976c, 0x976d, 0x976e, 0x976f, 0x9770, 0x9771, 0x9772, + 0x9775, 0x9777, 0x9778, 0x9779, 0x977a, 0x977b, 0x977d, 0x977e, + 0x977f, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9786, 0x9787, + 0x9788, 0x9789, 0x978a, 0x978c, 0x978e, 0x978f, 0x9790, 0x9793, + 0x9795, 0x9796, 0x9797, 0x9799, 0x979a, 0x979b, 0x979c, 0x979d, + 0x81c1, 0x81a6, 0x6b24, 0x6b37, 0x6b39, 0x6b43, 0x6b46, 0x6b59, + 0x98d1, 0x98d2, 0x98d3, 0x98d5, 0x98d9, 0x98da, 0x6bb3, 0x5f40, + 0x6bc2, 0x89f3, 0x6590, 0x9f51, 0x6593, 0x65bc, 0x65c6, 0x65c4, + 0x65c3, 0x65cc, 0x65ce, 0x65d2, 0x65d6, 0x7080, 0x709c, 0x7096, + 0x709d, 0x70bb, 0x70c0, 0x70b7, 0x70ab, 0x70b1, 0x70e8, 0x70ca, + 0x7110, 0x7113, 0x7116, 0x712f, 0x7131, 0x7173, 0x715c, 0x7168, + 0x7145, 0x7172, 0x714a, 0x7178, 0x717a, 0x7198, 0x71b3, 0x71b5, + 0x71a8, 0x71a0, 0x71e0, 0x71d4, 0x71e7, 0x71f9, 0x721d, 0x7228, + 0x706c, 0x7118, 0x7166, 0x71b9, 0x623e, 0x623d, 0x6243, 0x6248, + 0x6249, 0x793b, 0x7940, 0x7946, 0x7949, 0x795b, 0x795c, 0x7953, + 0x795a, 0x7962, 0x7957, 0x7960, 0x796f, 0x7967, 0x797a, 0x7985, + 0x798a, 0x799a, 0x79a7, 0x79b3, 0x5fd1, 0x5fd0, + /* 0xed */ + 0x979e, 0x979f, 0x97a1, 0x97a2, 0x97a4, 0x97a5, 0x97a6, 0x97a7, + 0x97a8, 0x97a9, 0x97aa, 0x97ac, 0x97ae, 0x97b0, 0x97b1, 0x97b3, + 0x97b5, 0x97b6, 0x97b7, 0x97b8, 0x97b9, 0x97ba, 0x97bb, 0x97bc, + 0x97bd, 0x97be, 0x97bf, 0x97c0, 0x97c1, 0x97c2, 0x97c3, 0x97c4, + 0x97c5, 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, + 0x97cd, 0x97ce, 0x97cf, 0x97d0, 0x97d1, 0x97d2, 0x97d3, 0x97d4, + 0x97d5, 0x97d6, 0x97d7, 0x97d8, 0x97d9, 0x97da, 0x97db, 0x97dc, + 0x97dd, 0x97de, 0x97df, 0x97e0, 0x97e1, 0x97e2, 0x97e3, 0x97e4, + 0x97e5, 0x97e8, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f4, + 0x97f7, 0x97f8, 0x97f9, 0x97fa, 0x97fb, 0x97fc, 0x97fd, 0x97fe, + 0x97ff, 0x9800, 0x9801, 0x9802, 0x9803, 0x9804, 0x9805, 0x9806, + 0x9807, 0x9808, 0x9809, 0x980a, 0x980b, 0x980c, 0x980d, 0x980e, + 0x603c, 0x605d, 0x605a, 0x6067, 0x6041, 0x6059, 0x6063, 0x60ab, + 0x6106, 0x610d, 0x615d, 0x61a9, 0x619d, 0x61cb, 0x61d1, 0x6206, + 0x8080, 0x807f, 0x6c93, 0x6cf6, 0x6dfc, 0x77f6, 0x77f8, 0x7800, + 0x7809, 0x7817, 0x7818, 0x7811, 0x65ab, 0x782d, 0x781c, 0x781d, + 0x7839, 0x783a, 0x783b, 0x781f, 0x783c, 0x7825, 0x782c, 0x7823, + 0x7829, 0x784e, 0x786d, 0x7856, 0x7857, 0x7826, 0x7850, 0x7847, + 0x784c, 0x786a, 0x789b, 0x7893, 0x789a, 0x7887, 0x789c, 0x78a1, + 0x78a3, 0x78b2, 0x78b9, 0x78a5, 0x78d4, 0x78d9, 0x78c9, 0x78ec, + 0x78f2, 0x7905, 0x78f4, 0x7913, 0x7924, 0x791e, 0x7934, 0x9f9b, + 0x9ef9, 0x9efb, 0x9efc, 0x76f1, 0x7704, 0x770d, 0x76f9, 0x7707, + 0x7708, 0x771a, 0x7722, 0x7719, 0x772d, 0x7726, 0x7735, 0x7738, + 0x7750, 0x7751, 0x7747, 0x7743, 0x775a, 0x7768, + /* 0xee */ + 0x980f, 0x9810, 0x9811, 0x9812, 0x9813, 0x9814, 0x9815, 0x9816, + 0x9817, 0x9818, 0x9819, 0x981a, 0x981b, 0x981c, 0x981d, 0x981e, + 0x981f, 0x9820, 0x9821, 0x9822, 0x9823, 0x9824, 0x9825, 0x9826, + 0x9827, 0x9828, 0x9829, 0x982a, 0x982b, 0x982c, 0x982d, 0x982e, + 0x982f, 0x9830, 0x9831, 0x9832, 0x9833, 0x9834, 0x9835, 0x9836, + 0x9837, 0x9838, 0x9839, 0x983a, 0x983b, 0x983c, 0x983d, 0x983e, + 0x983f, 0x9840, 0x9841, 0x9842, 0x9843, 0x9844, 0x9845, 0x9846, + 0x9847, 0x9848, 0x9849, 0x984a, 0x984b, 0x984c, 0x984d, 0x984e, + 0x984f, 0x9850, 0x9851, 0x9852, 0x9853, 0x9854, 0x9855, 0x9856, + 0x9857, 0x9858, 0x9859, 0x985a, 0x985b, 0x985c, 0x985d, 0x985e, + 0x985f, 0x9860, 0x9861, 0x9862, 0x9863, 0x9864, 0x9865, 0x9866, + 0x9867, 0x9868, 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, + 0x7762, 0x7765, 0x777f, 0x778d, 0x777d, 0x7780, 0x778c, 0x7791, + 0x779f, 0x77a0, 0x77b0, 0x77b5, 0x77bd, 0x753a, 0x7540, 0x754e, + 0x754b, 0x7548, 0x755b, 0x7572, 0x7579, 0x7583, 0x7f58, 0x7f61, + 0x7f5f, 0x8a48, 0x7f68, 0x7f74, 0x7f71, 0x7f79, 0x7f81, 0x7f7e, + 0x76cd, 0x76e5, 0x8832, 0x9485, 0x9486, 0x9487, 0x948b, 0x948a, + 0x948c, 0x948d, 0x948f, 0x9490, 0x9494, 0x9497, 0x9495, 0x949a, + 0x949b, 0x949c, 0x94a3, 0x94a4, 0x94ab, 0x94aa, 0x94ad, 0x94ac, + 0x94af, 0x94b0, 0x94b2, 0x94b4, 0x94b6, 0x94b7, 0x94b8, 0x94b9, + 0x94ba, 0x94bc, 0x94bd, 0x94bf, 0x94c4, 0x94c8, 0x94c9, 0x94ca, + 0x94cb, 0x94cc, 0x94cd, 0x94ce, 0x94d0, 0x94d1, 0x94d2, 0x94d5, + 0x94d6, 0x94d7, 0x94d9, 0x94d8, 0x94db, 0x94de, 0x94df, 0x94e0, + 0x94e2, 0x94e4, 0x94e5, 0x94e7, 0x94e8, 0x94ea, + /* 0xef */ + 0x986f, 0x9870, 0x9871, 0x9872, 0x9873, 0x9874, 0x988b, 0x988e, + 0x9892, 0x9895, 0x9899, 0x98a3, 0x98a8, 0x98a9, 0x98aa, 0x98ab, + 0x98ac, 0x98ad, 0x98ae, 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, + 0x98b4, 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, + 0x98bc, 0x98bd, 0x98be, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, + 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0x98cb, + 0x98cc, 0x98cd, 0x98cf, 0x98d0, 0x98d4, 0x98d6, 0x98d7, 0x98db, + 0x98dc, 0x98dd, 0x98e0, 0x98e1, 0x98e2, 0x98e3, 0x98e4, 0x98e5, + 0x98e6, 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0x98ed, 0x98ee, 0x98ef, + 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, 0x98f7, + 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, 0x98fe, 0x98ff, + 0x9900, 0x9901, 0x9902, 0x9903, 0x9904, 0x9905, 0x9906, 0x9907, + 0x94e9, 0x94eb, 0x94ee, 0x94ef, 0x94f3, 0x94f4, 0x94f5, 0x94f7, + 0x94f9, 0x94fc, 0x94fd, 0x94ff, 0x9503, 0x9502, 0x9506, 0x9507, + 0x9509, 0x950a, 0x950d, 0x950e, 0x950f, 0x9512, 0x9513, 0x9514, + 0x9515, 0x9516, 0x9518, 0x951b, 0x951d, 0x951e, 0x951f, 0x9522, + 0x952a, 0x952b, 0x9529, 0x952c, 0x9531, 0x9532, 0x9534, 0x9536, + 0x9537, 0x9538, 0x953c, 0x953e, 0x953f, 0x9542, 0x9535, 0x9544, + 0x9545, 0x9546, 0x9549, 0x954c, 0x954e, 0x954f, 0x9552, 0x9553, + 0x9554, 0x9556, 0x9557, 0x9558, 0x9559, 0x955b, 0x955e, 0x955f, + 0x955d, 0x9561, 0x9562, 0x9564, 0x9565, 0x9566, 0x9567, 0x9568, + 0x9569, 0x956a, 0x956b, 0x956c, 0x956f, 0x9571, 0x9572, 0x9573, + 0x953a, 0x77e7, 0x77ec, 0x96c9, 0x79d5, 0x79ed, 0x79e3, 0x79eb, + 0x7a06, 0x5d47, 0x7a03, 0x7a02, 0x7a1e, 0x7a14, + /* 0xf0 */ + 0x9908, 0x9909, 0x990a, 0x990b, 0x990c, 0x990e, 0x990f, 0x9911, + 0x9912, 0x9913, 0x9914, 0x9915, 0x9916, 0x9917, 0x9918, 0x9919, + 0x991a, 0x991b, 0x991c, 0x991d, 0x991e, 0x991f, 0x9920, 0x9921, + 0x9922, 0x9923, 0x9924, 0x9925, 0x9926, 0x9927, 0x9928, 0x9929, + 0x992a, 0x992b, 0x992c, 0x992d, 0x992f, 0x9930, 0x9931, 0x9932, + 0x9933, 0x9934, 0x9935, 0x9936, 0x9937, 0x9938, 0x9939, 0x993a, + 0x993b, 0x993c, 0x993d, 0x993e, 0x993f, 0x9940, 0x9941, 0x9942, + 0x9943, 0x9944, 0x9945, 0x9946, 0x9947, 0x9948, 0x9949, 0x994a, + 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, 0x9952, + 0x9953, 0x9956, 0x9957, 0x9958, 0x9959, 0x995a, 0x995b, 0x995c, + 0x995d, 0x995e, 0x995f, 0x9960, 0x9961, 0x9962, 0x9964, 0x9966, + 0x9973, 0x9978, 0x9979, 0x997b, 0x997e, 0x9982, 0x9983, 0x9989, + 0x7a39, 0x7a37, 0x7a51, 0x9ecf, 0x99a5, 0x7a70, 0x7688, 0x768e, + 0x7693, 0x7699, 0x76a4, 0x74de, 0x74e0, 0x752c, 0x9e20, 0x9e22, + 0x9e28, 0x9e29, 0x9e2a, 0x9e2b, 0x9e2c, 0x9e32, 0x9e31, 0x9e36, + 0x9e38, 0x9e37, 0x9e39, 0x9e3a, 0x9e3e, 0x9e41, 0x9e42, 0x9e44, + 0x9e46, 0x9e47, 0x9e48, 0x9e49, 0x9e4b, 0x9e4c, 0x9e4e, 0x9e51, + 0x9e55, 0x9e57, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5e, 0x9e63, 0x9e66, + 0x9e67, 0x9e68, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e71, 0x9e6d, + 0x9e73, 0x7592, 0x7594, 0x7596, 0x75a0, 0x759d, 0x75ac, 0x75a3, + 0x75b3, 0x75b4, 0x75b8, 0x75c4, 0x75b1, 0x75b0, 0x75c3, 0x75c2, + 0x75d6, 0x75cd, 0x75e3, 0x75e8, 0x75e6, 0x75e4, 0x75eb, 0x75e7, + 0x7603, 0x75f1, 0x75fc, 0x75ff, 0x7610, 0x7600, 0x7605, 0x760c, + 0x7617, 0x760a, 0x7625, 0x7618, 0x7615, 0x7619, + /* 0xf1 */ + 0x998c, 0x998e, 0x999a, 0x999b, 0x999c, 0x999d, 0x999e, 0x999f, + 0x99a0, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a6, 0x99a7, 0x99a9, + 0x99aa, 0x99ab, 0x99ac, 0x99ad, 0x99ae, 0x99af, 0x99b0, 0x99b1, + 0x99b2, 0x99b3, 0x99b4, 0x99b5, 0x99b6, 0x99b7, 0x99b8, 0x99b9, + 0x99ba, 0x99bb, 0x99bc, 0x99bd, 0x99be, 0x99bf, 0x99c0, 0x99c1, + 0x99c2, 0x99c3, 0x99c4, 0x99c5, 0x99c6, 0x99c7, 0x99c8, 0x99c9, + 0x99ca, 0x99cb, 0x99cc, 0x99cd, 0x99ce, 0x99cf, 0x99d0, 0x99d1, + 0x99d2, 0x99d3, 0x99d4, 0x99d5, 0x99d6, 0x99d7, 0x99d8, 0x99d9, + 0x99da, 0x99db, 0x99dc, 0x99dd, 0x99de, 0x99df, 0x99e0, 0x99e1, + 0x99e2, 0x99e3, 0x99e4, 0x99e5, 0x99e6, 0x99e7, 0x99e8, 0x99e9, + 0x99ea, 0x99eb, 0x99ec, 0x99ed, 0x99ee, 0x99ef, 0x99f0, 0x99f1, + 0x99f2, 0x99f3, 0x99f4, 0x99f5, 0x99f6, 0x99f7, 0x99f8, 0x99f9, + 0x761b, 0x763c, 0x7622, 0x7620, 0x7640, 0x762d, 0x7630, 0x763f, + 0x7635, 0x7643, 0x763e, 0x7633, 0x764d, 0x765e, 0x7654, 0x765c, + 0x7656, 0x766b, 0x766f, 0x7fca, 0x7ae6, 0x7a78, 0x7a79, 0x7a80, + 0x7a86, 0x7a88, 0x7a95, 0x7aa6, 0x7aa0, 0x7aac, 0x7aa8, 0x7aad, + 0x7ab3, 0x8864, 0x8869, 0x8872, 0x887d, 0x887f, 0x8882, 0x88a2, + 0x88c6, 0x88b7, 0x88bc, 0x88c9, 0x88e2, 0x88ce, 0x88e3, 0x88e5, + 0x88f1, 0x891a, 0x88fc, 0x88e8, 0x88fe, 0x88f0, 0x8921, 0x8919, + 0x8913, 0x891b, 0x890a, 0x8934, 0x892b, 0x8936, 0x8941, 0x8966, + 0x897b, 0x758b, 0x80e5, 0x76b2, 0x76b4, 0x77dc, 0x8012, 0x8014, + 0x8016, 0x801c, 0x8020, 0x8022, 0x8025, 0x8026, 0x8027, 0x8029, + 0x8028, 0x8031, 0x800b, 0x8035, 0x8043, 0x8046, 0x804d, 0x8052, + 0x8069, 0x8071, 0x8983, 0x9878, 0x9880, 0x9883, + /* 0xf2 */ + 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x99ff, 0x9a00, 0x9a01, + 0x9a02, 0x9a03, 0x9a04, 0x9a05, 0x9a06, 0x9a07, 0x9a08, 0x9a09, + 0x9a0a, 0x9a0b, 0x9a0c, 0x9a0d, 0x9a0e, 0x9a0f, 0x9a10, 0x9a11, + 0x9a12, 0x9a13, 0x9a14, 0x9a15, 0x9a16, 0x9a17, 0x9a18, 0x9a19, + 0x9a1a, 0x9a1b, 0x9a1c, 0x9a1d, 0x9a1e, 0x9a1f, 0x9a20, 0x9a21, + 0x9a22, 0x9a23, 0x9a24, 0x9a25, 0x9a26, 0x9a27, 0x9a28, 0x9a29, + 0x9a2a, 0x9a2b, 0x9a2c, 0x9a2d, 0x9a2e, 0x9a2f, 0x9a30, 0x9a31, + 0x9a32, 0x9a33, 0x9a34, 0x9a35, 0x9a36, 0x9a37, 0x9a38, 0x9a39, + 0x9a3a, 0x9a3b, 0x9a3c, 0x9a3d, 0x9a3e, 0x9a3f, 0x9a40, 0x9a41, + 0x9a42, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0x9a47, 0x9a48, 0x9a49, + 0x9a4a, 0x9a4b, 0x9a4c, 0x9a4d, 0x9a4e, 0x9a4f, 0x9a50, 0x9a51, + 0x9a52, 0x9a53, 0x9a54, 0x9a55, 0x9a56, 0x9a57, 0x9a58, 0x9a59, + 0x9889, 0x988c, 0x988d, 0x988f, 0x9894, 0x989a, 0x989b, 0x989e, + 0x989f, 0x98a1, 0x98a2, 0x98a5, 0x98a6, 0x864d, 0x8654, 0x866c, + 0x866e, 0x867f, 0x867a, 0x867c, 0x867b, 0x86a8, 0x868d, 0x868b, + 0x86ac, 0x869d, 0x86a7, 0x86a3, 0x86aa, 0x8693, 0x86a9, 0x86b6, + 0x86c4, 0x86b5, 0x86ce, 0x86b0, 0x86ba, 0x86b1, 0x86af, 0x86c9, + 0x86cf, 0x86b4, 0x86e9, 0x86f1, 0x86f2, 0x86ed, 0x86f3, 0x86d0, + 0x8713, 0x86de, 0x86f4, 0x86df, 0x86d8, 0x86d1, 0x8703, 0x8707, + 0x86f8, 0x8708, 0x870a, 0x870d, 0x8709, 0x8723, 0x873b, 0x871e, + 0x8725, 0x872e, 0x871a, 0x873e, 0x8748, 0x8734, 0x8731, 0x8729, + 0x8737, 0x873f, 0x8782, 0x8722, 0x877d, 0x877e, 0x877b, 0x8760, + 0x8770, 0x874c, 0x876e, 0x878b, 0x8753, 0x8763, 0x877c, 0x8764, + 0x8759, 0x8765, 0x8793, 0x87af, 0x87a8, 0x87d2, + /* 0xf3 */ + 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, 0x9a5f, 0x9a60, 0x9a61, + 0x9a62, 0x9a63, 0x9a64, 0x9a65, 0x9a66, 0x9a67, 0x9a68, 0x9a69, + 0x9a6a, 0x9a6b, 0x9a72, 0x9a83, 0x9a89, 0x9a8d, 0x9a8e, 0x9a94, + 0x9a95, 0x9a99, 0x9aa6, 0x9aa9, 0x9aaa, 0x9aab, 0x9aac, 0x9aad, + 0x9aae, 0x9aaf, 0x9ab2, 0x9ab3, 0x9ab4, 0x9ab5, 0x9ab9, 0x9abb, + 0x9abd, 0x9abe, 0x9abf, 0x9ac3, 0x9ac4, 0x9ac6, 0x9ac7, 0x9ac8, + 0x9ac9, 0x9aca, 0x9acd, 0x9ace, 0x9acf, 0x9ad0, 0x9ad2, 0x9ad4, + 0x9ad5, 0x9ad6, 0x9ad7, 0x9ad9, 0x9ada, 0x9adb, 0x9adc, 0x9add, + 0x9ade, 0x9ae0, 0x9ae2, 0x9ae3, 0x9ae4, 0x9ae5, 0x9ae7, 0x9ae8, + 0x9ae9, 0x9aea, 0x9aec, 0x9aee, 0x9af0, 0x9af1, 0x9af2, 0x9af3, + 0x9af4, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9afa, 0x9afc, 0x9afd, + 0x9afe, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b04, 0x9b05, 0x9b06, + 0x87c6, 0x8788, 0x8785, 0x87ad, 0x8797, 0x8783, 0x87ab, 0x87e5, + 0x87ac, 0x87b5, 0x87b3, 0x87cb, 0x87d3, 0x87bd, 0x87d1, 0x87c0, + 0x87ca, 0x87db, 0x87ea, 0x87e0, 0x87ee, 0x8816, 0x8813, 0x87fe, + 0x880a, 0x881b, 0x8821, 0x8839, 0x883c, 0x7f36, 0x7f42, 0x7f44, + 0x7f45, 0x8210, 0x7afa, 0x7afd, 0x7b08, 0x7b03, 0x7b04, 0x7b15, + 0x7b0a, 0x7b2b, 0x7b0f, 0x7b47, 0x7b38, 0x7b2a, 0x7b19, 0x7b2e, + 0x7b31, 0x7b20, 0x7b25, 0x7b24, 0x7b33, 0x7b3e, 0x7b1e, 0x7b58, + 0x7b5a, 0x7b45, 0x7b75, 0x7b4c, 0x7b5d, 0x7b60, 0x7b6e, 0x7b7b, + 0x7b62, 0x7b72, 0x7b71, 0x7b90, 0x7ba6, 0x7ba7, 0x7bb8, 0x7bac, + 0x7b9d, 0x7ba8, 0x7b85, 0x7baa, 0x7b9c, 0x7ba2, 0x7bab, 0x7bb4, + 0x7bd1, 0x7bc1, 0x7bcc, 0x7bdd, 0x7bda, 0x7be5, 0x7be6, 0x7bea, + 0x7c0c, 0x7bfe, 0x7bfc, 0x7c0f, 0x7c16, 0x7c0b, + /* 0xf4 */ + 0x9b07, 0x9b09, 0x9b0a, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, 0x9b10, + 0x9b11, 0x9b12, 0x9b14, 0x9b15, 0x9b16, 0x9b17, 0x9b18, 0x9b19, + 0x9b1a, 0x9b1b, 0x9b1c, 0x9b1d, 0x9b1e, 0x9b20, 0x9b21, 0x9b22, + 0x9b24, 0x9b25, 0x9b26, 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2b, + 0x9b2c, 0x9b2d, 0x9b2e, 0x9b30, 0x9b31, 0x9b33, 0x9b34, 0x9b35, + 0x9b36, 0x9b37, 0x9b38, 0x9b39, 0x9b3a, 0x9b3d, 0x9b3e, 0x9b3f, + 0x9b40, 0x9b46, 0x9b4a, 0x9b4b, 0x9b4c, 0x9b4e, 0x9b50, 0x9b52, + 0x9b53, 0x9b55, 0x9b56, 0x9b57, 0x9b58, 0x9b59, 0x9b5a, 0x9b5b, + 0x9b5c, 0x9b5d, 0x9b5e, 0x9b5f, 0x9b60, 0x9b61, 0x9b62, 0x9b63, + 0x9b64, 0x9b65, 0x9b66, 0x9b67, 0x9b68, 0x9b69, 0x9b6a, 0x9b6b, + 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, 0x9b70, 0x9b71, 0x9b72, 0x9b73, + 0x9b74, 0x9b75, 0x9b76, 0x9b77, 0x9b78, 0x9b79, 0x9b7a, 0x9b7b, + 0x7c1f, 0x7c2a, 0x7c26, 0x7c38, 0x7c41, 0x7c40, 0x81fe, 0x8201, + 0x8202, 0x8204, 0x81ec, 0x8844, 0x8221, 0x8222, 0x8223, 0x822d, + 0x822f, 0x8228, 0x822b, 0x8238, 0x823b, 0x8233, 0x8234, 0x823e, + 0x8244, 0x8249, 0x824b, 0x824f, 0x825a, 0x825f, 0x8268, 0x887e, + 0x8885, 0x8888, 0x88d8, 0x88df, 0x895e, 0x7f9d, 0x7f9f, 0x7fa7, + 0x7faf, 0x7fb0, 0x7fb2, 0x7c7c, 0x6549, 0x7c91, 0x7c9d, 0x7c9c, + 0x7c9e, 0x7ca2, 0x7cb2, 0x7cbc, 0x7cbd, 0x7cc1, 0x7cc7, 0x7ccc, + 0x7ccd, 0x7cc8, 0x7cc5, 0x7cd7, 0x7ce8, 0x826e, 0x66a8, 0x7fbf, + 0x7fce, 0x7fd5, 0x7fe5, 0x7fe1, 0x7fe6, 0x7fe9, 0x7fee, 0x7ff3, + 0x7cf8, 0x7d77, 0x7da6, 0x7dae, 0x7e47, 0x7e9b, 0x9eb8, 0x9eb4, + 0x8d73, 0x8d84, 0x8d94, 0x8d91, 0x8db1, 0x8d67, 0x8d6d, 0x8c47, + 0x8c49, 0x914a, 0x9150, 0x914e, 0x914f, 0x9164, + /* 0xf5 */ + 0x9b7c, 0x9b7d, 0x9b7e, 0x9b7f, 0x9b80, 0x9b81, 0x9b82, 0x9b83, + 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b88, 0x9b89, 0x9b8a, 0x9b8b, + 0x9b8c, 0x9b8d, 0x9b8e, 0x9b8f, 0x9b90, 0x9b91, 0x9b92, 0x9b93, + 0x9b94, 0x9b95, 0x9b96, 0x9b97, 0x9b98, 0x9b99, 0x9b9a, 0x9b9b, + 0x9b9c, 0x9b9d, 0x9b9e, 0x9b9f, 0x9ba0, 0x9ba1, 0x9ba2, 0x9ba3, + 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0x9ba8, 0x9ba9, 0x9baa, 0x9bab, + 0x9bac, 0x9bad, 0x9bae, 0x9baf, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb3, + 0x9bb4, 0x9bb5, 0x9bb6, 0x9bb7, 0x9bb8, 0x9bb9, 0x9bba, 0x9bbb, + 0x9bbc, 0x9bbd, 0x9bbe, 0x9bbf, 0x9bc0, 0x9bc1, 0x9bc2, 0x9bc3, + 0x9bc4, 0x9bc5, 0x9bc6, 0x9bc7, 0x9bc8, 0x9bc9, 0x9bca, 0x9bcb, + 0x9bcc, 0x9bcd, 0x9bce, 0x9bcf, 0x9bd0, 0x9bd1, 0x9bd2, 0x9bd3, + 0x9bd4, 0x9bd5, 0x9bd6, 0x9bd7, 0x9bd8, 0x9bd9, 0x9bda, 0x9bdb, + 0x9162, 0x9161, 0x9170, 0x9169, 0x916f, 0x917d, 0x917e, 0x9172, + 0x9174, 0x9179, 0x918c, 0x9185, 0x9190, 0x918d, 0x9191, 0x91a2, + 0x91a3, 0x91aa, 0x91ad, 0x91ae, 0x91af, 0x91b5, 0x91b4, 0x91ba, + 0x8c55, 0x9e7e, 0x8db8, 0x8deb, 0x8e05, 0x8e59, 0x8e69, 0x8db5, + 0x8dbf, 0x8dbc, 0x8dba, 0x8dc4, 0x8dd6, 0x8dd7, 0x8dda, 0x8dde, + 0x8dce, 0x8dcf, 0x8ddb, 0x8dc6, 0x8dec, 0x8df7, 0x8df8, 0x8de3, + 0x8df9, 0x8dfb, 0x8de4, 0x8e09, 0x8dfd, 0x8e14, 0x8e1d, 0x8e1f, + 0x8e2c, 0x8e2e, 0x8e23, 0x8e2f, 0x8e3a, 0x8e40, 0x8e39, 0x8e35, + 0x8e3d, 0x8e31, 0x8e49, 0x8e41, 0x8e42, 0x8e51, 0x8e52, 0x8e4a, + 0x8e70, 0x8e76, 0x8e7c, 0x8e6f, 0x8e74, 0x8e85, 0x8e8f, 0x8e94, + 0x8e90, 0x8e9c, 0x8e9e, 0x8c78, 0x8c82, 0x8c8a, 0x8c85, 0x8c98, + 0x8c94, 0x659b, 0x89d6, 0x89de, 0x89da, 0x89dc, + /* 0xf6 */ + 0x9bdc, 0x9bdd, 0x9bde, 0x9bdf, 0x9be0, 0x9be1, 0x9be2, 0x9be3, + 0x9be4, 0x9be5, 0x9be6, 0x9be7, 0x9be8, 0x9be9, 0x9bea, 0x9beb, + 0x9bec, 0x9bed, 0x9bee, 0x9bef, 0x9bf0, 0x9bf1, 0x9bf2, 0x9bf3, + 0x9bf4, 0x9bf5, 0x9bf6, 0x9bf7, 0x9bf8, 0x9bf9, 0x9bfa, 0x9bfb, + 0x9bfc, 0x9bfd, 0x9bfe, 0x9bff, 0x9c00, 0x9c01, 0x9c02, 0x9c03, + 0x9c04, 0x9c05, 0x9c06, 0x9c07, 0x9c08, 0x9c09, 0x9c0a, 0x9c0b, + 0x9c0c, 0x9c0d, 0x9c0e, 0x9c0f, 0x9c10, 0x9c11, 0x9c12, 0x9c13, + 0x9c14, 0x9c15, 0x9c16, 0x9c17, 0x9c18, 0x9c19, 0x9c1a, 0x9c1b, + 0x9c1c, 0x9c1d, 0x9c1e, 0x9c1f, 0x9c20, 0x9c21, 0x9c22, 0x9c23, + 0x9c24, 0x9c25, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c2b, + 0x9c2c, 0x9c2d, 0x9c2e, 0x9c2f, 0x9c30, 0x9c31, 0x9c32, 0x9c33, + 0x9c34, 0x9c35, 0x9c36, 0x9c37, 0x9c38, 0x9c39, 0x9c3a, 0x9c3b, + 0x89e5, 0x89eb, 0x89ef, 0x8a3e, 0x8b26, 0x9753, 0x96e9, 0x96f3, + 0x96ef, 0x9706, 0x9701, 0x9708, 0x970f, 0x970e, 0x972a, 0x972d, + 0x9730, 0x973e, 0x9f80, 0x9f83, 0x9f85, 0x9f86, 0x9f87, 0x9f88, + 0x9f89, 0x9f8a, 0x9f8c, 0x9efe, 0x9f0b, 0x9f0d, 0x96b9, 0x96bc, + 0x96bd, 0x96ce, 0x96d2, 0x77bf, 0x96e0, 0x928e, 0x92ae, 0x92c8, + 0x933e, 0x936a, 0x93ca, 0x938f, 0x943e, 0x946b, 0x9c7f, 0x9c82, + 0x9c85, 0x9c86, 0x9c87, 0x9c88, 0x7a23, 0x9c8b, 0x9c8e, 0x9c90, + 0x9c91, 0x9c92, 0x9c94, 0x9c95, 0x9c9a, 0x9c9b, 0x9c9e, 0x9c9f, + 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca5, 0x9ca6, 0x9ca7, 0x9ca8, + 0x9ca9, 0x9cab, 0x9cad, 0x9cae, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, + 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cba, 0x9cbb, 0x9cbc, 0x9cbd, + 0x9cc4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cca, 0x9ccb, + /* 0xf7 */ + 0x9c3c, 0x9c3d, 0x9c3e, 0x9c3f, 0x9c40, 0x9c41, 0x9c42, 0x9c43, + 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0x9c48, 0x9c49, 0x9c4a, 0x9c4b, + 0x9c4c, 0x9c4d, 0x9c4e, 0x9c4f, 0x9c50, 0x9c51, 0x9c52, 0x9c53, + 0x9c54, 0x9c55, 0x9c56, 0x9c57, 0x9c58, 0x9c59, 0x9c5a, 0x9c5b, + 0x9c5c, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c60, 0x9c61, 0x9c62, 0x9c63, + 0x9c64, 0x9c65, 0x9c66, 0x9c67, 0x9c68, 0x9c69, 0x9c6a, 0x9c6b, + 0x9c6c, 0x9c6d, 0x9c6e, 0x9c6f, 0x9c70, 0x9c71, 0x9c72, 0x9c73, + 0x9c74, 0x9c75, 0x9c76, 0x9c77, 0x9c78, 0x9c79, 0x9c7a, 0x9c7b, + 0x9c7d, 0x9c7e, 0x9c80, 0x9c83, 0x9c84, 0x9c89, 0x9c8a, 0x9c8c, + 0x9c8f, 0x9c93, 0x9c96, 0x9c97, 0x9c98, 0x9c99, 0x9c9d, 0x9caa, + 0x9cac, 0x9caf, 0x9cb9, 0x9cbe, 0x9cbf, 0x9cc0, 0x9cc1, 0x9cc2, + 0x9cc8, 0x9cc9, 0x9cd1, 0x9cd2, 0x9cda, 0x9cdb, 0x9ce0, 0x9ce1, + 0x9ccc, 0x9ccd, 0x9cce, 0x9ccf, 0x9cd0, 0x9cd3, 0x9cd4, 0x9cd5, + 0x9cd7, 0x9cd8, 0x9cd9, 0x9cdc, 0x9cdd, 0x9cdf, 0x9ce2, 0x977c, + 0x9785, 0x9791, 0x9792, 0x9794, 0x97af, 0x97ab, 0x97a3, 0x97b2, + 0x97b4, 0x9ab1, 0x9ab0, 0x9ab7, 0x9e58, 0x9ab6, 0x9aba, 0x9abc, + 0x9ac1, 0x9ac0, 0x9ac5, 0x9ac2, 0x9acb, 0x9acc, 0x9ad1, 0x9b45, + 0x9b43, 0x9b47, 0x9b49, 0x9b48, 0x9b4d, 0x9b51, 0x98e8, 0x990d, + 0x992e, 0x9955, 0x9954, 0x9adf, 0x9ae1, 0x9ae6, 0x9aef, 0x9aeb, + 0x9afb, 0x9aed, 0x9af9, 0x9b08, 0x9b0f, 0x9b13, 0x9b1f, 0x9b23, + 0x9ebd, 0x9ebe, 0x7e3b, 0x9e82, 0x9e87, 0x9e88, 0x9e8b, 0x9e92, + 0x93d6, 0x9e9d, 0x9e9f, 0x9edb, 0x9edc, 0x9edd, 0x9ee0, 0x9edf, + 0x9ee2, 0x9ee9, 0x9ee7, 0x9ee5, 0x9eea, 0x9eef, 0x9f22, 0x9f2c, + 0x9f2f, 0x9f39, 0x9f37, 0x9f3d, 0x9f3e, 0x9f44, + /* 0xf8 */ + 0x9ce3, 0x9ce4, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0x9ce9, 0x9cea, + 0x9ceb, 0x9cec, 0x9ced, 0x9cee, 0x9cef, 0x9cf0, 0x9cf1, 0x9cf2, + 0x9cf3, 0x9cf4, 0x9cf5, 0x9cf6, 0x9cf7, 0x9cf8, 0x9cf9, 0x9cfa, + 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, 0x9cff, 0x9d00, 0x9d01, 0x9d02, + 0x9d03, 0x9d04, 0x9d05, 0x9d06, 0x9d07, 0x9d08, 0x9d09, 0x9d0a, + 0x9d0b, 0x9d0c, 0x9d0d, 0x9d0e, 0x9d0f, 0x9d10, 0x9d11, 0x9d12, + 0x9d13, 0x9d14, 0x9d15, 0x9d16, 0x9d17, 0x9d18, 0x9d19, 0x9d1a, + 0x9d1b, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d1f, 0x9d20, 0x9d21, 0x9d22, + 0x9d23, 0x9d24, 0x9d25, 0x9d26, 0x9d27, 0x9d28, 0x9d29, 0x9d2a, + 0x9d2b, 0x9d2c, 0x9d2d, 0x9d2e, 0x9d2f, 0x9d30, 0x9d31, 0x9d32, + 0x9d33, 0x9d34, 0x9d35, 0x9d36, 0x9d37, 0x9d38, 0x9d39, 0x9d3a, + 0x9d3b, 0x9d3c, 0x9d3d, 0x9d3e, 0x9d3f, 0x9d40, 0x9d41, 0x9d42, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xf9 */ + 0x9d43, 0x9d44, 0x9d45, 0x9d46, 0x9d47, 0x9d48, 0x9d49, 0x9d4a, + 0x9d4b, 0x9d4c, 0x9d4d, 0x9d4e, 0x9d4f, 0x9d50, 0x9d51, 0x9d52, + 0x9d53, 0x9d54, 0x9d55, 0x9d56, 0x9d57, 0x9d58, 0x9d59, 0x9d5a, + 0x9d5b, 0x9d5c, 0x9d5d, 0x9d5e, 0x9d5f, 0x9d60, 0x9d61, 0x9d62, + 0x9d63, 0x9d64, 0x9d65, 0x9d66, 0x9d67, 0x9d68, 0x9d69, 0x9d6a, + 0x9d6b, 0x9d6c, 0x9d6d, 0x9d6e, 0x9d6f, 0x9d70, 0x9d71, 0x9d72, + 0x9d73, 0x9d74, 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, + 0x9d7b, 0x9d7c, 0x9d7d, 0x9d7e, 0x9d7f, 0x9d80, 0x9d81, 0x9d82, + 0x9d83, 0x9d84, 0x9d85, 0x9d86, 0x9d87, 0x9d88, 0x9d89, 0x9d8a, + 0x9d8b, 0x9d8c, 0x9d8d, 0x9d8e, 0x9d8f, 0x9d90, 0x9d91, 0x9d92, + 0x9d93, 0x9d94, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9d99, 0x9d9a, + 0x9d9b, 0x9d9c, 0x9d9d, 0x9d9e, 0x9d9f, 0x9da0, 0x9da1, 0x9da2, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xfa */ + 0x9da3, 0x9da4, 0x9da5, 0x9da6, 0x9da7, 0x9da8, 0x9da9, 0x9daa, + 0x9dab, 0x9dac, 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0x9db1, 0x9db2, + 0x9db3, 0x9db4, 0x9db5, 0x9db6, 0x9db7, 0x9db8, 0x9db9, 0x9dba, + 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, + 0x9dc3, 0x9dc4, 0x9dc5, 0x9dc6, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, + 0x9dcb, 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, + 0x9dd3, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dd8, 0x9dd9, 0x9dda, + 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, 0x9de1, 0x9de2, + 0x9de3, 0x9de4, 0x9de5, 0x9de6, 0x9de7, 0x9de8, 0x9de9, 0x9dea, + 0x9deb, 0x9dec, 0x9ded, 0x9dee, 0x9def, 0x9df0, 0x9df1, 0x9df2, + 0x9df3, 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0x9dfa, + 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9dff, 0x9e00, 0x9e01, 0x9e02, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xfb */ + 0x9e03, 0x9e04, 0x9e05, 0x9e06, 0x9e07, 0x9e08, 0x9e09, 0x9e0a, + 0x9e0b, 0x9e0c, 0x9e0d, 0x9e0e, 0x9e0f, 0x9e10, 0x9e11, 0x9e12, + 0x9e13, 0x9e14, 0x9e15, 0x9e16, 0x9e17, 0x9e18, 0x9e19, 0x9e1a, + 0x9e1b, 0x9e1c, 0x9e1d, 0x9e1e, 0x9e24, 0x9e27, 0x9e2e, 0x9e30, + 0x9e34, 0x9e3b, 0x9e3c, 0x9e40, 0x9e4d, 0x9e50, 0x9e52, 0x9e53, + 0x9e54, 0x9e56, 0x9e59, 0x9e5d, 0x9e5f, 0x9e60, 0x9e61, 0x9e62, + 0x9e65, 0x9e6e, 0x9e6f, 0x9e72, 0x9e74, 0x9e75, 0x9e76, 0x9e77, + 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, 0x9e7c, 0x9e7d, 0x9e80, 0x9e81, + 0x9e83, 0x9e84, 0x9e85, 0x9e86, 0x9e89, 0x9e8a, 0x9e8c, 0x9e8d, + 0x9e8e, 0x9e8f, 0x9e90, 0x9e91, 0x9e94, 0x9e95, 0x9e96, 0x9e97, + 0x9e98, 0x9e99, 0x9e9a, 0x9e9b, 0x9e9c, 0x9e9e, 0x9ea0, 0x9ea1, + 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea7, 0x9ea8, 0x9ea9, 0x9eaa, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xfc */ + 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb1, 0x9eb2, + 0x9eb3, 0x9eb5, 0x9eb6, 0x9eb7, 0x9eb9, 0x9eba, 0x9ebc, 0x9ebf, + 0x9ec0, 0x9ec1, 0x9ec2, 0x9ec3, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, + 0x9eca, 0x9ecb, 0x9ecc, 0x9ed0, 0x9ed2, 0x9ed3, 0x9ed5, 0x9ed6, + 0x9ed7, 0x9ed9, 0x9eda, 0x9ede, 0x9ee1, 0x9ee3, 0x9ee4, 0x9ee6, + 0x9ee8, 0x9eeb, 0x9eec, 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, + 0x9ef3, 0x9ef4, 0x9ef5, 0x9ef6, 0x9ef7, 0x9ef8, 0x9efa, 0x9efd, + 0x9eff, 0x9f00, 0x9f01, 0x9f02, 0x9f03, 0x9f04, 0x9f05, 0x9f06, + 0x9f07, 0x9f08, 0x9f09, 0x9f0a, 0x9f0c, 0x9f0f, 0x9f11, 0x9f12, + 0x9f14, 0x9f15, 0x9f16, 0x9f18, 0x9f1a, 0x9f1b, 0x9f1c, 0x9f1d, + 0x9f1e, 0x9f1f, 0x9f21, 0x9f23, 0x9f24, 0x9f25, 0x9f26, 0x9f27, + 0x9f28, 0x9f29, 0x9f2a, 0x9f2b, 0x9f2d, 0x9f2e, 0x9f30, 0x9f31, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xfd */ + 0x9f32, 0x9f33, 0x9f34, 0x9f35, 0x9f36, 0x9f38, 0x9f3a, 0x9f3c, + 0x9f3f, 0x9f40, 0x9f41, 0x9f42, 0x9f43, 0x9f45, 0x9f46, 0x9f47, + 0x9f48, 0x9f49, 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, + 0x9f52, 0x9f53, 0x9f54, 0x9f55, 0x9f56, 0x9f57, 0x9f58, 0x9f59, + 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, 0x9f5f, 0x9f60, 0x9f61, + 0x9f62, 0x9f63, 0x9f64, 0x9f65, 0x9f66, 0x9f67, 0x9f68, 0x9f69, + 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, + 0x9f72, 0x9f73, 0x9f74, 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, + 0x9f7a, 0x9f7b, 0x9f7c, 0x9f7d, 0x9f7e, 0x9f81, 0x9f82, 0x9f8d, + 0x9f8e, 0x9f8f, 0x9f90, 0x9f91, 0x9f92, 0x9f93, 0x9f94, 0x9f95, + 0x9f96, 0x9f97, 0x9f98, 0x9f9c, 0x9f9d, 0x9f9e, 0x9fa1, 0x9fa2, + 0x9fa3, 0x9fa4, 0x9fa5, 0xf92c, 0xf979, 0xf995, 0xf9e7, 0xf9f1, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xfe */ + 0xfa0c, 0xfa0d, 0xfa0e, 0xfa0f, 0xfa11, 0xfa13, 0xfa14, 0xfa18, + 0xfa1f, 0xfa20, 0xfa21, 0xfa23, 0xfa24, 0xfa27, 0xfa28, 0xfa29, +}; + +static int +gbk_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = s[0]; + if ((c1 >= 0x81 && c1 <= 0xfe)) { + if (n >= 2) { + unsigned char c2 = s[1]; + if ((c2 >= 0x40 && c2 < 0x7f) || (c2 >= 0x80 && c2 < 0xff)) { + unsigned int i = 190 * (c1 - 0x81) + (c2 - (c2 >= 0x80 ? 0x41 : 0x40)); + unsigned short wc = 0xfffd; + { + if (i < 23766) + wc = gbk_2uni_page81[i]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short gbk_page00[208] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0xa1e8, 0x0000, 0x0000, 0xa1ec, /*0xa0-0xa7*/ + 0xa1a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ + 0xa1e3, 0xa1c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1a4, /*0xb0-0xb7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1c1, /*0xd0-0xd7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ + 0xa8a4, 0xa8a2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xe0-0xe7*/ + 0xa8a8, 0xa8a6, 0xa8ba, 0x0000, 0xa8ac, 0xa8aa, 0x0000, 0x0000, /*0xe8-0xef*/ + 0x0000, 0x0000, 0xa8b0, 0xa8ae, 0x0000, 0x0000, 0x0000, 0xa1c2, /*0xf0-0xf7*/ + 0x0000, 0xa8b4, 0xa8b2, 0x0000, 0xa8b9, 0x0000, 0x0000, 0x0000, /*0xf8-0xff*/ + /* 0x0100 */ + 0x0000, 0xa8a1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x00-0x07*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ + 0x0000, 0x0000, 0x0000, 0xa8a5, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ + 0x0000, 0x0000, 0x0000, 0xa8a7, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ + 0x0000, 0x0000, 0x0000, 0xa8a9, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa8bd, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ + 0xa8be, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8ad, 0x0000, 0x0000, /*0x48-0x4f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ + 0x0000, 0x0000, 0x0000, 0xa8b1, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ +}; +static const unsigned short gbk_page01[24] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8a3, 0x0000, /*0xc8-0xcf*/ + 0xa8ab, 0x0000, 0xa8af, 0x0000, 0xa8b3, 0x0000, 0xa8b5, 0x0000, /*0xd0-0xd7*/ + 0xa8b6, 0x0000, 0xa8b7, 0x0000, 0xa8b8, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ +}; +static const unsigned short gbk_page02a[24] = { + 0x0000, 0xa8bb, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ + 0x0000, 0xa8c0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x60-0x67*/ +}; +static const unsigned short gbk_page02b[32] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1a6, /*0xc0-0xc7*/ + 0x0000, 0xa1a5, 0xa840, 0xa841, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/ + 0x0000, 0xa842, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ +}; +static const unsigned short gbk_page03[64] = { + 0x0000, 0xa6a1, 0xa6a2, 0xa6a3, 0xa6a4, 0xa6a5, 0xa6a6, 0xa6a7, /*0x90-0x97*/ + 0xa6a8, 0xa6a9, 0xa6aa, 0xa6ab, 0xa6ac, 0xa6ad, 0xa6ae, 0xa6af, /*0x98-0x9f*/ + 0xa6b0, 0xa6b1, 0x0000, 0xa6b2, 0xa6b3, 0xa6b4, 0xa6b5, 0xa6b6, /*0xa0-0xa7*/ + 0xa6b7, 0xa6b8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ + 0x0000, 0xa6c1, 0xa6c2, 0xa6c3, 0xa6c4, 0xa6c5, 0xa6c6, 0xa6c7, /*0xb0-0xb7*/ + 0xa6c8, 0xa6c9, 0xa6ca, 0xa6cb, 0xa6cc, 0xa6cd, 0xa6ce, 0xa6cf, /*0xb8-0xbf*/ + 0xa6d0, 0xa6d1, 0x0000, 0xa6d2, 0xa6d3, 0xa6d4, 0xa6d5, 0xa6d6, /*0xc0-0xc7*/ + 0xa6d7, 0xa6d8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xc8-0xcf*/ +}; +static const unsigned short gbk_page04[88] = { + 0x0000, 0xa7a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x00-0x07*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ + 0xa7a1, 0xa7a2, 0xa7a3, 0xa7a4, 0xa7a5, 0xa7a6, 0xa7a8, 0xa7a9, /*0x10-0x17*/ + 0xa7aa, 0xa7ab, 0xa7ac, 0xa7ad, 0xa7ae, 0xa7af, 0xa7b0, 0xa7b1, /*0x18-0x1f*/ + 0xa7b2, 0xa7b3, 0xa7b4, 0xa7b5, 0xa7b6, 0xa7b7, 0xa7b8, 0xa7b9, /*0x20-0x27*/ + 0xa7ba, 0xa7bb, 0xa7bc, 0xa7bd, 0xa7be, 0xa7bf, 0xa7c0, 0xa7c1, /*0x28-0x2f*/ + 0xa7d1, 0xa7d2, 0xa7d3, 0xa7d4, 0xa7d5, 0xa7d6, 0xa7d8, 0xa7d9, /*0x30-0x37*/ + 0xa7da, 0xa7db, 0xa7dc, 0xa7dd, 0xa7de, 0xa7df, 0xa7e0, 0xa7e1, /*0x38-0x3f*/ + 0xa7e2, 0xa7e3, 0xa7e4, 0xa7e5, 0xa7e6, 0xa7e7, 0xa7e8, 0xa7e9, /*0x40-0x47*/ + 0xa7ea, 0xa7eb, 0xa7ec, 0xa7ed, 0xa7ee, 0xa7ef, 0xa7f0, 0xa7f1, /*0x48-0x4f*/ + 0x0000, 0xa7d7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ +}; +static const unsigned short gbk_page20[48] = { + 0xa95c, 0x0000, 0x0000, 0xa843, 0xa1aa, 0xa844, 0xa1ac, 0x0000, /*0x10-0x17*/ + 0xa1ae, 0xa1af, 0x0000, 0x0000, 0xa1b0, 0xa1b1, 0x0000, 0x0000, /*0x18-0x1f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa845, 0xa1ad, 0x0000, /*0x20-0x27*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ + 0xa1eb, 0x0000, 0xa1e4, 0xa1e5, 0x0000, 0xa846, 0x0000, 0x0000, /*0x30-0x37*/ + 0x0000, 0x0000, 0x0000, 0xa1f9, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ +}; +static const unsigned short gbk_page21[160] = { + 0x0000, 0x0000, 0x0000, 0xa1e6, 0x0000, 0xa847, 0x0000, 0x0000, /*0x00-0x07*/ + 0x0000, 0xa848, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1ed, 0x0000, /*0x10-0x17*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ + 0x0000, 0xa959, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ + 0xa2f1, 0xa2f2, 0xa2f3, 0xa2f4, 0xa2f5, 0xa2f6, 0xa2f7, 0xa2f8, /*0x60-0x67*/ + 0xa2f9, 0xa2fa, 0xa2fb, 0xa2fc, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ + 0xa2a1, 0xa2a2, 0xa2a3, 0xa2a4, 0xa2a5, 0xa2a6, 0xa2a7, 0xa2a8, /*0x70-0x77*/ + 0xa2a9, 0xa2aa, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ + 0xa1fb, 0xa1fc, 0xa1fa, 0xa1fd, 0x0000, 0x0000, 0xa849, 0xa84a, /*0x90-0x97*/ + 0xa84b, 0xa84c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ +}; +static const unsigned short gbk_page22[184] = { + 0xa1ca, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1c7, /*0x08-0x0f*/ + 0x0000, 0xa1c6, 0x0000, 0x0000, 0x0000, 0xa84d, 0x0000, 0x0000, /*0x10-0x17*/ + 0x0000, 0x0000, 0xa1cc, 0x0000, 0x0000, 0xa1d8, 0xa1de, 0xa84e, /*0x18-0x1f*/ + 0xa1cf, 0x0000, 0x0000, 0xa84f, 0x0000, 0xa1ce, 0x0000, 0xa1c4, /*0x20-0x27*/ + 0xa1c5, 0xa1c9, 0xa1c8, 0xa1d2, 0x0000, 0x0000, 0xa1d3, 0x0000, /*0x28-0x2f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa1e0, 0xa1df, 0xa1c3, 0xa1cb, /*0x30-0x37*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1d7, 0x0000, 0x0000, /*0x38-0x3f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ + 0xa1d6, 0x0000, 0x0000, 0x0000, 0xa1d5, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ + 0x0000, 0x0000, 0xa850, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x50-0x57*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x58-0x5f*/ + 0xa1d9, 0xa1d4, 0x0000, 0x0000, 0xa1dc, 0xa1dd, 0xa851, 0xa852, /*0x60-0x67*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1da, 0xa1db, /*0x68-0x6f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa892, 0x0000, 0x0000, /*0x90-0x97*/ + 0x0000, 0xa1d1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1cd, 0x0000, 0x0000, /*0xa0-0xa7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa853, /*0xb8-0xbf*/ +}; +static const unsigned short gbk_page24[64] = { + 0xa2d9, 0xa2da, 0xa2db, 0xa2dc, 0xa2dd, 0xa2de, 0xa2df, 0xa2e0, /*0x60-0x67*/ + 0xa2e1, 0xa2e2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa2c5, 0xa2c6, 0xa2c7, 0xa2c8, /*0x70-0x77*/ + 0xa2c9, 0xa2ca, 0xa2cb, 0xa2cc, 0xa2cd, 0xa2ce, 0xa2cf, 0xa2d0, /*0x78-0x7f*/ + 0xa2d1, 0xa2d2, 0xa2d3, 0xa2d4, 0xa2d5, 0xa2d6, 0xa2d7, 0xa2d8, /*0x80-0x87*/ + 0xa2b1, 0xa2b2, 0xa2b3, 0xa2b4, 0xa2b5, 0xa2b6, 0xa2b7, 0xa2b8, /*0x88-0x8f*/ + 0xa2b9, 0xa2ba, 0xa2bb, 0xa2bc, 0xa2bd, 0xa2be, 0xa2bf, 0xa2c0, /*0x90-0x97*/ + 0xa2c1, 0xa2c2, 0xa2c3, 0xa2c4, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ +}; +static const unsigned short gbk_page25[232] = { + 0xa9a4, 0xa9a5, 0xa9a6, 0xa9a7, 0xa9a8, 0xa9a9, 0xa9aa, 0xa9ab, /*0x00-0x07*/ + 0xa9ac, 0xa9ad, 0xa9ae, 0xa9af, 0xa9b0, 0xa9b1, 0xa9b2, 0xa9b3, /*0x08-0x0f*/ + 0xa9b4, 0xa9b5, 0xa9b6, 0xa9b7, 0xa9b8, 0xa9b9, 0xa9ba, 0xa9bb, /*0x10-0x17*/ + 0xa9bc, 0xa9bd, 0xa9be, 0xa9bf, 0xa9c0, 0xa9c1, 0xa9c2, 0xa9c3, /*0x18-0x1f*/ + 0xa9c4, 0xa9c5, 0xa9c6, 0xa9c7, 0xa9c8, 0xa9c9, 0xa9ca, 0xa9cb, /*0x20-0x27*/ + 0xa9cc, 0xa9cd, 0xa9ce, 0xa9cf, 0xa9d0, 0xa9d1, 0xa9d2, 0xa9d3, /*0x28-0x2f*/ + 0xa9d4, 0xa9d5, 0xa9d6, 0xa9d7, 0xa9d8, 0xa9d9, 0xa9da, 0xa9db, /*0x30-0x37*/ + 0xa9dc, 0xa9dd, 0xa9de, 0xa9df, 0xa9e0, 0xa9e1, 0xa9e2, 0xa9e3, /*0x38-0x3f*/ + 0xa9e4, 0xa9e5, 0xa9e6, 0xa9e7, 0xa9e8, 0xa9e9, 0xa9ea, 0xa9eb, /*0x40-0x47*/ + 0xa9ec, 0xa9ed, 0xa9ee, 0xa9ef, 0x0000, 0x0000, 0x0000, 0x0000, /*0x48-0x4f*/ + 0xa854, 0xa855, 0xa856, 0xa857, 0xa858, 0xa859, 0xa85a, 0xa85b, /*0x50-0x57*/ + 0xa85c, 0xa85d, 0xa85e, 0xa85f, 0xa860, 0xa861, 0xa862, 0xa863, /*0x58-0x5f*/ + 0xa864, 0xa865, 0xa866, 0xa867, 0xa868, 0xa869, 0xa86a, 0xa86b, /*0x60-0x67*/ + 0xa86c, 0xa86d, 0xa86e, 0xa86f, 0xa870, 0xa871, 0xa872, 0xa873, /*0x68-0x6f*/ + 0xa874, 0xa875, 0xa876, 0xa877, 0x0000, 0x0000, 0x0000, 0x0000, /*0x70-0x77*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ + 0x0000, 0xa878, 0xa879, 0xa87a, 0xa87b, 0xa87c, 0xa87d, 0xa87e, /*0x80-0x87*/ + 0xa880, 0xa881, 0xa882, 0xa883, 0xa884, 0xa885, 0xa886, 0xa887, /*0x88-0x8f*/ + 0x0000, 0x0000, 0x0000, 0xa888, 0xa889, 0xa88a, 0x0000, 0x0000, /*0x90-0x97*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x98-0x9f*/ + 0xa1f6, 0xa1f5, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ + 0x0000, 0x0000, 0xa1f8, 0xa1f7, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa88b, 0xa88c, 0x0000, 0x0000, /*0xb8-0xbf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1f4, 0xa1f3, /*0xc0-0xc7*/ + 0x0000, 0x0000, 0x0000, 0xa1f0, 0x0000, 0x0000, 0xa1f2, 0xa1f1, /*0xc8-0xcf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd0-0xd7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xd8-0xdf*/ + 0x0000, 0x0000, 0xa88d, 0xa88e, 0xa88f, 0xa890, 0x0000, 0x0000, /*0xe0-0xe7*/ +}; +static const unsigned short gbk_page26[72] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa1ef, 0xa1ee, 0x0000, /*0x00-0x07*/ + 0x0000, 0xa891, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x08-0x0f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x18-0x1f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x20-0x27*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ + 0xa1e2, 0x0000, 0xa1e1, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ +}; +static const unsigned short gbk_page30[304] = { + 0xa1a1, 0xa1a2, 0xa1a3, 0xa1a8, 0x0000, 0xa1a9, 0xa965, 0xa996, /*0x00-0x07*/ + 0xa1b4, 0xa1b5, 0xa1b6, 0xa1b7, 0xa1b8, 0xa1b9, 0xa1ba, 0xa1bb, /*0x08-0x0f*/ + 0xa1be, 0xa1bf, 0xa893, 0xa1fe, 0xa1b2, 0xa1b3, 0xa1bc, 0xa1bd, /*0x10-0x17*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa894, 0xa895, 0x0000, /*0x18-0x1f*/ + 0x0000, 0xa940, 0xa941, 0xa942, 0xa943, 0xa944, 0xa945, 0xa946, /*0x20-0x27*/ + 0xa947, 0xa948, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x38-0x3f*/ + 0x0000, 0xa4a1, 0xa4a2, 0xa4a3, 0xa4a4, 0xa4a5, 0xa4a6, 0xa4a7, /*0x40-0x47*/ + 0xa4a8, 0xa4a9, 0xa4aa, 0xa4ab, 0xa4ac, 0xa4ad, 0xa4ae, 0xa4af, /*0x48-0x4f*/ + 0xa4b0, 0xa4b1, 0xa4b2, 0xa4b3, 0xa4b4, 0xa4b5, 0xa4b6, 0xa4b7, /*0x50-0x57*/ + 0xa4b8, 0xa4b9, 0xa4ba, 0xa4bb, 0xa4bc, 0xa4bd, 0xa4be, 0xa4bf, /*0x58-0x5f*/ + 0xa4c0, 0xa4c1, 0xa4c2, 0xa4c3, 0xa4c4, 0xa4c5, 0xa4c6, 0xa4c7, /*0x60-0x67*/ + 0xa4c8, 0xa4c9, 0xa4ca, 0xa4cb, 0xa4cc, 0xa4cd, 0xa4ce, 0xa4cf, /*0x68-0x6f*/ + 0xa4d0, 0xa4d1, 0xa4d2, 0xa4d3, 0xa4d4, 0xa4d5, 0xa4d6, 0xa4d7, /*0x70-0x77*/ + 0xa4d8, 0xa4d9, 0xa4da, 0xa4db, 0xa4dc, 0xa4dd, 0xa4de, 0xa4df, /*0x78-0x7f*/ + 0xa4e0, 0xa4e1, 0xa4e2, 0xa4e3, 0xa4e4, 0xa4e5, 0xa4e6, 0xa4e7, /*0x80-0x87*/ + 0xa4e8, 0xa4e9, 0xa4ea, 0xa4eb, 0xa4ec, 0xa4ed, 0xa4ee, 0xa4ef, /*0x88-0x8f*/ + 0xa4f0, 0xa4f1, 0xa4f2, 0xa4f3, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/ + 0x0000, 0x0000, 0x0000, 0xa961, 0xa962, 0xa966, 0xa967, 0x0000, /*0x98-0x9f*/ + 0x0000, 0xa5a1, 0xa5a2, 0xa5a3, 0xa5a4, 0xa5a5, 0xa5a6, 0xa5a7, /*0xa0-0xa7*/ + 0xa5a8, 0xa5a9, 0xa5aa, 0xa5ab, 0xa5ac, 0xa5ad, 0xa5ae, 0xa5af, /*0xa8-0xaf*/ + 0xa5b0, 0xa5b1, 0xa5b2, 0xa5b3, 0xa5b4, 0xa5b5, 0xa5b6, 0xa5b7, /*0xb0-0xb7*/ + 0xa5b8, 0xa5b9, 0xa5ba, 0xa5bb, 0xa5bc, 0xa5bd, 0xa5be, 0xa5bf, /*0xb8-0xbf*/ + 0xa5c0, 0xa5c1, 0xa5c2, 0xa5c3, 0xa5c4, 0xa5c5, 0xa5c6, 0xa5c7, /*0xc0-0xc7*/ + 0xa5c8, 0xa5c9, 0xa5ca, 0xa5cb, 0xa5cc, 0xa5cd, 0xa5ce, 0xa5cf, /*0xc8-0xcf*/ + 0xa5d0, 0xa5d1, 0xa5d2, 0xa5d3, 0xa5d4, 0xa5d5, 0xa5d6, 0xa5d7, /*0xd0-0xd7*/ + 0xa5d8, 0xa5d9, 0xa5da, 0xa5db, 0xa5dc, 0xa5dd, 0xa5de, 0xa5df, /*0xd8-0xdf*/ + 0xa5e0, 0xa5e1, 0xa5e2, 0xa5e3, 0xa5e4, 0xa5e5, 0xa5e6, 0xa5e7, /*0xe0-0xe7*/ + 0xa5e8, 0xa5e9, 0xa5ea, 0xa5eb, 0xa5ec, 0xa5ed, 0xa5ee, 0xa5ef, /*0xe8-0xef*/ + 0xa5f0, 0xa5f1, 0xa5f2, 0xa5f3, 0xa5f4, 0xa5f5, 0xa5f6, 0x0000, /*0xf0-0xf7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa960, 0xa963, 0xa964, 0x0000, /*0xf8-0xff*/ + /* 0x3100 */ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa8c5, 0xa8c6, 0xa8c7, /*0x00-0x07*/ + 0xa8c8, 0xa8c9, 0xa8ca, 0xa8cb, 0xa8cc, 0xa8cd, 0xa8ce, 0xa8cf, /*0x08-0x0f*/ + 0xa8d0, 0xa8d1, 0xa8d2, 0xa8d3, 0xa8d4, 0xa8d5, 0xa8d6, 0xa8d7, /*0x10-0x17*/ + 0xa8d8, 0xa8d9, 0xa8da, 0xa8db, 0xa8dc, 0xa8dd, 0xa8de, 0xa8df, /*0x18-0x1f*/ + 0xa8e0, 0xa8e1, 0xa8e2, 0xa8e3, 0xa8e4, 0xa8e5, 0xa8e6, 0xa8e7, /*0x20-0x27*/ + 0xa8e8, 0xa8e9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ +}; +static const unsigned short gbk_page32[24] = { + 0xa2e5, 0xa2e6, 0xa2e7, 0xa2e8, 0xa2e9, 0xa2ea, 0xa2eb, 0xa2ec, /*0x20-0x27*/ + 0xa2ed, 0xa2ee, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ + 0x0000, 0xa95a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x30-0x37*/ +}; +static const unsigned short gbk_page33[80] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa94a, 0xa94b, /*0x88-0x8f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x90-0x97*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa94c, 0xa94d, 0xa94e, 0x0000, /*0x98-0x9f*/ + 0x0000, 0xa94f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa0-0xa7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xa8-0xaf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb0-0xb7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xb8-0xbf*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0xa950, 0x0000, 0x0000, 0x0000, /*0xc0-0xc7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xa951, 0x0000, /*0xc8-0xcf*/ + 0x0000, 0xa952, 0xa953, 0x0000, 0x0000, 0xa954, 0x0000, 0x0000, /*0xd0-0xd7*/ +}; +static const unsigned short gbk_page4e[20904] = { + 0xd2bb, 0xb6a1, 0x8140, 0xc6df, 0x8141, 0x8142, 0x8143, 0xcdf2, /*0x00-0x07*/ + 0xd5c9, 0xc8fd, 0xc9cf, 0xcfc2, 0xd8a2, 0xb2bb, 0xd3eb, 0x8144, /*0x08-0x0f*/ + 0xd8a4, 0xb3f3, 0x8145, 0xd7a8, 0xc7d2, 0xd8a7, 0xcac0, 0x8146, /*0x10-0x17*/ + 0xc7f0, 0xb1fb, 0xd2b5, 0xb4d4, 0xb6ab, 0xcbbf, 0xd8a9, 0x8147, /*0x18-0x1f*/ + 0x8148, 0x8149, 0xb6aa, 0x814a, 0xc1bd, 0xd1cf, 0x814b, 0xc9a5, /*0x20-0x27*/ + 0xd8ad, 0x814c, 0xb8f6, 0xd1be, 0xe3dc, 0xd6d0, 0x814d, 0x814e, /*0x28-0x2f*/ + 0xb7e1, 0x814f, 0xb4ae, 0x8150, 0xc1d9, 0x8151, 0xd8bc, 0x8152, /*0x30-0x37*/ + 0xcde8, 0xb5a4, 0xceaa, 0xd6f7, 0x8153, 0xc0f6, 0xbed9, 0xd8af, /*0x38-0x3f*/ + 0x8154, 0x8155, 0x8156, 0xc4cb, 0x8157, 0xbec3, 0x8158, 0xd8b1, /*0x40-0x47*/ + 0xc3b4, 0xd2e5, 0x8159, 0xd6ae, 0xceda, 0xd5a7, 0xbaf5, 0xb7a6, /*0x48-0x4f*/ + 0xc0d6, 0x815a, 0xc6b9, 0xc5d2, 0xc7c7, 0x815b, 0xb9d4, 0x815c, /*0x50-0x57*/ + 0xb3cb, 0xd2d2, 0x815d, 0x815e, 0xd8bf, 0xbec5, 0xc6f2, 0xd2b2, /*0x58-0x5f*/ + 0xcfb0, 0xcfe7, 0x815f, 0x8160, 0x8161, 0x8162, 0xcae9, 0x8163, /*0x60-0x67*/ + 0x8164, 0xd8c0, 0x8165, 0x8166, 0x8167, 0x8168, 0x8169, 0x816a, /*0x68-0x6f*/ + 0xc2f2, 0xc2d2, 0x816b, 0xc8e9, 0x816c, 0x816d, 0x816e, 0x816f, /*0x70-0x77*/ + 0x8170, 0x8171, 0x8172, 0x8173, 0x8174, 0x8175, 0xc7ac, 0x8176, /*0x78-0x7f*/ + 0x8177, 0x8178, 0x8179, 0x817a, 0x817b, 0x817c, 0xc1cb, 0x817d, /*0x80-0x87*/ + 0xd3e8, 0xd5f9, 0x817e, 0xcac2, 0xb6fe, 0xd8a1, 0xd3da, 0xbff7, /*0x88-0x8f*/ + 0x8180, 0xd4c6, 0xbba5, 0xd8c1, 0xcee5, 0xbeae, 0x8181, 0x8182, /*0x90-0x97*/ + 0xd8a8, 0x8183, 0xd1c7, 0xd0a9, 0x8184, 0x8185, 0x8186, 0xd8bd, /*0x98-0x9f*/ + 0xd9ef, 0xcdf6, 0xbfba, 0x8187, 0xbdbb, 0xbaa5, 0xd2e0, 0xb2fa, /*0xa0-0xa7*/ + 0xbae0, 0xc4b6, 0x8188, 0xcfed, 0xbea9, 0xcda4, 0xc1c1, 0x8189, /*0xa8-0xaf*/ + 0x818a, 0x818b, 0xc7d7, 0xd9f1, 0x818c, 0xd9f4, 0x818d, 0x818e, /*0xb0-0xb7*/ + 0x818f, 0x8190, 0xc8cb, 0xd8e9, 0x8191, 0x8192, 0x8193, 0xd2da, /*0xb8-0xbf*/ + 0xcab2, 0xc8ca, 0xd8ec, 0xd8ea, 0xd8c6, 0xbdf6, 0xc6cd, 0xb3f0, /*0xc0-0xc7*/ + 0x8194, 0xd8eb, 0xbdf1, 0xbde9, 0x8195, 0xc8d4, 0xb4d3, 0x8196, /*0xc8-0xcf*/ + 0x8197, 0xc2d8, 0x8198, 0xb2d6, 0xd7d0, 0xcacb, 0xcbfb, 0xd5cc, /*0xd0-0xd7*/ + 0xb8b6, 0xcfc9, 0x8199, 0x819a, 0x819b, 0xd9da, 0xd8f0, 0xc7aa, /*0xd8-0xdf*/ + 0x819c, 0xd8ee, 0x819d, 0xb4fa, 0xc1ee, 0xd2d4, 0x819e, 0x819f, /*0xe0-0xe7*/ + 0xd8ed, 0x81a0, 0xd2c7, 0xd8ef, 0xc3c7, 0x81a1, 0x81a2, 0x81a3, /*0xe8-0xef*/ + 0xd1f6, 0x81a4, 0xd6d9, 0xd8f2, 0x81a5, 0xd8f5, 0xbcfe, 0xbcdb, /*0xf0-0xf7*/ + 0x81a6, 0x81a7, 0x81a8, 0xc8ce, 0x81a9, 0xb7dd, 0x81aa, 0xb7c2, /*0xf8-0xff*/ + /* 0x4f00 */ + 0x81ab, 0xc6f3, 0x81ac, 0x81ad, 0x81ae, 0x81af, 0x81b0, 0x81b1, /*0x00-0x07*/ + 0x81b2, 0xd8f8, 0xd2c1, 0x81b3, 0x81b4, 0xcee9, 0xbcbf, 0xb7fc, /*0x08-0x0f*/ + 0xb7a5, 0xd0dd, 0x81b5, 0x81b6, 0x81b7, 0x81b8, 0x81b9, 0xd6da, /*0x10-0x17*/ + 0xd3c5, 0xbbef, 0xbbe1, 0xd8f1, 0x81ba, 0x81bb, 0xc9a1, 0xceb0, /*0x18-0x1f*/ + 0xb4ab, 0x81bc, 0xd8f3, 0x81bd, 0xc9cb, 0xd8f6, 0xc2d7, 0xd8f7, /*0x20-0x27*/ + 0x81be, 0x81bf, 0xceb1, 0xd8f9, 0x81c0, 0x81c1, 0x81c2, 0xb2ae, /*0x28-0x2f*/ + 0xb9c0, 0x81c3, 0xd9a3, 0x81c4, 0xb0e9, 0x81c5, 0xc1e6, 0x81c6, /*0x30-0x37*/ + 0xc9ec, 0x81c7, 0xcbc5, 0x81c8, 0xcbc6, 0xd9a4, 0x81c9, 0x81ca, /*0x38-0x3f*/ + 0x81cb, 0x81cc, 0x81cd, 0xb5e8, 0x81ce, 0x81cf, 0xb5ab, 0x81d0, /*0x40-0x47*/ + 0x81d1, 0x81d2, 0x81d3, 0x81d4, 0x81d5, 0xcebb, 0xb5cd, 0xd7a1, /*0x48-0x4f*/ + 0xd7f4, 0xd3d3, 0x81d6, 0xcce5, 0x81d7, 0xbace, 0x81d8, 0xd9a2, /*0x50-0x57*/ + 0xd9dc, 0xd3e0, 0xd8fd, 0xb7f0, 0xd7f7, 0xd8fe, 0xd8fa, 0xd9a1, /*0x58-0x5f*/ + 0xc4e3, 0x81d9, 0x81da, 0xd3b6, 0xd8f4, 0xd9dd, 0x81db, 0xd8fb, /*0x60-0x67*/ + 0x81dc, 0xc5e5, 0x81dd, 0x81de, 0xc0d0, 0x81df, 0x81e0, 0xd1f0, /*0x68-0x6f*/ + 0xb0db, 0x81e1, 0x81e2, 0xbcd1, 0xd9a6, 0x81e3, 0xd9a5, 0x81e4, /*0x70-0x77*/ + 0x81e5, 0x81e6, 0x81e7, 0xd9ac, 0xd9ae, 0x81e8, 0xd9ab, 0xcab9, /*0x78-0x7f*/ + 0x81e9, 0x81ea, 0x81eb, 0xd9a9, 0xd6b6, 0x81ec, 0x81ed, 0x81ee, /*0x80-0x87*/ + 0xb3de, 0xd9a8, 0x81ef, 0xc0fd, 0x81f0, 0xcacc, 0x81f1, 0xd9aa, /*0x88-0x8f*/ + 0x81f2, 0xd9a7, 0x81f3, 0x81f4, 0xd9b0, 0x81f5, 0x81f6, 0xb6b1, /*0x90-0x97*/ + 0x81f7, 0x81f8, 0x81f9, 0xb9a9, 0x81fa, 0xd2c0, 0x81fb, 0x81fc, /*0x98-0x9f*/ + 0xcfc0, 0x81fd, 0x81fe, 0xc2c2, 0x8240, 0xbdc4, 0xd5ec, 0xb2e0, /*0xa0-0xa7*/ + 0xc7c8, 0xbfeb, 0xd9ad, 0x8241, 0xd9af, 0x8242, 0xceea, 0xbaee, /*0xa8-0xaf*/ + 0x8243, 0x8244, 0x8245, 0x8246, 0x8247, 0xc7d6, 0x8248, 0x8249, /*0xb0-0xb7*/ + 0x824a, 0x824b, 0x824c, 0x824d, 0x824e, 0x824f, 0x8250, 0xb1e3, /*0xb8-0xbf*/ + 0x8251, 0x8252, 0x8253, 0xb4d9, 0xb6ed, 0xd9b4, 0x8254, 0x8255, /*0xc0-0xc7*/ + 0x8256, 0x8257, 0xbfa1, 0x8258, 0x8259, 0x825a, 0xd9de, 0xc7ce, /*0xc8-0xcf*/ + 0xc0fe, 0xd9b8, 0x825b, 0x825c, 0x825d, 0x825e, 0x825f, 0xcbd7, /*0xd0-0xd7*/ + 0xb7fd, 0x8260, 0xd9b5, 0x8261, 0xd9b7, 0xb1a3, 0xd3e1, 0xd9b9, /*0xd8-0xdf*/ + 0x8262, 0xd0c5, 0x8263, 0xd9b6, 0x8264, 0x8265, 0xd9b1, 0x8266, /*0xe0-0xe7*/ + 0xd9b2, 0xc1a9, 0xd9b3, 0x8267, 0x8268, 0xbcf3, 0xd0de, 0xb8a9, /*0xe8-0xef*/ + 0x8269, 0xbee3, 0x826a, 0xd9bd, 0x826b, 0x826c, 0x826d, 0x826e, /*0xf0-0xf7*/ + 0xd9ba, 0x826f, 0xb0b3, 0x8270, 0x8271, 0x8272, 0xd9c2, 0x8273, /*0xf8-0xff*/ + /* 0x5000 */ + 0x8274, 0x8275, 0x8276, 0x8277, 0x8278, 0x8279, 0x827a, 0x827b, /*0x00-0x07*/ + 0x827c, 0x827d, 0x827e, 0x8280, 0xd9c4, 0xb1b6, 0x8281, 0xd9bf, /*0x08-0x0f*/ + 0x8282, 0x8283, 0xb5b9, 0x8284, 0xbef3, 0x8285, 0x8286, 0x8287, /*0x10-0x17*/ + 0xccc8, 0xbaf2, 0xd2d0, 0x8288, 0xd9c3, 0x8289, 0x828a, 0xbde8, /*0x18-0x1f*/ + 0x828b, 0xb3ab, 0x828c, 0x828d, 0x828e, 0xd9c5, 0xbeeb, 0x828f, /*0x20-0x27*/ + 0xd9c6, 0xd9bb, 0xc4df, 0x8290, 0xd9be, 0xd9c1, 0xd9c0, 0x8291, /*0x28-0x2f*/ + 0x8292, 0x8293, 0x8294, 0x8295, 0x8296, 0x8297, 0x8298, 0x8299, /*0x30-0x37*/ + 0x829a, 0x829b, 0xd5ae, 0x829c, 0xd6b5, 0x829d, 0xc7e3, 0x829e, /*0x38-0x3f*/ + 0x829f, 0x82a0, 0x82a1, 0xd9c8, 0x82a2, 0x82a3, 0x82a4, 0xbcd9, /*0x40-0x47*/ + 0xd9ca, 0x82a5, 0x82a6, 0x82a7, 0xd9bc, 0x82a8, 0xd9cb, 0xc6ab, /*0x48-0x4f*/ + 0x82a9, 0x82aa, 0x82ab, 0x82ac, 0x82ad, 0xd9c9, 0x82ae, 0x82af, /*0x50-0x57*/ + 0x82b0, 0x82b1, 0xd7f6, 0x82b2, 0xcda3, 0x82b3, 0x82b4, 0x82b5, /*0x58-0x5f*/ + 0x82b6, 0x82b7, 0x82b8, 0x82b9, 0x82ba, 0xbda1, 0x82bb, 0x82bc, /*0x60-0x67*/ + 0x82bd, 0x82be, 0x82bf, 0x82c0, 0xd9cc, 0x82c1, 0x82c2, 0x82c3, /*0x68-0x6f*/ + 0x82c4, 0x82c5, 0x82c6, 0x82c7, 0x82c8, 0x82c9, 0xc5bc, 0xcdb5, /*0x70-0x77*/ + 0x82ca, 0x82cb, 0x82cc, 0xd9cd, 0x82cd, 0x82ce, 0xd9c7, 0xb3a5, /*0x78-0x7f*/ + 0xbffe, 0x82cf, 0x82d0, 0x82d1, 0x82d2, 0xb8b5, 0x82d3, 0x82d4, /*0x80-0x87*/ + 0xc0fc, 0x82d5, 0x82d6, 0x82d7, 0x82d8, 0xb0f8, 0x82d9, 0x82da, /*0x88-0x8f*/ + 0x82db, 0x82dc, 0x82dd, 0x82de, 0x82df, 0x82e0, 0x82e1, 0x82e2, /*0x90-0x97*/ + 0x82e3, 0x82e4, 0x82e5, 0x82e6, 0x82e7, 0x82e8, 0x82e9, 0x82ea, /*0x98-0x9f*/ + 0x82eb, 0x82ec, 0x82ed, 0xb4f6, 0x82ee, 0xd9ce, 0x82ef, 0xd9cf, /*0xa0-0xa7*/ + 0xb4a2, 0xd9d0, 0x82f0, 0x82f1, 0xb4df, 0x82f2, 0x82f3, 0x82f4, /*0xa8-0xaf*/ + 0x82f5, 0x82f6, 0xb0c1, 0x82f7, 0x82f8, 0x82f9, 0x82fa, 0x82fb, /*0xb0-0xb7*/ + 0x82fc, 0x82fd, 0xd9d1, 0xc9b5, 0x82fe, 0x8340, 0x8341, 0x8342, /*0xb8-0xbf*/ + 0x8343, 0x8344, 0x8345, 0x8346, 0x8347, 0x8348, 0x8349, 0x834a, /*0xc0-0xc7*/ + 0x834b, 0x834c, 0x834d, 0x834e, 0x834f, 0x8350, 0x8351, 0xcff1, /*0xc8-0xcf*/ + 0x8352, 0x8353, 0x8354, 0x8355, 0x8356, 0x8357, 0xd9d2, 0x8358, /*0xd0-0xd7*/ + 0x8359, 0x835a, 0xc1c5, 0x835b, 0x835c, 0x835d, 0x835e, 0x835f, /*0xd8-0xdf*/ + 0x8360, 0x8361, 0x8362, 0x8363, 0x8364, 0x8365, 0xd9d6, 0xc9ae, /*0xe0-0xe7*/ + 0x8366, 0x8367, 0x8368, 0x8369, 0xd9d5, 0xd9d4, 0xd9d7, 0x836a, /*0xe8-0xef*/ + 0x836b, 0x836c, 0x836d, 0xcbdb, 0x836e, 0xbda9, 0x836f, 0x8370, /*0xf0-0xf7*/ + 0x8371, 0x8372, 0x8373, 0xc6a7, 0x8374, 0x8375, 0x8376, 0x8377, /*0xf8-0xff*/ + /* 0x5100 */ + 0x8378, 0x8379, 0x837a, 0x837b, 0x837c, 0x837d, 0xd9d3, 0xd9d8, /*0x00-0x07*/ + 0x837e, 0x8380, 0x8381, 0xd9d9, 0x8382, 0x8383, 0x8384, 0x8385, /*0x08-0x0f*/ + 0x8386, 0x8387, 0xc8e5, 0x8388, 0x8389, 0x838a, 0x838b, 0x838c, /*0x10-0x17*/ + 0x838d, 0x838e, 0x838f, 0x8390, 0x8391, 0x8392, 0x8393, 0x8394, /*0x18-0x1f*/ + 0x8395, 0xc0dc, 0x8396, 0x8397, 0x8398, 0x8399, 0x839a, 0x839b, /*0x20-0x27*/ + 0x839c, 0x839d, 0x839e, 0x839f, 0x83a0, 0x83a1, 0x83a2, 0x83a3, /*0x28-0x2f*/ + 0x83a4, 0x83a5, 0x83a6, 0x83a7, 0x83a8, 0x83a9, 0x83aa, 0x83ab, /*0x30-0x37*/ + 0x83ac, 0x83ad, 0x83ae, 0x83af, 0x83b0, 0x83b1, 0x83b2, 0xb6f9, /*0x38-0x3f*/ + 0xd8a3, 0xd4ca, 0x83b3, 0xd4aa, 0xd0d6, 0xb3e4, 0xd5d7, 0x83b4, /*0x40-0x47*/ + 0xcfc8, 0xb9e2, 0x83b5, 0xbfcb, 0x83b6, 0xc3e2, 0x83b7, 0x83b8, /*0x48-0x4f*/ + 0x83b9, 0xb6d2, 0x83ba, 0x83bb, 0xcdc3, 0xd9ee, 0xd9f0, 0x83bc, /*0x50-0x57*/ + 0x83bd, 0x83be, 0xb5b3, 0x83bf, 0xb6b5, 0x83c0, 0x83c1, 0x83c2, /*0x58-0x5f*/ + 0x83c3, 0x83c4, 0xbea4, 0x83c5, 0x83c6, 0xc8eb, 0x83c7, 0x83c8, /*0x60-0x67*/ + 0xc8ab, 0x83c9, 0x83ca, 0xb0cb, 0xb9ab, 0xc1f9, 0xd9e2, 0x83cb, /*0x68-0x6f*/ + 0xc0bc, 0xb9b2, 0x83cc, 0xb9d8, 0xd0cb, 0xb1f8, 0xc6e4, 0xbedf, /*0x70-0x77*/ + 0xb5e4, 0xd7c8, 0x83cd, 0xd1f8, 0xbce6, 0xcade, 0x83ce, 0x83cf, /*0x78-0x7f*/ + 0xbcbd, 0xd9e6, 0xd8e7, 0x83d0, 0x83d1, 0xc4da, 0x83d2, 0x83d3, /*0x80-0x87*/ + 0xb8d4, 0xc8bd, 0x83d4, 0x83d5, 0xb2e1, 0xd4d9, 0x83d6, 0x83d7, /*0x88-0x8f*/ + 0x83d8, 0x83d9, 0xc3b0, 0x83da, 0x83db, 0xc3e1, 0xdaa2, 0xc8df, /*0x90-0x97*/ + 0x83dc, 0xd0b4, 0x83dd, 0xbefc, 0xc5a9, 0x83de, 0x83df, 0x83e0, /*0x98-0x9f*/ + 0xb9da, 0x83e1, 0xdaa3, 0x83e2, 0xd4a9, 0xdaa4, 0x83e3, 0x83e4, /*0xa0-0xa7*/ + 0x83e5, 0x83e6, 0x83e7, 0xd9fb, 0xb6ac, 0x83e8, 0x83e9, 0xb7eb, /*0xa8-0xaf*/ + 0xb1f9, 0xd9fc, 0xb3e5, 0xbef6, 0x83ea, 0xbff6, 0xd2b1, 0xc0e4, /*0xb0-0xb7*/ + 0x83eb, 0x83ec, 0x83ed, 0xb6b3, 0xd9fe, 0xd9fd, 0x83ee, 0x83ef, /*0xb8-0xbf*/ + 0xbebb, 0x83f0, 0x83f1, 0x83f2, 0xc6e0, 0x83f3, 0xd7bc, 0xdaa1, /*0xc0-0xc7*/ + 0x83f4, 0xc1b9, 0x83f5, 0xb5f2, 0xc1e8, 0x83f6, 0x83f7, 0xbcf5, /*0xc8-0xcf*/ + 0x83f8, 0xb4d5, 0x83f9, 0x83fa, 0x83fb, 0x83fc, 0x83fd, 0x83fe, /*0xd0-0xd7*/ + 0x8440, 0x8441, 0x8442, 0xc1dd, 0x8443, 0xc4fd, 0x8444, 0x8445, /*0xd8-0xdf*/ + 0xbcb8, 0xb7b2, 0x8446, 0x8447, 0xb7ef, 0x8448, 0x8449, 0x844a, /*0xe0-0xe7*/ + 0x844b, 0x844c, 0x844d, 0xd9ec, 0x844e, 0xc6be, 0x844f, 0xbfad, /*0xe8-0xef*/ + 0xbbcb, 0x8450, 0x8451, 0xb5ca, 0x8452, 0xdbc9, 0xd0d7, 0x8453, /*0xf0-0xf7*/ + 0xcdb9, 0xb0bc, 0xb3f6, 0xbbf7, 0xdbca, 0xbaaf, 0x8454, 0xd4e4, /*0xf8-0xff*/ + /* 0x5200 */ + 0xb5b6, 0xb5f3, 0xd8d6, 0xc8d0, 0x8455, 0x8456, 0xb7d6, 0xc7d0, /*0x00-0x07*/ + 0xd8d7, 0x8457, 0xbfaf, 0x8458, 0x8459, 0xdbbb, 0xd8d8, 0x845a, /*0x08-0x0f*/ + 0x845b, 0xd0cc, 0xbbae, 0x845c, 0x845d, 0x845e, 0xebbe, 0xc1d0, /*0x10-0x17*/ + 0xc1f5, 0xd4f2, 0xb8d5, 0xb4b4, 0x845f, 0xb3f5, 0x8460, 0x8461, /*0x18-0x1f*/ + 0xc9be, 0x8462, 0x8463, 0x8464, 0xc5d0, 0x8465, 0x8466, 0x8467, /*0x20-0x27*/ + 0xc5d9, 0xc0fb, 0x8468, 0xb1f0, 0x8469, 0xd8d9, 0xb9ce, 0x846a, /*0x28-0x2f*/ + 0xb5bd, 0x846b, 0x846c, 0xd8da, 0x846d, 0x846e, 0xd6c6, 0xcba2, /*0x30-0x37*/ + 0xc8af, 0xc9b2, 0xb4cc, 0xbfcc, 0x846f, 0xb9f4, 0x8470, 0xd8db, /*0x38-0x3f*/ + 0xd8dc, 0xb6e7, 0xbcc1, 0xccea, 0x8471, 0x8472, 0x8473, 0x8474, /*0x40-0x47*/ + 0x8475, 0x8476, 0xcff7, 0x8477, 0xd8dd, 0xc7b0, 0x8478, 0x8479, /*0x48-0x4f*/ + 0xb9d0, 0xbda3, 0x847a, 0x847b, 0xccde, 0x847c, 0xc6ca, 0x847d, /*0x50-0x57*/ + 0x847e, 0x8480, 0x8481, 0x8482, 0xd8e0, 0x8483, 0xd8de, 0x8484, /*0x58-0x5f*/ + 0x8485, 0xd8df, 0x8486, 0x8487, 0x8488, 0xb0fe, 0x8489, 0xbee7, /*0x60-0x67*/ + 0x848a, 0xcaa3, 0xbcf4, 0x848b, 0x848c, 0x848d, 0x848e, 0xb8b1, /*0x68-0x6f*/ + 0x848f, 0x8490, 0xb8ee, 0x8491, 0x8492, 0x8493, 0x8494, 0x8495, /*0x70-0x77*/ + 0x8496, 0x8497, 0x8498, 0x8499, 0x849a, 0xd8e2, 0x849b, 0xbdcb, /*0x78-0x7f*/ + 0x849c, 0xd8e4, 0xd8e3, 0x849d, 0x849e, 0x849f, 0x84a0, 0x84a1, /*0x80-0x87*/ + 0xc5fc, 0x84a2, 0x84a3, 0x84a4, 0x84a5, 0x84a6, 0x84a7, 0x84a8, /*0x88-0x8f*/ + 0xd8e5, 0x84a9, 0x84aa, 0xd8e6, 0x84ab, 0x84ac, 0x84ad, 0x84ae, /*0x90-0x97*/ + 0x84af, 0x84b0, 0x84b1, 0xc1a6, 0x84b2, 0xc8b0, 0xb0ec, 0xb9a6, /*0x98-0x9f*/ + 0xbcd3, 0xcef1, 0xdbbd, 0xc1d3, 0x84b3, 0x84b4, 0x84b5, 0x84b6, /*0xa0-0xa7*/ + 0xb6af, 0xd6fa, 0xc5ac, 0xbdd9, 0xdbbe, 0xdbbf, 0x84b7, 0x84b8, /*0xa8-0xaf*/ + 0x84b9, 0xc0f8, 0xbea2, 0xc0cd, 0x84ba, 0x84bb, 0x84bc, 0x84bd, /*0xb0-0xb7*/ + 0x84be, 0x84bf, 0x84c0, 0x84c1, 0x84c2, 0x84c3, 0xdbc0, 0xcac6, /*0xb8-0xbf*/ + 0x84c4, 0x84c5, 0x84c6, 0xb2aa, 0x84c7, 0x84c8, 0x84c9, 0xd3c2, /*0xc0-0xc7*/ + 0x84ca, 0xc3e3, 0x84cb, 0xd1ab, 0x84cc, 0x84cd, 0x84ce, 0x84cf, /*0xc8-0xcf*/ + 0xdbc2, 0x84d0, 0xc0d5, 0x84d1, 0x84d2, 0x84d3, 0xdbc3, 0x84d4, /*0xd0-0xd7*/ + 0xbfb1, 0x84d5, 0x84d6, 0x84d7, 0x84d8, 0x84d9, 0x84da, 0xc4bc, /*0xd8-0xdf*/ + 0x84db, 0x84dc, 0x84dd, 0x84de, 0xc7da, 0x84df, 0x84e0, 0x84e1, /*0xe0-0xe7*/ + 0x84e2, 0x84e3, 0x84e4, 0x84e5, 0x84e6, 0x84e7, 0x84e8, 0x84e9, /*0xe8-0xef*/ + 0xdbc4, 0x84ea, 0x84eb, 0x84ec, 0x84ed, 0x84ee, 0x84ef, 0x84f0, /*0xf0-0xf7*/ + 0x84f1, 0xd9e8, 0xc9d7, 0x84f2, 0x84f3, 0x84f4, 0xb9b4, 0xcef0, /*0xf8-0xff*/ + /* 0x5300 */ + 0xd4c8, 0x84f5, 0x84f6, 0x84f7, 0x84f8, 0xb0fc, 0xb4d2, 0x84f9, /*0x00-0x07*/ + 0xd0d9, 0x84fa, 0x84fb, 0x84fc, 0x84fd, 0xd9e9, 0x84fe, 0xdecb, /*0x08-0x0f*/ + 0xd9eb, 0x8540, 0x8541, 0x8542, 0x8543, 0xd8b0, 0xbbaf, 0xb1b1, /*0x10-0x17*/ + 0x8544, 0xb3d7, 0xd8ce, 0x8545, 0x8546, 0xd4d1, 0x8547, 0x8548, /*0x18-0x1f*/ + 0xbdb3, 0xbfef, 0x8549, 0xcfbb, 0x854a, 0x854b, 0xd8d0, 0x854c, /*0x20-0x27*/ + 0x854d, 0x854e, 0xb7cb, 0x854f, 0x8550, 0x8551, 0xd8d1, 0x8552, /*0x28-0x2f*/ + 0x8553, 0x8554, 0x8555, 0x8556, 0x8557, 0x8558, 0x8559, 0x855a, /*0x30-0x37*/ + 0x855b, 0xc6a5, 0xc7f8, 0xd2bd, 0x855c, 0x855d, 0xd8d2, 0xc4e4, /*0x38-0x3f*/ + 0x855e, 0xcaae, 0x855f, 0xc7a7, 0x8560, 0xd8a6, 0x8561, 0xc9fd, /*0x40-0x47*/ + 0xcee7, 0xbbdc, 0xb0eb, 0x8562, 0x8563, 0x8564, 0xbbaa, 0xd0ad, /*0x48-0x4f*/ + 0x8565, 0xb1b0, 0xd7e4, 0xd7bf, 0x8566, 0xb5a5, 0xc2f4, 0xc4cf, /*0x50-0x57*/ + 0x8567, 0x8568, 0xb2a9, 0x8569, 0xb2b7, 0x856a, 0xb1e5, 0xdfb2, /*0x58-0x5f*/ + 0xd5bc, 0xbfa8, 0xc2ac, 0xd8d5, 0xc2b1, 0x856b, 0xd8d4, 0xced4, /*0x60-0x67*/ + 0x856c, 0xdae0, 0x856d, 0xcec0, 0x856e, 0x856f, 0xd8b4, 0xc3ae, /*0x68-0x6f*/ + 0xd3a1, 0xcea3, 0x8570, 0xbcb4, 0xc8b4, 0xc2d1, 0x8571, 0xbeed, /*0x70-0x77*/ + 0xd0b6, 0x8572, 0xdae1, 0x8573, 0x8574, 0x8575, 0x8576, 0xc7e4, /*0x78-0x7f*/ + 0x8577, 0x8578, 0xb3a7, 0x8579, 0xb6f2, 0xccfc, 0xc0fa, 0x857a, /*0x80-0x87*/ + 0x857b, 0xc0f7, 0x857c, 0xd1b9, 0xd1e1, 0xd8c7, 0x857d, 0x857e, /*0x88-0x8f*/ + 0x8580, 0x8581, 0x8582, 0x8583, 0x8584, 0xb2de, 0x8585, 0x8586, /*0x90-0x97*/ + 0xc0e5, 0x8587, 0xbaf1, 0x8588, 0x8589, 0xd8c8, 0x858a, 0xd4ad, /*0x98-0x9f*/ + 0x858b, 0x858c, 0xcfe1, 0xd8c9, 0x858d, 0xd8ca, 0xcfc3, 0x858e, /*0xa0-0xa7*/ + 0xb3f8, 0xbec7, 0x858f, 0x8590, 0x8591, 0x8592, 0xd8cb, 0x8593, /*0xa8-0xaf*/ + 0x8594, 0x8595, 0x8596, 0x8597, 0x8598, 0x8599, 0xdbcc, 0x859a, /*0xb0-0xb7*/ + 0x859b, 0x859c, 0x859d, 0xc8a5, 0x859e, 0x859f, 0x85a0, 0xcfd8, /*0xb8-0xbf*/ + 0x85a1, 0xc8fe, 0xb2ce, 0x85a2, 0x85a3, 0x85a4, 0x85a5, 0x85a6, /*0xc0-0xc7*/ + 0xd3d6, 0xb2e6, 0xbcb0, 0xd3d1, 0xcbab, 0xb7b4, 0x85a7, 0x85a8, /*0xc8-0xcf*/ + 0x85a9, 0xb7a2, 0x85aa, 0x85ab, 0xcae5, 0x85ac, 0xc8a1, 0xcadc, /*0xd0-0xd7*/ + 0xb1e4, 0xd0f0, 0x85ad, 0xc5d1, 0x85ae, 0x85af, 0x85b0, 0xdbc5, /*0xd8-0xdf*/ + 0xb5fe, 0x85b1, 0x85b2, 0xbfda, 0xb9c5, 0xbee4, 0xc1ed, 0x85b3, /*0xe0-0xe7*/ + 0xdfb6, 0xdfb5, 0xd6bb, 0xbdd0, 0xd5d9, 0xb0c8, 0xb6a3, 0xbfc9, /*0xe8-0xef*/ + 0xcca8, 0xdfb3, 0xcab7, 0xd3d2, 0x85b4, 0xd8cf, 0xd2b6, 0xbac5, /*0xf0-0xf7*/ + 0xcbbe, 0xccbe, 0x85b5, 0xdfb7, 0xb5f0, 0xdfb4, 0x85b6, 0x85b7, /*0xf8-0xff*/ + /* 0x5400 */ + 0x85b8, 0xd3f5, 0x85b9, 0xb3d4, 0xb8f7, 0x85ba, 0xdfba, 0x85bb, /*0x00-0x07*/ + 0xbacf, 0xbcaa, 0xb5f5, 0x85bc, 0xcdac, 0xc3fb, 0xbaf3, 0xc0f4, /*0x08-0x0f*/ + 0xcdc2, 0xcff2, 0xdfb8, 0xcfc5, 0x85bd, 0xc2c0, 0xdfb9, 0xc2f0, /*0x10-0x17*/ + 0x85be, 0x85bf, 0x85c0, 0xbefd, 0x85c1, 0xc1df, 0xcdcc, 0xd2f7, /*0x18-0x1f*/ + 0xb7cd, 0xdfc1, 0x85c2, 0xdfc4, 0x85c3, 0x85c4, 0xb7f1, 0xb0c9, /*0x20-0x27*/ + 0xb6d6, 0xb7d4, 0x85c5, 0xbaac, 0xccfd, 0xbfd4, 0xcbb1, 0xc6f4, /*0x28-0x2f*/ + 0x85c6, 0xd6a8, 0xdfc5, 0x85c7, 0xcee2, 0xb3b3, 0x85c8, 0x85c9, /*0x30-0x37*/ + 0xcefc, 0xb4b5, 0x85ca, 0xcec7, 0xbaf0, 0x85cb, 0xcee1, 0x85cc, /*0x38-0x3f*/ + 0xd1bd, 0x85cd, 0x85ce, 0xdfc0, 0x85cf, 0x85d0, 0xb4f4, 0x85d1, /*0x40-0x47*/ + 0xb3ca, 0x85d2, 0xb8e6, 0xdfbb, 0x85d3, 0x85d4, 0x85d5, 0x85d6, /*0x48-0x4f*/ + 0xc4c5, 0x85d7, 0xdfbc, 0xdfbd, 0xdfbe, 0xc5bb, 0xdfbf, 0xdfc2, /*0x50-0x57*/ + 0xd4b1, 0xdfc3, 0x85d8, 0xc7ba, 0xced8, 0x85d9, 0x85da, 0x85db, /*0x58-0x5f*/ + 0x85dc, 0x85dd, 0xc4d8, 0x85de, 0xdfca, 0x85df, 0xdfcf, 0x85e0, /*0x60-0x67*/ + 0xd6dc, 0x85e1, 0x85e2, 0x85e3, 0x85e4, 0x85e5, 0x85e6, 0x85e7, /*0x68-0x6f*/ + 0x85e8, 0xdfc9, 0xdfda, 0xceb6, 0x85e9, 0xbac7, 0xdfce, 0xdfc8, /*0x70-0x77*/ + 0xc5de, 0x85ea, 0x85eb, 0xc9eb, 0xbaf4, 0xc3fc, 0x85ec, 0x85ed, /*0x78-0x7f*/ + 0xbed7, 0x85ee, 0xdfc6, 0x85ef, 0xdfcd, 0x85f0, 0xc5d8, 0x85f1, /*0x80-0x87*/ + 0x85f2, 0x85f3, 0x85f4, 0xd5a6, 0xbacd, 0x85f5, 0xbecc, 0xd3bd, /*0x88-0x8f*/ + 0xb8c0, 0x85f6, 0xd6e4, 0x85f7, 0xdfc7, 0xb9be, 0xbfa7, 0x85f8, /*0x90-0x97*/ + 0x85f9, 0xc1fc, 0xdfcb, 0xdfcc, 0x85fa, 0xdfd0, 0x85fb, 0x85fc, /*0x98-0x9f*/ + 0x85fd, 0x85fe, 0x8640, 0xdfdb, 0xdfe5, 0x8641, 0xdfd7, 0xdfd6, /*0xa0-0xa7*/ + 0xd7c9, 0xdfe3, 0xdfe4, 0xe5eb, 0xd2a7, 0xdfd2, 0x8642, 0xbfa9, /*0xa8-0xaf*/ + 0x8643, 0xd4db, 0x8644, 0xbfc8, 0xdfd4, 0x8645, 0x8646, 0x8647, /*0xb0-0xb7*/ + 0xcfcc, 0x8648, 0x8649, 0xdfdd, 0x864a, 0xd1ca, 0x864b, 0xdfde, /*0xb8-0xbf*/ + 0xb0a7, 0xc6b7, 0xdfd3, 0x864c, 0xbae5, 0x864d, 0xb6df, 0xcddb, /*0xc0-0xc7*/ + 0xb9fe, 0xd4d5, 0x864e, 0x864f, 0xdfdf, 0xcfec, 0xb0a5, 0xdfe7, /*0xc8-0xcf*/ + 0xdfd1, 0xd1c6, 0xdfd5, 0xdfd8, 0xdfd9, 0xdfdc, 0x8650, 0xbba9, /*0xd0-0xd7*/ + 0x8651, 0xdfe0, 0xdfe1, 0x8652, 0xdfe2, 0xdfe6, 0xdfe8, 0xd3b4, /*0xd8-0xdf*/ + 0x8653, 0x8654, 0x8655, 0x8656, 0x8657, 0xb8e7, 0xc5b6, 0xdfea, /*0xe0-0xe7*/ + 0xc9da, 0xc1a8, 0xc4c4, 0x8658, 0x8659, 0xbfde, 0xcff8, 0x865a, /*0xe8-0xef*/ + 0x865b, 0x865c, 0xd5dc, 0xdfee, 0x865d, 0x865e, 0x865f, 0x8660, /*0xf0-0xf7*/ + 0x8661, 0x8662, 0xb2b8, 0x8663, 0xbadf, 0xdfec, 0x8664, 0xdbc1, /*0xf8-0xff*/ + /* 0x5500 */ + 0x8665, 0xd1e4, 0x8666, 0x8667, 0x8668, 0x8669, 0xcbf4, 0xb4bd, /*0x00-0x07*/ + 0x866a, 0xb0a6, 0x866b, 0x866c, 0x866d, 0x866e, 0x866f, 0xdff1, /*0x08-0x0f*/ + 0xccc6, 0xdff2, 0x8670, 0x8671, 0xdfed, 0x8672, 0x8673, 0x8674, /*0x10-0x17*/ + 0x8675, 0x8676, 0x8677, 0xdfe9, 0x8678, 0x8679, 0x867a, 0x867b, /*0x18-0x1f*/ + 0xdfeb, 0x867c, 0xdfef, 0xdff0, 0xbbbd, 0x867d, 0x867e, 0xdff3, /*0x20-0x27*/ + 0x8680, 0x8681, 0xdff4, 0x8682, 0xbba3, 0x8683, 0xcadb, 0xcea8, /*0x28-0x2f*/ + 0xe0a7, 0xb3aa, 0x8684, 0xe0a6, 0x8685, 0x8686, 0x8687, 0xe0a1, /*0x30-0x37*/ + 0x8688, 0x8689, 0x868a, 0x868b, 0xdffe, 0x868c, 0xcdd9, 0xdffc, /*0x38-0x3f*/ + 0x868d, 0xdffa, 0x868e, 0xbfd0, 0xd7c4, 0x868f, 0xc9cc, 0x8690, /*0x40-0x47*/ + 0x8691, 0xdff8, 0xb0a1, 0x8692, 0x8693, 0x8694, 0x8695, 0x8696, /*0x48-0x4f*/ + 0xdffd, 0x8697, 0x8698, 0x8699, 0x869a, 0xdffb, 0xe0a2, 0x869b, /*0x50-0x57*/ + 0x869c, 0x869d, 0x869e, 0x869f, 0xe0a8, 0x86a0, 0x86a1, 0x86a2, /*0x58-0x5f*/ + 0x86a3, 0xb7c8, 0x86a4, 0x86a5, 0xc6a1, 0xc9b6, 0xc0b2, 0xdff5, /*0x60-0x67*/ + 0x86a6, 0x86a7, 0xc5be, 0x86a8, 0xd8c4, 0xdff9, 0xc4f6, 0x86a9, /*0x68-0x6f*/ + 0x86aa, 0x86ab, 0x86ac, 0x86ad, 0x86ae, 0xe0a3, 0xe0a4, 0xe0a5, /*0x70-0x77*/ + 0xd0a5, 0x86af, 0x86b0, 0xe0b4, 0xcce4, 0x86b1, 0xe0b1, 0x86b2, /*0x78-0x7f*/ + 0xbfa6, 0xe0af, 0xceb9, 0xe0ab, 0xc9c6, 0x86b3, 0x86b4, 0xc0ae, /*0x80-0x87*/ + 0xe0ae, 0xbaed, 0xbab0, 0xe0a9, 0x86b5, 0x86b6, 0x86b7, 0xdff6, /*0x88-0x8f*/ + 0x86b8, 0xe0b3, 0x86b9, 0x86ba, 0xe0b8, 0x86bb, 0x86bc, 0x86bd, /*0x90-0x97*/ + 0xb4ad, 0xe0b9, 0x86be, 0x86bf, 0xcfb2, 0xbac8, 0x86c0, 0xe0b0, /*0x98-0x9f*/ + 0x86c1, 0x86c2, 0x86c3, 0x86c4, 0x86c5, 0x86c6, 0x86c7, 0xd0fa, /*0xa0-0xa7*/ + 0x86c8, 0x86c9, 0x86ca, 0x86cb, 0x86cc, 0x86cd, 0x86ce, 0x86cf, /*0xa8-0xaf*/ + 0x86d0, 0xe0ac, 0x86d1, 0xd4fb, 0x86d2, 0xdff7, 0x86d3, 0xc5e7, /*0xb0-0xb7*/ + 0x86d4, 0xe0ad, 0x86d5, 0xd3f7, 0x86d6, 0xe0b6, 0xe0b7, 0x86d7, /*0xb8-0xbf*/ + 0x86d8, 0x86d9, 0x86da, 0x86db, 0xe0c4, 0xd0e1, 0x86dc, 0x86dd, /*0xc0-0xc7*/ + 0x86de, 0xe0bc, 0x86df, 0x86e0, 0xe0c9, 0xe0ca, 0x86e1, 0x86e2, /*0xc8-0xcf*/ + 0x86e3, 0xe0be, 0xe0aa, 0xc9a4, 0xe0c1, 0x86e4, 0xe0b2, 0x86e5, /*0xd0-0xd7*/ + 0x86e6, 0x86e7, 0x86e8, 0x86e9, 0xcac8, 0xe0c3, 0x86ea, 0xe0b5, /*0xd8-0xdf*/ + 0x86eb, 0xcecb, 0x86ec, 0xcbc3, 0xe0cd, 0xe0c6, 0xe0c2, 0x86ed, /*0xe0-0xe7*/ + 0xe0cb, 0x86ee, 0xe0ba, 0xe0bf, 0xe0c0, 0x86ef, 0x86f0, 0xe0c5, /*0xe8-0xef*/ + 0x86f1, 0x86f2, 0xe0c7, 0xe0c8, 0x86f3, 0xe0cc, 0x86f4, 0xe0bb, /*0xf0-0xf7*/ + 0x86f5, 0x86f6, 0x86f7, 0x86f8, 0x86f9, 0xcbd4, 0xe0d5, 0x86fa, /*0xf8-0xff*/ + /* 0x5600 */ + 0xe0d6, 0xe0d2, 0x86fb, 0x86fc, 0x86fd, 0x86fe, 0x8740, 0x8741, /*0x00-0x07*/ + 0xe0d0, 0xbcce, 0x8742, 0x8743, 0xe0d1, 0x8744, 0xb8c2, 0xd8c5, /*0x08-0x0f*/ + 0x8745, 0x8746, 0x8747, 0x8748, 0x8749, 0x874a, 0x874b, 0x874c, /*0x10-0x17*/ + 0xd0ea, 0x874d, 0x874e, 0xc2ef, 0x874f, 0x8750, 0xe0cf, 0xe0bd, /*0x18-0x1f*/ + 0x8751, 0x8752, 0x8753, 0xe0d4, 0xe0d3, 0x8754, 0x8755, 0xe0d7, /*0x20-0x27*/ + 0x8756, 0x8757, 0x8758, 0x8759, 0xe0dc, 0xe0d8, 0x875a, 0x875b, /*0x28-0x2f*/ + 0x875c, 0xd6f6, 0xb3b0, 0x875d, 0xd7ec, 0x875e, 0xcbbb, 0x875f, /*0x30-0x37*/ + 0x8760, 0xe0da, 0x8761, 0xcefb, 0x8762, 0x8763, 0x8764, 0xbad9, /*0x38-0x3f*/ + 0x8765, 0x8766, 0x8767, 0x8768, 0x8769, 0x876a, 0x876b, 0x876c, /*0x40-0x47*/ + 0x876d, 0x876e, 0x876f, 0x8770, 0xe0e1, 0xe0dd, 0xd2ad, 0x8771, /*0x48-0x4f*/ + 0x8772, 0x8773, 0x8774, 0x8775, 0xe0e2, 0x8776, 0x8777, 0xe0db, /*0x50-0x57*/ + 0xe0d9, 0xe0df, 0x8778, 0x8779, 0xe0e0, 0x877a, 0x877b, 0x877c, /*0x58-0x5f*/ + 0x877d, 0x877e, 0xe0de, 0x8780, 0xe0e4, 0x8781, 0x8782, 0x8783, /*0x60-0x67*/ + 0xc6f7, 0xd8ac, 0xd4eb, 0xe0e6, 0xcac9, 0x8784, 0x8785, 0x8786, /*0x68-0x6f*/ + 0x8787, 0xe0e5, 0x8788, 0x8789, 0x878a, 0x878b, 0xb8c1, 0x878c, /*0x70-0x77*/ + 0x878d, 0x878e, 0x878f, 0xe0e7, 0xe0e8, 0x8790, 0x8791, 0x8792, /*0x78-0x7f*/ + 0x8793, 0x8794, 0x8795, 0x8796, 0x8797, 0xe0e9, 0xe0e3, 0x8798, /*0x80-0x87*/ + 0x8799, 0x879a, 0x879b, 0x879c, 0x879d, 0x879e, 0xbabf, 0xcce7, /*0x88-0x8f*/ + 0x879f, 0x87a0, 0x87a1, 0xe0ea, 0x87a2, 0x87a3, 0x87a4, 0x87a5, /*0x90-0x97*/ + 0x87a6, 0x87a7, 0x87a8, 0x87a9, 0x87aa, 0x87ab, 0x87ac, 0x87ad, /*0x98-0x9f*/ + 0x87ae, 0x87af, 0x87b0, 0xcff9, 0x87b1, 0x87b2, 0x87b3, 0x87b4, /*0xa0-0xa7*/ + 0x87b5, 0x87b6, 0x87b7, 0x87b8, 0x87b9, 0x87ba, 0x87bb, 0xe0eb, /*0xa8-0xaf*/ + 0x87bc, 0x87bd, 0x87be, 0x87bf, 0x87c0, 0x87c1, 0x87c2, 0xc8c2, /*0xb0-0xb7*/ + 0x87c3, 0x87c4, 0x87c5, 0x87c6, 0xbdc0, 0x87c7, 0x87c8, 0x87c9, /*0xb8-0xbf*/ + 0x87ca, 0x87cb, 0x87cc, 0x87cd, 0x87ce, 0x87cf, 0x87d0, 0x87d1, /*0xc0-0xc7*/ + 0x87d2, 0x87d3, 0xc4d2, 0x87d4, 0x87d5, 0x87d6, 0x87d7, 0x87d8, /*0xc8-0xcf*/ + 0x87d9, 0x87da, 0x87db, 0x87dc, 0xe0ec, 0x87dd, 0x87de, 0xe0ed, /*0xd0-0xd7*/ + 0x87df, 0x87e0, 0xc7f4, 0xcbc4, 0x87e1, 0xe0ee, 0xbbd8, 0xd8b6, /*0xd8-0xdf*/ + 0xd2f2, 0xe0ef, 0xcdc5, 0x87e2, 0xb6da, 0x87e3, 0x87e4, 0x87e5, /*0xe0-0xe7*/ + 0x87e6, 0x87e7, 0x87e8, 0xe0f1, 0x87e9, 0xd4b0, 0x87ea, 0x87eb, /*0xe8-0xef*/ + 0xc0a7, 0xb4d1, 0x87ec, 0x87ed, 0xcea7, 0xe0f0, 0x87ee, 0x87ef, /*0xf0-0xf7*/ + 0x87f0, 0xe0f2, 0xb9cc, 0x87f1, 0x87f2, 0xb9fa, 0xcdbc, 0xe0f3, /*0xf8-0xff*/ + /* 0x5700 */ + 0x87f3, 0x87f4, 0x87f5, 0xc6d4, 0xe0f4, 0x87f6, 0xd4b2, 0x87f7, /*0x00-0x07*/ + 0xc8a6, 0xe0f6, 0xe0f5, 0x87f8, 0x87f9, 0x87fa, 0x87fb, 0x87fc, /*0x08-0x0f*/ + 0x87fd, 0x87fe, 0x8840, 0x8841, 0x8842, 0x8843, 0x8844, 0x8845, /*0x10-0x17*/ + 0x8846, 0x8847, 0x8848, 0x8849, 0xe0f7, 0x884a, 0x884b, 0xcdc1, /*0x18-0x1f*/ + 0x884c, 0x884d, 0x884e, 0xcaa5, 0x884f, 0x8850, 0x8851, 0x8852, /*0x20-0x27*/ + 0xd4da, 0xdbd7, 0xdbd9, 0x8853, 0xdbd8, 0xb9e7, 0xdbdc, 0xdbdd, /*0x28-0x2f*/ + 0xb5d8, 0x8854, 0x8855, 0xdbda, 0x8856, 0x8857, 0x8858, 0x8859, /*0x30-0x37*/ + 0x885a, 0xdbdb, 0xb3a1, 0xdbdf, 0x885b, 0x885c, 0xbbf8, 0x885d, /*0x38-0x3f*/ + 0xd6b7, 0x885e, 0xdbe0, 0x885f, 0x8860, 0x8861, 0x8862, 0xbef9, /*0x40-0x47*/ + 0x8863, 0x8864, 0xb7bb, 0x8865, 0xdbd0, 0xccae, 0xbfb2, 0xbbb5, /*0x48-0x4f*/ + 0xd7f8, 0xbfd3, 0x8866, 0x8867, 0x8868, 0x8869, 0x886a, 0xbfe9, /*0x50-0x57*/ + 0x886b, 0x886c, 0xbce1, 0xccb3, 0xdbde, 0xb0d3, 0xceeb, 0xb7d8, /*0x58-0x5f*/ + 0xd7b9, 0xc6c2, 0x886d, 0x886e, 0xc0a4, 0x886f, 0xccb9, 0x8870, /*0x60-0x67*/ + 0xdbe7, 0xdbe1, 0xc6ba, 0xdbe3, 0x8871, 0xdbe8, 0x8872, 0xc5f7, /*0x68-0x6f*/ + 0x8873, 0x8874, 0x8875, 0xdbea, 0x8876, 0x8877, 0xdbe9, 0xbfc0, /*0x70-0x77*/ + 0x8878, 0x8879, 0x887a, 0xdbe6, 0xdbe5, 0x887b, 0x887c, 0x887d, /*0x78-0x7f*/ + 0x887e, 0x8880, 0xb4b9, 0xc0ac, 0xc2a2, 0xdbe2, 0xdbe4, 0x8881, /*0x80-0x87*/ + 0x8882, 0x8883, 0x8884, 0xd0cd, 0xdbed, 0x8885, 0x8886, 0x8887, /*0x88-0x8f*/ + 0x8888, 0x8889, 0xc0dd, 0xdbf2, 0x888a, 0x888b, 0x888c, 0x888d, /*0x90-0x97*/ + 0x888e, 0x888f, 0x8890, 0xb6e2, 0x8891, 0x8892, 0x8893, 0x8894, /*0x98-0x9f*/ + 0xdbf3, 0xdbd2, 0xb9b8, 0xd4ab, 0xdbec, 0x8895, 0xbfd1, 0xdbf0, /*0xa0-0xa7*/ + 0x8896, 0xdbd1, 0x8897, 0xb5e6, 0x8898, 0xdbeb, 0xbfe5, 0x8899, /*0xa8-0xaf*/ + 0x889a, 0x889b, 0xdbee, 0x889c, 0xdbf1, 0x889d, 0x889e, 0x889f, /*0xb0-0xb7*/ + 0xdbf9, 0x88a0, 0x88a1, 0x88a2, 0x88a3, 0x88a4, 0x88a5, 0x88a6, /*0xb8-0xbf*/ + 0x88a7, 0x88a8, 0xb9a1, 0xb0a3, 0x88a9, 0x88aa, 0x88ab, 0x88ac, /*0xc0-0xc7*/ + 0x88ad, 0x88ae, 0x88af, 0xc2f1, 0x88b0, 0x88b1, 0xb3c7, 0xdbef, /*0xc8-0xcf*/ + 0x88b2, 0x88b3, 0xdbf8, 0x88b4, 0xc6d2, 0xdbf4, 0x88b5, 0x88b6, /*0xd0-0xd7*/ + 0xdbf5, 0xdbf7, 0xdbf6, 0x88b7, 0x88b8, 0xdbfe, 0x88b9, 0xd3f2, /*0xd8-0xdf*/ + 0xb2ba, 0x88ba, 0x88bb, 0x88bc, 0xdbfd, 0x88bd, 0x88be, 0x88bf, /*0xe0-0xe7*/ + 0x88c0, 0x88c1, 0x88c2, 0x88c3, 0x88c4, 0xdca4, 0x88c5, 0xdbfb, /*0xe8-0xef*/ + 0x88c6, 0x88c7, 0x88c8, 0x88c9, 0xdbfa, 0x88ca, 0x88cb, 0x88cc, /*0xf0-0xf7*/ + 0xdbfc, 0xc5e0, 0xbbf9, 0x88cd, 0x88ce, 0xdca3, 0x88cf, 0x88d0, /*0xf8-0xff*/ + /* 0x5800 */ + 0xdca5, 0x88d1, 0xccc3, 0x88d2, 0x88d3, 0x88d4, 0xb6d1, 0xddc0, /*0x00-0x07*/ + 0x88d5, 0x88d6, 0x88d7, 0xdca1, 0x88d8, 0xdca2, 0x88d9, 0x88da, /*0x08-0x0f*/ + 0x88db, 0xc7b5, 0x88dc, 0x88dd, 0x88de, 0xb6e9, 0x88df, 0x88e0, /*0x10-0x17*/ + 0x88e1, 0xdca7, 0x88e2, 0x88e3, 0x88e4, 0x88e5, 0xdca6, 0x88e6, /*0x18-0x1f*/ + 0xdca9, 0xb1a4, 0x88e7, 0x88e8, 0xb5cc, 0x88e9, 0x88ea, 0x88eb, /*0x20-0x27*/ + 0x88ec, 0x88ed, 0xbfb0, 0x88ee, 0x88ef, 0x88f0, 0x88f1, 0x88f2, /*0x28-0x2f*/ + 0xd1df, 0x88f3, 0x88f4, 0x88f5, 0x88f6, 0xb6c2, 0x88f7, 0x88f8, /*0x30-0x37*/ + 0x88f9, 0x88fa, 0x88fb, 0x88fc, 0x88fd, 0x88fe, 0x8940, 0x8941, /*0x38-0x3f*/ + 0x8942, 0x8943, 0x8944, 0x8945, 0xdca8, 0x8946, 0x8947, 0x8948, /*0x40-0x47*/ + 0x8949, 0x894a, 0x894b, 0x894c, 0xcbfa, 0xebf3, 0x894d, 0x894e, /*0x48-0x4f*/ + 0x894f, 0xcbdc, 0x8950, 0x8951, 0xcbfe, 0x8952, 0x8953, 0x8954, /*0x50-0x57*/ + 0xccc1, 0x8955, 0x8956, 0x8957, 0x8958, 0x8959, 0xc8fb, 0x895a, /*0x58-0x5f*/ + 0x895b, 0x895c, 0x895d, 0x895e, 0x895f, 0xdcaa, 0x8960, 0x8961, /*0x60-0x67*/ + 0x8962, 0x8963, 0x8964, 0xccee, 0xdcab, 0x8965, 0x8966, 0x8967, /*0x68-0x6f*/ + 0x8968, 0x8969, 0x896a, 0x896b, 0x896c, 0x896d, 0x896e, 0x896f, /*0x70-0x77*/ + 0x8970, 0x8971, 0x8972, 0x8973, 0x8974, 0x8975, 0xdbd3, 0x8976, /*0x78-0x7f*/ + 0xdcaf, 0xdcac, 0x8977, 0xbeb3, 0x8978, 0xcafb, 0x8979, 0x897a, /*0x80-0x87*/ + 0x897b, 0xdcad, 0x897c, 0x897d, 0x897e, 0x8980, 0x8981, 0x8982, /*0x88-0x8f*/ + 0x8983, 0x8984, 0xc9ca, 0xc4b9, 0x8985, 0x8986, 0x8987, 0x8988, /*0x90-0x97*/ + 0x8989, 0xc7bd, 0xdcae, 0x898a, 0x898b, 0x898c, 0xd4f6, 0xd0e6, /*0x98-0x9f*/ + 0x898d, 0x898e, 0x898f, 0x8990, 0x8991, 0x8992, 0x8993, 0x8994, /*0xa0-0xa7*/ + 0xc4ab, 0xb6d5, 0x8995, 0x8996, 0x8997, 0x8998, 0x8999, 0x899a, /*0xa8-0xaf*/ + 0x899b, 0x899c, 0x899d, 0x899e, 0x899f, 0x89a0, 0x89a1, 0x89a2, /*0xb0-0xb7*/ + 0x89a3, 0x89a4, 0x89a5, 0x89a6, 0xdbd4, 0x89a7, 0x89a8, 0x89a9, /*0xb8-0xbf*/ + 0x89aa, 0xb1da, 0x89ab, 0x89ac, 0x89ad, 0xdbd5, 0x89ae, 0x89af, /*0xc0-0xc7*/ + 0x89b0, 0x89b1, 0x89b2, 0x89b3, 0x89b4, 0x89b5, 0x89b6, 0x89b7, /*0xc8-0xcf*/ + 0x89b8, 0xdbd6, 0x89b9, 0x89ba, 0x89bb, 0xbabe, 0x89bc, 0x89bd, /*0xd0-0xd7*/ + 0x89be, 0x89bf, 0x89c0, 0x89c1, 0x89c2, 0x89c3, 0x89c4, 0x89c5, /*0xd8-0xdf*/ + 0x89c6, 0x89c7, 0x89c8, 0x89c9, 0xc8c0, 0x89ca, 0x89cb, 0x89cc, /*0xe0-0xe7*/ + 0x89cd, 0x89ce, 0x89cf, 0xcabf, 0xc8c9, 0x89d0, 0xd7b3, 0x89d1, /*0xe8-0xef*/ + 0xc9f9, 0x89d2, 0x89d3, 0xbfc7, 0x89d4, 0x89d5, 0xbaf8, 0x89d6, /*0xf0-0xf7*/ + 0x89d7, 0xd2bc, 0x89d8, 0x89d9, 0x89da, 0x89db, 0x89dc, 0x89dd, /*0xf8-0xff*/ + /* 0x5900 */ + 0x89de, 0x89df, 0xe2ba, 0x89e0, 0xb4a6, 0x89e1, 0x89e2, 0xb1b8, /*0x00-0x07*/ + 0x89e3, 0x89e4, 0x89e5, 0x89e6, 0x89e7, 0xb8b4, 0x89e8, 0xcfc4, /*0x08-0x0f*/ + 0x89e9, 0x89ea, 0x89eb, 0x89ec, 0xd9e7, 0xcfa6, 0xcde2, 0x89ed, /*0x10-0x17*/ + 0x89ee, 0xd9ed, 0xb6e0, 0x89ef, 0xd2b9, 0x89f0, 0x89f1, 0xb9bb, /*0x18-0x1f*/ + 0x89f2, 0x89f3, 0x89f4, 0x89f5, 0xe2b9, 0xe2b7, 0x89f6, 0xb4f3, /*0x20-0x27*/ + 0x89f7, 0xccec, 0xccab, 0xb7f2, 0x89f8, 0xd8b2, 0xd1eb, 0xbabb, /*0x28-0x2f*/ + 0x89f9, 0xcaa7, 0x89fa, 0x89fb, 0xcdb7, 0x89fc, 0x89fd, 0xd2c4, /*0x30-0x37*/ + 0xbfe4, 0xbcd0, 0xb6e1, 0x89fe, 0xdec5, 0x8a40, 0x8a41, 0x8a42, /*0x38-0x3f*/ + 0x8a43, 0xdec6, 0xdbbc, 0x8a44, 0xd1d9, 0x8a45, 0x8a46, 0xc6e6, /*0x40-0x47*/ + 0xc4ce, 0xb7ee, 0x8a47, 0xb7dc, 0x8a48, 0x8a49, 0xbffc, 0xd7e0, /*0x48-0x4f*/ + 0x8a4a, 0xc6f5, 0x8a4b, 0x8a4c, 0xb1bc, 0xdec8, 0xbdb1, 0xccd7, /*0x50-0x57*/ + 0xdeca, 0x8a4d, 0xdec9, 0x8a4e, 0x8a4f, 0x8a50, 0x8a51, 0x8a52, /*0x58-0x5f*/ + 0xb5ec, 0x8a53, 0xc9dd, 0x8a54, 0x8a55, 0xb0c2, 0x8a56, 0x8a57, /*0x60-0x67*/ + 0x8a58, 0x8a59, 0x8a5a, 0x8a5b, 0x8a5c, 0x8a5d, 0x8a5e, 0x8a5f, /*0x68-0x6f*/ + 0x8a60, 0x8a61, 0x8a62, 0xc5ae, 0xc5ab, 0x8a63, 0xc4cc, 0x8a64, /*0x70-0x77*/ + 0xbce9, 0xcbfd, 0x8a65, 0x8a66, 0x8a67, 0xbac3, 0x8a68, 0x8a69, /*0x78-0x7f*/ + 0x8a6a, 0xe5f9, 0xc8e7, 0xe5fa, 0xcdfd, 0x8a6b, 0xd7b1, 0xb8be, /*0x80-0x87*/ + 0xc2e8, 0x8a6c, 0xc8d1, 0x8a6d, 0x8a6e, 0xe5fb, 0x8a6f, 0x8a70, /*0x88-0x8f*/ + 0x8a71, 0x8a72, 0xb6ca, 0xbccb, 0x8a73, 0x8a74, 0xd1fd, 0xe6a1, /*0x90-0x97*/ + 0x8a75, 0xc3ee, 0x8a76, 0x8a77, 0x8a78, 0x8a79, 0xe6a4, 0x8a7a, /*0x98-0x9f*/ + 0x8a7b, 0x8a7c, 0x8a7d, 0xe5fe, 0xe6a5, 0xcdd7, 0x8a7e, 0x8a80, /*0xa0-0xa7*/ + 0xb7c1, 0xe5fc, 0xe5fd, 0xe6a3, 0x8a81, 0x8a82, 0xc4dd, 0xe6a8, /*0xa8-0xaf*/ + 0x8a83, 0x8a84, 0xe6a7, 0x8a85, 0x8a86, 0x8a87, 0x8a88, 0x8a89, /*0xb0-0xb7*/ + 0x8a8a, 0xc3c3, 0x8a8b, 0xc6de, 0x8a8c, 0x8a8d, 0xe6aa, 0x8a8e, /*0xb8-0xbf*/ + 0x8a8f, 0x8a90, 0x8a91, 0x8a92, 0x8a93, 0x8a94, 0xc4b7, 0x8a95, /*0xc0-0xc7*/ + 0x8a96, 0x8a97, 0xe6a2, 0xcabc, 0x8a98, 0x8a99, 0x8a9a, 0x8a9b, /*0xc8-0xcf*/ + 0xbde3, 0xb9c3, 0xe6a6, 0xd0d5, 0xceaf, 0x8a9c, 0x8a9d, 0xe6a9, /*0xd0-0xd7*/ + 0xe6b0, 0x8a9e, 0xd2a6, 0x8a9f, 0xbdaa, 0xe6ad, 0x8aa0, 0x8aa1, /*0xd8-0xdf*/ + 0x8aa2, 0x8aa3, 0x8aa4, 0xe6af, 0x8aa5, 0xc0d1, 0x8aa6, 0x8aa7, /*0xe0-0xe7*/ + 0xd2cc, 0x8aa8, 0x8aa9, 0x8aaa, 0xbca7, 0x8aab, 0x8aac, 0x8aad, /*0xe8-0xef*/ + 0x8aae, 0x8aaf, 0x8ab0, 0x8ab1, 0x8ab2, 0x8ab3, 0x8ab4, 0x8ab5, /*0xf0-0xf7*/ + 0x8ab6, 0xe6b1, 0x8ab7, 0xd2f6, 0x8ab8, 0x8ab9, 0x8aba, 0xd7cb, /*0xf8-0xff*/ + /* 0x5a00 */ + 0x8abb, 0xcdfe, 0x8abc, 0xcdde, 0xc2a6, 0xe6ab, 0xe6ac, 0xbdbf, /*0x00-0x07*/ + 0xe6ae, 0xe6b3, 0x8abd, 0x8abe, 0xe6b2, 0x8abf, 0x8ac0, 0x8ac1, /*0x08-0x0f*/ + 0x8ac2, 0xe6b6, 0x8ac3, 0xe6b8, 0x8ac4, 0x8ac5, 0x8ac6, 0x8ac7, /*0x10-0x17*/ + 0xc4ef, 0x8ac8, 0x8ac9, 0x8aca, 0xc4c8, 0x8acb, 0x8acc, 0xbeea, /*0x18-0x1f*/ + 0xc9ef, 0x8acd, 0x8ace, 0xe6b7, 0x8acf, 0xb6f0, 0x8ad0, 0x8ad1, /*0x20-0x27*/ + 0x8ad2, 0xc3e4, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad6, 0x8ad7, 0x8ad8, /*0x28-0x2f*/ + 0x8ad9, 0xd3e9, 0xe6b4, 0x8ada, 0xe6b5, 0x8adb, 0xc8a2, 0x8adc, /*0x30-0x37*/ + 0x8add, 0x8ade, 0x8adf, 0x8ae0, 0xe6bd, 0x8ae1, 0x8ae2, 0x8ae3, /*0x38-0x3f*/ + 0xe6b9, 0x8ae4, 0x8ae5, 0x8ae6, 0x8ae7, 0x8ae8, 0xc6c5, 0x8ae9, /*0x40-0x47*/ + 0x8aea, 0xcdf1, 0xe6bb, 0x8aeb, 0x8aec, 0x8aed, 0x8aee, 0x8aef, /*0x48-0x4f*/ + 0x8af0, 0x8af1, 0x8af2, 0x8af3, 0x8af4, 0xe6bc, 0x8af5, 0x8af6, /*0x50-0x57*/ + 0x8af7, 0x8af8, 0xbbe9, 0x8af9, 0x8afa, 0x8afb, 0x8afc, 0x8afd, /*0x58-0x5f*/ + 0x8afe, 0x8b40, 0xe6be, 0x8b41, 0x8b42, 0x8b43, 0x8b44, 0xe6ba, /*0x60-0x67*/ + 0x8b45, 0x8b46, 0xc0b7, 0x8b47, 0x8b48, 0x8b49, 0x8b4a, 0x8b4b, /*0x68-0x6f*/ + 0x8b4c, 0x8b4d, 0x8b4e, 0x8b4f, 0xd3a4, 0xe6bf, 0xc9f4, 0xe6c3, /*0x70-0x77*/ + 0x8b50, 0x8b51, 0xe6c4, 0x8b52, 0x8b53, 0x8b54, 0x8b55, 0xd0f6, /*0x78-0x7f*/ + 0x8b56, 0x8b57, 0x8b58, 0x8b59, 0x8b5a, 0x8b5b, 0x8b5c, 0x8b5d, /*0x80-0x87*/ + 0x8b5e, 0x8b5f, 0x8b60, 0x8b61, 0x8b62, 0x8b63, 0x8b64, 0x8b65, /*0x88-0x8f*/ + 0x8b66, 0x8b67, 0xc3bd, 0x8b68, 0x8b69, 0x8b6a, 0x8b6b, 0x8b6c, /*0x90-0x97*/ + 0x8b6d, 0x8b6e, 0xc3c4, 0xe6c2, 0x8b6f, 0x8b70, 0x8b71, 0x8b72, /*0x98-0x9f*/ + 0x8b73, 0x8b74, 0x8b75, 0x8b76, 0x8b77, 0x8b78, 0x8b79, 0x8b7a, /*0xa0-0xa7*/ + 0x8b7b, 0x8b7c, 0xe6c1, 0x8b7d, 0x8b7e, 0x8b80, 0x8b81, 0x8b82, /*0xa8-0xaf*/ + 0x8b83, 0x8b84, 0xe6c7, 0xcfb1, 0x8b85, 0xebf4, 0x8b86, 0x8b87, /*0xb0-0xb7*/ + 0xe6ca, 0x8b88, 0x8b89, 0x8b8a, 0x8b8b, 0x8b8c, 0xe6c5, 0x8b8d, /*0xb8-0xbf*/ + 0x8b8e, 0xbcde, 0xc9a9, 0x8b8f, 0x8b90, 0x8b91, 0x8b92, 0x8b93, /*0xc0-0xc7*/ + 0x8b94, 0xbcb5, 0x8b95, 0x8b96, 0xcfd3, 0x8b97, 0x8b98, 0x8b99, /*0xc8-0xcf*/ + 0x8b9a, 0x8b9b, 0xe6c8, 0x8b9c, 0xe6c9, 0x8b9d, 0xe6ce, 0x8b9e, /*0xd0-0xd7*/ + 0xe6d0, 0x8b9f, 0x8ba0, 0x8ba1, 0xe6d1, 0x8ba2, 0x8ba3, 0x8ba4, /*0xd8-0xdf*/ + 0xe6cb, 0xb5d5, 0x8ba5, 0xe6cc, 0x8ba6, 0x8ba7, 0xe6cf, 0x8ba8, /*0xe0-0xe7*/ + 0x8ba9, 0xc4db, 0x8baa, 0xe6c6, 0x8bab, 0x8bac, 0x8bad, 0x8bae, /*0xe8-0xef*/ + 0x8baf, 0xe6cd, 0x8bb0, 0x8bb1, 0x8bb2, 0x8bb3, 0x8bb4, 0x8bb5, /*0xf0-0xf7*/ + 0x8bb6, 0x8bb7, 0x8bb8, 0x8bb9, 0x8bba, 0x8bbb, 0x8bbc, 0x8bbd, /*0xf8-0xff*/ + /* 0x5b00 */ + 0x8bbe, 0x8bbf, 0x8bc0, 0x8bc1, 0x8bc2, 0x8bc3, 0x8bc4, 0x8bc5, /*0x00-0x07*/ + 0x8bc6, 0xe6d2, 0x8bc7, 0x8bc8, 0x8bc9, 0x8bca, 0x8bcb, 0x8bcc, /*0x08-0x0f*/ + 0x8bcd, 0x8bce, 0x8bcf, 0x8bd0, 0x8bd1, 0x8bd2, 0xe6d4, 0xe6d3, /*0x10-0x17*/ + 0x8bd3, 0x8bd4, 0x8bd5, 0x8bd6, 0x8bd7, 0x8bd8, 0x8bd9, 0x8bda, /*0x18-0x1f*/ + 0x8bdb, 0x8bdc, 0x8bdd, 0x8bde, 0x8bdf, 0x8be0, 0x8be1, 0x8be2, /*0x20-0x27*/ + 0x8be3, 0x8be4, 0x8be5, 0x8be6, 0x8be7, 0x8be8, 0x8be9, 0x8bea, /*0x28-0x2f*/ + 0x8beb, 0x8bec, 0xe6d5, 0x8bed, 0xd9f8, 0x8bee, 0x8bef, 0xe6d6, /*0x30-0x37*/ + 0x8bf0, 0x8bf1, 0x8bf2, 0x8bf3, 0x8bf4, 0x8bf5, 0x8bf6, 0x8bf7, /*0x38-0x3f*/ + 0xe6d7, 0x8bf8, 0x8bf9, 0x8bfa, 0x8bfb, 0x8bfc, 0x8bfd, 0x8bfe, /*0x40-0x47*/ + 0x8c40, 0x8c41, 0x8c42, 0x8c43, 0x8c44, 0x8c45, 0x8c46, 0x8c47, /*0x48-0x4f*/ + 0xd7d3, 0xe6dd, 0x8c48, 0xe6de, 0xbfd7, 0xd4d0, 0x8c49, 0xd7d6, /*0x50-0x57*/ + 0xb4e6, 0xcbef, 0xe6da, 0xd8c3, 0xd7ce, 0xd0a2, 0x8c4a, 0xc3cf, /*0x58-0x5f*/ + 0x8c4b, 0x8c4c, 0xe6df, 0xbcbe, 0xb9c2, 0xe6db, 0xd1a7, 0x8c4d, /*0x60-0x67*/ + 0x8c4e, 0xbaa2, 0xc2cf, 0x8c4f, 0xd8ab, 0x8c50, 0x8c51, 0x8c52, /*0x68-0x6f*/ + 0xcaeb, 0xe5ee, 0x8c53, 0xe6dc, 0x8c54, 0xb7f5, 0x8c55, 0x8c56, /*0x70-0x77*/ + 0x8c57, 0x8c58, 0xc8e6, 0x8c59, 0x8c5a, 0xc4f5, 0x8c5b, 0x8c5c, /*0x78-0x7f*/ + 0xe5b2, 0xc4fe, 0x8c5d, 0xcbfc, 0xe5b3, 0xd5ac, 0x8c5e, 0xd3ee, /*0x80-0x87*/ + 0xcad8, 0xb0b2, 0x8c5f, 0xcbce, 0xcdea, 0x8c60, 0x8c61, 0xbaea, /*0x88-0x8f*/ + 0x8c62, 0x8c63, 0x8c64, 0xe5b5, 0x8c65, 0xe5b4, 0x8c66, 0xd7da, /*0x90-0x97*/ + 0xb9d9, 0xd6e6, 0xb6a8, 0xcdf0, 0xd2cb, 0xb1a6, 0xcab5, 0x8c67, /*0x98-0x9f*/ + 0xb3e8, 0xc9f3, 0xbfcd, 0xd0fb, 0xcad2, 0xe5b6, 0xbbc2, 0x8c68, /*0xa0-0xa7*/ + 0x8c69, 0x8c6a, 0xcfdc, 0xb9ac, 0x8c6b, 0x8c6c, 0x8c6d, 0x8c6e, /*0xa8-0xaf*/ + 0xd4d7, 0x8c6f, 0x8c70, 0xbaa6, 0xd1e7, 0xcffc, 0xbcd2, 0x8c71, /*0xb0-0xb7*/ + 0xe5b7, 0xc8dd, 0x8c72, 0x8c73, 0x8c74, 0xbfed, 0xb1f6, 0xcbde, /*0xb8-0xbf*/ + 0x8c75, 0x8c76, 0xbcc5, 0x8c77, 0xbcc4, 0xd2fa, 0xc3dc, 0xbfdc, /*0xc0-0xc7*/ + 0x8c78, 0x8c79, 0x8c7a, 0x8c7b, 0xb8bb, 0x8c7c, 0x8c7d, 0x8c7e, /*0xc8-0xcf*/ + 0xc3c2, 0x8c80, 0xbaae, 0xd4a2, 0x8c81, 0x8c82, 0x8c83, 0x8c84, /*0xd0-0xd7*/ + 0x8c85, 0x8c86, 0x8c87, 0x8c88, 0x8c89, 0xc7de, 0xc4af, 0xb2ec, /*0xd8-0xdf*/ + 0x8c8a, 0xb9d1, 0x8c8b, 0x8c8c, 0xe5bb, 0xc1c8, 0x8c8d, 0x8c8e, /*0xe0-0xe7*/ + 0xd5af, 0x8c8f, 0x8c90, 0x8c91, 0x8c92, 0x8c93, 0xe5bc, 0x8c94, /*0xe8-0xef*/ + 0xe5be, 0x8c95, 0x8c96, 0x8c97, 0x8c98, 0x8c99, 0x8c9a, 0x8c9b, /*0xf0-0xf7*/ + 0xb4e7, 0xb6d4, 0xcbc2, 0xd1b0, 0xb5bc, 0x8c9c, 0x8c9d, 0xcad9, /*0xf8-0xff*/ + /* 0x5c00 */ + 0x8c9e, 0xb7e2, 0x8c9f, 0x8ca0, 0xc9e4, 0x8ca1, 0xbdab, 0x8ca2, /*0x00-0x07*/ + 0x8ca3, 0xcebe, 0xd7f0, 0x8ca4, 0x8ca5, 0x8ca6, 0x8ca7, 0xd0a1, /*0x08-0x0f*/ + 0x8ca8, 0xc9d9, 0x8ca9, 0x8caa, 0xb6fb, 0xe6d8, 0xbce2, 0x8cab, /*0x10-0x17*/ + 0xb3be, 0x8cac, 0xc9d0, 0x8cad, 0xe6d9, 0xb3a2, 0x8cae, 0x8caf, /*0x18-0x1f*/ + 0x8cb0, 0x8cb1, 0xdecc, 0x8cb2, 0xd3c8, 0xdecd, 0x8cb3, 0xd2a2, /*0x20-0x27*/ + 0x8cb4, 0x8cb5, 0x8cb6, 0x8cb7, 0xdece, 0x8cb8, 0x8cb9, 0x8cba, /*0x28-0x2f*/ + 0x8cbb, 0xbecd, 0x8cbc, 0x8cbd, 0xdecf, 0x8cbe, 0x8cbf, 0x8cc0, /*0x30-0x37*/ + 0xcaac, 0xd2fc, 0xb3df, 0xe5ea, 0xc4e1, 0xbea1, 0xceb2, 0xc4f2, /*0x38-0x3f*/ + 0xbed6, 0xc6a8, 0xb2e3, 0x8cc1, 0x8cc2, 0xbed3, 0x8cc3, 0x8cc4, /*0x40-0x47*/ + 0xc7fc, 0xcceb, 0xbdec, 0xcedd, 0x8cc5, 0x8cc6, 0xcaba, 0xc6c1, /*0x48-0x4f*/ + 0xe5ec, 0xd0bc, 0x8cc7, 0x8cc8, 0x8cc9, 0xd5b9, 0x8cca, 0x8ccb, /*0x50-0x57*/ + 0x8ccc, 0xe5ed, 0x8ccd, 0x8cce, 0x8ccf, 0x8cd0, 0xcaf4, 0x8cd1, /*0x58-0x5f*/ + 0xcdc0, 0xc2c5, 0x8cd2, 0xe5ef, 0x8cd3, 0xc2c4, 0xe5f0, 0x8cd4, /*0x60-0x67*/ + 0x8cd5, 0x8cd6, 0x8cd7, 0x8cd8, 0x8cd9, 0x8cda, 0xe5f8, 0xcdcd, /*0x68-0x6f*/ + 0x8cdb, 0xc9bd, 0x8cdc, 0x8cdd, 0x8cde, 0x8cdf, 0x8ce0, 0x8ce1, /*0x70-0x77*/ + 0x8ce2, 0xd2d9, 0xe1a8, 0x8ce3, 0x8ce4, 0x8ce5, 0x8ce6, 0xd3ec, /*0x78-0x7f*/ + 0x8ce7, 0xcbea, 0xc6f1, 0x8ce8, 0x8ce9, 0x8cea, 0x8ceb, 0x8cec, /*0x80-0x87*/ + 0xe1ac, 0x8ced, 0x8cee, 0x8cef, 0xe1a7, 0xe1a9, 0x8cf0, 0x8cf1, /*0x88-0x8f*/ + 0xe1aa, 0xe1af, 0x8cf2, 0x8cf3, 0xb2ed, 0x8cf4, 0xe1ab, 0xb8da, /*0x90-0x97*/ + 0xe1ad, 0xe1ae, 0xe1b0, 0xb5ba, 0xe1b1, 0x8cf5, 0x8cf6, 0x8cf7, /*0x98-0x9f*/ + 0x8cf8, 0x8cf9, 0xe1b3, 0xe1b8, 0x8cfa, 0x8cfb, 0x8cfc, 0x8cfd, /*0xa0-0xa7*/ + 0x8cfe, 0xd1d2, 0x8d40, 0xe1b6, 0xe1b5, 0xc1eb, 0x8d41, 0x8d42, /*0xa8-0xaf*/ + 0x8d43, 0xe1b7, 0x8d44, 0xd4c0, 0x8d45, 0xe1b2, 0x8d46, 0xe1ba, /*0xb0-0xb7*/ + 0xb0b6, 0x8d47, 0x8d48, 0x8d49, 0x8d4a, 0xe1b4, 0x8d4b, 0xbff9, /*0xb8-0xbf*/ + 0x8d4c, 0xe1b9, 0x8d4d, 0x8d4e, 0xe1bb, 0x8d4f, 0x8d50, 0x8d51, /*0xc0-0xc7*/ + 0x8d52, 0x8d53, 0x8d54, 0xe1be, 0x8d55, 0x8d56, 0x8d57, 0x8d58, /*0xc8-0xcf*/ + 0x8d59, 0x8d5a, 0xe1bc, 0x8d5b, 0x8d5c, 0x8d5d, 0x8d5e, 0x8d5f, /*0xd0-0xd7*/ + 0x8d60, 0xd6c5, 0x8d61, 0x8d62, 0x8d63, 0x8d64, 0x8d65, 0x8d66, /*0xd8-0xdf*/ + 0x8d67, 0xcfbf, 0x8d68, 0x8d69, 0xe1bd, 0xe1bf, 0xc2cd, 0x8d6a, /*0xe0-0xe7*/ + 0xb6eb, 0x8d6b, 0xd3f8, 0x8d6c, 0x8d6d, 0xc7cd, 0x8d6e, 0x8d6f, /*0xe8-0xef*/ + 0xb7e5, 0x8d70, 0x8d71, 0x8d72, 0x8d73, 0x8d74, 0x8d75, 0x8d76, /*0xf0-0xf7*/ + 0x8d77, 0x8d78, 0x8d79, 0xbefe, 0x8d7a, 0x8d7b, 0x8d7c, 0x8d7d, /*0xf8-0xff*/ + /* 0x5d00 */ + 0x8d7e, 0x8d80, 0xe1c0, 0xe1c1, 0x8d81, 0x8d82, 0xe1c7, 0xb3e7, /*0x00-0x07*/ + 0x8d83, 0x8d84, 0x8d85, 0x8d86, 0x8d87, 0x8d88, 0xc6e9, 0x8d89, /*0x08-0x0f*/ + 0x8d8a, 0x8d8b, 0x8d8c, 0x8d8d, 0xb4de, 0x8d8e, 0xd1c2, 0x8d8f, /*0x10-0x17*/ + 0x8d90, 0x8d91, 0x8d92, 0xe1c8, 0x8d93, 0x8d94, 0xe1c6, 0x8d95, /*0x18-0x1f*/ + 0x8d96, 0x8d97, 0x8d98, 0x8d99, 0xe1c5, 0x8d9a, 0xe1c3, 0xe1c2, /*0x20-0x27*/ + 0x8d9b, 0xb1c0, 0x8d9c, 0x8d9d, 0x8d9e, 0xd5b8, 0xe1c4, 0x8d9f, /*0x28-0x2f*/ + 0x8da0, 0x8da1, 0x8da2, 0x8da3, 0xe1cb, 0x8da4, 0x8da5, 0x8da6, /*0x30-0x37*/ + 0x8da7, 0x8da8, 0x8da9, 0x8daa, 0x8dab, 0xe1cc, 0xe1ca, 0x8dac, /*0x38-0x3f*/ + 0x8dad, 0x8dae, 0x8daf, 0x8db0, 0x8db1, 0x8db2, 0x8db3, 0xeffa, /*0x40-0x47*/ + 0x8db4, 0x8db5, 0xe1d3, 0xe1d2, 0xc7b6, 0x8db6, 0x8db7, 0x8db8, /*0x48-0x4f*/ + 0x8db9, 0x8dba, 0x8dbb, 0x8dbc, 0x8dbd, 0x8dbe, 0x8dbf, 0x8dc0, /*0x50-0x57*/ + 0xe1c9, 0x8dc1, 0x8dc2, 0xe1ce, 0x8dc3, 0xe1d0, 0x8dc4, 0x8dc5, /*0x58-0x5f*/ + 0x8dc6, 0x8dc7, 0x8dc8, 0x8dc9, 0x8dca, 0x8dcb, 0x8dcc, 0x8dcd, /*0x60-0x67*/ + 0x8dce, 0xe1d4, 0x8dcf, 0xe1d1, 0xe1cd, 0x8dd0, 0x8dd1, 0xe1cf, /*0x68-0x6f*/ + 0x8dd2, 0x8dd3, 0x8dd4, 0x8dd5, 0xe1d5, 0x8dd6, 0x8dd7, 0x8dd8, /*0x70-0x77*/ + 0x8dd9, 0x8dda, 0x8ddb, 0x8ddc, 0x8ddd, 0x8dde, 0x8ddf, 0x8de0, /*0x78-0x7f*/ + 0x8de1, 0x8de2, 0xe1d6, 0x8de3, 0x8de4, 0x8de5, 0x8de6, 0x8de7, /*0x80-0x87*/ + 0x8de8, 0x8de9, 0x8dea, 0x8deb, 0x8dec, 0x8ded, 0x8dee, 0x8def, /*0x88-0x8f*/ + 0x8df0, 0x8df1, 0x8df2, 0x8df3, 0x8df4, 0x8df5, 0x8df6, 0x8df7, /*0x90-0x97*/ + 0x8df8, 0xe1d7, 0x8df9, 0x8dfa, 0x8dfb, 0xe1d8, 0x8dfc, 0x8dfd, /*0x98-0x9f*/ + 0x8dfe, 0x8e40, 0x8e41, 0x8e42, 0x8e43, 0x8e44, 0x8e45, 0x8e46, /*0xa0-0xa7*/ + 0x8e47, 0x8e48, 0x8e49, 0x8e4a, 0x8e4b, 0x8e4c, 0x8e4d, 0x8e4e, /*0xa8-0xaf*/ + 0x8e4f, 0x8e50, 0x8e51, 0x8e52, 0x8e53, 0x8e54, 0x8e55, 0xe1da, /*0xb0-0xb7*/ + 0x8e56, 0x8e57, 0x8e58, 0x8e59, 0x8e5a, 0x8e5b, 0x8e5c, 0x8e5d, /*0xb8-0xbf*/ + 0x8e5e, 0x8e5f, 0x8e60, 0x8e61, 0x8e62, 0xe1db, 0x8e63, 0x8e64, /*0xc0-0xc7*/ + 0x8e65, 0x8e66, 0x8e67, 0x8e68, 0x8e69, 0xcea1, 0x8e6a, 0x8e6b, /*0xc8-0xcf*/ + 0x8e6c, 0x8e6d, 0x8e6e, 0x8e6f, 0x8e70, 0x8e71, 0x8e72, 0x8e73, /*0xd0-0xd7*/ + 0x8e74, 0x8e75, 0x8e76, 0xe7dd, 0x8e77, 0xb4a8, 0xd6dd, 0x8e78, /*0xd8-0xdf*/ + 0x8e79, 0xd1b2, 0xb3b2, 0x8e7a, 0x8e7b, 0xb9a4, 0xd7f3, 0xc7c9, /*0xe0-0xe7*/ + 0xbede, 0xb9ae, 0x8e7c, 0xced7, 0x8e7d, 0x8e7e, 0xb2ee, 0xdbcf, /*0xe8-0xef*/ + 0x8e80, 0xbcba, 0xd2d1, 0xcbc8, 0xb0cd, 0x8e81, 0x8e82, 0xcfef, /*0xf0-0xf7*/ + 0x8e83, 0x8e84, 0x8e85, 0x8e86, 0x8e87, 0xd9e3, 0xbded, 0x8e88, /*0xf8-0xff*/ + /* 0x5e00 */ + 0x8e89, 0xb1d2, 0xcad0, 0xb2bc, 0x8e8a, 0xcba7, 0xb7ab, 0x8e8b, /*0x00-0x07*/ + 0xcaa6, 0x8e8c, 0x8e8d, 0x8e8e, 0xcfa3, 0x8e8f, 0x8e90, 0xe0f8, /*0x08-0x0f*/ + 0xd5ca, 0xe0fb, 0x8e91, 0x8e92, 0xe0fa, 0xc5c1, 0xccfb, 0x8e93, /*0x10-0x17*/ + 0xc1b1, 0xe0f9, 0xd6e3, 0xb2af, 0xd6c4, 0xb5db, 0x8e94, 0x8e95, /*0x18-0x1f*/ + 0x8e96, 0x8e97, 0x8e98, 0x8e99, 0x8e9a, 0x8e9b, 0xb4f8, 0xd6a1, /*0x20-0x27*/ + 0x8e9c, 0x8e9d, 0x8e9e, 0x8e9f, 0x8ea0, 0xcfaf, 0xb0ef, 0x8ea1, /*0x28-0x2f*/ + 0x8ea2, 0xe0fc, 0x8ea3, 0x8ea4, 0x8ea5, 0x8ea6, 0x8ea7, 0xe1a1, /*0x30-0x37*/ + 0xb3a3, 0x8ea8, 0x8ea9, 0xe0fd, 0xe0fe, 0xc3b1, 0x8eaa, 0x8eab, /*0x38-0x3f*/ + 0x8eac, 0x8ead, 0xc3dd, 0x8eae, 0xe1a2, 0xb7f9, 0x8eaf, 0x8eb0, /*0x40-0x47*/ + 0x8eb1, 0x8eb2, 0x8eb3, 0x8eb4, 0xbbcf, 0x8eb5, 0x8eb6, 0x8eb7, /*0x48-0x4f*/ + 0x8eb8, 0x8eb9, 0x8eba, 0x8ebb, 0xe1a3, 0xc4bb, 0x8ebc, 0x8ebd, /*0x50-0x57*/ + 0x8ebe, 0x8ebf, 0x8ec0, 0xe1a4, 0x8ec1, 0x8ec2, 0xe1a5, 0x8ec3, /*0x58-0x5f*/ + 0x8ec4, 0xe1a6, 0xb4b1, 0x8ec5, 0x8ec6, 0x8ec7, 0x8ec8, 0x8ec9, /*0x60-0x67*/ + 0x8eca, 0x8ecb, 0x8ecc, 0x8ecd, 0x8ece, 0x8ecf, 0x8ed0, 0x8ed1, /*0x68-0x6f*/ + 0x8ed2, 0x8ed3, 0xb8c9, 0xc6bd, 0xc4ea, 0x8ed4, 0xb2a2, 0x8ed5, /*0x70-0x77*/ + 0xd0d2, 0x8ed6, 0xe7db, 0xbbc3, 0xd3d7, 0xd3c4, 0x8ed7, 0xb9e3, /*0x78-0x7f*/ + 0xe2cf, 0x8ed8, 0x8ed9, 0x8eda, 0xd7af, 0x8edb, 0xc7ec, 0xb1d3, /*0x80-0x87*/ + 0x8edc, 0x8edd, 0xb4b2, 0xe2d1, 0x8ede, 0x8edf, 0x8ee0, 0xd0f2, /*0x88-0x8f*/ + 0xc2ae, 0xe2d0, 0x8ee1, 0xbfe2, 0xd3a6, 0xb5d7, 0xe2d2, 0xb5ea, /*0x90-0x97*/ + 0x8ee2, 0xc3ed, 0xb8fd, 0x8ee3, 0xb8ae, 0x8ee4, 0xc5d3, 0xb7cf, /*0x98-0x9f*/ + 0xe2d4, 0x8ee5, 0x8ee6, 0x8ee7, 0x8ee8, 0xe2d3, 0xb6c8, 0xd7f9, /*0xa0-0xa7*/ + 0x8ee9, 0x8eea, 0x8eeb, 0x8eec, 0x8eed, 0xcda5, 0x8eee, 0x8eef, /*0xa8-0xaf*/ + 0x8ef0, 0x8ef1, 0x8ef2, 0xe2d8, 0x8ef3, 0xe2d6, 0xcafc, 0xbfb5, /*0xb0-0xb7*/ + 0xd3b9, 0xe2d5, 0x8ef4, 0x8ef5, 0x8ef6, 0x8ef7, 0xe2d7, 0x8ef8, /*0xb8-0xbf*/ + 0x8ef9, 0x8efa, 0x8efb, 0x8efc, 0x8efd, 0x8efe, 0x8f40, 0x8f41, /*0xc0-0xc7*/ + 0x8f42, 0xc1ae, 0xc0c8, 0x8f43, 0x8f44, 0x8f45, 0x8f46, 0x8f47, /*0xc8-0xcf*/ + 0x8f48, 0xe2db, 0xe2da, 0xc0aa, 0x8f49, 0x8f4a, 0xc1ce, 0x8f4b, /*0xd0-0xd7*/ + 0x8f4c, 0x8f4d, 0x8f4e, 0xe2dc, 0x8f4f, 0x8f50, 0x8f51, 0x8f52, /*0xd8-0xdf*/ + 0x8f53, 0x8f54, 0x8f55, 0x8f56, 0x8f57, 0x8f58, 0x8f59, 0x8f5a, /*0xe0-0xe7*/ + 0xe2dd, 0x8f5b, 0xe2de, 0x8f5c, 0x8f5d, 0x8f5e, 0x8f5f, 0x8f60, /*0xe8-0xef*/ + 0x8f61, 0x8f62, 0x8f63, 0x8f64, 0xdbc8, 0x8f65, 0xd1d3, 0xcda2, /*0xf0-0xf7*/ + 0x8f66, 0x8f67, 0xbda8, 0x8f68, 0x8f69, 0x8f6a, 0xdec3, 0xd8a5, /*0xf8-0xff*/ + /* 0x5f00 */ + 0xbfaa, 0xdbcd, 0xd2ec, 0xc6fa, 0xc5aa, 0x8f6b, 0x8f6c, 0x8f6d, /*0x00-0x07*/ + 0xdec4, 0x8f6e, 0xb1d7, 0xdfae, 0x8f6f, 0x8f70, 0x8f71, 0xcabd, /*0x08-0x0f*/ + 0x8f72, 0xdfb1, 0x8f73, 0xb9ad, 0x8f74, 0xd2fd, 0x8f75, 0xb8a5, /*0x10-0x17*/ + 0xbaeb, 0x8f76, 0x8f77, 0xb3da, 0x8f78, 0x8f79, 0x8f7a, 0xb5dc, /*0x18-0x1f*/ + 0xd5c5, 0x8f7b, 0x8f7c, 0x8f7d, 0x8f7e, 0xc3d6, 0xcfd2, 0xbba1, /*0x20-0x27*/ + 0x8f80, 0xe5f3, 0xe5f2, 0x8f81, 0x8f82, 0xe5f4, 0x8f83, 0xcde4, /*0x28-0x2f*/ + 0x8f84, 0xc8f5, 0x8f85, 0x8f86, 0x8f87, 0x8f88, 0x8f89, 0x8f8a, /*0x30-0x37*/ + 0x8f8b, 0xb5af, 0xc7bf, 0x8f8c, 0xe5f6, 0x8f8d, 0x8f8e, 0x8f8f, /*0x38-0x3f*/ + 0xecb0, 0x8f90, 0x8f91, 0x8f92, 0x8f93, 0x8f94, 0x8f95, 0x8f96, /*0x40-0x47*/ + 0x8f97, 0x8f98, 0x8f99, 0x8f9a, 0x8f9b, 0x8f9c, 0x8f9d, 0x8f9e, /*0x48-0x4f*/ + 0xe5e6, 0x8f9f, 0xb9e9, 0xb5b1, 0x8fa0, 0xc2bc, 0xe5e8, 0xe5e7, /*0x50-0x57*/ + 0xe5e9, 0x8fa1, 0x8fa2, 0x8fa3, 0x8fa4, 0xd2cd, 0x8fa5, 0x8fa6, /*0x58-0x5f*/ + 0x8fa7, 0xe1ea, 0xd0ce, 0x8fa8, 0xcdae, 0x8fa9, 0xd1e5, 0x8faa, /*0x60-0x67*/ + 0x8fab, 0xb2ca, 0xb1eb, 0x8fac, 0xb1f2, 0xc5ed, 0x8fad, 0x8fae, /*0x68-0x6f*/ + 0xd5c3, 0xd3b0, 0x8faf, 0xe1dc, 0x8fb0, 0x8fb1, 0x8fb2, 0xe1dd, /*0x70-0x77*/ + 0x8fb3, 0xd2db, 0x8fb4, 0xb3b9, 0xb1cb, 0x8fb5, 0x8fb6, 0x8fb7, /*0x78-0x7f*/ + 0xcdf9, 0xd5f7, 0xe1de, 0x8fb8, 0xbeb6, 0xb4fd, 0x8fb9, 0xe1df, /*0x80-0x87*/ + 0xbadc, 0xe1e0, 0xbbb2, 0xc2c9, 0xe1e1, 0x8fba, 0x8fbb, 0x8fbc, /*0x88-0x8f*/ + 0xd0ec, 0x8fbd, 0xcdbd, 0x8fbe, 0x8fbf, 0xe1e2, 0x8fc0, 0xb5c3, /*0x90-0x97*/ + 0xc5c7, 0xe1e3, 0x8fc1, 0x8fc2, 0xe1e4, 0x8fc3, 0x8fc4, 0x8fc5, /*0x98-0x9f*/ + 0x8fc6, 0xd3f9, 0x8fc7, 0x8fc8, 0x8fc9, 0x8fca, 0x8fcb, 0x8fcc, /*0xa0-0xa7*/ + 0xe1e5, 0x8fcd, 0xd1ad, 0x8fce, 0x8fcf, 0xe1e6, 0xcea2, 0x8fd0, /*0xa8-0xaf*/ + 0x8fd1, 0x8fd2, 0x8fd3, 0x8fd4, 0x8fd5, 0xe1e7, 0x8fd6, 0xb5c2, /*0xb0-0xb7*/ + 0x8fd7, 0x8fd8, 0x8fd9, 0x8fda, 0xe1e8, 0xbbd5, 0x8fdb, 0x8fdc, /*0xb8-0xbf*/ + 0x8fdd, 0x8fde, 0x8fdf, 0xd0c4, 0xe2e0, 0xb1d8, 0xd2e4, 0x8fe0, /*0xc0-0xc7*/ + 0x8fe1, 0xe2e1, 0x8fe2, 0x8fe3, 0xbcc9, 0xc8cc, 0x8fe4, 0xe2e3, /*0xc8-0xcf*/ + 0xecfe, 0xecfd, 0xdfaf, 0x8fe5, 0x8fe6, 0x8fe7, 0xe2e2, 0xd6be, /*0xd0-0xd7*/ + 0xcdfc, 0xc3a6, 0x8fe8, 0x8fe9, 0x8fea, 0xe3c3, 0x8feb, 0x8fec, /*0xd8-0xdf*/ + 0xd6d2, 0xe2e7, 0x8fed, 0x8fee, 0xe2e8, 0x8fef, 0x8ff0, 0xd3c7, /*0xe0-0xe7*/ + 0x8ff1, 0x8ff2, 0xe2ec, 0xbfec, 0x8ff3, 0xe2ed, 0xe2e5, 0x8ff4, /*0xe8-0xef*/ + 0x8ff5, 0xb3c0, 0x8ff6, 0x8ff7, 0x8ff8, 0xc4ee, 0x8ff9, 0x8ffa, /*0xf0-0xf7*/ + 0xe2ee, 0x8ffb, 0x8ffc, 0xd0c3, 0x8ffd, 0xbaf6, 0xe2e9, 0xb7de, /*0xf8-0xff*/ + /* 0x6000 */ + 0xbbb3, 0xccac, 0xcbcb, 0xe2e4, 0xe2e6, 0xe2ea, 0xe2eb, 0x8ffe, /*0x00-0x07*/ + 0x9040, 0x9041, 0xe2f7, 0x9042, 0x9043, 0xe2f4, 0xd4f5, 0xe2f3, /*0x08-0x0f*/ + 0x9044, 0x9045, 0xc5ad, 0x9046, 0xd5fa, 0xc5c2, 0xb2c0, 0x9047, /*0x10-0x17*/ + 0x9048, 0xe2ef, 0x9049, 0xe2f2, 0xc1af, 0xcbbc, 0x904a, 0x904b, /*0x18-0x1f*/ + 0xb5a1, 0xe2f9, 0x904c, 0x904d, 0x904e, 0xbcb1, 0xe2f1, 0xd0d4, /*0x20-0x27*/ + 0xd4b9, 0xe2f5, 0xb9d6, 0xe2f6, 0x904f, 0x9050, 0x9051, 0xc7d3, /*0x28-0x2f*/ + 0x9052, 0x9053, 0x9054, 0x9055, 0x9056, 0xe2f0, 0x9057, 0x9058, /*0x30-0x37*/ + 0x9059, 0x905a, 0x905b, 0xd7dc, 0xeda1, 0x905c, 0x905d, 0xe2f8, /*0x38-0x3f*/ + 0x905e, 0xeda5, 0xe2fe, 0xcad1, 0x905f, 0x9060, 0x9061, 0x9062, /*0x40-0x47*/ + 0x9063, 0x9064, 0x9065, 0xc1b5, 0x9066, 0xbbd0, 0x9067, 0x9068, /*0x48-0x4f*/ + 0xbfd6, 0x9069, 0xbae3, 0x906a, 0x906b, 0xcba1, 0x906c, 0x906d, /*0x50-0x57*/ + 0x906e, 0xeda6, 0xeda3, 0x906f, 0x9070, 0xeda2, 0x9071, 0x9072, /*0x58-0x5f*/ + 0x9073, 0x9074, 0xbbd6, 0xeda7, 0xd0f4, 0x9075, 0x9076, 0xeda4, /*0x60-0x67*/ + 0xbade, 0xb6f7, 0xe3a1, 0xb6b2, 0xccf1, 0xb9a7, 0x9077, 0xcfa2, /*0x68-0x6f*/ + 0xc7a1, 0x9078, 0x9079, 0xbfd2, 0x907a, 0x907b, 0xb6f1, 0x907c, /*0x70-0x77*/ + 0xe2fa, 0xe2fb, 0xe2fd, 0xe2fc, 0xc4d5, 0xe3a2, 0x907d, 0xd3c1, /*0x78-0x7f*/ + 0x907e, 0x9080, 0x9081, 0xe3a7, 0xc7c4, 0x9082, 0x9083, 0x9084, /*0x80-0x87*/ + 0x9085, 0xcfa4, 0x9086, 0x9087, 0xe3a9, 0xbab7, 0x9088, 0x9089, /*0x88-0x8f*/ + 0x908a, 0x908b, 0xe3a8, 0x908c, 0xbbda, 0x908d, 0xe3a3, 0x908e, /*0x90-0x97*/ + 0x908f, 0x9090, 0xe3a4, 0xe3aa, 0x9091, 0xe3a6, 0x9092, 0xcef2, /*0x98-0x9f*/ + 0xd3c6, 0x9093, 0x9094, 0xbbbc, 0x9095, 0x9096, 0xd4c3, 0x9097, /*0xa0-0xa7*/ + 0xc4fa, 0x9098, 0x9099, 0xeda8, 0xd0fc, 0xe3a5, 0x909a, 0xc3f5, /*0xa8-0xaf*/ + 0x909b, 0xe3ad, 0xb1af, 0x909c, 0xe3b2, 0x909d, 0x909e, 0x909f, /*0xb0-0xb7*/ + 0xbcc2, 0x90a0, 0x90a1, 0xe3ac, 0xb5bf, 0x90a2, 0x90a3, 0x90a4, /*0xb8-0xbf*/ + 0x90a5, 0x90a6, 0x90a7, 0x90a8, 0x90a9, 0xc7e9, 0xe3b0, 0x90aa, /*0xc0-0xc7*/ + 0x90ab, 0x90ac, 0xbeaa, 0xcdef, 0x90ad, 0x90ae, 0x90af, 0x90b0, /*0xc8-0xcf*/ + 0x90b1, 0xbbf3, 0x90b2, 0x90b3, 0x90b4, 0xcce8, 0x90b5, 0x90b6, /*0xd0-0xd7*/ + 0xe3af, 0x90b7, 0xe3b1, 0x90b8, 0xcfa7, 0xe3ae, 0x90b9, 0xcea9, /*0xd8-0xdf*/ + 0xbbdd, 0x90ba, 0x90bb, 0x90bc, 0x90bd, 0x90be, 0xb5eb, 0xbee5, /*0xe0-0xe7*/ + 0xb2d2, 0xb3cd, 0x90bf, 0xb1b9, 0xe3ab, 0xb2d1, 0xb5ac, 0xb9df, /*0xe8-0xef*/ + 0xb6e8, 0x90c0, 0x90c1, 0xcfeb, 0xe3b7, 0x90c2, 0xbbcc, 0x90c3, /*0xf0-0xf7*/ + 0x90c4, 0xc8c7, 0xd0ca, 0x90c5, 0x90c6, 0x90c7, 0x90c8, 0x90c9, /*0xf8-0xff*/ + /* 0x6100 */ + 0xe3b8, 0xb3ee, 0x90ca, 0x90cb, 0x90cc, 0x90cd, 0xeda9, 0x90ce, /*0x00-0x07*/ + 0xd3fa, 0xd3e4, 0x90cf, 0x90d0, 0x90d1, 0xedaa, 0xe3b9, 0xd2e2, /*0x08-0x0f*/ + 0x90d2, 0x90d3, 0x90d4, 0x90d5, 0x90d6, 0xe3b5, 0x90d7, 0x90d8, /*0x10-0x17*/ + 0x90d9, 0x90da, 0xd3de, 0x90db, 0x90dc, 0x90dd, 0x90de, 0xb8d0, /*0x18-0x1f*/ + 0xe3b3, 0x90df, 0x90e0, 0xe3b6, 0xb7df, 0x90e1, 0xe3b4, 0xc0a2, /*0x20-0x27*/ + 0x90e2, 0x90e3, 0x90e4, 0xe3ba, 0x90e5, 0x90e6, 0x90e7, 0x90e8, /*0x28-0x2f*/ + 0x90e9, 0x90ea, 0x90eb, 0x90ec, 0x90ed, 0x90ee, 0x90ef, 0x90f0, /*0x30-0x37*/ + 0x90f1, 0x90f2, 0x90f3, 0x90f4, 0x90f5, 0x90f6, 0x90f7, 0xd4b8, /*0x38-0x3f*/ + 0x90f8, 0x90f9, 0x90fa, 0x90fb, 0x90fc, 0x90fd, 0x90fe, 0x9140, /*0x40-0x47*/ + 0xb4c8, 0x9141, 0xe3bb, 0x9142, 0xbbc5, 0x9143, 0xc9f7, 0x9144, /*0x48-0x4f*/ + 0x9145, 0xc9e5, 0x9146, 0x9147, 0x9148, 0xc4bd, 0x9149, 0x914a, /*0x50-0x57*/ + 0x914b, 0x914c, 0x914d, 0x914e, 0x914f, 0xedab, 0x9150, 0x9151, /*0x58-0x5f*/ + 0x9152, 0x9153, 0xc2fd, 0x9154, 0x9155, 0x9156, 0x9157, 0xbbdb, /*0x60-0x67*/ + 0xbfae, 0x9158, 0x9159, 0x915a, 0x915b, 0x915c, 0x915d, 0x915e, /*0x68-0x6f*/ + 0xcebf, 0x915f, 0x9160, 0x9161, 0x9162, 0xe3bc, 0x9163, 0xbfb6, /*0x70-0x77*/ + 0x9164, 0x9165, 0x9166, 0x9167, 0x9168, 0x9169, 0x916a, 0x916b, /*0x78-0x7f*/ + 0x916c, 0x916d, 0x916e, 0x916f, 0x9170, 0x9171, 0x9172, 0x9173, /*0x80-0x87*/ + 0x9174, 0x9175, 0x9176, 0xb1ef, 0x9177, 0x9178, 0xd4f7, 0x9179, /*0x88-0x8f*/ + 0x917a, 0x917b, 0x917c, 0x917d, 0xe3be, 0x917e, 0x9180, 0x9181, /*0x90-0x97*/ + 0x9182, 0x9183, 0x9184, 0x9185, 0x9186, 0xedad, 0x9187, 0x9188, /*0x98-0x9f*/ + 0x9189, 0x918a, 0x918b, 0x918c, 0x918d, 0x918e, 0x918f, 0xe3bf, /*0xa0-0xa7*/ + 0xbaa9, 0xedac, 0x9190, 0x9191, 0xe3bd, 0x9192, 0x9193, 0x9194, /*0xa8-0xaf*/ + 0x9195, 0x9196, 0x9197, 0x9198, 0x9199, 0x919a, 0x919b, 0xe3c0, /*0xb0-0xb7*/ + 0x919c, 0x919d, 0x919e, 0x919f, 0x91a0, 0x91a1, 0xbab6, 0x91a2, /*0xb8-0xbf*/ + 0x91a3, 0x91a4, 0xb6ae, 0x91a5, 0x91a6, 0x91a7, 0x91a8, 0x91a9, /*0xc0-0xc7*/ + 0xd0b8, 0x91aa, 0xb0c3, 0xedae, 0x91ab, 0x91ac, 0x91ad, 0x91ae, /*0xc8-0xcf*/ + 0x91af, 0xedaf, 0xc0c1, 0x91b0, 0xe3c1, 0x91b1, 0x91b2, 0x91b3, /*0xd0-0xd7*/ + 0x91b4, 0x91b5, 0x91b6, 0x91b7, 0x91b8, 0x91b9, 0x91ba, 0x91bb, /*0xd8-0xdf*/ + 0x91bc, 0x91bd, 0x91be, 0x91bf, 0x91c0, 0x91c1, 0xc5b3, 0x91c2, /*0xe0-0xe7*/ + 0x91c3, 0x91c4, 0x91c5, 0x91c6, 0x91c7, 0x91c8, 0x91c9, 0x91ca, /*0xe8-0xef*/ + 0x91cb, 0x91cc, 0x91cd, 0x91ce, 0x91cf, 0xe3c2, 0x91d0, 0x91d1, /*0xf0-0xf7*/ + 0x91d2, 0x91d3, 0x91d4, 0x91d5, 0x91d6, 0x91d7, 0x91d8, 0xdcb2, /*0xf8-0xff*/ + /* 0x6200 */ + 0x91d9, 0x91da, 0x91db, 0x91dc, 0x91dd, 0x91de, 0xedb0, 0x91df, /*0x00-0x07*/ + 0xb8ea, 0x91e0, 0xceec, 0xeaa7, 0xd0e7, 0xcaf9, 0xc8d6, 0xcfb7, /*0x08-0x0f*/ + 0xb3c9, 0xced2, 0xbde4, 0x91e1, 0x91e2, 0xe3de, 0xbbf2, 0xeaa8, /*0x10-0x17*/ + 0xd5bd, 0x91e3, 0xc6dd, 0xeaa9, 0x91e4, 0x91e5, 0x91e6, 0xeaaa, /*0x18-0x1f*/ + 0x91e7, 0xeaac, 0xeaab, 0x91e8, 0xeaae, 0xeaad, 0x91e9, 0x91ea, /*0x20-0x27*/ + 0x91eb, 0x91ec, 0xbdd8, 0x91ed, 0xeaaf, 0x91ee, 0xc2be, 0x91ef, /*0x28-0x2f*/ + 0x91f0, 0x91f1, 0x91f2, 0xb4c1, 0xb4f7, 0x91f3, 0x91f4, 0xbba7, /*0x30-0x37*/ + 0x91f5, 0x91f6, 0x91f7, 0x91f8, 0x91f9, 0xece6, 0xece5, 0xb7bf, /*0x38-0x3f*/ + 0xcbf9, 0xb1e2, 0x91fa, 0xece7, 0x91fb, 0x91fc, 0x91fd, 0xc9c8, /*0x40-0x47*/ + 0xece8, 0xece9, 0x91fe, 0xcad6, 0xded0, 0xb2c5, 0xd4fa, 0x9240, /*0x48-0x4f*/ + 0x9241, 0xc6cb, 0xb0c7, 0xb4f2, 0xc8d3, 0x9242, 0x9243, 0x9244, /*0x50-0x57*/ + 0xcdd0, 0x9245, 0x9246, 0xbfb8, 0x9247, 0x9248, 0x9249, 0x924a, /*0x58-0x5f*/ + 0x924b, 0x924c, 0x924d, 0xbfdb, 0x924e, 0x924f, 0xc7a4, 0xd6b4, /*0x60-0x67*/ + 0x9250, 0xc0a9, 0xded1, 0xc9a8, 0xd1ef, 0xc5a4, 0xb0e7, 0xb3b6, /*0x68-0x6f*/ + 0xc8c5, 0x9251, 0x9252, 0xb0e2, 0x9253, 0x9254, 0xb7f6, 0x9255, /*0x70-0x77*/ + 0x9256, 0xc5fa, 0x9257, 0x9258, 0xb6f3, 0x9259, 0xd5d2, 0xb3d0, /*0x78-0x7f*/ + 0xbcbc, 0x925a, 0x925b, 0x925c, 0xb3ad, 0x925d, 0x925e, 0x925f, /*0x80-0x87*/ + 0x9260, 0xbef1, 0xb0d1, 0x9261, 0x9262, 0x9263, 0x9264, 0x9265, /*0x88-0x8f*/ + 0x9266, 0xd2d6, 0xcae3, 0xd7a5, 0x9267, 0xcdb6, 0xb6b6, 0xbfb9, /*0x90-0x97*/ + 0xd5db, 0x9268, 0xb8a7, 0xc5d7, 0x9269, 0x926a, 0x926b, 0xded2, /*0x98-0x9f*/ + 0xbfd9, 0xc2d5, 0xc7c0, 0x926c, 0xbba4, 0xb1a8, 0x926d, 0x926e, /*0xa0-0xa7*/ + 0xc5ea, 0x926f, 0x9270, 0xc5fb, 0xcca7, 0x9271, 0x9272, 0x9273, /*0xa8-0xaf*/ + 0x9274, 0xb1a7, 0x9275, 0x9276, 0x9277, 0xb5d6, 0x9278, 0x9279, /*0xb0-0xb7*/ + 0x927a, 0xc4a8, 0x927b, 0xded3, 0xd1ba, 0xb3e9, 0x927c, 0xc3f2, /*0xb8-0xbf*/ + 0x927d, 0x927e, 0xb7f7, 0x9280, 0xd6f4, 0xb5a3, 0xb2f0, 0xc4b4, /*0xc0-0xc7*/ + 0xc4e9, 0xc0ad, 0xded4, 0x9281, 0xb0e8, 0xc5c4, 0xc1e0, 0x9282, /*0xc8-0xcf*/ + 0xb9d5, 0x9283, 0xbedc, 0xcdd8, 0xb0ce, 0x9284, 0xcdcf, 0xded6, /*0xd0-0xd7*/ + 0xbed0, 0xd7be, 0xded5, 0xd5d0, 0xb0dd, 0x9285, 0x9286, 0xc4e2, /*0xd8-0xdf*/ + 0x9287, 0x9288, 0xc2a3, 0xbcf0, 0x9289, 0xd3b5, 0xc0b9, 0xc5a1, /*0xe0-0xe7*/ + 0xb2a6, 0xd4f1, 0x928a, 0x928b, 0xc0a8, 0xcac3, 0xded7, 0xd5fc, /*0xe8-0xef*/ + 0x928c, 0xb9b0, 0x928d, 0xc8ad, 0xcba9, 0x928e, 0xded9, 0xbfbd, /*0xf0-0xf7*/ + 0x928f, 0x9290, 0x9291, 0x9292, 0xc6b4, 0xd7a7, 0xcab0, 0xc4c3, /*0xf8-0xff*/ + /* 0x6300 */ + 0x9293, 0xb3d6, 0xb9d2, 0x9294, 0x9295, 0x9296, 0x9297, 0xd6b8, /*0x00-0x07*/ + 0xeafc, 0xb0b4, 0x9298, 0x9299, 0x929a, 0x929b, 0xbfe6, 0x929c, /*0x08-0x0f*/ + 0x929d, 0xccf4, 0x929e, 0x929f, 0x92a0, 0x92a1, 0xcdda, 0x92a2, /*0x10-0x17*/ + 0x92a3, 0x92a4, 0xd6bf, 0xc2ce, 0x92a5, 0xcece, 0xcca2, 0xd0ae, /*0x18-0x1f*/ + 0xc4d3, 0xb5b2, 0xded8, 0xd5f5, 0xbcb7, 0xbbd3, 0x92a6, 0x92a7, /*0x20-0x27*/ + 0xb0a4, 0x92a8, 0xc5b2, 0xb4ec, 0x92a9, 0x92aa, 0x92ab, 0xd5f1, /*0x28-0x2f*/ + 0x92ac, 0x92ad, 0xeafd, 0x92ae, 0x92af, 0x92b0, 0x92b1, 0x92b2, /*0x30-0x37*/ + 0x92b3, 0xdeda, 0xcda6, 0x92b4, 0x92b5, 0xcdec, 0x92b6, 0x92b7, /*0x38-0x3f*/ + 0x92b8, 0x92b9, 0xcee6, 0xdedc, 0x92ba, 0xcdb1, 0xc0a6, 0x92bb, /*0x40-0x47*/ + 0x92bc, 0xd7bd, 0x92bd, 0xdedb, 0xb0c6, 0xbab4, 0xc9d3, 0xc4f3, /*0x48-0x4f*/ + 0xbee8, 0x92be, 0x92bf, 0x92c0, 0x92c1, 0xb2b6, 0x92c2, 0x92c3, /*0x50-0x57*/ + 0x92c4, 0x92c5, 0x92c6, 0x92c7, 0x92c8, 0x92c9, 0xc0cc, 0xcbf0, /*0x58-0x5f*/ + 0x92ca, 0xbcf1, 0xbbbb, 0xb5b7, 0x92cb, 0x92cc, 0x92cd, 0xc5f5, /*0x60-0x67*/ + 0x92ce, 0xdee6, 0x92cf, 0x92d0, 0x92d1, 0xdee3, 0xbedd, 0x92d2, /*0x68-0x6f*/ + 0x92d3, 0xdedf, 0x92d4, 0x92d5, 0x92d6, 0x92d7, 0xb4b7, 0xbddd, /*0x70-0x77*/ + 0x92d8, 0x92d9, 0xdee0, 0xc4ed, 0x92da, 0x92db, 0x92dc, 0x92dd, /*0x78-0x7f*/ + 0xcfc6, 0x92de, 0xb5e0, 0x92df, 0x92e0, 0x92e1, 0x92e2, 0xb6de, /*0x80-0x87*/ + 0xcada, 0xb5f4, 0xdee5, 0x92e3, 0xd5c6, 0x92e4, 0xdee1, 0xcccd, /*0x88-0x8f*/ + 0xc6fe, 0x92e5, 0xc5c5, 0x92e6, 0x92e7, 0x92e8, 0xd2b4, 0x92e9, /*0x90-0x97*/ + 0xbef2, 0x92ea, 0x92eb, 0x92ec, 0x92ed, 0x92ee, 0x92ef, 0x92f0, /*0x98-0x9f*/ + 0xc2d3, 0x92f1, 0xccbd, 0xb3b8, 0x92f2, 0xbdd3, 0x92f3, 0xbfd8, /*0xa0-0xa7*/ + 0xcdc6, 0xd1da, 0xb4eb, 0x92f4, 0xdee4, 0xdedd, 0xdee7, 0x92f5, /*0xa8-0xaf*/ + 0xeafe, 0x92f6, 0x92f7, 0xc2b0, 0xdee2, 0x92f8, 0x92f9, 0xd6c0, /*0xb0-0xb7*/ + 0xb5a7, 0x92fa, 0xb2f4, 0x92fb, 0xdee8, 0x92fc, 0xdef2, 0x92fd, /*0xb8-0xbf*/ + 0x92fe, 0x9340, 0x9341, 0x9342, 0xdeed, 0x9343, 0xdef1, 0x9344, /*0xc0-0xc7*/ + 0x9345, 0xc8e0, 0x9346, 0x9347, 0x9348, 0xd7e1, 0xdeef, 0xc3e8, /*0xc8-0xcf*/ + 0xcce1, 0x9349, 0xb2e5, 0x934a, 0x934b, 0x934c, 0xd2be, 0x934d, /*0xd0-0xd7*/ + 0x934e, 0x934f, 0x9350, 0x9351, 0x9352, 0x9353, 0xdeee, 0x9354, /*0xd8-0xdf*/ + 0xdeeb, 0xced5, 0x9355, 0xb4a7, 0x9356, 0x9357, 0x9358, 0x9359, /*0xe0-0xe7*/ + 0x935a, 0xbfab, 0xbebe, 0x935b, 0x935c, 0xbdd2, 0x935d, 0x935e, /*0xe8-0xef*/ + 0x935f, 0x9360, 0xdee9, 0x9361, 0xd4ae, 0x9362, 0xdede, 0x9363, /*0xf0-0xf7*/ + 0xdeea, 0x9364, 0x9365, 0x9366, 0x9367, 0xc0bf, 0x9368, 0xdeec, /*0xf8-0xff*/ + /* 0x6400 */ + 0xb2f3, 0xb8e9, 0xc2a7, 0x9369, 0x936a, 0xbdc1, 0x936b, 0x936c, /*0x00-0x07*/ + 0x936d, 0x936e, 0x936f, 0xdef5, 0xdef8, 0x9370, 0x9371, 0xb2ab, /*0x08-0x0f*/ + 0xb4a4, 0x9372, 0x9373, 0xb4ea, 0xc9a6, 0x9374, 0x9375, 0x9376, /*0x10-0x17*/ + 0x9377, 0x9378, 0x9379, 0xdef6, 0xcbd1, 0x937a, 0xb8e3, 0x937b, /*0x18-0x1f*/ + 0xdef7, 0xdefa, 0x937c, 0x937d, 0x937e, 0x9380, 0xdef9, 0x9381, /*0x20-0x27*/ + 0x9382, 0x9383, 0xccc2, 0x9384, 0xb0e1, 0xb4ee, 0x9385, 0x9386, /*0x28-0x2f*/ + 0x9387, 0x9388, 0x9389, 0x938a, 0xe5ba, 0x938b, 0x938c, 0x938d, /*0x30-0x37*/ + 0x938e, 0x938f, 0xd0af, 0x9390, 0x9391, 0xb2eb, 0x9392, 0xeba1, /*0x38-0x3f*/ + 0x9393, 0xdef4, 0x9394, 0x9395, 0xc9e3, 0xdef3, 0xb0da, 0xd2a1, /*0x40-0x47*/ + 0xb1f7, 0x9396, 0xccaf, 0x9397, 0x9398, 0x9399, 0x939a, 0x939b, /*0x48-0x4f*/ + 0x939c, 0x939d, 0xdef0, 0x939e, 0xcba4, 0x939f, 0x93a0, 0x93a1, /*0x50-0x57*/ + 0xd5aa, 0x93a2, 0x93a3, 0x93a4, 0x93a5, 0x93a6, 0xdefb, 0x93a7, /*0x58-0x5f*/ + 0x93a8, 0x93a9, 0x93aa, 0x93ab, 0x93ac, 0x93ad, 0x93ae, 0xb4dd, /*0x60-0x67*/ + 0x93af, 0xc4a6, 0x93b0, 0x93b1, 0x93b2, 0xdefd, 0x93b3, 0x93b4, /*0x68-0x6f*/ + 0x93b5, 0x93b6, 0x93b7, 0x93b8, 0x93b9, 0x93ba, 0x93bb, 0x93bc, /*0x70-0x77*/ + 0xc3fe, 0xc4a1, 0xdfa1, 0x93bd, 0x93be, 0x93bf, 0x93c0, 0x93c1, /*0x78-0x7f*/ + 0x93c2, 0x93c3, 0xc1cc, 0x93c4, 0xdefc, 0xbeef, 0x93c5, 0xc6b2, /*0x80-0x87*/ + 0x93c6, 0x93c7, 0x93c8, 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, /*0x88-0x8f*/ + 0x93ce, 0xb3c5, 0xc8f6, 0x93cf, 0x93d0, 0xcbba, 0xdefe, 0x93d1, /*0x90-0x97*/ + 0x93d2, 0xdfa4, 0x93d3, 0x93d4, 0x93d5, 0x93d6, 0xd7b2, 0x93d7, /*0x98-0x9f*/ + 0x93d8, 0x93d9, 0x93da, 0x93db, 0xb3b7, 0x93dc, 0x93dd, 0x93de, /*0xa0-0xa7*/ + 0x93df, 0xc1c3, 0x93e0, 0x93e1, 0xc7cb, 0xb2a5, 0xb4e9, 0x93e2, /*0xa8-0xaf*/ + 0xd7ab, 0x93e3, 0x93e4, 0x93e5, 0x93e6, 0xc4ec, 0x93e7, 0xdfa2, /*0xb0-0xb7*/ + 0xdfa3, 0x93e8, 0xdfa5, 0x93e9, 0xbab3, 0x93ea, 0x93eb, 0x93ec, /*0xb8-0xbf*/ + 0xdfa6, 0x93ed, 0xc0de, 0x93ee, 0x93ef, 0xc9c3, 0x93f0, 0x93f1, /*0xc0-0xc7*/ + 0x93f2, 0x93f3, 0x93f4, 0x93f5, 0x93f6, 0xb2d9, 0xc7e6, 0x93f7, /*0xc8-0xcf*/ + 0xdfa7, 0x93f8, 0xc7dc, 0x93f9, 0x93fa, 0x93fb, 0x93fc, 0xdfa8, /*0xd0-0xd7*/ + 0xeba2, 0x93fd, 0x93fe, 0x9440, 0x9441, 0x9442, 0xcbd3, 0x9443, /*0xd8-0xdf*/ + 0x9444, 0x9445, 0xdfaa, 0x9446, 0xdfa9, 0x9447, 0xb2c1, 0x9448, /*0xe0-0xe7*/ + 0x9449, 0x944a, 0x944b, 0x944c, 0x944d, 0x944e, 0x944f, 0x9450, /*0xe8-0xef*/ + 0x9451, 0x9452, 0x9453, 0x9454, 0x9455, 0x9456, 0x9457, 0x9458, /*0xf0-0xf7*/ + 0x9459, 0x945a, 0x945b, 0x945c, 0x945d, 0x945e, 0x945f, 0x9460, /*0xf8-0xff*/ + /* 0x6500 */ + 0xc5ca, 0x9461, 0x9462, 0x9463, 0x9464, 0x9465, 0x9466, 0x9467, /*0x00-0x07*/ + 0x9468, 0xdfab, 0x9469, 0x946a, 0x946b, 0x946c, 0x946d, 0x946e, /*0x08-0x0f*/ + 0x946f, 0x9470, 0xd4dc, 0x9471, 0x9472, 0x9473, 0x9474, 0x9475, /*0x10-0x17*/ + 0xc8c1, 0x9476, 0x9477, 0x9478, 0x9479, 0x947a, 0x947b, 0x947c, /*0x18-0x1f*/ + 0x947d, 0x947e, 0x9480, 0x9481, 0x9482, 0xdfac, 0x9483, 0x9484, /*0x20-0x27*/ + 0x9485, 0x9486, 0x9487, 0xbef0, 0x9488, 0x9489, 0xdfad, 0xd6a7, /*0x28-0x2f*/ + 0x948a, 0x948b, 0x948c, 0x948d, 0xeab7, 0xebb6, 0xcad5, 0x948e, /*0x30-0x37*/ + 0xd8fc, 0xb8c4, 0x948f, 0xb9a5, 0x9490, 0x9491, 0xb7c5, 0xd5fe, /*0x38-0x3f*/ + 0x9492, 0x9493, 0x9494, 0x9495, 0x9496, 0xb9ca, 0x9497, 0x9498, /*0x40-0x47*/ + 0xd0a7, 0xf4cd, 0x9499, 0x949a, 0xb5d0, 0x949b, 0x949c, 0xc3f4, /*0x48-0x4f*/ + 0x949d, 0xbec8, 0x949e, 0x949f, 0x94a0, 0xebb7, 0xb0bd, 0x94a1, /*0x50-0x57*/ + 0x94a2, 0xbdcc, 0x94a3, 0xc1b2, 0x94a4, 0xb1d6, 0xb3a8, 0x94a5, /*0x58-0x5f*/ + 0x94a6, 0x94a7, 0xb8d2, 0xc9a2, 0x94a8, 0x94a9, 0xb6d8, 0x94aa, /*0x60-0x67*/ + 0x94ab, 0x94ac, 0x94ad, 0xebb8, 0xbeb4, 0x94ae, 0x94af, 0x94b0, /*0x68-0x6f*/ + 0xcafd, 0x94b1, 0xc7c3, 0x94b2, 0xd5fb, 0x94b3, 0x94b4, 0xb7f3, /*0x70-0x77*/ + 0x94b5, 0x94b6, 0x94b7, 0x94b8, 0x94b9, 0x94ba, 0x94bb, 0x94bc, /*0x78-0x7f*/ + 0x94bd, 0x94be, 0x94bf, 0x94c0, 0x94c1, 0x94c2, 0x94c3, 0xcec4, /*0x80-0x87*/ + 0x94c4, 0x94c5, 0x94c6, 0xd5ab, 0xb1f3, 0x94c7, 0x94c8, 0x94c9, /*0x88-0x8f*/ + 0xecb3, 0xb0df, 0x94ca, 0xecb5, 0x94cb, 0x94cc, 0x94cd, 0xb6b7, /*0x90-0x97*/ + 0x94ce, 0xc1cf, 0x94cf, 0xf5fa, 0xd0b1, 0x94d0, 0x94d1, 0xd5e5, /*0x98-0x9f*/ + 0x94d2, 0xced3, 0x94d3, 0x94d4, 0xbdef, 0xb3e2, 0x94d5, 0xb8ab, /*0xa0-0xa7*/ + 0x94d6, 0xd5b6, 0x94d7, 0xedbd, 0x94d8, 0xb6cf, 0x94d9, 0xcbb9, /*0xa8-0xaf*/ + 0xd0c2, 0x94da, 0x94db, 0x94dc, 0x94dd, 0x94de, 0x94df, 0x94e0, /*0xb0-0xb7*/ + 0x94e1, 0xb7bd, 0x94e2, 0x94e3, 0xecb6, 0xcaa9, 0x94e4, 0x94e5, /*0xb8-0xbf*/ + 0x94e6, 0xc5d4, 0x94e7, 0xecb9, 0xecb8, 0xc2c3, 0xecb7, 0x94e8, /*0xc0-0xc7*/ + 0x94e9, 0x94ea, 0x94eb, 0xd0fd, 0xecba, 0x94ec, 0xecbb, 0xd7e5, /*0xc8-0xcf*/ + 0x94ed, 0x94ee, 0xecbc, 0x94ef, 0x94f0, 0x94f1, 0xecbd, 0xc6ec, /*0xd0-0xd7*/ + 0x94f2, 0x94f3, 0x94f4, 0x94f5, 0x94f6, 0x94f7, 0x94f8, 0x94f9, /*0xd8-0xdf*/ + 0xcede, 0x94fa, 0xbcc8, 0x94fb, 0x94fc, 0xc8d5, 0xb5a9, 0xbec9, /*0xe0-0xe7*/ + 0xd6bc, 0xd4e7, 0x94fd, 0x94fe, 0xd1ae, 0xd0f1, 0xeab8, 0xeab9, /*0xe8-0xef*/ + 0xeaba, 0xbab5, 0x9540, 0x9541, 0x9542, 0x9543, 0xcab1, 0xbff5, /*0xf0-0xf7*/ + 0x9544, 0x9545, 0xcdfa, 0x9546, 0x9547, 0x9548, 0x9549, 0x954a, /*0xf8-0xff*/ + /* 0x6600 */ + 0xeac0, 0x954b, 0xb0ba, 0xeabe, 0x954c, 0x954d, 0xc0a5, 0x954e, /*0x00-0x07*/ + 0x954f, 0x9550, 0xeabb, 0x9551, 0xb2fd, 0x9552, 0xc3f7, 0xbbe8, /*0x08-0x0f*/ + 0x9553, 0x9554, 0x9555, 0xd2d7, 0xcef4, 0xeabf, 0x9556, 0x9557, /*0x10-0x17*/ + 0x9558, 0xeabc, 0x9559, 0x955a, 0x955b, 0xeac3, 0x955c, 0xd0c7, /*0x18-0x1f*/ + 0xd3b3, 0x955d, 0x955e, 0x955f, 0x9560, 0xb4ba, 0x9561, 0xc3c1, /*0x20-0x27*/ + 0xd7f2, 0x9562, 0x9563, 0x9564, 0x9565, 0xd5d1, 0x9566, 0xcac7, /*0x28-0x2f*/ + 0x9567, 0xeac5, 0x9568, 0x9569, 0xeac4, 0xeac7, 0xeac6, 0x956a, /*0x30-0x37*/ + 0x956b, 0x956c, 0x956d, 0x956e, 0xd6e7, 0x956f, 0xcfd4, 0x9570, /*0x38-0x3f*/ + 0x9571, 0xeacb, 0x9572, 0xbbce, 0x9573, 0x9574, 0x9575, 0x9576, /*0x40-0x47*/ + 0x9577, 0x9578, 0x9579, 0xbdfa, 0xc9ce, 0x957a, 0x957b, 0xeacc, /*0x48-0x4f*/ + 0x957c, 0x957d, 0xc9b9, 0xcffe, 0xeaca, 0xd4ce, 0xeacd, 0xeacf, /*0x50-0x57*/ + 0x957e, 0x9580, 0xcded, 0x9581, 0x9582, 0x9583, 0x9584, 0xeac9, /*0x58-0x5f*/ + 0x9585, 0xeace, 0x9586, 0x9587, 0xceee, 0x9588, 0xbbde, 0x9589, /*0x60-0x67*/ + 0xb3bf, 0x958a, 0x958b, 0x958c, 0x958d, 0x958e, 0xc6d5, 0xbeb0, /*0x68-0x6f*/ + 0xcefa, 0x958f, 0x9590, 0x9591, 0xc7e7, 0x9592, 0xbea7, 0xead0, /*0x70-0x77*/ + 0x9593, 0x9594, 0xd6c7, 0x9595, 0x9596, 0x9597, 0xc1c0, 0x9598, /*0x78-0x7f*/ + 0x9599, 0x959a, 0xd4dd, 0x959b, 0xead1, 0x959c, 0x959d, 0xcfbe, /*0x80-0x87*/ + 0x959e, 0x959f, 0x95a0, 0x95a1, 0xead2, 0x95a2, 0x95a3, 0x95a4, /*0x88-0x8f*/ + 0x95a5, 0xcaee, 0x95a6, 0x95a7, 0x95a8, 0x95a9, 0xc5af, 0xb0b5, /*0x90-0x97*/ + 0x95aa, 0x95ab, 0x95ac, 0x95ad, 0x95ae, 0xead4, 0x95af, 0x95b0, /*0x98-0x9f*/ + 0x95b1, 0x95b2, 0x95b3, 0x95b4, 0x95b5, 0x95b6, 0x95b7, 0xead3, /*0xa0-0xa7*/ + 0xf4df, 0x95b8, 0x95b9, 0x95ba, 0x95bb, 0x95bc, 0xc4ba, 0x95bd, /*0xa8-0xaf*/ + 0x95be, 0x95bf, 0x95c0, 0x95c1, 0xb1a9, 0x95c2, 0x95c3, 0x95c4, /*0xb0-0xb7*/ + 0x95c5, 0xe5df, 0x95c6, 0x95c7, 0x95c8, 0x95c9, 0xead5, 0x95ca, /*0xb8-0xbf*/ + 0x95cb, 0x95cc, 0x95cd, 0x95ce, 0x95cf, 0x95d0, 0x95d1, 0x95d2, /*0xc0-0xc7*/ + 0x95d3, 0x95d4, 0x95d5, 0x95d6, 0x95d7, 0x95d8, 0x95d9, 0x95da, /*0xc8-0xcf*/ + 0x95db, 0x95dc, 0x95dd, 0x95de, 0x95df, 0x95e0, 0x95e1, 0x95e2, /*0xd0-0xd7*/ + 0x95e3, 0xcaef, 0x95e4, 0xead6, 0xead7, 0xc6d8, 0x95e5, 0x95e6, /*0xd8-0xdf*/ + 0x95e7, 0x95e8, 0x95e9, 0x95ea, 0x95eb, 0x95ec, 0xead8, 0x95ed, /*0xe0-0xe7*/ + 0x95ee, 0xead9, 0x95ef, 0x95f0, 0x95f1, 0x95f2, 0x95f3, 0x95f4, /*0xe8-0xef*/ + 0xd4bb, 0x95f5, 0xc7fa, 0xd2b7, 0xb8fc, 0x95f6, 0x95f7, 0xeac2, /*0xf0-0xf7*/ + 0x95f8, 0xb2dc, 0x95f9, 0x95fa, 0xc2fc, 0x95fb, 0xd4f8, 0xcce6, /*0xf8-0xff*/ + /* 0x6700 */ + 0xd7ee, 0x95fc, 0x95fd, 0x95fe, 0x9640, 0x9641, 0x9642, 0x9643, /*0x00-0x07*/ + 0xd4c2, 0xd3d0, 0xebc3, 0xc5f3, 0x9644, 0xb7fe, 0x9645, 0x9646, /*0x08-0x0f*/ + 0xebd4, 0x9647, 0x9648, 0x9649, 0xcbb7, 0xebde, 0x964a, 0xc0ca, /*0x10-0x17*/ + 0x964b, 0x964c, 0x964d, 0xcdfb, 0x964e, 0xb3af, 0x964f, 0xc6da, /*0x18-0x1f*/ + 0x9650, 0x9651, 0x9652, 0x9653, 0x9654, 0x9655, 0xebfc, 0x9656, /*0x20-0x27*/ + 0xc4be, 0x9657, 0xceb4, 0xc4a9, 0xb1be, 0xd4fd, 0x9658, 0xcaf5, /*0x28-0x2f*/ + 0x9659, 0xd6ec, 0x965a, 0x965b, 0xc6d3, 0xb6e4, 0x965c, 0x965d, /*0x30-0x37*/ + 0x965e, 0x965f, 0xbbfa, 0x9660, 0x9661, 0xd0e0, 0x9662, 0x9663, /*0x38-0x3f*/ + 0xc9b1, 0x9664, 0xd4d3, 0xc8a8, 0x9665, 0x9666, 0xb8cb, 0x9667, /*0x40-0x47*/ + 0xe8be, 0xc9bc, 0x9668, 0x9669, 0xe8bb, 0x966a, 0xc0ee, 0xd0d3, /*0x48-0x4f*/ + 0xb2c4, 0xb4e5, 0x966b, 0xe8bc, 0x966c, 0x966d, 0xd5c8, 0x966e, /*0x50-0x57*/ + 0x966f, 0x9670, 0x9671, 0x9672, 0xb6c5, 0x9673, 0xe8bd, 0xcaf8, /*0x58-0x5f*/ + 0xb8dc, 0xccf5, 0x9674, 0x9675, 0x9676, 0xc0b4, 0x9677, 0x9678, /*0x60-0x67*/ + 0xd1ee, 0xe8bf, 0xe8c2, 0x9679, 0x967a, 0xbabc, 0x967b, 0xb1ad, /*0x68-0x6f*/ + 0xbddc, 0x967c, 0xeabd, 0xe8c3, 0x967d, 0xe8c6, 0x967e, 0xe8cb, /*0x70-0x77*/ + 0x9680, 0x9681, 0x9682, 0x9683, 0xe8cc, 0x9684, 0xcbc9, 0xb0e5, /*0x78-0x7f*/ + 0x9685, 0xbcab, 0x9686, 0x9687, 0xb9b9, 0x9688, 0x9689, 0xe8c1, /*0x80-0x87*/ + 0x968a, 0xcdf7, 0x968b, 0xe8ca, 0x968c, 0x968d, 0x968e, 0x968f, /*0x88-0x8f*/ + 0xcef6, 0x9690, 0x9691, 0x9692, 0x9693, 0xd5ed, 0x9694, 0xc1d6, /*0x90-0x97*/ + 0xe8c4, 0x9695, 0xc3b6, 0x9696, 0xb9fb, 0xd6a6, 0xe8c8, 0x9697, /*0x98-0x9f*/ + 0x9698, 0x9699, 0xcae0, 0xd4e6, 0x969a, 0xe8c0, 0x969b, 0xe8c5, /*0xa0-0xa7*/ + 0xe8c7, 0x969c, 0xc7b9, 0xb7e3, 0x969d, 0xe8c9, 0x969e, 0xbfdd, /*0xa8-0xaf*/ + 0xe8d2, 0x969f, 0x96a0, 0xe8d7, 0x96a1, 0xe8d5, 0xbcdc, 0xbccf, /*0xb0-0xb7*/ + 0xe8db, 0x96a2, 0x96a3, 0x96a4, 0x96a5, 0x96a6, 0x96a7, 0x96a8, /*0xb8-0xbf*/ + 0x96a9, 0xe8de, 0x96aa, 0xe8da, 0xb1fa, 0x96ab, 0x96ac, 0x96ad, /*0xc0-0xc7*/ + 0x96ae, 0x96af, 0x96b0, 0x96b1, 0x96b2, 0x96b3, 0x96b4, 0xb0d8, /*0xc8-0xcf*/ + 0xc4b3, 0xb8cc, 0xc6e2, 0xc8be, 0xc8e1, 0x96b5, 0x96b6, 0x96b7, /*0xd0-0xd7*/ + 0xe8cf, 0xe8d4, 0xe8d6, 0x96b8, 0xb9f1, 0xe8d8, 0xd7f5, 0x96b9, /*0xd8-0xdf*/ + 0xc4fb, 0x96ba, 0xe8dc, 0x96bb, 0x96bc, 0xb2e9, 0x96bd, 0x96be, /*0xe0-0xe7*/ + 0x96bf, 0xe8d1, 0x96c0, 0x96c1, 0xbced, 0x96c2, 0x96c3, 0xbfc2, /*0xe8-0xef*/ + 0xe8cd, 0xd6f9, 0x96c4, 0xc1f8, 0xb2f1, 0x96c5, 0x96c6, 0x96c7, /*0xf0-0xf7*/ + 0x96c8, 0x96c9, 0x96ca, 0x96cb, 0x96cc, 0xe8df, 0x96cd, 0xcac1, /*0xf8-0xff*/ + /* 0x6800 */ + 0xe8d9, 0x96ce, 0x96cf, 0x96d0, 0x96d1, 0xd5a4, 0x96d2, 0xb1ea, /*0x00-0x07*/ + 0xd5bb, 0xe8ce, 0xe8d0, 0xb6b0, 0xe8d3, 0x96d3, 0xe8dd, 0xc0b8, /*0x08-0x0f*/ + 0x96d4, 0xcaf7, 0x96d5, 0xcba8, 0x96d6, 0x96d7, 0xc6dc, 0xc0f5, /*0x10-0x17*/ + 0x96d8, 0x96d9, 0x96da, 0x96db, 0x96dc, 0xe8e9, 0x96dd, 0x96de, /*0x18-0x1f*/ + 0x96df, 0xd0a3, 0x96e0, 0x96e1, 0x96e2, 0x96e3, 0x96e4, 0x96e5, /*0x20-0x27*/ + 0x96e6, 0xe8f2, 0xd6ea, 0x96e7, 0x96e8, 0x96e9, 0x96ea, 0x96eb, /*0x28-0x2f*/ + 0x96ec, 0x96ed, 0xe8e0, 0xe8e1, 0x96ee, 0x96ef, 0x96f0, 0xd1f9, /*0x30-0x37*/ + 0xbacb, 0xb8f9, 0x96f1, 0x96f2, 0xb8f1, 0xd4d4, 0xe8ef, 0x96f3, /*0x38-0x3f*/ + 0xe8ee, 0xe8ec, 0xb9f0, 0xccd2, 0xe8e6, 0xcea6, 0xbff2, 0x96f4, /*0x40-0x47*/ + 0xb0b8, 0xe8f1, 0xe8f0, 0x96f5, 0xd7c0, 0x96f6, 0xe8e4, 0x96f7, /*0x48-0x4f*/ + 0xcda9, 0xc9a3, 0x96f8, 0xbbb8, 0xbddb, 0xe8ea, 0x96f9, 0x96fa, /*0x50-0x57*/ + 0x96fb, 0x96fc, 0x96fd, 0x96fe, 0x9740, 0x9741, 0x9742, 0x9743, /*0x58-0x5f*/ + 0xe8e2, 0xe8e3, 0xe8e5, 0xb5b5, 0xe8e7, 0xc7c5, 0xe8eb, 0xe8ed, /*0x60-0x67*/ + 0xbdb0, 0xd7ae, 0x9744, 0xe8f8, 0x9745, 0x9746, 0x9747, 0x9748, /*0x68-0x6f*/ + 0x9749, 0x974a, 0x974b, 0x974c, 0xe8f5, 0x974d, 0xcdb0, 0xe8f6, /*0x70-0x77*/ + 0x974e, 0x974f, 0x9750, 0x9751, 0x9752, 0x9753, 0x9754, 0x9755, /*0x78-0x7f*/ + 0x9756, 0xc1ba, 0x9757, 0xe8e8, 0x9758, 0xc3b7, 0xb0f0, 0x9759, /*0x80-0x87*/ + 0x975a, 0x975b, 0x975c, 0x975d, 0x975e, 0x975f, 0x9760, 0xe8f4, /*0x88-0x8f*/ + 0x9761, 0x9762, 0x9763, 0xe8f7, 0x9764, 0x9765, 0x9766, 0xb9a3, /*0x90-0x97*/ + 0x9767, 0x9768, 0x9769, 0x976a, 0x976b, 0x976c, 0x976d, 0x976e, /*0x98-0x9f*/ + 0x976f, 0x9770, 0xc9d2, 0x9771, 0x9772, 0x9773, 0xc3ce, 0xcee0, /*0xa0-0xa7*/ + 0xc0e6, 0x9774, 0x9775, 0x9776, 0x9777, 0xcbf3, 0x9778, 0xccdd, /*0xa8-0xaf*/ + 0xd0b5, 0x9779, 0x977a, 0xcae1, 0x977b, 0xe8f3, 0x977c, 0x977d, /*0xb0-0xb7*/ + 0x977e, 0x9780, 0x9781, 0x9782, 0x9783, 0x9784, 0x9785, 0x9786, /*0xb8-0xbf*/ + 0xbcec, 0x9787, 0xe8f9, 0x9788, 0x9789, 0x978a, 0x978b, 0x978c, /*0xc0-0xc7*/ + 0x978d, 0xc3de, 0x978e, 0xc6e5, 0x978f, 0xb9f7, 0x9790, 0x9791, /*0xc8-0xcf*/ + 0x9792, 0x9793, 0xb0f4, 0x9794, 0x9795, 0xd7d8, 0x9796, 0x9797, /*0xd0-0xd7*/ + 0xbcac, 0x9798, 0xc5ef, 0x9799, 0x979a, 0x979b, 0x979c, 0x979d, /*0xd8-0xdf*/ + 0xccc4, 0x979e, 0x979f, 0xe9a6, 0x97a0, 0x97a1, 0x97a2, 0x97a3, /*0xe0-0xe7*/ + 0x97a4, 0x97a5, 0x97a6, 0x97a7, 0x97a8, 0x97a9, 0xc9ad, 0x97aa, /*0xe8-0xef*/ + 0xe9a2, 0xc0e2, 0x97ab, 0x97ac, 0x97ad, 0xbfc3, 0x97ae, 0x97af, /*0xf0-0xf7*/ + 0x97b0, 0xe8fe, 0xb9d7, 0x97b1, 0xe8fb, 0x97b2, 0x97b3, 0x97b4, /*0xf8-0xff*/ + /* 0x6900 */ + 0x97b5, 0xe9a4, 0x97b6, 0x97b7, 0x97b8, 0xd2ce, 0x97b9, 0x97ba, /*0x00-0x07*/ + 0x97bb, 0x97bc, 0x97bd, 0xe9a3, 0x97be, 0xd6b2, 0xd7b5, 0x97bf, /*0x08-0x0f*/ + 0xe9a7, 0x97c0, 0xbdb7, 0x97c1, 0x97c2, 0x97c3, 0x97c4, 0x97c5, /*0x10-0x17*/ + 0x97c6, 0x97c7, 0x97c8, 0x97c9, 0x97ca, 0x97cb, 0x97cc, 0xe8fc, /*0x18-0x1f*/ + 0xe8fd, 0x97cd, 0x97ce, 0x97cf, 0xe9a1, 0x97d0, 0x97d1, 0x97d2, /*0x20-0x27*/ + 0x97d3, 0x97d4, 0x97d5, 0x97d6, 0x97d7, 0xcdd6, 0x97d8, 0x97d9, /*0x28-0x2f*/ + 0xd2ac, 0x97da, 0x97db, 0x97dc, 0xe9b2, 0x97dd, 0x97de, 0x97df, /*0x30-0x37*/ + 0x97e0, 0xe9a9, 0x97e1, 0x97e2, 0x97e3, 0xb4aa, 0x97e4, 0xb4bb, /*0x38-0x3f*/ + 0x97e5, 0x97e6, 0xe9ab, 0x97e7, 0x97e8, 0x97e9, 0x97ea, 0x97eb, /*0x40-0x47*/ + 0x97ec, 0x97ed, 0x97ee, 0x97ef, 0x97f0, 0x97f1, 0x97f2, 0x97f3, /*0x48-0x4f*/ + 0x97f4, 0x97f5, 0x97f6, 0x97f7, 0xd0a8, 0x97f8, 0x97f9, 0xe9a5, /*0x50-0x57*/ + 0x97fa, 0x97fb, 0xb3fe, 0x97fc, 0x97fd, 0xe9ac, 0xc0e3, 0x97fe, /*0x58-0x5f*/ + 0xe9aa, 0x9840, 0x9841, 0xe9b9, 0x9842, 0x9843, 0xe9b8, 0x9844, /*0x60-0x67*/ + 0x9845, 0x9846, 0x9847, 0xe9ae, 0x9848, 0x9849, 0xe8fa, 0x984a, /*0x68-0x6f*/ + 0x984b, 0xe9a8, 0x984c, 0x984d, 0x984e, 0x984f, 0x9850, 0xbfac, /*0x70-0x77*/ + 0xe9b1, 0xe9ba, 0x9851, 0x9852, 0xc2a5, 0x9853, 0x9854, 0x9855, /*0x78-0x7f*/ + 0xe9af, 0x9856, 0xb8c5, 0x9857, 0xe9ad, 0x9858, 0xd3dc, 0xe9b4, /*0x80-0x87*/ + 0xe9b5, 0xe9b7, 0x9859, 0x985a, 0x985b, 0xe9c7, 0x985c, 0x985d, /*0x88-0x8f*/ + 0x985e, 0x985f, 0x9860, 0x9861, 0xc0c6, 0xe9c5, 0x9862, 0x9863, /*0x90-0x97*/ + 0xe9b0, 0x9864, 0x9865, 0xe9bb, 0xb0f1, 0x9866, 0x9867, 0x9868, /*0x98-0x9f*/ + 0x9869, 0x986a, 0x986b, 0x986c, 0x986d, 0x986e, 0x986f, 0xe9bc, /*0xa0-0xa7*/ + 0xd5a5, 0x9870, 0x9871, 0xe9be, 0x9872, 0xe9bf, 0x9873, 0x9874, /*0xa8-0xaf*/ + 0x9875, 0xe9c1, 0x9876, 0x9877, 0xc1f1, 0x9878, 0x9879, 0xc8b6, /*0xb0-0xb7*/ + 0x987a, 0x987b, 0x987c, 0xe9bd, 0x987d, 0x987e, 0x9880, 0x9881, /*0xb8-0xbf*/ + 0x9882, 0xe9c2, 0x9883, 0x9884, 0x9885, 0x9886, 0x9887, 0x9888, /*0xc0-0xc7*/ + 0x9889, 0x988a, 0xe9c3, 0x988b, 0xe9b3, 0x988c, 0xe9b6, 0x988d, /*0xc8-0xcf*/ + 0xbbb1, 0x988e, 0x988f, 0x9890, 0xe9c0, 0x9891, 0x9892, 0x9893, /*0xd0-0xd7*/ + 0x9894, 0x9895, 0x9896, 0xbcf7, 0x9897, 0x9898, 0x9899, 0xe9c4, /*0xd8-0xdf*/ + 0xe9c6, 0x989a, 0x989b, 0x989c, 0x989d, 0x989e, 0x989f, 0x98a0, /*0xe0-0xe7*/ + 0x98a1, 0x98a2, 0x98a3, 0x98a4, 0x98a5, 0xe9ca, 0x98a6, 0x98a7, /*0xe8-0xef*/ + 0x98a8, 0x98a9, 0xe9ce, 0x98aa, 0x98ab, 0x98ac, 0x98ad, 0x98ae, /*0xf0-0xf7*/ + 0x98af, 0x98b0, 0x98b1, 0x98b2, 0x98b3, 0xb2db, 0x98b4, 0xe9c8, /*0xf8-0xff*/ + /* 0x6a00 */ + 0x98b5, 0x98b6, 0x98b7, 0x98b8, 0x98b9, 0x98ba, 0x98bb, 0x98bc, /*0x00-0x07*/ + 0x98bd, 0x98be, 0xb7ae, 0x98bf, 0x98c0, 0x98c1, 0x98c2, 0x98c3, /*0x08-0x0f*/ + 0x98c4, 0x98c5, 0x98c6, 0x98c7, 0x98c8, 0x98c9, 0x98ca, 0xe9cb, /*0x10-0x17*/ + 0xe9cc, 0x98cb, 0x98cc, 0x98cd, 0x98ce, 0x98cf, 0x98d0, 0xd5c1, /*0x18-0x1f*/ + 0x98d1, 0xc4a3, 0x98d2, 0x98d3, 0x98d4, 0x98d5, 0x98d6, 0x98d7, /*0x20-0x27*/ + 0xe9d8, 0x98d8, 0xbae1, 0x98d9, 0x98da, 0x98db, 0x98dc, 0xe9c9, /*0x28-0x2f*/ + 0x98dd, 0xd3a3, 0x98de, 0x98df, 0x98e0, 0xe9d4, 0x98e1, 0x98e2, /*0x30-0x37*/ + 0x98e3, 0x98e4, 0x98e5, 0x98e6, 0x98e7, 0xe9d7, 0xe9d0, 0x98e8, /*0x38-0x3f*/ + 0x98e9, 0x98ea, 0x98eb, 0x98ec, 0xe9cf, 0x98ed, 0x98ee, 0xc7c1, /*0x40-0x47*/ + 0x98ef, 0x98f0, 0x98f1, 0x98f2, 0x98f3, 0x98f4, 0x98f5, 0x98f6, /*0x48-0x4f*/ + 0xe9d2, 0x98f7, 0x98f8, 0x98f9, 0x98fa, 0x98fb, 0x98fc, 0x98fd, /*0x50-0x57*/ + 0xe9d9, 0xb3c8, 0x98fe, 0xe9d3, 0x9940, 0x9941, 0x9942, 0x9943, /*0x58-0x5f*/ + 0x9944, 0xcff0, 0x9945, 0x9946, 0x9947, 0xe9cd, 0x9948, 0x9949, /*0x60-0x67*/ + 0x994a, 0x994b, 0x994c, 0x994d, 0x994e, 0x994f, 0x9950, 0x9951, /*0x68-0x6f*/ + 0x9952, 0xb3f7, 0x9953, 0x9954, 0x9955, 0x9956, 0x9957, 0x9958, /*0x70-0x77*/ + 0x9959, 0xe9d6, 0x995a, 0x995b, 0xe9da, 0x995c, 0x995d, 0x995e, /*0x78-0x7f*/ + 0xccb4, 0x995f, 0x9960, 0x9961, 0xcfad, 0x9962, 0x9963, 0x9964, /*0x80-0x87*/ + 0x9965, 0x9966, 0x9967, 0x9968, 0x9969, 0x996a, 0xe9d5, 0x996b, /*0x88-0x8f*/ + 0xe9dc, 0xe9db, 0x996c, 0x996d, 0x996e, 0x996f, 0x9970, 0xe9de, /*0x90-0x97*/ + 0x9971, 0x9972, 0x9973, 0x9974, 0x9975, 0x9976, 0x9977, 0x9978, /*0x98-0x9f*/ + 0xe9d1, 0x9979, 0x997a, 0x997b, 0x997c, 0x997d, 0x997e, 0x9980, /*0xa0-0xa7*/ + 0x9981, 0xe9dd, 0x9982, 0xe9df, 0xc3ca, 0x9983, 0x9984, 0x9985, /*0xa8-0xaf*/ + 0x9986, 0x9987, 0x9988, 0x9989, 0x998a, 0x998b, 0x998c, 0x998d, /*0xb0-0xb7*/ + 0x998e, 0x998f, 0x9990, 0x9991, 0x9992, 0x9993, 0x9994, 0x9995, /*0xb8-0xbf*/ + 0x9996, 0x9997, 0x9998, 0x9999, 0x999a, 0x999b, 0x999c, 0x999d, /*0xc0-0xc7*/ + 0x999e, 0x999f, 0x99a0, 0x99a1, 0x99a2, 0x99a3, 0x99a4, 0x99a5, /*0xc8-0xcf*/ + 0x99a6, 0x99a7, 0x99a8, 0x99a9, 0x99aa, 0x99ab, 0x99ac, 0x99ad, /*0xd0-0xd7*/ + 0x99ae, 0x99af, 0x99b0, 0x99b1, 0x99b2, 0x99b3, 0x99b4, 0x99b5, /*0xd8-0xdf*/ + 0x99b6, 0x99b7, 0x99b8, 0x99b9, 0x99ba, 0x99bb, 0x99bc, 0x99bd, /*0xe0-0xe7*/ + 0x99be, 0x99bf, 0x99c0, 0x99c1, 0x99c2, 0x99c3, 0x99c4, 0x99c5, /*0xe8-0xef*/ + 0x99c6, 0x99c7, 0x99c8, 0x99c9, 0x99ca, 0x99cb, 0x99cc, 0x99cd, /*0xf0-0xf7*/ + 0x99ce, 0x99cf, 0x99d0, 0x99d1, 0x99d2, 0x99d3, 0x99d4, 0x99d5, /*0xf8-0xff*/ + /* 0x6b00 */ + 0x99d6, 0x99d7, 0x99d8, 0x99d9, 0x99da, 0x99db, 0x99dc, 0x99dd, /*0x00-0x07*/ + 0x99de, 0x99df, 0x99e0, 0x99e1, 0x99e2, 0x99e3, 0x99e4, 0x99e5, /*0x08-0x0f*/ + 0x99e6, 0x99e7, 0x99e8, 0x99e9, 0x99ea, 0x99eb, 0x99ec, 0x99ed, /*0x10-0x17*/ + 0x99ee, 0x99ef, 0x99f0, 0x99f1, 0x99f2, 0x99f3, 0x99f4, 0x99f5, /*0x18-0x1f*/ + 0xc7b7, 0xb4ce, 0xbbb6, 0xd0c0, 0xeca3, 0x99f6, 0x99f7, 0xc5b7, /*0x20-0x27*/ + 0x99f8, 0x99f9, 0x99fa, 0x99fb, 0x99fc, 0x99fd, 0x99fe, 0x9a40, /*0x28-0x2f*/ + 0x9a41, 0x9a42, 0xd3fb, 0x9a43, 0x9a44, 0x9a45, 0x9a46, 0xeca4, /*0x30-0x37*/ + 0x9a47, 0xeca5, 0xc6db, 0x9a48, 0x9a49, 0x9a4a, 0xbfee, 0x9a4b, /*0x38-0x3f*/ + 0x9a4c, 0x9a4d, 0x9a4e, 0xeca6, 0x9a4f, 0x9a50, 0xeca7, 0xd0aa, /*0x40-0x47*/ + 0x9a51, 0xc7b8, 0x9a52, 0x9a53, 0xb8e8, 0x9a54, 0x9a55, 0x9a56, /*0x48-0x4f*/ + 0x9a57, 0x9a58, 0x9a59, 0x9a5a, 0x9a5b, 0x9a5c, 0x9a5d, 0x9a5e, /*0x50-0x57*/ + 0x9a5f, 0xeca8, 0x9a60, 0x9a61, 0x9a62, 0x9a63, 0x9a64, 0x9a65, /*0x58-0x5f*/ + 0x9a66, 0x9a67, 0xd6b9, 0xd5fd, 0xb4cb, 0xb2bd, 0xcee4, 0xc6e7, /*0x60-0x67*/ + 0x9a68, 0x9a69, 0xcde1, 0x9a6a, 0x9a6b, 0x9a6c, 0x9a6d, 0x9a6e, /*0x68-0x6f*/ + 0x9a6f, 0x9a70, 0x9a71, 0x9a72, 0x9a73, 0x9a74, 0x9a75, 0x9a76, /*0x70-0x77*/ + 0x9a77, 0xb4f5, 0x9a78, 0xcbc0, 0xbcdf, 0x9a79, 0x9a7a, 0x9a7b, /*0x78-0x7f*/ + 0x9a7c, 0xe9e2, 0xe9e3, 0xd1ea, 0xe9e5, 0x9a7d, 0xb4f9, 0xe9e4, /*0x80-0x87*/ + 0x9a7e, 0xd1b3, 0xcae2, 0xb2d0, 0x9a80, 0xe9e8, 0x9a81, 0x9a82, /*0x88-0x8f*/ + 0x9a83, 0x9a84, 0xe9e6, 0xe9e7, 0x9a85, 0x9a86, 0xd6b3, 0x9a87, /*0x90-0x97*/ + 0x9a88, 0x9a89, 0xe9e9, 0xe9ea, 0x9a8a, 0x9a8b, 0x9a8c, 0x9a8d, /*0x98-0x9f*/ + 0x9a8e, 0xe9eb, 0x9a8f, 0x9a90, 0x9a91, 0x9a92, 0x9a93, 0x9a94, /*0xa0-0xa7*/ + 0x9a95, 0x9a96, 0xe9ec, 0x9a97, 0x9a98, 0x9a99, 0x9a9a, 0x9a9b, /*0xa8-0xaf*/ + 0x9a9c, 0x9a9d, 0x9a9e, 0xecaf, 0xc5b9, 0xb6ce, 0x9a9f, 0xd2f3, /*0xb0-0xb7*/ + 0x9aa0, 0x9aa1, 0x9aa2, 0x9aa3, 0x9aa4, 0x9aa5, 0x9aa6, 0xb5ee, /*0xb8-0xbf*/ + 0x9aa7, 0xbbd9, 0xecb1, 0x9aa8, 0x9aa9, 0xd2e3, 0x9aaa, 0x9aab, /*0xc0-0xc7*/ + 0x9aac, 0x9aad, 0x9aae, 0xcee3, 0x9aaf, 0xc4b8, 0x9ab0, 0xc3bf, /*0xc8-0xcf*/ + 0x9ab1, 0x9ab2, 0xb6be, 0xd8b9, 0xb1c8, 0xb1cf, 0xb1d1, 0xc5fe, /*0xd0-0xd7*/ + 0x9ab3, 0xb1d0, 0x9ab4, 0xc3ab, 0x9ab5, 0x9ab6, 0x9ab7, 0x9ab8, /*0xd8-0xdf*/ + 0x9ab9, 0xd5b1, 0x9aba, 0x9abb, 0x9abc, 0x9abd, 0x9abe, 0x9abf, /*0xe0-0xe7*/ + 0x9ac0, 0x9ac1, 0xeba4, 0xbac1, 0x9ac2, 0x9ac3, 0x9ac4, 0xccba, /*0xe8-0xef*/ + 0x9ac5, 0x9ac6, 0x9ac7, 0xeba5, 0x9ac8, 0xeba7, 0x9ac9, 0x9aca, /*0xf0-0xf7*/ + 0x9acb, 0xeba8, 0x9acc, 0x9acd, 0x9ace, 0xeba6, 0x9acf, 0x9ad0, /*0xf8-0xff*/ + /* 0x6c00 */ + 0x9ad1, 0x9ad2, 0x9ad3, 0x9ad4, 0x9ad5, 0xeba9, 0xebab, 0xebaa, /*0x00-0x07*/ + 0x9ad6, 0x9ad7, 0x9ad8, 0x9ad9, 0x9ada, 0xebac, 0x9adb, 0xcacf, /*0x08-0x0f*/ + 0xd8b5, 0xc3f1, 0x9adc, 0xc3a5, 0xc6f8, 0xebad, 0xc4ca, 0x9add, /*0x10-0x17*/ + 0xebae, 0xebaf, 0xebb0, 0xb7d5, 0x9ade, 0x9adf, 0x9ae0, 0xb7fa, /*0x18-0x1f*/ + 0x9ae1, 0xebb1, 0xc7e2, 0x9ae2, 0xebb3, 0x9ae3, 0xbaa4, 0xd1f5, /*0x20-0x27*/ + 0xb0b1, 0xebb2, 0xebb4, 0x9ae4, 0x9ae5, 0x9ae6, 0xb5aa, 0xc2c8, /*0x28-0x2f*/ + 0xc7e8, 0x9ae7, 0xebb5, 0x9ae8, 0xcbae, 0xe3df, 0x9ae9, 0x9aea, /*0x30-0x37*/ + 0xd3c0, 0x9aeb, 0x9aec, 0x9aed, 0x9aee, 0xd9db, 0x9aef, 0x9af0, /*0x38-0x3f*/ + 0xcda1, 0xd6ad, 0xc7f3, 0x9af1, 0x9af2, 0x9af3, 0xd9e0, 0xbbe3, /*0x40-0x47*/ + 0x9af4, 0xbaba, 0xe3e2, 0x9af5, 0x9af6, 0x9af7, 0x9af8, 0x9af9, /*0x48-0x4f*/ + 0xcfab, 0x9afa, 0x9afb, 0x9afc, 0xe3e0, 0xc9c7, 0x9afd, 0xbab9, /*0x50-0x57*/ + 0x9afe, 0x9b40, 0x9b41, 0xd1b4, 0xe3e1, 0xc8ea, 0xb9af, 0xbdad, /*0x58-0x5f*/ + 0xb3d8, 0xcedb, 0x9b42, 0x9b43, 0xccc0, 0x9b44, 0x9b45, 0x9b46, /*0x60-0x67*/ + 0xe3e8, 0xe3e9, 0xcdf4, 0x9b47, 0x9b48, 0x9b49, 0x9b4a, 0x9b4b, /*0x68-0x6f*/ + 0xccad, 0x9b4c, 0xbcb3, 0x9b4d, 0xe3ea, 0x9b4e, 0xe3eb, 0x9b4f, /*0x70-0x77*/ + 0x9b50, 0xd0da, 0x9b51, 0x9b52, 0x9b53, 0xc6fb, 0xb7da, 0x9b54, /*0x78-0x7f*/ + 0x9b55, 0xc7df, 0xd2ca, 0xced6, 0x9b56, 0xe3e4, 0xe3ec, 0x9b57, /*0x80-0x87*/ + 0xc9f2, 0xb3c1, 0x9b58, 0x9b59, 0xe3e7, 0x9b5a, 0x9b5b, 0xc6e3, /*0x88-0x8f*/ + 0xe3e5, 0x9b5c, 0x9b5d, 0xedb3, 0xe3e6, 0x9b5e, 0x9b5f, 0x9b60, /*0x90-0x97*/ + 0x9b61, 0xc9b3, 0x9b62, 0xc5e6, 0x9b63, 0x9b64, 0x9b65, 0xb9b5, /*0x98-0x9f*/ + 0x9b66, 0xc3bb, 0x9b67, 0xe3e3, 0xc5bd, 0xc1a4, 0xc2d9, 0xb2d7, /*0xa0-0xa7*/ + 0x9b68, 0xe3ed, 0xbba6, 0xc4ad, 0x9b69, 0xe3f0, 0xbeda, 0x9b6a, /*0xa8-0xaf*/ + 0x9b6b, 0xe3fb, 0xe3f5, 0xbad3, 0x9b6c, 0x9b6d, 0x9b6e, 0x9b6f, /*0xb0-0xb7*/ + 0xb7d0, 0xd3cd, 0x9b70, 0xd6ce, 0xd5d3, 0xb9c1, 0xd5b4, 0xd1d8, /*0xb8-0xbf*/ + 0x9b71, 0x9b72, 0x9b73, 0x9b74, 0xd0b9, 0xc7f6, 0x9b75, 0x9b76, /*0xc0-0xc7*/ + 0x9b77, 0xc8aa, 0xb2b4, 0x9b78, 0xc3da, 0x9b79, 0x9b7a, 0x9b7b, /*0xc8-0xcf*/ + 0xe3ee, 0x9b7c, 0x9b7d, 0xe3fc, 0xe3ef, 0xb7a8, 0xe3f7, 0xe3f4, /*0xd0-0xd7*/ + 0x9b7e, 0x9b80, 0x9b81, 0xb7ba, 0x9b82, 0x9b83, 0xc5a2, 0x9b84, /*0xd8-0xdf*/ + 0xe3f6, 0xc5dd, 0xb2a8, 0xc6fc, 0x9b85, 0xc4e0, 0x9b86, 0x9b87, /*0xe0-0xe7*/ + 0xd7a2, 0x9b88, 0xc0e1, 0xe3f9, 0x9b89, 0x9b8a, 0xe3fa, 0xe3fd, /*0xe8-0xef*/ + 0xcca9, 0xe3f3, 0x9b8b, 0xd3be, 0x9b8c, 0xb1c3, 0xedb4, 0xe3f1, /*0xf0-0xf7*/ + 0xe3f2, 0x9b8d, 0xe3f8, 0xd0ba, 0xc6c3, 0xd4f3, 0xe3fe, 0x9b8e, /*0xf8-0xff*/ + /* 0x6d00 */ + 0x9b8f, 0xbde0, 0x9b90, 0x9b91, 0xe4a7, 0x9b92, 0x9b93, 0xe4a6, /*0x00-0x07*/ + 0x9b94, 0x9b95, 0x9b96, 0xd1f3, 0xe4a3, 0x9b97, 0xe4a9, 0x9b98, /*0x08-0x0f*/ + 0x9b99, 0x9b9a, 0xc8f7, 0x9b9b, 0x9b9c, 0x9b9d, 0x9b9e, 0xcfb4, /*0x10-0x17*/ + 0x9b9f, 0xe4a8, 0xe4ae, 0xc2e5, 0x9ba0, 0x9ba1, 0xb6b4, 0x9ba2, /*0x18-0x1f*/ + 0x9ba3, 0x9ba4, 0x9ba5, 0x9ba6, 0x9ba7, 0xbdf2, 0x9ba8, 0xe4a2, /*0x20-0x27*/ + 0x9ba9, 0x9baa, 0xbae9, 0xe4aa, 0x9bab, 0x9bac, 0xe4ac, 0x9bad, /*0x28-0x2f*/ + 0x9bae, 0xb6fd, 0xd6de, 0xe4b2, 0x9baf, 0xe4ad, 0x9bb0, 0x9bb1, /*0x30-0x37*/ + 0x9bb2, 0xe4a1, 0x9bb3, 0xbbee, 0xcddd, 0xc7a2, 0xc5c9, 0x9bb4, /*0x38-0x3f*/ + 0x9bb5, 0xc1f7, 0x9bb6, 0xe4a4, 0x9bb7, 0xc7b3, 0xbdac, 0xbdbd, /*0x40-0x47*/ + 0xe4a5, 0x9bb8, 0xd7c7, 0xb2e2, 0x9bb9, 0xe4ab, 0xbcc3, 0xe4af, /*0x48-0x4f*/ + 0x9bba, 0xbbeb, 0xe4b0, 0xc5a8, 0xe4b1, 0x9bbb, 0x9bbc, 0x9bbd, /*0x50-0x57*/ + 0x9bbe, 0xd5e3, 0xbfa3, 0x9bbf, 0xe4ba, 0x9bc0, 0xe4b7, 0x9bc1, /*0x58-0x5f*/ + 0xe4bb, 0x9bc2, 0x9bc3, 0xe4bd, 0x9bc4, 0x9bc5, 0xc6d6, 0x9bc6, /*0x60-0x67*/ + 0x9bc7, 0xbac6, 0xc0cb, 0x9bc8, 0x9bc9, 0x9bca, 0xb8a1, 0xe4b4, /*0x68-0x6f*/ + 0x9bcb, 0x9bcc, 0x9bcd, 0x9bce, 0xd4a1, 0x9bcf, 0x9bd0, 0xbaa3, /*0x70-0x77*/ + 0xbdfe, 0x9bd1, 0x9bd2, 0x9bd3, 0xe4bc, 0x9bd4, 0x9bd5, 0x9bd6, /*0x78-0x7f*/ + 0x9bd7, 0x9bd8, 0xcdbf, 0x9bd9, 0x9bda, 0xc4f9, 0x9bdb, 0x9bdc, /*0x80-0x87*/ + 0xcffb, 0xc9e6, 0x9bdd, 0x9bde, 0xd3bf, 0x9bdf, 0xcfd1, 0x9be0, /*0x88-0x8f*/ + 0x9be1, 0xe4b3, 0x9be2, 0xe4b8, 0xe4b9, 0xcce9, 0x9be3, 0x9be4, /*0x90-0x97*/ + 0x9be5, 0x9be6, 0x9be7, 0xccce, 0x9be8, 0xc0d4, 0xe4b5, 0xc1b0, /*0x98-0x9f*/ + 0xe4b6, 0xced0, 0x9be9, 0xbbc1, 0xb5d3, 0x9bea, 0xc8f3, 0xbda7, /*0xa0-0xa7*/ + 0xd5c7, 0xc9ac, 0xb8a2, 0xe4ca, 0x9beb, 0x9bec, 0xe4cc, 0xd1c4, /*0xa8-0xaf*/ + 0x9bed, 0x9bee, 0xd2ba, 0x9bef, 0x9bf0, 0xbaad, 0x9bf1, 0x9bf2, /*0xb0-0xb7*/ + 0xbad4, 0x9bf3, 0x9bf4, 0x9bf5, 0x9bf6, 0x9bf7, 0x9bf8, 0xe4c3, /*0xb8-0xbf*/ + 0xb5ed, 0x9bf9, 0x9bfa, 0x9bfb, 0xd7cd, 0xe4c0, 0xcffd, 0xe4bf, /*0xc0-0xc7*/ + 0x9bfc, 0x9bfd, 0x9bfe, 0xc1dc, 0xccca, 0x9c40, 0x9c41, 0x9c42, /*0xc8-0xcf*/ + 0x9c43, 0xcae7, 0x9c44, 0x9c45, 0x9c46, 0x9c47, 0xc4d7, 0x9c48, /*0xd0-0xd7*/ + 0xccd4, 0xe4c8, 0x9c49, 0x9c4a, 0x9c4b, 0xe4c7, 0xe4c1, 0x9c4c, /*0xd8-0xdf*/ + 0xe4c4, 0xb5ad, 0x9c4d, 0x9c4e, 0xd3d9, 0x9c4f, 0xe4c6, 0x9c50, /*0xe0-0xe7*/ + 0x9c51, 0x9c52, 0x9c53, 0xd2f9, 0xb4e3, 0x9c54, 0xbbb4, 0x9c55, /*0xe8-0xef*/ + 0x9c56, 0xc9ee, 0x9c57, 0xb4be, 0x9c58, 0x9c59, 0x9c5a, 0xbbec, /*0xf0-0xf7*/ + 0x9c5b, 0xd1cd, 0x9c5c, 0xcced, 0xedb5, 0x9c5d, 0x9c5e, 0x9c5f, /*0xf8-0xff*/ + /* 0x6e00 */ + 0x9c60, 0x9c61, 0x9c62, 0x9c63, 0x9c64, 0xc7e5, 0x9c65, 0x9c66, /*0x00-0x07*/ + 0x9c67, 0x9c68, 0xd4a8, 0x9c69, 0xe4cb, 0xd7d5, 0xe4c2, 0x9c6a, /*0x08-0x0f*/ + 0xbda5, 0xe4c5, 0x9c6b, 0x9c6c, 0xd3e6, 0x9c6d, 0xe4c9, 0xc9f8, /*0x10-0x17*/ + 0x9c6e, 0x9c6f, 0xe4be, 0x9c70, 0x9c71, 0xd3e5, 0x9c72, 0x9c73, /*0x18-0x1f*/ + 0xc7fe, 0xb6c9, 0x9c74, 0xd4fc, 0xb2b3, 0xe4d7, 0x9c75, 0x9c76, /*0x20-0x27*/ + 0x9c77, 0xcec2, 0x9c78, 0xe4cd, 0x9c79, 0xcebc, 0x9c7a, 0xb8db, /*0x28-0x2f*/ + 0x9c7b, 0x9c7c, 0xe4d6, 0x9c7d, 0xbfca, 0x9c7e, 0x9c80, 0x9c81, /*0x30-0x37*/ + 0xd3ce, 0x9c82, 0xc3ec, 0x9c83, 0x9c84, 0x9c85, 0x9c86, 0x9c87, /*0x38-0x3f*/ + 0x9c88, 0x9c89, 0x9c8a, 0xc5c8, 0xe4d8, 0x9c8b, 0x9c8c, 0x9c8d, /*0x40-0x47*/ + 0x9c8e, 0x9c8f, 0x9c90, 0x9c91, 0x9c92, 0xcdc4, 0xe4cf, 0x9c93, /*0x48-0x4f*/ + 0x9c94, 0x9c95, 0x9c96, 0xe4d4, 0xe4d5, 0x9c97, 0xbafe, 0x9c98, /*0x50-0x57*/ + 0xcfe6, 0x9c99, 0x9c9a, 0xd5bf, 0x9c9b, 0x9c9c, 0x9c9d, 0xe4d2, /*0x58-0x5f*/ + 0x9c9e, 0x9c9f, 0x9ca0, 0x9ca1, 0x9ca2, 0x9ca3, 0x9ca4, 0x9ca5, /*0x60-0x67*/ + 0x9ca6, 0x9ca7, 0x9ca8, 0xe4d0, 0x9ca9, 0x9caa, 0xe4ce, 0x9cab, /*0x68-0x6f*/ + 0x9cac, 0x9cad, 0x9cae, 0x9caf, 0x9cb0, 0x9cb1, 0x9cb2, 0x9cb3, /*0x70-0x77*/ + 0x9cb4, 0x9cb5, 0x9cb6, 0x9cb7, 0x9cb8, 0x9cb9, 0xcde5, 0xcaaa, /*0x78-0x7f*/ + 0x9cba, 0x9cbb, 0x9cbc, 0xc0a3, 0x9cbd, 0xbda6, 0xe4d3, 0x9cbe, /*0x80-0x87*/ + 0x9cbf, 0xb8c8, 0x9cc0, 0x9cc1, 0x9cc2, 0x9cc3, 0x9cc4, 0xe4e7, /*0x88-0x8f*/ + 0xd4b4, 0x9cc5, 0x9cc6, 0x9cc7, 0x9cc8, 0x9cc9, 0x9cca, 0x9ccb, /*0x90-0x97*/ + 0xe4db, 0x9ccc, 0x9ccd, 0x9cce, 0xc1ef, 0x9ccf, 0x9cd0, 0xe4e9, /*0x98-0x9f*/ + 0x9cd1, 0x9cd2, 0xd2e7, 0x9cd3, 0x9cd4, 0xe4df, 0x9cd5, 0xe4e0, /*0xa0-0xa7*/ + 0x9cd6, 0x9cd7, 0xcfaa, 0x9cd8, 0x9cd9, 0x9cda, 0x9cdb, 0xcbdd, /*0xa8-0xaf*/ + 0x9cdc, 0xe4da, 0xe4d1, 0x9cdd, 0xe4e5, 0x9cde, 0xc8dc, 0xe4e3, /*0xb0-0xb7*/ + 0x9cdf, 0x9ce0, 0xc4e7, 0xe4e2, 0x9ce1, 0xe4e1, 0x9ce2, 0x9ce3, /*0xb8-0xbf*/ + 0x9ce4, 0xb3fc, 0xe4e8, 0x9ce5, 0x9ce6, 0x9ce7, 0x9ce8, 0xb5e1, /*0xc0-0xc7*/ + 0x9ce9, 0x9cea, 0x9ceb, 0xd7cc, 0x9cec, 0x9ced, 0x9cee, 0xe4e6, /*0xc8-0xcf*/ + 0x9cef, 0xbbac, 0x9cf0, 0xd7d2, 0xcccf, 0xebf8, 0x9cf1, 0xe4e4, /*0xd0-0xd7*/ + 0x9cf2, 0x9cf3, 0xb9f6, 0x9cf4, 0x9cf5, 0x9cf6, 0xd6cd, 0xe4d9, /*0xd8-0xdf*/ + 0xe4dc, 0xc2fa, 0xe4de, 0x9cf7, 0xc2cb, 0xc0c4, 0xc2d0, 0x9cf8, /*0xe0-0xe7*/ + 0xb1f5, 0xccb2, 0x9cf9, 0x9cfa, 0x9cfb, 0x9cfc, 0x9cfd, 0x9cfe, /*0xe8-0xef*/ + 0x9d40, 0x9d41, 0x9d42, 0x9d43, 0xb5ce, 0x9d44, 0x9d45, 0x9d46, /*0xf0-0xf7*/ + 0x9d47, 0xe4ef, 0x9d48, 0x9d49, 0x9d4a, 0x9d4b, 0x9d4c, 0x9d4d, /*0xf8-0xff*/ + /* 0x6f00 */ + 0x9d4e, 0x9d4f, 0xc6af, 0x9d50, 0x9d51, 0x9d52, 0xc6e1, 0x9d53, /*0x00-0x07*/ + 0x9d54, 0xe4f5, 0x9d55, 0x9d56, 0x9d57, 0x9d58, 0x9d59, 0xc2a9, /*0x08-0x0f*/ + 0x9d5a, 0x9d5b, 0x9d5c, 0xc0ec, 0xd1dd, 0xe4ee, 0x9d5d, 0x9d5e, /*0x10-0x17*/ + 0x9d5f, 0x9d60, 0x9d61, 0x9d62, 0x9d63, 0x9d64, 0x9d65, 0x9d66, /*0x18-0x1f*/ + 0xc4ae, 0x9d67, 0x9d68, 0x9d69, 0xe4ed, 0x9d6a, 0x9d6b, 0x9d6c, /*0x20-0x27*/ + 0x9d6d, 0xe4f6, 0xe4f4, 0xc2fe, 0x9d6e, 0xe4dd, 0x9d6f, 0xe4f0, /*0x28-0x2f*/ + 0x9d70, 0xcafe, 0x9d71, 0xd5c4, 0x9d72, 0x9d73, 0xe4f1, 0x9d74, /*0x30-0x37*/ + 0x9d75, 0x9d76, 0x9d77, 0x9d78, 0x9d79, 0x9d7a, 0xd1fa, 0x9d7b, /*0x38-0x3f*/ + 0x9d7c, 0x9d7d, 0x9d7e, 0x9d80, 0x9d81, 0x9d82, 0xe4eb, 0xe4ec, /*0x40-0x47*/ + 0x9d83, 0x9d84, 0x9d85, 0xe4f2, 0x9d86, 0xceab, 0x9d87, 0x9d88, /*0x48-0x4f*/ + 0x9d89, 0x9d8a, 0x9d8b, 0x9d8c, 0x9d8d, 0x9d8e, 0x9d8f, 0x9d90, /*0x50-0x57*/ + 0xc5cb, 0x9d91, 0x9d92, 0x9d93, 0xc7b1, 0x9d94, 0xc2ba, 0x9d95, /*0x58-0x5f*/ + 0x9d96, 0x9d97, 0xe4ea, 0x9d98, 0x9d99, 0x9d9a, 0xc1ca, 0x9d9b, /*0x60-0x67*/ + 0x9d9c, 0x9d9d, 0x9d9e, 0x9d9f, 0x9da0, 0xccb6, 0xb3b1, 0x9da1, /*0x68-0x6f*/ + 0x9da2, 0x9da3, 0xe4fb, 0x9da4, 0xe4f3, 0x9da5, 0x9da6, 0x9da7, /*0x70-0x77*/ + 0xe4fa, 0x9da8, 0xe4fd, 0x9da9, 0xe4fc, 0x9daa, 0x9dab, 0x9dac, /*0x78-0x7f*/ + 0x9dad, 0x9dae, 0x9daf, 0x9db0, 0xb3ce, 0x9db1, 0x9db2, 0x9db3, /*0x80-0x87*/ + 0xb3ba, 0xe4f7, 0x9db4, 0x9db5, 0xe4f9, 0xe4f8, 0xc5ec, 0x9db6, /*0x88-0x8f*/ + 0x9db7, 0x9db8, 0x9db9, 0x9dba, 0x9dbb, 0x9dbc, 0x9dbd, 0x9dbe, /*0x90-0x97*/ + 0x9dbf, 0x9dc0, 0x9dc1, 0x9dc2, 0xc0bd, 0x9dc3, 0x9dc4, 0x9dc5, /*0x98-0x9f*/ + 0x9dc6, 0xd4e8, 0x9dc7, 0x9dc8, 0x9dc9, 0x9dca, 0x9dcb, 0xe5a2, /*0xa0-0xa7*/ + 0x9dcc, 0x9dcd, 0x9dce, 0x9dcf, 0x9dd0, 0x9dd1, 0x9dd2, 0x9dd3, /*0xa8-0xaf*/ + 0x9dd4, 0x9dd5, 0x9dd6, 0xb0c4, 0x9dd7, 0x9dd8, 0xe5a4, 0x9dd9, /*0xb0-0xb7*/ + 0x9dda, 0xe5a3, 0x9ddb, 0x9ddc, 0x9ddd, 0x9dde, 0x9ddf, 0x9de0, /*0xb8-0xbf*/ + 0xbca4, 0x9de1, 0xe5a5, 0x9de2, 0x9de3, 0x9de4, 0x9de5, 0x9de6, /*0xc0-0xc7*/ + 0x9de7, 0xe5a1, 0x9de8, 0x9de9, 0x9dea, 0x9deb, 0x9dec, 0x9ded, /*0xc8-0xcf*/ + 0x9dee, 0xe4fe, 0xb1f4, 0x9def, 0x9df0, 0x9df1, 0x9df2, 0x9df3, /*0xd0-0xd7*/ + 0x9df4, 0x9df5, 0x9df6, 0x9df7, 0x9df8, 0x9df9, 0xe5a8, 0x9dfa, /*0xd8-0xdf*/ + 0xe5a9, 0xe5a6, 0x9dfb, 0x9dfc, 0x9dfd, 0x9dfe, 0x9e40, 0x9e41, /*0xe0-0xe7*/ + 0x9e42, 0x9e43, 0x9e44, 0x9e45, 0x9e46, 0x9e47, 0xe5a7, 0xe5aa, /*0xe8-0xef*/ + 0x9e48, 0x9e49, 0x9e4a, 0x9e4b, 0x9e4c, 0x9e4d, 0x9e4e, 0x9e4f, /*0xf0-0xf7*/ + 0x9e50, 0x9e51, 0x9e52, 0x9e53, 0x9e54, 0x9e55, 0x9e56, 0x9e57, /*0xf8-0xff*/ + /* 0x7000 */ + 0x9e58, 0x9e59, 0x9e5a, 0x9e5b, 0x9e5c, 0x9e5d, 0x9e5e, 0x9e5f, /*0x00-0x07*/ + 0x9e60, 0x9e61, 0x9e62, 0x9e63, 0x9e64, 0x9e65, 0x9e66, 0x9e67, /*0x08-0x0f*/ + 0x9e68, 0xc6d9, 0x9e69, 0x9e6a, 0x9e6b, 0x9e6c, 0x9e6d, 0x9e6e, /*0x10-0x17*/ + 0x9e6f, 0x9e70, 0xe5ab, 0xe5ad, 0x9e71, 0x9e72, 0x9e73, 0x9e74, /*0x18-0x1f*/ + 0x9e75, 0x9e76, 0x9e77, 0xe5ac, 0x9e78, 0x9e79, 0x9e7a, 0x9e7b, /*0x20-0x27*/ + 0x9e7c, 0x9e7d, 0x9e7e, 0x9e80, 0x9e81, 0x9e82, 0x9e83, 0x9e84, /*0x28-0x2f*/ + 0x9e85, 0x9e86, 0x9e87, 0x9e88, 0x9e89, 0xe5af, 0x9e8a, 0x9e8b, /*0x30-0x37*/ + 0x9e8c, 0xe5ae, 0x9e8d, 0x9e8e, 0x9e8f, 0x9e90, 0x9e91, 0x9e92, /*0x38-0x3f*/ + 0x9e93, 0x9e94, 0x9e95, 0x9e96, 0x9e97, 0x9e98, 0x9e99, 0x9e9a, /*0x40-0x47*/ + 0x9e9b, 0x9e9c, 0x9e9d, 0x9e9e, 0xb9e0, 0x9e9f, 0x9ea0, 0xe5b0, /*0x48-0x4f*/ + 0x9ea1, 0x9ea2, 0x9ea3, 0x9ea4, 0x9ea5, 0x9ea6, 0x9ea7, 0x9ea8, /*0x50-0x57*/ + 0x9ea9, 0x9eaa, 0x9eab, 0x9eac, 0x9ead, 0x9eae, 0xe5b1, 0x9eaf, /*0x58-0x5f*/ + 0x9eb0, 0x9eb1, 0x9eb2, 0x9eb3, 0x9eb4, 0x9eb5, 0x9eb6, 0x9eb7, /*0x60-0x67*/ + 0x9eb8, 0x9eb9, 0x9eba, 0xbbf0, 0xece1, 0xc3f0, 0x9ebb, 0xb5c6, /*0x68-0x6f*/ + 0xbbd2, 0x9ebc, 0x9ebd, 0x9ebe, 0x9ebf, 0xc1e9, 0xd4ee, 0x9ec0, /*0x70-0x77*/ + 0xbec4, 0x9ec1, 0x9ec2, 0x9ec3, 0xd7c6, 0x9ec4, 0xd4d6, 0xb2d3, /*0x78-0x7f*/ + 0xecbe, 0x9ec5, 0x9ec6, 0x9ec7, 0x9ec8, 0xeac1, 0x9ec9, 0x9eca, /*0x80-0x87*/ + 0x9ecb, 0xc2af, 0xb4b6, 0x9ecc, 0x9ecd, 0x9ece, 0xd1d7, 0x9ecf, /*0x88-0x8f*/ + 0x9ed0, 0x9ed1, 0xb3b4, 0x9ed2, 0xc8b2, 0xbfbb, 0xecc0, 0x9ed3, /*0x90-0x97*/ + 0x9ed4, 0xd6cb, 0x9ed5, 0x9ed6, 0xecbf, 0xecc1, 0x9ed7, 0x9ed8, /*0x98-0x9f*/ + 0x9ed9, 0x9eda, 0x9edb, 0x9edc, 0x9edd, 0x9ede, 0x9edf, 0x9ee0, /*0xa0-0xa7*/ + 0x9ee1, 0x9ee2, 0x9ee3, 0xecc5, 0xbee6, 0xccbf, 0xc5da, 0xbebc, /*0xa8-0xaf*/ + 0x9ee4, 0xecc6, 0x9ee5, 0xb1fe, 0x9ee6, 0x9ee7, 0x9ee8, 0xecc4, /*0xb0-0xb7*/ + 0xd5a8, 0xb5e3, 0x9ee9, 0xecc2, 0xc1b6, 0xb3e3, 0x9eea, 0x9eeb, /*0xb8-0xbf*/ + 0xecc3, 0xcbb8, 0xc0c3, 0xccfe, 0x9eec, 0x9eed, 0x9eee, 0x9eef, /*0xc0-0xc7*/ + 0xc1d2, 0x9ef0, 0xecc8, 0x9ef1, 0x9ef2, 0x9ef3, 0x9ef4, 0x9ef5, /*0xc8-0xcf*/ + 0x9ef6, 0x9ef7, 0x9ef8, 0x9ef9, 0x9efa, 0x9efb, 0x9efc, 0x9efd, /*0xd0-0xd7*/ + 0xbae6, 0xc0d3, 0x9efe, 0xd6f2, 0x9f40, 0x9f41, 0x9f42, 0xd1cc, /*0xd8-0xdf*/ + 0x9f43, 0x9f44, 0x9f45, 0x9f46, 0xbfbe, 0x9f47, 0xb7b3, 0xc9d5, /*0xe0-0xe7*/ + 0xecc7, 0xbbe2, 0x9f48, 0xcccc, 0xbdfd, 0xc8c8, 0x9f49, 0xcfa9, /*0xe8-0xef*/ + 0x9f4a, 0x9f4b, 0x9f4c, 0x9f4d, 0x9f4e, 0x9f4f, 0x9f50, 0xcde9, /*0xf0-0xf7*/ + 0x9f51, 0xc5eb, 0x9f52, 0x9f53, 0x9f54, 0xb7e9, 0x9f55, 0x9f56, /*0xf8-0xff*/ + /* 0x7100 */ + 0x9f57, 0x9f58, 0x9f59, 0x9f5a, 0x9f5b, 0x9f5c, 0x9f5d, 0x9f5e, /*0x00-0x07*/ + 0x9f5f, 0xd1c9, 0xbab8, 0x9f60, 0x9f61, 0x9f62, 0x9f63, 0x9f64, /*0x08-0x0f*/ + 0xecc9, 0x9f65, 0x9f66, 0xecca, 0x9f67, 0xbbc0, 0xeccb, 0x9f68, /*0x10-0x17*/ + 0xece2, 0xb1ba, 0xb7d9, 0x9f69, 0x9f6a, 0x9f6b, 0x9f6c, 0x9f6d, /*0x18-0x1f*/ + 0x9f6e, 0x9f6f, 0x9f70, 0x9f71, 0x9f72, 0x9f73, 0xbdb9, 0x9f74, /*0x20-0x27*/ + 0x9f75, 0x9f76, 0x9f77, 0x9f78, 0x9f79, 0x9f7a, 0x9f7b, 0xeccc, /*0x28-0x2f*/ + 0xd1e6, 0xeccd, 0x9f7c, 0x9f7d, 0x9f7e, 0x9f80, 0xc8bb, 0x9f81, /*0x30-0x37*/ + 0x9f82, 0x9f83, 0x9f84, 0x9f85, 0x9f86, 0x9f87, 0x9f88, 0x9f89, /*0x38-0x3f*/ + 0x9f8a, 0x9f8b, 0x9f8c, 0x9f8d, 0x9f8e, 0xecd1, 0x9f8f, 0x9f90, /*0x40-0x47*/ + 0x9f91, 0x9f92, 0xecd3, 0x9f93, 0xbbcd, 0x9f94, 0xbce5, 0x9f95, /*0x48-0x4f*/ + 0x9f96, 0x9f97, 0x9f98, 0x9f99, 0x9f9a, 0x9f9b, 0x9f9c, 0x9f9d, /*0x50-0x57*/ + 0x9f9e, 0x9f9f, 0x9fa0, 0x9fa1, 0xeccf, 0x9fa2, 0xc9b7, 0x9fa3, /*0x58-0x5f*/ + 0x9fa4, 0x9fa5, 0x9fa6, 0x9fa7, 0xc3ba, 0x9fa8, 0xece3, 0xd5d5, /*0x60-0x67*/ + 0xecd0, 0x9fa9, 0x9faa, 0x9fab, 0x9fac, 0x9fad, 0xd6f3, 0x9fae, /*0x68-0x6f*/ + 0x9faf, 0x9fb0, 0xecd2, 0xecce, 0x9fb1, 0x9fb2, 0x9fb3, 0x9fb4, /*0x70-0x77*/ + 0xecd4, 0x9fb5, 0xecd5, 0x9fb6, 0x9fb7, 0xc9bf, 0x9fb8, 0x9fb9, /*0x78-0x7f*/ + 0x9fba, 0x9fbb, 0x9fbc, 0x9fbd, 0xcfa8, 0x9fbe, 0x9fbf, 0x9fc0, /*0x80-0x87*/ + 0x9fc1, 0x9fc2, 0xd0dc, 0x9fc3, 0x9fc4, 0x9fc5, 0x9fc6, 0xd1ac, /*0x88-0x8f*/ + 0x9fc7, 0x9fc8, 0x9fc9, 0x9fca, 0xc8db, 0x9fcb, 0x9fcc, 0x9fcd, /*0x90-0x97*/ + 0xecd6, 0xcef5, 0x9fce, 0x9fcf, 0x9fd0, 0x9fd1, 0x9fd2, 0xcaec, /*0x98-0x9f*/ + 0xecda, 0x9fd3, 0x9fd4, 0x9fd5, 0x9fd6, 0x9fd7, 0x9fd8, 0x9fd9, /*0xa0-0xa7*/ + 0xecd9, 0x9fda, 0x9fdb, 0x9fdc, 0xb0be, 0x9fdd, 0x9fde, 0x9fdf, /*0xa8-0xaf*/ + 0x9fe0, 0x9fe1, 0x9fe2, 0xecd7, 0x9fe3, 0xecd8, 0x9fe4, 0x9fe5, /*0xb0-0xb7*/ + 0x9fe6, 0xece4, 0x9fe7, 0x9fe8, 0x9fe9, 0x9fea, 0x9feb, 0x9fec, /*0xb8-0xbf*/ + 0x9fed, 0x9fee, 0x9fef, 0xc8bc, 0x9ff0, 0x9ff1, 0x9ff2, 0x9ff3, /*0xc0-0xc7*/ + 0x9ff4, 0x9ff5, 0x9ff6, 0x9ff7, 0x9ff8, 0x9ff9, 0xc1c7, 0x9ffa, /*0xc8-0xcf*/ + 0x9ffb, 0x9ffc, 0x9ffd, 0x9ffe, 0xecdc, 0xd1e0, 0xa040, 0xa041, /*0xd0-0xd7*/ + 0xa042, 0xa043, 0xa044, 0xa045, 0xa046, 0xa047, 0xa048, 0xa049, /*0xd8-0xdf*/ + 0xecdb, 0xa04a, 0xa04b, 0xa04c, 0xa04d, 0xd4ef, 0xa04e, 0xecdd, /*0xe0-0xe7*/ + 0xa04f, 0xa050, 0xa051, 0xa052, 0xa053, 0xa054, 0xdbc6, 0xa055, /*0xe8-0xef*/ + 0xa056, 0xa057, 0xa058, 0xa059, 0xa05a, 0xa05b, 0xa05c, 0xa05d, /*0xf0-0xf7*/ + 0xa05e, 0xecde, 0xa05f, 0xa060, 0xa061, 0xa062, 0xa063, 0xa064, /*0xf8-0xff*/ + /* 0x7200 */ + 0xa065, 0xa066, 0xa067, 0xa068, 0xa069, 0xa06a, 0xb1ac, 0xa06b, /*0x00-0x07*/ + 0xa06c, 0xa06d, 0xa06e, 0xa06f, 0xa070, 0xa071, 0xa072, 0xa073, /*0x08-0x0f*/ + 0xa074, 0xa075, 0xa076, 0xa077, 0xa078, 0xa079, 0xa07a, 0xa07b, /*0x10-0x17*/ + 0xa07c, 0xa07d, 0xa07e, 0xa080, 0xa081, 0xecdf, 0xa082, 0xa083, /*0x18-0x1f*/ + 0xa084, 0xa085, 0xa086, 0xa087, 0xa088, 0xa089, 0xa08a, 0xa08b, /*0x20-0x27*/ + 0xece0, 0xa08c, 0xd7a6, 0xa08d, 0xc5c0, 0xa08e, 0xa08f, 0xa090, /*0x28-0x2f*/ + 0xebbc, 0xb0ae, 0xa091, 0xa092, 0xa093, 0xbef4, 0xb8b8, 0xd2af, /*0x30-0x37*/ + 0xb0d6, 0xb5f9, 0xa094, 0xd8b3, 0xa095, 0xcbac, 0xa096, 0xe3dd, /*0x38-0x3f*/ + 0xa097, 0xa098, 0xa099, 0xa09a, 0xa09b, 0xa09c, 0xa09d, 0xc6ac, /*0x40-0x47*/ + 0xb0e6, 0xa09e, 0xa09f, 0xa0a0, 0xc5c6, 0xebb9, 0xa0a1, 0xa0a2, /*0x48-0x4f*/ + 0xa0a3, 0xa0a4, 0xebba, 0xa0a5, 0xa0a6, 0xa0a7, 0xebbb, 0xa0a8, /*0x50-0x57*/ + 0xa0a9, 0xd1c0, 0xa0aa, 0xc5a3, 0xa0ab, 0xeaf2, 0xa0ac, 0xc4b2, /*0x58-0x5f*/ + 0xa0ad, 0xc4b5, 0xc0ce, 0xa0ae, 0xa0af, 0xa0b0, 0xeaf3, 0xc4c1, /*0x60-0x67*/ + 0xa0b1, 0xceef, 0xa0b2, 0xa0b3, 0xa0b4, 0xa0b5, 0xeaf0, 0xeaf4, /*0x68-0x6f*/ + 0xa0b6, 0xa0b7, 0xc9fc, 0xa0b8, 0xa0b9, 0xc7a3, 0xa0ba, 0xa0bb, /*0x70-0x77*/ + 0xa0bc, 0xccd8, 0xcefe, 0xa0bd, 0xa0be, 0xa0bf, 0xeaf5, 0xeaf6, /*0x78-0x7f*/ + 0xcfac, 0xc0e7, 0xa0c0, 0xa0c1, 0xeaf7, 0xa0c2, 0xa0c3, 0xa0c4, /*0x80-0x87*/ + 0xa0c5, 0xa0c6, 0xb6bf, 0xeaf8, 0xa0c7, 0xeaf9, 0xa0c8, 0xeafa, /*0x88-0x8f*/ + 0xa0c9, 0xa0ca, 0xeafb, 0xa0cb, 0xa0cc, 0xa0cd, 0xa0ce, 0xa0cf, /*0x90-0x97*/ + 0xa0d0, 0xa0d1, 0xa0d2, 0xa0d3, 0xa0d4, 0xa0d5, 0xa0d6, 0xeaf1, /*0x98-0x9f*/ + 0xa0d7, 0xa0d8, 0xa0d9, 0xa0da, 0xa0db, 0xa0dc, 0xa0dd, 0xa0de, /*0xa0-0xa7*/ + 0xa0df, 0xa0e0, 0xa0e1, 0xa0e2, 0xc8ae, 0xe1eb, 0xa0e3, 0xb7b8, /*0xa8-0xaf*/ + 0xe1ec, 0xa0e4, 0xa0e5, 0xa0e6, 0xe1ed, 0xa0e7, 0xd7b4, 0xe1ee, /*0xb0-0xb7*/ + 0xe1ef, 0xd3cc, 0xa0e8, 0xa0e9, 0xa0ea, 0xa0eb, 0xa0ec, 0xa0ed, /*0xb8-0xbf*/ + 0xa0ee, 0xe1f1, 0xbff1, 0xe1f0, 0xb5d2, 0xa0ef, 0xa0f0, 0xa0f1, /*0xc0-0xc7*/ + 0xb1b7, 0xa0f2, 0xa0f3, 0xa0f4, 0xa0f5, 0xe1f3, 0xe1f2, 0xa0f6, /*0xc8-0xcf*/ + 0xbafc, 0xa0f7, 0xe1f4, 0xa0f8, 0xa0f9, 0xa0fa, 0xa0fb, 0xb9b7, /*0xd0-0xd7*/ + 0xa0fc, 0xbed1, 0xa0fd, 0xa0fe, 0xaa40, 0xaa41, 0xc4fc, 0xaa42, /*0xd8-0xdf*/ + 0xbadd, 0xbdc6, 0xaa43, 0xaa44, 0xaa45, 0xaa46, 0xaa47, 0xaa48, /*0xe0-0xe7*/ + 0xe1f5, 0xe1f7, 0xaa49, 0xaa4a, 0xb6c0, 0xcfc1, 0xcaa8, 0xe1f6, /*0xe8-0xef*/ + 0xd5f8, 0xd3fc, 0xe1f8, 0xe1fc, 0xe1f9, 0xaa4b, 0xaa4c, 0xe1fa, /*0xf0-0xf7*/ + 0xc0ea, 0xaa4d, 0xe1fe, 0xe2a1, 0xc0c7, 0xaa4e, 0xaa4f, 0xaa50, /*0xf8-0xff*/ + /* 0x7300 */ + 0xaa51, 0xe1fb, 0xaa52, 0xe1fd, 0xaa53, 0xaa54, 0xaa55, 0xaa56, /*0x00-0x07*/ + 0xaa57, 0xaa58, 0xe2a5, 0xaa59, 0xaa5a, 0xaa5b, 0xc1d4, 0xaa5c, /*0x08-0x0f*/ + 0xaa5d, 0xaa5e, 0xaa5f, 0xe2a3, 0xaa60, 0xe2a8, 0xb2fe, 0xe2a2, /*0x10-0x17*/ + 0xaa61, 0xaa62, 0xaa63, 0xc3cd, 0xb2c2, 0xe2a7, 0xe2a6, 0xaa64, /*0x18-0x1f*/ + 0xaa65, 0xe2a4, 0xe2a9, 0xaa66, 0xaa67, 0xe2ab, 0xaa68, 0xaa69, /*0x20-0x27*/ + 0xaa6a, 0xd0c9, 0xd6ed, 0xc3a8, 0xe2ac, 0xaa6b, 0xcfd7, 0xaa6c, /*0x28-0x2f*/ + 0xaa6d, 0xe2ae, 0xaa6e, 0xaa6f, 0xbaef, 0xaa70, 0xaa71, 0xe9e0, /*0x30-0x37*/ + 0xe2ad, 0xe2aa, 0xaa72, 0xaa73, 0xaa74, 0xaa75, 0xbbab, 0xd4b3, /*0x38-0x3f*/ + 0xaa76, 0xaa77, 0xaa78, 0xaa79, 0xaa7a, 0xaa7b, 0xaa7c, 0xaa7d, /*0x40-0x47*/ + 0xaa7e, 0xaa80, 0xaa81, 0xaa82, 0xaa83, 0xe2b0, 0xaa84, 0xaa85, /*0x48-0x4f*/ + 0xe2af, 0xaa86, 0xe9e1, 0xaa87, 0xaa88, 0xaa89, 0xaa8a, 0xe2b1, /*0x50-0x57*/ + 0xaa8b, 0xaa8c, 0xaa8d, 0xaa8e, 0xaa8f, 0xaa90, 0xaa91, 0xaa92, /*0x58-0x5f*/ + 0xe2b2, 0xaa93, 0xaa94, 0xaa95, 0xaa96, 0xaa97, 0xaa98, 0xaa99, /*0x60-0x67*/ + 0xaa9a, 0xaa9b, 0xaa9c, 0xaa9d, 0xe2b3, 0xcca1, 0xaa9e, 0xe2b4, /*0x68-0x6f*/ + 0xaa9f, 0xaaa0, 0xab40, 0xab41, 0xab42, 0xab43, 0xab44, 0xab45, /*0x70-0x77*/ + 0xab46, 0xab47, 0xab48, 0xab49, 0xab4a, 0xab4b, 0xe2b5, 0xab4c, /*0x78-0x7f*/ + 0xab4d, 0xab4e, 0xab4f, 0xab50, 0xd0fe, 0xab51, 0xab52, 0xc2ca, /*0x80-0x87*/ + 0xab53, 0xd3f1, 0xab54, 0xcdf5, 0xab55, 0xab56, 0xe7e0, 0xab57, /*0x88-0x8f*/ + 0xab58, 0xe7e1, 0xab59, 0xab5a, 0xab5b, 0xab5c, 0xbec1, 0xab5d, /*0x90-0x97*/ + 0xab5e, 0xab5f, 0xab60, 0xc2ea, 0xab61, 0xab62, 0xab63, 0xe7e4, /*0x98-0x9f*/ + 0xab64, 0xab65, 0xe7e3, 0xab66, 0xab67, 0xab68, 0xab69, 0xab6a, /*0xa0-0xa7*/ + 0xab6b, 0xcde6, 0xab6c, 0xc3b5, 0xab6d, 0xab6e, 0xe7e2, 0xbbb7, /*0xa8-0xaf*/ + 0xcfd6, 0xab6f, 0xc1e1, 0xe7e9, 0xab70, 0xab71, 0xab72, 0xe7e8, /*0xb0-0xb7*/ + 0xab73, 0xab74, 0xe7f4, 0xb2a3, 0xab75, 0xab76, 0xab77, 0xab78, /*0xb8-0xbf*/ + 0xe7ea, 0xab79, 0xe7e6, 0xab7a, 0xab7b, 0xab7c, 0xab7d, 0xab7e, /*0xc0-0xc7*/ + 0xe7ec, 0xe7eb, 0xc9ba, 0xab80, 0xab81, 0xd5e4, 0xab82, 0xe7e5, /*0xc8-0xcf*/ + 0xb7a9, 0xe7e7, 0xab83, 0xab84, 0xab85, 0xab86, 0xab87, 0xab88, /*0xd0-0xd7*/ + 0xab89, 0xe7ee, 0xab8a, 0xab8b, 0xab8c, 0xab8d, 0xe7f3, 0xab8e, /*0xd8-0xdf*/ + 0xd6e9, 0xab8f, 0xab90, 0xab91, 0xab92, 0xe7ed, 0xab93, 0xe7f2, /*0xe0-0xe7*/ + 0xab94, 0xe7f1, 0xab95, 0xab96, 0xab97, 0xb0e0, 0xab98, 0xab99, /*0xe8-0xef*/ + 0xab9a, 0xab9b, 0xe7f5, 0xab9c, 0xab9d, 0xab9e, 0xab9f, 0xaba0, /*0xf0-0xf7*/ + 0xac40, 0xac41, 0xac42, 0xac43, 0xac44, 0xac45, 0xac46, 0xac47, /*0xf8-0xff*/ + /* 0x7400 */ + 0xac48, 0xac49, 0xac4a, 0xc7f2, 0xac4b, 0xc0c5, 0xc0ed, 0xac4c, /*0x00-0x07*/ + 0xac4d, 0xc1f0, 0xe7f0, 0xac4e, 0xac4f, 0xac50, 0xac51, 0xe7f6, /*0x08-0x0f*/ + 0xcbf6, 0xac52, 0xac53, 0xac54, 0xac55, 0xac56, 0xac57, 0xac58, /*0x10-0x17*/ + 0xac59, 0xac5a, 0xe8a2, 0xe8a1, 0xac5b, 0xac5c, 0xac5d, 0xac5e, /*0x18-0x1f*/ + 0xac5f, 0xac60, 0xd7c1, 0xac61, 0xac62, 0xe7fa, 0xe7f9, 0xac63, /*0x20-0x27*/ + 0xe7fb, 0xac64, 0xe7f7, 0xac65, 0xe7fe, 0xac66, 0xe7fd, 0xac67, /*0x28-0x2f*/ + 0xe7fc, 0xac68, 0xac69, 0xc1d5, 0xc7d9, 0xc5fd, 0xc5c3, 0xac6a, /*0x30-0x37*/ + 0xac6b, 0xac6c, 0xac6d, 0xac6e, 0xc7ed, 0xac6f, 0xac70, 0xac71, /*0x38-0x3f*/ + 0xac72, 0xe8a3, 0xac73, 0xac74, 0xac75, 0xac76, 0xac77, 0xac78, /*0x40-0x47*/ + 0xac79, 0xac7a, 0xac7b, 0xac7c, 0xac7d, 0xac7e, 0xac80, 0xac81, /*0x48-0x4f*/ + 0xac82, 0xac83, 0xac84, 0xac85, 0xac86, 0xe8a6, 0xac87, 0xe8a5, /*0x50-0x57*/ + 0xac88, 0xe8a7, 0xbaf7, 0xe7f8, 0xe8a4, 0xac89, 0xc8f0, 0xc9aa, /*0x58-0x5f*/ + 0xac8a, 0xac8b, 0xac8c, 0xac8d, 0xac8e, 0xac8f, 0xac90, 0xac91, /*0x60-0x67*/ + 0xac92, 0xac93, 0xac94, 0xac95, 0xac96, 0xe8a9, 0xac97, 0xac98, /*0x68-0x6f*/ + 0xb9e5, 0xac99, 0xac9a, 0xac9b, 0xac9c, 0xac9d, 0xd1fe, 0xe8a8, /*0x70-0x77*/ + 0xac9e, 0xac9f, 0xaca0, 0xad40, 0xad41, 0xad42, 0xe8aa, 0xad43, /*0x78-0x7f*/ + 0xe8ad, 0xe8ae, 0xad44, 0xc1a7, 0xad45, 0xad46, 0xad47, 0xe8af, /*0x80-0x87*/ + 0xad48, 0xad49, 0xad4a, 0xe8b0, 0xad4b, 0xad4c, 0xe8ac, 0xad4d, /*0x88-0x8f*/ + 0xe8b4, 0xad4e, 0xad4f, 0xad50, 0xad51, 0xad52, 0xad53, 0xad54, /*0x90-0x97*/ + 0xad55, 0xad56, 0xad57, 0xad58, 0xe8ab, 0xad59, 0xe8b1, 0xad5a, /*0x98-0x9f*/ + 0xad5b, 0xad5c, 0xad5d, 0xad5e, 0xad5f, 0xad60, 0xad61, 0xe8b5, /*0xa0-0xa7*/ + 0xe8b2, 0xe8b3, 0xad62, 0xad63, 0xad64, 0xad65, 0xad66, 0xad67, /*0xa8-0xaf*/ + 0xad68, 0xad69, 0xad6a, 0xad6b, 0xad6c, 0xad6d, 0xad6e, 0xad6f, /*0xb0-0xb7*/ + 0xad70, 0xad71, 0xe8b7, 0xad72, 0xad73, 0xad74, 0xad75, 0xad76, /*0xb8-0xbf*/ + 0xad77, 0xad78, 0xad79, 0xad7a, 0xad7b, 0xad7c, 0xad7d, 0xad7e, /*0xc0-0xc7*/ + 0xad80, 0xad81, 0xad82, 0xad83, 0xad84, 0xad85, 0xad86, 0xad87, /*0xc8-0xcf*/ + 0xad88, 0xad89, 0xe8b6, 0xad8a, 0xad8b, 0xad8c, 0xad8d, 0xad8e, /*0xd0-0xd7*/ + 0xad8f, 0xad90, 0xad91, 0xad92, 0xb9cf, 0xad93, 0xf0ac, 0xad94, /*0xd8-0xdf*/ + 0xf0ad, 0xad95, 0xc6b0, 0xb0ea, 0xc8bf, 0xad96, 0xcddf, 0xad97, /*0xe0-0xe7*/ + 0xad98, 0xad99, 0xad9a, 0xad9b, 0xad9c, 0xad9d, 0xcecd, 0xeab1, /*0xe8-0xef*/ + 0xad9e, 0xad9f, 0xada0, 0xae40, 0xeab2, 0xae41, 0xc6bf, 0xb4c9, /*0xf0-0xf7*/ + 0xae42, 0xae43, 0xae44, 0xae45, 0xae46, 0xae47, 0xae48, 0xeab3, /*0xf8-0xff*/ + /* 0x7500 */ + 0xae49, 0xae4a, 0xae4b, 0xae4c, 0xd5e7, 0xae4d, 0xae4e, 0xae4f, /*0x00-0x07*/ + 0xae50, 0xae51, 0xae52, 0xae53, 0xae54, 0xddf9, 0xae55, 0xeab4, /*0x08-0x0f*/ + 0xae56, 0xeab5, 0xae57, 0xeab6, 0xae58, 0xae59, 0xae5a, 0xae5b, /*0x10-0x17*/ + 0xb8ca, 0xdfb0, 0xc9f5, 0xae5c, 0xccf0, 0xae5d, 0xae5e, 0xc9fa, /*0x18-0x1f*/ + 0xae5f, 0xae60, 0xae61, 0xae62, 0xae63, 0xc9fb, 0xae64, 0xae65, /*0x20-0x27*/ + 0xd3c3, 0xcba6, 0xae66, 0xb8a6, 0xf0ae, 0xb1c2, 0xae67, 0xe5b8, /*0x28-0x2f*/ + 0xccef, 0xd3c9, 0xbcd7, 0xc9ea, 0xae68, 0xb5e7, 0xae69, 0xc4d0, /*0x30-0x37*/ + 0xb5e9, 0xae6a, 0xeeae, 0xbbad, 0xae6b, 0xae6c, 0xe7de, 0xae6d, /*0x38-0x3f*/ + 0xeeaf, 0xae6e, 0xae6f, 0xae70, 0xae71, 0xb3a9, 0xae72, 0xae73, /*0x40-0x47*/ + 0xeeb2, 0xae74, 0xae75, 0xeeb1, 0xbde7, 0xae76, 0xeeb0, 0xceb7, /*0x48-0x4f*/ + 0xae77, 0xae78, 0xae79, 0xae7a, 0xc5cf, 0xae7b, 0xae7c, 0xae7d, /*0x50-0x57*/ + 0xae7e, 0xc1f4, 0xdbce, 0xeeb3, 0xd0f3, 0xae80, 0xae81, 0xae82, /*0x58-0x5f*/ + 0xae83, 0xae84, 0xae85, 0xae86, 0xae87, 0xc2d4, 0xc6e8, 0xae88, /*0x60-0x67*/ + 0xae89, 0xae8a, 0xb7ac, 0xae8b, 0xae8c, 0xae8d, 0xae8e, 0xae8f, /*0x68-0x6f*/ + 0xae90, 0xae91, 0xeeb4, 0xae92, 0xb3eb, 0xae93, 0xae94, 0xae95, /*0x70-0x77*/ + 0xbbfb, 0xeeb5, 0xae96, 0xae97, 0xae98, 0xae99, 0xae9a, 0xe7dc, /*0x78-0x7f*/ + 0xae9b, 0xae9c, 0xae9d, 0xeeb6, 0xae9e, 0xae9f, 0xbdae, 0xaea0, /*0x80-0x87*/ + 0xaf40, 0xaf41, 0xaf42, 0xf1e2, 0xaf43, 0xaf44, 0xaf45, 0xcae8, /*0x88-0x8f*/ + 0xaf46, 0xd2c9, 0xf0da, 0xaf47, 0xf0db, 0xaf48, 0xf0dc, 0xc1c6, /*0x90-0x97*/ + 0xaf49, 0xb8ed, 0xbece, 0xaf4a, 0xaf4b, 0xf0de, 0xaf4c, 0xc5b1, /*0x98-0x9f*/ + 0xf0dd, 0xd1f1, 0xaf4d, 0xf0e0, 0xb0cc, 0xbdea, 0xaf4e, 0xaf4f, /*0xa0-0xa7*/ + 0xaf50, 0xaf51, 0xaf52, 0xd2df, 0xf0df, 0xaf53, 0xb4af, 0xb7e8, /*0xa8-0xaf*/ + 0xf0e6, 0xf0e5, 0xc6a3, 0xf0e1, 0xf0e2, 0xb4c3, 0xaf54, 0xaf55, /*0xb0-0xb7*/ + 0xf0e3, 0xd5ee, 0xaf56, 0xaf57, 0xccdb, 0xbed2, 0xbcb2, 0xaf58, /*0xb8-0xbf*/ + 0xaf59, 0xaf5a, 0xf0e8, 0xf0e7, 0xf0e4, 0xb2a1, 0xaf5b, 0xd6a2, /*0xc0-0xc7*/ + 0xd3b8, 0xbeb7, 0xc8ac, 0xaf5c, 0xaf5d, 0xf0ea, 0xaf5e, 0xaf5f, /*0xc8-0xcf*/ + 0xaf60, 0xaf61, 0xd1f7, 0xaf62, 0xd6cc, 0xbadb, 0xf0e9, 0xaf63, /*0xd0-0xd7*/ + 0xb6bb, 0xaf64, 0xaf65, 0xcdb4, 0xaf66, 0xaf67, 0xc6a6, 0xaf68, /*0xd8-0xdf*/ + 0xaf69, 0xaf6a, 0xc1a1, 0xf0eb, 0xf0ee, 0xaf6b, 0xf0ed, 0xf0f0, /*0xe0-0xe7*/ + 0xf0ec, 0xaf6c, 0xbbbe, 0xf0ef, 0xaf6d, 0xaf6e, 0xaf6f, 0xaf70, /*0xe8-0xef*/ + 0xccb5, 0xf0f2, 0xaf71, 0xaf72, 0xb3d5, 0xaf73, 0xaf74, 0xaf75, /*0xf0-0xf7*/ + 0xaf76, 0xb1d4, 0xaf77, 0xaf78, 0xf0f3, 0xaf79, 0xaf7a, 0xf0f4, /*0xf8-0xff*/ + /* 0x7600 */ + 0xf0f6, 0xb4e1, 0xaf7b, 0xf0f1, 0xaf7c, 0xf0f7, 0xaf7d, 0xaf7e, /*0x00-0x07*/ + 0xaf80, 0xaf81, 0xf0fa, 0xaf82, 0xf0f8, 0xaf83, 0xaf84, 0xaf85, /*0x08-0x0f*/ + 0xf0f5, 0xaf86, 0xaf87, 0xaf88, 0xaf89, 0xf0fd, 0xaf8a, 0xf0f9, /*0x10-0x17*/ + 0xf0fc, 0xf0fe, 0xaf8b, 0xf1a1, 0xaf8c, 0xaf8d, 0xaf8e, 0xcec1, /*0x18-0x1f*/ + 0xf1a4, 0xaf8f, 0xf1a3, 0xaf90, 0xc1f6, 0xf0fb, 0xcadd, 0xaf91, /*0x20-0x27*/ + 0xaf92, 0xb4f1, 0xb1f1, 0xccb1, 0xaf93, 0xf1a6, 0xaf94, 0xaf95, /*0x28-0x2f*/ + 0xf1a7, 0xaf96, 0xaf97, 0xf1ac, 0xd5ce, 0xf1a9, 0xaf98, 0xaf99, /*0x30-0x37*/ + 0xc8b3, 0xaf9a, 0xaf9b, 0xaf9c, 0xf1a2, 0xaf9d, 0xf1ab, 0xf1a8, /*0x38-0x3f*/ + 0xf1a5, 0xaf9e, 0xaf9f, 0xf1aa, 0xafa0, 0xb040, 0xb041, 0xb042, /*0x40-0x47*/ + 0xb043, 0xb044, 0xb045, 0xb046, 0xb0a9, 0xf1ad, 0xb047, 0xb048, /*0x48-0x4f*/ + 0xb049, 0xb04a, 0xb04b, 0xb04c, 0xf1af, 0xb04d, 0xf1b1, 0xb04e, /*0x50-0x57*/ + 0xb04f, 0xb050, 0xb051, 0xb052, 0xf1b0, 0xb053, 0xf1ae, 0xb054, /*0x58-0x5f*/ + 0xb055, 0xb056, 0xb057, 0xd1a2, 0xb058, 0xb059, 0xb05a, 0xb05b, /*0x60-0x67*/ + 0xb05c, 0xb05d, 0xb05e, 0xf1b2, 0xb05f, 0xb060, 0xb061, 0xf1b3, /*0x68-0x6f*/ + 0xb062, 0xb063, 0xb064, 0xb065, 0xb066, 0xb067, 0xb068, 0xb069, /*0x70-0x77*/ + 0xb9ef, 0xb06a, 0xb06b, 0xb5c7, 0xb06c, 0xb0d7, 0xb0d9, 0xb06d, /*0x78-0x7f*/ + 0xb06e, 0xb06f, 0xd4ed, 0xb070, 0xb5c4, 0xb071, 0xbdd4, 0xbbca, /*0x80-0x87*/ + 0xf0a7, 0xb072, 0xb073, 0xb8de, 0xb074, 0xb075, 0xf0a8, 0xb076, /*0x88-0x8f*/ + 0xb077, 0xb0a8, 0xb078, 0xf0a9, 0xb079, 0xb07a, 0xcdee, 0xb07b, /*0x90-0x97*/ + 0xb07c, 0xf0aa, 0xb07d, 0xb07e, 0xb080, 0xb081, 0xb082, 0xb083, /*0x98-0x9f*/ + 0xb084, 0xb085, 0xb086, 0xb087, 0xf0ab, 0xb088, 0xb089, 0xb08a, /*0xa0-0xa7*/ + 0xb08b, 0xb08c, 0xb08d, 0xb08e, 0xb08f, 0xb090, 0xc6a4, 0xb091, /*0xa8-0xaf*/ + 0xb092, 0xd6e5, 0xf1e4, 0xb093, 0xf1e5, 0xb094, 0xb095, 0xb096, /*0xb0-0xb7*/ + 0xb097, 0xb098, 0xb099, 0xb09a, 0xb09b, 0xb09c, 0xb09d, 0xc3f3, /*0xb8-0xbf*/ + 0xb09e, 0xb09f, 0xd3db, 0xb0a0, 0xb140, 0xd6d1, 0xc5e8, 0xb141, /*0xc0-0xc7*/ + 0xd3af, 0xb142, 0xd2e6, 0xb143, 0xb144, 0xeec1, 0xb0bb, 0xd5b5, /*0xc8-0xcf*/ + 0xd1ce, 0xbce0, 0xbad0, 0xb145, 0xbff8, 0xb146, 0xb8c7, 0xb5c1, /*0xd0-0xd7*/ + 0xc5cc, 0xb147, 0xb148, 0xcaa2, 0xb149, 0xb14a, 0xb14b, 0xc3cb, /*0xd8-0xdf*/ + 0xb14c, 0xb14d, 0xb14e, 0xb14f, 0xb150, 0xeec2, 0xb151, 0xb152, /*0xe0-0xe7*/ + 0xb153, 0xb154, 0xb155, 0xb156, 0xb157, 0xb158, 0xc4bf, 0xb6a2, /*0xe8-0xef*/ + 0xb159, 0xedec, 0xc3a4, 0xb15a, 0xd6b1, 0xb15b, 0xb15c, 0xb15d, /*0xf0-0xf7*/ + 0xcfe0, 0xedef, 0xb15e, 0xb15f, 0xc5ce, 0xb160, 0xb6dc, 0xb161, /*0xf8-0xff*/ + /* 0x7700 */ + 0xb162, 0xcaa1, 0xb163, 0xb164, 0xeded, 0xb165, 0xb166, 0xedf0, /*0x00-0x07*/ + 0xedf1, 0xc3bc, 0xb167, 0xbfb4, 0xb168, 0xedee, 0xb169, 0xb16a, /*0x08-0x0f*/ + 0xb16b, 0xb16c, 0xb16d, 0xb16e, 0xb16f, 0xb170, 0xb171, 0xb172, /*0x10-0x17*/ + 0xb173, 0xedf4, 0xedf2, 0xb174, 0xb175, 0xb176, 0xb177, 0xd5e6, /*0x18-0x1f*/ + 0xc3df, 0xb178, 0xedf3, 0xb179, 0xb17a, 0xb17b, 0xedf6, 0xb17c, /*0x20-0x27*/ + 0xd5a3, 0xd1a3, 0xb17d, 0xb17e, 0xb180, 0xedf5, 0xb181, 0xc3d0, /*0x28-0x2f*/ + 0xb182, 0xb183, 0xb184, 0xb185, 0xb186, 0xedf7, 0xbff4, 0xbeec, /*0x30-0x37*/ + 0xedf8, 0xb187, 0xccf7, 0xb188, 0xd1db, 0xb189, 0xb18a, 0xb18b, /*0x38-0x3f*/ + 0xd7c5, 0xd5f6, 0xb18c, 0xedfc, 0xb18d, 0xb18e, 0xb18f, 0xedfb, /*0x40-0x47*/ + 0xb190, 0xb191, 0xb192, 0xb193, 0xb194, 0xb195, 0xb196, 0xb197, /*0x48-0x4f*/ + 0xedf9, 0xedfa, 0xb198, 0xb199, 0xb19a, 0xb19b, 0xb19c, 0xb19d, /*0x50-0x57*/ + 0xb19e, 0xb19f, 0xedfd, 0xbea6, 0xb1a0, 0xb240, 0xb241, 0xb242, /*0x58-0x5f*/ + 0xb243, 0xcbaf, 0xeea1, 0xb6bd, 0xb244, 0xeea2, 0xc4c0, 0xb245, /*0x60-0x67*/ + 0xedfe, 0xb246, 0xb247, 0xbdde, 0xb2c7, 0xb248, 0xb249, 0xb24a, /*0x68-0x6f*/ + 0xb24b, 0xb24c, 0xb24d, 0xb24e, 0xb24f, 0xb250, 0xb251, 0xb252, /*0x70-0x77*/ + 0xb253, 0xb6c3, 0xb254, 0xb255, 0xb256, 0xeea5, 0xd8ba, 0xeea3, /*0x78-0x7f*/ + 0xeea6, 0xb257, 0xb258, 0xb259, 0xc3e9, 0xb3f2, 0xb25a, 0xb25b, /*0x80-0x87*/ + 0xb25c, 0xb25d, 0xb25e, 0xb25f, 0xeea7, 0xeea4, 0xcfb9, 0xb260, /*0x88-0x8f*/ + 0xb261, 0xeea8, 0xc2f7, 0xb262, 0xb263, 0xb264, 0xb265, 0xb266, /*0x90-0x97*/ + 0xb267, 0xb268, 0xb269, 0xb26a, 0xb26b, 0xb26c, 0xb26d, 0xeea9, /*0x98-0x9f*/ + 0xeeaa, 0xb26e, 0xdeab, 0xb26f, 0xb270, 0xc6b3, 0xb271, 0xc7c6, /*0xa0-0xa7*/ + 0xb272, 0xd6f5, 0xb5c9, 0xb273, 0xcbb2, 0xb274, 0xb275, 0xb276, /*0xa8-0xaf*/ + 0xeeab, 0xb277, 0xb278, 0xcdab, 0xb279, 0xeeac, 0xb27a, 0xb27b, /*0xb0-0xb7*/ + 0xb27c, 0xb27d, 0xb27e, 0xd5b0, 0xb280, 0xeead, 0xb281, 0xf6c4, /*0xb8-0xbf*/ + 0xb282, 0xb283, 0xb284, 0xb285, 0xb286, 0xb287, 0xb288, 0xb289, /*0xc0-0xc7*/ + 0xb28a, 0xb28b, 0xb28c, 0xb28d, 0xb28e, 0xdbc7, 0xb28f, 0xb290, /*0xc8-0xcf*/ + 0xb291, 0xb292, 0xb293, 0xb294, 0xb295, 0xb296, 0xb297, 0xb4a3, /*0xd0-0xd7*/ + 0xb298, 0xb299, 0xb29a, 0xc3ac, 0xf1e6, 0xb29b, 0xb29c, 0xb29d, /*0xd8-0xdf*/ + 0xb29e, 0xb29f, 0xcab8, 0xd2d3, 0xb2a0, 0xd6aa, 0xb340, 0xeff2, /*0xe0-0xe7*/ + 0xb341, 0xbed8, 0xb342, 0xbdc3, 0xeff3, 0xb6cc, 0xb0ab, 0xb343, /*0xe8-0xef*/ + 0xb344, 0xb345, 0xb346, 0xcaaf, 0xb347, 0xb348, 0xedb6, 0xb349, /*0xf0-0xf7*/ + 0xedb7, 0xb34a, 0xb34b, 0xb34c, 0xb34d, 0xcef9, 0xb7af, 0xbff3, /*0xf8-0xff*/ + /* 0x7800 */ + 0xedb8, 0xc2eb, 0xc9b0, 0xb34e, 0xb34f, 0xb350, 0xb351, 0xb352, /*0x00-0x07*/ + 0xb353, 0xedb9, 0xb354, 0xb355, 0xc6f6, 0xbfb3, 0xb356, 0xb357, /*0x08-0x0f*/ + 0xb358, 0xedbc, 0xc5f8, 0xb359, 0xd1d0, 0xb35a, 0xd7a9, 0xedba, /*0x10-0x17*/ + 0xedbb, 0xb35b, 0xd1e2, 0xb35c, 0xedbf, 0xedc0, 0xb35d, 0xedc4, /*0x18-0x1f*/ + 0xb35e, 0xb35f, 0xb360, 0xedc8, 0xb361, 0xedc6, 0xedce, 0xd5e8, /*0x20-0x27*/ + 0xb362, 0xedc9, 0xb363, 0xb364, 0xedc7, 0xedbe, 0xb365, 0xb366, /*0x28-0x2f*/ + 0xc5e9, 0xb367, 0xb368, 0xb369, 0xc6c6, 0xb36a, 0xb36b, 0xc9e9, /*0x30-0x37*/ + 0xd4d2, 0xedc1, 0xedc2, 0xedc3, 0xedc5, 0xb36c, 0xc0f9, 0xb36d, /*0x38-0x3f*/ + 0xb4a1, 0xb36e, 0xb36f, 0xb370, 0xb371, 0xb9e8, 0xb372, 0xedd0, /*0x40-0x47*/ + 0xb373, 0xb374, 0xb375, 0xb376, 0xedd1, 0xb377, 0xedca, 0xb378, /*0x48-0x4f*/ + 0xedcf, 0xb379, 0xcef8, 0xb37a, 0xb37b, 0xcbb6, 0xedcc, 0xedcd, /*0x50-0x57*/ + 0xb37c, 0xb37d, 0xb37e, 0xb380, 0xb381, 0xcff5, 0xb382, 0xb383, /*0x58-0x5f*/ + 0xb384, 0xb385, 0xb386, 0xb387, 0xb388, 0xb389, 0xb38a, 0xb38b, /*0x60-0x67*/ + 0xb38c, 0xb38d, 0xedd2, 0xc1f2, 0xd3b2, 0xedcb, 0xc8b7, 0xb38e, /*0x68-0x6f*/ + 0xb38f, 0xb390, 0xb391, 0xb392, 0xb393, 0xb394, 0xb395, 0xbcef, /*0x70-0x77*/ + 0xb396, 0xb397, 0xb398, 0xb399, 0xc5f0, 0xb39a, 0xb39b, 0xb39c, /*0x78-0x7f*/ + 0xb39d, 0xb39e, 0xb39f, 0xb3a0, 0xb440, 0xb441, 0xb442, 0xedd6, /*0x80-0x87*/ + 0xb443, 0xb5ef, 0xb444, 0xb445, 0xc2b5, 0xb0ad, 0xcbe9, 0xb446, /*0x88-0x8f*/ + 0xb447, 0xb1ae, 0xb448, 0xedd4, 0xb449, 0xb44a, 0xb44b, 0xcdeb, /*0x90-0x97*/ + 0xb5e2, 0xb44c, 0xedd5, 0xedd3, 0xedd7, 0xb44d, 0xb44e, 0xb5fa, /*0x98-0x9f*/ + 0xb44f, 0xedd8, 0xb450, 0xedd9, 0xb451, 0xeddc, 0xb452, 0xb1cc, /*0xa0-0xa7*/ + 0xb453, 0xb454, 0xb455, 0xb456, 0xb457, 0xb458, 0xb459, 0xb45a, /*0xa8-0xaf*/ + 0xc5f6, 0xbcee, 0xedda, 0xccbc, 0xb2ea, 0xb45b, 0xb45c, 0xb45d, /*0xb0-0xb7*/ + 0xb45e, 0xeddb, 0xb45f, 0xb460, 0xb461, 0xb462, 0xc4eb, 0xb463, /*0xb8-0xbf*/ + 0xb464, 0xb4c5, 0xb465, 0xb466, 0xb467, 0xb0f5, 0xb468, 0xb469, /*0xc0-0xc7*/ + 0xb46a, 0xeddf, 0xc0da, 0xb4e8, 0xb46b, 0xb46c, 0xb46d, 0xb46e, /*0xc8-0xcf*/ + 0xc5cd, 0xb46f, 0xb470, 0xb471, 0xeddd, 0xbfc4, 0xb472, 0xb473, /*0xd0-0xd7*/ + 0xb474, 0xedde, 0xb475, 0xb476, 0xb477, 0xb478, 0xb479, 0xb47a, /*0xd8-0xdf*/ + 0xb47b, 0xb47c, 0xb47d, 0xb47e, 0xb480, 0xb481, 0xb482, 0xb483, /*0xe0-0xe7*/ + 0xc4a5, 0xb484, 0xb485, 0xb486, 0xede0, 0xb487, 0xb488, 0xb489, /*0xe8-0xef*/ + 0xb48a, 0xb48b, 0xede1, 0xb48c, 0xede3, 0xb48d, 0xb48e, 0xc1d7, /*0xf0-0xf7*/ + 0xb48f, 0xb490, 0xbbc7, 0xb491, 0xb492, 0xb493, 0xb494, 0xb495, /*0xf8-0xff*/ + /* 0x7900 */ + 0xb496, 0xbdb8, 0xb497, 0xb498, 0xb499, 0xede2, 0xb49a, 0xb49b, /*0x00-0x07*/ + 0xb49c, 0xb49d, 0xb49e, 0xb49f, 0xb4a0, 0xb540, 0xb541, 0xb542, /*0x08-0x0f*/ + 0xb543, 0xb544, 0xb545, 0xede4, 0xb546, 0xb547, 0xb548, 0xb549, /*0x10-0x17*/ + 0xb54a, 0xb54b, 0xb54c, 0xb54d, 0xb54e, 0xb54f, 0xede6, 0xb550, /*0x18-0x1f*/ + 0xb551, 0xb552, 0xb553, 0xb554, 0xede5, 0xb555, 0xb556, 0xb557, /*0x20-0x27*/ + 0xb558, 0xb559, 0xb55a, 0xb55b, 0xb55c, 0xb55d, 0xb55e, 0xb55f, /*0x28-0x2f*/ + 0xb560, 0xb561, 0xb562, 0xb563, 0xede7, 0xb564, 0xb565, 0xb566, /*0x30-0x37*/ + 0xb567, 0xb568, 0xcabe, 0xecea, 0xc0f1, 0xb569, 0xc9e7, 0xb56a, /*0x38-0x3f*/ + 0xeceb, 0xc6ee, 0xb56b, 0xb56c, 0xb56d, 0xb56e, 0xecec, 0xb56f, /*0x40-0x47*/ + 0xc6ed, 0xeced, 0xb570, 0xb571, 0xb572, 0xb573, 0xb574, 0xb575, /*0x48-0x4f*/ + 0xb576, 0xb577, 0xb578, 0xecf0, 0xb579, 0xb57a, 0xd7e6, 0xecf3, /*0x50-0x57*/ + 0xb57b, 0xb57c, 0xecf1, 0xecee, 0xecef, 0xd7a3, 0xc9f1, 0xcbee, /*0x58-0x5f*/ + 0xecf4, 0xb57d, 0xecf2, 0xb57e, 0xb580, 0xcfe9, 0xb581, 0xecf6, /*0x60-0x67*/ + 0xc6b1, 0xb582, 0xb583, 0xb584, 0xb585, 0xbcc0, 0xb586, 0xecf5, /*0x68-0x6f*/ + 0xb587, 0xb588, 0xb589, 0xb58a, 0xb58b, 0xb58c, 0xb58d, 0xb5bb, /*0x70-0x77*/ + 0xbbf6, 0xb58e, 0xecf7, 0xb58f, 0xb590, 0xb591, 0xb592, 0xb593, /*0x78-0x7f*/ + 0xd9f7, 0xbdfb, 0xb594, 0xb595, 0xc2bb, 0xecf8, 0xb596, 0xb597, /*0x80-0x87*/ + 0xb598, 0xb599, 0xecf9, 0xb59a, 0xb59b, 0xb59c, 0xb59d, 0xb8a3, /*0x88-0x8f*/ + 0xb59e, 0xb59f, 0xb5a0, 0xb640, 0xb641, 0xb642, 0xb643, 0xb644, /*0x90-0x97*/ + 0xb645, 0xb646, 0xecfa, 0xb647, 0xb648, 0xb649, 0xb64a, 0xb64b, /*0x98-0x9f*/ + 0xb64c, 0xb64d, 0xb64e, 0xb64f, 0xb650, 0xb651, 0xb652, 0xecfb, /*0xa0-0xa7*/ + 0xb653, 0xb654, 0xb655, 0xb656, 0xb657, 0xb658, 0xb659, 0xb65a, /*0xa8-0xaf*/ + 0xb65b, 0xb65c, 0xb65d, 0xecfc, 0xb65e, 0xb65f, 0xb660, 0xb661, /*0xb0-0xb7*/ + 0xb662, 0xd3ed, 0xd8ae, 0xc0eb, 0xb663, 0xc7dd, 0xbacc, 0xb664, /*0xb8-0xbf*/ + 0xd0e3, 0xcbbd, 0xb665, 0xcdba, 0xb666, 0xb667, 0xb8d1, 0xb668, /*0xc0-0xc7*/ + 0xb669, 0xb1fc, 0xb66a, 0xc7ef, 0xb66b, 0xd6d6, 0xb66c, 0xb66d, /*0xc8-0xcf*/ + 0xb66e, 0xbfc6, 0xc3eb, 0xb66f, 0xb670, 0xeff5, 0xb671, 0xb672, /*0xd0-0xd7*/ + 0xc3d8, 0xb673, 0xb674, 0xb675, 0xb676, 0xb677, 0xb678, 0xd7e2, /*0xd8-0xdf*/ + 0xb679, 0xb67a, 0xb67b, 0xeff7, 0xb3d3, 0xb67c, 0xc7d8, 0xd1ed, /*0xe0-0xe7*/ + 0xb67d, 0xd6c8, 0xb67e, 0xeff8, 0xb680, 0xeff6, 0xb681, 0xbbfd, /*0xe8-0xef*/ + 0xb3c6, 0xb682, 0xb683, 0xb684, 0xb685, 0xb686, 0xb687, 0xb688, /*0xf0-0xf7*/ + 0xbdd5, 0xb689, 0xb68a, 0xd2c6, 0xb68b, 0xbbe0, 0xb68c, 0xb68d, /*0xf8-0xff*/ + /* 0x7a00 */ + 0xcfa1, 0xb68e, 0xeffc, 0xeffb, 0xb68f, 0xb690, 0xeff9, 0xb691, /*0x00-0x07*/ + 0xb692, 0xb693, 0xb694, 0xb3cc, 0xb695, 0xc9d4, 0xcbb0, 0xb696, /*0x08-0x0f*/ + 0xb697, 0xb698, 0xb699, 0xb69a, 0xeffe, 0xb69b, 0xb69c, 0xb0de, /*0x10-0x17*/ + 0xb69d, 0xb69e, 0xd6c9, 0xb69f, 0xb6a0, 0xb740, 0xeffd, 0xb741, /*0x18-0x1f*/ + 0xb3ed, 0xb742, 0xb743, 0xf6d5, 0xb744, 0xb745, 0xb746, 0xb747, /*0x20-0x27*/ + 0xb748, 0xb749, 0xb74a, 0xb74b, 0xb74c, 0xb74d, 0xb74e, 0xb74f, /*0x28-0x2f*/ + 0xb750, 0xb751, 0xb752, 0xcec8, 0xb753, 0xb754, 0xb755, 0xf0a2, /*0x30-0x37*/ + 0xb756, 0xf0a1, 0xb757, 0xb5be, 0xbcda, 0xbbfc, 0xb758, 0xb8e5, /*0x38-0x3f*/ + 0xb759, 0xb75a, 0xb75b, 0xb75c, 0xb75d, 0xb75e, 0xc4c2, 0xb75f, /*0x40-0x47*/ + 0xb760, 0xb761, 0xb762, 0xb763, 0xb764, 0xb765, 0xb766, 0xb767, /*0x48-0x4f*/ + 0xb768, 0xf0a3, 0xb769, 0xb76a, 0xb76b, 0xb76c, 0xb76d, 0xcbeb, /*0x50-0x57*/ + 0xb76e, 0xb76f, 0xb770, 0xb771, 0xb772, 0xb773, 0xb774, 0xb775, /*0x58-0x5f*/ + 0xb776, 0xb777, 0xb778, 0xb779, 0xb77a, 0xb77b, 0xb77c, 0xb77d, /*0x60-0x67*/ + 0xb77e, 0xb780, 0xb781, 0xb782, 0xb783, 0xb784, 0xb785, 0xb786, /*0x68-0x6f*/ + 0xf0a6, 0xb787, 0xb788, 0xb789, 0xd1a8, 0xb78a, 0xbebf, 0xc7ee, /*0x70-0x77*/ + 0xf1b6, 0xf1b7, 0xbfd5, 0xb78b, 0xb78c, 0xb78d, 0xb78e, 0xb4a9, /*0x78-0x7f*/ + 0xf1b8, 0xcdbb, 0xb78f, 0xc7d4, 0xd5ad, 0xb790, 0xf1b9, 0xb791, /*0x80-0x87*/ + 0xf1ba, 0xb792, 0xb793, 0xb794, 0xb795, 0xc7cf, 0xb796, 0xb797, /*0x88-0x8f*/ + 0xb798, 0xd2a4, 0xd6cf, 0xb799, 0xb79a, 0xf1bb, 0xbdd1, 0xb4b0, /*0x90-0x97*/ + 0xbebd, 0xb79b, 0xb79c, 0xb79d, 0xb4dc, 0xced1, 0xb79e, 0xbfdf, /*0x98-0x9f*/ + 0xf1bd, 0xb79f, 0xb7a0, 0xb840, 0xb841, 0xbffa, 0xf1bc, 0xb842, /*0xa0-0xa7*/ + 0xf1bf, 0xb843, 0xb844, 0xb845, 0xf1be, 0xf1c0, 0xb846, 0xb847, /*0xa8-0xaf*/ + 0xb848, 0xb849, 0xb84a, 0xf1c1, 0xb84b, 0xb84c, 0xb84d, 0xb84e, /*0xb0-0xb7*/ + 0xb84f, 0xb850, 0xb851, 0xb852, 0xb853, 0xb854, 0xb855, 0xc1fe, /*0xb8-0xbf*/ + 0xb856, 0xb857, 0xb858, 0xb859, 0xb85a, 0xb85b, 0xb85c, 0xb85d, /*0xc0-0xc7*/ + 0xb85e, 0xb85f, 0xb860, 0xc1a2, 0xb861, 0xb862, 0xb863, 0xb864, /*0xc8-0xcf*/ + 0xb865, 0xb866, 0xb867, 0xb868, 0xb869, 0xb86a, 0xcafa, 0xb86b, /*0xd0-0xd7*/ + 0xb86c, 0xd5be, 0xb86d, 0xb86e, 0xb86f, 0xb870, 0xbeba, 0xbeb9, /*0xd8-0xdf*/ + 0xd5c2, 0xb871, 0xb872, 0xbfa2, 0xb873, 0xcdaf, 0xf1b5, 0xb874, /*0xe0-0xe7*/ + 0xb875, 0xb876, 0xb877, 0xb878, 0xb879, 0xbddf, 0xb87a, 0xb6cb, /*0xe8-0xef*/ + 0xb87b, 0xb87c, 0xb87d, 0xb87e, 0xb880, 0xb881, 0xb882, 0xb883, /*0xf0-0xf7*/ + 0xb884, 0xd6f1, 0xf3c3, 0xb885, 0xb886, 0xf3c4, 0xb887, 0xb8cd, /*0xf8-0xff*/ + /* 0x7b00 */ + 0xb888, 0xb889, 0xb88a, 0xf3c6, 0xf3c7, 0xb88b, 0xb0ca, 0xb88c, /*0x00-0x07*/ + 0xf3c5, 0xb88d, 0xf3c9, 0xcbf1, 0xb88e, 0xb88f, 0xb890, 0xf3cb, /*0x08-0x0f*/ + 0xb891, 0xd0a6, 0xb892, 0xb893, 0xb1ca, 0xf3c8, 0xb894, 0xb895, /*0x10-0x17*/ + 0xb896, 0xf3cf, 0xb897, 0xb5d1, 0xb898, 0xb899, 0xf3d7, 0xb89a, /*0x18-0x1f*/ + 0xf3d2, 0xb89b, 0xb89c, 0xb89d, 0xf3d4, 0xf3d3, 0xb7fb, 0xb89e, /*0x20-0x27*/ + 0xb1bf, 0xb89f, 0xf3ce, 0xf3ca, 0xb5da, 0xb8a0, 0xf3d0, 0xb940, /*0x28-0x2f*/ + 0xb941, 0xf3d1, 0xb942, 0xf3d5, 0xb943, 0xb944, 0xb945, 0xb946, /*0x30-0x37*/ + 0xf3cd, 0xb947, 0xbce3, 0xb948, 0xc1fd, 0xb949, 0xf3d6, 0xb94a, /*0x38-0x3f*/ + 0xb94b, 0xb94c, 0xb94d, 0xb94e, 0xb94f, 0xf3da, 0xb950, 0xf3cc, /*0x40-0x47*/ + 0xb951, 0xb5c8, 0xb952, 0xbdee, 0xf3dc, 0xb953, 0xb954, 0xb7a4, /*0x48-0x4f*/ + 0xbff0, 0xd6fe, 0xcdb2, 0xb955, 0xb4f0, 0xb956, 0xb2df, 0xb957, /*0x50-0x57*/ + 0xf3d8, 0xb958, 0xf3d9, 0xc9b8, 0xb959, 0xf3dd, 0xb95a, 0xb95b, /*0x58-0x5f*/ + 0xf3de, 0xb95c, 0xf3e1, 0xb95d, 0xb95e, 0xb95f, 0xb960, 0xb961, /*0x60-0x67*/ + 0xb962, 0xb963, 0xb964, 0xb965, 0xb966, 0xb967, 0xf3df, 0xb968, /*0x68-0x6f*/ + 0xb969, 0xf3e3, 0xf3e2, 0xb96a, 0xb96b, 0xf3db, 0xb96c, 0xbfea, /*0x70-0x77*/ + 0xb96d, 0xb3ef, 0xb96e, 0xf3e0, 0xb96f, 0xb970, 0xc7a9, 0xb971, /*0x78-0x7f*/ + 0xbcf2, 0xb972, 0xb973, 0xb974, 0xb975, 0xf3eb, 0xb976, 0xb977, /*0x80-0x87*/ + 0xb978, 0xb979, 0xb97a, 0xb97b, 0xb97c, 0xb9bf, 0xb97d, 0xb97e, /*0x88-0x8f*/ + 0xf3e4, 0xb980, 0xb981, 0xb982, 0xb2ad, 0xbbfe, 0xb983, 0xcbe3, /*0x90-0x97*/ + 0xb984, 0xb985, 0xb986, 0xb987, 0xf3ed, 0xf3e9, 0xb988, 0xb989, /*0x98-0x9f*/ + 0xb98a, 0xb9dc, 0xf3ee, 0xb98b, 0xb98c, 0xb98d, 0xf3e5, 0xf3e6, /*0xa0-0xa7*/ + 0xf3ea, 0xc2e1, 0xf3ec, 0xf3ef, 0xf3e8, 0xbcfd, 0xb98e, 0xb98f, /*0xa8-0xaf*/ + 0xb990, 0xcfe4, 0xb991, 0xb992, 0xf3f0, 0xb993, 0xb994, 0xb995, /*0xb0-0xb7*/ + 0xf3e7, 0xb996, 0xb997, 0xb998, 0xb999, 0xb99a, 0xb99b, 0xb99c, /*0xb8-0xbf*/ + 0xb99d, 0xf3f2, 0xb99e, 0xb99f, 0xb9a0, 0xba40, 0xd7ad, 0xc6aa, /*0xc0-0xc7*/ + 0xba41, 0xba42, 0xba43, 0xba44, 0xf3f3, 0xba45, 0xba46, 0xba47, /*0xc8-0xcf*/ + 0xba48, 0xf3f1, 0xba49, 0xc2a8, 0xba4a, 0xba4b, 0xba4c, 0xba4d, /*0xd0-0xd7*/ + 0xba4e, 0xb8dd, 0xf3f5, 0xba4f, 0xba50, 0xf3f4, 0xba51, 0xba52, /*0xd8-0xdf*/ + 0xba53, 0xb4db, 0xba54, 0xba55, 0xba56, 0xf3f6, 0xf3f7, 0xba57, /*0xe0-0xe7*/ + 0xba58, 0xba59, 0xf3f8, 0xba5a, 0xba5b, 0xba5c, 0xc0ba, 0xba5d, /*0xe8-0xef*/ + 0xba5e, 0xc0e9, 0xba5f, 0xba60, 0xba61, 0xba62, 0xba63, 0xc5f1, /*0xf0-0xf7*/ + 0xba64, 0xba65, 0xba66, 0xba67, 0xf3fb, 0xba68, 0xf3fa, 0xba69, /*0xf8-0xff*/ + /* 0x7c00 */ + 0xba6a, 0xba6b, 0xba6c, 0xba6d, 0xba6e, 0xba6f, 0xba70, 0xb4d8, /*0x00-0x07*/ + 0xba71, 0xba72, 0xba73, 0xf3fe, 0xf3f9, 0xba74, 0xba75, 0xf3fc, /*0x08-0x0f*/ + 0xba76, 0xba77, 0xba78, 0xba79, 0xba7a, 0xba7b, 0xf3fd, 0xba7c, /*0x10-0x17*/ + 0xba7d, 0xba7e, 0xba80, 0xba81, 0xba82, 0xba83, 0xba84, 0xf4a1, /*0x18-0x1f*/ + 0xba85, 0xba86, 0xba87, 0xba88, 0xba89, 0xba8a, 0xf4a3, 0xbbc9, /*0x20-0x27*/ + 0xba8b, 0xba8c, 0xf4a2, 0xba8d, 0xba8e, 0xba8f, 0xba90, 0xba91, /*0x28-0x2f*/ + 0xba92, 0xba93, 0xba94, 0xba95, 0xba96, 0xba97, 0xba98, 0xba99, /*0x30-0x37*/ + 0xf4a4, 0xba9a, 0xba9b, 0xba9c, 0xba9d, 0xba9e, 0xba9f, 0xb2be, /*0x38-0x3f*/ + 0xf4a6, 0xf4a5, 0xbaa0, 0xbb40, 0xbb41, 0xbb42, 0xbb43, 0xbb44, /*0x40-0x47*/ + 0xbb45, 0xbb46, 0xbb47, 0xbb48, 0xbb49, 0xbcae, 0xbb4a, 0xbb4b, /*0x48-0x4f*/ + 0xbb4c, 0xbb4d, 0xbb4e, 0xbb4f, 0xbb50, 0xbb51, 0xbb52, 0xbb53, /*0x50-0x57*/ + 0xbb54, 0xbb55, 0xbb56, 0xbb57, 0xbb58, 0xbb59, 0xbb5a, 0xbb5b, /*0x58-0x5f*/ + 0xbb5c, 0xbb5d, 0xbb5e, 0xbb5f, 0xbb60, 0xbb61, 0xbb62, 0xbb63, /*0x60-0x67*/ + 0xbb64, 0xbb65, 0xbb66, 0xbb67, 0xbb68, 0xbb69, 0xbb6a, 0xbb6b, /*0x68-0x6f*/ + 0xbb6c, 0xbb6d, 0xbb6e, 0xc3d7, 0xd9e1, 0xbb6f, 0xbb70, 0xbb71, /*0x70-0x77*/ + 0xbb72, 0xbb73, 0xbb74, 0xc0e0, 0xf4cc, 0xd7d1, 0xbb75, 0xbb76, /*0x78-0x7f*/ + 0xbb77, 0xbb78, 0xbb79, 0xbb7a, 0xbb7b, 0xbb7c, 0xbb7d, 0xbb7e, /*0x80-0x87*/ + 0xbb80, 0xb7db, 0xbb81, 0xbb82, 0xbb83, 0xbb84, 0xbb85, 0xbb86, /*0x88-0x8f*/ + 0xbb87, 0xf4ce, 0xc1a3, 0xbb88, 0xbb89, 0xc6c9, 0xbb8a, 0xb4d6, /*0x90-0x97*/ + 0xd5b3, 0xbb8b, 0xbb8c, 0xbb8d, 0xf4d0, 0xf4cf, 0xf4d1, 0xcbda, /*0x98-0x9f*/ + 0xbb8e, 0xbb8f, 0xf4d2, 0xbb90, 0xd4c1, 0xd6e0, 0xbb91, 0xbb92, /*0xa0-0xa7*/ + 0xbb93, 0xbb94, 0xb7e0, 0xbb95, 0xbb96, 0xbb97, 0xc1b8, 0xbb98, /*0xa8-0xaf*/ + 0xbb99, 0xc1bb, 0xf4d3, 0xbeac, 0xbb9a, 0xbb9b, 0xbb9c, 0xbb9d, /*0xb0-0xb7*/ + 0xbb9e, 0xb4e2, 0xbb9f, 0xbba0, 0xf4d4, 0xf4d5, 0xbeab, 0xbc40, /*0xb8-0xbf*/ + 0xbc41, 0xf4d6, 0xbc42, 0xbc43, 0xbc44, 0xf4db, 0xbc45, 0xf4d7, /*0xc0-0xc7*/ + 0xf4da, 0xbc46, 0xbafd, 0xbc47, 0xf4d8, 0xf4d9, 0xbc48, 0xbc49, /*0xc8-0xcf*/ + 0xbc4a, 0xbc4b, 0xbc4c, 0xbc4d, 0xbc4e, 0xb8e2, 0xccc7, 0xf4dc, /*0xd0-0xd7*/ + 0xbc4f, 0xb2da, 0xbc50, 0xbc51, 0xc3d3, 0xbc52, 0xbc53, 0xd4e3, /*0xd8-0xdf*/ + 0xbfb7, 0xbc54, 0xbc55, 0xbc56, 0xbc57, 0xbc58, 0xbc59, 0xbc5a, /*0xe0-0xe7*/ + 0xf4dd, 0xbc5b, 0xbc5c, 0xbc5d, 0xbc5e, 0xbc5f, 0xbc60, 0xc5b4, /*0xe8-0xef*/ + 0xbc61, 0xbc62, 0xbc63, 0xbc64, 0xbc65, 0xbc66, 0xbc67, 0xbc68, /*0xf0-0xf7*/ + 0xf4e9, 0xbc69, 0xbc6a, 0xcfb5, 0xbc6b, 0xbc6c, 0xbc6d, 0xbc6e, /*0xf8-0xff*/ + /* 0x7d00 */ + 0xbc6f, 0xbc70, 0xbc71, 0xbc72, 0xbc73, 0xbc74, 0xbc75, 0xbc76, /*0x00-0x07*/ + 0xbc77, 0xbc78, 0xcec9, 0xbc79, 0xbc7a, 0xbc7b, 0xbc7c, 0xbc7d, /*0x08-0x0f*/ + 0xbc7e, 0xbc80, 0xbc81, 0xbc82, 0xbc83, 0xbc84, 0xbc85, 0xbc86, /*0x10-0x17*/ + 0xbc87, 0xbc88, 0xbc89, 0xbc8a, 0xbc8b, 0xbc8c, 0xbc8d, 0xbc8e, /*0x18-0x1f*/ + 0xcbd8, 0xbc8f, 0xcbf7, 0xbc90, 0xbc91, 0xbc92, 0xbc93, 0xbdf4, /*0x20-0x27*/ + 0xbc94, 0xbc95, 0xbc96, 0xd7cf, 0xbc97, 0xbc98, 0xbc99, 0xc0db, /*0x28-0x2f*/ + 0xbc9a, 0xbc9b, 0xbc9c, 0xbc9d, 0xbc9e, 0xbc9f, 0xbca0, 0xbd40, /*0x30-0x37*/ + 0xbd41, 0xbd42, 0xbd43, 0xbd44, 0xbd45, 0xbd46, 0xbd47, 0xbd48, /*0x38-0x3f*/ + 0xbd49, 0xbd4a, 0xbd4b, 0xbd4c, 0xbd4d, 0xbd4e, 0xbd4f, 0xbd50, /*0x40-0x47*/ + 0xbd51, 0xbd52, 0xbd53, 0xbd54, 0xbd55, 0xbd56, 0xbd57, 0xbd58, /*0x48-0x4f*/ + 0xbd59, 0xbd5a, 0xbd5b, 0xbd5c, 0xbd5d, 0xbd5e, 0xbd5f, 0xbd60, /*0x50-0x57*/ + 0xbd61, 0xbd62, 0xbd63, 0xbd64, 0xbd65, 0xbd66, 0xbd67, 0xbd68, /*0x58-0x5f*/ + 0xbd69, 0xbd6a, 0xbd6b, 0xbd6c, 0xbd6d, 0xbd6e, 0xbd6f, 0xbd70, /*0x60-0x67*/ + 0xbd71, 0xbd72, 0xbd73, 0xbd74, 0xbd75, 0xbd76, 0xd0f5, 0xbd77, /*0x68-0x6f*/ + 0xbd78, 0xbd79, 0xbd7a, 0xbd7b, 0xbd7c, 0xbd7d, 0xbd7e, 0xf4ea, /*0x70-0x77*/ + 0xbd80, 0xbd81, 0xbd82, 0xbd83, 0xbd84, 0xbd85, 0xbd86, 0xbd87, /*0x78-0x7f*/ + 0xbd88, 0xbd89, 0xbd8a, 0xbd8b, 0xbd8c, 0xbd8d, 0xbd8e, 0xbd8f, /*0x80-0x87*/ + 0xbd90, 0xbd91, 0xbd92, 0xbd93, 0xbd94, 0xbd95, 0xbd96, 0xbd97, /*0x88-0x8f*/ + 0xbd98, 0xbd99, 0xbd9a, 0xbd9b, 0xbd9c, 0xbd9d, 0xbd9e, 0xbd9f, /*0x90-0x97*/ + 0xbda0, 0xbe40, 0xbe41, 0xbe42, 0xbe43, 0xbe44, 0xbe45, 0xbe46, /*0x98-0x9f*/ + 0xbe47, 0xbe48, 0xbe49, 0xbe4a, 0xbe4b, 0xbe4c, 0xf4eb, 0xbe4d, /*0xa0-0xa7*/ + 0xbe4e, 0xbe4f, 0xbe50, 0xbe51, 0xbe52, 0xbe53, 0xf4ec, 0xbe54, /*0xa8-0xaf*/ + 0xbe55, 0xbe56, 0xbe57, 0xbe58, 0xbe59, 0xbe5a, 0xbe5b, 0xbe5c, /*0xb0-0xb7*/ + 0xbe5d, 0xbe5e, 0xbe5f, 0xbe60, 0xbe61, 0xbe62, 0xbe63, 0xbe64, /*0xb8-0xbf*/ + 0xbe65, 0xbe66, 0xbe67, 0xbe68, 0xbe69, 0xbe6a, 0xbe6b, 0xbe6c, /*0xc0-0xc7*/ + 0xbe6d, 0xbe6e, 0xbe6f, 0xbe70, 0xbe71, 0xbe72, 0xbe73, 0xbe74, /*0xc8-0xcf*/ + 0xbe75, 0xbe76, 0xbe77, 0xbe78, 0xbe79, 0xbe7a, 0xbe7b, 0xbe7c, /*0xd0-0xd7*/ + 0xbe7d, 0xbe7e, 0xbe80, 0xbe81, 0xbe82, 0xbe83, 0xbe84, 0xbe85, /*0xd8-0xdf*/ + 0xbe86, 0xbe87, 0xbe88, 0xbe89, 0xbe8a, 0xbe8b, 0xbe8c, 0xbe8d, /*0xe0-0xe7*/ + 0xbe8e, 0xbe8f, 0xbe90, 0xbe91, 0xbe92, 0xbe93, 0xbe94, 0xbe95, /*0xe8-0xef*/ + 0xbe96, 0xbe97, 0xbe98, 0xbe99, 0xbe9a, 0xbe9b, 0xbe9c, 0xbe9d, /*0xf0-0xf7*/ + 0xbe9e, 0xbe9f, 0xbea0, 0xbf40, 0xbf41, 0xbf42, 0xbf43, 0xbf44, /*0xf8-0xff*/ + /* 0x7e00 */ + 0xbf45, 0xbf46, 0xbf47, 0xbf48, 0xbf49, 0xbf4a, 0xbf4b, 0xbf4c, /*0x00-0x07*/ + 0xbf4d, 0xbf4e, 0xbf4f, 0xbf50, 0xbf51, 0xbf52, 0xbf53, 0xbf54, /*0x08-0x0f*/ + 0xbf55, 0xbf56, 0xbf57, 0xbf58, 0xbf59, 0xbf5a, 0xbf5b, 0xbf5c, /*0x10-0x17*/ + 0xbf5d, 0xbf5e, 0xbf5f, 0xbf60, 0xbf61, 0xbf62, 0xbf63, 0xbf64, /*0x18-0x1f*/ + 0xbf65, 0xbf66, 0xbf67, 0xbf68, 0xbf69, 0xbf6a, 0xbf6b, 0xbf6c, /*0x20-0x27*/ + 0xbf6d, 0xbf6e, 0xbf6f, 0xbf70, 0xbf71, 0xbf72, 0xbf73, 0xbf74, /*0x28-0x2f*/ + 0xbf75, 0xbf76, 0xbf77, 0xbf78, 0xbf79, 0xbf7a, 0xbf7b, 0xbf7c, /*0x30-0x37*/ + 0xbf7d, 0xbf7e, 0xbf80, 0xf7e3, 0xbf81, 0xbf82, 0xbf83, 0xbf84, /*0x38-0x3f*/ + 0xbf85, 0xb7b1, 0xbf86, 0xbf87, 0xbf88, 0xbf89, 0xbf8a, 0xf4ed, /*0x40-0x47*/ + 0xbf8b, 0xbf8c, 0xbf8d, 0xbf8e, 0xbf8f, 0xbf90, 0xbf91, 0xbf92, /*0x48-0x4f*/ + 0xbf93, 0xbf94, 0xbf95, 0xbf96, 0xbf97, 0xbf98, 0xbf99, 0xbf9a, /*0x50-0x57*/ + 0xbf9b, 0xbf9c, 0xbf9d, 0xbf9e, 0xbf9f, 0xbfa0, 0xc040, 0xc041, /*0x58-0x5f*/ + 0xc042, 0xc043, 0xc044, 0xc045, 0xc046, 0xc047, 0xc048, 0xc049, /*0x60-0x67*/ + 0xc04a, 0xc04b, 0xc04c, 0xc04d, 0xc04e, 0xc04f, 0xc050, 0xc051, /*0x68-0x6f*/ + 0xc052, 0xc053, 0xc054, 0xc055, 0xc056, 0xc057, 0xc058, 0xc059, /*0x70-0x77*/ + 0xc05a, 0xc05b, 0xc05c, 0xc05d, 0xc05e, 0xc05f, 0xc060, 0xc061, /*0x78-0x7f*/ + 0xc062, 0xc063, 0xd7eb, 0xc064, 0xc065, 0xc066, 0xc067, 0xc068, /*0x80-0x87*/ + 0xc069, 0xc06a, 0xc06b, 0xc06c, 0xc06d, 0xc06e, 0xc06f, 0xc070, /*0x88-0x8f*/ + 0xc071, 0xc072, 0xc073, 0xc074, 0xc075, 0xc076, 0xc077, 0xc078, /*0x90-0x97*/ + 0xc079, 0xc07a, 0xc07b, 0xf4ee, 0xc07c, 0xc07d, 0xc07e, 0xe6f9, /*0x98-0x9f*/ + 0xbec0, 0xe6fa, 0xbaec, 0xe6fb, 0xcfcb, 0xe6fc, 0xd4bc, 0xbcb6, /*0xa0-0xa7*/ + 0xe6fd, 0xe6fe, 0xbccd, 0xc8d2, 0xceb3, 0xe7a1, 0xc080, 0xb4bf, /*0xa8-0xaf*/ + 0xe7a2, 0xc9b4, 0xb8d9, 0xc4c9, 0xc081, 0xd7dd, 0xc2da, 0xb7d7, /*0xb0-0xb7*/ + 0xd6bd, 0xcec6, 0xb7c4, 0xc082, 0xc083, 0xc5a6, 0xe7a3, 0xcfdf, /*0xb8-0xbf*/ + 0xe7a4, 0xe7a5, 0xe7a6, 0xc1b7, 0xd7e9, 0xc9f0, 0xcfb8, 0xd6af, /*0xc0-0xc7*/ + 0xd6d5, 0xe7a7, 0xb0ed, 0xe7a8, 0xe7a9, 0xc9dc, 0xd2ef, 0xbead, /*0xc8-0xcf*/ + 0xe7aa, 0xb0f3, 0xc8de, 0xbde1, 0xe7ab, 0xc8c6, 0xc084, 0xe7ac, /*0xd0-0xd7*/ + 0xbbe6, 0xb8f8, 0xd1a4, 0xe7ad, 0xc2e7, 0xbef8, 0xbdca, 0xcdb3, /*0xd8-0xdf*/ + 0xe7ae, 0xe7af, 0xbeee, 0xd0e5, 0xc085, 0xcbe7, 0xccd0, 0xbccc, /*0xe0-0xe7*/ + 0xe7b0, 0xbca8, 0xd0f7, 0xe7b1, 0xc086, 0xd0f8, 0xe7b2, 0xe7b3, /*0xe8-0xef*/ + 0xb4c2, 0xe7b4, 0xe7b5, 0xc9fe, 0xceac, 0xc3e0, 0xe7b7, 0xb1c1, /*0xf0-0xf7*/ + 0xb3f1, 0xc087, 0xe7b8, 0xe7b9, 0xd7db, 0xd5c0, 0xe7ba, 0xc2cc, /*0xf8-0xff*/ + /* 0x7f00 */ + 0xd7ba, 0xe7bb, 0xe7bc, 0xe7bd, 0xbcea, 0xc3e5, 0xc0c2, 0xe7be, /*0x00-0x07*/ + 0xe7bf, 0xbca9, 0xc088, 0xe7c0, 0xe7c1, 0xe7b6, 0xb6d0, 0xe7c2, /*0x08-0x0f*/ + 0xc089, 0xe7c3, 0xe7c4, 0xbbba, 0xb5de, 0xc2c6, 0xb1e0, 0xe7c5, /*0x10-0x17*/ + 0xd4b5, 0xe7c6, 0xb8bf, 0xe7c8, 0xe7c7, 0xb7ec, 0xc08a, 0xe7c9, /*0x18-0x1f*/ + 0xb2f8, 0xe7ca, 0xe7cb, 0xe7cc, 0xe7cd, 0xe7ce, 0xe7cf, 0xe7d0, /*0x20-0x27*/ + 0xd3a7, 0xcbf5, 0xe7d1, 0xe7d2, 0xe7d3, 0xe7d4, 0xc9c9, 0xe7d5, /*0x28-0x2f*/ + 0xe7d6, 0xe7d7, 0xe7d8, 0xe7d9, 0xbdc9, 0xe7da, 0xf3be, 0xc08b, /*0x30-0x37*/ + 0xb8d7, 0xc08c, 0xc8b1, 0xc08d, 0xc08e, 0xc08f, 0xc090, 0xc091, /*0x38-0x3f*/ + 0xc092, 0xc093, 0xf3bf, 0xc094, 0xf3c0, 0xf3c1, 0xc095, 0xc096, /*0x40-0x47*/ + 0xc097, 0xc098, 0xc099, 0xc09a, 0xc09b, 0xc09c, 0xc09d, 0xc09e, /*0x48-0x4f*/ + 0xb9de, 0xcdf8, 0xc09f, 0xc0a0, 0xd8e8, 0xbab1, 0xc140, 0xc2de, /*0x50-0x57*/ + 0xeeb7, 0xc141, 0xb7a3, 0xc142, 0xc143, 0xc144, 0xc145, 0xeeb9, /*0x58-0x5f*/ + 0xc146, 0xeeb8, 0xb0d5, 0xc147, 0xc148, 0xc149, 0xc14a, 0xc14b, /*0x60-0x67*/ + 0xeebb, 0xd5d6, 0xd7ef, 0xc14c, 0xc14d, 0xc14e, 0xd6c3, 0xc14f, /*0x68-0x6f*/ + 0xc150, 0xeebd, 0xcaf0, 0xc151, 0xeebc, 0xc152, 0xc153, 0xc154, /*0x70-0x77*/ + 0xc155, 0xeebe, 0xc156, 0xc157, 0xc158, 0xc159, 0xeec0, 0xc15a, /*0x78-0x7f*/ + 0xc15b, 0xeebf, 0xc15c, 0xc15d, 0xc15e, 0xc15f, 0xc160, 0xc161, /*0x80-0x87*/ + 0xc162, 0xc163, 0xd1f2, 0xc164, 0xc7bc, 0xc165, 0xc3c0, 0xc166, /*0x88-0x8f*/ + 0xc167, 0xc168, 0xc169, 0xc16a, 0xb8e1, 0xc16b, 0xc16c, 0xc16d, /*0x90-0x97*/ + 0xc16e, 0xc16f, 0xc1e7, 0xc170, 0xc171, 0xf4c6, 0xd0df, 0xf4c7, /*0x98-0x9f*/ + 0xc172, 0xcfdb, 0xc173, 0xc174, 0xc8ba, 0xc175, 0xc176, 0xf4c8, /*0xa0-0xa7*/ + 0xc177, 0xc178, 0xc179, 0xc17a, 0xc17b, 0xc17c, 0xc17d, 0xf4c9, /*0xa8-0xaf*/ + 0xf4ca, 0xc17e, 0xf4cb, 0xc180, 0xc181, 0xc182, 0xc183, 0xc184, /*0xb0-0xb7*/ + 0xd9fa, 0xb8fe, 0xc185, 0xc186, 0xe5f1, 0xd3f0, 0xc187, 0xf4e0, /*0xb8-0xbf*/ + 0xc188, 0xcecc, 0xc189, 0xc18a, 0xc18b, 0xb3e1, 0xc18c, 0xc18d, /*0xc0-0xc7*/ + 0xc18e, 0xc18f, 0xf1b4, 0xc190, 0xd2ee, 0xc191, 0xf4e1, 0xc192, /*0xc8-0xcf*/ + 0xc193, 0xc194, 0xc195, 0xc196, 0xcfe8, 0xf4e2, 0xc197, 0xc198, /*0xd0-0xd7*/ + 0xc7cc, 0xc199, 0xc19a, 0xc19b, 0xc19c, 0xc19d, 0xc19e, 0xb5d4, /*0xd8-0xdf*/ + 0xb4e4, 0xf4e4, 0xc19f, 0xc1a0, 0xc240, 0xf4e3, 0xf4e5, 0xc241, /*0xe0-0xe7*/ + 0xc242, 0xf4e6, 0xc243, 0xc244, 0xc245, 0xc246, 0xf4e7, 0xc247, /*0xe8-0xef*/ + 0xbab2, 0xb0bf, 0xc248, 0xf4e8, 0xc249, 0xc24a, 0xc24b, 0xc24c, /*0xf0-0xf7*/ + 0xc24d, 0xc24e, 0xc24f, 0xb7ad, 0xd2ed, 0xc250, 0xc251, 0xc252, /*0xf8-0xff*/ + /* 0x8000 */ + 0xd2ab, 0xc0cf, 0xc253, 0xbfbc, 0xeba3, 0xd5df, 0xeac8, 0xc254, /*0x00-0x07*/ + 0xc255, 0xc256, 0xc257, 0xf1f3, 0xb6f8, 0xcba3, 0xc258, 0xc259, /*0x08-0x0f*/ + 0xc4cd, 0xc25a, 0xf1e7, 0xc25b, 0xf1e8, 0xb8fb, 0xf1e9, 0xbac4, /*0x10-0x17*/ + 0xd4c5, 0xb0d2, 0xc25c, 0xc25d, 0xf1ea, 0xc25e, 0xc25f, 0xc260, /*0x18-0x1f*/ + 0xf1eb, 0xc261, 0xf1ec, 0xc262, 0xc263, 0xf1ed, 0xf1ee, 0xf1ef, /*0x20-0x27*/ + 0xf1f1, 0xf1f0, 0xc5d5, 0xc264, 0xc265, 0xc266, 0xc267, 0xc268, /*0x28-0x2f*/ + 0xc269, 0xf1f2, 0xc26a, 0xb6fa, 0xc26b, 0xf1f4, 0xd2ae, 0xdec7, /*0x30-0x37*/ + 0xcbca, 0xc26c, 0xc26d, 0xb3dc, 0xc26e, 0xb5a2, 0xc26f, 0xb9a2, /*0x38-0x3f*/ + 0xc270, 0xc271, 0xc4f4, 0xf1f5, 0xc272, 0xc273, 0xf1f6, 0xc274, /*0x40-0x47*/ + 0xc275, 0xc276, 0xc1c4, 0xc1fb, 0xd6b0, 0xf1f7, 0xc277, 0xc278, /*0x48-0x4f*/ + 0xc279, 0xc27a, 0xf1f8, 0xc27b, 0xc1aa, 0xc27c, 0xc27d, 0xc27e, /*0x50-0x57*/ + 0xc6b8, 0xc280, 0xbedb, 0xc281, 0xc282, 0xc283, 0xc284, 0xc285, /*0x58-0x5f*/ + 0xc286, 0xc287, 0xc288, 0xc289, 0xc28a, 0xc28b, 0xc28c, 0xc28d, /*0x60-0x67*/ + 0xc28e, 0xf1f9, 0xb4cf, 0xc28f, 0xc290, 0xc291, 0xc292, 0xc293, /*0x68-0x6f*/ + 0xc294, 0xf1fa, 0xc295, 0xc296, 0xc297, 0xc298, 0xc299, 0xc29a, /*0x70-0x77*/ + 0xc29b, 0xc29c, 0xc29d, 0xc29e, 0xc29f, 0xc2a0, 0xc340, 0xedb2, /*0x78-0x7f*/ + 0xedb1, 0xc341, 0xc342, 0xcbe0, 0xd2de, 0xc343, 0xcbc1, 0xd5d8, /*0x80-0x87*/ + 0xc344, 0xc8e2, 0xc345, 0xc0df, 0xbca1, 0xc346, 0xc347, 0xc348, /*0x88-0x8f*/ + 0xc349, 0xc34a, 0xc34b, 0xebc1, 0xc34c, 0xc34d, 0xd0a4, 0xc34e, /*0x90-0x97*/ + 0xd6e2, 0xc34f, 0xb6c7, 0xb8d8, 0xebc0, 0xb8ce, 0xc350, 0xebbf, /*0x98-0x9f*/ + 0xb3a6, 0xb9c9, 0xd6ab, 0xc351, 0xb7f4, 0xb7ca, 0xc352, 0xc353, /*0xa0-0xa7*/ + 0xc354, 0xbce7, 0xb7be, 0xebc6, 0xc355, 0xebc7, 0xb0b9, 0xbfcf, /*0xa8-0xaf*/ + 0xc356, 0xebc5, 0xd3fd, 0xc357, 0xebc8, 0xc358, 0xc359, 0xebc9, /*0xb0-0xb7*/ + 0xc35a, 0xc35b, 0xb7ce, 0xc35c, 0xebc2, 0xebc4, 0xc9f6, 0xd6d7, /*0xb8-0xbf*/ + 0xd5cd, 0xd0b2, 0xebcf, 0xceb8, 0xebd0, 0xc35d, 0xb5a8, 0xc35e, /*0xc0-0xc7*/ + 0xc35f, 0xc360, 0xc361, 0xc362, 0xb1b3, 0xebd2, 0xcca5, 0xc363, /*0xc8-0xcf*/ + 0xc364, 0xc365, 0xc366, 0xc367, 0xc368, 0xc369, 0xc5d6, 0xebd3, /*0xd0-0xd7*/ + 0xc36a, 0xebd1, 0xc5df, 0xebce, 0xcaa4, 0xebd5, 0xb0fb, 0xc36b, /*0xd8-0xdf*/ + 0xc36c, 0xbafa, 0xc36d, 0xc36e, 0xd8b7, 0xf1e3, 0xc36f, 0xebca, /*0xe0-0xe7*/ + 0xebcb, 0xebcc, 0xebcd, 0xebd6, 0xe6c0, 0xebd9, 0xc370, 0xbfe8, /*0xe8-0xef*/ + 0xd2c8, 0xebd7, 0xebdc, 0xb8ec, 0xebd8, 0xc371, 0xbdba, 0xc372, /*0xf0-0xf7*/ + 0xd0d8, 0xc373, 0xb0b7, 0xc374, 0xebdd, 0xc4dc, 0xc375, 0xc376, /*0xf8-0xff*/ + /* 0x8100 */ + 0xc377, 0xc378, 0xd6ac, 0xc379, 0xc37a, 0xc37b, 0xb4e0, 0xc37c, /*0x00-0x07*/ + 0xc37d, 0xc2f6, 0xbcb9, 0xc37e, 0xc380, 0xebda, 0xebdb, 0xd4e0, /*0x08-0x0f*/ + 0xc6ea, 0xc4d4, 0xebdf, 0xc5a7, 0xd9f5, 0xc381, 0xb2b1, 0xc382, /*0x10-0x17*/ + 0xebe4, 0xc383, 0xbdc5, 0xc384, 0xc385, 0xc386, 0xebe2, 0xc387, /*0x18-0x1f*/ + 0xc388, 0xc389, 0xc38a, 0xc38b, 0xc38c, 0xc38d, 0xc38e, 0xc38f, /*0x20-0x27*/ + 0xc390, 0xc391, 0xc392, 0xc393, 0xebe3, 0xc394, 0xc395, 0xb8ac, /*0x28-0x2f*/ + 0xc396, 0xcdd1, 0xebe5, 0xc397, 0xc398, 0xc399, 0xebe1, 0xc39a, /*0x30-0x37*/ + 0xc1b3, 0xc39b, 0xc39c, 0xc39d, 0xc39e, 0xc39f, 0xc6a2, 0xc3a0, /*0x38-0x3f*/ + 0xc440, 0xc441, 0xc442, 0xc443, 0xc444, 0xc445, 0xccf3, 0xc446, /*0x40-0x47*/ + 0xebe6, 0xc447, 0xc0b0, 0xd2b8, 0xebe7, 0xc448, 0xc449, 0xc44a, /*0x48-0x4f*/ + 0xb8af, 0xb8ad, 0xc44b, 0xebe8, 0xc7bb, 0xcdf3, 0xc44c, 0xc44d, /*0x50-0x57*/ + 0xc44e, 0xebea, 0xebeb, 0xc44f, 0xc450, 0xc451, 0xc452, 0xc453, /*0x58-0x5f*/ + 0xebed, 0xc454, 0xc455, 0xc456, 0xc457, 0xd0c8, 0xc458, 0xebf2, /*0x60-0x67*/ + 0xc459, 0xebee, 0xc45a, 0xc45b, 0xc45c, 0xebf1, 0xc8f9, 0xc45d, /*0x68-0x6f*/ + 0xd1fc, 0xebec, 0xc45e, 0xc45f, 0xebe9, 0xc460, 0xc461, 0xc462, /*0x70-0x77*/ + 0xc463, 0xb8b9, 0xcfd9, 0xc4e5, 0xebef, 0xebf0, 0xccda, 0xcdc8, /*0x78-0x7f*/ + 0xb0f2, 0xc464, 0xebf6, 0xc465, 0xc466, 0xc467, 0xc468, 0xc469, /*0x80-0x87*/ + 0xebf5, 0xc46a, 0xb2b2, 0xc46b, 0xc46c, 0xc46d, 0xc46e, 0xb8e0, /*0x88-0x8f*/ + 0xc46f, 0xebf7, 0xc470, 0xc471, 0xc472, 0xc473, 0xc474, 0xc475, /*0x90-0x97*/ + 0xb1ec, 0xc476, 0xc477, 0xccc5, 0xc4a4, 0xcfa5, 0xc478, 0xc479, /*0x98-0x9f*/ + 0xc47a, 0xc47b, 0xc47c, 0xebf9, 0xc47d, 0xc47e, 0xeca2, 0xc480, /*0xa0-0xa7*/ + 0xc5f2, 0xc481, 0xebfa, 0xc482, 0xc483, 0xc484, 0xc485, 0xc486, /*0xa8-0xaf*/ + 0xc487, 0xc488, 0xc489, 0xc9c5, 0xc48a, 0xc48b, 0xc48c, 0xc48d, /*0xb0-0xb7*/ + 0xc48e, 0xc48f, 0xe2df, 0xebfe, 0xc490, 0xc491, 0xc492, 0xc493, /*0xb8-0xbf*/ + 0xcdce, 0xeca1, 0xb1db, 0xd3b7, 0xc494, 0xc495, 0xd2dc, 0xc496, /*0xc0-0xc7*/ + 0xc497, 0xc498, 0xebfd, 0xc499, 0xebfb, 0xc49a, 0xc49b, 0xc49c, /*0xc8-0xcf*/ + 0xc49d, 0xc49e, 0xc49f, 0xc4a0, 0xc540, 0xc541, 0xc542, 0xc543, /*0xd0-0xd7*/ + 0xc544, 0xc545, 0xc546, 0xc547, 0xc548, 0xc549, 0xc54a, 0xc54b, /*0xd8-0xdf*/ + 0xc54c, 0xc54d, 0xc54e, 0xb3bc, 0xc54f, 0xc550, 0xc551, 0xeab0, /*0xe0-0xe7*/ + 0xc552, 0xc553, 0xd7d4, 0xc554, 0xf4ab, 0xb3f4, 0xc555, 0xc556, /*0xe8-0xef*/ + 0xc557, 0xc558, 0xc559, 0xd6c1, 0xd6c2, 0xc55a, 0xc55b, 0xc55c, /*0xf0-0xf7*/ + 0xc55d, 0xc55e, 0xc55f, 0xd5e9, 0xbeca, 0xc560, 0xf4a7, 0xc561, /*0xf8-0xff*/ + /* 0x8200 */ + 0xd2a8, 0xf4a8, 0xf4a9, 0xc562, 0xf4aa, 0xbecb, 0xd3df, 0xc563, /*0x00-0x07*/ + 0xc564, 0xc565, 0xc566, 0xc567, 0xc9e0, 0xc9e1, 0xc568, 0xc569, /*0x08-0x0f*/ + 0xf3c2, 0xc56a, 0xcae6, 0xc56b, 0xccf2, 0xc56c, 0xc56d, 0xc56e, /*0x10-0x17*/ + 0xc56f, 0xc570, 0xc571, 0xe2b6, 0xcbb4, 0xc572, 0xcee8, 0xd6db, /*0x18-0x1f*/ + 0xc573, 0xf4ad, 0xf4ae, 0xf4af, 0xc574, 0xc575, 0xc576, 0xc577, /*0x20-0x27*/ + 0xf4b2, 0xc578, 0xbabd, 0xf4b3, 0xb0e3, 0xf4b0, 0xc579, 0xf4b1, /*0x28-0x2f*/ + 0xbda2, 0xb2d5, 0xc57a, 0xf4b6, 0xf4b7, 0xb6e6, 0xb2b0, 0xcfcf, /*0x30-0x37*/ + 0xf4b4, 0xb4ac, 0xc57b, 0xf4b5, 0xc57c, 0xc57d, 0xf4b8, 0xc57e, /*0x38-0x3f*/ + 0xc580, 0xc581, 0xc582, 0xc583, 0xf4b9, 0xc584, 0xc585, 0xcda7, /*0x40-0x47*/ + 0xc586, 0xf4ba, 0xc587, 0xf4bb, 0xc588, 0xc589, 0xc58a, 0xf4bc, /*0x48-0x4f*/ + 0xc58b, 0xc58c, 0xc58d, 0xc58e, 0xc58f, 0xc590, 0xc591, 0xc592, /*0x50-0x57*/ + 0xcbd2, 0xc593, 0xf4bd, 0xc594, 0xc595, 0xc596, 0xc597, 0xf4be, /*0x58-0x5f*/ + 0xc598, 0xc599, 0xc59a, 0xc59b, 0xc59c, 0xc59d, 0xc59e, 0xc59f, /*0x60-0x67*/ + 0xf4bf, 0xc5a0, 0xc640, 0xc641, 0xc642, 0xc643, 0xf4de, 0xc1bc, /*0x68-0x6f*/ + 0xbce8, 0xc644, 0xc9ab, 0xd1de, 0xe5f5, 0xc645, 0xc646, 0xc647, /*0x70-0x77*/ + 0xc648, 0xdcb3, 0xd2d5, 0xc649, 0xc64a, 0xdcb4, 0xb0ac, 0xdcb5, /*0x78-0x7f*/ + 0xc64b, 0xc64c, 0xbdda, 0xc64d, 0xdcb9, 0xc64e, 0xc64f, 0xc650, /*0x80-0x87*/ + 0xd8c2, 0xc651, 0xdcb7, 0xd3f3, 0xc652, 0xc9d6, 0xdcba, 0xdcb6, /*0x88-0x8f*/ + 0xc653, 0xdcbb, 0xc3a2, 0xc654, 0xc655, 0xc656, 0xc657, 0xdcbc, /*0x90-0x97*/ + 0xdcc5, 0xdcbd, 0xc658, 0xc659, 0xcedf, 0xd6a5, 0xc65a, 0xdccf, /*0x98-0x9f*/ + 0xc65b, 0xdccd, 0xc65c, 0xc65d, 0xdcd2, 0xbde6, 0xc2ab, 0xc65e, /*0xa0-0xa7*/ + 0xdcb8, 0xdccb, 0xdcce, 0xdcbe, 0xb7d2, 0xb0c5, 0xdcc7, 0xd0be, /*0xa8-0xaf*/ + 0xdcc1, 0xbba8, 0xc65f, 0xb7bc, 0xdccc, 0xc660, 0xc661, 0xdcc6, /*0xb0-0xb7*/ + 0xdcbf, 0xc7db, 0xc662, 0xc663, 0xc664, 0xd1bf, 0xdcc0, 0xc665, /*0xb8-0xbf*/ + 0xc666, 0xdcca, 0xc667, 0xc668, 0xdcd0, 0xc669, 0xc66a, 0xcead, /*0xc0-0xc7*/ + 0xdcc2, 0xc66b, 0xdcc3, 0xdcc8, 0xdcc9, 0xb2d4, 0xdcd1, 0xcbd5, /*0xc8-0xcf*/ + 0xc66c, 0xd4b7, 0xdcdb, 0xdcdf, 0xcca6, 0xdce6, 0xc66d, 0xc3e7, /*0xd0-0xd7*/ + 0xdcdc, 0xc66e, 0xc66f, 0xbfc1, 0xdcd9, 0xc670, 0xb0fa, 0xb9b6, /*0xd8-0xdf*/ + 0xdce5, 0xdcd3, 0xc671, 0xdcc4, 0xdcd6, 0xc8f4, 0xbfe0, 0xc672, /*0xe0-0xe7*/ + 0xc673, 0xc674, 0xc675, 0xc9bb, 0xc676, 0xc677, 0xc678, 0xb1bd, /*0xe8-0xef*/ + 0xc679, 0xd3a2, 0xc67a, 0xc67b, 0xdcda, 0xc67c, 0xc67d, 0xdcd5, /*0xf0-0xf7*/ + 0xc67e, 0xc6bb, 0xc680, 0xdcde, 0xc681, 0xc682, 0xc683, 0xc684, /*0xf8-0xff*/ + /* 0x8300 */ + 0xc685, 0xd7c2, 0xc3af, 0xb7b6, 0xc7d1, 0xc3a9, 0xdce2, 0xdcd8, /*0x00-0x07*/ + 0xdceb, 0xdcd4, 0xc686, 0xc687, 0xdcdd, 0xc688, 0xbea5, 0xdcd7, /*0x08-0x0f*/ + 0xc689, 0xdce0, 0xc68a, 0xc68b, 0xdce3, 0xdce4, 0xc68c, 0xdcf8, /*0x10-0x17*/ + 0xc68d, 0xc68e, 0xdce1, 0xdda2, 0xdce7, 0xc68f, 0xc690, 0xc691, /*0x18-0x1f*/ + 0xc692, 0xc693, 0xc694, 0xc695, 0xc696, 0xc697, 0xc698, 0xbceb, /*0x20-0x27*/ + 0xb4c4, 0xc699, 0xc69a, 0xc3a3, 0xb2e7, 0xdcfa, 0xc69b, 0xdcf2, /*0x28-0x2f*/ + 0xc69c, 0xdcef, 0xc69d, 0xdcfc, 0xdcee, 0xd2f0, 0xb2e8, 0xc69e, /*0x30-0x37*/ + 0xc8d7, 0xc8e3, 0xdcfb, 0xc69f, 0xdced, 0xc6a0, 0xc740, 0xc741, /*0x38-0x3f*/ + 0xdcf7, 0xc742, 0xc743, 0xdcf5, 0xc744, 0xc745, 0xbea3, 0xdcf4, /*0x40-0x47*/ + 0xc746, 0xb2dd, 0xc747, 0xc748, 0xc749, 0xc74a, 0xc74b, 0xdcf3, /*0x48-0x4f*/ + 0xbcf6, 0xdce8, 0xbbc4, 0xc74c, 0xc0f3, 0xc74d, 0xc74e, 0xc74f, /*0x50-0x57*/ + 0xc750, 0xc751, 0xbcd4, 0xdce9, 0xdcea, 0xc752, 0xdcf1, 0xdcf6, /*0x58-0x5f*/ + 0xdcf9, 0xb5b4, 0xc753, 0xc8d9, 0xbbe7, 0xdcfe, 0xdcfd, 0xd3ab, /*0x60-0x67*/ + 0xdda1, 0xdda3, 0xdda5, 0xd2f1, 0xdda4, 0xdda6, 0xdda7, 0xd2a9, /*0x68-0x6f*/ + 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc759, 0xc75a, 0xbac9, /*0x70-0x77*/ + 0xdda9, 0xc75b, 0xc75c, 0xddb6, 0xddb1, 0xddb4, 0xc75d, 0xc75e, /*0x78-0x7f*/ + 0xc75f, 0xc760, 0xc761, 0xc762, 0xc763, 0xddb0, 0xc6ce, 0xc764, /*0x80-0x87*/ + 0xc765, 0xc0f2, 0xc766, 0xc767, 0xc768, 0xc769, 0xc9af, 0xc76a, /*0x88-0x8f*/ + 0xc76b, 0xc76c, 0xdcec, 0xddae, 0xc76d, 0xc76e, 0xc76f, 0xc770, /*0x90-0x97*/ + 0xddb7, 0xc771, 0xc772, 0xdcf0, 0xddaf, 0xc773, 0xddb8, 0xc774, /*0x98-0x9f*/ + 0xddac, 0xc775, 0xc776, 0xc777, 0xc778, 0xc779, 0xc77a, 0xc77b, /*0xa0-0xa7*/ + 0xddb9, 0xddb3, 0xddad, 0xc4aa, 0xc77c, 0xc77d, 0xc77e, 0xc780, /*0xa8-0xaf*/ + 0xdda8, 0xc0b3, 0xc1ab, 0xddaa, 0xddab, 0xc781, 0xddb2, 0xbbf1, /*0xb0-0xb7*/ + 0xddb5, 0xd3a8, 0xddba, 0xc782, 0xddbb, 0xc3a7, 0xc783, 0xc784, /*0xb8-0xbf*/ + 0xddd2, 0xddbc, 0xc785, 0xc786, 0xc787, 0xddd1, 0xc788, 0xb9bd, /*0xc0-0xc7*/ + 0xc789, 0xc78a, 0xbed5, 0xc78b, 0xbefa, 0xc78c, 0xc78d, 0xbaca, /*0xc8-0xcf*/ + 0xc78e, 0xc78f, 0xc790, 0xc791, 0xddca, 0xc792, 0xddc5, 0xc793, /*0xd0-0xd7*/ + 0xddbf, 0xc794, 0xc795, 0xc796, 0xb2cb, 0xddc3, 0xc797, 0xddcb, /*0xd8-0xdf*/ + 0xb2a4, 0xddd5, 0xc798, 0xc799, 0xc79a, 0xddbe, 0xc79b, 0xc79c, /*0xe0-0xe7*/ + 0xc79d, 0xc6d0, 0xddd0, 0xc79e, 0xc79f, 0xc7a0, 0xc840, 0xc841, /*0xe8-0xef*/ + 0xddd4, 0xc1e2, 0xb7c6, 0xc842, 0xc843, 0xc844, 0xc845, 0xc846, /*0xf0-0xf7*/ + 0xddce, 0xddcf, 0xc847, 0xc848, 0xc849, 0xddc4, 0xc84a, 0xc84b, /*0xf8-0xff*/ + /* 0x8400 */ + 0xc84c, 0xddbd, 0xc84d, 0xddcd, 0xccd1, 0xc84e, 0xddc9, 0xc84f, /*0x00-0x07*/ + 0xc850, 0xc851, 0xc852, 0xddc2, 0xc3c8, 0xc6bc, 0xceae, 0xddcc, /*0x08-0x0f*/ + 0xc853, 0xddc8, 0xc854, 0xc855, 0xc856, 0xc857, 0xc858, 0xc859, /*0x10-0x17*/ + 0xddc1, 0xc85a, 0xc85b, 0xc85c, 0xddc6, 0xc2dc, 0xc85d, 0xc85e, /*0x18-0x1f*/ + 0xc85f, 0xc860, 0xc861, 0xc862, 0xd3a9, 0xd3aa, 0xddd3, 0xcff4, /*0x20-0x27*/ + 0xc8f8, 0xc863, 0xc864, 0xc865, 0xc866, 0xc867, 0xc868, 0xc869, /*0x28-0x2f*/ + 0xc86a, 0xdde6, 0xc86b, 0xc86c, 0xc86d, 0xc86e, 0xc86f, 0xc870, /*0x30-0x37*/ + 0xddc7, 0xc871, 0xc872, 0xc873, 0xdde0, 0xc2e4, 0xc874, 0xc875, /*0x38-0x3f*/ + 0xc876, 0xc877, 0xc878, 0xc879, 0xc87a, 0xc87b, 0xdde1, 0xc87c, /*0x40-0x47*/ + 0xc87d, 0xc87e, 0xc880, 0xc881, 0xc882, 0xc883, 0xc884, 0xc885, /*0x48-0x4f*/ + 0xc886, 0xddd7, 0xc887, 0xc888, 0xc889, 0xc88a, 0xc88b, 0xd6f8, /*0x50-0x57*/ + 0xc88c, 0xddd9, 0xddd8, 0xb8f0, 0xddd6, 0xc88d, 0xc88e, 0xc88f, /*0x58-0x5f*/ + 0xc890, 0xc6cf, 0xc891, 0xb6ad, 0xc892, 0xc893, 0xc894, 0xc895, /*0x60-0x67*/ + 0xc896, 0xdde2, 0xc897, 0xbaf9, 0xd4e1, 0xdde7, 0xc898, 0xc899, /*0x68-0x6f*/ + 0xc89a, 0xb4d0, 0xc89b, 0xddda, 0xc89c, 0xbffb, 0xdde3, 0xc89d, /*0x70-0x77*/ + 0xdddf, 0xc89e, 0xdddd, 0xc89f, 0xc8a0, 0xc940, 0xc941, 0xc942, /*0x78-0x7f*/ + 0xc943, 0xc944, 0xb5d9, 0xc945, 0xc946, 0xc947, 0xc948, 0xdddb, /*0x80-0x87*/ + 0xdddc, 0xddde, 0xc949, 0xbdaf, 0xdde4, 0xc94a, 0xdde5, 0xc94b, /*0x88-0x8f*/ + 0xc94c, 0xc94d, 0xc94e, 0xc94f, 0xc950, 0xc951, 0xc952, 0xddf5, /*0x90-0x97*/ + 0xc953, 0xc3c9, 0xc954, 0xc955, 0xcbe2, 0xc956, 0xc957, 0xc958, /*0x98-0x9f*/ + 0xc959, 0xddf2, 0xc95a, 0xc95b, 0xc95c, 0xc95d, 0xc95e, 0xc95f, /*0xa0-0xa7*/ + 0xc960, 0xc961, 0xc962, 0xc963, 0xc964, 0xc965, 0xc966, 0xd8e1, /*0xa8-0xaf*/ + 0xc967, 0xc968, 0xc6d1, 0xc969, 0xddf4, 0xc96a, 0xc96b, 0xc96c, /*0xb0-0xb7*/ + 0xd5f4, 0xddf3, 0xddf0, 0xc96d, 0xc96e, 0xddec, 0xc96f, 0xddef, /*0xb8-0xbf*/ + 0xc970, 0xdde8, 0xc971, 0xc972, 0xd0ee, 0xc973, 0xc974, 0xc975, /*0xc0-0xc7*/ + 0xc976, 0xc8d8, 0xddee, 0xc977, 0xc978, 0xdde9, 0xc979, 0xc97a, /*0xc8-0xcf*/ + 0xddea, 0xcbf2, 0xc97b, 0xdded, 0xc97c, 0xc97d, 0xb1cd, 0xc97e, /*0xd0-0xd7*/ + 0xc980, 0xc981, 0xc982, 0xc983, 0xc984, 0xc0b6, 0xc985, 0xbcbb, /*0xd8-0xdf*/ + 0xddf1, 0xc986, 0xc987, 0xddf7, 0xc988, 0xddf6, 0xddeb, 0xc989, /*0xe0-0xe7*/ + 0xc98a, 0xc98b, 0xc98c, 0xc98d, 0xc5ee, 0xc98e, 0xc98f, 0xc990, /*0xe8-0xef*/ + 0xddfb, 0xc991, 0xc992, 0xc993, 0xc994, 0xc995, 0xc996, 0xc997, /*0xf0-0xf7*/ + 0xc998, 0xc999, 0xc99a, 0xc99b, 0xdea4, 0xc99c, 0xc99d, 0xdea3, /*0xf8-0xff*/ + /* 0x8500 */ + 0xc99e, 0xc99f, 0xc9a0, 0xca40, 0xca41, 0xca42, 0xca43, 0xca44, /*0x00-0x07*/ + 0xca45, 0xca46, 0xca47, 0xca48, 0xddf8, 0xca49, 0xca4a, 0xca4b, /*0x08-0x0f*/ + 0xca4c, 0xc3ef, 0xca4d, 0xc2fb, 0xca4e, 0xca4f, 0xca50, 0xd5e1, /*0x10-0x17*/ + 0xca51, 0xca52, 0xceb5, 0xca53, 0xca54, 0xca55, 0xca56, 0xddfd, /*0x18-0x1f*/ + 0xca57, 0xb2cc, 0xca58, 0xca59, 0xca5a, 0xca5b, 0xca5c, 0xca5d, /*0x20-0x27*/ + 0xca5e, 0xca5f, 0xca60, 0xc4e8, 0xcadf, 0xca61, 0xca62, 0xca63, /*0x28-0x2f*/ + 0xca64, 0xca65, 0xca66, 0xca67, 0xca68, 0xca69, 0xca6a, 0xc7be, /*0x30-0x37*/ + 0xddfa, 0xddfc, 0xddfe, 0xdea2, 0xb0aa, 0xb1ce, 0xca6b, 0xca6c, /*0x38-0x3f*/ + 0xca6d, 0xca6e, 0xca6f, 0xdeac, 0xca70, 0xca71, 0xca72, 0xca73, /*0x40-0x47*/ + 0xdea6, 0xbdb6, 0xc8ef, 0xca74, 0xca75, 0xca76, 0xca77, 0xca78, /*0x48-0x4f*/ + 0xca79, 0xca7a, 0xca7b, 0xca7c, 0xca7d, 0xca7e, 0xdea1, 0xca80, /*0x50-0x57*/ + 0xca81, 0xdea5, 0xca82, 0xca83, 0xca84, 0xca85, 0xdea9, 0xca86, /*0x58-0x5f*/ + 0xca87, 0xca88, 0xca89, 0xca8a, 0xdea8, 0xca8b, 0xca8c, 0xca8d, /*0x60-0x67*/ + 0xdea7, 0xca8e, 0xca8f, 0xca90, 0xca91, 0xca92, 0xca93, 0xca94, /*0x68-0x6f*/ + 0xca95, 0xca96, 0xdead, 0xca97, 0xd4cc, 0xca98, 0xca99, 0xca9a, /*0x70-0x77*/ + 0xca9b, 0xdeb3, 0xdeaa, 0xdeae, 0xca9c, 0xca9d, 0xc0d9, 0xca9e, /*0x78-0x7f*/ + 0xca9f, 0xcaa0, 0xcb40, 0xcb41, 0xb1a1, 0xdeb6, 0xcb42, 0xdeb1, /*0x80-0x87*/ + 0xcb43, 0xcb44, 0xcb45, 0xcb46, 0xcb47, 0xcb48, 0xcb49, 0xdeb2, /*0x88-0x8f*/ + 0xcb4a, 0xcb4b, 0xcb4c, 0xcb4d, 0xcb4e, 0xcb4f, 0xcb50, 0xcb51, /*0x90-0x97*/ + 0xcb52, 0xcb53, 0xcb54, 0xd1a6, 0xdeb5, 0xcb55, 0xcb56, 0xcb57, /*0x98-0x9f*/ + 0xcb58, 0xcb59, 0xcb5a, 0xcb5b, 0xdeaf, 0xcb5c, 0xcb5d, 0xcb5e, /*0xa0-0xa7*/ + 0xdeb0, 0xcb5f, 0xd0bd, 0xcb60, 0xcb61, 0xcb62, 0xdeb4, 0xcaed, /*0xa8-0xaf*/ + 0xdeb9, 0xcb63, 0xcb64, 0xcb65, 0xcb66, 0xcb67, 0xcb68, 0xdeb8, /*0xb0-0xb7*/ + 0xcb69, 0xdeb7, 0xcb6a, 0xcb6b, 0xcb6c, 0xcb6d, 0xcb6e, 0xcb6f, /*0xb8-0xbf*/ + 0xcb70, 0xdebb, 0xcb71, 0xcb72, 0xcb73, 0xcb74, 0xcb75, 0xcb76, /*0xc0-0xc7*/ + 0xcb77, 0xbde5, 0xcb78, 0xcb79, 0xcb7a, 0xcb7b, 0xcb7c, 0xb2d8, /*0xc8-0xcf*/ + 0xc3ea, 0xcb7d, 0xcb7e, 0xdeba, 0xcb80, 0xc5ba, 0xcb81, 0xcb82, /*0xd0-0xd7*/ + 0xcb83, 0xcb84, 0xcb85, 0xcb86, 0xdebc, 0xcb87, 0xcb88, 0xcb89, /*0xd8-0xdf*/ + 0xcb8a, 0xcb8b, 0xcb8c, 0xcb8d, 0xccd9, 0xcb8e, 0xcb8f, 0xcb90, /*0xe0-0xe7*/ + 0xcb91, 0xb7aa, 0xcb92, 0xcb93, 0xcb94, 0xcb95, 0xcb96, 0xcb97, /*0xe8-0xef*/ + 0xcb98, 0xcb99, 0xcb9a, 0xcb9b, 0xcb9c, 0xcb9d, 0xcb9e, 0xcb9f, /*0xf0-0xf7*/ + 0xcba0, 0xcc40, 0xcc41, 0xd4e5, 0xcc42, 0xcc43, 0xcc44, 0xdebd, /*0xf8-0xff*/ + /* 0x8600 */ + 0xcc45, 0xcc46, 0xcc47, 0xcc48, 0xcc49, 0xdebf, 0xcc4a, 0xcc4b, /*0x00-0x07*/ + 0xcc4c, 0xcc4d, 0xcc4e, 0xcc4f, 0xcc50, 0xcc51, 0xcc52, 0xcc53, /*0x08-0x0f*/ + 0xcc54, 0xc4a2, 0xcc55, 0xcc56, 0xcc57, 0xcc58, 0xdec1, 0xcc59, /*0x10-0x17*/ + 0xcc5a, 0xcc5b, 0xcc5c, 0xcc5d, 0xcc5e, 0xcc5f, 0xcc60, 0xcc61, /*0x18-0x1f*/ + 0xcc62, 0xcc63, 0xcc64, 0xcc65, 0xcc66, 0xcc67, 0xcc68, 0xdebe, /*0x20-0x27*/ + 0xcc69, 0xdec0, 0xcc6a, 0xcc6b, 0xcc6c, 0xcc6d, 0xcc6e, 0xcc6f, /*0x28-0x2f*/ + 0xcc70, 0xcc71, 0xcc72, 0xcc73, 0xcc74, 0xcc75, 0xcc76, 0xcc77, /*0x30-0x37*/ + 0xd5ba, 0xcc78, 0xcc79, 0xcc7a, 0xdec2, 0xcc7b, 0xcc7c, 0xcc7d, /*0x38-0x3f*/ + 0xcc7e, 0xcc80, 0xcc81, 0xcc82, 0xcc83, 0xcc84, 0xcc85, 0xcc86, /*0x40-0x47*/ + 0xcc87, 0xcc88, 0xcc89, 0xcc8a, 0xcc8b, 0xf2ae, 0xbba2, 0xc2b2, /*0x48-0x4f*/ + 0xc5b0, 0xc2c7, 0xcc8c, 0xcc8d, 0xf2af, 0xcc8e, 0xcc8f, 0xcc90, /*0x50-0x57*/ + 0xcc91, 0xcc92, 0xd0e9, 0xcc93, 0xcc94, 0xcc95, 0xd3dd, 0xcc96, /*0x58-0x5f*/ + 0xcc97, 0xcc98, 0xebbd, 0xcc99, 0xcc9a, 0xcc9b, 0xcc9c, 0xcc9d, /*0x60-0x67*/ + 0xcc9e, 0xcc9f, 0xcca0, 0xb3e6, 0xf2b0, 0xcd40, 0xf2b1, 0xcd41, /*0x68-0x6f*/ + 0xcd42, 0xcaad, 0xcd43, 0xcd44, 0xcd45, 0xcd46, 0xcd47, 0xcd48, /*0x70-0x77*/ + 0xcd49, 0xbae7, 0xf2b3, 0xf2b5, 0xf2b4, 0xcbe4, 0xcfba, 0xf2b2, /*0x78-0x7f*/ + 0xcab4, 0xd2cf, 0xc2ec, 0xcd4a, 0xcd4b, 0xcd4c, 0xcd4d, 0xcd4e, /*0x80-0x87*/ + 0xcd4f, 0xcd50, 0xcec3, 0xf2b8, 0xb0f6, 0xf2b7, 0xcd51, 0xcd52, /*0x88-0x8f*/ + 0xcd53, 0xcd54, 0xcd55, 0xf2be, 0xcd56, 0xb2cf, 0xcd57, 0xcd58, /*0x90-0x97*/ + 0xcd59, 0xcd5a, 0xcd5b, 0xcd5c, 0xd1c1, 0xf2ba, 0xcd5d, 0xcd5e, /*0x98-0x9f*/ + 0xcd5f, 0xcd60, 0xcd61, 0xf2bc, 0xd4e9, 0xcd62, 0xcd63, 0xf2bb, /*0xa0-0xa7*/ + 0xf2b6, 0xf2bf, 0xf2bd, 0xcd64, 0xf2b9, 0xcd65, 0xcd66, 0xf2c7, /*0xa8-0xaf*/ + 0xf2c4, 0xf2c6, 0xcd67, 0xcd68, 0xf2ca, 0xf2c2, 0xf2c0, 0xcd69, /*0xb0-0xb7*/ + 0xcd6a, 0xcd6b, 0xf2c5, 0xcd6c, 0xcd6d, 0xcd6e, 0xcd6f, 0xcd70, /*0xb8-0xbf*/ + 0xd6fb, 0xcd71, 0xcd72, 0xcd73, 0xf2c1, 0xcd74, 0xc7f9, 0xc9df, /*0xc0-0xc7*/ + 0xcd75, 0xf2c8, 0xb9c6, 0xb5b0, 0xcd76, 0xcd77, 0xf2c3, 0xf2c9, /*0xc8-0xcf*/ + 0xf2d0, 0xf2d6, 0xcd78, 0xcd79, 0xbbd7, 0xcd7a, 0xcd7b, 0xcd7c, /*0xd0-0xd7*/ + 0xf2d5, 0xcddc, 0xcd7d, 0xd6eb, 0xcd7e, 0xcd80, 0xf2d2, 0xf2d4, /*0xd8-0xdf*/ + 0xcd81, 0xcd82, 0xcd83, 0xcd84, 0xb8f2, 0xcd85, 0xcd86, 0xcd87, /*0xe0-0xe7*/ + 0xcd88, 0xf2cb, 0xcd89, 0xcd8a, 0xcd8b, 0xf2ce, 0xc2f9, 0xcd8c, /*0xe8-0xef*/ + 0xd5dd, 0xf2cc, 0xf2cd, 0xf2cf, 0xf2d3, 0xcd8d, 0xcd8e, 0xcd8f, /*0xf0-0xf7*/ + 0xf2d9, 0xd3bc, 0xcd90, 0xcd91, 0xcd92, 0xcd93, 0xb6ea, 0xcd94, /*0xf8-0xff*/ + /* 0x8700 */ + 0xcaf1, 0xcd95, 0xb7e4, 0xf2d7, 0xcd96, 0xcd97, 0xcd98, 0xf2d8, /*0x00-0x07*/ + 0xf2da, 0xf2dd, 0xf2db, 0xcd99, 0xcd9a, 0xf2dc, 0xcd9b, 0xcd9c, /*0x08-0x0f*/ + 0xcd9d, 0xcd9e, 0xd1d1, 0xf2d1, 0xcd9f, 0xcdc9, 0xcda0, 0xcecf, /*0x10-0x17*/ + 0xd6a9, 0xce40, 0xf2e3, 0xce41, 0xc3db, 0xce42, 0xf2e0, 0xce43, /*0x18-0x1f*/ + 0xce44, 0xc0af, 0xf2ec, 0xf2de, 0xce45, 0xf2e1, 0xce46, 0xce47, /*0x20-0x27*/ + 0xce48, 0xf2e8, 0xce49, 0xce4a, 0xce4b, 0xce4c, 0xf2e2, 0xce4d, /*0x28-0x2f*/ + 0xce4e, 0xf2e7, 0xce4f, 0xce50, 0xf2e6, 0xce51, 0xce52, 0xf2e9, /*0x30-0x37*/ + 0xce53, 0xce54, 0xce55, 0xf2df, 0xce56, 0xce57, 0xf2e4, 0xf2ea, /*0x38-0x3f*/ + 0xce58, 0xce59, 0xce5a, 0xce5b, 0xce5c, 0xce5d, 0xce5e, 0xd3ac, /*0x40-0x47*/ + 0xf2e5, 0xb2f5, 0xce5f, 0xce60, 0xf2f2, 0xce61, 0xd0ab, 0xce62, /*0x48-0x4f*/ + 0xce63, 0xce64, 0xce65, 0xf2f5, 0xce66, 0xce67, 0xce68, 0xbbc8, /*0x50-0x57*/ + 0xce69, 0xf2f9, 0xce6a, 0xce6b, 0xce6c, 0xce6d, 0xce6e, 0xce6f, /*0x58-0x5f*/ + 0xf2f0, 0xce70, 0xce71, 0xf2f6, 0xf2f8, 0xf2fa, 0xce72, 0xce73, /*0x60-0x67*/ + 0xce74, 0xce75, 0xce76, 0xce77, 0xce78, 0xce79, 0xf2f3, 0xce7a, /*0x68-0x6f*/ + 0xf2f1, 0xce7b, 0xce7c, 0xce7d, 0xbafb, 0xce7e, 0xb5fb, 0xce80, /*0x70-0x77*/ + 0xce81, 0xce82, 0xce83, 0xf2ef, 0xf2f7, 0xf2ed, 0xf2ee, 0xce84, /*0x78-0x7f*/ + 0xce85, 0xce86, 0xf2eb, 0xf3a6, 0xce87, 0xf3a3, 0xce88, 0xce89, /*0x80-0x87*/ + 0xf3a2, 0xce8a, 0xce8b, 0xf2f4, 0xce8c, 0xc8da, 0xce8d, 0xce8e, /*0x88-0x8f*/ + 0xce8f, 0xce90, 0xce91, 0xf2fb, 0xce92, 0xce93, 0xce94, 0xf3a5, /*0x90-0x97*/ + 0xce95, 0xce96, 0xce97, 0xce98, 0xce99, 0xce9a, 0xce9b, 0xc3f8, /*0x98-0x9f*/ + 0xce9c, 0xce9d, 0xce9e, 0xce9f, 0xcea0, 0xcf40, 0xcf41, 0xcf42, /*0xa0-0xa7*/ + 0xf2fd, 0xcf43, 0xcf44, 0xf3a7, 0xf3a9, 0xf3a4, 0xcf45, 0xf2fc, /*0xa8-0xaf*/ + 0xcf46, 0xcf47, 0xcf48, 0xf3ab, 0xcf49, 0xf3aa, 0xcf4a, 0xcf4b, /*0xb0-0xb7*/ + 0xcf4c, 0xcf4d, 0xc2dd, 0xcf4e, 0xcf4f, 0xf3ae, 0xcf50, 0xcf51, /*0xb8-0xbf*/ + 0xf3b0, 0xcf52, 0xcf53, 0xcf54, 0xcf55, 0xcf56, 0xf3a1, 0xcf57, /*0xc0-0xc7*/ + 0xcf58, 0xcf59, 0xf3b1, 0xf3ac, 0xcf5a, 0xcf5b, 0xcf5c, 0xcf5d, /*0xc8-0xcf*/ + 0xcf5e, 0xf3af, 0xf2fe, 0xf3ad, 0xcf5f, 0xcf60, 0xcf61, 0xcf62, /*0xd0-0xd7*/ + 0xcf63, 0xcf64, 0xcf65, 0xf3b2, 0xcf66, 0xcf67, 0xcf68, 0xcf69, /*0xd8-0xdf*/ + 0xf3b4, 0xcf6a, 0xcf6b, 0xcf6c, 0xcf6d, 0xf3a8, 0xcf6e, 0xcf6f, /*0xe0-0xe7*/ + 0xcf70, 0xcf71, 0xf3b3, 0xcf72, 0xcf73, 0xcf74, 0xf3b5, 0xcf75, /*0xe8-0xef*/ + 0xcf76, 0xcf77, 0xcf78, 0xcf79, 0xcf7a, 0xcf7b, 0xcf7c, 0xcf7d, /*0xf0-0xf7*/ + 0xcf7e, 0xd0b7, 0xcf80, 0xcf81, 0xcf82, 0xcf83, 0xf3b8, 0xcf84, /*0xf8-0xff*/ + /* 0x8800 */ + 0xcf85, 0xcf86, 0xcf87, 0xd9f9, 0xcf88, 0xcf89, 0xcf8a, 0xcf8b, /*0x00-0x07*/ + 0xcf8c, 0xcf8d, 0xf3b9, 0xcf8e, 0xcf8f, 0xcf90, 0xcf91, 0xcf92, /*0x08-0x0f*/ + 0xcf93, 0xcf94, 0xcf95, 0xf3b7, 0xcf96, 0xc8e4, 0xf3b6, 0xcf97, /*0x10-0x17*/ + 0xcf98, 0xcf99, 0xcf9a, 0xf3ba, 0xcf9b, 0xcf9c, 0xcf9d, 0xcf9e, /*0x18-0x1f*/ + 0xcf9f, 0xf3bb, 0xb4c0, 0xcfa0, 0xd040, 0xd041, 0xd042, 0xd043, /*0x20-0x27*/ + 0xd044, 0xd045, 0xd046, 0xd047, 0xd048, 0xd049, 0xd04a, 0xd04b, /*0x28-0x2f*/ + 0xd04c, 0xd04d, 0xeec3, 0xd04e, 0xd04f, 0xd050, 0xd051, 0xd052, /*0x30-0x37*/ + 0xd053, 0xf3bc, 0xd054, 0xd055, 0xf3bd, 0xd056, 0xd057, 0xd058, /*0x38-0x3f*/ + 0xd1aa, 0xd059, 0xd05a, 0xd05b, 0xf4ac, 0xd0c6, 0xd05c, 0xd05d, /*0x40-0x47*/ + 0xd05e, 0xd05f, 0xd060, 0xd061, 0xd0d0, 0xd1dc, 0xd062, 0xd063, /*0x48-0x4f*/ + 0xd064, 0xd065, 0xd066, 0xd067, 0xcfce, 0xd068, 0xd069, 0xbdd6, /*0x50-0x57*/ + 0xd06a, 0xd1c3, 0xd06b, 0xd06c, 0xd06d, 0xd06e, 0xd06f, 0xd070, /*0x58-0x5f*/ + 0xd071, 0xbae2, 0xe1e9, 0xd2c2, 0xf1c2, 0xb2b9, 0xd072, 0xd073, /*0x60-0x67*/ + 0xb1ed, 0xf1c3, 0xd074, 0xc9c0, 0xb3c4, 0xd075, 0xd9f2, 0xd076, /*0x68-0x6f*/ + 0xcba5, 0xd077, 0xf1c4, 0xd078, 0xd079, 0xd07a, 0xd07b, 0xd6d4, /*0x70-0x77*/ + 0xd07c, 0xd07d, 0xd07e, 0xd080, 0xd081, 0xf1c5, 0xf4c0, 0xf1c6, /*0x78-0x7f*/ + 0xd082, 0xd4ac, 0xf1c7, 0xd083, 0xb0c0, 0xf4c1, 0xd084, 0xd085, /*0x80-0x87*/ + 0xf4c2, 0xd086, 0xd087, 0xb4fc, 0xd088, 0xc5db, 0xd089, 0xd08a, /*0x88-0x8f*/ + 0xd08b, 0xd08c, 0xccbb, 0xd08d, 0xd08e, 0xd08f, 0xd0e4, 0xd090, /*0x90-0x97*/ + 0xd091, 0xd092, 0xd093, 0xd094, 0xcde0, 0xd095, 0xd096, 0xd097, /*0x98-0x9f*/ + 0xd098, 0xd099, 0xf1c8, 0xd09a, 0xd9f3, 0xd09b, 0xd09c, 0xd09d, /*0xa0-0xa7*/ + 0xd09e, 0xd09f, 0xd0a0, 0xb1bb, 0xd140, 0xcfae, 0xd141, 0xd142, /*0xa8-0xaf*/ + 0xd143, 0xb8a4, 0xd144, 0xd145, 0xd146, 0xd147, 0xd148, 0xf1ca, /*0xb0-0xb7*/ + 0xd149, 0xd14a, 0xd14b, 0xd14c, 0xf1cb, 0xd14d, 0xd14e, 0xd14f, /*0xb8-0xbf*/ + 0xd150, 0xb2c3, 0xc1d1, 0xd151, 0xd152, 0xd7b0, 0xf1c9, 0xd153, /*0xc0-0xc7*/ + 0xd154, 0xf1cc, 0xd155, 0xd156, 0xd157, 0xd158, 0xf1ce, 0xd159, /*0xc8-0xcf*/ + 0xd15a, 0xd15b, 0xd9f6, 0xd15c, 0xd2e1, 0xd4a3, 0xd15d, 0xd15e, /*0xd0-0xd7*/ + 0xf4c3, 0xc8b9, 0xd15f, 0xd160, 0xd161, 0xd162, 0xd163, 0xf4c4, /*0xd8-0xdf*/ + 0xd164, 0xd165, 0xf1cd, 0xf1cf, 0xbfe3, 0xf1d0, 0xd166, 0xd167, /*0xe0-0xe7*/ + 0xf1d4, 0xd168, 0xd169, 0xd16a, 0xd16b, 0xd16c, 0xd16d, 0xd16e, /*0xe8-0xef*/ + 0xf1d6, 0xf1d1, 0xd16f, 0xc9d1, 0xc5e1, 0xd170, 0xd171, 0xd172, /*0xf0-0xf7*/ + 0xc2e3, 0xb9fc, 0xd173, 0xd174, 0xf1d3, 0xd175, 0xf1d5, 0xd176, /*0xf8-0xff*/ + /* 0x8900 */ + 0xd177, 0xd178, 0xb9d3, 0xd179, 0xd17a, 0xd17b, 0xd17c, 0xd17d, /*0x00-0x07*/ + 0xd17e, 0xd180, 0xf1db, 0xd181, 0xd182, 0xd183, 0xd184, 0xd185, /*0x08-0x0f*/ + 0xbad6, 0xd186, 0xb0fd, 0xf1d9, 0xd187, 0xd188, 0xd189, 0xd18a, /*0x10-0x17*/ + 0xd18b, 0xf1d8, 0xf1d2, 0xf1da, 0xd18c, 0xd18d, 0xd18e, 0xd18f, /*0x18-0x1f*/ + 0xd190, 0xf1d7, 0xd191, 0xd192, 0xd193, 0xc8ec, 0xd194, 0xd195, /*0x20-0x27*/ + 0xd196, 0xd197, 0xcdca, 0xf1dd, 0xd198, 0xd199, 0xd19a, 0xd19b, /*0x28-0x2f*/ + 0xe5bd, 0xd19c, 0xd19d, 0xd19e, 0xf1dc, 0xd19f, 0xf1de, 0xd1a0, /*0x30-0x37*/ + 0xd240, 0xd241, 0xd242, 0xd243, 0xd244, 0xd245, 0xd246, 0xd247, /*0x38-0x3f*/ + 0xd248, 0xf1df, 0xd249, 0xd24a, 0xcfe5, 0xd24b, 0xd24c, 0xd24d, /*0x40-0x47*/ + 0xd24e, 0xd24f, 0xd250, 0xd251, 0xd252, 0xd253, 0xd254, 0xd255, /*0x48-0x4f*/ + 0xd256, 0xd257, 0xd258, 0xd259, 0xd25a, 0xd25b, 0xd25c, 0xd25d, /*0x50-0x57*/ + 0xd25e, 0xd25f, 0xd260, 0xd261, 0xd262, 0xd263, 0xf4c5, 0xbdf3, /*0x58-0x5f*/ + 0xd264, 0xd265, 0xd266, 0xd267, 0xd268, 0xd269, 0xf1e0, 0xd26a, /*0x60-0x67*/ + 0xd26b, 0xd26c, 0xd26d, 0xd26e, 0xd26f, 0xd270, 0xd271, 0xd272, /*0x68-0x6f*/ + 0xd273, 0xd274, 0xd275, 0xd276, 0xd277, 0xd278, 0xd279, 0xd27a, /*0x70-0x77*/ + 0xd27b, 0xd27c, 0xd27d, 0xf1e1, 0xd27e, 0xd280, 0xd281, 0xcef7, /*0x78-0x7f*/ + 0xd282, 0xd2aa, 0xd283, 0xf1fb, 0xd284, 0xd285, 0xb8b2, 0xd286, /*0x80-0x87*/ + 0xd287, 0xd288, 0xd289, 0xd28a, 0xd28b, 0xd28c, 0xd28d, 0xd28e, /*0x88-0x8f*/ + 0xd28f, 0xd290, 0xd291, 0xd292, 0xd293, 0xd294, 0xd295, 0xd296, /*0x90-0x97*/ + 0xd297, 0xd298, 0xd299, 0xd29a, 0xd29b, 0xd29c, 0xd29d, 0xd29e, /*0x98-0x9f*/ + 0xd29f, 0xd2a0, 0xd340, 0xd341, 0xd342, 0xd343, 0xd344, 0xd345, /*0xa0-0xa7*/ + 0xd346, 0xd347, 0xd348, 0xd349, 0xd34a, 0xd34b, 0xd34c, 0xd34d, /*0xa8-0xaf*/ + 0xd34e, 0xd34f, 0xd350, 0xd351, 0xd352, 0xd353, 0xd354, 0xd355, /*0xb0-0xb7*/ + 0xd356, 0xd357, 0xd358, 0xd359, 0xd35a, 0xd35b, 0xd35c, 0xd35d, /*0xb8-0xbf*/ + 0xd35e, 0xbcfb, 0xb9db, 0xd35f, 0xb9e6, 0xc3d9, 0xcad3, 0xeae8, /*0xc0-0xc7*/ + 0xc0c0, 0xbef5, 0xeae9, 0xeaea, 0xeaeb, 0xd360, 0xeaec, 0xeaed, /*0xc8-0xcf*/ + 0xeaee, 0xeaef, 0xbdc7, 0xd361, 0xd362, 0xd363, 0xf5fb, 0xd364, /*0xd0-0xd7*/ + 0xd365, 0xd366, 0xf5fd, 0xd367, 0xf5fe, 0xd368, 0xf5fc, 0xd369, /*0xd8-0xdf*/ + 0xd36a, 0xd36b, 0xd36c, 0xbde2, 0xd36d, 0xf6a1, 0xb4a5, 0xd36e, /*0xe0-0xe7*/ + 0xd36f, 0xd370, 0xd371, 0xf6a2, 0xd372, 0xd373, 0xd374, 0xf6a3, /*0xe8-0xef*/ + 0xd375, 0xd376, 0xd377, 0xecb2, 0xd378, 0xd379, 0xd37a, 0xd37b, /*0xf0-0xf7*/ + 0xd37c, 0xd37d, 0xd37e, 0xd380, 0xd381, 0xd382, 0xd383, 0xd384, /*0xf8-0xff*/ + /* 0x8a00 */ + 0xd1d4, 0xd385, 0xd386, 0xd387, 0xd388, 0xd389, 0xd38a, 0xd9ea, /*0x00-0x07*/ + 0xd38b, 0xd38c, 0xd38d, 0xd38e, 0xd38f, 0xd390, 0xd391, 0xd392, /*0x08-0x0f*/ + 0xd393, 0xd394, 0xd395, 0xd396, 0xd397, 0xd398, 0xd399, 0xd39a, /*0x10-0x17*/ + 0xd39b, 0xd39c, 0xd39d, 0xd39e, 0xd39f, 0xd3a0, 0xd440, 0xd441, /*0x18-0x1f*/ + 0xd442, 0xd443, 0xd444, 0xd445, 0xd446, 0xd447, 0xd448, 0xd449, /*0x20-0x27*/ + 0xd44a, 0xd44b, 0xd44c, 0xd44d, 0xd44e, 0xd44f, 0xd450, 0xd451, /*0x28-0x2f*/ + 0xd452, 0xd453, 0xd454, 0xd455, 0xd456, 0xd457, 0xd458, 0xd459, /*0x30-0x37*/ + 0xd45a, 0xd45b, 0xd45c, 0xd45d, 0xd45e, 0xd45f, 0xf6a4, 0xd460, /*0x38-0x3f*/ + 0xd461, 0xd462, 0xd463, 0xd464, 0xd465, 0xd466, 0xd467, 0xd468, /*0x40-0x47*/ + 0xeeba, 0xd469, 0xd46a, 0xd46b, 0xd46c, 0xd46d, 0xd46e, 0xd46f, /*0x48-0x4f*/ + 0xd470, 0xd471, 0xd472, 0xd473, 0xd474, 0xd475, 0xd476, 0xd477, /*0x50-0x57*/ + 0xd478, 0xd479, 0xd47a, 0xd47b, 0xd47c, 0xd47d, 0xd47e, 0xd480, /*0x58-0x5f*/ + 0xd481, 0xd482, 0xd483, 0xd484, 0xd485, 0xd486, 0xd487, 0xd488, /*0x60-0x67*/ + 0xd489, 0xd48a, 0xd48b, 0xd48c, 0xd48d, 0xd48e, 0xd48f, 0xd490, /*0x68-0x6f*/ + 0xd491, 0xd492, 0xd493, 0xd494, 0xd495, 0xd496, 0xd497, 0xd498, /*0x70-0x77*/ + 0xd499, 0xd5b2, 0xd49a, 0xd49b, 0xd49c, 0xd49d, 0xd49e, 0xd49f, /*0x78-0x7f*/ + 0xd4a0, 0xd540, 0xd541, 0xd542, 0xd543, 0xd544, 0xd545, 0xd546, /*0x80-0x87*/ + 0xd547, 0xd3fe, 0xccdc, 0xd548, 0xd549, 0xd54a, 0xd54b, 0xd54c, /*0x88-0x8f*/ + 0xd54d, 0xd54e, 0xd54f, 0xcac4, 0xd550, 0xd551, 0xd552, 0xd553, /*0x90-0x97*/ + 0xd554, 0xd555, 0xd556, 0xd557, 0xd558, 0xd559, 0xd55a, 0xd55b, /*0x98-0x9f*/ + 0xd55c, 0xd55d, 0xd55e, 0xd55f, 0xd560, 0xd561, 0xd562, 0xd563, /*0xa0-0xa7*/ + 0xd564, 0xd565, 0xd566, 0xd567, 0xd568, 0xd569, 0xd56a, 0xd56b, /*0xa8-0xaf*/ + 0xd56c, 0xd56d, 0xd56e, 0xd56f, 0xd570, 0xd571, 0xd572, 0xd573, /*0xb0-0xb7*/ + 0xd574, 0xd575, 0xd576, 0xd577, 0xd578, 0xd579, 0xd57a, 0xd57b, /*0xb8-0xbf*/ + 0xd57c, 0xd57d, 0xd57e, 0xd580, 0xd581, 0xd582, 0xd583, 0xd584, /*0xc0-0xc7*/ + 0xd585, 0xd586, 0xd587, 0xd588, 0xd589, 0xd58a, 0xd58b, 0xd58c, /*0xc8-0xcf*/ + 0xd58d, 0xd58e, 0xd58f, 0xd590, 0xd591, 0xd592, 0xd593, 0xd594, /*0xd0-0xd7*/ + 0xd595, 0xd596, 0xd597, 0xd598, 0xd599, 0xd59a, 0xd59b, 0xd59c, /*0xd8-0xdf*/ + 0xd59d, 0xd59e, 0xd59f, 0xd5a0, 0xd640, 0xd641, 0xd642, 0xd643, /*0xe0-0xe7*/ + 0xd644, 0xd645, 0xd646, 0xd647, 0xd648, 0xd649, 0xd64a, 0xd64b, /*0xe8-0xef*/ + 0xd64c, 0xd64d, 0xd64e, 0xd64f, 0xd650, 0xd651, 0xd652, 0xd653, /*0xf0-0xf7*/ + 0xd654, 0xd655, 0xd656, 0xd657, 0xd658, 0xd659, 0xd65a, 0xd65b, /*0xf8-0xff*/ + /* 0x8b00 */ + 0xd65c, 0xd65d, 0xd65e, 0xd65f, 0xd660, 0xd661, 0xd662, 0xe5c0, /*0x00-0x07*/ + 0xd663, 0xd664, 0xd665, 0xd666, 0xd667, 0xd668, 0xd669, 0xd66a, /*0x08-0x0f*/ + 0xd66b, 0xd66c, 0xd66d, 0xd66e, 0xd66f, 0xd670, 0xd671, 0xd672, /*0x10-0x17*/ + 0xd673, 0xd674, 0xd675, 0xd676, 0xd677, 0xd678, 0xd679, 0xd67a, /*0x18-0x1f*/ + 0xd67b, 0xd67c, 0xd67d, 0xd67e, 0xd680, 0xd681, 0xf6a5, 0xd682, /*0x20-0x27*/ + 0xd683, 0xd684, 0xd685, 0xd686, 0xd687, 0xd688, 0xd689, 0xd68a, /*0x28-0x2f*/ + 0xd68b, 0xd68c, 0xd68d, 0xd68e, 0xd68f, 0xd690, 0xd691, 0xd692, /*0x30-0x37*/ + 0xd693, 0xd694, 0xd695, 0xd696, 0xd697, 0xd698, 0xd699, 0xd69a, /*0x38-0x3f*/ + 0xd69b, 0xd69c, 0xd69d, 0xd69e, 0xd69f, 0xd6a0, 0xd740, 0xd741, /*0x40-0x47*/ + 0xd742, 0xd743, 0xd744, 0xd745, 0xd746, 0xd747, 0xd748, 0xd749, /*0x48-0x4f*/ + 0xd74a, 0xd74b, 0xd74c, 0xd74d, 0xd74e, 0xd74f, 0xd750, 0xd751, /*0x50-0x57*/ + 0xd752, 0xd753, 0xd754, 0xd755, 0xd756, 0xd757, 0xd758, 0xd759, /*0x58-0x5f*/ + 0xd75a, 0xd75b, 0xd75c, 0xd75d, 0xd75e, 0xd75f, 0xbeaf, 0xd760, /*0x60-0x67*/ + 0xd761, 0xd762, 0xd763, 0xd764, 0xc6a9, 0xd765, 0xd766, 0xd767, /*0x68-0x6f*/ + 0xd768, 0xd769, 0xd76a, 0xd76b, 0xd76c, 0xd76d, 0xd76e, 0xd76f, /*0x70-0x77*/ + 0xd770, 0xd771, 0xd772, 0xd773, 0xd774, 0xd775, 0xd776, 0xd777, /*0x78-0x7f*/ + 0xd778, 0xd779, 0xd77a, 0xd77b, 0xd77c, 0xd77d, 0xd77e, 0xd780, /*0x80-0x87*/ + 0xd781, 0xd782, 0xd783, 0xd784, 0xd785, 0xd786, 0xd787, 0xd788, /*0x88-0x8f*/ + 0xd789, 0xd78a, 0xd78b, 0xd78c, 0xd78d, 0xd78e, 0xd78f, 0xd790, /*0x90-0x97*/ + 0xd791, 0xd792, 0xd793, 0xd794, 0xd795, 0xd796, 0xd797, 0xd798, /*0x98-0x9f*/ + 0xdaa5, 0xbcc6, 0xb6a9, 0xb8bc, 0xc8cf, 0xbca5, 0xdaa6, 0xdaa7, /*0xa0-0xa7*/ + 0xccd6, 0xc8c3, 0xdaa8, 0xc6fd, 0xd799, 0xd1b5, 0xd2e9, 0xd1b6, /*0xa8-0xaf*/ + 0xbcc7, 0xd79a, 0xbdb2, 0xbbe4, 0xdaa9, 0xdaaa, 0xd1c8, 0xdaab, /*0xb0-0xb7*/ + 0xd0ed, 0xb6ef, 0xc2db, 0xd79b, 0xcbcf, 0xb7ed, 0xc9e8, 0xb7c3, /*0xb8-0xbf*/ + 0xbef7, 0xd6a4, 0xdaac, 0xdaad, 0xc6c0, 0xd7e7, 0xcab6, 0xd79c, /*0xc0-0xc7*/ + 0xd5a9, 0xcbdf, 0xd5ef, 0xdaae, 0xd6df, 0xb4ca, 0xdab0, 0xdaaf, /*0xc8-0xcf*/ + 0xd79d, 0xd2eb, 0xdab1, 0xdab2, 0xdab3, 0xcad4, 0xdab4, 0xcaab, /*0xd0-0xd7*/ + 0xdab5, 0xdab6, 0xb3cf, 0xd6ef, 0xdab7, 0xbbb0, 0xb5ae, 0xdab8, /*0xd8-0xdf*/ + 0xdab9, 0xb9ee, 0xd1af, 0xd2e8, 0xdaba, 0xb8c3, 0xcfea, 0xb2ef, /*0xe0-0xe7*/ + 0xdabb, 0xdabc, 0xd79e, 0xbdeb, 0xcedc, 0xd3ef, 0xdabd, 0xcef3, /*0xe8-0xef*/ + 0xdabe, 0xd3d5, 0xbbe5, 0xdabf, 0xcbb5, 0xcbd0, 0xdac0, 0xc7eb, /*0xf0-0xf7*/ + 0xd6ee, 0xdac1, 0xc5b5, 0xb6c1, 0xdac2, 0xb7cc, 0xbfce, 0xdac3, /*0xf8-0xff*/ + /* 0x8c00 */ + 0xdac4, 0xcbad, 0xdac5, 0xb5f7, 0xdac6, 0xc1c2, 0xd7bb, 0xdac7, /*0x00-0x07*/ + 0xccb8, 0xd79f, 0xd2ea, 0xc4b1, 0xdac8, 0xb5fd, 0xbbd1, 0xdac9, /*0x08-0x0f*/ + 0xd0b3, 0xdaca, 0xdacb, 0xcebd, 0xdacc, 0xdacd, 0xdace, 0xb2f7, /*0x10-0x17*/ + 0xdad1, 0xdacf, 0xd1e8, 0xdad0, 0xc3d5, 0xdad2, 0xd7a0, 0xdad3, /*0x18-0x1f*/ + 0xdad4, 0xdad5, 0xd0bb, 0xd2a5, 0xb0f9, 0xdad6, 0xc7ab, 0xdad7, /*0x20-0x27*/ + 0xbdf7, 0xc3a1, 0xdad8, 0xdad9, 0xc3fd, 0xccb7, 0xdada, 0xdadb, /*0x28-0x2f*/ + 0xc0be, 0xc6d7, 0xdadc, 0xdadd, 0xc7b4, 0xdade, 0xdadf, 0xb9c8, /*0x30-0x37*/ + 0xd840, 0xd841, 0xd842, 0xd843, 0xd844, 0xd845, 0xd846, 0xd847, /*0x38-0x3f*/ + 0xd848, 0xbbed, 0xd849, 0xd84a, 0xd84b, 0xd84c, 0xb6b9, 0xf4f8, /*0x40-0x47*/ + 0xd84d, 0xf4f9, 0xd84e, 0xd84f, 0xcde3, 0xd850, 0xd851, 0xd852, /*0x48-0x4f*/ + 0xd853, 0xd854, 0xd855, 0xd856, 0xd857, 0xf5b9, 0xd858, 0xd859, /*0x50-0x57*/ + 0xd85a, 0xd85b, 0xebe0, 0xd85c, 0xd85d, 0xd85e, 0xd85f, 0xd860, /*0x58-0x5f*/ + 0xd861, 0xcff3, 0xbbbf, 0xd862, 0xd863, 0xd864, 0xd865, 0xd866, /*0x60-0x67*/ + 0xd867, 0xd868, 0xbac0, 0xd4a5, 0xd869, 0xd86a, 0xd86b, 0xd86c, /*0x68-0x6f*/ + 0xd86d, 0xd86e, 0xd86f, 0xe1d9, 0xd870, 0xd871, 0xd872, 0xd873, /*0x70-0x77*/ + 0xf5f4, 0xb1aa, 0xb2f2, 0xd874, 0xd875, 0xd876, 0xd877, 0xd878, /*0x78-0x7f*/ + 0xd879, 0xd87a, 0xf5f5, 0xd87b, 0xd87c, 0xf5f7, 0xd87d, 0xd87e, /*0x80-0x87*/ + 0xd880, 0xbad1, 0xf5f6, 0xd881, 0xc3b2, 0xd882, 0xd883, 0xd884, /*0x88-0x8f*/ + 0xd885, 0xd886, 0xd887, 0xd888, 0xf5f9, 0xd889, 0xd88a, 0xd88b, /*0x90-0x97*/ + 0xf5f8, 0xd88c, 0xd88d, 0xd88e, 0xd88f, 0xd890, 0xd891, 0xd892, /*0x98-0x9f*/ + 0xd893, 0xd894, 0xd895, 0xd896, 0xd897, 0xd898, 0xd899, 0xd89a, /*0xa0-0xa7*/ + 0xd89b, 0xd89c, 0xd89d, 0xd89e, 0xd89f, 0xd8a0, 0xd940, 0xd941, /*0xa8-0xaf*/ + 0xd942, 0xd943, 0xd944, 0xd945, 0xd946, 0xd947, 0xd948, 0xd949, /*0xb0-0xb7*/ + 0xd94a, 0xd94b, 0xd94c, 0xd94d, 0xd94e, 0xd94f, 0xd950, 0xd951, /*0xb8-0xbf*/ + 0xd952, 0xd953, 0xd954, 0xd955, 0xd956, 0xd957, 0xd958, 0xd959, /*0xc0-0xc7*/ + 0xd95a, 0xd95b, 0xd95c, 0xd95d, 0xd95e, 0xd95f, 0xd960, 0xd961, /*0xc8-0xcf*/ + 0xd962, 0xd963, 0xd964, 0xd965, 0xd966, 0xd967, 0xd968, 0xd969, /*0xd0-0xd7*/ + 0xd96a, 0xd96b, 0xd96c, 0xd96d, 0xd96e, 0xd96f, 0xd970, 0xd971, /*0xd8-0xdf*/ + 0xd972, 0xd973, 0xd974, 0xd975, 0xd976, 0xd977, 0xd978, 0xd979, /*0xe0-0xe7*/ + 0xd97a, 0xd97b, 0xd97c, 0xd97d, 0xd97e, 0xd980, 0xd981, 0xd982, /*0xe8-0xef*/ + 0xd983, 0xd984, 0xd985, 0xd986, 0xd987, 0xd988, 0xd989, 0xd98a, /*0xf0-0xf7*/ + 0xd98b, 0xd98c, 0xd98d, 0xd98e, 0xd98f, 0xd990, 0xd991, 0xd992, /*0xf8-0xff*/ + /* 0x8d00 */ + 0xd993, 0xd994, 0xd995, 0xd996, 0xd997, 0xd998, 0xd999, 0xd99a, /*0x00-0x07*/ + 0xd99b, 0xd99c, 0xd99d, 0xd99e, 0xd99f, 0xd9a0, 0xda40, 0xda41, /*0x08-0x0f*/ + 0xda42, 0xda43, 0xda44, 0xda45, 0xda46, 0xda47, 0xda48, 0xda49, /*0x10-0x17*/ + 0xda4a, 0xda4b, 0xda4c, 0xda4d, 0xda4e, 0xb1b4, 0xd5ea, 0xb8ba, /*0x18-0x1f*/ + 0xda4f, 0xb9b1, 0xb2c6, 0xd4f0, 0xcfcd, 0xb0dc, 0xd5cb, 0xbbf5, /*0x20-0x27*/ + 0xd6ca, 0xb7b7, 0xccb0, 0xc6b6, 0xb1e1, 0xb9ba, 0xd6fc, 0xb9e1, /*0x28-0x2f*/ + 0xb7a1, 0xbcfa, 0xeada, 0xeadb, 0xccf9, 0xb9f3, 0xeadc, 0xb4fb, /*0x30-0x37*/ + 0xc3b3, 0xb7d1, 0xbad8, 0xeadd, 0xd4f4, 0xeade, 0xbcd6, 0xbbdf, /*0x38-0x3f*/ + 0xeadf, 0xc1de, 0xc2b8, 0xd4df, 0xd7ca, 0xeae0, 0xeae1, 0xeae4, /*0x40-0x47*/ + 0xeae2, 0xeae3, 0xc9de, 0xb8b3, 0xb6c4, 0xeae5, 0xcaea, 0xc9cd, /*0x48-0x4f*/ + 0xb4cd, 0xda50, 0xda51, 0xe2d9, 0xc5e2, 0xeae6, 0xc0b5, 0xda52, /*0x50-0x57*/ + 0xd7b8, 0xeae7, 0xd7ac, 0xc8fc, 0xd8d3, 0xd8cd, 0xd4de, 0xda53, /*0x58-0x5f*/ + 0xd4f9, 0xc9c4, 0xd3ae, 0xb8d3, 0xb3e0, 0xda54, 0xc9e2, 0xf4f6, /*0x60-0x67*/ + 0xda55, 0xda56, 0xda57, 0xbad5, 0xda58, 0xf4f7, 0xda59, 0xda5a, /*0x68-0x6f*/ + 0xd7df, 0xda5b, 0xda5c, 0xf4f1, 0xb8b0, 0xd5d4, 0xb8cf, 0xc6f0, /*0x70-0x77*/ + 0xda5d, 0xda5e, 0xda5f, 0xda60, 0xda61, 0xda62, 0xda63, 0xda64, /*0x78-0x7f*/ + 0xda65, 0xb3c3, 0xda66, 0xda67, 0xf4f2, 0xb3ac, 0xda68, 0xda69, /*0x80-0x87*/ + 0xda6a, 0xda6b, 0xd4bd, 0xc7f7, 0xda6c, 0xda6d, 0xda6e, 0xda6f, /*0x88-0x8f*/ + 0xda70, 0xf4f4, 0xda71, 0xda72, 0xf4f3, 0xda73, 0xda74, 0xda75, /*0x90-0x97*/ + 0xda76, 0xda77, 0xda78, 0xda79, 0xda7a, 0xda7b, 0xda7c, 0xcccb, /*0x98-0x9f*/ + 0xda7d, 0xda7e, 0xda80, 0xc8a4, 0xda81, 0xda82, 0xda83, 0xda84, /*0xa0-0xa7*/ + 0xda85, 0xda86, 0xda87, 0xda88, 0xda89, 0xda8a, 0xda8b, 0xda8c, /*0xa8-0xaf*/ + 0xda8d, 0xf4f5, 0xda8e, 0xd7e3, 0xc5bf, 0xf5c0, 0xda8f, 0xda90, /*0xb0-0xb7*/ + 0xf5bb, 0xda91, 0xf5c3, 0xda92, 0xf5c2, 0xda93, 0xd6ba, 0xf5c1, /*0xb8-0xbf*/ + 0xda94, 0xda95, 0xda96, 0xd4be, 0xf5c4, 0xda97, 0xf5cc, 0xda98, /*0xc0-0xc7*/ + 0xda99, 0xda9a, 0xda9b, 0xb0cf, 0xb5f8, 0xda9c, 0xf5c9, 0xf5ca, /*0xc8-0xcf*/ + 0xda9d, 0xc5dc, 0xda9e, 0xda9f, 0xdaa0, 0xdb40, 0xf5c5, 0xf5c6, /*0xd0-0xd7*/ + 0xdb41, 0xdb42, 0xf5c7, 0xf5cb, 0xdb43, 0xbee0, 0xf5c8, 0xb8fa, /*0xd8-0xdf*/ + 0xdb44, 0xdb45, 0xdb46, 0xf5d0, 0xf5d3, 0xdb47, 0xdb48, 0xdb49, /*0xe0-0xe7*/ + 0xbfe7, 0xdb4a, 0xb9f2, 0xf5bc, 0xf5cd, 0xdb4b, 0xdb4c, 0xc2b7, /*0xe8-0xef*/ + 0xdb4d, 0xdb4e, 0xdb4f, 0xccf8, 0xdb50, 0xbcf9, 0xdb51, 0xf5ce, /*0xf0-0xf7*/ + 0xf5cf, 0xf5d1, 0xb6e5, 0xf5d2, 0xdb52, 0xf5d5, 0xdb53, 0xdb54, /*0xf8-0xff*/ + /* 0x8e00 */ + 0xdb55, 0xdb56, 0xdb57, 0xdb58, 0xdb59, 0xf5bd, 0xdb5a, 0xdb5b, /*0x00-0x07*/ + 0xdb5c, 0xf5d4, 0xd3bb, 0xdb5d, 0xb3ec, 0xdb5e, 0xdb5f, 0xcca4, /*0x08-0x0f*/ + 0xdb60, 0xdb61, 0xdb62, 0xdb63, 0xf5d6, 0xdb64, 0xdb65, 0xdb66, /*0x10-0x17*/ + 0xdb67, 0xdb68, 0xdb69, 0xdb6a, 0xdb6b, 0xf5d7, 0xbee1, 0xf5d8, /*0x18-0x1f*/ + 0xdb6c, 0xdb6d, 0xccdf, 0xf5db, 0xdb6e, 0xdb6f, 0xdb70, 0xdb71, /*0x20-0x27*/ + 0xdb72, 0xb2c8, 0xd7d9, 0xdb73, 0xf5d9, 0xdb74, 0xf5da, 0xf5dc, /*0x28-0x2f*/ + 0xdb75, 0xf5e2, 0xdb76, 0xdb77, 0xdb78, 0xf5e0, 0xdb79, 0xdb7a, /*0x30-0x37*/ + 0xdb7b, 0xf5df, 0xf5dd, 0xdb7c, 0xdb7d, 0xf5e1, 0xdb7e, 0xdb80, /*0x38-0x3f*/ + 0xf5de, 0xf5e4, 0xf5e5, 0xdb81, 0xcce3, 0xdb82, 0xdb83, 0xe5bf, /*0x40-0x47*/ + 0xb5b8, 0xf5e3, 0xf5e8, 0xcca3, 0xdb84, 0xdb85, 0xdb86, 0xdb87, /*0x48-0x4f*/ + 0xdb88, 0xf5e6, 0xf5e7, 0xdb89, 0xdb8a, 0xdb8b, 0xdb8c, 0xdb8d, /*0x50-0x57*/ + 0xdb8e, 0xf5be, 0xdb8f, 0xdb90, 0xdb91, 0xdb92, 0xdb93, 0xdb94, /*0x58-0x5f*/ + 0xdb95, 0xdb96, 0xdb97, 0xdb98, 0xdb99, 0xdb9a, 0xb1c4, 0xdb9b, /*0x60-0x67*/ + 0xdb9c, 0xf5bf, 0xdb9d, 0xdb9e, 0xb5c5, 0xb2e4, 0xdb9f, 0xf5ec, /*0x68-0x6f*/ + 0xf5e9, 0xdba0, 0xb6d7, 0xdc40, 0xf5ed, 0xdc41, 0xf5ea, 0xdc42, /*0x70-0x77*/ + 0xdc43, 0xdc44, 0xdc45, 0xdc46, 0xf5eb, 0xdc47, 0xdc48, 0xb4da, /*0x78-0x7f*/ + 0xdc49, 0xd4ea, 0xdc4a, 0xdc4b, 0xdc4c, 0xf5ee, 0xdc4d, 0xb3f9, /*0x80-0x87*/ + 0xdc4e, 0xdc4f, 0xdc50, 0xdc51, 0xdc52, 0xdc53, 0xdc54, 0xf5ef, /*0x88-0x8f*/ + 0xf5f1, 0xdc55, 0xdc56, 0xdc57, 0xf5f0, 0xdc58, 0xdc59, 0xdc5a, /*0x90-0x97*/ + 0xdc5b, 0xdc5c, 0xdc5d, 0xdc5e, 0xf5f2, 0xdc5f, 0xf5f3, 0xdc60, /*0x98-0x9f*/ + 0xdc61, 0xdc62, 0xdc63, 0xdc64, 0xdc65, 0xdc66, 0xdc67, 0xdc68, /*0xa0-0xa7*/ + 0xdc69, 0xdc6a, 0xdc6b, 0xc9ed, 0xb9aa, 0xdc6c, 0xdc6d, 0xc7fb, /*0xa8-0xaf*/ + 0xdc6e, 0xdc6f, 0xb6e3, 0xdc70, 0xdc71, 0xdc72, 0xdc73, 0xdc74, /*0xb0-0xb7*/ + 0xdc75, 0xdc76, 0xccc9, 0xdc77, 0xdc78, 0xdc79, 0xdc7a, 0xdc7b, /*0xb8-0xbf*/ + 0xdc7c, 0xdc7d, 0xdc7e, 0xdc80, 0xdc81, 0xdc82, 0xdc83, 0xdc84, /*0xc0-0xc7*/ + 0xdc85, 0xdc86, 0xdc87, 0xdc88, 0xdc89, 0xdc8a, 0xeaa6, 0xdc8b, /*0xc8-0xcf*/ + 0xdc8c, 0xdc8d, 0xdc8e, 0xdc8f, 0xdc90, 0xdc91, 0xdc92, 0xdc93, /*0xd0-0xd7*/ + 0xdc94, 0xdc95, 0xdc96, 0xdc97, 0xdc98, 0xdc99, 0xdc9a, 0xdc9b, /*0xd8-0xdf*/ + 0xdc9c, 0xdc9d, 0xdc9e, 0xdc9f, 0xdca0, 0xdd40, 0xdd41, 0xdd42, /*0xe0-0xe7*/ + 0xdd43, 0xdd44, 0xdd45, 0xdd46, 0xdd47, 0xdd48, 0xdd49, 0xdd4a, /*0xe8-0xef*/ + 0xdd4b, 0xdd4c, 0xdd4d, 0xdd4e, 0xdd4f, 0xdd50, 0xdd51, 0xdd52, /*0xf0-0xf7*/ + 0xdd53, 0xdd54, 0xdd55, 0xdd56, 0xdd57, 0xdd58, 0xdd59, 0xdd5a, /*0xf8-0xff*/ + /* 0x8f00 */ + 0xdd5b, 0xdd5c, 0xdd5d, 0xdd5e, 0xdd5f, 0xdd60, 0xdd61, 0xdd62, /*0x00-0x07*/ + 0xdd63, 0xdd64, 0xdd65, 0xdd66, 0xdd67, 0xdd68, 0xdd69, 0xdd6a, /*0x08-0x0f*/ + 0xdd6b, 0xdd6c, 0xdd6d, 0xdd6e, 0xdd6f, 0xdd70, 0xdd71, 0xdd72, /*0x10-0x17*/ + 0xdd73, 0xdd74, 0xdd75, 0xdd76, 0xdd77, 0xdd78, 0xdd79, 0xdd7a, /*0x18-0x1f*/ + 0xdd7b, 0xdd7c, 0xdd7d, 0xdd7e, 0xdd80, 0xdd81, 0xdd82, 0xdd83, /*0x20-0x27*/ + 0xdd84, 0xdd85, 0xdd86, 0xdd87, 0xdd88, 0xdd89, 0xdd8a, 0xdd8b, /*0x28-0x2f*/ + 0xdd8c, 0xdd8d, 0xdd8e, 0xdd8f, 0xdd90, 0xdd91, 0xdd92, 0xdd93, /*0x30-0x37*/ + 0xdd94, 0xdd95, 0xdd96, 0xdd97, 0xdd98, 0xdd99, 0xdd9a, 0xdd9b, /*0x38-0x3f*/ + 0xdd9c, 0xdd9d, 0xdd9e, 0xdd9f, 0xdda0, 0xde40, 0xde41, 0xde42, /*0x40-0x47*/ + 0xde43, 0xde44, 0xde45, 0xde46, 0xde47, 0xde48, 0xde49, 0xde4a, /*0x48-0x4f*/ + 0xde4b, 0xde4c, 0xde4d, 0xde4e, 0xde4f, 0xde50, 0xde51, 0xde52, /*0x50-0x57*/ + 0xde53, 0xde54, 0xde55, 0xde56, 0xde57, 0xde58, 0xde59, 0xde5a, /*0x58-0x5f*/ + 0xde5b, 0xde5c, 0xde5d, 0xde5e, 0xde5f, 0xde60, 0xb3b5, 0xd4fe, /*0x60-0x67*/ + 0xb9ec, 0xd0f9, 0xde61, 0xe9ed, 0xd7aa, 0xe9ee, 0xc2d6, 0xc8ed, /*0x68-0x6f*/ + 0xbae4, 0xe9ef, 0xe9f0, 0xe9f1, 0xd6e1, 0xe9f2, 0xe9f3, 0xe9f5, /*0x70-0x77*/ + 0xe9f4, 0xe9f6, 0xe9f7, 0xc7e1, 0xe9f8, 0xd4d8, 0xe9f9, 0xbdce, /*0x78-0x7f*/ + 0xde62, 0xe9fa, 0xe9fb, 0xbdcf, 0xe9fc, 0xb8a8, 0xc1be, 0xe9fd, /*0x80-0x87*/ + 0xb1b2, 0xbbd4, 0xb9f5, 0xe9fe, 0xde63, 0xeaa1, 0xeaa2, 0xeaa3, /*0x88-0x8f*/ + 0xb7f8, 0xbcad, 0xde64, 0xcae4, 0xe0ce, 0xd4af, 0xcfbd, 0xd5b7, /*0x90-0x97*/ + 0xeaa4, 0xd5de, 0xeaa5, 0xd0c1, 0xb9bc, 0xde65, 0xb4c7, 0xb1d9, /*0x98-0x9f*/ + 0xde66, 0xde67, 0xde68, 0xc0b1, 0xde69, 0xde6a, 0xde6b, 0xde6c, /*0xa0-0xa7*/ + 0xb1e6, 0xb1e7, 0xde6d, 0xb1e8, 0xde6e, 0xde6f, 0xde70, 0xde71, /*0xa8-0xaf*/ + 0xb3bd, 0xc8e8, 0xde72, 0xde73, 0xde74, 0xde75, 0xe5c1, 0xde76, /*0xb0-0xb7*/ + 0xde77, 0xb1df, 0xde78, 0xde79, 0xde7a, 0xc1c9, 0xb4ef, 0xde7b, /*0xb8-0xbf*/ + 0xde7c, 0xc7a8, 0xd3d8, 0xde7d, 0xc6f9, 0xd1b8, 0xde7e, 0xb9fd, /*0xc0-0xc7*/ + 0xc2f5, 0xde80, 0xde81, 0xde82, 0xde83, 0xde84, 0xd3ad, 0xde85, /*0xc8-0xcf*/ + 0xd4cb, 0xbdfc, 0xde86, 0xe5c2, 0xb7b5, 0xe5c3, 0xde87, 0xde88, /*0xd0-0xd7*/ + 0xbbb9, 0xd5e2, 0xde89, 0xbdf8, 0xd4b6, 0xcea5, 0xc1ac, 0xb3d9, /*0xd8-0xdf*/ + 0xde8a, 0xde8b, 0xccf6, 0xde8c, 0xe5c6, 0xe5c4, 0xe5c8, 0xde8d, /*0xe0-0xe7*/ + 0xe5ca, 0xe5c7, 0xb5cf, 0xc6c8, 0xde8e, 0xb5fc, 0xe5c5, 0xde8f, /*0xe8-0xef*/ + 0xcaf6, 0xde90, 0xde91, 0xe5c9, 0xde92, 0xde93, 0xde94, 0xc3d4, /*0xf0-0xf7*/ + 0xb1c5, 0xbca3, 0xde95, 0xde96, 0xde97, 0xd7b7, 0xde98, 0xde99, /*0xf8-0xff*/ + /* 0x9000 */ + 0xcdcb, 0xcbcd, 0xcaca, 0xccd3, 0xe5cc, 0xe5cb, 0xc4e6, 0xde9a, /*0x00-0x07*/ + 0xde9b, 0xd1a1, 0xd1b7, 0xe5cd, 0xde9c, 0xe5d0, 0xde9d, 0xcdb8, /*0x08-0x0f*/ + 0xd6f0, 0xe5cf, 0xb5dd, 0xde9e, 0xcdbe, 0xde9f, 0xe5d1, 0xb6ba, /*0x10-0x17*/ + 0xdea0, 0xdf40, 0xcda8, 0xb9e4, 0xdf41, 0xcac5, 0xb3d1, 0xcbd9, /*0x18-0x1f*/ + 0xd4ec, 0xe5d2, 0xb7ea, 0xdf42, 0xdf43, 0xdf44, 0xe5ce, 0xdf45, /*0x20-0x27*/ + 0xdf46, 0xdf47, 0xdf48, 0xdf49, 0xdf4a, 0xe5d5, 0xb4fe, 0xe5d6, /*0x28-0x2f*/ + 0xdf4b, 0xdf4c, 0xdf4d, 0xdf4e, 0xdf4f, 0xe5d3, 0xe5d4, 0xdf50, /*0x30-0x37*/ + 0xd2dd, 0xdf51, 0xdf52, 0xc2df, 0xb1c6, 0xdf53, 0xd3e2, 0xdf54, /*0x38-0x3f*/ + 0xdf55, 0xb6dd, 0xcbec, 0xdf56, 0xe5d7, 0xdf57, 0xdf58, 0xd3f6, /*0x40-0x47*/ + 0xdf59, 0xdf5a, 0xdf5b, 0xdf5c, 0xdf5d, 0xb1e9, 0xdf5e, 0xb6f4, /*0x48-0x4f*/ + 0xe5da, 0xe5d8, 0xe5d9, 0xb5c0, 0xdf5f, 0xdf60, 0xdf61, 0xd2c5, /*0x50-0x57*/ + 0xe5dc, 0xdf62, 0xdf63, 0xe5de, 0xdf64, 0xdf65, 0xdf66, 0xdf67, /*0x58-0x5f*/ + 0xdf68, 0xdf69, 0xe5dd, 0xc7b2, 0xdf6a, 0xd2a3, 0xdf6b, 0xdf6c, /*0x60-0x67*/ + 0xe5db, 0xdf6d, 0xdf6e, 0xdf6f, 0xdf70, 0xd4e2, 0xd5da, 0xdf71, /*0x68-0x6f*/ + 0xdf72, 0xdf73, 0xdf74, 0xdf75, 0xe5e0, 0xd7f1, 0xdf76, 0xdf77, /*0x70-0x77*/ + 0xdf78, 0xdf79, 0xdf7a, 0xdf7b, 0xdf7c, 0xe5e1, 0xdf7d, 0xb1dc, /*0x78-0x7f*/ + 0xd1fb, 0xdf7e, 0xe5e2, 0xe5e4, 0xdf80, 0xdf81, 0xdf82, 0xdf83, /*0x80-0x87*/ + 0xe5e3, 0xdf84, 0xdf85, 0xe5e5, 0xdf86, 0xdf87, 0xdf88, 0xdf89, /*0x88-0x8f*/ + 0xdf8a, 0xd2d8, 0xdf8b, 0xb5cb, 0xdf8c, 0xe7df, 0xdf8d, 0xdaf5, /*0x90-0x97*/ + 0xdf8e, 0xdaf8, 0xdf8f, 0xdaf6, 0xdf90, 0xdaf7, 0xdf91, 0xdf92, /*0x98-0x9f*/ + 0xdf93, 0xdafa, 0xd0cf, 0xc4c7, 0xdf94, 0xdf95, 0xb0ee, 0xdf96, /*0xa0-0xa7*/ + 0xdf97, 0xdf98, 0xd0b0, 0xdf99, 0xdaf9, 0xdf9a, 0xd3ca, 0xbaaa, /*0xa8-0xaf*/ + 0xdba2, 0xc7f1, 0xdf9b, 0xdafc, 0xdafb, 0xc9db, 0xdafd, 0xdf9c, /*0xb0-0xb7*/ + 0xdba1, 0xd7de, 0xdafe, 0xc1da, 0xdf9d, 0xdf9e, 0xdba5, 0xdf9f, /*0xb8-0xbf*/ + 0xdfa0, 0xd3f4, 0xe040, 0xe041, 0xdba7, 0xdba4, 0xe042, 0xdba8, /*0xc0-0xc7*/ + 0xe043, 0xe044, 0xbdbc, 0xe045, 0xe046, 0xe047, 0xc0c9, 0xdba3, /*0xc8-0xcf*/ + 0xdba6, 0xd6a3, 0xe048, 0xdba9, 0xe049, 0xe04a, 0xe04b, 0xdbad, /*0xd0-0xd7*/ + 0xe04c, 0xe04d, 0xe04e, 0xdbae, 0xdbac, 0xbac2, 0xe04f, 0xe050, /*0xd8-0xdf*/ + 0xe051, 0xbfa4, 0xdbab, 0xe052, 0xe053, 0xe054, 0xdbaa, 0xd4c7, /*0xe0-0xe7*/ + 0xb2bf, 0xe055, 0xe056, 0xdbaf, 0xe057, 0xb9f9, 0xe058, 0xdbb0, /*0xe8-0xef*/ + 0xe059, 0xe05a, 0xe05b, 0xe05c, 0xb3bb, 0xe05d, 0xe05e, 0xe05f, /*0xf0-0xf7*/ + 0xb5a6, 0xe060, 0xe061, 0xe062, 0xe063, 0xb6bc, 0xdbb1, 0xe064, /*0xf8-0xff*/ + /* 0x9100 */ + 0xe065, 0xe066, 0xb6f5, 0xe067, 0xdbb2, 0xe068, 0xe069, 0xe06a, /*0x00-0x07*/ + 0xe06b, 0xe06c, 0xe06d, 0xe06e, 0xe06f, 0xe070, 0xe071, 0xe072, /*0x08-0x0f*/ + 0xe073, 0xe074, 0xe075, 0xe076, 0xe077, 0xe078, 0xe079, 0xe07a, /*0x10-0x17*/ + 0xe07b, 0xb1c9, 0xe07c, 0xe07d, 0xe07e, 0xe080, 0xdbb4, 0xe081, /*0x18-0x1f*/ + 0xe082, 0xe083, 0xdbb3, 0xdbb5, 0xe084, 0xe085, 0xe086, 0xe087, /*0x20-0x27*/ + 0xe088, 0xe089, 0xe08a, 0xe08b, 0xe08c, 0xe08d, 0xe08e, 0xdbb7, /*0x28-0x2f*/ + 0xe08f, 0xdbb6, 0xe090, 0xe091, 0xe092, 0xe093, 0xe094, 0xe095, /*0x30-0x37*/ + 0xe096, 0xdbb8, 0xe097, 0xe098, 0xe099, 0xe09a, 0xe09b, 0xe09c, /*0x38-0x3f*/ + 0xe09d, 0xe09e, 0xe09f, 0xdbb9, 0xe0a0, 0xe140, 0xdbba, 0xe141, /*0x40-0x47*/ + 0xe142, 0xd3cf, 0xf4fa, 0xc7f5, 0xd7c3, 0xc5e4, 0xf4fc, 0xf4fd, /*0x48-0x4f*/ + 0xf4fb, 0xe143, 0xbec6, 0xe144, 0xe145, 0xe146, 0xe147, 0xd0ef, /*0x50-0x57*/ + 0xe148, 0xe149, 0xb7d3, 0xe14a, 0xe14b, 0xd4cd, 0xccaa, 0xe14c, /*0x58-0x5f*/ + 0xe14d, 0xf5a2, 0xf5a1, 0xbaa8, 0xf4fe, 0xcbd6, 0xe14e, 0xe14f, /*0x60-0x67*/ + 0xe150, 0xf5a4, 0xc0d2, 0xe151, 0xb3ea, 0xe152, 0xcdaa, 0xf5a5, /*0x68-0x6f*/ + 0xf5a3, 0xbdb4, 0xf5a8, 0xe153, 0xf5a9, 0xbdcd, 0xc3b8, 0xbfe1, /*0x70-0x77*/ + 0xcbe1, 0xf5aa, 0xe154, 0xe155, 0xe156, 0xf5a6, 0xf5a7, 0xc4f0, /*0x78-0x7f*/ + 0xe157, 0xe158, 0xe159, 0xe15a, 0xe15b, 0xf5ac, 0xe15c, 0xb4bc, /*0x80-0x87*/ + 0xe15d, 0xd7ed, 0xe15e, 0xb4d7, 0xf5ab, 0xf5ae, 0xe15f, 0xe160, /*0x88-0x8f*/ + 0xf5ad, 0xf5af, 0xd0d1, 0xe161, 0xe162, 0xe163, 0xe164, 0xe165, /*0x90-0x97*/ + 0xe166, 0xe167, 0xc3d1, 0xc8a9, 0xe168, 0xe169, 0xe16a, 0xe16b, /*0x98-0x9f*/ + 0xe16c, 0xe16d, 0xf5b0, 0xf5b1, 0xe16e, 0xe16f, 0xe170, 0xe171, /*0xa0-0xa7*/ + 0xe172, 0xe173, 0xf5b2, 0xe174, 0xe175, 0xf5b3, 0xf5b4, 0xf5b5, /*0xa8-0xaf*/ + 0xe176, 0xe177, 0xe178, 0xe179, 0xf5b7, 0xf5b6, 0xe17a, 0xe17b, /*0xb0-0xb7*/ + 0xe17c, 0xe17d, 0xf5b8, 0xe17e, 0xe180, 0xe181, 0xe182, 0xe183, /*0xb8-0xbf*/ + 0xe184, 0xe185, 0xe186, 0xe187, 0xe188, 0xe189, 0xe18a, 0xb2c9, /*0xc0-0xc7*/ + 0xe18b, 0xd3d4, 0xcacd, 0xe18c, 0xc0ef, 0xd6d8, 0xd2b0, 0xc1bf, /*0xc8-0xcf*/ + 0xe18d, 0xbdf0, 0xe18e, 0xe18f, 0xe190, 0xe191, 0xe192, 0xe193, /*0xd0-0xd7*/ + 0xe194, 0xe195, 0xe196, 0xe197, 0xb8aa, 0xe198, 0xe199, 0xe19a, /*0xd8-0xdf*/ + 0xe19b, 0xe19c, 0xe19d, 0xe19e, 0xe19f, 0xe1a0, 0xe240, 0xe241, /*0xe0-0xe7*/ + 0xe242, 0xe243, 0xe244, 0xe245, 0xe246, 0xe247, 0xe248, 0xe249, /*0xe8-0xef*/ + 0xe24a, 0xe24b, 0xe24c, 0xe24d, 0xe24e, 0xe24f, 0xe250, 0xe251, /*0xf0-0xf7*/ + 0xe252, 0xe253, 0xe254, 0xe255, 0xe256, 0xe257, 0xe258, 0xe259, /*0xf8-0xff*/ + /* 0x9200 */ + 0xe25a, 0xe25b, 0xe25c, 0xe25d, 0xe25e, 0xe25f, 0xe260, 0xe261, /*0x00-0x07*/ + 0xe262, 0xe263, 0xe264, 0xe265, 0xe266, 0xe267, 0xe268, 0xe269, /*0x08-0x0f*/ + 0xe26a, 0xe26b, 0xe26c, 0xe26d, 0xe26e, 0xe26f, 0xe270, 0xe271, /*0x10-0x17*/ + 0xe272, 0xe273, 0xe274, 0xe275, 0xe276, 0xe277, 0xe278, 0xe279, /*0x18-0x1f*/ + 0xe27a, 0xe27b, 0xe27c, 0xe27d, 0xe27e, 0xe280, 0xe281, 0xe282, /*0x20-0x27*/ + 0xe283, 0xe284, 0xe285, 0xe286, 0xe287, 0xe288, 0xe289, 0xe28a, /*0x28-0x2f*/ + 0xe28b, 0xe28c, 0xe28d, 0xe28e, 0xe28f, 0xe290, 0xe291, 0xe292, /*0x30-0x37*/ + 0xe293, 0xe294, 0xe295, 0xe296, 0xe297, 0xe298, 0xe299, 0xe29a, /*0x38-0x3f*/ + 0xe29b, 0xe29c, 0xe29d, 0xe29e, 0xe29f, 0xe2a0, 0xe340, 0xe341, /*0x40-0x47*/ + 0xe342, 0xe343, 0xe344, 0xe345, 0xe346, 0xe347, 0xe348, 0xe349, /*0x48-0x4f*/ + 0xe34a, 0xe34b, 0xe34c, 0xe34d, 0xe34e, 0xe34f, 0xe350, 0xe351, /*0x50-0x57*/ + 0xe352, 0xe353, 0xe354, 0xe355, 0xe356, 0xe357, 0xe358, 0xe359, /*0x58-0x5f*/ + 0xe35a, 0xe35b, 0xe35c, 0xe35d, 0xe35e, 0xe35f, 0xe360, 0xe361, /*0x60-0x67*/ + 0xe362, 0xe363, 0xe364, 0xe365, 0xe366, 0xe367, 0xe368, 0xe369, /*0x68-0x6f*/ + 0xe36a, 0xe36b, 0xe36c, 0xe36d, 0xbcf8, 0xe36e, 0xe36f, 0xe370, /*0x70-0x77*/ + 0xe371, 0xe372, 0xe373, 0xe374, 0xe375, 0xe376, 0xe377, 0xe378, /*0x78-0x7f*/ + 0xe379, 0xe37a, 0xe37b, 0xe37c, 0xe37d, 0xe37e, 0xe380, 0xe381, /*0x80-0x87*/ + 0xe382, 0xe383, 0xe384, 0xe385, 0xe386, 0xe387, 0xf6c6, 0xe388, /*0x88-0x8f*/ + 0xe389, 0xe38a, 0xe38b, 0xe38c, 0xe38d, 0xe38e, 0xe38f, 0xe390, /*0x90-0x97*/ + 0xe391, 0xe392, 0xe393, 0xe394, 0xe395, 0xe396, 0xe397, 0xe398, /*0x98-0x9f*/ + 0xe399, 0xe39a, 0xe39b, 0xe39c, 0xe39d, 0xe39e, 0xe39f, 0xe3a0, /*0xa0-0xa7*/ + 0xe440, 0xe441, 0xe442, 0xe443, 0xe444, 0xe445, 0xf6c7, 0xe446, /*0xa8-0xaf*/ + 0xe447, 0xe448, 0xe449, 0xe44a, 0xe44b, 0xe44c, 0xe44d, 0xe44e, /*0xb0-0xb7*/ + 0xe44f, 0xe450, 0xe451, 0xe452, 0xe453, 0xe454, 0xe455, 0xe456, /*0xb8-0xbf*/ + 0xe457, 0xe458, 0xe459, 0xe45a, 0xe45b, 0xe45c, 0xe45d, 0xe45e, /*0xc0-0xc7*/ + 0xf6c8, 0xe45f, 0xe460, 0xe461, 0xe462, 0xe463, 0xe464, 0xe465, /*0xc8-0xcf*/ + 0xe466, 0xe467, 0xe468, 0xe469, 0xe46a, 0xe46b, 0xe46c, 0xe46d, /*0xd0-0xd7*/ + 0xe46e, 0xe46f, 0xe470, 0xe471, 0xe472, 0xe473, 0xe474, 0xe475, /*0xd8-0xdf*/ + 0xe476, 0xe477, 0xe478, 0xe479, 0xe47a, 0xe47b, 0xe47c, 0xe47d, /*0xe0-0xe7*/ + 0xe47e, 0xe480, 0xe481, 0xe482, 0xe483, 0xe484, 0xe485, 0xe486, /*0xe8-0xef*/ + 0xe487, 0xe488, 0xe489, 0xe48a, 0xe48b, 0xe48c, 0xe48d, 0xe48e, /*0xf0-0xf7*/ + 0xe48f, 0xe490, 0xe491, 0xe492, 0xe493, 0xe494, 0xe495, 0xe496, /*0xf8-0xff*/ + /* 0x9300 */ + 0xe497, 0xe498, 0xe499, 0xe49a, 0xe49b, 0xe49c, 0xe49d, 0xe49e, /*0x00-0x07*/ + 0xe49f, 0xe4a0, 0xe540, 0xe541, 0xe542, 0xe543, 0xe544, 0xe545, /*0x08-0x0f*/ + 0xe546, 0xe547, 0xe548, 0xe549, 0xe54a, 0xe54b, 0xe54c, 0xe54d, /*0x10-0x17*/ + 0xe54e, 0xe54f, 0xe550, 0xe551, 0xe552, 0xe553, 0xe554, 0xe555, /*0x18-0x1f*/ + 0xe556, 0xe557, 0xe558, 0xe559, 0xe55a, 0xe55b, 0xe55c, 0xe55d, /*0x20-0x27*/ + 0xe55e, 0xe55f, 0xe560, 0xe561, 0xe562, 0xe563, 0xe564, 0xe565, /*0x28-0x2f*/ + 0xe566, 0xe567, 0xe568, 0xe569, 0xe56a, 0xe56b, 0xe56c, 0xe56d, /*0x30-0x37*/ + 0xe56e, 0xe56f, 0xe570, 0xe571, 0xe572, 0xe573, 0xf6c9, 0xe574, /*0x38-0x3f*/ + 0xe575, 0xe576, 0xe577, 0xe578, 0xe579, 0xe57a, 0xe57b, 0xe57c, /*0x40-0x47*/ + 0xe57d, 0xe57e, 0xe580, 0xe581, 0xe582, 0xe583, 0xe584, 0xe585, /*0x48-0x4f*/ + 0xe586, 0xe587, 0xe588, 0xe589, 0xe58a, 0xe58b, 0xe58c, 0xe58d, /*0x50-0x57*/ + 0xe58e, 0xe58f, 0xe590, 0xe591, 0xe592, 0xe593, 0xe594, 0xe595, /*0x58-0x5f*/ + 0xe596, 0xe597, 0xe598, 0xe599, 0xe59a, 0xe59b, 0xe59c, 0xe59d, /*0x60-0x67*/ + 0xe59e, 0xe59f, 0xf6ca, 0xe5a0, 0xe640, 0xe641, 0xe642, 0xe643, /*0x68-0x6f*/ + 0xe644, 0xe645, 0xe646, 0xe647, 0xe648, 0xe649, 0xe64a, 0xe64b, /*0x70-0x77*/ + 0xe64c, 0xe64d, 0xe64e, 0xe64f, 0xe650, 0xe651, 0xe652, 0xe653, /*0x78-0x7f*/ + 0xe654, 0xe655, 0xe656, 0xe657, 0xe658, 0xe659, 0xe65a, 0xe65b, /*0x80-0x87*/ + 0xe65c, 0xe65d, 0xe65e, 0xe65f, 0xe660, 0xe661, 0xe662, 0xf6cc, /*0x88-0x8f*/ + 0xe663, 0xe664, 0xe665, 0xe666, 0xe667, 0xe668, 0xe669, 0xe66a, /*0x90-0x97*/ + 0xe66b, 0xe66c, 0xe66d, 0xe66e, 0xe66f, 0xe670, 0xe671, 0xe672, /*0x98-0x9f*/ + 0xe673, 0xe674, 0xe675, 0xe676, 0xe677, 0xe678, 0xe679, 0xe67a, /*0xa0-0xa7*/ + 0xe67b, 0xe67c, 0xe67d, 0xe67e, 0xe680, 0xe681, 0xe682, 0xe683, /*0xa8-0xaf*/ + 0xe684, 0xe685, 0xe686, 0xe687, 0xe688, 0xe689, 0xe68a, 0xe68b, /*0xb0-0xb7*/ + 0xe68c, 0xe68d, 0xe68e, 0xe68f, 0xe690, 0xe691, 0xe692, 0xe693, /*0xb8-0xbf*/ + 0xe694, 0xe695, 0xe696, 0xe697, 0xe698, 0xe699, 0xe69a, 0xe69b, /*0xc0-0xc7*/ + 0xe69c, 0xe69d, 0xf6cb, 0xe69e, 0xe69f, 0xe6a0, 0xe740, 0xe741, /*0xc8-0xcf*/ + 0xe742, 0xe743, 0xe744, 0xe745, 0xe746, 0xe747, 0xf7e9, 0xe748, /*0xd0-0xd7*/ + 0xe749, 0xe74a, 0xe74b, 0xe74c, 0xe74d, 0xe74e, 0xe74f, 0xe750, /*0xd8-0xdf*/ + 0xe751, 0xe752, 0xe753, 0xe754, 0xe755, 0xe756, 0xe757, 0xe758, /*0xe0-0xe7*/ + 0xe759, 0xe75a, 0xe75b, 0xe75c, 0xe75d, 0xe75e, 0xe75f, 0xe760, /*0xe8-0xef*/ + 0xe761, 0xe762, 0xe763, 0xe764, 0xe765, 0xe766, 0xe767, 0xe768, /*0xf0-0xf7*/ + 0xe769, 0xe76a, 0xe76b, 0xe76c, 0xe76d, 0xe76e, 0xe76f, 0xe770, /*0xf8-0xff*/ + /* 0x9400 */ + 0xe771, 0xe772, 0xe773, 0xe774, 0xe775, 0xe776, 0xe777, 0xe778, /*0x00-0x07*/ + 0xe779, 0xe77a, 0xe77b, 0xe77c, 0xe77d, 0xe77e, 0xe780, 0xe781, /*0x08-0x0f*/ + 0xe782, 0xe783, 0xe784, 0xe785, 0xe786, 0xe787, 0xe788, 0xe789, /*0x10-0x17*/ + 0xe78a, 0xe78b, 0xe78c, 0xe78d, 0xe78e, 0xe78f, 0xe790, 0xe791, /*0x18-0x1f*/ + 0xe792, 0xe793, 0xe794, 0xe795, 0xe796, 0xe797, 0xe798, 0xe799, /*0x20-0x27*/ + 0xe79a, 0xe79b, 0xe79c, 0xe79d, 0xe79e, 0xe79f, 0xe7a0, 0xe840, /*0x28-0x2f*/ + 0xe841, 0xe842, 0xe843, 0xe844, 0xe845, 0xe846, 0xe847, 0xe848, /*0x30-0x37*/ + 0xe849, 0xe84a, 0xe84b, 0xe84c, 0xe84d, 0xe84e, 0xf6cd, 0xe84f, /*0x38-0x3f*/ + 0xe850, 0xe851, 0xe852, 0xe853, 0xe854, 0xe855, 0xe856, 0xe857, /*0x40-0x47*/ + 0xe858, 0xe859, 0xe85a, 0xe85b, 0xe85c, 0xe85d, 0xe85e, 0xe85f, /*0x48-0x4f*/ + 0xe860, 0xe861, 0xe862, 0xe863, 0xe864, 0xe865, 0xe866, 0xe867, /*0x50-0x57*/ + 0xe868, 0xe869, 0xe86a, 0xe86b, 0xe86c, 0xe86d, 0xe86e, 0xe86f, /*0x58-0x5f*/ + 0xe870, 0xe871, 0xe872, 0xe873, 0xe874, 0xe875, 0xe876, 0xe877, /*0x60-0x67*/ + 0xe878, 0xe879, 0xe87a, 0xf6ce, 0xe87b, 0xe87c, 0xe87d, 0xe87e, /*0x68-0x6f*/ + 0xe880, 0xe881, 0xe882, 0xe883, 0xe884, 0xe885, 0xe886, 0xe887, /*0x70-0x77*/ + 0xe888, 0xe889, 0xe88a, 0xe88b, 0xe88c, 0xe88d, 0xe88e, 0xe88f, /*0x78-0x7f*/ + 0xe890, 0xe891, 0xe892, 0xe893, 0xe894, 0xeec4, 0xeec5, 0xeec6, /*0x80-0x87*/ + 0xd5eb, 0xb6a4, 0xeec8, 0xeec7, 0xeec9, 0xeeca, 0xc7a5, 0xeecb, /*0x88-0x8f*/ + 0xeecc, 0xe895, 0xb7b0, 0xb5f6, 0xeecd, 0xeecf, 0xe896, 0xeece, /*0x90-0x97*/ + 0xe897, 0xb8c6, 0xeed0, 0xeed1, 0xeed2, 0xb6db, 0xb3ae, 0xd6d3, /*0x98-0x9f*/ + 0xc4c6, 0xb1b5, 0xb8d6, 0xeed3, 0xeed4, 0xd4bf, 0xc7d5, 0xbefb, /*0xa0-0xa7*/ + 0xced9, 0xb9b3, 0xeed6, 0xeed5, 0xeed8, 0xeed7, 0xc5a5, 0xeed9, /*0xa8-0xaf*/ + 0xeeda, 0xc7ae, 0xeedb, 0xc7af, 0xeedc, 0xb2a7, 0xeedd, 0xeede, /*0xb0-0xb7*/ + 0xeedf, 0xeee0, 0xeee1, 0xd7ea, 0xeee2, 0xeee3, 0xbcd8, 0xeee4, /*0xb8-0xbf*/ + 0xd3cb, 0xccfa, 0xb2ac, 0xc1e5, 0xeee5, 0xc7a6, 0xc3ad, 0xe898, /*0xc0-0xc7*/ + 0xeee6, 0xeee7, 0xeee8, 0xeee9, 0xeeea, 0xeeeb, 0xeeec, 0xe899, /*0xc8-0xcf*/ + 0xeeed, 0xeeee, 0xeeef, 0xe89a, 0xe89b, 0xeef0, 0xeef1, 0xeef2, /*0xd0-0xd7*/ + 0xeef4, 0xeef3, 0xe89c, 0xeef5, 0xcdad, 0xc2c1, 0xeef6, 0xeef7, /*0xd8-0xdf*/ + 0xeef8, 0xd5a1, 0xeef9, 0xcfb3, 0xeefa, 0xeefb, 0xe89d, 0xeefc, /*0xe0-0xe7*/ + 0xeefd, 0xefa1, 0xeefe, 0xefa2, 0xb8f5, 0xc3fa, 0xefa3, 0xefa4, /*0xe8-0xef*/ + 0xbdc2, 0xd2bf, 0xb2f9, 0xefa5, 0xefa6, 0xefa7, 0xd2f8, 0xefa8, /*0xf0-0xf7*/ + 0xd6fd, 0xefa9, 0xc6cc, 0xe89e, 0xefaa, 0xefab, 0xc1b4, 0xefac, /*0xf8-0xff*/ + /* 0x9500 */ + 0xcffa, 0xcbf8, 0xefae, 0xefad, 0xb3fa, 0xb9f8, 0xefaf, 0xefb0, /*0x00-0x07*/ + 0xd0e2, 0xefb1, 0xefb2, 0xb7e6, 0xd0bf, 0xefb3, 0xefb4, 0xefb5, /*0x08-0x0f*/ + 0xc8f1, 0xcce0, 0xefb6, 0xefb7, 0xefb8, 0xefb9, 0xefba, 0xd5e0, /*0x10-0x17*/ + 0xefbb, 0xb4ed, 0xc3aa, 0xefbc, 0xe89f, 0xefbd, 0xefbe, 0xefbf, /*0x18-0x1f*/ + 0xe8a0, 0xcefd, 0xefc0, 0xc2e0, 0xb4b8, 0xd7b6, 0xbdf5, 0xe940, /*0x20-0x27*/ + 0xcfc7, 0xefc3, 0xefc1, 0xefc2, 0xefc4, 0xb6a7, 0xbcfc, 0xbee2, /*0x28-0x2f*/ + 0xc3cc, 0xefc5, 0xefc6, 0xe941, 0xefc7, 0xefcf, 0xefc8, 0xefc9, /*0x30-0x37*/ + 0xefca, 0xc7c2, 0xeff1, 0xb6cd, 0xefcb, 0xe942, 0xefcc, 0xefcd, /*0x38-0x3f*/ + 0xb6c6, 0xc3be, 0xefce, 0xe943, 0xefd0, 0xefd1, 0xefd2, 0xd5f2, /*0x40-0x47*/ + 0xe944, 0xefd3, 0xc4f7, 0xe945, 0xefd4, 0xc4f8, 0xefd5, 0xefd6, /*0x48-0x4f*/ + 0xb8e4, 0xb0f7, 0xefd7, 0xefd8, 0xefd9, 0xe946, 0xefda, 0xefdb, /*0x50-0x57*/ + 0xefdc, 0xefdd, 0xe947, 0xefde, 0xbeb5, 0xefe1, 0xefdf, 0xefe0, /*0x58-0x5f*/ + 0xe948, 0xefe2, 0xefe3, 0xc1cd, 0xefe4, 0xefe5, 0xefe6, 0xefe7, /*0x60-0x67*/ + 0xefe8, 0xefe9, 0xefea, 0xefeb, 0xefec, 0xc0d8, 0xe949, 0xefed, /*0x68-0x6f*/ + 0xc1ad, 0xefee, 0xefef, 0xeff0, 0xe94a, 0xe94b, 0xcfe2, 0xe94c, /*0x70-0x77*/ + 0xe94d, 0xe94e, 0xe94f, 0xe950, 0xe951, 0xe952, 0xe953, 0xb3a4, /*0x78-0x7f*/ + 0xe954, 0xe955, 0xe956, 0xe957, 0xe958, 0xe959, 0xe95a, 0xe95b, /*0x80-0x87*/ + 0xe95c, 0xe95d, 0xe95e, 0xe95f, 0xe960, 0xe961, 0xe962, 0xe963, /*0x88-0x8f*/ + 0xe964, 0xe965, 0xe966, 0xe967, 0xe968, 0xe969, 0xe96a, 0xe96b, /*0x90-0x97*/ + 0xe96c, 0xe96d, 0xe96e, 0xe96f, 0xe970, 0xe971, 0xe972, 0xe973, /*0x98-0x9f*/ + 0xe974, 0xe975, 0xe976, 0xe977, 0xe978, 0xe979, 0xe97a, 0xe97b, /*0xa0-0xa7*/ + 0xe97c, 0xe97d, 0xe97e, 0xe980, 0xe981, 0xe982, 0xe983, 0xe984, /*0xa8-0xaf*/ + 0xe985, 0xe986, 0xe987, 0xe988, 0xe989, 0xe98a, 0xe98b, 0xe98c, /*0xb0-0xb7*/ + 0xe98d, 0xe98e, 0xe98f, 0xe990, 0xe991, 0xe992, 0xe993, 0xe994, /*0xb8-0xbf*/ + 0xe995, 0xe996, 0xe997, 0xe998, 0xe999, 0xe99a, 0xe99b, 0xe99c, /*0xc0-0xc7*/ + 0xe99d, 0xe99e, 0xe99f, 0xe9a0, 0xea40, 0xea41, 0xea42, 0xea43, /*0xc8-0xcf*/ + 0xea44, 0xea45, 0xea46, 0xea47, 0xea48, 0xea49, 0xea4a, 0xea4b, /*0xd0-0xd7*/ + 0xea4c, 0xea4d, 0xea4e, 0xea4f, 0xea50, 0xea51, 0xea52, 0xea53, /*0xd8-0xdf*/ + 0xea54, 0xea55, 0xea56, 0xea57, 0xea58, 0xea59, 0xea5a, 0xea5b, /*0xe0-0xe7*/ + 0xc3c5, 0xe3c5, 0xc9c1, 0xe3c6, 0xea5c, 0xb1d5, 0xceca, 0xb4b3, /*0xe8-0xef*/ + 0xc8f2, 0xe3c7, 0xcfd0, 0xe3c8, 0xbce4, 0xe3c9, 0xe3ca, 0xc3c6, /*0xf0-0xf7*/ + 0xd5a2, 0xc4d6, 0xb9eb, 0xcec5, 0xe3cb, 0xc3f6, 0xe3cc, 0xea5d, /*0xf8-0xff*/ + /* 0x9600 */ + 0xb7a7, 0xb8f3, 0xbad2, 0xe3cd, 0xe3ce, 0xd4c4, 0xe3cf, 0xea5e, /*0x00-0x07*/ + 0xe3d0, 0xd1cb, 0xe3d1, 0xe3d2, 0xe3d3, 0xe3d4, 0xd1d6, 0xe3d5, /*0x08-0x0f*/ + 0xb2fb, 0xc0bb, 0xe3d6, 0xea5f, 0xc0ab, 0xe3d7, 0xe3d8, 0xe3d9, /*0x10-0x17*/ + 0xea60, 0xe3da, 0xe3db, 0xea61, 0xb8b7, 0xdae2, 0xea62, 0xb6d3, /*0x18-0x1f*/ + 0xea63, 0xdae4, 0xdae3, 0xea64, 0xea65, 0xea66, 0xea67, 0xea68, /*0x20-0x27*/ + 0xea69, 0xea6a, 0xdae6, 0xea6b, 0xea6c, 0xea6d, 0xc8ee, 0xea6e, /*0x28-0x2f*/ + 0xea6f, 0xdae5, 0xb7c0, 0xd1f4, 0xd2f5, 0xd5f3, 0xbdd7, 0xea70, /*0x30-0x37*/ + 0xea71, 0xea72, 0xea73, 0xd7e8, 0xdae8, 0xdae7, 0xea74, 0xb0a2, /*0x38-0x3f*/ + 0xcdd3, 0xea75, 0xdae9, 0xea76, 0xb8bd, 0xbcca, 0xc2bd, 0xc2a4, /*0x40-0x47*/ + 0xb3c2, 0xdaea, 0xea77, 0xc2aa, 0xc4b0, 0xbdb5, 0xea78, 0xea79, /*0x48-0x4f*/ + 0xcfde, 0xea7a, 0xea7b, 0xea7c, 0xdaeb, 0xc9c2, 0xea7d, 0xea7e, /*0x50-0x57*/ + 0xea80, 0xea81, 0xea82, 0xb1dd, 0xea83, 0xea84, 0xea85, 0xdaec, /*0x58-0x5f*/ + 0xea86, 0xb6b8, 0xd4ba, 0xea87, 0xb3fd, 0xea88, 0xea89, 0xdaed, /*0x60-0x67*/ + 0xd4c9, 0xcfd5, 0xc5e3, 0xea8a, 0xdaee, 0xea8b, 0xea8c, 0xea8d, /*0x68-0x6f*/ + 0xea8e, 0xea8f, 0xdaef, 0xea90, 0xdaf0, 0xc1ea, 0xccd5, 0xcfdd, /*0x70-0x77*/ + 0xea91, 0xea92, 0xea93, 0xea94, 0xea95, 0xea96, 0xea97, 0xea98, /*0x78-0x7f*/ + 0xea99, 0xea9a, 0xea9b, 0xea9c, 0xea9d, 0xd3e7, 0xc2a1, 0xea9e, /*0x80-0x87*/ + 0xdaf1, 0xea9f, 0xeaa0, 0xcbe5, 0xeb40, 0xdaf2, 0xeb41, 0xcbe6, /*0x88-0x8f*/ + 0xd2fe, 0xeb42, 0xeb43, 0xeb44, 0xb8f4, 0xeb45, 0xeb46, 0xdaf3, /*0x90-0x97*/ + 0xb0af, 0xcfb6, 0xeb47, 0xeb48, 0xd5cf, 0xeb49, 0xeb4a, 0xeb4b, /*0x98-0x9f*/ + 0xeb4c, 0xeb4d, 0xeb4e, 0xeb4f, 0xeb50, 0xeb51, 0xeb52, 0xcbed, /*0xa0-0xa7*/ + 0xeb53, 0xeb54, 0xeb55, 0xeb56, 0xeb57, 0xeb58, 0xeb59, 0xeb5a, /*0xa8-0xaf*/ + 0xdaf4, 0xeb5b, 0xeb5c, 0xe3c4, 0xeb5d, 0xeb5e, 0xc1a5, 0xeb5f, /*0xb0-0xb7*/ + 0xeb60, 0xf6bf, 0xeb61, 0xeb62, 0xf6c0, 0xf6c1, 0xc4d1, 0xeb63, /*0xb8-0xbf*/ + 0xc8b8, 0xd1e3, 0xeb64, 0xeb65, 0xd0db, 0xd1c5, 0xbcaf, 0xb9cd, /*0xc0-0xc7*/ + 0xeb66, 0xeff4, 0xeb67, 0xeb68, 0xb4c6, 0xd3ba, 0xf6c2, 0xb3fb, /*0xc8-0xcf*/ + 0xeb69, 0xeb6a, 0xf6c3, 0xeb6b, 0xeb6c, 0xb5f1, 0xeb6d, 0xeb6e, /*0xd0-0xd7*/ + 0xeb6f, 0xeb70, 0xeb71, 0xeb72, 0xeb73, 0xeb74, 0xeb75, 0xeb76, /*0xd8-0xdf*/ + 0xf6c5, 0xeb77, 0xeb78, 0xeb79, 0xeb7a, 0xeb7b, 0xeb7c, 0xeb7d, /*0xe0-0xe7*/ + 0xd3ea, 0xf6a7, 0xd1a9, 0xeb7e, 0xeb80, 0xeb81, 0xeb82, 0xf6a9, /*0xe8-0xef*/ + 0xeb83, 0xeb84, 0xeb85, 0xf6a8, 0xeb86, 0xeb87, 0xc1e3, 0xc0d7, /*0xf0-0xf7*/ + 0xeb88, 0xb1a2, 0xeb89, 0xeb8a, 0xeb8b, 0xeb8c, 0xceed, 0xeb8d, /*0xf8-0xff*/ + /* 0x9700 */ + 0xd0e8, 0xf6ab, 0xeb8e, 0xeb8f, 0xcff6, 0xeb90, 0xf6aa, 0xd5f0, /*0x00-0x07*/ + 0xf6ac, 0xc3b9, 0xeb91, 0xeb92, 0xeb93, 0xbbf4, 0xf6ae, 0xf6ad, /*0x08-0x0f*/ + 0xeb94, 0xeb95, 0xeb96, 0xc4de, 0xeb97, 0xeb98, 0xc1d8, 0xeb99, /*0x10-0x17*/ + 0xeb9a, 0xeb9b, 0xeb9c, 0xeb9d, 0xcbaa, 0xeb9e, 0xcfbc, 0xeb9f, /*0x18-0x1f*/ + 0xeba0, 0xec40, 0xec41, 0xec42, 0xec43, 0xec44, 0xec45, 0xec46, /*0x20-0x27*/ + 0xec47, 0xec48, 0xf6af, 0xec49, 0xec4a, 0xf6b0, 0xec4b, 0xec4c, /*0x28-0x2f*/ + 0xf6b1, 0xec4d, 0xc2b6, 0xec4e, 0xec4f, 0xec50, 0xec51, 0xec52, /*0x30-0x37*/ + 0xb0d4, 0xc5f9, 0xec53, 0xec54, 0xec55, 0xec56, 0xf6b2, 0xec57, /*0x38-0x3f*/ + 0xec58, 0xec59, 0xec5a, 0xec5b, 0xec5c, 0xec5d, 0xec5e, 0xec5f, /*0x40-0x47*/ + 0xec60, 0xec61, 0xec62, 0xec63, 0xec64, 0xec65, 0xec66, 0xec67, /*0x48-0x4f*/ + 0xec68, 0xec69, 0xc7e0, 0xf6a6, 0xec6a, 0xec6b, 0xbeb8, 0xec6c, /*0x50-0x57*/ + 0xec6d, 0xbeb2, 0xec6e, 0xb5e5, 0xec6f, 0xec70, 0xb7c7, 0xec71, /*0x58-0x5f*/ + 0xbfbf, 0xc3d2, 0xc3e6, 0xec72, 0xec73, 0xd8cc, 0xec74, 0xec75, /*0x60-0x67*/ + 0xec76, 0xb8ef, 0xec77, 0xec78, 0xec79, 0xec7a, 0xec7b, 0xec7c, /*0x68-0x6f*/ + 0xec7d, 0xec7e, 0xec80, 0xbdf9, 0xd1a5, 0xec81, 0xb0d0, 0xec82, /*0x70-0x77*/ + 0xec83, 0xec84, 0xec85, 0xec86, 0xf7b0, 0xec87, 0xec88, 0xec89, /*0x78-0x7f*/ + 0xec8a, 0xec8b, 0xec8c, 0xec8d, 0xec8e, 0xf7b1, 0xec8f, 0xec90, /*0x80-0x87*/ + 0xec91, 0xec92, 0xec93, 0xd0ac, 0xec94, 0xb0b0, 0xec95, 0xec96, /*0x88-0x8f*/ + 0xec97, 0xf7b2, 0xf7b3, 0xec98, 0xf7b4, 0xec99, 0xec9a, 0xec9b, /*0x90-0x97*/ + 0xc7ca, 0xec9c, 0xec9d, 0xec9e, 0xec9f, 0xeca0, 0xed40, 0xed41, /*0x98-0x9f*/ + 0xbecf, 0xed42, 0xed43, 0xf7b7, 0xed44, 0xed45, 0xed46, 0xed47, /*0xa0-0xa7*/ + 0xed48, 0xed49, 0xed4a, 0xf7b6, 0xed4b, 0xb1de, 0xed4c, 0xf7b5, /*0xa8-0xaf*/ + 0xed4d, 0xed4e, 0xf7b8, 0xed4f, 0xf7b9, 0xed50, 0xed51, 0xed52, /*0xb0-0xb7*/ + 0xed53, 0xed54, 0xed55, 0xed56, 0xed57, 0xed58, 0xed59, 0xed5a, /*0xb8-0xbf*/ + 0xed5b, 0xed5c, 0xed5d, 0xed5e, 0xed5f, 0xed60, 0xed61, 0xed62, /*0xc0-0xc7*/ + 0xed63, 0xed64, 0xed65, 0xed66, 0xed67, 0xed68, 0xed69, 0xed6a, /*0xc8-0xcf*/ + 0xed6b, 0xed6c, 0xed6d, 0xed6e, 0xed6f, 0xed70, 0xed71, 0xed72, /*0xd0-0xd7*/ + 0xed73, 0xed74, 0xed75, 0xed76, 0xed77, 0xed78, 0xed79, 0xed7a, /*0xd8-0xdf*/ + 0xed7b, 0xed7c, 0xed7d, 0xed7e, 0xed80, 0xed81, 0xcea4, 0xc8cd, /*0xe0-0xe7*/ + 0xed82, 0xbaab, 0xe8b8, 0xe8b9, 0xe8ba, 0xbec2, 0xed83, 0xed84, /*0xe8-0xef*/ + 0xed85, 0xed86, 0xed87, 0xd2f4, 0xed88, 0xd4cf, 0xc9d8, 0xed89, /*0xf0-0xf7*/ + 0xed8a, 0xed8b, 0xed8c, 0xed8d, 0xed8e, 0xed8f, 0xed90, 0xed91, /*0xf8-0xff*/ + /* 0x9800 */ + 0xed92, 0xed93, 0xed94, 0xed95, 0xed96, 0xed97, 0xed98, 0xed99, /*0x00-0x07*/ + 0xed9a, 0xed9b, 0xed9c, 0xed9d, 0xed9e, 0xed9f, 0xeda0, 0xee40, /*0x08-0x0f*/ + 0xee41, 0xee42, 0xee43, 0xee44, 0xee45, 0xee46, 0xee47, 0xee48, /*0x10-0x17*/ + 0xee49, 0xee4a, 0xee4b, 0xee4c, 0xee4d, 0xee4e, 0xee4f, 0xee50, /*0x18-0x1f*/ + 0xee51, 0xee52, 0xee53, 0xee54, 0xee55, 0xee56, 0xee57, 0xee58, /*0x20-0x27*/ + 0xee59, 0xee5a, 0xee5b, 0xee5c, 0xee5d, 0xee5e, 0xee5f, 0xee60, /*0x28-0x2f*/ + 0xee61, 0xee62, 0xee63, 0xee64, 0xee65, 0xee66, 0xee67, 0xee68, /*0x30-0x37*/ + 0xee69, 0xee6a, 0xee6b, 0xee6c, 0xee6d, 0xee6e, 0xee6f, 0xee70, /*0x38-0x3f*/ + 0xee71, 0xee72, 0xee73, 0xee74, 0xee75, 0xee76, 0xee77, 0xee78, /*0x40-0x47*/ + 0xee79, 0xee7a, 0xee7b, 0xee7c, 0xee7d, 0xee7e, 0xee80, 0xee81, /*0x48-0x4f*/ + 0xee82, 0xee83, 0xee84, 0xee85, 0xee86, 0xee87, 0xee88, 0xee89, /*0x50-0x57*/ + 0xee8a, 0xee8b, 0xee8c, 0xee8d, 0xee8e, 0xee8f, 0xee90, 0xee91, /*0x58-0x5f*/ + 0xee92, 0xee93, 0xee94, 0xee95, 0xee96, 0xee97, 0xee98, 0xee99, /*0x60-0x67*/ + 0xee9a, 0xee9b, 0xee9c, 0xee9d, 0xee9e, 0xee9f, 0xeea0, 0xef40, /*0x68-0x6f*/ + 0xef41, 0xef42, 0xef43, 0xef44, 0xef45, 0xd2b3, 0xb6a5, 0xc7ea, /*0x70-0x77*/ + 0xf1fc, 0xcfee, 0xcbb3, 0xd0eb, 0xe7ef, 0xcde7, 0xb9cb, 0xb6d9, /*0x78-0x7f*/ + 0xf1fd, 0xb0e4, 0xcbcc, 0xf1fe, 0xd4a4, 0xc2ad, 0xc1ec, 0xc6c4, /*0x80-0x87*/ + 0xbeb1, 0xf2a1, 0xbcd5, 0xef46, 0xf2a2, 0xf2a3, 0xef47, 0xf2a4, /*0x88-0x8f*/ + 0xd2c3, 0xc6b5, 0xef48, 0xcdc7, 0xf2a5, 0xef49, 0xd3b1, 0xbfc5, /*0x90-0x97*/ + 0xcce2, 0xef4a, 0xf2a6, 0xf2a7, 0xd1d5, 0xb6ee, 0xf2a8, 0xf2a9, /*0x98-0x9f*/ + 0xb5df, 0xf2aa, 0xf2ab, 0xef4b, 0xb2fc, 0xf2ac, 0xf2ad, 0xc8a7, /*0xa0-0xa7*/ + 0xef4c, 0xef4d, 0xef4e, 0xef4f, 0xef50, 0xef51, 0xef52, 0xef53, /*0xa8-0xaf*/ + 0xef54, 0xef55, 0xef56, 0xef57, 0xef58, 0xef59, 0xef5a, 0xef5b, /*0xb0-0xb7*/ + 0xef5c, 0xef5d, 0xef5e, 0xef5f, 0xef60, 0xef61, 0xef62, 0xef63, /*0xb8-0xbf*/ + 0xef64, 0xef65, 0xef66, 0xef67, 0xef68, 0xef69, 0xef6a, 0xef6b, /*0xc0-0xc7*/ + 0xef6c, 0xef6d, 0xef6e, 0xef6f, 0xef70, 0xef71, 0xb7e7, 0xef72, /*0xc8-0xcf*/ + 0xef73, 0xeca9, 0xecaa, 0xecab, 0xef74, 0xecac, 0xef75, 0xef76, /*0xd0-0xd7*/ + 0xc6ae, 0xecad, 0xecae, 0xef77, 0xef78, 0xef79, 0xb7c9, 0xcab3, /*0xd8-0xdf*/ + 0xef7a, 0xef7b, 0xef7c, 0xef7d, 0xef7e, 0xef80, 0xef81, 0xe2b8, /*0xe0-0xe7*/ + 0xf7cf, 0xef82, 0xef83, 0xef84, 0xef85, 0xef86, 0xef87, 0xef88, /*0xe8-0xef*/ + 0xef89, 0xef8a, 0xef8b, 0xef8c, 0xef8d, 0xef8e, 0xef8f, 0xef90, /*0xf0-0xf7*/ + 0xef91, 0xef92, 0xef93, 0xef94, 0xef95, 0xef96, 0xef97, 0xef98, /*0xf8-0xff*/ + /* 0x9900 */ + 0xef99, 0xef9a, 0xef9b, 0xef9c, 0xef9d, 0xef9e, 0xef9f, 0xefa0, /*0x00-0x07*/ + 0xf040, 0xf041, 0xf042, 0xf043, 0xf044, 0xf7d0, 0xf045, 0xf046, /*0x08-0x0f*/ + 0xb2cd, 0xf047, 0xf048, 0xf049, 0xf04a, 0xf04b, 0xf04c, 0xf04d, /*0x10-0x17*/ + 0xf04e, 0xf04f, 0xf050, 0xf051, 0xf052, 0xf053, 0xf054, 0xf055, /*0x18-0x1f*/ + 0xf056, 0xf057, 0xf058, 0xf059, 0xf05a, 0xf05b, 0xf05c, 0xf05d, /*0x20-0x27*/ + 0xf05e, 0xf05f, 0xf060, 0xf061, 0xf062, 0xf063, 0xf7d1, 0xf064, /*0x28-0x2f*/ + 0xf065, 0xf066, 0xf067, 0xf068, 0xf069, 0xf06a, 0xf06b, 0xf06c, /*0x30-0x37*/ + 0xf06d, 0xf06e, 0xf06f, 0xf070, 0xf071, 0xf072, 0xf073, 0xf074, /*0x38-0x3f*/ + 0xf075, 0xf076, 0xf077, 0xf078, 0xf079, 0xf07a, 0xf07b, 0xf07c, /*0x40-0x47*/ + 0xf07d, 0xf07e, 0xf080, 0xf081, 0xf082, 0xf083, 0xf084, 0xf085, /*0x48-0x4f*/ + 0xf086, 0xf087, 0xf088, 0xf089, 0xf7d3, 0xf7d2, 0xf08a, 0xf08b, /*0x50-0x57*/ + 0xf08c, 0xf08d, 0xf08e, 0xf08f, 0xf090, 0xf091, 0xf092, 0xf093, /*0x58-0x5f*/ + 0xf094, 0xf095, 0xf096, 0xe2bb, 0xf097, 0xbca2, 0xf098, 0xe2bc, /*0x60-0x67*/ + 0xe2bd, 0xe2be, 0xe2bf, 0xe2c0, 0xe2c1, 0xb7b9, 0xd2fb, 0xbda4, /*0x68-0x6f*/ + 0xcace, 0xb1a5, 0xcbc7, 0xf099, 0xe2c2, 0xb6fc, 0xc8c4, 0xe2c3, /*0x70-0x77*/ + 0xf09a, 0xf09b, 0xbdc8, 0xf09c, 0xb1fd, 0xe2c4, 0xf09d, 0xb6f6, /*0x78-0x7f*/ + 0xe2c5, 0xc4d9, 0xf09e, 0xf09f, 0xe2c6, 0xcfda, 0xb9dd, 0xe2c7, /*0x80-0x87*/ + 0xc0a1, 0xf0a0, 0xe2c8, 0xb2f6, 0xf140, 0xe2c9, 0xf141, 0xc1f3, /*0x88-0x8f*/ + 0xe2ca, 0xe2cb, 0xc2f8, 0xe2cc, 0xe2cd, 0xe2ce, 0xcad7, 0xd8b8, /*0x90-0x97*/ + 0xd9e5, 0xcfe3, 0xf142, 0xf143, 0xf144, 0xf145, 0xf146, 0xf147, /*0x98-0x9f*/ + 0xf148, 0xf149, 0xf14a, 0xf14b, 0xf14c, 0xf0a5, 0xf14d, 0xf14e, /*0xa0-0xa7*/ + 0xdcb0, 0xf14f, 0xf150, 0xf151, 0xf152, 0xf153, 0xf154, 0xf155, /*0xa8-0xaf*/ + 0xf156, 0xf157, 0xf158, 0xf159, 0xf15a, 0xf15b, 0xf15c, 0xf15d, /*0xb0-0xb7*/ + 0xf15e, 0xf15f, 0xf160, 0xf161, 0xf162, 0xf163, 0xf164, 0xf165, /*0xb8-0xbf*/ + 0xf166, 0xf167, 0xf168, 0xf169, 0xf16a, 0xf16b, 0xf16c, 0xf16d, /*0xc0-0xc7*/ + 0xf16e, 0xf16f, 0xf170, 0xf171, 0xf172, 0xf173, 0xf174, 0xf175, /*0xc8-0xcf*/ + 0xf176, 0xf177, 0xf178, 0xf179, 0xf17a, 0xf17b, 0xf17c, 0xf17d, /*0xd0-0xd7*/ + 0xf17e, 0xf180, 0xf181, 0xf182, 0xf183, 0xf184, 0xf185, 0xf186, /*0xd8-0xdf*/ + 0xf187, 0xf188, 0xf189, 0xf18a, 0xf18b, 0xf18c, 0xf18d, 0xf18e, /*0xe0-0xe7*/ + 0xf18f, 0xf190, 0xf191, 0xf192, 0xf193, 0xf194, 0xf195, 0xf196, /*0xe8-0xef*/ + 0xf197, 0xf198, 0xf199, 0xf19a, 0xf19b, 0xf19c, 0xf19d, 0xf19e, /*0xf0-0xf7*/ + 0xf19f, 0xf1a0, 0xf240, 0xf241, 0xf242, 0xf243, 0xf244, 0xf245, /*0xf8-0xff*/ + /* 0x9a00 */ + 0xf246, 0xf247, 0xf248, 0xf249, 0xf24a, 0xf24b, 0xf24c, 0xf24d, /*0x00-0x07*/ + 0xf24e, 0xf24f, 0xf250, 0xf251, 0xf252, 0xf253, 0xf254, 0xf255, /*0x08-0x0f*/ + 0xf256, 0xf257, 0xf258, 0xf259, 0xf25a, 0xf25b, 0xf25c, 0xf25d, /*0x10-0x17*/ + 0xf25e, 0xf25f, 0xf260, 0xf261, 0xf262, 0xf263, 0xf264, 0xf265, /*0x18-0x1f*/ + 0xf266, 0xf267, 0xf268, 0xf269, 0xf26a, 0xf26b, 0xf26c, 0xf26d, /*0x20-0x27*/ + 0xf26e, 0xf26f, 0xf270, 0xf271, 0xf272, 0xf273, 0xf274, 0xf275, /*0x28-0x2f*/ + 0xf276, 0xf277, 0xf278, 0xf279, 0xf27a, 0xf27b, 0xf27c, 0xf27d, /*0x30-0x37*/ + 0xf27e, 0xf280, 0xf281, 0xf282, 0xf283, 0xf284, 0xf285, 0xf286, /*0x38-0x3f*/ + 0xf287, 0xf288, 0xf289, 0xf28a, 0xf28b, 0xf28c, 0xf28d, 0xf28e, /*0x40-0x47*/ + 0xf28f, 0xf290, 0xf291, 0xf292, 0xf293, 0xf294, 0xf295, 0xf296, /*0x48-0x4f*/ + 0xf297, 0xf298, 0xf299, 0xf29a, 0xf29b, 0xf29c, 0xf29d, 0xf29e, /*0x50-0x57*/ + 0xf29f, 0xf2a0, 0xf340, 0xf341, 0xf342, 0xf343, 0xf344, 0xf345, /*0x58-0x5f*/ + 0xf346, 0xf347, 0xf348, 0xf349, 0xf34a, 0xf34b, 0xf34c, 0xf34d, /*0x60-0x67*/ + 0xf34e, 0xf34f, 0xf350, 0xf351, 0xc2ed, 0xd4a6, 0xcdd4, 0xd1b1, /*0x68-0x6f*/ + 0xb3db, 0xc7fd, 0xf352, 0xb2b5, 0xc2bf, 0xe6e0, 0xcabb, 0xe6e1, /*0x70-0x77*/ + 0xe6e2, 0xbed4, 0xe6e3, 0xd7a4, 0xcdd5, 0xe6e5, 0xbcdd, 0xe6e4, /*0x78-0x7f*/ + 0xe6e6, 0xe6e7, 0xc2ee, 0xf353, 0xbdbe, 0xe6e8, 0xc2e6, 0xbaa7, /*0x80-0x87*/ + 0xe6e9, 0xf354, 0xe6ea, 0xb3d2, 0xd1e9, 0xf355, 0xf356, 0xbfa5, /*0x88-0x8f*/ + 0xe6eb, 0xc6ef, 0xe6ec, 0xe6ed, 0xf357, 0xf358, 0xe6ee, 0xc6ad, /*0x90-0x97*/ + 0xe6ef, 0xf359, 0xc9a7, 0xe6f0, 0xe6f1, 0xe6f2, 0xe5b9, 0xe6f3, /*0x98-0x9f*/ + 0xe6f4, 0xc2e2, 0xe6f5, 0xe6f6, 0xd6e8, 0xe6f7, 0xf35a, 0xe6f8, /*0xa0-0xa7*/ + 0xb9c7, 0xf35b, 0xf35c, 0xf35d, 0xf35e, 0xf35f, 0xf360, 0xf361, /*0xa8-0xaf*/ + 0xf7bb, 0xf7ba, 0xf362, 0xf363, 0xf364, 0xf365, 0xf7be, 0xf7bc, /*0xb0-0xb7*/ + 0xbaa1, 0xf366, 0xf7bf, 0xf367, 0xf7c0, 0xf368, 0xf369, 0xf36a, /*0xb8-0xbf*/ + 0xf7c2, 0xf7c1, 0xf7c4, 0xf36b, 0xf36c, 0xf7c3, 0xf36d, 0xf36e, /*0xc0-0xc7*/ + 0xf36f, 0xf370, 0xf371, 0xf7c5, 0xf7c6, 0xf372, 0xf373, 0xf374, /*0xc8-0xcf*/ + 0xf375, 0xf7c7, 0xf376, 0xcbe8, 0xf377, 0xf378, 0xf379, 0xf37a, /*0xd0-0xd7*/ + 0xb8df, 0xf37b, 0xf37c, 0xf37d, 0xf37e, 0xf380, 0xf381, 0xf7d4, /*0xd8-0xdf*/ + 0xf382, 0xf7d5, 0xf383, 0xf384, 0xf385, 0xf386, 0xf7d6, 0xf387, /*0xe0-0xe7*/ + 0xf388, 0xf389, 0xf38a, 0xf7d8, 0xf38b, 0xf7da, 0xf38c, 0xf7d7, /*0xe8-0xef*/ + 0xf38d, 0xf38e, 0xf38f, 0xf390, 0xf391, 0xf392, 0xf393, 0xf394, /*0xf0-0xf7*/ + 0xf395, 0xf7db, 0xf396, 0xf7d9, 0xf397, 0xf398, 0xf399, 0xf39a, /*0xf8-0xff*/ + /* 0x9b00 */ + 0xf39b, 0xf39c, 0xf39d, 0xd7d7, 0xf39e, 0xf39f, 0xf3a0, 0xf440, /*0x00-0x07*/ + 0xf7dc, 0xf441, 0xf442, 0xf443, 0xf444, 0xf445, 0xf446, 0xf7dd, /*0x08-0x0f*/ + 0xf447, 0xf448, 0xf449, 0xf7de, 0xf44a, 0xf44b, 0xf44c, 0xf44d, /*0x10-0x17*/ + 0xf44e, 0xf44f, 0xf450, 0xf451, 0xf452, 0xf453, 0xf454, 0xf7df, /*0x18-0x1f*/ + 0xf455, 0xf456, 0xf457, 0xf7e0, 0xf458, 0xf459, 0xf45a, 0xf45b, /*0x20-0x27*/ + 0xf45c, 0xf45d, 0xf45e, 0xf45f, 0xf460, 0xf461, 0xf462, 0xdbcb, /*0x28-0x2f*/ + 0xf463, 0xf464, 0xd8aa, 0xf465, 0xf466, 0xf467, 0xf468, 0xf469, /*0x30-0x37*/ + 0xf46a, 0xf46b, 0xf46c, 0xe5f7, 0xb9ed, 0xf46d, 0xf46e, 0xf46f, /*0x38-0x3f*/ + 0xf470, 0xbffd, 0xbbea, 0xf7c9, 0xc6c7, 0xf7c8, 0xf471, 0xf7ca, /*0x40-0x47*/ + 0xf7cc, 0xf7cb, 0xf472, 0xf473, 0xf474, 0xf7cd, 0xf475, 0xceba, /*0x48-0x4f*/ + 0xf476, 0xf7ce, 0xf477, 0xf478, 0xc4a7, 0xf479, 0xf47a, 0xf47b, /*0x50-0x57*/ + 0xf47c, 0xf47d, 0xf47e, 0xf480, 0xf481, 0xf482, 0xf483, 0xf484, /*0x58-0x5f*/ + 0xf485, 0xf486, 0xf487, 0xf488, 0xf489, 0xf48a, 0xf48b, 0xf48c, /*0x60-0x67*/ + 0xf48d, 0xf48e, 0xf48f, 0xf490, 0xf491, 0xf492, 0xf493, 0xf494, /*0x68-0x6f*/ + 0xf495, 0xf496, 0xf497, 0xf498, 0xf499, 0xf49a, 0xf49b, 0xf49c, /*0x70-0x77*/ + 0xf49d, 0xf49e, 0xf49f, 0xf4a0, 0xf540, 0xf541, 0xf542, 0xf543, /*0x78-0x7f*/ + 0xf544, 0xf545, 0xf546, 0xf547, 0xf548, 0xf549, 0xf54a, 0xf54b, /*0x80-0x87*/ + 0xf54c, 0xf54d, 0xf54e, 0xf54f, 0xf550, 0xf551, 0xf552, 0xf553, /*0x88-0x8f*/ + 0xf554, 0xf555, 0xf556, 0xf557, 0xf558, 0xf559, 0xf55a, 0xf55b, /*0x90-0x97*/ + 0xf55c, 0xf55d, 0xf55e, 0xf55f, 0xf560, 0xf561, 0xf562, 0xf563, /*0x98-0x9f*/ + 0xf564, 0xf565, 0xf566, 0xf567, 0xf568, 0xf569, 0xf56a, 0xf56b, /*0xa0-0xa7*/ + 0xf56c, 0xf56d, 0xf56e, 0xf56f, 0xf570, 0xf571, 0xf572, 0xf573, /*0xa8-0xaf*/ + 0xf574, 0xf575, 0xf576, 0xf577, 0xf578, 0xf579, 0xf57a, 0xf57b, /*0xb0-0xb7*/ + 0xf57c, 0xf57d, 0xf57e, 0xf580, 0xf581, 0xf582, 0xf583, 0xf584, /*0xb8-0xbf*/ + 0xf585, 0xf586, 0xf587, 0xf588, 0xf589, 0xf58a, 0xf58b, 0xf58c, /*0xc0-0xc7*/ + 0xf58d, 0xf58e, 0xf58f, 0xf590, 0xf591, 0xf592, 0xf593, 0xf594, /*0xc8-0xcf*/ + 0xf595, 0xf596, 0xf597, 0xf598, 0xf599, 0xf59a, 0xf59b, 0xf59c, /*0xd0-0xd7*/ + 0xf59d, 0xf59e, 0xf59f, 0xf5a0, 0xf640, 0xf641, 0xf642, 0xf643, /*0xd8-0xdf*/ + 0xf644, 0xf645, 0xf646, 0xf647, 0xf648, 0xf649, 0xf64a, 0xf64b, /*0xe0-0xe7*/ + 0xf64c, 0xf64d, 0xf64e, 0xf64f, 0xf650, 0xf651, 0xf652, 0xf653, /*0xe8-0xef*/ + 0xf654, 0xf655, 0xf656, 0xf657, 0xf658, 0xf659, 0xf65a, 0xf65b, /*0xf0-0xf7*/ + 0xf65c, 0xf65d, 0xf65e, 0xf65f, 0xf660, 0xf661, 0xf662, 0xf663, /*0xf8-0xff*/ + /* 0x9c00 */ + 0xf664, 0xf665, 0xf666, 0xf667, 0xf668, 0xf669, 0xf66a, 0xf66b, /*0x00-0x07*/ + 0xf66c, 0xf66d, 0xf66e, 0xf66f, 0xf670, 0xf671, 0xf672, 0xf673, /*0x08-0x0f*/ + 0xf674, 0xf675, 0xf676, 0xf677, 0xf678, 0xf679, 0xf67a, 0xf67b, /*0x10-0x17*/ + 0xf67c, 0xf67d, 0xf67e, 0xf680, 0xf681, 0xf682, 0xf683, 0xf684, /*0x18-0x1f*/ + 0xf685, 0xf686, 0xf687, 0xf688, 0xf689, 0xf68a, 0xf68b, 0xf68c, /*0x20-0x27*/ + 0xf68d, 0xf68e, 0xf68f, 0xf690, 0xf691, 0xf692, 0xf693, 0xf694, /*0x28-0x2f*/ + 0xf695, 0xf696, 0xf697, 0xf698, 0xf699, 0xf69a, 0xf69b, 0xf69c, /*0x30-0x37*/ + 0xf69d, 0xf69e, 0xf69f, 0xf6a0, 0xf740, 0xf741, 0xf742, 0xf743, /*0x38-0x3f*/ + 0xf744, 0xf745, 0xf746, 0xf747, 0xf748, 0xf749, 0xf74a, 0xf74b, /*0x40-0x47*/ + 0xf74c, 0xf74d, 0xf74e, 0xf74f, 0xf750, 0xf751, 0xf752, 0xf753, /*0x48-0x4f*/ + 0xf754, 0xf755, 0xf756, 0xf757, 0xf758, 0xf759, 0xf75a, 0xf75b, /*0x50-0x57*/ + 0xf75c, 0xf75d, 0xf75e, 0xf75f, 0xf760, 0xf761, 0xf762, 0xf763, /*0x58-0x5f*/ + 0xf764, 0xf765, 0xf766, 0xf767, 0xf768, 0xf769, 0xf76a, 0xf76b, /*0x60-0x67*/ + 0xf76c, 0xf76d, 0xf76e, 0xf76f, 0xf770, 0xf771, 0xf772, 0xf773, /*0x68-0x6f*/ + 0xf774, 0xf775, 0xf776, 0xf777, 0xf778, 0xf779, 0xf77a, 0xf77b, /*0x70-0x77*/ + 0xf77c, 0xf77d, 0xf77e, 0xf780, 0xd3e3, 0xf781, 0xf782, 0xf6cf, /*0x78-0x7f*/ + 0xf783, 0xc2b3, 0xf6d0, 0xf784, 0xf785, 0xf6d1, 0xf6d2, 0xf6d3, /*0x80-0x87*/ + 0xf6d4, 0xf786, 0xf787, 0xf6d6, 0xf788, 0xb1ab, 0xf6d7, 0xf789, /*0x88-0x8f*/ + 0xf6d8, 0xf6d9, 0xf6da, 0xf78a, 0xf6db, 0xf6dc, 0xf78b, 0xf78c, /*0x90-0x97*/ + 0xf78d, 0xf78e, 0xf6dd, 0xf6de, 0xcfca, 0xf78f, 0xf6df, 0xf6e0, /*0x98-0x9f*/ + 0xf6e1, 0xf6e2, 0xf6e3, 0xf6e4, 0xc0f0, 0xf6e5, 0xf6e6, 0xf6e7, /*0xa0-0xa7*/ + 0xf6e8, 0xf6e9, 0xf790, 0xf6ea, 0xf791, 0xf6eb, 0xf6ec, 0xf792, /*0xa8-0xaf*/ + 0xf6ed, 0xf6ee, 0xf6ef, 0xf6f0, 0xf6f1, 0xf6f2, 0xf6f3, 0xf6f4, /*0xb0-0xb7*/ + 0xbea8, 0xf793, 0xf6f5, 0xf6f6, 0xf6f7, 0xf6f8, 0xf794, 0xf795, /*0xb8-0xbf*/ + 0xf796, 0xf797, 0xf798, 0xc8fa, 0xf6f9, 0xf6fa, 0xf6fb, 0xf6fc, /*0xc0-0xc7*/ + 0xf799, 0xf79a, 0xf6fd, 0xf6fe, 0xf7a1, 0xf7a2, 0xf7a3, 0xf7a4, /*0xc8-0xcf*/ + 0xf7a5, 0xf79b, 0xf79c, 0xf7a6, 0xf7a7, 0xf7a8, 0xb1ee, 0xf7a9, /*0xd0-0xd7*/ + 0xf7aa, 0xf7ab, 0xf79d, 0xf79e, 0xf7ac, 0xf7ad, 0xc1db, 0xf7ae, /*0xd8-0xdf*/ + 0xf79f, 0xf7a0, 0xf7af, 0xf840, 0xf841, 0xf842, 0xf843, 0xf844, /*0xe0-0xe7*/ + 0xf845, 0xf846, 0xf847, 0xf848, 0xf849, 0xf84a, 0xf84b, 0xf84c, /*0xe8-0xef*/ + 0xf84d, 0xf84e, 0xf84f, 0xf850, 0xf851, 0xf852, 0xf853, 0xf854, /*0xf0-0xf7*/ + 0xf855, 0xf856, 0xf857, 0xf858, 0xf859, 0xf85a, 0xf85b, 0xf85c, /*0xf8-0xff*/ + /* 0x9d00 */ + 0xf85d, 0xf85e, 0xf85f, 0xf860, 0xf861, 0xf862, 0xf863, 0xf864, /*0x00-0x07*/ + 0xf865, 0xf866, 0xf867, 0xf868, 0xf869, 0xf86a, 0xf86b, 0xf86c, /*0x08-0x0f*/ + 0xf86d, 0xf86e, 0xf86f, 0xf870, 0xf871, 0xf872, 0xf873, 0xf874, /*0x10-0x17*/ + 0xf875, 0xf876, 0xf877, 0xf878, 0xf879, 0xf87a, 0xf87b, 0xf87c, /*0x18-0x1f*/ + 0xf87d, 0xf87e, 0xf880, 0xf881, 0xf882, 0xf883, 0xf884, 0xf885, /*0x20-0x27*/ + 0xf886, 0xf887, 0xf888, 0xf889, 0xf88a, 0xf88b, 0xf88c, 0xf88d, /*0x28-0x2f*/ + 0xf88e, 0xf88f, 0xf890, 0xf891, 0xf892, 0xf893, 0xf894, 0xf895, /*0x30-0x37*/ + 0xf896, 0xf897, 0xf898, 0xf899, 0xf89a, 0xf89b, 0xf89c, 0xf89d, /*0x38-0x3f*/ + 0xf89e, 0xf89f, 0xf8a0, 0xf940, 0xf941, 0xf942, 0xf943, 0xf944, /*0x40-0x47*/ + 0xf945, 0xf946, 0xf947, 0xf948, 0xf949, 0xf94a, 0xf94b, 0xf94c, /*0x48-0x4f*/ + 0xf94d, 0xf94e, 0xf94f, 0xf950, 0xf951, 0xf952, 0xf953, 0xf954, /*0x50-0x57*/ + 0xf955, 0xf956, 0xf957, 0xf958, 0xf959, 0xf95a, 0xf95b, 0xf95c, /*0x58-0x5f*/ + 0xf95d, 0xf95e, 0xf95f, 0xf960, 0xf961, 0xf962, 0xf963, 0xf964, /*0x60-0x67*/ + 0xf965, 0xf966, 0xf967, 0xf968, 0xf969, 0xf96a, 0xf96b, 0xf96c, /*0x68-0x6f*/ + 0xf96d, 0xf96e, 0xf96f, 0xf970, 0xf971, 0xf972, 0xf973, 0xf974, /*0x70-0x77*/ + 0xf975, 0xf976, 0xf977, 0xf978, 0xf979, 0xf97a, 0xf97b, 0xf97c, /*0x78-0x7f*/ + 0xf97d, 0xf97e, 0xf980, 0xf981, 0xf982, 0xf983, 0xf984, 0xf985, /*0x80-0x87*/ + 0xf986, 0xf987, 0xf988, 0xf989, 0xf98a, 0xf98b, 0xf98c, 0xf98d, /*0x88-0x8f*/ + 0xf98e, 0xf98f, 0xf990, 0xf991, 0xf992, 0xf993, 0xf994, 0xf995, /*0x90-0x97*/ + 0xf996, 0xf997, 0xf998, 0xf999, 0xf99a, 0xf99b, 0xf99c, 0xf99d, /*0x98-0x9f*/ + 0xf99e, 0xf99f, 0xf9a0, 0xfa40, 0xfa41, 0xfa42, 0xfa43, 0xfa44, /*0xa0-0xa7*/ + 0xfa45, 0xfa46, 0xfa47, 0xfa48, 0xfa49, 0xfa4a, 0xfa4b, 0xfa4c, /*0xa8-0xaf*/ + 0xfa4d, 0xfa4e, 0xfa4f, 0xfa50, 0xfa51, 0xfa52, 0xfa53, 0xfa54, /*0xb0-0xb7*/ + 0xfa55, 0xfa56, 0xfa57, 0xfa58, 0xfa59, 0xfa5a, 0xfa5b, 0xfa5c, /*0xb8-0xbf*/ + 0xfa5d, 0xfa5e, 0xfa5f, 0xfa60, 0xfa61, 0xfa62, 0xfa63, 0xfa64, /*0xc0-0xc7*/ + 0xfa65, 0xfa66, 0xfa67, 0xfa68, 0xfa69, 0xfa6a, 0xfa6b, 0xfa6c, /*0xc8-0xcf*/ + 0xfa6d, 0xfa6e, 0xfa6f, 0xfa70, 0xfa71, 0xfa72, 0xfa73, 0xfa74, /*0xd0-0xd7*/ + 0xfa75, 0xfa76, 0xfa77, 0xfa78, 0xfa79, 0xfa7a, 0xfa7b, 0xfa7c, /*0xd8-0xdf*/ + 0xfa7d, 0xfa7e, 0xfa80, 0xfa81, 0xfa82, 0xfa83, 0xfa84, 0xfa85, /*0xe0-0xe7*/ + 0xfa86, 0xfa87, 0xfa88, 0xfa89, 0xfa8a, 0xfa8b, 0xfa8c, 0xfa8d, /*0xe8-0xef*/ + 0xfa8e, 0xfa8f, 0xfa90, 0xfa91, 0xfa92, 0xfa93, 0xfa94, 0xfa95, /*0xf0-0xf7*/ + 0xfa96, 0xfa97, 0xfa98, 0xfa99, 0xfa9a, 0xfa9b, 0xfa9c, 0xfa9d, /*0xf8-0xff*/ + /* 0x9e00 */ + 0xfa9e, 0xfa9f, 0xfaa0, 0xfb40, 0xfb41, 0xfb42, 0xfb43, 0xfb44, /*0x00-0x07*/ + 0xfb45, 0xfb46, 0xfb47, 0xfb48, 0xfb49, 0xfb4a, 0xfb4b, 0xfb4c, /*0x08-0x0f*/ + 0xfb4d, 0xfb4e, 0xfb4f, 0xfb50, 0xfb51, 0xfb52, 0xfb53, 0xfb54, /*0x10-0x17*/ + 0xfb55, 0xfb56, 0xfb57, 0xfb58, 0xfb59, 0xfb5a, 0xfb5b, 0xc4f1, /*0x18-0x1f*/ + 0xf0af, 0xbca6, 0xf0b0, 0xc3f9, 0xfb5c, 0xc5b8, 0xd1bb, 0xfb5d, /*0x20-0x27*/ + 0xf0b1, 0xf0b2, 0xf0b3, 0xf0b4, 0xf0b5, 0xd1bc, 0xfb5e, 0xd1ec, /*0x28-0x2f*/ + 0xfb5f, 0xf0b7, 0xf0b6, 0xd4a7, 0xfb60, 0xcdd2, 0xf0b8, 0xf0ba, /*0x30-0x37*/ + 0xf0b9, 0xf0bb, 0xf0bc, 0xfb61, 0xfb62, 0xb8eb, 0xf0bd, 0xbae8, /*0x38-0x3f*/ + 0xfb63, 0xf0be, 0xf0bf, 0xbee9, 0xf0c0, 0xb6ec, 0xf0c1, 0xf0c2, /*0x40-0x47*/ + 0xf0c3, 0xf0c4, 0xc8b5, 0xf0c5, 0xf0c6, 0xfb64, 0xf0c7, 0xc5f4, /*0x48-0x4f*/ + 0xfb65, 0xf0c8, 0xfb66, 0xfb67, 0xfb68, 0xf0c9, 0xfb69, 0xf0ca, /*0x50-0x57*/ + 0xf7bd, 0xfb6a, 0xf0cb, 0xf0cc, 0xf0cd, 0xfb6b, 0xf0ce, 0xfb6c, /*0x58-0x5f*/ + 0xfb6d, 0xfb6e, 0xfb6f, 0xf0cf, 0xbad7, 0xfb70, 0xf0d0, 0xf0d1, /*0x60-0x67*/ + 0xf0d2, 0xf0d3, 0xf0d4, 0xf0d5, 0xf0d6, 0xf0d8, 0xfb71, 0xfb72, /*0x68-0x6f*/ + 0xd3a5, 0xf0d7, 0xfb73, 0xf0d9, 0xfb74, 0xfb75, 0xfb76, 0xfb77, /*0x70-0x77*/ + 0xfb78, 0xfb79, 0xfb7a, 0xfb7b, 0xfb7c, 0xfb7d, 0xf5ba, 0xc2b9, /*0x78-0x7f*/ + 0xfb7e, 0xfb80, 0xf7e4, 0xfb81, 0xfb82, 0xfb83, 0xfb84, 0xf7e5, /*0x80-0x87*/ + 0xf7e6, 0xfb85, 0xfb86, 0xf7e7, 0xfb87, 0xfb88, 0xfb89, 0xfb8a, /*0x88-0x8f*/ + 0xfb8b, 0xfb8c, 0xf7e8, 0xc2b4, 0xfb8d, 0xfb8e, 0xfb8f, 0xfb90, /*0x90-0x97*/ + 0xfb91, 0xfb92, 0xfb93, 0xfb94, 0xfb95, 0xf7ea, 0xfb96, 0xf7eb, /*0x98-0x9f*/ + 0xfb97, 0xfb98, 0xfb99, 0xfb9a, 0xfb9b, 0xfb9c, 0xc2f3, 0xfb9d, /*0xa0-0xa7*/ + 0xfb9e, 0xfb9f, 0xfba0, 0xfc40, 0xfc41, 0xfc42, 0xfc43, 0xfc44, /*0xa8-0xaf*/ + 0xfc45, 0xfc46, 0xfc47, 0xfc48, 0xf4f0, 0xfc49, 0xfc4a, 0xfc4b, /*0xb0-0xb7*/ + 0xf4ef, 0xfc4c, 0xfc4d, 0xc2e9, 0xfc4e, 0xf7e1, 0xf7e2, 0xfc4f, /*0xb8-0xbf*/ + 0xfc50, 0xfc51, 0xfc52, 0xfc53, 0xbbc6, 0xfc54, 0xfc55, 0xfc56, /*0xc0-0xc7*/ + 0xfc57, 0xd9e4, 0xfc58, 0xfc59, 0xfc5a, 0xcaf2, 0xc0e8, 0xf0a4, /*0xc8-0xcf*/ + 0xfc5b, 0xbada, 0xfc5c, 0xfc5d, 0xc7ad, 0xfc5e, 0xfc5f, 0xfc60, /*0xd0-0xd7*/ + 0xc4ac, 0xfc61, 0xfc62, 0xf7ec, 0xf7ed, 0xf7ee, 0xfc63, 0xf7f0, /*0xd8-0xdf*/ + 0xf7ef, 0xfc64, 0xf7f1, 0xfc65, 0xfc66, 0xf7f4, 0xfc67, 0xf7f3, /*0xe0-0xe7*/ + 0xfc68, 0xf7f2, 0xf7f5, 0xfc69, 0xfc6a, 0xfc6b, 0xfc6c, 0xf7f6, /*0xe8-0xef*/ + 0xfc6d, 0xfc6e, 0xfc6f, 0xfc70, 0xfc71, 0xfc72, 0xfc73, 0xfc74, /*0xf0-0xf7*/ + 0xfc75, 0xede9, 0xfc76, 0xedea, 0xedeb, 0xfc77, 0xf6bc, 0xfc78, /*0xf8-0xff*/ + /* 0x9f00 */ + 0xfc79, 0xfc7a, 0xfc7b, 0xfc7c, 0xfc7d, 0xfc7e, 0xfc80, 0xfc81, /*0x00-0x07*/ + 0xfc82, 0xfc83, 0xfc84, 0xf6bd, 0xfc85, 0xf6be, 0xb6a6, 0xfc86, /*0x08-0x0f*/ + 0xd8be, 0xfc87, 0xfc88, 0xb9c4, 0xfc89, 0xfc8a, 0xfc8b, 0xd8bb, /*0x10-0x17*/ + 0xfc8c, 0xdcb1, 0xfc8d, 0xfc8e, 0xfc8f, 0xfc90, 0xfc91, 0xfc92, /*0x18-0x1f*/ + 0xcaf3, 0xfc93, 0xf7f7, 0xfc94, 0xfc95, 0xfc96, 0xfc97, 0xfc98, /*0x20-0x27*/ + 0xfc99, 0xfc9a, 0xfc9b, 0xfc9c, 0xf7f8, 0xfc9d, 0xfc9e, 0xf7f9, /*0x28-0x2f*/ + 0xfc9f, 0xfca0, 0xfd40, 0xfd41, 0xfd42, 0xfd43, 0xfd44, 0xf7fb, /*0x30-0x37*/ + 0xfd45, 0xf7fa, 0xfd46, 0xb1c7, 0xfd47, 0xf7fc, 0xf7fd, 0xfd48, /*0x38-0x3f*/ + 0xfd49, 0xfd4a, 0xfd4b, 0xfd4c, 0xf7fe, 0xfd4d, 0xfd4e, 0xfd4f, /*0x40-0x47*/ + 0xfd50, 0xfd51, 0xfd52, 0xfd53, 0xfd54, 0xfd55, 0xfd56, 0xfd57, /*0x48-0x4f*/ + 0xc6eb, 0xecb4, 0xfd58, 0xfd59, 0xfd5a, 0xfd5b, 0xfd5c, 0xfd5d, /*0x50-0x57*/ + 0xfd5e, 0xfd5f, 0xfd60, 0xfd61, 0xfd62, 0xfd63, 0xfd64, 0xfd65, /*0x58-0x5f*/ + 0xfd66, 0xfd67, 0xfd68, 0xfd69, 0xfd6a, 0xfd6b, 0xfd6c, 0xfd6d, /*0x60-0x67*/ + 0xfd6e, 0xfd6f, 0xfd70, 0xfd71, 0xfd72, 0xfd73, 0xfd74, 0xfd75, /*0x68-0x6f*/ + 0xfd76, 0xfd77, 0xfd78, 0xfd79, 0xfd7a, 0xfd7b, 0xfd7c, 0xfd7d, /*0x70-0x77*/ + 0xfd7e, 0xfd80, 0xfd81, 0xfd82, 0xfd83, 0xfd84, 0xfd85, 0xb3dd, /*0x78-0x7f*/ + 0xf6b3, 0xfd86, 0xfd87, 0xf6b4, 0xc1e4, 0xf6b5, 0xf6b6, 0xf6b7, /*0x80-0x87*/ + 0xf6b8, 0xf6b9, 0xf6ba, 0xc8a3, 0xf6bb, 0xfd88, 0xfd89, 0xfd8a, /*0x88-0x8f*/ + 0xfd8b, 0xfd8c, 0xfd8d, 0xfd8e, 0xfd8f, 0xfd90, 0xfd91, 0xfd92, /*0x90-0x97*/ + 0xfd93, 0xc1fa, 0xb9a8, 0xede8, 0xfd94, 0xfd95, 0xfd96, 0xb9ea, /*0x98-0x9f*/ + 0xd9df, 0xfd97, 0xfd98, 0xfd99, 0xfd9a, 0xfd9b, 0x0000, 0x0000, /*0xa0-0xa7*/ +}; +static const unsigned short gbk_pagef9a[32] = { + 0x0000, 0xfd9d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x78-0x7f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x80-0x87*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x88-0x8f*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfd9e, 0x0000, 0x0000, /*0x90-0x97*/ +}; +static const unsigned short gbk_pagef9b[24] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfd9f, /*0xe0-0xe7*/ + 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xe8-0xef*/ + 0x0000, 0xfda0, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0xf0-0xf7*/ +}; +static const unsigned short gbk_pagefa[40] = { + 0x0000, 0x0000, 0x0000, 0x0000, 0xfe40, 0xfe41, 0xfe42, 0xfe43, /*0x08-0x0f*/ + 0x0000, 0xfe44, 0x0000, 0xfe45, 0xfe46, 0x0000, 0x0000, 0x0000, /*0x10-0x17*/ + 0xfe47, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0xfe48, /*0x18-0x1f*/ + 0xfe49, 0xfe4a, 0x0000, 0xfe4b, 0xfe4c, 0x0000, 0x0000, 0xfe4d, /*0x20-0x27*/ + 0xfe4e, 0xfe4f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, /*0x28-0x2f*/ +}; +static const unsigned short gbk_pagefe[64] = { + 0xa955, 0xa6f2, 0x0000, 0xa6f4, 0xa6f5, 0xa6e0, 0xa6e1, 0xa6f0, /*0x30-0x37*/ + 0xa6f1, 0xa6e2, 0xa6e3, 0xa6ee, 0xa6ef, 0xa6e6, 0xa6e7, 0xa6e4, /*0x38-0x3f*/ + 0xa6e5, 0xa6e8, 0xa6e9, 0xa6ea, 0xa6eb, 0x0000, 0x0000, 0x0000, /*0x40-0x47*/ + 0x0000, 0xa968, 0xa969, 0xa96a, 0xa96b, 0xa96c, 0xa96d, 0xa96e, /*0x48-0x4f*/ + 0xa96f, 0xa970, 0xa971, 0x0000, 0xa972, 0xa973, 0xa974, 0xa975, /*0x50-0x57*/ + 0x0000, 0xa976, 0xa977, 0xa978, 0xa979, 0xa97a, 0xa97b, 0xa97c, /*0x58-0x5f*/ + 0xa97d, 0xa97e, 0xa980, 0xa981, 0xa982, 0xa983, 0xa984, 0x0000, /*0x60-0x67*/ + 0xa985, 0xa986, 0xa987, 0xa988, 0x0000, 0x0000, 0x0000, 0x0000, /*0x68-0x6f*/ +}; +static const unsigned short gbk_pageffa[96] = { + 0x0000, 0xa3a1, 0xa3a2, 0xa3a3, 0xa1e7, 0xa3a5, 0xa3a6, 0xa3a7, /*0x00-0x07*/ + 0xa3a8, 0xa3a9, 0xa3aa, 0xa3ab, 0xa3ac, 0xa3ad, 0xa3ae, 0xa3af, /*0x08-0x0f*/ + 0xa3b0, 0xa3b1, 0xa3b2, 0xa3b3, 0xa3b4, 0xa3b5, 0xa3b6, 0xa3b7, /*0x10-0x17*/ + 0xa3b8, 0xa3b9, 0xa3ba, 0xa3bb, 0xa3bc, 0xa3bd, 0xa3be, 0xa3bf, /*0x18-0x1f*/ + 0xa3c0, 0xa3c1, 0xa3c2, 0xa3c3, 0xa3c4, 0xa3c5, 0xa3c6, 0xa3c7, /*0x20-0x27*/ + 0xa3c8, 0xa3c9, 0xa3ca, 0xa3cb, 0xa3cc, 0xa3cd, 0xa3ce, 0xa3cf, /*0x28-0x2f*/ + 0xa3d0, 0xa3d1, 0xa3d2, 0xa3d3, 0xa3d4, 0xa3d5, 0xa3d6, 0xa3d7, /*0x30-0x37*/ + 0xa3d8, 0xa3d9, 0xa3da, 0xa3db, 0xa3dc, 0xa3dd, 0xa3de, 0xa3df, /*0x38-0x3f*/ + 0xa3e0, 0xa3e1, 0xa3e2, 0xa3e3, 0xa3e4, 0xa3e5, 0xa3e6, 0xa3e7, /*0x40-0x47*/ + 0xa3e8, 0xa3e9, 0xa3ea, 0xa3eb, 0xa3ec, 0xa3ed, 0xa3ee, 0xa3ef, /*0x48-0x4f*/ + 0xa3f0, 0xa3f1, 0xa3f2, 0xa3f3, 0xa3f4, 0xa3f5, 0xa3f6, 0xa3f7, /*0x50-0x57*/ + 0xa3f8, 0xa3f9, 0xa3fa, 0xa3fb, 0xa3fc, 0xa3fd, 0xa1ab, 0x0000, /*0x58-0x5f*/ +}; +static const unsigned short gbk_pageffb[8] = { + 0xa1e9, 0xa1ea, 0xa956, 0xa3fe, 0xa957, 0xa3a4, 0x0000, 0x0000, /*0xe0-0xe7*/ +}; + +static int +gbk_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + unsigned short c = 0; + if (wc >= 0x00a0 && wc < 0x0170) + c = gbk_page00[wc-0x00a0]; + else if (wc >= 0x01c8 && wc < 0x01e0) + c = gbk_page01[wc-0x01c8]; + else if (wc >= 0x0250 && wc < 0x0268) + c = gbk_page02a[wc-0x0250]; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = gbk_page02b[wc-0x02c0]; + else if (wc >= 0x0390 && wc < 0x03d0) + c = gbk_page03[wc-0x0390]; + else if (wc >= 0x0400 && wc < 0x0458) + c = gbk_page04[wc-0x0400]; + else if (wc >= 0x2010 && wc < 0x2040) + c = gbk_page20[wc-0x2010]; + else if (wc >= 0x2100 && wc < 0x21a0) + c = gbk_page21[wc-0x2100]; + else if (wc >= 0x2208 && wc < 0x22c0) + c = gbk_page22[wc-0x2208]; + else if (wc == 0x2312) + c = 0xa1d0; + else if (wc >= 0x2460 && wc < 0x24a0) + c = gbk_page24[wc-0x2460]; + else if (wc >= 0x2500 && wc < 0x25e8) + c = gbk_page25[wc-0x2500]; + else if (wc >= 0x2600 && wc < 0x2648) + c = gbk_page26[wc-0x2600]; + else if (wc >= 0x3000 && wc < 0x3130) + c = gbk_page30[wc-0x3000]; + else if (wc >= 0x3220 && wc < 0x3238) + c = gbk_page32[wc-0x3220]; + else if (wc == 0x32a3) + c = 0xa949; + else if (wc >= 0x3388 && wc < 0x33d8) + c = gbk_page33[wc-0x3388]; + else if (wc >= 0x4e00 && wc < 0x9fa8) + c = gbk_page4e[wc-0x4e00]; + else if (wc == 0xf92c) + c = 0xfd9c; + else if (wc >= 0xf978 && wc < 0xf998) + c = gbk_pagef9a[wc-0xf978]; + else if (wc >= 0xf9e0 && wc < 0xf9f8) + c = gbk_pagef9b[wc-0xf9e0]; + else if (wc >= 0xfa08 && wc < 0xfa30) + c = gbk_pagefa[wc-0xfa08]; + else if (wc >= 0xfe30 && wc < 0xfe70) + c = gbk_pagefe[wc-0xfe30]; + else if (wc >= 0xff00 && wc < 0xff60) + c = gbk_pageffa[wc-0xff00]; + else if (wc >= 0xffe0 && wc < 0xffe8) + c = gbk_pageffb[wc-0xffe0]; + if (c != 0) { + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_academy.h b/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_academy.h new file mode 100644 index 000000000..0e4350461 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_academy.h @@ -0,0 +1,87 @@ + +/* + * GEORGIAN-ACADEMY + */ + +static const unsigned short georgian_academy_2uni[32] = { + /* 0x80 */ + 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, + /* 0x90 */ + 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, +}; + +static int +georgian_academy_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0x80 && c < 0xa0) + *pwc = (ucs4_t) georgian_academy_2uni[c-0x80]; + else if (c >= 0xc0 && c < 0xe7) + *pwc = (ucs4_t) c + 0x1010; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char georgian_academy_page00[32] = { + 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ +}; +static const unsigned char georgian_academy_page01[72] = { + 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char georgian_academy_page02[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ +}; +static const unsigned char georgian_academy_page20[48] = { + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +georgian_academy_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x0080 && wc < 0x00a0) + c = georgian_academy_page00[wc-0x0080]; + else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e7 && wc < 0x0100)) + c = wc; + else if (wc >= 0x0150 && wc < 0x0198) + c = georgian_academy_page01[wc-0x0150]; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = georgian_academy_page02[wc-0x02c0]; + else if (wc >= 0x10d0 && wc < 0x10f7) + c = wc-0x1010; + else if (wc >= 0x2010 && wc < 0x2040) + c = georgian_academy_page20[wc-0x2010]; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_ps.h b/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_ps.h new file mode 100644 index 000000000..b96c491df --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/georgian_ps.h @@ -0,0 +1,104 @@ + +/* + * GEORGIAN-PS + */ + +static const unsigned short georgian_ps_2uni_1[32] = { + /* 0x80 */ + 0x0080, 0x0081, 0x201a, 0x0192, 0x201e, 0x2026, 0x2020, 0x2021, + 0x02c6, 0x2030, 0x0160, 0x2039, 0x0152, 0x008d, 0x008e, 0x008f, + /* 0x90 */ + 0x0090, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x02dc, 0x2122, 0x0161, 0x203a, 0x0153, 0x009d, 0x009e, 0x0178, +}; +static const unsigned short georgian_ps_2uni_2[39] = { + /* 0xc0 */ + 0x10d0, 0x10d1, 0x10d2, 0x10d3, 0x10d4, 0x10d5, 0x10d6, 0x10f1, + 0x10d7, 0x10d8, 0x10d9, 0x10da, 0x10db, 0x10dc, 0x10f2, 0x10dd, + /* 0xd0 */ + 0x10de, 0x10df, 0x10e0, 0x10e1, 0x10e2, 0x10f3, 0x10e3, 0x10e4, + 0x10e5, 0x10e6, 0x10e7, 0x10e8, 0x10e9, 0x10ea, 0x10eb, 0x10ec, + /* 0xe0 */ + 0x10ed, 0x10ee, 0x10f4, 0x10ef, 0x10f0, 0x10f5, +}; + +static int +georgian_ps_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0x80 && c < 0xa0) + *pwc = (ucs4_t) georgian_ps_2uni_1[c-0x80]; + else if (c >= 0xc0 && c < 0xe6) + *pwc = (ucs4_t) georgian_ps_2uni_2[c-0xc0]; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char georgian_ps_page00[32] = { + 0x80, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x8e, 0x8f, /* 0x88-0x8f */ + 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x9d, 0x9e, 0x00, /* 0x98-0x9f */ +}; +static const unsigned char georgian_ps_page01[72] = { + 0x00, 0x00, 0x8c, 0x9c, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x9f, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x83, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char georgian_ps_page02[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x98, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ +}; +static const unsigned char georgian_ps_page10[40] = { + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc8, /* 0xd0-0xd7 */ + 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xcf, 0xd0, 0xd1, /* 0xd8-0xdf */ + 0xd2, 0xd3, 0xd4, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, /* 0xe0-0xe7 */ + 0xdb, 0xdc, 0xdd, 0xde, 0xdf, 0xe0, 0xe1, 0xe3, /* 0xe8-0xef */ + 0xe4, 0xc7, 0xce, 0xd5, 0xe2, 0xe5, 0x00, 0x00, /* 0xf0-0xf7 */ +}; +static const unsigned char georgian_ps_page20[48] = { + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; + +static int +georgian_ps_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x0080 && wc < 0x00a0) + c = georgian_ps_page00[wc-0x0080]; + else if ((wc >= 0x00a0 && wc < 0x00c0) || (wc >= 0x00e6 && wc < 0x0100)) + c = wc; + else if (wc >= 0x0150 && wc < 0x0198) + c = georgian_ps_page01[wc-0x0150]; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = georgian_ps_page02[wc-0x02c0]; + else if (wc >= 0x10d0 && wc < 0x10f8) + c = georgian_ps_page10[wc-0x10d0]; + else if (wc >= 0x2010 && wc < 0x2040) + c = georgian_ps_page20[wc-0x2010]; + else if (wc == 0x2122) + c = 0x99; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_1.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_1.h new file mode 100644 index 000000000..fc302bb44 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_1.h @@ -0,0 +1,22 @@ + +/* + * ISO-8859-1 + */ + +static int +iso8859_1_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + *pwc = (ucs4_t) c; + return 1; +} + +static int +iso8859_1_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (wc < 0x0100) { + *r = wc; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_10.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_10.h new file mode 100644 index 000000000..508db5758 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_10.h @@ -0,0 +1,87 @@ + +/* + * ISO-8859-10 + */ + +static const unsigned short iso8859_10_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0104, 0x0112, 0x0122, 0x012a, 0x0128, 0x0136, 0x00a7, + 0x013b, 0x0110, 0x0160, 0x0166, 0x017d, 0x00ad, 0x016a, 0x014a, + /* 0xb0 */ + 0x00b0, 0x0105, 0x0113, 0x0123, 0x012b, 0x0129, 0x0137, 0x00b7, + 0x013c, 0x0111, 0x0161, 0x0167, 0x017e, 0x2015, 0x016b, 0x014b, + /* 0xc0 */ + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x00cf, + /* 0xd0 */ + 0x00d0, 0x0145, 0x014c, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x0168, + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x00de, 0x00df, + /* 0xe0 */ + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x00f0, 0x0146, 0x014d, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x0169, + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x00fe, 0x0138, +}; + +static int +iso8859_10_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) iso8859_10_2uni[c-0xa0]; + return 1; +} + +static const unsigned char iso8859_10_page00[224] = { + 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0xb0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ + 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0xd0, 0x00, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ + 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xd8-0xdf */ + 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ + 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0xf0, 0x00, 0x00, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ + 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xf8-0xff */ + /* 0x0100 */ + 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ + 0xa9, 0xb9, 0xa2, 0xb2, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ + 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0xa3, 0xb3, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0xa5, 0xb5, 0xa4, 0xb4, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, /* 0x30-0x37 */ + 0xff, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0xaf, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xaa, 0xba, 0x00, 0x00, 0x00, 0x00, 0xab, 0xbb, /* 0x60-0x67 */ + 0xd7, 0xf7, 0xae, 0xbe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, 0x00, /* 0x78-0x7f */ +}; + +static int +iso8859_10_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0180) + c = iso8859_10_page00[wc-0x00a0]; + else if (wc == 0x2015) + c = 0xbd; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_11.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_11.h new file mode 100644 index 000000000..5458da514 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_11.h @@ -0,0 +1,77 @@ + +/* + * ISO8859-11 + */ + +static const unsigned short iso8859_11_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + /* 0xb0 */ + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + /* 0xc0 */ + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + /* 0xd0 */ + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, + /* 0xe0 */ + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + /* 0xf0 */ + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, +}; + +static int +iso8859_11_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + *pwc = (ucs4_t) c; + return 1; + } + else if (c < 0xa0) { + } + else { + unsigned short wc = iso8859_11_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char iso8859_11_page0e[96] = { + 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ +}; + +static int +iso8859_11_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080 || wc == 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x0e00 && wc < 0x0e60) + c = iso8859_11_page0e[wc-0x0e00]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_13.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_13.h new file mode 100644 index 000000000..c041b154a --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_13.h @@ -0,0 +1,90 @@ + +/* + * ISO-8859-13 + */ + +static const unsigned short iso8859_13_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x201d, 0x00a2, 0x00a3, 0x00a4, 0x201e, 0x00a6, 0x00a7, + 0x00d8, 0x00a9, 0x0156, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00c6, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x201c, 0x00b5, 0x00b6, 0x00b7, + 0x00f8, 0x00b9, 0x0157, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0x00e6, + /* 0xc0 */ + 0x0104, 0x012e, 0x0100, 0x0106, 0x00c4, 0x00c5, 0x0118, 0x0112, + 0x010c, 0x00c9, 0x0179, 0x0116, 0x0122, 0x0136, 0x012a, 0x013b, + /* 0xd0 */ + 0x0160, 0x0143, 0x0145, 0x00d3, 0x014c, 0x00d5, 0x00d6, 0x00d7, + 0x0172, 0x0141, 0x015a, 0x016a, 0x00dc, 0x017b, 0x017d, 0x00df, + /* 0xe0 */ + 0x0105, 0x012f, 0x0101, 0x0107, 0x00e4, 0x00e5, 0x0119, 0x0113, + 0x010d, 0x00e9, 0x017a, 0x0117, 0x0123, 0x0137, 0x012b, 0x013c, + /* 0xf0 */ + 0x0161, 0x0144, 0x0146, 0x00f3, 0x014d, 0x00f5, 0x00f6, 0x00f7, + 0x0173, 0x0142, 0x015b, 0x016b, 0x00fc, 0x017c, 0x017e, 0x2019, +}; + +static int +iso8859_13_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) iso8859_13_2uni[c-0xa0]; + return 1; +} + +static const unsigned char iso8859_13_page00[224] = { + 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0xc4, 0xc5, 0xaf, 0x00, /* 0xc0-0xc7 */ + 0x00, 0xc9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0xd3, 0x00, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xa8, 0x00, 0x00, 0x00, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0xe4, 0xe5, 0xbf, 0x00, /* 0xe0-0xe7 */ + 0x00, 0xe9, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0xf3, 0x00, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xb8, 0x00, 0x00, 0x00, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ + /* 0x0100 */ + 0xc2, 0xe2, 0x00, 0x00, 0xc0, 0xe0, 0xc3, 0xe3, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0xc7, 0xe7, 0x00, 0x00, 0xcb, 0xeb, /* 0x10-0x17 */ + 0xc6, 0xe6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0xce, 0xee, 0x00, 0x00, 0xc1, 0xe1, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xcd, 0xed, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0xcf, 0xef, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0xd9, 0xf9, 0xd1, 0xf1, 0xd2, 0xf2, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0xd4, 0xf4, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0x50-0x57 */ + 0x00, 0x00, 0xda, 0xfa, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0xca, 0xea, 0xdd, 0xfd, 0xde, 0xfe, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char iso8859_13_page20[8] = { + 0x00, 0xff, 0x00, 0x00, 0xb4, 0xa1, 0xa5, 0x00, /* 0x18-0x1f */ +}; + +static int +iso8859_13_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0180) + c = iso8859_13_page00[wc-0x00a0]; + else if (wc >= 0x2018 && wc < 0x2020) + c = iso8859_13_page20[wc-0x2018]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_14.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_14.h new file mode 100644 index 000000000..f01581492 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_14.h @@ -0,0 +1,108 @@ + +/* + * ISO-8859-14 + */ + +static const unsigned short iso8859_14_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x1e02, 0x1e03, 0x00a3, 0x010a, 0x010b, 0x1e0a, 0x00a7, + 0x1e80, 0x00a9, 0x1e82, 0x1e0b, 0x1ef2, 0x00ad, 0x00ae, 0x0178, + /* 0xb0 */ + 0x1e1e, 0x1e1f, 0x0120, 0x0121, 0x1e40, 0x1e41, 0x00b6, 0x1e56, + 0x1e81, 0x1e57, 0x1e83, 0x1e60, 0x1ef3, 0x1e84, 0x1e85, 0x1e61, + /* 0xc0 */ + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + /* 0xd0 */ + 0x0174, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x1e6a, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x00dd, 0x0176, 0x00df, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x0175, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x1e6b, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x00fd, 0x0177, 0x00ff, +}; + +static int +iso8859_14_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0xa0) + *pwc = (ucs4_t) iso8859_14_2uni[c-0xa0]; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char iso8859_14_page00[96] = { + 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0x00, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb6, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0x00, 0xff, /* 0xf8-0xff */ +}; +static const unsigned char iso8859_14_page01_0[32] = { + 0x00, 0x00, 0xa4, 0xa5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0xb2, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ +}; +static const unsigned char iso8859_14_page01_1[16] = { + 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, 0xde, 0xfe, /* 0x70-0x77 */ + 0xaf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char iso8859_14_page1e_0[136] = { + 0x00, 0x00, 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0xa6, 0xab, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb0, 0xb1, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0xb4, 0xb5, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, 0xb9, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xbb, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0xa8, 0xb8, 0xaa, 0xba, 0xbd, 0xbe, 0x00, 0x00, /* 0x80-0x87 */ +}; +static const unsigned char iso8859_14_page1e_1[8] = { + 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0xf0-0xf7 */ +}; + +static int +iso8859_14_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0100) + c = iso8859_14_page00[wc-0x00a0]; + else if (wc >= 0x0108 && wc < 0x0128) + c = iso8859_14_page01_0[wc-0x0108]; + else if (wc >= 0x0170 && wc < 0x0180) + c = iso8859_14_page01_1[wc-0x0170]; + else if (wc >= 0x1e00 && wc < 0x1e88) + c = iso8859_14_page1e_0[wc-0x1e00]; + else if (wc >= 0x1ef0 && wc < 0x1ef8) + c = iso8859_14_page1e_1[wc-0x1ef0]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h new file mode 100644 index 000000000..631d9b5e2 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_15.h @@ -0,0 +1,62 @@ + +/* + * ISO-8859-15 + */ + +static const unsigned short iso8859_15_2uni[32] = { + /* 0xa0 */ + 0x00a0, 0x00a1, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x00aa, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x017d, 0x00b5, 0x00b6, 0x00b7, + 0x017e, 0x00b9, 0x00ba, 0x00bb, 0x0152, 0x0153, 0x0178, 0x00bf, +}; + +static int +iso8859_15_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0xa0 && c < 0xc0) + *pwc = (ucs4_t) iso8859_15_2uni[c-0xa0]; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char iso8859_15_page00[32] = { + 0xa0, 0xa1, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0xb9, 0xba, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0xb8-0xbf */ +}; +static const unsigned char iso8859_15_page01[48] = { + 0x00, 0x00, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0xbe, 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ +}; + +static int +iso8859_15_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00c0) + c = iso8859_15_page00[wc-0x00a0]; + else if (wc >= 0x00c0 && wc < 0x0100) + c = wc; + else if (wc >= 0x0150 && wc < 0x0180) + c = iso8859_15_page01[wc-0x0150]; + else if (wc == 0x20ac) + c = 0xa4; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_16.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_16.h new file mode 100644 index 000000000..99a54d98f --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_16.h @@ -0,0 +1,97 @@ + +/* + * ISO-8859-16 + */ + +static const unsigned short iso8859_16_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0104, 0x0105, 0x0141, 0x20ac, 0x201e, 0x0160, 0x00a7, + 0x0161, 0x00a9, 0x0218, 0x00ab, 0x0179, 0x00ad, 0x017a, 0x017b, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x010c, 0x0142, 0x017d, 0x201d, 0x00b6, 0x00b7, + 0x017e, 0x010d, 0x0219, 0x00bb, 0x0152, 0x0153, 0x0178, 0x017c, + /* 0xc0 */ + 0x00c0, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0106, 0x00c6, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + /* 0xd0 */ + 0x0110, 0x0143, 0x00d2, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x015a, + 0x0170, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0118, 0x021a, 0x00df, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x0107, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x0111, 0x0144, 0x00f2, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x015b, + 0x0171, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0119, 0x021b, 0x00ff, +}; + +static int +iso8859_16_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) iso8859_16_2uni[c-0xa0]; + return 1; +} + +static const unsigned char iso8859_16_page00[224] = { + 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0x00, 0x00, 0x00, 0x00, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0xc6, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0x00, 0x00, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0x00, /* 0xd0-0xd7 */ + 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0x00, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0x00, /* 0xf0-0xf7 */ + 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ + /* 0x0100 */ + 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xa2, 0xc5, 0xe5, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0xb2, 0xb9, 0x00, 0x00, /* 0x08-0x0f */ + 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0xd5, 0xf5, 0xbc, 0xbd, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0xd7, 0xf7, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xa6, 0xa8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0xd8, 0xf8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0xbe, 0xac, 0xae, 0xaf, 0xbf, 0xb4, 0xb8, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char iso8859_16_page02[8] = { + 0xaa, 0xba, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ +}; +static const unsigned char iso8859_16_page20[8] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0xb5, 0xa5, 0x00, /* 0x18-0x1f */ +}; + +static int +iso8859_16_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0180) + c = iso8859_16_page00[wc-0x00a0]; + else if (wc >= 0x0218 && wc < 0x0220) + c = iso8859_16_page02[wc-0x0218]; + else if (wc >= 0x2018 && wc < 0x2020) + c = iso8859_16_page20[wc-0x2018]; + else if (wc == 0x20ac) + c = 0xa4; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_2.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_2.h new file mode 100644 index 000000000..a63d00424 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_2.h @@ -0,0 +1,93 @@ + +/* + * ISO-8859-2 + */ + +static const unsigned short iso8859_2_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0104, 0x02d8, 0x0141, 0x00a4, 0x013d, 0x015a, 0x00a7, + 0x00a8, 0x0160, 0x015e, 0x0164, 0x0179, 0x00ad, 0x017d, 0x017b, + /* 0xb0 */ + 0x00b0, 0x0105, 0x02db, 0x0142, 0x00b4, 0x013e, 0x015b, 0x02c7, + 0x00b8, 0x0161, 0x015f, 0x0165, 0x017a, 0x02dd, 0x017e, 0x017c, + /* 0xc0 */ + 0x0154, 0x00c1, 0x00c2, 0x0102, 0x00c4, 0x0139, 0x0106, 0x00c7, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x011a, 0x00cd, 0x00ce, 0x010e, + /* 0xd0 */ + 0x0110, 0x0143, 0x0147, 0x00d3, 0x00d4, 0x0150, 0x00d6, 0x00d7, + 0x0158, 0x016e, 0x00da, 0x0170, 0x00dc, 0x00dd, 0x0162, 0x00df, + /* 0xe0 */ + 0x0155, 0x00e1, 0x00e2, 0x0103, 0x00e4, 0x013a, 0x0107, 0x00e7, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x011b, 0x00ed, 0x00ee, 0x010f, + /* 0xf0 */ + 0x0111, 0x0144, 0x0148, 0x00f3, 0x00f4, 0x0151, 0x00f6, 0x00f7, + 0x0159, 0x016f, 0x00fa, 0x0171, 0x00fc, 0x00fd, 0x0163, 0x02d9, +}; + +static int +iso8859_2_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) iso8859_2_2uni[c-0xa0]; + return 1; +} + +static const unsigned char iso8859_2_page00[224] = { + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ + 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0x00, 0x00, 0xda, 0x00, 0xdc, 0xdd, 0x00, 0xdf, /* 0xd8-0xdf */ + 0x00, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ + 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0x00, 0x00, 0xfa, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ + /* 0x0100 */ + 0x00, 0x00, 0xc3, 0xe3, 0xa1, 0xb1, 0xc6, 0xe6, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0xcf, 0xef, /* 0x08-0x0f */ + 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0xca, 0xea, 0xcc, 0xec, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0xc5, 0xe5, 0x00, 0x00, 0xa5, 0xb5, 0x00, /* 0x38-0x3f */ + 0x00, 0xa3, 0xb3, 0xd1, 0xf1, 0x00, 0x00, 0xd2, /* 0x40-0x47 */ + 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0xd5, 0xf5, 0x00, 0x00, 0xc0, 0xe0, 0x00, 0x00, /* 0x50-0x57 */ + 0xd8, 0xf8, 0xa6, 0xb6, 0x00, 0x00, 0xaa, 0xba, /* 0x58-0x5f */ + 0xa9, 0xb9, 0xde, 0xfe, 0xab, 0xbb, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd9, 0xf9, /* 0x68-0x6f */ + 0xdb, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0xac, 0xbc, 0xaf, 0xbf, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char iso8859_2_page02[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0xa2, 0xff, 0x00, 0xb2, 0x00, 0xbd, 0x00, 0x00, /* 0xd8-0xdf */ +}; + +static int +iso8859_2_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0180) + c = iso8859_2_page00[wc-0x00a0]; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = iso8859_2_page02[wc-0x02c0]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_3.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_3.h new file mode 100644 index 000000000..2282f19cf --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_3.h @@ -0,0 +1,99 @@ + +/* + * ISO-8859-3 + */ + +static const unsigned short iso8859_3_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0126, 0x02d8, 0x00a3, 0x00a4, 0xfffd, 0x0124, 0x00a7, + 0x00a8, 0x0130, 0x015e, 0x011e, 0x0134, 0x00ad, 0xfffd, 0x017b, + /* 0xb0 */ + 0x00b0, 0x0127, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x0125, 0x00b7, + 0x00b8, 0x0131, 0x015f, 0x011f, 0x0135, 0x00bd, 0xfffd, 0x017c, + /* 0xc0 */ + 0x00c0, 0x00c1, 0x00c2, 0xfffd, 0x00c4, 0x010a, 0x0108, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + /* 0xd0 */ + 0xfffd, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x0120, 0x00d6, 0x00d7, + 0x011c, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x016c, 0x015c, 0x00df, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0xfffd, 0x00e4, 0x010b, 0x0109, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0xfffd, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x0121, 0x00f6, 0x00f7, + 0x011d, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x016d, 0x015d, 0x02d9, +}; + +static int +iso8859_3_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = iso8859_3_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char iso8859_3_page00[96] = { + 0xa0, 0x00, 0x00, 0xa3, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0x00, 0x00, 0x00, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0x00, 0xc4, 0x00, 0x00, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0x00, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0x00, 0xe4, 0x00, 0x00, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0x00, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; +static const unsigned char iso8859_3_page01[120] = { + 0xc6, 0xe6, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0xd8, 0xf8, 0xab, 0xbb, /* 0x18-0x1f */ + 0xd5, 0xf5, 0x00, 0x00, 0xa6, 0xb6, 0xa1, 0xb1, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0xa9, 0xb9, 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, 0xaa, 0xba, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0xdd, 0xfd, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char iso8859_3_page02[8] = { + 0xa2, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ +}; + +static int +iso8859_3_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0100) + c = iso8859_3_page00[wc-0x00a0]; + else if (wc >= 0x0108 && wc < 0x0180) + c = iso8859_3_page01[wc-0x0108]; + else if (wc >= 0x02d8 && wc < 0x02e0) + c = iso8859_3_page02[wc-0x02d8]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_4.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_4.h new file mode 100644 index 000000000..878a7e44a --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_4.h @@ -0,0 +1,93 @@ + +/* + * ISO-8859-4 + */ + +static const unsigned short iso8859_4_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0104, 0x0138, 0x0156, 0x00a4, 0x0128, 0x013b, 0x00a7, + 0x00a8, 0x0160, 0x0112, 0x0122, 0x0166, 0x00ad, 0x017d, 0x00af, + /* 0xb0 */ + 0x00b0, 0x0105, 0x02db, 0x0157, 0x00b4, 0x0129, 0x013c, 0x02c7, + 0x00b8, 0x0161, 0x0113, 0x0123, 0x0167, 0x014a, 0x017e, 0x014b, + /* 0xc0 */ + 0x0100, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x00c6, 0x012e, + 0x010c, 0x00c9, 0x0118, 0x00cb, 0x0116, 0x00cd, 0x00ce, 0x012a, + /* 0xd0 */ + 0x0110, 0x0145, 0x014c, 0x0136, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x0172, 0x00da, 0x00db, 0x00dc, 0x0168, 0x016a, 0x00df, + /* 0xe0 */ + 0x0101, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x012f, + 0x010d, 0x00e9, 0x0119, 0x00eb, 0x0117, 0x00ed, 0x00ee, 0x012b, + /* 0xf0 */ + 0x0111, 0x0146, 0x014d, 0x0137, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x0173, 0x00fa, 0x00fb, 0x00fc, 0x0169, 0x016b, 0x02d9, +}; + +static int +iso8859_4_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) iso8859_4_2uni[c-0xa0]; + return 1; +} + +static const unsigned char iso8859_4_page00[224] = { + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0xb8, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0x00, /* 0xc0-0xc7 */ + 0x00, 0xc9, 0x00, 0xcb, 0x00, 0xcd, 0xce, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0x00, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0x00, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0x00, /* 0xe0-0xe7 */ + 0x00, 0xe9, 0x00, 0xeb, 0x00, 0xed, 0xee, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0x00, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0x00, /* 0xf8-0xff */ + /* 0x0100 */ + 0xc0, 0xe0, 0x00, 0x00, 0xa1, 0xb1, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0xc8, 0xe8, 0x00, 0x00, /* 0x08-0x0f */ + 0xd0, 0xf0, 0xaa, 0xba, 0x00, 0x00, 0xcc, 0xec, /* 0x10-0x17 */ + 0xca, 0xea, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0xab, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0xa5, 0xb5, 0xcf, 0xef, 0x00, 0x00, 0xc7, 0xe7, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd3, 0xf3, /* 0x30-0x37 */ + 0xa2, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xd1, 0xf1, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0xbd, 0xbf, 0xd2, 0xf2, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa3, 0xb3, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0xa9, 0xb9, 0x00, 0x00, 0x00, 0x00, 0xac, 0xbc, /* 0x60-0x67 */ + 0xdd, 0xfd, 0xde, 0xfe, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0xd9, 0xf9, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xae, 0xbe, 0x00, /* 0x78-0x7f */ +}; +static const unsigned char iso8859_4_page02[32] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb7, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0xff, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ +}; + +static int +iso8859_4_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0180) + c = iso8859_4_page00[wc-0x00a0]; + else if (wc >= 0x02c0 && wc < 0x02e0) + c = iso8859_4_page02[wc-0x02c0]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_5.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_5.h new file mode 100644 index 000000000..cdd6c45db --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_5.h @@ -0,0 +1,76 @@ + +/* + * ISO-8859-5 + */ + +static const unsigned short iso8859_5_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0401, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0408, 0x0409, 0x040a, 0x040b, 0x040c, 0x00ad, 0x040e, 0x040f, + /* 0xb0 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + /* 0xc0 */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + /* 0xd0 */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + /* 0xe0 */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, + /* 0xf0 */ + 0x2116, 0x0451, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x00a7, 0x045e, 0x045f, +}; + +static int +iso8859_5_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) iso8859_5_2uni[c-0xa0]; + return 1; +} + +static const unsigned char iso8859_5_page00[16] = { + 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ +}; +static const unsigned char iso8859_5_page04[96] = { + 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x08-0x0f */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x38-0x3f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0xfe, 0xff, /* 0x58-0x5f */ +}; + +static int +iso8859_5_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00b0) + c = iso8859_5_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x0460) + c = iso8859_5_page04[wc-0x0400]; + else if (wc == 0x2116) + c = 0xf0; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_6.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_6.h new file mode 100644 index 000000000..4c80a64f5 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_6.h @@ -0,0 +1,79 @@ + +/* + * ISO-8859-6 + */ + +static const unsigned short iso8859_6_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0xfffd, 0xfffd, 0xfffd, 0x00a4, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x060c, 0x00ad, 0xfffd, 0xfffd, + /* 0xb0 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0x061b, 0xfffd, 0xfffd, 0xfffd, 0x061f, + /* 0xc0 */ + 0xfffd, 0x0621, 0x0622, 0x0623, 0x0624, 0x0625, 0x0626, 0x0627, + 0x0628, 0x0629, 0x062a, 0x062b, 0x062c, 0x062d, 0x062e, 0x062f, + /* 0xd0 */ + 0x0630, 0x0631, 0x0632, 0x0633, 0x0634, 0x0635, 0x0636, 0x0637, + 0x0638, 0x0639, 0x063a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xe0 */ + 0x0640, 0x0641, 0x0642, 0x0643, 0x0644, 0x0645, 0x0646, 0x0647, + 0x0648, 0x0649, 0x064a, 0x064b, 0x064c, 0x064d, 0x064e, 0x064f, + /* 0xf0 */ + 0x0650, 0x0651, 0x0652, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, +}; + +static int +iso8859_6_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = iso8859_6_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char iso8859_6_page00[16] = { + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ +}; +static const unsigned char iso8859_6_page06[80] = { + 0x00, 0x00, 0x00, 0x00, 0xac, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0xbf, /* 0x18-0x1f */ + 0x00, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ + 0xf0, 0xf1, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ +}; + +static int +iso8859_6_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00b0) + c = iso8859_6_page00[wc-0x00a0]; + else if (wc >= 0x0608 && wc < 0x0658) + c = iso8859_6_page06[wc-0x0608]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_7.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_7.h new file mode 100644 index 000000000..9b500e4b3 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_7.h @@ -0,0 +1,87 @@ + +/* + * ISO-8859-7 + */ + +static const unsigned short iso8859_7_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x2018, 0x2019, 0x00a3, 0xfffd, 0xfffd, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0xfffd, 0x00ab, 0x00ac, 0x00ad, 0xfffd, 0x2015, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x0384, 0x0385, 0x0386, 0x00b7, + 0x0388, 0x0389, 0x038a, 0x00bb, 0x038c, 0x00bd, 0x038e, 0x038f, + /* 0xc0 */ + 0x0390, 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, + 0x0398, 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, + /* 0xd0 */ + 0x03a0, 0x03a1, 0xfffd, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, + 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x03ac, 0x03ad, 0x03ae, 0x03af, + /* 0xe0 */ + 0x03b0, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, + 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, + /* 0xf0 */ + 0x03c0, 0x03c1, 0x03c2, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, + 0x03c8, 0x03c9, 0x03ca, 0x03cb, 0x03cc, 0x03cd, 0x03ce, 0xfffd, +}; + +static int +iso8859_7_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = iso8859_7_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char iso8859_7_page00[32] = { + 0xa0, 0x00, 0x00, 0xa3, 0x00, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0x00, 0x00, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0x00, 0x00, 0x00, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ +}; +static const unsigned char iso8859_7_page03[80] = { + 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0x00, /* 0x80-0x87 */ + 0xb8, 0xb9, 0xba, 0x00, 0xbc, 0x00, 0xbe, 0xbf, /* 0x88-0x8f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x90-0x97 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x98-0x9f */ + 0xd0, 0xd1, 0x00, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xa0-0xa7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0xa8-0xaf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xb0-0xb7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xb8-0xbf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xc0-0xc7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0x00, /* 0xc8-0xcf */ +}; +static const unsigned char iso8859_7_page20[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0xaf, 0x00, 0x00, /* 0x10-0x17 */ + 0xa1, 0xa2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ +}; + +static int +iso8859_7_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00c0) + c = iso8859_7_page00[wc-0x00a0]; + else if (wc >= 0x0380 && wc < 0x03d0) + c = iso8859_7_page03[wc-0x0380]; + else if (wc >= 0x2010 && wc < 0x2020) + c = iso8859_7_page20[wc-0x2010]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_8.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_8.h new file mode 100644 index 000000000..152dc3cae --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_8.h @@ -0,0 +1,88 @@ + +/* + * ISO-8859-8 + */ + +static const unsigned short iso8859_8_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0xfffd, 0x00a2, 0x00a3, 0x00a4, 0x00a5, 0x00a6, 0x00a7, + 0x00a8, 0x00a9, 0x00d7, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x00af, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x00b6, 0x00b7, + 0x00b8, 0x00b9, 0x00f7, 0x00bb, 0x00bc, 0x00bd, 0x00be, 0xfffd, + /* 0xc0 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0xd0 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2017, + /* 0xe0 */ + 0x05d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, + 0x05d8, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, + /* 0xf0 */ + 0x05e0, 0x05e1, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, + 0x05e8, 0x05e9, 0x05ea, 0xfffd, 0xfffd, 0x200e, 0x200f, 0xfffd, +}; + +static int +iso8859_8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0xa0) { + unsigned short wc = iso8859_8_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + else { + *pwc = (ucs4_t) c; + return 1; + } + return RET_ILSEQ; +} + +static const unsigned char iso8859_8_page00[88] = { + 0xa0, 0x00, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0xa8, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0xb8, 0xb9, 0x00, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xba, /* 0xf0-0xf7 */ +}; +static const unsigned char iso8859_8_page05[32] = { + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xd0-0xd7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xd8-0xdf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xe0-0xe7 */ + 0xf8, 0xf9, 0xfa, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ +}; +static const unsigned char iso8859_8_page20[16] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfd, 0xfe, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x10-0x17 */ +}; + +static int +iso8859_8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00f8) + c = iso8859_8_page00[wc-0x00a0]; + else if (wc >= 0x05d0 && wc < 0x05f0) + c = iso8859_8_page05[wc-0x05d0]; + else if (wc >= 0x2008 && wc < 0x2018) + c = iso8859_8_page20[wc-0x2008]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9.h new file mode 100644 index 000000000..b94ac9de6 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9.h @@ -0,0 +1,66 @@ + +/* + * ISO-8859-9 + */ + +static const unsigned short iso8859_9_2uni[48] = { + /* 0xd0 */ + 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00d7, + 0x00d8, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x00e6, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00f7, + 0x00f8, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, +}; + +static int +iso8859_9_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0xd0) + *pwc = (ucs4_t) iso8859_9_2uni[c-0xd0]; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char iso8859_9_page00[48] = { + 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xd0-0xd7 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0x00, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xf0-0xf7 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0x00, 0x00, 0xff, /* 0xf8-0xff */ +}; +static const unsigned char iso8859_9_page01[72] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ +}; + +static int +iso8859_9_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00d0) { + *r = wc; + return 1; + } + else if (wc >= 0x00d0 && wc < 0x0100) + c = iso8859_9_page00[wc-0x00d0]; + else if (wc >= 0x0118 && wc < 0x0160) + c = iso8859_9_page01[wc-0x0118]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9e.h b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9e.h new file mode 100644 index 000000000..cbab5816c --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/iso8859_9e.h @@ -0,0 +1,102 @@ + +/* + * ISO-8859-9E + */ + +static const unsigned short iso8859_9e_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x017d, 0x00a2, 0x00a3, 0x20ac, 0x00a5, 0x012c, 0x00a7, + 0x016c, 0x00a9, 0x01e6, 0x00ab, 0x014a, 0x00ad, 0x00ae, 0x01d1, + /* 0xb0 */ + 0x00b0, 0x017e, 0x00b2, 0x00b3, 0x00b4, 0x00b5, 0x012d, 0x00b7, + 0x016d, 0x00b9, 0x01e7, 0x00bb, 0x014b, 0x00bd, 0x0178, 0x01d2, + /* 0xc0 */ + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x00c4, 0x00c5, 0x018f, 0x00c7, + 0x00c8, 0x00c9, 0x00ca, 0x00cb, 0x00cc, 0x00cd, 0x00ce, 0x00cf, + /* 0xd0 */ + 0x011e, 0x00d1, 0x00d2, 0x00d3, 0x00d4, 0x00d5, 0x00d6, 0x00dd, + 0x019f, 0x00d9, 0x00da, 0x00db, 0x00dc, 0x0130, 0x015e, 0x00df, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x00e4, 0x00e5, 0x0259, 0x00e7, + 0x00e8, 0x00e9, 0x00ea, 0x00eb, 0x00ec, 0x00ed, 0x00ee, 0x00ef, + /* 0xf0 */ + 0x011f, 0x00f1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x00f6, 0x00fd, + 0x0275, 0x00f9, 0x00fa, 0x00fb, 0x00fc, 0x0131, 0x015f, 0x00ff, +}; + +static int +iso8859_9e_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c >= 0xa0) + *pwc = (ucs4_t) iso8859_9e_2uni[c-0xa0]; + else + *pwc = (ucs4_t) c; + return 1; +} + +static const unsigned char iso8859_9e_page00[96] = { + 0xa0, 0x00, 0xa2, 0xa3, 0x00, 0xa5, 0x00, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0xab, 0x00, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ + 0xb0, 0x00, 0xb2, 0xb3, 0xb4, 0xb5, 0x00, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0xb9, 0x00, 0xbb, 0x00, 0xbd, 0x00, 0x00, /* 0xb8-0xbf */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0x00, 0xc7, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0xc8-0xcf */ + 0x00, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0x00, /* 0xd0-0xd7 */ + 0x00, 0xd9, 0xda, 0xdb, 0xdc, 0xd7, 0x00, 0xdf, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0x00, 0xe7, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0xe8-0xef */ + 0x00, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0x00, /* 0xf0-0xf7 */ + 0x00, 0xf9, 0xfa, 0xfb, 0xfc, 0xf7, 0x00, 0xff, /* 0xf8-0xff */ +}; +static const unsigned char iso8859_9e_page01[136] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd0, 0xf0, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0xa6, 0xb6, 0x00, 0x00, /* 0x28-0x2f */ + 0xdd, 0xfd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0xac, 0xbc, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xde, 0xfe, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0xa8, 0xb8, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0xbe, 0x00, 0x00, 0x00, 0x00, 0xa1, 0xb1, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xc6, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xd8, /* 0x98-0x9f */ +}; +static const unsigned char iso8859_9e_page01_d[24] = { + 0x00, 0xaf, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xaa, 0xba, /* 0xe0-0xe7 */ +}; + +static int +iso8859_9e_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x0100) + c = iso8859_9e_page00[wc-0x00a0]; + else if (wc >= 0x0118 && wc < 0x01a0) + c = iso8859_9e_page01[wc-0x0118]; + else if (wc >= 0x01d0 && wc < 0x01e8) + c = iso8859_9e_page01_d[wc-0x01d0]; + else if (wc == 0x0259) + c = 0xe6; + else if (wc == 0x0275) + c = 0xf8; + else if (wc == 0x20ac) + c = 0xa4; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0201.h b/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0201.h new file mode 100644 index 000000000..e4af9666f --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0201.h @@ -0,0 +1,47 @@ + +/* + * JISX0201.1976-0 + */ + +static int +jisx0201_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + if (c == 0x5c) + *pwc = (ucs4_t) 0x00a5; + else if (c == 0x7e) + *pwc = (ucs4_t) 0x203e; + else + *pwc = (ucs4_t) c; + return 1; + } else { + if (c >= 0xa1 && c < 0xe0) { + *pwc = (ucs4_t) c + 0xfec0; + return 1; + } + } + return RET_ILSEQ; +} + +static int +jisx0201_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (wc < 0x0080 && !(wc == 0x005c || wc == 0x007e)) { + *r = wc; + return 1; + } + if (wc == 0x00a5) { + *r = 0x5c; + return 1; + } + if (wc == 0x203e) { + *r = 0x7e; + return 1; + } + if (wc >= 0xff61 && wc < 0xffa0) { + *r = wc - 0xfec0; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0208.h b/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0208.h new file mode 100644 index 000000000..5888f6f21 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0208.h @@ -0,0 +1,2396 @@ + +/* + * JISX0208.1990-0 + */ + +static const unsigned short jisx0208_2uni_page21[690] = { + /* 0x21 */ + 0x3000, 0x3001, 0x3002, 0xff0c, 0xff0e, 0x30fb, 0xff1a, 0xff1b, + 0xff1f, 0xff01, 0x309b, 0x309c, 0x00b4, 0xff40, 0x00a8, 0xff3e, + 0xffe3, 0xff3f, 0x30fd, 0x30fe, 0x309d, 0x309e, 0x3003, 0x4edd, + 0x3005, 0x3006, 0x3007, 0x30fc, 0x2015, 0x2010, 0xff0f, 0xff3c, + 0x301c, 0x2016, 0xff5c, 0x2026, 0x2025, 0x2018, 0x2019, 0x201c, + 0x201d, 0xff08, 0xff09, 0x3014, 0x3015, 0xff3b, 0xff3d, 0xff5b, + 0xff5d, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, 0x300d, 0x300e, + 0x300f, 0x3010, 0x3011, 0xff0b, 0x2212, 0x00b1, 0x00d7, 0x00f7, + 0xff1d, 0x2260, 0xff1c, 0xff1e, 0x2266, 0x2267, 0x221e, 0x2234, + 0x2642, 0x2640, 0x00b0, 0x2032, 0x2033, 0x2103, 0xffe5, 0xff04, + 0x00a2, 0x00a3, 0xff05, 0xff03, 0xff06, 0xff0a, 0xff20, 0x00a7, + 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, + /* 0x22 */ + 0x25c6, 0x25a1, 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x203b, + 0x3012, 0x2192, 0x2190, 0x2191, 0x2193, 0x3013, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, 0x2283, 0x222a, + 0x2229, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0x2227, 0x2228, 0x00ac, 0x21d2, 0x21d4, 0x2200, 0x2203, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0x2220, 0x22a5, 0x2312, 0x2202, 0x2207, + 0x2261, 0x2252, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, 0x2235, + 0x222b, 0x222c, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0x212b, 0x2030, 0x266f, 0x266d, 0x266a, 0x2020, 0x2021, + 0x00b6, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x25ef, + /* 0x23 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xff10, + 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, + 0xff19, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, + 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, + 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, + 0xff39, 0xff3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, + 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, + 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, + 0xff59, 0xff5a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x24 */ + 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, + 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, + 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, + 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, + 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, + 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, + 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, + 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, + 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, + 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x25 */ + 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, + 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, + 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, + 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, + 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, + 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, + 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, + 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, + 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, + 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, + 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x26 */ + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, + 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, + 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, + 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, + 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x27 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, + 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, + 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, + 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, + 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, + 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, + 0x044f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x28 */ + 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c, + 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b, + 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f, + 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542, +}; +static const unsigned short jisx0208_2uni_page30[6398] = { + /* 0x30 */ + 0x4e9c, 0x5516, 0x5a03, 0x963f, 0x54c0, 0x611b, 0x6328, 0x59f6, + 0x9022, 0x8475, 0x831c, 0x7a50, 0x60aa, 0x63e1, 0x6e25, 0x65ed, + 0x8466, 0x82a6, 0x9bf5, 0x6893, 0x5727, 0x65a1, 0x6271, 0x5b9b, + 0x59d0, 0x867b, 0x98f4, 0x7d62, 0x7dbe, 0x9b8e, 0x6216, 0x7c9f, + 0x88b7, 0x5b89, 0x5eb5, 0x6309, 0x6697, 0x6848, 0x95c7, 0x978d, + 0x674f, 0x4ee5, 0x4f0a, 0x4f4d, 0x4f9d, 0x5049, 0x56f2, 0x5937, + 0x59d4, 0x5a01, 0x5c09, 0x60df, 0x610f, 0x6170, 0x6613, 0x6905, + 0x70ba, 0x754f, 0x7570, 0x79fb, 0x7dad, 0x7def, 0x80c3, 0x840e, + 0x8863, 0x8b02, 0x9055, 0x907a, 0x533b, 0x4e95, 0x4ea5, 0x57df, + 0x80b2, 0x90c1, 0x78ef, 0x4e00, 0x58f1, 0x6ea2, 0x9038, 0x7a32, + 0x8328, 0x828b, 0x9c2f, 0x5141, 0x5370, 0x54bd, 0x54e1, 0x56e0, + 0x59fb, 0x5f15, 0x98f2, 0x6deb, 0x80e4, 0x852d, + /* 0x31 */ + 0x9662, 0x9670, 0x96a0, 0x97fb, 0x540b, 0x53f3, 0x5b87, 0x70cf, + 0x7fbd, 0x8fc2, 0x96e8, 0x536f, 0x9d5c, 0x7aba, 0x4e11, 0x7893, + 0x81fc, 0x6e26, 0x5618, 0x5504, 0x6b1d, 0x851a, 0x9c3b, 0x59e5, + 0x53a9, 0x6d66, 0x74dc, 0x958f, 0x5642, 0x4e91, 0x904b, 0x96f2, + 0x834f, 0x990c, 0x53e1, 0x55b6, 0x5b30, 0x5f71, 0x6620, 0x66f3, + 0x6804, 0x6c38, 0x6cf3, 0x6d29, 0x745b, 0x76c8, 0x7a4e, 0x9834, + 0x82f1, 0x885b, 0x8a60, 0x92ed, 0x6db2, 0x75ab, 0x76ca, 0x99c5, + 0x60a6, 0x8b01, 0x8d8a, 0x95b2, 0x698e, 0x53ad, 0x5186, 0x5712, + 0x5830, 0x5944, 0x5bb4, 0x5ef6, 0x6028, 0x63a9, 0x63f4, 0x6cbf, + 0x6f14, 0x708e, 0x7114, 0x7159, 0x71d5, 0x733f, 0x7e01, 0x8276, + 0x82d1, 0x8597, 0x9060, 0x925b, 0x9d1b, 0x5869, 0x65bc, 0x6c5a, + 0x7525, 0x51f9, 0x592e, 0x5965, 0x5f80, 0x5fdc, + /* 0x32 */ + 0x62bc, 0x65fa, 0x6a2a, 0x6b27, 0x6bb4, 0x738b, 0x7fc1, 0x8956, + 0x9d2c, 0x9d0e, 0x9ec4, 0x5ca1, 0x6c96, 0x837b, 0x5104, 0x5c4b, + 0x61b6, 0x81c6, 0x6876, 0x7261, 0x4e59, 0x4ffa, 0x5378, 0x6069, + 0x6e29, 0x7a4f, 0x97f3, 0x4e0b, 0x5316, 0x4eee, 0x4f55, 0x4f3d, + 0x4fa1, 0x4f73, 0x52a0, 0x53ef, 0x5609, 0x590f, 0x5ac1, 0x5bb6, + 0x5be1, 0x79d1, 0x6687, 0x679c, 0x67b6, 0x6b4c, 0x6cb3, 0x706b, + 0x73c2, 0x798d, 0x79be, 0x7a3c, 0x7b87, 0x82b1, 0x82db, 0x8304, + 0x8377, 0x83ef, 0x83d3, 0x8766, 0x8ab2, 0x5629, 0x8ca8, 0x8fe6, + 0x904e, 0x971e, 0x868a, 0x4fc4, 0x5ce8, 0x6211, 0x7259, 0x753b, + 0x81e5, 0x82bd, 0x86fe, 0x8cc0, 0x96c5, 0x9913, 0x99d5, 0x4ecb, + 0x4f1a, 0x89e3, 0x56de, 0x584a, 0x58ca, 0x5efb, 0x5feb, 0x602a, + 0x6094, 0x6062, 0x61d0, 0x6212, 0x62d0, 0x6539, + /* 0x33 */ + 0x9b41, 0x6666, 0x68b0, 0x6d77, 0x7070, 0x754c, 0x7686, 0x7d75, + 0x82a5, 0x87f9, 0x958b, 0x968e, 0x8c9d, 0x51f1, 0x52be, 0x5916, + 0x54b3, 0x5bb3, 0x5d16, 0x6168, 0x6982, 0x6daf, 0x788d, 0x84cb, + 0x8857, 0x8a72, 0x93a7, 0x9ab8, 0x6d6c, 0x99a8, 0x86d9, 0x57a3, + 0x67ff, 0x86ce, 0x920e, 0x5283, 0x5687, 0x5404, 0x5ed3, 0x62e1, + 0x64b9, 0x683c, 0x6838, 0x6bbb, 0x7372, 0x78ba, 0x7a6b, 0x899a, + 0x89d2, 0x8d6b, 0x8f03, 0x90ed, 0x95a3, 0x9694, 0x9769, 0x5b66, + 0x5cb3, 0x697d, 0x984d, 0x984e, 0x639b, 0x7b20, 0x6a2b, 0x6a7f, + 0x68b6, 0x9c0d, 0x6f5f, 0x5272, 0x559d, 0x6070, 0x62ec, 0x6d3b, + 0x6e07, 0x6ed1, 0x845b, 0x8910, 0x8f44, 0x4e14, 0x9c39, 0x53f6, + 0x691b, 0x6a3a, 0x9784, 0x682a, 0x515c, 0x7ac3, 0x84b2, 0x91dc, + 0x938c, 0x565b, 0x9d28, 0x6822, 0x8305, 0x8431, + /* 0x34 */ + 0x7ca5, 0x5208, 0x82c5, 0x74e6, 0x4e7e, 0x4f83, 0x51a0, 0x5bd2, + 0x520a, 0x52d8, 0x52e7, 0x5dfb, 0x559a, 0x582a, 0x59e6, 0x5b8c, + 0x5b98, 0x5bdb, 0x5e72, 0x5e79, 0x60a3, 0x611f, 0x6163, 0x61be, + 0x63db, 0x6562, 0x67d1, 0x6853, 0x68fa, 0x6b3e, 0x6b53, 0x6c57, + 0x6f22, 0x6f97, 0x6f45, 0x74b0, 0x7518, 0x76e3, 0x770b, 0x7aff, + 0x7ba1, 0x7c21, 0x7de9, 0x7f36, 0x7ff0, 0x809d, 0x8266, 0x839e, + 0x89b3, 0x8acc, 0x8cab, 0x9084, 0x9451, 0x9593, 0x9591, 0x95a2, + 0x9665, 0x97d3, 0x9928, 0x8218, 0x4e38, 0x542b, 0x5cb8, 0x5dcc, + 0x73a9, 0x764c, 0x773c, 0x5ca9, 0x7feb, 0x8d0b, 0x96c1, 0x9811, + 0x9854, 0x9858, 0x4f01, 0x4f0e, 0x5371, 0x559c, 0x5668, 0x57fa, + 0x5947, 0x5b09, 0x5bc4, 0x5c90, 0x5e0c, 0x5e7e, 0x5fcc, 0x63ee, + 0x673a, 0x65d7, 0x65e2, 0x671f, 0x68cb, 0x68c4, + /* 0x35 */ + 0x6a5f, 0x5e30, 0x6bc5, 0x6c17, 0x6c7d, 0x757f, 0x7948, 0x5b63, + 0x7a00, 0x7d00, 0x5fbd, 0x898f, 0x8a18, 0x8cb4, 0x8d77, 0x8ecc, + 0x8f1d, 0x98e2, 0x9a0e, 0x9b3c, 0x4e80, 0x507d, 0x5100, 0x5993, + 0x5b9c, 0x622f, 0x6280, 0x64ec, 0x6b3a, 0x72a0, 0x7591, 0x7947, + 0x7fa9, 0x87fb, 0x8abc, 0x8b70, 0x63ac, 0x83ca, 0x97a0, 0x5409, + 0x5403, 0x55ab, 0x6854, 0x6a58, 0x8a70, 0x7827, 0x6775, 0x9ecd, + 0x5374, 0x5ba2, 0x811a, 0x8650, 0x9006, 0x4e18, 0x4e45, 0x4ec7, + 0x4f11, 0x53ca, 0x5438, 0x5bae, 0x5f13, 0x6025, 0x6551, 0x673d, + 0x6c42, 0x6c72, 0x6ce3, 0x7078, 0x7403, 0x7a76, 0x7aae, 0x7b08, + 0x7d1a, 0x7cfe, 0x7d66, 0x65e7, 0x725b, 0x53bb, 0x5c45, 0x5de8, + 0x62d2, 0x62e0, 0x6319, 0x6e20, 0x865a, 0x8a31, 0x8ddd, 0x92f8, + 0x6f01, 0x79a6, 0x9b5a, 0x4ea8, 0x4eab, 0x4eac, + /* 0x36 */ + 0x4f9b, 0x4fa0, 0x50d1, 0x5147, 0x7af6, 0x5171, 0x51f6, 0x5354, + 0x5321, 0x537f, 0x53eb, 0x55ac, 0x5883, 0x5ce1, 0x5f37, 0x5f4a, + 0x602f, 0x6050, 0x606d, 0x631f, 0x6559, 0x6a4b, 0x6cc1, 0x72c2, + 0x72ed, 0x77ef, 0x80f8, 0x8105, 0x8208, 0x854e, 0x90f7, 0x93e1, + 0x97ff, 0x9957, 0x9a5a, 0x4ef0, 0x51dd, 0x5c2d, 0x6681, 0x696d, + 0x5c40, 0x66f2, 0x6975, 0x7389, 0x6850, 0x7c81, 0x50c5, 0x52e4, + 0x5747, 0x5dfe, 0x9326, 0x65a4, 0x6b23, 0x6b3d, 0x7434, 0x7981, + 0x79bd, 0x7b4b, 0x7dca, 0x82b9, 0x83cc, 0x887f, 0x895f, 0x8b39, + 0x8fd1, 0x91d1, 0x541f, 0x9280, 0x4e5d, 0x5036, 0x53e5, 0x533a, + 0x72d7, 0x7396, 0x77e9, 0x82e6, 0x8eaf, 0x99c6, 0x99c8, 0x99d2, + 0x5177, 0x611a, 0x865e, 0x55b0, 0x7a7a, 0x5076, 0x5bd3, 0x9047, + 0x9685, 0x4e32, 0x6adb, 0x91e7, 0x5c51, 0x5c48, + /* 0x37 */ + 0x6398, 0x7a9f, 0x6c93, 0x9774, 0x8f61, 0x7aaa, 0x718a, 0x9688, + 0x7c82, 0x6817, 0x7e70, 0x6851, 0x936c, 0x52f2, 0x541b, 0x85ab, + 0x8a13, 0x7fa4, 0x8ecd, 0x90e1, 0x5366, 0x8888, 0x7941, 0x4fc2, + 0x50be, 0x5211, 0x5144, 0x5553, 0x572d, 0x73ea, 0x578b, 0x5951, + 0x5f62, 0x5f84, 0x6075, 0x6176, 0x6167, 0x61a9, 0x63b2, 0x643a, + 0x656c, 0x666f, 0x6842, 0x6e13, 0x7566, 0x7a3d, 0x7cfb, 0x7d4c, + 0x7d99, 0x7e4b, 0x7f6b, 0x830e, 0x834a, 0x86cd, 0x8a08, 0x8a63, + 0x8b66, 0x8efd, 0x981a, 0x9d8f, 0x82b8, 0x8fce, 0x9be8, 0x5287, + 0x621f, 0x6483, 0x6fc0, 0x9699, 0x6841, 0x5091, 0x6b20, 0x6c7a, + 0x6f54, 0x7a74, 0x7d50, 0x8840, 0x8a23, 0x6708, 0x4ef6, 0x5039, + 0x5026, 0x5065, 0x517c, 0x5238, 0x5263, 0x55a7, 0x570f, 0x5805, + 0x5acc, 0x5efa, 0x61b2, 0x61f8, 0x62f3, 0x6372, + /* 0x38 */ + 0x691c, 0x6a29, 0x727d, 0x72ac, 0x732e, 0x7814, 0x786f, 0x7d79, + 0x770c, 0x80a9, 0x898b, 0x8b19, 0x8ce2, 0x8ed2, 0x9063, 0x9375, + 0x967a, 0x9855, 0x9a13, 0x9e78, 0x5143, 0x539f, 0x53b3, 0x5e7b, + 0x5f26, 0x6e1b, 0x6e90, 0x7384, 0x73fe, 0x7d43, 0x8237, 0x8a00, + 0x8afa, 0x9650, 0x4e4e, 0x500b, 0x53e4, 0x547c, 0x56fa, 0x59d1, + 0x5b64, 0x5df1, 0x5eab, 0x5f27, 0x6238, 0x6545, 0x67af, 0x6e56, + 0x72d0, 0x7cca, 0x88b4, 0x80a1, 0x80e1, 0x83f0, 0x864e, 0x8a87, + 0x8de8, 0x9237, 0x96c7, 0x9867, 0x9f13, 0x4e94, 0x4e92, 0x4f0d, + 0x5348, 0x5449, 0x543e, 0x5a2f, 0x5f8c, 0x5fa1, 0x609f, 0x68a7, + 0x6a8e, 0x745a, 0x7881, 0x8a9e, 0x8aa4, 0x8b77, 0x9190, 0x4e5e, + 0x9bc9, 0x4ea4, 0x4f7c, 0x4faf, 0x5019, 0x5016, 0x5149, 0x516c, + 0x529f, 0x52b9, 0x52fe, 0x539a, 0x53e3, 0x5411, + /* 0x39 */ + 0x540e, 0x5589, 0x5751, 0x57a2, 0x597d, 0x5b54, 0x5b5d, 0x5b8f, + 0x5de5, 0x5de7, 0x5df7, 0x5e78, 0x5e83, 0x5e9a, 0x5eb7, 0x5f18, + 0x6052, 0x614c, 0x6297, 0x62d8, 0x63a7, 0x653b, 0x6602, 0x6643, + 0x66f4, 0x676d, 0x6821, 0x6897, 0x69cb, 0x6c5f, 0x6d2a, 0x6d69, + 0x6e2f, 0x6e9d, 0x7532, 0x7687, 0x786c, 0x7a3f, 0x7ce0, 0x7d05, + 0x7d18, 0x7d5e, 0x7db1, 0x8015, 0x8003, 0x80af, 0x80b1, 0x8154, + 0x818f, 0x822a, 0x8352, 0x884c, 0x8861, 0x8b1b, 0x8ca2, 0x8cfc, + 0x90ca, 0x9175, 0x9271, 0x783f, 0x92fc, 0x95a4, 0x964d, 0x9805, + 0x9999, 0x9ad8, 0x9d3b, 0x525b, 0x52ab, 0x53f7, 0x5408, 0x58d5, + 0x62f7, 0x6fe0, 0x8c6a, 0x8f5f, 0x9eb9, 0x514b, 0x523b, 0x544a, + 0x56fd, 0x7a40, 0x9177, 0x9d60, 0x9ed2, 0x7344, 0x6f09, 0x8170, + 0x7511, 0x5ffd, 0x60da, 0x9aa8, 0x72db, 0x8fbc, + /* 0x3a */ + 0x6b64, 0x9803, 0x4eca, 0x56f0, 0x5764, 0x58be, 0x5a5a, 0x6068, + 0x61c7, 0x660f, 0x6606, 0x6839, 0x68b1, 0x6df7, 0x75d5, 0x7d3a, + 0x826e, 0x9b42, 0x4e9b, 0x4f50, 0x53c9, 0x5506, 0x5d6f, 0x5de6, + 0x5dee, 0x67fb, 0x6c99, 0x7473, 0x7802, 0x8a50, 0x9396, 0x88df, + 0x5750, 0x5ea7, 0x632b, 0x50b5, 0x50ac, 0x518d, 0x6700, 0x54c9, + 0x585e, 0x59bb, 0x5bb0, 0x5f69, 0x624d, 0x63a1, 0x683d, 0x6b73, + 0x6e08, 0x707d, 0x91c7, 0x7280, 0x7815, 0x7826, 0x796d, 0x658e, + 0x7d30, 0x83dc, 0x88c1, 0x8f09, 0x969b, 0x5264, 0x5728, 0x6750, + 0x7f6a, 0x8ca1, 0x51b4, 0x5742, 0x962a, 0x583a, 0x698a, 0x80b4, + 0x54b2, 0x5d0e, 0x57fc, 0x7895, 0x9dfa, 0x4f5c, 0x524a, 0x548b, + 0x643e, 0x6628, 0x6714, 0x67f5, 0x7a84, 0x7b56, 0x7d22, 0x932f, + 0x685c, 0x9bad, 0x7b39, 0x5319, 0x518a, 0x5237, + /* 0x3b */ + 0x5bdf, 0x62f6, 0x64ae, 0x64e6, 0x672d, 0x6bba, 0x85a9, 0x96d1, + 0x7690, 0x9bd6, 0x634c, 0x9306, 0x9bab, 0x76bf, 0x6652, 0x4e09, + 0x5098, 0x53c2, 0x5c71, 0x60e8, 0x6492, 0x6563, 0x685f, 0x71e6, + 0x73ca, 0x7523, 0x7b97, 0x7e82, 0x8695, 0x8b83, 0x8cdb, 0x9178, + 0x9910, 0x65ac, 0x66ab, 0x6b8b, 0x4ed5, 0x4ed4, 0x4f3a, 0x4f7f, + 0x523a, 0x53f8, 0x53f2, 0x55e3, 0x56db, 0x58eb, 0x59cb, 0x59c9, + 0x59ff, 0x5b50, 0x5c4d, 0x5e02, 0x5e2b, 0x5fd7, 0x601d, 0x6307, + 0x652f, 0x5b5c, 0x65af, 0x65bd, 0x65e8, 0x679d, 0x6b62, 0x6b7b, + 0x6c0f, 0x7345, 0x7949, 0x79c1, 0x7cf8, 0x7d19, 0x7d2b, 0x80a2, + 0x8102, 0x81f3, 0x8996, 0x8a5e, 0x8a69, 0x8a66, 0x8a8c, 0x8aee, + 0x8cc7, 0x8cdc, 0x96cc, 0x98fc, 0x6b6f, 0x4e8b, 0x4f3c, 0x4f8d, + 0x5150, 0x5b57, 0x5bfa, 0x6148, 0x6301, 0x6642, + /* 0x3c */ + 0x6b21, 0x6ecb, 0x6cbb, 0x723e, 0x74bd, 0x75d4, 0x78c1, 0x793a, + 0x800c, 0x8033, 0x81ea, 0x8494, 0x8f9e, 0x6c50, 0x9e7f, 0x5f0f, + 0x8b58, 0x9d2b, 0x7afa, 0x8ef8, 0x5b8d, 0x96eb, 0x4e03, 0x53f1, + 0x57f7, 0x5931, 0x5ac9, 0x5ba4, 0x6089, 0x6e7f, 0x6f06, 0x75be, + 0x8cea, 0x5b9f, 0x8500, 0x7be0, 0x5072, 0x67f4, 0x829d, 0x5c61, + 0x854a, 0x7e1e, 0x820e, 0x5199, 0x5c04, 0x6368, 0x8d66, 0x659c, + 0x716e, 0x793e, 0x7d17, 0x8005, 0x8b1d, 0x8eca, 0x906e, 0x86c7, + 0x90aa, 0x501f, 0x52fa, 0x5c3a, 0x6753, 0x707c, 0x7235, 0x914c, + 0x91c8, 0x932b, 0x82e5, 0x5bc2, 0x5f31, 0x60f9, 0x4e3b, 0x53d6, + 0x5b88, 0x624b, 0x6731, 0x6b8a, 0x72e9, 0x73e0, 0x7a2e, 0x816b, + 0x8da3, 0x9152, 0x9996, 0x5112, 0x53d7, 0x546a, 0x5bff, 0x6388, + 0x6a39, 0x7dac, 0x9700, 0x56da, 0x53ce, 0x5468, + /* 0x3d */ + 0x5b97, 0x5c31, 0x5dde, 0x4fee, 0x6101, 0x62fe, 0x6d32, 0x79c0, + 0x79cb, 0x7d42, 0x7e4d, 0x7fd2, 0x81ed, 0x821f, 0x8490, 0x8846, + 0x8972, 0x8b90, 0x8e74, 0x8f2f, 0x9031, 0x914b, 0x916c, 0x96c6, + 0x919c, 0x4ec0, 0x4f4f, 0x5145, 0x5341, 0x5f93, 0x620e, 0x67d4, + 0x6c41, 0x6e0b, 0x7363, 0x7e26, 0x91cd, 0x9283, 0x53d4, 0x5919, + 0x5bbf, 0x6dd1, 0x795d, 0x7e2e, 0x7c9b, 0x587e, 0x719f, 0x51fa, + 0x8853, 0x8ff0, 0x4fca, 0x5cfb, 0x6625, 0x77ac, 0x7ae3, 0x821c, + 0x99ff, 0x51c6, 0x5faa, 0x65ec, 0x696f, 0x6b89, 0x6df3, 0x6e96, + 0x6f64, 0x76fe, 0x7d14, 0x5de1, 0x9075, 0x9187, 0x9806, 0x51e6, + 0x521d, 0x6240, 0x6691, 0x66d9, 0x6e1a, 0x5eb6, 0x7dd2, 0x7f72, + 0x66f8, 0x85af, 0x85f7, 0x8af8, 0x52a9, 0x53d9, 0x5973, 0x5e8f, + 0x5f90, 0x6055, 0x92e4, 0x9664, 0x50b7, 0x511f, + /* 0x3e */ + 0x52dd, 0x5320, 0x5347, 0x53ec, 0x54e8, 0x5546, 0x5531, 0x5617, + 0x5968, 0x59be, 0x5a3c, 0x5bb5, 0x5c06, 0x5c0f, 0x5c11, 0x5c1a, + 0x5e84, 0x5e8a, 0x5ee0, 0x5f70, 0x627f, 0x6284, 0x62db, 0x638c, + 0x6377, 0x6607, 0x660c, 0x662d, 0x6676, 0x677e, 0x68a2, 0x6a1f, + 0x6a35, 0x6cbc, 0x6d88, 0x6e09, 0x6e58, 0x713c, 0x7126, 0x7167, + 0x75c7, 0x7701, 0x785d, 0x7901, 0x7965, 0x79f0, 0x7ae0, 0x7b11, + 0x7ca7, 0x7d39, 0x8096, 0x83d6, 0x848b, 0x8549, 0x885d, 0x88f3, + 0x8a1f, 0x8a3c, 0x8a54, 0x8a73, 0x8c61, 0x8cde, 0x91a4, 0x9266, + 0x937e, 0x9418, 0x969c, 0x9798, 0x4e0a, 0x4e08, 0x4e1e, 0x4e57, + 0x5197, 0x5270, 0x57ce, 0x5834, 0x58cc, 0x5b22, 0x5e38, 0x60c5, + 0x64fe, 0x6761, 0x6756, 0x6d44, 0x72b6, 0x7573, 0x7a63, 0x84b8, + 0x8b72, 0x91b8, 0x9320, 0x5631, 0x57f4, 0x98fe, + /* 0x3f */ + 0x62ed, 0x690d, 0x6b96, 0x71ed, 0x7e54, 0x8077, 0x8272, 0x89e6, + 0x98df, 0x8755, 0x8fb1, 0x5c3b, 0x4f38, 0x4fe1, 0x4fb5, 0x5507, + 0x5a20, 0x5bdd, 0x5be9, 0x5fc3, 0x614e, 0x632f, 0x65b0, 0x664b, + 0x68ee, 0x699b, 0x6d78, 0x6df1, 0x7533, 0x75b9, 0x771f, 0x795e, + 0x79e6, 0x7d33, 0x81e3, 0x82af, 0x85aa, 0x89aa, 0x8a3a, 0x8eab, + 0x8f9b, 0x9032, 0x91dd, 0x9707, 0x4eba, 0x4ec1, 0x5203, 0x5875, + 0x58ec, 0x5c0b, 0x751a, 0x5c3d, 0x814e, 0x8a0a, 0x8fc5, 0x9663, + 0x976d, 0x7b25, 0x8acf, 0x9808, 0x9162, 0x56f3, 0x53a8, 0x9017, + 0x5439, 0x5782, 0x5e25, 0x63a8, 0x6c34, 0x708a, 0x7761, 0x7c8b, + 0x7fe0, 0x8870, 0x9042, 0x9154, 0x9310, 0x9318, 0x968f, 0x745e, + 0x9ac4, 0x5d07, 0x5d69, 0x6570, 0x67a2, 0x8da8, 0x96db, 0x636e, + 0x6749, 0x6919, 0x83c5, 0x9817, 0x96c0, 0x88fe, + /* 0x40 */ + 0x6f84, 0x647a, 0x5bf8, 0x4e16, 0x702c, 0x755d, 0x662f, 0x51c4, + 0x5236, 0x52e2, 0x59d3, 0x5f81, 0x6027, 0x6210, 0x653f, 0x6574, + 0x661f, 0x6674, 0x68f2, 0x6816, 0x6b63, 0x6e05, 0x7272, 0x751f, + 0x76db, 0x7cbe, 0x8056, 0x58f0, 0x88fd, 0x897f, 0x8aa0, 0x8a93, + 0x8acb, 0x901d, 0x9192, 0x9752, 0x9759, 0x6589, 0x7a0e, 0x8106, + 0x96bb, 0x5e2d, 0x60dc, 0x621a, 0x65a5, 0x6614, 0x6790, 0x77f3, + 0x7a4d, 0x7c4d, 0x7e3e, 0x810a, 0x8cac, 0x8d64, 0x8de1, 0x8e5f, + 0x78a9, 0x5207, 0x62d9, 0x63a5, 0x6442, 0x6298, 0x8a2d, 0x7a83, + 0x7bc0, 0x8aac, 0x96ea, 0x7d76, 0x820c, 0x8749, 0x4ed9, 0x5148, + 0x5343, 0x5360, 0x5ba3, 0x5c02, 0x5c16, 0x5ddd, 0x6226, 0x6247, + 0x64b0, 0x6813, 0x6834, 0x6cc9, 0x6d45, 0x6d17, 0x67d3, 0x6f5c, + 0x714e, 0x717d, 0x65cb, 0x7a7f, 0x7bad, 0x7dda, + /* 0x41 */ + 0x7e4a, 0x7fa8, 0x817a, 0x821b, 0x8239, 0x85a6, 0x8a6e, 0x8cce, + 0x8df5, 0x9078, 0x9077, 0x92ad, 0x9291, 0x9583, 0x9bae, 0x524d, + 0x5584, 0x6f38, 0x7136, 0x5168, 0x7985, 0x7e55, 0x81b3, 0x7cce, + 0x564c, 0x5851, 0x5ca8, 0x63aa, 0x66fe, 0x66fd, 0x695a, 0x72d9, + 0x758f, 0x758e, 0x790e, 0x7956, 0x79df, 0x7c97, 0x7d20, 0x7d44, + 0x8607, 0x8a34, 0x963b, 0x9061, 0x9f20, 0x50e7, 0x5275, 0x53cc, + 0x53e2, 0x5009, 0x55aa, 0x58ee, 0x594f, 0x723d, 0x5b8b, 0x5c64, + 0x531d, 0x60e3, 0x60f3, 0x635c, 0x6383, 0x633f, 0x63bb, 0x64cd, + 0x65e9, 0x66f9, 0x5de3, 0x69cd, 0x69fd, 0x6f15, 0x71e5, 0x4e89, + 0x75e9, 0x76f8, 0x7a93, 0x7cdf, 0x7dcf, 0x7d9c, 0x8061, 0x8349, + 0x8358, 0x846c, 0x84bc, 0x85fb, 0x88c5, 0x8d70, 0x9001, 0x906d, + 0x9397, 0x971c, 0x9a12, 0x50cf, 0x5897, 0x618e, + /* 0x42 */ + 0x81d3, 0x8535, 0x8d08, 0x9020, 0x4fc3, 0x5074, 0x5247, 0x5373, + 0x606f, 0x6349, 0x675f, 0x6e2c, 0x8db3, 0x901f, 0x4fd7, 0x5c5e, + 0x8cca, 0x65cf, 0x7d9a, 0x5352, 0x8896, 0x5176, 0x63c3, 0x5b58, + 0x5b6b, 0x5c0a, 0x640d, 0x6751, 0x905c, 0x4ed6, 0x591a, 0x592a, + 0x6c70, 0x8a51, 0x553e, 0x5815, 0x59a5, 0x60f0, 0x6253, 0x67c1, + 0x8235, 0x6955, 0x9640, 0x99c4, 0x9a28, 0x4f53, 0x5806, 0x5bfe, + 0x8010, 0x5cb1, 0x5e2f, 0x5f85, 0x6020, 0x614b, 0x6234, 0x66ff, + 0x6cf0, 0x6ede, 0x80ce, 0x817f, 0x82d4, 0x888b, 0x8cb8, 0x9000, + 0x902e, 0x968a, 0x9edb, 0x9bdb, 0x4ee3, 0x53f0, 0x5927, 0x7b2c, + 0x918d, 0x984c, 0x9df9, 0x6edd, 0x7027, 0x5353, 0x5544, 0x5b85, + 0x6258, 0x629e, 0x62d3, 0x6ca2, 0x6fef, 0x7422, 0x8a17, 0x9438, + 0x6fc1, 0x8afe, 0x8338, 0x51e7, 0x86f8, 0x53ea, + /* 0x43 */ + 0x53e9, 0x4f46, 0x9054, 0x8fb0, 0x596a, 0x8131, 0x5dfd, 0x7aea, + 0x8fbf, 0x68da, 0x8c37, 0x72f8, 0x9c48, 0x6a3d, 0x8ab0, 0x4e39, + 0x5358, 0x5606, 0x5766, 0x62c5, 0x63a2, 0x65e6, 0x6b4e, 0x6de1, + 0x6e5b, 0x70ad, 0x77ed, 0x7aef, 0x7baa, 0x7dbb, 0x803d, 0x80c6, + 0x86cb, 0x8a95, 0x935b, 0x56e3, 0x58c7, 0x5f3e, 0x65ad, 0x6696, + 0x6a80, 0x6bb5, 0x7537, 0x8ac7, 0x5024, 0x77e5, 0x5730, 0x5f1b, + 0x6065, 0x667a, 0x6c60, 0x75f4, 0x7a1a, 0x7f6e, 0x81f4, 0x8718, + 0x9045, 0x99b3, 0x7bc9, 0x755c, 0x7af9, 0x7b51, 0x84c4, 0x9010, + 0x79e9, 0x7a92, 0x8336, 0x5ae1, 0x7740, 0x4e2d, 0x4ef2, 0x5b99, + 0x5fe0, 0x62bd, 0x663c, 0x67f1, 0x6ce8, 0x866b, 0x8877, 0x8a3b, + 0x914e, 0x92f3, 0x99d0, 0x6a17, 0x7026, 0x732a, 0x82e7, 0x8457, + 0x8caf, 0x4e01, 0x5146, 0x51cb, 0x558b, 0x5bf5, + /* 0x44 */ + 0x5e16, 0x5e33, 0x5e81, 0x5f14, 0x5f35, 0x5f6b, 0x5fb4, 0x61f2, + 0x6311, 0x66a2, 0x671d, 0x6f6e, 0x7252, 0x753a, 0x773a, 0x8074, + 0x8139, 0x8178, 0x8776, 0x8abf, 0x8adc, 0x8d85, 0x8df3, 0x929a, + 0x9577, 0x9802, 0x9ce5, 0x52c5, 0x6357, 0x76f4, 0x6715, 0x6c88, + 0x73cd, 0x8cc3, 0x93ae, 0x9673, 0x6d25, 0x589c, 0x690e, 0x69cc, + 0x8ffd, 0x939a, 0x75db, 0x901a, 0x585a, 0x6802, 0x63b4, 0x69fb, + 0x4f43, 0x6f2c, 0x67d8, 0x8fbb, 0x8526, 0x7db4, 0x9354, 0x693f, + 0x6f70, 0x576a, 0x58f7, 0x5b2c, 0x7d2c, 0x722a, 0x540a, 0x91e3, + 0x9db4, 0x4ead, 0x4f4e, 0x505c, 0x5075, 0x5243, 0x8c9e, 0x5448, + 0x5824, 0x5b9a, 0x5e1d, 0x5e95, 0x5ead, 0x5ef7, 0x5f1f, 0x608c, + 0x62b5, 0x633a, 0x63d0, 0x68af, 0x6c40, 0x7887, 0x798e, 0x7a0b, + 0x7de0, 0x8247, 0x8a02, 0x8ae6, 0x8e44, 0x9013, + /* 0x45 */ + 0x90b8, 0x912d, 0x91d8, 0x9f0e, 0x6ce5, 0x6458, 0x64e2, 0x6575, + 0x6ef4, 0x7684, 0x7b1b, 0x9069, 0x93d1, 0x6eba, 0x54f2, 0x5fb9, + 0x64a4, 0x8f4d, 0x8fed, 0x9244, 0x5178, 0x586b, 0x5929, 0x5c55, + 0x5e97, 0x6dfb, 0x7e8f, 0x751c, 0x8cbc, 0x8ee2, 0x985b, 0x70b9, + 0x4f1d, 0x6bbf, 0x6fb1, 0x7530, 0x96fb, 0x514e, 0x5410, 0x5835, + 0x5857, 0x59ac, 0x5c60, 0x5f92, 0x6597, 0x675c, 0x6e21, 0x767b, + 0x83df, 0x8ced, 0x9014, 0x90fd, 0x934d, 0x7825, 0x783a, 0x52aa, + 0x5ea6, 0x571f, 0x5974, 0x6012, 0x5012, 0x515a, 0x51ac, 0x51cd, + 0x5200, 0x5510, 0x5854, 0x5858, 0x5957, 0x5b95, 0x5cf6, 0x5d8b, + 0x60bc, 0x6295, 0x642d, 0x6771, 0x6843, 0x68bc, 0x68df, 0x76d7, + 0x6dd8, 0x6e6f, 0x6d9b, 0x706f, 0x71c8, 0x5f53, 0x75d8, 0x7977, + 0x7b49, 0x7b54, 0x7b52, 0x7cd6, 0x7d71, 0x5230, + /* 0x46 */ + 0x8463, 0x8569, 0x85e4, 0x8a0e, 0x8b04, 0x8c46, 0x8e0f, 0x9003, + 0x900f, 0x9419, 0x9676, 0x982d, 0x9a30, 0x95d8, 0x50cd, 0x52d5, + 0x540c, 0x5802, 0x5c0e, 0x61a7, 0x649e, 0x6d1e, 0x77b3, 0x7ae5, + 0x80f4, 0x8404, 0x9053, 0x9285, 0x5ce0, 0x9d07, 0x533f, 0x5f97, + 0x5fb3, 0x6d9c, 0x7279, 0x7763, 0x79bf, 0x7be4, 0x6bd2, 0x72ec, + 0x8aad, 0x6803, 0x6a61, 0x51f8, 0x7a81, 0x6934, 0x5c4a, 0x9cf6, + 0x82eb, 0x5bc5, 0x9149, 0x701e, 0x5678, 0x5c6f, 0x60c7, 0x6566, + 0x6c8c, 0x8c5a, 0x9041, 0x9813, 0x5451, 0x66c7, 0x920d, 0x5948, + 0x90a3, 0x5185, 0x4e4d, 0x51ea, 0x8599, 0x8b0e, 0x7058, 0x637a, + 0x934b, 0x6962, 0x99b4, 0x7e04, 0x7577, 0x5357, 0x6960, 0x8edf, + 0x96e3, 0x6c5d, 0x4e8c, 0x5c3c, 0x5f10, 0x8fe9, 0x5302, 0x8cd1, + 0x8089, 0x8679, 0x5eff, 0x65e5, 0x4e73, 0x5165, + /* 0x47 */ + 0x5982, 0x5c3f, 0x97ee, 0x4efb, 0x598a, 0x5fcd, 0x8a8d, 0x6fe1, + 0x79b0, 0x7962, 0x5be7, 0x8471, 0x732b, 0x71b1, 0x5e74, 0x5ff5, + 0x637b, 0x649a, 0x71c3, 0x7c98, 0x4e43, 0x5efc, 0x4e4b, 0x57dc, + 0x56a2, 0x60a9, 0x6fc3, 0x7d0d, 0x80fd, 0x8133, 0x81bf, 0x8fb2, + 0x8997, 0x86a4, 0x5df4, 0x628a, 0x64ad, 0x8987, 0x6777, 0x6ce2, + 0x6d3e, 0x7436, 0x7834, 0x5a46, 0x7f75, 0x82ad, 0x99ac, 0x4ff3, + 0x5ec3, 0x62dd, 0x6392, 0x6557, 0x676f, 0x76c3, 0x724c, 0x80cc, + 0x80ba, 0x8f29, 0x914d, 0x500d, 0x57f9, 0x5a92, 0x6885, 0x6973, + 0x7164, 0x72fd, 0x8cb7, 0x58f2, 0x8ce0, 0x966a, 0x9019, 0x877f, + 0x79e4, 0x77e7, 0x8429, 0x4f2f, 0x5265, 0x535a, 0x62cd, 0x67cf, + 0x6cca, 0x767d, 0x7b94, 0x7c95, 0x8236, 0x8584, 0x8feb, 0x66dd, + 0x6f20, 0x7206, 0x7e1b, 0x83ab, 0x99c1, 0x9ea6, + /* 0x48 */ + 0x51fd, 0x7bb1, 0x7872, 0x7bb8, 0x8087, 0x7b48, 0x6ae8, 0x5e61, + 0x808c, 0x7551, 0x7560, 0x516b, 0x9262, 0x6e8c, 0x767a, 0x9197, + 0x9aea, 0x4f10, 0x7f70, 0x629c, 0x7b4f, 0x95a5, 0x9ce9, 0x567a, + 0x5859, 0x86e4, 0x96bc, 0x4f34, 0x5224, 0x534a, 0x53cd, 0x53db, + 0x5e06, 0x642c, 0x6591, 0x677f, 0x6c3e, 0x6c4e, 0x7248, 0x72af, + 0x73ed, 0x7554, 0x7e41, 0x822c, 0x85e9, 0x8ca9, 0x7bc4, 0x91c6, + 0x7169, 0x9812, 0x98ef, 0x633d, 0x6669, 0x756a, 0x76e4, 0x78d0, + 0x8543, 0x86ee, 0x532a, 0x5351, 0x5426, 0x5983, 0x5e87, 0x5f7c, + 0x60b2, 0x6249, 0x6279, 0x62ab, 0x6590, 0x6bd4, 0x6ccc, 0x75b2, + 0x76ae, 0x7891, 0x79d8, 0x7dcb, 0x7f77, 0x80a5, 0x88ab, 0x8ab9, + 0x8cbb, 0x907f, 0x975e, 0x98db, 0x6a0b, 0x7c38, 0x5099, 0x5c3e, + 0x5fae, 0x6787, 0x6bd8, 0x7435, 0x7709, 0x7f8e, + /* 0x49 */ + 0x9f3b, 0x67ca, 0x7a17, 0x5339, 0x758b, 0x9aed, 0x5f66, 0x819d, + 0x83f1, 0x8098, 0x5f3c, 0x5fc5, 0x7562, 0x7b46, 0x903c, 0x6867, + 0x59eb, 0x5a9b, 0x7d10, 0x767e, 0x8b2c, 0x4ff5, 0x5f6a, 0x6a19, + 0x6c37, 0x6f02, 0x74e2, 0x7968, 0x8868, 0x8a55, 0x8c79, 0x5edf, + 0x63cf, 0x75c5, 0x79d2, 0x82d7, 0x9328, 0x92f2, 0x849c, 0x86ed, + 0x9c2d, 0x54c1, 0x5f6c, 0x658c, 0x6d5c, 0x7015, 0x8ca7, 0x8cd3, + 0x983b, 0x654f, 0x74f6, 0x4e0d, 0x4ed8, 0x57e0, 0x592b, 0x5a66, + 0x5bcc, 0x51a8, 0x5e03, 0x5e9c, 0x6016, 0x6276, 0x6577, 0x65a7, + 0x666e, 0x6d6e, 0x7236, 0x7b26, 0x8150, 0x819a, 0x8299, 0x8b5c, + 0x8ca0, 0x8ce6, 0x8d74, 0x961c, 0x9644, 0x4fae, 0x64ab, 0x6b66, + 0x821e, 0x8461, 0x856a, 0x90e8, 0x5c01, 0x6953, 0x98a8, 0x847a, + 0x8557, 0x4f0f, 0x526f, 0x5fa9, 0x5e45, 0x670d, + /* 0x4a */ + 0x798f, 0x8179, 0x8907, 0x8986, 0x6df5, 0x5f17, 0x6255, 0x6cb8, + 0x4ecf, 0x7269, 0x9b92, 0x5206, 0x543b, 0x5674, 0x58b3, 0x61a4, + 0x626e, 0x711a, 0x596e, 0x7c89, 0x7cde, 0x7d1b, 0x96f0, 0x6587, + 0x805e, 0x4e19, 0x4f75, 0x5175, 0x5840, 0x5e63, 0x5e73, 0x5f0a, + 0x67c4, 0x4e26, 0x853d, 0x9589, 0x965b, 0x7c73, 0x9801, 0x50fb, + 0x58c1, 0x7656, 0x78a7, 0x5225, 0x77a5, 0x8511, 0x7b86, 0x504f, + 0x5909, 0x7247, 0x7bc7, 0x7de8, 0x8fba, 0x8fd4, 0x904d, 0x4fbf, + 0x52c9, 0x5a29, 0x5f01, 0x97ad, 0x4fdd, 0x8217, 0x92ea, 0x5703, + 0x6355, 0x6b69, 0x752b, 0x88dc, 0x8f14, 0x7a42, 0x52df, 0x5893, + 0x6155, 0x620a, 0x66ae, 0x6bcd, 0x7c3f, 0x83e9, 0x5023, 0x4ff8, + 0x5305, 0x5446, 0x5831, 0x5949, 0x5b9d, 0x5cf0, 0x5cef, 0x5d29, + 0x5e96, 0x62b1, 0x6367, 0x653e, 0x65b9, 0x670b, + /* 0x4b */ + 0x6cd5, 0x6ce1, 0x70f9, 0x7832, 0x7e2b, 0x80de, 0x82b3, 0x840c, + 0x84ec, 0x8702, 0x8912, 0x8a2a, 0x8c4a, 0x90a6, 0x92d2, 0x98fd, + 0x9cf3, 0x9d6c, 0x4e4f, 0x4ea1, 0x508d, 0x5256, 0x574a, 0x59a8, + 0x5e3d, 0x5fd8, 0x5fd9, 0x623f, 0x66b4, 0x671b, 0x67d0, 0x68d2, + 0x5192, 0x7d21, 0x80aa, 0x81a8, 0x8b00, 0x8c8c, 0x8cbf, 0x927e, + 0x9632, 0x5420, 0x982c, 0x5317, 0x50d5, 0x535c, 0x58a8, 0x64b2, + 0x6734, 0x7267, 0x7766, 0x7a46, 0x91e6, 0x52c3, 0x6ca1, 0x6b86, + 0x5800, 0x5e4c, 0x5954, 0x672c, 0x7ffb, 0x51e1, 0x76c6, 0x6469, + 0x78e8, 0x9b54, 0x9ebb, 0x57cb, 0x59b9, 0x6627, 0x679a, 0x6bce, + 0x54e9, 0x69d9, 0x5e55, 0x819c, 0x6795, 0x9baa, 0x67fe, 0x9c52, + 0x685d, 0x4ea6, 0x4fe3, 0x53c8, 0x62b9, 0x672b, 0x6cab, 0x8fc4, + 0x4fad, 0x7e6d, 0x9ebf, 0x4e07, 0x6162, 0x6e80, + /* 0x4c */ + 0x6f2b, 0x8513, 0x5473, 0x672a, 0x9b45, 0x5df3, 0x7b95, 0x5cac, + 0x5bc6, 0x871c, 0x6e4a, 0x84d1, 0x7a14, 0x8108, 0x5999, 0x7c8d, + 0x6c11, 0x7720, 0x52d9, 0x5922, 0x7121, 0x725f, 0x77db, 0x9727, + 0x9d61, 0x690b, 0x5a7f, 0x5a18, 0x51a5, 0x540d, 0x547d, 0x660e, + 0x76df, 0x8ff7, 0x9298, 0x9cf4, 0x59ea, 0x725d, 0x6ec5, 0x514d, + 0x68c9, 0x7dbf, 0x7dec, 0x9762, 0x9eba, 0x6478, 0x6a21, 0x8302, + 0x5984, 0x5b5f, 0x6bdb, 0x731b, 0x76f2, 0x7db2, 0x8017, 0x8499, + 0x5132, 0x6728, 0x9ed9, 0x76ee, 0x6762, 0x52ff, 0x9905, 0x5c24, + 0x623b, 0x7c7e, 0x8cb0, 0x554f, 0x60b6, 0x7d0b, 0x9580, 0x5301, + 0x4e5f, 0x51b6, 0x591c, 0x723a, 0x8036, 0x91ce, 0x5f25, 0x77e2, + 0x5384, 0x5f79, 0x7d04, 0x85ac, 0x8a33, 0x8e8d, 0x9756, 0x67f3, + 0x85ae, 0x9453, 0x6109, 0x6108, 0x6cb9, 0x7652, + /* 0x4d */ + 0x8aed, 0x8f38, 0x552f, 0x4f51, 0x512a, 0x52c7, 0x53cb, 0x5ba5, + 0x5e7d, 0x60a0, 0x6182, 0x63d6, 0x6709, 0x67da, 0x6e67, 0x6d8c, + 0x7336, 0x7337, 0x7531, 0x7950, 0x88d5, 0x8a98, 0x904a, 0x9091, + 0x90f5, 0x96c4, 0x878d, 0x5915, 0x4e88, 0x4f59, 0x4e0e, 0x8a89, + 0x8f3f, 0x9810, 0x50ad, 0x5e7c, 0x5996, 0x5bb9, 0x5eb8, 0x63da, + 0x63fa, 0x64c1, 0x66dc, 0x694a, 0x69d8, 0x6d0b, 0x6eb6, 0x7194, + 0x7528, 0x7aaf, 0x7f8a, 0x8000, 0x8449, 0x84c9, 0x8981, 0x8b21, + 0x8e0a, 0x9065, 0x967d, 0x990a, 0x617e, 0x6291, 0x6b32, 0x6c83, + 0x6d74, 0x7fcc, 0x7ffc, 0x6dc0, 0x7f85, 0x87ba, 0x88f8, 0x6765, + 0x83b1, 0x983c, 0x96f7, 0x6d1b, 0x7d61, 0x843d, 0x916a, 0x4e71, + 0x5375, 0x5d50, 0x6b04, 0x6feb, 0x85cd, 0x862d, 0x89a7, 0x5229, + 0x540f, 0x5c65, 0x674e, 0x68a8, 0x7406, 0x7483, + /* 0x4e */ + 0x75e2, 0x88cf, 0x88e1, 0x91cc, 0x96e2, 0x9678, 0x5f8b, 0x7387, + 0x7acb, 0x844e, 0x63a0, 0x7565, 0x5289, 0x6d41, 0x6e9c, 0x7409, + 0x7559, 0x786b, 0x7c92, 0x9686, 0x7adc, 0x9f8d, 0x4fb6, 0x616e, + 0x65c5, 0x865c, 0x4e86, 0x4eae, 0x50da, 0x4e21, 0x51cc, 0x5bee, + 0x6599, 0x6881, 0x6dbc, 0x731f, 0x7642, 0x77ad, 0x7a1c, 0x7ce7, + 0x826f, 0x8ad2, 0x907c, 0x91cf, 0x9675, 0x9818, 0x529b, 0x7dd1, + 0x502b, 0x5398, 0x6797, 0x6dcb, 0x71d0, 0x7433, 0x81e8, 0x8f2a, + 0x96a3, 0x9c57, 0x9e9f, 0x7460, 0x5841, 0x6d99, 0x7d2f, 0x985e, + 0x4ee4, 0x4f36, 0x4f8b, 0x51b7, 0x52b1, 0x5dba, 0x601c, 0x73b2, + 0x793c, 0x82d3, 0x9234, 0x96b7, 0x96f6, 0x970a, 0x9e97, 0x9f62, + 0x66a6, 0x6b74, 0x5217, 0x52a3, 0x70c8, 0x88c2, 0x5ec9, 0x604b, + 0x6190, 0x6f23, 0x7149, 0x7c3e, 0x7df4, 0x806f, + /* 0x4f */ + 0x84ee, 0x9023, 0x932c, 0x5442, 0x9b6f, 0x6ad3, 0x7089, 0x8cc2, + 0x8def, 0x9732, 0x52b4, 0x5a41, 0x5eca, 0x5f04, 0x6717, 0x697c, + 0x6994, 0x6d6a, 0x6f0f, 0x7262, 0x72fc, 0x7bed, 0x8001, 0x807e, + 0x874b, 0x90ce, 0x516d, 0x9e93, 0x7984, 0x808b, 0x9332, 0x8ad6, + 0x502d, 0x548c, 0x8a71, 0x6b6a, 0x8cc4, 0x8107, 0x60d1, 0x67a0, + 0x9df2, 0x4e99, 0x4e98, 0x9c10, 0x8a6b, 0x85c1, 0x8568, 0x6900, + 0x6e7e, 0x7897, 0x8155, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x50 */ + 0x5f0c, 0x4e10, 0x4e15, 0x4e2a, 0x4e31, 0x4e36, 0x4e3c, 0x4e3f, + 0x4e42, 0x4e56, 0x4e58, 0x4e82, 0x4e85, 0x8c6b, 0x4e8a, 0x8212, + 0x5f0d, 0x4e8e, 0x4e9e, 0x4e9f, 0x4ea0, 0x4ea2, 0x4eb0, 0x4eb3, + 0x4eb6, 0x4ece, 0x4ecd, 0x4ec4, 0x4ec6, 0x4ec2, 0x4ed7, 0x4ede, + 0x4eed, 0x4edf, 0x4ef7, 0x4f09, 0x4f5a, 0x4f30, 0x4f5b, 0x4f5d, + 0x4f57, 0x4f47, 0x4f76, 0x4f88, 0x4f8f, 0x4f98, 0x4f7b, 0x4f69, + 0x4f70, 0x4f91, 0x4f6f, 0x4f86, 0x4f96, 0x5118, 0x4fd4, 0x4fdf, + 0x4fce, 0x4fd8, 0x4fdb, 0x4fd1, 0x4fda, 0x4fd0, 0x4fe4, 0x4fe5, + 0x501a, 0x5028, 0x5014, 0x502a, 0x5025, 0x5005, 0x4f1c, 0x4ff6, + 0x5021, 0x5029, 0x502c, 0x4ffe, 0x4fef, 0x5011, 0x5006, 0x5043, + 0x5047, 0x6703, 0x5055, 0x5050, 0x5048, 0x505a, 0x5056, 0x506c, + 0x5078, 0x5080, 0x509a, 0x5085, 0x50b4, 0x50b2, + /* 0x51 */ + 0x50c9, 0x50ca, 0x50b3, 0x50c2, 0x50d6, 0x50de, 0x50e5, 0x50ed, + 0x50e3, 0x50ee, 0x50f9, 0x50f5, 0x5109, 0x5101, 0x5102, 0x5116, + 0x5115, 0x5114, 0x511a, 0x5121, 0x513a, 0x5137, 0x513c, 0x513b, + 0x513f, 0x5140, 0x5152, 0x514c, 0x5154, 0x5162, 0x7af8, 0x5169, + 0x516a, 0x516e, 0x5180, 0x5182, 0x56d8, 0x518c, 0x5189, 0x518f, + 0x5191, 0x5193, 0x5195, 0x5196, 0x51a4, 0x51a6, 0x51a2, 0x51a9, + 0x51aa, 0x51ab, 0x51b3, 0x51b1, 0x51b2, 0x51b0, 0x51b5, 0x51bd, + 0x51c5, 0x51c9, 0x51db, 0x51e0, 0x8655, 0x51e9, 0x51ed, 0x51f0, + 0x51f5, 0x51fe, 0x5204, 0x520b, 0x5214, 0x520e, 0x5227, 0x522a, + 0x522e, 0x5233, 0x5239, 0x524f, 0x5244, 0x524b, 0x524c, 0x525e, + 0x5254, 0x526a, 0x5274, 0x5269, 0x5273, 0x527f, 0x527d, 0x528d, + 0x5294, 0x5292, 0x5271, 0x5288, 0x5291, 0x8fa8, + /* 0x52 */ + 0x8fa7, 0x52ac, 0x52ad, 0x52bc, 0x52b5, 0x52c1, 0x52cd, 0x52d7, + 0x52de, 0x52e3, 0x52e6, 0x98ed, 0x52e0, 0x52f3, 0x52f5, 0x52f8, + 0x52f9, 0x5306, 0x5308, 0x7538, 0x530d, 0x5310, 0x530f, 0x5315, + 0x531a, 0x5323, 0x532f, 0x5331, 0x5333, 0x5338, 0x5340, 0x5346, + 0x5345, 0x4e17, 0x5349, 0x534d, 0x51d6, 0x535e, 0x5369, 0x536e, + 0x5918, 0x537b, 0x5377, 0x5382, 0x5396, 0x53a0, 0x53a6, 0x53a5, + 0x53ae, 0x53b0, 0x53b6, 0x53c3, 0x7c12, 0x96d9, 0x53df, 0x66fc, + 0x71ee, 0x53ee, 0x53e8, 0x53ed, 0x53fa, 0x5401, 0x543d, 0x5440, + 0x542c, 0x542d, 0x543c, 0x542e, 0x5436, 0x5429, 0x541d, 0x544e, + 0x548f, 0x5475, 0x548e, 0x545f, 0x5471, 0x5477, 0x5470, 0x5492, + 0x547b, 0x5480, 0x5476, 0x5484, 0x5490, 0x5486, 0x54c7, 0x54a2, + 0x54b8, 0x54a5, 0x54ac, 0x54c4, 0x54c8, 0x54a8, + /* 0x53 */ + 0x54ab, 0x54c2, 0x54a4, 0x54be, 0x54bc, 0x54d8, 0x54e5, 0x54e6, + 0x550f, 0x5514, 0x54fd, 0x54ee, 0x54ed, 0x54fa, 0x54e2, 0x5539, + 0x5540, 0x5563, 0x554c, 0x552e, 0x555c, 0x5545, 0x5556, 0x5557, + 0x5538, 0x5533, 0x555d, 0x5599, 0x5580, 0x54af, 0x558a, 0x559f, + 0x557b, 0x557e, 0x5598, 0x559e, 0x55ae, 0x557c, 0x5583, 0x55a9, + 0x5587, 0x55a8, 0x55da, 0x55c5, 0x55df, 0x55c4, 0x55dc, 0x55e4, + 0x55d4, 0x5614, 0x55f7, 0x5616, 0x55fe, 0x55fd, 0x561b, 0x55f9, + 0x564e, 0x5650, 0x71df, 0x5634, 0x5636, 0x5632, 0x5638, 0x566b, + 0x5664, 0x562f, 0x566c, 0x566a, 0x5686, 0x5680, 0x568a, 0x56a0, + 0x5694, 0x568f, 0x56a5, 0x56ae, 0x56b6, 0x56b4, 0x56c2, 0x56bc, + 0x56c1, 0x56c3, 0x56c0, 0x56c8, 0x56ce, 0x56d1, 0x56d3, 0x56d7, + 0x56ee, 0x56f9, 0x5700, 0x56ff, 0x5704, 0x5709, + /* 0x54 */ + 0x5708, 0x570b, 0x570d, 0x5713, 0x5718, 0x5716, 0x55c7, 0x571c, + 0x5726, 0x5737, 0x5738, 0x574e, 0x573b, 0x5740, 0x574f, 0x5769, + 0x57c0, 0x5788, 0x5761, 0x577f, 0x5789, 0x5793, 0x57a0, 0x57b3, + 0x57a4, 0x57aa, 0x57b0, 0x57c3, 0x57c6, 0x57d4, 0x57d2, 0x57d3, + 0x580a, 0x57d6, 0x57e3, 0x580b, 0x5819, 0x581d, 0x5872, 0x5821, + 0x5862, 0x584b, 0x5870, 0x6bc0, 0x5852, 0x583d, 0x5879, 0x5885, + 0x58b9, 0x589f, 0x58ab, 0x58ba, 0x58de, 0x58bb, 0x58b8, 0x58ae, + 0x58c5, 0x58d3, 0x58d1, 0x58d7, 0x58d9, 0x58d8, 0x58e5, 0x58dc, + 0x58e4, 0x58df, 0x58ef, 0x58fa, 0x58f9, 0x58fb, 0x58fc, 0x58fd, + 0x5902, 0x590a, 0x5910, 0x591b, 0x68a6, 0x5925, 0x592c, 0x592d, + 0x5932, 0x5938, 0x593e, 0x7ad2, 0x5955, 0x5950, 0x594e, 0x595a, + 0x5958, 0x5962, 0x5960, 0x5967, 0x596c, 0x5969, + /* 0x55 */ + 0x5978, 0x5981, 0x599d, 0x4f5e, 0x4fab, 0x59a3, 0x59b2, 0x59c6, + 0x59e8, 0x59dc, 0x598d, 0x59d9, 0x59da, 0x5a25, 0x5a1f, 0x5a11, + 0x5a1c, 0x5a09, 0x5a1a, 0x5a40, 0x5a6c, 0x5a49, 0x5a35, 0x5a36, + 0x5a62, 0x5a6a, 0x5a9a, 0x5abc, 0x5abe, 0x5acb, 0x5ac2, 0x5abd, + 0x5ae3, 0x5ad7, 0x5ae6, 0x5ae9, 0x5ad6, 0x5afa, 0x5afb, 0x5b0c, + 0x5b0b, 0x5b16, 0x5b32, 0x5ad0, 0x5b2a, 0x5b36, 0x5b3e, 0x5b43, + 0x5b45, 0x5b40, 0x5b51, 0x5b55, 0x5b5a, 0x5b5b, 0x5b65, 0x5b69, + 0x5b70, 0x5b73, 0x5b75, 0x5b78, 0x6588, 0x5b7a, 0x5b80, 0x5b83, + 0x5ba6, 0x5bb8, 0x5bc3, 0x5bc7, 0x5bc9, 0x5bd4, 0x5bd0, 0x5be4, + 0x5be6, 0x5be2, 0x5bde, 0x5be5, 0x5beb, 0x5bf0, 0x5bf6, 0x5bf3, + 0x5c05, 0x5c07, 0x5c08, 0x5c0d, 0x5c13, 0x5c20, 0x5c22, 0x5c28, + 0x5c38, 0x5c39, 0x5c41, 0x5c46, 0x5c4e, 0x5c53, + /* 0x56 */ + 0x5c50, 0x5c4f, 0x5b71, 0x5c6c, 0x5c6e, 0x4e62, 0x5c76, 0x5c79, + 0x5c8c, 0x5c91, 0x5c94, 0x599b, 0x5cab, 0x5cbb, 0x5cb6, 0x5cbc, + 0x5cb7, 0x5cc5, 0x5cbe, 0x5cc7, 0x5cd9, 0x5ce9, 0x5cfd, 0x5cfa, + 0x5ced, 0x5d8c, 0x5cea, 0x5d0b, 0x5d15, 0x5d17, 0x5d5c, 0x5d1f, + 0x5d1b, 0x5d11, 0x5d14, 0x5d22, 0x5d1a, 0x5d19, 0x5d18, 0x5d4c, + 0x5d52, 0x5d4e, 0x5d4b, 0x5d6c, 0x5d73, 0x5d76, 0x5d87, 0x5d84, + 0x5d82, 0x5da2, 0x5d9d, 0x5dac, 0x5dae, 0x5dbd, 0x5d90, 0x5db7, + 0x5dbc, 0x5dc9, 0x5dcd, 0x5dd3, 0x5dd2, 0x5dd6, 0x5ddb, 0x5deb, + 0x5df2, 0x5df5, 0x5e0b, 0x5e1a, 0x5e19, 0x5e11, 0x5e1b, 0x5e36, + 0x5e37, 0x5e44, 0x5e43, 0x5e40, 0x5e4e, 0x5e57, 0x5e54, 0x5e5f, + 0x5e62, 0x5e64, 0x5e47, 0x5e75, 0x5e76, 0x5e7a, 0x9ebc, 0x5e7f, + 0x5ea0, 0x5ec1, 0x5ec2, 0x5ec8, 0x5ed0, 0x5ecf, + /* 0x57 */ + 0x5ed6, 0x5ee3, 0x5edd, 0x5eda, 0x5edb, 0x5ee2, 0x5ee1, 0x5ee8, + 0x5ee9, 0x5eec, 0x5ef1, 0x5ef3, 0x5ef0, 0x5ef4, 0x5ef8, 0x5efe, + 0x5f03, 0x5f09, 0x5f5d, 0x5f5c, 0x5f0b, 0x5f11, 0x5f16, 0x5f29, + 0x5f2d, 0x5f38, 0x5f41, 0x5f48, 0x5f4c, 0x5f4e, 0x5f2f, 0x5f51, + 0x5f56, 0x5f57, 0x5f59, 0x5f61, 0x5f6d, 0x5f73, 0x5f77, 0x5f83, + 0x5f82, 0x5f7f, 0x5f8a, 0x5f88, 0x5f91, 0x5f87, 0x5f9e, 0x5f99, + 0x5f98, 0x5fa0, 0x5fa8, 0x5fad, 0x5fbc, 0x5fd6, 0x5ffb, 0x5fe4, + 0x5ff8, 0x5ff1, 0x5fdd, 0x60b3, 0x5fff, 0x6021, 0x6060, 0x6019, + 0x6010, 0x6029, 0x600e, 0x6031, 0x601b, 0x6015, 0x602b, 0x6026, + 0x600f, 0x603a, 0x605a, 0x6041, 0x606a, 0x6077, 0x605f, 0x604a, + 0x6046, 0x604d, 0x6063, 0x6043, 0x6064, 0x6042, 0x606c, 0x606b, + 0x6059, 0x6081, 0x608d, 0x60e7, 0x6083, 0x609a, + /* 0x58 */ + 0x6084, 0x609b, 0x6096, 0x6097, 0x6092, 0x60a7, 0x608b, 0x60e1, + 0x60b8, 0x60e0, 0x60d3, 0x60b4, 0x5ff0, 0x60bd, 0x60c6, 0x60b5, + 0x60d8, 0x614d, 0x6115, 0x6106, 0x60f6, 0x60f7, 0x6100, 0x60f4, + 0x60fa, 0x6103, 0x6121, 0x60fb, 0x60f1, 0x610d, 0x610e, 0x6147, + 0x613e, 0x6128, 0x6127, 0x614a, 0x613f, 0x613c, 0x612c, 0x6134, + 0x613d, 0x6142, 0x6144, 0x6173, 0x6177, 0x6158, 0x6159, 0x615a, + 0x616b, 0x6174, 0x616f, 0x6165, 0x6171, 0x615f, 0x615d, 0x6153, + 0x6175, 0x6199, 0x6196, 0x6187, 0x61ac, 0x6194, 0x619a, 0x618a, + 0x6191, 0x61ab, 0x61ae, 0x61cc, 0x61ca, 0x61c9, 0x61f7, 0x61c8, + 0x61c3, 0x61c6, 0x61ba, 0x61cb, 0x7f79, 0x61cd, 0x61e6, 0x61e3, + 0x61f6, 0x61fa, 0x61f4, 0x61ff, 0x61fd, 0x61fc, 0x61fe, 0x6200, + 0x6208, 0x6209, 0x620d, 0x620c, 0x6214, 0x621b, + /* 0x59 */ + 0x621e, 0x6221, 0x622a, 0x622e, 0x6230, 0x6232, 0x6233, 0x6241, + 0x624e, 0x625e, 0x6263, 0x625b, 0x6260, 0x6268, 0x627c, 0x6282, + 0x6289, 0x627e, 0x6292, 0x6293, 0x6296, 0x62d4, 0x6283, 0x6294, + 0x62d7, 0x62d1, 0x62bb, 0x62cf, 0x62ff, 0x62c6, 0x64d4, 0x62c8, + 0x62dc, 0x62cc, 0x62ca, 0x62c2, 0x62c7, 0x629b, 0x62c9, 0x630c, + 0x62ee, 0x62f1, 0x6327, 0x6302, 0x6308, 0x62ef, 0x62f5, 0x6350, + 0x633e, 0x634d, 0x641c, 0x634f, 0x6396, 0x638e, 0x6380, 0x63ab, + 0x6376, 0x63a3, 0x638f, 0x6389, 0x639f, 0x63b5, 0x636b, 0x6369, + 0x63be, 0x63e9, 0x63c0, 0x63c6, 0x63e3, 0x63c9, 0x63d2, 0x63f6, + 0x63c4, 0x6416, 0x6434, 0x6406, 0x6413, 0x6426, 0x6436, 0x651d, + 0x6417, 0x6428, 0x640f, 0x6467, 0x646f, 0x6476, 0x644e, 0x652a, + 0x6495, 0x6493, 0x64a5, 0x64a9, 0x6488, 0x64bc, + /* 0x5a */ + 0x64da, 0x64d2, 0x64c5, 0x64c7, 0x64bb, 0x64d8, 0x64c2, 0x64f1, + 0x64e7, 0x8209, 0x64e0, 0x64e1, 0x62ac, 0x64e3, 0x64ef, 0x652c, + 0x64f6, 0x64f4, 0x64f2, 0x64fa, 0x6500, 0x64fd, 0x6518, 0x651c, + 0x6505, 0x6524, 0x6523, 0x652b, 0x6534, 0x6535, 0x6537, 0x6536, + 0x6538, 0x754b, 0x6548, 0x6556, 0x6555, 0x654d, 0x6558, 0x655e, + 0x655d, 0x6572, 0x6578, 0x6582, 0x6583, 0x8b8a, 0x659b, 0x659f, + 0x65ab, 0x65b7, 0x65c3, 0x65c6, 0x65c1, 0x65c4, 0x65cc, 0x65d2, + 0x65db, 0x65d9, 0x65e0, 0x65e1, 0x65f1, 0x6772, 0x660a, 0x6603, + 0x65fb, 0x6773, 0x6635, 0x6636, 0x6634, 0x661c, 0x664f, 0x6644, + 0x6649, 0x6641, 0x665e, 0x665d, 0x6664, 0x6667, 0x6668, 0x665f, + 0x6662, 0x6670, 0x6683, 0x6688, 0x668e, 0x6689, 0x6684, 0x6698, + 0x669d, 0x66c1, 0x66b9, 0x66c9, 0x66be, 0x66bc, + /* 0x5b */ + 0x66c4, 0x66b8, 0x66d6, 0x66da, 0x66e0, 0x663f, 0x66e6, 0x66e9, + 0x66f0, 0x66f5, 0x66f7, 0x670f, 0x6716, 0x671e, 0x6726, 0x6727, + 0x9738, 0x672e, 0x673f, 0x6736, 0x6741, 0x6738, 0x6737, 0x6746, + 0x675e, 0x6760, 0x6759, 0x6763, 0x6764, 0x6789, 0x6770, 0x67a9, + 0x677c, 0x676a, 0x678c, 0x678b, 0x67a6, 0x67a1, 0x6785, 0x67b7, + 0x67ef, 0x67b4, 0x67ec, 0x67b3, 0x67e9, 0x67b8, 0x67e4, 0x67de, + 0x67dd, 0x67e2, 0x67ee, 0x67b9, 0x67ce, 0x67c6, 0x67e7, 0x6a9c, + 0x681e, 0x6846, 0x6829, 0x6840, 0x684d, 0x6832, 0x684e, 0x68b3, + 0x682b, 0x6859, 0x6863, 0x6877, 0x687f, 0x689f, 0x688f, 0x68ad, + 0x6894, 0x689d, 0x689b, 0x6883, 0x6aae, 0x68b9, 0x6874, 0x68b5, + 0x68a0, 0x68ba, 0x690f, 0x688d, 0x687e, 0x6901, 0x68ca, 0x6908, + 0x68d8, 0x6922, 0x6926, 0x68e1, 0x690c, 0x68cd, + /* 0x5c */ + 0x68d4, 0x68e7, 0x68d5, 0x6936, 0x6912, 0x6904, 0x68d7, 0x68e3, + 0x6925, 0x68f9, 0x68e0, 0x68ef, 0x6928, 0x692a, 0x691a, 0x6923, + 0x6921, 0x68c6, 0x6979, 0x6977, 0x695c, 0x6978, 0x696b, 0x6954, + 0x697e, 0x696e, 0x6939, 0x6974, 0x693d, 0x6959, 0x6930, 0x6961, + 0x695e, 0x695d, 0x6981, 0x696a, 0x69b2, 0x69ae, 0x69d0, 0x69bf, + 0x69c1, 0x69d3, 0x69be, 0x69ce, 0x5be8, 0x69ca, 0x69dd, 0x69bb, + 0x69c3, 0x69a7, 0x6a2e, 0x6991, 0x69a0, 0x699c, 0x6995, 0x69b4, + 0x69de, 0x69e8, 0x6a02, 0x6a1b, 0x69ff, 0x6b0a, 0x69f9, 0x69f2, + 0x69e7, 0x6a05, 0x69b1, 0x6a1e, 0x69ed, 0x6a14, 0x69eb, 0x6a0a, + 0x6a12, 0x6ac1, 0x6a23, 0x6a13, 0x6a44, 0x6a0c, 0x6a72, 0x6a36, + 0x6a78, 0x6a47, 0x6a62, 0x6a59, 0x6a66, 0x6a48, 0x6a38, 0x6a22, + 0x6a90, 0x6a8d, 0x6aa0, 0x6a84, 0x6aa2, 0x6aa3, + /* 0x5d */ + 0x6a97, 0x8617, 0x6abb, 0x6ac3, 0x6ac2, 0x6ab8, 0x6ab3, 0x6aac, + 0x6ade, 0x6ad1, 0x6adf, 0x6aaa, 0x6ada, 0x6aea, 0x6afb, 0x6b05, + 0x8616, 0x6afa, 0x6b12, 0x6b16, 0x9b31, 0x6b1f, 0x6b38, 0x6b37, + 0x76dc, 0x6b39, 0x98ee, 0x6b47, 0x6b43, 0x6b49, 0x6b50, 0x6b59, + 0x6b54, 0x6b5b, 0x6b5f, 0x6b61, 0x6b78, 0x6b79, 0x6b7f, 0x6b80, + 0x6b84, 0x6b83, 0x6b8d, 0x6b98, 0x6b95, 0x6b9e, 0x6ba4, 0x6baa, + 0x6bab, 0x6baf, 0x6bb2, 0x6bb1, 0x6bb3, 0x6bb7, 0x6bbc, 0x6bc6, + 0x6bcb, 0x6bd3, 0x6bdf, 0x6bec, 0x6beb, 0x6bf3, 0x6bef, 0x9ebe, + 0x6c08, 0x6c13, 0x6c14, 0x6c1b, 0x6c24, 0x6c23, 0x6c5e, 0x6c55, + 0x6c62, 0x6c6a, 0x6c82, 0x6c8d, 0x6c9a, 0x6c81, 0x6c9b, 0x6c7e, + 0x6c68, 0x6c73, 0x6c92, 0x6c90, 0x6cc4, 0x6cf1, 0x6cd3, 0x6cbd, + 0x6cd7, 0x6cc5, 0x6cdd, 0x6cae, 0x6cb1, 0x6cbe, + /* 0x5e */ + 0x6cba, 0x6cdb, 0x6cef, 0x6cd9, 0x6cea, 0x6d1f, 0x884d, 0x6d36, + 0x6d2b, 0x6d3d, 0x6d38, 0x6d19, 0x6d35, 0x6d33, 0x6d12, 0x6d0c, + 0x6d63, 0x6d93, 0x6d64, 0x6d5a, 0x6d79, 0x6d59, 0x6d8e, 0x6d95, + 0x6fe4, 0x6d85, 0x6df9, 0x6e15, 0x6e0a, 0x6db5, 0x6dc7, 0x6de6, + 0x6db8, 0x6dc6, 0x6dec, 0x6dde, 0x6dcc, 0x6de8, 0x6dd2, 0x6dc5, + 0x6dfa, 0x6dd9, 0x6de4, 0x6dd5, 0x6dea, 0x6dee, 0x6e2d, 0x6e6e, + 0x6e2e, 0x6e19, 0x6e72, 0x6e5f, 0x6e3e, 0x6e23, 0x6e6b, 0x6e2b, + 0x6e76, 0x6e4d, 0x6e1f, 0x6e43, 0x6e3a, 0x6e4e, 0x6e24, 0x6eff, + 0x6e1d, 0x6e38, 0x6e82, 0x6eaa, 0x6e98, 0x6ec9, 0x6eb7, 0x6ed3, + 0x6ebd, 0x6eaf, 0x6ec4, 0x6eb2, 0x6ed4, 0x6ed5, 0x6e8f, 0x6ea5, + 0x6ec2, 0x6e9f, 0x6f41, 0x6f11, 0x704c, 0x6eec, 0x6ef8, 0x6efe, + 0x6f3f, 0x6ef2, 0x6f31, 0x6eef, 0x6f32, 0x6ecc, + /* 0x5f */ + 0x6f3e, 0x6f13, 0x6ef7, 0x6f86, 0x6f7a, 0x6f78, 0x6f81, 0x6f80, + 0x6f6f, 0x6f5b, 0x6ff3, 0x6f6d, 0x6f82, 0x6f7c, 0x6f58, 0x6f8e, + 0x6f91, 0x6fc2, 0x6f66, 0x6fb3, 0x6fa3, 0x6fa1, 0x6fa4, 0x6fb9, + 0x6fc6, 0x6faa, 0x6fdf, 0x6fd5, 0x6fec, 0x6fd4, 0x6fd8, 0x6ff1, + 0x6fee, 0x6fdb, 0x7009, 0x700b, 0x6ffa, 0x7011, 0x7001, 0x700f, + 0x6ffe, 0x701b, 0x701a, 0x6f74, 0x701d, 0x7018, 0x701f, 0x7030, + 0x703e, 0x7032, 0x7051, 0x7063, 0x7099, 0x7092, 0x70af, 0x70f1, + 0x70ac, 0x70b8, 0x70b3, 0x70ae, 0x70df, 0x70cb, 0x70dd, 0x70d9, + 0x7109, 0x70fd, 0x711c, 0x7119, 0x7165, 0x7155, 0x7188, 0x7166, + 0x7162, 0x714c, 0x7156, 0x716c, 0x718f, 0x71fb, 0x7184, 0x7195, + 0x71a8, 0x71ac, 0x71d7, 0x71b9, 0x71be, 0x71d2, 0x71c9, 0x71d4, + 0x71ce, 0x71e0, 0x71ec, 0x71e7, 0x71f5, 0x71fc, + /* 0x60 */ + 0x71f9, 0x71ff, 0x720d, 0x7210, 0x721b, 0x7228, 0x722d, 0x722c, + 0x7230, 0x7232, 0x723b, 0x723c, 0x723f, 0x7240, 0x7246, 0x724b, + 0x7258, 0x7274, 0x727e, 0x7282, 0x7281, 0x7287, 0x7292, 0x7296, + 0x72a2, 0x72a7, 0x72b9, 0x72b2, 0x72c3, 0x72c6, 0x72c4, 0x72ce, + 0x72d2, 0x72e2, 0x72e0, 0x72e1, 0x72f9, 0x72f7, 0x500f, 0x7317, + 0x730a, 0x731c, 0x7316, 0x731d, 0x7334, 0x732f, 0x7329, 0x7325, + 0x733e, 0x734e, 0x734f, 0x9ed8, 0x7357, 0x736a, 0x7368, 0x7370, + 0x7378, 0x7375, 0x737b, 0x737a, 0x73c8, 0x73b3, 0x73ce, 0x73bb, + 0x73c0, 0x73e5, 0x73ee, 0x73de, 0x74a2, 0x7405, 0x746f, 0x7425, + 0x73f8, 0x7432, 0x743a, 0x7455, 0x743f, 0x745f, 0x7459, 0x7441, + 0x745c, 0x7469, 0x7470, 0x7463, 0x746a, 0x7476, 0x747e, 0x748b, + 0x749e, 0x74a7, 0x74ca, 0x74cf, 0x74d4, 0x73f1, + /* 0x61 */ + 0x74e0, 0x74e3, 0x74e7, 0x74e9, 0x74ee, 0x74f2, 0x74f0, 0x74f1, + 0x74f8, 0x74f7, 0x7504, 0x7503, 0x7505, 0x750c, 0x750e, 0x750d, + 0x7515, 0x7513, 0x751e, 0x7526, 0x752c, 0x753c, 0x7544, 0x754d, + 0x754a, 0x7549, 0x755b, 0x7546, 0x755a, 0x7569, 0x7564, 0x7567, + 0x756b, 0x756d, 0x7578, 0x7576, 0x7586, 0x7587, 0x7574, 0x758a, + 0x7589, 0x7582, 0x7594, 0x759a, 0x759d, 0x75a5, 0x75a3, 0x75c2, + 0x75b3, 0x75c3, 0x75b5, 0x75bd, 0x75b8, 0x75bc, 0x75b1, 0x75cd, + 0x75ca, 0x75d2, 0x75d9, 0x75e3, 0x75de, 0x75fe, 0x75ff, 0x75fc, + 0x7601, 0x75f0, 0x75fa, 0x75f2, 0x75f3, 0x760b, 0x760d, 0x7609, + 0x761f, 0x7627, 0x7620, 0x7621, 0x7622, 0x7624, 0x7634, 0x7630, + 0x763b, 0x7647, 0x7648, 0x7646, 0x765c, 0x7658, 0x7661, 0x7662, + 0x7668, 0x7669, 0x766a, 0x7667, 0x766c, 0x7670, + /* 0x62 */ + 0x7672, 0x7676, 0x7678, 0x767c, 0x7680, 0x7683, 0x7688, 0x768b, + 0x768e, 0x7696, 0x7693, 0x7699, 0x769a, 0x76b0, 0x76b4, 0x76b8, + 0x76b9, 0x76ba, 0x76c2, 0x76cd, 0x76d6, 0x76d2, 0x76de, 0x76e1, + 0x76e5, 0x76e7, 0x76ea, 0x862f, 0x76fb, 0x7708, 0x7707, 0x7704, + 0x7729, 0x7724, 0x771e, 0x7725, 0x7726, 0x771b, 0x7737, 0x7738, + 0x7747, 0x775a, 0x7768, 0x776b, 0x775b, 0x7765, 0x777f, 0x777e, + 0x7779, 0x778e, 0x778b, 0x7791, 0x77a0, 0x779e, 0x77b0, 0x77b6, + 0x77b9, 0x77bf, 0x77bc, 0x77bd, 0x77bb, 0x77c7, 0x77cd, 0x77d7, + 0x77da, 0x77dc, 0x77e3, 0x77ee, 0x77fc, 0x780c, 0x7812, 0x7926, + 0x7820, 0x792a, 0x7845, 0x788e, 0x7874, 0x7886, 0x787c, 0x789a, + 0x788c, 0x78a3, 0x78b5, 0x78aa, 0x78af, 0x78d1, 0x78c6, 0x78cb, + 0x78d4, 0x78be, 0x78bc, 0x78c5, 0x78ca, 0x78ec, + /* 0x63 */ + 0x78e7, 0x78da, 0x78fd, 0x78f4, 0x7907, 0x7912, 0x7911, 0x7919, + 0x792c, 0x792b, 0x7940, 0x7960, 0x7957, 0x795f, 0x795a, 0x7955, + 0x7953, 0x797a, 0x797f, 0x798a, 0x799d, 0x79a7, 0x9f4b, 0x79aa, + 0x79ae, 0x79b3, 0x79b9, 0x79ba, 0x79c9, 0x79d5, 0x79e7, 0x79ec, + 0x79e1, 0x79e3, 0x7a08, 0x7a0d, 0x7a18, 0x7a19, 0x7a20, 0x7a1f, + 0x7980, 0x7a31, 0x7a3b, 0x7a3e, 0x7a37, 0x7a43, 0x7a57, 0x7a49, + 0x7a61, 0x7a62, 0x7a69, 0x9f9d, 0x7a70, 0x7a79, 0x7a7d, 0x7a88, + 0x7a97, 0x7a95, 0x7a98, 0x7a96, 0x7aa9, 0x7ac8, 0x7ab0, 0x7ab6, + 0x7ac5, 0x7ac4, 0x7abf, 0x9083, 0x7ac7, 0x7aca, 0x7acd, 0x7acf, + 0x7ad5, 0x7ad3, 0x7ad9, 0x7ada, 0x7add, 0x7ae1, 0x7ae2, 0x7ae6, + 0x7aed, 0x7af0, 0x7b02, 0x7b0f, 0x7b0a, 0x7b06, 0x7b33, 0x7b18, + 0x7b19, 0x7b1e, 0x7b35, 0x7b28, 0x7b36, 0x7b50, + /* 0x64 */ + 0x7b7a, 0x7b04, 0x7b4d, 0x7b0b, 0x7b4c, 0x7b45, 0x7b75, 0x7b65, + 0x7b74, 0x7b67, 0x7b70, 0x7b71, 0x7b6c, 0x7b6e, 0x7b9d, 0x7b98, + 0x7b9f, 0x7b8d, 0x7b9c, 0x7b9a, 0x7b8b, 0x7b92, 0x7b8f, 0x7b5d, + 0x7b99, 0x7bcb, 0x7bc1, 0x7bcc, 0x7bcf, 0x7bb4, 0x7bc6, 0x7bdd, + 0x7be9, 0x7c11, 0x7c14, 0x7be6, 0x7be5, 0x7c60, 0x7c00, 0x7c07, + 0x7c13, 0x7bf3, 0x7bf7, 0x7c17, 0x7c0d, 0x7bf6, 0x7c23, 0x7c27, + 0x7c2a, 0x7c1f, 0x7c37, 0x7c2b, 0x7c3d, 0x7c4c, 0x7c43, 0x7c54, + 0x7c4f, 0x7c40, 0x7c50, 0x7c58, 0x7c5f, 0x7c64, 0x7c56, 0x7c65, + 0x7c6c, 0x7c75, 0x7c83, 0x7c90, 0x7ca4, 0x7cad, 0x7ca2, 0x7cab, + 0x7ca1, 0x7ca8, 0x7cb3, 0x7cb2, 0x7cb1, 0x7cae, 0x7cb9, 0x7cbd, + 0x7cc0, 0x7cc5, 0x7cc2, 0x7cd8, 0x7cd2, 0x7cdc, 0x7ce2, 0x9b3b, + 0x7cef, 0x7cf2, 0x7cf4, 0x7cf6, 0x7cfa, 0x7d06, + /* 0x65 */ + 0x7d02, 0x7d1c, 0x7d15, 0x7d0a, 0x7d45, 0x7d4b, 0x7d2e, 0x7d32, + 0x7d3f, 0x7d35, 0x7d46, 0x7d73, 0x7d56, 0x7d4e, 0x7d72, 0x7d68, + 0x7d6e, 0x7d4f, 0x7d63, 0x7d93, 0x7d89, 0x7d5b, 0x7d8f, 0x7d7d, + 0x7d9b, 0x7dba, 0x7dae, 0x7da3, 0x7db5, 0x7dc7, 0x7dbd, 0x7dab, + 0x7e3d, 0x7da2, 0x7daf, 0x7ddc, 0x7db8, 0x7d9f, 0x7db0, 0x7dd8, + 0x7ddd, 0x7de4, 0x7dde, 0x7dfb, 0x7df2, 0x7de1, 0x7e05, 0x7e0a, + 0x7e23, 0x7e21, 0x7e12, 0x7e31, 0x7e1f, 0x7e09, 0x7e0b, 0x7e22, + 0x7e46, 0x7e66, 0x7e3b, 0x7e35, 0x7e39, 0x7e43, 0x7e37, 0x7e32, + 0x7e3a, 0x7e67, 0x7e5d, 0x7e56, 0x7e5e, 0x7e59, 0x7e5a, 0x7e79, + 0x7e6a, 0x7e69, 0x7e7c, 0x7e7b, 0x7e83, 0x7dd5, 0x7e7d, 0x8fae, + 0x7e7f, 0x7e88, 0x7e89, 0x7e8c, 0x7e92, 0x7e90, 0x7e93, 0x7e94, + 0x7e96, 0x7e8e, 0x7e9b, 0x7e9c, 0x7f38, 0x7f3a, + /* 0x66 */ + 0x7f45, 0x7f4c, 0x7f4d, 0x7f4e, 0x7f50, 0x7f51, 0x7f55, 0x7f54, + 0x7f58, 0x7f5f, 0x7f60, 0x7f68, 0x7f69, 0x7f67, 0x7f78, 0x7f82, + 0x7f86, 0x7f83, 0x7f88, 0x7f87, 0x7f8c, 0x7f94, 0x7f9e, 0x7f9d, + 0x7f9a, 0x7fa3, 0x7faf, 0x7fb2, 0x7fb9, 0x7fae, 0x7fb6, 0x7fb8, + 0x8b71, 0x7fc5, 0x7fc6, 0x7fca, 0x7fd5, 0x7fd4, 0x7fe1, 0x7fe6, + 0x7fe9, 0x7ff3, 0x7ff9, 0x98dc, 0x8006, 0x8004, 0x800b, 0x8012, + 0x8018, 0x8019, 0x801c, 0x8021, 0x8028, 0x803f, 0x803b, 0x804a, + 0x8046, 0x8052, 0x8058, 0x805a, 0x805f, 0x8062, 0x8068, 0x8073, + 0x8072, 0x8070, 0x8076, 0x8079, 0x807d, 0x807f, 0x8084, 0x8086, + 0x8085, 0x809b, 0x8093, 0x809a, 0x80ad, 0x5190, 0x80ac, 0x80db, + 0x80e5, 0x80d9, 0x80dd, 0x80c4, 0x80da, 0x80d6, 0x8109, 0x80ef, + 0x80f1, 0x811b, 0x8129, 0x8123, 0x812f, 0x814b, + /* 0x67 */ + 0x968b, 0x8146, 0x813e, 0x8153, 0x8151, 0x80fc, 0x8171, 0x816e, + 0x8165, 0x8166, 0x8174, 0x8183, 0x8188, 0x818a, 0x8180, 0x8182, + 0x81a0, 0x8195, 0x81a4, 0x81a3, 0x815f, 0x8193, 0x81a9, 0x81b0, + 0x81b5, 0x81be, 0x81b8, 0x81bd, 0x81c0, 0x81c2, 0x81ba, 0x81c9, + 0x81cd, 0x81d1, 0x81d9, 0x81d8, 0x81c8, 0x81da, 0x81df, 0x81e0, + 0x81e7, 0x81fa, 0x81fb, 0x81fe, 0x8201, 0x8202, 0x8205, 0x8207, + 0x820a, 0x820d, 0x8210, 0x8216, 0x8229, 0x822b, 0x8238, 0x8233, + 0x8240, 0x8259, 0x8258, 0x825d, 0x825a, 0x825f, 0x8264, 0x8262, + 0x8268, 0x826a, 0x826b, 0x822e, 0x8271, 0x8277, 0x8278, 0x827e, + 0x828d, 0x8292, 0x82ab, 0x829f, 0x82bb, 0x82ac, 0x82e1, 0x82e3, + 0x82df, 0x82d2, 0x82f4, 0x82f3, 0x82fa, 0x8393, 0x8303, 0x82fb, + 0x82f9, 0x82de, 0x8306, 0x82dc, 0x8309, 0x82d9, + /* 0x68 */ + 0x8335, 0x8334, 0x8316, 0x8332, 0x8331, 0x8340, 0x8339, 0x8350, + 0x8345, 0x832f, 0x832b, 0x8317, 0x8318, 0x8385, 0x839a, 0x83aa, + 0x839f, 0x83a2, 0x8396, 0x8323, 0x838e, 0x8387, 0x838a, 0x837c, + 0x83b5, 0x8373, 0x8375, 0x83a0, 0x8389, 0x83a8, 0x83f4, 0x8413, + 0x83eb, 0x83ce, 0x83fd, 0x8403, 0x83d8, 0x840b, 0x83c1, 0x83f7, + 0x8407, 0x83e0, 0x83f2, 0x840d, 0x8422, 0x8420, 0x83bd, 0x8438, + 0x8506, 0x83fb, 0x846d, 0x842a, 0x843c, 0x855a, 0x8484, 0x8477, + 0x846b, 0x84ad, 0x846e, 0x8482, 0x8469, 0x8446, 0x842c, 0x846f, + 0x8479, 0x8435, 0x84ca, 0x8462, 0x84b9, 0x84bf, 0x849f, 0x84d9, + 0x84cd, 0x84bb, 0x84da, 0x84d0, 0x84c1, 0x84c6, 0x84d6, 0x84a1, + 0x8521, 0x84ff, 0x84f4, 0x8517, 0x8518, 0x852c, 0x851f, 0x8515, + 0x8514, 0x84fc, 0x8540, 0x8563, 0x8558, 0x8548, + /* 0x69 */ + 0x8541, 0x8602, 0x854b, 0x8555, 0x8580, 0x85a4, 0x8588, 0x8591, + 0x858a, 0x85a8, 0x856d, 0x8594, 0x859b, 0x85ea, 0x8587, 0x859c, + 0x8577, 0x857e, 0x8590, 0x85c9, 0x85ba, 0x85cf, 0x85b9, 0x85d0, + 0x85d5, 0x85dd, 0x85e5, 0x85dc, 0x85f9, 0x860a, 0x8613, 0x860b, + 0x85fe, 0x85fa, 0x8606, 0x8622, 0x861a, 0x8630, 0x863f, 0x864d, + 0x4e55, 0x8654, 0x865f, 0x8667, 0x8671, 0x8693, 0x86a3, 0x86a9, + 0x86aa, 0x868b, 0x868c, 0x86b6, 0x86af, 0x86c4, 0x86c6, 0x86b0, + 0x86c9, 0x8823, 0x86ab, 0x86d4, 0x86de, 0x86e9, 0x86ec, 0x86df, + 0x86db, 0x86ef, 0x8712, 0x8706, 0x8708, 0x8700, 0x8703, 0x86fb, + 0x8711, 0x8709, 0x870d, 0x86f9, 0x870a, 0x8734, 0x873f, 0x8737, + 0x873b, 0x8725, 0x8729, 0x871a, 0x8760, 0x875f, 0x8778, 0x874c, + 0x874e, 0x8774, 0x8757, 0x8768, 0x876e, 0x8759, + /* 0x6a */ + 0x8753, 0x8763, 0x876a, 0x8805, 0x87a2, 0x879f, 0x8782, 0x87af, + 0x87cb, 0x87bd, 0x87c0, 0x87d0, 0x96d6, 0x87ab, 0x87c4, 0x87b3, + 0x87c7, 0x87c6, 0x87bb, 0x87ef, 0x87f2, 0x87e0, 0x880f, 0x880d, + 0x87fe, 0x87f6, 0x87f7, 0x880e, 0x87d2, 0x8811, 0x8816, 0x8815, + 0x8822, 0x8821, 0x8831, 0x8836, 0x8839, 0x8827, 0x883b, 0x8844, + 0x8842, 0x8852, 0x8859, 0x885e, 0x8862, 0x886b, 0x8881, 0x887e, + 0x889e, 0x8875, 0x887d, 0x88b5, 0x8872, 0x8882, 0x8897, 0x8892, + 0x88ae, 0x8899, 0x88a2, 0x888d, 0x88a4, 0x88b0, 0x88bf, 0x88b1, + 0x88c3, 0x88c4, 0x88d4, 0x88d8, 0x88d9, 0x88dd, 0x88f9, 0x8902, + 0x88fc, 0x88f4, 0x88e8, 0x88f2, 0x8904, 0x890c, 0x890a, 0x8913, + 0x8943, 0x891e, 0x8925, 0x892a, 0x892b, 0x8941, 0x8944, 0x893b, + 0x8936, 0x8938, 0x894c, 0x891d, 0x8960, 0x895e, + /* 0x6b */ + 0x8966, 0x8964, 0x896d, 0x896a, 0x896f, 0x8974, 0x8977, 0x897e, + 0x8983, 0x8988, 0x898a, 0x8993, 0x8998, 0x89a1, 0x89a9, 0x89a6, + 0x89ac, 0x89af, 0x89b2, 0x89ba, 0x89bd, 0x89bf, 0x89c0, 0x89da, + 0x89dc, 0x89dd, 0x89e7, 0x89f4, 0x89f8, 0x8a03, 0x8a16, 0x8a10, + 0x8a0c, 0x8a1b, 0x8a1d, 0x8a25, 0x8a36, 0x8a41, 0x8a5b, 0x8a52, + 0x8a46, 0x8a48, 0x8a7c, 0x8a6d, 0x8a6c, 0x8a62, 0x8a85, 0x8a82, + 0x8a84, 0x8aa8, 0x8aa1, 0x8a91, 0x8aa5, 0x8aa6, 0x8a9a, 0x8aa3, + 0x8ac4, 0x8acd, 0x8ac2, 0x8ada, 0x8aeb, 0x8af3, 0x8ae7, 0x8ae4, + 0x8af1, 0x8b14, 0x8ae0, 0x8ae2, 0x8af7, 0x8ade, 0x8adb, 0x8b0c, + 0x8b07, 0x8b1a, 0x8ae1, 0x8b16, 0x8b10, 0x8b17, 0x8b20, 0x8b33, + 0x97ab, 0x8b26, 0x8b2b, 0x8b3e, 0x8b28, 0x8b41, 0x8b4c, 0x8b4f, + 0x8b4e, 0x8b49, 0x8b56, 0x8b5b, 0x8b5a, 0x8b6b, + /* 0x6c */ + 0x8b5f, 0x8b6c, 0x8b6f, 0x8b74, 0x8b7d, 0x8b80, 0x8b8c, 0x8b8e, + 0x8b92, 0x8b93, 0x8b96, 0x8b99, 0x8b9a, 0x8c3a, 0x8c41, 0x8c3f, + 0x8c48, 0x8c4c, 0x8c4e, 0x8c50, 0x8c55, 0x8c62, 0x8c6c, 0x8c78, + 0x8c7a, 0x8c82, 0x8c89, 0x8c85, 0x8c8a, 0x8c8d, 0x8c8e, 0x8c94, + 0x8c7c, 0x8c98, 0x621d, 0x8cad, 0x8caa, 0x8cbd, 0x8cb2, 0x8cb3, + 0x8cae, 0x8cb6, 0x8cc8, 0x8cc1, 0x8ce4, 0x8ce3, 0x8cda, 0x8cfd, + 0x8cfa, 0x8cfb, 0x8d04, 0x8d05, 0x8d0a, 0x8d07, 0x8d0f, 0x8d0d, + 0x8d10, 0x9f4e, 0x8d13, 0x8ccd, 0x8d14, 0x8d16, 0x8d67, 0x8d6d, + 0x8d71, 0x8d73, 0x8d81, 0x8d99, 0x8dc2, 0x8dbe, 0x8dba, 0x8dcf, + 0x8dda, 0x8dd6, 0x8dcc, 0x8ddb, 0x8dcb, 0x8dea, 0x8deb, 0x8ddf, + 0x8de3, 0x8dfc, 0x8e08, 0x8e09, 0x8dff, 0x8e1d, 0x8e1e, 0x8e10, + 0x8e1f, 0x8e42, 0x8e35, 0x8e30, 0x8e34, 0x8e4a, + /* 0x6d */ + 0x8e47, 0x8e49, 0x8e4c, 0x8e50, 0x8e48, 0x8e59, 0x8e64, 0x8e60, + 0x8e2a, 0x8e63, 0x8e55, 0x8e76, 0x8e72, 0x8e7c, 0x8e81, 0x8e87, + 0x8e85, 0x8e84, 0x8e8b, 0x8e8a, 0x8e93, 0x8e91, 0x8e94, 0x8e99, + 0x8eaa, 0x8ea1, 0x8eac, 0x8eb0, 0x8ec6, 0x8eb1, 0x8ebe, 0x8ec5, + 0x8ec8, 0x8ecb, 0x8edb, 0x8ee3, 0x8efc, 0x8efb, 0x8eeb, 0x8efe, + 0x8f0a, 0x8f05, 0x8f15, 0x8f12, 0x8f19, 0x8f13, 0x8f1c, 0x8f1f, + 0x8f1b, 0x8f0c, 0x8f26, 0x8f33, 0x8f3b, 0x8f39, 0x8f45, 0x8f42, + 0x8f3e, 0x8f4c, 0x8f49, 0x8f46, 0x8f4e, 0x8f57, 0x8f5c, 0x8f62, + 0x8f63, 0x8f64, 0x8f9c, 0x8f9f, 0x8fa3, 0x8fad, 0x8faf, 0x8fb7, + 0x8fda, 0x8fe5, 0x8fe2, 0x8fea, 0x8fef, 0x9087, 0x8ff4, 0x9005, + 0x8ff9, 0x8ffa, 0x9011, 0x9015, 0x9021, 0x900d, 0x901e, 0x9016, + 0x900b, 0x9027, 0x9036, 0x9035, 0x9039, 0x8ff8, + /* 0x6e */ + 0x904f, 0x9050, 0x9051, 0x9052, 0x900e, 0x9049, 0x903e, 0x9056, + 0x9058, 0x905e, 0x9068, 0x906f, 0x9076, 0x96a8, 0x9072, 0x9082, + 0x907d, 0x9081, 0x9080, 0x908a, 0x9089, 0x908f, 0x90a8, 0x90af, + 0x90b1, 0x90b5, 0x90e2, 0x90e4, 0x6248, 0x90db, 0x9102, 0x9112, + 0x9119, 0x9132, 0x9130, 0x914a, 0x9156, 0x9158, 0x9163, 0x9165, + 0x9169, 0x9173, 0x9172, 0x918b, 0x9189, 0x9182, 0x91a2, 0x91ab, + 0x91af, 0x91aa, 0x91b5, 0x91b4, 0x91ba, 0x91c0, 0x91c1, 0x91c9, + 0x91cb, 0x91d0, 0x91d6, 0x91df, 0x91e1, 0x91db, 0x91fc, 0x91f5, + 0x91f6, 0x921e, 0x91ff, 0x9214, 0x922c, 0x9215, 0x9211, 0x925e, + 0x9257, 0x9245, 0x9249, 0x9264, 0x9248, 0x9295, 0x923f, 0x924b, + 0x9250, 0x929c, 0x9296, 0x9293, 0x929b, 0x925a, 0x92cf, 0x92b9, + 0x92b7, 0x92e9, 0x930f, 0x92fa, 0x9344, 0x932e, + /* 0x6f */ + 0x9319, 0x9322, 0x931a, 0x9323, 0x933a, 0x9335, 0x933b, 0x935c, + 0x9360, 0x937c, 0x936e, 0x9356, 0x93b0, 0x93ac, 0x93ad, 0x9394, + 0x93b9, 0x93d6, 0x93d7, 0x93e8, 0x93e5, 0x93d8, 0x93c3, 0x93dd, + 0x93d0, 0x93c8, 0x93e4, 0x941a, 0x9414, 0x9413, 0x9403, 0x9407, + 0x9410, 0x9436, 0x942b, 0x9435, 0x9421, 0x943a, 0x9441, 0x9452, + 0x9444, 0x945b, 0x9460, 0x9462, 0x945e, 0x946a, 0x9229, 0x9470, + 0x9475, 0x9477, 0x947d, 0x945a, 0x947c, 0x947e, 0x9481, 0x947f, + 0x9582, 0x9587, 0x958a, 0x9594, 0x9596, 0x9598, 0x9599, 0x95a0, + 0x95a8, 0x95a7, 0x95ad, 0x95bc, 0x95bb, 0x95b9, 0x95be, 0x95ca, + 0x6ff6, 0x95c3, 0x95cd, 0x95cc, 0x95d5, 0x95d4, 0x95d6, 0x95dc, + 0x95e1, 0x95e5, 0x95e2, 0x9621, 0x9628, 0x962e, 0x962f, 0x9642, + 0x964c, 0x964f, 0x964b, 0x9677, 0x965c, 0x965e, + /* 0x70 */ + 0x965d, 0x965f, 0x9666, 0x9672, 0x966c, 0x968d, 0x9698, 0x9695, + 0x9697, 0x96aa, 0x96a7, 0x96b1, 0x96b2, 0x96b0, 0x96b4, 0x96b6, + 0x96b8, 0x96b9, 0x96ce, 0x96cb, 0x96c9, 0x96cd, 0x894d, 0x96dc, + 0x970d, 0x96d5, 0x96f9, 0x9704, 0x9706, 0x9708, 0x9713, 0x970e, + 0x9711, 0x970f, 0x9716, 0x9719, 0x9724, 0x972a, 0x9730, 0x9739, + 0x973d, 0x973e, 0x9744, 0x9746, 0x9748, 0x9742, 0x9749, 0x975c, + 0x9760, 0x9764, 0x9766, 0x9768, 0x52d2, 0x976b, 0x9771, 0x9779, + 0x9785, 0x977c, 0x9781, 0x977a, 0x9786, 0x978b, 0x978f, 0x9790, + 0x979c, 0x97a8, 0x97a6, 0x97a3, 0x97b3, 0x97b4, 0x97c3, 0x97c6, + 0x97c8, 0x97cb, 0x97dc, 0x97ed, 0x9f4f, 0x97f2, 0x7adf, 0x97f6, + 0x97f5, 0x980f, 0x980c, 0x9838, 0x9824, 0x9821, 0x9837, 0x983d, + 0x9846, 0x984f, 0x984b, 0x986b, 0x986f, 0x9870, + /* 0x71 */ + 0x9871, 0x9874, 0x9873, 0x98aa, 0x98af, 0x98b1, 0x98b6, 0x98c4, + 0x98c3, 0x98c6, 0x98e9, 0x98eb, 0x9903, 0x9909, 0x9912, 0x9914, + 0x9918, 0x9921, 0x991d, 0x991e, 0x9924, 0x9920, 0x992c, 0x992e, + 0x993d, 0x993e, 0x9942, 0x9949, 0x9945, 0x9950, 0x994b, 0x9951, + 0x9952, 0x994c, 0x9955, 0x9997, 0x9998, 0x99a5, 0x99ad, 0x99ae, + 0x99bc, 0x99df, 0x99db, 0x99dd, 0x99d8, 0x99d1, 0x99ed, 0x99ee, + 0x99f1, 0x99f2, 0x99fb, 0x99f8, 0x9a01, 0x9a0f, 0x9a05, 0x99e2, + 0x9a19, 0x9a2b, 0x9a37, 0x9a45, 0x9a42, 0x9a40, 0x9a43, 0x9a3e, + 0x9a55, 0x9a4d, 0x9a5b, 0x9a57, 0x9a5f, 0x9a62, 0x9a65, 0x9a64, + 0x9a69, 0x9a6b, 0x9a6a, 0x9aad, 0x9ab0, 0x9abc, 0x9ac0, 0x9acf, + 0x9ad1, 0x9ad3, 0x9ad4, 0x9ade, 0x9adf, 0x9ae2, 0x9ae3, 0x9ae6, + 0x9aef, 0x9aeb, 0x9aee, 0x9af4, 0x9af1, 0x9af7, + /* 0x72 */ + 0x9afb, 0x9b06, 0x9b18, 0x9b1a, 0x9b1f, 0x9b22, 0x9b23, 0x9b25, + 0x9b27, 0x9b28, 0x9b29, 0x9b2a, 0x9b2e, 0x9b2f, 0x9b32, 0x9b44, + 0x9b43, 0x9b4f, 0x9b4d, 0x9b4e, 0x9b51, 0x9b58, 0x9b74, 0x9b93, + 0x9b83, 0x9b91, 0x9b96, 0x9b97, 0x9b9f, 0x9ba0, 0x9ba8, 0x9bb4, + 0x9bc0, 0x9bca, 0x9bb9, 0x9bc6, 0x9bcf, 0x9bd1, 0x9bd2, 0x9be3, + 0x9be2, 0x9be4, 0x9bd4, 0x9be1, 0x9c3a, 0x9bf2, 0x9bf1, 0x9bf0, + 0x9c15, 0x9c14, 0x9c09, 0x9c13, 0x9c0c, 0x9c06, 0x9c08, 0x9c12, + 0x9c0a, 0x9c04, 0x9c2e, 0x9c1b, 0x9c25, 0x9c24, 0x9c21, 0x9c30, + 0x9c47, 0x9c32, 0x9c46, 0x9c3e, 0x9c5a, 0x9c60, 0x9c67, 0x9c76, + 0x9c78, 0x9ce7, 0x9cec, 0x9cf0, 0x9d09, 0x9d08, 0x9ceb, 0x9d03, + 0x9d06, 0x9d2a, 0x9d26, 0x9daf, 0x9d23, 0x9d1f, 0x9d44, 0x9d15, + 0x9d12, 0x9d41, 0x9d3f, 0x9d3e, 0x9d46, 0x9d48, + /* 0x73 */ + 0x9d5d, 0x9d5e, 0x9d64, 0x9d51, 0x9d50, 0x9d59, 0x9d72, 0x9d89, + 0x9d87, 0x9dab, 0x9d6f, 0x9d7a, 0x9d9a, 0x9da4, 0x9da9, 0x9db2, + 0x9dc4, 0x9dc1, 0x9dbb, 0x9db8, 0x9dba, 0x9dc6, 0x9dcf, 0x9dc2, + 0x9dd9, 0x9dd3, 0x9df8, 0x9de6, 0x9ded, 0x9def, 0x9dfd, 0x9e1a, + 0x9e1b, 0x9e1e, 0x9e75, 0x9e79, 0x9e7d, 0x9e81, 0x9e88, 0x9e8b, + 0x9e8c, 0x9e92, 0x9e95, 0x9e91, 0x9e9d, 0x9ea5, 0x9ea9, 0x9eb8, + 0x9eaa, 0x9ead, 0x9761, 0x9ecc, 0x9ece, 0x9ecf, 0x9ed0, 0x9ed4, + 0x9edc, 0x9ede, 0x9edd, 0x9ee0, 0x9ee5, 0x9ee8, 0x9eef, 0x9ef4, + 0x9ef6, 0x9ef7, 0x9ef9, 0x9efb, 0x9efc, 0x9efd, 0x9f07, 0x9f08, + 0x76b7, 0x9f15, 0x9f21, 0x9f2c, 0x9f3e, 0x9f4a, 0x9f52, 0x9f54, + 0x9f63, 0x9f5f, 0x9f60, 0x9f61, 0x9f66, 0x9f67, 0x9f6c, 0x9f6a, + 0x9f77, 0x9f72, 0x9f76, 0x9f95, 0x9f9c, 0x9fa0, + /* 0x74 */ + 0x582f, 0x69c7, 0x9059, 0x7464, 0x51dc, 0x7199, +}; + +static int +jisx0208_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = (s[0] & 0x7F); + if ((c1 >= 0x21 && c1 <= 0x28) || (c1 >= 0x30 && c1 <= 0x74)) { + if (n >= 2) { + unsigned char c2 = (s[1] & 0x7F); + if (c2 >= 0x21 && c2 < 0x7f) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + unsigned short wc = 0xfffd; + if (i < 1410) { + if (i < 690) + wc = jisx0208_2uni_page21[i]; + } else { + if (i < 7808) + wc = jisx0208_2uni_page30[i-1410]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short jisx0208_2charset[6879] = { + 0x2140, 0x2171, 0x2172, 0x2178, 0x212f, 0x224c, 0x216b, 0x215e, + 0x212d, 0x2279, 0x215f, 0x2160, 0x2621, 0x2622, 0x2623, 0x2624, + 0x2625, 0x2626, 0x2627, 0x2628, 0x2629, 0x262a, 0x262b, 0x262c, + 0x262d, 0x262e, 0x262f, 0x2630, 0x2631, 0x2632, 0x2633, 0x2634, + 0x2635, 0x2636, 0x2637, 0x2638, 0x2641, 0x2642, 0x2643, 0x2644, + 0x2645, 0x2646, 0x2647, 0x2648, 0x2649, 0x264a, 0x264b, 0x264c, + 0x264d, 0x264e, 0x264f, 0x2650, 0x2651, 0x2652, 0x2653, 0x2654, + 0x2655, 0x2656, 0x2657, 0x2658, 0x2727, 0x2721, 0x2722, 0x2723, + 0x2724, 0x2725, 0x2726, 0x2728, 0x2729, 0x272a, 0x272b, 0x272c, + 0x272d, 0x272e, 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, + 0x2735, 0x2736, 0x2737, 0x2738, 0x2739, 0x273a, 0x273b, 0x273c, + 0x273d, 0x273e, 0x273f, 0x2740, 0x2741, 0x2751, 0x2752, 0x2753, + 0x2754, 0x2755, 0x2756, 0x2758, 0x2759, 0x275a, 0x275b, 0x275c, + 0x275d, 0x275e, 0x275f, 0x2760, 0x2761, 0x2762, 0x2763, 0x2764, + 0x2765, 0x2766, 0x2767, 0x2768, 0x2769, 0x276a, 0x276b, 0x276c, + 0x276d, 0x276e, 0x276f, 0x2770, 0x2771, 0x2757, 0x213e, 0x213d, + 0x2142, 0x2146, 0x2147, 0x2148, 0x2149, 0x2277, 0x2278, 0x2145, + 0x2144, 0x2273, 0x216c, 0x216d, 0x2228, 0x216e, 0x2272, 0x222b, + 0x222c, 0x222a, 0x222d, 0x224d, 0x224e, 0x224f, 0x225f, 0x2250, + 0x2260, 0x223a, 0x223b, 0x215d, 0x2265, 0x2267, 0x2167, 0x225c, + 0x224a, 0x224b, 0x2241, 0x2240, 0x2269, 0x226a, 0x2168, 0x2268, + 0x2266, 0x2262, 0x2162, 0x2261, 0x2165, 0x2166, 0x2263, 0x2264, + 0x223e, 0x223f, 0x223c, 0x223d, 0x225d, 0x225e, 0x2821, 0x282c, + 0x2822, 0x282d, 0x2823, 0x282e, 0x2824, 0x282f, 0x2826, 0x2831, + 0x2825, 0x2830, 0x2827, 0x283c, 0x2837, 0x2832, 0x2829, 0x283e, + 0x2839, 0x2834, 0x2828, 0x2838, 0x283d, 0x2833, 0x282a, 0x283a, + 0x283f, 0x2835, 0x282b, 0x283b, 0x2840, 0x2836, 0x2223, 0x2222, + 0x2225, 0x2224, 0x2227, 0x2226, 0x2221, 0x217e, 0x217b, 0x217d, + 0x217c, 0x227e, 0x217a, 0x2179, 0x216a, 0x2169, 0x2276, 0x2275, + 0x2274, 0x2121, 0x2122, 0x2123, 0x2137, 0x2139, 0x213a, 0x213b, + 0x2152, 0x2153, 0x2154, 0x2155, 0x2156, 0x2157, 0x2158, 0x2159, + 0x215a, 0x215b, 0x2229, 0x222e, 0x214c, 0x214d, 0x2141, 0x2421, + 0x2422, 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, + 0x242a, 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, + 0x2432, 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, + 0x243a, 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, + 0x2442, 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, + 0x244a, 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, + 0x2452, 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, + 0x245a, 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, + 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, + 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, + 0x2472, 0x2473, 0x212b, 0x212c, 0x2135, 0x2136, 0x2521, 0x2522, + 0x2523, 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, + 0x252b, 0x252c, 0x252d, 0x252e, 0x252f, 0x2530, 0x2531, 0x2532, + 0x2533, 0x2534, 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x253a, + 0x253b, 0x253c, 0x253d, 0x253e, 0x253f, 0x2540, 0x2541, 0x2542, + 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, 0x2549, 0x254a, + 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, 0x2551, 0x2552, + 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, 0x2559, 0x255a, + 0x255b, 0x255c, 0x255d, 0x255e, 0x255f, 0x2560, 0x2561, 0x2562, + 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, + 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, 0x2571, 0x2572, + 0x2573, 0x2574, 0x2575, 0x2576, 0x2126, 0x213c, 0x2133, 0x2134, + 0x306c, 0x437a, 0x3c37, 0x4b7c, 0x3e66, 0x3b30, 0x3e65, 0x323c, + 0x4954, 0x4d3f, 0x5022, 0x312f, 0x336e, 0x5023, 0x4024, 0x5242, + 0x3556, 0x4a3a, 0x3e67, 0x4e3e, 0x4a42, 0x5024, 0x4366, 0x5025, + 0x367a, 0x5026, 0x345d, 0x4330, 0x3c67, 0x5027, 0x5028, 0x5029, + 0x4735, 0x3557, 0x4737, 0x4663, 0x3843, 0x4b33, 0x6949, 0x502a, + 0x3e68, 0x502b, 0x3235, 0x3665, 0x3870, 0x4c69, 0x5626, 0x4d70, + 0x467d, 0x3425, 0x3535, 0x502c, 0x502d, 0x4e3b, 0x4d3d, 0x4168, + 0x502f, 0x3b76, 0x4673, 0x5032, 0x313e, 0x385f, 0x385e, 0x3066, + 0x4f4b, 0x4f4a, 0x3a33, 0x3021, 0x5033, 0x5034, 0x5035, 0x4b34, + 0x5036, 0x3872, 0x3067, 0x4b72, 0x357c, 0x357d, 0x357e, 0x4462, + 0x4e3c, 0x5037, 0x5038, 0x5039, 0x3f4d, 0x3d3a, 0x3f4e, 0x503e, + 0x503c, 0x503d, 0x3558, 0x3a23, 0x3270, 0x503b, 0x503a, 0x4a29, + 0x3b46, 0x3b45, 0x423e, 0x503f, 0x4955, 0x4067, 0x2138, 0x5040, + 0x5042, 0x4265, 0x4e61, 0x304a, 0x5041, 0x323e, 0x3644, 0x4367, + 0x376f, 0x5043, 0x4724, 0x346b, 0x5044, 0x304b, 0x3860, 0x346c, + 0x497a, 0x4832, 0x3559, 0x3271, 0x5067, 0x4541, 0x476c, 0x5046, + 0x483c, 0x4e62, 0x3f2d, 0x3b47, 0x3b77, 0x3240, 0x4451, 0x4322, + 0x504a, 0x304c, 0x4463, 0x3d3b, 0x3a34, 0x4d24, 0x424e, 0x323f, + 0x5049, 0x4d3e, 0x5045, 0x5047, 0x3a6e, 0x5048, 0x5524, 0x5050, + 0x5053, 0x5051, 0x3242, 0x4a3b, 0x504b, 0x504f, 0x3873, 0x3b48, + 0x3426, 0x5054, 0x504c, 0x4e63, 0x3b78, 0x504d, 0x5052, 0x5055, + 0x504e, 0x3621, 0x304d, 0x3622, 0x3241, 0x5525, 0x4b79, 0x496e, + 0x3874, 0x3f2f, 0x4e37, 0x4a58, 0x3738, 0x4225, 0x3264, 0x3d53, + 0x5059, 0x505e, 0x505c, 0x5057, 0x422f, 0x505a, 0x505d, 0x505b, + 0x4a5d, 0x5058, 0x3f2e, 0x4b73, 0x505f, 0x5060, 0x3d24, 0x506d, + 0x4750, 0x4936, 0x5068, 0x4a70, 0x3236, 0x506c, 0x5066, 0x506f, + 0x4152, 0x3844, 0x475c, 0x6047, 0x506e, 0x455d, 0x5063, 0x3876, + 0x3875, 0x5061, 0x3c5a, 0x5069, 0x4a6f, 0x434d, 0x5065, 0x3771, + 0x5062, 0x506a, 0x5064, 0x4e51, 0x506b, 0x4f41, 0x3666, 0x3770, + 0x5070, 0x5071, 0x5075, 0x304e, 0x4a50, 0x5074, 0x5073, 0x5077, + 0x5076, 0x4464, 0x3772, 0x5078, 0x3c45, 0x4226, 0x4465, 0x3676, + 0x5079, 0x3536, 0x507a, 0x507c, 0x4b35, 0x3766, 0x3b31, 0x4877, + 0x507b, 0x3a45, 0x4d43, 0x507e, 0x5123, 0x507d, 0x3a44, 0x3d7d, + 0x3739, 0x5124, 0x364f, 0x5121, 0x5122, 0x462f, 0x417c, 0x3623, + 0x4b4d, 0x5125, 0x4e3d, 0x5126, 0x5129, 0x5127, 0x414e, 0x5128, + 0x512a, 0x512c, 0x512b, 0x4a48, 0x3537, 0x512e, 0x512f, 0x322f, + 0x512d, 0x3c74, 0x5132, 0x5131, 0x5130, 0x5056, 0x5133, 0x3d7e, + 0x5134, 0x4d25, 0x4c59, 0x5136, 0x5135, 0x5138, 0x5137, 0x5139, + 0x513a, 0x3074, 0x3835, 0x373b, 0x3d3c, 0x437b, 0x3624, 0x4068, + 0x3877, 0x396e, 0x513c, 0x4c48, 0x4546, 0x3b79, 0x513b, 0x513d, + 0x455e, 0x3375, 0x513e, 0x467e, 0x4134, 0x5140, 0x5141, 0x482c, + 0x3878, 0x4f3b, 0x5142, 0x3626, 0x4a3c, 0x4236, 0x3671, 0x4535, + 0x3773, 0x5143, 0x5144, 0x4662, 0x315f, 0x5147, 0x3a7d, 0x5146, + 0x3a46, 0x5148, 0x666e, 0x5149, 0x4b41, 0x514a, 0x514b, 0x514c, + 0x3e69, 0x3c4c, 0x3427, 0x514f, 0x514d, 0x4c3d, 0x514e, 0x495a, + 0x5150, 0x5151, 0x5152, 0x455f, 0x5156, 0x5154, 0x5155, 0x5153, + 0x3a63, 0x5157, 0x4c6a, 0x4e64, 0x5158, 0x4028, 0x5159, 0x3d5a, + 0x515a, 0x437c, 0x4e3f, 0x4560, 0x5245, 0x515b, 0x7425, 0x3645, + 0x515c, 0x4b5e, 0x3d68, 0x427c, 0x515e, 0x4664, 0x515f, 0x5160, + 0x332e, 0x5161, 0x3627, 0x464c, 0x317a, 0x3d50, 0x4821, 0x5162, + 0x4561, 0x3f4f, 0x5163, 0x4a2c, 0x405a, 0x3422, 0x3429, 0x5164, + 0x5166, 0x373a, 0x5165, 0x4e73, 0x3d69, 0x483d, 0x4a4c, 0x5167, + 0x4d78, 0x5168, 0x5169, 0x457e, 0x516a, 0x4029, 0x3a7e, 0x3774, + 0x516b, 0x3b49, 0x396f, 0x4466, 0x516d, 0x4227, 0x3a6f, 0x516e, + 0x516f, 0x4130, 0x516c, 0x5171, 0x4b36, 0x3964, 0x5170, 0x3775, + 0x3a5e, 0x476d, 0x5174, 0x5172, 0x497b, 0x3e6a, 0x517b, 0x3364, + 0x5175, 0x5173, 0x414f, 0x5177, 0x5176, 0x3344, 0x3760, 0x517c, + 0x4e2d, 0x5178, 0x517d, 0x517a, 0x5179, 0x4e4f, 0x3879, 0x3243, + 0x4e74, 0x3d75, 0x4558, 0x3965, 0x5222, 0x5223, 0x4e65, 0x4f2b, + 0x5225, 0x387a, 0x5224, 0x332f, 0x5226, 0x4b56, 0x443c, 0x4d26, + 0x4a59, 0x5227, 0x7055, 0x4630, 0x5228, 0x342a, 0x4c33, 0x3e21, + 0x5229, 0x4a67, 0x522d, 0x402a, 0x522a, 0x3650, 0x522b, 0x342b, + 0x372e, 0x522e, 0x522f, 0x5230, 0x5231, 0x3c5b, 0x387b, 0x4c5e, + 0x4c68, 0x4677, 0x4a71, 0x5232, 0x5233, 0x5235, 0x5237, 0x5236, + 0x5238, 0x323d, 0x4b4c, 0x3a7c, 0x5239, 0x4159, 0x3e22, 0x3629, + 0x523a, 0x485b, 0x523b, 0x523c, 0x523d, 0x523e, 0x4924, 0x3668, + 0x3065, 0x463f, 0x523f, 0x3d3d, 0x4069, 0x5241, 0x5240, 0x3e23, + 0x3861, 0x5243, 0x483e, 0x5244, 0x485c, 0x4234, 0x426e, 0x3628, + 0x466e, 0x4331, 0x476e, 0x4b4e, 0x5246, 0x406a, 0x3735, 0x5247, + 0x5248, 0x312c, 0x3075, 0x346d, 0x4228, 0x3551, 0x4d71, 0x524b, + 0x3237, 0x524a, 0x362a, 0x524c, 0x4c71, 0x524d, 0x4e52, 0x387c, + 0x3836, 0x524e, 0x5250, 0x524f, 0x3f5f, 0x3139, 0x315e, 0x5251, + 0x5252, 0x3837, 0x5253, 0x356e, 0x3b32, 0x5254, 0x4b74, 0x3a35, + 0x355a, 0x4d27, 0x4150, 0x483f, 0x3c7d, 0x3d47, 0x3c68, 0x3c75, + 0x3d76, 0x4840, 0x5257, 0x3143, 0x4151, 0x387d, 0x3845, 0x3667, + 0x525b, 0x4321, 0x427e, 0x362b, 0x3e24, 0x525c, 0x525a, 0x3244, + 0x4266, 0x3c38, 0x3b4b, 0x3126, 0x3370, 0x3966, 0x3b4a, 0x525d, + 0x525e, 0x3549, 0x3346, 0x3967, 0x3548, 0x445f, 0x3125, 0x4631, + 0x4c3e, 0x3921, 0x4d79, 0x4547, 0x387e, 0x372f, 0x5267, 0x3663, + 0x4b4a, 0x485d, 0x5266, 0x345e, 0x5261, 0x5262, 0x5264, 0x5265, + 0x355b, 0x3f61, 0x4a2d, 0x5263, 0x525f, 0x3863, 0x5260, 0x4f24, + 0x4a72, 0x4468, 0x3862, 0x3970, 0x5268, 0x465d, 0x526c, 0x3c7e, + 0x3c76, 0x526f, 0x526d, 0x4c23, 0x526a, 0x5273, 0x526e, 0x5271, + 0x3846, 0x4c3f, 0x5272, 0x5274, 0x5276, 0x3a70, 0x4f42, 0x526b, + 0x5269, 0x5275, 0x5270, 0x5278, 0x5323, 0x527a, 0x527e, 0x5321, + 0x527b, 0x533e, 0x3a69, 0x3331, 0x5279, 0x5325, 0x3076, 0x5324, + 0x3025, 0x494a, 0x5322, 0x527c, 0x5277, 0x527d, 0x3a48, 0x5326, + 0x3077, 0x532f, 0x5327, 0x5328, 0x3e25, 0x4b69, 0x532d, 0x532c, + 0x452f, 0x532e, 0x532b, 0x3134, 0x3a36, 0x3f30, 0x5329, 0x4562, + 0x532a, 0x3022, 0x5334, 0x4d23, 0x3e27, 0x533a, 0x5339, 0x5330, + 0x4243, 0x5331, 0x426f, 0x5336, 0x3e26, 0x5333, 0x4c64, 0x373c, + 0x5337, 0x5338, 0x5335, 0x533b, 0x5332, 0x5341, 0x5346, 0x5342, + 0x533d, 0x5347, 0x4131, 0x5349, 0x3922, 0x533f, 0x437d, 0x5343, + 0x533c, 0x342d, 0x346e, 0x3365, 0x5344, 0x5340, 0x3776, 0x534a, + 0x5348, 0x4153, 0x354a, 0x362c, 0x5345, 0x3674, 0x3144, 0x534e, + 0x534c, 0x5427, 0x5351, 0x534b, 0x534f, 0x534d, 0x3b4c, 0x5350, + 0x5353, 0x5358, 0x5356, 0x5355, 0x4332, 0x3245, 0x5352, 0x5354, + 0x3e28, 0x3133, 0x5357, 0x325e, 0x5362, 0x3e7c, 0x535e, 0x535c, + 0x535d, 0x535f, 0x313d, 0x4139, 0x5359, 0x535a, 0x337a, 0x5361, + 0x346f, 0x5364, 0x5360, 0x5363, 0x4a2e, 0x4655, 0x4838, 0x5366, + 0x5365, 0x3345, 0x5367, 0x536a, 0x5369, 0x5368, 0x4739, 0x536b, + 0x536c, 0x536e, 0x536d, 0x5370, 0x5373, 0x5371, 0x536f, 0x5372, + 0x5374, 0x5375, 0x5376, 0x5377, 0x5378, 0x5145, 0x3c7c, 0x3b4d, + 0x3273, 0x3078, 0x4344, 0x5379, 0x3a24, 0x304f, 0x3f5e, 0x537a, + 0x3847, 0x3971, 0x537c, 0x537b, 0x4a60, 0x537d, 0x5421, 0x537e, + 0x5422, 0x5423, 0x3777, 0x3160, 0x5424, 0x5426, 0x5425, 0x5428, + 0x455a, 0x5429, 0x3035, 0x3a5f, 0x373d, 0x434f, 0x542a, 0x542b, + 0x542d, 0x542e, 0x3a64, 0x3651, 0x4b37, 0x542c, 0x542f, 0x3a41, + 0x3923, 0x5433, 0x3a25, 0x4333, 0x5430, 0x445a, 0x5434, 0x3f62, + 0x5432, 0x5435, 0x373f, 0x5436, 0x5437, 0x3924, 0x3340, 0x5439, + 0x543a, 0x543b, 0x5438, 0x5431, 0x543c, 0x543d, 0x4b64, 0x3e6b, + 0x543f, 0x5440, 0x543e, 0x5442, 0x4738, 0x3068, 0x4956, 0x5443, + 0x3e7d, 0x3c39, 0x475d, 0x3470, 0x3a6b, 0x4b59, 0x4632, 0x3778, + 0x424f, 0x5441, 0x5444, 0x4244, 0x5445, 0x5446, 0x5448, 0x4469, + 0x342e, 0x7421, 0x3161, 0x4a73, 0x3e6c, 0x4548, 0x3a66, 0x544e, + 0x4a3d, 0x4e5d, 0x3274, 0x544a, 0x413a, 0x544d, 0x4563, 0x4549, + 0x4564, 0x4839, 0x444d, 0x3a49, 0x5449, 0x3176, 0x4536, 0x544b, + 0x5447, 0x3f50, 0x544f, 0x3d4e, 0x362d, 0x5450, 0x4a68, 0x417d, + 0x4446, 0x5452, 0x4b4f, 0x5453, 0x5458, 0x4a2f, 0x5457, 0x5451, + 0x5454, 0x5456, 0x3a26, 0x4a49, 0x5459, 0x4345, 0x3275, 0x3e6d, + 0x545b, 0x545a, 0x3968, 0x545c, 0x545e, 0x545d, 0x5460, 0x5455, + 0x5462, 0x5461, 0x545f, 0x3b4e, 0x3f51, 0x4154, 0x5463, 0x403c, + 0x306d, 0x4764, 0x445b, 0x5465, 0x5464, 0x5466, 0x5467, 0x5468, + 0x5469, 0x4a51, 0x546a, 0x3246, 0x546b, 0x4d3c, 0x3330, 0x5249, + 0x3d48, 0x423f, 0x546c, 0x4c6b, 0x4c34, 0x546e, 0x4267, 0x4537, + 0x4240, 0x4957, 0x546f, 0x5470, 0x317b, 0x3c3a, 0x5471, 0x3050, + 0x5472, 0x5473, 0x3162, 0x3471, 0x4660, 0x4a74, 0x5477, 0x4155, + 0x5476, 0x3740, 0x4b5b, 0x5475, 0x4565, 0x5479, 0x5478, 0x547b, + 0x547a, 0x317c, 0x547c, 0x3e29, 0x547e, 0x4325, 0x547d, 0x4a33, + 0x3d77, 0x455b, 0x5521, 0x3925, 0x5522, 0x4721, 0x485e, 0x4c51, + 0x4725, 0x552b, 0x3538, 0x4d45, 0x4c2f, 0x562c, 0x5523, 0x5526, + 0x4245, 0x4b38, 0x454a, 0x5527, 0x4b65, 0x3a4a, 0x3e2a, 0x5528, + 0x3b50, 0x3b4f, 0x3039, 0x3848, 0x402b, 0x3051, 0x552c, 0x552d, + 0x552a, 0x3138, 0x342f, 0x5529, 0x4c45, 0x4931, 0x3028, 0x3079, + 0x3b51, 0x3052, 0x3023, 0x5532, 0x5530, 0x4c3c, 0x5533, 0x5531, + 0x552f, 0x3f31, 0x552e, 0x4a5a, 0x3864, 0x5537, 0x5538, 0x3e2b, + 0x5534, 0x4f2c, 0x474c, 0x5536, 0x3a27, 0x5539, 0x4958, 0x553a, + 0x5535, 0x4c3b, 0x475e, 0x553b, 0x4932, 0x553c, 0x5540, 0x553d, + 0x3247, 0x553f, 0x3c3b, 0x553e, 0x3779, 0x554c, 0x5545, 0x5542, + 0x4364, 0x5541, 0x5543, 0x5544, 0x5546, 0x5547, 0x3472, 0x5549, + 0x5548, 0x554a, 0x3e6e, 0x554d, 0x445c, 0x3145, 0x554b, 0x554e, + 0x554f, 0x5552, 0x5550, 0x5551, 0x3b52, 0x5553, 0x3926, 0x5554, + 0x3b7a, 0x4238, 0x5555, 0x5556, 0x3b5a, 0x3927, 0x4c52, 0x3528, + 0x3849, 0x5557, 0x3358, 0x5558, 0x4239, 0x5559, 0x5623, 0x555a, + 0x555b, 0x555c, 0x555e, 0x555f, 0x5560, 0x4270, 0x3127, 0x3c69, + 0x3042, 0x4157, 0x3430, 0x3c35, 0x3928, 0x4566, 0x3d21, 0x3431, + 0x4368, 0x446a, 0x3038, 0x3539, 0x4a75, 0x3c42, 0x3552, 0x406b, + 0x3c3c, 0x4d28, 0x5561, 0x355c, 0x3a4b, 0x3332, 0x3163, 0x3e2c, + 0x3248, 0x5562, 0x4d46, 0x3d49, 0x3c64, 0x5563, 0x3473, 0x4652, + 0x4c29, 0x5564, 0x5565, 0x4959, 0x5567, 0x3428, 0x3677, 0x5566, + 0x3432, 0x3f32, 0x556b, 0x3b21, 0x3249, 0x556a, 0x5568, 0x556c, + 0x5569, 0x472b, 0x5c4d, 0x3f33, 0x556d, 0x4e40, 0x556e, 0x5570, + 0x437e, 0x556f, 0x4023, 0x3b7b, 0x4250, 0x3c77, 0x4975, 0x406c, + 0x3c4d, 0x5571, 0x3e2d, 0x5572, 0x5573, 0x3053, 0x423a, 0x3f52, + 0x5574, 0x4633, 0x3e2e, 0x3e2f, 0x5575, 0x406d, 0x3e30, 0x5576, + 0x5577, 0x4c60, 0x5578, 0x3646, 0x3d22, 0x5579, 0x557a, 0x3c5c, + 0x3f2c, 0x4674, 0x3f54, 0x4878, 0x4722, 0x3649, 0x557b, 0x356f, + 0x557c, 0x367e, 0x464f, 0x3230, 0x3b53, 0x557d, 0x5622, 0x5621, + 0x367d, 0x557e, 0x4538, 0x4230, 0x454b, 0x3c48, 0x4158, 0x4d7a, + 0x5624, 0x5625, 0x4656, 0x3b33, 0x5627, 0x5628, 0x5629, 0x3474, + 0x562a, 0x562b, 0x322c, 0x413b, 0x3464, 0x562d, 0x4c28, 0x4252, + 0x3359, 0x562f, 0x5631, 0x345f, 0x562e, 0x5630, 0x5633, 0x5632, + 0x5634, 0x5635, 0x463d, 0x362e, 0x3265, 0x5636, 0x563b, 0x5639, + 0x4a77, 0x4a76, 0x4567, 0x5638, 0x3d54, 0x5637, 0x3f72, 0x563c, + 0x3a6a, 0x5642, 0x5643, 0x563d, 0x3333, 0x563e, 0x5647, 0x5646, + 0x5645, 0x5641, 0x5640, 0x5644, 0x4a78, 0x564b, 0x5648, 0x564a, + 0x4d72, 0x5649, 0x563f, 0x3f73, 0x564c, 0x3a37, 0x564d, 0x564e, + 0x5651, 0x5650, 0x564f, 0x4568, 0x563a, 0x5657, 0x5653, 0x5652, + 0x5654, 0x5655, 0x5658, 0x4e66, 0x5659, 0x5656, 0x565a, 0x3460, + 0x565b, 0x565d, 0x565c, 0x565e, 0x565f, 0x406e, 0x3d23, 0x3d64, + 0x4163, 0x3929, 0x3a38, 0x392a, 0x3570, 0x5660, 0x3a39, 0x384a, + 0x5661, 0x4c26, 0x4743, 0x5662, 0x392b, 0x342c, 0x4327, 0x3652, + 0x3b54, 0x495b, 0x4841, 0x5663, 0x3475, 0x5666, 0x4421, 0x5665, + 0x5664, 0x5667, 0x446b, 0x3f63, 0x3b55, 0x404a, 0x4253, 0x3522, + 0x4422, 0x5668, 0x5669, 0x3e6f, 0x4b39, 0x566c, 0x566b, 0x566a, + 0x497d, 0x5673, 0x4b5a, 0x566d, 0x566f, 0x4b6b, 0x566e, 0x5670, + 0x4828, 0x5671, 0x4a3e, 0x5672, 0x3433, 0x4a3f, 0x472f, 0x5674, + 0x5675, 0x392c, 0x3434, 0x5676, 0x3838, 0x4d44, 0x4d29, 0x3476, + 0x5678, 0x4423, 0x392d, 0x3e31, 0x485f, 0x3e32, 0x3d78, 0x446c, + 0x4a79, 0x4539, 0x392e, 0x495c, 0x5679, 0x4559, 0x3a42, 0x384b, + 0x446d, 0x3043, 0x3d6e, 0x392f, 0x4d47, 0x567a, 0x567b, 0x4751, + 0x567c, 0x4e77, 0x4f2d, 0x567e, 0x567d, 0x3347, 0x5721, 0x5724, + 0x5725, 0x5723, 0x4940, 0x3e33, 0x5727, 0x5726, 0x5722, 0x5728, + 0x5729, 0x572a, 0x572d, 0x572b, 0x572c, 0x572e, 0x3164, 0x446e, + 0x572f, 0x377a, 0x3276, 0x4736, 0x5730, 0x467b, 0x4a5b, 0x5731, + 0x4f2e, 0x5732, 0x4a40, 0x5735, 0x5021, 0x5031, 0x3c30, 0x4675, + 0x5736, 0x355d, 0x4424, 0x307a, 0x5737, 0x4a26, 0x3930, 0x4350, + 0x446f, 0x4c6f, 0x3839, 0x384c, 0x5738, 0x5739, 0x573f, 0x3c65, + 0x4425, 0x362f, 0x573a, 0x492b, 0x4346, 0x573b, 0x573c, 0x3630, + 0x573d, 0x573e, 0x5740, 0x4576, 0x5741, 0x5742, 0x5743, 0x5734, + 0x5733, 0x5744, 0x3741, 0x4927, 0x3a4c, 0x4937, 0x4426, 0x494b, + 0x5745, 0x3e34, 0x3146, 0x5746, 0x5747, 0x4c72, 0x4860, 0x574a, + 0x317d, 0x402c, 0x5749, 0x5748, 0x3742, 0x4254, 0x574e, 0x574c, + 0x574b, 0x4e27, 0x3865, 0x3d79, 0x574d, 0x454c, 0x3d3e, 0x4640, + 0x5751, 0x5750, 0x574f, 0x5752, 0x3866, 0x5753, 0x497c, 0x3d5b, + 0x5754, 0x4879, 0x4641, 0x4427, 0x4530, 0x5755, 0x352b, 0x3f34, + 0x492c, 0x3477, 0x4726, 0x5756, 0x3b56, 0x4b3a, 0x4b3b, 0x317e, + 0x575b, 0x4369, 0x5758, 0x3277, 0x582d, 0x575a, 0x4730, 0x5759, + 0x5757, 0x397a, 0x575d, 0x5763, 0x5769, 0x5761, 0x455c, 0x5766, + 0x495d, 0x5760, 0x5765, 0x4e67, 0x3b57, 0x4255, 0x575e, 0x355e, + 0x5768, 0x402d, 0x3165, 0x5762, 0x3278, 0x5767, 0x3631, 0x5764, + 0x576a, 0x576c, 0x5776, 0x5774, 0x5771, 0x5770, 0x4e78, 0x5772, + 0x3632, 0x3931, 0x3d7a, 0x5779, 0x576b, 0x576f, 0x575f, 0x327a, + 0x5773, 0x5775, 0x4351, 0x3a28, 0x3238, 0x576d, 0x5778, 0x5777, + 0x3633, 0x4229, 0x3366, 0x3743, 0x576e, 0x577a, 0x577d, 0x5821, + 0x3c3d, 0x5827, 0x4470, 0x577b, 0x5825, 0x3279, 0x5823, 0x5824, + 0x577e, 0x5822, 0x3867, 0x4d2a, 0x3435, 0x3159, 0x5826, 0x473a, + 0x302d, 0x4861, 0x575c, 0x582c, 0x5830, 0x4c65, 0x5829, 0x4569, + 0x582e, 0x3e70, 0x582f, 0x4657, 0x4f47, 0x582b, 0x5831, 0x397b, + 0x404b, 0x3054, 0x582a, 0x5828, 0x415a, 0x577c, 0x3b34, 0x4246, + 0x583d, 0x415b, 0x5838, 0x5835, 0x5836, 0x3c66, 0x5839, 0x583c, + 0x5837, 0x3d25, 0x583a, 0x5834, 0x4c7c, 0x4c7b, 0x583e, 0x583f, + 0x3055, 0x5833, 0x3672, 0x3026, 0x3436, 0x583b, 0x5843, 0x5842, + 0x5847, 0x5848, 0x5846, 0x5849, 0x5841, 0x5845, 0x584a, 0x584b, + 0x5840, 0x3b7c, 0x5844, 0x4256, 0x3932, 0x5832, 0x3f35, 0x5858, + 0x4a69, 0x584e, 0x584f, 0x5850, 0x5857, 0x5856, 0x4b7d, 0x3437, + 0x5854, 0x3745, 0x3334, 0x5851, 0x4e38, 0x5853, 0x3056, 0x5855, + 0x584c, 0x5852, 0x5859, 0x3744, 0x584d, 0x4d5d, 0x4d2b, 0x585c, + 0x5860, 0x417e, 0x4e79, 0x5861, 0x585e, 0x585b, 0x585a, 0x585f, + 0x4a30, 0x4634, 0x3746, 0x5862, 0x585d, 0x5863, 0x377b, 0x3231, + 0x586b, 0x3438, 0x5869, 0x586a, 0x3a29, 0x5868, 0x5866, 0x5865, + 0x586c, 0x5864, 0x586e, 0x327b, 0x5870, 0x586f, 0x4428, 0x5873, + 0x5871, 0x5867, 0x377c, 0x5872, 0x5876, 0x5875, 0x5877, 0x5874, + 0x5878, 0x5879, 0x587a, 0x4a6a, 0x587c, 0x587b, 0x3d3f, 0x402e, + 0x3266, 0x327c, 0x587d, 0x303f, 0x404c, 0x587e, 0x6c43, 0x5921, + 0x3761, 0x5922, 0x406f, 0x5923, 0x5924, 0x353a, 0x5925, 0x5926, + 0x5927, 0x4257, 0x384d, 0x4c61, 0x4b3c, 0x3d6a, 0x5928, 0x4070, + 0x6e3d, 0x4862, 0x3c6a, 0x3a4d, 0x5929, 0x4247, 0x4a27, 0x4271, + 0x592c, 0x592a, 0x592d, 0x592b, 0x592e, 0x4a31, 0x3037, 0x495e, + 0x4863, 0x592f, 0x5932, 0x3e35, 0x353b, 0x5930, 0x5937, 0x3e36, + 0x5931, 0x4744, 0x4d5e, 0x5933, 0x5934, 0x5938, 0x456a, 0x5935, + 0x3933, 0x405e, 0x5946, 0x4834, 0x4272, 0x4864, 0x5a2d, 0x4a7a, + 0x4471, 0x4b75, 0x593b, 0x3221, 0x436a, 0x5944, 0x4334, 0x593e, + 0x5945, 0x5940, 0x5947, 0x5943, 0x5942, 0x476f, 0x593c, 0x327d, + 0x593a, 0x3571, 0x4273, 0x5936, 0x5939, 0x3934, 0x405b, 0x3e37, + 0x5941, 0x4752, 0x3572, 0x3348, 0x3367, 0x3f21, 0x5949, 0x594e, + 0x594a, 0x377d, 0x594f, 0x3b22, 0x3969, 0x3d26, 0x593d, 0x3b7d, + 0x594c, 0x3b58, 0x594d, 0x3044, 0x5948, 0x4429, 0x3573, 0x3634, + 0x594b, 0x3027, 0x3a43, 0x3f36, 0x4472, 0x4854, 0x5951, 0x415e, + 0x422a, 0x3b2b, 0x5952, 0x5954, 0x5950, 0x4a61, 0x443d, 0x415c, + 0x4a7b, 0x3c4e, 0x5960, 0x595f, 0x3f78, 0x377e, 0x5959, 0x3e39, + 0x4668, 0x4731, 0x5957, 0x415d, 0x3c78, 0x595c, 0x3e38, 0x5956, + 0x595b, 0x4753, 0x5955, 0x3721, 0x335d, 0x595d, 0x4e2b, 0x3a4e, + 0x4335, 0x595a, 0x405c, 0x3935, 0x3f64, 0x3166, 0x413c, 0x5958, + 0x3545, 0x3747, 0x444f, 0x595e, 0x415f, 0x5961, 0x5963, 0x4237, + 0x5969, 0x5964, 0x5966, 0x4941, 0x4473, 0x5967, 0x4d2c, 0x4d48, + 0x3439, 0x302e, 0x5965, 0x5962, 0x3478, 0x3167, 0x5968, 0x4d49, + 0x596c, 0x423b, 0x5973, 0x596d, 0x596a, 0x5971, 0x5953, 0x596e, + 0x5972, 0x4842, 0x456b, 0x596b, 0x596f, 0x3748, 0x3a71, 0x405d, + 0x5977, 0x4526, 0x5974, 0x4b60, 0x5975, 0x5976, 0x4c4e, 0x4022, + 0x3762, 0x597d, 0x3b35, 0x597a, 0x5979, 0x4732, 0x4635, 0x4531, + 0x597b, 0x597c, 0x496f, 0x4745, 0x3b23, 0x4071, 0x4b50, 0x3349, + 0x5a25, 0x597e, 0x4d4a, 0x5a27, 0x5a23, 0x5a24, 0x4160, 0x5a22, + 0x593f, 0x5a26, 0x5a21, 0x5a2b, 0x5a2c, 0x4527, 0x5a2e, 0x3b24, + 0x5a29, 0x353c, 0x5a2f, 0x5a28, 0x5a33, 0x5a32, 0x5a31, 0x5a34, + 0x5a36, 0x3e71, 0x5a35, 0x5a39, 0x5a37, 0x5a38, 0x5970, 0x5a3b, + 0x5a3a, 0x5978, 0x5a3c, 0x5a30, 0x3b59, 0x5a3d, 0x5a3e, 0x5a40, + 0x5a3f, 0x5a41, 0x327e, 0x3936, 0x4a7c, 0x402f, 0x384e, 0x5a43, + 0x5a46, 0x4952, 0x355f, 0x5a45, 0x5a44, 0x4754, 0x5a47, 0x3635, + 0x5a49, 0x5a48, 0x343a, 0x3b36, 0x4658, 0x3749, 0x3f74, 0x5a4a, + 0x4030, 0x4528, 0x495f, 0x5a4b, 0x5a4c, 0x5a4d, 0x4a38, 0x555d, + 0x4046, 0x494c, 0x3a58, 0x4865, 0x4843, 0x454d, 0x4e41, 0x5a4f, + 0x3c50, 0x5a50, 0x3036, 0x3654, 0x404d, 0x4960, 0x5a51, 0x3b42, + 0x4347, 0x3b5b, 0x3f37, 0x5a52, 0x4a7d, 0x3177, 0x3b5c, 0x5a55, + 0x5a53, 0x5a56, 0x4e39, 0x5a54, 0x407b, 0x5a57, 0x4232, 0x5a58, + 0x347a, 0x5a5a, 0x5a59, 0x5a5b, 0x5a5c, 0x347b, 0x467c, 0x4336, + 0x356c, 0x3b5d, 0x4161, 0x3d5c, 0x3030, 0x5a5d, 0x3222, 0x5a61, + 0x3937, 0x5a60, 0x3a2b, 0x3e3a, 0x5a5f, 0x3e3b, 0x4c40, 0x3a2a, + 0x3057, 0x404e, 0x5a66, 0x4031, 0x3147, 0x3d55, 0x4b66, 0x3a72, + 0x3e3c, 0x4027, 0x5a65, 0x5a63, 0x5a64, 0x436b, 0x5b26, 0x5a6a, + 0x3b7e, 0x3938, 0x5a68, 0x5a69, 0x3f38, 0x5a67, 0x3b2f, 0x5a6c, + 0x5a6b, 0x5a70, 0x5a71, 0x5a6d, 0x3322, 0x5a6e, 0x5a6f, 0x4855, + 0x4961, 0x374a, 0x5a72, 0x4032, 0x3e3d, 0x4352, 0x3647, 0x5a73, + 0x5a77, 0x324b, 0x5a74, 0x5a76, 0x5a75, 0x3d6b, 0x4348, 0x3045, + 0x5a78, 0x5a79, 0x442a, 0x4e71, 0x3b43, 0x4a6b, 0x4b3d, 0x5b22, + 0x5a7b, 0x5a7e, 0x5a7d, 0x5a7a, 0x5b21, 0x465e, 0x5a7c, 0x5b23, + 0x3d6c, 0x5b24, 0x4d4b, 0x4778, 0x5b25, 0x5b27, 0x5b28, 0x5b29, + 0x364a, 0x3148, 0x3939, 0x5b2a, 0x5b2b, 0x3d71, 0x4162, 0x5258, + 0x413e, 0x413d, 0x4258, 0x3a47, 0x5072, 0x376e, 0x4d2d, 0x4a7e, + 0x497e, 0x5b2c, 0x3a73, 0x443f, 0x5b2d, 0x4f2f, 0x4b3e, 0x442b, + 0x5b2e, 0x347c, 0x5b2f, 0x5b30, 0x4c5a, 0x4c24, 0x4b76, 0x4b5c, + 0x3b25, 0x5b32, 0x3c6b, 0x4b51, 0x5b34, 0x5b37, 0x5b36, 0x3479, + 0x3560, 0x5b33, 0x5b35, 0x5b38, 0x3f79, 0x4d7b, 0x3049, 0x3a60, + 0x423c, 0x3c5d, 0x3e73, 0x5b3b, 0x454e, 0x5b39, 0x422b, 0x5b3a, + 0x3e72, 0x4c5d, 0x5b3c, 0x5b3d, 0x4d68, 0x5b42, 0x393a, 0x4755, + 0x5b3f, 0x456c, 0x5a5e, 0x5a62, 0x354f, 0x4747, 0x5b41, 0x3e3e, + 0x4844, 0x5b47, 0x487a, 0x5b3e, 0x5b44, 0x5b43, 0x404f, 0x4b6d, + 0x4e53, 0x4b67, 0x324c, 0x3b5e, 0x4f48, 0x5b46, 0x3f75, 0x5b45, + 0x5b40, 0x384f, 0x5b4c, 0x5b4a, 0x324d, 0x5b48, 0x5b4e, 0x5b54, + 0x4248, 0x4a41, 0x5b56, 0x4922, 0x5b55, 0x4770, 0x4b3f, 0x343b, + 0x4077, 0x3d40, 0x4453, 0x4d2e, 0x5b51, 0x5b50, 0x5b52, 0x5b4f, + 0x5b57, 0x5b4d, 0x5b4b, 0x5b53, 0x5b49, 0x436c, 0x4c78, 0x3c46, + 0x3a74, 0x3a3a, 0x4b6f, 0x3341, 0x444e, 0x464a, 0x3149, 0x4072, + 0x4034, 0x372a, 0x5b59, 0x393b, 0x337c, 0x5b5b, 0x3374, 0x5b61, + 0x5b5e, 0x4073, 0x334b, 0x3a2c, 0x334a, 0x3a4f, 0x5b5c, 0x3765, + 0x374b, 0x456d, 0x5b5a, 0x3046, 0x5b5d, 0x5b5f, 0x364d, 0x372c, + 0x343c, 0x354b, 0x5b62, 0x3a79, 0x4b71, 0x3b37, 0x5b63, 0x4930, + 0x5b6f, 0x3233, 0x5b64, 0x5b75, 0x5b65, 0x4e42, 0x5b6c, 0x475f, + 0x5b74, 0x5b67, 0x3034, 0x5b69, 0x393c, 0x5b6b, 0x5b6a, 0x5b66, + 0x5b71, 0x3e3f, 0x546d, 0x3868, 0x4d7c, 0x5b68, 0x4474, 0x3323, + 0x3a2d, 0x5b60, 0x5b70, 0x3361, 0x5b6e, 0x5b72, 0x456e, 0x347e, + 0x5c32, 0x4c49, 0x5b77, 0x347d, 0x5b7e, 0x4b40, 0x5c21, 0x5c23, + 0x5c27, 0x5b79, 0x432a, 0x456f, 0x5c2b, 0x5b7c, 0x5c28, 0x5c22, + 0x3f39, 0x5c2c, 0x4033, 0x5c2a, 0x343d, 0x4f50, 0x5b76, 0x5c26, + 0x3058, 0x5b78, 0x4c3a, 0x5b7d, 0x3f22, 0x4447, 0x5b73, 0x5c25, + 0x3f7a, 0x5c2f, 0x3371, 0x3821, 0x5c31, 0x5b7a, 0x5c30, 0x5c29, + 0x5b7b, 0x5c2d, 0x5c2e, 0x5c3f, 0x464e, 0x5c24, 0x5c3b, 0x5c3d, + 0x4458, 0x4d4c, 0x4976, 0x5c38, 0x424a, 0x5c3e, 0x413f, 0x5c35, + 0x5c42, 0x5c41, 0x466f, 0x5c40, 0x466a, 0x5c44, 0x5c37, 0x3648, + 0x5c3a, 0x3d5d, 0x4760, 0x5c3c, 0x364b, 0x5c34, 0x5c36, 0x5c33, + 0x4f30, 0x335a, 0x5c39, 0x5c43, 0x3335, 0x3a67, 0x315d, 0x5c54, + 0x4f31, 0x5c57, 0x3f3a, 0x5c56, 0x5c55, 0x5c52, 0x5c46, 0x5c63, + 0x5c45, 0x5c58, 0x5c50, 0x5c4b, 0x5c48, 0x5c49, 0x5c51, 0x7422, + 0x5c4e, 0x393d, 0x4448, 0x4164, 0x5c4c, 0x5c47, 0x5c4a, 0x4d4d, + 0x4b6a, 0x5c4f, 0x5c59, 0x5c61, 0x5c5a, 0x5c67, 0x5c65, 0x5c60, + 0x5c5f, 0x4450, 0x4165, 0x5c5d, 0x5c5b, 0x5c62, 0x5c68, 0x4875, + 0x5c6e, 0x5c69, 0x5c6c, 0x5c66, 0x4374, 0x4938, 0x5c5c, 0x5c64, + 0x3e40, 0x4c4f, 0x5c78, 0x5c6b, 0x3822, 0x3223, 0x335f, 0x5c53, + 0x3e41, 0x5c70, 0x5c77, 0x3c79, 0x3372, 0x432e, 0x5c6d, 0x5c72, + 0x5c76, 0x3636, 0x354c, 0x5c74, 0x3521, 0x464b, 0x5c73, 0x5c75, + 0x5c6f, 0x5c71, 0x3360, 0x4349, 0x5c7c, 0x5c7a, 0x3869, 0x5c79, + 0x5d21, 0x5b58, 0x5c7b, 0x5c7d, 0x5c7e, 0x5d2c, 0x5d28, 0x5b6d, + 0x5d27, 0x5d26, 0x5d23, 0x5c6a, 0x5d25, 0x5d24, 0x5d2a, 0x4f26, + 0x5d2d, 0x367b, 0x5d29, 0x5d2b, 0x4827, 0x5d2e, 0x5d32, 0x5d2f, + 0x4d73, 0x5d30, 0x5c5e, 0x5d33, 0x5d34, 0x3135, 0x5d36, 0x3767, + 0x3c21, 0x3655, 0x3224, 0x4d5f, 0x5d38, 0x5d37, 0x5d3a, 0x353d, + 0x3656, 0x343e, 0x5d3d, 0x5d3c, 0x5d3e, 0x324e, 0x4337, 0x5d3f, + 0x343f, 0x5d41, 0x5d40, 0x5d42, 0x5d43, 0x5d44, 0x3b5f, 0x4035, + 0x3a21, 0x4970, 0x4a62, 0x4f44, 0x3b75, 0x3a50, 0x4e72, 0x5d45, + 0x5d46, 0x3b60, 0x5d47, 0x5d48, 0x5d4a, 0x5d49, 0x4b58, 0x3d5e, + 0x3c6c, 0x3b44, 0x5d4b, 0x5d4d, 0x3f23, 0x5d4c, 0x5d4e, 0x5d4f, + 0x5d50, 0x5d51, 0x5d52, 0x5d54, 0x5d53, 0x5d55, 0x3225, 0x434a, + 0x5d56, 0x3b26, 0x334c, 0x5d57, 0x4542, 0x544c, 0x3523, 0x5d58, + 0x5d59, 0x4a6c, 0x4b68, 0x4647, 0x5d5a, 0x4866, 0x487b, 0x4c53, + 0x5d5b, 0x5d5d, 0x5d5c, 0x5d5f, 0x5d5e, 0x5d61, 0x3b61, 0x4c31, + 0x5d62, 0x5d63, 0x3524, 0x5d64, 0x5d66, 0x5d65, 0x3f65, 0x4939, + 0x314a, 0x4845, 0x4475, 0x3d41, 0x3561, 0x4846, 0x3c2e, 0x5d68, + 0x3440, 0x3178, 0x4672, 0x5d67, 0x393e, 0x4353, 0x5d69, 0x5d71, + 0x5d6a, 0x4241, 0x3562, 0x5d72, 0x3768, 0x3525, 0x5d70, 0x5d6e, + 0x5d6b, 0x4d60, 0x4440, 0x4659, 0x5d6c, 0x5d74, 0x5d73, 0x3723, + 0x322d, 0x3a3b, 0x5d6d, 0x5d6f, 0x4b57, 0x4274, 0x4b77, 0x5d7c, + 0x5d7d, 0x324f, 0x4a28, 0x4c7d, 0x5e21, 0x3c23, 0x3e42, 0x5d78, + 0x5d7e, 0x3168, 0x3637, 0x5d75, 0x5d7a, 0x4074, 0x4771, 0x4867, + 0x5d77, 0x4b21, 0x5d79, 0x5e24, 0x5e22, 0x5d7b, 0x4b22, 0x4748, + 0x3563, 0x4525, 0x436d, 0x5e25, 0x5e23, 0x4259, 0x5d76, 0x314b, + 0x4d4e, 0x5e30, 0x5e2f, 0x4076, 0x5e2c, 0x4d6c, 0x4636, 0x5e26, + 0x4445, 0x314c, 0x393f, 0x5e29, 0x3d27, 0x5e2e, 0x5e2d, 0x5e28, + 0x5e2b, 0x3368, 0x5e2a, 0x4749, 0x4e2e, 0x3e74, 0x4075, 0x5e36, + 0x5e34, 0x494d, 0x5e31, 0x5e33, 0x313a, 0x3940, 0x4f32, 0x333d, + 0x4962, 0x4d61, 0x3324, 0x3f3b, 0x5e35, 0x5e3a, 0x3e43, 0x4d30, + 0x5e37, 0x5e32, 0x5e38, 0x4e5e, 0x4573, 0x4642, 0x3336, 0x3155, + 0x5e3e, 0x5e41, 0x4e43, 0x4d64, 0x5e48, 0x5e42, 0x5e3f, 0x4e54, + 0x5e45, 0x3d4a, 0x5e47, 0x5e4c, 0x4571, 0x5e4a, 0x5e44, 0x4338, + 0x5e4b, 0x5e40, 0x5e46, 0x5e4d, 0x307c, 0x5e43, 0x5e4e, 0x3f3c, + 0x3d5f, 0x4a25, 0x3a2e, 0x5e3b, 0x5e49, 0x453a, 0x4036, 0x3369, + 0x3a51, 0x3e44, 0x5e3d, 0x3d42, 0x374c, 0x5e3c, 0x5e52, 0x3d6d, + 0x383a, 0x5e61, 0x5e5b, 0x3574, 0x454f, 0x5e56, 0x5e5f, 0x302f, + 0x3132, 0x3239, 0x5e58, 0x422c, 0x5e4f, 0x5e51, 0x3941, 0x5e62, + 0x5e5d, 0x5e55, 0x5e5c, 0x4c2b, 0x5e5a, 0x5e5e, 0x3850, 0x3e45, + 0x4339, 0x5e54, 0x4d2f, 0x5e57, 0x5e50, 0x4572, 0x5e53, 0x5e59, + 0x4f51, 0x3c3e, 0x4b7e, 0x5e63, 0x482e, 0x5e6f, 0x383b, 0x3d60, + 0x5e65, 0x4e2f, 0x3942, 0x5e72, 0x306e, 0x5e70, 0x5e64, 0x5e6a, + 0x5e6c, 0x4d4f, 0x5e67, 0x452e, 0x5e69, 0x5e71, 0x5e6b, 0x4c47, + 0x5e66, 0x3c22, 0x5e7e, 0x336a, 0x5e68, 0x5e6d, 0x5e6e, 0x426c, + 0x425a, 0x5e76, 0x5e7c, 0x5e7a, 0x4529, 0x5f23, 0x5e77, 0x5e78, + 0x5e60, 0x3579, 0x493a, 0x3c3f, 0x3977, 0x4f33, 0x5e74, 0x5f22, + 0x3169, 0x4166, 0x4779, 0x3441, 0x4e7a, 0x4c21, 0x4452, 0x5e7b, + 0x5e7d, 0x4132, 0x5f21, 0x5e79, 0x5e73, 0x3443, 0x3769, 0x5f2f, + 0x5f2a, 0x4078, 0x3363, 0x3d61, 0x5f33, 0x5f2c, 0x442c, 0x5f29, + 0x4459, 0x5f4c, 0x5f26, 0x5f25, 0x5f2e, 0x5f28, 0x5f27, 0x5f2d, + 0x4021, 0x5f24, 0x5f30, 0x5f31, 0x3442, 0x5f36, 0x5f35, 0x5f37, + 0x5f3a, 0x4543, 0x5f34, 0x5f38, 0x3763, 0x4279, 0x5f32, 0x473b, + 0x5f39, 0x5f3e, 0x5f3c, 0x5f3f, 0x5f42, 0x5f3b, 0x396a, 0x4728, + 0x5e39, 0x4d74, 0x5f3d, 0x5f41, 0x4275, 0x5f40, 0x5f2b, 0x6f69, + 0x5f45, 0x5f49, 0x5f47, 0x5f43, 0x5f44, 0x5f48, 0x5f46, 0x494e, + 0x5f4e, 0x5f4b, 0x5f4a, 0x5f4d, 0x4654, 0x5f4f, 0x4375, 0x426d, + 0x4025, 0x5f50, 0x5f52, 0x5f51, 0x5e75, 0x5f53, 0x4667, 0x5f54, + 0x3250, 0x4574, 0x3325, 0x3564, 0x3c5e, 0x3a52, 0x4f27, 0x3f66, + 0x316a, 0x5f56, 0x5f55, 0x5f59, 0x433a, 0x5f5c, 0x5f57, 0x5f5b, + 0x5f5a, 0x4540, 0x3059, 0x4e75, 0x5f5e, 0x3128, 0x5f60, 0x5f5f, + 0x5f5d, 0x5f58, 0x4b23, 0x5f62, 0x5f61, 0x316b, 0x5f64, 0x4a32, + 0x5f63, 0x4c35, 0x3e47, 0x4133, 0x3e46, 0x4e7b, 0x5f6a, 0x4079, + 0x5f66, 0x5f6b, 0x316c, 0x5f69, 0x4761, 0x5f65, 0x5f68, 0x3e48, + 0x4851, 0x5f6c, 0x3c51, 0x407a, 0x5f6f, 0x5f67, 0x3727, 0x5f6d, + 0x4d50, 0x5f70, 0x7426, 0x3d4f, 0x5f71, 0x5f72, 0x472e, 0x5f74, + 0x5f75, 0x4733, 0x4575, 0x5f77, 0x5f79, 0x4e55, 0x5f76, 0x5f78, + 0x316d, 0x5f73, 0x535b, 0x5f7a, 0x4167, 0x3b38, 0x5f7c, 0x5f7b, + 0x3f24, 0x5259, 0x5f7d, 0x6021, 0x5f6e, 0x5f7e, 0x6022, 0x477a, + 0x6023, 0x6024, 0x6025, 0x6026, 0x445e, 0x6028, 0x6027, 0x6029, + 0x602a, 0x3c5f, 0x4963, 0x4c6c, 0x602b, 0x602c, 0x4156, 0x3c24, + 0x602d, 0x602e, 0x602f, 0x4a52, 0x4847, 0x6030, 0x4757, 0x442d, + 0x6031, 0x3267, 0x356d, 0x4c46, 0x4c36, 0x3234, 0x4f34, 0x4b52, + 0x4a2a, 0x4037, 0x6032, 0x4643, 0x3823, 0x6033, 0x3a54, 0x6035, + 0x6034, 0x6036, 0x6037, 0x6038, 0x353e, 0x6039, 0x603a, 0x3824, + 0x4848, 0x603c, 0x3e75, 0x603b, 0x3638, 0x603d, 0x603f, 0x603e, + 0x6040, 0x3851, 0x6041, 0x3669, 0x4140, 0x397d, 0x6043, 0x6044, + 0x6042, 0x3c6d, 0x4648, 0x3639, 0x6046, 0x432c, 0x6045, 0x4f35, + 0x4762, 0x6049, 0x604b, 0x6048, 0x4c54, 0x604a, 0x604c, 0x4e44, + 0x6050, 0x604f, 0x4376, 0x472d, 0x3825, 0x604e, 0x604d, 0x4d31, + 0x4d32, 0x6051, 0x316e, 0x3976, 0x3b62, 0x6052, 0x6053, 0x6055, + 0x3d43, 0x6057, 0x6056, 0x6058, 0x334d, 0x605a, 0x6059, 0x605c, + 0x605b, 0x383c, 0x4e28, 0x364c, 0x3226, 0x366a, 0x3461, 0x4e68, + 0x605e, 0x6060, 0x6061, 0x3251, 0x605d, 0x3b39, 0x4441, 0x605f, + 0x6064, 0x3c6e, 0x6062, 0x373e, 0x4849, 0x6063, 0x607e, 0x6069, + 0x383d, 0x3565, 0x6066, 0x4d7d, 0x4e30, 0x4276, 0x6068, 0x606a, + 0x4e56, 0x3657, 0x487c, 0x474a, 0x606b, 0x606d, 0x6070, 0x606c, + 0x606f, 0x386a, 0x314d, 0x6071, 0x3f70, 0x606e, 0x4e5c, 0x6074, + 0x7424, 0x6072, 0x6075, 0x6067, 0x6073, 0x3a3c, 0x6076, 0x6077, + 0x4d7e, 0x6078, 0x6079, 0x6065, 0x607a, 0x3444, 0x3c25, 0x607b, + 0x607c, 0x607d, 0x313b, 0x6121, 0x493b, 0x6122, 0x3424, 0x6123, + 0x6124, 0x6125, 0x6127, 0x6128, 0x6126, 0x4953, 0x612a, 0x6129, + 0x612c, 0x612b, 0x612d, 0x612e, 0x6130, 0x612f, 0x3979, 0x6132, + 0x6131, 0x3445, 0x3f53, 0x453c, 0x6133, 0x4038, 0x3b3a, 0x3179, + 0x6134, 0x4d51, 0x4a63, 0x6135, 0x4544, 0x4d33, 0x3943, 0x3f3d, + 0x434b, 0x5234, 0x442e, 0x3268, 0x6136, 0x6137, 0x613c, 0x613a, + 0x6139, 0x5a42, 0x3326, 0x6138, 0x305a, 0x482a, 0x484a, 0x4e31, + 0x613d, 0x613b, 0x435c, 0x4026, 0x482b, 0x492d, 0x613f, 0x4e2c, + 0x374d, 0x6140, 0x613e, 0x4856, 0x6141, 0x6142, 0x305b, 0x3e76, + 0x6147, 0x6144, 0x466d, 0x6143, 0x3526, 0x614a, 0x6145, 0x6146, + 0x6149, 0x6148, 0x4925, 0x4142, 0x4141, 0x353f, 0x614b, 0x614c, + 0x614d, 0x614f, 0x614e, 0x3156, 0x6157, 0x4868, 0x6151, 0x6153, + 0x6155, 0x3f3e, 0x6156, 0x6154, 0x3c40, 0x6150, 0x6152, 0x4942, + 0x3e49, 0x6159, 0x6158, 0x615a, 0x3c26, 0x3a2f, 0x4577, 0x615b, + 0x444b, 0x615d, 0x4e21, 0x615c, 0x4169, 0x6162, 0x6164, 0x6165, + 0x4354, 0x6163, 0x6160, 0x615e, 0x615f, 0x6161, 0x6168, 0x6166, + 0x6167, 0x6169, 0x616b, 0x616c, 0x616d, 0x616e, 0x616a, 0x6170, + 0x616f, 0x6171, 0x4e45, 0x6174, 0x6172, 0x6173, 0x3462, 0x4c7e, + 0x4a4a, 0x6176, 0x6175, 0x6177, 0x6178, 0x617c, 0x6179, 0x617a, + 0x617b, 0x617d, 0x617e, 0x6221, 0x6222, 0x6223, 0x482f, 0x4550, + 0x6224, 0x4772, 0x4934, 0x6225, 0x6226, 0x452a, 0x3327, 0x3944, + 0x6227, 0x6228, 0x6229, 0x3b29, 0x622b, 0x622a, 0x622c, 0x622d, + 0x4869, 0x622e, 0x622f, 0x7369, 0x6230, 0x6231, 0x6232, 0x3b2e, + 0x6233, 0x4756, 0x4b5f, 0x314e, 0x3157, 0x6234, 0x6236, 0x6235, + 0x4570, 0x4039, 0x5d39, 0x6237, 0x4c41, 0x6238, 0x3446, 0x4857, + 0x6239, 0x623a, 0x623b, 0x4c5c, 0x4c55, 0x443e, 0x416a, 0x623d, + 0x3d62, 0x3e4a, 0x6240, 0x623f, 0x623e, 0x487d, 0x3447, 0x3829, + 0x6246, 0x6243, 0x3f3f, 0x4c32, 0x6242, 0x6244, 0x6245, 0x6241, + 0x6247, 0x6248, 0x442f, 0x3463, 0x4365, 0x6249, 0x624a, 0x624d, + 0x3f67, 0x4644, 0x624e, 0x4b53, 0x624b, 0x624c, 0x6251, 0x6250, + 0x624f, 0x6253, 0x6252, 0x6254, 0x6256, 0x6255, 0x4a4d, 0x3d56, + 0x4e46, 0x6257, 0x4637, 0x6258, 0x6259, 0x625d, 0x625b, 0x625c, + 0x625a, 0x625e, 0x625f, 0x6260, 0x6261, 0x4c37, 0x6262, 0x4c70, + 0x6263, 0x434e, 0x476a, 0x366b, 0x433b, 0x6264, 0x363a, 0x4050, + 0x6265, 0x3a3d, 0x6266, 0x6267, 0x3826, 0x3a55, 0x6269, 0x4556, + 0x3a56, 0x354e, 0x4b24, 0x474b, 0x4557, 0x395c, 0x626b, 0x3e4b, + 0x4e32, 0x3945, 0x3827, 0x4823, 0x626d, 0x626f, 0x386b, 0x626e, + 0x4476, 0x6271, 0x3337, 0x626c, 0x486a, 0x3130, 0x3a6c, 0x4f52, + 0x6270, 0x6272, 0x4a4b, 0x4059, 0x6274, 0x6275, 0x6273, 0x334e, + 0x627b, 0x627a, 0x3c27, 0x627c, 0x6277, 0x627d, 0x6278, 0x4858, + 0x6276, 0x6279, 0x6322, 0x6321, 0x4b61, 0x627e, 0x306b, 0x6324, + 0x6323, 0x3e4c, 0x6325, 0x4143, 0x6327, 0x6326, 0x6328, 0x6268, + 0x626a, 0x632a, 0x6329, 0x3c28, 0x4e69, 0x3c52, 0x632b, 0x3737, + 0x3540, 0x3527, 0x3b63, 0x4d34, 0x6331, 0x6330, 0x4144, 0x632d, + 0x632f, 0x3d4b, 0x3f40, 0x632e, 0x632c, 0x472a, 0x3e4d, 0x493c, + 0x3a57, 0x4578, 0x6332, 0x6333, 0x6349, 0x3658, 0x4f3d, 0x4135, + 0x6334, 0x3252, 0x4477, 0x4a21, 0x6335, 0x357a, 0x6336, 0x6338, + 0x6339, 0x4729, 0x633a, 0x633b, 0x633c, 0x3659, 0x3253, 0x4645, + 0x3d28, 0x3b64, 0x633d, 0x3d29, 0x324a, 0x4943, 0x633e, 0x486b, + 0x4145, 0x6341, 0x6342, 0x4769, 0x3f41, 0x633f, 0x4361, 0x6340, + 0x3e4e, 0x305c, 0x3529, 0x6343, 0x4478, 0x6344, 0x4047, 0x4c2d, + 0x4923, 0x6345, 0x6346, 0x4355, 0x4e47, 0x6348, 0x6347, 0x3c6f, + 0x634a, 0x3070, 0x634d, 0x634b, 0x3254, 0x374e, 0x634c, 0x3946, + 0x3972, 0x4a66, 0x634e, 0x4b54, 0x6350, 0x4051, 0x314f, 0x323a, + 0x302c, 0x634f, 0x6351, 0x6352, 0x3e77, 0x6353, 0x334f, 0x6355, + 0x376a, 0x3566, 0x6356, 0x3675, 0x6357, 0x407c, 0x464d, 0x4060, + 0x3a75, 0x6358, 0x4362, 0x416b, 0x635a, 0x635c, 0x6359, 0x635b, + 0x3722, 0x635d, 0x3726, 0x3567, 0x4d52, 0x635f, 0x6360, 0x312e, + 0x6363, 0x3376, 0x6362, 0x6361, 0x6365, 0x635e, 0x6366, 0x4e29, + 0x6367, 0x6368, 0x5474, 0x636a, 0x6369, 0x636b, 0x636c, 0x4e35, + 0x636d, 0x706f, 0x3e4f, 0x636e, 0x636f, 0x3d57, 0x4638, 0x6370, + 0x4328, 0x6371, 0x433c, 0x6372, 0x3625, 0x513f, 0x435d, 0x3c33, + 0x3448, 0x6373, 0x6422, 0x6376, 0x3568, 0x6375, 0x6424, 0x6374, + 0x3e50, 0x6378, 0x6379, 0x452b, 0x637a, 0x335e, 0x3f5a, 0x4964, + 0x637c, 0x4268, 0x6377, 0x637b, 0x637d, 0x3a7b, 0x6426, 0x492e, + 0x4826, 0x4579, 0x365a, 0x6425, 0x6423, 0x4835, 0x637e, 0x435e, + 0x457b, 0x457a, 0x3a76, 0x6438, 0x6428, 0x642a, 0x642d, 0x642e, + 0x642b, 0x642c, 0x6429, 0x6427, 0x6421, 0x4a4f, 0x3255, 0x6435, + 0x6432, 0x6437, 0x6436, 0x4773, 0x4c27, 0x3b3b, 0x6430, 0x6439, + 0x6434, 0x6433, 0x642f, 0x6431, 0x3449, 0x433d, 0x407d, 0x4822, + 0x643e, 0x4824, 0x4061, 0x643b, 0x484f, 0x643f, 0x4a53, 0x435b, + 0x643a, 0x643c, 0x643d, 0x6440, 0x3c44, 0x4646, 0x6445, 0x6444, + 0x6441, 0x4f36, 0x644a, 0x644e, 0x644b, 0x6447, 0x6448, 0x644d, + 0x6442, 0x5255, 0x6449, 0x6443, 0x644c, 0x6452, 0x344a, 0x644f, + 0x6450, 0x6451, 0x6454, 0x6453, 0x4876, 0x6455, 0x4e7c, 0x4a6d, + 0x645a, 0x6457, 0x6456, 0x4052, 0x6459, 0x645b, 0x6458, 0x645f, + 0x645c, 0x645d, 0x6446, 0x645e, 0x6460, 0x6461, 0x4a46, 0x6462, + 0x4c62, 0x364e, 0x3729, 0x6463, 0x4a34, 0x3f68, 0x4c30, 0x6464, + 0x4e33, 0x4774, 0x4146, 0x4734, 0x3d4d, 0x3040, 0x6469, 0x6467, + 0x6465, 0x3421, 0x3e51, 0x646a, 0x6468, 0x6466, 0x646e, 0x646d, + 0x646c, 0x646b, 0x646f, 0x6470, 0x403a, 0x6471, 0x6473, 0x6472, + 0x3852, 0x4138, 0x6475, 0x457c, 0x6474, 0x6476, 0x4a35, 0x416c, + 0x3947, 0x6477, 0x4e48, 0x6479, 0x647a, 0x647b, 0x647c, 0x3b65, + 0x647d, 0x374f, 0x356a, 0x352a, 0x6521, 0x4c73, 0x3948, 0x647e, + 0x6524, 0x4c66, 0x473c, 0x4933, 0x3d63, 0x6523, 0x3c53, 0x3949, + 0x3b66, 0x3569, 0x4a36, 0x6522, 0x4147, 0x4b42, 0x3a77, 0x3b67, + 0x445d, 0x6527, 0x4e5f, 0x3a59, 0x6528, 0x3f42, 0x652a, 0x3e52, + 0x3a30, 0x6529, 0x3d2a, 0x383e, 0x4148, 0x6525, 0x652b, 0x6526, + 0x3750, 0x652e, 0x6532, 0x376b, 0x652d, 0x6536, 0x394a, 0x4d6d, + 0x303c, 0x6533, 0x356b, 0x6530, 0x6531, 0x457d, 0x652f, 0x652c, + 0x3328, 0x4064, 0x3828, 0x6538, 0x6535, 0x6537, 0x6534, 0x3751, + 0x4233, 0x6539, 0x416e, 0x6546, 0x6542, 0x653c, 0x6540, 0x3c7a, + 0x305d, 0x653b, 0x6543, 0x6547, 0x394b, 0x4c56, 0x4456, 0x653d, + 0x6545, 0x653a, 0x433e, 0x653f, 0x303d, 0x4c4a, 0x653e, 0x365b, + 0x486c, 0x416d, 0x4e50, 0x3d6f, 0x656e, 0x6548, 0x407e, 0x6544, + 0x6549, 0x654b, 0x4479, 0x654e, 0x654a, 0x4a54, 0x344b, 0x4c4b, + 0x305e, 0x654d, 0x4e7d, 0x654c, 0x316f, 0x466c, 0x654f, 0x6556, + 0x6550, 0x6557, 0x6553, 0x477b, 0x3c4a, 0x6555, 0x6552, 0x6558, + 0x6551, 0x3d44, 0x4b25, 0x3d4c, 0x6554, 0x6560, 0x655c, 0x655f, + 0x655d, 0x6561, 0x655b, 0x6541, 0x4053, 0x484b, 0x655e, 0x6559, + 0x4121, 0x3752, 0x3d2b, 0x3f25, 0x4136, 0x6564, 0x6566, 0x6567, + 0x6563, 0x6565, 0x655a, 0x6562, 0x656a, 0x6569, 0x4b7a, 0x372b, + 0x6568, 0x656c, 0x656b, 0x656f, 0x6571, 0x3b3c, 0x656d, 0x6572, + 0x6573, 0x6574, 0x657a, 0x453b, 0x6576, 0x6575, 0x6577, 0x6578, + 0x6579, 0x657b, 0x657c, 0x344c, 0x657d, 0x657e, 0x6621, 0x6622, + 0x6623, 0x6624, 0x6625, 0x6626, 0x6628, 0x6627, 0x6629, 0x662a, + 0x662b, 0x662e, 0x662c, 0x662d, 0x3a61, 0x3753, 0x4356, 0x4833, + 0x3d70, 0x474d, 0x486d, 0x662f, 0x586d, 0x6630, 0x6632, 0x4d65, + 0x6631, 0x6634, 0x6633, 0x4d53, 0x6635, 0x487e, 0x6636, 0x6639, + 0x6638, 0x6637, 0x663a, 0x3732, 0x4122, 0x3541, 0x663e, 0x663b, + 0x663c, 0x663f, 0x6640, 0x663d, 0x3129, 0x3227, 0x6642, 0x6643, + 0x6644, 0x4d62, 0x3d2c, 0x6646, 0x6645, 0x3f69, 0x6647, 0x6648, + 0x6649, 0x3465, 0x344d, 0x664a, 0x664b, 0x4b5d, 0x4d63, 0x4d54, + 0x4f37, 0x394d, 0x664e, 0x3c54, 0x664d, 0x664f, 0x3c29, 0x4251, + 0x6650, 0x394c, 0x4c57, 0x6651, 0x6652, 0x6653, 0x6654, 0x6655, + 0x3c2a, 0x4c6d, 0x6657, 0x433f, 0x6656, 0x6659, 0x6658, 0x665a, + 0x403b, 0x665b, 0x665c, 0x4a39, 0x665d, 0x416f, 0x665e, 0x665f, + 0x4e7e, 0x6662, 0x6661, 0x6660, 0x4430, 0x6663, 0x3f26, 0x6664, + 0x6665, 0x4f38, 0x6666, 0x6667, 0x6669, 0x6668, 0x4825, 0x4679, + 0x4f3e, 0x4829, 0x666b, 0x3e53, 0x492a, 0x666c, 0x666a, 0x344e, + 0x3854, 0x3b68, 0x486e, 0x382a, 0x4b43, 0x666f, 0x666d, 0x394e, + 0x394f, 0x3069, 0x3a68, 0x4759, 0x305f, 0x6674, 0x4340, 0x4758, + 0x425b, 0x6676, 0x6672, 0x6675, 0x6670, 0x6673, 0x4b26, 0x3855, + 0x307d, 0x6671, 0x6678, 0x6679, 0x4639, 0x363b, 0x6726, 0x473d, + 0x3b69, 0x363c, 0x4048, 0x4f46, 0x4c2e, 0x6677, 0x4054, 0x3553, + 0x667a, 0x667c, 0x667b, 0x667d, 0x4326, 0x473e, 0x4431, 0x6723, + 0x6722, 0x667e, 0x3f55, 0x4965, 0x6725, 0x6724, 0x3950, 0x4f53, + 0x6735, 0x6729, 0x672a, 0x3c70, 0x6728, 0x3978, 0x6727, 0x672b, + 0x4432, 0x4a22, 0x4123, 0x425c, 0x672f, 0x6730, 0x672c, 0x672d, + 0x672e, 0x3951, 0x6736, 0x6732, 0x4966, 0x4b6c, 0x4928, 0x6731, + 0x6734, 0x6733, 0x4b44, 0x6737, 0x6738, 0x4137, 0x6739, 0x673b, + 0x673f, 0x673c, 0x673a, 0x473f, 0x673d, 0x673e, 0x3232, 0x6745, + 0x6740, 0x6741, 0x6742, 0x4221, 0x6744, 0x6743, 0x6746, 0x6747, + 0x6748, 0x3f43, 0x3269, 0x6749, 0x4e57, 0x3c2b, 0x3d2d, 0x3b6a, + 0x4357, 0x674a, 0x674b, 0x3131, 0x674c, 0x674d, 0x674e, 0x674f, + 0x6750, 0x363d, 0x5a2a, 0x6751, 0x4065, 0x6752, 0x3c4b, 0x6753, + 0x5030, 0x6754, 0x4a5e, 0x345c, 0x4124, 0x3d58, 0x4971, 0x3d2e, + 0x6755, 0x3952, 0x6756, 0x484c, 0x6764, 0x6758, 0x4249, 0x4775, + 0x383f, 0x6757, 0x4125, 0x6759, 0x447a, 0x675b, 0x675a, 0x675d, + 0x675c, 0x675e, 0x6760, 0x675f, 0x344f, 0x6761, 0x6762, 0x6763, + 0x3a31, 0x4e49, 0x6765, 0x3f27, 0x3170, 0x6766, 0x6767, 0x6768, + 0x3072, 0x6769, 0x676a, 0x4967, 0x3c47, 0x676c, 0x3329, 0x3032, + 0x676b, 0x676e, 0x474e, 0x3f44, 0x3256, 0x4b27, 0x375d, 0x365c, + 0x676d, 0x326a, 0x3423, 0x3171, 0x6772, 0x4e6a, 0x425d, 0x4944, + 0x677e, 0x3257, 0x677c, 0x677a, 0x6771, 0x676f, 0x6770, 0x3c63, + 0x366c, 0x4377, 0x4651, 0x3151, 0x6774, 0x6773, 0x6779, 0x6775, + 0x6778, 0x4c50, 0x6777, 0x3258, 0x337d, 0x677b, 0x677d, 0x3754, + 0x6823, 0x682c, 0x682d, 0x302b, 0x6834, 0x3071, 0x682b, 0x682a, + 0x6825, 0x6824, 0x6822, 0x6821, 0x4363, 0x427b, 0x6827, 0x6826, + 0x6829, 0x4170, 0x3755, 0x3141, 0x6828, 0x3953, 0x4171, 0x683a, + 0x683b, 0x3259, 0x322e, 0x6838, 0x682e, 0x6836, 0x683d, 0x6837, + 0x6835, 0x6776, 0x6833, 0x682f, 0x3450, 0x6831, 0x683c, 0x6832, + 0x683e, 0x6830, 0x477c, 0x4d69, 0x6839, 0x684f, 0x6847, 0x3f7b, + 0x3546, 0x365d, 0x6842, 0x325b, 0x3e54, 0x6845, 0x3a5a, 0x4551, + 0x684a, 0x4a6e, 0x6841, 0x325a, 0x3856, 0x4929, 0x684b, 0x683f, + 0x6848, 0x6852, 0x6843, 0x6844, 0x463a, 0x6849, 0x6846, 0x4b28, + 0x684c, 0x3060, 0x6840, 0x684e, 0x684d, 0x476b, 0x6854, 0x685f, + 0x337e, 0x6862, 0x6850, 0x6855, 0x4d6e, 0x685e, 0x4d55, 0x4e2a, + 0x4378, 0x336b, 0x4972, 0x6864, 0x4621, 0x3031, 0x685d, 0x6859, + 0x4172, 0x6853, 0x685b, 0x6860, 0x472c, 0x302a, 0x6858, 0x6861, + 0x4978, 0x685c, 0x6857, 0x3e55, 0x3d2f, 0x3c2c, 0x4c58, 0x4947, + 0x6867, 0x6870, 0x685a, 0x3377, 0x3e78, 0x6865, 0x686a, 0x4173, + 0x6866, 0x686d, 0x435f, 0x686e, 0x4d56, 0x6863, 0x3338, 0x6869, + 0x686c, 0x4c2c, 0x686f, 0x6868, 0x686b, 0x4b29, 0x4f21, 0x6873, + 0x687a, 0x6872, 0x3c43, 0x6851, 0x4a4e, 0x4c22, 0x6879, 0x6878, + 0x6874, 0x6875, 0x3136, 0x6877, 0x6871, 0x4455, 0x6876, 0x307e, + 0x4222, 0x4a43, 0x687b, 0x6921, 0x4859, 0x687e, 0x3e56, 0x3c49, + 0x6923, 0x363e, 0x6924, 0x4979, 0x687d, 0x6856, 0x687c, 0x4f4f, + 0x4622, 0x4973, 0x692b, 0x6931, 0x6932, 0x6925, 0x4776, 0x692f, + 0x6927, 0x6929, 0x6933, 0x6928, 0x692c, 0x3172, 0x4665, 0x692d, + 0x6930, 0x6926, 0x4126, 0x692a, 0x3b27, 0x3f45, 0x3730, 0x4c74, + 0x4c79, 0x3d72, 0x6937, 0x6935, 0x4f4e, 0x6934, 0x4d75, 0x6936, + 0x6938, 0x6939, 0x693c, 0x693a, 0x4623, 0x693b, 0x484d, 0x692e, + 0x3d73, 0x693d, 0x6942, 0x4174, 0x6941, 0x6922, 0x6943, 0x4149, + 0x693e, 0x6940, 0x693f, 0x5d31, 0x5d22, 0x6945, 0x6944, 0x4d76, + 0x623c, 0x6946, 0x6947, 0x6948, 0x3857, 0x3554, 0x694a, 0x515d, + 0x3575, 0x4e3a, 0x3673, 0x694b, 0x694c, 0x436e, 0x694d, 0x467a, + 0x303a, 0x3263, 0x6952, 0x6953, 0x694e, 0x3b3d, 0x694f, 0x4742, + 0x6950, 0x6951, 0x695b, 0x6955, 0x6958, 0x6954, 0x6956, 0x6957, + 0x3c58, 0x6959, 0x4341, 0x3756, 0x3342, 0x695c, 0x333f, 0x6961, + 0x695d, 0x6960, 0x483a, 0x695e, 0x695f, 0x4948, 0x485a, 0x6962, + 0x427d, 0x696c, 0x6968, 0x326b, 0x6966, 0x4b2a, 0x6967, 0x6964, + 0x6965, 0x696a, 0x696d, 0x696b, 0x6969, 0x6963, 0x4358, 0x6974, + 0x4c2a, 0x6972, 0x6973, 0x696e, 0x6970, 0x6971, 0x696f, 0x4066, + 0x4f39, 0x6978, 0x6979, 0x6a21, 0x3f2a, 0x697b, 0x697e, 0x6976, + 0x6975, 0x6a22, 0x325c, 0x697c, 0x6a23, 0x697d, 0x697a, 0x4433, + 0x6977, 0x4768, 0x6a27, 0x4d3b, 0x6a26, 0x6a25, 0x6a2e, 0x6a28, + 0x6a30, 0x4d66, 0x6a33, 0x6a2a, 0x6a2b, 0x6a2f, 0x6a32, 0x6a31, + 0x6a29, 0x6a2c, 0x6a3d, 0x6a36, 0x6a34, 0x6a35, 0x6a3a, 0x6a3b, + 0x332a, 0x3542, 0x6a39, 0x6a24, 0x6a38, 0x6a3c, 0x6a37, 0x6a3e, + 0x6a40, 0x6a3f, 0x6a42, 0x6a41, 0x695a, 0x6a46, 0x6a43, 0x6a44, + 0x6a45, 0x6a47, 0x376c, 0x6a49, 0x6a48, 0x3d30, 0x3954, 0x5e27, + 0x6a4a, 0x3d51, 0x3339, 0x6a4b, 0x3152, 0x3e57, 0x6a4c, 0x3955, + 0x6a4d, 0x3061, 0x493d, 0x6a4e, 0x3f6a, 0x6a55, 0x6a52, 0x436f, + 0x6a53, 0x6a50, 0x365e, 0x6a4f, 0x6a56, 0x3736, 0x425e, 0x6a5c, + 0x6a58, 0x4235, 0x6a57, 0x6a5a, 0x6a51, 0x6a5b, 0x6a5d, 0x486f, + 0x6a59, 0x6a5e, 0x6a60, 0x3853, 0x6a54, 0x3041, 0x6a5f, 0x3a5b, + 0x4e76, 0x6a61, 0x6a62, 0x4175, 0x4e22, 0x6a63, 0x4d35, 0x6a64, + 0x6a65, 0x4a64, 0x6a66, 0x3a40, 0x4e23, 0x6a6b, 0x6a6c, 0x3e58, + 0x6a6a, 0x4d67, 0x6a67, 0x6a69, 0x403d, 0x3f7e, 0x6a68, 0x6a6d, + 0x4a23, 0x6a6f, 0x6a6e, 0x336c, 0x4b2b, 0x6a70, 0x6a7c, 0x6a72, + 0x6a73, 0x6a74, 0x6a75, 0x6a79, 0x6a7a, 0x6a78, 0x6a76, 0x6a71, + 0x6a77, 0x6a7b, 0x7037, 0x3228, 0x6a7e, 0x365f, 0x6a7d, 0x6b22, + 0x6b21, 0x6b24, 0x6b23, 0x6b25, 0x3d31, 0x6b26, 0x6b27, 0x6b28, + 0x403e, 0x4d57, 0x6b29, 0x4a24, 0x4746, 0x6b2a, 0x6b2b, 0x382b, + 0x352c, 0x6b2c, 0x3b6b, 0x4741, 0x6b2d, 0x3350, 0x6b2e, 0x6b30, + 0x4d77, 0x6b2f, 0x3f46, 0x6b31, 0x6b32, 0x6b33, 0x3451, 0x6b34, + 0x6b35, 0x6b36, 0x6b37, 0x3351, 0x6b38, 0x6b39, 0x6b3a, 0x3272, + 0x3f28, 0x6b3b, 0x6b3c, 0x6b3d, 0x3840, 0x447b, 0x6b3e, 0x3757, + 0x3f56, 0x6b41, 0x4624, 0x6b40, 0x3731, 0x6b3f, 0x4277, 0x352d, + 0x6b42, 0x6b43, 0x3e59, 0x376d, 0x6b44, 0x4b2c, 0x405f, 0x3576, + 0x4c75, 0x414a, 0x6b45, 0x3f47, 0x4370, 0x3e5a, 0x6b46, 0x6b49, + 0x6b4a, 0x3a3e, 0x4242, 0x6b48, 0x3e5b, 0x493e, 0x6b47, 0x3b6c, + 0x3153, 0x6b4e, 0x3758, 0x3b6e, 0x3b6d, 0x4f4d, 0x6b4d, 0x6b4c, + 0x4127, 0x354d, 0x4f43, 0x333a, 0x3e5c, 0x6b4b, 0x6b50, 0x6b51, + 0x6b4f, 0x3858, 0x4d40, 0x3b6f, 0x4727, 0x6b54, 0x4040, 0x4342, + 0x4d36, 0x6b57, 0x386c, 0x403f, 0x6b53, 0x6b58, 0x386d, 0x6b55, + 0x6b56, 0x6b52, 0x4062, 0x4649, 0x432f, 0x325d, 0x4870, 0x3543, + 0x4434, 0x6b5b, 0x6b59, 0x434c, 0x4041, 0x3452, 0x6b5a, 0x3f5b, + 0x4e4a, 0x4f40, 0x6b5c, 0x6b67, 0x4435, 0x6b66, 0x6b63, 0x6b6b, + 0x6b64, 0x6b60, 0x447c, 0x6b5f, 0x6b5d, 0x4d21, 0x3b70, 0x6b61, + 0x6b5e, 0x6b65, 0x3d74, 0x3841, 0x427a, 0x4b45, 0x315a, 0x3062, + 0x4625, 0x6b69, 0x6b68, 0x4666, 0x6b6d, 0x6b62, 0x6b6c, 0x6b6e, + 0x382c, 0x6b6a, 0x3956, 0x3c55, 0x6b6f, 0x4d58, 0x6b72, 0x6b75, + 0x6b73, 0x4935, 0x6b70, 0x3660, 0x6b74, 0x6b76, 0x6b7a, 0x6b77, + 0x6b79, 0x6b78, 0x6b7b, 0x3c31, 0x6b7d, 0x6b7c, 0x4968, 0x6c21, + 0x3759, 0x6b7e, 0x6c22, 0x6c23, 0x3544, 0x6641, 0x3e79, 0x6c24, + 0x386e, 0x6c25, 0x6c26, 0x3b3e, 0x5a4e, 0x6c27, 0x6c28, 0x3d32, + 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x6c2d, 0x432b, 0x6c2e, 0x6c30, + 0x6c2f, 0x4626, 0x6c31, 0x4b2d, 0x6c32, 0x6c33, 0x6c34, 0x6c35, + 0x465a, 0x3e5d, 0x6c36, 0x396b, 0x502e, 0x6c37, 0x6c38, 0x493f, + 0x6c39, 0x6c41, 0x6c3a, 0x6c3c, 0x6c3b, 0x6c3d, 0x4b46, 0x6c3e, + 0x6c3f, 0x6c40, 0x6c42, 0x332d, 0x4467, 0x4969, 0x3a62, 0x3957, + 0x494f, 0x325f, 0x484e, 0x6c45, 0x3453, 0x4055, 0x6c44, 0x6c49, + 0x4379, 0x4c63, 0x6c47, 0x6c48, 0x352e, 0x6c4a, 0x4763, 0x425f, + 0x4871, 0x453d, 0x6c46, 0x4b47, 0x326c, 0x6c4c, 0x4f28, 0x4442, + 0x4f45, 0x3b71, 0x6c4b, 0x4231, 0x6c5c, 0x4128, 0x4678, 0x4950, + 0x6c4f, 0x3b3f, 0x3b72, 0x3e5e, 0x4765, 0x382d, 0x6c4e, 0x6c4d, + 0x496a, 0x3c41, 0x4552, 0x6c51, 0x6c52, 0x3958, 0x6c50, 0x6c53, + 0x6c54, 0x6c56, 0x4223, 0x6c55, 0x3466, 0x6c58, 0x6c57, 0x6c59, + 0x6c5b, 0x6c5d, 0x6c5e, 0x4056, 0x3c4f, 0x6c5f, 0x3352, 0x6c60, + 0x4176, 0x6c61, 0x6c62, 0x496b, 0x352f, 0x6c63, 0x4436, 0x315b, + 0x6c64, 0x3c71, 0x3f76, 0x422d, 0x6c67, 0x6c66, 0x6c65, 0x6c6d, + 0x6c6b, 0x6c68, 0x6c6a, 0x6c69, 0x6c6c, 0x3577, 0x6c70, 0x4057, + 0x6c71, 0x3859, 0x6c6e, 0x6c6f, 0x4f29, 0x4437, 0x4129, 0x6c72, + 0x6c75, 0x6c73, 0x6c74, 0x4d59, 0x4627, 0x6c78, 0x6c76, 0x6c77, + 0x6c79, 0x6d29, 0x6c7c, 0x6c7d, 0x6c7b, 0x6c7a, 0x447d, 0x6d21, + 0x6d25, 0x6d22, 0x6c7e, 0x6d23, 0x6d24, 0x6d2b, 0x6d26, 0x4058, + 0x6d28, 0x6d2a, 0x6d27, 0x6d2d, 0x3d33, 0x6d2c, 0x6d2e, 0x6d2f, + 0x6d32, 0x6d31, 0x6d30, 0x6d34, 0x6d33, 0x4c76, 0x6d36, 0x6d35, + 0x6d37, 0x6d38, 0x6d3a, 0x6d39, 0x3f48, 0x6d3b, 0x366d, 0x6d3c, + 0x6d3e, 0x6d3f, 0x6d40, 0x6d3d, 0x6d41, 0x3c56, 0x6d42, 0x3530, + 0x3733, 0x382e, 0x6d43, 0x4670, 0x453e, 0x6d44, 0x6d47, 0x3c34, + 0x6d46, 0x6d45, 0x375a, 0x6d48, 0x3353, 0x6d4a, 0x3a5c, 0x6d49, + 0x6d52, 0x6d4c, 0x6d4e, 0x4a65, 0x6d4b, 0x6d4d, 0x6d51, 0x6d4f, + 0x3531, 0x6d50, 0x6d53, 0x475a, 0x4e58, 0x3d34, 0x6d54, 0x4d22, + 0x6d56, 0x6d55, 0x6d59, 0x4d41, 0x6d58, 0x336d, 0x6d57, 0x6d5c, + 0x6d5b, 0x6d5a, 0x4532, 0x6d5d, 0x6d5e, 0x6d5f, 0x396c, 0x3725, + 0x6d60, 0x6d61, 0x6d62, 0x3f49, 0x6d63, 0x3c2d, 0x6d64, 0x6d65, + 0x5221, 0x517e, 0x6d66, 0x6570, 0x6d67, 0x4324, 0x3f2b, 0x4740, + 0x6d68, 0x4a55, 0x4454, 0x397e, 0x4329, 0x312a, 0x4b78, 0x3f57, + 0x375e, 0x3661, 0x4a56, 0x6d69, 0x6d6b, 0x6d6a, 0x3260, 0x4676, + 0x6d6c, 0x4777, 0x4533, 0x6d6d, 0x3d52, 0x6d6f, 0x4c42, 0x6d7e, + 0x6d71, 0x6d72, 0x4449, 0x4260, 0x4177, 0x4628, 0x6d70, 0x3555, + 0x6d79, 0x6d76, 0x6e25, 0x4629, 0x4360, 0x6d73, 0x447e, 0x4553, + 0x6d74, 0x6d78, 0x3f60, 0x4767, 0x444c, 0x4042, 0x6d77, 0x422e, + 0x4224, 0x6d75, 0x3029, 0x4f22, 0x6d7a, 0x4261, 0x3d35, 0x3f4a, + 0x6d7c, 0x6d7b, 0x306f, 0x6d7d, 0x492f, 0x6e27, 0x465b, 0x3f6b, + 0x4359, 0x3678, 0x6e26, 0x4d37, 0x313f, 0x4a57, 0x3261, 0x6e21, + 0x6e22, 0x6e23, 0x6e24, 0x463b, 0x4323, 0x3063, 0x6e28, 0x6e29, + 0x7423, 0x423d, 0x6e2a, 0x3173, 0x414c, 0x382f, 0x4d5a, 0x6e2b, + 0x452c, 0x4178, 0x3c57, 0x6e2c, 0x6e2f, 0x3d65, 0x6e2d, 0x412b, + 0x412a, 0x3064, 0x4e4b, 0x6e31, 0x4872, 0x6e33, 0x6e32, 0x6e30, + 0x6364, 0x3454, 0x6d6e, 0x6e35, 0x6e34, 0x6e36, 0x4d38, 0x4661, + 0x4b2e, 0x6e37, 0x3c59, 0x6e38, 0x6e39, 0x6e3a, 0x4521, 0x306a, + 0x3959, 0x4f3a, 0x6e3e, 0x3734, 0x6e3b, 0x6e3c, 0x4974, 0x3354, + 0x4d39, 0x363f, 0x4554, 0x6e3f, 0x6e40, 0x6e41, 0x4522, 0x6e43, + 0x6e42, 0x4653, 0x6e44, 0x3d36, 0x3c60, 0x475b, 0x4371, 0x3c72, + 0x3f6c, 0x6e45, 0x6e46, 0x3f5d, 0x6e47, 0x6e48, 0x6e49, 0x4d6f, + 0x3d37, 0x6e4b, 0x6e4a, 0x395a, 0x3973, 0x3b40, 0x6e4e, 0x3d66, + 0x6e4d, 0x6e4c, 0x4269, 0x386f, 0x4043, 0x4830, 0x3d39, 0x6e4f, + 0x3e5f, 0x6e52, 0x6e50, 0x6e51, 0x6e54, 0x6e53, 0x3e7a, 0x6e55, + 0x6e56, 0x6e57, 0x4850, 0x3a53, 0x3c61, 0x6e58, 0x6e59, 0x4e24, + 0x3d45, 0x4c6e, 0x4e4c, 0x6e5a, 0x3662, 0x6e5b, 0x4523, 0x6e5e, + 0x3378, 0x3f4b, 0x6e5c, 0x6e5d, 0x4460, 0x4b55, 0x367c, 0x6e60, + 0x6e61, 0x6e5f, 0x6e63, 0x465f, 0x3343, 0x6e67, 0x6e64, 0x6e66, + 0x6e62, 0x6f4f, 0x6e65, 0x4e6b, 0x385a, 0x6e6f, 0x4534, 0x6e6a, + 0x6e6d, 0x6e6b, 0x6e70, 0x6e71, 0x6e69, 0x6e76, 0x3174, 0x6e68, + 0x482d, 0x6e6c, 0x3e60, 0x395b, 0x4b48, 0x3664, 0x3d46, 0x463c, + 0x412d, 0x6e74, 0x6e6e, 0x6e73, 0x4c43, 0x4438, 0x6e75, 0x6e72, + 0x412c, 0x6e79, 0x6e78, 0x6e77, 0x4b2f, 0x3d7b, 0x6e7a, 0x4a5f, + 0x3154, 0x4946, 0x4372, 0x3578, 0x6e7c, 0x395d, 0x3b2c, 0x6e7b, + 0x3f6d, 0x3f6e, 0x6f21, 0x6f23, 0x3e7b, 0x6f22, 0x6f24, 0x3653, + 0x4945, 0x3c62, 0x4f23, 0x6e7e, 0x3a78, 0x4f3f, 0x6f26, 0x6f25, + 0x6f27, 0x6e7d, 0x4669, 0x4555, 0x4457, 0x6f2c, 0x4343, 0x6f28, + 0x6f29, 0x372d, 0x6f2b, 0x3830, 0x6f2a, 0x3e61, 0x3379, 0x6f30, + 0x3a3f, 0x4179, 0x444a, 0x333b, 0x6f2e, 0x6f2f, 0x4443, 0x6f2d, + 0x6f31, 0x6f37, 0x6f3a, 0x6f39, 0x452d, 0x6f32, 0x6f33, 0x6f36, + 0x6f38, 0x3640, 0x6f3b, 0x6f35, 0x6f34, 0x6f3f, 0x6f40, 0x6f41, + 0x6f3e, 0x6f3d, 0x3e62, 0x462a, 0x6f3c, 0x6f45, 0x6f43, 0x6f44, + 0x6f42, 0x4278, 0x6f46, 0x6f47, 0x6f49, 0x3455, 0x6f48, 0x4c7a, + 0x6f54, 0x6f4a, 0x6f4d, 0x6f4b, 0x6f4c, 0x6f4e, 0x6f50, 0x6f51, + 0x6f52, 0x6f55, 0x6f53, 0x6f56, 0x6f58, 0x6f57, 0x4439, 0x4c67, + 0x6f59, 0x412e, 0x6f5a, 0x4a44, 0x6f5b, 0x332b, 0x313c, 0x3457, + 0x3456, 0x6f5c, 0x6f5d, 0x6f5e, 0x6f5f, 0x6f60, 0x3458, 0x3355, + 0x395e, 0x4836, 0x6f62, 0x6f61, 0x6f63, 0x315c, 0x6f66, 0x6f65, + 0x6f64, 0x6f67, 0x6f6a, 0x3047, 0x6f68, 0x6f6c, 0x6f6b, 0x6f6e, + 0x6f6d, 0x6f6f, 0x462e, 0x6f70, 0x6f71, 0x6f73, 0x6f72, 0x496c, + 0x6f74, 0x6f75, 0x3a65, 0x6f76, 0x6f77, 0x4b49, 0x414b, 0x3024, + 0x424b, 0x6f78, 0x496d, 0x6f7b, 0x6f79, 0x395f, 0x6f7a, 0x3842, + 0x4a45, 0x6f7d, 0x7021, 0x6f7e, 0x7022, 0x3121, 0x3f58, 0x3d7c, + 0x3459, 0x7023, 0x4766, 0x7025, 0x3122, 0x7024, 0x4444, 0x4e4d, + 0x462b, 0x6f7c, 0x4e26, 0x3831, 0x4d5b, 0x3679, 0x4e34, 0x3728, + 0x4262, 0x6721, 0x7026, 0x332c, 0x3f6f, 0x3356, 0x7028, 0x7029, + 0x7027, 0x3764, 0x3a5d, 0x3e63, 0x3123, 0x4e59, 0x702b, 0x6e2e, + 0x702a, 0x702e, 0x702c, 0x702d, 0x702f, 0x7030, 0x4e6c, 0x7031, + 0x7032, 0x4049, 0x483b, 0x3f7d, 0x3467, 0x4d3a, 0x326d, 0x3d38, + 0x385b, 0x7035, 0x7034, 0x3b73, 0x7036, 0x7033, 0x3b28, 0x703a, + 0x6a2d, 0x5256, 0x3f77, 0x7038, 0x4e25, 0x4671, 0x312b, 0x4063, + 0x3c36, 0x4a37, 0x3140, 0x4e6d, 0x4d6b, 0x703b, 0x4545, 0x3c7b, + 0x703c, 0x703d, 0x3f4c, 0x703e, 0x4e6e, 0x7039, 0x7040, 0x7042, + 0x7041, 0x703f, 0x7043, 0x7044, 0x417a, 0x3262, 0x7045, 0x4c38, + 0x7046, 0x7047, 0x4f2a, 0x5b31, 0x7048, 0x7049, 0x704a, 0x704e, + 0x704b, 0x704c, 0x704d, 0x704f, 0x4044, 0x4c77, 0x4045, 0x7050, + 0x4873, 0x7051, 0x7353, 0x4c4c, 0x7052, 0x7053, 0x7054, 0x3357, + 0x7056, 0x3f59, 0x7057, 0x3724, 0x7058, 0x705c, 0x705a, 0x705b, + 0x3373, 0x7059, 0x705d, 0x705e, 0x3048, 0x705f, 0x7060, 0x3e64, + 0x7061, 0x3547, 0x7064, 0x7063, 0x7062, 0x6b71, 0x4a5c, 0x7065, + 0x7066, 0x7067, 0x7068, 0x7069, 0x706a, 0x345a, 0x706b, 0x706c, + 0x4723, 0x706e, 0x323b, 0x7071, 0x7070, 0x3124, 0x3641, 0x4a47, + 0x443a, 0x3a22, 0x3960, 0x3d67, 0x3f5c, 0x7073, 0x7072, 0x4d42, + 0x3468, 0x4852, 0x465c, 0x3f7c, 0x4e4e, 0x375b, 0x7076, 0x7075, + 0x4b4b, 0x462c, 0x3150, 0x7077, 0x7074, 0x4951, 0x4d6a, 0x7078, + 0x7079, 0x707b, 0x426a, 0x335b, 0x335c, 0x707a, 0x3469, 0x3832, + 0x346a, 0x453f, 0x4e60, 0x385c, 0x707c, 0x707d, 0x707e, 0x7121, + 0x7123, 0x7122, 0x4977, 0x7124, 0x7125, 0x7126, 0x7127, 0x7129, + 0x7128, 0x712a, 0x4874, 0x664c, 0x3f29, 0x3532, 0x712b, 0x712c, + 0x522c, 0x5d3b, 0x4853, 0x307b, 0x303b, 0x3b74, 0x4b30, 0x3e7e, + 0x712d, 0x4c5f, 0x712e, 0x4d5c, 0x3142, 0x3b41, 0x712f, 0x326e, + 0x7130, 0x7131, 0x7133, 0x7134, 0x7136, 0x7132, 0x7135, 0x345b, + 0x7137, 0x7138, 0x7139, 0x713a, 0x713b, 0x713d, 0x713c, 0x713f, + 0x7142, 0x713e, 0x7140, 0x7141, 0x7143, 0x3642, 0x3c73, 0x7144, + 0x7145, 0x3961, 0x7146, 0x333e, 0x474f, 0x7147, 0x7148, 0x435a, + 0x466b, 0x7149, 0x477d, 0x424c, 0x3158, 0x366e, 0x366f, 0x4373, + 0x714e, 0x3670, 0x326f, 0x714d, 0x714b, 0x714c, 0x714a, 0x7158, + 0x714f, 0x7150, 0x7151, 0x7152, 0x7154, 0x7153, 0x3d59, 0x7155, + 0x7157, 0x3533, 0x7156, 0x417b, 0x3833, 0x7159, 0x424d, 0x715a, + 0x462d, 0x715b, 0x7160, 0x715e, 0x715d, 0x715f, 0x715c, 0x7162, + 0x7161, 0x7164, 0x3643, 0x7163, 0x7165, 0x7166, 0x7168, 0x7167, + 0x7169, 0x716b, 0x716a, 0x397c, 0x716c, 0x716d, 0x333c, 0x716e, + 0x716f, 0x3f71, 0x7170, 0x7171, 0x7172, 0x7173, 0x3962, 0x7174, + 0x7175, 0x7176, 0x7177, 0x7178, 0x4831, 0x717a, 0x4926, 0x717b, + 0x7179, 0x717d, 0x717c, 0x717e, 0x7221, 0x7222, 0x7223, 0x7224, + 0x7225, 0x7226, 0x7227, 0x7228, 0x7229, 0x722a, 0x722b, 0x722c, + 0x722d, 0x722e, 0x5d35, 0x722f, 0x6478, 0x3534, 0x3321, 0x3a32, + 0x7231, 0x7230, 0x4c25, 0x7233, 0x7234, 0x7232, 0x7235, 0x4b62, + 0x7236, 0x357b, 0x4f25, 0x7237, 0x7239, 0x303e, 0x723a, 0x4a2b, + 0x7238, 0x723b, 0x723c, 0x723d, 0x723e, 0x723f, 0x4b6e, 0x3b2d, + 0x3a7a, 0x412f, 0x7240, 0x7243, 0x7241, 0x7244, 0x3871, 0x7242, + 0x7245, 0x7246, 0x7247, 0x724b, 0x3b2a, 0x4264, 0x724c, 0x7249, + 0x7248, 0x724a, 0x375f, 0x7250, 0x724f, 0x724e, 0x3033, 0x725a, + 0x7256, 0x7257, 0x7253, 0x7259, 0x7255, 0x3362, 0x4f4c, 0x7258, + 0x7254, 0x7252, 0x7251, 0x725c, 0x725f, 0x725e, 0x725d, 0x4949, + 0x725b, 0x3073, 0x7260, 0x7262, 0x336f, 0x724d, 0x3137, 0x7264, + 0x7263, 0x7261, 0x432d, 0x4b70, 0x4e5a, 0x7265, 0x7266, 0x7267, + 0x7268, 0x7269, 0x443b, 0x726a, 0x4837, 0x726f, 0x726b, 0x726c, + 0x4b31, 0x4c44, 0x4650, 0x7270, 0x7271, 0x463e, 0x726e, 0x726d, + 0x322a, 0x7279, 0x7278, 0x3175, 0x7276, 0x7275, 0x7273, 0x337b, + 0x7272, 0x3c32, 0x3229, 0x3963, 0x727c, 0x727b, 0x727a, 0x7277, + 0x727d, 0x727e, 0x7325, 0x7324, 0x7326, 0x312d, 0x7321, 0x7322, + 0x3974, 0x4c39, 0x7323, 0x4b32, 0x732b, 0x7327, 0x732c, 0x7329, + 0x7328, 0x375c, 0x732d, 0x732e, 0x732f, 0x732a, 0x7274, 0x7330, + 0x4461, 0x7334, 0x7335, 0x7333, 0x7332, 0x7338, 0x7331, 0x7336, + 0x7337, 0x733a, 0x7339, 0x733c, 0x733d, 0x733e, 0x4f49, 0x733b, + 0x426b, 0x3a6d, 0x733f, 0x7340, 0x7341, 0x7342, 0x7343, 0x3834, + 0x7344, 0x7345, 0x3c2f, 0x7346, 0x7347, 0x7348, 0x7349, 0x734c, + 0x734a, 0x4f3c, 0x734b, 0x4e6f, 0x734d, 0x4e5b, 0x734e, 0x477e, + 0x734f, 0x7351, 0x7352, 0x7350, 0x396d, 0x4c4d, 0x4b63, 0x5677, + 0x5d60, 0x4b7b, 0x322b, 0x7354, 0x3550, 0x7355, 0x7356, 0x7357, + 0x3975, 0x7358, 0x6054, 0x4c5b, 0x4263, 0x7359, 0x735b, 0x735a, + 0x735c, 0x735d, 0x735e, 0x735f, 0x7360, 0x7361, 0x7362, 0x7363, + 0x7364, 0x7365, 0x7366, 0x7367, 0x7368, 0x4524, 0x385d, 0x736a, + 0x414d, 0x736b, 0x736c, 0x4921, 0x736d, 0x736e, 0x6337, 0x6c5a, + 0x706d, 0x736f, 0x7370, 0x7372, 0x7373, 0x7374, 0x4e70, 0x7371, + 0x7375, 0x7376, 0x7378, 0x7377, 0x737a, 0x737b, 0x7379, 0x4e36, + 0x737c, 0x737d, 0x6354, 0x737e, 0x212a, 0x2174, 0x2170, 0x2173, + 0x2175, 0x214a, 0x214b, 0x2176, 0x215c, 0x2124, 0x2125, 0x213f, + 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, 0x2335, 0x2336, 0x2337, + 0x2338, 0x2339, 0x2127, 0x2128, 0x2163, 0x2161, 0x2164, 0x2129, + 0x2177, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, 0x2346, 0x2347, + 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, 0x234d, 0x234e, 0x234f, + 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, 0x2357, + 0x2358, 0x2359, 0x235a, 0x214e, 0x214f, 0x2130, 0x2132, 0x212e, + 0x2361, 0x2362, 0x2363, 0x2364, 0x2365, 0x2366, 0x2367, 0x2368, + 0x2369, 0x236a, 0x236b, 0x236c, 0x236d, 0x236e, 0x236f, 0x2370, + 0x2371, 0x2372, 0x2373, 0x2374, 0x2375, 0x2376, 0x2377, 0x2378, + 0x2379, 0x237a, 0x2150, 0x2143, 0x2151, 0x2131, 0x216f, +}; + +static const Summary16 jisx0208_uni2indx_page00[16] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x1000 }, { 1, 0x0000 }, { 1, 0x0000 }, + { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0x118c }, { 6, 0x0053 }, + { 10, 0x0000 }, { 10, 0x0080 }, { 11, 0x0000 }, { 11, 0x0080 }, +}; +static const Summary16 jisx0208_uni2indx_page03[22] = { + /* 0x0300 */ + { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, + { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, { 12, 0x0000 }, + { 12, 0x0000 }, { 12, 0xfffe }, { 27, 0x03fb }, { 36, 0xfffe }, + { 51, 0x03fb }, { 60, 0x0000 }, { 60, 0x0000 }, { 60, 0x0000 }, + /* 0x0400 */ + { 60, 0x0002 }, { 61, 0xffff }, { 77, 0xffff }, { 93, 0xffff }, + { 109, 0xffff }, { 125, 0x0002 }, +}; +static const Summary16 jisx0208_uni2indx_page20[50] = { + /* 0x2000 */ + { 126, 0x0000 }, { 126, 0x3361 }, { 133, 0x0063 }, { 137, 0x080d }, + { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, + { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, + { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, { 141, 0x0000 }, + /* 0x2100 */ + { 141, 0x0008 }, { 142, 0x0000 }, { 142, 0x0800 }, { 143, 0x0000 }, + { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, { 143, 0x0000 }, + { 143, 0x0000 }, { 143, 0x000f }, { 147, 0x0000 }, { 147, 0x0000 }, + { 147, 0x0000 }, { 147, 0x0014 }, { 149, 0x0000 }, { 149, 0x0000 }, + /* 0x2200 */ + { 149, 0x098d }, { 155, 0x6404 }, { 159, 0x1f81 }, { 166, 0x2030 }, + { 169, 0x0000 }, { 169, 0x0004 }, { 170, 0x0cc3 }, { 176, 0x0000 }, + { 176, 0x00cc }, { 180, 0x0000 }, { 180, 0x0020 }, { 181, 0x0000 }, + { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, { 181, 0x0000 }, + /* 0x2300 */ + { 181, 0x0000 }, { 181, 0x0004 }, +}; +static const Summary16 jisx0208_uni2indx_page25[23] = { + /* 0x2500 */ + { 182, 0x900f }, { 188, 0x3999 }, { 196, 0x9939 }, { 204, 0x9999 }, + { 212, 0x0804 }, { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0000 }, + { 214, 0x0000 }, { 214, 0x0000 }, { 214, 0x0003 }, { 216, 0x300c }, + { 220, 0xc8c0 }, { 225, 0x0000 }, { 225, 0x8000 }, { 226, 0x0000 }, + /* 0x2600 */ + { 226, 0x0060 }, { 228, 0x0000 }, { 228, 0x0000 }, { 228, 0x0000 }, + { 228, 0x0005 }, { 230, 0x0000 }, { 230, 0xa400 }, +}; +static const Summary16 jisx0208_uni2indx_page30[16] = { + /* 0x3000 */ + { 233, 0xffef }, { 248, 0x103f }, { 255, 0x0000 }, { 255, 0x0000 }, + { 255, 0xfffe }, { 270, 0xffff }, { 286, 0xffff }, { 302, 0xffff }, + { 318, 0xffff }, { 334, 0x780f }, { 342, 0xfffe }, { 357, 0xffff }, + { 373, 0xffff }, { 389, 0xffff }, { 405, 0xffff }, { 421, 0x787f }, +}; +static const Summary16 jisx0208_uni2indx_page4e[1307] = { + /* 0x4e00 */ + { 432, 0x6f8b }, { 442, 0x43f3 }, { 451, 0x2442 }, { 455, 0x9b46 }, + { 463, 0xe82c }, { 470, 0xe3e0 }, { 478, 0x0004 }, { 479, 0x400a }, + { 482, 0x5f65 }, { 492, 0xdb36 }, { 502, 0x7977 }, { 513, 0x0449 }, + { 517, 0xecd7 }, { 528, 0xe3f0 }, { 537, 0x6038 }, { 542, 0x08c5 }, + /* 0x4f00 */ + { 547, 0xe602 }, { 553, 0x3403 }, { 558, 0x8000 }, { 559, 0x3551 }, + { 566, 0xe0c8 }, { 572, 0x7eab }, { 583, 0x8200 }, { 585, 0x9869 }, + { 592, 0xa948 }, { 598, 0x2942 }, { 603, 0xe803 }, { 609, 0x8060 }, + { 612, 0x441c }, { 617, 0xad93 }, { 626, 0xc03a }, { 632, 0x4568 }, + /* 0x5000 */ + { 638, 0xaa60 }, { 644, 0x8656 }, { 651, 0x3f7a }, { 662, 0x0240 }, + { 664, 0x8388 }, { 669, 0x1461 }, { 674, 0x1020 }, { 676, 0x2174 }, + { 682, 0x2021 }, { 685, 0x0702 }, { 689, 0x3000 }, { 691, 0x40bc }, + { 697, 0xa624 }, { 703, 0x4462 }, { 708, 0x60a8 }, { 713, 0x0a20 }, + /* 0x5100 */ + { 716, 0x0217 }, { 721, 0x8574 }, { 728, 0x0402 }, { 730, 0x9c84 }, + { 736, 0x7bfb }, { 749, 0x1415 }, { 754, 0x7f24 }, { 763, 0x11e2 }, + { 769, 0xb665 }, { 778, 0x02ef }, { 786, 0x1f75 }, { 796, 0x20ff }, + { 805, 0x3a70 }, { 812, 0x3840 }, { 816, 0x26c3 }, { 823, 0x6763 }, + /* 0x5200 */ + { 832, 0x4dd9 }, { 841, 0x2092 }, { 845, 0x46b0 }, { 851, 0x0fc9 }, + { 859, 0xbc98 }, { 867, 0x4850 }, { 871, 0x8638 }, { 877, 0xa03f }, + { 885, 0x2388 }, { 890, 0x8816 }, { 895, 0x3e09 }, { 902, 0x5232 }, + { 908, 0x22aa }, { 914, 0xe3a4 }, { 922, 0x00dd }, { 928, 0xc72c }, + /* 0x5300 */ + { 936, 0xa166 }, { 943, 0x26e1 }, { 950, 0x840b }, { 955, 0x8f0a }, + { 962, 0x27eb }, { 972, 0x559e }, { 981, 0xc241 }, { 986, 0x89bb }, + { 995, 0x0014 }, { 997, 0x8540 }, { 1001, 0x6361 }, { 1008, 0x0849 }, + { 1012, 0x7f0c }, { 1021, 0x8ad0 }, { 1027, 0xff3e }, { 1040, 0x05cf }, + /* 0x5400 */ + { 1048, 0xff1a }, { 1059, 0xa803 }, { 1064, 0x7a41 }, { 1071, 0x7b40 }, + { 1078, 0x4745 }, { 1085, 0x8002 }, { 1087, 0x0500 }, { 1089, 0x38eb }, + { 1098, 0xd851 }, { 1105, 0x0005 }, { 1107, 0x9934 }, { 1114, 0x710c }, + { 1120, 0x0397 }, { 1127, 0x0100 }, { 1128, 0x6366 }, { 1136, 0x2404 }, + /* 0x5500 */ + { 1139, 0x80d0 }, { 1143, 0x0051 }, { 1146, 0xc000 }, { 1148, 0x430a }, + { 1153, 0x9071 }, { 1159, 0x30c8 }, { 1164, 0x0008 }, { 1165, 0x5800 }, + { 1168, 0x0e99 }, { 1175, 0xf700 }, { 1182, 0x5f80 }, { 1189, 0x0041 }, + { 1191, 0x00b0 }, { 1194, 0x9410 }, { 1198, 0x0018 }, { 1200, 0x6280 }, + /* 0x5600 */ + { 1204, 0x0240 }, { 1206, 0x09d0 }, { 1211, 0x8200 }, { 1213, 0x0156 }, + { 1218, 0x5004 }, { 1221, 0x0801 }, { 1223, 0x1d10 }, { 1228, 0x0510 }, + { 1231, 0x84c1 }, { 1236, 0x0010 }, { 1237, 0x4025 }, { 1241, 0x1050 }, + { 1244, 0x410f }, { 1250, 0x4d8a }, { 1257, 0x4009 }, { 1260, 0xa60d }, + /* 0x5700 */ + { 1267, 0xab19 }, { 1275, 0x914c }, { 1281, 0x21c0 }, { 1285, 0x0981 }, + { 1289, 0xc485 }, { 1295, 0x0003 }, { 1297, 0x0652 }, { 1302, 0x8000 }, + { 1303, 0x0b04 }, { 1307, 0x0008 }, { 1308, 0x041d }, { 1313, 0x0009 }, + { 1315, 0x4849 }, { 1320, 0x905c }, { 1326, 0x0009 }, { 1328, 0x1690 }, + /* 0x5800 */ + { 1333, 0x0c65 }, { 1339, 0x2220 }, { 1342, 0x8412 }, { 1346, 0x2433 }, + { 1352, 0x0c03 }, { 1356, 0x4796 }, { 1364, 0x0a04 }, { 1367, 0x4225 }, + { 1372, 0x0028 }, { 1374, 0x9088 }, { 1378, 0x4900 }, { 1381, 0x4f08 }, + { 1387, 0x14a2 }, { 1392, 0xd3aa }, { 1401, 0xd830 }, { 1407, 0x3e87 }, + /* 0x5900 */ + { 1416, 0x8604 }, { 1420, 0x1f61 }, { 1428, 0x7ea4 }, { 1437, 0x4186 }, + { 1442, 0xc390 }, { 1448, 0x05b3 }, { 1455, 0x57a5 }, { 1464, 0x2118 }, + { 1468, 0x241e }, { 1474, 0x2a48 }, { 1479, 0x1128 }, { 1483, 0x4a04 }, + { 1487, 0x0a40 }, { 1490, 0x161b }, { 1497, 0x0d60 }, { 1502, 0x8840 }, + /* 0x5a00 */ + { 1505, 0x020a }, { 1508, 0x9502 }, { 1513, 0x8221 }, { 1517, 0x1060 }, + { 1520, 0x0243 }, { 1524, 0x0400 }, { 1525, 0x1444 }, { 1529, 0x8000 }, + { 1530, 0x0000 }, { 1530, 0x0c04 }, { 1533, 0x0000 }, { 1533, 0x7000 }, + { 1536, 0x1a06 }, { 1541, 0x00c1 }, { 1544, 0x024a }, { 1548, 0x0c00 }, + /* 0x5b00 */ + { 1550, 0x1a00 }, { 1553, 0x0040 }, { 1554, 0x1404 }, { 1557, 0x4045 }, + { 1561, 0x0029 }, { 1564, 0xbdb3 }, { 1575, 0x0a78 }, { 1581, 0x052b }, + { 1587, 0xbba9 }, { 1597, 0xbfa0 }, { 1606, 0x407c }, { 1612, 0x8379 }, + { 1620, 0x12fc }, { 1628, 0xe81d }, { 1636, 0x4bf6 }, { 1646, 0xc569 }, + /* 0x5c00 */ + { 1654, 0xeff6 }, { 1667, 0x044a }, { 1671, 0x2115 }, { 1676, 0xff02 }, + { 1685, 0xed63 }, { 1695, 0x402b }, { 1700, 0xd033 }, { 1707, 0x0242 }, + { 1710, 0x1000 }, { 1711, 0x0013 }, { 1714, 0x1b02 }, { 1719, 0x59ca }, + { 1727, 0x00a0 }, { 1729, 0x0200 }, { 1730, 0xa703 }, { 1737, 0x2c41 }, + /* 0x5d00 */ + { 1742, 0x4880 }, { 1745, 0x8ff2 }, { 1755, 0x0204 }, { 1757, 0x0000 }, + { 1757, 0x5800 }, { 1760, 0x1005 }, { 1763, 0x9200 }, { 1766, 0x0048 }, + { 1768, 0x1894 }, { 1773, 0x2001 }, { 1775, 0x5004 }, { 1778, 0x3480 }, + { 1782, 0x3200 }, { 1785, 0x684c }, { 1791, 0x49ea }, { 1799, 0x68be }, + /* 0x5e00 */ + { 1808, 0x184c }, { 1813, 0x2e42 }, { 1819, 0xa820 }, { 1823, 0x21c9 }, + { 1829, 0x50b9 }, { 1836, 0x80b0 }, { 1840, 0x001e }, { 1844, 0xff7c }, + { 1857, 0x849a }, { 1863, 0x14e0 }, { 1868, 0x28c1 }, { 1873, 0x01e0 }, + { 1877, 0x870e }, { 1884, 0xac49 }, { 1891, 0x130f }, { 1898, 0xdddb }, + /* 0x5f00 */ + { 1910, 0xbe1a }, { 1919, 0x89fb }, { 1929, 0xa2e0 }, { 1935, 0x51a2 }, + { 1941, 0x5502 }, { 1946, 0x32ca }, { 1953, 0x3e46 }, { 1961, 0x928b }, + { 1968, 0x1dbf }, { 1979, 0x438f }, { 1987, 0x6703 }, { 1994, 0x3218 }, + { 1999, 0x3028 }, { 2003, 0x33c0 }, { 2009, 0x0811 }, { 2012, 0xa923 }, + /* 0x6000 */ + { 2019, 0xc000 }, { 2021, 0x3a65 }, { 2029, 0x8fe3 }, { 2039, 0x0402 }, + { 2041, 0x2c4e }, { 2048, 0x8625 }, { 2054, 0xbf3d }, { 2066, 0x00a1 }, + { 2069, 0x3a1a }, { 2076, 0x8cd4 }, { 2083, 0x06c9 }, { 2089, 0x317c }, + { 2097, 0x00e0 }, { 2100, 0x950a }, { 2106, 0x018b }, { 2111, 0x0edb }, + /* 0x6100 */ + { 2120, 0xe34b }, { 2129, 0x8c20 }, { 2133, 0x1182 }, { 2137, 0xf010 }, + { 2142, 0x7d94 }, { 2151, 0xa728 }, { 2158, 0xc9ac }, { 2166, 0x40fb }, + { 2174, 0x4484 }, { 2178, 0x0653 }, { 2184, 0x5a90 }, { 2190, 0x4444 }, + { 2194, 0x3fc8 }, { 2203, 0x0001 }, { 2204, 0x0048 }, { 2206, 0xf5d4 }, + /* 0x6200 */ + { 2216, 0x7701 }, { 2223, 0xec57 }, { 2233, 0xc442 }, { 2238, 0x891d }, + { 2245, 0x6b83 }, { 2253, 0x4928 }, { 2258, 0x4109 }, { 2262, 0xd242 }, + { 2268, 0x061d }, { 2274, 0x59fe }, { 2285, 0x1800 }, { 2287, 0x3a22 }, + { 2293, 0xb7e4 }, { 2303, 0x3b9f }, { 2314, 0xf003 }, { 2320, 0xc0ea }, + /* 0x6300 */ + { 2327, 0x1386 }, { 2333, 0x8202 }, { 2336, 0x8980 }, { 2340, 0xe400 }, + { 2344, 0xb200 }, { 2348, 0x10a1 }, { 2352, 0x4b80 }, { 2357, 0x0cc4 }, + { 2362, 0xd309 }, { 2369, 0x8944 }, { 2374, 0x1faf }, { 2385, 0x4834 }, + { 2390, 0x8259 }, { 2396, 0x0c45 }, { 2401, 0x420a }, { 2405, 0x0450 }, + /* 0x6400 */ + { 2408, 0xa040 }, { 2411, 0x10c8 }, { 2415, 0x3140 }, { 2419, 0x4450 }, + { 2423, 0x4004 }, { 2425, 0x0100 }, { 2426, 0x8280 }, { 2429, 0x0540 }, + { 2432, 0x0108 }, { 2434, 0x442c }, { 2439, 0x6a30 }, { 2445, 0x1a05 }, + { 2450, 0x20a6 }, { 2455, 0x0514 }, { 2459, 0x90cf }, { 2467, 0x6456 }, + /* 0x6500 */ + { 2474, 0x0021 }, { 2476, 0x3100 }, { 2479, 0x9c18 }, { 2485, 0xcbf0 }, + { 2494, 0xa120 }, { 2498, 0x63e2 }, { 2506, 0x104c }, { 2510, 0x01b5 }, + { 2516, 0x538c }, { 2523, 0x9a83 }, { 2530, 0xb8b2 }, { 2538, 0x3281 }, + { 2543, 0x987a }, { 2551, 0x0a84 }, { 2555, 0x33e7 }, { 2565, 0x0c02 }, + /* 0x6600 */ + { 2568, 0xd4cc }, { 2576, 0x9018 }, { 2580, 0xa1a1 }, { 2586, 0x9070 }, + { 2591, 0x8a1e }, { 2598, 0xe004 }, { 2602, 0xc3d4 }, { 2610, 0x0451 }, + { 2614, 0x439a }, { 2621, 0x21c2 }, { 2626, 0x4844 }, { 2630, 0x5310 }, + { 2635, 0x0292 }, { 2639, 0x3640 }, { 2644, 0x0241 }, { 2647, 0xf3bd }, + /* 0x6700 */ + { 2659, 0xab09 }, { 2666, 0xe8f0 }, { 2674, 0x7dc0 }, { 2682, 0xa5d2 }, + { 2690, 0xc242 }, { 2695, 0xd24b }, { 2703, 0xa43f }, { 2712, 0xd0af }, + { 2721, 0x1aa0 }, { 2726, 0x34a1 }, { 2732, 0x8247 }, { 2738, 0x03d8 }, + { 2744, 0xc452 }, { 2750, 0x651b }, { 2758, 0xd294 }, { 2765, 0xc83a }, + /* 0x6800 */ + { 2772, 0x001c }, { 2775, 0x40c8 }, { 2779, 0x0e06 }, { 2784, 0x3314 }, + { 2790, 0x614f }, { 2798, 0xb21b }, { 2806, 0x0088 }, { 2808, 0xc0d0 }, + { 2813, 0xa02a }, { 2818, 0xa898 }, { 2824, 0xa1c5 }, { 2831, 0x166b }, + { 2839, 0x2e50 }, { 2845, 0x85b4 }, { 2852, 0xc08b }, { 2858, 0x0604 }, + /* 0x6900 */ + { 2861, 0xf933 }, { 2871, 0x1e04 }, { 2876, 0x056e }, { 2883, 0xa251 }, + { 2889, 0x0400 }, { 2890, 0x7638 }, { 2898, 0xec07 }, { 2906, 0x73b8 }, + { 2915, 0x4406 }, { 2919, 0x1832 }, { 2924, 0x4081 }, { 2927, 0xc816 }, + { 2933, 0x7c8a }, { 2941, 0x6309 }, { 2947, 0x2980 }, { 2951, 0xaa04 }, + /* 0x6a00 */ + { 2956, 0x1c24 }, { 2961, 0xca9c }, { 2969, 0x4e0e }, { 2976, 0x2760 }, + { 2982, 0x0990 }, { 2986, 0x8300 }, { 2989, 0x0046 }, { 2992, 0x8104 }, + { 2995, 0x6011 }, { 2999, 0x1081 }, { 3002, 0x540d }, { 3008, 0x0908 }, + { 3011, 0x000e }, { 3014, 0xcc0a }, { 3020, 0x0500 }, { 3022, 0x0c00 }, + /* 0x6b00 */ + { 3024, 0x0430 }, { 3027, 0xa044 }, { 3031, 0x008b }, { 3035, 0x6784 }, + { 3042, 0x5288 }, { 3047, 0x8a19 }, { 3053, 0x865e }, { 3061, 0x8b18 }, + { 3067, 0x2e59 }, { 3075, 0x4160 }, { 3079, 0x8c10 }, { 3083, 0x9cbe }, + { 3093, 0x6861 }, { 3099, 0x891c }, { 3105, 0x9800 }, { 3108, 0x0008 }, + /* 0x6c00 */ + { 3109, 0x8100 }, { 3111, 0x089a }, { 3116, 0x0018 }, { 3118, 0x4190 }, + { 3122, 0x4007 }, { 3126, 0xe4a1 }, { 3133, 0x0505 }, { 3137, 0x640d }, + { 3143, 0x310e }, { 3149, 0x0e4d }, { 3156, 0x4806 }, { 3160, 0xff0a }, + { 3170, 0x1632 }, { 3176, 0x2aa8 }, { 3182, 0x852e }, { 3189, 0x000b }, + /* 0x6d00 */ + { 3192, 0x1800 }, { 3194, 0xca84 }, { 3200, 0x0e20 }, { 3204, 0x696c }, + { 3212, 0x0032 }, { 3215, 0x1600 }, { 3218, 0x5658 }, { 3225, 0x0390 }, + { 3229, 0x5120 }, { 3233, 0x1a28 }, { 3238, 0x8000 }, { 3239, 0x1124 }, + { 3243, 0x18e1 }, { 3249, 0x4326 }, { 3255, 0x5d52 }, { 3263, 0x0eaa }, + /* 0x6e00 */ + { 3270, 0x0fa0 }, { 3276, 0xae28 }, { 3283, 0xfa7b }, { 3295, 0x4500 }, + { 3298, 0x6408 }, { 3302, 0x8940 }, { 3306, 0xc880 }, { 3310, 0xc044 }, + { 3314, 0x9005 }, { 3318, 0xb141 }, { 3324, 0x8424 }, { 3328, 0x24c4 }, + { 3333, 0x1a34 }, { 3339, 0x603a }, { 3345, 0x9000 }, { 3347, 0xc194 }, + /* 0x6f00 */ + { 3353, 0x8246 }, { 3358, 0x003a }, { 3362, 0x180d }, { 3367, 0xc106 }, + { 3372, 0x0022 }, { 3374, 0x9910 }, { 3379, 0xe050 }, { 3384, 0x1511 }, + { 3389, 0x4057 }, { 3395, 0x0082 }, { 3397, 0x041a }, { 3401, 0x020a }, + { 3404, 0x004f }, { 3409, 0x8930 }, { 3414, 0xd813 }, { 3421, 0x444a }, + /* 0x7000 */ + { 3426, 0x8a02 }, { 3430, 0xed22 }, { 3438, 0x10c0 }, { 3441, 0x4005 }, + { 3444, 0x1000 }, { 3445, 0x0102 }, { 3447, 0x8808 }, { 3450, 0x3101 }, + { 3454, 0x4600 }, { 3457, 0x0204 }, { 3459, 0xf000 }, { 3463, 0x0708 }, + { 3467, 0x8900 }, { 3470, 0xa200 }, { 3473, 0x0000 }, { 3473, 0x2202 }, + /* 0x7100 */ + { 3476, 0x0200 }, { 3477, 0x1610 }, { 3481, 0x0042 }, { 3483, 0x1040 }, + { 3485, 0x5200 }, { 3488, 0x0260 }, { 3491, 0x52f4 }, { 3499, 0x2000 }, + { 3500, 0x8510 }, { 3504, 0x8230 }, { 3508, 0x1100 }, { 3510, 0x4202 }, + { 3513, 0x4308 }, { 3517, 0x80b5 }, { 3523, 0x70e1 }, { 3530, 0x9a20 }, + /* 0x7200 */ + { 3535, 0x2040 }, { 3537, 0x0801 }, { 3539, 0x3500 }, { 3543, 0xfc65 }, + { 3553, 0x19c1 }, { 3559, 0xab04 }, { 3565, 0x0286 }, { 3569, 0x6214 }, + { 3574, 0x0087 }, { 3578, 0x0044 }, { 3580, 0x9085 }, { 3585, 0x0244 }, + { 3588, 0x405c }, { 3593, 0x0a85 }, { 3598, 0x3207 }, { 3604, 0x3380 }, + /* 0x7300 */ + { 3609, 0x0400 }, { 3610, 0xb8c0 }, { 3616, 0xce20 }, { 3622, 0xc0d0 }, + { 3627, 0xc030 }, { 3631, 0x0080 }, { 3632, 0x0508 }, { 3635, 0x0d25 }, + { 3641, 0x0a90 }, { 3645, 0x0040 }, { 3646, 0x0200 }, { 3647, 0x080c }, + { 3650, 0x6505 }, { 3656, 0x4000 }, { 3657, 0x6421 }, { 3662, 0x4102 }, + /* 0x7400 */ + { 3665, 0x0268 }, { 3669, 0x0000 }, { 3669, 0x0024 }, { 3671, 0x847c }, + { 3678, 0x0002 }, { 3679, 0xde20 }, { 3686, 0x8619 }, { 3692, 0x4049 }, + { 3696, 0x0808 }, { 3698, 0x4000 }, { 3699, 0x0084 }, { 3701, 0x2001 }, + { 3703, 0x8400 }, { 3705, 0x1010 }, { 3707, 0x42cd }, { 3714, 0x01c7 }, + /* 0x7500 */ + { 3720, 0x7038 }, { 3726, 0xd52a }, { 3734, 0x1968 }, { 3740, 0x1d8f }, + { 3749, 0xbe50 }, { 3757, 0x3e12 }, { 3764, 0x2ef5 }, { 3774, 0x81d9 }, + { 3781, 0xcec4 }, { 3789, 0x2412 }, { 3793, 0x0828 }, { 3796, 0x732e }, + { 3805, 0x24ac }, { 3811, 0x4b34 }, { 3818, 0x020c }, { 3821, 0xd41d }, + /* 0x7600 */ + { 3829, 0x2a02 }, { 3833, 0x8000 }, { 3834, 0x0097 }, { 3839, 0x0811 }, + { 3842, 0x11c4 }, { 3847, 0x1144 }, { 3851, 0x1786 }, { 3858, 0x7d45 }, + { 3867, 0x49d9 }, { 3875, 0x0649 }, { 3880, 0x4000 }, { 3881, 0x8791 }, + { 3888, 0x254c }, { 3894, 0xd8c4 }, { 3901, 0x44ba }, { 3908, 0x4914 }, + /* 0x7700 */ + { 3913, 0x1b92 }, { 3920, 0xc800 }, { 3923, 0x0271 }, { 3928, 0x1580 }, + { 3932, 0x0081 }, { 3934, 0x0c00 }, { 3936, 0x096a }, { 3942, 0xc200 }, + { 3945, 0x4800 }, { 3947, 0x4002 }, { 3949, 0x3021 }, { 3953, 0xba49 }, + { 3961, 0x2080 }, { 3963, 0x1c80 }, { 3967, 0xe2ac }, { 3975, 0x1008 }, + /* 0x7800 */ + { 3977, 0x1004 }, { 3979, 0x0034 }, { 3982, 0x00e1 }, { 3986, 0x8414 }, + { 3990, 0x0020 }, { 3991, 0x2000 }, { 3992, 0x9800 }, { 3995, 0x1014 }, + { 3998, 0x70c2 }, { 4004, 0x04aa }, { 4009, 0x8688 }, { 4014, 0x5420 }, + { 4018, 0x0c62 }, { 4023, 0x0413 }, { 4027, 0x9180 }, { 4031, 0x2010 }, + /* 0x7900 */ + { 4033, 0x4082 }, { 4036, 0x0206 }, { 4039, 0x1c40 }, { 4043, 0x5400 }, + { 4046, 0x0383 }, { 4051, 0xe4e9 }, { 4060, 0x2125 }, { 4065, 0x8480 }, + { 4068, 0xe433 }, { 4076, 0x2000 }, { 4077, 0x44c0 }, { 4081, 0xe609 }, + { 4088, 0x0a03 }, { 4092, 0x8126 }, { 4097, 0x12da }, { 4104, 0x0801 }, + /* 0x7a00 */ + { 4106, 0x6901 }, { 4111, 0x9790 }, { 4118, 0x4001 }, { 4120, 0xf886 }, + { 4128, 0xe24d }, { 4136, 0x0081 }, { 4138, 0x0a0e }, { 4143, 0xa651 }, + { 4150, 0x011a }, { 4154, 0x81ec }, { 4161, 0xc600 }, { 4165, 0x8441 }, + { 4169, 0xadb8 }, { 4178, 0xb62c }, { 4186, 0xa46f }, { 4195, 0x8741 }, + /* 0x7b00 */ + { 4201, 0x8d54 }, { 4208, 0x4b02 }, { 4213, 0x1161 }, { 4218, 0x0268 }, + { 4222, 0xbb60 }, { 4230, 0x2057 }, { 4236, 0x50a0 }, { 4240, 0x0433 }, + { 4245, 0xa8c0 }, { 4250, 0xb7b4 }, { 4260, 0x2402 }, { 4263, 0x0112 }, + { 4266, 0x9ad3 }, { 4275, 0x2000 }, { 4276, 0x2271 }, { 4282, 0x00c8 }, + /* 0x7c00 */ + { 4285, 0x2081 }, { 4288, 0x809e }, { 4294, 0x0c8a }, { 4299, 0xe180 }, + { 4304, 0xb009 }, { 4309, 0x8151 }, { 4314, 0x1031 }, { 4318, 0x4028 }, + { 4321, 0x2a0e }, { 4327, 0x89a5 }, { 4334, 0x69b6 }, { 4343, 0x620e }, + { 4349, 0x4425 }, { 4354, 0xd144 }, { 4360, 0x8085 }, { 4364, 0x4d54 }, + /* 0x7d00 */ + { 4371, 0x2c75 }, { 4379, 0x1fb1 }, { 4388, 0xd807 }, { 4395, 0x862d }, + { 4402, 0xd87c }, { 4411, 0x4841 }, { 4415, 0x414e }, { 4421, 0x226e }, + { 4428, 0x8200 }, { 4430, 0x9e08 }, { 4436, 0xf80c }, { 4443, 0xed37 }, + { 4454, 0x8c80 }, { 4458, 0x7526 }, { 4466, 0x9313 }, { 4473, 0x0814 }, + /* 0x7e00 */ + { 4476, 0x0e32 }, { 4482, 0xc804 }, { 4486, 0x484e }, { 4492, 0x6ea6 }, + { 4501, 0x2c4a }, { 4507, 0x6670 }, { 4514, 0x26c0 }, { 4519, 0xba01 }, + { 4525, 0xd30c }, { 4532, 0x185d }, { 4539, 0x0000 }, { 4539, 0x0000 }, + { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, + /* 0x7f00 */ + { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0000 }, { 4539, 0x0540 }, + { 4542, 0x7020 }, { 4546, 0x8133 }, { 4552, 0x4f81 }, { 4559, 0x03a5 }, + { 4565, 0x55ec }, { 4574, 0x6410 }, { 4578, 0xc318 }, { 4584, 0x2344 }, + { 4589, 0x1462 }, { 4594, 0x0034 }, { 4597, 0x0a43 }, { 4602, 0x1a09 }, + /* 0x8000 */ + { 4607, 0x187b }, { 4615, 0x13a5 }, { 4622, 0x0102 }, { 4624, 0xa848 }, + { 4629, 0x0440 }, { 4631, 0xc544 }, { 4637, 0x8106 }, { 4641, 0xe2dd }, + { 4651, 0x1af0 }, { 4658, 0x2d48 }, { 4664, 0xb626 }, { 4672, 0x0416 }, + { 4676, 0x5058 }, { 4681, 0x6e40 }, { 4687, 0x8032 }, { 4691, 0x3112 }, + /* 0x8100 */ + { 4696, 0x07e4 }, { 4703, 0x0c00 }, { 4705, 0x8208 }, { 4708, 0x420a }, + { 4712, 0x4840 }, { 4715, 0x803b }, { 4721, 0x4860 }, { 4725, 0x8713 }, + { 4732, 0x850d }, { 4738, 0x3428 }, { 4743, 0x0319 }, { 4748, 0xe529 }, + { 4756, 0x2345 }, { 4762, 0x870a }, { 4768, 0x25a9 }, { 4775, 0x5c18 }, + /* 0x8200 */ + { 4781, 0x77a6 }, { 4791, 0xd9c5 }, { 4800, 0x5e00 }, { 4805, 0x03e8 }, + { 4811, 0x0081 }, { 4813, 0xa700 }, { 4818, 0xcd54 }, { 4826, 0x41c6 }, + { 4832, 0x2800 }, { 4834, 0xa204 }, { 4838, 0xb860 }, { 4844, 0x2b0a }, + { 4850, 0x0020 }, { 4851, 0xda9e }, { 4861, 0x08ea }, { 4867, 0x0e1a }, + /* 0x8300 */ + { 4873, 0x427c }, { 4880, 0x11c0 }, { 4884, 0x8908 }, { 4888, 0x0376 }, + { 4895, 0x8621 }, { 4900, 0x0105 }, { 4903, 0x0000 }, { 4903, 0x18a8 }, + { 4908, 0x46a0 }, { 4913, 0xc448 }, { 4918, 0x0d05 }, { 4923, 0x2022 }, + { 4926, 0x5422 }, { 4931, 0x9148 }, { 4936, 0x8a01 }, { 4940, 0x2897 }, + /* 0x8400 */ + { 4947, 0x7898 }, { 4954, 0x0008 }, { 4955, 0x1605 }, { 4960, 0x3122 }, + { 4965, 0x4240 }, { 4968, 0x0880 }, { 4970, 0xfa4e }, { 4980, 0x06a2 }, + { 4985, 0x0814 }, { 4988, 0x9211 }, { 4993, 0x2002 }, { 4995, 0x9b04 }, + { 5001, 0x2e52 }, { 5008, 0x0643 }, { 5013, 0x5000 }, { 5015, 0x9010 }, + /* 0x8500 */ + { 5018, 0x0041 }, { 5020, 0x85ba }, { 5028, 0x3042 }, { 5032, 0x2020 }, + { 5034, 0x4f0b }, { 5042, 0x05a0 }, { 5046, 0x2708 }, { 5051, 0x4080 }, + { 5053, 0x0591 }, { 5058, 0x1a93 }, { 5065, 0xdf50 }, { 5074, 0x0600 }, + { 5076, 0xa202 }, { 5080, 0x3021 }, { 5084, 0x0630 }, { 5088, 0x4e80 }, + /* 0x8600 */ + { 5093, 0x0cc4 }, { 5098, 0x04c8 }, { 5102, 0xa004 }, { 5105, 0x8001 }, + { 5107, 0x6000 }, { 5109, 0xd431 }, { 5116, 0x0880 }, { 5118, 0x0a02 }, + { 5121, 0x1c00 }, { 5124, 0x0028 }, { 5126, 0x8e18 }, { 5132, 0x0041 }, + { 5134, 0x6ad0 }, { 5141, 0xca10 }, { 5146, 0xf210 }, { 5152, 0x4b00 }, + /* 0x8700 */ + { 5156, 0x274d }, { 5164, 0x1506 }, { 5169, 0x0220 }, { 5171, 0x8890 }, + { 5175, 0x5a00 }, { 5179, 0x82a8 }, { 5184, 0x4549 }, { 5190, 0x8150 }, + { 5194, 0x2004 }, { 5196, 0x8000 }, { 5197, 0x8804 }, { 5200, 0x2c08 }, + { 5204, 0x08d1 }, { 5209, 0x0005 }, { 5211, 0x8001 }, { 5213, 0x4ac4 }, + /* 0x8800 */ + { 5219, 0xe020 }, { 5223, 0x0062 }, { 5226, 0x008e }, { 5230, 0x0a42 }, + { 5234, 0x3055 }, { 5240, 0x6a8c }, { 5247, 0x090e }, { 5252, 0xe0a5 }, + { 5259, 0x2906 }, { 5264, 0x42c4 }, { 5269, 0x4814 }, { 5273, 0x80b3 }, + { 5279, 0x803e }, { 5285, 0xb330 }, { 5292, 0x0102 }, { 5294, 0x731c }, + /* 0x8900 */ + { 5302, 0x1494 }, { 5307, 0x600d }, { 5312, 0x0c20 }, { 5315, 0x0940 }, + { 5318, 0x301a }, { 5323, 0xc040 }, { 5326, 0xa451 }, { 5332, 0xc094 }, + { 5337, 0x8dca }, { 5345, 0x05c8 }, { 5350, 0x96c2 }, { 5357, 0xa40c }, + { 5362, 0x0001 }, { 5363, 0x3404 }, { 5367, 0x00c8 }, { 5370, 0x0110 }, + /* 0x8a00 */ + { 5372, 0x550d }, { 5379, 0xa9c9 }, { 5387, 0x2428 }, { 5391, 0x1c5a }, + { 5398, 0x0142 }, { 5401, 0x4837 }, { 5408, 0x7a4d }, { 5417, 0x100f }, + { 5422, 0x32b4 }, { 5429, 0x452a }, { 5435, 0x317b }, { 5444, 0x9205 }, + { 5449, 0xb894 }, { 5456, 0x5c44 }, { 5462, 0x68d7 }, { 5471, 0x458a }, + /* 0x8b00 */ + { 5477, 0x5097 }, { 5484, 0x2ed1 }, { 5492, 0x1943 }, { 5498, 0x4208 }, + { 5501, 0xd202 }, { 5506, 0x9d40 }, { 5512, 0x9840 }, { 5516, 0x2097 }, + { 5522, 0x5409 }, { 5527, 0x064d }, { 5533, 0x0000 }, { 5533, 0x0000 }, + { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, + /* 0x8c00 */ + { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x0000 }, { 5533, 0x8480 }, + { 5536, 0x5542 }, { 5542, 0x0421 }, { 5545, 0x1c06 }, { 5550, 0x1700 }, + { 5554, 0x7624 }, { 5561, 0x6110 }, { 5565, 0xff87 }, { 5577, 0xb9dd }, + { 5588, 0x659f }, { 5598, 0x5c0a }, { 5604, 0x245d }, { 5611, 0x3c00 }, + /* 0x8d00 */ + { 5615, 0xadb0 }, { 5623, 0x0059 }, { 5627, 0x0000 }, { 5627, 0x0000 }, + { 5627, 0x0000 }, { 5627, 0x0000 }, { 5627, 0x28d0 }, { 5632, 0x009b }, + { 5637, 0x0422 }, { 5640, 0x0200 }, { 5641, 0x0108 }, { 5643, 0x4408 }, + { 5646, 0x9804 }, { 5650, 0xac40 }, { 5655, 0x8d0a }, { 5661, 0x9028 }, + /* 0x8e00 */ + { 5665, 0x8700 }, { 5669, 0xe001 }, { 5673, 0x0400 }, { 5674, 0x0031 }, + { 5677, 0x1794 }, { 5684, 0x8221 }, { 5688, 0x0019 }, { 5691, 0x1054 }, + { 5695, 0x2cb2 }, { 5702, 0x021a }, { 5706, 0x9c02 }, { 5711, 0x4003 }, + { 5714, 0x3d60 }, { 5721, 0x8804 }, { 5724, 0x080c }, { 5727, 0x7900 }, + /* 0x8f00 */ + { 5732, 0x1628 }, { 5737, 0xba3c }, { 5746, 0x8640 }, { 5750, 0xcb08 }, + { 5756, 0x7274 }, { 5764, 0x9080 }, { 5767, 0x001e }, { 5771, 0x0000 }, + { 5771, 0x0000 }, { 5771, 0xd800 }, { 5775, 0xe188 }, { 5781, 0x9c87 }, + { 5789, 0x4034 }, { 5793, 0x0412 }, { 5796, 0xae64 }, { 5804, 0x2791 }, + /* 0x9000 */ + { 5811, 0xe86b }, { 5820, 0xe6fb }, { 5832, 0x408f }, { 5838, 0x5366 }, + { 5846, 0xeea6 }, { 5856, 0x537f }, { 5867, 0xe32b }, { 5876, 0xb5e4 }, + { 5885, 0x869f }, { 5894, 0x0002 }, { 5895, 0x8548 }, { 5900, 0x0122 }, + { 5903, 0x4402 }, { 5906, 0x0800 }, { 5907, 0x2116 }, { 5912, 0x20a0 }, + /* 0x9100 */ + { 5915, 0x0004 }, { 5916, 0x0204 }, { 5918, 0x2000 }, { 5919, 0x0005 }, + { 5921, 0x7e00 }, { 5927, 0x0154 }, { 5931, 0x162c }, { 5937, 0x01ac }, + { 5942, 0x2a84 }, { 5947, 0x1085 }, { 5951, 0x8c14 }, { 5956, 0x0530 }, + { 5960, 0xfbc3 }, { 5971, 0xb943 }, { 5979, 0x00ca }, { 5983, 0x9060 }, + /* 0x9200 */ + { 5987, 0x6000 }, { 5989, 0x4032 }, { 5993, 0x1200 }, { 5995, 0x8090 }, + { 5998, 0x0b30 }, { 6003, 0x4c81 }, { 6008, 0x0054 }, { 6011, 0x4002 }, + { 6013, 0x0029 }, { 6016, 0x1d6a }, { 6024, 0x2000 }, { 6025, 0x0280 }, + { 6027, 0x8000 }, { 6028, 0x0004 }, { 6029, 0x2610 }, { 6033, 0x150c }, + /* 0x9300 */ + { 6038, 0x8040 }, { 6040, 0x0701 }, { 6044, 0xd94d }, { 6053, 0x0c24 }, + { 6057, 0x2810 }, { 6060, 0x1850 }, { 6064, 0x5001 }, { 6067, 0x5020 }, + { 6070, 0x1000 }, { 6071, 0x04d0 }, { 6075, 0x7080 }, { 6079, 0x0201 }, + { 6081, 0x0108 }, { 6083, 0x21c3 }, { 6089, 0x0132 }, { 6093, 0x0000 }, + /* 0x9400 */ + { 6093, 0x0088 }, { 6095, 0x0719 }, { 6101, 0x0802 }, { 6103, 0x0560 }, + { 6107, 0x0012 }, { 6109, 0x4c0e }, { 6115, 0x0405 }, { 6118, 0xf0a1 }, + { 6125, 0x0002 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, + { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, + /* 0x9500 */ + { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, + { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0000 }, { 6126, 0x0080 }, + { 6127, 0x8e8d }, { 6135, 0x035a }, { 6141, 0x21bd }, { 6149, 0x5a04 }, + { 6154, 0x3488 }, { 6159, 0x1170 }, { 6164, 0x0026 }, { 6167, 0x0000 }, + /* 0x9600 */ + { 6167, 0x0000 }, { 6167, 0x1000 }, { 6168, 0xc502 }, { 6173, 0x8804 }, + { 6176, 0xb815 }, { 6183, 0xf801 }, { 6189, 0x147c }, { 6196, 0x25ed }, + { 6205, 0xed60 }, { 6213, 0x1bb0 }, { 6220, 0x0589 }, { 6225, 0x1bd7 }, + { 6235, 0x7af3 }, { 6246, 0x1a62 }, { 6252, 0x0d0c }, { 6257, 0x0ac5 }, + /* 0x9700 */ + { 6263, 0xe5d1 }, { 6272, 0x524a }, { 6278, 0x0490 }, { 6281, 0x6305 }, + { 6287, 0x0354 }, { 6292, 0x5244 }, { 6297, 0x2b57 }, { 6306, 0x1612 }, + { 6311, 0xa872 }, { 6318, 0x1101 }, { 6321, 0x2949 }, { 6327, 0x0018 }, + { 6329, 0x0948 }, { 6333, 0x1008 }, { 6335, 0x6000 }, { 6337, 0x886c }, + /* 0x9800 */ + { 6343, 0x916e }, { 6351, 0x058f }, { 6358, 0x3012 }, { 6362, 0x3990 }, + { 6368, 0xf840 }, { 6374, 0x4930 }, { 6379, 0x8880 }, { 6382, 0x001b }, + { 6386, 0x0000 }, { 6386, 0x0000 }, { 6386, 0x8500 }, { 6389, 0x0042 }, + { 6391, 0x0058 }, { 6394, 0x9800 }, { 6397, 0xea04 }, { 6403, 0x7014 }, + /* 0x9900 */ + { 6408, 0x1628 }, { 6413, 0x611d }, { 6420, 0x5113 }, { 6426, 0x6000 }, + { 6428, 0x1a24 }, { 6433, 0x00a7 }, { 6438, 0x0000 }, { 6438, 0x0000 }, + { 6438, 0x0000 }, { 6438, 0x03c0 }, { 6442, 0x7120 }, { 6447, 0x1018 }, + { 6450, 0x0172 }, { 6455, 0xa927 }, { 6463, 0x6004 }, { 6466, 0x8906 }, + /* 0x9a00 */ + { 6471, 0xc022 }, { 6475, 0x020c }, { 6478, 0x0900 }, { 6480, 0x4081 }, + { 6483, 0x202d }, { 6488, 0x8ca0 }, { 6493, 0x0e34 }, { 6499, 0x0000 }, + { 6499, 0x0000 }, { 6499, 0x0000 }, { 6499, 0x2100 }, { 6501, 0x1101 }, + { 6504, 0x8011 }, { 6507, 0xc11a }, { 6513, 0xec4c }, { 6521, 0x0892 }, + /* 0x9b00 */ + { 6525, 0x0040 }, { 6526, 0x8500 }, { 6529, 0xc7ac }, { 6538, 0x1806 }, + { 6542, 0xe03e }, { 6550, 0x0512 }, { 6554, 0x8000 }, { 6555, 0x0010 }, + { 6556, 0x4008 }, { 6558, 0x80ce }, { 6564, 0x6d01 }, { 6570, 0x0210 }, + { 6572, 0x8641 }, { 6577, 0x0856 }, { 6582, 0x011e }, { 6587, 0x0027 }, + /* 0x9c00 */ + { 6591, 0x3750 }, { 6598, 0x083d }, { 6604, 0xe032 }, { 6610, 0x4e05 }, + { 6616, 0x01c0 }, { 6619, 0x0484 }, { 6622, 0x0081 }, { 6624, 0x0140 }, + { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x0000 }, + { 6626, 0x0000 }, { 6626, 0x0000 }, { 6626, 0x1aa0 }, { 6631, 0x0059 }, + /* 0x9d00 */ + { 6635, 0x43c8 }, { 6641, 0x8824 }, { 6645, 0x1d48 }, { 6651, 0xc800 }, + { 6654, 0x0152 }, { 6658, 0x7203 }, { 6664, 0x9013 }, { 6669, 0x0404 }, + { 6671, 0x8280 }, { 6674, 0x0400 }, { 6675, 0x8a10 }, { 6679, 0x0d14 }, + { 6684, 0x8056 }, { 6689, 0x0208 }, { 6691, 0xa040 }, { 6694, 0x2704 }, + /* 0x9e00 */ + { 6699, 0x0000 }, { 6699, 0x4c00 }, { 6702, 0x0000 }, { 6702, 0x0000 }, + { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0x0000 }, { 6702, 0xa320 }, + { 6707, 0x1902 }, { 6711, 0xa0ae }, { 6718, 0x2660 }, { 6723, 0xdf00 }, + { 6730, 0xf010 }, { 6735, 0x7b15 }, { 6744, 0x8121 }, { 6748, 0x3ad0 }, + /* 0x9f00 */ + { 6755, 0x4180 }, { 6758, 0x0028 }, { 6760, 0x1003 }, { 6763, 0x4800 }, + { 6765, 0xcc00 }, { 6769, 0x8014 }, { 6772, 0x14cf }, { 6780, 0x00c4 }, + { 6783, 0x2000 }, { 6784, 0x3020 }, { 6787, 0x0001 }, +}; +static const Summary16 jisx0208_uni2indx_pageff[15] = { + /* 0xff00 */ + { 6788, 0xdf7a }, { 6800, 0xffff }, { 6816, 0xffff }, { 6832, 0xefff }, + { 6847, 0xffff }, { 6863, 0x3fff }, { 6877, 0x0000 }, { 6877, 0x0000 }, + { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0000 }, + { 6877, 0x0000 }, { 6877, 0x0000 }, { 6877, 0x0028 }, +}; + +static int +jisx0208_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc < 0x0100) + summary = &jisx0208_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x0300 && wc < 0x0460) + summary = &jisx0208_uni2indx_page03[(wc>>4)-0x030]; + else if (wc >= 0x2000 && wc < 0x2320) + summary = &jisx0208_uni2indx_page20[(wc>>4)-0x200]; + else if (wc >= 0x2500 && wc < 0x2670) + summary = &jisx0208_uni2indx_page25[(wc>>4)-0x250]; + else if (wc >= 0x3000 && wc < 0x3100) + summary = &jisx0208_uni2indx_page30[(wc>>4)-0x300]; + else if (wc >= 0x4e00 && wc < 0x9fb0) + summary = &jisx0208_uni2indx_page4e[(wc>>4)-0x4e0]; + else if (wc >= 0xff00 && wc < 0xfff0) + summary = &jisx0208_uni2indx_pageff[(wc>>4)-0xff0]; + if (summary) { + unsigned short used = summary->used; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = jisx0208_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0212.h b/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0212.h new file mode 100644 index 000000000..05cca5203 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/jisx0212.h @@ -0,0 +1,2163 @@ + +/* + * JISX0212.1990-0 + */ + +static const unsigned short jisx0212_2uni_page22[81] = { + /* 0x22 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x02d8, 0x02c7, + 0x00b8, 0x02d9, 0x02dd, 0x00af, 0x02db, 0x02da, 0x007e, 0x0384, + 0x0385, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0x00a1, 0x00a6, 0x00bf, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0x00ba, 0x00aa, 0x00a9, 0x00ae, 0x2122, 0x00a4, + 0x2116, +}; +static const unsigned short jisx0212_2uni_page26[188] = { + /* 0x26 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0386, 0x0388, 0x0389, 0x038a, 0x03aa, 0xfffd, 0x038c, 0xfffd, + 0x038e, 0x03ab, 0xfffd, 0x038f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x03ac, 0x03ad, 0x03ae, 0x03af, 0x03ca, 0x0390, 0x03cc, 0x03c2, + 0x03cd, 0x03cb, 0x03b0, 0x03ce, 0xfffd, 0xfffd, + /* 0x27 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0x0402, 0x0403, 0x0404, 0x0405, 0x0406, 0x0407, 0x0408, + 0x0409, 0x040a, 0x040b, 0x040c, 0x040e, 0x040f, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0x0452, 0x0453, 0x0454, 0x0455, 0x0456, 0x0457, 0x0458, + 0x0459, 0x045a, 0x045b, 0x045c, 0x045e, 0x045f, +}; +static const unsigned short jisx0212_2uni_page29[275] = { + /* 0x29 */ + 0x00c6, 0x0110, 0xfffd, 0x0126, 0xfffd, 0x0132, 0xfffd, 0x0141, + 0x013f, 0xfffd, 0x014a, 0x00d8, 0x0152, 0xfffd, 0x0166, 0x00de, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138, 0x0142, + 0x0140, 0x0149, 0x014b, 0x00f8, 0x0153, 0x00df, 0x0167, 0x00fe, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x2a */ + 0x00c1, 0x00c0, 0x00c4, 0x00c2, 0x0102, 0x01cd, 0x0100, 0x0104, + 0x00c5, 0x00c3, 0x0106, 0x0108, 0x010c, 0x00c7, 0x010a, 0x010e, + 0x00c9, 0x00c8, 0x00cb, 0x00ca, 0x011a, 0x0116, 0x0112, 0x0118, + 0xfffd, 0x011c, 0x011e, 0x0122, 0x0120, 0x0124, 0x00cd, 0x00cc, + 0x00cf, 0x00ce, 0x01cf, 0x0130, 0x012a, 0x012e, 0x0128, 0x0134, + 0x0136, 0x0139, 0x013d, 0x013b, 0x0143, 0x0147, 0x0145, 0x00d1, + 0x00d3, 0x00d2, 0x00d6, 0x00d4, 0x01d1, 0x0150, 0x014c, 0x00d5, + 0x0154, 0x0158, 0x0156, 0x015a, 0x015c, 0x0160, 0x015e, 0x0164, + 0x0162, 0x00da, 0x00d9, 0x00dc, 0x00db, 0x016c, 0x01d3, 0x0170, + 0x016a, 0x0172, 0x016e, 0x0168, 0x01d7, 0x01db, 0x01d9, 0x01d5, + 0x0174, 0x00dd, 0x0178, 0x0176, 0x0179, 0x017d, 0x017b, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x2b */ + 0x00e1, 0x00e0, 0x00e4, 0x00e2, 0x0103, 0x01ce, 0x0101, 0x0105, + 0x00e5, 0x00e3, 0x0107, 0x0109, 0x010d, 0x00e7, 0x010b, 0x010f, + 0x00e9, 0x00e8, 0x00eb, 0x00ea, 0x011b, 0x0117, 0x0113, 0x0119, + 0x01f5, 0x011d, 0x011f, 0xfffd, 0x0121, 0x0125, 0x00ed, 0x00ec, + 0x00ef, 0x00ee, 0x01d0, 0xfffd, 0x012b, 0x012f, 0x0129, 0x0135, + 0x0137, 0x013a, 0x013e, 0x013c, 0x0144, 0x0148, 0x0146, 0x00f1, + 0x00f3, 0x00f2, 0x00f6, 0x00f4, 0x01d2, 0x0151, 0x014d, 0x00f5, + 0x0155, 0x0159, 0x0157, 0x015b, 0x015d, 0x0161, 0x015f, 0x0165, + 0x0163, 0x00fa, 0x00f9, 0x00fc, 0x00fb, 0x016d, 0x01d4, 0x0171, + 0x016b, 0x0173, 0x016f, 0x0169, 0x01d8, 0x01dc, 0x01da, 0x01d6, + 0x0175, 0x00fd, 0x00ff, 0x0177, 0x017a, 0x017e, 0x017c, +}; +static const unsigned short jisx0212_2uni_page30[5801] = { + /* 0x30 */ + 0x4e02, 0x4e04, 0x4e05, 0x4e0c, 0x4e12, 0x4e1f, 0x4e23, 0x4e24, + 0x4e28, 0x4e2b, 0x4e2e, 0x4e2f, 0x4e30, 0x4e35, 0x4e40, 0x4e41, + 0x4e44, 0x4e47, 0x4e51, 0x4e5a, 0x4e5c, 0x4e63, 0x4e68, 0x4e69, + 0x4e74, 0x4e75, 0x4e79, 0x4e7f, 0x4e8d, 0x4e96, 0x4e97, 0x4e9d, + 0x4eaf, 0x4eb9, 0x4ec3, 0x4ed0, 0x4eda, 0x4edb, 0x4ee0, 0x4ee1, + 0x4ee2, 0x4ee8, 0x4eef, 0x4ef1, 0x4ef3, 0x4ef5, 0x4efd, 0x4efe, + 0x4eff, 0x4f00, 0x4f02, 0x4f03, 0x4f08, 0x4f0b, 0x4f0c, 0x4f12, + 0x4f15, 0x4f16, 0x4f17, 0x4f19, 0x4f2e, 0x4f31, 0x4f60, 0x4f33, + 0x4f35, 0x4f37, 0x4f39, 0x4f3b, 0x4f3e, 0x4f40, 0x4f42, 0x4f48, + 0x4f49, 0x4f4b, 0x4f4c, 0x4f52, 0x4f54, 0x4f56, 0x4f58, 0x4f5f, + 0x4f63, 0x4f6a, 0x4f6c, 0x4f6e, 0x4f71, 0x4f77, 0x4f78, 0x4f79, + 0x4f7a, 0x4f7d, 0x4f7e, 0x4f81, 0x4f82, 0x4f84, + /* 0x31 */ + 0x4f85, 0x4f89, 0x4f8a, 0x4f8c, 0x4f8e, 0x4f90, 0x4f92, 0x4f93, + 0x4f94, 0x4f97, 0x4f99, 0x4f9a, 0x4f9e, 0x4f9f, 0x4fb2, 0x4fb7, + 0x4fb9, 0x4fbb, 0x4fbc, 0x4fbd, 0x4fbe, 0x4fc0, 0x4fc1, 0x4fc5, + 0x4fc6, 0x4fc8, 0x4fc9, 0x4fcb, 0x4fcc, 0x4fcd, 0x4fcf, 0x4fd2, + 0x4fdc, 0x4fe0, 0x4fe2, 0x4ff0, 0x4ff2, 0x4ffc, 0x4ffd, 0x4fff, + 0x5000, 0x5001, 0x5004, 0x5007, 0x500a, 0x500c, 0x500e, 0x5010, + 0x5013, 0x5017, 0x5018, 0x501b, 0x501c, 0x501d, 0x501e, 0x5022, + 0x5027, 0x502e, 0x5030, 0x5032, 0x5033, 0x5035, 0x5040, 0x5041, + 0x5042, 0x5045, 0x5046, 0x504a, 0x504c, 0x504e, 0x5051, 0x5052, + 0x5053, 0x5057, 0x5059, 0x505f, 0x5060, 0x5062, 0x5063, 0x5066, + 0x5067, 0x506a, 0x506d, 0x5070, 0x5071, 0x503b, 0x5081, 0x5083, + 0x5084, 0x5086, 0x508a, 0x508e, 0x508f, 0x5090, + /* 0x32 */ + 0x5092, 0x5093, 0x5094, 0x5096, 0x509b, 0x509c, 0x509e, 0x509f, + 0x50a0, 0x50a1, 0x50a2, 0x50aa, 0x50af, 0x50b0, 0x50b9, 0x50ba, + 0x50bd, 0x50c0, 0x50c3, 0x50c4, 0x50c7, 0x50cc, 0x50ce, 0x50d0, + 0x50d3, 0x50d4, 0x50d8, 0x50dc, 0x50dd, 0x50df, 0x50e2, 0x50e4, + 0x50e6, 0x50e8, 0x50e9, 0x50ef, 0x50f1, 0x50f6, 0x50fa, 0x50fe, + 0x5103, 0x5106, 0x5107, 0x5108, 0x510b, 0x510c, 0x510d, 0x510e, + 0x50f2, 0x5110, 0x5117, 0x5119, 0x511b, 0x511c, 0x511d, 0x511e, + 0x5123, 0x5127, 0x5128, 0x512c, 0x512d, 0x512f, 0x5131, 0x5133, + 0x5134, 0x5135, 0x5138, 0x5139, 0x5142, 0x514a, 0x514f, 0x5153, + 0x5155, 0x5157, 0x5158, 0x515f, 0x5164, 0x5166, 0x517e, 0x5183, + 0x5184, 0x518b, 0x518e, 0x5198, 0x519d, 0x51a1, 0x51a3, 0x51ad, + 0x51b8, 0x51ba, 0x51bc, 0x51be, 0x51bf, 0x51c2, + /* 0x33 */ + 0x51c8, 0x51cf, 0x51d1, 0x51d2, 0x51d3, 0x51d5, 0x51d8, 0x51de, + 0x51e2, 0x51e5, 0x51ee, 0x51f2, 0x51f3, 0x51f4, 0x51f7, 0x5201, + 0x5202, 0x5205, 0x5212, 0x5213, 0x5215, 0x5216, 0x5218, 0x5222, + 0x5228, 0x5231, 0x5232, 0x5235, 0x523c, 0x5245, 0x5249, 0x5255, + 0x5257, 0x5258, 0x525a, 0x525c, 0x525f, 0x5260, 0x5261, 0x5266, + 0x526e, 0x5277, 0x5278, 0x5279, 0x5280, 0x5282, 0x5285, 0x528a, + 0x528c, 0x5293, 0x5295, 0x5296, 0x5297, 0x5298, 0x529a, 0x529c, + 0x52a4, 0x52a5, 0x52a6, 0x52a7, 0x52af, 0x52b0, 0x52b6, 0x52b7, + 0x52b8, 0x52ba, 0x52bb, 0x52bd, 0x52c0, 0x52c4, 0x52c6, 0x52c8, + 0x52cc, 0x52cf, 0x52d1, 0x52d4, 0x52d6, 0x52db, 0x52dc, 0x52e1, + 0x52e5, 0x52e8, 0x52e9, 0x52ea, 0x52ec, 0x52f0, 0x52f1, 0x52f4, + 0x52f6, 0x52f7, 0x5300, 0x5303, 0x530a, 0x530b, + /* 0x34 */ + 0x530c, 0x5311, 0x5313, 0x5318, 0x531b, 0x531c, 0x531e, 0x531f, + 0x5325, 0x5327, 0x5328, 0x5329, 0x532b, 0x532c, 0x532d, 0x5330, + 0x5332, 0x5335, 0x533c, 0x533d, 0x533e, 0x5342, 0x534c, 0x534b, + 0x5359, 0x535b, 0x5361, 0x5363, 0x5365, 0x536c, 0x536d, 0x5372, + 0x5379, 0x537e, 0x5383, 0x5387, 0x5388, 0x538e, 0x5393, 0x5394, + 0x5399, 0x539d, 0x53a1, 0x53a4, 0x53aa, 0x53ab, 0x53af, 0x53b2, + 0x53b4, 0x53b5, 0x53b7, 0x53b8, 0x53ba, 0x53bd, 0x53c0, 0x53c5, + 0x53cf, 0x53d2, 0x53d3, 0x53d5, 0x53da, 0x53dd, 0x53de, 0x53e0, + 0x53e6, 0x53e7, 0x53f5, 0x5402, 0x5413, 0x541a, 0x5421, 0x5427, + 0x5428, 0x542a, 0x542f, 0x5431, 0x5434, 0x5435, 0x5443, 0x5444, + 0x5447, 0x544d, 0x544f, 0x545e, 0x5462, 0x5464, 0x5466, 0x5467, + 0x5469, 0x546b, 0x546d, 0x546e, 0x5474, 0x547f, + /* 0x35 */ + 0x5481, 0x5483, 0x5485, 0x5488, 0x5489, 0x548d, 0x5491, 0x5495, + 0x5496, 0x549c, 0x549f, 0x54a1, 0x54a6, 0x54a7, 0x54a9, 0x54aa, + 0x54ad, 0x54ae, 0x54b1, 0x54b7, 0x54b9, 0x54ba, 0x54bb, 0x54bf, + 0x54c6, 0x54ca, 0x54cd, 0x54ce, 0x54e0, 0x54ea, 0x54ec, 0x54ef, + 0x54f6, 0x54fc, 0x54fe, 0x54ff, 0x5500, 0x5501, 0x5505, 0x5508, + 0x5509, 0x550c, 0x550d, 0x550e, 0x5515, 0x552a, 0x552b, 0x5532, + 0x5535, 0x5536, 0x553b, 0x553c, 0x553d, 0x5541, 0x5547, 0x5549, + 0x554a, 0x554d, 0x5550, 0x5551, 0x5558, 0x555a, 0x555b, 0x555e, + 0x5560, 0x5561, 0x5564, 0x5566, 0x557f, 0x5581, 0x5582, 0x5586, + 0x5588, 0x558e, 0x558f, 0x5591, 0x5592, 0x5593, 0x5594, 0x5597, + 0x55a3, 0x55a4, 0x55ad, 0x55b2, 0x55bf, 0x55c1, 0x55c3, 0x55c6, + 0x55c9, 0x55cb, 0x55cc, 0x55ce, 0x55d1, 0x55d2, + /* 0x36 */ + 0x55d3, 0x55d7, 0x55d8, 0x55db, 0x55de, 0x55e2, 0x55e9, 0x55f6, + 0x55ff, 0x5605, 0x5608, 0x560a, 0x560d, 0x560e, 0x560f, 0x5610, + 0x5611, 0x5612, 0x5619, 0x562c, 0x5630, 0x5633, 0x5635, 0x5637, + 0x5639, 0x563b, 0x563c, 0x563d, 0x563f, 0x5640, 0x5641, 0x5643, + 0x5644, 0x5646, 0x5649, 0x564b, 0x564d, 0x564f, 0x5654, 0x565e, + 0x5660, 0x5661, 0x5662, 0x5663, 0x5666, 0x5669, 0x566d, 0x566f, + 0x5671, 0x5672, 0x5675, 0x5684, 0x5685, 0x5688, 0x568b, 0x568c, + 0x5695, 0x5699, 0x569a, 0x569d, 0x569e, 0x569f, 0x56a6, 0x56a7, + 0x56a8, 0x56a9, 0x56ab, 0x56ac, 0x56ad, 0x56b1, 0x56b3, 0x56b7, + 0x56be, 0x56c5, 0x56c9, 0x56ca, 0x56cb, 0x56cf, 0x56d0, 0x56cc, + 0x56cd, 0x56d9, 0x56dc, 0x56dd, 0x56df, 0x56e1, 0x56e4, 0x56e5, + 0x56e6, 0x56e7, 0x56e8, 0x56f1, 0x56eb, 0x56ed, + /* 0x37 */ + 0x56f6, 0x56f7, 0x5701, 0x5702, 0x5707, 0x570a, 0x570c, 0x5711, + 0x5715, 0x571a, 0x571b, 0x571d, 0x5720, 0x5722, 0x5723, 0x5724, + 0x5725, 0x5729, 0x572a, 0x572c, 0x572e, 0x572f, 0x5733, 0x5734, + 0x573d, 0x573e, 0x573f, 0x5745, 0x5746, 0x574c, 0x574d, 0x5752, + 0x5762, 0x5765, 0x5767, 0x5768, 0x576b, 0x576d, 0x576e, 0x576f, + 0x5770, 0x5771, 0x5773, 0x5774, 0x5775, 0x5777, 0x5779, 0x577a, + 0x577b, 0x577c, 0x577e, 0x5781, 0x5783, 0x578c, 0x5794, 0x5797, + 0x5799, 0x579a, 0x579c, 0x579d, 0x579e, 0x579f, 0x57a1, 0x5795, + 0x57a7, 0x57a8, 0x57a9, 0x57ac, 0x57b8, 0x57bd, 0x57c7, 0x57c8, + 0x57cc, 0x57cf, 0x57d5, 0x57dd, 0x57de, 0x57e4, 0x57e6, 0x57e7, + 0x57e9, 0x57ed, 0x57f0, 0x57f5, 0x57f6, 0x57f8, 0x57fd, 0x57fe, + 0x57ff, 0x5803, 0x5804, 0x5808, 0x5809, 0x57e1, + /* 0x38 */ + 0x580c, 0x580d, 0x581b, 0x581e, 0x581f, 0x5820, 0x5826, 0x5827, + 0x582d, 0x5832, 0x5839, 0x583f, 0x5849, 0x584c, 0x584d, 0x584f, + 0x5850, 0x5855, 0x585f, 0x5861, 0x5864, 0x5867, 0x5868, 0x5878, + 0x587c, 0x587f, 0x5880, 0x5881, 0x5887, 0x5888, 0x5889, 0x588a, + 0x588c, 0x588d, 0x588f, 0x5890, 0x5894, 0x5896, 0x589d, 0x58a0, + 0x58a1, 0x58a2, 0x58a6, 0x58a9, 0x58b1, 0x58b2, 0x58c4, 0x58bc, + 0x58c2, 0x58c8, 0x58cd, 0x58ce, 0x58d0, 0x58d2, 0x58d4, 0x58d6, + 0x58da, 0x58dd, 0x58e1, 0x58e2, 0x58e9, 0x58f3, 0x5905, 0x5906, + 0x590b, 0x590c, 0x5912, 0x5913, 0x5914, 0x8641, 0x591d, 0x5921, + 0x5923, 0x5924, 0x5928, 0x592f, 0x5930, 0x5933, 0x5935, 0x5936, + 0x593f, 0x5943, 0x5946, 0x5952, 0x5953, 0x5959, 0x595b, 0x595d, + 0x595e, 0x595f, 0x5961, 0x5963, 0x596b, 0x596d, + /* 0x39 */ + 0x596f, 0x5972, 0x5975, 0x5976, 0x5979, 0x597b, 0x597c, 0x598b, + 0x598c, 0x598e, 0x5992, 0x5995, 0x5997, 0x599f, 0x59a4, 0x59a7, + 0x59ad, 0x59ae, 0x59af, 0x59b0, 0x59b3, 0x59b7, 0x59ba, 0x59bc, + 0x59c1, 0x59c3, 0x59c4, 0x59c8, 0x59ca, 0x59cd, 0x59d2, 0x59dd, + 0x59de, 0x59df, 0x59e3, 0x59e4, 0x59e7, 0x59ee, 0x59ef, 0x59f1, + 0x59f2, 0x59f4, 0x59f7, 0x5a00, 0x5a04, 0x5a0c, 0x5a0d, 0x5a0e, + 0x5a12, 0x5a13, 0x5a1e, 0x5a23, 0x5a24, 0x5a27, 0x5a28, 0x5a2a, + 0x5a2d, 0x5a30, 0x5a44, 0x5a45, 0x5a47, 0x5a48, 0x5a4c, 0x5a50, + 0x5a55, 0x5a5e, 0x5a63, 0x5a65, 0x5a67, 0x5a6d, 0x5a77, 0x5a7a, + 0x5a7b, 0x5a7e, 0x5a8b, 0x5a90, 0x5a93, 0x5a96, 0x5a99, 0x5a9c, + 0x5a9e, 0x5a9f, 0x5aa0, 0x5aa2, 0x5aa7, 0x5aac, 0x5ab1, 0x5ab2, + 0x5ab3, 0x5ab5, 0x5ab8, 0x5aba, 0x5abb, 0x5abf, + /* 0x3a */ + 0x5ac4, 0x5ac6, 0x5ac8, 0x5acf, 0x5ada, 0x5adc, 0x5ae0, 0x5ae5, + 0x5aea, 0x5aee, 0x5af5, 0x5af6, 0x5afd, 0x5b00, 0x5b01, 0x5b08, + 0x5b17, 0x5b34, 0x5b19, 0x5b1b, 0x5b1d, 0x5b21, 0x5b25, 0x5b2d, + 0x5b38, 0x5b41, 0x5b4b, 0x5b4c, 0x5b52, 0x5b56, 0x5b5e, 0x5b68, + 0x5b6e, 0x5b6f, 0x5b7c, 0x5b7d, 0x5b7e, 0x5b7f, 0x5b81, 0x5b84, + 0x5b86, 0x5b8a, 0x5b8e, 0x5b90, 0x5b91, 0x5b93, 0x5b94, 0x5b96, + 0x5ba8, 0x5ba9, 0x5bac, 0x5bad, 0x5baf, 0x5bb1, 0x5bb2, 0x5bb7, + 0x5bba, 0x5bbc, 0x5bc0, 0x5bc1, 0x5bcd, 0x5bcf, 0x5bd6, 0x5bd7, + 0x5bd8, 0x5bd9, 0x5bda, 0x5be0, 0x5bef, 0x5bf1, 0x5bf4, 0x5bfd, + 0x5c0c, 0x5c17, 0x5c1e, 0x5c1f, 0x5c23, 0x5c26, 0x5c29, 0x5c2b, + 0x5c2c, 0x5c2e, 0x5c30, 0x5c32, 0x5c35, 0x5c36, 0x5c59, 0x5c5a, + 0x5c5c, 0x5c62, 0x5c63, 0x5c67, 0x5c68, 0x5c69, + /* 0x3b */ + 0x5c6d, 0x5c70, 0x5c74, 0x5c75, 0x5c7a, 0x5c7b, 0x5c7c, 0x5c7d, + 0x5c87, 0x5c88, 0x5c8a, 0x5c8f, 0x5c92, 0x5c9d, 0x5c9f, 0x5ca0, + 0x5ca2, 0x5ca3, 0x5ca6, 0x5caa, 0x5cb2, 0x5cb4, 0x5cb5, 0x5cba, + 0x5cc9, 0x5ccb, 0x5cd2, 0x5cdd, 0x5cd7, 0x5cee, 0x5cf1, 0x5cf2, + 0x5cf4, 0x5d01, 0x5d06, 0x5d0d, 0x5d12, 0x5d2b, 0x5d23, 0x5d24, + 0x5d26, 0x5d27, 0x5d31, 0x5d34, 0x5d39, 0x5d3d, 0x5d3f, 0x5d42, + 0x5d43, 0x5d46, 0x5d48, 0x5d55, 0x5d51, 0x5d59, 0x5d4a, 0x5d5f, + 0x5d60, 0x5d61, 0x5d62, 0x5d64, 0x5d6a, 0x5d6d, 0x5d70, 0x5d79, + 0x5d7a, 0x5d7e, 0x5d7f, 0x5d81, 0x5d83, 0x5d88, 0x5d8a, 0x5d92, + 0x5d93, 0x5d94, 0x5d95, 0x5d99, 0x5d9b, 0x5d9f, 0x5da0, 0x5da7, + 0x5dab, 0x5db0, 0x5db4, 0x5db8, 0x5db9, 0x5dc3, 0x5dc7, 0x5dcb, + 0x5dd0, 0x5dce, 0x5dd8, 0x5dd9, 0x5de0, 0x5de4, + /* 0x3c */ + 0x5de9, 0x5df8, 0x5df9, 0x5e00, 0x5e07, 0x5e0d, 0x5e12, 0x5e14, + 0x5e15, 0x5e18, 0x5e1f, 0x5e20, 0x5e2e, 0x5e28, 0x5e32, 0x5e35, + 0x5e3e, 0x5e4b, 0x5e50, 0x5e49, 0x5e51, 0x5e56, 0x5e58, 0x5e5b, + 0x5e5c, 0x5e5e, 0x5e68, 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, + 0x5e70, 0x5e80, 0x5e8b, 0x5e8e, 0x5ea2, 0x5ea4, 0x5ea5, 0x5ea8, + 0x5eaa, 0x5eac, 0x5eb1, 0x5eb3, 0x5ebd, 0x5ebe, 0x5ebf, 0x5ec6, + 0x5ecc, 0x5ecb, 0x5ece, 0x5ed1, 0x5ed2, 0x5ed4, 0x5ed5, 0x5edc, + 0x5ede, 0x5ee5, 0x5eeb, 0x5f02, 0x5f06, 0x5f07, 0x5f08, 0x5f0e, + 0x5f19, 0x5f1c, 0x5f1d, 0x5f21, 0x5f22, 0x5f23, 0x5f24, 0x5f28, + 0x5f2b, 0x5f2c, 0x5f2e, 0x5f30, 0x5f34, 0x5f36, 0x5f3b, 0x5f3d, + 0x5f3f, 0x5f40, 0x5f44, 0x5f45, 0x5f47, 0x5f4d, 0x5f50, 0x5f54, + 0x5f58, 0x5f5b, 0x5f60, 0x5f63, 0x5f64, 0x5f67, + /* 0x3d */ + 0x5f6f, 0x5f72, 0x5f74, 0x5f75, 0x5f78, 0x5f7a, 0x5f7d, 0x5f7e, + 0x5f89, 0x5f8d, 0x5f8f, 0x5f96, 0x5f9c, 0x5f9d, 0x5fa2, 0x5fa7, + 0x5fab, 0x5fa4, 0x5fac, 0x5faf, 0x5fb0, 0x5fb1, 0x5fb8, 0x5fc4, + 0x5fc7, 0x5fc8, 0x5fc9, 0x5fcb, 0x5fd0, 0x5fd1, 0x5fd2, 0x5fd3, + 0x5fd4, 0x5fde, 0x5fe1, 0x5fe2, 0x5fe8, 0x5fe9, 0x5fea, 0x5fec, + 0x5fed, 0x5fee, 0x5fef, 0x5ff2, 0x5ff3, 0x5ff6, 0x5ffa, 0x5ffc, + 0x6007, 0x600a, 0x600d, 0x6013, 0x6014, 0x6017, 0x6018, 0x601a, + 0x601f, 0x6024, 0x602d, 0x6033, 0x6035, 0x6040, 0x6047, 0x6048, + 0x6049, 0x604c, 0x6051, 0x6054, 0x6056, 0x6057, 0x605d, 0x6061, + 0x6067, 0x6071, 0x607e, 0x607f, 0x6082, 0x6086, 0x6088, 0x608a, + 0x608e, 0x6091, 0x6093, 0x6095, 0x6098, 0x609d, 0x609e, 0x60a2, + 0x60a4, 0x60a5, 0x60a8, 0x60b0, 0x60b1, 0x60b7, + /* 0x3e */ + 0x60bb, 0x60be, 0x60c2, 0x60c4, 0x60c8, 0x60c9, 0x60ca, 0x60cb, + 0x60ce, 0x60cf, 0x60d4, 0x60d5, 0x60d9, 0x60db, 0x60dd, 0x60de, + 0x60e2, 0x60e5, 0x60f2, 0x60f5, 0x60f8, 0x60fc, 0x60fd, 0x6102, + 0x6107, 0x610a, 0x610c, 0x6110, 0x6111, 0x6112, 0x6113, 0x6114, + 0x6116, 0x6117, 0x6119, 0x611c, 0x611e, 0x6122, 0x612a, 0x612b, + 0x6130, 0x6131, 0x6135, 0x6136, 0x6137, 0x6139, 0x6141, 0x6145, + 0x6146, 0x6149, 0x615e, 0x6160, 0x616c, 0x6172, 0x6178, 0x617b, + 0x617c, 0x617f, 0x6180, 0x6181, 0x6183, 0x6184, 0x618b, 0x618d, + 0x6192, 0x6193, 0x6197, 0x6198, 0x619c, 0x619d, 0x619f, 0x61a0, + 0x61a5, 0x61a8, 0x61aa, 0x61ad, 0x61b8, 0x61b9, 0x61bc, 0x61c0, + 0x61c1, 0x61c2, 0x61ce, 0x61cf, 0x61d5, 0x61dc, 0x61dd, 0x61de, + 0x61df, 0x61e1, 0x61e2, 0x61e7, 0x61e9, 0x61e5, + /* 0x3f */ + 0x61ec, 0x61ed, 0x61ef, 0x6201, 0x6203, 0x6204, 0x6207, 0x6213, + 0x6215, 0x621c, 0x6220, 0x6222, 0x6223, 0x6227, 0x6229, 0x622b, + 0x6239, 0x623d, 0x6242, 0x6243, 0x6244, 0x6246, 0x624c, 0x6250, + 0x6251, 0x6252, 0x6254, 0x6256, 0x625a, 0x625c, 0x6264, 0x626d, + 0x626f, 0x6273, 0x627a, 0x627d, 0x628d, 0x628e, 0x628f, 0x6290, + 0x62a6, 0x62a8, 0x62b3, 0x62b6, 0x62b7, 0x62ba, 0x62be, 0x62bf, + 0x62c4, 0x62ce, 0x62d5, 0x62d6, 0x62da, 0x62ea, 0x62f2, 0x62f4, + 0x62fc, 0x62fd, 0x6303, 0x6304, 0x630a, 0x630b, 0x630d, 0x6310, + 0x6313, 0x6316, 0x6318, 0x6329, 0x632a, 0x632d, 0x6335, 0x6336, + 0x6339, 0x633c, 0x6341, 0x6342, 0x6343, 0x6344, 0x6346, 0x634a, + 0x634b, 0x634e, 0x6352, 0x6353, 0x6354, 0x6358, 0x635b, 0x6365, + 0x6366, 0x636c, 0x636d, 0x6371, 0x6374, 0x6375, + /* 0x40 */ + 0x6378, 0x637c, 0x637d, 0x637f, 0x6382, 0x6384, 0x6387, 0x638a, + 0x6390, 0x6394, 0x6395, 0x6399, 0x639a, 0x639e, 0x63a4, 0x63a6, + 0x63ad, 0x63ae, 0x63af, 0x63bd, 0x63c1, 0x63c5, 0x63c8, 0x63ce, + 0x63d1, 0x63d3, 0x63d4, 0x63d5, 0x63dc, 0x63e0, 0x63e5, 0x63ea, + 0x63ec, 0x63f2, 0x63f3, 0x63f5, 0x63f8, 0x63f9, 0x6409, 0x640a, + 0x6410, 0x6412, 0x6414, 0x6418, 0x641e, 0x6420, 0x6422, 0x6424, + 0x6425, 0x6429, 0x642a, 0x642f, 0x6430, 0x6435, 0x643d, 0x643f, + 0x644b, 0x644f, 0x6451, 0x6452, 0x6453, 0x6454, 0x645a, 0x645b, + 0x645c, 0x645d, 0x645f, 0x6460, 0x6461, 0x6463, 0x646d, 0x6473, + 0x6474, 0x647b, 0x647d, 0x6485, 0x6487, 0x648f, 0x6490, 0x6491, + 0x6498, 0x6499, 0x649b, 0x649d, 0x649f, 0x64a1, 0x64a3, 0x64a6, + 0x64a8, 0x64ac, 0x64b3, 0x64bd, 0x64be, 0x64bf, + /* 0x41 */ + 0x64c4, 0x64c9, 0x64ca, 0x64cb, 0x64cc, 0x64ce, 0x64d0, 0x64d1, + 0x64d5, 0x64d7, 0x64e4, 0x64e5, 0x64e9, 0x64ea, 0x64ed, 0x64f0, + 0x64f5, 0x64f7, 0x64fb, 0x64ff, 0x6501, 0x6504, 0x6508, 0x6509, + 0x650a, 0x650f, 0x6513, 0x6514, 0x6516, 0x6519, 0x651b, 0x651e, + 0x651f, 0x6522, 0x6526, 0x6529, 0x652e, 0x6531, 0x653a, 0x653c, + 0x653d, 0x6543, 0x6547, 0x6549, 0x6550, 0x6552, 0x6554, 0x655f, + 0x6560, 0x6567, 0x656b, 0x657a, 0x657d, 0x6581, 0x6585, 0x658a, + 0x6592, 0x6595, 0x6598, 0x659d, 0x65a0, 0x65a3, 0x65a6, 0x65ae, + 0x65b2, 0x65b3, 0x65b4, 0x65bf, 0x65c2, 0x65c8, 0x65c9, 0x65ce, + 0x65d0, 0x65d4, 0x65d6, 0x65d8, 0x65df, 0x65f0, 0x65f2, 0x65f4, + 0x65f5, 0x65f9, 0x65fe, 0x65ff, 0x6600, 0x6604, 0x6608, 0x6609, + 0x660d, 0x6611, 0x6612, 0x6615, 0x6616, 0x661d, + /* 0x42 */ + 0x661e, 0x6621, 0x6622, 0x6623, 0x6624, 0x6626, 0x6629, 0x662a, + 0x662b, 0x662c, 0x662e, 0x6630, 0x6631, 0x6633, 0x6639, 0x6637, + 0x6640, 0x6645, 0x6646, 0x664a, 0x664c, 0x6651, 0x664e, 0x6657, + 0x6658, 0x6659, 0x665b, 0x665c, 0x6660, 0x6661, 0x66fb, 0x666a, + 0x666b, 0x666c, 0x667e, 0x6673, 0x6675, 0x667f, 0x6677, 0x6678, + 0x6679, 0x667b, 0x6680, 0x667c, 0x668b, 0x668c, 0x668d, 0x6690, + 0x6692, 0x6699, 0x669a, 0x669b, 0x669c, 0x669f, 0x66a0, 0x66a4, + 0x66ad, 0x66b1, 0x66b2, 0x66b5, 0x66bb, 0x66bf, 0x66c0, 0x66c2, + 0x66c3, 0x66c8, 0x66cc, 0x66ce, 0x66cf, 0x66d4, 0x66db, 0x66df, + 0x66e8, 0x66eb, 0x66ec, 0x66ee, 0x66fa, 0x6705, 0x6707, 0x670e, + 0x6713, 0x6719, 0x671c, 0x6720, 0x6722, 0x6733, 0x673e, 0x6745, + 0x6747, 0x6748, 0x674c, 0x6754, 0x6755, 0x675d, + /* 0x43 */ + 0x6766, 0x676c, 0x676e, 0x6774, 0x6776, 0x677b, 0x6781, 0x6784, + 0x678e, 0x678f, 0x6791, 0x6793, 0x6796, 0x6798, 0x6799, 0x679b, + 0x67b0, 0x67b1, 0x67b2, 0x67b5, 0x67bb, 0x67bc, 0x67bd, 0x67f9, + 0x67c0, 0x67c2, 0x67c3, 0x67c5, 0x67c8, 0x67c9, 0x67d2, 0x67d7, + 0x67d9, 0x67dc, 0x67e1, 0x67e6, 0x67f0, 0x67f2, 0x67f6, 0x67f7, + 0x6852, 0x6814, 0x6819, 0x681d, 0x681f, 0x6828, 0x6827, 0x682c, + 0x682d, 0x682f, 0x6830, 0x6831, 0x6833, 0x683b, 0x683f, 0x6844, + 0x6845, 0x684a, 0x684c, 0x6855, 0x6857, 0x6858, 0x685b, 0x686b, + 0x686e, 0x686f, 0x6870, 0x6871, 0x6872, 0x6875, 0x6879, 0x687a, + 0x687b, 0x687c, 0x6882, 0x6884, 0x6886, 0x6888, 0x6896, 0x6898, + 0x689a, 0x689c, 0x68a1, 0x68a3, 0x68a5, 0x68a9, 0x68aa, 0x68ae, + 0x68b2, 0x68bb, 0x68c5, 0x68c8, 0x68cc, 0x68cf, + /* 0x44 */ + 0x68d0, 0x68d1, 0x68d3, 0x68d6, 0x68d9, 0x68dc, 0x68dd, 0x68e5, + 0x68e8, 0x68ea, 0x68eb, 0x68ec, 0x68ed, 0x68f0, 0x68f1, 0x68f5, + 0x68f6, 0x68fb, 0x68fc, 0x68fd, 0x6906, 0x6909, 0x690a, 0x6910, + 0x6911, 0x6913, 0x6916, 0x6917, 0x6931, 0x6933, 0x6935, 0x6938, + 0x693b, 0x6942, 0x6945, 0x6949, 0x694e, 0x6957, 0x695b, 0x6963, + 0x6964, 0x6965, 0x6966, 0x6968, 0x6969, 0x696c, 0x6970, 0x6971, + 0x6972, 0x697a, 0x697b, 0x697f, 0x6980, 0x698d, 0x6992, 0x6996, + 0x6998, 0x69a1, 0x69a5, 0x69a6, 0x69a8, 0x69ab, 0x69ad, 0x69af, + 0x69b7, 0x69b8, 0x69ba, 0x69bc, 0x69c5, 0x69c8, 0x69d1, 0x69d6, + 0x69d7, 0x69e2, 0x69e5, 0x69ee, 0x69ef, 0x69f1, 0x69f3, 0x69f5, + 0x69fe, 0x6a00, 0x6a01, 0x6a03, 0x6a0f, 0x6a11, 0x6a15, 0x6a1a, + 0x6a1d, 0x6a20, 0x6a24, 0x6a28, 0x6a30, 0x6a32, + /* 0x45 */ + 0x6a34, 0x6a37, 0x6a3b, 0x6a3e, 0x6a3f, 0x6a45, 0x6a46, 0x6a49, + 0x6a4a, 0x6a4e, 0x6a50, 0x6a51, 0x6a52, 0x6a55, 0x6a56, 0x6a5b, + 0x6a64, 0x6a67, 0x6a6a, 0x6a71, 0x6a73, 0x6a7e, 0x6a81, 0x6a83, + 0x6a86, 0x6a87, 0x6a89, 0x6a8b, 0x6a91, 0x6a9b, 0x6a9d, 0x6a9e, + 0x6a9f, 0x6aa5, 0x6aab, 0x6aaf, 0x6ab0, 0x6ab1, 0x6ab4, 0x6abd, + 0x6abe, 0x6abf, 0x6ac6, 0x6ac9, 0x6ac8, 0x6acc, 0x6ad0, 0x6ad4, + 0x6ad5, 0x6ad6, 0x6adc, 0x6add, 0x6ae4, 0x6ae7, 0x6aec, 0x6af0, + 0x6af1, 0x6af2, 0x6afc, 0x6afd, 0x6b02, 0x6b03, 0x6b06, 0x6b07, + 0x6b09, 0x6b0f, 0x6b10, 0x6b11, 0x6b17, 0x6b1b, 0x6b1e, 0x6b24, + 0x6b28, 0x6b2b, 0x6b2c, 0x6b2f, 0x6b35, 0x6b36, 0x6b3b, 0x6b3f, + 0x6b46, 0x6b4a, 0x6b4d, 0x6b52, 0x6b56, 0x6b58, 0x6b5d, 0x6b60, + 0x6b67, 0x6b6b, 0x6b6e, 0x6b70, 0x6b75, 0x6b7d, + /* 0x46 */ + 0x6b7e, 0x6b82, 0x6b85, 0x6b97, 0x6b9b, 0x6b9f, 0x6ba0, 0x6ba2, + 0x6ba3, 0x6ba8, 0x6ba9, 0x6bac, 0x6bad, 0x6bae, 0x6bb0, 0x6bb8, + 0x6bb9, 0x6bbd, 0x6bbe, 0x6bc3, 0x6bc4, 0x6bc9, 0x6bcc, 0x6bd6, + 0x6bda, 0x6be1, 0x6be3, 0x6be6, 0x6be7, 0x6bee, 0x6bf1, 0x6bf7, + 0x6bf9, 0x6bff, 0x6c02, 0x6c04, 0x6c05, 0x6c09, 0x6c0d, 0x6c0e, + 0x6c10, 0x6c12, 0x6c19, 0x6c1f, 0x6c26, 0x6c27, 0x6c28, 0x6c2c, + 0x6c2e, 0x6c33, 0x6c35, 0x6c36, 0x6c3a, 0x6c3b, 0x6c3f, 0x6c4a, + 0x6c4b, 0x6c4d, 0x6c4f, 0x6c52, 0x6c54, 0x6c59, 0x6c5b, 0x6c5c, + 0x6c6b, 0x6c6d, 0x6c6f, 0x6c74, 0x6c76, 0x6c78, 0x6c79, 0x6c7b, + 0x6c85, 0x6c86, 0x6c87, 0x6c89, 0x6c94, 0x6c95, 0x6c97, 0x6c98, + 0x6c9c, 0x6c9f, 0x6cb0, 0x6cb2, 0x6cb4, 0x6cc2, 0x6cc6, 0x6ccd, + 0x6ccf, 0x6cd0, 0x6cd1, 0x6cd2, 0x6cd4, 0x6cd6, + /* 0x47 */ + 0x6cda, 0x6cdc, 0x6ce0, 0x6ce7, 0x6ce9, 0x6ceb, 0x6cec, 0x6cee, + 0x6cf2, 0x6cf4, 0x6d04, 0x6d07, 0x6d0a, 0x6d0e, 0x6d0f, 0x6d11, + 0x6d13, 0x6d1a, 0x6d26, 0x6d27, 0x6d28, 0x6c67, 0x6d2e, 0x6d2f, + 0x6d31, 0x6d39, 0x6d3c, 0x6d3f, 0x6d57, 0x6d5e, 0x6d5f, 0x6d61, + 0x6d65, 0x6d67, 0x6d6f, 0x6d70, 0x6d7c, 0x6d82, 0x6d87, 0x6d91, + 0x6d92, 0x6d94, 0x6d96, 0x6d97, 0x6d98, 0x6daa, 0x6dac, 0x6db4, + 0x6db7, 0x6db9, 0x6dbd, 0x6dbf, 0x6dc4, 0x6dc8, 0x6dca, 0x6dce, + 0x6dcf, 0x6dd6, 0x6ddb, 0x6ddd, 0x6ddf, 0x6de0, 0x6de2, 0x6de5, + 0x6de9, 0x6def, 0x6df0, 0x6df4, 0x6df6, 0x6dfc, 0x6e00, 0x6e04, + 0x6e1e, 0x6e22, 0x6e27, 0x6e32, 0x6e36, 0x6e39, 0x6e3b, 0x6e3c, + 0x6e44, 0x6e45, 0x6e48, 0x6e49, 0x6e4b, 0x6e4f, 0x6e51, 0x6e52, + 0x6e53, 0x6e54, 0x6e57, 0x6e5c, 0x6e5d, 0x6e5e, + /* 0x48 */ + 0x6e62, 0x6e63, 0x6e68, 0x6e73, 0x6e7b, 0x6e7d, 0x6e8d, 0x6e93, + 0x6e99, 0x6ea0, 0x6ea7, 0x6ead, 0x6eae, 0x6eb1, 0x6eb3, 0x6ebb, + 0x6ebf, 0x6ec0, 0x6ec1, 0x6ec3, 0x6ec7, 0x6ec8, 0x6eca, 0x6ecd, + 0x6ece, 0x6ecf, 0x6eeb, 0x6eed, 0x6eee, 0x6ef9, 0x6efb, 0x6efd, + 0x6f04, 0x6f08, 0x6f0a, 0x6f0c, 0x6f0d, 0x6f16, 0x6f18, 0x6f1a, + 0x6f1b, 0x6f26, 0x6f29, 0x6f2a, 0x6f2f, 0x6f30, 0x6f33, 0x6f36, + 0x6f3b, 0x6f3c, 0x6f2d, 0x6f4f, 0x6f51, 0x6f52, 0x6f53, 0x6f57, + 0x6f59, 0x6f5a, 0x6f5d, 0x6f5e, 0x6f61, 0x6f62, 0x6f68, 0x6f6c, + 0x6f7d, 0x6f7e, 0x6f83, 0x6f87, 0x6f88, 0x6f8b, 0x6f8c, 0x6f8d, + 0x6f90, 0x6f92, 0x6f93, 0x6f94, 0x6f96, 0x6f9a, 0x6f9f, 0x6fa0, + 0x6fa5, 0x6fa6, 0x6fa7, 0x6fa8, 0x6fae, 0x6faf, 0x6fb0, 0x6fb5, + 0x6fb6, 0x6fbc, 0x6fc5, 0x6fc7, 0x6fc8, 0x6fca, + /* 0x49 */ + 0x6fda, 0x6fde, 0x6fe8, 0x6fe9, 0x6ff0, 0x6ff5, 0x6ff9, 0x6ffc, + 0x6ffd, 0x7000, 0x7005, 0x7006, 0x7007, 0x700d, 0x7017, 0x7020, + 0x7023, 0x702f, 0x7034, 0x7037, 0x7039, 0x703c, 0x7043, 0x7044, + 0x7048, 0x7049, 0x704a, 0x704b, 0x7054, 0x7055, 0x705d, 0x705e, + 0x704e, 0x7064, 0x7065, 0x706c, 0x706e, 0x7075, 0x7076, 0x707e, + 0x7081, 0x7085, 0x7086, 0x7094, 0x7095, 0x7096, 0x7097, 0x7098, + 0x709b, 0x70a4, 0x70ab, 0x70b0, 0x70b1, 0x70b4, 0x70b7, 0x70ca, + 0x70d1, 0x70d3, 0x70d4, 0x70d5, 0x70d6, 0x70d8, 0x70dc, 0x70e4, + 0x70fa, 0x7103, 0x7104, 0x7105, 0x7106, 0x7107, 0x710b, 0x710c, + 0x710f, 0x711e, 0x7120, 0x712b, 0x712d, 0x712f, 0x7130, 0x7131, + 0x7138, 0x7141, 0x7145, 0x7146, 0x7147, 0x714a, 0x714b, 0x7150, + 0x7152, 0x7157, 0x715a, 0x715c, 0x715e, 0x7160, + /* 0x4a */ + 0x7168, 0x7179, 0x7180, 0x7185, 0x7187, 0x718c, 0x7192, 0x719a, + 0x719b, 0x71a0, 0x71a2, 0x71af, 0x71b0, 0x71b2, 0x71b3, 0x71ba, + 0x71bf, 0x71c0, 0x71c1, 0x71c4, 0x71cb, 0x71cc, 0x71d3, 0x71d6, + 0x71d9, 0x71da, 0x71dc, 0x71f8, 0x71fe, 0x7200, 0x7207, 0x7208, + 0x7209, 0x7213, 0x7217, 0x721a, 0x721d, 0x721f, 0x7224, 0x722b, + 0x722f, 0x7234, 0x7238, 0x7239, 0x7241, 0x7242, 0x7243, 0x7245, + 0x724e, 0x724f, 0x7250, 0x7253, 0x7255, 0x7256, 0x725a, 0x725c, + 0x725e, 0x7260, 0x7263, 0x7268, 0x726b, 0x726e, 0x726f, 0x7271, + 0x7277, 0x7278, 0x727b, 0x727c, 0x727f, 0x7284, 0x7289, 0x728d, + 0x728e, 0x7293, 0x729b, 0x72a8, 0x72ad, 0x72ae, 0x72b1, 0x72b4, + 0x72be, 0x72c1, 0x72c7, 0x72c9, 0x72cc, 0x72d5, 0x72d6, 0x72d8, + 0x72df, 0x72e5, 0x72f3, 0x72f4, 0x72fa, 0x72fb, + /* 0x4b */ + 0x72fe, 0x7302, 0x7304, 0x7305, 0x7307, 0x730b, 0x730d, 0x7312, + 0x7313, 0x7318, 0x7319, 0x731e, 0x7322, 0x7324, 0x7327, 0x7328, + 0x732c, 0x7331, 0x7332, 0x7335, 0x733a, 0x733b, 0x733d, 0x7343, + 0x734d, 0x7350, 0x7352, 0x7356, 0x7358, 0x735d, 0x735e, 0x735f, + 0x7360, 0x7366, 0x7367, 0x7369, 0x736b, 0x736c, 0x736e, 0x736f, + 0x7371, 0x7377, 0x7379, 0x737c, 0x7380, 0x7381, 0x7383, 0x7385, + 0x7386, 0x738e, 0x7390, 0x7393, 0x7395, 0x7397, 0x7398, 0x739c, + 0x739e, 0x739f, 0x73a0, 0x73a2, 0x73a5, 0x73a6, 0x73aa, 0x73ab, + 0x73ad, 0x73b5, 0x73b7, 0x73b9, 0x73bc, 0x73bd, 0x73bf, 0x73c5, + 0x73c6, 0x73c9, 0x73cb, 0x73cc, 0x73cf, 0x73d2, 0x73d3, 0x73d6, + 0x73d9, 0x73dd, 0x73e1, 0x73e3, 0x73e6, 0x73e7, 0x73e9, 0x73f4, + 0x73f5, 0x73f7, 0x73f9, 0x73fa, 0x73fb, 0x73fd, + /* 0x4c */ + 0x73ff, 0x7400, 0x7401, 0x7404, 0x7407, 0x740a, 0x7411, 0x741a, + 0x741b, 0x7424, 0x7426, 0x7428, 0x7429, 0x742a, 0x742b, 0x742c, + 0x742d, 0x742e, 0x742f, 0x7430, 0x7431, 0x7439, 0x7440, 0x7443, + 0x7444, 0x7446, 0x7447, 0x744b, 0x744d, 0x7451, 0x7452, 0x7457, + 0x745d, 0x7462, 0x7466, 0x7467, 0x7468, 0x746b, 0x746d, 0x746e, + 0x7471, 0x7472, 0x7480, 0x7481, 0x7485, 0x7486, 0x7487, 0x7489, + 0x748f, 0x7490, 0x7491, 0x7492, 0x7498, 0x7499, 0x749a, 0x749c, + 0x749f, 0x74a0, 0x74a1, 0x74a3, 0x74a6, 0x74a8, 0x74a9, 0x74aa, + 0x74ab, 0x74ae, 0x74af, 0x74b1, 0x74b2, 0x74b5, 0x74b9, 0x74bb, + 0x74bf, 0x74c8, 0x74c9, 0x74cc, 0x74d0, 0x74d3, 0x74d8, 0x74da, + 0x74db, 0x74de, 0x74df, 0x74e4, 0x74e8, 0x74ea, 0x74eb, 0x74ef, + 0x74f4, 0x74fa, 0x74fb, 0x74fc, 0x74ff, 0x7506, + /* 0x4d */ + 0x7512, 0x7516, 0x7517, 0x7520, 0x7521, 0x7524, 0x7527, 0x7529, + 0x752a, 0x752f, 0x7536, 0x7539, 0x753d, 0x753e, 0x753f, 0x7540, + 0x7543, 0x7547, 0x7548, 0x754e, 0x7550, 0x7552, 0x7557, 0x755e, + 0x755f, 0x7561, 0x756f, 0x7571, 0x7579, 0x757a, 0x757b, 0x757c, + 0x757d, 0x757e, 0x7581, 0x7585, 0x7590, 0x7592, 0x7593, 0x7595, + 0x7599, 0x759c, 0x75a2, 0x75a4, 0x75b4, 0x75ba, 0x75bf, 0x75c0, + 0x75c1, 0x75c4, 0x75c6, 0x75cc, 0x75ce, 0x75cf, 0x75d7, 0x75dc, + 0x75df, 0x75e0, 0x75e1, 0x75e4, 0x75e7, 0x75ec, 0x75ee, 0x75ef, + 0x75f1, 0x75f9, 0x7600, 0x7602, 0x7603, 0x7604, 0x7607, 0x7608, + 0x760a, 0x760c, 0x760f, 0x7612, 0x7613, 0x7615, 0x7616, 0x7619, + 0x761b, 0x761c, 0x761d, 0x761e, 0x7623, 0x7625, 0x7626, 0x7629, + 0x762d, 0x7632, 0x7633, 0x7635, 0x7638, 0x7639, + /* 0x4e */ + 0x763a, 0x763c, 0x764a, 0x7640, 0x7641, 0x7643, 0x7644, 0x7645, + 0x7649, 0x764b, 0x7655, 0x7659, 0x765f, 0x7664, 0x7665, 0x766d, + 0x766e, 0x766f, 0x7671, 0x7674, 0x7681, 0x7685, 0x768c, 0x768d, + 0x7695, 0x769b, 0x769c, 0x769d, 0x769f, 0x76a0, 0x76a2, 0x76a3, + 0x76a4, 0x76a5, 0x76a6, 0x76a7, 0x76a8, 0x76aa, 0x76ad, 0x76bd, + 0x76c1, 0x76c5, 0x76c9, 0x76cb, 0x76cc, 0x76ce, 0x76d4, 0x76d9, + 0x76e0, 0x76e6, 0x76e8, 0x76ec, 0x76f0, 0x76f1, 0x76f6, 0x76f9, + 0x76fc, 0x7700, 0x7706, 0x770a, 0x770e, 0x7712, 0x7714, 0x7715, + 0x7717, 0x7719, 0x771a, 0x771c, 0x7722, 0x7728, 0x772d, 0x772e, + 0x772f, 0x7734, 0x7735, 0x7736, 0x7739, 0x773d, 0x773e, 0x7742, + 0x7745, 0x7746, 0x774a, 0x774d, 0x774e, 0x774f, 0x7752, 0x7756, + 0x7757, 0x775c, 0x775e, 0x775f, 0x7760, 0x7762, + /* 0x4f */ + 0x7764, 0x7767, 0x776a, 0x776c, 0x7770, 0x7772, 0x7773, 0x7774, + 0x777a, 0x777d, 0x7780, 0x7784, 0x778c, 0x778d, 0x7794, 0x7795, + 0x7796, 0x779a, 0x779f, 0x77a2, 0x77a7, 0x77aa, 0x77ae, 0x77af, + 0x77b1, 0x77b5, 0x77be, 0x77c3, 0x77c9, 0x77d1, 0x77d2, 0x77d5, + 0x77d9, 0x77de, 0x77df, 0x77e0, 0x77e4, 0x77e6, 0x77ea, 0x77ec, + 0x77f0, 0x77f1, 0x77f4, 0x77f8, 0x77fb, 0x7805, 0x7806, 0x7809, + 0x780d, 0x780e, 0x7811, 0x781d, 0x7821, 0x7822, 0x7823, 0x782d, + 0x782e, 0x7830, 0x7835, 0x7837, 0x7843, 0x7844, 0x7847, 0x7848, + 0x784c, 0x784e, 0x7852, 0x785c, 0x785e, 0x7860, 0x7861, 0x7863, + 0x7864, 0x7868, 0x786a, 0x786e, 0x787a, 0x787e, 0x788a, 0x788f, + 0x7894, 0x7898, 0x78a1, 0x789d, 0x789e, 0x789f, 0x78a4, 0x78a8, + 0x78ac, 0x78ad, 0x78b0, 0x78b1, 0x78b2, 0x78b3, + /* 0x50 */ + 0x78bb, 0x78bd, 0x78bf, 0x78c7, 0x78c8, 0x78c9, 0x78cc, 0x78ce, + 0x78d2, 0x78d3, 0x78d5, 0x78d6, 0x78e4, 0x78db, 0x78df, 0x78e0, + 0x78e1, 0x78e6, 0x78ea, 0x78f2, 0x78f3, 0x7900, 0x78f6, 0x78f7, + 0x78fa, 0x78fb, 0x78ff, 0x7906, 0x790c, 0x7910, 0x791a, 0x791c, + 0x791e, 0x791f, 0x7920, 0x7925, 0x7927, 0x7929, 0x792d, 0x7931, + 0x7934, 0x7935, 0x793b, 0x793d, 0x793f, 0x7944, 0x7945, 0x7946, + 0x794a, 0x794b, 0x794f, 0x7951, 0x7954, 0x7958, 0x795b, 0x795c, + 0x7967, 0x7969, 0x796b, 0x7972, 0x7979, 0x797b, 0x797c, 0x797e, + 0x798b, 0x798c, 0x7991, 0x7993, 0x7994, 0x7995, 0x7996, 0x7998, + 0x799b, 0x799c, 0x79a1, 0x79a8, 0x79a9, 0x79ab, 0x79af, 0x79b1, + 0x79b4, 0x79b8, 0x79bb, 0x79c2, 0x79c4, 0x79c7, 0x79c8, 0x79ca, + 0x79cf, 0x79d4, 0x79d6, 0x79da, 0x79dd, 0x79de, + /* 0x51 */ + 0x79e0, 0x79e2, 0x79e5, 0x79ea, 0x79eb, 0x79ed, 0x79f1, 0x79f8, + 0x79fc, 0x7a02, 0x7a03, 0x7a07, 0x7a09, 0x7a0a, 0x7a0c, 0x7a11, + 0x7a15, 0x7a1b, 0x7a1e, 0x7a21, 0x7a27, 0x7a2b, 0x7a2d, 0x7a2f, + 0x7a30, 0x7a34, 0x7a35, 0x7a38, 0x7a39, 0x7a3a, 0x7a44, 0x7a45, + 0x7a47, 0x7a48, 0x7a4c, 0x7a55, 0x7a56, 0x7a59, 0x7a5c, 0x7a5d, + 0x7a5f, 0x7a60, 0x7a65, 0x7a67, 0x7a6a, 0x7a6d, 0x7a75, 0x7a78, + 0x7a7e, 0x7a80, 0x7a82, 0x7a85, 0x7a86, 0x7a8a, 0x7a8b, 0x7a90, + 0x7a91, 0x7a94, 0x7a9e, 0x7aa0, 0x7aa3, 0x7aac, 0x7ab3, 0x7ab5, + 0x7ab9, 0x7abb, 0x7abc, 0x7ac6, 0x7ac9, 0x7acc, 0x7ace, 0x7ad1, + 0x7adb, 0x7ae8, 0x7ae9, 0x7aeb, 0x7aec, 0x7af1, 0x7af4, 0x7afb, + 0x7afd, 0x7afe, 0x7b07, 0x7b14, 0x7b1f, 0x7b23, 0x7b27, 0x7b29, + 0x7b2a, 0x7b2b, 0x7b2d, 0x7b2e, 0x7b2f, 0x7b30, + /* 0x52 */ + 0x7b31, 0x7b34, 0x7b3d, 0x7b3f, 0x7b40, 0x7b41, 0x7b47, 0x7b4e, + 0x7b55, 0x7b60, 0x7b64, 0x7b66, 0x7b69, 0x7b6a, 0x7b6d, 0x7b6f, + 0x7b72, 0x7b73, 0x7b77, 0x7b84, 0x7b89, 0x7b8e, 0x7b90, 0x7b91, + 0x7b96, 0x7b9b, 0x7b9e, 0x7ba0, 0x7ba5, 0x7bac, 0x7baf, 0x7bb0, + 0x7bb2, 0x7bb5, 0x7bb6, 0x7bba, 0x7bbb, 0x7bbc, 0x7bbd, 0x7bc2, + 0x7bc5, 0x7bc8, 0x7bca, 0x7bd4, 0x7bd6, 0x7bd7, 0x7bd9, 0x7bda, + 0x7bdb, 0x7be8, 0x7bea, 0x7bf2, 0x7bf4, 0x7bf5, 0x7bf8, 0x7bf9, + 0x7bfa, 0x7bfc, 0x7bfe, 0x7c01, 0x7c02, 0x7c03, 0x7c04, 0x7c06, + 0x7c09, 0x7c0b, 0x7c0c, 0x7c0e, 0x7c0f, 0x7c19, 0x7c1b, 0x7c20, + 0x7c25, 0x7c26, 0x7c28, 0x7c2c, 0x7c31, 0x7c33, 0x7c34, 0x7c36, + 0x7c39, 0x7c3a, 0x7c46, 0x7c4a, 0x7c55, 0x7c51, 0x7c52, 0x7c53, + 0x7c59, 0x7c5a, 0x7c5b, 0x7c5c, 0x7c5d, 0x7c5e, + /* 0x53 */ + 0x7c61, 0x7c63, 0x7c67, 0x7c69, 0x7c6d, 0x7c6e, 0x7c70, 0x7c72, + 0x7c79, 0x7c7c, 0x7c7d, 0x7c86, 0x7c87, 0x7c8f, 0x7c94, 0x7c9e, + 0x7ca0, 0x7ca6, 0x7cb0, 0x7cb6, 0x7cb7, 0x7cba, 0x7cbb, 0x7cbc, + 0x7cbf, 0x7cc4, 0x7cc7, 0x7cc8, 0x7cc9, 0x7ccd, 0x7ccf, 0x7cd3, + 0x7cd4, 0x7cd5, 0x7cd7, 0x7cd9, 0x7cda, 0x7cdd, 0x7ce6, 0x7ce9, + 0x7ceb, 0x7cf5, 0x7d03, 0x7d07, 0x7d08, 0x7d09, 0x7d0f, 0x7d11, + 0x7d12, 0x7d13, 0x7d16, 0x7d1d, 0x7d1e, 0x7d23, 0x7d26, 0x7d2a, + 0x7d2d, 0x7d31, 0x7d3c, 0x7d3d, 0x7d3e, 0x7d40, 0x7d41, 0x7d47, + 0x7d48, 0x7d4d, 0x7d51, 0x7d53, 0x7d57, 0x7d59, 0x7d5a, 0x7d5c, + 0x7d5d, 0x7d65, 0x7d67, 0x7d6a, 0x7d70, 0x7d78, 0x7d7a, 0x7d7b, + 0x7d7f, 0x7d81, 0x7d82, 0x7d83, 0x7d85, 0x7d86, 0x7d88, 0x7d8b, + 0x7d8c, 0x7d8d, 0x7d91, 0x7d96, 0x7d97, 0x7d9d, + /* 0x54 */ + 0x7d9e, 0x7da6, 0x7da7, 0x7daa, 0x7db3, 0x7db6, 0x7db7, 0x7db9, + 0x7dc2, 0x7dc3, 0x7dc4, 0x7dc5, 0x7dc6, 0x7dcc, 0x7dcd, 0x7dce, + 0x7dd7, 0x7dd9, 0x7e00, 0x7de2, 0x7de5, 0x7de6, 0x7dea, 0x7deb, + 0x7ded, 0x7df1, 0x7df5, 0x7df6, 0x7df9, 0x7dfa, 0x7e08, 0x7e10, + 0x7e11, 0x7e15, 0x7e17, 0x7e1c, 0x7e1d, 0x7e20, 0x7e27, 0x7e28, + 0x7e2c, 0x7e2d, 0x7e2f, 0x7e33, 0x7e36, 0x7e3f, 0x7e44, 0x7e45, + 0x7e47, 0x7e4e, 0x7e50, 0x7e52, 0x7e58, 0x7e5f, 0x7e61, 0x7e62, + 0x7e65, 0x7e6b, 0x7e6e, 0x7e6f, 0x7e73, 0x7e78, 0x7e7e, 0x7e81, + 0x7e86, 0x7e87, 0x7e8a, 0x7e8d, 0x7e91, 0x7e95, 0x7e98, 0x7e9a, + 0x7e9d, 0x7e9e, 0x7f3c, 0x7f3b, 0x7f3d, 0x7f3e, 0x7f3f, 0x7f43, + 0x7f44, 0x7f47, 0x7f4f, 0x7f52, 0x7f53, 0x7f5b, 0x7f5c, 0x7f5d, + 0x7f61, 0x7f63, 0x7f64, 0x7f65, 0x7f66, 0x7f6d, + /* 0x55 */ + 0x7f71, 0x7f7d, 0x7f7e, 0x7f7f, 0x7f80, 0x7f8b, 0x7f8d, 0x7f8f, + 0x7f90, 0x7f91, 0x7f96, 0x7f97, 0x7f9c, 0x7fa1, 0x7fa2, 0x7fa6, + 0x7faa, 0x7fad, 0x7fb4, 0x7fbc, 0x7fbf, 0x7fc0, 0x7fc3, 0x7fc8, + 0x7fce, 0x7fcf, 0x7fdb, 0x7fdf, 0x7fe3, 0x7fe5, 0x7fe8, 0x7fec, + 0x7fee, 0x7fef, 0x7ff2, 0x7ffa, 0x7ffd, 0x7ffe, 0x7fff, 0x8007, + 0x8008, 0x800a, 0x800d, 0x800e, 0x800f, 0x8011, 0x8013, 0x8014, + 0x8016, 0x801d, 0x801e, 0x801f, 0x8020, 0x8024, 0x8026, 0x802c, + 0x802e, 0x8030, 0x8034, 0x8035, 0x8037, 0x8039, 0x803a, 0x803c, + 0x803e, 0x8040, 0x8044, 0x8060, 0x8064, 0x8066, 0x806d, 0x8071, + 0x8075, 0x8081, 0x8088, 0x808e, 0x809c, 0x809e, 0x80a6, 0x80a7, + 0x80ab, 0x80b8, 0x80b9, 0x80c8, 0x80cd, 0x80cf, 0x80d2, 0x80d4, + 0x80d5, 0x80d7, 0x80d8, 0x80e0, 0x80ed, 0x80ee, + /* 0x56 */ + 0x80f0, 0x80f2, 0x80f3, 0x80f6, 0x80f9, 0x80fa, 0x80fe, 0x8103, + 0x810b, 0x8116, 0x8117, 0x8118, 0x811c, 0x811e, 0x8120, 0x8124, + 0x8127, 0x812c, 0x8130, 0x8135, 0x813a, 0x813c, 0x8145, 0x8147, + 0x814a, 0x814c, 0x8152, 0x8157, 0x8160, 0x8161, 0x8167, 0x8168, + 0x8169, 0x816d, 0x816f, 0x8177, 0x8181, 0x8190, 0x8184, 0x8185, + 0x8186, 0x818b, 0x818e, 0x8196, 0x8198, 0x819b, 0x819e, 0x81a2, + 0x81ae, 0x81b2, 0x81b4, 0x81bb, 0x81cb, 0x81c3, 0x81c5, 0x81ca, + 0x81ce, 0x81cf, 0x81d5, 0x81d7, 0x81db, 0x81dd, 0x81de, 0x81e1, + 0x81e4, 0x81eb, 0x81ec, 0x81f0, 0x81f1, 0x81f2, 0x81f5, 0x81f6, + 0x81f8, 0x81f9, 0x81fd, 0x81ff, 0x8200, 0x8203, 0x820f, 0x8213, + 0x8214, 0x8219, 0x821a, 0x821d, 0x8221, 0x8222, 0x8228, 0x8232, + 0x8234, 0x823a, 0x8243, 0x8244, 0x8245, 0x8246, + /* 0x57 */ + 0x824b, 0x824e, 0x824f, 0x8251, 0x8256, 0x825c, 0x8260, 0x8263, + 0x8267, 0x826d, 0x8274, 0x827b, 0x827d, 0x827f, 0x8280, 0x8281, + 0x8283, 0x8284, 0x8287, 0x8289, 0x828a, 0x828e, 0x8291, 0x8294, + 0x8296, 0x8298, 0x829a, 0x829b, 0x82a0, 0x82a1, 0x82a3, 0x82a4, + 0x82a7, 0x82a8, 0x82a9, 0x82aa, 0x82ae, 0x82b0, 0x82b2, 0x82b4, + 0x82b7, 0x82ba, 0x82bc, 0x82be, 0x82bf, 0x82c6, 0x82d0, 0x82d5, + 0x82da, 0x82e0, 0x82e2, 0x82e4, 0x82e8, 0x82ea, 0x82ed, 0x82ef, + 0x82f6, 0x82f7, 0x82fd, 0x82fe, 0x8300, 0x8301, 0x8307, 0x8308, + 0x830a, 0x830b, 0x8354, 0x831b, 0x831d, 0x831e, 0x831f, 0x8321, + 0x8322, 0x832c, 0x832d, 0x832e, 0x8330, 0x8333, 0x8337, 0x833a, + 0x833c, 0x833d, 0x8342, 0x8343, 0x8344, 0x8347, 0x834d, 0x834e, + 0x8351, 0x8355, 0x8356, 0x8357, 0x8370, 0x8378, + /* 0x58 */ + 0x837d, 0x837f, 0x8380, 0x8382, 0x8384, 0x8386, 0x838d, 0x8392, + 0x8394, 0x8395, 0x8398, 0x8399, 0x839b, 0x839c, 0x839d, 0x83a6, + 0x83a7, 0x83a9, 0x83ac, 0x83be, 0x83bf, 0x83c0, 0x83c7, 0x83c9, + 0x83cf, 0x83d0, 0x83d1, 0x83d4, 0x83dd, 0x8353, 0x83e8, 0x83ea, + 0x83f6, 0x83f8, 0x83f9, 0x83fc, 0x8401, 0x8406, 0x840a, 0x840f, + 0x8411, 0x8415, 0x8419, 0x83ad, 0x842f, 0x8439, 0x8445, 0x8447, + 0x8448, 0x844a, 0x844d, 0x844f, 0x8451, 0x8452, 0x8456, 0x8458, + 0x8459, 0x845a, 0x845c, 0x8460, 0x8464, 0x8465, 0x8467, 0x846a, + 0x8470, 0x8473, 0x8474, 0x8476, 0x8478, 0x847c, 0x847d, 0x8481, + 0x8485, 0x8492, 0x8493, 0x8495, 0x849e, 0x84a6, 0x84a8, 0x84a9, + 0x84aa, 0x84af, 0x84b1, 0x84b4, 0x84ba, 0x84bd, 0x84be, 0x84c0, + 0x84c2, 0x84c7, 0x84c8, 0x84cc, 0x84cf, 0x84d3, + /* 0x59 */ + 0x84dc, 0x84e7, 0x84ea, 0x84ef, 0x84f0, 0x84f1, 0x84f2, 0x84f7, + 0x8532, 0x84fa, 0x84fb, 0x84fd, 0x8502, 0x8503, 0x8507, 0x850c, + 0x850e, 0x8510, 0x851c, 0x851e, 0x8522, 0x8523, 0x8524, 0x8525, + 0x8527, 0x852a, 0x852b, 0x852f, 0x8533, 0x8534, 0x8536, 0x853f, + 0x8546, 0x854f, 0x8550, 0x8551, 0x8552, 0x8553, 0x8556, 0x8559, + 0x855c, 0x855d, 0x855e, 0x855f, 0x8560, 0x8561, 0x8562, 0x8564, + 0x856b, 0x856f, 0x8579, 0x857a, 0x857b, 0x857d, 0x857f, 0x8581, + 0x8585, 0x8586, 0x8589, 0x858b, 0x858c, 0x858f, 0x8593, 0x8598, + 0x859d, 0x859f, 0x85a0, 0x85a2, 0x85a5, 0x85a7, 0x85b4, 0x85b6, + 0x85b7, 0x85b8, 0x85bc, 0x85bd, 0x85be, 0x85bf, 0x85c2, 0x85c7, + 0x85ca, 0x85cb, 0x85ce, 0x85ad, 0x85d8, 0x85da, 0x85df, 0x85e0, + 0x85e6, 0x85e8, 0x85ed, 0x85f3, 0x85f6, 0x85fc, + /* 0x5a */ + 0x85ff, 0x8600, 0x8604, 0x8605, 0x860d, 0x860e, 0x8610, 0x8611, + 0x8612, 0x8618, 0x8619, 0x861b, 0x861e, 0x8621, 0x8627, 0x8629, + 0x8636, 0x8638, 0x863a, 0x863c, 0x863d, 0x8640, 0x8642, 0x8646, + 0x8652, 0x8653, 0x8656, 0x8657, 0x8658, 0x8659, 0x865d, 0x8660, + 0x8661, 0x8662, 0x8663, 0x8664, 0x8669, 0x866c, 0x866f, 0x8675, + 0x8676, 0x8677, 0x867a, 0x868d, 0x8691, 0x8696, 0x8698, 0x869a, + 0x869c, 0x86a1, 0x86a6, 0x86a7, 0x86a8, 0x86ad, 0x86b1, 0x86b3, + 0x86b4, 0x86b5, 0x86b7, 0x86b8, 0x86b9, 0x86bf, 0x86c0, 0x86c1, + 0x86c3, 0x86c5, 0x86d1, 0x86d2, 0x86d5, 0x86d7, 0x86da, 0x86dc, + 0x86e0, 0x86e3, 0x86e5, 0x86e7, 0x8688, 0x86fa, 0x86fc, 0x86fd, + 0x8704, 0x8705, 0x8707, 0x870b, 0x870e, 0x870f, 0x8710, 0x8713, + 0x8714, 0x8719, 0x871e, 0x871f, 0x8721, 0x8723, + /* 0x5b */ + 0x8728, 0x872e, 0x872f, 0x8731, 0x8732, 0x8739, 0x873a, 0x873c, + 0x873d, 0x873e, 0x8740, 0x8743, 0x8745, 0x874d, 0x8758, 0x875d, + 0x8761, 0x8764, 0x8765, 0x876f, 0x8771, 0x8772, 0x877b, 0x8783, + 0x8784, 0x8785, 0x8786, 0x8787, 0x8788, 0x8789, 0x878b, 0x878c, + 0x8790, 0x8793, 0x8795, 0x8797, 0x8798, 0x8799, 0x879e, 0x87a0, + 0x87a3, 0x87a7, 0x87ac, 0x87ad, 0x87ae, 0x87b1, 0x87b5, 0x87be, + 0x87bf, 0x87c1, 0x87c8, 0x87c9, 0x87ca, 0x87ce, 0x87d5, 0x87d6, + 0x87d9, 0x87da, 0x87dc, 0x87df, 0x87e2, 0x87e3, 0x87e4, 0x87ea, + 0x87eb, 0x87ed, 0x87f1, 0x87f3, 0x87f8, 0x87fa, 0x87ff, 0x8801, + 0x8803, 0x8806, 0x8809, 0x880a, 0x880b, 0x8810, 0x8819, 0x8812, + 0x8813, 0x8814, 0x8818, 0x881a, 0x881b, 0x881c, 0x881e, 0x881f, + 0x8828, 0x882d, 0x882e, 0x8830, 0x8832, 0x8835, + /* 0x5c */ + 0x883a, 0x883c, 0x8841, 0x8843, 0x8845, 0x8848, 0x8849, 0x884a, + 0x884b, 0x884e, 0x8851, 0x8855, 0x8856, 0x8858, 0x885a, 0x885c, + 0x885f, 0x8860, 0x8864, 0x8869, 0x8871, 0x8879, 0x887b, 0x8880, + 0x8898, 0x889a, 0x889b, 0x889c, 0x889f, 0x88a0, 0x88a8, 0x88aa, + 0x88ba, 0x88bd, 0x88be, 0x88c0, 0x88ca, 0x88cb, 0x88cc, 0x88cd, + 0x88ce, 0x88d1, 0x88d2, 0x88d3, 0x88db, 0x88de, 0x88e7, 0x88ef, + 0x88f0, 0x88f1, 0x88f5, 0x88f7, 0x8901, 0x8906, 0x890d, 0x890e, + 0x890f, 0x8915, 0x8916, 0x8918, 0x8919, 0x891a, 0x891c, 0x8920, + 0x8926, 0x8927, 0x8928, 0x8930, 0x8931, 0x8932, 0x8935, 0x8939, + 0x893a, 0x893e, 0x8940, 0x8942, 0x8945, 0x8946, 0x8949, 0x894f, + 0x8952, 0x8957, 0x895a, 0x895b, 0x895c, 0x8961, 0x8962, 0x8963, + 0x896b, 0x896e, 0x8970, 0x8973, 0x8975, 0x897a, + /* 0x5d */ + 0x897b, 0x897c, 0x897d, 0x8989, 0x898d, 0x8990, 0x8994, 0x8995, + 0x899b, 0x899c, 0x899f, 0x89a0, 0x89a5, 0x89b0, 0x89b4, 0x89b5, + 0x89b6, 0x89b7, 0x89bc, 0x89d4, 0x89d5, 0x89d6, 0x89d7, 0x89d8, + 0x89e5, 0x89e9, 0x89eb, 0x89ed, 0x89f1, 0x89f3, 0x89f6, 0x89f9, + 0x89fd, 0x89ff, 0x8a04, 0x8a05, 0x8a07, 0x8a0f, 0x8a11, 0x8a12, + 0x8a14, 0x8a15, 0x8a1e, 0x8a20, 0x8a22, 0x8a24, 0x8a26, 0x8a2b, + 0x8a2c, 0x8a2f, 0x8a35, 0x8a37, 0x8a3d, 0x8a3e, 0x8a40, 0x8a43, + 0x8a45, 0x8a47, 0x8a49, 0x8a4d, 0x8a4e, 0x8a53, 0x8a56, 0x8a57, + 0x8a58, 0x8a5c, 0x8a5d, 0x8a61, 0x8a65, 0x8a67, 0x8a75, 0x8a76, + 0x8a77, 0x8a79, 0x8a7a, 0x8a7b, 0x8a7e, 0x8a7f, 0x8a80, 0x8a83, + 0x8a86, 0x8a8b, 0x8a8f, 0x8a90, 0x8a92, 0x8a96, 0x8a97, 0x8a99, + 0x8a9f, 0x8aa7, 0x8aa9, 0x8aae, 0x8aaf, 0x8ab3, + /* 0x5e */ + 0x8ab6, 0x8ab7, 0x8abb, 0x8abe, 0x8ac3, 0x8ac6, 0x8ac8, 0x8ac9, + 0x8aca, 0x8ad1, 0x8ad3, 0x8ad4, 0x8ad5, 0x8ad7, 0x8add, 0x8adf, + 0x8aec, 0x8af0, 0x8af4, 0x8af5, 0x8af6, 0x8afc, 0x8aff, 0x8b05, + 0x8b06, 0x8b0b, 0x8b11, 0x8b1c, 0x8b1e, 0x8b1f, 0x8b0a, 0x8b2d, + 0x8b30, 0x8b37, 0x8b3c, 0x8b42, 0x8b43, 0x8b44, 0x8b45, 0x8b46, + 0x8b48, 0x8b52, 0x8b53, 0x8b54, 0x8b59, 0x8b4d, 0x8b5e, 0x8b63, + 0x8b6d, 0x8b76, 0x8b78, 0x8b79, 0x8b7c, 0x8b7e, 0x8b81, 0x8b84, + 0x8b85, 0x8b8b, 0x8b8d, 0x8b8f, 0x8b94, 0x8b95, 0x8b9c, 0x8b9e, + 0x8b9f, 0x8c38, 0x8c39, 0x8c3d, 0x8c3e, 0x8c45, 0x8c47, 0x8c49, + 0x8c4b, 0x8c4f, 0x8c51, 0x8c53, 0x8c54, 0x8c57, 0x8c58, 0x8c5b, + 0x8c5d, 0x8c59, 0x8c63, 0x8c64, 0x8c66, 0x8c68, 0x8c69, 0x8c6d, + 0x8c73, 0x8c75, 0x8c76, 0x8c7b, 0x8c7e, 0x8c86, + /* 0x5f */ + 0x8c87, 0x8c8b, 0x8c90, 0x8c92, 0x8c93, 0x8c99, 0x8c9b, 0x8c9c, + 0x8ca4, 0x8cb9, 0x8cba, 0x8cc5, 0x8cc6, 0x8cc9, 0x8ccb, 0x8ccf, + 0x8cd6, 0x8cd5, 0x8cd9, 0x8cdd, 0x8ce1, 0x8ce8, 0x8cec, 0x8cef, + 0x8cf0, 0x8cf2, 0x8cf5, 0x8cf7, 0x8cf8, 0x8cfe, 0x8cff, 0x8d01, + 0x8d03, 0x8d09, 0x8d12, 0x8d17, 0x8d1b, 0x8d65, 0x8d69, 0x8d6c, + 0x8d6e, 0x8d7f, 0x8d82, 0x8d84, 0x8d88, 0x8d8d, 0x8d90, 0x8d91, + 0x8d95, 0x8d9e, 0x8d9f, 0x8da0, 0x8da6, 0x8dab, 0x8dac, 0x8daf, + 0x8db2, 0x8db5, 0x8db7, 0x8db9, 0x8dbb, 0x8dc0, 0x8dc5, 0x8dc6, + 0x8dc7, 0x8dc8, 0x8dca, 0x8dce, 0x8dd1, 0x8dd4, 0x8dd5, 0x8dd7, + 0x8dd9, 0x8de4, 0x8de5, 0x8de7, 0x8dec, 0x8df0, 0x8dbc, 0x8df1, + 0x8df2, 0x8df4, 0x8dfd, 0x8e01, 0x8e04, 0x8e05, 0x8e06, 0x8e0b, + 0x8e11, 0x8e14, 0x8e16, 0x8e20, 0x8e21, 0x8e22, + /* 0x60 */ + 0x8e23, 0x8e26, 0x8e27, 0x8e31, 0x8e33, 0x8e36, 0x8e37, 0x8e38, + 0x8e39, 0x8e3d, 0x8e40, 0x8e41, 0x8e4b, 0x8e4d, 0x8e4e, 0x8e4f, + 0x8e54, 0x8e5b, 0x8e5c, 0x8e5d, 0x8e5e, 0x8e61, 0x8e62, 0x8e69, + 0x8e6c, 0x8e6d, 0x8e6f, 0x8e70, 0x8e71, 0x8e79, 0x8e7a, 0x8e7b, + 0x8e82, 0x8e83, 0x8e89, 0x8e90, 0x8e92, 0x8e95, 0x8e9a, 0x8e9b, + 0x8e9d, 0x8e9e, 0x8ea2, 0x8ea7, 0x8ea9, 0x8ead, 0x8eae, 0x8eb3, + 0x8eb5, 0x8eba, 0x8ebb, 0x8ec0, 0x8ec1, 0x8ec3, 0x8ec4, 0x8ec7, + 0x8ecf, 0x8ed1, 0x8ed4, 0x8edc, 0x8ee8, 0x8eee, 0x8ef0, 0x8ef1, + 0x8ef7, 0x8ef9, 0x8efa, 0x8eed, 0x8f00, 0x8f02, 0x8f07, 0x8f08, + 0x8f0f, 0x8f10, 0x8f16, 0x8f17, 0x8f18, 0x8f1e, 0x8f20, 0x8f21, + 0x8f23, 0x8f25, 0x8f27, 0x8f28, 0x8f2c, 0x8f2d, 0x8f2e, 0x8f34, + 0x8f35, 0x8f36, 0x8f37, 0x8f3a, 0x8f40, 0x8f41, + /* 0x61 */ + 0x8f43, 0x8f47, 0x8f4f, 0x8f51, 0x8f52, 0x8f53, 0x8f54, 0x8f55, + 0x8f58, 0x8f5d, 0x8f5e, 0x8f65, 0x8f9d, 0x8fa0, 0x8fa1, 0x8fa4, + 0x8fa5, 0x8fa6, 0x8fb5, 0x8fb6, 0x8fb8, 0x8fbe, 0x8fc0, 0x8fc1, + 0x8fc6, 0x8fca, 0x8fcb, 0x8fcd, 0x8fd0, 0x8fd2, 0x8fd3, 0x8fd5, + 0x8fe0, 0x8fe3, 0x8fe4, 0x8fe8, 0x8fee, 0x8ff1, 0x8ff5, 0x8ff6, + 0x8ffb, 0x8ffe, 0x9002, 0x9004, 0x9008, 0x900c, 0x9018, 0x901b, + 0x9028, 0x9029, 0x902f, 0x902a, 0x902c, 0x902d, 0x9033, 0x9034, + 0x9037, 0x903f, 0x9043, 0x9044, 0x904c, 0x905b, 0x905d, 0x9062, + 0x9066, 0x9067, 0x906c, 0x9070, 0x9074, 0x9079, 0x9085, 0x9088, + 0x908b, 0x908c, 0x908e, 0x9090, 0x9095, 0x9097, 0x9098, 0x9099, + 0x909b, 0x90a0, 0x90a1, 0x90a2, 0x90a5, 0x90b0, 0x90b2, 0x90b3, + 0x90b4, 0x90b6, 0x90bd, 0x90cc, 0x90be, 0x90c3, + /* 0x62 */ + 0x90c4, 0x90c5, 0x90c7, 0x90c8, 0x90d5, 0x90d7, 0x90d8, 0x90d9, + 0x90dc, 0x90dd, 0x90df, 0x90e5, 0x90d2, 0x90f6, 0x90eb, 0x90ef, + 0x90f0, 0x90f4, 0x90fe, 0x90ff, 0x9100, 0x9104, 0x9105, 0x9106, + 0x9108, 0x910d, 0x9110, 0x9114, 0x9116, 0x9117, 0x9118, 0x911a, + 0x911c, 0x911e, 0x9120, 0x9125, 0x9122, 0x9123, 0x9127, 0x9129, + 0x912e, 0x912f, 0x9131, 0x9134, 0x9136, 0x9137, 0x9139, 0x913a, + 0x913c, 0x913d, 0x9143, 0x9147, 0x9148, 0x914f, 0x9153, 0x9157, + 0x9159, 0x915a, 0x915b, 0x9161, 0x9164, 0x9167, 0x916d, 0x9174, + 0x9179, 0x917a, 0x917b, 0x9181, 0x9183, 0x9185, 0x9186, 0x918a, + 0x918e, 0x9191, 0x9193, 0x9194, 0x9195, 0x9198, 0x919e, 0x91a1, + 0x91a6, 0x91a8, 0x91ac, 0x91ad, 0x91ae, 0x91b0, 0x91b1, 0x91b2, + 0x91b3, 0x91b6, 0x91bb, 0x91bc, 0x91bd, 0x91bf, + /* 0x63 */ + 0x91c2, 0x91c3, 0x91c5, 0x91d3, 0x91d4, 0x91d7, 0x91d9, 0x91da, + 0x91de, 0x91e4, 0x91e5, 0x91e9, 0x91ea, 0x91ec, 0x91ed, 0x91ee, + 0x91ef, 0x91f0, 0x91f1, 0x91f7, 0x91f9, 0x91fb, 0x91fd, 0x9200, + 0x9201, 0x9204, 0x9205, 0x9206, 0x9207, 0x9209, 0x920a, 0x920c, + 0x9210, 0x9212, 0x9213, 0x9216, 0x9218, 0x921c, 0x921d, 0x9223, + 0x9224, 0x9225, 0x9226, 0x9228, 0x922e, 0x922f, 0x9230, 0x9233, + 0x9235, 0x9236, 0x9238, 0x9239, 0x923a, 0x923c, 0x923e, 0x9240, + 0x9242, 0x9243, 0x9246, 0x9247, 0x924a, 0x924d, 0x924e, 0x924f, + 0x9251, 0x9258, 0x9259, 0x925c, 0x925d, 0x9260, 0x9261, 0x9265, + 0x9267, 0x9268, 0x9269, 0x926e, 0x926f, 0x9270, 0x9275, 0x9276, + 0x9277, 0x9278, 0x9279, 0x927b, 0x927c, 0x927d, 0x927f, 0x9288, + 0x9289, 0x928a, 0x928d, 0x928e, 0x9292, 0x9297, + /* 0x64 */ + 0x9299, 0x929f, 0x92a0, 0x92a4, 0x92a5, 0x92a7, 0x92a8, 0x92ab, + 0x92af, 0x92b2, 0x92b6, 0x92b8, 0x92ba, 0x92bb, 0x92bc, 0x92bd, + 0x92bf, 0x92c0, 0x92c1, 0x92c2, 0x92c3, 0x92c5, 0x92c6, 0x92c7, + 0x92c8, 0x92cb, 0x92cc, 0x92cd, 0x92ce, 0x92d0, 0x92d3, 0x92d5, + 0x92d7, 0x92d8, 0x92d9, 0x92dc, 0x92dd, 0x92df, 0x92e0, 0x92e1, + 0x92e3, 0x92e5, 0x92e7, 0x92e8, 0x92ec, 0x92ee, 0x92f0, 0x92f9, + 0x92fb, 0x92ff, 0x9300, 0x9302, 0x9308, 0x930d, 0x9311, 0x9314, + 0x9315, 0x931c, 0x931d, 0x931e, 0x931f, 0x9321, 0x9324, 0x9325, + 0x9327, 0x9329, 0x932a, 0x9333, 0x9334, 0x9336, 0x9337, 0x9347, + 0x9348, 0x9349, 0x9350, 0x9351, 0x9352, 0x9355, 0x9357, 0x9358, + 0x935a, 0x935e, 0x9364, 0x9365, 0x9367, 0x9369, 0x936a, 0x936d, + 0x936f, 0x9370, 0x9371, 0x9373, 0x9374, 0x9376, + /* 0x65 */ + 0x937a, 0x937d, 0x937f, 0x9380, 0x9381, 0x9382, 0x9388, 0x938a, + 0x938b, 0x938d, 0x938f, 0x9392, 0x9395, 0x9398, 0x939b, 0x939e, + 0x93a1, 0x93a3, 0x93a4, 0x93a6, 0x93a8, 0x93ab, 0x93b4, 0x93b5, + 0x93b6, 0x93ba, 0x93a9, 0x93c1, 0x93c4, 0x93c5, 0x93c6, 0x93c7, + 0x93c9, 0x93ca, 0x93cb, 0x93cc, 0x93cd, 0x93d3, 0x93d9, 0x93dc, + 0x93de, 0x93df, 0x93e2, 0x93e6, 0x93e7, 0x93f9, 0x93f7, 0x93f8, + 0x93fa, 0x93fb, 0x93fd, 0x9401, 0x9402, 0x9404, 0x9408, 0x9409, + 0x940d, 0x940e, 0x940f, 0x9415, 0x9416, 0x9417, 0x941f, 0x942e, + 0x942f, 0x9431, 0x9432, 0x9433, 0x9434, 0x943b, 0x943f, 0x943d, + 0x9443, 0x9445, 0x9448, 0x944a, 0x944c, 0x9455, 0x9459, 0x945c, + 0x945f, 0x9461, 0x9463, 0x9468, 0x946b, 0x946d, 0x946e, 0x946f, + 0x9471, 0x9472, 0x9484, 0x9483, 0x9578, 0x9579, + /* 0x66 */ + 0x957e, 0x9584, 0x9588, 0x958c, 0x958d, 0x958e, 0x959d, 0x959e, + 0x959f, 0x95a1, 0x95a6, 0x95a9, 0x95ab, 0x95ac, 0x95b4, 0x95b6, + 0x95ba, 0x95bd, 0x95bf, 0x95c6, 0x95c8, 0x95c9, 0x95cb, 0x95d0, + 0x95d1, 0x95d2, 0x95d3, 0x95d9, 0x95da, 0x95dd, 0x95de, 0x95df, + 0x95e0, 0x95e4, 0x95e6, 0x961d, 0x961e, 0x9622, 0x9624, 0x9625, + 0x9626, 0x962c, 0x9631, 0x9633, 0x9637, 0x9638, 0x9639, 0x963a, + 0x963c, 0x963d, 0x9641, 0x9652, 0x9654, 0x9656, 0x9657, 0x9658, + 0x9661, 0x966e, 0x9674, 0x967b, 0x967c, 0x967e, 0x967f, 0x9681, + 0x9682, 0x9683, 0x9684, 0x9689, 0x9691, 0x9696, 0x969a, 0x969d, + 0x969f, 0x96a4, 0x96a5, 0x96a6, 0x96a9, 0x96ae, 0x96af, 0x96b3, + 0x96ba, 0x96ca, 0x96d2, 0x5db2, 0x96d8, 0x96da, 0x96dd, 0x96de, + 0x96df, 0x96e9, 0x96ef, 0x96f1, 0x96fa, 0x9702, + /* 0x67 */ + 0x9703, 0x9705, 0x9709, 0x971a, 0x971b, 0x971d, 0x9721, 0x9722, + 0x9723, 0x9728, 0x9731, 0x9733, 0x9741, 0x9743, 0x974a, 0x974e, + 0x974f, 0x9755, 0x9757, 0x9758, 0x975a, 0x975b, 0x9763, 0x9767, + 0x976a, 0x976e, 0x9773, 0x9776, 0x9777, 0x9778, 0x977b, 0x977d, + 0x977f, 0x9780, 0x9789, 0x9795, 0x9796, 0x9797, 0x9799, 0x979a, + 0x979e, 0x979f, 0x97a2, 0x97ac, 0x97ae, 0x97b1, 0x97b2, 0x97b5, + 0x97b6, 0x97b8, 0x97b9, 0x97ba, 0x97bc, 0x97be, 0x97bf, 0x97c1, + 0x97c4, 0x97c5, 0x97c7, 0x97c9, 0x97ca, 0x97cc, 0x97cd, 0x97ce, + 0x97d0, 0x97d1, 0x97d4, 0x97d7, 0x97d8, 0x97d9, 0x97dd, 0x97de, + 0x97e0, 0x97db, 0x97e1, 0x97e4, 0x97ef, 0x97f1, 0x97f4, 0x97f7, + 0x97f8, 0x97fa, 0x9807, 0x980a, 0x9819, 0x980d, 0x980e, 0x9814, + 0x9816, 0x981c, 0x981e, 0x9820, 0x9823, 0x9826, + /* 0x68 */ + 0x982b, 0x982e, 0x982f, 0x9830, 0x9832, 0x9833, 0x9835, 0x9825, + 0x983e, 0x9844, 0x9847, 0x984a, 0x9851, 0x9852, 0x9853, 0x9856, + 0x9857, 0x9859, 0x985a, 0x9862, 0x9863, 0x9865, 0x9866, 0x986a, + 0x986c, 0x98ab, 0x98ad, 0x98ae, 0x98b0, 0x98b4, 0x98b7, 0x98b8, + 0x98ba, 0x98bb, 0x98bf, 0x98c2, 0x98c5, 0x98c8, 0x98cc, 0x98e1, + 0x98e3, 0x98e5, 0x98e6, 0x98e7, 0x98ea, 0x98f3, 0x98f6, 0x9902, + 0x9907, 0x9908, 0x9911, 0x9915, 0x9916, 0x9917, 0x991a, 0x991b, + 0x991c, 0x991f, 0x9922, 0x9926, 0x9927, 0x992b, 0x9931, 0x9932, + 0x9933, 0x9934, 0x9935, 0x9939, 0x993a, 0x993b, 0x993c, 0x9940, + 0x9941, 0x9946, 0x9947, 0x9948, 0x994d, 0x994e, 0x9954, 0x9958, + 0x9959, 0x995b, 0x995c, 0x995e, 0x995f, 0x9960, 0x999b, 0x999d, + 0x999f, 0x99a6, 0x99b0, 0x99b1, 0x99b2, 0x99b5, + /* 0x69 */ + 0x99b9, 0x99ba, 0x99bd, 0x99bf, 0x99c3, 0x99c9, 0x99d3, 0x99d4, + 0x99d9, 0x99da, 0x99dc, 0x99de, 0x99e7, 0x99ea, 0x99eb, 0x99ec, + 0x99f0, 0x99f4, 0x99f5, 0x99f9, 0x99fd, 0x99fe, 0x9a02, 0x9a03, + 0x9a04, 0x9a0b, 0x9a0c, 0x9a10, 0x9a11, 0x9a16, 0x9a1e, 0x9a20, + 0x9a22, 0x9a23, 0x9a24, 0x9a27, 0x9a2d, 0x9a2e, 0x9a33, 0x9a35, + 0x9a36, 0x9a38, 0x9a47, 0x9a41, 0x9a44, 0x9a4a, 0x9a4b, 0x9a4c, + 0x9a4e, 0x9a51, 0x9a54, 0x9a56, 0x9a5d, 0x9aaa, 0x9aac, 0x9aae, + 0x9aaf, 0x9ab2, 0x9ab4, 0x9ab5, 0x9ab6, 0x9ab9, 0x9abb, 0x9abe, + 0x9abf, 0x9ac1, 0x9ac3, 0x9ac6, 0x9ac8, 0x9ace, 0x9ad0, 0x9ad2, + 0x9ad5, 0x9ad6, 0x9ad7, 0x9adb, 0x9adc, 0x9ae0, 0x9ae4, 0x9ae5, + 0x9ae7, 0x9ae9, 0x9aec, 0x9af2, 0x9af3, 0x9af5, 0x9af9, 0x9afa, + 0x9afd, 0x9aff, 0x9b00, 0x9b01, 0x9b02, 0x9b03, + /* 0x6a */ + 0x9b04, 0x9b05, 0x9b08, 0x9b09, 0x9b0b, 0x9b0c, 0x9b0d, 0x9b0e, + 0x9b10, 0x9b12, 0x9b16, 0x9b19, 0x9b1b, 0x9b1c, 0x9b20, 0x9b26, + 0x9b2b, 0x9b2d, 0x9b33, 0x9b34, 0x9b35, 0x9b37, 0x9b39, 0x9b3a, + 0x9b3d, 0x9b48, 0x9b4b, 0x9b4c, 0x9b55, 0x9b56, 0x9b57, 0x9b5b, + 0x9b5e, 0x9b61, 0x9b63, 0x9b65, 0x9b66, 0x9b68, 0x9b6a, 0x9b6b, + 0x9b6c, 0x9b6d, 0x9b6e, 0x9b73, 0x9b75, 0x9b77, 0x9b78, 0x9b79, + 0x9b7f, 0x9b80, 0x9b84, 0x9b85, 0x9b86, 0x9b87, 0x9b89, 0x9b8a, + 0x9b8b, 0x9b8d, 0x9b8f, 0x9b90, 0x9b94, 0x9b9a, 0x9b9d, 0x9b9e, + 0x9ba6, 0x9ba7, 0x9ba9, 0x9bac, 0x9bb0, 0x9bb1, 0x9bb2, 0x9bb7, + 0x9bb8, 0x9bbb, 0x9bbc, 0x9bbe, 0x9bbf, 0x9bc1, 0x9bc7, 0x9bc8, + 0x9bce, 0x9bd0, 0x9bd7, 0x9bd8, 0x9bdd, 0x9bdf, 0x9be5, 0x9be7, + 0x9bea, 0x9beb, 0x9bef, 0x9bf3, 0x9bf7, 0x9bf8, + /* 0x6b */ + 0x9bf9, 0x9bfa, 0x9bfd, 0x9bff, 0x9c00, 0x9c02, 0x9c0b, 0x9c0f, + 0x9c11, 0x9c16, 0x9c18, 0x9c19, 0x9c1a, 0x9c1c, 0x9c1e, 0x9c22, + 0x9c23, 0x9c26, 0x9c27, 0x9c28, 0x9c29, 0x9c2a, 0x9c31, 0x9c35, + 0x9c36, 0x9c37, 0x9c3d, 0x9c41, 0x9c43, 0x9c44, 0x9c45, 0x9c49, + 0x9c4a, 0x9c4e, 0x9c4f, 0x9c50, 0x9c53, 0x9c54, 0x9c56, 0x9c58, + 0x9c5b, 0x9c5d, 0x9c5e, 0x9c5f, 0x9c63, 0x9c69, 0x9c6a, 0x9c5c, + 0x9c6b, 0x9c68, 0x9c6e, 0x9c70, 0x9c72, 0x9c75, 0x9c77, 0x9c7b, + 0x9ce6, 0x9cf2, 0x9cf7, 0x9cf9, 0x9d0b, 0x9d02, 0x9d11, 0x9d17, + 0x9d18, 0x9d1c, 0x9d1d, 0x9d1e, 0x9d2f, 0x9d30, 0x9d32, 0x9d33, + 0x9d34, 0x9d3a, 0x9d3c, 0x9d45, 0x9d3d, 0x9d42, 0x9d43, 0x9d47, + 0x9d4a, 0x9d53, 0x9d54, 0x9d5f, 0x9d63, 0x9d62, 0x9d65, 0x9d69, + 0x9d6a, 0x9d6b, 0x9d70, 0x9d76, 0x9d77, 0x9d7b, + /* 0x6c */ + 0x9d7c, 0x9d7e, 0x9d83, 0x9d84, 0x9d86, 0x9d8a, 0x9d8d, 0x9d8e, + 0x9d92, 0x9d93, 0x9d95, 0x9d96, 0x9d97, 0x9d98, 0x9da1, 0x9daa, + 0x9dac, 0x9dae, 0x9db1, 0x9db5, 0x9db9, 0x9dbc, 0x9dbf, 0x9dc3, + 0x9dc7, 0x9dc9, 0x9dca, 0x9dd4, 0x9dd5, 0x9dd6, 0x9dd7, 0x9dda, + 0x9dde, 0x9ddf, 0x9de0, 0x9de5, 0x9de7, 0x9de9, 0x9deb, 0x9dee, + 0x9df0, 0x9df3, 0x9df4, 0x9dfe, 0x9e0a, 0x9e02, 0x9e07, 0x9e0e, + 0x9e10, 0x9e11, 0x9e12, 0x9e15, 0x9e16, 0x9e19, 0x9e1c, 0x9e1d, + 0x9e7a, 0x9e7b, 0x9e7c, 0x9e80, 0x9e82, 0x9e83, 0x9e84, 0x9e85, + 0x9e87, 0x9e8e, 0x9e8f, 0x9e96, 0x9e98, 0x9e9b, 0x9e9e, 0x9ea4, + 0x9ea8, 0x9eac, 0x9eae, 0x9eaf, 0x9eb0, 0x9eb3, 0x9eb4, 0x9eb5, + 0x9ec6, 0x9ec8, 0x9ecb, 0x9ed5, 0x9edf, 0x9ee4, 0x9ee7, 0x9eec, + 0x9eed, 0x9eee, 0x9ef0, 0x9ef1, 0x9ef2, 0x9ef5, + /* 0x6d */ + 0x9ef8, 0x9eff, 0x9f02, 0x9f03, 0x9f09, 0x9f0f, 0x9f10, 0x9f11, + 0x9f12, 0x9f14, 0x9f16, 0x9f17, 0x9f19, 0x9f1a, 0x9f1b, 0x9f1f, + 0x9f22, 0x9f26, 0x9f2a, 0x9f2b, 0x9f2f, 0x9f31, 0x9f32, 0x9f34, + 0x9f37, 0x9f39, 0x9f3a, 0x9f3c, 0x9f3d, 0x9f3f, 0x9f41, 0x9f43, + 0x9f44, 0x9f45, 0x9f46, 0x9f47, 0x9f53, 0x9f55, 0x9f56, 0x9f57, + 0x9f58, 0x9f5a, 0x9f5d, 0x9f5e, 0x9f68, 0x9f69, 0x9f6d, 0x9f6e, + 0x9f6f, 0x9f70, 0x9f71, 0x9f73, 0x9f75, 0x9f7a, 0x9f7d, 0x9f8f, + 0x9f90, 0x9f91, 0x9f92, 0x9f94, 0x9f96, 0x9f97, 0x9f9e, 0x9fa1, + 0x9fa2, 0x9fa3, 0x9fa5, +}; + +static int +jisx0212_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = (s[0] & 0x7F); + if ((c1 == 0x22) || (c1 >= 0x26 && c1 <= 0x27) || (c1 >= 0x29 && c1 <= 0x2b) || (c1 >= 0x30 && c1 <= 0x6d)) { + if (n >= 2) { + unsigned char c2 = (s[1] & 0x7F); + if (c2 >= 0x21 && c2 < 0x7f) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + unsigned short wc = 0xfffd; + if (i < 470) { + if (i < 175) + wc = jisx0212_2uni_page22[i-94]; + } else if (i < 752) { + if (i < 658) + wc = jisx0212_2uni_page26[i-470]; + } else if (i < 1410) { + if (i < 1027) + wc = jisx0212_2uni_page29[i-752]; + } else { + if (i < 7211) + wc = jisx0212_2uni_page30[i-1410]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short jisx0212_2charset[6067] = { + 0x2237, 0x2242, 0x2270, 0x2243, 0x226d, 0x226c, 0x226e, 0x2234, + 0x2231, 0x226b, 0x2244, 0x2a22, 0x2a21, 0x2a24, 0x2a2a, 0x2a23, + 0x2a29, 0x2921, 0x2a2e, 0x2a32, 0x2a31, 0x2a34, 0x2a33, 0x2a40, + 0x2a3f, 0x2a42, 0x2a41, 0x2a50, 0x2a52, 0x2a51, 0x2a54, 0x2a58, + 0x2a53, 0x292c, 0x2a63, 0x2a62, 0x2a65, 0x2a64, 0x2a72, 0x2930, + 0x294e, 0x2b22, 0x2b21, 0x2b24, 0x2b2a, 0x2b23, 0x2b29, 0x2941, + 0x2b2e, 0x2b32, 0x2b31, 0x2b34, 0x2b33, 0x2b40, 0x2b3f, 0x2b42, + 0x2b41, 0x2943, 0x2b50, 0x2b52, 0x2b51, 0x2b54, 0x2b58, 0x2b53, + 0x294c, 0x2b63, 0x2b62, 0x2b65, 0x2b64, 0x2b72, 0x2950, 0x2b73, + 0x2a27, 0x2b27, 0x2a25, 0x2b25, 0x2a28, 0x2b28, 0x2a2b, 0x2b2b, + 0x2a2c, 0x2b2c, 0x2a2f, 0x2b2f, 0x2a2d, 0x2b2d, 0x2a30, 0x2b30, + 0x2922, 0x2942, 0x2a37, 0x2b37, 0x2a36, 0x2b36, 0x2a38, 0x2b38, + 0x2a35, 0x2b35, 0x2a3a, 0x2b3a, 0x2a3b, 0x2b3b, 0x2a3d, 0x2b3d, + 0x2a3c, 0x2a3e, 0x2b3e, 0x2924, 0x2944, 0x2a47, 0x2b47, 0x2a45, + 0x2b45, 0x2a46, 0x2b46, 0x2a44, 0x2945, 0x2926, 0x2946, 0x2a48, + 0x2b48, 0x2a49, 0x2b49, 0x2947, 0x2a4a, 0x2b4a, 0x2a4c, 0x2b4c, + 0x2a4b, 0x2b4b, 0x2929, 0x2949, 0x2928, 0x2948, 0x2a4d, 0x2b4d, + 0x2a4f, 0x2b4f, 0x2a4e, 0x2b4e, 0x294a, 0x292b, 0x294b, 0x2a57, + 0x2b57, 0x2a56, 0x2b56, 0x292d, 0x294d, 0x2a59, 0x2b59, 0x2a5b, + 0x2b5b, 0x2a5a, 0x2b5a, 0x2a5c, 0x2b5c, 0x2a5d, 0x2b5d, 0x2a5f, + 0x2b5f, 0x2a5e, 0x2b5e, 0x2a61, 0x2b61, 0x2a60, 0x2b60, 0x292f, + 0x294f, 0x2a6c, 0x2b6c, 0x2a69, 0x2b69, 0x2a66, 0x2b66, 0x2a6b, + 0x2b6b, 0x2a68, 0x2b68, 0x2a6a, 0x2b6a, 0x2a71, 0x2b71, 0x2a74, + 0x2b74, 0x2a73, 0x2a75, 0x2b75, 0x2a77, 0x2b77, 0x2a76, 0x2b76, + 0x2a26, 0x2b26, 0x2a43, 0x2b43, 0x2a55, 0x2b55, 0x2a67, 0x2b67, + 0x2a70, 0x2b70, 0x2a6d, 0x2b6d, 0x2a6f, 0x2b6f, 0x2a6e, 0x2b6e, + 0x2b39, 0x2230, 0x222f, 0x2232, 0x2236, 0x2235, 0x2233, 0x2238, + 0x2239, 0x2661, 0x2662, 0x2663, 0x2664, 0x2667, 0x2669, 0x266c, + 0x2676, 0x2665, 0x266a, 0x2671, 0x2672, 0x2673, 0x2674, 0x267b, + 0x2678, 0x2675, 0x267a, 0x2677, 0x2679, 0x267c, 0x2742, 0x2743, + 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x2749, 0x274a, 0x274b, + 0x274c, 0x274d, 0x274e, 0x2772, 0x2773, 0x2774, 0x2775, 0x2776, + 0x2777, 0x2778, 0x2779, 0x277a, 0x277b, 0x277c, 0x277d, 0x277e, + 0x2271, 0x226f, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, + 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, + 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, + 0x3037, 0x3038, 0x3039, 0x303a, 0x303b, 0x303c, 0x303d, 0x303e, + 0x303f, 0x3040, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, + 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, + 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, + 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, + 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, + 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, + 0x3070, 0x305f, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, + 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, + 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, + 0x3129, 0x312a, 0x312b, 0x312c, 0x312d, 0x312e, 0x312f, 0x3130, + 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, + 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, + 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, + 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, + 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, + 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x3176, 0x315f, + 0x3160, 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, + 0x3168, 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, + 0x3170, 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3177, 0x3178, + 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x3221, 0x3222, + 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, + 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, + 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323a, + 0x323b, 0x323c, 0x323d, 0x323e, 0x323f, 0x3240, 0x3241, 0x3242, + 0x3243, 0x3244, 0x3245, 0x3251, 0x3246, 0x3247, 0x3248, 0x3249, + 0x324a, 0x324b, 0x324c, 0x324d, 0x324e, 0x324f, 0x3250, 0x3252, + 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a, + 0x325b, 0x325c, 0x325d, 0x325e, 0x325f, 0x3260, 0x3261, 0x3262, + 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, + 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, + 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, + 0x327b, 0x327c, 0x327d, 0x327e, 0x3321, 0x3322, 0x3323, 0x3324, + 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332a, 0x332b, 0x332c, + 0x332d, 0x332e, 0x332f, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, + 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333a, 0x333b, 0x333c, + 0x333d, 0x333e, 0x333f, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, + 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334a, 0x334b, 0x334c, + 0x334d, 0x334e, 0x334f, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, + 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335a, 0x335b, 0x335c, + 0x335d, 0x335e, 0x335f, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, + 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336a, 0x336b, 0x336c, + 0x336d, 0x336e, 0x336f, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, + 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, + 0x337d, 0x337e, 0x3421, 0x3422, 0x3423, 0x3424, 0x3425, 0x3426, + 0x3427, 0x3428, 0x3429, 0x342a, 0x342b, 0x342c, 0x342d, 0x342e, + 0x342f, 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, + 0x3438, 0x3437, 0x3439, 0x343a, 0x343b, 0x343c, 0x343d, 0x343e, + 0x343f, 0x3440, 0x3441, 0x3442, 0x3443, 0x3444, 0x3445, 0x3446, + 0x3447, 0x3448, 0x3449, 0x344a, 0x344b, 0x344c, 0x344d, 0x344e, + 0x344f, 0x3450, 0x3451, 0x3452, 0x3453, 0x3454, 0x3455, 0x3456, + 0x3457, 0x3458, 0x3459, 0x345a, 0x345b, 0x345c, 0x345d, 0x345e, + 0x345f, 0x3460, 0x3461, 0x3462, 0x3463, 0x3464, 0x3465, 0x3466, + 0x3467, 0x3468, 0x3469, 0x346a, 0x346b, 0x346c, 0x346d, 0x346e, + 0x346f, 0x3470, 0x3471, 0x3472, 0x3473, 0x3474, 0x3475, 0x3476, + 0x3477, 0x3478, 0x3479, 0x347a, 0x347b, 0x347c, 0x347d, 0x347e, + 0x3521, 0x3522, 0x3523, 0x3524, 0x3525, 0x3526, 0x3527, 0x3528, + 0x3529, 0x352a, 0x352b, 0x352c, 0x352d, 0x352e, 0x352f, 0x3530, + 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, + 0x3539, 0x353a, 0x353b, 0x353c, 0x353d, 0x353e, 0x353f, 0x3540, + 0x3541, 0x3542, 0x3543, 0x3544, 0x3545, 0x3546, 0x3547, 0x3548, + 0x3549, 0x354a, 0x354b, 0x354c, 0x354d, 0x354e, 0x354f, 0x3550, + 0x3551, 0x3552, 0x3553, 0x3554, 0x3555, 0x3556, 0x3557, 0x3558, + 0x3559, 0x355a, 0x355b, 0x355c, 0x355d, 0x355e, 0x355f, 0x3560, + 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, + 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, + 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x3576, 0x3577, 0x3578, + 0x3579, 0x357a, 0x357b, 0x357c, 0x357d, 0x357e, 0x3621, 0x3622, + 0x3623, 0x3624, 0x3625, 0x3626, 0x3627, 0x3628, 0x3629, 0x362a, + 0x362b, 0x362c, 0x362d, 0x362e, 0x362f, 0x3630, 0x3631, 0x3632, + 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, 0x363a, + 0x363b, 0x363c, 0x363d, 0x363e, 0x363f, 0x3640, 0x3641, 0x3642, + 0x3643, 0x3644, 0x3645, 0x3646, 0x3647, 0x3648, 0x3649, 0x364a, + 0x364b, 0x364c, 0x364d, 0x364e, 0x364f, 0x3650, 0x3651, 0x3652, + 0x3653, 0x3654, 0x3655, 0x3656, 0x3657, 0x3658, 0x3659, 0x365a, + 0x365b, 0x365c, 0x365d, 0x365e, 0x365f, 0x3660, 0x3661, 0x3662, + 0x3663, 0x3664, 0x3665, 0x3666, 0x3667, 0x3668, 0x3669, 0x366a, + 0x366b, 0x366c, 0x366d, 0x3670, 0x3671, 0x366e, 0x366f, 0x3672, + 0x3673, 0x3674, 0x3675, 0x3676, 0x3677, 0x3678, 0x3679, 0x367a, + 0x367b, 0x367d, 0x367e, 0x367c, 0x3721, 0x3722, 0x3723, 0x3724, + 0x3725, 0x3726, 0x3727, 0x3728, 0x3729, 0x372a, 0x372b, 0x372c, + 0x372d, 0x372e, 0x372f, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, + 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, + 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, + 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, + 0x374d, 0x374e, 0x374f, 0x3750, 0x3751, 0x3752, 0x3753, 0x3754, + 0x3755, 0x3756, 0x3757, 0x3760, 0x3758, 0x3759, 0x375a, 0x375b, + 0x375c, 0x375d, 0x375e, 0x375f, 0x3761, 0x3762, 0x3763, 0x3764, + 0x3765, 0x3766, 0x3767, 0x3768, 0x3769, 0x376a, 0x376b, 0x376c, + 0x376d, 0x377e, 0x376e, 0x376f, 0x3770, 0x3771, 0x3772, 0x3773, + 0x3774, 0x3775, 0x3776, 0x3777, 0x3778, 0x3779, 0x377a, 0x377b, + 0x377c, 0x377d, 0x3821, 0x3822, 0x3823, 0x3824, 0x3825, 0x3826, + 0x3827, 0x3828, 0x3829, 0x382a, 0x382b, 0x382c, 0x382d, 0x382e, + 0x382f, 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, + 0x3837, 0x3838, 0x3839, 0x383a, 0x383b, 0x383c, 0x383d, 0x383e, + 0x383f, 0x3840, 0x3841, 0x3842, 0x3843, 0x3844, 0x3845, 0x3846, + 0x3847, 0x3848, 0x3849, 0x384a, 0x384b, 0x384c, 0x384d, 0x384e, + 0x3850, 0x3851, 0x384f, 0x3852, 0x3853, 0x3854, 0x3855, 0x3856, + 0x3857, 0x3858, 0x3859, 0x385a, 0x385b, 0x385c, 0x385d, 0x385e, + 0x385f, 0x3860, 0x3861, 0x3862, 0x3863, 0x3864, 0x3865, 0x3867, + 0x3868, 0x3869, 0x386a, 0x386b, 0x386c, 0x386d, 0x386e, 0x386f, + 0x3870, 0x3871, 0x3872, 0x3873, 0x3874, 0x3875, 0x3876, 0x3877, + 0x3878, 0x3879, 0x387a, 0x387b, 0x387c, 0x387d, 0x387e, 0x3921, + 0x3922, 0x3923, 0x3924, 0x3925, 0x3926, 0x3927, 0x3928, 0x3929, + 0x392a, 0x392b, 0x392c, 0x392d, 0x392e, 0x392f, 0x3930, 0x3931, + 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, 0x3939, + 0x393a, 0x393b, 0x393c, 0x393d, 0x393e, 0x393f, 0x3940, 0x3941, + 0x3942, 0x3943, 0x3944, 0x3945, 0x3946, 0x3947, 0x3948, 0x3949, + 0x394a, 0x394b, 0x394c, 0x394d, 0x394e, 0x394f, 0x3950, 0x3951, + 0x3952, 0x3953, 0x3954, 0x3955, 0x3956, 0x3957, 0x3958, 0x3959, + 0x395a, 0x395b, 0x395c, 0x395d, 0x395e, 0x395f, 0x3960, 0x3961, + 0x3962, 0x3963, 0x3964, 0x3965, 0x3966, 0x3967, 0x3968, 0x3969, + 0x396a, 0x396b, 0x396c, 0x396d, 0x396e, 0x396f, 0x3970, 0x3971, + 0x3972, 0x3973, 0x3974, 0x3975, 0x3976, 0x3977, 0x3978, 0x3979, + 0x397a, 0x397b, 0x397c, 0x397d, 0x397e, 0x3a21, 0x3a22, 0x3a23, + 0x3a24, 0x3a25, 0x3a26, 0x3a27, 0x3a28, 0x3a29, 0x3a2a, 0x3a2b, + 0x3a2c, 0x3a2d, 0x3a2e, 0x3a2f, 0x3a30, 0x3a31, 0x3a33, 0x3a34, + 0x3a35, 0x3a36, 0x3a37, 0x3a38, 0x3a32, 0x3a39, 0x3a3a, 0x3a3b, + 0x3a3c, 0x3a3d, 0x3a3e, 0x3a3f, 0x3a40, 0x3a41, 0x3a42, 0x3a43, + 0x3a44, 0x3a45, 0x3a46, 0x3a47, 0x3a48, 0x3a49, 0x3a4a, 0x3a4b, + 0x3a4c, 0x3a4d, 0x3a4e, 0x3a4f, 0x3a50, 0x3a51, 0x3a52, 0x3a53, + 0x3a54, 0x3a55, 0x3a56, 0x3a57, 0x3a58, 0x3a59, 0x3a5a, 0x3a5b, + 0x3a5c, 0x3a5d, 0x3a5e, 0x3a5f, 0x3a60, 0x3a61, 0x3a62, 0x3a63, + 0x3a64, 0x3a65, 0x3a66, 0x3a67, 0x3a68, 0x3a69, 0x3a6a, 0x3a6b, + 0x3a6c, 0x3a6d, 0x3a6e, 0x3a6f, 0x3a70, 0x3a71, 0x3a72, 0x3a73, + 0x3a74, 0x3a75, 0x3a76, 0x3a77, 0x3a78, 0x3a79, 0x3a7a, 0x3a7b, + 0x3a7c, 0x3a7d, 0x3a7e, 0x3b21, 0x3b22, 0x3b23, 0x3b24, 0x3b25, + 0x3b26, 0x3b27, 0x3b28, 0x3b29, 0x3b2a, 0x3b2b, 0x3b2c, 0x3b2d, + 0x3b2e, 0x3b2f, 0x3b30, 0x3b31, 0x3b32, 0x3b33, 0x3b34, 0x3b35, + 0x3b36, 0x3b37, 0x3b38, 0x3b39, 0x3b3a, 0x3b3b, 0x3b3d, 0x3b3c, + 0x3b3e, 0x3b3f, 0x3b40, 0x3b41, 0x3b42, 0x3b43, 0x3b44, 0x3b45, + 0x3b47, 0x3b48, 0x3b49, 0x3b4a, 0x3b46, 0x3b4b, 0x3b4c, 0x3b4d, + 0x3b4e, 0x3b4f, 0x3b50, 0x3b51, 0x3b52, 0x3b53, 0x3b57, 0x3b55, + 0x3b54, 0x3b56, 0x3b58, 0x3b59, 0x3b5a, 0x3b5b, 0x3b5c, 0x3b5d, + 0x3b5e, 0x3b5f, 0x3b60, 0x3b61, 0x3b62, 0x3b63, 0x3b64, 0x3b65, + 0x3b66, 0x3b67, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x3b6c, 0x3b6d, + 0x3b6e, 0x3b6f, 0x3b70, 0x3b71, 0x3b72, 0x6674, 0x3b73, 0x3b74, + 0x3b75, 0x3b76, 0x3b77, 0x3b78, 0x3b7a, 0x3b79, 0x3b7b, 0x3b7c, + 0x3b7d, 0x3b7e, 0x3c21, 0x3c22, 0x3c23, 0x3c24, 0x3c25, 0x3c26, + 0x3c27, 0x3c28, 0x3c29, 0x3c2a, 0x3c2b, 0x3c2c, 0x3c2e, 0x3c2d, + 0x3c2f, 0x3c30, 0x3c31, 0x3c34, 0x3c32, 0x3c33, 0x3c35, 0x3c36, + 0x3c37, 0x3c38, 0x3c39, 0x3c3a, 0x3c3b, 0x3c3c, 0x3c3d, 0x3c3e, + 0x3c3f, 0x3c40, 0x3c41, 0x3c42, 0x3c43, 0x3c44, 0x3c45, 0x3c46, + 0x3c47, 0x3c48, 0x3c49, 0x3c4a, 0x3c4b, 0x3c4c, 0x3c4d, 0x3c4e, + 0x3c4f, 0x3c50, 0x3c52, 0x3c51, 0x3c53, 0x3c54, 0x3c55, 0x3c56, + 0x3c57, 0x3c58, 0x3c59, 0x3c5a, 0x3c5b, 0x3c5c, 0x3c5d, 0x3c5e, + 0x3c5f, 0x3c60, 0x3c61, 0x3c62, 0x3c63, 0x3c64, 0x3c65, 0x3c66, + 0x3c67, 0x3c68, 0x3c69, 0x3c6a, 0x3c6b, 0x3c6c, 0x3c6d, 0x3c6e, + 0x3c6f, 0x3c70, 0x3c71, 0x3c72, 0x3c73, 0x3c74, 0x3c75, 0x3c76, + 0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c, 0x3c7d, 0x3c7e, + 0x3d21, 0x3d22, 0x3d23, 0x3d24, 0x3d25, 0x3d26, 0x3d27, 0x3d28, + 0x3d29, 0x3d2a, 0x3d2b, 0x3d2c, 0x3d2d, 0x3d2e, 0x3d2f, 0x3d32, + 0x3d30, 0x3d31, 0x3d33, 0x3d34, 0x3d35, 0x3d36, 0x3d37, 0x3d38, + 0x3d39, 0x3d3a, 0x3d3b, 0x3d3c, 0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, + 0x3d41, 0x3d42, 0x3d43, 0x3d44, 0x3d45, 0x3d46, 0x3d47, 0x3d48, + 0x3d49, 0x3d4a, 0x3d4b, 0x3d4c, 0x3d4d, 0x3d4e, 0x3d4f, 0x3d50, + 0x3d51, 0x3d52, 0x3d53, 0x3d54, 0x3d55, 0x3d56, 0x3d57, 0x3d58, + 0x3d59, 0x3d5a, 0x3d5b, 0x3d5c, 0x3d5d, 0x3d5e, 0x3d5f, 0x3d60, + 0x3d61, 0x3d62, 0x3d63, 0x3d64, 0x3d65, 0x3d66, 0x3d67, 0x3d68, + 0x3d69, 0x3d6a, 0x3d6b, 0x3d6c, 0x3d6d, 0x3d6e, 0x3d6f, 0x3d70, + 0x3d71, 0x3d72, 0x3d73, 0x3d74, 0x3d75, 0x3d76, 0x3d77, 0x3d78, + 0x3d79, 0x3d7a, 0x3d7b, 0x3d7c, 0x3d7d, 0x3d7e, 0x3e21, 0x3e22, + 0x3e23, 0x3e24, 0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x3e29, 0x3e2a, + 0x3e2b, 0x3e2c, 0x3e2d, 0x3e2e, 0x3e2f, 0x3e30, 0x3e31, 0x3e32, + 0x3e33, 0x3e34, 0x3e35, 0x3e36, 0x3e37, 0x3e38, 0x3e39, 0x3e3a, + 0x3e3b, 0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x3e41, 0x3e42, + 0x3e43, 0x3e44, 0x3e45, 0x3e46, 0x3e47, 0x3e48, 0x3e49, 0x3e4a, + 0x3e4b, 0x3e4c, 0x3e4d, 0x3e4e, 0x3e4f, 0x3e50, 0x3e51, 0x3e52, + 0x3e53, 0x3e54, 0x3e55, 0x3e56, 0x3e57, 0x3e58, 0x3e59, 0x3e5a, + 0x3e5b, 0x3e5c, 0x3e5d, 0x3e5e, 0x3e5f, 0x3e60, 0x3e61, 0x3e62, + 0x3e63, 0x3e64, 0x3e65, 0x3e66, 0x3e67, 0x3e68, 0x3e69, 0x3e6a, + 0x3e6b, 0x3e6c, 0x3e6d, 0x3e6e, 0x3e6f, 0x3e70, 0x3e71, 0x3e72, + 0x3e73, 0x3e74, 0x3e75, 0x3e76, 0x3e77, 0x3e78, 0x3e79, 0x3e7a, + 0x3e7b, 0x3e7e, 0x3e7c, 0x3e7d, 0x3f21, 0x3f22, 0x3f23, 0x3f24, + 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, + 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, + 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, + 0x3f3d, 0x3f3e, 0x3f3f, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, + 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, + 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, + 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, + 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, + 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, + 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, + 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, + 0x3f7d, 0x3f7e, 0x4021, 0x4022, 0x4023, 0x4024, 0x4025, 0x4026, + 0x4027, 0x4028, 0x4029, 0x402a, 0x402b, 0x402c, 0x402d, 0x402e, + 0x402f, 0x4030, 0x4031, 0x4032, 0x4033, 0x4034, 0x4035, 0x4036, + 0x4037, 0x4038, 0x4039, 0x403a, 0x403b, 0x403c, 0x403d, 0x403e, + 0x403f, 0x4040, 0x4041, 0x4042, 0x4043, 0x4044, 0x4045, 0x4046, + 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d, 0x404e, + 0x404f, 0x4050, 0x4051, 0x4052, 0x4053, 0x4054, 0x4055, 0x4056, + 0x4057, 0x4058, 0x4059, 0x405a, 0x405b, 0x405c, 0x405d, 0x405e, + 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, + 0x4067, 0x4068, 0x4069, 0x406a, 0x406b, 0x406c, 0x406d, 0x406e, + 0x406f, 0x4070, 0x4071, 0x4072, 0x4073, 0x4074, 0x4075, 0x4076, + 0x4077, 0x4078, 0x4079, 0x407a, 0x407b, 0x407c, 0x407d, 0x407e, + 0x4121, 0x4122, 0x4123, 0x4124, 0x4125, 0x4126, 0x4127, 0x4128, + 0x4129, 0x412a, 0x412b, 0x412c, 0x412d, 0x412e, 0x412f, 0x4130, + 0x4131, 0x4132, 0x4133, 0x4134, 0x4135, 0x4136, 0x4137, 0x4138, + 0x4139, 0x413a, 0x413b, 0x413c, 0x413d, 0x413e, 0x413f, 0x4140, + 0x4141, 0x4142, 0x4143, 0x4144, 0x4145, 0x4146, 0x4147, 0x4148, + 0x4149, 0x414a, 0x414b, 0x414c, 0x414d, 0x414e, 0x414f, 0x4150, + 0x4151, 0x4152, 0x4153, 0x4154, 0x4155, 0x4156, 0x4157, 0x4158, + 0x4159, 0x415a, 0x415b, 0x415c, 0x415d, 0x415e, 0x415f, 0x4160, + 0x4161, 0x4162, 0x4163, 0x4164, 0x4165, 0x4166, 0x4167, 0x4168, + 0x4169, 0x416a, 0x416b, 0x416c, 0x416d, 0x416e, 0x416f, 0x4170, + 0x4171, 0x4172, 0x4173, 0x4174, 0x4175, 0x4176, 0x4177, 0x4178, + 0x4179, 0x417a, 0x417b, 0x417c, 0x417d, 0x417e, 0x4221, 0x4222, + 0x4223, 0x4224, 0x4225, 0x4226, 0x4227, 0x4228, 0x4229, 0x422a, + 0x422b, 0x422c, 0x422d, 0x422e, 0x4230, 0x422f, 0x4231, 0x4232, + 0x4233, 0x4234, 0x4235, 0x4237, 0x4236, 0x4238, 0x4239, 0x423a, + 0x423b, 0x423c, 0x423d, 0x423e, 0x4240, 0x4241, 0x4242, 0x4244, + 0x4245, 0x4247, 0x4248, 0x4249, 0x424a, 0x424c, 0x4243, 0x4246, + 0x424b, 0x424d, 0x424e, 0x424f, 0x4250, 0x4251, 0x4252, 0x4253, + 0x4254, 0x4255, 0x4256, 0x4257, 0x4258, 0x4259, 0x425a, 0x425b, + 0x425c, 0x425d, 0x425e, 0x425f, 0x4260, 0x4261, 0x4262, 0x4263, + 0x4264, 0x4265, 0x4266, 0x4267, 0x4268, 0x4269, 0x426a, 0x426b, + 0x426c, 0x426d, 0x423f, 0x426e, 0x426f, 0x4270, 0x4271, 0x4272, + 0x4273, 0x4274, 0x4275, 0x4276, 0x4277, 0x4278, 0x4279, 0x427a, + 0x427b, 0x427c, 0x427d, 0x427e, 0x4321, 0x4322, 0x4323, 0x4324, + 0x4325, 0x4326, 0x4327, 0x4328, 0x4329, 0x432a, 0x432b, 0x432c, + 0x432d, 0x432e, 0x432f, 0x4330, 0x4331, 0x4332, 0x4333, 0x4334, + 0x4335, 0x4336, 0x4337, 0x4339, 0x433a, 0x433b, 0x433c, 0x433d, + 0x433e, 0x433f, 0x4340, 0x4341, 0x4342, 0x4343, 0x4344, 0x4345, + 0x4346, 0x4347, 0x4348, 0x4338, 0x434a, 0x434b, 0x434c, 0x434d, + 0x434f, 0x434e, 0x4350, 0x4351, 0x4352, 0x4353, 0x4354, 0x4355, + 0x4356, 0x4357, 0x4358, 0x4359, 0x435a, 0x435b, 0x4349, 0x435c, + 0x435d, 0x435e, 0x435f, 0x4360, 0x4361, 0x4362, 0x4363, 0x4364, + 0x4365, 0x4366, 0x4367, 0x4368, 0x4369, 0x436a, 0x436b, 0x436c, + 0x436d, 0x436e, 0x436f, 0x4370, 0x4371, 0x4372, 0x4373, 0x4374, + 0x4375, 0x4376, 0x4377, 0x4378, 0x4379, 0x437a, 0x437b, 0x437c, + 0x437d, 0x437e, 0x4421, 0x4422, 0x4423, 0x4424, 0x4425, 0x4426, + 0x4427, 0x4428, 0x4429, 0x442a, 0x442b, 0x442c, 0x442d, 0x442e, + 0x442f, 0x4430, 0x4431, 0x4432, 0x4433, 0x4434, 0x4435, 0x4436, + 0x4437, 0x4438, 0x4439, 0x443a, 0x443b, 0x443c, 0x443d, 0x443e, + 0x443f, 0x4440, 0x4441, 0x4442, 0x4443, 0x4444, 0x4445, 0x4446, + 0x4447, 0x4448, 0x4449, 0x444a, 0x444b, 0x444c, 0x444d, 0x444e, + 0x444f, 0x4450, 0x4451, 0x4452, 0x4453, 0x4454, 0x4455, 0x4456, + 0x4457, 0x4458, 0x4459, 0x445a, 0x445b, 0x445c, 0x445d, 0x445e, + 0x445f, 0x4460, 0x4461, 0x4462, 0x4463, 0x4464, 0x4465, 0x4466, + 0x4467, 0x4468, 0x4469, 0x446a, 0x446b, 0x446c, 0x446d, 0x446e, + 0x446f, 0x4470, 0x4471, 0x4472, 0x4473, 0x4474, 0x4475, 0x4476, + 0x4477, 0x4478, 0x4479, 0x447a, 0x447b, 0x447c, 0x447d, 0x447e, + 0x4521, 0x4522, 0x4523, 0x4524, 0x4525, 0x4526, 0x4527, 0x4528, + 0x4529, 0x452a, 0x452b, 0x452c, 0x452d, 0x452e, 0x452f, 0x4530, + 0x4531, 0x4532, 0x4533, 0x4534, 0x4535, 0x4536, 0x4537, 0x4538, + 0x4539, 0x453a, 0x453b, 0x453c, 0x453d, 0x453e, 0x453f, 0x4540, + 0x4541, 0x4542, 0x4543, 0x4544, 0x4545, 0x4546, 0x4547, 0x4548, + 0x4549, 0x454a, 0x454b, 0x454d, 0x454c, 0x454e, 0x454f, 0x4550, + 0x4551, 0x4552, 0x4553, 0x4554, 0x4555, 0x4556, 0x4557, 0x4558, + 0x4559, 0x455a, 0x455b, 0x455c, 0x455d, 0x455e, 0x455f, 0x4560, + 0x4561, 0x4562, 0x4563, 0x4564, 0x4565, 0x4566, 0x4567, 0x4568, + 0x4569, 0x456a, 0x456b, 0x456c, 0x456d, 0x456e, 0x456f, 0x4570, + 0x4571, 0x4572, 0x4573, 0x4574, 0x4575, 0x4576, 0x4577, 0x4578, + 0x4579, 0x457a, 0x457b, 0x457c, 0x457d, 0x457e, 0x4621, 0x4622, + 0x4623, 0x4624, 0x4625, 0x4626, 0x4627, 0x4628, 0x4629, 0x462a, + 0x462b, 0x462c, 0x462d, 0x462e, 0x462f, 0x4630, 0x4631, 0x4632, + 0x4633, 0x4634, 0x4635, 0x4636, 0x4637, 0x4638, 0x4639, 0x463a, + 0x463b, 0x463c, 0x463d, 0x463e, 0x463f, 0x4640, 0x4641, 0x4642, + 0x4643, 0x4644, 0x4645, 0x4646, 0x4647, 0x4648, 0x4649, 0x464a, + 0x464b, 0x464c, 0x464d, 0x464e, 0x464f, 0x4650, 0x4651, 0x4652, + 0x4653, 0x4654, 0x4655, 0x4656, 0x4657, 0x4658, 0x4659, 0x465a, + 0x465b, 0x465c, 0x465d, 0x465e, 0x465f, 0x4660, 0x4736, 0x4661, + 0x4662, 0x4663, 0x4664, 0x4665, 0x4666, 0x4667, 0x4668, 0x4669, + 0x466a, 0x466b, 0x466c, 0x466d, 0x466e, 0x466f, 0x4670, 0x4671, + 0x4672, 0x4673, 0x4674, 0x4675, 0x4676, 0x4677, 0x4678, 0x4679, + 0x467a, 0x467b, 0x467c, 0x467d, 0x467e, 0x4721, 0x4722, 0x4723, + 0x4724, 0x4725, 0x4726, 0x4727, 0x4728, 0x4729, 0x472a, 0x472b, + 0x472c, 0x472d, 0x472e, 0x472f, 0x4730, 0x4731, 0x4732, 0x4733, + 0x4734, 0x4735, 0x4737, 0x4738, 0x4739, 0x473a, 0x473b, 0x473c, + 0x473d, 0x473e, 0x473f, 0x4740, 0x4741, 0x4742, 0x4743, 0x4744, + 0x4745, 0x4746, 0x4747, 0x4748, 0x4749, 0x474a, 0x474b, 0x474c, + 0x474d, 0x474e, 0x474f, 0x4750, 0x4751, 0x4752, 0x4753, 0x4754, + 0x4755, 0x4756, 0x4757, 0x4758, 0x4759, 0x475a, 0x475b, 0x475c, + 0x475d, 0x475e, 0x475f, 0x4760, 0x4761, 0x4762, 0x4763, 0x4764, + 0x4765, 0x4766, 0x4767, 0x4768, 0x4769, 0x476a, 0x476b, 0x476c, + 0x476d, 0x476e, 0x476f, 0x4770, 0x4771, 0x4772, 0x4773, 0x4774, + 0x4775, 0x4776, 0x4777, 0x4778, 0x4779, 0x477a, 0x477b, 0x477c, + 0x477d, 0x477e, 0x4821, 0x4822, 0x4823, 0x4824, 0x4825, 0x4826, + 0x4827, 0x4828, 0x4829, 0x482a, 0x482b, 0x482c, 0x482d, 0x482e, + 0x482f, 0x4830, 0x4831, 0x4832, 0x4833, 0x4834, 0x4835, 0x4836, + 0x4837, 0x4838, 0x4839, 0x483a, 0x483b, 0x483c, 0x483d, 0x483e, + 0x483f, 0x4840, 0x4841, 0x4842, 0x4843, 0x4844, 0x4845, 0x4846, + 0x4847, 0x4848, 0x4849, 0x484a, 0x484b, 0x484c, 0x4853, 0x484d, + 0x484e, 0x484f, 0x4850, 0x4851, 0x4852, 0x4854, 0x4855, 0x4856, + 0x4857, 0x4858, 0x4859, 0x485a, 0x485b, 0x485c, 0x485d, 0x485e, + 0x485f, 0x4860, 0x4861, 0x4862, 0x4863, 0x4864, 0x4865, 0x4866, + 0x4867, 0x4868, 0x4869, 0x486a, 0x486b, 0x486c, 0x486d, 0x486e, + 0x486f, 0x4870, 0x4871, 0x4872, 0x4873, 0x4874, 0x4875, 0x4876, + 0x4877, 0x4878, 0x4879, 0x487a, 0x487b, 0x487c, 0x487d, 0x487e, + 0x4921, 0x4922, 0x4923, 0x4924, 0x4925, 0x4926, 0x4927, 0x4928, + 0x4929, 0x492a, 0x492b, 0x492c, 0x492d, 0x492e, 0x492f, 0x4930, + 0x4931, 0x4932, 0x4933, 0x4934, 0x4935, 0x4936, 0x4937, 0x4938, + 0x4939, 0x493a, 0x493b, 0x493c, 0x4941, 0x493d, 0x493e, 0x493f, + 0x4940, 0x4942, 0x4943, 0x4944, 0x4945, 0x4946, 0x4947, 0x4948, + 0x4949, 0x494a, 0x494b, 0x494c, 0x494d, 0x494e, 0x494f, 0x4950, + 0x4951, 0x4952, 0x4953, 0x4954, 0x4955, 0x4956, 0x4957, 0x4958, + 0x4959, 0x495a, 0x495b, 0x495c, 0x495d, 0x495e, 0x495f, 0x4960, + 0x4961, 0x4962, 0x4963, 0x4964, 0x4965, 0x4966, 0x4967, 0x4968, + 0x4969, 0x496a, 0x496b, 0x496c, 0x496d, 0x496e, 0x496f, 0x4970, + 0x4971, 0x4972, 0x4973, 0x4974, 0x4975, 0x4976, 0x4977, 0x4978, + 0x4979, 0x497a, 0x497b, 0x497c, 0x497d, 0x497e, 0x4a21, 0x4a22, + 0x4a23, 0x4a24, 0x4a25, 0x4a26, 0x4a27, 0x4a28, 0x4a29, 0x4a2a, + 0x4a2b, 0x4a2c, 0x4a2d, 0x4a2e, 0x4a2f, 0x4a30, 0x4a31, 0x4a32, + 0x4a33, 0x4a34, 0x4a35, 0x4a36, 0x4a37, 0x4a38, 0x4a39, 0x4a3a, + 0x4a3b, 0x4a3c, 0x4a3d, 0x4a3e, 0x4a3f, 0x4a40, 0x4a41, 0x4a42, + 0x4a43, 0x4a44, 0x4a45, 0x4a46, 0x4a47, 0x4a48, 0x4a49, 0x4a4a, + 0x4a4b, 0x4a4c, 0x4a4d, 0x4a4e, 0x4a4f, 0x4a50, 0x4a51, 0x4a52, + 0x4a53, 0x4a54, 0x4a55, 0x4a56, 0x4a57, 0x4a58, 0x4a59, 0x4a5a, + 0x4a5b, 0x4a5c, 0x4a5d, 0x4a5e, 0x4a5f, 0x4a60, 0x4a61, 0x4a62, + 0x4a63, 0x4a64, 0x4a65, 0x4a66, 0x4a67, 0x4a68, 0x4a69, 0x4a6a, + 0x4a6b, 0x4a6c, 0x4a6d, 0x4a6e, 0x4a6f, 0x4a70, 0x4a71, 0x4a72, + 0x4a73, 0x4a74, 0x4a75, 0x4a76, 0x4a77, 0x4a78, 0x4a79, 0x4a7a, + 0x4a7b, 0x4a7c, 0x4a7d, 0x4a7e, 0x4b21, 0x4b22, 0x4b23, 0x4b24, + 0x4b25, 0x4b26, 0x4b27, 0x4b28, 0x4b29, 0x4b2a, 0x4b2b, 0x4b2c, + 0x4b2d, 0x4b2e, 0x4b2f, 0x4b30, 0x4b31, 0x4b32, 0x4b33, 0x4b34, + 0x4b35, 0x4b36, 0x4b37, 0x4b38, 0x4b39, 0x4b3a, 0x4b3b, 0x4b3c, + 0x4b3d, 0x4b3e, 0x4b3f, 0x4b40, 0x4b41, 0x4b42, 0x4b43, 0x4b44, + 0x4b45, 0x4b46, 0x4b47, 0x4b48, 0x4b49, 0x4b4a, 0x4b4b, 0x4b4c, + 0x4b4d, 0x4b4e, 0x4b4f, 0x4b50, 0x4b51, 0x4b52, 0x4b53, 0x4b54, + 0x4b55, 0x4b56, 0x4b57, 0x4b58, 0x4b59, 0x4b5a, 0x4b5b, 0x4b5c, + 0x4b5d, 0x4b5e, 0x4b5f, 0x4b60, 0x4b61, 0x4b62, 0x4b63, 0x4b64, + 0x4b65, 0x4b66, 0x4b67, 0x4b68, 0x4b69, 0x4b6a, 0x4b6b, 0x4b6c, + 0x4b6d, 0x4b6e, 0x4b6f, 0x4b70, 0x4b71, 0x4b72, 0x4b73, 0x4b74, + 0x4b75, 0x4b76, 0x4b77, 0x4b78, 0x4b79, 0x4b7a, 0x4b7b, 0x4b7c, + 0x4b7d, 0x4b7e, 0x4c21, 0x4c22, 0x4c23, 0x4c24, 0x4c25, 0x4c26, + 0x4c27, 0x4c28, 0x4c29, 0x4c2a, 0x4c2b, 0x4c2c, 0x4c2d, 0x4c2e, + 0x4c2f, 0x4c30, 0x4c31, 0x4c32, 0x4c33, 0x4c34, 0x4c35, 0x4c36, + 0x4c37, 0x4c38, 0x4c39, 0x4c3a, 0x4c3b, 0x4c3c, 0x4c3d, 0x4c3e, + 0x4c3f, 0x4c40, 0x4c41, 0x4c42, 0x4c43, 0x4c44, 0x4c45, 0x4c46, + 0x4c47, 0x4c48, 0x4c49, 0x4c4a, 0x4c4b, 0x4c4c, 0x4c4d, 0x4c4e, + 0x4c4f, 0x4c50, 0x4c51, 0x4c52, 0x4c53, 0x4c54, 0x4c55, 0x4c56, + 0x4c57, 0x4c58, 0x4c59, 0x4c5a, 0x4c5b, 0x4c5c, 0x4c5d, 0x4c5e, + 0x4c5f, 0x4c60, 0x4c61, 0x4c62, 0x4c63, 0x4c64, 0x4c65, 0x4c66, + 0x4c67, 0x4c68, 0x4c69, 0x4c6a, 0x4c6b, 0x4c6c, 0x4c6d, 0x4c6e, + 0x4c6f, 0x4c70, 0x4c71, 0x4c72, 0x4c73, 0x4c74, 0x4c75, 0x4c76, + 0x4c77, 0x4c78, 0x4c79, 0x4c7a, 0x4c7b, 0x4c7c, 0x4c7d, 0x4c7e, + 0x4d21, 0x4d22, 0x4d23, 0x4d24, 0x4d25, 0x4d26, 0x4d27, 0x4d28, + 0x4d29, 0x4d2a, 0x4d2b, 0x4d2c, 0x4d2d, 0x4d2e, 0x4d2f, 0x4d30, + 0x4d31, 0x4d32, 0x4d33, 0x4d34, 0x4d35, 0x4d36, 0x4d37, 0x4d38, + 0x4d39, 0x4d3a, 0x4d3b, 0x4d3c, 0x4d3d, 0x4d3e, 0x4d3f, 0x4d40, + 0x4d41, 0x4d42, 0x4d43, 0x4d44, 0x4d45, 0x4d46, 0x4d47, 0x4d48, + 0x4d49, 0x4d4a, 0x4d4b, 0x4d4c, 0x4d4d, 0x4d4e, 0x4d4f, 0x4d50, + 0x4d51, 0x4d52, 0x4d53, 0x4d54, 0x4d55, 0x4d56, 0x4d57, 0x4d58, + 0x4d59, 0x4d5a, 0x4d5b, 0x4d5c, 0x4d5d, 0x4d5e, 0x4d5f, 0x4d60, + 0x4d61, 0x4d62, 0x4d63, 0x4d64, 0x4d65, 0x4d66, 0x4d67, 0x4d68, + 0x4d69, 0x4d6a, 0x4d6b, 0x4d6c, 0x4d6d, 0x4d6e, 0x4d6f, 0x4d70, + 0x4d71, 0x4d72, 0x4d73, 0x4d74, 0x4d75, 0x4d76, 0x4d77, 0x4d78, + 0x4d79, 0x4d7a, 0x4d7b, 0x4d7c, 0x4d7d, 0x4d7e, 0x4e21, 0x4e22, + 0x4e24, 0x4e25, 0x4e26, 0x4e27, 0x4e28, 0x4e29, 0x4e23, 0x4e2a, + 0x4e2b, 0x4e2c, 0x4e2d, 0x4e2e, 0x4e2f, 0x4e30, 0x4e31, 0x4e32, + 0x4e33, 0x4e34, 0x4e35, 0x4e36, 0x4e37, 0x4e38, 0x4e39, 0x4e3a, + 0x4e3b, 0x4e3c, 0x4e3d, 0x4e3e, 0x4e3f, 0x4e40, 0x4e41, 0x4e42, + 0x4e43, 0x4e44, 0x4e45, 0x4e46, 0x4e47, 0x4e48, 0x4e49, 0x4e4a, + 0x4e4b, 0x4e4c, 0x4e4d, 0x4e4e, 0x4e4f, 0x4e50, 0x4e51, 0x4e52, + 0x4e53, 0x4e54, 0x4e55, 0x4e56, 0x4e57, 0x4e58, 0x4e59, 0x4e5a, + 0x4e5b, 0x4e5c, 0x4e5d, 0x4e5e, 0x4e5f, 0x4e60, 0x4e61, 0x4e62, + 0x4e63, 0x4e64, 0x4e65, 0x4e66, 0x4e67, 0x4e68, 0x4e69, 0x4e6a, + 0x4e6b, 0x4e6c, 0x4e6d, 0x4e6e, 0x4e6f, 0x4e70, 0x4e71, 0x4e72, + 0x4e73, 0x4e74, 0x4e75, 0x4e76, 0x4e77, 0x4e78, 0x4e79, 0x4e7a, + 0x4e7b, 0x4e7c, 0x4e7d, 0x4e7e, 0x4f21, 0x4f22, 0x4f23, 0x4f24, + 0x4f25, 0x4f26, 0x4f27, 0x4f28, 0x4f29, 0x4f2a, 0x4f2b, 0x4f2c, + 0x4f2d, 0x4f2e, 0x4f2f, 0x4f30, 0x4f31, 0x4f32, 0x4f33, 0x4f34, + 0x4f35, 0x4f36, 0x4f37, 0x4f38, 0x4f39, 0x4f3a, 0x4f3b, 0x4f3c, + 0x4f3d, 0x4f3e, 0x4f3f, 0x4f40, 0x4f41, 0x4f42, 0x4f43, 0x4f44, + 0x4f45, 0x4f46, 0x4f47, 0x4f48, 0x4f49, 0x4f4a, 0x4f4b, 0x4f4c, + 0x4f4d, 0x4f4e, 0x4f4f, 0x4f50, 0x4f51, 0x4f52, 0x4f53, 0x4f54, + 0x4f55, 0x4f56, 0x4f57, 0x4f58, 0x4f59, 0x4f5a, 0x4f5b, 0x4f5c, + 0x4f5d, 0x4f5e, 0x4f5f, 0x4f60, 0x4f61, 0x4f62, 0x4f63, 0x4f64, + 0x4f65, 0x4f66, 0x4f67, 0x4f68, 0x4f69, 0x4f6a, 0x4f6b, 0x4f6c, + 0x4f6d, 0x4f6e, 0x4f6f, 0x4f70, 0x4f71, 0x4f72, 0x4f74, 0x4f75, + 0x4f76, 0x4f73, 0x4f77, 0x4f78, 0x4f79, 0x4f7a, 0x4f7b, 0x4f7c, + 0x4f7d, 0x4f7e, 0x5021, 0x5022, 0x5023, 0x5024, 0x5025, 0x5026, + 0x5027, 0x5028, 0x5029, 0x502a, 0x502b, 0x502c, 0x502e, 0x502f, + 0x5030, 0x5031, 0x502d, 0x5032, 0x5033, 0x5034, 0x5035, 0x5037, + 0x5038, 0x5039, 0x503a, 0x503b, 0x5036, 0x503c, 0x503d, 0x503e, + 0x503f, 0x5040, 0x5041, 0x5042, 0x5043, 0x5044, 0x5045, 0x5046, + 0x5047, 0x5048, 0x5049, 0x504a, 0x504b, 0x504c, 0x504d, 0x504e, + 0x504f, 0x5050, 0x5051, 0x5052, 0x5053, 0x5054, 0x5055, 0x5056, + 0x5057, 0x5058, 0x5059, 0x505a, 0x505b, 0x505c, 0x505d, 0x505e, + 0x505f, 0x5060, 0x5061, 0x5062, 0x5063, 0x5064, 0x5065, 0x5066, + 0x5067, 0x5068, 0x5069, 0x506a, 0x506b, 0x506c, 0x506d, 0x506e, + 0x506f, 0x5070, 0x5071, 0x5072, 0x5073, 0x5074, 0x5075, 0x5076, + 0x5077, 0x5078, 0x5079, 0x507a, 0x507b, 0x507c, 0x507d, 0x507e, + 0x5121, 0x5122, 0x5123, 0x5124, 0x5125, 0x5126, 0x5127, 0x5128, + 0x5129, 0x512a, 0x512b, 0x512c, 0x512d, 0x512e, 0x512f, 0x5130, + 0x5131, 0x5132, 0x5133, 0x5134, 0x5135, 0x5136, 0x5137, 0x5138, + 0x5139, 0x513a, 0x513b, 0x513c, 0x513d, 0x513e, 0x513f, 0x5140, + 0x5141, 0x5142, 0x5143, 0x5144, 0x5145, 0x5146, 0x5147, 0x5148, + 0x5149, 0x514a, 0x514b, 0x514c, 0x514d, 0x514e, 0x514f, 0x5150, + 0x5151, 0x5152, 0x5153, 0x5154, 0x5155, 0x5156, 0x5157, 0x5158, + 0x5159, 0x515a, 0x515b, 0x515c, 0x515d, 0x515e, 0x515f, 0x5160, + 0x5161, 0x5162, 0x5163, 0x5164, 0x5165, 0x5166, 0x5167, 0x5168, + 0x5169, 0x516a, 0x516b, 0x516c, 0x516d, 0x516e, 0x516f, 0x5170, + 0x5171, 0x5172, 0x5173, 0x5174, 0x5175, 0x5176, 0x5177, 0x5178, + 0x5179, 0x517a, 0x517b, 0x517c, 0x517d, 0x517e, 0x5221, 0x5222, + 0x5223, 0x5224, 0x5225, 0x5226, 0x5227, 0x5228, 0x5229, 0x522a, + 0x522b, 0x522c, 0x522d, 0x522e, 0x522f, 0x5230, 0x5231, 0x5232, + 0x5233, 0x5234, 0x5235, 0x5236, 0x5237, 0x5238, 0x5239, 0x523a, + 0x523b, 0x523c, 0x523d, 0x523e, 0x523f, 0x5240, 0x5241, 0x5242, + 0x5243, 0x5244, 0x5245, 0x5246, 0x5247, 0x5248, 0x5249, 0x524a, + 0x524b, 0x524c, 0x524d, 0x524e, 0x524f, 0x5250, 0x5251, 0x5252, + 0x5253, 0x5254, 0x5255, 0x5256, 0x5257, 0x5258, 0x5259, 0x525a, + 0x525b, 0x525c, 0x525d, 0x525e, 0x525f, 0x5260, 0x5261, 0x5262, + 0x5263, 0x5264, 0x5265, 0x5266, 0x5267, 0x5268, 0x5269, 0x526a, + 0x526b, 0x526c, 0x526d, 0x526e, 0x526f, 0x5270, 0x5271, 0x5272, + 0x5273, 0x5274, 0x5276, 0x5277, 0x5278, 0x5275, 0x5279, 0x527a, + 0x527b, 0x527c, 0x527d, 0x527e, 0x5321, 0x5322, 0x5323, 0x5324, + 0x5325, 0x5326, 0x5327, 0x5328, 0x5329, 0x532a, 0x532b, 0x532c, + 0x532d, 0x532e, 0x532f, 0x5330, 0x5331, 0x5332, 0x5333, 0x5334, + 0x5335, 0x5336, 0x5337, 0x5338, 0x5339, 0x533a, 0x533b, 0x533c, + 0x533d, 0x533e, 0x533f, 0x5340, 0x5341, 0x5342, 0x5343, 0x5344, + 0x5345, 0x5346, 0x5347, 0x5348, 0x5349, 0x534a, 0x534b, 0x534c, + 0x534d, 0x534e, 0x534f, 0x5350, 0x5351, 0x5352, 0x5353, 0x5354, + 0x5355, 0x5356, 0x5357, 0x5358, 0x5359, 0x535a, 0x535b, 0x535c, + 0x535d, 0x535e, 0x535f, 0x5360, 0x5361, 0x5362, 0x5363, 0x5364, + 0x5365, 0x5366, 0x5367, 0x5368, 0x5369, 0x536a, 0x536b, 0x536c, + 0x536d, 0x536e, 0x536f, 0x5370, 0x5371, 0x5372, 0x5373, 0x5374, + 0x5375, 0x5376, 0x5377, 0x5378, 0x5379, 0x537a, 0x537b, 0x537c, + 0x537d, 0x537e, 0x5421, 0x5422, 0x5423, 0x5424, 0x5425, 0x5426, + 0x5427, 0x5428, 0x5429, 0x542a, 0x542b, 0x542c, 0x542d, 0x542e, + 0x542f, 0x5430, 0x5431, 0x5432, 0x5434, 0x5435, 0x5436, 0x5437, + 0x5438, 0x5439, 0x543a, 0x543b, 0x543c, 0x543d, 0x543e, 0x5433, + 0x543f, 0x5440, 0x5441, 0x5442, 0x5443, 0x5444, 0x5445, 0x5446, + 0x5447, 0x5448, 0x5449, 0x544a, 0x544b, 0x544c, 0x544d, 0x544e, + 0x544f, 0x5450, 0x5451, 0x5452, 0x5453, 0x5454, 0x5455, 0x5456, + 0x5457, 0x5458, 0x5459, 0x545a, 0x545b, 0x545c, 0x545d, 0x545e, + 0x545f, 0x5460, 0x5461, 0x5462, 0x5463, 0x5464, 0x5465, 0x5466, + 0x5467, 0x5468, 0x5469, 0x546a, 0x546c, 0x546b, 0x546d, 0x546e, + 0x546f, 0x5470, 0x5471, 0x5472, 0x5473, 0x5474, 0x5475, 0x5476, + 0x5477, 0x5478, 0x5479, 0x547a, 0x547b, 0x547c, 0x547d, 0x547e, + 0x5521, 0x5522, 0x5523, 0x5524, 0x5525, 0x5526, 0x5527, 0x5528, + 0x5529, 0x552a, 0x552b, 0x552c, 0x552d, 0x552e, 0x552f, 0x5530, + 0x5531, 0x5532, 0x5533, 0x5534, 0x5535, 0x5536, 0x5537, 0x5538, + 0x5539, 0x553a, 0x553b, 0x553c, 0x553d, 0x553e, 0x553f, 0x5540, + 0x5541, 0x5542, 0x5543, 0x5544, 0x5545, 0x5546, 0x5547, 0x5548, + 0x5549, 0x554a, 0x554b, 0x554c, 0x554d, 0x554e, 0x554f, 0x5550, + 0x5551, 0x5552, 0x5553, 0x5554, 0x5555, 0x5556, 0x5557, 0x5558, + 0x5559, 0x555a, 0x555b, 0x555c, 0x555d, 0x555e, 0x555f, 0x5560, + 0x5561, 0x5562, 0x5563, 0x5564, 0x5565, 0x5566, 0x5567, 0x5568, + 0x5569, 0x556a, 0x556b, 0x556c, 0x556d, 0x556e, 0x556f, 0x5570, + 0x5571, 0x5572, 0x5573, 0x5574, 0x5575, 0x5576, 0x5577, 0x5578, + 0x5579, 0x557a, 0x557b, 0x557c, 0x557d, 0x557e, 0x5621, 0x5622, + 0x5623, 0x5624, 0x5625, 0x5626, 0x5627, 0x5628, 0x5629, 0x562a, + 0x562b, 0x562c, 0x562d, 0x562e, 0x562f, 0x5630, 0x5631, 0x5632, + 0x5633, 0x5634, 0x5635, 0x5636, 0x5637, 0x5638, 0x5639, 0x563a, + 0x563b, 0x563c, 0x563d, 0x563e, 0x563f, 0x5640, 0x5641, 0x5642, + 0x5643, 0x5644, 0x5645, 0x5647, 0x5648, 0x5649, 0x564a, 0x564b, + 0x5646, 0x564c, 0x564d, 0x564e, 0x564f, 0x5650, 0x5651, 0x5652, + 0x5653, 0x5654, 0x5656, 0x5657, 0x5658, 0x5655, 0x5659, 0x565a, + 0x565b, 0x565c, 0x565d, 0x565e, 0x565f, 0x5660, 0x5661, 0x5662, + 0x5663, 0x5664, 0x5665, 0x5666, 0x5667, 0x5668, 0x5669, 0x566a, + 0x566b, 0x566c, 0x566d, 0x566e, 0x566f, 0x5670, 0x5671, 0x5672, + 0x5673, 0x5674, 0x5675, 0x5676, 0x5677, 0x5678, 0x5679, 0x567a, + 0x567b, 0x567c, 0x567d, 0x567e, 0x5721, 0x5722, 0x5723, 0x5724, + 0x5725, 0x5726, 0x5727, 0x5728, 0x5729, 0x572a, 0x572b, 0x572c, + 0x572d, 0x572e, 0x572f, 0x5730, 0x5731, 0x5732, 0x5733, 0x5734, + 0x5735, 0x5736, 0x5737, 0x5738, 0x5739, 0x573a, 0x573b, 0x573c, + 0x573d, 0x573e, 0x573f, 0x5740, 0x5741, 0x5742, 0x5743, 0x5744, + 0x5745, 0x5746, 0x5747, 0x5748, 0x5749, 0x574a, 0x574b, 0x574c, + 0x574d, 0x574e, 0x574f, 0x5750, 0x5751, 0x5752, 0x5753, 0x5754, + 0x5755, 0x5756, 0x5757, 0x5758, 0x5759, 0x575a, 0x575b, 0x575c, + 0x575d, 0x575e, 0x575f, 0x5760, 0x5761, 0x5762, 0x5764, 0x5765, + 0x5766, 0x5767, 0x5768, 0x5769, 0x576a, 0x576b, 0x576c, 0x576d, + 0x576e, 0x576f, 0x5770, 0x5771, 0x5772, 0x5773, 0x5774, 0x5775, + 0x5776, 0x5777, 0x5778, 0x5779, 0x583e, 0x5763, 0x577a, 0x577b, + 0x577c, 0x577d, 0x577e, 0x5821, 0x5822, 0x5823, 0x5824, 0x5825, + 0x5826, 0x5827, 0x5828, 0x5829, 0x582a, 0x582b, 0x582c, 0x582d, + 0x582e, 0x582f, 0x5830, 0x5831, 0x5832, 0x5833, 0x584c, 0x5834, + 0x5835, 0x5836, 0x5837, 0x5838, 0x5839, 0x583a, 0x583b, 0x583c, + 0x583d, 0x583f, 0x5840, 0x5841, 0x5842, 0x5843, 0x5844, 0x5845, + 0x5846, 0x5847, 0x5848, 0x5849, 0x584a, 0x584b, 0x584d, 0x584e, + 0x584f, 0x5850, 0x5851, 0x5852, 0x5853, 0x5854, 0x5855, 0x5856, + 0x5857, 0x5858, 0x5859, 0x585a, 0x585b, 0x585c, 0x585d, 0x585e, + 0x585f, 0x5860, 0x5861, 0x5862, 0x5863, 0x5864, 0x5865, 0x5866, + 0x5867, 0x5868, 0x5869, 0x586a, 0x586b, 0x586c, 0x586d, 0x586e, + 0x586f, 0x5870, 0x5871, 0x5872, 0x5873, 0x5874, 0x5875, 0x5876, + 0x5877, 0x5878, 0x5879, 0x587a, 0x587b, 0x587c, 0x587d, 0x587e, + 0x5921, 0x5922, 0x5923, 0x5924, 0x5925, 0x5926, 0x5927, 0x5928, + 0x592a, 0x592b, 0x592c, 0x592d, 0x592e, 0x592f, 0x5930, 0x5931, + 0x5932, 0x5933, 0x5934, 0x5935, 0x5936, 0x5937, 0x5938, 0x5939, + 0x593a, 0x593b, 0x593c, 0x5929, 0x593d, 0x593e, 0x593f, 0x5940, + 0x5941, 0x5942, 0x5943, 0x5944, 0x5945, 0x5946, 0x5947, 0x5948, + 0x5949, 0x594a, 0x594b, 0x594c, 0x594d, 0x594e, 0x594f, 0x5950, + 0x5951, 0x5952, 0x5953, 0x5954, 0x5955, 0x5956, 0x5957, 0x5958, + 0x5959, 0x595a, 0x595b, 0x595c, 0x595d, 0x595e, 0x595f, 0x5960, + 0x5961, 0x5962, 0x5963, 0x5964, 0x5965, 0x5966, 0x5974, 0x5967, + 0x5968, 0x5969, 0x596a, 0x596b, 0x596c, 0x596d, 0x596e, 0x596f, + 0x5970, 0x5971, 0x5972, 0x5973, 0x5975, 0x5976, 0x5977, 0x5978, + 0x5979, 0x597a, 0x597b, 0x597c, 0x597d, 0x597e, 0x5a21, 0x5a22, + 0x5a23, 0x5a24, 0x5a25, 0x5a26, 0x5a27, 0x5a28, 0x5a29, 0x5a2a, + 0x5a2b, 0x5a2c, 0x5a2d, 0x5a2e, 0x5a2f, 0x5a30, 0x5a31, 0x5a32, + 0x5a33, 0x5a34, 0x5a35, 0x5a36, 0x3866, 0x5a37, 0x5a38, 0x5a39, + 0x5a3a, 0x5a3b, 0x5a3c, 0x5a3d, 0x5a3e, 0x5a3f, 0x5a40, 0x5a41, + 0x5a42, 0x5a43, 0x5a44, 0x5a45, 0x5a46, 0x5a47, 0x5a48, 0x5a49, + 0x5a4a, 0x5a4b, 0x5a6d, 0x5a4c, 0x5a4d, 0x5a4e, 0x5a4f, 0x5a50, + 0x5a51, 0x5a52, 0x5a53, 0x5a54, 0x5a55, 0x5a56, 0x5a57, 0x5a58, + 0x5a59, 0x5a5a, 0x5a5b, 0x5a5c, 0x5a5d, 0x5a5e, 0x5a5f, 0x5a60, + 0x5a61, 0x5a62, 0x5a63, 0x5a64, 0x5a65, 0x5a66, 0x5a67, 0x5a68, + 0x5a69, 0x5a6a, 0x5a6b, 0x5a6c, 0x5a6e, 0x5a6f, 0x5a70, 0x5a71, + 0x5a72, 0x5a73, 0x5a74, 0x5a75, 0x5a76, 0x5a77, 0x5a78, 0x5a79, + 0x5a7a, 0x5a7b, 0x5a7c, 0x5a7d, 0x5a7e, 0x5b21, 0x5b22, 0x5b23, + 0x5b24, 0x5b25, 0x5b26, 0x5b27, 0x5b28, 0x5b29, 0x5b2a, 0x5b2b, + 0x5b2c, 0x5b2d, 0x5b2e, 0x5b2f, 0x5b30, 0x5b31, 0x5b32, 0x5b33, + 0x5b34, 0x5b35, 0x5b36, 0x5b37, 0x5b38, 0x5b39, 0x5b3a, 0x5b3b, + 0x5b3c, 0x5b3d, 0x5b3e, 0x5b3f, 0x5b40, 0x5b41, 0x5b42, 0x5b43, + 0x5b44, 0x5b45, 0x5b46, 0x5b47, 0x5b48, 0x5b49, 0x5b4a, 0x5b4b, + 0x5b4c, 0x5b4d, 0x5b4e, 0x5b4f, 0x5b50, 0x5b51, 0x5b52, 0x5b53, + 0x5b54, 0x5b55, 0x5b56, 0x5b57, 0x5b58, 0x5b59, 0x5b5a, 0x5b5b, + 0x5b5c, 0x5b5d, 0x5b5e, 0x5b5f, 0x5b60, 0x5b61, 0x5b62, 0x5b63, + 0x5b64, 0x5b65, 0x5b66, 0x5b67, 0x5b68, 0x5b69, 0x5b6a, 0x5b6b, + 0x5b6c, 0x5b6d, 0x5b6e, 0x5b70, 0x5b71, 0x5b72, 0x5b73, 0x5b6f, + 0x5b74, 0x5b75, 0x5b76, 0x5b77, 0x5b78, 0x5b79, 0x5b7a, 0x5b7b, + 0x5b7c, 0x5b7d, 0x5b7e, 0x5c21, 0x5c22, 0x5c23, 0x5c24, 0x5c25, + 0x5c26, 0x5c27, 0x5c28, 0x5c29, 0x5c2a, 0x5c2b, 0x5c2c, 0x5c2d, + 0x5c2e, 0x5c2f, 0x5c30, 0x5c31, 0x5c32, 0x5c33, 0x5c34, 0x5c35, + 0x5c36, 0x5c37, 0x5c38, 0x5c39, 0x5c3a, 0x5c3b, 0x5c3c, 0x5c3d, + 0x5c3e, 0x5c3f, 0x5c40, 0x5c41, 0x5c42, 0x5c43, 0x5c44, 0x5c45, + 0x5c46, 0x5c47, 0x5c48, 0x5c49, 0x5c4a, 0x5c4b, 0x5c4c, 0x5c4d, + 0x5c4e, 0x5c4f, 0x5c50, 0x5c51, 0x5c52, 0x5c53, 0x5c54, 0x5c55, + 0x5c56, 0x5c57, 0x5c58, 0x5c59, 0x5c5a, 0x5c5b, 0x5c5c, 0x5c5d, + 0x5c5e, 0x5c5f, 0x5c60, 0x5c61, 0x5c62, 0x5c63, 0x5c64, 0x5c65, + 0x5c66, 0x5c67, 0x5c68, 0x5c69, 0x5c6a, 0x5c6b, 0x5c6c, 0x5c6d, + 0x5c6e, 0x5c6f, 0x5c70, 0x5c71, 0x5c72, 0x5c73, 0x5c74, 0x5c75, + 0x5c76, 0x5c77, 0x5c78, 0x5c79, 0x5c7a, 0x5c7b, 0x5c7c, 0x5c7d, + 0x5c7e, 0x5d21, 0x5d22, 0x5d23, 0x5d24, 0x5d25, 0x5d26, 0x5d27, + 0x5d28, 0x5d29, 0x5d2a, 0x5d2b, 0x5d2c, 0x5d2d, 0x5d2e, 0x5d2f, + 0x5d30, 0x5d31, 0x5d32, 0x5d33, 0x5d34, 0x5d35, 0x5d36, 0x5d37, + 0x5d38, 0x5d39, 0x5d3a, 0x5d3b, 0x5d3c, 0x5d3d, 0x5d3e, 0x5d3f, + 0x5d40, 0x5d41, 0x5d42, 0x5d43, 0x5d44, 0x5d45, 0x5d46, 0x5d47, + 0x5d48, 0x5d49, 0x5d4a, 0x5d4b, 0x5d4c, 0x5d4d, 0x5d4e, 0x5d4f, + 0x5d50, 0x5d51, 0x5d52, 0x5d53, 0x5d54, 0x5d55, 0x5d56, 0x5d57, + 0x5d58, 0x5d59, 0x5d5a, 0x5d5b, 0x5d5c, 0x5d5d, 0x5d5e, 0x5d5f, + 0x5d60, 0x5d61, 0x5d62, 0x5d63, 0x5d64, 0x5d65, 0x5d66, 0x5d67, + 0x5d68, 0x5d69, 0x5d6a, 0x5d6b, 0x5d6c, 0x5d6d, 0x5d6e, 0x5d6f, + 0x5d70, 0x5d71, 0x5d72, 0x5d73, 0x5d74, 0x5d75, 0x5d76, 0x5d77, + 0x5d78, 0x5d79, 0x5d7a, 0x5d7b, 0x5d7c, 0x5d7d, 0x5d7e, 0x5e21, + 0x5e22, 0x5e23, 0x5e24, 0x5e25, 0x5e26, 0x5e27, 0x5e28, 0x5e29, + 0x5e2a, 0x5e2b, 0x5e2c, 0x5e2d, 0x5e2e, 0x5e2f, 0x5e30, 0x5e31, + 0x5e32, 0x5e33, 0x5e34, 0x5e35, 0x5e36, 0x5e37, 0x5e38, 0x5e39, + 0x5e3f, 0x5e3a, 0x5e3b, 0x5e3c, 0x5e3d, 0x5e3e, 0x5e40, 0x5e41, + 0x5e42, 0x5e43, 0x5e44, 0x5e45, 0x5e46, 0x5e47, 0x5e48, 0x5e49, + 0x5e4e, 0x5e4a, 0x5e4b, 0x5e4c, 0x5e4d, 0x5e4f, 0x5e50, 0x5e51, + 0x5e52, 0x5e53, 0x5e54, 0x5e55, 0x5e56, 0x5e57, 0x5e58, 0x5e59, + 0x5e5a, 0x5e5b, 0x5e5c, 0x5e5d, 0x5e5e, 0x5e5f, 0x5e60, 0x5e61, + 0x5e62, 0x5e63, 0x5e64, 0x5e65, 0x5e66, 0x5e67, 0x5e68, 0x5e69, + 0x5e6a, 0x5e6b, 0x5e6c, 0x5e6d, 0x5e6e, 0x5e6f, 0x5e72, 0x5e70, + 0x5e71, 0x5e73, 0x5e74, 0x5e75, 0x5e76, 0x5e77, 0x5e78, 0x5e79, + 0x5e7a, 0x5e7b, 0x5e7c, 0x5e7d, 0x5e7e, 0x5f21, 0x5f22, 0x5f23, + 0x5f24, 0x5f25, 0x5f26, 0x5f27, 0x5f28, 0x5f29, 0x5f2a, 0x5f2b, + 0x5f2c, 0x5f2d, 0x5f2e, 0x5f2f, 0x5f30, 0x5f32, 0x5f31, 0x5f33, + 0x5f34, 0x5f35, 0x5f36, 0x5f37, 0x5f38, 0x5f39, 0x5f3a, 0x5f3b, + 0x5f3c, 0x5f3d, 0x5f3e, 0x5f3f, 0x5f40, 0x5f41, 0x5f42, 0x5f43, + 0x5f44, 0x5f45, 0x5f46, 0x5f47, 0x5f48, 0x5f49, 0x5f4a, 0x5f4b, + 0x5f4c, 0x5f4d, 0x5f4e, 0x5f4f, 0x5f50, 0x5f51, 0x5f52, 0x5f53, + 0x5f54, 0x5f55, 0x5f56, 0x5f57, 0x5f58, 0x5f59, 0x5f5a, 0x5f5b, + 0x5f5c, 0x5f5d, 0x5f6f, 0x5f5e, 0x5f5f, 0x5f60, 0x5f61, 0x5f62, + 0x5f63, 0x5f64, 0x5f65, 0x5f66, 0x5f67, 0x5f68, 0x5f69, 0x5f6a, + 0x5f6b, 0x5f6c, 0x5f6d, 0x5f6e, 0x5f70, 0x5f71, 0x5f72, 0x5f73, + 0x5f74, 0x5f75, 0x5f76, 0x5f77, 0x5f78, 0x5f79, 0x5f7a, 0x5f7b, + 0x5f7c, 0x5f7d, 0x5f7e, 0x6021, 0x6022, 0x6023, 0x6024, 0x6025, + 0x6026, 0x6027, 0x6028, 0x6029, 0x602a, 0x602b, 0x602c, 0x602d, + 0x602e, 0x602f, 0x6030, 0x6031, 0x6032, 0x6033, 0x6034, 0x6035, + 0x6036, 0x6037, 0x6038, 0x6039, 0x603a, 0x603b, 0x603c, 0x603d, + 0x603e, 0x603f, 0x6040, 0x6041, 0x6042, 0x6043, 0x6044, 0x6045, + 0x6046, 0x6047, 0x6048, 0x6049, 0x604a, 0x604b, 0x604c, 0x604d, + 0x604e, 0x604f, 0x6050, 0x6051, 0x6052, 0x6053, 0x6054, 0x6055, + 0x6056, 0x6057, 0x6058, 0x6059, 0x605a, 0x605b, 0x605c, 0x605d, + 0x6064, 0x605e, 0x605f, 0x6060, 0x6061, 0x6062, 0x6063, 0x6065, + 0x6066, 0x6067, 0x6068, 0x6069, 0x606a, 0x606b, 0x606c, 0x606d, + 0x606e, 0x606f, 0x6070, 0x6071, 0x6072, 0x6073, 0x6074, 0x6075, + 0x6076, 0x6077, 0x6078, 0x6079, 0x607a, 0x607b, 0x607c, 0x607d, + 0x607e, 0x6121, 0x6122, 0x6123, 0x6124, 0x6125, 0x6126, 0x6127, + 0x6128, 0x6129, 0x612a, 0x612b, 0x612c, 0x612d, 0x612e, 0x612f, + 0x6130, 0x6131, 0x6132, 0x6133, 0x6134, 0x6135, 0x6136, 0x6137, + 0x6138, 0x6139, 0x613a, 0x613b, 0x613c, 0x613d, 0x613e, 0x613f, + 0x6140, 0x6141, 0x6142, 0x6143, 0x6144, 0x6145, 0x6146, 0x6147, + 0x6148, 0x6149, 0x614a, 0x614b, 0x614c, 0x614d, 0x614e, 0x614f, + 0x6150, 0x6151, 0x6152, 0x6154, 0x6155, 0x6156, 0x6153, 0x6157, + 0x6158, 0x6159, 0x615a, 0x615b, 0x615c, 0x615d, 0x615e, 0x615f, + 0x6160, 0x6161, 0x6162, 0x6163, 0x6164, 0x6165, 0x6166, 0x6167, + 0x6168, 0x6169, 0x616a, 0x616b, 0x616c, 0x616d, 0x616e, 0x616f, + 0x6170, 0x6171, 0x6172, 0x6173, 0x6174, 0x6175, 0x6176, 0x6177, + 0x6178, 0x6179, 0x617a, 0x617b, 0x617d, 0x617e, 0x6221, 0x6222, + 0x6223, 0x6224, 0x617c, 0x622d, 0x6225, 0x6226, 0x6227, 0x6228, + 0x6229, 0x622a, 0x622b, 0x622c, 0x622f, 0x6230, 0x6231, 0x6232, + 0x622e, 0x6233, 0x6234, 0x6235, 0x6236, 0x6237, 0x6238, 0x6239, + 0x623a, 0x623b, 0x623c, 0x623d, 0x623e, 0x623f, 0x6240, 0x6241, + 0x6242, 0x6243, 0x6245, 0x6246, 0x6244, 0x6247, 0x6248, 0x6249, + 0x624a, 0x624b, 0x624c, 0x624d, 0x624e, 0x624f, 0x6250, 0x6251, + 0x6252, 0x6253, 0x6254, 0x6255, 0x6256, 0x6257, 0x6258, 0x6259, + 0x625a, 0x625b, 0x625c, 0x625d, 0x625e, 0x625f, 0x6260, 0x6261, + 0x6262, 0x6263, 0x6264, 0x6265, 0x6266, 0x6267, 0x6268, 0x6269, + 0x626a, 0x626b, 0x626c, 0x626d, 0x626e, 0x626f, 0x6270, 0x6271, + 0x6272, 0x6273, 0x6274, 0x6275, 0x6276, 0x6277, 0x6278, 0x6279, + 0x627a, 0x627b, 0x627c, 0x627d, 0x627e, 0x6321, 0x6322, 0x6323, + 0x6324, 0x6325, 0x6326, 0x6327, 0x6328, 0x6329, 0x632a, 0x632b, + 0x632c, 0x632d, 0x632e, 0x632f, 0x6330, 0x6331, 0x6332, 0x6333, + 0x6334, 0x6335, 0x6336, 0x6337, 0x6338, 0x6339, 0x633a, 0x633b, + 0x633c, 0x633d, 0x633e, 0x633f, 0x6340, 0x6341, 0x6342, 0x6343, + 0x6344, 0x6345, 0x6346, 0x6347, 0x6348, 0x6349, 0x634a, 0x634b, + 0x634c, 0x634d, 0x634e, 0x634f, 0x6350, 0x6351, 0x6352, 0x6353, + 0x6354, 0x6355, 0x6356, 0x6357, 0x6358, 0x6359, 0x635a, 0x635b, + 0x635c, 0x635d, 0x635e, 0x635f, 0x6360, 0x6361, 0x6362, 0x6363, + 0x6364, 0x6365, 0x6366, 0x6367, 0x6368, 0x6369, 0x636a, 0x636b, + 0x636c, 0x636d, 0x636e, 0x636f, 0x6370, 0x6371, 0x6372, 0x6373, + 0x6374, 0x6375, 0x6376, 0x6377, 0x6378, 0x6379, 0x637a, 0x637b, + 0x637c, 0x637d, 0x637e, 0x6421, 0x6422, 0x6423, 0x6424, 0x6425, + 0x6426, 0x6427, 0x6428, 0x6429, 0x642a, 0x642b, 0x642c, 0x642d, + 0x642e, 0x642f, 0x6430, 0x6431, 0x6432, 0x6433, 0x6434, 0x6435, + 0x6436, 0x6437, 0x6438, 0x6439, 0x643a, 0x643b, 0x643c, 0x643d, + 0x643e, 0x643f, 0x6440, 0x6441, 0x6442, 0x6443, 0x6444, 0x6445, + 0x6446, 0x6447, 0x6448, 0x6449, 0x644a, 0x644b, 0x644c, 0x644d, + 0x644e, 0x644f, 0x6450, 0x6451, 0x6452, 0x6453, 0x6454, 0x6455, + 0x6456, 0x6457, 0x6458, 0x6459, 0x645a, 0x645b, 0x645c, 0x645d, + 0x645e, 0x645f, 0x6460, 0x6461, 0x6462, 0x6463, 0x6464, 0x6465, + 0x6466, 0x6467, 0x6468, 0x6469, 0x646a, 0x646b, 0x646c, 0x646d, + 0x646e, 0x646f, 0x6470, 0x6471, 0x6472, 0x6473, 0x6474, 0x6475, + 0x6476, 0x6477, 0x6478, 0x6479, 0x647a, 0x647b, 0x647c, 0x647d, + 0x647e, 0x6521, 0x6522, 0x6523, 0x6524, 0x6525, 0x6526, 0x6527, + 0x6528, 0x6529, 0x652a, 0x652b, 0x652c, 0x652d, 0x652e, 0x652f, + 0x6530, 0x6531, 0x6532, 0x6533, 0x6534, 0x6535, 0x653b, 0x6536, + 0x6537, 0x6538, 0x6539, 0x653a, 0x653c, 0x653d, 0x653e, 0x653f, + 0x6540, 0x6541, 0x6542, 0x6543, 0x6544, 0x6545, 0x6546, 0x6547, + 0x6548, 0x6549, 0x654a, 0x654b, 0x654c, 0x654d, 0x654f, 0x6550, + 0x654e, 0x6551, 0x6552, 0x6553, 0x6554, 0x6555, 0x6556, 0x6557, + 0x6558, 0x6559, 0x655a, 0x655b, 0x655c, 0x655d, 0x655e, 0x655f, + 0x6560, 0x6561, 0x6562, 0x6563, 0x6564, 0x6565, 0x6566, 0x6568, + 0x6567, 0x6569, 0x656a, 0x656b, 0x656c, 0x656d, 0x656e, 0x656f, + 0x6570, 0x6571, 0x6572, 0x6573, 0x6574, 0x6575, 0x6576, 0x6577, + 0x6578, 0x6579, 0x657a, 0x657c, 0x657b, 0x657d, 0x657e, 0x6621, + 0x6622, 0x6623, 0x6624, 0x6625, 0x6626, 0x6627, 0x6628, 0x6629, + 0x662a, 0x662b, 0x662c, 0x662d, 0x662e, 0x662f, 0x6630, 0x6631, + 0x6632, 0x6633, 0x6634, 0x6635, 0x6636, 0x6637, 0x6638, 0x6639, + 0x663a, 0x663b, 0x663c, 0x663d, 0x663e, 0x663f, 0x6640, 0x6641, + 0x6642, 0x6643, 0x6644, 0x6645, 0x6646, 0x6647, 0x6648, 0x6649, + 0x664a, 0x664b, 0x664c, 0x664d, 0x664e, 0x664f, 0x6650, 0x6651, + 0x6652, 0x6653, 0x6654, 0x6655, 0x6656, 0x6657, 0x6658, 0x6659, + 0x665a, 0x665b, 0x665c, 0x665d, 0x665e, 0x665f, 0x6660, 0x6661, + 0x6662, 0x6663, 0x6664, 0x6665, 0x6666, 0x6667, 0x6668, 0x6669, + 0x666a, 0x666b, 0x666c, 0x666d, 0x666e, 0x666f, 0x6670, 0x6671, + 0x6672, 0x6673, 0x6675, 0x6676, 0x6677, 0x6678, 0x6679, 0x667a, + 0x667b, 0x667c, 0x667d, 0x667e, 0x6721, 0x6722, 0x6723, 0x6724, + 0x6725, 0x6726, 0x6727, 0x6728, 0x6729, 0x672a, 0x672b, 0x672c, + 0x672d, 0x672e, 0x672f, 0x6730, 0x6731, 0x6732, 0x6733, 0x6734, + 0x6735, 0x6736, 0x6737, 0x6738, 0x6739, 0x673a, 0x673b, 0x673c, + 0x673d, 0x673e, 0x673f, 0x6740, 0x6741, 0x6742, 0x6743, 0x6744, + 0x6745, 0x6746, 0x6747, 0x6748, 0x6749, 0x674a, 0x674b, 0x674c, + 0x674d, 0x674e, 0x674f, 0x6750, 0x6751, 0x6752, 0x6753, 0x6754, + 0x6755, 0x6756, 0x6757, 0x6758, 0x6759, 0x675a, 0x675b, 0x675c, + 0x675d, 0x675e, 0x675f, 0x6760, 0x6761, 0x6762, 0x6763, 0x6764, + 0x6765, 0x6766, 0x676a, 0x6767, 0x6768, 0x6769, 0x676b, 0x676c, + 0x676d, 0x676e, 0x676f, 0x6770, 0x6771, 0x6772, 0x6773, 0x6774, + 0x6776, 0x6777, 0x6778, 0x6779, 0x6775, 0x677a, 0x677b, 0x677c, + 0x677d, 0x6828, 0x677e, 0x6821, 0x6822, 0x6823, 0x6824, 0x6825, + 0x6826, 0x6827, 0x6829, 0x682a, 0x682b, 0x682c, 0x682d, 0x682e, + 0x682f, 0x6830, 0x6831, 0x6832, 0x6833, 0x6834, 0x6835, 0x6836, + 0x6837, 0x6838, 0x6839, 0x683a, 0x683b, 0x683c, 0x683d, 0x683e, + 0x683f, 0x6840, 0x6841, 0x6842, 0x6843, 0x6844, 0x6845, 0x6846, + 0x6847, 0x6848, 0x6849, 0x684a, 0x684b, 0x684c, 0x684d, 0x684e, + 0x684f, 0x6850, 0x6851, 0x6852, 0x6853, 0x6854, 0x6855, 0x6856, + 0x6857, 0x6858, 0x6859, 0x685a, 0x685b, 0x685c, 0x685d, 0x685e, + 0x685f, 0x6860, 0x6861, 0x6862, 0x6863, 0x6864, 0x6865, 0x6866, + 0x6867, 0x6868, 0x6869, 0x686a, 0x686b, 0x686c, 0x686d, 0x686e, + 0x686f, 0x6870, 0x6871, 0x6872, 0x6873, 0x6874, 0x6875, 0x6876, + 0x6877, 0x6878, 0x6879, 0x687a, 0x687b, 0x687c, 0x687d, 0x687e, + 0x6921, 0x6922, 0x6923, 0x6924, 0x6925, 0x6926, 0x6927, 0x6928, + 0x6929, 0x692a, 0x692b, 0x692c, 0x692d, 0x692e, 0x692f, 0x6930, + 0x6931, 0x6932, 0x6933, 0x6934, 0x6935, 0x6936, 0x6937, 0x6938, + 0x6939, 0x693a, 0x693b, 0x693c, 0x693d, 0x693e, 0x693f, 0x6940, + 0x6941, 0x6942, 0x6943, 0x6944, 0x6945, 0x6946, 0x6947, 0x6948, + 0x6949, 0x694a, 0x694c, 0x694d, 0x694b, 0x694e, 0x694f, 0x6950, + 0x6951, 0x6952, 0x6953, 0x6954, 0x6955, 0x6956, 0x6957, 0x6958, + 0x6959, 0x695a, 0x695b, 0x695c, 0x695d, 0x695e, 0x695f, 0x6960, + 0x6961, 0x6962, 0x6963, 0x6964, 0x6965, 0x6966, 0x6967, 0x6968, + 0x6969, 0x696a, 0x696b, 0x696c, 0x696d, 0x696e, 0x696f, 0x6970, + 0x6971, 0x6972, 0x6973, 0x6974, 0x6975, 0x6976, 0x6977, 0x6978, + 0x6979, 0x697a, 0x697b, 0x697c, 0x697d, 0x697e, 0x6a21, 0x6a22, + 0x6a23, 0x6a24, 0x6a25, 0x6a26, 0x6a27, 0x6a28, 0x6a29, 0x6a2a, + 0x6a2b, 0x6a2c, 0x6a2d, 0x6a2e, 0x6a2f, 0x6a30, 0x6a31, 0x6a32, + 0x6a33, 0x6a34, 0x6a35, 0x6a36, 0x6a37, 0x6a38, 0x6a39, 0x6a3a, + 0x6a3b, 0x6a3c, 0x6a3d, 0x6a3e, 0x6a3f, 0x6a40, 0x6a41, 0x6a42, + 0x6a43, 0x6a44, 0x6a45, 0x6a46, 0x6a47, 0x6a48, 0x6a49, 0x6a4a, + 0x6a4b, 0x6a4c, 0x6a4d, 0x6a4e, 0x6a4f, 0x6a50, 0x6a51, 0x6a52, + 0x6a53, 0x6a54, 0x6a55, 0x6a56, 0x6a57, 0x6a58, 0x6a59, 0x6a5a, + 0x6a5b, 0x6a5c, 0x6a5d, 0x6a5e, 0x6a5f, 0x6a60, 0x6a61, 0x6a62, + 0x6a63, 0x6a64, 0x6a65, 0x6a66, 0x6a67, 0x6a68, 0x6a69, 0x6a6a, + 0x6a6b, 0x6a6c, 0x6a6d, 0x6a6e, 0x6a6f, 0x6a70, 0x6a71, 0x6a72, + 0x6a73, 0x6a74, 0x6a75, 0x6a76, 0x6a77, 0x6a78, 0x6a79, 0x6a7a, + 0x6a7b, 0x6a7c, 0x6a7d, 0x6a7e, 0x6b21, 0x6b22, 0x6b23, 0x6b24, + 0x6b25, 0x6b26, 0x6b27, 0x6b28, 0x6b29, 0x6b2a, 0x6b2b, 0x6b2c, + 0x6b2d, 0x6b2e, 0x6b2f, 0x6b30, 0x6b31, 0x6b32, 0x6b33, 0x6b34, + 0x6b35, 0x6b36, 0x6b37, 0x6b38, 0x6b39, 0x6b3a, 0x6b3b, 0x6b3c, + 0x6b3d, 0x6b3e, 0x6b3f, 0x6b40, 0x6b41, 0x6b42, 0x6b43, 0x6b44, + 0x6b45, 0x6b46, 0x6b47, 0x6b48, 0x6b49, 0x6b50, 0x6b4a, 0x6b4b, + 0x6b4c, 0x6b4d, 0x6b52, 0x6b4e, 0x6b4f, 0x6b51, 0x6b53, 0x6b54, + 0x6b55, 0x6b56, 0x6b57, 0x6b58, 0x6b59, 0x6b5a, 0x6b5b, 0x6b5c, + 0x6b5e, 0x6b5d, 0x6b5f, 0x6b60, 0x6b61, 0x6b62, 0x6b63, 0x6b64, + 0x6b65, 0x6b66, 0x6b67, 0x6b68, 0x6b69, 0x6b6a, 0x6b6b, 0x6b6d, + 0x6b6e, 0x6b6f, 0x6b6c, 0x6b70, 0x6b71, 0x6b72, 0x6b73, 0x6b74, + 0x6b76, 0x6b75, 0x6b77, 0x6b78, 0x6b79, 0x6b7a, 0x6b7b, 0x6b7c, + 0x6b7d, 0x6b7e, 0x6c21, 0x6c22, 0x6c23, 0x6c24, 0x6c25, 0x6c26, + 0x6c27, 0x6c28, 0x6c29, 0x6c2a, 0x6c2b, 0x6c2c, 0x6c2d, 0x6c2e, + 0x6c2f, 0x6c30, 0x6c31, 0x6c32, 0x6c33, 0x6c34, 0x6c35, 0x6c36, + 0x6c37, 0x6c38, 0x6c39, 0x6c3a, 0x6c3b, 0x6c3c, 0x6c3d, 0x6c3e, + 0x6c3f, 0x6c40, 0x6c41, 0x6c42, 0x6c43, 0x6c44, 0x6c45, 0x6c46, + 0x6c47, 0x6c48, 0x6c49, 0x6c4a, 0x6c4b, 0x6c4c, 0x6c4e, 0x6c4f, + 0x6c4d, 0x6c50, 0x6c51, 0x6c52, 0x6c53, 0x6c54, 0x6c55, 0x6c56, + 0x6c57, 0x6c58, 0x6c59, 0x6c5a, 0x6c5b, 0x6c5c, 0x6c5d, 0x6c5e, + 0x6c5f, 0x6c60, 0x6c61, 0x6c62, 0x6c63, 0x6c64, 0x6c65, 0x6c66, + 0x6c67, 0x6c68, 0x6c69, 0x6c6a, 0x6c6b, 0x6c6c, 0x6c6d, 0x6c6e, + 0x6c6f, 0x6c70, 0x6c71, 0x6c72, 0x6c73, 0x6c74, 0x6c75, 0x6c76, + 0x6c77, 0x6c78, 0x6c79, 0x6c7a, 0x6c7b, 0x6c7c, 0x6c7d, 0x6c7e, + 0x6d21, 0x6d22, 0x6d23, 0x6d24, 0x6d25, 0x6d26, 0x6d27, 0x6d28, + 0x6d29, 0x6d2a, 0x6d2b, 0x6d2c, 0x6d2d, 0x6d2e, 0x6d2f, 0x6d30, + 0x6d31, 0x6d32, 0x6d33, 0x6d34, 0x6d35, 0x6d36, 0x6d37, 0x6d38, + 0x6d39, 0x6d3a, 0x6d3b, 0x6d3c, 0x6d3d, 0x6d3e, 0x6d3f, 0x6d40, + 0x6d41, 0x6d42, 0x6d43, 0x6d44, 0x6d45, 0x6d46, 0x6d47, 0x6d48, + 0x6d49, 0x6d4a, 0x6d4b, 0x6d4c, 0x6d4d, 0x6d4e, 0x6d4f, 0x6d50, + 0x6d51, 0x6d52, 0x6d53, 0x6d54, 0x6d55, 0x6d56, 0x6d57, 0x6d58, + 0x6d59, 0x6d5a, 0x6d5b, 0x6d5c, 0x6d5d, 0x6d5e, 0x6d5f, 0x6d60, + 0x6d61, 0x6d62, 0x6d63, +}; + +static const Summary16 jisx0212_uni2indx_page00[70] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x4000 }, + { 1, 0x0000 }, { 1, 0x0000 }, { 1, 0xc652 }, { 8, 0x8500 }, + { 11, 0xffff }, { 27, 0xff7e }, { 41, 0xffff }, { 57, 0xff7f }, + /* 0x0100 */ + { 72, 0xffff }, { 88, 0xffcf }, { 102, 0xcff7 }, { 115, 0xffff }, + { 131, 0x3fff }, { 145, 0xffff }, { 161, 0xffff }, { 177, 0x7fff }, + { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, { 192, 0x0000 }, + { 192, 0xe000 }, { 195, 0x1fff }, { 208, 0x0000 }, { 208, 0x0020 }, + /* 0x0200 */ + { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, + { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, + { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, { 209, 0x0000 }, + { 209, 0x0080 }, { 210, 0x2f00 }, { 215, 0x0000 }, { 215, 0x0000 }, + /* 0x0300 */ + { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, + { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, { 215, 0x0000 }, + { 215, 0xd770 }, { 224, 0x0001 }, { 225, 0xfc00 }, { 231, 0x0001 }, + { 232, 0x7c04 }, { 238, 0x0000 }, { 238, 0x0000 }, { 238, 0x0000 }, + /* 0x0400 */ + { 238, 0xdffc }, { 251, 0x0000 }, { 251, 0x0000 }, { 251, 0x0000 }, + { 251, 0x0000 }, { 251, 0xdffc }, +}; +static const Summary16 jisx0212_uni2indx_page21[3] = { + /* 0x2100 */ + { 264, 0x0000 }, { 264, 0x0040 }, { 265, 0x0004 }, +}; +static const Summary16 jisx0212_uni2indx_page4e[1307] = { + /* 0x4e00 */ + { 266, 0x1034 }, { 270, 0x8004 }, { 272, 0xc918 }, { 278, 0x0021 }, + { 280, 0x0093 }, { 284, 0x1402 }, { 287, 0x0308 }, { 290, 0x8230 }, + { 294, 0x2000 }, { 295, 0x20c0 }, { 298, 0x8000 }, { 299, 0x0200 }, + { 300, 0x0008 }, { 301, 0x0c01 }, { 304, 0x8107 }, { 309, 0xe02a }, + /* 0x4f00 */ + { 315, 0x190d }, { 321, 0x02e4 }, { 326, 0x4000 }, { 327, 0x4aaa }, + { 334, 0x1b05 }, { 340, 0x8154 }, { 345, 0x5409 }, { 350, 0x6782 }, + { 357, 0x5636 }, { 365, 0xc69d }, { 374, 0x0000 }, { 374, 0x7a84 }, + { 381, 0xbb63 }, { 391, 0x1004 }, { 393, 0x0005 }, { 395, 0xb005 }, + /* 0x5000 */ + { 400, 0x5493 }, { 407, 0x7989 }, { 415, 0x4084 }, { 418, 0x082d }, + { 423, 0x5467 }, { 431, 0x828e }, { 437, 0x24cd }, { 444, 0x0003 }, + { 446, 0xc45a }, { 453, 0xd85d }, { 462, 0x8407 }, { 467, 0x2601 }, + { 471, 0x5099 }, { 477, 0xb119 }, { 484, 0x8354 }, { 490, 0x4446 }, + /* 0x5100 */ + { 495, 0x79c8 }, { 503, 0x7a81 }, { 510, 0xb188 }, { 516, 0x033a }, + { 522, 0x8404 }, { 525, 0x81a8 }, { 530, 0x0050 }, { 532, 0x4000 }, + { 533, 0x4818 }, { 537, 0x2100 }, { 539, 0x200a }, { 542, 0xd500 }, + { 547, 0x8104 }, { 550, 0x412e }, { 556, 0x4024 }, { 559, 0x009c }, + /* 0x5200 */ + { 563, 0x0026 }, { 566, 0x016c }, { 571, 0x0104 }, { 573, 0x1026 }, + { 577, 0x0220 }, { 579, 0x95a0 }, { 585, 0x4043 }, { 589, 0x0380 }, + { 592, 0x1425 }, { 597, 0x15e8 }, { 604, 0x80f0 }, { 609, 0x2dc1 }, + { 616, 0x9151 }, { 622, 0x1852 }, { 627, 0x1722 }, { 633, 0x00d3 }, + /* 0x5300 */ + { 638, 0x1c09 }, { 643, 0xd90a }, { 650, 0x3ba0 }, { 657, 0x7025 }, + { 663, 0x1804 }, { 666, 0x0a00 }, { 668, 0x302a }, { 673, 0x4204 }, + { 676, 0x4188 }, { 680, 0x2218 }, { 684, 0x8c12 }, { 689, 0x25b4 }, + { 696, 0x8021 }, { 699, 0x642c }, { 705, 0x00c1 }, { 708, 0x0020 }, + /* 0x5400 */ + { 709, 0x0004 }, { 710, 0x0408 }, { 712, 0x8582 }, { 717, 0x0032 }, + { 720, 0xa098 }, { 725, 0x4000 }, { 726, 0x6ad4 }, { 734, 0x8010 }, + { 736, 0x232a }, { 742, 0x9062 }, { 747, 0x66c2 }, { 754, 0x8e82 }, + { 760, 0x6440 }, { 764, 0x0000 }, { 764, 0x9401 }, { 768, 0xd040 }, + /* 0x5500 */ + { 772, 0x7323 }, { 780, 0x0020 }, { 781, 0x0c00 }, { 783, 0x3864 }, + { 789, 0x2682 }, { 794, 0x4d03 }, { 800, 0x0053 }, { 804, 0x8000 }, + { 805, 0xc146 }, { 811, 0x009e }, { 816, 0x2018 }, { 819, 0x8004 }, + { 821, 0x5a4a }, { 828, 0x498e }, { 835, 0x0204 }, { 837, 0x8040 }, + /* 0x5600 */ + { 839, 0xe520 }, { 845, 0x0207 }, { 849, 0x1000 }, { 850, 0xbaa9 }, + { 859, 0xaa5b }, { 868, 0x4010 }, { 870, 0xa24f }, { 878, 0x0026 }, + { 881, 0x1930 }, { 886, 0xe620 }, { 892, 0x3bc0 }, { 899, 0x408a }, + { 903, 0xbe20 }, { 910, 0xb201 }, { 915, 0x29f2 }, { 923, 0x00c2 }, + /* 0x5700 */ + { 926, 0x1486 }, { 931, 0x2c22 }, { 936, 0xd63d }, { 946, 0xe018 }, + { 951, 0x3060 }, { 955, 0x0004 }, { 956, 0xe9a4 }, { 964, 0x5ebb }, + { 975, 0x100a }, { 978, 0xf6b0 }, { 987, 0x1382 }, { 992, 0x2100 }, + { 994, 0x9180 }, { 998, 0x6020 }, { 1001, 0x22d2 }, { 1007, 0xe161 }, + /* 0x5800 */ + { 1014, 0x3318 }, { 1020, 0xc800 }, { 1023, 0x20c1 }, { 1027, 0x8204 }, + { 1030, 0xb200 }, { 1034, 0x8021 }, { 1037, 0x0192 }, { 1041, 0x9100 }, + { 1044, 0xb783 }, { 1053, 0x2051 }, { 1057, 0x0247 }, { 1062, 0x1006 }, + { 1065, 0x6114 }, { 1070, 0x2455 }, { 1076, 0x0206 }, { 1079, 0x0008 }, + /* 0x5900 */ + { 1080, 0x1860 }, { 1084, 0x201c }, { 1088, 0x811a }, { 1093, 0x8069 }, + { 1098, 0x0048 }, { 1100, 0xea0c }, { 1107, 0xa80a }, { 1112, 0x1a64 }, + { 1118, 0x5800 }, { 1121, 0x80a4 }, { 1125, 0xe090 }, { 1130, 0x1489 }, + { 1135, 0x251a }, { 1141, 0xe004 }, { 1145, 0xc098 }, { 1150, 0x0096 }, + /* 0x5a00 */ + { 1154, 0x7011 }, { 1159, 0x400c }, { 1162, 0x2598 }, { 1168, 0x0001 }, + { 1169, 0x11b0 }, { 1174, 0x4021 }, { 1177, 0x20a8 }, { 1181, 0x4c80 }, + { 1185, 0x0800 }, { 1186, 0xd249 }, { 1193, 0x1085 }, { 1197, 0x8d2e }, + { 1205, 0x8150 }, { 1209, 0x1400 }, { 1211, 0x4421 }, { 1215, 0x2060 }, + /* 0x5b00 */ + { 1218, 0x0103 }, { 1221, 0x2a80 }, { 1225, 0x2022 }, { 1228, 0x0110 }, + { 1230, 0x1802 }, { 1233, 0x4044 }, { 1236, 0xc100 }, { 1239, 0xf000 }, + { 1243, 0x4452 }, { 1248, 0x005b }, { 1253, 0xb300 }, { 1258, 0x1486 }, + { 1263, 0xa003 }, { 1267, 0x07c0 }, { 1272, 0x8001 }, { 1274, 0x2012 }, + /* 0x5c00 */ + { 1277, 0x1000 }, { 1278, 0xc080 }, { 1281, 0x5a48 }, { 1287, 0x0065 }, + { 1291, 0x0000 }, { 1291, 0x1600 }, { 1294, 0x238c }, { 1300, 0x3c31 }, + { 1307, 0x8580 }, { 1311, 0xa004 }, { 1314, 0x044d }, { 1319, 0x0434 }, + { 1323, 0x0a00 }, { 1325, 0x2084 }, { 1328, 0x4000 }, { 1329, 0x0016 }, + /* 0x5d00 */ + { 1332, 0x2042 }, { 1335, 0x0004 }, { 1336, 0x08d8 }, { 1341, 0xa212 }, + { 1346, 0x054c }, { 1351, 0x8222 }, { 1355, 0x2417 }, { 1361, 0xc601 }, + { 1366, 0x050a }, { 1370, 0x8a3c }, { 1377, 0x0881 }, { 1380, 0x0315 }, + { 1385, 0x4888 }, { 1389, 0x0301 }, { 1392, 0x0211 }, { 1395, 0x0300 }, + /* 0x5e00 */ + { 1397, 0x2081 }, { 1400, 0x8134 }, { 1405, 0x4101 }, { 1408, 0x4024 }, + { 1411, 0x0a00 }, { 1413, 0x5943 }, { 1420, 0x7d00 }, { 1426, 0x0001 }, + { 1427, 0x4801 }, { 1430, 0x0000 }, { 1430, 0x1534 }, { 1436, 0xe00a }, + { 1441, 0x5840 }, { 1445, 0x5036 }, { 1451, 0x0820 }, { 1453, 0x0000 }, + /* 0x5f00 */ + { 1453, 0x41c4 }, { 1458, 0x3200 }, { 1461, 0x591e }, { 1469, 0xa851 }, + { 1475, 0x20b1 }, { 1480, 0x0911 }, { 1484, 0x8099 }, { 1489, 0x6534 }, + { 1496, 0xa200 }, { 1499, 0x3040 }, { 1502, 0x9894 }, { 1508, 0x0103 }, + { 1511, 0x0b90 }, { 1516, 0x401f }, { 1522, 0xf706 }, { 1531, 0x144c }, + /* 0x6000 */ + { 1536, 0x2480 }, { 1539, 0x8598 }, { 1545, 0x2010 }, { 1547, 0x0028 }, + { 1549, 0x1381 }, { 1554, 0x20d2 }, { 1559, 0x0082 }, { 1561, 0xc002 }, + { 1564, 0x4544 }, { 1569, 0x612a }, { 1575, 0x0134 }, { 1579, 0x4883 }, + { 1584, 0xcf14 }, { 1592, 0x6a30 }, { 1598, 0x0024 }, { 1600, 0x3124 }, + /* 0x6100 */ + { 1605, 0x1484 }, { 1609, 0x52df }, { 1619, 0x0c04 }, { 1622, 0x02e3 }, + { 1628, 0x0262 }, { 1632, 0x4000 }, { 1633, 0x1001 }, { 1635, 0x9904 }, + { 1640, 0x281b }, { 1646, 0xb18c }, { 1653, 0x2521 }, { 1658, 0x1300 }, + { 1661, 0xc007 }, { 1666, 0xf020 }, { 1671, 0xb2a6 }, { 1679, 0x0000 }, + /* 0x6200 */ + { 1679, 0x009a }, { 1683, 0x1028 }, { 1686, 0x0a8d }, { 1692, 0x2200 }, + { 1694, 0x105c }, { 1699, 0x1457 }, { 1706, 0xa010 }, { 1709, 0x2408 }, + { 1712, 0xe000 }, { 1715, 0x0001 }, { 1716, 0x0140 }, { 1718, 0xc4c8 }, + { 1724, 0x4010 }, { 1726, 0x0460 }, { 1729, 0x0400 }, { 1730, 0x3014 }, + /* 0x6300 */ + { 1734, 0x2c18 }, { 1739, 0x0149 }, { 1743, 0x2600 }, { 1746, 0x1260 }, + { 1750, 0x4c5e }, { 1758, 0x091c }, { 1763, 0x3060 }, { 1767, 0xb132 }, + { 1774, 0x0494 }, { 1778, 0x4631 }, { 1784, 0xe050 }, { 1789, 0x2000 }, + { 1790, 0x4122 }, { 1794, 0x103a }, { 1799, 0x1421 }, { 1803, 0x032c }, + /* 0x6400 */ + { 1808, 0x0600 }, { 1810, 0x4115 }, { 1815, 0x8635 }, { 1822, 0xa021 }, + { 1826, 0x8800 }, { 1828, 0xbc1e }, { 1837, 0x200b }, { 1841, 0x2818 }, + { 1845, 0x80a0 }, { 1848, 0xab03 }, { 1855, 0x114a }, { 1860, 0xe008 }, + { 1864, 0x5e10 }, { 1870, 0x00a3 }, { 1874, 0x2630 }, { 1879, 0x88a1 }, + /* 0x6500 */ + { 1884, 0x8712 }, { 1890, 0xca58 }, { 1897, 0x4244 }, { 1901, 0x3402 }, + { 1905, 0x0288 }, { 1908, 0x8015 }, { 1912, 0x0881 }, { 1915, 0x2400 }, + { 1917, 0x0422 }, { 1920, 0x2124 }, { 1924, 0x4049 }, { 1928, 0x801c }, + { 1932, 0x4304 }, { 1936, 0x8151 }, { 1941, 0x0000 }, { 1941, 0xc235 }, + /* 0x6600 */ + { 1948, 0x2311 }, { 1953, 0x6066 }, { 1959, 0x5e5e }, { 1969, 0x028b }, + { 1974, 0x5461 }, { 1980, 0x1b82 }, { 1986, 0x1c03 }, { 1991, 0xdba8 }, + { 2000, 0x3801 }, { 2004, 0x9e05 }, { 2011, 0x2011 }, { 2014, 0x8826 }, + { 2019, 0xd10d }, { 2026, 0x8810 }, { 2029, 0x5900 }, { 2033, 0x0c00 }, + /* 0x6700 */ + { 2035, 0x40a0 }, { 2038, 0x1208 }, { 2041, 0x0005 }, { 2043, 0x4008 }, + { 2045, 0x11a0 }, { 2049, 0x2030 }, { 2052, 0x5040 }, { 2055, 0x0850 }, + { 2058, 0xc012 }, { 2062, 0x0b4a }, { 2068, 0x0000 }, { 2068, 0x3827 }, + { 2075, 0x032d }, { 2081, 0x1284 }, { 2085, 0x0042 }, { 2087, 0x02c5 }, + /* 0x6800 */ + { 2092, 0x0000 }, { 2092, 0xa210 }, { 2096, 0xb180 }, { 2101, 0x880b }, + { 2106, 0x1430 }, { 2110, 0x09a4 }, { 2115, 0xc800 }, { 2118, 0x1e27 }, + { 2126, 0x0154 }, { 2130, 0x1540 }, { 2134, 0x462a }, { 2140, 0x0804 }, + { 2142, 0x9120 }, { 2146, 0x324b }, { 2153, 0x3d20 }, { 2159, 0x3863 }, + /* 0x6900 */ + { 2166, 0x0640 }, { 2169, 0x00cb }, { 2174, 0x0000 }, { 2174, 0x092a }, + { 2179, 0x4224 }, { 2183, 0x0880 }, { 2185, 0x1378 }, { 2192, 0x8c07 }, + { 2198, 0x2001 }, { 2200, 0x0144 }, { 2203, 0xa962 }, { 2210, 0x1580 }, + { 2214, 0x0120 }, { 2216, 0x00c2 }, { 2219, 0xc024 }, { 2223, 0x402a }, + /* 0x6a00 */ + { 2227, 0x800b }, { 2231, 0x2422 }, { 2235, 0x0111 }, { 2238, 0xc895 }, + { 2245, 0x4660 }, { 2250, 0x0867 }, { 2256, 0x0490 }, { 2259, 0x400a }, + { 2262, 0x0aca }, { 2268, 0xe802 }, { 2273, 0x8820 }, { 2276, 0xe013 }, + { 2282, 0x1340 }, { 2286, 0x3071 }, { 2292, 0x1090 }, { 2295, 0x3007 }, + /* 0x6b00 */ + { 2300, 0x82cc }, { 2306, 0x4883 }, { 2311, 0x9910 }, { 2316, 0x8860 }, + { 2320, 0x2440 }, { 2323, 0x2144 }, { 2327, 0x4881 }, { 2331, 0x6021 }, + { 2335, 0x0024 }, { 2337, 0x8880 }, { 2340, 0x730d }, { 2348, 0x6301 }, + { 2353, 0x1218 }, { 2357, 0x0440 }, { 2359, 0x40ca }, { 2364, 0x8282 }, + /* 0x6c00 */ + { 2368, 0x6234 }, { 2374, 0x8205 }, { 2378, 0x51c0 }, { 2383, 0x8c68 }, + { 2389, 0xac00 }, { 2393, 0x1a14 }, { 2398, 0xa880 }, { 2402, 0x0b50 }, + { 2407, 0x02e0 }, { 2411, 0x91b0 }, { 2417, 0x0000 }, { 2417, 0x0015 }, + { 2420, 0xa044 }, { 2424, 0x1457 }, { 2431, 0x5a81 }, { 2437, 0x0014 }, + /* 0x6d00 */ + { 2439, 0xc490 }, { 2444, 0x040a }, { 2447, 0xc1c0 }, { 2452, 0x9202 }, + { 2456, 0x0000 }, { 2456, 0xc080 }, { 2459, 0x80a2 }, { 2463, 0x1001 }, + { 2465, 0x0084 }, { 2467, 0x01d6 }, { 2473, 0x1400 }, { 2475, 0xa290 }, + { 2480, 0xc510 }, { 2485, 0xa840 }, { 2489, 0x8225 }, { 2494, 0x1051 }, + /* 0x6e00 */ + { 2498, 0x0011 }, { 2500, 0x4000 }, { 2501, 0x0084 }, { 2503, 0x1a44 }, + { 2508, 0x8b30 }, { 2514, 0x709e }, { 2522, 0x010c }, { 2525, 0x2808 }, + { 2528, 0x2000 }, { 2529, 0x0208 }, { 2531, 0x6081 }, { 2535, 0x880a }, + { 2539, 0xe58b }, { 2548, 0x0000 }, { 2548, 0x6800 }, { 2551, 0x2a00 }, + /* 0x6f00 */ + { 2554, 0x3510 }, { 2559, 0x0d40 }, { 2563, 0xa640 }, { 2568, 0x1849 }, + { 2573, 0x8000 }, { 2574, 0x668e }, { 2582, 0x1106 }, { 2586, 0x6000 }, + { 2588, 0x3988 }, { 2594, 0x845d }, { 2601, 0xc1e1 }, { 2608, 0x1061 }, + { 2612, 0x05a0 }, { 2616, 0x4400 }, { 2618, 0x0300 }, { 2620, 0x3221 }, + /* 0x7000 */ + { 2625, 0x20e1 }, { 2630, 0x0080 }, { 2631, 0x8009 }, { 2634, 0x1290 }, + { 2638, 0x4f18 }, { 2645, 0x6030 }, { 2649, 0x5030 }, { 2653, 0x4060 }, + { 2656, 0x0062 }, { 2659, 0x09f0 }, { 2665, 0x0810 }, { 2667, 0x0093 }, + { 2671, 0x0400 }, { 2672, 0x117a }, { 2679, 0x0010 }, { 2680, 0x0400 }, + /* 0x7100 */ + { 2681, 0x98f8 }, { 2689, 0x4000 }, { 2690, 0xa801 }, { 2694, 0x0103 }, + { 2697, 0x0ce2 }, { 2703, 0x5485 }, { 2709, 0x0101 }, { 2711, 0x0200 }, + { 2712, 0x10a1 }, { 2716, 0x0c04 }, { 2719, 0x8005 }, { 2722, 0x840d }, + { 2727, 0x1813 }, { 2732, 0x1648 }, { 2737, 0x0000 }, { 2737, 0x4100 }, + /* 0x7200 */ + { 2739, 0x0381 }, { 2743, 0xa488 }, { 2748, 0x8810 }, { 2751, 0x0310 }, + { 2754, 0xc02e }, { 2760, 0x5469 }, { 2767, 0xc909 }, { 2773, 0x9982 }, + { 2779, 0x6210 }, { 2783, 0x0808 }, { 2785, 0x6100 }, { 2788, 0x4012 }, + { 2791, 0x1282 }, { 2795, 0x8160 }, { 2799, 0x0020 }, { 2800, 0x4c18 }, + /* 0x7300 */ + { 2805, 0x28b4 }, { 2811, 0x430c }, { 2816, 0x1194 }, { 2821, 0x2c26 }, + { 2827, 0x2008 }, { 2829, 0xe145 }, { 2836, 0xdac1 }, { 2844, 0x1282 }, + { 2848, 0x406b }, { 2854, 0xd1a9 }, { 2862, 0x2c65 }, { 2869, 0xb2a0 }, + { 2875, 0x9a60 }, { 2881, 0x224c }, { 2886, 0x02ca }, { 2891, 0xaeb0 }, + /* 0x7400 */ + { 2899, 0x0493 }, { 2904, 0x0c02 }, { 2907, 0xff50 }, { 2917, 0x0203 }, + { 2920, 0x28d9 }, { 2927, 0x2086 }, { 2931, 0x69c4 }, { 2938, 0x0006 }, + { 2940, 0x82e3 }, { 2947, 0x9707 }, { 2955, 0xcf4b }, { 2965, 0x8a26 }, + { 2971, 0x1300 }, { 2974, 0xcd09 }, { 2981, 0x8d10 }, { 2986, 0x9c10 }, + /* 0x7500 */ + { 2991, 0x0040 }, { 2992, 0x00c4 }, { 2995, 0x8693 }, { 3002, 0xe240 }, + { 3007, 0x4189 }, { 3012, 0xc085 }, { 3017, 0x8002 }, { 3019, 0x7e02 }, + { 3026, 0x0022 }, { 3028, 0x122d }, { 3034, 0x0014 }, { 3036, 0x8410 }, + { 3039, 0xd053 }, { 3046, 0x9080 }, { 3049, 0xd093 }, { 3056, 0x0202 }, + /* 0x7600 */ + { 3058, 0x959d }, { 3067, 0x7a6c }, { 3076, 0x2268 }, { 3081, 0x172c }, + { 3088, 0x0e3b }, { 3096, 0x8220 }, { 3099, 0xe030 }, { 3104, 0x0012 }, + { 3106, 0x3022 }, { 3110, 0xb820 }, { 3115, 0x25fd }, { 3125, 0x2000 }, + { 3126, 0x5a22 }, { 3132, 0x0210 }, { 3134, 0x1141 }, { 3138, 0x1243 }, + /* 0x7700 */ + { 3143, 0x4441 }, { 3147, 0x16b4 }, { 3154, 0xe104 }, { 3159, 0x6270 }, + { 3165, 0xe464 }, { 3172, 0xd0c4 }, { 3178, 0x1495 }, { 3184, 0x241d }, + { 3190, 0x3011 }, { 3194, 0x8470 }, { 3199, 0xc484 }, { 3204, 0x4022 }, + { 3207, 0x0208 }, { 3209, 0xc226 }, { 3215, 0x1451 }, { 3220, 0x0913 }, + /* 0x7800 */ + { 3225, 0x6260 }, { 3230, 0x2002 }, { 3232, 0x600e }, { 3237, 0x00a1 }, + { 3240, 0x5198 }, { 3246, 0x5004 }, { 3249, 0x451b }, { 3256, 0x4400 }, + { 3258, 0x8400 }, { 3260, 0xe110 }, { 3265, 0x3112 }, { 3270, 0xa80f }, + { 3277, 0x5380 }, { 3282, 0x886c }, { 3288, 0x0453 }, { 3293, 0x8ccc }, + /* 0x7900 */ + { 3300, 0x1041 }, { 3303, 0xd401 }, { 3308, 0x22a1 }, { 3313, 0xa832 }, + { 3319, 0x8c70 }, { 3325, 0x1912 }, { 3330, 0x0a80 }, { 3333, 0x5a04 }, + { 3338, 0x1800 }, { 3340, 0x197a }, { 3348, 0x8b02 }, { 3353, 0x0912 }, + { 3357, 0x8594 }, { 3363, 0x6450 }, { 3368, 0x2c25 }, { 3374, 0x1102 }, + /* 0x7a00 */ + { 3377, 0x168c }, { 3383, 0x4822 }, { 3387, 0xa882 }, { 3392, 0x0731 }, + { 3398, 0x11b0 }, { 3403, 0xb260 }, { 3409, 0x24a1 }, { 3414, 0x4120 }, + { 3417, 0x0c65 }, { 3423, 0x4013 }, { 3427, 0x1009 }, { 3430, 0x1a28 }, + { 3435, 0x5240 }, { 3439, 0x0802 }, { 3441, 0x1b00 }, { 3445, 0x6812 }, + /* 0x7b00 */ + { 3450, 0x0080 }, { 3451, 0x8010 }, { 3453, 0xee88 }, { 3461, 0xa013 }, + { 3466, 0x4083 }, { 3470, 0x0020 }, { 3471, 0xa651 }, { 3478, 0x008c }, + { 3481, 0x4210 }, { 3484, 0x4843 }, { 3489, 0x9021 }, { 3493, 0x3c65 }, + { 3501, 0x0524 }, { 3505, 0x0ed0 }, { 3511, 0x0500 }, { 3513, 0x5734 }, + /* 0x7c00 */ + { 3521, 0xda5e }, { 3531, 0x0a00 }, { 3533, 0x1161 }, { 3538, 0x065a }, + { 3544, 0x0440 }, { 3546, 0x7e2e }, { 3556, 0x628a }, { 3562, 0x3205 }, + { 3567, 0x80c0 }, { 3570, 0x4010 }, { 3572, 0x0041 }, { 3574, 0x9cc1 }, + { 3581, 0xa390 }, { 3587, 0x26b8 }, { 3594, 0x0a40 }, { 3597, 0x0020 }, + /* 0x7d00 */ + { 3598, 0x8388 }, { 3603, 0x604e }, { 3609, 0x2448 }, { 3613, 0x7002 }, + { 3617, 0x2183 }, { 3622, 0x368a }, { 3629, 0x04a0 }, { 3632, 0x8d01 }, + { 3637, 0x396e }, { 3646, 0x60c2 }, { 3651, 0x04c0 }, { 3654, 0x02c8 }, + { 3658, 0x707c }, { 3666, 0x0280 }, { 3668, 0x2c64 }, { 3674, 0x0662 }, + /* 0x7e00 */ + { 3679, 0x0101 }, { 3681, 0x30a3 }, { 3687, 0xb181 }, { 3693, 0x8048 }, + { 3696, 0x40b0 }, { 3700, 0x8105 }, { 3704, 0xc826 }, { 3710, 0x4108 }, + { 3713, 0x24c2 }, { 3718, 0x6522 }, { 3724, 0x0000 }, { 3724, 0x0000 }, + { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, + /* 0x7f00 */ + { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0x0000 }, { 3724, 0xf800 }, + { 3729, 0x8098 }, { 3733, 0x380c }, { 3738, 0x207a }, { 3744, 0xe002 }, + { 3748, 0xa801 }, { 3752, 0x10c3 }, { 3757, 0x2446 }, { 3762, 0x9010 }, + { 3765, 0xc109 }, { 3770, 0x8800 }, { 3772, 0xd128 }, { 3778, 0xe404 }, + /* 0x8000 */ + { 3783, 0xe580 }, { 3789, 0xe05a }, { 3796, 0x5051 }, { 3801, 0x56b1 }, + { 3809, 0x0011 }, { 3811, 0x0000 }, { 3811, 0x2051 }, { 3815, 0x0022 }, + { 3817, 0x4102 }, { 3820, 0x5000 }, { 3822, 0x08c0 }, { 3825, 0x0300 }, + { 3827, 0xa100 }, { 3830, 0x01b4 }, { 3835, 0x6001 }, { 3838, 0x464d }, + /* 0x8100 */ + { 3845, 0x0808 }, { 3847, 0x51c0 }, { 3852, 0x1091 }, { 3856, 0x1421 }, + { 3860, 0x14a0 }, { 3864, 0x0084 }, { 3866, 0xa383 }, { 3873, 0x0080 }, + { 3874, 0x4872 }, { 3880, 0x4941 }, { 3885, 0x4004 }, { 3887, 0x0814 }, + { 3890, 0xcc28 }, { 3896, 0x68a0 }, { 3901, 0x1812 }, { 3905, 0xa367 }, + /* 0x8200 */ + { 3914, 0x8009 }, { 3917, 0x2618 }, { 3922, 0x0106 }, { 3925, 0x0414 }, + { 3928, 0xc878 }, { 3935, 0x1042 }, { 3938, 0x2089 }, { 3942, 0xa810 }, + { 3946, 0x469b }, { 3954, 0x0d52 }, { 3960, 0x479b }, { 3969, 0xd495 }, + { 3977, 0x0040 }, { 3978, 0x0421 }, { 3981, 0xa515 }, { 3988, 0x60c0 }, + /* 0x8300 */ + { 3992, 0x0d83 }, { 3998, 0xe800 }, { 4002, 0x7006 }, { 4007, 0x3489 }, + { 4013, 0x609c }, { 4019, 0x00fa }, { 4025, 0x0000 }, { 4025, 0xa101 }, + { 4029, 0x2055 }, { 4034, 0x3b34 }, { 4042, 0x32c0 }, { 4047, 0xc000 }, + { 4049, 0x8281 }, { 4053, 0x2013 }, { 4057, 0x0500 }, { 4059, 0x1340 }, + /* 0x8400 */ + { 4063, 0x8442 }, { 4067, 0x0222 }, { 4070, 0x8000 }, { 4071, 0x0200 }, + { 4072, 0xa5a0 }, { 4078, 0x1746 }, { 4085, 0x04b1 }, { 4090, 0x3159 }, + { 4097, 0x0022 }, { 4099, 0x402c }, { 4103, 0x8740 }, { 4108, 0x6412 }, + { 4113, 0x9185 }, { 4119, 0x1008 }, { 4121, 0x8480 }, { 4124, 0x2c87 }, + /* 0x8500 */ + { 4131, 0x508c }, { 4136, 0x5001 }, { 4139, 0x8cbc }, { 4147, 0x805c }, + { 4152, 0x8040 }, { 4154, 0xf24f }, { 4164, 0x8817 }, { 4170, 0xae00 }, + { 4175, 0x9a62 }, { 4182, 0xa108 }, { 4186, 0x20a5 }, { 4191, 0xf1d0 }, + { 4199, 0x4c84 }, { 4204, 0x8500 }, { 4207, 0x2141 }, { 4211, 0x9048 }, + /* 0x8600 */ + { 4215, 0x6031 }, { 4220, 0x4b07 }, { 4227, 0x0282 }, { 4230, 0x3540 }, + { 4235, 0x0047 }, { 4239, 0x23cc }, { 4246, 0x921f }, { 4254, 0x04e0 }, + { 4258, 0x2100 }, { 4260, 0x1542 }, { 4265, 0x21c2 }, { 4270, 0x83ba }, + { 4278, 0x002b }, { 4282, 0x14a6 }, { 4288, 0x00a9 }, { 4292, 0x3400 }, + /* 0x8700 */ + { 4295, 0xc8b0 }, { 4301, 0xc219 }, { 4307, 0xc10a }, { 4312, 0x7606 }, + { 4319, 0x2029 }, { 4323, 0x2100 }, { 4325, 0x8032 }, { 4329, 0x0806 }, + { 4332, 0x1bf8 }, { 4341, 0x43a9 }, { 4348, 0x7089 }, { 4354, 0xc022 }, + { 4358, 0x4702 }, { 4363, 0x9660 }, { 4369, 0x2c1c }, { 4375, 0x850a }, + /* 0x8800 */ + { 4380, 0x0e4a }, { 4386, 0xdf1d }, { 4397, 0x6100 }, { 4400, 0x1425 }, + { 4405, 0x4f2a }, { 4413, 0x9562 }, { 4420, 0x0211 }, { 4423, 0x0a02 }, + { 4426, 0x0001 }, { 4427, 0x9d00 }, { 4432, 0x0501 }, { 4435, 0x6400 }, + { 4438, 0x7c01 }, { 4444, 0x480e }, { 4449, 0x8080 }, { 4451, 0x00a3 }, + /* 0x8900 */ + { 4455, 0xe042 }, { 4460, 0x1760 }, { 4466, 0x01c1 }, { 4470, 0x4627 }, + { 4477, 0x8265 }, { 4483, 0x1c84 }, { 4488, 0x480e }, { 4493, 0x3c29 }, + { 4500, 0x2200 }, { 4502, 0x9831 }, { 4508, 0x0021 }, { 4510, 0x10f1 }, + { 4516, 0x0000 }, { 4516, 0x01f0 }, { 4521, 0x2a20 }, { 4525, 0xa24a }, + /* 0x8a00 */ + { 4531, 0x80b0 }, { 4535, 0x4036 }, { 4540, 0x9855 }, { 4547, 0x60a0 }, + { 4551, 0x62a9 }, { 4558, 0x31c8 }, { 4564, 0x00a2 }, { 4567, 0xcee0 }, + { 4575, 0x8849 }, { 4580, 0x82c5 }, { 4586, 0xc280 }, { 4590, 0x48c8 }, + { 4595, 0x0748 }, { 4600, 0xa0ba }, { 4607, 0x1000 }, { 4608, 0x9071 }, + /* 0x8b00 */ + { 4614, 0x0c60 }, { 4618, 0xd002 }, { 4622, 0x2000 }, { 4623, 0x1081 }, + { 4626, 0x217c }, { 4633, 0x421c }, { 4638, 0x2008 }, { 4640, 0x5340 }, + { 4645, 0xa832 }, { 4651, 0xd030 }, { 4656, 0x0000 }, { 4656, 0x0000 }, + { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, + /* 0x8c00 */ + { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x0000 }, { 4656, 0x6300 }, + { 4660, 0x8aa0 }, { 4665, 0x2b9a }, { 4673, 0x2358 }, { 4679, 0x4868 }, + { 4684, 0x08c0 }, { 4687, 0x1a0d }, { 4693, 0x0010 }, { 4694, 0x0600 }, + { 4696, 0x8a60 }, { 4701, 0x2260 }, { 4705, 0x9102 }, { 4709, 0xc1a5 }, + /* 0x8d00 */ + { 4716, 0x020a }, { 4719, 0x0884 }, { 4722, 0x0000 }, { 4722, 0x0000 }, + { 4722, 0x0000 }, { 4722, 0x0000 }, { 4722, 0x5220 }, { 4726, 0x8000 }, + { 4727, 0x2114 }, { 4731, 0xc023 }, { 4736, 0x9841 }, { 4741, 0x1aa4 }, + { 4747, 0x45e1 }, { 4754, 0x02b2 }, { 4759, 0x10b0 }, { 4763, 0x2017 }, + /* 0x8e00 */ + { 4768, 0x0872 }, { 4773, 0x0052 }, { 4776, 0x00cf }, { 4782, 0x23ca }, + { 4789, 0xe803 }, { 4795, 0x7810 }, { 4800, 0xb206 }, { 4806, 0x0e03 }, + { 4811, 0x020c }, { 4814, 0x6c25 }, { 4821, 0x6284 }, { 4826, 0x0c28 }, + { 4830, 0x809b }, { 4836, 0x1012 }, { 4839, 0x6100 }, { 4842, 0x0683 }, + /* 0x8f00 */ + { 4847, 0x8185 }, { 4852, 0x41c1 }, { 4857, 0x71ab }, { 4866, 0x04f0 }, + { 4871, 0x808b }, { 4876, 0x613e }, { 4884, 0x0020 }, { 4885, 0x0000 }, + { 4885, 0x0000 }, { 4885, 0x2000 }, { 4886, 0x0073 }, { 4891, 0x4160 }, + { 4895, 0x2c43 }, { 4901, 0x002d }, { 4905, 0x4119 }, { 4910, 0x4862 }, + /* 0x9000 */ + { 4915, 0x1114 }, { 4919, 0x0900 }, { 4921, 0xb700 }, { 4927, 0x8098 }, + { 4931, 0x1018 }, { 4934, 0x2800 }, { 4936, 0x10c4 }, { 4940, 0x0211 }, + { 4943, 0x5920 }, { 4948, 0x0ba1 }, { 4954, 0x0027 }, { 4958, 0x605d }, + { 4965, 0x11b8 }, { 4971, 0xb3a4 }, { 4979, 0x8820 }, { 4982, 0xc051 }, + /* 0x9100 */ + { 4987, 0x2171 }, { 4993, 0x55d1 }, { 5001, 0xc2ad }, { 5009, 0x36d2 }, + { 5017, 0x8188 }, { 5021, 0x0e88 }, { 5026, 0x2092 }, { 5030, 0x0e10 }, + { 5034, 0x446a }, { 5040, 0x413a }, { 5046, 0x7142 }, { 5052, 0xb84f }, + { 5061, 0x002c }, { 5064, 0x4698 }, { 5070, 0xf630 }, { 5078, 0x2a83 }, + /* 0x9200 */ + { 5084, 0x16f3 }, { 5093, 0x314d }, { 5100, 0xc178 }, { 5107, 0x5769 }, + { 5116, 0xe4cd }, { 5125, 0x3302 }, { 5130, 0xc3a3 }, { 5138, 0xbbe1 }, + { 5148, 0x6700 }, { 5153, 0x8284 }, { 5157, 0x89b1 }, { 5164, 0xbd44 }, + { 5172, 0x79ef }, { 5184, 0xb3a9 }, { 5193, 0x51ab }, { 5201, 0x8a01 }, + /* 0x9300 */ + { 5205, 0x2105 }, { 5209, 0xf032 }, { 5216, 0x06b2 }, { 5222, 0x00d8 }, + { 5226, 0x0380 }, { 5229, 0x45a7 }, { 5237, 0xa6b0 }, { 5244, 0xa45b }, + { 5252, 0xad07 }, { 5260, 0x4924 }, { 5265, 0x0b5a }, { 5272, 0x0470 }, + { 5276, 0x3ef2 }, { 5286, 0xd208 }, { 5291, 0x00c4 }, { 5294, 0x2f80 }, + /* 0x9400 */ + { 5300, 0xe316 }, { 5308, 0x80e0 }, { 5312, 0xc000 }, { 5314, 0xa81e }, + { 5321, 0x1528 }, { 5326, 0x9220 }, { 5330, 0xe90a }, { 5337, 0x0006 }, + { 5339, 0x0018 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, + { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, + /* 0x9500 */ + { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, + { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x0000 }, { 5341, 0x4300 }, + { 5344, 0x7110 }, { 5349, 0xe000 }, { 5352, 0x1a42 }, { 5357, 0xa450 }, + { 5362, 0x0b40 }, { 5366, 0xe60f }, { 5375, 0x0051 }, { 5378, 0x0000 }, + /* 0x9600 */ + { 5378, 0x0000 }, { 5378, 0x6000 }, { 5380, 0x1074 }, { 5385, 0x378a }, + { 5393, 0x0002 }, { 5394, 0x01d4 }, { 5399, 0x4002 }, { 5401, 0xd810 }, + { 5406, 0x021e }, { 5411, 0xa442 }, { 5416, 0xc270 }, { 5422, 0x0408 }, + { 5424, 0x0400 }, { 5425, 0xe504 }, { 5431, 0x8200 }, { 5433, 0x0402 }, + /* 0x9700 */ + { 5435, 0x022c }, { 5439, 0x2c00 }, { 5442, 0x010e }, { 5446, 0x000a }, + { 5448, 0xc40a }, { 5453, 0x0da0 }, { 5458, 0x4488 }, { 5462, 0xa9c8 }, + { 5469, 0x0201 }, { 5471, 0xc6e0 }, { 5478, 0x5004 }, { 5481, 0xd766 }, + { 5491, 0x76b2 }, { 5500, 0x6b93 }, { 5509, 0x8013 }, { 5513, 0x0592 }, + /* 0x9800 */ + { 5518, 0x6480 }, { 5522, 0x5250 }, { 5527, 0xc869 }, { 5534, 0x402d }, + { 5539, 0x0490 }, { 5542, 0x06ce }, { 5549, 0x146c }, { 5555, 0x0000 }, + { 5555, 0x0000 }, { 5555, 0x0000 }, { 5555, 0x6800 }, { 5558, 0x8d91 }, + { 5565, 0x1124 }, { 5569, 0x0000 }, { 5569, 0x04ea }, { 5575, 0x0048 }, + /* 0x9900 */ + { 5577, 0x0184 }, { 5580, 0x9ce2 }, { 5588, 0x08c4 }, { 5592, 0x1e3e }, + { 5601, 0x61c3 }, { 5608, 0xdb10 }, { 5615, 0x0001 }, { 5616, 0x0000 }, + { 5616, 0x0000 }, { 5616, 0xa800 }, { 5619, 0x0040 }, { 5620, 0xa627 }, + { 5628, 0x0208 }, { 5630, 0x5618 }, { 5636, 0x1c80 }, { 5640, 0x6231 }, + /* 0x9a00 */ + { 5646, 0x181c }, { 5651, 0x4043 }, { 5655, 0x609d }, { 5662, 0x0168 }, + { 5666, 0x5c92 }, { 5673, 0x2052 }, { 5677, 0x0000 }, { 5677, 0x0000 }, + { 5677, 0x0000 }, { 5677, 0x0000 }, { 5677, 0xd400 }, { 5681, 0xca74 }, + { 5689, 0x414a }, { 5694, 0x18e5 }, { 5701, 0x12b1 }, { 5707, 0xa62c }, + /* 0x9b00 */ + { 5714, 0x7b3f }, { 5726, 0x1a45 }, { 5732, 0x2841 }, { 5736, 0x26b8 }, + { 5743, 0x1900 }, { 5746, 0x48e0 }, { 5751, 0x7d6a }, { 5761, 0x83a8 }, + { 5767, 0xaef1 }, { 5777, 0x6411 }, { 5782, 0x12c0 }, { 5786, 0xd987 }, + { 5795, 0x4182 }, { 5799, 0xa181 }, { 5804, 0x8ca0 }, { 5809, 0xa788 }, + /* 0x9c00 */ + { 5816, 0x8805 }, { 5820, 0x5742 }, { 5827, 0x07cc }, { 5834, 0x20e2 }, + { 5839, 0xc63a }, { 5847, 0xf959 }, { 5857, 0x4f08 }, { 5863, 0x08a5 }, + { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0000 }, + { 5868, 0x0000 }, { 5868, 0x0000 }, { 5868, 0x0040 }, { 5869, 0x0284 }, + /* 0x9d00 */ + { 5872, 0x0804 }, { 5874, 0x7182 }, { 5880, 0x8000 }, { 5881, 0x341d }, + { 5888, 0x04ac }, { 5893, 0x8018 }, { 5896, 0x0e2c }, { 5902, 0x58c1 }, + { 5908, 0x6458 }, { 5914, 0x01ec }, { 5920, 0x5402 }, { 5924, 0x9222 }, + { 5929, 0x0688 }, { 5933, 0xc4f0 }, { 5940, 0x4aa1 }, { 5946, 0x4019 }, + /* 0x9e00 */ + { 5950, 0x4484 }, { 5954, 0x3267 }, { 5962, 0x0000 }, { 5962, 0x0000 }, + { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x0000 }, { 5962, 0x1c00 }, + { 5965, 0xc0bd }, { 5973, 0x4940 }, { 5977, 0xd110 }, { 5982, 0x0039 }, + { 5986, 0x0940 }, { 5989, 0x8020 }, { 5991, 0x7090 }, { 5996, 0x8127 }, + /* 0x9f00 */ + { 6002, 0x820c }, { 6006, 0x8ed7 }, { 6016, 0x8c44 }, { 6021, 0xb696 }, + { 6030, 0x00fa }, { 6036, 0x65e8 }, { 6044, 0xe300 }, { 6049, 0x242b }, + { 6055, 0x8000 }, { 6056, 0x40d7 }, { 6063, 0x002e }, +}; + +static int +jisx0212_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc < 0x0460) + summary = &jisx0212_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x2100 && wc < 0x2130) + summary = &jisx0212_uni2indx_page21[(wc>>4)-0x210]; + else if (wc >= 0x4e00 && wc < 0x9fb0) + summary = &jisx0212_uni2indx_page4e[(wc>>4)-0x4e0]; + if (summary) { + unsigned short used = summary->used; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = jisx0212_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_c.h b/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_c.h new file mode 100644 index 000000000..d870a01db --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_c.h @@ -0,0 +1,102 @@ + +/* + * KOI8-C + */ + +static const unsigned short koi8_c_2uni[128] = { + /* 0x80 */ + 0x0493, 0x0497, 0x049b, 0x049d, 0x04a3, 0x04af, 0x04b1, 0x04b3, + 0x04b7, 0x04b9, 0x04bb, 0x2580, 0x04d9, 0x04e3, 0x04e9, 0x04ef, + /* 0x90 */ + 0x0492, 0x0496, 0x049a, 0x049c, 0x04a2, 0x04ae, 0x04b0, 0x04b2, + 0x04b6, 0x04b8, 0x04ba, 0x2321, 0x04d8, 0x04e2, 0x04e8, 0x04ee, + /* 0xa0 */ + 0x00a0, 0x0452, 0x0453, 0x0451, 0x0454, 0x0455, 0x0456, 0x0457, + 0x0458, 0x0459, 0x045a, 0x045b, 0x045c, 0x0491, 0x045e, 0x045f, + /* 0xb0 */ + 0x2116, 0x0402, 0x0403, 0x0401, 0x0404, 0x0405, 0x0406, 0x0407, + 0x0486, 0x0409, 0x040a, 0x040b, 0x040c, 0x0490, 0x040e, 0x040f, + /* 0xc0 */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + /* 0xd0 */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + /* 0xe0 */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + /* 0xf0 */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, +}; + +static int +koi8_c_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) koi8_c_2uni[c-0x80]; + return 1; +} + +static const unsigned char koi8_c_page00[1] = { + 0xa0, /* 0xa0-0xa7 */ +}; +static const unsigned char koi8_c_page04[240] = { + 0x00, 0xb3, 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x00-0x07 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0xbf, /* 0x08-0x0f */ + 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ + 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ + 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ + 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ + 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ + 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ + 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ + 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ + 0x00, 0xa3, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x50-0x57 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0xbd, 0xad, 0x90, 0x80, 0x00, 0x00, 0x91, 0x81, /* 0x90-0x97 */ + 0x00, 0x00, 0x92, 0x82, 0x93, 0x83, 0x00, 0x00, /* 0x98-0x9f */ + 0x00, 0x00, 0x94, 0x84, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x95, 0x85, /* 0xa8-0xaf */ + 0x96, 0x86, 0x97, 0x87, 0x00, 0x00, 0x98, 0x88, /* 0xb0-0xb7 */ + 0x99, 0x89, 0x9a, 0x8a, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x9c, 0x8c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x9d, 0x8d, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x9e, 0x8e, 0x00, 0x00, 0x00, 0x00, 0x9f, 0x8f, /* 0xe8-0xef */ +}; +static const unsigned char koi8_c_page22[1] = { + 0xb0, /* 0x16-0x16 */ +}; + +static int +koi8_c_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00a1) + c = koi8_c_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x04ef) + c = koi8_c_page04[wc-0x0400]; + else if (wc >= 0x2216 && wc < 0x2217) + c = koi8_c_page22[wc-0x2216]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_r.h b/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_r.h new file mode 100644 index 000000000..37ca594f6 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_r.h @@ -0,0 +1,134 @@ + +/* + * KOI8-R + */ + +/* Specification: RFC 1489 */ + +static const unsigned short koi8_r_2uni[128] = { + /* 0x80 */ + 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, + 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, + /* 0x90 */ + 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, + 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, + /* 0xa0 */ + 0x2550, 0x2551, 0x2552, 0x0451, 0x2553, 0x2554, 0x2555, 0x2556, + 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x255c, 0x255d, 0x255e, + /* 0xb0 */ + 0x255f, 0x2560, 0x2561, 0x0401, 0x2562, 0x2563, 0x2564, 0x2565, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x256b, 0x256c, 0x00a9, + /* 0xc0 */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + /* 0xd0 */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + /* 0xe0 */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + /* 0xf0 */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, +}; + +static int +koi8_r_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) koi8_r_2uni[c-0x80]; + return 1; +} + +static const unsigned char koi8_r_page00[88] = { + 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x9c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ +}; +static const unsigned char koi8_r_page04[88] = { + 0x00, 0xb3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ + 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ + 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ + 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ + 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ + 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ + 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ + 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ + 0x00, 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ +}; +static const unsigned char koi8_r_page22[80] = { + 0x00, 0x95, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ +}; +static const unsigned char koi8_r_page23[8] = { + 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ +}; +static const unsigned char koi8_r_page25[168] = { + 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x85, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0xa0, 0xa1, 0xa2, 0xa4, 0xa5, 0xa6, 0xa7, 0xa8, /* 0x50-0x57 */ + 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, 0xb0, /* 0x58-0x5f */ + 0xb1, 0xb2, 0xb4, 0xb5, 0xb6, 0xb7, 0xb8, 0xb9, /* 0x60-0x67 */ + 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x8f, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ +}; + +static int +koi8_r_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00f8) + c = koi8_r_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x0458) + c = koi8_r_page04[wc-0x0400]; + else if (wc >= 0x2218 && wc < 0x2268) + c = koi8_r_page22[wc-0x2218]; + else if (wc >= 0x2320 && wc < 0x2328) + c = koi8_r_page23[wc-0x2320]; + else if (wc >= 0x2500 && wc < 0x25a8) + c = koi8_r_page25[wc-0x2500]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_u.h b/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_u.h new file mode 100644 index 000000000..e094419bc --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/koi8_u.h @@ -0,0 +1,142 @@ + +/* + * KOI8-U + */ + +/* Specification: RFC 2319 */ + +static const unsigned short koi8_u_2uni[128] = { + /* 0x80 */ + 0x2500, 0x2502, 0x250c, 0x2510, 0x2514, 0x2518, 0x251c, 0x2524, + 0x252c, 0x2534, 0x253c, 0x2580, 0x2584, 0x2588, 0x258c, 0x2590, + /* 0x90 */ + 0x2591, 0x2592, 0x2593, 0x2320, 0x25a0, 0x2219, 0x221a, 0x2248, + 0x2264, 0x2265, 0x00a0, 0x2321, 0x00b0, 0x00b2, 0x00b7, 0x00f7, + /* 0xa0 */ + 0x2550, 0x2551, 0x2552, 0x0451, 0x0454, 0x2554, 0x0456, 0x0457, + 0x2557, 0x2558, 0x2559, 0x255a, 0x255b, 0x0491, 0x255d, 0x255e, + /* 0xb0 */ + 0x255f, 0x2560, 0x2561, 0x0401, 0x0404, 0x2563, 0x0406, 0x0407, + 0x2566, 0x2567, 0x2568, 0x2569, 0x256a, 0x0490, 0x256c, 0x00a9, + /* 0xc0 */ + 0x044e, 0x0430, 0x0431, 0x0446, 0x0434, 0x0435, 0x0444, 0x0433, + 0x0445, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + /* 0xd0 */ + 0x043f, 0x044f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, + 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, + /* 0xe0 */ + 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, + 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + /* 0xf0 */ + 0x041f, 0x042f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0416, 0x0412, + 0x042c, 0x042b, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427, 0x042a, +}; + +static int +koi8_u_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) koi8_u_2uni[c-0x80]; + return 1; +} + +static const unsigned char koi8_u_page00[88] = { + 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0xbf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x9c, 0x00, 0x9d, 0x00, 0x00, 0x00, 0x00, 0x9e, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x9f, /* 0xf0-0xf7 */ +}; +static const unsigned char koi8_u_page04[152] = { + 0x00, 0xb3, 0x00, 0x00, 0xb4, 0x00, 0xb6, 0xb7, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0xe1, 0xe2, 0xf7, 0xe7, 0xe4, 0xe5, 0xf6, 0xfa, /* 0x10-0x17 */ + 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, 0xf0, /* 0x18-0x1f */ + 0xf2, 0xf3, 0xf4, 0xf5, 0xe6, 0xe8, 0xe3, 0xfe, /* 0x20-0x27 */ + 0xfb, 0xfd, 0xff, 0xf9, 0xf8, 0xfc, 0xe0, 0xf1, /* 0x28-0x2f */ + 0xc1, 0xc2, 0xd7, 0xc7, 0xc4, 0xc5, 0xd6, 0xda, /* 0x30-0x37 */ + 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, 0xd0, /* 0x38-0x3f */ + 0xd2, 0xd3, 0xd4, 0xd5, 0xc6, 0xc8, 0xc3, 0xde, /* 0x40-0x47 */ + 0xdb, 0xdd, 0xdf, 0xd9, 0xd8, 0xdc, 0xc0, 0xd1, /* 0x48-0x4f */ + 0x00, 0xa3, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0xbd, 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ +}; +static const unsigned char koi8_u_page22[80] = { + 0x00, 0x95, 0x96, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x97, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x98, 0x99, 0x00, 0x00, /* 0x60-0x67 */ +}; +static const unsigned char koi8_u_page23[8] = { + 0x93, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ +}; +static const unsigned char koi8_u_page25[168] = { + 0x80, 0x00, 0x81, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x82, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x83, 0x00, 0x00, 0x00, 0x84, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x85, 0x00, 0x00, 0x00, 0x86, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x87, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x88, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x89, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x8a, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0xa0, 0xa1, 0xa2, 0x00, 0xa5, 0x00, 0x00, 0xa8, /* 0x50-0x57 */ + 0xa9, 0xaa, 0xab, 0xac, 0x00, 0xae, 0xaf, 0xb0, /* 0x58-0x5f */ + 0xb1, 0xb2, 0x00, 0xb5, 0x00, 0x00, 0xb8, 0xb9, /* 0x60-0x67 */ + 0xba, 0xbb, 0xbc, 0x00, 0xbe, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x8b, 0x00, 0x00, 0x00, 0x8c, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x8d, 0x00, 0x00, 0x00, 0x8e, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x8f, 0x90, 0x91, 0x92, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0x94, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ +}; + +static int +koi8_u_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00f8) + c = koi8_u_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x0498) + c = koi8_u_page04[wc-0x0400]; + else if (wc >= 0x2218 && wc < 0x2268) + c = koi8_u_page22[wc-0x2218]; + else if (wc >= 0x2320 && wc < 0x2328) + c = koi8_u_page23[wc-0x2320]; + else if (wc >= 0x2500 && wc < 0x25a8) + c = koi8_u_page25[wc-0x2500]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/ksc5601.h b/nx-X11/lib/src/xlibi18n/lcUniConv/ksc5601.h new file mode 100644 index 000000000..843dcff19 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/ksc5601.h @@ -0,0 +1,3002 @@ + +/* + * KSC5601.1987-0 + */ + +static const unsigned short ksc5601_2uni_page21[1115] = { + /* 0x21 */ + 0x3000, 0x3001, 0x3002, 0x00b7, 0x2025, 0x2026, 0x00a8, 0x3003, + 0x00ad, 0x2015, 0x2225, 0xff3c, 0x223c, 0x2018, 0x2019, 0x201c, + 0x201d, 0x3014, 0x3015, 0x3008, 0x3009, 0x300a, 0x300b, 0x300c, + 0x300d, 0x300e, 0x300f, 0x3010, 0x3011, 0x00b1, 0x00d7, 0x00f7, + 0x2260, 0x2264, 0x2265, 0x221e, 0x2234, 0x00b0, 0x2032, 0x2033, + 0x2103, 0x212b, 0xffe0, 0xffe1, 0xffe5, 0x2642, 0x2640, 0x2220, + 0x22a5, 0x2312, 0x2202, 0x2207, 0x2261, 0x2252, 0x00a7, 0x203b, + 0x2606, 0x2605, 0x25cb, 0x25cf, 0x25ce, 0x25c7, 0x25c6, 0x25a1, + 0x25a0, 0x25b3, 0x25b2, 0x25bd, 0x25bc, 0x2192, 0x2190, 0x2191, + 0x2193, 0x2194, 0x3013, 0x226a, 0x226b, 0x221a, 0x223d, 0x221d, + 0x2235, 0x222b, 0x222c, 0x2208, 0x220b, 0x2286, 0x2287, 0x2282, + 0x2283, 0x222a, 0x2229, 0x2227, 0x2228, 0xffe2, + /* 0x22 */ + 0x21d2, 0x21d4, 0x2200, 0x2203, 0x00b4, 0xff5e, 0x02c7, 0x02d8, + 0x02dd, 0x02da, 0x02d9, 0x00b8, 0x02db, 0x00a1, 0x00bf, 0x02d0, + 0x222e, 0x2211, 0x220f, 0x00a4, 0x2109, 0x2030, 0x25c1, 0x25c0, + 0x25b7, 0x25b6, 0x2664, 0x2660, 0x2661, 0x2665, 0x2667, 0x2663, + 0x2299, 0x25c8, 0x25a3, 0x25d0, 0x25d1, 0x2592, 0x25a4, 0x25a5, + 0x25a8, 0x25a7, 0x25a6, 0x25a9, 0x2668, 0x260f, 0x260e, 0x261c, + 0x261e, 0x00b6, 0x2020, 0x2021, 0x2195, 0x2197, 0x2199, 0x2196, + 0x2198, 0x266d, 0x2669, 0x266a, 0x266c, 0x327f, 0x321c, 0x2116, + 0x33c7, 0x2122, 0x33c2, 0x33d8, 0x2121, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x23 */ + 0xff01, 0xff02, 0xff03, 0xff04, 0xff05, 0xff06, 0xff07, 0xff08, + 0xff09, 0xff0a, 0xff0b, 0xff0c, 0xff0d, 0xff0e, 0xff0f, 0xff10, + 0xff11, 0xff12, 0xff13, 0xff14, 0xff15, 0xff16, 0xff17, 0xff18, + 0xff19, 0xff1a, 0xff1b, 0xff1c, 0xff1d, 0xff1e, 0xff1f, 0xff20, + 0xff21, 0xff22, 0xff23, 0xff24, 0xff25, 0xff26, 0xff27, 0xff28, + 0xff29, 0xff2a, 0xff2b, 0xff2c, 0xff2d, 0xff2e, 0xff2f, 0xff30, + 0xff31, 0xff32, 0xff33, 0xff34, 0xff35, 0xff36, 0xff37, 0xff38, + 0xff39, 0xff3a, 0xff3b, 0xffe6, 0xff3d, 0xff3e, 0xff3f, 0xff40, + 0xff41, 0xff42, 0xff43, 0xff44, 0xff45, 0xff46, 0xff47, 0xff48, + 0xff49, 0xff4a, 0xff4b, 0xff4c, 0xff4d, 0xff4e, 0xff4f, 0xff50, + 0xff51, 0xff52, 0xff53, 0xff54, 0xff55, 0xff56, 0xff57, 0xff58, + 0xff59, 0xff5a, 0xff5b, 0xff5c, 0xff5d, 0xffe3, + /* 0x24 */ + 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, + 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, + 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, + 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, + 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, + 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, + 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, + 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, + 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, + 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x317f, 0x3180, + 0x3181, 0x3182, 0x3183, 0x3184, 0x3185, 0x3186, 0x3187, 0x3188, + 0x3189, 0x318a, 0x318b, 0x318c, 0x318d, 0x318e, + /* 0x25 */ + 0x2170, 0x2171, 0x2172, 0x2173, 0x2174, 0x2175, 0x2176, 0x2177, + 0x2178, 0x2179, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x2160, + 0x2161, 0x2162, 0x2163, 0x2164, 0x2165, 0x2166, 0x2167, 0x2168, + 0x2169, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, + 0x0399, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, + 0x03a1, 0x03a3, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x03b7, 0x03b8, + 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x03bd, 0x03be, 0x03bf, 0x03c0, + 0x03c1, 0x03c3, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x03c9, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x26 */ + 0x2500, 0x2502, 0x250c, 0x2510, 0x2518, 0x2514, 0x251c, 0x252c, + 0x2524, 0x2534, 0x253c, 0x2501, 0x2503, 0x250f, 0x2513, 0x251b, + 0x2517, 0x2523, 0x2533, 0x252b, 0x253b, 0x254b, 0x2520, 0x252f, + 0x2528, 0x2537, 0x253f, 0x251d, 0x2530, 0x2525, 0x2538, 0x2542, + 0x2512, 0x2511, 0x251a, 0x2519, 0x2516, 0x2515, 0x250e, 0x250d, + 0x251e, 0x251f, 0x2521, 0x2522, 0x2526, 0x2527, 0x2529, 0x252a, + 0x252d, 0x252e, 0x2531, 0x2532, 0x2535, 0x2536, 0x2539, 0x253a, + 0x253d, 0x253e, 0x2540, 0x2541, 0x2543, 0x2544, 0x2545, 0x2546, + 0x2547, 0x2548, 0x2549, 0x254a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x27 */ + 0x3395, 0x3396, 0x3397, 0x2113, 0x3398, 0x33c4, 0x33a3, 0x33a4, + 0x33a5, 0x33a6, 0x3399, 0x339a, 0x339b, 0x339c, 0x339d, 0x339e, + 0x339f, 0x33a0, 0x33a1, 0x33a2, 0x33ca, 0x338d, 0x338e, 0x338f, + 0x33cf, 0x3388, 0x3389, 0x33c8, 0x33a7, 0x33a8, 0x33b0, 0x33b1, + 0x33b2, 0x33b3, 0x33b4, 0x33b5, 0x33b6, 0x33b7, 0x33b8, 0x33b9, + 0x3380, 0x3381, 0x3382, 0x3383, 0x3384, 0x33ba, 0x33bb, 0x33bc, + 0x33bd, 0x33be, 0x33bf, 0x3390, 0x3391, 0x3392, 0x3393, 0x3394, + 0x2126, 0x33c0, 0x33c1, 0x338a, 0x338b, 0x338c, 0x33d6, 0x33c5, + 0x33ad, 0x33ae, 0x33af, 0x33db, 0x33a9, 0x33aa, 0x33ab, 0x33ac, + 0x33dd, 0x33d0, 0x33d3, 0x33c3, 0x33c9, 0x33dc, 0x33c6, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x28 */ + 0x00c6, 0x00d0, 0x00aa, 0x0126, 0xfffd, 0x0132, 0xfffd, 0x013f, + 0x0141, 0x00d8, 0x0152, 0x00ba, 0x00de, 0x0166, 0x014a, 0xfffd, + 0x3260, 0x3261, 0x3262, 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, + 0x3268, 0x3269, 0x326a, 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, + 0x3270, 0x3271, 0x3272, 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, + 0x3278, 0x3279, 0x327a, 0x327b, 0x24d0, 0x24d1, 0x24d2, 0x24d3, + 0x24d4, 0x24d5, 0x24d6, 0x24d7, 0x24d8, 0x24d9, 0x24da, 0x24db, + 0x24dc, 0x24dd, 0x24de, 0x24df, 0x24e0, 0x24e1, 0x24e2, 0x24e3, + 0x24e4, 0x24e5, 0x24e6, 0x24e7, 0x24e8, 0x24e9, 0x2460, 0x2461, + 0x2462, 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, + 0x246a, 0x246b, 0x246c, 0x246d, 0x246e, 0x00bd, 0x2153, 0x2154, + 0x00bc, 0x00be, 0x215b, 0x215c, 0x215d, 0x215e, + /* 0x29 */ + 0x00e6, 0x0111, 0x00f0, 0x0127, 0x0131, 0x0133, 0x0138, 0x0140, + 0x0142, 0x00f8, 0x0153, 0x00df, 0x00fe, 0x0167, 0x014b, 0x0149, + 0x3200, 0x3201, 0x3202, 0x3203, 0x3204, 0x3205, 0x3206, 0x3207, + 0x3208, 0x3209, 0x320a, 0x320b, 0x320c, 0x320d, 0x320e, 0x320f, + 0x3210, 0x3211, 0x3212, 0x3213, 0x3214, 0x3215, 0x3216, 0x3217, + 0x3218, 0x3219, 0x321a, 0x321b, 0x249c, 0x249d, 0x249e, 0x249f, + 0x24a0, 0x24a1, 0x24a2, 0x24a3, 0x24a4, 0x24a5, 0x24a6, 0x24a7, + 0x24a8, 0x24a9, 0x24aa, 0x24ab, 0x24ac, 0x24ad, 0x24ae, 0x24af, + 0x24b0, 0x24b1, 0x24b2, 0x24b3, 0x24b4, 0x24b5, 0x2474, 0x2475, + 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, 0x247b, 0x247c, 0x247d, + 0x247e, 0x247f, 0x2480, 0x2481, 0x2482, 0x00b9, 0x00b2, 0x00b3, + 0x2074, 0x207f, 0x2081, 0x2082, 0x2083, 0x2084, + /* 0x2a */ + 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, 0x3047, 0x3048, + 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, 0x304f, 0x3050, + 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, 0x3057, 0x3058, + 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, 0x305f, 0x3060, + 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, 0x3067, 0x3068, + 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, 0x306f, 0x3070, + 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, 0x3077, 0x3078, + 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, 0x307f, 0x3080, + 0x3081, 0x3082, 0x3083, 0x3084, 0x3085, 0x3086, 0x3087, 0x3088, + 0x3089, 0x308a, 0x308b, 0x308c, 0x308d, 0x308e, 0x308f, 0x3090, + 0x3091, 0x3092, 0x3093, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x2b */ + 0x30a1, 0x30a2, 0x30a3, 0x30a4, 0x30a5, 0x30a6, 0x30a7, 0x30a8, + 0x30a9, 0x30aa, 0x30ab, 0x30ac, 0x30ad, 0x30ae, 0x30af, 0x30b0, + 0x30b1, 0x30b2, 0x30b3, 0x30b4, 0x30b5, 0x30b6, 0x30b7, 0x30b8, + 0x30b9, 0x30ba, 0x30bb, 0x30bc, 0x30bd, 0x30be, 0x30bf, 0x30c0, + 0x30c1, 0x30c2, 0x30c3, 0x30c4, 0x30c5, 0x30c6, 0x30c7, 0x30c8, + 0x30c9, 0x30ca, 0x30cb, 0x30cc, 0x30cd, 0x30ce, 0x30cf, 0x30d0, + 0x30d1, 0x30d2, 0x30d3, 0x30d4, 0x30d5, 0x30d6, 0x30d7, 0x30d8, + 0x30d9, 0x30da, 0x30db, 0x30dc, 0x30dd, 0x30de, 0x30df, 0x30e0, + 0x30e1, 0x30e2, 0x30e3, 0x30e4, 0x30e5, 0x30e6, 0x30e7, 0x30e8, + 0x30e9, 0x30ea, 0x30eb, 0x30ec, 0x30ed, 0x30ee, 0x30ef, 0x30f0, + 0x30f1, 0x30f2, 0x30f3, 0x30f4, 0x30f5, 0x30f6, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + /* 0x2c */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0401, 0x0416, + 0x0417, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, + 0x041f, 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, + 0x0427, 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, + 0x042f, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0xfffd, + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0451, 0x0436, + 0x0437, 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, + 0x043f, 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, + 0x0447, 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, + 0x044f, +}; +static const unsigned short ksc5601_2uni_page30[2350] = { + /* 0x30 */ + 0xac00, 0xac01, 0xac04, 0xac07, 0xac08, 0xac09, 0xac0a, 0xac10, + 0xac11, 0xac12, 0xac13, 0xac14, 0xac15, 0xac16, 0xac17, 0xac19, + 0xac1a, 0xac1b, 0xac1c, 0xac1d, 0xac20, 0xac24, 0xac2c, 0xac2d, + 0xac2f, 0xac30, 0xac31, 0xac38, 0xac39, 0xac3c, 0xac40, 0xac4b, + 0xac4d, 0xac54, 0xac58, 0xac5c, 0xac70, 0xac71, 0xac74, 0xac77, + 0xac78, 0xac7a, 0xac80, 0xac81, 0xac83, 0xac84, 0xac85, 0xac86, + 0xac89, 0xac8a, 0xac8b, 0xac8c, 0xac90, 0xac94, 0xac9c, 0xac9d, + 0xac9f, 0xaca0, 0xaca1, 0xaca8, 0xaca9, 0xacaa, 0xacac, 0xacaf, + 0xacb0, 0xacb8, 0xacb9, 0xacbb, 0xacbc, 0xacbd, 0xacc1, 0xacc4, + 0xacc8, 0xaccc, 0xacd5, 0xacd7, 0xace0, 0xace1, 0xace4, 0xace7, + 0xace8, 0xacea, 0xacec, 0xacef, 0xacf0, 0xacf1, 0xacf3, 0xacf5, + 0xacf6, 0xacfc, 0xacfd, 0xad00, 0xad04, 0xad06, + /* 0x31 */ + 0xad0c, 0xad0d, 0xad0f, 0xad11, 0xad18, 0xad1c, 0xad20, 0xad29, + 0xad2c, 0xad2d, 0xad34, 0xad35, 0xad38, 0xad3c, 0xad44, 0xad45, + 0xad47, 0xad49, 0xad50, 0xad54, 0xad58, 0xad61, 0xad63, 0xad6c, + 0xad6d, 0xad70, 0xad73, 0xad74, 0xad75, 0xad76, 0xad7b, 0xad7c, + 0xad7d, 0xad7f, 0xad81, 0xad82, 0xad88, 0xad89, 0xad8c, 0xad90, + 0xad9c, 0xad9d, 0xada4, 0xadb7, 0xadc0, 0xadc1, 0xadc4, 0xadc8, + 0xadd0, 0xadd1, 0xadd3, 0xaddc, 0xade0, 0xade4, 0xadf8, 0xadf9, + 0xadfc, 0xadff, 0xae00, 0xae01, 0xae08, 0xae09, 0xae0b, 0xae0d, + 0xae14, 0xae30, 0xae31, 0xae34, 0xae37, 0xae38, 0xae3a, 0xae40, + 0xae41, 0xae43, 0xae45, 0xae46, 0xae4a, 0xae4c, 0xae4d, 0xae4e, + 0xae50, 0xae54, 0xae56, 0xae5c, 0xae5d, 0xae5f, 0xae60, 0xae61, + 0xae65, 0xae68, 0xae69, 0xae6c, 0xae70, 0xae78, + /* 0x32 */ + 0xae79, 0xae7b, 0xae7c, 0xae7d, 0xae84, 0xae85, 0xae8c, 0xaebc, + 0xaebd, 0xaebe, 0xaec0, 0xaec4, 0xaecc, 0xaecd, 0xaecf, 0xaed0, + 0xaed1, 0xaed8, 0xaed9, 0xaedc, 0xaee8, 0xaeeb, 0xaeed, 0xaef4, + 0xaef8, 0xaefc, 0xaf07, 0xaf08, 0xaf0d, 0xaf10, 0xaf2c, 0xaf2d, + 0xaf30, 0xaf32, 0xaf34, 0xaf3c, 0xaf3d, 0xaf3f, 0xaf41, 0xaf42, + 0xaf43, 0xaf48, 0xaf49, 0xaf50, 0xaf5c, 0xaf5d, 0xaf64, 0xaf65, + 0xaf79, 0xaf80, 0xaf84, 0xaf88, 0xaf90, 0xaf91, 0xaf95, 0xaf9c, + 0xafb8, 0xafb9, 0xafbc, 0xafc0, 0xafc7, 0xafc8, 0xafc9, 0xafcb, + 0xafcd, 0xafce, 0xafd4, 0xafdc, 0xafe8, 0xafe9, 0xaff0, 0xaff1, + 0xaff4, 0xaff8, 0xb000, 0xb001, 0xb004, 0xb00c, 0xb010, 0xb014, + 0xb01c, 0xb01d, 0xb028, 0xb044, 0xb045, 0xb048, 0xb04a, 0xb04c, + 0xb04e, 0xb053, 0xb054, 0xb055, 0xb057, 0xb059, + /* 0x33 */ + 0xb05d, 0xb07c, 0xb07d, 0xb080, 0xb084, 0xb08c, 0xb08d, 0xb08f, + 0xb091, 0xb098, 0xb099, 0xb09a, 0xb09c, 0xb09f, 0xb0a0, 0xb0a1, + 0xb0a2, 0xb0a8, 0xb0a9, 0xb0ab, 0xb0ac, 0xb0ad, 0xb0ae, 0xb0af, + 0xb0b1, 0xb0b3, 0xb0b4, 0xb0b5, 0xb0b8, 0xb0bc, 0xb0c4, 0xb0c5, + 0xb0c7, 0xb0c8, 0xb0c9, 0xb0d0, 0xb0d1, 0xb0d4, 0xb0d8, 0xb0e0, + 0xb0e5, 0xb108, 0xb109, 0xb10b, 0xb10c, 0xb110, 0xb112, 0xb113, + 0xb118, 0xb119, 0xb11b, 0xb11c, 0xb11d, 0xb123, 0xb124, 0xb125, + 0xb128, 0xb12c, 0xb134, 0xb135, 0xb137, 0xb138, 0xb139, 0xb140, + 0xb141, 0xb144, 0xb148, 0xb150, 0xb151, 0xb154, 0xb155, 0xb158, + 0xb15c, 0xb160, 0xb178, 0xb179, 0xb17c, 0xb180, 0xb182, 0xb188, + 0xb189, 0xb18b, 0xb18d, 0xb192, 0xb193, 0xb194, 0xb198, 0xb19c, + 0xb1a8, 0xb1cc, 0xb1d0, 0xb1d4, 0xb1dc, 0xb1dd, + /* 0x34 */ + 0xb1df, 0xb1e8, 0xb1e9, 0xb1ec, 0xb1f0, 0xb1f9, 0xb1fb, 0xb1fd, + 0xb204, 0xb205, 0xb208, 0xb20b, 0xb20c, 0xb214, 0xb215, 0xb217, + 0xb219, 0xb220, 0xb234, 0xb23c, 0xb258, 0xb25c, 0xb260, 0xb268, + 0xb269, 0xb274, 0xb275, 0xb27c, 0xb284, 0xb285, 0xb289, 0xb290, + 0xb291, 0xb294, 0xb298, 0xb299, 0xb29a, 0xb2a0, 0xb2a1, 0xb2a3, + 0xb2a5, 0xb2a6, 0xb2aa, 0xb2ac, 0xb2b0, 0xb2b4, 0xb2c8, 0xb2c9, + 0xb2cc, 0xb2d0, 0xb2d2, 0xb2d8, 0xb2d9, 0xb2db, 0xb2dd, 0xb2e2, + 0xb2e4, 0xb2e5, 0xb2e6, 0xb2e8, 0xb2eb, 0xb2ec, 0xb2ed, 0xb2ee, + 0xb2ef, 0xb2f3, 0xb2f4, 0xb2f5, 0xb2f7, 0xb2f8, 0xb2f9, 0xb2fa, + 0xb2fb, 0xb2ff, 0xb300, 0xb301, 0xb304, 0xb308, 0xb310, 0xb311, + 0xb313, 0xb314, 0xb315, 0xb31c, 0xb354, 0xb355, 0xb356, 0xb358, + 0xb35b, 0xb35c, 0xb35e, 0xb35f, 0xb364, 0xb365, + /* 0x35 */ + 0xb367, 0xb369, 0xb36b, 0xb36e, 0xb370, 0xb371, 0xb374, 0xb378, + 0xb380, 0xb381, 0xb383, 0xb384, 0xb385, 0xb38c, 0xb390, 0xb394, + 0xb3a0, 0xb3a1, 0xb3a8, 0xb3ac, 0xb3c4, 0xb3c5, 0xb3c8, 0xb3cb, + 0xb3cc, 0xb3ce, 0xb3d0, 0xb3d4, 0xb3d5, 0xb3d7, 0xb3d9, 0xb3db, + 0xb3dd, 0xb3e0, 0xb3e4, 0xb3e8, 0xb3fc, 0xb410, 0xb418, 0xb41c, + 0xb420, 0xb428, 0xb429, 0xb42b, 0xb434, 0xb450, 0xb451, 0xb454, + 0xb458, 0xb460, 0xb461, 0xb463, 0xb465, 0xb46c, 0xb480, 0xb488, + 0xb49d, 0xb4a4, 0xb4a8, 0xb4ac, 0xb4b5, 0xb4b7, 0xb4b9, 0xb4c0, + 0xb4c4, 0xb4c8, 0xb4d0, 0xb4d5, 0xb4dc, 0xb4dd, 0xb4e0, 0xb4e3, + 0xb4e4, 0xb4e6, 0xb4ec, 0xb4ed, 0xb4ef, 0xb4f1, 0xb4f8, 0xb514, + 0xb515, 0xb518, 0xb51b, 0xb51c, 0xb524, 0xb525, 0xb527, 0xb528, + 0xb529, 0xb52a, 0xb530, 0xb531, 0xb534, 0xb538, + /* 0x36 */ + 0xb540, 0xb541, 0xb543, 0xb544, 0xb545, 0xb54b, 0xb54c, 0xb54d, + 0xb550, 0xb554, 0xb55c, 0xb55d, 0xb55f, 0xb560, 0xb561, 0xb5a0, + 0xb5a1, 0xb5a4, 0xb5a8, 0xb5aa, 0xb5ab, 0xb5b0, 0xb5b1, 0xb5b3, + 0xb5b4, 0xb5b5, 0xb5bb, 0xb5bc, 0xb5bd, 0xb5c0, 0xb5c4, 0xb5cc, + 0xb5cd, 0xb5cf, 0xb5d0, 0xb5d1, 0xb5d8, 0xb5ec, 0xb610, 0xb611, + 0xb614, 0xb618, 0xb625, 0xb62c, 0xb634, 0xb648, 0xb664, 0xb668, + 0xb69c, 0xb69d, 0xb6a0, 0xb6a4, 0xb6ab, 0xb6ac, 0xb6b1, 0xb6d4, + 0xb6f0, 0xb6f4, 0xb6f8, 0xb700, 0xb701, 0xb705, 0xb728, 0xb729, + 0xb72c, 0xb72f, 0xb730, 0xb738, 0xb739, 0xb73b, 0xb744, 0xb748, + 0xb74c, 0xb754, 0xb755, 0xb760, 0xb764, 0xb768, 0xb770, 0xb771, + 0xb773, 0xb775, 0xb77c, 0xb77d, 0xb780, 0xb784, 0xb78c, 0xb78d, + 0xb78f, 0xb790, 0xb791, 0xb792, 0xb796, 0xb797, + /* 0x37 */ + 0xb798, 0xb799, 0xb79c, 0xb7a0, 0xb7a8, 0xb7a9, 0xb7ab, 0xb7ac, + 0xb7ad, 0xb7b4, 0xb7b5, 0xb7b8, 0xb7c7, 0xb7c9, 0xb7ec, 0xb7ed, + 0xb7f0, 0xb7f4, 0xb7fc, 0xb7fd, 0xb7ff, 0xb800, 0xb801, 0xb807, + 0xb808, 0xb809, 0xb80c, 0xb810, 0xb818, 0xb819, 0xb81b, 0xb81d, + 0xb824, 0xb825, 0xb828, 0xb82c, 0xb834, 0xb835, 0xb837, 0xb838, + 0xb839, 0xb840, 0xb844, 0xb851, 0xb853, 0xb85c, 0xb85d, 0xb860, + 0xb864, 0xb86c, 0xb86d, 0xb86f, 0xb871, 0xb878, 0xb87c, 0xb88d, + 0xb8a8, 0xb8b0, 0xb8b4, 0xb8b8, 0xb8c0, 0xb8c1, 0xb8c3, 0xb8c5, + 0xb8cc, 0xb8d0, 0xb8d4, 0xb8dd, 0xb8df, 0xb8e1, 0xb8e8, 0xb8e9, + 0xb8ec, 0xb8f0, 0xb8f8, 0xb8f9, 0xb8fb, 0xb8fd, 0xb904, 0xb918, + 0xb920, 0xb93c, 0xb93d, 0xb940, 0xb944, 0xb94c, 0xb94f, 0xb951, + 0xb958, 0xb959, 0xb95c, 0xb960, 0xb968, 0xb969, + /* 0x38 */ + 0xb96b, 0xb96d, 0xb974, 0xb975, 0xb978, 0xb97c, 0xb984, 0xb985, + 0xb987, 0xb989, 0xb98a, 0xb98d, 0xb98e, 0xb9ac, 0xb9ad, 0xb9b0, + 0xb9b4, 0xb9bc, 0xb9bd, 0xb9bf, 0xb9c1, 0xb9c8, 0xb9c9, 0xb9cc, + 0xb9ce, 0xb9cf, 0xb9d0, 0xb9d1, 0xb9d2, 0xb9d8, 0xb9d9, 0xb9db, + 0xb9dd, 0xb9de, 0xb9e1, 0xb9e3, 0xb9e4, 0xb9e5, 0xb9e8, 0xb9ec, + 0xb9f4, 0xb9f5, 0xb9f7, 0xb9f8, 0xb9f9, 0xb9fa, 0xba00, 0xba01, + 0xba08, 0xba15, 0xba38, 0xba39, 0xba3c, 0xba40, 0xba42, 0xba48, + 0xba49, 0xba4b, 0xba4d, 0xba4e, 0xba53, 0xba54, 0xba55, 0xba58, + 0xba5c, 0xba64, 0xba65, 0xba67, 0xba68, 0xba69, 0xba70, 0xba71, + 0xba74, 0xba78, 0xba83, 0xba84, 0xba85, 0xba87, 0xba8c, 0xbaa8, + 0xbaa9, 0xbaab, 0xbaac, 0xbab0, 0xbab2, 0xbab8, 0xbab9, 0xbabb, + 0xbabd, 0xbac4, 0xbac8, 0xbad8, 0xbad9, 0xbafc, + /* 0x39 */ + 0xbb00, 0xbb04, 0xbb0d, 0xbb0f, 0xbb11, 0xbb18, 0xbb1c, 0xbb20, + 0xbb29, 0xbb2b, 0xbb34, 0xbb35, 0xbb36, 0xbb38, 0xbb3b, 0xbb3c, + 0xbb3d, 0xbb3e, 0xbb44, 0xbb45, 0xbb47, 0xbb49, 0xbb4d, 0xbb4f, + 0xbb50, 0xbb54, 0xbb58, 0xbb61, 0xbb63, 0xbb6c, 0xbb88, 0xbb8c, + 0xbb90, 0xbba4, 0xbba8, 0xbbac, 0xbbb4, 0xbbb7, 0xbbc0, 0xbbc4, + 0xbbc8, 0xbbd0, 0xbbd3, 0xbbf8, 0xbbf9, 0xbbfc, 0xbbff, 0xbc00, + 0xbc02, 0xbc08, 0xbc09, 0xbc0b, 0xbc0c, 0xbc0d, 0xbc0f, 0xbc11, + 0xbc14, 0xbc15, 0xbc16, 0xbc17, 0xbc18, 0xbc1b, 0xbc1c, 0xbc1d, + 0xbc1e, 0xbc1f, 0xbc24, 0xbc25, 0xbc27, 0xbc29, 0xbc2d, 0xbc30, + 0xbc31, 0xbc34, 0xbc38, 0xbc40, 0xbc41, 0xbc43, 0xbc44, 0xbc45, + 0xbc49, 0xbc4c, 0xbc4d, 0xbc50, 0xbc5d, 0xbc84, 0xbc85, 0xbc88, + 0xbc8b, 0xbc8c, 0xbc8e, 0xbc94, 0xbc95, 0xbc97, + /* 0x3a */ + 0xbc99, 0xbc9a, 0xbca0, 0xbca1, 0xbca4, 0xbca7, 0xbca8, 0xbcb0, + 0xbcb1, 0xbcb3, 0xbcb4, 0xbcb5, 0xbcbc, 0xbcbd, 0xbcc0, 0xbcc4, + 0xbccd, 0xbccf, 0xbcd0, 0xbcd1, 0xbcd5, 0xbcd8, 0xbcdc, 0xbcf4, + 0xbcf5, 0xbcf6, 0xbcf8, 0xbcfc, 0xbd04, 0xbd05, 0xbd07, 0xbd09, + 0xbd10, 0xbd14, 0xbd24, 0xbd2c, 0xbd40, 0xbd48, 0xbd49, 0xbd4c, + 0xbd50, 0xbd58, 0xbd59, 0xbd64, 0xbd68, 0xbd80, 0xbd81, 0xbd84, + 0xbd87, 0xbd88, 0xbd89, 0xbd8a, 0xbd90, 0xbd91, 0xbd93, 0xbd95, + 0xbd99, 0xbd9a, 0xbd9c, 0xbda4, 0xbdb0, 0xbdb8, 0xbdd4, 0xbdd5, + 0xbdd8, 0xbddc, 0xbde9, 0xbdf0, 0xbdf4, 0xbdf8, 0xbe00, 0xbe03, + 0xbe05, 0xbe0c, 0xbe0d, 0xbe10, 0xbe14, 0xbe1c, 0xbe1d, 0xbe1f, + 0xbe44, 0xbe45, 0xbe48, 0xbe4c, 0xbe4e, 0xbe54, 0xbe55, 0xbe57, + 0xbe59, 0xbe5a, 0xbe5b, 0xbe60, 0xbe61, 0xbe64, + /* 0x3b */ + 0xbe68, 0xbe6a, 0xbe70, 0xbe71, 0xbe73, 0xbe74, 0xbe75, 0xbe7b, + 0xbe7c, 0xbe7d, 0xbe80, 0xbe84, 0xbe8c, 0xbe8d, 0xbe8f, 0xbe90, + 0xbe91, 0xbe98, 0xbe99, 0xbea8, 0xbed0, 0xbed1, 0xbed4, 0xbed7, + 0xbed8, 0xbee0, 0xbee3, 0xbee4, 0xbee5, 0xbeec, 0xbf01, 0xbf08, + 0xbf09, 0xbf18, 0xbf19, 0xbf1b, 0xbf1c, 0xbf1d, 0xbf40, 0xbf41, + 0xbf44, 0xbf48, 0xbf50, 0xbf51, 0xbf55, 0xbf94, 0xbfb0, 0xbfc5, + 0xbfcc, 0xbfcd, 0xbfd0, 0xbfd4, 0xbfdc, 0xbfdf, 0xbfe1, 0xc03c, + 0xc051, 0xc058, 0xc05c, 0xc060, 0xc068, 0xc069, 0xc090, 0xc091, + 0xc094, 0xc098, 0xc0a0, 0xc0a1, 0xc0a3, 0xc0a5, 0xc0ac, 0xc0ad, + 0xc0af, 0xc0b0, 0xc0b3, 0xc0b4, 0xc0b5, 0xc0b6, 0xc0bc, 0xc0bd, + 0xc0bf, 0xc0c0, 0xc0c1, 0xc0c5, 0xc0c8, 0xc0c9, 0xc0cc, 0xc0d0, + 0xc0d8, 0xc0d9, 0xc0db, 0xc0dc, 0xc0dd, 0xc0e4, + /* 0x3c */ + 0xc0e5, 0xc0e8, 0xc0ec, 0xc0f4, 0xc0f5, 0xc0f7, 0xc0f9, 0xc100, + 0xc104, 0xc108, 0xc110, 0xc115, 0xc11c, 0xc11d, 0xc11e, 0xc11f, + 0xc120, 0xc123, 0xc124, 0xc126, 0xc127, 0xc12c, 0xc12d, 0xc12f, + 0xc130, 0xc131, 0xc136, 0xc138, 0xc139, 0xc13c, 0xc140, 0xc148, + 0xc149, 0xc14b, 0xc14c, 0xc14d, 0xc154, 0xc155, 0xc158, 0xc15c, + 0xc164, 0xc165, 0xc167, 0xc168, 0xc169, 0xc170, 0xc174, 0xc178, + 0xc185, 0xc18c, 0xc18d, 0xc18e, 0xc190, 0xc194, 0xc196, 0xc19c, + 0xc19d, 0xc19f, 0xc1a1, 0xc1a5, 0xc1a8, 0xc1a9, 0xc1ac, 0xc1b0, + 0xc1bd, 0xc1c4, 0xc1c8, 0xc1cc, 0xc1d4, 0xc1d7, 0xc1d8, 0xc1e0, + 0xc1e4, 0xc1e8, 0xc1f0, 0xc1f1, 0xc1f3, 0xc1fc, 0xc1fd, 0xc200, + 0xc204, 0xc20c, 0xc20d, 0xc20f, 0xc211, 0xc218, 0xc219, 0xc21c, + 0xc21f, 0xc220, 0xc228, 0xc229, 0xc22b, 0xc22d, + /* 0x3d */ + 0xc22f, 0xc231, 0xc232, 0xc234, 0xc248, 0xc250, 0xc251, 0xc254, + 0xc258, 0xc260, 0xc265, 0xc26c, 0xc26d, 0xc270, 0xc274, 0xc27c, + 0xc27d, 0xc27f, 0xc281, 0xc288, 0xc289, 0xc290, 0xc298, 0xc29b, + 0xc29d, 0xc2a4, 0xc2a5, 0xc2a8, 0xc2ac, 0xc2ad, 0xc2b4, 0xc2b5, + 0xc2b7, 0xc2b9, 0xc2dc, 0xc2dd, 0xc2e0, 0xc2e3, 0xc2e4, 0xc2eb, + 0xc2ec, 0xc2ed, 0xc2ef, 0xc2f1, 0xc2f6, 0xc2f8, 0xc2f9, 0xc2fb, + 0xc2fc, 0xc300, 0xc308, 0xc309, 0xc30c, 0xc30d, 0xc313, 0xc314, + 0xc315, 0xc318, 0xc31c, 0xc324, 0xc325, 0xc328, 0xc329, 0xc345, + 0xc368, 0xc369, 0xc36c, 0xc370, 0xc372, 0xc378, 0xc379, 0xc37c, + 0xc37d, 0xc384, 0xc388, 0xc38c, 0xc3c0, 0xc3d8, 0xc3d9, 0xc3dc, + 0xc3df, 0xc3e0, 0xc3e2, 0xc3e8, 0xc3e9, 0xc3ed, 0xc3f4, 0xc3f5, + 0xc3f8, 0xc408, 0xc410, 0xc424, 0xc42c, 0xc430, + /* 0x3e */ + 0xc434, 0xc43c, 0xc43d, 0xc448, 0xc464, 0xc465, 0xc468, 0xc46c, + 0xc474, 0xc475, 0xc479, 0xc480, 0xc494, 0xc49c, 0xc4b8, 0xc4bc, + 0xc4e9, 0xc4f0, 0xc4f1, 0xc4f4, 0xc4f8, 0xc4fa, 0xc4ff, 0xc500, + 0xc501, 0xc50c, 0xc510, 0xc514, 0xc51c, 0xc528, 0xc529, 0xc52c, + 0xc530, 0xc538, 0xc539, 0xc53b, 0xc53d, 0xc544, 0xc545, 0xc548, + 0xc549, 0xc54a, 0xc54c, 0xc54d, 0xc54e, 0xc553, 0xc554, 0xc555, + 0xc557, 0xc558, 0xc559, 0xc55d, 0xc55e, 0xc560, 0xc561, 0xc564, + 0xc568, 0xc570, 0xc571, 0xc573, 0xc574, 0xc575, 0xc57c, 0xc57d, + 0xc580, 0xc584, 0xc587, 0xc58c, 0xc58d, 0xc58f, 0xc591, 0xc595, + 0xc597, 0xc598, 0xc59c, 0xc5a0, 0xc5a9, 0xc5b4, 0xc5b5, 0xc5b8, + 0xc5b9, 0xc5bb, 0xc5bc, 0xc5bd, 0xc5be, 0xc5c4, 0xc5c5, 0xc5c6, + 0xc5c7, 0xc5c8, 0xc5c9, 0xc5ca, 0xc5cc, 0xc5ce, + /* 0x3f */ + 0xc5d0, 0xc5d1, 0xc5d4, 0xc5d8, 0xc5e0, 0xc5e1, 0xc5e3, 0xc5e5, + 0xc5ec, 0xc5ed, 0xc5ee, 0xc5f0, 0xc5f4, 0xc5f6, 0xc5f7, 0xc5fc, + 0xc5fd, 0xc5fe, 0xc5ff, 0xc600, 0xc601, 0xc605, 0xc606, 0xc607, + 0xc608, 0xc60c, 0xc610, 0xc618, 0xc619, 0xc61b, 0xc61c, 0xc624, + 0xc625, 0xc628, 0xc62c, 0xc62d, 0xc62e, 0xc630, 0xc633, 0xc634, + 0xc635, 0xc637, 0xc639, 0xc63b, 0xc640, 0xc641, 0xc644, 0xc648, + 0xc650, 0xc651, 0xc653, 0xc654, 0xc655, 0xc65c, 0xc65d, 0xc660, + 0xc66c, 0xc66f, 0xc671, 0xc678, 0xc679, 0xc67c, 0xc680, 0xc688, + 0xc689, 0xc68b, 0xc68d, 0xc694, 0xc695, 0xc698, 0xc69c, 0xc6a4, + 0xc6a5, 0xc6a7, 0xc6a9, 0xc6b0, 0xc6b1, 0xc6b4, 0xc6b8, 0xc6b9, + 0xc6ba, 0xc6c0, 0xc6c1, 0xc6c3, 0xc6c5, 0xc6cc, 0xc6cd, 0xc6d0, + 0xc6d4, 0xc6dc, 0xc6dd, 0xc6e0, 0xc6e1, 0xc6e8, + /* 0x40 */ + 0xc6e9, 0xc6ec, 0xc6f0, 0xc6f8, 0xc6f9, 0xc6fd, 0xc704, 0xc705, + 0xc708, 0xc70c, 0xc714, 0xc715, 0xc717, 0xc719, 0xc720, 0xc721, + 0xc724, 0xc728, 0xc730, 0xc731, 0xc733, 0xc735, 0xc737, 0xc73c, + 0xc73d, 0xc740, 0xc744, 0xc74a, 0xc74c, 0xc74d, 0xc74f, 0xc751, + 0xc752, 0xc753, 0xc754, 0xc755, 0xc756, 0xc757, 0xc758, 0xc75c, + 0xc760, 0xc768, 0xc76b, 0xc774, 0xc775, 0xc778, 0xc77c, 0xc77d, + 0xc77e, 0xc783, 0xc784, 0xc785, 0xc787, 0xc788, 0xc789, 0xc78a, + 0xc78e, 0xc790, 0xc791, 0xc794, 0xc796, 0xc797, 0xc798, 0xc79a, + 0xc7a0, 0xc7a1, 0xc7a3, 0xc7a4, 0xc7a5, 0xc7a6, 0xc7ac, 0xc7ad, + 0xc7b0, 0xc7b4, 0xc7bc, 0xc7bd, 0xc7bf, 0xc7c0, 0xc7c1, 0xc7c8, + 0xc7c9, 0xc7cc, 0xc7ce, 0xc7d0, 0xc7d8, 0xc7dd, 0xc7e4, 0xc7e8, + 0xc7ec, 0xc800, 0xc801, 0xc804, 0xc808, 0xc80a, + /* 0x41 */ + 0xc810, 0xc811, 0xc813, 0xc815, 0xc816, 0xc81c, 0xc81d, 0xc820, + 0xc824, 0xc82c, 0xc82d, 0xc82f, 0xc831, 0xc838, 0xc83c, 0xc840, + 0xc848, 0xc849, 0xc84c, 0xc84d, 0xc854, 0xc870, 0xc871, 0xc874, + 0xc878, 0xc87a, 0xc880, 0xc881, 0xc883, 0xc885, 0xc886, 0xc887, + 0xc88b, 0xc88c, 0xc88d, 0xc894, 0xc89d, 0xc89f, 0xc8a1, 0xc8a8, + 0xc8bc, 0xc8bd, 0xc8c4, 0xc8c8, 0xc8cc, 0xc8d4, 0xc8d5, 0xc8d7, + 0xc8d9, 0xc8e0, 0xc8e1, 0xc8e4, 0xc8f5, 0xc8fc, 0xc8fd, 0xc900, + 0xc904, 0xc905, 0xc906, 0xc90c, 0xc90d, 0xc90f, 0xc911, 0xc918, + 0xc92c, 0xc934, 0xc950, 0xc951, 0xc954, 0xc958, 0xc960, 0xc961, + 0xc963, 0xc96c, 0xc970, 0xc974, 0xc97c, 0xc988, 0xc989, 0xc98c, + 0xc990, 0xc998, 0xc999, 0xc99b, 0xc99d, 0xc9c0, 0xc9c1, 0xc9c4, + 0xc9c7, 0xc9c8, 0xc9ca, 0xc9d0, 0xc9d1, 0xc9d3, + /* 0x42 */ + 0xc9d5, 0xc9d6, 0xc9d9, 0xc9da, 0xc9dc, 0xc9dd, 0xc9e0, 0xc9e2, + 0xc9e4, 0xc9e7, 0xc9ec, 0xc9ed, 0xc9ef, 0xc9f0, 0xc9f1, 0xc9f8, + 0xc9f9, 0xc9fc, 0xca00, 0xca08, 0xca09, 0xca0b, 0xca0c, 0xca0d, + 0xca14, 0xca18, 0xca29, 0xca4c, 0xca4d, 0xca50, 0xca54, 0xca5c, + 0xca5d, 0xca5f, 0xca60, 0xca61, 0xca68, 0xca7d, 0xca84, 0xca98, + 0xcabc, 0xcabd, 0xcac0, 0xcac4, 0xcacc, 0xcacd, 0xcacf, 0xcad1, + 0xcad3, 0xcad8, 0xcad9, 0xcae0, 0xcaec, 0xcaf4, 0xcb08, 0xcb10, + 0xcb14, 0xcb18, 0xcb20, 0xcb21, 0xcb41, 0xcb48, 0xcb49, 0xcb4c, + 0xcb50, 0xcb58, 0xcb59, 0xcb5d, 0xcb64, 0xcb78, 0xcb79, 0xcb9c, + 0xcbb8, 0xcbd4, 0xcbe4, 0xcbe7, 0xcbe9, 0xcc0c, 0xcc0d, 0xcc10, + 0xcc14, 0xcc1c, 0xcc1d, 0xcc21, 0xcc22, 0xcc27, 0xcc28, 0xcc29, + 0xcc2c, 0xcc2e, 0xcc30, 0xcc38, 0xcc39, 0xcc3b, + /* 0x43 */ + 0xcc3c, 0xcc3d, 0xcc3e, 0xcc44, 0xcc45, 0xcc48, 0xcc4c, 0xcc54, + 0xcc55, 0xcc57, 0xcc58, 0xcc59, 0xcc60, 0xcc64, 0xcc66, 0xcc68, + 0xcc70, 0xcc75, 0xcc98, 0xcc99, 0xcc9c, 0xcca0, 0xcca8, 0xcca9, + 0xccab, 0xccac, 0xccad, 0xccb4, 0xccb5, 0xccb8, 0xccbc, 0xccc4, + 0xccc5, 0xccc7, 0xccc9, 0xccd0, 0xccd4, 0xcce4, 0xccec, 0xccf0, + 0xcd01, 0xcd08, 0xcd09, 0xcd0c, 0xcd10, 0xcd18, 0xcd19, 0xcd1b, + 0xcd1d, 0xcd24, 0xcd28, 0xcd2c, 0xcd39, 0xcd5c, 0xcd60, 0xcd64, + 0xcd6c, 0xcd6d, 0xcd6f, 0xcd71, 0xcd78, 0xcd88, 0xcd94, 0xcd95, + 0xcd98, 0xcd9c, 0xcda4, 0xcda5, 0xcda7, 0xcda9, 0xcdb0, 0xcdc4, + 0xcdcc, 0xcdd0, 0xcde8, 0xcdec, 0xcdf0, 0xcdf8, 0xcdf9, 0xcdfb, + 0xcdfd, 0xce04, 0xce08, 0xce0c, 0xce14, 0xce19, 0xce20, 0xce21, + 0xce24, 0xce28, 0xce30, 0xce31, 0xce33, 0xce35, + /* 0x44 */ + 0xce58, 0xce59, 0xce5c, 0xce5f, 0xce60, 0xce61, 0xce68, 0xce69, + 0xce6b, 0xce6d, 0xce74, 0xce75, 0xce78, 0xce7c, 0xce84, 0xce85, + 0xce87, 0xce89, 0xce90, 0xce91, 0xce94, 0xce98, 0xcea0, 0xcea1, + 0xcea3, 0xcea4, 0xcea5, 0xceac, 0xcead, 0xcec1, 0xcee4, 0xcee5, + 0xcee8, 0xceeb, 0xceec, 0xcef4, 0xcef5, 0xcef7, 0xcef8, 0xcef9, + 0xcf00, 0xcf01, 0xcf04, 0xcf08, 0xcf10, 0xcf11, 0xcf13, 0xcf15, + 0xcf1c, 0xcf20, 0xcf24, 0xcf2c, 0xcf2d, 0xcf2f, 0xcf30, 0xcf31, + 0xcf38, 0xcf54, 0xcf55, 0xcf58, 0xcf5c, 0xcf64, 0xcf65, 0xcf67, + 0xcf69, 0xcf70, 0xcf71, 0xcf74, 0xcf78, 0xcf80, 0xcf85, 0xcf8c, + 0xcfa1, 0xcfa8, 0xcfb0, 0xcfc4, 0xcfe0, 0xcfe1, 0xcfe4, 0xcfe8, + 0xcff0, 0xcff1, 0xcff3, 0xcff5, 0xcffc, 0xd000, 0xd004, 0xd011, + 0xd018, 0xd02d, 0xd034, 0xd035, 0xd038, 0xd03c, + /* 0x45 */ + 0xd044, 0xd045, 0xd047, 0xd049, 0xd050, 0xd054, 0xd058, 0xd060, + 0xd06c, 0xd06d, 0xd070, 0xd074, 0xd07c, 0xd07d, 0xd081, 0xd0a4, + 0xd0a5, 0xd0a8, 0xd0ac, 0xd0b4, 0xd0b5, 0xd0b7, 0xd0b9, 0xd0c0, + 0xd0c1, 0xd0c4, 0xd0c8, 0xd0c9, 0xd0d0, 0xd0d1, 0xd0d3, 0xd0d4, + 0xd0d5, 0xd0dc, 0xd0dd, 0xd0e0, 0xd0e4, 0xd0ec, 0xd0ed, 0xd0ef, + 0xd0f0, 0xd0f1, 0xd0f8, 0xd10d, 0xd130, 0xd131, 0xd134, 0xd138, + 0xd13a, 0xd140, 0xd141, 0xd143, 0xd144, 0xd145, 0xd14c, 0xd14d, + 0xd150, 0xd154, 0xd15c, 0xd15d, 0xd15f, 0xd161, 0xd168, 0xd16c, + 0xd17c, 0xd184, 0xd188, 0xd1a0, 0xd1a1, 0xd1a4, 0xd1a8, 0xd1b0, + 0xd1b1, 0xd1b3, 0xd1b5, 0xd1ba, 0xd1bc, 0xd1c0, 0xd1d8, 0xd1f4, + 0xd1f8, 0xd207, 0xd209, 0xd210, 0xd22c, 0xd22d, 0xd230, 0xd234, + 0xd23c, 0xd23d, 0xd23f, 0xd241, 0xd248, 0xd25c, + /* 0x46 */ + 0xd264, 0xd280, 0xd281, 0xd284, 0xd288, 0xd290, 0xd291, 0xd295, + 0xd29c, 0xd2a0, 0xd2a4, 0xd2ac, 0xd2b1, 0xd2b8, 0xd2b9, 0xd2bc, + 0xd2bf, 0xd2c0, 0xd2c2, 0xd2c8, 0xd2c9, 0xd2cb, 0xd2d4, 0xd2d8, + 0xd2dc, 0xd2e4, 0xd2e5, 0xd2f0, 0xd2f1, 0xd2f4, 0xd2f8, 0xd300, + 0xd301, 0xd303, 0xd305, 0xd30c, 0xd30d, 0xd30e, 0xd310, 0xd314, + 0xd316, 0xd31c, 0xd31d, 0xd31f, 0xd320, 0xd321, 0xd325, 0xd328, + 0xd329, 0xd32c, 0xd330, 0xd338, 0xd339, 0xd33b, 0xd33c, 0xd33d, + 0xd344, 0xd345, 0xd37c, 0xd37d, 0xd380, 0xd384, 0xd38c, 0xd38d, + 0xd38f, 0xd390, 0xd391, 0xd398, 0xd399, 0xd39c, 0xd3a0, 0xd3a8, + 0xd3a9, 0xd3ab, 0xd3ad, 0xd3b4, 0xd3b8, 0xd3bc, 0xd3c4, 0xd3c5, + 0xd3c8, 0xd3c9, 0xd3d0, 0xd3d8, 0xd3e1, 0xd3e3, 0xd3ec, 0xd3ed, + 0xd3f0, 0xd3f4, 0xd3fc, 0xd3fd, 0xd3ff, 0xd401, + /* 0x47 */ + 0xd408, 0xd41d, 0xd440, 0xd444, 0xd45c, 0xd460, 0xd464, 0xd46d, + 0xd46f, 0xd478, 0xd479, 0xd47c, 0xd47f, 0xd480, 0xd482, 0xd488, + 0xd489, 0xd48b, 0xd48d, 0xd494, 0xd4a9, 0xd4cc, 0xd4d0, 0xd4d4, + 0xd4dc, 0xd4df, 0xd4e8, 0xd4ec, 0xd4f0, 0xd4f8, 0xd4fb, 0xd4fd, + 0xd504, 0xd508, 0xd50c, 0xd514, 0xd515, 0xd517, 0xd53c, 0xd53d, + 0xd540, 0xd544, 0xd54c, 0xd54d, 0xd54f, 0xd551, 0xd558, 0xd559, + 0xd55c, 0xd560, 0xd565, 0xd568, 0xd569, 0xd56b, 0xd56d, 0xd574, + 0xd575, 0xd578, 0xd57c, 0xd584, 0xd585, 0xd587, 0xd588, 0xd589, + 0xd590, 0xd5a5, 0xd5c8, 0xd5c9, 0xd5cc, 0xd5d0, 0xd5d2, 0xd5d8, + 0xd5d9, 0xd5db, 0xd5dd, 0xd5e4, 0xd5e5, 0xd5e8, 0xd5ec, 0xd5f4, + 0xd5f5, 0xd5f7, 0xd5f9, 0xd600, 0xd601, 0xd604, 0xd608, 0xd610, + 0xd611, 0xd613, 0xd614, 0xd615, 0xd61c, 0xd620, + /* 0x48 */ + 0xd624, 0xd62d, 0xd638, 0xd639, 0xd63c, 0xd640, 0xd645, 0xd648, + 0xd649, 0xd64b, 0xd64d, 0xd651, 0xd654, 0xd655, 0xd658, 0xd65c, + 0xd667, 0xd669, 0xd670, 0xd671, 0xd674, 0xd683, 0xd685, 0xd68c, + 0xd68d, 0xd690, 0xd694, 0xd69d, 0xd69f, 0xd6a1, 0xd6a8, 0xd6ac, + 0xd6b0, 0xd6b9, 0xd6bb, 0xd6c4, 0xd6c5, 0xd6c8, 0xd6cc, 0xd6d1, + 0xd6d4, 0xd6d7, 0xd6d9, 0xd6e0, 0xd6e4, 0xd6e8, 0xd6f0, 0xd6f5, + 0xd6fc, 0xd6fd, 0xd700, 0xd704, 0xd711, 0xd718, 0xd719, 0xd71c, + 0xd720, 0xd728, 0xd729, 0xd72b, 0xd72d, 0xd734, 0xd735, 0xd738, + 0xd73c, 0xd744, 0xd747, 0xd749, 0xd750, 0xd751, 0xd754, 0xd756, + 0xd757, 0xd758, 0xd759, 0xd760, 0xd761, 0xd763, 0xd765, 0xd769, + 0xd76c, 0xd770, 0xd774, 0xd77c, 0xd77d, 0xd781, 0xd788, 0xd789, + 0xd78c, 0xd790, 0xd798, 0xd799, 0xd79b, 0xd79d, +}; +static const unsigned short ksc5601_2uni_page4a[4888] = { + /* 0x4a */ + 0x4f3d, 0x4f73, 0x5047, 0x50f9, 0x52a0, 0x53ef, 0x5475, 0x54e5, + 0x5609, 0x5ac1, 0x5bb6, 0x6687, 0x67b6, 0x67b7, 0x67ef, 0x6b4c, + 0x73c2, 0x75c2, 0x7a3c, 0x82db, 0x8304, 0x8857, 0x8888, 0x8a36, + 0x8cc8, 0x8dcf, 0x8efb, 0x8fe6, 0x99d5, 0x523b, 0x5374, 0x5404, + 0x606a, 0x6164, 0x6bbc, 0x73cf, 0x811a, 0x89ba, 0x89d2, 0x95a3, + 0x4f83, 0x520a, 0x58be, 0x5978, 0x59e6, 0x5e72, 0x5e79, 0x61c7, + 0x63c0, 0x6746, 0x67ec, 0x687f, 0x6f97, 0x764e, 0x770b, 0x78f5, + 0x7a08, 0x7aff, 0x7c21, 0x809d, 0x826e, 0x8271, 0x8aeb, 0x9593, + 0x4e6b, 0x559d, 0x66f7, 0x6e34, 0x78a3, 0x7aed, 0x845b, 0x8910, + 0x874e, 0x97a8, 0x52d8, 0x574e, 0x582a, 0x5d4c, 0x611f, 0x61be, + 0x6221, 0x6562, 0x67d1, 0x6a44, 0x6e1b, 0x7518, 0x75b3, 0x76e3, + 0x77b0, 0x7d3a, 0x90af, 0x9451, 0x9452, 0x9f95, + /* 0x4b */ + 0x5323, 0x5cac, 0x7532, 0x80db, 0x9240, 0x9598, 0x525b, 0x5808, + 0x59dc, 0x5ca1, 0x5d17, 0x5eb7, 0x5f3a, 0x5f4a, 0x6177, 0x6c5f, + 0x757a, 0x7586, 0x7ce0, 0x7d73, 0x7db1, 0x7f8c, 0x8154, 0x8221, + 0x8591, 0x8941, 0x8b1b, 0x92fc, 0x964d, 0x9c47, 0x4ecb, 0x4ef7, + 0x500b, 0x51f1, 0x584f, 0x6137, 0x613e, 0x6168, 0x6539, 0x69ea, + 0x6f11, 0x75a5, 0x7686, 0x76d6, 0x7b87, 0x82a5, 0x84cb, 0xf900, + 0x93a7, 0x958b, 0x5580, 0x5ba2, 0x5751, 0xf901, 0x7cb3, 0x7fb9, + 0x91b5, 0x5028, 0x53bb, 0x5c45, 0x5de8, 0x62d2, 0x636e, 0x64da, + 0x64e7, 0x6e20, 0x70ac, 0x795b, 0x8ddd, 0x8e1e, 0xf902, 0x907d, + 0x9245, 0x92f8, 0x4e7e, 0x4ef6, 0x5065, 0x5dfe, 0x5efa, 0x6106, + 0x6957, 0x8171, 0x8654, 0x8e47, 0x9375, 0x9a2b, 0x4e5e, 0x5091, + 0x6770, 0x6840, 0x5109, 0x528d, 0x5292, 0x6aa2, + /* 0x4c */ + 0x77bc, 0x9210, 0x9ed4, 0x52ab, 0x602f, 0x8ff2, 0x5048, 0x61a9, + 0x63ed, 0x64ca, 0x683c, 0x6a84, 0x6fc0, 0x8188, 0x89a1, 0x9694, + 0x5805, 0x727d, 0x72ac, 0x7504, 0x7d79, 0x7e6d, 0x80a9, 0x898b, + 0x8b74, 0x9063, 0x9d51, 0x6289, 0x6c7a, 0x6f54, 0x7d50, 0x7f3a, + 0x8a23, 0x517c, 0x614a, 0x7b9d, 0x8b19, 0x9257, 0x938c, 0x4eac, + 0x4fd3, 0x501e, 0x50be, 0x5106, 0x52c1, 0x52cd, 0x537f, 0x5770, + 0x5883, 0x5e9a, 0x5f91, 0x6176, 0x61ac, 0x64ce, 0x656c, 0x666f, + 0x66bb, 0x66f4, 0x6897, 0x6d87, 0x7085, 0x70f1, 0x749f, 0x74a5, + 0x74ca, 0x75d9, 0x786c, 0x78ec, 0x7adf, 0x7af6, 0x7d45, 0x7d93, + 0x8015, 0x803f, 0x811b, 0x8396, 0x8b66, 0x8f15, 0x9015, 0x93e1, + 0x9803, 0x9838, 0x9a5a, 0x9be8, 0x4fc2, 0x5553, 0x583a, 0x5951, + 0x5b63, 0x5c46, 0x60b8, 0x6212, 0x6842, 0x68b0, + /* 0x4d */ + 0x68e8, 0x6eaa, 0x754c, 0x7678, 0x78ce, 0x7a3d, 0x7cfb, 0x7e6b, + 0x7e7c, 0x8a08, 0x8aa1, 0x8c3f, 0x968e, 0x9dc4, 0x53e4, 0x53e9, + 0x544a, 0x5471, 0x56fa, 0x59d1, 0x5b64, 0x5c3b, 0x5eab, 0x62f7, + 0x6537, 0x6545, 0x6572, 0x66a0, 0x67af, 0x69c1, 0x6cbd, 0x75fc, + 0x7690, 0x777e, 0x7a3f, 0x7f94, 0x8003, 0x80a1, 0x818f, 0x82e6, + 0x82fd, 0x83f0, 0x85c1, 0x8831, 0x88b4, 0x8aa5, 0xf903, 0x8f9c, + 0x932e, 0x96c7, 0x9867, 0x9ad8, 0x9f13, 0x54ed, 0x659b, 0x66f2, + 0x688f, 0x7a40, 0x8c37, 0x9d60, 0x56f0, 0x5764, 0x5d11, 0x6606, + 0x68b1, 0x68cd, 0x6efe, 0x7428, 0x889e, 0x9be4, 0x6c68, 0xf904, + 0x9aa8, 0x4f9b, 0x516c, 0x5171, 0x529f, 0x5b54, 0x5de5, 0x6050, + 0x606d, 0x62f1, 0x63a7, 0x653b, 0x73d9, 0x7a7a, 0x86a3, 0x8ca2, + 0x978f, 0x4e32, 0x5be1, 0x6208, 0x679c, 0x74dc, + /* 0x4e */ + 0x79d1, 0x83d3, 0x8a87, 0x8ab2, 0x8de8, 0x904e, 0x934b, 0x9846, + 0x5ed3, 0x69e8, 0x85ff, 0x90ed, 0xf905, 0x51a0, 0x5b98, 0x5bec, + 0x6163, 0x68fa, 0x6b3e, 0x704c, 0x742f, 0x74d8, 0x7ba1, 0x7f50, + 0x83c5, 0x89c0, 0x8cab, 0x95dc, 0x9928, 0x522e, 0x605d, 0x62ec, + 0x9002, 0x4f8a, 0x5149, 0x5321, 0x58d9, 0x5ee3, 0x66e0, 0x6d38, + 0x709a, 0x72c2, 0x73d6, 0x7b50, 0x80f1, 0x945b, 0x5366, 0x639b, + 0x7f6b, 0x4e56, 0x5080, 0x584a, 0x58de, 0x602a, 0x6127, 0x62d0, + 0x69d0, 0x9b41, 0x5b8f, 0x7d18, 0x80b1, 0x8f5f, 0x4ea4, 0x50d1, + 0x54ac, 0x55ac, 0x5b0c, 0x5da0, 0x5de7, 0x652a, 0x654e, 0x6821, + 0x6a4b, 0x72e1, 0x768e, 0x77ef, 0x7d5e, 0x7ff9, 0x81a0, 0x854e, + 0x86df, 0x8f03, 0x8f4e, 0x90ca, 0x9903, 0x9a55, 0x9bab, 0x4e18, + 0x4e45, 0x4e5d, 0x4ec7, 0x4ff1, 0x5177, 0x52fe, + /* 0x4f */ + 0x5340, 0x53e3, 0x53e5, 0x548e, 0x5614, 0x5775, 0x57a2, 0x5bc7, + 0x5d87, 0x5ed0, 0x61fc, 0x62d8, 0x6551, 0x67b8, 0x67e9, 0x69cb, + 0x6b50, 0x6bc6, 0x6bec, 0x6c42, 0x6e9d, 0x7078, 0x72d7, 0x7396, + 0x7403, 0x77bf, 0x77e9, 0x7a76, 0x7d7f, 0x8009, 0x81fc, 0x8205, + 0x820a, 0x82df, 0x8862, 0x8b33, 0x8cfc, 0x8ec0, 0x9011, 0x90b1, + 0x9264, 0x92b6, 0x99d2, 0x9a45, 0x9ce9, 0x9dd7, 0x9f9c, 0x570b, + 0x5c40, 0x83ca, 0x97a0, 0x97ab, 0x9eb4, 0x541b, 0x7a98, 0x7fa4, + 0x88d9, 0x8ecd, 0x90e1, 0x5800, 0x5c48, 0x6398, 0x7a9f, 0x5bae, + 0x5f13, 0x7a79, 0x7aae, 0x828e, 0x8eac, 0x5026, 0x5238, 0x52f8, + 0x5377, 0x5708, 0x62f3, 0x6372, 0x6b0a, 0x6dc3, 0x7737, 0x53a5, + 0x7357, 0x8568, 0x8e76, 0x95d5, 0x673a, 0x6ac3, 0x6f70, 0x8a6d, + 0x8ecc, 0x994b, 0xf906, 0x6677, 0x6b78, 0x8cb4, + /* 0x50 */ + 0x9b3c, 0xf907, 0x53eb, 0x572d, 0x594e, 0x63c6, 0x69fb, 0x73ea, + 0x7845, 0x7aba, 0x7ac5, 0x7cfe, 0x8475, 0x898f, 0x8d73, 0x9035, + 0x95a8, 0x52fb, 0x5747, 0x7547, 0x7b60, 0x83cc, 0x921e, 0xf908, + 0x6a58, 0x514b, 0x524b, 0x5287, 0x621f, 0x68d8, 0x6975, 0x9699, + 0x50c5, 0x52a4, 0x52e4, 0x61c3, 0x65a4, 0x6839, 0x69ff, 0x747e, + 0x7b4b, 0x82b9, 0x83eb, 0x89b2, 0x8b39, 0x8fd1, 0x9949, 0xf909, + 0x4eca, 0x5997, 0x64d2, 0x6611, 0x6a8e, 0x7434, 0x7981, 0x79bd, + 0x82a9, 0x887e, 0x887f, 0x895f, 0xf90a, 0x9326, 0x4f0b, 0x53ca, + 0x6025, 0x6271, 0x6c72, 0x7d1a, 0x7d66, 0x4e98, 0x5162, 0x77dc, + 0x80af, 0x4f01, 0x4f0e, 0x5176, 0x5180, 0x55dc, 0x5668, 0x573b, + 0x57fa, 0x57fc, 0x5914, 0x5947, 0x5993, 0x5bc4, 0x5c90, 0x5d0e, + 0x5df1, 0x5e7e, 0x5fcc, 0x6280, 0x65d7, 0x65e3, + /* 0x51 */ + 0x671e, 0x671f, 0x675e, 0x68cb, 0x68c4, 0x6a5f, 0x6b3a, 0x6c23, + 0x6c7d, 0x6c82, 0x6dc7, 0x7398, 0x7426, 0x742a, 0x7482, 0x74a3, + 0x7578, 0x757f, 0x7881, 0x78ef, 0x7941, 0x7947, 0x7948, 0x797a, + 0x7b95, 0x7d00, 0x7dba, 0x7f88, 0x8006, 0x802d, 0x808c, 0x8a18, + 0x8b4f, 0x8c48, 0x8d77, 0x9321, 0x9324, 0x98e2, 0x9951, 0x9a0e, + 0x9a0f, 0x9a65, 0x9e92, 0x7dca, 0x4f76, 0x5409, 0x62ee, 0x6854, + 0x91d1, 0x55ab, 0x513a, 0xf90b, 0xf90c, 0x5a1c, 0x61e6, 0xf90d, + 0x62cf, 0x62ff, 0xf90e, 0xf90f, 0xf910, 0xf911, 0xf912, 0xf913, + 0x90a3, 0xf914, 0xf915, 0xf916, 0xf917, 0xf918, 0x8afe, 0xf919, + 0xf91a, 0xf91b, 0xf91c, 0x6696, 0xf91d, 0x7156, 0xf91e, 0xf91f, + 0x96e3, 0xf920, 0x634f, 0x637a, 0x5357, 0xf921, 0x678f, 0x6960, + 0x6e73, 0xf922, 0x7537, 0xf923, 0xf924, 0xf925, + /* 0x52 */ + 0x7d0d, 0xf926, 0xf927, 0x8872, 0x56ca, 0x5a18, 0xf928, 0xf929, + 0xf92a, 0xf92b, 0xf92c, 0x4e43, 0xf92d, 0x5167, 0x5948, 0x67f0, + 0x8010, 0xf92e, 0x5973, 0x5e74, 0x649a, 0x79ca, 0x5ff5, 0x606c, + 0x62c8, 0x637b, 0x5be7, 0x5bd7, 0x52aa, 0xf92f, 0x5974, 0x5f29, + 0x6012, 0xf930, 0xf931, 0xf932, 0x7459, 0xf933, 0xf934, 0xf935, + 0xf936, 0xf937, 0xf938, 0x99d1, 0xf939, 0xf93a, 0xf93b, 0xf93c, + 0xf93d, 0xf93e, 0xf93f, 0xf940, 0xf941, 0xf942, 0xf943, 0x6fc3, + 0xf944, 0xf945, 0x81bf, 0x8fb2, 0x60f1, 0xf946, 0xf947, 0x8166, + 0xf948, 0xf949, 0x5c3f, 0xf94a, 0xf94b, 0xf94c, 0xf94d, 0xf94e, + 0xf94f, 0xf950, 0xf951, 0x5ae9, 0x8a25, 0x677b, 0x7d10, 0xf952, + 0xf953, 0xf954, 0xf955, 0xf956, 0xf957, 0x80fd, 0xf958, 0xf959, + 0x5c3c, 0x6ce5, 0x533f, 0x6eba, 0x591a, 0x8336, + /* 0x53 */ + 0x4e39, 0x4eb6, 0x4f46, 0x55ae, 0x5718, 0x58c7, 0x5f56, 0x65b7, + 0x65e6, 0x6a80, 0x6bb5, 0x6e4d, 0x77ed, 0x7aef, 0x7c1e, 0x7dde, + 0x86cb, 0x8892, 0x9132, 0x935b, 0x64bb, 0x6fbe, 0x737a, 0x75b8, + 0x9054, 0x5556, 0x574d, 0x61ba, 0x64d4, 0x66c7, 0x6de1, 0x6e5b, + 0x6f6d, 0x6fb9, 0x75f0, 0x8043, 0x81bd, 0x8541, 0x8983, 0x8ac7, + 0x8b5a, 0x931f, 0x6c93, 0x7553, 0x7b54, 0x8e0f, 0x905d, 0x5510, + 0x5802, 0x5858, 0x5e62, 0x6207, 0x649e, 0x68e0, 0x7576, 0x7cd6, + 0x87b3, 0x9ee8, 0x4ee3, 0x5788, 0x576e, 0x5927, 0x5c0d, 0x5cb1, + 0x5e36, 0x5f85, 0x6234, 0x64e1, 0x73b3, 0x81fa, 0x888b, 0x8cb8, + 0x968a, 0x9edb, 0x5b85, 0x5fb7, 0x60b3, 0x5012, 0x5200, 0x5230, + 0x5716, 0x5835, 0x5857, 0x5c0e, 0x5c60, 0x5cf6, 0x5d8b, 0x5ea6, + 0x5f92, 0x60bc, 0x6311, 0x6389, 0x6417, 0x6843, + /* 0x54 */ + 0x68f9, 0x6ac2, 0x6dd8, 0x6e21, 0x6ed4, 0x6fe4, 0x71fe, 0x76dc, + 0x7779, 0x79b1, 0x7a3b, 0x8404, 0x89a9, 0x8ced, 0x8df3, 0x8e48, + 0x9003, 0x9014, 0x9053, 0x90fd, 0x934d, 0x9676, 0x97dc, 0x6bd2, + 0x7006, 0x7258, 0x72a2, 0x7368, 0x7763, 0x79bf, 0x7be4, 0x7e9b, + 0x8b80, 0x58a9, 0x60c7, 0x6566, 0x65fd, 0x66be, 0x6c8c, 0x711e, + 0x71c9, 0x8c5a, 0x9813, 0x4e6d, 0x7a81, 0x4edd, 0x51ac, 0x51cd, + 0x52d5, 0x540c, 0x61a7, 0x6771, 0x6850, 0x68df, 0x6d1e, 0x6f7c, + 0x75bc, 0x77b3, 0x7ae5, 0x80f4, 0x8463, 0x9285, 0x515c, 0x6597, + 0x675c, 0x6793, 0x75d8, 0x7ac7, 0x8373, 0xf95a, 0x8c46, 0x9017, + 0x982d, 0x5c6f, 0x81c0, 0x829a, 0x9041, 0x906f, 0x920d, 0x5f97, + 0x5d9d, 0x6a59, 0x71c8, 0x767b, 0x7b49, 0x85e4, 0x8b04, 0x9127, + 0x9a30, 0x5587, 0x61f6, 0xf95b, 0x7669, 0x7f85, + /* 0x55 */ + 0x863f, 0x87ba, 0x88f8, 0x908f, 0xf95c, 0x6d1b, 0x70d9, 0x73de, + 0x7d61, 0x843d, 0xf95d, 0x916a, 0x99f1, 0xf95e, 0x4e82, 0x5375, + 0x6b04, 0x6b12, 0x703e, 0x721b, 0x862d, 0x9e1e, 0x524c, 0x8fa3, + 0x5d50, 0x64e5, 0x652c, 0x6b16, 0x6feb, 0x7c43, 0x7e9c, 0x85cd, + 0x8964, 0x89bd, 0x62c9, 0x81d8, 0x881f, 0x5eca, 0x6717, 0x6d6a, + 0x72fc, 0x7405, 0x746f, 0x8782, 0x90de, 0x4f86, 0x5d0d, 0x5fa0, + 0x840a, 0x51b7, 0x63a0, 0x7565, 0x4eae, 0x5006, 0x5169, 0x51c9, + 0x6881, 0x6a11, 0x7cae, 0x7cb1, 0x7ce7, 0x826f, 0x8ad2, 0x8f1b, + 0x91cf, 0x4fb6, 0x5137, 0x52f5, 0x5442, 0x5eec, 0x616e, 0x623e, + 0x65c5, 0x6ada, 0x6ffe, 0x792a, 0x85dc, 0x8823, 0x95ad, 0x9a62, + 0x9a6a, 0x9e97, 0x9ece, 0x529b, 0x66c6, 0x6b77, 0x701d, 0x792b, + 0x8f62, 0x9742, 0x6190, 0x6200, 0x6523, 0x6f23, + /* 0x56 */ + 0x7149, 0x7489, 0x7df4, 0x806f, 0x84ee, 0x8f26, 0x9023, 0x934a, + 0x51bd, 0x5217, 0x52a3, 0x6d0c, 0x70c8, 0x88c2, 0x5ec9, 0x6582, + 0x6bae, 0x6fc2, 0x7c3e, 0x7375, 0x4ee4, 0x4f36, 0x56f9, 0xf95f, + 0x5cba, 0x5dba, 0x601c, 0x73b2, 0x7b2d, 0x7f9a, 0x7fce, 0x8046, + 0x901e, 0x9234, 0x96f6, 0x9748, 0x9818, 0x9f61, 0x4f8b, 0x6fa7, + 0x79ae, 0x91b4, 0x96b7, 0x52de, 0xf960, 0x6488, 0x64c4, 0x6ad3, + 0x6f5e, 0x7018, 0x7210, 0x76e7, 0x8001, 0x8606, 0x865c, 0x8def, + 0x8f05, 0x9732, 0x9b6f, 0x9dfa, 0x9e75, 0x788c, 0x797f, 0x7da0, + 0x83c9, 0x9304, 0x9e7f, 0x9e93, 0x8ad6, 0x58df, 0x5f04, 0x6727, + 0x7027, 0x74cf, 0x7c60, 0x807e, 0x5121, 0x7028, 0x7262, 0x78ca, + 0x8cc2, 0x8cda, 0x8cf4, 0x96f7, 0x4e86, 0x50da, 0x5bee, 0x5ed6, + 0x6599, 0x71ce, 0x7642, 0x77ad, 0x804a, 0x84fc, + /* 0x57 */ + 0x907c, 0x9b27, 0x9f8d, 0x58d8, 0x5a41, 0x5c62, 0x6a13, 0x6dda, + 0x6f0f, 0x763b, 0x7d2f, 0x7e37, 0x851e, 0x8938, 0x93e4, 0x964b, + 0x5289, 0x65d2, 0x67f3, 0x69b4, 0x6d41, 0x6e9c, 0x700f, 0x7409, + 0x7460, 0x7559, 0x7624, 0x786b, 0x8b2c, 0x985e, 0x516d, 0x622e, + 0x9678, 0x4f96, 0x502b, 0x5d19, 0x6dea, 0x7db8, 0x8f2a, 0x5f8b, + 0x6144, 0x6817, 0xf961, 0x9686, 0x52d2, 0x808b, 0x51dc, 0x51cc, + 0x695e, 0x7a1c, 0x7dbe, 0x83f1, 0x9675, 0x4fda, 0x5229, 0x5398, + 0x540f, 0x550e, 0x5c65, 0x60a7, 0x674e, 0x68a8, 0x6d6c, 0x7281, + 0x72f8, 0x7406, 0x7483, 0xf962, 0x75e2, 0x7c6c, 0x7f79, 0x7fb8, + 0x8389, 0x88cf, 0x88e1, 0x91cc, 0x91d0, 0x96e2, 0x9bc9, 0x541d, + 0x6f7e, 0x71d0, 0x7498, 0x85fa, 0x8eaa, 0x96a3, 0x9c57, 0x9e9f, + 0x6797, 0x6dcb, 0x7433, 0x81e8, 0x9716, 0x782c, + /* 0x58 */ + 0x7acb, 0x7b20, 0x7c92, 0x6469, 0x746a, 0x75f2, 0x78bc, 0x78e8, + 0x99ac, 0x9b54, 0x9ebb, 0x5bde, 0x5e55, 0x6f20, 0x819c, 0x83ab, + 0x9088, 0x4e07, 0x534d, 0x5a29, 0x5dd2, 0x5f4e, 0x6162, 0x633d, + 0x6669, 0x66fc, 0x6eff, 0x6f2b, 0x7063, 0x779e, 0x842c, 0x8513, + 0x883b, 0x8f13, 0x9945, 0x9c3b, 0x551c, 0x62b9, 0x672b, 0x6cab, + 0x8309, 0x896a, 0x977a, 0x4ea1, 0x5984, 0x5fd8, 0x5fd9, 0x671b, + 0x7db2, 0x7f54, 0x8292, 0x832b, 0x83bd, 0x8f1e, 0x9099, 0x57cb, + 0x59b9, 0x5a92, 0x5bd0, 0x6627, 0x679a, 0x6885, 0x6bcf, 0x7164, + 0x7f75, 0x8cb7, 0x8ce3, 0x9081, 0x9b45, 0x8108, 0x8c8a, 0x964c, + 0x9a40, 0x9ea5, 0x5b5f, 0x6c13, 0x731b, 0x76f2, 0x76df, 0x840c, + 0x51aa, 0x8993, 0x514d, 0x5195, 0x52c9, 0x68c9, 0x6c94, 0x7704, + 0x7720, 0x7dbf, 0x7dec, 0x9762, 0x9eb5, 0x6ec5, + /* 0x59 */ + 0x8511, 0x51a5, 0x540d, 0x547d, 0x660e, 0x669d, 0x6927, 0x6e9f, + 0x76bf, 0x7791, 0x8317, 0x84c2, 0x879f, 0x9169, 0x9298, 0x9cf4, + 0x8882, 0x4fae, 0x5192, 0x52df, 0x59c6, 0x5e3d, 0x6155, 0x6478, + 0x6479, 0x66ae, 0x67d0, 0x6a21, 0x6bcd, 0x6bdb, 0x725f, 0x7261, + 0x7441, 0x7738, 0x77db, 0x8017, 0x82bc, 0x8305, 0x8b00, 0x8b28, + 0x8c8c, 0x6728, 0x6c90, 0x7267, 0x76ee, 0x7766, 0x7a46, 0x9da9, + 0x6b7f, 0x6c92, 0x5922, 0x6726, 0x8499, 0x536f, 0x5893, 0x5999, + 0x5edf, 0x63cf, 0x6634, 0x6773, 0x6e3a, 0x732b, 0x7ad7, 0x82d7, + 0x9328, 0x52d9, 0x5deb, 0x61ae, 0x61cb, 0x620a, 0x62c7, 0x64ab, + 0x65e0, 0x6959, 0x6b66, 0x6bcb, 0x7121, 0x73f7, 0x755d, 0x7e46, + 0x821e, 0x8302, 0x856a, 0x8aa3, 0x8cbf, 0x9727, 0x9d61, 0x58a8, + 0x9ed8, 0x5011, 0x520e, 0x543b, 0x554f, 0x6587, + /* 0x5a */ + 0x6c76, 0x7d0a, 0x7d0b, 0x805e, 0x868a, 0x9580, 0x96ef, 0x52ff, + 0x6c95, 0x7269, 0x5473, 0x5a9a, 0x5c3e, 0x5d4b, 0x5f4c, 0x5fae, + 0x672a, 0x68b6, 0x6963, 0x6e3c, 0x6e44, 0x7709, 0x7c73, 0x7f8e, + 0x8587, 0x8b0e, 0x8ff7, 0x9761, 0x9ef4, 0x5cb7, 0x60b6, 0x610d, + 0x61ab, 0x654f, 0x65fb, 0x65fc, 0x6c11, 0x6cef, 0x739f, 0x73c9, + 0x7de1, 0x9594, 0x5bc6, 0x871c, 0x8b10, 0x525d, 0x535a, 0x62cd, + 0x640f, 0x64b2, 0x6734, 0x6a38, 0x6cca, 0x73c0, 0x749e, 0x7b94, + 0x7c95, 0x7e1b, 0x818a, 0x8236, 0x8584, 0x8feb, 0x96f9, 0x99c1, + 0x4f34, 0x534a, 0x53cd, 0x53db, 0x62cc, 0x642c, 0x6500, 0x6591, + 0x69c3, 0x6cee, 0x6f58, 0x73ed, 0x7554, 0x7622, 0x76e4, 0x76fc, + 0x78d0, 0x78fb, 0x792c, 0x7d46, 0x822c, 0x87e0, 0x8fd4, 0x9812, + 0x98ef, 0x52c3, 0x62d4, 0x64a5, 0x6e24, 0x6f51, + /* 0x5b */ + 0x767c, 0x8dcb, 0x91b1, 0x9262, 0x9aee, 0x9b43, 0x5023, 0x508d, + 0x574a, 0x59a8, 0x5c28, 0x5e47, 0x5f77, 0x623f, 0x653e, 0x65b9, + 0x65c1, 0x6609, 0x678b, 0x699c, 0x6ec2, 0x78c5, 0x7d21, 0x80aa, + 0x8180, 0x822b, 0x82b3, 0x84a1, 0x868c, 0x8a2a, 0x8b17, 0x90a6, + 0x9632, 0x9f90, 0x500d, 0x4ff3, 0xf963, 0x57f9, 0x5f98, 0x62dc, + 0x6392, 0x676f, 0x6e43, 0x7119, 0x76c3, 0x80cc, 0x80da, 0x88f4, + 0x88f5, 0x8919, 0x8ce0, 0x8f29, 0x914d, 0x966a, 0x4f2f, 0x4f70, + 0x5e1b, 0x67cf, 0x6822, 0x767d, 0x767e, 0x9b44, 0x5e61, 0x6a0a, + 0x7169, 0x71d4, 0x756a, 0xf964, 0x7e41, 0x8543, 0x85e9, 0x98dc, + 0x4f10, 0x7b4f, 0x7f70, 0x95a5, 0x51e1, 0x5e06, 0x68b5, 0x6c3e, + 0x6c4e, 0x6cdb, 0x72af, 0x7bc4, 0x8303, 0x6cd5, 0x743a, 0x50fb, + 0x5288, 0x58c1, 0x64d8, 0x6a97, 0x74a7, 0x7656, + /* 0x5c */ + 0x78a7, 0x8617, 0x95e2, 0x9739, 0xf965, 0x535e, 0x5f01, 0x8b8a, + 0x8fa8, 0x8faf, 0x908a, 0x5225, 0x77a5, 0x9c49, 0x9f08, 0x4e19, + 0x5002, 0x5175, 0x5c5b, 0x5e77, 0x661e, 0x663a, 0x67c4, 0x68c5, + 0x70b3, 0x7501, 0x75c5, 0x79c9, 0x7add, 0x8f27, 0x9920, 0x9a08, + 0x4fdd, 0x5821, 0x5831, 0x5bf6, 0x666e, 0x6b65, 0x6d11, 0x6e7a, + 0x6f7d, 0x73e4, 0x752b, 0x83e9, 0x88dc, 0x8913, 0x8b5c, 0x8f14, + 0x4f0f, 0x50d5, 0x5310, 0x535c, 0x5b93, 0x5fa9, 0x670d, 0x798f, + 0x8179, 0x832f, 0x8514, 0x8907, 0x8986, 0x8f39, 0x8f3b, 0x99a5, + 0x9c12, 0x672c, 0x4e76, 0x4ff8, 0x5949, 0x5c01, 0x5cef, 0x5cf0, + 0x6367, 0x68d2, 0x70fd, 0x71a2, 0x742b, 0x7e2b, 0x84ec, 0x8702, + 0x9022, 0x92d2, 0x9cf3, 0x4e0d, 0x4ed8, 0x4fef, 0x5085, 0x5256, + 0x526f, 0x5426, 0x5490, 0x57e0, 0x592b, 0x5a66, + /* 0x5d */ + 0x5b5a, 0x5b75, 0x5bcc, 0x5e9c, 0xf966, 0x6276, 0x6577, 0x65a7, + 0x6d6e, 0x6ea5, 0x7236, 0x7b26, 0x7c3f, 0x7f36, 0x8150, 0x8151, + 0x819a, 0x8240, 0x8299, 0x83a9, 0x8a03, 0x8ca0, 0x8ce6, 0x8cfb, + 0x8d74, 0x8dba, 0x90e8, 0x91dc, 0x961c, 0x9644, 0x99d9, 0x9ce7, + 0x5317, 0x5206, 0x5429, 0x5674, 0x58b3, 0x5954, 0x596e, 0x5fff, + 0x61a4, 0x626e, 0x6610, 0x6c7e, 0x711a, 0x76c6, 0x7c89, 0x7cde, + 0x7d1b, 0x82ac, 0x8cc1, 0x96f0, 0xf967, 0x4f5b, 0x5f17, 0x5f7f, + 0x62c2, 0x5d29, 0x670b, 0x68da, 0x787c, 0x7e43, 0x9d6c, 0x4e15, + 0x5099, 0x5315, 0x532a, 0x5351, 0x5983, 0x5a62, 0x5e87, 0x60b2, + 0x618a, 0x6249, 0x6279, 0x6590, 0x6787, 0x69a7, 0x6bd4, 0x6bd6, + 0x6bd7, 0x6bd8, 0x6cb8, 0xf968, 0x7435, 0x75fa, 0x7812, 0x7891, + 0x79d5, 0x79d8, 0x7c83, 0x7dcb, 0x7fe1, 0x80a5, + /* 0x5e */ + 0x813e, 0x81c2, 0x83f2, 0x871a, 0x88e8, 0x8ab9, 0x8b6c, 0x8cbb, + 0x9119, 0x975e, 0x98db, 0x9f3b, 0x56ac, 0x5b2a, 0x5f6c, 0x658c, + 0x6ab3, 0x6baf, 0x6d5c, 0x6ff1, 0x7015, 0x725d, 0x73ad, 0x8ca7, + 0x8cd3, 0x983b, 0x6191, 0x6c37, 0x8058, 0x9a01, 0x4e4d, 0x4e8b, + 0x4e9b, 0x4ed5, 0x4f3a, 0x4f3c, 0x4f7f, 0x4fdf, 0x50ff, 0x53f2, + 0x53f8, 0x5506, 0x55e3, 0x56db, 0x58eb, 0x5962, 0x5a11, 0x5beb, + 0x5bfa, 0x5c04, 0x5df3, 0x5e2b, 0x5f99, 0x601d, 0x6368, 0x659c, + 0x65af, 0x67f6, 0x67fb, 0x68ad, 0x6b7b, 0x6c99, 0x6cd7, 0x6e23, + 0x7009, 0x7345, 0x7802, 0x793e, 0x7940, 0x7960, 0x79c1, 0x7be9, + 0x7d17, 0x7d72, 0x8086, 0x820d, 0x838e, 0x84d1, 0x86c7, 0x88df, + 0x8a50, 0x8a5e, 0x8b1d, 0x8cdc, 0x8d66, 0x8fad, 0x90aa, 0x98fc, + 0x99df, 0x9e9d, 0x524a, 0xf969, 0x6714, 0xf96a, + /* 0x5f */ + 0x5098, 0x522a, 0x5c71, 0x6563, 0x6c55, 0x73ca, 0x7523, 0x759d, + 0x7b97, 0x849c, 0x9178, 0x9730, 0x4e77, 0x6492, 0x6bba, 0x715e, + 0x85a9, 0x4e09, 0xf96b, 0x6749, 0x68ee, 0x6e17, 0x829f, 0x8518, + 0x886b, 0x63f7, 0x6f81, 0x9212, 0x98af, 0x4e0a, 0x50b7, 0x50cf, + 0x511f, 0x5546, 0x55aa, 0x5617, 0x5b40, 0x5c19, 0x5ce0, 0x5e38, + 0x5e8a, 0x5ea0, 0x5ec2, 0x60f3, 0x6851, 0x6a61, 0x6e58, 0x723d, + 0x7240, 0x72c0, 0x76f8, 0x7965, 0x7bb1, 0x7fd4, 0x88f3, 0x89f4, + 0x8a73, 0x8c61, 0x8cde, 0x971c, 0x585e, 0x74bd, 0x8cfd, 0x55c7, + 0xf96c, 0x7a61, 0x7d22, 0x8272, 0x7272, 0x751f, 0x7525, 0xf96d, + 0x7b19, 0x5885, 0x58fb, 0x5dbc, 0x5e8f, 0x5eb6, 0x5f90, 0x6055, + 0x6292, 0x637f, 0x654d, 0x6691, 0x66d9, 0x66f8, 0x6816, 0x68f2, + 0x7280, 0x745e, 0x7b6e, 0x7d6e, 0x7dd6, 0x7f72, + /* 0x60 */ + 0x80e5, 0x8212, 0x85af, 0x897f, 0x8a93, 0x901d, 0x92e4, 0x9ecd, + 0x9f20, 0x5915, 0x596d, 0x5e2d, 0x60dc, 0x6614, 0x6673, 0x6790, + 0x6c50, 0x6dc5, 0x6f5f, 0x77f3, 0x78a9, 0x84c6, 0x91cb, 0x932b, + 0x4ed9, 0x50ca, 0x5148, 0x5584, 0x5b0b, 0x5ba3, 0x6247, 0x657e, + 0x65cb, 0x6e32, 0x717d, 0x7401, 0x7444, 0x7487, 0x74bf, 0x766c, + 0x79aa, 0x7dda, 0x7e55, 0x7fa8, 0x817a, 0x81b3, 0x8239, 0x861a, + 0x87ec, 0x8a75, 0x8de3, 0x9078, 0x9291, 0x9425, 0x994d, 0x9bae, + 0x5368, 0x5c51, 0x6954, 0x6cc4, 0x6d29, 0x6e2b, 0x820c, 0x859b, + 0x893b, 0x8a2d, 0x8aaa, 0x96ea, 0x9f67, 0x5261, 0x66b9, 0x6bb2, + 0x7e96, 0x87fe, 0x8d0d, 0x9583, 0x965d, 0x651d, 0x6d89, 0x71ee, + 0xf96e, 0x57ce, 0x59d3, 0x5bac, 0x6027, 0x60fa, 0x6210, 0x661f, + 0x665f, 0x7329, 0x73f9, 0x76db, 0x7701, 0x7b6c, + /* 0x61 */ + 0x8056, 0x8072, 0x8165, 0x8aa0, 0x9192, 0x4e16, 0x52e2, 0x6b72, + 0x6d17, 0x7a05, 0x7b39, 0x7d30, 0xf96f, 0x8cb0, 0x53ec, 0x562f, + 0x5851, 0x5bb5, 0x5c0f, 0x5c11, 0x5de2, 0x6240, 0x6383, 0x6414, + 0x662d, 0x68b3, 0x6cbc, 0x6d88, 0x6eaf, 0x701f, 0x70a4, 0x71d2, + 0x7526, 0x758f, 0x758e, 0x7619, 0x7b11, 0x7be0, 0x7c2b, 0x7d20, + 0x7d39, 0x852c, 0x856d, 0x8607, 0x8a34, 0x900d, 0x9061, 0x90b5, + 0x92b7, 0x97f6, 0x9a37, 0x4fd7, 0x5c6c, 0x675f, 0x6d91, 0x7c9f, + 0x7e8c, 0x8b16, 0x8d16, 0x901f, 0x5b6b, 0x5dfd, 0x640d, 0x84c0, + 0x905c, 0x98e1, 0x7387, 0x5b8b, 0x609a, 0x677e, 0x6dde, 0x8a1f, + 0x8aa6, 0x9001, 0x980c, 0x5237, 0xf970, 0x7051, 0x788e, 0x9396, + 0x8870, 0x91d7, 0x4fee, 0x53d7, 0x55fd, 0x56da, 0x5782, 0x58fd, + 0x5ac2, 0x5b88, 0x5cab, 0x5cc0, 0x5e25, 0x6101, + /* 0x62 */ + 0x620d, 0x624b, 0x6388, 0x641c, 0x6536, 0x6578, 0x6a39, 0x6b8a, + 0x6c34, 0x6d19, 0x6f31, 0x71e7, 0x72e9, 0x7378, 0x7407, 0x74b2, + 0x7626, 0x7761, 0x79c0, 0x7a57, 0x7aea, 0x7cb9, 0x7d8f, 0x7dac, + 0x7e61, 0x7f9e, 0x8129, 0x8331, 0x8490, 0x84da, 0x85ea, 0x8896, + 0x8ab0, 0x8b90, 0x8f38, 0x9042, 0x9083, 0x916c, 0x9296, 0x92b9, + 0x968b, 0x96a7, 0x96a8, 0x96d6, 0x9700, 0x9808, 0x9996, 0x9ad3, + 0x9b1a, 0x53d4, 0x587e, 0x5919, 0x5b70, 0x5bbf, 0x6dd1, 0x6f5a, + 0x719f, 0x7421, 0x74b9, 0x8085, 0x83fd, 0x5de1, 0x5f87, 0x5faa, + 0x6042, 0x65ec, 0x6812, 0x696f, 0x6a53, 0x6b89, 0x6d35, 0x6df3, + 0x73e3, 0x76fe, 0x77ac, 0x7b4d, 0x7d14, 0x8123, 0x821c, 0x8340, + 0x84f4, 0x8563, 0x8a62, 0x8ac4, 0x9187, 0x931e, 0x9806, 0x99b4, + 0x620c, 0x8853, 0x8ff0, 0x9265, 0x5d07, 0x5d27, + /* 0x63 */ + 0x5d69, 0x745f, 0x819d, 0x8768, 0x6fd5, 0x62fe, 0x7fd2, 0x8936, + 0x8972, 0x4e1e, 0x4e58, 0x50e7, 0x52dd, 0x5347, 0x627f, 0x6607, + 0x7e69, 0x8805, 0x965e, 0x4f8d, 0x5319, 0x5636, 0x59cb, 0x5aa4, + 0x5c38, 0x5c4e, 0x5c4d, 0x5e02, 0x5f11, 0x6043, 0x65bd, 0x662f, + 0x6642, 0x67be, 0x67f4, 0x731c, 0x77e2, 0x793a, 0x7fc5, 0x8494, + 0x84cd, 0x8996, 0x8a66, 0x8a69, 0x8ae1, 0x8c55, 0x8c7a, 0x57f4, + 0x5bd4, 0x5f0f, 0x606f, 0x62ed, 0x690d, 0x6b96, 0x6e5c, 0x7184, + 0x7bd2, 0x8755, 0x8b58, 0x8efe, 0x98df, 0x98fe, 0x4f38, 0x4f81, + 0x4fe1, 0x547b, 0x5a20, 0x5bb8, 0x613c, 0x65b0, 0x6668, 0x71fc, + 0x7533, 0x795e, 0x7d33, 0x814e, 0x81e3, 0x8398, 0x85aa, 0x85ce, + 0x8703, 0x8a0a, 0x8eab, 0x8f9b, 0xf971, 0x8fc5, 0x5931, 0x5ba4, + 0x5be6, 0x6089, 0x5be9, 0x5c0b, 0x5fc3, 0x6c81, + /* 0x64 */ + 0xf972, 0x6df1, 0x700b, 0x751a, 0x82af, 0x8af6, 0x4ec0, 0x5341, + 0xf973, 0x96d9, 0x6c0f, 0x4e9e, 0x4fc4, 0x5152, 0x555e, 0x5a25, + 0x5ce8, 0x6211, 0x7259, 0x82bd, 0x83aa, 0x86fe, 0x8859, 0x8a1d, + 0x963f, 0x96c5, 0x9913, 0x9d09, 0x9d5d, 0x580a, 0x5cb3, 0x5dbd, + 0x5e44, 0x60e1, 0x6115, 0x63e1, 0x6a02, 0x6e25, 0x9102, 0x9354, + 0x984e, 0x9c10, 0x9f77, 0x5b89, 0x5cb8, 0x6309, 0x664f, 0x6848, + 0x773c, 0x96c1, 0x978d, 0x9854, 0x9b9f, 0x65a1, 0x8b01, 0x8ecb, + 0x95bc, 0x5535, 0x5ca9, 0x5dd6, 0x5eb5, 0x6697, 0x764c, 0x83f4, + 0x95c7, 0x58d3, 0x62bc, 0x72ce, 0x9d28, 0x4ef0, 0x592e, 0x600f, + 0x663b, 0x6b83, 0x79e7, 0x9d26, 0x5393, 0x54c0, 0x57c3, 0x5d16, + 0x611b, 0x66d6, 0x6daf, 0x788d, 0x827e, 0x9698, 0x9744, 0x5384, + 0x627c, 0x6396, 0x6db2, 0x7e0a, 0x814b, 0x984d, + /* 0x65 */ + 0x6afb, 0x7f4c, 0x9daf, 0x9e1a, 0x4e5f, 0x503b, 0x51b6, 0x591c, + 0x60f9, 0x63f6, 0x6930, 0x723a, 0x8036, 0xf974, 0x91ce, 0x5f31, + 0xf975, 0xf976, 0x7d04, 0x82e5, 0x846f, 0x84bb, 0x85e5, 0x8e8d, + 0xf977, 0x4f6f, 0xf978, 0xf979, 0x58e4, 0x5b43, 0x6059, 0x63da, + 0x6518, 0x656d, 0x6698, 0xf97a, 0x694a, 0x6a23, 0x6d0b, 0x7001, + 0x716c, 0x75d2, 0x760d, 0x79b3, 0x7a70, 0xf97b, 0x7f8a, 0xf97c, + 0x8944, 0xf97d, 0x8b93, 0x91c0, 0x967d, 0xf97e, 0x990a, 0x5704, + 0x5fa1, 0x65bc, 0x6f01, 0x7600, 0x79a6, 0x8a9e, 0x99ad, 0x9b5a, + 0x9f6c, 0x5104, 0x61b6, 0x6291, 0x6a8d, 0x81c6, 0x5043, 0x5830, + 0x5f66, 0x7109, 0x8a00, 0x8afa, 0x5b7c, 0x8616, 0x4ffa, 0x513c, + 0x56b4, 0x5944, 0x63a9, 0x6df9, 0x5daa, 0x696d, 0x5186, 0x4e88, + 0x4f59, 0xf97f, 0xf980, 0xf981, 0x5982, 0xf982, + /* 0x66 */ + 0xf983, 0x6b5f, 0x6c5d, 0xf984, 0x74b5, 0x7916, 0xf985, 0x8207, + 0x8245, 0x8339, 0x8f3f, 0x8f5d, 0xf986, 0x9918, 0xf987, 0xf988, + 0xf989, 0x4ea6, 0xf98a, 0x57df, 0x5f79, 0x6613, 0xf98b, 0xf98c, + 0x75ab, 0x7e79, 0x8b6f, 0xf98d, 0x9006, 0x9a5b, 0x56a5, 0x5827, + 0x59f8, 0x5a1f, 0x5bb4, 0xf98e, 0x5ef6, 0xf98f, 0xf990, 0x6350, + 0x633b, 0xf991, 0x693d, 0x6c87, 0x6cbf, 0x6d8e, 0x6d93, 0x6df5, + 0x6f14, 0xf992, 0x70df, 0x7136, 0x7159, 0xf993, 0x71c3, 0x71d5, + 0xf994, 0x784f, 0x786f, 0xf995, 0x7b75, 0x7de3, 0xf996, 0x7e2f, + 0xf997, 0x884d, 0x8edf, 0xf998, 0xf999, 0xf99a, 0x925b, 0xf99b, + 0x9cf6, 0xf99c, 0xf99d, 0xf99e, 0x6085, 0x6d85, 0xf99f, 0x71b1, + 0xf9a0, 0xf9a1, 0x95b1, 0x53ad, 0xf9a2, 0xf9a3, 0xf9a4, 0x67d3, + 0xf9a5, 0x708e, 0x7130, 0x7430, 0x8276, 0x82d2, + /* 0x67 */ + 0xf9a6, 0x95bb, 0x9ae5, 0x9e7d, 0x66c4, 0xf9a7, 0x71c1, 0x8449, + 0xf9a8, 0xf9a9, 0x584b, 0xf9aa, 0xf9ab, 0x5db8, 0x5f71, 0xf9ac, + 0x6620, 0x668e, 0x6979, 0x69ae, 0x6c38, 0x6cf3, 0x6e36, 0x6f41, + 0x6fda, 0x701b, 0x702f, 0x7150, 0x71df, 0x7370, 0xf9ad, 0x745b, + 0xf9ae, 0x74d4, 0x76c8, 0x7a4e, 0x7e93, 0xf9af, 0xf9b0, 0x82f1, + 0x8a60, 0x8fce, 0xf9b1, 0x9348, 0xf9b2, 0x9719, 0xf9b3, 0xf9b4, + 0x4e42, 0x502a, 0xf9b5, 0x5208, 0x53e1, 0x66f3, 0x6c6d, 0x6fca, + 0x730a, 0x777f, 0x7a62, 0x82ae, 0x85dd, 0x8602, 0xf9b6, 0x88d4, + 0x8a63, 0x8b7d, 0x8c6b, 0xf9b7, 0x92b3, 0xf9b8, 0x9713, 0x9810, + 0x4e94, 0x4f0d, 0x4fc9, 0x50b2, 0x5348, 0x543e, 0x5433, 0x55da, + 0x5862, 0x58ba, 0x5967, 0x5a1b, 0x5be4, 0x609f, 0xf9b9, 0x61ca, + 0x6556, 0x65ff, 0x6664, 0x68a7, 0x6c5a, 0x6fb3, + /* 0x68 */ + 0x70cf, 0x71ac, 0x7352, 0x7b7d, 0x8708, 0x8aa4, 0x9c32, 0x9f07, + 0x5c4b, 0x6c83, 0x7344, 0x7389, 0x923a, 0x6eab, 0x7465, 0x761f, + 0x7a69, 0x7e15, 0x860a, 0x5140, 0x58c5, 0x64c1, 0x74ee, 0x7515, + 0x7670, 0x7fc1, 0x9095, 0x96cd, 0x9954, 0x6e26, 0x74e6, 0x7aa9, + 0x7aaa, 0x81e5, 0x86d9, 0x8778, 0x8a1b, 0x5a49, 0x5b8c, 0x5b9b, + 0x68a1, 0x6900, 0x6d63, 0x73a9, 0x7413, 0x742c, 0x7897, 0x7de9, + 0x7feb, 0x8118, 0x8155, 0x839e, 0x8c4c, 0x962e, 0x9811, 0x66f0, + 0x5f80, 0x65fa, 0x6789, 0x6c6a, 0x738b, 0x502d, 0x5a03, 0x6b6a, + 0x77ee, 0x5916, 0x5d6c, 0x5dcd, 0x7325, 0x754f, 0xf9ba, 0xf9bb, + 0x50e5, 0x51f9, 0x582f, 0x592d, 0x5996, 0x59da, 0x5be5, 0xf9bc, + 0xf9bd, 0x5da2, 0x62d7, 0x6416, 0x6493, 0x64fe, 0xf9be, 0x66dc, + 0xf9bf, 0x6a48, 0xf9c0, 0x71ff, 0x7464, 0xf9c1, + /* 0x69 */ + 0x7a88, 0x7aaf, 0x7e47, 0x7e5e, 0x8000, 0x8170, 0xf9c2, 0x87ef, + 0x8981, 0x8b20, 0x9059, 0xf9c3, 0x9080, 0x9952, 0x617e, 0x6b32, + 0x6d74, 0x7e1f, 0x8925, 0x8fb1, 0x4fd1, 0x50ad, 0x5197, 0x52c7, + 0x57c7, 0x5889, 0x5bb9, 0x5eb8, 0x6142, 0x6995, 0x6d8c, 0x6e67, + 0x6eb6, 0x7194, 0x7462, 0x7528, 0x752c, 0x8073, 0x8338, 0x84c9, + 0x8e0a, 0x9394, 0x93de, 0xf9c4, 0x4e8e, 0x4f51, 0x5076, 0x512a, + 0x53c8, 0x53cb, 0x53f3, 0x5b87, 0x5bd3, 0x5c24, 0x611a, 0x6182, + 0x65f4, 0x725b, 0x7397, 0x7440, 0x76c2, 0x7950, 0x7991, 0x79b9, + 0x7d06, 0x7fbd, 0x828b, 0x85d5, 0x865e, 0x8fc2, 0x9047, 0x90f5, + 0x91ea, 0x9685, 0x96e8, 0x96e9, 0x52d6, 0x5f67, 0x65ed, 0x6631, + 0x682f, 0x715c, 0x7a36, 0x90c1, 0x980a, 0x4e91, 0xf9c5, 0x6a52, + 0x6b9e, 0x6f90, 0x7189, 0x8018, 0x82b8, 0x8553, + /* 0x6a */ + 0x904b, 0x9695, 0x96f2, 0x97fb, 0x851a, 0x9b31, 0x4e90, 0x718a, + 0x96c4, 0x5143, 0x539f, 0x54e1, 0x5713, 0x5712, 0x57a3, 0x5a9b, + 0x5ac4, 0x5bc3, 0x6028, 0x613f, 0x63f4, 0x6c85, 0x6d39, 0x6e72, + 0x6e90, 0x7230, 0x733f, 0x7457, 0x82d1, 0x8881, 0x8f45, 0x9060, + 0xf9c6, 0x9662, 0x9858, 0x9d1b, 0x6708, 0x8d8a, 0x925e, 0x4f4d, + 0x5049, 0x50de, 0x5371, 0x570d, 0x59d4, 0x5a01, 0x5c09, 0x6170, + 0x6690, 0x6e2d, 0x7232, 0x744b, 0x7def, 0x80c3, 0x840e, 0x8466, + 0x853f, 0x875f, 0x885b, 0x8918, 0x8b02, 0x9055, 0x97cb, 0x9b4f, + 0x4e73, 0x4f91, 0x5112, 0x516a, 0xf9c7, 0x552f, 0x55a9, 0x5b7a, + 0x5ba5, 0x5e7c, 0x5e7d, 0x5ebe, 0x60a0, 0x60df, 0x6108, 0x6109, + 0x63c4, 0x6538, 0x6709, 0xf9c8, 0x67d4, 0x67da, 0xf9c9, 0x6961, + 0x6962, 0x6cb9, 0x6d27, 0xf9ca, 0x6e38, 0xf9cb, + /* 0x6b */ + 0x6fe1, 0x7336, 0x7337, 0xf9cc, 0x745c, 0x7531, 0xf9cd, 0x7652, + 0xf9ce, 0xf9cf, 0x7dad, 0x81fe, 0x8438, 0x88d5, 0x8a98, 0x8adb, + 0x8aed, 0x8e30, 0x8e42, 0x904a, 0x903e, 0x907a, 0x9149, 0x91c9, + 0x936e, 0xf9d0, 0xf9d1, 0x5809, 0xf9d2, 0x6bd3, 0x8089, 0x80b2, + 0xf9d3, 0xf9d4, 0x5141, 0x596b, 0x5c39, 0xf9d5, 0xf9d6, 0x6f64, + 0x73a7, 0x80e4, 0x8d07, 0xf9d7, 0x9217, 0x958f, 0xf9d8, 0xf9d9, + 0xf9da, 0xf9db, 0x807f, 0x620e, 0x701c, 0x7d68, 0x878d, 0xf9dc, + 0x57a0, 0x6069, 0x6147, 0x6bb7, 0x8abe, 0x9280, 0x96b1, 0x4e59, + 0x541f, 0x6deb, 0x852d, 0x9670, 0x97f3, 0x98ee, 0x63d6, 0x6ce3, + 0x9091, 0x51dd, 0x61c9, 0x81ba, 0x9df9, 0x4f9d, 0x501a, 0x5100, + 0x5b9c, 0x610f, 0x61ff, 0x64ec, 0x6905, 0x6bc5, 0x7591, 0x77e3, + 0x7fa9, 0x8264, 0x858f, 0x87fb, 0x8863, 0x8abc, + /* 0x6c */ + 0x8b70, 0x91ab, 0x4e8c, 0x4ee5, 0x4f0a, 0xf9dd, 0xf9de, 0x5937, + 0x59e8, 0xf9df, 0x5df2, 0x5f1b, 0x5f5b, 0x6021, 0xf9e0, 0xf9e1, + 0xf9e2, 0xf9e3, 0x723e, 0x73e5, 0xf9e4, 0x7570, 0x75cd, 0xf9e5, + 0x79fb, 0xf9e6, 0x800c, 0x8033, 0x8084, 0x82e1, 0x8351, 0xf9e7, + 0xf9e8, 0x8cbd, 0x8cb3, 0x9087, 0xf9e9, 0xf9ea, 0x98f4, 0x990c, + 0xf9eb, 0xf9ec, 0x7037, 0x76ca, 0x7fca, 0x7fcc, 0x7ffc, 0x8b1a, + 0x4eba, 0x4ec1, 0x5203, 0x5370, 0xf9ed, 0x54bd, 0x56e0, 0x59fb, + 0x5bc5, 0x5f15, 0x5fcd, 0x6e6e, 0xf9ee, 0xf9ef, 0x7d6a, 0x8335, + 0xf9f0, 0x8693, 0x8a8d, 0xf9f1, 0x976d, 0x9777, 0xf9f2, 0xf9f3, + 0x4e00, 0x4f5a, 0x4f7e, 0x58f9, 0x65e5, 0x6ea2, 0x9038, 0x93b0, + 0x99b9, 0x4efb, 0x58ec, 0x598a, 0x59d9, 0x6041, 0xf9f4, 0xf9f5, + 0x7a14, 0xf9f6, 0x834f, 0x8cc3, 0x5165, 0x5344, + /* 0x6d */ + 0xf9f7, 0xf9f8, 0xf9f9, 0x4ecd, 0x5269, 0x5b55, 0x82bf, 0x4ed4, + 0x523a, 0x54a8, 0x59c9, 0x59ff, 0x5b50, 0x5b57, 0x5b5c, 0x6063, + 0x6148, 0x6ecb, 0x7099, 0x716e, 0x7386, 0x74f7, 0x75b5, 0x78c1, + 0x7d2b, 0x8005, 0x81ea, 0x8328, 0x8517, 0x85c9, 0x8aee, 0x8cc7, + 0x96cc, 0x4f5c, 0x52fa, 0x56bc, 0x65ab, 0x6628, 0x707c, 0x70b8, + 0x7235, 0x7dbd, 0x828d, 0x914c, 0x96c0, 0x9d72, 0x5b71, 0x68e7, + 0x6b98, 0x6f7a, 0x76de, 0x5c91, 0x66ab, 0x6f5b, 0x7bb4, 0x7c2a, + 0x8836, 0x96dc, 0x4e08, 0x4ed7, 0x5320, 0x5834, 0x58bb, 0x58ef, + 0x596c, 0x5c07, 0x5e33, 0x5e84, 0x5f35, 0x638c, 0x66b2, 0x6756, + 0x6a1f, 0x6aa3, 0x6b0c, 0x6f3f, 0x7246, 0xf9fa, 0x7350, 0x748b, + 0x7ae0, 0x7ca7, 0x8178, 0x81df, 0x81e7, 0x838a, 0x846c, 0x8523, + 0x8594, 0x85cf, 0x88dd, 0x8d13, 0x91ac, 0x9577, + /* 0x6e */ + 0x969c, 0x518d, 0x54c9, 0x5728, 0x5bb0, 0x624d, 0x6750, 0x683d, + 0x6893, 0x6e3d, 0x6ed3, 0x707d, 0x7e21, 0x88c1, 0x8ca1, 0x8f09, + 0x9f4b, 0x9f4e, 0x722d, 0x7b8f, 0x8acd, 0x931a, 0x4f47, 0x4f4e, + 0x5132, 0x5480, 0x59d0, 0x5e95, 0x62b5, 0x6775, 0x696e, 0x6a17, + 0x6cae, 0x6e1a, 0x72d9, 0x732a, 0x75bd, 0x7bb8, 0x7d35, 0x82e7, + 0x83f9, 0x8457, 0x85f7, 0x8a5b, 0x8caf, 0x8e87, 0x9019, 0x90b8, + 0x96ce, 0x9f5f, 0x52e3, 0x540a, 0x5ae1, 0x5bc2, 0x6458, 0x6575, + 0x6ef4, 0x72c4, 0xf9fb, 0x7684, 0x7a4d, 0x7b1b, 0x7c4d, 0x7e3e, + 0x7fdf, 0x837b, 0x8b2b, 0x8cca, 0x8d64, 0x8de1, 0x8e5f, 0x8fea, + 0x8ff9, 0x9069, 0x93d1, 0x4f43, 0x4f7a, 0x50b3, 0x5168, 0x5178, + 0x524d, 0x526a, 0x5861, 0x587c, 0x5960, 0x5c08, 0x5c55, 0x5edb, + 0x609b, 0x6230, 0x6813, 0x6bbf, 0x6c08, 0x6fb1, + /* 0x6f */ + 0x714e, 0x7420, 0x7530, 0x7538, 0x7551, 0x7672, 0x7b4c, 0x7b8b, + 0x7bad, 0x7bc6, 0x7e8f, 0x8a6e, 0x8f3e, 0x8f49, 0x923f, 0x9293, + 0x9322, 0x942b, 0x96fb, 0x985a, 0x986b, 0x991e, 0x5207, 0x622a, + 0x6298, 0x6d59, 0x7664, 0x7aca, 0x7bc0, 0x7d76, 0x5360, 0x5cbe, + 0x5e97, 0x6f38, 0x70b9, 0x7c98, 0x9711, 0x9b8e, 0x9ede, 0x63a5, + 0x647a, 0x8776, 0x4e01, 0x4e95, 0x4ead, 0x505c, 0x5075, 0x5448, + 0x59c3, 0x5b9a, 0x5e40, 0x5ead, 0x5ef7, 0x5f81, 0x60c5, 0x633a, + 0x653f, 0x6574, 0x65cc, 0x6676, 0x6678, 0x67fe, 0x6968, 0x6a89, + 0x6b63, 0x6c40, 0x6dc0, 0x6de8, 0x6e1f, 0x6e5e, 0x701e, 0x70a1, + 0x738e, 0x73fd, 0x753a, 0x775b, 0x7887, 0x798e, 0x7a0b, 0x7a7d, + 0x7cbe, 0x7d8e, 0x8247, 0x8a02, 0x8aea, 0x8c9e, 0x912d, 0x914a, + 0x91d8, 0x9266, 0x92cc, 0x9320, 0x9706, 0x9756, + /* 0x70 */ + 0x975c, 0x9802, 0x9f0e, 0x5236, 0x5291, 0x557c, 0x5824, 0x5e1d, + 0x5f1f, 0x608c, 0x63d0, 0x68af, 0x6fdf, 0x796d, 0x7b2c, 0x81cd, + 0x85ba, 0x88fd, 0x8af8, 0x8e44, 0x918d, 0x9664, 0x969b, 0x973d, + 0x984c, 0x9f4a, 0x4fce, 0x5146, 0x51cb, 0x52a9, 0x5632, 0x5f14, + 0x5f6b, 0x63aa, 0x64cd, 0x65e9, 0x6641, 0x66fa, 0x66f9, 0x671d, + 0x689d, 0x68d7, 0x69fd, 0x6f15, 0x6f6e, 0x7167, 0x71e5, 0x722a, + 0x74aa, 0x773a, 0x7956, 0x795a, 0x79df, 0x7a20, 0x7a95, 0x7c97, + 0x7cdf, 0x7d44, 0x7e70, 0x8087, 0x85fb, 0x86a4, 0x8a54, 0x8abf, + 0x8d99, 0x8e81, 0x9020, 0x906d, 0x91e3, 0x963b, 0x96d5, 0x9ce5, + 0x65cf, 0x7c07, 0x8db3, 0x93c3, 0x5b58, 0x5c0a, 0x5352, 0x62d9, + 0x731d, 0x5027, 0x5b97, 0x5f9e, 0x60b0, 0x616b, 0x68d5, 0x6dd9, + 0x742e, 0x7a2e, 0x7d42, 0x7d9c, 0x7e31, 0x816b, + /* 0x71 */ + 0x8e2a, 0x8e35, 0x937e, 0x9418, 0x4f50, 0x5750, 0x5de6, 0x5ea7, + 0x632b, 0x7f6a, 0x4e3b, 0x4f4f, 0x4f8f, 0x505a, 0x59dd, 0x80c4, + 0x546a, 0x5468, 0x55fe, 0x594f, 0x5b99, 0x5dde, 0x5eda, 0x665d, + 0x6731, 0x67f1, 0x682a, 0x6ce8, 0x6d32, 0x6e4a, 0x6f8d, 0x70b7, + 0x73e0, 0x7587, 0x7c4c, 0x7d02, 0x7d2c, 0x7da2, 0x821f, 0x86db, + 0x8a3b, 0x8a85, 0x8d70, 0x8e8a, 0x8f33, 0x9031, 0x914e, 0x9152, + 0x9444, 0x99d0, 0x7af9, 0x7ca5, 0x4fca, 0x5101, 0x51c6, 0x57c8, + 0x5bef, 0x5cfb, 0x6659, 0x6a3d, 0x6d5a, 0x6e96, 0x6fec, 0x710c, + 0x756f, 0x7ae3, 0x8822, 0x9021, 0x9075, 0x96cb, 0x99ff, 0x8301, + 0x4e2d, 0x4ef2, 0x8846, 0x91cd, 0x537d, 0x6adb, 0x696b, 0x6c41, + 0x847a, 0x589e, 0x618e, 0x66fe, 0x62ef, 0x70dd, 0x7511, 0x75c7, + 0x7e52, 0x84b8, 0x8b49, 0x8d08, 0x4e4b, 0x53ea, + /* 0x72 */ + 0x54ab, 0x5730, 0x5740, 0x5fd7, 0x6301, 0x6307, 0x646f, 0x652f, + 0x65e8, 0x667a, 0x679d, 0x67b3, 0x6b62, 0x6c60, 0x6c9a, 0x6f2c, + 0x77e5, 0x7825, 0x7949, 0x7957, 0x7d19, 0x80a2, 0x8102, 0x81f3, + 0x829d, 0x82b7, 0x8718, 0x8a8c, 0xf9fc, 0x8d04, 0x8dbe, 0x9072, + 0x76f4, 0x7a19, 0x7a37, 0x7e54, 0x8077, 0x5507, 0x55d4, 0x5875, + 0x632f, 0x6422, 0x6649, 0x664b, 0x686d, 0x699b, 0x6b84, 0x6d25, + 0x6eb1, 0x73cd, 0x7468, 0x74a1, 0x755b, 0x75b9, 0x76e1, 0x771e, + 0x778b, 0x79e6, 0x7e09, 0x7e1d, 0x81fb, 0x852f, 0x8897, 0x8a3a, + 0x8cd1, 0x8eeb, 0x8fb0, 0x9032, 0x93ad, 0x9663, 0x9673, 0x9707, + 0x4f84, 0x53f1, 0x59ea, 0x5ac9, 0x5e19, 0x684e, 0x74c6, 0x75be, + 0x79e9, 0x7a92, 0x81a3, 0x86ed, 0x8cea, 0x8dcc, 0x8fed, 0x659f, + 0x6715, 0xf9fd, 0x57f7, 0x6f57, 0x7ddd, 0x8f2f, + /* 0x73 */ + 0x93f6, 0x96c6, 0x5fb5, 0x61f2, 0x6f84, 0x4e14, 0x4f98, 0x501f, + 0x53c9, 0x55df, 0x5d6f, 0x5dee, 0x6b21, 0x6b64, 0x78cb, 0x7b9a, + 0xf9fe, 0x8e49, 0x8eca, 0x906e, 0x6349, 0x643e, 0x7740, 0x7a84, + 0x932f, 0x947f, 0x9f6a, 0x64b0, 0x6faf, 0x71e6, 0x74a8, 0x74da, + 0x7ac4, 0x7c12, 0x7e82, 0x7cb2, 0x7e98, 0x8b9a, 0x8d0a, 0x947d, + 0x9910, 0x994c, 0x5239, 0x5bdf, 0x64e6, 0x672d, 0x7d2e, 0x50ed, + 0x53c3, 0x5879, 0x6158, 0x6159, 0x61fa, 0x65ac, 0x7ad9, 0x8b92, + 0x8b96, 0x5009, 0x5021, 0x5275, 0x5531, 0x5a3c, 0x5ee0, 0x5f70, + 0x6134, 0x655e, 0x660c, 0x6636, 0x66a2, 0x69cd, 0x6ec4, 0x6f32, + 0x7316, 0x7621, 0x7a93, 0x8139, 0x8259, 0x83d6, 0x84bc, 0x50b5, + 0x57f0, 0x5bc0, 0x5be8, 0x5f69, 0x63a1, 0x7826, 0x7db5, 0x83dc, + 0x8521, 0x91c7, 0x91f5, 0x518a, 0x67f5, 0x7b56, + /* 0x74 */ + 0x8cac, 0x51c4, 0x59bb, 0x60bd, 0x8655, 0x501c, 0xf9ff, 0x5254, + 0x5c3a, 0x617d, 0x621a, 0x62d3, 0x64f2, 0x65a5, 0x6ecc, 0x7620, + 0x810a, 0x8e60, 0x965f, 0x96bb, 0x4edf, 0x5343, 0x5598, 0x5929, + 0x5ddd, 0x64c5, 0x6cc9, 0x6dfa, 0x7394, 0x7a7f, 0x821b, 0x85a6, + 0x8ce4, 0x8e10, 0x9077, 0x91e7, 0x95e1, 0x9621, 0x97c6, 0x51f8, + 0x54f2, 0x5586, 0x5fb9, 0x64a4, 0x6f88, 0x7db4, 0x8f1f, 0x8f4d, + 0x9435, 0x50c9, 0x5c16, 0x6cbe, 0x6dfb, 0x751b, 0x77bb, 0x7c3d, + 0x7c64, 0x8a79, 0x8ac2, 0x581e, 0x59be, 0x5e16, 0x6377, 0x7252, + 0x758a, 0x776b, 0x8adc, 0x8cbc, 0x8f12, 0x5ef3, 0x6674, 0x6df8, + 0x807d, 0x83c1, 0x8acb, 0x9751, 0x9bd6, 0xfa00, 0x5243, 0x66ff, + 0x6d95, 0x6eef, 0x7de0, 0x8ae6, 0x902e, 0x905e, 0x9ad4, 0x521d, + 0x527f, 0x54e8, 0x6194, 0x6284, 0x62db, 0x68a2, + /* 0x75 */ + 0x6912, 0x695a, 0x6a35, 0x7092, 0x7126, 0x785d, 0x7901, 0x790e, + 0x79d2, 0x7a0d, 0x8096, 0x8278, 0x82d5, 0x8349, 0x8549, 0x8c82, + 0x8d85, 0x9162, 0x918b, 0x91ae, 0x4fc3, 0x56d1, 0x71ed, 0x77d7, + 0x8700, 0x89f8, 0x5bf8, 0x5fd6, 0x6751, 0x90a8, 0x53e2, 0x585a, + 0x5bf5, 0x60a4, 0x6181, 0x6460, 0x7e3d, 0x8070, 0x8525, 0x9283, + 0x64ae, 0x50ac, 0x5d14, 0x6700, 0x589c, 0x62bd, 0x63a8, 0x690e, + 0x6978, 0x6a1e, 0x6e6b, 0x76ba, 0x79cb, 0x82bb, 0x8429, 0x8acf, + 0x8da8, 0x8ffd, 0x9112, 0x914b, 0x919c, 0x9310, 0x9318, 0x939a, + 0x96db, 0x9a36, 0x9c0d, 0x4e11, 0x755c, 0x795d, 0x7afa, 0x7b51, + 0x7bc9, 0x7e2e, 0x84c4, 0x8e59, 0x8e74, 0x8ef8, 0x9010, 0x6625, + 0x693f, 0x7443, 0x51fa, 0x672e, 0x9edc, 0x5145, 0x5fe0, 0x6c96, + 0x87f2, 0x885d, 0x8877, 0x60b4, 0x81b5, 0x8403, + /* 0x76 */ + 0x8d05, 0x53d6, 0x5439, 0x5634, 0x5a36, 0x5c31, 0x708a, 0x7fe0, + 0x805a, 0x8106, 0x81ed, 0x8da3, 0x9189, 0x9a5f, 0x9df2, 0x5074, + 0x4ec4, 0x53a0, 0x60fb, 0x6e2c, 0x5c64, 0x4f88, 0x5024, 0x55e4, + 0x5cd9, 0x5e5f, 0x6065, 0x6894, 0x6cbb, 0x6dc4, 0x71be, 0x75d4, + 0x75f4, 0x7661, 0x7a1a, 0x7a49, 0x7dc7, 0x7dfb, 0x7f6e, 0x81f4, + 0x86a9, 0x8f1c, 0x96c9, 0x99b3, 0x9f52, 0x5247, 0x52c5, 0x98ed, + 0x89aa, 0x4e03, 0x67d2, 0x6f06, 0x4fb5, 0x5be2, 0x6795, 0x6c88, + 0x6d78, 0x741b, 0x7827, 0x91dd, 0x937c, 0x87c4, 0x79e4, 0x7a31, + 0x5feb, 0x4ed6, 0x54a4, 0x553e, 0x58ae, 0x59a5, 0x60f0, 0x6253, + 0x62d6, 0x6736, 0x6955, 0x8235, 0x9640, 0x99b1, 0x99dd, 0x502c, + 0x5353, 0x5544, 0x577c, 0xfa01, 0x6258, 0xfa02, 0x64e2, 0x666b, + 0x67dd, 0x6fc1, 0x6fef, 0x7422, 0x7438, 0x8a17, + /* 0x77 */ + 0x9438, 0x5451, 0x5606, 0x5766, 0x5f48, 0x619a, 0x6b4e, 0x7058, + 0x70ad, 0x7dbb, 0x8a95, 0x596a, 0x812b, 0x63a2, 0x7708, 0x803d, + 0x8caa, 0x5854, 0x642d, 0x69bb, 0x5b95, 0x5e11, 0x6e6f, 0xfa03, + 0x8569, 0x514c, 0x53f0, 0x592a, 0x6020, 0x614b, 0x6b86, 0x6c70, + 0x6cf0, 0x7b1e, 0x80ce, 0x82d4, 0x8dc6, 0x90b0, 0x98b1, 0xfa04, + 0x64c7, 0x6fa4, 0x6491, 0x6504, 0x514e, 0x5410, 0x571f, 0x8a0e, + 0x615f, 0x6876, 0xfa05, 0x75db, 0x7b52, 0x7d71, 0x901a, 0x5806, + 0x69cc, 0x817f, 0x892a, 0x9000, 0x9839, 0x5078, 0x5957, 0x59ac, + 0x6295, 0x900f, 0x9b2a, 0x615d, 0x7279, 0x95d6, 0x5761, 0x5a46, + 0x5df4, 0x628a, 0x64ad, 0x64fa, 0x6777, 0x6ce2, 0x6d3e, 0x722c, + 0x7436, 0x7834, 0x7f77, 0x82ad, 0x8ddb, 0x9817, 0x5224, 0x5742, + 0x677f, 0x7248, 0x74e3, 0x8ca9, 0x8fa6, 0x9211, + /* 0x78 */ + 0x962a, 0x516b, 0x53ed, 0x634c, 0x4f69, 0x5504, 0x6096, 0x6557, + 0x6c9b, 0x6d7f, 0x724c, 0x72fd, 0x7a17, 0x8987, 0x8c9d, 0x5f6d, + 0x6f8e, 0x70f9, 0x81a8, 0x610e, 0x4fbf, 0x504f, 0x6241, 0x7247, + 0x7bc7, 0x7de8, 0x7fe9, 0x904d, 0x97ad, 0x9a19, 0x8cb6, 0x576a, + 0x5e73, 0x67b0, 0x840d, 0x8a55, 0x5420, 0x5b16, 0x5e63, 0x5ee2, + 0x5f0a, 0x6583, 0x80ba, 0x853d, 0x9589, 0x965b, 0x4f48, 0x5305, + 0x530d, 0x530f, 0x5486, 0x54fa, 0x5703, 0x5e03, 0x6016, 0x629b, + 0x62b1, 0x6355, 0xfa06, 0x6ce1, 0x6d66, 0x75b1, 0x7832, 0x80de, + 0x812f, 0x82de, 0x8461, 0x84b2, 0x888d, 0x8912, 0x900b, 0x92ea, + 0x98fd, 0x9b91, 0x5e45, 0x66b4, 0x66dd, 0x7011, 0x7206, 0xfa07, + 0x4ff5, 0x527d, 0x5f6a, 0x6153, 0x6753, 0x6a19, 0x6f02, 0x74e2, + 0x7968, 0x8868, 0x8c79, 0x98c7, 0x98c4, 0x9a43, + /* 0x79 */ + 0x54c1, 0x7a1f, 0x6953, 0x8af7, 0x8c4a, 0x98a8, 0x99ae, 0x5f7c, + 0x62ab, 0x75b2, 0x76ae, 0x88ab, 0x907f, 0x9642, 0x5339, 0x5f3c, + 0x5fc5, 0x6ccc, 0x73cc, 0x7562, 0x758b, 0x7b46, 0x82fe, 0x999d, + 0x4e4f, 0x903c, 0x4e0b, 0x4f55, 0x53a6, 0x590f, 0x5ec8, 0x6630, + 0x6cb3, 0x7455, 0x8377, 0x8766, 0x8cc0, 0x9050, 0x971e, 0x9c15, + 0x58d1, 0x5b78, 0x8650, 0x8b14, 0x9db4, 0x5bd2, 0x6068, 0x608d, + 0x65f1, 0x6c57, 0x6f22, 0x6fa3, 0x701a, 0x7f55, 0x7ff0, 0x9591, + 0x9592, 0x9650, 0x97d3, 0x5272, 0x8f44, 0x51fd, 0x542b, 0x54b8, + 0x5563, 0x558a, 0x6abb, 0x6db5, 0x7dd8, 0x8266, 0x929c, 0x9677, + 0x9e79, 0x5408, 0x54c8, 0x76d2, 0x86e4, 0x95a4, 0x95d4, 0x965c, + 0x4ea2, 0x4f09, 0x59ee, 0x5ae6, 0x5df7, 0x6052, 0x6297, 0x676d, + 0x6841, 0x6c86, 0x6e2f, 0x7f38, 0x809b, 0x822a, + /* 0x7a */ + 0xfa08, 0xfa09, 0x9805, 0x4ea5, 0x5055, 0x54b3, 0x5793, 0x595a, + 0x5b69, 0x5bb3, 0x61c8, 0x6977, 0x6d77, 0x7023, 0x87f9, 0x89e3, + 0x8a72, 0x8ae7, 0x9082, 0x99ed, 0x9ab8, 0x52be, 0x6838, 0x5016, + 0x5e78, 0x674f, 0x8347, 0x884c, 0x4eab, 0x5411, 0x56ae, 0x73e6, + 0x9115, 0x97ff, 0x9909, 0x9957, 0x9999, 0x5653, 0x589f, 0x865b, + 0x8a31, 0x61b2, 0x6af6, 0x737b, 0x8ed2, 0x6b47, 0x96aa, 0x9a57, + 0x5955, 0x7200, 0x8d6b, 0x9769, 0x4fd4, 0x5cf4, 0x5f26, 0x61f8, + 0x665b, 0x6ceb, 0x70ab, 0x7384, 0x73b9, 0x73fe, 0x7729, 0x774d, + 0x7d43, 0x7d62, 0x7e23, 0x8237, 0x8852, 0xfa0a, 0x8ce2, 0x9249, + 0x986f, 0x5b51, 0x7a74, 0x8840, 0x9801, 0x5acc, 0x4fe0, 0x5354, + 0x593e, 0x5cfd, 0x633e, 0x6d79, 0x72f9, 0x8105, 0x8107, 0x83a2, + 0x92cf, 0x9830, 0x4ea8, 0x5144, 0x5211, 0x578b, + /* 0x7b */ + 0x5f62, 0x6cc2, 0x6ece, 0x7005, 0x7050, 0x70af, 0x7192, 0x73e9, + 0x7469, 0x834a, 0x87a2, 0x8861, 0x9008, 0x90a2, 0x93a3, 0x99a8, + 0x516e, 0x5f57, 0x60e0, 0x6167, 0x66b3, 0x8559, 0x8e4a, 0x91af, + 0x978b, 0x4e4e, 0x4e92, 0x547c, 0x58d5, 0x58fa, 0x597d, 0x5cb5, + 0x5f27, 0x6236, 0x6248, 0x660a, 0x6667, 0x6beb, 0x6d69, 0x6dcf, + 0x6e56, 0x6ef8, 0x6f94, 0x6fe0, 0x6fe9, 0x705d, 0x72d0, 0x7425, + 0x745a, 0x74e0, 0x7693, 0x795c, 0x7cca, 0x7e1e, 0x80e1, 0x82a6, + 0x846b, 0x84bf, 0x864e, 0x865f, 0x8774, 0x8b77, 0x8c6a, 0x93ac, + 0x9800, 0x9865, 0x60d1, 0x6216, 0x9177, 0x5a5a, 0x660f, 0x6df7, + 0x6e3e, 0x743f, 0x9b42, 0x5ffd, 0x60da, 0x7b0f, 0x54c4, 0x5f18, + 0x6c5e, 0x6cd3, 0x6d2a, 0x70d8, 0x7d05, 0x8679, 0x8a0c, 0x9d3b, + 0x5316, 0x548c, 0x5b05, 0x6a3a, 0x706b, 0x7575, + /* 0x7c */ + 0x798d, 0x79be, 0x82b1, 0x83ef, 0x8a71, 0x8b41, 0x8ca8, 0x9774, + 0xfa0b, 0x64f4, 0x652b, 0x78ba, 0x78bb, 0x7a6b, 0x4e38, 0x559a, + 0x5950, 0x5ba6, 0x5e7b, 0x60a3, 0x63db, 0x6b61, 0x6665, 0x6853, + 0x6e19, 0x7165, 0x74b0, 0x7d08, 0x9084, 0x9a69, 0x9c25, 0x6d3b, + 0x6ed1, 0x733e, 0x8c41, 0x95ca, 0x51f0, 0x5e4c, 0x5fa8, 0x604d, + 0x60f6, 0x6130, 0x614c, 0x6643, 0x6644, 0x69a5, 0x6cc1, 0x6e5f, + 0x6ec9, 0x6f62, 0x714c, 0x749c, 0x7687, 0x7bc1, 0x7c27, 0x8352, + 0x8757, 0x9051, 0x968d, 0x9ec3, 0x532f, 0x56de, 0x5efb, 0x5f8a, + 0x6062, 0x6094, 0x61f7, 0x6666, 0x6703, 0x6a9c, 0x6dee, 0x6fae, + 0x7070, 0x736a, 0x7e6a, 0x81be, 0x8334, 0x86d4, 0x8aa8, 0x8cc4, + 0x5283, 0x7372, 0x5b96, 0x6a6b, 0x9404, 0x54ee, 0x5686, 0x5b5d, + 0x6548, 0x6585, 0x66c9, 0x689f, 0x6d8d, 0x6dc6, + /* 0x7d */ + 0x723b, 0x80b4, 0x9175, 0x9a4d, 0x4faf, 0x5019, 0x539a, 0x540e, + 0x543c, 0x5589, 0x55c5, 0x5e3f, 0x5f8c, 0x673d, 0x7166, 0x73dd, + 0x9005, 0x52db, 0x52f3, 0x5864, 0x58ce, 0x7104, 0x718f, 0x71fb, + 0x85b0, 0x8a13, 0x6688, 0x85a8, 0x55a7, 0x6684, 0x714a, 0x8431, + 0x5349, 0x5599, 0x6bc1, 0x5f59, 0x5fbd, 0x63ee, 0x6689, 0x7147, + 0x8af1, 0x8f1d, 0x9ebe, 0x4f11, 0x643a, 0x70cb, 0x7566, 0x8667, + 0x6064, 0x8b4e, 0x9df8, 0x5147, 0x51f6, 0x5308, 0x6d36, 0x80f8, + 0x9ed1, 0x6615, 0x6b23, 0x7098, 0x75d5, 0x5403, 0x5c79, 0x7d07, + 0x8a16, 0x6b20, 0x6b3d, 0x6b46, 0x5438, 0x6070, 0x6d3d, 0x7fd5, + 0x8208, 0x50d6, 0x51de, 0x559c, 0x566b, 0x56cd, 0x59ec, 0x5b09, + 0x5e0c, 0x6199, 0x6198, 0x6231, 0x665e, 0x66e6, 0x7199, 0x71b9, + 0x71ba, 0x72a7, 0x79a7, 0x7a00, 0x7fb2, 0x8a70, +}; + +static int +ksc5601_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c1 = (s[0] & 0x7F); + if ((c1 >= 0x21 && c1 <= 0x2c) || (c1 >= 0x30 && c1 <= 0x48) || (c1 >= 0x4a && c1 <= 0x7d)) { + if (n >= 2) { + unsigned char c2 = (s[1] & 0x7F); + if (c2 >= 0x21 && c2 < 0x7f) { + unsigned int i = 94 * (c1 - 0x21) + (c2 - 0x21); + unsigned short wc = 0xfffd; + if (i < 1410) { + if (i < 1115) + wc = ksc5601_2uni_page21[i]; + } else if (i < 3854) { + if (i < 3760) + wc = ksc5601_2uni_page30[i-1410]; + } else { + if (i < 8742) + wc = ksc5601_2uni_page4a[i-3854]; + } + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOFEW(0); + } + return RET_ILSEQ; +} + +static const unsigned short ksc5601_2charset[8224] = { + 0x222e, 0x2234, 0x2157, 0x2127, 0x2823, 0x2129, 0x2146, 0x213e, + 0x2977, 0x2978, 0x2225, 0x2252, 0x2124, 0x222c, 0x2976, 0x282c, + 0x2879, 0x2876, 0x287a, 0x222f, 0x2821, 0x2822, 0x213f, 0x282a, + 0x282d, 0x292c, 0x2921, 0x2923, 0x2140, 0x292a, 0x292d, 0x2922, + 0x2824, 0x2924, 0x2925, 0x2826, 0x2926, 0x2927, 0x2828, 0x2928, + 0x2829, 0x2929, 0x2930, 0x282f, 0x292f, 0x282b, 0x292b, 0x282e, + 0x292e, 0x2227, 0x2230, 0x2228, 0x222b, 0x222a, 0x222d, 0x2229, + 0x2541, 0x2542, 0x2543, 0x2544, 0x2545, 0x2546, 0x2547, 0x2548, + 0x2549, 0x254a, 0x254b, 0x254c, 0x254d, 0x254e, 0x254f, 0x2550, + 0x2551, 0x2552, 0x2553, 0x2554, 0x2555, 0x2556, 0x2557, 0x2558, + 0x2561, 0x2562, 0x2563, 0x2564, 0x2565, 0x2566, 0x2567, 0x2568, + 0x2569, 0x256a, 0x256b, 0x256c, 0x256d, 0x256e, 0x256f, 0x2570, + 0x2571, 0x2572, 0x2573, 0x2574, 0x2575, 0x2576, 0x2577, 0x2578, + 0x2c27, 0x2c21, 0x2c22, 0x2c23, 0x2c24, 0x2c25, 0x2c26, 0x2c28, + 0x2c29, 0x2c2a, 0x2c2b, 0x2c2c, 0x2c2d, 0x2c2e, 0x2c2f, 0x2c30, + 0x2c31, 0x2c32, 0x2c33, 0x2c34, 0x2c35, 0x2c36, 0x2c37, 0x2c38, + 0x2c39, 0x2c3a, 0x2c3b, 0x2c3c, 0x2c3d, 0x2c3e, 0x2c3f, 0x2c40, + 0x2c41, 0x2c51, 0x2c52, 0x2c53, 0x2c54, 0x2c55, 0x2c56, 0x2c58, + 0x2c59, 0x2c5a, 0x2c5b, 0x2c5c, 0x2c5d, 0x2c5e, 0x2c5f, 0x2c60, + 0x2c61, 0x2c62, 0x2c63, 0x2c64, 0x2c65, 0x2c66, 0x2c67, 0x2c68, + 0x2c69, 0x2c6a, 0x2c6b, 0x2c6c, 0x2c6d, 0x2c6e, 0x2c6f, 0x2c70, + 0x2c71, 0x2c57, 0x212a, 0x212e, 0x212f, 0x2130, 0x2131, 0x2253, + 0x2254, 0x2125, 0x2126, 0x2236, 0x2147, 0x2148, 0x2158, 0x2979, + 0x297a, 0x297b, 0x297c, 0x297d, 0x297e, 0x2149, 0x2235, 0x2724, + 0x2260, 0x2265, 0x2262, 0x2759, 0x214a, 0x2877, 0x2878, 0x287b, + 0x287c, 0x287d, 0x287e, 0x2530, 0x2531, 0x2532, 0x2533, 0x2534, + 0x2535, 0x2536, 0x2537, 0x2538, 0x2539, 0x2521, 0x2522, 0x2523, + 0x2524, 0x2525, 0x2526, 0x2527, 0x2528, 0x2529, 0x252a, 0x2167, + 0x2168, 0x2166, 0x2169, 0x216a, 0x2255, 0x2258, 0x2256, 0x2259, + 0x2257, 0x2221, 0x2222, 0x2223, 0x2153, 0x2224, 0x2154, 0x2174, + 0x2175, 0x2233, 0x2232, 0x216e, 0x2170, 0x2144, 0x2150, 0x212b, + 0x217c, 0x217d, 0x217b, 0x217a, 0x2172, 0x2173, 0x2231, 0x2145, + 0x2171, 0x212d, 0x216f, 0x2156, 0x2141, 0x2155, 0x2142, 0x2143, + 0x216c, 0x216d, 0x2178, 0x2179, 0x2176, 0x2177, 0x2241, 0x2151, + 0x2152, 0x2867, 0x2868, 0x2869, 0x286a, 0x286b, 0x286c, 0x286d, + 0x286e, 0x286f, 0x2870, 0x2871, 0x2872, 0x2873, 0x2874, 0x2875, + 0x2967, 0x2968, 0x2969, 0x296a, 0x296b, 0x296c, 0x296d, 0x296e, + 0x296f, 0x2970, 0x2971, 0x2972, 0x2973, 0x2974, 0x2975, 0x294d, + 0x294e, 0x294f, 0x2950, 0x2951, 0x2952, 0x2953, 0x2954, 0x2955, + 0x2956, 0x2957, 0x2958, 0x2959, 0x295a, 0x295b, 0x295c, 0x295d, + 0x295e, 0x295f, 0x2960, 0x2961, 0x2962, 0x2963, 0x2964, 0x2965, + 0x2966, 0x284d, 0x284e, 0x284f, 0x2850, 0x2851, 0x2852, 0x2853, + 0x2854, 0x2855, 0x2856, 0x2857, 0x2858, 0x2859, 0x285a, 0x285b, + 0x285c, 0x285d, 0x285e, 0x285f, 0x2860, 0x2861, 0x2862, 0x2863, + 0x2864, 0x2865, 0x2866, 0x2621, 0x262c, 0x2622, 0x262d, 0x2623, + 0x2648, 0x2647, 0x262e, 0x2624, 0x2642, 0x2641, 0x262f, 0x2626, + 0x2646, 0x2645, 0x2631, 0x2625, 0x2644, 0x2643, 0x2630, 0x2627, + 0x263c, 0x2649, 0x264a, 0x2637, 0x264b, 0x264c, 0x2632, 0x2629, + 0x263e, 0x264d, 0x264e, 0x2639, 0x264f, 0x2650, 0x2634, 0x2628, + 0x2651, 0x2652, 0x2638, 0x263d, 0x2653, 0x2654, 0x2633, 0x262a, + 0x2655, 0x2656, 0x263a, 0x263f, 0x2657, 0x2658, 0x2635, 0x262b, + 0x2659, 0x265a, 0x263b, 0x265b, 0x265c, 0x2640, 0x265d, 0x265e, + 0x265f, 0x2660, 0x2661, 0x2662, 0x2663, 0x2664, 0x2636, 0x2246, + 0x2161, 0x2160, 0x2243, 0x2247, 0x2248, 0x224b, 0x224a, 0x2249, + 0x224c, 0x2163, 0x2162, 0x223a, 0x2239, 0x2165, 0x2164, 0x2238, + 0x2237, 0x215f, 0x215e, 0x2242, 0x215b, 0x215d, 0x215c, 0x2244, + 0x2245, 0x215a, 0x2159, 0x224f, 0x224e, 0x2250, 0x2251, 0x214f, + 0x214e, 0x223c, 0x223d, 0x2240, 0x223b, 0x223e, 0x223f, 0x224d, + 0x225b, 0x225c, 0x225d, 0x225a, 0x2121, 0x2122, 0x2123, 0x2128, + 0x2134, 0x2135, 0x2136, 0x2137, 0x2138, 0x2139, 0x213a, 0x213b, + 0x213c, 0x213d, 0x216b, 0x2132, 0x2133, 0x2a21, 0x2a22, 0x2a23, + 0x2a24, 0x2a25, 0x2a26, 0x2a27, 0x2a28, 0x2a29, 0x2a2a, 0x2a2b, + 0x2a2c, 0x2a2d, 0x2a2e, 0x2a2f, 0x2a30, 0x2a31, 0x2a32, 0x2a33, + 0x2a34, 0x2a35, 0x2a36, 0x2a37, 0x2a38, 0x2a39, 0x2a3a, 0x2a3b, + 0x2a3c, 0x2a3d, 0x2a3e, 0x2a3f, 0x2a40, 0x2a41, 0x2a42, 0x2a43, + 0x2a44, 0x2a45, 0x2a46, 0x2a47, 0x2a48, 0x2a49, 0x2a4a, 0x2a4b, + 0x2a4c, 0x2a4d, 0x2a4e, 0x2a4f, 0x2a50, 0x2a51, 0x2a52, 0x2a53, + 0x2a54, 0x2a55, 0x2a56, 0x2a57, 0x2a58, 0x2a59, 0x2a5a, 0x2a5b, + 0x2a5c, 0x2a5d, 0x2a5e, 0x2a5f, 0x2a60, 0x2a61, 0x2a62, 0x2a63, + 0x2a64, 0x2a65, 0x2a66, 0x2a67, 0x2a68, 0x2a69, 0x2a6a, 0x2a6b, + 0x2a6c, 0x2a6d, 0x2a6e, 0x2a6f, 0x2a70, 0x2a71, 0x2a72, 0x2a73, + 0x2b21, 0x2b22, 0x2b23, 0x2b24, 0x2b25, 0x2b26, 0x2b27, 0x2b28, + 0x2b29, 0x2b2a, 0x2b2b, 0x2b2c, 0x2b2d, 0x2b2e, 0x2b2f, 0x2b30, + 0x2b31, 0x2b32, 0x2b33, 0x2b34, 0x2b35, 0x2b36, 0x2b37, 0x2b38, + 0x2b39, 0x2b3a, 0x2b3b, 0x2b3c, 0x2b3d, 0x2b3e, 0x2b3f, 0x2b40, + 0x2b41, 0x2b42, 0x2b43, 0x2b44, 0x2b45, 0x2b46, 0x2b47, 0x2b48, + 0x2b49, 0x2b4a, 0x2b4b, 0x2b4c, 0x2b4d, 0x2b4e, 0x2b4f, 0x2b50, + 0x2b51, 0x2b52, 0x2b53, 0x2b54, 0x2b55, 0x2b56, 0x2b57, 0x2b58, + 0x2b59, 0x2b5a, 0x2b5b, 0x2b5c, 0x2b5d, 0x2b5e, 0x2b5f, 0x2b60, + 0x2b61, 0x2b62, 0x2b63, 0x2b64, 0x2b65, 0x2b66, 0x2b67, 0x2b68, + 0x2b69, 0x2b6a, 0x2b6b, 0x2b6c, 0x2b6d, 0x2b6e, 0x2b6f, 0x2b70, + 0x2b71, 0x2b72, 0x2b73, 0x2b74, 0x2b75, 0x2b76, 0x2421, 0x2422, + 0x2423, 0x2424, 0x2425, 0x2426, 0x2427, 0x2428, 0x2429, 0x242a, + 0x242b, 0x242c, 0x242d, 0x242e, 0x242f, 0x2430, 0x2431, 0x2432, + 0x2433, 0x2434, 0x2435, 0x2436, 0x2437, 0x2438, 0x2439, 0x243a, + 0x243b, 0x243c, 0x243d, 0x243e, 0x243f, 0x2440, 0x2441, 0x2442, + 0x2443, 0x2444, 0x2445, 0x2446, 0x2447, 0x2448, 0x2449, 0x244a, + 0x244b, 0x244c, 0x244d, 0x244e, 0x244f, 0x2450, 0x2451, 0x2452, + 0x2453, 0x2454, 0x2455, 0x2456, 0x2457, 0x2458, 0x2459, 0x245a, + 0x245b, 0x245c, 0x245d, 0x245e, 0x245f, 0x2460, 0x2461, 0x2462, + 0x2463, 0x2464, 0x2465, 0x2466, 0x2467, 0x2468, 0x2469, 0x246a, + 0x246b, 0x246c, 0x246d, 0x246e, 0x246f, 0x2470, 0x2471, 0x2472, + 0x2473, 0x2474, 0x2475, 0x2476, 0x2477, 0x2478, 0x2479, 0x247a, + 0x247b, 0x247c, 0x247d, 0x247e, 0x2931, 0x2932, 0x2933, 0x2934, + 0x2935, 0x2936, 0x2937, 0x2938, 0x2939, 0x293a, 0x293b, 0x293c, + 0x293d, 0x293e, 0x293f, 0x2940, 0x2941, 0x2942, 0x2943, 0x2944, + 0x2945, 0x2946, 0x2947, 0x2948, 0x2949, 0x294a, 0x294b, 0x294c, + 0x225f, 0x2831, 0x2832, 0x2833, 0x2834, 0x2835, 0x2836, 0x2837, + 0x2838, 0x2839, 0x283a, 0x283b, 0x283c, 0x283d, 0x283e, 0x283f, + 0x2840, 0x2841, 0x2842, 0x2843, 0x2844, 0x2845, 0x2846, 0x2847, + 0x2848, 0x2849, 0x284a, 0x284b, 0x284c, 0x225e, 0x2749, 0x274a, + 0x274b, 0x274c, 0x274d, 0x273a, 0x273b, 0x275c, 0x275d, 0x275e, + 0x2736, 0x2737, 0x2738, 0x2754, 0x2755, 0x2756, 0x2757, 0x2758, + 0x2721, 0x2722, 0x2723, 0x2725, 0x272b, 0x272c, 0x272d, 0x272e, + 0x272f, 0x2730, 0x2731, 0x2732, 0x2733, 0x2734, 0x2727, 0x2728, + 0x2729, 0x272a, 0x273d, 0x273e, 0x2765, 0x2766, 0x2767, 0x2768, + 0x2761, 0x2762, 0x2763, 0x273f, 0x2740, 0x2741, 0x2742, 0x2743, + 0x2744, 0x2745, 0x2746, 0x2747, 0x2748, 0x274e, 0x274f, 0x2750, + 0x2751, 0x2752, 0x2753, 0x275a, 0x275b, 0x2263, 0x276c, 0x2726, + 0x2760, 0x276f, 0x2261, 0x273c, 0x276d, 0x2735, 0x2739, 0x276a, + 0x276b, 0x275f, 0x2264, 0x2764, 0x276e, 0x2769, 0x6c69, 0x6f4b, + 0x7652, 0x5832, 0x6d5b, 0x5f32, 0x5f3e, 0x793b, 0x5c74, 0x7564, + 0x7326, 0x5d60, 0x6126, 0x4e78, 0x5c30, 0x632a, 0x7169, 0x4d7a, + 0x7c2f, 0x5321, 0x712b, 0x6751, 0x522c, 0x4e79, 0x717d, 0x5e3f, + 0x7b3a, 0x7939, 0x4e52, 0x632b, 0x6b60, 0x4e7a, 0x4b77, 0x6525, + 0x4a61, 0x544c, 0x6a61, 0x5c63, 0x5f2d, 0x4b6b, 0x552f, 0x5675, + 0x6578, 0x5e40, 0x6c23, 0x694d, 0x6a27, 0x6976, 0x7b3b, 0x6769, + 0x6f4c, 0x5066, 0x5e41, 0x642c, 0x584c, 0x7971, 0x4e5f, 0x7a24, + 0x6632, 0x7a7b, 0x7a3d, 0x4c48, 0x6f4d, 0x5555, 0x5322, 0x6c51, + 0x6427, 0x6c52, 0x7631, 0x4e7b, 0x5051, 0x4b3f, 0x6d24, 0x6d28, + 0x5e42, 0x7662, 0x6d5c, 0x5c75, 0x6039, 0x544e, 0x7435, 0x535b, + 0x5635, 0x6c24, 0x6466, 0x716a, 0x4b6c, 0x4b40, 0x6c72, 0x506a, + 0x7972, 0x6c25, 0x505f, 0x676a, 0x506b, 0x5c51, 0x5b69, 0x7d4c, + 0x5b57, 0x5a61, 0x5636, 0x635f, 0x5e43, 0x5e44, 0x4a21, 0x6e6c, + 0x5323, 0x6e37, 0x784f, 0x6a48, 0x6e38, 0x712c, 0x7125, 0x694e, + 0x793c, 0x6579, 0x6c6a, 0x5d56, 0x6d42, 0x7825, 0x653a, 0x5b58, + 0x4a22, 0x514d, 0x6e6d, 0x6c6b, 0x5e45, 0x6360, 0x4a49, 0x7269, + 0x554e, 0x7636, 0x4e42, 0x5647, 0x6334, 0x712d, 0x6a62, 0x5742, + 0x7327, 0x4d6a, 0x6b6e, 0x5932, 0x7d25, 0x7655, 0x5562, 0x7835, + 0x4c75, 0x7535, 0x642d, 0x676b, 0x7155, 0x703b, 0x6935, 0x4c49, + 0x7a55, 0x6154, 0x5756, 0x5c41, 0x5e46, 0x7a6f, 0x6361, 0x6173, + 0x5c76, 0x4e7c, 0x5b44, 0x7871, 0x5c64, 0x656f, 0x5c31, 0x5556, + 0x735a, 0x4b41, 0x5b43, 0x597a, 0x536e, 0x7a38, 0x7d26, 0x6b6f, + 0x7426, 0x4c4a, 0x7328, 0x735b, 0x5b27, 0x7637, 0x4f66, 0x7072, + 0x4b5a, 0x6752, 0x5743, 0x7670, 0x685e, 0x6526, 0x6567, 0x4a23, + 0x4c27, 0x6a49, 0x7836, 0x7a25, 0x712e, 0x6f4e, 0x4b6d, 0x7630, + 0x6f4f, 0x694f, 0x775e, 0x4e53, 0x5c77, 0x5b28, 0x4b78, 0x5f21, + 0x5d61, 0x754a, 0x6936, 0x676c, 0x6e6e, 0x7370, 0x5f3f, 0x4c4b, + 0x5041, 0x7452, 0x603a, 0x5f40, 0x4e60, 0x5c52, 0x7d6a, 0x5676, + 0x6a4a, 0x6869, 0x632c, 0x7350, 0x4a24, 0x5b78, 0x5e47, 0x6b70, + 0x7156, 0x6562, 0x4c4c, 0x4b7b, 0x6a63, 0x5f41, 0x566d, 0x6950, + 0x6e39, 0x5563, 0x5153, 0x6570, 0x6834, 0x6b43, 0x6a2a, 0x7a7c, + 0x7576, 0x703c, 0x7d54, 0x603b, 0x4e43, 0x503a, 0x773a, 0x5873, + 0x774d, 0x642e, 0x545f, 0x5067, 0x6c7d, 0x522e, 0x6e6f, 0x5557, + 0x6a64, 0x7822, 0x4d6b, 0x573f, 0x7b31, 0x4d6c, 0x5c32, 0x506c, + 0x4e7d, 0x6e70, 0x4c42, 0x506d, 0x6577, 0x737c, 0x6e22, 0x5933, + 0x5874, 0x6937, 0x4e2e, 0x5922, 0x5871, 0x544f, 0x6527, 0x5552, + 0x5629, 0x7422, 0x7157, 0x5558, 0x703d, 0x5750, 0x5450, 0x574f, + 0x6b6a, 0x7d6b, 0x5b6d, 0x7c45, 0x4b42, 0x7d55, 0x7448, 0x686a, + 0x7573, 0x795e, 0x536f, 0x6c53, 0x5d42, 0x6f37, 0x6754, 0x4a4a, + 0x597b, 0x7a7d, 0x562a, 0x7478, 0x7777, 0x5c2c, 0x5757, 0x5f22, + 0x4e3e, 0x5370, 0x7024, 0x616c, 0x4f67, 0x734b, 0x6d29, 0x4a3e, + 0x746f, 0x764e, 0x5e7b, 0x503b, 0x5537, 0x6e71, 0x7428, 0x5c78, + 0x4b27, 0x5a4e, 0x6066, 0x6d25, 0x6e72, 0x5c79, 0x795c, 0x735c, + 0x7872, 0x7479, 0x7c71, 0x503c, 0x5b79, 0x5731, 0x4b7c, 0x7025, + 0x4b7d, 0x5574, 0x4d6d, 0x4a25, 0x562b, 0x5042, 0x703e, 0x523d, + 0x4c24, 0x7a36, 0x4c4d, 0x5a7a, 0x764f, 0x6938, 0x5875, 0x4c4e, + 0x574d, 0x5451, 0x696d, 0x4a6b, 0x5962, 0x7d32, 0x632d, 0x564c, + 0x5934, 0x6127, 0x6e53, 0x5043, 0x7d33, 0x5564, 0x4f68, 0x6d43, + 0x5032, 0x4e7e, 0x5a28, 0x7850, 0x7d56, 0x7851, 0x7852, 0x5c53, + 0x5d62, 0x7b79, 0x5d41, 0x6335, 0x6d5d, 0x4e44, 0x4b21, 0x5d63, + 0x7c5d, 0x792f, 0x527b, 0x4f21, 0x6428, 0x7436, 0x6c7e, 0x632e, + 0x676d, 0x7d41, 0x5a62, 0x5833, 0x5d64, 0x706f, 0x7671, 0x7a70, + 0x5175, 0x5a4f, 0x5c54, 0x5c26, 0x6f3f, 0x4e4f, 0x6059, 0x5956, + 0x6c54, 0x6a4b, 0x4a3f, 0x5530, 0x4f69, 0x716d, 0x4c4f, 0x6478, + 0x646d, 0x5758, 0x7d27, 0x6a2b, 0x7632, 0x4f70, 0x793d, 0x6674, + 0x4b5b, 0x7351, 0x6951, 0x7329, 0x5060, 0x6952, 0x5a63, 0x6252, + 0x7622, 0x6174, 0x5a64, 0x6755, 0x753f, 0x4f22, 0x4d2f, 0x4f23, + 0x4d30, 0x717e, 0x5023, 0x612f, 0x7823, 0x4a26, 0x773b, 0x726a, + 0x5e48, 0x6953, 0x5e49, 0x7d5e, 0x4a40, 0x796a, 0x514e, 0x6e54, + 0x5452, 0x5923, 0x7d28, 0x5759, 0x774e, 0x7a3e, 0x4f56, 0x5770, + 0x6b61, 0x7845, 0x5c7a, 0x5d43, 0x795f, 0x676f, 0x7d65, 0x7623, + 0x597c, 0x7d29, 0x676e, 0x5565, 0x6f50, 0x4d31, 0x7722, 0x7132, + 0x7131, 0x4d32, 0x5a2b, 0x4a27, 0x6362, 0x7b3c, 0x5924, 0x6e3a, + 0x7853, 0x7b7a, 0x4f24, 0x5c7b, 0x7663, 0x6d2a, 0x7221, 0x4e61, + 0x7a26, 0x7960, 0x6c56, 0x646e, 0x7921, 0x7b6f, 0x796b, 0x6e23, + 0x6a2c, 0x4a28, 0x747a, 0x4d56, 0x7c76, 0x7449, 0x7854, 0x7826, + 0x5e4a, 0x7246, 0x575a, 0x5350, 0x5845, 0x6a66, 0x735d, 0x645a, + 0x7664, 0x7672, 0x5f42, 0x597d, 0x4c76, 0x533a, 0x642f, 0x7961, + 0x7026, 0x4b53, 0x603c, 0x744a, 0x547a, 0x7d2a, 0x7962, 0x7437, + 0x7d42, 0x7c30, 0x7d6c, 0x4a62, 0x7d3d, 0x6a67, 0x5f43, 0x5152, + 0x4e62, 0x5324, 0x7d2b, 0x5f60, 0x7247, 0x6770, 0x506e, 0x732a, + 0x5e4b, 0x7638, 0x6175, 0x7133, 0x7723, 0x4a29, 0x4f25, 0x5f44, + 0x6130, 0x703f, 0x7624, 0x6336, 0x7a46, 0x506f, 0x7d6d, 0x5d44, + 0x7c77, 0x663f, 0x5e2d, 0x7a3f, 0x6571, 0x6d44, 0x5225, 0x7d6e, + 0x7536, 0x6176, 0x5e4c, 0x7c5e, 0x6c57, 0x4d5d, 0x5637, 0x4d33, + 0x7855, 0x6558, 0x4f6a, 0x4f50, 0x6a4c, 0x6a2e, 0x6a2d, 0x5371, + 0x5325, 0x774f, 0x6e24, 0x5024, 0x7222, 0x5070, 0x7223, 0x7778, + 0x5033, 0x5b29, 0x533b, 0x4a6c, 0x7126, 0x4b55, 0x7767, 0x4d5e, + 0x7724, 0x7840, 0x535d, 0x4c50, 0x4f26, 0x7673, 0x6177, 0x535c, + 0x7a7e, 0x7a27, 0x6b59, 0x4f27, 0x6a2f, 0x646f, 0x6939, 0x7158, + 0x5858, 0x6072, 0x6634, 0x5c7c, 0x7371, 0x6350, 0x727b, 0x5b46, + 0x5071, 0x5072, 0x4f5c, 0x5351, 0x4c31, 0x7758, 0x4b28, 0x6b3c, + 0x643e, 0x745c, 0x5c42, 0x7027, 0x6640, 0x4a6d, 0x686b, 0x6568, + 0x5c43, 0x6d5e, 0x5372, 0x4c77, 0x4e54, 0x672b, 0x4b43, 0x6131, + 0x7732, 0x5373, 0x5352, 0x7540, 0x5f5d, 0x6e73, 0x6771, 0x7d34, + 0x7248, 0x7352, 0x6e74, 0x6253, 0x4c51, 0x5f6a, 0x693a, 0x5957, + 0x754d, 0x7172, 0x7a47, 0x5978, 0x5442, 0x7665, 0x5d45, 0x6772, + 0x6d5f, 0x4a4b, 0x5b7a, 0x6835, 0x5326, 0x7d35, 0x7949, 0x6462, + 0x7b3d, 0x5724, 0x4e45, 0x4e55, 0x5666, 0x653d, 0x5e4d, 0x6c73, + 0x6d60, 0x6c6c, 0x7b3e, 0x5f6b, 0x6178, 0x793e, 0x5073, 0x602a, + 0x6862, 0x6254, 0x527d, 0x6528, 0x5953, 0x535e, 0x7438, 0x773c, + 0x5c7d, 0x686c, 0x6467, 0x6377, 0x6c28, 0x7a71, 0x6572, 0x5074, + 0x522f, 0x5c65, 0x5025, 0x7134, 0x7c31, 0x4c78, 0x5d46, 0x7a51, + 0x775f, 0x7a28, 0x6e75, 0x5e4e, 0x6773, 0x772c, 0x6b44, 0x6d61, + 0x602b, 0x5d47, 0x5233, 0x523f, 0x4a4c, 0x7b3f, 0x657d, 0x5d65, + 0x584d, 0x6c74, 0x5075, 0x686d, 0x5052, 0x5958, 0x7666, 0x5b2a, + 0x7760, 0x5859, 0x7423, 0x745d, 0x6f51, 0x5935, 0x6d2b, 0x6337, + 0x6e3b, 0x4d34, 0x6073, 0x6a4d, 0x6c75, 0x686e, 0x4b29, 0x712f, + 0x4a4d, 0x6c29, 0x726b, 0x7d6f, 0x7973, 0x6641, 0x6c58, 0x6d2c, + 0x6a4e, 0x685f, 0x5e4f, 0x5226, 0x6774, 0x5156, 0x6642, 0x6363, + 0x6430, 0x5834, 0x7625, 0x735e, 0x5725, 0x7768, 0x6846, 0x7b66, + 0x5d66, 0x5c7e, 0x585a, 0x5a2c, 0x6a30, 0x6338, 0x4a2a, 0x6179, + 0x6a31, 0x726c, 0x7a6e, 0x6e55, 0x7974, 0x526c, 0x7b7b, 0x7d70, + 0x603d, 0x4e63, 0x7846, 0x5e2e, 0x5f45, 0x653e, 0x6d2d, 0x7a6a, + 0x4d6e, 0x6d26, 0x6d2e, 0x706d, 0x5d21, 0x6d2f, 0x7c78, 0x586b, + 0x4c79, 0x4d35, 0x7a29, 0x615d, 0x6255, 0x6d4f, 0x5d22, 0x794a, + 0x6a68, 0x656d, 0x536b, 0x6954, 0x617a, 0x644c, 0x6164, 0x6847, + 0x4e5b, 0x5c55, 0x7735, 0x7c73, 0x7073, 0x4e2f, 0x7135, 0x6f52, + 0x6848, 0x6b71, 0x4b54, 0x603e, 0x6378, 0x6a69, 0x7c32, 0x6074, + 0x4f60, 0x6e25, 0x7a2a, 0x6643, 0x6132, 0x4a2b, 0x6364, 0x693b, + 0x6256, 0x7372, 0x6e56, 0x6a32, 0x5076, 0x6c59, 0x5a4b, 0x4f28, + 0x5d23, 0x585b, 0x794e, 0x6955, 0x6351, 0x523c, 0x582c, 0x734c, + 0x4d7b, 0x7656, 0x6775, 0x686f, 0x6379, 0x523b, 0x7373, 0x637b, + 0x5e50, 0x4e30, 0x5677, 0x7159, 0x7541, 0x5c44, 0x753b, 0x5e51, + 0x5c66, 0x5e52, 0x6d62, 0x6e76, 0x6a4f, 0x706e, 0x637c, 0x535f, + 0x5374, 0x6133, 0x6134, 0x7453, 0x5f46, 0x6956, 0x5b2b, 0x7626, + 0x6339, 0x6b45, 0x7429, 0x4d36, 0x5279, 0x5a2d, 0x5263, 0x4f51, + 0x4b5c, 0x4c7a, 0x4f5d, 0x6829, 0x633b, 0x633a, 0x605a, 0x6e77, + 0x5c33, 0x5375, 0x5726, 0x7635, 0x575b, 0x6155, 0x546a, 0x5f23, + 0x7d5f, 0x5077, 0x6d54, 0x4b2a, 0x645b, 0x617b, 0x4b22, 0x5360, + 0x643f, 0x7b40, 0x5a3e, 0x644d, 0x5639, 0x6f40, 0x617c, 0x7639, + 0x5f47, 0x6431, 0x5c67, 0x5c68, 0x7a56, 0x5376, 0x715a, 0x7a72, + 0x627d, 0x554f, 0x5078, 0x4d5f, 0x754b, 0x6470, 0x4b2b, 0x5744, + 0x627e, 0x5d5a, 0x5a2e, 0x4a6e, 0x5539, 0x6321, 0x6863, 0x732b, + 0x4f29, 0x5377, 0x5471, 0x4e64, 0x6872, 0x6575, 0x672e, 0x563a, + 0x5f6c, 0x6440, 0x6864, 0x5835, 0x645c, 0x7439, 0x7136, 0x625e, + 0x6135, 0x4d6f, 0x7127, 0x4e65, 0x4b5d, 0x5963, 0x732c, 0x5079, + 0x6c2b, 0x5e53, 0x7769, 0x7975, 0x615e, 0x4b6e, 0x633c, 0x7856, + 0x5b6e, 0x7d71, 0x7736, 0x745e, 0x726d, 0x5b59, 0x7028, 0x617d, + 0x5e54, 0x602c, 0x6d63, 0x5361, 0x5f48, 0x5936, 0x7d2c, 0x6f53, + 0x6441, 0x786b, 0x5b2c, 0x7c46, 0x582d, 0x763a, 0x5b5f, 0x5353, + 0x7847, 0x4a4e, 0x7841, 0x5234, 0x5c34, 0x7a39, 0x4a4f, 0x7c33, + 0x6a6a, 0x6a6b, 0x507a, 0x6d64, 0x5d67, 0x5f49, 0x5f6d, 0x6e3c, + 0x6f41, 0x4c52, 0x5d24, 0x5f4a, 0x5378, 0x7128, 0x4d37, 0x6f54, + 0x645d, 0x5f6e, 0x4b2c, 0x693c, 0x6a6c, 0x5f4b, 0x793f, 0x562f, + 0x5546, 0x4f2a, 0x4e29, 0x5678, 0x7137, 0x6e78, 0x5959, 0x735f, + 0x7848, 0x4e46, 0x5566, 0x7466, 0x6645, 0x6f55, 0x4b6f, 0x7c5f, + 0x5c27, 0x5667, 0x7849, 0x6352, 0x633d, 0x4f61, 0x7040, 0x6c5a, + 0x5d57, 0x7b70, 0x6c2c, 0x7029, 0x7a57, 0x7b41, 0x5240, 0x6530, + 0x6d65, 0x4b2d, 0x7930, 0x7725, 0x4b2e, 0x5a2f, 0x5836, 0x5327, + 0x7b32, 0x7d44, 0x6c2d, 0x7b21, 0x6569, 0x696e, 0x7374, 0x7873, + 0x7041, 0x5e2f, 0x7830, 0x7360, 0x672f, 0x5b2d, 0x6635, 0x7928, + 0x5d58, 0x6859, 0x6f56, 0x5362, 0x625f, 0x7c60, 0x5748, 0x7d2d, + 0x5f6f, 0x4c53, 0x5379, 0x5470, 0x5b47, 0x5e55, 0x7074, 0x5550, + 0x6559, 0x7c47, 0x5c56, 0x6260, 0x5a30, 0x7323, 0x536c, 0x744b, + 0x7d45, 0x637d, 0x7931, 0x507b, 0x6c5b, 0x753c, 0x7224, 0x584e, + 0x584f, 0x7577, 0x7661, 0x5237, 0x7b6c, 0x5d48, 0x6468, 0x5241, + 0x7857, 0x563b, 0x5e56, 0x773d, 0x6c2e, 0x5061, 0x6075, 0x6a33, + 0x4e56, 0x4c25, 0x6c76, 0x6261, 0x633e, 0x7c48, 0x4d70, 0x7976, + 0x5f70, 0x653f, 0x4e3f, 0x7c61, 0x6d30, 0x7d51, 0x763b, 0x794f, + 0x6b5a, 0x4a41, 0x5238, 0x4d71, 0x6353, 0x7d66, 0x666d, 0x637a, + 0x702a, 0x7950, 0x7c62, 0x7827, 0x6165, 0x6e79, 0x6776, 0x6a6d, + 0x7c34, 0x7542, 0x575c, 0x7075, 0x5d68, 0x536d, 0x757c, 0x5a3f, + 0x4c7b, 0x537a, 0x7424, 0x6f57, 0x5443, 0x7b63, 0x7b6d, 0x602d, + 0x6a6e, 0x7b33, 0x6442, 0x7667, 0x525d, 0x5f4c, 0x7c49, 0x6529, + 0x6076, 0x7633, 0x617e, 0x4b70, 0x6a6f, 0x6a70, 0x5a40, 0x7834, + 0x6b72, 0x6443, 0x6957, 0x6471, 0x4a6f, 0x4e57, 0x7c4a, 0x7361, + 0x4b44, 0x6365, 0x4b45, 0x6a34, 0x693d, 0x5749, 0x6b5b, 0x6d31, + 0x4c43, 0x773e, 0x7c4b, 0x7874, 0x5937, 0x7353, 0x7354, 0x7764, + 0x7751, 0x5837, 0x4e31, 0x4a42, 0x7b34, 0x4b46, 0x7076, 0x5567, + 0x6a50, 0x4c54, 0x4b2f, 0x742a, 0x692f, 0x7543, 0x6958, 0x5d69, + 0x7173, 0x557b, 0x5e3b, 0x747b, 0x7d73, 0x7d72, 0x7726, 0x5d49, + 0x5453, 0x4c28, 0x5a41, 0x4c55, 0x5964, 0x7a4a, 0x6563, 0x533c, + 0x4a70, 0x5044, 0x4a50, 0x7a2b, 0x6b6b, 0x6778, 0x5965, 0x5157, + 0x7324, 0x547b, 0x7c63, 0x7a58, 0x7355, 0x4f2b, 0x6b73, 0x557c, + 0x5354, 0x4d7c, 0x5966, 0x6279, 0x6221, 0x6b54, 0x6077, 0x6432, + 0x4c7c, 0x7b64, 0x742b, 0x503d, 0x4a71, 0x6f38, 0x5740, 0x6e7a, + 0x7d74, 0x5363, 0x7b42, 0x5568, 0x5b2e, 0x6136, 0x7837, 0x603f, + 0x7b43, 0x5d6a, 0x6222, 0x6e26, 0x7668, 0x7675, 0x5d4a, 0x5062, + 0x5d26, 0x5d6b, 0x6479, 0x632f, 0x507c, 0x747c, 0x4c3c, 0x776a, + 0x6564, 0x5f71, 0x7761, 0x7977, 0x6f39, 0x7858, 0x7929, 0x7859, + 0x6e3d, 0x5846, 0x6463, 0x754e, 0x5d59, 0x5967, 0x5239, 0x5543, + 0x5a65, 0x5a50, 0x5159, 0x4e58, 0x4b5e, 0x742c, 0x5a7b, 0x7669, + 0x6873, 0x4f2c, 0x7070, 0x747d, 0x5b48, 0x4e40, 0x6354, 0x514f, + 0x7175, 0x4d72, 0x4f6b, 0x4d38, 0x6326, 0x515a, 0x7225, 0x7226, + 0x644e, 0x537b, 0x7129, 0x7249, 0x6f58, 0x6649, 0x5838, 0x7a73, + 0x7335, 0x7824, 0x5173, 0x6648, 0x785a, 0x5c69, 0x5e57, 0x4b5f, + 0x4f6c, 0x745f, 0x5174, 0x523a, 0x5f72, 0x6137, 0x6223, 0x537c, + 0x6d66, 0x5b49, 0x647a, 0x4f5e, 0x4e50, 0x5553, 0x7375, 0x772e, + 0x6f48, 0x4d73, 0x754f, 0x6573, 0x7042, 0x4a51, 0x6a71, 0x5026, + 0x595a, 0x702b, 0x6b67, 0x6540, 0x7c35, 0x6444, 0x4c29, 0x7d46, + 0x6a35, 0x652a, 0x5f3a, 0x615f, 0x5a51, 0x6138, 0x6874, 0x537d, + 0x6224, 0x724a, 0x5a66, 0x7733, 0x7d4d, 0x7336, 0x6e57, 0x7544, + 0x5824, 0x7227, 0x5938, 0x5939, 0x6f49, 0x564e, 0x774b, 0x5f2e, + 0x6875, 0x5235, 0x5355, 0x744c, 0x5a7c, 0x5968, 0x776b, 0x7549, + 0x733c, 0x5a52, 0x5335, 0x6836, 0x564f, 0x743a, 0x7749, 0x4c2a, + 0x7043, 0x4c56, 0x5053, 0x533d, 0x5b7b, 0x4b60, 0x5364, 0x7677, + 0x553a, 0x734d, 0x4b61, 0x6b74, 0x742d, 0x7c2a, 0x776c, 0x6876, + 0x5a67, 0x774c, 0x6541, 0x606e, 0x557d, 0x4e66, 0x7c2b, 0x553b, + 0x7228, 0x6225, 0x4d39, 0x6a72, 0x4b47, 0x4d74, 0x5b2f, 0x6f59, + 0x4d3a, 0x7c79, 0x5f73, 0x4e67, 0x5a42, 0x4f2d, 0x6779, 0x7828, + 0x7362, 0x4a72, 0x5f24, 0x5444, 0x4c57, 0x6542, 0x4d3b, 0x6f5a, + 0x6e58, 0x5d27, 0x6226, 0x6040, 0x5630, 0x784a, 0x7c7a, 0x597e, + 0x5e30, 0x5d6c, 0x5a68, 0x5460, 0x5679, 0x4d57, 0x5e58, 0x7278, + 0x6456, 0x5045, 0x742e, 0x5d28, 0x6d45, 0x7356, 0x5e59, 0x6366, + 0x5328, 0x5b30, 0x655a, 0x633f, 0x5b31, 0x5569, 0x6041, 0x6f5b, + 0x7069, 0x5732, 0x507d, 0x5969, 0x507e, 0x6c6d, 0x5329, 0x7229, + 0x7044, 0x6262, 0x696f, 0x7951, 0x6959, 0x685a, 0x5a43, 0x5a44, + 0x5445, 0x677a, 0x4d60, 0x6330, 0x5b32, 0x7b44, 0x7363, 0x5925, + 0x7b67, 0x5d4b, 0x5054, 0x6636, 0x602e, 0x7d5a, 0x5c35, 0x6078, + 0x6731, 0x7570, 0x585c, 0x6d46, 0x6139, 0x6340, 0x7940, 0x6970, + 0x595b, 0x7364, 0x5c36, 0x6469, 0x7045, 0x6341, 0x7c4c, 0x7c4d, + 0x724b, 0x724c, 0x644f, 0x715b, 0x7a59, 0x7138, 0x7d75, 0x6079, + 0x677b, 0x7c37, 0x7c64, 0x7b45, 0x6367, 0x5839, 0x7678, 0x5c45, + 0x4c58, 0x602f, 0x7467, 0x6f5c, 0x4f7c, 0x6f5d, 0x722a, 0x7d3e, + 0x4a2c, 0x7d3b, 0x7d47, 0x6732, 0x6a51, 0x5f74, 0x516c, 0x645e, + 0x6543, 0x5926, 0x4d3c, 0x7365, 0x6d55, 0x593a, 0x6d67, 0x7b35, + 0x786c, 0x6067, 0x4c59, 0x5446, 0x6725, 0x5575, 0x533e, 0x7c7b, + 0x6472, 0x5f75, 0x6878, 0x786d, 0x4e47, 0x7d76, 0x6858, 0x4d58, + 0x6756, 0x4c5a, 0x4a63, 0x5f76, 0x7047, 0x7046, 0x583a, 0x7174, + 0x7470, 0x754c, 0x7c65, 0x6a45, 0x6a73, 0x5d5b, 0x5c57, 0x5e7d, + 0x7279, 0x5547, 0x5850, 0x7048, 0x5121, 0x5122, 0x5954, 0x5668, + 0x594a, 0x5a31, 0x5847, 0x5c62, 0x734e, 0x7574, 0x7139, 0x5a53, + 0x766a, 0x4f75, 0x7d2e, 0x4a52, 0x5f34, 0x575d, 0x7a3a, 0x6e27, + 0x753d, 0x7875, 0x6d68, 0x5461, 0x5123, 0x6156, 0x7978, 0x5b4a, + 0x4b79, 0x5454, 0x595c, 0x6e3e, 0x776d, 0x526e, 0x6166, 0x7779, + 0x5d6d, 0x685b, 0x5b33, 0x5177, 0x6030, 0x5462, 0x7657, 0x5779, + 0x585d, 0x4d7d, 0x722b, 0x4d3d, 0x7842, 0x722c, 0x4a2d, 0x4a2e, + 0x4f2e, 0x6342, 0x5c37, 0x5b5a, 0x593b, 0x4a73, 0x7653, 0x6678, + 0x6a75, 0x6a76, 0x7679, 0x4f2f, 0x4a53, 0x4a2f, 0x5230, 0x713a, + 0x5733, 0x6343, 0x737d, 0x5e5a, 0x5e5b, 0x6f5e, 0x6263, 0x6e7b, + 0x5f77, 0x574a, 0x4e68, 0x5b5b, 0x713b, 0x6971, 0x7a37, 0x5046, + 0x4c2b, 0x6e28, 0x4b7a, 0x7979, 0x4c7d, 0x537e, 0x6450, 0x726e, + 0x5455, 0x5f4d, 0x7c38, 0x5150, 0x724d, 0x7752, 0x4a54, 0x5559, + 0x585e, 0x4d59, 0x6e29, 0x763c, 0x4c5b, 0x7049, 0x7c7c, 0x6849, + 0x747e, 0x677c, 0x575e, 0x5e5c, 0x702c, 0x4c7e, 0x4d61, 0x613a, + 0x5b6f, 0x5a32, 0x5125, 0x5c38, 0x5876, 0x5124, 0x4d62, 0x5c6a, + 0x7077, 0x704a, 0x503e, 0x5d5c, 0x5456, 0x5356, 0x6d50, 0x4d21, + 0x5f35, 0x5f78, 0x5421, 0x4e32, 0x684a, 0x6b75, 0x6355, 0x7550, + 0x7521, 0x5927, 0x652b, 0x664b, 0x7571, 0x6545, 0x7923, 0x605b, + 0x766b, 0x4b71, 0x596a, 0x7522, 0x5751, 0x5178, 0x6a78, 0x6a79, + 0x5a33, 0x6f5f, 0x716f, 0x6576, 0x6e3f, 0x6264, 0x503f, 0x7a2c, + 0x7551, 0x6733, 0x693e, 0x724e, 0x5b34, 0x7c4e, 0x5d6e, 0x6734, + 0x5734, 0x7734, 0x4d3e, 0x5a69, 0x4f30, 0x7759, 0x7366, 0x4e59, + 0x4e2a, 0x4b48, 0x5027, 0x704b, 0x5047, 0x6445, 0x5b60, 0x555a, + 0x5727, 0x6e40, 0x7876, 0x7552, 0x6d69, 0x593c, 0x6546, 0x7523, + 0x5a54, 0x6227, 0x7b7c, 0x715c, 0x4a74, 0x687a, 0x4e69, 0x6978, + 0x6265, 0x5039, 0x5472, 0x5126, 0x5f4e, 0x7c74, 0x532a, 0x4c2c, + 0x6f60, 0x6565, 0x5055, 0x5b7c, 0x7c66, 0x4b7e, 0x6d6a, 0x5e31, + 0x7963, 0x5422, 0x4f76, 0x5650, 0x556a, 0x716e, 0x7a4b, 0x6521, + 0x5531, 0x4f6d, 0x6d6b, 0x5532, 0x553c, 0x7d62, 0x732d, 0x7d5b, + 0x6930, 0x5127, 0x7d63, 0x4e33, 0x7d64, 0x7a4e, 0x4a30, 0x7727, + 0x4f31, 0x6622, 0x7c36, 0x722d, 0x6f61, 0x732e, 0x5c46, 0x596b, + 0x6860, 0x6128, 0x5576, 0x4f7d, 0x5e5d, 0x5951, 0x646a, 0x724f, + 0x773f, 0x6266, 0x6228, 0x6356, 0x6d51, 0x6979, 0x5631, 0x5e32, + 0x6068, 0x532b, 0x6b5c, 0x5f2f, 0x4a43, 0x6e7c, 0x7d43, 0x6b76, + 0x4f32, 0x596c, 0x593d, 0x585f, 0x5438, 0x6b3e, 0x5d6f, 0x5d70, + 0x5d71, 0x5d72, 0x593e, 0x7b46, 0x4f33, 0x6e7d, 0x642b, 0x5a45, + 0x586c, 0x5128, 0x6229, 0x5e3c, 0x6735, 0x5b70, 0x6f62, 0x7170, + 0x4f34, 0x5b71, 0x6031, 0x5f25, 0x7952, 0x677d, 0x6623, 0x7b71, + 0x4b30, 0x722e, 0x4d67, 0x685c, 0x6757, 0x7740, 0x5063, 0x5a21, + 0x4c3d, 0x5129, 0x5d4c, 0x637e, 0x512a, 0x682a, 0x6a36, 0x797a, + 0x664c, 0x7658, 0x5447, 0x594b, 0x5952, 0x534b, 0x5877, 0x5a29, + 0x7578, 0x5e5e, 0x722f, 0x7829, 0x5848, 0x6e41, 0x7941, 0x5d73, + 0x6a7a, 0x763d, 0x613b, 0x4d3f, 0x7454, 0x664d, 0x7c4f, 0x7b22, + 0x605c, 0x743b, 0x5a55, 0x7932, 0x7b72, 0x5b76, 0x5e5f, 0x5b72, + 0x785c, 0x776e, 0x6b68, 0x527a, 0x713c, 0x7a5a, 0x5a6a, 0x5a46, + 0x7741, 0x6736, 0x6547, 0x562c, 0x5c47, 0x6129, 0x622a, 0x5526, + 0x5457, 0x7250, 0x6a7b, 0x605d, 0x7b73, 0x713d, 0x6267, 0x7d57, + 0x4e48, 0x6a37, 0x7c40, 0x7d67, 0x776f, 0x5735, 0x6f3a, 0x715d, + 0x5e33, 0x684b, 0x785d, 0x7b47, 0x5548, 0x575f, 0x5d29, 0x6931, + 0x7a2d, 0x7659, 0x7a74, 0x782a, 0x666e, 0x4c5c, 0x613c, 0x606f, + 0x693f, 0x7c7d, 0x664e, 0x6157, 0x664f, 0x7471, 0x6473, 0x647b, + 0x7964, 0x6f63, 0x4f6e, 0x763e, 0x6032, 0x7c7e, 0x512b, 0x577a, + 0x7b48, 0x6257, 0x5423, 0x7078, 0x5728, 0x6167, 0x533f, 0x6f64, + 0x5745, 0x6b62, 0x7c67, 0x6422, 0x6268, 0x6650, 0x7b68, 0x7468, + 0x6574, 0x743c, 0x7455, 0x5f36, 0x7c39, 0x6e42, 0x4a75, 0x6f65, + 0x4b62, 0x5424, 0x5e60, 0x5a7d, 0x6446, 0x683e, 0x605e, 0x7634, + 0x6a52, 0x797b, 0x6042, 0x4a64, 0x6737, 0x6a7d, 0x595d, 0x5a34, + 0x6e2a, 0x7b69, 0x5b4b, 0x5a35, 0x713e, 0x532c, 0x7b49, 0x5f4f, + 0x5340, 0x6357, 0x6f66, 0x7c50, 0x6940, 0x7553, 0x6c5c, 0x7737, + 0x6a38, 0x5179, 0x5c48, 0x6a39, 0x715e, 0x5736, 0x4f35, 0x5928, + 0x6c6e, 0x5d2a, 0x4d22, 0x682e, 0x613d, 0x7251, 0x6941, 0x527c, + 0x5b35, 0x7367, 0x587e, 0x7c51, 0x6d32, 0x742f, 0x7b23, 0x7c41, + 0x6e2b, 0x5425, 0x7472, 0x6e59, 0x7b4a, 0x4d63, 0x583b, 0x655b, + 0x7877, 0x7654, 0x5729, 0x4b49, 0x6651, 0x704c, 0x582e, 0x7953, + 0x557e, 0x583c, 0x7230, 0x622b, 0x7368, 0x6f42, 0x6d6c, 0x6738, + 0x5a7e, 0x4c3e, 0x727c, 0x5a6b, 0x6258, 0x6d56, 0x5651, 0x6033, + 0x7c52, 0x6b48, 0x5341, 0x704d, 0x4f77, 0x6d52, 0x5458, 0x5c49, + 0x5771, 0x5f3b, 0x7325, 0x744d, 0x713f, 0x7831, 0x697a, 0x7b4b, + 0x4a55, 0x7954, 0x774a, 0x5648, 0x7c68, 0x733d, 0x6e7e, 0x677e, + 0x5342, 0x5336, 0x4c2d, 0x767a, 0x5632, 0x5258, 0x6758, 0x6325, + 0x6739, 0x702d, 0x7b4c, 0x6b21, 0x5426, 0x7b4d, 0x553d, 0x715f, + 0x767b, 0x5e34, 0x556b, 0x6548, 0x7b24, 0x5439, 0x5e61, 0x6423, + 0x5737, 0x786e, 0x5e35, 0x5652, 0x7955, 0x673a, 0x6b55, 0x5577, + 0x6f67, 0x613e, 0x7a2e, 0x5669, 0x566e, 0x673b, 0x6c4b, 0x5533, + 0x4e34, 0x7b25, 0x616e, 0x7728, 0x7b4e, 0x583d, 0x7b7d, 0x7c69, + 0x4f36, 0x6d47, 0x6e2c, 0x4c5d, 0x7627, 0x667a, 0x7524, 0x7d5c, + 0x6d33, 0x4e49, 0x6f68, 0x613f, 0x7a5b, 0x4b63, 0x7729, 0x7b26, + 0x5c39, 0x7140, 0x6d48, 0x6f43, 0x562d, 0x7d4e, 0x6821, 0x7b74, + 0x5527, 0x7176, 0x6653, 0x4c5e, 0x7832, 0x5c6b, 0x7d36, 0x656a, + 0x7160, 0x5b4c, 0x5d4d, 0x5448, 0x596d, 0x7525, 0x667b, 0x6654, + 0x7d48, 0x5621, 0x7d3f, 0x7c53, 0x6f21, 0x673c, 0x516e, 0x6655, + 0x6972, 0x5f30, 0x5860, 0x7c3a, 0x7d2f, 0x704e, 0x5b61, 0x6549, + 0x6d34, 0x6043, 0x6358, 0x697b, 0x6a28, 0x7d37, 0x7b27, 0x6942, + 0x7d77, 0x6259, 0x5c6c, 0x6822, 0x6670, 0x7d78, 0x7d79, 0x763f, + 0x6727, 0x6657, 0x5473, 0x5449, 0x567a, 0x5772, 0x6140, 0x5b62, + 0x6658, 0x673d, 0x704f, 0x733e, 0x622c, 0x7537, 0x6070, 0x7d38, + 0x6368, 0x5427, 0x687c, 0x7a52, 0x786f, 0x5653, 0x5534, 0x7050, + 0x7770, 0x6e33, 0x6a3a, 0x6a53, 0x6d49, 0x5d2b, 0x652c, 0x7d21, + 0x5f50, 0x6c33, 0x5f51, 0x6d6d, 0x7838, 0x777a, 0x782b, 0x7460, + 0x543a, 0x6433, 0x695a, 0x5e36, 0x593f, 0x5940, 0x566f, 0x594c, + 0x5a2a, 0x5f65, 0x7765, 0x4c32, 0x5f79, 0x5760, 0x543b, 0x7d7a, + 0x4c33, 0x5b73, 0x5f52, 0x4e4a, 0x6e5a, 0x6464, 0x7b4f, 0x4f37, + 0x6e43, 0x4e6a, 0x622d, 0x5761, 0x7a75, 0x5549, 0x782c, 0x6759, + 0x7369, 0x586d, 0x6344, 0x7071, 0x6865, 0x607a, 0x6e44, 0x595e, + 0x6b22, 0x6b23, 0x7c42, 0x6a3b, 0x682b, 0x5e62, 0x6d6f, 0x6823, + 0x4f71, 0x543c, 0x7c6a, 0x673e, 0x7c72, 0x5634, 0x622e, 0x5337, + 0x7a4c, 0x7a5c, 0x6d35, 0x6163, 0x682c, 0x685d, 0x6f69, 0x743d, + 0x4f38, 0x695b, 0x512c, 0x5a47, 0x6b49, 0x684c, 0x5e37, 0x563c, + 0x5365, 0x7a5d, 0x5a56, 0x4a31, 0x5a48, 0x5f26, 0x7933, 0x7252, + 0x4a44, 0x4e4b, 0x4d75, 0x7d30, 0x5528, 0x7141, 0x6269, 0x5c4a, + 0x6c34, 0x7a40, 0x7b28, 0x5028, 0x5a6c, 0x596e, 0x607b, 0x6f6a, + 0x7a5e, 0x6044, 0x4f39, 0x554a, 0x5762, 0x622f, 0x5738, 0x684d, + 0x765a, 0x6f22, 0x625a, 0x767c, 0x7b50, 0x512d, 0x4d64, 0x512e, + 0x5c6d, 0x684e, 0x7079, 0x4e35, 0x667c, 0x577b, 0x5056, 0x5d75, + 0x7771, 0x767d, 0x5b77, 0x7b6a, 0x695c, 0x5941, 0x7572, 0x6045, + 0x6a54, 0x7942, 0x6a3c, 0x5245, 0x7b51, 0x6740, 0x6b25, 0x5f7a, + 0x6322, 0x5739, 0x6943, 0x687d, 0x682f, 0x7253, 0x7b29, 0x5825, + 0x554b, 0x5048, 0x512f, 0x5763, 0x6046, 0x5622, 0x6d70, 0x5773, + 0x7c54, 0x5a57, 0x4c5f, 0x7254, 0x5130, 0x4c60, 0x5b7d, 0x733f, + 0x7051, 0x7c3b, 0x6230, 0x6625, 0x625b, 0x5f5e, 0x6047, 0x726f, + 0x4c61, 0x566a, 0x6742, 0x4e36, 0x7340, 0x4d7e, 0x7b52, 0x7878, + 0x777b, 0x683f, 0x6837, 0x6d36, 0x5c3a, 0x4c34, 0x7177, 0x6838, + 0x4a76, 0x6424, 0x7456, 0x5f66, 0x5f27, 0x5f67, 0x6141, 0x6944, + 0x5c4b, 0x6945, 0x6f23, 0x6b26, 0x4b23, 0x6369, 0x517b, 0x6f24, + 0x6f6b, 0x5034, 0x4d23, 0x6866, 0x6f25, 0x534c, 0x5a6d, 0x573a, + 0x7255, 0x7565, 0x596f, 0x7934, 0x5554, 0x7d4f, 0x5b63, 0x7161, + 0x6c36, 0x7b7e, 0x5357, 0x5131, 0x4b31, 0x5132, 0x4b32, 0x7142, + 0x7461, 0x7935, 0x6143, 0x6142, 0x6b77, 0x5f28, 0x4b4a, 0x6639, + 0x785e, 0x792a, 0x4a77, 0x6d37, 0x5338, 0x7256, 0x5459, 0x6e45, + 0x7270, 0x4a32, 0x5c3b, 0x7178, 0x6c37, 0x654a, 0x7640, 0x7d5d, + 0x5463, 0x4c62, 0x7754, 0x5765, 0x5343, 0x5826, 0x7641, 0x5d76, + 0x4d40, 0x655c, 0x654b, 0x6144, 0x6830, 0x7430, 0x736a, 0x5a6e, + 0x573b, 0x6231, 0x572a, 0x567b, 0x645f, 0x4a56, 0x6b28, 0x5b7e, + 0x7642, 0x6f3b, 0x547d, 0x6048, 0x6839, 0x6f26, 0x4d24, 0x5474, + 0x5b21, 0x5b5c, 0x5b5d, 0x6e5c, 0x4b4b, 0x7c55, 0x4e6b, 0x4d41, + 0x7b53, 0x792b, 0x7554, 0x5929, 0x695d, 0x5b4d, 0x5d4e, 0x6743, + 0x6c4c, 0x796c, 0x4b4c, 0x607c, 0x5428, 0x6d53, 0x586f, 0x7257, + 0x4a78, 0x5a6f, 0x5654, 0x594d, 0x586e, 0x7241, 0x5f53, 0x5a70, + 0x626a, 0x607d, 0x5878, 0x772f, 0x5a36, 0x4a57, 0x7258, 0x5879, + 0x7a5f, 0x4f6f, 0x5942, 0x7052, 0x6451, 0x7337, 0x7a60, 0x6f6c, + 0x6232, 0x543d, 0x594e, 0x7462, 0x5429, 0x4d42, 0x675a, 0x7259, + 0x592a, 0x583e, 0x5c2d, 0x626b, 0x567c, 0x4a79, 0x545a, 0x7457, + 0x4c21, 0x4f3a, 0x7538, 0x5943, 0x5068, 0x6345, 0x6b78, 0x7231, + 0x4f3b, 0x532d, 0x6861, 0x4e6c, 0x6034, 0x5e63, 0x5d77, 0x7232, + 0x7376, 0x765b, 0x577e, 0x785f, 0x7772, 0x5029, 0x665a, 0x7526, + 0x573c, 0x4c63, 0x665b, 0x5d5d, 0x5133, 0x6f6d, 0x565e, 0x6474, + 0x616f, 0x5d78, 0x684f, 0x4a65, 0x5c21, 0x6035, 0x7c2c, 0x7c2d, + 0x5827, 0x6d38, 0x5b36, 0x5670, 0x732f, 0x4d25, 0x5a71, 0x5828, + 0x4c64, 0x5134, 0x4a58, 0x5a72, 0x7527, 0x7528, 0x6626, 0x556c, + 0x5578, 0x5a73, 0x6346, 0x5e64, 0x5e65, 0x5135, 0x5136, 0x5137, + 0x7233, 0x695e, 0x7053, 0x7234, 0x7054, 0x4b64, 0x7b54, 0x7566, + 0x636a, 0x5e66, 0x5f54, 0x7879, 0x702e, 0x5138, 0x565f, 0x5057, + 0x7c21, 0x6f6e, 0x5c58, 0x695f, 0x655d, 0x7d7b, 0x6049, 0x5649, + 0x542a, 0x654c, 0x6960, 0x5058, 0x7c22, 0x543e, 0x6233, 0x5e67, + 0x5c3c, 0x5236, 0x7555, 0x4e21, 0x7529, 0x5d79, 0x5d7a, 0x7055, + 0x765f, 0x725a, 0x646b, 0x7271, 0x6c39, 0x7d7c, 0x612a, 0x4a59, + 0x6f6f, 0x752a, 0x6c79, 0x782d, 0x7242, 0x7643, 0x5752, 0x7922, + 0x7056, 0x707a, 0x7660, 0x6973, 0x7243, 0x542b, 0x4a33, 0x4d26, + 0x4d43, 0x4d5a, 0x594f, 0x7644, 0x6e5d, 0x6744, 0x6234, 0x5f62, + 0x675b, 0x6831, 0x7c2e, 0x654d, 0x7a6b, 0x4f3c, 0x4f62, 0x4d76, + 0x6f70, 0x743e, 0x544d, 0x7338, 0x6921, 0x7272, 0x736b, 0x7057, + 0x4f57, 0x4f5f, 0x6840, 0x6841, 0x4f63, 0x6922, 0x502a, 0x7341, + 0x502b, 0x5464, 0x6f3c, 0x5821, 0x595f, 0x7357, 0x5c3d, 0x4c65, + 0x6d71, 0x7162, 0x545b, 0x6235, 0x4a66, 0x532e, 0x4c66, 0x7153, + 0x7567, 0x4a5a, 0x7b6e, 0x6145, 0x5f69, 0x6e5e, 0x7742, 0x5822, + 0x5d2c, 0x702f, 0x563d, 0x612b, 0x7936, 0x5475, 0x5049, 0x6f27, + 0x626c, 0x5b6a, 0x4e4c, 0x7568, 0x7755, 0x534d, 0x737e, 0x5035, + 0x607e, 0x5f7b, 0x665d, 0x6824, 0x4b4d, 0x6f28, 0x6e34, 0x5a58, + 0x5139, 0x5f29, 0x7330, 0x4c44, 0x4e37, 0x6f29, 0x5f55, 0x6d57, + 0x6e46, 0x6f3d, 0x7c56, 0x5b74, 0x6f2a, 0x7839, 0x7569, 0x6359, + 0x6146, 0x543f, 0x5e68, 0x706a, 0x7342, 0x532f, 0x4a5b, 0x7c57, + 0x6d58, 0x6147, 0x7458, 0x5633, 0x5d2d, 0x553e, 0x7143, 0x6e5f, + 0x566b, 0x7459, 0x5766, 0x5a37, 0x5d7b, 0x5d4f, 0x5823, 0x5a59, + 0x7058, 0x6f44, 0x6158, 0x7154, 0x6d72, 0x555b, 0x555c, 0x7344, + 0x4b57, 0x6236, 0x6f71, 0x7b55, 0x5358, 0x5d50, 0x7059, 0x4b33, + 0x555d, 0x4d27, 0x502c, 0x513a, 0x7144, 0x6533, 0x7b75, 0x6961, + 0x7d60, 0x7c3c, 0x5a22, 0x5a23, 0x5221, 0x526f, 0x626d, 0x5e69, + 0x4e5c, 0x7235, 0x5064, 0x5d51, 0x6148, 0x5b37, 0x5f63, 0x6d39, + 0x7145, 0x734f, 0x572b, 0x612c, 0x636b, 0x6e47, 0x6149, 0x4a7a, + 0x707b, 0x7a61, 0x705a, 0x4c67, 0x5a74, 0x4c3f, 0x4e6d, 0x5529, + 0x7a62, 0x5065, 0x6b56, 0x6c5f, 0x5f7c, 0x7756, 0x5e6a, 0x4b34, + 0x6f3e, 0x4c35, 0x4f3d, 0x6f72, 0x6237, 0x4c68, 0x707c, 0x5660, + 0x7146, 0x6238, 0x6b2b, 0x4b35, 0x5851, 0x744e, 0x7377, 0x5746, + 0x513b, 0x772a, 0x6d4a, 0x5753, 0x587a, 0x7645, 0x514c, 0x5d7c, + 0x5f7d, 0x7965, 0x604a, 0x727d, 0x5330, 0x7473, 0x5a49, 0x665e, + 0x783a, 0x6850, 0x587b, 0x6a55, 0x5623, 0x7646, 0x725b, 0x647c, + 0x6832, 0x5a5a, 0x725c, 0x7b56, 0x6932, 0x6e2d, 0x7a63, 0x5c6e, + 0x756a, 0x6660, 0x707d, 0x572c, 0x7545, 0x6e60, 0x5b65, 0x5d5e, + 0x5970, 0x6923, 0x7179, 0x7244, 0x604b, 0x6924, 0x6239, 0x6331, + 0x7c6b, 0x4d28, 0x4c36, 0x705b, 0x663a, 0x4d29, 0x7343, 0x6159, + 0x6f2b, 0x6745, 0x6069, 0x7345, 0x5440, 0x553f, 0x5d2e, 0x797c, + 0x4c40, 0x6522, 0x4e38, 0x5852, 0x7956, 0x712a, 0x4e51, 0x7647, + 0x5b6b, 0x5f7e, 0x5861, 0x7773, 0x5767, 0x547e, 0x513c, 0x654f, + 0x4b36, 0x5a38, 0x4d44, 0x563e, 0x623a, 0x4f58, 0x604c, 0x6b79, + 0x7d7d, 0x5768, 0x4b58, 0x6962, 0x683a, 0x6347, 0x6c4d, 0x6c4e, + 0x563f, 0x6327, 0x5f56, 0x7d68, 0x6e61, 0x7628, 0x5d7d, 0x783b, + 0x6851, 0x7957, 0x4e6e, 0x6c4f, 0x6925, 0x5655, 0x4d45, 0x6d3a, + 0x513d, 0x4f3e, 0x6c3b, 0x5231, 0x4c69, 0x5944, 0x697c, 0x513e, + 0x6c3c, 0x652d, 0x7730, 0x4c6a, 0x5344, 0x5640, 0x567d, 0x6121, + 0x5e3d, 0x7629, 0x5a24, 0x5624, 0x7546, 0x6122, 0x6946, 0x7245, + 0x7469, 0x566c, 0x6b53, 0x6c3d, 0x625c, 0x5e6b, 0x705c, 0x6b3f, + 0x574e, 0x513f, 0x752b, 0x797d, 0x4a5c, 0x4d46, 0x7236, 0x5d7e, + 0x4c37, 0x5b38, 0x5069, 0x4e5d, 0x6b40, 0x7d22, 0x784b, 0x6a56, + 0x7130, 0x5b4e, 0x7743, 0x5b4f, 0x4b24, 0x7860, 0x7b57, 0x6b4a, + 0x6021, 0x4e4d, 0x545c, 0x7d58, 0x5276, 0x7237, 0x7a76, 0x762a, + 0x7a77, 0x5866, 0x7431, 0x6852, 0x4a45, 0x4c6b, 0x626e, 0x623b, + 0x772d, 0x7861, 0x736c, 0x5e21, 0x647d, 0x636c, 0x5d2f, 0x5d30, + 0x4b37, 0x6853, 0x6123, 0x5260, 0x707e, 0x6926, 0x4b72, 0x6d73, + 0x5c59, 0x604d, 0x775a, 0x5b39, 0x4c2e, 0x5a5b, 0x4d47, 0x5d31, + 0x582f, 0x6323, 0x4e6f, 0x7273, 0x7833, 0x604e, 0x757d, 0x6b6c, + 0x5345, 0x7c6c, 0x525b, 0x546b, 0x5e22, 0x6566, 0x7030, 0x5544, + 0x6d74, 0x636d, 0x6842, 0x6d75, 0x577c, 0x6d3b, 0x762b, 0x7238, + 0x7648, 0x5366, 0x725d, 0x4f3f, 0x6b2c, 0x4f40, 0x6628, 0x7d69, + 0x4f41, 0x605f, 0x5e6c, 0x6022, 0x743f, 0x626f, 0x5971, 0x7147, + 0x4b38, 0x797e, 0x5b3a, 0x5a75, 0x766c, 0x5a5c, 0x7a64, 0x604f, + 0x5d32, 0x6629, 0x6f73, 0x736d, 0x6b7a, 0x7966, 0x4a5d, 0x555e, + 0x4a5e, 0x5f64, 0x667d, 0x752c, 0x6475, 0x6963, 0x6d4b, 0x4f64, + 0x5853, 0x5d33, 0x546c, 0x7239, 0x5f37, 0x4b4e, 0x7b58, 0x5059, + 0x5d52, 0x7774, 0x675c, 0x6425, 0x7c23, 0x5b3b, 0x723a, 0x697d, + 0x504a, 0x7556, 0x5945, 0x6434, 0x6d27, 0x6a3d, 0x667e, 0x7744, + 0x752d, 0x5960, 0x4a34, 0x7862, 0x4f42, 0x6c3e, 0x6534, 0x4d48, + 0x6e48, 0x6748, 0x4d49, 0x7937, 0x7168, 0x5972, 0x5b75, 0x4a35, + 0x5946, 0x5849, 0x592b, 0x6d3c, 0x5854, 0x5c5a, 0x623c, 0x7c6d, + 0x6c60, 0x527e, 0x6947, 0x662a, 0x6270, 0x7a3b, 0x752e, 0x7b2a, + 0x6c7b, 0x6c3f, 0x7c58, 0x5465, 0x7943, 0x6e62, 0x5769, 0x6d76, + 0x5e6d, 0x4c6c, 0x636e, 0x6854, 0x7a78, 0x5d34, 0x6435, 0x5830, + 0x5855, 0x746a, 0x4e39, 0x5661, 0x4f52, 0x5036, 0x4e22, 0x736e, + 0x7378, 0x5c4c, 0x504b, 0x7c24, 0x4d4a, 0x5754, 0x5e23, 0x6460, + 0x6e49, 0x625d, 0x757e, 0x542c, 0x5551, 0x5870, 0x7843, 0x6a57, + 0x7557, 0x583f, 0x7d40, 0x6b2d, 0x552a, 0x6728, 0x6e4a, 0x4a67, + 0x7863, 0x545d, 0x6a58, 0x7b59, 0x6d77, 0x6535, 0x502d, 0x7171, + 0x623d, 0x6348, 0x5955, 0x5f2a, 0x5b3c, 0x7864, 0x717a, 0x6536, + 0x736f, 0x7b5a, 0x6160, 0x592c, 0x756b, 0x6036, 0x6948, 0x4b4f, + 0x6349, 0x5e6e, 0x623e, 0x5c6f, 0x5625, 0x6271, 0x567e, 0x5921, + 0x5840, 0x5c5b, 0x6d3d, 0x5f38, 0x6a25, 0x572d, 0x7379, 0x6d78, + 0x7547, 0x614a, 0x6b63, 0x725e, 0x784c, 0x6a59, 0x5346, 0x5b66, + 0x752f, 0x4e70, 0x697e, 0x7b36, 0x6272, 0x4f72, 0x7739, 0x5973, + 0x614b, 0x5a5d, 0x5a39, 0x6b7b, 0x4b39, 0x6d79, 0x6060, 0x7440, + 0x7d3c, 0x5f31, 0x636f, 0x6023, 0x7d39, 0x7031, 0x4d4b, 0x6d3e, + 0x5540, 0x6370, 0x6d7a, 0x6964, 0x556d, 0x675d, 0x5476, 0x6537, + 0x5b67, 0x623f, 0x6e4b, 0x5774, 0x705d, 0x4e2b, 0x675e, 0x5656, + 0x614c, 0x6833, 0x656e, 0x5c22, 0x6050, 0x5535, 0x5521, 0x7b5b, + 0x794b, 0x4b73, 0x7425, 0x7a48, 0x5657, 0x6965, 0x7b5c, 0x7d50, + 0x7b76, 0x5a25, 0x5b3d, 0x6c62, 0x4d77, 0x705e, 0x7649, 0x5e6f, + 0x5331, 0x7c6e, 0x6843, 0x7148, 0x4e71, 0x796d, 0x7274, 0x6436, + 0x7539, 0x5c70, 0x6371, 0x6825, 0x723b, 0x5e24, 0x5a4c, 0x4a69, + 0x635a, 0x7c59, 0x6a5a, 0x7944, 0x6324, 0x7b5d, 0x6f4a, 0x6844, + 0x554c, 0x6b57, 0x592d, 0x7b2b, 0x5359, 0x5522, 0x765e, 0x5a76, + 0x6051, 0x6928, 0x7579, 0x7a2f, 0x6b7c, 0x606a, 0x6332, 0x5545, + 0x7163, 0x556e, 0x4d4c, 0x6d59, 0x5841, 0x7a6c, 0x716b, 0x7a3c, + 0x6662, 0x7a65, 0x627a, 0x4a36, 0x6437, 0x6a5b, 0x757a, 0x7b2c, + 0x4f43, 0x6b7d, 0x787a, 0x5f39, 0x6171, 0x5224, 0x757b, 0x505a, + 0x505b, 0x6a3e, 0x5931, 0x4a37, 0x5367, 0x7865, 0x5332, 0x6240, + 0x725f, 0x4d65, 0x792c, 0x4d4d, 0x6e2e, 0x562e, 0x576a, 0x6760, + 0x6b2e, 0x4f59, 0x5c4d, 0x6d7b, 0x5e70, 0x576b, 0x5e25, 0x5f57, + 0x5b50, 0x5b51, 0x5523, 0x7032, 0x5c5c, 0x4a68, 0x7866, 0x5c4e, + 0x6a5c, 0x5b52, 0x6933, 0x775b, 0x6328, 0x572e, 0x6061, 0x4b3a, + 0x6551, 0x505c, 0x5541, 0x584a, 0x6329, 0x6024, 0x6929, 0x5347, + 0x5c5d, 0x782e, 0x4c38, 0x502e, 0x5872, 0x634a, 0x4c2f, 0x542d, + 0x7651, 0x504c, 0x4a46, 0x5542, 0x4e3a, 0x4a47, 0x7a30, 0x5f58, + 0x753a, 0x656b, 0x6f74, 0x5d35, 0x4d2a, 0x6372, 0x7b77, 0x7750, + 0x7d3a, 0x7d61, 0x767e, 0x5140, 0x6845, 0x6438, 0x6168, 0x4c41, + 0x526d, 0x5b3e, 0x6062, 0x7a49, 0x614d, 0x4a38, 0x7260, 0x7149, + 0x5e71, 0x705f, 0x7844, 0x6e4c, 0x5e72, 0x6749, 0x6273, 0x6761, + 0x634b, 0x634c, 0x4f78, 0x6f2c, 0x7d7e, 0x7c25, 0x7a31, 0x5f59, + 0x6052, 0x745a, 0x714a, 0x4e23, 0x723c, 0x6c63, 0x6025, 0x772b, + 0x6b2f, 0x655e, 0x6124, 0x4d2b, 0x5974, 0x6826, 0x4d4e, 0x6169, + 0x7c6f, 0x6063, 0x6241, 0x4e24, 0x5e26, 0x6b7e, 0x6b5d, 0x7060, + 0x745b, 0x6274, 0x5348, 0x746b, 0x6e35, 0x7558, 0x555f, 0x5665, + 0x6b30, 0x7463, 0x634d, 0x7474, 0x7a32, 0x6f75, 0x4a5f, 0x6b31, + 0x6d3f, 0x7d49, 0x6426, 0x7924, 0x7033, 0x656c, 0x5167, 0x5947, + 0x6457, 0x6a5d, 0x5477, 0x5a3a, 0x5a4d, 0x794c, 0x615a, 0x5b3f, + 0x4c45, 0x6c50, 0x4b3b, 0x5e73, 0x692a, 0x5948, 0x6e63, 0x573d, + 0x4f44, 0x504d, 0x7c26, 0x717b, 0x7d52, 0x5141, 0x635b, 0x5349, + 0x5c4f, 0x4c6d, 0x5e27, 0x663b, 0x6c21, 0x4c39, 0x7b5e, 0x6762, + 0x5441, 0x5c28, 0x6242, 0x7358, 0x6553, 0x7359, 0x7346, 0x4d5b, + 0x4d2c, 0x7c43, 0x5467, 0x5142, 0x7925, 0x6855, 0x634e, 0x544a, + 0x5f5a, 0x7b5f, 0x6763, 0x787b, 0x634f, 0x7530, 0x5867, 0x5949, + 0x782f, 0x6f76, 0x5d36, 0x6e2f, 0x4d78, 0x5e38, 0x7c27, 0x777c, + 0x7731, 0x4e3b, 0x7421, 0x6e4d, 0x612e, 0x6c43, 0x4f7e, 0x783f, + 0x5862, 0x5368, 0x5e28, 0x7464, 0x6c42, 0x5975, 0x7945, 0x5d53, + 0x5671, 0x6c7c, 0x7c70, 0x6d40, 0x4a39, 0x6e64, 0x7261, 0x5e39, + 0x5672, 0x5e74, 0x5f5b, 0x5b53, 0x7a67, 0x5863, 0x7441, 0x5d37, + 0x7275, 0x542e, 0x5673, 0x5d38, 0x4f45, 0x5f5f, 0x723e, 0x7621, + 0x6b4b, 0x717c, 0x7347, 0x606b, 0x6d7c, 0x615b, 0x6e65, 0x5e75, + 0x7a53, 0x714b, 0x502f, 0x5d39, 0x5143, 0x7531, 0x6a46, 0x7061, + 0x762c, 0x7559, 0x706b, 0x5d3a, 0x723f, 0x7745, 0x5b22, 0x7276, + 0x4a3a, 0x7775, 0x4b65, 0x6e66, 0x6053, 0x4e25, 0x5658, 0x542f, + 0x6949, 0x534e, 0x7442, 0x4b66, 0x7121, 0x6b32, 0x7122, 0x6b33, + 0x7034, 0x4b74, 0x5430, 0x7332, 0x7b37, 0x756c, 0x6e67, 0x7432, + 0x756d, 0x4f73, 0x7062, 0x6e4e, 0x714c, 0x6538, 0x5775, 0x6373, + 0x4f65, 0x4f46, 0x7333, 0x6458, 0x4f79, 0x4f5a, 0x7a4d, 0x6663, + 0x7262, 0x756e, 0x4a3b, 0x635c, 0x4e72, 0x5659, 0x6e30, 0x7465, + 0x5842, 0x5c50, 0x4c6e, 0x5560, 0x764a, 0x7d4a, 0x5856, 0x744f, + 0x5626, 0x5c3e, 0x5b54, 0x5747, 0x727e, 0x714d, 0x6243, 0x5c5e, + 0x5c5f, 0x6f2d, 0x662b, 0x795d, 0x6a3f, 0x6f2e, 0x7450, 0x4e73, + 0x662c, 0x4e5e, 0x5579, 0x6374, 0x4d50, 0x5538, 0x777d, 0x5c29, + 0x5e76, 0x5c2a, 0x7263, 0x6934, 0x525c, 0x6966, 0x6376, 0x674a, + 0x504e, 0x5a77, 0x4a3c, 0x6e68, 0x5a5e, 0x7277, 0x627b, 0x4c26, + 0x5a3b, 0x6e69, 0x755a, 0x775c, 0x616a, 0x4e41, 0x5431, 0x7d31, + 0x663d, 0x7b2d, 0x7867, 0x614e, 0x7762, 0x756f, 0x4f47, 0x5432, + 0x4c6f, 0x5468, 0x6e4f, 0x7757, 0x6026, 0x5641, 0x615c, 0x7063, + 0x7164, 0x5c71, 0x5627, 0x7475, 0x714e, 0x7264, 0x5030, 0x6c6f, + 0x793a, 0x6b35, 0x546d, 0x6244, 0x6967, 0x6b34, 0x6a21, 0x783c, + 0x4e26, 0x7946, 0x7c5a, 0x5433, 0x5339, 0x6a5e, 0x692b, 0x6161, + 0x534f, 0x7476, 0x6a40, 0x614f, 0x4c3a, 0x6e6a, 0x7064, 0x7334, + 0x546e, 0x7240, 0x7165, 0x7443, 0x6054, 0x6b36, 0x5721, 0x4b68, + 0x792d, 0x692d, 0x5864, 0x7a33, 0x6245, 0x7c3d, 0x6c44, 0x5831, + 0x5c2b, 0x5524, 0x6b69, 0x683b, 0x5857, 0x7b2e, 0x5161, 0x5b40, + 0x753e, 0x5e77, 0x4a7b, 0x7746, 0x4f48, 0x6150, 0x6e50, 0x6974, + 0x4e74, 0x554d, 0x4f5b, 0x5d3b, 0x4e2c, 0x6968, 0x5434, 0x6447, + 0x755b, 0x7a41, 0x5e29, 0x5478, 0x6f77, 0x5333, 0x6b37, 0x6f78, + 0x755c, 0x6d4c, 0x5b55, 0x714f, 0x7150, 0x7532, 0x592e, 0x552c, + 0x6246, 0x7d23, 0x7b65, 0x5f2b, 0x6275, 0x762d, 0x7533, 0x7035, + 0x6125, 0x755d, 0x6c22, 0x6d7d, 0x7534, 0x7b38, 0x5b23, 0x564a, + 0x4b59, 0x6554, 0x737a, 0x6b38, 0x6037, 0x576c, 0x716c, 0x652f, + 0x5561, 0x576d, 0x5151, 0x6172, 0x6f79, 0x5d3c, 0x765c, 0x7065, + 0x7444, 0x6969, 0x737b, 0x546f, 0x4c22, 0x777e, 0x5f3c, 0x6b4d, + 0x5037, 0x5642, 0x682d, 0x6f2f, 0x4b25, 0x4b69, 0x7a68, 0x4c46, + 0x6667, 0x6a47, 0x5b24, 0x4f49, 0x627c, 0x6f7a, 0x6b5e, 0x7548, + 0x545e, 0x6055, 0x6f30, 0x6247, 0x592f, 0x7967, 0x6765, 0x4f4a, + 0x6151, 0x6248, 0x6f7b, 0x7a79, 0x5c72, 0x6027, 0x7868, 0x4b6a, + 0x4b3c, 0x5662, 0x755e, 0x755f, 0x6e36, 0x6276, 0x534a, 0x6f7c, + 0x5144, 0x6f31, 0x5145, 0x505e, 0x5961, 0x6038, 0x4d51, 0x7339, + 0x674c, 0x5628, 0x4e27, 0x5435, 0x6448, 0x5334, 0x6b39, 0x4b75, + 0x765d, 0x7123, 0x4c47, 0x694a, 0x6170, 0x7560, 0x7b2f, 0x4b51, + 0x7b60, 0x7265, 0x6c70, 0x706c, 0x6e6b, 0x694b, 0x4c70, 0x572f, + 0x7321, 0x7c75, 0x7124, 0x6056, 0x6f32, 0x7451, 0x7721, 0x7151, + 0x4a7c, 0x4a7d, 0x4e4e, 0x7348, 0x733a, 0x6d7e, 0x5a26, 0x606c, + 0x784d, 0x4b52, 0x6b4e, 0x7958, 0x7959, 0x4a60, 0x5a4a, 0x4b26, + 0x4a48, 0x796e, 0x5b6c, 0x5031, 0x556f, 0x6673, 0x6722, 0x6459, + 0x6461, 0x7c44, 0x796f, 0x4f74, 0x7766, 0x4e3c, 0x7445, 0x5c23, + 0x5d3d, 0x7446, 0x7821, 0x6856, 0x5b41, 0x7066, 0x6439, 0x766d, + 0x792e, 0x5d3e, 0x5730, 0x5868, 0x4b3d, 0x795a, 0x784e, 0x7970, + 0x606d, 0x6333, 0x7433, 0x6a42, 0x7266, 0x7036, 0x5b56, 0x6b64, + 0x7267, 0x5755, 0x5436, 0x7968, 0x5741, 0x6555, 0x696a, 0x574c, + 0x5369, 0x6249, 0x7c5b, 0x4d2d, 0x4c30, 0x6a22, 0x6476, 0x5040, + 0x7037, 0x6e21, 0x5776, 0x624a, 0x624b, 0x7a4f, 0x6b5f, 0x564b, + 0x7434, 0x6d4d, 0x6452, 0x6a29, 0x643a, 0x7322, 0x4d52, 0x764b, + 0x7166, 0x6d41, 0x683c, 0x6e51, 0x7067, 0x624c, 0x642a, 0x7561, + 0x6d5a, 0x576e, 0x5171, 0x696b, 0x696c, 0x6064, 0x5a27, 0x5d54, + 0x6a23, 0x5643, 0x5674, 0x5a5f, 0x6f33, 0x624d, 0x6f7d, 0x7268, + 0x6f45, 0x6767, 0x577d, 0x674e, 0x5f5c, 0x7947, 0x5976, 0x5f2c, + 0x565a, 0x5c24, 0x7038, 0x557a, 0x6477, 0x5644, 0x746c, 0x6f7e, + 0x7021, 0x5e2a, 0x5a3c, 0x587c, 0x7a54, 0x6c65, 0x7c28, 0x6c66, + 0x584b, 0x7b39, 0x6453, 0x4d79, 0x4f53, 0x4a6a, 0x4f54, 0x783d, + 0x7447, 0x6a5f, 0x795b, 0x5437, 0x6b65, 0x6152, 0x6a24, 0x7a42, + 0x7b61, 0x7a6d, 0x7022, 0x4c71, 0x7a23, 0x6277, 0x624e, 0x6975, + 0x616b, 0x6768, 0x6857, 0x5a78, 0x544b, 0x7776, 0x5645, 0x5469, + 0x7a7a, 0x4c72, 0x775d, 0x5e3a, 0x4e28, 0x7039, 0x647e, 0x6449, + 0x6454, 0x6a43, 0x6f34, 0x573e, 0x7b62, 0x4d53, 0x6f35, 0x7a69, + 0x7926, 0x5f3d, 0x7747, 0x787d, 0x787c, 0x5e2b, 0x5b68, 0x635d, + 0x6162, 0x5146, 0x7650, 0x6b66, 0x5a79, 0x6c47, 0x5e78, 0x7869, + 0x635e, 0x4e75, 0x7a43, 0x6557, 0x6c48, 0x7349, 0x643b, 0x662e, + 0x6f36, 0x5c3f, 0x4e3d, 0x5843, 0x504f, 0x4f7a, 0x734a, 0x6057, + 0x5147, 0x692e, 0x683d, 0x7a44, 0x624f, 0x7a45, 0x7938, 0x5c60, + 0x7b30, 0x5829, 0x655f, 0x7927, 0x766e, 0x764c, 0x6278, 0x6c71, + 0x5a60, 0x7152, 0x524c, 0x4f4b, 0x4a3d, 0x5d3f, 0x766f, 0x5e79, + 0x7a34, 0x552d, 0x7167, 0x5e3e, 0x5c40, 0x5148, 0x5149, 0x783e, + 0x4b76, 0x5479, 0x7562, 0x6153, 0x5869, 0x787e, 0x4f4c, 0x7d24, + 0x4e76, 0x7a50, 0x4c73, 0x663e, 0x762e, 0x5570, 0x514a, 0x7c3e, + 0x5571, 0x4d69, 0x7a35, 0x6250, 0x7477, 0x4d54, 0x6723, 0x5b25, + 0x6251, 0x5722, 0x7763, 0x6a26, 0x5021, 0x4e5a, 0x7b6b, 0x5b26, + 0x5b5e, 0x5865, 0x6a60, 0x582a, 0x6560, 0x565b, 0x6f46, 0x786a, + 0x6455, 0x4e77, 0x6058, 0x576f, 0x746d, 0x4d66, 0x4c74, 0x7563, + 0x644a, 0x5c61, 0x7948, 0x7c3f, 0x6827, 0x5844, 0x4b3e, 0x5c2e, + 0x5777, 0x7068, 0x5d40, 0x4f4d, 0x5c73, 0x5930, 0x6669, 0x643c, + 0x6a44, 0x646c, 0x6465, 0x7b78, 0x4c3b, 0x643d, 0x4d5c, 0x5977, + 0x5d5f, 0x6d4e, 0x5950, 0x6523, 0x794d, 0x4d2e, 0x4f4e, 0x762f, + 0x7d53, 0x6b6d, 0x565c, 0x6524, 0x5536, 0x565d, 0x7969, 0x6724, + 0x5663, 0x514b, 0x5664, 0x5572, 0x5e7a, 0x5778, 0x586a, 0x4f55, + 0x587d, 0x582b, 0x7d4b, 0x7c5c, 0x6028, 0x5573, 0x7d59, 0x4c23, + 0x5979, 0x536a, 0x7575, 0x6f47, 0x535a, 0x5a3d, 0x6828, 0x5c2f, + 0x7023, 0x4d55, 0x6029, 0x5e2c, 0x703a, 0x6e31, 0x6e32, 0x764d, + 0x6e52, 0x5646, 0x6065, 0x733b, 0x6561, 0x644b, 0x5723, 0x5b42, + 0x4a7e, 0x4f4f, 0x3021, 0x3022, 0x3023, 0x3024, 0x3025, 0x3026, + 0x3027, 0x3028, 0x3029, 0x302a, 0x302b, 0x302c, 0x302d, 0x302e, + 0x302f, 0x3030, 0x3031, 0x3032, 0x3033, 0x3034, 0x3035, 0x3036, + 0x3037, 0x3038, 0x3039, 0x303a, 0x303b, 0x303c, 0x303d, 0x303e, + 0x303f, 0x3040, 0x3041, 0x3042, 0x3043, 0x3044, 0x3045, 0x3046, + 0x3047, 0x3048, 0x3049, 0x304a, 0x304b, 0x304c, 0x304d, 0x304e, + 0x304f, 0x3050, 0x3051, 0x3052, 0x3053, 0x3054, 0x3055, 0x3056, + 0x3057, 0x3058, 0x3059, 0x305a, 0x305b, 0x305c, 0x305d, 0x305e, + 0x305f, 0x3060, 0x3061, 0x3062, 0x3063, 0x3064, 0x3065, 0x3066, + 0x3067, 0x3068, 0x3069, 0x306a, 0x306b, 0x306c, 0x306d, 0x306e, + 0x306f, 0x3070, 0x3071, 0x3072, 0x3073, 0x3074, 0x3075, 0x3076, + 0x3077, 0x3078, 0x3079, 0x307a, 0x307b, 0x307c, 0x307d, 0x307e, + 0x3121, 0x3122, 0x3123, 0x3124, 0x3125, 0x3126, 0x3127, 0x3128, + 0x3129, 0x312a, 0x312b, 0x312c, 0x312d, 0x312e, 0x312f, 0x3130, + 0x3131, 0x3132, 0x3133, 0x3134, 0x3135, 0x3136, 0x3137, 0x3138, + 0x3139, 0x313a, 0x313b, 0x313c, 0x313d, 0x313e, 0x313f, 0x3140, + 0x3141, 0x3142, 0x3143, 0x3144, 0x3145, 0x3146, 0x3147, 0x3148, + 0x3149, 0x314a, 0x314b, 0x314c, 0x314d, 0x314e, 0x314f, 0x3150, + 0x3151, 0x3152, 0x3153, 0x3154, 0x3155, 0x3156, 0x3157, 0x3158, + 0x3159, 0x315a, 0x315b, 0x315c, 0x315d, 0x315e, 0x315f, 0x3160, + 0x3161, 0x3162, 0x3163, 0x3164, 0x3165, 0x3166, 0x3167, 0x3168, + 0x3169, 0x316a, 0x316b, 0x316c, 0x316d, 0x316e, 0x316f, 0x3170, + 0x3171, 0x3172, 0x3173, 0x3174, 0x3175, 0x3176, 0x3177, 0x3178, + 0x3179, 0x317a, 0x317b, 0x317c, 0x317d, 0x317e, 0x3221, 0x3222, + 0x3223, 0x3224, 0x3225, 0x3226, 0x3227, 0x3228, 0x3229, 0x322a, + 0x322b, 0x322c, 0x322d, 0x322e, 0x322f, 0x3230, 0x3231, 0x3232, + 0x3233, 0x3234, 0x3235, 0x3236, 0x3237, 0x3238, 0x3239, 0x323a, + 0x323b, 0x323c, 0x323d, 0x323e, 0x323f, 0x3240, 0x3241, 0x3242, + 0x3243, 0x3244, 0x3245, 0x3246, 0x3247, 0x3248, 0x3249, 0x324a, + 0x324b, 0x324c, 0x324d, 0x324e, 0x324f, 0x3250, 0x3251, 0x3252, + 0x3253, 0x3254, 0x3255, 0x3256, 0x3257, 0x3258, 0x3259, 0x325a, + 0x325b, 0x325c, 0x325d, 0x325e, 0x325f, 0x3260, 0x3261, 0x3262, + 0x3263, 0x3264, 0x3265, 0x3266, 0x3267, 0x3268, 0x3269, 0x326a, + 0x326b, 0x326c, 0x326d, 0x326e, 0x326f, 0x3270, 0x3271, 0x3272, + 0x3273, 0x3274, 0x3275, 0x3276, 0x3277, 0x3278, 0x3279, 0x327a, + 0x327b, 0x327c, 0x327d, 0x327e, 0x3321, 0x3322, 0x3323, 0x3324, + 0x3325, 0x3326, 0x3327, 0x3328, 0x3329, 0x332a, 0x332b, 0x332c, + 0x332d, 0x332e, 0x332f, 0x3330, 0x3331, 0x3332, 0x3333, 0x3334, + 0x3335, 0x3336, 0x3337, 0x3338, 0x3339, 0x333a, 0x333b, 0x333c, + 0x333d, 0x333e, 0x333f, 0x3340, 0x3341, 0x3342, 0x3343, 0x3344, + 0x3345, 0x3346, 0x3347, 0x3348, 0x3349, 0x334a, 0x334b, 0x334c, + 0x334d, 0x334e, 0x334f, 0x3350, 0x3351, 0x3352, 0x3353, 0x3354, + 0x3355, 0x3356, 0x3357, 0x3358, 0x3359, 0x335a, 0x335b, 0x335c, + 0x335d, 0x335e, 0x335f, 0x3360, 0x3361, 0x3362, 0x3363, 0x3364, + 0x3365, 0x3366, 0x3367, 0x3368, 0x3369, 0x336a, 0x336b, 0x336c, + 0x336d, 0x336e, 0x336f, 0x3370, 0x3371, 0x3372, 0x3373, 0x3374, + 0x3375, 0x3376, 0x3377, 0x3378, 0x3379, 0x337a, 0x337b, 0x337c, + 0x337d, 0x337e, 0x3421, 0x3422, 0x3423, 0x3424, 0x3425, 0x3426, + 0x3427, 0x3428, 0x3429, 0x342a, 0x342b, 0x342c, 0x342d, 0x342e, + 0x342f, 0x3430, 0x3431, 0x3432, 0x3433, 0x3434, 0x3435, 0x3436, + 0x3437, 0x3438, 0x3439, 0x343a, 0x343b, 0x343c, 0x343d, 0x343e, + 0x343f, 0x3440, 0x3441, 0x3442, 0x3443, 0x3444, 0x3445, 0x3446, + 0x3447, 0x3448, 0x3449, 0x344a, 0x344b, 0x344c, 0x344d, 0x344e, + 0x344f, 0x3450, 0x3451, 0x3452, 0x3453, 0x3454, 0x3455, 0x3456, + 0x3457, 0x3458, 0x3459, 0x345a, 0x345b, 0x345c, 0x345d, 0x345e, + 0x345f, 0x3460, 0x3461, 0x3462, 0x3463, 0x3464, 0x3465, 0x3466, + 0x3467, 0x3468, 0x3469, 0x346a, 0x346b, 0x346c, 0x346d, 0x346e, + 0x346f, 0x3470, 0x3471, 0x3472, 0x3473, 0x3474, 0x3475, 0x3476, + 0x3477, 0x3478, 0x3479, 0x347a, 0x347b, 0x347c, 0x347d, 0x347e, + 0x3521, 0x3522, 0x3523, 0x3524, 0x3525, 0x3526, 0x3527, 0x3528, + 0x3529, 0x352a, 0x352b, 0x352c, 0x352d, 0x352e, 0x352f, 0x3530, + 0x3531, 0x3532, 0x3533, 0x3534, 0x3535, 0x3536, 0x3537, 0x3538, + 0x3539, 0x353a, 0x353b, 0x353c, 0x353d, 0x353e, 0x353f, 0x3540, + 0x3541, 0x3542, 0x3543, 0x3544, 0x3545, 0x3546, 0x3547, 0x3548, + 0x3549, 0x354a, 0x354b, 0x354c, 0x354d, 0x354e, 0x354f, 0x3550, + 0x3551, 0x3552, 0x3553, 0x3554, 0x3555, 0x3556, 0x3557, 0x3558, + 0x3559, 0x355a, 0x355b, 0x355c, 0x355d, 0x355e, 0x355f, 0x3560, + 0x3561, 0x3562, 0x3563, 0x3564, 0x3565, 0x3566, 0x3567, 0x3568, + 0x3569, 0x356a, 0x356b, 0x356c, 0x356d, 0x356e, 0x356f, 0x3570, + 0x3571, 0x3572, 0x3573, 0x3574, 0x3575, 0x3576, 0x3577, 0x3578, + 0x3579, 0x357a, 0x357b, 0x357c, 0x357d, 0x357e, 0x3621, 0x3622, + 0x3623, 0x3624, 0x3625, 0x3626, 0x3627, 0x3628, 0x3629, 0x362a, + 0x362b, 0x362c, 0x362d, 0x362e, 0x362f, 0x3630, 0x3631, 0x3632, + 0x3633, 0x3634, 0x3635, 0x3636, 0x3637, 0x3638, 0x3639, 0x363a, + 0x363b, 0x363c, 0x363d, 0x363e, 0x363f, 0x3640, 0x3641, 0x3642, + 0x3643, 0x3644, 0x3645, 0x3646, 0x3647, 0x3648, 0x3649, 0x364a, + 0x364b, 0x364c, 0x364d, 0x364e, 0x364f, 0x3650, 0x3651, 0x3652, + 0x3653, 0x3654, 0x3655, 0x3656, 0x3657, 0x3658, 0x3659, 0x365a, + 0x365b, 0x365c, 0x365d, 0x365e, 0x365f, 0x3660, 0x3661, 0x3662, + 0x3663, 0x3664, 0x3665, 0x3666, 0x3667, 0x3668, 0x3669, 0x366a, + 0x366b, 0x366c, 0x366d, 0x366e, 0x366f, 0x3670, 0x3671, 0x3672, + 0x3673, 0x3674, 0x3675, 0x3676, 0x3677, 0x3678, 0x3679, 0x367a, + 0x367b, 0x367c, 0x367d, 0x367e, 0x3721, 0x3722, 0x3723, 0x3724, + 0x3725, 0x3726, 0x3727, 0x3728, 0x3729, 0x372a, 0x372b, 0x372c, + 0x372d, 0x372e, 0x372f, 0x3730, 0x3731, 0x3732, 0x3733, 0x3734, + 0x3735, 0x3736, 0x3737, 0x3738, 0x3739, 0x373a, 0x373b, 0x373c, + 0x373d, 0x373e, 0x373f, 0x3740, 0x3741, 0x3742, 0x3743, 0x3744, + 0x3745, 0x3746, 0x3747, 0x3748, 0x3749, 0x374a, 0x374b, 0x374c, + 0x374d, 0x374e, 0x374f, 0x3750, 0x3751, 0x3752, 0x3753, 0x3754, + 0x3755, 0x3756, 0x3757, 0x3758, 0x3759, 0x375a, 0x375b, 0x375c, + 0x375d, 0x375e, 0x375f, 0x3760, 0x3761, 0x3762, 0x3763, 0x3764, + 0x3765, 0x3766, 0x3767, 0x3768, 0x3769, 0x376a, 0x376b, 0x376c, + 0x376d, 0x376e, 0x376f, 0x3770, 0x3771, 0x3772, 0x3773, 0x3774, + 0x3775, 0x3776, 0x3777, 0x3778, 0x3779, 0x377a, 0x377b, 0x377c, + 0x377d, 0x377e, 0x3821, 0x3822, 0x3823, 0x3824, 0x3825, 0x3826, + 0x3827, 0x3828, 0x3829, 0x382a, 0x382b, 0x382c, 0x382d, 0x382e, + 0x382f, 0x3830, 0x3831, 0x3832, 0x3833, 0x3834, 0x3835, 0x3836, + 0x3837, 0x3838, 0x3839, 0x383a, 0x383b, 0x383c, 0x383d, 0x383e, + 0x383f, 0x3840, 0x3841, 0x3842, 0x3843, 0x3844, 0x3845, 0x3846, + 0x3847, 0x3848, 0x3849, 0x384a, 0x384b, 0x384c, 0x384d, 0x384e, + 0x384f, 0x3850, 0x3851, 0x3852, 0x3853, 0x3854, 0x3855, 0x3856, + 0x3857, 0x3858, 0x3859, 0x385a, 0x385b, 0x385c, 0x385d, 0x385e, + 0x385f, 0x3860, 0x3861, 0x3862, 0x3863, 0x3864, 0x3865, 0x3866, + 0x3867, 0x3868, 0x3869, 0x386a, 0x386b, 0x386c, 0x386d, 0x386e, + 0x386f, 0x3870, 0x3871, 0x3872, 0x3873, 0x3874, 0x3875, 0x3876, + 0x3877, 0x3878, 0x3879, 0x387a, 0x387b, 0x387c, 0x387d, 0x387e, + 0x3921, 0x3922, 0x3923, 0x3924, 0x3925, 0x3926, 0x3927, 0x3928, + 0x3929, 0x392a, 0x392b, 0x392c, 0x392d, 0x392e, 0x392f, 0x3930, + 0x3931, 0x3932, 0x3933, 0x3934, 0x3935, 0x3936, 0x3937, 0x3938, + 0x3939, 0x393a, 0x393b, 0x393c, 0x393d, 0x393e, 0x393f, 0x3940, + 0x3941, 0x3942, 0x3943, 0x3944, 0x3945, 0x3946, 0x3947, 0x3948, + 0x3949, 0x394a, 0x394b, 0x394c, 0x394d, 0x394e, 0x394f, 0x3950, + 0x3951, 0x3952, 0x3953, 0x3954, 0x3955, 0x3956, 0x3957, 0x3958, + 0x3959, 0x395a, 0x395b, 0x395c, 0x395d, 0x395e, 0x395f, 0x3960, + 0x3961, 0x3962, 0x3963, 0x3964, 0x3965, 0x3966, 0x3967, 0x3968, + 0x3969, 0x396a, 0x396b, 0x396c, 0x396d, 0x396e, 0x396f, 0x3970, + 0x3971, 0x3972, 0x3973, 0x3974, 0x3975, 0x3976, 0x3977, 0x3978, + 0x3979, 0x397a, 0x397b, 0x397c, 0x397d, 0x397e, 0x3a21, 0x3a22, + 0x3a23, 0x3a24, 0x3a25, 0x3a26, 0x3a27, 0x3a28, 0x3a29, 0x3a2a, + 0x3a2b, 0x3a2c, 0x3a2d, 0x3a2e, 0x3a2f, 0x3a30, 0x3a31, 0x3a32, + 0x3a33, 0x3a34, 0x3a35, 0x3a36, 0x3a37, 0x3a38, 0x3a39, 0x3a3a, + 0x3a3b, 0x3a3c, 0x3a3d, 0x3a3e, 0x3a3f, 0x3a40, 0x3a41, 0x3a42, + 0x3a43, 0x3a44, 0x3a45, 0x3a46, 0x3a47, 0x3a48, 0x3a49, 0x3a4a, + 0x3a4b, 0x3a4c, 0x3a4d, 0x3a4e, 0x3a4f, 0x3a50, 0x3a51, 0x3a52, + 0x3a53, 0x3a54, 0x3a55, 0x3a56, 0x3a57, 0x3a58, 0x3a59, 0x3a5a, + 0x3a5b, 0x3a5c, 0x3a5d, 0x3a5e, 0x3a5f, 0x3a60, 0x3a61, 0x3a62, + 0x3a63, 0x3a64, 0x3a65, 0x3a66, 0x3a67, 0x3a68, 0x3a69, 0x3a6a, + 0x3a6b, 0x3a6c, 0x3a6d, 0x3a6e, 0x3a6f, 0x3a70, 0x3a71, 0x3a72, + 0x3a73, 0x3a74, 0x3a75, 0x3a76, 0x3a77, 0x3a78, 0x3a79, 0x3a7a, + 0x3a7b, 0x3a7c, 0x3a7d, 0x3a7e, 0x3b21, 0x3b22, 0x3b23, 0x3b24, + 0x3b25, 0x3b26, 0x3b27, 0x3b28, 0x3b29, 0x3b2a, 0x3b2b, 0x3b2c, + 0x3b2d, 0x3b2e, 0x3b2f, 0x3b30, 0x3b31, 0x3b32, 0x3b33, 0x3b34, + 0x3b35, 0x3b36, 0x3b37, 0x3b38, 0x3b39, 0x3b3a, 0x3b3b, 0x3b3c, + 0x3b3d, 0x3b3e, 0x3b3f, 0x3b40, 0x3b41, 0x3b42, 0x3b43, 0x3b44, + 0x3b45, 0x3b46, 0x3b47, 0x3b48, 0x3b49, 0x3b4a, 0x3b4b, 0x3b4c, + 0x3b4d, 0x3b4e, 0x3b4f, 0x3b50, 0x3b51, 0x3b52, 0x3b53, 0x3b54, + 0x3b55, 0x3b56, 0x3b57, 0x3b58, 0x3b59, 0x3b5a, 0x3b5b, 0x3b5c, + 0x3b5d, 0x3b5e, 0x3b5f, 0x3b60, 0x3b61, 0x3b62, 0x3b63, 0x3b64, + 0x3b65, 0x3b66, 0x3b67, 0x3b68, 0x3b69, 0x3b6a, 0x3b6b, 0x3b6c, + 0x3b6d, 0x3b6e, 0x3b6f, 0x3b70, 0x3b71, 0x3b72, 0x3b73, 0x3b74, + 0x3b75, 0x3b76, 0x3b77, 0x3b78, 0x3b79, 0x3b7a, 0x3b7b, 0x3b7c, + 0x3b7d, 0x3b7e, 0x3c21, 0x3c22, 0x3c23, 0x3c24, 0x3c25, 0x3c26, + 0x3c27, 0x3c28, 0x3c29, 0x3c2a, 0x3c2b, 0x3c2c, 0x3c2d, 0x3c2e, + 0x3c2f, 0x3c30, 0x3c31, 0x3c32, 0x3c33, 0x3c34, 0x3c35, 0x3c36, + 0x3c37, 0x3c38, 0x3c39, 0x3c3a, 0x3c3b, 0x3c3c, 0x3c3d, 0x3c3e, + 0x3c3f, 0x3c40, 0x3c41, 0x3c42, 0x3c43, 0x3c44, 0x3c45, 0x3c46, + 0x3c47, 0x3c48, 0x3c49, 0x3c4a, 0x3c4b, 0x3c4c, 0x3c4d, 0x3c4e, + 0x3c4f, 0x3c50, 0x3c51, 0x3c52, 0x3c53, 0x3c54, 0x3c55, 0x3c56, + 0x3c57, 0x3c58, 0x3c59, 0x3c5a, 0x3c5b, 0x3c5c, 0x3c5d, 0x3c5e, + 0x3c5f, 0x3c60, 0x3c61, 0x3c62, 0x3c63, 0x3c64, 0x3c65, 0x3c66, + 0x3c67, 0x3c68, 0x3c69, 0x3c6a, 0x3c6b, 0x3c6c, 0x3c6d, 0x3c6e, + 0x3c6f, 0x3c70, 0x3c71, 0x3c72, 0x3c73, 0x3c74, 0x3c75, 0x3c76, + 0x3c77, 0x3c78, 0x3c79, 0x3c7a, 0x3c7b, 0x3c7c, 0x3c7d, 0x3c7e, + 0x3d21, 0x3d22, 0x3d23, 0x3d24, 0x3d25, 0x3d26, 0x3d27, 0x3d28, + 0x3d29, 0x3d2a, 0x3d2b, 0x3d2c, 0x3d2d, 0x3d2e, 0x3d2f, 0x3d30, + 0x3d31, 0x3d32, 0x3d33, 0x3d34, 0x3d35, 0x3d36, 0x3d37, 0x3d38, + 0x3d39, 0x3d3a, 0x3d3b, 0x3d3c, 0x3d3d, 0x3d3e, 0x3d3f, 0x3d40, + 0x3d41, 0x3d42, 0x3d43, 0x3d44, 0x3d45, 0x3d46, 0x3d47, 0x3d48, + 0x3d49, 0x3d4a, 0x3d4b, 0x3d4c, 0x3d4d, 0x3d4e, 0x3d4f, 0x3d50, + 0x3d51, 0x3d52, 0x3d53, 0x3d54, 0x3d55, 0x3d56, 0x3d57, 0x3d58, + 0x3d59, 0x3d5a, 0x3d5b, 0x3d5c, 0x3d5d, 0x3d5e, 0x3d5f, 0x3d60, + 0x3d61, 0x3d62, 0x3d63, 0x3d64, 0x3d65, 0x3d66, 0x3d67, 0x3d68, + 0x3d69, 0x3d6a, 0x3d6b, 0x3d6c, 0x3d6d, 0x3d6e, 0x3d6f, 0x3d70, + 0x3d71, 0x3d72, 0x3d73, 0x3d74, 0x3d75, 0x3d76, 0x3d77, 0x3d78, + 0x3d79, 0x3d7a, 0x3d7b, 0x3d7c, 0x3d7d, 0x3d7e, 0x3e21, 0x3e22, + 0x3e23, 0x3e24, 0x3e25, 0x3e26, 0x3e27, 0x3e28, 0x3e29, 0x3e2a, + 0x3e2b, 0x3e2c, 0x3e2d, 0x3e2e, 0x3e2f, 0x3e30, 0x3e31, 0x3e32, + 0x3e33, 0x3e34, 0x3e35, 0x3e36, 0x3e37, 0x3e38, 0x3e39, 0x3e3a, + 0x3e3b, 0x3e3c, 0x3e3d, 0x3e3e, 0x3e3f, 0x3e40, 0x3e41, 0x3e42, + 0x3e43, 0x3e44, 0x3e45, 0x3e46, 0x3e47, 0x3e48, 0x3e49, 0x3e4a, + 0x3e4b, 0x3e4c, 0x3e4d, 0x3e4e, 0x3e4f, 0x3e50, 0x3e51, 0x3e52, + 0x3e53, 0x3e54, 0x3e55, 0x3e56, 0x3e57, 0x3e58, 0x3e59, 0x3e5a, + 0x3e5b, 0x3e5c, 0x3e5d, 0x3e5e, 0x3e5f, 0x3e60, 0x3e61, 0x3e62, + 0x3e63, 0x3e64, 0x3e65, 0x3e66, 0x3e67, 0x3e68, 0x3e69, 0x3e6a, + 0x3e6b, 0x3e6c, 0x3e6d, 0x3e6e, 0x3e6f, 0x3e70, 0x3e71, 0x3e72, + 0x3e73, 0x3e74, 0x3e75, 0x3e76, 0x3e77, 0x3e78, 0x3e79, 0x3e7a, + 0x3e7b, 0x3e7c, 0x3e7d, 0x3e7e, 0x3f21, 0x3f22, 0x3f23, 0x3f24, + 0x3f25, 0x3f26, 0x3f27, 0x3f28, 0x3f29, 0x3f2a, 0x3f2b, 0x3f2c, + 0x3f2d, 0x3f2e, 0x3f2f, 0x3f30, 0x3f31, 0x3f32, 0x3f33, 0x3f34, + 0x3f35, 0x3f36, 0x3f37, 0x3f38, 0x3f39, 0x3f3a, 0x3f3b, 0x3f3c, + 0x3f3d, 0x3f3e, 0x3f3f, 0x3f40, 0x3f41, 0x3f42, 0x3f43, 0x3f44, + 0x3f45, 0x3f46, 0x3f47, 0x3f48, 0x3f49, 0x3f4a, 0x3f4b, 0x3f4c, + 0x3f4d, 0x3f4e, 0x3f4f, 0x3f50, 0x3f51, 0x3f52, 0x3f53, 0x3f54, + 0x3f55, 0x3f56, 0x3f57, 0x3f58, 0x3f59, 0x3f5a, 0x3f5b, 0x3f5c, + 0x3f5d, 0x3f5e, 0x3f5f, 0x3f60, 0x3f61, 0x3f62, 0x3f63, 0x3f64, + 0x3f65, 0x3f66, 0x3f67, 0x3f68, 0x3f69, 0x3f6a, 0x3f6b, 0x3f6c, + 0x3f6d, 0x3f6e, 0x3f6f, 0x3f70, 0x3f71, 0x3f72, 0x3f73, 0x3f74, + 0x3f75, 0x3f76, 0x3f77, 0x3f78, 0x3f79, 0x3f7a, 0x3f7b, 0x3f7c, + 0x3f7d, 0x3f7e, 0x4021, 0x4022, 0x4023, 0x4024, 0x4025, 0x4026, + 0x4027, 0x4028, 0x4029, 0x402a, 0x402b, 0x402c, 0x402d, 0x402e, + 0x402f, 0x4030, 0x4031, 0x4032, 0x4033, 0x4034, 0x4035, 0x4036, + 0x4037, 0x4038, 0x4039, 0x403a, 0x403b, 0x403c, 0x403d, 0x403e, + 0x403f, 0x4040, 0x4041, 0x4042, 0x4043, 0x4044, 0x4045, 0x4046, + 0x4047, 0x4048, 0x4049, 0x404a, 0x404b, 0x404c, 0x404d, 0x404e, + 0x404f, 0x4050, 0x4051, 0x4052, 0x4053, 0x4054, 0x4055, 0x4056, + 0x4057, 0x4058, 0x4059, 0x405a, 0x405b, 0x405c, 0x405d, 0x405e, + 0x405f, 0x4060, 0x4061, 0x4062, 0x4063, 0x4064, 0x4065, 0x4066, + 0x4067, 0x4068, 0x4069, 0x406a, 0x406b, 0x406c, 0x406d, 0x406e, + 0x406f, 0x4070, 0x4071, 0x4072, 0x4073, 0x4074, 0x4075, 0x4076, + 0x4077, 0x4078, 0x4079, 0x407a, 0x407b, 0x407c, 0x407d, 0x407e, + 0x4121, 0x4122, 0x4123, 0x4124, 0x4125, 0x4126, 0x4127, 0x4128, + 0x4129, 0x412a, 0x412b, 0x412c, 0x412d, 0x412e, 0x412f, 0x4130, + 0x4131, 0x4132, 0x4133, 0x4134, 0x4135, 0x4136, 0x4137, 0x4138, + 0x4139, 0x413a, 0x413b, 0x413c, 0x413d, 0x413e, 0x413f, 0x4140, + 0x4141, 0x4142, 0x4143, 0x4144, 0x4145, 0x4146, 0x4147, 0x4148, + 0x4149, 0x414a, 0x414b, 0x414c, 0x414d, 0x414e, 0x414f, 0x4150, + 0x4151, 0x4152, 0x4153, 0x4154, 0x4155, 0x4156, 0x4157, 0x4158, + 0x4159, 0x415a, 0x415b, 0x415c, 0x415d, 0x415e, 0x415f, 0x4160, + 0x4161, 0x4162, 0x4163, 0x4164, 0x4165, 0x4166, 0x4167, 0x4168, + 0x4169, 0x416a, 0x416b, 0x416c, 0x416d, 0x416e, 0x416f, 0x4170, + 0x4171, 0x4172, 0x4173, 0x4174, 0x4175, 0x4176, 0x4177, 0x4178, + 0x4179, 0x417a, 0x417b, 0x417c, 0x417d, 0x417e, 0x4221, 0x4222, + 0x4223, 0x4224, 0x4225, 0x4226, 0x4227, 0x4228, 0x4229, 0x422a, + 0x422b, 0x422c, 0x422d, 0x422e, 0x422f, 0x4230, 0x4231, 0x4232, + 0x4233, 0x4234, 0x4235, 0x4236, 0x4237, 0x4238, 0x4239, 0x423a, + 0x423b, 0x423c, 0x423d, 0x423e, 0x423f, 0x4240, 0x4241, 0x4242, + 0x4243, 0x4244, 0x4245, 0x4246, 0x4247, 0x4248, 0x4249, 0x424a, + 0x424b, 0x424c, 0x424d, 0x424e, 0x424f, 0x4250, 0x4251, 0x4252, + 0x4253, 0x4254, 0x4255, 0x4256, 0x4257, 0x4258, 0x4259, 0x425a, + 0x425b, 0x425c, 0x425d, 0x425e, 0x425f, 0x4260, 0x4261, 0x4262, + 0x4263, 0x4264, 0x4265, 0x4266, 0x4267, 0x4268, 0x4269, 0x426a, + 0x426b, 0x426c, 0x426d, 0x426e, 0x426f, 0x4270, 0x4271, 0x4272, + 0x4273, 0x4274, 0x4275, 0x4276, 0x4277, 0x4278, 0x4279, 0x427a, + 0x427b, 0x427c, 0x427d, 0x427e, 0x4321, 0x4322, 0x4323, 0x4324, + 0x4325, 0x4326, 0x4327, 0x4328, 0x4329, 0x432a, 0x432b, 0x432c, + 0x432d, 0x432e, 0x432f, 0x4330, 0x4331, 0x4332, 0x4333, 0x4334, + 0x4335, 0x4336, 0x4337, 0x4338, 0x4339, 0x433a, 0x433b, 0x433c, + 0x433d, 0x433e, 0x433f, 0x4340, 0x4341, 0x4342, 0x4343, 0x4344, + 0x4345, 0x4346, 0x4347, 0x4348, 0x4349, 0x434a, 0x434b, 0x434c, + 0x434d, 0x434e, 0x434f, 0x4350, 0x4351, 0x4352, 0x4353, 0x4354, + 0x4355, 0x4356, 0x4357, 0x4358, 0x4359, 0x435a, 0x435b, 0x435c, + 0x435d, 0x435e, 0x435f, 0x4360, 0x4361, 0x4362, 0x4363, 0x4364, + 0x4365, 0x4366, 0x4367, 0x4368, 0x4369, 0x436a, 0x436b, 0x436c, + 0x436d, 0x436e, 0x436f, 0x4370, 0x4371, 0x4372, 0x4373, 0x4374, + 0x4375, 0x4376, 0x4377, 0x4378, 0x4379, 0x437a, 0x437b, 0x437c, + 0x437d, 0x437e, 0x4421, 0x4422, 0x4423, 0x4424, 0x4425, 0x4426, + 0x4427, 0x4428, 0x4429, 0x442a, 0x442b, 0x442c, 0x442d, 0x442e, + 0x442f, 0x4430, 0x4431, 0x4432, 0x4433, 0x4434, 0x4435, 0x4436, + 0x4437, 0x4438, 0x4439, 0x443a, 0x443b, 0x443c, 0x443d, 0x443e, + 0x443f, 0x4440, 0x4441, 0x4442, 0x4443, 0x4444, 0x4445, 0x4446, + 0x4447, 0x4448, 0x4449, 0x444a, 0x444b, 0x444c, 0x444d, 0x444e, + 0x444f, 0x4450, 0x4451, 0x4452, 0x4453, 0x4454, 0x4455, 0x4456, + 0x4457, 0x4458, 0x4459, 0x445a, 0x445b, 0x445c, 0x445d, 0x445e, + 0x445f, 0x4460, 0x4461, 0x4462, 0x4463, 0x4464, 0x4465, 0x4466, + 0x4467, 0x4468, 0x4469, 0x446a, 0x446b, 0x446c, 0x446d, 0x446e, + 0x446f, 0x4470, 0x4471, 0x4472, 0x4473, 0x4474, 0x4475, 0x4476, + 0x4477, 0x4478, 0x4479, 0x447a, 0x447b, 0x447c, 0x447d, 0x447e, + 0x4521, 0x4522, 0x4523, 0x4524, 0x4525, 0x4526, 0x4527, 0x4528, + 0x4529, 0x452a, 0x452b, 0x452c, 0x452d, 0x452e, 0x452f, 0x4530, + 0x4531, 0x4532, 0x4533, 0x4534, 0x4535, 0x4536, 0x4537, 0x4538, + 0x4539, 0x453a, 0x453b, 0x453c, 0x453d, 0x453e, 0x453f, 0x4540, + 0x4541, 0x4542, 0x4543, 0x4544, 0x4545, 0x4546, 0x4547, 0x4548, + 0x4549, 0x454a, 0x454b, 0x454c, 0x454d, 0x454e, 0x454f, 0x4550, + 0x4551, 0x4552, 0x4553, 0x4554, 0x4555, 0x4556, 0x4557, 0x4558, + 0x4559, 0x455a, 0x455b, 0x455c, 0x455d, 0x455e, 0x455f, 0x4560, + 0x4561, 0x4562, 0x4563, 0x4564, 0x4565, 0x4566, 0x4567, 0x4568, + 0x4569, 0x456a, 0x456b, 0x456c, 0x456d, 0x456e, 0x456f, 0x4570, + 0x4571, 0x4572, 0x4573, 0x4574, 0x4575, 0x4576, 0x4577, 0x4578, + 0x4579, 0x457a, 0x457b, 0x457c, 0x457d, 0x457e, 0x4621, 0x4622, + 0x4623, 0x4624, 0x4625, 0x4626, 0x4627, 0x4628, 0x4629, 0x462a, + 0x462b, 0x462c, 0x462d, 0x462e, 0x462f, 0x4630, 0x4631, 0x4632, + 0x4633, 0x4634, 0x4635, 0x4636, 0x4637, 0x4638, 0x4639, 0x463a, + 0x463b, 0x463c, 0x463d, 0x463e, 0x463f, 0x4640, 0x4641, 0x4642, + 0x4643, 0x4644, 0x4645, 0x4646, 0x4647, 0x4648, 0x4649, 0x464a, + 0x464b, 0x464c, 0x464d, 0x464e, 0x464f, 0x4650, 0x4651, 0x4652, + 0x4653, 0x4654, 0x4655, 0x4656, 0x4657, 0x4658, 0x4659, 0x465a, + 0x465b, 0x465c, 0x465d, 0x465e, 0x465f, 0x4660, 0x4661, 0x4662, + 0x4663, 0x4664, 0x4665, 0x4666, 0x4667, 0x4668, 0x4669, 0x466a, + 0x466b, 0x466c, 0x466d, 0x466e, 0x466f, 0x4670, 0x4671, 0x4672, + 0x4673, 0x4674, 0x4675, 0x4676, 0x4677, 0x4678, 0x4679, 0x467a, + 0x467b, 0x467c, 0x467d, 0x467e, 0x4721, 0x4722, 0x4723, 0x4724, + 0x4725, 0x4726, 0x4727, 0x4728, 0x4729, 0x472a, 0x472b, 0x472c, + 0x472d, 0x472e, 0x472f, 0x4730, 0x4731, 0x4732, 0x4733, 0x4734, + 0x4735, 0x4736, 0x4737, 0x4738, 0x4739, 0x473a, 0x473b, 0x473c, + 0x473d, 0x473e, 0x473f, 0x4740, 0x4741, 0x4742, 0x4743, 0x4744, + 0x4745, 0x4746, 0x4747, 0x4748, 0x4749, 0x474a, 0x474b, 0x474c, + 0x474d, 0x474e, 0x474f, 0x4750, 0x4751, 0x4752, 0x4753, 0x4754, + 0x4755, 0x4756, 0x4757, 0x4758, 0x4759, 0x475a, 0x475b, 0x475c, + 0x475d, 0x475e, 0x475f, 0x4760, 0x4761, 0x4762, 0x4763, 0x4764, + 0x4765, 0x4766, 0x4767, 0x4768, 0x4769, 0x476a, 0x476b, 0x476c, + 0x476d, 0x476e, 0x476f, 0x4770, 0x4771, 0x4772, 0x4773, 0x4774, + 0x4775, 0x4776, 0x4777, 0x4778, 0x4779, 0x477a, 0x477b, 0x477c, + 0x477d, 0x477e, 0x4821, 0x4822, 0x4823, 0x4824, 0x4825, 0x4826, + 0x4827, 0x4828, 0x4829, 0x482a, 0x482b, 0x482c, 0x482d, 0x482e, + 0x482f, 0x4830, 0x4831, 0x4832, 0x4833, 0x4834, 0x4835, 0x4836, + 0x4837, 0x4838, 0x4839, 0x483a, 0x483b, 0x483c, 0x483d, 0x483e, + 0x483f, 0x4840, 0x4841, 0x4842, 0x4843, 0x4844, 0x4845, 0x4846, + 0x4847, 0x4848, 0x4849, 0x484a, 0x484b, 0x484c, 0x484d, 0x484e, + 0x484f, 0x4850, 0x4851, 0x4852, 0x4853, 0x4854, 0x4855, 0x4856, + 0x4857, 0x4858, 0x4859, 0x485a, 0x485b, 0x485c, 0x485d, 0x485e, + 0x485f, 0x4860, 0x4861, 0x4862, 0x4863, 0x4864, 0x4865, 0x4866, + 0x4867, 0x4868, 0x4869, 0x486a, 0x486b, 0x486c, 0x486d, 0x486e, + 0x486f, 0x4870, 0x4871, 0x4872, 0x4873, 0x4874, 0x4875, 0x4876, + 0x4877, 0x4878, 0x4879, 0x487a, 0x487b, 0x487c, 0x487d, 0x487e, + 0x4b50, 0x4b56, 0x4b67, 0x4d4f, 0x4d68, 0x4e2d, 0x4f7b, 0x5022, + 0x5038, 0x5050, 0x505d, 0x5154, 0x5155, 0x5158, 0x515b, 0x515c, + 0x515d, 0x515e, 0x515f, 0x5160, 0x5162, 0x5163, 0x5164, 0x5165, + 0x5166, 0x5168, 0x5169, 0x516a, 0x516b, 0x516d, 0x516f, 0x5170, + 0x5172, 0x5176, 0x517a, 0x517c, 0x517d, 0x517e, 0x5222, 0x5223, + 0x5227, 0x5228, 0x5229, 0x522a, 0x522b, 0x522d, 0x5232, 0x523e, + 0x5242, 0x5243, 0x5244, 0x5246, 0x5247, 0x5248, 0x5249, 0x524a, + 0x524b, 0x524d, 0x524e, 0x524f, 0x5250, 0x5251, 0x5252, 0x5253, + 0x5254, 0x5255, 0x5256, 0x5257, 0x5259, 0x525a, 0x525e, 0x525f, + 0x5261, 0x5262, 0x5264, 0x5265, 0x5266, 0x5267, 0x5268, 0x5269, + 0x526a, 0x526b, 0x5270, 0x5271, 0x5272, 0x5273, 0x5274, 0x5275, + 0x5277, 0x5278, 0x5466, 0x547c, 0x5525, 0x552b, 0x552e, 0x5638, + 0x564d, 0x574b, 0x5764, 0x5b45, 0x5b64, 0x5c25, 0x5d25, 0x5d55, + 0x5d74, 0x5e7c, 0x5e7e, 0x5f33, 0x5f61, 0x5f68, 0x6071, 0x612d, + 0x616d, 0x6375, 0x6421, 0x6429, 0x652e, 0x6531, 0x6532, 0x6539, + 0x653b, 0x653c, 0x6544, 0x654e, 0x6550, 0x6552, 0x6556, 0x657a, + 0x657b, 0x657c, 0x657e, 0x6621, 0x6624, 0x6627, 0x662d, 0x662f, + 0x6630, 0x6631, 0x6633, 0x6637, 0x6638, 0x663c, 0x6644, 0x6646, + 0x6647, 0x664a, 0x6652, 0x6656, 0x6659, 0x665c, 0x665f, 0x6661, + 0x6664, 0x6665, 0x6666, 0x6668, 0x666a, 0x666b, 0x666c, 0x666f, + 0x6671, 0x6672, 0x6675, 0x6676, 0x6677, 0x6679, 0x6721, 0x6726, + 0x6729, 0x672a, 0x672c, 0x672d, 0x6730, 0x673f, 0x6741, 0x6746, + 0x6747, 0x674b, 0x674d, 0x674f, 0x6750, 0x6753, 0x675f, 0x6764, + 0x6766, 0x6777, 0x6867, 0x6868, 0x6870, 0x6871, 0x6877, 0x6879, + 0x687b, 0x687e, 0x6927, 0x692c, 0x694c, 0x6977, 0x6a41, 0x6a65, + 0x6a74, 0x6a77, 0x6a7c, 0x6a7e, 0x6b24, 0x6b27, 0x6b29, 0x6b2a, + 0x6b3a, 0x6b3b, 0x6b3d, 0x6b41, 0x6b42, 0x6b46, 0x6b47, 0x6b4c, + 0x6b4f, 0x6b50, 0x6b51, 0x6b52, 0x6b58, 0x6c26, 0x6c27, 0x6c2a, + 0x6c2f, 0x6c30, 0x6c31, 0x6c32, 0x6c35, 0x6c38, 0x6c3a, 0x6c40, + 0x6c41, 0x6c45, 0x6c46, 0x6c49, 0x6c4a, 0x6c55, 0x6c5d, 0x6c5e, + 0x6c61, 0x6c64, 0x6c67, 0x6c68, 0x6c77, 0x6c78, 0x6c7a, 0x6d21, + 0x6d22, 0x6d23, 0x6d6e, 0x6e5b, 0x723d, 0x727a, 0x7331, 0x7427, + 0x746e, 0x7674, 0x7676, 0x7738, 0x7748, 0x7753, 0x785b, 0x7870, + 0x7a21, 0x7a22, 0x7a66, 0x7c29, 0x2321, 0x2322, 0x2323, 0x2324, + 0x2325, 0x2326, 0x2327, 0x2328, 0x2329, 0x232a, 0x232b, 0x232c, + 0x232d, 0x232e, 0x232f, 0x2330, 0x2331, 0x2332, 0x2333, 0x2334, + 0x2335, 0x2336, 0x2337, 0x2338, 0x2339, 0x233a, 0x233b, 0x233c, + 0x233d, 0x233e, 0x233f, 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, + 0x2345, 0x2346, 0x2347, 0x2348, 0x2349, 0x234a, 0x234b, 0x234c, + 0x234d, 0x234e, 0x234f, 0x2350, 0x2351, 0x2352, 0x2353, 0x2354, + 0x2355, 0x2356, 0x2357, 0x2358, 0x2359, 0x235a, 0x235b, 0x212c, + 0x235d, 0x235e, 0x235f, 0x2360, 0x2361, 0x2362, 0x2363, 0x2364, + 0x2365, 0x2366, 0x2367, 0x2368, 0x2369, 0x236a, 0x236b, 0x236c, + 0x236d, 0x236e, 0x236f, 0x2370, 0x2371, 0x2372, 0x2373, 0x2374, + 0x2375, 0x2376, 0x2377, 0x2378, 0x2379, 0x237a, 0x237b, 0x237c, + 0x237d, 0x2226, 0x214b, 0x214c, 0x217e, 0x237e, 0x214d, 0x235c, +}; + +static const Summary16 ksc5601_uni2indx_page00[70] = { + /* 0x0000 */ + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x0000 }, + { 0, 0x0000 }, { 0, 0x0000 }, { 0, 0x2592 }, { 6, 0xf7df }, + { 20, 0x0040 }, { 21, 0xc181 }, { 26, 0x0040 }, { 27, 0x4181 }, + /* 0x0100 */ + { 31, 0x0000 }, { 31, 0x0002 }, { 32, 0x00c0 }, { 34, 0x810e }, + { 39, 0x0e07 }, { 45, 0x000c }, { 47, 0x00c0 }, { 49, 0x0000 }, + { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, + { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, + /* 0x0200 */ + { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, + { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, + { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, { 49, 0x0000 }, + { 49, 0x0080 }, { 50, 0x2f01 }, { 56, 0x0000 }, { 56, 0x0000 }, + /* 0x0300 */ + { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, + { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, { 56, 0x0000 }, + { 56, 0x0000 }, { 56, 0xfffe }, { 71, 0x03fb }, { 80, 0xfffe }, + { 95, 0x03fb }, { 104, 0x0000 }, { 104, 0x0000 }, { 104, 0x0000 }, + /* 0x0400 */ + { 104, 0x0002 }, { 105, 0xffff }, { 121, 0xffff }, { 137, 0xffff }, + { 153, 0xffff }, { 169, 0x0002 }, +}; +static const Summary16 ksc5601_uni2indx_page20[103] = { + /* 0x2000 */ + { 170, 0x0000 }, { 170, 0x3320 }, { 175, 0x0063 }, { 179, 0x080d }, + { 183, 0x0000 }, { 183, 0x0000 }, { 183, 0x0000 }, { 183, 0x8010 }, + { 185, 0x001e }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, + { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, { 189, 0x0000 }, + /* 0x2100 */ + { 189, 0x0208 }, { 191, 0x0048 }, { 193, 0x0846 }, { 197, 0x0000 }, + { 197, 0x0000 }, { 197, 0x7818 }, { 203, 0x03ff }, { 213, 0x03ff }, + { 223, 0x0000 }, { 223, 0x03ff }, { 233, 0x0000 }, { 233, 0x0000 }, + { 233, 0x0000 }, { 233, 0x0014 }, { 235, 0x0000 }, { 235, 0x0000 }, + /* 0x2200 */ + { 235, 0x898d }, { 242, 0x6402 }, { 246, 0x5fa1 }, { 255, 0x3030 }, + { 259, 0x0000 }, { 259, 0x0004 }, { 260, 0x0c33 }, { 266, 0x0000 }, + { 266, 0x00cc }, { 270, 0x0200 }, { 271, 0x0020 }, { 272, 0x0000 }, + { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, { 272, 0x0000 }, + /* 0x2300 */ + { 272, 0x0000 }, { 272, 0x0004 }, { 273, 0x0000 }, { 273, 0x0000 }, + { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, + { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, + { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, + /* 0x2400 */ + { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x0000 }, + { 273, 0x0000 }, { 273, 0x0000 }, { 273, 0x7fff }, { 288, 0xfff0 }, + { 300, 0x0007 }, { 303, 0xf000 }, { 307, 0xffff }, { 323, 0x003f }, + { 329, 0x0000 }, { 329, 0xffff }, { 345, 0x03ff }, { 355, 0x0000 }, + /* 0x2500 */ + { 355, 0xf00f }, { 363, 0xffff }, { 379, 0xffff }, { 395, 0xffff }, + { 411, 0x0fff }, { 423, 0x0000 }, { 423, 0x0000 }, { 423, 0x0000 }, + { 423, 0x0000 }, { 423, 0x0004 }, { 424, 0x03fb }, { 433, 0x30cc }, + { 439, 0xc9c3 }, { 447, 0x0003 }, { 449, 0x0000 }, { 449, 0x0000 }, + /* 0x2600 */ + { 449, 0xc060 }, { 453, 0x5000 }, { 455, 0x0000 }, { 455, 0x0000 }, + { 455, 0x0005 }, { 457, 0x0000 }, { 457, 0x37bb }, +}; +static const Summary16 ksc5601_uni2indx_page30[62] = { + /* 0x3000 */ + { 468, 0xff0f }, { 480, 0x003b }, { 485, 0x0000 }, { 485, 0x0000 }, + { 485, 0xfffe }, { 500, 0xffff }, { 516, 0xffff }, { 532, 0xffff }, + { 548, 0xffff }, { 564, 0x000f }, { 568, 0xfffe }, { 583, 0xffff }, + { 599, 0xffff }, { 615, 0xffff }, { 631, 0xffff }, { 647, 0x007f }, + /* 0x3100 */ + { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0x0000 }, { 654, 0xfffe }, + { 669, 0xffff }, { 685, 0xffff }, { 701, 0xffff }, { 717, 0xffff }, + { 733, 0x7fff }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, + { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, { 748, 0x0000 }, + /* 0x3200 */ + { 748, 0xffff }, { 764, 0x1fff }, { 777, 0x0000 }, { 777, 0x0000 }, + { 777, 0x0000 }, { 777, 0x0000 }, { 777, 0xffff }, { 793, 0x8fff }, + { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, + { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, + /* 0x3300 */ + { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, + { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, { 806, 0x0000 }, + { 806, 0xff1f }, { 819, 0xffff }, { 835, 0xffff }, { 851, 0xffff }, + { 867, 0x87ff }, { 879, 0x3949 }, +}; +static const Summary16 ksc5601_uni2indx_page4e[1306] = { + /* 0x4e00 */ + { 886, 0x2f8b }, { 895, 0x4372 }, { 902, 0x2000 }, { 903, 0x0b04 }, + { 907, 0xe82c }, { 914, 0xe340 }, { 920, 0x2800 }, { 922, 0x40c8 }, + { 926, 0x5944 }, { 932, 0x4937 }, { 940, 0x7976 }, { 950, 0x0440 }, + { 952, 0x2c93 }, { 959, 0xa3f0 }, { 967, 0x0038 }, { 970, 0x08c5 }, + /* 0x4f00 */ + { 975, 0xee02 }, { 982, 0x0003 }, { 984, 0x8000 }, { 985, 0x3550 }, + { 991, 0xe1c8 }, { 998, 0x1e23 }, { 1005, 0x8200 }, { 1007, 0xc449 }, + { 1013, 0xad5a }, { 1022, 0x2942 }, { 1027, 0xc000 }, { 1029, 0x8060 }, + { 1032, 0x461c }, { 1038, 0xa49a }, { 1045, 0xc003 }, { 1049, 0x052a }, + /* 0x5000 */ + { 1054, 0x2a44 }, { 1059, 0xd646 }, { 1067, 0x3dda }, { 1077, 0x0800 }, + { 1078, 0x8388 }, { 1083, 0x1420 }, { 1086, 0x0020 }, { 1087, 0x0170 }, + { 1091, 0x2021 }, { 1094, 0x0302 }, { 1097, 0x3000 }, { 1099, 0x40ac }, + { 1104, 0x8620 }, { 1108, 0x4462 }, { 1113, 0x20a0 }, { 1116, 0x8a00 }, + /* 0x5100 */ + { 1119, 0x0253 }, { 1124, 0x8004 }, { 1126, 0x0402 }, { 1128, 0x1484 }, + { 1132, 0x7bfb }, { 1145, 0x1004 }, { 1147, 0x7fa4 }, { 1157, 0x11e2 }, + { 1163, 0x2441 }, { 1167, 0x00a4 }, { 1170, 0x1421 }, { 1174, 0x20c0 }, + { 1177, 0x3a50 }, { 1183, 0x7000 }, { 1186, 0x0002 }, { 1187, 0x2743 }, + /* 0x5200 */ + { 1194, 0x45c9 }, { 1201, 0x2082 }, { 1204, 0x4630 }, { 1209, 0x0fc1 }, + { 1216, 0x3c88 }, { 1222, 0x2850 }, { 1226, 0x8602 }, { 1230, 0xa024 }, + { 1234, 0x2388 }, { 1239, 0x8806 }, { 1243, 0x0e19 }, { 1249, 0x4000 }, + { 1250, 0x22aa }, { 1256, 0xeb64 }, { 1265, 0x001c }, { 1268, 0xcd28 }, + /* 0x5300 */ + { 1275, 0xa120 }, { 1279, 0x02e1 }, { 1284, 0x840b }, { 1289, 0x8200 }, + { 1291, 0x279b }, { 1300, 0x549e }, { 1308, 0x8141 }, { 1312, 0xa0b3 }, + { 1319, 0x0010 }, { 1320, 0x8508 }, { 1324, 0x2061 }, { 1328, 0x0800 }, + { 1329, 0x2f08 }, { 1335, 0x08d0 }, { 1339, 0xbe3e }, { 1350, 0x010f }, + /* 0x5400 */ + { 1355, 0xf718 }, { 1364, 0xa803 }, { 1369, 0x0a41 }, { 1373, 0x5b08 }, + { 1379, 0x0504 }, { 1382, 0x0002 }, { 1383, 0x0500 }, { 1385, 0x382a }, + { 1391, 0x5041 }, { 1395, 0x0001 }, { 1396, 0x1910 }, { 1400, 0x2108 }, + { 1403, 0x0313 }, { 1408, 0x0000 }, { 1408, 0x6122 }, { 1413, 0x0404 }, + /* 0x5500 */ + { 1415, 0x40d0 }, { 1419, 0x1001 }, { 1421, 0x8000 }, { 1422, 0x4022 }, + { 1425, 0x8050 }, { 1428, 0x4048 }, { 1431, 0x0008 }, { 1432, 0x1000 }, + { 1433, 0x06d1 }, { 1439, 0x3700 }, { 1444, 0x5e80 }, { 1450, 0x0000 }, + { 1450, 0x00a0 }, { 1452, 0x9410 }, { 1456, 0x0018 }, { 1458, 0x6000 }, + /* 0x5600 */ + { 1460, 0x0240 }, { 1462, 0x0090 }, { 1464, 0x8000 }, { 1465, 0x0054 }, + { 1468, 0x0000 }, { 1468, 0x0008 }, { 1469, 0x0900 }, { 1471, 0x0010 }, + { 1472, 0x0040 }, { 1473, 0x0000 }, { 1473, 0x5020 }, { 1476, 0x1010 }, + { 1478, 0x2400 }, { 1480, 0x4c02 }, { 1484, 0x0001 }, { 1485, 0x0601 }, + /* 0x5700 */ + { 1488, 0x2918 }, { 1493, 0x814c }, { 1498, 0x2100 }, { 1500, 0x0801 }, + { 1502, 0x6485 }, { 1508, 0x0003 }, { 1510, 0x4452 }, { 1515, 0x1021 }, + { 1518, 0x0904 }, { 1521, 0x0008 }, { 1522, 0x000d }, { 1525, 0x0000 }, + { 1525, 0x4988 }, { 1530, 0x8000 }, { 1531, 0x0001 }, { 1532, 0x1691 }, + /* 0x5800 */ + { 1538, 0x0765 }, { 1545, 0x4000 }, { 1546, 0x8492 }, { 1551, 0x0433 }, + { 1556, 0x8c00 }, { 1559, 0x4592 }, { 1565, 0x0016 }, { 1568, 0x5220 }, + { 1572, 0x0228 }, { 1575, 0xd008 }, { 1579, 0x4300 }, { 1582, 0x4c08 }, + { 1586, 0x40a2 }, { 1590, 0xc32a }, { 1597, 0x9810 }, { 1601, 0x2e00 }, + /* 0x5900 */ + { 1605, 0x8000 }, { 1606, 0x1670 }, { 1612, 0x6e84 }, { 1619, 0x4082 }, + { 1622, 0xc390 }, { 1628, 0x04b3 }, { 1634, 0x7c85 }, { 1642, 0x2118 }, + { 1646, 0x041c }, { 1650, 0x02c8 }, { 1654, 0x1120 }, { 1657, 0x4a00 }, + { 1660, 0x0a48 }, { 1664, 0x361b }, { 1672, 0x5540 }, { 1677, 0x8900 }, + /* 0x5a00 */ + { 1680, 0x000a }, { 1682, 0x9902 }, { 1687, 0x0221 }, { 1690, 0x1040 }, + { 1692, 0x0242 }, { 1695, 0x0400 }, { 1696, 0x0044 }, { 1698, 0x0000 }, + { 1698, 0x0000 }, { 1698, 0x0c04 }, { 1701, 0x0010 }, { 1702, 0x0000 }, + { 1702, 0x1216 }, { 1707, 0x0000 }, { 1707, 0x0242 }, { 1710, 0x0000 }, + /* 0x5b00 */ + { 1710, 0x1a20 }, { 1714, 0x0040 }, { 1715, 0x0400 }, { 1716, 0x0000 }, + { 1716, 0x0009 }, { 1718, 0xb5b3 }, { 1728, 0x0a18 }, { 1732, 0x1523 }, + { 1738, 0x9ba0 }, { 1745, 0x1fe8 }, { 1754, 0x507c }, { 1761, 0x8379 }, + { 1769, 0x10fd }, { 1777, 0xc09d }, { 1784, 0xdbf6 }, { 1796, 0x0560 }, + /* 0x5c00 */ + { 1800, 0xef92 }, { 1810, 0x0242 }, { 1813, 0x0110 }, { 1815, 0xdf02 }, + { 1823, 0x6961 }, { 1830, 0x0822 }, { 1833, 0x9035 }, { 1839, 0x0202 }, + { 1841, 0x0000 }, { 1841, 0x0003 }, { 1843, 0x1a02 }, { 1847, 0x45aa }, + { 1854, 0x0001 }, { 1855, 0x0200 }, { 1856, 0x8101 }, { 1859, 0x2851 }, + /* 0x5d00 */ + { 1864, 0x6080 }, { 1867, 0x02d2 }, { 1872, 0x0280 }, { 1874, 0x0000 }, + { 1874, 0x1800 }, { 1876, 0x0001 }, { 1877, 0x9200 }, { 1880, 0x0000 }, + { 1880, 0x0880 }, { 1882, 0x2000 }, { 1883, 0x0405 }, { 1886, 0x3500 }, + { 1890, 0x2000 }, { 1891, 0x6044 }, { 1895, 0x49e6 }, { 1903, 0x609e }, + /* 0x5e00 */ + { 1910, 0x104c }, { 1914, 0x2a42 }, { 1919, 0x2820 }, { 1922, 0xa148 }, + { 1927, 0x10b1 }, { 1932, 0x8020 }, { 1934, 0x000e }, { 1937, 0x7b9c }, + { 1947, 0x8490 }, { 1951, 0x14a0 }, { 1955, 0x28c1 }, { 1960, 0x41e0 }, + { 1965, 0x0704 }, { 1969, 0x8c49 }, { 1975, 0x100d }, { 1979, 0x0cc8 }, + /* 0x5f00 */ + { 1984, 0x8412 }, { 1988, 0x89ba }, { 1996, 0x02c0 }, { 1999, 0x1422 }, + { 2003, 0x5500 }, { 2007, 0x0ac0 }, { 2011, 0x3ec4 }, { 2019, 0x9283 }, + { 2025, 0x1ca3 }, { 2032, 0x4387 }, { 2039, 0x4703 }, { 2045, 0x22a0 }, + { 2049, 0x3028 }, { 2053, 0x03c0 }, { 2057, 0x0801 }, { 2059, 0xa020 }, + /* 0x6000 */ + { 2062, 0x8000 }, { 2063, 0x3044 }, { 2067, 0x85a3 }, { 2074, 0x0000 }, + { 2074, 0x200e }, { 2078, 0x2225 }, { 2083, 0xb73c }, { 2093, 0x0001 }, + { 2094, 0x3220 }, { 2098, 0x8c50 }, { 2103, 0x0099 }, { 2107, 0x315d }, + { 2115, 0x00a0 }, { 2117, 0x9402 }, { 2121, 0x0003 }, { 2123, 0x0e4b }, + /* 0x6100 */ + { 2130, 0xe342 }, { 2137, 0x8c20 }, { 2141, 0x0080 }, { 2142, 0xd091 }, + { 2148, 0x1d94 }, { 2155, 0xa328 }, { 2161, 0x499c }, { 2168, 0x60c1 }, + { 2173, 0x4406 }, { 2177, 0x0713 }, { 2183, 0x5a90 }, { 2189, 0x4444 }, + { 2193, 0x0f88 }, { 2199, 0x0000 }, { 2199, 0x0040 }, { 2200, 0x95c4 }, + /* 0x6200 */ + { 2207, 0x7581 }, { 2214, 0x8447 }, { 2220, 0x4402 }, { 2223, 0xc053 }, + { 2229, 0x2b83 }, { 2236, 0x0108 }, { 2238, 0x4000 }, { 2239, 0x9242 }, + { 2244, 0x0611 }, { 2248, 0x09a6 }, { 2254, 0x0800 }, { 2255, 0x3222 }, + { 2260, 0xb384 }, { 2267, 0x1bdd }, { 2277, 0xf000 }, { 2281, 0xc08a }, + /* 0x6300 */ + { 2286, 0x0282 }, { 2289, 0x0002 }, { 2290, 0x8800 }, { 2292, 0x6c00 }, + { 2296, 0x9200 }, { 2299, 0x0021 }, { 2301, 0x4180 }, { 2304, 0x8c84 }, + { 2309, 0x1308 }, { 2313, 0x0944 }, { 2317, 0x07a7 }, { 2325, 0x0000 }, + { 2325, 0x8051 }, { 2329, 0x0c41 }, { 2333, 0x6002 }, { 2336, 0x00d0 }, + /* 0x6400 */ + { 2339, 0xa000 }, { 2341, 0x10d0 }, { 2345, 0x3004 }, { 2348, 0x4400 }, + { 2350, 0x0000 }, { 2350, 0x0100 }, { 2351, 0x8201 }, { 2354, 0x0700 }, + { 2357, 0x0100 }, { 2358, 0x440e }, { 2363, 0x6830 }, { 2368, 0x0805 }, + { 2371, 0x64b2 }, { 2378, 0x0514 }, { 2382, 0x10e6 }, { 2388, 0x4414 }, + /* 0x6500 */ + { 2392, 0x0011 }, { 2394, 0x2100 }, { 2396, 0x9c08 }, { 2401, 0xcbc0 }, + { 2408, 0xe120 }, { 2413, 0x40c2 }, { 2417, 0x304c }, { 2422, 0x41b4 }, + { 2428, 0x10ac }, { 2433, 0x9a83 }, { 2440, 0x98b2 }, { 2447, 0x3281 }, + { 2452, 0x9822 }, { 2457, 0x0084 }, { 2459, 0x3369 }, { 2467, 0xbc12 }, + /* 0x6600 */ + { 2474, 0xd6c0 }, { 2481, 0xc03b }, { 2488, 0xa1a1 }, { 2494, 0x0c53 }, + { 2500, 0x8a1e }, { 2507, 0xea00 }, { 2512, 0xcbf0 }, { 2521, 0x05d8 }, + { 2527, 0x4390 }, { 2532, 0x21c3 }, { 2538, 0x4805 }, { 2542, 0x4a1c }, + { 2548, 0x02d0 }, { 2552, 0x3240 }, { 2556, 0x0041 }, { 2558, 0xd79d }, + /* 0x6700 */ + { 2569, 0x2b09 }, { 2575, 0xe8b0 }, { 2582, 0x7dc0 }, { 2590, 0x2452 }, + { 2595, 0xc240 }, { 2599, 0xd04b }, { 2606, 0xa000 }, { 2608, 0xc8ab }, + { 2616, 0x8a80 }, { 2620, 0x34a9 }, { 2627, 0x8000 }, { 2628, 0x41c9 }, + { 2634, 0x8010 }, { 2636, 0x241f }, { 2643, 0x9200 }, { 2646, 0x487b }, + /* 0x6800 */ + { 2654, 0x0000 }, { 2654, 0x00cc }, { 2658, 0x8406 }, { 2662, 0x3300 }, + { 2666, 0x410f }, { 2672, 0x001b }, { 2676, 0x2000 }, { 2677, 0x8040 }, + { 2679, 0x8022 }, { 2682, 0xa098 }, { 2687, 0xa186 }, { 2693, 0x006b }, + { 2698, 0x2a30 }, { 2703, 0x85a4 }, { 2709, 0x4181 }, { 2713, 0x0604 }, + /* 0x6900 */ + { 2716, 0x6021 }, { 2720, 0x0004 }, { 2721, 0x0080 }, { 2722, 0xa001 }, + { 2725, 0x0400 }, { 2726, 0x46b8 }, { 2733, 0xe90f }, { 2742, 0x03a0 }, + { 2746, 0x0000 }, { 2746, 0x1820 }, { 2749, 0x40a0 }, { 2752, 0x0810 }, + { 2754, 0x380a }, { 2759, 0x0001 }, { 2760, 0x0500 }, { 2762, 0xa800 }, + /* 0x6a00 */ + { 2765, 0x0404 }, { 2767, 0xc28a }, { 2773, 0x000a }, { 2775, 0x2720 }, + { 2780, 0x0910 }, { 2783, 0x830c }, { 2788, 0x0802 }, { 2790, 0x0000 }, + { 2790, 0x6211 }, { 2795, 0x1080 }, { 2797, 0x000c }, { 2799, 0x0808 }, + { 2801, 0x000c }, { 2803, 0x0c08 }, { 2806, 0x0000 }, { 2806, 0x0840 }, + /* 0x6b00 */ + { 2808, 0x1410 }, { 2811, 0x0044 }, { 2813, 0x000b }, { 2816, 0x6404 }, + { 2820, 0x50c0 }, { 2824, 0x8001 }, { 2826, 0x047e }, { 2833, 0x8984 }, + { 2838, 0x0658 }, { 2843, 0x4140 }, { 2846, 0xc000 }, { 2848, 0x94a4 }, + { 2854, 0xa862 }, { 2860, 0x09dc }, { 2867, 0x1800 }, { 2869, 0x0000 }, + /* 0x6c00 */ + { 2869, 0x8100 }, { 2871, 0x000a }, { 2873, 0x0008 }, { 2874, 0x4190 }, + { 2878, 0x4007 }, { 2882, 0xe4a1 }, { 2889, 0x2501 }, { 2893, 0x6445 }, + { 2899, 0x11ee }, { 2907, 0x0e7d }, { 2916, 0x4800 }, { 2918, 0xfb08 }, + { 2926, 0x1616 }, { 2932, 0x08a8 }, { 2936, 0xc92e }, { 2944, 0x0009 }, + /* 0x6d00 */ + { 2946, 0x1800 }, { 2948, 0x4a82 }, { 2953, 0x06a0 }, { 2957, 0x6b64 }, + { 2965, 0x0002 }, { 2966, 0x1600 }, { 2969, 0x5648 }, { 2975, 0x8390 }, + { 2980, 0x73a0 }, { 2987, 0x002a }, { 2990, 0x8000 }, { 2991, 0x0024 }, + { 2993, 0x88f9 }, { 3001, 0x4702 }, { 3006, 0x4d02 }, { 3011, 0x0faa }, + /* 0x6e00 */ + { 3019, 0x0000 }, { 3019, 0x8e80 }, { 3024, 0xb87b }, { 3034, 0x7554 }, + { 3042, 0x2418 }, { 3046, 0xd940 }, { 3052, 0xc880 }, { 3056, 0x040c }, + { 3059, 0x0000 }, { 3059, 0xb041 }, { 3064, 0x8c24 }, { 3069, 0x0442 }, + { 3072, 0x5a34 }, { 3079, 0x001a }, { 3082, 0x8000 }, { 3083, 0xc110 }, + /* 0x6f00 */ + { 3087, 0x8046 }, { 3091, 0x0032 }, { 3094, 0x180d }, { 3099, 0x8106 }, + { 3103, 0x0002 }, { 3104, 0xcd92 }, { 3112, 0x6014 }, { 3116, 0x7401 }, + { 3121, 0x6112 }, { 3126, 0x0091 }, { 3129, 0xc098 }, { 3134, 0x420a }, + { 3138, 0x040f }, { 3143, 0x8420 }, { 3146, 0x9a13 }, { 3153, 0x4002 }, + /* 0x7000 */ + { 3155, 0x8a62 }, { 3161, 0xfd22 }, { 3170, 0x8188 }, { 3174, 0x4080 }, + { 3176, 0x1000 }, { 3177, 0x2103 }, { 3181, 0x0808 }, { 3183, 0x3101 }, + { 3187, 0x4420 }, { 3190, 0x0704 }, { 3194, 0xb812 }, { 3200, 0x0388 }, + { 3204, 0x8900 }, { 3207, 0xa300 }, { 3211, 0x0000 }, { 3211, 0x2202 }, + /* 0x7100 */ + { 3214, 0x1210 }, { 3217, 0x4600 }, { 3220, 0x0042 }, { 3222, 0x0041 }, + { 3224, 0x5680 }, { 3229, 0x5241 }, { 3234, 0x52f0 }, { 3241, 0x2000 }, + { 3242, 0x8610 }, { 3246, 0x8214 }, { 3250, 0x1004 }, { 3252, 0x4602 }, + { 3256, 0x430a }, { 3261, 0x8035 }, { 3266, 0x60e0 }, { 3271, 0xd800 }, + /* 0x7200 */ + { 3275, 0x0041 }, { 3277, 0x0801 }, { 3279, 0x3400 }, { 3282, 0x6c65 }, + { 3290, 0x11c1 }, { 3295, 0xab04 }, { 3301, 0x0286 }, { 3305, 0x2204 }, + { 3308, 0x0003 }, { 3310, 0x0000 }, { 3310, 0x9084 }, { 3314, 0x0000 }, + { 3314, 0x4015 }, { 3318, 0x0281 }, { 3321, 0x0202 }, { 3323, 0x3300 }, + /* 0x7300 */ + { 3327, 0x0400 }, { 3328, 0x3840 }, { 3332, 0x0e20 }, { 3336, 0xc0c0 }, + { 3340, 0x0030 }, { 3342, 0x0085 }, { 3345, 0x0500 }, { 3347, 0x0d25 }, + { 3353, 0x4ad0 }, { 3359, 0x81d0 }, { 3364, 0x2280 }, { 3367, 0x020c }, + { 3370, 0xb605 }, { 3377, 0x6240 }, { 3381, 0x2679 }, { 3389, 0x6280 }, + /* 0x7400 */ + { 3393, 0x02ea }, { 3399, 0x0808 }, { 3401, 0xdd67 }, { 3412, 0x8579 }, + { 3420, 0x081b }, { 3425, 0xdea0 }, { 3433, 0x8735 }, { 3441, 0x4000 }, + { 3442, 0x0a8c }, { 3447, 0xd100 }, { 3451, 0x05aa }, { 3457, 0xa225 }, + { 3463, 0x8440 }, { 3466, 0x1510 }, { 3470, 0x404d }, { 3475, 0x0080 }, + /* 0x7500 */ + { 3476, 0x0012 }, { 3478, 0x8d22 }, { 3484, 0x1968 }, { 3490, 0x058f }, + { 3497, 0x9080 }, { 3500, 0x3a1a }, { 3507, 0x8464 }, { 3512, 0x8561 }, + { 3518, 0xccc0 }, { 3524, 0x2002 }, { 3526, 0x0820 }, { 3528, 0x732e }, + { 3537, 0x20a4 }, { 3541, 0x0b34 }, { 3547, 0x0004 }, { 3548, 0x1415 }, + /* 0x7600 */ + { 3553, 0x2001 }, { 3555, 0x8200 }, { 3557, 0x0057 }, { 3562, 0x0800 }, + { 3563, 0x5004 }, { 3566, 0x0044 }, { 3568, 0x1212 }, { 3572, 0x7905 }, + { 3579, 0x40d0 }, { 3583, 0x0009 }, { 3585, 0x4000 }, { 3586, 0x8400 }, + { 3588, 0x054c }, { 3593, 0xd844 }, { 3599, 0x409a }, { 3604, 0x5114 }, + /* 0x7700 */ + { 3609, 0x0b12 }, { 3614, 0x4000 }, { 3615, 0x0201 }, { 3617, 0x1580 }, + { 3621, 0x2001 }, { 3623, 0x0800 }, { 3624, 0x084a }, { 3628, 0xc200 }, + { 3631, 0x0800 }, { 3632, 0x4002 }, { 3634, 0x3020 }, { 3637, 0x9809 }, + { 3642, 0x0000 }, { 3642, 0x1880 }, { 3645, 0xe22c }, { 3652, 0x0008 }, + /* 0x7800 */ + { 3653, 0x0004 }, { 3654, 0x0004 }, { 3655, 0x10e0 }, { 3659, 0x0014 }, + { 3661, 0x8020 }, { 3663, 0x2000 }, { 3664, 0x9800 }, { 3667, 0x1000 }, + { 3668, 0x7082 }, { 3673, 0x0082 }, { 3675, 0x0288 }, { 3678, 0x1c00 }, + { 3681, 0x4c22 }, { 3686, 0x0001 }, { 3687, 0x9100 }, { 3690, 0x0820 }, + /* 0x7900 */ + { 3692, 0x4002 }, { 3694, 0x0040 }, { 3695, 0x1c00 }, { 3698, 0x4400 }, + { 3700, 0x0383 }, { 3705, 0x7cc1 }, { 3713, 0x2121 }, { 3717, 0x8400 }, + { 3719, 0xe002 }, { 3723, 0x0002 }, { 3724, 0x44c0 }, { 3728, 0xe20a }, + { 3734, 0x0e03 }, { 3739, 0x8126 }, { 3744, 0x02d0 }, { 3748, 0x0800 }, + /* 0x7a00 */ + { 3749, 0x2921 }, { 3754, 0x9690 }, { 3760, 0x4001 }, { 3762, 0xb8c2 }, + { 3769, 0x6241 }, { 3774, 0x0080 }, { 3775, 0x0a06 }, { 3779, 0xa651 }, + { 3786, 0x0112 }, { 3789, 0x812c }, { 3794, 0xc600 }, { 3798, 0x0400 }, + { 3799, 0x0cb0 }, { 3804, 0xa280 }, { 3808, 0xa429 }, { 3814, 0x8640 }, + /* 0x7b00 */ + { 3818, 0x8000 }, { 3819, 0x4a02 }, { 3823, 0x3041 }, { 3827, 0x0200 }, + { 3828, 0xba40 }, { 3834, 0x0057 }, { 3839, 0x5001 }, { 3842, 0x2020 }, + { 3844, 0x8880 }, { 3847, 0x24b0 }, { 3852, 0x2002 }, { 3854, 0x0112 }, + { 3857, 0x02d3 }, { 3863, 0x0004 }, { 3864, 0x0211 }, { 3867, 0x0000 }, + /* 0x7c00 */ + { 3867, 0x0080 }, { 3868, 0x4004 }, { 3870, 0x0c82 }, { 3874, 0xe000 }, + { 3877, 0x3008 }, { 3880, 0x0000 }, { 3880, 0x1011 }, { 3883, 0x0008 }, + { 3884, 0x0208 }, { 3886, 0x81a4 }, { 3891, 0x40a0 }, { 3894, 0x420e }, + { 3899, 0x0400 }, { 3900, 0xc040 }, { 3903, 0x0081 }, { 3905, 0x4800 }, + /* 0x7d00 */ + { 3907, 0x2df5 }, { 3917, 0x0f91 }, { 3924, 0xd807 }, { 3931, 0x0629 }, + { 3936, 0x007c }, { 3941, 0x4001 }, { 3943, 0x4546 }, { 3949, 0x824e }, + { 3955, 0xc000 }, { 3957, 0x1008 }, { 3959, 0x3005 }, { 3963, 0xed36 }, + { 3973, 0x0c80 }, { 3976, 0x6540 }, { 3981, 0x930b }, { 3988, 0x0810 }, + /* 0x7e00 */ + { 3990, 0x0600 }, { 3992, 0xe820 }, { 3997, 0xc80a }, { 4002, 0x6082 }, + { 4006, 0x00ca }, { 4010, 0x4034 }, { 4014, 0x2e02 }, { 4019, 0x1201 }, + { 4022, 0x9004 }, { 4025, 0x1948 }, { 4030, 0x0000 }, { 4030, 0x0000 }, + { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, + /* 0x7f00 */ + { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0000 }, { 4030, 0x0540 }, + { 4033, 0x1000 }, { 4034, 0x0031 }, { 4037, 0x4c00 }, { 4040, 0x02a5 }, + { 4045, 0x5520 }, { 4050, 0x4410 }, { 4053, 0x0310 }, { 4056, 0x2304 }, + { 4060, 0x5422 }, { 4065, 0x8034 }, { 4069, 0x0a03 }, { 4073, 0x1201 }, + /* 0x8000 */ + { 4076, 0x126b }, { 4083, 0x01a1 }, { 4087, 0x2000 }, { 4088, 0xa048 }, + { 4092, 0x0448 }, { 4095, 0x4540 }, { 4099, 0x8000 }, { 4100, 0xe08d }, + { 4107, 0x1af0 }, { 4114, 0x2840 }, { 4117, 0x8626 }, { 4123, 0x0416 }, + { 4127, 0x5018 }, { 4131, 0x4c00 }, { 4134, 0x0032 }, { 4137, 0x2112 }, + /* 0x8100 */ + { 4141, 0x05e4 }, { 4147, 0x0d00 }, { 4150, 0x8a08 }, { 4154, 0x4200 }, + { 4156, 0x4800 }, { 4158, 0x0033 }, { 4162, 0x0860 }, { 4165, 0x8703 }, + { 4171, 0x8501 }, { 4175, 0x3400 }, { 4178, 0x0109 }, { 4181, 0xe428 }, + { 4187, 0x2045 }, { 4191, 0x8100 }, { 4193, 0x25a8 }, { 4199, 0x5c18 }, + /* 0x8200 */ + { 4205, 0x35a0 }, { 4211, 0xd804 }, { 4216, 0x1c02 }, { 4220, 0x02e0 }, + { 4224, 0x00a1 }, { 4227, 0x0200 }, { 4228, 0xc050 }, { 4232, 0x4146 }, + { 4237, 0x6800 }, { 4240, 0xa604 }, { 4245, 0xf260 }, { 4252, 0xbb8a }, + { 4261, 0x0000 }, { 4261, 0xc8b6 }, { 4269, 0x00e2 }, { 4273, 0x6002 }, + /* 0x8300 */ + { 4276, 0x023e }, { 4282, 0x0080 }, { 4283, 0x8900 }, { 4286, 0x0372 }, + { 4292, 0x8681 }, { 4297, 0x0006 }, { 4299, 0x0000 }, { 4299, 0x0888 }, + { 4302, 0x4600 }, { 4305, 0x4140 }, { 4308, 0x0e04 }, { 4312, 0x2000 }, + { 4313, 0x1622 }, { 4318, 0x1048 }, { 4321, 0x8a00 }, { 4324, 0x2217 }, + /* 0x8400 */ + { 4330, 0x7418 }, { 4336, 0x0000 }, { 4336, 0x1200 }, { 4338, 0x2102 }, + { 4341, 0x0200 }, { 4342, 0x0880 }, { 4344, 0x984a }, { 4350, 0x0420 }, + { 4352, 0x0000 }, { 4352, 0x1211 }, { 4356, 0x0002 }, { 4357, 0x9904 }, + { 4362, 0x2a55 }, { 4369, 0x0402 }, { 4371, 0x5000 }, { 4373, 0x1010 }, + /* 0x8500 */ + { 4375, 0x0000 }, { 4375, 0x459a }, { 4382, 0xb02a }, { 4388, 0xa000 }, + { 4390, 0x420a }, { 4394, 0x0208 }, { 4396, 0x2708 }, { 4401, 0x0000 }, + { 4401, 0x8090 }, { 4404, 0x0812 }, { 4407, 0x8740 }, { 4412, 0x0401 }, + { 4414, 0xe202 }, { 4419, 0x3020 }, { 4422, 0x0630 }, { 4426, 0x8c80 }, + /* 0x8600 */ + { 4430, 0x04c4 }, { 4434, 0x04c0 }, { 4437, 0x2000 }, { 4438, 0x8000 }, + { 4439, 0x4000 }, { 4440, 0xd831 }, { 4447, 0x0080 }, { 4448, 0x0200 }, + { 4449, 0x1400 }, { 4451, 0x0008 }, { 4452, 0x0218 }, { 4455, 0x0000 }, + { 4455, 0x0880 }, { 4457, 0x8a10 }, { 4461, 0x2010 }, { 4463, 0x4000 }, + /* 0x8700 */ + { 4464, 0x010d }, { 4468, 0x1500 }, { 4471, 0x0000 }, { 4471, 0x0000 }, + { 4471, 0x4000 }, { 4472, 0x80a0 }, { 4475, 0x0140 }, { 4477, 0x0150 }, + { 4480, 0x2004 }, { 4482, 0x8000 }, { 4483, 0x0004 }, { 4484, 0x0408 }, + { 4486, 0x0010 }, { 4487, 0x0000 }, { 4487, 0x9001 }, { 4490, 0x4a04 }, + /* 0x8800 */ + { 4494, 0x0020 }, { 4495, 0x8000 }, { 4496, 0x000c }, { 4498, 0x0842 }, + { 4501, 0x3041 }, { 4505, 0x2a8c }, { 4511, 0x090e }, { 4516, 0xc085 }, + { 4521, 0x2906 }, { 4526, 0x40c4 }, { 4530, 0x0800 }, { 4531, 0x0010 }, + { 4532, 0x8006 }, { 4535, 0xb230 }, { 4541, 0x0102 }, { 4543, 0x2138 }, + /* 0x8900 */ + { 4548, 0x0080 }, { 4549, 0x030d }, { 4554, 0x0420 }, { 4556, 0x0940 }, + { 4559, 0x0012 }, { 4561, 0x8000 }, { 4562, 0x0410 }, { 4564, 0x8004 }, + { 4566, 0x88ca }, { 4572, 0x0048 }, { 4574, 0x0602 }, { 4577, 0x2404 }, + { 4580, 0x0001 }, { 4581, 0x0004 }, { 4582, 0x0008 }, { 4583, 0x0110 }, + /* 0x8a00 */ + { 4585, 0x550d }, { 4592, 0xa9c8 }, { 4599, 0x2428 }, { 4603, 0x0c52 }, + { 4608, 0x0000 }, { 4608, 0x4831 }, { 4613, 0x624d }, { 4620, 0x022f }, + { 4626, 0x30a0 }, { 4630, 0x4128 }, { 4634, 0x057b }, { 4642, 0xd205 }, + { 4648, 0xa894 }, { 4654, 0x1844 }, { 4658, 0x6cc2 }, { 4665, 0x45c2 }, + /* 0x8b00 */ + { 4671, 0x4017 }, { 4676, 0x2ed1 }, { 4684, 0x1901 }, { 4688, 0x0208 }, + { 4690, 0xc202 }, { 4694, 0x1500 }, { 4697, 0x9040 }, { 4700, 0x2091 }, + { 4704, 0x0401 }, { 4706, 0x044d }, { 4711, 0x0000 }, { 4711, 0x0000 }, + { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, + /* 0x8c00 */ + { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x0000 }, { 4711, 0x8080 }, + { 4713, 0x1542 }, { 4718, 0x0420 }, { 4720, 0x0c02 }, { 4723, 0x0600 }, + { 4725, 0x1404 }, { 4728, 0x6000 }, { 4730, 0x9f87 }, { 4740, 0xb9d9 }, + { 4750, 0x059f }, { 4758, 0x540a }, { 4763, 0x245d }, { 4770, 0x3810 }, + /* 0x8d00 */ + { 4774, 0x25b0 }, { 4780, 0x0048 }, { 4782, 0x0000 }, { 4782, 0x0000 }, + { 4782, 0x0000 }, { 4782, 0x0000 }, { 4782, 0x0850 }, { 4785, 0x0099 }, + { 4789, 0x0420 }, { 4791, 0x0200 }, { 4792, 0x0108 }, { 4794, 0x4408 }, + { 4797, 0x9840 }, { 4801, 0x2800 }, { 4803, 0x810a }, { 4807, 0x0008 }, + /* 0x8e00 */ + { 4808, 0x8400 }, { 4810, 0x4001 }, { 4812, 0x0400 }, { 4813, 0x0021 }, + { 4815, 0x0794 }, { 4821, 0x8200 }, { 4823, 0x0001 }, { 4824, 0x0050 }, + { 4826, 0x2482 }, { 4830, 0x0000 }, { 4830, 0x1c00 }, { 4833, 0x0000 }, + { 4833, 0x3c01 }, { 4838, 0x8004 }, { 4840, 0x0800 }, { 4841, 0x4900 }, + /* 0x8f00 */ + { 4844, 0x0228 }, { 4847, 0xf83c }, { 4856, 0x86c0 }, { 4861, 0xcb08 }, + { 4867, 0x6230 }, { 4872, 0xa000 }, { 4874, 0x0004 }, { 4875, 0x0000 }, + { 4875, 0x0000 }, { 4875, 0x1800 }, { 4877, 0xa148 }, { 4882, 0x0007 }, + { 4885, 0x4024 }, { 4888, 0x0012 }, { 4890, 0x2c40 }, { 4894, 0x2285 }, + /* 0x9000 */ + { 4899, 0xa96f }, { 4909, 0xe6b3 }, { 4919, 0x400f }, { 4924, 0x5126 }, + { 4930, 0x6c86 }, { 4937, 0x723b }, { 4946, 0xe20b }, { 4953, 0xb5a4 }, + { 4961, 0x859f }, { 4970, 0x0222 }, { 4973, 0x854c }, { 4979, 0x0123 }, + { 4983, 0x0402 }, { 4985, 0x4000 }, { 4986, 0x2102 }, { 4989, 0x2020 }, + /* 0x9100 */ + { 4991, 0x0004 }, { 4992, 0x0224 }, { 4995, 0x2080 }, { 4997, 0x0004 }, + { 4998, 0x7e00 }, { 5004, 0x0004 }, { 5005, 0x1604 }, { 5009, 0x01a0 }, + { 5012, 0x2a80 }, { 5016, 0x1004 }, { 5018, 0xd800 }, { 5022, 0x0032 }, + { 5025, 0xfa81 }, { 5033, 0x3183 }, { 5039, 0x0488 }, { 5042, 0x0020 }, + /* 0x9200 */ + { 5043, 0x2000 }, { 5044, 0x4087 }, { 5049, 0x0000 }, { 5049, 0x8410 }, + { 5052, 0x0221 }, { 5055, 0x4880 }, { 5058, 0x0074 }, { 5062, 0x0000 }, + { 5062, 0x0029 }, { 5065, 0x114a }, { 5070, 0x0000 }, { 5070, 0x02c8 }, + { 5074, 0x9000 }, { 5076, 0x0004 }, { 5077, 0x0410 }, { 5079, 0x1100 }, + /* 0x9300 */ + { 5081, 0x0010 }, { 5082, 0xc501 }, { 5087, 0xc957 }, { 5096, 0x0000 }, + { 5096, 0x2d00 }, { 5100, 0x0810 }, { 5102, 0x4000 }, { 5103, 0x5020 }, + { 5106, 0x1000 }, { 5107, 0x0450 }, { 5110, 0x3088 }, { 5114, 0x0001 }, + { 5115, 0x0008 }, { 5116, 0x4002 }, { 5118, 0x0012 }, { 5120, 0x0040 }, + /* 0x9400 */ + { 5121, 0x0010 }, { 5122, 0x0100 }, { 5123, 0x0820 }, { 5125, 0x0120 }, + { 5127, 0x0010 }, { 5128, 0x0806 }, { 5131, 0x0000 }, { 5131, 0xa000 }, + { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, + { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, + /* 0x9500 */ + { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, + { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0000 }, { 5133, 0x0080 }, + { 5134, 0x8a09 }, { 5139, 0x011e }, { 5144, 0x2138 }, { 5149, 0x1802 }, + { 5152, 0x0480 }, { 5154, 0x1070 }, { 5158, 0x0006 }, { 5160, 0x0000 }, + /* 0x9600 */ + { 5160, 0x0000 }, { 5160, 0x1000 }, { 5161, 0x4402 }, { 5164, 0x8804 }, + { 5167, 0x3815 }, { 5173, 0xf801 }, { 5179, 0x041c }, { 5183, 0x21e9 }, + { 5190, 0x6c60 }, { 5196, 0x1b30 }, { 5202, 0x0588 }, { 5206, 0x0882 }, + { 5209, 0x7af3 }, { 5220, 0x1a60 }, { 5225, 0x870c }, { 5231, 0x0ac5 }, + /* 0x9700 */ + { 5237, 0x00c1 }, { 5240, 0x524a }, { 5246, 0x0080 }, { 5247, 0x2205 }, + { 5251, 0x0114 }, { 5254, 0x5042 }, { 5258, 0x2206 }, { 5262, 0x0490 }, + { 5265, 0xa800 }, { 5268, 0x0000 }, { 5268, 0x2901 }, { 5272, 0x0000 }, + { 5272, 0x0840 }, { 5274, 0x1008 }, { 5276, 0x0000 }, { 5276, 0x8848 }, + /* 0x9800 */ + { 5280, 0x156f }, { 5289, 0x018f }, { 5295, 0x2000 }, { 5296, 0x0b01 }, + { 5300, 0x7040 }, { 5304, 0x4510 }, { 5308, 0x88a0 }, { 5312, 0x0000 }, + { 5312, 0x0000 }, { 5312, 0x0000 }, { 5312, 0x8100 }, { 5314, 0x0002 }, + { 5315, 0x0090 }, { 5317, 0x9800 }, { 5320, 0xe006 }, { 5325, 0x7010 }, + /* 0x9900 */ + { 5329, 0x1608 }, { 5333, 0x4109 }, { 5337, 0x0101 }, { 5339, 0x0000 }, + { 5339, 0x3a20 }, { 5344, 0x0096 }, { 5348, 0x0000 }, { 5348, 0x0000 }, + { 5348, 0x0000 }, { 5348, 0x2240 }, { 5351, 0x7120 }, { 5356, 0x021a }, + { 5360, 0x0002 }, { 5361, 0xa227 }, { 5368, 0x2000 }, { 5369, 0x8002 }, + /* 0x9a00 */ + { 5371, 0xc102 }, { 5375, 0x0200 }, { 5376, 0x0800 }, { 5377, 0x00c1 }, + { 5380, 0x2029 }, { 5384, 0x8ca0 }, { 5389, 0x0624 }, { 5393, 0x0000 }, + { 5393, 0x0000 }, { 5393, 0x0000 }, { 5393, 0x0100 }, { 5394, 0x0100 }, + { 5395, 0x0000 }, { 5395, 0x0118 }, { 5398, 0x4020 }, { 5400, 0x0000 }, + /* 0x9b00 */ + { 5400, 0x0000 }, { 5400, 0x0400 }, { 5401, 0x0480 }, { 5403, 0x1002 }, + { 5405, 0x803e }, { 5411, 0x0410 }, { 5413, 0x8000 }, { 5414, 0x0000 }, + { 5414, 0x4000 }, { 5415, 0x8002 }, { 5417, 0x4800 }, { 5419, 0x0000 }, + { 5419, 0x0200 }, { 5420, 0x0040 }, { 5421, 0x0110 }, { 5423, 0x0000 }, + /* 0x9c00 */ + { 5423, 0x2000 }, { 5424, 0x0025 }, { 5427, 0x0020 }, { 5428, 0x0804 }, + { 5430, 0x0280 }, { 5432, 0x0080 }, { 5433, 0x0000 }, { 5433, 0x0000 }, + { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x0000 }, + { 5433, 0x0000 }, { 5433, 0x0000 }, { 5433, 0x02a0 }, { 5436, 0x0058 }, + /* 0x9d00 */ + { 5439, 0x0200 }, { 5440, 0x0800 }, { 5441, 0x0140 }, { 5443, 0x0800 }, + { 5444, 0x0000 }, { 5444, 0x2002 }, { 5446, 0x1003 }, { 5449, 0x0004 }, + { 5450, 0x0000 }, { 5450, 0x0000 }, { 5450, 0x8200 }, { 5452, 0x0010 }, + { 5453, 0x0010 }, { 5454, 0x0080 }, { 5455, 0x0000 }, { 5455, 0x0704 }, + /* 0x9e00 */ + { 5459, 0x0000 }, { 5459, 0x4400 }, { 5461, 0x0000 }, { 5461, 0x0000 }, + { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0x0000 }, { 5461, 0xa220 }, + { 5465, 0x0000 }, { 5465, 0xa08c }, { 5470, 0x0020 }, { 5471, 0x4830 }, + { 5475, 0x6008 }, { 5478, 0x5912 }, { 5484, 0x0100 }, { 5485, 0x0010 }, + /* 0x9f00 */ + { 5486, 0x4180 }, { 5489, 0x0008 }, { 5490, 0x0001 }, { 5491, 0x0800 }, + { 5492, 0x4c00 }, { 5495, 0x8004 }, { 5497, 0x1482 }, { 5501, 0x0080 }, + { 5502, 0x2000 }, { 5503, 0x1021 }, +}; +static const Summary16 ksc5601_uni2indx_pageac[698] = { + /* 0xac00 */ + { 5506, 0x0793 }, { 5513, 0x3eff }, { 5526, 0xb011 }, { 5531, 0x1303 }, + { 5536, 0x2801 }, { 5539, 0x1110 }, { 5542, 0x0000 }, { 5542, 0x0593 }, + { 5548, 0x1e7b }, { 5558, 0xb011 }, { 5563, 0x9703 }, { 5570, 0x3b01 }, + { 5576, 0x1112 }, { 5580, 0x00a0 }, { 5582, 0x9593 }, { 5590, 0x306b }, + /* 0xad00 */ + { 5597, 0xb051 }, { 5603, 0x1102 }, { 5606, 0x3201 }, { 5610, 0x1130 }, + { 5614, 0x02b0 }, { 5618, 0x0111 }, { 5621, 0x300a }, { 5625, 0xb879 }, + { 5634, 0x1306 }, { 5639, 0x3001 }, { 5642, 0x0010 }, { 5643, 0x0080 }, + { 5644, 0x0113 }, { 5648, 0x100b }, { 5652, 0x0011 }, { 5654, 0x9300 }, + /* 0xae00 */ + { 5658, 0x2b03 }, { 5664, 0x0010 }, { 5665, 0x0000 }, { 5665, 0x0593 }, + { 5671, 0x746b }, { 5680, 0xb051 }, { 5686, 0x1323 }, { 5692, 0x3b01 }, + { 5698, 0x1030 }, { 5701, 0x0000 }, { 5701, 0x0000 }, { 5701, 0x7000 }, + { 5704, 0xb011 }, { 5709, 0x1303 }, { 5714, 0x2900 }, { 5717, 0x1110 }, + /* 0xaf00 */ + { 5720, 0x2180 }, { 5723, 0x0001 }, { 5724, 0x3000 }, { 5726, 0xb015 }, + { 5732, 0x030e }, { 5737, 0x3001 }, { 5740, 0x0030 }, { 5742, 0x0200 }, + { 5743, 0x0111 }, { 5746, 0x1023 }, { 5750, 0x0000 }, { 5750, 0x1300 }, + { 5753, 0x6b81 }, { 5760, 0x1010 }, { 5762, 0x0300 }, { 5764, 0x0113 }, + /* 0xb000 */ + { 5768, 0x1013 }, { 5772, 0x3011 }, { 5776, 0x0100 }, { 5777, 0x0000 }, + { 5777, 0x5530 }, { 5783, 0x22b8 }, { 5789, 0x0000 }, { 5789, 0x3000 }, + { 5791, 0xb011 }, { 5796, 0x9702 }, { 5802, 0xfb07 }, { 5812, 0x113a }, + { 5818, 0x03b0 }, { 5823, 0x0113 }, { 5827, 0x0021 }, { 5829, 0x0000 }, + /* 0xb100 */ + { 5829, 0x1b00 }, { 5833, 0x3b0d }, { 5841, 0x1138 }, { 5846, 0x03b0 }, + { 5851, 0x0113 }, { 5855, 0x1133 }, { 5861, 0x0001 }, { 5862, 0x1300 }, + { 5865, 0x2b05 }, { 5871, 0x111c }, { 5876, 0x0100 }, { 5877, 0x0000 }, + { 5877, 0x1000 }, { 5878, 0xb011 }, { 5883, 0x1300 }, { 5886, 0x2a01 }, + /* 0xb200 */ + { 5890, 0x1930 }, { 5895, 0x02b0 }, { 5899, 0x0001 }, { 5900, 0x1010 }, + { 5902, 0x0000 }, { 5902, 0x1100 }, { 5904, 0x0301 }, { 5907, 0x1030 }, + { 5910, 0x0230 }, { 5913, 0x0713 }, { 5919, 0x146b }, { 5926, 0x0011 }, + { 5928, 0x1300 }, { 5931, 0x2b05 }, { 5937, 0xf974 }, { 5947, 0x8fb8 }, + /* 0xb300 */ + { 5956, 0x0113 }, { 5960, 0x103b }, { 5966, 0x0000 }, { 5966, 0x0000 }, + { 5966, 0x0000 }, { 5966, 0xd970 }, { 5974, 0x4ab0 }, { 5980, 0x0113 }, + { 5984, 0x103b }, { 5990, 0x0011 }, { 5992, 0x1103 }, { 5996, 0x0000 }, + { 5996, 0x5930 }, { 6002, 0x2ab1 }, { 6009, 0x0111 }, { 6012, 0x1000 }, + /* 0xb400 */ + { 6013, 0x0000 }, { 6013, 0x1101 }, { 6016, 0x0b01 }, { 6020, 0x0010 }, + { 6021, 0x0000 }, { 6021, 0x0113 }, { 6025, 0x102b }, { 6030, 0x0000 }, + { 6030, 0x0101 }, { 6032, 0x2000 }, { 6033, 0x1110 }, { 6036, 0x02a0 }, + { 6039, 0x0111 }, { 6042, 0x3021 }, { 6046, 0xb059 }, { 6053, 0x0102 }, + /* 0xb500 */ + { 6055, 0x0000 }, { 6055, 0x1930 }, { 6060, 0x07b0 }, { 6066, 0x0113 }, + { 6070, 0x383b }, { 6078, 0xb011 }, { 6083, 0x0003 }, { 6085, 0x0000 }, + { 6085, 0x0000 }, { 6085, 0x0000 }, { 6085, 0x0d13 }, { 6091, 0x383b }, + { 6099, 0xb011 }, { 6104, 0x0103 }, { 6107, 0x1000 }, { 6108, 0x0000 }, + /* 0xb600 */ + { 6108, 0x0000 }, { 6108, 0x0113 }, { 6112, 0x1020 }, { 6114, 0x0010 }, + { 6115, 0x0100 }, { 6116, 0x0000 }, { 6116, 0x0110 }, { 6118, 0x0000 }, + { 6118, 0x0000 }, { 6118, 0x3000 }, { 6120, 0x1811 }, { 6124, 0x0002 }, + { 6125, 0x0000 }, { 6125, 0x0010 }, { 6126, 0x0000 }, { 6126, 0x0111 }, + /* 0xb700 */ + { 6129, 0x0023 }, { 6132, 0x0000 }, { 6132, 0x9300 }, { 6136, 0x0b01 }, + { 6140, 0x1110 }, { 6143, 0x0030 }, { 6145, 0x0111 }, { 6148, 0x302b }, + { 6154, 0xb011 }, { 6159, 0x13c7 }, { 6167, 0x3b01 }, { 6173, 0x0130 }, + { 6176, 0x0280 }, { 6178, 0x0000 }, { 6178, 0x3000 }, { 6180, 0xb011 }, + /* 0xb800 */ + { 6185, 0x1383 }, { 6191, 0x2b01 }, { 6196, 0x1130 }, { 6200, 0x03b0 }, + { 6205, 0x0011 }, { 6207, 0x300a }, { 6211, 0xb011 }, { 6216, 0x1102 }, + { 6219, 0x2000 }, { 6220, 0x0000 }, { 6220, 0x0100 }, { 6221, 0x0111 }, + { 6224, 0x102b }, { 6229, 0xa011 }, { 6233, 0x1302 }, { 6237, 0x2b01 }, + /* 0xb900 */ + { 6242, 0x0010 }, { 6243, 0x0100 }, { 6244, 0x0001 }, { 6245, 0x3000 }, + { 6247, 0x9011 }, { 6251, 0x1302 }, { 6255, 0x2b01 }, { 6260, 0x1130 }, + { 6264, 0x66b0 }, { 6271, 0x0000 }, { 6271, 0x3000 }, { 6273, 0xb011 }, + { 6278, 0xd302 }, { 6284, 0x6b07 }, { 6292, 0x113a }, { 6298, 0x07b0 }, + /* 0xba00 */ + { 6304, 0x0103 }, { 6307, 0x0020 }, { 6308, 0x0000 }, { 6308, 0x1300 }, + { 6311, 0x6b05 }, { 6318, 0x1138 }, { 6323, 0x03b0 }, { 6328, 0x0113 }, + { 6332, 0x10b8 }, { 6337, 0x0000 }, { 6337, 0x1b00 }, { 6341, 0x2b05 }, + { 6347, 0x0110 }, { 6349, 0x0300 }, { 6351, 0x0000 }, { 6351, 0x1000 }, + /* 0xbb00 */ + { 6352, 0xa011 }, { 6356, 0x1102 }, { 6359, 0x0a01 }, { 6362, 0x7970 }, + { 6370, 0xa2b0 }, { 6376, 0x0111 }, { 6379, 0x100a }, { 6382, 0x0000 }, + { 6382, 0x1100 }, { 6384, 0x0001 }, { 6385, 0x1110 }, { 6388, 0x0090 }, + { 6390, 0x0111 }, { 6393, 0x0009 }, { 6395, 0x0000 }, { 6395, 0x9300 }, + /* 0xbc00 */ + { 6399, 0xbb05 }, { 6407, 0xf9f2 }, { 6418, 0x22b0 }, { 6423, 0x0113 }, + { 6427, 0x323b }, { 6435, 0x2001 }, { 6437, 0x0000 }, { 6437, 0x0000 }, + { 6437, 0x5930 }, { 6443, 0x06b0 }, { 6448, 0x0193 }, { 6453, 0x303b }, + { 6460, 0xa011 }, { 6464, 0x1123 }, { 6469, 0x0000 }, { 6469, 0x1170 }, + /* 0xbd00 */ + { 6474, 0x02b0 }, { 6478, 0x0011 }, { 6480, 0x1010 }, { 6482, 0x0000 }, + { 6482, 0x1301 }, { 6486, 0x0301 }, { 6489, 0x0110 }, { 6491, 0x0000 }, + { 6491, 0x0793 }, { 6498, 0x162b }, { 6505, 0x0010 }, { 6506, 0x0101 }, + { 6508, 0x0000 }, { 6508, 0x1130 }, { 6512, 0x0200 }, { 6513, 0x0111 }, + /* 0xbe00 */ + { 6516, 0x3029 }, { 6521, 0xb011 }, { 6526, 0x0000 }, { 6526, 0x0000 }, + { 6526, 0x5130 }, { 6531, 0x0eb0 }, { 6537, 0x0513 }, { 6542, 0x383b }, + { 6550, 0xb011 }, { 6555, 0x0303 }, { 6559, 0x0100 }, { 6560, 0x0000 }, + { 6560, 0x0000 }, { 6560, 0x0193 }, { 6565, 0x1039 }, { 6570, 0x0000 }, + /* 0xbf00 */ + { 6570, 0x0302 }, { 6573, 0x3b00 }, { 6578, 0x0000 }, { 6578, 0x0000 }, + { 6578, 0x0113 }, { 6582, 0x0023 }, { 6585, 0x0000 }, { 6585, 0x0000 }, + { 6585, 0x0000 }, { 6585, 0x0010 }, { 6586, 0x0000 }, { 6586, 0x0001 }, + { 6587, 0x3020 }, { 6590, 0x9011 }, { 6594, 0x0002 }, { 6595, 0x0000 }, + /* 0xc000 */ + { 6595, 0x0000 }, { 6595, 0x0000 }, { 6595, 0x0000 }, { 6595, 0x1000 }, + { 6596, 0x0000 }, { 6596, 0x1102 }, { 6599, 0x0301 }, { 6602, 0x0000 }, + { 6602, 0x0000 }, { 6602, 0x0113 }, { 6606, 0xb02b }, { 6613, 0xb079 }, + { 6621, 0x1323 }, { 6627, 0x3b01 }, { 6633, 0x1130 }, { 6637, 0x02b0 }, + /* 0xc100 */ + { 6641, 0x0111 }, { 6644, 0xf021 }, { 6650, 0xb0d9 }, { 6658, 0x1343 }, + { 6664, 0x3b01 }, { 6670, 0x1130 }, { 6674, 0x03b0 }, { 6679, 0x0111 }, + { 6682, 0x7020 }, { 6686, 0xb051 }, { 6692, 0x1322 }, { 6697, 0x2001 }, + { 6699, 0x1110 }, { 6702, 0x0190 }, { 6705, 0x0111 }, { 6708, 0x300b }, + /* 0xc200 */ + { 6713, 0xb011 }, { 6718, 0x9302 }, { 6723, 0xab01 }, { 6729, 0x0016 }, + { 6732, 0x0100 }, { 6733, 0x0113 }, { 6737, 0x3021 }, { 6741, 0xb011 }, + { 6746, 0x0302 }, { 6749, 0x2901 }, { 6753, 0x3130 }, { 6758, 0x02b0 }, + { 6762, 0x0000 }, { 6762, 0x3000 }, { 6764, 0xb819 }, { 6771, 0x1b42 }, + /* 0xc300 */ + { 6777, 0x3301 }, { 6782, 0x1138 }, { 6787, 0x0330 }, { 6791, 0x0000 }, + { 6791, 0x0020 }, { 6792, 0x0000 }, { 6792, 0x1300 }, { 6795, 0x3305 }, + { 6801, 0x1110 }, { 6804, 0x0000 }, { 6804, 0x0000 }, { 6804, 0x0000 }, + { 6804, 0x0001 }, { 6805, 0x9300 }, { 6809, 0x2305 }, { 6814, 0x0130 }, + /* 0xc400 */ + { 6817, 0x0100 }, { 6818, 0x0001 }, { 6819, 0x1010 }, { 6821, 0x3011 }, + { 6825, 0x0100 }, { 6826, 0x0000 }, { 6826, 0x1130 }, { 6830, 0x0230 }, + { 6833, 0x0001 }, { 6834, 0x1010 }, { 6836, 0x0000 }, { 6836, 0x1100 }, + { 6838, 0x0000 }, { 6838, 0x0000 }, { 6838, 0x0200 }, { 6839, 0x8513 }, + /* 0xc500 */ + { 6845, 0x1003 }, { 6848, 0x1011 }, { 6851, 0x1300 }, { 6854, 0x2b01 }, + { 6859, 0x7730 }, { 6867, 0x63b8 }, { 6875, 0x0113 }, { 6879, 0x303b }, + { 6886, 0xb091 }, { 6892, 0x11a2 }, { 6897, 0x0201 }, { 6899, 0x7b30 }, + { 6907, 0x57f0 }, { 6916, 0x0113 }, { 6920, 0x702b }, { 6927, 0xf0d1 }, + /* 0xc600 */ + { 6935, 0x11e3 }, { 6942, 0x1b01 }, { 6947, 0x7130 }, { 6953, 0x0ab9 }, + { 6960, 0x0113 }, { 6964, 0x303b }, { 6971, 0x9001 }, { 6974, 0x1302 }, + { 6978, 0x2b01 }, { 6983, 0x1130 }, { 6987, 0x02b0 }, { 6991, 0x0713 }, + { 6997, 0x302b }, { 7003, 0x3011 }, { 7007, 0x1303 }, { 7012, 0x2301 }, + /* 0xc700 */ + { 7016, 0x1130 }, { 7020, 0x02b0 }, { 7024, 0x0113 }, { 7028, 0x30ab }, + { 7035, 0xb411 }, { 7041, 0x11fe }, { 7050, 0x0901 }, { 7053, 0x7130 }, + { 7059, 0x47b8 }, { 7067, 0x05d3 }, { 7074, 0x307b }, { 7082, 0xb011 }, + { 7087, 0x5303 }, { 7093, 0x2101 }, { 7096, 0x1110 }, { 7099, 0x0000 }, + /* 0xc800 */ + { 7099, 0x0513 }, { 7104, 0x306b }, { 7111, 0xb011 }, { 7116, 0x1102 }, + { 7119, 0x3301 }, { 7124, 0x0010 }, { 7125, 0x0000 }, { 7125, 0x0513 }, + { 7130, 0x38eb }, { 7139, 0xa010 }, { 7142, 0x0102 }, { 7144, 0x3000 }, + { 7146, 0x1110 }, { 7149, 0x02b0 }, { 7153, 0x0013 }, { 7156, 0x3020 }, + /* 0xc900 */ + { 7159, 0xb071 }, { 7166, 0x0102 }, { 7168, 0x1000 }, { 7169, 0x0010 }, + { 7170, 0x0000 }, { 7170, 0x0113 }, { 7174, 0x100b }, { 7178, 0x1011 }, + { 7181, 0x1300 }, { 7184, 0x2b01 }, { 7189, 0x0000 }, { 7189, 0x0000 }, + { 7189, 0x0593 }, { 7195, 0x366b }, { 7204, 0xb095 }, { 7211, 0x1303 }, + /* 0xca00 */ + { 7216, 0x3b01 }, { 7222, 0x0110 }, { 7224, 0x0200 }, { 7225, 0x0000 }, + { 7225, 0x3000 }, { 7227, 0xb011 }, { 7232, 0x0103 }, { 7235, 0x2000 }, + { 7236, 0x0010 }, { 7237, 0x0100 }, { 7238, 0x0000 }, { 7238, 0x3000 }, + { 7240, 0xb011 }, { 7245, 0x030a }, { 7249, 0x1001 }, { 7251, 0x0010 }, + /* 0xcb00 */ + { 7252, 0x0100 }, { 7253, 0x0111 }, { 7256, 0x0003 }, { 7258, 0x0000 }, + { 7258, 0x1302 }, { 7262, 0x2301 }, { 7266, 0x0010 }, { 7267, 0x0300 }, + { 7269, 0x0000 }, { 7269, 0x1000 }, { 7270, 0x0000 }, { 7270, 0x0100 }, + { 7271, 0x0000 }, { 7271, 0x0010 }, { 7272, 0x0290 }, { 7275, 0x0000 }, + /* 0xcc00 */ + { 7275, 0x3000 }, { 7277, 0x3011 }, { 7281, 0x5386 }, { 7288, 0x7b01 }, + { 7295, 0x1130 }, { 7299, 0x03b0 }, { 7304, 0x0151 }, { 7308, 0x0021 }, + { 7310, 0x0000 }, { 7310, 0x1300 }, { 7313, 0x3b01 }, { 7319, 0x1130 }, + { 7323, 0x02b0 }, { 7327, 0x0011 }, { 7329, 0x1010 }, { 7331, 0x0001 }, + /* 0xcd00 */ + { 7332, 0x1302 }, { 7336, 0x2b01 }, { 7341, 0x1110 }, { 7344, 0x0200 }, + { 7345, 0x0000 }, { 7345, 0x1000 }, { 7346, 0xb011 }, { 7351, 0x0102 }, + { 7353, 0x0100 }, { 7354, 0x1130 }, { 7358, 0x02b0 }, { 7362, 0x0001 }, + { 7363, 0x1010 }, { 7365, 0x0001 }, { 7366, 0x1100 }, { 7368, 0x2b01 }, + /* 0xce00 */ + { 7373, 0x1110 }, { 7376, 0x0210 }, { 7378, 0x0113 }, { 7382, 0x002b }, + { 7386, 0x0000 }, { 7386, 0x9300 }, { 7390, 0x2b03 }, { 7396, 0x1130 }, + { 7400, 0x02b0 }, { 7404, 0x0113 }, { 7408, 0x303b }, { 7415, 0x0000 }, + { 7415, 0x0002 }, { 7416, 0x0000 }, { 7416, 0x1930 }, { 7421, 0x03b0 }, + /* 0xcf00 */ + { 7426, 0x0113 }, { 7430, 0x102b }, { 7435, 0xb011 }, { 7440, 0x0103 }, + { 7443, 0x0000 }, { 7443, 0x1130 }, { 7447, 0x02b0 }, { 7451, 0x0113 }, + { 7455, 0x1021 }, { 7458, 0x0000 }, { 7458, 0x0102 }, { 7460, 0x0001 }, + { 7461, 0x0010 }, { 7462, 0x0000 }, { 7462, 0x0113 }, { 7466, 0x102b }, + /* 0xd000 */ + { 7471, 0x0011 }, { 7473, 0x0102 }, { 7475, 0x2000 }, { 7476, 0x1130 }, + { 7480, 0x02b0 }, { 7484, 0x0111 }, { 7487, 0x3001 }, { 7490, 0x3011 }, + { 7494, 0x0002 }, { 7495, 0x0000 }, { 7495, 0x1130 }, { 7499, 0x02b0 }, + { 7503, 0x0313 }, { 7508, 0x303b }, { 7515, 0xb011 }, { 7520, 0x0103 }, + /* 0xd100 */ + { 7523, 0x2000 }, { 7524, 0x0000 }, { 7524, 0x0000 }, { 7524, 0x0513 }, + { 7529, 0x303b }, { 7536, 0xb011 }, { 7541, 0x1102 }, { 7544, 0x1000 }, + { 7545, 0x0110 }, { 7547, 0x0000 }, { 7547, 0x0113 }, { 7551, 0x142b }, + { 7557, 0x0001 }, { 7558, 0x0100 }, { 7559, 0x0000 }, { 7559, 0x0110 }, + /* 0xd200 */ + { 7561, 0x0280 }, { 7563, 0x0001 }, { 7564, 0x3000 }, { 7566, 0xb011 }, + { 7571, 0x0102 }, { 7573, 0x1000 }, { 7574, 0x0010 }, { 7575, 0x0000 }, + { 7575, 0x0113 }, { 7579, 0x1023 }, { 7583, 0x1011 }, { 7586, 0x9302 }, + { 7591, 0x0b05 }, { 7596, 0x1110 }, { 7599, 0x0030 }, { 7601, 0x0113 }, + /* 0xd300 */ + { 7605, 0x702b }, { 7612, 0xb051 }, { 7618, 0x1323 }, { 7624, 0x3b01 }, + { 7630, 0x0030 }, { 7632, 0x0000 }, { 7632, 0x0000 }, { 7632, 0x3000 }, + { 7634, 0xb011 }, { 7639, 0x1303 }, { 7644, 0x2b01 }, { 7649, 0x1110 }, + { 7652, 0x0330 }, { 7656, 0x0101 }, { 7658, 0x300a }, { 7662, 0xb011 }, + /* 0xd400 */ + { 7667, 0x0102 }, { 7669, 0x2000 }, { 7670, 0x0000 }, { 7670, 0x0000 }, + { 7670, 0x0011 }, { 7672, 0x1000 }, { 7673, 0xa011 }, { 7677, 0x9300 }, + { 7681, 0x2b05 }, { 7687, 0x0010 }, { 7688, 0x0200 }, { 7689, 0x0000 }, + { 7689, 0x1000 }, { 7690, 0x9011 }, { 7694, 0x1100 }, { 7696, 0x2901 }, + /* 0xd500 */ + { 7700, 0x1110 }, { 7703, 0x00b0 }, { 7706, 0x0000 }, { 7706, 0x3000 }, + { 7708, 0xb011 }, { 7713, 0x1302 }, { 7717, 0x2b21 }, { 7723, 0x1130 }, + { 7727, 0x03b0 }, { 7732, 0x0001 }, { 7733, 0x0020 }, { 7734, 0x0000 }, + { 7734, 0x1300 }, { 7737, 0x2b05 }, { 7743, 0x1130 }, { 7747, 0x02b0 }, + /* 0xd600 */ + { 7751, 0x0113 }, { 7755, 0x103b }, { 7761, 0x2011 }, { 7764, 0x1300 }, + { 7767, 0x2b21 }, { 7773, 0x1132 }, { 7778, 0x0280 }, { 7780, 0x0013 }, + { 7783, 0x3028 }, { 7787, 0xa011 }, { 7791, 0x1102 }, { 7794, 0x0a01 }, + { 7797, 0x1130 }, { 7801, 0x0292 }, { 7805, 0x0111 }, { 7808, 0x3021 }, + /* 0xd700 */ + { 7812, 0x0011 }, { 7814, 0x1302 }, { 7818, 0x2b01 }, { 7823, 0x1130 }, + { 7827, 0x0290 }, { 7830, 0x03d3 }, { 7837, 0x122b }, { 7843, 0x3011 }, + { 7847, 0x1302 }, { 7851, 0x2b01 }, +}; +static const Summary16 ksc5601_uni2indx_pagef9[17] = { + /* 0xf900 */ + { 7856, 0xffff }, { 7872, 0xffff }, { 7888, 0xffff }, { 7904, 0xffff }, + { 7920, 0xffff }, { 7936, 0xffff }, { 7952, 0xffff }, { 7968, 0xffff }, + { 7984, 0xffff }, { 8000, 0xffff }, { 8016, 0xffff }, { 8032, 0xffff }, + { 8048, 0xffff }, { 8064, 0xffff }, { 8080, 0xffff }, { 8096, 0xffff }, + /* 0xfa00 */ + { 8112, 0x0fff }, +}; +static const Summary16 ksc5601_uni2indx_pageff[15] = { + /* 0xff00 */ + { 8124, 0xfffe }, { 8139, 0xffff }, { 8155, 0xffff }, { 8171, 0xffff }, + { 8187, 0xffff }, { 8203, 0x7fff }, { 8218, 0x0000 }, { 8218, 0x0000 }, + { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x0000 }, + { 8218, 0x0000 }, { 8218, 0x0000 }, { 8218, 0x006f }, +}; + +static int +ksc5601_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (n >= 2) { + const Summary16 *summary = NULL; + if (wc < 0x0460) + summary = &ksc5601_uni2indx_page00[(wc>>4)]; + else if (wc >= 0x2000 && wc < 0x2670) /* General Punctuation (2000, 206F) */ + summary = &ksc5601_uni2indx_page20[(wc>>4)-0x200]; + 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) /* CJK Unified Ideographs (4E00, 9FFF) */ + summary = &ksc5601_uni2indx_page4e[(wc>>4)-0x4e0]; + else if (wc >= 0xac00 && wc < 0xd7a0) /* Hangul Syllables (AC00, D7AF) 11183 */ + summary = &ksc5601_uni2indx_pageac[(wc>>4)-0xac0]; + else if (wc >= 0xf900 && wc < 0xfa10) /* CJK Compatibility Ideographs (F900, FAFF) */ + summary = &ksc5601_uni2indx_pagef9[(wc>>4)-0xf90]; + 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; + unsigned int i = wc & 0x0f; + if (used & ((unsigned short) 1 << i)) { + unsigned short c; + /* Keep in `used' only the bits 0..i-1. */ + used &= ((unsigned short) 1 << i) - 1; + /* Add `summary->indx' and the number of bits set in `used'. */ + used = (used & 0x5555) + ((used & 0xaaaa) >> 1); + used = (used & 0x3333) + ((used & 0xcccc) >> 2); + used = (used & 0x0f0f) + ((used & 0xf0f0) >> 4); + used = (used & 0x00ff) + (used >> 8); + c = ksc5601_2charset[summary->indx + used]; + r[0] = (c >> 8); r[1] = (c & 0xff); + return 2; + } + } + return RET_ILSEQ; + } + return RET_TOOSMALL; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/mulelao.h b/nx-X11/lib/src/xlibi18n/lcUniConv/mulelao.h new file mode 100644 index 000000000..5b8245762 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/mulelao.h @@ -0,0 +1,77 @@ + +/* + * MULELAO-1 + */ + +static const unsigned short mulelao_2uni[96] = { + /* 0xa0 */ + 0x00a0, 0x0e81, 0x0e82, 0xfffd, 0x0e84, 0xfffd, 0xfffd, 0x0e87, + 0x0e88, 0xfffd, 0x0e8a, 0xfffd, 0xfffd, 0x0e8d, 0xfffd, 0xfffd, + /* 0xb0 */ + 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e94, 0x0e95, 0x0e96, 0x0e97, + 0xfffd, 0x0e99, 0x0e9a, 0x0e9b, 0x0e9c, 0x0e9d, 0x0e9e, 0x0e9f, + /* 0xc0 */ + 0xfffd, 0x0ea1, 0x0ea2, 0x0ea3, 0xfffd, 0x0ea5, 0xfffd, 0x0ea7, + 0xfffd, 0xfffd, 0x0eaa, 0x0eab, 0xfffd, 0x0ead, 0x0eae, 0x0eaf, + /* 0xd0 */ + 0x0eb0, 0x0eb1, 0x0eb2, 0x0eb3, 0x0eb4, 0x0eb5, 0x0eb6, 0x0eb7, + 0x0eb8, 0x0eb9, 0xfffd, 0x0ebb, 0x0ebc, 0x0ebd, 0xfffd, 0xfffd, + /* 0xe0 */ + 0x0ec0, 0x0ec1, 0x0ec2, 0x0ec3, 0x0ec4, 0xfffd, 0x0ec6, 0xfffd, + 0x0ec8, 0x0ec9, 0x0eca, 0x0ecb, 0x0ecc, 0x0ecd, 0xfffd, 0xfffd, + /* 0xf0 */ + 0x0ed0, 0x0ed1, 0x0ed2, 0x0ed3, 0x0ed4, 0x0ed5, 0x0ed6, 0x0ed7, + 0x0ed8, 0x0ed9, 0xfffd, 0xfffd, 0x0edc, 0x0edd, 0xfffd, 0xfffd, +}; + +static int +mulelao_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0xa0) { + *pwc = (ucs4_t) c; + return 1; + } + else { + unsigned short wc = mulelao_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char mulelao_page0e[96] = { + 0x00, 0xa1, 0xa2, 0x00, 0xa4, 0x00, 0x00, 0xa7, /* 0x80-0x87 */ + 0xa8, 0x00, 0xaa, 0x00, 0x00, 0xad, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x90-0x97 */ + 0x00, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x98-0x9f */ + 0x00, 0xc1, 0xc2, 0xc3, 0x00, 0xc5, 0x00, 0xc7, /* 0xa0-0xa7 */ + 0x00, 0x00, 0xca, 0xcb, 0x00, 0xcd, 0xce, 0xcf, /* 0xa8-0xaf */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0xb0-0xb7 */ + 0xd8, 0xd9, 0x00, 0xdb, 0xdc, 0xdd, 0x00, 0x00, /* 0xb8-0xbf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0x00, 0xe6, 0x00, /* 0xc0-0xc7 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0x00, 0x00, /* 0xc8-0xcf */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0xd0-0xd7 */ + 0xf8, 0xf9, 0x00, 0x00, 0xfc, 0xfd, 0x00, 0x00, /* 0xd8-0xdf */ +}; + +static int +mulelao_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x00a0) { + *r = wc; + return 1; + } + else if (wc == 0x00a0) + c = 0xa0; + else if (wc >= 0x0e80 && wc < 0x0ee0) + c = mulelao_page0e[wc-0x0e80]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/tatar_cyr.h b/nx-X11/lib/src/xlibi18n/lcUniConv/tatar_cyr.h new file mode 100644 index 000000000..471e5a79a --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/tatar_cyr.h @@ -0,0 +1,122 @@ + +/* + * TATAR-CYR + */ + +static const unsigned short tatar_cyr_2uni[128] = { + /* 0x80 */ + 0x04d8, 0x0403, 0x201a, 0x0453, 0x201e, 0x2026, 0x2020, 0x2021, + 0x20ac, 0x2030, 0x04e8, 0x2039, 0x04ae, 0x0496, 0x04a2, 0x04ba, + /* 0x90 */ + 0x04d9, 0x2018, 0x2019, 0x201c, 0x201d, 0x2022, 0x2013, 0x2014, + 0x98, 0x2122, 0x04e9, 0x203a, 0x04af, 0x0497, 0x04a3, 0x04bb, + /* 0xa0 */ + 0x00a0, 0x040e, 0x045e, 0x0408, 0x00a4, 0x0490, 0x00a6, 0x00a7, + 0x0401, 0x00a9, 0x0404, 0x00ab, 0x00ac, 0x00ad, 0x00ae, 0x0407, + /* 0xb0 */ + 0x00b0, 0x00b1, 0x0406, 0x0456, 0x0491, 0x00b5, 0x00b6, 0x00b7, + 0x0451, 0x2116, 0x0454, 0x00bb, 0x0458, 0x0405, 0x0455, 0x0457, + /* 0xc0 */ + 0x0410, 0x0411, 0x0412, 0x0413, 0x0414, 0x0415, 0x0416, 0x0417, + 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x041d, 0x041e, 0x041f, + /* 0xd0 */ + 0x0420, 0x0421, 0x0422, 0x0423, 0x0424, 0x0425, 0x0426, 0x0427, + 0x0428, 0x0429, 0x042a, 0x042b, 0x042c, 0x042d, 0x042e, 0x042f, + /* 0xe0 */ + 0x0430, 0x0431, 0x0432, 0x0433, 0x0434, 0x0435, 0x0436, 0x0437, + 0x0438, 0x0439, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, + /* 0xf0 */ + 0x0440, 0x0441, 0x0442, 0x0443, 0x0444, 0x0445, 0x0446, 0x0447, + 0x0448, 0x0449, 0x044a, 0x044b, 0x044c, 0x044d, 0x044e, 0x044f, +}; + +static int +tatar_cyr_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) tatar_cyr_2uni[c-0x80]; + return 1; +} + +static const unsigned char tatar_cyr_page00[32] = { + 0xa0, 0x00, 0x00, 0x00, 0xa4, 0x00, 0xa6, 0xa7, /* 0xa0-0xa7 */ + 0x00, 0xa9, 0x00, 0xab, 0xac, 0xad, 0xae, 0x00, /* 0xa8-0xaf */ + 0xb0, 0xb1, 0x00, 0x00, 0x00, 0xb5, 0xb6, 0xb7, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0xbb, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ +}; +static const unsigned char tatar_cyr_page04[240] = { + 0x00, 0xa8, 0x00, 0x81, 0xaa, 0xbd, 0xb2, 0xaf, /* 0x00-0x07 */ + 0xa3, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa1, 0x00, /* 0x08-0x0f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x10-0x17 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x18-0x1f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x20-0x27 */ + 0xd8, 0xd9, 0xda, 0xdb, 0xdc, 0xdd, 0xde, 0xdf, /* 0x28-0x2f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x30-0x37 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x38-0x3f */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x40-0x47 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0xfc, 0xfd, 0xfe, 0xff, /* 0x48-0x4f */ + 0x00, 0xb8, 0x00, 0x83, 0xba, 0xbe, 0xb3, 0xbf, /* 0x50-0x57 */ + 0xbc, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa2, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0xa5, 0xb4, 0x00, 0x00, 0x00, 0x00, 0x8d, 0x9d, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0x00, 0x00, 0x8e, 0x9e, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x8c, 0x9c, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x8f, 0x9f, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x80, 0x90, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xd8-0xdf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0x8a, 0x9a, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xe8-0xef */ +}; +static const unsigned char tatar_cyr_page20[48] = { + 0x00, 0x00, 0x00, 0x96, 0x97, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x91, 0x92, 0x82, 0x00, 0x93, 0x94, 0x84, 0x00, /* 0x18-0x1f */ + 0x86, 0x87, 0x95, 0x00, 0x00, 0x00, 0x85, 0x00, /* 0x20-0x27 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x89, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x8b, 0x9b, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ +}; +static const unsigned char tatar_cyr_page21[24] = { + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xb9, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x99, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ +}; +static const unsigned char tatar_cyr_page22[1] = { + 0xb0, /* 0x16-0x16 */ +}; + +static int +tatar_cyr_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x00bc) + c = tatar_cyr_page00[wc-0x00a0]; + else if (wc >= 0x0400 && wc < 0x04ef) + c = tatar_cyr_page04[wc-0x0400]; + else if (wc >= 0x2010 && wc < 0x203b) + c = tatar_cyr_page20[wc-0x2010]; + else if (wc == 0x20ac) + c = 0x88; + else if (wc >= 0x2110 && wc < 0x2123) + c = tatar_cyr_page21[wc-0x2110]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/tcvn.h b/nx-X11/lib/src/xlibi18n/lcUniConv/tcvn.h new file mode 100644 index 000000000..4662683dc --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/tcvn.h @@ -0,0 +1,133 @@ + +/* + * TCVN-5712 + */ + +static const unsigned short tcvn_2uni_1[32] = { + /* 0x00 */ + 0x0000, 0x00da, 0x1ee4, 0x0003, 0x1eea, 0x1eec, 0x1eee, 0x0007, + 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + /* 0x10 */ + 0x0010, 0x1ee8, 0x1ef0, 0x1ef2, 0x1ef6, 0x1ef8, 0x00dd, 0x1ef4, + 0x0018, 0x0019, 0x001a, 0x001b, 0x001c, 0x001d, 0x001e, 0x001f, +}; +static const unsigned short tcvn_2uni_2[128] = { + /* 0x80 */ + 0x00c0, 0x1ea2, 0x00c3, 0x00c1, 0x1ea0, 0x1eb6, 0x1eac, 0x00c8, + 0x1eba, 0x1ebc, 0x00c9, 0x1eb8, 0x1ec6, 0x00cc, 0x1ec8, 0x0128, + /* 0x90 */ + 0x00cd, 0x1eca, 0x00d2, 0x1ece, 0x00d5, 0x00d3, 0x1ecc, 0x1ed8, + 0x1edc, 0x1ede, 0x1ee0, 0x1eda, 0x1ee2, 0x00d9, 0x1ee6, 0x0168, + /* 0xa0 */ + 0x00a0, 0x0102, 0x00c2, 0x00ca, 0x00d4, 0x01a0, 0x01af, 0x0110, + 0x0103, 0x00e2, 0x00ea, 0x00f4, 0x01a1, 0x01b0, 0x0111, 0x1eb0, + /* 0xb0 */ + 0x0300, 0x0309, 0x0303, 0x0301, 0x0323, 0x00e0, 0x1ea3, 0x00e3, + 0x00e1, 0x1ea1, 0x1eb2, 0x1eb1, 0x1eb3, 0x1eb5, 0x1eaf, 0x1eb4, + /* 0xc0 */ + 0x1eae, 0x1ea6, 0x1ea8, 0x1eaa, 0x1ea4, 0x1ec0, 0x1eb7, 0x1ea7, + 0x1ea9, 0x1eab, 0x1ea5, 0x1ead, 0x00e8, 0x1ec2, 0x1ebb, 0x1ebd, + /* 0xd0 */ + 0x00e9, 0x1eb9, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ebf, 0x1ec7, 0x00ec, + 0x1ec9, 0x1ec4, 0x1ebe, 0x1ed2, 0x0129, 0x00ed, 0x1ecb, 0x00f2, + /* 0xe0 */ + 0x1ed4, 0x1ecf, 0x00f5, 0x00f3, 0x1ecd, 0x1ed3, 0x1ed5, 0x1ed7, + 0x1ed1, 0x1ed9, 0x1edd, 0x1edf, 0x1ee1, 0x1edb, 0x1ee3, 0x00f9, + /* 0xf0 */ + 0x1ed6, 0x1ee7, 0x0169, 0x00fa, 0x1ee5, 0x1eeb, 0x1eed, 0x1eef, + 0x1ee9, 0x1ef1, 0x1ef3, 0x1ef7, 0x1ef9, 0x00fd, 0x1ef5, 0x1ed0, +}; + +static int +tcvn_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x20) + *pwc = (ucs4_t) tcvn_2uni_1[c]; + else if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) tcvn_2uni_2[c-0x80]; + return 1; +} + +static const unsigned char tcvn_page00[96+184] = { + 0xa0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa8-0xaf */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb8-0xbf */ + 0x80, 0x83, 0xa2, 0x82, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0x87, 0x8a, 0xa3, 0x00, 0x8d, 0x90, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0x92, 0x95, 0xa4, 0x94, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0x9d, 0x01, 0x00, 0x00, 0x16, 0x00, 0x00, /* 0xd8-0xdf */ + 0xb5, 0xb8, 0xa9, 0xb7, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xcc, 0xd0, 0xaa, 0x00, 0xd7, 0xdd, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0xdf, 0xe3, 0xab, 0xe2, 0x00, 0x00, /* 0xf0-0xf7 */ + 0x00, 0xef, 0xf3, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ + /* 0x0100 */ + 0x00, 0x00, 0xa1, 0xa8, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0xa7, 0xae, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0x8f, 0xdc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x9f, 0xf2, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xa5, 0xac, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xa6, /* 0xa8-0xaf */ + 0xad, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ +}; +static const unsigned char tcvn_page03[40] = { + 0xb0, 0xb3, 0x00, 0xb2, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0xb1, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0xb4, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ +}; +static const unsigned char tcvn_page1e[96] = { + 0x84, 0xb9, 0x81, 0xb6, 0xc4, 0xca, 0xc1, 0xc7, /* 0xa0-0xa7 */ + 0xc2, 0xc8, 0xc3, 0xc9, 0x86, 0xcb, 0xc0, 0xbe, /* 0xa8-0xaf */ + 0xaf, 0xbb, 0xba, 0xbc, 0xbf, 0xbd, 0x85, 0xc6, /* 0xb0-0xb7 */ + 0x8b, 0xd1, 0x88, 0xce, 0x89, 0xcf, 0xda, 0xd5, /* 0xb8-0xbf */ + 0xc5, 0xd2, 0xcd, 0xd3, 0xd9, 0xd4, 0x8c, 0xd6, /* 0xc0-0xc7 */ + 0x8e, 0xd8, 0x91, 0xde, 0x96, 0xe4, 0x93, 0xe1, /* 0xc8-0xcf */ + 0xff, 0xe8, 0xdb, 0xe5, 0xe0, 0xe6, 0xf0, 0xe7, /* 0xd0-0xd7 */ + 0x97, 0xe9, 0x9b, 0xed, 0x98, 0xea, 0x99, 0xeb, /* 0xd8-0xdf */ + 0x9a, 0xec, 0x9c, 0xee, 0x02, 0xf4, 0x9e, 0xf1, /* 0xe0-0xe7 */ + 0x11, 0xf8, 0x04, 0xf5, 0x05, 0xf6, 0x06, 0xf7, /* 0xe8-0xef */ + 0x12, 0xf9, 0x13, 0xfa, 0x17, 0xfe, 0x14, 0xfb, /* 0xf0-0xf7 */ + 0x15, 0xfc, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; + +static int +tcvn_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080 && (wc >= 0x0020 || (0x00fe0076 & (1 << wc)) == 0)) { + *r = wc; + return 1; + } + else if (wc >= 0x00a0 && wc < 0x01b8) + c = tcvn_page00[wc-0x00a0]; + else if (wc >= 0x0300 && wc < 0x0328) + c = tcvn_page03[wc-0x0300]; + else if (wc >= 0x1ea0 && wc < 0x1f00) + c = tcvn_page1e[wc-0x1ea0]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/tis620.h b/nx-X11/lib/src/xlibi18n/lcUniConv/tis620.h new file mode 100644 index 000000000..4fa96ec98 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/tis620.h @@ -0,0 +1,77 @@ + +/* + * TIS620-0 + */ + +static const unsigned short tis620_2uni[96] = { + /* 0xa0 */ + 0xfffd, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, + 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x0e0f, + /* 0xb0 */ + 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x0e16, 0x0e17, + 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0e1d, 0x0e1e, 0x0e1f, + /* 0xc0 */ + 0x0e20, 0x0e21, 0x0e22, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, + 0x0e28, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e2f, + /* 0xd0 */ + 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x0e35, 0x0e36, 0x0e37, + 0x0e38, 0x0e39, 0x0e3a, 0xfffd, 0xfffd, 0xfffd, 0xfffd, 0x0e3f, + /* 0xe0 */ + 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x0e45, 0x0e46, 0x0e47, + 0x0e48, 0x0e49, 0x0e4a, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4e, 0x0e4f, + /* 0xf0 */ + 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, + 0x0e58, 0x0e59, 0x0e5a, 0x0e5b, 0xfffd, 0xfffd, 0xfffd, 0xfffd, +}; + +static int +tis620_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x80) { + *pwc = (ucs4_t) c; + return 1; + } + else if (c < 0xa0) { + } + else { + unsigned short wc = tis620_2uni[c-0xa0]; + if (wc != 0xfffd) { + *pwc = (ucs4_t) wc; + return 1; + } + } + return RET_ILSEQ; +} + +static const unsigned char tis620_page0e[96] = { + 0x00, 0xa1, 0xa2, 0xa3, 0xa4, 0xa5, 0xa6, 0xa7, /* 0x00-0x07 */ + 0xa8, 0xa9, 0xaa, 0xab, 0xac, 0xad, 0xae, 0xaf, /* 0x08-0x0f */ + 0xb0, 0xb1, 0xb2, 0xb3, 0xb4, 0xb5, 0xb6, 0xb7, /* 0x10-0x17 */ + 0xb8, 0xb9, 0xba, 0xbb, 0xbc, 0xbd, 0xbe, 0xbf, /* 0x18-0x1f */ + 0xc0, 0xc1, 0xc2, 0xc3, 0xc4, 0xc5, 0xc6, 0xc7, /* 0x20-0x27 */ + 0xc8, 0xc9, 0xca, 0xcb, 0xcc, 0xcd, 0xce, 0xcf, /* 0x28-0x2f */ + 0xd0, 0xd1, 0xd2, 0xd3, 0xd4, 0xd5, 0xd6, 0xd7, /* 0x30-0x37 */ + 0xd8, 0xd9, 0xda, 0x00, 0x00, 0x00, 0x00, 0xdf, /* 0x38-0x3f */ + 0xe0, 0xe1, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, /* 0x40-0x47 */ + 0xe8, 0xe9, 0xea, 0xeb, 0xec, 0xed, 0xee, 0xef, /* 0x48-0x4f */ + 0xf0, 0xf1, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, /* 0x50-0x57 */ + 0xf8, 0xf9, 0xfa, 0xfb, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ +}; + +static int +tis620_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080) { + *r = wc; + return 1; + } + else if (wc >= 0x0e00 && wc < 0x0e60) + c = tis620_page0e[wc-0x0e00]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/ucs2be.h b/nx-X11/lib/src/xlibi18n/lcUniConv/ucs2be.h new file mode 100644 index 000000000..20a8b27bd --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/ucs2be.h @@ -0,0 +1,31 @@ +/* + * UCS-2BE = UCS-2 big endian + */ + +static int +ucs2be_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + if (n >= 2) { + if (s[0] >= 0xd8 && s[0] < 0xe0) { + return RET_ILSEQ; + } else { + *pwc = (s[0] << 8) + s[1]; + return 2; + } + } + return RET_TOOFEW(0); +} + +static int +ucs2be_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + if (wc < 0x10000 && !(wc >= 0xd800 && wc < 0xe000)) { + if (n >= 2) { + r[0] = (unsigned char) (wc >> 8); + r[1] = (unsigned char) wc; + return 2; + } else + return RET_TOOSMALL; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/utf8.h b/nx-X11/lib/src/xlibi18n/lcUniConv/utf8.h new file mode 100644 index 000000000..d00995ca0 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/utf8.h @@ -0,0 +1,109 @@ + +/* + * UTF-8 + */ + +/* Specification: RFC 2279 */ + +static int +utf8_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = s[0]; + + if (c < 0x80) { + *pwc = c; + return 1; + } else if (c < 0xc2) { + return RET_ILSEQ; + } else if (c < 0xe0) { + if (n < 2) + return RET_TOOFEW(0); + if (!((s[1] ^ 0x80) < 0x40)) + return RET_ILSEQ; + *pwc = ((ucs4_t) (c & 0x1f) << 6) + | (ucs4_t) (s[1] ^ 0x80); + return 2; + } else if (c < 0xf0) { + if (n < 3) + return RET_TOOFEW(0); + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (c >= 0xe1 || s[1] >= 0xa0))) + return RET_ILSEQ; + *pwc = ((ucs4_t) (c & 0x0f) << 12) + | ((ucs4_t) (s[1] ^ 0x80) << 6) + | (ucs4_t) (s[2] ^ 0x80); + return 3; + } else if (c < 0xf8) { + if (n < 4) + return RET_TOOFEW(0); + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 + && (c >= 0xf1 || s[1] >= 0x90))) + return RET_ILSEQ; + *pwc = ((ucs4_t) (c & 0x07) << 18) + | ((ucs4_t) (s[1] ^ 0x80) << 12) + | ((ucs4_t) (s[2] ^ 0x80) << 6) + | (ucs4_t) (s[3] ^ 0x80); + return 4; + } else if (c < 0xfc) { + if (n < 5) + return RET_TOOFEW(0); + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (c >= 0xf9 || s[1] >= 0x88))) + return RET_ILSEQ; + *pwc = ((ucs4_t) (c & 0x03) << 24) + | ((ucs4_t) (s[1] ^ 0x80) << 18) + | ((ucs4_t) (s[2] ^ 0x80) << 12) + | ((ucs4_t) (s[3] ^ 0x80) << 6) + | (ucs4_t) (s[4] ^ 0x80); + return 5; + } else if (c < 0xfe) { + if (n < 6) + return RET_TOOFEW(0); + if (!((s[1] ^ 0x80) < 0x40 && (s[2] ^ 0x80) < 0x40 + && (s[3] ^ 0x80) < 0x40 && (s[4] ^ 0x80) < 0x40 + && (s[5] ^ 0x80) < 0x40 + && (c >= 0xfd || s[1] >= 0x84))) + return RET_ILSEQ; + *pwc = ((ucs4_t) (c & 0x01) << 30) + | ((ucs4_t) (s[1] ^ 0x80) << 24) + | ((ucs4_t) (s[2] ^ 0x80) << 18) + | ((ucs4_t) (s[3] ^ 0x80) << 12) + | ((ucs4_t) (s[4] ^ 0x80) << 6) + | (ucs4_t) (s[5] ^ 0x80); + return 6; + } else + return RET_ILSEQ; +} + +static int +utf8_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) /* n == 0 is acceptable */ +{ + int count; + if (wc < 0x80) + count = 1; + else if (wc < 0x800) + count = 2; + else if (wc < 0x10000) + count = 3; + else if (wc < 0x200000) + count = 4; + else if (wc < 0x4000000) + count = 5; + else if (wc <= 0x7fffffff) + count = 6; + else + return RET_ILSEQ; + if (n < count) + return RET_TOOSMALL; + switch (count) { /* note: code falls through cases! */ + case 6: r[5] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x4000000; + case 5: r[4] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x200000; + case 4: r[3] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x10000; + case 3: r[2] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0x800; + case 2: r[1] = 0x80 | (wc & 0x3f); wc = wc >> 6; wc |= 0xc0; + case 1: r[0] = wc; + } + return count; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUniConv/viscii.h b/nx-X11/lib/src/xlibi18n/lcUniConv/viscii.h new file mode 100644 index 000000000..d5147e81e --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUniConv/viscii.h @@ -0,0 +1,122 @@ + +/* + * VISCII1.1-1 + */ + +/* Specification: RFC 1456 */ + +static const unsigned short viscii_2uni_1[32] = { + /* 0x00 */ + 0x0000, 0x0001, 0x1eb2, 0x0003, 0x0004, 0x1eb4, 0x1eaa, 0x0007, + 0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f, + /* 0x10 */ + 0x0010, 0x0011, 0x0012, 0x0013, 0x1ef6, 0x0015, 0x0016, 0x0017, + 0x0018, 0x1ef8, 0x001a, 0x001b, 0x001c, 0x001d, 0x1ef4, 0x001f, +}; +static const unsigned short viscii_2uni_2[128] = { + /* 0x80 */ + 0x1ea0, 0x1eae, 0x1eb0, 0x1eb6, 0x1ea4, 0x1ea6, 0x1ea8, 0x1eac, + 0x1ebc, 0x1eb8, 0x1ebe, 0x1ec0, 0x1ec2, 0x1ec4, 0x1ec6, 0x1ed0, + /* 0x90 */ + 0x1ed2, 0x1ed4, 0x1ed6, 0x1ed8, 0x1ee2, 0x1eda, 0x1edc, 0x1ede, + 0x1eca, 0x1ece, 0x1ecc, 0x1ec8, 0x1ee6, 0x0168, 0x1ee4, 0x1ef2, + /* 0xa0 */ + 0x00d5, 0x1eaf, 0x1eb1, 0x1eb7, 0x1ea5, 0x1ea7, 0x1ea9, 0x1ead, + 0x1ebd, 0x1eb9, 0x1ebf, 0x1ec1, 0x1ec3, 0x1ec5, 0x1ec7, 0x1ed1, + /* 0xb0 */ + 0x1ed3, 0x1ed5, 0x1ed7, 0x1ee0, 0x01a0, 0x1ed9, 0x1edd, 0x1edf, + 0x1ecb, 0x1ef0, 0x1ee8, 0x1eea, 0x1eec, 0x01a1, 0x1edb, 0x01af, + /* 0xc0 */ + 0x00c0, 0x00c1, 0x00c2, 0x00c3, 0x1ea2, 0x0102, 0x1eb3, 0x1eb5, + 0x00c8, 0x00c9, 0x00ca, 0x1eba, 0x00cc, 0x00cd, 0x0128, 0x1ef3, + /* 0xd0 */ + 0x0110, 0x1ee9, 0x00d2, 0x00d3, 0x00d4, 0x1ea1, 0x1ef7, 0x1eeb, + 0x1eed, 0x00d9, 0x00da, 0x1ef9, 0x1ef5, 0x00dd, 0x1ee1, 0x01b0, + /* 0xe0 */ + 0x00e0, 0x00e1, 0x00e2, 0x00e3, 0x1ea3, 0x0103, 0x1eef, 0x1eab, + 0x00e8, 0x00e9, 0x00ea, 0x1ebb, 0x00ec, 0x00ed, 0x0129, 0x1ec9, + /* 0xf0 */ + 0x0111, 0x1ef1, 0x00f2, 0x00f3, 0x00f4, 0x00f5, 0x1ecf, 0x1ecd, + 0x1ee5, 0x00f9, 0x00fa, 0x0169, 0x1ee7, 0x00fd, 0x1ee3, 0x1eee, +}; + +static int +viscii_mbtowc (conv_t conv, ucs4_t *pwc, const unsigned char *s, int n) +{ + unsigned char c = *s; + if (c < 0x20) + *pwc = (ucs4_t) viscii_2uni_1[c]; + else if (c < 0x80) + *pwc = (ucs4_t) c; + else + *pwc = (ucs4_t) viscii_2uni_2[c-0x80]; + return 1; +} + +static const unsigned char viscii_page00[64+184] = { + 0xc0, 0xc1, 0xc2, 0xc3, 0x00, 0x00, 0x00, 0x00, /* 0xc0-0xc7 */ + 0xc8, 0xc9, 0xca, 0x00, 0xcc, 0xcd, 0x00, 0x00, /* 0xc8-0xcf */ + 0x00, 0x00, 0xd2, 0xd3, 0xd4, 0xa0, 0x00, 0x00, /* 0xd0-0xd7 */ + 0x00, 0xd9, 0xda, 0x00, 0x00, 0xdd, 0x00, 0x00, /* 0xd8-0xdf */ + 0xe0, 0xe1, 0xe2, 0xe3, 0x00, 0x00, 0x00, 0x00, /* 0xe0-0xe7 */ + 0xe8, 0xe9, 0xea, 0x00, 0xec, 0xed, 0x00, 0x00, /* 0xe8-0xef */ + 0x00, 0x00, 0xf2, 0xf3, 0xf4, 0xf5, 0x00, 0x00, /* 0xf0-0xf7 */ + 0x00, 0xf9, 0xfa, 0x00, 0x00, 0xfd, 0x00, 0x00, /* 0xf8-0xff */ + /* 0x0100 */ + 0x00, 0x00, 0xc5, 0xe5, 0x00, 0x00, 0x00, 0x00, /* 0x00-0x07 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x08-0x0f */ + 0xd0, 0xf0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x10-0x17 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x18-0x1f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x20-0x27 */ + 0xce, 0xee, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x28-0x2f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x30-0x37 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x38-0x3f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x40-0x47 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x48-0x4f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x50-0x57 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x58-0x5f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x60-0x67 */ + 0x9d, 0xfb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x68-0x6f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x70-0x77 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x78-0x7f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x80-0x87 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x88-0x8f */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x90-0x97 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0x98-0x9f */ + 0xb4, 0xbd, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xa0-0xa7 */ + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xbf, /* 0xa8-0xaf */ + 0xdf, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xb0-0xb7 */ +}; +static const unsigned char viscii_page1e[96] = { + 0x80, 0xd5, 0xc4, 0xe4, 0x84, 0xa4, 0x85, 0xa5, /* 0xa0-0xa7 */ + 0x86, 0xa6, 0x06, 0xe7, 0x87, 0xa7, 0x81, 0xa1, /* 0xa8-0xaf */ + 0x82, 0xa2, 0x02, 0xc6, 0x05, 0xc7, 0x83, 0xa3, /* 0xb0-0xb7 */ + 0x89, 0xa9, 0xcb, 0xeb, 0x88, 0xa8, 0x8a, 0xaa, /* 0xb8-0xbf */ + 0x8b, 0xab, 0x8c, 0xac, 0x8d, 0xad, 0x8e, 0xae, /* 0xc0-0xc7 */ + 0x9b, 0xef, 0x98, 0xb8, 0x9a, 0xf7, 0x99, 0xf6, /* 0xc8-0xcf */ + 0x8f, 0xaf, 0x90, 0xb0, 0x91, 0xb1, 0x92, 0xb2, /* 0xd0-0xd7 */ + 0x93, 0xb5, 0x95, 0xbe, 0x96, 0xb6, 0x97, 0xb7, /* 0xd8-0xdf */ + 0xb3, 0xde, 0x94, 0xfe, 0x9e, 0xf8, 0x9c, 0xfc, /* 0xe0-0xe7 */ + 0xba, 0xd1, 0xbb, 0xd7, 0xbc, 0xd8, 0xff, 0xe6, /* 0xe8-0xef */ + 0xb9, 0xf1, 0x9f, 0xcf, 0x1e, 0xdc, 0x14, 0xd6, /* 0xf0-0xf7 */ + 0x19, 0xdb, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, /* 0xf8-0xff */ +}; + +static int +viscii_wctomb (conv_t conv, unsigned char *r, ucs4_t wc, int n) +{ + unsigned char c = 0; + if (wc < 0x0080 && (wc >= 0x0020 || (0x42100064 & (1 << wc)) == 0)) { + *r = wc; + return 1; + } + else if (wc >= 0x00c0 && wc < 0x01b8) + c = viscii_page00[wc-0x00c0]; + else if (wc >= 0x1ea0 && wc < 0x1f00) + c = viscii_page1e[wc-0x1ea0]; + if (c != 0) { + *r = c; + return 1; + } + return RET_ILSEQ; +} diff --git a/nx-X11/lib/src/xlibi18n/lcUtil.c b/nx-X11/lib/src/xlibi18n/lcUtil.c new file mode 100644 index 000000000..52a16daea --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcUtil.c @@ -0,0 +1,86 @@ +/* + * Copyright 1992, 1993 by TOSHIBA Corp. + * + * 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 supporting + * documentation, and that the name of TOSHIBA not be used in advertising + * or publicity pertaining to distribution of the software without specific, + * written prior permission. TOSHIBA make no representations about the + * suitability of this software for any purpose. It is provided "as is" + * without express or implied warranty. + * + * TOSHIBA DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING + * ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL + * TOSHIBA 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: Katsuhisa Yano TOSHIBA Corp. + * mopi@osa.ilab.toshiba.co.jp + * Bug fixes: Bruno Haible XFree86 Inc. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "XlcPublic.h" + +/* Don't use here because it is locale dependent. */ + +#define set_toupper(ch) \ + if (ch >= 'a' && ch <= 'z') \ + ch = ch - 'a' + 'A'; + +/* Compares two ISO 8859-1 strings, ignoring case of ASCII letters. + Like strcasecmp in an ASCII locale. */ +int +_XlcCompareISOLatin1( + const char *str1, + const char *str2) +{ + unsigned char ch1, ch2; + + for ( ; ; str1++, str2++) { + ch1 = *str1; + ch2 = *str2; + if (ch1 == '\0' || ch2 == '\0') + break; + set_toupper(ch1); + set_toupper(ch2); + if (ch1 != ch2) + break; + } + + return ch1 - ch2; +} + +/* Compares two ISO 8859-1 strings, at most len bytes of each, ignoring + case of ASCII letters. Like strncasecmp in an ASCII locale. */ +int +_XlcNCompareISOLatin1( + const char *str1, + const char *str2, + int len) +{ + unsigned char ch1, ch2; + + for ( ; ; str1++, str2++, len--) { + if (len == 0) + return 0; + ch1 = *str1; + ch2 = *str2; + if (ch1 == '\0' || ch2 == '\0') + break; + set_toupper(ch1); + set_toupper(ch2); + if (ch1 != ch2) + break; + } + + return ch1 - ch2; +} diff --git a/nx-X11/lib/src/xlibi18n/lcWrap.c b/nx-X11/lib/src/xlibi18n/lcWrap.c new file mode 100644 index 000000000..067c501ba --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/lcWrap.c @@ -0,0 +1,648 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* + * Copyright 1991 by the Open Software Foundation + * Copyright 1993 by the TOSHIBA Corp. + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 names of Open Software Foundation and TOSHIBA + * not be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Open Software + * Foundation and TOSHIBA 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 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 + * 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 + * + * Katsuhisa Yano TOSHIBA Corp. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include "Xlibint.h" +#include "Xlcint.h" +#include +#include +#ifdef WIN32 +#undef close +#endif +#include +#include "XlcPubI.h" + +#ifdef XTHREADS +LockInfoPtr _Xi18n_lock; +#endif + +char * +XSetLocaleModifiers( + const char *modifiers) +{ + XLCd lcd = _XlcCurrentLC(); + char *user_mods; + char *mapped_mods; + + if (!lcd) + return (char *) NULL; + if (!modifiers) + return lcd->core->modifiers; + user_mods = getenv("XMODIFIERS"); + mapped_mods = (*lcd->methods->map_modifiers) (lcd, user_mods, modifiers); + if (mapped_mods) { + Xfree(lcd->core->modifiers); + lcd->core->modifiers = mapped_mods; + } + return mapped_mods; +} + +Bool +XSupportsLocale(void) +{ + return _XlcCurrentLC() != (XLCd)NULL; +} + +Bool _XlcValidModSyntax( + const char * mods, + const char * const *valid_mods) +{ + int i; + const char * const *ptr; + + while (mods && (*mods == '@')) { + mods++; + if (*mods == '@') + break; + for (ptr = valid_mods; *ptr; ptr++) { + i = strlen(*ptr); + if (strncmp(mods, *ptr, i) || ((mods[i] != '=') +#ifdef WIN32 + && (mods[i] != '#') +#endif + )) + continue; + mods = strchr(mods+i+1, '@'); + break; + } + } + return !mods || !*mods; +} + +static const char *im_valid[] = {"im", (const char *)NULL}; + +/*ARGSUSED*/ +char * +_XlcDefaultMapModifiers( + XLCd lcd, + const char *user_mods, + const char *prog_mods) +{ + int i; + char *mods; + + if (!_XlcValidModSyntax(prog_mods, im_valid)) + return (char *)NULL; + if (!_XlcValidModSyntax(user_mods, im_valid)) + return (char *)NULL; + i = strlen(prog_mods) + 1; + if (user_mods) + i += strlen(user_mods); + mods = Xmalloc(i); + if (mods) { + strcpy(mods, prog_mods); + if (user_mods) + strcat(mods, user_mods); +#ifdef WIN32 + { + char *s; + for (s = mods; (s = strchr(s, '@')); s++) { + for (s++; *s && *s != '='; s++) { + if (*s == '#') { + *s = '='; + break; + } + } + } + } +#endif + } + return mods; +} + +typedef struct _XLCdListRec { + struct _XLCdListRec *next; + XLCd lcd; + int ref_count; +} XLCdListRec, *XLCdList; + +static XLCdList lcd_list = NULL; + +typedef struct _XlcLoaderListRec { + struct _XlcLoaderListRec *next; + XLCdLoadProc proc; +} XlcLoaderListRec, *XlcLoaderList; + +static XlcLoaderList loader_list = NULL; + +void +_XlcRemoveLoader( + XLCdLoadProc proc) +{ + XlcLoaderList loader, prev; + + if (loader_list == NULL) + return; + + prev = loader = loader_list; + if (loader->proc == proc) { + loader_list = loader->next; + Xfree(loader); + return; + } + + while ((loader = loader->next)) { + if (loader->proc == proc) { + prev->next = loader->next; + Xfree(loader); + return; + } + prev = loader; + } + + return; +} + +Bool +_XlcAddLoader( + XLCdLoadProc proc, + XlcPosition position) +{ + XlcLoaderList loader, last; + + _XlcRemoveLoader(proc); /* remove old loader, if exist */ + + loader = Xmalloc(sizeof(XlcLoaderListRec)); + if (loader == NULL) + return False; + + loader->proc = proc; + + if (loader_list == NULL) + position = XlcHead; + + if (position == XlcHead) { + loader->next = loader_list; + loader_list = loader; + } else { + last = loader_list; + while (last->next) + last = last->next; + + loader->next = NULL; + last->next = loader; + } + + return True; +} + +XLCd +_XOpenLC( + char *name) +{ + XLCd lcd; + XlcLoaderList loader; + XLCdList cur; +#if !defined(X_LOCALE) + int len; + char sinamebuf[256]; + char* siname = sinamebuf; +#endif + + 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 + */ + if ((len = strlen(name)) >= sizeof sinamebuf) { + siname = Xmalloc (len + 1); + if (siname == NULL) + return NULL; + } + name = _XlcMapOSLocaleName(name, siname); +#endif + } + + _XLockMutex(_Xi18n_lock); + + /* + * search for needed lcd, if found return it + */ + for (cur = lcd_list; cur; cur = cur->next) { + if (!strcmp (cur->lcd->core->name, name)) { + lcd = cur->lcd; + cur->ref_count++; + goto found; + } + } + + if (!loader_list) + _XlcInitLoader(); + + /* + * not there, so try to get and add to list + */ + for (loader = loader_list; loader; loader = loader->next) { + lcd = (*loader->proc)(name); + if (lcd) { + cur = Xmalloc (sizeof(XLCdListRec)); + if (cur) { + cur->lcd = lcd; + cur->ref_count = 1; + cur->next = lcd_list; + lcd_list = cur; + } else { + (*lcd->methods->close)(lcd); + lcd = (XLCd) NULL; + } + goto found; + } + } + + lcd = NULL; + +found: + _XUnlockMutex(_Xi18n_lock); + +#if !defined(X_LOCALE) + if (siname != sinamebuf) Xfree(siname); +#endif + + return lcd; +} + +void +_XCloseLC( + XLCd lcd) +{ + XLCdList cur, *prev; + + for (prev = &lcd_list; (cur = *prev); prev = &cur->next) { + if (cur->lcd == lcd) { + if (--cur->ref_count < 1) { + (*lcd->methods->close)(lcd); + *prev = cur->next; + Xfree(cur); + } + break; + } + } + + if(loader_list) { + _XlcDeInitLoader(); + loader_list = NULL; + } +} + +/* + * Get the XLCd for the current locale + */ + +XLCd +_XlcCurrentLC(void) +{ + XLCd lcd; + static XLCd last_lcd = NULL; + + lcd = _XOpenLC((char *) NULL); + + if (last_lcd) + _XCloseLC(last_lcd); + + last_lcd = lcd; + + return lcd; +} + +XrmMethods +_XrmInitParseInfo( + XPointer *state) +{ + XLCd lcd = _XOpenLC((char *) NULL); + + if (lcd == (XLCd) NULL) + return (XrmMethods) NULL; + + return (*lcd->methods->init_parse_info)(lcd, state); +} + +int +XmbTextPropertyToTextList( + Display *dpy, + const XTextProperty *text_prop, + char ***list_ret, + int *count_ret) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return XLocaleNotSupported; + + return (*lcd->methods->mb_text_prop_to_list)(lcd, dpy, text_prop, list_ret, + count_ret); +} + +int +XwcTextPropertyToTextList( + Display *dpy, + const XTextProperty *text_prop, + wchar_t ***list_ret, + int *count_ret) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return XLocaleNotSupported; + + return (*lcd->methods->wc_text_prop_to_list)(lcd, dpy, text_prop, list_ret, + count_ret); +} + +int +Xutf8TextPropertyToTextList( + Display *dpy, + const XTextProperty *text_prop, + char ***list_ret, + int *count_ret) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return XLocaleNotSupported; + + return (*lcd->methods->utf8_text_prop_to_list)(lcd, dpy, text_prop, + list_ret, count_ret); +} + +int +XmbTextListToTextProperty( + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return XLocaleNotSupported; + + return (*lcd->methods->mb_text_list_to_prop)(lcd, dpy, list, count, style, + text_prop); +} + +int +XwcTextListToTextProperty( + Display *dpy, + wchar_t **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return XLocaleNotSupported; + + return (*lcd->methods->wc_text_list_to_prop)(lcd, dpy, list, count, style, + text_prop); +} + +int +Xutf8TextListToTextProperty( + Display *dpy, + char **list, + int count, + XICCEncodingStyle style, + XTextProperty *text_prop) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return XLocaleNotSupported; + + return (*lcd->methods->utf8_text_list_to_prop)(lcd, dpy, list, count, + style, text_prop); +} + +void +XwcFreeStringList( + wchar_t **list) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return; + + (*lcd->methods->wc_free_string_list)(lcd, list); +} + +const char * +XDefaultString(void) +{ + XLCd lcd = _XlcCurrentLC(); + + if (lcd == NULL) + return (char *) NULL; + + return (*lcd->methods->default_string)(lcd); +} + +void +_XlcCopyFromArg( + char *src, + char *dst, + int size) +{ + if (size == sizeof(long)) + *((long *) dst) = (long) src; +#ifdef LONG64 + else if (size == sizeof(int)) + *((int *) dst) = (int)(long) src; +#endif + else if (size == sizeof(short)) + *((short *) dst) = (short)(long) src; + else if (size == sizeof(char)) + *((char *) dst) = (char)(long) src; + else if (size == sizeof(XPointer)) + *((XPointer *) dst) = (XPointer) src; + else if (size > sizeof(XPointer)) + memcpy(dst, (char *) src, size); + else + memcpy(dst, (char *) &src, size); +} + +void +_XlcCopyToArg( + char *src, + char **dst, + int size) +{ + /* FIXME: + On Big Endian machines, this behaves differently than _XCopyToArg. */ + if (size == sizeof(long)) + *((long *) *dst) = *((long *) src); +#ifdef LONG64 + else if (size == sizeof(int)) + *((int *) *dst) = *((int *) src); +#endif + else if (size == sizeof(short)) + *((short *) *dst) = *((short *) src); + else if (size == sizeof(char)) + *((char *) *dst) = *((char *) src); + else if (size == sizeof(XPointer)) + *((XPointer *) *dst) = *((XPointer *) src); + else + memcpy(*dst, src, size); +} + +void +_XlcCountVaList( + va_list var, + int *count_ret) +{ + int count; + + for (count = 0; va_arg(var, char *); count++) + (void)va_arg(var, XPointer); + + *count_ret = count; +} + +void +_XlcVaToArgList( + va_list var, + int count, + XlcArgList *args_ret) +{ + XlcArgList args; + + *args_ret = args = 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); + } +} + +void +_XlcCompileResourceList( + XlcResourceList resources, + int num_resources) +{ + for ( ; num_resources-- > 0; resources++) + resources->xrm_name = XrmPermStringToQuark(resources->name); +} + +char * +_XlcGetValues( + XPointer base, + XlcResourceList resources, + int num_resources, + XlcArgList args, + int num_args, + unsigned long mask) +{ + XlcResourceList res; + XrmQuark xrm_name; + int count; + + for ( ; num_args-- > 0; args++) { + res = resources; + count = num_resources; + xrm_name = XrmPermStringToQuark(args->name); + + for ( ; count-- > 0; res++) { + if (xrm_name == res->xrm_name && (mask & res->mask)) { + _XlcCopyToArg(base + res->offset, &args->value, res->size); + break; + } + } + + if (count < 0) + return args->name; + } + + return NULL; +} + +char * +_XlcSetValues( + XPointer base, + XlcResourceList resources, + int num_resources, + XlcArgList args, + int num_args, + unsigned long mask) +{ + XlcResourceList res; + XrmQuark xrm_name; + int count; + + for ( ; num_args-- > 0; args++) { + res = resources; + count = num_resources; + xrm_name = XrmPermStringToQuark(args->name); + + for ( ; count-- > 0; res++) { + if (xrm_name == res->xrm_name && (mask & res->mask)) { + _XlcCopyFromArg(args->value, base + res->offset, res->size); + break; + } + } + + if (count < 0) + return args->name; + } + + return NULL; +} diff --git a/nx-X11/lib/src/xlibi18n/mbWMProps.c b/nx-X11/lib/src/xlibi18n/mbWMProps.c new file mode 100644 index 000000000..9fb57faca --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/mbWMProps.c @@ -0,0 +1,69 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include + +void +XmbSetWMProperties ( + Display *dpy, + Window w, + _Xconst char *windowName, + _Xconst char *iconName, + char **argv, + int argc, + XSizeHints *sizeHints, + XWMHints *wmHints, + XClassHint *classHints) +{ + XTextProperty wname, iname; + XTextProperty *wprop = NULL; + XTextProperty *iprop = NULL; + + if (windowName && + XmbTextListToTextProperty(dpy, (char**)&windowName, 1, + XStdICCTextStyle, &wname) >= Success) + wprop = &wname; + if (iconName && + XmbTextListToTextProperty(dpy, (char**)&iconName, 1, + XStdICCTextStyle, &iname) >= Success) + iprop = &iname; + XSetWMProperties(dpy, w, wprop, iprop, argv, argc, + sizeHints, wmHints, classHints); + if (wprop) + Xfree(wname.value); + if (iprop) + Xfree(iname.value); + + /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ +} diff --git a/nx-X11/lib/src/xlibi18n/mbWrap.c b/nx-X11/lib/src/xlibi18n/mbWrap.c new file mode 100644 index 000000000..766b8da01 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/mbWrap.c @@ -0,0 +1,161 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* + * Copyright 1991 by the Open Software Foundation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 + * 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 + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * 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 + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +void +XmbDrawText( + Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XmbTextItem *text_items, + int nitems) +{ + register XFontSet fs = NULL; + register XmbTextItem *p = text_items; + register int i = nitems; + register int esc; + + /* ignore leading items with no fontset */ + while (i && !p->font_set) { + i--; + p++; + } + + for (; --i >= 0; p++) { + if (p->font_set) + fs = p->font_set; + x += p->delta; + esc = (*fs->methods->mb_draw_string) (dpy, d, fs, gc, x, y, + p->chars, p->nchars); + if (!esc) + esc = fs->methods->mb_escapement (fs, p->chars, p->nchars); + x += esc; + } +} + +void +XmbDrawString( + Display *dpy, + Drawable d, + XFontSet font_set, + GC gc, + int x, + int y, + _Xconst char *text, + int text_len) +{ + (void)(*font_set->methods->mb_draw_string) (dpy, d, font_set, gc, x, y, + text, text_len); +} + + +void +XmbDrawImageString( + Display *dpy, + Drawable d, + XFontSet font_set, + GC gc, + int x, + int y, + _Xconst char *text, + int text_len) +{ + (*font_set->methods->mb_draw_image_string) (dpy, d, font_set, gc, x, y, + text, text_len); +} + +int +XmbTextEscapement( + XFontSet font_set, + _Xconst char *text, + int text_len) +{ + return (*font_set->methods->mb_escapement) (font_set, text, text_len); +} + +int +XmbTextExtents( + XFontSet font_set, + _Xconst char *text, + int text_len, + XRectangle *overall_ink_extents, + XRectangle *overall_logical_extents) +{ + return (*font_set->methods->mb_extents) (font_set, text, text_len, + overall_ink_extents, + overall_logical_extents); +} + +Status +XmbTextPerCharExtents( + XFontSet font_set, + _Xconst char *text, + int text_len, + XRectangle *ink_extents_buffer, + XRectangle *logical_extents_buffer, + int buffer_size, + int *num_chars, + XRectangle *max_ink_extents, + XRectangle *max_logical_extents) +{ + return (*font_set->methods->mb_extents_per_char) + (font_set, text, text_len, + ink_extents_buffer, logical_extents_buffer, + buffer_size, num_chars, max_ink_extents, max_logical_extents); +} diff --git a/nx-X11/lib/src/xlibi18n/utf8WMProps.c b/nx-X11/lib/src/xlibi18n/utf8WMProps.c new file mode 100644 index 000000000..09d643377 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/utf8WMProps.c @@ -0,0 +1,91 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* + * Copyright 2000 by Bruno Haible + * + * Permission to use, copy, modify, distribute, and sell this software + * and its 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 Bruno Haible not + * be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Bruno Haible + * makes no representations about the suitability of this software for + * any purpose. It is provided "as is" without express or implied + * warranty. + * + * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL Bruno Haible 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include +#include +#include +#include + +void +Xutf8SetWMProperties ( + Display *dpy, + Window w, + _Xconst char *windowName, + _Xconst char *iconName, + char **argv, + int argc, + XSizeHints *sizeHints, + XWMHints *wmHints, + XClassHint *classHints) +{ + XTextProperty wname, iname; + XTextProperty *wprop = NULL; + XTextProperty *iprop = NULL; + + if (windowName && + Xutf8TextListToTextProperty(dpy, (char**)&windowName, 1, + XStdICCTextStyle, &wname) >= Success) + wprop = &wname; + if (iconName && + Xutf8TextListToTextProperty(dpy, (char**)&iconName, 1, + XStdICCTextStyle, &iname) >= Success) + iprop = &iname; + XSetWMProperties(dpy, w, wprop, iprop, argv, argc, + sizeHints, wmHints, classHints); + if (wprop) + Xfree(wname.value); + if (iprop) + Xfree(iname.value); + + /* Note: The WM_LOCALE_NAME property is set by XSetWMProperties. */ +} diff --git a/nx-X11/lib/src/xlibi18n/utf8Wrap.c b/nx-X11/lib/src/xlibi18n/utf8Wrap.c new file mode 100644 index 000000000..24cb4494c --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/utf8Wrap.c @@ -0,0 +1,183 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ +/* + * Copyright 1991 by the Open Software Foundation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 + * 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 + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * 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 + * 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 + */ +/* + * Copyright 2000 by Bruno Haible + * + * Permission to use, copy, modify, distribute, and sell this software + * and its 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 Bruno Haible not + * be used in advertising or publicity pertaining to distribution of the + * software without specific, written prior permission. Bruno Haible + * makes no representations about the suitability of this software for + * any purpose. It is provided "as is" without express or implied + * warranty. + * + * Bruno Haible DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN + * NO EVENT SHALL Bruno Haible 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. + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +void +Xutf8DrawText( + Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XmbTextItem *text_items, + int nitems) +{ + register XFontSet fs = NULL; + register XmbTextItem *p = text_items; + register int i = nitems; + register int esc; + + /* ignore leading items with no fontset */ + while (i && !p->font_set) { + i--; + p++; + } + + for (; --i >= 0; p++) { + if (p->font_set) + fs = p->font_set; + x += p->delta; + esc = (*fs->methods->utf8_draw_string) (dpy, d, fs, gc, x, y, + p->chars, p->nchars); + if (!esc) + esc = fs->methods->utf8_escapement (fs, p->chars, p->nchars); + x += esc; + } +} + +void +Xutf8DrawString( + Display *dpy, + Drawable d, + XFontSet font_set, + GC gc, + int x, + int y, + _Xconst char *text, + int text_len) +{ + (void)(*font_set->methods->utf8_draw_string) (dpy, d, font_set, gc, x, y, + text, text_len); +} + + +void +Xutf8DrawImageString( + Display *dpy, + Drawable d, + XFontSet font_set, + GC gc, + int x, + int y, + _Xconst char *text, + int text_len) +{ + (*font_set->methods->utf8_draw_image_string) (dpy, d, font_set, gc, x, y, + text, text_len); +} + +int +Xutf8TextEscapement( + XFontSet font_set, + _Xconst char *text, + int text_len) +{ + return (*font_set->methods->utf8_escapement) (font_set, text, text_len); +} + +int +Xutf8TextExtents( + XFontSet font_set, + _Xconst char *text, + int text_len, + XRectangle *overall_ink_extents, + XRectangle *overall_logical_extents) +{ + return (*font_set->methods->utf8_extents) (font_set, text, text_len, + overall_ink_extents, + overall_logical_extents); +} + +Status +Xutf8TextPerCharExtents( + XFontSet font_set, + _Xconst char *text, + int text_len, + XRectangle *ink_extents_buffer, + XRectangle *logical_extents_buffer, + int buffer_size, + int *num_chars, + XRectangle *max_ink_extents, + XRectangle *max_logical_extents) +{ + return (*font_set->methods->utf8_extents_per_char) + (font_set, text, text_len, + ink_extents_buffer, logical_extents_buffer, + buffer_size, num_chars, max_ink_extents, max_logical_extents); +} diff --git a/nx-X11/lib/src/xlibi18n/wcWrap.c b/nx-X11/lib/src/xlibi18n/wcWrap.c new file mode 100644 index 000000000..cc3b33f7d --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/wcWrap.c @@ -0,0 +1,161 @@ +/* + +Copyright 1991, 1998 The Open Group + +Permission to use, copy, modify, distribute, and sell this software and its +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. + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR +OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, +ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR +OTHER DEALINGS IN THE SOFTWARE. + +Except as contained in this notice, the name of The Open Group shall +not be used in advertising or otherwise to promote the sale, use or +other dealings in this Software without prior written authorization +from The Open Group. + +*/ + +/* + * Copyright 1991 by the Open Software Foundation + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 + * 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 + * software for any purpose. It is provided "as is" without express or + * implied warranty. + * + * 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 + * 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 + */ + +#ifdef HAVE_CONFIG_H +#include +#endif +#include "Xlibint.h" +#include "Xlcint.h" + +void +XwcDrawText( + Display *dpy, + Drawable d, + GC gc, + int x, + int y, + XwcTextItem *text_items, + int nitems) +{ + register XFontSet fs = NULL; + register XwcTextItem *p = text_items; + register int i = nitems; + register int esc; + + /* ignore leading items with no fontset */ + while (i && !p->font_set) { + i--; + p++; + } + + for (; --i >= 0; p++) { + if (p->font_set) + fs = p->font_set; + x += p->delta; + esc = (*fs->methods->wc_draw_string) (dpy, d, fs, gc, x, y, + p->chars, p->nchars); + if (!esc) + esc = fs->methods->wc_escapement (fs, p->chars, p->nchars); + x += esc; + } +} + +void +XwcDrawString( + Display *dpy, + Drawable d, + XFontSet font_set, + GC gc, + int x, + int y, + _Xconst wchar_t *text, + int text_len) +{ + (void)(*font_set->methods->wc_draw_string) (dpy, d, font_set, gc, x, y, + text, text_len); +} + +void +XwcDrawImageString( + Display *dpy, + Drawable d, + XFontSet font_set, + GC gc, + int x, + int y, + _Xconst wchar_t *text, + int text_len) +{ + (*font_set->methods->wc_draw_image_string) (dpy, d, font_set, gc, x, y, + text, text_len); +} + +int +XwcTextEscapement( + XFontSet font_set, + _Xconst wchar_t *text, + int text_len) +{ + return (*font_set->methods->wc_escapement) (font_set, text, text_len); +} + +int +XwcTextExtents( + XFontSet font_set, + _Xconst wchar_t *text, + int text_len, + XRectangle *overall_ink_extents, + XRectangle *overall_logical_extents) +{ + return (*font_set->methods->wc_extents) (font_set, text, text_len, + overall_ink_extents, + overall_logical_extents); +} + +Status +XwcTextPerCharExtents( + XFontSet font_set, + _Xconst wchar_t *text, + int text_len, + XRectangle *ink_extents_buffer, + XRectangle *logical_extents_buffer, + int buffer_size, + int *num_chars, + XRectangle *max_ink_extents, + XRectangle *max_logical_extents) +{ + 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); +} diff --git a/nx-X11/lib/src/xlibi18n/xim_trans.c b/nx-X11/lib/src/xlibi18n/xim_trans.c new file mode 100644 index 000000000..928038ae2 --- /dev/null +++ b/nx-X11/lib/src/xlibi18n/xim_trans.c @@ -0,0 +1,30 @@ +/* + * Copyright © 2003 Keith Packard + * + * Permission to use, copy, modify, distribute, and sell this software and its + * 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 Keith Packard not be used in + * advertising or publicity pertaining to distribution of the software without + * specific, written prior permission. Keith Packard makes no + * representations about the suitability of this software for any purpose. It + * is provided "as is" without express or implied warranty. + * + * KEITH PACKARD DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, + * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO + * EVENT SHALL KEITH PACKARD 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. + */ + +#ifdef HAVE_CONFIG_H +# include "config.h" +#endif + +#define XIM_t 1 +#define TRANS_CLIENT 1 + +#include diff --git a/nx-X11/lib/xtrans/Imakefile b/nx-X11/lib/xtrans/Imakefile deleted file mode 100644 index 70716bb90..000000000 --- a/nx-X11/lib/xtrans/Imakefile +++ /dev/null @@ -1,19 +0,0 @@ -#define IncSubdir nx-X11 - -all:: - -DEFINES = $(FAILDEFINES) - -# Since xtrans source is #include'd into software that uses it, we install -# the .c files as if they were headers. -HEADERS = \ - Xtrans.h \ - Xtrans.c \ - Xtransint.h \ - Xtranslcl.c \ - Xtranssock.c \ - Xtransutil.c \ - transport.c - -DependTarget() -BuildIncludes($(HEADERS),IncSubdir/Xtrans,../..) diff --git a/nx-X11/lib/xtrans/Xtrans.c b/nx-X11/lib/xtrans/Xtrans.c deleted file mode 100644 index 328a970b1..000000000 --- a/nx-X11/lib/xtrans/Xtrans.c +++ /dev/null @@ -1,1367 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -#include -#include -#include -#ifdef HAVE_SYSTEMD_DAEMON -#include -#endif - -/* - * The transport table contains a definition for every transport (protocol) - * family. All operations that can be made on the transport go through this - * table. - * - * Each transport is assigned a unique transport id. - * - * New transports can be added by adding an entry in this table. - * For compatiblity, the transport ids should never be renumbered. - * Always add to the end of the list. - */ - -#define TRANS_TLI_INET_INDEX 1 -#define TRANS_TLI_TCP_INDEX 2 -#define TRANS_TLI_TLI_INDEX 3 -#define TRANS_SOCKET_UNIX_INDEX 4 -#define TRANS_SOCKET_LOCAL_INDEX 5 -#define TRANS_SOCKET_INET_INDEX 6 -#define TRANS_SOCKET_TCP_INDEX 7 -#define TRANS_DNET_INDEX 8 -#define TRANS_LOCAL_LOCAL_INDEX 9 -#define TRANS_LOCAL_PTS_INDEX 10 -#define TRANS_LOCAL_NAMED_INDEX 11 -/* 12 used to be ISC, but that's gone. */ -#define TRANS_LOCAL_SCO_INDEX 13 -#define TRANS_SOCKET_INET6_INDEX 14 -#define TRANS_LOCAL_PIPE_INDEX 15 - - -static -Xtransport_table Xtransports[] = { -#if defined(TCPCONN) - { &TRANS(SocketTCPFuncs), TRANS_SOCKET_TCP_INDEX }, -#if defined(IPv6) && defined(AF_INET6) - { &TRANS(SocketINET6Funcs), TRANS_SOCKET_INET6_INDEX }, -#endif /* IPv6 */ - { &TRANS(SocketINETFuncs), TRANS_SOCKET_INET_INDEX }, -#endif /* TCPCONN */ -#if defined(UNIXCONN) -#if !defined(LOCALCONN) - { &TRANS(SocketLocalFuncs), TRANS_SOCKET_LOCAL_INDEX }, -#endif /* !LOCALCONN */ - { &TRANS(SocketUNIXFuncs), TRANS_SOCKET_UNIX_INDEX }, -#endif /* UNIXCONN */ -#if defined(LOCALCONN) - { &TRANS(LocalFuncs), TRANS_LOCAL_LOCAL_INDEX }, -#ifndef __sun - { &TRANS(PTSFuncs), TRANS_LOCAL_PTS_INDEX }, -#endif /* __sun */ -#if defined(SVR4) || defined(__SVR4) - { &TRANS(NAMEDFuncs), TRANS_LOCAL_NAMED_INDEX }, -#endif -#ifdef __sun - { &TRANS(PIPEFuncs), TRANS_LOCAL_PIPE_INDEX }, -#endif /* __sun */ -#if defined(__SCO__) || defined(__UNIXWARE__) - { &TRANS(SCOFuncs), TRANS_LOCAL_SCO_INDEX }, -#endif /* __SCO__ || __UNIXWARE__ */ -#endif /* LOCALCONN */ -}; - -#define NUMTRANS (sizeof(Xtransports)/sizeof(Xtransport_table)) - - -#ifdef WIN32 -#define ioctl ioctlsocket -#endif - - - -/* - * These are a few utility function used by the public interface functions. - */ - -void -TRANS(FreeConnInfo) (XtransConnInfo ciptr) - -{ - prmsg (3,"FreeConnInfo(%p)\n", (void *) ciptr); - - if (ciptr->addr) - free (ciptr->addr); - - if (ciptr->peeraddr) - free (ciptr->peeraddr); - - if (ciptr->port) - free (ciptr->port); - - free (ciptr); -} - - -#define PROTOBUFSIZE 20 - -static Xtransport * -TRANS(SelectTransport) (const char *protocol) - -{ - char protobuf[PROTOBUFSIZE]; - int i; - - prmsg (3,"SelectTransport(%s)\n", protocol); - - /* - * Force Protocol to be lowercase as a way of doing - * a case insensitive match. - */ - - strncpy (protobuf, protocol, PROTOBUFSIZE - 1); - protobuf[PROTOBUFSIZE-1] = '\0'; - - for (i = 0; i < PROTOBUFSIZE && protobuf[i] != '\0'; i++) - if (isupper ((unsigned char)protobuf[i])) - protobuf[i] = tolower ((unsigned char)protobuf[i]); - - /* Look at all of the configured protocols */ - - for (i = 0; i < NUMTRANS; i++) - { - if (!strcmp (protobuf, Xtransports[i].transport->TransName)) - return Xtransports[i].transport; - } - - return NULL; -} - -#ifndef TEST_t -static -#endif /* TEST_t */ -int -TRANS(ParseAddress) (const char *address, - char **protocol, char **host, char **port) - -{ - /* - * For the font library, the address is a string formatted - * as "protocol/host:port[/catalogue]". Note that the catologue - * is optional. At this time, the catologue info is ignored, but - * we have to parse it anyways. - * - * Other than fontlib, the address is a string formatted - * as "protocol/host:port". - * - * If the protocol part is missing, then assume TCP. - * If the protocol part and host part are missing, then assume local. - * If a "::" is found then assume DNET. - */ - - char *mybuf, *tmpptr; - const char *_protocol; - char *_host, *_port; - char hostnamebuf[256]; - int _host_len; - - prmsg (3,"ParseAddress(%s)\n", address); - - /* Copy the string so it can be changed */ - - tmpptr = mybuf = strdup (address); - - /* Parse the string to get each component */ - - /* Get the protocol part */ - - _protocol = mybuf; - - - if ( ((mybuf = strchr (mybuf,'/')) == NULL) && - ((mybuf = strrchr (tmpptr,':')) == NULL) ) - { - /* address is in a bad format */ - *protocol = NULL; - *host = NULL; - *port = NULL; - free (tmpptr); - return 0; - } - - if (*mybuf == ':') - { - /* - * If there is a hostname, then assume tcp, otherwise - * it must be local. - */ - if (mybuf == tmpptr) - { - /* There is neither a protocol or host specified */ - _protocol = "local"; - } - else - { - /* There is a hostname specified */ - _protocol = "tcp"; - mybuf = tmpptr; /* reset to the begining of the host ptr */ - } - } - else - { - /* *mybuf == '/' */ - - *mybuf ++= '\0'; /* put a null at the end of the protocol */ - - if (strlen(_protocol) == 0) - { - /* - * If there is a hostname, then assume tcp, otherwise - * it must be local. - */ - if (*mybuf != ':') - _protocol = "tcp"; - else - _protocol = "local"; - } - } - - /* Get the host part */ - - _host = mybuf; - - if ((mybuf = strrchr (mybuf,':')) == NULL) - { - *protocol = NULL; - *host = NULL; - *port = NULL; - free (tmpptr); - return 0; - } - - *mybuf ++= '\0'; - - _host_len = strlen(_host); - if (_host_len == 0) - { - TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); - _host = hostnamebuf; - } -#if defined(IPv6) && defined(AF_INET6) - /* hostname in IPv6 [numeric_addr]:0 form? */ - else if ( (_host_len > 3) && - ((strcmp(_protocol, "tcp") == 0) || (strcmp(_protocol, "inet6") == 0)) - && (*_host == '[') && (*(_host + _host_len - 1) == ']') ) { - struct sockaddr_in6 sin6; - - *(_host + _host_len - 1) = '\0'; - - /* Verify address is valid IPv6 numeric form */ - if (inet_pton(AF_INET6, _host + 1, &sin6) == 1) { - /* It is. Use it as such. */ - _host++; - _protocol = "inet6"; - } else { - /* It's not, restore it just in case some other code can use it. */ - *(_host + _host_len - 1) = ']'; - } - } -#endif - - - /* Get the port */ - - _port = mybuf; - -#if defined(FONT_t) || defined(FS_t) - /* - * Is there an optional catalogue list? - */ - - if ((mybuf = strchr (mybuf,'/')) != NULL) - *mybuf ++= '\0'; - - /* - * The rest, if any, is the (currently unused) catalogue list. - * - * _catalogue = mybuf; - */ -#endif - -#ifdef HAVE_LAUNCHD - /* launchd sockets will look like 'local//tmp/launch-XgkNns/:0' */ - if(address != NULL && strlen(address)>8 && (!strncmp(address,"local//",7))) { - _protocol="local"; - _host=""; - _port=address+6; - } -#endif - - /* - * Now that we have all of the components, allocate new - * string space for them. - */ - - if ((*protocol = strdup (_protocol)) == NULL) - { - /* Malloc failed */ - *port = NULL; - *host = NULL; - *protocol = NULL; - free (tmpptr); - return 0; - } - - if ((*host = strdup (_host)) == NULL) - { - /* Malloc failed */ - *port = NULL; - *host = NULL; - free (*protocol); - *protocol = NULL; - free (tmpptr); - return 0; - } - - if ((*port = strdup (_port)) == NULL) - { - /* Malloc failed */ - *port = NULL; - free (*host); - *host = NULL; - free (*protocol); - *protocol = NULL; - free (tmpptr); - return 0; - } - - free (tmpptr); - - return 1; -} - - -/* - * TRANS(Open) does all of the real work opening a connection. The only - * funny part about this is the type parameter which is used to decide which - * type of open to perform. - */ - -static XtransConnInfo -TRANS(Open) (int type, const char *address) - -{ - char *protocol = NULL, *host = NULL, *port = NULL; - XtransConnInfo ciptr = NULL; - Xtransport *thistrans; - - prmsg (2,"Open(%d,%s)\n", type, address); - -#if defined(WIN32) && defined(TCPCONN) - if (TRANS(WSAStartup)()) - { - prmsg (1,"Open: WSAStartup failed\n"); - return NULL; - } -#endif - - /* Parse the Address */ - - if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) - { - prmsg (1,"Open: Unable to Parse address %s\n", address); - return NULL; - } - - /* Determine the transport type */ - - if ((thistrans = TRANS(SelectTransport) (protocol)) == NULL) - { - prmsg (1,"Open: Unable to find transport for %s\n", - protocol); - - free (protocol); - free (host); - free (port); - return NULL; - } - - /* Open the transport */ - - switch (type) - { - case XTRANS_OPEN_COTS_CLIENT: -#ifdef TRANS_CLIENT - ciptr = thistrans->OpenCOTSClient(thistrans, protocol, host, port); -#endif /* TRANS_CLIENT */ - break; - case XTRANS_OPEN_COTS_SERVER: -#ifdef TRANS_SERVER - ciptr = thistrans->OpenCOTSServer(thistrans, protocol, host, port); -#endif /* TRANS_SERVER */ - break; - default: - prmsg (1,"Open: Unknown Open type %d\n", type); - } - - if (ciptr == NULL) - { - if (!(thistrans->flags & TRANS_DISABLED)) - { - prmsg (1,"Open: transport open failed for %s/%s:%s\n", - protocol, host, port); - } - free (protocol); - free (host); - free (port); - return NULL; - } - - ciptr->transptr = thistrans; - ciptr->port = port; /* We need this for TRANS(Reopen) */ - - free (protocol); - free (host); - - return ciptr; -} - - -#ifdef TRANS_REOPEN - -/* - * We might want to create an XtransConnInfo object based on a previously - * opened connection. For example, the font server may clone itself and - * pass file descriptors to the parent. - */ - -static XtransConnInfo -TRANS(Reopen) (int type, int trans_id, int fd, const char *port) - -{ - XtransConnInfo ciptr = NULL; - Xtransport *thistrans = NULL; - char *save_port; - int i; - - prmsg (2,"Reopen(%d,%d,%s)\n", trans_id, fd, port); - - /* Determine the transport type */ - - for (i = 0; i < NUMTRANS; i++) - if (Xtransports[i].transport_id == trans_id) - { - thistrans = Xtransports[i].transport; - break; - } - - if (thistrans == NULL) - { - prmsg (1,"Reopen: Unable to find transport id %d\n", - trans_id); - - return NULL; - } - - if ((save_port = strdup (port)) == NULL) - { - prmsg (1,"Reopen: Unable to malloc port string\n"); - - return NULL; - } - - /* Get a new XtransConnInfo object */ - - switch (type) - { - case XTRANS_OPEN_COTS_SERVER: - ciptr = thistrans->ReopenCOTSServer(thistrans, fd, port); - break; - default: - prmsg (1,"Reopen: Bad Open type %d\n", type); - } - - if (ciptr == NULL) - { - prmsg (1,"Reopen: transport open failed\n"); - free (save_port); - return NULL; - } - - ciptr->transptr = thistrans; - ciptr->port = save_port; - - return ciptr; -} - -#endif /* TRANS_REOPEN */ - - - -/* - * These are the public interfaces to this Transport interface. - * These are the only functions that should have knowledge of the transport - * table. - */ - -#ifdef TRANS_CLIENT - -XtransConnInfo -TRANS(OpenCOTSClient) (const char *address) - -{ - prmsg (2,"OpenCOTSClient(%s)\n", address); - return TRANS(Open) (XTRANS_OPEN_COTS_CLIENT, address); -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -XtransConnInfo -TRANS(OpenCOTSServer) (const char *address) - -{ - prmsg (2,"OpenCOTSServer(%s)\n", address); - return TRANS(Open) (XTRANS_OPEN_COTS_SERVER, address); -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -XtransConnInfo -TRANS(ReopenCOTSServer) (int trans_id, int fd, const char *port) - -{ - prmsg (2,"ReopenCOTSServer(%d, %d, %s)\n", trans_id, fd, port); - return TRANS(Reopen) (XTRANS_OPEN_COTS_SERVER, trans_id, fd, port); -} - -int -TRANS(GetReopenInfo) (XtransConnInfo ciptr, - int *trans_id, int *fd, char **port) - -{ - int i; - - for (i = 0; i < NUMTRANS; i++) - if (Xtransports[i].transport == ciptr->transptr) - { - *trans_id = Xtransports[i].transport_id; - *fd = ciptr->fd; - - if ((*port = strdup (ciptr->port)) == NULL) - return 0; - else - return 1; - } - - return 0; -} - -#endif /* TRANS_REOPEN */ - - -int -TRANS(SetOption) (XtransConnInfo ciptr, int option, int arg) - -{ - int fd = ciptr->fd; - int ret = 0; - - prmsg (2,"SetOption(%d,%d,%d)\n", fd, option, arg); - - /* - * For now, all transport type use the same stuff for setting options. - * As long as this is true, we can put the common code here. Once a more - * complicated transport such as shared memory or an OSI implementation - * that uses the session and application libraries is implemented, this - * code may have to move to a transport dependent function. - * - * ret = ciptr->transptr->SetOption (ciptr, option, arg); - */ - - switch (option) - { - case TRANS_NONBLOCKING: - switch (arg) - { - case 0: - /* Set to blocking mode */ - break; - case 1: /* Set to non-blocking mode */ - -#if defined(O_NONBLOCK) && !defined(SCO325) - ret = fcntl (fd, F_GETFL, 0); - if (ret != -1) - ret = fcntl (fd, F_SETFL, ret | O_NONBLOCK); -#else -#ifdef FIOSNBIO - { - int arg; - arg = 1; - ret = ioctl (fd, FIOSNBIO, &arg); - } -#else -#if defined(WIN32) - { -#ifdef WIN32 - u_long arg; -#else - int arg; -#endif - arg = 1; -/* IBM TCP/IP understands this option too well: it causes TRANS(Read) to fail - * eventually with EWOULDBLOCK */ - ret = ioctl (fd, FIONBIO, &arg); - } -#else - ret = fcntl (fd, F_GETFL, 0); -#ifdef FNDELAY - ret = fcntl (fd, F_SETFL, ret | FNDELAY); -#else - ret = fcntl (fd, F_SETFL, ret | O_NDELAY); -#endif -#endif /* WIN32 */ -#endif /* FIOSNBIO */ -#endif /* O_NONBLOCK */ - break; - default: - /* Unknown option */ - break; - } - break; - case TRANS_CLOSEONEXEC: -#ifdef F_SETFD -#ifdef FD_CLOEXEC - ret = fcntl (fd, F_SETFD, FD_CLOEXEC); -#else - ret = fcntl (fd, F_SETFD, 1); -#endif /* FD_CLOEXEC */ -#endif /* F_SETFD */ - break; - } - - return ret; -} - -#ifdef TRANS_SERVER - -int -TRANS(CreateListener) (XtransConnInfo ciptr, const char *port, unsigned int flags) - -{ - return ciptr->transptr->CreateListener (ciptr, port, flags); -} - -int -TRANS(Received) (const char * protocol) - -{ - Xtransport *trans; - int i = 0, ret = 0; - - prmsg (5, "Received(%s)\n", protocol); - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"Received: unable to find transport: %s\n", - protocol); - - return -1; - } - if (trans->flags & TRANS_ALIAS) { - if (trans->nolisten) - while (trans->nolisten[i]) { - ret |= TRANS(Received)(trans->nolisten[i]); - i++; - } - } - - trans->flags |= TRANS_RECEIVED; - return ret; -} - -int -TRANS(NoListen) (const char * protocol) - -{ - Xtransport *trans; - int i = 0, ret = 0; - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"TransNoListen: unable to find transport: %s\n", - protocol); - - return -1; - } - if (trans->flags & TRANS_ALIAS) { - if (trans->nolisten) - while (trans->nolisten[i]) { - ret |= TRANS(NoListen)(trans->nolisten[i]); - i++; - } - } - - trans->flags |= TRANS_NOLISTEN; - return ret; -} - -int -TRANS(Listen) (const char * protocol) -{ - Xtransport *trans; - int i = 0, ret = 0; - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"TransListen: unable to find transport: %s\n", - protocol); - - return -1; - } - if (trans->flags & TRANS_ALIAS) { - if (trans->nolisten) - while (trans->nolisten[i]) { - ret |= TRANS(Listen)(trans->nolisten[i]); - i++; - } - } - - trans->flags &= ~TRANS_NOLISTEN; - return ret; -} - -int -TRANS(IsListening) (const char * protocol) -{ - Xtransport *trans; - - if ((trans = TRANS(SelectTransport)(protocol)) == NULL) - { - prmsg (1,"TransIsListening: unable to find transport: %s\n", - protocol); - - return 0; - } - - return !(trans->flags & TRANS_NOLISTEN); -} - -int -TRANS(ResetListener) (XtransConnInfo ciptr) - -{ - if (ciptr->transptr->ResetListener) - return ciptr->transptr->ResetListener (ciptr); - else - return TRANS_RESET_NOOP; -} - - -XtransConnInfo -TRANS(Accept) (XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - - prmsg (2,"Accept(%d)\n", ciptr->fd); - - newciptr = ciptr->transptr->Accept (ciptr, status); - - if (newciptr) - newciptr->transptr = ciptr->transptr; - - return newciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -int -TRANS(Connect) (XtransConnInfo ciptr, const char *address) - -{ - char *protocol; - char *host; - char *port; - int ret; - - prmsg (2,"Connect(%d,%s)\n", ciptr->fd, address); - - if (TRANS(ParseAddress) (address, &protocol, &host, &port) == 0) - { - prmsg (1,"Connect: Unable to Parse address %s\n", - address); - return -1; - } - -#ifdef HAVE_LAUNCHD - if (!host) host=strdup(""); -#endif - - if (!port || !*port) - { - prmsg (1,"Connect: Missing port specification in %s\n", - address); - if (protocol) free (protocol); - if (host) free (host); - return -1; - } - - ret = ciptr->transptr->Connect (ciptr, host, port); - - if (protocol) free (protocol); - if (host) free (host); - if (port) free (port); - - return ret; -} - -#endif /* TRANS_CLIENT */ - - -int -TRANS(BytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) - -{ - return ciptr->transptr->BytesReadable (ciptr, pend); -} - -int -TRANS(Read) (XtransConnInfo ciptr, char *buf, int size) - -{ - return ciptr->transptr->Read (ciptr, buf, size); -} - -int -TRANS(Write) (XtransConnInfo ciptr, char *buf, int size) - -{ - return ciptr->transptr->Write (ciptr, buf, size); -} - -int -TRANS(Readv) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - return ciptr->transptr->Readv (ciptr, buf, size); -} - -int -TRANS(Writev) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - return ciptr->transptr->Writev (ciptr, buf, size); -} - -#if XTRANS_SEND_FDS -int -TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close) -{ - return ciptr->transptr->SendFd(ciptr, fd, do_close); -} - -int -TRANS(RecvFd) (XtransConnInfo ciptr) -{ - return ciptr->transptr->RecvFd(ciptr); -} -#endif - -int -TRANS(Disconnect) (XtransConnInfo ciptr) - -{ - return ciptr->transptr->Disconnect (ciptr); -} - -int -TRANS(Close) (XtransConnInfo ciptr) - -{ - int ret; - - prmsg (2,"Close(%d)\n", ciptr->fd); - - ret = ciptr->transptr->Close (ciptr); - - TRANS(FreeConnInfo) (ciptr); - - return ret; -} - -int -TRANS(CloseForCloning) (XtransConnInfo ciptr) - -{ - int ret; - - prmsg (2,"CloseForCloning(%d)\n", ciptr->fd); - - ret = ciptr->transptr->CloseForCloning (ciptr); - - TRANS(FreeConnInfo) (ciptr); - - return ret; -} - -int -TRANS(IsLocal) (XtransConnInfo ciptr) - -{ - return (ciptr->family == AF_UNIX); -} - -#ifdef NX_TRANS_SOCKET -/* this is needed for pre-xcb X11 as we have in NX */ -int -TRANS(GetMyAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, - Xtransaddr **addrp) - -{ - prmsg (2,"GetMyAddr(%d)\n", ciptr->fd); - - *familyp = ciptr->family; - *addrlenp = ciptr->addrlen; - - if ((*addrp = (Xtransaddr *) malloc (ciptr->addrlen)) == NULL) - { - prmsg (1,"GetMyAddr: malloc failed\n"); - return -1; - } - memcpy(*addrp, ciptr->addr, ciptr->addrlen); - - return 0; -} -#endif - -int -TRANS(GetPeerAddr) (XtransConnInfo ciptr, int *familyp, int *addrlenp, - Xtransaddr **addrp) - -{ - prmsg (2,"GetPeerAddr(%d)\n", ciptr->fd); - - *familyp = ciptr->family; - *addrlenp = ciptr->peeraddrlen; - - if ((*addrp = malloc (ciptr->peeraddrlen)) == NULL) - { - prmsg (1,"GetPeerAddr: malloc failed\n"); - return -1; - } - memcpy(*addrp, ciptr->peeraddr, ciptr->peeraddrlen); - - return 0; -} - - -int -TRANS(GetConnectionNumber) (XtransConnInfo ciptr) - -{ - return ciptr->fd; -} - - -/* - * These functions are really utility functions, but they require knowledge - * of the internal data structures, so they have to be part of the Transport - * Independant API. - */ - -#ifdef TRANS_SERVER - -static int -complete_network_count (void) - -{ - int count = 0; - int found_local = 0; - int i; - - /* - * For a complete network, we only need one LOCALCONN transport to work - */ - - for (i = 0; i < NUMTRANS; i++) - { - if (Xtransports[i].transport->flags & TRANS_ALIAS - || Xtransports[i].transport->flags & TRANS_NOLISTEN) - continue; - - if (Xtransports[i].transport->flags & TRANS_LOCAL) - found_local = 1; - else - count++; - } - - return (count + found_local); -} - - -static int -receive_listening_fds(const char* port, XtransConnInfo* temp_ciptrs, - int* count_ret) - -{ -#ifdef HAVE_SYSTEMD_DAEMON - XtransConnInfo ciptr; - int i, systemd_listen_fds; - - systemd_listen_fds = sd_listen_fds(1); - if (systemd_listen_fds < 0) - { - prmsg (1, "receive_listening_fds: sd_listen_fds error: %s\n", - strerror(-systemd_listen_fds)); - return -1; - } - - for (i = 0; i < systemd_listen_fds && *count_ret < NUMTRANS; i++) - { - struct sockaddr_storage a; - int ti; - const char* tn; - socklen_t al; - - al = sizeof(a); - if (getsockname(i + SD_LISTEN_FDS_START, (struct sockaddr*)&a, &al) < 0) { - prmsg (1, "receive_listening_fds: getsockname error: %s\n", - strerror(errno)); - return -1; - } - - switch (a.ss_family) - { - case AF_UNIX: - ti = TRANS_SOCKET_UNIX_INDEX; - if (*((struct sockaddr_un*)&a)->sun_path == '\0' && - al > sizeof(sa_family_t)) - tn = "local"; - else - tn = "unix"; - break; - case AF_INET: - ti = TRANS_SOCKET_INET_INDEX; - tn = "inet"; - break; -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: - ti = TRANS_SOCKET_INET6_INDEX; - tn = "inet6"; - break; -#endif /* IPv6 */ - default: - prmsg (1, "receive_listening_fds:" - "Got unknown socket address family\n"); - return -1; - } - - ciptr = TRANS(ReopenCOTSServer)(ti, i + SD_LISTEN_FDS_START, port); - if (!ciptr) - { - prmsg (1, "receive_listening_fds:" - "Got NULL while trying to reopen socket received from systemd.\n"); - return -1; - } - - prmsg (5, "receive_listening_fds: received listener for %s, %d\n", - tn, ciptr->fd); - temp_ciptrs[(*count_ret)++] = ciptr; - TRANS(Received)(tn); - } -#endif /* HAVE_SYSTEMD_DAEMON */ - return 0; -} - -#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD -extern int xquartz_launchd_fd; -#endif - -int -TRANS(MakeAllCOTSServerListeners) (const char *port, int *partial, - int *count_ret, XtransConnInfo **ciptrs_ret) - -{ - char buffer[256]; /* ??? What size ?? */ - XtransConnInfo ciptr, temp_ciptrs[NUMTRANS]; - int status, i, j; - -#if defined(IPv6) && defined(AF_INET6) - int ipv6_succ = 0; -#endif - prmsg (2,"MakeAllCOTSServerListeners(%s,%p)\n", - port ? port : "NULL", (void *) ciptrs_ret); - - *count_ret = 0; - -#ifdef XQUARTZ_EXPORTS_LAUNCHD_FD - fprintf(stderr, "Launchd socket fd: %d\n", xquartz_launchd_fd); - if(xquartz_launchd_fd != -1) { - if((ciptr = TRANS(ReopenCOTSServer(TRANS_SOCKET_LOCAL_INDEX, - xquartz_launchd_fd, getenv("DISPLAY"))))==NULL) - fprintf(stderr,"Got NULL while trying to Reopen launchd port\n"); - else - temp_ciptrs[(*count_ret)++] = ciptr; - } -#endif - - if (receive_listening_fds(port, temp_ciptrs, count_ret) < 0) - return -1; - - for (i = 0; i < NUMTRANS; i++) - { - Xtransport *trans = Xtransports[i].transport; - unsigned int flags = 0; - - if (trans->flags&TRANS_ALIAS || trans->flags&TRANS_NOLISTEN || - trans->flags&TRANS_RECEIVED) - continue; - - snprintf(buffer, sizeof(buffer), "%s/:%s", - trans->TransName, port ? port : ""); - - prmsg (5,"MakeAllCOTSServerListeners: opening %s\n", - buffer); - - if ((ciptr = TRANS(OpenCOTSServer(buffer))) == NULL) - { - if (trans->flags & TRANS_DISABLED) - continue; - - prmsg (1, - "MakeAllCOTSServerListeners: failed to open listener for %s\n", - trans->TransName); - continue; - } -#if defined(IPv6) && defined(AF_INET6) - if ((Xtransports[i].transport_id == TRANS_SOCKET_INET_INDEX - && ipv6_succ)) - flags |= ADDR_IN_USE_ALLOWED; -#endif - - if ((status = TRANS(CreateListener (ciptr, port, flags))) < 0) - { - if (status == TRANS_ADDR_IN_USE) - { - /* - * We failed to bind to the specified address because the - * address is in use. It must be that a server is already - * running at this address, and this function should fail. - */ - - prmsg (1, - "MakeAllCOTSServerListeners: server already running\n"); - - for (j = 0; j < *count_ret; j++) - TRANS(Close) (temp_ciptrs[j]); - - *count_ret = 0; - *ciptrs_ret = NULL; - *partial = 0; - return -1; - } - else - { - prmsg (1, - "MakeAllCOTSServerListeners: failed to create listener for %s\n", - trans->TransName); - - continue; - } - } - -#if defined(IPv6) && defined(AF_INET6) - if (Xtransports[i].transport_id == TRANS_SOCKET_INET6_INDEX) - ipv6_succ = 1; -#endif - - prmsg (5, - "MakeAllCOTSServerListeners: opened listener for %s, %d\n", - trans->TransName, ciptr->fd); - - temp_ciptrs[*count_ret] = ciptr; - (*count_ret)++; - } - - *partial = (*count_ret < complete_network_count()); - - prmsg (5, - "MakeAllCOTSServerListeners: partial=%d, actual=%d, complete=%d \n", - *partial, *count_ret, complete_network_count()); - - if (*count_ret > 0) - { - if ((*ciptrs_ret = malloc ( - *count_ret * sizeof (XtransConnInfo))) == NULL) - { - return -1; - } - - for (i = 0; i < *count_ret; i++) - { - (*ciptrs_ret)[i] = temp_ciptrs[i]; - } - } - else - *ciptrs_ret = NULL; - - return 0; -} - -#endif /* TRANS_SERVER */ - - - -/* - * These routines are not part of the X Transport Interface, but they - * may be used by it. - */ - - -#ifdef WIN32 - -/* - * emulate readv - */ - -static int TRANS(ReadV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) - -{ - int i, len, total; - char *base; - - ESET(0); - for (i = 0, total = 0; i < iovcnt; i++, iov++) { - len = iov->iov_len; - base = iov->iov_base; - while (len > 0) { - register int nbytes; - nbytes = TRANS(Read) (ciptr, base, len); - if (nbytes < 0 && total == 0) return -1; - if (nbytes <= 0) return total; - ESET(0); - len -= nbytes; - total += nbytes; - base += nbytes; - } - } - return total; -} - - -/* - * emulate writev - */ - -static int TRANS(WriteV) (XtransConnInfo ciptr, struct iovec *iov, int iovcnt) - -{ - int i, len, total; - char *base; - - ESET(0); - for (i = 0, total = 0; i < iovcnt; i++, iov++) { - len = iov->iov_len; - base = iov->iov_base; - while (len > 0) { - register int nbytes; - nbytes = TRANS(Write) (ciptr, base, len); - if (nbytes < 0 && total == 0) return -1; - if (nbytes <= 0) return total; - ESET(0); - len -= nbytes; - total += nbytes; - base += nbytes; - } - } - return total; -} - -#endif /* WIN32 */ - - -#if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) -#ifndef NEED_UTSNAME -#define NEED_UTSNAME -#endif -#include -#endif - -/* - * TRANS(GetHostname) - similar to gethostname but allows special processing. - */ - -int TRANS(GetHostname) (char *buf, int maxlen) - -{ - int len; - -#ifdef NEED_UTSNAME - struct utsname name; - - uname (&name); - len = strlen (name.nodename); - if (len >= maxlen) len = maxlen - 1; - strncpy (buf, name.nodename, len); - buf[len] = '\0'; -#else - buf[0] = '\0'; - (void) gethostname (buf, maxlen); - buf [maxlen - 1] = '\0'; - len = strlen(buf); -#endif /* NEED_UTSNAME */ - return len; -} diff --git a/nx-X11/lib/xtrans/Xtrans.h b/nx-X11/lib/xtrans/Xtrans.h deleted file mode 100644 index 54b2a1425..000000000 --- a/nx-X11/lib/xtrans/Xtrans.h +++ /dev/null @@ -1,426 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -#ifndef _XTRANS_H_ -#define _XTRANS_H_ - -#include -#include -#include - -#ifndef WIN32 -#include -#endif - -#ifdef __clang__ -/* Not all clients make use of all provided statics */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" -#endif - -/* - * Set the functions names according to where this code is being compiled. - */ - -#ifdef X11_t -#define TRANS(func) _X11Trans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_X11Trans"; -#endif -#endif /* X11_t */ - -#ifdef XSERV_t -#define TRANS(func) _XSERVTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_XSERVTrans"; -#endif -#define X11_t -#endif /* XSERV_t */ - -#ifdef XIM_t -#define TRANS(func) _XimXTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_XimTrans"; -#endif -#endif /* XIM_t */ - -#ifdef FS_t -#define TRANS(func) _FSTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_FSTrans"; -#endif -#endif /* FS_t */ - -#ifdef FONT_t -#define TRANS(func) _FontTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_FontTrans"; -#endif -#endif /* FONT_t */ - -#ifdef ICE_t -#define TRANS(func) _IceTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_IceTrans"; -#endif -#endif /* ICE_t */ - -#if !defined(TRANS) -#define TRANS(func) _XTrans##func -#ifdef XTRANSDEBUG -static const char *__xtransname = "_XTrans"; -#endif -#endif /* !TRANS */ - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -/* - * Create a single address structure that can be used wherever - * an address structure is needed. struct sockaddr is not big enough - * to hold a sockadd_un, so we create this definition to have a single - * structure that is big enough for all the structures we might need. - * - * This structure needs to be independent of the socket/TLI interface used. - */ - -#if defined(IPv6) && defined(AF_INET6) -typedef struct sockaddr_storage Xtransaddr; -#else -#define XTRANS_MAX_ADDR_LEN 128 /* large enough to hold sun_path */ - -typedef struct { - unsigned char addr[XTRANS_MAX_ADDR_LEN]; -} Xtransaddr; -#endif - -#ifdef LONG64 -typedef int BytesReadable_t; -#else -typedef long BytesReadable_t; -#endif - - -#if defined(WIN32) || defined(USG) - -/* - * TRANS(Readv) and TRANS(Writev) use struct iovec, normally found - * in Berkeley systems in . See the readv(2) and writev(2) - * manual pages for details. - */ - -struct iovec { - caddr_t iov_base; - int iov_len; -}; - -#else -#include -#endif - -typedef struct _XtransConnInfo *XtransConnInfo; - - -/* - * Transport Option definitions - */ - -#define TRANS_NONBLOCKING 1 -#define TRANS_CLOSEONEXEC 2 - - -/* - * Return values of Connect (0 is success) - */ - -#define TRANS_CONNECT_FAILED -1 -#define TRANS_TRY_CONNECT_AGAIN -2 -#define TRANS_IN_PROGRESS -3 - - -/* - * Return values of CreateListener (0 is success) - */ - -#define TRANS_CREATE_LISTENER_FAILED -1 -#define TRANS_ADDR_IN_USE -2 - - -/* - * Return values of Accept (0 is success) - */ - -#define TRANS_ACCEPT_BAD_MALLOC -1 -#define TRANS_ACCEPT_FAILED -2 -#define TRANS_ACCEPT_MISC_ERROR -3 - - -/* - * ResetListener return values - */ - -#define TRANS_RESET_NOOP 1 -#define TRANS_RESET_NEW_FD 2 -#define TRANS_RESET_FAILURE 3 - - -/* - * Function prototypes for the exposed interface - */ - -void TRANS(FreeConnInfo) ( - XtransConnInfo /* ciptr */ -); - -#ifdef TRANS_CLIENT - -XtransConnInfo TRANS(OpenCOTSClient)( - const char * /* address */ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - -XtransConnInfo TRANS(OpenCOTSServer)( - const char * /* address */ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - -XtransConnInfo TRANS(ReopenCOTSServer)( - int, /* trans_id */ - int, /* fd */ - const char * /* port */ -); - -int TRANS(GetReopenInfo)( - XtransConnInfo, /* ciptr */ - int *, /* trans_id */ - int *, /* fd */ - char ** /* port */ -); - -#endif /* TRANS_REOPEN */ - - -int TRANS(SetOption)( - XtransConnInfo, /* ciptr */ - int, /* option */ - int /* arg */ -); - -#ifdef TRANS_SERVER - -int TRANS(CreateListener)( - XtransConnInfo, /* ciptr */ - const char *, /* port */ - unsigned int /* flags */ -); - -int TRANS(Received) ( - const char* /* protocol*/ -); - -int TRANS(NoListen) ( - const char* /* protocol*/ -); - -int TRANS(Listen) ( - const char* /* protocol*/ -); - -int TRANS(IsListening) ( - const char* /* protocol*/ -); - -int TRANS(ResetListener)( - XtransConnInfo /* ciptr */ -); - -XtransConnInfo TRANS(Accept)( - XtransConnInfo, /* ciptr */ - int * /* status */ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - -int TRANS(Connect)( - XtransConnInfo, /* ciptr */ - const char * /* address */ -); - -#endif /* TRANS_CLIENT */ - -int TRANS(BytesReadable)( - XtransConnInfo, /* ciptr */ - BytesReadable_t * /* pend */ -); - -int TRANS(Read)( - XtransConnInfo, /* ciptr */ - char *, /* buf */ - int /* size */ -); - -int TRANS(Write)( - XtransConnInfo, /* ciptr */ - char *, /* buf */ - int /* size */ -); - -int TRANS(Readv)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* buf */ - int /* size */ -); - -int TRANS(Writev)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* buf */ - int /* size */ -); - -int TRANS(SendFd) (XtransConnInfo ciptr, int fd, int do_close); - -int TRANS(RecvFd) (XtransConnInfo ciptr); - -int TRANS(Disconnect)( - XtransConnInfo /* ciptr */ -); - -int TRANS(Close)( - XtransConnInfo /* ciptr */ -); - -int TRANS(CloseForCloning)( - XtransConnInfo /* ciptr */ -); - -int TRANS(IsLocal)( - XtransConnInfo /* ciptr */ -); - -#ifdef NX_TRANS_SOCKET -/* needed for pre-xcb libX11 as we have in NX */ -int TRANS(GetMyAddr)( - XtransConnInfo, /* ciptr */ - int *, /* familyp */ - int *, /* addrlenp */ - Xtransaddr ** /* addrp */ -); -#endif - -int TRANS(GetPeerAddr)( - XtransConnInfo, /* ciptr */ - int *, /* familyp */ - int *, /* addrlenp */ - Xtransaddr ** /* addrp */ -); - -int TRANS(GetConnectionNumber)( - XtransConnInfo /* ciptr */ -); - -#ifdef TRANS_SERVER - -int TRANS(MakeAllCOTSServerListeners)( - const char *, /* port */ - int *, /* partial */ - int *, /* count_ret */ - XtransConnInfo ** /* ciptrs_ret */ -); - -#endif /* TRANS_SERVER */ - - -/* - * Function Prototypes for Utility Functions. - */ - -#ifdef X11_t - -int TRANS(ConvertAddress)( - int *, /* familyp */ - int *, /* addrlenp */ - Xtransaddr ** /* addrp */ -); - -#endif /* X11_t */ - -#ifdef ICE_t - -char * -TRANS(GetMyNetworkId)( - XtransConnInfo /* ciptr */ -); - -char * -TRANS(GetPeerNetworkId)( - XtransConnInfo /* ciptr */ -); - -#endif /* ICE_t */ - -int -TRANS(GetHostname) ( - char * /* buf */, - int /* maxlen */ -); - -#if defined(WIN32) && defined(TCPCONN) -int TRANS(WSAStartup)(); -#endif - -#endif /* _XTRANS_H_ */ diff --git a/nx-X11/lib/xtrans/Xtransint.h b/nx-X11/lib/xtrans/Xtransint.h deleted file mode 100644 index f7e07687b..000000000 --- a/nx-X11/lib/xtrans/Xtransint.h +++ /dev/null @@ -1,433 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -#ifndef _XTRANSINT_H_ -#define _XTRANSINT_H_ - -/* - * XTRANSDEBUG will enable the PRMSG() macros used in the X Transport - * Interface code. Each use of the PRMSG macro has a level associated with - * it. XTRANSDEBUG is defined to be a level. If the invocation level is =< - * the value of XTRANSDEBUG, then the message will be printed out to stderr. - * Recommended levels are: - * - * XTRANSDEBUG=1 Error messages - * XTRANSDEBUG=2 API Function Tracing - * XTRANSDEBUG=3 All Function Tracing - * XTRANSDEBUG=4 printing of intermediate values - * XTRANSDEBUG=5 really detailed stuff -#define XTRANSDEBUG 2 - * - * Defining XTRANSDEBUGTIMESTAMP will cause printing timestamps with each - * message. - */ - -#if !defined(XTRANSDEBUG) && defined(XTRANS_TRANSPORT_C) -# define XTRANSDEBUG 1 -#endif - -#ifdef WIN32 -# define _WILLWINSOCK_ -#endif - -#include "Xtrans.h" - -#ifndef _X_UNUSED /* Defined in Xfuncproto.h in xproto >= 7.0.22 */ -# define _X_UNUSED /* */ -#endif - -#ifdef XTRANSDEBUG -# include -#endif /* XTRANSDEBUG */ - -#include - -#ifndef WIN32 -# include -# include -# include - -/* - * Moved the setting of NEED_UTSNAME to this header file from Xtrans.c, - * to avoid a race condition. JKJ (6/5/97) - */ - -# if defined(_POSIX_SOURCE) || defined(USG) || defined(SVR4) || defined(__SVR4) || defined(__SCO__) -# ifndef NEED_UTSNAME -# define NEED_UTSNAME -# endif -# include -# endif - -# define ESET(val) errno = val -# define EGET() errno - -#else /* WIN32 */ - -# include /* for USHRT_MAX */ - -# define ESET(val) WSASetLastError(val) -# define EGET() WSAGetLastError() - -#endif /* WIN32 */ - -#include - -#ifdef X11_t -#define X_TCP_PORT 6000 -#endif - -#if XTRANS_SEND_FDS - -struct _XtransConnFd { - struct _XtransConnFd *next; - int fd; - int do_close; -}; - -#endif - -struct _XtransConnInfo { - struct _Xtransport *transptr; - int index; - char *priv; - int flags; - int fd; - char *port; - int family; - char *addr; - int addrlen; - char *peeraddr; - int peeraddrlen; - struct _XtransConnFd *recv_fds; - struct _XtransConnFd *send_fds; -}; - -#define XTRANS_OPEN_COTS_CLIENT 1 -#define XTRANS_OPEN_COTS_SERVER 2 - -typedef struct _Xtransport { - const char *TransName; - int flags; - -#ifdef TRANS_CLIENT - - XtransConnInfo (*OpenCOTSClient)( - struct _Xtransport *, /* transport */ - const char *, /* protocol */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - const char ** nolisten; - XtransConnInfo (*OpenCOTSServer)( - struct _Xtransport *, /* transport */ - const char *, /* protocol */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - - XtransConnInfo (*ReopenCOTSServer)( - struct _Xtransport *, /* transport */ - int, /* fd */ - const char * /* port */ - ); - -#endif /* TRANS_REOPEN */ - - - int (*SetOption)( - XtransConnInfo, /* connection */ - int, /* option */ - int /* arg */ - ); - -#ifdef TRANS_SERVER -/* Flags */ -# define ADDR_IN_USE_ALLOWED 1 - - int (*CreateListener)( - XtransConnInfo, /* connection */ - const char *, /* port */ - unsigned int /* flags */ - ); - - int (*ResetListener)( - XtransConnInfo /* connection */ - ); - - XtransConnInfo (*Accept)( - XtransConnInfo, /* connection */ - int * /* status */ - ); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - - int (*Connect)( - XtransConnInfo, /* connection */ - const char *, /* host */ - const char * /* port */ - ); - -#endif /* TRANS_CLIENT */ - - int (*BytesReadable)( - XtransConnInfo, /* connection */ - BytesReadable_t * /* pend */ - ); - - int (*Read)( - XtransConnInfo, /* connection */ - char *, /* buf */ - int /* size */ - ); - - int (*Write)( - XtransConnInfo, /* connection */ - char *, /* buf */ - int /* size */ - ); - - int (*Readv)( - XtransConnInfo, /* connection */ - struct iovec *, /* buf */ - int /* size */ - ); - - int (*Writev)( - XtransConnInfo, /* connection */ - struct iovec *, /* buf */ - int /* size */ - ); - -#if XTRANS_SEND_FDS - int (*SendFd)( - XtransConnInfo, /* connection */ - int, /* fd */ - int /* do_close */ - ); - - int (*RecvFd)( - XtransConnInfo /* connection */ - ); -#endif - - int (*Disconnect)( - XtransConnInfo /* connection */ - ); - - int (*Close)( - XtransConnInfo /* connection */ - ); - - int (*CloseForCloning)( - XtransConnInfo /* connection */ - ); - -} Xtransport; - - -typedef struct _Xtransport_table { - Xtransport *transport; - int transport_id; -} Xtransport_table; - - -/* - * Flags for the flags member of Xtransport. - */ - -#define TRANS_ALIAS (1<<0) /* record is an alias, don't create server */ -#define TRANS_LOCAL (1<<1) /* local transport */ -#define TRANS_DISABLED (1<<2) /* Don't open this one */ -#define TRANS_NOLISTEN (1<<3) /* Don't listen on this one */ -#define TRANS_NOUNLINK (1<<4) /* Don't unlink transport endpoints */ -#define TRANS_ABSTRACT (1<<5) /* Use abstract sockets if available */ -#define TRANS_NOXAUTH (1<<6) /* Don't verify authentication (because it's secure some other way at the OS layer) */ -#define TRANS_RECEIVED (1<<7) /* The fd for this has already been opened by someone else. */ - -/* Flags to preserve when setting others */ -#define TRANS_KEEPFLAGS (TRANS_NOUNLINK|TRANS_ABSTRACT) - -#ifdef XTRANS_TRANSPORT_C /* only provide static function prototypes when - building the transport.c file that has them in */ - -#ifdef __clang__ -/* Not all clients make use of all provided statics */ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wunused-function" -#endif - -/* - * readv() and writev() don't exist or don't work correctly on some - * systems, so they may be emulated. - */ - -#ifdef WIN32 - -#define READV(ciptr, iov, iovcnt) TRANS(ReadV)(ciptr, iov, iovcnt) - -static int TRANS(ReadV)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* iov */ - int /* iovcnt */ -); - -#else - -#define READV(ciptr, iov, iovcnt) readv(ciptr->fd, iov, iovcnt) - -#endif /* WIN32 */ - - -#ifdef WIN32 - -#define WRITEV(ciptr, iov, iovcnt) TRANS(WriteV)(ciptr, iov, iovcnt) - -static int TRANS(WriteV)( - XtransConnInfo, /* ciptr */ - struct iovec *, /* iov */ - int /* iovcnt */ -); - -#else - -#define WRITEV(ciptr, iov, iovcnt) writev(ciptr->fd, iov, iovcnt) - -#endif /* WIN32 */ - -#if defined(X11_t) -static int is_numeric ( - const char * /* str */ -); -#endif - -#ifdef TRANS_SERVER -static int trans_mkdir ( - const char *, /* path */ - int /* mode */ -); -#endif - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif - -/* - * Some XTRANSDEBUG stuff - */ - -#ifdef XTRANSDEBUG -#include - -/* - * The X server provides ErrorF() & VErrorF(), for other software that uses - * xtrans, we provide our own simple versions. - */ -# if defined(XSERV_t) && defined(TRANS_SERVER) -# include "os.h" -# else -static inline void _X_ATTRIBUTE_PRINTF(1, 0) -VErrorF(const char *f, va_list args) -{ - vfprintf(stderr, f, args); - fflush(stderr); -} - -static inline void _X_ATTRIBUTE_PRINTF(1, 2) -ErrorF(const char *f, ...) -{ - va_list args; - - va_start(args, f); - VErrorF(f, args); - va_end(args); -} -# endif /* xserver */ -#endif /* XTRANSDEBUG */ - -static inline void _X_ATTRIBUTE_PRINTF(2, 3) -prmsg(int lvl, const char *f, ...) -{ -#ifdef XTRANSDEBUG - va_list args; - - va_start(args, f); - if (lvl <= XTRANSDEBUG) { - int saveerrno = errno; - - ErrorF("%s", __xtransname); - VErrorF(f, args); - -# ifdef XTRANSDEBUGTIMESTAMP - { - struct timeval tp; - gettimeofday(&tp, 0); - ErrorF("timestamp (ms): %d\n", - tp.tv_sec * 1000 + tp.tv_usec / 1000); - } -# endif - errno = saveerrno; - } - va_end(args); -#endif /* XTRANSDEBUG */ -} - -#endif /* XTRANS_TRANSPORT_C */ - -#endif /* _XTRANSINT_H_ */ diff --git a/nx-X11/lib/xtrans/Xtranslcl.c b/nx-X11/lib/xtrans/Xtranslcl.c deleted file mode 100644 index 7231d2a83..000000000 --- a/nx-X11/lib/xtrans/Xtranslcl.c +++ /dev/null @@ -1,2486 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -/* - * - * The connection code/ideas in lib/X and server/os for SVR4/Intel - * environments was contributed by the following companies/groups: - * - * MetroLink Inc - * NCR - * Pittsburgh Powercomputing Corporation (PPc)/Quarterdeck Office Systems - * SGCS - * Unix System Laboratories (USL) / Novell - * XFree86 - * - * The goal is to have common connection code among all SVR4/Intel vendors. - * - * ALL THE ABOVE COMPANIES DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS - * SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, - * IN NO EVENT SHALL THESE COMPANIES * 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. - */ - -#include -#include -#include -#include -#include -#if defined(SVR4) || defined(__SVR4) -#include -#endif -#ifdef __sun -# include -#else -#include -#endif -#include -#include - -/* - * The local transports should be treated the same as a UNIX domain socket - * wrt authentication, etc. Because of this, we will use struct sockaddr_un - * for the address format. This will simplify the code in other places like - * The X Server. - */ - -#include -#ifndef X_NO_SYS_UN -#include -#endif - - -/* Types of local connections supported: - * - PTS - * - named pipes - * - SCO - */ -#if !defined(__sun) -# define LOCAL_TRANS_PTS -#endif -#if defined(SVR4) || defined(__SVR4) -# define LOCAL_TRANS_NAMED -#endif -#if defined(__SCO__) || defined(__UNIXWARE__) -# define LOCAL_TRANS_SCO -#endif - -static int TRANS(LocalClose)(XtransConnInfo ciptr); - -/* - * These functions actually implement the local connection mechanisms. - */ - -/* Type Not Supported */ - -static int -TRANS(OpenFail)(XtransConnInfo ciptr _X_UNUSED, const char *port _X_UNUSED) - -{ - return -1; -} - -#ifdef TRANS_REOPEN - -static int -TRANS(ReopenFail)(XtransConnInfo ciptr _X_UNUSED, int fd _X_UNUSED, - const char *port _X_UNUSED) - -{ - return 0; -} - -#endif /* TRANS_REOPEN */ - -#if XTRANS_SEND_FDS -static int -TRANS(LocalRecvFdInvalid)(XtransConnInfo ciptr) -{ - errno = EINVAL; - return -1; -} - -static int -TRANS(LocalSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) -{ - errno = EINVAL; - return -1; -} -#endif - - -static int -TRANS(FillAddrInfo)(XtransConnInfo ciptr, - const char *sun_path, const char *peer_sun_path) - -{ - struct sockaddr_un *sunaddr; - struct sockaddr_un *p_sunaddr; - - ciptr->family = AF_UNIX; - ciptr->addrlen = sizeof (struct sockaddr_un); - - if ((sunaddr = malloc (ciptr->addrlen)) == NULL) - { - prmsg(1,"FillAddrInfo: failed to allocate memory for addr\n"); - return 0; - } - - sunaddr->sun_family = AF_UNIX; - - if (strlen(sun_path) > sizeof(sunaddr->sun_path) - 1) { - prmsg(1, "FillAddrInfo: path too long\n"); - free((char *) sunaddr); - return 0; - } - strcpy (sunaddr->sun_path, sun_path); -#if defined(BSD44SOCKETS) - sunaddr->sun_len = strlen (sunaddr->sun_path); -#endif - - ciptr->addr = (char *) sunaddr; - - ciptr->peeraddrlen = sizeof (struct sockaddr_un); - - if ((p_sunaddr = malloc (ciptr->peeraddrlen)) == NULL) - { - prmsg(1, - "FillAddrInfo: failed to allocate memory for peer addr\n"); - free (sunaddr); - ciptr->addr = NULL; - - return 0; - } - - p_sunaddr->sun_family = AF_UNIX; - - if (strlen(peer_sun_path) > sizeof(p_sunaddr->sun_path) - 1) { - prmsg(1, "FillAddrInfo: peer path too long\n"); - free((char *) p_sunaddr); - return 0; - } - strcpy (p_sunaddr->sun_path, peer_sun_path); -#if defined(BSD44SOCKETS) - p_sunaddr->sun_len = strlen (p_sunaddr->sun_path); -#endif - - ciptr->peeraddr = (char *) p_sunaddr; - - return 1; -} - - - -#ifdef LOCAL_TRANS_PTS -/* PTS */ - -#if defined(SYSV) && !defined(__SCO__) -#define SIGNAL_T int -#else -#define SIGNAL_T void -#endif /* SYSV */ - -typedef SIGNAL_T (*PFV)(); - -extern PFV signal(); - -extern char *ptsname( - int -); - -static void _dummy(int sig _X_UNUSED) - -{ -} -#endif /* LOCAL_TRANS_PTS */ - -#ifndef __sun -#define X_STREAMS_DIR "/dev/X" -#define DEV_SPX "/dev/spx" -#else -#ifndef X11_t -#define X_STREAMS_DIR "/dev/X" -#else -#define X_STREAMS_DIR "/tmp/.X11-pipe" -#endif -#endif - -#define DEV_PTMX "/dev/ptmx" - -#if defined(X11_t) - -#define PTSNODENAME "/dev/X/server." -#ifdef __sun -#define NAMEDNODENAME "/tmp/.X11-pipe/X" -#else -#define NAMEDNODENAME "/dev/X/Nserver." - -#define SCORNODENAME "/dev/X%1sR" -#define SCOSNODENAME "/dev/X%1sS" -#endif /* !__sun */ -#endif -#if defined(XIM_t) -#ifdef __sun -#define NAMEDNODENAME "/tmp/.XIM-pipe/XIM" -#else -#define PTSNODENAME "/dev/X/XIM." -#define NAMEDNODENAME "/dev/X/NXIM." -#define SCORNODENAME "/dev/XIM.%sR" -#define SCOSNODENAME "/dev/XIM.%sS" -#endif -#endif -#if defined(FS_t) || defined (FONT_t) -#ifdef __sun -#define NAMEDNODENAME "/tmp/.font-pipe/fs" -#else -/* - * USL has already defined something here. We need to check with them - * and see if their choice is usable here. - */ -#define PTSNODENAME "/dev/X/fontserver." -#define NAMEDNODENAME "/dev/X/Nfontserver." -#define SCORNODENAME "/dev/fontserver.%sR" -#define SCOSNODENAME "/dev/fontserver.%sS" -#endif -#endif -#if defined(ICE_t) -#ifdef __sun -#define NAMEDNODENAME "/tmp/.ICE-pipe/" -#else -#define PTSNODENAME "/dev/X/ICE." -#define NAMEDNODENAME "/dev/X/NICE." -#define SCORNODENAME "/dev/ICE.%sR" -#define SCOSNODENAME "/dev/ICE.%sS" -#endif -#endif -#if defined(TEST_t) -#ifdef __sun -#define NAMEDNODENAME "/tmp/.Test-unix/test" -#endif -#define PTSNODENAME "/dev/X/transtest." -#define NAMEDNODENAME "/dev/X/Ntranstest." -#define SCORNODENAME "/dev/transtest.%sR" -#define SCOSNODENAME "/dev/transtest.%sS" -#endif - - - -#ifdef LOCAL_TRANS_PTS -#ifdef TRANS_CLIENT - -static int -TRANS(PTSOpenClient)(XtransConnInfo ciptr, const char *port) - -{ -#ifdef PTSNODENAME - int fd,server,exitval,alarm_time,ret; - char server_path[64]; - char *slave, namelen; - char buf[20]; /* MAX_PATH_LEN?? */ - PFV savef; - pid_t saved_pid; -#endif - - prmsg(2,"PTSOpenClient(%s)\n", port); - -#if !defined(PTSNODENAME) - prmsg(1,"PTSOpenClient: Protocol is not supported by a pts connection\n"); - return -1; -#else - if (port && *port ) { - if( *port == '/' ) { /* A full pathname */ - snprintf(server_path, sizeof(server_path), "%s", port); - } else { - snprintf(server_path, sizeof(server_path), "%s%s", - PTSNODENAME, port); - } - } else { - snprintf(server_path, sizeof(server_path), "%s%d", - PTSNODENAME, getpid()); - } - - - /* - * Open the node the on which the server is listening. - */ - - if ((server = open (server_path, O_RDWR)) < 0) { - prmsg(1,"PTSOpenClient: failed to open %s\n", server_path); - return -1; - } - - - /* - * Open the streams based pipe that will be this connection. - */ - - if ((fd = open(DEV_PTMX, O_RDWR)) < 0) { - prmsg(1,"PTSOpenClient: failed to open %s\n", DEV_PTMX); - close(server); - return(-1); - } - - (void) grantpt(fd); - (void) unlockpt(fd); - - slave = ptsname(fd); /* get name */ - - if( slave == NULL ) { - prmsg(1,"PTSOpenClient: failed to get ptsname()\n"); - close(fd); - close(server); - return -1; - } - - /* - * This is neccesary for the case where a program is setuid to non-root. - * grantpt() calls /usr/lib/pt_chmod which is set-uid root. This program will - * set the owner of the pt device incorrectly if the uid is not restored - * before it is called. The problem is that once it gets restored, it - * cannot be changed back to its original condition, hence the fork(). - */ - - if(!(saved_pid=fork())) { - uid_t saved_euid; - - saved_euid = geteuid(); - /** sets the euid to the actual/real uid **/ - if (setuid( getuid() ) == -1) { - exit(1); - } - if( chown( slave, saved_euid, -1 ) < 0 ) { - exit( 1 ); - } - - exit( 0 ); - } - - waitpid(saved_pid, &exitval, 0); - if (WIFEXITED(exitval) && WEXITSTATUS(exitval) != 0) { - close(fd); - close(server); - prmsg(1, "PTSOpenClient: cannot set the owner of %s\n", - slave); - return(-1); - } - if (chmod(slave, 0666) < 0) { - close(fd); - close(server); - prmsg(1,"PTSOpenClient: Cannot chmod %s\n", slave); - return(-1); - } - - /* - * write slave name to server - */ - - namelen = strlen(slave); - buf[0] = namelen; - (void) sprintf(&buf[1], slave); - (void) write(server, buf, namelen+1); - (void) close(server); - - /* - * wait for server to respond - */ - - savef = signal(SIGALRM, _dummy); - alarm_time = alarm (30); /* CONNECT_TIMEOUT */ - - ret = read(fd, buf, 1); - - (void) alarm(alarm_time); - (void) signal(SIGALRM, savef); - - if (ret != 1) { - prmsg(1, - "PTSOpenClient: failed to get acknoledgement from server\n"); - (void) close(fd); - fd = -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, slave, server_path) == 0) - { - prmsg(1,"PTSOpenClient: failed to fill in addr info\n"); - close(fd); - return -1; - } - - return(fd); - -#endif /* !PTSNODENAME */ -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static int -TRANS(PTSOpenServer)(XtransConnInfo ciptr, const char *port) - -{ -#ifdef PTSNODENAME - int fd, server; - char server_path[64], *slave; - int mode; -#endif - - prmsg(2,"PTSOpenServer(%s)\n", port); - -#if !defined(PTSNODENAME) - prmsg(1,"PTSOpenServer: Protocol is not supported by a pts connection\n"); - return -1; -#else - if (port && *port ) { - if( *port == '/' ) { /* A full pathname */ - (void) sprintf(server_path, "%s", port); - } else { - (void) sprintf(server_path, "%s%s", PTSNODENAME, port); - } - } else { - (void) sprintf(server_path, "%s%d", PTSNODENAME, getpid()); - } - -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif - if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { - prmsg (1, "PTSOpenServer: mkdir(%s) failed, errno = %d\n", - X_STREAMS_DIR, errno); - return(-1); - } - -#if 0 - if( (fd=open(server_path, O_RDWR)) >= 0 ) { - /* - * This doesn't prevent the server from starting up, and doesn't - * prevent clients from trying to connect to the in-use PTS (which - * is often in use by something other than another server). - */ - prmsg(1, "PTSOpenServer: A server is already running on port %s\n", port); - prmsg(1, "PTSOpenServer: Remove %s if this is incorrect.\n", server_path); - close(fd); - return(-1); - } -#else - /* Just remove the old path (which is what happens with UNIXCONN) */ -#endif - - unlink(server_path); - - if( (fd=open(DEV_PTMX, O_RDWR)) < 0) { - prmsg(1, "PTSOpenServer: Unable to open %s\n", DEV_PTMX); - return(-1); - } - - grantpt(fd); - unlockpt(fd); - - if( (slave=ptsname(fd)) == NULL) { - prmsg(1, "PTSOpenServer: Unable to get slave device name\n"); - close(fd); - return(-1); - } - - if( link(slave,server_path) < 0 ) { - prmsg(1, "PTSOpenServer: Unable to link %s to %s\n", slave, server_path); - close(fd); - return(-1); - } - - if( chmod(server_path, 0666) < 0 ) { - prmsg(1, "PTSOpenServer: Unable to chmod %s to 0666\n", server_path); - close(fd); - return(-1); - } - - if( (server=open(server_path, O_RDWR)) < 0 ) { - prmsg(1, "PTSOpenServer: Unable to open server device %s\n", server_path); - close(fd); - return(-1); - } - - close(server); - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"PTSOpenServer: failed to fill in addr info\n"); - close(fd); - return -1; - } - - return fd; - -#endif /* !PTSNODENAME */ -} - -static int -TRANS(PTSAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) - -{ - int newfd; - int in; - unsigned char length; - char buf[256]; - struct sockaddr_un *sunaddr; - - prmsg(2,"PTSAccept(%x->%d)\n",ciptr,ciptr->fd); - - if( (in=read(ciptr->fd,&length,1)) <= 0 ){ - if( !in ) { - prmsg(2, - "PTSAccept: Incoming connection closed\n"); - } - else { - prmsg(1, - "PTSAccept: Error reading incoming connection. errno=%d \n", - errno); - } - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - if( (in=read(ciptr->fd,buf,length)) <= 0 ){ - if( !in ) { - prmsg(2, - "PTSAccept: Incoming connection closed\n"); - } - else { - prmsg(1, -"PTSAccept: Error reading device name for new connection. errno=%d \n", - errno); - } - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - buf[length] = '\0'; - - if( (newfd=open(buf,O_RDWR)) < 0 ) { - prmsg(1, "PTSAccept: Failed to open %s\n",buf); - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - write(newfd,"1",1); - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { - prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); - close(newfd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); - - newciptr->peeraddrlen=sizeof(struct sockaddr_un); - if( (sunaddr = malloc(newciptr->peeraddrlen)) == NULL ) { - prmsg(1,"PTSAccept: failed to allocate memory for peer addr\n"); - free(newciptr->addr); - close(newfd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - sunaddr->sun_family=AF_UNIX; - strcpy(sunaddr->sun_path,buf); -#if defined(BSD44SOCKETS) - sunaddr->sun_len=strlen(sunaddr->sun_path); -#endif - - newciptr->peeraddr=(char *)sunaddr; - - *status = 0; - - return newfd; -} - -#endif /* TRANS_SERVER */ -#endif /* LOCAL_TRANS_PTS */ - - -#ifdef LOCAL_TRANS_NAMED - -/* NAMED */ - -#ifdef TRANS_CLIENT - -static int -TRANS(NAMEDOpenClient)(XtransConnInfo ciptr, const char *port) - -{ -#ifdef NAMEDNODENAME - int fd; - char server_path[64]; - struct stat filestat; -# ifndef __sun - extern int isastream(int); -# endif -#endif - - prmsg(2,"NAMEDOpenClient(%s)\n", port); - -#if !defined(NAMEDNODENAME) - prmsg(1,"NAMEDOpenClient: Protocol is not supported by a NAMED connection\n"); - return -1; -#else - if ( port && *port ) { - if( *port == '/' ) { /* A full pathname */ - (void) snprintf(server_path, sizeof(server_path), "%s", port); - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%s", NAMEDNODENAME, port); - } - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%ld", NAMEDNODENAME, (long)getpid()); - } - - if ((fd = open(server_path, O_RDWR)) < 0) { - prmsg(1,"NAMEDOpenClient: Cannot open %s for NAMED connection\n", server_path); - return -1; - } - - if (fstat(fd, &filestat) < 0 ) { - prmsg(1,"NAMEDOpenClient: Cannot stat %s for NAMED connection\n", server_path); - (void) close(fd); - return -1; - } - - if ((filestat.st_mode & S_IFMT) != S_IFIFO) { - prmsg(1,"NAMEDOpenClient: Device %s is not a FIFO\n", server_path); - /* Is this really a failure? */ - (void) close(fd); - return -1; - } - - - if (isastream(fd) <= 0) { - prmsg(1,"NAMEDOpenClient: %s is not a streams device\n", server_path); - (void) close(fd); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"NAMEDOpenClient: failed to fill in addr info\n"); - close(fd); - return -1; - } - - return(fd); - -#endif /* !NAMEDNODENAME */ -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - - -#ifdef NAMEDNODENAME -static int -TRANS(NAMEDOpenPipe)(const char *server_path) -{ - int fd, pipefd[2]; - struct stat sbuf; - int mode; - - prmsg(2,"NAMEDOpenPipe(%s)\n", server_path); - -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif - if (trans_mkdir(X_STREAMS_DIR, mode) == -1) { - prmsg (1, "NAMEDOpenPipe: mkdir(%s) failed, errno = %d\n", - X_STREAMS_DIR, errno); - return(-1); - } - - if(stat(server_path, &sbuf) != 0) { - if (errno == ENOENT) { - if ((fd = creat(server_path, (mode_t)0666)) == -1) { - prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); - return(-1); - } - close(fd); - if (chmod(server_path, (mode_t)0666) < 0) { - prmsg(1, "NAMEDOpenPipe: Can't open %s\n", server_path); - return(-1); - } - } else { - prmsg(1, "NAMEDOpenPipe: stat on %s failed\n", server_path); - return(-1); - } - } - - if( pipe(pipefd) != 0) { - prmsg(1, "NAMEDOpenPipe: pipe() failed, errno=%d\n",errno); - return(-1); - } - - if( ioctl(pipefd[0], I_PUSH, "connld") != 0) { - prmsg(1, "NAMEDOpenPipe: ioctl(I_PUSH,\"connld\") failed, errno=%d\n",errno); - close(pipefd[0]); - close(pipefd[1]); - return(-1); - } - - if( fattach(pipefd[0], server_path) != 0) { - prmsg(1, "NAMEDOpenPipe: fattach(%s) failed, errno=%d\n", server_path,errno); - close(pipefd[0]); - close(pipefd[1]); - return(-1); - } - - return(pipefd[1]); -} -#endif - -static int -TRANS(NAMEDOpenServer)(XtransConnInfo ciptr, const char *port) -{ -#ifdef NAMEDNODENAME - int fd; - char server_path[64]; -#endif - - prmsg(2,"NAMEDOpenServer(%s)\n", port); - -#if !defined(NAMEDNODENAME) - prmsg(1,"NAMEDOpenServer: Protocol is not supported by a NAMED connection\n"); - return -1; -#else - if ( port && *port ) { - if( *port == '/' ) { /* A full pathname */ - (void) snprintf(server_path, sizeof(server_path), "%s", port); - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%s", - NAMEDNODENAME, port); - } - } else { - (void) snprintf(server_path, sizeof(server_path), "%s%ld", - NAMEDNODENAME, (long)getpid()); - } - - fd = TRANS(NAMEDOpenPipe)(server_path); - if (fd < 0) { - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"NAMEDOpenServer: failed to fill in addr info\n"); - TRANS(LocalClose)(ciptr); - return -1; - } - - return fd; - -#endif /* !NAMEDNODENAME */ -} - -static int -TRANS(NAMEDResetListener) (XtransConnInfo ciptr) - -{ - struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; - struct stat statb; - - prmsg(2,"NAMEDResetListener(%p, %d)\n", ciptr, ciptr->fd); - - if (ciptr->fd != -1) { - /* - * see if the pipe has disappeared - */ - - if (stat (sockname->sun_path, &statb) == -1 || - (statb.st_mode & S_IFMT) != S_IFIFO) { - prmsg(3, "Pipe %s trashed, recreating\n", sockname->sun_path); - TRANS(LocalClose)(ciptr); - ciptr->fd = TRANS(NAMEDOpenPipe)(sockname->sun_path); - if (ciptr->fd >= 0) - return TRANS_RESET_NEW_FD; - else - return TRANS_CREATE_LISTENER_FAILED; - } - } - return TRANS_RESET_NOOP; -} - -static int -TRANS(NAMEDAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) - -{ - struct strrecvfd str; - - prmsg(2,"NAMEDAccept(%p->%d)\n", ciptr, ciptr->fd); - - if( ioctl(ciptr->fd, I_RECVFD, &str ) < 0 ) { - prmsg(1, "NAMEDAccept: ioctl(I_RECVFD) failed, errno=%d\n", errno); - *status = TRANS_ACCEPT_MISC_ERROR; - return(-1); - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - newciptr->family=ciptr->family; - newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { - prmsg(1, - "NAMEDAccept: failed to allocate memory for pipe addr\n"); - close(str.fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); - - newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { - prmsg(1, - "NAMEDAccept: failed to allocate memory for peer addr\n"); - free(newciptr->addr); - close(str.fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); - - *status = 0; - - return str.fd; -} - -#endif /* TRANS_SERVER */ - -#endif /* LOCAL_TRANS_NAMED */ - - - -#if defined(LOCAL_TRANS_SCO) - -/* - * connect_spipe is used by the SCO connection type. - */ -static int -connect_spipe(int fd1, int fd2) -{ - long temp; - struct strfdinsert sbuf; - - sbuf.databuf.maxlen = -1; - sbuf.databuf.len = -1; - sbuf.databuf.buf = NULL; - sbuf.ctlbuf.maxlen = sizeof(long); - sbuf.ctlbuf.len = sizeof(long); - sbuf.ctlbuf.buf = (caddr_t)&temp; - sbuf.offset = 0; - sbuf.fildes = fd2; - sbuf.flags = 0; - - if( ioctl(fd1, I_FDINSERT, &sbuf) < 0 ) - return(-1); - - return(0); -} - -/* - * named_spipe is used by the SCO connection type. - */ - -static int -named_spipe(int fd, char *path) - -{ - int oldUmask, ret; - struct stat sbuf; - - oldUmask = umask(0); - - (void) fstat(fd, &sbuf); - ret = mknod(path, 0020666, sbuf.st_rdev); - - umask(oldUmask); - - if (ret < 0) { - ret = -1; - } else { - ret = fd; - } - - return(ret); -} - -#endif /* defined(LOCAL_TRANS_SCO) */ - - - - -#ifdef LOCAL_TRANS_SCO -/* SCO */ - -/* - * 2002-11-09 (jkj@sco.com) - * - * This code has been modified to match what is in the actual SCO X server. - * This greatly helps inter-operability between X11R6 and X11R5 (the native - * SCO server). Mainly, it relies on streams nodes existing in /dev, not - * creating them or unlinking them, which breaks the native X server. - * - * However, this is only for the X protocol. For all other protocols, we - * do in fact create the nodes, as only X11R6 will use them, and this makes - * it possible to have both types of clients running, otherwise we get all - * kinds of nasty errors on startup for anything that doesnt use the X - * protocol (like SM, when KDE starts up). - */ - -#ifdef TRANS_CLIENT - -static int -TRANS(SCOOpenClient)(XtransConnInfo ciptr, const char *port) -{ -#ifdef SCORNODENAME - int fd, server, fl, ret; - char server_path[64]; - struct strbuf ctlbuf; - unsigned long alarm_time; - void (*savef)(); - long temp; - extern int getmsg(), putmsg(); -#endif - - prmsg(2,"SCOOpenClient(%s)\n", port); - if (!port || !port[0]) - port = "0"; - -#if !defined(SCORNODENAME) - prmsg(2,"SCOOpenClient: Protocol is not supported by a SCO connection\n"); - return -1; -#else - (void) sprintf(server_path, SCORNODENAME, port); - - if ((server = open(server_path, O_RDWR)) < 0) { - prmsg(1,"SCOOpenClient: failed to open %s\n", server_path); - return -1; - } - - if ((fd = open(DEV_SPX, O_RDWR)) < 0) { - prmsg(1,"SCOOpenClient: failed to open %s\n", DEV_SPX); - close(server); - return -1; - } - - (void) write(server, &server, 1); - ctlbuf.len = 0; - ctlbuf.maxlen = sizeof(long); - ctlbuf.buf = (caddr_t)&temp; - fl = 0; - - savef = signal(SIGALRM, _dummy); - alarm_time = alarm(10); - - ret = getmsg(server, &ctlbuf, 0, &fl); - - (void) alarm(alarm_time); - (void) signal(SIGALRM, savef); - - if (ret < 0) { - prmsg(1,"SCOOpenClient: error from getmsg\n"); - close(fd); - close(server); - return -1; - } - - /* The msg we got via getmsg is the result of an - * I_FDINSERT, so if we do a putmsg with whatever - * we recieved, we're doing another I_FDINSERT ... - */ - (void) putmsg(fd, &ctlbuf, 0, 0); - (void) fcntl(fd,F_SETFL,fcntl(fd,F_GETFL,0)|O_NDELAY); - - (void) close(server); - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - -#if defined(X11_t) && defined(__SCO__) - ciptr->flags |= TRANS_NOUNLINK; -#endif - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"SCOOpenClient: failed to fill addr info\n"); - close(fd); - return -1; - } - - return(fd); - -#endif /* !SCORNODENAME */ -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static int -TRANS(SCOOpenServer)(XtransConnInfo ciptr, const char *port) -{ -#ifdef SCORNODENAME - char serverR_path[64]; - char serverS_path[64]; - struct flock mylock; - int fdr = -1; - int fds = -1; -#endif - - prmsg(2,"SCOOpenServer(%s)\n", port); - if (!port || !port[0]) - port = "0"; - -#if !defined(SCORNODENAME) - prmsg(1,"SCOOpenServer: Protocol is not supported by a SCO connection\n"); - return -1; -#else - (void) sprintf(serverR_path, SCORNODENAME, port); - (void) sprintf(serverS_path, SCOSNODENAME, port); - -#if !defined(X11_t) || !defined(__SCO__) - unlink(serverR_path); - unlink(serverS_path); - - if ((fds = open(DEV_SPX, O_RDWR)) < 0 || - (fdr = open(DEV_SPX, O_RDWR)) < 0 ) { - prmsg(1,"SCOOpenServer: failed to open %s\n", DEV_SPX); - if (fds >= 0) - close(fds); - if (fdr >= 0) - close(fdr); - return -1; - } - - if (named_spipe (fds, serverS_path) == -1) { - prmsg(1,"SCOOpenServer: failed to create %s\n", serverS_path); - close (fdr); - close (fds); - return -1; - } - - if (named_spipe (fdr, serverR_path) == -1) { - prmsg(1,"SCOOpenServer: failed to create %s\n", serverR_path); - close (fdr); - close (fds); - return -1; - } -#else /* X11_t */ - - fds = open (serverS_path, O_RDWR | O_NDELAY); - if (fds < 0) { - prmsg(1,"SCOOpenServer: failed to open %s\n", serverS_path); - return -1; - } - - /* - * Lock the connection device for the duration of the server. - * This resolves multiple server starts especially on SMP machines. - */ - mylock.l_type = F_WRLCK; - mylock.l_whence = 0; - mylock.l_start = 0; - mylock.l_len = 0; - if (fcntl (fds, F_SETLK, &mylock) < 0) { - prmsg(1,"SCOOpenServer: failed to lock %s\n", serverS_path); - close (fds); - return -1; - } - - fdr = open (serverR_path, O_RDWR | O_NDELAY); - if (fdr < 0) { - prmsg(1,"SCOOpenServer: failed to open %s\n", serverR_path); - close (fds); - return -1; - } -#endif /* X11_t */ - - if (connect_spipe(fds, fdr)) { - prmsg(1,"SCOOpenServer: ioctl(I_FDINSERT) failed on %s\n", - serverS_path); - close (fdr); - close (fds); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - -#if defined(X11_t) && defined(__SCO__) - ciptr->flags |= TRANS_NOUNLINK; -#endif - if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) { - prmsg(1,"SCOOpenServer: failed to fill in addr info\n"); - close(fds); - close(fdr); - return -1; - } - - return(fds); - -#endif /* !SCORNODENAME */ -} - -static int -TRANS(SCOAccept)(XtransConnInfo ciptr, XtransConnInfo newciptr, int *status) -{ - char c; - int fd; - - prmsg(2,"SCOAccept(%d)\n", ciptr->fd); - - if (read(ciptr->fd, &c, 1) < 0) { - prmsg(1,"SCOAccept: can't read from client\n"); - *status = TRANS_ACCEPT_MISC_ERROR; - return(-1); - } - - if( (fd = open(DEV_SPX, O_RDWR)) < 0 ) { - prmsg(1,"SCOAccept: can't open \"%s\"\n",DEV_SPX); - *status = TRANS_ACCEPT_MISC_ERROR; - return(-1); - } - - if (connect_spipe (ciptr->fd, fd) < 0) { - prmsg(1,"SCOAccept: ioctl(I_FDINSERT) failed\n"); - close (fd); - *status = TRANS_ACCEPT_MISC_ERROR; - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - newciptr->addrlen=ciptr->addrlen; - if( (newciptr->addr = malloc(newciptr->addrlen)) == NULL ) { - prmsg(1, - "SCOAccept: failed to allocate memory for peer addr\n"); - close(fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->addr,ciptr->addr,newciptr->addrlen); -#if defined(__SCO__) - newciptr->flags |= TRANS_NOUNLINK; -#endif - - newciptr->peeraddrlen=newciptr->addrlen; - if( (newciptr->peeraddr = malloc(newciptr->peeraddrlen)) == NULL ) { - prmsg(1, - "SCOAccept: failed to allocate memory for peer addr\n"); - free(newciptr->addr); - close(fd); - *status = TRANS_ACCEPT_BAD_MALLOC; - return -1; - } - - memcpy(newciptr->peeraddr,newciptr->addr,newciptr->peeraddrlen); - - *status = 0; - - return(fd); -} - -#endif /* TRANS_SERVER */ -#endif /* LOCAL_TRANS_SCO */ - - - -#ifdef TRANS_REOPEN -#ifdef LOCAL_TRANS_PTS - -static int -TRANS(PTSReopenServer)(XtransConnInfo ciptr, int fd, const char *port) - -{ -#ifdef PTSNODENAME - char server_path[64]; -#endif - - prmsg(2,"PTSReopenServer(%d,%s)\n", fd, port); - -#if !defined(PTSNODENAME) - prmsg(1,"PTSReopenServer: Protocol is not supported by a pts connection\n"); - return 0; -#else - if (port && *port ) { - if( *port == '/' ) { /* A full pathname */ - snprintf(server_path, sizeof(server_path), "%s", port); - } else { - snprintf(server_path, sizeof(server_path), "%s%s", - PTSNODENAME, port); - } - } else { - snprintf(server_path, sizeof(server_path), "%s%ld", - PTSNODENAME, (long)getpid()); - } - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"PTSReopenServer: failed to fill in addr info\n"); - return 0; - } - - return 1; - -#endif /* !PTSNODENAME */ -} - -#endif /* LOCAL_TRANS_PTS */ - -#ifdef LOCAL_TRANS_NAMED - -static int -TRANS(NAMEDReopenServer)(XtransConnInfo ciptr, int fd _X_UNUSED, const char *port) - -{ -#ifdef NAMEDNODENAME - char server_path[64]; -#endif - - prmsg(2,"NAMEDReopenServer(%s)\n", port); - -#if !defined(NAMEDNODENAME) - prmsg(1,"NAMEDReopenServer: Protocol is not supported by a NAMED connection\n"); - return 0; -#else - if ( port && *port ) { - if( *port == '/' ) { /* A full pathname */ - snprintf(server_path, sizeof(server_path),"%s", port); - } else { - snprintf(server_path, sizeof(server_path), "%s%s", - NAMEDNODENAME, port); - } - } else { - snprintf(server_path, sizeof(server_path), "%s%ld", - NAMEDNODENAME, (long)getpid()); - } - - if (TRANS(FillAddrInfo) (ciptr, server_path, server_path) == 0) - { - prmsg(1,"NAMEDReopenServer: failed to fill in addr info\n"); - return 0; - } - - return 1; - -#endif /* !NAMEDNODENAME */ -} - -#endif /* LOCAL_TRANS_NAMED */ - - -#ifdef LOCAL_TRANS_SCO -static int -TRANS(SCOReopenServer)(XtransConnInfo ciptr, int fd, const char *port) - -{ -#ifdef SCORNODENAME - char serverR_path[64], serverS_path[64]; -#endif - - prmsg(2,"SCOReopenServer(%s)\n", port); - if (!port || !port[0]) - port = "0"; - -#if !defined(SCORNODENAME) - prmsg(2,"SCOReopenServer: Protocol is not supported by a SCO connection\n"); - return 0; -#else - (void) sprintf(serverR_path, SCORNODENAME, port); - (void) sprintf(serverS_path, SCOSNODENAME, port); - -#if defined(X11_t) && defined(__SCO__) - ciptr->flags |= TRANS_NOUNLINK; -#endif - if (TRANS(FillAddrInfo) (ciptr, serverS_path, serverR_path) == 0) - { - prmsg(1, "SCOReopenServer: failed to fill in addr info\n"); - return 0; - } - - return 1; - -#endif /* SCORNODENAME */ -} - -#endif /* LOCAL_TRANS_SCO */ - -#endif /* TRANS_REOPEN */ - - - -/* - * This table contains all of the entry points for the different local - * connection mechanisms. - */ - -typedef struct _LOCALtrans2dev { - const char *transname; - -#ifdef TRANS_CLIENT - - int (*devcotsopenclient)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - - int (*devcotsopenserver)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_CLIENT - - int (*devcltsopenclient)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_CLIENT */ - -#ifdef TRANS_SERVER - - int (*devcltsopenserver)( - XtransConnInfo, const char * /*port*/ -); - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - - int (*devcotsreopenserver)( - XtransConnInfo, - int, /* fd */ - const char * /* port */ -); - - int (*devcltsreopenserver)( - XtransConnInfo, - int, /* fd */ - const char * /* port */ -); - -#endif /* TRANS_REOPEN */ - -#ifdef TRANS_SERVER - - int (*devreset)( - XtransConnInfo /* ciptr */ -); - - int (*devaccept)( - XtransConnInfo, XtransConnInfo, int * -); - -#endif /* TRANS_SERVER */ - -} LOCALtrans2dev; - -static LOCALtrans2dev LOCALtrans2devtab[] = { -#ifdef LOCAL_TRANS_PTS -{"", -#ifdef TRANS_CLIENT - TRANS(PTSOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(PTSOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(PTSReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(PTSAccept) -#endif /* TRANS_SERVER */ -}, - -{"local", -#ifdef TRANS_CLIENT - TRANS(PTSOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(PTSOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(PTSReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(PTSAccept) -#endif /* TRANS_SERVER */ -}, - -{"pts", -#ifdef TRANS_CLIENT - TRANS(PTSOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(PTSOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(PTSReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(PTSAccept) -#endif /* TRANS_SERVER */ -}, -#else /* !LOCAL_TRANS_PTS */ -{"", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, - -{"local", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, -#endif /* !LOCAL_TRANS_PTS */ - -#ifdef LOCAL_TRANS_NAMED -{"named", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, - -#ifdef __sun /* Alias "pipe" to named, since that's what Solaris called it */ -{"pipe", -#ifdef TRANS_CLIENT - TRANS(NAMEDOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(NAMEDOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(NAMEDReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - TRANS(NAMEDResetListener), - TRANS(NAMEDAccept) -#endif /* TRANS_SERVER */ -}, -#endif /* __sun */ -#endif /* LOCAL_TRANS_NAMED */ - - -#ifdef LOCAL_TRANS_SCO -{"sco", -#ifdef TRANS_CLIENT - TRANS(SCOOpenClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(SCOOpenServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(OpenFail), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - TRANS(OpenFail), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SCOReopenServer), - TRANS(ReopenFail), -#endif -#ifdef TRANS_SERVER - NULL, /* ResetListener */ - TRANS(SCOAccept) -#endif /* TRANS_SERVER */ -}, -#endif /* LOCAL_TRANS_SCO */ -}; - -#define NUMTRANSPORTS (sizeof(LOCALtrans2devtab)/sizeof(LOCALtrans2dev)) - -static const char *XLOCAL=NULL; -static char *workingXLOCAL=NULL; -static char *freeXLOCAL=NULL; - -#if defined(__SCO__) -#define DEF_XLOCAL "SCO:UNIX:PTS" -#elif defined(__UNIXWARE__) -#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" -#elif defined(__sun) -#define DEF_XLOCAL "UNIX:NAMED" -#else -#define DEF_XLOCAL "UNIX:PTS:NAMED:SCO" -#endif - -static void -TRANS(LocalInitTransports)(const char *protocol) - -{ - prmsg(3,"LocalInitTransports(%s)\n", protocol); - - if( strcmp(protocol,"local") && strcmp(protocol,"LOCAL") ) - { - workingXLOCAL = freeXLOCAL = strdup (protocol); - } - else { - XLOCAL=(char *)getenv("XLOCAL"); - if(XLOCAL==NULL) - XLOCAL=DEF_XLOCAL; - workingXLOCAL = freeXLOCAL = strdup (XLOCAL); - } -} - -static void -TRANS(LocalEndTransports)(void) - -{ - prmsg(3,"LocalEndTransports()\n"); - free(freeXLOCAL); -} - -#define TYPEBUFSIZE 32 - -#ifdef TRANS_CLIENT - -static LOCALtrans2dev * -TRANS(LocalGetNextTransport)(void) - -{ - int i,j; - char *typetocheck; - char typebuf[TYPEBUFSIZE]; - prmsg(3,"LocalGetNextTransport()\n"); - - while(1) - { - if( workingXLOCAL == NULL || *workingXLOCAL == '\0' ) - return NULL; - - typetocheck=workingXLOCAL; - workingXLOCAL=strchr(workingXLOCAL,':'); - if(workingXLOCAL && *workingXLOCAL) - *workingXLOCAL++='\0'; - - for(i=0;i -#endif - -/* - * Make sure 'host' is really local. - */ - -static int -HostReallyLocal (const char *host) - -{ - /* - * The 'host' passed to this function may have been generated - * by either uname() or gethostname(). We try both if possible. - */ - -#ifdef NEED_UTSNAME - struct utsname name; -#endif - char buf[256]; - -#ifdef NEED_UTSNAME - if (uname (&name) >= 0 && strcmp (host, name.nodename) == 0) - return (1); -#endif - - buf[0] = '\0'; - (void) gethostname (buf, 256); - buf[255] = '\0'; - - if (strcmp (host, buf) == 0) - return (1); - - return (0); -} - - -static XtransConnInfo -TRANS(LocalOpenClient)(int type, const char *protocol, - const char *host, const char *port) - -{ - LOCALtrans2dev *transptr; - XtransConnInfo ciptr; - int index; - - prmsg(3,"LocalOpenClient()\n"); - - /* - * Make sure 'host' is really local. If not, we return failure. - * The reason we make this check is because a process may advertise - * a "local" address for which it can accept connections, but if a - * process on a remote machine tries to connect to this address, - * we know for sure it will fail. - */ - - if (strcmp (host, "unix") != 0 && !HostReallyLocal (host)) - { - prmsg (1, - "LocalOpenClient: Cannot connect to non-local host %s\n", - host); - return NULL; - } - - -#if defined(X11_t) - /* - * X has a well known port, that is transport dependant. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the idisplay - * from ConnectDisplay(). Since that is what we want for the local transports, - * we don't have to do anything special. - */ -#endif /* X11_t */ - - if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) - { - prmsg(1,"LocalOpenClient: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - return NULL; - } - - ciptr->fd = -1; - - TRANS(LocalInitTransports)(protocol); - - index = 0; - for(transptr=TRANS(LocalGetNextTransport)(); - transptr!=NULL;transptr=TRANS(LocalGetNextTransport)(), index++) - { - switch( type ) - { - case XTRANS_OPEN_COTS_CLIENT: - ciptr->fd=transptr->devcotsopenclient(ciptr,port); - break; - case XTRANS_OPEN_COTS_SERVER: - prmsg(1, - "LocalOpenClient: Should not be opening a server with this function\n"); - break; - default: - prmsg(1, - "LocalOpenClient: Unknown Open type %d\n", - type); - } - if( ciptr->fd >= 0 ) - break; - } - - TRANS(LocalEndTransports)(); - - if( ciptr->fd < 0 ) - { - free(ciptr); - return NULL; - } - - ciptr->priv=(char *)transptr; - ciptr->index = index; - - return ciptr; -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(LocalOpenServer)(int type, const char *protocol, - const char *host _X_UNUSED, const char *port) - -{ - int i; - XtransConnInfo ciptr; - - prmsg(2,"LocalOpenServer(%d,%s,%s)\n", type, protocol, port); - -#if defined(X11_t) - /* - * For X11, the port will be in the format xserverN where N is the - * display number. All of the local connections just need to know - * the display number because they don't do any name resolution on - * the port. This just truncates port to the display portion. - */ -#endif /* X11_t */ - - if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) - { - prmsg(1,"LocalOpenServer: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - return NULL; - } - - for(i=1;ifd=LOCALtrans2devtab[i].devcotsopenserver(ciptr,port); - break; - default: - prmsg(1,"LocalOpenServer: Unknown Open type %d\n", - type ); - } - if( ciptr->fd >= 0 ) { - ciptr->priv=(char *)&LOCALtrans2devtab[i]; - ciptr->index=i; - ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); - return ciptr; - } - } - - free(ciptr); - return NULL; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(LocalReopenServer)(int type, int index, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int stat = 0; - - prmsg(2,"LocalReopenServer(%d,%d,%d)\n", type, index, fd); - - if( (ciptr = calloc(1,sizeof(struct _XtransConnInfo))) == NULL ) - { - prmsg(1,"LocalReopenServer: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - return NULL; - } - - ciptr->fd = fd; - - switch( type ) - { - case XTRANS_OPEN_COTS_SERVER: - stat = LOCALtrans2devtab[index].devcotsreopenserver(ciptr,fd,port); - break; - default: - prmsg(1,"LocalReopenServer: Unknown Open type %d\n", - type ); - } - - if( stat > 0 ) { - ciptr->priv=(char *)&LOCALtrans2devtab[index]; - ciptr->index=index; - ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); - return ciptr; - } - - free(ciptr); - return NULL; -} - -#endif /* TRANS_REOPEN */ - - - -/* - * This is the Local implementation of the X Transport service layer - */ - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(LocalOpenCOTSClient)(Xtransport *thistrans _X_UNUSED, const char *protocol, - const char *host, const char *port) - -{ - prmsg(2,"LocalOpenCOTSClient(%s,%s,%s)\n",protocol,host,port); - - return TRANS(LocalOpenClient)(XTRANS_OPEN_COTS_CLIENT, protocol, host, port); -} - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(LocalOpenCOTSServer)(Xtransport *thistrans, const char *protocol, - const char *host, const char *port) - -{ - char *typetocheck = NULL; - int found = 0; - char typebuf[TYPEBUFSIZE]; - - prmsg(2,"LocalOpenCOTSServer(%s,%s,%s)\n",protocol,host,port); - - /* Check if this local type is in the XLOCAL list */ - TRANS(LocalInitTransports)("local"); - typetocheck = workingXLOCAL; - while (typetocheck && !found) { - int j; - - workingXLOCAL = strchr(workingXLOCAL, ':'); - if (workingXLOCAL && *workingXLOCAL) - *workingXLOCAL++ = '\0'; - strncpy(typebuf, typetocheck, TYPEBUFSIZE); - for (j = 0; j < TYPEBUFSIZE; j++) - if (isupper(typebuf[j])) - typebuf[j] = tolower(typebuf[j]); - if (!strcmp(thistrans->TransName, typebuf)) - found = 1; - typetocheck = workingXLOCAL; - } - TRANS(LocalEndTransports)(); - - if (!found) { - prmsg(3,"LocalOpenCOTSServer: disabling %s\n",thistrans->TransName); - thistrans->flags |= TRANS_DISABLED; - return NULL; - } - - return TRANS(LocalOpenServer)(XTRANS_OPEN_COTS_SERVER, protocol, host, port); -} - -#endif /* TRANS_SERVER */ - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(LocalReopenCOTSServer)(Xtransport *thistrans, int fd, const char *port) - -{ - int index; - - prmsg(2,"LocalReopenCOTSServer(%d,%s)\n", fd, port); - - for(index=1;indexTransName, - LOCALtrans2devtab[index].transname) == 0 ) - break; - } - - if (index >= NUMTRANSPORTS) - { - return (NULL); - } - - return TRANS(LocalReopenServer)(XTRANS_OPEN_COTS_SERVER, - index, fd, port); -} - -#endif /* TRANS_REOPEN */ - - - -static int -TRANS(LocalSetOption)(XtransConnInfo ciptr, int option, int arg) - -{ - prmsg(2,"LocalSetOption(%d,%d,%d)\n",ciptr->fd,option,arg); - - return -1; -} - - -#ifdef TRANS_SERVER - -static int -TRANS(LocalCreateListener)(XtransConnInfo ciptr, const char *port, - unsigned int flags _X_UNUSED) - -{ - prmsg(2,"LocalCreateListener(%p->%d,%s)\n",ciptr,ciptr->fd,port); - - return 0; -} - -static int -TRANS(LocalResetListener)(XtransConnInfo ciptr) - -{ - LOCALtrans2dev *transptr; - - prmsg(2,"LocalResetListener(%p)\n",ciptr); - - transptr=(LOCALtrans2dev *)ciptr->priv; - if (transptr->devreset != NULL) { - return transptr->devreset(ciptr); - } - return TRANS_RESET_NOOP; -} - - -static XtransConnInfo -TRANS(LocalAccept)(XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - LOCALtrans2dev *transptr; - - prmsg(2,"LocalAccept(%p->%d)\n", ciptr, ciptr->fd); - - transptr=(LOCALtrans2dev *)ciptr->priv; - - if( (newciptr = calloc(1,sizeof(struct _XtransConnInfo)))==NULL ) - { - prmsg(1,"LocalAccept: calloc(1,%lu) failed\n", - sizeof(struct _XtransConnInfo)); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - newciptr->fd=transptr->devaccept(ciptr,newciptr,status); - - if( newciptr->fd < 0 ) - { - free(newciptr); - return NULL; - } - - newciptr->priv=(char *)transptr; - newciptr->index = ciptr->index; - - *status = 0; - - return newciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -static int -TRANS(LocalConnect)(XtransConnInfo ciptr, - const char *host _X_UNUSED, const char *port) - -{ - prmsg(2,"LocalConnect(%p->%d,%s)\n", ciptr, ciptr->fd, port); - - return 0; -} - -#endif /* TRANS_CLIENT */ - - -static int -TRANS(LocalBytesReadable)(XtransConnInfo ciptr, BytesReadable_t *pend ) - -{ - prmsg(2,"LocalBytesReadable(%p->%d,%p)\n", ciptr, ciptr->fd, pend); - -#if defined(SCO325) - return ioctl(ciptr->fd, I_NREAD, (char *)pend); -#else - return ioctl(ciptr->fd, FIONREAD, (char *)pend); -#endif -} - -static int -TRANS(LocalRead)(XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg(2,"LocalRead(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return read(ciptr->fd,buf,size); -} - -static int -TRANS(LocalWrite)(XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg(2,"LocalWrite(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return write(ciptr->fd,buf,size); -} - -static int -TRANS(LocalReadv)(XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg(2,"LocalReadv(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return READV(ciptr,buf,size); -} - -static int -TRANS(LocalWritev)(XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg(2,"LocalWritev(%d,%p,%d)\n", ciptr->fd, buf, size ); - - return WRITEV(ciptr,buf,size); -} - -static int -TRANS(LocalDisconnect)(XtransConnInfo ciptr) - -{ - prmsg(2,"LocalDisconnect(%p->%d)\n", ciptr, ciptr->fd); - - return 0; -} - -static int -TRANS(LocalClose)(XtransConnInfo ciptr) - -{ - struct sockaddr_un *sockname=(struct sockaddr_un *) ciptr->addr; - int ret; - - prmsg(2,"LocalClose(%p->%d)\n", ciptr, ciptr->fd ); - - ret=close(ciptr->fd); - - if(ciptr->flags - && sockname - && sockname->sun_family == AF_UNIX - && sockname->sun_path[0] ) - { - if (!(ciptr->flags & TRANS_NOUNLINK)) - unlink(sockname->sun_path); - } - - return ret; -} - -static int -TRANS(LocalCloseForCloning)(XtransConnInfo ciptr) - -{ - int ret; - - prmsg(2,"LocalCloseForCloning(%p->%d)\n", ciptr, ciptr->fd ); - - /* Don't unlink path */ - - ret=close(ciptr->fd); - - return ret; -} - - -/* - * MakeAllCOTSServerListeners() will go through the entire Xtransports[] - * array defined in Xtrans.c and try to OpenCOTSServer() for each entry. - * We will add duplicate entries to that table so that the OpenCOTSServer() - * function will get called once for each type of local transport. - * - * The TransName is in lowercase, so it will never match during a normal - * call to SelectTransport() in Xtrans.c. - */ - -#ifdef TRANS_SERVER -static const char * local_aliases[] = { -# ifdef LOCAL_TRANS_PTS - "pts", -# endif - "named", -# ifdef __sun - "pipe", /* compatibility with Solaris Xlib */ -# endif -# ifdef LOCAL_TRANS_SCO - "sco", -# endif - NULL }; -#endif - -Xtransport TRANS(LocalFuncs) = { - /* Local Interface */ - "local", - TRANS_ALIAS | TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - local_aliases, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; - -#ifdef LOCAL_TRANS_PTS - -Xtransport TRANS(PTSFuncs) = { - /* Local Interface */ - "pts", - TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; - -#endif /* LOCAL_TRANS_PTS */ - -#ifdef LOCAL_TRANS_NAMED - -Xtransport TRANS(NAMEDFuncs) = { - /* Local Interface */ - "named", - TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; - -#ifdef __sun -Xtransport TRANS(PIPEFuncs) = { - /* Local Interface */ - "pipe", - TRANS_ALIAS | TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; -#endif /* __sun */ -#endif /* LOCAL_TRANS_NAMED */ - - -#ifdef LOCAL_TRANS_SCO -Xtransport TRANS(SCOFuncs) = { - /* Local Interface */ - "sco", - TRANS_LOCAL, -#ifdef TRANS_CLIENT - TRANS(LocalOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(LocalOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(LocalReopenCOTSServer), -#endif - TRANS(LocalSetOption), -#ifdef TRANS_SERVER - TRANS(LocalCreateListener), - TRANS(LocalResetListener), - TRANS(LocalAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(LocalConnect), -#endif /* TRANS_CLIENT */ - TRANS(LocalBytesReadable), - TRANS(LocalRead), - TRANS(LocalWrite), - TRANS(LocalReadv), - TRANS(LocalWritev), -#if XTRANS_SEND_FDS - TRANS(LocalSendFdInvalid), - TRANS(LocalRecvFdInvalid), -#endif - TRANS(LocalDisconnect), - TRANS(LocalClose), - TRANS(LocalCloseForCloning), -}; -#endif /* LOCAL_TRANS_SCO */ diff --git a/nx-X11/lib/xtrans/Xtranssock.c b/nx-X11/lib/xtrans/Xtranssock.c deleted file mode 100644 index dff217e9d..000000000 --- a/nx-X11/lib/xtrans/Xtranssock.c +++ /dev/null @@ -1,3554 +0,0 @@ -/**************************************************************************/ -/* */ -/* Copyright (c) 2001, 2011 NoMachine (http://www.nomachine.com) */ -/* Copyright (c) 2008-2014 Oleksandr Shneyder */ -/* Copyright (c) 2011-2016 Mike Gabriel */ -/* Copyright (c) 2014-2016 Mihai Moldovan */ -/* Copyright (c) 2014-2016 Ulrich Sibiller */ -/* Copyright (c) 2015-2016 Qindel Group (http://www.qindel.com) */ -/* */ -/* nx-X11, NX protocol compression and NX extensions to this software */ -/* are copyright of the aforementioned persons and companies. */ -/* */ -/* Redistribution and use of the present software is allowed according */ -/* to terms specified in the file LICENSE which comes in the source */ -/* distribution. */ -/* */ -/* All rights reserved. */ -/* */ -/* NOTE: This software has received contributions from various other */ -/* contributors, only the core maintainers and supporters are listed as */ -/* copyright holders. Please contact us, if you feel you should be listed */ -/* as copyright holder, as well. */ -/* */ -/**************************************************************************/ - -/* - * Copyright (c) 2002, Oracle and/or its affiliates. All rights reserved. - * - * Permission is hereby granted, free of charge, to any person obtaining a - * copy of this software and associated documentation files (the "Software"), - * to deal in the Software without restriction, including without limitation - * the rights to use, copy, modify, merge, publish, distribute, sublicense, - * and/or sell copies of the Software, and to permit persons to whom the - * Software is furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice (including the next - * paragraph) shall be included in all copies or substantial portions of the - * Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR - * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL - * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER - * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING - * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of the copyright holders shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from the copyright holders. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -#ifdef NX_TRANS_SOCKET - -#ifdef NX_TRANS_DEBUG -#define XTRANSDEBUG 5 -#endif - -#ifndef PF_LOCAL -#define PF_LOCAL PF_UNIX -#endif - -#endif - -#include -#ifdef XTHREADS -#include -#endif - -#ifndef WIN32 - -#if defined(TCPCONN) || defined(UNIXCONN) -#include -#include -#include -#endif - -#if defined(TCPCONN) || defined(UNIXCONN) -#define X_INCLUDE_NETDB_H -#define XOS_USE_NO_LOCKING -#include -#endif - -#ifdef UNIXCONN -#ifndef X_NO_SYS_UN -#include -#endif -#include -#endif - - -#ifndef NO_TCP_H -#if defined(linux) || defined(__GLIBC__) -#include -#endif /* linux || __GLIBC__ */ -#if defined(__NetBSD__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__DragonFly__) -#include -#include -#endif /* __NetBSD__ || __OpenBSD__ || __FreeBSD__ || __DragonFly__ */ -#include -#endif /* !NO_TCP_H */ - -#include -#if defined(SVR4) || defined(__SVR4) -#include -#endif - -#include - -#else /* !WIN32 */ - -#include -#include -#include -#undef close -#define close closesocket -#define ECONNREFUSED WSAECONNREFUSED -#define EADDRINUSE WSAEADDRINUSE -#define EPROTOTYPE WSAEPROTOTYPE -#undef EWOULDBLOCK -#define EWOULDBLOCK WSAEWOULDBLOCK -#define EINPROGRESS WSAEINPROGRESS -#undef EINTR -#define EINTR WSAEINTR -#define X_INCLUDE_NETDB_H -#define XOS_USE_MTSAFE_NETDBAPI -#include -#endif /* WIN32 */ - -#if defined(SO_DONTLINGER) && defined(SO_LINGER) -#undef SO_DONTLINGER -#endif - -/* others don't need this */ -#define SocketInitOnce() /**/ - -#ifdef linux -#define HAVE_ABSTRACT_SOCKETS -#endif - -#define MIN_BACKLOG 128 -#ifdef SOMAXCONN -#if SOMAXCONN > MIN_BACKLOG -#define BACKLOG SOMAXCONN -#endif -#endif -#ifndef BACKLOG -#define BACKLOG MIN_BACKLOG -#endif - -/* - * This is the Socket implementation of the X Transport service layer - * - * This file contains the implementation for both the UNIX and INET domains, - * and can be built for either one, or both. - * - */ - -typedef struct _Sockettrans2dev { - const char *transname; - int family; - int devcotsname; - int devcltsname; - int protocol; -} Sockettrans2dev; - -static Sockettrans2dev Sockettrans2devtab[] = { -#ifdef TCPCONN - {"inet",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, -#if !defined(IPv6) || !defined(AF_INET6) - {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, -#else /* IPv6 */ - {"tcp",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, - {"tcp",AF_INET,SOCK_STREAM,SOCK_DGRAM,0}, /* fallback */ - {"inet6",AF_INET6,SOCK_STREAM,SOCK_DGRAM,0}, -#endif -#endif /* TCPCONN */ -#ifdef UNIXCONN - {"unix",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, -#if !defined(LOCALCONN) - {"local",AF_UNIX,SOCK_STREAM,SOCK_DGRAM,0}, -#endif /* !LOCALCONN */ -#endif /* UNIXCONN */ -}; - -#define NUMSOCKETFAMILIES (sizeof(Sockettrans2devtab)/sizeof(Sockettrans2dev)) - -#ifdef TCPCONN -static int TRANS(SocketINETClose) (XtransConnInfo ciptr); -#endif - -#ifdef UNIXCONN - - -#if defined(X11_t) -#define UNIX_PATH "/tmp/.X11-unix/X" -#define UNIX_DIR "/tmp/.X11-unix" -#endif /* X11_t */ -#if defined(XIM_t) -#define UNIX_PATH "/tmp/.XIM-unix/XIM" -#define UNIX_DIR "/tmp/.XIM-unix" -#endif /* XIM_t */ -#if defined(FS_t) || defined(FONT_t) -#define UNIX_PATH "/tmp/.font-unix/fs" -#define UNIX_DIR "/tmp/.font-unix" -#endif /* FS_t || FONT_t */ -#if defined(ICE_t) -#define UNIX_PATH "/tmp/.ICE-unix/" -#define UNIX_DIR "/tmp/.ICE-unix" -#endif /* ICE_t */ - - -#endif /* UNIXCONN */ - -#define PORTBUFSIZE 32 - -#ifndef MAXHOSTNAMELEN -#define MAXHOSTNAMELEN 255 -#endif - -#if defined HAVE_SOCKLEN_T || (defined(IPv6) && defined(AF_INET6)) -# define SOCKLEN_T socklen_t -#elif defined(SVR4) || defined(__SVR4) || defined(__SCO__) -# define SOCKLEN_T size_t -#else -# define SOCKLEN_T int -#endif - -#ifndef X11_t - -/* - * No NX changes if this is not - * compiled as a X11 transport. - */ - -#undef NX_TRANS_SOCKET - -#endif - -#ifdef NX_TRANS_SOCKET - -#if XTRANS_SEND_FDS - #error XTRANS_SEND_FDS is unsupported for NX! -#endif - -#ifdef TRANS_CLIENT - -#include - -typedef struct -{ - XtransConnInfo info; - int local; - int remote; - int congestion; - -} _NXProxyConnInfo; - -#define NX_PROXY_CONN_LIMIT 256 - -static _NXProxyConnInfo *_NXProxyConnInfoTab[NX_PROXY_CONN_LIMIT]; - -#endif /* #ifdef TRANS_CLIENT */ - -static char *_NXGetUnixDir(char *dir); -static char *_NXGetUnixPath(char *path); - -/* - * Forcibly close any connection attempt on the - * listening socket. Need this to avoid loopback - * connections to the agent server. - */ - -#ifdef TRANS_SERVER - -void TRANS(SocketRejectConnection) (XtransConnInfo ciptr) -{ - socklen_t sa_l = sizeof(struct sockaddr); - struct sockaddr sa; - fd_set fs; - struct timeval t; - int f; - - prmsg (3, "SocketRejectConnection(%p)\n", (void *) ciptr); - - FD_ZERO(&fs); - FD_SET(ciptr -> fd, &fs); - - t.tv_sec = 0; - t.tv_usec = 0; - - /* - * Check if there is an awaiting connection. - */ - - if (select(ciptr -> fd + 1, &fs, NULL, NULL, &t) == 1) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketRejectConnection: Accepting connection attempt on fd [%d].\n", - ciptr -> fd); -#endif - /* - * If there is one, close it. - */ - - if ((f = accept(ciptr -> fd, &sa, &sa_l)) >= 0) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketRejectConnection: Closing connection attempt on fd [%d].\n", - ciptr -> fd); -#endif - close(f); - } - } -} - -#endif /* #ifdef TRANS_SERVER */ - -#ifdef TRANS_CLIENT - -void *TRANS(SocketProxyConnInfo) (XtransConnInfo ciptr) -{ - if (_NXProxyConnInfoTab[ciptr->fd] != NULL) - { - return ciptr->priv; - } - - return NULL; -} - -static XtransConnInfo TRANS(SocketCreateConnInfo) () -{ - XtransConnInfo ciptr; - - int fds[2]; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCreateConnInfo: Going to create the NX connection info.\n"); -#endif - - if ((ciptr = (XtransConnInfo) calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketCreateConnInfo: malloc failed\n"); - return NULL; - } - - /* - * Create a pair of sockets. We'll communicate with - * the NX proxy by reading and writing to our end. - */ - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCreateConnInfo: Going to create the NX socketpair.\n"); -#endif - - if (socketpair(PF_LOCAL, SOCK_STREAM, 0, fds) < 0) - { - prmsg (1, "SocketCreateConnInfo: socketpair() failed.\n"); - free ((char *) ciptr); - return NULL; - } - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCreateConnInfo: X socket end is [%d] NX proxy end is [%d].\n", - fds[0], fds[1]); -#endif - - /* - * Save in _NXProxyConnInfoTab the local and remote end of - * the socketpair. The remote end will be used by the proxy. - * When the memory-to-memory transport is activated, the - * agent and the proxy don't read or write to the real des- - * criptors but the communication takes place by reading - * and writing to the proxy's buffers. - */ - - ciptr->fd = fds[0]; - - if (ciptr->fd >= NX_PROXY_CONN_LIMIT) - { - prmsg (1, "SocketCreateConnInfo: No space for a new _NXProxyConnInfo for [%d].\n", - ciptr->fd); - free ((char *) ciptr); - return NULL; - } - else if (_NXProxyConnInfoTab[ciptr->fd] != NULL) - { - prmsg (1, "SocketCreateConnInfo: _NXProxyConnInfo for [%d] is not NULL. Exiting.\n", - ciptr->fd); - exit(1); - } - - _NXProxyConnInfoTab[ciptr->fd] = (_NXProxyConnInfo *) calloc(1, sizeof(_NXProxyConnInfo)); - - if (_NXProxyConnInfoTab[ciptr->fd] == NULL) - { - prmsg (1, "SocketCreateConnInfo: Alloc of _NXProxyConnInfo failed.\n"); - free ((char *) ciptr); - return NULL; - } - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCreateConnInfo: Allocated new _NXProxyConnInfo for [%d].\n", - ciptr->fd); -#endif - - _NXProxyConnInfoTab[ciptr->fd]->info = ciptr; - _NXProxyConnInfoTab[ciptr->fd]->local = fds[0]; - _NXProxyConnInfoTab[ciptr->fd]->remote = fds[1]; - _NXProxyConnInfoTab[ciptr->fd]->congestion = 0; - - ciptr->priv = (char *) _NXProxyConnInfoTab[ciptr->fd]; - - return ciptr; -} - -static int TRANS(SocketConnectConnInfo) (XtransConnInfo ciptr, const char *host, const char *port) -{ - int fds[2]; - char display[1024]; - - _NXProxyConnInfo *proxy_conn; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketConnectConnInfo: Going to connect NX fd [%d] to host [%s] port [%s].\n", - ciptr->fd, host, port); -#endif - - /* - * We should have already created the socket pair. - */ - - proxy_conn = (_NXProxyConnInfo *) ciptr->priv; - - if (proxy_conn == NULL) - { - prmsg (1, "SocketConnectConnInfo: Pointer to _NXProxyConnInfo is NULL. Exiting.\n"); - - exit(1); - } - else if (_NXProxyConnInfoTab[ciptr->fd] != (_NXProxyConnInfo *) ciptr->priv) - { - prmsg (1, "SocketConnectConnInfo: Can't find _NXProxyConnInfo in table. Exiting.\n"); - - exit(1); - } - - if (strlen(host) + strlen(port) + 1 >= 1023) - { - prmsg (1, "SocketConnectConnInfo: Length of NX display string '%s:%s' would exceed %d characters.\n", - host, port, 1023); - - return TRANS_CONNECT_FAILED; - } - - sprintf(display, "%s:%s", host, port); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketConnectConnInfo: Setting close-on-exec flag on local NX descriptor [%d].\n", - proxy_conn -> local); -#endif - -#ifdef F_SETFD -#ifdef FD_CLOEXEC - if (fcntl(proxy_conn -> local, F_SETFD, FD_CLOEXEC) != 0) -#else - if (fcntl(proxy_conn -> local, F_SETFD, 1) != 0) -#endif -#endif - { - prmsg (1, "SocketConnectConnInfo: Cannot set close-on-exec on local NX descriptor [%d].\n", - proxy_conn -> local); - - return TRANS_CONNECT_FAILED; - } - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketConnectConnInfo: Creating the NX transport with display [%s].\n", - display); -#endif - - if (NXTransCreate(NX_FD_ANY, NX_MODE_CLIENT, display) < 0) - { - prmsg (1, "SocketConnectConnInfo: Cannot create the NX transport.\n"); - - return TRANS_CONNECT_FAILED; - } - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketConnectConnInfo: Starting the NX agent with descriptor [%d].\n", - proxy_conn -> remote); -#endif - - fds[0] = proxy_conn -> local; - fds[1] = proxy_conn -> remote; - - NXTransAgent(fds); - - return 0; -} - -static void TRANS(SocketCloseConnInfo) (XtransConnInfo ciptr) -{ - _NXProxyConnInfo *proxy_conn; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCloseConnInfo: Going to close the NX fd [%d].\n", ciptr->fd); -#endif - - proxy_conn = (_NXProxyConnInfo *) ciptr->priv; - - if (proxy_conn == NULL) - { - prmsg (1, "SocketCloseConnInfo: Pointer to _NXProxyConnInfo is NULL. Exiting.\n"); - - exit(1); - } - else if (ciptr->fd >= NX_PROXY_CONN_LIMIT || - _NXProxyConnInfoTab[ciptr->fd] != (_NXProxyConnInfo *) ciptr->priv) - { - prmsg (1, "SocketCloseConnInfo: Can't find _NXProxyConnInfo in table. Exiting.\n"); - exit(1); - } - else if (_NXProxyConnInfoTab[ciptr->fd] -> info != ciptr || - _NXProxyConnInfoTab[ciptr->fd] -> local != ciptr->fd) - { - prmsg (1, "SocketCloseConnInfo: Invalid _NXProxyConnInfo structure for [%d]. Exiting.\n", - ciptr->fd); - exit(1); - } - else if (proxy_conn->local < 0 || proxy_conn->remote < 0) - { - prmsg (1, "SocketCloseConnInfo: Invalid socket pair in NX connection for [%d]. Exiting.\n", - ciptr->fd); - exit(1); - } - - NXTransClose(ciptr->fd); - - /* - * Get rid of the _NXProxyConnInfo structure. - */ - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCloseConnInfo: Freeing _NXProxyConnInfo structure for [%d].\n", - ciptr->fd); -#endif - - free((char *) _NXProxyConnInfoTab[ciptr->fd]); - - _NXProxyConnInfoTab[ciptr->fd] = NULL; - - ciptr->priv = NULL; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCloseConnInfo: Should now close the local descriptor [%d].\n", - ciptr->fd); -#endif -} - -#endif /* #ifdef TRANS_CLIENT */ - -#if defined(TRANS_CLIENT) && defined(NX_TRANS_CHANGE) - -/* - * Check the congestion state of the NX transport - * and return 1 if there has been a change. This - * can be extended by adding a few counters track- - * ing the bandwidth usage of the X11 connection. - */ - -int TRANS(SocketCongestionChange) (XtransConnInfo ciptr, int *state) -{ - int congestion; - - _NXProxyConnInfo *proxy_conn; - - prmsg (3, "SocketCongestionChange(%p)\n", (void *) ciptr); - - proxy_conn = (_NXProxyConnInfo *) ciptr->priv; - - if (proxy_conn == NULL) - { -#ifdef NX_TRANS_DEBUG - fprintf(stderr, "SocketCongestionChange: Descriptor [%d] doesn't appear to be a NX connection.\n", - ciptr->fd); -#endif - return 0; - } - -#ifdef NX_TRANS_DEBUG - fprintf(stderr, "SocketCongestionChange: Checking congestion on fd [%d] with old state [%d].\n", - ciptr->fd, proxy_conn->congestion); -#endif - - congestion = NXTransCongestion(ciptr->fd); - - if (congestion != proxy_conn->congestion) - { - proxy_conn->congestion = congestion; - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCongestionChange: Change detected on fd [%d] with new state [%d].\n", - ciptr->fd, proxy_conn->congestion); -#endif - return 1; - } - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketCongestionChange: No change on fd [%d] with current state [%d].\n", - ciptr->fd, congestion); -#endif - return 0; -} - -#endif /* #if defined(TRANS_CLIENT) && defined(NX_TRANS_CHANGE) */ - -#endif /* #ifdef NX_TRANS_SOCKET */ - -/* - * These are some utility function used by the real interface function below. - */ - -static int -TRANS(SocketSelectFamily) (int first, const char *family) - -{ - int i; - - prmsg (3,"SocketSelectFamily(%s)\n", family); - - for (i = first + 1; i < NUMSOCKETFAMILIES;i++) - { - if (!strcmp (family, Sockettrans2devtab[i].transname)) - return i; - } - - return (first == -1 ? -2 : -1); -} - - -/* - * This function gets the local address of the socket and stores it in the - * XtransConnInfo structure for the connection. - */ - -static int -TRANS(SocketINETGetAddr) (XtransConnInfo ciptr) - -{ -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_storage socknamev6; -#else - struct sockaddr_in socknamev4; -#endif - void *socknamePtr; - SOCKLEN_T namelen; - - prmsg (3,"SocketINETGetAddr(%p)\n", (void *) ciptr); - -#if defined(IPv6) && defined(AF_INET6) - namelen = sizeof(socknamev6); - socknamePtr = &socknamev6; -#else - namelen = sizeof(socknamev4); - socknamePtr = &socknamev4; -#endif - - bzero(socknamePtr, namelen); - - if (getsockname (ciptr->fd,(struct sockaddr *) socknamePtr, - (void *)&namelen) < 0) - { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (1,"SocketINETGetAddr: getsockname() failed: %d\n", - EGET()); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if ((ciptr->addr = malloc (namelen)) == NULL) - { - prmsg (1, - "SocketINETGetAddr: Can't allocate space for the addr\n"); - return -1; - } - -#if defined(IPv6) && defined(AF_INET6) - ciptr->family = ((struct sockaddr *)socknamePtr)->sa_family; -#else - ciptr->family = socknamev4.sin_family; -#endif - ciptr->addrlen = namelen; - memcpy (ciptr->addr, socknamePtr, ciptr->addrlen); - - return 0; -} - - -/* - * This function gets the remote address of the socket and stores it in the - * XtransConnInfo structure for the connection. - */ - -static int -TRANS(SocketINETGetPeerAddr) (XtransConnInfo ciptr) - -{ -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_storage socknamev6; -#endif - struct sockaddr_in socknamev4; - void *socknamePtr; - SOCKLEN_T namelen; - -#if defined(IPv6) && defined(AF_INET6) - if (ciptr->family == AF_INET6) - { - namelen = sizeof(socknamev6); - socknamePtr = &socknamev6; - } - else -#endif - { - namelen = sizeof(socknamev4); - socknamePtr = &socknamev4; - } - - bzero(socknamePtr, namelen); - - prmsg (3,"SocketINETGetPeerAddr(%p)\n", (void *) ciptr); - - if (getpeername (ciptr->fd, (struct sockaddr *) socknamePtr, - (void *)&namelen) < 0) - { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (1,"SocketINETGetPeerAddr: getpeername() failed: %d\n", - EGET()); - return -1; - } - - /* - * Everything looks good: fill in the XtransConnInfo structure. - */ - - if ((ciptr->peeraddr = malloc (namelen)) == NULL) - { - prmsg (1, - "SocketINETGetPeerAddr: Can't allocate space for the addr\n"); - return -1; - } - - ciptr->peeraddrlen = namelen; - memcpy (ciptr->peeraddr, socknamePtr, ciptr->peeraddrlen); - - return 0; -} - - -static XtransConnInfo -TRANS(SocketOpen) (int i, int type) - -{ - XtransConnInfo ciptr; - - prmsg (3,"SocketOpen(%d,%d)\n", i, type); - - if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketOpen: malloc failed\n"); - return NULL; - } - - if ((ciptr->fd = socket(Sockettrans2devtab[i].family, type, - Sockettrans2devtab[i].protocol)) < 0 -#ifndef WIN32 -#if (defined(X11_t) && !defined(USE_POLL)) || defined(FS_t) || defined(FONT_t) - || ciptr->fd >= sysconf(_SC_OPEN_MAX) -#endif -#endif - ) { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (2, "SocketOpen: socket() failed for %s\n", - Sockettrans2devtab[i].transname); - - free (ciptr); - return NULL; - } - -#ifdef TCP_NODELAY - if (Sockettrans2devtab[i].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[i].family == AF_INET6 -#endif - ) - { - /* - * turn off TCP coalescence for INET sockets - */ - - int tmp = 1; - setsockopt (ciptr->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (int)); - } -#endif - - /* - * Some systems provide a really small default buffer size for - * UNIX sockets. Bump it up a bit such that large transfers don't - * proceed at glacial speed. - */ -#ifdef SO_SNDBUF - if (Sockettrans2devtab[i].family == AF_UNIX) - { - SOCKLEN_T len = sizeof (int); - int val; - - if (getsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, - (char *) &val, &len) == 0 && val < 64 * 1024) - { - val = 64 * 1024; - setsockopt (ciptr->fd, SOL_SOCKET, SO_SNDBUF, - (char *) &val, sizeof (int)); - } - } -#endif - - return ciptr; -} - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(SocketReopen) (int i _X_UNUSED, int type, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int portlen; - struct sockaddr *addr; - size_t addrlen; - - prmsg (3,"SocketReopen(%d,%d,%s)\n", type, fd, port); - - if (port == NULL) { - prmsg (1, "SocketReopen: port was null!\n"); - return NULL; - } - - portlen = strlen(port) + 1; // include space for trailing null -#ifdef SOCK_MAXADDRLEN - if (portlen < 0 || portlen > (SOCK_MAXADDRLEN + 2)) { - prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); - return NULL; - } - if (portlen < 14) portlen = 14; -#else - if (portlen < 0 || portlen > 14) { - prmsg (1, "SocketReopen: invalid portlen %d\n", portlen); - return NULL; - } -#endif /*SOCK_MAXADDRLEN*/ - - if ((ciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketReopen: malloc(ciptr) failed\n"); - return NULL; - } - - ciptr->fd = fd; - - addrlen = portlen + offsetof(struct sockaddr, sa_data); - if ((addr = calloc (1, addrlen)) == NULL) { - prmsg (1, "SocketReopen: malloc(addr) failed\n"); - free (ciptr); - return NULL; - } - ciptr->addr = (char *) addr; - ciptr->addrlen = addrlen; - - if ((ciptr->peeraddr = calloc (1, addrlen)) == NULL) { - prmsg (1, "SocketReopen: malloc(portaddr) failed\n"); - free (addr); - free (ciptr); - return NULL; - } - ciptr->peeraddrlen = addrlen; - - /* Initialize ciptr structure as if it were a normally-opened unix socket */ - ciptr->flags = TRANS_LOCAL | TRANS_NOUNLINK; -#ifdef BSD44SOCKETS - addr->sa_len = addrlen; -#endif - addr->sa_family = AF_UNIX; -#if defined(HAVE_STRLCPY) || defined(HAS_STRLCPY) - strlcpy(addr->sa_data, port, portlen); -#else - strncpy(addr->sa_data, port, portlen); -#endif - ciptr->family = AF_UNIX; - memcpy(ciptr->peeraddr, ciptr->addr, addrlen); - ciptr->port = rindex(addr->sa_data, ':'); - if (ciptr->port == NULL) { - if (is_numeric(addr->sa_data)) { - ciptr->port = addr->sa_data; - } - } else if (ciptr->port[0] == ':') { - ciptr->port++; - } - /* port should now point to portnum or NULL */ - return ciptr; -} - -#endif /* TRANS_REOPEN */ - - -/* - * These functions are the interface supplied in the Xtransport structure - */ - -#ifdef TRANS_CLIENT - -static XtransConnInfo -TRANS(SocketOpenCOTSClientBase) (const char *transname, const char *protocol, - const char *host, const char *port, int previndex) -{ - XtransConnInfo ciptr; - int i = previndex; - - prmsg (2, "SocketOpenCOTSClient(%s,%s,%s)\n", - protocol, host, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, transname)) >= 0) { - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - if ((!strcmp(protocol, "local") || !strcmp(protocol, "nx")) && - (!strcasecmp(host, "nx") || !strncasecmp(host, "nx,", 3))) - { - ciptr = TRANS(SocketCreateConnInfo) (); - - if (ciptr == NULL) - { - prmsg (1, "SocketOpenCOTSClient: Unable to create the NX connection info for %s.\n", - transname); - - return NULL; - } - - ciptr->index = i; - - return ciptr; - } - -#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ - - if ((ciptr = TRANS(SocketOpen) ( - i, Sockettrans2devtab[i].devcotsname)) != NULL) { - /* Save the index for later use */ - - ciptr->index = i; - break; - } - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketOpenCOTSClient: Unable to open socket for %s\n", - transname); - else - prmsg (1,"SocketOpenCOTSClient: Unable to determine socket type for %s\n", - transname); - return NULL; - } - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - ciptr->priv = NULL; - -#endif - - return ciptr; -} - -static XtransConnInfo -TRANS(SocketOpenCOTSClient) (Xtransport *thistrans, const char *protocol, - const char *host, const char *port) -{ - return TRANS(SocketOpenCOTSClientBase)( - thistrans->TransName, protocol, host, port, -1); -} - - -#endif /* TRANS_CLIENT */ - - -#ifdef TRANS_SERVER - -static XtransConnInfo -TRANS(SocketOpenCOTSServer) (Xtransport *thistrans, const char *protocol, - const char *host, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2,"SocketOpenCOTSServer(%s,%s,%s)\n", protocol, host, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketOpen) ( - i, Sockettrans2devtab[i].devcotsname)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketOpenCOTSServer: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketOpenCOTSServer: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - - /* - * Using this prevents the bind() check for an existing server listening - * on the same port, but it is required for other reasons. - */ -#ifdef SO_REUSEADDR - - /* - * SO_REUSEADDR only applied to AF_INET && AF_INET6 - */ - - if (Sockettrans2devtab[i].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[i].family == AF_INET6 -#endif - ) - { - int one = 1; - setsockopt (ciptr->fd, SOL_SOCKET, SO_REUSEADDR, - (char *) &one, sizeof (int)); - } -#endif -#ifdef IPV6_V6ONLY - if (Sockettrans2devtab[i].family == AF_INET6) - { - int one = 1; - setsockopt(ciptr->fd, IPPROTO_IPV6, IPV6_V6ONLY, &one, sizeof(int)); - } -#endif - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_REOPEN - -static XtransConnInfo -TRANS(SocketReopenCOTSServer) (Xtransport *thistrans, int fd, const char *port) - -{ - XtransConnInfo ciptr; - int i = -1; - - prmsg (2, - "SocketReopenCOTSServer(%d, %s)\n", fd, port); - - SocketInitOnce(); - - while ((i = TRANS(SocketSelectFamily) (i, thistrans->TransName)) >= 0) { - if ((ciptr = TRANS(SocketReopen) ( - i, Sockettrans2devtab[i].devcotsname, fd, port)) != NULL) - break; - } - if (i < 0) { - if (i == -1) - prmsg (1,"SocketReopenCOTSServer: Unable to open socket for %s\n", - thistrans->TransName); - else - prmsg (1,"SocketReopenCOTSServer: Unable to determine socket type for %s\n", - thistrans->TransName); - return NULL; - } - - /* Save the index for later use */ - - ciptr->index = i; - - return ciptr; -} - -#endif /* TRANS_REOPEN */ - - -static int -TRANS(SocketSetOption) (XtransConnInfo ciptr, int option, int arg) - -{ - prmsg (2,"SocketSetOption(%d,%d,%d)\n", ciptr->fd, option, arg); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "SocketSetOption: WARNING! Not setting option [%d] with value [%d] on descriptor [%d].\n", - option, arg, ciptr -> fd); -#endif - - return -1; -} - -#ifdef UNIXCONN -static int -set_sun_path(const char *port, const char *upath, char *path, int abstract) -{ - struct sockaddr_un s; - int maxlen = sizeof(s.sun_path) - 1; - const char *at = ""; - - if (!port || !*port || !path) - return -1; - -#ifdef HAVE_ABSTRACT_SOCKETS - if (port[0] == '@') - upath = ""; - else if (abstract) - at = "@"; -#endif - - if (*port == '/') /* a full pathname */ - upath = ""; - - if (strlen(port) + strlen(upath) > maxlen) - return -1; - snprintf(path, sizeof(s.sun_path), "%s%s%s", at, upath, port); - return 0; -} -#endif - -#ifdef TRANS_SERVER - -static int -TRANS(SocketCreateListener) (XtransConnInfo ciptr, - struct sockaddr *sockname, - int socknamelen, unsigned int flags) - -{ - SOCKLEN_T namelen = socknamelen; - int fd = ciptr->fd; - int retry; - - prmsg (3, "SocketCreateListener(%p,%d)\n", (void *) ciptr, fd); - - if (Sockettrans2devtab[ciptr->index].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[ciptr->index].family == AF_INET6 -#endif - ) - retry = 20; - else - retry = 0; - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "SocketCreateListener: Creating listener for ciptr at [%p] on path [%s].\n", - (void *) ciptr, ((struct sockaddr_un *) sockname)->sun_family == AF_UNIX ? - ((struct sockaddr_un *) sockname)->sun_path : "TCP"); -#endif - while (bind (fd, (struct sockaddr *) sockname, namelen) < 0) - { - if (errno == EADDRINUSE) { - if (flags & ADDR_IN_USE_ALLOWED) - break; - else - return TRANS_ADDR_IN_USE; - } - - if (retry-- == 0) { - prmsg (1, "SocketCreateListener: failed to bind listener\n"); - close (fd); - return TRANS_CREATE_LISTENER_FAILED; - } -#ifdef SO_REUSEADDR - sleep (1); -#else - sleep (10); -#endif /* SO_REUSEDADDR */ - } - - if (Sockettrans2devtab[ciptr->index].family == AF_INET -#if defined(IPv6) && defined(AF_INET6) - || Sockettrans2devtab[ciptr->index].family == AF_INET6 -#endif - ) { -#ifdef SO_DONTLINGER - setsockopt (fd, SOL_SOCKET, SO_DONTLINGER, (char *) NULL, 0); -#else -#ifdef SO_LINGER - { - static int linger[2] = { 0, 0 }; - setsockopt (fd, SOL_SOCKET, SO_LINGER, - (char *) linger, sizeof (linger)); - } -#endif -#endif -} - - if (listen (fd, BACKLOG) < 0) - { - prmsg (1, "SocketCreateListener: listen() failed\n"); - close (fd); - return TRANS_CREATE_LISTENER_FAILED; - } - - /* Set a flag to indicate that this connection is a listener */ - - ciptr->flags = 1 | (ciptr->flags & TRANS_KEEPFLAGS); - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "SocketCreateListener: Set flags to [%d] for ciptr [%p].\n", - ciptr->flags, (void *) ciptr); -#endif - - return 0; -} - -#ifdef TCPCONN -static int -TRANS(SocketINETCreateListener) (XtransConnInfo ciptr, const char *port, - unsigned int flags) - -{ -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_storage sockname; -#else - struct sockaddr_in sockname; -#endif - unsigned short sport; - SOCKLEN_T namelen = sizeof(sockname); - int status; - long tmpport; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgetservbynameparams sparams; -#endif - struct servent *servp; - -#ifdef X11_t - char portbuf[PORTBUFSIZE]; -#endif - - prmsg (2, "SocketINETCreateListener(%s)\n", port); - -#ifdef X11_t - /* - * X has a well known port, that is transport dependent. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the idisplay - * from ConnectDisplay(). - */ - - if (is_numeric (port)) - { - /* fixup the server port address */ - tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); - snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); - port = portbuf; - } -#endif - - if (port && *port) - { - /* Check to see if the port string is just a number (handles X11) */ - - if (!is_numeric (port)) - { - if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) - { - prmsg (1, - "SocketINETCreateListener: Unable to get service for %s\n", - port); - return TRANS_CREATE_LISTENER_FAILED; - } - /* we trust getservbyname to return a valid number */ - sport = servp->s_port; - } - else - { - tmpport = strtol (port, (char**)NULL, 10); - /* - * check that somehow the port address isn't negative or in - * the range of reserved port addresses. This can happen and - * be very bad if the server is suid-root and the user does - * something (dumb) like `X :60049`. - */ - if (tmpport < 1024 || tmpport > USHRT_MAX) - return TRANS_CREATE_LISTENER_FAILED; - - sport = (unsigned short) tmpport; - } - } - else - sport = 0; - - bzero(&sockname, sizeof(sockname)); -#if defined(IPv6) && defined(AF_INET6) - if (Sockettrans2devtab[ciptr->index].family == AF_INET) { - namelen = sizeof (struct sockaddr_in); -#ifdef BSD44SOCKETS - ((struct sockaddr_in *)&sockname)->sin_len = namelen; -#endif - ((struct sockaddr_in *)&sockname)->sin_family = AF_INET; - ((struct sockaddr_in *)&sockname)->sin_port = htons(sport); - ((struct sockaddr_in *)&sockname)->sin_addr.s_addr = htonl(INADDR_ANY); - } else { - namelen = sizeof (struct sockaddr_in6); -#ifdef SIN6_LEN - ((struct sockaddr_in6 *)&sockname)->sin6_len = sizeof(sockname); -#endif - ((struct sockaddr_in6 *)&sockname)->sin6_family = AF_INET6; - ((struct sockaddr_in6 *)&sockname)->sin6_port = htons(sport); - ((struct sockaddr_in6 *)&sockname)->sin6_addr = in6addr_any; - } -#else -#ifdef BSD44SOCKETS - sockname.sin_len = sizeof (sockname); -#endif - sockname.sin_family = AF_INET; - sockname.sin_port = htons (sport); - sockname.sin_addr.s_addr = htonl (INADDR_ANY); -#endif - - if ((status = TRANS(SocketCreateListener) (ciptr, - (struct sockaddr *) &sockname, namelen, flags)) < 0) - { - prmsg (1, - "SocketINETCreateListener: ...SocketCreateListener() failed\n"); - return status; - } - - if (TRANS(SocketINETGetAddr) (ciptr) < 0) - { - prmsg (1, - "SocketINETCreateListener: ...SocketINETGetAddr() failed\n"); - return TRANS_CREATE_LISTENER_FAILED; - } - - return 0; -} - -#endif /* TCPCONN */ - - -#ifdef UNIXCONN - -static int -TRANS(SocketUNIXCreateListener) (XtransConnInfo ciptr, const char *port, - unsigned int flags) - -{ - struct sockaddr_un sockname; - int namelen; - int oldUmask; - int status; - unsigned int mode; - char tmpport[108]; - - int abstract = 0; -#ifdef HAVE_ABSTRACT_SOCKETS - abstract = ciptr->transptr->flags & TRANS_ABSTRACT; -#endif - - prmsg (2, "SocketUNIXCreateListener(%s)\n", - port ? port : "NULL"); - - /* Make sure the directory is created */ - - oldUmask = umask (0); - -#ifdef UNIX_DIR -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif -#ifdef NX_TRANS_SOCKET - if (!abstract && trans_mkdir(_NXGetUnixDir(UNIX_DIR), mode) == -1) { - prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n", - _NXGetUnixDir(UNIX_DIR), errno); -#else - if (!abstract && trans_mkdir(UNIX_DIR, mode) == -1) { - prmsg (1, "SocketUNIXCreateListener: mkdir(%s) failed, errno = %d\n", - UNIX_DIR, errno); -#endif - (void) umask (oldUmask); - return TRANS_CREATE_LISTENER_FAILED; - } -#endif - - memset(&sockname, 0, sizeof(sockname)); - sockname.sun_family = AF_UNIX; - - if (!(port && *port)) { - snprintf (tmpport, sizeof(tmpport), "%s%ld", UNIX_PATH, (long)getpid()); - port = tmpport; - } -#ifdef NX_TRANS_SOCKET - if (set_sun_path(port, _NXGetUnixPath(UNIX_PATH), sockname.sun_path, abstract) != 0) { -#else - if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { -#endif - prmsg (1, "SocketUNIXCreateListener: path too long\n"); - return TRANS_CREATE_LISTENER_FAILED; - } - -#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) - sockname.sun_len = strlen(sockname.sun_path); -#endif - -#if defined(BSD44SOCKETS) || defined(SUN_LEN) - namelen = SUN_LEN(&sockname); -#else - namelen = strlen(sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); -#endif - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "SocketUNIXCreateListener: Unlinking path [%s] for ciptr at [%p].\n", - sockname.sun_path, (void *) ciptr); -#endif - if (abstract) { - sockname.sun_path[0] = '\0'; - namelen = offsetof(struct sockaddr_un, sun_path) + 1 + strlen(&sockname.sun_path[1]); - } - else - unlink (sockname.sun_path); - - if ((status = TRANS(SocketCreateListener) (ciptr, - (struct sockaddr *) &sockname, namelen, flags)) < 0) - { - prmsg (1, - "SocketUNIXCreateListener: ...SocketCreateListener() failed\n"); - (void) umask (oldUmask); - return status; - } - - /* - * Now that the listener is esablished, create the addr info for - * this connection. getpeername() doesn't work for UNIX Domain Sockets - * on some systems (hpux at least), so we will just do it manually, instead - * of calling something like TRANS(SocketUNIXGetAddr). - */ - - namelen = sizeof (sockname); /* this will always make it the same size */ - - if ((ciptr->addr = malloc (namelen)) == NULL) - { - prmsg (1, - "SocketUNIXCreateListener: Can't allocate space for the addr\n"); - (void) umask (oldUmask); - return TRANS_CREATE_LISTENER_FAILED; - } - - if (abstract) - sockname.sun_path[0] = '@'; - - ciptr->family = sockname.sun_family; - ciptr->addrlen = namelen; - memcpy (ciptr->addr, &sockname, ciptr->addrlen); - - (void) umask (oldUmask); - - return 0; -} - - -static int -TRANS(SocketUNIXResetListener) (XtransConnInfo ciptr) - -{ - /* - * See if the unix domain socket has disappeared. If it has, recreate it. - */ - - struct sockaddr_un *unsock = (struct sockaddr_un *) ciptr->addr; - struct stat statb; - int status = TRANS_RESET_NOOP; - unsigned int mode; - int abstract = 0; -#ifdef HAVE_ABSTRACT_SOCKETS - abstract = ciptr->transptr->flags & TRANS_ABSTRACT; -#endif - - prmsg (3, "SocketUNIXResetListener(%p,%d)\n", (void *) ciptr, ciptr->fd); - - if (!abstract && ( - stat (unsock->sun_path, &statb) == -1 || - ((statb.st_mode & S_IFMT) != -#if defined(NCR) || defined(SCO325) || !defined(S_IFSOCK) - S_IFIFO -#else - S_IFSOCK -#endif - ))) - { - int oldUmask = umask (0); - -#ifdef UNIX_DIR -#ifdef HAS_STICKY_DIR_BIT - mode = 01777; -#else - mode = 0777; -#endif -#ifdef NX_TRANS_SOCKET - if (trans_mkdir(_NXGetUnixDir(UNIX_DIR), mode) == -1) { - prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n", - _NXGetUnixDir(UNIX_DIR), errno); -#else - if (trans_mkdir(UNIX_DIR, mode) == -1) { - prmsg (1, "SocketUNIXResetListener: mkdir(%s) failed, errno = %d\n", - UNIX_DIR, errno); -#endif - (void) umask (oldUmask); - return TRANS_RESET_FAILURE; - } -#endif - - close (ciptr->fd); - unlink (unsock->sun_path); - - if ((ciptr->fd = socket (AF_UNIX, SOCK_STREAM, 0)) < 0) - { - TRANS(FreeConnInfo) (ciptr); - (void) umask (oldUmask); - return TRANS_RESET_FAILURE; - } - - if (bind (ciptr->fd, (struct sockaddr *) unsock, ciptr->addrlen) < 0) - { - close (ciptr->fd); - TRANS(FreeConnInfo) (ciptr); - return TRANS_RESET_FAILURE; - } - - if (listen (ciptr->fd, BACKLOG) < 0) - { - close (ciptr->fd); - TRANS(FreeConnInfo) (ciptr); - (void) umask (oldUmask); - return TRANS_RESET_FAILURE; - } - - umask (oldUmask); - - status = TRANS_RESET_NEW_FD; - } - - return status; -} - -#endif /* UNIXCONN */ - - -#ifdef TCPCONN - -static XtransConnInfo -TRANS(SocketINETAccept) (XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - struct sockaddr_in sockname; - SOCKLEN_T namelen = sizeof(sockname); - - prmsg (2, "SocketINETAccept(%p,%d)\n", (void *) ciptr, ciptr->fd); - - if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketINETAccept: malloc failed\n"); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - if ((newciptr->fd = accept (ciptr->fd, - (struct sockaddr *) &sockname, (void *)&namelen)) < 0) - { -#ifdef WIN32 - errno = WSAGetLastError(); -#endif - prmsg (1, "SocketINETAccept: accept() failed\n"); - free (newciptr); - *status = TRANS_ACCEPT_FAILED; - return NULL; - } - -#ifdef TCP_NODELAY - { - /* - * turn off TCP coalescence for INET sockets - */ - - int tmp = 1; - setsockopt (newciptr->fd, IPPROTO_TCP, TCP_NODELAY, - (char *) &tmp, sizeof (int)); - } -#endif - - /* - * Get this address again because the transport may give a more - * specific address now that a connection is established. - */ - - if (TRANS(SocketINETGetAddr) (newciptr) < 0) - { - prmsg (1, - "SocketINETAccept: ...SocketINETGetAddr() failed:\n"); - close (newciptr->fd); - free (newciptr); - *status = TRANS_ACCEPT_MISC_ERROR; - return NULL; - } - - if (TRANS(SocketINETGetPeerAddr) (newciptr) < 0) - { - prmsg (1, - "SocketINETAccept: ...SocketINETGetPeerAddr() failed:\n"); - close (newciptr->fd); - if (newciptr->addr) free (newciptr->addr); - free (newciptr); - *status = TRANS_ACCEPT_MISC_ERROR; - return NULL; - } - - *status = 0; - - return newciptr; -} - -#endif /* TCPCONN */ - - -#ifdef UNIXCONN -static XtransConnInfo -TRANS(SocketUNIXAccept) (XtransConnInfo ciptr, int *status) - -{ - XtransConnInfo newciptr; - struct sockaddr_un sockname; - SOCKLEN_T namelen = sizeof sockname; - - prmsg (2, "SocketUNIXAccept(%p,%d)\n", (void *) ciptr, ciptr->fd); - - if ((newciptr = calloc (1, sizeof(struct _XtransConnInfo))) == NULL) - { - prmsg (1, "SocketUNIXAccept: malloc() failed\n"); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - if ((newciptr->fd = accept (ciptr->fd, - (struct sockaddr *) &sockname, (void *)&namelen)) < 0) - { - prmsg (1, "SocketUNIXAccept: accept() failed\n"); - free (newciptr); - *status = TRANS_ACCEPT_FAILED; - return NULL; - } - - ciptr->addrlen = namelen; - /* - * Get the socket name and the peer name from the listener socket, - * since this is unix domain. - */ - - if ((newciptr->addr = malloc (ciptr->addrlen)) == NULL) - { - prmsg (1, - "SocketUNIXAccept: Can't allocate space for the addr\n"); - close (newciptr->fd); - free (newciptr); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - /* - * if the socket is abstract, we already modified the address to have a - * @ instead of the initial NUL, so no need to do that again here. - */ - - newciptr->addrlen = ciptr->addrlen; - memcpy (newciptr->addr, ciptr->addr, newciptr->addrlen); - - if ((newciptr->peeraddr = malloc (ciptr->addrlen)) == NULL) - { - prmsg (1, - "SocketUNIXAccept: Can't allocate space for the addr\n"); - close (newciptr->fd); - if (newciptr->addr) free (newciptr->addr); - free (newciptr); - *status = TRANS_ACCEPT_BAD_MALLOC; - return NULL; - } - - newciptr->peeraddrlen = ciptr->addrlen; - memcpy (newciptr->peeraddr, ciptr->addr, newciptr->addrlen); - - newciptr->family = AF_UNIX; - - *status = 0; - - return newciptr; -} - -#endif /* UNIXCONN */ - -#endif /* TRANS_SERVER */ - - -#ifdef TRANS_CLIENT - -#ifdef TCPCONN - -#if defined(IPv6) && defined(AF_INET6) -struct addrlist { - struct addrinfo * addr; - struct addrinfo * firstaddr; - char port[PORTBUFSIZE]; - char host[MAXHOSTNAMELEN]; -}; -static struct addrlist *addrlist = NULL; -#endif - - -static int -TRANS(SocketINETConnect) (XtransConnInfo ciptr, - const char *host, const char *port) - -{ - struct sockaddr * socketaddr = NULL; - int socketaddrlen = 0; - int res; -#if defined(IPv6) && defined(AF_INET6) - struct addrinfo hints; - char ntopbuf[INET6_ADDRSTRLEN]; - int resetonce = 0; -#else - struct sockaddr_in sockname; - struct hostent *hostp; - struct servent *servp; - unsigned long tmpaddr; -#endif -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; - _Xgetservbynameparams sparams; -#endif -#ifdef X11_t - char portbuf[PORTBUFSIZE]; -#endif - - char hostnamebuf[256]; /* tmp space */ - - prmsg (2,"SocketINETConnect(%d,%s,%s)\n", ciptr->fd, host, port); - - if (!host) - { - hostnamebuf[0] = '\0'; - (void) TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); - host = hostnamebuf; - } - -#ifdef X11_t - /* - * X has a well known port, that is transport dependent. It is easier - * to handle it here, than try and come up with a transport independent - * representation that can be passed in and resolved the usual way. - * - * The port that is passed here is really a string containing the idisplay - * from ConnectDisplay(). - */ - - if (is_numeric (port)) - { - long tmpport = X_TCP_PORT + strtol (port, (char**)NULL, 10); - snprintf (portbuf, sizeof(portbuf), "%lu", tmpport); - port = portbuf; - } -#endif - -#if defined(IPv6) && defined(AF_INET6) - { - if (addrlist != NULL) { - if (strcmp(host,addrlist->host) || strcmp(port,addrlist->port)) { - if (addrlist->firstaddr) - freeaddrinfo(addrlist->firstaddr); - addrlist->firstaddr = NULL; - } - } else { - addrlist = malloc(sizeof(struct addrlist)); - addrlist->firstaddr = NULL; - } - - if (addrlist->firstaddr == NULL) { - strncpy(addrlist->port, port, sizeof(addrlist->port)); - addrlist->port[sizeof(addrlist->port) - 1] = '\0'; - strncpy(addrlist->host, host, sizeof(addrlist->host)); - addrlist->host[sizeof(addrlist->host) - 1] = '\0'; - - bzero(&hints,sizeof(hints)); - hints.ai_socktype = Sockettrans2devtab[ciptr->index].devcotsname; - - res = getaddrinfo(host,port,&hints,&addrlist->firstaddr); - if (res != 0) { - prmsg (1, "SocketINETConnect() can't get address " - "for %s:%s: %s\n", host, port, gai_strerror(res)); - ESET(EINVAL); - return TRANS_CONNECT_FAILED; - } - for (res = 0, addrlist->addr = addrlist->firstaddr; - addrlist->addr ; res++) { - addrlist->addr = addrlist->addr->ai_next; - } - prmsg(4,"Got New Address list with %d addresses\n", res); - res = 0; - addrlist->addr = NULL; - } - - while (socketaddr == NULL) { - if (addrlist->addr == NULL) { - if (resetonce) { - /* Already checked entire list - no usable addresses */ - prmsg (1, "SocketINETConnect() no usable address " - "for %s:%s\n", host, port); - return TRANS_CONNECT_FAILED; - } else { - /* Go back to beginning of list */ - resetonce = 1; - addrlist->addr = addrlist->firstaddr; - } - } - - socketaddr = addrlist->addr->ai_addr; - socketaddrlen = addrlist->addr->ai_addrlen; - - if (addrlist->addr->ai_family == AF_INET) { - struct sockaddr_in *sin = (struct sockaddr_in *) socketaddr; - - prmsg (4,"SocketINETConnect() sockname.sin_addr = %s\n", - inet_ntop(addrlist->addr->ai_family,&sin->sin_addr, - ntopbuf,sizeof(ntopbuf))); - - prmsg (4,"SocketINETConnect() sockname.sin_port = %d\n", - ntohs(sin->sin_port)); - - if (Sockettrans2devtab[ciptr->index].family == AF_INET6) { - if (strcmp(Sockettrans2devtab[ciptr->index].transname, - "tcp") == 0) { - XtransConnInfo newciptr; - - /* - * Our socket is an IPv6 socket, but the address is - * IPv4. Close it and get an IPv4 socket. This is - * needed for IPv4 connections to work on platforms - * that don't allow IPv4 over IPv6 sockets. - */ - TRANS(SocketINETClose)(ciptr); - newciptr = TRANS(SocketOpenCOTSClientBase)( - "tcp", "tcp", host, port, ciptr->index); - if (newciptr) - ciptr->fd = newciptr->fd; - if (!newciptr || - Sockettrans2devtab[newciptr->index].family != - AF_INET) { - socketaddr = NULL; - prmsg (4,"SocketINETConnect() Cannot get IPv4 " - " socketfor IPv4 address\n"); - } - if (newciptr) - free(newciptr); - } else { - socketaddr = NULL; - prmsg (4,"SocketINETConnect Skipping IPv4 address\n"); - } - } - } else if (addrlist->addr->ai_family == AF_INET6) { - struct sockaddr_in6 *sin6 = (struct sockaddr_in6 *) socketaddr; - - prmsg (4,"SocketINETConnect() sockname.sin6_addr = %s\n", - inet_ntop(addrlist->addr->ai_family, - &sin6->sin6_addr,ntopbuf,sizeof(ntopbuf))); - prmsg (4,"SocketINETConnect() sockname.sin6_port = %d\n", - ntohs(sin6->sin6_port)); - - if (Sockettrans2devtab[ciptr->index].family == AF_INET) { - if (strcmp(Sockettrans2devtab[ciptr->index].transname, - "tcp") == 0) { - XtransConnInfo newciptr; - - /* - * Close the IPv4 socket and try to open an IPv6 socket. - */ - TRANS(SocketINETClose)(ciptr); - newciptr = TRANS(SocketOpenCOTSClientBase)( - "tcp", "tcp", host, port, -1); - if (newciptr) - ciptr->fd = newciptr->fd; - if (!newciptr || - Sockettrans2devtab[newciptr->index].family != - AF_INET6) { - socketaddr = NULL; - prmsg (4,"SocketINETConnect() Cannot get IPv6 " - "socket for IPv6 address\n"); - } - if (newciptr) - free(newciptr); - } - else - { - socketaddr = NULL; - prmsg (4,"SocketINETConnect() Skipping IPv6 address\n"); - } - } - } else { - socketaddr = NULL; /* Unsupported address type */ - } - if (socketaddr == NULL) { - addrlist->addr = addrlist->addr->ai_next; - } - } - } -#else - { - /* - * Build the socket name. - */ - -#ifdef BSD44SOCKETS - sockname.sin_len = sizeof (struct sockaddr_in); -#endif - sockname.sin_family = AF_INET; - - /* - * fill in sin_addr - */ - -#ifndef INADDR_NONE -#define INADDR_NONE ((in_addr_t) 0xffffffff) -#endif - - /* check for ww.xx.yy.zz host string */ - - if (isascii (host[0]) && isdigit (host[0])) { - tmpaddr = inet_addr (host); /* returns network byte order */ - } else { - tmpaddr = INADDR_NONE; - } - - prmsg (4,"SocketINETConnect() inet_addr(%s) = %x\n", host, tmpaddr); - - if (tmpaddr == INADDR_NONE) { - if ((hostp = _XGethostbyname(host,hparams)) == NULL) { - prmsg (1,"SocketINETConnect: Can't get address for %s\n", - host); - ESET(EINVAL); - return TRANS_CONNECT_FAILED; - } - if (hostp->h_addrtype != AF_INET) { /* is IP host? */ - prmsg (1,"SocketINETConnect: not INET host%s\n", host); - ESET(EPROTOTYPE); - return TRANS_CONNECT_FAILED; - } - - memcpy ((char *) &sockname.sin_addr, (char *) hostp->h_addr, - sizeof (sockname.sin_addr)); - - } else { - sockname.sin_addr.s_addr = tmpaddr; - } - - /* - * fill in sin_port - */ - - /* Check for number in the port string */ - - if (!is_numeric (port)) { - if ((servp = _XGetservbyname (port,"tcp",sparams)) == NULL) { - prmsg (1,"SocketINETConnect: can't get service for %s\n", - port); - return TRANS_CONNECT_FAILED; - } - sockname.sin_port = htons (servp->s_port); - } else { - long tmpport = strtol (port, (char**)NULL, 10); - if (tmpport < 1024 || tmpport > USHRT_MAX) - return TRANS_CONNECT_FAILED; - sockname.sin_port = htons (((unsigned short) tmpport)); - } - - prmsg (4,"SocketINETConnect: sockname.sin_port = %d\n", - ntohs(sockname.sin_port)); - socketaddr = (struct sockaddr *) &sockname; - socketaddrlen = sizeof(sockname); - } -#endif - - /* - * Turn on socket keepalive so the client process will eventually - * be notified with a SIGPIPE signal if the display server fails - * to respond to a periodic transmission of messages - * on the connected socket. - * This is useful to avoid hung application processes when the - * processes are not spawned from the xdm session and - * the display server terminates abnormally. - * (Someone turned off the power switch.) - */ - - { - int tmp = 1; - setsockopt (ciptr->fd, SOL_SOCKET, SO_KEEPALIVE, - (char *) &tmp, sizeof (int)); - } - - /* - * Do the connect() - */ - - if (connect (ciptr->fd, socketaddr, socketaddrlen ) < 0) - { -#ifdef WIN32 - int olderrno = WSAGetLastError(); -#else - int olderrno = errno; -#endif - - /* - * If the error was ECONNREFUSED, the server may be overloaded - * and we should try again. - * - * If the error was EWOULDBLOCK or EINPROGRESS then the socket - * was non-blocking and we should poll using select - * - * If the error was EINTR, the connect was interrupted and we - * should try again. - * - * If multiple addresses are found for a host then we should - * try to connect again with a different address for a larger - * number of errors that made us quit before, since those - * could be caused by trying to use an IPv6 address to contact - * a machine with an IPv4-only server or other reasons that - * only affect one of a set of addresses. - */ - - if (olderrno == ECONNREFUSED || olderrno == EINTR -#if defined(IPv6) && defined(AF_INET6) - || (((addrlist->addr->ai_next != NULL) || - (addrlist->addr != addrlist->firstaddr)) && - (olderrno == ENETUNREACH || olderrno == EAFNOSUPPORT || - olderrno == EADDRNOTAVAIL || olderrno == ETIMEDOUT -#if defined(EHOSTDOWN) - || olderrno == EHOSTDOWN -#endif - )) -#endif - ) - res = TRANS_TRY_CONNECT_AGAIN; - else if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) - res = TRANS_IN_PROGRESS; - else - { - prmsg (2,"SocketINETConnect: Can't connect: errno = %d\n", - olderrno); - - res = TRANS_CONNECT_FAILED; - } - } else { - res = 0; - - - /* - * Sync up the address fields of ciptr. - */ - - if (TRANS(SocketINETGetAddr) (ciptr) < 0) - { - prmsg (1, - "SocketINETConnect: ...SocketINETGetAddr() failed:\n"); - res = TRANS_CONNECT_FAILED; - } - - else if (TRANS(SocketINETGetPeerAddr) (ciptr) < 0) - { - prmsg (1, - "SocketINETConnect: ...SocketINETGetPeerAddr() failed:\n"); - res = TRANS_CONNECT_FAILED; - } - } - -#if defined(IPv6) && defined(AF_INET6) - if (res != 0) { - addrlist->addr = addrlist->addr->ai_next; - } -#endif - - return res; -} - -#endif /* TCPCONN */ - - - -#ifdef UNIXCONN - -/* - * Make sure 'host' is really local. - */ - -static int -UnixHostReallyLocal (const char *host) - -{ - char hostnamebuf[256]; - - TRANS(GetHostname) (hostnamebuf, sizeof (hostnamebuf)); - - if (strcmp (hostnamebuf, host) == 0) - { - return (1); - } else { -#if defined(IPv6) && defined(AF_INET6) - struct addrinfo *localhostaddr; - struct addrinfo *otherhostaddr; - struct addrinfo *i, *j; - int equiv = 0; - - if (getaddrinfo(hostnamebuf, NULL, NULL, &localhostaddr) != 0) - return 0; - if (getaddrinfo(host, NULL, NULL, &otherhostaddr) != 0) { - freeaddrinfo(localhostaddr); - return 0; - } - - for (i = localhostaddr; i != NULL && equiv == 0; i = i->ai_next) { - for (j = otherhostaddr; j != NULL && equiv == 0; j = j->ai_next) { - if (i->ai_family == j->ai_family) { - if (i->ai_family == AF_INET) { - struct sockaddr_in *sinA - = (struct sockaddr_in *) i->ai_addr; - struct sockaddr_in *sinB - = (struct sockaddr_in *) j->ai_addr; - struct in_addr *A = &sinA->sin_addr; - struct in_addr *B = &sinB->sin_addr; - - if (memcmp(A,B,sizeof(struct in_addr)) == 0) { - equiv = 1; - } - } else if (i->ai_family == AF_INET6) { - struct sockaddr_in6 *sinA - = (struct sockaddr_in6 *) i->ai_addr; - struct sockaddr_in6 *sinB - = (struct sockaddr_in6 *) j->ai_addr; - struct in6_addr *A = &sinA->sin6_addr; - struct in6_addr *B = &sinB->sin6_addr; - - if (memcmp(A,B,sizeof(struct in6_addr)) == 0) { - equiv = 1; - } - } - } - } - } - - freeaddrinfo(localhostaddr); - freeaddrinfo(otherhostaddr); - return equiv; -#else - /* - * A host may have more than one network address. If any of the - * network addresses of 'host' (specified to the connect call) - * match any of the network addresses of 'hostname' (determined - * by TRANS(GetHostname)), then the two hostnames are equivalent, - * and we know that 'host' is really a local host. - */ - char specified_local_addr_list[10][4]; - int scount, equiv, i, j; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; -#endif - struct hostent *hostp; - - if ((hostp = _XGethostbyname (host,hparams)) == NULL) - return (0); - - scount = 0; - while (hostp->h_addr_list[scount] && scount <= 8) - { - /* - * The 2nd call to gethostname() overrides the data - * from the 1st call, so we must save the address list. - */ - - specified_local_addr_list[scount][0] = - hostp->h_addr_list[scount][0]; - specified_local_addr_list[scount][1] = - hostp->h_addr_list[scount][1]; - specified_local_addr_list[scount][2] = - hostp->h_addr_list[scount][2]; - specified_local_addr_list[scount][3] = - hostp->h_addr_list[scount][3]; - scount++; - } - if ((hostp = _XGethostbyname (hostnamebuf,hparams)) == NULL) - return (0); - - equiv = 0; - i = 0; - - while (i < scount && !equiv) - { - j = 0; - - while (hostp->h_addr_list[j]) - { - if ((specified_local_addr_list[i][0] == - hostp->h_addr_list[j][0]) && - (specified_local_addr_list[i][1] == - hostp->h_addr_list[j][1]) && - (specified_local_addr_list[i][2] == - hostp->h_addr_list[j][2]) && - (specified_local_addr_list[i][3] == - hostp->h_addr_list[j][3])) - { - /* They're equal, so we're done */ - - equiv = 1; - break; - } - - j++; - } - - i++; - } - return (equiv); -#endif - } -} - -static int -TRANS(SocketUNIXConnect) (XtransConnInfo ciptr, - const char *host, const char *port) - -{ - struct sockaddr_un sockname; - SOCKLEN_T namelen; - - - int abstract = 0; -#ifdef HAVE_ABSTRACT_SOCKETS - abstract = ciptr->transptr->flags & TRANS_ABSTRACT; -#endif - - prmsg (2,"SocketUNIXConnect(%d,%s,%s)\n", ciptr->fd, host, port); - - /* - * Make sure 'host' is really local. If not, we return failure. - * The reason we make this check is because a process may advertise - * a "local" network ID for which it can accept connections, but if - * a process on a remote machine tries to connect to this network ID, - * we know for sure it will fail. - */ - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - if (host && *host && host[0]!='/' && strcmp(host, "unix") != 0 && strcasecmp(host, "nx") != 0 && - strncasecmp(host, "nx,", 3) != 0 && !UnixHostReallyLocal (host)) -#else - if (host && *host && host[0]!='/' && strcmp (host, "unix") != 0 && !UnixHostReallyLocal (host)) -#endif - { - prmsg (1, - "SocketUNIXConnect: Cannot connect to non-local host %s\n", - host); - return TRANS_CONNECT_FAILED; - } - - - /* - * Check the port. - */ - - if (!port || !*port) - { - prmsg (1,"SocketUNIXConnect: Missing port specification\n"); - return TRANS_CONNECT_FAILED; - } - - /* - * Build the socket name. - */ - - sockname.sun_family = AF_UNIX; - -#ifdef NX_TRANS_SOCKET - if (set_sun_path(port, _NXGetUnixPath(UNIX_PATH), sockname.sun_path, abstract) != 0) { -#else - if (set_sun_path(port, UNIX_PATH, sockname.sun_path, abstract) != 0) { -#endif - prmsg (1, "SocketUNIXConnect: path too long\n"); - return TRANS_CONNECT_FAILED; - } - -#if (defined(BSD44SOCKETS) || defined(__UNIXWARE__)) - sockname.sun_len = strlen (sockname.sun_path); -#endif - -#if defined(BSD44SOCKETS) || defined(SUN_LEN) - namelen = SUN_LEN (&sockname); -#else - namelen = strlen (sockname.sun_path) + offsetof(struct sockaddr_un, sun_path); -#endif - - - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - if (ciptr->priv != NULL) - { - if (TRANS(SocketConnectConnInfo) (ciptr, host, port) != 0) - { - return TRANS_CONNECT_FAILED; - } - - goto SocketUNIXConnectPost; - } - -#endif - - /* - * Adjust the socket path if using abstract sockets. - * Done here because otherwise all the strlen() calls above would fail. - */ - - if (abstract) { - sockname.sun_path[0] = '\0'; - } - - /* - * Do the connect() - */ - - if (connect (ciptr->fd, (struct sockaddr *) &sockname, namelen) < 0) - { - int olderrno = errno; - int connected = 0; - - if (!connected) - { - errno = olderrno; - - /* - * If the error was ENOENT, the server may be starting up; we used - * to suggest to try again in this case with - * TRANS_TRY_CONNECT_AGAIN, but this introduced problems for - * processes still referencing stale sockets in their environment. - * Hence, we now return a hard error, TRANS_CONNECT_FAILED, and it - * is suggested that higher level stacks handle retries on their - * level when they face a slow starting server. - * - * If the error was EWOULDBLOCK or EINPROGRESS then the socket - * was non-blocking and we should poll using select - * - * If the error was EINTR, the connect was interrupted and we - * should try again. - */ - - if (olderrno == EWOULDBLOCK || olderrno == EINPROGRESS) - return TRANS_IN_PROGRESS; - else if (olderrno == EINTR) - return TRANS_TRY_CONNECT_AGAIN; - else if (olderrno == ENOENT || olderrno == ECONNREFUSED) { - /* If opening as abstract socket failed, try again normally */ - if (abstract) { - ciptr->transptr->flags &= ~(TRANS_ABSTRACT); - return TRANS_TRY_CONNECT_AGAIN; - } else { - return TRANS_CONNECT_FAILED; - } - } else { - prmsg (2,"SocketUNIXConnect: Can't connect: errno = %d\n", - EGET()); - - return TRANS_CONNECT_FAILED; - } - } - } - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - -SocketUNIXConnectPost: - -#endif - - /* - * Get the socket name and the peer name from the connect socket, - * since this is unix domain. - */ - - if ((ciptr->addr = malloc(namelen)) == NULL || - (ciptr->peeraddr = malloc(namelen)) == NULL) - { - prmsg (1, - "SocketUNIXCreateListener: Can't allocate space for the addr\n"); - return TRANS_CONNECT_FAILED; - } - - if (abstract) - sockname.sun_path[0] = '@'; - - ciptr->family = AF_UNIX; - ciptr->addrlen = namelen; - ciptr->peeraddrlen = namelen; - memcpy (ciptr->addr, &sockname, ciptr->addrlen); - memcpy (ciptr->peeraddr, &sockname, ciptr->peeraddrlen); - - return 0; -} - -#endif /* UNIXCONN */ - -#endif /* TRANS_CLIENT */ - - -static int -TRANS(SocketBytesReadable) (XtransConnInfo ciptr, BytesReadable_t *pend) - -{ - prmsg (2,"SocketBytesReadable(%p,%d,%p)\n", - (void *) ciptr, ciptr->fd, (void *) pend); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - if (ciptr->priv) - { - if (NXTransRunning(ciptr->fd) == 0) - { - /* - * Force the application to shut down the - * socket if the NX transport is gone. We - * may probably save this additional call. - */ - -#ifdef NX_TRANS_DEBUG - fprintf(stderr, "SocketBytesReadable: NX transport not running for descriptor [%d].\n", - ciptr->fd); -#endif - ESET(EPIPE); - - return -1; - } - else - { - /* - * Emulate BytesReadable. Some X applications may use the system - * select() in their main loop, instead of the _XSelect() that is - * replaced by NX. Still these applications use _XEventsQueued to - * poll events from the X connection, and _XEventsQueued uses the - * NX _XSelect(), so it is generally possible to let the client - * yield the control to NX and let it handle the I/O on the proxy - * descriptors even if the application is not explicitly designed - * to work as a NX agent. - */ - -#ifdef NX_TRANS_DEBUG - - int result; - - result = NXTransReadable(ciptr->fd, (int *) pend); - - fprintf(stderr, "SocketBytesReadable: Descriptor [%d] result [%d] readable [%ld].\n", - ciptr->fd, result, *pend); - - return result; -#else - return NXTransReadable(ciptr->fd, (int *) pend); -#endif - } - } - -#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ - -#ifdef WIN32 - { - int ret = ioctlsocket ((SOCKET) ciptr->fd, FIONREAD, (u_long *) pend); - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); - return ret; - } -#else - return ioctl (ciptr->fd, FIONREAD, (char *) pend); -#endif /* WIN32 */ -} - -#if XTRANS_SEND_FDS - -static void -appendFd(struct _XtransConnFd **prev, int fd, int do_close) -{ - struct _XtransConnFd *cf, *new; - - new = malloc (sizeof (struct _XtransConnFd)); - if (!new) { - /* XXX mark connection as broken */ - close(fd); - return; - } - new->next = 0; - new->fd = fd; - new->do_close = do_close; - /* search to end of list */ - for (; (cf = *prev); prev = &(cf->next)); - *prev = new; -} - -static int -removeFd(struct _XtransConnFd **prev) -{ - struct _XtransConnFd *cf; - int fd; - - if ((cf = *prev)) { - *prev = cf->next; - fd = cf->fd; - free(cf); - } else - fd = -1; - return fd; -} - -static void -discardFd(struct _XtransConnFd **prev, struct _XtransConnFd *upto, int do_close) -{ - struct _XtransConnFd *cf, *next; - - for (cf = *prev; cf != upto; cf = next) { - next = cf->next; - if (do_close || cf->do_close) - close(cf->fd); - free(cf); - } - *prev = upto; -} - -static void -cleanupFds(XtransConnInfo ciptr) -{ - /* Clean up the send list but don't close the fds */ - discardFd(&ciptr->send_fds, NULL, 0); - /* Clean up the recv list and *do* close the fds */ - discardFd(&ciptr->recv_fds, NULL, 1); -} - -static int -nFd(struct _XtransConnFd **prev) -{ - struct _XtransConnFd *cf; - int n = 0; - - for (cf = *prev; cf; cf = cf->next) - n++; - return n; -} - -static int -TRANS(SocketRecvFd) (XtransConnInfo ciptr) -{ - prmsg (2, "SocketRecvFd(%d)\n", ciptr->fd); - return removeFd(&ciptr->recv_fds); -} - -static int -TRANS(SocketSendFd) (XtransConnInfo ciptr, int fd, int do_close) -{ - appendFd(&ciptr->send_fds, fd, do_close); - return 0; -} - -static int -TRANS(SocketRecvFdInvalid)(XtransConnInfo ciptr) -{ - errno = EINVAL; - return -1; -} - -static int -TRANS(SocketSendFdInvalid)(XtransConnInfo ciptr, int fd, int do_close) -{ - errno = EINVAL; - return -1; -} - -#define MAX_FDS 128 - -union fd_pass { - struct cmsghdr cmsghdr; - char buf[CMSG_SPACE(MAX_FDS * sizeof(int))]; -}; - -#endif /* XTRANS_SEND_FDS */ - -static int -TRANS(SocketRead) (XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg (2,"SocketRead(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - /* - * If we have a valid priv pointer then this - * is an internal connection to the proxy. - * In this case we should emulate the read. - */ - - if (ciptr->priv) - { - int result; - - result = NXTransRead(ciptr->fd, buf, size); - -#ifdef NX_TRANS_DEBUG - if (result < 0 && EGET() == EAGAIN) - { - fprintf(stderr, "SocketRead: Read from descriptor [%d] would block.\n", - ciptr->fd); - } - else - { - fprintf(stderr, "SocketRead: Read [%d] bytes from descriptor [%d].\n", - result, ciptr->fd); - } -#endif - return result; - } - else - { - /* FIXME: same code as below, should be possible without duplication */ -#if XTRANS_SEND_FDS - struct iovec iov = { - .iov_base = buf, - .iov_len = size - }; - union fd_pass cmsgbuf; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = &iov, - .msg_iovlen = 1, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) - }; - - size = recvmsg(ciptr->fd, &msg, 0); - if (size >= 0) { - struct cmsghdr *hdr; - - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - int i; - int *fd = (int *) CMSG_DATA(hdr); - - for (i = 0; i < nfd; i++) - appendFd(&ciptr->recv_fds, fd[i], 0); - } - } - } - return size; -#else - return read (ciptr->fd, buf, size); -#endif /* XTRANS_SEND_FDS */ - } - -#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ - -#if defined(WIN32) - { - int ret = recv ((SOCKET)ciptr->fd, buf, size, 0); -#ifdef WIN32 - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); -#endif - return ret; - } -#else -#if XTRANS_SEND_FDS - { - struct iovec iov = { - .iov_base = buf, - .iov_len = size - }; - union fd_pass cmsgbuf; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = &iov, - .msg_iovlen = 1, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) - }; - - size = recvmsg(ciptr->fd, &msg, 0); - if (size >= 0) { - struct cmsghdr *hdr; - - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - int i; - int *fd = (int *) CMSG_DATA(hdr); - - for (i = 0; i < nfd; i++) - appendFd(&ciptr->recv_fds, fd[i], 0); - } - } - } - return size; - } -#else - return read (ciptr->fd, buf, size); -#endif /* XTRANS_SEND_FDS */ -#endif /* WIN32 */ - -#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ -} - -static int -TRANS(SocketReadv) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg (2,"SocketReadv(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - /* - * If we have a valid priv pointer then this - * is an internal connection to the proxy. - * In this case we should emulate the readv. - */ - - if (ciptr->priv) - { - return NXTransReadVector(ciptr->fd, buf, size); - } - else - { - /* FIXME: same code as below, should be possible without duplication */ -#if XTRANS_SEND_FDS - union fd_pass cmsgbuf; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = buf, - .msg_iovlen = size, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) - }; - - size = recvmsg(ciptr->fd, &msg, 0); - if (size >= 0) { - struct cmsghdr *hdr; - - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - int i; - int *fd = (int *) CMSG_DATA(hdr); - - for (i = 0; i < nfd; i++) - appendFd(&ciptr->recv_fds, fd[i], 0); - } - } - } - return size; -#else - return READV (ciptr, buf, size); -#endif - } - -#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ - -#if XTRANS_SEND_FDS - { - union fd_pass cmsgbuf; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = buf, - .msg_iovlen = size, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(MAX_FDS * sizeof(int)) - }; - - size = recvmsg(ciptr->fd, &msg, 0); - if (size >= 0) { - struct cmsghdr *hdr; - - for (hdr = CMSG_FIRSTHDR(&msg); hdr; hdr = CMSG_NXTHDR(&msg, hdr)) { - if (hdr->cmsg_level == SOL_SOCKET && hdr->cmsg_type == SCM_RIGHTS) { - int nfd = (hdr->cmsg_len - CMSG_LEN(0)) / sizeof (int); - int i; - int *fd = (int *) CMSG_DATA(hdr); - - for (i = 0; i < nfd; i++) - appendFd(&ciptr->recv_fds, fd[i], 0); - } - } - } - return size; - } -#else - return READV (ciptr, buf, size); -#endif - -#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ -} - - -static int -TRANS(SocketWritev) (XtransConnInfo ciptr, struct iovec *buf, int size) - -{ - prmsg (2,"SocketWritev(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - /* - * If we have a valid priv pointer then this - * is an internal connection to the proxy. - * In this case we should emulate the writev. - */ - - if (ciptr->priv) - { - return NXTransWriteVector(ciptr->fd, buf, size); - } - else - { - /* FIXME: same code as below, should be possible without duplication */ -#if XTRANS_SEND_FDS - if (ciptr->send_fds) - { - union fd_pass cmsgbuf; - int nfd = nFd(&ciptr->send_fds); - struct _XtransConnFd *cf = ciptr->send_fds; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = buf, - .msg_iovlen = size, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(nfd * sizeof(int)) - }; - struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); - int i; - int *fds; - - hdr->cmsg_len = msg.msg_controllen; - hdr->cmsg_level = SOL_SOCKET; - hdr->cmsg_type = SCM_RIGHTS; - - fds = (int *) CMSG_DATA(hdr); - /* Set up fds */ - for (i = 0; i < nfd; i++) { - fds[i] = cf->fd; - cf = cf->next; - } - - i = sendmsg(ciptr->fd, &msg, 0); - if (i > 0) - discardFd(&ciptr->send_fds, cf, 0); - return i; - } -#endif - return WRITEV (ciptr, buf, size); - } - -#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ - -#if XTRANS_SEND_FDS - if (ciptr->send_fds) - { - union fd_pass cmsgbuf; - int nfd = nFd(&ciptr->send_fds); - struct _XtransConnFd *cf = ciptr->send_fds; - struct msghdr msg = { - .msg_name = NULL, - .msg_namelen = 0, - .msg_iov = buf, - .msg_iovlen = size, - .msg_control = cmsgbuf.buf, - .msg_controllen = CMSG_LEN(nfd * sizeof(int)) - }; - struct cmsghdr *hdr = CMSG_FIRSTHDR(&msg); - int i; - int *fds; - - hdr->cmsg_len = msg.msg_controllen; - hdr->cmsg_level = SOL_SOCKET; - hdr->cmsg_type = SCM_RIGHTS; - - fds = (int *) CMSG_DATA(hdr); - /* Set up fds */ - for (i = 0; i < nfd; i++) { - fds[i] = cf->fd; - cf = cf->next; - } - - i = sendmsg(ciptr->fd, &msg, 0); - if (i > 0) - discardFd(&ciptr->send_fds, cf, 0); - return i; - } -#endif - return WRITEV (ciptr, buf, size); - -#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ -} - - -static int -TRANS(SocketWrite) (XtransConnInfo ciptr, char *buf, int size) - -{ - prmsg (2,"SocketWrite(%d,%p,%d)\n", ciptr->fd, (void *) buf, size); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - /* - * If we have a valid priv pointer then this - * is an internal connection to the proxy. - * In this case we should emulate the write. - */ - - if (ciptr->priv) - { - int result; - - result = NXTransWrite(ciptr->fd, buf, size); - -#ifdef NX_TRANS_DEBUG - if (result < 0 && EGET() == EAGAIN) - { - fprintf(stderr, "SocketWrite: Write on descriptor [%d] would block.\n", - ciptr->fd); - } - else - { - fprintf(stderr, "SocketWrite: Written [%d] bytes on descriptor [%d].\n", - result, ciptr->fd); - } -#endif - return result; - } - else - { - /* FIXME: same code as below, should be possible without duplication */ -#if XTRANS_SEND_FDS - if (ciptr->send_fds) - { - struct iovec iov; - - iov.iov_base = buf; - iov.iov_len = size; - return TRANS(SocketWritev)(ciptr, &iov, 1); - } -#endif /* XTRANS_SEND_FDS */ - return write (ciptr->fd, buf, size); - } - -#else /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ - -#if defined(WIN32) - { - int ret = send ((SOCKET)ciptr->fd, buf, size, 0); -#ifdef WIN32 - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); -#endif - return ret; - } -#else -#if XTRANS_SEND_FDS - if (ciptr->send_fds) - { - struct iovec iov; - - iov.iov_base = buf; - iov.iov_len = size; - return TRANS(SocketWritev)(ciptr, &iov, 1); - } -#endif /* XTRANS_SEND_FDS */ - return write (ciptr->fd, buf, size); -#endif /* WIN32 */ - -#endif /* #if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) */ -} - -static int -TRANS(SocketDisconnect) (XtransConnInfo ciptr) - -{ - prmsg (2,"SocketDisconnect(%p,%d)\n", (void *) ciptr, ciptr->fd); - -#ifdef WIN32 - { - int ret = shutdown (ciptr->fd, 2); - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); - return ret; - } -#else - return shutdown (ciptr->fd, 2); /* disallow further sends and receives */ -#endif -} - - -#ifdef TCPCONN -static int -TRANS(SocketINETClose) (XtransConnInfo ciptr) - -{ - prmsg (2,"SocketINETClose(%p,%d)\n", (void *) ciptr, ciptr->fd); - -#ifdef WIN32 - { - int ret = close (ciptr->fd); - if (ret == SOCKET_ERROR) errno = WSAGetLastError(); - return ret; - } -#else - return close (ciptr->fd); -#endif -} - -#endif /* TCPCONN */ - - -#ifdef UNIXCONN -static int -TRANS(SocketUNIXClose) (XtransConnInfo ciptr) -{ - /* - * If this is the server side, then once the socket is closed, - * it must be unlinked to completely close it - */ - - struct sockaddr_un *sockname = (struct sockaddr_un *) ciptr->addr; - int ret; - - prmsg (2,"SocketUNIXClose(%p,%d)\n", (void *) ciptr, ciptr->fd); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - if (ciptr->priv) - { - TRANS(SocketCloseConnInfo) (ciptr); - } - -#endif - -#if XTRANS_SEND_FDS - cleanupFds(ciptr); -#endif - ret = close(ciptr->fd); - -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - fprintf(stderr, "SocketUNIXClose: Flags are [%d] for ciptr at [%p] check is [%d].\n", - ciptr->flags, (void *) ciptr, (ciptr->flags && sockname - && sockname->sun_family == AF_UNIX && sockname->sun_path[0])); -#endif - - if (ciptr->flags - && sockname - && sockname->sun_family == AF_UNIX - && sockname->sun_path[0]) - { -#if defined(NX_TRANS_SOCKET) && defined(NX_TRANS_TEST) - if (!(ciptr->flags & TRANS_NOUNLINK - || ciptr->transptr->flags & TRANS_ABSTRACT)) - { - fprintf(stderr, "SocketUNIXClose: Unlinking path [%s] for ciptr at [%p].\n", - sockname->sun_path, (void *) ciptr); - unlink (sockname->sun_path); - } -#else - if (!(ciptr->flags & TRANS_NOUNLINK - || ciptr->transptr->flags & TRANS_ABSTRACT)) - unlink (sockname->sun_path); -#endif - } - - return ret; -} - -static int -TRANS(SocketUNIXCloseForCloning) (XtransConnInfo ciptr) - -{ - /* - * Don't unlink path. - */ - - int ret; - - prmsg (2,"SocketUNIXCloseForCloning(%p,%d)\n", - (void *) ciptr, ciptr->fd); - -#if defined(NX_TRANS_SOCKET) && defined(TRANS_CLIENT) - - if (ciptr->priv) - { - TRANS(SocketCloseConnInfo) (ciptr); - } - -#endif - -#if XTRANS_SEND_FDS - cleanupFds(ciptr); -#endif - ret = close(ciptr->fd); - - return ret; -} - -#endif /* UNIXCONN */ - - -#ifdef TCPCONN -# ifdef TRANS_SERVER -static const char* tcp_nolisten[] = { - "inet", -#if defined(IPv6) && defined(AF_INET6) - "inet6", -#endif - NULL -}; -# endif - -Xtransport TRANS(SocketTCPFuncs) = { - /* Socket Interface */ - "tcp", - TRANS_ALIAS, -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - tcp_nolisten, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketINETCreateListener), - NULL, /* ResetListener */ - TRANS(SocketINETAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketINETConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFdInvalid), - TRANS(SocketRecvFdInvalid), -#endif - TRANS(SocketDisconnect), - TRANS(SocketINETClose), - TRANS(SocketINETClose), - }; - -Xtransport TRANS(SocketINETFuncs) = { - /* Socket Interface */ - "inet", - 0, -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketINETCreateListener), - NULL, /* ResetListener */ - TRANS(SocketINETAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketINETConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFdInvalid), - TRANS(SocketRecvFdInvalid), -#endif - TRANS(SocketDisconnect), - TRANS(SocketINETClose), - TRANS(SocketINETClose), - }; - -#if defined(IPv6) && defined(AF_INET6) -Xtransport TRANS(SocketINET6Funcs) = { - /* Socket Interface */ - "inet6", - 0, -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketINETCreateListener), - NULL, /* ResetListener */ - TRANS(SocketINETAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketINETConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFdInvalid), - TRANS(SocketRecvFdInvalid), -#endif - TRANS(SocketDisconnect), - TRANS(SocketINETClose), - TRANS(SocketINETClose), - }; -#endif /* IPv6 */ -#endif /* TCPCONN */ - -#ifdef UNIXCONN -#if !defined(LOCALCONN) -Xtransport TRANS(SocketLocalFuncs) = { - /* Socket Interface */ - "local", -#ifdef HAVE_ABSTRACT_SOCKETS - TRANS_ABSTRACT, -#else - 0, -#endif -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER - NULL, - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketUNIXCreateListener), - TRANS(SocketUNIXResetListener), - TRANS(SocketUNIXAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketUNIXConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFd), - TRANS(SocketRecvFd), -#endif - TRANS(SocketDisconnect), - TRANS(SocketUNIXClose), - TRANS(SocketUNIXCloseForCloning), - }; -#endif /* !LOCALCONN */ -# ifdef TRANS_SERVER -# if !defined(LOCALCONN) -static const char* unix_nolisten[] = { "local" , NULL }; -# endif -# endif - -Xtransport TRANS(SocketUNIXFuncs) = { - /* Socket Interface */ - "unix", -#if !defined(LOCALCONN) && !defined(HAVE_ABSTRACT_SOCKETS) - TRANS_ALIAS, -#else - 0, -#endif -#ifdef TRANS_CLIENT - TRANS(SocketOpenCOTSClient), -#endif /* TRANS_CLIENT */ -#ifdef TRANS_SERVER -#if !defined(LOCALCONN) - unix_nolisten, -#else - NULL, -#endif - TRANS(SocketOpenCOTSServer), -#endif /* TRANS_SERVER */ -#ifdef TRANS_REOPEN - TRANS(SocketReopenCOTSServer), -#endif - TRANS(SocketSetOption), -#ifdef TRANS_SERVER - TRANS(SocketUNIXCreateListener), - TRANS(SocketUNIXResetListener), - TRANS(SocketUNIXAccept), -#endif /* TRANS_SERVER */ -#ifdef TRANS_CLIENT - TRANS(SocketUNIXConnect), -#endif /* TRANS_CLIENT */ - TRANS(SocketBytesReadable), - TRANS(SocketRead), - TRANS(SocketWrite), - TRANS(SocketReadv), - TRANS(SocketWritev), -#if XTRANS_SEND_FDS - TRANS(SocketSendFd), - TRANS(SocketRecvFd), -#endif - TRANS(SocketDisconnect), - TRANS(SocketUNIXClose), - TRANS(SocketUNIXCloseForCloning), - }; - -#endif /* UNIXCONN */ - -#ifdef NX_TRANS_SOCKET -/* - * Override the UNIX_DIR and UNIX_PATH settings and - * make them configurable, based on the NX_TEMP or - * the TEMP environment. - * - * We must be careful as the same defines are used - * for different directories, based on the subsystem - * that is compiling this, while we want to override - * only the '/tmp/.X11-unix' and '/tmp/.X11-unix/X' - * settings. - */ - -static char _NXUnixDir[1024]; -static char _NXUnixPath[1024]; - -static char *_NXGetUnixDir(char *dir) -{ - const char *tempDir; - - prmsg (3, "_NXGetUnixDir(%s)\n", dir); - - if (strcmp(dir, UNIX_DIR) != 0) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixDir: Returning other Unix directory [%s].\n", dir); -#endif - return dir; - } - - /* - * Check the environment only once. - */ - - if (*_NXUnixDir != '\0') - { - return _NXUnixDir; - } - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixDir: Trying with the NX_TEMP environment.\n"); -#endif - - tempDir = getenv("NX_TEMP"); - - if (tempDir == NULL || *tempDir == '\0') - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixDir: Trying with the TEMP environment.\n"); -#endif - - tempDir = getenv("TEMP"); - } - - if (tempDir != NULL && *tempDir != '\0') - { - if (strlen(tempDir) + strlen("/.X11-unix") + 1 > 1024) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixDir: WARNING! Maximum length of X11 Unix directory exceeded.\n"); -#endif - goto _NXGetUnixDirError; - } - - strcpy(_NXUnixDir, tempDir); - strcat(_NXUnixDir, "/.X11-unix"); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixDir: Using X11 Unix directory [%s].\n", _NXUnixDir); -#endif - - return _NXUnixDir; - } - -_NXGetUnixDirError: - - strcpy(_NXUnixDir, dir); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixDir: Returning default X11 Unix directory [%s].\n", _NXUnixDir); -#endif - - return _NXUnixDir; -} - -static char *_NXGetUnixPath(char *path) -{ - const char *unixDir; - - prmsg (3, "_NXGetUnixPath(%s)\n", path); - - if (strcmp(path, UNIX_PATH) != 0) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixPath: Returning other X11 Unix path [%s].\n", path); -#endif - return path; - } - - /* - * Check the environment only once. - */ - - if (*_NXUnixPath != '\0') - { - return _NXUnixPath; - } - - unixDir = _NXGetUnixDir(UNIX_DIR); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixPath: Got X11 Unix directory [%s].\n", unixDir); -#endif - - if (strlen(unixDir) + strlen("/X") + 1 > 1024) - { -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixPath: WARNING! Maximum length of X11 Unix path exceeded.\n"); -#endif - - goto _NXGetUnixPathError; - } - - strcpy(_NXUnixPath, unixDir); - strcat(_NXUnixPath, "/X"); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixPath: Returning X11 Unix path [%s].\n", _NXUnixPath); -#endif - - return _NXUnixPath; - -_NXGetUnixPathError: - - strcpy(_NXUnixPath, path); - -#ifdef NX_TRANS_TEST - fprintf(stderr, "_NXGetUnixPath: Returning default X11 Unix path [%s].\n", _NXUnixPath); -#endif - - return _NXUnixPath; -} - -#endif /* NX_TRANS_SOCKET */ diff --git a/nx-X11/lib/xtrans/Xtransutil.c b/nx-X11/lib/xtrans/Xtransutil.c deleted file mode 100644 index 0063e83d8..000000000 --- a/nx-X11/lib/xtrans/Xtransutil.c +++ /dev/null @@ -1,639 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCRS DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -/* - * These are some utility functions created for convenience or to provide - * an interface that is similar to an existing interface. These are built - * only using the Transport Independant API, and have no knowledge of - * the internal implementation. - */ - -#ifdef XTHREADS -#include -#endif -#ifdef WIN32 -#include -#include -#endif - -#ifdef X11_t - -/* - * These values come from X.h and Xauth.h, and MUST match them. Some - * of these values are also defined by the ChangeHost protocol message. - */ - -#define FamilyInternet 0 /* IPv4 */ -#define FamilyDECnet 1 -#define FamilyChaos 2 -#define FamilyInternet6 6 -#define FamilyAmoeba 33 -#define FamilyLocalHost 252 -#define FamilyKrb5Principal 253 -#define FamilyNetname 254 -#define FamilyLocal 256 -#define FamilyWild 65535 - -/* - * TRANS(ConvertAddress) converts a sockaddr based address to an - * X authorization based address. Some of this is defined as part of - * the ChangeHost protocol. The rest is just done in a consistent manner. - */ - -int -TRANS(ConvertAddress)(int *familyp, int *addrlenp, Xtransaddr **addrp) - -{ - - prmsg(2,"ConvertAddress(%d,%d,%p)\n",*familyp,*addrlenp,(void *) *addrp); - - switch( *familyp ) - { -#if defined(TCPCONN) - case AF_INET: - { - /* - * Check for the BSD hack localhost address 127.0.0.1. - * In this case, we are really FamilyLocal. - */ - - struct sockaddr_in saddr; - int len = sizeof(saddr.sin_addr.s_addr); - char *cp = (char *) &saddr.sin_addr.s_addr; - - memcpy (&saddr, *addrp, sizeof (struct sockaddr_in)); - - if ((len == 4) && (cp[0] == 127) && (cp[1] == 0) && - (cp[2] == 0) && (cp[3] == 1)) - { - *familyp=FamilyLocal; - } - else - { - *familyp=FamilyInternet; - *addrlenp=len; - memcpy(*addrp,&saddr.sin_addr,len); - } - break; - } - -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: - { - struct sockaddr_in6 saddr6; - - memcpy (&saddr6, *addrp, sizeof (struct sockaddr_in6)); - - if (IN6_IS_ADDR_LOOPBACK(&saddr6.sin6_addr)) - { - *familyp=FamilyLocal; - } - else if (IN6_IS_ADDR_V4MAPPED(&(saddr6.sin6_addr))) { - char *cp = (char *) &saddr6.sin6_addr.s6_addr[12]; - - if ((cp[0] == 127) && (cp[1] == 0) && - (cp[2] == 0) && (cp[3] == 1)) - { - *familyp=FamilyLocal; - } - else - { - *familyp=FamilyInternet; - *addrlenp = sizeof (struct in_addr); - memcpy(*addrp,cp,*addrlenp); - } - } - else - { - *familyp=FamilyInternet6; - *addrlenp=sizeof(saddr6.sin6_addr); - memcpy(*addrp,&saddr6.sin6_addr,sizeof(saddr6.sin6_addr)); - } - break; - } -#endif /* IPv6 */ -#endif /* defined(TCPCONN) */ - - -#if defined(UNIXCONN) || defined(LOCALCONN) - case AF_UNIX: - { - *familyp=FamilyLocal; - break; - } -#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ - -#if (defined(__SCO__) || defined(__UNIXWARE__)) && defined(LOCALCONN) - case 0: - { - *familyp=FamilyLocal; - break; - } -#endif - - default: - prmsg(1,"ConvertAddress: Unknown family type %d\n", - *familyp); - return -1; - } - - - if (*familyp == FamilyLocal) - { - /* - * In the case of a local connection, we need to get the - * host name for authentication. - */ - - char hostnamebuf[256]; - int len = TRANS(GetHostname) (hostnamebuf, sizeof hostnamebuf); - - if (len > 0) { - if (*addrp && *addrlenp < (len + 1)) - { - free (*addrp); - *addrp = NULL; - } - if (!*addrp) - *addrp = malloc (len + 1); - if (*addrp) { - strcpy ((char *) *addrp, hostnamebuf); - *addrlenp = len; - } else { - *addrlenp = 0; - } - } - else - { - if (*addrp) - free (*addrp); - *addrp = NULL; - *addrlenp = 0; - } - } - - return 0; -} - -#endif /* X11_t */ - -#ifdef ICE_t - -/* Needed for _XGethostbyaddr usage in TRANS(GetPeerNetworkId) */ -# if defined(TCPCONN) || defined(UNIXCONN) -# define X_INCLUDE_NETDB_H -# define XOS_USE_NO_LOCKING -# include -# endif - -#include - -char * -TRANS(GetMyNetworkId) (XtransConnInfo ciptr) - -{ - int family = ciptr->family; - char *addr = ciptr->addr; - char hostnamebuf[256]; - char *networkId = NULL; - const char *transName = ciptr->transptr->TransName; - - if (gethostname (hostnamebuf, sizeof (hostnamebuf)) < 0) - { - return (NULL); - } - - switch (family) - { -#if defined(UNIXCONN) || defined(LOCALCONN) - case AF_UNIX: - { - struct sockaddr_un *saddr = (struct sockaddr_un *) addr; - networkId = malloc (3 + strlen (transName) + - strlen (hostnamebuf) + strlen (saddr->sun_path)); - sprintf (networkId, "%s/%s:%s", transName, - hostnamebuf, saddr->sun_path); - break; - } -#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ - -#if defined(TCPCONN) - case AF_INET: -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: -#endif - { - struct sockaddr_in *saddr = (struct sockaddr_in *) addr; -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) addr; -#endif - int portnum; - char portnumbuf[10]; - - -#if defined(IPv6) && defined(AF_INET6) - if (family == AF_INET6) - portnum = ntohs (saddr6->sin6_port); - else -#endif - portnum = ntohs (saddr->sin_port); - - snprintf (portnumbuf, sizeof(portnumbuf), "%d", portnum); - networkId = malloc (3 + strlen (transName) + - strlen (hostnamebuf) + strlen (portnumbuf)); - sprintf (networkId, "%s/%s:%s", transName, hostnamebuf, portnumbuf); - break; - } -#endif /* defined(TCPCONN) */ - - - default: - break; - } - - return (networkId); -} - -#include -static jmp_buf env; - -#ifdef SIGALRM -static volatile int nameserver_timedout = 0; - -static void -nameserver_lost(int sig _X_UNUSED) -{ - nameserver_timedout = 1; - longjmp (env, -1); - /* NOTREACHED */ -} -#endif /* SIGALARM */ - - -char * -TRANS(GetPeerNetworkId) (XtransConnInfo ciptr) - -{ - int family = ciptr->family; - char *peer_addr = ciptr->peeraddr; - char *hostname; - char addrbuf[256]; - const char *addr = NULL; - - switch (family) - { - case AF_UNSPEC: -#if defined(UNIXCONN) || defined(LOCALCONN) - case AF_UNIX: - { - if (gethostname (addrbuf, sizeof (addrbuf)) == 0) - addr = addrbuf; - break; - } -#endif /* defined(UNIXCONN) || defined(LOCALCONN) */ - -#if defined(TCPCONN) - case AF_INET: -#if defined(IPv6) && defined(AF_INET6) - case AF_INET6: -#endif - { - struct sockaddr_in *saddr = (struct sockaddr_in *) peer_addr; -#if defined(IPv6) && defined(AF_INET6) - struct sockaddr_in6 *saddr6 = (struct sockaddr_in6 *) peer_addr; -#endif - char *address; - int addresslen; -#ifdef XTHREADS_NEEDS_BYNAMEPARAMS - _Xgethostbynameparams hparams; -#endif - struct hostent * volatile hostp = NULL; - -#if defined(IPv6) && defined(AF_INET6) - if (family == AF_INET6) - { - address = (char *) &saddr6->sin6_addr; - addresslen = sizeof (saddr6->sin6_addr); - } - else -#endif - { - address = (char *) &saddr->sin_addr; - addresslen = sizeof (saddr->sin_addr); - } - -#ifdef SIGALRM - /* - * gethostbyaddr can take a LONG time if the host does not exist. - * Assume that if it does not respond in NAMESERVER_TIMEOUT seconds - * that something is wrong and do not make the user wait. - * gethostbyaddr will continue after a signal, so we have to - * jump out of it. - */ - - nameserver_timedout = 0; - signal (SIGALRM, nameserver_lost); - alarm (4); - if (setjmp(env) == 0) { -#endif - hostp = _XGethostbyaddr (address, addresslen, family, hparams); -#ifdef SIGALRM - } - alarm (0); -#endif - if (hostp != NULL) - addr = hostp->h_name; - else -#if defined(IPv6) && defined(AF_INET6) - addr = inet_ntop (family, address, addrbuf, sizeof (addrbuf)); -#else - addr = inet_ntoa (saddr->sin_addr); -#endif - break; - } - -#endif /* defined(TCPCONN) */ - - - default: - return (NULL); - } - - - hostname = malloc (strlen (ciptr->transptr->TransName) + strlen (addr) + 2); - strcpy (hostname, ciptr->transptr->TransName); - strcat (hostname, "/"); - if (addr) - strcat (hostname, addr); - - return (hostname); -} - -#endif /* ICE_t */ - - -#if defined(WIN32) && defined(TCPCONN) -int -TRANS(WSAStartup) (void) -{ - static WSADATA wsadata; - - prmsg (2,"WSAStartup()\n"); - - if (!wsadata.wVersion && WSAStartup(MAKEWORD(2,2), &wsadata)) - return 1; - return 0; -} -#endif - -#include - -#if defined(X11_t) -static int -is_numeric (const char *str) -{ - int i; - - for (i = 0; i < (int) strlen (str); i++) - if (!isdigit (str[i])) - return (0); - - return (1); -} -#endif - -#ifdef TRANS_SERVER -#include -#include -#include - -#if !defined(S_IFLNK) && !defined(S_ISLNK) -#undef lstat -#define lstat(a,b) stat(a,b) -#endif - -#define FAIL_IF_NOMODE 1 -#define FAIL_IF_NOT_ROOT 2 -#define WARN_NO_ACCESS 4 - -/* - * We make the assumption that when the 'sticky' (t) bit is requested - * it's not save if the directory has non-root ownership or the sticky - * bit cannot be set and fail. - */ -static int -trans_mkdir(const char *path, int mode) -{ - struct stat buf; - - if (lstat(path, &buf) != 0) { - if (errno != ENOENT) { - prmsg(1, "mkdir: ERROR: (l)stat failed for %s (%d)\n", - path, errno); - return -1; - } - /* Dir doesn't exist. Try to create it */ - -#if !defined(WIN32) && !defined(__CYGWIN__) - /* - * 'sticky' bit requested: assume application makes - * certain security implications. If effective user ID - * is != 0: fail as we may not be able to meet them. - */ - if (geteuid() != 0) { - if (mode & 01000) { - prmsg(1, "mkdir: ERROR: euid != 0," - "directory %s will not be created.\n", - path); -#ifdef FAIL_HARD - return -1; -#endif - } else { - prmsg(1, "mkdir: Cannot create %s with root ownership\n", - path); - } - } -#endif - -#ifndef WIN32 - if (mkdir(path, mode) == 0) { - if (chmod(path, mode)) { - prmsg(1, "mkdir: ERROR: Mode of %s should be set to %04o\n", - path, mode); -#ifdef FAIL_HARD - return -1; -#endif - } -#else - if (mkdir(path) == 0) { -#endif - } else { - prmsg(1, "mkdir: ERROR: Cannot create %s\n", - path); - return -1; - } - - return 0; - - } else { - if (S_ISDIR(buf.st_mode)) { - int updateOwner = 0; - int updateMode = 0; - int updatedOwner = 0; - int updatedMode = 0; - int status = 0; - /* Check if the directory's ownership is OK. */ - if (buf.st_uid != 0) - updateOwner = 1; - - /* - * Check if the directory's mode is OK. An exact match isn't - * required, just a mode that isn't more permissive than the - * one requested. - */ - if ((~mode) & 0077 & buf.st_mode) - updateMode = 1; - - /* - * If the directory is not writeable not everybody may - * be able to create sockets. Therefore warn if mode - * cannot be fixed. - */ - if ((~buf.st_mode) & 0022 & mode) { - updateMode = 1; - status |= WARN_NO_ACCESS; - } - - /* - * If 'sticky' bit is requested fail if owner isn't root - * as we assume the caller makes certain security implications - */ - if (mode & 01000) { - status |= FAIL_IF_NOT_ROOT; - if (!(buf.st_mode & 01000)) { - status |= FAIL_IF_NOMODE; - updateMode = 1; - } - } - -#ifdef HAS_FCHOWN - /* - * If fchown(2) and fchmod(2) are available, try to correct the - * directory's owner and mode. Otherwise it isn't safe to attempt - * to do this. - */ - if (updateMode || updateOwner) { - int fd = -1; - struct stat fbuf; - if ((fd = open(path, O_RDONLY)) != -1) { - if (fstat(fd, &fbuf) == -1) { - prmsg(1, "mkdir: ERROR: fstat failed for %s (%d)\n", - path, errno); - close(fd); - return -1; - } - /* - * Verify that we've opened the same directory as was - * checked above. - */ - if (!S_ISDIR(fbuf.st_mode) || - buf.st_dev != fbuf.st_dev || - buf.st_ino != fbuf.st_ino) { - prmsg(1, "mkdir: ERROR: inode for %s changed\n", - path); - close(fd); - return -1; - } - if (updateOwner && fchown(fd, 0, 0) == 0) - updatedOwner = 1; - if (updateMode && fchmod(fd, mode) == 0) - updatedMode = 1; - close(fd); - } - } -#endif - - if (updateOwner && !updatedOwner) { -#ifdef FAIL_HARD - if (status & FAIL_IF_NOT_ROOT) { - prmsg(1, "mkdir: ERROR: Owner of %s must be set to root\n", - path); - return -1; - } -#endif -#if !defined(__APPLE_CC__) && !defined(__CYGWIN__) - prmsg(1, "mkdir: Owner of %s should be set to root\n", - path); -#endif - } - - if (updateMode && !updatedMode) { -#ifdef FAIL_HARD - if (status & FAIL_IF_NOMODE) { - prmsg(1, "mkdir: ERROR: Mode of %s must be set to %04o\n", - path, mode); - return -1; - } -#endif - prmsg(1, "mkdir: Mode of %s should be set to %04o\n", - path, mode); - if (status & WARN_NO_ACCESS) { - prmsg(1, "mkdir: this may cause subsequent errors\n"); - } - } - return 0; - } - return -1; - } - - /* In all other cases, fail */ - return -1; -} - -#endif /* TRANS_SERVER */ diff --git a/nx-X11/lib/xtrans/transport.c b/nx-X11/lib/xtrans/transport.c deleted file mode 100644 index b62fc7b64..000000000 --- a/nx-X11/lib/xtrans/transport.c +++ /dev/null @@ -1,74 +0,0 @@ -/* - -Copyright 1993, 1994, 1998 The Open Group - -Permission to use, copy, modify, distribute, and sell this software and its -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. - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR -OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, -ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR -OTHER DEALINGS IN THE SOFTWARE. - -Except as contained in this notice, the name of The Open Group shall -not be used in advertising or otherwise to promote the sale, use or -other dealings in this Software without prior written authorization -from The Open Group. - - * Copyright 1993, 1994 NCR Corporation - Dayton, Ohio, USA - * - * All Rights Reserved - * - * 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 supporting - * documentation, and that the name NCR not be used in advertising - * or publicity pertaining to distribution of the software without specific, - * written prior permission. NCR makes no representations about the - * suitability of this software for any purpose. It is provided "as is" - * without express or implied warranty. - * - * NCR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, - * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN - * NO EVENT SHALL NCR 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. - */ - -#include - -#define XTRANS_TRANSPORT_C /* used to flag Xtransint.h that it's being used - here, not just #included in another file */ - -#include "Xtransint.h" - -#ifdef __clang__ -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wformat-nonliteral" -#pragma clang diagnostic ignored "-Wdeprecated-declarations" -#endif - -#ifdef LOCALCONN -#include "Xtranslcl.c" -#endif -#if defined(TCPCONN) || defined(UNIXCONN) -#include "Xtranssock.c" -#endif -#include "Xtrans.c" -#include "Xtransutil.c" - -#ifdef __clang__ -#pragma clang diagnostic pop -#endif diff --git a/nx-X11/programs/Xserver/Imakefile b/nx-X11/programs/Xserver/Imakefile index 3c7e68597..3cfd5dcb0 100644 --- a/nx-X11/programs/Xserver/Imakefile +++ b/nx-X11/programs/Xserver/Imakefile @@ -317,6 +317,7 @@ $(NXAGENTOBJS) $(NXAGENTLIBS) $(NXAGENTSYSLIBS):: $(NXAGENTDIRS) NXAGENTNXLIBS = -L/usr/sfw/lib \ -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ + -L../../lib/src/.libs \ -lrt \ -lXcomp \ -lXcompshad \ @@ -332,6 +333,7 @@ NXAGENTNXLIBS = -L/usr/sfw/lib \ #elif defined(cygwinArchitecture) NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ + -L../../lib/src/.libs \ -lXcomp \ -lXcompshad \ -lXrender \ @@ -344,8 +346,8 @@ NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ $(NULL) #elif defined(OpenBSDArchitecture) NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ - -L../../../nx-X11/exports/lib \ -L../../../nxcompshad/src/.libs \ + -L../../lib/src/.libs \ -lkvm \ -lXcomp \ -lXcompshad \ @@ -361,6 +363,7 @@ NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ #else NXAGENTNXLIBS = -L../../../nxcomp/src/.libs \ -L../../../nxcompshad/src/.libs \ + -L../../lib/src/.libs \ -lXcomp \ -lXcompshad \ -lXrender \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/Imakefile index a1b059cae..43dace09e 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/Imakefile @@ -149,6 +149,7 @@ INCLUDES = \ -I../../GL/include \ -I../../../../lib/GL/include \ -I../../Xext \ + -I../../../../lib/include/X11 \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ @@ -169,6 +170,7 @@ INCLUDES = \ -I../../Xext \ -I../../miext/damage \ -I../../miext/cw \ + -I../../../../lib/include/X11 \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ @@ -192,6 +194,7 @@ INCLUDES = \ -I../../../../../nxcomp \ -I../../../../../nxcompshad \ -I../../../../extras/Mesa/include \ + -I../../../../lib/include/X11 \ -I$(EXTINCSRC) -I$(XINCLUDESRC) \ $(VFBINCLUDES) \ `pkg-config --cflags-only-I libxml-2.0` \ diff --git a/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile b/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile index 8f0f17d1e..d364370ac 100644 --- a/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile +++ b/nx-X11/programs/Xserver/hw/nxagent/compext/Imakefile @@ -32,6 +32,7 @@ OBJS = \ INCLUDES = -I$(SERVERSRC)/include \ -I$(XBUILDINCDIR) \ + -I../../../../../lib/include/X11 \ `pkg-config --cflags-only-I pixman-1` \ `pkg-config --cflags-only-I zlib` \ `pkg-config --cflags-only-I libpng` \ diff --git a/nxcompshad/src/Makefile.am b/nxcompshad/src/Makefile.am index c7f45ba27..6d82dcd88 100644 --- a/nxcompshad/src/Makefile.am +++ b/nxcompshad/src/Makefile.am @@ -18,7 +18,7 @@ libXcompshad_la_LIBADD = \ @Xdamage_LIBS@ \ @Xrandr_LIBS@ \ @Xtst_LIBS@ \ - -L$(top_srcdir)/../nx-X11/exports/lib -lNX_X11 \ + -L$(top_srcdir)/../nx-X11/lib/src/.libs -lNX_X11 \ $(NULL) AM_CFLAGS = \ -- cgit v1.2.3 From 71878f7a9b6ca4ac9d1b15374d2f0b8247df7ae4 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 25 Aug 2017 16:29:29 +0200 Subject: Makefile: Use $(RM_DIR) rather then plain rmdir in clean-env target. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 906b3715e..8f1da954d 100644 --- a/Makefile +++ b/Makefile @@ -120,8 +120,8 @@ clean-env: version ${RM_FILE} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \ done - -rmdir exports/include/nx-X11/Xtrans/ - -rmdir exports/include/nx-X11/ + -$(RM_DIR) exports/include/nx-X11/Xtrans/ + -$(RM_DIR) exports/include/nx-X11/ ${MAKE} -C nx-X11 CleanEnv FONT_DEFINES=$(FONT_DEFINES) -- cgit v1.2.3 From a32f1dfa1b6f7fbc63bcbb274cf936ec00e77e25 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Fri, 25 Aug 2017 16:34:30 +0200 Subject: Makefile: Check for dir existence before attempting to remove it. --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 8f1da954d..27a6f966c 100644 --- a/Makefile +++ b/Makefile @@ -120,8 +120,8 @@ clean-env: version ${RM_FILE} nx-X11/exports/include/nx-X11/Xtrans/$${header}; \ done - -$(RM_DIR) exports/include/nx-X11/Xtrans/ - -$(RM_DIR) exports/include/nx-X11/ + [ -d exports/include/nx-X11/Xtrans ] && $(RM_DIR) exports/include/nx-X11/Xtrans/ || : + [ -d exports/include/nx-X11/ ] && $(RM_DIR) exports/include/nx-X11/ || : ${MAKE} -C nx-X11 CleanEnv FONT_DEFINES=$(FONT_DEFINES) -- cgit v1.2.3 From ca43087812afa2817ddc086591b60d593aacc954 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Nov 2017 13:28:17 +0100 Subject: Drop bin wrappers for nxagent and nxproxy, directly install nxproxy and nxagent to BINDIR. Fixes ArcticaProject/nx-libs#546. --- Makefile | 43 +++++++++++++------------------------------ bin/nxagent.in | 24 ------------------------ bin/nxproxy.in | 24 ------------------------ debian/nxagent.install | 3 ++- debian/nxproxy.install | 1 - nx-X11/config/cf/X11.tmpl | 2 +- nx-libs.spec | 7 +------ nxproxy/src/Makefile.am | 2 +- 8 files changed, 18 insertions(+), 88 deletions(-) delete mode 100644 bin/nxagent.in delete mode 100644 bin/nxproxy.in (limited to 'Makefile') diff --git a/Makefile b/Makefile index 27a6f966c..204a7310a 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) --libexecdir=$(NXLIBDIR)/bin +CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) # use Xfont2 if available in the build env FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") @@ -75,8 +75,6 @@ NX_XTRANS_HEADERS = \ rm -Rf nx-X11/extras/Mesa/.pc/; \ rm -f nx-X11/config/cf/nxversion.def; \ rm -f nx-X11/config/cf/date.def; \ - rm -f bin/nxagent; \ - rm -f bin/nxproxy; \ ${MAKE} clean-env; \ fi @@ -168,30 +166,24 @@ install-lite: # install nxcomp library $(MAKE) -C nxcomp install - # install nxproxy wrapper script - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxproxy.in > bin/nxproxy - $(INSTALL_PROGRAM) bin/nxproxy $(DESTDIR)$(BINDIR) - # install the nxproxy executable and its man page $(MAKE) -C nxproxy install install-full: - # install nxagent wrapper script - $(INSTALL_DIR) $(DESTDIR)$(BINDIR) - sed -e 's|@@NXLIBDIR@@|$(NXLIBDIR)|g' bin/nxagent.in > bin/nxagent - $(INSTALL_PROGRAM) bin/nxagent $(DESTDIR)$(BINDIR) - $(MAKE) -C nxcompshad install + $(INSTALL_DIR) $(DESTDIR)$(BINDIR)/bin + $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(BINDIR) + $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/nxagent.xpm $(DESTDIR)$(PREFIX)/share/pixmaps $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/nx $(INSTALL_FILE) nx-X11/programs/Xserver/Xext/SecurityPolicy $(DESTDIR)$(PREFIX)/share/nx + # FIXME: Drop this symlink for 3.6.0. Requires that third party frameworks like X2Go have become aware of this... $(INSTALL_DIR) $(DESTDIR)$(NXLIBDIR)/bin - $(INSTALL_PROGRAM) nx-X11/programs/Xserver/nxagent $(DESTDIR)$(NXLIBDIR)/bin + $(INSTALL_SYMLINK) $(BINDIR)/nxagent $(DESTDIR)$(NXLIBDIR)/bin/nxagent $(INSTALL_DIR) $(DESTDIR)$(PREFIX)/share/man/man1/ $(INSTALL_FILE) nx-X11/programs/Xserver/hw/nxagent/man/nxagent.1 $(DESTDIR)$(PREFIX)/share/man/man1/ @@ -243,28 +235,19 @@ uninstall: uninstall-lite: if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi - # uninstall nproxy wrapper script - $(RM_FILE) $(DESTDIR)$(BINDIR)/nxproxy - # FIXME: don't use uninstall rule in nxproxy/Makefile.in, let's do - # it on our own for now... - $(RM_FILE) $(DESTDIR)$(NXLIBDIR)/bin/nxproxy - $(RM_DIR) $(DESTDIR)$(NXLIBDIR)/bin/ - $(RM_FILE) $(DESTDIR)$(PREFIX)/share/man/man1/*.1 $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ uninstall-full: - for f in nxagent; do \ - $(RM_FILE) $(DESTDIR)$(BINDIR)/$$f; done + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi + if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib $@; fi + + $(RM_FILE) $(DESTDIR)$(BINDIR)/nxagent $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxagent $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ - if test -d nx-X11; then \ - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ - if test -f nx-X11/Makefile; then \ - if test -d $(NXLIBDIR); then rm -rf $(NXLIBDIR); fi; \ - if test -d $(INCLUDEDIR)/nx; then rm -rf $(INCLUDEDIR)/nx; fi; \ - fi; \ - fi + if test -d $(DESTDIR)$(NXLIBDIR); then rm -rf $(DESTDIR)$(NXLIBDIR); fi + if test -d $(DESTDIR)$(INCLUDEDIR)/nx; then rm -rf $(DESTDIR)$(INCLUDEDIR)/nx; fi diff --git a/bin/nxagent.in b/bin/nxagent.in deleted file mode 100644 index 3a9dfc649..000000000 --- a/bin/nxagent.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NX_LIBDIR=@@NXLIBDIR@@ - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -exec $NX_LIBDIR/bin/${NXAPP:-"nxagent"} "$@" diff --git a/bin/nxproxy.in b/bin/nxproxy.in deleted file mode 100644 index 0866d25ac..000000000 --- a/bin/nxproxy.in +++ /dev/null @@ -1,24 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2012 Mike Gabriel -# -# This program is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program. If not, see http://www.gnu.org/licenses/. - -NX_LIBDIR=@@NXLIBDIR@@ - -# make sure nxagent starts properly with pam_tmpdir.so being in use -NX_TEMP=${NX_TEMP:-/tmp} -export NX_TEMP - -exec $NX_LIBDIR/bin/${NXAPP:="nxproxy"} "$@" diff --git a/debian/nxagent.install b/debian/nxagent.install index 34f5c3a76..87ba3583f 100644 --- a/debian/nxagent.install +++ b/debian/nxagent.install @@ -1,8 +1,9 @@ etc/nxagent/keystrokes.cfg usr/share/nx/VERSION.nxagent usr/share/man/man1/nxagent.1* -usr/lib/*/nx/bin/nxagent usr/lib/*/nx/X11/ usr/bin/nxagent usr/share/pixmaps/nxagent.xpm etc/nxagent/nxagent.keyboard +# FIXME: compatibility symlink, drop for 3.6.0 release +usr/lib/*/nx/bin/nxagent diff --git a/debian/nxproxy.install b/debian/nxproxy.install index 8ade77d6d..988f2842f 100644 --- a/debian/nxproxy.install +++ b/debian/nxproxy.install @@ -1,4 +1,3 @@ -usr/lib/*/nx/bin/nxproxy usr/bin/nxproxy usr/share/man/man1/nxproxy.1* usr/share/nx/VERSION.nxproxy diff --git a/nx-X11/config/cf/X11.tmpl b/nx-X11/config/cf/X11.tmpl index ddd6e0bad..9b3e0e8b3 100644 --- a/nx-X11/config/cf/X11.tmpl +++ b/nx-X11/config/cf/X11.tmpl @@ -769,7 +769,7 @@ FCHOWN_DEFINES = -DHAS_FCHOWN #ifndef BinDir #ifdef ProjectRoot -#define BinDir Concat(ProjectRoot,/lib/nx/bin) +#define BinDir Concat(ProjectRoot,/bin) #else #define BinDir /usr/bin/X11 #endif diff --git a/nx-libs.spec b/nx-libs.spec index 4a64b8aed..68bec6397 100644 --- a/nx-libs.spec +++ b/nx-libs.spec @@ -367,10 +367,6 @@ This package provides the NX proxy (client) binary. rm -Rf nx*/configure nx*/autom4te.cache* # Install into /usr sed -i -e 's,/usr/local,/usr,' nx-X11/config/cf/site.def -# Use multilib dirs -# We're installing binaries into %%{_libdir}/nx/bin rather than %%{_libexedir}/nx -# because upstream expects libraries and binaries in the same directory -sed -i -e 's,/lib/nx,/%{_lib}/nx,' nx-X11/config/cf/X11.tmpl # Fix FSF address find -name LICENSE | xargs sed -i \ -e 's/59 Temple Place/51 Franklin Street/' -e 's/Suite 330/Fifth Floor/' \ @@ -575,6 +571,7 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %config(noreplace) %{_sysconfdir}/nxagent/nxagent.keyboard %doc doc/nxagent/README.keystrokes %{_bindir}/nxagent +# FIXME: compatibility symlink to BINDIR/nxagent, remove for 3.6.0 %dir %{_libdir}/nx/bin %{_libdir}/nx/bin/nxagent %dir %{_libdir}/nx/X11 @@ -590,8 +587,6 @@ rm -r %{buildroot}%{_includedir}/nx-X11/Xtrans %doc doc/nxproxy/README-VALGRIND %{_bindir}/nxproxy %{_datadir}/man/man1/nxproxy.1* -%dir %{_libdir}/nx/bin -%{_libdir}/nx/bin/nxproxy %dir %{_datadir}/nx %{_datadir}/nx/VERSION.nxproxy diff --git a/nxproxy/src/Makefile.am b/nxproxy/src/Makefile.am index 7e55900d3..4fd2eefd6 100644 --- a/nxproxy/src/Makefile.am +++ b/nxproxy/src/Makefile.am @@ -1,6 +1,6 @@ NULL = -nxexecdir = $(libexecdir) +nxexecdir = $(bindir) nxexec_PROGRAMS = nxproxy -- cgit v1.2.3 From 1539c20e56696d861126108266a4711942caec31 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 21 Nov 2017 13:45:55 +0100 Subject: Makefile: Don't use DESTDIR in configure. Fixes ArcticaProject/nx-libs#547. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 204a7310a..6e9479284 100644 --- a/Makefile +++ b/Makefile @@ -23,7 +23,7 @@ SHLIBDIR ?= $(LIBDIR) NXLIBDIR ?= $(SHLIBDIR)/nx USRLIBDIR ?= $(NXLIBDIR)/X11 INCLUDEDIR ?= $(PREFIX)/include -CONFIGURE ?= ./configure --prefix=$(DESTDIR)$(PREFIX) +CONFIGURE ?= ./configure --prefix=$(PREFIX) # use Xfont2 if available in the build env FONT_DEFINES ?= $(shell pkg-config --modversion xfont2 1>/dev/null 2>/dev/null && echo "-DHAS_XFONT2") -- cgit v1.2.3 From c54558e3cbf796de60e443dd86159468a9a3c99d Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 26 Nov 2017 23:16:59 +0100 Subject: Makefile: Quote '$@' in make calls with double quotes. --- Makefile | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'Makefile') diff --git a/Makefile b/Makefile index 6e9479284..cfd0d10b8 100644 --- a/Makefile +++ b/Makefile @@ -61,12 +61,12 @@ NX_XTRANS_HEADERS = \ $(NULL) %: - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp "$@"; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy "$@"; fi if test -d nx-X11; then \ - if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib $@; fi; \ - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi; \ - if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 $@; fi; \ + if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib "$@"; fi; \ + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad "$@"; fi; \ + if test -f nx-X11/Makefile; then ${MAKE} -C nx-X11 "$@"; fi; \ fi # clean auto-generated files @@ -234,15 +234,15 @@ uninstall: [ ! -d nx-X11 ] || $(MAKE) uninstall-full uninstall-lite: - if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp $@; fi - if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy $@; fi + if test -f nxcomp/Makefile; then ${MAKE} -C nxcomp "$@"; fi + if test -f nxproxy/Makefile; then ${MAKE} -C nxproxy "$@"; fi $(RM_FILE) $(DESTDIR)$(PREFIX)/share/nx/VERSION.nxproxy $(RM_DIR) $(DESTDIR)$(PREFIX)/share/nx/ uninstall-full: - if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad $@; fi - if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib $@; fi + if test -f nxcompshad/Makefile; then ${MAKE} -C nxcompshad "$@"; fi + if test -f nx-X11/lib/Makefile; then ${MAKE} -C nx-X11/lib "$@"; fi $(RM_FILE) $(DESTDIR)$(BINDIR)/nxagent -- cgit v1.2.3